(()=>{var CKe=Object.create;var NAe=Object.defineProperty;var SKe=Object.getOwnPropertyDescriptor;var EKe=Object.getOwnPropertyNames;var OKe=Object.getPrototypeOf,AKe=Object.prototype.hasOwnProperty;var od=(o=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(o,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):o)(function(o){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')});var cp=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports);var _Ke=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of EKe(t))!AKe.call(o,i)&&i!==e&&NAe(o,i,{get:()=>t[i],enumerable:!(r=SKe(t,i))||r.enumerable});return o};var Ru=(o,t,e)=>(e=o!=null?CKe(OKe(o)):{},_Ke(t||!o||!o.__esModule?NAe(e,"default",{value:o,enumerable:!0}):e,o));var FAe=cp((Xwt,BAe)=>{var kAe=[];kAe.push(`<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>EasyEDA PCB</title>
		<style type="text/css">
			html,
			body {
				padding: 0px;
				margin: 0px;
				border: none;
				background-color: #000;
			}

			/*#root{position: absolute;left:0px;top:0px;}*/
			body > #root {
				position: absolute;
				left: 0px;
				top: 0px;
				margin: 0;
			}

			/*position is needed when put svg root on the body center,*/
		</style>
	</head>

	<body>
		<canvas id="canvas"></canvas>
	</body>
</html>
`);BAe.exports=kAe.join("")});var UAe=cp((qwt,GAe)=>{var j$=[];j$.push('body,html{background-color:#000}body>#root{left:0;margin:0;position:absolute;top:0}body,html{border:none;height:100%;margin:0;overflow:hidden;padding:0}body::-webkit-scrollbar{height:12px;width:12px}body::-webkit-scrollbar-track{border-radius:10px;-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,.3)}body::-webkit-scrollbar-thumb{background:rgba(205,227,255,.8);border:1px solid #62b0ff;border-radius:10px;-webkit-box-shadow:inset 0 0 6px rgba(98,176,255,.5)}body::-webkit-scrollbar-thumb:window-inactive{background:rgba(205,227,255,.4)}input:not([type])::-ms-clear,input[type=text]::-ms-clear{display:none}svg,text{-webkit-user-select:none;-moz-user-select:none;-o-user-select:none;user-select:none}text,tspan{-webkit-text-size-adjust:none}svg{overflow:hidden}.highlight [stroke=none],.highlight[stroke=none],.selected [stroke=none],.selected[stroke=none]{stroke-width:1;vector-effect:non-scaling-stroke}.hidetext g text{display:none}text{cursor:default}.hidetext text,text.hidetext{display:none}#gControlDots rect{shape-rendering:auto}#gControlDots circle{shape-rendering:auto;vector-effect:non-scaling-stroke}#gControlDots circle.light{fill:#aea}#gControlLines line,#gControlRects rect{fill:none;shape-rendering:auto;stroke:#00c;vector-effect:non-scaling-stroke}#gControlLines line:not([stroke-dasharray]),#gControlRects rect:not([stroke-dasharray]),#selectBox1{stroke-dasharray:3,3}#selectBox1{fill:none;shape-rendering:crispEdges}.bw-chrome.cursor-cross-red{cursor:none,crosshair}.cursor-none{cursor:none}.cursor-crosshair{cursor:crosshair}.cursor-row-resize{cursor:row-resize}.cursor-col-resize{cursor:col-resize}.cursor-zoom-in{cursor:-moz-zoom-in;cursor:-webkit-zoom-in;cursor:zoom-in}.cursor-zoom-out{cursor:-moz-zoom-out;cursor:-webkit-zoom-out;cursor:zoom-out}.events-all{pointer-events:all}#gridOH,#gridOV{shape-rendering:crispEdges}#gCurParts circle.pindot{fill:silver;fill-opacity:.6;stroke:none}#g1 circle.pindot{fill:none;pointer-events:fill;stroke:none}#g1 .selected circle.pindot{fill:silver;fill-opacity:.6;stroke:none}polyline[c_etype=wire].designManager_selected{stroke-width:3!important}g[c_partid=part_netLabel_text]>path{stroke:#5a5757;stroke-linecap:inherit}#g1 circle,#g1 ellipse,#g1 line,#g1 path,#g1 polygon,#g1 polyline,#g1 rect{shape-rendering:auto}#g1 path[d*=A],#g1 path[d*=C]{shape-rendering:initial}line,path,polygon,polyline{stroke-linecap:round;stroke-linejoin:round}#gCurParts *{shape-rendering:crispEdges}svg rect.hitbox{fill:none;pointer-events:all;stroke:none}#textBoxContainer{background-color:var(--bg-color-input);-o-box-shadow:0 0 10px 5px #666;box-shadow:0 0 10px 5px #666;font-size:12px;overflow:auto;padding:2px;position:absolute;resize:both}#textBoxContainer div.tip{color:#978e8e;margin-left:1px}#bodyPlaceholder{height:100px;margin:0;width:100px}.fixed-center{left:50%;position:fixed;top:-1000px;-moz-transform:translate(-50%);-webkit-transform:translate(-50%);transform:translate(-50%)}.one-time-tip{background-color:rgba(0,0,0,.5);color:#fff;font-family:Arial;padding:10px;top:10px}.one-time-tip .content{max-width:700px;white-space:nowrap}.one-time-tip em{color:#ff0}.one-time-tip .content+.content{margin-top:6px}.one-time-tip .btns{text-align:right}#g1 .fm-0{font-family:\u5B8B\u4F53}#g1 .fm-1{font-family:Times New Roman}#g1 .fm-2{font-family:Arial}#g1 .fm-3{font-family:helvetica}#g1 .fm-4{font-family:"sans-serif"}#g1 .fm-5{font-family:"monospace"}#g1 .fm-6{font-family:Tahoma}#g1 .fm-7{font-family:Courier New}#g1 .fm-8{font-family:MS Gothic}#g1 .fm-9{font-family:Arial Black}#g1 .fm-10{font-family:Arial Narrow}#g1 .fm-11{font-family:Verdana}#g1 .fw-normal{font-weight:400}#g1 .fw-bold{font-weight:700}#g1 .fw-bolder{font-weight:bolder}#g1 .fw-lighter{font-weight:lighter}#g1 .fw-1{font-weight:100}#g1 .fw-2{font-weight:200}#g1 .fw-3{font-weight:300}#g1 .fw-4{font-weight:400}#g1 .fw-5{font-weight:500}#g1 .fw-6{font-weight:600}#g1 .fw-7{font-weight:700}#g1 .fw-8{font-weight:800}#g1 .fw-9{font-weight:900}#g1 .stroke-width-1{stroke-width:1}#g1 .stroke-width-2{stroke-width:2}#g1 .stroke-width-3{stroke-width:3}#g1 .stroke-width-4{stroke-width:4}#g1 .stroke-width-5{stroke-width:5}#g1 .stroke-width-6{stroke-width:6}#g1 .stroke-width-7{stroke-width:7}#g1 .stroke-width-8{stroke-width:8}#g1 .stroke-width-9{stroke-width:9}#g1 .stroke-width-10{stroke-width:10}#g1 .stroke-dasharray-0{stroke-dasharray:0}#g1 .stroke-dasharray-1{stroke-dasharray:6,6}#g1 .stroke-dasharray-2{stroke-dasharray:3,10}#g1 .fs-4{font-size:4pt}#g1 .fs-05{font-size:5.5pt}#g1 .fs-065{font-size:6.5pt}#g1 .fs-7{font-size:7pt}#g1 .fs-075{font-size:7.5pt}#g1 .fs-8{font-size:8pt}#g1 .fs-9{font-size:9pt}#g1 .fs-10{font-size:10pt}#g1 .fs-11{font-size:11pt}#g1 .fs-12{font-size:12pt}#g1 .fs-14{font-size:14pt}#g1 .fs-16{font-size:16pt}#g1 .fs-18{font-size:18pt}#g1 .fs-20{font-size:20pt}#g1 .fs-22{font-size:22pt}#g1 .fs-24{font-size:24pt}#g1 .fs-26{font-size:26pt}#g1 .fs-28{font-size:28pt}#g1 .fs-36{font-size:36pt}#g1 .fs-48{font-size:48pt}#g1 .fs-72{font-size:72pt}#g1 .font-style-0{font-style:normal}#g1 .font-style-1{font-style:italic}#g1 .font-style-2{font-style:inherit}#g1 g[id^=frame_lib_]{pointer-events:none}#g1>g[id^=frame_lib_]>.editing{pointer-events:all}#g1 .objectUnSelected:not([c_partid^=part_lib_]),#g1 g[c_partid^=part_lib_].objectUnSelected :not([c_partid=part_annotation]):not([c_note=note_name]):not([c_partid=part_pin]):not([c_pinname]):not([c_pinnumber]),#g1 g[c_partid^=part_lib_]>g[c_partid=part_annotation].objectUnSelected,#g1 g[c_partid^=part_lib_]>g[c_partid=part_pin].objectUnSelected,.objectUnSelected:not([c_partid^=part_lib_]) *{pointer-events:none}.selected .net-guideline{display:inline;display:initial;stroke:#fff;stroke-dasharray:3,3}.is-draging .net-guideline,.net-guideline{display:none}');j$=j$.join("");function VAe(){let o=document.createElement("style");o.innerHTML=j$,document.head.appendChild(o)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",VAe):VAe();GAe.exports={root:"root",highlight:"highlight",selected:"selected",hidetext:"hidetext",gControlDots:"gControlDots",light:"light",gControlLines:"gControlLines",gControlRects:"gControlRects",selectBox1:"selectBox1","bw-chrome":"bw-chrome","cursor-cross-red":"cursor-cross-red","cursor-none":"cursor-none","cursor-crosshair":"cursor-crosshair","cursor-row-resize":"cursor-row-resize","cursor-col-resize":"cursor-col-resize","cursor-zoom-in":"cursor-zoom-in","cursor-zoom-out":"cursor-zoom-out","events-all":"events-all",gridOH:"gridOH",gridOV:"gridOV",gCurParts:"gCurParts",pindot:"pindot",g1:"g1",designManager_selected:"designManager_selected",hitbox:"hitbox",textBoxContainer:"textBoxContainer",tip:"tip",bodyPlaceholder:"bodyPlaceholder","fixed-center":"fixed-center","one-time-tip":"one-time-tip",content:"content",btns:"btns","fm-0":"fm-0","fm-1":"fm-1","fm-2":"fm-2","fm-3":"fm-3","fm-4":"fm-4","fm-5":"fm-5","fm-6":"fm-6","fm-7":"fm-7","fm-8":"fm-8","fm-9":"fm-9","fm-10":"fm-10","fm-11":"fm-11","fw-normal":"fw-normal","fw-bold":"fw-bold","fw-bolder":"fw-bolder","fw-lighter":"fw-lighter","fw-1":"fw-1","fw-2":"fw-2","fw-3":"fw-3","fw-4":"fw-4","fw-5":"fw-5","fw-6":"fw-6","fw-7":"fw-7","fw-8":"fw-8","fw-9":"fw-9","stroke-width-1":"stroke-width-1","stroke-width-2":"stroke-width-2","stroke-width-3":"stroke-width-3","stroke-width-4":"stroke-width-4","stroke-width-5":"stroke-width-5","stroke-width-6":"stroke-width-6","stroke-width-7":"stroke-width-7","stroke-width-8":"stroke-width-8","stroke-width-9":"stroke-width-9","stroke-width-10":"stroke-width-10","stroke-dasharray-0":"stroke-dasharray-0","stroke-dasharray-1":"stroke-dasharray-1","stroke-dasharray-2":"stroke-dasharray-2","fs-4":"fs-4","fs-05":"fs-05","fs-065":"fs-065","fs-7":"fs-7","fs-075":"fs-075","fs-8":"fs-8","fs-9":"fs-9","fs-10":"fs-10","fs-11":"fs-11","fs-12":"fs-12","fs-14":"fs-14","fs-16":"fs-16","fs-18":"fs-18","fs-20":"fs-20","fs-22":"fs-22","fs-24":"fs-24","fs-26":"fs-26","fs-28":"fs-28","fs-36":"fs-36","fs-48":"fs-48","fs-72":"fs-72","font-style-0":"font-style-0","font-style-1":"font-style-1","font-style-2":"font-style-2",editing:"editing",objectUnSelected:"objectUnSelected","net-guideline":"net-guideline","is-draging":"is-draging"}});var r2=cp((Qwt,JAe)=>{"use strict";var Kme=Object.defineProperty,vKe=Object.getOwnPropertyDescriptor,xKe=Object.getOwnPropertyNames,RKe=Object.prototype.hasOwnProperty,DKe=(o,t)=>{for(var e in t)Kme(o,e,{get:t[e],enumerable:!0})},wKe=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of xKe(t))!RKe.call(o,i)&&i!==e&&Kme(o,i,{get:()=>t[i],enumerable:!(r=vKe(t,i))||r.enumerable});return o},LKe=o=>wKe(Kme({},"__esModule",{value:!0}),o),zAe={};DKe(zAe,{BroadcastChannelMessageBus:()=>KKe,MessageBus:()=>YKe,MessageBus2:()=>qKe,MessageBusTask:()=>qme,MessageBusTask2:()=>LU,WindowMessageBridge:()=>zKe,WorkerMessageBridge:()=>WKe,createBroadcastP2PStream:()=>KAe,createBufferedByteBufferStream:()=>$Ae,createBufferedStream:()=>Qme,createBufferedStringStream:()=>qAe,dropP2PStream:()=>ZKe,flowRead:()=>QKe,flowWrite:()=>JKe});JAe.exports=LKe(zAe);var X$=class{constructor(o=1.5){this.growthFactor=o,this.capacity=10,this.buffer=new Array(this.capacity),this.head=0,this.tail=0,this.count=0}enqueue(o){if(this.count===this.capacity){let t=Math.floor(this.capacity*this.growthFactor);console.log("grow",this.capacity,t);let e=new Array(t);for(let r=0;r<this.count;r++)e[r]=this.buffer[(this.head+r)%this.capacity];this.buffer=e,this.head=0,this.tail=this.count,this.capacity=t}this.buffer[this.tail]=o,this.tail=(this.tail+1)%this.capacity,this.count++}dequeue(){if(this.isEmpty())return;let o=this.buffer[this.head];return this.head=(this.head+1)%this.capacity,this.count--,o}peek(){return this.buffer[this.head]}isEmpty(){return this.count===0}clear(){this.buffer.length=0,this.head=0,this.tail=0,this.count=0}},Zme=new ArrayBuffer(8),Kwt=new Float64Array(Zme),Zwt=new Uint32Array(Zme),Jwt=new Uint16Array(Zme),Xme=ArrayBuffer;try{Xme=self.HTMLImageElement||Xme}catch{}var MKe=typeof SharedArrayBuffer<"u";function q$(o){if(typeof o!="object"||o===null||o instanceof Date||o instanceof ArrayBuffer||MKe&&o instanceof SharedArrayBuffer||o instanceof Blob||o instanceof FormData||o instanceof Function||o instanceof Uint8ClampedArray||o instanceof Xme)return o;if(Array.isArray(o))return o.map(q$);{let t={};for(let e in o)Object.hasOwnProperty.call(o,e)&&(t[e]=q$(o[e]));return t}}function jme(o,t){return NKe(o,t,()=>[])}function NKe(o,t,e){let r=o[t];return r!==void 0||(r=e(t),o[t]=r),r}var kKe=class{constructor(o){this.maxResources=o,this.idle=new X$,this.isClosed=!1,this.resources=o}acquire(o){this.isClosed?Promise.resolve(!1).then(o):this.resources>0?(this.resources--,Promise.resolve(!0).then(o)):this.idle.enqueue(o)}acquireSync(){return new Promise(o=>{this.acquire(o)})}release(){if(!this.isClosed){let o=this.idle.dequeue();o?Promise.resolve(!0).then(o):this.resources++}}close(){if(!this.isClosed)for(this.isClosed=!0;!this.idle.isEmpty();){let o=this.idle.dequeue();Promise.resolve(!1).then(o)}}};function BKe(){if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof globalThis<"u")return globalThis;if(typeof global<"u")return global}function FKe(o,t){let e=0,r=o.length;for(let i=0;i<r;i++)o[i]===t&&(o.splice(i,1),i--,r--,e++);return e}var VKe=BKe(),GKe=VKe.WeakRef||(o=>o);function rw(o){if(o!=null){if(typeof o=="object")return new GKe(o);console.error(o,o instanceof Object,typeof o);return}}function y_(o){return o==null?void 0:o.deref()}var UKe="_MSG_BUS_RPC_",Jme=300*1e3,HKe=(o=>(o.PUBLISH="publish",o.SUBSCRIBE="subscribe",o.PUSH="push",o.PULL="pull",o))(HKe||{}),YAe=class{constructor(o){this.bus=o}processRemoteMessage(o,t){let e=rw(t),r=o.topic,i=o.type,n=o.message;switch(i){case"pull":this.bus.pull(r,s=>{this.push(r,s,y_(e))});break;case"subscribe":this.bus.subscribe(r,s=>{this.publish(r,s,y_(e))});break;case"publish":this.bus.publish(r,n,this,y_(e));break;case"push":this.bus.push(r,n,this,y_(e));break;default:console.debug("unknown message type "+i)}}rpcCall(o,t,e,r=Jme){let i=rw(e),n=new Promise(s=>{let a=this.bus.uniqueRpcTopic(o);this.publish(o,{message:t,reply:a},y_(i)),this.bus.pull(a,(l,c,h)=>{s({message:l,bridge:c,source:rw(h)})})});return r>0?Promise.race([n,new Promise((s,a)=>{setTimeout(a,r)})]):n}},WKe=class extends YAe{constructor(o,t){super(o),this.worker=t,t.onmessage=e=>{this.processRemoteMessage(e.data,void 0)}}publish(o,t){this.postMessage(o,"publish",t)}subscribe(o){this.postMessage(o,"subscribe",null)}push(o,t){this.postMessage(o,"push",t)}pull(o){this.postMessage(o,"pull",null)}rpcCall(o,t,e=Jme){return super.rpcCall(o,t,void 0,e)}postMessage(o,t,e){let r={topic:o,type:t,message:e};this.worker.postMessage(r)}discard(){this.worker.terminate()}},zKe=class extends YAe{constructor(o){super(o),window.addEventListener("message",t=>{this.processRemoteMessage(t.data,t.source)},!1)}publish(o,t,e){this.postMessage(o,"publish",t,e)}subscribe(o,t){if(t===window)throw new Error("regist remote subscribe from current window is not permitted");this.postMessage(o,"subscribe",null,t)}push(o,t,e){this.postMessage(o,"push",t,e)}pull(o,t){if(t===window)throw new Error("regist remote pull from current window is not permitted");this.postMessage(o,"pull",null,t)}postMessage(o,t,e,r){let i={topic:o,type:t,message:e};r&&r.postMessage(i,"*")}},qme=class{constructor(o){this.isRunning=!0,this.callback=o}cancel(){this.callback=null,this.isRunning=!1}running(){return this.isRunning}execute(o,t,e,r){try{o=r?o:q$(o),this.callback(o,t,e)}catch(i){console.error(i)}}},YKe=class{constructor(o=!1){this.subscribed={},this.pulled={},this.pushed={},this.uuid=crypto.randomUUID().replace(/-/g,""),this.rpcTicket=0,this.unsafe=o}uniqueRpcTopic(o){return`${UKe}-${o}-${this.uuid}-${this.rpcTicket++}`}publish(o,t,e,r){let i=this.subscribed[o];if(i){let n;for(let s of i)s.running()?s.execute(t,e,r,this.unsafe):(n=n||new Array,n.push(s));if(n)for(let s of n)FKe(i,s)}else console.debug("no sub on topic: "+o)}subscribe(o,t){let e=new qme(t);return jme(this.subscribed,o).push(e),e}push(o,t,e,r){let i=!1,n=this.pulled[o];if(n){for(;n.length>0;){let s=n.shift();if(s.running()){s.execute(t,e,r,this.unsafe),i=!0;break}}n.length===0&&delete this.pulled[o]}i||jme(this.pushed,o).push({message:t,bridge:e,source:rw(r)})}pull(o,t){let e=new qme(t),r=this.pushed[o];if(r){let i=r.shift();e.execute(i.message,i.bridge,y_(i.source),this.unsafe),r.length===0&&delete this.pushed[o]}else jme(this.pulled,o).push(e);return e}pullA(o){return new Promise(t=>{this.pull(o,(e,r,i)=>{t({message:e,bridge:r,source:rw(i)})})})}rpcService(o,t){this.subscribe(o,(e,r,i)=>{let{message:n,reply:s}=e;try{let a=t(n);if(a instanceof Promise){let l=rw(i);a.then(c=>{this.rpcReply(c,s,r,y_(l))},c=>{console.error(c),this.rpcReply(void 0,s,r,y_(l))})}else this.rpcReply(a,s,r,i)}catch(a){console.error(a),this.rpcReply(void 0,s,r,i)}})}rpcCall(o,t,e=Jme){let r=new Promise(i=>{let n=this.uniqueRpcTopic(o);this.publish(o,{message:t,reply:n}),this.pull(n,(s,a,l)=>{i({message:s,bridge:a,source:rw(l)})})});return e>0?Promise.race([r,new Promise((i,n)=>{setTimeout(n,e)})]):r}rpcReply(o,t,e,r){e?e.push(t,o,r):this.push(t,o)}},jKe="_MSG_BUS_RPC_";function $me(o,t){let e=0,r=o.length;for(let i=0;i<r;i++)o[i]===t&&(o.splice(i,1),i--,r--,e++);return e}function t7(o,t){return XKe(o,t,()=>[])}function XKe(o,t,e){let r=o[t];return r!==void 0||(r=e(t),o[t]=r),r}var LU=class{constructor(o,t){this.callback=o,this.unsafe=t,this.isRunning=!0}cancel(){this.callback=null,this.isRunning=!1}running(){return this.isRunning}async execute(o){try{o=this.unsafe?o:q$(o),this.callback(o)}catch(t){console.error(t)}}},jAe=class{constructor(o=crypto.randomUUID()){this.uuid=o,this.rpcTicket=0}subscribeOnce(o,t){let e=this.subscribe(o,r=>{e.cancel(),t(r)});return e}pullA(o){return new Promise(t=>{this.pull(o,t)})}rpcService(o,t){let e=r=>{try{let{message:i,replyTopic:n}=r;try{let s=t(i);s instanceof Promise?s.then(a=>{this.publish(n,{success:!0,result:a})}).catch(a=>{console.error(a),this.publish(n,{success:!1,err:String(a)})}):this.publish(n,{success:!0,result:s})}catch(s){this.publish(n,{success:!1,err:String(s)})}}finally{this.pull(o,e)}};this.pull(o,e)}rpcCall(o,t,e=0){let r=new Promise((i,n)=>{let s=`${jKe}-${o}-${this.uuid}-${this.rpcTicket++}`;this.subscribeOnce(s,a=>{a.success?i(a.result):n(new Error(a.err))}),this.push(o,{message:t,replyTopic:s})});return e>0?Promise.race([r,new Promise((i,n)=>{setTimeout(n,e)})]):r}},qKe=class extends jAe{constructor(o=!1){super(),this.unsafe=o,this.subscribed={},this.pulled={},this.pushed={}}publish(o,t){let e=this.subscribed[o];if(e){let r;for(let i of e)i.running()?i.execute(t):(r=r||new Array,r.push(i));if(r)for(let i of r)$me(e,i)}}subscribe(o,t){let e=new LU(t,this.unsafe);return t7(this.subscribed,o).push(e),e}push(o,t){let e=!1,r=this.pulled[o];if(r){for(;r.length>0;){let i=r.shift();if(i&&i.running()){i.execute(t),e=!0;break}}r.length===0&&delete this.pulled[o]}e||t7(this.pushed,o).push(t)}pull(o,t){let e=new LU(t,this.unsafe);return this.repull(o,e),e}repull(o,t){let e=this.pushed[o];if(e){let r=e.shift();r&&(t.execute(r),e.length===0&&delete this.pushed[o])}else t7(this.pulled,o).push(t)}},$Ke=class extends jAe{constructor(o=crypto.randomUUID()){super(o),this.subscribed={},this.pushed={},this.pulled={},this.pushCnt=0}publish(o,t){console.debug("BC",this.uuid,"PUBLISH",o,t),this.broadcastPublish(o,t)}subscribe(o,t){console.debug("BC",this.uuid,"SUBSCRIBE",o);let e=new LU(t,!0);return t7(this.subscribed,o).push(e),e}push(o,t){let e=this.pushCnt++;console.debug("BC",this.uuid,"PUSH",o,`(${e})`,t),t7(this.pushed,o).push({id:e,message:t}),this.broadcastPushedHeadMessage(o)}pull(o,t){console.debug("BC",this.uuid,"PULL",o);let e=new LU(t,!0);return t7(this.pulled,o).push(e),this.broadcastWhoHas(o),e}broadcastPushedHeadMessage(o){let t=this.pushed[o];t&&t[0]&&this.broadcastIHave(o,t[0].id)}onReceivedPublish(o,t,e){console.debug("BCMSG(",this.uuid,")","from",o,"PUBLISH",t,"message",e);let r=this.subscribed[t];if(r){let i;for(let n of r)n.running()?n.execute(e):(i=i||new Array,i.push(n));if(i)for(let n of i)$me(r,n);r.length===0&&delete this.subscribed[t]}}onReceivedWhoHas(o,t){console.debug("BCMSG(",this.uuid,")","from",o,"WHOHAS",t),this.broadcastPushedHeadMessage(t)}onReceivedIHave(o,t,e){console.debug("BCMSG(",this.uuid,")","from",o,"IHAVE",t,"id",e);let r=this.pulled[t];if(r){let i;for(let n of r)if(n.running()){this.broadcastINeed(t,o,e);break}else i=i||new Array,i.push(n);if(i)for(let n of i)$me(r,n);r.length===0&&delete this.pulled[t]}}onReceivedINeed(o,t,e,r){if(console.debug("BCMSG(",this.uuid,")","from",o,"INEED",t,"source",e,"id",r),this.uuid===e){let i=this.pushed[t];if(i&&i[0]&&i[0].id===r){let{message:n}=i.shift();this.broadcastIGive(t,r,o,n),this.broadcastPushedHeadMessage(t),i.length===0&&delete this.pushed[t]}}}onReceivedIGive(o,t,e,r,i){console.debug("BCMSG(",this.uuid,")","from",o,"IGIVE",t,"id",e,"target",r,"message",i);let n=this.pulled[t];if(n&&this.uuid===r){let s=!1;for(;n.length>0;){let a=n.shift();if(a.running()){a.execute(i),s=!0;break}}s||this.push(t,i),n.length===0&&delete this.pulled[t]}}},KKe=class extends $Ke{constructor(o,t=crypto.randomUUID()){super(t),this.bc=new BroadcastChannel(o),this.bc.onmessage=e=>{this.onMessage(e.data)}}onMessage(o){let{type:t,uuid:e,topic:r}=o;switch(t){case"PUBLISH":{let{message:i}=o;this.onReceivedPublish(e,r,i);break}case"WHOHAS":{this.onReceivedWhoHas(e,r);break}case"IHAVE":{let{id:i}=o;this.onReceivedIHave(e,r,i);break}case"INEED":{let{source:i,id:n}=o;this.onReceivedINeed(e,r,i,n);break}case"IGIVE":{let{target:i,id:n,message:s}=o;this.onReceivedIGive(e,r,n,i,s);break}default:console.warn("unsupported",o)}}broadcastPublish(o,t){this.post({type:"PUBLISH",uuid:this.uuid,topic:o,message:t})}broadcastWhoHas(o){this.post({type:"WHOHAS",uuid:this.uuid,topic:o})}broadcastIHave(o,t){this.post({type:"IHAVE",uuid:this.uuid,topic:o,id:t})}broadcastINeed(o,t,e){this.post({type:"INEED",uuid:this.uuid,topic:o,source:t,id:e})}broadcastIGive(o,t,e,r){this.post({type:"IGIVE",uuid:this.uuid,topic:o,id:t,target:e,message:r})}post(o){this.bc.postMessage(o),Promise.resolve().then(()=>{this.onMessage(o)})}},r7=Symbol("BLOCKING_QUEUE_RESET"),XAe=class{constructor(o,t=()=>1){if(this.maxSize=o,this.itemSizeOf=t,this.queue=new X$,this.waitingConsumers=new X$,this.waitingProducers=new X$,this.queueSize=0,this.closePromise=null,this.closeResolve=null,o<=0)throw new Error("Max size must be greater than 0")}enqueue(o){return this.closePromise?!1:this.isFull()?(async()=>{console.debug("queue is full",this.queueSize,this.maxSize);let t=await new Promise(e=>{this.waitingProducers.enqueue(e)});return console.debug("queue is not full",this.size(),t),t?(this.innerEnqueue(o),!0):!1})():(this.innerEnqueue(o),!0)}innerEnqueue(o){if(this.waitingConsumers.isEmpty())this.queue.enqueue(o),this.queueSize+=this.itemSizeOf(o),console.debug("queue pushed",o,"size",this.queueSize);else{let t=this.waitingConsumers.dequeue();Promise.resolve(o).then(t),console.debug("queue direct",o,"size",this.queueSize)}}dequeue(){if(this.queue.isEmpty())if(this.closePromise){for(;!this.waitingConsumers.isEmpty();){let o=this.waitingConsumers.dequeue();Promise.resolve(r7).then(o)}return setTimeout(()=>this.closeResolve(),0),r7}else return new Promise(o=>{this.waitingConsumers.enqueue(o)});else{let o=this.queue.dequeue();if(this.queueSize-=this.itemSizeOf(o),!this.waitingProducers.isEmpty()){let t=this.waitingProducers.dequeue();Promise.resolve(!0).then(t)}return o}}size(){return this.queueSize}isEmpty(){return this.queueSize===0}isFull(){return this.queueSize>=this.maxSize}close(){return this.closePromise||(this.closePromise=new Promise(o=>{for(this.closeResolve=o;!this.waitingProducers.isEmpty();){let t=this.waitingProducers.dequeue();Promise.resolve(!1).then(t)}if(this.queueSize===0){for(;!this.waitingConsumers.isEmpty();){let t=this.waitingConsumers.dequeue();Promise.resolve(r7).then(t)}o()}})),this.closePromise}};function Qme(o,t,e=Number.MAX_SAFE_INTEGER){let r=new XAe(e,t),i=new ReadableStream({pull(s){let a=!0,l=(async()=>{let c=new Array;do{let h=r.dequeue();if(h instanceof Promise){a=!1;let u=await h;u===r7?s.close():c.push(u)}else{let u=h;u===r7?s.close():c.push(u)}}while(r.size()>0);if(c.length>0){let h=o(c);s.enqueue(h)}})();if(!a)return console.debug("read stream stucked --------------------------------------"),l},async cancel(){console.debug("buffered readable cancel"),await r.close()}}),n=new WritableStream({write(s,a){let l=!0,c=(async()=>{let h=r.enqueue(s);typeof h=="boolean"?h||a.error(new Error("Write stream closed")):(l=!1,await h||a.error(new Error("Write stream closed")))})();if(!l)return console.debug("read stream stucked >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"),c},async close(){console.debug("buffered writable closing",r.size()),await r.close(),console.debug("buffered writable closed",r.size())},async abort(){console.debug("buffered writable aborting",r.size()),await r.close(),console.debug("buffered writable aborted",r.size())}});return{readable:i,writable:n}}function qAe(o=Number.MAX_SAFE_INTEGER){return Qme(t=>t.join(""),t=>t.length,o)}function $Ae(o=Number.MAX_SAFE_INTEGER){return Qme(t=>{let e=new Uint8Array(t.reduce((i,n)=>i+n.byteLength,0)),r=0;return t.forEach(i=>{e.set(i,r),r+=i.byteLength}),e},t=>t.byteLength,o)}function KAe(o){return new Promise((t,e)=>{let r=new BroadcastChannel(o),i=new XAe(1),n=new kKe(1),s=null,a=!1,l=!1,c=!1;r.onmessage=h=>{let u=h.data,{type:d}=u;if(console.debug("p2p",o,"type",d,"data",d==="DATA"&&u.data),d==="DATA")i.enqueue(u.data);else if(d==="HI"){if(!s){r.postMessage({type:"HI"});let y=0;s={rs:new ReadableStream({async pull(b){let P=await i.dequeue();P===r7?(await m(),b.close()):(b.enqueue(P),r.postMessage({type:"ACK"}))},cancel(){return m()}}),ws:new WritableStream({async write(b,P){await n.acquireSync()?r.postMessage({type:"DATA",id:y++,data:b}):(p(),P.error(new Error("Write stream closed")))},close(){p()},abort(){p()}})},t(s)}}else d==="REND"?s?n.close():g("REND1"):d==="WEND"?s?i.close():g("WEND1"):d==="ACK"&&n.release();function p(){a||(a=!0,console.debug(o,"p2p write stream closed"),n.close(),r.postMessage({type:"WEND"}),l&&(console.debug(o,"p2p channel closed on ws"),r.close()))}async function m(){l||(l=!0,console.debug(o,"p2p read stream closed"),r.postMessage({type:"REND"}),await i.close(),a&&(console.debug(o,"p2p channel closed on rs"),r.close()))}async function g(y){c||(c=!0,console.debug(o,"p2p channel connection released on",y),n.close(),i.close(),s?(s.rs.locked||(console.debug(o,"p2p unlocked read stream direct cancel"),s.rs.cancel()),s.ws.locked||(console.debug(o,"p2p unlocked write stream direct close"),s.ws.close())):(r.postMessage({type:"HI"}),r.close()),e(new Error("p2p channel connection released")))}},r.postMessage({type:"HI"})})}function ZKe(o){return new Promise(t=>{let e=new BroadcastChannel(o);e.onmessage=r=>{let i=r.data,{type:n}=i;n==="HI"&&(e.postMessage({type:"REND"}),e.close(),t())},e.postMessage({type:"REND"})})}async function ZAe(o){try{return await KAe(o)}catch(t){t.message!=="p2p channel connection released"&&console.error(t)}}async function JKe(o,t,e=10*1024*1024,r=!0){let i=await ZAe(o);if(!i)return!1;let n=!1;try{let s,a=l=>{if(!s)if(!r)s=i.ws.getWriter();else if(typeof l=="string"){let c=qAe(e);c.readable.pipeTo(i.ws),s=c.writable.getWriter()}else{let c=$Ae(e);c.readable.pipeTo(i.ws),s=c.writable.getWriter()}return s.write(l)};if(Array.isArray(t))for(let l of t)await a(l);else await t({write:a,get desiredSize(){return((s==null?void 0:s.desiredSize)||0)+10}});s&&await s.close(),n=!0}catch(s){console.error(s)}finally{return i.rs.cancel(),n}}async function QKe(o,t){var r,i;let e=await ZAe(o);if(e)try{let n=e.rs.getReader();for((r=t.start)==null?void 0:r.call(t);;){let{value:s,done:a}=await n.read();if(s!==void 0){let l;if(t.update instanceof Promise?l=await t.update(s):l=t.update(s),l){await n.cancel();break}}if(a){(i=t.end)==null||i.call(t);break}}}catch(n){console.error(n)}finally{e.ws.close()}}});var JBe=cp((wIr,ZBe)=>{(function(){var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t={rotl:function(e,r){return e<<r|e>>>32-r},rotr:function(e,r){return e<<32-r|e>>>r},endian:function(e){if(e.constructor==Number)return t.rotl(e,8)&16711935|t.rotl(e,24)&4278255360;for(var r=0;r<e.length;r++)e[r]=t.endian(e[r]);return e},randomBytes:function(e){for(var r=[];e>0;e--)r.push(Math.floor(Math.random()*256));return r},bytesToWords:function(e){for(var r=[],i=0,n=0;i<e.length;i++,n+=8)r[n>>>5]|=e[i]<<24-n%32;return r},wordsToBytes:function(e){for(var r=[],i=0;i<e.length*32;i+=8)r.push(e[i>>>5]>>>24-i%32&255);return r},bytesToHex:function(e){for(var r=[],i=0;i<e.length;i++)r.push((e[i]>>>4).toString(16)),r.push((e[i]&15).toString(16));return r.join("")},hexToBytes:function(e){for(var r=[],i=0;i<e.length;i+=2)r.push(parseInt(e.substr(i,2),16));return r},bytesToBase64:function(e){for(var r=[],i=0;i<e.length;i+=3)for(var n=e[i]<<16|e[i+1]<<8|e[i+2],s=0;s<4;s++)i*8+s*6<=e.length*8?r.push(o.charAt(n>>>6*(3-s)&63)):r.push("=");return r.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/ig,"");for(var r=[],i=0,n=0;i<e.length;n=++i%4)n!=0&&r.push((o.indexOf(e.charAt(i-1))&Math.pow(2,-2*n+8)-1)<<n*2|o.indexOf(e.charAt(i))>>>6-n*2);return r}};ZBe.exports=t})()});var TIe=cp((LIr,QBe)=>{var PIe={utf8:{stringToBytes:function(o){return PIe.bin.stringToBytes(unescape(encodeURIComponent(o)))},bytesToString:function(o){return decodeURIComponent(escape(PIe.bin.bytesToString(o)))}},bin:{stringToBytes:function(o){for(var t=[],e=0;e<o.length;e++)t.push(o.charCodeAt(e)&255);return t},bytesToString:function(o){for(var t=[],e=0;e<o.length;e++)t.push(String.fromCharCode(o[e]));return t.join("")}}};QBe.exports=PIe});var r8e=cp((MIr,t8e)=>{t8e.exports=function(o){return o!=null&&(e8e(o)||mSt(o)||!!o._isBuffer)};function e8e(o){return!!o.constructor&&typeof o.constructor.isBuffer=="function"&&o.constructor.isBuffer(o)}function mSt(o){return typeof o.readFloatLE=="function"&&typeof o.slice=="function"&&e8e(o.slice(0,0))}});var gY=cp((NIr,i8e)=>{(function(){var o=JBe(),t=TIe().utf8,e=r8e(),r=TIe().bin,i=function(n,s){n.constructor==String?s&&s.encoding==="binary"?n=r.stringToBytes(n):n=t.stringToBytes(n):e(n)?n=Array.prototype.slice.call(n,0):!Array.isArray(n)&&n.constructor!==Uint8Array&&(n=n.toString());for(var a=o.bytesToWords(n),l=n.length*8,c=1732584193,h=-271733879,u=-1732584194,d=271733878,p=0;p<a.length;p++)a[p]=(a[p]<<8|a[p]>>>24)&16711935|(a[p]<<24|a[p]>>>8)&4278255360;a[l>>>5]|=128<<l%32,a[(l+64>>>9<<4)+14]=l;for(var m=i._ff,g=i._gg,y=i._hh,b=i._ii,p=0;p<a.length;p+=16){var P=c,T=h,I=u,C=d;c=m(c,h,u,d,a[p+0],7,-680876936),d=m(d,c,h,u,a[p+1],12,-389564586),u=m(u,d,c,h,a[p+2],17,606105819),h=m(h,u,d,c,a[p+3],22,-1044525330),c=m(c,h,u,d,a[p+4],7,-176418897),d=m(d,c,h,u,a[p+5],12,1200080426),u=m(u,d,c,h,a[p+6],17,-1473231341),h=m(h,u,d,c,a[p+7],22,-45705983),c=m(c,h,u,d,a[p+8],7,1770035416),d=m(d,c,h,u,a[p+9],12,-1958414417),u=m(u,d,c,h,a[p+10],17,-42063),h=m(h,u,d,c,a[p+11],22,-1990404162),c=m(c,h,u,d,a[p+12],7,1804603682),d=m(d,c,h,u,a[p+13],12,-40341101),u=m(u,d,c,h,a[p+14],17,-1502002290),h=m(h,u,d,c,a[p+15],22,1236535329),c=g(c,h,u,d,a[p+1],5,-165796510),d=g(d,c,h,u,a[p+6],9,-1069501632),u=g(u,d,c,h,a[p+11],14,643717713),h=g(h,u,d,c,a[p+0],20,-373897302),c=g(c,h,u,d,a[p+5],5,-701558691),d=g(d,c,h,u,a[p+10],9,38016083),u=g(u,d,c,h,a[p+15],14,-660478335),h=g(h,u,d,c,a[p+4],20,-405537848),c=g(c,h,u,d,a[p+9],5,568446438),d=g(d,c,h,u,a[p+14],9,-1019803690),u=g(u,d,c,h,a[p+3],14,-187363961),h=g(h,u,d,c,a[p+8],20,1163531501),c=g(c,h,u,d,a[p+13],5,-1444681467),d=g(d,c,h,u,a[p+2],9,-51403784),u=g(u,d,c,h,a[p+7],14,1735328473),h=g(h,u,d,c,a[p+12],20,-1926607734),c=y(c,h,u,d,a[p+5],4,-378558),d=y(d,c,h,u,a[p+8],11,-2022574463),u=y(u,d,c,h,a[p+11],16,1839030562),h=y(h,u,d,c,a[p+14],23,-35309556),c=y(c,h,u,d,a[p+1],4,-1530992060),d=y(d,c,h,u,a[p+4],11,1272893353),u=y(u,d,c,h,a[p+7],16,-155497632),h=y(h,u,d,c,a[p+10],23,-1094730640),c=y(c,h,u,d,a[p+13],4,681279174),d=y(d,c,h,u,a[p+0],11,-358537222),u=y(u,d,c,h,a[p+3],16,-722521979),h=y(h,u,d,c,a[p+6],23,76029189),c=y(c,h,u,d,a[p+9],4,-640364487),d=y(d,c,h,u,a[p+12],11,-421815835),u=y(u,d,c,h,a[p+15],16,530742520),h=y(h,u,d,c,a[p+2],23,-995338651),c=b(c,h,u,d,a[p+0],6,-198630844),d=b(d,c,h,u,a[p+7],10,1126891415),u=b(u,d,c,h,a[p+14],15,-1416354905),h=b(h,u,d,c,a[p+5],21,-57434055),c=b(c,h,u,d,a[p+12],6,1700485571),d=b(d,c,h,u,a[p+3],10,-1894986606),u=b(u,d,c,h,a[p+10],15,-1051523),h=b(h,u,d,c,a[p+1],21,-2054922799),c=b(c,h,u,d,a[p+8],6,1873313359),d=b(d,c,h,u,a[p+15],10,-30611744),u=b(u,d,c,h,a[p+6],15,-1560198380),h=b(h,u,d,c,a[p+13],21,1309151649),c=b(c,h,u,d,a[p+4],6,-145523070),d=b(d,c,h,u,a[p+11],10,-1120210379),u=b(u,d,c,h,a[p+2],15,718787259),h=b(h,u,d,c,a[p+9],21,-343485551),c=c+P>>>0,h=h+T>>>0,u=u+I>>>0,d=d+C>>>0}return o.endian([c,h,u,d])};i._ff=function(n,s,a,l,c,h,u){var d=n+(s&a|~s&l)+(c>>>0)+u;return(d<<h|d>>>32-h)+s},i._gg=function(n,s,a,l,c,h,u){var d=n+(s&l|a&~l)+(c>>>0)+u;return(d<<h|d>>>32-h)+s},i._hh=function(n,s,a,l,c,h,u){var d=n+(s^a^l)+(c>>>0)+u;return(d<<h|d>>>32-h)+s},i._ii=function(n,s,a,l,c,h,u){var d=n+(a^(s|~l))+(c>>>0)+u;return(d<<h|d>>>32-h)+s},i._blocksize=16,i._digestsize=16,i8e.exports=function(n,s){if(n==null)throw new Error("Illegal argument "+n);var a=o.wordsToBytes(i(n,s));return s&&s.asBytes?a:s&&s.asString?r.bytesToString(a):o.bytesToHex(a)}})()});var vA=cp(x2=>{"use strict";var rEt=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function iEt(o,t){return Object.prototype.hasOwnProperty.call(o,t)}x2.assign=function(o){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(var r in e)iEt(e,r)&&(o[r]=e[r])}}return o};x2.shrinkBuf=function(o,t){return o.length===t?o:o.subarray?o.subarray(0,t):(o.length=t,o)};var nEt={arraySet:function(o,t,e,r,i){if(t.subarray&&o.subarray){o.set(t.subarray(e,e+r),i);return}for(var n=0;n<r;n++)o[i+n]=t[e+n]},flattenChunks:function(o){var t,e,r,i,n,s;for(r=0,t=0,e=o.length;t<e;t++)r+=o[t].length;for(s=new Uint8Array(r),i=0,t=0,e=o.length;t<e;t++)n=o[t],s.set(n,i),i+=n.length;return s}},oEt={arraySet:function(o,t,e,r,i){for(var n=0;n<r;n++)o[i+n]=t[e+n]},flattenChunks:function(o){return[].concat.apply([],o)}};x2.setTyped=function(o){o?(x2.Buf8=Uint8Array,x2.Buf16=Uint16Array,x2.Buf32=Int32Array,x2.assign(x2,nEt)):(x2.Buf8=Array,x2.Buf16=Array,x2.Buf32=Array,x2.assign(x2,oEt))};x2.setTyped(rEt)});var $Ge=cp(NF=>{"use strict";var sEt=vA(),aEt=4,_Ge=0,vGe=1,lEt=2;function MF(o){for(var t=o.length;--t>=0;)o[t]=0}var cEt=0,MGe=1,hEt=2,uEt=3,dEt=258,MSe=29,Zj=256,Xj=Zj+1+MSe,LF=30,NSe=19,NGe=2*Xj+1,P6=15,vSe=16,pEt=7,kSe=256,kGe=16,BGe=17,FGe=18,wSe=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],nse=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],fEt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],VGe=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],mEt=512,xA=new Array((Xj+2)*2);MF(xA);var jj=new Array(LF*2);MF(jj);var qj=new Array(mEt);MF(qj);var $j=new Array(dEt-uEt+1);MF($j);var BSe=new Array(MSe);MF(BSe);var ose=new Array(LF);MF(ose);function xSe(o,t,e,r,i){this.static_tree=o,this.extra_bits=t,this.extra_base=e,this.elems=r,this.max_length=i,this.has_stree=o&&o.length}var GGe,UGe,HGe;function RSe(o,t){this.dyn_tree=o,this.max_code=0,this.stat_desc=t}function WGe(o){return o<256?qj[o]:qj[256+(o>>>7)]}function Kj(o,t){o.pending_buf[o.pending++]=t&255,o.pending_buf[o.pending++]=t>>>8&255}function Wb(o,t,e){o.bi_valid>vSe-e?(o.bi_buf|=t<<o.bi_valid&65535,Kj(o,o.bi_buf),o.bi_buf=t>>vSe-o.bi_valid,o.bi_valid+=e-vSe):(o.bi_buf|=t<<o.bi_valid&65535,o.bi_valid+=e)}function Y3(o,t,e){Wb(o,e[t*2],e[t*2+1])}function zGe(o,t){var e=0;do e|=o&1,o>>>=1,e<<=1;while(--t>0);return e>>>1}function gEt(o){o.bi_valid===16?(Kj(o,o.bi_buf),o.bi_buf=0,o.bi_valid=0):o.bi_valid>=8&&(o.pending_buf[o.pending++]=o.bi_buf&255,o.bi_buf>>=8,o.bi_valid-=8)}function yEt(o,t){var e=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,n=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,l=t.stat_desc.max_length,c,h,u,d,p,m,g=0;for(d=0;d<=P6;d++)o.bl_count[d]=0;for(e[o.heap[o.heap_max]*2+1]=0,c=o.heap_max+1;c<NGe;c++)h=o.heap[c],d=e[e[h*2+1]*2+1]+1,d>l&&(d=l,g++),e[h*2+1]=d,!(h>r)&&(o.bl_count[d]++,p=0,h>=a&&(p=s[h-a]),m=e[h*2],o.opt_len+=m*(d+p),n&&(o.static_len+=m*(i[h*2+1]+p)));if(g!==0){do{for(d=l-1;o.bl_count[d]===0;)d--;o.bl_count[d]--,o.bl_count[d+1]+=2,o.bl_count[l]--,g-=2}while(g>0);for(d=l;d!==0;d--)for(h=o.bl_count[d];h!==0;)u=o.heap[--c],!(u>r)&&(e[u*2+1]!==d&&(o.opt_len+=(d-e[u*2+1])*e[u*2],e[u*2+1]=d),h--)}}function YGe(o,t,e){var r=new Array(P6+1),i=0,n,s;for(n=1;n<=P6;n++)r[n]=i=i+e[n-1]<<1;for(s=0;s<=t;s++){var a=o[s*2+1];a!==0&&(o[s*2]=zGe(r[a]++,a))}}function bEt(){var o,t,e,r,i,n=new Array(P6+1);for(e=0,r=0;r<MSe-1;r++)for(BSe[r]=e,o=0;o<1<<wSe[r];o++)$j[e++]=r;for($j[e-1]=r,i=0,r=0;r<16;r++)for(ose[r]=i,o=0;o<1<<nse[r];o++)qj[i++]=r;for(i>>=7;r<LF;r++)for(ose[r]=i<<7,o=0;o<1<<nse[r]-7;o++)qj[256+i++]=r;for(t=0;t<=P6;t++)n[t]=0;for(o=0;o<=143;)xA[o*2+1]=8,o++,n[8]++;for(;o<=255;)xA[o*2+1]=9,o++,n[9]++;for(;o<=279;)xA[o*2+1]=7,o++,n[7]++;for(;o<=287;)xA[o*2+1]=8,o++,n[8]++;for(YGe(xA,Xj+1,n),o=0;o<LF;o++)jj[o*2+1]=5,jj[o*2]=zGe(o,5);GGe=new xSe(xA,wSe,Zj+1,Xj,P6),UGe=new xSe(jj,nse,0,LF,P6),HGe=new xSe(new Array(0),fEt,0,NSe,pEt)}function jGe(o){var t;for(t=0;t<Xj;t++)o.dyn_ltree[t*2]=0;for(t=0;t<LF;t++)o.dyn_dtree[t*2]=0;for(t=0;t<NSe;t++)o.bl_tree[t*2]=0;o.dyn_ltree[kSe*2]=1,o.opt_len=o.static_len=0,o.last_lit=o.matches=0}function XGe(o){o.bi_valid>8?Kj(o,o.bi_buf):o.bi_valid>0&&(o.pending_buf[o.pending++]=o.bi_buf),o.bi_buf=0,o.bi_valid=0}function PEt(o,t,e,r){XGe(o),r&&(Kj(o,e),Kj(o,~e)),sEt.arraySet(o.pending_buf,o.window,t,e,o.pending),o.pending+=e}function xGe(o,t,e,r){var i=t*2,n=e*2;return o[i]<o[n]||o[i]===o[n]&&r[t]<=r[e]}function DSe(o,t,e){for(var r=o.heap[e],i=e<<1;i<=o.heap_len&&(i<o.heap_len&&xGe(t,o.heap[i+1],o.heap[i],o.depth)&&i++,!xGe(t,r,o.heap[i],o.depth));)o.heap[e]=o.heap[i],e=i,i<<=1;o.heap[e]=r}function RGe(o,t,e){var r,i,n=0,s,a;if(o.last_lit!==0)do r=o.pending_buf[o.d_buf+n*2]<<8|o.pending_buf[o.d_buf+n*2+1],i=o.pending_buf[o.l_buf+n],n++,r===0?Y3(o,i,t):(s=$j[i],Y3(o,s+Zj+1,t),a=wSe[s],a!==0&&(i-=BSe[s],Wb(o,i,a)),r--,s=WGe(r),Y3(o,s,e),a=nse[s],a!==0&&(r-=ose[s],Wb(o,r,a)));while(n<o.last_lit);Y3(o,kSe,t)}function LSe(o,t){var e=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,n=t.stat_desc.elems,s,a,l=-1,c;for(o.heap_len=0,o.heap_max=NGe,s=0;s<n;s++)e[s*2]!==0?(o.heap[++o.heap_len]=l=s,o.depth[s]=0):e[s*2+1]=0;for(;o.heap_len<2;)c=o.heap[++o.heap_len]=l<2?++l:0,e[c*2]=1,o.depth[c]=0,o.opt_len--,i&&(o.static_len-=r[c*2+1]);for(t.max_code=l,s=o.heap_len>>1;s>=1;s--)DSe(o,e,s);c=n;do s=o.heap[1],o.heap[1]=o.heap[o.heap_len--],DSe(o,e,1),a=o.heap[1],o.heap[--o.heap_max]=s,o.heap[--o.heap_max]=a,e[c*2]=e[s*2]+e[a*2],o.depth[c]=(o.depth[s]>=o.depth[a]?o.depth[s]:o.depth[a])+1,e[s*2+1]=e[a*2+1]=c,o.heap[1]=c++,DSe(o,e,1);while(o.heap_len>=2);o.heap[--o.heap_max]=o.heap[1],yEt(o,t),YGe(e,l,o.bl_count)}function DGe(o,t,e){var r,i=-1,n,s=t[1],a=0,l=7,c=4;for(s===0&&(l=138,c=3),t[(e+1)*2+1]=65535,r=0;r<=e;r++)n=s,s=t[(r+1)*2+1],!(++a<l&&n===s)&&(a<c?o.bl_tree[n*2]+=a:n!==0?(n!==i&&o.bl_tree[n*2]++,o.bl_tree[kGe*2]++):a<=10?o.bl_tree[BGe*2]++:o.bl_tree[FGe*2]++,a=0,i=n,s===0?(l=138,c=3):n===s?(l=6,c=3):(l=7,c=4))}function wGe(o,t,e){var r,i=-1,n,s=t[1],a=0,l=7,c=4;for(s===0&&(l=138,c=3),r=0;r<=e;r++)if(n=s,s=t[(r+1)*2+1],!(++a<l&&n===s)){if(a<c)do Y3(o,n,o.bl_tree);while(--a!==0);else n!==0?(n!==i&&(Y3(o,n,o.bl_tree),a--),Y3(o,kGe,o.bl_tree),Wb(o,a-3,2)):a<=10?(Y3(o,BGe,o.bl_tree),Wb(o,a-3,3)):(Y3(o,FGe,o.bl_tree),Wb(o,a-11,7));a=0,i=n,s===0?(l=138,c=3):n===s?(l=6,c=3):(l=7,c=4)}}function TEt(o){var t;for(DGe(o,o.dyn_ltree,o.l_desc.max_code),DGe(o,o.dyn_dtree,o.d_desc.max_code),LSe(o,o.bl_desc),t=NSe-1;t>=3&&o.bl_tree[VGe[t]*2+1]===0;t--);return o.opt_len+=3*(t+1)+5+5+4,t}function IEt(o,t,e,r){var i;for(Wb(o,t-257,5),Wb(o,e-1,5),Wb(o,r-4,4),i=0;i<r;i++)Wb(o,o.bl_tree[VGe[i]*2+1],3);wGe(o,o.dyn_ltree,t-1),wGe(o,o.dyn_dtree,e-1)}function CEt(o){var t=4093624447,e;for(e=0;e<=31;e++,t>>>=1)if(t&1&&o.dyn_ltree[e*2]!==0)return _Ge;if(o.dyn_ltree[18]!==0||o.dyn_ltree[20]!==0||o.dyn_ltree[26]!==0)return vGe;for(e=32;e<Zj;e++)if(o.dyn_ltree[e*2]!==0)return vGe;return _Ge}var LGe=!1;function SEt(o){LGe||(bEt(),LGe=!0),o.l_desc=new RSe(o.dyn_ltree,GGe),o.d_desc=new RSe(o.dyn_dtree,UGe),o.bl_desc=new RSe(o.bl_tree,HGe),o.bi_buf=0,o.bi_valid=0,jGe(o)}function qGe(o,t,e,r){Wb(o,(cEt<<1)+(r?1:0),3),PEt(o,t,e,!0)}function EEt(o){Wb(o,MGe<<1,3),Y3(o,kSe,xA),gEt(o)}function OEt(o,t,e,r){var i,n,s=0;o.level>0?(o.strm.data_type===lEt&&(o.strm.data_type=CEt(o)),LSe(o,o.l_desc),LSe(o,o.d_desc),s=TEt(o),i=o.opt_len+3+7>>>3,n=o.static_len+3+7>>>3,n<=i&&(i=n)):i=n=e+5,e+4<=i&&t!==-1?qGe(o,t,e,r):o.strategy===aEt||n===i?(Wb(o,(MGe<<1)+(r?1:0),3),RGe(o,xA,jj)):(Wb(o,(hEt<<1)+(r?1:0),3),IEt(o,o.l_desc.max_code+1,o.d_desc.max_code+1,s+1),RGe(o,o.dyn_ltree,o.dyn_dtree)),jGe(o),r&&XGe(o)}function AEt(o,t,e){return o.pending_buf[o.d_buf+o.last_lit*2]=t>>>8&255,o.pending_buf[o.d_buf+o.last_lit*2+1]=t&255,o.pending_buf[o.l_buf+o.last_lit]=e&255,o.last_lit++,t===0?o.dyn_ltree[e*2]++:(o.matches++,t--,o.dyn_ltree[($j[e]+Zj+1)*2]++,o.dyn_dtree[WGe(t)*2]++),o.last_lit===o.lit_bufsize-1}NF._tr_init=SEt;NF._tr_stored_block=qGe;NF._tr_flush_block=OEt;NF._tr_tally=AEt;NF._tr_align=EEt});var FSe=cp((h8n,KGe)=>{"use strict";function _Et(o,t,e,r){for(var i=o&65535|0,n=o>>>16&65535|0,s=0;e!==0;){s=e>2e3?2e3:e,e-=s;do i=i+t[r++]|0,n=n+i|0;while(--s);i%=65521,n%=65521}return i|n<<16|0}KGe.exports=_Et});var VSe=cp((u8n,ZGe)=>{"use strict";function vEt(){for(var o,t=[],e=0;e<256;e++){o=e;for(var r=0;r<8;r++)o=o&1?3988292384^o>>>1:o>>>1;t[e]=o}return t}var xEt=vEt();function REt(o,t,e,r){var i=xEt,n=r+e;o^=-1;for(var s=r;s<n;s++)o=o>>>8^i[(o^t[s])&255];return o^-1}ZGe.exports=REt});var sse=cp((d8n,JGe)=>{"use strict";JGe.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var aUe=cp(q3=>{"use strict";var R2=vA(),VI=$Ge(),rUe=FSe(),FR=VSe(),DEt=sse(),S6=0,wEt=1,LEt=3,WR=4,QGe=5,X3=0,eUe=1,GI=-2,MEt=-3,GSe=-5,NEt=-1,kEt=1,ase=2,BEt=3,FEt=4,VEt=0,GEt=2,use=8,UEt=9,HEt=15,WEt=8,zEt=29,YEt=256,HSe=YEt+1+zEt,jEt=30,XEt=19,qEt=2*HSe+1,$Et=15,Oc=3,UR=258,RS=UR+Oc+1,KEt=32,dse=42,WSe=69,lse=73,cse=91,hse=103,T6=113,Qj=666,Fm=1,eX=2,I6=3,FF=4,ZEt=3;function HR(o,t){return o.msg=DEt[t],t}function tUe(o){return(o<<1)-(o>4?9:0)}function GR(o){for(var t=o.length;--t>=0;)o[t]=0}function VR(o){var t=o.state,e=t.pending;e>o.avail_out&&(e=o.avail_out),e!==0&&(R2.arraySet(o.output,t.pending_buf,t.pending_out,e,o.next_out),o.next_out+=e,t.pending_out+=e,o.total_out+=e,o.avail_out-=e,t.pending-=e,t.pending===0&&(t.pending_out=0))}function T1(o,t){VI._tr_flush_block(o,o.block_start>=0?o.block_start:-1,o.strstart-o.block_start,t),o.block_start=o.strstart,VR(o.strm)}function fh(o,t){o.pending_buf[o.pending++]=t}function Jj(o,t){o.pending_buf[o.pending++]=t>>>8&255,o.pending_buf[o.pending++]=t&255}function JEt(o,t,e,r){var i=o.avail_in;return i>r&&(i=r),i===0?0:(o.avail_in-=i,R2.arraySet(t,o.input,o.next_in,i,e),o.state.wrap===1?o.adler=rUe(o.adler,t,i,e):o.state.wrap===2&&(o.adler=FR(o.adler,t,i,e)),o.next_in+=i,o.total_in+=i,i)}function iUe(o,t){var e=o.max_chain_length,r=o.strstart,i,n,s=o.prev_length,a=o.nice_match,l=o.strstart>o.w_size-RS?o.strstart-(o.w_size-RS):0,c=o.window,h=o.w_mask,u=o.prev,d=o.strstart+UR,p=c[r+s-1],m=c[r+s];o.prev_length>=o.good_match&&(e>>=2),a>o.lookahead&&(a=o.lookahead);do if(i=t,!(c[i+s]!==m||c[i+s-1]!==p||c[i]!==c[r]||c[++i]!==c[r+1])){r+=2,i++;do;while(c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&r<d);if(n=UR-(d-r),r=d-UR,n>s){if(o.match_start=t,s=n,n>=a)break;p=c[r+s-1],m=c[r+s]}}while((t=u[t&h])>l&&--e!==0);return s<=o.lookahead?s:o.lookahead}function C6(o){var t=o.w_size,e,r,i,n,s;do{if(n=o.window_size-o.lookahead-o.strstart,o.strstart>=t+(t-RS)){R2.arraySet(o.window,o.window,t,t,0),o.match_start-=t,o.strstart-=t,o.block_start-=t,r=o.hash_size,e=r;do i=o.head[--e],o.head[e]=i>=t?i-t:0;while(--r);r=t,e=r;do i=o.prev[--e],o.prev[e]=i>=t?i-t:0;while(--r);n+=t}if(o.strm.avail_in===0)break;if(r=JEt(o.strm,o.window,o.strstart+o.lookahead,n),o.lookahead+=r,o.lookahead+o.insert>=Oc)for(s=o.strstart-o.insert,o.ins_h=o.window[s],o.ins_h=(o.ins_h<<o.hash_shift^o.window[s+1])&o.hash_mask;o.insert&&(o.ins_h=(o.ins_h<<o.hash_shift^o.window[s+Oc-1])&o.hash_mask,o.prev[s&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=s,s++,o.insert--,!(o.lookahead+o.insert<Oc)););}while(o.lookahead<RS&&o.strm.avail_in!==0)}function QEt(o,t){var e=65535;for(e>o.pending_buf_size-5&&(e=o.pending_buf_size-5);;){if(o.lookahead<=1){if(C6(o),o.lookahead===0&&t===S6)return Fm;if(o.lookahead===0)break}o.strstart+=o.lookahead,o.lookahead=0;var r=o.block_start+e;if((o.strstart===0||o.strstart>=r)&&(o.lookahead=o.strstart-r,o.strstart=r,T1(o,!1),o.strm.avail_out===0)||o.strstart-o.block_start>=o.w_size-RS&&(T1(o,!1),o.strm.avail_out===0))return Fm}return o.insert=0,t===WR?(T1(o,!0),o.strm.avail_out===0?I6:FF):(o.strstart>o.block_start&&(T1(o,!1),o.strm.avail_out===0),Fm)}function USe(o,t){for(var e,r;;){if(o.lookahead<RS){if(C6(o),o.lookahead<RS&&t===S6)return Fm;if(o.lookahead===0)break}if(e=0,o.lookahead>=Oc&&(o.ins_h=(o.ins_h<<o.hash_shift^o.window[o.strstart+Oc-1])&o.hash_mask,e=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart),e!==0&&o.strstart-e<=o.w_size-RS&&(o.match_length=iUe(o,e)),o.match_length>=Oc)if(r=VI._tr_tally(o,o.strstart-o.match_start,o.match_length-Oc),o.lookahead-=o.match_length,o.match_length<=o.max_lazy_match&&o.lookahead>=Oc){o.match_length--;do o.strstart++,o.ins_h=(o.ins_h<<o.hash_shift^o.window[o.strstart+Oc-1])&o.hash_mask,e=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart;while(--o.match_length!==0);o.strstart++}else o.strstart+=o.match_length,o.match_length=0,o.ins_h=o.window[o.strstart],o.ins_h=(o.ins_h<<o.hash_shift^o.window[o.strstart+1])&o.hash_mask;else r=VI._tr_tally(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++;if(r&&(T1(o,!1),o.strm.avail_out===0))return Fm}return o.insert=o.strstart<Oc-1?o.strstart:Oc-1,t===WR?(T1(o,!0),o.strm.avail_out===0?I6:FF):o.last_lit&&(T1(o,!1),o.strm.avail_out===0)?Fm:eX}function kF(o,t){for(var e,r,i;;){if(o.lookahead<RS){if(C6(o),o.lookahead<RS&&t===S6)return Fm;if(o.lookahead===0)break}if(e=0,o.lookahead>=Oc&&(o.ins_h=(o.ins_h<<o.hash_shift^o.window[o.strstart+Oc-1])&o.hash_mask,e=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart),o.prev_length=o.match_length,o.prev_match=o.match_start,o.match_length=Oc-1,e!==0&&o.prev_length<o.max_lazy_match&&o.strstart-e<=o.w_size-RS&&(o.match_length=iUe(o,e),o.match_length<=5&&(o.strategy===kEt||o.match_length===Oc&&o.strstart-o.match_start>4096)&&(o.match_length=Oc-1)),o.prev_length>=Oc&&o.match_length<=o.prev_length){i=o.strstart+o.lookahead-Oc,r=VI._tr_tally(o,o.strstart-1-o.prev_match,o.prev_length-Oc),o.lookahead-=o.prev_length-1,o.prev_length-=2;do++o.strstart<=i&&(o.ins_h=(o.ins_h<<o.hash_shift^o.window[o.strstart+Oc-1])&o.hash_mask,e=o.prev[o.strstart&o.w_mask]=o.head[o.ins_h],o.head[o.ins_h]=o.strstart);while(--o.prev_length!==0);if(o.match_available=0,o.match_length=Oc-1,o.strstart++,r&&(T1(o,!1),o.strm.avail_out===0))return Fm}else if(o.match_available){if(r=VI._tr_tally(o,0,o.window[o.strstart-1]),r&&T1(o,!1),o.strstart++,o.lookahead--,o.strm.avail_out===0)return Fm}else o.match_available=1,o.strstart++,o.lookahead--}return o.match_available&&(r=VI._tr_tally(o,0,o.window[o.strstart-1]),o.match_available=0),o.insert=o.strstart<Oc-1?o.strstart:Oc-1,t===WR?(T1(o,!0),o.strm.avail_out===0?I6:FF):o.last_lit&&(T1(o,!1),o.strm.avail_out===0)?Fm:eX}function eOt(o,t){for(var e,r,i,n,s=o.window;;){if(o.lookahead<=UR){if(C6(o),o.lookahead<=UR&&t===S6)return Fm;if(o.lookahead===0)break}if(o.match_length=0,o.lookahead>=Oc&&o.strstart>0&&(i=o.strstart-1,r=s[i],r===s[++i]&&r===s[++i]&&r===s[++i])){n=o.strstart+UR;do;while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&i<n);o.match_length=UR-(n-i),o.match_length>o.lookahead&&(o.match_length=o.lookahead)}if(o.match_length>=Oc?(e=VI._tr_tally(o,1,o.match_length-Oc),o.lookahead-=o.match_length,o.strstart+=o.match_length,o.match_length=0):(e=VI._tr_tally(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++),e&&(T1(o,!1),o.strm.avail_out===0))return Fm}return o.insert=0,t===WR?(T1(o,!0),o.strm.avail_out===0?I6:FF):o.last_lit&&(T1(o,!1),o.strm.avail_out===0)?Fm:eX}function tOt(o,t){for(var e;;){if(o.lookahead===0&&(C6(o),o.lookahead===0)){if(t===S6)return Fm;break}if(o.match_length=0,e=VI._tr_tally(o,0,o.window[o.strstart]),o.lookahead--,o.strstart++,e&&(T1(o,!1),o.strm.avail_out===0))return Fm}return o.insert=0,t===WR?(T1(o,!0),o.strm.avail_out===0?I6:FF):o.last_lit&&(T1(o,!1),o.strm.avail_out===0)?Fm:eX}function j3(o,t,e,r,i){this.good_length=o,this.max_lazy=t,this.nice_length=e,this.max_chain=r,this.func=i}var BF;BF=[new j3(0,0,0,0,QEt),new j3(4,4,8,4,USe),new j3(4,5,16,8,USe),new j3(4,6,32,32,USe),new j3(4,4,16,16,kF),new j3(8,16,32,32,kF),new j3(8,16,128,128,kF),new j3(8,32,128,256,kF),new j3(32,128,258,1024,kF),new j3(32,258,258,4096,kF)];function rOt(o){o.window_size=2*o.w_size,GR(o.head),o.max_lazy_match=BF[o.level].max_lazy,o.good_match=BF[o.level].good_length,o.nice_match=BF[o.level].nice_length,o.max_chain_length=BF[o.level].max_chain,o.strstart=0,o.block_start=0,o.lookahead=0,o.insert=0,o.match_length=o.prev_length=Oc-1,o.match_available=0,o.ins_h=0}function iOt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=use,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new R2.Buf16(qEt*2),this.dyn_dtree=new R2.Buf16((2*jEt+1)*2),this.bl_tree=new R2.Buf16((2*XEt+1)*2),GR(this.dyn_ltree),GR(this.dyn_dtree),GR(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new R2.Buf16($Et+1),this.heap=new R2.Buf16(2*HSe+1),GR(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new R2.Buf16(2*HSe+1),GR(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function nUe(o){var t;return!o||!o.state?HR(o,GI):(o.total_in=o.total_out=0,o.data_type=GEt,t=o.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?dse:T6,o.adler=t.wrap===2?0:1,t.last_flush=S6,VI._tr_init(t),X3)}function oUe(o){var t=nUe(o);return t===X3&&rOt(o.state),t}function nOt(o,t){return!o||!o.state||o.state.wrap!==2?GI:(o.state.gzhead=t,X3)}function sUe(o,t,e,r,i,n){if(!o)return GI;var s=1;if(t===NEt&&(t=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),i<1||i>UEt||e!==use||r<8||r>15||t<0||t>9||n<0||n>FEt)return HR(o,GI);r===8&&(r=9);var a=new iOt;return o.state=a,a.strm=o,a.wrap=s,a.gzhead=null,a.w_bits=r,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=i+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+Oc-1)/Oc),a.window=new R2.Buf8(a.w_size*2),a.head=new R2.Buf16(a.hash_size),a.prev=new R2.Buf16(a.w_size),a.lit_bufsize=1<<i+6,a.pending_buf_size=a.lit_bufsize*4,a.pending_buf=new R2.Buf8(a.pending_buf_size),a.d_buf=1*a.lit_bufsize,a.l_buf=3*a.lit_bufsize,a.level=t,a.strategy=n,a.method=e,oUe(o)}function oOt(o,t){return sUe(o,t,use,HEt,WEt,VEt)}function sOt(o,t){var e,r,i,n;if(!o||!o.state||t>QGe||t<0)return o?HR(o,GI):GI;if(r=o.state,!o.output||!o.input&&o.avail_in!==0||r.status===Qj&&t!==WR)return HR(o,o.avail_out===0?GSe:GI);if(r.strm=o,e=r.last_flush,r.last_flush=t,r.status===dse)if(r.wrap===2)o.adler=0,fh(r,31),fh(r,139),fh(r,8),r.gzhead?(fh(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),fh(r,r.gzhead.time&255),fh(r,r.gzhead.time>>8&255),fh(r,r.gzhead.time>>16&255),fh(r,r.gzhead.time>>24&255),fh(r,r.level===9?2:r.strategy>=ase||r.level<2?4:0),fh(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(fh(r,r.gzhead.extra.length&255),fh(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(o.adler=FR(o.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=WSe):(fh(r,0),fh(r,0),fh(r,0),fh(r,0),fh(r,0),fh(r,r.level===9?2:r.strategy>=ase||r.level<2?4:0),fh(r,ZEt),r.status=T6);else{var s=use+(r.w_bits-8<<4)<<8,a=-1;r.strategy>=ase||r.level<2?a=0:r.level<6?a=1:r.level===6?a=2:a=3,s|=a<<6,r.strstart!==0&&(s|=KEt),s+=31-s%31,r.status=T6,Jj(r,s),r.strstart!==0&&(Jj(r,o.adler>>>16),Jj(r,o.adler&65535)),o.adler=1}if(r.status===WSe)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(r.gzhead.extra.length&65535)&&!(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(o.adler=FR(o.adler,r.pending_buf,r.pending-i,i)),VR(o),i=r.pending,r.pending===r.pending_buf_size));)fh(r,r.gzhead.extra[r.gzindex]&255),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(o.adler=FR(o.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=lse)}else r.status=lse;if(r.status===lse)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(o.adler=FR(o.adler,r.pending_buf,r.pending-i,i)),VR(o),i=r.pending,r.pending===r.pending_buf_size)){n=1;break}r.gzindex<r.gzhead.name.length?n=r.gzhead.name.charCodeAt(r.gzindex++)&255:n=0,fh(r,n)}while(n!==0);r.gzhead.hcrc&&r.pending>i&&(o.adler=FR(o.adler,r.pending_buf,r.pending-i,i)),n===0&&(r.gzindex=0,r.status=cse)}else r.status=cse;if(r.status===cse)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(o.adler=FR(o.adler,r.pending_buf,r.pending-i,i)),VR(o),i=r.pending,r.pending===r.pending_buf_size)){n=1;break}r.gzindex<r.gzhead.comment.length?n=r.gzhead.comment.charCodeAt(r.gzindex++)&255:n=0,fh(r,n)}while(n!==0);r.gzhead.hcrc&&r.pending>i&&(o.adler=FR(o.adler,r.pending_buf,r.pending-i,i)),n===0&&(r.status=hse)}else r.status=hse;if(r.status===hse&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&VR(o),r.pending+2<=r.pending_buf_size&&(fh(r,o.adler&255),fh(r,o.adler>>8&255),o.adler=0,r.status=T6)):r.status=T6),r.pending!==0){if(VR(o),o.avail_out===0)return r.last_flush=-1,X3}else if(o.avail_in===0&&tUe(t)<=tUe(e)&&t!==WR)return HR(o,GSe);if(r.status===Qj&&o.avail_in!==0)return HR(o,GSe);if(o.avail_in!==0||r.lookahead!==0||t!==S6&&r.status!==Qj){var l=r.strategy===ase?tOt(r,t):r.strategy===BEt?eOt(r,t):BF[r.level].func(r,t);if((l===I6||l===FF)&&(r.status=Qj),l===Fm||l===I6)return o.avail_out===0&&(r.last_flush=-1),X3;if(l===eX&&(t===wEt?VI._tr_align(r):t!==QGe&&(VI._tr_stored_block(r,0,0,!1),t===LEt&&(GR(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),VR(o),o.avail_out===0))return r.last_flush=-1,X3}return t!==WR?X3:r.wrap<=0?eUe:(r.wrap===2?(fh(r,o.adler&255),fh(r,o.adler>>8&255),fh(r,o.adler>>16&255),fh(r,o.adler>>24&255),fh(r,o.total_in&255),fh(r,o.total_in>>8&255),fh(r,o.total_in>>16&255),fh(r,o.total_in>>24&255)):(Jj(r,o.adler>>>16),Jj(r,o.adler&65535)),VR(o),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?X3:eUe)}function aOt(o){var t;return!o||!o.state?GI:(t=o.state.status,t!==dse&&t!==WSe&&t!==lse&&t!==cse&&t!==hse&&t!==T6&&t!==Qj?HR(o,GI):(o.state=null,t===T6?HR(o,MEt):X3))}function lOt(o,t){var e=t.length,r,i,n,s,a,l,c,h;if(!o||!o.state||(r=o.state,s=r.wrap,s===2||s===1&&r.status!==dse||r.lookahead))return GI;for(s===1&&(o.adler=rUe(o.adler,t,e,0)),r.wrap=0,e>=r.w_size&&(s===0&&(GR(r.head),r.strstart=0,r.block_start=0,r.insert=0),h=new R2.Buf8(r.w_size),R2.arraySet(h,t,e-r.w_size,r.w_size,0),t=h,e=r.w_size),a=o.avail_in,l=o.next_in,c=o.input,o.avail_in=e,o.next_in=0,o.input=t,C6(r);r.lookahead>=Oc;){i=r.strstart,n=r.lookahead-(Oc-1);do r.ins_h=(r.ins_h<<r.hash_shift^r.window[i+Oc-1])&r.hash_mask,r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++;while(--n);r.strstart=i,r.lookahead=Oc-1,C6(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Oc-1,r.match_available=0,o.next_in=l,o.input=c,o.avail_in=a,r.wrap=s,X3}q3.deflateInit=oOt;q3.deflateInit2=sUe;q3.deflateReset=oUe;q3.deflateResetKeep=nUe;q3.deflateSetHeader=nOt;q3.deflate=sOt;q3.deflateEnd=aOt;q3.deflateSetDictionary=lOt;q3.deflateInfo="pako deflate (from Nodeca project)"});var zSe=cp(VF=>{"use strict";var pse=vA(),lUe=!0,cUe=!0;try{String.fromCharCode.apply(null,[0])}catch{lUe=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{cUe=!1}var tX=new pse.Buf8(256);for(RA=0;RA<256;RA++)tX[RA]=RA>=252?6:RA>=248?5:RA>=240?4:RA>=224?3:RA>=192?2:1;var RA;tX[254]=tX[254]=1;VF.string2buf=function(o){var t,e,r,i,n,s=o.length,a=0;for(i=0;i<s;i++)e=o.charCodeAt(i),(e&64512)===55296&&i+1<s&&(r=o.charCodeAt(i+1),(r&64512)===56320&&(e=65536+(e-55296<<10)+(r-56320),i++)),a+=e<128?1:e<2048?2:e<65536?3:4;for(t=new pse.Buf8(a),n=0,i=0;n<a;i++)e=o.charCodeAt(i),(e&64512)===55296&&i+1<s&&(r=o.charCodeAt(i+1),(r&64512)===56320&&(e=65536+(e-55296<<10)+(r-56320),i++)),e<128?t[n++]=e:e<2048?(t[n++]=192|e>>>6,t[n++]=128|e&63):e<65536?(t[n++]=224|e>>>12,t[n++]=128|e>>>6&63,t[n++]=128|e&63):(t[n++]=240|e>>>18,t[n++]=128|e>>>12&63,t[n++]=128|e>>>6&63,t[n++]=128|e&63);return t};function hUe(o,t){if(t<65534&&(o.subarray&&cUe||!o.subarray&&lUe))return String.fromCharCode.apply(null,pse.shrinkBuf(o,t));for(var e="",r=0;r<t;r++)e+=String.fromCharCode(o[r]);return e}VF.buf2binstring=function(o){return hUe(o,o.length)};VF.binstring2buf=function(o){for(var t=new pse.Buf8(o.length),e=0,r=t.length;e<r;e++)t[e]=o.charCodeAt(e);return t};VF.buf2string=function(o,t){var e,r,i,n,s=t||o.length,a=new Array(s*2);for(r=0,e=0;e<s;){if(i=o[e++],i<128){a[r++]=i;continue}if(n=tX[i],n>4){a[r++]=65533,e+=n-1;continue}for(i&=n===2?31:n===3?15:7;n>1&&e<s;)i=i<<6|o[e++]&63,n--;if(n>1){a[r++]=65533;continue}i<65536?a[r++]=i:(i-=65536,a[r++]=55296|i>>10&1023,a[r++]=56320|i&1023)}return hUe(a,r)};VF.utf8border=function(o,t){var e;for(t=t||o.length,t>o.length&&(t=o.length),e=t-1;e>=0&&(o[e]&192)===128;)e--;return e<0||e===0?t:e+tX[o[e]]>t?e:t}});var YSe=cp((m8n,uUe)=>{"use strict";function cOt(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}uUe.exports=cOt});var mUe=cp(nX=>{"use strict";var rX=aUe(),iX=vA(),XSe=zSe(),qSe=sse(),hOt=YSe(),fUe=Object.prototype.toString,uOt=0,jSe=4,GF=0,dUe=1,pUe=2,dOt=-1,pOt=0,fOt=8;function E6(o){if(!(this instanceof E6))return new E6(o);this.options=iX.assign({level:dOt,method:fOt,chunkSize:16384,windowBits:15,memLevel:8,strategy:pOt,to:""},o||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new hOt,this.strm.avail_out=0;var e=rX.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(e!==GF)throw new Error(qSe[e]);if(t.header&&rX.deflateSetHeader(this.strm,t.header),t.dictionary){var r;if(typeof t.dictionary=="string"?r=XSe.string2buf(t.dictionary):fUe.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,e=rX.deflateSetDictionary(this.strm,r),e!==GF)throw new Error(qSe[e]);this._dict_set=!0}}E6.prototype.push=function(o,t){var e=this.strm,r=this.options.chunkSize,i,n;if(this.ended)return!1;n=t===~~t?t:t===!0?jSe:uOt,typeof o=="string"?e.input=XSe.string2buf(o):fUe.call(o)==="[object ArrayBuffer]"?e.input=new Uint8Array(o):e.input=o,e.next_in=0,e.avail_in=e.input.length;do{if(e.avail_out===0&&(e.output=new iX.Buf8(r),e.next_out=0,e.avail_out=r),i=rX.deflate(e,n),i!==dUe&&i!==GF)return this.onEnd(i),this.ended=!0,!1;(e.avail_out===0||e.avail_in===0&&(n===jSe||n===pUe))&&(this.options.to==="string"?this.onData(XSe.buf2binstring(iX.shrinkBuf(e.output,e.next_out))):this.onData(iX.shrinkBuf(e.output,e.next_out)))}while((e.avail_in>0||e.avail_out===0)&&i!==dUe);return n===jSe?(i=rX.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===GF):(n===pUe&&(this.onEnd(GF),e.avail_out=0),!0)};E6.prototype.onData=function(o){this.chunks.push(o)};E6.prototype.onEnd=function(o){o===GF&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=iX.flattenChunks(this.chunks)),this.chunks=[],this.err=o,this.msg=this.strm.msg};function $Se(o,t){var e=new E6(t);if(e.push(o,!0),e.err)throw e.msg||qSe[e.err];return e.result}function mOt(o,t){return t=t||{},t.raw=!0,$Se(o,t)}function gOt(o,t){return t=t||{},t.gzip=!0,$Se(o,t)}nX.Deflate=E6;nX.deflate=$Se;nX.deflateRaw=mOt;nX.gzip=gOt});var yUe=cp((y8n,gUe)=>{"use strict";var fse=30,yOt=12;gUe.exports=function(t,e){var r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,x,v,D;r=t.state,i=t.next_in,v=t.input,n=i+(t.avail_in-5),s=t.next_out,D=t.output,a=s-(e-t.avail_out),l=s+(t.avail_out-257),c=r.dmax,h=r.wsize,u=r.whave,d=r.wnext,p=r.window,m=r.hold,g=r.bits,y=r.lencode,b=r.distcode,P=(1<<r.lenbits)-1,T=(1<<r.distbits)-1;e:do{g<15&&(m+=v[i++]<<g,g+=8,m+=v[i++]<<g,g+=8),I=y[m&P];t:for(;;){if(C=I>>>24,m>>>=C,g-=C,C=I>>>16&255,C===0)D[s++]=I&65535;else if(C&16){E=I&65535,C&=15,C&&(g<C&&(m+=v[i++]<<g,g+=8),E+=m&(1<<C)-1,m>>>=C,g-=C),g<15&&(m+=v[i++]<<g,g+=8,m+=v[i++]<<g,g+=8),I=b[m&T];r:for(;;){if(C=I>>>24,m>>>=C,g-=C,C=I>>>16&255,C&16){if(O=I&65535,C&=15,g<C&&(m+=v[i++]<<g,g+=8,g<C&&(m+=v[i++]<<g,g+=8)),O+=m&(1<<C)-1,O>c){t.msg="invalid distance too far back",r.mode=fse;break e}if(m>>>=C,g-=C,C=s-a,O>C){if(C=O-C,C>u&&r.sane){t.msg="invalid distance too far back",r.mode=fse;break e}if(_=0,x=p,d===0){if(_+=h-C,C<E){E-=C;do D[s++]=p[_++];while(--C);_=s-O,x=D}}else if(d<C){if(_+=h+d-C,C-=d,C<E){E-=C;do D[s++]=p[_++];while(--C);if(_=0,d<E){C=d,E-=C;do D[s++]=p[_++];while(--C);_=s-O,x=D}}}else if(_+=d-C,C<E){E-=C;do D[s++]=p[_++];while(--C);_=s-O,x=D}for(;E>2;)D[s++]=x[_++],D[s++]=x[_++],D[s++]=x[_++],E-=3;E&&(D[s++]=x[_++],E>1&&(D[s++]=x[_++]))}else{_=s-O;do D[s++]=D[_++],D[s++]=D[_++],D[s++]=D[_++],E-=3;while(E>2);E&&(D[s++]=D[_++],E>1&&(D[s++]=D[_++]))}}else if((C&64)===0){I=b[(I&65535)+(m&(1<<C)-1)];continue r}else{t.msg="invalid distance code",r.mode=fse;break e}break}}else if((C&64)===0){I=y[(I&65535)+(m&(1<<C)-1)];continue t}else if(C&32){r.mode=yOt;break e}else{t.msg="invalid literal/length code",r.mode=fse;break e}break}}while(i<n&&s<l);E=g>>3,i-=E,g-=E<<3,m&=(1<<g)-1,t.next_in=i,t.next_out=s,t.avail_in=i<n?5+(n-i):5-(i-n),t.avail_out=s<l?257+(l-s):257-(s-l),r.hold=m,r.bits=g}});var EUe=cp((b8n,SUe)=>{"use strict";var bUe=vA(),UF=15,PUe=852,TUe=592,IUe=0,KSe=1,CUe=2,bOt=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],POt=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],TOt=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],IOt=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];SUe.exports=function(t,e,r,i,n,s,a,l){var c=l.bits,h=0,u=0,d=0,p=0,m=0,g=0,y=0,b=0,P=0,T=0,I,C,E,O,_,x=null,v=0,D,w=new bUe.Buf16(UF+1),F=new bUe.Buf16(UF+1),H=null,z=0,V,W,L;for(h=0;h<=UF;h++)w[h]=0;for(u=0;u<i;u++)w[e[r+u]]++;for(m=c,p=UF;p>=1&&w[p]===0;p--);if(m>p&&(m=p),p===0)return n[s++]=1<<24|64<<16|0,n[s++]=1<<24|64<<16|0,l.bits=1,0;for(d=1;d<p&&w[d]===0;d++);for(m<d&&(m=d),b=1,h=1;h<=UF;h++)if(b<<=1,b-=w[h],b<0)return-1;if(b>0&&(t===IUe||p!==1))return-1;for(F[1]=0,h=1;h<UF;h++)F[h+1]=F[h]+w[h];for(u=0;u<i;u++)e[r+u]!==0&&(a[F[e[r+u]]++]=u);if(t===IUe?(x=H=a,D=19):t===KSe?(x=bOt,v-=257,H=POt,z-=257,D=256):(x=TOt,H=IOt,D=-1),T=0,u=0,h=d,_=s,g=m,y=0,E=-1,P=1<<m,O=P-1,t===KSe&&P>PUe||t===CUe&&P>TUe)return 1;for(;;){V=h-y,a[u]<D?(W=0,L=a[u]):a[u]>D?(W=H[z+a[u]],L=x[v+a[u]]):(W=96,L=0),I=1<<h-y,C=1<<g,d=C;do C-=I,n[_+(T>>y)+C]=V<<24|W<<16|L|0;while(C!==0);for(I=1<<h-1;T&I;)I>>=1;if(I!==0?(T&=I-1,T+=I):T=0,u++,--w[h]===0){if(h===p)break;h=e[r+a[u]]}if(h>m&&(T&O)!==E){for(y===0&&(y=m),_+=d,g=h-y,b=1<<g;g+y<p&&(b-=w[g+y],!(b<=0));)g++,b<<=1;if(P+=1<<g,t===KSe&&P>PUe||t===CUe&&P>TUe)return 1;E=T&O,n[E]=m<<24|g<<16|_-s|0}}return T!==0&&(n[_+T]=h-y<<24|64<<16|0),l.bits=m,0}});var oHe=cp(DS=>{"use strict";var cT=vA(),r9e=FSe(),$3=VSe(),COt=yUe(),oX=EUe(),SOt=0,KUe=1,ZUe=2,OUe=4,EOt=5,mse=6,O6=0,OOt=1,AOt=2,UI=-2,JUe=-3,i9e=-4,_Ot=-5,AUe=8,QUe=1,_Ue=2,vUe=3,xUe=4,RUe=5,DUe=6,wUe=7,LUe=8,MUe=9,NUe=10,bse=11,DA=12,ZSe=13,kUe=14,JSe=15,BUe=16,FUe=17,VUe=18,GUe=19,gse=20,yse=21,UUe=22,HUe=23,WUe=24,zUe=25,YUe=26,QSe=27,jUe=28,XUe=29,kp=30,n9e=31,vOt=32,xOt=852,ROt=592,DOt=15,wOt=DOt;function qUe(o){return(o>>>24&255)+(o>>>8&65280)+((o&65280)<<8)+((o&255)<<24)}function LOt(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new cT.Buf16(320),this.work=new cT.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function eHe(o){var t;return!o||!o.state?UI:(t=o.state,o.total_in=o.total_out=t.total=0,o.msg="",t.wrap&&(o.adler=t.wrap&1),t.mode=QUe,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new cT.Buf32(xOt),t.distcode=t.distdyn=new cT.Buf32(ROt),t.sane=1,t.back=-1,O6)}function tHe(o){var t;return!o||!o.state?UI:(t=o.state,t.wsize=0,t.whave=0,t.wnext=0,eHe(o))}function rHe(o,t){var e,r;return!o||!o.state||(r=o.state,t<0?(e=0,t=-t):(e=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?UI:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=e,r.wbits=t,tHe(o))}function iHe(o,t){var e,r;return o?(r=new LOt,o.state=r,r.window=null,e=rHe(o,t),e!==O6&&(o.state=null),e):UI}function MOt(o){return iHe(o,wOt)}var $Ue=!0,e9e,t9e;function NOt(o){if($Ue){var t;for(e9e=new cT.Buf32(512),t9e=new cT.Buf32(32),t=0;t<144;)o.lens[t++]=8;for(;t<256;)o.lens[t++]=9;for(;t<280;)o.lens[t++]=7;for(;t<288;)o.lens[t++]=8;for(oX(KUe,o.lens,0,288,e9e,0,o.work,{bits:9}),t=0;t<32;)o.lens[t++]=5;oX(ZUe,o.lens,0,32,t9e,0,o.work,{bits:5}),$Ue=!1}o.lencode=e9e,o.lenbits=9,o.distcode=t9e,o.distbits=5}function nHe(o,t,e,r){var i,n=o.state;return n.window===null&&(n.wsize=1<<n.wbits,n.wnext=0,n.whave=0,n.window=new cT.Buf8(n.wsize)),r>=n.wsize?(cT.arraySet(n.window,t,e-n.wsize,n.wsize,0),n.wnext=0,n.whave=n.wsize):(i=n.wsize-n.wnext,i>r&&(i=r),cT.arraySet(n.window,t,e-r,i,n.wnext),r-=i,r?(cT.arraySet(n.window,t,e-r,r,0),n.wnext=r,n.whave=n.wsize):(n.wnext+=i,n.wnext===n.wsize&&(n.wnext=0),n.whave<n.wsize&&(n.whave+=i))),0}function kOt(o,t){var e,r,i,n,s,a,l,c,h,u,d,p,m,g,y=0,b,P,T,I,C,E,O,_,x=new cT.Buf8(4),v,D,w=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!o||!o.state||!o.output||!o.input&&o.avail_in!==0)return UI;e=o.state,e.mode===DA&&(e.mode=ZSe),s=o.next_out,i=o.output,l=o.avail_out,n=o.next_in,r=o.input,a=o.avail_in,c=e.hold,h=e.bits,u=a,d=l,_=O6;e:for(;;)switch(e.mode){case QUe:if(e.wrap===0){e.mode=ZSe;break}for(;h<16;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if(e.wrap&2&&c===35615){e.check=0,x[0]=c&255,x[1]=c>>>8&255,e.check=$3(e.check,x,2,0),c=0,h=0,e.mode=_Ue;break}if(e.flags=0,e.head&&(e.head.done=!1),!(e.wrap&1)||(((c&255)<<8)+(c>>8))%31){o.msg="incorrect header check",e.mode=kp;break}if((c&15)!==AUe){o.msg="unknown compression method",e.mode=kp;break}if(c>>>=4,h-=4,O=(c&15)+8,e.wbits===0)e.wbits=O;else if(O>e.wbits){o.msg="invalid window size",e.mode=kp;break}e.dmax=1<<O,o.adler=e.check=1,e.mode=c&512?NUe:DA,c=0,h=0;break;case _Ue:for(;h<16;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if(e.flags=c,(e.flags&255)!==AUe){o.msg="unknown compression method",e.mode=kp;break}if(e.flags&57344){o.msg="unknown header flags set",e.mode=kp;break}e.head&&(e.head.text=c>>8&1),e.flags&512&&(x[0]=c&255,x[1]=c>>>8&255,e.check=$3(e.check,x,2,0)),c=0,h=0,e.mode=vUe;case vUe:for(;h<32;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}e.head&&(e.head.time=c),e.flags&512&&(x[0]=c&255,x[1]=c>>>8&255,x[2]=c>>>16&255,x[3]=c>>>24&255,e.check=$3(e.check,x,4,0)),c=0,h=0,e.mode=xUe;case xUe:for(;h<16;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}e.head&&(e.head.xflags=c&255,e.head.os=c>>8),e.flags&512&&(x[0]=c&255,x[1]=c>>>8&255,e.check=$3(e.check,x,2,0)),c=0,h=0,e.mode=RUe;case RUe:if(e.flags&1024){for(;h<16;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}e.length=c,e.head&&(e.head.extra_len=c),e.flags&512&&(x[0]=c&255,x[1]=c>>>8&255,e.check=$3(e.check,x,2,0)),c=0,h=0}else e.head&&(e.head.extra=null);e.mode=DUe;case DUe:if(e.flags&1024&&(p=e.length,p>a&&(p=a),p&&(e.head&&(O=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Array(e.head.extra_len)),cT.arraySet(e.head.extra,r,n,p,O)),e.flags&512&&(e.check=$3(e.check,r,p,n)),a-=p,n+=p,e.length-=p),e.length))break e;e.length=0,e.mode=wUe;case wUe:if(e.flags&2048){if(a===0)break e;p=0;do O=r[n+p++],e.head&&O&&e.length<65536&&(e.head.name+=String.fromCharCode(O));while(O&&p<a);if(e.flags&512&&(e.check=$3(e.check,r,p,n)),a-=p,n+=p,O)break e}else e.head&&(e.head.name=null);e.length=0,e.mode=LUe;case LUe:if(e.flags&4096){if(a===0)break e;p=0;do O=r[n+p++],e.head&&O&&e.length<65536&&(e.head.comment+=String.fromCharCode(O));while(O&&p<a);if(e.flags&512&&(e.check=$3(e.check,r,p,n)),a-=p,n+=p,O)break e}else e.head&&(e.head.comment=null);e.mode=MUe;case MUe:if(e.flags&512){for(;h<16;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if(c!==(e.check&65535)){o.msg="header crc mismatch",e.mode=kp;break}c=0,h=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),o.adler=e.check=0,e.mode=DA;break;case NUe:for(;h<32;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}o.adler=e.check=qUe(c),c=0,h=0,e.mode=bse;case bse:if(e.havedict===0)return o.next_out=s,o.avail_out=l,o.next_in=n,o.avail_in=a,e.hold=c,e.bits=h,AOt;o.adler=e.check=1,e.mode=DA;case DA:if(t===EOt||t===mse)break e;case ZSe:if(e.last){c>>>=h&7,h-=h&7,e.mode=QSe;break}for(;h<3;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}switch(e.last=c&1,c>>>=1,h-=1,c&3){case 0:e.mode=kUe;break;case 1:if(NOt(e),e.mode=gse,t===mse){c>>>=2,h-=2;break e}break;case 2:e.mode=FUe;break;case 3:o.msg="invalid block type",e.mode=kp}c>>>=2,h-=2;break;case kUe:for(c>>>=h&7,h-=h&7;h<32;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if((c&65535)!==(c>>>16^65535)){o.msg="invalid stored block lengths",e.mode=kp;break}if(e.length=c&65535,c=0,h=0,e.mode=JSe,t===mse)break e;case JSe:e.mode=BUe;case BUe:if(p=e.length,p){if(p>a&&(p=a),p>l&&(p=l),p===0)break e;cT.arraySet(i,r,n,p,s),a-=p,n+=p,l-=p,s+=p,e.length-=p;break}e.mode=DA;break;case FUe:for(;h<14;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if(e.nlen=(c&31)+257,c>>>=5,h-=5,e.ndist=(c&31)+1,c>>>=5,h-=5,e.ncode=(c&15)+4,c>>>=4,h-=4,e.nlen>286||e.ndist>30){o.msg="too many length or distance symbols",e.mode=kp;break}e.have=0,e.mode=VUe;case VUe:for(;e.have<e.ncode;){for(;h<3;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}e.lens[w[e.have++]]=c&7,c>>>=3,h-=3}for(;e.have<19;)e.lens[w[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,v={bits:e.lenbits},_=oX(SOt,e.lens,0,19,e.lencode,0,e.work,v),e.lenbits=v.bits,_){o.msg="invalid code lengths set",e.mode=kp;break}e.have=0,e.mode=GUe;case GUe:for(;e.have<e.nlen+e.ndist;){for(;y=e.lencode[c&(1<<e.lenbits)-1],b=y>>>24,P=y>>>16&255,T=y&65535,!(b<=h);){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if(T<16)c>>>=b,h-=b,e.lens[e.have++]=T;else{if(T===16){for(D=b+2;h<D;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if(c>>>=b,h-=b,e.have===0){o.msg="invalid bit length repeat",e.mode=kp;break}O=e.lens[e.have-1],p=3+(c&3),c>>>=2,h-=2}else if(T===17){for(D=b+3;h<D;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}c>>>=b,h-=b,O=0,p=3+(c&7),c>>>=3,h-=3}else{for(D=b+7;h<D;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}c>>>=b,h-=b,O=0,p=11+(c&127),c>>>=7,h-=7}if(e.have+p>e.nlen+e.ndist){o.msg="invalid bit length repeat",e.mode=kp;break}for(;p--;)e.lens[e.have++]=O}}if(e.mode===kp)break;if(e.lens[256]===0){o.msg="invalid code -- missing end-of-block",e.mode=kp;break}if(e.lenbits=9,v={bits:e.lenbits},_=oX(KUe,e.lens,0,e.nlen,e.lencode,0,e.work,v),e.lenbits=v.bits,_){o.msg="invalid literal/lengths set",e.mode=kp;break}if(e.distbits=6,e.distcode=e.distdyn,v={bits:e.distbits},_=oX(ZUe,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,v),e.distbits=v.bits,_){o.msg="invalid distances set",e.mode=kp;break}if(e.mode=gse,t===mse)break e;case gse:e.mode=yse;case yse:if(a>=6&&l>=258){o.next_out=s,o.avail_out=l,o.next_in=n,o.avail_in=a,e.hold=c,e.bits=h,COt(o,d),s=o.next_out,i=o.output,l=o.avail_out,n=o.next_in,r=o.input,a=o.avail_in,c=e.hold,h=e.bits,e.mode===DA&&(e.back=-1);break}for(e.back=0;y=e.lencode[c&(1<<e.lenbits)-1],b=y>>>24,P=y>>>16&255,T=y&65535,!(b<=h);){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if(P&&(P&240)===0){for(I=b,C=P,E=T;y=e.lencode[E+((c&(1<<I+C)-1)>>I)],b=y>>>24,P=y>>>16&255,T=y&65535,!(I+b<=h);){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}c>>>=I,h-=I,e.back+=I}if(c>>>=b,h-=b,e.back+=b,e.length=T,P===0){e.mode=YUe;break}if(P&32){e.back=-1,e.mode=DA;break}if(P&64){o.msg="invalid literal/length code",e.mode=kp;break}e.extra=P&15,e.mode=UUe;case UUe:if(e.extra){for(D=e.extra;h<D;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}e.length+=c&(1<<e.extra)-1,c>>>=e.extra,h-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=HUe;case HUe:for(;y=e.distcode[c&(1<<e.distbits)-1],b=y>>>24,P=y>>>16&255,T=y&65535,!(b<=h);){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if((P&240)===0){for(I=b,C=P,E=T;y=e.distcode[E+((c&(1<<I+C)-1)>>I)],b=y>>>24,P=y>>>16&255,T=y&65535,!(I+b<=h);){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}c>>>=I,h-=I,e.back+=I}if(c>>>=b,h-=b,e.back+=b,P&64){o.msg="invalid distance code",e.mode=kp;break}e.offset=T,e.extra=P&15,e.mode=WUe;case WUe:if(e.extra){for(D=e.extra;h<D;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}e.offset+=c&(1<<e.extra)-1,c>>>=e.extra,h-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){o.msg="invalid distance too far back",e.mode=kp;break}e.mode=zUe;case zUe:if(l===0)break e;if(p=d-l,e.offset>p){if(p=e.offset-p,p>e.whave&&e.sane){o.msg="invalid distance too far back",e.mode=kp;break}p>e.wnext?(p-=e.wnext,m=e.wsize-p):m=e.wnext-p,p>e.length&&(p=e.length),g=e.window}else g=i,m=s-e.offset,p=e.length;p>l&&(p=l),l-=p,e.length-=p;do i[s++]=g[m++];while(--p);e.length===0&&(e.mode=yse);break;case YUe:if(l===0)break e;i[s++]=e.length,l--,e.mode=yse;break;case QSe:if(e.wrap){for(;h<32;){if(a===0)break e;a--,c|=r[n++]<<h,h+=8}if(d-=l,o.total_out+=d,e.total+=d,d&&(o.adler=e.check=e.flags?$3(e.check,i,d,s-d):r9e(e.check,i,d,s-d)),d=l,(e.flags?c:qUe(c))!==e.check){o.msg="incorrect data check",e.mode=kp;break}c=0,h=0}e.mode=jUe;case jUe:if(e.wrap&&e.flags){for(;h<32;){if(a===0)break e;a--,c+=r[n++]<<h,h+=8}if(c!==(e.total&4294967295)){o.msg="incorrect length check",e.mode=kp;break}c=0,h=0}e.mode=XUe;case XUe:_=OOt;break e;case kp:_=JUe;break e;case n9e:return i9e;case vOt:default:return UI}return o.next_out=s,o.avail_out=l,o.next_in=n,o.avail_in=a,e.hold=c,e.bits=h,(e.wsize||d!==o.avail_out&&e.mode<kp&&(e.mode<QSe||t!==OUe))&&nHe(o,o.output,o.next_out,d-o.avail_out)?(e.mode=n9e,i9e):(u-=o.avail_in,d-=o.avail_out,o.total_in+=u,o.total_out+=d,e.total+=d,e.wrap&&d&&(o.adler=e.check=e.flags?$3(e.check,i,d,o.next_out-d):r9e(e.check,i,d,o.next_out-d)),o.data_type=e.bits+(e.last?64:0)+(e.mode===DA?128:0)+(e.mode===gse||e.mode===JSe?256:0),(u===0&&d===0||t===OUe)&&_===O6&&(_=_Ot),_)}function BOt(o){if(!o||!o.state)return UI;var t=o.state;return t.window&&(t.window=null),o.state=null,O6}function FOt(o,t){var e;return!o||!o.state||(e=o.state,(e.wrap&2)===0)?UI:(e.head=t,t.done=!1,O6)}function VOt(o,t){var e=t.length,r,i,n;return!o||!o.state||(r=o.state,r.wrap!==0&&r.mode!==bse)?UI:r.mode===bse&&(i=1,i=r9e(i,t,e,0),i!==r.check)?JUe:(n=nHe(o,t,e,e),n?(r.mode=n9e,i9e):(r.havedict=1,O6))}DS.inflateReset=tHe;DS.inflateReset2=rHe;DS.inflateResetKeep=eHe;DS.inflateInit=MOt;DS.inflateInit2=iHe;DS.inflate=kOt;DS.inflateEnd=BOt;DS.inflateGetHeader=FOt;DS.inflateSetDictionary=VOt;DS.inflateInfo="pako inflate (from Nodeca project)"});var o9e=cp((T8n,sHe)=>{"use strict";sHe.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var lHe=cp((I8n,aHe)=>{"use strict";function GOt(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}aHe.exports=GOt});var hHe=cp(aX=>{"use strict";var HF=oHe(),sX=vA(),Pse=zSe(),af=o9e(),s9e=sse(),UOt=YSe(),HOt=lHe(),cHe=Object.prototype.toString;function A6(o){if(!(this instanceof A6))return new A6(o);this.options=sX.assign({chunkSize:16384,windowBits:0,to:""},o||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(o&&o.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new UOt,this.strm.avail_out=0;var e=HF.inflateInit2(this.strm,t.windowBits);if(e!==af.Z_OK)throw new Error(s9e[e]);if(this.header=new HOt,HF.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Pse.string2buf(t.dictionary):cHe.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=HF.inflateSetDictionary(this.strm,t.dictionary),e!==af.Z_OK)))throw new Error(s9e[e])}A6.prototype.push=function(o,t){var e=this.strm,r=this.options.chunkSize,i=this.options.dictionary,n,s,a,l,c,h=!1;if(this.ended)return!1;s=t===~~t?t:t===!0?af.Z_FINISH:af.Z_NO_FLUSH,typeof o=="string"?e.input=Pse.binstring2buf(o):cHe.call(o)==="[object ArrayBuffer]"?e.input=new Uint8Array(o):e.input=o,e.next_in=0,e.avail_in=e.input.length;do{if(e.avail_out===0&&(e.output=new sX.Buf8(r),e.next_out=0,e.avail_out=r),n=HF.inflate(e,af.Z_NO_FLUSH),n===af.Z_NEED_DICT&&i&&(n=HF.inflateSetDictionary(this.strm,i)),n===af.Z_BUF_ERROR&&h===!0&&(n=af.Z_OK,h=!1),n!==af.Z_STREAM_END&&n!==af.Z_OK)return this.onEnd(n),this.ended=!0,!1;e.next_out&&(e.avail_out===0||n===af.Z_STREAM_END||e.avail_in===0&&(s===af.Z_FINISH||s===af.Z_SYNC_FLUSH))&&(this.options.to==="string"?(a=Pse.utf8border(e.output,e.next_out),l=e.next_out-a,c=Pse.buf2string(e.output,a),e.next_out=l,e.avail_out=r-l,l&&sX.arraySet(e.output,e.output,a,l,0),this.onData(c)):this.onData(sX.shrinkBuf(e.output,e.next_out))),e.avail_in===0&&e.avail_out===0&&(h=!0)}while((e.avail_in>0||e.avail_out===0)&&n!==af.Z_STREAM_END);return n===af.Z_STREAM_END&&(s=af.Z_FINISH),s===af.Z_FINISH?(n=HF.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===af.Z_OK):(s===af.Z_SYNC_FLUSH&&(this.onEnd(af.Z_OK),e.avail_out=0),!0)};A6.prototype.onData=function(o){this.chunks.push(o)};A6.prototype.onEnd=function(o){o===af.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=sX.flattenChunks(this.chunks)),this.chunks=[],this.err=o,this.msg=this.strm.msg};function a9e(o,t){var e=new A6(t);if(e.push(o,!0),e.err)throw e.msg||s9e[e.err];return e.result}function WOt(o,t){return t=t||{},t.raw=!0,a9e(o,t)}aX.Inflate=A6;aX.inflate=a9e;aX.inflateRaw=WOt;aX.ungzip=a9e});var pHe=cp((S8n,dHe)=>{"use strict";var zOt=vA().assign,YOt=mUe(),jOt=hHe(),XOt=o9e(),uHe={};zOt(uHe,YOt,jOt,XOt);dHe.exports=uHe});var YR=cp((xHe,m9e)=>{(function(o){typeof xHe=="object"&&typeof m9e<"u"?m9e.exports=o():typeof define=="function"&&define.amd?define([],o):(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).JSZip=o()})(function(){return(function o(t,e,r){function i(a,l){if(!e[a]){if(!t[a]){var c=typeof od=="function"&&od;if(!l&&c)return c(a,!0);if(n)return n(a,!0);var h=new Error("Cannot find module '"+a+"'");throw h.code="MODULE_NOT_FOUND",h}var u=e[a]={exports:{}};t[a][0].call(u.exports,function(d){var p=t[a][1][d];return i(p||d)},u,u.exports,o,t,e,r)}return e[a].exports}for(var n=typeof od=="function"&&od,s=0;s<r.length;s++)i(r[s]);return i})({1:[function(o,t,e){"use strict";var r=o("./utils"),i=o("./support"),n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.encode=function(s){for(var a,l,c,h,u,d,p,m=[],g=0,y=s.length,b=y,P=r.getTypeOf(s)!=="string";g<s.length;)b=y-g,c=P?(a=s[g++],l=g<y?s[g++]:0,g<y?s[g++]:0):(a=s.charCodeAt(g++),l=g<y?s.charCodeAt(g++):0,g<y?s.charCodeAt(g++):0),h=a>>2,u=(3&a)<<4|l>>4,d=1<b?(15&l)<<2|c>>6:64,p=2<b?63&c:64,m.push(n.charAt(h)+n.charAt(u)+n.charAt(d)+n.charAt(p));return m.join("")},e.decode=function(s){var a,l,c,h,u,d,p=0,m=0,g="data:";if(s.substr(0,g.length)===g)throw new Error("Invalid base64 input, it looks like a data url.");var y,b=3*(s=s.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(s.charAt(s.length-1)===n.charAt(64)&&b--,s.charAt(s.length-2)===n.charAt(64)&&b--,b%1!=0)throw new Error("Invalid base64 input, bad content length.");for(y=i.uint8array?new Uint8Array(0|b):new Array(0|b);p<s.length;)a=n.indexOf(s.charAt(p++))<<2|(h=n.indexOf(s.charAt(p++)))>>4,l=(15&h)<<4|(u=n.indexOf(s.charAt(p++)))>>2,c=(3&u)<<6|(d=n.indexOf(s.charAt(p++))),y[m++]=a,u!==64&&(y[m++]=l),d!==64&&(y[m++]=c);return y}},{"./support":30,"./utils":32}],2:[function(o,t,e){"use strict";var r=o("./external"),i=o("./stream/DataWorker"),n=o("./stream/Crc32Probe"),s=o("./stream/DataLengthProbe");function a(l,c,h,u,d){this.compressedSize=l,this.uncompressedSize=c,this.crc32=h,this.compression=u,this.compressedContent=d}a.prototype={getContentWorker:function(){var l=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),c=this;return l.on("end",function(){if(this.streamInfo.data_length!==c.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),l},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(l,c,h){return l.pipe(new n).pipe(new s("uncompressedSize")).pipe(c.compressWorker(h)).pipe(new s("compressedSize")).withStreamInfo("compression",c)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(o,t,e){"use strict";var r=o("./stream/GenericWorker");e.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},e.DEFLATE=o("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(o,t,e){"use strict";var r=o("./utils"),i=(function(){for(var n,s=[],a=0;a<256;a++){n=a;for(var l=0;l<8;l++)n=1&n?3988292384^n>>>1:n>>>1;s[a]=n}return s})();t.exports=function(n,s){return n!==void 0&&n.length?r.getTypeOf(n)!=="string"?(function(a,l,c,h){var u=i,d=h+c;a^=-1;for(var p=h;p<d;p++)a=a>>>8^u[255&(a^l[p])];return-1^a})(0|s,n,n.length,0):(function(a,l,c,h){var u=i,d=h+c;a^=-1;for(var p=h;p<d;p++)a=a>>>8^u[255&(a^l.charCodeAt(p))];return-1^a})(0|s,n,n.length,0):0}},{"./utils":32}],5:[function(o,t,e){"use strict";e.base64=!1,e.binary=!1,e.dir=!1,e.createFolders=!0,e.date=null,e.compression=null,e.compressionOptions=null,e.comment=null,e.unixPermissions=null,e.dosPermissions=null},{}],6:[function(o,t,e){"use strict";var r=null;r=typeof Promise<"u"?Promise:o("lie"),t.exports={Promise:r}},{lie:37}],7:[function(o,t,e){"use strict";var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=o("pako"),n=o("./utils"),s=o("./stream/GenericWorker"),a=r?"uint8array":"array";function l(c,h){s.call(this,"FlateWorker/"+c),this._pako=null,this._pakoAction=c,this._pakoOptions=h,this.meta={}}e.magic="\b\0",n.inherits(l,s),l.prototype.processChunk=function(c){this.meta=c.meta,this._pako===null&&this._createPako(),this._pako.push(n.transformTo(a,c.data),!1)},l.prototype.flush=function(){s.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var c=this;this._pako.onData=function(h){c.push({data:h,meta:c.meta})}},e.compressWorker=function(c){return new l("Deflate",c)},e.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(o,t,e){"use strict";function r(u,d){var p,m="";for(p=0;p<d;p++)m+=String.fromCharCode(255&u),u>>>=8;return m}function i(u,d,p,m,g,y){var b,P,T=u.file,I=u.compression,C=y!==a.utf8encode,E=n.transformTo("string",y(T.name)),O=n.transformTo("string",a.utf8encode(T.name)),_=T.comment,x=n.transformTo("string",y(_)),v=n.transformTo("string",a.utf8encode(_)),D=O.length!==T.name.length,w=v.length!==_.length,F="",H="",z="",V=T.dir,W=T.date,L={crc32:0,compressedSize:0,uncompressedSize:0};d&&!p||(L.crc32=u.crc32,L.compressedSize=u.compressedSize,L.uncompressedSize=u.uncompressedSize);var k=0;d&&(k|=8),C||!D&&!w||(k|=2048);var N=0,U=0;V&&(N|=16),g==="UNIX"?(U=798,N|=(function(G,Y){var X=G;return G||(X=Y?16893:33204),(65535&X)<<16})(T.unixPermissions,V)):(U=20,N|=(function(G){return 63&(G||0)})(T.dosPermissions)),b=W.getUTCHours(),b<<=6,b|=W.getUTCMinutes(),b<<=5,b|=W.getUTCSeconds()/2,P=W.getUTCFullYear()-1980,P<<=4,P|=W.getUTCMonth()+1,P<<=5,P|=W.getUTCDate(),D&&(H=r(1,1)+r(l(E),4)+O,F+="up"+r(H.length,2)+H),w&&(z=r(1,1)+r(l(x),4)+v,F+="uc"+r(z.length,2)+z);var B="";return B+=`
\0`,B+=r(k,2),B+=I.magic,B+=r(b,2),B+=r(P,2),B+=r(L.crc32,4),B+=r(L.compressedSize,4),B+=r(L.uncompressedSize,4),B+=r(E.length,2),B+=r(F.length,2),{fileRecord:c.LOCAL_FILE_HEADER+B+E+F,dirRecord:c.CENTRAL_FILE_HEADER+r(U,2)+B+r(x.length,2)+"\0\0\0\0"+r(N,4)+r(m,4)+E+F+x}}var n=o("../utils"),s=o("../stream/GenericWorker"),a=o("../utf8"),l=o("../crc32"),c=o("../signature");function h(u,d,p,m){s.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=d,this.zipPlatform=p,this.encodeFileName=m,this.streamFiles=u,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}n.inherits(h,s),h.prototype.push=function(u){var d=u.meta.percent||0,p=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(u):(this.bytesWritten+=u.data.length,s.prototype.push.call(this,{data:u.data,meta:{currentFile:this.currentFile,percent:p?(d+100*(p-m-1))/p:100}}))},h.prototype.openedSource=function(u){this.currentSourceOffset=this.bytesWritten,this.currentFile=u.file.name;var d=this.streamFiles&&!u.file.dir;if(d){var p=i(u,d,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:p.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(u){this.accumulate=!1;var d=this.streamFiles&&!u.file.dir,p=i(u,d,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),d)this.push({data:(function(m){return c.DATA_DESCRIPTOR+r(m.crc32,4)+r(m.compressedSize,4)+r(m.uncompressedSize,4)})(u),meta:{percent:100}});else for(this.push({data:p.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var u=this.bytesWritten,d=0;d<this.dirRecords.length;d++)this.push({data:this.dirRecords[d],meta:{percent:100}});var p=this.bytesWritten-u,m=(function(g,y,b,P,T){var I=n.transformTo("string",T(P));return c.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(g,2)+r(g,2)+r(y,4)+r(b,4)+r(I.length,2)+I})(this.dirRecords.length,p,u,this.zipComment,this.encodeFileName);this.push({data:m,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(u){this._sources.push(u);var d=this;return u.on("data",function(p){d.processChunk(p)}),u.on("end",function(){d.closedSource(d.previous.streamInfo),d._sources.length?d.prepareNextSource():d.end()}),u.on("error",function(p){d.error(p)}),this},h.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(u){var d=this._sources;if(!s.prototype.error.call(this,u))return!1;for(var p=0;p<d.length;p++)try{d[p].error(u)}catch{}return!0},h.prototype.lock=function(){s.prototype.lock.call(this);for(var u=this._sources,d=0;d<u.length;d++)u[d].lock()},t.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(o,t,e){"use strict";var r=o("../compressions"),i=o("./ZipFileWorker");e.generateWorker=function(n,s,a){var l=new i(s.streamFiles,a,s.platform,s.encodeFileName),c=0;try{n.forEach(function(h,u){c++;var d=(function(y,b){var P=y||b,T=r[P];if(!T)throw new Error(P+" is not a valid compression method !");return T})(u.options.compression,s.compression),p=u.options.compressionOptions||s.compressionOptions||{},m=u.dir,g=u.date;u._compressWorker(d,p).withStreamInfo("file",{name:h,dir:m,date:g,comment:u.comment||"",unixPermissions:u.unixPermissions,dosPermissions:u.dosPermissions}).pipe(l)}),l.entriesCount=c}catch(h){l.error(h)}return l}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(o,t,e){"use strict";function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var i=new r;for(var n in this)typeof this[n]!="function"&&(i[n]=this[n]);return i}}(r.prototype=o("./object")).loadAsync=o("./load"),r.support=o("./support"),r.defaults=o("./defaults"),r.version="3.10.1",r.loadAsync=function(i,n){return new r().loadAsync(i,n)},r.external=o("./external"),t.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(o,t,e){"use strict";var r=o("./utils"),i=o("./external"),n=o("./utf8"),s=o("./zipEntries"),a=o("./stream/Crc32Probe"),l=o("./nodejsUtils");function c(h){return new i.Promise(function(u,d){var p=h.decompressed.getContentWorker().pipe(new a);p.on("error",function(m){d(m)}).on("end",function(){p.streamInfo.crc32!==h.decompressed.crc32?d(new Error("Corrupted zip : CRC32 mismatch")):u()}).resume()})}t.exports=function(h,u){var d=this;return u=r.extend(u||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:n.utf8decode}),l.isNode&&l.isStream(h)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",h,!0,u.optimizedBinaryString,u.base64).then(function(p){var m=new s(u);return m.load(p),m}).then(function(p){var m=[i.Promise.resolve(p)],g=p.files;if(u.checkCRC32)for(var y=0;y<g.length;y++)m.push(c(g[y]));return i.Promise.all(m)}).then(function(p){for(var m=p.shift(),g=m.files,y=0;y<g.length;y++){var b=g[y],P=b.fileNameStr,T=r.resolve(b.fileNameStr);d.file(T,b.decompressed,{binary:!0,optimizedBinaryString:!0,date:b.date,dir:b.dir,comment:b.fileCommentStr.length?b.fileCommentStr:null,unixPermissions:b.unixPermissions,dosPermissions:b.dosPermissions,createFolders:u.createFolders}),b.dir||(d.file(T).unsafeOriginalName=P)}return m.zipComment.length&&(d.comment=m.zipComment),d})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(o,t,e){"use strict";var r=o("../utils"),i=o("../stream/GenericWorker");function n(s,a){i.call(this,"Nodejs stream input adapter for "+s),this._upstreamEnded=!1,this._bindStream(a)}r.inherits(n,i),n.prototype._bindStream=function(s){var a=this;(this._stream=s).pause(),s.on("data",function(l){a.push({data:l,meta:{percent:0}})}).on("error",function(l){a.isPaused?this.generatedError=l:a.error(l)}).on("end",function(){a.isPaused?a._upstreamEnded=!0:a.end()})},n.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},n.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=n},{"../stream/GenericWorker":28,"../utils":32}],13:[function(o,t,e){"use strict";var r=o("readable-stream").Readable;function i(n,s,a){r.call(this,s),this._helper=n;var l=this;n.on("data",function(c,h){l.push(c)||l._helper.pause(),a&&a(h)}).on("error",function(c){l.emit("error",c)}).on("end",function(){l.push(null)})}o("../utils").inherits(i,r),i.prototype._read=function(){this._helper.resume()},t.exports=i},{"../utils":32,"readable-stream":16}],14:[function(o,t,e){"use strict";t.exports={isNode:typeof Buffer<"u",newBufferFrom:function(r,i){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(r,i);if(typeof r=="number")throw new Error('The "data" argument must not be a number');return new Buffer(r,i)},allocBuffer:function(r){if(Buffer.alloc)return Buffer.alloc(r);var i=new Buffer(r);return i.fill(0),i},isBuffer:function(r){return Buffer.isBuffer(r)},isStream:function(r){return r&&typeof r.on=="function"&&typeof r.pause=="function"&&typeof r.resume=="function"}}},{}],15:[function(o,t,e){"use strict";function r(T,I,C){var E,O=n.getTypeOf(I),_=n.extend(C||{},l);_.date=_.date||new Date,_.compression!==null&&(_.compression=_.compression.toUpperCase()),typeof _.unixPermissions=="string"&&(_.unixPermissions=parseInt(_.unixPermissions,8)),_.unixPermissions&&16384&_.unixPermissions&&(_.dir=!0),_.dosPermissions&&16&_.dosPermissions&&(_.dir=!0),_.dir&&(T=g(T)),_.createFolders&&(E=m(T))&&y.call(this,E,!0);var x=O==="string"&&_.binary===!1&&_.base64===!1;C&&C.binary!==void 0||(_.binary=!x),(I instanceof c&&I.uncompressedSize===0||_.dir||!I||I.length===0)&&(_.base64=!1,_.binary=!0,I="",_.compression="STORE",O="string");var v=null;v=I instanceof c||I instanceof s?I:d.isNode&&d.isStream(I)?new p(T,I):n.prepareContent(T,I,_.binary,_.optimizedBinaryString,_.base64);var D=new h(T,v,_);this.files[T]=D}var i=o("./utf8"),n=o("./utils"),s=o("./stream/GenericWorker"),a=o("./stream/StreamHelper"),l=o("./defaults"),c=o("./compressedObject"),h=o("./zipObject"),u=o("./generate"),d=o("./nodejsUtils"),p=o("./nodejs/NodejsStreamInputAdapter"),m=function(T){T.slice(-1)==="/"&&(T=T.substring(0,T.length-1));var I=T.lastIndexOf("/");return 0<I?T.substring(0,I):""},g=function(T){return T.slice(-1)!=="/"&&(T+="/"),T},y=function(T,I){return I=I!==void 0?I:l.createFolders,T=g(T),this.files[T]||r.call(this,T,null,{dir:!0,createFolders:I}),this.files[T]};function b(T){return Object.prototype.toString.call(T)==="[object RegExp]"}var P={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(T){var I,C,E;for(I in this.files)E=this.files[I],(C=I.slice(this.root.length,I.length))&&I.slice(0,this.root.length)===this.root&&T(C,E)},filter:function(T){var I=[];return this.forEach(function(C,E){T(C,E)&&I.push(E)}),I},file:function(T,I,C){if(arguments.length!==1)return T=this.root+T,r.call(this,T,I,C),this;if(b(T)){var E=T;return this.filter(function(_,x){return!x.dir&&E.test(_)})}var O=this.files[this.root+T];return O&&!O.dir?O:null},folder:function(T){if(!T)return this;if(b(T))return this.filter(function(O,_){return _.dir&&T.test(O)});var I=this.root+T,C=y.call(this,I),E=this.clone();return E.root=C.name,E},remove:function(T){T=this.root+T;var I=this.files[T];if(I||(T.slice(-1)!=="/"&&(T+="/"),I=this.files[T]),I&&!I.dir)delete this.files[T];else for(var C=this.filter(function(O,_){return _.name.slice(0,T.length)===T}),E=0;E<C.length;E++)delete this.files[C[E].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(T){var I,C={};try{if((C=n.extend(T||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=C.type.toLowerCase(),C.compression=C.compression.toUpperCase(),C.type==="binarystring"&&(C.type="string"),!C.type)throw new Error("No output type specified.");n.checkSupport(C.type),C.platform!=="darwin"&&C.platform!=="freebsd"&&C.platform!=="linux"&&C.platform!=="sunos"||(C.platform="UNIX"),C.platform==="win32"&&(C.platform="DOS");var E=C.comment||this.comment||"";I=u.generateWorker(this,C,E)}catch(O){(I=new s("error")).error(O)}return new a(I,C.type||"string",C.mimeType)},generateAsync:function(T,I){return this.generateInternalStream(T).accumulate(I)},generateNodeStream:function(T,I){return(T=T||{}).type||(T.type="nodebuffer"),this.generateInternalStream(T).toNodejsStream(I)}};t.exports=P},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(o,t,e){"use strict";t.exports=o("stream")},{stream:void 0}],17:[function(o,t,e){"use strict";var r=o("./DataReader");function i(n){r.call(this,n);for(var s=0;s<this.data.length;s++)n[s]=255&n[s]}o("../utils").inherits(i,r),i.prototype.byteAt=function(n){return this.data[this.zero+n]},i.prototype.lastIndexOfSignature=function(n){for(var s=n.charCodeAt(0),a=n.charCodeAt(1),l=n.charCodeAt(2),c=n.charCodeAt(3),h=this.length-4;0<=h;--h)if(this.data[h]===s&&this.data[h+1]===a&&this.data[h+2]===l&&this.data[h+3]===c)return h-this.zero;return-1},i.prototype.readAndCheckSignature=function(n){var s=n.charCodeAt(0),a=n.charCodeAt(1),l=n.charCodeAt(2),c=n.charCodeAt(3),h=this.readData(4);return s===h[0]&&a===h[1]&&l===h[2]&&c===h[3]},i.prototype.readData=function(n){if(this.checkOffset(n),n===0)return[];var s=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,s},t.exports=i},{"../utils":32,"./DataReader":18}],18:[function(o,t,e){"use strict";var r=o("../utils");function i(n){this.data=n,this.length=n.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(n){this.checkIndex(this.index+n)},checkIndex:function(n){if(this.length<this.zero+n||n<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+n+"). Corrupted zip ?")},setIndex:function(n){this.checkIndex(n),this.index=n},skip:function(n){this.setIndex(this.index+n)},byteAt:function(){},readInt:function(n){var s,a=0;for(this.checkOffset(n),s=this.index+n-1;s>=this.index;s--)a=(a<<8)+this.byteAt(s);return this.index+=n,a},readString:function(n){return r.transformTo("string",this.readData(n))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var n=this.readInt(4);return new Date(Date.UTC(1980+(n>>25&127),(n>>21&15)-1,n>>16&31,n>>11&31,n>>5&63,(31&n)<<1))}},t.exports=i},{"../utils":32}],19:[function(o,t,e){"use strict";var r=o("./Uint8ArrayReader");function i(n){r.call(this,n)}o("../utils").inherits(i,r),i.prototype.readData=function(n){this.checkOffset(n);var s=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,s},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(o,t,e){"use strict";var r=o("./DataReader");function i(n){r.call(this,n)}o("../utils").inherits(i,r),i.prototype.byteAt=function(n){return this.data.charCodeAt(this.zero+n)},i.prototype.lastIndexOfSignature=function(n){return this.data.lastIndexOf(n)-this.zero},i.prototype.readAndCheckSignature=function(n){return n===this.readData(4)},i.prototype.readData=function(n){this.checkOffset(n);var s=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,s},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(o,t,e){"use strict";var r=o("./ArrayReader");function i(n){r.call(this,n)}o("../utils").inherits(i,r),i.prototype.readData=function(n){if(this.checkOffset(n),n===0)return new Uint8Array(0);var s=this.data.subarray(this.zero+this.index,this.zero+this.index+n);return this.index+=n,s},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(o,t,e){"use strict";var r=o("../utils"),i=o("../support"),n=o("./ArrayReader"),s=o("./StringReader"),a=o("./NodeBufferReader"),l=o("./Uint8ArrayReader");t.exports=function(c){var h=r.getTypeOf(c);return r.checkSupport(h),h!=="string"||i.uint8array?h==="nodebuffer"?new a(c):i.uint8array?new l(r.transformTo("uint8array",c)):new n(r.transformTo("array",c)):new s(c)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(o,t,e){"use strict";e.LOCAL_FILE_HEADER="PK",e.CENTRAL_FILE_HEADER="PK",e.CENTRAL_DIRECTORY_END="PK",e.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",e.ZIP64_CENTRAL_DIRECTORY_END="PK",e.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(o,t,e){"use strict";var r=o("./GenericWorker"),i=o("../utils");function n(s){r.call(this,"ConvertWorker to "+s),this.destType=s}i.inherits(n,r),n.prototype.processChunk=function(s){this.push({data:i.transformTo(this.destType,s.data),meta:s.meta})},t.exports=n},{"../utils":32,"./GenericWorker":28}],25:[function(o,t,e){"use strict";var r=o("./GenericWorker"),i=o("../crc32");function n(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}o("../utils").inherits(n,r),n.prototype.processChunk=function(s){this.streamInfo.crc32=i(s.data,this.streamInfo.crc32||0),this.push(s)},t.exports=n},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(o,t,e){"use strict";var r=o("../utils"),i=o("./GenericWorker");function n(s){i.call(this,"DataLengthProbe for "+s),this.propName=s,this.withStreamInfo(s,0)}r.inherits(n,i),n.prototype.processChunk=function(s){if(s){var a=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=a+s.data.length}i.prototype.processChunk.call(this,s)},t.exports=n},{"../utils":32,"./GenericWorker":28}],27:[function(o,t,e){"use strict";var r=o("../utils"),i=o("./GenericWorker");function n(s){i.call(this,"DataWorker");var a=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,s.then(function(l){a.dataIsReady=!0,a.data=l,a.max=l&&l.length||0,a.type=r.getTypeOf(l),a.isPaused||a._tickAndRepeat()},function(l){a.error(l)})}r.inherits(n,i),n.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},n.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},n.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},n.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var s=null,a=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":s=this.data.substring(this.index,a);break;case"uint8array":s=this.data.subarray(this.index,a);break;case"array":case"nodebuffer":s=this.data.slice(this.index,a)}return this.index=a,this.push({data:s,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=n},{"../utils":32,"./GenericWorker":28}],28:[function(o,t,e){"use strict";function r(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,n){return this._listeners[i].push(n),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,n){if(this._listeners[i])for(var s=0;s<this._listeners[i].length;s++)this._listeners[i][s].call(this,n)},pipe:function(i){return i.registerPrevious(this)},registerPrevious:function(i){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=i.streamInfo,this.mergeStreamInfo(),this.previous=i;var n=this;return i.on("data",function(s){n.processChunk(s)}),i.on("end",function(){n.end()}),i.on("error",function(s){n.error(s)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var i=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),i=!0),this.previous&&this.previous.resume(),!i},flush:function(){},processChunk:function(i){this.push(i)},withStreamInfo:function(i,n){return this.extraStreamInfo[i]=n,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var i in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,i)&&(this.streamInfo[i]=this.extraStreamInfo[i])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var i="Worker "+this.name;return this.previous?this.previous+" -> "+i:i}},t.exports=r},{}],29:[function(o,t,e){"use strict";var r=o("../utils"),i=o("./ConvertWorker"),n=o("./GenericWorker"),s=o("../base64"),a=o("../support"),l=o("../external"),c=null;if(a.nodestream)try{c=o("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(d,p){return new l.Promise(function(m,g){var y=[],b=d._internalType,P=d._outputType,T=d._mimeType;d.on("data",function(I,C){y.push(I),p&&p(C)}).on("error",function(I){y=[],g(I)}).on("end",function(){try{var I=(function(C,E,O){switch(C){case"blob":return r.newBlob(r.transformTo("arraybuffer",E),O);case"base64":return s.encode(E);default:return r.transformTo(C,E)}})(P,(function(C,E){var O,_=0,x=null,v=0;for(O=0;O<E.length;O++)v+=E[O].length;switch(C){case"string":return E.join("");case"array":return Array.prototype.concat.apply([],E);case"uint8array":for(x=new Uint8Array(v),O=0;O<E.length;O++)x.set(E[O],_),_+=E[O].length;return x;case"nodebuffer":return Buffer.concat(E);default:throw new Error("concat : unsupported type '"+C+"'")}})(b,y),T);m(I)}catch(C){g(C)}y=[]}).resume()})}function u(d,p,m){var g=p;switch(p){case"blob":case"arraybuffer":g="uint8array";break;case"base64":g="string"}try{this._internalType=g,this._outputType=p,this._mimeType=m,r.checkSupport(g),this._worker=d.pipe(new i(g)),d.lock()}catch(y){this._worker=new n("error"),this._worker.error(y)}}u.prototype={accumulate:function(d){return h(this,d)},on:function(d,p){var m=this;return d==="data"?this._worker.on(d,function(g){p.call(m,g.data,g.meta)}):this._worker.on(d,function(){r.delay(p,arguments,m)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(d){if(r.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new c(this,{objectMode:this._outputType!=="nodebuffer"},d)}},t.exports=u},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(o,t,e){"use strict";if(e.base64=!0,e.array=!0,e.string=!0,e.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",e.nodebuffer=typeof Buffer<"u",e.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")e.blob=!1;else{var r=new ArrayBuffer(0);try{e.blob=new Blob([r],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(r),e.blob=i.getBlob("application/zip").size===0}catch{e.blob=!1}}}try{e.nodestream=!!o("readable-stream").Readable}catch{e.nodestream=!1}},{"readable-stream":16}],31:[function(o,t,e){"use strict";for(var r=o("./utils"),i=o("./support"),n=o("./nodejsUtils"),s=o("./stream/GenericWorker"),a=new Array(256),l=0;l<256;l++)a[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;a[254]=a[254]=1;function c(){s.call(this,"utf-8 decode"),this.leftOver=null}function h(){s.call(this,"utf-8 encode")}e.utf8encode=function(u){return i.nodebuffer?n.newBufferFrom(u,"utf-8"):(function(d){var p,m,g,y,b,P=d.length,T=0;for(y=0;y<P;y++)(64512&(m=d.charCodeAt(y)))==55296&&y+1<P&&(64512&(g=d.charCodeAt(y+1)))==56320&&(m=65536+(m-55296<<10)+(g-56320),y++),T+=m<128?1:m<2048?2:m<65536?3:4;for(p=i.uint8array?new Uint8Array(T):new Array(T),y=b=0;b<T;y++)(64512&(m=d.charCodeAt(y)))==55296&&y+1<P&&(64512&(g=d.charCodeAt(y+1)))==56320&&(m=65536+(m-55296<<10)+(g-56320),y++),m<128?p[b++]=m:(m<2048?p[b++]=192|m>>>6:(m<65536?p[b++]=224|m>>>12:(p[b++]=240|m>>>18,p[b++]=128|m>>>12&63),p[b++]=128|m>>>6&63),p[b++]=128|63&m);return p})(u)},e.utf8decode=function(u){return i.nodebuffer?r.transformTo("nodebuffer",u).toString("utf-8"):(function(d){var p,m,g,y,b=d.length,P=new Array(2*b);for(p=m=0;p<b;)if((g=d[p++])<128)P[m++]=g;else if(4<(y=a[g]))P[m++]=65533,p+=y-1;else{for(g&=y===2?31:y===3?15:7;1<y&&p<b;)g=g<<6|63&d[p++],y--;1<y?P[m++]=65533:g<65536?P[m++]=g:(g-=65536,P[m++]=55296|g>>10&1023,P[m++]=56320|1023&g)}return P.length!==m&&(P.subarray?P=P.subarray(0,m):P.length=m),r.applyFromCharCode(P)})(u=r.transformTo(i.uint8array?"uint8array":"array",u))},r.inherits(c,s),c.prototype.processChunk=function(u){var d=r.transformTo(i.uint8array?"uint8array":"array",u.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var p=d;(d=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),d.set(p,this.leftOver.length)}else d=this.leftOver.concat(d);this.leftOver=null}var m=(function(y,b){var P;for((b=b||y.length)>y.length&&(b=y.length),P=b-1;0<=P&&(192&y[P])==128;)P--;return P<0||P===0?b:P+a[y[P]]>b?P:b})(d),g=d;m!==d.length&&(i.uint8array?(g=d.subarray(0,m),this.leftOver=d.subarray(m,d.length)):(g=d.slice(0,m),this.leftOver=d.slice(m,d.length))),this.push({data:e.utf8decode(g),meta:u.meta})},c.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:e.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},e.Utf8DecodeWorker=c,r.inherits(h,s),h.prototype.processChunk=function(u){this.push({data:e.utf8encode(u.data),meta:u.meta})},e.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(o,t,e){"use strict";var r=o("./support"),i=o("./base64"),n=o("./nodejsUtils"),s=o("./external");function a(p){return p}function l(p,m){for(var g=0;g<p.length;++g)m[g]=255&p.charCodeAt(g);return m}o("setimmediate"),e.newBlob=function(p,m){e.checkSupport("blob");try{return new Blob([p],{type:m})}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return g.append(p),g.getBlob(m)}catch{throw new Error("Bug : can't construct the Blob.")}}};var c={stringifyByChunk:function(p,m,g){var y=[],b=0,P=p.length;if(P<=g)return String.fromCharCode.apply(null,p);for(;b<P;)m==="array"||m==="nodebuffer"?y.push(String.fromCharCode.apply(null,p.slice(b,Math.min(b+g,P)))):y.push(String.fromCharCode.apply(null,p.subarray(b,Math.min(b+g,P)))),b+=g;return y.join("")},stringifyByChar:function(p){for(var m="",g=0;g<p.length;g++)m+=String.fromCharCode(p[g]);return m},applyCanBeUsed:{uint8array:(function(){try{return r.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return r.nodebuffer&&String.fromCharCode.apply(null,n.allocBuffer(1)).length===1}catch{return!1}})()}};function h(p){var m=65536,g=e.getTypeOf(p),y=!0;if(g==="uint8array"?y=c.applyCanBeUsed.uint8array:g==="nodebuffer"&&(y=c.applyCanBeUsed.nodebuffer),y)for(;1<m;)try{return c.stringifyByChunk(p,g,m)}catch{m=Math.floor(m/2)}return c.stringifyByChar(p)}function u(p,m){for(var g=0;g<p.length;g++)m[g]=p[g];return m}e.applyFromCharCode=h;var d={};d.string={string:a,array:function(p){return l(p,new Array(p.length))},arraybuffer:function(p){return d.string.uint8array(p).buffer},uint8array:function(p){return l(p,new Uint8Array(p.length))},nodebuffer:function(p){return l(p,n.allocBuffer(p.length))}},d.array={string:h,array:a,arraybuffer:function(p){return new Uint8Array(p).buffer},uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return n.newBufferFrom(p)}},d.arraybuffer={string:function(p){return h(new Uint8Array(p))},array:function(p){return u(new Uint8Array(p),new Array(p.byteLength))},arraybuffer:a,uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return n.newBufferFrom(new Uint8Array(p))}},d.uint8array={string:h,array:function(p){return u(p,new Array(p.length))},arraybuffer:function(p){return p.buffer},uint8array:a,nodebuffer:function(p){return n.newBufferFrom(p)}},d.nodebuffer={string:h,array:function(p){return u(p,new Array(p.length))},arraybuffer:function(p){return d.nodebuffer.uint8array(p).buffer},uint8array:function(p){return u(p,new Uint8Array(p.length))},nodebuffer:a},e.transformTo=function(p,m){if(m=m||"",!p)return m;e.checkSupport(p);var g=e.getTypeOf(m);return d[g][p](m)},e.resolve=function(p){for(var m=p.split("/"),g=[],y=0;y<m.length;y++){var b=m[y];b==="."||b===""&&y!==0&&y!==m.length-1||(b===".."?g.pop():g.push(b))}return g.join("/")},e.getTypeOf=function(p){return typeof p=="string"?"string":Object.prototype.toString.call(p)==="[object Array]"?"array":r.nodebuffer&&n.isBuffer(p)?"nodebuffer":r.uint8array&&p instanceof Uint8Array?"uint8array":r.arraybuffer&&p instanceof ArrayBuffer?"arraybuffer":void 0},e.checkSupport=function(p){if(!r[p.toLowerCase()])throw new Error(p+" is not supported by this platform")},e.MAX_VALUE_16BITS=65535,e.MAX_VALUE_32BITS=-1,e.pretty=function(p){var m,g,y="";for(g=0;g<(p||"").length;g++)y+="\\x"+((m=p.charCodeAt(g))<16?"0":"")+m.toString(16).toUpperCase();return y},e.delay=function(p,m,g){setImmediate(function(){p.apply(g||null,m||[])})},e.inherits=function(p,m){function g(){}g.prototype=m.prototype,p.prototype=new g},e.extend=function(){var p,m,g={};for(p=0;p<arguments.length;p++)for(m in arguments[p])Object.prototype.hasOwnProperty.call(arguments[p],m)&&g[m]===void 0&&(g[m]=arguments[p][m]);return g},e.prepareContent=function(p,m,g,y,b){return s.Promise.resolve(m).then(function(P){return r.blob&&(P instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(P))!==-1)&&typeof FileReader<"u"?new s.Promise(function(T,I){var C=new FileReader;C.onload=function(E){T(E.target.result)},C.onerror=function(E){I(E.target.error)},C.readAsArrayBuffer(P)}):P}).then(function(P){var T=e.getTypeOf(P);return T?(T==="arraybuffer"?P=e.transformTo("uint8array",P):T==="string"&&(b?P=i.decode(P):g&&y!==!0&&(P=(function(I){return l(I,r.uint8array?new Uint8Array(I.length):new Array(I.length))})(P))),P):s.Promise.reject(new Error("Can't read the data of '"+p+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(o,t,e){"use strict";var r=o("./reader/readerFor"),i=o("./utils"),n=o("./signature"),s=o("./zipEntry"),a=o("./support");function l(c){this.files=[],this.loadOptions=c}l.prototype={checkSignature:function(c){if(!this.reader.readAndCheckSignature(c)){this.reader.index-=4;var h=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(h)+", expected "+i.pretty(c)+")")}},isSignature:function(c,h){var u=this.reader.index;this.reader.setIndex(c);var d=this.reader.readString(4)===h;return this.reader.setIndex(u),d},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var c=this.reader.readData(this.zipCommentLength),h=a.uint8array?"uint8array":"array",u=i.transformTo(h,c);this.zipComment=this.loadOptions.decodeFileName(u)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var c,h,u,d=this.zip64EndOfCentralSize-44;0<d;)c=this.reader.readInt(2),h=this.reader.readInt(4),u=this.reader.readData(h),this.zip64ExtensibleData[c]={id:c,length:h,value:u}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var c,h;for(c=0;c<this.files.length;c++)h=this.files[c],this.reader.setIndex(h.localHeaderOffset),this.checkSignature(n.LOCAL_FILE_HEADER),h.readLocalPart(this.reader),h.handleUTF8(),h.processAttributes()},readCentralDir:function(){var c;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(n.CENTRAL_FILE_HEADER);)(c=new s({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(c);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var c=this.reader.lastIndexOfSignature(n.CENTRAL_DIRECTORY_END);if(c<0)throw this.isSignature(0,n.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(c);var h=c;if(this.checkSignature(n.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(c=this.reader.lastIndexOfSignature(n.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(c),this.checkSignature(n.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,n.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(n.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(n.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var u=this.centralDirOffset+this.centralDirSize;this.zip64&&(u+=20,u+=12+this.zip64EndOfCentralSize);var d=h-u;if(0<d)this.isSignature(h,n.CENTRAL_FILE_HEADER)||(this.reader.zero=d);else if(d<0)throw new Error("Corrupted zip: missing "+Math.abs(d)+" bytes.")},prepareReader:function(c){this.reader=r(c)},load:function(c){this.prepareReader(c),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=l},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(o,t,e){"use strict";var r=o("./reader/readerFor"),i=o("./utils"),n=o("./compressedObject"),s=o("./crc32"),a=o("./utf8"),l=o("./compressions"),c=o("./support");function h(u,d){this.options=u,this.loadOptions=d}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(u){var d,p;if(u.skip(22),this.fileNameLength=u.readInt(2),p=u.readInt(2),this.fileName=u.readData(this.fileNameLength),u.skip(p),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((d=(function(m){for(var g in l)if(Object.prototype.hasOwnProperty.call(l,g)&&l[g].magic===m)return l[g];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new n(this.compressedSize,this.uncompressedSize,this.crc32,d,u.readData(this.compressedSize))},readCentralPart:function(u){this.versionMadeBy=u.readInt(2),u.skip(2),this.bitFlag=u.readInt(2),this.compressionMethod=u.readString(2),this.date=u.readDate(),this.crc32=u.readInt(4),this.compressedSize=u.readInt(4),this.uncompressedSize=u.readInt(4);var d=u.readInt(2);if(this.extraFieldsLength=u.readInt(2),this.fileCommentLength=u.readInt(2),this.diskNumberStart=u.readInt(2),this.internalFileAttributes=u.readInt(2),this.externalFileAttributes=u.readInt(4),this.localHeaderOffset=u.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");u.skip(d),this.readExtraFields(u),this.parseZIP64ExtraField(u),this.fileComment=u.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var u=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),u==0&&(this.dosPermissions=63&this.externalFileAttributes),u==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var u=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=u.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=u.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=u.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=u.readInt(4))}},readExtraFields:function(u){var d,p,m,g=u.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});u.index+4<g;)d=u.readInt(2),p=u.readInt(2),m=u.readData(p),this.extraFields[d]={id:d,length:p,value:m};u.setIndex(g)},handleUTF8:function(){var u=c.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var d=this.findExtraFieldUnicodePath();if(d!==null)this.fileNameStr=d;else{var p=i.transformTo(u,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(p)}var m=this.findExtraFieldUnicodeComment();if(m!==null)this.fileCommentStr=m;else{var g=i.transformTo(u,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(g)}}},findExtraFieldUnicodePath:function(){var u=this.extraFields[28789];if(u){var d=r(u.value);return d.readInt(1)!==1||s(this.fileName)!==d.readInt(4)?null:a.utf8decode(d.readData(u.length-5))}return null},findExtraFieldUnicodeComment:function(){var u=this.extraFields[25461];if(u){var d=r(u.value);return d.readInt(1)!==1||s(this.fileComment)!==d.readInt(4)?null:a.utf8decode(d.readData(u.length-5))}return null}},t.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(o,t,e){"use strict";function r(d,p,m){this.name=d,this.dir=m.dir,this.date=m.date,this.comment=m.comment,this.unixPermissions=m.unixPermissions,this.dosPermissions=m.dosPermissions,this._data=p,this._dataBinary=m.binary,this.options={compression:m.compression,compressionOptions:m.compressionOptions}}var i=o("./stream/StreamHelper"),n=o("./stream/DataWorker"),s=o("./utf8"),a=o("./compressedObject"),l=o("./stream/GenericWorker");r.prototype={internalStream:function(d){var p=null,m="string";try{if(!d)throw new Error("No output type specified.");var g=(m=d.toLowerCase())==="string"||m==="text";m!=="binarystring"&&m!=="text"||(m="string"),p=this._decompressWorker();var y=!this._dataBinary;y&&!g&&(p=p.pipe(new s.Utf8EncodeWorker)),!y&&g&&(p=p.pipe(new s.Utf8DecodeWorker))}catch(b){(p=new l("error")).error(b)}return new i(p,m,"")},async:function(d,p){return this.internalStream(d).accumulate(p)},nodeStream:function(d,p){return this.internalStream(d||"nodebuffer").toNodejsStream(p)},_compressWorker:function(d,p){if(this._data instanceof a&&this._data.compression.magic===d.magic)return this._data.getCompressedWorker();var m=this._decompressWorker();return this._dataBinary||(m=m.pipe(new s.Utf8EncodeWorker)),a.createWorkerFrom(m,d,p)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof l?this._data:new n(this._data)}};for(var c=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},u=0;u<c.length;u++)r.prototype[c[u]]=h;t.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(o,t,e){(function(r){"use strict";var i,n,s=r.MutationObserver||r.WebKitMutationObserver;if(s){var a=0,l=new s(d),c=r.document.createTextNode("");l.observe(c,{characterData:!0}),i=function(){c.data=a=++a%2}}else if(r.setImmediate||r.MessageChannel===void 0)i="document"in r&&"onreadystatechange"in r.document.createElement("script")?function(){var p=r.document.createElement("script");p.onreadystatechange=function(){d(),p.onreadystatechange=null,p.parentNode.removeChild(p),p=null},r.document.documentElement.appendChild(p)}:function(){setTimeout(d,0)};else{var h=new r.MessageChannel;h.port1.onmessage=d,i=function(){h.port2.postMessage(0)}}var u=[];function d(){var p,m;n=!0;for(var g=u.length;g;){for(m=u,u=[],p=-1;++p<g;)m[p]();g=u.length}n=!1}t.exports=function(p){u.push(p)!==1||n||i()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(o,t,e){"use strict";var r=o("immediate");function i(){}var n={},s=["REJECTED"],a=["FULFILLED"],l=["PENDING"];function c(g){if(typeof g!="function")throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,g!==i&&p(this,g)}function h(g,y,b){this.promise=g,typeof y=="function"&&(this.onFulfilled=y,this.callFulfilled=this.otherCallFulfilled),typeof b=="function"&&(this.onRejected=b,this.callRejected=this.otherCallRejected)}function u(g,y,b){r(function(){var P;try{P=y(b)}catch(T){return n.reject(g,T)}P===g?n.reject(g,new TypeError("Cannot resolve promise with itself")):n.resolve(g,P)})}function d(g){var y=g&&g.then;if(g&&(typeof g=="object"||typeof g=="function")&&typeof y=="function")return function(){y.apply(g,arguments)}}function p(g,y){var b=!1;function P(C){b||(b=!0,n.reject(g,C))}function T(C){b||(b=!0,n.resolve(g,C))}var I=m(function(){y(T,P)});I.status==="error"&&P(I.value)}function m(g,y){var b={};try{b.value=g(y),b.status="success"}catch(P){b.status="error",b.value=P}return b}(t.exports=c).prototype.finally=function(g){if(typeof g!="function")return this;var y=this.constructor;return this.then(function(b){return y.resolve(g()).then(function(){return b})},function(b){return y.resolve(g()).then(function(){throw b})})},c.prototype.catch=function(g){return this.then(null,g)},c.prototype.then=function(g,y){if(typeof g!="function"&&this.state===a||typeof y!="function"&&this.state===s)return this;var b=new this.constructor(i);return this.state!==l?u(b,this.state===a?g:y,this.outcome):this.queue.push(new h(b,g,y)),b},h.prototype.callFulfilled=function(g){n.resolve(this.promise,g)},h.prototype.otherCallFulfilled=function(g){u(this.promise,this.onFulfilled,g)},h.prototype.callRejected=function(g){n.reject(this.promise,g)},h.prototype.otherCallRejected=function(g){u(this.promise,this.onRejected,g)},n.resolve=function(g,y){var b=m(d,y);if(b.status==="error")return n.reject(g,b.value);var P=b.value;if(P)p(g,P);else{g.state=a,g.outcome=y;for(var T=-1,I=g.queue.length;++T<I;)g.queue[T].callFulfilled(y)}return g},n.reject=function(g,y){g.state=s,g.outcome=y;for(var b=-1,P=g.queue.length;++b<P;)g.queue[b].callRejected(y);return g},c.resolve=function(g){return g instanceof this?g:n.resolve(new this(i),g)},c.reject=function(g){var y=new this(i);return n.reject(y,g)},c.all=function(g){var y=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=g.length,P=!1;if(!b)return this.resolve([]);for(var T=new Array(b),I=0,C=-1,E=new this(i);++C<b;)O(g[C],C);return E;function O(_,x){y.resolve(_).then(function(v){T[x]=v,++I!==b||P||(P=!0,n.resolve(E,T))},function(v){P||(P=!0,n.reject(E,v))})}},c.race=function(g){var y=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=g.length,P=!1;if(!b)return this.resolve([]);for(var T=-1,I=new this(i);++T<b;)C=g[T],y.resolve(C).then(function(E){P||(P=!0,n.resolve(I,E))},function(E){P||(P=!0,n.reject(I,E))});var C;return I}},{immediate:36}],38:[function(o,t,e){"use strict";var r={};(0,o("./lib/utils/common").assign)(r,o("./lib/deflate"),o("./lib/inflate"),o("./lib/zlib/constants")),t.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(o,t,e){"use strict";var r=o("./zlib/deflate"),i=o("./utils/common"),n=o("./utils/strings"),s=o("./zlib/messages"),a=o("./zlib/zstream"),l=Object.prototype.toString,c=0,h=-1,u=0,d=8;function p(g){if(!(this instanceof p))return new p(g);this.options=i.assign({level:h,method:d,chunkSize:16384,windowBits:15,memLevel:8,strategy:u,to:""},g||{});var y=this.options;y.raw&&0<y.windowBits?y.windowBits=-y.windowBits:y.gzip&&0<y.windowBits&&y.windowBits<16&&(y.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var b=r.deflateInit2(this.strm,y.level,y.method,y.windowBits,y.memLevel,y.strategy);if(b!==c)throw new Error(s[b]);if(y.header&&r.deflateSetHeader(this.strm,y.header),y.dictionary){var P;if(P=typeof y.dictionary=="string"?n.string2buf(y.dictionary):l.call(y.dictionary)==="[object ArrayBuffer]"?new Uint8Array(y.dictionary):y.dictionary,(b=r.deflateSetDictionary(this.strm,P))!==c)throw new Error(s[b]);this._dict_set=!0}}function m(g,y){var b=new p(y);if(b.push(g,!0),b.err)throw b.msg||s[b.err];return b.result}p.prototype.push=function(g,y){var b,P,T=this.strm,I=this.options.chunkSize;if(this.ended)return!1;P=y===~~y?y:y===!0?4:0,typeof g=="string"?T.input=n.string2buf(g):l.call(g)==="[object ArrayBuffer]"?T.input=new Uint8Array(g):T.input=g,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new i.Buf8(I),T.next_out=0,T.avail_out=I),(b=r.deflate(T,P))!==1&&b!==c)return this.onEnd(b),!(this.ended=!0);T.avail_out!==0&&(T.avail_in!==0||P!==4&&P!==2)||(this.options.to==="string"?this.onData(n.buf2binstring(i.shrinkBuf(T.output,T.next_out))):this.onData(i.shrinkBuf(T.output,T.next_out)))}while((0<T.avail_in||T.avail_out===0)&&b!==1);return P===4?(b=r.deflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===c):P!==2||(this.onEnd(c),!(T.avail_out=0))},p.prototype.onData=function(g){this.chunks.push(g)},p.prototype.onEnd=function(g){g===c&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},e.Deflate=p,e.deflate=m,e.deflateRaw=function(g,y){return(y=y||{}).raw=!0,m(g,y)},e.gzip=function(g,y){return(y=y||{}).gzip=!0,m(g,y)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(o,t,e){"use strict";var r=o("./zlib/inflate"),i=o("./utils/common"),n=o("./utils/strings"),s=o("./zlib/constants"),a=o("./zlib/messages"),l=o("./zlib/zstream"),c=o("./zlib/gzheader"),h=Object.prototype.toString;function u(p){if(!(this instanceof u))return new u(p);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},p||{});var m=this.options;m.raw&&0<=m.windowBits&&m.windowBits<16&&(m.windowBits=-m.windowBits,m.windowBits===0&&(m.windowBits=-15)),!(0<=m.windowBits&&m.windowBits<16)||p&&p.windowBits||(m.windowBits+=32),15<m.windowBits&&m.windowBits<48&&(15&m.windowBits)==0&&(m.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var g=r.inflateInit2(this.strm,m.windowBits);if(g!==s.Z_OK)throw new Error(a[g]);this.header=new c,r.inflateGetHeader(this.strm,this.header)}function d(p,m){var g=new u(m);if(g.push(p,!0),g.err)throw g.msg||a[g.err];return g.result}u.prototype.push=function(p,m){var g,y,b,P,T,I,C=this.strm,E=this.options.chunkSize,O=this.options.dictionary,_=!1;if(this.ended)return!1;y=m===~~m?m:m===!0?s.Z_FINISH:s.Z_NO_FLUSH,typeof p=="string"?C.input=n.binstring2buf(p):h.call(p)==="[object ArrayBuffer]"?C.input=new Uint8Array(p):C.input=p,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new i.Buf8(E),C.next_out=0,C.avail_out=E),(g=r.inflate(C,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&O&&(I=typeof O=="string"?n.string2buf(O):h.call(O)==="[object ArrayBuffer]"?new Uint8Array(O):O,g=r.inflateSetDictionary(this.strm,I)),g===s.Z_BUF_ERROR&&_===!0&&(g=s.Z_OK,_=!1),g!==s.Z_STREAM_END&&g!==s.Z_OK)return this.onEnd(g),!(this.ended=!0);C.next_out&&(C.avail_out!==0&&g!==s.Z_STREAM_END&&(C.avail_in!==0||y!==s.Z_FINISH&&y!==s.Z_SYNC_FLUSH)||(this.options.to==="string"?(b=n.utf8border(C.output,C.next_out),P=C.next_out-b,T=n.buf2string(C.output,b),C.next_out=P,C.avail_out=E-P,P&&i.arraySet(C.output,C.output,b,P,0),this.onData(T)):this.onData(i.shrinkBuf(C.output,C.next_out)))),C.avail_in===0&&C.avail_out===0&&(_=!0)}while((0<C.avail_in||C.avail_out===0)&&g!==s.Z_STREAM_END);return g===s.Z_STREAM_END&&(y=s.Z_FINISH),y===s.Z_FINISH?(g=r.inflateEnd(this.strm),this.onEnd(g),this.ended=!0,g===s.Z_OK):y!==s.Z_SYNC_FLUSH||(this.onEnd(s.Z_OK),!(C.avail_out=0))},u.prototype.onData=function(p){this.chunks.push(p)},u.prototype.onEnd=function(p){p===s.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=p,this.msg=this.strm.msg},e.Inflate=u,e.inflate=d,e.inflateRaw=function(p,m){return(m=m||{}).raw=!0,d(p,m)},e.ungzip=d},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(o,t,e){"use strict";var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";e.assign=function(s){for(var a=Array.prototype.slice.call(arguments,1);a.length;){var l=a.shift();if(l){if(typeof l!="object")throw new TypeError(l+"must be non-object");for(var c in l)l.hasOwnProperty(c)&&(s[c]=l[c])}}return s},e.shrinkBuf=function(s,a){return s.length===a?s:s.subarray?s.subarray(0,a):(s.length=a,s)};var i={arraySet:function(s,a,l,c,h){if(a.subarray&&s.subarray)s.set(a.subarray(l,l+c),h);else for(var u=0;u<c;u++)s[h+u]=a[l+u]},flattenChunks:function(s){var a,l,c,h,u,d;for(a=c=0,l=s.length;a<l;a++)c+=s[a].length;for(d=new Uint8Array(c),a=h=0,l=s.length;a<l;a++)u=s[a],d.set(u,h),h+=u.length;return d}},n={arraySet:function(s,a,l,c,h){for(var u=0;u<c;u++)s[h+u]=a[l+u]},flattenChunks:function(s){return[].concat.apply([],s)}};e.setTyped=function(s){s?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,i)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,n))},e.setTyped(r)},{}],42:[function(o,t,e){"use strict";var r=o("./common"),i=!0,n=!0;try{String.fromCharCode.apply(null,[0])}catch{i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{n=!1}for(var s=new r.Buf8(256),a=0;a<256;a++)s[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function l(c,h){if(h<65537&&(c.subarray&&n||!c.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(c,h));for(var u="",d=0;d<h;d++)u+=String.fromCharCode(c[d]);return u}s[254]=s[254]=1,e.string2buf=function(c){var h,u,d,p,m,g=c.length,y=0;for(p=0;p<g;p++)(64512&(u=c.charCodeAt(p)))==55296&&p+1<g&&(64512&(d=c.charCodeAt(p+1)))==56320&&(u=65536+(u-55296<<10)+(d-56320),p++),y+=u<128?1:u<2048?2:u<65536?3:4;for(h=new r.Buf8(y),p=m=0;m<y;p++)(64512&(u=c.charCodeAt(p)))==55296&&p+1<g&&(64512&(d=c.charCodeAt(p+1)))==56320&&(u=65536+(u-55296<<10)+(d-56320),p++),u<128?h[m++]=u:(u<2048?h[m++]=192|u>>>6:(u<65536?h[m++]=224|u>>>12:(h[m++]=240|u>>>18,h[m++]=128|u>>>12&63),h[m++]=128|u>>>6&63),h[m++]=128|63&u);return h},e.buf2binstring=function(c){return l(c,c.length)},e.binstring2buf=function(c){for(var h=new r.Buf8(c.length),u=0,d=h.length;u<d;u++)h[u]=c.charCodeAt(u);return h},e.buf2string=function(c,h){var u,d,p,m,g=h||c.length,y=new Array(2*g);for(u=d=0;u<g;)if((p=c[u++])<128)y[d++]=p;else if(4<(m=s[p]))y[d++]=65533,u+=m-1;else{for(p&=m===2?31:m===3?15:7;1<m&&u<g;)p=p<<6|63&c[u++],m--;1<m?y[d++]=65533:p<65536?y[d++]=p:(p-=65536,y[d++]=55296|p>>10&1023,y[d++]=56320|1023&p)}return l(y,d)},e.utf8border=function(c,h){var u;for((h=h||c.length)>c.length&&(h=c.length),u=h-1;0<=u&&(192&c[u])==128;)u--;return u<0||u===0?h:u+s[c[u]]>h?u:h}},{"./common":41}],43:[function(o,t,e){"use strict";t.exports=function(r,i,n,s){for(var a=65535&r|0,l=r>>>16&65535|0,c=0;n!==0;){for(n-=c=2e3<n?2e3:n;l=l+(a=a+i[s++]|0)|0,--c;);a%=65521,l%=65521}return a|l<<16|0}},{}],44:[function(o,t,e){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(o,t,e){"use strict";var r=(function(){for(var i,n=[],s=0;s<256;s++){i=s;for(var a=0;a<8;a++)i=1&i?3988292384^i>>>1:i>>>1;n[s]=i}return n})();t.exports=function(i,n,s,a){var l=r,c=a+s;i^=-1;for(var h=a;h<c;h++)i=i>>>8^l[255&(i^n[h])];return-1^i}},{}],46:[function(o,t,e){"use strict";var r,i=o("../utils/common"),n=o("./trees"),s=o("./adler32"),a=o("./crc32"),l=o("./messages"),c=0,h=4,u=0,d=-2,p=-1,m=4,g=2,y=8,b=9,P=286,T=30,I=19,C=2*P+1,E=15,O=3,_=258,x=_+O+1,v=42,D=113,w=1,F=2,H=3,z=4;function V($,fe){return $.msg=l[fe],fe}function W($){return($<<1)-(4<$?9:0)}function L($){for(var fe=$.length;0<=--fe;)$[fe]=0}function k($){var fe=$.state,Oe=fe.pending;Oe>$.avail_out&&(Oe=$.avail_out),Oe!==0&&(i.arraySet($.output,fe.pending_buf,fe.pending_out,Oe,$.next_out),$.next_out+=Oe,fe.pending_out+=Oe,$.total_out+=Oe,$.avail_out-=Oe,fe.pending-=Oe,fe.pending===0&&(fe.pending_out=0))}function N($,fe){n._tr_flush_block($,0<=$.block_start?$.block_start:-1,$.strstart-$.block_start,fe),$.block_start=$.strstart,k($.strm)}function U($,fe){$.pending_buf[$.pending++]=fe}function B($,fe){$.pending_buf[$.pending++]=fe>>>8&255,$.pending_buf[$.pending++]=255&fe}function G($,fe){var Oe,Te,ue=$.max_chain_length,be=$.strstart,j=$.prev_length,Z=$.nice_match,ie=$.strstart>$.w_size-x?$.strstart-($.w_size-x):0,de=$.window,me=$.w_mask,Se=$.prev,Re=$.strstart+_,Je=de[be+j-1],Ke=de[be+j];$.prev_length>=$.good_match&&(ue>>=2),Z>$.lookahead&&(Z=$.lookahead);do if(de[(Oe=fe)+j]===Ke&&de[Oe+j-1]===Je&&de[Oe]===de[be]&&de[++Oe]===de[be+1]){be+=2,Oe++;do;while(de[++be]===de[++Oe]&&de[++be]===de[++Oe]&&de[++be]===de[++Oe]&&de[++be]===de[++Oe]&&de[++be]===de[++Oe]&&de[++be]===de[++Oe]&&de[++be]===de[++Oe]&&de[++be]===de[++Oe]&&be<Re);if(Te=_-(Re-be),be=Re-_,j<Te){if($.match_start=fe,Z<=(j=Te))break;Je=de[be+j-1],Ke=de[be+j]}}while((fe=Se[fe&me])>ie&&--ue!=0);return j<=$.lookahead?j:$.lookahead}function Y($){var fe,Oe,Te,ue,be,j,Z,ie,de,me,Se=$.w_size;do{if(ue=$.window_size-$.lookahead-$.strstart,$.strstart>=Se+(Se-x)){for(i.arraySet($.window,$.window,Se,Se,0),$.match_start-=Se,$.strstart-=Se,$.block_start-=Se,fe=Oe=$.hash_size;Te=$.head[--fe],$.head[fe]=Se<=Te?Te-Se:0,--Oe;);for(fe=Oe=Se;Te=$.prev[--fe],$.prev[fe]=Se<=Te?Te-Se:0,--Oe;);ue+=Se}if($.strm.avail_in===0)break;if(j=$.strm,Z=$.window,ie=$.strstart+$.lookahead,de=ue,me=void 0,me=j.avail_in,de<me&&(me=de),Oe=me===0?0:(j.avail_in-=me,i.arraySet(Z,j.input,j.next_in,me,ie),j.state.wrap===1?j.adler=s(j.adler,Z,me,ie):j.state.wrap===2&&(j.adler=a(j.adler,Z,me,ie)),j.next_in+=me,j.total_in+=me,me),$.lookahead+=Oe,$.lookahead+$.insert>=O)for(be=$.strstart-$.insert,$.ins_h=$.window[be],$.ins_h=($.ins_h<<$.hash_shift^$.window[be+1])&$.hash_mask;$.insert&&($.ins_h=($.ins_h<<$.hash_shift^$.window[be+O-1])&$.hash_mask,$.prev[be&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=be,be++,$.insert--,!($.lookahead+$.insert<O)););}while($.lookahead<x&&$.strm.avail_in!==0)}function X($,fe){for(var Oe,Te;;){if($.lookahead<x){if(Y($),$.lookahead<x&&fe===c)return w;if($.lookahead===0)break}if(Oe=0,$.lookahead>=O&&($.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+O-1])&$.hash_mask,Oe=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart),Oe!==0&&$.strstart-Oe<=$.w_size-x&&($.match_length=G($,Oe)),$.match_length>=O)if(Te=n._tr_tally($,$.strstart-$.match_start,$.match_length-O),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=O){for($.match_length--;$.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+O-1])&$.hash_mask,Oe=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart,--$.match_length!=0;);$.strstart++}else $.strstart+=$.match_length,$.match_length=0,$.ins_h=$.window[$.strstart],$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+1])&$.hash_mask;else Te=n._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(Te&&(N($,!1),$.strm.avail_out===0))return w}return $.insert=$.strstart<O-1?$.strstart:O-1,fe===h?(N($,!0),$.strm.avail_out===0?H:z):$.last_lit&&(N($,!1),$.strm.avail_out===0)?w:F}function K($,fe){for(var Oe,Te,ue;;){if($.lookahead<x){if(Y($),$.lookahead<x&&fe===c)return w;if($.lookahead===0)break}if(Oe=0,$.lookahead>=O&&($.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+O-1])&$.hash_mask,Oe=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart),$.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=O-1,Oe!==0&&$.prev_length<$.max_lazy_match&&$.strstart-Oe<=$.w_size-x&&($.match_length=G($,Oe),$.match_length<=5&&($.strategy===1||$.match_length===O&&4096<$.strstart-$.match_start)&&($.match_length=O-1)),$.prev_length>=O&&$.match_length<=$.prev_length){for(ue=$.strstart+$.lookahead-O,Te=n._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-O),$.lookahead-=$.prev_length-1,$.prev_length-=2;++$.strstart<=ue&&($.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+O-1])&$.hash_mask,Oe=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart),--$.prev_length!=0;);if($.match_available=0,$.match_length=O-1,$.strstart++,Te&&(N($,!1),$.strm.avail_out===0))return w}else if($.match_available){if((Te=n._tr_tally($,0,$.window[$.strstart-1]))&&N($,!1),$.strstart++,$.lookahead--,$.strm.avail_out===0)return w}else $.match_available=1,$.strstart++,$.lookahead--}return $.match_available&&(Te=n._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0),$.insert=$.strstart<O-1?$.strstart:O-1,fe===h?(N($,!0),$.strm.avail_out===0?H:z):$.last_lit&&(N($,!1),$.strm.avail_out===0)?w:F}function J($,fe,Oe,Te,ue){this.good_length=$,this.max_lazy=fe,this.nice_length=Oe,this.max_chain=Te,this.func=ue}function se(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=y,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*C),this.dyn_dtree=new i.Buf16(2*(2*T+1)),this.bl_tree=new i.Buf16(2*(2*I+1)),L(this.dyn_ltree),L(this.dyn_dtree),L(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(E+1),this.heap=new i.Buf16(2*P+1),L(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*P+1),L(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function ce($){var fe;return $&&$.state?($.total_in=$.total_out=0,$.data_type=g,(fe=$.state).pending=0,fe.pending_out=0,fe.wrap<0&&(fe.wrap=-fe.wrap),fe.status=fe.wrap?v:D,$.adler=fe.wrap===2?0:1,fe.last_flush=c,n._tr_init(fe),u):V($,d)}function te($){var fe=ce($);return fe===u&&(function(Oe){Oe.window_size=2*Oe.w_size,L(Oe.head),Oe.max_lazy_match=r[Oe.level].max_lazy,Oe.good_match=r[Oe.level].good_length,Oe.nice_match=r[Oe.level].nice_length,Oe.max_chain_length=r[Oe.level].max_chain,Oe.strstart=0,Oe.block_start=0,Oe.lookahead=0,Oe.insert=0,Oe.match_length=Oe.prev_length=O-1,Oe.match_available=0,Oe.ins_h=0})($.state),fe}function oe($,fe,Oe,Te,ue,be){if(!$)return d;var j=1;if(fe===p&&(fe=6),Te<0?(j=0,Te=-Te):15<Te&&(j=2,Te-=16),ue<1||b<ue||Oe!==y||Te<8||15<Te||fe<0||9<fe||be<0||m<be)return V($,d);Te===8&&(Te=9);var Z=new se;return($.state=Z).strm=$,Z.wrap=j,Z.gzhead=null,Z.w_bits=Te,Z.w_size=1<<Z.w_bits,Z.w_mask=Z.w_size-1,Z.hash_bits=ue+7,Z.hash_size=1<<Z.hash_bits,Z.hash_mask=Z.hash_size-1,Z.hash_shift=~~((Z.hash_bits+O-1)/O),Z.window=new i.Buf8(2*Z.w_size),Z.head=new i.Buf16(Z.hash_size),Z.prev=new i.Buf16(Z.w_size),Z.lit_bufsize=1<<ue+6,Z.pending_buf_size=4*Z.lit_bufsize,Z.pending_buf=new i.Buf8(Z.pending_buf_size),Z.d_buf=1*Z.lit_bufsize,Z.l_buf=3*Z.lit_bufsize,Z.level=fe,Z.strategy=be,Z.method=Oe,te($)}r=[new J(0,0,0,0,function($,fe){var Oe=65535;for(Oe>$.pending_buf_size-5&&(Oe=$.pending_buf_size-5);;){if($.lookahead<=1){if(Y($),$.lookahead===0&&fe===c)return w;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var Te=$.block_start+Oe;if(($.strstart===0||$.strstart>=Te)&&($.lookahead=$.strstart-Te,$.strstart=Te,N($,!1),$.strm.avail_out===0)||$.strstart-$.block_start>=$.w_size-x&&(N($,!1),$.strm.avail_out===0))return w}return $.insert=0,fe===h?(N($,!0),$.strm.avail_out===0?H:z):($.strstart>$.block_start&&(N($,!1),$.strm.avail_out),w)}),new J(4,4,8,4,X),new J(4,5,16,8,X),new J(4,6,32,32,X),new J(4,4,16,16,K),new J(8,16,32,32,K),new J(8,16,128,128,K),new J(8,32,128,256,K),new J(32,128,258,1024,K),new J(32,258,258,4096,K)],e.deflateInit=function($,fe){return oe($,fe,y,15,8,0)},e.deflateInit2=oe,e.deflateReset=te,e.deflateResetKeep=ce,e.deflateSetHeader=function($,fe){return $&&$.state?$.state.wrap!==2?d:($.state.gzhead=fe,u):d},e.deflate=function($,fe){var Oe,Te,ue,be;if(!$||!$.state||5<fe||fe<0)return $?V($,d):d;if(Te=$.state,!$.output||!$.input&&$.avail_in!==0||Te.status===666&&fe!==h)return V($,$.avail_out===0?-5:d);if(Te.strm=$,Oe=Te.last_flush,Te.last_flush=fe,Te.status===v)if(Te.wrap===2)$.adler=0,U(Te,31),U(Te,139),U(Te,8),Te.gzhead?(U(Te,(Te.gzhead.text?1:0)+(Te.gzhead.hcrc?2:0)+(Te.gzhead.extra?4:0)+(Te.gzhead.name?8:0)+(Te.gzhead.comment?16:0)),U(Te,255&Te.gzhead.time),U(Te,Te.gzhead.time>>8&255),U(Te,Te.gzhead.time>>16&255),U(Te,Te.gzhead.time>>24&255),U(Te,Te.level===9?2:2<=Te.strategy||Te.level<2?4:0),U(Te,255&Te.gzhead.os),Te.gzhead.extra&&Te.gzhead.extra.length&&(U(Te,255&Te.gzhead.extra.length),U(Te,Te.gzhead.extra.length>>8&255)),Te.gzhead.hcrc&&($.adler=a($.adler,Te.pending_buf,Te.pending,0)),Te.gzindex=0,Te.status=69):(U(Te,0),U(Te,0),U(Te,0),U(Te,0),U(Te,0),U(Te,Te.level===9?2:2<=Te.strategy||Te.level<2?4:0),U(Te,3),Te.status=D);else{var j=y+(Te.w_bits-8<<4)<<8;j|=(2<=Te.strategy||Te.level<2?0:Te.level<6?1:Te.level===6?2:3)<<6,Te.strstart!==0&&(j|=32),j+=31-j%31,Te.status=D,B(Te,j),Te.strstart!==0&&(B(Te,$.adler>>>16),B(Te,65535&$.adler)),$.adler=1}if(Te.status===69)if(Te.gzhead.extra){for(ue=Te.pending;Te.gzindex<(65535&Te.gzhead.extra.length)&&(Te.pending!==Te.pending_buf_size||(Te.gzhead.hcrc&&Te.pending>ue&&($.adler=a($.adler,Te.pending_buf,Te.pending-ue,ue)),k($),ue=Te.pending,Te.pending!==Te.pending_buf_size));)U(Te,255&Te.gzhead.extra[Te.gzindex]),Te.gzindex++;Te.gzhead.hcrc&&Te.pending>ue&&($.adler=a($.adler,Te.pending_buf,Te.pending-ue,ue)),Te.gzindex===Te.gzhead.extra.length&&(Te.gzindex=0,Te.status=73)}else Te.status=73;if(Te.status===73)if(Te.gzhead.name){ue=Te.pending;do{if(Te.pending===Te.pending_buf_size&&(Te.gzhead.hcrc&&Te.pending>ue&&($.adler=a($.adler,Te.pending_buf,Te.pending-ue,ue)),k($),ue=Te.pending,Te.pending===Te.pending_buf_size)){be=1;break}be=Te.gzindex<Te.gzhead.name.length?255&Te.gzhead.name.charCodeAt(Te.gzindex++):0,U(Te,be)}while(be!==0);Te.gzhead.hcrc&&Te.pending>ue&&($.adler=a($.adler,Te.pending_buf,Te.pending-ue,ue)),be===0&&(Te.gzindex=0,Te.status=91)}else Te.status=91;if(Te.status===91)if(Te.gzhead.comment){ue=Te.pending;do{if(Te.pending===Te.pending_buf_size&&(Te.gzhead.hcrc&&Te.pending>ue&&($.adler=a($.adler,Te.pending_buf,Te.pending-ue,ue)),k($),ue=Te.pending,Te.pending===Te.pending_buf_size)){be=1;break}be=Te.gzindex<Te.gzhead.comment.length?255&Te.gzhead.comment.charCodeAt(Te.gzindex++):0,U(Te,be)}while(be!==0);Te.gzhead.hcrc&&Te.pending>ue&&($.adler=a($.adler,Te.pending_buf,Te.pending-ue,ue)),be===0&&(Te.status=103)}else Te.status=103;if(Te.status===103&&(Te.gzhead.hcrc?(Te.pending+2>Te.pending_buf_size&&k($),Te.pending+2<=Te.pending_buf_size&&(U(Te,255&$.adler),U(Te,$.adler>>8&255),$.adler=0,Te.status=D)):Te.status=D),Te.pending!==0){if(k($),$.avail_out===0)return Te.last_flush=-1,u}else if($.avail_in===0&&W(fe)<=W(Oe)&&fe!==h)return V($,-5);if(Te.status===666&&$.avail_in!==0)return V($,-5);if($.avail_in!==0||Te.lookahead!==0||fe!==c&&Te.status!==666){var Z=Te.strategy===2?(function(ie,de){for(var me;;){if(ie.lookahead===0&&(Y(ie),ie.lookahead===0)){if(de===c)return w;break}if(ie.match_length=0,me=n._tr_tally(ie,0,ie.window[ie.strstart]),ie.lookahead--,ie.strstart++,me&&(N(ie,!1),ie.strm.avail_out===0))return w}return ie.insert=0,de===h?(N(ie,!0),ie.strm.avail_out===0?H:z):ie.last_lit&&(N(ie,!1),ie.strm.avail_out===0)?w:F})(Te,fe):Te.strategy===3?(function(ie,de){for(var me,Se,Re,Je,Ke=ie.window;;){if(ie.lookahead<=_){if(Y(ie),ie.lookahead<=_&&de===c)return w;if(ie.lookahead===0)break}if(ie.match_length=0,ie.lookahead>=O&&0<ie.strstart&&(Se=Ke[Re=ie.strstart-1])===Ke[++Re]&&Se===Ke[++Re]&&Se===Ke[++Re]){Je=ie.strstart+_;do;while(Se===Ke[++Re]&&Se===Ke[++Re]&&Se===Ke[++Re]&&Se===Ke[++Re]&&Se===Ke[++Re]&&Se===Ke[++Re]&&Se===Ke[++Re]&&Se===Ke[++Re]&&Re<Je);ie.match_length=_-(Je-Re),ie.match_length>ie.lookahead&&(ie.match_length=ie.lookahead)}if(ie.match_length>=O?(me=n._tr_tally(ie,1,ie.match_length-O),ie.lookahead-=ie.match_length,ie.strstart+=ie.match_length,ie.match_length=0):(me=n._tr_tally(ie,0,ie.window[ie.strstart]),ie.lookahead--,ie.strstart++),me&&(N(ie,!1),ie.strm.avail_out===0))return w}return ie.insert=0,de===h?(N(ie,!0),ie.strm.avail_out===0?H:z):ie.last_lit&&(N(ie,!1),ie.strm.avail_out===0)?w:F})(Te,fe):r[Te.level].func(Te,fe);if(Z!==H&&Z!==z||(Te.status=666),Z===w||Z===H)return $.avail_out===0&&(Te.last_flush=-1),u;if(Z===F&&(fe===1?n._tr_align(Te):fe!==5&&(n._tr_stored_block(Te,0,0,!1),fe===3&&(L(Te.head),Te.lookahead===0&&(Te.strstart=0,Te.block_start=0,Te.insert=0))),k($),$.avail_out===0))return Te.last_flush=-1,u}return fe!==h?u:Te.wrap<=0?1:(Te.wrap===2?(U(Te,255&$.adler),U(Te,$.adler>>8&255),U(Te,$.adler>>16&255),U(Te,$.adler>>24&255),U(Te,255&$.total_in),U(Te,$.total_in>>8&255),U(Te,$.total_in>>16&255),U(Te,$.total_in>>24&255)):(B(Te,$.adler>>>16),B(Te,65535&$.adler)),k($),0<Te.wrap&&(Te.wrap=-Te.wrap),Te.pending!==0?u:1)},e.deflateEnd=function($){var fe;return $&&$.state?(fe=$.state.status)!==v&&fe!==69&&fe!==73&&fe!==91&&fe!==103&&fe!==D&&fe!==666?V($,d):($.state=null,fe===D?V($,-3):u):d},e.deflateSetDictionary=function($,fe){var Oe,Te,ue,be,j,Z,ie,de,me=fe.length;if(!$||!$.state||(be=(Oe=$.state).wrap)===2||be===1&&Oe.status!==v||Oe.lookahead)return d;for(be===1&&($.adler=s($.adler,fe,me,0)),Oe.wrap=0,me>=Oe.w_size&&(be===0&&(L(Oe.head),Oe.strstart=0,Oe.block_start=0,Oe.insert=0),de=new i.Buf8(Oe.w_size),i.arraySet(de,fe,me-Oe.w_size,Oe.w_size,0),fe=de,me=Oe.w_size),j=$.avail_in,Z=$.next_in,ie=$.input,$.avail_in=me,$.next_in=0,$.input=fe,Y(Oe);Oe.lookahead>=O;){for(Te=Oe.strstart,ue=Oe.lookahead-(O-1);Oe.ins_h=(Oe.ins_h<<Oe.hash_shift^Oe.window[Te+O-1])&Oe.hash_mask,Oe.prev[Te&Oe.w_mask]=Oe.head[Oe.ins_h],Oe.head[Oe.ins_h]=Te,Te++,--ue;);Oe.strstart=Te,Oe.lookahead=O-1,Y(Oe)}return Oe.strstart+=Oe.lookahead,Oe.block_start=Oe.strstart,Oe.insert=Oe.lookahead,Oe.lookahead=0,Oe.match_length=Oe.prev_length=O-1,Oe.match_available=0,$.next_in=Z,$.input=ie,$.avail_in=j,Oe.wrap=be,u},e.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(o,t,e){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(o,t,e){"use strict";t.exports=function(r,i){var n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,x,v,D,w,F;n=r.state,s=r.next_in,w=r.input,a=s+(r.avail_in-5),l=r.next_out,F=r.output,c=l-(i-r.avail_out),h=l+(r.avail_out-257),u=n.dmax,d=n.wsize,p=n.whave,m=n.wnext,g=n.window,y=n.hold,b=n.bits,P=n.lencode,T=n.distcode,I=(1<<n.lenbits)-1,C=(1<<n.distbits)-1;e:do{b<15&&(y+=w[s++]<<b,b+=8,y+=w[s++]<<b,b+=8),E=P[y&I];t:for(;;){if(y>>>=O=E>>>24,b-=O,(O=E>>>16&255)===0)F[l++]=65535&E;else{if(!(16&O)){if((64&O)==0){E=P[(65535&E)+(y&(1<<O)-1)];continue t}if(32&O){n.mode=12;break e}r.msg="invalid literal/length code",n.mode=30;break e}_=65535&E,(O&=15)&&(b<O&&(y+=w[s++]<<b,b+=8),_+=y&(1<<O)-1,y>>>=O,b-=O),b<15&&(y+=w[s++]<<b,b+=8,y+=w[s++]<<b,b+=8),E=T[y&C];r:for(;;){if(y>>>=O=E>>>24,b-=O,!(16&(O=E>>>16&255))){if((64&O)==0){E=T[(65535&E)+(y&(1<<O)-1)];continue r}r.msg="invalid distance code",n.mode=30;break e}if(x=65535&E,b<(O&=15)&&(y+=w[s++]<<b,(b+=8)<O&&(y+=w[s++]<<b,b+=8)),u<(x+=y&(1<<O)-1)){r.msg="invalid distance too far back",n.mode=30;break e}if(y>>>=O,b-=O,(O=l-c)<x){if(p<(O=x-O)&&n.sane){r.msg="invalid distance too far back",n.mode=30;break e}if(D=g,(v=0)===m){if(v+=d-O,O<_){for(_-=O;F[l++]=g[v++],--O;);v=l-x,D=F}}else if(m<O){if(v+=d+m-O,(O-=m)<_){for(_-=O;F[l++]=g[v++],--O;);if(v=0,m<_){for(_-=O=m;F[l++]=g[v++],--O;);v=l-x,D=F}}}else if(v+=m-O,O<_){for(_-=O;F[l++]=g[v++],--O;);v=l-x,D=F}for(;2<_;)F[l++]=D[v++],F[l++]=D[v++],F[l++]=D[v++],_-=3;_&&(F[l++]=D[v++],1<_&&(F[l++]=D[v++]))}else{for(v=l-x;F[l++]=F[v++],F[l++]=F[v++],F[l++]=F[v++],2<(_-=3););_&&(F[l++]=F[v++],1<_&&(F[l++]=F[v++]))}break}}break}}while(s<a&&l<h);s-=_=b>>3,y&=(1<<(b-=_<<3))-1,r.next_in=s,r.next_out=l,r.avail_in=s<a?a-s+5:5-(s-a),r.avail_out=l<h?h-l+257:257-(l-h),n.hold=y,n.bits=b}},{}],49:[function(o,t,e){"use strict";var r=o("../utils/common"),i=o("./adler32"),n=o("./crc32"),s=o("./inffast"),a=o("./inftrees"),l=1,c=2,h=0,u=-2,d=1,p=852,m=592;function g(v){return(v>>>24&255)+(v>>>8&65280)+((65280&v)<<8)+((255&v)<<24)}function y(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function b(v){var D;return v&&v.state?(D=v.state,v.total_in=v.total_out=D.total=0,v.msg="",D.wrap&&(v.adler=1&D.wrap),D.mode=d,D.last=0,D.havedict=0,D.dmax=32768,D.head=null,D.hold=0,D.bits=0,D.lencode=D.lendyn=new r.Buf32(p),D.distcode=D.distdyn=new r.Buf32(m),D.sane=1,D.back=-1,h):u}function P(v){var D;return v&&v.state?((D=v.state).wsize=0,D.whave=0,D.wnext=0,b(v)):u}function T(v,D){var w,F;return v&&v.state?(F=v.state,D<0?(w=0,D=-D):(w=1+(D>>4),D<48&&(D&=15)),D&&(D<8||15<D)?u:(F.window!==null&&F.wbits!==D&&(F.window=null),F.wrap=w,F.wbits=D,P(v))):u}function I(v,D){var w,F;return v?(F=new y,(v.state=F).window=null,(w=T(v,D))!==h&&(v.state=null),w):u}var C,E,O=!0;function _(v){if(O){var D;for(C=new r.Buf32(512),E=new r.Buf32(32),D=0;D<144;)v.lens[D++]=8;for(;D<256;)v.lens[D++]=9;for(;D<280;)v.lens[D++]=7;for(;D<288;)v.lens[D++]=8;for(a(l,v.lens,0,288,C,0,v.work,{bits:9}),D=0;D<32;)v.lens[D++]=5;a(c,v.lens,0,32,E,0,v.work,{bits:5}),O=!1}v.lencode=C,v.lenbits=9,v.distcode=E,v.distbits=5}function x(v,D,w,F){var H,z=v.state;return z.window===null&&(z.wsize=1<<z.wbits,z.wnext=0,z.whave=0,z.window=new r.Buf8(z.wsize)),F>=z.wsize?(r.arraySet(z.window,D,w-z.wsize,z.wsize,0),z.wnext=0,z.whave=z.wsize):(F<(H=z.wsize-z.wnext)&&(H=F),r.arraySet(z.window,D,w-F,H,z.wnext),(F-=H)?(r.arraySet(z.window,D,w-F,F,0),z.wnext=F,z.whave=z.wsize):(z.wnext+=H,z.wnext===z.wsize&&(z.wnext=0),z.whave<z.wsize&&(z.whave+=H))),0}e.inflateReset=P,e.inflateReset2=T,e.inflateResetKeep=b,e.inflateInit=function(v){return I(v,15)},e.inflateInit2=I,e.inflate=function(v,D){var w,F,H,z,V,W,L,k,N,U,B,G,Y,X,K,J,se,ce,te,oe,$,fe,Oe,Te,ue=0,be=new r.Buf8(4),j=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!v||!v.state||!v.output||!v.input&&v.avail_in!==0)return u;(w=v.state).mode===12&&(w.mode=13),V=v.next_out,H=v.output,L=v.avail_out,z=v.next_in,F=v.input,W=v.avail_in,k=w.hold,N=w.bits,U=W,B=L,fe=h;e:for(;;)switch(w.mode){case d:if(w.wrap===0){w.mode=13;break}for(;N<16;){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}if(2&w.wrap&&k===35615){be[w.check=0]=255&k,be[1]=k>>>8&255,w.check=n(w.check,be,2,0),N=k=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&k)<<8)+(k>>8))%31){v.msg="incorrect header check",w.mode=30;break}if((15&k)!=8){v.msg="unknown compression method",w.mode=30;break}if(N-=4,$=8+(15&(k>>>=4)),w.wbits===0)w.wbits=$;else if($>w.wbits){v.msg="invalid window size",w.mode=30;break}w.dmax=1<<$,v.adler=w.check=1,w.mode=512&k?10:12,N=k=0;break;case 2:for(;N<16;){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}if(w.flags=k,(255&w.flags)!=8){v.msg="unknown compression method",w.mode=30;break}if(57344&w.flags){v.msg="unknown header flags set",w.mode=30;break}w.head&&(w.head.text=k>>8&1),512&w.flags&&(be[0]=255&k,be[1]=k>>>8&255,w.check=n(w.check,be,2,0)),N=k=0,w.mode=3;case 3:for(;N<32;){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}w.head&&(w.head.time=k),512&w.flags&&(be[0]=255&k,be[1]=k>>>8&255,be[2]=k>>>16&255,be[3]=k>>>24&255,w.check=n(w.check,be,4,0)),N=k=0,w.mode=4;case 4:for(;N<16;){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}w.head&&(w.head.xflags=255&k,w.head.os=k>>8),512&w.flags&&(be[0]=255&k,be[1]=k>>>8&255,w.check=n(w.check,be,2,0)),N=k=0,w.mode=5;case 5:if(1024&w.flags){for(;N<16;){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}w.length=k,w.head&&(w.head.extra_len=k),512&w.flags&&(be[0]=255&k,be[1]=k>>>8&255,w.check=n(w.check,be,2,0)),N=k=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&(W<(G=w.length)&&(G=W),G&&(w.head&&($=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),r.arraySet(w.head.extra,F,z,G,$)),512&w.flags&&(w.check=n(w.check,F,G,z)),W-=G,z+=G,w.length-=G),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(W===0)break e;for(G=0;$=F[z+G++],w.head&&$&&w.length<65536&&(w.head.name+=String.fromCharCode($)),$&&G<W;);if(512&w.flags&&(w.check=n(w.check,F,G,z)),W-=G,z+=G,$)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if(W===0)break e;for(G=0;$=F[z+G++],w.head&&$&&w.length<65536&&(w.head.comment+=String.fromCharCode($)),$&&G<W;);if(512&w.flags&&(w.check=n(w.check,F,G,z)),W-=G,z+=G,$)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;N<16;){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}if(k!==(65535&w.check)){v.msg="header crc mismatch",w.mode=30;break}N=k=0}w.head&&(w.head.hcrc=w.flags>>9&1,w.head.done=!0),v.adler=w.check=0,w.mode=12;break;case 10:for(;N<32;){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}v.adler=w.check=g(k),N=k=0,w.mode=11;case 11:if(w.havedict===0)return v.next_out=V,v.avail_out=L,v.next_in=z,v.avail_in=W,w.hold=k,w.bits=N,2;v.adler=w.check=1,w.mode=12;case 12:if(D===5||D===6)break e;case 13:if(w.last){k>>>=7&N,N-=7&N,w.mode=27;break}for(;N<3;){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}switch(w.last=1&k,N-=1,3&(k>>>=1)){case 0:w.mode=14;break;case 1:if(_(w),w.mode=20,D!==6)break;k>>>=2,N-=2;break e;case 2:w.mode=17;break;case 3:v.msg="invalid block type",w.mode=30}k>>>=2,N-=2;break;case 14:for(k>>>=7&N,N-=7&N;N<32;){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}if((65535&k)!=(k>>>16^65535)){v.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&k,N=k=0,w.mode=15,D===6)break e;case 15:w.mode=16;case 16:if(G=w.length){if(W<G&&(G=W),L<G&&(G=L),G===0)break e;r.arraySet(H,F,z,G,V),W-=G,z+=G,L-=G,V+=G,w.length-=G;break}w.mode=12;break;case 17:for(;N<14;){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}if(w.nlen=257+(31&k),k>>>=5,N-=5,w.ndist=1+(31&k),k>>>=5,N-=5,w.ncode=4+(15&k),k>>>=4,N-=4,286<w.nlen||30<w.ndist){v.msg="too many length or distance symbols",w.mode=30;break}w.have=0,w.mode=18;case 18:for(;w.have<w.ncode;){for(;N<3;){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}w.lens[j[w.have++]]=7&k,k>>>=3,N-=3}for(;w.have<19;)w.lens[j[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,Oe={bits:w.lenbits},fe=a(0,w.lens,0,19,w.lencode,0,w.work,Oe),w.lenbits=Oe.bits,fe){v.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have<w.nlen+w.ndist;){for(;J=(ue=w.lencode[k&(1<<w.lenbits)-1])>>>16&255,se=65535&ue,!((K=ue>>>24)<=N);){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}if(se<16)k>>>=K,N-=K,w.lens[w.have++]=se;else{if(se===16){for(Te=K+2;N<Te;){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}if(k>>>=K,N-=K,w.have===0){v.msg="invalid bit length repeat",w.mode=30;break}$=w.lens[w.have-1],G=3+(3&k),k>>>=2,N-=2}else if(se===17){for(Te=K+3;N<Te;){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}N-=K,$=0,G=3+(7&(k>>>=K)),k>>>=3,N-=3}else{for(Te=K+7;N<Te;){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}N-=K,$=0,G=11+(127&(k>>>=K)),k>>>=7,N-=7}if(w.have+G>w.nlen+w.ndist){v.msg="invalid bit length repeat",w.mode=30;break}for(;G--;)w.lens[w.have++]=$}}if(w.mode===30)break;if(w.lens[256]===0){v.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,Oe={bits:w.lenbits},fe=a(l,w.lens,0,w.nlen,w.lencode,0,w.work,Oe),w.lenbits=Oe.bits,fe){v.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,Oe={bits:w.distbits},fe=a(c,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,Oe),w.distbits=Oe.bits,fe){v.msg="invalid distances set",w.mode=30;break}if(w.mode=20,D===6)break e;case 20:w.mode=21;case 21:if(6<=W&&258<=L){v.next_out=V,v.avail_out=L,v.next_in=z,v.avail_in=W,w.hold=k,w.bits=N,s(v,B),V=v.next_out,H=v.output,L=v.avail_out,z=v.next_in,F=v.input,W=v.avail_in,k=w.hold,N=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;J=(ue=w.lencode[k&(1<<w.lenbits)-1])>>>16&255,se=65535&ue,!((K=ue>>>24)<=N);){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}if(J&&(240&J)==0){for(ce=K,te=J,oe=se;J=(ue=w.lencode[oe+((k&(1<<ce+te)-1)>>ce)])>>>16&255,se=65535&ue,!(ce+(K=ue>>>24)<=N);){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}k>>>=ce,N-=ce,w.back+=ce}if(k>>>=K,N-=K,w.back+=K,w.length=se,J===0){w.mode=26;break}if(32&J){w.back=-1,w.mode=12;break}if(64&J){v.msg="invalid literal/length code",w.mode=30;break}w.extra=15&J,w.mode=22;case 22:if(w.extra){for(Te=w.extra;N<Te;){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}w.length+=k&(1<<w.extra)-1,k>>>=w.extra,N-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;J=(ue=w.distcode[k&(1<<w.distbits)-1])>>>16&255,se=65535&ue,!((K=ue>>>24)<=N);){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}if((240&J)==0){for(ce=K,te=J,oe=se;J=(ue=w.distcode[oe+((k&(1<<ce+te)-1)>>ce)])>>>16&255,se=65535&ue,!(ce+(K=ue>>>24)<=N);){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}k>>>=ce,N-=ce,w.back+=ce}if(k>>>=K,N-=K,w.back+=K,64&J){v.msg="invalid distance code",w.mode=30;break}w.offset=se,w.extra=15&J,w.mode=24;case 24:if(w.extra){for(Te=w.extra;N<Te;){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}w.offset+=k&(1<<w.extra)-1,k>>>=w.extra,N-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){v.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(L===0)break e;if(G=B-L,w.offset>G){if((G=w.offset-G)>w.whave&&w.sane){v.msg="invalid distance too far back",w.mode=30;break}Y=G>w.wnext?(G-=w.wnext,w.wsize-G):w.wnext-G,G>w.length&&(G=w.length),X=w.window}else X=H,Y=V-w.offset,G=w.length;for(L<G&&(G=L),L-=G,w.length-=G;H[V++]=X[Y++],--G;);w.length===0&&(w.mode=21);break;case 26:if(L===0)break e;H[V++]=w.length,L--,w.mode=21;break;case 27:if(w.wrap){for(;N<32;){if(W===0)break e;W--,k|=F[z++]<<N,N+=8}if(B-=L,v.total_out+=B,w.total+=B,B&&(v.adler=w.check=w.flags?n(w.check,H,B,V-B):i(w.check,H,B,V-B)),B=L,(w.flags?k:g(k))!==w.check){v.msg="incorrect data check",w.mode=30;break}N=k=0}w.mode=28;case 28:if(w.wrap&&w.flags){for(;N<32;){if(W===0)break e;W--,k+=F[z++]<<N,N+=8}if(k!==(4294967295&w.total)){v.msg="incorrect length check",w.mode=30;break}N=k=0}w.mode=29;case 29:fe=1;break e;case 30:fe=-3;break e;case 31:return-4;case 32:default:return u}return v.next_out=V,v.avail_out=L,v.next_in=z,v.avail_in=W,w.hold=k,w.bits=N,(w.wsize||B!==v.avail_out&&w.mode<30&&(w.mode<27||D!==4))&&x(v,v.output,v.next_out,B-v.avail_out)?(w.mode=31,-4):(U-=v.avail_in,B-=v.avail_out,v.total_in+=U,v.total_out+=B,w.total+=B,w.wrap&&B&&(v.adler=w.check=w.flags?n(w.check,H,B,v.next_out-B):i(w.check,H,B,v.next_out-B)),v.data_type=w.bits+(w.last?64:0)+(w.mode===12?128:0)+(w.mode===20||w.mode===15?256:0),(U==0&&B===0||D===4)&&fe===h&&(fe=-5),fe)},e.inflateEnd=function(v){if(!v||!v.state)return u;var D=v.state;return D.window&&(D.window=null),v.state=null,h},e.inflateGetHeader=function(v,D){var w;return v&&v.state?(2&(w=v.state).wrap)==0?u:((w.head=D).done=!1,h):u},e.inflateSetDictionary=function(v,D){var w,F=D.length;return v&&v.state?(w=v.state).wrap!==0&&w.mode!==11?u:w.mode===11&&i(1,D,F,0)!==w.check?-3:x(v,D,F,F)?(w.mode=31,-4):(w.havedict=1,h):u},e.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(o,t,e){"use strict";var r=o("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],n=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],s=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(l,c,h,u,d,p,m,g){var y,b,P,T,I,C,E,O,_,x=g.bits,v=0,D=0,w=0,F=0,H=0,z=0,V=0,W=0,L=0,k=0,N=null,U=0,B=new r.Buf16(16),G=new r.Buf16(16),Y=null,X=0;for(v=0;v<=15;v++)B[v]=0;for(D=0;D<u;D++)B[c[h+D]]++;for(H=x,F=15;1<=F&&B[F]===0;F--);if(F<H&&(H=F),F===0)return d[p++]=20971520,d[p++]=20971520,g.bits=1,0;for(w=1;w<F&&B[w]===0;w++);for(H<w&&(H=w),v=W=1;v<=15;v++)if(W<<=1,(W-=B[v])<0)return-1;if(0<W&&(l===0||F!==1))return-1;for(G[1]=0,v=1;v<15;v++)G[v+1]=G[v]+B[v];for(D=0;D<u;D++)c[h+D]!==0&&(m[G[c[h+D]]++]=D);if(C=l===0?(N=Y=m,19):l===1?(N=i,U-=257,Y=n,X-=257,256):(N=s,Y=a,-1),v=w,I=p,V=D=k=0,P=-1,T=(L=1<<(z=H))-1,l===1&&852<L||l===2&&592<L)return 1;for(;;){for(E=v-V,_=m[D]<C?(O=0,m[D]):m[D]>C?(O=Y[X+m[D]],N[U+m[D]]):(O=96,0),y=1<<v-V,w=b=1<<z;d[I+(k>>V)+(b-=y)]=E<<24|O<<16|_|0,b!==0;);for(y=1<<v-1;k&y;)y>>=1;if(y!==0?(k&=y-1,k+=y):k=0,D++,--B[v]==0){if(v===F)break;v=c[h+m[D]]}if(H<v&&(k&T)!==P){for(V===0&&(V=H),I+=w,W=1<<(z=v-V);z+V<F&&!((W-=B[z+V])<=0);)z++,W<<=1;if(L+=1<<z,l===1&&852<L||l===2&&592<L)return 1;d[P=k&T]=H<<24|z<<16|I-p|0}}return k!==0&&(d[I+k]=v-V<<24|64<<16|0),g.bits=H,0}},{"../utils/common":41}],51:[function(o,t,e){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(o,t,e){"use strict";var r=o("../utils/common"),i=0,n=1;function s(ue){for(var be=ue.length;0<=--be;)ue[be]=0}var a=0,l=29,c=256,h=c+1+l,u=30,d=19,p=2*h+1,m=15,g=16,y=7,b=256,P=16,T=17,I=18,C=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],E=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],_=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],x=new Array(2*(h+2));s(x);var v=new Array(2*u);s(v);var D=new Array(512);s(D);var w=new Array(256);s(w);var F=new Array(l);s(F);var H,z,V,W=new Array(u);function L(ue,be,j,Z,ie){this.static_tree=ue,this.extra_bits=be,this.extra_base=j,this.elems=Z,this.max_length=ie,this.has_stree=ue&&ue.length}function k(ue,be){this.dyn_tree=ue,this.max_code=0,this.stat_desc=be}function N(ue){return ue<256?D[ue]:D[256+(ue>>>7)]}function U(ue,be){ue.pending_buf[ue.pending++]=255&be,ue.pending_buf[ue.pending++]=be>>>8&255}function B(ue,be,j){ue.bi_valid>g-j?(ue.bi_buf|=be<<ue.bi_valid&65535,U(ue,ue.bi_buf),ue.bi_buf=be>>g-ue.bi_valid,ue.bi_valid+=j-g):(ue.bi_buf|=be<<ue.bi_valid&65535,ue.bi_valid+=j)}function G(ue,be,j){B(ue,j[2*be],j[2*be+1])}function Y(ue,be){for(var j=0;j|=1&ue,ue>>>=1,j<<=1,0<--be;);return j>>>1}function X(ue,be,j){var Z,ie,de=new Array(m+1),me=0;for(Z=1;Z<=m;Z++)de[Z]=me=me+j[Z-1]<<1;for(ie=0;ie<=be;ie++){var Se=ue[2*ie+1];Se!==0&&(ue[2*ie]=Y(de[Se]++,Se))}}function K(ue){var be;for(be=0;be<h;be++)ue.dyn_ltree[2*be]=0;for(be=0;be<u;be++)ue.dyn_dtree[2*be]=0;for(be=0;be<d;be++)ue.bl_tree[2*be]=0;ue.dyn_ltree[2*b]=1,ue.opt_len=ue.static_len=0,ue.last_lit=ue.matches=0}function J(ue){8<ue.bi_valid?U(ue,ue.bi_buf):0<ue.bi_valid&&(ue.pending_buf[ue.pending++]=ue.bi_buf),ue.bi_buf=0,ue.bi_valid=0}function se(ue,be,j,Z){var ie=2*be,de=2*j;return ue[ie]<ue[de]||ue[ie]===ue[de]&&Z[be]<=Z[j]}function ce(ue,be,j){for(var Z=ue.heap[j],ie=j<<1;ie<=ue.heap_len&&(ie<ue.heap_len&&se(be,ue.heap[ie+1],ue.heap[ie],ue.depth)&&ie++,!se(be,Z,ue.heap[ie],ue.depth));)ue.heap[j]=ue.heap[ie],j=ie,ie<<=1;ue.heap[j]=Z}function te(ue,be,j){var Z,ie,de,me,Se=0;if(ue.last_lit!==0)for(;Z=ue.pending_buf[ue.d_buf+2*Se]<<8|ue.pending_buf[ue.d_buf+2*Se+1],ie=ue.pending_buf[ue.l_buf+Se],Se++,Z===0?G(ue,ie,be):(G(ue,(de=w[ie])+c+1,be),(me=C[de])!==0&&B(ue,ie-=F[de],me),G(ue,de=N(--Z),j),(me=E[de])!==0&&B(ue,Z-=W[de],me)),Se<ue.last_lit;);G(ue,b,be)}function oe(ue,be){var j,Z,ie,de=be.dyn_tree,me=be.stat_desc.static_tree,Se=be.stat_desc.has_stree,Re=be.stat_desc.elems,Je=-1;for(ue.heap_len=0,ue.heap_max=p,j=0;j<Re;j++)de[2*j]!==0?(ue.heap[++ue.heap_len]=Je=j,ue.depth[j]=0):de[2*j+1]=0;for(;ue.heap_len<2;)de[2*(ie=ue.heap[++ue.heap_len]=Je<2?++Je:0)]=1,ue.depth[ie]=0,ue.opt_len--,Se&&(ue.static_len-=me[2*ie+1]);for(be.max_code=Je,j=ue.heap_len>>1;1<=j;j--)ce(ue,de,j);for(ie=Re;j=ue.heap[1],ue.heap[1]=ue.heap[ue.heap_len--],ce(ue,de,1),Z=ue.heap[1],ue.heap[--ue.heap_max]=j,ue.heap[--ue.heap_max]=Z,de[2*ie]=de[2*j]+de[2*Z],ue.depth[ie]=(ue.depth[j]>=ue.depth[Z]?ue.depth[j]:ue.depth[Z])+1,de[2*j+1]=de[2*Z+1]=ie,ue.heap[1]=ie++,ce(ue,de,1),2<=ue.heap_len;);ue.heap[--ue.heap_max]=ue.heap[1],(function(Ke,Gt){var Nr,xr,vr,_r,Ne,Vt,Ft=Gt.dyn_tree,ir=Gt.max_code,Fe=Gt.stat_desc.static_tree,tt=Gt.stat_desc.has_stree,ye=Gt.stat_desc.extra_bits,yt=Gt.stat_desc.extra_base,Wt=Gt.stat_desc.max_length,pe=0;for(_r=0;_r<=m;_r++)Ke.bl_count[_r]=0;for(Ft[2*Ke.heap[Ke.heap_max]+1]=0,Nr=Ke.heap_max+1;Nr<p;Nr++)Wt<(_r=Ft[2*Ft[2*(xr=Ke.heap[Nr])+1]+1]+1)&&(_r=Wt,pe++),Ft[2*xr+1]=_r,ir<xr||(Ke.bl_count[_r]++,Ne=0,yt<=xr&&(Ne=ye[xr-yt]),Vt=Ft[2*xr],Ke.opt_len+=Vt*(_r+Ne),tt&&(Ke.static_len+=Vt*(Fe[2*xr+1]+Ne)));if(pe!==0){do{for(_r=Wt-1;Ke.bl_count[_r]===0;)_r--;Ke.bl_count[_r]--,Ke.bl_count[_r+1]+=2,Ke.bl_count[Wt]--,pe-=2}while(0<pe);for(_r=Wt;_r!==0;_r--)for(xr=Ke.bl_count[_r];xr!==0;)ir<(vr=Ke.heap[--Nr])||(Ft[2*vr+1]!==_r&&(Ke.opt_len+=(_r-Ft[2*vr+1])*Ft[2*vr],Ft[2*vr+1]=_r),xr--)}})(ue,be),X(de,Je,ue.bl_count)}function $(ue,be,j){var Z,ie,de=-1,me=be[1],Se=0,Re=7,Je=4;for(me===0&&(Re=138,Je=3),be[2*(j+1)+1]=65535,Z=0;Z<=j;Z++)ie=me,me=be[2*(Z+1)+1],++Se<Re&&ie===me||(Se<Je?ue.bl_tree[2*ie]+=Se:ie!==0?(ie!==de&&ue.bl_tree[2*ie]++,ue.bl_tree[2*P]++):Se<=10?ue.bl_tree[2*T]++:ue.bl_tree[2*I]++,de=ie,Je=(Se=0)===me?(Re=138,3):ie===me?(Re=6,3):(Re=7,4))}function fe(ue,be,j){var Z,ie,de=-1,me=be[1],Se=0,Re=7,Je=4;for(me===0&&(Re=138,Je=3),Z=0;Z<=j;Z++)if(ie=me,me=be[2*(Z+1)+1],!(++Se<Re&&ie===me)){if(Se<Je)for(;G(ue,ie,ue.bl_tree),--Se!=0;);else ie!==0?(ie!==de&&(G(ue,ie,ue.bl_tree),Se--),G(ue,P,ue.bl_tree),B(ue,Se-3,2)):Se<=10?(G(ue,T,ue.bl_tree),B(ue,Se-3,3)):(G(ue,I,ue.bl_tree),B(ue,Se-11,7));de=ie,Je=(Se=0)===me?(Re=138,3):ie===me?(Re=6,3):(Re=7,4)}}s(W);var Oe=!1;function Te(ue,be,j,Z){B(ue,(a<<1)+(Z?1:0),3),(function(ie,de,me,Se){J(ie),Se&&(U(ie,me),U(ie,~me)),r.arraySet(ie.pending_buf,ie.window,de,me,ie.pending),ie.pending+=me})(ue,be,j,!0)}e._tr_init=function(ue){Oe||((function(){var be,j,Z,ie,de,me=new Array(m+1);for(ie=Z=0;ie<l-1;ie++)for(F[ie]=Z,be=0;be<1<<C[ie];be++)w[Z++]=ie;for(w[Z-1]=ie,ie=de=0;ie<16;ie++)for(W[ie]=de,be=0;be<1<<E[ie];be++)D[de++]=ie;for(de>>=7;ie<u;ie++)for(W[ie]=de<<7,be=0;be<1<<E[ie]-7;be++)D[256+de++]=ie;for(j=0;j<=m;j++)me[j]=0;for(be=0;be<=143;)x[2*be+1]=8,be++,me[8]++;for(;be<=255;)x[2*be+1]=9,be++,me[9]++;for(;be<=279;)x[2*be+1]=7,be++,me[7]++;for(;be<=287;)x[2*be+1]=8,be++,me[8]++;for(X(x,h+1,me),be=0;be<u;be++)v[2*be+1]=5,v[2*be]=Y(be,5);H=new L(x,C,c+1,h,m),z=new L(v,E,0,u,m),V=new L(new Array(0),O,0,d,y)})(),Oe=!0),ue.l_desc=new k(ue.dyn_ltree,H),ue.d_desc=new k(ue.dyn_dtree,z),ue.bl_desc=new k(ue.bl_tree,V),ue.bi_buf=0,ue.bi_valid=0,K(ue)},e._tr_stored_block=Te,e._tr_flush_block=function(ue,be,j,Z){var ie,de,me=0;0<ue.level?(ue.strm.data_type===2&&(ue.strm.data_type=(function(Se){var Re,Je=4093624447;for(Re=0;Re<=31;Re++,Je>>>=1)if(1&Je&&Se.dyn_ltree[2*Re]!==0)return i;if(Se.dyn_ltree[18]!==0||Se.dyn_ltree[20]!==0||Se.dyn_ltree[26]!==0)return n;for(Re=32;Re<c;Re++)if(Se.dyn_ltree[2*Re]!==0)return n;return i})(ue)),oe(ue,ue.l_desc),oe(ue,ue.d_desc),me=(function(Se){var Re;for($(Se,Se.dyn_ltree,Se.l_desc.max_code),$(Se,Se.dyn_dtree,Se.d_desc.max_code),oe(Se,Se.bl_desc),Re=d-1;3<=Re&&Se.bl_tree[2*_[Re]+1]===0;Re--);return Se.opt_len+=3*(Re+1)+5+5+4,Re})(ue),ie=ue.opt_len+3+7>>>3,(de=ue.static_len+3+7>>>3)<=ie&&(ie=de)):ie=de=j+5,j+4<=ie&&be!==-1?Te(ue,be,j,Z):ue.strategy===4||de===ie?(B(ue,2+(Z?1:0),3),te(ue,x,v)):(B(ue,4+(Z?1:0),3),(function(Se,Re,Je,Ke){var Gt;for(B(Se,Re-257,5),B(Se,Je-1,5),B(Se,Ke-4,4),Gt=0;Gt<Ke;Gt++)B(Se,Se.bl_tree[2*_[Gt]+1],3);fe(Se,Se.dyn_ltree,Re-1),fe(Se,Se.dyn_dtree,Je-1)})(ue,ue.l_desc.max_code+1,ue.d_desc.max_code+1,me+1),te(ue,ue.dyn_ltree,ue.dyn_dtree)),K(ue),Z&&J(ue)},e._tr_tally=function(ue,be,j){return ue.pending_buf[ue.d_buf+2*ue.last_lit]=be>>>8&255,ue.pending_buf[ue.d_buf+2*ue.last_lit+1]=255&be,ue.pending_buf[ue.l_buf+ue.last_lit]=255&j,ue.last_lit++,be===0?ue.dyn_ltree[2*j]++:(ue.matches++,be--,ue.dyn_ltree[2*(w[j]+c+1)]++,ue.dyn_dtree[2*N(be)]++),ue.last_lit===ue.lit_bufsize-1},e._tr_align=function(ue){B(ue,2,3),G(ue,b,x),(function(be){be.bi_valid===16?(U(be,be.bi_buf),be.bi_buf=0,be.bi_valid=0):8<=be.bi_valid&&(be.pending_buf[be.pending++]=255&be.bi_buf,be.bi_buf>>=8,be.bi_valid-=8)})(ue)}},{"../utils/common":41}],53:[function(o,t,e){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(o,t,e){(function(r){(function(i,n){"use strict";if(!i.setImmediate){var s,a,l,c,h=1,u={},d=!1,p=i.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(i);m=m&&m.setTimeout?m:i,s={}.toString.call(i.process)==="[object process]"?function(P){process.nextTick(function(){y(P)})}:(function(){if(i.postMessage&&!i.importScripts){var P=!0,T=i.onmessage;return i.onmessage=function(){P=!1},i.postMessage("","*"),i.onmessage=T,P}})()?(c="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",b,!1):i.attachEvent("onmessage",b),function(P){i.postMessage(c+P,"*")}):i.MessageChannel?((l=new MessageChannel).port1.onmessage=function(P){y(P.data)},function(P){l.port2.postMessage(P)}):p&&"onreadystatechange"in p.createElement("script")?(a=p.documentElement,function(P){var T=p.createElement("script");T.onreadystatechange=function(){y(P),T.onreadystatechange=null,a.removeChild(T),T=null},a.appendChild(T)}):function(P){setTimeout(y,0,P)},m.setImmediate=function(P){typeof P!="function"&&(P=new Function(""+P));for(var T=new Array(arguments.length-1),I=0;I<T.length;I++)T[I]=arguments[I+1];var C={callback:P,args:T};return u[h]=C,s(h),h++},m.clearImmediate=g}function g(P){delete u[P]}function y(P){if(d)setTimeout(y,0,P);else{var T=u[P];if(T){d=!0;try{(function(I){var C=I.callback,E=I.args;switch(E.length){case 0:C();break;case 1:C(E[0]);break;case 2:C(E[0],E[1]);break;case 3:C(E[0],E[1],E[2]);break;default:C.apply(n,E)}})(T)}finally{g(P),d=!1}}}}function b(P){P.source===i&&typeof P.data=="string"&&P.data.indexOf(c)===0&&y(+P.data.slice(c.length))}})(typeof self>"u"?r===void 0?this:r:self)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})});var HAe=Ru(FAe()),WAe=Ru(UAe());if(window.frameElement&&!window["USE-IFRAME-FOR-MAIN"]){let o=document.createElement("style");o.innerHTML=WAe.default,document.head.appendChild(o),document.write(HAe.default)}var iw=Ru(r2());var $$=class{constructor(){this.workerBus=null;this.messageBus2=new iw.MessageBus2(!0);let t=xT(),e=!!t.frameElement&&!t["USE-IFRAME-FOR-MAIN"]&&!t["META-PANELIZE-ENV"];t["META-PANELIZE-ENV"]&&t._MSG_BUS_&&(t._MSG_BUS_.unsafe=!0),this.globalMessageBus=t._MSG_BUS_=t._MSG_BUS_||new iw.MessageBus(!e),this.messageBus=e?new iw.MessageBus(!0):this.globalMessageBus,this.windowBridge=e?new iw.WindowMessageBridge(this.messageBus):this.messageBus,this.workerBus=null,this.extensionApiMessageBus2=()=>t.top._MSG_BUS2_EXTAPI_}publish(t,e,r){r!=null&&r!=null?this.windowBridge.publish(t,e,r):this.messageBus.publish(t,e)}subscribe(t,e,r){let i=xT();r!=null&&r!=null&&r!==i&&this.windowBridge.subscribe(t,r),this.messageBus.subscribe(t,e)}push(t,e,r){r!=null&&r!=null?this.windowBridge.push(t,e,r):this.messageBus.push(t,e)}pull(t,e,r){r!=null&&r!=null&&this.windowBridge.pull(t,r),this.messageBus.pull(t,e)}};function xT(){if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof globalThis<"u")return globalThis;if(typeof K$<"u")return K$}var K$=xT(),he=K$.MSG_BUS_PCB=K$.MSG_BUS_PCB||new $$;var eZe=Object.create,N_e=Object.defineProperty,tZe=Object.getOwnPropertyDescriptor,rZe=Object.getOwnPropertyNames,iZe=Object.getPrototypeOf,nZe=Object.prototype.hasOwnProperty,oZe=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),sZe=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rZe(t))!nZe.call(o,i)&&i!==e&&N_e(o,i,{get:()=>t[i],enumerable:!(r=tZe(t,i))||r.enumerable});return o},aZe=(o,t,e)=>(e=o!=null?eZe(iZe(o)):{},sZe(t||!o||!o.__esModule?N_e(e,"default",{value:o,enumerable:!0}):e,o)),lZe=oZe((o,t)=>{"use strict";t.exports=e,t.exports.default=e;function e(L,k,N){N=N||2;var U=k&&k.length,B=U?k[0]*N:L.length,G=r(L,0,B,N,!0),Y=[];if(!G||G.next===G.prev)return Y;var X,K,J,se,ce,te,oe;if(U&&(G=h(L,k,G,N)),L.length>80*N){X=J=L[0],K=se=L[1];for(var $=N;$<B;$+=N)ce=L[$],te=L[$+1],ce<X&&(X=ce),te<K&&(K=te),ce>J&&(J=ce),te>se&&(se=te);oe=Math.max(J-X,se-K),oe=oe!==0?32767/oe:0}return n(G,Y,N,X,K,oe,0),Y}function r(L,k,N,U,B){var G,Y;if(B===W(L,k,N,U)>0)for(G=k;G<N;G+=U)Y=H(G,L[G],L[G+1],Y);else for(G=N-U;G>=k;G-=U)Y=H(G,L[G],L[G+1],Y);return Y&&E(Y,Y.next)&&(z(Y),Y=Y.next),Y}function i(L,k){if(!L)return L;k||(k=L);var N=L,U;do if(U=!1,!N.steiner&&(E(N,N.next)||C(N.prev,N,N.next)===0)){if(z(N),N=k=N.prev,N===N.next)break;U=!0}else N=N.next;while(U||N!==k);return k}function n(L,k,N,U,B,G,Y){if(L){!Y&&G&&g(L,U,B,G);for(var X=L,K,J;L.prev!==L.next;){if(K=L.prev,J=L.next,G?a(L,U,B,G):s(L)){k.push(K.i/N|0),k.push(L.i/N|0),k.push(J.i/N|0),z(L),L=J.next,X=J.next;continue}if(L=J,L===X){Y?Y===1?(L=l(i(L),k,N),n(L,k,N,U,B,G,2)):Y===2&&c(L,k,N,U,B,G):n(i(L),k,N,U,B,G,1);break}}}}function s(L){var k=L.prev,N=L,U=L.next;if(C(k,N,U)>=0)return!1;for(var B=k.x,G=N.x,Y=U.x,X=k.y,K=N.y,J=U.y,se=B<G?B<Y?B:Y:G<Y?G:Y,ce=X<K?X<J?X:J:K<J?K:J,te=B>G?B>Y?B:Y:G>Y?G:Y,oe=X>K?X>J?X:J:K>J?K:J,$=U.next;$!==k;){if($.x>=se&&$.x<=te&&$.y>=ce&&$.y<=oe&&T(B,X,G,K,Y,J,$.x,$.y)&&C($.prev,$,$.next)>=0)return!1;$=$.next}return!0}function a(L,k,N,U){var B=L.prev,G=L,Y=L.next;if(C(B,G,Y)>=0)return!1;for(var X=B.x,K=G.x,J=Y.x,se=B.y,ce=G.y,te=Y.y,oe=X<K?X<J?X:J:K<J?K:J,$=se<ce?se<te?se:te:ce<te?ce:te,fe=X>K?X>J?X:J:K>J?K:J,Oe=se>ce?se>te?se:te:ce>te?ce:te,Te=b(oe,$,k,N,U),ue=b(fe,Oe,k,N,U),be=L.prevZ,j=L.nextZ;be&&be.z>=Te&&j&&j.z<=ue;){if(be.x>=oe&&be.x<=fe&&be.y>=$&&be.y<=Oe&&be!==B&&be!==Y&&T(X,se,K,ce,J,te,be.x,be.y)&&C(be.prev,be,be.next)>=0||(be=be.prevZ,j.x>=oe&&j.x<=fe&&j.y>=$&&j.y<=Oe&&j!==B&&j!==Y&&T(X,se,K,ce,J,te,j.x,j.y)&&C(j.prev,j,j.next)>=0))return!1;j=j.nextZ}for(;be&&be.z>=Te;){if(be.x>=oe&&be.x<=fe&&be.y>=$&&be.y<=Oe&&be!==B&&be!==Y&&T(X,se,K,ce,J,te,be.x,be.y)&&C(be.prev,be,be.next)>=0)return!1;be=be.prevZ}for(;j&&j.z<=ue;){if(j.x>=oe&&j.x<=fe&&j.y>=$&&j.y<=Oe&&j!==B&&j!==Y&&T(X,se,K,ce,J,te,j.x,j.y)&&C(j.prev,j,j.next)>=0)return!1;j=j.nextZ}return!0}function l(L,k,N){var U=L;do{var B=U.prev,G=U.next.next;!E(B,G)&&O(B,U,U.next,G)&&D(B,G)&&D(G,B)&&(k.push(B.i/N|0),k.push(U.i/N|0),k.push(G.i/N|0),z(U),z(U.next),U=L=G),U=U.next}while(U!==L);return i(U)}function c(L,k,N,U,B,G){var Y=L;do{for(var X=Y.next.next;X!==Y.prev;){if(Y.i!==X.i&&I(Y,X)){var K=F(Y,X);Y=i(Y,Y.next),K=i(K,K.next),n(Y,k,N,U,B,G,0),n(K,k,N,U,B,G,0);return}X=X.next}Y=Y.next}while(Y!==L)}function h(L,k,N,U){var B=[],G,Y,X,K,J;for(G=0,Y=k.length;G<Y;G++)X=k[G]*U,K=G<Y-1?k[G+1]*U:L.length,J=r(L,X,K,U,!1),J===J.next&&(J.steiner=!0),B.push(P(J));for(B.sort(u),G=0;G<B.length;G++)N=d(B[G],N);return N}function u(L,k){return L.x-k.x}function d(L,k){var N=p(L,k);if(!N)return k;var U=F(N,L);return i(U,U.next),i(N,N.next)}function p(L,k){var N=k,U=L.x,B=L.y,G=-1/0,Y;do{if(B<=N.y&&B>=N.next.y&&N.next.y!==N.y){var X=N.x+(B-N.y)*(N.next.x-N.x)/(N.next.y-N.y);if(X<=U&&X>G&&(G=X,Y=N.x<N.next.x?N:N.next,X===U))return Y}N=N.next}while(N!==k);if(!Y)return null;var K=Y,J=Y.x,se=Y.y,ce=1/0,te;N=Y;do U>=N.x&&N.x>=J&&U!==N.x&&T(B<se?U:G,B,J,se,B<se?G:U,B,N.x,N.y)&&(te=Math.abs(B-N.y)/(U-N.x),D(N,L)&&(te<ce||te===ce&&(N.x>Y.x||N.x===Y.x&&m(Y,N)))&&(Y=N,ce=te)),N=N.next;while(N!==K);return Y}function m(L,k){return C(L.prev,L,k.prev)<0&&C(k.next,L,L.next)<0}function g(L,k,N,U){var B=L;do B.z===0&&(B.z=b(B.x,B.y,k,N,U)),B.prevZ=B.prev,B.nextZ=B.next,B=B.next;while(B!==L);B.prevZ.nextZ=null,B.prevZ=null,y(B)}function y(L){var k,N,U,B,G,Y,X,K,J=1;do{for(N=L,L=null,G=null,Y=0;N;){for(Y++,U=N,X=0,k=0;k<J&&(X++,U=U.nextZ,!!U);k++);for(K=J;X>0||K>0&&U;)X!==0&&(K===0||!U||N.z<=U.z)?(B=N,N=N.nextZ,X--):(B=U,U=U.nextZ,K--),G?G.nextZ=B:L=B,B.prevZ=G,G=B;N=U}G.nextZ=null,J*=2}while(Y>1);return L}function b(L,k,N,U,B){return L=(L-N)*B|0,k=(k-U)*B|0,L=(L|L<<8)&16711935,L=(L|L<<4)&252645135,L=(L|L<<2)&858993459,L=(L|L<<1)&1431655765,k=(k|k<<8)&16711935,k=(k|k<<4)&252645135,k=(k|k<<2)&858993459,k=(k|k<<1)&1431655765,L|k<<1}function P(L){var k=L,N=L;do(k.x<N.x||k.x===N.x&&k.y<N.y)&&(N=k),k=k.next;while(k!==L);return N}function T(L,k,N,U,B,G,Y,X){return(B-Y)*(k-X)>=(L-Y)*(G-X)&&(L-Y)*(U-X)>=(N-Y)*(k-X)&&(N-Y)*(G-X)>=(B-Y)*(U-X)}function I(L,k){return L.next.i!==k.i&&L.prev.i!==k.i&&!v(L,k)&&(D(L,k)&&D(k,L)&&w(L,k)&&(C(L.prev,L,k.prev)||C(L,k.prev,k))||E(L,k)&&C(L.prev,L,L.next)>0&&C(k.prev,k,k.next)>0)}function C(L,k,N){return(k.y-L.y)*(N.x-k.x)-(k.x-L.x)*(N.y-k.y)}function E(L,k){return L.x===k.x&&L.y===k.y}function O(L,k,N,U){var B=x(C(L,k,N)),G=x(C(L,k,U)),Y=x(C(N,U,L)),X=x(C(N,U,k));return!!(B!==G&&Y!==X||B===0&&_(L,N,k)||G===0&&_(L,U,k)||Y===0&&_(N,L,U)||X===0&&_(N,k,U))}function _(L,k,N){return k.x<=Math.max(L.x,N.x)&&k.x>=Math.min(L.x,N.x)&&k.y<=Math.max(L.y,N.y)&&k.y>=Math.min(L.y,N.y)}function x(L){return L>0?1:L<0?-1:0}function v(L,k){var N=L;do{if(N.i!==L.i&&N.next.i!==L.i&&N.i!==k.i&&N.next.i!==k.i&&O(N,N.next,L,k))return!0;N=N.next}while(N!==L);return!1}function D(L,k){return C(L.prev,L,L.next)<0?C(L,k,L.next)>=0&&C(L,L.prev,k)>=0:C(L,k,L.prev)<0||C(L,L.next,k)<0}function w(L,k){var N=L,U=!1,B=(L.x+k.x)/2,G=(L.y+k.y)/2;do N.y>G!=N.next.y>G&&N.next.y!==N.y&&B<(N.next.x-N.x)*(G-N.y)/(N.next.y-N.y)+N.x&&(U=!U),N=N.next;while(N!==L);return U}function F(L,k){var N=new V(L.i,L.x,L.y),U=new V(k.i,k.x,k.y),B=L.next,G=k.prev;return L.next=k,k.prev=L,N.next=B,B.prev=N,U.next=N,N.prev=U,G.next=U,U.prev=G,U}function H(L,k,N,U){var B=new V(L,k,N);return U?(B.next=U.next,B.prev=U,U.next.prev=B,U.next=B):(B.prev=B,B.next=B),B}function z(L){L.next.prev=L.prev,L.prev.next=L.next,L.prevZ&&(L.prevZ.nextZ=L.nextZ),L.nextZ&&(L.nextZ.prevZ=L.prevZ)}function V(L,k,N){this.i=L,this.x=k,this.y=N,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}e.deviation=function(L,k,N,U){var B=k&&k.length,G=B?k[0]*N:L.length,Y=Math.abs(W(L,0,G,N));if(B)for(var X=0,K=k.length;X<K;X++){var J=k[X]*N,se=X<K-1?k[X+1]*N:L.length;Y-=Math.abs(W(L,J,se,N))}var ce=0;for(X=0;X<U.length;X+=3){var te=U[X]*N,oe=U[X+1]*N,$=U[X+2]*N;ce+=Math.abs((L[te]-L[$])*(L[oe+1]-L[te+1])-(L[te]-L[oe])*(L[$+1]-L[te+1]))}return Y===0&&ce===0?0:Math.abs((ce-Y)/Y)};function W(L,k,N,U){for(var B=0,G=k,Y=N-U;G<N;G+=U)B+=(L[Y]-L[G])*(L[G+1]+L[Y+1]),Y=G;return B}e.flatten=function(L){for(var k=L[0][0].length,N={vertices:[],holes:[],dimensions:k},U=0,B=0;B<L.length;B++){for(var G=0;G<L[B].length;G++)for(var Y=0;Y<k;Y++)N.vertices.push(L[B][G][Y]);B>0&&(U+=L[B-1].length,N.holes.push(U))}return N}}),QAe={mil:1,inch:1e3,ft:12e3,yard:36e3,mile:6336e4,km:3937007874e-2,dm:3937,mm:39.37,um:.039,nm:394e-7,pt:13.88888888888889,"px(72)":13.88888888888889,"px(96)":10.416666666666666,"px(100)":10},PLt=(()=>{let o={};for(let t in QAe)o[QAe[t]]=t;return o})(),e_e=class{constructor(t,e){this.ratio=t/e}wrap(t){return t*this.ratio}static convert(t,e,r){return t*e/r}};e_e.ASIS=new e_e(1,1);var xK=class{conversion(o,t,e){if(o===t)return e;let r=o+2+t;return this[r](e)}conversion1(o,t,e){let r=o+2+t,i=this[r](e);return t=="mil"?Math.round(i*10)/10:Math.round(i*1e3)/1e3}mil2mil(o){return o}mil2mm(o){return o*.0254}mil2cm(o){return o*.00254}mil2inch(o){return o/1e3}mm2mm(o){return o}mm2mil(o){let t=Math.pow(10,5);return Math.round(o*39.37007874015748*t)/t}mm2cm(o){return o/10}mm2inch(o){let t=Math.pow(10,8);return Math.round(o*.03937007874015748*t)/t}cm2mil(o){let t=Math.pow(10,6);return Math.round(o*393.7007874015748*t)/t}cm2mm(o){return o*10}cm2inch(o){let t=Math.pow(10,7);return Math.round(o*.3937007874015748*t)/t}inch2mil(o){return o*1e3}inch2mm(o){return o*25.4}inch2cm(o){return o*2.54}};xK.prototype["px(100)2mil"]=o=>o*10;xK.prototype["px(100)2mm"]=o=>o*.254;xK.prototype["mil2px(100)"]=o=>o/10;xK.prototype["mm2px(100)"]=o=>{let t=Math.pow(10,5);return Math.round(o*3.937007874015748*t)/t};var Z$=null,Mge=new ArrayBuffer(8),ege=new Float64Array(Mge),tge=new Uint32Array(Mge),t_e=new Uint16Array(Mge),r_e=class{static repeat(o,t){let e=new Array(t);for(;t-- >0;)e[t]=o;return e.join("")}static lpad(o,t,e){let r=e-o.length;return r>0?this.repeat(t,r)+o:o}static rpad(o,t,e){let r=e-o.length;return r>0?o+this.repeat(t,r):o}static strHashcode(o){if(o.length>0){let t=0;for(let e=0;e<o.length;e++)t=31*t+o.charCodeAt(e)|0;return t}else return 0}static arraycopy(o,t,e,r,i){if(o.length>=t+i&&e.length>=r+i)for(;i-- >0;)e[r++]=o[t++];else throw new Error("arraycopy out of range")}static undefAsNull(o){return null}static reverse(o,t){for(let e=0,r=o.length-1;r>=0;e++,r--)t[e]=o[r];return t}static sortAsc(o,t){return o-t}static xmlDecode(o){let t=o.length,e=new Array,r=-1;for(let i=0;i<t;i++){let n=o.charAt(i);if(r>=0){if(n===";"){let s=o.substring(r+1,i);switch(s){case"lt":e.push("<");break;case"gt":e.push(">");break;case"quot":e.push('"');break;case"apos":e.push("'");break;case"amp":e.push("&");break;default:if(s.charAt(0)==="#"){let a=parseInt(s.substring(1));e.push(String.fromCharCode(a))}else e.push("&"+s+";")}r=-1}}else n==="&"?r=i:e.push(n)}return r>=0&&e.push(o.substring(r)),e.join("")}static addAll(o,t){for(let e of t)o.push(e)}static addAllSet(o,t){for(let e of t)o.add(e)}static contains(o,t){for(let e of o)if(e.equals(t))return!0;return!1}static equals(o,t){if(o.length==t.length){for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}else return!1}static remove(o,t){let e=0,r=o.length;for(let i=0;i<r;i++)o[i]===t&&(o.splice(i,1),i--,r--,e++);return e}static getUrlVars(){for(var o={},t=location.href.slice(location.href.indexOf("?")+1).split("&"),e=0;e<t.length;e++){var r=t[e].split("=");o[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return o}static prefix(){if(!Z$){let o=this.getUrlVars().version;o?Z$="/analyzer/v"+o:Z$="/analyzer"}return Z$}static add2objS(o,t,e){if(t in o)return o[t];{let r=e(t);return o[t]=r,r}}static downloadFile(o,t){let e=document.createElement("a"),r=URL.createObjectURL(t);e.download=o,e.href=r,e.click(),URL.revokeObjectURL(r)}static uuid(){let o=new Array;ege[0]=new Date().getTime(),o.push(tge[1].toString(16)),ege[0]=Math.random(),o.push(t_e[3].toString(16));let t=t_e[2].toString(16);o.push("4"+t.substr(0,3)),ege[0]=performance.now();let e=tge[0].toString(16)+tge[1].toString(16);return o.push("0"+e.substr(0,3)),o.push(e.substr(3)),o.join("-")}static funcCopy(o){return(0,eval)("("+o.toString()+")")}static NVL(...o){for(let t of o)if(t!==null)return t;return null}static isSingle(o){return Array.from(new Set(o)).length===o.length}},k_e=class{static rgb(o){if(0<=o&&o<=255)return o;throw new Error(p7.format("RGB should not nagative and not over 255(0xFF): %X",o))}static normal(o){if(isFinite(o))return o;throw new Error(p7.format("%f is not permitted",o))}static positiveOr0(o){if(o>=0)return o;throw new Error(p7.format("%f must >= 0",o))}static positive(o){if(o>0)return o;throw new Error(p7.format("%f must > 0",o))}static notnull(o){if(o!=null)return o;throw new Error("invalid null value")}static mustnull(o){if(o===null)return null;throw new Error("value must be null")}static notEmpty(o){if(o==null||o.length===0)throw new Error("invalid empty string");return o}static nullOrEmpty(o){return o==null||o.length===0}static notNullOrUndef(o){if(o!=null)return o;throw new Error("null or undefined is not permitted")}},cZe=/(\.?0+)$/,p7=class{static format(o,...t){return this.format1(o,t)}static format1(o,t){let e=this._format(o,t);if(typeof e=="string")return e;throw new Error(this.format("Invalid state on (%d) %s",e,o))}static _format(o,t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l),h=c.charCodeAt(0);switch(r){case 0:h===37?r=1:e.push(c);break;case 1:switch(h){case 100:if(n=t[i++],typeof n=="number")e.push(n.toFixed(0)),r=0;else return l;break;case 102:if(n=t[i++],typeof n=="number")e.push(n.toString()),r=0;else return l;break;case 120:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16)),r=0;else return l;break;case 88:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16).toUpperCase()),r=0;else return l;break;case 115:case 99:n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case 48:s=l+1,a=-1,r=2;break;case 37:e.push("%"),r=0;break;default:return l}break;case 2:switch(h){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a=l;break;case 120:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(r_e.lpad((n|0).toString(16),"0",u)),r=0;else return l}else return l;break;case 88:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(r_e.lpad((n|0).toString(16).toUpperCase(),"0",u)),r=0;else return l}else return l;break;default:return l}break;default:return l}}return e.join("")}static startsWith(o,t){return o.length>=t.length?o.substring(0,t.length)===t:!1}static endsWith(o,t){return o.length>=t.length?o.substring(o.length-t.length)===t:!1}static split(o,t){let e=new Array,r=0;for(;;){let i=o.exec(t);if(i!==null){let n=o.lastIndex-i[0].length;e.push(t.substring(r,n)),r=o.lastIndex}else{let n=t.substring(r);k_e.nullOrEmpty(n)||e.push(n);break}}return e}static fmtNumber(o){return o.toFixed(5).replace(cZe,"")}};function hZe(o){switch(o){case 0:return"DEBUG";case 1:return"INFO";case 2:return"WARNING";case 3:return"ERROR";case 4:return"DUMMY"}}var uZe=(o,t)=>{o===3?console.error(t):console.log(t)},dZe=(o,t)=>p7.format("%s %s: %s",new Date,hZe(o),t),Tge=class Ige{constructor(t,e=uZe,r=dZe){this.debug=!1,this.level=t,this.writer=e,this.fmt=r}static mix(...t){let e=4;for(let r of t)r.level<e&&(e=r.level);return new Ige(e,(r,i)=>{for(let n of t)n.write1(r,i)},(r,i)=>i)}wrap(t=null,e=null){let r=t===null?this.fmt:(n,s)=>(s=t(n,s),this.fmt(n,s)),i=e===null?this.writer:(n,s)=>{e(n,s),this.writer(n,s)};return new Ige(this.level,i,r)}chain(t){return t.wrap(this.fmt.bind(this),this.writer.bind(this))}include(t){return this.level<=t}write3(t,e,r){this.include(t)&&this.writer(t,this.fmt(t,p7.format(e,...r)))}write2(t,e){this.include(t)&&(e instanceof Error?this.writer(t,this.fmt(t,e.stack)):this.writer(t,this.fmt(t,e.toString())))}write1(t,e){this.include(t)&&this.writer(t,this.fmt(t,e))}debug3(t,...e){this.write3(0,t,e)}debug2(t){this.write2(0,t)}debug1(t){this.write1(0,t)}info3(t,...e){this.write3(1,t,e)}info2(t){this.write2(1,t)}info1(t){this.write1(1,t)}warning3(t,...e){this.write3(2,t,e)}warning2(t){this.write2(2,t)}warning1(t){this.write1(2,t)}error3(t,...e){this.write3(3,t,e)}error2(t){this.write2(3,t)}error1(t){this.write1(3,t)}};Tge.DUMMY=new Tge(4);var RK=Tge,Nge=new ArrayBuffer(8),rge=new Float64Array(Nge),ige=new Uint32Array(Nge),i_e=new Uint16Array(Nge),n_e=ArrayBuffer;try{n_e=self.HTMLImageElement||n_e}catch{}var J$=null;function cw(o,t,e=0,r=o.length){i(o,null,t,e,r);function i(s,a,l,c,h){let u,d,p,m;if(c<h-1){let g=h-c;if(g>50)a===null&&(a=new Array(g+1)),n(s,a,l,c,(c+h)/2|0,h);else{u=s[c],d=c,p=c,m=h;let y=d+1;for(;y<m;){if(p!=m){if(m=m+-1,l(u,s[m])<=0)continue;s[p]=s[m],p=m;continue}if(l(u,s[y])>=0){d=y,y=d+1;continue}s[p]=s[y],d=y,p=y,y=d+1}s[p]=u,i(s,a,l,c,p),i(s,a,l,p+1,h)}}}function n(s,a,l,c,h,u){i(s,a,l,c,h),i(s,a,l,h,u);for(var d=c,p=h,m=0,g=s[d],y=s[p];d<h&&p<u;){var b=l(g,y);isNaN(b)?(a[m++]=y,y=s[++p]):(b<=0&&(a[m++]=g,g=s[++d]),b>=0&&(a[m++]=y,y=s[++p]))}for(;d<h;d++)a[m++]=s[d];for(;p<u;p++)a[m++]=s[p];for(d=c,p=0;p<m;d++,p++)s[d]=a[p]}}var kg=class{static repeat(o,t){let e=new Array(t);for(;t-- >0;)e[t]=o;return e.join("")}static lpad(o,t,e){let r=e-o.length;return r>0?this.repeat(t,r)+o:o}static rpad(o,t,e){let r=e-o.length;return r>0?o+this.repeat(t,r):o}static strHashcode(o){if(o.length>0){let t=0;for(let e=0;e<o.length;e++)t=31*t+o.charCodeAt(e)|0;return t}else return 0}static arraycopy(o,t,e,r,i){if(o.length>=t+i&&e.length>=r+i)for(;i-- >0;)e[r++]=o[t++];else throw new Error("arraycopy out of range")}static undefAsNull(o){return null}static reverse(o,t){for(let e=0,r=o.length-1;r>=0;e++,r--)t[e]=o[r];return t}static sortAsc(o,t){return o-t}static xmlDecode(o){let t=o.length,e=new Array,r=-1;for(let i=0;i<t;i++){let n=o.charAt(i);if(r>=0){if(n===";"){let s=o.substring(r+1,i);switch(s){case"lt":e.push("<");break;case"gt":e.push(">");break;case"quot":e.push('"');break;case"apos":e.push("'");break;case"amp":e.push("&");break;default:if(s.charAt(0)==="#"){let a=parseInt(s.substring(1));e.push(String.fromCharCode(a))}else e.push("&"+s+";")}r=-1}}else n==="&"?r=i:e.push(n)}return r>=0&&e.push(o.substring(r)),e.join("")}static addAll(o,t){for(let e of t)o.push(e)}static addAllSet(o,t){for(let e of t)o.add(e)}static contains(o,t){for(let e of o)if(e.equals(t))return!0;return!1}static equals(o,t){if(o.length==t.length){for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}else return!1}static remove(o,t){let e=0,r=o.length;for(let i=0;i<r;i++)o[i]===t&&(o.splice(i,1),i--,r--,e++);return e}static getUrlVars(){for(var o={},t=location.href.slice(location.href.indexOf("?")+1).split("&"),e=0;e<t.length;e++){var r=t[e].split("=");o[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return o}static prefix(){if(!J$){let o=this.getUrlVars().version;o?J$="/analyzer/v"+o:J$="/analyzer"}return J$}static add2objS(o,t,e){if(t in o)return o[t];{let r=e(t);return o[t]=r,r}}static downloadFile(o,t){let e=document.createElement("a"),r=URL.createObjectURL(t);e.download=o,e.href=r,e.click(),URL.revokeObjectURL(r)}static uuid(){let o=new Array;rge[0]=new Date().getTime(),o.push(ige[1].toString(16)),rge[0]=Math.random(),o.push(i_e[3].toString(16));let t=i_e[2].toString(16);o.push("4"+t.substr(0,3)),rge[0]=performance.now();let e=ige[0].toString(16)+ige[1].toString(16);return o.push("0"+e.substr(0,3)),o.push(e.substr(3)),o.join("-")}static funcCopy(o){return(0,eval)("("+o.toString()+")")}static NVL(...o){for(let t of o)if(t!==null)return t;return null}static isSingle(o){return Array.from(new Set(o)).length===o.length}},pZe=[1,10,100,1e3],Q$=0,nw=0;function o_e(o,t,e){return Q$=Math.abs(o-t),e>=5&&Q$>1e-5||isNaN(e)&&Q$>1e-8?!1:Q$<1e-13?!0:(nw=Math.min(s_e(o),s_e(t)),nw<10&&(nw=10),isNaN(e)||(nw=Math.min(nw,e)),a_e(o,nw)===a_e(t,nw))}var eK=0,tK=0;function s_e(o){return eK=0,tK=0,o>0?eK=o-Math.floor(o):eK=o-Math.ceil(o),tK=(eK.toString()||"").length,tK>2?tK-2:0}function a_e(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=pZe[t]||Math.pow(10,t)||10;if(e){var i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(i+o)}else return Math.round(o*r+1e-10)/r}var fZe=/(\.?0+)$/,f7=class{static format(o,...t){return this.format1(o,t)}static format1(o,t){let e=this._format(o,t);if(typeof e=="string")return e;throw new Error(this.format("Invalid state on (%d) %s",e,o))}static _format(o,t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l),h=c.charCodeAt(0);switch(r){case 0:h===37?r=1:e.push(c);break;case 1:switch(h){case 100:if(n=t[i++],typeof n=="number")e.push(n.toFixed(0)),r=0;else return l;break;case 102:if(n=t[i++],typeof n=="number")e.push(n.toString()),r=0;else return l;break;case 120:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16)),r=0;else return l;break;case 88:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16).toUpperCase()),r=0;else return l;break;case 115:case 99:n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case 48:s=l+1,a=-1,r=2;break;case 37:e.push("%"),r=0;break;default:return l}break;case 2:switch(h){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a=l;break;case 120:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(kg.lpad((n|0).toString(16),"0",u)),r=0;else return l}else return l;break;case 88:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(kg.lpad((n|0).toString(16).toUpperCase(),"0",u)),r=0;else return l}else return l;break;default:return l}break;default:return l}}return e.join("")}static startsWith(o,t){return o.length>=t.length?o.substring(0,t.length)===t:!1}static endsWith(o,t){return o.length>=t.length?o.substring(o.length-t.length)===t:!1}static split(o,t){let e=new Array,r=0;for(;;){let i=o.exec(t);if(i!==null){let n=o.lastIndex-i[0].length;e.push(t.substring(r,n)),r=o.lastIndex}else{let n=t.substring(r);Fa.nullOrEmpty(n)||e.push(n);break}}return e}static fmtNumber(o){return o.toFixed(5).replace(fZe,"")}},Fa=class{static rgb(o){if(0<=o&&o<=255)return o;throw new Error(f7.format("RGB should not nagative and not over 255(0xFF): %X",o))}static normal(o){if(isFinite(o))return o;throw new Error(f7.format("%f is not permitted",o))}static positiveOr0(o){if(o>=0)return o;throw new Error(f7.format("%f must >= 0",o))}static positive(o){if(o>0)return o;throw new Error(f7.format("%f must > 0",o))}static notnull(o){if(o!=null)return o;throw new Error("invalid null value")}static mustnull(o){if(o===null)return null;throw new Error("value must be null")}static notEmpty(o){if(o==null||o.length===0)throw new Error("invalid empty string");return o}static nullOrEmpty(o){return o==null||o.length===0}static notNullOrUndef(o){if(o!=null)return o;throw new Error("null or undefined is not permitted")}},sr=class{static regular(o){return Math.round(o*this.precision)/this.precision}static eq(o,t){return Math.abs(o-t)<=this.eps}static neq(o,t){return Math.abs(o-t)>this.eps}static less(o,t){return o-t<-this.eps}static lesseq(o,t){return o-t<=this.eps}static greater(o,t){return o-t>this.eps}static greatereq(o,t){return o-t>=-this.eps}static sqrt(o){return Math.abs(o)<=1e-10?0:Math.sqrt(o)}static sortAsc(o,t){return o-t}static sortDesc(o,t){return t-o}};sr.eps=1e-8,sr.precision=1e8;function g7(o,t){bK(o.iterator(),t)}function bK(o,t){let e=0;for(;o.hasNext();){let r=o.next();t(e++,r)}}var mZe=class{constructor(o){this.idx=-1,this.lst=o}hasNext(){return this.idx<this.lst.length-1}next(){if(this.idx<this.lst.length-1)return this.idx++,this.lst[this.idx];throw new Error("bug")}};function Cge(o){return new mZe(o)}var dK=class aP{static toDegrees(t){return t*180/Math.PI}static toRadians(t){return t/180*Math.PI}static regularD(t){return t=t%360,t=t<0?360+t:t,t===360?0:t}static regular(t){return t=t%aP.PIx2,t=t<0?aP.PIx2+t:t,t===aP.PIx2?0:t}static toQuarterBase(t){return aP.regular((t+aP.PI_4)/aP.PI_2*aP.PI_2)}static toQuarterBaseD(t){return aP.regularD(((t+45)/90|0)*90)}static transformD(t,e){return aP.toDegrees(aP.transform(aP.toRadians(t),e))}static transform(t,e){let r=Math.cos(t),i=Math.sin(t),n=new S(e.data[6],e.data[7]),s=new S(r,i).multiply3(e);return aP.regular(s.angle(n))}};dK.PIx2=Math.PI*2,dK.PI_2=Math.PI/2,dK.PI_4=Math.PI/4;var so=dK,dp=class{static dotProd1(o,t,e,r){return o*e+t*r}static dotProd2(o,t,e,r,i,n){return this.dotProd1(e-o,r-t,i-e,n-r)}static dotProd3(o,t,e){return this.dotProd2(o.x,o.y,t.x,t.y,e.x,e.y)}static crossProd1(o,t,e,r){return o*r-t*e}static crossProd2(o,t,e,r,i,n){return this.crossProd1(e-o,r-t,i-e,n-r)}static crossProd3(o,t,e){return this.crossProd2(o.x,o.y,t.x,t.y,e.x,e.y)}static distance2(o,t,e,r){let i=e-o,n=r-t;return i*i+n*n}static distance1(o,t,e,r){return this.hypot(e-o,r-t)}static distance1p(o,t){return this.distance1(o.x,o.y,t.x,t.y)}static hypot(o,t){if(o=Math.abs(o),t=Math.abs(t),t>o){var e=t;t=o,o=e}if(o===0)return t;var r=t/o;return o*Math.sqrt(1+r*r)}},B_e=new ArrayBuffer(16),l_e=new Float64Array(B_e),rK=new Int32Array(B_e),ow=class Uh{static sortByXAsc(t,e){return t.x-e.x}static sortByYAsc(t,e){return t.y-e.y}static sortByXYAsc(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y-e.y}static caculateAngle(t,e){let r=Math.cos(t),i=Math.sin(t),n=r*e.data[0]+i*e.data[4],s=r*e.data[1]+i*e.data[5],a=new Uh(n,s).normalize();return Math.atan2(a.y,a.x)}static normal(t,e,r){let i=e.sub(t),n=r.sub(e);return i.cross(n)}static getVector2(t){return new Uh(Math.cos(t),Math.sin(t))}static getCrossPoint1(t,e,r,i){if(t.equals1(e)||r.equals1(i)||sr.eq(1,Math.abs(e.sub(t).normalize().dot(i.sub(r).normalize()))))return null;let n=e.y-t.y,s=t.x-e.x,a=e.x*t.y-t.x*e.y,l=i.y-r.y,c=r.x-i.x,h=i.x*r.y-r.x*i.y,u=n*c-l*s;return new Uh((h*s-a*c)/u,(a*l-h*n)/u)}static getCrossPoint2(t,e,r,i){return this.getCrossPoint1(t,t.add(e),r,r.add(i))}constructor(t,e){this.x=Fa.normal(t),this.y=Fa.normal(e)}get hashed(){return this._hashed==null&&(l_e[0]=this.x,l_e[1]=this.y,this._hashed=rK[0]^rK[1]^rK[2]^rK[3]),this._hashed}dot(t){return this.x*t.x+this.y*t.y}length(){return Math.sqrt(this.dot(this))}getCos(){return this.x/this.length()}sub(t){var e=this.x-t.x,r=this.y-t.y;return new Uh(e,r)}add(t){var e=this.x+t.x,r=this.y+t.y;return new Uh(e,r)}div(t){return new Uh(this.x/t,this.y/t)}add1(t,e){return new Uh(this.x+t,this.y+e)}mul(t){return new Uh(this.x*t,this.y*t)}cross(t){return this.x*t.y-this.y*t.x}getSin(){return this.y/this.length()}angle2(t){let e=this.y-t.y,r=this.x-t.x;return e=Math.abs(e-0)<10**-4?0:e,r=Math.abs(r-0)<10**-4?0:r,Math.atan2(e,r)}angleD2(t){return so.toDegrees(this.angle2(t))}angle(t){return Math.atan2(this.y-t.y,this.x-t.x)}angleX(t=Uh.ORIGIN){let e=this.angle(t);return e<0&&(e=Math.PI*2+e),e}angleD(t){return so.toDegrees(this.angle(t))}distance1(t){let e=t.x-this.x,r=t.y-this.y;return dp.hypot(e,r)}distance2(t){let e=t.x-this.x,r=t.y-this.y;return e*e+r*r}rotateD(t,e){return this.rotate(t,so.toRadians(e))}rotate(t,e){let r=Math.cos(e),i=Math.sin(e),n=this.x-t.x,s=this.y-t.y,a=n*r+s*-i,l=n*i+s*r;return t.add1(a,l)}multiply3(t){let e=this.x*t.data[0]+this.y*t.data[3]+t.data[6],r=this.x*t.data[1]+this.y*t.data[4]+t.data[7];return new Uh(e,r)}multiply4(t){let e=this.x*t.data[0]+this.y*t.data[4]+t.data[12],r=this.x*t.data[1]+this.y*t.data[5]+t.data[13];return new Uh(e,r)}hashCode(){return this.hashed}equals(t,e){return t instanceof Uh?o_e(t.x,this.x,e)&&o_e(t.y,this.y,e):!1}equals1(t){return t?sr.eq(this.x,t.x)&&sr.eq(this.y,t.y):!1}equals2(t,e){return t instanceof Uh?Math.abs(this.x-t.x)<=e&&Math.abs(this.y-t.y)<=e:!1}similarEquals(t,e=.5){return Math.abs(this.x*.1-t.x*.1)<=e&&Math.abs(this.y*.1-t.y*.1)<=e}toString(){return"Vector [X="+this.x+", Y="+this.y+"]"}bbox(){let t=this.x,e=this.y;return new ht(t,t,e,e)}normalize(){if(this.x===0&&this.y===0)return new Uh(0,0);let t=this.x/this.length(),e=this.y/this.length();return new Uh(t,e)}regular(t=1e-4){let e=Math.round(1/t);return new Uh(Math.round(this.x*e)/e,Math.round(this.y*e)/e)}round(t=4){let e=10**(t|0);return new Uh(Math.round(this.x*e)/e,Math.round(this.y*e)/e)}mirrorX(t=Uh.ORIGIN){return new Uh(this.x,2*t.y-this.y)}mirrorY(t=Uh.ORIGIN){return new Uh(2*t.x-this.x,this.y)}mirrorCenter(t=Uh.ORIGIN){return new Uh(2*t.x-this.x,2*t.y-this.y)}clone(){return new Uh(this.x,this.y)}mirror(t=Uh.ORIGIN){return new Uh(2*t.x-this.x,2*t.y-this.y)}pointOnRays(t,e){let r=so.toRadians(t);return new Uh(this.x+Math.cos(r)*e,this.y+Math.sin(r)*e)}pointOnRays2(t,e){let r=t.angle(this);return new Uh(this.x+Math.cos(r)*e,this.y+Math.sin(r)*e)}scale(t){return new Uh(this.x*t,this.y*t)}};ow.ORIGIN=new ow(0,0),ow.X_UNIT_VECTOR=new ow(1,0),ow.Y_UNIT_VECTOR=new ow(0,1);var S=ow,kge=(o=>(o[o.LEFT=0]="LEFT",o[o.CENTER=1]="CENTER",o[o.RIGHT=2]="RIGHT",o))(kge||{}),G1=(o=>(o[o.TOP=0]="TOP",o[o.CENTER=1]="CENTER",o[o.BOTTOM=2]="BOTTOM",o))(G1||{}),um=class{constructor(t,e){this.horizontal=t,this.vertical=e}};um.LT=new um(0,0),um.LC=new um(0,1),um.LB=new um(0,2),um.CT=new um(1,0),um.CC=new um(1,1),um.CB=new um(1,2),um.RT=new um(2,0),um.RC=new um(2,1),um.RB=new um(2,2);var fm=um,_e=class{constructor(){this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY}ext1(o){return this.minX=Math.min(this.minX,o.minX),this.maxX=Math.max(this.maxX,o.maxX),this.minY=Math.min(this.minY,o.minY),this.maxY=Math.max(this.maxY,o.maxY),this}ext2(o){return this.minX=Math.min(this.minX,o.x),this.maxX=Math.max(this.maxX,o.x),this.minY=Math.min(this.minY,o.y),this.maxY=Math.max(this.maxY,o.y),this}ext3(o){for(let t=0;t<o.length;t++){let e=o[t];this.ext2(e)}return this}ext4(o){return g7(o,(t,e)=>(this.ext2(e),!0)),this}ext5(o,t,e,r){return this.minX=Math.min(this.minX,o),this.maxX=Math.max(this.maxX,t),this.minY=Math.min(this.minY,e),this.maxY=Math.max(this.maxY,r),this}ext6(o,t){return this.minX=Math.min(this.minX,o),this.maxX=Math.max(this.maxX,o),this.minY=Math.min(this.minY,t),this.maxY=Math.max(this.maxY,t),this}ext7(o){if(o<0){let t=o*2;if(t<this.minX-this.maxX||t<this.minY-this.maxY)throw new Error("")}return this.minX-=o,this.maxX+=o,this.minY-=o,this.maxY+=o,this}ext8(o){let t=[];for(let e=0;e<o.length;e+=2)t.push(new S(o[e],o[e+1]));return this.ext3(t)}ext9(o,t,e,r){return this.minX=Math.min(this.minX,o),this.maxX=Math.max(this.maxX,o+e),this.minY=Math.min(this.minY,t),this.maxY=Math.max(this.maxY,t+r),this}ext10({x:o,y:t,width:e,height:r}){return this.ext9(o,t,e,r)}valid(){return isFinite(this.minX)&&isFinite(this.maxX)&&isFinite(this.minY)&&isFinite(this.maxY)}clear(){this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY}build(){return new ht(this.minX,this.maxX,this.minY,this.maxY)}build1(){return this.valid()?new ht(this.minX,this.maxX,this.minY,this.maxY):new ht(0,0,0,0)}},MU=new Float64Array(4),ht=class RT{static extendRect({x:t,y:e,width:r,height:i}){return new RT(t,t+r,e,e+i)}static extend1(t,e){if(t===null)return new RT(e.x,e.x,e.y,e.y);{let r=Math.min(t.minX,e.x),i=Math.max(t.maxX,e.x),n=Math.min(t.minY,e.y),s=Math.max(t.maxY,e.y);return new RT(r,i,n,s)}}static extend2(t,e){if(t){let r=Math.min(t.minX,e.minX),i=Math.max(t.maxX,e.maxX),n=Math.min(t.minY,e.minY),s=Math.max(t.maxY,e.maxY);return new RT(r,i,n,s)}else return e}static extend3(t,e){let r=Math.min(t.x,e.x),i=Math.max(t.x,e.x),n=Math.min(t.y,e.y),s=Math.max(t.y,e.y);return new RT(r,i,n,s)}static extend4(t,e,r){return new RT(t.x-e/2,t.x+e/2,t.y-r/2,t.y+r/2)}constructor(t,e,r,i){if(this.minX=Fa.normal(t),this.maxX=Fa.normal(e),this.minY=Fa.normal(r),this.maxY=Fa.normal(i),t>e||r>i)throw new Error(`min > max is not permitted: [${t}, ${e}, ${r}, ${i}]`)}get data(){return MU[0]=this.minX,MU[1]=this.maxX,MU[2]=this.minY,MU[3]=this.maxY,MU}isContains(t){return this.isContains1(t.x,t.y)}points(){return[this.LL(),this.LR(),this.UR(),this.UL(),this.LL()]}isContains1(t,e){return this.isContainsX(t)&&this.isContainsY(e)}isContains2(t,e){return this.isContainsX1(t)&&this.isContainsY1(e)}isContainsX(t){return t>=this.minX&&t<=this.maxX}isContainsX1(t){return sr.greatereq(t,this.minX)&&sr.lesseq(t,this.maxX)}isContainsY(t){return t>=this.minY&&t<=this.maxY}isContainsY1(t){return sr.greatereq(t,this.minY)&&sr.lesseq(t,this.maxY)}isIntersect(t){return!(this.maxX<t.minX||this.minX>t.maxX||this.maxY<t.minY||this.minY>t.maxY)}extendOfSize(t){return Fa.positiveOr0(this.maxX-this.minX+t*2),Fa.positiveOr0(this.maxY-this.minY+t*2),new RT(this.minX-t,this.maxX+t,this.minY-t,this.maxY+t)}isInside(t){return this.minX>=t.minX&&this.maxX<=t.maxX&&this.minY>=t.minY&&this.maxY<=t.maxY}isContainsBBox(t){return this.maxX>=t.maxX&&this.minX<=t.minX&&this.maxY>=t.maxY&&this.minY<=t.minY}isContainsBBox1(t){return sr.greatereq(this.maxX,t.maxX)&&sr.lesseq(this.minX,t.minX)&&sr.greatereq(this.maxY,t.maxY)&&sr.lesseq(this.minY,t.minY)}intersect(t){let e=Math.max(this.minX,t.minX),r=Math.min(this.maxX,t.maxX);if(e>r)return null;let i=Math.max(this.minY,t.minY),n=Math.min(this.maxY,t.maxY);return i>n?null:new RT(e,r,i,n)}intersection1(t){let e=Math.max(this.minX,t.minX),r=Math.min(this.maxX,t.maxX);if(sr.greater(e,r))return null;e>r&&(r=e);let i=Math.max(this.minY,t.minY),n=Math.min(this.maxY,t.maxY);return sr.greater(i,n)?null:(i>n&&(n=i),new RT(e,r,i,n))}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}UL(){return new S(this.minX,this.maxY)}UR(){return new S(this.maxX,this.maxY)}LL(){return new S(this.minX,this.minY)}LR(){return new S(this.maxX,this.minY)}center(){return new S(this.maxX-(this.maxX-this.minX)/2,this.maxY-(this.maxY-this.minY)/2)}area(){return this.width()*this.height()}transform(t){let e=new _e;return e.ext2(this.LL().multiply3(t)),e.ext2(this.LR().multiply3(t)),e.ext2(this.UR().multiply3(t)),e.ext2(this.UL().multiply3(t)),e.build()}transform4(t){let e=new _e;return e.ext2(this.LL().multiply4(t)),e.ext2(this.LR().multiply4(t)),e.ext2(this.UR().multiply4(t)),e.ext2(this.UL().multiply4(t)),e.build()}isSeparated(t){if(t==null||t==null)return!1;let e;this.minX>=t.minX?e=this.minX:e=t.minX;let r;if(this.maxX<=t.maxX?r=this.maxX:r=t.maxX,e>r)return!0;{let i;this.minY>=t.minY?i=this.minY:i=t.minY;let n;return this.maxY<=t.maxY?n=this.maxY:n=t.maxY,i>n}}relation(t){let e=0,r=0,i;this.minX>t.minX?(e++,i=this.minX):this.minX===t.minX?i=this.minX:(r++,i=t.minX);let n;if(this.maxX<t.maxX?(e++,n=this.maxX):this.maxX===t.maxX?n=this.maxX:(r++,n=t.maxX),i>n)return 2;{let s;this.minY>t.minY?(e++,s=this.minY):this.minY===t.minY?s=this.minY:(r++,s=t.minY);let a;return this.maxY<t.maxY?(e++,a=this.maxY):this.maxY===t.maxY?a=this.maxY:(r++,a=t.maxY),s>a?2:e===4?0:r===4?1:e===0&&r===0?4:i===n||s===a?6:e!==r?5:3}}zoom(t){let e=this.width(),r=this.height(),i=this.center();return t!=0&&(e/=t/2,r/=t/2),new RT(i.x-e,i.x+e,i.y-e,i.y+e)}toString(){return"BBox [minX="+this.minX+", maxX="+this.maxX+", minY="+this.minY+", maxY="+this.maxY+"]"}equals(t){return this.minY==t.minY&&this.minX==t.minX&&this.maxX==t.maxX&&this.maxY==t.maxY}extendSize(t,e){return Object.is(void 0,e)&&(e=t),RT.extend4(this.center(),this.width()+t,this.height()+e)}positionOnBBox(t,e=0){let r=this.center(),i=this.width()*e/2,n=this.height()*e/2,s=t.x-r.x,a=t.y-r.y;return s>i?a>n?fm.RT:a<-n?fm.RB:fm.RC:s<-i?a>n?fm.LT:a<-n?fm.LB:fm.LC:a>n?fm.CT:a<-n?fm.CB:fm.CC}bbox(){return this}},PK=class cl{static mul(t,e,r,i,n,s){let a=0,l=0;for(let c=0;c<t;c++){for(let h=0;h<r;h++){let u=h,d=0;for(let p=0;p<e;p++)d+=i[l+p]*n[u],u+=r;s[a++]=d}l+=e}}constructor(t,e,r){this.m=Fa.normal(t),this.n=Fa.normal(e);let i=t*e;if(r.length===i){for(let n=0;n<r.length;n++)Fa.normal(r[n]);this.data=r}else throw new Error("invalid matrix size")}mul(t){if(this.n===t.m){let e=new Array(this.m*t.n);return cl.mul(this.m,this.n,t.n,this.data,t.data,e),new cl(this.m,t.n,e)}else throw new Error("m !== p")}toString(){let t=[];t.push("Matrix ("),t.push(this.m.toString()),t.push(" x "),t.push(this.n.toString()),t.push(")");let e=0;for(let r=0;r<this.m;r++)for(let i=0;i<this.n;i++){let n=this.data[e++].toString();i===0?(t.push(`
`),t.push("	"),t.push(n)):(t.push(", "),t.push(n))}return t.join("")}static on(t,e,r){return t*e+r}initExpandMatrix(t){let e=this.m,r=this.n,i=r*2,n=new Array(e*i);for(let s=0;s<e;s++)for(let a=0;a<i;a++)a<r?n[cl.on(i,s,a)]=t[cl.on(r,s,a)]:a===e+s?n[cl.on(i,s,a)]=1:n[cl.on(i,s,a)]=0;return n}inverseMatrix(t,e,r){for(let i=0;i<e;i++){let n=t[cl.on(r,i,i)];for(let s=0;s<r;s++)t[cl.on(r,i,s)]/=n}return t}getMatrixRank(t,e,r){let i=Math.min(e,r);for(let n=0;n<e;n++){if(t[cl.on(r,n,n)]===0){let s=new Array(r),a;for(a=n;a<e;a++)if(t[cl.on(r,a,n)]!==0){kg.arraycopy(t,cl.on(r,a,0),s,0,r),kg.arraycopy(t,cl.on(r,n,0),t,cl.on(r,a,0),r),kg.arraycopy(s,0,t,cl.on(r,n,0),r);break}a>=e&&(i-=1)}if(!(i<e))for(let s=0;s<e;s++){if(s===n)continue;let a=t[cl.on(r,s,n)]/t[cl.on(r,n,n)];for(let l=0;l<r;l++)t[cl.on(r,s,l)]-=t[cl.on(r,n,l)]*a}}return i}getInverseMatrix(){if(this.m!==this.n)throw new Error("The matrix is an "+this.m+"x"+this.n+" order matrix, non-square matrix, please check!");function t(s){return sr.lesseq(Math.abs(s),0)}let e=this.initExpandMatrix(this.data.slice(0)),r=this.n*2;function i(s,a){for(let l=0;l<r;l++){let c=e[cl.on(r,s,l)];e[cl.on(r,s,l)]=e[cl.on(r,a,l)],e[cl.on(r,a,l)]=c}}for(let s=0;s<this.m;s++){let a=Math.abs(e[cl.on(r,s,s)]),l=s;if(t(e[cl.on(r,s,s)]))for(let h=s+1;h<this.m;h++){if(t(e[cl.on(r,h,s)])){Math.abs(e[cl.on(r,h,s)])>a&&(a=Math.abs(e[cl.on(r,h,s)]),l=h);continue}i(s,h);break}if(t(e[cl.on(r,s,s)])){if(a===0)throw new Error("The matrix is a non-full rank matrix, please check!");console.warn("The matrix may be a non-full rank matrix, please check!"),l!==s&&i(s,l)}let c=1/e[cl.on(r,s,s)];for(let h=0;h<r;h++)e[cl.on(r,s,h)]*=c;for(let h=0;h<this.m;h++){if(s===h)continue;let u=e[cl.on(r,h,s)];for(let d=s;d<r;d++)e[cl.on(r,h,d)]-=e[cl.on(r,s,d)]*u}}let n=[];for(let s=0;s<this.m;s++)for(let a=this.n;a<r;a++)n[cl.on(this.n,s,a-this.n)]=e[cl.on(r,s,a)];return new cl(this.m,this.n,n)}getTransposeMatrix(){let t=new Array(this.data.length);for(let e=0;e<this.m;e++)for(let r=0;r<this.n;r++)t[r*this.n+e]=this.data[e*this.m+r];return new cl(this.n,this.m,t)}hashCode(){let t=0;for(let e of this.data)t+=e;return t}equals(t){return this===t?!0:t===null?!1:t instanceof cl?!(this.m!=t.m||this.n!=t.n||!kg.equals(this.data,t.data)):!1}},gZe=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],Sge=class kd extends PK{static translate(t,e,r){return new kd([1,0,0,0,0,1,0,0,0,0,1,0,t,e,r,1])}static translate1(t){return new kd([1,0,0,0,0,1,0,0,0,0,1,0,t.x,t.y,t.z,1])}static rotateX(t){let e=Math.cos(t),r=Math.sin(t);return new kd([1,0,0,0,0,e,r,0,0,-r,e,0,0,0,0,1])}static rotateY(t){let e=Math.cos(t),r=Math.sin(t);return new kd([e,0,-r,0,0,1,0,0,r,0,e,0,0,0,0,1])}static rotateZ(t){let e=Math.cos(t),r=Math.sin(t);return new kd([e,r,0,0,-r,e,0,0,0,0,1,0,0,0,0,1])}static rotateAxis(t,e){t=t.normalize();let r=t.x,i=t.y,n=t.z,s=Math.sin(e),a=Math.cos(e);return new kd([r*r*(1-a)+a,r*i*(1-a)+n*s,r*n*(1-a)-i*s,0,r*i*(1-a)-n*s,i*i*(1-a)+a,i*n*(1-a)+r*s,0,r*n*(1-a)+i*s,i*n*(1-a)-r*s,n*n*(1-a)+a,0,0,0,0,1])}static scale(t,e=t,r=t){return new kd([t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1])}static flipX(){return new kd([1,0,0,0,0,-1,0,0,0,0,1,0,0,0,0,1])}static flipY(){return new kd([-1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}static rotateZForPoint(t,e){return t.equals1(S.ORIGIN)?kd.rotateZ(e):kd.translate(-t.x,-t.y,0).rotateZ(e).translate1(t.x,t.y,0)}static getMatrix4(t,e,r,i){let n=Math.cos(e),s=Math.sin(e),a=r*(t.x*n-t.y*s)+i.x,l=t.x*s+t.y*n+i.y,c=[r*n,s,0,0,-s*r,n,0,0,0,0,1,0,a,l,0,1];return new kd(c)}constructor(t=gZe){super(4,4,t)}translate(t){return this.multiply4(kd.translate1(t))}translate1(t,e,r){return this.multiply4(kd.translate(t,e,r))}rotateX(t){return this.multiply4(kd.rotateX(t))}rotateY(t){return this.multiply4(kd.rotateY(t))}rotateZ(t){return this.multiply4(kd.rotateZ(t))}scale(t,e=t,r=t){return this.multiply4(kd.scale(t,e,r))}scale1(t){return this.multiply4(kd.scale(t.x,t.y,t.z))}setOrigin(t,e,r){return kd.translate(-t,-e,-r).multiply4(this).translate1(t,e,r)}setOrigin1(t){return this.setOrigin(t.x,t.y,t.z)}multiply4(t){let e=new Array(16);return PK.mul(4,4,4,this.data,t.data,e),new kd(e)}getInverseMatrix(){let t=super.getInverseMatrix();return new kd(t.data)}getTransposeMatrix(){let t=super.getTransposeMatrix();return new kd(t.data)}inverse(){let t=this.getInverseMatrix();return new kd(t.data)}toMatrix3(){let t=this.data;return new Qe([t[0],t[1],0,t[4],t[5],0,t[12],t[13],1])}};Sge.ORIGIN=new Sge;var Ae=Sge;function NU(o){return k_e.normal(parseFloat(o))}var yZe=[1,0,0,0,1,0,0,0,1],PC=class dm extends PK{static translate(t,e){return new dm([1,0,0,0,1,0,t,e,1])}static translate1(t){return this.translate(t.x,t.y)}static rotate(t){let e=Math.cos(t),r=Math.sin(t);return new dm([e,r,0,-r,e,0,0,0,1])}static rotateD(t){return this.rotate(so.toRadians(t))}static scale(t,e=t){return new dm([t,0,0,0,e,0,0,0,1])}static scale1(t,e){return new dm([t,0,0,0,e,0,0,0,1])}static toDOMMatrix(t){let[e,r,,i,n,,s,a]=t.data;return`matrix(${[e,r,i,n,s,a].join(",")})`}static svgTrasform(t){let e=t.split(" "),r=null;return e.forEach(i=>{i=i.trim();let n=i.trim().replace(")","").split("("),s=n[0],a=n[1].split(",");switch(s){case"translate":let l=NU(a[0]),c=NU(a[1]);r=r?r.translate(l,c):dm.translate(l,c);break;case"rotate":let h=NU(a[0]),u=NU(a[1]),d=NU(a[2]);r=r?r.setOrigin(u,d):dm.translate(u,d),r=r.rotateD(h);break;default:return}}),r}constructor(t=yZe){super(3,3,t);let e=t[0],r=t[3],i=t[1],n=t[4];this.iScale=Math.sqrt(e*e+i*i),this.jScale=Math.sqrt(r*r+n*n)}isMirrored(){return this.det()<0}multiply3(t){let e=new Array(9);return PK.mul(3,3,3,this.data,t.data,e),new dm(e)}translate(t,e){return this.multiply3(dm.translate(t,e))}translate1(t){return this.multiply3(dm.translate1(t))}scale(t,e=t){return this.multiply3(dm.scale(t,e))}scale1(t,e){return this.multiply3(dm.scale1(t,e))}det(){return this.data[0]*this.data[4]-this.data[3]*this.data[1]}invert(){let t=this.getInverseMatrix();return new dm(t.data)}rotateD(t){return this.multiply3(dm.rotateD(t))}rotate(t){return this.multiply3(dm.rotate(t))}resetOffset(){let t=this.data;return new dm([t[0],t[1],0,t[3],t[4],0,0,0,1])}setOrigin(t,e){return dm.translate(-t,-e).multiply3(this).translate(t,e)}setOrigin1(t){return this.setOrigin(t.x,t.y)}getInverseMatrix(){return new dm(super.getInverseMatrix().data)}getTransposeMatrix(){let t=super.getTransposeMatrix();return new dm(t.data)}toMatrix4(){let t=this.data;return new Ae([t[0],t[1],0,t[2],t[3],t[4],0,t[5],0,0,1,0,t[6],t[7],0,t[8]])}scaleNum(t){return!t||isNaN(t)?t:t*this.iScale}};PC.ORIGIN=new PC,PC.MIRROR_Y=new PC([1,0,0,0,-1,0,0,0,1]),PC.MIRROR_X=new PC([-1,0,0,0,1,0,0,0,1]),PC.ROT_90=new PC([0,1,0,-1,0,0,0,0,1]),PC.ROT_N90=new PC([0,-1,0,1,0,0,0,0,1]);var Qe=PC,wr=(o=>(o[o.BUTT=0]="BUTT",o[o.ROUND=1]="ROUND",o[o.SQUARE=2]="SQUARE",o))(wr||{}),ae=(o=>(o[o.CW=0]="CW",o[o.CCW=1]="CCW",o))(ae||{}),rl=class{},ME=class VU{constructor(t,e,r){this.p1=t,this.p2=e,this.p3=r}barycentre(){return VU.barycentre(this.p1,this.p2,this.p3)}incentre(){return VU.incentre(this.p1,this.p2,this.p3)}static barycentre(t,e,r){let i=t.x+e.x+r.x,n=t.y+e.y+r.y;return new S(i/3,n/3)}static incentre(t,e,r){let i=e.sub(r).length(),n=t.sub(r).length(),s=t.sub(e).length(),a=i+n+s,l=i*t.x+n*e.x+s*r.x,c=i*t.y+n*e.y+s*r.y;return new S(l/a,c/a)}area(){return VU.area(this.p1,this.p2,this.p3)}static area(t,e,r){return this.area2(t.x,t.y,e.x,e.y,r.x,r.y)/2}static area2(t,e,r,i,n,s){return Math.abs(dp.crossProd2(t,e,r,i,n,s))}scale(t,e){let r=Qe.translate(-t.x,-t.y).scale(e).translate1(t),i=this.p1.multiply3(r),n=this.p2.multiply3(r),s=this.p3.multiply3(r);return new VU(i,n,s)}scaleOnBarycentre(t){return this.scale(this.barycentre(),t)}scaleOnIncentre(t){return this.scale(this.incentre(),t)}extend(t){let e=this.incentre(),r=this.p1.add(this.p2).sub(e).scale(1/2),i=r.length(),n=S.ORIGIN.pointOnRays2(r,i+t).length()/i;return this.scaleOnIncentre(n)}container(t){let e=this.p3.sub(this.p1),r=this.p2.sub(this.p1),i=t.sub(this.p1),n=e.dot(e),s=e.dot(r),a=e.dot(i),l=r.dot(r),c=r.dot(i),h=1/(n*l-s*s),u=(l*a-s*c)*h;if(u<0||u>1)return!1;let d=(n*c-s*a)*h;return d<0||d>1?!1:u+d<=1}};function iK(){return{minDistance:Number.POSITIVE_INFINITY,start:null,end:null}}var er=class P_{static getMinDistanceWithoutCross(t,e){let r=iK();return P_.minLine(t,e,r),r.minDistance}static getMinDistance(t,e){return G0(t,e)?0:this.getMinDistanceWithoutCross(t,e)}static getMinLineWithCross(t,e){let r=iK();return P_.minLine(t,e,r),new M(r.start,r.end)}static getMinLine(t,e){return P_.intersection(t,e)||this.getMinLineWithCross(t,e)}static getMinDistanceFromPoint(t,e){let r=iK();if(e instanceof M)this.point2LineMinLine(r,e,t);else if(e instanceof q)this.point2ArcMinDistance(t,e,r);else throw new Error("not support");return r.minDistance}constructor(t,e){if(this.pt1=t,this.pt2=e,this.minline=P_.intersection(t,e),this.minline)this.minDistance=0;else{let r=iK();P_.minLine(t,e,r),this.minline=new M(r.start,r.end),this.minDistance=r.minDistance}}getDistance(){return this.minDistance}getLine(){return this.minline}static intersection(t,e){let r=G0(t,e);if(r===0)return;let i=new Array;for(let n=0;n<r;n+=2){let s=new S($e[n],$e[n+1]);i.push(s)}return i.length>1?new M(i[0],i[1]):new M(i[0],i[0])}static minLine(t,e,r){if(t instanceof M&&e instanceof M)return this.minDistanceForLines(t,e,r);if(t instanceof q&&e instanceof M)return this.minDistanceForLineAndArc(t,e,r);if(t instanceof M&&e instanceof q)return this.minDistanceForLineAndArc(e,t,r);if(t instanceof q&&e instanceof q)return this.minDistanceForArcs(t,e,r);throw new Error("not support")}static minDistanceForLines(t,e,r){[t.start(),t.end(),e.start(),e.end()].forEach((i,n)=>{n<2?this.point2LineMinLine(r,e,i):this.point2LineMinLine(r,t,i)})}static minDistanceForLineAndArc(t,e,r){this.point2LineMinLine(r,e,t.start()),this.point2LineMinLine(r,e,t.svgEnd);let i=P_.foot(e,t.center);e.bbox().extendOfSize(1e-8).isContains(i)&&this.point2ArcMinLine(r,t,i),this.point2ArcMinLine(r,t,e.start()),this.point2ArcMinLine(r,t,e.end())}static minDistanceForArcs(t,e,r){this.concentricArc(t,e,r),this.point2ArcMinDistance(e.start(),t,r),this.point2ArcMinDistance(e.svgEnd,t,r),this.point2ArcMinDistance(t.start(),e,r),this.point2ArcMinDistance(t.svgEnd,e,r),(V0(t,e.center)||V0(e,t.center))&&this.shortestLineForArcs(t,e,r)}static minLineForArcAndLine(t,e,r){let i=t.pointOn(r.angleD(t.center)),n=t.pointOn(t.center.angleD(r));this.arcShortestLine(t,e,r,i),this.arcShortestLine(t,e,r,n)}static arcInnerLineFootSegment(t,e,r){let i=r.distance1(t.center);if(i!==0){let n=t.rx*(r.y-t.center.y)/i+t.center.y,s=t.rx*(r.x-t.center.x)/i+t.center.x;i=t.rx-i,i<e.minDistance&&(e.minDistance=i,e.start=new S(s,n),e.end=r)}else i=t.rx-i,i<e.minDistance&&(e.minDistance=i,e.start=t.start(),e.end=r)}static shortestLineForArcs(t,e,r){let i=t.center.angleD(e.center),n=e.center.angleD(t.center),s=t.pointOn(i),a=t.pointOn(n),l=e.pointOn(i),c=e.pointOn(n);V0(t,s)&&(this.arcShortestLine(e,r,s,l),this.arcShortestLine(e,r,s,c)),V0(t,a)&&(this.arcShortestLine(e,r,a,l),this.arcShortestLine(e,r,a,c)),this.shortestLineForArcs1(t,e,r)}static shortestLineForArcs1(t,e,r){let i=e.start().sub(t.center).normalize(),n=e.end().sub(t.center).normalize(),s=t.start().sub(e.center).normalize(),a=t.end().sub(e.center).normalize(),l=t.center.add(i.mul(t.rx)),c=t.center.add(n.mul(t.rx)),h=e.center.add(s.mul(e.rx)),u=e.center.add(a.mul(e.rx));V0(t,l)&&sr.greater(e.start().distance2(t.center),0)&&this.arcShortestLine(t,r,e.start(),l),V0(t,c)&&sr.greater(e.end().distance2(t.center),0)&&this.arcShortestLine(t,r,e.end(),c),V0(e,h)&&sr.greater(t.start().distance2(e.center),0)&&this.arcShortestLine(e,r,t.start(),h),V0(e,u)&&sr.greater(t.end().distance2(e.center),0)&&this.arcShortestLine(e,r,t.end(),u)}static concentricArc(t,e,r){if(!(t.center.distance1(e.center)<1e-5&&t.rx===e.rx&&t.ry===e.ry))return;let i=t.start().distance1(e.svgEnd);i<r.minDistance&&(r.minDistance=i,r.start=t.start(),r.end=e.svgEnd),i=e.start().distance1(t.svgEnd),i<r.minDistance&&(r.minDistance=i,r.start=e.start(),r.end=t.svgEnd)}static point2ArcMinDistance(t,e,r){if(V0(e,t)){let i=e.pointOn(t.angleD(e.center)),n=e.pointOn(e.center.angleD(t));this.arcShortestLine(e,r,t,i),this.arcShortestLine(e,r,t,n)}else this.minLineSegment(r,e.start(),t),this.minLineSegment(r,e.svgEnd,t)}static point2ArcMinLine(t,e,r){if(V0(e,r)){let i=r.distance1(e.center);i>e.rx||i>e.ry?this.minLineForArcAndLine(e,t,r):this.arcInnerLineFootSegment(e,t,r)}}static point2LineMinLine(t,e,r){let i=P_.foot(e,r);e.bbox().extendOfSize(1e-8).isContains(i)?this.minLineSegment(t,i,r):(this.minLineSegment(t,e.start(),r),this.minLineSegment(t,e.end(),r))}static minLineSegment(t,e,r){let i=e.distance1(r);i<t.minDistance&&(t.minDistance=i,t.start=e,t.end=r)}static arcShortestLine(t,e,r,i){if(!V0(t,i))return;let n=r.distance1(i);n<e.minDistance&&(e.minDistance=n,e.start=r,e.end=i)}static foot(t,e){if(t.isPoint())return t.start();if(!sr.eq(t.b,0)&&!sr.eq(t.a,0)){let r=t.start(),i=t.direct,n=(e.x-r.x)*i.x+(e.y-r.y)*i.y;return new S(r.x+i.x*n,r.y+i.y*n)}else return sr.eq(t.b,0)&&!sr.eq(t.a,0)?new S(t.start().x,e.y):!sr.eq(t.b,0)&&sr.eq(t.a,0)?new S(e.x,t.start().y):e}};function V0(o,t){if(sr.eq(o.sweepAngle,360))return!0;let e=so.regularD(t.angleD(o.center));return o.sweepAngle>0?(sr.less(e,o.startAngle)&&(e+=360),sr.greatereq(o.endAngle(),e)):(sr.greater(e,o.startAngle)&&(e-=360),sr.lesseq(o.endAngle(),e))}var bZe=[1,10,100,1e3],c_e="http://www.w3.org/2000/svg",h_e="http://www.w3.org/1999/xlink",u_e="http://www.w3.org/XML/1998/namespace",d_e="https://easyeda.com/",CLt=(function(){var o={svg:c_e,xlink:h_e,xml:u_e,c:d_e};return o[c_e]="svg",o[h_e]="xlink",o[u_e]="xml",o[d_e]="c",o})(),Vp=(function(){var o={RATLINES:9,MODEL3D:19,ALL:11,TOPSILKLAYER:3,TOPLAYER:1,TOPPASTERLAYER:5,TOPSOLDERLAYER:7,LIBBODY:99,PADSURFACE:100,BOARDOUTLINE:10,DOCUMENT:12,TOPASSEMBLY:13,MECHANICAL:15,TOPCOMPONENT:16,SUBSTRATE:18},t;for(t=21;t<53;t++)o["INNER"+(t-20)]=t;for(o.BOTTOMSILKLAYER=4,o.BOTTOMLAYER=2,o.BOTTOMPASTERLAYER=6,o.BOTTOMSOLDERLAYER=8,o.BOTTOMASSEMBLY=14,o.BOTTOMCOMPONENT=17,t=53;t<85;t++)o["BOARD"+(t-52)]=t;return o})(),SLt=(function(){var o={COPPERAREA:[1,2,21,22,23,24],PLANEZONE:[1,2,21,22,23,24],RECT:[1,2,3,4,5,6,7,8,12,13,14,15,21,22,23,24,99],TRACK:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],PAD:[11,1,2],VIA:[11],HOLE:[11],TEXT:[3,4,1,2,7,8,12,13,14,15,21,22,23,24],ARC:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],ELLIPSE:[3,4,12,13,14,15],CIRCLE:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],DIMENSION:[3,4,12,13,14,15],FOOTPRINT:[1,2],SOLIDREGION:[1,2,3,4,5,6,7,8,12,13,14,15,21,22,23,24,11,99,100],SVGNODE:[1,2,3,4,7,8,12,13,14,15],PROTRACTOR:[3,4,12,13,14,15],SHEET:[12,13,14,15]};o["3D"]=(function(){for(var i=[16,19,3,7,5,1],n=21;n<52;n++)i.push(n+32,n);return i.push(2,6,8,4,17),i})();var t,e,r;for(t in o)if(o.hasOwnProperty(t)&&(r=o[t],r.indexOf(21)>0&&r.indexOf(25)===-1))for(e=25;e<=52;e++)r.push(e);return o})(),hm=(function(){var o={1:"TopLayer",2:"BottomLayer",3:"TopSilkLayer",4:"BottomSilkLayer",5:"TopPasteMaskLayer",6:"BottomPasteMaskLayer",7:"TopSolderMaskLayer",8:"BottomSolderMaskLayer",9:"Ratlines",10:"BoardOutLine",11:"Multi-Layer",12:"Document",13:"TopAssembly",14:"BottomAssembly",15:"Mechanical",16:"TopComponents",17:"BottomComponents",18:"Substrate",19:"3DModel",99:"ComponentShapeLayer",100:"LeadShapeLayer"},t;for(t=21;t<53;t++)o[t]="Inner"+(t-20);for(t=53;t<85;t++)o[t]="Substrate"+(t-52);return o})(),ELt=(function(){var o=[],t=[];for(var e in Vp)if(Vp.hasOwnProperty(e)){if(e.match(/^BOARD\d+/))continue;o.push(Vp[e])}o.sort(),t.sort();var r={},i,n={21:"#999966",22:"#008000",23:"#00FF00",24:"#BC8E00",25:"#70DBFA",26:"#00CC66",27:"#9966FF",28:"#800080",29:"#008080",30:"#15935F",31:"#000080",32:"#00B400",33:"#2E4756",34:"#99842F",35:"#FFFFAA",36:"#99842F",37:"#2E4756",38:"#3535FF",39:"#8000BC",40:"#43AE5F",41:"#C3ECCE",42:"#728978",43:"#39503F",44:"#0C715D",45:"#5A8A80",46:"#2B937E",47:"#23999D",48:"#45B4E3",49:"#215DA1",50:"#4564D7",51:"#6969E9",52:"#9069E9"};o.forEach(function(a){switch(a){case Vp.TOPLAYER:i={name:hm[a],color:"#FF0000",darkColor:"#CC0000",visible:!0,active:!0,config:!0};break;case Vp.BOTTOMLAYER:i={name:hm[a],color:"#0000FF",darkColor:"#000080",visible:!0,active:!1,config:!0};break;case Vp.TOPSILKLAYER:i={name:hm[a],color:"#FFCC00",darkColor:"#806600",visible:!0,active:!1,config:!0};break;case Vp.BOTTOMSILKLAYER:i={name:hm[a],color:"#66CC33",darkColor:"#33661A",visible:!0,active:!1,config:!0};break;case Vp.TOPPASTERLAYER:i={name:hm[a],color:"#808080",darkColor:"#666666",visible:!0,active:!1,config:!0};break;case Vp.BOTTOMPASTERLAYER:i={name:hm[a],color:"#800000",darkColor:"#660000",visible:!0,active:!1,config:!0};break;case Vp.TOPSOLDERLAYER:i={name:hm[a],color:"#800080",darkColor:"#660066",visible:!0,active:!1,transparency:.3,config:!0};break;case Vp.BOTTOMSOLDERLAYER:i={name:hm[a],color:"#AA00FF",darkColor:"#8800CC",visible:!0,active:!1,transparency:.3,config:!0};break;case Vp.RATLINES:i={name:hm[a],color:"#6464FF",darkColor:"#5050CC",visible:!1,active:!1,config:!0};break;case Vp.BOARDOUTLINE:i={name:hm[a],color:"#FF00FF",darkColor:"#CC00CC",visible:!0,active:!1,config:!0};break;case Vp.ALL:i={name:hm[a],color:"#C0C0C0",darkColor:"#999999",visible:!0,active:!1,config:!0};break;case Vp.DOCUMENT:i={name:hm[a],color:"#FFFFFF",darkColor:"#CCCCCC",visible:!0,active:!1,config:!0};break;case Vp.TOPASSEMBLY:i={name:hm[a],color:"#33CC99",darkColor:"#33AA99",visible:!1,active:!1,config:!1};break;case Vp.BOTTOMASSEMBLY:i={name:hm[a],color:"#5555FF",darkColor:"#8888FF",visible:!1,active:!1,config:!1};break;case Vp.MECHANICAL:i={name:hm[a],color:"#F022F0",darkColor:"#F088F0",visible:!1,active:!1,config:!1};break;case Vp.MODEL3D:i={name:hm[a],color:"#66CCFF",visible:!1,active:!1,config:!1};break;case Vp.LIBBODY:i={name:hm[a],color:"#00CCCC",visible:!1,active:!1,config:!1};break;case Vp.PADSURFACE:i={name:hm[a],color:"#CC9999",visible:!1,active:!1,config:!1};break;default:a>=Vp.INNER1&&a<=Vp.INNER32?i={name:hm[a],color:n[a],darkColor:s(n[a]),visible:!1,active:!1,config:!1}:i=null;break}i&&(r[a]=i)}),r.Hole={config:!0,name:"Hole",darkColor:"#222222",color:"#222222"},r.DRCError={config:!0,name:"DRCError",color:"#FAD609",darkColor:"#FAD609"};function s(a){if(typeof a!="string"||!a.match(/#?([\da-f]{6})/i))return a;var l=parseInt(RegExp.$1,16),c=.5,h=Math.min(255,Math.round((l>>16)*c)),u=Math.min(255,Math.round((l>>8&255)*c)),d=Math.min(255,Math.round((l&255)*c)),p=((h<<16)+(u<<8)+d).toString(16);return"#"+("00000"+p).substr(-6).toUpperCase()}return r})(),p_e={BLANK:0,SCH:1,PART:2,PCB:3,FOOTPRINT:4,PRJ:5,SUBPART:6,SPICESYMBOL:7,SUBCKT:8,NETLIST:9,WAVEFORM:10,SCHLIB3D:11,PHOTOVIEW:12,SCHMODULE:13,PCBMODULE:14,VIEW3D:15,PCBLIB3D:16,BLOCK_SYMBOL:17,NETFLAG:18,NETPORT:19,SHEET_SYMBOL:20,NONEELEC_SYMBOL:21,SHORT_SYMBOL:22,FOOTPRINTVIEW:23,CNCPRINTVIEW:24,PCB2D:31,PCB3D:32},OLt=(function(){var o={};for(let t in p_e)o[p_e[t]]=t;return o})(),DK=Math.PI*2,TK=Math.PI/2,ALt=Math.sin(Math.PI/180);function PZe(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=bZe[t]||Math.pow(10,t)||10;if(e){var i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(i+o)}else return Math.round(o*r+1e-10)/r}function F_e(o,t,e){var r=o-t;return e||(e=1e-10),(r>0?r:-r)<e}function TZe(o,t,e){var r=h(o)&&h(t)&&h(e);if(!r)return console.warn("Bad arguments"),null;var i=t.x-e.x>0?t.x:e.x,n=t.y-e.y>0?t.y:e.y,s=t.x-e.x>0?e.x:t.x,a=t.y-e.y>0?e.y:t.y,l=o.x,c=o.y;return l<=i+.001&&l>=s-.001&&c<=n+.001&&c>=a-.001;function h(u){return u?(u.x=Number(u.x),u.y=Number(u.y),isNaN(u.x)||isNaN(u.y)?(console.warn("Can not convert to Number, NaN found"),!1):!0):(console.warn("Empty input!"),!1)}}function IZe(o,t,e,r,i,n){var s=(i-e)*(o-e)+(n-r)*(t-r),a=(i-e)*(i-e)+(n-r)*(n-r),l=s/a,c=e+(i-e)*l,h=r+(n-r)*l;return s<=0?Math.sqrt((o-e)*(o-e)+(t-r)*(t-r)):s>=a?Math.sqrt((o-i)*(o-i)+(t-n)*(t-n)):Math.sqrt((o-c)*(o-c)+(h-t)*(h-t))}function CZe(o,t,e){return TZe(o,t,e)?F_e((o.x-t.x)*(e.y-t.y),(e.x-t.x)*(o.y-t.y),.001):!1}var GU=1e-4,$e=new Float64Array(100);function G0(o,t){if(o instanceof M&&t instanceof M)return p9(o,t);if(o instanceof q&&t instanceof M)return Ege(o,t);if(o instanceof M&&t instanceof q)return Ege(t,o);if(o instanceof q&&t instanceof q)return G_e(o,t);if(o instanceof Dr&&t instanceof Dr)return pK(o,t);if(o instanceof Dr&&t instanceof M)return pK(o,new Dr([t.start(),t.end()]));if(o instanceof M&&t instanceof Dr)return pK(new Dr([o.start(),o.end()]),t);if(o instanceof Dr&&t instanceof q)return T_e(t,o);if(o instanceof q&&t instanceof Dr)return T_e(o,t);throw new Error("not supported operation")}function SZe(o,t){let e=o.bbox();if(e.isContainsY1(t)){let r=new M(new S(e.minX-1,t),new S(e.maxX+1,t));return p9(r,o)>0?1:0}else return 0}function EZe(o,t){if(o.rx===o.ry){let e=o.bbox();if(e.isContainsY1(t)){let r=new M(new S(e.minX-1,t),new S(e.maxX+1,t));return IK(o,r)>0?1:0}else return 0}else throw new Error("not supported operation")}function f_e(o,t){let e=o.bbox();return e.isContainsY1(t)&&pK(new Dr([new S(e.minX-1,t),new S(e.maxX+1,t)]),o)>0?1:0}function m_e(o,t,e){return isFinite(t)&&isFinite(e)?o.isContains2(t,e):!1}function OZe(o,t){let e=t.length(),r=dp.crossProd3(t.start(),t.end(),o.start())/e,i=dp.crossProd3(t.start(),t.end(),o.end())/e;return Math.abs(r)<1e-8||Math.abs(i)<1e-8||r*i<0}function p9(o,t){let e=o.bbox().intersection1(t.bbox());if(!e)return 0;if(o.isPoint())if(t.isPoint()){let r=e.center();return $e[0]=r.x,$e[1]=r.y,2}else return g_e(t,o,e);else{if(t.isPoint())return g_e(o,t,e);{let r=function(T,I){e.isContains2(T,I)&&($e[P++]=T,$e[P++]=I)};if(!OZe(o,t))return 0;let i=o.start().x,n=o.start().y,s=o.end().x,a=o.end().y,l=t.start().x,c=t.start().y,h=t.end().x,u=t.end().y,d=t.length(),p=dp.crossProd2(i,n,l,c,h,u)/d,m=dp.crossProd2(s,a,l,c,h,u)/d;if(p*m>0&&!sr.eq(p,0)&&!sr.eq(m,0))return 0;let g=o.length(),y=dp.crossProd2(l,c,i,n,s,a)/g,b=dp.crossProd2(h,u,i,n,s,a)/g;if(y*b>0&&!sr.eq(y,0)&&!sr.eq(b,0))return 0;let P=0;if(sr.eq(p,0)&&sr.eq(m,0)){let T=e.UL(),I=e.UR(),C=e.LL(),E=e.LR();if(sr.eq(e.width(),0))sr.eq(e.height(),0)?($e[P++]=T.x,$e[P++]=T.y):($e[P++]=T.x,$e[P++]=T.y,$e[P++]=C.x,$e[P++]=C.y);else if(sr.eq(e.height(),0))$e[P++]=T.x,$e[P++]=T.y,$e[P++]=I.x,$e[P++]=I.y;else{let O=ME.area2(T.x,T.y,l,c,h,u),_=ME.area2(I.x,I.y,l,c,h,u);O<_?($e[P++]=T.x,$e[P++]=T.y,$e[P++]=E.x,$e[P++]=E.y):($e[P++]=I.x,$e[P++]=I.y,$e[P++]=C.x,$e[P++]=C.y)}}else if(sr.eq(p,0))r(i,n);else if(sr.eq(m,0))r(s,a);else{let T=Math.abs(p/(p-m));r(i+(s-i)*T,n+(a-n)*T)}return P}}}function g_e(o,t,e){let r=t.start(),i=t.end(),n=dp.crossProd3(o.start(),o.end(),t.start()),s=dp.crossProd3(o.start(),o.end(),t.end());if(n*s<0){let a=e.center();return $e[0]=a.x,$e[1]=a.y,2}else if(Math.abs(n)<Math.abs(s)){if(sr.eq(n/o.length(),0))return $e[0]=r.x,$e[1]=r.y,2}else if(sr.eq(s/o.length(),0))return $e[0]=i.x,$e[1]=i.y,2;return 0}function IK(o,t){let e=o.bbox().intersection1(t.bbox());if(e!=null){e=e.extendOfSize(GU);let r=o.center.x,i=o.center.y,n=o.rx,s=o.rx2,a=t.start().x,l=t.start().y,c=t.end().x,h=t.end().y,u=o.center.distance1(t.start()),d=o.center.distance1(t.end()),p=sr.eq(u,n)?0:u>n?1:-1,m=sr.eq(d,n)?0:d>n?1:-1,g=0;if(p===-1&&m===-1)return 0;if(p===0&&m===0)$e[g++]=a,$e[g++]=l,$e[g++]=c,$e[g++]=h;else if(p===1&&m===1){let y=er.foot(t,o.center),b=y.distance1(o.center);if(sr.greater(b,n))return 0;if(sr.eq(b,n))sr.eq(t.distance2(o.start()),0)?($e[g++]=o.start().x,$e[g++]=o.start().y,$e[g++]=o.start().x,$e[g++]=o.start().y):sr.eq(t.distance2(o.end()),0)?($e[g++]=o.end().x,$e[g++]=o.end().y,$e[g++]=o.end().x,$e[g++]=o.end().y):($e[g++]=y.x,$e[g++]=y.y,$e[g++]=y.x,$e[g++]=y.y);else{g=V_e(r,i,a,l,c,h,g,y);let P=$e[g-2],T=$e[g-1];g-=2;let I=dp.distance1(r,i,P,T);if(sr.eq(I,n))$e[g++]=P,$e[g++]=T,$e[g++]=P,$e[g++]=T;else if(I<n)g=gf(s,r,i,a,l,P,T,g),g=gf(s,r,i,P,T,c,h,g);else return 0}}else if(p===-1||m===-1)g=gf(s,r,i,a,l,c,h,g);else{let y=er.foot(t,o.center),b=y.distance1(o.center);if(sr.eq(b,n)){let P=function(C){return m_e(e,C.x,C.y)&&up(o,C)},T=o.start(),I=o.end();if(p===0){let C=t.start();if(P(C))return $e[g++]=C.x,$e[g++]=C.y,$e[g++]=C.x,$e[g++]=C.y,g;if(P(y))return $e[g++]=y.x,$e[g++]=y.y,$e[g++]=y.x,$e[g++]=y.y,g;if(sr.eq(t.distance2(T),0)&&P(T))return $e[g++]=T.x,$e[g++]=T.y,$e[g++]=T.x,$e[g++]=T.y,g;if(sr.eq(t.distance2(I),0)&&P(I))return $e[g++]=I.x,$e[g++]=I.y,$e[g++]=I.x,$e[g++]=I.y,g;if(u<=n)g=gf(s,r,i,y.x,y.y,c,h,g),g===2&&($e[g++]=$e[0],$e[g++]=$e[1]);else if(b<n){if(g=gf(s,r,i,y.x,y.y,c,h,g),g===2&&P(new S($e[0],$e[1])))return $e[g++]=$e[0],$e[g++]=$e[1],g;g=gf(s,r,i,y.x,y.y,a,l,0),g===2&&($e[g++]=$e[0],$e[g++]=$e[1])}}else{let C=t.end();if(P(C))return $e[g++]=C.x,$e[g++]=C.y,$e[g++]=C.x,$e[g++]=C.y,g;if(P(y))return $e[g++]=y.x,$e[g++]=y.y,$e[g++]=y.x,$e[g++]=y.y,g;if(sr.eq(t.distance2(T),0)&&P(T))return $e[g++]=T.x,$e[g++]=T.y,$e[g++]=T.x,$e[g++]=T.y,g;if(sr.eq(t.distance2(I),0)&&P(I))return $e[g++]=I.x,$e[g++]=I.y,$e[g++]=I.x,$e[g++]=I.y,g;if(d<=n)g=gf(s,r,i,y.x,y.y,a,l,g),g===2&&($e[g++]=$e[0],$e[g++]=$e[1]);else if(b<n){if(g=gf(s,r,i,y.x,y.y,a,l,g),g===2&&P(new S($e[0],$e[1])))return $e[g++]=$e[0],$e[g++]=$e[1],g;g=gf(s,r,i,y.x,y.y,c,h,0),g===2&&($e[g++]=$e[0],$e[g++]=$e[1])}}}else if(p===0){let P=t.start();$e[g++]=P.x,$e[g++]=P.y,(a-y.x)*(c-y.x)+(l-y.y)*(h-y.y)<0&&(g=gf(s,r,i,y.x,y.y,c,h,g))}else{let P=t.end();$e[g++]=P.x,$e[g++]=P.y,(a-y.x)*(c-y.x)+(l-y.y)*(h-y.y)<0&&(g=gf(s,r,i,y.x,y.y,a,l,g))}}if(g>0){let y=0;for(let b=0;b<g;b+=2){let P=$e[b],T=$e[b+1];isFinite(P)&&isFinite(T)&&m_e(e,P,T)&&up(o,new S(P,T))&&($e[y++]=P,$e[y++]=T)}return y}else return 0}else return 0}function AZe(o,t){if(o.bbox()){let e=o.center.x,r=o.center.y,i=o.rx2,n=t.start().x,s=t.start().y,a=t.end().x,l=t.end().y,c=o.center.distance2(t.start()),h=o.center.distance2(t.end()),u=sr.eq(c,i)?0:c>i?1:-1,d=sr.eq(h,i)?0:h>i?1:-1,p=0;if(u===-1&&d===-1)return 0;if(u===0&&d===0)$e[p++]=n,$e[p++]=s,$e[p++]=a,$e[p++]=l;else if(u===1&&d===1){let m=er.foot(t,o.center),g=m.distance2(o.center);if(sr.greater(g,i))return 0;if(sr.eq(g,i)){let y=m.distance2(o.start()),b=m.distance2(o.end());sr.eq(y,0)?($e[p++]=o.start().x,$e[p++]=o.start().y):sr.eq(b,0)?($e[p++]=o.end().x,$e[p++]=o.end().y):($e[p++]=m.x,$e[p++]=m.y)}else{p=V_e(e,r,n,s,a,l,p,m);let y=$e[p-2],b=$e[p-1],P=dp.distance2(e,r,y,b);if(p-=2,sr.eq(P,i))$e[p++]=y,$e[p++]=b;else if(P<i)p=gf(i,e,r,n,s,y,b,p),p=gf(i,e,r,y,b,a,l,p);else return 0}}else if(u===-1||d===-1)p=gf(i,e,r,n,s,a,l,p);else{let m=er.foot(t,o.center);u===0?($e[p++]=t.start().x,$e[p++]=t.start().y,sr.neq(m.distance2(t.start()),0)&&(n-m.x)*(a-m.x)+(s-m.y)*(l-m.y)<0&&(p=gf(i,e,r,m.x,m.y,a,l,p))):($e[p++]=t.end().x,$e[p++]=t.end().y,sr.neq(m.distance2(t.end()),0)&&(n-m.x)*(a-m.x)+(s-m.y)*(l-m.y)<0&&(p=gf(i,e,r,m.x,m.y,n,s,p)))}if(p>0){let m=0;for(let g=0;g<p;g+=2){let y=$e[g],b=$e[g+1];isFinite(y)&&isFinite(b)&&($e[m++]=y,$e[m++]=b)}return m}else return 0}else return 0}function gf(o,t,e,r,i,n,s,a){if(i==s){let P=o-(i-e)*(i-e);if(sr.greater(P,0)){let T=Math.sqrt(P),I=t-T,C=t+T,E=Math.min(r,n),O=Math.max(r,n);return I>=E&&I<=O&&($e[a++]=I,$e[a++]=i),C>=E&&C<=O&&($e[a++]=C,$e[a++]=i),a}}let l=dp.distance2(r,i,t,e)-o;if(l===0)return $e[a++]=r,$e[a++]=i,a;let c=dp.distance2(n,s,t,e)-o;if(c===0)return $e[a++]=n,$e[a++]=s,a;if(l<0&&c<0)return l>c?sr.eq(l,0)&&($e[a++]=r,$e[a++]=i):sr.eq(c,0)&&($e[a++]=n,$e[a++]=s),a;if(l>0&&c>0&&(r-t)*(n-t)+(i-e)*(s-e)>0)return l<c?sr.eq(l,0)&&($e[a++]=r,$e[a++]=i):sr.eq(c,0)&&($e[a++]=n,$e[a++]=s),a;let h=r,u=i,d=n,p=s,m=NaN,g=NaN,y=Number.POSITIVE_INFINITY,b=0;for(;y!==0;){b++;let P=Math.max(Math.min(Math.abs(l)/(Math.abs(l)+Math.abs(c)),.75),.25);if(m=h+(d-h)*P,g=u+(p-u)*P,h===m&&u===g||d===m&&p===g){Math.abs(l)>Math.abs(c)?(m=d,g=p,y=c):(m=h,g=u,y=l);break}else y=dp.distance2(m,g,t,e)-o,(y<0?l>c:l<c)?(d=m,p=g,c=y):(h=m,u=g,l=y)}return $e[a++]=m,$e[a++]=g,a}function V_e(o,t,e,r,i,n,s,a){let l=dp.dotProd2(e,r,i,n,o,t),c=dp.dotProd2(i,n,e,r,o,t);if(l>=0)return $e[s++]=i,$e[s++]=n,s;if(c>=0)return $e[s++]=e,$e[s++]=r,s;if(dp.crossProd2(e,r,i,n,o,t)==0)return $e[s++]=o,$e[s++]=t,s;{let h=NaN,u=NaN,d=e,p=r,m=i,g=n,y=dp.distance2(e,r,o,t),b=dp.distance2(i,n,o,t),P=Number.POSITIVE_INFINITY,T=0;for(;P>0&&(T++,h=d+(m-d)*.5,u=p+(g-p)*.5,!(y==b||d==h&&p==u||m==h&&g==u));){P=dp.distance2(h,u,o,t);let I=dp.dotProd2(d,p,h,u,o,t);if(I==0)break;I<0?(m=h,g=u,b=P):(d=h,p=u,y=P)}return dp.distance2(h,u,o,t)<dp.distance2(a.x,a.y,o,t)?($e[s++]=h,$e[s++]=u):($e[s++]=a.x,$e[s++]=a.y),s}}function Ege(o,t){if(o.rx===o.ry)return IK(o,t);throw new Error("not supported")}function _Ze(o,t){if(o.rx===o.ry)return AZe(o,t);throw new Error("not supported")}function G_e(o,t){if(o.bbox().intersection1(t.bbox())!=null){if(o.rx===o.ry&&t.rx===t.ry)return vZe(o,t);throw new Error("not supported operation")}return 0}function vZe(o,t){let e=o.center.x,r=o.center.y,i=t.center.x,n=t.center.y,s=o.rx,a=t.rx,l=o.rx2,c=t.rx2,h=o.center.distance1(t.center),u=Math.abs(s-a),d=s+a;if(sr.greater(h,d)||sr.less(h,u))return 0;if(sr.eq(u+h,0)){let p=0,m;return up(o,t.start())&&($e[p]=t.start().x,$e[p+1]=t.start().y,p+=2,m=t.start()),up(o,t.end())&&($e[p]=t.end().x,$e[p+1]=t.end().y,p+=2,m=t.end()),p===0?(up(t,o.start())&&($e[p]=o.start().x,$e[p+1]=o.start().y,p+=2),up(t,o.end())&&($e[p]=o.end().x,$e[p+1]=o.end().y,p+=2)):p===2&&(!m.equals1(o.start())&&up(t,o.start())&&($e[p]=o.start().x,$e[p+1]=o.start().y,p+=2),!m.equals1(o.end())&&up(t,o.end())&&($e[p]=o.end().x,$e[p+1]=o.end().y,p+=2)),p}else if(sr.eq(h,d)){if(y_e(o,t))return 4;let p=new M(o.center,t.center),m=IK(t,p);return m=b_e(o,m),m!==0?m:(m=IK(o,p),b_e(t,m))}else if(sr.eq(h,u)){if(y_e(o,t))return 4;if(s>a){let p=(s-a)/s;return $e[0]=e+(i-e)/p,$e[1]=r+(n-r)/p,P_e(o,t,2)}else{let p=(a-s)/a;return $e[0]=i+(e-i)/p,$e[1]=n+(r-n)/p,P_e(o,t,2)}}else{let p,m;if(o.rx>t.rx){let x=(o.center.distance2(t.center)-l+c)/(h*2)/h;p=(e-i)*x+i,m=(r-n)*x+n}else{let x=(o.center.distance2(t.center)-c+l)/(h*2)/h;p=(i-e)*x+e,m=(n-r)*x+r}let g=i-e,y=n-r,b=Math.max(s,a)*2,P,T,I,C;if(Math.abs(g)<Math.abs(y)){let x=g/-y,v=m-x*p;P=p-b,T=x*P+v,I=p+b,C=x*I+v}else{let x=y/-g,v=p-x*m;T=m-b,P=x*T+v,C=m+b,I=x*C+v}let E;if(o.rx>t.rx?(E=gf(c,i,n,P,T,p,m,0),E=gf(c,i,n,p,m,I,C,E)):(E=gf(l,e,r,P,T,p,m,0),E=gf(l,e,r,p,m,I,C,E)),E!==4)throw new Error("cnt !== 4");let O=new S($e[0],$e[1]),_=new S($e[2],$e[3]);if(up(o,O)&&up(t,O))return up(o,_)&&up(t,_)?4:b_(o.start(),t,_,O)?($e[2]=o.start().x,$e[3]=o.start().y,4):b_(o.end(),t,_,O)?($e[2]=o.end().x,$e[3]=o.end().y,4):b_(t.start(),o,_,O)?($e[2]=t.start().x,$e[3]=t.start().y,4):b_(t.end(),o,_,O)?($e[2]=t.end().x,$e[3]=t.end().y,4):2;if(up(o,_)&&up(t,_))return b_(o.start(),t,O,_)?($e[0]=o.start().x,$e[1]=o.start().y,4):b_(o.end(),t,O,_)?($e[0]=o.end().x,$e[1]=o.end().y,4):b_(t.start(),o,O,_)?($e[0]=t.start().x,$e[1]=t.start().y,4):b_(t.end(),o,O,_)?($e[0]=t.end().x,$e[1]=t.end().y,4):($e[0]=$e[2],$e[1]=$e[3],2);{let x=function(F,H){if(sr.eq(F.distance1(H.center),H.rx)&&up(H,F)){if(F.distance2(O)<F.distance2(_)){if(v)return;v=!0}else{if(D)return;D=!0}$e[w++]=F.x,$e[w++]=F.y}},v=!1,D=!1,w=0;return x(o.start(),t),x(o.end(),t),x(t.start(),o),x(t.end(),o),w}}}function b_(o,t,e,r){return sr.eq(o.distance1(t.center),t.rx)&&up(t,o)&&o.distance2(e)<o.distance2(r)}function y_e(o,t){return sr.eq(t.start().distance1(o.center),o.rx)&&up(o,t.start())?($e[0]=t.start().x,$e[1]=t.start().y,$e[2]=t.start().x,$e[3]=t.start().y,!0):sr.eq(t.end().distance1(o.center),o.rx)&&up(o,t.end())?($e[0]=t.end().x,$e[1]=t.end().y,$e[2]=t.end().x,$e[3]=t.end().y,!0):sr.eq(o.start().distance1(t.center),t.rx)&&up(t,o.start())?($e[0]=o.start().x,$e[1]=o.start().y,$e[2]=o.start().x,$e[3]=o.start().y,!0):sr.eq(o.end().distance1(t.center),t.rx)&&up(t,o.end())?($e[0]=o.end().x,$e[1]=o.end().y,$e[2]=o.end().x,$e[3]=o.end().y,!0):!1}function b_e(o,t){if(t===0)return 0;let e=$e[0],r=$e[1];return up(o,new S(e,r))?($e[0]=e,$e[1]=r,$e[2]=e,$e[3]=r,4):0}function P_e(o,t,e){if(e===0)return 0;let r=$e[0],i=$e[1],n=new S(r,i);return up(o,n)&&up(t,n)?($e[0]=r,$e[1]=i,$e[2]=r,$e[3]=i,4):0}function i7(o,t){return Math.abs(o-t)<=1e-6}function up(o,t){let e=o.bbox();if(t.x-e.minX>-GU&&t.x-e.maxX<GU&&t.y-e.minY>-GU&&t.y-e.maxY<GU){let r=so.regularD(t.angleD(o.center));return i7(r,o.startAngle)||i7(r,o.startAngle+360)||i7(r,o.startAngle-360)||i7(r,o.endAngle())||i7(r,o.endAngle()+360)||i7(r,o.endAngle()-360)?!0:o.sweepAngle>0?(sr.less(r,o.startAngle)&&(r+=360),sr.greatereq(o.endAngle(),r)):(sr.greater(r,o.startAngle)&&(r-=360),sr.lesseq(o.endAngle(),r))}else return!1}function xZe(o,t){let e=o[1].x-o[0].x,r=o[1].y-o[0].y,i=t[1].x-t[0].x,n=t[1].y-t[0].y;if(e===0&&i!==0||e!==0&&i===0)return!1;if(e===0&&i===0)return!0;let s=r/e,a=n/i;return F_e(s,a,Math.sin(Math.PI/180))}function RZe(o,t,e){var r,i=+t.x,n=+t.y,s=+e.x,a=+e.y,l=+o.x,c=+o.y,h=s-i,u=a-n,d=l-i,p=c-n,m,g,y,b,P,T;return h===0&&u===0?{d:Math.sqrt(d*d+p*p),point:new S(i,n)}:(r=(d*h+p*u)/(h*h+u*u),r<0?{d:Math.sqrt(d*d+p*p),point:new S(i,n)}:r>1?(m=l-s,g=c-a,{d:Math.sqrt(m*m+g*g),point:new S(s,a)}):(P=i+r*h,T=n+r*u,y=l-P,b=c-T,{d:Math.sqrt(y*y+b*b),point:new S(P,T)}))}function CC(o,t){if(!o||!t||o.length!=t.length)return!1;let e="equals1";return!o.some((r,i)=>{let n=t[i],s=!1;return r&&n&&typeof r=="object"&&typeof n=="object"?typeof r[e]=="function"&&wZe(r,n)?s=!r[e].call(r,n):s=!(r===n||r.toString()===n.toString()):typeof r=="number"&&typeof n=="number"?s=!(DZe(r,n)||Number.isNaN(r)&&Number.isNaN(n)):s=r!==n,s})}function DZe(o,t,e=5){return Math.abs(o-t)*Math.pow(10,e)<1}function wZe(o,t){return!o||!t||typeof o!="object"||typeof t!="object"?o===t:o.constructor===t.constructor}var Vs=new Float64Array(100);function pK(o,t){if(o.bbox().extendOfSize(sr.eps).isSeparated(t.bbox()))return 0;let e=[[o,t]],r=(o.controls.length-1)*(t.controls.length-1)*8,i=0,n=Number.POSITIVE_INFINITY;for(;e.length!==0;){let s=function(V){D=Math.min(D,V),w=Math.max(w,V)},a=function(V,W){let L=p9(V,W);if(L===0)throw new Error("cnt === 0");for(let k=0;k<L;k+=2)s($e[k])};if(i>r){for(let V=i-2;V>=2;V-=2)for(let W=V-2;W>=0;W-=2)if(sr.eq(Vs[V],Vs[W])&&sr.eq(Vs[V+1],Vs[W+1])){Vs[W]=(Vs[V]+Vs[W])/2,Vs[W+1]=(Vs[V+1]+Vs[W+1])/2;for(let L=i-3;L>=V;L--)Vs[L]=Vs[L+2];i-=2;break}if(i>r){i=0;let V=t.start(),W=new Float64Array(8);o.getPercent(V)!==null&&(W[i++]=V.x,W[i++]=V.y);let L=t.end();o.getPercent(L)!==null&&(W[i++]=L.x,W[i++]=L.y);let k=o.start();t.getPercent(k)!==null&&(W[i++]=k.x,W[i++]=k.y);let N=o.end();return t.getPercent(N)!==null&&(W[i++]=N.x,W[i++]=N.y),$e.set(W),i}}let[l,c]=e.pop(),h=l.controls,u=c.controls;if(h.length===2&&u.length===2){let V=p9(new M(h[0],h[1]),new M(u[0],u[1]));for(let W=0;W<V;W++)Vs[i++]=$e[W];continue}let d=h[0],p=h[h.length-1];d.equals1(p)&&(p=d.add1(1,0));let m=p.y-d.y,g=d.x-p.x,y=-m*d.x-g*d.y,b=Math.sqrt(1/(m**2+g**2));m*=b,g*=b,y*=b;let P=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY;if(h.forEach(V=>{let W=m*V.x+g*V.y+y;W<P&&(P=W),W>T&&(T=W)}),sr.eq(P,T)){if(c.controls.length===2){let V=p9(new M(l.start(),l.end()),new M(c.start(),c.end()));for(let W=0;W<V;W++)Vs[i++]=$e[W];if(V!==0)continue}l=new Dr([h[0],h[h.length-1]]),h=l.controls}let I=u.map(V=>{let W=m*V.x+g*V.y+y,L=Math.abs(W);return L<n&&(n=L),W}),C=0;for(let V of I){if(sr.less(V,P))C=C|1;else if(sr.greater(V,T))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let E=0,O=0,_=p.x-d.x,x=p.y-d.y,v=Math.sqrt(1/(_**2+x**2));_*=v,x*=v;for(let V=1;V<h.length;V++){let W=h[V],L=(W.x-d.x)*_+(W.y-d.y)*x;L<E?E=L:L>O&&(O=L)}C=0;for(let V of u){let W=(V.x-d.x)*_+(V.y-d.y)*x;if(sr.less(W,E))C=C|1;else if(sr.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let D=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY;n/=2,n<=sr.eps&&(n=sr.eps),P-=n,T+=n,I.forEach((V,W)=>{V>=P&&V<=T&&s(W/(I.length-1))});let F=new M(new S(0,P),new S(1,P)),H=new M(new S(0,T),new S(1,T));for(let V=0;V<I.length-1;V++){let W=new S(V/(I.length-1),I[V]),L=W.y<P?1:W.y>T?2:3;for(let k=0;k<I.length;k++){let N=new S(k/(I.length-1),I[k]),U=N.y<P?1:N.y>T?2:3;L!==U&&(L===1?U===2?(a(new M(W,N),F),a(new M(W,N),H)):a(new M(W,N),F):L===2?U===1?(a(new M(W,N),F),a(new M(W,N),H)):a(new M(W,N),H):U===1?a(new M(W,N),F):a(new M(W,N),H))}}D!==0&&(c=c.clip(D)[1]),w!==1&&(c=c.clip((w-D)/(1-D))[0]);let z=c.bbox();if(sr.eq(z.minX,z.maxX)&&sr.eq(z.minY,z.maxY)){C=0;for(let V of c.controls){let W=(V.x-d.x)*_+(V.y-d.y)*x;if(sr.less(W,E))C=C|1;else if(sr.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C===3){let V=new S((z.minX+z.maxX)/2,(z.minY+z.maxY)/2);l.getPercent(V)&&(Vs[i++]=V.x,Vs[i++]=V.y)}continue}if(w-D>.8){let[V,W]=c.clip(.5);e.push([V,l]),e.push([W,l])}else e.push([c,l])}for(let s=0;s<i;s++)$e[s]=Vs[s];return i}function LZe(o,t){if(o.bbox().extendOfSize(sr.eps).isSeparated(t.bbox()))return{cnt:0};let e=[[o,t]],r=(o.controls.length-1)*(t.controls.length-1)*8,i=0,n=Number.POSITIVE_INFINITY;for(;e.length!==0;){let s=function(V){D=Math.min(D,V),w=Math.max(w,V)},a=function(V,W){let L=p9(V,W);if(L===0)throw new Error("cnt === 0");for(let k=0;k<L;k+=2)s($e[k])};if(i>r){for(let V=i-2;V>=2;V-=2)for(let W=V-2;W>=0;W-=2)if(sr.eq(Vs[V],Vs[W])&&sr.eq(Vs[V+1],Vs[W+1])){Vs[W]=(Vs[V]+Vs[W])/2,Vs[W+1]=(Vs[V+1]+Vs[W+1])/2;for(let L=i-3;L>=V;L--)Vs[L]=Vs[L+2];i-=2;break}if(i>r){i=0;let V=new Float64Array(8),W=t.end(),L=0;o.getPercent(W)!==null&&(V[i++]=W.x,V[i++]=W.y,L=2);let k=o.end();return t.getPercent(k)!==null&&(V[i++]=k.x,V[i++]=k.y,L=L===0?1:3),$e.set(V),{havOverlap:L,cnt:i}}}let[l,c]=e.pop(),h=l.controls,u=c.controls;if(h.length===2&&u.length===2){let V=p9(new M(h[0],h[1]),new M(u[0],u[1]));for(let W=0;W<V;W++)Vs[i++]=$e[W];continue}let d=h[0],p=h[h.length-1];d.equals1(p)&&(p=d.add1(1,0));let m=p.y-d.y,g=d.x-p.x,y=-m*d.x-g*d.y,b=Math.sqrt(1/(m**2+g**2));m*=b,g*=b,y*=b;let P=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY;if(h.forEach(V=>{let W=m*V.x+g*V.y+y;W<P&&(P=W),W>T&&(T=W)}),sr.eq(P,T)){if(c.controls.length===2){let V=p9(new M(l.start(),l.end()),new M(c.start(),c.end()));for(let W=0;W<V;W++)Vs[i++]=$e[W];if(V!==0)continue}l=new Dr([h[0],h[h.length-1]]),h=l.controls}let I=u.map(V=>{let W=m*V.x+g*V.y+y,L=Math.abs(W);return L<n&&(n=L),W}),C=0;for(let V of I){if(sr.less(V,P))C=C|1;else if(sr.greater(V,T))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let E=0,O=0,_=p.x-d.x,x=p.y-d.y,v=Math.sqrt(1/(_**2+x**2));_*=v,x*=v;for(let V=1;V<h.length;V++){let W=h[V],L=(W.x-d.x)*_+(W.y-d.y)*x;L<E?E=L:L>O&&(O=L)}C=0;for(let V of u){let W=(V.x-d.x)*_+(V.y-d.y)*x;if(sr.less(W,E))C=C|1;else if(sr.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let D=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY;n/=2,n<=sr.eps&&(n=sr.eps),P-=n,T+=n,I.forEach((V,W)=>{V>=P&&V<=T&&s(W/(I.length-1))});let F=new M(new S(0,P),new S(1,P)),H=new M(new S(0,T),new S(1,T));for(let V=0;V<I.length-1;V++){let W=new S(V/(I.length-1),I[V]),L=W.y<P?1:W.y>T?2:3;for(let k=0;k<I.length;k++){let N=new S(k/(I.length-1),I[k]),U=N.y<P?1:N.y>T?2:3;L!==U&&(L===1?U===2?(a(new M(W,N),F),a(new M(W,N),H)):a(new M(W,N),F):L===2?U===1?(a(new M(W,N),F),a(new M(W,N),H)):a(new M(W,N),H):U===1?a(new M(W,N),F):a(new M(W,N),H))}}D!==0&&(c=c.clip(D)[1]),w!==1&&(c=c.clip((w-D)/(1-D))[0]);let z=c.bbox();if(sr.eq(z.minX,z.maxX)&&sr.eq(z.minY,z.maxY)){C=0;for(let V of c.controls){let W=(V.x-d.x)*_+(V.y-d.y)*x;if(sr.less(W,E))C=C|1;else if(sr.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C===3){let V=new S((z.minX+z.maxX)/2,(z.minY+z.maxY)/2);l.getPercent(V)&&(Vs[i++]=V.x,Vs[i++]=V.y)}continue}if(w-D>.8){let[V,W]=c.clip(.5);e.push([V,l]),e.push([W,l])}else e.push([c,l])}for(let s=0;s<i;s++)$e[s]=Vs[s];return{cnt:i}}var MZe=class{constructor(o=sr.eps){this.eps=o}eq(o,t){return Math.abs(o-t)<=this.eps}setEps(o){this.eps=o}},kU=new MZe;function T_e(o,t){if(o.bbox().extendOfSize(sr.eps).isSeparated(t.bbox()))return 0;let e=[[o,t]],r=(t.controls.length-1)*16,i=0;for(;e.length!==0;){if(i>r){let s=function(){for(let c=0;c<i;c+=2)for(let h=c+2;h<i;h+=2)if(!(kU.eq(Vs[c],Vs[h])&&kU.eq(Vs[c+1],Vs[h+1]))){l(Vs[h],Vs[h+1],a);break}function l(c,h,u){let d=!1;for(let p=0;p<u.length;p+=2)if(kU.eq(c,u[p])&&kU.eq(h,u[p+1])){d=!0;break}d||u.push(c,h)}},a=[Vs[0],Vs[1]];if(s(),a.length>=100&&(kU.setEps(.001),a=[Vs[0],Vs[1]],s(),a.length>=100))throw new Error("clearSamePoint()");i=a.length,a.forEach((l,c)=>Vs[c]=l)}let n=e.pop();if(n[0]instanceof q){let s=function(H){x=Math.min(x,H),v=Math.max(v,H)},a=function(H,z){let V=p9(H,z);if(V===0)throw new Error("cnt === 0");for(let W=0;W<V;W+=2)s($e[W])},[l,c]=n,h=c.controls;if(h.length===2){let H=Ege(l,new M(h[0],h[1]));for(let z=0;z<H;z++)Vs[i++]=$e[z];continue}let u=Number.POSITIVE_INFINITY,d=Number.NEGATIVE_INFINITY,p,m,g,y,b;if(Math.abs(l.sweepAngle)>359){let H=l.rx;p=l.center.add1(H,0),m=l.center.add1(-H,0),u=-H,d=H,g=0,y=1,b=-l.center.y}else{p=l.start(),m=l.end(),g=m.y-p.y,y=p.x-m.x,b=-g*p.x-y*p.y;let H=Math.sqrt(1/(g**2+y**2));g*=H,y*=H,b*=H;let z=g*l.center.x+y*l.center.y+b;l.isCCW?(d=l.rx+z,u=0):(u=z-l.rx,d=0)}let P=h.map(H=>g*H.x+y*H.y+b),T=0;for(let H of P){if(sr.less(H,u))T=T|1;else if(sr.greater(H,d))T=T|2;else{T=3;break}if(T===3)break}if(T!==3)continue;let I=0,C=0,E=m.x-p.x,O=m.y-p.y,_=Math.sqrt(1/(E**2+O**2));if(E*=_,O*=_,Math.abs(l.sweepAngle)<=180)I=0,C=(m.x-p.x)*E+(m.y-p.y)*O;else throw new Error("not support");T=0;for(let H of h){let z=(H.x-p.x)*E+(H.y-p.y)*O;if(sr.less(z,I))T=T|1;else if(sr.greater(z,C))T=T|2;else{T=3;break}if(T===3)break}if(T!==3)continue;let x=Number.POSITIVE_INFINITY,v=Number.NEGATIVE_INFINITY;u-=sr.eps,d+=sr.eps,P.forEach((H,z)=>{H>=u&&H<=d&&s(z/(P.length-1))});let D=new M(new S(0,u),new S(1,u)),w=new M(new S(0,d),new S(1,d));for(let H=0;H<P.length-1;H++){let z=new S(H/(P.length-1),P[H]),V=z.y<u?1:z.y>d?2:3;for(let W=0;W<P.length;W++){let L=new S(W/(P.length-1),P[W]),k=L.y<u?1:L.y>d?2:3;V!==k&&(V===1?k===2?(a(new M(z,L),D),a(new M(z,L),w)):a(new M(z,L),D):V===2?k===1?(a(new M(z,L),D),a(new M(z,L),w)):a(new M(z,L),w):k===1?a(new M(z,L),D):a(new M(z,L),w))}}x!==0&&(c=c.clip(x)[1]),v!==1&&(c=c.clip((v-x)/(1-x))[0]);let F=c.bbox();if(sr.eq(F.minX,F.maxX)&&sr.eq(F.minY,F.maxY)){T=0;for(let H of c.controls){let z=(H.x-p.x)*E+(H.y-p.y)*O;if(sr.less(z,I))T=T|1;else if(sr.greater(z,C))T=T|2;else{T=3;break}if(T===3)break}T===3&&(Vs[i++]=(F.minX+F.maxX)/2,Vs[i++]=(F.minY+F.maxY)/2);continue}v-x>.8?c.clip(.5).forEach(H=>e.push([H,l])):e.push([c,l])}else{let[s,a]=n;e.push([q.build3(a.center,a.startAngle,a.sweepAngle/2,a.rx,a.ry),s]),e.push([q.build3(a.center,a.startAngle+a.sweepAngle/2,a.sweepAngle/2,a.rx,a.ry),s])}}for(let n=0;n<i;n++)$e[n]=Vs[n];return i}var NZe=class{static getSweep(o){if(o.length>2){let t=0,e=o.length;for(let n=0;n<e-1;n++){let s=o[n],a=o[n+1];t+=(a.x+s.x)*(a.y-s.y)}let r=o[0],i=o[e-1];return t+=(r.x+i.x)*(r.y-i.y),t>0}else throw new Error("Unable to determine the direction of rotation!")}static isClose(o){return!!(o.primitives.length>0&&o.primitives[0].start().equals1(o.primitives[o.primitives.length-1].end()))}};function kZe(o){let t=o.primitives,e=t[0],r=e instanceof q?e.sweepAngle%360:null;if(t.length===1&&e instanceof q&&(sr.eq(r,0)||sr.eq(Math.abs(r),360)))return!!e.isCCW;let i=new Array;return o.points(.1,n=>{i.push(n)}),NZe.getSweep(i)}var BZe=class{static zoomCorner(o,t){let e=new Array,r=new Array,i=new Array;return this.getPanPrimitive(o,e,i,t),this.rearrange(e,i),this.processStart(e,i),this.getResult(e,i,r,t),r.length>0?ge.build2(r):null}static zoomPolygon(o,t){let e=new Array,r=new Array,i=new Array;return kZe(o)&&(o=o.reverse().asClose()),this.getPanPrimitive(o,e,i,t),this.rearrange(e,i),this.processStart(e,i),this.getResult(e,i,r,t),r.length>0?ge.build2(r):null}static zoomLines(o,t){return this.zoomPolygon(ge.build2(o.primitives.concat(o.reverse().primitives)),t/2)}static getPanPrimitive(o,t,e,r){let i=o.primitives;for(let n of i){let s=this.panDistance(n,r);s!==void 0&&(t.push(s),e.push(n))}}static rearrange(o,t){let e=o.length,r=0;for(let s=0;s<e;s++){let a=t[s],l=o[s],c=s==e-1?o[0]:o[s+1];if(!(l instanceof q&&c instanceof q)&&!this.isCW(l.end(),c.start(),a.end())){if(G0(l,c)!=0){r=s==e-1?0:s+1;break}}else{r=s;break}}let i=this.start4Index(t,r),n=this.start4Index(o,r);t.length=0,o.length=0,i.forEach(s=>{t.push(s)}),n.forEach(s=>{o.push(s)})}static processStart(o,t){let e=o.length;if(e>2){let r=o[e-1],i=o[0],n=t[e-1];if(!(r instanceof q&&i instanceof q)&&!this.isCW(r.end(),i.start(),n.end())){let s=G0(r,i);for(let a=0;a<s;a+=2){let l=new S($e[a],$e[a+1]);o[e-1]=this.generatePrimitive(r,r.start(),l),o[0]=this.generatePrimitive(i,l,i.end())}}}}static getResult(o,t,e,r){let i=o.length;for(let n=0;n<i;n++){let s=t[n],a=n===i-1?t[0]:t[n+1],l=n==i-1?0:n+1,c=l==i-1?t[0]:t[l+1],h=o[n],u=n==i-1?o[0]:o[n+1],d=l==i-1?o[0]:o[l+1];if(!(h instanceof q&&u instanceof q)&&!this.isCW(h.end(),u.start(),s.end())){let m=this.add(o,e,n,h,u,0);m=this.update(o,e,n,u,m);let g=this.generateArc(a,c,u,d,r);if(m=this.add(o,e,n,h,g,m),m=this.update(o,e,n,g,m),m>0)continue}e.push(h);let p=this.generateArc(s,a,h,u,r);p!==void 0&&e.push(p)}}static generateArc(o,t,e,r,i){if(i>0){let n=o.end(),s=t.start(),a=e.end(),l=r.start();if(a.distance2(l)>1e-8)if(n.equals(s)){let c=a.angleD(n),h=l.angleD(n);return q.build2(n,c,h,i,i,0)}else{let c=a.angleD(n),h=l.angleD(n),u=a.angleD(s),d=l.angleD(s),p=q.build2(n,c,h,i,i,0),m=q.build2(s,u,d,i,i,0);return p.pointOn(p.endAngle()).equals1(l)?p:m.pointOn(m.endAngle()).equals1(l)?m:p}}}static updateNews(o,t,e,r){let i=o.length,n=t==i-1?0:t+1;o[n]=this.generatePrimitive(e,r,e.end())}static add(o,t,e,r,i,n){if(n>0)return n;if(r!=null&&i!=null){let s=G0(r,i);for(let a=0;a<s;a+=2){let l=new S($e[a],$e[a+1]);t.push(this.generatePrimitive(r,r.start(),l)),this.updateNews(o,e,i,l);break}return s}else return 0}static update(o,t,e,r,i){if(i>0)return i;let n=t.length;if(n>0&&r!=null){let s=t[n-1],a=G0(s,r);for(let l=0;l<a;l+=2){let c=new S($e[l],$e[l+1]);t[n-1]=this.generatePrimitive(s,s.start(),c),this.updateNews(o,e,r,c)}return a}else return 0}static generatePrimitive(o,t,e){if(o instanceof M)return new M(t,e);if(o instanceof q){let r=o,i=t.angleD(r.center),n=e.angleD(r.center);return q.build2(r.center,i,n,r.rx,r.ry,r.sweep())}else throw new Error("not supported operation")}static start4Index(o,t){let e=o.length,r=new Array;for(let i=t;i<e;i++)r.push(o[i]);for(let i=0;i<t;i++)r.push(o[i]);return r}static isCW(o,t,e){let r=new M(e,o),i=new M(e,t),n=r.end().x-r.start().x,s=r.end().y-r.start().y,a=i.end().x-i.start().x,l=i.end().y-i.start().y;return!(n*l-s*a>0)}static panDistance(o,t){if(o instanceof M){if(o.isPoint())return;{let e=o.panDistance(t);return e.length()>1e-5?e:void 0}}else if(o instanceof q){let e=o;if(e.sweepAngle>0){if(e.rx-t<=0||e.ry-t<=0)return}else if(e.sweepAngle<0&&(e.rx+t<=0||e.ry+t<=0))return;return e=e.panDistance(t),e.start().distance1(e.end())>1e-5||sr.eq(Math.abs(e.sweepAngle),360)?e:void 0}else throw new Error("not supported operation")}},Zn=.001,Fg=Zn**2;function rn(o,t){return o.distance2(t)<Fg}function f9(o,t){return Math.abs(o-t)<=1e-4}function FZe(o,t){if(o instanceof M)return new M(o.start(),t);if(o instanceof q){let e=t.angleD(o.center);return f9(so.regularD(o.startAngle),so.regularD(e))?q.build3(o.center,o.startAngle,0,o.rx,o.ry):q.build2(o.center,o.startAngle,e,o.rx,o.ry,o.isCCW?1:0)}else{if(o instanceof Dr)return o.clip(o.getPercent(t,Zn))[0];throw new Error("not supported operation")}}function SC(o,t=so.toRadians(o.startAngle)){return o.isCCW?t+=TK:t-=TK,new S(Math.cos(t),Math.sin(t))}function KU(o,t=0){let e=o.controls;if(t===0){let r=e[0],i=e.slice(1).find(n=>!(n.x===r.x&&n.y===r.y));if(!i)throw Error("getTangentBezier(bezier: Bezier, t: number = 0)");return i.sub(r)}else if(t===1){let r=e[e.length-1],i=e.slice(0,-1).reverse().find(n=>!(n.x===r.x&&n.y===r.y));if(!i)throw Error("getTangentBezier(bezier: Bezier, t: number = 0)");return r.sub(i)}if(e.length===3){let[r,i,n]=e;return i.sub(r).mul(2*(1-t)).add(n.sub(i).mul(2*t)).normalize()}else{let[r,i,n,s]=e;return i.sub(r).mul(3*(1-t)**2).add(n.sub(i).mul(6*(1-t)*t)).add(s.sub(n).mul(3*t**2)).normalize()}}function m7(o,t,e){let r=o.slice(1).findIndex(n=>!(n.x===t.x&&n.y===t.y)),i=o[r+1];if(e&&(e.getPercent(i,Zn)!==null||new M(e.start(),e.end()).distance(i)<=Zn)&&(i=o[r+2]),!i)throw Error("getSecondPoint(controls: readonly Vector2[])");return i}function Kn(o,t){if(o instanceof M)return o.end().sub(o.start()).normalize();if(o instanceof q)return(t?SC(o,t.angle(o.center)):SC(o)).normalize();if(o instanceof Dr)if(o.controls.length===2){let[e,r]=o.controls;if(rn(e,r))throw Error("equalsPP(p0, p1)");return r.sub(e).normalize()}else return(t?KU(o,o.getPercent(t,Zn)):KU(o)).normalize();else throw new Error("not support")}function VZe(o,t,e){let r=[],i=t**2-4*o*e;if(i>=0){let n=-t/(2*o),s=Math.sqrt(i)/(2*o),a=n+s;if(r.push(a),i>0){let l=n-s;r.push(l)}}return r}function GZe(o,t,e,r,i=0,n=1){let s=[],a=o*Math.pow(i,3)+t*Math.pow(i,2)+e*i+r,l=o*Math.pow(n,3)+t*Math.pow(n,2)+e*n+r,c,h;if(a*l<0)for(;Math.abs(i-n)>Zn;)if(c=(i+n)/2,h=o*Math.pow(c,3)+t*Math.pow(c,2)+e*c+r,Math.abs(h)<Zn){s.push(c);break}else a*h<0?n=c:l*h<0&&(i=c);else a*l===0&&(a===0&&s.push(i),l===0&&s.push(n));return s}function nge(o,t,e){if(o instanceof M||t.distance2(e)<=Fg)return new M(t,e);if(o instanceof q)return q.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.isCCW?1:0);if(o instanceof Dr){let r=o.getPercent(t,Zn),i=o.getPercent(e,Zn);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}function Oge(o){return sr.greater(o,0)&&sr.less(o,1)}function CK(o,t,e,r){let i=o[r]-2*t[r]+e[r],n=t[r]-o[r];if(i===0)return[];let s=-n/i,a=[];return Oge(s)&&a.push(s),a}function SK(o,t,e,r,i){let n,s,a=-o[i]+3*t[i]-3*e[i]+r[i],l=2*(o[i]-2*t[i]+e[i]),c=t[i]-o[i],h=l**2-4*a*c;if(sr.lesseq(h,0))n=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY;else{let d=Math.sqrt(h);n=(-l-d)/(2*a),s=(-l+d)/(2*a);let p=a*2;if(sr.lesseq(n,1)&&sr.greatereq(n,0)){let m=Number.NEGATIVE_INFINITY;for(;sr.neq(n,m);){m=n;let g=p*n+l;n=-(a*n**2+l*n+c-g*n)/g}}if(sr.lesseq(s,1)&&sr.greatereq(s,0)){let m=Number.NEGATIVE_INFINITY;for(;sr.neq(s,m);){m=s;let g=p*s+l;s=-(a*s**2+l*s+c-g*s)/g}}}let u=[];return Oge(s)&&u.push(s),Oge(n)&&u.push(n),u}function U_e(o,t){if(o.controls.length===2){let[a,l]=o.controls;rn(a,l)||t.push(new M(a,l));return}let e,r;if(o.controls.length===3){let[a,l,c]=o.controls;e=CK(a,l,c,"x"),r=CK(a,l,c,"y")}else{let[a,l,c,h]=o.controls;e=SK(a,l,c,h,"x"),r=SK(a,l,c,h,"y")}e.sort((a,l)=>l-a),r.sort((a,l)=>l-a);let i=e.pop()||1,n=r.pop()||1,s=0;for(;i!==1||n!==1;)if(sr.eq(i,n))i=e.pop()||1,n=r.pop()||1;else if(i<n){let[a,l]=o.clip((i-s)/(1-s));s=i,t.push(a),o=l,i=e.pop()||1}else{let[a,l]=o.clip((n-s)/(1-s));s=n,t.push(a),o=l,n=r.pop()||1}t.push(o)}var UZe=1e-5,Bge=1,Dr=class F1 extends rl{constructor(t){if(super(),this._startToEndL=null,t.length<2)throw new Error("Bezier needs at least 2 endpoints");this.controls=t.slice()}get startToEndL(){return this._startToEndL===null&&(this._startToEndL=new M(this.start(),this.end())),this._startToEndL}build1(t){let e=[];return g7(t,(r,i)=>(e.push(i),!0)),new F1(e)}start(){return this.controls[0]}end(){return this.controls[this.controls.length-1]}static pointOn(t,e){if(e.length<1)throw new Error("bezier must have at least 1 point");if(e.length===1)return e[0];{let r=new Array(e.length-1);for(let i=1;i<e.length;i++){let n=e[i-1],s=e[i],a=(s.x-n.x)*t,l=(s.y-n.y)*t;r[i-1]=n.add1(a,l)}return F1.pointOn(t,r)}}clip1(t,e,r,i){if(r.push(e[0]),i.push(e[e.length-1]),e.length<2)throw new Error("bezier clip must have at least 2 point");if(e.length===2){let n=e[0],s=e[1],a=(s.x-n.x)*t,l=(s.y-n.y)*t,c=n.add1(a,l);r.push(c),i.push(c)}else{let n=new Array(e.length-1);for(let s=1;s<e.length;s++){let a=e[s-1],l=e[s],c=(l.x-a.x)*t,h=(l.y-a.y)*t;n[s-1]=a.add1(c,h)}this.clip1(t,n,r,i)}}clip(t){let e=[],r=[];return this.clip1(t,this.controls,e,r),[new F1(e),new F1(r.reverse())]}greater(t,e,r){return t-e>r}less(t,e,r){return t-e<-r}eq(t,e,r){return Math.abs(t-e)<=r}eqPP(t,e,r){return!t||!e?!1:this.eq(t.x,e.x,r)&&this.eq(t.y,e.y,r)}isInRange(t,e=sr.eps){let r=this.controls.map(n=>n.y-t.y),i=0;for(let n of r){if(this.less(n,0,e))i=i|1;else if(this.greater(n,0,e))i=i|2;else{i=3;break}if(i===3)break}if(i!==3)return!1;i=0;for(let n of this.controls){let s=n.x-t.x;if(this.less(s,0,e))i=i|1;else if(this.greater(s,0,e))i=i|2;else{i=3;break}if(i===3)break}return i===3}getPercent(t,e=sr.eps){if(!this.isInRange(t,e))return null;let r=Number.POSITIVE_INFINITY,i=[[this,0,1]];for(;i.length!==0;){let n=function(y){h=Math.min(h,y),u=Math.max(u,y)},s=function(y,b){let P=p9(y,b);if(P===0)throw new Error("cnt === 0");for(let T=0;T<P;T+=2)n($e[T])},[a,l,c]=i.pop();if(this.eqPP(a.start(),t,e))return l;if(this.eqPP(a.end(),t,e))return c;let h=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,d=a.controls.map(y=>y.y-t.y);r=d.reduce((y,b)=>{let P=Math.abs(b);return P<y?P:y},r),r/=2,r<=e&&(r=e),d.forEach((y,b)=>{this.eq(y,0,e)&&n(b/(d.length-1))});let p=new M(new S(0,-r),new S(1,-r)),m=new M(new S(0,r),new S(1,r));for(let y=0;y<d.length-1;y++){let b=new S(y/(d.length-1),d[y]),P=this.less(b.y,0,e)?1:this.greater(b.y,0,e)?2:3;for(let T=0;T<d.length;T++){let I=new S(T/(d.length-1),d[T]),C=this.less(I.y,0,e)?1:this.greater(I.y,0,e)?2:3;P!==C&&(P===1?C===2?(s(new M(b,I),p),s(new M(b,I),m)):s(new M(b,I),p):P===2?C===1?(s(new M(b,I),p),s(new M(b,I),m)):s(new M(b,I),m):C===1?s(new M(b,I),p):s(new M(b,I),m))}}if(!isFinite(h)){if(Math.max(...d.map(y=>Math.abs(y)))<e*4)return(l+c)/2;continue}if(h!==0&&(a=a.clip(h)[1],l=(c-l)*h+l),u!==1){let y=(u-h)/(1-h);a=a.clip(y)[0],c=(c-l)*y+l}if(!a.isInRange(t,e))continue;let g=a.controls.reduce((y,b)=>y.ext2(b),new _e).build1();if(this.eq(g.minX,g.maxX,e)&&this.eq(g.minY,g.maxY,e))return(l+c)/2;if(u-h>.8){let[y,b]=a.clip(.5);y.isInRange(t,e)?(i.push([y,l,(l+c)/2]),b.isInRange(t,e)&&i.push([b,(l+c)/2,c])):i.push([b,(l+c)/2,c])}else i.push([a,l,c])}return null}toBezier(){return this}toString(){return"Bezier ["+this.controls.join(" ")+"]"}bbox(){return this._bbox||(this._bbox=new _e().ext3(this.points(.1)).build1()),this._bbox}bboxWithControls(){return this._bbox_controls||(this._bbox_controls=new _e().ext3(this.controls).build()),this._bbox_controls}multiply3(t){let e=new Array(this.controls.length);for(let r=0;r<this.controls.length;r++){let i=this.controls[r];e[r]=i.multiply3(t)}return new F1(e)}stroke(t,e,r,i=Bge){let n=BZe.zoomLines(ge.build4(this.points(i)),t);return r===0?n:n.reverse()}points(t){let e=[];return this.getBezierPoints(t,r=>e.push(r)),e}getBezierPoints(t,e){if(this.controls.length===2){e(this.start()),e(this.end());return}let r=[this];for(e(this.start());r.length!==0;){let n=r.pop(),s=new M(n.start(),n.end());if(i(n.controls,s)<=t)e(n.end());else{let[a,l]=n.clip(.5);r.push(l,a)}}function i(n,s){let a=s.start(),l=s.end();a.equals1(l)&&(l=a.add1(1,0));let c=l.y-a.y,h=a.x-l.x,u=-c*a.x-h*a.y,d=Math.sqrt(1/(c**2+h**2));c*=d,h*=d,u*=d;let p=n.map(m=>Math.abs(c*m.x+h*m.y+u));return Math.max(...p)}}getBezierPoints3(t,e){if(this.controls.length===2){e(this.start()),e(this.end());return}let r=t*t,i=this.controls[0],n=.5;for(;n>UZe&&!(i.distance2(F1.pointOn(n,this.controls))<=r);n*=.5);let s=Math.ceil(1/n);n=1/s,e(i);let a=0;for(let l=1;l<s;l++)a+=n,e(F1.pointOn(a,this.controls));e(this.end())}getPointsBySlope(t){if(this.controls.length===4)return this.getPointsBySlope4(t);throw new Error("Currently, only 4 control points are supported!")}getPointsBySlope4(t){let[e,r,i,n]=this.controls,s=-3*e.x+9*r.x-9*i.x+3*n.x,a=6*e.x-12*r.x+6*i.x,l=-3*e.x+3*r.x,c=[];if(Number.isFinite(t)){let h=-3*e.y+9*r.y-9*i.y+3*n.y,u=6*e.y-12*r.y+6*i.y,d=-3*e.y+3*r.y,p=h-s*t,m=u-a*t,g=d-l*t,y=-m/(2*p),b=Math.sqrt(m**2-4*p*g)/(2*p),P=y+b;P>=0&&P<=1&&c.push(F1.pointOn(P,this.controls));let T=y-b;T>=0&&T<=1&&c.push(F1.pointOn(T,this.controls))}else{let h=-a/(2*s),u=Math.sqrt(a**2-4*s*l)/(2*s),d=h+u;d>=0&&d<=1&&c.push(F1.pointOn(d,this.controls));let p=h-u;p>=0&&p<=1&&c.push(F1.pointOn(p,this.controls))}return c}buildConverxHull(t=sr.eps){let e=[...this.controls],r=[],i=e[0],n=1;do{let s=e[n%e.length];this.eqPP(i,s,t)||r.push(new M(i,s)),i=s,n++}while(i!==e[0]);if(r.length===0)throw Error("buildConverxHull(diff = DoubleKit.eps)");return ge.build7(r).asClose()}getExtremePoints(t){if(!t)return s(this.controls);let e=t.start(),r=t.end(),i=r.x-e.x,n=r.y-e.y;if(Math.abs(i)<=sr.eps||Math.abs(n)<=sr.eps)return s(this.controls);{let a=n/i;if(this.controls.length===3){e.equals1(r)&&(r=e.add1(1,0));let l=r.y-e.y,c=e.x-r.x,h=-l*e.x-c*e.y,u=Math.sqrt(1/(l**2+c**2));l*=u,c*=u,h*=u;let d=this.controls.map(g=>l*g.x+c*g.y+h),p=d[0]-2*d[1]+d[2],m=d[1]-d[0]-a/2;if(p!==0){let g=-m/p;if(sr.greater(g,0)&&sr.less(g,1))return[F1.pointOn(g,this.controls)]}}else if(this.controls.length===4)return this.getPointsBySlope(a)}return[];function s(a){let l,c;if(a.length===3){let[p,m,g]=a;l=CK(p,m,g,"x"),c=CK(p,m,g,"y")}else if(a.length===4){let[p,m,g,y]=a;l=SK(p,m,g,y,"x"),c=SK(p,m,g,y,"y")}l.sort((p,m)=>m-p),c.sort((p,m)=>m-p);let h=l.pop()||1,u=c.pop()||1,d=[];for(;h!==1||u!==1;)sr.eq(h,u)?(h=l.pop()||1,u=c.pop()||1):h<u?(d.push(F1.pointOn(h,a)),h=l.pop()||1):(d.push(F1.pointOn(u,a)),u=c.pop()||1);return d}}getToLineMaxDis2(t){let e=this.getExtremePoints(t),r=t.distance2(this.start()),i=t.distance2(this.end()),n=Math.max(r,i);return e.forEach(a=>s(t.distance2(a))),n;function s(a){n=Math.max(n,a)}}getToLineMinAndMaxDis_Controls(t){let e=t.start(),r=t.end();t.start().equals1(t.end())&&(r=e.add1(1,0));let i=r.y-e.y,n=e.x-r.x,s=-i*e.x-n*e.y,a=Math.sqrt(1/(i**2+n**2));i*=a,n*=a,s*=a;let l=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY;return this.controls.forEach(h=>{let u=i*h.x+n*h.y+s;u<l&&(l=u),u>c&&(c=u)}),{minDis:l,maxDis:c}}getPercentInLine(t){let e=[],r=[],i=this.controls,n=t.start(),s=t.end(),a=s.y-n.y,l=n.x-s.x,c=-a*n.x-l*n.y,h=Math.sqrt(1/(a**2+l**2));if(a*=h,l*=h,c*=h,a**2+l**2<=0)return e;if(i.length===3){let[u,d,p]=i,m=a*(u.x-2*d.x+p.x)+l*(u.y-2*d.y+p.y),g=2*(a*(d.x-u.x)+l*(d.y-u.y)),y=a*u.x+l*u.y+c;r=VZe(m,g,y)}else if(i.length===4){let[u,d,p,m]=i,g=m.sub(p.mul(3)).add(d.mul(3)).sub(u),y=u.sub(d.mul(2)).add(p).mul(3),b=d.sub(u).mul(3),P=u,T=a*g.x+l*g.y,I=a*y.x+l*y.y,C=a*b.x+l*b.y,E=a*P.x+l*P.y+c,O=Math.sqrt(1/(T**2+I**2));T*=O,I*=O,C*=O,E*=O,r=GZe(T,I,C,E)}else throw Error("not support getBeizerPointInLine");return r.forEach(u=>{u>=0&&u<=1&&e.push(u)}),e}reverse(){return new F1(this.controls.slice().reverse())}},H_e=class UU{constructor(){this.textCache=new Map,this.numCache=new Array(20),this.boxCache=new Array(4),this.textOffsetCache=new Array(9),this.BuildLineCache=new Array(7),this.BuildTrackCache=new Array(7),this.BuildViaCache=new Array(11),this.BuildBoxCache=new Array(10),this.BuildArcCache=new Array(10),this.BuildArcTrackCache=new Array(10),this.BuildTextCache=new Array(7),this.BuildPadStyleCache=new Array(4),this.BuildPadCache=new Array(12),this.ARRAY1=new Array(1),this.ARRAY2=new Array(2),this.ARRAY3=new Array(3),this.ARRAY4=new Array(4),this.ARRAY5=new Array(5),this.ARRAY6=new Array(6),this.ARRAY7=new Array(7),this.ARRAY8=new Array(8),this.ARRAY9=new Array(9),this.ARRAY10=new Array(10),this.ARRAY11=new Array(11),this.ARRAY12=new Array(12),this.textOffsetCache[0]=S.ORIGIN,this.textOffsetCache[1]=new S(0,-.5),this.textOffsetCache[2]=new S(0,-1),this.textOffsetCache[3]=new S(-.5,0),this.textOffsetCache[4]=new S(-.5,-.5),this.textOffsetCache[5]=new S(-.5,-1),this.textOffsetCache[6]=new S(-1,0),this.textOffsetCache[7]=new S(-1,-.5),this.textOffsetCache[8]=new S(-1,-1)}static getCache(){return UU.instance==null&&(UU.instance=new UU),UU.instance}};H_e.instance=null;var W_e=H_e,M=class sw extends rl{constructor(t,e){super(),this._start=t,this._end=e}get a(){return this._a==null&&(this._start.equals1(this._end)?(this._a=NaN,this._b=NaN,this._c=NaN):(this._a=this._end.y-this._start.y,this._b=this._start.x-this._end.x,this._c=this._end.x*this._start.y-this._start.x*this._end.y)),this._a}get b(){return this._b==null&&(this._start.equals1(this._end)?(this._a=NaN,this._b=NaN,this._c=NaN):(this._a=this._end.y-this._start.y,this._b=this._start.x-this._end.x,this._c=this._end.x*this._start.y-this._start.x*this._end.y)),this._b}get c(){return this._c==null&&(this._start.equals1(this._end)?(this._a=NaN,this._b=NaN,this._c=NaN):(this._a=this._end.y-this._start.y,this._b=this._start.x-this._end.x,this._c=this._end.x*this._start.y-this._start.x*this._end.y)),this._c}get hashed(){return this._hashed==null&&(this._hashed=this._hashCode()),this._hashed}get direct(){return this._direct==null&&(this._direct=this._end.sub(this._start).normalize()),this._direct}cutLine(t){if(sr.eq(this.distance(t),0)){let e=new sw(this._start,t);return e._a=this._a,e._b=this._b,e._c=this._c,e}return new sw(this._start,t)}get midPoint(){return this._start.add(this._end).mul(.5)}toBezier(){return new Dr([this._start,this._end])}_hashCode(){let t=31,e=1;return e=t*e+this._start.hashCode(),e=t*e+this._end.hashCode(),e}start(){return this._start}end(){return this._end}center(){let t=this.start(),e=this.end();return t.add(e).mul(.5)}panDistance(t){let e=this._end.x-this._start.x,r=this._end.y-this._start.y,i=this.length();e=e*t/i,r=-r*t/i;let n=new S(this._start.x+r,this._start.y+e),s=new S(this._end.x+r,this._end.y+e);return new sw(n,s)}isPoint(){return this._start.distance2(this._end)<=1e-8}length(){return this._start.distance1(this._end)}toString(){return"Line [start="+this._start+", end="+this._end+"]"}bbox(){if(this.__bbox==null){let t=W_e.getCache().boxCache;t[0]=Math.min(this._start.x,this._end.x),t[1]=Math.max(this._start.x,this._end.x),t[2]=Math.min(this._start.y,this._end.y),t[3]=Math.max(this._start.y,this._end.y),this.__bbox=new ht(t[0],t[1],t[2],t[3])}return this.__bbox}multiply3(t){return new sw(this._start.multiply3(t),this._end.multiply3(t))}hashCode(){return this.hashed}equals(t){let e=t;return this.hashed===e.hashed&&this._start.equals(e._start)&&this._end.equals(e._end)}equals1(t){let e=t;return this.hashed===e.hashed&&this._start.equals1(e._start)&&this._end.equals1(e._end)}equals2(t){let e=[this.start(),this.end()],r=[t.start(),t.end()];return CC(e,r)||CC(e,r.reverse())}stroke(t,e,r){let i,n,s;this._end.x<this._start.x?(n=this._start.x-this._end.x,s=this._start.y-this._end.y,i=this._end):(n=this._end.x-this._start.x,s=this._end.y-this._start.y,i=this._start);let a=Math.sqrt(n*n+s*s),l=t/2,c,h,u;e===2?(h=-l,u=a+l):(h=0,u=a),e===0||e===2?r===0?c=ge.build5([h,-l,h,l,u,l,u,-l]):c=ge.build5([h,l,h,-l,u,-l,u,l]):r===0?c=ge.build2([q.build3(new S(h,0),-90,-180,l,l),q.build3(new S(u,0),90,-180,l,l)]):c=ge.build2([q.build3(new S(h,0),90,180,l,l),q.build3(new S(u,0),-90,180,l,l)]);let d=Math.atan2(s,n),p=Qe.rotate(d).translate1(i);return c.asClose().multiply3(p)}points(t){return[this._start,this._end]}mirrorY(t){return new sw(this.start().mirrorY(t),this.end().mirrorY(t))}reverse(){return new sw(this._end,this._start)}inArea(t,e,r){let i=t.x,n=t.y,s=this._start,a=this._end,l=r==1,c=i-s.x,h=n-s.y,u=i-a.x,d=n-a.y,p=a.x-s.x,m=a.y-s.y,g=new S(-m,p).normalize(),y=p+g.x*e/2,b=m+g.y*e/2,P=y*y+b*b,T=c*c+h*h,I=u*u+d*d,C=Math.abs(c*m-h*p)/2,E=Math.sqrt(p*p+m*m)*e/4;if(C<=E&&T<=P&&I<=P){if(l)return!0;{let O=new S(i,n).sub(a).normalize(),_=new S(i,n).sub(s).normalize(),x=new S(g.x,g.y).cross(O),v=new S(g.x,g.y).cross(_);return x>=0&&v<=0}}else if(l){let O=e/2;return T<=O*O?!0:I<=O*O}else return!1}isParallel(t,e=!1){let r=sr.eq(Math.abs(this.direct.cross(t.direct)),0),i=!e||sr.greatereq(this.direct.dot(t.direct),0);return r&&i}distance2(t){return(this.a*t.x+this.b*t.y+this.c)**2/(this.a**2+this.b**2)}distance2ForPP(t){let{x:e,y:r}=t,{x:i,y:n}=this.start(),{x:s,y:a}=this.end();return((e-i)*(a-n)-(r-n)*(s-i))**2/((a-n)**2+(s-i)**2)}distance(t){return Math.abs(this.a*t.x+this.b*t.y+this.c)/Math.sqrt(this.a**2+this.b**2)}};function HZe(o,t=.05){if(o.length<3)return o.slice();let e=o.slice(0,1),r=(n,s,a)=>IZe(n.x,n.y,s.x,s.y,a.x,a.y);for(;;){e=o.slice(0,1);for(let n=1;n<o.length-1;n+=2)r(o[n],o[n-1],o[n+1])>t&&e.push(o[n]),e.push(o[n+1]);if(e.at(-1).equals1(o.at(-1))||e.push(o.at(-1)),o.length==e.length)break;o=e}let i=o[o.length-1];return e.push(i),e}var WZe=aZe(lZe());function pp(o){if(o instanceof M)o=new M(o.end(),o.start());else if(o instanceof q)o=o.exchangeSweep();else if(o instanceof Dr)o=new Dr(o.controls.slice().reverse());else throw new Error("bug");return o}function z_e(o){if(o.length>2){let t=o[0],e=new Array;e.push(t);for(let r=1,i=o.length;r<i;r++){let n=o[r],s=!1;if(r+1<i){let a=n.sub(t).normalize(),l=o[r+1].sub(t).normalize(),c=a.cross(l);Math.abs(c)<.01&&(s=!0)}s||(e.push(n),t=n)}return e}else return o}var zZe=class{constructor(){this.fac=new _e,this.length=0,this.box=null,this.pt=null,this.i=0}calcBBox(o){for(this.fac.clear(),this.length=o.length,this.box=null,this.pt=null,this.i=0;this.i<this.length;this.i++)this.pt=o[this.i],this.box=this.pt.bbox(),this.fac.ext1(this.box);return this.fac.build1()}},YZe=new zZe,ge=class hp{constructor(t,e){this.primitives=t,this.__bbox=e}static calcBBox(t){return YZe.calcBBox(t)}static build1(t){let e=[],r=null;return bK(t,(i,n)=>{let s=n.start();return r!==null&&!s.equals(r)&&e.push(new M(r,s)),e.push(n),r=n.end(),!0}),e.length===0&&r!=null&&e.push(new M(r,r)),new hp(e)}static build2(t){return hp.build1(Cge(t))}static build3(t){let e=[],r=null;return bK(t,(i,n)=>(r!==null&&e.push(new M(r,n)),r=n,!0)),new hp(e)}static build4(t){return this.build3(Cge(t))}static build5(t){let e=[];for(let r=0;r<t.length;r+=2)e.push(new S(t[r],t[r+1]));return this.build4(e)}static build6(t){return hp.build4([t.LL(),t.LR(),t.UR(),t.UL(),t.LL()])}static build7(t){return new hp(t)}static build8(t){let e=new S(t[0],t[1]),r,i=[],n,s=(a,l)=>a.length==l&&a.every(c=>typeof c=="number");for(let a=2;a<t.length;)switch(typeof t[a]=="string"?n=t[a]:a-=1,n){case"ARC":{let l=t.slice(a+1,a+4);if(!s(l,3))throw new Error("invalid rawData");let c=l[0];r=new S(l[1],l[2]),i.push(q.build5(e,r,c)),e=r,a+=4;break}case"L":{let l=t.slice(a+1,a+3);if(!s(l,2))throw new Error("invalid rawData");r=new S(l[0],l[1]),i.push(new M(e,r)),e=r,a+=3;break}case"C":{let l=t.slice(a+1,a+7);if(!s(l,7))throw new Error("invalid rawData");let c=new S(l[0],l[1]),h=new S(l[2],l[3]);r=new S(l[4],l[5]),i.push(new Dr([e,c,h,r])),e=r,a+=7;break}default:throw new Error("invalid rawData")}return hp.build2(i)}static buildBBox(t,e=0){return e===1?hp.build5([t.minX,t.minY,t.maxX,t.minY,t.maxX,t.maxY,t.minX,t.maxY,t.minX,t.minY]):hp.build5([t.minX,t.minY,t.minX,t.maxY,t.maxX,t.maxY,t.maxX,t.minY,t.minX,t.minY])}static triangulate(t,e,r=1,i=!1){let n=i?(h,u)=>{h.points(r,u)}:(h,u)=>{h.points2(r,u)};if(t.length===1){let h=new Array;n(t[0].asClose(),m=>h.push(m));let u,d=h[0],p=[];for(let m=0;m<h.length-2;m+=2){let g=h[m+1],y=h[m+2],b=g.sub(d).normalize().cross(y.sub(d).normalize());if(sr.neq(b,0)){if(u===!0){if(b<0){p.length=0;break}}else if(u===!1){if(b>0){p.length=0;break}}else u=b>0;p.push(d),p.push(g),p.push(y)}h.push(d),d=y}if(p.length!==0){for(let m=0;m<p.length;m+=3)e(p[m],p[m+1],p[m+2]);return}}let s=[],a=[];t.forEach(h=>{s.length!==0&&a.push(s.length/2),n(h.asClose(),u=>s.push(u.x,u.y))});let l=WZe.default(s,a),c=[];for(let h=1;h<s.length;h+=2)c.push(new S(s[h-1],s[h]));for(let h=0;h<l.length;h+=3)e(c[l[h]],c[l[h+1]],c[l[h+2]])}lines(t,e){let r=new Array;this.points(t,n=>r.push(n));let i=r[0];for(let n=1;n<r.length;n++){let s=r[n];e(i),e(s),i=s}}triangles(t,e,r=!1){hp.triangulate([this],(...i)=>{i.forEach(n=>e(n))},t,r)}mirror(){let t=[];return this.primitives.forEach(e=>{if(e instanceof M)e=new M(e.start().mirror(),e.end().mirror());else if(e instanceof q)e=e.mirror();else if(e instanceof Dr){let r=e.controls.map(i=>i.mirror());e=new Dr(r)}else throw new Error("bug");t.push(e)}),new hp(t,this.__bbox)}getPoints(t){let e=[];for(let r of this.primitives)for(let i of r.points(t))e.push(i);return e}round(t=4){let e=this.primitives.slice();for(let r=0;r<e.length;r++){let i=e[r];if(i instanceof M){let n=i.start().round(t),s=i.end().round(t);e[r]=new M(n,s)}else if(i instanceof Dr){let n=i.controls.map(s=>s.round(t));e[r]=new Dr(n)}else if(i instanceof q){let n=i.start().round(t),s=i.end().round(t),a=i.sweepAngle;e[r]=q.build5(n,s,a)}}return new hp(e,this.__bbox)}simplify(t=.05){let e=[],r=!1,i=[],n=this.closed();if(this.primitives.length<=1)return hp.build2(this.primitives);let s=()=>{if(i.length>2){let l=HZe(i,t);for(let c=1;c<l.length;c++)e.push(new M(l[c-1],l[c]))}else e.push(new M(i[0],i[1]));i.length=0,r=!1};for(let l=0;l<this.primitives.length;l++){let c=this.primitives[l];c instanceof M?(r?i.push(c.end()):(i.length=0,i.push(c.start(),c.end()),r=!0),l===this.primitives.length-1&&s()):(r&&s(),e.push(c))}let a=new hp(e,this.__bbox);return n&&!a.closed()&&(a=a.asClose()),a}hasBackLine(){let{primitives:t}=this,e;for(let r=0;r<t.length;r++){let i=t[r];if(i instanceof M){if(i.end().equals1(i.start()))continue;if(e&&(i.end().equals1(e.start())||CZe(i.end(),e.start(),e.end())))return!0;e=i}else e=null}return!1}area(t=.1){let e=0,r=this.end();return this.primitives.forEach(i=>{let n=i.start(),s=i.end();if(e+=(n.x+r.x)*(n.y-r.y),i instanceof M)e+=(s.x+n.x)*(s.y-n.y);else if(i instanceof q)e+=(s.x+n.x)*(s.y-n.y),e+=Math.PI*i.rx2*i.sweepAngle/180-S.normal(i.center,i.start(),i.end());else if(i instanceof Dr){let a=n;i.points(t).forEach(l=>{e+=(l.x+a.x)*(l.y-a.y),a=l}),e+=(s.x+a.x)*(s.y-a.y)}r=s}),e/2}closed(t){return this.primitives.length===0?!1:this.start().equals(this.end(),t)}asClose(){let t=this.primitives[0],e=this.primitives[this.primitives.length-1],r=t.start(),i=e.end();if(r.equals(i))return this;{let n=new Array;return kg.addAll(n,this.primitives),n.push(new M(i,r)),hp.build2(n)}}closeEndpoint(){let t=this.primitives[0],e=this.primitives[this.primitives.length-1],r=t.start(),i=e.end();if(r.equals1(i))return this;{let n=new Array;return kg.addAll(n,this.primitives),n.push(new M(i,r)),new hp(n)}}reverse(){let t=new Array(this.primitives.length);for(let e=0,r=this.primitives.length-1;r>=0;e++,r--){let i=this.primitives[r];if(i instanceof M)i=new M(i.end(),i.start());else if(i instanceof q)i=i.exchangeSweep();else if(i instanceof Dr)i=new Dr(i.controls.slice().reverse());else throw new Error("bug");t[e]=i}return new hp(t,this.__bbox)}reverse1(){let t=new Array(this.primitives.length);for(let e=0,r=this.primitives.length-1;r>=0;e++,r--){let i=this.primitives[r];if(i instanceof M)i=new M(i.end(),i.start());else if(i instanceof q)i=i.exchangeSweep1();else if(i instanceof Dr)i=new Dr(i.controls.slice().reverse());else throw new Error("bug");t[e]=i}return new hp(t,this.__bbox)}mirrorY(t){let e=[];return this.primitives.forEach(r=>{if(r instanceof M)r=r.mirrorY(t);else if(r instanceof q)r=r.mirrorY(t);else if(r instanceof Dr){let i=r.controls.map(n=>n.mirrorY(t));r=new Dr(i)}else throw new Error("bug");e.push(r)}),new hp(e,this.__bbox)}points(t,e){if(this.primitives.length!==0){for(let r=0;r<this.primitives.length-1;r++){let i=this.primitives[r].points(t);i.pop(),i.forEach(n=>e(n))}this.primitives[this.primitives.length-1].points(t).forEach(r=>e(r))}}points1(t,e){if(this.primitives.length===0)return;for(let i=0;i<this.primitives.length-1;i++){let n=this.primitives[i],s=n instanceof q?n.points1(t):n.points(t);s.pop(),s.forEach(a=>e(a))}let r=this.primitives[this.primitives.length-1];(r instanceof q?r.points1(t):r.points(t)).forEach(i=>e(i))}points2(t,e){if(this.primitives.length===0)return;for(let i=0;i<this.primitives.length-1;i++){let n=this.primitives[i],s=n instanceof q?n.points2():n.points(t);s.pop(),s.forEach(a=>e(a))}let r=this.primitives[this.primitives.length-1];(r instanceof q?r.points2():r.points(t)).forEach(i=>e(i))}multiply3(t){let e=new Array(this.primitives.length);for(let r=0;r<this.primitives.length;r++)e[r]=this.primitives[r].multiply3(t);return hp.build7(e)}bbox(){return this.__bbox==null&&(this.__bbox=hp.calcBBox(this.primitives)),this.__bbox}start(){return this.primitives.length!==0?this.primitives[0].start():null}end(){return this.primitives.length!==0?this.primitives[this.primitives.length-1].end():null}isClose(t){if(this.primitives.length<=1&&!(this.primitives[0]instanceof q))return!1;{let e=this.primitives[0],r=this.primitives[this.primitives.length-1];return e.start().equals(r.end(),t)}}isEqual(t){if(t instanceof hp&&t.primitives.length==this.primitives.length){let e=t.primitives.length;for(let r=0;r<e;r++){let i=t.primitives[r],n=this.primitives[r];if(JSON.stringify(i)!=JSON.stringify(n))return!1}return!0}return!1}equals(t){if(!t)return!1;let e=this.primitives,r=t.primitives;if(e.length!=r.length)return!1;if(t.isClose()){let i=0;for(;i<e.length;){let n=e.slice(i).concat(e.slice(0,i));if(CC(n,r)||CC(n.reverse(),r))return!0;i++}return!1}else return CC(this.primitives,t.primitives)}clone(){return hp.build2(this.primitives)}putItem(t,e){if(!t)return!1;if(t instanceof hp)return this.mergePolyline(t,e);let r=this.start();if(!r){this.primitives.push(t),this.__bbox=t.bbox();return}let i=this.end();if(r.equals(i,e))return!1;let n=t.start(),s=t.end(),a=!1,l=!1;if(r.equals(n,e))a=!0,l=!1;else if(r.equals(s,e))a=!1,l=!1;else if(i.equals(n,e))a=!1,l=!0;else if(i.equals(s,e))a=!0,l=!0;else return!1;return l?this.primitives.push(a?t.reverse():t):this.primitives.unshift(a?t.reverse():t),this.__bbox=ht.extend2(this.__bbox,t.bbox()),!0}mergePolyline(t,e,r=0){if(!t)return!1;let i=this.start();if(!i){this.primitives.push(...t.primitives),this.__bbox=t.bbox();return}let n=this.end();if(i.equals(n,e))return!1;let s=t.start(),a=t.end(),l=!1,c=!1;if(i.equals(s,e))l=!0,c=!1;else if(i.equals(a,e))l=!1,c=!1;else if(n.equals(s,e))l=!1,c=!0;else if(n.equals(a,e))l=!0,c=!0;else return!1;let h=l?t.reverse():t;return c?this.primitives.push(...h.primitives):this.primitives.unshift(...h.primitives),this.__bbox=ht.extend2(this.__bbox,t.bbox()),!0}deDuplicationPoint(t){let e=this.primitives[this.primitives.length-1].start(),r=this.primitives[this.primitives.length-1].end(),i=t.primitives[0].start(),n=t.primitives[0].end();if(this.primitives[this.primitives.length-1]instanceof M&&t.primitives[0]instanceof M&&xZe([e,r],[i,n])){this.primitives.pop(),t.primitives.shift();let s=[];s.push(new M(e,n)),this.primitives.push(...s)}}getMaxBBoxHeightByVec(t){let e=t.normalize(),r=-1/0,i=1/0;if(this.primitives.forEach(s=>{let a=s.start().dot(e),l=s.end().dot(e);if(n(a),n(l),s instanceof q){let c=t.angleD(S.ORIGIN);if(s.angleIsInArc(c)){let h=s.pointOn(c).dot(e);n(h)}if(s.angleIsInArc(c+180)){let h=s.pointOn(c-180).dot(e);n(h)}}}),r-i<=0)throw new Error("getMaxBBoxHeightByVec");return r-i;function n(s){s>r&&(r=s),s<i&&(i=s)}}getWindingNum(t){let e=this.end(),r=0,{x:i,y:n}=t;for(let a of this.primitives){if(e.y>n?a.bbox().minY>n:a.bbox().maxY<=n){e=a.end();continue}if(a instanceof q&&(a.isCCW?Math.floor(a.startAngle/90)+1!==Math.ceil(a.endAngle()/90):Math.ceil(a.startAngle/90)-1!==Math.floor(a.endAngle()/90))){let l=a.startAngle,c=a.endAngle();if(a.sweepAngle>0){let h=90;for(;h<=c;)h>l&&(s(q.build3(a.center,l,h-l,a.rx,a.ry)),l=h),h+=90;l<c&&s(q.build3(a.center,l,c-l,a.rx,a.ry))}else{let h=270;for(;h>=c;)h<l&&(s(q.build3(a.center,l,h-l,a.rx,a.ry)),l=h),h-=90;l>c&&s(q.build3(a.center,l,c-l,a.rx,a.ry))}}else if(a instanceof Dr){let l=[];U_e(a,l),l.forEach(c=>s(c))}else s(a)}return r;function s(a){let l=a.start(),c=a.end();if(e.y>n!=l.y>n&&(e.x>i?l.x>i?r+=l.y>e.y?1:-1:e.y>l.y?(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)<0&&r--:(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)>0&&r++:l.x>i&&(e.y>l.y?(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)<0&&r--:(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)>0&&r++)),l.y>n!=c.y>n){if(l.x>i)if(c.x>i)r+=c.y>l.y?1:-1;else if(a instanceof M)l.y>c.y?(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)<0&&r--:(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)>0&&r++;else if(a instanceof q){let{center:h,isCCW:u,rx2:d}=a,p=(h.x-i)**2+(h.y-n)**2;l.y>c.y?(u?p>d:p<d)&&r--:(u?p<d:p>d)&&r++}else if(a instanceof Dr){if(f_e(a,n)===0)throw new Error("no inters");$e[0]>i&&(r+=c.y>l.y?1:-1)}else throw new Error("not support!");else if(c.x>i)if(a instanceof M)l.y>c.y?(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)<0&&r--:(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)>0&&r++;else if(a instanceof q){let{center:h,isCCW:u,rx2:d}=a,p=(h.x-i)**2+(h.y-n)**2;l.y>c.y?(u?p>d:p<d)&&r--:(u?p<d:p>d)&&r++}else if(a instanceof Dr){if(f_e(a,n)===0)throw new Error("no inters");$e[0]>i&&(r+=c.y>l.y?1:-1)}else throw new Error("not support!")}e=c}}},nK=Math.PI*2,_Lt=Math.PI/2,vLt=Math.sin(Math.PI/180),jZe=4,q=class pc extends rl{constructor(t,e,r,i,n){super(),this.rx=t,this.ry=e,this.center=r,this.startAngle=i,this.sweepAngle=n,this._start=S.ORIGIN,this._end=S.ORIGIN,this._start=this.pointOn(i),this._end=this.pointOn(i+n)}get hashed(){return this._hashed==null&&(this._hashed=this._hashCode()),this._hashed}hashCode(){return this.hashed}_hashCode(){let t=31,e=1;return e=t*e+new S(this.rx,this.rx).hashCode(),e=t*e+this.center.hashCode(),e=t*e+new S(this.startAngle,this.sweepAngle).hashCode(),e}get rx2(){return this._rx2==null&&(this._rx2=this.rx*this.rx),this._rx2}get ry2(){return this._ry2==null&&(this._ry2=this.ry*this.ry),this._ry2}get svgEnd(){return this._svgEnd==null&&(this._svgEnd=this.getSvgEnd(this.startAngle,this.sweepAngle,this._start,this._end)),this._svgEnd}getSvgEnd(t,e,r,i){let n=e>=0?-.01:.01,s=t+e;for(;(e>=0&&s>t||e<0&&s<t)&&r.distance2(i)<2e-4;)n*=2,s+=n,i=this.pointOn(s);return i}static build1(t,e,r,i,n,s){Fa.positive(r),Fa.positive(i);let a=t.equals(e);if(a)return new pc(r,i,t,0,n?360:0);{let l=t.x,c=-t.y,h=e.x,u=-e.y,d=s===0,p=(l-h)/2,m=(c-u)/2,g=Math.cos(0),y=Math.sin(0),b=g*p+y*m,P=-y*p+g*m;r=Math.abs(r),i=Math.abs(i);let T=r*r,I=i*i,C=b*b,E=P*P,O=n===d?-1:1,_=(T*I-T*E-I*C)/(T*E+I*C);_=_<0?0:_;let x=O*Math.sqrt(_),v=x*(r*P/i),D=x*-(i*b/r),w=(l+h)/2,F=(c+u)/2,H=w+(g*v-y*D),z=F+(y*v+g*D),V=(b-v)/r,W=(P-D)/i,L=(-b-v)/r,k=(-P-D)/i,N,U;U=Math.sqrt(V*V+W*W),N=V,O=W<0?-1:1;let B=so.toDegrees(O*Math.acos(N/U));U=Math.sqrt((V*V+W*W)*(L*L+k*k)),N=V*L+W*k,O=V*k-W*L<0?-1:1;let G=N/U,Y;G<-1?Y=Math.acos(-1):G>1?Y=Math.acos(1):Y=Math.acos(G);let X=so.toDegrees(O*Y);!d&&X>0?X-=360:d&&X<0&&(X+=360),Fa.normal(B),Fa.normal(X);let K=p*p/T+m*m/I,J=t.distance1(e)/2;r<J&&i<J&&(r*=Math.sqrt(K),i*=Math.sqrt(K));let se=a?0:so.regularD(-B),ce=a?n?360:0:-X;return new pc(r,i,new S(H,-z),se,ce)}}static build2(t,e,r,i,n,s){Fa.positive(i),Fa.positive(n),Fa.normal(e),Fa.normal(r);let a;return e===r?(e=so.regularD(e),r=so.regularD(r),a=0):(e=so.regularD(e),r=so.regularD(r),s===1?r<=e&&(r+=360):r>=e&&(e+=360),a=r-e),new pc(i,n,t,so.regularD(e),a)}static build3(t,e,r,i,n){return Fa.positive(i),Fa.positive(n),Fa.normal(r),new pc(i,n,t,so.regularD(e),r)}static build4(t,e,r,i,n,s){let a=t.angleD(r),l=e.angleD(r);return pc.build2(r,a,l,i,n,s)}static build5(t,e,r){r=so.toRadians(r);let i=e.sub(t),n=new S(-i.y,i.x).normalize(),s=Math.abs(r)/2,a;if(s!=0)a=i.length()/2/Math.sin(s);else throw new Error("Can't represent circle!!!");let l=n.rotate(S.ORIGIN,s),c,h;r>0?(c=1,h=e.add(l.scale(a))):(c=0,h=t.sub(l.scale(a)));let u=so.toDegrees(t.angle(h)),d=so.toDegrees(e.angle(h));return pc.build2(h,u,d,a,a,c)}static buildCircle(t,e,r=0){return pc.build2(t,0,360,e,e,r)}start(){return this._start}end(){return this._end}isLarge(){return Math.abs(this.sweepAngle)>180}sweep(){return this.sweepAngle>=0?1:0}get isCCW(){return this.sweepAngle>=0}endAngle(){return this.startAngle+this.sweepAngle}pointOn(t){t=so.regularD(t);let e=this.rx,r=this.ry;if(t===0)return this.center.add1(e,0);if(t===90)return this.center.add1(0,r);if(t===180)return this.center.add1(-e,0);if(t===270)return this.center.add1(0,-r);{let i=this.rx2,n=this.ry2,s=Math.tan(so.toRadians(t)),a=s*s,l=Math.sqrt(i*n/(i+n/a)),c=Math.sqrt(i*n/(n+i*a));return t>90&&t<270&&(c=-c),t>180&&t<360&&(l=-l),isNaN(c)&&(c=0),isNaN(l)&&(l=0),this.center.add1(c,l)}}exchangeSweep(){return pc.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle,this.rx,this.ry)}exchangeSweepAndStart(){return pc.build1(this.end(),this.start(),this.rx,this.ry,this.isLarge(),this.sweepAngle>=0?0:1)}exchangeSweep1(){return pc.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle+.01,this.rx,this.ry)}mirrorY(t){let e=this.start(),r=this.end();return e.equals(r)?pc.build3(this.center.mirrorY(),0,360,this.rx,this.ry):pc.build1(e.mirrorY(t),r.mirrorY(t),this.rx,this.ry,this.isLarge(),this.sweepAngle>=0?0:1)}mirror(t=S.ORIGIN){let e=this.start(),r=this.end();return e.equals(r)?pc.build3(this.center.mirror(t),0,360,this.rx,this.ry):pc.build1(e.mirror(t),r.mirror(t),this.rx,this.ry,this.isLarge(),this.sweep())}sectorArea(){return Math.abs(this.sweepAngle)/360*Math.PI*this.rx*this.ry}area(){let t=ME.area(this.center,this._start,this.pointOn(this.endAngle()));return this.sectorArea()-t}multiply3(t){let e;t.isMirrored()?e=-this.sweepAngle:e=this.sweepAngle;let r;return t.equals(Qe.ROT_90)?r=so.regularD(this.startAngle+90):t.equals(Qe.ROT_N90)?r=so.regularD(this.startAngle-90):r=so.transformD(this.startAngle,t),pc.build3(this.center.multiply3(t),r,e,t.iScale*this.rx,t.iScale*this.ry)}angleIsInArc(t){return t=so.regularD(t),this.sweepAngle>0?(t<this.startAngle&&(t+=360),this.endAngle()>t):(t>this.startAngle&&(t-=360),this.endAngle()<t)}toBezier(){if(Math.abs(this.sweepAngle)>90)throw new Error("not support!");let t=this.start(),e=this.end(),r=so.toRadians(this.sweepAngle)/2,i=4/3*(1-Math.cos(r))/Math.sin(r)*this.rx;return new Dr([t,t.add(new S(i,0).multiply3(Qe.rotateD(this.startAngle+90))),e.add(new S(i,0).multiply3(Qe.rotateD(this.endAngle()-90))),e])}toBezier2(){let t=[];r(this,90);let e=[];return t.forEach(i=>e.push(i.toBezier())),e;function r(i,n){if(Math.abs(i.sweepAngle)>n){let s=i.sweepAngle/2;r(pc.build3(i.center,i.startAngle,s,i.rx,i.ry),n),r(pc.build3(i.center,i.startAngle+s,s,i.rx,i.ry),n)}else t.push(i)}}buildBBox(){let t=W_e.getCache().boxCache,e=this.startAngle+this.sweepAngle;if(t[0]=Math.min(this._start.x,this._end.x),t[1]=Math.max(this._start.x,this._end.x),t[2]=Math.min(this._start.y,this._end.y),t[3]=Math.max(this._start.y,this._end.y),this.sweepAngle>0){let r=0;for(;r<e;){if(r>this.startAngle){let i=this.pointOn(r);t[0]=Math.min(t[0],i.x),t[1]=Math.max(t[1],i.x),t[2]=Math.min(t[2],i.y),t[3]=Math.max(t[3],i.y)}r+=90}}else if(this.sweepAngle<0){let r=360;for(;r>e;){if(r<this.startAngle){let i=this.pointOn(r);t[0]=Math.min(t[0],i.x),t[1]=Math.max(t[1],i.x),t[2]=Math.min(t[2],i.y),t[3]=Math.max(t[3],i.y)}r-=90}}return new ht(t[0],t[1],t[2],t[3])}bbox(){return this.__bbox==null&&(this.__bbox=this.buildBBox()),this.__bbox}length(){return Math.abs(this.rx*this.sweepAngle*Math.PI/180)}toString(){return f7.format("Arc [start=%s, end=%s, rx=%s, ry=%s, center=%s, startAngle=%s, sweepAngle=%s]",this._start,this._end,this.rx,this.ry,this.center,this.startAngle,this.sweepAngle)}stroke(t,e,r){let i=t/2,n=this.rx+i,s=this.ry+i,a=this.rx-i,l=this.ry-i,c=new Qe;a<0&&(a=-a,c=c.multiply3(Qe.MIRROR_Y)),l<0&&(l=-l,c=c.multiply3(Qe.MIRROR_X)),a===0&&(a=.001),l===0&&(l=.001),c=c.setOrigin1(this.center);let h,u;switch(r===this.sweep()?(h=pc.build3(this.center,this.startAngle,this.sweepAngle,n,s),u=pc.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle,a,l)):(h=pc.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle,n,s),u=pc.build3(this.center,this.startAngle,this.sweepAngle,a,l)),u=u.multiply3(c),e){case 1:{let d=r===1?180:-180,p=r===this.sweep()?this.pointOn(this.endAngle()):this.pointOn(this.startAngle),m=r===this.sweep()?this.pointOn(this.startAngle):this.pointOn(this.endAngle()),g=h.pointOn(h.endAngle()).angleD(p),y=u.pointOn(u.endAngle()).angleD(m);return ge.build2([h,pc.build3(p,g,d,i,i),u,pc.build3(m,y,d,i,i)])}default:return ge.build2([h,u])}}points2(){let t=Math.ceil(Math.abs(this.sweepAngle)/jZe),e=this.sweepAngle/t,r=[this._start];for(let i=1;i<t;i++)r.push(this.pointOn(this.startAngle+e*i));return r.push(this._end),r}points1(t){let e=Math.max(this.rx,this.ry);if(e<=t)return[this.start(),this.svgEnd];let r=(e-t)/e,i=Math.ceil(Math.abs(this.sweepAngle/so.toDegrees(Math.acos(r))/2)),n=new Array(i+1),s=this.sweepAngle/i,a=this.startAngle;for(let l=0;l<=i;l++,a+=s)n[l]=this.pointOn(a);return n}points(t){let e=Math.max(this.rx,this.ry);if(t=Math.abs(t),e<=t)return[this.start(),this.svgEnd];t=Math.max(t,e*1e-5),t=Math.min(t,e*(1-Math.SQRT1_2));let r=(e-t)/e,i=Math.ceil(Math.abs(this.sweepAngle/so.toDegrees(Math.acos(r))/2));i=Math.max(i,2);let n=new Array(i+1),s=this.sweepAngle/i,a=this.startAngle+s;n[0]=this.start();for(let l=1;l<i;l++,a+=s)n[l]=this.pointOn(a);return n[i]=this.end(),n}panDistance(t){return this.sweepAngle>0?new pc(this.rx-t,this.ry-t,this.center,this.startAngle,this.sweepAngle):new pc(this.rx+t,this.ry+t,this.center,this.startAngle,this.sweepAngle)}panDistance1(t){if(this.sweepAngle>0){let e=this.rx-t;return e<0?(e=Math.abs(e),pc.build3(this.center,this.startAngle-180,this.sweepAngle,e,e)):new pc(e,e,this.center,this.startAngle,this.sweepAngle)}else{let e=this.rx+t;return e<0?(e=Math.abs(e),pc.build3(this.center,this.startAngle-180,this.sweepAngle,e,e)):new pc(e,e,this.center,this.startAngle,this.sweepAngle)}}get bulge(){let t=Math.abs(PZe(this.sweepAngle,3))/180*Math.PI;return Math.tan(t/4)}get midPoint(){let t=so.toRadians(this.startAngle),e=so.toRadians(this.endAngle()),r=this.sweep(),i=this.center,n=this.rx;if(r==1)if(e>t){let s=(e-t)/2+t;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new S(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(e+nK-t)/2+t;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}}else if(e>t){let s=(t+nK-e)/2+e;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new S(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(t-e)/2+e;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}}}get svgPathData(){return[{type:"M",values:[this._start.x,this._start.y]},{type:"A",values:[this.rx,this.ry,0,this.isLarge()?1:0,this.isCCW,this._end.x,this._end.y]}]}equals(t){let e=so.regularD(this.startAngle),r=so.regularD(this.sweepAngle),i=so.regularD(t.startAngle),n=so.regularD(t.sweepAngle);return CC([this.rx,this.ry,this.center,Math.abs(r)],[t.rx,t.ry,t.center,Math.abs(n)])&&(CC([r,e],[n,i])||CC([so.regularD(e+r)],[i]))}equals1(t){let e=so.regularD(this.startAngle),r=so.regularD(this.sweepAngle),i=so.regularD(t.startAngle),n=so.regularD(t.sweepAngle);return CC([this.rx,this.ry,this.center,Math.abs(r)],[t.rx,t.ry,t.center,Math.abs(n)])&&(CC([r,e],[n,i])||CC([so.regularD(e+r)],[i]))}inArea(t,e){let r=t.x,i=t.y,n=this.center,s=this.rx,a=so.toRadians(this.startAngle);this.sweep()==0&&(a=so.toRadians(this.endAngle()));let l=so.toRadians(this.endAngle());this.sweep()==0&&(l=so.toRadians(this.startAngle));let c=s-e/2,h=s+e/2;var u=r-n.x,d=i-n.y,p=Math.atan2(d,u);if(p<0&&(p+=nK),a<=l&&p>=a&&p<=l||a>l&&(p>=a&&p<=nK||p>=0&&p<=l)||a==l){var m=Math.sqrt(u*u+d*d);return m<=h&&m>=c}else{var m=(h+c)/2,g=new S(n.x+Math.cos(a)*m,n.y+Math.sin(a)*m),y=new S(n.x+Math.cos(l)*m,n.y+Math.sin(l)*m),b=r-g.x,P=i-g.y,T=r-y.x,I=i-y.y;return b*b+P*P<=e*e/4?!0:T*T+I*I<=e*e/4}}isCircle(){return(sr.eq(Math.abs(this.sweepAngle),360)||this._start.equals1(this._end))&&this.rx==this.ry}reverse(){return pc.build3(this.center,this.endAngle(),-this.sweepAngle,this.rx,this.ry)}getAngle(){let t=Math.PI*2;return this.sweep()==1?(this.endAngle()-this.startAngle+t)%t:(this.startAngle-this.endAngle()+t)%t}isValid(){return this.rx>0&&this.ry>0}panDistance2(t){if(this.sweepAngle>0){let e=this.rx-t;if(e===0)return new M(this.center,this.center);if(e<sr.eps){e=Math.abs(e);let r=pc.build3(this.center,this.startAngle-180,this.sweepAngle,e,e);return r.area()<1e-5?new M(r.start(),r.end()):r}return new pc(e,e,this.center,this.startAngle,this.sweepAngle)}else{let e=this.rx+t;if(e===0)return new M(this.center,this.center);if(e<sr.eps){e=Math.abs(e);let r=pc.build3(this.center,this.startAngle-180,this.sweepAngle,e,e);return r.area()<1e-5?new M(r.start(),r.end()):r}return new pc(e,e,this.center,this.startAngle,this.sweepAngle)}}},Y_e=new ArrayBuffer(24),oge=new Float64Array(Y_e),n7=new Int32Array(Y_e),_E=class TC{static normal(t,e,r){let i=e.sub(t),n=r.sub(e);return i.cross(n)}static random(){return new TC(t(),t(),t()).normalize();function t(){return Math.sqrt(-2*Math.log(Math.random()))*Math.cos(2*Math.PI*Math.random())}}constructor(t,e,r){this.x=Fa.normal(t),this.y=Fa.normal(e),this.z=Fa.normal(r),oge[0]=t,oge[1]=e,oge[2]=r,this.hashed=n7[0]^n7[1]^n7[2]^n7[3]^n7[4]^n7[5]}isNormalized(){return sr.eq(this.length(),1)}isZeroVector(){return this.x===0&&this.y===0&&this.z===0}hashCode(){return this.hashed}equals(t){return t instanceof TC?t.x===this.x&&t.y===this.y&&t.z===this.z:!1}cross(t){return new TC(this.y*t.z-this.z*t.y,this.z*t.x-this.x*t.z,this.x*t.y-this.y*t.x)}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}normalize(){var t=this.length();return new TC(this.x/t,this.y/t,this.z/t)}sub(t){return new TC(this.x-t.x,this.y-t.y,this.z-t.z)}add(t){return new TC(this.x+t.x,this.y+t.y,this.z+t.z)}scale(t){return new TC(this.x*t,this.y*t,this.z*t)}neg(){return new TC(-this.x,-this.y,-this.z)}multiply4(t){var e=this.x*t.data[0]+this.y*t.data[4]+this.z*t.data[8]+t.data[12],r=this.x*t.data[1]+this.y*t.data[5]+this.z*t.data[9]+t.data[13],i=this.x*t.data[2]+this.y*t.data[6]+this.z*t.data[10]+t.data[14],n=this.x*t.data[3]+this.y*t.data[7]+this.z*t.data[11]+t.data[15];return n!=0?new TC(e/n,r/n,i/n):new TC(e,r,i)}rotate(t,e){return this.multiply4(Ae.rotateAxis(t,e))}toVector2(){return new S(this.x,this.y)}};_E.ORIGIN=new _E(0,0,0),_E.X_UNIT_VECTOR=new _E(1,0,0),_E.Y_UNIT_VECTOR=new _E(0,1,0),_E.Z_UNIT_VECTOR=new _E(0,0,1);var Dt=_E,mm=class{constructor(){this.clear()}clear(){this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.minZ=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY,this.maxZ=Number.NEGATIVE_INFINITY}ext1(o,t,e,r,i,n){if(o<=r&&t<=i&&e<=n)this.minX=Math.min(this.minX,o),this.minY=Math.min(this.minY,t),this.minZ=Math.min(this.minZ,e),this.maxX=Math.max(this.maxX,r),this.maxY=Math.max(this.maxY,i),this.maxZ=Math.max(this.maxZ,n);else throw new Error("min > max is not permitted");return this}ext2(o,t,e){return this.minX=Math.min(this.minX,o),this.minY=Math.min(this.minY,t),this.minZ=Math.min(this.minZ,e),this.maxX=Math.max(this.maxX,o),this.maxY=Math.max(this.maxY,t),this.maxZ=Math.max(this.maxZ,e),this}ext3(o){return this.ext2(o.x,o.y,o.z)}ext4(o){return this.ext1(o.minX,o.minY,o.minZ,o.maxX,o.maxY,o.maxZ)}ext5(o,t){return this.minX=Math.min(this.minX,o),this.minY=Math.min(this.minY,t),this.maxX=Math.max(this.maxX,o),this.maxY=Math.max(this.maxY,t),this}ext6(o){return this.minZ=Math.min(this.minZ,o),this.maxZ=Math.max(this.maxZ,o),this}ext7(o){return this.minX=Math.min(this.minX,o.minX),this.minY=Math.min(this.minY,o.minY),this.maxX=Math.max(this.maxX,o.maxX),this.maxY=Math.max(this.maxY,o.maxY),this}isValid(){return isFinite(this.minX)&&isFinite(this.minY)&&isFinite(this.minZ)&&isFinite(this.maxX)&&isFinite(this.maxY)&&isFinite(this.maxZ)}build(){return new U1(this.minX,this.minY,this.minZ,this.maxX,this.maxY,this.maxZ)}},U1=class{constructor(o,t,e,r,i,n){if(o<=r&&t<=i&&e<=n)this.minX=Fa.normal(o),this.minY=Fa.normal(t),this.minZ=Fa.normal(e),this.maxX=Fa.normal(r),this.maxY=Fa.normal(i),this.maxZ=Fa.normal(n);else throw new Error("min > max is not permitted")}center(){return new Dt((this.minX+this.maxX)/2,(this.minY+this.maxY)/2,(this.minZ+this.maxZ)/2)}transform(o){let t=new mm;for(let e of this.getVertexes())t.ext3(e.multiply4(o));return t.build()}isContains(o){return!(o.x<this.minX||o.y<this.minY||o.z<this.minZ||o.x>this.maxX||o.y>this.maxY||o.z>this.maxZ)}getVertexes(){return[new Dt(this.minX,this.minY,this.minZ),new Dt(this.minX,this.minY,this.maxZ),new Dt(this.minX,this.maxY,this.minZ),new Dt(this.minX,this.maxY,this.maxZ),new Dt(this.maxX,this.minY,this.minZ),new Dt(this.maxX,this.minY,this.maxZ),new Dt(this.maxX,this.maxY,this.minZ),new Dt(this.maxX,this.maxY,this.maxZ)]}diagonalLength(){let o=this.maxX-this.minX,t=this.maxY-this.minY,e=this.maxZ-this.minZ;return Math.sqrt(o*o+t*t+e*e)}toBBox2(){return new ht(this.minX,this.maxX,this.minY,this.maxY)}},Fo=class c7{static build(t){return t instanceof ge?new c7([new Zo([t])]):t instanceof Zo?new c7([t]):t}static buildByPolygon(t){return t?new c7([t]):new c7([])}static buildByStroke(t,e,r=1,i){return this.buildByPolygon(Zo.buildByStroke(t,e,r,Bge,i))}static buildCircle(t,e){return this.buildByPolygon(Zo.buildCircle(t,e))}static buildRect(t){return this.buildByPolygon(Zo.buildRect(t))}static buildBBox(t){return this.buildByPolygon(Zo.buildBBox(t))}constructor(t){this.items=t.slice()}multiply3(t){return new c7(this.items.map(e=>e.multiply3(t)))}bbox(){return this._bbox||(this._bbox=this.items.reduce((t,e)=>t.ext1(e.bbox()),new _e).build1()),this._bbox}toPolylineGroups(){return this.items.map(t=>t.toPolylineGroup())}},pm=class DT{static isHexFormate(t){return!t||typeof t!="string"?!1:/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)}static of1(t){return this.of2(t>>16&255,t>>8&255,t&255)}static of2(t,e,r,i=255){return new DT(t/255,e/255,r/255,i/255)}static of3(t){t.startsWith("#")&&(t=t.substr(1));let e=t.length;if(e==3)return new DT(parseInt(t[0],16)/15,parseInt(t[1],16)/15,parseInt(t[2],16)/15);if(e==6)return new DT(parseInt(t.substr(0,2),16)/255,parseInt(t.substr(2,2),16)/255,parseInt(t.substr(4,2),16)/255);if(e==8)return new DT(parseInt(t.substr(0,2),16)/255,parseInt(t.substr(2,2),16)/255,parseInt(t.substr(4,2),16)/255,parseInt(t.substr(6,2),16)/255);throw new Error("invalid color string")}static of4(t){let e=parseInt(t.r*255+"").toString(16),r=parseInt(t.g*255+"").toString(16),i=parseInt(t.b*255+"").toString(16);return e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),i.length<2&&(i="0"+i),("#"+e+r+i).toUpperCase()}static of5(t,e){if(t.startsWith("#")&&(t=t.substr(1)),t.length==3)return new DT(parseInt(t[0],16)/15,parseInt(t[1],16)/15,parseInt(t[2],16)/15,e);if(t.length==6)return new DT(parseInt(t.substr(0,2),16)/255,parseInt(t.substr(2,2),16)/255,parseInt(t.substr(4,2),16)/255,e);throw new Error("invalid color string")}static of6(t,e){return new DT(t.r,t.g,t.b,e)}static of7(t){return t==null?null:DT.of3(t)}constructor(t,e,r,i=1){this.r=Fa.positiveOr0(t),this.g=Fa.positiveOr0(e),this.b=Fa.positiveOr0(r),this.alpha=i}hashCode(){return this.r+this.g+this.b+this.alpha}equals(t,e=!1){let r=this.r===t.r&&this.g===t.g&&this.b===t.b;return e?r:r&&this.alpha===t.alpha}add(t,e,r,i){return new DT(Math.max(0,Math.min(1,this.r+t)),Math.max(0,Math.min(1,this.g+e)),Math.max(0,Math.min(1,this.b+r)),Math.max(0,Math.min(1,this.alpha+i)))}mul(t){return new DT(Math.max(0,Math.min(1,this.r*t)),Math.max(0,Math.min(1,this.g*t)),Math.max(0,Math.min(1,this.b*t)),this.alpha)}mul1(t){return new DT(Math.max(0,this.r*t),Math.max(0,this.g*t),Math.max(0,this.b*t),this.alpha)}getData(){return[this.r,this.g,this.b,this.alpha]}toString(){let t=(this.r*255).toString(16),e=(this.g*255).toString(16),r=(this.b*255).toString(16);return t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),"#"+t.substr(0,2)+e.substr(0,2)+r.substr(0,2)}toString1(){let t=(this.r*255).toString(16),e=(this.g*255).toString(16),r=(this.b*255).toString(16),i=(this.alpha*255).toString(16);return t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),i.length<2&&(i="0"+i),"#"+t.substr(0,2)+e.substr(0,2)+r.substr(0,2)+i.substr(0,2)}toRGBA(){let t=this.r*255,e=this.g*255,r=this.b*255;return[t,e,r,this.alpha]}toRGBAString(){let t=this.r*255,e=this.g*255,r=this.b*255;return`rgba(${t},${e},${r},${this.alpha})`}isWHITE(){return this.r===1&&this.g===1&&this.b===1&&this.alpha===1}};pm.WHITE=new pm(1,1,1,1),pm.BLACK=new pm(0,0,0,1),pm.RED=new pm(1,0,0,1),pm.GREEN=new pm(0,1,0,1),pm.BLUE=new pm(0,0,1,1),pm.Gray=pm.of3("#9966ff"),pm.Silver=pm.of3("#D2D2D2"),pm.Golden=pm.of3("#DCAA14"),pm.Pink=pm.of3("#ffaec9");var Il=pm,I_e=!1,j_e=class{onRTreeBBox(o){}onResultSide(o){}onOriginSide(o){}onSplitedSide(o){}onDebugSide(o){}onSweep(o,t,e,r,i,n){}onIntersect(o,t,e){}onSegment(o,t,e,r,i,n){}onSegment1(o,t,e){if(I_e){let r=new S(o.getX(e),e),i=new S(t.getX(e),e);this.onSegment(r,o.weight,o,i,t.weight,t)}else this.onSegment(o.start,o.weight,o,t.end,t.weight,t)}onSweep1(o,t,e){if(I_e){let r=new S(o.getX(e),e),i=new S(t.getX(e),e);this.onSweep(r,o.weight,o,i,t.weight,t)}else this.onSweep(o.start,o.weight,o,t.end,t.weight,t)}},qU=class extends j_e{constructor(o){super(),this.plGrps=new Array,this.debug=o}onPolylineGroup(o,t){this.plGrps.push(o)}},JU=class{constructor(o){this.cache={},this.levels=o,this.result=new Array(o),this.weights=new Array(o),this.maxIdx=o-1,this.rule=this.decide.bind(this);let t=1;for(let e=0;e<o;e++)this.weights[e]=t,t*=50}weight(o){return this.weights[o]}decide(o){o=Math.abs(o);let t=this.cache[o];if(t===void 0){let e=o;for(let r=this.maxIdx;r>=0;r--){let i=this.weights[r],n=o/i|0,s=o%i;s>(i/2|0)?(o=i-s,n++):o=s,this.result[r]=n>0}t=this.decide1(this.result),this.cache[e]=t}return t}},XZe=o=>o!==0;var qZe=new class extends JU{decide1(o){return o[0]||o[1]}}(2),fK=new class extends JU{decide1(o){return o[0]&&!o[1]}}(2),mK=new class extends JU{decide1(o){return o[0]&&o[1]}}(2),sge=new class extends JU{decide1(o){return o[0]&&!o[1]||!o[0]&&o[1]}}(2),b7=class h7{constructor(t,e,r,i,n,s,a){this.inters=[],this.connect=new Array,this.previous=null,this.next=null,this.finalGrp=-1,this.trans=NaN,this.outsideWeight=0,this.insideWeight=0,this.invalidWeight=0,this._confidence=0,this._confidence_y=NaN,this._x=NaN,this._x_y=NaN,this.status=0,this.bo=t,this.shape=e,this.baseWeight=r,i.y>n.y?this.weight=-r:i.y==n.y?this.weight=0:this.weight=r,this.start=i,this.end=n,this.polyGrp=s,this.polyIndex=a,this._bbox=new _e().ext1(e.bbox()).ext2(i).ext2(n).build1(),this.inters.push(i),this.inters.push(n);let l=31,c=1;c=l*c+this.polyGrp,c=l*c+this.polyIndex,this._hashcode=c}static rebuild(t,e,r){if(t instanceof M||e.distance2(r)<1e-6)return new M(e,r);if(t instanceof q){let i=t,n=t.bbox().center().x,s;e.y>r.y?s=n>i.center.x?0:1:s=n>i.center.x?1:0;let a=e.angleD(i.center),l=r.angleD(i.center);return q.build2(i.center,a,l,i.rx,i.ry,s)}else throw new Error("not supported operation")}updateBbox(){this._bbox=new _e().ext2(this.start).ext2(this.end).build1()}is(t,e){return t===this.polyGrp&&e===this.polyIndex}confidence(t){if(this._confidence_y!=t){let e=this._bbox.height();if(e!==0)if(Math.abs(t-this._bbox.maxY)>5e-4&&Math.abs(t-this._bbox.minY)>5e-4){let r=1-Math.abs(2*t-this._bbox.maxY-this._bbox.minY)/e;this._confidence=r*1e4|0}else this._confidence=0;else this._confidence=1;this._confidence_y=t}return this._confidence}needCountWeight(){return this.outsideWeight+this.insideWeight+this.invalidWeight<5e3}revokeOutside(t){let e=this.confidence(t);return this.outsideWeight-=e,this.invalidWeight+=e,e}revokeInside(t){let e=this.confidence(t);return this.insideWeight-=e,this.invalidWeight+=e,e}setOutside(t){let e=this.confidence(t);return this.outsideWeight+=e,e}setInside(t){let e=this.confidence(t);return this.insideWeight+=e,e}setInvalid(t){let e=this.confidence(t);return this.invalidWeight+=e,e}prevNot0(){let t=this.previous;for(;t!=null&&t!=this;){if(t.weight!=0)return t;t=t.previous}return null}nextNot0(){let t=this.next;for(;t!=null&&t!=this;){if(t.weight!=0)return t;t=t.next}return null}getX(t){if(this.bo!==null)return(this._x_y!=t||isNaN(this._x))&&(rJe(this,t)>0?this._x=$e[0]:this._x=NaN,this._x_y=t),this._x;throw new Error("not supported operation")}voteStatus(){return this.outsideWeight>this.insideWeight&&this.outsideWeight>this.invalidWeight?2:this.insideWeight>this.outsideWeight&&this.insideWeight>this.invalidWeight?1:this.invalidWeight>this.outsideWeight&&this.invalidWeight>this.insideWeight?3:0}reverse(t){if(t===2)if(this.start.y>this.end.y){let e=h7.rebuild(this.shape,this.end,this.start),r=new h7(this.bo,e,this.baseWeight,this.end,this.start,this.polyGrp,this.polyIndex);return kg.addAll(r.connect,this.connect),r}else return this;else if(t===1)if(this.start.y<this.end.y){let e=h7.rebuild(this.shape,this.end,this.start),r=new h7(this.bo,e,this.baseWeight,this.end,this.start,this.polyGrp,this.polyIndex);return kg.addAll(r.connect,this.connect),r}else return this;return this}isNeedScan(t){return this.needCountWeight()&&this.confidence(t)>0}hashCode(){return this._hashcode}equals(t){return t instanceof h7?!(this.polyGrp!==t.polyGrp||this.polyIndex!==t.polyIndex):!1}bbox(){return this._bbox}toString(){return f7.format("(%d,%d,%d) (%d,%d,%d) %s %s",this.polyGrp,this.polyIndex,this.weight,this.outsideWeight,this.invalidWeight,this.insideWeight,this.start,this.end)}};function $Ze(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minY+e.maxY)/2,n=(r.minY+r.maxY)/2;return i-n}function KZe(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minX+e.maxX)/2,n=(r.minX+r.maxX)/2;return i-n}var o7=class{constructor(o){if(this.__bbox=null,typeof o<"u")if(o instanceof Array){this.__items=[];for(let t of o)this.add(t)}else this.__items=o,this.__bbox=o.bbox();else this.__items=[]}add(o){if(this.__items instanceof Array)this.__items.push(o),this.__bbox=ht.extend2(this.__bbox,o.bbox());else throw new Error("can't insert multiple item into leaf node")}items(){return this.__items}bbox(){if(this.__bbox!==null)return this.__bbox;throw new Error("bug")}},i2=class{constructor(o){this.changed=!1,this.root=new o7,this.capacity=o,this.capacity2=o*o,this.itemList=[]}size(){return this.itemList.length}items(){return this.flushWhenNeed(),this.itemList}add(o){this.itemList.push(o),this.changed=!0}remove(o){kg.remove(this.itemList,o),this.changed=!0}clear(){this.changed=!1,this.root=new o7,this.itemList.length=0}flushWhenNeed(){if(this.changed){let o=new Array;for(let t of this.itemList)o.push(new o7(t));for(;;){let t=this.organize(o);if(t.length>1)o=t;else break}this.root=new o7(o),this.changed=!1}}organize(o){cw(o,KZe,0,o.length);let t=o.length,e=[];for(let r=0;r<t;)if(r+this.capacity2<=t){let i=r+this.capacity2;cw(o,$Ze,r,i);for(let n=r;n<i;n+=this.capacity){let s=new o7(o.slice(n,n+this.capacity));e.push(s)}r=r+this.capacity*this.capacity}else{let i=new o7(o.slice(r,r+this.capacity));e.push(i),r=r+this.capacity}return e}search(o){this.flushWhenNeed();let t=[],e=[];for(e.push(this.root);;){let r=e.shift();if(typeof r<"u"){let i=r.items();if(i instanceof Array){for(let n of i)if(!o.isSeparated(n.bbox())){let s=n.items();s instanceof Array?e.push(n):t.push(s)}}else o.isSeparated(r.bbox())||t.push(i)}else break}return t}walker(o){this.flushWhenNeed(),this._walker(this.root,0,o)}_walker(o,t,e){this.flushWhenNeed();let r=o.items();if(r instanceof Array)for(let i of r)this._walker(i,t+1,e);else e(r,t)}bbox(){return this.flushWhenNeed(),this.root.bbox()}};function age(o,t){ZZe(o.iterator(),t)}function ZZe(o,t){let e=0;for(;o.hasNext();){let r=o.next();t(e++,r)}}var oK=new Error("list is empty"),sK=class{constructor(o,t){this.prev=null,this.next=null,this.parent=o,this.item=t}insertAfter(o){o.next=this.next,this.next=o,o.prev=this,o.next!==null&&(o.next.prev=o)}insertBefore(o){o.prev=this.prev,this.prev=o,o.next=this,o.prev!==null&&(o.prev.next=o)}remove(){this.prev!==null&&(this.prev.next=this.next),this.next!==null&&(this.next.prev=this.prev)}set(o){this.item=o}},JZe=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o.item;throw new Error("iterator is null")}},QZe=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o;throw new Error("iterator is null")}},aw=class{constructor(){this.first=null,this.last=null,this.cnt=0}add(o){return this.addLast(o)}push(o){return this.addLast(o)}pop(){return this.removeLast()}shift(){return this.removeFirst()}removeFirst(){let o=this.first;if(o===null)throw oK;return this.remove(o),o.item}removeLast(){let o=this.last;if(o===null)throw oK;return this.remove(o),o.item}addLast(o){return this.first===null||this.last===null?(this.first=new sK(this,o),this.last=this.first,this.cnt=1,this.first):this.insertAfter(this.last,o)}addFirst(o){if(this.first===null||this.last===null){let t=new sK(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertBefore(this.first,o)}getFirst(){if(this.first===null)throw oK;return this.first.item}getLast(){if(this.last===null)throw oK;return this.last.item}insertAfter(o,t){let e=new sK(this,t);return o.insertAfter(e),o===this.last&&(this.last=e),this.cnt++,e}insertBefore(o,t){let e=new sK(this,t);return o.insertBefore(e),o===this.first&&(this.first=e),this.cnt++,e}remove(o){o.remove(),o===this.first&&(this.first=o.next),o===this.last&&(this.last=o.prev),this.cnt--}size(){return this.cnt}clear(){this.first=null,this.last=null,this.cnt=0}iterator(){return new JZe(this.first)}listIterator(){return new QZe(this.first)}toArray(){let o=new Array(this.cnt),t=this.first,e=0;for(;t!=null;)o[e]=t.item,t=t.next,e++;return o}};function lge(o){throw new Error("")}var aK=class{constructor(o,t){this.node1=null,this.node2=null,this.key=o,this.value=t}},eJe=class{constructor(o){this.itors=o}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().key}},tJe=class{constructor(o){this.itors=o}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().value}},EK=class{constructor(){this.innerList=new aw,this.innerMap={}}replace(o,t){o.node1!==null&&(o.node1.set(t),t.node1=o.node1),o.node2!==null&&(o.node2.set(t),t.node2=o.node2)}clear(){this.innerList.clear();for(let o in this.innerMap)delete this.innerMap[o]}put(o,t){let e=o.hashCode(),r=new aK(o,t),i=this.innerMap[e];if(i===void 0)return r.node1=this.innerList.add(r),this.innerMap[e]=r,null;if(i instanceof aK){if(i.key.equals(o))return this.innerMap[e]=r,this.replace(i,r),i.value;{r.node1=this.innerList.add(r);let n=new aw;return i.node2=n.add(i),r.node2=n.add(r),this.innerMap[e]=n,null}}if(i instanceof aw){let n=null;return age(i,(s,a)=>a.key.equals(o)?(this.replace(a,r),n=a.value,!1):!0),n===null?(r.node1=this.innerList.add(r),r.node2=i.push(r),null):n}return lge(i)}get(o){let t=o.hashCode(),e=this.innerMap[t];if(e===void 0)return null;if(e instanceof aK)return e.key.equals(o)?e.value:null;if(e instanceof aw){let r=null;return age(e,(i,n)=>n.key.equals(o)?(r=n.value,!1):!0),r}return lge(e)}containsKey(o){return this.get(o)!==null}delete(o){o.node1!==null&&o.node1.parent.remove(o.node1),o.node2===null?delete this.innerMap[o.key.hashCode()]:o.node2.parent.remove(o.node2)}remove(o){let t=o.hashCode(),e=this.innerMap[t];if(e===void 0)return null;if(e instanceof aK)return e.key.equals(o)?(this.delete(e),e.value):null;if(e instanceof aw){let r=null;return age(e,(i,n)=>n.key.equals(o)?(r=n.value,this.delete(n),!1):!0),r}return lge(e)}computeIfAbsent(o,t){let e=this.get(o);if(e===null){let r=t(o);return this.put(o,r),r}else return e}size(){return this.innerList.size()}isEmpty(){return this.innerList.size()===0}keys(){return new eJe(this.innerList.iterator())}values(){return new tJe(this.innerList.iterator())}entries(){return this.innerList.iterator()}},y7=class{constructor(){this.innerMap=new EK}add(o){return this.innerMap.put(o,!0)!==!0}remove(o){this.innerMap.remove(o)}contains(o){return this.innerMap.get(o)===!0}iterator(){return this.innerMap.keys()}addAll(o){let t=o.iterator();for(;t.hasNext();)this.add(t.next())}size(){return this.innerMap.size()}clear(){let o=this.iterator();for(;o.hasNext();){let t=o.next();this.remove(t)}}},C_e=kg.funcCopy(cw);function rJe(o,t){let e=0;if(Math.abs(o.start.y-t)<=1e-4)$e[e++]=o.start.x;else if(Math.abs(o.end.y-t)<=1e-4)$e[e++]=o.end.x;else if(o.shape instanceof M)e=SZe(o.shape,t);else if(o.shape instanceof q)e=EZe(o.shape,t);else throw new Error("not supported operation");return e}var gK=class{constructor(o,t,e,r){this.sides=new Array,this.loader=o,this.loader.bo=this,this.logger=e,this.rule=t,this.event=r}static sortByBBoxMinY(o,t){return o.bbox().minY-t.bbox().minY}static sortByBBoxAreaDesc(o,t){return t.bbox().area()-o.bbox().area()}addPolyline(o,t=1,e=.01,r=!0){for(let i of this.loader.buildGroup(o,t,e,r))this.sides.push(i),this.event.onOriginSide(i)}buildRTree(){let o=new i2(10);for(let t of this.sides)o.add(t);return o}fillValidSides(o,t,e){for(let r of t)isFinite(r.getX(e))&&o.push(r)}getSortedEndpointsLineAsc(o){let t=new Array;for(let i of o)i.needCountWeight()&&(t.push(i.start),t.push(i.end));C_e(t,S.sortByYAsc,0,t.length);let e=new Array,r=Number.NEGATIVE_INFINITY;for(let i of t){let n=i.y;n>r&&(e.push(n),r=n)}return e}splitSides(o,t,e){let r=o.start,i=o.end,n=new S(i.x+(r.x-i.x)*2,i.y+(r.y-i.y)*2);C_e(o.inters,(a,l)=>a.distance2(n)-l.distance2(n),0,o.inters.length);let s=null;for(let a of o.inters)if(s==null)a.equals(r)&&(s=a);else if(!a.equals(s)){let l=b7.rebuild(o.shape,s,a);l instanceof q&&Math.abs(l.sweepAngle)>190&&(l=new M(s,a));let c=new b7(this,l,o.baseWeight,s,a,o.polyGrp,e++);if(t.push(c),c.updateBbox(),a.equals(i))break;s=a}return e}splitSidesByInters(){let o=new Array;for(let t of this.sides)if(t.polyIndex==0){let e=0,r=null,i=null;do{let n=new Array;e=this.splitSides(t,n,e);for(let s of n)r!=null?(r.next=s,s.previous=r):i=s,r=s,this.event.onSplitedSide(s),o.push(s);if(t.next===null)throw new Error("not supported operation");t=t.next}while(t.polyIndex!==0);i!=null&&r!=null&&(i.previous=r,r.next=i)}this.sides.length=0;for(let t of o)this.sides.push(t)}seekIntersection(){if(this.sides.length>0){let o=this.buildRTree(),t=new y7;for(let e of this.sides){t.add(e);let r=e.bbox().extendOfSize(1e-5),i=e.shape instanceof M;for(let n of o.search(r))if(!t.contains(n)){let s=n.shape instanceof M;if(!(i&&s&&e.next!==null&&e.previous!==null&&(e.next.equals(n)||e.previous.equals(n)))){let a=G0(e.shape,n.shape);for(let l=0;l<a;l+=2){let c=new S($e[l],$e[l+1]);e.inters.push(c),n.inters.push(c),this.event.onIntersect(c,e,n)}}}}}}},iJe=class X_e{constructor(t){this.sides=new y7,this.others=new y7,this.id=t}add(t){this.sides.add(t),t.finalGrp=this.id;for(let e of t.connect)this.others.add(e)}polyline(){let t=new Array;return g7(this.sides,(e,r)=>(t.push(r.shape),!0)),ge.build2(t).asClose()}hashCode(){return this.id}equals(t){return t!=null&&t instanceof X_e?this.id===t.id:!1}},q_e=class{constructor(o){this.bo=null,this.sides=new Array,this.polyGrp=0,this.polyIndex=0,this.prevSide=null,this.firstSide=null,this.noWeight0=o}completeGroup(o){this.prevSide!=null&&this.firstSide!=null&&!this.prevSide.end.equals(this.firstSide.start)&&this.addSide(new M(this.prevSide.end,this.firstSide.start),o);let t=new Array,e=null,r=null;for(let i of this.sides)(!this.noWeight0||i.weight!==0)&&(e!=null?(e.next=i,i.previous=e):r=i,e=i,t.push(i));return e!=null&&r!=null&&(r.previous=e,e.next=r),this.polyGrp++,this.sides.length=0,this.prevSide=null,this.firstSide=null,this.polyIndex=0,t}buildGroup(o,t,e,r=!0){for(let i of o.primitives)if(i instanceof M)this.addSide(i,t);else if(r&&i instanceof q&&i.rx===i.ry)this.addArc(i,t);else{let n=null;for(let s of i.points(e))n!=null&&this.addSide(new M(n,s),t),n=s}return this.completeGroup(t)}addArc(o,t){let e=o.sweepAngle,r=so.regularD(o.startAngle),i=r+e;if(e>0){let n=90;for(;n<=i;)n>r&&(this.addSide(q.build3(o.center,r,n-r,o.rx,o.ry),t),r=n),n+=90;r<i&&this.addSide(q.build3(o.center,r,i-r,o.rx,o.ry),t)}else if(e<0){let n=270;for(;n>=i;)n<r&&(this.addSide(q.build3(o.center,r,n-r,o.rx,o.ry),t),r=n),n-=90;r>i&&this.addSide(q.build3(o.center,r,i-r,o.rx,o.ry),t)}}addSide(o,t){if(o.start().equals(o.end()))return;let e=o.start(),r;this.prevSide!=null?(this.prevSide.end.equals(e)||this.addSide(new M(this.prevSide.end,e),t),r=new b7(this.bo,o,t,o.start(),o.end(),this.polyGrp,this.polyIndex++)):(r=new b7(this.bo,o,t,o.start(),o.end(),this.polyGrp,this.polyIndex++),this.firstSide=r),this.prevSide=r,this.sides.push(r)}},$_e=class{constructor(o,t,e){this.eps=new Array,this.curWeight=0,this.start=null,this.last=null,this.prevStart=null,this.prevEnd=null,this.y=e,this.rule=o,this.bo=t,this.event=t.event}onEp(o){this.tuningWeight(o),this.start===null?this.rule(this.curWeight)?this.in(o):o.setInvalid(this.y):this.rule(this.curWeight)?o.setInvalid(this.y):this.out(o,this.start),this.last!==null&&this.event.onSweep1(this.last,o,this.y),this.last=o}in(o){this.prevEnd!=null&&this.onSameX(o,this.prevEnd)?(this.start=this.prevStart,this.prevStart=null,this.prevEnd.revokeInside(this.y),this.prevEnd=null):(this.start=o,this.start.setOutside(this.y))}out(o,t){if(this.onSameX(t,o))t.revokeOutside(this.y);else{if(o.setInside(this.y)>0&&t.confidence(this.y)>0){let e=t.voteStatus(),r=o.voteStatus();this.isValid(e)&&this.isValid(r)?e==2&&r==1&&(o.connect.push(t),t.connect.push(o)):(o.connect.push(t),t.connect.push(o))}this.event.onSegment1(t,o,this.y),this.eps.push(t),this.eps.push(o),this.prevStart=t,this.prevEnd=o}this.start=null}isValid(o){return o==1||o==2}onSameX(o,t){return o.bbox().isIntersect(t.bbox())&&sr.eq(o.getX(this.y),t.getX(this.y))}tuningWeight(o){this.curWeight+=o.weight;let t=o.nextNot0(),e=o.prevNot0();t!=null&&o.weight===t.weight&&t.trans===this.y&&(this.curWeight-=o.weight),e!=null&&o.weight===e.weight&&e.trans===this.y&&(this.curWeight-=o.weight),o.trans=this.y}},OK=new Error,S_e=new class extends JU{decide1(o){return o[0]&&o[1]}}(2),nJe=new class extends j_e{onPolylineGroup(o,t){throw OK}onSegment(o,t,e,r,i,n){throw OK}},oJe=class{constructor(o,t){this.rtree=o,this.level=t}},sJe=class K_e extends gK{static isIntersect(t,e,r=RK.DUMMY){let i=new K_e(r),n=i.createGroup1(t.items),s=i.createGroup2(e.items);return n.rtree.itemList.length==0||s.rtree.itemList.length==0?!1:i.isIntersect(n,s)}constructor(t){super(new q_e(!1),S_e.rule,t,nJe)}createGroup1(t){return this.createGroup(t,0)}createGroup2(t){return this.createGroup(t,1)}createGroup(t,e){let r=S_e.weight(e);for(let n of t)this.addPolyline(n,r);let i=this.buildRTree();return this.sides.length=0,new oJe(i,e)}isIntersect(t,e){if(t.level!==e.level){let r=t.rtree.bbox().intersection1(e.rtree.bbox());if(r!==null){try{this.inters(t,e);let i=(r.minY+r.maxY)/2;this.sweep(t,e,i)}catch(i){if(i===OK)return!0;throw i}return!1}else return!1}else throw new Error("inersection detection should not in same group")}inters(t,e){if(t.rtree.size()>e.rtree.size()){let r=t;t=e,e=r}for(let r of t.rtree.items()){r.trans=NaN;let i=r.bbox().extendOfSize(1e-5);for(let n of e.rtree.search(i))if(n.trans=NaN,G0(r.shape,n.shape)>0)throw OK}}sweep(t,e,r){let i=ht.extend2(t.rtree.bbox(),e.rtree.bbox()).extendOfSize(1e-5),n=new Array;this.fillValidSides(n,t.rtree.search(i),r),this.fillValidSides(n,e.rtree.search(i),r),cw(n,(a,l)=>a.getX(r)-l.getX(r),0,n.length);let s=new $_e(this.rule,this,r);for(let a of n)s.onEp(a)}},Bt=class vE{constructor(t){this.items=new Array(t.length),kg.arraycopy(t,0,this.items,0,t.length),this.__bbox=this.calcBBox()}static build1(t){let e=[];return bK(t,(r,i)=>(e.push(i),!0)),new vE(e)}static build2(t){let e=t.map(r=>ge.build8(r));return new vE(e)}static combinePolylineGroupArr(t){let e=[];for(let r of t)e=e.concat(r.items);return new vE(e)}calcBBox(){let t=new _e;for(let e=0;e<this.items.length;e++)t.ext1(this.items[e].bbox());return t.build1()}multiply3(t){let e=new Array(this.items.length);for(let r=0;r<e.length;r++)e[r]=this.items[r].multiply3(t);return new vE(e)}bbox(){return this.__bbox}asClose(){return this.items.forEach(t=>t.asClose()),this}mirrorY(t){return this.items.forEach(e=>e.mirrorY(t)),this}closeEndpoint(){return this.items.forEach(t=>t.closeEndpoint()),this}get primitives(){return this.items.map(t=>t.primitives).flat(2)}isEqual(t){return t instanceof vE?this.items.every(e=>t.items.some(r=>r.isEqual(e))):!1}getOutMostPolyline(){return this.items.reduce((t,e)=>e.bbox().area()>t.bbox().area()?e:t,this.items[0])}getOutline(){let t=this.items;if(t.length===1)return{outline:t,hole:new Array};let e=new Set,r=new Set;for(let i=0,n=t.length;i<n;i++){let s=t[i];if(!e.has(s)&&!r.has(s)){i+1>=n&&e.add(s);for(let a=i+1;a<n;a++){let l=t[a];if(!e.has(l)&&!r.has(l)){if(!s.bbox().isInside(l.bbox().extendOfSize(1e-4))&&!l.bbox().isInside(s.bbox().extendOfSize(1e-4)))continue;sJe.isIntersect(new vE([s]),new vE([l]))&&(s.bbox().area()>l.bbox().area()?(e.add(s),r.add(l)):(e.add(l),r.add(s)))}}!e.has(s)&&!r.has(s)&&e.add(s)}}return{outline:[...e],hole:[...r]}}round(t=4){let e=this.items.map(r=>r.round(t));return new vE(e)}},aJe=kg.funcCopy(cw),lJe=kg.funcCopy(cw),cJe=kg.funcCopy(cw);function hJe(o){return new Array}function uJe(o,t){let e=new qU(!1),r=new $U(o,RK.DUMMY,e);for(let i of t)r.addPolyline(i);return r.simplify(),e.plGrps}var $U=class extends gK{constructor(o,t,e){super(new q_e(!1),o,t,e),this.finalSides=new Array,this.sideGroups={},this.vecSides=new Array,this.scanY=NaN,this.curNetIndex=0,this.curIndex=-1,this.scanLines=0}sweep(o,t,e){this.scanY=NaN,this.scanLines=0,aJe(t,gK.sortByBBoxMinY,0,t.length);let r=new aw;this.curNetIndex=0;let i=Number.POSITIVE_INFINITY;for(let n of o)n>i&&this.scan(r,(i+n)/2,t),i=n;this.getAllMarkPrimitive(e,t),this.logger.debug3("scan %s %d",e,this.scanLines)}simplify(){this.seekIntersection(),this.splitSidesByInters(),this.sweep(this.getSortedEndpointsLineAsc(this.sides),this.sides,!1),this.flipSides(),this.sweep(this.getSortedEndpointsLineAsc(this.vecSides),this.vecSides,!0),this.connectSides(),this.fillResult()}addPolyline(o,t=1,e=.01,r=!0){super.addPolyline(o,t,e,r)}scan(o,t,e){if(this.scanY==t)return;this.scanY=t;let r=!1,i=o.listIterator();for(;i.hasNext();){let n=i.next(),s=n.item;sr.less(s.bbox().maxY,t)?o.remove(n):!r&&s.isNeedScan(t)&&(r=!0)}for(;this.curNetIndex<e.length;){let n=e[this.curNetIndex];if(sr.less(n.bbox().minY,t))sr.greatereq(n.bbox().maxY,t)&&(this.add2AET(o,n),!r&&n.isNeedScan(t)&&(r=!0)),this.curNetIndex++;else break}if(r){this.scanLines++;let n=new $_e(this.rule,this,t),s=o.iterator();for(;s.hasNext();){let a=s.next();n.onEp(a)}}}add2AET(o,t){let e=t.bbox().minX,r=t.bbox().maxX,i=t.bbox().minY,n=t.bbox().maxY,s=o.listIterator(),a=null;for(;s.hasNext();){let l,c=s.next(),h=c.item,u=h.bbox().minX,d=h.bbox().maxX;if(r<=u)l=-1;else if(d<=e)l=1;else{let m=h.bbox().minY,g=h.bbox().maxY,y=Math.max(i,m),b=Math.min(n,g);l=this.compareBySweep(t,h,(y+b)/2)}let p=h.shape;if(p instanceof M&&p.length()<.001&&a==null&&l<0){a=c;continue}if(a!=null&&l<0){o.insertBefore(a,t);return}if(l<0){o.insertBefore(c,t);return}else a=null}o.add(t)}getLineAngle(o){let t=o.start().angle(o.end());return t<0&&(t+=Math.PI),t}getArcAngle(o,t){let e=Math.asin((t-o.center.y)/o.rx);return o.startAngle>90&&o.startAngle<270&&(e=-e),e<0&&(e+=Math.PI),(e+Math.PI/2)%Math.PI}compareArcLine(o,t,e){let r=this.getArcAngle(o,e),i=this.getLineAngle(t);return sr.eq(r,i)?-o.sweepAngle:i-r}compareBySweep(o,t,e){let r=o.getX(e);if(!isFinite(r))return 0;let i=t.getX(e);if(!isFinite(i))return 0;if(!sr.eq(r,i))return r-i;if(o.shape instanceof M)return t.shape instanceof M?this.getLineAngle(t.shape)-this.getLineAngle(o.shape):-this.compareArcLine(t.shape,o.shape,e);if(t.shape instanceof M)return this.compareArcLine(o.shape,t.shape,e);{let n=o.shape,s=t.shape,a=this.getArcAngle(n,e),l=this.getArcAngle(s,e);return sr.eq(a,l)?n.sweepAngle*s.sweepAngle<=0?n.sweepAngle<=0?1:-1:n.sweepAngle>0?n.rx-s.rx:s.rx-n.rx:l-a}}getAllMarkPrimitive(o,t){for(let e of t)if(e.status===0&&e.bbox().height()!=0){let r=e.voteStatus();if(r===2||r===1){e.status=r;let i=e.reverse(r);if(o){this.event.onResultSide(i);let n=i.shape.multiply3(Qe.ROT_N90),s=i.start.multiply3(Qe.ROT_N90),a=i.end.multiply3(Qe.ROT_N90);i=new b7(this,n,i.baseWeight,s,a,i.polyGrp,i.polyIndex)}this.finalSides.push(i),this.event.onResultSide(i)}}}flipSides(){for(let o of this.sides)if(o.polyIndex==0){let t=null,e=null;do{let r=o.shape.multiply3(Qe.ROT_90),i=o.start.multiply3(Qe.ROT_90),n=o.end.multiply3(Qe.ROT_90),s=new b7(this,r,o.baseWeight,i,n,o.polyGrp,o.polyIndex);if(s.outsideWeight=o.outsideWeight,s.insideWeight=o.insideWeight,s.invalidWeight=o.invalidWeight,s.status=o.status,t!=null?(t.next=s,s.previous=t):e=s,this.vecSides.push(s),this.event.onSplitedSide(s),t=s,o.next!==null)o=o.next;else break}while(o.polyIndex!=0);e!=null&&(e.previous=t,t.next=e)}}canBeEnd(o,t){if(o.size()==1){let e=o.getFirst().shape;if(e instanceof q){if(t&&e.rx<=t)return!1}else if(e instanceof M&&t&&e.length()<=t)return!1}return!0}connectSides(){let o=new EK,t=new i2(10);for(let n of this.finalSides)o.computeIfAbsent(n.start,hJe).push(n),t.add(n.start);let e=0,r=new y7,i=new Array;for(let n of this.finalSides)if(!r.contains(n)){let s=new y7,a=n.start,l=new aw;l.add(n),r.add(n);let c=n.end;for(;l.size()>0;)if(this.isStart(a,c)&&this.canBeEnd(l,.01)){l.size()>1&&this.fillSideGroups(l,e++);break}else{let h=o.get(c),u=this.findNext(r,h);if(u==null&&(c=this.findNeigber(c,s,t,.01),c!==null&&(h=o.get(c),u=this.findNext(r,h))),u!=null)l.add(u),r.add(u),c=u.end;else if(c!=null?s.add(c):(i.length==0&&l.size()>1&&this.logger.warning3("unable to connect at %s",l.getLast()),i.push(l.removeLast())),l.size()>0)c=l.getLast().end;else break}}}fillSideGroups(o,t){let e=new iJe(t);g7(o,(r,i)=>(e.add(i),!0)),this.sideGroups[e.id]=e}isStart(o,t){return o.distance2(t)<=1e-4}findNext(o,t){if(t!=null){for(let e of t)if(!o.contains(e))return e}return null}fillResult(){let o=0,t=new EK;for(let r in this.sideGroups){let i=this.sideGroups[r];g7(i.sides,(n,s)=>(s.polyGrp!=-2&&t.put(s,s),!0))}let e=new y7;for(let r in this.sideGroups){let i=this.sideGroups[r];if(e.add(i)){let n=0,s=new Array;for(s.push(i);n<s.length;){let l=s[n],c=new Array;g7(l.others,(u,d)=>{let p=t.get(d);return p!=null&&c.push(p.finalGrp),!0}),lJe(c,kg.sortAsc,0,c.length);let h=l.id;for(let u of c)if(u!=h&&u!=l.id){let d=this.sideGroups[u];e.add(d)&&s.push(d),h=u}n++}let a=new Array;for(let l of s)a.push(l.polyline());cJe(a,gK.sortByBBoxAreaDesc,0,a.length),this.event.onPolylineGroup(new Bt(a),o++)}}}findNeigber(o,t,e,r){let i=r*r,n=Number.MAX_VALUE,s=null;for(let a of e.search(o.bbox().extendOfSize(r)))if(!t.contains(a)){let l=o.distance2(a);l<n&&(n=l,s=a)}return n<i?s:null}},dJe=class{constructor(){this.points=[],this.lines=[],this.arcs=[],this.beziers=[],this.listText=[],this.fonts=[]}addPt(o,t=!0){if(o instanceof M)this.lines.push(o);else if(o instanceof q)this.arcs.push(o);else if(o instanceof Dr)this.beziers.push(o);else throw new Error("not support");t&&this.points.push(o.start())}addPoint(o){this.points.push(o)}addText(o,t,e=1,r=.1,i=!0){this.listText.push({pos:o,str:t,size:e,width:r}),i&&this.points.push(o)}addPly(o,t=!0){o.primitives.forEach(e=>this.addPt(e,t))}build(){let o=[],t=[],e=[],r=[],i=[],n=[];return this.points.forEach(s=>o.push(s.x,s.y)),this.lines.forEach(s=>t.push(s.start().x,s.start().y,s.end().x,s.end().y)),this.arcs.forEach(s=>e.push(s.center.x,s.center.y,s.rx,so.toRadians(s.startAngle),so.toRadians(s.endAngle()),s.sweep())),this.beziers.forEach(s=>{s.controls.forEach(a=>{r.push(a.x,a.y)}),r.push("end")}),this.listText.forEach(s=>i.push(s.pos.x,s.pos.y,s.str,s.width,s.size)),this.fonts.forEach(s=>n.push(s)),{points:o,lines:t,arcs:e,texts:i,beziers:r,fonts:n}}},Age=class Z_e{constructor(t){this.map=new EK,this.bus=t}initColor(t){return this.map.computeIfAbsent(t,()=>new dJe)}draw(){let t={},e=this.map.entries();for(;e.hasNext();){let r=e.next();t[r.key.toString()]=r.value.build()}this.bus.publish("/debug/draw",t)}clear(){this.map.clear()}static init(t){if(!t)throw new Error("bus is undefined!");this.palette=new Z_e(t)}static initPalette(t){this.palette=t}static getDefaultColor(){for(let t of this.colorBuffersMap)if(t[0]!==null&&t[0])return t[0]=!1,t[1];return this.colorBuffersMap.forEach(t=>{if(t[0]===null){console.log(1);return}t[0]=!0}),this.getDefaultColor()}static clear(){this.palette.clear()}static auto(t,e=this.getDefaultColor()){if(Array.isArray(t))t.forEach(r=>{this.auto(r,e)});else if(t instanceof S)this.point(t,e);else if(t instanceof ht)this.bbox(t,e);else if(t instanceof rl)this.primitive(t,e);else if(t instanceof ge)this.polyline(t,e);else if(t instanceof Zo)this.polygon(t,e);else if(t instanceof Fo)this.group(t,e);else if(t instanceof Bt)this.auto(t.items,e);else{debugger;throw new Error("No incoming type!")}}static text(t,e,r=.5,i=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");this.palette.initColor(i).addText(t,e,r,r/10),this.palette.draw()}static point(t,e=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");let r=this.palette.initColor(e);Array.isArray(t)?t.forEach(i=>{this.point(i,e)}):r.addPoint(t),this.palette.draw()}static bbox(t,e=this.getDefaultColor()){Array.isArray(t)?t.forEach(r=>{this.bbox(r,e)}):(this.primitive(new M(new S(t.maxX,t.maxY),new S(t.maxX,t.minY)),e),this.primitive(new M(new S(t.maxX,t.maxY),new S(t.minX,t.maxY)),e),this.primitive(new M(new S(t.minX,t.minY),new S(t.maxX,t.minY)),e),this.primitive(new M(new S(t.minX,t.minY),new S(t.minX,t.maxY)),e))}static primitive(t,e=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");let r=this.palette.initColor(e);Array.isArray(t)?t.forEach(i=>{this.primitive(i,e)}):r.addPt(t),this.palette.draw()}static polyline(t,e=this.getDefaultColor()){Array.isArray(t)?t.forEach(r=>{this.polyline(r,e)}):t.primitives.forEach(r=>{this.primitive(r,e)})}static polygon(t,e=this.getDefaultColor()){Array.isArray(t)?t.forEach(r=>{this.polygon(r,e)}):t.items.forEach(r=>{this.polyline(r,e)})}static group(t,e=this.getDefaultColor()){Array.isArray(t)?t.forEach(r=>{this.group(r,e)}):t.items.forEach(r=>{this.polygon(r,e)})}static async begin(){this.t1=performance.now()}static async end(t){console.log(t||"t1:",performance.now()-this.t1)}static async log(t){console.log(t||"==================")}};Age.colorBuffersMap=[[!0,Il.BLUE],[!0,Il.GREEN],[!0,Il.WHITE],[!0,Il.RED],[!0,Il.Golden],[!0,Il.Gray]],Age.t1=0;var QU=Age,pJe=0,eH=class _ge{constructor(t,e){this.inters=[],this.shape=t,this.start=t.start(),this.end=t.end(),this.judgeOverlapMap=new Map,e&&(this.id=pJe++)}reverse(){this.shape=this.shape.reverse();let t=this.start;this.start=this.end,this.end=t}getCenterPoint(t=this.end){let{x:e,y:r}=this.start,{x:i,y:n}=t;if(this.shape instanceof q){let s=this.shape.rx,a=new S((e+i)/2,(r+n)/2),l=this.shape.center,c;return a.x!==l.x||a.y!==l.y?(c=a.angle(l),Math.abs(this.shape.sweepAngle)>180&&(c+=c>=0?-180:180)):c=(this.shape.startAngle+this.shape.endAngle())/2,new S(l.x+Math.cos(c)*s,l.y+Math.sin(c)*s)}else{if(this.shape instanceof M)return new S((e+i)/2,(r+n)/2);if(this.shape instanceof Dr){let s=this.shape.getPercent(t,Zn);return Dr.pointOn(s/2,this.shape.controls)}else throw Error("not support")}}static finalAngle(t,e,r){let i=t.cross(e)>0,n=Math.acos(Math.min(1,Math.max(-1,t.dot(e)/e.length())));return(r?!i:i)&&(n=DK-n),n}sortInters(){if(this.shape instanceof q){let t=this.shape.center,e=this.shape.start().sub(t).normalize(),r=this.shape.isCCW;this.inters.sort((i,n)=>{let s=i.coord.sub(t),a=n.coord.sub(t);return _ge.finalAngle(e,s,r)-_ge.finalAngle(e,a,r)<=0?-1:1})}else if(this.shape instanceof M){let t=this.start,e=this.end,r=new S(e.x+(t.x-e.x)*2,e.y+(t.y-e.y)*2);this.inters.sort((i,n)=>i.coord.distance2(r)-n.coord.distance2(r)<=0?-1:1)}else if(this.shape instanceof Dr){let t=this.shape;this.inters.sort((e,r)=>t.getPercent(e.coord,Zn)-t.getPercent(r.coord,Zn)<=0?-1:1)}else throw Error("not support the primitive type");this.inters.forEach((t,e)=>t.setIndex(e))}getStart(){return this.start}getEnd(){return this.end}getShape(){return this.shape}connect(t){this.nextSide=t,t.prevSide=this}static returnPolygonList(t){let e=[];return t.forEach(r=>{let i=[];r.forEach((n,s)=>{let a=[];n.forEach(l=>{a.push(l.shape)}),i.push(ge.build7(a))}),e.push(new Zo(i))}),e}addInter(t){this.inters.push(t)}static returnPolygonGroup(t){let e=[];return t.forEach(r=>{let i=[];r.forEach((n,s)=>{let a=[];n.forEach(l=>{a.push(l.shape)}),i.push(ge.build7(a))}),e.push(new Zo(i))}),new Fo(e)}static rebuild(t,e,r){let i;if(t instanceof M||e.distance2(r)<1e-6)i=new M(e,r);else if(t instanceof q)i=q.build2(t.center,e.angleD(t.center),r.angleD(t.center),t.rx,t.ry,t.isCCW?1:0);else if(t instanceof Dr){let n=t.getPercent(e,Zn),s=t.clip(n)[1];i=s.clip(s.getPercent(r,Zn))[0]}else throw new Error("not supported operation");return Kn(t,e).dot(Kn(i,e))<0?null:i}static returnPolyline(t){return ge.build7(t.map(e=>e.shape))}bbox(){return this.shape.bbox()}};function Bg(o,t,e){if(o instanceof q&&t instanceof q)return gJe(o,t);if(o instanceof q&&t instanceof M)return A_e(o,t);if(o instanceof M&&t instanceof q)return O_e(o,t);if(o instanceof M&&t instanceof M)return lw(o,t);if(o instanceof Dr&&t instanceof M)return o.controls.length===2||LE(o)?lw(new M(o.start(),o.end()),t):J_e(o,t);if(o instanceof M&&t instanceof Dr)return t.controls.length===2||LE(t)?lw(o,new M(t.start(),t.end())):vge(o,t);if(o instanceof q&&t instanceof Dr)return t.controls.length===2||LE(t)?A_e(o,new M(t.start(),t.end())):fJe(o,t);if(o instanceof Dr&&t instanceof q)return o.controls.length===2||LE(o)?O_e(new M(o.start(),o.end()),t):mJe(o,t);if(o instanceof Dr&&t instanceof Dr)return Fge(o,t);throw new Error("not support")}function s7(o,t){return Kn(o,t.start()).dot(Kn(t,t.start()))<=0?!1:Bg(o,t).state<=2}function cge(o,t){let e=t.getPercent(o.end(),Zn);if(e===null)return!1;if(e===0)return!0;let r=t.clip(e)[0],i=o.buildConverxHull(Zn),n=r.buildConverxHull(Zn),s=c(i),a=c(n);return l(s,a);function l(h,u){let d=new Map([[0,1],[1,0],[2,2],[3,4],[4,3]]),p=h[0],m=u[0];if(!p||!m)throw Error("isAllOverlap(sides1: PackSide[], sides2: PackSide[])");let g=!0;do{let y=p.getShape(),b=m.getShape();if(y instanceof M&&b instanceof M){let P=g?lw(y,b).state:d.get(lw(b,y).state);if(P===0)p=p.nextSide,g=!1;else if(P===1)m=m.nextSide,g=!0;else if(P===2)p=p.nextSide,m=m.nextSide,g=!0;else return!1}else throw Error("not support")}while(p!==h[0].prevSide&&m!==u[0].prevSide);return!0}function c(h){let u=h.primitives.map(p=>new eH(p)),d=u[u.length-1];return u.forEach(p=>{d.connect(p),d=p}),u}}function E_e(o,t){let e=o.end().distance2(t.center);if(e>(t.rx+Zn)**2||e<(t.rx-Zn)**2||!(rn(o.end(),t.end())||Vge(t,o.end())))return!1;if(o.center.equals1(t.center))return!0;let r=o.center.distance1(t.center),i=Math.abs(o.rx-t.rx);if(r>Math.min(o.rx,t.rx)){let n=o.center.angleD(t.center);return o.rx>t.rx?!(r+i>Zn&&u9(o,n))&&!(r-i>Zn&&o.rx+t.rx-r>Zn&&u9(o,n+180)):!(r-i>Zn&&u9(o,n))&&!(o.rx+t.rx-r>Zn&&u9(o,n+180))}else{if(r+i<=Zn)return!0;let n=o.rx>t.rx?o.center.angleD(t.center):t.center.angleD(o.center);return u9(o,n)?!1:r-i<=Zn?!0:!u9(o,n+180)}}function fJe(o,t){let e=Gge(o,t.start()).toBezier2(),r,i=0;for(let n=e.length;i<n;i++){let s=e[i];if(r=Fge(s,t).state,r!==0)break}return r===2&&i!==e.length-1?{state:1}:{state:r}}function mJe(o,t){let e=t.toBezier2(),r,i=0;for(let n=e.length;i<n;i++){let s=e[i];if(r=Fge(o,s).state,r!==1)break}return r===2&&i!==e.length-1?{state:0}:{state:r}}function Fge(o,t){if(o.controls.length===2||LE(o))return t.controls.length===2||LE(t)?lw(new M(o.start(),t.end()),new M(t.start(),t.end())):vge(new M(t.start(),o.end()),t);if(t.controls.length===2||LE(t))return J_e(xge(o,t.start()),new M(t.start(),t.end()));let e=xge(o,t.start());if(LE(e))return vge(new M(t.start(),o.end()),t);let r=cge(e,t),i=cge(t,e);if(!r&&!i){let n=LZe(e,t);if(n.havOverlap){let s=n.havOverlap!==2,a=n.havOverlap!==1;return NE(o,t,s,a)}else{let s=function(){for(let u=0;u<c;u+=2)$e[u]=h[u],$e[u+1]=h[u+1]},a,l,c=n.cnt,h=new Array(c).fill(0).map((u,d)=>$e[d]);for(let u=0;u<c;u+=2){let d=new S($e[u],$e[u+1]),p=e.getPercent(d,Zn),m=t.getPercent(d,Zn);if(p===0||m===0)continue;let g=p===1?e:e.clip(p)[0],y=m===1?t:t.clip(m)[0];if(cge(g,y)){let b=Kn(o,d).cross(Kn(t,d));if(b===0){a=e.end(),l=t.end();break}return{state:b<0?3:4}}s()}return(!a||!l)&&(a=m7(e.controls,e.controls[0],t),l=m7(t.controls,e.controls[0],e)),{state:a.sub(e.controls[0]).cross(l.sub(e.controls[0]))>0?4:3}}}return NE(o,t,r,i)}function J_e(o,t){let e=xge(o,t.start());if(LE(e))return lw(new M(e.start(),e.end()),t);let r=eve(e,t),{isIn:i,bezierIsInLeft:n}=Q_e(t,e);if(!r&&!i){if(n!==void 0)return{state:n?3:4};let s=null,a=o.getPercent(t.start(),Zn)+.01;for(let l=a>1?1:a;l<=1;){let c=Dr.pointOn(l,o.controls);if(ZU(t,c)>Fg){s=c;break}l+=.01,l>1&&(l=1)}if(!s)throw Error("!end1 && !end2 not result");return{state:t.direct.cross(s.sub(t.start()))<0?4:3}}return NE(e,t,r,i)}function vge(o,t){let{isIn:e,bezierIsInLeft:r}=Q_e(o,t),i=eve(t,o);if(!e&&!i){if(r!==void 0)return{state:r?4:3};let n=null;for(let s=.01;s<=1;){let a=Dr.pointOn(s,t.controls);if(ZU(o,a)>Fg){n=a;break}s+=.01,s>1&&(s=1)}if(!n)throw Error("!end1 && !end2 not result");return{state:o.direct.cross(n.sub(o.start()))<0?3:4}}return NE(t,o,e,i)}function gJe(o,t){let e=E_e(Gge(o,t.start()),t),r=E_e(t,o);if(!e&&!r){let i=SC(t);if(o.center.sub(t.start()).dot(t.center.sub(t.start()))>0){if(o.rx===t.rx)return o.isCCW?{state:i.dot(o.center.sub(t.center))<0?3:4,exitIsInvalid:!1}:{state:i.dot(o.center.sub(t.center))>0?3:4,exitIsInvalid:!1};let n,s;return o.rx>t.rx?(n=o,s=t):(n=t,s=o),i.dot(s.center.sub(n.center))>0&&s.rx+s.center.distance1(n.center)-n.rx>Zn?o.isCCW?{state:o.rx>t.rx?3:4,exitIsInvalid:!1}:{state:o.rx<t.rx?3:4,exitIsInvalid:!1}:o.isCCW?{state:o.rx<t.rx?3:4,exitIsInvalid:!0}:{state:o.rx>t.rx?3:4,exitIsInvalid:!0}}else return o.rx+t.rx-o.center.distance1(t.center)>Zn&&i.dot(o.center.sub(t.center))>0?{state:t.isCCW?3:4,exitIsInvalid:!1}:{state:o.isCCW?3:4,exitIsInvalid:!0}}return NE(o,t,e,r)}function O_e(o,t){let e=er.foot(o,t.center),r=o.end().distance2(t.center),i=o.end().sub(o.start()),n=(t.rx-Zn)**2,s=r<=(t.rx+Zn)**2&&r>=n&&(i.dot(e.sub(t.start()))<=0||o.start().distance2(o.end())<=o.start().distance2(e)||e.distance2(t.center)>=n)&&(rn(o.end(),t.end())||Vge(t,o.end())),a=tve(t,o);if(!s&&!a){let l=o.distance2(t.center);return l<=Fg?{state:i.cross(SC(t))>0?4:3}:i.dot(e.sub(t.start()))>=0&&(r<n||o.start().distance2(t.center)<n||l<n)?{state:i.cross(t.center.sub(o.start()))<0?4:3}:{state:i.cross(t.center.sub(o.start()))>0?4:3}}return NE(t,o,s,a)}function u9(o,t){return t=so.regularD(t),o.sweepAngle>0?(t<o.startAngle&&(t+=360),o.endAngle()>t):(t>o.startAngle&&(t-=360),o.endAngle()<t)}function Vge(o,t){return rn(o.end(),t)||rn(o.start(),t)||u9(o,t.angleD(o.center))}function Q_e(o,t){let e=o.panDistance(Zn),r=o.panDistance(-Zn),i=__e(t,e),n=__e(t,r);if(!i.length&&!n.length)return{isIn:t.getPercent(o.end(),Zn)!==null};let s=[...i,...n].sort((h,u)=>h.t-u.t),a=new M(r.start(),e.start()),l=[];for(let h=0,u=s.length;h<u;h++){let d=s[h];if(l.push(d),a.distance(d.interP)>o.length()+Zn)break;if(l.length===2){let p=(l[1].t*10+l.shift().t*10)/20,m=Dr.pointOn(p,t.controls);if(o.distance2(m)>Fg)return{isIn:!1,bezierIsInLeft:o.direct.cross(m.sub(o.start()))>0}}}let c=l.length?a.distance(l[0].interP)>=o.length()+Zn:!0;return{isIn:c,bezierIsInLeft:c?void 0:o.direct.cross(l[0].interP.sub(o.start()))>0}}function eve(o,t){if(ZU(t,o.end())>Fg||o.getToLineMaxDis2(t)>Fg)return!1;let e=bJe(t,Fg);return o.getToLineMaxDis2(e)<=(t.length()+Zn)**2}function tve(o,t){let e=t.end().angleD(t.start()),r=yJe(t,o.end());if(r>Fg)return!1;if(u9(o,e+90)){if(er.foot(t,o.center).distance1(o.pointOn(e+90))>o.rx)return!1;r=Math.max(r,(o.rx-t.distance(o.center))**2)}if(u9(o,e-90)){if(er.foot(t,o.center).distance1(o.pointOn(e-90))>o.rx)return!1;r=Math.max(r,(o.rx-t.distance(o.center))**2)}return r<=Fg&&(rn(o.end(),t.end())||Rge(t,o.end()))}var rve=(Zn*2)**2;function Gge(o,t){if(rn(o.end(),t))return q.build3(o.center,o.endAngle(),0,o.rx,o.ry);if(o.start().distance2(t)<rve)return o;let e=so.regularD(t.angleD(o.center));if(!u9(o,e))throw new Error("!angleIsInArc(arc, angle)");return q.build2(o.center,e,o.endAngle(),o.rx,o.ry,o.isCCW?1:0)}function xge(o,t){if(rn(o.end(),t))return new Dr([t,t]);if(o.start().distance2(t)<rve)return o;let e=o.getPercent(t,Zn);if(e===null)throw new Error("!cutBezier(bezier: Bezier, p: Vector2)");return o.clip(e)[1]}function A_e(o,t){let e=tve(Gge(o,t.start()),t),r=t.end().distance2(o.center),i=t.end().sub(t.start()),n=er.foot(t,o.center),s=(o.rx-Zn)**2,a=r<=(o.rx+Zn)**2&&r>=s&&(i.dot(n.sub(t.start()))<=0||t.start().distance2(t.end())<=t.start().distance2(n)||n.distance2(o.center)>=s)&&(rn(o.end(),t.end())||Vge(o,t.end()));if(!e&&!a){let l=t.distance2(o.center);return l<=Fg?{state:i.cross(SC(o,t.start().angle(o.center)))>0?3:4}:i.dot(n.sub(t.start()))>=0&&(r<s||t.start().distance2(o.center)<s||l<s)?{state:i.cross(o.center.sub(t.start()))>0?4:3}:{state:i.cross(o.center.sub(t.start()))<0?4:3}}return NE(t,o,e,a)}function lw(o,t){if(rn(o.end(),t.end()))return NE(o,t,!0,!0);let e=ZU(t,o.end())<=Fg&&Rge(t,o.end()),r=ZU(o,t.end())<=Fg&&Rge(o,t.end());if(!e&&!r){let i=o.direct.x===0&&o.direct.y===0,n=t.direct.x===0&&t.direct.y===0;if(i&&n)throw Error("2LineAllIsPoint");return i?{state:t.direct.cross(o.end().sub(t.start()))>0?3:4}:{state:o.end().sub(o.start()).cross(t.end().sub(o.start()))>0?4:3}}return NE(o,t,e,r)}function Rge(o,t){return er.foot(o,t).distance2(o.start())<o.end().distance2(o.start())}function NE(o,t,e,r){if(e)return r?rn(o.end(),t.end())?{state:2}:{state:0}:{state:0};if(r)return{state:1};throw new Error("!end1 && !end2")}function ZU(o,t){return(o.a*t.x+o.b*t.y+o.c)**2/(o.a**2+o.b**2)}function yJe(o,t){return Math.min(o.distance2(t),er.foot(o,t).distance2(t))}function bJe(o,t){let e=o.panDistance(t),r=o.panDistance(-t);return new M(r.start(),e.start())}function LE(o){let t=o.start(),e=o.end();t.equals1(e)&&(e=t.add1(1,0));let r=e.y-t.y,i=t.x-e.x,n=-r*t.x-i*t.y,s=Math.sqrt(1/(r**2+i**2));r*=s,i*=s,n*=s;let a=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;return o.controls.forEach(c=>{let h=r*c.x+i*c.y+n;h<a&&(a=h),h>l&&(l=h)}),f9(a,l)}function __e(o,t){let e=G0(o,t),r=[],i=new Array(e).fill(0).map((s,a)=>$e[a]);for(let s=0;s<e;s+=2){let a=new S($e[s],$e[s+1]),l=o.getPercent(a);r.push({interP:a,t:l}),n()}function n(){for(let s=0;s<e;s+=2)$e[s]=i[s],$e[s+1]=i[s+1]}return r}var h9=.01,PJe=270;function bf(o){let t=h9**2,e=o.end(),r=[],i=[];for(let p=0,m=o.primitives.length;p<m;p++){let g=function(v,D){return v instanceof M&&D instanceof M&&Math.abs(v.direct.cross(D.direct))<sr.eps&&v.direct.dot(D.direct)>0||v instanceof q&&D instanceof q&&Math.abs(v.rx-D.rx)<=sr.eps&&v.center.distance2(D.center)<sr.eps&&v.isCCW===D.isCCW},y=function(v){if(lP(v,h9))i.push(null);else{if(v instanceof M)i.push(v);else if(v instanceof q&&v.rx===v.ry)u(v,i);else if(v instanceof Dr){let D=[];U_e(v,D),D.forEach(w=>{let F=w.start(),H=w.end();h(F,H)||i.push(w)})}else throw new Error("not support!");e=I}},b=function(v){if(v instanceof M)return v.direct.x===0&&v.direct.y===0;if(v instanceof q)return v.sweepAngle===0;if(v instanceof Dr){let D=new Set(v.controls.map(F=>F.x)),w=new Set(v.controls.map(F=>F.y));return D.size===1&&w.size===1}else throw new Error("not support")},P=o.primitives[p],T=P.start(),I=P.end();if(b(P))continue;h(e,T)||(i.push(new M(e,T)),e=T);let C=(p+1)%m,E=o.primitives[C];for(;g(P,E)&&(C=(C+1)%m,E=o.primitives[C],E!==P););if(C===(p+1)%m){y(P);continue}if(E===P){if(!(P instanceof q)){if(Math.abs(o.area(.1))<t)return null;throw new Error("simplifyPolyline not support")}let v=P instanceof q?P.isCCW:o.area(.1)>0;i.length=0;let D=v?180:-180;i.push(q.build3(P.center,P.startAngle,D,P.rx,P.ry),q.build3(P.center,P.startAngle+D,D,P.rx,P.ry));break}let O=(()=>{if(P instanceof M)return(v,D)=>{let w=new M(v,D);return lP(w,h9)?null:[w]};if(P instanceof q)return(v,D)=>{let w;if(v.equals1(D)?w=q.build3(P.center,P.startAngle,P.sweep()===1?360:-360,P.rx,P.ry):w=q.build4(v,D,P.center,P.rx,P.ry,P.sweep()),lP(w,h9))return null;let F=w.pointOn(w.startAngle+w.sweepAngle/2),H=q.build4(w.start(),F,P.center,P.rx,P.ry,P.sweep()),z=q.build4(F,w.end(),P.center,P.rx,P.ry,P.sweep());return lP(H,h9)||lP(z,h9)?[w]:[H,z]};throw new Error("not support")})(),_=C===0;if(C<p&&!_&&(_=!O(o.primitives[0].start(),o.primitives[C-1].end()),!_)){let v=O(P.start(),i[0].end());if(v.length===1)i[0]=v[0];else if(v.length===2)i[0]=v[1],i.push(v[0]);else throw new Error("!!!generatorPt");break}p=C===0?m-1:C-1,E=o.primitives[p];let x=O(P.start(),E.end());if(x?(x.forEach(v=>i.push(v)),e=E.end()):y(null),_)break}let n=i.length;if(i.forEach((p,m)=>{if(p)r.push(p);else{let g,y;m===n-1&&(g=r[0],y=r[r.length-1]);let b=(m+1)%n;if(g=g!=null?g:i[b],g){let P=m,T=!1;for(;y=y!=null?y:i[(--P+n)%n],y!==g;)if(y){T=!0;break}if(T){if(g.start().equals1(y.end()))return;if(Kn(y,y.end()).dot(Kn(g,g.start()))<0){if(!h(y.end(),g.start())){let O=new M(y.end(),g.start());r.push(O);return}let{rebuildPrevPt:I,rebuildNextPt:C,rebuildLinkLine:E}=v_e(i[(P-1+n)%n],y,new M(y.end(),g.start()),g,i[(m+2)%n]);I&&C&&(I!==y?(i[(P+n)%n]=I,r[r.length-1]&&(r[r.length-1]=I)):C!==g&&(i[(m+1)%n]=C,r[0]===g&&(r[0]=C)),E&&r.push(E))}}}}}),r.length===0)return null;h(e,r[0].start())||r.push(new M(e,r[0].start()));let s=r[r.length-1];if(r.length===1)return s instanceof q?ge.build7([q.build2(s.center,0,180,s.rx,s.ry,s.sweep()),q.build2(s.center,180,360,s.rx,s.ry,s.sweep())]):s instanceof Dr?ge.build7(s.clip(.5)):null;let a=r.map(p=>new TJe(p)),l=a[a.length-1];for(a.forEach(p=>{p.connect(l),l=p});!l.isVisited;){let p=function(){l.next.connect(g),l=l.next,l.isConnected=!1,l.isVisited=!1},m=function(){l.connect(g.prev),l.isConnected=!1},g=l.prev;if(l===g)break;let y=l.pt,b=g.pt,P=b.end();if(!l.isConnected&&!P.equals(y.start())){let T=function(C){l.isConnected=!0,l.pt=y=C,l.next.isVisited=!1},I=function(C){l.isConnected=!0,g.pt=C,g.isVisited=!1,l=g};if(y instanceof M)if(h(P,y.end())){p();continue}else T(new M(P,y.end()));else if(b instanceof M){h(b.start(),y.start())?m():I(new M(b.start(),y.start()));continue}else if(y instanceof Dr)if(h(P,y.end())&&!(y.controls.length!==2&&y.getToLineMaxDis2(y.startToEndL)>=t)){p();continue}else T(new Dr([P,...y.controls.slice(1)]));else if(b instanceof Dr)h(b.start(),y.start())&&!(b.controls.length!==2&&b.getToLineMaxDis2(b.startToEndL)>=t)?m():I(new Dr([...b.controls.slice(0,-1),y.start()]));else if(y instanceof q&&b instanceof q)if(Math.abs(Math.abs(y.sweepAngle)-180)<Math.abs(Math.abs(b.sweepAngle)-180)){let C=q.build5(P,y.end(),y.sweepAngle);if(h(C.start(),C.end())&&!(C.rx>=h9&&Math.abs(C.sweepAngle)>180)){p();continue}else T(C)}else{let C=q.build5(b.start(),y.start(),b.sweepAngle);h(C.start(),C.end())&&!(C.rx>=h9&&Math.abs(C.sweepAngle)>180)?m():I(C);continue}else throw new Error("not support")}if(Kn(y,y.start()).dot(Kn(b,b.end()))<0){let T=function(E,O,_,x,v,D){if(l.next===g){l=null;return}let{rebuildLinkLine:w,rebuildPrevPt:F,rebuildNextPt:H}=v_e(E,O,_,x,v);F&&H&&(F!==O&&(g.prev.pt=F),H!==x&&(l.next.pt=H),w?D.pt=w:p())},I=function(){l.next===g?l=null:(l.next.connect(g.prev),l=l.next,l.isConnected=!1,l.isVisited=!1)},C=Bg(b.reverse(),y).state;if(C===0){let E=x_e(y,b.start(),y.end());if(d(E)){let O=g.prev.pt,_=l.next.pt;if(Kn(_,_.start()).dot(Kn(O,O.end()))>=0){if(I(),!l)break;continue}if(T(g.prev.prev.pt,O,E instanceof M?E:new M(E.start(),E.end()),_,l.next.next.pt,l),!l)break}else l.pt=E;m();continue}else if(C===1){let E=x_e(b,b.start(),y.end());if(d(E)){let O=g.prev.pt,_=l.next.pt;if(Kn(_,_.start()).dot(Kn(O,O.end()))>=0){if(I(),!l)break;continue}if(T(g.prev.prev.pt,O,E instanceof M?E:new M(E.start(),E.end()),_,l.next.next.pt,g),!l)break}else g.pt=E;p();continue}else if(C===2){if(I(),!l)break;continue}}l.isVisited=!0,l=l.next}if(!l)return null;r.length=0;let c=l;for(r.push(l.pt),l=l.next;l!==c;)r.push(l.pt),l=l.next;if(r.length===1){let p=r[0];return p instanceof q?(h(p.start(),p.end())?r[0]=q.buildCircle(p.center,p.rx,p.sweep()):r.push(new M(p.end(),p.start())),ge.build7(r)):p instanceof Dr?(h(p.start(),p.end())||r.push(new M(p.end(),p.start())),ge.build7(r)):null}if(o=ge.build7(r),Math.abs(o.area(.1))<t)return null;return o;function h(p,m){return p.distance2(m)<t}function u(p,m){if(Math.abs(p.sweepAngle)>PJe){let g=p.sweepAngle/2;u(q.build3(p.center,p.startAngle,g,p.rx,p.ry),m),u(q.build3(p.center,p.startAngle+g,g,p.rx,p.ry),m)}else m.push(p)}function d(p){return p.start().distance2(p.end())<t&&!(p instanceof q&&p.rx>=h9&&Math.abs(p.sweepAngle)>180||p instanceof Dr&&p.controls.length!==2&&p.getToLineMaxDis2(new M(p.start().add1(1,0),p.end()))>=t)}}function lP(o,t){if(!o)return!0;let e=o.start(),r=o.end();if(e.distance2(r)<t**2)if(o instanceof q){if(!(o.rx>=t&&Math.abs(o.sweepAngle)>180))return!0}else if(o instanceof Dr){if(!(o.controls.length!==2&&o.getToLineMaxDis2(new M(o.start().add1(1,0),o.end()))>=t))return!0}else return!0;return!1}function a7(o){if(o.direct.x===0&&o.direct.y===0)throw Error("getEndOfExtendLine(line: Line, distance: number)");let t=Math.abs(h9-o.length())+sr.eps,e={x:o.direct.normalize().x*t,y:o.direct.normalize().y*t},r=o.end();return new S(r.x+e.x,r.y+e.y)}function v_e(o,t,e,r,i){if(!o)s();else if(!i)a();else{let l=Kn(o,o.end()),c=Kn(t,o.end()),h=l.dot(c);if(h>=0)s();else{let u=Kn(r,r.end()),d=Kn(i,r.end()),p=u.dot(d);if(p>=0)a();else if(f9(h,-1)&&f9(p,-1)){let m=e.center();n(m),e=null}else h>p?s():a()}}function n(l){let c;if(t instanceof M)c=new M(t.start(),l);else if(t instanceof Dr)c=new Dr([...t.controls.slice(0,-1),l]);else if(t instanceof q)c=q.build5(t.start(),l,t.sweepAngle);else throw new Error("not supported");t=lP(c,Zn)?null:c;let h;if(r instanceof M)h=new M(l,r.end());else if(r instanceof Dr)h=new Dr([l,...r.controls.slice(1)]);else if(r instanceof q)h=q.build5(l,r.end(),r.sweepAngle);else throw new Error("supported");r=lP(h,Zn)?null:h}function s(){if(t instanceof M){let l=a7(e.reverse());e=new M(l,e.end());let c=new M(t.start(),l);t=lP(c,Zn)?null:c}else if(t instanceof Dr){let l=a7(e.reverse());e=new M(l,e.end());let c=new Dr([...t.controls.slice(0,-1),l]);t=lP(c,Zn)?null:c}else if(t instanceof q){let l=a7(e.reverse());e=new M(l,e.end());let c=q.build5(t.start(),l,t.sweepAngle);t=lP(c,Zn)?null:c}else throw new Error("not supported")}function a(){if(r instanceof M){let l=a7(e);e=new M(e.start(),l);let c=new M(l,r.end());r=lP(c,Zn)?null:c}else if(r instanceof Dr){let l=a7(e);e=new M(e.start(),l);let c=new Dr([l,...r.controls.slice(1)]);r=lP(c,Zn)?null:c}else if(r instanceof q){let l=a7(e);e=new M(e.start(),l);let c=q.build5(l,r.end(),r.sweepAngle);r=lP(c,Zn)?null:c}else throw new Error("not supported")}return{rebuildPrevPt:t,rebuildNextPt:r,rebuildLinkLine:e}}function x_e(o,t,e){if(o instanceof M||t.distance2(e)<=Fg)return new M(t,e);if(o instanceof q)return q.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.isCCW?1:0);if(o instanceof Dr){let r=o.getPercent(t,Zn),i=o.getPercent(e,Zn);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}var TJe=class{constructor(o){this.pt=o}connect(o){this.prev=o,o.next=this}};function AK(o){let t=kE(),e;if(o instanceof ge){let r=bf(o);if(r===null)return null;e=r}else if(o instanceof Zo){let r=o.items.map(i=>AK(i)).filter(i=>i!==null);if(r.length===0)return null;e=new Zo(r)}else{let r=o.items.map(i=>AK(i)).filter(i=>i!==null);if(r.length===0)return null;e=new Fo(r)}return Y2.preprocessPolyline+=wT(t),e}var Y2={addDocShapes2RTree:0,getPour:0,prepare:0,getSinglePourLayerPolyline:0,combindOutlines:0,mergeSameNet:0,run:0,end:0,deSelfIntersection:0,changeDirect:0,extend:0,preprocessPolyline:0,runBoolean:0,IntersectionSeeker:0,BooleanTools:0,totalBool:0};function kE(){return{timeIndex:Object.assign({},Y2),start:performance.now()}}function R_e(o){return Object.values(o).reduce((t,e)=>t+e,0)}function wT(o){return performance.now()-o.start-(R_e(Y2)-R_e(o.timeIndex))}function yf(o,t,e,r){let i=Il.RED,n=Il.Golden;function s(){if(!r)return;let d=r.initColor(Il.Golden);d.addPt(a),d.addPoint(a.end()),r.initColor(Il.RED).addPt(l),r.draw();debugger}let a=o.getShape(),l=e?t.getShape():t.getShape().reverse(),c=Kn(a,l.start()),h=Kn(l),u=c.cross(h);if(f9(u,0))if(a instanceof M)if(l instanceof M){if(sr.eq(u,0)&&(c.dot(h)>0?!rn(a.end(),l.start()):!rn(a.start(),l.start())))throw s(),new Error("line and line");return u<0}else{if(l instanceof q)return c.cross(l.center.sub(a.start()))<0;if(l instanceof Dr){let d=l.getExtremePoints(a),p=d.length?d[0]:m7(l.controls,a.start());return c.cross(p.sub(a.start()))<0}else throw new Error("not support")}else if(a instanceof q){if(l instanceof M)return a.isCCW;if(l instanceof q){if(l.center.equals1(a.center)&&(c.dot(h)>0?!rn(a.end(),l.start())&&a.end().sub(l.start()).dot(h)>0:!rn(a.start(),l.start())&&a.start().sub(l.start()).dot(h)>0))throw s(),new Error("arc and arc");return l.rx>=a.rx||l.center.distance2(a.center)>a.rx2?a.isCCW:!a.isCCW}else throw new Error("not support")}else if(a instanceof Dr)if(l instanceof M){let d=a.getPercent(l.start(),Zn),p=a.clip(d)[1],m=p.getExtremePoints(l);return(m.length?m[0]:m7(p.controls,l.start())).sub(l.start()).cross(h)<0}else if(l instanceof Dr){let d=a.getPercent(l.start(),Zn),p=a.clip(d)[1],m=p.getExtremePoints(new M(l.start(),l.end())),g=l.getExtremePoints(new M(p.start(),p.end())),y=m.length?m[0]:m7(p.controls,l.start()),b=g.length?g[0]:m7(l.controls,l.start()),P=y.sub(l.start()),T=b.sub(l.start());return P.cross(T)<0}else throw Error("not support");else throw new Error("not support");else return u<0}function hw(o,t,e,r,i){let n=o.getShape(),s=t.getShape(),a=n instanceof q?SC(n,so.toRadians(n.endAngle())):n instanceof Dr?KU(n,1):n.end().sub(n.start()).normalize(),l=Kn(s),c=a.dot(l);if(f9(c,-1))return yf(o,t,!0,i)?yf(o,e,r,i)&&yf(t,e,r,i):yf(o,e,r,i)||yf(t,e,r,i);{let h=a.scale(-1).angle(S.ORIGIN),u=l.angle(S.ORIGIN);h>u&&(h-=DK);let d=(h+u)/2,p=new S(Math.cos(d),Math.sin(d)),m=r?e.getShape():e.getShape().reverse(),g=Kn(m);return p.cross(g)<0?yf(o,e,r,i):yf(t,e,r,i)}}function hge(o,t,e,r,i){let n=o.getShape(),s=t.getShape(),a=n instanceof q?SC(n,so.toRadians(n.endAngle())):n instanceof Dr?KU(n,1):n.end().sub(n.start()).normalize(),l=Kn(s),c=a.dot(l);if(f9(c,-1))return yf(o,t,!0,i)?yf(o,e,r,i)&&yf(t,e,r,i):yf(o,e,r,i)||yf(t,e,r,i);{let h=a.scale(-1).angle(S.ORIGIN),u=l.angle(S.ORIGIN);h>u&&(h-=DK);let d=(h+u)/2,p=new S(Math.cos(d),Math.sin(d)),m=r?e.getShape():e.getShape().reverse(),g=Kn(m);if(p.cross(g)<0){let y=a.dot(g)<0,b=Bg(y?o.getShape().reverse():o.getShape(),m).state;return b!==3&&b!==4?yf(o,e,r,i):b===(y?4:3)}else{let y=l.dot(g)<0,b=Bg(y?t.getShape().reverse():t.getShape(),m).state;return b!==3&&b!==4?yf(t,e,r,i):b===(y?4:3)}}}var d9,I_=!1;function cP(o,t,e,r,i,n,s,a=e.side===t,l=!0,c){return d9=i,I_=n,ive(nve(o,t,l,c,s,e,a,r),e,a,r,0)}function RE(o,t,e,r,i,n,s,a=r.side===e){d9=i,I_=n;let l=ove(o,t,e,new Map,r,a,s),c=l instanceof Array?-1:1;return ive(l,r,a,s,c)}function ive(o,t,e,r,i){for(;o instanceof Array;)i++,o.length===4?o=ove(...o,t,e,r):o=nve(...o,t,e,r);return{...o,existOverlap:i>0}}function nve(o,t,e,r,i,n,s,a){if(_K===-1){a.initColor(Il.RED).addPt(o.getShape()),a.initColor(Il.Golden).addPt(t.getShape()),a.draw();debugger}let l=o.getShape(),c=s?t.getShape().reverse():t.getShape(),h=(l instanceof q?SC(l,e?c.start().angle(l.center):r?so.toRadians(l.endAngle()):void 0):l instanceof Dr?Kn(l,e?c.start():r?l.end():l.start()):l.end().sub(l.start())).normalize(),u=(c instanceof q?SC(c,e?void 0:(r?l.end():l.start()).angle(c.center)):c instanceof Dr?Kn(c,e?void 0:r?l.end():l.start()):c.end().sub(c.start())).normalize();if(r===void 0){let m=h.dot(u);if(r=m<0,f9(m,0))return{state:yf(o,t,!s,a)?1:0,inter:DE(o,t,n,s,e,r,i)}}else if(r?h.dot(u)>0:h.dot(u)<0)if(e){let m,g=!0;if(l instanceof M&&rn(er.foot(l,c.start()),r?l.end():l.start()))g=!1;else if(l instanceof q||l instanceof Dr){let y=r?l.reverse():l,b=Bg(c,FZe(y,c.start()).reverse()).state;(b===1||b===2)&&(g=!1)}if(g){let y=!r;m=Bg(y?l.reverse():l,c,a).state===(y?4:3)?1:0}else r?m=hw(o,o.nextSide,t,!s,a)?1:0:m=hw(o.prevSide,o,t,!s,a)?1:0;return{state:m,inter:DE(o,t,n,s,e,r,i)}}else return r?{state:yf(o,o.nextSide,!0,a)?0:1,inter:DE(o,t,n,s,e,r,i),isReversed:!0}:{state:yf(o.prevSide,o,!0,a)?0:1,inter:DE(o,t,n,s,e,r,i),isReversed:!0};let d,p=new Map([[3,4],[4,3],[0,1],[1,0],[2,2]]);if(e)if(o.judgeOverlapMap.has(t)&&!I_){let m=o.judgeOverlapMap.get(t);d=r?p.get(m.state):m.state}else d=Bg(r?l.reverse():l,c).state,(d===3||d===4)&&o.judgeOverlapMap.set(t,{state:r?p.get(d):d});else{if(t.judgeOverlapMap.has(o)&&!I_){let m=t.judgeOverlapMap.get(o);d=s?p.get(m.state):m.state}else d=Bg(c,r?l.reverse():l).state,(d===3||d===4)&&t.judgeOverlapMap.set(o,{state:s?p.get(d):d});d=p.get(d)}if(d===1||d===2){let m=s?t.prevSide:t,g=m.inters,y=m.getEnd();for(let b=g.length-1;b>=0;b--){let P=g[b];if(!(m.getShape()instanceof Dr)&&!rn(y,P.coord))break;if(P===n)return{state:2,inter:DE(o,t,n,s,e,r,i)}}}if(d===3||d===4)return{state:d===(r?4:3)?1:0,inter:DE(o,t,n,s,e,r,i)};if(i.has(o)?i.get(o).mapSideList.push(t):i.set(o,{sideIsReversed:r,mapSideList:[t]}),i.has(t)?i.get(t).mapSideList.push(o):i.set(t,{sideIsReversed:s,mapSideList:[o]}),d===2)return r?[o.prevSide,o,s?t.prevSide:t.nextSide,i]:[o,o.nextSide,s?t.prevSide:t.nextSide,i];if(d===0)return[r?o.prevSide:o.nextSide,t,!1,r,i];if(d===1)return[o,s?t.prevSide:t.nextSide,!0,r,i];throw Error("not support")}function DE(o,t,e,r,i,n,s){if(I_)return null;let a=o.getShape(),l=r?t.getShape().reverse():t.getShape(),c=r;if(!i){let p=t;t=o,o=p,r=n,e=e.getBindedInter()}let h=p=>!(i?n:c)&&rn(p,o.prevSide.getEnd())?o.prevSide:o;if(r){let p=t.inters;for(let m=0;m<p.length;m++){let g=p[m];if(g.isInvalid&&n===void 0)continue;if(g===e&&rn(l.start(),e.coord))return i?g:g.getBindedInter();let y=g.getBindedInter().side,b=h(g.coord);if(y===b&&u(g))return d(g)}for(;;){t=t.nextSide;let m=t.inters;for(let g=0;g<m.length;g++){let y=m[g];if(y===e)return i?y:y.getBindedInter();if(s.has(t)){let b=y.getBindedInter().side;if(s.get(t).mapSideList.includes(b)||rn(y.coord,b.getEnd())&&s.get(t).mapSideList.includes(b.nextSide))return d(y);if(s.has(b)){let P=t.getShape().reverse(),T=Kn(P,y.coord).dot(Kn(b.getShape(),y.coord))<0,I=T?b.getShape().reverse():b.getShape(),C=Bg(P,T?nge(I,y.coord,I.end()):nge(I,I.start(),y.coord)).state;if(C===1||C===2)return d(y)}else s.has(b.nextSide)}else if(y.side===e.side&&u(y))return d(y)}}}else{let p=t.inters;for(let m=p.length-1;m>=0;m--){let g=p[m];if(g.isInvalid&&n===void 0)continue;if(g===e&&rn(l.start(),e.coord))return i?g:g.getBindedInter();let y=g.getBindedInter().side,b=h(g.coord);if(y===b&&u(g))return d(g)}for(;;){t=t.prevSide;let m=t.inters;for(let g=m.length-1;g>=0;g--){let y=m[g];if(y===e)return i?y:y.getBindedInter();if(s.has(t)){let b=y.getBindedInter().side;if(s.get(t).mapSideList.includes(b)||rn(y.coord,y.getBindedInter().side.getEnd())&&s.get(t).mapSideList.includes(b.nextSide))return d(y);if(!s.has(b)&&s.has(b.prevSide)){let P=t.getShape().reverse(),T=Kn(P,y.coord).dot(Kn(b.getShape(),y.coord))<0;if(s.has(b.prevSide)){let I=T?b.getShape().reverse():b.getShape(),C=Bg(t.getShape(),nge(I,y.coord,I.end())).state;if(C===1||C===2)return d(y)}}}else if(y.side===e.side&&u(y))return d(y)}}}function u(p){if(p.isInvalid||p.getBindedInter().side!==(rn(p.coord,o.prevSide.getEnd())?o.prevSide:o))return!1;let m;if(i){if(rn(p.coord,l.start()))return!0;m=Bg(n?a.reverse():a,g(l)).state}else{if(rn(p.coord,n?a.end():a.start()))return!0;m=Bg(l,g(n?a.reverse():a)).state}return m===2||m===1;function g(y){if(y instanceof M)return rn(p.coord,y.end())?y:y.cutLine(p.coord);if(y instanceof q)return q.build2(y.center,y.startAngle,p.coord.angleD(y.center),y.rx,y.ry,y.isCCW?1:0);if(y instanceof Dr)return y.clip(y.getPercent(p.coord,Zn))[0];throw new Error("not supported operation")}}function d(p){let m=e.getBindedInter(),g=e.side,y=m.side,b=e===p,P=e;if(r){let T=e.getIndex()-1;for(;g;){let I=g.inters;for(;T>=0;T--)if(e=I[T],e===p){b||(e.setIsInvalid(),e.isDealed(),P=e),g=null;break}else if(d9===0)!e.isInvalid&&(!rn(e.coord,p.coord)||e.side===p.side&&e.getBindedInter().side===p.getBindedInter().side)&&(e.setIsInvalid(),e.isDealed(),P=e);else if(d9===1){if(e.isInvalid)continue;let C=e.getBindedInter().side;s.has(g)&&s.get(g).mapSideList.includes(C)&&(e.setIsInvalid(),e.isDealed(),P=e)}g=g==null?void 0:g.prevSide,T=(g==null?void 0:g.inters.length)-1}}else{let T=e.getIndex()+1;for(;g;){let I=g.inters;for(;T<I.length;T++){e=I[T];let C=e.getBindedInter();if(e===p){b||(e.setIsInvalid(),e.isDealed(),P=e),g=null;break}else if(d9===0)!e.isInvalid&&(!rn(e.coord,p.coord)||g===p.side&&(rn(C.side.getEnd(),e.coord)?C.side.nextSide:C.side)===p.getBindedInter().side)&&(e.setIsInvalid(),e.isDealed(),P=e);else if(d9===1){let E=C.side;s.has(g)&&s.get(g).mapSideList.includes(E)&&(e.setIsInvalid(),e.isDealed(),P=e)}}g=g==null?void 0:g.nextSide,T=0}}if(d9===0&&!rn(m.coord,p.coord))if(i?s.has(y)?s.get(y).sideIsReversed:n:c){let T=m.getIndex()-1;for(;y;){let I=s.has(y),C=y.inters;for(;T>=0;T--){if(m=C[T],m===p.getBindedInter()){y=null;break}m.isInvalid||!I||(!rn(m.coord,p.getBindedInter().coord)||m.side===p.side&&m.getBindedInter().side===p.getBindedInter().side)&&(m.setIsInvalid(),m.isDealed())}y=y==null?void 0:y.prevSide,T=(y==null?void 0:y.inters.length)-1}}else{let T=m.getIndex()+1;for(;y;){let I=y.inters,C=s.has(y);for(;T<I.length;T++){if(m=I[T],m===p.getBindedInter()){y=null;break}let E=rn(y.getEnd(),m.coord)?s.has(y.nextSide):!1;m.isInvalid||!(C||E)||(!rn(m.coord,p.getBindedInter().coord)||m.side===p.side&&m.getBindedInter().side===p.getBindedInter().side)&&(m.setIsInvalid(),m.isDealed())}y=y==null?void 0:y.nextSide,T=0}}return i?P:P.getBindedInter()}}function ove(o,t,e,r,i,n,s){let a=o.getShape(),l=t.getShape(),c=n?e.getShape().reverse():e.getShape(),h=(a instanceof q?SC(a,c.start().angle(a.center)):a instanceof Dr?Kn(a,c.start()):a.end().sub(a.start())).normalize(),u=(l instanceof q?SC(l,c.start().angle(l.center)):l instanceof Dr?Kn(l,c.start()):l.end().sub(l.start())).normalize(),d=h.dot(u);if(f9(d,-1)){let p=n?e.getShape().reverse():e.getShape(),m=Kn(p).normalize(),g=h.add(u.scale(-1)).normalize().dot(m),y=Bg(a.reverse(),l,s).state;if(g>-.9&&(y===3||y===4))return{state:y===4?0:1,inter:DE(t,e,i,n,!0,!1,r)};let b=cP(o,e,i,s,d9,I_,r.size===0?new Map:r,n);return b.state===2?b:y===4?b.state===0||b.inter!==i?b:cP(t,e,i,s,d9,I_,r.size===0?new Map:r,n):b.state===1||b.inter!==i?b:cP(t,e,i,s,d9,I_,r.size===0?new Map:r,n)}else{let p=h.scale(-1).angle(S.ORIGIN),m=u.angle(S.ORIGIN);p>m&&(p-=DK);let g=(p+m)/2,y=new S(Math.cos(g),Math.sin(g)),b=Kn(c).normalize(),P=b.angle(S.ORIGIN),T=p<P&&P<m&&a instanceof M&&l instanceof M&&c instanceof M;if(y.cross(b)<=0){if(h.scale(-1).dot(b)<0){let I;return i.coord.equals1(c.start())?I=Kn(a,i.coord).dot(Kn(c,i.coord))<0:c instanceof M&&(I=Kn(a,a.end()).dot(c.direct)<0),{state:hw(o,t,e,!n,s)?1:0,inter:DE(o,e,i,n,!0,I,r)}}return T&&a.distance2(c.start())>Fg?[t,e,!0,void 0,r]:[o,e,!0,void 0,r]}else return u.dot(b)<=0?{state:hw(o,t,e,!n,s)?1:0,inter:DE(t,e,i,n,!0,void 0,r)}:T&&l.distance2(c.start())>Fg?[o,e,!0,void 0,r]:[t,e,!0,void 0,r]}}var _K=0;function IJe(o,t,e,r){let i=t.getBindedInter(),n=t.side,s=i.side,a=n.getShape(),l=s.getShape();if(r&&(_K++,_K===-1)){r.initColor(Il.RED).addPt(a),r.initColor(Il.Golden).addPt(l),r.draw();debugger}let c=0,h=!1;if(o===-1){let O=RE(n,n.nextSide,s,i,c,h,r),_=O.state!==0;if(O.state===2){let v=Kn(a,t.coord).add(Kn(n.nextSide.getShape(),t.coord)).normalize(),D=Kn(l,t.coord).add(Kn(s.nextSide.getShape(),t.coord)).normalize();return E(_,v.dot(D)>0)}let x=RE(n,n.nextSide,s.nextSide,i,c,h,r);return O.state!==x.state?(C(O,x),1):E(_,O.state!==RE(s,s.nextSide,n,t,c,!0,r).state,O.inter,x.inter)}if(o===1){let O=cP(n,s,i,r,c,h,new Map),_=O.state!==0;if(O.state===2)return E(_,Kn(a,t.coord).dot(Kn(l,t.coord))>0);let x;if(O.isReversed&&O.existOverlap&&rn(O.inter.coord,s.getEnd())&&O.inter.getBindedInter().side!==n){let w=O.inter.getBindedInter().side;if(w===n.nextSide)x={state:hw(n,w,s.nextSide,!0,r)?1:0,inter:i};else if(w===n.prevSide){if(x={state:hw(w,n,s.nextSide,!0,r)?1:0,inter:O.inter},O.state===x.state&&t!==O.inter){let F=Kn(l,t.coord),H=Kn(s.nextSide.getShape(),t.coord),z=Kn(w.getShape(),t.coord);return E(_,F.add(H).dot(z)>0,O.inter,x.inter)}}else x=cP(n,s.nextSide,i,r,c,h,new Map)}else x=cP(n,s.nextSide,i,r,c,h,new Map);if(O.state!==x.state)return C(O,x),1;let v=Kn(l,t.coord),D=Kn(s.nextSide.getShape(),t.coord);if(f9(v.dot(D),-1)){let w=yf(s,s.nextSide,!0,r);return E(_,O.state!==cP(s.nextSide,n,t,r,c,!0,new Map,w?!_:_,!1).state,O.inter,x.inter)}else{let w=Kn(a,t.coord);return E(_,v.add(D).dot(w)>0,O.inter,x.inter)}}if(!(a instanceof Dr||l instanceof Dr))return 1;let u=Kn(a,t.coord),d=Kn(l,t.coord),p,m;if(l instanceof M)p=new M(t.coord,l.start()),m=new M(t.coord,l.end());else if(l instanceof q){let O=t.coord.angleD(l.center);p=q.build2(l.center,O,l.startAngle,l.rx,l.ry,l.isCCW?0:1),m=q.build2(l.center,O,l.endAngle(),l.rx,l.ry,l.isCCW?1:0)}else if(l instanceof Dr){let O=l.getPercent(t.coord,Zn);[p,m]=l.clip(O),p=p.reverse()}else throw new Error("not support");let g=u.dot(d)>0,y,b;g?(y=Bg(a.reverse(),p).state,b=Bg(a,m).state):(y=Bg(a,p).state,b=Bg(a.reverse(),m).state);let P;y===0?P=cP(g?n.prevSide:n.nextSide,s,i,r,c,h,new Map,!0,!1,g):y===1?P=cP(n,s.prevSide,i,r,c,h,new Map,!0,!0,g):y===2?g?P=RE(n.prevSide,n,s.prevSide,i,c,h,r,!0):P=RE(n,n.nextSide,s.prevSide,i,c,h,r,!0):g?y===3?P={inter:i,state:0}:P={inter:i,state:1}:y===3?P={inter:i,state:1}:P={inter:i,state:0};let T=P.state!==0;if(P.state===2)return E(T,g);let I;if(b===0?I=cP(g?n.nextSide:n.prevSide,s,i,r,c,h,new Map,!1,!1,!g):b===1?I=cP(n,s.nextSide,i,r,c,h,new Map,!1,!0,!g):b===2?g?I=RE(n,n.nextSide,s.nextSide,i,c,h,r,!1):I=RE(n.prevSide,n,s.nextSide,i,c,h,r,!1):g?b===3?I={inter:i,state:1}:I={inter:i,state:0}:b===3?I={inter:i,state:0}:I={inter:i,state:1},P.state===I.state)return P.inter===I.inter?(t.setIsInvalid(),0):E(T,g,P.inter,I.inter);return C(P,I),1;function C(O,_){let x=O.state!==0;if(O.inter===_.inter){t.setOutToIn(x);return}else l7(O.inter,_.inter,!0),l7(_.inter,O.inter,!1);let v=[];if(o===-1){let w=Kn(a,t.coord),F=Kn(n.nextSide.getShape(),t.coord),H=Kn(l,t.coord),z=Kn(s.nextSide.getShape(),t.coord);v.push(w.dot(H)),v.push(w.dot(z)),v.push(F.dot(H)),v.push(F.dot(z))}else{let w=Kn(a,t.coord);v.push(Kn(l,t.coord).dot(w)),v.push(Kn(s.nextSide.getShape(),t.coord).dot(w))}if(v.reduce((w,F)=>Math.abs(w)>Math.abs(F)?w:F,0)>0)if(e===1||e===0||e===2||e===3)t.setOutToIn(x);else throw new Error("not support");else if(e===1)D(!x);else if(e===0||e===2||e===3)D(x);else throw new Error("not support");function D(w){t.setIsInvalid();let F=(w?O:_).inter;delete F.isInvalid,delete F.getBindedInter().isInvalid,F.setOutToIn(!x)}}function E(O,_,x,v){if(x===v){if(t.side.outline.inters.find(F=>!F.isInvalid&&F!==t&&rn(F.coord,t.coord)))return t.setIsInvalid(),0;let D=new wE(t.coord,n,r),w=new wE(t.coord,s,r);return D.bind(w),_?n.inters.splice(t.getIndex(),0,D):n.inters.splice(t.getIndex()+1,0,D),s.inters.splice(t.getBindedInter().getIndex(),0,w),D.setOutToIn(O),t.setOutToIn(!O),D.isDealed(),n.inters.forEach((F,H)=>F.setIndex(H)),s.inters.forEach((F,H)=>F.setIndex(H)),2}else{let D=function(){let w=x.getBindedInter(),F=v.getBindedInter();delete x.isInvalid,delete w.isInvalid,delete v.isInvalid,delete F.isInvalid,x.setOutToIn(!O),v.setOutToIn(O),l7(x,v,!0),l7(v,x,!1),l7(w,F,_),l7(F,w,!_)};if(t.setIsInvalid(),_){if(e===1||e===0||e===2||e===3)return D(),2;throw new Error("not support")}else{if(e===1)return O?0:(D(),2);if(e===0||e===2||e===3)return O?(D(),2):0;throw new Error("not support")}}}}function l7(o,t,e){let{judge:r,changeNum:i}=s(),n=o.getIndex();for(let a=n+i,l=o.side.inters;r(a);a+=i){if(l[a].isInvalid)continue;if(!rn(l[a].coord,o.coord))break;l[a].setIndex(n),l[n].setIndex(a);let c=l[a];l[a]=l[n],l[n]=c,n=a}function s(){let a=o.side===t.side;if(e){let l=a?t.getIndex():o.side.inters.length;return{judge:c=>c<l,changeNum:1}}else{let l=a?t.getIndex()+1:0;return{judge:c=>c>=l,changeNum:-1}}}}var D_e=0,wE=class{constructor(o,t,e){this.id=D_e++,this.coord=o,this.side=t,e&&(this.id=D_e++,this.drawDebug=e);let r=new _e;r.ext2(o),this._bbox=r.build1()}bbox(){return this._bbox}resetVisitStatus(){this.visited=!1,this.bindedInter.visited=!1}isDealed(){this.dealed=!0,this.getBindedInter().dealed=!0}setOutToIn(o){this.outToIn=o,this.bindedInter.outToIn=!o}setIsInvalid(){this.isInvalid=!0,this.getBindedInter().isInvalid=!0}getBindedInter(){return this.bindedInter}bind(o){this.bindedInter=o,o.bindedInter=this}setIndex(o){this.index=o}isSorted(){return this.index!==void 0}getIndex(){return this.index}getVisited(){return this.visited}visitSelf(){this.visited=!0}visit(){this.visited=!0,this.bindedInter.visited=!0}getPrevPoint(){let o=this.getIndex(),t=this.side.getStart();return o&&(t=this.side.inters[o-1].coord),t}getTangent(){let o=this.side.getShape();if(o instanceof M)return o.end().sub(o.start());if(o instanceof q){let t=this.coord.angle(o.center);return o.isCCW?t+=TK:t-=TK,new S(Math.cos(t),Math.sin(t))}else{if(o instanceof Dr)return KU(o,o.getPercent(this.coord,Zn));throw new Error("not support")}}findStartInter(){return this.outToIn===void 0?this.getTangent().cross(this.bindedInter.getTangent())>0?this:this.bindedInter:this.outToIn?this:this.bindedInter}run(){let o=[],t=this,e;if(this.drawDebug){uge++;let r=uge===-1,i=this.drawDebug.initColor(Il.RED);if(r){this.drawDebug.draw();debugger}e=n=>{if(o.push(n),r){i.addPt(o[o.length-1]),this.drawDebug.draw();debugger}}}else e=r=>o.push(r);for(;!t.visited;){let r=function(a,l){if(sr.eq(a.distance2(l),0))return;let c=eH.rebuild(n.getShape(),a,l);if(!c)return!0;e(c)};t.visit();let i=t.getIndex(),n=t.side,s=n.inters[i+1];for(;s!=null&&s.isInvalid;)s=n.inters[s.getIndex()+1];if(s)r(t.coord,s.coord),t=s.bindedInter;else{let a=r(t.coord,n.getEnd()),l=t.coord;for(n=n.nextSide,t=null;;){for(let c of n.inters)if(!c.isInvalid){t=c.bindedInter;break}if(t)break;a?(r(l,n.getEnd()),a=!1):e(n.getShape()),n=n.nextSide}a?(sr.eq(l.distance2(t.coord),0)?r(l,n.getEnd()):r(l,t.coord),a=!1):sr.eq(n.getEnd().distance2(t.coord),0)?e(n.getShape()):r(n.getStart(),t.coord)}}if(t!==this)throw this.drawDebug&&console.log(JSON.stringify({runId:uge,handleId:_K,boolId:WU})),new Error("inter !== this");return bf(ge.build7(o))}},uge=0,dge=class Dge{constructor(t,e,r,i,n){this.inters=[],this.allInterIsInvalid=!0,this.isVisit=!1,this.sides=t,this.isGroup1=r,this.isOutside=i,this.finalIsOutside=i,this.polyline=e,n&&(this.polygon=n),t.forEach(s=>s.outline=this)}static build(t,e,r,i,n){let s=t.primitives.map(l=>new eH(l,i)),a=s[s.length-1];return s.forEach(l=>{a.connect(l),a=l}),n?new Dge(s,t,e,r,n):new Dge(s,t,e,r)}setFinalIsOutSide(t){this.finalIsOutside=t}startAndEndIsSameOutsideFlag(){return this.isOutside===this.finalIsOutside}get hasInter(){return!!this.interOutlines}isAllInterIsInvalid(){return this.allInterIsInvalid}setAllInterIsInvalidToFalse(){this.allInterIsInvalid=!1}resetVisited(){this.isVisit=!1}intersect(t,e){if(!(t.interOutlines&&t.interOutlines===this.interOutlines))if(t.interOutlines)if(this.interOutlines){let r,i;this.interOutlines.length>t.interOutlines.length?(r=this.interOutlines,i=t.interOutlines):(r=t.interOutlines,i=this.interOutlines),i.forEach(n=>{r.push(n),n.interOutlines=r}),e.delete(i)}else t.interOutlines.push(this),this.interOutlines=t.interOutlines;else this.interOutlines?(this.interOutlines.push(t),t.interOutlines=this.interOutlines):(t.interOutlines=this.interOutlines=[this,t],e.add(this.interOutlines))}isContain(t){if(!this.polyline.bbox().extendOfSize(Zn).isContainsBBox(t.polyline.bbox()))return!1;let e=t.polyline.primitives[0].start();if(t.hasInter&&t.isAllInterIsInvalid()){let r=t.inters[0];r.getBindedInter().side.outline!==this?e=r.side.getCenterPoint():e=r.side.getCenterPoint(r.coord)}return!!this.polyline.getWindingNum(e)}isInternally(t){return!!this.polyline.getWindingNum(t)}isEqual(t){return this.polyline===t.polyline}bbox(){return this.polyline.bbox()}reverse(){this.sides.reverse();let t=this.sides[this.sides.length-1];this.sides.forEach(e=>{e.reverse(),t.connect(e),t=e})}returnPolyline(){let t=this.sides.map(r=>r.getShape()),e=this.polyline.primitives;if(this.sides.length===e.length){let r=new Set(e);if(!t.some(i=>!r.has(i)))return this.polyline}return ge.build7(t)}};function w_e(o,t,e){let r=[];return o.forEach(i=>i.forEach(n=>{if(n.hasInter&&!n.isAllInterIsInvalid())return;let s=n.bbox(),a=t.search(s.extendOfSize(Zn)).filter(l=>l.bbox().extendOfSize(Zn).isContainsBBox(s)).sort((l,c)=>l.bbox().area()-c.bbox().area());for(let l of a)if(l.isContain(n)){let c=e(!n.isOutside,l.isOutside),h=e(n.isOutside,l.isOutside);c!==h&&(r.push(n),n.setFinalIsOutSide(!c));return}e(n.isOutside,!1)!==e(!n.isOutside,!1)&&r.push(n)})),r}function CJe(o,t,e){let r;switch(e){case 0:r=(a,l)=>a&&l;break;case 1:r=(a,l)=>a||l;break;case 2:r=(a,l)=>a&&!l;break;case 3:r=(a,l)=>a&&!l||!a&&l;break;default:throw Error("not support the rule")}let i=new i2(10),n=new i2(10);o.forEach(a=>a.forEach(l=>i.add(l))),t.forEach(a=>a.forEach(l=>n.add(l)));let s=w_e(o,n,r);return w_e(t,i,(a,l)=>r(l,a)).forEach(a=>s.push(a)),s}var SJe=class{constructor(o){this.roots=[],this.nodes=o.sort((t,e)=>t.bbox().minX-e.bbox().minX).map(t=>new EJe(t)),this.nodes.forEach((t,e)=>{t.visit()&&(this.roots.push(t),this.build(e))})}build(o){let t=this.nodes[o];for(let e=o+1,r=this.nodes.length;e<r;e++){let i=this.nodes[e];if(t.key.bbox().maxX<i.key.bbox().minX)break;i.getIsVisit()||t.isContain(i)&&(i.visit(),t.addChild(i),this.build(e))}}getPolygons(){let o=[];return this.roots.forEach(t=>t.getPolygons().forEach(e=>o.push(e))),o}},EJe=class{constructor(o){this.children=[],this.isVisit=!1,this.key=o}getIsVisit(){return this.isVisit}isContain(o){return this.key.isContain(o.key)}addChild(o){this.children.push(o)}getPolygons(){let o=[];return this.getPolylineList(o),o.map(t=>{let e=t[0].polygon;if(e&&e.items.length===t.length){let r=t.map(n=>n.returnPolyline()),i=new Set(e.items);return r.some(n=>!i.has(n))?new Zo(r):e}else return new Zo(t.map(r=>r.returnPolyline()))})}getPolylineList(o,t){t?(t.push(this.key),t=null):(t=[this.key],o.push(t)),this.children.forEach(e=>e.getPolylineList(o,t))}visit(){return this.isVisit?!1:(this.isVisit=!0,!0)}};function L_e(o){let t="";return o.items.forEach((e,r)=>{let i="$";if(e.items.forEach((n,s)=>{let a="[";if(n.primitives.forEach((l,c)=>{let h="";if(l instanceof M)h=`Line,${l.start().x},${l.start().y},${l.end().x},${l.end().y}`;else if(l instanceof q)h=`Arc,${l.center.x},${l.center.y},${l.startAngle},${l.sweepAngle},${l.rx}`;else if(l instanceof Dr)h=`Bezier,${l.controls.map(u=>`${u.x},${u.y}`).join(",")}`;else throw new Error("not supported");if(c===n.primitives.length-1){a+=`${h}]`;return}a+=`${h},`}),s===e.items.length-1){i+=`${a}$`;return}i+=`${a}_`}),r===o.items.length-1){t+=`${i}`;return}t+=`${i}^`}),console.log(t),t}function M_e(o){let t=o.split("^"),e=[];return t.forEach(i=>{let n=/\$(.*?)\$/,s=i.match(n)[1].split("_"),a=[];s.forEach(c=>{let h=/\[(.*?)\]/,u=c.match(h)[1].split(","),d=[],p=[];for(let g=0;g<u.length;g++){let y=u[g];if(y==="Line"||y==="Arc"||y==="Bezier"){if(d.length){let b=r(d);p.push(b),d.length=0}d.push(y);continue}d.push(Number(y))}d.length&&(p.push(r(d)),d.length=0);let m=ge.build7(p);a.push(m)});let l=new Zo(a);e.push(l)}),new Fo(e);function r(i){let n=i[0];if(n==="Line")return new M(new S(i[1],i[2]),new S(i[3],i[4]));if(n==="Arc")return q.build3(new S(i[1],i[2]),i[3],i[4],i[5],i[5]);if(n==="Bezier"){let s=[];for(let a=1;a<i.length;a+=2)s.push(new S(i[a],i[a+1]));return new Dr(s)}else throw new Error("not support")}}var OJe=class{constructor(o=1){this.group1Str="$[Line,20193.777980000017,4122.200439600661,20193.77082,4211.848760073709,Arc,20193.972672902382,4211.8487570980205,179.99915535323618,-89.99540000050294,0.2018529024026465,Line,20193.972659672283,4212.050609999989,20193.972660393258,4212.039610000013,Arc,20193.97217289501,4211.848257065248,89.85403133887164,89.99540000041924,0.19135355574930143,Line,20193.78082,4211.848759926291,20193.78897999998,4122.200440479205,Line,20193.78897999998,4122.200440479205,20193.777980000017,4122.200439600661]$",this.group2Str="$[Arc,20209.72784128151,4122.2007625157785,258.46768032837986,-75.66780748375947,4.138846238512183,Line,20205.593935808283,4121.998590004101,20193.97982992629,4121.998600000001,Arc,20193.97983290198,4122.2004529023825,269.9991553532362,-89.99540000050297,0.20185290240401074,Arc,20193.782979999996,4122.20044,180.00375535340328,-180.0000000000027,0.004999999999025513,Arc,20193.979332869207,4122.200952909754,180.15347936671733,89.99540000008247,0.19135355575111057,Line,20193.97983008845,4122.009599999999,20205.603694309226,4122.003828485546,Arc,20209.733142304296,4122.194577876843,182.64475341258483,75.73379999998886,4.133851239977064,Line,20208.900400396684,4118.145470939558,20208.902599535475,4118.156248870184,Arc,20206.972515961093,4108.700057667588,78.46393309088245,-78.46759999998636,9.65115405866796,Arc,20216.618669999996,4108.69944,359.99996825446135,-180,0.004999999999200412,Arc,20206.973015966745,4108.699445349495,359.99996822365375,78.46759999998409,9.640654033253735]$^$[Line,20193.997796883676,4095.399470032799,20205.596133314026,4095.4013992171836,Arc,20209.72470159858,4095.1923799234505,177.10172964919312,-75.64935037184974,4.133855965730166,Arc,20209.73000213952,4095.198565517174,101.5415133143569,75.7293000000185,4.128850963459707,Line,20205.605834328744,4095.395161923586,20193.997203529463,4095.389485743675,Arc,20193.994588809255,4095.197684525904,89.21896662213764,4.544099999999517,0.19181903946188483,Arc,20193.981499796217,4095.1977402038,89.85034659953621,89.9999999995926,0.19135044893494071,Arc,20193.78515,4095.19824,0,-180,0.005,Arc,20193.98200016982,4095.1982398301675,179.99995179248322,-89.99999999974185,0.20185016982129908,Arc,20193.981986624152,4095.198185381971,89.9961078637802,-4.487285276547311,0.2019046184835962]$",this.rule=o}getGroup1(){return M_e(this.group1Str)}getGroup2(){return M_e(this.group2Str)}},pge=new RK(2),HU=class{getUnion(o,t=!0){return t&&(o=o.map(e=>this.asSameSweep([e])[0])),uJe(XZe,o)}asSameSweep(o){let t=0;return o.forEach(e=>t+=e.area(.01)),t>0?o.map(e=>e.reverse()):o}getSubtraction(o,t){let e=new qU(!1),r=new $U(fK.rule,pge,e);for(let i of o){let n=fK.weight(0);r.addPolyline(i,n)}for(let i of t){let n=fK.weight(1);r.addPolyline(i,n)}return r.simplify(),e.plGrps}getIntersection(o,t){let e=new qU(!1),r=new $U(mK.rule,pge,e);for(let i of o){let n=mK.weight(0);r.addPolyline(i,n)}for(let i of t){let n=mK.weight(1);r.addPolyline(i,n)}return r.simplify(),e.plGrps}getMutuallyExclusive(o,t){let e=new qU(!1),r=new $U(sge.rule,pge,e);for(let i of o){let n=sge.weight(0);r.addPolyline(i,n)}for(let i of t){let n=sge.weight(1);r.addPolyline(i,n)}return r.simplify(),e.plGrps}},WU=0,fge=!1;function zU(o,t,e,r,i){let n=kE(),s=[],a=[],l=[],c=new Set,h;if(i){if(h=new QU(i),WU++,fge){debugger;fge=!1;let I=new OJe;zU(I.rule,I.getGroup1(),I.getGroup2(),r,i)}if(WU===-1||fge){console.table({rule:o,group1:L_e(t),group2:L_e(e)}),h.clear();let I=h.initColor(Il.GREEN),C=h.initColor(Il.WHITE),E=h.initColor(Il.BLUE),O=h.initColor(Il.Gray);t.items.forEach(_=>_.items.forEach((x,v)=>{v>0?C.addPly(x):I.addPly(x)})),e.items.forEach(_=>_.items.forEach((x,v)=>{v>0?O.addPly(x):E.addPly(x)})),h.draw();debugger}}let u=t.items.length!==0&&e.items.length!==0?t.bbox().extendOfSize(Zn).intersection1(e.bbox().extendOfSize(Zn)):null;if(u){let I=[],C=[];switch(o){case 0:{for(let E of t.items)E.bbox().isIntersect(u)&&I.push(E);for(let E of e.items)E.bbox().isIntersect(u)&&C.push(E);break}case 1:case 3:{for(let E of t.items)E.bbox().isIntersect(u)?I.push(E):s.push(E);for(let E of e.items)E.bbox().isIntersect(u)?C.push(E):s.push(E);break}case 2:{for(let E of t.items)E.bbox().isIntersect(u)?I.push(E):s.push(E);for(let E of e.items)E.bbox().isIntersect(u)&&C.push(E);break}default:throw new Error("not support")}I.length!==t.items.length&&(t=new Fo(I)),C.length!==e.items.length&&(e=new Fo(C))}else{switch(o){case 0:break;case 1:case 3:{t.items.forEach(I=>s.push(I)),e.items.forEach(I=>s.push(I));break}case 2:{t.items.forEach(I=>s.push(I));break}default:throw new Error("not support")}t=new Fo([]),e=new Fo([])}P(t,a,!0),P(e,l,!1);let d=o===2||o===3?(I,C)=>rn(I.getEnd(),C)?I.nextSide:I:(I,C)=>rn(I.prevSide.getEnd(),C)?I.prevSide:I,p=(I,C,E)=>{if(rn(I.getEnd(),E)){if(I.inters.findIndex(O=>O.getBindedInter().side===C&&rn(O.coord,I.getEnd()))===-1)return new wE(E,I,h)}else return new wE(E,I,h)},m=o===2||o===3?(I,C,E)=>{if(rn(I.getStart(),E)){if(I.inters.findIndex(O=>O.getBindedInter().side===C&&rn(O.coord,I.getStart()))===-1)return new wE(E,I,h)}else return new wE(E,I,h)}:p;r.seek(t,e,(I,C,E,O,_,x)=>{let v=a[I][C],D=l[O][_],w=v.sides[E],F=D.sides[x],H=G0(w.getShape(),F.getShape());if((w.getShape()instanceof Dr||F.getShape()instanceof Dr)&&H>=4){if(w.getShape()instanceof q||F.getShape()instanceof q){let V=function(L,k){let N=!1;for(let U=0;U<k.length;U+=2)rn(new S(k[U],k[U+1]),L)&&(N=!0);N||k.push(L.x,L.y)},W=[$e[0],$e[1]];for(let L=0;L<H;L+=2){let k=new S($e[L],$e[L+1]);for(let N=L+2;N<H;N+=2){let U=new S($e[N],$e[N+1]);if(!rn(k,U)){V(U,W);break}}}H=W.length,W.forEach((L,k)=>$e[k]=L)}else for(let V=H-2;V>=2;V-=2)for(let W=V-2;W>=0;W-=2)if(rn(new S($e[V],$e[V+1]),new S($e[W],$e[W+1]))){$e[W]=($e[V]+$e[W])/2,$e[W+1]=($e[V+1]+$e[W+1])/2;for(let L=H-3;L>=V;L--)$e[L]=$e[L+2];H-=2;break}}let z=0;if(H===4){let V=function(k){return rn(w.getEnd(),k)||rn(w.prevSide.getEnd(),k)||rn(F.prevSide.getEnd(),k)||rn(F.getEnd(),k)},W=new S($e[0],$e[1]),L=()=>{let k=new wE(W,w,h),N=new wE(W,F,h);k.bind(N),k.setIsInvalid(),k.isDealed(),v.inters.push(k),D.inters.push(N)};if($e[0]===$e[2]&&$e[1]===$e[3])if(V(W))z=2;else{L();return}}for(;z<H;z+=2){let V=new S($e[z],$e[z+1]),W=w,L=F;if(rn(W.prevSide.getEnd(),V)&&(W=W.prevSide),L=d(L,V),w!==W&&F!==L){let N=o===2||o===3?F.getEnd():L.getEnd();W.getEnd().distance1(V)<N.distance1(V)?(V=W.getEnd(),rn(N,V)||(L=F)):(V=N,rn(W.getEnd(),V)||(W=w))}let k=p(W,L,V);if(k){let N=m(L,W,V);N&&(W.addInter(k),v.inters.push(k),L.addInter(N),D.inters.push(N),k.bind(N),v.intersect(D,c))}}return H},i);let g=T(),y=CJe(a,l,o);y.forEach(I=>!I.startAndEndIsSameOutsideFlag()&&I.reverse()),new SJe(g.concat(y)).getPolygons().forEach(I=>s.push(I));let b=new Fo(s);if(h){if(WU===-1){let I=h.initColor(Il.RED),C=h.initColor(Il.Golden);s.forEach(E=>{I.addPly(E.items[0]),E.items.slice(1).forEach(O=>C.addPly(O))}),h.draw();debugger;throw new Error}b.id=WU}return Y2.BooleanTools+=wT(n),b;function P(I,C,E){I.items.forEach(O=>{let _=[];_.push(dge.build(O.items[0],E,!0,h,O)),O.items.slice(1).forEach(x=>{_.push(dge.build(x,E,!1,h))}),C.push(_)})}function T(){let I=[];return c.forEach(E=>{o===2||o===3?E.forEach(_=>{_.isGroup1||_.reverse(),_.sides.forEach(x=>x.sortInters())}):E.forEach(_=>_.sides.forEach(x=>x.sortInters())),E.map(_=>_.sides.filter(x=>x.inters.length)).flat(2).sort((_,x)=>{let v=_.inters,D=x.inters,w=rn(v[v.length-1].coord,_.getEnd()),F=rn(D[D.length-1].coord,x.getEnd());if(w&&F){let H=0,z=0;for(let V=v.length-2;V>=0&&rn(v[V].coord,_.getEnd());V--)H++;for(let V=D.length-2;V>=0&&rn(D[V].coord,x.getEnd());V--)z++;return z-H}else return w?-1:1}).forEach(_=>{_.inters.forEach(x=>{if(x.dealed)return;let v=x.side,D=x.getBindedInter().side,w;rn(v.getEnd(),x.coord)&&rn(D.getEnd(),x.coord)?w=-1:rn(v.getEnd(),x.coord)?(w=1,x=x.getBindedInter()):rn(D.getEnd(),x.coord)&&(w=1);let F=IJe(w,x,o,h);x.isDealed(),F&&(v.outline.setAllInterIsInvalidToFalse(),D.outline.setAllInterIsInvalidToFalse())})}),O(E),o===3&&(E.forEach(_=>{_.reverse(),_.sides.forEach(x=>{x.sortInters(),x.inters.forEach(v=>{v.resetVisitStatus()})})}),O(E));function O(_){_.forEach(x=>{x.inters.forEach(v=>{if(v.isInvalid||v.getVisited())return;let D=v.findStartInter(),w=C(o)?D.run():D.getBindedInter().run(),F=x.polyline.primitives;if(w){if(F.length===w.primitives.length){let H=new Set(F);if(!w.primitives.some(z=>!H.has(z))){I.push(x);return}}I.push(dge.build(w,!0,!0,h))}})})}}),I;function C(E){switch(E){case 0:case 2:case 3:return!0;case 1:return!1;default:throw Error("not support the rule")}}}}var lK=/\bstablilizetion\b/.test(self.location.href)||!0,cK={intersect(o,t,e,r){try{return zU(0,o,t,e,r)}catch(i){if(lK){let n=new HU().getIntersection(o.items.map(s=>s.items.map(a=>a)).flat(2),t.items.map(s=>s.items.map(a=>a)).flat(2));return new Fo(n.map(s=>new Zo(s.items)))}throw i}},union(o,t,e,r){try{return zU(1,o,t,e,r)}catch(i){if(lK){let n=new HU,s=o.items.map(l=>l.items.map(c=>c)).flat(2);t.items.forEach(l=>l.items.forEach(c=>s.push(c)));let a=n.getUnion(s);return new Fo(a.map(l=>new Zo(l.items)))}throw i}},diff(o,t,e,r){try{return zU(2,o,t,e,r)}catch(i){if(lK){let n=new HU().getSubtraction(o.items.map(s=>s.items.map(a=>a)).flat(2),t.items.map(s=>s.items.map(a=>a)).flat(2));return new Fo(n.map(s=>new Zo(s.items)))}throw i}},xor(o,t,e,r){try{return zU(3,o,t,e,r)}catch(i){if(lK){let n=new HU().getMutuallyExclusive(o.items.map(s=>s.items.map(a=>a)).flat(2),t.items.map(s=>s.items.map(a=>a)).flat(2));return new Fo(n.map(s=>new Zo(s.items)))}throw i}}},AJe=class extends $U{constructor(o,t,e,r,i,n){super(o.rule,RK.DUMMY,t),this.sideGroup1=[],this.sideGroup2=[],this.group1=e,this.group2=r,this.seeker=i,this.addGroup(e,o.weight(0),this.sideGroup1),this.addGroup(r,o.weight(1),this.sideGroup2),this.bus=n}addGroup(o,t,e){if(!o)debugger;o.items.forEach(r=>{let i=[];r.items.forEach(n=>{let s=this.sides.length;this.addPolyline(n,t),i.push(this.sides.slice(s))}),e.push(i)})}seekIntersection(){this.seeker.seek(this.group1,this.group2,(o,t,e,r,i,n)=>{let s=this.sideGroup1[o][t][e],a=this.sideGroup2[r][i][n],l=G0(s.shape,a.shape);for(let c=0;c<l;c+=2){let h=new S($e[c],$e[c+1]);s.inters.push(h),a.inters.push(h),this.event.onIntersect(h,s,a)}return l},this.bus)}},_Je=class extends qU{constructor(o){super(!!o),o&&(this.drawDebug=new QU(o),this.blueDrawing=this.drawDebug.initColor(Il.BLUE),this.greenDrawing=this.drawDebug.initColor(Il.GREEN),this.redDrawing=this.drawDebug.initColor(Il.RED))}onOriginSide(o){super.onOriginSide(o),this.debug&&this.blueDrawing.addPt(o.shape)}onPolylineGroup(o,t){super.onPolylineGroup(o,t),this.debug&&o.items.forEach(e=>this.greenDrawing.addPly(e))}draw(){this.drawDebug.draw()}};function mge(o,t,e,r,i){let n=kE(),s=new _Je(i);new AJe(o,s,t,e,r,i).simplify();let a=[];s.plGrps.forEach(c=>{let h=c.items.map(u=>AK(u));h[0]&&a.push(new Zo(h.filter(u=>u)))});let l=new Fo(a);return Y2.BooleanTools+=wT(n),l}var gge=!0,BU={intersect(o,t,e,r){try{return cK.intersect(o,t,e,r)}catch(i){if(gge)throw i;return console.error(i),mge(mK,o,t,e,r)}},union(o,t,e,r){try{return cK.union(o,t,e,r)}catch(i){if(gge)throw i;return console.error(i),mge(qZe,o,t,e,r)}},diff(o,t,e,r){try{return cK.diff(o,t,e,r)}catch(i){if(gge)throw i;return console.error(i),mge(fK,o,t,e,r)}},xor(o,t,e,r){return cK.xor(o,t,e,r)}},vJe=class{init(o){}seek(o,t,e,r){let i=o.bbox().extendOfSize(5e-6).intersection1(t.bbox().extendOfSize(5e-6));if(!i)return;let n=kE(),s=[];for(let d=0,p=o.items.length;d<p;d++){let m=o.items[d];if(i.isIntersect(m.bbox()))for(let g=0,y=m.items.length;g<y;g++){let b=m.items[g];if(i.isIntersect(b.bbox()))for(let P=0,T=b.primitives.length;P<T;P++){let I=b.primitives[P].bbox();i.isIntersect(I)&&s.push({bbox:I,polygonIndex:d,polylineIndex:g,ptIndex:P})}}}let a=s.length;if(a===0){Y2.IntersectionSeeker+=wT(n);return}let l=[];for(let d=0,p=t.items.length;d<p;d++){let m=t.items[d];if(i.isIntersect(m.bbox()))for(let g=0,y=m.items.length;g<y;g++){let b=m.items[g];if(i.isIntersect(b.bbox()))for(let P=0,T=b.primitives.length;P<T;P++){let I=b.primitives[P].bbox();i.isIntersect(I)&&l.push({bbox:I,polygonIndex:d,polylineIndex:g,ptIndex:P})}}}let c=l.length;if(c===0){Y2.IntersectionSeeker+=wT(n);return}if(a<5||c<5){for(let d=0,p=s.length;d<p;d++)for(let m=0,g=l.length;m<g;m++)if(s[d].bbox.isIntersect(l[m].bbox.extendOfSize(1e-5))){let y=s[d],b=l[m];e(y.polygonIndex,y.polylineIndex,y.ptIndex,b.polygonIndex,b.polylineIndex,b.ptIndex)}Y2.IntersectionSeeker+=wT(n);return}s.sort((d,p)=>d.bbox.minX-p.bbox.minX),l.sort((d,p)=>d.bbox.minX-p.bbox.minX);let h=0,u=0;for(;h<a&&u<c;)if(s[h].bbox.minX<l[u].bbox.minX){let d=s[h],p=d.bbox;for(let m=u;m<c;m++){let g=l[m],y=g.bbox;if(y.minX>p.maxX+1e-5)break;(p.minY<y.minY?y.minY:p.minY)<(p.maxY<y.maxY?p.maxY:y.maxY)+1e-5&&e(d.polygonIndex,d.polylineIndex,d.ptIndex,g.polygonIndex,g.polylineIndex,g.ptIndex)}h++}else{let d=l[u],p=d.bbox;for(let m=h;m<a;m++){let g=s[m],y=g.bbox;if(y.minX>p.maxX+1e-5)break;(y.minY<p.minY?p.minY:y.minY)<(y.maxY<p.maxY?y.maxY:p.maxY)+1e-5&&e(g.polygonIndex,g.polylineIndex,g.ptIndex,d.polygonIndex,d.polylineIndex,d.ptIndex)}u++}Y2.IntersectionSeeker+=wT(n)}},u7=class xE{static getDebug(){return xE.drawDebug||(xE.drawDebug=new QU(xE.curBus)),xE.drawDebug}static getDrawing(t=Il.GREEN){return this.getDebug().initColor(t)}static clearDrawing(){xE.getDebug().clear()}static drawText(t,e,r=Il.GREEN){xE.getDrawing(r).addText(t,e,1.5,.1,!0)}static drawBBox(t,e=Il.GREEN){if(!t)return;let r=xE.getDrawing(e),i=new M(t.UL(),t.UR()),n=new M(t.UR(),t.LR()),s=new M(t.LR(),t.LL()),a=new M(t.LL(),t.UL());r.addPt(i),r.addPt(n),r.addPt(s),r.addPt(a)}static drawPolyType(t,e){let r=xE.getDrawing(e);if(t instanceof ge)r.addPly(t);else if(t instanceof Zo)for(let i of t.items)i instanceof ge?r.addPly(i):this.drawPolyType(i,e);else if(t instanceof Fo)for(let i of t.items)this.drawPolyType(i,e)}static translate(t){switch(t){case 0:return"\u2229";case 2:return"-";case 1:return"U";case 3:return"X";default:break}}};u7.UseOptimizeSplit=!0,u7.LocalBestThread=4,u7.HandleDiff=!0,u7.OcTreeSplitStep=4,u7.PrintStart=new S(150,-200);var Ng=u7,FU=class wge{static getPolyTypeLine(t){let e=[];if(t instanceof ge)for(let r of t.primitives)e.push(r);else if(t instanceof Zo)for(let r of t.items)if(r instanceof ge)for(let i of r.primitives)e.push(i);else{let i=this.getPolyTypeLine(r);for(let n of i)e.push(n)}else if(t instanceof Fo)for(let r of t.items){let i=this.getPolyTypeLine(r);for(let n of i)e.push(n)}return e}static getPolyTypePolyLine(t){let e=[];if(t instanceof ge)e.push(t);else if(t instanceof Zo)for(let r of t.items)if(r instanceof ge)e.push(r);else{let i=this.getPolyTypePolyLine(r);for(let n of i)e.push(n)}else if(t instanceof Fo)for(let r of t.items){let i=this.getPolyTypePolyLine(r);for(let n of i)e.push(n)}return e}static getListBBox(t){if(t.length<=0)return;let e=new _e;for(let r of t){let i=wge.getSingleBBox(r);e.ext1(i)}return e.build1()}static getSingleBBox(t){if(t instanceof Array){let e=new _e,r=wge.getListBBox(t.slice(1));return e.ext1(r),e.build1()}else return t.bbox()}static doDrawRule(t,e=Ng.PrintStart){if(t.length<2)return[e,e,e];let r=5,i=10,n=t[0],s=Ng.translate(n),a=[],l=e.y,c=e.x,h=e.x;e=e.add(new S(0,-i));for(let p=1;p<t.length;p++){let m=t[p];if(m instanceof Array){e=e.add(new S(r,0));let g=this.doDrawRule(m,e);a.push(g[0]),g[1].x<=c&&(c=g[1].x),g[2].x>=h&&(h=g[2].x),e=new S(g[2].x+r,e.y)}else a.push(e.clone()),e.x<=c&&(c=e.x),e.x>=h&&(h=e.x),Ng.drawText(e,m.name),e=e.add(new S(r,0))}let u=0;for(let p of a)u+=p.x;let d=new S(u/a.length,e.y+i);Ng.drawText(d,"N:"+s);for(let p of a){let m=new M(p,d),g=new Array;g.push(m);let y=ge.build1(Cge(g));Ng.drawPolyType(y,Il.GREEN)}return[d,new S(c,l),new S(h,l)]}static drawRule(t,e=Ng.PrintStart,r=!1,i){Ng.clearDrawing(),this.doDrawRule(t,e),r&&this.doDrawRulePolygon(t,i),Ng.getDebug().draw()}static doDrawRulePolygon(t,e){let r=t[0];for(let i=1;i<t.length;i++){let n=t[i];if(n instanceof Array)this.doDrawRulePolygon(n,e);else{let s=e;r===2&&i===1&&(s=Il.RED),n.name&&Ng.drawText(n.bbox().UL(),n.name,s),Ng.drawPolyType(n,s)}}}static IsCenterBBoxPointInPolygonType(t,e){let r=t.center();for(let i of e.items)if(i.getOutMostPolyline().getWindingNum(r))return!0;return!1}static KeepBBoxPolygonGroup(t,e){let r=e.bbox().intersection1(t);if(!r)return!1;for(let i of e.items)if(i.bbox().isIntersect(r)){for(let n of i.items)if(n.bbox().isIntersect(r)){for(let s of n.primitives)if(r.isIntersect(s.bbox()))return!0}}return!!this.IsCenterBBoxPointInPolygonType(t,e)}},xJe=class d7{static createNode(t,e,r){let i=t.UL(),n=t.width()/e,s=t.height()/e,a=~~(r/e),l=r-a*e,c=i.x+l*n,h=i.y-(a+1)*s,u=c+n,d=h+s;return new ht(c,u,h,d)}static ocTreeSplitNode(t,e,r,i,n=2){if(t.length<=r)return t;let s=[],a=n**2,l=new Array(a),c=new Array(a);for(let p=0;p<a;p++)l[p]=new Array(t.length),c[p]=0;let h=e.UL(),u=e.width()/n,d=e.height()/n;for(let p of t){let m=i(p).center(),g=~~((m.x-h.x)/u),y=~~((h.y-m.y)/d)*n+g;try{l[y][c[y]]=p,c[y]+=1}catch{s.push(p)}}for(let p=0;p<l.length;p++){let m=c[p];if(m<=0)continue;let g=l[p].slice(0,m);if(g.length===t.length)return t;let y=d7.createNode(e,n,p),b=d7.ocTreeSplitNode(g,y,r,i,n);if(b.length===t.length)return t;s.push(b)}return s}static ocTreeSplitNodeMinIntersect(t,e,r,i){let n=[];if(t.length<=r)return t;let s=3,a=e.LL(),l=e.UR(),c=e.width()/(s+1),h=e.height()/(s+1),u=-(2**32),d=[],p=[];for(let m=1;m<=s;m++)for(let g=1;g<=s;g++){let y=a.x+c*m,b=a.y+h*g,P=[[],[],[],[]],T=new Array(4),I=new Array(4);I[0]=new ht(a.x,y,b,l.y),I[1]=new ht(y,l.x,b,l.y),I[2]=new ht(a.x,y,a.y,b),I[3]=new ht(y,l.x,a.y,b);for(let _ of t){let x=i(_).center(),v=-1,D=-1;x.x===y?v=Math.random()>=.5?1:-1:x.x>y?v=1:x.x<y&&(v=-1),x.y===b?D=Math.random()>=.5?1:-1:x.y>b?D=1:x.y<b&&(D=-1),v===1&&D===1?P[1].push(_):v===1&&D===-1?P[3].push(_):v===-1&&D===-1?P[2].push(_):v===-1&&D===1&&P[0].push(_)}for(let _=0;_<4;_++){let x=P[_];if(x.length<=0)continue;let v=new _e;for(let D of x)v.ext1(i(D));T[_]=v.build1()}let C=0,E=0;for(let _ of T)_&&(C+=_.area());E=C;let O=(_,x)=>{if(!T[_]||!T[x])return 0;let v=T[_].intersection1(T[x]);return v?v.area():0};E-=O(0,1),E-=O(0,2),E-=O(0,3),E-=O(1,2),E-=O(1,3),E-=O(2,3),E/C>=u&&(d=P,p=I)}for(let m=0;m<d.length;m++){let g=d[m];if(g.length<=0)continue;let y=p[m],b;if(g.length===t.length?b=d7.ocTreeSplitNode(g,y,r,i):b=d7.ocTreeSplitNodeMinIntersect(g,y,r,i),b.length===t.length)return t;n.push(b)}return n}static ocTreeSplit(t,e,r,i){return d7.ocTreeSplitNode(t,e,r,i,Ng.OcTreeSplitStep)}},RJe=class sve{static OcTreeOptimizeSplit(t){let e=t[0];if(e!==1||t.length<=Ng.LocalBestThread+1)return t;let r=t.slice(1),i=new Array(r.length);for(let c=1;c<t.length;c++)i[c-1]=c;let n=FU.getListBBox(r),s=xJe.ocTreeSplit(i,n,Ng.LocalBestThread,c=>{let h=t[c];return FU.getSingleBBox(h)}),a=(c,h)=>{if(!(c.length<=0))for(let u of c)if(Array.isArray(u)){let d=[h[0]];a(u,d),h.push(d)}else{let d=t[u];h.push(d)}},l=[e];return a(s,l),l}static optimizeSplit(t,e){let r=t[0];if(r===2){if(Ng.HandleDiff){let n=t[1],s;if(Array.isArray(n)){let a=this.optimizeSplit(n,e);if(a.length<=1)return[2];s=vK(a,e)}else s=vK([2,n],e);if(t.length>3){let a;a=[1];for(let l=2;l<t.length;l++){let c=t[l];if(Array.isArray(c)){let h=FU.getListBBox([...c.slice(1)]);FU.KeepBBoxPolygonGroup(h,s)&&a.push(c)}else FU.KeepBBoxPolygonGroup(c.bbox(),s)&&a.push(c)}return a.length<=1?[2,s]:(a=this.optimizeSplit(a,e),a.length>1?[2,s,...a.slice(1)]:[2,s])}else{let a=t[2];if(Array.isArray(a)&&a[0]===1&&a.length>2){let l=a.slice(1);return this.optimizeSplit([2,s,...l],e)}}}else if(t.slice(1).length>2){let n=t[1],s=t.slice(2),a=this.optimizeSplit([1,...s],e);return a.length>1?[2,n,...a.slice(1)]:n}}else if(r===1){if(t.length-1>Ng.LocalBestThread){let n=!1;for(let s=1;s<t.length;s++){let a=t[s];if(!Array.isArray(a)){n=!0;break}}n&&(t=sve.OcTreeOptimizeSplit(t))}}else if(r===0&&t.length<=2)return[0];let i=[r];for(let n=1;n<t.length;n++){let s=t[n];if(Array.isArray(s)){let a=this.optimizeSplit(s,e);if(a.length<=1)continue;i.push(a)}else i.push(s)}return i}},Cl=(o=>(o[o.INTERSECT=0]="INTERSECT",o[o.UNION=1]="UNION",o[o.DIFF=2]="DIFF",o[o.XOR=3]="XOR",o))(Cl||{});function YU(o){let t=o[0],e=[t];switch(t){case 0:for(let i=1;i<o.length;i++){let n=o[i];if(Array.isArray(n)&&(n=YU(n),!n))return null;e.push(n)}break;case 1:case 3:for(let i=1;i<o.length;i++){let n=o[i];Array.isArray(n)&&(n=YU(n),!n)||e.push(n)}break;case 2:let r=o[1];if(Array.isArray(r)&&(r=YU(r)),!r)return null;e.push(r);for(let i=2;i<o.length;i++){let n=o[i];Array.isArray(n)&&(n=YU(n),!n)||e.push(n)}break;default:throw new Error("not support boolean rule!")}return e.length===1?null:e.length===2?e[1]:e}function yge(o,t,e){return Array.isArray(o)?ave(o,t,e):o}function bge(o,t,e,r,i=!0){if(i)for(;o.length>1;){let n,s=[];for(o.length%2===1?(s.push(o[0]),n=1):n=0;n<o.length;n+=2)s.push(t(o[n],o[n+1],e,r));o=s}else for(;o.length>1;){if(o.length===2)return t(o[0],o[1],e,r);o=[t(o[0],o[1],e,r),...o.slice(2)]}return o[0]}function ave(o,t,e,r=!0){let i=new Array(o.length-1);for(let n=1;n<o.length;n++)i[n-1]=yge(o[n],t,e);switch(o[0]){case 0:return bge(i,BU.intersect,t,e);case 1:return bge(i,BU.union,t,e);case 2:let n=bge(i.slice(1),BU.union,t,e);return n?BU.diff(i[0],n,t,e):i[0];case 3:let s=yge(o[1],t,e);for(let a=2;a<o.length;a++)s=BU.xor(s,yge(o[a],t,e),t,e);return s;default:throw new Error("not support boolean rule! "+o[0])}}function lve(o){let t=[o[0]];for(let e=1;e<o.length;e++){let r=o[e];if(Array.isArray(r)){let i=lve(r);Array.isArray(i)?i.length>1&&t.push(i):t.push(i)}else{let i=AK(r);i!==null&&t.push(Fo.build(i))}}return t}function DJe(o){let t=[];for(let e=0;e<o.length;e+=2){let r=o[e],i=o[e+1];i?t.push({xor:T_([3,r,i]),union:T_([1,r,i])}):t.push({xor:r,union:r})}for(;t.length!==1;){for(let e=0;e<t.length;e+=2){let r=t[e],i=t[e+1],n=e/2;if(!i){t[n]=r;break}let s=T_([2,r.xor,i.union]),a=T_([2,i.xor,r.union]),l=[];s.items.forEach(c=>l.push(c)),a.items.forEach(c=>l.push(c)),t[n]={xor:new Fo(l),union:T_([1,r.union,i.union])}}t.length=Math.ceil(t.length/2)}return t[0].xor}function Lge(o){let t=o[0];if(t===3&&o.length>3){let r=[];for(let i=1;i<o.length;i++){let n=o[i];if(n instanceof Fo)r.push(n);else{let s=Lge(n);s instanceof Fo?r.push(s):r.push(T_(s))}}return DJe(r)}let e=[t];for(let r=1;r<o.length;r++){let i=o[r];i instanceof Fo?e.push(i):e.push(Lge(i))}return T_(e)}function T_(o,t){if(!Ng.UseOptimizeSplit)return vK(o,t);let e=RJe.optimizeSplit(o,t);return e.length<=1?new Fo([]):vK(e,t)}function hP(o,t){Ng.curBus=t;let e=lve(o),r=YU(e);if(!(r instanceof Array))return r||new Fo([]);let i=Lge(r);return i instanceof Fo?i:T_(i)}function vK(o,t,e=!0){if(!o||o.length===1)return new Fo([]);let r=o,i=new vJe,n=[];function s(a){for(let l=1;l<a.length;l++){let c=a[l];Array.isArray(c)?s(c):n.push(c)}}return s(r),i.init(n),ave(r,i,t,e)}var hK=new Error("list is empty"),uK=class{constructor(o,t){this.prev=null,this.next=null,this.parent=o,this.item=t}insertAfter(o){o.next=this.next,this.next=o,o.prev=this,o.next!==null&&(o.next.prev=o)}insertBefore(o){o.prev=this.prev,this.prev=o,o.next=this,o.prev!==null&&(o.prev.next=o)}remove(){this.prev!==null&&(this.prev.next=this.next),this.next!==null&&(this.next.prev=this.prev)}set(o){this.item=o}},wJe=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o.item;throw new Error("iterator is null")}},LJe=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o;throw new Error("iterator is null")}},MJe=class{constructor(){this.first=null,this.last=null,this.cnt=0}add(o){return this.addLast(o)}push(o){return this.addLast(o)}pop(){return this.removeLast()}shift(){return this.removeFirst()}removeFirst(){let o=this.first;if(o===null)throw hK;return this.remove(o),o.item}removeLast(){let o=this.last;if(o===null)throw hK;return this.remove(o),o.item}addLast(o){if(this.first===null||this.last===null){let t=new uK(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertAfter(this.last,o)}addFirst(o){if(this.first===null||this.last===null){let t=new uK(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertBefore(this.first,o)}getFirst(){if(this.first===null)throw hK;return this.first.item}getLast(){if(this.last===null)throw hK;return this.last.item}insertAfter(o,t){let e=new uK(this,t);return o.insertAfter(e),o===this.last&&(this.last=e),this.cnt++,e}insertBefore(o,t){let e=new uK(this,t);return o.insertBefore(e),o===this.first&&(this.first=e),this.cnt++,e}remove(o){o.remove(),o===this.first&&(this.first=o.next),o===this.last&&(this.last=o.prev),this.cnt--}size(){return this.cnt}clear(){this.first=null,this.last=null,this.cnt=0}iterator(){return new wJe(this.first)}listIterator(){return new LJe(this.first)}toArray(){let o=new Array,t=this.first;for(;t!=null;)o.push(t.item),t=t.next;return o}},yK=class{constructor(o){this.inters=[],o&&(this.inters=o)}addInter(o){this.inters.push(o),o.group=this}findInter(o){let t=this.inters.find(e=>rn(e.coord,o.coord));return t&&this.inters.find(e=>e.side===o.side)&&o.visitSelf(),t}getOutInter(o){let t=this.inters.filter(e=>!e.getVisited());if(t.length!==0)return t.length===1?t[0]:t.reduce((e,r)=>{if(!e||e.side.getShape()===o)return r;if(r.side.getShape()===o)return e;let i=e.coord,n=Kn(o,i),s=Kn(e.side.getShape(),i),a=Kn(r.side.getShape(),i);return n.dot(s)>n.dot(a)?e:r},void 0)}getEntryInter(){}},Pge=0;function C_(o,t){let e=o.primitives[0];if(o.primitives.length===1&&e instanceof q&&Math.abs(e.sweepAngle)===360)return[o];let r=kE();Pge++;let i,n=WJe(o);if(n.length===0)return[];let s=BJe(n);if(Pge===-1){i=new QU(t);let h=i.initColor(Il.BLUE);n.forEach(d=>h.addPt(d.getShape()));let u=i.initColor(Il.GREEN);s.forEach(d=>u.addPoint(d.coord)),i.draw();debugger;throw new Error}if(s.length===0)return[ge.build7(n.map(h=>h.getShape()))];FJe(s);let a=[],l=!1;try{UJe(s,i)}catch(h){h.customType==="IS_OVERLAP"?(l=!0,a=new HU().getUnion([o]).map(u=>u.items).flat(2)):console.error(h)}if(l)return a;let c=GJe(s);if(!c.length)return[ge.build7(n.map(h=>h.getShape()))];if(a=NJe(c,i),a.length===0)return console.warn("=====deSelfIntersection=====",Pge),[];if(i)throw a.forEach(h=>{i.initColor(Il.WHITE).addPly(h),i.draw();debugger}),new Error;return Y2.deSelfIntersection+=wT(r),a}function NJe(o,t){let e=[];return o.forEach(r=>{let i=r;r.inters.forEach(n=>{if(n.getVisited())return;let s=[],a=[],l;if(t){debugger;let h=t.initColor(Il.RED);l=u=>{s.push(u),h.addPt(s[s.length-1]),t.draw();debugger}}else l=h=>s.push(h);do{let h=function(g,y){sr.eq(g.distance2(y),0)||l(cve(p.getShape(),g,y))},u=a.findIndex(g=>g===n.group);if(u!==-1){let g=s.findIndex(P=>P===n.group),y=s.splice(g).filter(P=>!(P instanceof yK));if(y.length){let P=bf(ge.build7(y));P&&e.push(P)}let b=s.filter(P=>!(P instanceof yK));if(n=a[u].getOutInter(b[b.length-1]),a.splice(u),!n)throw Error("interGroup not hav inter!!!2");continue}n.visitSelf(),a.push(n.group),s.push(n.group);let d=n.getIndex(),p=n.side,m=p.inters[d+1];for(;m!=null&&m.isInvalid||m&&m.group===n.group;)m=p.inters[m.getIndex()+1];if(m){h(n.coord,m.coord);let g=m.getBindedInter();if(n=g.getVisited()?g.group.getOutInter(g.side.getShape()):g,!n){if(m.group===i)break;throw new Error("interGroup not hav inter!!!3")}}else{for(h(n.coord,p.getEnd()),p=p.nextSide,n=null;;){for(let g of p.inters)if(!g.isInvalid){let y=g.group.getOutInter(p.getShape());if(!y){if(g.group===i){n=g;break}else if(g.getBindedInter().group===i){n=g.getBindedInter();break}continue}n=y;break}if(n)break;l(p.getShape()),p=p.nextSide}sr.eq(p.getEnd().distance2(n.coord),0)?l(p.getShape()):h(p.getStart(),n.coord)}}while(n.group!==i);let c=bf(ge.build7(s.filter(h=>!(h instanceof yK))));c&&e.push(c)})}),e}function kJe(o){return{next(){return o.hasNext()?{value:o.next()}:{done:!0,value:void 0}},[Symbol.iterator](){return this}}}function BJe(o){let t=[],e=new MJe;for(let r of o.slice().sort((i,n)=>i.bbox().minY-n.bbox().minY)){for(let i of kJe(e.listIterator())){let n=i.item;if(n.bbox().maxY<r.bbox().minY)e.remove(i);else{let s=function(d,p){let m=new wE(p,d,null);return d.inters.push(m),t.push(m),m},a=function(d,p){let m=d.getEnd(),g=new S($e[0],$e[1]),y=new S($e[2],$e[3]),b=m.distance2(g)>m.distance2(y)?g:y,P=d.prevSide;s(rn(P.getEnd(),b)?P:d,b).bind(s(p,b))},l=n.getShape(),c=r.getShape(),h=G0(l,c),u=h===4&&$e[0]===$e[2]&&$e[1]===$e[3];if(u&&(h-=2),n.nextSide===r)n.prevSide!==r&&h===4&&a(n,r);else if(n.prevSide===r)h===4&&a(r,n);else if(h!==0){let d=function(m,g){let y=m.prevSide;return s(rn(y.getEnd(),g)?y:m,g)},p=new S($e[0],$e[1]);if(u&&!rn(p,n.prevSide.getEnd())&&!rn(p,r.prevSide.getEnd())&&Kn(l,p).dot(Kn(c,p))>0)continue;for(let m=0;m<h;m+=2){let g=new S($e[m],$e[m+1]);d(n,g).bind(d(r,g))}}}}e.add(r)}return t.forEach(r=>{r.getIndex()===void 0&&r.side.sortInters()}),t}function FJe(o){o.forEach(t=>{let e=t.side.getEnd();if(t.isInvalid||!rn(t.coord,e))return;let r=t.side.inters,i=t.getBindedInter().side;for(let n=r.length-1;n>=0;n--){let s=r[n];if(!rn(s.coord,e))break;s!==t&&s.getBindedInter().side===i&&s.setIsInvalid()}})}function VJe(o){let t=new i2(10);return o.forEach(e=>{e.isInvalid||t.add(e)}),t}function GJe(o){let t=[],e=VJe(o);return o.forEach(r=>{if(r.isInvalid||r.group)return;let i=e.search(r.bbox().extendOfSize(sr.eps)).filter(n=>!n.group);if(i.length){let n=new Set,s=new yK(i);i.forEach(a=>{a.group=s,n.has(a.side)&&a.visitSelf(),n.add(a.side)}),t.push(s)}}),t}function UJe(o,t){o.forEach(e=>{if(e.isInvalid||e.dealed)return;let r=e.side,i=e.getBindedInter().side,n;rn(r.getEnd(),e.coord)&&rn(i.getEnd(),e.coord)?n=-1:rn(r.getEnd(),e.coord)?r.nextSide!==i&&(n=1,e=e.getBindedInter()):rn(i.getEnd(),e.coord)&&i.nextSide!==r&&(n=1),HJe(n,e,t),e.isDealed()})}function HJe(o,t,e){let r=t.getBindedInter(),i=t.side,n=r.side,s=i.getShape(),a=n.getShape(),l=1,c=!1;if(o===-1){if(s7(s.reverse(),a.reverse())||s7(i.nextSide.getShape(),n.nextSide.getShape())){let u=RE(i,i.nextSide,n,r,l,c,e);if(u.state===2){let p=new Error("info1.state === InState.IS_OVERLAP");throw p.customType="IS_OVERLAP",p}let d=RE(i,i.nextSide,n.nextSide,r,l,c,e);u.state===d.state&&h(u,d)}else if(!(s7(s.reverse(),n.nextSide.getShape())||s7(i.nextSide.getShape(),a.reverse()))){let u=hge(i,i.nextSide,n,!1,e);u===hge(i,i.nextSide,n.nextSide,!0,e)&&u!==hge(n,n.nextSide,i.nextSide,!0,e)&&t.setIsInvalid()}}else if(o===1){let u=function(d,p){return Kn(d,p.start()).dot(Kn(p,p.start()))>0};if(s7(s.reverse(),a.reverse())||s7(s,n.nextSide.getShape())){let d=cP(i,n,r,e,l,c,new Map);if(d.state===2){let m=new Error("info1.state === InState.IS_OVERLAP");throw m.customType="IS_OVERLAP",m}let p=cP(i,n.nextSide,r,e,l,c,new Map);d.state===p.state&&h(d,p)}else if(u(s.reverse(),a.reverse())&&u(s,n.nextSide.getShape())){let d=yf(i,n,!1,e);d===yf(i,n.nextSide,!0,e)&&d!==hw(n,n.nextSide,new eH(cve(s,t.coord,s.end()),e),!0,e)&&t.setIsInvalid()}}function h(u,d){u.inter.setIsInvalid(),d.inter.setIsInvalid(),t.setIsInvalid()}}function cve(o,t,e){if(o instanceof M||t.distance2(e)<1e-6)return new M(t,e);if(o instanceof q)return q.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.sweep());if(o instanceof Dr){let r=o.getPercent(t,Zn),i=o.getPercent(e,Zn);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}function WJe(o){let t=bf(o);if(!t)return[];let e=t.primitives.map(i=>new eH(i,null)),r=e[e.length-1];return e.forEach(i=>{r.connect(i),r=i}),e}var V1=class{static clearData(o){this.originalPrimitive=[],this.offsetPrimitive=[],this.rawOffsetPrimitive=[],this.offsetDistance=0,this.testI++,this.testI===0?this.drawDebug=new QU(o):delete this.drawDebug}static createRawOffsetEdge(){if(this.drawDebug){let o=this.drawDebug.initColor(Il.WHITE);this.originalPrimitive.forEach(t=>o.addPt(t)),this.drawDebug.draw();debugger}for(let o=0;o<this.originalPrimitive.length;o+=1){let t=this.originalPrimitive[o];this.offsetPrimitive.push({index:o,offsetEdge:this.createOffsetEdge(t)})}if(this.drawDebug){let o=this.drawDebug.initColor(Il.Golden);this.offsetPrimitive.forEach(t=>o.addPt(t.offsetEdge)),this.drawDebug.draw();debugger}if(this.offsetPrimitive.length>1)for(let o=0;o<this.offsetPrimitive.length;o+=1)if(o===this.offsetPrimitive.length-1){this.connectPrimitive(this.offsetPrimitive[o],this.offsetPrimitive[0]);let t=this.rawOffsetPrimitive[0],e;t instanceof q?e=q.build4(this.offsetPrimitive[0].offsetEdge.start(),t.end(),t.center,t.rx,t.ry,t.sweep()):e=new M(this.offsetPrimitive[0].offsetEdge.start(),t.end()),this.rawOffsetPrimitive.shift(),this.rawOffsetPrimitive.unshift(e)}else this.connectPrimitive(this.offsetPrimitive[o],this.offsetPrimitive[o+1]);else this.rawOffsetPrimitive=[]}static createCirclePrimitive(o,t){let e=o.width()*.5,r=o.height()*.5,i=Math.sqrt(e**2+r**2)+t;return[q.buildCircle(o.center(),i)]}static getExtendPolyLine(o,t,e=!0,r){var i,n;if(!((i=o==null?void 0:o.primitives)!=null&&i.length))return[];this.isExpansion=t>0;let s=bf(o);if(!((n=s==null?void 0:s.primitives)!=null&&n.length)){if(this.isExpansion){let l=[1],c=t*2;o.primitives.forEach(u=>l.push(u.stroke(c,1,0)));let h=hP(l,r);if(h.items.length!==1)throw new Error("group.items.length !== 1 ");return[h.items[0].items[0]]}return[]}if(o=s,this.clearData(r),this.originalPrimitive=o.primitives,this.offsetDistance=t,this.createRawOffsetEdge(),this.drawDebug){let l=this.drawDebug.initColor(Il.BLUE);this.rawOffsetPrimitive.forEach(c=>l.addPt(c)),this.drawDebug.draw();debugger}let a=e?this.createClippingEdge(r):[ge.build2(this.rawOffsetPrimitive)];if(this.drawDebug){let l=this.drawDebug.initColor(Il.RED);a.forEach(c=>l.addPly(c)),this.drawDebug.draw();debugger}if(a.length&&(!this.isExpansion||this.isExpansion&&a.length>1)&&(a=this.getValidityPrimitive(a)),this.drawDebug){let l=this.drawDebug.initColor(Il.GREEN);a.forEach(c=>l.addPly(c)),this.drawDebug.draw();debugger;throw new Error}return a}static getValidityPrimitive(o){let t=[],e=Math.abs(this.offsetDistance);for(let r=0;r<o.length;r+=1){let i=!0,n=o[r].primitives;e:for(let s=0;s<n.length;s+=1){let a=n[s],l;if(a instanceof q)l=a.midPoint;else if(a instanceof M)l=a.start();else throw new Error("not support!");for(let c=0;c<this.originalPrimitive.length;c+=1){let h=this.originalPrimitive[c],u;if(h instanceof q?u=this.pointArcClosest(l,h):u=RZe(l,h.start(),h.end()).d,e-u>.01){i=!1;break e}}}i&&t.push(o[r])}return t}static getInters(o){let t=[];for(let e=0;e<o;e+=2)t.push(new S($e[e],$e[e+1]));return t}static pointArcClosest(o,t){let e=t.center;if(o.equals1(t.center))return t.rx;if(t.inArea(o,0)){let n=o.sub(e);return Math.abs(n.length()-t.rx)}let r=o.distance2(t.start()),i=o.distance2(t.end());return sr.less(r,i)?Math.sqrt(r):Math.sqrt(i)}static createClippingEdge(o){let t=[],e=[],r=C_(ge.build2(this.rawOffsetPrimitive),o);r.forEach(n=>{let s=n.area(.01);t.push(s)});let i=Math.min(...t.filter(n=>n<0));for(let n=0;n<t.length;n+=1){let s=t[n];sr.eq(s,0)||(!this.isExpansion&&s<0||this.isExpansion&&(s<0&&t[n]===i||s>0))&&e.push(r[n])}return e}static createOffsetEdge(o){if(o instanceof q)return o.panDistance2(this.offsetDistance);if(o instanceof M)return o.panDistance(this.offsetDistance);throw new Error("not support!")}static connectPrimitive(o,t){o.offsetEdge instanceof M&&t.offsetEdge instanceof M?this.lineToLineConnect(o,t):o.offsetEdge instanceof q&&t.offsetEdge instanceof q?this.arcToArcConnect(o,t):o.offsetEdge instanceof M&&t.offsetEdge instanceof q?this.lineToArcConnect(o,t):this.arcToLineConnect(o,t)}static isFalseIntersection(o){return o>1||o<0}static lineToLineConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=o.index,n=t.index,s=this.originalPrimitive[n].start();if(e.isParallel(r))e.bbox().intersection1(r.bbox())?this.rawOffsetPrimitive.push(e):this.lineToLineUseArcToConnect(s,e,r,i);else{let a=this.getLineToLineT(e,r),l=a[0],c=a[1];if(this.isFalseIntersection(l)||this.isFalseIntersection(c))l>1&&this.isFalseIntersection(c)?this.lineToLineUseArcToConnect(s,e,r,i):this.useLineToConnect(e,r);else if(!this.isFalseIntersection(l)&&!this.isFalseIntersection(c)){let h=e.end().sub(e.start()),u=e.start().add(h.mul(l)),d=new M(e.start(),u);this.rawOffsetPrimitive.push(d);let p=new M(u,r.end());this.updateNextOffsetPrimitive(n,p)}}}static updateNextOffsetPrimitive(o,t){this.offsetPrimitive[o].offsetEdge=t}static useLineToConnect(o,t){this.rawOffsetPrimitive.push(o);let e=new M(o.end(),t.start());this.rawOffsetPrimitive.push(e)}static lineToLineUseArcToConnect(o,t,e,r){let i=this.getSweep(o,t,r),n=this.getSweepAngel(t.end(),e.start(),o,i);if(n===0){this.useLineToConnect(t,e);return}this.rawOffsetPrimitive.push(t);let s=q.build5(t.end(),e.start(),n);this.rawOffsetPrimitive.push(s)}static getSweep(o,t,e){let r=null,i=e||e===0?this.originalPrimitive[e]:t;if(i instanceof q){let n=i.center.sub(i.end()).normalize();i.isCCW?r=new S(n.y,-n.x):r=new S(-n.y,n.x)}else r=t.end().sub(t.start()).normalize();return o.sub(t.end()).normalize().cross(r)>0?0:1}static getLineToLineT(o,t){let e=o.end().sub(o.start()),r=t.end().sub(t.start()),i=e.cross(r),n=t.start().sub(o.start()),s=o.start().sub(t.start()),a=n.cross(r)/i,l=s.cross(e)/-i;return[a,l]}static lineToArcConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=o.index,n=t.index,s=this.getLineJoinArcScalarAndIntersectionNum(e,r),a=this.originalPrimitive[n].start();if(s.intersectionNum===0)this.lineAndArcUseArcConnect(a,e,r,i);else if(s.intersectionNum===1){let l=s.points[0];this.lineAndArcConnectionDetail(e,r,s.t[0],l,a,i,n)}else if(s.intersectionNum===2){let l=s.points[0],c=s.points[1],h=l.distance2(a),u=c.distance2(a);this.lineAndArcConnectionDetail(e,r,h<u?s.t[0]:s.t[1],h<u?l:c,a,i,n)}}static lineAndArcConnectionDetail(o,t,e,r,i,n,s){let a=this.isTrueArcIntersection(t,r);if(!this.isFalseIntersection(e)&&a){let l=new M(o.start(),r);this.rawOffsetPrimitive.push(l);let c;!t.center.equals1(r)||t.sweepAngle>1e-4?(c=q.build4(r,t.end(),t.center,t.rx,t.ry,t.sweep()),c instanceof q&&c.sweepAngle===0&&(c=new M(c.start(),c.end()))):c=new M(t.center,r),this.updateNextOffsetPrimitive(s,c)}else a?this.useLineToConnect(o,t):this.lineAndArcUseArcConnect(i,o,t,n)}static lineAndArcUseArcConnect(o,t,e,r){let i=this.getSweep(o,t,r),n=this.getSweepAngel(t.end(),e.start(),o,i);if(n===0){this.useLineToConnect(t,e);return}let s=q.build5(t.end(),e.start(),n);this.rawOffsetPrimitive.push(t),this.rawOffsetPrimitive.push(s)}static arcToLineConnectionDetail(o,t,e,r,i,n,s){let a=this.isTrueArcIntersection(o,r);if(!this.isFalseIntersection(e)&&a){let l;o.center.equals1(r)?l=new M(o.center,r):Math.abs(o.sweepAngle)<1e-4?l=new M(o.start(),r):(l=q.build4(o.start(),r,o.center,o.rx,o.ry,o.sweep()),l instanceof q&&l.sweepAngle===0&&(l=new M(l.start(),l.end()))),this.rawOffsetPrimitive.push(l);let c=new M(r,t.end());this.updateNextOffsetPrimitive(s,c)}else a?this.useLineToConnect(o,t):this.lineAndArcUseArcConnect(i,o,t,n)}static isTrueArcIntersection(o,t){return up(o,t)}static getSweepAngel(o,t,e,r){let i=o.angleD(e),n=t.angleD(e),s;return i===n?s=0:(i=so.regularD(i),n=so.regularD(n),r===1?n<=i&&(n+=360):n>=i&&(i+=360),s=n-i),s}static getLineJoinArcScalarAndIntersectionNum(o,t){let e={t:[],intersectionNum:0,points:[]},r=_Ze(t,o);if(r){e.intersectionNum=r/2;for(let i=0;i<r-1;i+=2){let n=new S($e[i],$e[i+1]);e.points.push(n),n.sub(o.start()).x<1e-4||n.sub(o.start()).y<1e-4?e.t.push(0):e.t.push(n.sub(o.start()).x/o.end().sub(o.start()).x)}}else e.intersectionNum=0;return e}static arcToLineConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=o.index,n=t.index,s=this.getLineJoinArcScalarAndIntersectionNum(r,e),a=this.originalPrimitive[n].start();if(s.intersectionNum===0)this.lineAndArcUseArcConnect(a,e,r,i);else if(s.intersectionNum===1){let l=s.points[0];this.arcToLineConnectionDetail(e,r,s.t[0],l,a,i,n)}else if(s.intersectionNum===2){let l=s.points[0],c=s.points[1],h=l.distance2(a),u=c.distance2(a);this.arcToLineConnectionDetail(e,r,h<u?s.t[0]:s.t[1],h<u?l:c,a,i,n)}}static rxChangeStatus(o){return o===1?!this.isExpansion:this.isExpansion}static arcToArcConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=G_e(e,r);if(i){let n=this.getInters(i),s;if(n.length===2){let c=this.originalPrimitive[t.index].start(),h=n[0],u=n[1],d=h.distance2(c),p=u.distance2(c);d<p?s=h:s=u}else s=n[0];let a,l;s.equals1(e.center)?a=new M(e.center,s):Math.abs(e.sweepAngle)<1e-4?a=new M(e.start(),s):(a=q.build4(e.start(),s,e.center,e.rx,e.ry,e.sweep()),a instanceof q&&a.sweepAngle===0&&(a=new M(a.start(),a.end()))),this.rawOffsetPrimitive.push(a),s.equals1(r.center)?l=new M(s,r.center):Math.abs(r.sweepAngle)<1e-4?l=new M(s,r.end()):(l=q.build4(s,r.end(),r.center,r.rx,r.ry,r.sweep()),l instanceof q&&l.sweepAngle===0&&(l=new M(l.start(),l.end()))),this.updateNextOffsetPrimitive(t.index,l)}else{let n=this.originalPrimitive[o.index],s=this.originalPrimitive[t.index],a=this.rxChangeStatus(n.sweep()),l=this.rxChangeStatus(s.sweep()),c=this.originalPrimitive[t.index].start(),h=this.getSweep(c,e,o.index),u=Math.abs(this.offsetDistance),d=q.build2(c,a?n.endAngle():n.endAngle()+180,l?s.startAngle:s.startAngle+180,u,u,h);this.rawOffsetPrimitive.push(e),this.rawOffsetPrimitive.push(d)}}};V1.originalPrimitive=[],V1.offsetPrimitive=[],V1.rawOffsetPrimitive=[],V1.testI=0;var Uge=class jU extends rl{constructor(t,e,r,i,n,s){if(super(),e<0||r<0)throw new Error("The width and height of rect can't be less than 0!");this.leftUpPoint=t,this.width=e,this.height=r,this.angle=i,this.isCCW=n,this.radius=Math.min(Math.max(s,0),e/2,r/2)}get radiusRatio(){return this.radius/Math.min(this.width,this.height)}start(){return this.leftUpPoint.add(new S(this.radius,0).multiply3(Qe.rotateD(this.angle)))}end(){return this.start()}getLeftPoint(){return this.leftUpPoint.add(new S(0,-this.height/2).multiply3(Qe.rotateD(this.angle)))}getRightPoint(){return this.leftUpPoint.add(new S(this.width,-this.height/2).multiply3(Qe.rotateD(this.angle)))}extend(t){return new jU(this.leftUpPoint.add(new S(-t,t).rotateD(S.ORIGIN,this.angle)),this.width+t*2,this.height+t*2,this.angle,this.isCCW,this.radius+t)}bbox(){let t=Qe.rotateD(this.angle),{leftUpPoint:e,width:r,height:i,radius:n}=this,s=e.add(new S(n,-n).multiply3(t)),a=e.add(new S(n,n-i).multiply3(t)),l=e.add(new S(r-n,-n).multiply3(t)),c=e.add(new S(r-n,n-i).multiply3(t));return new ht(Math.min(s.x,a.x,l.x,c.x)-n,Math.max(s.x,a.x,l.x,c.x)+n,Math.min(s.y,a.y,l.y,c.y)-n,Math.max(s.y,a.y,l.y,c.y)+n)}toPolyline(){let t=[],{leftUpPoint:e,width:r,height:i,radius:n}=this;if(n===0){let a=S.ORIGIN,l=new S(r,0),c=new S(r,-i),h=new S(0,-i);t.push(new M(a,l),new M(l,c),new M(c,h),new M(h,a))}else{let a=new S(0,-n),l=new S(n,0),c=new S(r-n,0),h=new S(r,-n),u=new S(r,n-i),d=new S(r-n,-i),p=new S(n,-i),m=new S(0,n-i);t.push(q.build1(a,l,n,n,!1,0),new M(l,c),q.build1(c,h,n,n,!1,0),new M(h,u),q.build1(u,d,n,n,!1,0),new M(d,p),q.build1(p,m,n,n,!1,0),new M(m,a))}t=t.filter(a=>!a.start().equals1(a.end())),this.isCCW&&(t.forEach((a,l)=>t[l]=a.reverse()),t.reverse());let s=Qe.rotateD(this.angle).translate1(e);return ge.build2(t.map(a=>a.multiply3(s)))}center(){return this.leftUpPoint.add1(this.width/2,this.height/2).rotateD(this.leftUpPoint,this.angle)}multiply3(t){let e=this.leftUpPoint.multiply3(t),r=new S(this.width,0).multiply3(Qe.rotateD(this.angle)).multiply3(t),i=new S(0,-this.height).multiply3(Qe.rotateD(this.angle)).multiply3(t);return t.isMirrored()?new jU(e,i.length(),r.length(),i.angleD(S.ORIGIN),this.isCCW===1?0:1,this.radius*r.length()/this.width):new jU(e,r.length(),i.length(),r.angleD(S.ORIGIN),this.isCCW,this.radius*r.length()/this.width)}reverse(){return new jU(this.leftUpPoint,this.width,this.height,this.angle,this.isCCW===1?0:1,this.radius)}stroke(t,e,r){let i=this.stroke1(t,e,r);if(i.length===1)return i[0];{let[n,s]=i;return ge.build2(n.primitives.concat(new M(n.primitives[0].start(),s.primitives[0].start()),s.primitives,new M(s.primitives[0].start(),n.primitives[0].start())))}}stroke1(t,e,r){let i=r===this.isCCW?this:this.reverse(),n=t/2,s=Math.min(i.width,i.height)/2,a=i.extend(n).toPolyline();return s<=n?[a]:[a,i.extend(-n).toPolyline().reverse()]}points(t){let e=this.toPolyline(),r=[];return e.points(t,i=>r.push(i)),r}toBezier(){throw new Error("Method not implemented.")}},zJe=.01,Zo=class IC{static simplify(t){return t=bf(t),t?new IC([t]):null}static buildByStroke(t,e,r=1,i=Bge,n){if(t instanceof q&&(t.rx<e/2+zJe||Math.abs(t.sweepAngle)>180&&sr.lesseq(t.start().distance1(t.end()),e))){let a=C_(t.stroke(e,r,0),n);if(a.length===0)return null;if(a.length===1)return new IC(a);let l=[null],c=Number.POSITIVE_INFINITY;return a.forEach(h=>{let u=h.area(.1);u<0?u<c&&(l[0]=h,c=u):l.push(h)}),new IC(l)}else if(t instanceof Uge){let a=t.stroke1(e,r,0).map(l=>bf(l));return a[0]?a[1]?new IC(a):new IC([a[0]]):null}let s=t.stroke(e,r,0,i);return s?this.simplify(s):null}static buildCircle(t,e){return this.simplify(ge.build7([q.buildCircle(t,e,0)]))}static buildRect(t){return this.simplify(t.toPolyline())}static buildBBox(t){return this.simplify(ge.buildBBox(t,0))}constructor(t){this.items=t.slice()}multiply3(t){return new IC(this.items.map(e=>e.multiply3(t)))}bbox(){return this.items[0].bbox()}isEqual(t){return t instanceof IC?this.items.every(e=>t.items.some(r=>r.isEqual(e))):!1}getOutMostPolyline(){return this.items[0]}extend(t,e){if(this.items.length!==1)throw new Error("this.items.length !== 1");if(t===0)return new Fo([this]);let r=this.items[0],i=[];for(let h of r.primitives)if(h instanceof M)i.push(h);else if(h instanceof q&&h.rx===h.ry)s(h);else if(h instanceof Dr)n(h);else throw new Error("not support!");r=ge.build7(i);function n(h){let u=h.points(.1);for(let d=0;d<u.length-1;d++){let p=u[d],m=u[d+1];i.push(new M(p,m))}}function s(h){if(Math.abs(h.sweepAngle)>270){let u=h.sweepAngle/2;s(q.build3(h.center,h.startAngle,u,h.rx,h.ry)),s(q.build3(h.center,h.startAngle+u,u,h.rx,h.ry))}else i.push(h)}let a=[],l=[];V1.getExtendPolyLine(r,t,!0,e).forEach(h=>{(h.area(.1)>0?l:a).push(h)});let c;if(a.length===1)l.forEach(h=>a.push(h)),c=new Fo([new IC(a)]);else if(a.length===0)console.warn("outlines.length === 0"),c=new Fo([]);else if(l.length===0)c=new Fo(a.map(h=>new IC([h])));else{let h=a.map(u=>[u]);l.forEach(u=>{let d=[],p=u.bbox();if(h.forEach(m=>{m[0].bbox().isContainsBBox1(p)&&d.push(m)}),d.length===1)d[0].push(u);else{if(d.length===0)throw new Error("inPlsArr.length === 0");for(let m of d.sort((g,y)=>g[0].bbox().area()-y[0].bbox().area()))if(m[0].getWindingNum(u.start())===-1){m.push(u);break}}}),c=new Fo(h.map(u=>new IC(u)))}return c}toPolylineGroup(){return new Bt(this.items)}},m9=class XU extends q{toTypeArc(t){return new XU(t.rx,t.ry,t.center,t.startAngle,t.sweepAngle)}constructor(t,e,r,i,n){super(t,e,r,i,n)}static build2(t,e,r,i,n,s){Fa.positive(i),Fa.positive(n),Fa.normal(e),Fa.normal(r);let a;return e===r?(e=so.regularD(e),r=so.regularD(r),a=0):(e=so.regularD(e),r=so.regularD(r),s===1?r<=e&&(r+=360):r>=e&&(e+=360),a=r-e),new XU(i,n,t,so.regularD(e),a)}static build3(t,e,r,i,n){return Fa.positive(i),Fa.positive(n),Fa.normal(r),new XU(i,n,t,so.regularD(e),r)}static build4(t,e,r,i,n,s){let a=t.angleD(r),l=e.angleD(r);return XU.build2(r,a,l,i,n,s)}reverse(){return this.toTypeArc(super.reverse())}exchangeSweep(){return this.toTypeArc(super.exchangeSweep())}exchangeSweepAndStart(){return this.toTypeArc(super.exchangeSweepAndStart())}exchangeSweep1(){return this.toTypeArc(super.exchangeSweep1())}mirrorY(t){return this.toTypeArc(super.mirrorY(t))}mirror(t=S.ORIGIN){return this.toTypeArc(super.mirror(t))}multiply3(t){return this.toTypeArc(super.multiply3(t))}};var tH="#000000",wK="default";var Hge={mil:1,inch:1e3,ft:12e3,yard:36e3,mile:6336e4,km:3937007874e-2,dm:3937,mm:39.37,um:.039,nm:394e-7,pt:13.88888888888889,"px(72)":13.88888888888889,"px(96)":10.416666666666666,"px(100)":10},YJe=(()=>{let o={};for(let t in Hge)o[Hge[t]]=t;return o})();function Wge(o,t){return YJe[o]||t}function rH(o,t){return Hge[o]||t}var LK=class LK{constructor(t,e){this.ratio=t/e}wrap(t){return t*this.ratio}static convert(t,e,r){return t*e/r}};LK.ASIS=new LK(1,1);var nn=LK;var jJe=Object.create,dRe=Object.defineProperty,XJe=Object.getOwnPropertyDescriptor,qJe=Object.getOwnPropertyNames,$Je=Object.getPrototypeOf,KJe=Object.prototype.hasOwnProperty,KE=(o=>typeof od<"u"?od:typeof Proxy<"u"?new Proxy(o,{get:(t,e)=>(typeof od<"u"?od:t)[e]}):o)(function(o){if(typeof od<"u")return od.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')}),Nn=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),ZJe=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of qJe(t))!KJe.call(o,i)&&i!==e&&dRe(o,i,{get:()=>t[i],enumerable:!(r=XJe(t,i))||r.enumerable});return o},pRe=(o,t,e)=>(e=o!=null?jJe($Je(o)):{},ZJe(t||!o||!o.__esModule?dRe(e,"default",{value:o,enumerable:!0}):e,o)),qZ=Nn((o,t)=>{"use strict";typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?t.exports={nextTick:e}:t.exports=process;function e(r,i,n,s){if(typeof r!="function")throw new TypeError('"callback" argument must be a function');var a=arguments.length,l,c;switch(a){case 0:case 1:return process.nextTick(r);case 2:return process.nextTick(function(){r.call(null,i)});case 3:return process.nextTick(function(){r.call(null,i,n)});case 4:return process.nextTick(function(){r.call(null,i,n,s)});default:for(l=new Array(a-1),c=0;c<l.length;)l[c++]=arguments[c];return process.nextTick(function(){r.apply(null,l)})}}}),JJe=Nn((o,t)=>{var e={}.toString;t.exports=Array.isArray||function(r){return e.call(r)=="[object Array]"}}),fRe=Nn((o,t)=>{t.exports=KE("stream")}),$Z=Nn((o,t)=>{var e=KE("buffer"),r=e.Buffer;function i(s,a){for(var l in s)a[l]=s[l]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=e:(i(e,o),o.Buffer=n);function n(s,a,l){return r(s,a,l)}i(r,n),n.from=function(s,a,l){if(typeof s=="number")throw new TypeError("Argument must not be a number");return r(s,a,l)},n.alloc=function(s,a,l){if(typeof s!="number")throw new TypeError("Argument must be a number");var c=r(s);return a!==void 0?typeof l=="string"?c.fill(a,l):c.fill(a):c.fill(0),c},n.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return r(s)},n.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return e.SlowBuffer(s)}}),xH=Nn(o=>{function t(y){return Array.isArray?Array.isArray(y):g(y)==="[object Array]"}o.isArray=t;function e(y){return typeof y=="boolean"}o.isBoolean=e;function r(y){return y===null}o.isNull=r;function i(y){return y==null}o.isNullOrUndefined=i;function n(y){return typeof y=="number"}o.isNumber=n;function s(y){return typeof y=="string"}o.isString=s;function a(y){return typeof y=="symbol"}o.isSymbol=a;function l(y){return y===void 0}o.isUndefined=l;function c(y){return g(y)==="[object RegExp]"}o.isRegExp=c;function h(y){return typeof y=="object"&&y!==null}o.isObject=h;function u(y){return g(y)==="[object Date]"}o.isDate=u;function d(y){return g(y)==="[object Error]"||y instanceof Error}o.isError=d;function p(y){return typeof y=="function"}o.isFunction=p;function m(y){return y===null||typeof y=="boolean"||typeof y=="number"||typeof y=="string"||typeof y=="symbol"||typeof y>"u"}o.isPrimitive=m,o.isBuffer=KE("buffer").Buffer.isBuffer;function g(y){return Object.prototype.toString.call(y)}}),QJe=Nn((o,t)=>{typeof Object.create=="function"?t.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}}),RH=Nn((o,t)=>{try{if(e=KE("util"),typeof e.inherits!="function")throw"";t.exports=e.inherits}catch{t.exports=QJe()}var e}),eQe=Nn((o,t)=>{"use strict";function e(s,a){if(!(s instanceof a))throw new TypeError("Cannot call a class as a function")}var r=$Z().Buffer,i=KE("util");function n(s,a,l){s.copy(a,l)}t.exports=(function(){function s(){e(this,s),this.head=null,this.tail=null,this.length=0}return s.prototype.push=function(a){var l={data:a,next:null};this.length>0?this.tail.next=l:this.head=l,this.tail=l,++this.length},s.prototype.unshift=function(a){var l={data:a,next:this.head};this.length===0&&(this.tail=l),this.head=l,++this.length},s.prototype.shift=function(){if(this.length!==0){var a=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,a}},s.prototype.clear=function(){this.head=this.tail=null,this.length=0},s.prototype.join=function(a){if(this.length===0)return"";for(var l=this.head,c=""+l.data;l=l.next;)c+=a+l.data;return c},s.prototype.concat=function(a){if(this.length===0)return r.alloc(0);for(var l=r.allocUnsafe(a>>>0),c=this.head,h=0;c;)n(c.data,l,h),h+=c.data.length,c=c.next;return l},s})(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var s=i.inspect({length:this.length});return this.constructor.name+" "+s})}),mRe=Nn((o,t)=>{"use strict";var e=qZ();function r(s,a){var l=this,c=this._readableState&&this._readableState.destroyed,h=this._writableState&&this._writableState.destroyed;return c||h?(a?a(s):s&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(n,this,s)):e.nextTick(n,this,s)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(s||null,function(u){!a&&u?l._writableState?l._writableState.errorEmitted||(l._writableState.errorEmitted=!0,e.nextTick(n,l,u)):e.nextTick(n,l,u):a&&a(u)}),this)}function i(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function n(s,a){s.emit("error",a)}t.exports={destroy:r,undestroy:i}}),tQe=Nn((o,t)=>{t.exports=KE("util").deprecate}),gRe=Nn((o,t)=>{"use strict";var e=qZ();t.exports=b;function r(k){var N=this;this.next=null,this.entry=null,this.finish=function(){L(N,k)}}var i=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:e.nextTick,n;b.WritableState=g;var s=Object.create(xH());s.inherits=RH();var a={deprecate:tQe()},l=fRe(),c=$Z().Buffer,h=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function u(k){return c.from(k)}function d(k){return c.isBuffer(k)||k instanceof h}var p=mRe();s.inherits(b,l);function m(){}function g(k,N){n=n||q7(),k=k||{};var U=N instanceof n;this.objectMode=!!k.objectMode,U&&(this.objectMode=this.objectMode||!!k.writableObjectMode);var B=k.highWaterMark,G=k.writableHighWaterMark,Y=this.objectMode?16:16*1024;B||B===0?this.highWaterMark=B:U&&(G||G===0)?this.highWaterMark=G:this.highWaterMark=Y,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var X=k.decodeStrings===!1;this.decodeStrings=!X,this.defaultEncoding=k.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(K){x(N,K)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new r(this)}g.prototype.getBuffer=function(){for(var k=this.bufferedRequest,N=[];k;)N.push(k),k=k.next;return N},(function(){try{Object.defineProperty(g.prototype,"buffer",{get:a.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var y;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(y=Function.prototype[Symbol.hasInstance],Object.defineProperty(b,Symbol.hasInstance,{value:function(k){return y.call(this,k)?!0:this!==b?!1:k&&k._writableState instanceof g}})):y=function(k){return k instanceof this};function b(k){if(n=n||q7(),!y.call(b,this)&&!(this instanceof n))return new b(k);this._writableState=new g(k,this),this.writable=!0,k&&(typeof k.write=="function"&&(this._write=k.write),typeof k.writev=="function"&&(this._writev=k.writev),typeof k.destroy=="function"&&(this._destroy=k.destroy),typeof k.final=="function"&&(this._final=k.final)),l.call(this)}b.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function P(k,N){var U=new Error("write after end");k.emit("error",U),e.nextTick(N,U)}function T(k,N,U,B){var G=!0,Y=!1;return U===null?Y=new TypeError("May not write null values to stream"):typeof U!="string"&&U!==void 0&&!N.objectMode&&(Y=new TypeError("Invalid non-string/buffer chunk")),Y&&(k.emit("error",Y),e.nextTick(B,Y),G=!1),G}b.prototype.write=function(k,N,U){var B=this._writableState,G=!1,Y=!B.objectMode&&d(k);return Y&&!c.isBuffer(k)&&(k=u(k)),typeof N=="function"&&(U=N,N=null),Y?N="buffer":N||(N=B.defaultEncoding),typeof U!="function"&&(U=m),B.ended?P(this,U):(Y||T(this,B,k,U))&&(B.pendingcb++,G=C(this,B,Y,k,N,U)),G},b.prototype.cork=function(){var k=this._writableState;k.corked++},b.prototype.uncork=function(){var k=this._writableState;k.corked&&(k.corked--,!k.writing&&!k.corked&&!k.bufferProcessing&&k.bufferedRequest&&w(this,k))},b.prototype.setDefaultEncoding=function(k){if(typeof k=="string"&&(k=k.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((k+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+k);return this._writableState.defaultEncoding=k,this};function I(k,N,U){return!k.objectMode&&k.decodeStrings!==!1&&typeof N=="string"&&(N=c.from(N,U)),N}Object.defineProperty(b.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function C(k,N,U,B,G,Y){if(!U){var X=I(N,B,G);B!==X&&(U=!0,G="buffer",B=X)}var K=N.objectMode?1:B.length;N.length+=K;var J=N.length<N.highWaterMark;if(J||(N.needDrain=!0),N.writing||N.corked){var se=N.lastBufferedRequest;N.lastBufferedRequest={chunk:B,encoding:G,isBuf:U,callback:Y,next:null},se?se.next=N.lastBufferedRequest:N.bufferedRequest=N.lastBufferedRequest,N.bufferedRequestCount+=1}else E(k,N,!1,K,B,G,Y);return J}function E(k,N,U,B,G,Y,X){N.writelen=B,N.writecb=X,N.writing=!0,N.sync=!0,U?k._writev(G,N.onwrite):k._write(G,Y,N.onwrite),N.sync=!1}function O(k,N,U,B,G){--N.pendingcb,U?(e.nextTick(G,B),e.nextTick(V,k,N),k._writableState.errorEmitted=!0,k.emit("error",B)):(G(B),k._writableState.errorEmitted=!0,k.emit("error",B),V(k,N))}function _(k){k.writing=!1,k.writecb=null,k.length-=k.writelen,k.writelen=0}function x(k,N){var U=k._writableState,B=U.sync,G=U.writecb;if(_(U),N)O(k,U,B,N,G);else{var Y=F(U);!Y&&!U.corked&&!U.bufferProcessing&&U.bufferedRequest&&w(k,U),B?i(v,k,U,Y,G):v(k,U,Y,G)}}function v(k,N,U,B){U||D(k,N),N.pendingcb--,B(),V(k,N)}function D(k,N){N.length===0&&N.needDrain&&(N.needDrain=!1,k.emit("drain"))}function w(k,N){N.bufferProcessing=!0;var U=N.bufferedRequest;if(k._writev&&U&&U.next){var B=N.bufferedRequestCount,G=new Array(B),Y=N.corkedRequestsFree;Y.entry=U;for(var X=0,K=!0;U;)G[X]=U,U.isBuf||(K=!1),U=U.next,X+=1;G.allBuffers=K,E(k,N,!0,N.length,G,"",Y.finish),N.pendingcb++,N.lastBufferedRequest=null,Y.next?(N.corkedRequestsFree=Y.next,Y.next=null):N.corkedRequestsFree=new r(N),N.bufferedRequestCount=0}else{for(;U;){var J=U.chunk,se=U.encoding,ce=U.callback,te=N.objectMode?1:J.length;if(E(k,N,!1,te,J,se,ce),U=U.next,N.bufferedRequestCount--,N.writing)break}U===null&&(N.lastBufferedRequest=null)}N.bufferedRequest=U,N.bufferProcessing=!1}b.prototype._write=function(k,N,U){U(new Error("_write() is not implemented"))},b.prototype._writev=null,b.prototype.end=function(k,N,U){var B=this._writableState;typeof k=="function"?(U=k,k=null,N=null):typeof N=="function"&&(U=N,N=null),k!=null&&this.write(k,N),B.corked&&(B.corked=1,this.uncork()),B.ending||W(this,B,U)};function F(k){return k.ending&&k.length===0&&k.bufferedRequest===null&&!k.finished&&!k.writing}function H(k,N){k._final(function(U){N.pendingcb--,U&&k.emit("error",U),N.prefinished=!0,k.emit("prefinish"),V(k,N)})}function z(k,N){!N.prefinished&&!N.finalCalled&&(typeof k._final=="function"?(N.pendingcb++,N.finalCalled=!0,e.nextTick(H,k,N)):(N.prefinished=!0,k.emit("prefinish")))}function V(k,N){var U=F(N);return U&&(z(k,N),N.pendingcb===0&&(N.finished=!0,k.emit("finish"))),U}function W(k,N,U){N.ending=!0,V(k,N),U&&(N.finished?e.nextTick(U):k.once("finish",U)),N.ended=!0,k.writable=!1}function L(k,N,U){var B=k.entry;for(k.entry=null;B;){var G=B.callback;N.pendingcb--,G(U),B=B.next}N.corkedRequestsFree.next=k}Object.defineProperty(b.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(k){this._writableState&&(this._writableState.destroyed=k)}}),b.prototype.destroy=p.destroy,b.prototype._undestroy=p.undestroy,b.prototype._destroy=function(k,N){this.end(),N(k)}}),q7=Nn((o,t)=>{"use strict";var e=qZ(),r=Object.keys||function(p){var m=[];for(var g in p)m.push(g);return m};t.exports=h;var i=Object.create(xH());i.inherits=RH();var n=yRe(),s=gRe();for(i.inherits(h,n),a=r(s.prototype),c=0;c<a.length;c++)l=a[c],h.prototype[l]||(h.prototype[l]=s.prototype[l]);var a,l,c;function h(p){if(!(this instanceof h))return new h(p);n.call(this,p),s.call(this,p),p&&p.readable===!1&&(this.readable=!1),p&&p.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,p&&p.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",u)}Object.defineProperty(h.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function u(){this.allowHalfOpen||this._writableState.ended||e.nextTick(d,this)}function d(p){p.end()}Object.defineProperty(h.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(p){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=p,this._writableState.destroyed=p)}}),h.prototype._destroy=function(p,m){this.push(null),this.end(),e.nextTick(m,p)}}),hve=Nn(o=>{"use strict";var t=$Z().Buffer,e=t.isEncoding||function(P){switch(P=""+P,P&&P.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(P){if(!P)return"utf8";for(var T;;)switch(P){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return P;default:if(T)return;P=(""+P).toLowerCase(),T=!0}}function i(P){var T=r(P);if(typeof T!="string"&&(t.isEncoding===e||!e(P)))throw new Error("Unknown encoding: "+P);return T||P}o.StringDecoder=n;function n(P){this.encoding=i(P);var T;switch(this.encoding){case"utf16le":this.text=d,this.end=p,T=4;break;case"utf8":this.fillLast=c,T=4;break;case"base64":this.text=m,this.end=g,T=3;break;default:this.write=y,this.end=b;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(T)}n.prototype.write=function(P){if(P.length===0)return"";var T,I;if(this.lastNeed){if(T=this.fillLast(P),T===void 0)return"";I=this.lastNeed,this.lastNeed=0}else I=0;return I<P.length?T?T+this.text(P,I):this.text(P,I):T||""},n.prototype.end=u,n.prototype.text=h,n.prototype.fillLast=function(P){if(this.lastNeed<=P.length)return P.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);P.copy(this.lastChar,this.lastTotal-this.lastNeed,0,P.length),this.lastNeed-=P.length};function s(P){return P<=127?0:P>>5===6?2:P>>4===14?3:P>>3===30?4:P>>6===2?-1:-2}function a(P,T,I){var C=T.length-1;if(C<I)return 0;var E=s(T[C]);return E>=0?(E>0&&(P.lastNeed=E-1),E):--C<I||E===-2?0:(E=s(T[C]),E>=0?(E>0&&(P.lastNeed=E-2),E):--C<I||E===-2?0:(E=s(T[C]),E>=0?(E>0&&(E===2?E=0:P.lastNeed=E-3),E):0))}function l(P,T,I){if((T[0]&192)!==128)return P.lastNeed=0,"\uFFFD";if(P.lastNeed>1&&T.length>1){if((T[1]&192)!==128)return P.lastNeed=1,"\uFFFD";if(P.lastNeed>2&&T.length>2&&(T[2]&192)!==128)return P.lastNeed=2,"\uFFFD"}}function c(P){var T=this.lastTotal-this.lastNeed,I=l(this,P,T);if(I!==void 0)return I;if(this.lastNeed<=P.length)return P.copy(this.lastChar,T,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);P.copy(this.lastChar,T,0,P.length),this.lastNeed-=P.length}function h(P,T){var I=a(this,P,T);if(!this.lastNeed)return P.toString("utf8",T);this.lastTotal=I;var C=P.length-(I-this.lastNeed);return P.copy(this.lastChar,0,C),P.toString("utf8",T,C)}function u(P){var T=P&&P.length?this.write(P):"";return this.lastNeed?T+"\uFFFD":T}function d(P,T){if((P.length-T)%2===0){var I=P.toString("utf16le",T);if(I){var C=I.charCodeAt(I.length-1);if(C>=55296&&C<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=P[P.length-2],this.lastChar[1]=P[P.length-1],I.slice(0,-1)}return I}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=P[P.length-1],P.toString("utf16le",T,P.length-1)}function p(P){var T=P&&P.length?this.write(P):"";if(this.lastNeed){var I=this.lastTotal-this.lastNeed;return T+this.lastChar.toString("utf16le",0,I)}return T}function m(P,T){var I=(P.length-T)%3;return I===0?P.toString("base64",T):(this.lastNeed=3-I,this.lastTotal=3,I===1?this.lastChar[0]=P[P.length-1]:(this.lastChar[0]=P[P.length-2],this.lastChar[1]=P[P.length-1]),P.toString("base64",T,P.length-I))}function g(P){var T=P&&P.length?this.write(P):"";return this.lastNeed?T+this.lastChar.toString("base64",0,3-this.lastNeed):T}function y(P){return P.toString(this.encoding)}function b(P){return P&&P.length?this.write(P):""}}),yRe=Nn((o,t)=>{"use strict";var e=qZ();t.exports=C;var r=JJe(),i;C.ReadableState=I;var n=KE("events").EventEmitter,s=function(te,oe){return te.listeners(oe).length},a=fRe(),l=$Z().Buffer,c=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function h(te){return l.from(te)}function u(te){return l.isBuffer(te)||te instanceof c}var d=Object.create(xH());d.inherits=RH();var p=KE("util"),m=void 0;p&&p.debuglog?m=p.debuglog("stream"):m=function(){};var g=eQe(),y=mRe(),b;d.inherits(C,a);var P=["error","close","destroy","pause","resume"];function T(te,oe,$){if(typeof te.prependListener=="function")return te.prependListener(oe,$);!te._events||!te._events[oe]?te.on(oe,$):r(te._events[oe])?te._events[oe].unshift($):te._events[oe]=[$,te._events[oe]]}function I(te,oe){i=i||q7(),te=te||{};var $=oe instanceof i;this.objectMode=!!te.objectMode,$&&(this.objectMode=this.objectMode||!!te.readableObjectMode);var fe=te.highWaterMark,Oe=te.readableHighWaterMark,Te=this.objectMode?16:16*1024;fe||fe===0?this.highWaterMark=fe:$&&(Oe||Oe===0)?this.highWaterMark=Oe:this.highWaterMark=Te,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=te.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,te.encoding&&(b||(b=hve().StringDecoder),this.decoder=new b(te.encoding),this.encoding=te.encoding)}function C(te){if(i=i||q7(),!(this instanceof C))return new C(te);this._readableState=new I(te,this),this.readable=!0,te&&(typeof te.read=="function"&&(this._read=te.read),typeof te.destroy=="function"&&(this._destroy=te.destroy)),a.call(this)}Object.defineProperty(C.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(te){this._readableState&&(this._readableState.destroyed=te)}}),C.prototype.destroy=y.destroy,C.prototype._undestroy=y.undestroy,C.prototype._destroy=function(te,oe){this.push(null),oe(te)},C.prototype.push=function(te,oe){var $=this._readableState,fe;return $.objectMode?fe=!0:typeof te=="string"&&(oe=oe||$.defaultEncoding,oe!==$.encoding&&(te=l.from(te,oe),oe=""),fe=!0),E(this,te,oe,!1,fe)},C.prototype.unshift=function(te){return E(this,te,null,!0,!1)};function E(te,oe,$,fe,Oe){var Te=te._readableState;if(oe===null)Te.reading=!1,F(te,Te);else{var ue;Oe||(ue=_(Te,oe)),ue?te.emit("error",ue):Te.objectMode||oe&&oe.length>0?(typeof oe!="string"&&!Te.objectMode&&Object.getPrototypeOf(oe)!==l.prototype&&(oe=h(oe)),fe?Te.endEmitted?te.emit("error",new Error("stream.unshift() after end event")):O(te,Te,oe,!0):Te.ended?te.emit("error",new Error("stream.push() after EOF")):(Te.reading=!1,Te.decoder&&!$?(oe=Te.decoder.write(oe),Te.objectMode||oe.length!==0?O(te,Te,oe,!1):V(te,Te)):O(te,Te,oe,!1))):fe||(Te.reading=!1)}return x(Te)}function O(te,oe,$,fe){oe.flowing&&oe.length===0&&!oe.sync?(te.emit("data",$),te.read(0)):(oe.length+=oe.objectMode?1:$.length,fe?oe.buffer.unshift($):oe.buffer.push($),oe.needReadable&&H(te)),V(te,oe)}function _(te,oe){var $;return!u(oe)&&typeof oe!="string"&&oe!==void 0&&!te.objectMode&&($=new TypeError("Invalid non-string/buffer chunk")),$}function x(te){return!te.ended&&(te.needReadable||te.length<te.highWaterMark||te.length===0)}C.prototype.isPaused=function(){return this._readableState.flowing===!1},C.prototype.setEncoding=function(te){return b||(b=hve().StringDecoder),this._readableState.decoder=new b(te),this._readableState.encoding=te,this};var v=8388608;function D(te){return te>=v?te=v:(te--,te|=te>>>1,te|=te>>>2,te|=te>>>4,te|=te>>>8,te|=te>>>16,te++),te}function w(te,oe){return te<=0||oe.length===0&&oe.ended?0:oe.objectMode?1:te!==te?oe.flowing&&oe.length?oe.buffer.head.data.length:oe.length:(te>oe.highWaterMark&&(oe.highWaterMark=D(te)),te<=oe.length?te:oe.ended?oe.length:(oe.needReadable=!0,0))}C.prototype.read=function(te){m("read",te),te=parseInt(te,10);var oe=this._readableState,$=te;if(te!==0&&(oe.emittedReadable=!1),te===0&&oe.needReadable&&(oe.length>=oe.highWaterMark||oe.ended))return m("read: emitReadable",oe.length,oe.ended),oe.length===0&&oe.ended?J(this):H(this),null;if(te=w(te,oe),te===0&&oe.ended)return oe.length===0&&J(this),null;var fe=oe.needReadable;m("need readable",fe),(oe.length===0||oe.length-te<oe.highWaterMark)&&(fe=!0,m("length less than watermark",fe)),oe.ended||oe.reading?(fe=!1,m("reading or ended",fe)):fe&&(m("do read"),oe.reading=!0,oe.sync=!0,oe.length===0&&(oe.needReadable=!0),this._read(oe.highWaterMark),oe.sync=!1,oe.reading||(te=w($,oe)));var Oe;return te>0?Oe=G(te,oe):Oe=null,Oe===null?(oe.needReadable=!0,te=0):oe.length-=te,oe.length===0&&(oe.ended||(oe.needReadable=!0),$!==te&&oe.ended&&J(this)),Oe!==null&&this.emit("data",Oe),Oe};function F(te,oe){if(!oe.ended){if(oe.decoder){var $=oe.decoder.end();$&&$.length&&(oe.buffer.push($),oe.length+=oe.objectMode?1:$.length)}oe.ended=!0,H(te)}}function H(te){var oe=te._readableState;oe.needReadable=!1,oe.emittedReadable||(m("emitReadable",oe.flowing),oe.emittedReadable=!0,oe.sync?e.nextTick(z,te):z(te))}function z(te){m("emit readable"),te.emit("readable"),B(te)}function V(te,oe){oe.readingMore||(oe.readingMore=!0,e.nextTick(W,te,oe))}function W(te,oe){for(var $=oe.length;!oe.reading&&!oe.flowing&&!oe.ended&&oe.length<oe.highWaterMark&&(m("maybeReadMore read 0"),te.read(0),$!==oe.length);)$=oe.length;oe.readingMore=!1}C.prototype._read=function(te){this.emit("error",new Error("_read() is not implemented"))},C.prototype.pipe=function(te,oe){var $=this,fe=this._readableState;switch(fe.pipesCount){case 0:fe.pipes=te;break;case 1:fe.pipes=[fe.pipes,te];break;default:fe.pipes.push(te);break}fe.pipesCount+=1,m("pipe count=%d opts=%j",fe.pipesCount,oe);var Oe=(!oe||oe.end!==!1)&&te!==process.stdout&&te!==process.stderr,Te=Oe?be:Ke;fe.endEmitted?e.nextTick(Te):$.once("end",Te),te.on("unpipe",ue);function ue(Gt,Nr){m("onunpipe"),Gt===$&&Nr&&Nr.hasUnpiped===!1&&(Nr.hasUnpiped=!0,ie())}function be(){m("onend"),te.end()}var j=L($);te.on("drain",j);var Z=!1;function ie(){m("cleanup"),te.removeListener("close",Re),te.removeListener("finish",Je),te.removeListener("drain",j),te.removeListener("error",Se),te.removeListener("unpipe",ue),$.removeListener("end",be),$.removeListener("end",Ke),$.removeListener("data",me),Z=!0,fe.awaitDrain&&(!te._writableState||te._writableState.needDrain)&&j()}var de=!1;$.on("data",me);function me(Gt){m("ondata"),de=!1;var Nr=te.write(Gt);Nr===!1&&!de&&((fe.pipesCount===1&&fe.pipes===te||fe.pipesCount>1&&ce(fe.pipes,te)!==-1)&&!Z&&(m("false write response, pause",fe.awaitDrain),fe.awaitDrain++,de=!0),$.pause())}function Se(Gt){m("onerror",Gt),Ke(),te.removeListener("error",Se),s(te,"error")===0&&te.emit("error",Gt)}T(te,"error",Se);function Re(){te.removeListener("finish",Je),Ke()}te.once("close",Re);function Je(){m("onfinish"),te.removeListener("close",Re),Ke()}te.once("finish",Je);function Ke(){m("unpipe"),$.unpipe(te)}return te.emit("pipe",$),fe.flowing||(m("pipe resume"),$.resume()),te};function L(te){return function(){var oe=te._readableState;m("pipeOnDrain",oe.awaitDrain),oe.awaitDrain&&oe.awaitDrain--,oe.awaitDrain===0&&s(te,"data")&&(oe.flowing=!0,B(te))}}C.prototype.unpipe=function(te){var oe=this._readableState,$={hasUnpiped:!1};if(oe.pipesCount===0)return this;if(oe.pipesCount===1)return te&&te!==oe.pipes?this:(te||(te=oe.pipes),oe.pipes=null,oe.pipesCount=0,oe.flowing=!1,te&&te.emit("unpipe",this,$),this);if(!te){var fe=oe.pipes,Oe=oe.pipesCount;oe.pipes=null,oe.pipesCount=0,oe.flowing=!1;for(var Te=0;Te<Oe;Te++)fe[Te].emit("unpipe",this,{hasUnpiped:!1});return this}var ue=ce(oe.pipes,te);return ue===-1?this:(oe.pipes.splice(ue,1),oe.pipesCount-=1,oe.pipesCount===1&&(oe.pipes=oe.pipes[0]),te.emit("unpipe",this,$),this)},C.prototype.on=function(te,oe){var $=a.prototype.on.call(this,te,oe);if(te==="data")this._readableState.flowing!==!1&&this.resume();else if(te==="readable"){var fe=this._readableState;!fe.endEmitted&&!fe.readableListening&&(fe.readableListening=fe.needReadable=!0,fe.emittedReadable=!1,fe.reading?fe.length&&H(this):e.nextTick(k,this))}return $},C.prototype.addListener=C.prototype.on;function k(te){m("readable nexttick read 0"),te.read(0)}C.prototype.resume=function(){var te=this._readableState;return te.flowing||(m("resume"),te.flowing=!0,N(this,te)),this};function N(te,oe){oe.resumeScheduled||(oe.resumeScheduled=!0,e.nextTick(U,te,oe))}function U(te,oe){oe.reading||(m("resume read 0"),te.read(0)),oe.resumeScheduled=!1,oe.awaitDrain=0,te.emit("resume"),B(te),oe.flowing&&!oe.reading&&te.read(0)}C.prototype.pause=function(){return m("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(m("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function B(te){var oe=te._readableState;for(m("flow",oe.flowing);oe.flowing&&te.read()!==null;);}C.prototype.wrap=function(te){var oe=this,$=this._readableState,fe=!1;te.on("end",function(){if(m("wrapped end"),$.decoder&&!$.ended){var ue=$.decoder.end();ue&&ue.length&&oe.push(ue)}oe.push(null)}),te.on("data",function(ue){if(m("wrapped data"),$.decoder&&(ue=$.decoder.write(ue)),!($.objectMode&&ue==null)&&!(!$.objectMode&&(!ue||!ue.length))){var be=oe.push(ue);be||(fe=!0,te.pause())}});for(var Oe in te)this[Oe]===void 0&&typeof te[Oe]=="function"&&(this[Oe]=(function(ue){return function(){return te[ue].apply(te,arguments)}})(Oe));for(var Te=0;Te<P.length;Te++)te.on(P[Te],this.emit.bind(this,P[Te]));return this._read=function(ue){m("wrapped _read",ue),fe&&(fe=!1,te.resume())},this},Object.defineProperty(C.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),C._fromList=G;function G(te,oe){if(oe.length===0)return null;var $;return oe.objectMode?$=oe.buffer.shift():!te||te>=oe.length?(oe.decoder?$=oe.buffer.join(""):oe.buffer.length===1?$=oe.buffer.head.data:$=oe.buffer.concat(oe.length),oe.buffer.clear()):$=Y(te,oe.buffer,oe.decoder),$}function Y(te,oe,$){var fe;return te<oe.head.data.length?(fe=oe.head.data.slice(0,te),oe.head.data=oe.head.data.slice(te)):te===oe.head.data.length?fe=oe.shift():fe=$?X(te,oe):K(te,oe),fe}function X(te,oe){var $=oe.head,fe=1,Oe=$.data;for(te-=Oe.length;$=$.next;){var Te=$.data,ue=te>Te.length?Te.length:te;if(ue===Te.length?Oe+=Te:Oe+=Te.slice(0,te),te-=ue,te===0){ue===Te.length?(++fe,$.next?oe.head=$.next:oe.head=oe.tail=null):(oe.head=$,$.data=Te.slice(ue));break}++fe}return oe.length-=fe,Oe}function K(te,oe){var $=l.allocUnsafe(te),fe=oe.head,Oe=1;for(fe.data.copy($),te-=fe.data.length;fe=fe.next;){var Te=fe.data,ue=te>Te.length?Te.length:te;if(Te.copy($,$.length-te,0,ue),te-=ue,te===0){ue===Te.length?(++Oe,fe.next?oe.head=fe.next:oe.head=oe.tail=null):(oe.head=fe,fe.data=Te.slice(ue));break}++Oe}return oe.length-=Oe,$}function J(te){var oe=te._readableState;if(oe.length>0)throw new Error('"endReadable()" called on non-empty stream');oe.endEmitted||(oe.ended=!0,e.nextTick(se,oe,te))}function se(te,oe){!te.endEmitted&&te.length===0&&(te.endEmitted=!0,oe.readable=!1,oe.emit("end"))}function ce(te,oe){for(var $=0,fe=te.length;$<fe;$++)if(te[$]===oe)return $;return-1}}),bRe=Nn((o,t)=>{"use strict";t.exports=n;var e=q7(),r=Object.create(xH());r.inherits=RH(),r.inherits(n,e);function i(l,c){var h=this._transformState;h.transforming=!1;var u=h.writecb;if(!u)return this.emit("error",new Error("write callback called multiple times"));h.writechunk=null,h.writecb=null,c!=null&&this.push(c),u(l);var d=this._readableState;d.reading=!1,(d.needReadable||d.length<d.highWaterMark)&&this._read(d.highWaterMark)}function n(l){if(!(this instanceof n))return new n(l);e.call(this,l),this._transformState={afterTransform:i.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,l&&(typeof l.transform=="function"&&(this._transform=l.transform),typeof l.flush=="function"&&(this._flush=l.flush)),this.on("prefinish",s)}function s(){var l=this;typeof this._flush=="function"?this._flush(function(c,h){a(l,c,h)}):a(this,null,null)}n.prototype.push=function(l,c){return this._transformState.needTransform=!1,e.prototype.push.call(this,l,c)},n.prototype._transform=function(l,c,h){throw new Error("_transform() is not implemented")},n.prototype._write=function(l,c,h){var u=this._transformState;if(u.writecb=h,u.writechunk=l,u.writeencoding=c,!u.transforming){var d=this._readableState;(u.needTransform||d.needReadable||d.length<d.highWaterMark)&&this._read(d.highWaterMark)}},n.prototype._read=function(l){var c=this._transformState;c.writechunk!==null&&c.writecb&&!c.transforming?(c.transforming=!0,this._transform(c.writechunk,c.writeencoding,c.afterTransform)):c.needTransform=!0},n.prototype._destroy=function(l,c){var h=this;e.prototype._destroy.call(this,l,function(u){c(u),h.emit("close")})};function a(l,c,h){if(c)return l.emit("error",c);if(h!=null&&l.push(h),l._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(l._transformState.transforming)throw new Error("Calling transform done when still transforming");return l.push(null)}}),rQe=Nn((o,t)=>{"use strict";t.exports=i;var e=bRe(),r=Object.create(xH());r.inherits=RH(),r.inherits(i,e);function i(n){if(!(this instanceof i))return new i(n);e.call(this,n)}i.prototype._transform=function(n,s,a){a(null,n)}}),PRe=Nn((o,t)=>{var e=KE("stream");process.env.READABLE_STREAM==="disable"&&e?(t.exports=e,o=t.exports=e.Readable,o.Readable=e.Readable,o.Writable=e.Writable,o.Duplex=e.Duplex,o.Transform=e.Transform,o.PassThrough=e.PassThrough,o.Stream=e):(o=t.exports=yRe(),o.Stream=e||o,o.Readable=o,o.Writable=gRe(),o.Duplex=q7(),o.Transform=bRe(),o.PassThrough=rQe())}),U_=Nn(o=>{"use strict";if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{t=new ArrayBuffer(0);try{o.blob=new Blob([t],{type:"application/zip"}).size===0}catch{try{e=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,r=new e,r.append(t),o.blob=r.getBlob("application/zip").size===0}catch{o.blob=!1}}}var t,e,r;try{o.nodestream=!!PRe().Readable}catch{o.nodestream=!1}}),TRe=Nn(o=>{"use strict";var t=u0(),e=U_(),r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(i){for(var n=[],s,a,l,c,h,u,d,p=0,m=i.length,g=m,y=t.getTypeOf(i)!=="string";p<i.length;)g=m-p,y?(s=i[p++],a=p<m?i[p++]:0,l=p<m?i[p++]:0):(s=i.charCodeAt(p++),a=p<m?i.charCodeAt(p++):0,l=p<m?i.charCodeAt(p++):0),c=s>>2,h=(s&3)<<4|a>>4,u=g>1?(a&15)<<2|l>>6:64,d=g>2?l&63:64,n.push(r.charAt(c)+r.charAt(h)+r.charAt(u)+r.charAt(d));return n.join("")},o.decode=function(i){var n,s,a,l,c,h,u,d=0,p=0,m="data:";if(i.substr(0,m.length)===m)throw new Error("Invalid base64 input, it looks like a data url.");i=i.replace(/[^A-Za-z0-9+/=]/g,"");var g=i.length*3/4;if(i.charAt(i.length-1)===r.charAt(64)&&g--,i.charAt(i.length-2)===r.charAt(64)&&g--,g%1!==0)throw new Error("Invalid base64 input, bad content length.");var y;for(e.uint8array?y=new Uint8Array(g|0):y=new Array(g|0);d<i.length;)l=r.indexOf(i.charAt(d++)),c=r.indexOf(i.charAt(d++)),h=r.indexOf(i.charAt(d++)),u=r.indexOf(i.charAt(d++)),n=l<<2|c>>4,s=(c&15)<<4|h>>2,a=(h&3)<<6|u,y[p++]=n,h!==64&&(y[p++]=s),u!==64&&(y[p++]=a);return y}}),KZ=Nn((o,t)=>{"use strict";t.exports={isNode:typeof Buffer<"u",newBufferFrom:function(e,r){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,r);if(typeof e=="number")throw new Error('The "data" argument must not be a number');return new Buffer(e,r)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var r=new Buffer(e);return r.fill(0),r},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&typeof e.on=="function"&&typeof e.pause=="function"&&typeof e.resume=="function"}}}),iQe=Nn((o,t)=>{"use strict";var e=global.MutationObserver||global.WebKitMutationObserver,r;process.browser?e?(i=0,n=new e(h),s=global.document.createTextNode(""),n.observe(s,{characterData:!0}),r=function(){s.data=i=++i%2}):!global.setImmediate&&typeof global.MessageChannel<"u"?(a=new global.MessageChannel,a.port1.onmessage=h,r=function(){a.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?r=function(){var d=global.document.createElement("script");d.onreadystatechange=function(){h(),d.onreadystatechange=null,d.parentNode.removeChild(d),d=null},global.document.documentElement.appendChild(d)}:r=function(){setTimeout(h,0)}:r=function(){process.nextTick(h)};var i,n,s,a,l,c=[];function h(){l=!0;for(var d,p,m=c.length;m;){for(p=c,c=[],d=-1;++d<m;)p[d]();m=c.length}l=!1}t.exports=u;function u(d){c.push(d)===1&&!l&&r()}}),nQe=Nn((o,t)=>{"use strict";var e=iQe();function r(){}var i={},n=["REJECTED"],s=["FULFILLED"],a=["PENDING"];process.browser||(l=["UNHANDLED"]);var l;t.exports=c;function c(T){if(typeof T!="function")throw new TypeError("resolver must be a function");this.state=a,this.queue=[],this.outcome=void 0,process.browser||(this.handled=l),T!==r&&p(this,T)}c.prototype.finally=function(T){if(typeof T!="function")return this;var I=this.constructor;return this.then(C,E);function C(O){function _(){return O}return I.resolve(T()).then(_)}function E(O){function _(){throw O}return I.resolve(T()).then(_)}},c.prototype.catch=function(T){return this.then(null,T)},c.prototype.then=function(T,I){if(typeof T!="function"&&this.state===s||typeof I!="function"&&this.state===n)return this;var C=new this.constructor(r);if(process.browser||this.handled===l&&(this.handled=null),this.state!==a){var E=this.state===s?T:I;u(C,E,this.outcome)}else this.queue.push(new h(C,T,I));return C};function h(T,I,C){this.promise=T,typeof I=="function"&&(this.onFulfilled=I,this.callFulfilled=this.otherCallFulfilled),typeof C=="function"&&(this.onRejected=C,this.callRejected=this.otherCallRejected)}h.prototype.callFulfilled=function(T){i.resolve(this.promise,T)},h.prototype.otherCallFulfilled=function(T){u(this.promise,this.onFulfilled,T)},h.prototype.callRejected=function(T){i.reject(this.promise,T)},h.prototype.otherCallRejected=function(T){u(this.promise,this.onRejected,T)};function u(T,I,C){e(function(){var E;try{E=I(C)}catch(O){return i.reject(T,O)}E===T?i.reject(T,new TypeError("Cannot resolve promise with itself")):i.resolve(T,E)})}i.resolve=function(T,I){var C=m(d,I);if(C.status==="error")return i.reject(T,C.value);var E=C.value;if(E)p(T,E);else{T.state=s,T.outcome=I;for(var O=-1,_=T.queue.length;++O<_;)T.queue[O].callFulfilled(I)}return T},i.reject=function(T,I){T.state=n,T.outcome=I,process.browser||T.handled===l&&e(function(){T.handled===l&&process.emit("unhandledRejection",I,T)});for(var C=-1,E=T.queue.length;++C<E;)T.queue[C].callRejected(I);return T};function d(T){var I=T&&T.then;if(T&&(typeof T=="object"||typeof T=="function")&&typeof I=="function")return function(){I.apply(T,arguments)}}function p(T,I){var C=!1;function E(v){C||(C=!0,i.reject(T,v))}function O(v){C||(C=!0,i.resolve(T,v))}function _(){I(O,E)}var x=m(_);x.status==="error"&&E(x.value)}function m(T,I){var C={};try{C.value=T(I),C.status="success"}catch(E){C.status="error",C.value=E}return C}c.resolve=g;function g(T){return T instanceof this?T:i.resolve(new this(r),T)}c.reject=y;function y(T){var I=new this(r);return i.reject(I,T)}c.all=b;function b(T){var I=this;if(Object.prototype.toString.call(T)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=T.length,E=!1;if(!C)return this.resolve([]);for(var O=new Array(C),_=0,x=-1,v=new this(r);++x<C;)D(T[x],x);return v;function D(w,F){I.resolve(w).then(H,function(z){E||(E=!0,i.reject(v,z))});function H(z){O[F]=z,++_===C&&!E&&(E=!0,i.resolve(v,O))}}}c.race=P;function P(T){var I=this;if(Object.prototype.toString.call(T)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=T.length,E=!1;if(!C)return this.resolve([]);for(var O=-1,_=new this(r);++O<C;)x(T[O]);return _;function x(v){I.resolve(v).then(function(D){E||(E=!0,i.resolve(_,D))},function(D){E||(E=!0,i.reject(_,D))})}}}),DH=Nn((o,t)=>{"use strict";var e=null;typeof Promise<"u"?e=Promise:e=nQe(),t.exports={Promise:e}}),oQe=Nn(o=>{(function(t,e){"use strict";if(t.setImmediate)return;var r=1,i={},n=!1,s=t.document,a;function l(T){typeof T!="function"&&(T=new Function(""+T));for(var I=new Array(arguments.length-1),C=0;C<I.length;C++)I[C]=arguments[C+1];var E={callback:T,args:I};return i[r]=E,a(r),r++}function c(T){delete i[T]}function h(T){var I=T.callback,C=T.args;switch(C.length){case 0:I();break;case 1:I(C[0]);break;case 2:I(C[0],C[1]);break;case 3:I(C[0],C[1],C[2]);break;default:I.apply(e,C);break}}function u(T){if(n)setTimeout(u,0,T);else{var I=i[T];if(I){n=!0;try{h(I)}finally{c(T),n=!1}}}}function d(){a=function(T){process.nextTick(function(){u(T)})}}function p(){if(t.postMessage&&!t.importScripts){var T=!0,I=t.onmessage;return t.onmessage=function(){T=!1},t.postMessage("","*"),t.onmessage=I,T}}function m(){var T="setImmediate$"+Math.random()+"$",I=function(C){C.source===t&&typeof C.data=="string"&&C.data.indexOf(T)===0&&u(+C.data.slice(T.length))};t.addEventListener?t.addEventListener("message",I,!1):t.attachEvent("onmessage",I),a=function(C){t.postMessage(T+C,"*")}}function g(){var T=new MessageChannel;T.port1.onmessage=function(I){var C=I.data;u(C)},a=function(I){T.port2.postMessage(I)}}function y(){var T=s.documentElement;a=function(I){var C=s.createElement("script");C.onreadystatechange=function(){u(I),C.onreadystatechange=null,T.removeChild(C),C=null},T.appendChild(C)}}function b(){a=function(T){setTimeout(u,0,T)}}var P=Object.getPrototypeOf&&Object.getPrototypeOf(t);P=P&&P.setTimeout?P:t,{}.toString.call(t.process)==="[object process]"?d():p()?m():t.MessageChannel?g():s&&"onreadystatechange"in s.createElement("script")?y():b(),P.setImmediate=l,P.clearImmediate=c})(typeof self>"u"?typeof global>"u"?o:global:self)}),u0=Nn(o=>{"use strict";var t=U_(),e=TRe(),r=KZ(),i=DH();oQe();function n(d){var p=null;return t.uint8array?p=new Uint8Array(d.length):p=new Array(d.length),a(d,p)}o.newBlob=function(d,p){o.checkSupport("blob");try{return new Blob([d],{type:p})}catch{try{var m=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,g=new m;return g.append(d),g.getBlob(p)}catch{throw new Error("Bug : can't construct the Blob.")}}};function s(d){return d}function a(d,p){for(var m=0;m<d.length;++m)p[m]=d.charCodeAt(m)&255;return p}var l={stringifyByChunk:function(d,p,m){var g=[],y=0,b=d.length;if(b<=m)return String.fromCharCode.apply(null,d);for(;y<b;)p==="array"||p==="nodebuffer"?g.push(String.fromCharCode.apply(null,d.slice(y,Math.min(y+m,b)))):g.push(String.fromCharCode.apply(null,d.subarray(y,Math.min(y+m,b)))),y+=m;return g.join("")},stringifyByChar:function(d){for(var p="",m=0;m<d.length;m++)p+=String.fromCharCode(d[m]);return p},applyCanBeUsed:{uint8array:(function(){try{return t.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return t.nodebuffer&&String.fromCharCode.apply(null,r.allocBuffer(1)).length===1}catch{return!1}})()}};function c(d){var p=65536,m=o.getTypeOf(d),g=!0;if(m==="uint8array"?g=l.applyCanBeUsed.uint8array:m==="nodebuffer"&&(g=l.applyCanBeUsed.nodebuffer),g)for(;p>1;)try{return l.stringifyByChunk(d,m,p)}catch{p=Math.floor(p/2)}return l.stringifyByChar(d)}o.applyFromCharCode=c;function h(d,p){for(var m=0;m<d.length;m++)p[m]=d[m];return p}var u={};u.string={string:s,array:function(d){return a(d,new Array(d.length))},arraybuffer:function(d){return u.string.uint8array(d).buffer},uint8array:function(d){return a(d,new Uint8Array(d.length))},nodebuffer:function(d){return a(d,r.allocBuffer(d.length))}},u.array={string:c,array:s,arraybuffer:function(d){return new Uint8Array(d).buffer},uint8array:function(d){return new Uint8Array(d)},nodebuffer:function(d){return r.newBufferFrom(d)}},u.arraybuffer={string:function(d){return c(new Uint8Array(d))},array:function(d){return h(new Uint8Array(d),new Array(d.byteLength))},arraybuffer:s,uint8array:function(d){return new Uint8Array(d)},nodebuffer:function(d){return r.newBufferFrom(new Uint8Array(d))}},u.uint8array={string:c,array:function(d){return h(d,new Array(d.length))},arraybuffer:function(d){return d.buffer},uint8array:s,nodebuffer:function(d){return r.newBufferFrom(d)}},u.nodebuffer={string:c,array:function(d){return h(d,new Array(d.length))},arraybuffer:function(d){return u.nodebuffer.uint8array(d).buffer},uint8array:function(d){return h(d,new Uint8Array(d.length))},nodebuffer:s},o.transformTo=function(d,p){if(p||(p=""),!d)return p;o.checkSupport(d);var m=o.getTypeOf(p),g=u[m][d](p);return g},o.resolve=function(d){for(var p=d.split("/"),m=[],g=0;g<p.length;g++){var y=p[g];y==="."||y===""&&g!==0&&g!==p.length-1||(y===".."?m.pop():m.push(y))}return m.join("/")},o.getTypeOf=function(d){if(typeof d=="string")return"string";if(Object.prototype.toString.call(d)==="[object Array]")return"array";if(t.nodebuffer&&r.isBuffer(d))return"nodebuffer";if(t.uint8array&&d instanceof Uint8Array)return"uint8array";if(t.arraybuffer&&d instanceof ArrayBuffer)return"arraybuffer"},o.checkSupport=function(d){var p=t[d.toLowerCase()];if(!p)throw new Error(d+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(d){var p="",m,g;for(g=0;g<(d||"").length;g++)m=d.charCodeAt(g),p+="\\x"+(m<16?"0":"")+m.toString(16).toUpperCase();return p},o.delay=function(d,p,m){setImmediate(function(){d.apply(m||null,p||[])})},o.inherits=function(d,p){var m=function(){};m.prototype=p.prototype,d.prototype=new m},o.extend=function(){var d={},p,m;for(p=0;p<arguments.length;p++)for(m in arguments[p])Object.prototype.hasOwnProperty.call(arguments[p],m)&&typeof d[m]>"u"&&(d[m]=arguments[p][m]);return d},o.prepareContent=function(d,p,m,g,y){var b=i.Promise.resolve(p).then(function(P){var T=t.blob&&(P instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(P))!==-1);return T&&typeof FileReader<"u"?new i.Promise(function(I,C){var E=new FileReader;E.onload=function(O){I(O.target.result)},E.onerror=function(O){C(O.target.error)},E.readAsArrayBuffer(P)}):P});return b.then(function(P){var T=o.getTypeOf(P);return T?(T==="arraybuffer"?P=o.transformTo("uint8array",P):T==="string"&&(y?P=e.decode(P):m&&g!==!0&&(P=n(P))),P):i.Promise.reject(new Error("Can't read the data of '"+d+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}}),UT=Nn((o,t)=>{"use strict";function e(r){this.name=r||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}e.prototype={push:function(r){this.emit("data",r)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(r){this.emit("error",r)}return!0},error:function(r){return this.isFinished?!1:(this.isPaused?this.generatedError=r:(this.isFinished=!0,this.emit("error",r),this.previous&&this.previous.error(r),this.cleanUp()),!0)},on:function(r,i){return this._listeners[r].push(i),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(r,i){if(this._listeners[r])for(var n=0;n<this._listeners[r].length;n++)this._listeners[r][n].call(this,i)},pipe:function(r){return r.registerPrevious(this)},registerPrevious:function(r){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=r.streamInfo,this.mergeStreamInfo(),this.previous=r;var i=this;return r.on("data",function(n){i.processChunk(n)}),r.on("end",function(){i.end()}),r.on("error",function(n){i.error(n)}),this},pause:function(){return this.isPaused||this.isFinished?!1:(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var r=!1;return this.generatedError&&(this.error(this.generatedError),r=!0),this.previous&&this.previous.resume(),!r},flush:function(){},processChunk:function(r){this.push(r)},withStreamInfo:function(r,i){return this.extraStreamInfo[r]=i,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var r in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,r)&&(this.streamInfo[r]=this.extraStreamInfo[r])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var r="Worker "+this.name;return this.previous?this.previous+" -> "+r:r}},t.exports=e}),wH=Nn(o=>{"use strict";var t=u0(),e=U_(),r=KZ(),i=UT(),n=new Array(256);for(s=0;s<256;s++)n[s]=s>=252?6:s>=248?5:s>=240?4:s>=224?3:s>=192?2:1;var s;n[254]=n[254]=1;var a=function(d){var p,m,g,y,b,P=d.length,T=0;for(y=0;y<P;y++)m=d.charCodeAt(y),(m&64512)===55296&&y+1<P&&(g=d.charCodeAt(y+1),(g&64512)===56320&&(m=65536+(m-55296<<10)+(g-56320),y++)),T+=m<128?1:m<2048?2:m<65536?3:4;for(e.uint8array?p=new Uint8Array(T):p=new Array(T),b=0,y=0;b<T;y++)m=d.charCodeAt(y),(m&64512)===55296&&y+1<P&&(g=d.charCodeAt(y+1),(g&64512)===56320&&(m=65536+(m-55296<<10)+(g-56320),y++)),m<128?p[b++]=m:m<2048?(p[b++]=192|m>>>6,p[b++]=128|m&63):m<65536?(p[b++]=224|m>>>12,p[b++]=128|m>>>6&63,p[b++]=128|m&63):(p[b++]=240|m>>>18,p[b++]=128|m>>>12&63,p[b++]=128|m>>>6&63,p[b++]=128|m&63);return p},l=function(d,p){var m;for(p=p||d.length,p>d.length&&(p=d.length),m=p-1;m>=0&&(d[m]&192)===128;)m--;return m<0||m===0?p:m+n[d[m]]>p?m:p},c=function(d){var p,m,g,y,b=d.length,P=new Array(b*2);for(m=0,p=0;p<b;){if(g=d[p++],g<128){P[m++]=g;continue}if(y=n[g],y>4){P[m++]=65533,p+=y-1;continue}for(g&=y===2?31:y===3?15:7;y>1&&p<b;)g=g<<6|d[p++]&63,y--;if(y>1){P[m++]=65533;continue}g<65536?P[m++]=g:(g-=65536,P[m++]=55296|g>>10&1023,P[m++]=56320|g&1023)}return P.length!==m&&(P.subarray?P=P.subarray(0,m):P.length=m),t.applyFromCharCode(P)};o.utf8encode=function(d){return e.nodebuffer?r.newBufferFrom(d,"utf-8"):a(d)},o.utf8decode=function(d){return e.nodebuffer?t.transformTo("nodebuffer",d).toString("utf-8"):(d=t.transformTo(e.uint8array?"uint8array":"array",d),c(d))};function h(){i.call(this,"utf-8 decode"),this.leftOver=null}t.inherits(h,i),h.prototype.processChunk=function(d){var p=t.transformTo(e.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(e.uint8array){var m=p;p=new Uint8Array(m.length+this.leftOver.length),p.set(this.leftOver,0),p.set(m,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var g=l(p),y=p;g!==p.length&&(e.uint8array?(y=p.subarray(0,g),this.leftOver=p.subarray(g,p.length)):(y=p.slice(0,g),this.leftOver=p.slice(g,p.length))),this.push({data:o.utf8decode(y),meta:d.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=h;function u(){i.call(this,"utf-8 encode")}t.inherits(u,i),u.prototype.processChunk=function(d){this.push({data:o.utf8encode(d.data),meta:d.meta})},o.Utf8EncodeWorker=u}),sQe=Nn((o,t)=>{"use strict";var e=UT(),r=u0();function i(n){e.call(this,"ConvertWorker to "+n),this.destType=n}r.inherits(i,e),i.prototype.processChunk=function(n){this.push({data:r.transformTo(this.destType,n.data),meta:n.meta})},t.exports=i}),aQe=Nn((o,t)=>{"use strict";var e=PRe().Readable,r=u0();r.inherits(i,e);function i(n,s,a){e.call(this,s),this._helper=n;var l=this;n.on("data",function(c,h){l.push(c)||l._helper.pause(),a&&a(h)}).on("error",function(c){l.emit("error",c)}).on("end",function(){l.push(null)})}i.prototype._read=function(){this._helper.resume()},t.exports=i}),IRe=Nn((o,t)=>{"use strict";var e=u0(),r=sQe(),i=UT(),n=TRe(),s=U_(),a=DH(),l=null;if(s.nodestream)try{l=aQe()}catch{}function c(p,m,g){switch(p){case"blob":return e.newBlob(e.transformTo("arraybuffer",m),g);case"base64":return n.encode(m);default:return e.transformTo(p,m)}}function h(p,m){var g,y=0,b=null,P=0;for(g=0;g<m.length;g++)P+=m[g].length;switch(p){case"string":return m.join("");case"array":return Array.prototype.concat.apply([],m);case"uint8array":for(b=new Uint8Array(P),g=0;g<m.length;g++)b.set(m[g],y),y+=m[g].length;return b;case"nodebuffer":return Buffer.concat(m);default:throw new Error("concat : unsupported type '"+p+"'")}}function u(p,m){return new a.Promise(function(g,y){var b=[],P=p._internalType,T=p._outputType,I=p._mimeType;p.on("data",function(C,E){b.push(C),m&&m(E)}).on("error",function(C){b=[],y(C)}).on("end",function(){try{var C=c(T,h(P,b),I);g(C)}catch(E){y(E)}b=[]}).resume()})}function d(p,m,g){var y=m;switch(m){case"blob":case"arraybuffer":y="uint8array";break;case"base64":y="string";break}try{this._internalType=y,this._outputType=m,this._mimeType=g,e.checkSupport(y),this._worker=p.pipe(new r(y)),p.lock()}catch(b){this._worker=new i("error"),this._worker.error(b)}}d.prototype={accumulate:function(p){return u(this,p)},on:function(p,m){var g=this;return p==="data"?this._worker.on(p,function(y){m.call(g,y.data,y.meta)}):this._worker.on(p,function(){e.delay(m,arguments,g)}),this},resume:function(){return e.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(p){if(e.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new l(this,{objectMode:this._outputType!=="nodebuffer"},p)}},t.exports=d}),CRe=Nn(o=>{"use strict";o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null}),SRe=Nn((o,t)=>{"use strict";var e=u0(),r=UT(),i=16*1024;function n(s){r.call(this,"DataWorker");var a=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,s.then(function(l){a.dataIsReady=!0,a.data=l,a.max=l&&l.length||0,a.type=e.getTypeOf(l),a.isPaused||a._tickAndRepeat()},function(l){a.error(l)})}e.inherits(n,r),n.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},n.prototype.resume=function(){return r.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,e.delay(this._tickAndRepeat,[],this)),!0):!1},n.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(e.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},n.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var s=i,a=null,l=Math.min(this.max,this.index+s);if(this.index>=this.max)return this.end();switch(this.type){case"string":a=this.data.substring(this.index,l);break;case"uint8array":a=this.data.subarray(this.index,l);break;case"array":case"nodebuffer":a=this.data.slice(this.index,l);break}return this.index=l,this.push({data:a,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=n}),_ye=Nn((o,t)=>{"use strict";var e=u0();function r(){for(var a,l=[],c=0;c<256;c++){a=c;for(var h=0;h<8;h++)a=a&1?3988292384^a>>>1:a>>>1;l[c]=a}return l}var i=r();function n(a,l,c,h){var u=i,d=h+c;a=a^-1;for(var p=h;p<d;p++)a=a>>>8^u[(a^l[p])&255];return a^-1}function s(a,l,c,h){var u=i,d=h+c;a=a^-1;for(var p=h;p<d;p++)a=a>>>8^u[(a^l.charCodeAt(p))&255];return a^-1}t.exports=function(a,l){if(typeof a>"u"||!a.length)return 0;var c=e.getTypeOf(a)!=="string";return c?n(l|0,a,a.length,0):s(l|0,a,a.length,0)}}),ERe=Nn((o,t)=>{"use strict";var e=UT(),r=_ye(),i=u0();function n(){e.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}i.inherits(n,e),n.prototype.processChunk=function(s){this.streamInfo.crc32=r(s.data,this.streamInfo.crc32||0),this.push(s)},t.exports=n}),lQe=Nn((o,t)=>{"use strict";var e=u0(),r=UT();function i(n){r.call(this,"DataLengthProbe for "+n),this.propName=n,this.withStreamInfo(n,0)}e.inherits(i,r),i.prototype.processChunk=function(n){if(n){var s=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=s+n.data.length}r.prototype.processChunk.call(this,n)},t.exports=i}),vye=Nn((o,t)=>{"use strict";var e=DH(),r=SRe(),i=ERe(),n=lQe();function s(a,l,c,h,u){this.compressedSize=a,this.uncompressedSize=l,this.crc32=c,this.compression=h,this.compressedContent=u}s.prototype={getContentWorker:function(){var a=new r(e.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new n("data_length")),l=this;return a.on("end",function(){if(this.streamInfo.data_length!==l.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),a},getCompressedWorker:function(){return new r(e.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},s.createWorkerFrom=function(a,l,c){return a.pipe(new i).pipe(new n("uncompressedSize")).pipe(l.compressWorker(c)).pipe(new n("compressedSize")).withStreamInfo("compression",l)},t.exports=s}),cQe=Nn((o,t)=>{"use strict";var e=IRe(),r=SRe(),i=wH(),n=vye(),s=UT(),a=function(u,d,p){this.name=u,this.dir=p.dir,this.date=p.date,this.comment=p.comment,this.unixPermissions=p.unixPermissions,this.dosPermissions=p.dosPermissions,this._data=d,this._dataBinary=p.binary,this.options={compression:p.compression,compressionOptions:p.compressionOptions}};a.prototype={internalStream:function(u){var d=null,p="string";try{if(!u)throw new Error("No output type specified.");p=u.toLowerCase();var m=p==="string"||p==="text";(p==="binarystring"||p==="text")&&(p="string"),d=this._decompressWorker();var g=!this._dataBinary;g&&!m&&(d=d.pipe(new i.Utf8EncodeWorker)),!g&&m&&(d=d.pipe(new i.Utf8DecodeWorker))}catch(y){d=new s("error"),d.error(y)}return new e(d,p,"")},async:function(u,d){return this.internalStream(u).accumulate(d)},nodeStream:function(u,d){return this.internalStream(u||"nodebuffer").toNodejsStream(d)},_compressWorker:function(u,d){if(this._data instanceof n&&this._data.compression.magic===u.magic)return this._data.getCompressedWorker();var p=this._decompressWorker();return this._dataBinary||(p=p.pipe(new i.Utf8EncodeWorker)),n.createWorkerFrom(p,u,d)},_decompressWorker:function(){return this._data instanceof n?this._data.getContentWorker():this._data instanceof s?this._data:new r(this._data)}};var l=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],c=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(h=0;h<l.length;h++)a.prototype[l[h]]=c;var h;t.exports=a}),H_=Nn(o=>{"use strict";var t=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function e(n,s){return Object.prototype.hasOwnProperty.call(n,s)}o.assign=function(n){for(var s=Array.prototype.slice.call(arguments,1);s.length;){var a=s.shift();if(a){if(typeof a!="object")throw new TypeError(a+"must be non-object");for(var l in a)e(a,l)&&(n[l]=a[l])}}return n},o.shrinkBuf=function(n,s){return n.length===s?n:n.subarray?n.subarray(0,s):(n.length=s,n)};var r={arraySet:function(n,s,a,l,c){if(s.subarray&&n.subarray){n.set(s.subarray(a,a+l),c);return}for(var h=0;h<l;h++)n[c+h]=s[a+h]},flattenChunks:function(n){var s,a,l,c,h,u;for(l=0,s=0,a=n.length;s<a;s++)l+=n[s].length;for(u=new Uint8Array(l),c=0,s=0,a=n.length;s<a;s++)h=n[s],u.set(h,c),c+=h.length;return u}},i={arraySet:function(n,s,a,l,c){for(var h=0;h<l;h++)n[c+h]=s[a+h]},flattenChunks:function(n){return[].concat.apply([],n)}};o.setTyped=function(n){n?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,r)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,i))},o.setTyped(t)}),hQe=Nn(o=>{"use strict";var t=H_(),e=4,r=0,i=1,n=2;function s(Ne){for(var Vt=Ne.length;--Vt>=0;)Ne[Vt]=0}var a=0,l=1,c=2,h=3,u=258,d=29,p=256,m=p+1+d,g=30,y=19,b=2*m+1,P=15,T=16,I=7,C=256,E=16,O=17,_=18,x=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],v=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],D=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],w=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],F=512,H=new Array((m+2)*2);s(H);var z=new Array(g*2);s(z);var V=new Array(F);s(V);var W=new Array(u-h+1);s(W);var L=new Array(d);s(L);var k=new Array(g);s(k);function N(Ne,Vt,Ft,ir,Fe){this.static_tree=Ne,this.extra_bits=Vt,this.extra_base=Ft,this.elems=ir,this.max_length=Fe,this.has_stree=Ne&&Ne.length}var U,B,G;function Y(Ne,Vt){this.dyn_tree=Ne,this.max_code=0,this.stat_desc=Vt}function X(Ne){return Ne<256?V[Ne]:V[256+(Ne>>>7)]}function K(Ne,Vt){Ne.pending_buf[Ne.pending++]=Vt&255,Ne.pending_buf[Ne.pending++]=Vt>>>8&255}function J(Ne,Vt,Ft){Ne.bi_valid>T-Ft?(Ne.bi_buf|=Vt<<Ne.bi_valid&65535,K(Ne,Ne.bi_buf),Ne.bi_buf=Vt>>T-Ne.bi_valid,Ne.bi_valid+=Ft-T):(Ne.bi_buf|=Vt<<Ne.bi_valid&65535,Ne.bi_valid+=Ft)}function se(Ne,Vt,Ft){J(Ne,Ft[Vt*2],Ft[Vt*2+1])}function ce(Ne,Vt){var Ft=0;do Ft|=Ne&1,Ne>>>=1,Ft<<=1;while(--Vt>0);return Ft>>>1}function te(Ne){Ne.bi_valid===16?(K(Ne,Ne.bi_buf),Ne.bi_buf=0,Ne.bi_valid=0):Ne.bi_valid>=8&&(Ne.pending_buf[Ne.pending++]=Ne.bi_buf&255,Ne.bi_buf>>=8,Ne.bi_valid-=8)}function oe(Ne,Vt){var Ft=Vt.dyn_tree,ir=Vt.max_code,Fe=Vt.stat_desc.static_tree,tt=Vt.stat_desc.has_stree,ye=Vt.stat_desc.extra_bits,yt=Vt.stat_desc.extra_base,Wt=Vt.stat_desc.max_length,pe,Xe,ct,Me,st,Ot,hr=0;for(Me=0;Me<=P;Me++)Ne.bl_count[Me]=0;for(Ft[Ne.heap[Ne.heap_max]*2+1]=0,pe=Ne.heap_max+1;pe<b;pe++)Xe=Ne.heap[pe],Me=Ft[Ft[Xe*2+1]*2+1]+1,Me>Wt&&(Me=Wt,hr++),Ft[Xe*2+1]=Me,!(Xe>ir)&&(Ne.bl_count[Me]++,st=0,Xe>=yt&&(st=ye[Xe-yt]),Ot=Ft[Xe*2],Ne.opt_len+=Ot*(Me+st),tt&&(Ne.static_len+=Ot*(Fe[Xe*2+1]+st)));if(hr!==0){do{for(Me=Wt-1;Ne.bl_count[Me]===0;)Me--;Ne.bl_count[Me]--,Ne.bl_count[Me+1]+=2,Ne.bl_count[Wt]--,hr-=2}while(hr>0);for(Me=Wt;Me!==0;Me--)for(Xe=Ne.bl_count[Me];Xe!==0;)ct=Ne.heap[--pe],!(ct>ir)&&(Ft[ct*2+1]!==Me&&(Ne.opt_len+=(Me-Ft[ct*2+1])*Ft[ct*2],Ft[ct*2+1]=Me),Xe--)}}function $(Ne,Vt,Ft){var ir=new Array(P+1),Fe=0,tt,ye;for(tt=1;tt<=P;tt++)ir[tt]=Fe=Fe+Ft[tt-1]<<1;for(ye=0;ye<=Vt;ye++){var yt=Ne[ye*2+1];yt!==0&&(Ne[ye*2]=ce(ir[yt]++,yt))}}function fe(){var Ne,Vt,Ft,ir,Fe,tt=new Array(P+1);for(Ft=0,ir=0;ir<d-1;ir++)for(L[ir]=Ft,Ne=0;Ne<1<<x[ir];Ne++)W[Ft++]=ir;for(W[Ft-1]=ir,Fe=0,ir=0;ir<16;ir++)for(k[ir]=Fe,Ne=0;Ne<1<<v[ir];Ne++)V[Fe++]=ir;for(Fe>>=7;ir<g;ir++)for(k[ir]=Fe<<7,Ne=0;Ne<1<<v[ir]-7;Ne++)V[256+Fe++]=ir;for(Vt=0;Vt<=P;Vt++)tt[Vt]=0;for(Ne=0;Ne<=143;)H[Ne*2+1]=8,Ne++,tt[8]++;for(;Ne<=255;)H[Ne*2+1]=9,Ne++,tt[9]++;for(;Ne<=279;)H[Ne*2+1]=7,Ne++,tt[7]++;for(;Ne<=287;)H[Ne*2+1]=8,Ne++,tt[8]++;for($(H,m+1,tt),Ne=0;Ne<g;Ne++)z[Ne*2+1]=5,z[Ne*2]=ce(Ne,5);U=new N(H,x,p+1,m,P),B=new N(z,v,0,g,P),G=new N(new Array(0),D,0,y,I)}function Oe(Ne){var Vt;for(Vt=0;Vt<m;Vt++)Ne.dyn_ltree[Vt*2]=0;for(Vt=0;Vt<g;Vt++)Ne.dyn_dtree[Vt*2]=0;for(Vt=0;Vt<y;Vt++)Ne.bl_tree[Vt*2]=0;Ne.dyn_ltree[C*2]=1,Ne.opt_len=Ne.static_len=0,Ne.last_lit=Ne.matches=0}function Te(Ne){Ne.bi_valid>8?K(Ne,Ne.bi_buf):Ne.bi_valid>0&&(Ne.pending_buf[Ne.pending++]=Ne.bi_buf),Ne.bi_buf=0,Ne.bi_valid=0}function ue(Ne,Vt,Ft,ir){Te(Ne),ir&&(K(Ne,Ft),K(Ne,~Ft)),t.arraySet(Ne.pending_buf,Ne.window,Vt,Ft,Ne.pending),Ne.pending+=Ft}function be(Ne,Vt,Ft,ir){var Fe=Vt*2,tt=Ft*2;return Ne[Fe]<Ne[tt]||Ne[Fe]===Ne[tt]&&ir[Vt]<=ir[Ft]}function j(Ne,Vt,Ft){for(var ir=Ne.heap[Ft],Fe=Ft<<1;Fe<=Ne.heap_len&&(Fe<Ne.heap_len&&be(Vt,Ne.heap[Fe+1],Ne.heap[Fe],Ne.depth)&&Fe++,!be(Vt,ir,Ne.heap[Fe],Ne.depth));)Ne.heap[Ft]=Ne.heap[Fe],Ft=Fe,Fe<<=1;Ne.heap[Ft]=ir}function Z(Ne,Vt,Ft){var ir,Fe,tt=0,ye,yt;if(Ne.last_lit!==0)do ir=Ne.pending_buf[Ne.d_buf+tt*2]<<8|Ne.pending_buf[Ne.d_buf+tt*2+1],Fe=Ne.pending_buf[Ne.l_buf+tt],tt++,ir===0?se(Ne,Fe,Vt):(ye=W[Fe],se(Ne,ye+p+1,Vt),yt=x[ye],yt!==0&&(Fe-=L[ye],J(Ne,Fe,yt)),ir--,ye=X(ir),se(Ne,ye,Ft),yt=v[ye],yt!==0&&(ir-=k[ye],J(Ne,ir,yt)));while(tt<Ne.last_lit);se(Ne,C,Vt)}function ie(Ne,Vt){var Ft=Vt.dyn_tree,ir=Vt.stat_desc.static_tree,Fe=Vt.stat_desc.has_stree,tt=Vt.stat_desc.elems,ye,yt,Wt=-1,pe;for(Ne.heap_len=0,Ne.heap_max=b,ye=0;ye<tt;ye++)Ft[ye*2]!==0?(Ne.heap[++Ne.heap_len]=Wt=ye,Ne.depth[ye]=0):Ft[ye*2+1]=0;for(;Ne.heap_len<2;)pe=Ne.heap[++Ne.heap_len]=Wt<2?++Wt:0,Ft[pe*2]=1,Ne.depth[pe]=0,Ne.opt_len--,Fe&&(Ne.static_len-=ir[pe*2+1]);for(Vt.max_code=Wt,ye=Ne.heap_len>>1;ye>=1;ye--)j(Ne,Ft,ye);pe=tt;do ye=Ne.heap[1],Ne.heap[1]=Ne.heap[Ne.heap_len--],j(Ne,Ft,1),yt=Ne.heap[1],Ne.heap[--Ne.heap_max]=ye,Ne.heap[--Ne.heap_max]=yt,Ft[pe*2]=Ft[ye*2]+Ft[yt*2],Ne.depth[pe]=(Ne.depth[ye]>=Ne.depth[yt]?Ne.depth[ye]:Ne.depth[yt])+1,Ft[ye*2+1]=Ft[yt*2+1]=pe,Ne.heap[1]=pe++,j(Ne,Ft,1);while(Ne.heap_len>=2);Ne.heap[--Ne.heap_max]=Ne.heap[1],oe(Ne,Vt),$(Ft,Wt,Ne.bl_count)}function de(Ne,Vt,Ft){var ir,Fe=-1,tt,ye=Vt[1],yt=0,Wt=7,pe=4;for(ye===0&&(Wt=138,pe=3),Vt[(Ft+1)*2+1]=65535,ir=0;ir<=Ft;ir++)tt=ye,ye=Vt[(ir+1)*2+1],!(++yt<Wt&&tt===ye)&&(yt<pe?Ne.bl_tree[tt*2]+=yt:tt!==0?(tt!==Fe&&Ne.bl_tree[tt*2]++,Ne.bl_tree[E*2]++):yt<=10?Ne.bl_tree[O*2]++:Ne.bl_tree[_*2]++,yt=0,Fe=tt,ye===0?(Wt=138,pe=3):tt===ye?(Wt=6,pe=3):(Wt=7,pe=4))}function me(Ne,Vt,Ft){var ir,Fe=-1,tt,ye=Vt[1],yt=0,Wt=7,pe=4;for(ye===0&&(Wt=138,pe=3),ir=0;ir<=Ft;ir++)if(tt=ye,ye=Vt[(ir+1)*2+1],!(++yt<Wt&&tt===ye)){if(yt<pe)do se(Ne,tt,Ne.bl_tree);while(--yt!==0);else tt!==0?(tt!==Fe&&(se(Ne,tt,Ne.bl_tree),yt--),se(Ne,E,Ne.bl_tree),J(Ne,yt-3,2)):yt<=10?(se(Ne,O,Ne.bl_tree),J(Ne,yt-3,3)):(se(Ne,_,Ne.bl_tree),J(Ne,yt-11,7));yt=0,Fe=tt,ye===0?(Wt=138,pe=3):tt===ye?(Wt=6,pe=3):(Wt=7,pe=4)}}function Se(Ne){var Vt;for(de(Ne,Ne.dyn_ltree,Ne.l_desc.max_code),de(Ne,Ne.dyn_dtree,Ne.d_desc.max_code),ie(Ne,Ne.bl_desc),Vt=y-1;Vt>=3&&Ne.bl_tree[w[Vt]*2+1]===0;Vt--);return Ne.opt_len+=3*(Vt+1)+5+5+4,Vt}function Re(Ne,Vt,Ft,ir){var Fe;for(J(Ne,Vt-257,5),J(Ne,Ft-1,5),J(Ne,ir-4,4),Fe=0;Fe<ir;Fe++)J(Ne,Ne.bl_tree[w[Fe]*2+1],3);me(Ne,Ne.dyn_ltree,Vt-1),me(Ne,Ne.dyn_dtree,Ft-1)}function Je(Ne){var Vt=4093624447,Ft;for(Ft=0;Ft<=31;Ft++,Vt>>>=1)if(Vt&1&&Ne.dyn_ltree[Ft*2]!==0)return r;if(Ne.dyn_ltree[18]!==0||Ne.dyn_ltree[20]!==0||Ne.dyn_ltree[26]!==0)return i;for(Ft=32;Ft<p;Ft++)if(Ne.dyn_ltree[Ft*2]!==0)return i;return r}var Ke=!1;function Gt(Ne){Ke||(fe(),Ke=!0),Ne.l_desc=new Y(Ne.dyn_ltree,U),Ne.d_desc=new Y(Ne.dyn_dtree,B),Ne.bl_desc=new Y(Ne.bl_tree,G),Ne.bi_buf=0,Ne.bi_valid=0,Oe(Ne)}function Nr(Ne,Vt,Ft,ir){J(Ne,(a<<1)+(ir?1:0),3),ue(Ne,Vt,Ft,!0)}function xr(Ne){J(Ne,l<<1,3),se(Ne,C,H),te(Ne)}function vr(Ne,Vt,Ft,ir){var Fe,tt,ye=0;Ne.level>0?(Ne.strm.data_type===n&&(Ne.strm.data_type=Je(Ne)),ie(Ne,Ne.l_desc),ie(Ne,Ne.d_desc),ye=Se(Ne),Fe=Ne.opt_len+3+7>>>3,tt=Ne.static_len+3+7>>>3,tt<=Fe&&(Fe=tt)):Fe=tt=Ft+5,Ft+4<=Fe&&Vt!==-1?Nr(Ne,Vt,Ft,ir):Ne.strategy===e||tt===Fe?(J(Ne,(l<<1)+(ir?1:0),3),Z(Ne,H,z)):(J(Ne,(c<<1)+(ir?1:0),3),Re(Ne,Ne.l_desc.max_code+1,Ne.d_desc.max_code+1,ye+1),Z(Ne,Ne.dyn_ltree,Ne.dyn_dtree)),Oe(Ne),ir&&Te(Ne)}function _r(Ne,Vt,Ft){return Ne.pending_buf[Ne.d_buf+Ne.last_lit*2]=Vt>>>8&255,Ne.pending_buf[Ne.d_buf+Ne.last_lit*2+1]=Vt&255,Ne.pending_buf[Ne.l_buf+Ne.last_lit]=Ft&255,Ne.last_lit++,Vt===0?Ne.dyn_ltree[Ft*2]++:(Ne.matches++,Vt--,Ne.dyn_ltree[(W[Ft]+p+1)*2]++,Ne.dyn_dtree[X(Vt)*2]++),Ne.last_lit===Ne.lit_bufsize-1}o._tr_init=Gt,o._tr_stored_block=Nr,o._tr_flush_block=vr,o._tr_tally=_r,o._tr_align=xr}),ORe=Nn((o,t)=>{"use strict";function e(r,i,n,s){for(var a=r&65535|0,l=r>>>16&65535|0,c=0;n!==0;){c=n>2e3?2e3:n,n-=c;do a=a+i[s++]|0,l=l+a|0;while(--c);a%=65521,l%=65521}return a|l<<16|0}t.exports=e}),ARe=Nn((o,t)=>{"use strict";function e(){for(var n,s=[],a=0;a<256;a++){n=a;for(var l=0;l<8;l++)n=n&1?3988292384^n>>>1:n>>>1;s[a]=n}return s}var r=e();function i(n,s,a,l){var c=r,h=l+a;n^=-1;for(var u=l;u<h;u++)n=n>>>8^c[(n^s[u])&255];return n^-1}t.exports=i}),xye=Nn((o,t)=>{"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}}),uQe=Nn(o=>{"use strict";var t=H_(),e=hQe(),r=ORe(),i=ARe(),n=xye(),s=0,a=1,l=3,c=4,h=5,u=0,d=1,p=-2,m=-3,g=-5,y=-1,b=1,P=2,T=3,I=4,C=0,E=2,O=8,_=9,x=15,v=8,D=29,w=256,F=w+1+D,H=30,z=19,V=2*F+1,W=15,L=3,k=258,N=k+L+1,U=32,B=42,G=69,Y=73,X=91,K=103,J=113,se=666,ce=1,te=2,oe=3,$=4,fe=3;function Oe(pe,Xe){return pe.msg=n[Xe],Xe}function Te(pe){return(pe<<1)-(pe>4?9:0)}function ue(pe){for(var Xe=pe.length;--Xe>=0;)pe[Xe]=0}function be(pe){var Xe=pe.state,ct=Xe.pending;ct>pe.avail_out&&(ct=pe.avail_out),ct!==0&&(t.arraySet(pe.output,Xe.pending_buf,Xe.pending_out,ct,pe.next_out),pe.next_out+=ct,Xe.pending_out+=ct,pe.total_out+=ct,pe.avail_out-=ct,Xe.pending-=ct,Xe.pending===0&&(Xe.pending_out=0))}function j(pe,Xe){e._tr_flush_block(pe,pe.block_start>=0?pe.block_start:-1,pe.strstart-pe.block_start,Xe),pe.block_start=pe.strstart,be(pe.strm)}function Z(pe,Xe){pe.pending_buf[pe.pending++]=Xe}function ie(pe,Xe){pe.pending_buf[pe.pending++]=Xe>>>8&255,pe.pending_buf[pe.pending++]=Xe&255}function de(pe,Xe,ct,Me){var st=pe.avail_in;return st>Me&&(st=Me),st===0?0:(pe.avail_in-=st,t.arraySet(Xe,pe.input,pe.next_in,st,ct),pe.state.wrap===1?pe.adler=r(pe.adler,Xe,st,ct):pe.state.wrap===2&&(pe.adler=i(pe.adler,Xe,st,ct)),pe.next_in+=st,pe.total_in+=st,st)}function me(pe,Xe){var ct=pe.max_chain_length,Me=pe.strstart,st,Ot,hr=pe.prev_length,Or=pe.nice_match,Xr=pe.strstart>pe.w_size-N?pe.strstart-(pe.w_size-N):0,Oi=pe.window,qi=pe.w_mask,Ni=pe.prev,Wi=pe.strstart+k,fo=Oi[Me+hr-1],tl=Oi[Me+hr];pe.prev_length>=pe.good_match&&(ct>>=2),Or>pe.lookahead&&(Or=pe.lookahead);do if(st=Xe,!(Oi[st+hr]!==tl||Oi[st+hr-1]!==fo||Oi[st]!==Oi[Me]||Oi[++st]!==Oi[Me+1])){Me+=2,st++;do;while(Oi[++Me]===Oi[++st]&&Oi[++Me]===Oi[++st]&&Oi[++Me]===Oi[++st]&&Oi[++Me]===Oi[++st]&&Oi[++Me]===Oi[++st]&&Oi[++Me]===Oi[++st]&&Oi[++Me]===Oi[++st]&&Oi[++Me]===Oi[++st]&&Me<Wi);if(Ot=k-(Wi-Me),Me=Wi-k,Ot>hr){if(pe.match_start=Xe,hr=Ot,Ot>=Or)break;fo=Oi[Me+hr-1],tl=Oi[Me+hr]}}while((Xe=Ni[Xe&qi])>Xr&&--ct!==0);return hr<=pe.lookahead?hr:pe.lookahead}function Se(pe){var Xe=pe.w_size,ct,Me,st,Ot,hr;do{if(Ot=pe.window_size-pe.lookahead-pe.strstart,pe.strstart>=Xe+(Xe-N)){t.arraySet(pe.window,pe.window,Xe,Xe,0),pe.match_start-=Xe,pe.strstart-=Xe,pe.block_start-=Xe,Me=pe.hash_size,ct=Me;do st=pe.head[--ct],pe.head[ct]=st>=Xe?st-Xe:0;while(--Me);Me=Xe,ct=Me;do st=pe.prev[--ct],pe.prev[ct]=st>=Xe?st-Xe:0;while(--Me);Ot+=Xe}if(pe.strm.avail_in===0)break;if(Me=de(pe.strm,pe.window,pe.strstart+pe.lookahead,Ot),pe.lookahead+=Me,pe.lookahead+pe.insert>=L)for(hr=pe.strstart-pe.insert,pe.ins_h=pe.window[hr],pe.ins_h=(pe.ins_h<<pe.hash_shift^pe.window[hr+1])&pe.hash_mask;pe.insert&&(pe.ins_h=(pe.ins_h<<pe.hash_shift^pe.window[hr+L-1])&pe.hash_mask,pe.prev[hr&pe.w_mask]=pe.head[pe.ins_h],pe.head[pe.ins_h]=hr,hr++,pe.insert--,!(pe.lookahead+pe.insert<L)););}while(pe.lookahead<N&&pe.strm.avail_in!==0)}function Re(pe,Xe){var ct=65535;for(ct>pe.pending_buf_size-5&&(ct=pe.pending_buf_size-5);;){if(pe.lookahead<=1){if(Se(pe),pe.lookahead===0&&Xe===s)return ce;if(pe.lookahead===0)break}pe.strstart+=pe.lookahead,pe.lookahead=0;var Me=pe.block_start+ct;if((pe.strstart===0||pe.strstart>=Me)&&(pe.lookahead=pe.strstart-Me,pe.strstart=Me,j(pe,!1),pe.strm.avail_out===0)||pe.strstart-pe.block_start>=pe.w_size-N&&(j(pe,!1),pe.strm.avail_out===0))return ce}return pe.insert=0,Xe===c?(j(pe,!0),pe.strm.avail_out===0?oe:$):(pe.strstart>pe.block_start&&(j(pe,!1),pe.strm.avail_out),ce)}function Je(pe,Xe){for(var ct,Me;;){if(pe.lookahead<N){if(Se(pe),pe.lookahead<N&&Xe===s)return ce;if(pe.lookahead===0)break}if(ct=0,pe.lookahead>=L&&(pe.ins_h=(pe.ins_h<<pe.hash_shift^pe.window[pe.strstart+L-1])&pe.hash_mask,ct=pe.prev[pe.strstart&pe.w_mask]=pe.head[pe.ins_h],pe.head[pe.ins_h]=pe.strstart),ct!==0&&pe.strstart-ct<=pe.w_size-N&&(pe.match_length=me(pe,ct)),pe.match_length>=L)if(Me=e._tr_tally(pe,pe.strstart-pe.match_start,pe.match_length-L),pe.lookahead-=pe.match_length,pe.match_length<=pe.max_lazy_match&&pe.lookahead>=L){pe.match_length--;do pe.strstart++,pe.ins_h=(pe.ins_h<<pe.hash_shift^pe.window[pe.strstart+L-1])&pe.hash_mask,ct=pe.prev[pe.strstart&pe.w_mask]=pe.head[pe.ins_h],pe.head[pe.ins_h]=pe.strstart;while(--pe.match_length!==0);pe.strstart++}else pe.strstart+=pe.match_length,pe.match_length=0,pe.ins_h=pe.window[pe.strstart],pe.ins_h=(pe.ins_h<<pe.hash_shift^pe.window[pe.strstart+1])&pe.hash_mask;else Me=e._tr_tally(pe,0,pe.window[pe.strstart]),pe.lookahead--,pe.strstart++;if(Me&&(j(pe,!1),pe.strm.avail_out===0))return ce}return pe.insert=pe.strstart<L-1?pe.strstart:L-1,Xe===c?(j(pe,!0),pe.strm.avail_out===0?oe:$):pe.last_lit&&(j(pe,!1),pe.strm.avail_out===0)?ce:te}function Ke(pe,Xe){for(var ct,Me,st;;){if(pe.lookahead<N){if(Se(pe),pe.lookahead<N&&Xe===s)return ce;if(pe.lookahead===0)break}if(ct=0,pe.lookahead>=L&&(pe.ins_h=(pe.ins_h<<pe.hash_shift^pe.window[pe.strstart+L-1])&pe.hash_mask,ct=pe.prev[pe.strstart&pe.w_mask]=pe.head[pe.ins_h],pe.head[pe.ins_h]=pe.strstart),pe.prev_length=pe.match_length,pe.prev_match=pe.match_start,pe.match_length=L-1,ct!==0&&pe.prev_length<pe.max_lazy_match&&pe.strstart-ct<=pe.w_size-N&&(pe.match_length=me(pe,ct),pe.match_length<=5&&(pe.strategy===b||pe.match_length===L&&pe.strstart-pe.match_start>4096)&&(pe.match_length=L-1)),pe.prev_length>=L&&pe.match_length<=pe.prev_length){st=pe.strstart+pe.lookahead-L,Me=e._tr_tally(pe,pe.strstart-1-pe.prev_match,pe.prev_length-L),pe.lookahead-=pe.prev_length-1,pe.prev_length-=2;do++pe.strstart<=st&&(pe.ins_h=(pe.ins_h<<pe.hash_shift^pe.window[pe.strstart+L-1])&pe.hash_mask,ct=pe.prev[pe.strstart&pe.w_mask]=pe.head[pe.ins_h],pe.head[pe.ins_h]=pe.strstart);while(--pe.prev_length!==0);if(pe.match_available=0,pe.match_length=L-1,pe.strstart++,Me&&(j(pe,!1),pe.strm.avail_out===0))return ce}else if(pe.match_available){if(Me=e._tr_tally(pe,0,pe.window[pe.strstart-1]),Me&&j(pe,!1),pe.strstart++,pe.lookahead--,pe.strm.avail_out===0)return ce}else pe.match_available=1,pe.strstart++,pe.lookahead--}return pe.match_available&&(Me=e._tr_tally(pe,0,pe.window[pe.strstart-1]),pe.match_available=0),pe.insert=pe.strstart<L-1?pe.strstart:L-1,Xe===c?(j(pe,!0),pe.strm.avail_out===0?oe:$):pe.last_lit&&(j(pe,!1),pe.strm.avail_out===0)?ce:te}function Gt(pe,Xe){for(var ct,Me,st,Ot,hr=pe.window;;){if(pe.lookahead<=k){if(Se(pe),pe.lookahead<=k&&Xe===s)return ce;if(pe.lookahead===0)break}if(pe.match_length=0,pe.lookahead>=L&&pe.strstart>0&&(st=pe.strstart-1,Me=hr[st],Me===hr[++st]&&Me===hr[++st]&&Me===hr[++st])){Ot=pe.strstart+k;do;while(Me===hr[++st]&&Me===hr[++st]&&Me===hr[++st]&&Me===hr[++st]&&Me===hr[++st]&&Me===hr[++st]&&Me===hr[++st]&&Me===hr[++st]&&st<Ot);pe.match_length=k-(Ot-st),pe.match_length>pe.lookahead&&(pe.match_length=pe.lookahead)}if(pe.match_length>=L?(ct=e._tr_tally(pe,1,pe.match_length-L),pe.lookahead-=pe.match_length,pe.strstart+=pe.match_length,pe.match_length=0):(ct=e._tr_tally(pe,0,pe.window[pe.strstart]),pe.lookahead--,pe.strstart++),ct&&(j(pe,!1),pe.strm.avail_out===0))return ce}return pe.insert=0,Xe===c?(j(pe,!0),pe.strm.avail_out===0?oe:$):pe.last_lit&&(j(pe,!1),pe.strm.avail_out===0)?ce:te}function Nr(pe,Xe){for(var ct;;){if(pe.lookahead===0&&(Se(pe),pe.lookahead===0)){if(Xe===s)return ce;break}if(pe.match_length=0,ct=e._tr_tally(pe,0,pe.window[pe.strstart]),pe.lookahead--,pe.strstart++,ct&&(j(pe,!1),pe.strm.avail_out===0))return ce}return pe.insert=0,Xe===c?(j(pe,!0),pe.strm.avail_out===0?oe:$):pe.last_lit&&(j(pe,!1),pe.strm.avail_out===0)?ce:te}function xr(pe,Xe,ct,Me,st){this.good_length=pe,this.max_lazy=Xe,this.nice_length=ct,this.max_chain=Me,this.func=st}var vr;vr=[new xr(0,0,0,0,Re),new xr(4,4,8,4,Je),new xr(4,5,16,8,Je),new xr(4,6,32,32,Je),new xr(4,4,16,16,Ke),new xr(8,16,32,32,Ke),new xr(8,16,128,128,Ke),new xr(8,32,128,256,Ke),new xr(32,128,258,1024,Ke),new xr(32,258,258,4096,Ke)];function _r(pe){pe.window_size=2*pe.w_size,ue(pe.head),pe.max_lazy_match=vr[pe.level].max_lazy,pe.good_match=vr[pe.level].good_length,pe.nice_match=vr[pe.level].nice_length,pe.max_chain_length=vr[pe.level].max_chain,pe.strstart=0,pe.block_start=0,pe.lookahead=0,pe.insert=0,pe.match_length=pe.prev_length=L-1,pe.match_available=0,pe.ins_h=0}function Ne(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=O,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new t.Buf16(V*2),this.dyn_dtree=new t.Buf16((2*H+1)*2),this.bl_tree=new t.Buf16((2*z+1)*2),ue(this.dyn_ltree),ue(this.dyn_dtree),ue(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new t.Buf16(W+1),this.heap=new t.Buf16(2*F+1),ue(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new t.Buf16(2*F+1),ue(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Vt(pe){var Xe;return!pe||!pe.state?Oe(pe,p):(pe.total_in=pe.total_out=0,pe.data_type=E,Xe=pe.state,Xe.pending=0,Xe.pending_out=0,Xe.wrap<0&&(Xe.wrap=-Xe.wrap),Xe.status=Xe.wrap?B:J,pe.adler=Xe.wrap===2?0:1,Xe.last_flush=s,e._tr_init(Xe),u)}function Ft(pe){var Xe=Vt(pe);return Xe===u&&_r(pe.state),Xe}function ir(pe,Xe){return!pe||!pe.state||pe.state.wrap!==2?p:(pe.state.gzhead=Xe,u)}function Fe(pe,Xe,ct,Me,st,Ot){if(!pe)return p;var hr=1;if(Xe===y&&(Xe=6),Me<0?(hr=0,Me=-Me):Me>15&&(hr=2,Me-=16),st<1||st>_||ct!==O||Me<8||Me>15||Xe<0||Xe>9||Ot<0||Ot>I)return Oe(pe,p);Me===8&&(Me=9);var Or=new Ne;return pe.state=Or,Or.strm=pe,Or.wrap=hr,Or.gzhead=null,Or.w_bits=Me,Or.w_size=1<<Or.w_bits,Or.w_mask=Or.w_size-1,Or.hash_bits=st+7,Or.hash_size=1<<Or.hash_bits,Or.hash_mask=Or.hash_size-1,Or.hash_shift=~~((Or.hash_bits+L-1)/L),Or.window=new t.Buf8(Or.w_size*2),Or.head=new t.Buf16(Or.hash_size),Or.prev=new t.Buf16(Or.w_size),Or.lit_bufsize=1<<st+6,Or.pending_buf_size=Or.lit_bufsize*4,Or.pending_buf=new t.Buf8(Or.pending_buf_size),Or.d_buf=1*Or.lit_bufsize,Or.l_buf=3*Or.lit_bufsize,Or.level=Xe,Or.strategy=Ot,Or.method=ct,Ft(pe)}function tt(pe,Xe){return Fe(pe,Xe,O,x,v,C)}function ye(pe,Xe){var ct,Me,st,Ot;if(!pe||!pe.state||Xe>h||Xe<0)return pe?Oe(pe,p):p;if(Me=pe.state,!pe.output||!pe.input&&pe.avail_in!==0||Me.status===se&&Xe!==c)return Oe(pe,pe.avail_out===0?g:p);if(Me.strm=pe,ct=Me.last_flush,Me.last_flush=Xe,Me.status===B)if(Me.wrap===2)pe.adler=0,Z(Me,31),Z(Me,139),Z(Me,8),Me.gzhead?(Z(Me,(Me.gzhead.text?1:0)+(Me.gzhead.hcrc?2:0)+(Me.gzhead.extra?4:0)+(Me.gzhead.name?8:0)+(Me.gzhead.comment?16:0)),Z(Me,Me.gzhead.time&255),Z(Me,Me.gzhead.time>>8&255),Z(Me,Me.gzhead.time>>16&255),Z(Me,Me.gzhead.time>>24&255),Z(Me,Me.level===9?2:Me.strategy>=P||Me.level<2?4:0),Z(Me,Me.gzhead.os&255),Me.gzhead.extra&&Me.gzhead.extra.length&&(Z(Me,Me.gzhead.extra.length&255),Z(Me,Me.gzhead.extra.length>>8&255)),Me.gzhead.hcrc&&(pe.adler=i(pe.adler,Me.pending_buf,Me.pending,0)),Me.gzindex=0,Me.status=G):(Z(Me,0),Z(Me,0),Z(Me,0),Z(Me,0),Z(Me,0),Z(Me,Me.level===9?2:Me.strategy>=P||Me.level<2?4:0),Z(Me,fe),Me.status=J);else{var hr=O+(Me.w_bits-8<<4)<<8,Or=-1;Me.strategy>=P||Me.level<2?Or=0:Me.level<6?Or=1:Me.level===6?Or=2:Or=3,hr|=Or<<6,Me.strstart!==0&&(hr|=U),hr+=31-hr%31,Me.status=J,ie(Me,hr),Me.strstart!==0&&(ie(Me,pe.adler>>>16),ie(Me,pe.adler&65535)),pe.adler=1}if(Me.status===G)if(Me.gzhead.extra){for(st=Me.pending;Me.gzindex<(Me.gzhead.extra.length&65535)&&!(Me.pending===Me.pending_buf_size&&(Me.gzhead.hcrc&&Me.pending>st&&(pe.adler=i(pe.adler,Me.pending_buf,Me.pending-st,st)),be(pe),st=Me.pending,Me.pending===Me.pending_buf_size));)Z(Me,Me.gzhead.extra[Me.gzindex]&255),Me.gzindex++;Me.gzhead.hcrc&&Me.pending>st&&(pe.adler=i(pe.adler,Me.pending_buf,Me.pending-st,st)),Me.gzindex===Me.gzhead.extra.length&&(Me.gzindex=0,Me.status=Y)}else Me.status=Y;if(Me.status===Y)if(Me.gzhead.name){st=Me.pending;do{if(Me.pending===Me.pending_buf_size&&(Me.gzhead.hcrc&&Me.pending>st&&(pe.adler=i(pe.adler,Me.pending_buf,Me.pending-st,st)),be(pe),st=Me.pending,Me.pending===Me.pending_buf_size)){Ot=1;break}Me.gzindex<Me.gzhead.name.length?Ot=Me.gzhead.name.charCodeAt(Me.gzindex++)&255:Ot=0,Z(Me,Ot)}while(Ot!==0);Me.gzhead.hcrc&&Me.pending>st&&(pe.adler=i(pe.adler,Me.pending_buf,Me.pending-st,st)),Ot===0&&(Me.gzindex=0,Me.status=X)}else Me.status=X;if(Me.status===X)if(Me.gzhead.comment){st=Me.pending;do{if(Me.pending===Me.pending_buf_size&&(Me.gzhead.hcrc&&Me.pending>st&&(pe.adler=i(pe.adler,Me.pending_buf,Me.pending-st,st)),be(pe),st=Me.pending,Me.pending===Me.pending_buf_size)){Ot=1;break}Me.gzindex<Me.gzhead.comment.length?Ot=Me.gzhead.comment.charCodeAt(Me.gzindex++)&255:Ot=0,Z(Me,Ot)}while(Ot!==0);Me.gzhead.hcrc&&Me.pending>st&&(pe.adler=i(pe.adler,Me.pending_buf,Me.pending-st,st)),Ot===0&&(Me.status=K)}else Me.status=K;if(Me.status===K&&(Me.gzhead.hcrc?(Me.pending+2>Me.pending_buf_size&&be(pe),Me.pending+2<=Me.pending_buf_size&&(Z(Me,pe.adler&255),Z(Me,pe.adler>>8&255),pe.adler=0,Me.status=J)):Me.status=J),Me.pending!==0){if(be(pe),pe.avail_out===0)return Me.last_flush=-1,u}else if(pe.avail_in===0&&Te(Xe)<=Te(ct)&&Xe!==c)return Oe(pe,g);if(Me.status===se&&pe.avail_in!==0)return Oe(pe,g);if(pe.avail_in!==0||Me.lookahead!==0||Xe!==s&&Me.status!==se){var Xr=Me.strategy===P?Nr(Me,Xe):Me.strategy===T?Gt(Me,Xe):vr[Me.level].func(Me,Xe);if((Xr===oe||Xr===$)&&(Me.status=se),Xr===ce||Xr===oe)return pe.avail_out===0&&(Me.last_flush=-1),u;if(Xr===te&&(Xe===a?e._tr_align(Me):Xe!==h&&(e._tr_stored_block(Me,0,0,!1),Xe===l&&(ue(Me.head),Me.lookahead===0&&(Me.strstart=0,Me.block_start=0,Me.insert=0))),be(pe),pe.avail_out===0))return Me.last_flush=-1,u}return Xe!==c?u:Me.wrap<=0?d:(Me.wrap===2?(Z(Me,pe.adler&255),Z(Me,pe.adler>>8&255),Z(Me,pe.adler>>16&255),Z(Me,pe.adler>>24&255),Z(Me,pe.total_in&255),Z(Me,pe.total_in>>8&255),Z(Me,pe.total_in>>16&255),Z(Me,pe.total_in>>24&255)):(ie(Me,pe.adler>>>16),ie(Me,pe.adler&65535)),be(pe),Me.wrap>0&&(Me.wrap=-Me.wrap),Me.pending!==0?u:d)}function yt(pe){var Xe;return!pe||!pe.state?p:(Xe=pe.state.status,Xe!==B&&Xe!==G&&Xe!==Y&&Xe!==X&&Xe!==K&&Xe!==J&&Xe!==se?Oe(pe,p):(pe.state=null,Xe===J?Oe(pe,m):u))}function Wt(pe,Xe){var ct=Xe.length,Me,st,Ot,hr,Or,Xr,Oi,qi;if(!pe||!pe.state||(Me=pe.state,hr=Me.wrap,hr===2||hr===1&&Me.status!==B||Me.lookahead))return p;for(hr===1&&(pe.adler=r(pe.adler,Xe,ct,0)),Me.wrap=0,ct>=Me.w_size&&(hr===0&&(ue(Me.head),Me.strstart=0,Me.block_start=0,Me.insert=0),qi=new t.Buf8(Me.w_size),t.arraySet(qi,Xe,ct-Me.w_size,Me.w_size,0),Xe=qi,ct=Me.w_size),Or=pe.avail_in,Xr=pe.next_in,Oi=pe.input,pe.avail_in=ct,pe.next_in=0,pe.input=Xe,Se(Me);Me.lookahead>=L;){st=Me.strstart,Ot=Me.lookahead-(L-1);do Me.ins_h=(Me.ins_h<<Me.hash_shift^Me.window[st+L-1])&Me.hash_mask,Me.prev[st&Me.w_mask]=Me.head[Me.ins_h],Me.head[Me.ins_h]=st,st++;while(--Ot);Me.strstart=st,Me.lookahead=L-1,Se(Me)}return Me.strstart+=Me.lookahead,Me.block_start=Me.strstart,Me.insert=Me.lookahead,Me.lookahead=0,Me.match_length=Me.prev_length=L-1,Me.match_available=0,pe.next_in=Xr,pe.input=Oi,pe.avail_in=Or,Me.wrap=hr,u}o.deflateInit=tt,o.deflateInit2=Fe,o.deflateReset=Ft,o.deflateResetKeep=Vt,o.deflateSetHeader=ir,o.deflate=ye,o.deflateEnd=yt,o.deflateSetDictionary=Wt,o.deflateInfo="pako deflate (from Nodeca project)"}),_Re=Nn(o=>{"use strict";var t=H_(),e=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch{e=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{r=!1}var i=new t.Buf8(256);for(n=0;n<256;n++)i[n]=n>=252?6:n>=248?5:n>=240?4:n>=224?3:n>=192?2:1;var n;i[254]=i[254]=1,o.string2buf=function(a){var l,c,h,u,d,p=a.length,m=0;for(u=0;u<p;u++)c=a.charCodeAt(u),(c&64512)===55296&&u+1<p&&(h=a.charCodeAt(u+1),(h&64512)===56320&&(c=65536+(c-55296<<10)+(h-56320),u++)),m+=c<128?1:c<2048?2:c<65536?3:4;for(l=new t.Buf8(m),d=0,u=0;d<m;u++)c=a.charCodeAt(u),(c&64512)===55296&&u+1<p&&(h=a.charCodeAt(u+1),(h&64512)===56320&&(c=65536+(c-55296<<10)+(h-56320),u++)),c<128?l[d++]=c:c<2048?(l[d++]=192|c>>>6,l[d++]=128|c&63):c<65536?(l[d++]=224|c>>>12,l[d++]=128|c>>>6&63,l[d++]=128|c&63):(l[d++]=240|c>>>18,l[d++]=128|c>>>12&63,l[d++]=128|c>>>6&63,l[d++]=128|c&63);return l};function s(a,l){if(l<65534&&(a.subarray&&r||!a.subarray&&e))return String.fromCharCode.apply(null,t.shrinkBuf(a,l));for(var c="",h=0;h<l;h++)c+=String.fromCharCode(a[h]);return c}o.buf2binstring=function(a){return s(a,a.length)},o.binstring2buf=function(a){for(var l=new t.Buf8(a.length),c=0,h=l.length;c<h;c++)l[c]=a.charCodeAt(c);return l},o.buf2string=function(a,l){var c,h,u,d,p=l||a.length,m=new Array(p*2);for(h=0,c=0;c<p;){if(u=a[c++],u<128){m[h++]=u;continue}if(d=i[u],d>4){m[h++]=65533,c+=d-1;continue}for(u&=d===2?31:d===3?15:7;d>1&&c<p;)u=u<<6|a[c++]&63,d--;if(d>1){m[h++]=65533;continue}u<65536?m[h++]=u:(u-=65536,m[h++]=55296|u>>10&1023,m[h++]=56320|u&1023)}return s(m,h)},o.utf8border=function(a,l){var c;for(l=l||a.length,l>a.length&&(l=a.length),c=l-1;c>=0&&(a[c]&192)===128;)c--;return c<0||c===0?l:c+i[a[c]]>l?c:l}}),vRe=Nn((o,t)=>{"use strict";function e(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}t.exports=e}),dQe=Nn(o=>{"use strict";var t=uQe(),e=H_(),r=_Re(),i=xye(),n=vRe(),s=Object.prototype.toString,a=0,l=4,c=0,h=1,u=2,d=-1,p=0,m=8;function g(T){if(!(this instanceof g))return new g(T);this.options=e.assign({level:d,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},T||{});var I=this.options;I.raw&&I.windowBits>0?I.windowBits=-I.windowBits:I.gzip&&I.windowBits>0&&I.windowBits<16&&(I.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new n,this.strm.avail_out=0;var C=t.deflateInit2(this.strm,I.level,I.method,I.windowBits,I.memLevel,I.strategy);if(C!==c)throw new Error(i[C]);if(I.header&&t.deflateSetHeader(this.strm,I.header),I.dictionary){var E;if(typeof I.dictionary=="string"?E=r.string2buf(I.dictionary):s.call(I.dictionary)==="[object ArrayBuffer]"?E=new Uint8Array(I.dictionary):E=I.dictionary,C=t.deflateSetDictionary(this.strm,E),C!==c)throw new Error(i[C]);this._dict_set=!0}}g.prototype.push=function(T,I){var C=this.strm,E=this.options.chunkSize,O,_;if(this.ended)return!1;_=I===~~I?I:I===!0?l:a,typeof T=="string"?C.input=r.string2buf(T):s.call(T)==="[object ArrayBuffer]"?C.input=new Uint8Array(T):C.input=T,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new e.Buf8(E),C.next_out=0,C.avail_out=E),O=t.deflate(C,_),O!==h&&O!==c)return this.onEnd(O),this.ended=!0,!1;(C.avail_out===0||C.avail_in===0&&(_===l||_===u))&&(this.options.to==="string"?this.onData(r.buf2binstring(e.shrinkBuf(C.output,C.next_out))):this.onData(e.shrinkBuf(C.output,C.next_out)))}while((C.avail_in>0||C.avail_out===0)&&O!==h);return _===l?(O=t.deflateEnd(this.strm),this.onEnd(O),this.ended=!0,O===c):(_===u&&(this.onEnd(c),C.avail_out=0),!0)},g.prototype.onData=function(T){this.chunks.push(T)},g.prototype.onEnd=function(T){T===c&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=e.flattenChunks(this.chunks)),this.chunks=[],this.err=T,this.msg=this.strm.msg};function y(T,I){var C=new g(I);if(C.push(T,!0),C.err)throw C.msg||i[C.err];return C.result}function b(T,I){return I=I||{},I.raw=!0,y(T,I)}function P(T,I){return I=I||{},I.gzip=!0,y(T,I)}o.Deflate=g,o.deflate=y,o.deflateRaw=b,o.gzip=P}),pQe=Nn((o,t)=>{"use strict";var e=30,r=12;t.exports=function(i,n){var s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,x,v,D,w,F,H;s=i.state,a=i.next_in,F=i.input,l=a+(i.avail_in-5),c=i.next_out,H=i.output,h=c-(n-i.avail_out),u=c+(i.avail_out-257),d=s.dmax,p=s.wsize,m=s.whave,g=s.wnext,y=s.window,b=s.hold,P=s.bits,T=s.lencode,I=s.distcode,C=(1<<s.lenbits)-1,E=(1<<s.distbits)-1;e:do{P<15&&(b+=F[a++]<<P,P+=8,b+=F[a++]<<P,P+=8),O=T[b&C];t:for(;;){if(_=O>>>24,b>>>=_,P-=_,_=O>>>16&255,_===0)H[c++]=O&65535;else if(_&16){x=O&65535,_&=15,_&&(P<_&&(b+=F[a++]<<P,P+=8),x+=b&(1<<_)-1,b>>>=_,P-=_),P<15&&(b+=F[a++]<<P,P+=8,b+=F[a++]<<P,P+=8),O=I[b&E];r:for(;;){if(_=O>>>24,b>>>=_,P-=_,_=O>>>16&255,_&16){if(v=O&65535,_&=15,P<_&&(b+=F[a++]<<P,P+=8,P<_&&(b+=F[a++]<<P,P+=8)),v+=b&(1<<_)-1,v>d){i.msg="invalid distance too far back",s.mode=e;break e}if(b>>>=_,P-=_,_=c-h,v>_){if(_=v-_,_>m&&s.sane){i.msg="invalid distance too far back",s.mode=e;break e}if(D=0,w=y,g===0){if(D+=p-_,_<x){x-=_;do H[c++]=y[D++];while(--_);D=c-v,w=H}}else if(g<_){if(D+=p+g-_,_-=g,_<x){x-=_;do H[c++]=y[D++];while(--_);if(D=0,g<x){_=g,x-=_;do H[c++]=y[D++];while(--_);D=c-v,w=H}}}else if(D+=g-_,_<x){x-=_;do H[c++]=y[D++];while(--_);D=c-v,w=H}for(;x>2;)H[c++]=w[D++],H[c++]=w[D++],H[c++]=w[D++],x-=3;x&&(H[c++]=w[D++],x>1&&(H[c++]=w[D++]))}else{D=c-v;do H[c++]=H[D++],H[c++]=H[D++],H[c++]=H[D++],x-=3;while(x>2);x&&(H[c++]=H[D++],x>1&&(H[c++]=H[D++]))}}else if((_&64)===0){O=I[(O&65535)+(b&(1<<_)-1)];continue r}else{i.msg="invalid distance code",s.mode=e;break e}break}}else if((_&64)===0){O=T[(O&65535)+(b&(1<<_)-1)];continue t}else if(_&32){s.mode=r;break e}else{i.msg="invalid literal/length code",s.mode=e;break e}break}}while(a<l&&c<u);x=P>>3,a-=x,P-=x<<3,b&=(1<<P)-1,i.next_in=a,i.next_out=c,i.avail_in=a<l?5+(l-a):5-(a-l),i.avail_out=c<u?257+(u-c):257-(c-u),s.hold=b,s.bits=P}}),fQe=Nn((o,t)=>{"use strict";var e=H_(),r=15,i=852,n=592,s=0,a=1,l=2,c=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],h=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],u=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],d=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(p,m,g,y,b,P,T,I){var C=I.bits,E=0,O=0,_=0,x=0,v=0,D=0,w=0,F=0,H=0,z=0,V,W,L,k,N,U=null,B=0,G,Y=new e.Buf16(r+1),X=new e.Buf16(r+1),K=null,J=0,se,ce,te;for(E=0;E<=r;E++)Y[E]=0;for(O=0;O<y;O++)Y[m[g+O]]++;for(v=C,x=r;x>=1&&Y[x]===0;x--);if(v>x&&(v=x),x===0)return b[P++]=1<<24|64<<16|0,b[P++]=1<<24|64<<16|0,I.bits=1,0;for(_=1;_<x&&Y[_]===0;_++);for(v<_&&(v=_),F=1,E=1;E<=r;E++)if(F<<=1,F-=Y[E],F<0)return-1;if(F>0&&(p===s||x!==1))return-1;for(X[1]=0,E=1;E<r;E++)X[E+1]=X[E]+Y[E];for(O=0;O<y;O++)m[g+O]!==0&&(T[X[m[g+O]]++]=O);if(p===s?(U=K=T,G=19):p===a?(U=c,B-=257,K=h,J-=257,G=256):(U=u,K=d,G=-1),z=0,O=0,E=_,N=P,D=v,w=0,L=-1,H=1<<v,k=H-1,p===a&&H>i||p===l&&H>n)return 1;for(;;){se=E-w,T[O]<G?(ce=0,te=T[O]):T[O]>G?(ce=K[J+T[O]],te=U[B+T[O]]):(ce=96,te=0),V=1<<E-w,W=1<<D,_=W;do W-=V,b[N+(z>>w)+W]=se<<24|ce<<16|te|0;while(W!==0);for(V=1<<E-1;z&V;)V>>=1;if(V!==0?(z&=V-1,z+=V):z=0,O++,--Y[E]===0){if(E===x)break;E=m[g+T[O]]}if(E>v&&(z&k)!==L){for(w===0&&(w=v),N+=_,D=E-w,F=1<<D;D+w<x&&(F-=Y[D+w],!(F<=0));)D++,F<<=1;if(H+=1<<D,p===a&&H>i||p===l&&H>n)return 1;L=z&k,b[L]=v<<24|D<<16|N-P|0}}return z!==0&&(b[N+z]=E-w<<24|64<<16|0),I.bits=v,0}}),mQe=Nn(o=>{"use strict";var t=H_(),e=ORe(),r=ARe(),i=pQe(),n=fQe(),s=0,a=1,l=2,c=4,h=5,u=6,d=0,p=1,m=2,g=-2,y=-3,b=-4,P=-5,T=8,I=1,C=2,E=3,O=4,_=5,x=6,v=7,D=8,w=9,F=10,H=11,z=12,V=13,W=14,L=15,k=16,N=17,U=18,B=19,G=20,Y=21,X=22,K=23,J=24,se=25,ce=26,te=27,oe=28,$=29,fe=30,Oe=31,Te=32,ue=852,be=592,j=15,Z=j;function ie(Fe){return(Fe>>>24&255)+(Fe>>>8&65280)+((Fe&65280)<<8)+((Fe&255)<<24)}function de(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new t.Buf16(320),this.work=new t.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function me(Fe){var tt;return!Fe||!Fe.state?g:(tt=Fe.state,Fe.total_in=Fe.total_out=tt.total=0,Fe.msg="",tt.wrap&&(Fe.adler=tt.wrap&1),tt.mode=I,tt.last=0,tt.havedict=0,tt.dmax=32768,tt.head=null,tt.hold=0,tt.bits=0,tt.lencode=tt.lendyn=new t.Buf32(ue),tt.distcode=tt.distdyn=new t.Buf32(be),tt.sane=1,tt.back=-1,d)}function Se(Fe){var tt;return!Fe||!Fe.state?g:(tt=Fe.state,tt.wsize=0,tt.whave=0,tt.wnext=0,me(Fe))}function Re(Fe,tt){var ye,yt;return!Fe||!Fe.state||(yt=Fe.state,tt<0?(ye=0,tt=-tt):(ye=(tt>>4)+1,tt<48&&(tt&=15)),tt&&(tt<8||tt>15))?g:(yt.window!==null&&yt.wbits!==tt&&(yt.window=null),yt.wrap=ye,yt.wbits=tt,Se(Fe))}function Je(Fe,tt){var ye,yt;return Fe?(yt=new de,Fe.state=yt,yt.window=null,ye=Re(Fe,tt),ye!==d&&(Fe.state=null),ye):g}function Ke(Fe){return Je(Fe,Z)}var Gt=!0,Nr,xr;function vr(Fe){if(Gt){var tt;for(Nr=new t.Buf32(512),xr=new t.Buf32(32),tt=0;tt<144;)Fe.lens[tt++]=8;for(;tt<256;)Fe.lens[tt++]=9;for(;tt<280;)Fe.lens[tt++]=7;for(;tt<288;)Fe.lens[tt++]=8;for(n(a,Fe.lens,0,288,Nr,0,Fe.work,{bits:9}),tt=0;tt<32;)Fe.lens[tt++]=5;n(l,Fe.lens,0,32,xr,0,Fe.work,{bits:5}),Gt=!1}Fe.lencode=Nr,Fe.lenbits=9,Fe.distcode=xr,Fe.distbits=5}function _r(Fe,tt,ye,yt){var Wt,pe=Fe.state;return pe.window===null&&(pe.wsize=1<<pe.wbits,pe.wnext=0,pe.whave=0,pe.window=new t.Buf8(pe.wsize)),yt>=pe.wsize?(t.arraySet(pe.window,tt,ye-pe.wsize,pe.wsize,0),pe.wnext=0,pe.whave=pe.wsize):(Wt=pe.wsize-pe.wnext,Wt>yt&&(Wt=yt),t.arraySet(pe.window,tt,ye-yt,Wt,pe.wnext),yt-=Wt,yt?(t.arraySet(pe.window,tt,ye-yt,yt,0),pe.wnext=yt,pe.whave=pe.wsize):(pe.wnext+=Wt,pe.wnext===pe.wsize&&(pe.wnext=0),pe.whave<pe.wsize&&(pe.whave+=Wt))),0}function Ne(Fe,tt){var ye,yt,Wt,pe,Xe,ct,Me,st,Ot,hr,Or,Xr,Oi,qi,Ni=0,Wi,fo,tl,Oa,Gc,B0,Uc,Lt,Ql=new t.Buf8(4),Wm,Lg,OT=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!Fe||!Fe.state||!Fe.output||!Fe.input&&Fe.avail_in!==0)return g;ye=Fe.state,ye.mode===z&&(ye.mode=V),Xe=Fe.next_out,Wt=Fe.output,Me=Fe.avail_out,pe=Fe.next_in,yt=Fe.input,ct=Fe.avail_in,st=ye.hold,Ot=ye.bits,hr=ct,Or=Me,Lt=d;e:for(;;)switch(ye.mode){case I:if(ye.wrap===0){ye.mode=V;break}for(;Ot<16;){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}if(ye.wrap&2&&st===35615){ye.check=0,Ql[0]=st&255,Ql[1]=st>>>8&255,ye.check=r(ye.check,Ql,2,0),st=0,Ot=0,ye.mode=C;break}if(ye.flags=0,ye.head&&(ye.head.done=!1),!(ye.wrap&1)||(((st&255)<<8)+(st>>8))%31){Fe.msg="incorrect header check",ye.mode=fe;break}if((st&15)!==T){Fe.msg="unknown compression method",ye.mode=fe;break}if(st>>>=4,Ot-=4,Uc=(st&15)+8,ye.wbits===0)ye.wbits=Uc;else if(Uc>ye.wbits){Fe.msg="invalid window size",ye.mode=fe;break}ye.dmax=1<<Uc,Fe.adler=ye.check=1,ye.mode=st&512?F:z,st=0,Ot=0;break;case C:for(;Ot<16;){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}if(ye.flags=st,(ye.flags&255)!==T){Fe.msg="unknown compression method",ye.mode=fe;break}if(ye.flags&57344){Fe.msg="unknown header flags set",ye.mode=fe;break}ye.head&&(ye.head.text=st>>8&1),ye.flags&512&&(Ql[0]=st&255,Ql[1]=st>>>8&255,ye.check=r(ye.check,Ql,2,0)),st=0,Ot=0,ye.mode=E;case E:for(;Ot<32;){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}ye.head&&(ye.head.time=st),ye.flags&512&&(Ql[0]=st&255,Ql[1]=st>>>8&255,Ql[2]=st>>>16&255,Ql[3]=st>>>24&255,ye.check=r(ye.check,Ql,4,0)),st=0,Ot=0,ye.mode=O;case O:for(;Ot<16;){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}ye.head&&(ye.head.xflags=st&255,ye.head.os=st>>8),ye.flags&512&&(Ql[0]=st&255,Ql[1]=st>>>8&255,ye.check=r(ye.check,Ql,2,0)),st=0,Ot=0,ye.mode=_;case _:if(ye.flags&1024){for(;Ot<16;){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}ye.length=st,ye.head&&(ye.head.extra_len=st),ye.flags&512&&(Ql[0]=st&255,Ql[1]=st>>>8&255,ye.check=r(ye.check,Ql,2,0)),st=0,Ot=0}else ye.head&&(ye.head.extra=null);ye.mode=x;case x:if(ye.flags&1024&&(Xr=ye.length,Xr>ct&&(Xr=ct),Xr&&(ye.head&&(Uc=ye.head.extra_len-ye.length,ye.head.extra||(ye.head.extra=new Array(ye.head.extra_len)),t.arraySet(ye.head.extra,yt,pe,Xr,Uc)),ye.flags&512&&(ye.check=r(ye.check,yt,Xr,pe)),ct-=Xr,pe+=Xr,ye.length-=Xr),ye.length))break e;ye.length=0,ye.mode=v;case v:if(ye.flags&2048){if(ct===0)break e;Xr=0;do Uc=yt[pe+Xr++],ye.head&&Uc&&ye.length<65536&&(ye.head.name+=String.fromCharCode(Uc));while(Uc&&Xr<ct);if(ye.flags&512&&(ye.check=r(ye.check,yt,Xr,pe)),ct-=Xr,pe+=Xr,Uc)break e}else ye.head&&(ye.head.name=null);ye.length=0,ye.mode=D;case D:if(ye.flags&4096){if(ct===0)break e;Xr=0;do Uc=yt[pe+Xr++],ye.head&&Uc&&ye.length<65536&&(ye.head.comment+=String.fromCharCode(Uc));while(Uc&&Xr<ct);if(ye.flags&512&&(ye.check=r(ye.check,yt,Xr,pe)),ct-=Xr,pe+=Xr,Uc)break e}else ye.head&&(ye.head.comment=null);ye.mode=w;case w:if(ye.flags&512){for(;Ot<16;){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}if(st!==(ye.check&65535)){Fe.msg="header crc mismatch",ye.mode=fe;break}st=0,Ot=0}ye.head&&(ye.head.hcrc=ye.flags>>9&1,ye.head.done=!0),Fe.adler=ye.check=0,ye.mode=z;break;case F:for(;Ot<32;){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}Fe.adler=ye.check=ie(st),st=0,Ot=0,ye.mode=H;case H:if(ye.havedict===0)return Fe.next_out=Xe,Fe.avail_out=Me,Fe.next_in=pe,Fe.avail_in=ct,ye.hold=st,ye.bits=Ot,m;Fe.adler=ye.check=1,ye.mode=z;case z:if(tt===h||tt===u)break e;case V:if(ye.last){st>>>=Ot&7,Ot-=Ot&7,ye.mode=te;break}for(;Ot<3;){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}switch(ye.last=st&1,st>>>=1,Ot-=1,st&3){case 0:ye.mode=W;break;case 1:if(vr(ye),ye.mode=G,tt===u){st>>>=2,Ot-=2;break e}break;case 2:ye.mode=N;break;case 3:Fe.msg="invalid block type",ye.mode=fe}st>>>=2,Ot-=2;break;case W:for(st>>>=Ot&7,Ot-=Ot&7;Ot<32;){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}if((st&65535)!==(st>>>16^65535)){Fe.msg="invalid stored block lengths",ye.mode=fe;break}if(ye.length=st&65535,st=0,Ot=0,ye.mode=L,tt===u)break e;case L:ye.mode=k;case k:if(Xr=ye.length,Xr){if(Xr>ct&&(Xr=ct),Xr>Me&&(Xr=Me),Xr===0)break e;t.arraySet(Wt,yt,pe,Xr,Xe),ct-=Xr,pe+=Xr,Me-=Xr,Xe+=Xr,ye.length-=Xr;break}ye.mode=z;break;case N:for(;Ot<14;){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}if(ye.nlen=(st&31)+257,st>>>=5,Ot-=5,ye.ndist=(st&31)+1,st>>>=5,Ot-=5,ye.ncode=(st&15)+4,st>>>=4,Ot-=4,ye.nlen>286||ye.ndist>30){Fe.msg="too many length or distance symbols",ye.mode=fe;break}ye.have=0,ye.mode=U;case U:for(;ye.have<ye.ncode;){for(;Ot<3;){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}ye.lens[OT[ye.have++]]=st&7,st>>>=3,Ot-=3}for(;ye.have<19;)ye.lens[OT[ye.have++]]=0;if(ye.lencode=ye.lendyn,ye.lenbits=7,Wm={bits:ye.lenbits},Lt=n(s,ye.lens,0,19,ye.lencode,0,ye.work,Wm),ye.lenbits=Wm.bits,Lt){Fe.msg="invalid code lengths set",ye.mode=fe;break}ye.have=0,ye.mode=B;case B:for(;ye.have<ye.nlen+ye.ndist;){for(;Ni=ye.lencode[st&(1<<ye.lenbits)-1],Wi=Ni>>>24,fo=Ni>>>16&255,tl=Ni&65535,!(Wi<=Ot);){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}if(tl<16)st>>>=Wi,Ot-=Wi,ye.lens[ye.have++]=tl;else{if(tl===16){for(Lg=Wi+2;Ot<Lg;){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}if(st>>>=Wi,Ot-=Wi,ye.have===0){Fe.msg="invalid bit length repeat",ye.mode=fe;break}Uc=ye.lens[ye.have-1],Xr=3+(st&3),st>>>=2,Ot-=2}else if(tl===17){for(Lg=Wi+3;Ot<Lg;){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}st>>>=Wi,Ot-=Wi,Uc=0,Xr=3+(st&7),st>>>=3,Ot-=3}else{for(Lg=Wi+7;Ot<Lg;){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}st>>>=Wi,Ot-=Wi,Uc=0,Xr=11+(st&127),st>>>=7,Ot-=7}if(ye.have+Xr>ye.nlen+ye.ndist){Fe.msg="invalid bit length repeat",ye.mode=fe;break}for(;Xr--;)ye.lens[ye.have++]=Uc}}if(ye.mode===fe)break;if(ye.lens[256]===0){Fe.msg="invalid code -- missing end-of-block",ye.mode=fe;break}if(ye.lenbits=9,Wm={bits:ye.lenbits},Lt=n(a,ye.lens,0,ye.nlen,ye.lencode,0,ye.work,Wm),ye.lenbits=Wm.bits,Lt){Fe.msg="invalid literal/lengths set",ye.mode=fe;break}if(ye.distbits=6,ye.distcode=ye.distdyn,Wm={bits:ye.distbits},Lt=n(l,ye.lens,ye.nlen,ye.ndist,ye.distcode,0,ye.work,Wm),ye.distbits=Wm.bits,Lt){Fe.msg="invalid distances set",ye.mode=fe;break}if(ye.mode=G,tt===u)break e;case G:ye.mode=Y;case Y:if(ct>=6&&Me>=258){Fe.next_out=Xe,Fe.avail_out=Me,Fe.next_in=pe,Fe.avail_in=ct,ye.hold=st,ye.bits=Ot,i(Fe,Or),Xe=Fe.next_out,Wt=Fe.output,Me=Fe.avail_out,pe=Fe.next_in,yt=Fe.input,ct=Fe.avail_in,st=ye.hold,Ot=ye.bits,ye.mode===z&&(ye.back=-1);break}for(ye.back=0;Ni=ye.lencode[st&(1<<ye.lenbits)-1],Wi=Ni>>>24,fo=Ni>>>16&255,tl=Ni&65535,!(Wi<=Ot);){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}if(fo&&(fo&240)===0){for(Oa=Wi,Gc=fo,B0=tl;Ni=ye.lencode[B0+((st&(1<<Oa+Gc)-1)>>Oa)],Wi=Ni>>>24,fo=Ni>>>16&255,tl=Ni&65535,!(Oa+Wi<=Ot);){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}st>>>=Oa,Ot-=Oa,ye.back+=Oa}if(st>>>=Wi,Ot-=Wi,ye.back+=Wi,ye.length=tl,fo===0){ye.mode=ce;break}if(fo&32){ye.back=-1,ye.mode=z;break}if(fo&64){Fe.msg="invalid literal/length code",ye.mode=fe;break}ye.extra=fo&15,ye.mode=X;case X:if(ye.extra){for(Lg=ye.extra;Ot<Lg;){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}ye.length+=st&(1<<ye.extra)-1,st>>>=ye.extra,Ot-=ye.extra,ye.back+=ye.extra}ye.was=ye.length,ye.mode=K;case K:for(;Ni=ye.distcode[st&(1<<ye.distbits)-1],Wi=Ni>>>24,fo=Ni>>>16&255,tl=Ni&65535,!(Wi<=Ot);){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}if((fo&240)===0){for(Oa=Wi,Gc=fo,B0=tl;Ni=ye.distcode[B0+((st&(1<<Oa+Gc)-1)>>Oa)],Wi=Ni>>>24,fo=Ni>>>16&255,tl=Ni&65535,!(Oa+Wi<=Ot);){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}st>>>=Oa,Ot-=Oa,ye.back+=Oa}if(st>>>=Wi,Ot-=Wi,ye.back+=Wi,fo&64){Fe.msg="invalid distance code",ye.mode=fe;break}ye.offset=tl,ye.extra=fo&15,ye.mode=J;case J:if(ye.extra){for(Lg=ye.extra;Ot<Lg;){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}ye.offset+=st&(1<<ye.extra)-1,st>>>=ye.extra,Ot-=ye.extra,ye.back+=ye.extra}if(ye.offset>ye.dmax){Fe.msg="invalid distance too far back",ye.mode=fe;break}ye.mode=se;case se:if(Me===0)break e;if(Xr=Or-Me,ye.offset>Xr){if(Xr=ye.offset-Xr,Xr>ye.whave&&ye.sane){Fe.msg="invalid distance too far back",ye.mode=fe;break}Xr>ye.wnext?(Xr-=ye.wnext,Oi=ye.wsize-Xr):Oi=ye.wnext-Xr,Xr>ye.length&&(Xr=ye.length),qi=ye.window}else qi=Wt,Oi=Xe-ye.offset,Xr=ye.length;Xr>Me&&(Xr=Me),Me-=Xr,ye.length-=Xr;do Wt[Xe++]=qi[Oi++];while(--Xr);ye.length===0&&(ye.mode=Y);break;case ce:if(Me===0)break e;Wt[Xe++]=ye.length,Me--,ye.mode=Y;break;case te:if(ye.wrap){for(;Ot<32;){if(ct===0)break e;ct--,st|=yt[pe++]<<Ot,Ot+=8}if(Or-=Me,Fe.total_out+=Or,ye.total+=Or,Or&&(Fe.adler=ye.check=ye.flags?r(ye.check,Wt,Or,Xe-Or):e(ye.check,Wt,Or,Xe-Or)),Or=Me,(ye.flags?st:ie(st))!==ye.check){Fe.msg="incorrect data check",ye.mode=fe;break}st=0,Ot=0}ye.mode=oe;case oe:if(ye.wrap&&ye.flags){for(;Ot<32;){if(ct===0)break e;ct--,st+=yt[pe++]<<Ot,Ot+=8}if(st!==(ye.total&4294967295)){Fe.msg="incorrect length check",ye.mode=fe;break}st=0,Ot=0}ye.mode=$;case $:Lt=p;break e;case fe:Lt=y;break e;case Oe:return b;case Te:default:return g}return Fe.next_out=Xe,Fe.avail_out=Me,Fe.next_in=pe,Fe.avail_in=ct,ye.hold=st,ye.bits=Ot,(ye.wsize||Or!==Fe.avail_out&&ye.mode<fe&&(ye.mode<te||tt!==c))&&_r(Fe,Fe.output,Fe.next_out,Or-Fe.avail_out)?(ye.mode=Oe,b):(hr-=Fe.avail_in,Or-=Fe.avail_out,Fe.total_in+=hr,Fe.total_out+=Or,ye.total+=Or,ye.wrap&&Or&&(Fe.adler=ye.check=ye.flags?r(ye.check,Wt,Or,Fe.next_out-Or):e(ye.check,Wt,Or,Fe.next_out-Or)),Fe.data_type=ye.bits+(ye.last?64:0)+(ye.mode===z?128:0)+(ye.mode===G||ye.mode===L?256:0),(hr===0&&Or===0||tt===c)&&Lt===d&&(Lt=P),Lt)}function Vt(Fe){if(!Fe||!Fe.state)return g;var tt=Fe.state;return tt.window&&(tt.window=null),Fe.state=null,d}function Ft(Fe,tt){var ye;return!Fe||!Fe.state||(ye=Fe.state,(ye.wrap&2)===0)?g:(ye.head=tt,tt.done=!1,d)}function ir(Fe,tt){var ye=tt.length,yt,Wt,pe;return!Fe||!Fe.state||(yt=Fe.state,yt.wrap!==0&&yt.mode!==H)?g:yt.mode===H&&(Wt=1,Wt=e(Wt,tt,ye,0),Wt!==yt.check)?y:(pe=_r(Fe,tt,ye,ye),pe?(yt.mode=Oe,b):(yt.havedict=1,d))}o.inflateReset=Se,o.inflateReset2=Re,o.inflateResetKeep=me,o.inflateInit=Ke,o.inflateInit2=Je,o.inflate=Ne,o.inflateEnd=Vt,o.inflateGetHeader=Ft,o.inflateSetDictionary=ir,o.inflateInfo="pako inflate (from Nodeca project)"}),xRe=Nn((o,t)=>{"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}}),gQe=Nn((o,t)=>{"use strict";function e(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}t.exports=e}),yQe=Nn(o=>{"use strict";var t=mQe(),e=H_(),r=_Re(),i=xRe(),n=xye(),s=vRe(),a=gQe(),l=Object.prototype.toString;function c(d){if(!(this instanceof c))return new c(d);this.options=e.assign({chunkSize:16384,windowBits:0,to:""},d||{});var p=this.options;p.raw&&p.windowBits>=0&&p.windowBits<16&&(p.windowBits=-p.windowBits,p.windowBits===0&&(p.windowBits=-15)),p.windowBits>=0&&p.windowBits<16&&!(d&&d.windowBits)&&(p.windowBits+=32),p.windowBits>15&&p.windowBits<48&&(p.windowBits&15)===0&&(p.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var m=t.inflateInit2(this.strm,p.windowBits);if(m!==i.Z_OK)throw new Error(n[m]);if(this.header=new a,t.inflateGetHeader(this.strm,this.header),p.dictionary&&(typeof p.dictionary=="string"?p.dictionary=r.string2buf(p.dictionary):l.call(p.dictionary)==="[object ArrayBuffer]"&&(p.dictionary=new Uint8Array(p.dictionary)),p.raw&&(m=t.inflateSetDictionary(this.strm,p.dictionary),m!==i.Z_OK)))throw new Error(n[m])}c.prototype.push=function(d,p){var m=this.strm,g=this.options.chunkSize,y=this.options.dictionary,b,P,T,I,C,E=!1;if(this.ended)return!1;P=p===~~p?p:p===!0?i.Z_FINISH:i.Z_NO_FLUSH,typeof d=="string"?m.input=r.binstring2buf(d):l.call(d)==="[object ArrayBuffer]"?m.input=new Uint8Array(d):m.input=d,m.next_in=0,m.avail_in=m.input.length;do{if(m.avail_out===0&&(m.output=new e.Buf8(g),m.next_out=0,m.avail_out=g),b=t.inflate(m,i.Z_NO_FLUSH),b===i.Z_NEED_DICT&&y&&(b=t.inflateSetDictionary(this.strm,y)),b===i.Z_BUF_ERROR&&E===!0&&(b=i.Z_OK,E=!1),b!==i.Z_STREAM_END&&b!==i.Z_OK)return this.onEnd(b),this.ended=!0,!1;m.next_out&&(m.avail_out===0||b===i.Z_STREAM_END||m.avail_in===0&&(P===i.Z_FINISH||P===i.Z_SYNC_FLUSH))&&(this.options.to==="string"?(T=r.utf8border(m.output,m.next_out),I=m.next_out-T,C=r.buf2string(m.output,T),m.next_out=I,m.avail_out=g-I,I&&e.arraySet(m.output,m.output,T,I,0),this.onData(C)):this.onData(e.shrinkBuf(m.output,m.next_out))),m.avail_in===0&&m.avail_out===0&&(E=!0)}while((m.avail_in>0||m.avail_out===0)&&b!==i.Z_STREAM_END);return b===i.Z_STREAM_END&&(P=i.Z_FINISH),P===i.Z_FINISH?(b=t.inflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===i.Z_OK):(P===i.Z_SYNC_FLUSH&&(this.onEnd(i.Z_OK),m.avail_out=0),!0)},c.prototype.onData=function(d){this.chunks.push(d)},c.prototype.onEnd=function(d){d===i.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=e.flattenChunks(this.chunks)),this.chunks=[],this.err=d,this.msg=this.strm.msg};function h(d,p){var m=new c(p);if(m.push(d,!0),m.err)throw m.msg||n[m.err];return m.result}function u(d,p){return p=p||{},p.raw=!0,h(d,p)}o.Inflate=c,o.inflate=h,o.inflateRaw=u,o.ungzip=h}),bQe=Nn((o,t)=>{"use strict";var e=H_().assign,r=dQe(),i=yQe(),n=xRe(),s={};e(s,r,i,n),t.exports=s}),PQe=Nn(o=>{"use strict";var t=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",e=bQe(),r=u0(),i=UT(),n=t?"uint8array":"array";o.magic="\b\0";function s(a,l){i.call(this,"FlateWorker/"+a),this._pako=null,this._pakoAction=a,this._pakoOptions=l,this.meta={}}r.inherits(s,i),s.prototype.processChunk=function(a){this.meta=a.meta,this._pako===null&&this._createPako(),this._pako.push(r.transformTo(n,a.data),!1)},s.prototype.flush=function(){i.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},s.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this._pako=null},s.prototype._createPako=function(){this._pako=new e[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var a=this;this._pako.onData=function(l){a.push({data:l,meta:a.meta})}},o.compressWorker=function(a){return new s("Deflate",a)},o.uncompressWorker=function(){return new s("Inflate",{})}}),RRe=Nn(o=>{"use strict";var t=UT();o.STORE={magic:"\0\0",compressWorker:function(){return new t("STORE compression")},uncompressWorker:function(){return new t("STORE decompression")}},o.DEFLATE=PQe()}),DRe=Nn(o=>{"use strict";o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"}),TQe=Nn((o,t)=>{"use strict";var e=u0(),r=UT(),i=wH(),n=_ye(),s=DRe(),a=function(m,g){var y="",b;for(b=0;b<g;b++)y+=String.fromCharCode(m&255),m=m>>>8;return y},l=function(m,g){var y=m;return m||(y=g?16893:33204),(y&65535)<<16},c=function(m){return(m||0)&63},h=function(m,g,y,b,P,T){var I=m.file,C=m.compression,E=T!==i.utf8encode,O=e.transformTo("string",T(I.name)),_=e.transformTo("string",i.utf8encode(I.name)),x=I.comment,v=e.transformTo("string",T(x)),D=e.transformTo("string",i.utf8encode(x)),w=_.length!==I.name.length,F=D.length!==x.length,H,z,V="",W="",L="",k=I.dir,N=I.date,U={crc32:0,compressedSize:0,uncompressedSize:0};(!g||y)&&(U.crc32=m.crc32,U.compressedSize=m.compressedSize,U.uncompressedSize=m.uncompressedSize);var B=0;g&&(B|=8),!E&&(w||F)&&(B|=2048);var G=0,Y=0;k&&(G|=16),P==="UNIX"?(Y=798,G|=l(I.unixPermissions,k)):(Y=20,G|=c(I.dosPermissions,k)),H=N.getUTCHours(),H=H<<6,H=H|N.getUTCMinutes(),H=H<<5,H=H|N.getUTCSeconds()/2,z=N.getUTCFullYear()-1980,z=z<<4,z=z|N.getUTCMonth()+1,z=z<<5,z=z|N.getUTCDate(),w&&(W=a(1,1)+a(n(O),4)+_,V+="up"+a(W.length,2)+W),F&&(L=a(1,1)+a(n(v),4)+D,V+="uc"+a(L.length,2)+L);var X="";X+=`
\0`,X+=a(B,2),X+=C.magic,X+=a(H,2),X+=a(z,2),X+=a(U.crc32,4),X+=a(U.compressedSize,4),X+=a(U.uncompressedSize,4),X+=a(O.length,2),X+=a(V.length,2);var K=s.LOCAL_FILE_HEADER+X+O+V,J=s.CENTRAL_FILE_HEADER+a(Y,2)+X+a(v.length,2)+"\0\0\0\0"+a(G,4)+a(b,4)+O+V+v;return{fileRecord:K,dirRecord:J}},u=function(m,g,y,b,P){var T="",I=e.transformTo("string",P(b));return T=s.CENTRAL_DIRECTORY_END+"\0\0\0\0"+a(m,2)+a(m,2)+a(g,4)+a(y,4)+a(I.length,2)+I,T},d=function(m){var g="";return g=s.DATA_DESCRIPTOR+a(m.crc32,4)+a(m.compressedSize,4)+a(m.uncompressedSize,4),g};function p(m,g,y,b){r.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=y,this.encodeFileName=b,this.streamFiles=m,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}e.inherits(p,r),p.prototype.push=function(m){var g=m.meta.percent||0,y=this.entriesCount,b=this._sources.length;this.accumulate?this.contentBuffer.push(m):(this.bytesWritten+=m.data.length,r.prototype.push.call(this,{data:m.data,meta:{currentFile:this.currentFile,percent:y?(g+100*(y-b-1))/y:100}}))},p.prototype.openedSource=function(m){this.currentSourceOffset=this.bytesWritten,this.currentFile=m.file.name;var g=this.streamFiles&&!m.file.dir;if(g){var y=h(m,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:y.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(m){this.accumulate=!1;var g=this.streamFiles&&!m.file.dir,y=h(m,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(y.dirRecord),g)this.push({data:d(m),meta:{percent:100}});else for(this.push({data:y.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var m=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var y=this.bytesWritten-m,b=u(this.dirRecords.length,y,m,this.zipComment,this.encodeFileName);this.push({data:b,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(m){this._sources.push(m);var g=this;return m.on("data",function(y){g.processChunk(y)}),m.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),m.on("error",function(y){g.error(y)}),this},p.prototype.resume=function(){if(!r.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0},p.prototype.error=function(m){var g=this._sources;if(!r.prototype.error.call(this,m))return!1;for(var y=0;y<g.length;y++)try{g[y].error(m)}catch{}return!0},p.prototype.lock=function(){r.prototype.lock.call(this);for(var m=this._sources,g=0;g<m.length;g++)m[g].lock()},t.exports=p}),IQe=Nn(o=>{"use strict";var t=RRe(),e=TQe(),r=function(i,n){var s=i||n,a=t[s];if(!a)throw new Error(s+" is not a valid compression method !");return a};o.generateWorker=function(i,n,s){var a=new e(n.streamFiles,s,n.platform,n.encodeFileName),l=0;try{i.forEach(function(c,h){l++;var u=r(h.options.compression,n.compression),d=h.options.compressionOptions||n.compressionOptions||{},p=h.dir,m=h.date;h._compressWorker(u,d).withStreamInfo("file",{name:c,dir:p,date:m,comment:h.comment||"",unixPermissions:h.unixPermissions,dosPermissions:h.dosPermissions}).pipe(a)}),a.entriesCount=l}catch(c){a.error(c)}return a}}),CQe=Nn((o,t)=>{"use strict";var e=u0(),r=UT();function i(n,s){r.call(this,"Nodejs stream input adapter for "+n),this._upstreamEnded=!1,this._bindStream(s)}e.inherits(i,r),i.prototype._bindStream=function(n){var s=this;this._stream=n,n.pause(),n.on("data",function(a){s.push({data:a,meta:{percent:0}})}).on("error",function(a){s.isPaused?this.generatedError=a:s.error(a)}).on("end",function(){s.isPaused?s._upstreamEnded=!0:s.end()})},i.prototype.pause=function(){return r.prototype.pause.call(this)?(this._stream.pause(),!0):!1},i.prototype.resume=function(){return r.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1},t.exports=i}),SQe=Nn((o,t)=>{"use strict";var e=wH(),r=u0(),i=UT(),n=IRe(),s=CRe(),a=vye(),l=cQe(),c=IQe(),h=KZ(),u=CQe(),d=function(P,T,I){var C=r.getTypeOf(T),E,O=r.extend(I||{},s);O.date=O.date||new Date,O.compression!==null&&(O.compression=O.compression.toUpperCase()),typeof O.unixPermissions=="string"&&(O.unixPermissions=parseInt(O.unixPermissions,8)),O.unixPermissions&&O.unixPermissions&16384&&(O.dir=!0),O.dosPermissions&&O.dosPermissions&16&&(O.dir=!0),O.dir&&(P=m(P)),O.createFolders&&(E=p(P))&&g.call(this,E,!0);var _=C==="string"&&O.binary===!1&&O.base64===!1;(!I||typeof I.binary>"u")&&(O.binary=!_);var x=T instanceof a&&T.uncompressedSize===0;(x||O.dir||!T||T.length===0)&&(O.base64=!1,O.binary=!0,T="",O.compression="STORE",C="string");var v=null;T instanceof a||T instanceof i?v=T:h.isNode&&h.isStream(T)?v=new u(P,T):v=r.prepareContent(P,T,O.binary,O.optimizedBinaryString,O.base64);var D=new l(P,v,O);this.files[P]=D},p=function(P){P.slice(-1)==="/"&&(P=P.substring(0,P.length-1));var T=P.lastIndexOf("/");return T>0?P.substring(0,T):""},m=function(P){return P.slice(-1)!=="/"&&(P+="/"),P},g=function(P,T){return T=typeof T<"u"?T:s.createFolders,P=m(P),this.files[P]||d.call(this,P,null,{dir:!0,createFolders:T}),this.files[P]};function y(P){return Object.prototype.toString.call(P)==="[object RegExp]"}var b={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(P){var T,I,C;for(T in this.files)C=this.files[T],I=T.slice(this.root.length,T.length),I&&T.slice(0,this.root.length)===this.root&&P(I,C)},filter:function(P){var T=[];return this.forEach(function(I,C){P(I,C)&&T.push(C)}),T},file:function(P,T,I){if(arguments.length===1)if(y(P)){var C=P;return this.filter(function(O,_){return!_.dir&&C.test(O)})}else{var E=this.files[this.root+P];return E&&!E.dir?E:null}else P=this.root+P,d.call(this,P,T,I);return this},folder:function(P){if(!P)return this;if(y(P))return this.filter(function(E,O){return O.dir&&P.test(E)});var T=this.root+P,I=g.call(this,T),C=this.clone();return C.root=I.name,C},remove:function(P){P=this.root+P;var T=this.files[P];if(T||(P.slice(-1)!=="/"&&(P+="/"),T=this.files[P]),T&&!T.dir)delete this.files[P];else for(var I=this.filter(function(E,O){return O.name.slice(0,P.length)===P}),C=0;C<I.length;C++)delete this.files[I[C].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(P){var T,I={};try{if(I=r.extend(P||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:e.utf8encode}),I.type=I.type.toLowerCase(),I.compression=I.compression.toUpperCase(),I.type==="binarystring"&&(I.type="string"),!I.type)throw new Error("No output type specified.");r.checkSupport(I.type),(I.platform==="darwin"||I.platform==="freebsd"||I.platform==="linux"||I.platform==="sunos")&&(I.platform="UNIX"),I.platform==="win32"&&(I.platform="DOS");var C=I.comment||this.comment||"";T=c.generateWorker(this,I,C)}catch(E){T=new i("error"),T.error(E)}return new n(T,I.type||"string",I.mimeType)},generateAsync:function(P,T){return this.generateInternalStream(P).accumulate(T)},generateNodeStream:function(P,T){return P=P||{},P.type||(P.type="nodebuffer"),this.generateInternalStream(P).toNodejsStream(T)}};t.exports=b}),wRe=Nn((o,t)=>{"use strict";var e=u0();function r(i){this.data=i,this.length=i.length,this.index=0,this.zero=0}r.prototype={checkOffset:function(i){this.checkIndex(this.index+i)},checkIndex:function(i){if(this.length<this.zero+i||i<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+i+"). Corrupted zip ?")},setIndex:function(i){this.checkIndex(i),this.index=i},skip:function(i){this.setIndex(this.index+i)},byteAt:function(){},readInt:function(i){var n=0,s;for(this.checkOffset(i),s=this.index+i-1;s>=this.index;s--)n=(n<<8)+this.byteAt(s);return this.index+=i,n},readString:function(i){return e.transformTo("string",this.readData(i))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var i=this.readInt(4);return new Date(Date.UTC((i>>25&127)+1980,(i>>21&15)-1,i>>16&31,i>>11&31,i>>5&63,(i&31)<<1))}},t.exports=r}),LRe=Nn((o,t)=>{"use strict";var e=wRe(),r=u0();function i(n){e.call(this,n);for(var s=0;s<this.data.length;s++)n[s]=n[s]&255}r.inherits(i,e),i.prototype.byteAt=function(n){return this.data[this.zero+n]},i.prototype.lastIndexOfSignature=function(n){for(var s=n.charCodeAt(0),a=n.charCodeAt(1),l=n.charCodeAt(2),c=n.charCodeAt(3),h=this.length-4;h>=0;--h)if(this.data[h]===s&&this.data[h+1]===a&&this.data[h+2]===l&&this.data[h+3]===c)return h-this.zero;return-1},i.prototype.readAndCheckSignature=function(n){var s=n.charCodeAt(0),a=n.charCodeAt(1),l=n.charCodeAt(2),c=n.charCodeAt(3),h=this.readData(4);return s===h[0]&&a===h[1]&&l===h[2]&&c===h[3]},i.prototype.readData=function(n){if(this.checkOffset(n),n===0)return[];var s=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,s},t.exports=i}),EQe=Nn((o,t)=>{"use strict";var e=wRe(),r=u0();function i(n){e.call(this,n)}r.inherits(i,e),i.prototype.byteAt=function(n){return this.data.charCodeAt(this.zero+n)},i.prototype.lastIndexOfSignature=function(n){return this.data.lastIndexOf(n)-this.zero},i.prototype.readAndCheckSignature=function(n){var s=this.readData(4);return n===s},i.prototype.readData=function(n){this.checkOffset(n);var s=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,s},t.exports=i}),MRe=Nn((o,t)=>{"use strict";var e=LRe(),r=u0();function i(n){e.call(this,n)}r.inherits(i,e),i.prototype.readData=function(n){if(this.checkOffset(n),n===0)return new Uint8Array(0);var s=this.data.subarray(this.zero+this.index,this.zero+this.index+n);return this.index+=n,s},t.exports=i}),OQe=Nn((o,t)=>{"use strict";var e=MRe(),r=u0();function i(n){e.call(this,n)}r.inherits(i,e),i.prototype.readData=function(n){this.checkOffset(n);var s=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,s},t.exports=i}),NRe=Nn((o,t)=>{"use strict";var e=u0(),r=U_(),i=LRe(),n=EQe(),s=OQe(),a=MRe();t.exports=function(l){var c=e.getTypeOf(l);return e.checkSupport(c),c==="string"&&!r.uint8array?new n(l):c==="nodebuffer"?new s(l):r.uint8array?new a(e.transformTo("uint8array",l)):new i(e.transformTo("array",l))}}),AQe=Nn((o,t)=>{"use strict";var e=NRe(),r=u0(),i=vye(),n=_ye(),s=wH(),a=RRe(),l=U_(),c=0,h=3,u=function(p){for(var m in a)if(Object.prototype.hasOwnProperty.call(a,m)&&a[m].magic===p)return a[m];return null};function d(p,m){this.options=p,this.loadOptions=m}d.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function(p){var m,g;if(p.skip(22),this.fileNameLength=p.readInt(2),g=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(g),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(m=u(this.compressionMethod),m===null)throw new Error("Corrupted zip : compression "+r.pretty(this.compressionMethod)+" unknown (inner file : "+r.transformTo("string",this.fileName)+")");this.decompressed=new i(this.compressedSize,this.uncompressedSize,this.crc32,m,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var m=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(m),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(this.externalFileAttributes&16),p===c&&(this.dosPermissions=this.externalFileAttributes&63),p===h&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=e(this.extraFields[1].value);this.uncompressedSize===r.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var m=p.index+this.extraFieldsLength,g,y,b;for(this.extraFields||(this.extraFields={});p.index+4<m;)g=p.readInt(2),y=p.readInt(2),b=p.readData(y),this.extraFields[g]={id:g,length:y,value:b};p.setIndex(m)},handleUTF8:function(){var p=l.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=s.utf8decode(this.fileName),this.fileCommentStr=s.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var g=r.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(g)}var y=this.findExtraFieldUnicodeComment();if(y!==null)this.fileCommentStr=y;else{var b=r.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(b)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var m=e(p.value);return m.readInt(1)!==1||n(this.fileName)!==m.readInt(4)?null:s.utf8decode(m.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var m=e(p.value);return m.readInt(1)!==1||n(this.fileComment)!==m.readInt(4)?null:s.utf8decode(m.readData(p.length-5))}return null}},t.exports=d}),_Qe=Nn((o,t)=>{"use strict";var e=NRe(),r=u0(),i=DRe(),n=AQe(),s=U_();function a(l){this.files=[],this.loadOptions=l}a.prototype={checkSignature:function(l){if(!this.reader.readAndCheckSignature(l)){this.reader.index-=4;var c=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+r.pretty(c)+", expected "+r.pretty(l)+")")}},isSignature:function(l,c){var h=this.reader.index;this.reader.setIndex(l);var u=this.reader.readString(4),d=u===c;return this.reader.setIndex(h),d},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var l=this.reader.readData(this.zipCommentLength),c=s.uint8array?"uint8array":"array",h=r.transformTo(c,l);this.zipComment=this.loadOptions.decodeFileName(h)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var l=this.zip64EndOfCentralSize-44,c=0,h,u,d;c<l;)h=this.reader.readInt(2),u=this.reader.readInt(4),d=this.reader.readData(u),this.zip64ExtensibleData[h]={id:h,length:u,value:d}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var l,c;for(l=0;l<this.files.length;l++)c=this.files[l],this.reader.setIndex(c.localHeaderOffset),this.checkSignature(i.LOCAL_FILE_HEADER),c.readLocalPart(this.reader),c.handleUTF8(),c.processAttributes()},readCentralDir:function(){var l;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(i.CENTRAL_FILE_HEADER);)l=new n({zip64:this.zip64},this.loadOptions),l.readCentralPart(this.reader),this.files.push(l);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var l=this.reader.lastIndexOfSignature(i.CENTRAL_DIRECTORY_END);if(l<0){var c=!this.isSignature(0,i.LOCAL_FILE_HEADER);throw c?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex(l);var h=l;if(this.checkSignature(i.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===r.MAX_VALUE_16BITS||this.diskWithCentralDirStart===r.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===r.MAX_VALUE_16BITS||this.centralDirRecords===r.MAX_VALUE_16BITS||this.centralDirSize===r.MAX_VALUE_32BITS||this.centralDirOffset===r.MAX_VALUE_32BITS){if(this.zip64=!0,l=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR),l<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(l),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,i.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var u=this.centralDirOffset+this.centralDirSize;this.zip64&&(u+=20,u+=12+this.zip64EndOfCentralSize);var d=h-u;if(d>0)this.isSignature(h,i.CENTRAL_FILE_HEADER)||(this.reader.zero=d);else if(d<0)throw new Error("Corrupted zip: missing "+Math.abs(d)+" bytes.")},prepareReader:function(l){this.reader=e(l)},load:function(l){this.prepareReader(l),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=a}),vQe=Nn((o,t)=>{"use strict";var e=u0(),r=DH(),i=wH(),n=_Qe(),s=ERe(),a=KZ();function l(c){return new r.Promise(function(h,u){var d=c.decompressed.getContentWorker().pipe(new s);d.on("error",function(p){u(p)}).on("end",function(){d.streamInfo.crc32!==c.decompressed.crc32?u(new Error("Corrupted zip : CRC32 mismatch")):h()}).resume()})}t.exports=function(c,h){var u=this;return h=e.extend(h||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:i.utf8decode}),a.isNode&&a.isStream(c)?r.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):e.prepareContent("the loaded zip file",c,!0,h.optimizedBinaryString,h.base64).then(function(d){var p=new n(h);return p.load(d),p}).then(function(d){var p=[r.Promise.resolve(d)],m=d.files;if(h.checkCRC32)for(var g=0;g<m.length;g++)p.push(l(m[g]));return r.Promise.all(p)}).then(function(d){for(var p=d.shift(),m=p.files,g=0;g<m.length;g++){var y=m[g],b=y.fileNameStr,P=e.resolve(y.fileNameStr);u.file(P,y.decompressed,{binary:!0,optimizedBinaryString:!0,date:y.date,dir:y.dir,comment:y.fileCommentStr.length?y.fileCommentStr:null,unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions,createFolders:h.createFolders}),y.dir||(u.file(P).unsafeOriginalName=b)}return p.zipComment.length&&(u.comment=p.zipComment),u})}}),kRe=Nn((o,t)=>{"use strict";function e(){if(!(this instanceof e))return new e;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var r=new e;for(var i in this)typeof this[i]!="function"&&(r[i]=this[i]);return r}}e.prototype=SQe(),e.prototype.loadAsync=vQe(),e.support=U_(),e.defaults=CRe(),e.version="3.10.1",e.loadAsync=function(r,i){return new e().loadAsync(r,i)},e.external=DH(),t.exports=e}),BRe=class{constructor(o,t=null){if(this.outNum=0,t&&o.length!==t.length)throw new Error("The length of vertexes and normals is not equal!");if(o.length===0)throw new Error("The length of vertexes can't be 0!");o instanceof Float32Array?(this.vertexes=o,this.vertexNum=o.length/3):(this.vertexes=this.createArray(o),this.vertexNum=o.length),t instanceof Float32Array?this.normals=t:t&&(this.normals=this.createArray(t))}hasNormals(){return!!this.normals}iterVertexes(o){for(let t=0;t<this.vertexes.length;t+=3)o(new Dt(this.vertexes[t],this.vertexes[t+1],this.vertexes[t+2]))}iterVertexesNormals(o,t){for(let e=0;e<this.vertexes.length;e+=3)o(new Dt(this.vertexes[e],this.vertexes[e+1],this.vertexes[e+2])),t(new Dt(this.normals[e],this.normals[e+1],this.normals[e+2]))}createArray(o){let t=new Float32Array(o.length*3),e=0;for(let r of o)t[e++]=r.x,t[e++]=r.y,t[e++]=r.z;return t}incOut(){this.outNum++}decOut(){this.outNum--,this.outNum===0&&(this.vertexBuf.destroy(),this.normalsBuf.destroy())}getData(o,t){}getVertexBuf(o){return this.vertexBuf||(this.vertexBuf=o.createDynamicBuffer(this.vertexes.length,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,"vertexBuf of Elements"),this.vertexBuf.write(0,this.vertexes)),this.vertexBuf}getNormalsBuf(o){var t,e;return this.normalsBuf||(this.normalsBuf=o.createDynamicBuffer(((t=this.normals)==null?void 0:t.length)||this.vertexes.length,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,"normalsBuf of Elements"),(e=this.normals)!=null&&e.length&&this.normalsBuf.write(0,this.normals),delete this.normals,delete this.vertexes),this.normalsBuf}getBBox(){if(!this.bbox){let o=new mm;for(let t=0;t<this.vertexes.length;t+=3)o.ext2(this.vertexes[t],this.vertexes[t+1],this.vertexes[t+2]);this.bbox=o.build()}return this.bbox}},xQe=class extends BRe{constructor(o,t=null){if(super(o,t),!Number.isInteger(this.vertexes.length/6))throw new Error("The length of vertexs is not a multiple of 2!")}},RQe=class extends BRe{constructor(o,t=null){if(super(o,t),!Number.isInteger(this.vertexes.length/9))throw new Error("The length of vertexs is not a multiple of 3!")}};function DQe(o){let t=o.toString(2),e=32-t.length;return e>0?"0".repeat(e)+t:t}var Xm=class FRe{constructor(t,e=null){this.marked=0,this.emptyStart=0,this.max=-1,this.size=t,this.index=new Uint32Array(Math.ceil(t/32)),e&&(this.index.set(e.index),this.marked=e.marked,this.emptyStart=e.emptyStart,this.max=e.max,this.trimListeners=e.trimListeners)}extSize(t){return new FRe(t,this)}isEmpty(){return this.marked===0}getMarked(){return this.marked}getChunk(t){return this.index[t]}isUsed(t){let e=t/32|0,r=this.index[e];return r===4294967295?!0:r===0?!1:(r>>31-t&1)===1}markUsed(t){let e=t/32|0,r=this.index[e],i=1<<31-t;(r&i)===0&&(this.index[e]=r|i,this.marked++),t>this.max&&(this.max=t)}markRemove(t){var e;let r=t/32|0,i=this.index[r],n=1<<31-t;if((i&n)!==0&&(this.index[r]=i&(4294967295^n),this.marked--,t<this.emptyStart&&(this.emptyStart=t),t===this.max)){if(i=this.index[r],i!==0)for(this.max--;(i&1<<31-this.max)===0;)this.max--;else{for(i=this.index[--r];i===0;)i=this.index[--r];if(i===void 0)this.max=-1;else for(this.max=r*32+31;(i&1<<31-this.max)===0;)this.max--}(e=this.trimListeners)==null||e.forEach(s=>s(this.max+1))}}addTrimListener(t){this.trimListeners||(this.trimListeners=new Set),this.trimListeners.add(t)}deleteTrimListener(t){this.trimListeners.delete(t)}reset(){this.index.fill(0),this.marked=0,this.emptyStart=0,this.max=-1}findEmpty(t=1){if(this.size-this.marked<t)return-1;if(this.size-this.max-1>=t)return this.max+1;let e=this.index,r=-1,i=!1;for(let n=Math.floor(this.emptyStart/32);n<e.length;n++){let s=e[n];if(s===0){if(r===-1){if(r=n*32,i||(this.emptyStart=r,i=!0),t<=32)return r}else if((n+1)*32-r>=t)return r}else if(s!==4294967295)for(let a=31;a>=0;a--)if((s>>a&1)===0){let l=n*32+31-a;if(r===-1&&(r=l,i||(this.emptyStart=r,i=!0)),l-r+1>=t)return r}else r=-1;else r=-1}return-1}hasNEmpty(t=1){return this.size-this.marked>=t}findNEmpty(t=1){let e=[];if(this.size-this.marked<t)return e;if(this.size-this.max-1>=t){let i=this.max+t;for(let n=this.max+1;n<=i;n++)e.push(n);return e}let r=this.index;for(let i=Math.floor(this.emptyStart/32);i<r.length;i++){if(this.marked+e.length===i*32){for(let s=i*32;e.length!==t;s++)e.push(s);return this.emptyStart=e[0],e}let n=r[i];if(n===0){let s=i*32;if(e.indexOf(s)==-1){if(e.push(s),e.length>=t)return this.emptyStart=e[0],e;{let a=t-e.length;if(a<32){for(let l=0;l<a;l++)e.push(s+l+1);return this.emptyStart=e[0],e}else for(let l=0;l<31;l++)e.push(s+l+1)}}}else if(n!==4294967295){for(let s=31;s>=0;s--)if((n>>s&1)===0){let a=i*32+31-s;if(e.indexOf(a)==-1&&(e.push(a),e.length==t))return this.emptyStart=e[0],e}}}return this.emptyStart=e.length===0?this.size:e[0],[]}getMax(){return this.max}debug(){let t=[],e=this.index;for(let r=0;r<e.length;r++)t.push(DQe(e[r]));console.log(t.join(" "))}},uve={mil:1,inch:1e3,ft:12e3,yard:36e3,mile:6336e4,km:3937007874e-2,dm:3937,mm:39.37,um:.039,nm:394e-7,pt:13.88888888888889,"px(72)":13.88888888888889,"px(96)":10.416666666666666,"px(100)":10},jMt=(()=>{let o={};for(let t in uve)o[uve[t]]=t;return o})(),dve=class{constructor(t,e){this.ratio=t/e}wrap(t){return t*this.ratio}static convert(t,e,r){return t*e/r}};dve.ASIS=new dve(1,1);var Aw=class{conversion(o,t,e){if(o===t)return e;let r=o+2+t;return this[r](e)}conversion1(o,t,e){let r=o+2+t,i=this[r](e);return t=="mil"?Math.round(i*10)/10:Math.round(i*1e3)/1e3}mil2mil(o){return o}mil2mm(o){return o*.0254}mil2cm(o){return o*.00254}mil2inch(o){return o/1e3}mm2mm(o){return o}mm2mil(o){let t=Math.pow(10,5);return Math.round(o*39.37007874015748*t)/t}mm2cm(o){return o/10}mm2inch(o){let t=Math.pow(10,8);return Math.round(o*.03937007874015748*t)/t}cm2mil(o){let t=Math.pow(10,6);return Math.round(o*393.7007874015748*t)/t}cm2mm(o){return o*10}cm2inch(o){let t=Math.pow(10,7);return Math.round(o*.3937007874015748*t)/t}inch2mil(o){return o*1e3}inch2mm(o){return o*25.4}inch2cm(o){return o*2.54}};Aw.prototype["px(100)2mil"]=o=>o*10;Aw.prototype["px(100)2mm"]=o=>o*.254;Aw.prototype["mil2px(100)"]=o=>o/10;Aw.prototype["mm2px(100)"]=o=>{let t=Math.pow(10,5);return Math.round(o*3.937007874015748*t)/t};var MK=null,Rye=new ArrayBuffer(8),zge=new Float64Array(Rye),Yge=new Uint32Array(Rye),pve=new Uint16Array(Rye),Zs=Math.PI*2,GT=Math.PI/2,MZ=class{static repeat(o,t){let e=new Array(t);for(;t-- >0;)e[t]=o;return e.join("")}static lpad(o,t,e){let r=e-o.length;return r>0?this.repeat(t,r)+o:o}static rpad(o,t,e){let r=e-o.length;return r>0?o+this.repeat(t,r):o}static strHashcode(o){if(o.length>0){let t=0;for(let e=0;e<o.length;e++)t=31*t+o.charCodeAt(e)|0;return t}else return 0}static arraycopy(o,t,e,r,i){if(o.length>=t+i&&e.length>=r+i)for(;i-- >0;)e[r++]=o[t++];else throw new Error("arraycopy out of range")}static undefAsNull(o){return null}static reverse(o,t){for(let e=0,r=o.length-1;r>=0;e++,r--)t[e]=o[r];return t}static sortAsc(o,t){return o-t}static xmlDecode(o){let t=o.length,e=new Array,r=-1;for(let i=0;i<t;i++){let n=o.charAt(i);if(r>=0){if(n===";"){let s=o.substring(r+1,i);switch(s){case"lt":e.push("<");break;case"gt":e.push(">");break;case"quot":e.push('"');break;case"apos":e.push("'");break;case"amp":e.push("&");break;default:if(s.charAt(0)==="#"){let a=parseInt(s.substring(1));e.push(String.fromCharCode(a))}else e.push("&"+s+";")}r=-1}}else n==="&"?r=i:e.push(n)}return r>=0&&e.push(o.substring(r)),e.join("")}static addAll(o,t){for(let e of t)o.push(e)}static addAllSet(o,t){for(let e of t)o.add(e)}static contains(o,t){for(let e of o)if(e.equals(t))return!0;return!1}static equals(o,t){if(o.length==t.length){for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}else return!1}static remove(o,t){let e=0,r=o.length;for(let i=0;i<r;i++)o[i]===t&&(o.splice(i,1),i--,r--,e++);return e}static getUrlVars(){for(var o={},t=location.href.slice(location.href.indexOf("?")+1).split("&"),e=0;e<t.length;e++){var r=t[e].split("=");o[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return o}static prefix(){if(!MK){let o=this.getUrlVars().version;o?MK="/analyzer/v"+o:MK="/analyzer"}return MK}static add2objS(o,t,e){if(t in o)return o[t];{let r=e(t);return o[t]=r,r}}static downloadFile(o,t){let e=document.createElement("a"),r=URL.createObjectURL(t);e.download=o,e.href=r,e.click(),URL.revokeObjectURL(r)}static uuid(){let o=new Array;zge[0]=new Date().getTime(),o.push(Yge[1].toString(16)),zge[0]=Math.random(),o.push(pve[3].toString(16));let t=pve[2].toString(16);o.push("4"+t.substr(0,3)),zge[0]=performance.now();let e=Yge[0].toString(16)+Yge[1].toString(16);return o.push("0"+e.substr(0,3)),o.push(e.substr(3)),o.join("-")}static funcCopy(o){return(0,eval)("("+o.toString()+")")}static NVL(...o){for(let t of o)if(t!==null)return t;return null}static isSingle(o){return Array.from(new Set(o)).length===o.length}},wQe=[1,10,100,1e3];function fve(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=wQe[t]||Math.pow(10,t)||10;if(e){var i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(i+o)}else return Math.round(o*r+1e-10)/r}function LQe(o,t={},...e){t=Object.assign({color:"#75de75","font-style":"italic","background-color":"#333",padding:"2px","font-size":"16px"},t),o.includes("%c")||(o="%c "+o),console.log(o,JSON.stringify(t).replace(/[\"\{\}]/g,"").replace(/,/g,";"),...e)}function MQe(){if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof globalThis<"u")return globalThis;if(typeof global<"u")return global}function NK(o,t){return Math.abs(o-t)<=1e-4}var NQe=/(\.?0+)$/,kK=class{static format(o,...t){return this.format1(o,t)}static format1(o,t){let e=this._format(o,t);if(typeof e=="string")return e;throw new Error(this.format("Invalid state on (%d) %s",e,o))}static _format(o,t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l),h=c.charCodeAt(0);switch(r){case 0:h===37?r=1:e.push(c);break;case 1:switch(h){case 100:if(n=t[i++],typeof n=="number")e.push(n.toFixed(0)),r=0;else return l;break;case 102:if(n=t[i++],typeof n=="number")e.push(n.toString()),r=0;else return l;break;case 120:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16)),r=0;else return l;break;case 88:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16).toUpperCase()),r=0;else return l;break;case 115:case 99:n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case 48:s=l+1,a=-1,r=2;break;case 37:e.push("%"),r=0;break;default:return l}break;case 2:switch(h){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a=l;break;case 120:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(MZ.lpad((n|0).toString(16),"0",u)),r=0;else return l}else return l;break;case 88:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(MZ.lpad((n|0).toString(16).toUpperCase(),"0",u)),r=0;else return l}else return l;break;default:return l}break;default:return l}}return e.join("")}static startsWith(o,t){return o.length>=t.length?o.substring(0,t.length)===t:!1}static endsWith(o,t){return o.length>=t.length?o.substring(o.length-t.length)===t:!1}static split(o,t){let e=new Array,r=0;for(;;){let i=o.exec(t);if(i!==null){let n=o.lastIndex-i[0].length;e.push(t.substring(r,n)),r=o.lastIndex}else{let n=t.substring(r);U7.nullOrEmpty(n)||e.push(n);break}}return e}static fmtNumber(o){return o.toFixed(5).replace(NQe,"")}},U7=class{static rgb(o){if(0<=o&&o<=255)return o;throw new Error(kK.format("RGB should not nagative and not over 255(0xFF): %X",o))}static normal(o){if(isFinite(o))return o;throw new Error(kK.format("%f is not permitted",o))}static positiveOr0(o){if(o>=0)return o;throw new Error(kK.format("%f must >= 0",o))}static positive(o){if(o>0)return o;throw new Error(kK.format("%f must > 0",o))}static notnull(o){if(o!=null)return o;throw new Error("invalid null value")}static mustnull(o){if(o===null)return null;throw new Error("value must be null")}static notEmpty(o){if(o==null||o.length===0)throw new Error("invalid empty string");return o}static nullOrEmpty(o){return o==null||o.length===0}static notNullOrUndef(o){if(o!=null)return o;throw new Error("null or undefined is not permitted")}},_c=class Y1{static build(t,e,r,i=1){let n=this.getHash(t,e,r,i),s=this._colorCache[n];return s||(s=new Y1(t,e,r,i),this._colorCache[n]=s),s}static getHash(t,e,r,i=1){return 31*(31*(31*t+e)+r)+i}static isHexFormate(t){return!t||typeof t!="string"?!1:/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)}static of1(t){return this.of2(t>>16&255,t>>8&255,t&255)}static of2(t,e,r,i=255){return Y1.build(t/255,e/255,r/255,i/255)}static of3(t){t.startsWith("#")&&(t=t.substr(1));let e=t.length;if(e==3)return Y1.build(parseInt(t[0],16)/15,parseInt(t[1],16)/15,parseInt(t[2],16)/15);if(e==6)return Y1.build(parseInt(t.substr(0,2),16)/255,parseInt(t.substr(2,2),16)/255,parseInt(t.substr(4,2),16)/255);if(e==8)return Y1.build(parseInt(t.substr(0,2),16)/255,parseInt(t.substr(2,2),16)/255,parseInt(t.substr(4,2),16)/255,parseInt(t.substr(6,2),16)/255);throw new Error("invalid color string")}static of4(t){let e=parseInt(t.r*255+"").toString(16),r=parseInt(t.g*255+"").toString(16),i=parseInt(t.b*255+"").toString(16);return e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),i.length<2&&(i="0"+i),("#"+e+r+i).toUpperCase()}static of5(t,e){if(t.startsWith("#")&&(t=t.substr(1)),t.length==3)return Y1.build(parseInt(t[0],16)/15,parseInt(t[1],16)/15,parseInt(t[2],16)/15,e);if(t.length==6)return Y1.build(parseInt(t.substr(0,2),16)/255,parseInt(t.substr(2,2),16)/255,parseInt(t.substr(4,2),16)/255,e);throw new Error("invalid color string")}static of6(t,e){return Y1.build(t.r,t.g,t.b,e)}static of7(t){return t==null?null:Y1.of3(t)}static ofNew(t){return Y1.build(t.r,t.g,t.b,t.alpha)}constructor(t,e,r,i=1){this.r=U7.positiveOr0(t),this.g=U7.positiveOr0(e),this.b=U7.positiveOr0(r),this.alpha=i}mulAlpha(t){return new Y1(this.r,this.g,this.b,this.alpha*t)}hashCode(){return Y1.getHash(this.r,this.g,this.b,this.alpha)}equals(t,e=!1){if(!t)return!1;let r=this.r===t.r&&this.g===t.g&&this.b===t.b;return e?r:r&&this.alpha===t.alpha}add(t,e,r,i){return Y1.build(Math.max(0,Math.min(1,this.r+t)),Math.max(0,Math.min(1,this.g+e)),Math.max(0,Math.min(1,this.b+r)),Math.max(0,Math.min(1,this.alpha+i)))}mul(t){return Y1.build(Math.max(0,Math.min(1,this.r*t)),Math.max(0,Math.min(1,this.g*t)),Math.max(0,Math.min(1,this.b*t)),this.alpha)}mul1(t){return Y1.build(Math.max(0,this.r*t),Math.max(0,this.g*t),Math.max(0,this.b*t),this.alpha)}getData(){return[this.r,this.g,this.b,this.alpha]}toString(){let t=(this.r*255).toString(16),e=(this.g*255).toString(16),r=(this.b*255).toString(16);return t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),"#"+t.substr(0,2)+e.substr(0,2)+r.substr(0,2)}toString1(){let t=(this.r*255).toString(16),e=(this.g*255).toString(16),r=(this.b*255).toString(16),i=(this.alpha*255).toString(16);return t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),i.length<2&&(i="0"+i),"#"+t.substr(0,2)+e.substr(0,2)+r.substr(0,2)+i.substr(0,2)}toRGBA(){let t=this.r*255,e=this.g*255,r=this.b*255;return[t,e,r,this.alpha]}toRGBAString(){let t=this.r*255,e=this.g*255,r=this.b*255;return`rgba(${t},${e},${r},${this.alpha})`}isWHITE(){return this.r===1&&this.g===1&&this.b===1&&this.alpha===1}toCSS(){return`rgba(${this.r*255}, ${this.g*255}, ${this.b*255}, ${this.alpha})`}};_c._colorCache={},_c.WHITE=_c.build(1,1,1,1),_c.BLACK=_c.build(0,0,0,1),_c.RED=_c.build(1,0,0,1),_c.GREEN=_c.build(0,1,0,1),_c.BLUE=_c.build(0,0,1,1),_c.Gray=_c.of3("#9966ff"),_c.Silver=_c.of3("#D2D2D2"),_c.Golden=_c.of3("#DCAA14"),_c.DefaultHighLightColor=_c.build(1,1,1,.5),_c.YELLOW=new _c(1,1,0,1),_c.PURPLE=new _c(1,0,1,1),_c.CYAN=new _c(0,1,1,1),_c.LightGray=_c.of3("#d9d9d9"),_c.ZERO=new _c(0,0,0,0),_c.ORANGE=_c.of3("#ffa500"),_c.AMARANTH=_c.of3("#ff00ff");var ee=_c,Js=10,K7=7,kQe=2**K7-1<<Js,ZMt=2**Js-1,cs=1<<Js+K7,TH=2**32-1-cs,Up=class{constructor(o,t,e){this.DataIndex=e,this.length=t,NZ[o]=t,VRe[o]=(r,i,n,s)=>this.getBBox(r,i,n,s),YRe[o]=(r,i)=>this.compare(r,i),GRe[o]=(r,i,n)=>this.getOrder(r,i,n),HRe[o]=(r,i,n)=>this.getGroupIdByBuilder(r,i,n),URe[o]=(r,i,n)=>this.getGroupId(r,i,n),WRe[o]=(r,i,n)=>this.getTemplateId(r,i,n),zRe[o]=(r,i,n)=>this.getColorIndex(r,i,n),jRe[o]=this,this.type=o}updateLength(o,t){this.length=o,NZ[t]=o}compare(o,t){if((o[0]&TH)!==(t[0]&TH))return!1;for(let e=1;e<this.length;e++)if(o[e]!==t[e])return!1;return!0}createBBox(o,t,e,r){let i=this.getBBox(o,t,e,r);return new ht(i.minX,i.maxX,i.minY,i.maxY)}getOrder(o,t,e){if(!this.DataIndex.ORDER)throw new Error("GetOrder error ");return o[t+this.DataIndex.ORDER]}getGroupIdByBuilder(o,t,e){if(!this.DataIndex.GROUP_ID)throw new Error("GetGroupId error ");return o.get(t+this.DataIndex.GROUP_ID)}getGroupId(o,t,e){if(!this.DataIndex.GROUP_ID)throw new Error("GetGroupId error ");return o[t+this.DataIndex.GROUP_ID]}getTemplateId(o,t,e){if(!this.DataIndex.TEMPLATE)throw new Error("GetTemplateId error ");return o[t+this.DataIndex.TEMPLATE]}getColorIndex(o,t,e){if(!this.DataIndex.COLOR_INDEX)throw new Error("GetColorIndex error ");return o[t+this.DataIndex.COLOR_INDEX]}},NZ=new Float64Array(70),VRe=[],GRe=[],URe=[],HRe=[],WRe=[],zRe=[],YRe=[],jRe=[],Fr={getType(o){return(o&kQe)>>Js},getPtLength(o){return NZ[Fr.getType(o)]},getBBox(o,t,e,r){return VRe[Fr.getType(o[t])](o,t,e,r)},compare(o,t){return YRe[Fr.getType(o[0])](o,t)},getPtLengthByType(o){return NZ[o]},getTool(o){return jRe[o]},isPolygonType(o){switch(o){case 6:case 7:case 8:case 9:case 26:case 27:case 29:case 28:case 11:case 12:case 13:case 14:case 31:case 32:case 33:case 34:case 41:case 42:case 43:case 44:case 46:case 47:case 48:case 49:return!0;default:return!1}},isTemplateOriginPtType(o){switch(o){case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 65:return!0;default:return!1}},isCustomTemplateInstanceType(o){switch(o){case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 50:return!0;default:return!1}},getCustomTemplateInstanceType(o){switch(o){case 21:return 36;case 22:return 37;case 23:return 38;case 24:return 39;case 25:return 40;case 26:return 41;case 27:return 42;case 28:return 43;case 29:return 44;case 30:return 45;case 31:return 46;case 32:return 47;case 33:return 48;case 34:return 49;case 35:return 50;default:return o}},getTemplateTypeByCustomInstanceType(o){switch(o){case 36:return 21;case 37:return 22;case 38:return 23;case 39:return 24;case 40:return 25;case 41:return 26;case 42:return 27;case 43:return 28;case 44:return 29;case 45:return 30;case 46:return 31;case 47:return 32;case 48:return 33;case 49:return 34;case 50:return 35;default:return o}},isTemplateNormalPolygonType(o){switch(o){case 56:case 57:case 59:case 58:return!0;default:return!1}},isTemplateWireFramePolygonType(o){switch(o){case 61:case 62:case 63:case 64:return!0;default:return!1}},isNormalPolygonType(o){switch(o){case 6:case 7:case 8:case 9:case 26:case 27:case 29:case 28:case 41:case 42:case 43:case 44:case 56:case 57:case 59:case 58:return!0;default:return!1}},isWireFramePolygonType(o){return o===11||o===12||o===13||o===14},isStaticPtType(o){switch(o){case 8:case 9:case 29:case 28:case 43:case 44:case 59:case 58:case 13:case 14:case 63:case 64:case 33:case 34:case 48:case 49:return!0;default:return!1}},isTemplateInstancePtType(o){switch(o){case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 50:return!0;default:return!1}},getTemplateInstanceType(o){switch(o){case 51:return 21;case 52:return 22;case 53:return 23;case 65:return 35;case 54:return 24;case 55:return 25;case 56:return 26;case 57:return 27;case 59:return 29;case 58:return 28;case 61:return 31;case 62:return 32;case 63:return 33;case 64:return 34;case 60:return 30;default:throw new Error(`type${o}`)}},getTemplateTypeByTemplateInstanceType(o){switch(o){case 21:case 36:return 51;case 22:case 37:return 52;case 23:case 38:return 53;case 24:case 39:return 54;case 25:case 40:return 55;case 26:case 41:return 56;case 27:case 42:return 57;case 29:case 44:return 59;case 28:case 43:return 58;case 31:case 46:return 61;case 32:case 47:return 62;case 33:case 48:return 63;case 34:case 49:return 64;case 30:case 45:return 60;case 35:case 50:return 65;default:return o}},isNormalType(o){return!Fr.isPolygonType(o)&&o!=10},getOrder(o,t,e){return GRe[Fr.getType(o[t])](o,t,e)},getGroupIdByBuilder(o,t,e){return HRe[Fr.getType(o.get(t))](o,t,e)},getTemplateId(o,t,e){return WRe[Fr.getType(o[t])](o,t,e)},getColorIndex(o,t,e){return zRe[Fr.getType(o[t])](o,t,e)},getGroupId(o,t,e){return URe[Fr.getType(o[0])](o,t,e)}},CZ=[];function _w(o,t){CZ.push(o,t)}function XRe(o){for(let t=0;t<CZ.length;t+=2)o==="cpu"?CZ[t]():CZ[t+1]()}var sd=12,XE=class qRe{constructor(t){this.chunks=[],this.length=0,this.isChanged=!1,this.arrayConstructor=t}get(t){return this.chunks[Math.floor(t/1024)][t%1024]}slice(t,e){if(e=Math.min(e,this.length),t>=e)return new this.arrayConstructor(0);let r=Math.floor(t/1024),i=Math.floor((e-1)/1024);if(r===i){let l=r*1024;return this.chunks[r].slice(t-l,e-l)}let n=new this.arrayConstructor(e-t),s=0,a=t%1024;for(let l=r;l<=i;l++){let c=this.chunks[l],h=a+Math.min(1024-a,n.length-s);for(;a<h;)n[s++]=c[a++];a=0}return n}forEach(t){this.length!==0&&this.chunks.forEach((e,r)=>{let i=r*1024;if(r===this.chunks.length-1&&this.length!==1024*this.chunks.length)for(let n=0,s=this.length%1024;n<s;n++)t(e[n],i++);else e.forEach(n=>t(n,i++))})}copy(){let t=new qRe(this.arrayConstructor);return this.chunks.forEach(e=>t.chunks.push(e.slice())),t.length=this.length,t.isChanged=!0,t}buildArr(){let t=new this.arrayConstructor(this.length),e=0;return this.chunks.forEach((r,i)=>{if(i===this.chunks.length-1&&this.length!==1024*this.chunks.length)for(let n=0,s=this.length%1024;n<s;n++)t[e++]=r[n];else t.set(r,e);e+=1024}),t}getLength(){return this.length}setLength(t){if(this.length===t)return;let e=Math.ceil(t/1024);if(e<=this.chunks.length)this.chunks.length=e;else for(;this.chunks.length<e;)this.chunks.push(new this.arrayConstructor(1024));this.length>t?this.markChange(t,this.length):this.markChange(this.length,t),this.length=t}trimChunk(t){Math.ceil(t/1024)!==this.chunks.length&&this.setLength(t)}extArr(t){t<=this.length||this.setLength(t)}markChange(t,e){this.isChanged=!0}set(t,e){this.extArr(t+1),this.chunks[Math.floor(t/1024)][t%1024]=e,this.markChange(t,t+1)}setArr(t,e){let r=e+t.length;this.extArr(r);let i=Math.floor(e/1024),n=Math.floor((e+t.length-1)/1024);if(i===n)this.chunks[i].set(t,e%1024);else{let s=0,a=e%1024;for(let l=i;l<=n;l++){let c=this.chunks[l],h=a+Math.min(1024-a,t.length-s);for(;a<h;)c[a++]=t[s++];a=0}}this.markChange(e,r)}push(t){return this.set(this.length,t),this.length}pushArr(t){return this.setArr(t,this.length),this.length}isChange(){return this.isChanged}clear(){this.chunks.length=0,this.length=0,this.markChange(0,0)}},BQe=class{constructor(){this._minX=0,this._maxX=0,this._minY=0,this._maxY=0}modify(o,t,e,r){return this._minX=o,this._maxX=t,this._minY=e,this._maxY=r,this}get minX(){return this._minX}get maxX(){return this._maxX}get minY(){return this._minY}get maxY(){return this._maxY}modify1(o){return this._minX=o.minX,this._maxX=o.maxX,this._minY=o.minY,this._maxY=o.maxY,this}center(){return new S(this.maxX-(this.maxX-this.minX)/2,this.maxY-(this.maxY-this.minY)/2)}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}UL(){return new S(this.minX,this.maxY)}UR(){return new S(this.maxX,this.maxY)}LL(){return new S(this.minX,this.minY)}LR(){return new S(this.maxX,this.minY)}transform4(o){let t=new _e;return t.ext2(this.LL().multiply4(o)),t.ext2(this.LR().multiply4(o)),t.ext2(this.UR().multiply4(o)),t.ext2(this.UL().multiply4(o)),t.build()}build(){return new ht(this.minX,this.maxX,this.minY,this.maxY)}},Xa=new BQe,FQe="struct O_a { O_b : i32 , O_c : i32 , O_d : i32 , O_e : i32 , O_f : i32 , } @ group ( 0 ) @ binding ( 0 ) var < uniform > O_g : O_a ; @ group ( 0 ) @ binding ( 1 ) var < storage , read > O_h : array < f32 > ; @ group ( 0 ) @ binding ( 2 ) var < storage , read_write > O_i : array < f32 > ; override MAX_COMPUTE_WORKGROUP_SIZE_X : u32 ; fn O_j ( O_k : vec2 < f32 > , ) -> f32 { let O_e = O_g . O_c ; let O_f = O_g . O_d ; let O_l = fract ( O_k . x ) ; let O_m = fract ( O_k . y ) ; let O_n = i32 ( O_k . x ) ; let O_o = i32 ( O_k . y ) ; let O_p = clamp ( O_n , 0 , O_e - 1 ) ; let O_q = clamp ( O_n + 1 , 0 , O_e - 1 ) ; let O_r = clamp ( O_o , 0 , O_f - 1 ) ; let O_s = clamp ( O_o + 1 , 0 , O_f - 1 ) ; let O_t = O_h [ O_r * O_e + O_p ] ; let O_u = O_h [ O_r * O_e + O_q ] ; let O_v = O_h [ O_s * O_e + O_p ] ; let O_w = O_h [ O_s * O_e + O_q ] ; let O_x = mix ( O_t , O_u , O_l ) ; let O_y = mix ( O_v , O_w , O_l ) ; return mix ( O_x , O_y , O_m ) ; } @ compute @ workgroup_size ( MAX_COMPUTE_WORKGROUP_SIZE_X ) fn reduceSdf ( @ builtin ( global_invocation_id ) id : vec3 < u32 > , ) { let O_z = i32 ( id . x ) + O_g . O_b ; if ( O_z > O_g . O_e * O_g . O_f ) { return ; } let O_aa = O_g . O_f ; let O_ab = O_g . O_e ; let O_ac = f32 ( O_g . O_c ) ; let O_ad = f32 ( O_g . O_d ) ; let O_ae : i32 = i32 ( floor ( f32 ( O_z ) / f32 ( O_ab ) ) ) ; let O_af : i32 = O_z % O_ab ; let O_ag = O_ae * O_ab + O_af ; let O_ah = ( f32 ( O_af ) + 0.5 ) / f32 ( O_ab ) ; let O_ai = ( f32 ( O_ae ) + 0.5 ) / f32 ( O_aa ) ; let O_aj = ( O_ah * O_ac - 0.5 ) ; let O_ak = ( O_ai * O_ad - 0.5 ) ; let O_al = O_j ( vec2 ( O_aj , O_ak ) ) ; O_i [ O_ag ] = O_al ; } ",VQe="struct O_a { O_b : i32 , O_c : i32 , O_d : i32 , O_e : i32 , } @ group ( 0 ) @ binding ( 0 ) var < uniform > O_f : O_a ; @ group ( 0 ) @ binding ( 1 ) var < storage , read_write > O_g : array < atomic < u32 > > ; @ group ( 0 ) @ binding ( 2 ) var < storage , read_write > O_h : array < atomic < u32 > > ; @ group ( 0 ) @ binding ( 3 ) var < storage , read_write > O_i : array < u32 > ; @ group ( 0 ) @ binding ( 4 ) var < storage , read_write > O_j : array < u32 > ; override INF : u32 ; override MAX_COMPUTE_WORKGROUP_SIZE_X : u32 ; fn O_k ( O_l : i32 , O_m : i32 , O_n : i32 , ) { if ( O_i [ O_l ] == INF ) { return ; } if ( O_f . O_e == 1 ) { for ( var O_o = O_m - 1 ; O_o >= 0 ; O_o -= 1 ) { let O_p = O_n * O_f . O_c + O_o ; if ( O_i [ O_p ] == 0 ) { break ; } var O_q = u32 ( ( O_o - O_m ) * ( O_o - O_m ) ) ; let O_r = atomicMin ( & O_g [ O_p ] , O_q ) ; if ( O_r <= O_q ) { break ; } } for ( var O_o = O_m + 1 ; O_o < O_f . O_c ; O_o += 1 ) { let O_p = O_n * O_f . O_c + O_o ; if ( O_i [ O_p ] == 0 ) { break ; } var O_q = u32 ( ( O_o - O_m ) * ( O_o - O_m ) ) ; let O_r = atomicMin ( & O_g [ O_p ] , O_q ) ; if ( O_r <= O_q ) { break ; } } } else { for ( var O_o = O_n - 1 ; O_o >= 0 ; O_o -= 1 ) { if ( O_n >= O_f . O_d ) { return ; } let O_s = O_o * O_f . O_c + O_m ; if ( O_i [ O_s ] <= O_i [ O_l ] ) { break ; } var O_q = u32 ( ( O_o - O_n ) * ( O_o - O_n ) ) + O_i [ O_l ] ; let O_r = atomicMin ( & O_g [ O_s ] , O_q ) ; } for ( var O_o = O_n + 1 ; O_o < O_f . O_d ; O_o += 1 ) { let O_s = O_o * O_f . O_c + O_m ; if ( O_i [ O_s ] <= O_i [ O_l ] ) { break ; } var O_q = u32 ( ( O_o - O_n ) * ( O_o - O_n ) ) + O_i [ O_l ] ; let O_r = atomicMin ( & O_g [ O_s ] , O_q ) ; } } } fn O_t ( O_l : i32 , O_m : i32 , O_n : i32 , ) { if ( O_j [ O_l ] == INF ) { return ; } if ( O_f . O_e == 1 ) { for ( var O_o = O_m - 1 ; O_o >= 0 ; O_o -= 1 ) { let O_p = O_n * O_f . O_c + O_o ; if ( O_j [ O_p ] == 0 ) { break ; } var O_q = u32 ( ( O_o - O_m ) * ( O_o - O_m ) ) ; let O_r = atomicMin ( & O_h [ O_p ] , O_q ) ; if ( O_r <= O_q ) { break ; } } for ( var O_o = O_m + 1 ; O_o < O_f . O_c ; O_o += 1 ) { let O_p = O_n * O_f . O_c + O_o ; if ( O_j [ O_p ] == 0 ) { break ; } var O_q = u32 ( ( O_o - O_m ) * ( O_o - O_m ) ) ; let O_r = atomicMin ( & O_h [ O_p ] , O_q ) ; if ( O_r <= O_q ) { break ; } } } else { for ( var O_o = O_n - 1 ; O_o >= 0 ; O_o -= 1 ) { if ( O_n >= O_f . O_d ) { return ; } let O_s = O_o * O_f . O_c + O_m ; if ( O_j [ O_s ] <= O_j [ O_l ] ) { break ; } var O_q = u32 ( ( O_o - O_n ) * ( O_o - O_n ) ) + O_j [ O_l ] ; let O_r = atomicMin ( & O_h [ O_s ] , O_q ) ; } for ( var O_o = O_n + 1 ; O_o < O_f . O_d ; O_o += 1 ) { let O_s = O_o * O_f . O_c + O_m ; if ( O_j [ O_s ] <= O_j [ O_l ] ) { break ; } var O_q = u32 ( ( O_o - O_n ) * ( O_o - O_n ) ) + O_j [ O_l ] ; let O_r = atomicMin ( & O_h [ O_s ] , O_q ) ; } } } @ compute @ workgroup_size ( MAX_COMPUTE_WORKGROUP_SIZE_X ) fn calculateGridRowData ( @ builtin ( global_invocation_id ) id : vec3 < u32 > , ) { let O_l = i32 ( id . x ) + O_f . O_b ; if ( O_l > O_f . O_c * O_f . O_d ) { return ; } let O_m = O_l % O_f . O_c ; let O_n = i32 ( floor ( f32 ( O_l / O_f . O_c ) ) ) ; O_k ( O_l , O_m , O_n ) ; O_t ( O_l , O_m , O_n ) ; } ",GQe="struct O_a { O_b : i32 , O_c : i32 , O_d : i32 , } @ group ( 0 ) @ binding ( 0 ) var < uniform > O_e : O_a ; @ group ( 0 ) @ binding ( 1 ) var < storage , read_write > O_f : array < u32 > ; @ group ( 0 ) @ binding ( 2 ) var < storage , read_write > O_g : array < u32 > ; @ group ( 0 ) @ binding ( 3 ) var < storage , read_write > O_h : array < f32 > ; override MAX_COMPUTE_WORKGROUP_SIZE_X : u32 ; @ compute @ workgroup_size ( MAX_COMPUTE_WORKGROUP_SIZE_X ) fn computeSdfData ( @ builtin ( global_invocation_id ) id : vec3 < u32 > , ) { let O_i = i32 ( id . x ) + O_e . O_b ; if ( O_i > O_e . O_c * O_e . O_d ) { return ; } let O_j = sqrt ( f32 ( O_f [ O_i ] ) ) - sqrt ( f32 ( O_g [ O_i ] ) ) ; O_h [ O_i ] = round ( 255 - 255 * O_j ) ; } ",UQe="struct O_a { O_b : i32 , O_c : i32 , O_d : i32 , } @ group ( 0 ) @ binding ( 0 ) var < uniform > O_e : O_a ; @ group ( 0 ) @ binding ( 1 ) var < storage , read_write > O_f : array < u32 > ; @ group ( 0 ) @ binding ( 2 ) var < storage , read_write > O_g : array < u32 > ; @ group ( 0 ) @ binding ( 3 ) var O_h : texture_2d < f32 > ; override INF : u32 ; override MAX_COMPUTE_WORKGROUP_SIZE_X : u32 ; @ compute @ workgroup_size ( MAX_COMPUTE_WORKGROUP_SIZE_X ) fn createGridData ( @ builtin ( global_invocation_id ) id : vec3 < u32 > , ) { let O_i = i32 ( id . x ) + O_e . O_b ; if ( O_i > O_e . O_c * O_e . O_d ) { return ; } let O_j = i32 ( floor ( f32 ( O_i / O_e . O_c ) ) ) ; let O_k = O_i % O_e . O_c ; let O_l = textureLoad ( O_h , vec2 < i32 > ( O_k , O_j ) , 0 ) ; if ( O_l . a > 0.5 ) { O_f [ O_i ] = 0 ; O_g [ O_i ] = INF ; } else { O_f [ O_i ] = INF ; O_g [ O_i ] = 0 ; } } ",V7=512,mve="#000000",gve="#000000",yve=[1,0,0,1,0,0],bve="10px sans-serif",U0=class{constructor(o){this.stateStack=[],this.operateStack=[],this.transformMatrix=yve,this.fillStyle=mve,this.strokeStyle=gve,this.font=bve,this.context=o}getContext(){return this.context}originSave(){this.context.save()}originRestore(){this.context.restore(),this.reset()}reset(){delete this.lastState,delete this.lastOperate,this.transformMatrix=yve,this.fillStyle=mve,this.strokeStyle=gve,this.font=bve}save(){this.lastState={},this.stateStack.push(this.lastState),this.lastOperate=[],this.operateStack.push(this.lastOperate)}restore(){let o=Object.keys(this.lastState).filter(e=>e==="transform");for(let e in this.lastState){let r=this.lastState[e];switch(e){case"transform":{this.context.setTransform(r[0],r[1],r[2],r[3],r[4],r[5]),this.transformMatrix=r;break}case"lineDash":{this.context.setLineDash(r);break}default:{switch(e){case"fillStyle":{this.fillStyle=r;break}case"strokeStyle":{this.strokeStyle=r;break}case"font":{this.font=r;break}}this.context[e]=r}}}let t=[];if(!o.length)for(let e of this.lastOperate.reverse())if(typeof e=="string")switch(e){case"translate":{this.context.translate(t[1],t[0]),t=[];break}case"rotate":{this.context.rotate(t[0]),t=[];break}case"scale":{this.context.scale(t[1],t[0]),t=[];break}}else t.push(e);this.stateStack.pop(),this.lastState=this.stateStack[this.stateStack.length-1],this.operateStack.pop(),this.lastOperate=this.operateStack[this.operateStack.length-1]}setFillStyle(o){o!==this.fillStyle&&(this.lastState&&this.lastState.fillStyle===void 0&&(this.lastState.fillStyle=this.fillStyle),this.fillStyle=o,this.context.fillStyle=o)}setStrokeStyle(o){o!==this.strokeStyle&&(this.lastState&&this.lastState.strokeStyle===void 0&&(this.lastState.strokeStyle=this.strokeStyle),this.strokeStyle=o,this.context.strokeStyle=o)}setLineCap(o){o!==this.context.lineCap&&(this.lastState&&this.lastState.lineCap===void 0&&(this.lastState.lineCap=this.context.lineCap),this.context.lineCap=o)}setTranslate(o,t){var e;(e=this.lastOperate)==null||e.push("translate",-o,-t),this.context.translate(o,t)}setRotate(o){var t;(t=this.lastOperate)==null||t.push("rotate",-o),this.context.rotate(o)}setScale(o,t){var e;(e=this.lastOperate)==null||e.push("scale",1/o,1/t),this.context.scale(o,t)}setTransform(o){this.lastState&&this.lastState.transform===void 0&&(this.lastState.transform=this.transformMatrix),this.transformMatrix=[o[0],o[1],o[2],o[3],o[4],o[5]],this.context.setTransform(o[0],o[1],o[2],o[3],o[4],o[5])}setLineDash(o){let t=this.context.getLineDash();JSON.stringify(o)!==JSON.stringify(t)&&(this.lastState&&this.lastState.lineDash===void 0&&(this.lastState.lineDash=t),this.context.setLineDash(o))}setLineWidth(o){o!==this.context.lineWidth&&(this.lastState&&this.lastState.lineWidth===void 0&&(this.lastState.lineWidth=this.context.lineWidth),this.context.lineWidth=o)}setTextAlign(o){o!==this.context.textAlign&&(this.lastState&&this.lastState.textAlign===void 0&&(this.lastState.textAlign=this.context.textAlign),this.context.textAlign=o)}setTextBaseLine(o){o!==this.context.textBaseline&&(this.lastState&&this.lastState.textBaseline===void 0&&(this.lastState.textBaseline=this.context.textBaseline),this.context.textBaseline=o)}setFont(o){o!==this.font&&(this.lastState&&this.lastState.font===void 0&&(this.lastState.font=this.font),this.font=o,this.context.font=o)}setGlobalAlpha(o){o!==this.context.globalAlpha&&(this.lastState&&this.lastState.globalAlpha===void 0&&(this.lastState.globalAlpha=this.context.globalAlpha),this.context.globalAlpha=o)}setShadowBlur(o){o!==this.context.shadowBlur&&(this.lastState&&this.lastState.shadowBlur===void 0&&(this.lastState.shadowBlur=this.context.shadowBlur),this.context.shadowBlur=o)}setShadowColor(o){o!==this.context.shadowColor&&(this.lastState&&this.lastState.shadowColor===void 0&&(this.lastState.shadowColor=this.context.shadowColor),this.context.shadowColor=o)}setShadowOffsetX(o){o!==this.context.shadowOffsetX&&(this.lastState&&this.lastState.shadowOffsetX===void 0&&(this.lastState.shadowOffsetX=this.context.shadowOffsetX),this.context.shadowOffsetX=o)}setShadowOffsetY(o){o!==this.context.shadowOffsetY&&(this.lastState&&this.lastState.shadowOffsetY===void 0&&(this.lastState.shadowOffsetY=this.context.shadowOffsetY),this.context.shadowOffsetY=o)}setGlobalCompositeOperation(o){o!==this.context.globalCompositeOperation&&(this.lastState&&this.lastState.globalCompositeOperation===void 0&&(this.lastState.globalCompositeOperation=this.context.globalCompositeOperation),this.context.globalCompositeOperation=o)}},ZZ=6,JZ=5,QZ=4,eJ=3,tJ=2,HQe=1,VT=2,$Re=class{constructor(o){this.data=o,this.bitmap=new Xm(4),this.bitmap.addTrimListener(t=>{this.data.trimChunk(t)})}add(){let o=this.bitmap.findEmpty();return o===-1&&(this.bitmap=this.bitmap.extSize(this.bitmap.size*2),o=this.bitmap.findEmpty()),this.bitmap.markUsed(o),this.data.setArr([0,0],o*VT),o}remove(o){this.data.setArr([0,0],o*VT),this.bitmap.markRemove(o)}set(o,t,e,r,i,n=0,s=0){if(!this.bitmap.isUsed(o))throw new Error("groupId does not exist");if(r!=null&&r!==0&&r!==1)throw new Error("highLightGroupId is incorrect");let a=t?0:1,l=r==null?0:1,c=e?1:0,h=i?1:0;this.data.setArr([(s<<ZZ)+(a<<JZ)+(l<<QZ)+(r<<eJ)+(c<<tJ)+h,n],o*VT)}getData(){return this.data}},ih={isDoubleRgb(o,t){if(o==-1)return!1;let e=o*VT;return!!(t!=null&&t.getLength()&&(t.get(e)>>tJ&1)==1)},isHidden(o,t){if(o==-1)return!1;let e=o*VT;return!!(t!=null&&t.getLength()&&t.get(e)>>JZ==1)},isHighLight(o,t){if(o==-1)return!1;let e=o*VT;return!!(t!=null&&t.getLength()&&(t.get(e)>>QZ&1)==1)},getHighLightGroupId(o,t){if(o==-1)throw new Error("GroupId error");if(!t.getLength())throw new Error("GroupId getHighLightGroupId error");let e=o*VT;return t.get(e)>>eJ&1},isForceHighLight(o,t){if(o==-1)return!1;if(t!=null&&t.getLength()){let e=o*VT;return(t.get(e)&HQe)==1}return!1},getColorIndex(o,t){if(o==-1)return 0;if(t!=null&&t.getLength()){let e=o*VT;return t.get(e+1)}return 0},getRenderMode(o,t){if(o==-1)return 0;let e=o*VT;return t!=null&&t.getLength()?t.get(e)>>ZZ:0}},WQe="struct O_a { O_b : mat4x4 < f32 > , O_c : mat4x4 < f32 > , O_d : mat4x4 < f32 > , O_e : vec3 < f32 > , O_f : f32 , O_g : vec3 < f32 > , O_h : f32 , O_i : f32 , O_j : f32 , O_k : f32 , O_l : f32 , } struct O_m { O_n : mat3x2 < f32 > , O_o : f32 , O_p : f32 , O_q : f32 , O_r : f32 , O_s : f32 , O_t : f32 , } struct O_u { O_n : mat3x2 < f32 > , O_r : f32 , O_v : f32 , } struct O_w { O_x : f32 , O_y : f32 , O_z : f32 , O_aa : f32 , O_ab : f32 , O_ac : f32 , O_ad : f32 , } struct O_ae { O_p : f32 , O_af : f32 , O_ag : f32 , O_ah : f32 , O_ai : f32 , O_aj : f32 , O_ak : f32 , } struct O_al { O_am : vec3 < f32 > , O_an : vec3 < f32 > , } struct O_ao { O_n : mat4x4 < f32 > , O_ap : vec4 < f32 > , O_aq : vec4 < f32 > , O_ar : vec3 < f32 > , O_as : vec3 < f32 > , O_at : vec3 < f32 > , O_au : f32 , O_av : f32 , O_i : f32 , O_ad : u32 , O_aw : u32 , O_ax : f32 , O_ay : u32 , O_az : u32 , O_ba : f32 , O_bb : vec4 < f32 > , O_bc : vec4 < f32 > , O_bd : f32 , O_be : f32 , O_bf : f32 , O_bg : f32 , O_bh : f32 , O_bi : u32 , O_bj : f32 , O_bk : f32 , O_bl : vec4 < f32 > , O_bm : f32 , O_bn : f32 , O_bo : f32 , O_bp : f32 , O_bq : O_ae , @ align ( 16 ) O_br : vec3 < f32 > , O_bs : vec3 < f32 > , O_bt : vec3 < f32 > , O_bu : vec2 < f32 > , } @ binding ( 0 ) @ group ( 0 ) var < uniform > O_bv : O_a ; @ binding ( 1 ) @ group ( 0 ) var < uniform > O_bw : O_ao ; @ binding ( 4 ) @ group ( 0 ) var < storage , read > O_bx : array < vec4 < f32 > > ; @ binding ( 5 ) @ group ( 0 ) var O_by : sampler ; @ binding ( 6 ) @ group ( 0 ) var O_bz : texture_2d < f32 > ; @ binding ( 7 ) @ group ( 0 ) var < storage , read > O_ca : array < O_m > ; @ binding ( 8 ) @ group ( 0 ) var < storage , read > O_cb : array < u32 > ; @ binding ( 9 ) @ group ( 0 ) var < storage , read > O_cc : array < u32 > ; @ binding ( 10 ) @ group ( 0 ) var < storage , read_write > O_cd : array < atomic < i32 > > ; @ binding ( 11 ) @ group ( 0 ) var < storage , read > O_ce : array < f32 > ; @ binding ( 12 ) @ group ( 0 ) var < storage , read > O_cf : array < f32 > ; @ binding ( 13 ) @ group ( 0 ) var < storage , read > O_cg : array < f32 > ; @ binding ( 14 ) @ group ( 0 ) var < storage , read > O_ch : array < O_u > ; @ binding ( 15 ) @ group ( 0 ) var < storage , read > O_ci : array < f32 > ; override VISIBLE_MASK : u32 ; override MATH_PI : f32 ; override CHAR_WIDTH : f32 ; override CHAR_HEIGHT : f32 ; override CANVAS_WIDTH : f32 ; override CANVAS_HEIGHT : f32 ; override PTGROUP_VISIBLE_SHIFT : u32 ; override PTGROUP_DOUBLERGB_SHIFT : u32 ; override PTGROUP_HIGH_LIGHT_SHIFT : u32 ; override PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT : u32 ; override PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT : u32 ; override ANTIALIAS_RATIO : f32 ; override MIN_PX_LENGTH_RATIO : f32 ; override SDF_WIDTH : f32 ; override SDF_HEIGHT : f32 ; override RENDER_HIGHLIGHT_TYPE_SHIFT : f32 ; override TEMPLATE_OFFSET_DATA_LENGTH : u32 ; override CIRCLE_INSTANCE_PT_LENGTH : i32 ; override TRIANGLE_INSTANCE_PT_LENGTH : i32 ; override CUTED_CIRCLE_INSTANCE_PT_LENGTH : i32 ; override LINE_WIRE_INSTANCE_FRAME_PT_LENGTH : i32 ; override ARC_WIRE_FRAME_INSTANCE_PT_LENGTH : i32 ; override STRING_INSTANCE_PT_LENGTH : i32 ; override STATIC_TRIANGLE_INSTANCE_PT_LENGTH : i32 ; override STATIC_CUTED_CIRCLE_INSTANCE_PT_LENGTH : i32 ; override STATIC_LINE_WIRE_FRAME_INSTANCE_PT_LENGTH : i32 ; override STATIC_ARC_WIRE_FRAME_INSTANCE_PT_LENGTH : i32 ; override STRING_LEVEL_BITLENGTH : u32 ; override ARC_INSTANCE_PT_LENGTH : i32 ; override RECT_INSTANCE_PT_LENGTH : i32 ; override LINE_INSTANCE_PT_LENGTH : i32 ; override LINESEGMENT_INSTANCE_PT_LENGTH : i32 ; override SEMICIRCLE_INSTANCE_PT_LENGTH : i32 ; override GROUP_DATA_LENGTH : u32 ; struct O_cj { @ location ( 0 ) O_ap : vec4 < f32 > , @ location ( 1 ) O_bb : vec4 < f32 > , @ location ( 2 ) O_bc : vec4 < f32 > , } struct O_ck { O_cl : vec4 < f32 > , O_cm : vec4 < f32 > , } fn O_cn ( O_y : f32 , O_z : f32 , O_ap : vec4 < f32 > , O_av : f32 , O_ab : f32 , ) -> O_ck { var O_co : O_ck ; if ( O_y == 1 ) { if ( O_ab == 0 || O_bw . O_bk == 0 ) { if ( O_z == 0 ) { O_co . O_cl = O_bw . O_bb ; } else { O_co . O_cm = O_bw . O_bc ; } } else { if ( O_z == 0 ) { O_co . O_cl = O_ap ; } else { O_co . O_cm = O_ap ; } } O_co . O_cl . a *= O_av ; O_co . O_cm . a *= O_av ; } return O_co ; } fn O_cp ( O_y : f32 , O_z : f32 , O_e : vec4 < f32 > , O_cq : bool , O_ab : f32 , ) { if ( O_y == 1 ) { let O_k = i32 ( O_bv . O_k * O_bw . O_bd ) ; let O_l = i32 ( O_bv . O_l * O_bw . O_bd ) ; var O_cr = i32 ( ( i32 ( O_l ) - 1 - i32 ( O_e . y ) ) * i32 ( O_k ) + i32 ( O_e . x ) ) ; if ( O_cq ) { if ( O_bw . O_bk == 1 && O_ab == 1 ) { atomicAdd ( & O_cd [ O_l * O_k * 2 + O_cr ] , 1 ) ; return ; } if ( O_z == 0 ) { atomicAdd ( & O_cd [ O_cr ] , 1 ) ; } else { atomicAdd ( & O_cd [ O_l * O_k + O_cr ] , 1 ) ; } } else { if ( O_bw . O_bk == 1 && O_ab == 1 ) { atomicSub ( & O_cd [ O_l * O_k * 2 + O_cr ] , 1 ) ; return ; } if ( O_z == 0 ) { atomicSub ( & O_cd [ O_cr ] , 1 ) ; } else { atomicSub ( & O_cd [ O_l * O_k + O_cr ] , 1 ) ; } } } } fn O_cs ( O_ct : f32 , O_cu : f32 , O_cv : O_w , ) -> f32 { let O_p = O_cw ( O_cu ) ; let O_av = select ( 1 , O_bx [ O_p ] . a , O_p > 0 ) ; if ( O_av == 0 ) { return 0 ; } let O_cx = u32 ( O_ct ) ; let O_cy : u32 = O_cx & VISIBLE_MASK ; if ( O_cy == 0 ) { return 0 ; } if ( O_cv . O_x == 1 ) { return 0 ; } if ( O_bw . O_ay == 0 && O_cv . O_ab == 0 ) { return 0 ; } if ( O_bw . O_ay == 0 && O_cv . O_ab == 1 && ( O_bw . O_bm == 0 || O_bw . O_bn == 1 ) ) { return 0 ; } return 1 ; } fn O_cz ( O_r : f32 , ) -> vec2f { var O_da = vec2f ( 0 , 0 ) ; if ( O_r != - 1 ) { let O_cr = u32 ( O_r ) * TEMPLATE_OFFSET_DATA_LENGTH ; O_da = vec2f ( O_cg [ O_cr ] , O_cg [ O_cr + 1 ] ) ; } return O_da ; } fn O_db ( O_dc : f32 , O_dd : f32 , O_de : f32 , ) -> f32 { let O_df = acos ( ( O_de * O_de + O_dc * O_dc - O_dd * O_dd ) / ( 2.0 * O_de * O_dc ) ) ; let O_dg = acos ( ( O_de * O_de + O_dd * O_dd - O_dc * O_dc ) / ( 2.0 * O_de * O_dd ) ) ; let O_dh = O_dc * O_dc * O_df ; let O_di = O_dd * O_dd * O_dg ; if ( O_dc > O_dd ) { return O_di - O_dd * cos ( O_dg ) * O_dd * sin ( O_dg ) ; } else { return O_dh - O_dc * cos ( O_df ) * O_dc * sin ( O_df ) ; } } fn O_dj ( O_aa : f32 , O_ab : f32 , ) -> f32 { if ( O_bw . O_ba != O_aa ) { return 0 ; } if ( O_bw . O_bp != 1 && O_ab == 1 && O_bw . O_bk == 0 && O_bw . O_bm == 1 ) { return 0 ; } if ( O_bw . O_bp == 1 && O_ab == 0 ) { return 0 ; } return 1 ; } fn O_dk ( O_ab : f32 , ) -> bool { return O_ab != 1 || ( O_ab == 1 && O_bw . O_bk == 0 ) ; } fn O_dl ( O_dm : vec4f , ) -> vec4f { var O_dn = O_dm ; O_dn . x += O_bw . O_bu . x * O_dm . w ; O_dn . y += O_bw . O_bu . y * O_dm . w ; return O_dn ; } fn O_cw ( O_cr : f32 , ) -> u32 { return u32 ( O_cr ) >> u32 ( RENDER_HIGHLIGHT_TYPE_SHIFT ) ; } fn O_do ( O_dm : vec4 < f32 > , ) -> O_al { var O_co : O_al ; if ( O_bw . O_ad == 2 ) { let O_n = O_bv . O_c * O_bw . O_n ; O_co . O_am = mat3x3 ( vec3 ( O_n [ 0 ] . xyz ) , vec3 ( O_n [ 1 ] . xyz ) , vec3 ( O_n [ 2 ] . xyz ) ) * vec3 < f32 > ( 0 , 0 , 1 ) ; let O_e = O_n * vec4 ( O_dm . xy , 0 , 1 ) ; O_co . O_an = - O_e . xyz / O_e . w ; } return O_co ; } fn O_dp ( O_cu : f32 , O_aa : f32 , O_ab : f32 , ) -> vec4 < f32 > { let O_p = O_cw ( O_cu ) ; var O_ap : vec4 < f32 > ; var O_dq = O_bw . O_ap ; if ( O_bw . O_bi == 0 && O_bw . O_bm == 1 && O_ab == 1 ) { O_dq = O_bw . O_bl ; } if ( O_p == 0 || ( O_bw . O_bi == 0 && O_bw . O_bm == 0 ) || ( O_bw . O_bi == 0 && O_bw . O_bm == 1 && O_ab == 0 ) ) { O_ap = O_dq ; } else { O_ap = O_bx [ O_p ] ; if ( O_ap . r + O_ap . g + O_ap . b == 0 ) { O_ap . r = O_dq . r ; O_ap . g = O_dq . g ; O_ap . b = O_dq . b ; } O_ap . a *= O_dq . a ; } var O_dr = O_bw . O_ax ; if ( O_aa == 1 || O_bw . O_ba == 1 || O_ab == 1 ) { O_dr = 1 ; } O_ap . r *= O_dr ; O_ap . g *= O_dr ; O_ap . b *= O_dr ; return O_ap ; } fn O_ds ( O_cu : f32 , O_am : vec3 < f32 > , O_an : vec3 < f32 > , O_aa : f32 , O_ab : f32 , ) -> vec4 < f32 > { if ( O_bw . O_ad == 0 || O_bw . O_ad == 1 ) { return O_dp ( O_cu , O_aa , O_ab ) ; } let O_p = O_cw ( O_cu ) ; var O_ar : vec3 < f32 > ; var O_as : vec3 < f32 > ; var O_at : vec3 < f32 > ; if ( O_p == 0 ) { O_ar = O_bw . O_ar ; O_as = O_bw . O_as ; O_at = O_bw . O_at ; } else { let O_dq = O_bx [ O_p ] . rgb ; O_ar = O_dq ; O_as = O_ar ; O_at = O_ar ; } var O_dt = O_ar * O_bw . O_br ; var O_du = normalize ( O_am ) ; var O_bt = O_bw . O_bt ; var O_dv = abs ( dot ( O_du , O_bt ) ) * O_as * O_bw . O_bs ; var O_dw = - 2.0 * O_du * dot ( O_bt , O_du ) + O_bt ; var O_dx = normalize ( O_an ) ; var O_dy = abs ( dot ( O_dw , O_dx ) ) ; var O_dz = O_at * O_bw . O_bs * pow ( O_dy , 300.0 ) * O_bw . O_au * 0.1 ; var O_ap = vec4 ( O_dt + O_dv + O_dz , O_bw . O_av ) ; return O_ap ; } fn O_ea ( O_eb : f32 , O_dm : vec2 < f32 > , ) -> vec2 < f32 > { let O_ec = O_ch [ i32 ( O_eb ) ] ; return O_ec . O_n * vec3 ( O_dm , 1.0 ) ; } fn O_ed ( O_ee : vec2 < f32 > , vec2 : vec2 < f32 > , ) -> f32 { return O_ee . x * vec2 . y - O_ee . y * vec2 . x ; } fn O_ef ( O_eg : f32 , ) -> vec4 < f32 > { let O_eh = vec4 ( 1.0 , 2.0 , 3.0 , 4.0 ) - O_eg ; let O_ei = O_eh * O_eh * O_eh ; let O_ej = O_ei . x ; let O_ek = O_ei . y - 4.0 * O_ei . x ; let O_el = O_ei . z - 4.0 * O_ei . y + 6.0 * O_ei . x ; let O_em = 6.0 - O_ej - O_ek - O_el ; return vec4 ( O_ej , O_ek , O_el , O_em ) * ( 1.0 / 6.0 ) ; } fn O_en ( O_eo : vec2 < f32 > , O_ep : f32 , O_eq : f32 , O_er : f32 , ) -> f32 { let size = vec2 < f32 > ( O_ep , O_eq ) ; let O_es = 1.0 / size ; var O_et = O_eo * size - 0.5 ; let O_eu = fract ( O_et ) ; O_et = O_et - O_eu ; let O_ev = O_ef ( O_eu . x ) ; let O_ew = O_ef ( O_eu . y ) ; let O_ex = O_et . xxyy + vec4 ( - 0.5 , 1.5 , - 0.5 , 1.5 ) ; let O_ei = vec4 ( O_ev . xz + O_ev . yw , O_ew . xz + O_ew . yw ) ; var O_da = O_ex + vec4 ( O_ev . yw , O_ew . yw ) / O_ei ; O_da = O_da * O_es . xxyy ; let O_ey = O_ez ( O_da . xz , O_ep , O_eq , O_er ) ; let O_fa = O_ez ( O_da . yz , O_ep , O_eq , O_er ) ; let O_fb = O_ez ( O_da . xw , O_ep , O_eq , O_er ) ; let O_fc = O_ez ( O_da . yw , O_ep , O_eq , O_er ) ; let O_fd = O_ei . x / ( O_ei . x + O_ei . y ) ; let O_fe = O_ei . z / ( O_ei . z + O_ei . w ) ; return mix ( mix ( O_fc , O_fb , O_fd ) , mix ( O_fa , O_ey , O_fd ) , O_fe ) ; } fn O_ez ( O_eo : vec2 < f32 > , O_ep : f32 , O_eq : f32 , O_er : f32 , ) -> f32 { let O_k = i32 ( O_ep ) ; let O_l = i32 ( O_eq ) ; let O_ff = O_eo . x * O_ep - 0.5 ; let O_fg = O_eo . y * O_eq - 0.5 ; let O_fh = fract ( O_ff ) ; let O_fi = fract ( O_fg ) ; let O_da = i32 ( O_er ) ; let O_fj = i32 ( floor ( O_ff ) ) ; let O_fk = i32 ( floor ( O_fg ) ) ; let O_fl = clamp ( O_fj , 0 , O_k - 1 ) ; let O_fm = clamp ( O_fj + 1 , 0 , O_k - 1 ) ; let O_fn = clamp ( O_fk , 0 , O_l - 1 ) ; let O_fo = clamp ( O_fk + 1 , 0 , O_l - 1 ) ; let O_fp = O_cf [ O_da + ( O_fn * O_k + O_fl ) ] ; let O_fq = O_cf [ O_da + ( O_fn * O_k + O_fm ) ] ; let O_fr = O_cf [ O_da + ( O_fo * O_k + O_fl ) ] ; let O_fs = O_cf [ O_da + ( O_fo * O_k + O_fm ) ] ; let O_ft = mix ( O_fp , O_fq , O_fh ) ; let O_fu = mix ( O_fr , O_fs , O_fh ) ; return mix ( O_ft , O_fu , O_fi ) ; } fn O_fv ( O_fw : u32 , O_fx : vec2 < f32 > , O_fy : f32 , O_fz : f32 , O_ga : f32 , O_gb : f32 , O_gc : f32 , ) -> vec2 < f32 > { let O_gd = O_ga + O_gb / 2 ; let O_ge = vec2 ( cos ( O_gd ) , sin ( O_gd ) ) ; var O_gf = vec2 ( O_ge . y , - O_ge . x ) ; let O_gg = cos ( O_gb / 2 ) * O_fz - O_gc ; let O_gh = O_ge * O_gg ; let O_ej = ( - O_gg + sqrt ( O_gg * O_gg + 8 * O_fy * O_fy ) ) / 2 ; let O_gi = O_ge * O_ej ; let tan = sqrt ( O_ej * O_ej - O_fy * O_fy ) / O_fy ; let O_gj = O_gf * ( ( O_ej - O_gg ) / tan ) ; var O_dm = O_fx ; if ( O_gb < 0 ) { if ( O_fw == 0 ) { O_dm += O_gj ; O_dm += O_gh ; } else if ( O_fw == 1 ) { O_dm -= O_gj ; O_dm += O_gh ; } else { O_dm += O_gi ; } } else { if ( O_fw == 0 ) { O_dm -= O_gj ; O_dm += O_gh ; } else if ( O_fw == 1 ) { O_dm += O_gj ; O_dm += O_gh ; } else { O_dm += O_gi ; } } return O_dm ; } fn O_gk ( O_fw : u32 , O_fx : vec2 < f32 > , O_fy : f32 , O_ga : f32 , O_gb : f32 , O_gl : vec2 < f32 > , O_gm : vec2 < f32 > , ) -> vec2 < f32 > { var O_dm = vec2f ( 0 , 0 ) ; if ( abs ( abs ( O_gb ) - 6.283185307179586 ) <= 1e-8 ) { O_dm = O_fx ; if ( O_gb > 0 ) { if ( O_fw == 0 ) { O_dm . x += O_fy * ( - sqrt ( 3.0 ) ) ; O_dm . y += O_fy * ( - 1.0 ) ; } else if ( O_fw == 1 ) { O_dm . x += O_fy * ( sqrt ( 3.0 ) ) ; O_dm . y += O_fy * ( - 1.0 ) ; } else { O_dm . y += O_fy * ( 2.0 ) ; } } else { if ( O_fw == 0 ) { O_dm . x += O_fy * ( sqrt ( 3.0 ) ) ; O_dm . y += O_fy * ( - 1.0 ) ; } else if ( O_fw == 1 ) { O_dm . x += O_fy * ( - sqrt ( 3.0 ) ) ; O_dm . y += O_fy * ( - 1.0 ) ; } else { O_dm . y += O_fy * ( 2.0 ) ; } } } else { let O_gd = O_ga + O_gb / 2 ; let O_ge = vec2 ( cos ( O_gd ) , sin ( O_gd ) ) ; var O_gf = normalize ( O_gm - O_gl ) ; let O_gg = cos ( O_gb / 2 ) * O_fy ; let O_ej = ( - O_gg + sqrt ( O_gg * O_gg + 8 * O_fy * O_fy ) ) / 2 ; let O_gi = O_ge * O_ej ; let tan = sqrt ( O_ej * O_ej - O_fy * O_fy ) / O_fy ; let O_gj = O_gf * ( ( O_ej - O_gg ) / tan ) - ( O_gm - O_gl ) / 2 ; if ( O_fw == 0 ) { O_dm = O_gm + O_gj ; } else if ( O_fw == 1 ) { O_dm = O_gl - O_gj ; } else { O_dm = O_fx + O_gi ; } } return O_dm ; } struct O_gn { O_gl : vec2f , O_gm : vec2f , O_gf : vec2f , } fn O_go ( O_gl : vec2f , O_gm : vec2f , O_gp : f32 , O_k : f32 , O_gq : f32 , ) -> O_gn { var O_co : O_gn ; var O_gf = normalize ( O_gm - O_gl ) ; if ( O_gp == 1 || O_gp == 2 ) { var O_gr : vec2f ; if ( all ( O_gl == O_gm ) ) { O_gf = vec2 ( 1 , 0 ) ; } O_gr = O_gf * max ( O_k , O_gq ) / 2 ; O_co . O_gl = O_gl - O_gr ; O_co . O_gm = O_gm + O_gr ; O_co . O_gf = O_gf ; return O_co ; } O_co . O_gl = O_gl ; O_co . O_gm = O_gm ; O_co . O_gf = O_gf ; return O_co ; } fn O_gs ( O_gt : u32 , ) -> u32 { return O_gt >> PTGROUP_VISIBLE_SHIFT ; } fn O_gu ( O_gt : u32 , ) -> u32 { return ( O_gt >> PTGROUP_DOUBLERGB_SHIFT ) & 1 ; } fn O_gv ( O_gt : u32 , ) -> u32 { return ( O_gt >> PTGROUP_HIGH_LIGHT_SHIFT ) & 1 ; } fn O_gw ( O_gt : u32 , ) -> u32 { return ( O_gt >> PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT ) & 1 ; } fn O_gx ( O_gt : u32 , ) -> u32 { return O_gt & 1 ; } fn O_gy ( O_gt : u32 , ) -> u32 { return O_gt >> PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT ; } fn O_gz ( O_q : f32 , ) -> O_w { var O_co : O_w ; if ( O_q != - 1 ) { let O_gt = O_cc [ u32 ( O_q ) * GROUP_DATA_LENGTH ] ; O_co . O_ac = f32 ( O_cc [ u32 ( O_q ) * GROUP_DATA_LENGTH + 1 ] ) ; O_co . O_y = f32 ( O_gv ( O_gt ) ) ; O_co . O_x = f32 ( O_gs ( O_gt ) ) ; if ( O_co . O_y == 1 ) { O_co . O_z = f32 ( O_gw ( O_gt ) ) ; O_co . O_ab = f32 ( O_gx ( O_gt ) ) ; } O_co . O_aa = f32 ( O_gu ( O_gt ) ) ; O_co . O_ad = f32 ( O_gy ( O_gt ) ) ; } return O_co ; } fn O_ha ( O_cu : f32 , O_hb : f32 , ) -> f32 { if ( O_cw ( O_cu ) != 0 ) { return O_cu ; } if ( O_cw ( O_hb ) != 0 ) { return O_hb ; } return O_cu ; } fn O_hc ( O_p : f32 , O_hd : f32 , ) -> bool { if ( O_bw . O_bj != O_p || O_hd == 1 ) { return false ; } return true ; } fn O_he ( O_hd : f32 , O_hf : u32 , ) -> bool { if ( O_hd == 0 ) { if ( O_hf == 1 ) { return true ; } return false ; } if ( O_hd == 1 ) { return true ; } if ( O_hd == 2 ) { return false ; } return false ; } struct O_hg { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_hi : f32 , @ location ( 1 ) @ interpolate ( flat ) r : f32 , @ location ( 2 ) @ interpolate ( flat ) O_fx : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_ga : f32 , @ location ( 4 ) @ interpolate ( flat ) O_hj : f32 , @ location ( 5 ) O_dm : vec2 < f32 > , @ location ( 6 ) O_am : vec3 < f32 > , @ location ( 7 ) O_an : vec3 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_p : f32 , @ location ( 9 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 10 ) @ interpolate ( flat ) O_y : f32 , @ location ( 11 ) @ interpolate ( flat ) O_z : f32 , @ location ( 12 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 13 ) @ interpolate ( flat ) O_hd : f32 , } fn O_hk ( O_ct : f32 , O_fw : u32 , O_fx : vec2 < f32 > , O_fz : f32 , O_k : f32 , O_ga : f32 , O_gb : f32 , O_p : f32 , O_da : vec2 < f32 > , O_gq : f32 , O_q : f32 , O_hl : bool , ) -> O_hg { var O_co : O_hg ; let O_cv = O_gz ( O_q ) ; if ( O_hl && ! O_he ( O_cv . O_ad , O_bw . O_ad ) ) { return O_co ; } let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } var O_hm = O_fx + O_da ; O_co . O_fx = O_hm ; O_co . O_hj = O_ga + O_gb ; let O_gc = max ( O_k , O_gq ) / 2 ; O_co . O_hi = O_fz + O_gc ; O_co . r = O_fz - O_gc ; let O_fy = O_co . O_hi ; O_co . O_dm = O_fv ( O_fw , O_hm , O_fy , O_fz , O_ga , O_gb , O_gc ) ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; O_co . O_ga = O_ga ; O_co . O_p = O_ac ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn arcVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_k : f32 , @ location ( 4 ) O_ga : f32 , @ location ( 5 ) O_gb : f32 , @ location ( 6 ) O_o : f32 , @ location ( 7 ) O_p : f32 , @ location ( 8 ) O_q : f32 , ) -> O_hg { var O_co : O_hg ; O_co = O_hk ( O_ct , O_fw , O_fx , O_fz , O_k , O_ga , O_gb , O_p , vec2f ( 0 , 0 ) , O_bw . O_i * MIN_PX_LENGTH_RATIO , O_q , false ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn arcTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_k : f32 , @ location ( 4 ) O_ga : f32 , @ location ( 5 ) O_gb : f32 , @ location ( 6 ) O_o : f32 , @ location ( 7 ) O_p : f32 , @ location ( 8 ) O_q : f32 , @ location ( 9 ) O_r : f32 , ) -> O_hg { var O_co : O_hg ; let O_da = O_cz ( O_r ) ; O_co = O_hk ( O_ct , O_fw , O_fx , O_fz , O_k , O_ga , O_gb , O_p , O_da , O_bw . O_i * MIN_PX_LENGTH_RATIO , O_q , false ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; return O_co ; } @ vertex fn arcTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_hg { var O_co : O_hg ; let O_hp = i32 ( O_cr ) * ARC_INSTANCE_PT_LENGTH ; var O_hq = O_p ; var O_hr = O_q ; if ( O_hq == 0 ) { O_hq = O_ci [ O_hp + 8 ] ; } if ( O_hr == - 1 ) { O_hr = O_ci [ O_hp + 10 ] ; } let O_fx = vec2 ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_fz = O_ci [ O_hp + 3 ] ; let O_k = O_ci [ O_hp + 4 ] ; let O_ga = O_ci [ O_hp + 5 ] ; let O_gb = O_ci [ O_hp + 6 ] ; O_co = O_hk ( O_ct , O_fw , O_fx , O_fz , O_k , O_ga , O_gb , O_hq , vec2f ( 0 , 0 ) , O_bw . O_i * MIN_PX_LENGTH_RATIO , O_hr , false ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } @ fragment fn arcFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_hi : f32 , @ location ( 1 ) @ interpolate ( flat ) O_fz : f32 , @ location ( 2 ) @ interpolate ( flat ) O_fx : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_ga : f32 , @ location ( 4 ) @ interpolate ( flat ) O_hj : f32 , @ location ( 5 ) O_dm : vec2 < f32 > , @ location ( 6 ) O_am : vec3 < f32 > , @ location ( 7 ) O_an : vec3 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_p : f32 , @ location ( 9 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 10 ) @ interpolate ( flat ) O_y : f32 , @ location ( 11 ) @ interpolate ( flat ) O_z : f32 , @ location ( 12 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 13 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; if ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) { discard ; } let O_de = length ( O_dm - O_fx ) ; let O_ht = sqrt ( 1.0 / 2.0 ) * O_bw . O_i ; if ( O_de >= O_hi + O_ht || O_de <= O_fz - O_ht ) { discard ; } let O_gf = O_dm - O_fx ; let O_hu = vec2 ( cos ( O_ga ) , sin ( O_ga ) ) ; let O_hv = O_hu . x * O_gf . y - O_hu . y * O_gf . x ; let O_hw = vec2 ( cos ( O_hj ) , sin ( O_hj ) ) ; let O_hx = O_hw . x * O_gf . y - O_hw . y * O_gf . x ; let O_hy = O_hj - O_ga ; var O_av = 0.0 ; let O_hz = 0.0 ; let O_ia = MATH_PI * O_ht * O_ht ; let O_ib = O_he ( O_hd , O_bw . O_ad ) ; if ( ( O_hy < MATH_PI && ( O_hv < 0.0 || O_hx > 0.0 ) ) || ( O_hy >= MATH_PI && ( O_hv < 0.0 && O_hx > 0.0 ) ) ) { let O_ic = ( O_hi - O_fz ) / 2.0 ; let O_fy = ( O_hi + O_fz ) / 2.0 ; let O_id = O_fx + O_hu * O_fy ; let O_ie = length ( O_dm - O_id ) ; let O_if = O_fx + O_hw * O_fy ; let O_ig = length ( O_dm - O_if ) ; let O_ih = min ( O_ie , O_ig ) ; if ( O_ih >= O_ic + O_ht ) { discard ; } else if ( O_ih <= O_ic - O_ht ) { if ( O_ib && ( O_ie < O_ic - O_bw . O_i * 2 || O_ig < O_ic - O_bw . O_i * 2 ) ) { discard ; } O_av = 1 ; } else { O_av = smoothstep ( O_hz , O_ia , O_db ( O_ic , O_ht , O_ih ) ) ; } } else { if ( O_de > O_hi - O_ht ) { O_av = smoothstep ( O_hz , O_ia , O_db ( O_hi , O_ht , O_de ) ) ; } else if ( O_de < O_fz + O_ht ) { O_av = smoothstep ( O_hz , O_ia , O_ia - O_db ( O_fz , O_ht , O_de ) ) ; } else { if ( O_ib && O_de < O_hi - O_bw . O_i * 2 && O_de > O_fz + O_bw . O_i * 2 ) { discard ; } O_av = 1 ; } } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = vec4f ( O_ap . rgb , O_ap . a * O_av ) ; } let O_ii = O_cn ( O_y , O_z , O_ap , O_av , O_ab ) ; O_co . O_bb = O_ii . O_cl ; O_co . O_bc = O_ii . O_cm ; return O_co ; } struct O_ij { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) r : f32 , @ location ( 2 ) O_am : vec3 < f32 > , @ location ( 3 ) O_an : vec3 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_p : f32 , @ location ( 5 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 6 ) @ interpolate ( flat ) O_y : f32 , @ location ( 7 ) @ interpolate ( flat ) O_z : f32 , @ location ( 8 ) @ interpolate ( flat ) O_fx : vec2 < f32 > , @ location ( 9 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 10 ) @ interpolate ( flat ) O_hd : f32 , } fn O_ik ( O_ct : f32 , O_fw : u32 , O_fx : vec2 < f32 > , O_fz : f32 , O_p : f32 , O_da : vec2 < f32 > , O_gq : f32 , O_i : f32 , O_q : f32 , ) -> O_ij { var O_co : O_ij ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } var O_hm = O_fx + O_da ; O_co . r = max ( O_fz , O_gq / 2 ) ; var O_il = sqrt ( 3.0 ) ; var O_fy = O_co . r ; O_fy += O_i * sqrt ( 0.5 ) ; if ( O_fw == 0 ) { O_co . O_dm = O_hm + vec2 ( - O_fy * O_il , - O_fy ) ; } else if ( O_fw == 1 ) { O_co . O_dm = O_hm + vec2 ( O_fy * O_il , - O_fy ) ; } else { O_co . O_dm = O_hm + vec2 ( 0 , 2 * O_fy ) ; } O_co . O_fx = O_hm ; O_co . O_p = O_ac ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn circleVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_o : f32 , @ location ( 4 ) O_p : f32 , @ location ( 5 ) O_q : f32 , ) -> O_ij { var O_co : O_ij ; O_co = O_ik ( O_ct , O_fw , O_fx , O_fz , O_p , vec2f ( 0 , 0 ) , O_bw . O_i * MIN_PX_LENGTH_RATIO , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn circleTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_o : f32 , @ location ( 4 ) O_p : f32 , @ location ( 5 ) O_q : f32 , @ location ( 6 ) O_r : f32 , ) -> O_ij { var O_co : O_ij ; let O_da = O_cz ( O_r ) ; O_co = O_ik ( O_ct , O_fw , O_fx , O_fz , O_p , O_da , O_bw . O_i * MIN_PX_LENGTH_RATIO , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; return O_co ; } @ vertex fn circleTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_ij { var O_co : O_ij ; let O_hp = i32 ( O_cr ) * CIRCLE_INSTANCE_PT_LENGTH ; var O_hq = O_p ; var O_hr = O_q ; if ( O_hq == 0 ) { O_hq = O_ci [ O_hp + 5 ] ; } if ( O_hr == - 1 ) { O_hr = O_ci [ O_hp + 10 ] ; } let O_fx = vec2 ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_fz = max ( O_ci [ O_hp + 3 ] , O_bw . O_i * MIN_PX_LENGTH_RATIO / 2 ) ; O_co = O_ik ( O_ct , O_fw , O_fx , O_fz , O_hq , vec2f ( 0 , 0 ) , O_bw . O_i * MIN_PX_LENGTH_RATIO , O_bw . O_i , O_hr ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs . xy , 0 , 1 ) ; return O_co ; } @ fragment fn circleFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_fz : f32 , @ location ( 2 ) O_am : vec3 < f32 > , @ location ( 3 ) O_an : vec3 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_p : f32 , @ location ( 5 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 6 ) @ interpolate ( flat ) O_y : f32 , @ location ( 7 ) @ interpolate ( flat ) O_z : f32 , @ location ( 8 ) @ interpolate ( flat ) O_fx : vec2 < f32 > , @ location ( 9 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 10 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; if ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) { discard ; } let O_de = length ( O_dm - O_fx ) ; let O_ht = sqrt ( 1.0 / 2.0 ) * O_bw . O_i ; if ( O_de >= O_fz + O_ht ) { discard ; } var O_av : f32 = 0.0 ; let O_hz = 0.0 ; let O_ia = MATH_PI * O_ht * O_ht ; let O_ib = O_he ( O_hd , O_bw . O_ad ) ; if ( O_de < O_fz - O_ht ) { if ( O_ib && O_de < O_fz - O_bw . O_i * 2 ) { discard ; } O_av = 1 ; } else if ( O_de < O_fz + O_ht ) { O_av = smoothstep ( O_hz , O_ia , O_db ( O_fz , O_ht , O_de ) ) ; } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = vec4f ( O_ap . rgb , O_ap . a * O_av ) ; } let O_ii = O_cn ( O_y , O_z , O_ap , O_av , O_ab ) ; O_co . O_bb = O_ii . O_cl ; O_co . O_bc = O_ii . O_cm ; return O_co ; } struct O_im { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_in : f32 , @ location ( 1 ) O_dm : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 4 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 5 ) O_am : vec3 < f32 > , @ location ( 6 ) O_an : vec3 < f32 > , } fn O_io ( O_ct : f32 , O_fw : u32 , O_in : f32 , O_p : f32 , O_q : f32 , ) -> O_im { var O_co : O_im ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } O_co . O_in = O_in ; O_co . O_p = O_ac ; let O_il = sqrt ( 3.0 ) ; if ( O_fw == 0 ) { O_co . O_dm = vec2 ( - O_il , - 1 ) ; } else if ( O_fw == 1 ) { O_co . O_dm = vec2 ( O_il , - 1 ) ; } else { O_co . O_dm = vec2 ( 0 , 2 ) ; } O_co . O_aa = O_cv . O_aa ; O_co . O_ab = O_cv . O_ab ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn pointVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_in : f32 , @ location ( 3 ) size : f32 , @ location ( 4 ) O_o : f32 , @ location ( 5 ) O_p : f32 , @ location ( 6 ) O_q : f32 , ) -> O_im { var O_co : O_im ; let O_fz = size * O_bv . O_i / 4 * O_in * select ( 0.5 , 1 , O_in == 1 ) ; O_co = O_io ( O_ct , O_fw , O_in , O_p , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_fx + O_co . O_dm * O_fz , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ fragment fn pointFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_in : f32 , @ location ( 1 ) O_dm : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 4 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 5 ) O_am : vec3 < f32 > , @ location ( 6 ) O_an : vec3 < f32 > , ) -> O_cj { var O_co : O_cj ; if ( O_in < 1.25 && O_dm . x * O_dm . x + O_dm . y * O_dm . y > 1 ) { discard ; } O_co . O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; O_co . O_bc = vec4f ( 0 , 0 , 0 , 0 ) ; O_co . O_bb = vec4f ( 0 , 0 , 0 , 0 ) ; return O_co ; } struct O_ip { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_gl : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_gm : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_iq : f32 , @ location ( 4 ) @ interpolate ( flat ) O_fy : f32 , @ location ( 5 ) O_am : vec3 < f32 > , @ location ( 6 ) O_an : vec3 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_p : f32 , @ location ( 8 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 9 ) @ interpolate ( flat ) O_y : f32 , @ location ( 10 ) @ interpolate ( flat ) O_z : f32 , @ location ( 11 ) @ interpolate ( flat ) O_ir : vec2 < f32 > , @ location ( 12 ) @ interpolate ( flat ) O_is : vec2 < f32 > , @ location ( 13 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 14 ) @ interpolate ( flat ) O_hd : f32 , } fn O_it ( O_ct : f32 , O_fw : u32 , O_iu : vec2 < f32 > , O_iv : f32 , O_iw : f32 , O_hy : f32 , O_fy : f32 , O_p : f32 , O_da : vec2 < f32 > , O_gq : f32 , O_i : f32 , O_q : f32 , ) -> O_ip { var O_co : O_ip ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } let O_k = max ( O_iv , O_gq ) ; let O_l = max ( O_iw , O_gq ) ; var O_ix = O_iu + O_da ; O_co . O_fy = O_fy ; O_co . O_p = O_ac ; O_co . O_iq = O_l / 2 ; let O_iy = cos ( O_hy ) ; let O_iz = sin ( O_hy ) ; let O_ja = mat2x2 < f32 > ( O_iy , O_iz , - O_iz , O_iy ) ; O_co . O_gl = O_ix + O_ja * vec2 ( 0 , - O_co . O_iq ) ; O_co . O_gm = O_ix + O_ja * vec2 ( O_k , - O_co . O_iq ) ; let O_gf = normalize ( O_co . O_gm - O_co . O_gl ) ; let O_ge = vec2 ( - O_gf . y , O_gf . x ) ; let O_ir = O_ge * O_co . O_iq ; let O_jb = O_ge * sqrt ( 0.5 ) * O_i ; var O_gr = O_gf * sqrt ( 0.5 ) * O_i ; if ( O_fw == 0 || O_fw == 5 ) { O_co . O_dm = O_co . O_gl - O_ir - O_jb - O_gr ; } else if ( O_fw == 1 ) { O_co . O_dm = O_co . O_gm - O_ir - O_jb + O_gr ; } else if ( O_fw == 2 || O_fw == 3 ) { O_co . O_dm = O_co . O_gm + O_ir + O_jb + O_gr ; } else if ( O_fw == 4 ) { O_co . O_dm = O_co . O_gl + O_ir + O_jb - O_gr ; } O_co . O_ir = O_ir ; O_co . O_is = O_gf * O_k * 0.5 ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn rectVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_iu : vec2 < f32 > , @ location ( 2 ) O_iv : f32 , @ location ( 3 ) O_iw : f32 , @ location ( 4 ) O_hy : f32 , @ location ( 5 ) O_fy : f32 , @ location ( 6 ) O_o : f32 , @ location ( 7 ) O_p : f32 , @ location ( 8 ) O_q : f32 , ) -> O_ip { var O_co : O_ip ; let O_gq = O_bw . O_i * MIN_PX_LENGTH_RATIO ; O_co = O_it ( O_ct , O_fw , O_iu , O_iv , O_iw , O_hy , O_fy , O_p , vec2f ( 0 , 0 ) , O_gq , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn rectTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_iu : vec2 < f32 > , @ location ( 2 ) O_iv : f32 , @ location ( 3 ) O_iw : f32 , @ location ( 4 ) O_hy : f32 , @ location ( 5 ) O_fy : f32 , @ location ( 6 ) O_o : f32 , @ location ( 7 ) O_p : f32 , @ location ( 8 ) O_q : f32 , @ location ( 9 ) O_r : f32 , ) -> O_ip { var O_co : O_ip ; let O_gq = O_bw . O_i * MIN_PX_LENGTH_RATIO ; let O_da = O_cz ( O_r ) ; O_co = O_it ( O_ct , O_fw , O_iu , O_iv , O_iw , O_hy , O_fy , O_p , O_da , O_gq , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; return O_co ; } @ vertex fn rectTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_ip { var O_co : O_ip ; let O_hp = i32 ( O_cr ) * RECT_INSTANCE_PT_LENGTH ; var O_hq = O_p ; if ( O_hq == 0 ) { O_hq = O_ci [ O_hp + 8 ] ; } let O_gq = O_bw . O_i * MIN_PX_LENGTH_RATIO ; let O_iu = vec2 ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_iv = O_ci [ O_hp + 3 ] ; let O_iw = O_ci [ O_hp + 4 ] ; let O_hy = O_ci [ O_hp + 5 ] ; let O_fy = O_ci [ O_hp + 6 ] ; let O_k = max ( O_iv , O_gq ) ; let O_l = max ( O_iw , O_gq ) ; O_co = O_it ( O_ct , O_fw , O_iu , O_iv , O_iw , O_hy , O_fy , O_hq , vec2f ( 0 , 0 ) , O_gq , O_bw . O_i , O_q ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } @ fragment fn rectFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_gl : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_gm : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_iq : f32 , @ location ( 4 ) @ interpolate ( flat ) O_fy : f32 , @ location ( 5 ) O_am : vec3 < f32 > , @ location ( 6 ) O_an : vec3 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_p : f32 , @ location ( 8 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 9 ) @ interpolate ( flat ) O_y : f32 , @ location ( 10 ) @ interpolate ( flat ) O_z : f32 , @ location ( 11 ) @ interpolate ( flat ) O_ir : vec2 < f32 > , @ location ( 12 ) @ interpolate ( flat ) O_is : vec2 < f32 > , @ location ( 13 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 14 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; if ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) { discard ; } var O_gf = O_gm - O_gl ; let O_jc = length ( O_gf ) ; if ( O_jc == 0 ) { O_gf = vec2 ( 1 , 0 ) ; } else { O_gf = normalize ( O_gf ) ; } let O_ge = vec2 ( O_gf . y , - O_gf . x ) ; var O_av : f32 = 1 ; let O_fx = ( O_gl + O_gm ) * 0.5 ; let O_jd = O_dm - O_fx ; let O_ej = abs ( dot ( O_gf , O_jd ) ) ; let O_ek = abs ( O_jd . x * O_gf . y - O_jd . y * O_gf . x ) ; let O_je = O_jc * 0.5 - O_fy ; let O_jf = O_iq - O_fy ; let O_ib = O_he ( O_hd , O_bw . O_ad ) ; if ( O_ib ) { let O_jg = O_ej - O_je ; let O_jh = O_ek - O_jf ; if ( O_ej > O_je && O_ek > O_jf ) { let O_ji = length ( vec2 ( O_jg , O_jh ) ) ; if ( O_ji > O_fy || O_ji < O_fy - O_bw . O_i * 2 ) { discard ; } } else { if ( O_jh < O_fy - O_bw . O_i * 2 ) { if ( O_jg < O_fy - O_bw . O_i * 2 ) { discard ; } } } } else { let O_fz = sqrt ( 1.0 / 2.0 ) * O_bw . O_i ; if ( O_ej > O_je && O_ek > O_jf ) { let O_jg = O_ej - O_je ; let O_jh = O_ek - O_jf ; let O_ji = length ( vec2 ( O_jg , O_jh ) ) ; if ( O_ji > ( O_fy + O_fz ) ) { discard ; } } let O_jj = length ( O_is ) ; let O_jk = length ( O_ir ) ; let O_jl = O_jj - O_jk ; let O_jm = vec2f ( O_jj - O_fy , O_jk - O_fy ) ; if ( O_fy >= O_fz && O_ej > O_jm . x && O_ek > O_jm . y ) { var distance = length ( vec2 ( O_ej , O_ek ) - O_jm ) ; if ( distance >= O_fy + O_fz ) { discard ; } else if ( distance < O_fy - O_fz ) { O_av = 1 ; } else { let O_ia : f32 = MATH_PI * O_fz * O_fz ; let O_hz : f32 = 0 ; var O_jn = O_db ( O_fy , O_fz , distance ) ; O_av = smoothstep ( O_hz , O_ia , O_jn ) ; } } else { let O_jo = select ( ( O_ek > - O_jl && O_ek + O_jl > O_ej ) , ( O_ej <= O_jl ) || ( O_ej - O_jl < O_ek ) , ( O_jl > 0 ) ) ; let distance = - select ( O_jj - O_ej , O_jk - O_ek , O_jo ) ; if ( distance <= - O_fz ) { O_av = 1 ; } else { let O_ia : f32 = MATH_PI * O_fz * O_fz ; let O_hz : f32 = 0 ; let O_hy = acos ( abs ( distance ) / O_fz ) ; let O_jp = abs ( O_hy * O_fz * O_fz ) ; let O_jq = sqrt ( O_fz * O_fz - distance * distance ) ; let O_jr = O_jq * abs ( distance ) ; var O_jn = O_jp - O_jr ; if ( distance < 0 ) { O_jn = O_ia - O_jn ; } O_av = smoothstep ( O_hz , O_ia * ANTIALIAS_RATIO , O_jn ) ; } } } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = vec4f ( O_ap . rgb , O_ap . a * O_av ) ; } let O_ii = O_cn ( O_y , O_z , O_ap , O_av , O_ab ) ; O_co . O_bb = vec4f ( O_ii . O_cl . rgb , O_ii . O_cl . a * O_av ) ; O_co . O_bc = vec4f ( O_ii . O_cm . rgb , O_ii . O_cm . a * O_av ) ; return O_co ; } struct O_js { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_gl : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_gm : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_iq : f32 , @ location ( 4 ) @ interpolate ( flat ) O_fy : f32 , @ location ( 5 ) O_am : vec3 < f32 > , @ location ( 6 ) O_an : vec3 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_p : f32 , @ location ( 8 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 9 ) @ interpolate ( flat ) O_y : f32 , @ location ( 10 ) @ interpolate ( flat ) O_z : f32 , @ location ( 11 ) @ interpolate ( flat ) O_ir : vec2 < f32 > , @ location ( 12 ) @ interpolate ( flat ) O_is : vec2 < f32 > , @ location ( 13 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 14 ) @ interpolate ( flat ) O_hd : f32 , } fn O_jt ( O_ct : f32 , O_fw : u32 , O_gl : vec2 < f32 > , O_gm : vec2 < f32 > , O_k : f32 , O_p : f32 , O_gp : f32 , O_gq : f32 , O_i : f32 , O_q : f32 , ) -> O_js { var O_co : O_js ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } O_co . O_p = O_ac ; let O_ju = O_go ( O_gl , O_gm , O_gp , O_k , O_gq ) ; O_co . O_gl = O_ju . O_gl ; O_co . O_gm = O_ju . O_gm ; let O_gf = O_ju . O_gf ; O_co . O_iq = max ( O_k , O_gq ) / 2 ; if ( O_gp == 1 ) { O_co . O_fy = O_co . O_iq ; } let O_ge = vec2 ( - O_gf . y , O_gf . x ) ; let O_ir = O_ge * O_co . O_iq ; let O_jb = O_ge * sqrt ( 0.5 ) * O_i ; var O_gr = O_gf * sqrt ( 0.5 ) * O_i ; if ( O_fw == 0 || O_fw == 5 ) { O_co . O_dm = O_co . O_gl - O_ir - O_jb - O_gr ; } else if ( O_fw == 1 ) { O_co . O_dm = O_co . O_gm - O_ir - O_jb + O_gr ; } else if ( O_fw == 2 || O_fw == 3 ) { O_co . O_dm = O_co . O_gm + O_ir + O_jb + O_gr ; } else if ( O_fw == 4 ) { O_co . O_dm = O_co . O_gl + O_ir + O_jb - O_gr ; } O_co . O_ir = O_ir ; O_co . O_is = O_gf * length ( O_co . O_gm - O_co . O_gl ) * 0.5 ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn lineVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_gl : vec2 < f32 > , @ location ( 2 ) O_gm : vec2 < f32 > , @ location ( 3 ) O_k : f32 , @ location ( 4 ) O_o : f32 , @ location ( 5 ) O_p : f32 , @ location ( 6 ) O_q : f32 , @ location ( 7 ) O_gp : f32 , ) -> O_js { var O_co : O_js ; O_co = O_jt ( O_ct , O_fw , O_gl , O_gm , O_k , O_p , O_gp , O_bw . O_i * MIN_PX_LENGTH_RATIO , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn lineTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_gl : vec2 < f32 > , @ location ( 2 ) O_gm : vec2 < f32 > , @ location ( 3 ) O_k : f32 , @ location ( 4 ) O_o : f32 , @ location ( 5 ) O_p : f32 , @ location ( 6 ) O_q : f32 , @ location ( 7 ) O_gp : f32 , @ location ( 8 ) O_r : f32 , ) -> O_js { var O_co : O_js ; O_co = O_jt ( O_ct , O_fw , O_gl , O_gm , O_k , O_p , O_gp , O_bw . O_i * MIN_PX_LENGTH_RATIO , O_bw . O_i , O_q ) ; let O_da = O_cz ( O_r ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm + O_da , 0 , 1 ) ; return O_co ; } @ vertex fn lineTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_js { var O_co : O_js ; let O_hp = i32 ( O_cr ) * LINE_INSTANCE_PT_LENGTH ; var O_hq = O_p ; if ( O_hq == 0 ) { O_hq = O_ci [ O_hp + 7 ] ; } let O_gl = vec2f ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_gm = vec2f ( O_ci [ O_hp + 3 ] , O_ci [ O_hp + 4 ] ) ; let O_k = O_ci [ O_hp + 5 ] ; let O_gp = O_ci [ O_hp + 9 ] ; O_co = O_jt ( O_ct , O_fw , O_gl , O_gm , O_k , O_hq , O_gp , O_bw . O_i * MIN_PX_LENGTH_RATIO , O_bw . O_i , O_q ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } @ fragment fn lineFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_gl : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_gm : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_iq : f32 , @ location ( 4 ) @ interpolate ( flat ) O_fy : f32 , @ location ( 5 ) O_am : vec3 < f32 > , @ location ( 6 ) O_an : vec3 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_p : f32 , @ location ( 8 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 9 ) @ interpolate ( flat ) O_y : f32 , @ location ( 10 ) @ interpolate ( flat ) O_z : f32 , @ location ( 11 ) @ interpolate ( flat ) O_ir : vec2 < f32 > , @ location ( 12 ) @ interpolate ( flat ) O_is : vec2 < f32 > , @ location ( 13 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 14 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; if ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) { discard ; } var O_gf = O_gm - O_gl ; let O_jc = length ( O_gf ) ; if ( O_jc == 0 ) { O_gf = vec2 ( 1 , 0 ) ; } else { O_gf = normalize ( O_gf ) ; } let O_ge = vec2 ( O_gf . y , - O_gf . x ) ; var O_av : f32 = 1 ; let O_fx = ( O_gl + O_gm ) * 0.5 ; let O_jd = O_dm - O_fx ; let O_ej = abs ( dot ( O_gf , O_jd ) ) ; let O_ek = abs ( O_jd . x * O_gf . y - O_jd . y * O_gf . x ) ; let O_je = O_jc * 0.5 - O_fy ; let O_jf = O_iq - O_fy ; let O_ib = O_he ( O_hd , O_bw . O_ad ) ; if ( O_ib ) { let O_jg = O_ej - O_je ; let O_jh = O_ek - O_jf ; if ( O_ej > O_je && O_ek > O_jf ) { let O_ji = length ( vec2 ( O_jg , O_jh ) ) ; if ( O_ji > O_fy || O_ji < O_fy - O_bw . O_i * 2 ) { discard ; } } else { if ( O_jh < O_fy - O_bw . O_i * 2 ) { if ( O_jg < O_fy - O_bw . O_i * 2 ) { discard ; } } } } else { let O_fz = sqrt ( 1.0 / 2.0 ) * O_bw . O_i ; if ( O_ej > O_je && O_ek > O_jf ) { let O_jg = O_ej - O_je ; let O_jh = O_ek - O_jf ; let O_ji = length ( vec2 ( O_jg , O_jh ) ) ; if ( O_ji > ( O_fy + O_fz ) ) { discard ; } } let O_jj = length ( O_is ) ; let O_jk = length ( O_ir ) ; let O_jl = O_jj - O_jk ; let O_jm = vec2f ( O_jj - O_fy , O_jk - O_fy ) ; if ( O_fy >= O_fz && O_ej > O_jm . x && O_ek > O_jm . y ) { var distance = length ( vec2 ( O_ej , O_ek ) - O_jm ) ; if ( distance >= O_fy + O_fz ) { discard ; } else if ( distance <= O_fy - O_fz ) { O_av = 1 ; } else { let O_ia : f32 = MATH_PI * O_fz * O_fz ; let O_hz : f32 = 0 ; let O_df = acos ( ( O_fy * O_fy + distance * distance - O_fz * O_fz ) / ( 2 * O_fy * distance ) ) ; let O_dg = acos ( ( O_fz * O_fz + distance * distance - O_fy * O_fy ) / ( 2 * O_fz * distance ) ) ; let O_jv = O_df * O_fy * O_fy ; let O_jw = O_dg * O_fz * O_fz ; let O_jr = O_fy * sin ( O_df ) * distance ; var O_jn = O_jv + O_jw - O_jr ; O_av = smoothstep ( O_hz , O_ia , O_jn ) ; } } else { let O_jo = select ( ( O_ek > - O_jl && O_ek + O_jl > O_ej ) , ( O_ej <= O_jl ) || ( O_ej - O_jl < O_ek ) , ( O_jl > 0 ) ) ; let distance = - select ( O_jj - O_ej , O_jk - O_ek , O_jo ) ; if ( distance <= - O_fz ) { O_av = 1 ; } else { let O_ia : f32 = MATH_PI * O_fz * O_fz ; let O_hz : f32 = 0 ; let O_hy = acos ( abs ( distance ) / O_fz ) ; let O_jp = abs ( O_hy * O_fz * O_fz ) ; let O_jq = sqrt ( O_fz * O_fz - distance * distance ) ; let O_jr = O_jq * abs ( distance ) ; var O_jn = O_jp - O_jr ; if ( distance < 0 ) { O_jn = O_ia - O_jn ; } O_av = smoothstep ( O_hz , O_ia * ANTIALIAS_RATIO , O_jn ) ; } } } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = vec4f ( O_ap . rgb , O_ap . a * O_av ) ; } let O_ii = O_cn ( O_y , O_z , O_ap , O_av , O_ab ) ; O_co . O_bb = vec4f ( O_ii . O_cl . rgb , O_ii . O_cl . a * O_av ) ; O_co . O_bc = vec4f ( O_ii . O_cm . rgb , O_ii . O_cm . a * O_av ) ; return O_co ; } struct O_jx { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_ji : f32 , @ location ( 1 ) @ interpolate ( flat ) O_jy : f32 , @ location ( 2 ) @ interpolate ( flat ) O_jz : f32 , @ location ( 3 ) @ interpolate ( flat ) O_p : f32 , @ location ( 4 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 5 ) @ interpolate ( flat ) O_y : f32 , @ location ( 6 ) @ interpolate ( flat ) O_z : f32 , @ location ( 7 ) @ interpolate ( flat ) O_gf : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_gl : vec2 < f32 > , @ location ( 9 ) O_dm : vec2 < f32 > , @ location ( 10 ) @ interpolate ( flat ) O_ir : vec2 < f32 > , @ location ( 11 ) @ interpolate ( flat ) O_ka : f32 , @ location ( 12 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 13 ) O_am : vec3 < f32 > , @ location ( 14 ) O_an : vec3 < f32 > , @ location ( 15 ) @ interpolate ( flat ) O_hd : f32 , } fn O_kb ( O_ct : f32 , O_fw : u32 , O_gl : vec2 < f32 > , O_gm : vec2 < f32 > , O_jc : f32 , O_kc : f32 , O_p : f32 , O_da : vec2 < f32 > , O_i : f32 , O_q : f32 , ) -> O_jx { var O_co : O_jx ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } O_co . O_gl = O_gl ; O_co . O_jy = O_jc ; O_co . O_jz = O_kc ; O_co . O_p = O_ac ; var O_dm : vec2 < f32 > ; let O_gf = normalize ( O_gm - O_gl ) ; O_co . O_gf = O_gf ; let O_ge = vec2 ( - O_gf . y , O_gf . x ) ; let O_kd = O_i * 0.5 ; let O_ir = O_ge * O_kd ; let O_jb = O_ge * sqrt ( 2 ) * O_kd ; let O_ke = O_ir + O_jb ; if ( O_fw == 0 || O_fw == 5 ) { O_dm = O_gl - O_ke ; O_co . O_ji = 0 ; } else if ( O_fw == 1 ) { O_dm = O_gm - O_ke ; O_co . O_ji = distance ( O_gl , O_gm ) / O_kd ; } else if ( O_fw == 2 || O_fw == 3 ) { O_dm = O_gm + O_ke ; O_co . O_ji = distance ( O_gl , O_gm ) / O_kd ; } else if ( O_fw == 4 ) { O_dm = O_gl + O_ke ; O_co . O_ji = 0 ; } O_co . O_ir = O_ir ; O_dm += O_da ; O_co . O_dm = O_dm ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn lineSegmentVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_gl : vec2 < f32 > , @ location ( 2 ) O_gm : vec2 < f32 > , @ location ( 3 ) O_jc : f32 , @ location ( 4 ) O_kc : f32 , @ location ( 5 ) O_o : f32 , @ location ( 6 ) O_p : f32 , @ location ( 7 ) O_q : f32 , ) -> O_jx { var O_co : O_jx ; O_co = O_kb ( O_ct , O_fw , O_gl , O_gm , O_jc , O_kc , O_p , vec2f ( 0 , 0 ) , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn lineSegmentTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_gl : vec2 < f32 > , @ location ( 2 ) O_gm : vec2 < f32 > , @ location ( 3 ) O_jc : f32 , @ location ( 4 ) O_kc : f32 , @ location ( 5 ) O_o : f32 , @ location ( 6 ) O_p : f32 , @ location ( 7 ) O_q : f32 , @ location ( 8 ) O_r : f32 , ) -> O_jx { var O_co : O_jx ; let O_da = O_cz ( O_r ) ; O_co = O_kb ( O_ct , O_fw , O_gl , O_gm , O_jc , O_kc , O_p , O_da , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; return O_co ; } @ vertex fn lineSegmentTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_jx { var O_co : O_jx ; let O_hp = i32 ( O_cr ) * LINESEGMENT_INSTANCE_PT_LENGTH ; var O_hq = O_p ; if ( O_hq == 0 ) { O_hq = O_ci [ O_hp + 8 ] ; } let O_gl = vec2 ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_gm = vec2 ( O_ci [ O_hp + 3 ] , O_ci [ O_hp + 4 ] ) ; let O_jc = O_ci [ O_hp + 5 ] ; let O_kc = O_ci [ O_hp + 6 ] ; O_co = O_kb ( O_ct , O_fw , O_gl , O_gm , O_jc , O_kc , O_p , vec2f ( 0 , 0 ) , O_bw . O_i , O_q ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } @ fragment fn lineSegmentFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_ji : f32 , @ location ( 1 ) @ interpolate ( flat ) O_jy : f32 , @ location ( 2 ) @ interpolate ( flat ) O_jz : f32 , @ location ( 3 ) @ interpolate ( flat ) O_p : f32 , @ location ( 4 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 5 ) @ interpolate ( flat ) O_y : f32 , @ location ( 6 ) @ interpolate ( flat ) O_z : f32 , @ location ( 7 ) @ interpolate ( flat ) O_gf : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_gl : vec2 < f32 > , @ location ( 9 ) O_dm : vec2 < f32 > , @ location ( 10 ) @ interpolate ( flat ) O_ir : vec2 < f32 > , @ location ( 11 ) @ interpolate ( flat ) O_ka : f32 , @ location ( 12 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 13 ) O_am : vec3 < f32 > , @ location ( 14 ) O_an : vec3 < f32 > , @ location ( 15 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; if ( ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) || O_ji % O_jy > O_jz ) { discard ; } var O_av : f32 = 0 ; let O_kf = O_dm - O_gl ; let O_jk = length ( O_ir ) ; let O_fz = sqrt ( 1.0 / 2.0 ) * O_bw . O_i ; let distance : f32 = abs ( dot ( O_kf , vec2 ( O_gf . y , - O_gf . x ) ) ) - O_jk ; if ( distance <= - O_fz ) { O_av = 1 ; } else { let O_ia : f32 = MATH_PI * O_fz * O_fz ; let O_hz : f32 = 0 ; let O_hy = acos ( abs ( distance ) / O_fz ) ; let O_jp = abs ( O_hy * O_fz * O_fz ) ; let O_jq = sqrt ( O_fz * O_fz - distance * distance ) ; let O_jr = O_jq * abs ( distance ) ; var O_jn = O_jp - O_jr ; if ( distance < 0 ) { O_jn = O_ia - O_jn ; } O_av = smoothstep ( O_hz , O_ia * ANTIALIAS_RATIO , O_jn ) ; } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = vec4f ( O_ap . rgb , O_ap . a * O_av ) ; } let O_ii = O_cn ( O_y , O_z , O_ap , O_av , O_ab ) ; O_co . O_bb = vec4f ( O_ii . O_cl . rgb , O_ii . O_cl . a * O_av ) ; O_co . O_bc = vec4f ( O_ii . O_cm . rgb , O_ii . O_cm . a * O_av ) ; return O_co ; } struct O_kg { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) r : f32 , @ location ( 2 ) @ interpolate ( flat ) O_hq : f32 , @ location ( 3 ) @ interpolate ( flat ) O_kh : f32 , @ location ( 4 ) @ interpolate ( flat ) O_y : f32 , @ location ( 5 ) @ interpolate ( flat ) O_z : f32 , @ location ( 6 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 7 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 8 ) O_am : vec3 < f32 > , @ location ( 9 ) O_an : vec3 < f32 > , } fn O_ki ( O_ct : f32 , O_fw : u32 , O_fx : vec2 < f32 > , O_fz : f32 , O_hq : f32 , O_kh : f32 , O_da : vec2 < f32 > , O_i : f32 , O_q : f32 , ) -> O_kg { var O_co : O_kg ; let O_cv = O_gz ( O_q ) ; if ( O_cs ( O_ct , O_hq , O_cv ) == 0 || O_cs ( O_ct , O_kh , O_cv ) == 0 ) { return O_co ; } O_co . r = max ( O_fz , O_i / 2 ) ; O_co . O_hq = O_hq ; O_co . O_kh = O_kh ; var O_il = sqrt ( 3.0 ) ; if ( O_fw == 0 ) { O_co . O_dm = O_fx + vec2 ( - O_co . r * O_il , - O_co . r ) ; } else if ( O_fw == 1 ) { O_co . O_dm = O_fx + vec2 ( O_co . r * O_il , - O_co . r ) ; } else { O_co . O_dm = O_fx + vec2 ( 0 , 2 * O_co . r ) ; } O_co . O_dm += O_da ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn semicircleVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_hq : f32 , @ location ( 4 ) O_kh : f32 , @ location ( 5 ) O_o : f32 , @ location ( 6 ) O_q : f32 , ) -> O_kg { var O_co : O_kg ; O_co = O_ki ( O_ct , O_fw , O_fx , O_fz , O_hq , O_kh , vec2f ( 0 , 0 ) , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; O_co . O_dm -= O_fx ; return O_co ; } @ vertex fn semicircleTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_hq : f32 , @ location ( 4 ) O_kh : f32 , @ location ( 5 ) O_o : f32 , @ location ( 6 ) O_q : f32 , @ location ( 7 ) O_r : f32 , ) -> O_kg { var O_co : O_kg ; let O_da = O_cz ( O_r ) ; O_co = O_ki ( O_ct , O_fw , O_fx , O_fz , O_hq , O_kh , O_da , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_dm -= O_fx ; return O_co ; } @ vertex fn semicircleTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_kg { var O_co : O_kg ; let O_hp = i32 ( O_cr ) * SEMICIRCLE_INSTANCE_PT_LENGTH ; let O_hq = O_ci [ O_hp + 4 ] ; let O_kh = O_ci [ O_hp + 5 ] ; let O_fx = vec2 ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_fz = O_ci [ O_hp + 3 ] ; O_co = O_ki ( O_ct , O_fw , O_fx , O_fz , O_hq , O_kh , vec2f ( 0 , 0 ) , O_bw . O_i , O_q ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; O_co . O_dm -= O_fx ; return O_co ; } @ fragment fn semicircleFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_fz : f32 , @ location ( 2 ) @ interpolate ( flat ) O_hq : f32 , @ location ( 3 ) @ interpolate ( flat ) O_kh : f32 , @ location ( 4 ) @ interpolate ( flat ) O_y : f32 , @ location ( 5 ) @ interpolate ( flat ) O_z : f32 , @ location ( 6 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 7 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 8 ) O_am : vec3 < f32 > , @ location ( 9 ) O_an : vec3 < f32 > , ) -> O_cj { var O_co : O_cj ; if ( ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) || length ( O_dm ) > O_fz ) { discard ; } let O_ap = select ( O_ds ( O_hq , O_am , O_an , O_aa , O_ab ) , O_ds ( O_kh , O_am , O_an , O_aa , O_ab ) , O_dm . x < 0 ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = O_ap ; } let O_ii = O_cn ( O_y , O_z , O_ap , 1 , O_ab ) ; O_co . O_bb = O_ii . O_cl ; O_co . O_bc = O_ii . O_cm ; return O_co ; } struct O_kj { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_p : f32 , @ location ( 1 ) @ interpolate ( flat ) O_kk : f32 , @ location ( 2 ) @ interpolate ( flat ) O_kl : f32 , @ location ( 3 ) O_km : vec2 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_gc : f32 , @ location ( 5 ) @ interpolate ( flat ) O_iq : f32 , @ location ( 6 ) O_dm : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_fx : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 9 ) @ interpolate ( flat ) O_y : f32 , @ location ( 10 ) @ interpolate ( flat ) O_z : f32 , @ location ( 11 ) O_am : vec3 < f32 > , @ location ( 12 ) O_an : vec3 < f32 > , @ location ( 13 ) @ interpolate ( flat ) O_kn : f32 , @ location ( 14 ) @ interpolate ( flat ) O_ab : f32 , } fn O_ko ( O_ct : f32 , O_fw : u32 , O_e : vec2 < f32 > , O_k : f32 , O_l : f32 , O_hy : f32 , O_kp : f32 , O_kk : f32 , O_kl : f32 , O_p : f32 , O_bf : f32 , O_i : f32 , O_kq : f32 , MATH_PI : f32 , SDF_WIDTH : f32 , SDF_HEIGHT : f32 , O_q : f32 , ) -> O_kj { var O_co : O_kj ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } O_co . O_p = O_ac ; O_co . O_kk = O_kk ; O_co . O_kl = O_kl ; O_co . O_fx = O_e ; var O_kn = 1.0 ; let O_kr = O_l / O_kq ; if ( O_bf == 1 && O_kr > O_kp ) { O_kn = O_kp / O_kr ; } let O_gc = O_k * 0.5 * O_kn ; let O_iq = O_l * 0.5 * O_kn ; O_co . O_gc = O_gc ; O_co . O_iq = O_iq ; var O_dm : vec2 < f32 > ; let O_jk = O_i ; let O_dr = O_iq / O_gc ; let O_df = atan ( O_dr ) ; let O_dg = ( MATH_PI * 0.5 - O_df ) * 0.5 ; let O_ks : f32 = O_jk / sin ( O_df ) ; let O_kt : f32 = O_jk / tan ( O_dg ) ; let O_gj = 0.25 ; let O_ku = O_gc * 2 ; let O_kv = SDF_HEIGHT / SDF_WIDTH ; var O_ej = O_ku * O_iq / ( O_kv * O_iq + O_ku ) ; var O_ek = O_kv * O_ej ; let O_kw = O_gc / O_ej ; let O_kx = ( O_iq - O_ek * 0.5 ) / O_ek ; if ( O_fw == 0 ) { O_dm = vec2 ( - O_gc - O_jk , - O_iq - O_kt ) ; O_co . O_km = vec2 ( 0 , - O_kx ) ; } else if ( O_fw == 1 ) { O_dm = vec2 ( O_ks , 0 ) ; O_co . O_km = vec2 ( O_kw , 0.5 ) ; } else if ( O_fw == 2 ) { O_dm = vec2 ( - O_gc - O_jk , O_iq + O_kt ) ; O_co . O_km = vec2 ( 0 , 1 + O_kx ) ; } else if ( O_fw == 3 ) { O_dm = vec2 ( O_gc + O_jk , - O_iq - O_kt ) ; O_co . O_km = vec2 ( 1 , - O_kx ) ; } else if ( O_fw == 4 ) { O_dm = vec2 ( O_gc + O_jk , O_iq + O_kt ) ; O_co . O_km = vec2 ( 1 , 1 + O_kx ) ; } else { O_dm = vec2 ( - O_ks , 0 ) ; O_co . O_km = vec2 ( 1 - O_kw , 0.5 ) ; } if ( O_fw < 3 ) { O_co . O_km . x -= O_gj ; } else { O_co . O_km . x += O_gj ; } O_co . O_kn = O_kn ; let cos = cos ( O_hy ) ; let sin = sin ( O_hy ) ; O_dm = mat2x2 ( cos , sin , - sin , cos ) * O_dm ; O_dm += O_e ; O_co . O_dm = O_dm ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn drcVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_e : vec2 < f32 > , @ location ( 2 ) O_k : f32 , @ location ( 3 ) O_l : f32 , @ location ( 4 ) O_hy : f32 , @ location ( 5 ) O_ky : f32 , @ location ( 6 ) O_kp : f32 , @ location ( 7 ) O_kk : f32 , @ location ( 8 ) O_kl : f32 , @ location ( 9 ) O_o : f32 , @ location ( 10 ) O_q : f32 , @ location ( 11 ) O_p : f32 , ) -> O_kj { var O_co : O_kj ; if ( O_bw . O_bf == 1 && O_ky < O_bv . O_i ) { return O_co ; } O_co = O_ko ( O_ct , O_fw , O_e , O_k , O_l , O_hy , O_kp , O_kk , O_kl , O_p , O_bw . O_bf , O_bw . O_i , O_bv . O_i , MATH_PI , SDF_WIDTH , SDF_HEIGHT , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm . xy , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ fragment fn drcFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_p : f32 , @ location ( 1 ) @ interpolate ( flat ) O_kk : f32 , @ location ( 2 ) @ interpolate ( flat ) O_kl : f32 , @ location ( 3 ) O_km : vec2 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_gc : f32 , @ location ( 5 ) @ interpolate ( flat ) O_iq : f32 , @ location ( 6 ) O_dm : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_fx : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 9 ) @ interpolate ( flat ) O_y : f32 , @ location ( 10 ) @ interpolate ( flat ) O_z : f32 , @ location ( 11 ) O_am : vec3 < f32 > , @ location ( 12 ) O_an : vec3 < f32 > , @ location ( 13 ) @ interpolate ( flat ) O_kn : f32 , @ location ( 14 ) @ interpolate ( flat ) O_ab : f32 , ) -> O_cj { var O_co : O_cj ; var O_av : f32 = 1 ; let O_i = O_bw . O_i ; let O_dr = O_iq / O_gc ; let O_kz = atan ( O_dr ) ; let O_gf = vec2f ( 1.0 , 0 ) ; var O_la = 1.0 ; if ( dot ( O_gf , O_dm - O_fx ) < 0 ) { O_la = - 1.0 ; } var O_lb = normalize ( vec2f ( O_la , O_dr ) ) ; if ( O_ed ( O_dm - O_fx , O_gf ) > 0 ) { O_lb = normalize ( vec2f ( O_la , - O_dr ) ) ; } let O_kf = O_dm - O_fx ; var O_jk = 0.5 * O_i ; if ( O_bw . O_bg == 1 ) { O_jk = 1.5 * O_i ; } let O_fz = sqrt ( 1.0 / 2.0 ) * O_i ; let distance : f32 = abs ( dot ( O_kf , vec2 ( O_lb . y , - O_lb . x ) ) ) - O_jk ; let O_lc = abs ( dot ( O_kf , O_lb ) ) ; if ( distance <= - O_fz ) { O_av = 1 ; } else { let O_ia : f32 = MATH_PI * O_fz * O_fz ; let O_hz : f32 = 0 ; let O_hy = acos ( abs ( distance ) / O_fz ) ; let O_jp = abs ( O_hy * O_fz * O_fz ) ; let O_jq = sqrt ( O_fz * O_fz - distance * distance ) ; let O_jr = O_jq * abs ( distance ) ; var O_jn = O_jp - O_jr ; if ( distance < 0 ) { O_jn = O_ia - O_jn ; } O_av = smoothstep ( O_hz , O_ia * ANTIALIAS_RATIO , O_jn ) ; } if ( O_bw . O_bg == 1 ) { if ( O_lc >= ( O_gc ) / cos ( O_kz ) - O_fz ) { discard ; } } else { let O_ej = abs ( dot ( O_gf , O_dm - O_fx ) ) ; let O_ld = dot ( O_gf , O_dm - O_fx ) ; if ( O_ej >= O_gc - O_i ) { O_av = 1 ; } let O_kw = O_km . x ; let O_kx = 1 - O_km . y ; if ( O_av == 0 && ( O_kw > 1 || O_kw < 0 || O_kx > 1 || O_kx < 0 ) ) { discard ; } var O_cr : f32 = 0 ; if ( O_ld < 0 ) { O_cr = O_ce [ u32 ( O_kk ) ] ; } else if ( O_ld > 0 ) { O_cr = O_ce [ u32 ( O_kl ) ] ; } let O_ff = clamp ( O_kw , 0 , 1 ) ; let O_fg = clamp ( O_kx , 0 , 1 ) ; let O_da = O_cr * SDF_WIDTH * SDF_HEIGHT ; let O_ep = SDF_WIDTH ; let O_eq = SDF_HEIGHT ; let O_le : f32 = O_en ( vec2 ( O_ff , O_fg ) , O_ep , O_eq , O_da ) ; let O_lf = fwidth ( O_le ) * 0.7 ; let O_lg = smoothstep ( 0.5 - O_lf , 0.5 + O_lf , O_le ) ; if ( O_av == 0 ) { O_av = O_lg ; } } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) || O_bw . O_bf == 1 ) { O_co . O_ap = vec4 ( O_ap . rgb , O_ap . a * O_av ) ; } let O_ii = O_cn ( O_y , O_z , O_ap , 1 , O_ab ) ; O_co . O_bb = vec4 ( O_ii . O_cl . rgb , O_ii . O_cl . a * O_av ) ; O_co . O_bc = vec4 ( O_ii . O_cm . rgb , O_ii . O_cl . a * O_av ) ; return O_co ; } struct O_lh { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_km : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_li : f32 , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 4 ) O_dm : vec2 < f32 > , @ location ( 5 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 6 ) O_am : vec3 < f32 > , @ location ( 7 ) O_an : vec3 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_hd : f32 , } fn O_lj ( O_ct : f32 , O_fw : u32 , O_e : vec2 < f32 > , O_k : f32 , O_l : f32 , O_hy : f32 , O_lk : f32 , O_li : f32 , O_kp : f32 , O_p : f32 , O_da : vec2 < f32 > , O_kq : f32 , O_ll : f32 , O_q : f32 , O_lm : f32 , O_ln : f32 , O_lo : bool , O_ky : f32 , ) -> O_lh { var O_co : O_lh ; if ( O_lo && O_ky < O_bv . O_i ) { return O_co ; } let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } O_co . O_p = O_ac ; O_co . O_li = O_li ; let O_gc = O_k / 2 ; let O_iq = O_l / 2 ; var O_dm : vec2 < f32 > ; if ( O_ll == 0 ) { if ( O_fw == 0 || O_fw == 5 ) { O_dm = vec2 ( - O_gc , - O_iq ) ; O_co . O_km = vec2 ( 0 , 0 ) ; } else if ( O_fw == 1 ) { O_dm = vec2 ( O_gc , - O_iq ) ; O_co . O_km = vec2 ( O_lk , 0 ) ; } else if ( O_fw == 2 || O_fw == 3 ) { O_dm = vec2 ( O_gc , O_iq ) ; O_co . O_km = vec2 ( O_lk , 1 ) ; } else if ( O_fw == 4 ) { O_dm = vec2 ( - O_gc , O_iq ) ; O_co . O_km = vec2 ( 0 , 1 ) ; } } else { if ( O_fw == 0 || O_fw == 5 ) { O_dm = vec2 ( - O_gc , - O_iq ) ; O_co . O_km = vec2 ( O_lk , 0 ) ; } else if ( O_fw == 1 ) { O_dm = vec2 ( O_gc , - O_iq ) ; O_co . O_km = vec2 ( 0 , 0 ) ; } else if ( O_fw == 2 || O_fw == 3 ) { O_dm = vec2 ( O_gc , O_iq ) ; O_co . O_km = vec2 ( 0 , 1 ) ; } else if ( O_fw == 4 ) { O_dm = vec2 ( - O_gc , O_iq ) ; O_co . O_km = vec2 ( O_lk , 1 ) ; } } O_dm . x += O_k * O_lm ; O_dm . y += O_l * O_ln ; if ( O_lo ) { let O_kr = O_l / O_kq ; if ( O_kr > O_kp ) { O_dm *= O_kp / O_kr ; } } let cos = cos ( O_hy ) ; let sin = sin ( O_hy ) ; O_dm = mat2x2 ( cos , sin , - sin , cos ) * O_dm ; O_dm += O_e ; O_dm += O_da ; O_co . O_dm = O_dm ; O_co . O_aa = O_cv . O_aa ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn stringVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_e : vec2 < f32 > , @ location ( 2 ) O_k : f32 , @ location ( 3 ) O_l : f32 , @ location ( 4 ) O_hy : f32 , @ location ( 5 ) O_lk : f32 , @ location ( 6 ) O_li : f32 , @ location ( 7 ) O_lp : f32 , @ location ( 8 ) O_kp : f32 , @ location ( 9 ) O_q : f32 , @ location ( 10 ) O_p : f32 , @ location ( 11 ) O_o : f32 , @ location ( 12 ) O_lm : f32 , @ location ( 13 ) O_ln : f32 , ) -> O_lh { var O_co : O_lh ; O_co = O_lj ( O_ct , O_fw , O_e , O_k , O_l , O_hy , O_lk , O_li , O_kp , O_p , vec2f ( 0 , 0 ) , O_bv . O_i , O_bv . O_j , O_q , O_lm , O_ln , true , O_lp ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm . xy , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn stringTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_e : vec2 < f32 > , @ location ( 2 ) O_k : f32 , @ location ( 3 ) O_l : f32 , @ location ( 4 ) O_hy : f32 , @ location ( 5 ) O_lk : f32 , @ location ( 6 ) O_li : f32 , @ location ( 7 ) O_lp : f32 , @ location ( 8 ) O_kp : f32 , @ location ( 9 ) O_q : f32 , @ location ( 10 ) O_p : f32 , @ location ( 11 ) O_o : f32 , @ location ( 12 ) O_lm : f32 , @ location ( 13 ) O_ln : f32 , @ location ( 14 ) O_r : f32 , ) -> O_lh { var O_co : O_lh ; let O_da = O_cz ( O_r ) ; O_co = O_lj ( O_ct , O_fw , O_e , O_k , O_l , O_hy , O_lk , O_li , O_kp , O_p , O_da , O_bv . O_i , O_bv . O_j , O_q , O_lm , O_ln , true , O_lp ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm . xy , 0 , 1 ) ; return O_co ; } @ vertex fn stringTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_lh { var O_co : O_lh ; let O_lq = u32 ( O_cr ) >> STRING_LEVEL_BITLENGTH ; var O_hp = i32 ( O_lq ) * STRING_INSTANCE_PT_LENGTH ; var O_hq = O_p ; if ( O_hq == 0 ) { O_hq = O_ci [ O_hp + 11 ] ; } let O_li = O_ci [ O_hp + 7 ] ; let O_k = O_ci [ O_hp + 3 ] ; let O_l = O_ci [ O_hp + 4 ] ; let O_lk = O_ci [ O_hp + 6 ] ; let O_kp = O_ci [ O_hp + 9 ] ; let O_hy = O_ci [ O_hp + 5 ] ; let O_e = vec2 ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_lm = O_ci [ O_hp + 13 ] ; let O_ln = O_ci [ O_hp + 14 ] ; let O_lp = O_ci [ O_hp + 8 ] ; O_co = O_lj ( O_ct , O_fw , O_e , O_k , O_l , O_hy , O_lk , O_li , O_kp , O_hq , vec2f ( 0 , 0 ) , O_bv . O_i , O_bv . O_j , O_q , O_lm , O_ln , true , O_lp ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs . xy , 0 , 1 ) ; return O_co ; } @ fragment fn stringFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_km : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_li : f32 , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 4 ) O_dm : vec2 < f32 > , @ location ( 5 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 6 ) O_am : vec3 < f32 > , @ location ( 7 ) O_an : vec3 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; let O_lr = CHAR_WIDTH + CHAR_HEIGHT / 8.0 ; let O_ls = CHAR_HEIGHT + CHAR_HEIGHT / 4.0 ; let O_lt = u32 ( CANVAS_WIDTH / O_lr ) ; let O_cr = O_cb [ u32 ( O_li + O_km . x ) ] ; let O_lu = O_cr / O_lt ; let O_lv = O_cr % O_lt ; let O_lw = O_lr * f32 ( O_lv ) ; let O_lx = O_ls * f32 ( O_lu ) ; let O_ly = O_lw ; let O_lz = O_lx ; let O_ma = O_ly + CHAR_WIDTH ; let O_mb = O_lz + CHAR_HEIGHT ; let O_mc = O_ly / CANVAS_WIDTH ; let O_md = O_ma / CANVAS_WIDTH ; let O_me = O_mb / CANVAS_HEIGHT ; let O_mf = O_lz / CANVAS_HEIGHT ; let O_ap = textureSample ( O_bz , O_by , vec2 ( O_mc + ( O_md - O_mc ) * ( O_km . x % 1.0 ) , O_me + ( O_mf - O_me ) * O_km . y ) ) ; if ( O_ap . r <= 0.1 ) { discard ; } var O_mg : vec4f ; if ( O_p > 0 ) { O_mg = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; } else { O_mg = O_bw . O_aq ; if ( O_aa == 0 && O_ab == 0 ) { var O_dr = O_bw . O_ax ; O_mg . r *= O_dr ; O_mg . g *= O_dr ; O_mg . b *= O_dr ; } } O_co . O_ap = vec4 ( O_mg . rgb , O_mg . a * O_ap . r + 0.1 ) ; if ( O_ab == 1 && O_bw . O_bk == 1 ) { O_co . O_bb = vec4 ( O_mg . rgb , O_mg . a * O_ap . r + 0.1 ) ; } return O_co ; } @ fragment fn stringRulerFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_km : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_li : f32 , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 4 ) O_dm : vec2 < f32 > , @ location ( 5 ) @ interpolate ( flat ) O_ab : f32 , ) -> @ location ( 0 ) vec4 < f32 > { let O_lr = CHAR_WIDTH + CHAR_HEIGHT / 8.0 ; let O_ls = CHAR_HEIGHT + CHAR_HEIGHT / 4.0 ; let O_lt = u32 ( CANVAS_WIDTH / O_lr ) ; let O_cr = O_cb [ u32 ( O_li + O_km . x ) ] ; let O_lu = O_cr / O_lt ; let O_lv = O_cr % O_lt ; let O_lw = O_lr * f32 ( O_lv ) ; let O_lx = O_ls * f32 ( O_lu ) ; let O_ly = O_lw ; let O_lz = O_lx ; let O_ma = O_ly + CHAR_WIDTH ; let O_mb = O_lz + CHAR_HEIGHT ; let O_mc = O_ly / CANVAS_WIDTH ; let O_md = O_ma / CANVAS_WIDTH ; let O_me = O_mb / CANVAS_HEIGHT ; let O_mf = O_lz / CANVAS_HEIGHT ; let O_ap = textureSample ( O_bz , O_by , vec2 ( O_mc + ( O_md - O_mc ) * ( O_km . x % 1.0 ) , O_me + ( O_mf - O_me ) * O_km . y ) ) ; if ( O_ap . r <= 0.1 ) { discard ; } var O_mg : vec4f ; if ( O_p > 0 ) { let O_mh = O_cw ( O_p ) ; O_mg = O_bx [ O_mh ] ; if ( O_mg . r + O_mg . g + O_mg . b == 0 ) { O_mg . r = O_bw . O_ap . r ; O_mg . g = O_bw . O_ap . g ; O_mg . b = O_bw . O_ap . b ; } O_mg . a *= O_bw . O_ap . a ; } else { O_mg = O_bw . O_aq ; } return vec4 ( O_mg . rgb , O_mg . a * O_ap . r + 0.1 ) ; } @ vertex fn scaleStringVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_e : vec2 < f32 > , @ location ( 2 ) O_k : f32 , @ location ( 3 ) O_l : f32 , @ location ( 4 ) O_hy : f32 , @ location ( 5 ) O_lk : f32 , @ location ( 6 ) O_li : f32 , @ location ( 7 ) O_q : f32 , @ location ( 8 ) O_p : f32 , @ location ( 9 ) O_o : f32 , @ location ( 10 ) O_lm : f32 , @ location ( 11 ) O_ln : f32 , ) -> O_lh { var O_co : O_lh ; O_co = O_lj ( O_ct , O_fw , O_e , O_k , O_l , O_hy , O_lk , O_li , 0 , O_p , vec2f ( 0 , 0 ) , O_bv . O_i , O_bv . O_j , O_q , O_lm , O_ln , false , 0 ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm . xy , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } struct O_mi { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) a : f32 , @ location ( 2 ) @ interpolate ( flat ) b : f32 , @ location ( 3 ) @ interpolate ( flat ) O_ga : f32 , @ location ( 4 ) @ interpolate ( flat ) O_hj : f32 , @ location ( 5 ) @ interpolate ( flat ) O_mj : f32 , @ location ( 6 ) O_am : vec3 < f32 > , @ location ( 7 ) O_an : vec3 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_p : f32 , @ location ( 9 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 10 ) @ interpolate ( flat ) O_y : f32 , @ location ( 11 ) @ interpolate ( flat ) O_z : f32 , @ location ( 12 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 13 ) @ interpolate ( flat ) O_hd : f32 , } fn O_mk ( O_dm : vec2 < f32 > , O_ml : f32 , ) -> vec2 < f32 > { let O_mm : f32 = cos ( O_ml ) ; let O_mn : f32 = sin ( O_ml ) ; let O_ej : f32 = O_dm . x * O_mm - O_dm . y * O_mn ; let O_ek : f32 = O_dm . x * O_mn + O_dm . y * O_mm ; return vec2 < f32 > ( O_ej , O_ek ) ; } fn O_mo ( O_ct : f32 , O_fw : u32 , O_fx : vec2 < f32 > , O_kv : f32 , O_fu : f32 , O_ga : f32 , O_hj : f32 , O_ml : f32 , O_mj : f32 , O_p : f32 , O_q : f32 , ) -> O_mi { var O_co : O_mi ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } O_co . a = O_kv ; O_co . b = O_fu ; O_co . O_ga = O_ga ; O_co . O_hj = O_hj ; O_co . O_mj = O_mj ; let O_mp = max ( O_kv , O_fu ) ; O_co . O_dm = vec2 ( 0 , 0 ) ; if ( O_fw == 0 ) { O_co . O_dm . x += O_mp * ( - sqrt ( 3.0 ) ) ; O_co . O_dm . y += O_mp * ( - 1.0 ) ; } else if ( O_fw == 1 ) { O_co . O_dm . x += O_mp * ( sqrt ( 3.0 ) ) ; O_co . O_dm . y += O_mp * ( - 1.0 ) ; } else { O_co . O_dm . y += O_mp * ( 2.0 ) ; } O_co . O_dm = O_mk ( O_co . O_dm , O_ml ) + O_fx ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; O_co . O_p = O_ac ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn ellipseVert ( @ builtin ( vertex_index ) O_fw : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_kv : f32 , @ location ( 3 ) O_fu : f32 , @ location ( 4 ) O_ga : f32 , @ location ( 5 ) O_hj : f32 , @ location ( 6 ) O_ml : f32 , @ location ( 7 ) O_mj : f32 , @ location ( 8 ) O_o : f32 , @ location ( 9 ) O_p : f32 , @ location ( 10 ) O_q : f32 , ) -> O_mi { var O_co : O_mi ; O_co = O_mo ( O_ct , O_fw , O_fx , O_kv , O_fu , O_ga , O_hj , O_ml , O_mj , O_p , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ fragment fn ellipseFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_kv : f32 , @ location ( 2 ) @ interpolate ( flat ) O_fu : f32 , @ location ( 3 ) @ interpolate ( flat ) O_ga : f32 , @ location ( 4 ) @ interpolate ( flat ) O_hj : f32 , @ location ( 5 ) @ interpolate ( flat ) O_mj : f32 , @ location ( 6 ) O_am : vec3 < f32 > , @ location ( 7 ) O_an : vec3 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_p : f32 , @ location ( 9 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 10 ) @ interpolate ( flat ) O_y : f32 , @ location ( 11 ) @ interpolate ( flat ) O_z : f32 , @ location ( 12 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 13 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; if ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) { discard ; } let O_mp = max ( O_kv , O_fu ) ; if ( length ( O_dm ) > O_mp ) { discard ; } let O_mq = max ( O_mj , O_bw . O_i * 2.0 ) / 2.0 ; let O_mr = O_dm . x ; let O_ms = O_dm . y ; let O_mt = O_kv + O_mq ; let O_mu = O_fu + O_mq ; let O_mv = O_kv - O_mq ; let O_mw = O_fu - O_mq ; let O_mx = pow ( O_mr , 2.0 ) ; let O_my = pow ( O_ms , 2.0 ) ; let O_mz = O_mx / pow ( O_mt , 2.0 ) + O_my / pow ( O_mu , 2.0 ) ; let O_na = O_mx / pow ( O_mv , 2.0 ) + O_my / pow ( O_mw , 2.0 ) ; if ( O_mz > 1 ) { discard ; } else if ( O_na > 1 ) { } else { discard ; } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = O_ap ; } let O_ii = O_cn ( O_y , O_z , O_ap , 1 , O_ab ) ; O_co . O_bb = O_ii . O_cl ; O_co . O_bc = O_ii . O_cm ; return O_co ; } @ vertex fn arcWireFrameVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_ga : f32 , @ location ( 4 ) O_gb : f32 , @ location ( 5 ) O_o : f32 , @ location ( 6 ) O_p : f32 , @ location ( 7 ) O_q : f32 , ) -> O_hg { var O_co : O_hg ; O_co = O_hk ( O_ct , O_fw , O_fx , O_fz , O_bw . O_i , O_ga , O_gb , O_p , vec2f ( 0 , 0 ) , O_bw . O_i , O_q , true ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn arcWireFrameTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_ga : f32 , @ location ( 4 ) O_gb : f32 , @ location ( 5 ) O_o : f32 , @ location ( 6 ) O_p : f32 , @ location ( 7 ) O_q : f32 , @ location ( 8 ) O_r : f32 , ) -> O_hg { var O_co : O_hg ; let O_da = O_cz ( O_r ) ; O_co = O_hk ( O_ct , O_fw , O_fx , O_fz , O_bw . O_i , O_ga , O_gb , O_p , O_da , O_bw . O_i , O_q , true ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn arcWireFrameTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_hg { var O_co : O_hg ; let O_hp = i32 ( O_cr ) * ARC_WIRE_FRAME_INSTANCE_PT_LENGTH ; var O_hq = O_p ; if ( O_hq == 0 ) { O_hq = O_ci [ O_hp + 7 ] ; } let O_fx = vec2f ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_fz = O_ci [ O_hp + 3 ] ; let O_ga = O_ci [ O_hp + 4 ] ; let O_gb = O_ci [ O_hp + 5 ] ; O_co = O_hk ( O_ct , O_fw , O_fx , O_fz , O_bw . O_i , O_ga , O_gb , O_hq , vec2f ( 0 , 0 ) , O_bw . O_i , O_q , true ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } @ fragment fn arcWireFrameFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_hi : f32 , @ location ( 1 ) @ interpolate ( flat ) O_fz : f32 , @ location ( 2 ) @ interpolate ( flat ) O_fx : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_ga : f32 , @ location ( 4 ) @ interpolate ( flat ) O_hj : f32 , @ location ( 5 ) O_dm : vec2 < f32 > , @ location ( 6 ) O_am : vec3 < f32 > , @ location ( 7 ) O_an : vec3 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_p : f32 , @ location ( 9 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 10 ) @ interpolate ( flat ) O_y : f32 , @ location ( 11 ) @ interpolate ( flat ) O_z : f32 , @ location ( 12 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 13 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; if ( ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) ) { discard ; } let O_de = length ( O_dm - O_fx ) ; if ( O_de > O_hi || O_de < O_fz ) { discard ; } let O_gf = O_dm - O_fx ; let O_hu = vec2 ( cos ( O_ga ) , sin ( O_ga ) ) ; let O_hv = O_hu . x * O_gf . y - O_hu . y * O_gf . x ; let O_hw = vec2 ( cos ( O_hj ) , sin ( O_hj ) ) ; let O_hx = O_hw . x * O_gf . y - O_hw . y * O_gf . x ; let O_hy = O_hj - O_ga ; if ( ( O_hy < MATH_PI && ( O_hv < 0.0 || O_hx > 0.0 ) ) || ( O_hy >= MATH_PI && ( O_hv < 0.0 && O_hx > 0.0 ) ) ) { let O_ic = ( O_hi - O_fz ) / 2.0 ; let O_fy = ( O_hi + O_fz ) / 2.0 ; let O_id = O_fx + O_hu * O_fy ; let O_ie = length ( O_dm - O_id ) ; let O_if = O_fx + O_hw * O_fy ; let O_ig = length ( O_dm - O_if ) ; if ( O_ie > O_ic && O_ig > O_ic ) { discard ; } if ( O_ie < O_ic - O_bw . O_i * 2 || O_ig < O_ic - O_bw . O_i * 2 ) { discard ; } } else if ( O_de < O_hi - O_bw . O_i * 2 && O_de > O_fz + O_bw . O_i * 2 ) { discard ; } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = O_ap ; } let O_ii = O_cn ( O_y , O_z , O_ap , 1 , O_ab ) ; O_co . O_bb = O_ii . O_cl ; O_co . O_bc = O_ii . O_cm ; return O_co ; } @ vertex fn staticArcWireFrameVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_ga : f32 , @ location ( 4 ) O_gb : f32 , @ location ( 5 ) O_nb : f32 , ) -> O_hg { var O_co : O_hg ; let O_ec = O_ca [ u32 ( O_nb ) ] ; let O_q = O_ec . O_q ; O_co = O_hk ( O_ct , O_fw , O_fx , O_fz , O_bw . O_i , O_ga , O_gb , O_ec . O_p , vec2f ( 0 , 0 ) , O_bw . O_i , O_q , true ) ; var O_hs = O_ec . O_n * vec3 ( O_co . O_dm , 1 ) ; let O_da = O_cz ( O_ec . O_r ) ; O_hs += O_da ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn staticArcWireFrameTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_hg { var O_co : O_hg ; let O_hp = i32 ( O_cr ) * STATIC_ARC_WIRE_FRAME_INSTANCE_PT_LENGTH ; let O_nb = O_ci [ O_hp + 6 ] ; let O_ec = O_ca [ u32 ( O_nb ) ] ; var O_hq = O_p ; if ( O_hq == 0 ) { O_hq = O_ec . O_p ; } let O_fx = vec2f ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_fz = O_ci [ O_hp + 3 ] ; let O_ga = O_ci [ O_hp + 4 ] ; let O_gb = O_ci [ O_hp + 5 ] ; O_co = O_hk ( O_ct , O_fw , O_fx , O_fz , O_bw . O_i , O_ga , O_gb , O_hq , vec2f ( 0 , 0 ) , O_bw . O_i , O_q , true ) ; var O_hs = O_ec . O_n * vec3 ( O_co . O_dm , 1 ) ; O_hs = O_ea ( O_eb , O_hs ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } struct O_nc { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_p : f32 , @ location ( 1 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 2 ) @ interpolate ( flat ) O_y : f32 , @ location ( 3 ) @ interpolate ( flat ) O_z : f32 , @ location ( 4 ) O_dm : vec2 < f32 > , @ location ( 5 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 6 ) O_am : vec3 < f32 > , @ location ( 7 ) O_an : vec3 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_hd : f32 , } fn O_nd ( O_ct : f32 , O_fw : u32 , O_gl : vec2 < f32 > , O_gm : vec2 < f32 > , O_p : f32 , O_da : vec2 < f32 > , O_i : f32 , O_q : f32 , ) -> O_nc { var O_co : O_nc ; let O_cv = O_gz ( O_q ) ; let O_ib = O_he ( O_cv . O_ad , O_bw . O_ad ) ; if ( ! O_ib ) { return O_co ; } let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } var O_dm : vec2 < f32 > ; let O_gf = normalize ( O_gm - O_gl ) ; let O_ge = vec2 ( - O_gf . y , O_gf . x ) ; let O_ir = vec2 ( O_ge * O_i ) ; if ( O_fw == 0 || O_fw == 5 ) { O_dm = O_gl - O_ir ; } else if ( O_fw == 1 ) { O_dm = O_gm - O_ir ; } else if ( O_fw == 2 || O_fw == 3 ) { O_dm = O_gm + O_ir ; } else if ( O_fw == 4 ) { O_dm = O_gl + O_ir ; } O_dm += O_da ; O_co . O_dm = O_dm ; O_co . O_p = O_ac ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn lineWireFrameVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_gl : vec2 < f32 > , @ location ( 2 ) O_gm : vec2 < f32 > , @ location ( 3 ) O_o : f32 , @ location ( 4 ) O_p : f32 , @ location ( 5 ) O_q : f32 , ) -> O_nc { var O_co : O_nc ; O_co = O_nd ( O_ct , O_fw , O_gl , O_gm , O_p , vec2f ( 0 , 0 ) , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn lineWireFrameTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_gl : vec2 < f32 > , @ location ( 2 ) O_gm : vec2 < f32 > , @ location ( 3 ) O_o : f32 , @ location ( 4 ) O_p : f32 , @ location ( 5 ) O_q : f32 , @ location ( 6 ) O_r : f32 , ) -> O_nc { var O_co : O_nc ; let O_da = O_cz ( O_r ) ; O_co = O_nd ( O_ct , O_fw , O_gl , O_gm , O_p , O_da , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; return O_co ; } @ vertex fn lineWireFrameTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_nc { var O_co : O_nc ; let O_hp = i32 ( O_cr ) * LINE_WIRE_INSTANCE_FRAME_PT_LENGTH ; var O_hq = O_p ; if ( O_hq == 0 ) { O_hq = O_ci [ O_hp + 6 ] ; } let O_gl = vec2f ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_gm = vec2f ( O_ci [ O_hp + 3 ] , O_ci [ O_hp + 4 ] ) ; O_co = O_nd ( O_ct , O_fw , O_gl , O_gm , O_hq , vec2f ( 0 , 0 ) , O_bw . O_i , O_q ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } @ fragment fn lineWireFrameFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_p : f32 , @ location ( 1 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 2 ) @ interpolate ( flat ) O_y : f32 , @ location ( 3 ) @ interpolate ( flat ) O_z : f32 , @ location ( 4 ) O_dm : vec2 < f32 > , @ location ( 5 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 6 ) O_am : vec3 < f32 > , @ location ( 7 ) O_an : vec3 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; if ( ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) ) { discard ; } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = O_ap ; } let O_ii = O_cn ( O_y , O_z , O_ap , 1 , O_ab ) ; O_co . O_bb = O_ii . O_cl ; O_co . O_bc = O_ii . O_cm ; return O_co ; } @ vertex fn staticLineWireFrameVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_gl : vec2 < f32 > , @ location ( 2 ) O_gm : vec2 < f32 > , @ location ( 3 ) O_nb : f32 , ) -> O_nc { var O_co : O_nc ; let O_ec = O_ca [ u32 ( O_nb ) ] ; let O_q = O_ec . O_q ; let O_da = O_cz ( O_ec . O_r ) ; let O_ne = O_ec . O_n * vec3 ( O_gl , 1 ) ; let O_nf = O_ec . O_n * vec3 ( O_gm , 1 ) ; O_co = O_nd ( O_ct , O_fw , O_ne , O_nf , O_ec . O_p , O_da , O_bw . O_i , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn staticLineWireFrameTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_nc { var O_co : O_nc ; let O_hp = i32 ( O_cr ) * STATIC_LINE_WIRE_FRAME_INSTANCE_PT_LENGTH ; let O_nb = O_ci [ O_hp + 5 ] ; let O_ec = O_ca [ u32 ( O_nb ) ] ; var O_hq = O_p ; if ( O_hq == 0 ) { O_hq = O_ec . O_p ; } let O_gl = vec2f ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_gm = vec2f ( O_ci [ O_hp + 3 ] , O_ci [ O_hp + 4 ] ) ; let O_ne = O_ec . O_n * vec3 ( O_gl , 1 ) ; let O_nf = O_ec . O_n * vec3 ( O_gm , 1 ) ; O_co = O_nd ( O_ct , O_fw , O_ne , O_nf , O_hq , vec2f ( 0 , 0 ) , O_bw . O_i , O_q ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } struct O_ng { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 1 ) O_am : vec3 < f32 > , @ location ( 2 ) O_an : vec3 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_p : f32 , @ location ( 4 ) @ interpolate ( flat ) O_nh : vec2 < f32 > , @ location ( 5 ) @ interpolate ( flat ) O_ni : vec2 < f32 > , @ location ( 6 ) @ interpolate ( flat ) O_nj : vec2 < f32 > , @ location ( 7 ) O_dm : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 9 ) @ interpolate ( flat ) O_y : f32 , @ location ( 10 ) @ interpolate ( flat ) O_z : f32 , @ location ( 11 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 12 ) @ interpolate ( flat ) O_hd : f32 , } fn O_nk ( O_ct : f32 , O_fw : u32 , O_nh : vec2 < f32 > , O_ni : vec2 < f32 > , O_nj : vec2 < f32 > , O_p : f32 , O_da : vec2 < f32 > , O_q : f32 , ) -> O_ng { var O_co : O_ng ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 || ! O_hc ( O_ac , O_cv . O_ad ) ) { return O_co ; } O_co . O_p = O_ac ; var O_dm : vec2 < f32 > ; if ( O_fw == 0 ) { O_dm = O_nh ; } else if ( O_fw == 1 ) { O_dm = O_ni ; } else { O_dm = O_nj ; } O_dm += O_da ; O_co . O_nh = O_nh ; O_co . O_ni = O_ni ; O_co . O_nj = O_nj ; O_co . O_dm = O_dm ; O_co . O_p = O_p ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn triangleVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_nh : vec2 < f32 > , @ location ( 2 ) O_ni : vec2 < f32 > , @ location ( 3 ) O_nj : vec2 < f32 > , @ location ( 4 ) O_o : f32 , @ location ( 5 ) O_p : f32 , @ location ( 6 ) O_q : f32 , ) -> O_ng { var O_co : O_ng ; O_co = O_nk ( O_ct , O_fw , O_nh , O_ni , O_nj , O_p , vec2f ( 0 , 0 ) , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn triangleTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_nh : vec2 < f32 > , @ location ( 2 ) O_ni : vec2 < f32 > , @ location ( 3 ) O_nj : vec2 < f32 > , @ location ( 4 ) O_o : f32 , @ location ( 5 ) O_p : f32 , @ location ( 6 ) O_q : f32 , @ location ( 7 ) O_r : f32 , ) -> O_ng { var O_co : O_ng ; let O_da = O_cz ( O_r ) ; O_co = O_nk ( O_ct , O_fw , O_nh , O_ni , O_nj , O_p , O_da , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; return O_co ; } @ vertex fn triangleTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_ng { var O_co : O_ng ; let O_hp = i32 ( O_cr ) * TRIANGLE_INSTANCE_PT_LENGTH ; var O_nh : vec2 < f32 > = vec2 ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; var O_ni : vec2 < f32 > = vec2 ( O_ci [ O_hp + 3 ] , O_ci [ O_hp + 4 ] ) ; var O_nj : vec2 < f32 > = vec2 ( O_ci [ O_hp + 5 ] , O_ci [ O_hp + 6 ] ) ; O_co = O_nk ( O_ct , O_fw , O_nh , O_ni , O_nj , O_p , vec2f ( 0 , 0 ) , O_q ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs . xy , 0 , 1 ) ; return O_co ; } @ fragment fn triangleFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ builtin ( front_facing ) O_cq : bool , @ location ( 1 ) O_am : vec3 < f32 > , @ location ( 2 ) O_an : vec3 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_p : f32 , @ location ( 4 ) @ interpolate ( flat ) O_nh : vec2 < f32 > , @ location ( 5 ) @ interpolate ( flat ) O_ni : vec2 < f32 > , @ location ( 6 ) @ interpolate ( flat ) O_nj : vec2 < f32 > , @ location ( 7 ) O_dm : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 9 ) @ interpolate ( flat ) O_y : f32 , @ location ( 10 ) @ interpolate ( flat ) O_z : f32 , @ location ( 11 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 12 ) @ interpolate ( flat ) O_hd : f32 , ) -> @ location ( 0 ) vec4 < f32 > { if ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) { discard ; } if ( O_dj ( O_aa , O_ab ) == 0 ) { discard ; } if ( O_y == 1 ) { if ( O_ab == 0 || O_bw . O_bk == 0 || O_p == O_bw . O_bo ) { O_cp ( O_y , O_z , O_hh , O_cq , O_ab ) ; } } if ( ! O_dk ( O_ab ) ) { discard ; } return vec4f ( 0 , 0 , 0 , 0 ) ; } @ vertex fn staticTriangleVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_nh : vec2 < f32 > , @ location ( 2 ) O_ni : vec2 < f32 > , @ location ( 3 ) O_nj : vec2 < f32 > , @ location ( 4 ) O_nb : f32 , ) -> O_ng { var O_co : O_ng ; let O_ec = O_ca [ u32 ( O_nb ) ] ; let O_r = O_ec . O_r ; let O_q = O_ec . O_q ; let O_p = O_ec . O_p ; O_co = O_nk ( O_ct , O_fw , O_nh , O_ni , O_nj , O_p , vec2f ( 0 , 0 ) , O_q ) ; var O_hs = O_ec . O_n * vec3 ( O_co . O_dm , 1 ) ; let O_da = O_cz ( O_r ) ; O_hs += O_da ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn staticTriangleTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_ng { var O_co : O_ng ; let O_hp = i32 ( O_cr ) * STATIC_TRIANGLE_INSTANCE_PT_LENGTH ; let O_nb = O_ci [ O_hp + 7 ] ; let O_ec = O_ca [ u32 ( O_nb ) ] ; var O_hq = O_p ; if ( O_hq == 0 ) { O_hq = O_ec . O_p ; } let O_nh = vec2f ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_ni = vec2f ( O_ci [ O_hp + 3 ] , O_ci [ O_hp + 4 ] ) ; let O_nj = vec2f ( O_ci [ O_hp + 5 ] , O_ci [ O_hp + 6 ] ) ; O_co = O_nk ( O_ct , O_fw , O_nh , O_ni , O_nj , O_hq , vec2f ( 0 , 0 ) , O_q ) ; var O_hs = O_ec . O_n * vec3 ( O_co . O_dm , 1 ) ; O_hs = O_ea ( O_eb , O_hs ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } struct O_nl { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) r : f32 , @ location ( 1 ) @ interpolate ( flat ) O_fx : vec2 < f32 > , @ location ( 2 ) O_dm : vec2 < f32 > , @ location ( 3 ) O_am : vec3 < f32 > , @ location ( 4 ) O_an : vec3 < f32 > , @ location ( 5 ) @ interpolate ( flat ) O_p : f32 , @ location ( 6 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 7 ) @ interpolate ( flat ) O_y : f32 , @ location ( 8 ) @ interpolate ( flat ) O_z : f32 , @ location ( 9 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 10 ) @ interpolate ( flat ) O_hd : f32 , } fn O_nm ( O_ct : f32 , O_fw : u32 , O_fx : vec2 < f32 > , O_fz : f32 , O_ga : f32 , O_gb : f32 , O_gl : vec2 < f32 > , O_gm : vec2 < f32 > , O_p : f32 , O_da : vec2 < f32 > , O_q : f32 , ) -> O_nl { var O_co : O_nl ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 || ! O_hc ( O_ac , O_cv . O_ad ) ) { return O_co ; } var O_dm = O_gk ( O_fw , O_fx , O_fz , O_ga , O_gb , O_gl , O_gm ) ; O_dm += O_da ; O_co . O_dm = O_dm ; O_co . O_fx = O_fx ; O_co . r = O_fz ; O_co . O_p = O_ac ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn cutedCircleVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_ga : f32 , @ location ( 4 ) O_gb : f32 , @ location ( 5 ) O_gl : vec2 < f32 > , @ location ( 6 ) O_gm : vec2 < f32 > , @ location ( 7 ) O_o : f32 , @ location ( 8 ) O_p : f32 , @ location ( 9 ) O_q : f32 , ) -> O_nl { var O_co : O_nl ; O_co = O_nm ( O_ct , O_fw , O_fx , O_fz , O_ga , O_gb , O_gl , O_gm , O_p , vec2f ( 0 , 0 ) , O_q ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn cutedCircleTemplateVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_ga : f32 , @ location ( 4 ) O_gb : f32 , @ location ( 5 ) O_gl : vec2 < f32 > , @ location ( 6 ) O_gm : vec2 < f32 > , @ location ( 7 ) O_o : f32 , @ location ( 8 ) O_p : f32 , @ location ( 9 ) O_q : f32 , @ location ( 10 ) O_r : f32 , ) -> O_nl { var O_co : O_nl ; O_co = O_nm ( O_ct , O_fw , O_fx , O_fz , O_ga , O_gb , O_gl , O_gm , O_p , vec2f ( 0 , 0 ) , O_q ) ; let O_da = O_cz ( O_r ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm + O_da , 0 , 1 ) ; return O_co ; } @ vertex fn cutedCircleTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_nl { var O_co : O_nl ; let O_hp = i32 ( O_cr ) * CUTED_CIRCLE_INSTANCE_PT_LENGTH ; let O_fx = vec2f ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_fz = O_ci [ O_hp + 3 ] ; let O_ga = O_ci [ O_hp + 4 ] ; let O_gb = O_ci [ O_hp + 5 ] ; let O_gl = vec2f ( O_ci [ O_hp + 6 ] , O_ci [ O_hp + 7 ] ) ; let O_gm = vec2f ( O_ci [ O_hp + 8 ] , O_ci [ O_hp + 9 ] ) ; O_co = O_nm ( O_ct , O_fw , O_fx , O_fz , O_ga , O_gb , O_gl , O_gm , O_p , vec2f ( 0 , 0 ) , O_q ) ; let O_hs = O_ea ( O_eb , O_co . O_dm ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs . xy , 0 , 1 ) ; return O_co ; } @ fragment fn cutedCircleFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ builtin ( front_facing ) O_cq : bool , @ location ( 0 ) @ interpolate ( flat ) O_fz : f32 , @ location ( 1 ) @ interpolate ( flat ) O_fx : vec2 < f32 > , @ location ( 2 ) O_dm : vec2 < f32 > , @ location ( 3 ) O_am : vec3 < f32 > , @ location ( 4 ) O_an : vec3 < f32 > , @ location ( 5 ) @ interpolate ( flat ) O_p : f32 , @ location ( 6 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 7 ) @ interpolate ( flat ) O_y : f32 , @ location ( 8 ) @ interpolate ( flat ) O_z : f32 , @ location ( 9 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 10 ) @ interpolate ( flat ) O_hd : f32 , ) -> @ location ( 0 ) vec4 < f32 > { if ( ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) || length ( O_dm - O_fx ) > O_fz ) { discard ; } if ( O_dj ( O_aa , O_ab ) == 0 ) { discard ; } if ( O_y == 1 ) { if ( O_ab == 0 || O_bw . O_bk == 0 || O_p == O_bw . O_bo ) { O_cp ( O_y , O_z , O_hh , O_cq , O_ab ) ; } } if ( ! O_dk ( O_ab ) ) { discard ; } return vec4f ( 0 , 0 , 0 , 0 ) ; } @ vertex fn staticCutedCircleVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_fx : vec2 < f32 > , @ location ( 2 ) O_fz : f32 , @ location ( 3 ) O_ga : f32 , @ location ( 4 ) O_gb : f32 , @ location ( 5 ) O_gl : vec2 < f32 > , @ location ( 6 ) O_gm : vec2 < f32 > , @ location ( 7 ) O_nb : f32 , ) -> O_nl { var O_co : O_nl ; let O_ec = O_ca [ u32 ( O_nb ) ] ; let O_r = O_ec . O_r ; let O_q = O_ec . O_q ; let O_p = O_ec . O_p ; O_co = O_nm ( O_ct , O_fw , O_fx , O_fz , O_ga , O_gb , O_gl , O_gm , O_p , vec2 ( 0 , 0 ) , O_q ) ; var O_hs = O_ec . O_n * vec3 ( O_co . O_dm , 1 ) ; let O_da = O_cz ( O_r ) ; O_hs += O_da ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ vertex fn staticCutedCircleTemplateInstanceVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_cr : f32 , @ location ( 2 ) O_eb : f32 , @ location ( 3 ) O_p : f32 , @ location ( 4 ) O_q : f32 , ) -> O_nl { var O_co : O_nl ; let O_hp = i32 ( O_cr ) * STATIC_CUTED_CIRCLE_INSTANCE_PT_LENGTH ; let O_nb = O_ci [ O_hp + 12 ] ; let O_ec = O_ca [ u32 ( O_nb ) ] ; let O_fx = vec2f ( O_ci [ O_hp + 1 ] , O_ci [ O_hp + 2 ] ) ; let O_fz = O_ci [ O_hp + 3 ] ; let O_ga = O_ci [ O_hp + 4 ] ; let O_gb = O_ci [ O_hp + 5 ] ; let O_gl = vec2f ( O_ci [ O_hp + 6 ] , O_ci [ O_hp + 7 ] ) ; let O_gm = vec2f ( O_ci [ O_hp + 8 ] , O_ci [ O_hp + 9 ] ) ; O_co = O_nm ( O_ct , O_fw , O_fx , O_fz , O_ga , O_gb , O_gl , O_gm , O_p , vec2f ( 0 , 0 ) , O_q ) ; var O_hs = O_ec . O_n * vec3 ( O_co . O_dm , 1 ) ; O_hs = O_ea ( O_eb , O_hs ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_hs , 0 , 1 ) ; return O_co ; } struct O_nn { @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_hy : f32 , @ location ( 2 ) O_am : vec3 < f32 > , @ location ( 3 ) O_an : vec3 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_p : f32 , @ location ( 5 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 6 ) @ interpolate ( flat ) O_y : f32 , @ location ( 7 ) @ interpolate ( flat ) O_z : f32 , @ location ( 8 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 9 ) @ interpolate ( flat ) O_hd : f32 , } fn O_no ( O_ct : f32 , O_fw : u32 , O_e : vec2 < f32 > , O_hy : f32 , O_q : f32 , O_gq : f32 , O_lo : bool , ) -> O_nn { var O_co : O_nn ; let O_cv = O_gz ( O_q ) ; let O_ac = O_ha ( O_bw . O_bq . O_p , O_cv . O_ac ) ; if ( O_cs ( O_ct , O_ac , O_cv ) == 0 ) { return O_co ; } let O_af = max ( O_bw . O_bq . O_af , O_gq ) ; let O_ag = max ( O_bw . O_bq . O_ag , O_gq ) ; let O_ah = max ( O_bw . O_bq . O_ah , O_gq ) ; let O_ai = max ( O_bw . O_bq . O_ai , O_gq ) ; O_co . O_p = O_ac ; let O_aj = O_bw . O_bq . O_aj ; var O_dm : vec2 < f32 > ; if ( O_fw == 0 ) { O_dm = vec2f ( 0 , 0 ) ; } else if ( O_fw == 1 ) { O_dm = vec2f ( O_af , - O_ag / 2 ) ; } else if ( O_fw == 2 ) { O_dm = vec2f ( O_af , O_ag / 2 ) ; } else if ( O_fw == 3 || O_fw == 8 ) { O_dm = vec2f ( O_af , O_ai / 2 ) ; } else if ( O_fw == 4 ) { O_dm = vec2f ( O_af + O_ah , O_ai / 2 ) ; } else if ( O_fw == 5 || O_fw == 6 ) { O_dm = vec2f ( O_af + O_ah , - O_ai / 2 ) ; } else if ( O_fw == 7 ) { O_dm = vec2f ( O_af , - O_ai / 2 ) ; } if ( O_lo ) { let O_kr = O_ag / O_bv . O_i ; if ( O_kr > O_aj ) { O_dm *= O_aj / O_kr ; } let O_iq = O_gq / 2 ; if ( O_fw == 3 || O_fw == 8 || O_fw == 4 ) { O_dm . y = O_iq ; } else if ( O_fw == 5 || O_fw == 6 || O_fw == 7 ) { O_dm . y = - O_iq ; } } let cos = cos ( O_hy ) ; let sin = sin ( O_hy ) ; O_dm = mat2x2 ( cos , sin , - sin , cos ) * O_dm ; O_dm += O_e ; O_co . O_dm = O_dm ; O_co . O_aa = O_cv . O_aa ; O_co . O_y = O_cv . O_y ; O_co . O_z = O_cv . O_z ; O_co . O_ab = O_cv . O_ab ; O_co . O_hd = O_cv . O_ad ; let O_hn = O_do ( vec4f ( O_co . O_dm , 0 , 1 ) ) ; O_co . O_am = O_hn . O_am ; O_co . O_an = O_hn . O_an ; return O_co ; } @ vertex fn scaleArrowVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_e : vec2 < f32 > , @ location ( 2 ) O_hy : f32 , @ location ( 3 ) O_o : f32 , @ location ( 4 ) O_q : f32 , ) -> O_nn { var O_co : O_nn ; let O_gq = O_bw . O_i * MIN_PX_LENGTH_RATIO ; O_co = O_no ( O_ct , O_fw , O_e , O_hy , O_q , O_gq , false ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm . xy , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } @ fragment fn scaleArrowFrag ( @ builtin ( position ) O_hh : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_dm : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_hy : f32 , @ location ( 2 ) O_am : vec3 < f32 > , @ location ( 3 ) O_an : vec3 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_p : f32 , @ location ( 5 ) @ interpolate ( flat ) O_aa : f32 , @ location ( 6 ) @ interpolate ( flat ) O_y : f32 , @ location ( 7 ) @ interpolate ( flat ) O_z : f32 , @ location ( 8 ) @ interpolate ( flat ) O_ab : f32 , @ location ( 9 ) @ interpolate ( flat ) O_hd : f32 , ) -> O_cj { var O_co : O_cj ; if ( O_bw . O_aw != 0 && O_hh . z <= O_bv . O_h ) { discard ; } let O_ap = O_ds ( O_p , O_am , O_an , O_aa , O_ab ) ; if ( O_dk ( O_ab ) ) { O_co . O_ap = O_ap ; } let O_ii = O_cn ( O_y , O_z , O_ap , 1 , O_ab ) ; O_co . O_bb = O_ii . O_cl ; O_co . O_bc = O_ii . O_cm ; return O_co ; } @ vertex fn fixedArrowVert ( @ builtin ( vertex_index ) O_fw : u32 , @ builtin ( instance_index ) O_ho : u32 , @ location ( 0 ) O_ct : f32 , @ location ( 1 ) O_e : vec2 < f32 > , @ location ( 2 ) O_hy : f32 , @ location ( 3 ) O_o : f32 , @ location ( 4 ) O_q : f32 , ) -> O_nn { var O_co : O_nn ; let O_gq = O_bw . O_i * MIN_PX_LENGTH_RATIO ; O_co = O_no ( O_ct , O_fw , O_e , O_hy , O_q , O_gq , true ) ; O_co . O_hh = O_bv . O_b * O_bw . O_n * vec4 ( O_co . O_dm . xy , 0 , 1 ) ; O_co . O_hh = O_dl ( O_co . O_hh ) ; return O_co ; } ",zQe="struct O_a { O_b : mat4x4 < f32 > , O_c : mat4x4 < f32 > , O_d : mat4x4 < f32 > , O_e : vec3 < f32 > , O_f : f32 , O_g : vec3 < f32 > , O_h : f32 , O_i : f32 , O_j : f32 , O_k : f32 , O_l : f32 , } struct O_m { O_n : mat3x2 < f32 > , O_o : f32 , O_p : f32 , O_q : f32 , O_r : f32 , O_s : f32 , O_t : f32 , } struct O_u { O_n : mat3x2 < f32 > , O_r : f32 , O_v : f32 , } struct O_w { O_x : f32 , O_y : f32 , O_z : f32 , O_aa : f32 , O_ab : f32 , O_ac : f32 , O_ad : f32 , } struct O_ae { O_p : f32 , O_af : f32 , O_ag : f32 , O_ah : f32 , O_ai : f32 , O_aj : f32 , O_ak : f32 , } struct O_al { O_am : vec3 < f32 > , O_an : vec3 < f32 > , } struct O_ao { O_ap : vec4 < f32 > , O_aq : vec4 < f32 > , O_ar : f32 , O_ab : f32 , } @ binding ( 0 ) @ group ( 0 ) var < uniform > O_as : O_a ; @ binding ( 1 ) @ group ( 0 ) var < uniform > O_at : O_ao ; @ binding ( 2 ) @ group ( 0 ) var < storage , read > O_au : array < i32 > ; @ vertex fn v_main ( @ builtin ( vertex_index ) O_av : u32 , ) -> @ builtin ( position ) vec4 < f32 > { var O_e = array < vec2 < f32 > , 6 > ( vec2 < f32 > ( 1.0 , 1.0 ) , vec2 < f32 > ( 1.0 , - 1.0 ) , vec2 < f32 > ( - 1.0 , - 1.0 ) , vec2 < f32 > ( 1.0 , 1.0 ) , vec2 < f32 > ( - 1.0 , - 1.0 ) , vec2 < f32 > ( - 1.0 , 1.0 ) ) ; return vec4 < f32 > ( O_e [ O_av ] , 0.5 , 1.0 ) ; } struct O_aw { @ location ( 0 ) O_ap : vec4 < f32 > , @ location ( 1 ) O_aq : vec4 < f32 > , } @ fragment fn v_frag ( @ builtin ( position ) O_e : vec4 < f32 > , ) -> O_aw { var O_ax : O_aw ; let O_k = i32 ( O_as . O_k * O_at . O_ar ) ; let O_l = i32 ( O_as . O_l * O_at . O_ar ) ; var O_ay = i32 ( ( O_l - 1 - i32 ( O_e . y ) ) * O_k + i32 ( O_e . x ) ) ; if ( O_at . O_ab == 1 ) { if ( O_au [ O_l * O_k * 2 + O_ay ] != 0 ) { O_ax . O_ap = O_at . O_ap ; } return O_ax ; } if ( O_au [ O_ay ] != 0 ) { O_ax . O_ap = O_at . O_ap ; } if ( O_au [ O_l * O_k + O_ay ] != 0 ) { O_ax . O_aq = O_at . O_aq ; } return O_ax ; } ",YQe="struct O_a { O_b : mat4x4 < f32 > , O_c : mat4x4 < f32 > , O_d : mat4x4 < f32 > , O_e : vec3 < f32 > , O_f : f32 , O_g : vec3 < f32 > , O_h : f32 , O_i : f32 , O_j : f32 , O_k : f32 , O_l : f32 , } struct O_m { O_n : mat3x2 < f32 > , O_o : f32 , O_p : f32 , O_q : f32 , O_r : f32 , O_s : f32 , O_t : f32 , } struct O_u { O_n : mat3x2 < f32 > , O_r : f32 , O_v : f32 , } struct O_w { O_x : f32 , O_y : f32 , O_z : f32 , O_aa : f32 , O_ab : f32 , O_ac : f32 , O_ad : f32 , } struct O_ae { O_p : f32 , O_af : f32 , O_ag : f32 , O_ah : f32 , O_ai : f32 , O_aj : f32 , O_ak : f32 , } struct O_al { O_am : vec3 < f32 > , O_an : vec3 < f32 > , } struct O_ao { O_n : mat4x4 < f32 > , O_ap : vec4 < f32 > , O_aq : vec4 < f32 > , O_ar : vec3 < f32 > , O_as : vec3 < f32 > , O_at : vec3 < f32 > , O_au : f32 , O_av : f32 , O_i : f32 , O_ad : u32 , O_aw : u32 , O_ax : f32 , O_ay : u32 , O_az : u32 , O_ba : f32 , O_bb : vec4 < f32 > , O_bc : vec4 < f32 > , O_bd : f32 , O_be : f32 , O_bf : f32 , O_bg : f32 , O_bh : f32 , O_bi : u32 , O_bj : f32 , O_bk : f32 , O_bl : vec4 < f32 > , O_bm : f32 , O_bn : f32 , O_bo : f32 , O_bp : f32 , O_bq : O_ae , @ align ( 16 ) O_br : vec3 < f32 > , O_bs : vec3 < f32 > , O_bt : vec3 < f32 > , O_bu : vec2 < f32 > , } struct O_bv { O_p : u32 , } struct O_bw { @ location ( 0 ) O_ap : vec4 < f32 > , @ location ( 1 ) O_bx : f32 , } override RENDER_HIGHLIGHT_TYPE_SHIFT : f32 ; @ binding ( 0 ) @ group ( 0 ) var < uniform > O_by : O_ao ; @ binding ( 1 ) @ group ( 0 ) var < uniform > O_bz : O_bv ; @ binding ( 2 ) @ group ( 0 ) var < storage , read > O_ca : array < vec4 < f32 > > ; @ binding ( 3 ) @ group ( 0 ) var < uniform > O_cb : O_a ; fn O_cc ( O_cd : f32 , ) -> u32 { return u32 ( O_cd ) >> u32 ( RENDER_HIGHLIGHT_TYPE_SHIFT ) ; } fn O_ce ( O_cf : vec4 < f32 > , ) -> O_al { var O_cg : O_al ; if ( O_by . O_ad == 2 ) { let O_n = O_cb . O_c * O_by . O_n ; O_cg . O_am = mat3x3 ( vec3 ( O_n [ 0 ] . xyz ) , vec3 ( O_n [ 1 ] . xyz ) , vec3 ( O_n [ 2 ] . xyz ) ) * vec3 < f32 > ( 0 , 0 , 1 ) ; let O_e = O_n * vec4 ( O_cf . xy , 0 , 1 ) ; O_cg . O_an = - O_e . xyz / O_e . w ; } return O_cg ; } fn O_ch ( O_ci : f32 , O_aa : f32 , O_ab : f32 , ) -> vec4 < f32 > { let O_p = O_cc ( O_ci ) ; var O_ap : vec4 < f32 > ; var O_cj = O_by . O_ap ; if ( O_by . O_bi == 0 && O_by . O_bm == 1 && O_ab == 1 ) { O_cj = O_by . O_bl ; } if ( O_p == 0 || ( O_by . O_bi == 0 && O_by . O_bm == 0 ) || ( O_by . O_bi == 0 && O_by . O_bm == 1 && O_ab == 0 ) ) { O_ap = O_cj ; } else { O_ap = O_ca [ O_p ] ; if ( O_ap . r + O_ap . g + O_ap . b == 0 ) { O_ap . r = O_cj . r ; O_ap . g = O_cj . g ; O_ap . b = O_cj . b ; } O_ap . a *= O_cj . a ; } var O_ck = O_by . O_ax ; if ( O_aa == 1 || O_by . O_ba == 1 || O_ab == 1 ) { O_ck = 1 ; } O_ap . r *= O_ck ; O_ap . g *= O_ck ; O_ap . b *= O_ck ; return O_ap ; } fn O_cl ( O_ci : f32 , O_am : vec3 < f32 > , O_an : vec3 < f32 > , O_aa : f32 , O_ab : f32 , ) -> vec4 < f32 > { if ( O_by . O_ad == 0 || O_by . O_ad == 1 ) { return O_ch ( O_ci , O_aa , O_ab ) ; } let O_p = O_cc ( O_ci ) ; var O_ar : vec3 < f32 > ; var O_as : vec3 < f32 > ; var O_at : vec3 < f32 > ; if ( O_p == 0 ) { O_ar = O_by . O_ar ; O_as = O_by . O_as ; O_at = O_by . O_at ; } else { let O_cj = O_ca [ O_p ] . rgb ; O_ar = O_cj ; O_as = O_ar ; O_at = O_ar ; } var O_cm = O_ar * O_by . O_br ; var O_cn = normalize ( O_am ) ; var O_bt = O_by . O_bt ; var O_co = abs ( dot ( O_cn , O_bt ) ) * O_as * O_by . O_bs ; var O_cp = - 2.0 * O_cn * dot ( O_bt , O_cn ) + O_bt ; var O_cq = normalize ( O_an ) ; var O_cr = abs ( dot ( O_cp , O_cq ) ) ; var O_cs = O_at * O_by . O_bs * pow ( O_cr , 300.0 ) * O_by . O_au * 0.1 ; var O_ap = vec4 ( O_cm + O_co + O_cs , O_by . O_av ) ; return O_ap ; } struct O_ct { @ builtin ( position ) O_cu : vec4 < f32 > , @ location ( 0 ) O_am : vec3 < f32 > , @ location ( 1 ) O_an : vec3 < f32 > , } @ vertex fn v_main ( @ builtin ( vertex_index ) O_cv : u32 , @ location ( 0 ) O_cw : vec2 < f32 > , @ location ( 1 ) O_k : f32 , @ location ( 2 ) O_l : f32 , ) -> O_ct { var O_cg : O_ct ; var O_cf : vec2f ; if ( O_cv == 0 || O_cv == 5 ) { O_cf = O_cw ; } else if ( O_cv == 1 ) { O_cf = O_cw + vec2f ( 0 , - O_l ) ; } else if ( O_cv == 2 || O_cv == 3 ) { O_cf = O_cw + vec2f ( O_k , - O_l ) ; } else if ( O_cv == 4 ) { O_cf = O_cw + vec2f ( O_k , 0 ) ; } O_cg . O_cu = O_cb . O_b * O_by . O_n * vec4 ( O_cf . xy , 0 , 1.0 ) ; let O_cx = O_ce ( vec4f ( O_cf , 0 , 1 ) ) ; O_cg . O_am = O_cx . O_am ; O_cg . O_an = O_cx . O_an ; return O_cg ; } @ fragment fn v_frag ( @ builtin ( position ) O_cu : vec4 < f32 > , @ location ( 0 ) O_am : vec3 < f32 > , @ location ( 1 ) O_an : vec3 < f32 > , ) -> O_bw { var O_cg : O_bw ; O_cg . O_ap = O_cl ( f32 ( O_bz . O_p ) , O_am , O_an , O_by . O_ba , O_by . O_bp ) ; return O_cg ; } ",jQe="struct O_a { O_b : mat4x4 < f32 > , O_c : mat4x4 < f32 > , O_d : mat4x4 < f32 > , O_e : vec3 < f32 > , O_f : f32 , O_g : vec3 < f32 > , O_h : f32 , O_i : f32 , O_j : f32 , O_k : f32 , O_l : f32 , } struct O_m { O_n : mat3x2 < f32 > , O_o : f32 , O_p : f32 , O_q : f32 , O_r : f32 , O_s : f32 , O_t : f32 , } struct O_u { O_n : mat3x2 < f32 > , O_r : f32 , O_v : f32 , } struct O_w { O_x : f32 , O_y : f32 , O_z : f32 , O_aa : f32 , O_ab : f32 , O_ac : f32 , O_ad : f32 , } struct O_ae { O_p : f32 , O_af : f32 , O_ag : f32 , O_ah : f32 , O_ai : f32 , O_aj : f32 , O_ak : f32 , } struct O_al { O_am : vec3 < f32 > , O_an : vec3 < f32 > , } struct O_ao { O_n : mat4x4 < f32 > , O_ap : mat4x4 < f32 > , O_i : f32 , } @ group ( 0 ) @ binding ( 0 ) var < uniform > O_aq : O_ao ; @ group ( 0 ) @ binding ( 1 ) var < uniform > O_ar : O_a ; @ group ( 0 ) @ binding ( 2 ) var O_as : sampler ; @ group ( 0 ) @ binding ( 3 ) var O_at : texture_2d < f32 > ; @ group ( 0 ) @ binding ( 4 ) var < storage , read > O_au : array < f32 > ; @ group ( 0 ) @ binding ( 5 ) var < storage , read > O_av : array < f32 > ; @ group ( 0 ) @ binding ( 6 ) var < storage , read > O_aw : array < O_u > ; override TEMPLATE_BBOX_DATA_LENGTH : u32 ; override MIN_PX_LENGTH_RATIO : f32 ; override TEMPLATE_OFFSET_DATA_LENGTH : u32 ; struct O_ax { @ builtin ( position ) O_ay : vec4 < f32 > , @ location ( 0 ) O_az : vec2 < f32 > , } struct O_ba { @ location ( 0 ) O_bb : vec4 < f32 > , @ location ( 1 ) O_bc : vec4 < f32 > , @ location ( 2 ) O_bd : vec4 < f32 > , @ location ( 3 ) O_be : f32 , } @ vertex fn v_main ( @ builtin ( vertex_index ) O_bf : u32 , @ location ( 0 ) id : f32 , ) -> O_ax { var O_bg : O_ax ; if ( id == - 1 ) { return O_bg ; } let O_bh = O_aw [ i32 ( id ) ] ; var O_r = O_bh . O_r ; if ( O_r == - 1 ) { return O_bg ; } var O_bi = u32 ( O_r ) * TEMPLATE_BBOX_DATA_LENGTH ; if ( O_au [ O_bi + 2 ] == 0 || O_au [ O_bi + 3 ] == 0 ) { return O_bg ; } let O_n = O_bh . O_n ; let O_bj = vec2f ( O_au [ O_bi ] , O_au [ O_bi + 1 ] ) ; let O_bk = O_aq . O_i * MIN_PX_LENGTH_RATIO ; let O_k = max ( O_au [ O_bi + 2 ] , O_bk ) ; let O_l = max ( O_au [ O_bi + 3 ] , O_bk ) ; let O_bl = O_l / 2 ; var O_bm : vec2f ; let O_bn = O_bj + vec2 ( 0 , - O_bl ) ; let O_bo = O_bj + vec2 ( O_k , - O_bl ) ; let O_bp = normalize ( O_bo - O_bn ) ; let O_bq = vec2 ( - O_bp . y , O_bp . x ) ; let O_br = O_bq * O_bl ; let O_bs = O_bq * O_aq . O_i * 0 ; var O_bt = O_bp * O_aq . O_i * 0 ; if ( O_bf == 0 || O_bf == 5 ) { O_bm = O_bn - O_br - O_bs - O_bt ; } else if ( O_bf == 1 ) { O_bm = O_bo - O_br - O_bs + O_bt ; } else if ( O_bf == 2 || O_bf == 3 ) { O_bm = O_bo + O_br + O_bs + O_bt ; } else if ( O_bf == 4 ) { O_bm = O_bn + O_br + O_bs - O_bt ; } let O_bu = O_n * vec3 ( O_bm , 1.0 ) ; O_bg . O_ay = O_ar . O_b * O_aq . O_n * vec4 ( O_bu . xy , 0 , 1.0 ) ; let O_bv = u32 ( O_r ) * TEMPLATE_OFFSET_DATA_LENGTH ; let O_bw = vec2f ( O_av [ O_bv ] , O_av [ O_bv + 1 ] ) ; let O_bx = O_bm + O_bw ; let O_by = O_aq . O_ap * vec4 ( O_bx , 0 , 1 ) ; let O_bz = O_by . xy ; var O_az : vec2f ; O_az = ( O_bz + 1.0 ) * 0.5 ; O_az . y = 1 - O_az . y ; O_bg . O_az = O_az ; return O_bg ; } @ fragment fn v_frag ( @ builtin ( position ) O_bm : vec4 < f32 > , @ location ( 0 ) O_az : vec2 < f32 > , ) -> O_ba { var O_bg : O_ba ; var O_bb = textureSample ( O_at , O_as , O_az ) ; if ( O_az . x < 0 || O_az . x > 1 || O_az . y < 0 || O_az . y > 1 ) { O_bb = vec4 ( 0 , 0 , 1 , 1 ) ; } O_bg . O_bb = O_bb ; return O_bg ; } ",ym=class KRe extends XE{constructor(t,e,r,i){super(e),this.gpu=t,this.usage=r,this.label=i,this.updateStart=Number.POSITIVE_INFINITY,this.updateEnd=Number.NEGATIVE_INFINITY}static create(t,e,r,i){return new KRe(e,t,r,i)}isChange(){return Number.isFinite(this.updateStart)}markUpdated(){this.updateStart=Number.POSITIVE_INFINITY,this.updateEnd=Number.NEGATIVE_INFINITY}setLength(t){let e=this.length;super.setLength(t),e>t&&this.updateBuf()}updateBuf(){if(this.buf||(this.buf=this.gpu.createSharedBuffer(Math.max(this.length,1),this.usage,this.label)),!this.isChange())return this.buf;let t=Math.max(this.length,1);if(this.buf.setSize(t),this.updateStart<this.length){let e=Math.min(this.updateEnd,this.length),r=this.updateStart;for(;r<e;){let i=Math.floor(r/1024),n=r%1024;this.buf.write(r,this.chunks[i],n,Math.min(e-r,1024-n)),r=(i+1)*1024}}return this.markUpdated(),this.buf}markChange(t,e){this.updateStart=Math.min(t,this.updateStart),this.updateEnd=Math.max(e,this.updateEnd)}clear(){super.clear(),this.buf&&this.buf.setSize(1,!1),this.markUpdated()}destroy(){var t;(t=this.buf)==null||t.free()}},Z7="Consolas, SimHei",F_=class{constructor(){if(this._charString="",this.changed=!1,this.canvas=document.createElement("canvas"),this.canvas.width=4e3,this.canvas.height=4e3,this.context=this.canvas.getContext("2d",{willReadFrequently:!0}),this.context===null)throw new Error("canvas2d not supported");this.currX=0,this.currY=200,this.drawFlag();let o=200;try{this.context.font=o+"px "+Z7}catch(t){console.log(t)}this.context.fillStyle="red",this.context.textBaseline="bottom",this.context.strokeStyle="black",this.preLoadASCII(),this.canvas.style.display="none",this.canvas.style.width=4e3/2+"px",this.canvas.style.height=4e3/2+"px"}getCharIndex(o){return this._charString.indexOf(o)}addChar(o){if(o.length!=1)throw new Error("char.length not equals 1");let t=this.getCharIndex(o);if(t>=0)return t;let e=108+200/8,r=200+200/4,i=this.currX+e;return i>=4e3&&(this.currY+=r,this.currX=0,i=this.currX+e),this.context.fillText(o,this.currX,this.currY,108),this._charString+=o,this.changed=!0,this.currX=i,this._charString.length-1}static getStrWidth(o){return 108*o.length}static getStrHeight(o){return 200}preLoadASCII(){let o="`1234567890-=~!@#$%^&*()_+qwertyuiop[]asdfghjklzxcvbnm,.QWERTYUIOPASDFGHJKLZXCVBNM{}";for(let t of o)try{this.addChar(t)}catch(e){console.log(e)}}drawFlag(){let o=48.5;this.context.lineWidth=8,this.context.strokeStyle="red",this.context.beginPath(),this.context.moveTo(2,o),this.context.lineTo(o*2+2,o*3),this.context.moveTo(o*2+2,o),this.context.lineTo(2,o*3),this.context.stroke(),this.context.lineWidth=1}createString(o,t){for(let e=0;e<o.length;e++){let r=this.addChar(o[e]);t(r)}}static getStrInfo(o,t,e){let r=this.getStrWidth(o),i=this.getStrHeight(o),n=0,s=0,a=0;return o.length!==0&&(n=t/r,s=e/i,a=Math.min(n,s)),{strWidth:r*a,strHeight:i*a}}},Pve=512,M_=64,Iw=M_*2,XQe=10,P7=1,Tve=1e8,ZRe=["L","P","V","S","H","K","O","C","W","N","D","I"],qQe=ZRe.length*M_*Iw,$Qe=class{constructor(o){this.scene=o,this.stringInfoMap=new Map,this.fontStyle={"font-family":Z7},this.gpu=this.scene.gpu,this.maxComputeWorkgroupSizeX=o.gpu.limits.maxComputeWorkgroupSizeX,this.imagesTexture=this.gpu.createDynamicTexture(1,1,_a,GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT,"texture of sdfStringLibrary"),this.stringInfoBuilder=ym.create(Float32Array,this.gpu,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"stringInfoBuf of sdfStringLibrary"),this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.initPipeline(),this.initBuffer(),this.initBindGroup()}init(){ZRe.forEach(o=>{this.create(o)})}getIndex(o){if(!o)return-1;let t=this.stringInfoMap.get(o);if(t==null)throw new Error("The value is not in the font library");return t}initPipeline(){let o=this.gpu.device,t=this.gpu.createShaderModule(VQe),e=o.createComputePipeline({layout:"auto",compute:{module:t,entryPoint:"calculateGridRowData",constants:{INF:Tve,MAX_COMPUTE_WORKGROUP_SIZE_X:this.maxComputeWorkgroupSizeX}}}),r=this.gpu.createShaderModule(GQe),i=o.createComputePipeline({layout:"auto",compute:{module:r,entryPoint:"computeSdfData",constants:{MAX_COMPUTE_WORKGROUP_SIZE_X:this.maxComputeWorkgroupSizeX}}}),n=this.gpu.createShaderModule(FQe),s=o.createComputePipeline({layout:"auto",compute:{module:n,entryPoint:"reduceSdf",constants:{MAX_COMPUTE_WORKGROUP_SIZE_X:this.maxComputeWorkgroupSizeX}}}),a=this.gpu.createShaderModule(UQe),l=o.createComputePipeline({layout:"auto",compute:{module:a,entryPoint:"createGridData",constants:{INF:Tve,MAX_COMPUTE_WORKGROUP_SIZE_X:this.maxComputeWorkgroupSizeX}}});this.computePipelines={calculateGridRowData:e,calculateSdfData:i,reduceSdfData:s,createGridData:l}}initBuffer(){let o=this.gpu;this.uniformsBuf=o.createDynamicBuffer(XQe,GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,"uniformsBuf"),this.grid1Buf=o.createDynamicBuffer(P7,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"grid1Buffer"),this.grid2Buf=o.createDynamicBuffer(P7,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"grid2Buffer"),this.originalGrid1Buf=o.createDynamicBuffer(P7,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"originalGrid1Buf"),this.originalGrid2Buf=o.createDynamicBuffer(P7,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"originalGrid2Buf"),this.currentSdfBuf=o.createDynamicBuffer(P7,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"sdfBuf"),this.sdfBuf=o.createDynamicBuffer(qQe,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"sdfBuf")}initBindGroup(){this.generateGridByImageDataBindGroup=this.gpu.createDynamicBindGroup(this.computePipelines.createGridData.getBindGroupLayout(0),0,this.uniformsBuf,1,this.grid1Buf,2,this.grid2Buf,3,this.imagesTexture),this.calculateGridRowDataBindGroup=this.gpu.createDynamicBindGroup(this.computePipelines.calculateGridRowData.getBindGroupLayout(0),0,this.uniformsBuf,1,this.grid1Buf,2,this.grid2Buf,3,this.originalGrid1Buf,4,this.originalGrid2Buf),this.generateSdfBindGroup=this.gpu.createDynamicBindGroup(this.computePipelines.calculateSdfData.getBindGroupLayout(0),0,this.uniformsBuf,1,this.grid1Buf,2,this.grid2Buf,3,this.currentSdfBuf)}create(o){let t=this.stringInfoMap.get(o);t||(t=this.stringInfoBuilder.getLength(),this.stringInfoMap.set(o,t),this.stringInfoBuilder.push(t),this.generateGridBufferFormImageData(o,t))}generateGridBufferFormImageData(o,t){let[e,r]=this.drawText(o,this.fontStyle);this.createGridData(e,r),this.calculateSdfBuf(e,r);let i=this.reduceSdfGPU(e,r);this.gpu.copyBufferToBuffer(i,0,this.sdfBuf,t*M_*Iw,i.getSize())}updateGridBufSize(o,t){let e=o*t;e>P7&&(this.grid1Buf.extSize(e*4),this.grid2Buf.extSize(e*4),this.currentSdfBuf.extSize(e*4),this.originalGrid1Buf.extSize(e*4),this.originalGrid2Buf.extSize(e*4))}createGridData(o,t){let e=this.gpu.device;this.updateGridBufSize(o,t);let r=e.createCommandEncoder({label:"encoder1"});this.uniformsBuf.write(0,new Uint32Array([0,o,t]));let i=o*t;this.gpu.runComputePass(r,this.computePipelines.createGridData,this.generateGridByImageDataBindGroup.getBindGroup(),i,s=>this.gpu.copyBufferToBuffer(this.gpu.groupOffsetXsBuf,s,this.uniformsBuf,0,1,r));let n=r.finish();e.queue.submit([n])}drawText(o,t){this.context.font=Ew(t,Pve);let e=this.context.measureText(o),r=Math.ceil(Math.max(e.width,e.actualBoundingBoxRight)/4)*4,i=e.fontBoundingBoxAscent,n=e.fontBoundingBoxDescent,s=i+n,a=0,l=i;return this.canvas.width=r,this.canvas.height=s,this.context.font=Ew(t,Pve),this.context.fillText(o,a,l),this.imagesTexture.updateSize(r,s),this.scene.gpu.device.queue.copyExternalImageToTexture({source:this.canvas},{texture:this.imagesTexture.texture},[r,s]),[r,s]}calculateSdfBuf(o,t){let e=this.gpu.device;{let r=e.createCommandEncoder({label:"encoder1"});this.gpu.copyBufferToBuffer(this.grid1Buf,0,this.originalGrid1Buf,0,o*t,r),this.gpu.copyBufferToBuffer(this.grid2Buf,0,this.originalGrid2Buf,0,o*t,r),this.uniformsBuf.write(0,new Int32Array([0,o,t,1]));let i=t*o;this.gpu.runComputePass(r,this.computePipelines.calculateGridRowData,this.calculateGridRowDataBindGroup.getBindGroup(),i,s=>this.gpu.copyBufferToBuffer(this.gpu.groupOffsetXsBuf,s,this.uniformsBuf,0,1,r));let n=r.finish();e.queue.submit([n])}{let r=e.createCommandEncoder({label:"encoder"});this.gpu.copyBufferToBuffer(this.grid1Buf,0,this.originalGrid1Buf,0,o*t,r),this.gpu.copyBufferToBuffer(this.grid2Buf,0,this.originalGrid2Buf,0,o*t,r),this.uniformsBuf.write(0,new Int32Array([0,o,t,0]));let i=o*t;this.gpu.runComputePass(r,this.computePipelines.calculateGridRowData,this.calculateGridRowDataBindGroup.getBindGroup(),i,s=>this.gpu.copyBufferToBuffer(this.gpu.groupOffsetXsBuf,s,this.uniformsBuf,0,1,r));let n=r.finish();e.queue.submit([n])}{this.uniformsBuf.write(0,new Int32Array([0,o,t]));let r=e.createCommandEncoder(),i=t*o;this.gpu.runComputePass(r,this.computePipelines.calculateSdfData,this.generateSdfBindGroup.getBindGroup(),i,s=>this.gpu.copyBufferToBuffer(this.gpu.groupOffsetXsBuf,s,this.uniformsBuf,0,1,r));let n=r.finish();e.queue.submit([n])}}reduceSdfGPU(o,t){let e=this.gpu.device,r=this.gpu.createDynamicBuffer(M_*Iw,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"reduce sdf");this.uniformsBuf.write(0,new Int32Array([0,o,t,M_,Iw]));let i=this.gpu.createDynamicBindGroup(this.computePipelines.reduceSdfData.getBindGroupLayout(0),0,this.uniformsBuf,1,this.currentSdfBuf,2,r),n=e.createCommandEncoder({label:"reduceSdf"}),s=M_*Iw;this.gpu.runComputePass(n,this.computePipelines.reduceSdfData,i.getBindGroup(),s,l=>this.gpu.copyBufferToBuffer(this.gpu.groupOffsetXsBuf,l,this.uniformsBuf,0,1,n));let a=n.finish();return e.queue.submit([a]),r}getSdfBuffer(){return this.sdfBuf}},Dye=1,jge=92,Ive=12,Cve=4,Sve=36,JRe=2,KQe=[0,1,2,15,3,4,66,67,68],ZQe=[11,12,13,14],JQe=[6,7,8,9];var Rs={0:"circle",1:"arc",2:"rect",15:"line",16:"ellipse",3:"lineSegment",4:"semicircle",5:"point",10:"string",66:"scaleString",6:"triangle",7:"cutedCircle",8:"staticTriangle",9:"staticCutedCircle",11:"lineWireFrame",12:"arcWireFrame",14:"staticArcWireFrame",13:"staticLineWireFrame",18:"sdfString",19:"drc",21:"circleTemplateInstance",26:"triangleTemplateInstance",30:"stringTemplateInstance",27:"cutedCircleTemplateInstance",31:"lineWireFrameTemplateInstance",32:"arcWireFrameTemplateInstance",28:"staticTriangleTemplateInstance",29:"staticCutedCircleTemplateInstance",33:"staticLineWireFrameTemplateInstance",34:"staticArcWireFrameTemplateInstance",22:"arcTemplateInstance",23:"rectTemplateInstance",24:"lineSegmentTemplateInstance",25:"semicircleTemplateInstance",35:"lineTemplateInstance",51:"circleTemplate",56:"triangleTemplate",60:"stringTemplate",57:"cutedCircleTemplate",61:"lineWireFrameTemplate",62:"arcWireFrameTemplate",58:"staticTriangle",59:"staticCutedCircle",63:"staticLineWireFrame",64:"staticArcWireFrame",52:"arcTemplate",53:"rectTemplate",54:"lineSegmentTemplate",55:"semicircleTemplate",65:"lineTemplate",67:"scaleArrow",68:"fixedArrow"},wye=2,BK=.5,uw=Math.sqrt(.5),QRe=1-(Math.acos(BK/uw)*uw*uw-BK*Math.sqrt(uw*uw-BK*BK))/Math.PI/(uw*uw),BE={VISIBLE_MASK:cs,MATH_PI:Math.PI,CHAR_WIDTH:108,CHAR_HEIGHT:200,CANVAS_WIDTH:4e3,CANVAS_HEIGHT:4e3,PTGROUP_VISIBLE_SHIFT:JZ,PTGROUP_DOUBLERGB_SHIFT:tJ,PTGROUP_HIGH_LIGHT_SHIFT:QZ,PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT:eJ,PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT:ZZ,ANTIALIAS_RATIO:QRe,MIN_PX_LENGTH_RATIO:wye,SDF_HEIGHT:Iw,SDF_WIDTH:M_,RENDER_HIGHLIGHT_TYPE_SHIFT:Dye,TEMPLATE_OFFSET_DATA_LENGTH:JRe,CIRCLE_INSTANCE_PT_LENGTH:8,TRIANGLE_INSTANCE_PT_LENGTH:11,STRING_INSTANCE_PT_LENGTH:15,STRING_LEVEL_BITLENGTH:RC,CUTED_CIRCLE_INSTANCE_PT_LENGTH:14,LINE_WIRE_INSTANCE_FRAME_PT_LENGTH:9,ARC_WIRE_FRAME_INSTANCE_PT_LENGTH:10,STATIC_TRIANGLE_INSTANCE_PT_LENGTH:9,STATIC_CUTED_CIRCLE_INSTANCE_PT_LENGTH:12,STATIC_LINE_WIRE_FRAME_INSTANCE_PT_LENGTH:6,STATIC_ARC_WIRE_FRAME_INSTANCE_PT_LENGTH:7,ARC_INSTANCE_PT_LENGTH:11,RECT_INSTANCE_PT_LENGTH:11,LINE_INSTANCE_PT_LENGTH:11,LINESEGMENT_INSTANCE_PT_LENGTH:11,SEMICIRCLE_INSTANCE_PT_LENGTH:9,GROUP_DATA_LENGTH:VT};function kZ(o){let t={};return t.RENDER_HIGHLIGHT_TYPE_SHIFT=BE.RENDER_HIGHLIGHT_TYPE_SHIFT,t.GROUP_DATA_LENGTH=BE.GROUP_DATA_LENGTH,o.indexOf("Vert")&&(t.VISIBLE_MASK=BE.VISIBLE_MASK,t.PTGROUP_VISIBLE_SHIFT=BE.PTGROUP_VISIBLE_SHIFT,t.PTGROUP_DOUBLERGB_SHIFT=BE.PTGROUP_DOUBLERGB_SHIFT,t.PTGROUP_HIGH_LIGHT_SHIFT=BE.PTGROUP_HIGH_LIGHT_SHIFT,t.PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT=BE.PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT,t.PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT=BE.PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT),Eve[o]&&Eve[o].forEach(e=>{t[e]=BE[e]}),t}function BZ(o){switch(o){case 11:case 61:case 31:case 46:case 13:case 63:case 33:case 48:case 3:case 54:case 24:case 39:case 2:case 53:case 23:case 38:case 15:case 65:case 35:case 50:case 10:case 60:case 30:case 45:case 66:case 18:case 19:return 6;case 67:case 68:return 9;default:return 3}}var Eve={circleVert:["MIN_PX_LENGTH_RATIO"],circleTemplateVert:["MIN_PX_LENGTH_RATIO","TEMPLATE_OFFSET_DATA_LENGTH"],circleFrag:["MATH_PI"],arcVert:["MIN_PX_LENGTH_RATIO"],arcTemplateVert:["MIN_PX_LENGTH_RATIO","TEMPLATE_OFFSET_DATA_LENGTH"],arcFrag:["MATH_PI"],triangleTemplateVert:["TEMPLATE_OFFSET_DATA_LENGTH"],triangleFrag:[],rectVert:["MIN_PX_LENGTH_RATIO"],rectTemplateVert:["MIN_PX_LENGTH_RATIO","TEMPLATE_OFFSET_DATA_LENGTH"],rectFrag:["MATH_PI","ANTIALIAS_RATIO"],lineVert:["MIN_PX_LENGTH_RATIO"],lineTemplateVert:["MIN_PX_LENGTH_RATIO","TEMPLATE_OFFSET_DATA_LENGTH"],lineFrag:["MATH_PI","ANTIALIAS_RATIO"],cutedCircleTemplateVert:["TEMPLATE_OFFSET_DATA_LENGTH"],lineSegmentTemplateVert:["TEMPLATE_OFFSET_DATA_LENGTH"],lineSegmentFrag:["MATH_PI","ANTIALIAS_RATIO"],semicircleTemplateVert:["TEMPLATE_OFFSET_DATA_LENGTH"],stringTemplateVert:["TEMPLATE_OFFSET_DATA_LENGTH"],stringFrag:["CHAR_WIDTH","CHAR_HEIGHT","CANVAS_WIDTH","CANVAS_HEIGHT"],drcVert:["MATH_PI","SDF_HEIGHT","SDF_WIDTH"],drcFrag:["SDF_HEIGHT","SDF_WIDTH","ANTIALIAS_RATIO","MATH_PI"],staticTriangleVert:["TEMPLATE_OFFSET_DATA_LENGTH"],staticCutedCircleVert:["TEMPLATE_OFFSET_DATA_LENGTH"],arcWireFrameTemplateVert:["TEMPLATE_OFFSET_DATA_LENGTH"],arcWireFrameFrag:["MATH_PI"],lineWireFrameTemplateVert:["TEMPLATE_OFFSET_DATA_LENGTH"],staticArcWireFrameVert:["TEMPLATE_OFFSET_DATA_LENGTH"],staticLineWireFrameVert:["TEMPLATE_OFFSET_DATA_LENGTH"],circleTemplateInstanceVert:["MIN_PX_LENGTH_RATIO","CIRCLE_INSTANCE_PT_LENGTH"],triangleTemplateInstanceVert:["TRIANGLE_INSTANCE_PT_LENGTH"],stringTemplateInstanceVert:["PTGROUP_HIGH_LIGHT_SHIFT"],cutedCircleTemplateInstanceVert:["CUTED_CIRCLE_INSTANCE_PT_LENGTH"],lineWireFrameTemplateInstanceVert:["LINE_WIRE_INSTANCE_FRAME_PT_LENGTH"],arcWireFrameTemplateInstanceVert:["ARC_WIRE_FRAME_INSTANCE_PT_LENGTH"],staticTriangleTemplateInstanceVert:["STATIC_TRIANGLE_INSTANCE_PT_LENGTH"],staticCutedCircleTemplateInstanceVert:["STATIC_CUTED_CIRCLE_INSTANCE_PT_LENGTH"],staticArcWireFrameTemplateInstanceVert:["STATIC_ARC_WIRE_FRAME_INSTANCE_PT_LENGTH"],staticLineWireFrameTemplateInstanceVert:["STATIC_LINE_WIRE_FRAME_INSTANCE_PT_LENGTH"],arcTemplateInstanceVert:["MIN_PX_LENGTH_RATIO","ARC_INSTANCE_PT_LENGTH"],rectTemplateInstanceVert:["MIN_PX_LENGTH_RATIO","RECT_INSTANCE_PT_LENGTH"],lineTemplateInstanceVert:["MIN_PX_LENGTH_RATIO","LINE_INSTANCE_PT_LENGTH"],lineSegmentTemplateInstanceVert:["LINESEGMENT_INSTANCE_PT_LENGTH"],semicircleTemplateInstanceVert:["SEMICIRCLE_INSTANCE_PT_LENGTH"],scaleArrowVert:["MIN_PX_LENGTH_RATIO"],fixedArrowVert:["MIN_PX_LENGTH_RATIO"]},QQe=[16,17,20,18],Ove=[5,18];function eet(o){return o.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{}},{binding:1,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{}},{binding:4,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:5,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:6,visibility:GPUShaderStage.FRAGMENT,texture:{}},{binding:7,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}},{binding:8,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:9,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:10,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"storage"}},{binding:11,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:12,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:13,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}},{binding:14,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}},{binding:15,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}}]})}function tet(o){return o.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{}},{binding:1,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:3,visibility:GPUShaderStage.FRAGMENT,texture:{}},{binding:4,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:5,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}},{binding:6,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}}]})}function eDe(o,t){let e=t[2],r=t[6];return e/r>o}function fc(...o){let t=[],e=0;return o.forEach((r,i)=>{t.push({shaderLocation:i,offset:e,format:r===1?"float32":`float32x${r}`}),e+=r*rs}),[{arrayStride:e,attributes:t,stepMode:"instance"}]}function ret(){return fc(1,1,1,1,1)}function tDe(o){switch(o){case 0:return fc(1,2,1,1,1,1);case 51:return fc(1,2,1,1,1,1,1);case 1:return fc(1,2,1,1,1,1,1,1,1);case 52:return fc(1,2,1,1,1,1,1,1,1,1);case 2:return fc(1,2,1,1,1,1,1,1,1);case 53:return fc(1,2,1,1,1,1,1,1,1,1);case 15:return fc(1,2,2,1,1,1,1,1);case 65:return fc(1,2,2,1,1,1,1,1,1);case 16:return fc(1,2,1,1,1,1,1,1,1,1,1);case 3:return fc(1,2,2,1,1,1,1,1);case 54:return fc(1,2,2,1,1,1,1,1,1);case 4:return fc(1,2,1,1,1,1,1);case 55:return fc(1,2,1,1,1,1,1,1);case 5:return fc(1,2,1,1,1,1,1);case 10:return fc(1,2,1,1,1,1,1,1,1,1,1,1,1,1);case 66:return fc(1,2,1,1,1,1,1,1,1,1,1,1);case 60:return fc(1,2,1,1,1,1,1,1,1,1,1,1,1,1,1);case 11:return fc(1,2,2,1,1,1);case 61:return fc(1,2,2,1,1,1,1);case 12:return fc(1,2,1,1,1,1,1,1);case 62:return fc(1,2,1,1,1,1,1,1,1);case 14:case 64:return fc(1,2,1,1,1,1);case 13:case 63:return fc(1,2,2,1);case 18:return fc(1,1,2,1,1,1,1,1,1);case 19:return fc(1,2,1,1,1,1,1,1,1,1,1,1);case 6:return fc(1,2,2,2,1,1,1);case 56:return fc(1,2,2,2,1,1,1,1);case 8:case 58:return fc(1,2,2,2,1,1);case 7:return fc(1,2,1,1,1,2,2,1,1,1);case 57:return fc(1,2,1,1,1,2,2,1,1,1,1);case 9:case 59:return fc(1,2,1,1,1,2,2,1,1);case 21:case 26:case 30:case 27:case 31:case 32:case 28:case 29:case 34:case 33:case 22:case 23:case 24:case 25:case 35:case 36:return ret();case 67:case 68:return fc(1,2,1,1,1);default:throw new Error("type error")}}function FZ(o,t){if(Fr.isTemplateInstancePtType(t)||Fr.isTemplateOriginPtType(t))switch(o){case Rs[21]:case Rs[51]:return Rs[0];case Rs[56]:case Rs[26]:case Rs[58]:case Rs[28]:return Rs[6];case Rs[60]:case Rs[30]:return Rs[10];case Rs[57]:case Rs[27]:case Rs[59]:case Rs[29]:return Rs[7];case Rs[61]:case Rs[31]:case Rs[63]:case Rs[33]:return Rs[11];case Rs[62]:case Rs[32]:case Rs[64]:case Rs[34]:return Rs[12];case Rs[52]:case Rs[22]:return Rs[1];case Rs[53]:case Rs[23]:return Rs[2];case Rs[54]:case Rs[24]:return Rs[3];case Rs[55]:case Rs[25]:return Rs[4];case Rs[65]:case Rs[35]:return Rs[15]}else{if(t===13)return Rs[11];if(t===14)return Rs[12];if(t===8)return Rs[6];if(t===9)return Rs[7];if(t===66)return Rs[10];if(t===68)return Rs[67]}return o}function iet(o,t,e,r,i,n){let s=Rs[o],a=`${s}Vert`,l=`${FZ(s,o)}Frag`;return t.createRenderPipeline({layout:r,vertex:{module:e,entryPoint:a,constants:n(a),buffers:tDe(o)},fragment:{module:e,entryPoint:l,constants:n(l),targets:[{format:_a,writeMask:0}]},primitive:{topology:"triangle-list"},depthStencil:{format:J2,depthCompare:"always",depthWriteEnabled:!1,stencilReadMask:i,stencilFront:{compare:"not-equal",passOp:"increment-wrap"},stencilBack:{compare:"not-equal",passOp:"decrement-wrap"}},label:`renderPt ${o} pipeline`})}function net(o,t,e,r,i,n,s,a,l){Fr.isCustomTemplateInstanceType(o)&&(o=Fr.getTemplateTypeByCustomInstanceType(o));let c=Rs[o],h=`${c}Vert`,u=`${FZ(c,o)}Frag`;return t.createRenderPipeline({layout:r,vertex:{module:e,entryPoint:h,constants:l(h),buffers:tDe(o)},fragment:{module:e,entryPoint:u,constants:l(u),targets:[{format:_a,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}},writeMask:i?15:0},{format:_a,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}},writeMask:i&&!Ove.includes(o)?15:0},{format:_a,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}},writeMask:i&&!Ove.includes(o)?15:0}]},primitive:{topology:"triangle-list"},depthStencil:{format:J2,depthCompare:"always",depthWriteEnabled:!!(i&&a),stencilReadMask:n,stencilFront:s,stencilBack:s},label:`renderPt ${o} pipeline`})}function Ave(o,t,e){return o.createRenderPipeline({layout:"auto",vertex:{module:t,entryPoint:"v_main",buffers:[{arrayStride:4*rs,attributes:[{shaderLocation:0,offset:0,format:"float32x2"},{shaderLocation:1,offset:2*rs,format:"float32"},{shaderLocation:2,offset:3*rs,format:"float32"}],stepMode:"instance"}]},fragment:{module:t,entryPoint:"v_frag",constants:{RENDER_HIGHLIGHT_TYPE_SHIFT:Dye},targets:[{format:_a,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}},writeMask:15}]},primitive:{topology:"triangle-list"},depthStencil:{format:J2,depthCompare:"always",depthWriteEnabled:!!e,stencilReadMask:63,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}})}function _ve(o,t,e,r){let i={color:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}};return o.createRenderPipeline({layout:e,vertex:{module:t,entryPoint:"v_main",constants:{TEMPLATE_BBOX_DATA_LENGTH:xwe,MIN_PX_LENGTH_RATIO:wye,TEMPLATE_OFFSET_DATA_LENGTH:JRe},buffers:fc(1)},fragment:{module:t,entryPoint:"v_frag",targets:[{format:_a,blend:i,writeMask:15},{format:_a,blend:i,writeMask:0},{format:_a,blend:i,writeMask:0}]},primitive:{topology:"triangle-list"},depthStencil:{format:J2,depthCompare:"always",depthWriteEnabled:!!r}})}function oet(o){let{device:t}=o,e=eet(t),r=tet(t),i=o.createShaderModule(WQe),n=t.createPipelineLayout({bindGroupLayouts:[e]}),s=t.createPipelineLayout({bindGroupLayouts:[r]});return{renderPtBindGroupLayout:e,renderPtPipelineLayout:n,templateLayout:r,templatePipelineLayout:s,drawStringPipeline:t.createRenderPipeline({layout:n,vertex:{module:i,entryPoint:"stringVert",constants:kZ("stringVert"),buffers:fc(1,2,1,1,1,1,1,1,1,1,1,1,1,1)},fragment:{module:i,entryPoint:"stringRulerFrag",constants:kZ("stringFrag"),targets:[{format:_a,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}}),sampler:o.linearSampler,nearSampler:o.nearestSampler,module:i}}var set=class{constructor(o,t){this.renderPipelines=[],this.renderPipelinesWithoutDepthWrite=[],this.drawPassStencilPipelines=[],this.drawNotPassStencilPipelines=[],this.drawInterStencilPipelines=[],this.afterDraw={render:(s,a,l)=>{this.polygonRenderDesc1.colorAttachments[0].view=s.colorTexture.view,this.polygonRenderDesc1.depthStencilAttachment.view=s.depthStencilTexture.view;let c=new Uint32Array(Cve);c.set([a]),this.scene.addData(c,this.drawPolygonUniformsBuf);let h=this.scene.commandEncoder.beginRenderPass(this.polygonRenderDesc1);h.setStencilReference(64),h.setPipeline(l?this.drawPolygonPipeline:this.drawPolygonPipelineWithoutDepth),h.setBindGroup(0,l?this.drawPolygonBindGroup.getBindGroup():this.drawPolygonBindGroupWithoutDepth.getBindGroup()),h.setVertexBuffer(0,this.polygonVertexBuf.getBuffer()),h.draw(6,1),h.end()},renderPolygonHighLightColor:(s,a=ee.DefaultHighLightColor,l=ee.DefaultHighLightColor,c=!1)=>{this.highLightPolygonRenderDesc.colorAttachments[0].view=s.highLightColorTexture0.view,this.highLightPolygonRenderDesc.colorAttachments[1].view=s.highLightColorTexture1.view;let h=new Float32Array(Ive);h.set(a.getData()),h.set(l.getData(),4),h[8]=this.scene.getSampling(),h[9]=c?1:0,this.scene.addData(new Uint32Array(h.buffer),this.drawHighLightPolygonUniformsBuf);let u=this.scene.commandEncoder.beginRenderPass(this.highLightPolygonRenderDesc);u.setPipeline(this.drawHighLightPolygonPipeline),u.setBindGroup(0,this.drawHighLightPolygonBindGroup.getBindGroup()),u.draw(6),u.end()},drawPassStencil:s=>{this.scene.drawStencilProgram.draw(s,!1,64,63)},drawNotPassStencil:s=>{this.scene.drawStencilProgram.draw(s,!1,128,63)},drawInterStencil:s=>{}},this.renderPtBindGroupLayout=t.renderPtBindGroupLayout,this.templateLayout=t.templateLayout,this.templatePipelineLayout=t.templatePipelineLayout,this.renderPtModule=t.module,this.drawStringPipeline=t.drawStringPipeline,this.sampler=t.sampler,this.nearSampler=t.nearSampler,this.renderPtPipelineLayout=t.renderPtPipelineLayout,this.desc={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"},{view:null,loadOp:"load",storeOp:"store"},{view:null,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"},label:"desc of RenderPtProgram"},this.polygonRenderDesc={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"},label:"polygonRenderDesc of RenderPtProgram"},this.polygonRenderDesc1={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"},label:"polygonRenderDesc1 of RenderPtProgram"},this.highLightPolygonRenderDesc={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"},{view:null,loadOp:"load",storeOp:"store"}],label:"highLightPolygonRenderDesc of RenderPtProgram"},this.stringDesc={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}],label:"stringDesc of RenderPtProgram"},this.scene=o;let e=o.gpu;this.gpu=e,this.templateCamera=new B_(null,L_,N7),this.templateCamera.setScene(o),this.templateCamera.setCameraType(!0,!1),this.templateCamera.setCameraDirect(!0,!1),this.templateTarget={colorTexture:e.createDynamicTexture(L_,N7,_a,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST,"colorTexture of templateTarget"),depthStencilTexture:e.createDynamicTexture(L_,N7,J2,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST,"depthStencilTexture of templateTarget"),highLightColorTexture0:e.createDynamicTexture(L_,N7,_a,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST,"highLightColorTexture0 of templateTarget"),highLightColorTexture1:e.createDynamicTexture(L_,N7,_a,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST,"highLightColorTexture1 of templateTarget")},this.clearTemplateDesc={colorAttachments:[{view:this.templateTarget.colorTexture.view,loadOp:"clear",storeOp:"store"}],label:"clearTemplateDesc of renderPtProgram"};let r=e.createShaderModule(jQe);this.drawTemplatePipeline=_ve(e.device,r,this.templatePipelineLayout,!0),this.drawTemplatePipelineWithoutDepth=_ve(e.device,r,this.templatePipelineLayout,!1),this.uniformsBuf=e.createDynamicBuffer(jge,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"uniformsBuf of RenderPtProgram"),this.drawHighLightPolygonUniformsBuf=e.createDynamicBuffer(Ive,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"drawHighLightPolygonUniformsBuf of RenderPtProgram"),this.highLightStencilBuf=e.createDynamicBuffer(1,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC,"highLightStencilBuf of RenderPtProgram"),this.sdfInitBuffer=e.createDynamicBuffer(1,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC,"sdfBuffer of RenderPtProgram");let i=e.createShaderModule(zQe);this.drawHighLightPolygonPipeline=e.device.createRenderPipeline({layout:"auto",vertex:{module:i,entryPoint:"v_main"},fragment:{module:i,entryPoint:"v_frag",targets:[{format:_a,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}},{format:_a,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}}),this.drawHighLightPolygonBindGroup=this.createDrawHighLightPolygonColorBindGroup(),this.drawPolygonUniformsBuf=e.createDynamicBuffer(Cve,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"drawPolygonUniformsBuf of RenderPtProgram");let n=e.createShaderModule(YQe);this.polygonVertexBuf=e.createDynamicBuffer(4,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,"polygonVertexBuf of RenderPtProgram"),this.drawPolygonPipeline=Ave(e.device,n,!0),this.drawPolygonPipelineWithoutDepth=Ave(e.device,n,!1),this.drawPolygonBindGroup=this.createDrawPolygonColorBindGroup(this.drawPolygonPipeline),this.drawPolygonBindGroupWithoutDepth=this.createDrawPolygonColorBindGroup(this.drawPolygonPipelineWithoutDepth),this.drawTemplatePipelineUniformsBuf=e.createDynamicBuffer(Sve,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"TemplateP uniformsBuf of RenderPtProgram")}createPipelineByType(o,t,e,r,i,n=!0){let{device:s}=this.gpu,a;if(Fr.isNormalPolygonType(o))a=iet(o,s,this.renderPtModule,this.renderPtPipelineLayout,i,kZ);else{if(QQe.includes(o))return;a=net(o,s,this.renderPtModule,this.renderPtPipelineLayout,t,e,r,n,kZ)}return a}updateSize(o,t){this.highLightStencilBuf.setSize(o*t*3)}createDrawHighLightPolygonColorBindGroup(){return this.gpu.createDynamicBindGroup(this.drawHighLightPolygonPipeline.getBindGroupLayout(0),0,this.scene.cameraBuf,1,this.drawHighLightPolygonUniformsBuf,2,this.highLightStencilBuf)}createDrawPolygonColorBindGroup(o){return this.gpu.createDynamicBindGroup(o.getBindGroupLayout(0),0,this.uniformsBuf,1,this.drawPolygonUniformsBuf,2,this.scene.colorsBuf,3,this.scene.cameraBuf)}draw0(o,t,e,r,i){let n=t;if(Fr.isCustomTemplateInstanceType(t)&&(t=Fr.getTemplateTypeByCustomInstanceType(t)),!e)throw new Error("pipelines type Error");o.setPipeline(e),o.setStencilReference(r);let s=BZ(t),a;for(let[l,c,h]of i){a!=h&&(o.setBindGroup(0,h.getBindGroup()),a=h);let u=c.getMemory();o.setVertexBuffer(0,u.getBuffer(),u.getOffset(),u.getSize()),o.draw(s,l),this.scene.renderPtNum+=l,this.scene.renderPtTypeNum[n]+=l,this.scene.renderVertexNum+=l*s,this.scene.drawTimes++}}render(o,t,e,r){let i;r?(this.renderPipelines[t]||(this.renderPipelines[t]=this.createPipelineByType(t,!0,255,{compare:"equal"},127)),i=this.renderPipelines[t]):(this.renderPipelinesWithoutDepthWrite[t]||(this.renderPipelinesWithoutDepthWrite[t]=this.createPipelineByType(t,!0,255,{compare:"equal"},127,!1)),i=this.renderPipelinesWithoutDepthWrite[t]),Fr.isNormalPolygonType(t)?this.draw0(o,t,i,0,e):this.draw0(o,t,i,64,e)}drawPassStencil(o,t,e){this.drawPassStencilPipelines[t]||(this.drawPassStencilPipelines[t]=this.createPipelineByType(t,!1,255,{compare:"always",passOp:"replace"},255)),this.draw0(o,t,this.drawPassStencilPipelines[t],64,e)}drawNotPassStencil(o,t,e){this.drawNotPassStencilPipelines[t]||(this.drawNotPassStencilPipelines[t]=this.createPipelineByType(t,!1,127,{compare:"not-equal",passOp:"replace"},127)),Fr.isNormalPolygonType(t)?this.draw0(o,t,this.drawNotPassStencilPipelines[t],0,e):this.draw0(o,t,this.drawNotPassStencilPipelines[t],128,e)}drawInterStencil(o,t,e){this.drawInterStencilPipelines[t]||(this.drawInterStencilPipelines[t]=this.createPipelineByType(t,!1,255,{compare:"equal",passOp:"increment-wrap"},127)),this.draw0(o,t,this.drawInterStencilPipelines[t],Fr.isNormalPolygonType(t)?0:64,e)}drawString(o,t,e,r,i){this.stringDesc.colorAttachments[0].view=o,this.scene.char.flush(),this.scene.stringInfoBuilder.updateBuf();let n=new Uint32Array(jge),s=new Float32Array(n.buffer);s.set(Ae.ORIGIN.data),s.set(e.getColor().getData(),16),s[37]=e.getPxLength(t,Ae.ORIGIN),s[40]=e.getAllRgbRatio(),s[41]=e.isVisible()?1:0,n[57]=e.isColorful?1:0,this.scene.addData(n,this.uniformsBuf);let a=this.scene.commandEncoder.beginRenderPass(this.stringDesc);a.setPipeline(this.drawStringPipeline),a.setBindGroup(0,i.getBindGroup());let l=r.updateBuf().getMemory();a.setVertexBuffer(0,l.getBuffer(),l.getOffset(),l.getSize()),a.draw(6,r.getLength()/J7.length),a.end()}isRenderForceHighLightPtPolygon(o,t=this.scene.ptGroup.getData()){return this.scene.getGlobalHighLightType()===0&&this.scene.getForceVisibleHighLightPt()&&ih.isForceHighLight(o,t)}getPolygonRenderColors(o,t){let e=[t],r=[{colorIndexs:e,isGroupForceHighLight:!1,isDoubleRgb:!1,isForceHighLight:!1}],i=o.polygonColorAndGroupIdMap.get(t);if(!i&&i!==0)return r;let n=this.scene.ptGroup.getData(),s=!1;if(Array.isArray(i)){let a=!1,l=!1;for(let c=0;c<i.length;c+=1){let h=i[c],u=ih.getColorIndex(h,n);u&&!e.includes(u)&&e.push(u),ih.isDoubleRgb(h,n)&&(!a&&r.push({colorIndexs:e,isDoubleRgb:!0,isForceHighLight:!1,isGroupForceHighLight:!1}),a=!0),this.isRenderForceHighLightPtPolygon(h,n)&&(!l&&r.push({colorIndexs:e,isDoubleRgb:!1,isForceHighLight:!0,isGroupForceHighLight:!1}),l=!0),s||(s=ih.isForceHighLight(h,n))}}else{let a=ih.getColorIndex(i,n);s=ih.isForceHighLight(i,n),a&&!e.includes(a)&&e.push(a),ih.isDoubleRgb(i,n)&&r.push({colorIndexs:e,isDoubleRgb:!0,isForceHighLight:!1,isGroupForceHighLight:!1}),this.isRenderForceHighLightPtPolygon(i,n)&&r.push({colorIndexs:e,isDoubleRgb:!1,isForceHighLight:!0,isGroupForceHighLight:!1})}return r[0].isGroupForceHighLight=s,r}getGroupForceHighLightColorByColorIndex(o,t){let e=o>>Dye,r=t.getColor();if(!t.isColorful&&this.scene.getForceVisibleHighLightPt()&&(r=t.getOriginalColor()),e==0)return r;let i=this.scene.colors[e];return i.r+i.g+i.b==0&&(i=ee.of6(r,i.alpha)),i=i.mulAlpha(r.alpha),i}drawPolygon(o,t,e,r,i,n,s,a,l,c){if(i===1||r.scene.getGroupUseWireFramePolygon()){let h=[];n.forEach(d=>{d.getBuilders().forEach((p,m)=>{let g=d.getMaxLength(m);!l[m]||!g||S_(h,m).push([g,p.updateBuf(),a.getBindGroup(m)])})});let u=this.scene.commandEncoder.beginRenderPass(this.desc);for(let d=0;d<h.length;d++){let p=h[d];p&&this[s](u,d,p,c)}u.end()}if(i!==1||r.scene.getGroupUseColorPolygon()){let h={};n.forEach(u=>{u.getPolygonBuilders().forEach((d,p)=>{d.length&&(h[p]||(h[p]=[]),h[p].push({builders:d,getRenderLength:u.getPolygonMaxLength.bind(u)}))})});for(let u of Object.keys(h)){let d=Number(u),p=this.getPolygonRenderColors(r,d);for(let m=0;m<p.length;m++){let g=p[m].isDoubleRgb?1:0,y=p[m].isForceHighLight?1:0,b=p[m].isGroupForceHighLight,P=p[m].colorIndexs;for(let T=0;T<P.length;T++){let I=P[T];t[43]!==g&&(t[43]=g),t[67]!==y&&(t[67]=y),this.scene.getHasGroupForceHighLight()&&this.scene.getGlobalHighLightType()===1&&(t[66]=Number(d)),t[58]=I,this.scene.addData(o,this.uniformsBuf);let C=[];h[d].forEach(O=>{O.builders.forEach((_,x)=>{let v=O.getRenderLength(x,u);!l[x]||!v||S_(C,x).push([v,_.updateBuf(),a.getBindGroup(Fr.getTemplateTypeByTemplateInstanceType(x))])})});let E=this.scene.commandEncoder.beginRenderPass(this.polygonRenderDesc);for(let O=0;O<C.length;O++){let _=C[O];_&&this[s](E,O,_,c)}E.end(),this.afterDraw[s](e,Number(I),c),this.scene.getGlobalHighLightType()===1&&b&&(this.afterDraw.renderPolygonHighLightColor(e,this.getGroupForceHighLightColorByColorIndex(Number(I),r),void 0,!0),this.highLightStencilBuf.clear(this.scene.commandEncoder,this.highLightStencilBuf.getSize()/3*2))}}}t[43]=0,t[66]=-1,t[67]=0,this.scene.addData(o,this.uniformsBuf)}}flushTarget(o){this.desc.colorAttachments[0].view=o.colorTexture.view,this.desc.colorAttachments[1].view=o.highLightColorTexture0.view,this.desc.colorAttachments[2].view=o.highLightColorTexture1.view,this.desc.depthStencilAttachment.view=o.depthStencilTexture.view,this.polygonRenderDesc.colorAttachments[0].view=o.colorTexture.view,this.polygonRenderDesc.depthStencilAttachment.view=o.depthStencilTexture.view}flush(o,t){return this.flushTarget(o),this.scene.char.flush(),this.scene.sdfStringInfoBuilder.updateBuf(),this.scene.ptGroup.getData().updateBuf(),this.scene.ptTemplate.getTemplateInstanceData().updateBuf(),this.scene.sdfStringLibrary.stringInfoBuilder.updateBuf(),this.scene.addData(t,this.uniformsBuf),this.scene.renderPtNum}drawTemplateToTarget(o,t,e,r,i){let n=new Uint32Array(Sve),s=new Float32Array(n.buffer);s.set(e.data),s.set(this.templateCamera.getRenderMatrix().data,16),s[33]=o.getPxLength(r,e),this.scene.addData(n,this.drawTemplatePipelineUniformsBuf),this.flushTarget(t);let a=this.scene.commandEncoder.beginRenderPass(this.desc),l=o.drawTemplateBindGroup;a.setPipeline(i?this.drawTemplatePipeline:this.drawTemplatePipelineWithoutDepth),a.setBindGroup(0,l.getBindGroup()),this.scene.ptTemplate.getTemplateInstanceData().updateBuf();let c=o.templateInstance.getData().updateBuf().getMemory();a.setVertexBuffer(0,c.getBuffer(),c.getOffset(),c.getSize()),a.draw(6,o.templateInstance.getMaxTemplateInstanceIndex()+1),a.end(),this.scene.submitCommandEncoder(),this.scene.drawTemplateToTargetTimes++}drawPolygonTemplate(o,t,e,r,i,n,s,a="render",l,c,h){if(c){if(l!==1){let u=[];if(i.getBuilders().forEach((p,m)=>{!Fr.isTemplateNormalPolygonType(m)||!i.getMaxLength(m)||(u[m]=p)}),!u.length)return;this.scene.commandEncoder.beginRenderPass(this.clearTemplateDesc).end(),this.scene.updateCameraBuf(this.templateCamera,Number.NEGATIVE_INFINITY),this.flushTarget(this.templateTarget);let d=Array.from(new Set(r.polygonTemplatePtColorArr));for(let p=0;p<d.length;p++){let m=d[p],g=this.getPolygonRenderColors(r,Number(m));for(let y=0;y<g.length;y++){let b=g[y].isDoubleRgb?1:0,P=g[y].colorIndexs;for(let T=0;T<P.length;T++){let I=P[T];s[43]!==b&&(s[43]=b),s[58]=I,this.scene.addData(n,this.uniformsBuf);let C=[];u.forEach((O,_)=>{let x=i.getMaxLength(_);x&&S_(C,_).push([x,O.updateBuf(),i.getBindGroup(_)])});let E=this.scene.commandEncoder.beginRenderPass(this.polygonRenderDesc);for(let O=0;O<C.length;O++){let _=C[O];_&&this[a](E,O,_,h)}E.end(),this.afterDraw[a](this.templateTarget,I,h)}}}s[43]=0,this.scene.addData(n,this.uniformsBuf)}else{this.scene.commandEncoder.beginRenderPass(this.clearTemplateDesc).end(),this.scene.updateCameraBuf(this.templateCamera,Number.NEGATIVE_INFINITY),this.flushTarget(this.templateTarget),this.scene.addData(n,this.uniformsBuf);let u=this.scene.commandEncoder.beginRenderPass(this.desc);i.getBuilders().forEach((d,p)=>{let m=i.getMaxLength(p);!Fr.isTemplateWireFramePolygonType(p)||!m||this[a](u,p,[[m,d.updateBuf(),i.getBindGroup(p)]],h)}),u.end()}this.scene.updateCameraBuf(e,Number.NEGATIVE_INFINITY),this.drawTemplateToTarget(r,o,t,e,h)}}isRenderTemplatePtType(o,t){return!(o&&Fr.isTemplateInstancePtType(t)&&!Fr.isCustomTemplateInstanceType(t))}draw(o,t,e,r,i,n,s,a,l,c,h,u="render",d,p,m){var g,y;let b=r.getBBox().toBBox2();this.scene.addData(new Uint32Array(new Float32Array([b.UL().x,b.UR().y,b.width(),b.height()]).buffer),this.polygonVertexBuf);let P=[];s&&(P[10]=!0,P[60]=!0,P[30]=!0),a&&(P[19]=!0),l&&(P[5]=!0),c&&KQe.forEach(z=>{this.isRenderTemplatePtType(p,z)&&(P[z]=!0)}),h&&((i===1||r.scene.getGroupUseWireFramePolygon())&&ZQe.forEach(z=>{this.isRenderTemplatePtType(p,z)&&(P[z]=!0)}),(i!==1||r.scene.getGroupUseColorPolygon())&&JQe.forEach(z=>{this.isRenderTemplatePtType(p,z)&&(P[z]=!0)}));let T=r.getPxLength(e,t),I=eDe(T,this.scene.getFixedPtData()),C=this.scene.renderPtNum,E=new Uint32Array(jge),O=new Float32Array(E.buffer);O.set(t.data),O[37]=T,E[38]=i,E[39]=r.isNormal?1:0,O[40]=r.getAllRgbRatio(),E[41]=r.isVisible()?1:0,E[42]=0,E[43]=0,O[66]=-1,O[67]=0,E[57]=r.isColorful?1:0,O.set(((g=this.scene.highLightColor[0])==null?void 0:g.getData())||ee.DefaultHighLightColor.getData(),44),O.set(((y=this.scene.highLightColor[1])==null?void 0:y.getData())||ee.DefaultHighLightColor.getData(),48);let _=this.scene.drcRenderModel===0;O[52]=this.scene.getSampling(),O[53]=0,O[54]=_?1:0,O[55]=this.scene.drcRenderStyle===0?1:0,O[56]=0,O[59]=this.scene.getGlobalHighLightType(),r.getOriginalColor()&&O.set(r.getOriginalColor().getData(),60),O[64]=this.scene.getForceVisibleHighLightPt()?1:0,O[65]=r.ignoreForceHighLightEffect?1:0;let x=this.scene.getFixedPtData();O[68]=x[0],O[69]=x[1],O[70]=x[2],O[71]=x[3],O[72]=x[4],O[73]=x[5],O[74]=x[6],O.set(this.scene.ambientLight.color.getData(),76),O.set(this.scene.directionalLight.color.getData(),80);let v=this.scene.directionalLight.direction();O.set([v.x,v.y,v.z],84);let D=this.scene.getViewOffset();O.set([D.x,D.y],88),this.flush(o,E);let w=r.getColor();w&&O.set(w.getData(),16),O.set(r.getNetStringColor().getData(),20);let F=r.getMaterial();F&&(O.set(F.ambient.getData(),24),O.set(F.diffuse.getData(),28),O.set(F.specular.getData(),32),O[35]=F.shininess,O[36]=F.alpha),this.scene.addData(E,this.uniformsBuf);let H=[];if(p&&c){this.scene.commandEncoder.beginRenderPass(this.clearTemplateDesc).end(),this.scene.updateCameraBuf(this.templateCamera,Number.NEGATIVE_INFINITY),this.flushTarget(this.templateTarget);let z=this.scene.commandEncoder.beginRenderPass(this.desc),V=!1;d.getBuilders().forEach((W,L)=>{let k=d.getMaxLength(L);!P[L]||Fr.isPolygonType(L)||!k||(V=!0,this[u](z,L,[[k,W.updateBuf(),d.getBindGroup(L)]],m))}),z.end(),V?(this.scene.updateCameraBuf(e,Number.NEGATIVE_INFINITY),this.drawTemplateToTarget(r,o,t,e,m)):(this.scene.updateCameraBuf(e,Number.NEGATIVE_INFINITY),this.flushTarget(o))}if(c&&n.forEach(z=>{z.getBuilders().forEach((V,W)=>{let L=z.getMaxLength(W);!P[W]||!L||W===68&&!I||S_(H,W).push([L,V.updateBuf(),d.getBindGroup(Fr.getTemplateTypeByTemplateInstanceType(W))])})}),s){if(p){let z=[];if(d.drawString(T,(V,W,L)=>{z.push([L,V.updateBuf(),d.getBindGroup(60)])}),z.length){this.scene.commandEncoder.beginRenderPass(this.clearTemplateDesc).end(),this.scene.updateCameraBuf(this.templateCamera,Number.NEGATIVE_INFINITY),this.flushTarget(this.templateTarget);let V=this.scene.commandEncoder.beginRenderPass(this.desc);this[u](V,60,z,m),V.end(),this.scene.updateCameraBuf(e,Number.NEGATIVE_INFINITY),this.drawTemplateToTarget(r,o,t,e,m)}}n.forEach(z=>{z.drawString(T,(V,W,L)=>{S_(H,10).push([L,V.updateBuf(),d.getStringTemplateBindGroup(W)])}),!p&&z.drawTemplateString(T,(V,W,L)=>{S_(H,30).push([L,V.updateBuf(),d.getStringTemplateBindGroup(W)])}),z.drawCustomTemplateString(T,(V,W,L)=>{S_(H,45).push([L,V.updateBuf(),d.getStringTemplateBindGroup(W)])})})}a&&n.forEach(z=>{let V=z.getBuilders()[19],W=z.getMaxLength(19);!W||_&&z.getDrcPxLength()<T||S_(H,19).push([W,V.updateBuf(),d.getBindGroup(19)])});{let z=this.scene.commandEncoder.beginRenderPass(this.desc);for(let V=0;V<H.length;V++){let W=H[V];W&&this[u](z,V,W,m)}z.end()}h&&(r.polygonColorAlphaRatio!==1&&(O[19]=r.polygonColorAlphaRatio*w.alpha,O[63]=r.polygonColorAlphaRatio*r.getOriginalColor().alpha),this.drawPolygonTemplate(o,t,e,r,d,E,O,u,i,p,m),this.drawPolygon(E,O,o,r,i,n,u,d,P,m))}};function S_(o,t){return o[t]||(o[t]=[])}var aet=!1,rs=4,cet=2**30/rs,e4t=cet/2,t4t=2**(2**7-1),r4t=2**31-1,het=1024;function LC(){return window}async function uet(o){return await t(o);async function t(e){try{let r=oet(e);return await e.device.queue.onSubmittedWorkDone(),{renderPt:r}}catch(r){throw r}}}var _a="rgba8unorm",J2="depth24plus-stencil8",B1e="sans-serif";function Ew(o,t){return`${o["font-style"]||"normal"} ${o["font-weight"]||"normal"} ${`${t||parseFloat(o["font-size"])||10}px`} "${o["font-family"]}", ${B1e}`}var rDe=class dH{constructor(){this.lastFontStyleString="",this.lastRatio=0,this.ctx=new U0(document.createElement("canvas").getContext("2d")),this.recordFontFamily=new Map}static getInstance(){return dH.instance==null&&(dH.instance=new dH),dH.instance}isFontApplied(t,e,r){let i=t.getContext().font.toLowerCase();return i.includes(e.toString())&&r.split(",").some(n=>(n=n.trim(),n=n.replace(/^['"]|['"]$/g,""),i.includes(n.toLowerCase())))}getApplyFontFamily(t,e){if(!e)return t;let r=this.recordFontFamily.get(t);if(r)return r;let i=B1e;return this.ctx.setFont(`${V7}px "${t}"`),this.isFontApplied(this.ctx,V7,t)&&(i=t),this.ctx.setFont(`10px ${B1e}`),this.recordFontFamily.set(t,i),i}getTextInfo(t,e,r=!0,i=!0){if(e["font-family"]=this.getApplyFontFamily(e["font-family"],i),this.ctx.setTextBaseLine("bottom"),!r)return this.getTextInfoDisableCorrection(t,e);let n=parseFloat(e["font-size"]),s=JSON.stringify(e);if(!this.lastFontStyleString||!this.lastRatio||s!==this.lastFontStyleString){let c=Ew(e,V7);this.ctx.setFont(c);let h=this.ctx.getContext().measureText(t),u=Math.abs(h.fontBoundingBoxAscent)+Math.abs(h.fontBoundingBoxDescent);this.lastRatio=V7/u,this.lastFontStyleString=s}let a=n*this.lastRatio,l=Ew(e,a);return this.ctx.setFont(l),{width:this.ctx.getContext().measureText(t).width,height:n,fontFamily:e["font-family"],renderFontSize:a}}getTextInfoDisableCorrection(t,e){let r=parseFloat(e["font-size"]),i=Ew(e,r);this.ctx.setFont(i);let n=this.ctx.getContext().measureText(t);return{width:n.width,height:Math.abs(n.fontBoundingBoxAscent)+Math.abs(n.fontBoundingBoxDescent),fontFamily:e["font-family"],renderFontSize:r}}};rDe.instance=null;var det=rDe,Lye=class{};Lye.value=null;function F1e(o){if(typeof o!="object"||o===null||o instanceof Date||o instanceof ArrayBuffer)return o;if(Array.isArray(o))return o.map(F1e);{let t={};for(let e in o)o.hasOwnProperty(e)&&(t[e]=F1e(o[e]));return t}}function vve(o,t,e){return{x:t*o[0]+e*o[3]+o[6],y:t*o[1]+e*o[4]+o[7]}}function El(o,t,e){return{x:o*Math.cos(e)-t*Math.sin(e),y:o*Math.sin(e)+t*Math.cos(e)}}function xve(o,t,e,r){return{x:o*e,y:t*r}}function V1e(o,t,e){let r=o[t];return r!==void 0||(r=e(t),o[t]=r),r}function pet(o,t){return V1e(o,t,()=>[])}var fet=GT*3,Mye=(o=>(o[o.ID=0]="ID",o[o.POSITION_X=1]="POSITION_X",o[o.POSITION_Y=2]="POSITION_Y",o[o.WIDTH=3]="WIDTH",o[o.HEIGHT=4]="HEIGHT",o[o.ANGLE=5]="ANGLE",o[o.STRING_LENGTH=6]="STRING_LENGTH",o[o.STRING_INDEX=7]="STRING_INDEX",o[o.MAX_PX_HEIGHT=8]="MAX_PX_HEIGHT",o[o.LIMIT_MAX=9]="LIMIT_MAX",o[o.GROUP_ID=10]="GROUP_ID",o[o.COLOR_INDEX=11]="COLOR_INDEX",o[o.ORDER=12]="ORDER",o[o.WIDTH_OFFSET_RATIO=13]="WIDTH_OFFSET_RATIO",o[o.HEIGHT_OFFSET_RATIO=14]="HEIGHT_OFFSET_RATIO",o[o.TEMPLATE_ID=15]="TEMPLATE_ID",o))(Mye||{}),iDe=15,gm=[],nDe=class extends Up{create(o,t,e,r,i,n,s,a,l,c=-1,h,u,d,p){return gm[0]=o+(10<<Js)+cs,gm[1]=t.x,gm[2]=t.y,gm[3]=e,gm[4]=r,gm[5]=(i%Zs+Zs)%Zs,gm[6]=n,gm[7]=s,gm[8]=r/a,gm[9]=l,gm[10]=c,gm[11]=h||0,gm[12]=u||0,gm[13]=d||0,gm[14]=p||0,gm}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+5],n=o[t+3]/2,s=o[t+4]/2,a=o[t+13],l=o[t+14];if(e+=a*n*2,r+=l*s*2,i===0||i===Math.PI)return Xa.modify(e-n,e+n,r-s,r+s);if(i===GT||i===fet)return Xa.modify(e-s,e+s,r-n,r+n);let c=El(n,-s,i),h=El(n,s,i),u=El(-n,-s,i),d=El(-n,s,i),p={x:e+d.x,y:r+d.y},m={x:e+u.x,y:r+u.y},g={x:e+h.x,y:r+h.y},y={x:e+c.x,y:r+c.y};return Xa.modify(Math.min(p.x,m.x,g.x,y.x),Math.max(p.x,m.x,g.x,y.x),Math.min(p.y,m.y,g.y,y.y),Math.max(p.y,m.y,g.y,y.y))}},met=class extends nDe{create(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m){return super.create(o,t,e,r,i,n,s,a,l,c,h,u,d,p),gm[0]=o+(60<<Js)+cs,gm[14]=m,gm}},J7=new nDe(10,iDe,Mye),VZ=new met(60,iDe+1,Mye),g9=2,SZ=class{constructor(o){this.data=o,this.bitmap=new Xm(32),this.bitmap.addTrimListener(t=>{this.data.trimChunk(t*g9)}),this.indexMap=new Map}add(o,t){let e=this.bitmap.findEmpty();e===-1&&(this.bitmap=this.bitmap.extSize(this.bitmap.size*2),e=this.bitmap.findEmpty()),this.bitmap.markUsed(e);let r=this.indexMap.get(o);r||r==0?Array.isArray(r)?r.push(e):(r=[r,e],this.indexMap.set(o,r)):this.indexMap.set(o,e),this.data.setArr([o,t],e*g9)}getColorIndex(o){return o>>W7}getColorIndexByDataIndex(o){return this.data.get(o*g9+1)}getDataIndexArrayByColorIndex(o,t,e){let r=[];if(t.forEach(i=>{let n=this.getColorIndexByDataIndex(i);o===n&&r.push(i)}),!r.length)throw new Error(`colorIndex error id:${e},colorIndex:${o}`);return r}remove(o,t){let e=this.indexMap.get(o);if(e==null)return 0;if(Array.isArray(e)){if(t){let r=this.getDataIndexArrayByColorIndex(t,e,o),i=r[r.length-1];this.data.set(i*g9,-1),this.bitmap.markRemove(i),e.forEach((n,s)=>{n===i&&e.splice(s,1)})}else{let r=e.length-1;this.data.set(e[r]*g9,-1),this.bitmap.markRemove(e[r]),e.pop()}e.length?e.length>1?this.indexMap.set(o,e):this.indexMap.set(o,e[0]):this.indexMap.delete(o)}else{if(t){let r=this.getColorIndexByDataIndex(e);if(t!==r)throw new Error(`colorIndex error id:${o},colorIndex:${t},recordColorIndex: ${r}`)}this.data.set(e*g9,-1),this.bitmap.markRemove(e),this.indexMap.delete(o)}return 1}getData(){return this.data}getMaxLength(){return this.bitmap.getMax()+1}getPtHighLightColorArray(o){let t=this.indexMap.get(o),e=[];if(t||t==0)if(!Array.isArray(t))e.push(this.data.get(t*g9+1));else for(let r=0;r<t.length;r+=1)e.push(this.data.get(t[r]*g9+1));return e}},get=GT*3,oDe=(o=>(o[o.ID=0]="ID",o[o.POSITION_X=1]="POSITION_X",o[o.POSITION_Y=2]="POSITION_Y",o[o.WIDTH=3]="WIDTH",o[o.HEIGHT=4]="HEIGHT",o[o.ANGLE=5]="ANGLE",o[o.MAX_PX_LENGTH=6]="MAX_PX_LENGTH",o[o.LIMIT_MAX=7]="LIMIT_MAX",o[o.LEFT_STRING_INDEX=8]="LEFT_STRING_INDEX",o[o.RIGHT_STRING_INDEX=9]="RIGHT_STRING_INDEX",o[o.ORDER=10]="ORDER",o[o.GROUP_ID=11]="GROUP_ID",o[o.COLOR_INDEX=12]="COLOR_INDEX",o[o.TEMPLATE_ID=13]="TEMPLATE_ID",o))(oDe||{}),yet=13,j2=[],bet=class extends Up{create(o,t,e,r,i,n,s,a,l,c=-1,h,u){return j2[0]=o+(19<<Js)+cs,j2[1]=t.x,j2[2]=t.y,j2[3]=e,j2[4]=r,j2[5]=(i%Zs+Zs)%Zs,j2[6]=r/n,j2[7]=s,j2[8]=a,j2[9]=l,j2[10]=u||0,j2[11]=c,j2[12]=h||0,j2}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+5],n=o[t+3]/2,s=o[t+4]/2;if(i===0||i===Math.PI)return Xa.modify(e-n,e+n,r-s,r+s);if(i===GT||i===get)return Xa.modify(e-s,e+s,r-n,r+n);let a=El(n,-s,i),l=El(n,s,i),c=El(-n,-s,i),h=El(-n,s,i),u={x:e+h.x,y:r+h.y},d={x:e+c.x,y:r+c.y},p={x:e+l.x,y:r+l.y},m={x:e+a.x,y:r+a.y};return Xa.modify(Math.min(u.x,d.x,p.x,m.x),Math.max(u.x,d.x,p.x,m.x),Math.min(u.y,d.y,p.y,m.y),Math.max(u.y,d.y,p.y,m.y))}},Nye=new bet(19,yet,oDe),LH=class extends Up{getOrder(o,t,e){let r=o[t+this.DataIndex.GROUP_ID]*sd+6;return e.get(r)}getGroupIdByBuilder(o,t,e){if(!this.DataIndex.GROUP_ID)throw new Error("GetGroupId error ");let r=o.get(t+this.DataIndex.GROUP_ID)*sd+8;return e.get(r)}getTemplateId(o,t,e){let r=o[t+this.DataIndex.GROUP_ID]*sd+9;return e.get(r)}getColorIndex(o,t,e){let r=o[t+this.DataIndex.GROUP_ID]*sd+7;return e.get(r)}},Ch=(o=>(o[o.ID=0]="ID",o[o.INDEX=1]="INDEX",o[o.TEMPLATE_INSTANCE_INDEX=2]="TEMPLATE_INSTANCE_INDEX",o[o.COLOR_INDEX=3]="COLOR_INDEX",o[o.GROUP_ID=4]="GROUP_ID",o))(Ch||{}),Hh=5,T7=[];function sDe(o,t,e,r,i=-1){return T7[0]=o+(this.type<<Js)+cs,T7[1]=t,T7[2]=e,T7[3]=r||0,T7[4]=i,T7}var d0=class extends Up{create(o,t,e,r,i=-1){return sDe(o,t,e,r,i)}getBBox(o,t){return Xa}},W_=class extends LH{create(o,t,e,r,i=-1){return sDe(o,t,e,r,i)}getBBox(o,t){return Xa}},Pet=new d0(21,Hh,Ch),Tet=new d0(22,Hh,Ch),Iet=new d0(23,Hh,Ch),Cet=new d0(24,Hh,Ch),Eet=new d0(25,Hh,Ch),Oet=new d0(26,Hh,Ch),Aet=new d0(27,Hh,Ch),_et=new W_(28,Hh,Ch),vet=new W_(29,Hh,Ch),D_=new d0(30,Hh,Ch),xet=new d0(31,Hh,Ch),Ret=new d0(32,Hh,Ch),Det=new W_(33,Hh,Ch),wet=new W_(34,Hh,Ch),Let=new d0(35,Hh,Ch),Met=new d0(36,Hh,Ch),Net=new d0(37,Hh,Ch),ket=new d0(38,Hh,Ch),Bet=new d0(39,Hh,Ch),Fet=new d0(40,Hh,Ch),Vet=new d0(41,Hh,Ch),Get=new d0(42,Hh,Ch),Uet=new W_(43,Hh,Ch),Het=new W_(44,Hh,Ch),Wet=new d0(45,Hh,Ch),zet=new d0(46,Hh,Ch),Yet=new d0(47,Hh,Ch),jet=new W_(48,Hh,Ch),Xet=new W_(49,Hh,Ch),qet=new d0(50,Hh,Ch),RC=4,EZ=2**RC-1,kye=class{constructor(o,t,e,r){if(this.minStringLevel=t,this.maxStringLevel=e,this.builders=[],this.bitmaps=[],this.strBuilders=[],this.strBitmaps=[],this.templateStrBuilders=[],this.templateStrBitmaps=[],this.customTemplateStrBuilders=[],this.customTemplateStrBitmaps=[],this.stringMaxPxLength=Number.NEGATIVE_INFINITY,this.drcPtMaxPxLength=null,this.sdfStrBuilders=[],this.sdfStrBitmaps=[],this.highLightGroupIds=[],this.stringHighLightGroupIds=[],this.stringTemplateHighLightGroupIds=[],this.stringCustomTemplateHighLightGroupIds=[],this.createBuilder=o,this.createHighLightIdsBuilder=r,e-t+1>2**RC)throw new Error("maxStringLevel - minStringLevel + 1 > 2 ** StringLevelBitLength")}clear(){this.builders.length=0,this.bitmaps.length=0,this.strBuilders.length=0,this.strBitmaps.length=0,this.templateStrBuilders.length=0,this.templateStrBitmaps.length=0,this.customTemplateStrBuilders.length=0,this.customTemplateStrBuilders.length=0,this.stringMaxPxLength=Number.NEGATIVE_INFINITY,this.drcPtMaxPxLength=null,this.sdfStrBuilders.length=0,this.sdfStrBitmaps.length=0,this.highLightGroupIds.length=0,this.stringHighLightGroupIds.length=0,this.stringTemplateHighLightGroupIds.length=0,this.stringCustomTemplateHighLightGroupIds.length=0}addStringHighLightPt(o,t,e,r){let{level:i,index:n}=this.getStringInfo(o,r);this.stringHighLightGroupIds[t]||(this.stringHighLightGroupIds[t]=[]),this.stringHighLightGroupIds[t][i]||(this.stringHighLightGroupIds[t][i]=new SZ(this.createHighLightIdsBuilder(i))),this.stringHighLightGroupIds[t][i].add(n,e)}addStringTemplateHighLightPt(o,t,e,r){let{level:i,index:n}=this.getTemplateStringInfo(o,r),s=r===30?this.stringTemplateHighLightGroupIds:this.stringCustomTemplateHighLightGroupIds;s[t]||(s[t]=[]),s[t][i]||(s[t][i]=new SZ(this.createHighLightIdsBuilder(i))),s[t][i].add(n,e)}isTemplateStringType(o){return o===30||o===45}addHighLightPt(o,t,e,r){if(this.isStringType(o)){this.addStringHighLightPt(t,e,r,o);return}if(this.isTemplateStringType(o)){this.addStringTemplateHighLightPt(t,e,r,o);return}this.highLightGroupIds[e]||(this.highLightGroupIds[e]=[]),this.highLightGroupIds[e][o]||(this.highLightGroupIds[e][o]=new SZ(this.createHighLightIdsBuilder(o))),this.highLightGroupIds[e][o].add(t,r)}removeHighLightPt(o,t,e,r){var i;return this.isStringType(o)?this.removeStringHighLightPt(t,e,r,o):this.isTemplateStringType(o)?this.removeStringTemplateHighLightPt(t,e,r,o):(i=this.highLightGroupIds[e])!=null&&i[o]?this.highLightGroupIds[e][o].remove(t,r):0}removeStringHighLightPt(o,t,e,r){let{level:i,index:n}=this.getStringInfo(o,r);return this.stringHighLightGroupIds[t][i].remove(n,e)}removeStringTemplateHighLightPt(o,t,e,r){let{level:i,index:n}=this.getTemplateStringInfo(o,r);return(r===30?this.stringTemplateHighLightGroupIds:this.stringCustomTemplateHighLightGroupIds)[t][i].remove(n,e)}getHighLightIds(o,t=1){var e;return this.isStringType(t)?this.getStringHighLightIds(o):this.isTemplateStringType(t)?this.getStringTemplateHighLightIds(o,t):(e=this.highLightGroupIds)==null?void 0:e[o]}getStringHighLightIds(o){var t;return(t=this.stringHighLightGroupIds)==null?void 0:t[o]}getStringTemplateHighLightIds(o,t){var e,r;return t===30?(e=this.stringTemplateHighLightGroupIds)==null?void 0:e[o]:(r=this.stringCustomTemplateHighLightGroupIds)==null?void 0:r[o]}getHighLightInfo(o,t){var e,r;if(this.isStringType(o))return this.getStringHighLightInfo(t,o);if(this.isTemplateStringType(o))return this.getStringTemplateHighLightInfo(t,o);let i=[];for(let n=0;n<this.highLightGroupIds.length;n++){let s=(r=(e=this.highLightGroupIds[n])==null?void 0:e[o])==null?void 0:r.getPtHighLightColorArray(t);s!=null&&s.length&&(i[n]=s)}return i}getStringHighLightInfo(o,t){var e,r;let{level:i,index:n}=this.getStringInfo(o,t),s=[];for(let a=0;a<this.stringHighLightGroupIds.length;a++){let l=(r=(e=this.stringHighLightGroupIds[a])==null?void 0:e[i])==null?void 0:r.getPtHighLightColorArray(n);l!=null&&l.length&&(s[a]=l)}return s}getStringTemplateHighLightInfo(o,t){var e,r;let{level:i,index:n}=this.getTemplateStringInfo(o,t),s=[],a=t===30?this.stringTemplateHighLightGroupIds:this.stringCustomTemplateHighLightGroupIds;for(let l=0;l<a.length;l++){let c=(r=(e=a[l])==null?void 0:e[i])==null?void 0:r.getPtHighLightColorArray(n);c!=null&&c.length&&(s[l]=c)}return s}getHighLightIdInfo(o,t,e){var r,i;return this.isStringType(o)?this.getStringHighLightIdInfo(t,e,o):((i=(r=this.highLightGroupIds[e])==null?void 0:r[o])==null?void 0:i.getPtHighLightColorArray(t))||[]}getStringHighLightIdInfo(o,t,e){var r,i;let{level:n,index:s}=this.getStringInfo(o,e);return((i=(r=this.stringHighLightGroupIds[t])==null?void 0:r[n])==null?void 0:i.getPtHighLightColorArray(s))||[]}removeHighLightPtAll(o,t,e,r){let i=0;for(let n=0;n<e.length;n++){let s=e[n];for(let a=0;a<(s==null?void 0:s.length);a++)r?r===s[a]&&(i+=this.removeHighLightPt(o,t,n,s[a])):i+=this.removeHighLightPt(o,t,n,s[a])}return i}addHighLightPtAll(o,t,e){let r=0;for(let i=0;i<e.length;i++){let n=e[i];for(let s=0;s<(n==null?void 0:n.length);s++)r++,this.addHighLightPt(o,t,i,n[s])}return r}setHighLightPtNum(o,t,e,r,i){let n=this.getHighLightIdInfo(o,t,e),s="none",a=n.filter(l=>l===i);if(a.length==r)return{operate:s,highLightNum:0};if(a.length==n.length){let l=r-n.length,c=Math.abs(l);if(l>0){s="add";for(let h=0;h<c;h++)this.addHighLightPt(o,t,e,i)}else{s="remove";for(let h=0;h<c;h++)this.removeHighLightPt(o,t,e,i)}return{operate:s,highLightNum:c}}else if(r==n.length){for(let l=0;l<r;l++)this.removeHighLightPt(o,t,e,n[0]);for(let l=0;l<r;l++)this.addHighLightPt(o,t,e,i);return{operate:s,highLightNum:0}}else{let l=r-n.length,c=Math.abs(l);for(let h=0;h<n.length;h++)this.removeHighLightPt(o,t,e,n[h]);l>0?s="add":s="remove";for(let h=0;h<r;h++)this.addHighLightPt(o,t,e,i);return{operate:s,highLightNum:c}}}getPtNum(o){var t;if(Fr.isNormalPolygonType(o))throw new Error("type error");return((t=this.bitmaps[o])==null?void 0:t.getMarked())||0}getStringMaxPxLength(){return this.stringMaxPxLength}getDrcPxLength(){return this.drcPtMaxPxLength}calStringLevel(o){return Math.max(this.minStringLevel,Math.min(this.maxStringLevel,Math.ceil(Math.log2(o))))-this.minStringLevel}calStringPtLevel(o){let t=o[8];return t>this.stringMaxPxLength&&(this.stringMaxPxLength=t),this.calStringLevel(t)}addString(o,t,e){let r=this.calStringPtLevel(o),i=this.getStringEnvLength(e),n=this.strBitmaps[r];if(!n){this.strBitmaps[r]=n=new Xm(32);let a=this.strBuilders[r]=this.createBuilder(e);this.strBitmaps[r].addTrimListener(l=>{a.trimChunk(l*i)})}let s=n.findEmpty();s===-1&&(this.strBitmaps[r]=n=n.extSize(n.size*2),s=n.findEmpty()),n.markUsed(s),this.strBuilders[r].setArr(o,s*i),this.builders[e].set(t,(s<<RC)+r)}addTemplateString(o,t,e){let r=e===30?this.templateStrBitmaps:this.customTemplateStrBitmaps,i=this.templateStrBuilders,n=o[1]&EZ,s=r[n];if(!s){r[n]=s=new Xm(32);let l=i[n]=this.createBuilder(30);r[n].addTrimListener(c=>{l.trimChunk(c*D_.length)})}let a=s.findEmpty();a===-1&&(r[n]=s=s.extSize(s.size*2),a=s.findEmpty()),s.markUsed(a),i[n].setArr(o,a*D_.length),this.builders[e].set(t,(a<<RC)+n)}calDrcPtLevel(o){let t=o[6];this.drcPtMaxPxLength=t}createId(o,t,e){let r=this.bitmaps[o];if(!r){this.bitmaps[o]=r=new Xm(32),this.builders[o]||(this.builders[o]=this.createBuilder(o));let n=this.builders[o];r.addTrimListener(s=>{n.trimChunk(s*e)})}let i=r.findEmpty();return i===-1&&(this.bitmaps[o]=r=r.extSize(r.size*2),i=r.findEmpty()),r.markUsed(i),i}addPt(o,t,e){let r=this.createId(o,t,e);return this.isStringType(o)?this.addString(t,r,o):this.isTemplateStringType(o)?this.addTemplateString(t,r,o):(o===19&&!this.drcPtMaxPxLength&&this.calDrcPtLevel(t),this.builders[o].setArr(t,r*Fr.getPtLengthByType(o))),r}getStringInfo(o,t){o=this.builders[t].get(o);let e=o&EZ,r=o>>RC;return{level:e,index:r,builder:this.strBuilders[e],bitmap:this.strBitmaps[e]}}removeString(o,t){let{builder:e,bitmap:r,index:i}=this.getStringInfo(o,t);e.set(i*this.getStringEnvLength(t),0),r.markRemove(i)}getTemplateStringInfo(o,t){let e=t===30?this.templateStrBitmaps:this.customTemplateStrBitmaps,r=this.templateStrBuilders;o=this.builders[30].get(o);let i=o&EZ,n=o>>RC;return{level:i,index:n,builder:r[i],bitmap:e[i]}}removeTemplateString(o,t){let{builder:e,bitmap:r,index:i}=this.getTemplateStringInfo(o,t);e.set(i*D_.length,0),r.markRemove(i)}isStringType(o){return o===10||o===60}getStringEnvLength(o){return o===10?J7.length:VZ.length}removePt(o,t){this.isStringType(o)?this.removeString(t,o):this.isTemplateStringType(o)?this.removeTemplateString(t,o):this.builders[o].set(t*Fr.getPtLengthByType(o),0),this.bitmaps[o].markRemove(t)}updatePt(o,t,e){if(this.isStringType(o)){let{builder:r,level:i,index:n}=this.getStringInfo(t,o),s=this.calStringPtLevel(e);return i===s?r.setArr(e,n*this.getStringEnvLength(o)):(this.removeString(t,o),this.addString(e,t,o)),t}if(this.isTemplateStringType(o)){let{builder:r,level:i,index:n}=this.getTemplateStringInfo(t,o),s=this.calStringPtLevel(e);return i===s?r.setArr(e,n*D_.length):(this.removeTemplateString(t,o),this.addTemplateString(e,t,o)),t}return this.builders[o].setArr(e,t*Fr.getPtLengthByType(o)),t}getPt(o,t){if(this.isStringType(o)){let{builder:r,index:i}=this.getStringInfo(t,o);return r.slice(i*this.getStringEnvLength(o),(i+1)*this.getStringEnvLength(o))}if(this.isTemplateStringType(o)){let{builder:r,index:i}=this.getTemplateStringInfo(t,o);return r.slice(i*D_.length,(i+1)*D_.length)}let e=Fr.getPtLengthByType(o);return this.builders[o].slice(t*e,(t+1)*e)}setPtVisible(o,t,e){let r,i=!1,n,s;if(this.isStringType(o)){let{builder:l,index:c}=this.getStringInfo(t,o);n=c*this.getStringEnvLength(o),s=l}else if(this.isTemplateStringType(o)){let{builder:l,index:c}=this.getTemplateStringInfo(t,o);n=c*D_.length,s=l}else n=t*Fr.getPtLengthByType(o),s=this.builders[o];let a=(s.get(n)&cs)!==0;return e!==a&&(e?s.set(n,s.get(n)|cs):s.set(n,s.get(n)&TH),r=s.slice(n,n+Fr.getPtLengthByType(o)),i=!0),{ptData:r,isUpdate:i}}getBuilders(){return this.builders}getMaxLength(o){var t;return(t=this.bitmaps)!=null&&t[o]?this.bitmaps[o].getMax()+1:0}getStringBuilders(){return this.strBuilders}getTemplateStringBuilders(){return this.templateStrBuilders}drawString(o,t){for(let e=this.calStringLevel(o);e<this.strBuilders.length;e++){let r=this.strBuilders[e],i=this.strBitmaps[e]?this.strBitmaps[e].getMax()+1:0;!r||!i||t(r,e,i)}}drawTemplateString(o,t){for(let e=this.calStringLevel(o);e<this.templateStrBuilders.length;e++){let r=this.templateStrBuilders[e],i=this.templateStrBitmaps[e]?this.templateStrBitmaps[e].getMax()+1:0;!r||!i||i&&t(r,e,i)}}drawCustomTemplateString(o,t){for(let e=this.calStringLevel(o);e<this.customTemplateStrBuilders.length;e++){let r=this.customTemplateStrBuilders[e],i=this.customTemplateStrBitmaps[e]?this.customTemplateStrBitmaps[e].getMax()+1:0;!r||!i||t(r,e,i)}}drawSdfString(o){for(let t=0;t<this.sdfStrBuilders.length;t++){let e=this.sdfStrBuilders[t],r=this.sdfStrBitmaps[t]?this.sdfStrBitmaps[t].getMax()+1:0;!e||!r||o(e,t)}}},$et=2**K7-1,aDe=class{constructor(){this.ptNum=0,this.indexsArr=new Array(69).fill(0).map(()=>[]),this.bitmaps=[]}static getTypeById(o){return o&$et}getIndexsArrIndex(o){return o>>K7}getIndex(o){let t=this.bitmaps[o];t||(this.bitmaps[o]=t=new Xm(32));let e=t.findEmpty();return e===-1&&(this.bitmaps[o]=t=t.extSize(t.size*2),e=t.findEmpty()),t.markUsed(e),e}clearArrData(){this.ptNum=0,this.indexsArr.forEach(o=>o.length=0),this.bitmaps.length=0}addHighLightPt(o,t,e){let{block:r,index:i,type:n}=this.getInfo(o);return r.addHighLightPt(n,i,t,e),this.scene.needRender=!0,r.getPt(n,i)}removeHighLightPt(o,t,e){let{block:r,index:i,type:n}=this.getInfo(o),s=0;if(t||t==0)s=r.removeHighLightPt(n,i,t,e);else{let a=r.getHighLightInfo(n,i);s=r.removeHighLightPtAll(n,i,a,e)}return this.scene.needRender=!0,{pt:r.getPt(n,i),num:s}}setHighLightPtNum(o,t,e,r){let{block:i,index:n,type:s}=this.getInfo(o);i.setHighLightPtNum(s,n,t,e,r);let a=i.getPt(s,n);return this.scene.needRender=!0,a}getPt(o){let{block:t,index:e,type:r}=this.getInfo(o);return t.getPt(r,e)}setPtVisible(o,t){let{block:e,index:r,type:i}=this.getInfo(o),{ptData:n,isUpdate:s}=e.setPtVisible(i,r,t);return s&&(this.scene.needRender=!0),{ptData:n,isUpdate:s}}getPtNum(){return this.ptNum}};function FK(){return new kye(()=>new XE(Float32Array),-10,5,()=>new XE(Int32Array))}var Ket=class lDe extends aDe{constructor(t,e){super(),this.plane=e,this.ptNums=new Array(69).fill(0),this.stringMaxPxLength=Number.NEGATIVE_INFINITY,this.grids=[],this.levelsArr=new Array(69).fill(0).map(()=>[]),this.xsArr=new Array(69).fill(0).map(()=>[]),this.ysArr=new Array(69).fill(0).map(()=>[]),this.scene=t,t.getUseGridAccelerate()||(this.block=FK()),this.MIN_WH=this.scene.getMinWh()}getInfo(t){let e=lDe.getTypeById(t),r=this.getIndexsArrIndex(t),i=this.levelsArr[e][r];if(i===-1)return{block:this.block,type:e,ptId:r,level:i,index:this.indexsArr[e][r]};let n=this.xsArr[e][r],s=this.ysArr[e][r];return{block:this.grids[i].get(n).get(s),type:e,ptId:r,level:i,x:n,y:s,index:this.indexsArr[e][r]}}clear(){this.clearArrData(),this.levelsArr.forEach(t=>t.length=0),this.xsArr.forEach(t=>t.length=0),this.ysArr.forEach(t=>t.length=0),this.ptNums.fill(0),this.stringMaxPxLength=Number.NEGATIVE_INFINITY,this.grids.length=0}calGrid(t,e,r=this.plane.getPtBBox(t,0,e)){let i,n,s,a=-1,l=this.MIN_WH;if(!this.scene.getUseGridAccelerate())i=this.block;else{let h=r.width(),u=r.height();if(a=Math.floor(Math.log2(Math.max(h,u)/l)),a<0)a=0;else{let g=l*2**a;(h>g&&Math.floor(r.minX/g+.5)!==Math.floor(r.maxX/g-.5)||u>g&&Math.floor(r.minY/g+.5)!==Math.floor(r.maxY/g-.5))&&a++}let d=r.center(),p=l*2**a;n=Math.floor(d.x/p),s=Math.floor(d.y/p);let m=this.grids[a];if(m){let g=m.get(n);g?(i=g.get(s),i||(i=FK(),g.set(s,i))):(g=new Map,m.set(n,g),i=FK(),g.set(s,i))}else{this.grids[a]=m=new Map;let g=new Map;m.set(n,g),i=FK(),g.set(s,i)}}let c=Fr.getType(t[0]);return{block:i,type:c,x:n,y:s,level:a}}addPt(t,e,r,i,n=this.calGrid(t,e,i)){let{type:s,block:a,level:l,x:c,y:h}=n,u=a.addPt(s,t,Fr.getPtLengthByType(s));if(r===void 0){let d=this.getIndex(s);r=(d<<K7)+s;let p=s;this.indexsArr[p][d]=u,this.levelsArr[p][d]=l,this.xsArr[p][d]=c,this.ysArr[p][d]=h,this.ptNum++,this.ptNums[s]++,this.stringMaxPxLength<a.getStringMaxPxLength()&&(this.stringMaxPxLength=a.getStringMaxPxLength())}else{let d=this.getIndexsArrIndex(r),p=s;this.indexsArr[p][d]=u,this.levelsArr[p][d]=l,this.xsArr[p][d]=c,this.ysArr[p][d]=h}return this.scene.needRender=!0,r}removePt(t){let e=!1,{block:r,index:i,type:n,ptId:s}=this.getInfo(t),a=r.getPt(n,i),l=r.getHighLightInfo(n,i);l.length&&(e=!0,r.removeHighLightPtAll(n,i,l)),r.removePt(n,i);let c=n;return delete this.indexsArr[c][s],delete this.levelsArr[c][s],delete this.xsArr[c][s],delete this.ysArr[c][s],this.bitmaps[n].markRemove(s),this.ptNum--,this.ptNums[n]--,this.scene.needRender=!0,{oldPt:a,isHighLightPt:e}}updatePt(t,e,r){let i=!1,{block:n,index:s,type:a}=this.getInfo(t),l=n.getPt(a,s),c=this.calGrid(e,r),h=n.getHighLightInfo(a,s);if(n===c.block&&a===c.type)a!==8&&a!==9&&n.updatePt(a,s,e),h.length&&(i=!0);else if(h.length&&(n.removeHighLightPtAll(a,s,h),i=!0),n.removePt(a,s),this.addPt(e,r,t,void 0,c),h.length){let{block:u,index:d}=this.getInfo(t);u.addHighLightPtAll(a,d,h)}return this.stringMaxPxLength<n.getStringMaxPxLength()&&(this.stringMaxPxLength=n.getStringMaxPxLength()),this.scene.needRender=!0,{oldPt:l,isHighLightPt:i}}getBlocks(t,e,r,i,n,s){let a=[],l=e.getPxLength();if(!n&&!s&&(!r||l>this.stringMaxPxLength)&&(!i||this.ptNums[5]===0))return a;if(!this.scene.getUseGridAccelerate())return a.push(this.block),a;let c=e.getBBox2().transform4(t.getInverseMatrix());return this.grids.forEach((h,u)=>{let d=this.MIN_WH*2**u,p=Math.floor(c.minX/d-.5),m=Math.floor(c.maxX/d+.5),g=Math.floor(c.minY/d-.5),y=Math.floor(c.maxY/d+.5);h.forEach((b,P)=>{P<p||P>m||b.forEach((T,I)=>{I<g||I>y||a.push(T)})})}),a}},cDe=(o=>(o[o.ID=0]="ID",o[o.POSITION_X=1]="POSITION_X",o[o.POSITION_Y=2]="POSITION_Y",o[o.IS_TRIANGLE=3]="IS_TRIANGLE",o[o.SIZE=4]="SIZE",o[o.ORDER=5]="ORDER",o[o.COLOR_INDEX=6]="COLOR_INDEX",o[o.GROUP_ID=7]="GROUP_ID",o[o.TEMPLATE_ID=8]="TEMPLATE_ID",o))(cDe||{}),Zet=8,FE=[],Jet=class extends Up{create(o,t,e,r,i,n,s=-1){return FE[0]=o+(5<<Js)+cs,FE[1]=t.x,FE[2]=t.y,FE[3]=r?1.5:1,FE[4]=e,FE[5]=n||0,FE[6]=i||0,FE[7]=s,FE}getBBox(o,t){let e=o[t+1],r=o[t+2];return Xa.modify(e,e,r,r)}},Bye=new Jet(5,Zet,cDe),Fye=(o=>(o[o.ID=0]="ID",o[o.START_X=1]="START_X",o[o.START_Y=2]="START_Y",o[o.END_X=3]="END_X",o[o.END_Y=4]="END_Y",o[o.LEN_ADD_GAP=5]="LEN_ADD_GAP",o[o.LEN=6]="LEN",o[o.ORDER=7]="ORDER",o[o.COLOR_INDEX=8]="COLOR_INDEX",o[o.GROUP_ID=9]="GROUP_ID",o[o.TEMPLATE_ID=10]="TEMPLATE_ID",o))(Fye||{}),hDe=10,K2=[],uDe=class extends Up{create(o,t,e,r,i,n,s,a,l=-1){return K2[0]=o+(3<<Js)+cs,K2[1]=t.x,K2[2]=t.y,K2[3]=e.x,K2[4]=e.y,K2[5]=r?1:i+n,K2[6]=r?1:i,K2[7]=s||0,K2[8]=a||0,K2[9]=l,K2}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3],n=o[t+4],s=Math.max(e,i),a=Math.min(e,i),l=Math.max(r,n),c=Math.min(r,n);return Xa.modify(a,s,c,l)}},Qet=class extends uDe{create(o,t,e,r,i,n,s,a,l=-1,c=-1){return super.create(o,t,e,r,i,n,s,a,l),K2[0]=o+(54<<Js)+cs,K2[10]=c,K2}},Vye=new uDe(3,hDe,Fye),ett=new Qet(54,hDe+1,Fye),GZ=1e-9,OZ=(o=>(o[o.ID=0]="ID",o[o.CENTER_X=1]="CENTER_X",o[o.CENTER_Y=2]="CENTER_Y",o[o.RADIUS=3]="RADIUS",o[o.WIDTH=4]="WIDTH",o[o.START_ANGLE=5]="START_ANGLE",o[o.SWEEP_ANGLE=6]="SWEEP_ANGLE",o[o.ORDER=7]="ORDER",o[o.COLOR_INDEX=8]="COLOR_INDEX",o[o.GROUP_ID=9]="GROUP_ID",o[o.DASH_ARR_INDEX=10]="DASH_ARR_INDEX",o[o.LINE_CAP=11]="LINE_CAP",o))(OZ||{}),Rve=10,ttt=12,jm=[],Gye=class extends Up{create(o,t,e,r,i,n,s,a,l=-1){return jm[0]=o+(1<<Js)+cs,jm[1]=t.x,jm[2]=t.y,jm[3]=e,jm[4]=r,jm[5]=i,jm[6]=n,jm[7]=s||0,jm[8]=a||0,jm[9]=l,jm}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3],n=o[t+4],s=o[t+5],a=s+o[t+6],{x:l,y:c}=El(1,0,s),{x:h,y:u}=El(1,0,a),d=Math.min(l,h),p=Math.max(l,h),m=Math.min(c,u),g=Math.max(c,u),y=n/2;for(let b=Math.ceil(s/(Math.PI/2))*(Math.PI/2);b<a;b+=Math.PI/2){let{x:P,y:T}=El(1,0,b);d=Math.min(P,d),p=Math.max(P,p),m=Math.min(T,m),g=Math.max(T,g)}return Xa.modify(d*i+e-y,p*i+e+y,m*i+r-y,g*i+r+y)}},rtt=class extends Gye{create(o,t,e,r,i,n,s,a,l=-1,c=-1,h="round"){return super.create(o,t,e,r,i,n,s,a,l),jm[10]=c,jm[11]=$7[h],jm}},itt=class extends Gye{create(o,t,e,r,i,n,s,a,l=-1){return super.create(o,t,e,r,i,n,s,a,l),jm}},ntt=class extends Gye{create(o,t,e,r,i,n,s,a,l=-1,c=-1){return super.create(o,t,e,r,i,n,s,a,l),jm[0]=o+(52<<Js)+cs,jm[10]=c,jm}},dDe,Uye,pDe;_w(()=>dDe=new rtt(1,ttt,OZ),()=>{Uye=new itt(1,Rve,OZ),pDe=new ntt(52,Rve+1,OZ)});var Hye=(o=>(o[o.ID=0]="ID",o[o.CENTER_X=1]="CENTER_X",o[o.CENTER_Y=2]="CENTER_Y",o[o.RADIUS=3]="RADIUS",o[o.COLOR_INDEX1=4]="COLOR_INDEX1",o[o.COLOR_INDEX2=5]="COLOR_INDEX2",o[o.ORDER=6]="ORDER",o[o.GROUP_ID=7]="GROUP_ID",o[o.TEMPLATE_ID=8]="TEMPLATE_ID",o))(Hye||{}),fDe=8,BT=[],mDe=class extends Up{create(o,t,e,r,i,n,s=-1){return BT[0]=o+(4<<Js)+cs,BT[1]=t.x,BT[2]=t.y,BT[3]=e,BT[4]=r,BT[5]=i,BT[6]=n||0,BT[7]=s,BT}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3];return Xa.modify(e-i,e+i,r-i,r+i)}},ott=class extends mDe{create(o,t,e,r,i,n,s,a){return super.create(o,t,e,r,i,n,s),BT[0]=o+(55<<Js)+cs,BT[8]=a,BT}},Wye=new mDe(4,fDe,Hye),stt=new ott(55,fDe+1,Hye),Dve=10,att=11,AZ=(o=>(o[o.ID=0]="ID",o[o.LEFT_POINT_X=1]="LEFT_POINT_X",o[o.LEFT_POINT_Y=2]="LEFT_POINT_Y",o[o.WIDTH=3]="WIDTH",o[o.HEIGHT=4]="HEIGHT",o[o.ANGLE=5]="ANGLE",o[o.RADIUS=6]="RADIUS",o[o.ORDER=7]="ORDER",o[o.COLOR_INDEX=8]="COLOR_INDEX",o[o.GROUP_ID=9]="GROUP_ID",o[o.TEMPLATE_ID=10]="TEMPLATE_ID",o))(AZ||{}),j1=[],zye=class extends Up{create(o,t,e,r,i,n,s,a,l=-1){return j1[0]=o+(2<<Js)+cs,j1[1]=t.x,j1[2]=t.y,j1[3]=e,j1[4]=r,j1[5]=i,j1[6]=n,j1[7]=s||0,j1[8]=a||0,j1[9]=l,j1}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3],n=o[t+4],s=o[t+5];if(s===0)return Xa.modify(e,e+i,r-n,r);let a=o[t+6],l=El(a,-a,s),c=El(a,a-n,s),h=El(i-a,-a,s),u=El(i-a,a-n,s),d={x:e+l.x,y:r+l.y},p={x:e+c.x,y:r+c.y},m={x:e+h.x,y:r+h.y},g={x:e+u.x,y:r+u.y};return Xa.modify(Math.min(d.x,p.x,m.x,g.x)-a,Math.max(d.x,p.x,m.x,g.x)+a,Math.min(d.y,p.y,m.y,g.y)-a,Math.max(d.y,p.y,m.y,g.y)+a)}},ltt=class extends zye{create(o,t,e,r,i,n,s,a,l=-1,c=1){return super.create(o,t,e,r,i,n,s,a,l),j1[10]=c,j1}},ctt=class extends zye{create(o,t,e,r,i,n,s,a,l=-1){return super.create(o,t,e,r,i,n,s,a,l)}},htt=class extends zye{create(o,t,e,r,i,n,s,a,l=-1,c=-1){return super.create(o,t,e,r,i,n,s,a,l),j1[0]=o+(53<<Js)+cs,j1[10]=c,j1}},gDe,Yye,yDe;_w(()=>gDe=new ltt(2,att,AZ),()=>{Yye=new ctt(2,Dve,AZ),yDe=new htt(53,Dve+1,AZ)});var jye=(o=>(o[o.ID=0]="ID",o[o.POINT1_X=1]="POINT1_X",o[o.POINT1_Y=2]="POINT1_Y",o[o.POINT2_X=3]="POINT2_X",o[o.POINT2_Y=4]="POINT2_Y",o[o.POINT3_X=5]="POINT3_X",o[o.POINT3_Y=6]="POINT3_Y",o[o.GROUP_ID=7]="GROUP_ID",o[o.FillStyle=8]="FillStyle",o))(jye||{}),bDe=9,NT=[],PDe=class extends LH{create(o,t,e,r,i,n=1){return NT[0]=o+(8<<Js)+cs,NT[1]=t.x,NT[2]=t.y,NT[3]=e.x,NT[4]=e.y,NT[5]=r.x,NT[6]=r.y,NT[7]=i,NT[8]=n,NT}getBBox(o,t,e){let r=o[t+1],i=o[t+2],n=o[t+3],s=o[t+4],a=o[t+5],l=o[t+6],c=o[t+7]*sd,h=e.get(c),u=e.get(c+1),d=e.get(c+2),p=e.get(c+3),m=e.get(c+4),g=e.get(c+5),y=r*h+i*d+m,b=r*u+i*p+g,P=n*h+s*d+m,T=n*u+s*p+g,I=a*h+l*d+m,C=a*u+l*p+g;return Xa.modify(Math.min(y,P,I),Math.max(y,P,I),Math.min(b,T,C),Math.max(b,T,C))}},utt=class extends PDe{create(o,t,e,r,i,n){return super.create(o,t,e,r,i,n),NT[0]=o+(58<<Js)+cs,NT}},MH=new PDe(8,bDe,jye),dtt=new utt(58,bDe,jye),V_=class{static regular(o){return Math.round(o*this.precision)/this.precision}static eq(o,t){return Math.abs(o-t)<=this.eps}static neq(o,t){return Math.abs(o-t)>this.eps}static less(o,t){return o-t<-this.eps}static lesseq(o,t){return o-t<this.eps}static greater(o,t){return o-t>this.eps}static greatereq(o,t){return o-t>-this.eps}static sqrt(o){return Math.abs(o)<=1e-10?0:Math.sqrt(o)}static sortAsc(o,t){return o-t}static sortDesc(o,t){return t-o}};V_.eps=1e-8,V_.precision=1e8;var Tw=class TDe{constructor(t,e,r,i,n,s,a=0,l=ee.WHITE,c=0,h){this.isMirroredX=1,this.valid=!1,this.scene=h,this.create(t,e,r,i,n,s,a,l,c)}static build(t,e){return new TDe(t,e.UL(),e.LL(),e.UR(),e.LR(),1,0,ee.WHITE,0)}create(t,e,r,i,n,s,a=0,l=ee.WHITE,c=0){t===null?this.image=null:t&&(this.image=t,t instanceof Promise&&t.then(p=>{this.image=p,this.scene&&(this.scene.needRender=!0)}));let h=[e,i,n,r].map((p,m,g)=>p.angle(g[m===0?g.length-1:m-1])),u,d=h[h.length-1];h.forEach((p,m)=>{let g=(p+Zs-d)%Zs;if(V_.eq(g,GT)){if(m===0)u=!0;else if(u!==!0)throw new Error("not support")}else if(V_.eq(g,GT*3)){if(m===0)u=!1;else if(u!==!1)throw new Error("not support")}else throw new Error("not support");d=p}),this.width=e.distance1(i),this.height=e.distance1(r),u?(this.isMirroredX=-1,this.angle=-(h[1]-Math.PI)):(this.isMirroredX=1,this.angle=-h[1]),this.valid=!0,this.luPoint=e,this.ldPoint=r,this.ruPoint=i,this.rdPoint=n,this.order=a,this.alpha=s,this.shadowColor=l,this.shadowBlur=c}getBBox(){let t=Math.min(this.luPoint.x,this.ldPoint.x,this.ruPoint.x,this.rdPoint.x),e=Math.max(this.luPoint.x,this.ldPoint.x,this.ruPoint.x,this.rdPoint.x),r=Math.min(this.luPoint.y,this.ldPoint.y,this.ruPoint.y,this.rdPoint.y),i=Math.max(this.luPoint.y,this.ldPoint.y,this.ruPoint.y,this.rdPoint.y);return Xa.modify(t,e,r,i)}sycnStatus(t,e,r,i,n,s=1,a=0,l,c){return this.create(t,e,r,i,n,s,a,l,c),this}getOrder(){return this.order}render(t,e,r){if(!this.valid||!this.image||this.image instanceof Promise)return;let i=t.getRenderMatrix(),n=t.getScale()*t.getSampling(),s=this.luPoint.multiply4(r.multiply4(i)),a=i.data[10]<0?-1:1;a*=this.isMirroredX;let l=Math.round(s.x+this.width*n)-Math.round(s.x),c=Math.round(s.y+this.height*n)-Math.round(s.y);e.save(),e.setTranslate(Math.round(s.x),Math.round(s.y)),e.setRotate(this.angle),e.setScale(a,1),e.setGlobalAlpha(this.alpha),this.shadowBlur>0&&(e.setShadowBlur(this.shadowBlur),e.setShadowColor(this.shadowColor.toCSS())),e.getContext().drawImage(this.image,0,0,l,c),e.restore()}},_Z=class pP{static toDegrees(t){return t*180/Math.PI}static toRadians(t){return t/180*Math.PI}static regularD(t){return t=t%360,t=t<0?360+t:t,t===360?0:t}static regular(t){return t=t%pP.PIx2,t=t<0?pP.PIx2+t:t,t===pP.PIx2?0:t}static toQuarterBase(t){return pP.regular((t+pP.PI_4)/pP.PI_2*pP.PI_2)}static toQuarterBaseD(t){return pP.regularD(((t+45)/90|0)*90)}static transformD(t,e){return pP.toDegrees(pP.transform(pP.toRadians(t),e))}static transform(t,e){let r=Math.cos(t),i=Math.sin(t),n=new S(e.data[6],e.data[7]),s=new S(r,i).multiply3(e);return pP.regular(s.angle(n))}};_Z.PIx2=Math.PI*2,_Z.PI_2=Math.PI/2,_Z.PI_4=Math.PI/4;var Ih=_Z,Xye=(o=>(o[o.ID=0]="ID",o[o.CENTER_X=1]="CENTER_X",o[o.CENTER_Y=2]="CENTER_Y",o[o.RADIUS=3]="RADIUS",o[o.START_ANGLE=4]="START_ANGLE",o[o.SWEEP_ANGLE=5]="SWEEP_ANGLE",o[o.START_X=6]="START_X",o[o.START_Y=7]="START_Y",o[o.END_X=8]="END_X",o[o.END_Y=9]="END_Y",o[o.GROUP_ID=10]="GROUP_ID",o[o.FillStyle=11]="FillStyle",o))(Xye||{}),IDe=12,n2=[],CDe=class extends LH{create(o,t,e,r,i,n,s,a,l=1){return n2[0]=o+(9<<Js)+cs,n2[1]=t.x,n2[2]=t.y,n2[3]=e,n2[4]=r,n2[5]=i,n2[6]=n.x,n2[7]=n.y,n2[8]=s.x,n2[9]=s.y,n2[10]=a,n2[11]=l,n2}getBBox(o,t,e){let r=o[t+1],i=o[t+2],n=o[t+3],s=o[t+4],a=s+o[t+5],l=o[t+10]*sd,c=new _e;function h(d){let{x:p,y:m}=El(n,0,d);p+=r,m+=i,c.ext6(p*e.get(l)+m*e.get(l+2)+e.get(l+4),p*e.get(l+1)+m*e.get(l+3)+e.get(l+5))}if(h(s),h(a),s<a)for(let d=Math.ceil(s/(Math.PI/2))*(Math.PI/2);d<a;d+=Math.PI/2)h(d);else for(let d=Math.floor(s/(Math.PI/2))*(Math.PI/2);d>a;d-=Math.PI/2)h(d);let u=c.build1();return Xa.modify(u.minX,u.maxX,u.minY,u.maxY)}},ptt=class extends CDe{create(o,t,e,r,i,n,s,a,l){return super.create(o,t,e,r,i,n,s,a,l),n2[0]=o+(59<<Js)+cs,n2}},NH=new CDe(9,IDe,Xye),ftt=new ptt(59,IDe,Xye),qye=(o=>(o[o.ID=0]="ID",o[o.CENTER_X=1]="CENTER_X",o[o.CENTER_Y=2]="CENTER_Y",o[o.RADIUS=3]="RADIUS",o[o.START_ANGLE=4]="START_ANGLE",o[o.SWEEP_ANGLE=5]="SWEEP_ANGLE",o[o.ORDER=6]="ORDER",o[o.COLOR_INDEX=7]="COLOR_INDEX",o[o.GROUP_ID=8]="GROUP_ID",o[o.TEMPLATE_ID=9]="TEMPLATE_ID",o))(qye||{}),SDe=9,mP=[],EDe=class extends Up{create(o,t,e,r,i,n,s,a=-1){return mP[0]=o+(12<<Js)+cs,mP[1]=t.x,mP[2]=t.y,mP[3]=e,mP[4]=r,mP[5]=i,mP[6]=n||0,mP[7]=s||0,mP[8]=a,mP}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3],n=o[t+4],s=n+o[t+5],{x:a,y:l}=El(1,0,n),{x:c,y:h}=El(1,0,s),u=Math.min(a,c),d=Math.max(a,c),p=Math.min(l,h),m=Math.max(l,h);for(let g=Math.ceil(n/(Math.PI/2))*(Math.PI/2);g<s;g+=Math.PI/2){let{x:y,y:b}=El(1,0,g);u=Math.min(y,u),d=Math.max(y,d),p=Math.min(b,p),m=Math.max(b,m)}return Xa.modify(u*i+e,d*i+e,p*i+r,m*i+r)}},mtt=class extends EDe{create(o,t,e,r,i,n,s,a=-1,l=-1){return super.create(o,t,e,r,i,n,s,a),mP[0]=o+(62<<Js)+cs,mP[9]=l,mP}},$ye=new EDe(12,SDe,qye),gtt=new mtt(62,SDe+1,qye),Kye=(o=>(o[o.ID=0]="ID",o[o.START_X=1]="START_X",o[o.START_Y=2]="START_Y",o[o.END_X=3]="END_X",o[o.END_Y=4]="END_Y",o[o.ORDER=5]="ORDER",o[o.COLOR_INDEX=6]="COLOR_INDEX",o[o.GROUP_ID=7]="GROUP_ID",o[o.TEMPLATE_ID=8]="TEMPLATE_ID",o))(Kye||{}),ODe=8,FT=[],ADe=class extends Up{create(o,t,e,r,i,n=-1){return FT[0]=o+(11<<Js)+cs,FT[1]=t.x,FT[2]=t.y,FT[3]=e.x,FT[4]=e.y,FT[5]=r||0,FT[6]=i||0,FT[7]=n,FT}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3],n=o[t+4],s=Math.max(e,i),a=Math.min(e,i),l=Math.max(r,n),c=Math.min(r,n);return Xa.modify(a,s,c,l)}},ytt=class extends ADe{create(o,t,e,r,i,n,s){return super.create(o,t,e,r,i,n),FT[0]=o+(61<<Js)+cs,FT[8]=s,FT}},IH=new ADe(11,ODe,Kye),wve=new ytt(61,ODe+1,Kye),Zye=(o=>(o[o.ID=0]="ID",o[o.CENTER_X=1]="CENTER_X",o[o.CENTER_Y=2]="CENTER_Y",o[o.RADIUS=3]="RADIUS",o[o.START_ANGLE=4]="START_ANGLE",o[o.SWEEP_ANGLE=5]="SWEEP_ANGLE",o[o.GROUP_ID=6]="GROUP_ID",o))(Zye||{}),y9=[],_De=7,vDe=class extends LH{create(o,t,e,r,i,n){return y9[0]=o+(14<<Js)+cs,y9[1]=t.x,y9[2]=t.y,y9[3]=e,y9[4]=r,y9[5]=i,y9[6]=n,y9}getBBox(o,t,e){let r=o[t+1],i=o[t+2],n=o[t+3],s=o[t+4],a=s+o[t+5],l=o[t+6]*sd,c=new _e;function h(d){let{x:p,y:m}=El(n,0,d);p+=r,m+=i,c.ext6(p*e.get(l)+m*e.get(l+2)+e.get(l+4),p*e.get(l+1)+m*e.get(l+3)+e.get(l+5))}if(h(s),h(a),s<a)for(let d=Math.ceil(s/(Math.PI/2))*(Math.PI/2);d<a;d+=Math.PI/2)h(d);else for(let d=Math.floor(s/(Math.PI/2))*(Math.PI/2);d>a;d-=Math.PI/2)h(d);let u=c.build1();return Xa.modify(u.minX,u.maxX,u.minY,u.maxY)}},btt=class extends vDe{create(o,t,e,r,i,n){return super.create(o,t,e,r,i,n),y9[0]=o+(64<<Js)+cs,y9}},Jye=new vDe(14,_De,Zye),Ptt=new btt(64,_De,Zye),Qye=(o=>(o[o.ID=0]="ID",o[o.START_X=1]="START_X",o[o.START_Y=2]="START_Y",o[o.END_X=3]="END_X",o[o.END_Y=4]="END_Y",o[o.GROUP_ID=5]="GROUP_ID",o))(Qye||{}),xDe=6,jE=[],RDe=class extends LH{create(o,t,e,r){return jE[0]=o+(13<<Js)+cs,jE[1]=t.x,jE[2]=t.y,jE[3]=e.x,jE[4]=e.y,jE[5]=r,jE}getBBox(o,t,e){let r=o[t+1],i=o[t+2],n=o[t+3],s=o[t+4],a=o[t+5]*sd,l=e.get(a),c=e.get(a+1),h=e.get(a+2),u=e.get(a+3),d=e.get(a+4),p=e.get(a+5),m=r*l+i*h+d,g=r*c+i*u+p,y=n*l+s*h+d,b=n*c+s*u+p;return Xa.modify(Math.min(m,y),Math.max(m,y),Math.min(g,b),Math.max(g,b))}},Ttt=class extends RDe{create(o,t,e,r){return super.create(o,t,e,r),jE[0]=o+(63<<Js)+cs,jE}},CH=new RDe(13,xDe,Qye),Lve=new Ttt(63,xDe,Qye),DDe=(o=>(o[o.ID=0]="ID",o[o.CenterX=1]="CenterX",o[o.CenterY=2]="CenterY",o[o.A=3]="A",o[o.B=4]="B",o[o.StartAngle=5]="StartAngle",o[o.EndAngle=6]="EndAngle",o[o.Rotation=7]="Rotation",o[o.Stroke=8]="Stroke",o[o.StrokeColorIndex=9]="StrokeColorIndex",o[o.DashArrayIndex=10]="DashArrayIndex",o[o.LineCapIndex=11]="LineCapIndex",o[o.FillColorIndex=12]="FillColorIndex",o[o.FillStyleIndex=13]="FillStyleIndex",o[o.ORDER=14]="ORDER",o[o.GROUP_ID=15]="GROUP_ID",o))(DDe||{}),Vg=[],Itt=class extends Up{create(o,t,e,r,i,n,s,a,l=0,c=-1,h=1,u=0,d=1,p=0,m=-1){return Vg[0]=o+(16<<Js)+cs,Vg[1]=t.x,Vg[2]=t.y,Vg[3]=e,Vg[4]=r,Vg[5]=i,Vg[6]=n,Vg[7]=s,Vg[8]=a,Vg[9]=l,Vg[10]=c,Vg[11]=h,Vg[12]=u,Vg[13]=d,Vg[14]=p,Vg[15]=m,Vg}getBBox(o,t){let e=new S(o[t+1],o[t+2]),r=o[t+3],i=o[t+4],n=o[t+5],s=o[t+6],a=o[t+7],l=o[t+8]/2,c=r+l,h=i+l,u=new S(c,0),d=new S(-c,0),p=new S(0,h),m=new S(0,-h),g=_(r,i,-n),y=_(r,i,-s),b=fve(Ih.regular(n),3),P=fve(b,3);b==P&&b==0&&(s<n?b=Ih.PIx2:P=Ih.PIx2);let T=Math.PI,I=T/2,C=T*3/2,E=new _e;b==0?P==0?E.ext5(-l,l,-l,l):P<I?(E.ext2(u),E.ext2(y)):P<T?(E.ext2(u),E.ext2(m),E.ext2(y)):P<C?(E.ext2(u),E.ext2(m),E.ext2(d),E.ext2(y)):(E.ext2(u),E.ext2(m),E.ext2(d),E.ext2(p),E.ext2(y)):P==0?(E.ext2(g),E.ext2(m),E.ext2(d),E.ext2(p),E.ext2(u)):P<I?(E.ext2(g),E.ext2(y)):P<T?(E.ext2(g),E.ext2(m),E.ext2(y)):P<C?(E.ext2(g),E.ext2(m),E.ext2(d),E.ext2(y)):(E.ext2(g),E.ext2(m),E.ext2(d),E.ext2(p),E.ext2(y));let O=E.build().transform(Qe.rotate(-a).translate1(e));return Xa.modify(O.minX,O.maxX,O.minY,O.maxY);function _(x,v,D){let w=x*Math.cos(D),F=v*Math.sin(D);return new S(w,F)}}},rJ=new Itt(16,16,DDe),H1=[],wDe=(o=>(o[o.ID=0]="ID",o[o.EndPointX1=1]="EndPointX1",o[o.EndPointY1=2]="EndPointY1",o[o.EndPointX2=3]="EndPointX2",o[o.EndPointY2=4]="EndPointY2",o[o.ControlX1=5]="ControlX1",o[o.ControlY1=6]="ControlY1",o[o.ControlX2=7]="ControlX2",o[o.ControlY2=8]="ControlY2",o[o.Stroke=9]="Stroke",o[o.StrokeColorIndex=10]="StrokeColorIndex",o[o.DashArrayIndex=11]="DashArrayIndex",o[o.LineCapIndex=12]="LineCapIndex",o[o.ORDER=13]="ORDER",o[o.GROUP_ID=14]="GROUP_ID",o))(wDe||{}),Ctt=class extends Up{create(o,t,e,r,i,n,s=0,a=-1,l=1,c=0,h=-1){return H1[0]=o+(17<<Js)+cs,H1[1]=t.x,H1[2]=t.y,H1[3]=e.x,H1[4]=e.y,H1[5]=r.x,H1[6]=r.y,H1[7]=i.x,H1[8]=i.y,H1[9]=n,H1[10]=s,H1[11]=a,H1[12]=l,H1[13]=c,H1[14]=h,H1}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3],n=o[t+4],s=o[t+5],a=o[t+6],l=o[t+7],c=o[t+8],h=o[t+9]/2,u=new Dr([new S(e,r),new S(s,a),new S(l,c),new S(i,n)]).bbox().extendOfSize(h);return Xa.modify1(u)}},e2e=new Ctt(17,15,wDe);function YE(o){return o>>W7}function vw(o){return o&W7}function ad(o,t){var e;let r=!0,i=YE(o);return i!=0&&!((e=t[i])!=null&&e.alpha)&&(r=!1),r}function Q7(o,t,e){return!kH(o,t,e)}function kH(o,t,e){let r=ih.getRenderMode(t,e),i;return r===0?i=o:r===1?i=!1:r===2&&(i=!0),i}function qm(o){let{plane:t,highLightColorIndex:e}=o,r=!0,i=vw(e);return!t.isVisible()&&i&&(!t.scene.getForceVisibleHighLightPt()||t.ignoreForceHighLightEffect)&&(r=!1),r}function Xge(o,t,e,r,i){r.push(o.x,o.y,t.x,t.y,e.x,e.y),i&&r.push(i.x,i.y)}function LDe(o,t,e,r,i,n,s,a,l,c,h,u,d=0){var p,m,g,y,b,P;let{trianglesArr:T,doubleRgbTrianglesArr:I,groupHighLightTrianglesArr:C,groupForceHighLightTrianglesArr:E}=c,O=[],_=[],x=[],v=ih.isDoubleRgb(i,l),D=ih.isForceHighLight(i,l);v?(O=(m=(p=I[a])==null?void 0:p[r])==null?void 0:m[s],O||(I[a]||(I[a]=[]),I[a][r]||(I[a][r]=[]),I[a][r][s]||(I[a][r][s]=O=[]))):D||(O=(y=(g=T[a])==null?void 0:g[r])==null?void 0:y[s],O||(T[a]||(T[a]=[]),T[a][r]||(T[a][r]=[]),T[a][r][s]||(T[a][r][s]=O=[]))),Gg(h,D,d)&&Xge(o,t,e,O,n);let w=u(i);w&&((d===0||!D)&&(_=C[w.highLightGroupId],_||(C[w.highLightGroupId]=_=[]),Xge(o,t,e,_)),D&&(x=(P=(b=E[a])==null?void 0:b[r])==null?void 0:P[s],x||(E[a]||(E[a]=[]),E[a][r]||(E[a][r]=[]),E[a][r][s]||(E[a][r][s]=x=[])),Xge(o,t,e,x,n)))}function qge(o,t,e,r,i,n){i.push(o.x,o.y,t,e,r),n&&i.push(n.x,n.y)}function MDe(o,t,e,r,i,n,s,a,l,c,h,u,d,p=0){var m,g,y,b,P,T;let{circlesArr:I,doubleRgbCirclesArr:C,groupHighLightCirclesArr:E,groupForceHighLightCirclesArr:O}=h,_=[],x=[],v=[],D=ih.isDoubleRgb(n,c),w=ih.isForceHighLight(n,c);D?(_=(g=(m=C[l])==null?void 0:m[i])==null?void 0:g[s],_||(C[l]||(C[l]=[]),C[l][i]||(C[l][i]=[]),C[l][i][s]||(C[l][i][s]=_=[]))):w||(_=(b=(y=I[l])==null?void 0:y[i])==null?void 0:b[s],_||(I[l]||(I[l]=[]),I[l][i]||(I[l][i]=[]),I[l][i][s]||(I[l][i][s]=_=[])));let F=d(n);Gg(u,w,p)&&qge(o,t,e,r,_,a),F&&((p===0||!w)&&(x=E[F.highLightGroupId],x||(E[F.highLightGroupId]=x=[]),qge(o,t,e,r,x)),w&&(v=(T=(P=O[l])==null?void 0:P[i])==null?void 0:T[s],v||(O[l]||(O[l]=[]),O[l][i]||(O[l][i]=[]),O[l][i][s]||(O[l][i][s]=v=[])),qge(o,t,e,r,v,a)))}var Stt=8,Ett=6,Ott=7,Att=5;function t2e(o,t,e,r){return[o+e*Math.cos(r),t-e*Math.sin(r)]}function $ge(o,t,e,r,i,n,s=!1,a,l=!1,c,h,u){var d,p;let m=t.getContext();for(let g=0;g<e;g++){let y=r[g],b=i[g],P=Math.max((y==null?void 0:y.length)||0,(b==null?void 0:b.length)||0);for(let T=1;T<P;T+=1){t.save();let I=1e9,C=1e9;m.beginPath();for(let E=0;E<((d=y==null?void 0:y[T])==null?void 0:d.length);E+=Stt){let O=y[T];m.moveTo(O[E],O[E+1]),m.lineTo(O[E+2],O[E+3]),m.lineTo(O[E+4],O[E+5]),I=Math.min(O[E+6],I),C=Math.min(O[E+7],C)}for(let E=0;E<((p=b==null?void 0:b[T])==null?void 0:p.length);E+=Ott){let O=b[T],_=O[E],x=O[E+1],v=O[E+2],D=O[E+3],w=O[E+4],F=O[E+5],H=O[E+6],[z,V]=t2e(_,x,v,D);m.moveTo(z,V),m.arc(_,x,v,-D,-(D+w),w>0),I=Math.min(F,I),C=Math.min(H,C)}m.closePath(),t.setTranslate(I,C),o.setFillStyle(t,T,g,s,a,l,c,!0,h,u),m.fill(),t.restore()}}}function _tt(o,t,e,r,i){let n=Math.max(r.length,i.length);for(let s=0;s<n;s++){let a;if(s==0)a=o;else if(s==1)a=t;else throw new Error("highLightGroupId is incorrect");let l=a.getContext();l.beginPath();let c=r[s];if(c)for(let u=0;u<c.length;u+=Ett)l.moveTo(c[u],c[u+1]),l.lineTo(c[u+2],c[u+3]),l.lineTo(c[u+4],c[u+5]);let h=i[s];if(h)for(let u=0;u<h.length;u+=Att){let d=h[u],p=h[u+1],m=h[u+2],g=h[u+3],y=h[u+4],[b,P]=t2e(d,p,m,g);l.moveTo(b,P),l.arc(d,p,m,-g,-(g+y),y>0)}l.closePath(),l.fill()}}var vtt=3,xtt=5;function Rtt(o,t,e,r,i){var n,s,a,l;let c=o.getContext(),h=Math.max((e==null?void 0:e.length)||0,(r==null?void 0:r.length)||0);for(let u=0;u<h;u+=1){let d=u!==0,p=Math.max(((n=e[u])==null?void 0:n.length)||0,((s=r[u])==null?void 0:s.length)||0);for(let m=0;m<p;m++){o.save(),c.beginPath();let g=(a=e[u])==null?void 0:a[m],y=!1;if(g){y=!0;for(let P=0;P<g.length;P+=vtt){let T=g[P],I=g[P+1],C=g[P+2];c.moveTo(T.x,T.y),c.lineTo(I.x,I.y),c.lineTo(C.x,C.y)}}let b=(l=r[u])==null?void 0:l[m];if(b){y=!0;for(let P=0;P<b.length;P+=xtt){let T=b[P],I=b[P+1],C=b[P+2],E=b[P+3],O=b[P+4],[_,x]=t2e(T,I,C,E);c.moveTo(_,x),c.arc(T,I,C,-E,-(E+O),O>0)}}if(y){let P=d?void 0:m,T=d?m:void 0;i.highLightPtSetCustomizedColor(o,P,T,void 0,!0)}c.closePath(),c.fill(),o.restore()}}}function iJ(o,t){return new Ae([o.get(t),o.get(t+1),0,0,o.get(t+2),o.get(t+3),0,0,0,0,1,0,o.get(t+4),o.get(t+5),0,1])}function Gg(o,t,e){return!o&&(!t||t&&e===0)}function Dtt(o,t,e,r){var i,n;let{plane:s,onlyRenderHighLightPt:a,globalHighLightType:l}=r,c=e.get(t+9),h=e.get(t+12),u=s.scene.colors;if(!ad(c,u)&&!ad(h,u))return;let d=NDe(e,t,r);Gg(a,(i=d.highLightInfo)==null?void 0:i.isForceHighLight,l)&&G1e(o,d),(n=d.highLightInfo)!=null&&n.ctx&&G1e(d.highLightInfo.ctx,d,"groupId")}function NDe(o,t,e,r="none"){let{plane:i,scale:n,getHighLightDrawInfo:s,renderMatrix3:a,sampling:l}=e,c=o.get(t+3),h=o.get(t+4),u=o.get(t+5),d=o.get(t+6),p=o.get(t+7),m=o.get(t+8),g=o.get(t+9),y=o.get(t+10),b=o.get(t+11),P=o.get(t+12),T=o.get(t+13),I=o.get(t+15),C=i.getDashedArray(y,n,m),E=sJ[b],O=r==="select"?null:s(I),_=new S(o.get(t+1),o.get(t+2)).multiply3(a),x=c*n,v=h*n,D=i.getRenderLineWidth(l,m,n),w=!1,F=ih.isDoubleRgb(I,i.scene.ptGroup.getData()),H=i.getPtBBox(o.slice(t,t+rJ.length)).UL().multiply3(a);return{...e,center:_,a:x,b:v,startAngle:u,endAngle:d,rotation:p,stroke:D,strokeColorIndex:g,lineCap:E,fillColorIndex:P,fillStyleIndex:T,dashedArray:C,groupId:I,highLightInfo:O,anticlockwise:w,isDoubleRgb:F,leftUpPoint:H}}function G1e(o,t,e="none"){let{center:r,a:i,b:n,startAngle:s,endAngle:a,rotation:l,stroke:c,dashedArray:h,lineCap:u,strokeColorIndex:d,fillColorIndex:p,groupId:m,fillStyleIndex:g,highLightInfo:y,plane:b,anticlockwise:P,isDoubleRgb:T,samplingPxLength:I,leftUpPoint:C,camera:E,material:O,renderMode:_}=t;switch(o.save(),e){case"none":{b.ptSetCustomizedColor(o,E,d,O,_,m);break}case"groupId":{b.setGroupHighLightColor(o,E,d,y.isForceHighLight);break}}let x=o.getContext();o.setLineWidth(c),o.setLineDash(h),o.setLineCap(u),x.beginPath(),x.ellipse(r.x,r.y,i,n,-l,s,a,P),o.setTranslate(C.x,C.y),e==="none"&&(b.setFillStyle(o,g,p,T,I,void 0,E,!1,O,_),x.fill()),x.stroke(),o.restore()}function wtt(o,t,e,r){if(!qm(r))return;let i=NDe(e,t,r,"select");G1e(o,i,"select")}var kDe=(o=>(o[o.ID=0]="ID",o[o.START_X=1]="START_X",o[o.START_Y=2]="START_Y",o[o.END_X=3]="END_X",o[o.END_Y=4]="END_Y",o[o.WIDTH=5]="WIDTH",o[o.ORDER=6]="ORDER",o[o.COLOR_INDEX=7]="COLOR_INDEX",o[o.GROUP_ID=8]="GROUP_ID",o[o.LINE_CAP=9]="LINE_CAP",o[o.DASH_ARR_INDEX=10]="DASH_ARR_INDEX",o[o.SHADOW_COLOR_INDEX=11]="SHADOW_COLOR_INDEX",o[o.SHADOW_BLUR=12]="SHADOW_BLUR",o[o.SHADOW_OFFSET_X=13]="SHADOW_OFFSET_X",o[o.SHADOW_OFFSET_Y=14]="SHADOW_OFFSET_Y",o[o.TEMPLATE_ID=15]="TEMPLATE_ID",o))(kDe||{}),U1e=(o=>(o[o.ID=0]="ID",o[o.START_X=1]="START_X",o[o.START_Y=2]="START_Y",o[o.END_X=3]="END_X",o[o.END_Y=4]="END_Y",o[o.WIDTH=5]="WIDTH",o[o.ORDER=6]="ORDER",o[o.COLOR_INDEX=7]="COLOR_INDEX",o[o.GROUP_ID=8]="GROUP_ID",o[o.LINE_CAP=9]="LINE_CAP",o[o.TEMPLATE_ID=10]="TEMPLATE_ID",o))(U1e||{}),Ltt=15,Mve=10,If=[],r2e=class extends Up{create(o,t,e,r,i="round",n,s,a=-1){return If[0]=o+(15<<Js)+cs,If[1]=t.x,If[2]=t.y,If[3]=e.x,If[4]=e.y,If[5]=r,If[6]=n||0,If[7]=s||0,If[8]=a,If[9]=$7[i],If}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3],n=o[t+4],s=o[t+5],a=Math.max(e,i),l=Math.min(e,i),c=Math.max(r,n),h=Math.min(r,n),u=s/2;return Xa.modify(l-u,a+u,h-u,c+u)}},Mtt=class extends r2e{create(o,t,e,r,i="round",n,s,a=-1,l=-1,c,h,u,d){return super.create(o,t,e,r,i,n,s,a),If[10]=l,If[11]=c||0,If[12]=h||0,If[13]=u||0,If[14]=d||0,If}},Ntt=class extends r2e{create(o,t,e,r,i="round",n,s,a=-1){return super.create(o,t,e,r,i,n,s,a)}},ktt=class extends r2e{create(o,t,e,r,i="round",n,s,a=-1,l=-1){return super.create(o,t,e,r,i,n,s,a),If[0]=o+(65<<Js)+cs,If[10]=l,If}},BDe,i2e,FDe;_w(()=>BDe=new Mtt(15,Ltt,kDe),()=>{i2e=new Ntt(15,Mve,U1e),FDe=new ktt(65,Mve+1,U1e)});function Btt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=VDe(e,t,r);l&&(Gg(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&H1e(o,l),(n=l.highLightInfo)!=null&&n.ctx&&H1e(l.highLightInfo.ctx,l,"groupId"))}function VDe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,scale:a,sampling:l}=e,c=o.get(t+8),h=i.getPtColorIndex(o.get(t+7),c);if(r!=="select"&&!ad(h,i.scene.colors))return;let u=e.highLightColorIndex,d=r==="select"?null:n(c),p=new S(o.get(t+1),o.get(t+2)).multiply4(s),m=new S(o.get(t+3),o.get(t+4)).multiply4(s),g=o.get(t+5),y=i.getRenderLineWidth(l,g,a),b=o.get(t+9),P=o.get(t+10),T=i.getDashedArray(P,a,g),I=o.get(t+12),C=o.get(t+11),E=o.get(t+13),O=o.get(t+14);return{...e,highLightInfo:d,colorIndex:h,groupIdIndex:c,dashedArray:T,lineWidth:y,start:p,end:m,lineCap:b,highLightColorIndex:u,shadowBlur:I,shadowColorIndex:C,shadowOffsetX:E,shadowOffsetY:O}}function H1e(o,t,e="none"){let{highLightInfo:r,bNeedFill:i,colorIndex:n,groupIdIndex:s,dashedArray:a,lineWidth:l,start:c,end:h,lineCap:u,plane:d,highLightColorIndex:p,shadowBlur:m,shadowColorIndex:g,shadowOffsetX:y,shadowOffsetY:b,camera:P,groupIdBuilder:T,material:I,renderMode:C}=t,E=kH(i,s,T);switch(o.save(),e){case"none":{d.ptSetCustomizedColor(o,P,n,I,C,s);break}case"groupId":{d.setGroupHighLightColor(o,P,n,r.isForceHighLight);break}case"select":{d.highLightPtSetCustomizedColor(o,p,n);break}}d.setRenderShadowInfo(o,m,g,y,b);let O=o.getContext();if(o.setLineDash(a),E)O.beginPath(),o.setLineWidth(l),O.moveTo(c.x,c.y),O.lineTo(h.x,h.y),o.setLineCap(sJ[u]),O.stroke();else{o.setLineWidth(1);let _=h.sub(c).normalize();O.moveTo(c.x,c.y),O.beginPath(),O.arc(c.x,c.y,l/2,0,Math.PI*2),O.closePath(),O.stroke(),O.moveTo(h.x,h.y),O.beginPath(),O.arc(h.x,h.y,l/2,0,Math.PI*2),O.closePath(),O.stroke();let x=c.add(_.mul(l/2)).rotateD(c,90),v=h.add(_.mul(l/2)).rotateD(h,90),D=c.add(_.mul(l/2)).rotateD(c,-90),w=h.add(_.mul(l/2)).rotateD(h,-90);O.beginPath(),O.moveTo(x.x,x.y),O.lineTo(v.x,v.y),O.stroke(),O.moveTo(D.x,D.y),O.lineTo(w.x,w.y),O.closePath(),O.stroke()}o.restore()}function Ftt(o,t,e,r){if(!qm(r))return;let i=VDe(e,t,r,"select");H1e(o,i,"select")}var GDe=(o=>(o[o.ID=0]="ID",o[o.POINT1_X=1]="POINT1_X",o[o.POINT1_Y=2]="POINT1_Y",o[o.POINT2_X=3]="POINT2_X",o[o.POINT2_Y=4]="POINT2_Y",o[o.POINT3_X=5]="POINT3_X",o[o.POINT3_Y=6]="POINT3_Y",o[o.ORDER=7]="ORDER",o[o.COLOR_INDEX=8]="COLOR_INDEX",o[o.GROUP_ID=9]="GROUP_ID",o[o.FILL_STYLE=10]="FILL_STYLE",o))(GDe||{}),Nve=10,Vtt=11,X1=[],vZ=(o=>(o[o.ID=0]="ID",o[o.POINT1_X=1]="POINT1_X",o[o.POINT1_Y=2]="POINT1_Y",o[o.POINT2_X=3]="POINT2_X",o[o.POINT2_Y=4]="POINT2_Y",o[o.POINT3_X=5]="POINT3_X",o[o.POINT3_Y=6]="POINT3_Y",o[o.ORDER=7]="ORDER",o[o.COLOR_INDEX=8]="COLOR_INDEX",o[o.GROUP_ID=9]="GROUP_ID",o[o.TEMPLATE_ID=10]="TEMPLATE_ID",o))(vZ||{}),n2e=class extends Up{create(o,t,e,r,i,n,s=-1){return X1[0]=o+(6<<Js)+cs,X1[1]=t.x,X1[2]=t.y,X1[3]=e.x,X1[4]=e.y,X1[5]=r.x,X1[6]=r.y,X1[7]=i||0,X1[8]=n||0,X1[9]=s,X1}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3],n=o[t+4],s=o[t+5],a=o[t+6];return Xa.modify(Math.min(e,i,s),Math.max(e,i,s),Math.min(r,n,a),Math.max(r,n,a))}},Gtt=class extends n2e{create(o,t,e,r,i,n,s=-1,a=1){return super.create(o,t,e,r,i,n,s),X1[10]=a,X1}},Utt=class extends n2e{create(o,t,e,r,i,n,s=-1){return super.create(o,t,e,r,i,n,s)}},Htt=class extends n2e{create(o,t,e,r,i,n,s=-1,a=-1){return super.create(o,t,e,r,i,n,s),X1[0]=o+(56<<Js)+cs,X1[10]=a,X1}},o2e,s2e,UDe;_w(()=>(o2e=new Gtt(6,Vtt,GDe),vZ),()=>{s2e=new Utt(6,Nve,vZ),UDe=new Htt(56,Nve+1,vZ)});function Wtt(o,t,e){let{plane:r,triangleContainerArr:i,getHighLightDrawInfo:n,renderMatrix:s,onlyRenderHighLightPt:a,groupIdBuilder:l,bNeedFill:c}=e,h=t.get(o+9),u=r.getPtColorIndex(t.get(o+8),h),d=r.scene.colors;if(!ad(u,d)||Q7(c,h,l))return;let p=t.get(o+7),m=r.getPtBBox(t.slice(o,o+o2e.length),0,null).UL().multiply4(s),g=t.get(o+10),y=new S(t.get(o+1),t.get(o+2)).multiply4(s),b=new S(t.get(o+3),t.get(o+4)).multiply4(s),P=new S(t.get(o+5),t.get(o+6)).multiply4(s);LDe(y,b,P,u,h,m,g,p,r.scene.ptGroup.getData(),i,a,n,r.getSceneGlobalHighLightType())}function ztt(o,t,e){var r;if(!qm(e))return;let{plane:i,trianglesArr:n,renderMatrix:s,highLightColorIndex:a}=e,l=vw(a),c=a;l&&(c=i.getPtColorIndex(t.get(o+8),t.get(o+9)));let h=(r=n[l])==null?void 0:r[c];n[l]||(n[l]=[]),h||(n[l][c]=h=[]),h.push(new S(t.get(o+1),t.get(o+2)).multiply4(s),new S(t.get(o+3),t.get(o+4)).multiply4(s),new S(t.get(o+5),t.get(o+6)).multiply4(s))}var HDe=(o=>(o[o.ID=0]="ID",o[o.CENTER_X=1]="CENTER_X",o[o.CENTER_Y=2]="CENTER_Y",o[o.RADIUS=3]="RADIUS",o[o.START_ANGLE=4]="START_ANGLE",o[o.SWEEP_ANGLE=5]="SWEEP_ANGLE",o[o.START_X=6]="START_X",o[o.START_Y=7]="START_Y",o[o.END_X=8]="END_X",o[o.END_Y=9]="END_Y",o[o.ORDER=10]="ORDER",o[o.COLOR_INDEX=11]="COLOR_INDEX",o[o.GROUP_ID=12]="GROUP_ID",o[o.FillStyle=13]="FillStyle",o))(HDe||{}),W1e=(o=>(o[o.ID=0]="ID",o[o.CENTER_X=1]="CENTER_X",o[o.CENTER_Y=2]="CENTER_Y",o[o.RADIUS=3]="RADIUS",o[o.START_ANGLE=4]="START_ANGLE",o[o.SWEEP_ANGLE=5]="SWEEP_ANGLE",o[o.START_X=6]="START_X",o[o.START_Y=7]="START_Y",o[o.END_X=8]="END_X",o[o.END_Y=9]="END_Y",o[o.ORDER=10]="ORDER",o[o.COLOR_INDEX=11]="COLOR_INDEX",o[o.GROUP_ID=12]="GROUP_ID",o[o.TEMPLATE_ID=13]="TEMPLATE_ID",o))(W1e||{}),kve=13,Ytt=14,Tf=[],a2e=class extends Up{create(o,t,e,r,i,n,s,a,l,c=-1){return Tf[0]=o+(7<<Js)+cs,Tf[1]=t.x,Tf[2]=t.y,Tf[3]=e,Tf[4]=r,Tf[5]=i,Tf[6]=n.x,Tf[7]=n.y,Tf[8]=s.x,Tf[9]=s.y,Tf[10]=a||0,Tf[11]=l||0,Tf[12]=c,Tf}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3],n=o[t+4],s=n+o[t+5],{x:a,y:l}=El(1,0,n),{x:c,y:h}=El(1,0,s),u=Math.min(a,c),d=Math.max(a,c),p=Math.min(l,h),m=Math.max(l,h);if(n<s)for(let g=Math.ceil(n/(Math.PI/2))*(Math.PI/2);g<s;g+=Math.PI/2){let{x:y,y:b}=El(1,0,g);u=Math.min(y,u),d=Math.max(y,d),p=Math.min(b,p),m=Math.max(b,m)}else for(let g=Math.floor(n/(Math.PI/2))*(Math.PI/2);g>s;g-=Math.PI/2){let y=Math.cos(g),b=Math.sin(g);u=Math.min(y,u),d=Math.max(y,d),p=Math.min(b,p),m=Math.max(b,m)}return Xa.modify(u*i+e,d*i+e,p*i+r,m*i+r)}},jtt=class extends a2e{create(o,t,e,r,i,n,s,a,l,c=-1,h=1){return super.create(o,t,e,r,i,n,s,a,l,c),Tf[13]=h,Tf}},Xtt=class extends a2e{create(o,t,e,r,i,n,s,a,l,c=-1){return super.create(o,t,e,r,i,n,s,a,l,c),Tf}},qtt=class extends a2e{create(o,t,e,r,i,n,s,a,l,c=-1,h=-1){return super.create(o,t,e,r,i,n,s,a,l,c),Tf[0]=o+(57<<Js)+cs,Tf[13]=h,Tf}},l2e,c2e,WDe;_w(()=>l2e=new jtt(7,Ytt,HDe),()=>{c2e=new Xtt(7,kve,W1e),WDe=new qtt(57,kve+1,W1e)});function $tt(o,t,e){let{plane:r,circleContainerArr:i,getHighLightDrawInfo:n,renderMatrix:s,onlyRenderHighLightPt:a,isMirrored:l,groupIdBuilder:c,bNeedFill:h}=e,u=t.get(o+12),d=r.getPtColorIndex(t.get(o+11),u);if(!ad(d,r.scene.colors)||Q7(h,u,c))return;let p=t.get(o+10),m=new S(t.get(o+1),t.get(o+2)).multiply4(s),g=new S(t.get(o+1)+t.get(o+3),t.get(o+2)).multiply4(s),y=Math.abs(g.x-m.x),b=l?Math.PI-t.get(o+4):t.get(o+4),P=l?-t.get(o+5):t.get(o+5),T=t.get(o+13),I=r.getPtBBox(t.slice(o,o+l2e.length)).UL().multiply4(s);MDe(m,y,b,P,d,u,T,I,p,r.scene.ptGroup.getData(),i,a,n,r.getSceneGlobalHighLightType())}function Ktt(o,t,e){var r;if(!qm(e))return;let{plane:i,circlesArr:n,renderMatrix:s,isMirrored:a,highLightColorIndex:l}=e,c=vw(l),h=l;c&&(h=i.getPtColorIndex(t.get(o+11),t.get(o+12)));let u=(r=n[c])==null?void 0:r[h];n[c]||(n[c]=[]),n[c][h]||(n[c][h]=u=[]);let d=new S(t.get(o+1),t.get(o+2)).multiply4(s),p=new S(t.get(o+1)+t.get(o+3),t.get(o+2)).multiply4(s),m=Math.abs(p.x-d.x),g=a?Math.PI-t.get(o+4):t.get(o+4),y=a?-t.get(o+5):t.get(o+5);u.push(d.x,d.y,m,g,y)}function Ztt(o,t,e){let{plane:r,triangleContainerArr:i,getHighLightDrawInfo:n,renderMatrix:s,onlyRenderHighLightPt:a,groupIdBuilder:l,bNeedFill:c}=e,h=t.get(o+7)*sd,u=r.scene.staticPolygonInfoBuilder,d=u.get(h+8),p=r.getPtColorIndex(u.get(h+7),d);if(!ad(p,r.scene.colors)||Q7(c,d,l))return;let m=iJ(u,h).multiply4(s),g=u.get(h+6),y=t.get(o+8),b=new S(t.get(o+1),t.get(o+2)).multiply4(m),P=new S(t.get(o+3),t.get(o+4)).multiply4(m),T=new S(t.get(o+5),t.get(o+6)).multiply4(m),I=r.getPtBBox(t.slice(o,o+MH.length),0,u).UL().multiply4(s);LDe(b,P,T,p,d,I,y,g,r.scene.ptGroup.getData(),i,a,n,r.getSceneGlobalHighLightType())}function Jtt(o,t,e){var r;if(!qm(e))return;let{plane:i,trianglesArr:n,renderMatrix:s,staticPolygonInfoBuilder:a,highLightColorIndex:l}=e,c=t.get(o+7)*sd,h=vw(l),u=l;h&&(u=i.getPtColorIndex(a.get(c+7),a.get(c+8)));let d=iJ(a,c).multiply4(s),p=(r=n[h])==null?void 0:r[u];n[h]||(n[h]=[]),p||(n[h][u]=p=[]),p.push(new S(t.get(o+1),t.get(o+2)).multiply4(d),new S(t.get(o+3),t.get(o+4)).multiply4(d),new S(t.get(o+5),t.get(o+6)).multiply4(d))}function Qtt(o,t,e){let{plane:r,circleContainerArr:i,getHighLightDrawInfo:n,renderMatrix:s,onlyRenderHighLightPt:a,isMirrored:l,groupIdBuilder:c,bNeedFill:h}=e,u=t.get(o+10)*sd,d=r.scene.staticPolygonInfoBuilder,p=d.get(u+8),m=r.getPtColorIndex(d.get(u+7),p);if(!ad(m,r.scene.colors)||Q7(h,p,c))return;let g=iJ(d,u).multiply4(s),y=d.get(u+6),b=t.get(o+11),P=l?Math.PI-t.get(o+4):t.get(o+4),T=l?-t.get(o+5):t.get(o+5),I=new S(t.get(o+1),t.get(o+2)).multiply4(g),C=new S(t.get(o+1)+t.get(o+3),t.get(o+2)).multiply4(g),E=Math.abs(C.x-I.x),O=r.getPtBBox(t.slice(o,o+NH.length),0,d).UL().multiply4(s);MDe(I,E,P,T,m,p,b,O,y,r.scene.ptGroup.getData(),i,a,n,r.getSceneGlobalHighLightType())}function ert(o,t,e){var r;if(!qm(e))return;let{plane:i,circlesArr:n,renderMatrix:s,isMirrored:a,staticPolygonInfoBuilder:l,highLightColorIndex:c}=e,h=vw(c),u=t.get(o+10)*sd,d=c;h&&(d=i.getPtColorIndex(l.get(u+7),l.get(u+8)));let p=iJ(l,u).multiply4(s),m=(r=n[h])==null?void 0:r[d];n[h]||(n[h]=[]),m||(n[h][d]=m=[]);let g=new S(t.get(o+1),t.get(o+2)).multiply4(p),y=new S(t.get(o+1)+t.get(o+3),t.get(o+2)).multiply4(p),b=Math.abs(y.x-g.x),P=a?Math.PI-t.get(o+4):t.get(o+4),T=a?-t.get(o+5):t.get(o+5);m.push(g.x,g.y,b,P,T)}function trt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=zDe(e,t,r);l&&(Gg(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&z1e(o,l),(n=l.highLightInfo)!=null&&n.ctx&&z1e(l.highLightInfo.ctx,l,"groupId"))}function zDe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix3:s,scale:a,sampling:l}=e,c=e.highLightColorIndex,h=o.get(t+9),u=i.getPtColorIndex(o.get(t+8),h);if(r!=="select"&&!ad(u,i.scene.colors))return;let d=r==="select"?null:n(h),p=o.get(t+11),m=o.get(t+10),g=o.get(t+4),y=i.getDashedArray(m,a,g),b=q.build3(new S(o.get(t+1),o.get(t+2)),o.get(t+5)*360/Zs,o.get(t+6)*360/Zs,o.get(t+3),o.get(t+3)).multiply3(s),P=i.getRenderLineWidth(l,g,a);return{...e,colorIndex:u,groupIdIndex:h,dashedArray:y,lineWidth:P,arc:b,lineCap:p,highLightInfo:d,highLightColorIndex:c}}function z1e(o,t,e="none"){let{bNeedFill:r,colorIndex:i,groupIdIndex:n,dashedArray:s,lineWidth:a,arc:l,lineCap:c,plane:h,highLightColorIndex:u,highLightInfo:d,camera:p,groupIdBuilder:m,material:g,renderMode:y}=t;switch(o.save(),e){case"none":{h.ptSetCustomizedColor(o,p,i,g,y,n);break}case"groupId":{h.setGroupHighLightColor(o,p,i,d.isForceHighLight);break}case"select":{h.highLightPtSetCustomizedColor(o,u,i);break}}o.setLineDash(s);let b=o.getContext();if(kH(r,n,m))o.setLineWidth(a),b.beginPath(),b.arc(l.center.x,l.center.y,l.rx,l.startAngle*Zs/360,l.endAngle()*Zs/360,l.sweepAngle<0),o.setLineCap(sJ[c]),b.stroke();else{o.setLineWidth(1),b.beginPath(),b.arc(l.center.x,l.center.y,l.rx+a/2,l.startAngle*Zs/360,l.endAngle()*Zs/360,l.sweepAngle<0),b.stroke(),l.rx-a/2>0&&(b.beginPath(),b.arc(l.center.x,l.center.y,l.rx-a/2,l.startAngle*Zs/360,l.endAngle()*Zs/360,l.sweepAngle<0),b.stroke());let P=l.center.add(new S(l.rx,0)).rotate(l.center,l.startAngle*Zs/360),T=l.center.add(new S(l.rx,0)).rotate(l.center,l.endAngle()*Zs/360);b.beginPath(),b.arc(P.x,P.y,a/2,0,2*Math.PI),b.stroke(),b.beginPath(),b.arc(T.x,T.y,a/2,0,2*Math.PI),b.stroke()}o.restore()}function rrt(o,t,e,r){if(!qm(r))return;let i=zDe(e,t,r,"select");z1e(o,i,"select")}var YDe=(o=>(o[o.ID=0]="ID",o[o.CENTER_X=1]="CENTER_X",o[o.CENTER_Y=2]="CENTER_Y",o[o.RADIUS=3]="RADIUS",o[o.ORDER=4]="ORDER",o[o.COLOR_INDEX=5]="COLOR_INDEX",o[o.GROUP_ID=6]="GROUP_ID",o[o.FILL_STYLE=7]="FILL_STYLE",o))(YDe||{}),Y1e=(o=>(o[o.ID=0]="ID",o[o.CENTER_X=1]="CENTER_X",o[o.CENTER_Y=2]="CENTER_Y",o[o.RADIUS=3]="RADIUS",o[o.ORDER=4]="ORDER",o[o.COLOR_INDEX=5]="COLOR_INDEX",o[o.GROUP_ID=6]="GROUP_ID",o[o.TEMPLATE_ID=7]="TEMPLATE_ID",o))(Y1e||{}),Bve=7,irt=8,gP=[],h2e=class extends Up{create(o,t,e,r,i,n=-1){return gP[0]=o+(0<<Js)+cs,gP[1]=t.x,gP[2]=t.y,gP[3]=e,gP[4]=r||0,gP[5]=i||0,gP[6]=n,gP}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+3];return Xa.modify(e-i,e+i,r-i,r+i)}},nrt=class extends h2e{create(o,t,e,r,i,n=-1,s=1){return super.create(o,t,e,r,i,n),gP[7]=s,gP}},ort=class extends h2e{create(o,t,e,r,i,n){return super.create(o,t,e,r,i,n)}},srt=class extends h2e{create(o,t,e,r,i,n,s=-1){return super.create(o,t,e,r,i,n),gP[0]=o+(51<<Js)+cs,gP[7]=s,gP}},u2e,d2e,jDe;_w(()=>u2e=new nrt(0,irt,YDe),()=>{d2e=new ort(0,Bve,Y1e),jDe=new srt(51,Bve+1,Y1e)});function art(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=XDe(e,t,r);l&&(Gg(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&j1e(o,l),(n=l.highLightInfo)!=null&&n.ctx&&j1e(l.highLightInfo.ctx,l,"groupId"))}function XDe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,scale:a}=e,l=o.get(t+6),c=i.getPtColorIndex(o.get(t+5),l);if(r!=="select"&&!ad(c,i.scene.colors))return;let h=r==="select"?null:n(l),u=new S(o.get(t+1),o.get(t+2)).multiply4(s),d=o.get(t+3)*a,p=i.getPtBBox(o.slice(t,t+u2e.length)).UL().multiply4(s),m=o.get(t+7),g=ih.isDoubleRgb(l,i.scene.ptGroup.getData());return{...e,highLightInfo:h,colorIndex:c,groupIdIndex:l,center:u,radius:d,leftUpPoint:p,fillStyle:m,isDoubleRgb:g}}function j1e(o,t,e="none"){let{bNeedFill:r,colorIndex:i,groupIdIndex:n,center:s,radius:a,plane:l,leftUpPoint:c,fillStyle:h,isDoubleRgb:u,samplingPxLength:d,highLightColorIndex:p,highLightInfo:m,camera:g,groupIdBuilder:y,material:b,renderMode:P}=t,T=kH(r,n,y);switch(o.save(),e){case"none":{l.ptSetCustomizedColor(o,g,i,b,P,n);break}case"groupId":{l.setGroupHighLightColor(o,g,i,m.isForceHighLight);break}case"select":{l.highLightPtSetCustomizedColor(o,p,i);break}}let I=o.getContext();I.beginPath(),I.arc(s.x,s.y,a,0,Zs),o.setTranslate(c.x,c.y),e=="none"&&l.setFillStyle(o,h,i,u,d,void 0,g,!1,b,P),T?I.fill():I.stroke(),o.restore()}function lrt(o,t,e,r){if(!qm(r))return;let i=XDe(e,t,r,"select");j1e(o,i,"select")}function crt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=qDe(e,t,r);l&&((Gg(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)||l.isDrcRenderFixed)&&X1e(o,l),(n=l.highLightInfo)!=null&&n.ctx&&X1e(l.highLightInfo.ctx,l,"groupId"))}function qDe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,samplingPxLength:a,scale:l,sampling:c}=e,h=o.get(t+11),u=i.getPtColorIndex(o.get(t+12),h);if(r!=="select"&&!ad(u,i.scene.colors))return;let d=e.highLightColorIndex,p=r==="select"?null:n(h),m=o.get(t+5),g=o.get(t+3)*l,y=o.get(t+4)*l,b=i.scene.drcRenderModel===0,P=i.scene.drcRenderStyle===0;b&&(y=Math.min(o.get(t+4)/a,o.get(t+7)*c),g=o.get(t+3)*y/o.get(t+4));let T=g*.5,I=y*.5,C=new S(-T,I),E=new S(T,-I),O=new S(T,I),_=new S(-T,-I),x=i.scene.stringInfos[o.get(t+8)],v=i.scene.stringInfos[o.get(t+9)],D=new S(o.get(t+1),o.get(t+2)).multiply4(s);return{...e,colorIndex:u,groupIdIndex:h,position:D,angle:m,isDrcRenderFixed:b,isDrcStyleCross:P,start1:C,end1:E,start2:O,end2:_,height:y,halfHeight:I,halfWidth:T,leftText:x,rightText:v,highLightInfo:p,highLightColorIndex:d}}function X1e(o,t,e="none"){let{colorIndex:r,groupIdIndex:i,position:n,angle:s,isDrcStyleCross:a,start1:l,end1:c,start2:h,end2:u,height:d,halfHeight:p,halfWidth:m,leftText:g,rightText:y,plane:b,highLightColorIndex:P,highLightInfo:T,sampling:I,camera:C,material:E,renderMode:O}=t;switch(o.save(),e){case"none":{b.ptSetCustomizedColor(o,C,r,E,O,i);break}case"groupId":{b.setGroupHighLightColor(o,C,r,T.isForceHighLight);break}case"select":{b.highLightPtSetCustomizedColor(o,P,r);break}}let _=o.getContext();if(o.setTranslate(n.x,n.y),o.setRotate(-s),a)o.setLineWidth(I*2),_.beginPath(),_.moveTo(l.x,l.y),_.lineTo(c.x,c.y),_.moveTo(h.x,h.y),_.lineTo(u.x,u.y),_.stroke();else{o.setLineWidth(I),_.beginPath(),_.moveTo(l.x,l.y),_.lineTo(c.x,c.y),_.moveTo(h.x,h.y),_.lineTo(u.x,u.y),_.moveTo(l.x,l.y),_.lineTo(u.x,u.y),_.moveTo(h.x,h.y),_.lineTo(c.x,c.y),_.stroke(),o.setTextAlign("center"),o.setTextBaseLine("middle");let x=d*.4;o.setFont(`normal ${x}px ${Z7}`);let v=p/m,D=Math.atan(v),w=m*p,F=p*2+p/Math.sin(D)*2,H=2*w/F;_.fillText(g,-(H/Math.sin(D)),0),_.fillText(y,H/Math.sin(D),0)}o.restore()}function hrt(o,t,e,r){if(!qm(r))return;let i=qDe(e,t,r,"select");X1e(o,i,"select")}function urt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=$De(e,t,r);l&&(Gg(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&q1e(o,l),(n=l.highLightInfo)!=null&&n.ctx&&q1e(l.highLightInfo.ctx,l,"groupId"))}function $De(o,t,e,r="none"){let{plane:i,pxLength:n,getHighLightDrawInfo:s,renderMatrix:a}=e,l=o.get(t+7),c=i.getPtColorIndex(o.get(t+6),l);if(r!=="select"&&!ad(c,i.scene.colors))return;let h=r==="select"?null:s(l),u=new S(o.get(t+1),o.get(t+2)),d=o.get(t+3),p=o.get(t+4)*n/8*d*(d===1?.5:1),m=Math.sqrt(3),g=u.add(new S(-m,-1).mul(p)).multiply4(a),y=u.add(new S(m,-1).mul(p)).multiply4(a),b=u.add(new S(0,2).mul(p)).multiply4(a),P;return d===1&&(u=u.multiply4(a),P=Math.sqrt((u.x-b.x)**2+(u.y-b.y)**2)*2),{...e,highLightInfo:h,colorIndex:c,groupIdIndex:l,isTriangle:d,point:u,p1:g,p2:y,p3:b}}function q1e(o,t,e="none"){let{highLightInfo:r,colorIndex:i,groupIdIndex:n,plane:s,isTriangle:a,point:l,p1:c,p2:h,p3:u,highLightColorIndex:d,camera:p,material:m,renderMode:g}=t;switch(o.save(),e){case"none":{s.ptSetCustomizedColor(o,p,i,m,g,n);break}case"groupId":{s.setGroupHighLightColor(o,p,i,r.isForceHighLight);break}case"select":{s.highLightPtSetCustomizedColor(o,d,i);break}}let y=o.getContext();if(y.beginPath(),a===1){let b=Math.sqrt((l.x-u.x)**2+(l.y-u.y)**2)*2;y.arc(l.x,l.y,b,0,Math.PI*2)}else y.moveTo(c.x,c.y),y.lineTo(h.x,h.y),y.lineTo(u.x,u.y);y.closePath(),y.fill(),o.restore()}function drt(o,t,e,r){if(!qm(r))return;let i=$De(e,t,r,"select");q1e(o,i,"select")}function prt(o,t,e,r){var i;let{plane:n,samplingPxLength:s}=r;if(e.get(t+8)<s)return;let a=KDe(e,t,r);a&&(n.getSceneGlobalHighLightType()==1&&(i=a.highLightInfo)!=null&&i.ctx?$1e(a.highLightInfo.ctx,a,"groupId"):$1e(o,a))}function KDe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,highLightColorIndex:a}=e,l=o.get(t+10),c=i.getPtColorIndex(o.get(t+11),l);if(r!=="select"&&!ad(c,i.scene.colors))return;let h=new S(o.get(t+1),o.get(t+2)).multiply4(s),u=i.scene.stringInfos[o.get(t+7)],d=o.get(t+5),p=o.get(t+3),m=o.get(t+4),g=o.get(t+9),y=r==="select"?null:n(l),b=ih.isDoubleRgb(l,i.scene.ptGroup.getData()),P=p*o.get(t+13),T=m*o.get(t+14);return{...e,colorIndex:c,groupIdIndex:l,point:h,text:u,angle:d,height:m,limitMax:g,isDoubleRgb:b,highLightInfo:y,highLightColorIndex:a,widthOffset:P,heightOffset:T}}function $1e(o,t,e="none"){let{plane:r,colorIndex:i,point:n,text:s,angle:a,height:l,limitMax:c,samplingPxLength:h,sampling:u,isDoubleRgb:d,highLightColorIndex:p,highLightInfo:m,widthOffset:g,heightOffset:y,camera:b}=t;o.save();let P=o.getContext();switch(e){case"none":{o.setFillStyle(r.getNetStringColor(i,d,!1,b));break}case"groupId":{r.setGroupHighLightStringColor(o,i,m.isForceHighLight,b);break}case"select":{r.highLightPtSetCustomizedColor(o,p,i,10);break}}o.setTranslate(n.x,n.y),o.setRotate(-a),o.setTextAlign("center"),o.setTextBaseLine("middle");let T=Math.min(l/h,c*u);o.setFont(`normal ${T}px ${Z7}`),P.fillText(s,g/h,-y/h),o.restore()}function frt(o,t,e,r){if(!qm(r))return;let i=KDe(e,t,r,"select");$1e(o,i,"select")}function mrt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=ZDe(e,t,r);l&&(Gg(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&K1e(o,l),(n=l.highLightInfo)!=null&&n.ctx&&K1e(l.highLightInfo.ctx,l,"groupId"))}function grt(o,t,e="none"){let{leftUpPointX:r,leftUpPointY:i,width:n,height:s}=t,a=t.radius;o.roundRect?o.roundRect(r,i,n,s,a):(o.beginPath(),2*a>Math.min(n,s)&&(a=Math.min(n,s)/2),o.moveTo(r+a,i),o.lineTo(r+n-a,i),o.arc(r+n-a,i+a,a,Math.PI*1.5,Math.PI*2),o.lineTo(r+n,i+s-a),o.arc(r+n-a,i+s-a,a,0,Math.PI*.5),o.lineTo(r+n-a,i+s),o.arc(r+a,i+s-a,a,Math.PI*.5,Math.PI),o.lineTo(r,i+a),o.arc(r+a,i+a,a,Math.PI,Math.PI*1.5),o.closePath())}function ZDe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,pxLength:a,scale:l}=e,c=o.get(t+9),h=i.getPtColorIndex(o.get(t+8),c);if(r!=="select"&&!ad(h,i.scene.colors))return;let u=e.highLightColorIndex,d=r==="select"?null:n(c),p=Math.max(o.get(t+3),a),m=Math.max(o.get(t+4),a),g=o.get(t+5),y=o.get(t+10),b=ih.isDoubleRgb(c,i.scene.ptGroup.getData()),P=o.get(t+6),T=new S(o.get(t+1),o.get(t+2)).multiply4(s);return{...e,highLightInfo:d,colorIndex:h,groupIdIndex:c,leftUpPoint:T,radius:P*l,width:p*l,height:m*l,isDoubleRgb:b,fillStyle:y,highLightColorIndex:u,angle:g}}function K1e(o,t,e="none"){let{plane:r,bNeedFill:i,highLightInfo:n,colorIndex:s,groupIdIndex:a,leftUpPoint:l,radius:c,height:h,width:u,isDoubleRgb:d,fillStyle:p,samplingPxLength:m,highLightColorIndex:g,angle:y,isNobodyRect:b,isMirrored:P,camera:T,groupIdBuilder:I,material:C,renderMode:E}=t,O=o.getContext();O.beginPath();let _=kH(i,a,I);switch(o.save(),e){case"none":{r.ptSetCustomizedColor(o,T,s,C,E,a);break}case"groupId":{r.setGroupHighLightColor(o,T,s,n.isForceHighLight);break}case"select":{b?r.setNoBodyRectColor(o,T,g,s,a):r.highLightPtSetCustomizedColor(o,g,s);break}}o.setTranslate(l.x,l.y),o.setScale(P?-1:1,1),o.setRotate(-y),c?grt(O,{leftUpPointX:0,leftUpPointY:0,width:u,height:h,radius:c}):(O.beginPath(),O.moveTo(0,0),O.lineTo(u,0),O.lineTo(u,h),O.lineTo(0,h),O.closePath()),e==="none"&&r.setFillStyle(o,p,s,d,m,void 0,T,!1,C,E),_?O.fill():O.stroke(),o.restore()}function yrt(o,t,e,r){if(!r.isNobodyRect&&!qm(r))return;let i=ZDe(e,t,r,"select");i.isNobodyRect=r.isNobodyRect,K1e(o,i,"select")}function brt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=JDe(e,t,r);l&&(Gg(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&Z1e(o,l),(n=l.highLightInfo)!=null&&n.ctx&&Z1e(l.highLightInfo.ctx,l))}function JDe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,sampling:a}=e,l=o.get(t+9),c=i.getPtColorIndex(o.get(t+8),l);if(r!=="select"&&!ad(c,i.scene.colors))return;let h=e.highLightColorIndex,u=r==="select"?null:n(l),d=new S(o.get(t+1),o.get(t+2)).multiply4(s),p=new S(o.get(t+3),o.get(t+4)).multiply4(s),m=a,g=o.get(t+5),y=o.get(t+6);return{...e,highLightInfo:u,colorIndex:c,groupIdIndex:l,lineWidth:m,start:d,end:p,lenAndGap:g,len:y,highLightColorIndex:h}}function Z1e(o,t,e="none"){let{highLightInfo:r,colorIndex:i,groupIdIndex:n,lineWidth:s,start:a,end:l,plane:c,lenAndGap:h,len:u,highLightColorIndex:d,camera:p,material:m,renderMode:g}=t;switch(o.save(),e){case"none":{c.ptSetCustomizedColor(o,p,i,m,g,n);break}case"groupId":{c.setGroupHighLightColor(o,p,i,r.isForceHighLight);break}case"select":{c.highLightPtSetCustomizedColor(o,d,i);break}}o.setLineWidth(s);let y=o.getContext();h!==u&&o.setLineDash([u,h-u]),y.beginPath(),y.moveTo(a.x,a.y),y.lineTo(l.x,l.y),y.stroke(),o.restore()}function Prt(o,t,e,r){if(!qm(r))return;let i=JDe(e,t,r,"select");Z1e(o,i,"select")}function Trt(o,t,e,r){var i,n;let{plane:s,onlyRenderHighLightPt:a,globalHighLightType:l}=r,c=e.get(t+4),h=e.get(t+5),u=s.scene.colors;if(!ad(c,u)&&!ad(h,u))return;let d=QDe(e,t,r);Gg(a,(i=d.highLightInfo)==null?void 0:i.isForceHighLight,l)&&J1e(o,d),(n=d.highLightInfo)!=null&&n.ctx&&J1e(d.highLightInfo.ctx,d,"groupId")}function QDe(o,t,e,r="none"){let{getHighLightDrawInfo:i,renderMatrix:n,scale:s,plane:a}=e,l=0,c=e.highLightColorIndex,h=o.get(t+4),u=o.get(t+5),d=o.get(t+7),p=r==="select"?null:i(d),m=o.get(t+3)*s,g=ih.isDoubleRgb(d,a.scene.ptGroup.getData()),y=new S(o.get(t+1),o.get(t+2)).multiply4(n);return{...e,highLightInfo:p,colorIndex1:h,colorIndex2:u,groupIdIndex:d,radius:m,center:y,colorIndex:l,isDoubleRgb:g,highLightColorIndex:c}}function J1e(o,t,e="none"){let{highLightInfo:r,colorIndex:i,colorIndex1:n,colorIndex2:s,groupIdIndex:a,radius:l,center:c,isMirrored:h,plane:u,isDoubleRgb:d,highLightColorIndex:p,camera:m,material:g,renderMode:y}=t;o.save();let b,P,T=o.getContext();switch(e){case"none":{b=u.getFillStyle(n,d,m,!1,g,y),P=u.getFillStyle(s,d,m,!1,g,y);break}case"groupId":{b=u.getGroupHighLightColor(n,r.isForceHighLight,m),P=u.getGroupHighLightColor(s,r.isForceHighLight,m);break}case"select":{if(vw(p))b=u.getSemicirclePtHighLightFillStyle(n,!0),P=u.getSemicirclePtHighLightFillStyle(s,!0);else{T.beginPath(),T.arc(c.x,c.y,l,0,Zs),o.setFillStyle(u.getFillStyle(p,d,m,!1,g,y)),T.fill(),o.restore();return}break}}T.beginPath(),T.arc(c.x,c.y,l,Math.PI/2,Math.PI/2+Math.PI),T.closePath();let I=h?P:b;I&&o.setFillStyle(I),T.fill(),T.beginPath(),T.arc(c.x,c.y,l,-Math.PI/2,Math.PI/2),T.closePath();let C=h?b:P;C&&o.setFillStyle(C),T.fill(),o.restore()}function Irt(o,t,e,r){if(!qm(r))return;let i=QDe(e,t,r,"select");J1e(o,i,"select")}function Crt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=Srt(e,t,r);l&&(Gg(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&Fve(o,l),(n=l.highLightInfo)!=null&&n.ctx&&Fve(l.highLightInfo.ctx,l,"groupId"))}function Srt(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix3:s,sampling:a}=e,l=o.get(t+8),c=i.getPtColorIndex(o.get(t+7),l);if(r!=="select"&&!ad(c,i.scene.colors))return;let h=r==="select"?null:n(l),u=q.build3(new S(o.get(t+1),o.get(t+2)),o.get(t+4)*360/Zs,o.get(t+5)*360/Zs,o.get(t+3),o.get(t+3)).multiply3(s);return{...e,colorIndex:c,groupIdIndex:l,lineWidth:a,arc:u,highLightInfo:h}}function Fve(o,t,e="none"){let{colorIndex:r,groupIdIndex:i,lineWidth:n,arc:s,plane:a,highLightInfo:l,camera:c,material:h,renderMode:u}=t;switch(o.save(),e){case"none":{a.ptSetCustomizedColor(o,c,r,h,u,i,void 0,!0);break}case"groupId":{a.setGroupHighLightColor(o,c,r,l.isForceHighLight,!0);break}}let d=o.getContext();o.setLineWidth(n),d.beginPath(),d.arc(s.center.x,s.center.y,s.rx,s.startAngle*Zs/360,s.endAngle()*Zs/360,s.sweepAngle<0),d.stroke(),o.restore()}function Ert(o,t,e,r){var i;let{plane:n,onlyRenderHighLightPt:s,groupIdBuilder:a,bNeedFill:l}=r,c=e.get(t+6)*sd,h=n.scene.staticPolygonInfoBuilder,u=h.get(c+8),d=n.getPtColorIndex(h.get(c+7),u);if(!ad(d,n.scene.colors)||!Q7(l,u,a))return;let p=Ort(e,t,r,h,c);!s&&Vve(o,p),(i=p.highLightInfo)!=null&&i.ctx&&Vve(p.highLightInfo.ctx,p,"groupId")}function Ort(o,t,e,r,i,n="none"){let{getHighLightDrawInfo:s,renderMatrix:a,sampling:l}=e,c=new Ae([r.get(i),r.get(i+1),0,0,r.get(i+2),r.get(i+3),0,0,0,0,1,0,r.get(i+4),r.get(i+5),0,1]).multiply4(a),h=q.build3(new S(o.get(t+1),o.get(t+2)),o.get(t+4)*360/Zs,o.get(t+5)*360/Zs,o.get(t+3),o.get(t+3)).multiply3(c.toMatrix3()),u=l,d=r.get(i+7),p=r.get(i+8),m=n==="select"?null:s(p);return{...e,colorIndex:d,groupIdIndex:p,lineWidth:u,arc:h,highLightInfo:m}}function Vve(o,t,e="none"){let{colorIndex:r,groupIdIndex:i,lineWidth:n,arc:s,plane:a,highLightInfo:l,camera:c,material:h,renderMode:u}=t;switch(o.save(),e){case"none":{a.ptSetCustomizedColor(o,c,r,h,u,i,void 0,!0);break}case"groupId":{a.setGroupHighLightColor(o,c,r,l.isForceHighLight,!0);break}}let d=o.getContext();o.setLineWidth(n),d.beginPath(),d.arc(s.center.x,s.center.y,s.rx,s.startAngle*Zs/360,s.endAngle()*Zs/360,s.sweepAngle<0),d.stroke(),o.restore()}function Art(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=_rt(e,t,r);l&&(Gg(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&Gve(o,l),(n=l.highLightInfo)!=null&&n.ctx&&Gve(l.highLightInfo.ctx,l,"groupId"))}function _rt(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,sampling:a}=e,l=o.get(t+7),c=i.getPtColorIndex(o.get(t+6),l);if(r!=="select"&&!ad(c,i.scene.colors))return;let h=r==="select"?null:n(l),u=new S(o.get(t+1),o.get(t+2)).multiply4(s),d=new S(o.get(t+3),o.get(t+4)).multiply4(s);return{...e,highLightInfo:h,colorIndex:c,groupIdIndex:l,lineWidth:a,start:u,end:d}}function Gve(o,t,e="none"){let{highLightInfo:r,colorIndex:i,groupIdIndex:n,lineWidth:s,start:a,end:l,plane:c,camera:h,material:u,renderMode:d}=t;switch(o.save(),e){case"none":{c.ptSetCustomizedColor(o,h,i,u,d,n,void 0,!0);break}case"groupId":{c.setGroupHighLightColor(o,h,i,r.isForceHighLight,!0);break}}let p=o.getContext();o.setLineWidth(s),p.beginPath(),p.moveTo(a.x,a.y),p.lineTo(l.x,l.y),p.stroke(),o.restore()}function vrt(o,t,e,r){var i;let{plane:n,onlyRenderHighLightPt:s,groupIdBuilder:a,bNeedFill:l}=r,c=e.get(t+5)*sd,h=n.scene.staticPolygonInfoBuilder.get(c+8),u=n.getPtColorIndex(n.scene.staticPolygonInfoBuilder.get(c+7),h);if(!ad(u,n.scene.colors)||!Q7(l,h,a))return;let d=xrt(e,t,r,n.scene.staticPolygonInfoBuilder,c);!s&&Uve(o,d),(i=d.highLightInfo)!=null&&i.ctx&&Uve(d.highLightInfo.ctx,d,"groupId")}function xrt(o,t,e,r,i,n=!1){let{getHighLightDrawInfo:s,renderMatrix:a,sampling:l}=e,c=new Ae([r.get(i),r.get(i+1),0,0,r.get(i+2),r.get(i+3),0,0,0,0,1,0,r.get(i+4),r.get(i+5),0,1]).multiply4(a),h=r.get(i+7),u=r.get(i+8),d=n?null:s(u),p=new S(o.get(t+1),o.get(t+2)).multiply4(c),m=new S(o.get(t+3),o.get(t+4)).multiply4(c);return{...e,highLightInfo:d,colorIndex:h,groupIdIndex:u,lineWidth:l,start:p,end:m}}function Uve(o,t,e="none"){let{highLightInfo:r,colorIndex:i,groupIdIndex:n,lineWidth:s,start:a,end:l,plane:c,camera:h,material:u,renderMode:d}=t;switch(o.save(),e){case"none":{c.ptSetCustomizedColor(o,h,i,u,d,n,void 0,!0);break}case"groupId":{c.setGroupHighLightColor(o,h,i,r.isForceHighLight,!0);break}}let p=o.getContext();o.setLineWidth(s),p.beginPath(),p.moveTo(a.x,a.y),p.lineTo(l.x,l.y),p.stroke(),o.restore()}var ewe=(o=>(o[o.ID=0]="ID",o[o.STRING_INDEX=1]="STRING_INDEX",o[o.CONTENT_WIDTH=2]="CONTENT_WIDTH",o[o.CONTENT_HEIGHT=3]="CONTENT_HEIGHT",o[o.Matrix3Start=4]="Matrix3Start",o[o.Matrix3End=12]="Matrix3End",o[o.COLOR_INDEX=13]="COLOR_INDEX",o[o.ORDER=14]="ORDER",o[o.GROUP_ID=15]="GROUP_ID",o[o.TEXT_WRAP=16]="TEXT_WRAP",o[o.TEXT_ALIGN=17]="TEXT_ALIGN",o[o.TEXT_VERTICAL_ALIGN=18]="TEXT_VERTICAL_ALIGN",o[o.OVERFLOW=19]="OVERFLOW",o[o.LINE_HEIGHT=20]="LINE_HEIGHT",o[o.SHADOW_COLOR_INDEX=21]="SHADOW_COLOR_INDEX",o[o.SHADOW_BLUR=22]="SHADOW_BLUR",o))(ewe||{}),Rrt=23,mc=[],Drt=class extends Up{create(o,t,e,r,i,n,s,a=-1,l=0,c=0,h=0,u=1,d,p,m){return mc[0]=o+(18<<Js)+cs,mc[1]=t,mc[2]=r,mc[3]=i,mc[4]=e.data[0],mc[5]=e.data[1],mc[6]=e.data[2],mc[7]=e.data[3],mc[8]=e.data[4],mc[9]=e.data[5],mc[10]=e.data[6],mc[11]=e.data[7],mc[12]=e.data[8],mc[13]=n||0,mc[14]=s||0,mc[15]=a,mc[16]=l,mc[17]=c,mc[18]=h,mc[19]=u,mc[20]=d||1,mc[21]=p,mc[22]=m||0,mc}getBBox(o,t){let e=o[t+2],r=o[t+3],i=o.slice(t+4,t+12+1),{x:n,y:s}=vve(i,0,0),{x:a,y:l}=vve(i,e,r);return Xa.modify(Math.min(n,a),Math.max(n,a),Math.min(s,l),Math.max(s,l))}},wrt=GT*3,Lrt=10,twe=(o=>(o[o.ID=0]="ID",o[o.STRING_INDEX=1]="STRING_INDEX",o[o.POSITION_X=2]="POSITION_X",o[o.POSITION_Y=3]="POSITION_Y",o[o.ANGLE=4]="ANGLE",o[o.WIDTH=5]="WIDTH",o[o.HEIGHT=6]="HEIGHT",o[o.COLOR_INDEX=7]="COLOR_INDEX",o[o.ORDER=8]="ORDER",o[o.GROUP_ID=9]="GROUP_ID",o))(twe||{}),Mrt=class extends Up{create(o,t,e,r,i,n,s,a,l=-1){return mc[0]=o+(18<<Js)+cs,mc[1]=t,mc[2]=e.x,mc[3]=e.y,mc[4]=(r%Zs+Zs)%Zs,mc[5]=i,mc[6]=n,mc[7]=s||0,mc[8]=a||0,mc[9]=l,mc}getBBox(o,t){let e=o[t+5],r=o[t+6],i=o[t+2]+e/2,n=o[t+3]+r/2,s=o[t+4],a=e/2,l=r/2;if(s===0||s===Math.PI){let p=Math.min(i-a,i+a),m=Math.max(i-a,i+a),g=Math.min(n-l,n+l),y=Math.max(n-l,n+l);return Xa.modify(p,m,g,y)}if(s===GT||s===wrt){let p=Math.min(i-l,i+l),m=Math.max(i-l,i+l),g=Math.min(n-a,n+a),y=Math.max(n-a,n+a);return Xa.modify(p,m,g,y)}let c=El(a,l,s),h=El(-a,-l,s),u=e>0?1:-1,d=r>0?1:-1;return c=xve(c.x,c.y,u,d),h=xve(h.x,h.y,u,d),Xa.modify(Math.min(c.x,h.x)+i,Math.max(c.x,h.x)+i,Math.min(c.y,h.y)+n,Math.max(c.y,h.y)+n)}},rwe,Cw;_w(()=>rwe=new Drt(18,Rrt,ewe),()=>{Cw=new Mrt(18,Lrt,twe)});function Nrt(o,t,e,r){let i=krt(e,t,r);i&&Brt(o,i)}function krt(o,t,e){let{plane:r,renderMatrix3:i,currentRenderFont:n}=e,s=o.get(t+15),a=r.getPtColorIndex(o.get(t+13),s);if(!ad(a,r.scene.colors))return;let l=r.scene.sdfStringInfos[o.get(t+1)],c=o.get(t+16),h=o.get(t+2),u=o.get(t+3),d=o.get(t+17),p=o.get(t+18),m=o.get(t+19),g=l["text-decoration"],y=new Qe(Array.from(o.slice(t+4,t+12+1))).multiply3(i),b=o.get(t+20),P=o.get(t+21),T=o.get(t+22);return{...e,textStyleObj:l,matrix:y,colorIndex:a,groupIdIndex:s,overflow:m,contentWidth:h,contentHeight:u,textWrap:c,textVerticalAlign:p,textAlign:d,textDecoration:g,currentRenderFont:n,lineHeight:b,shadowColorIndex:P,shadowBlur:T}}function Brt(o,t){let{plane:e,textStyleObj:r,matrix:i,colorIndex:n,groupIdIndex:s,overflow:a,contentWidth:l,contentHeight:c,textWrap:h,textVerticalAlign:u,textAlign:d,textDecoration:p,currentRenderFont:m,lineHeight:g,shadowColorIndex:y,shadowBlur:b,camera:P,material:T,renderMode:I}=t,C,E=o.getContext(),O=parseFloat(r["font-size"]);o.setTextBaseLine("bottom");let _=1,x=e.scene.getTextSizeCorrectionEnabled();if(x){let N=Ew(r,V7);if(!m.style||m.style!==N){o.setFont(N);let U=E.measureText(r.value);_=V7/(Math.abs(U.fontBoundingBoxAscent)+Math.abs(U.fontBoundingBoxDescent)),m.style=N,m.ratio=_}else _=m.ratio}let v=Ew(r,O*_);o.setFont(v),a==0?(C=!0,o.originSave()):o.save(),e.ptSetCustomizedColor(o,P,n,T,I,s),e.setRenderShadowInfo(o,b,y),o.setTransform([i.data[0],i.data[1],i.data[3],i.data[4],i.data[6],i.data[7]]),o.setScale(1,-1);let D=E.measureText(r.value),w=r.value.split(`
`),F=D.width,H=x?O:Math.abs(D.fontBoundingBoxAscent)+Math.abs(D.fontBoundingBoxDescent),z=r.value,V=H/8,W=0,L=0;a==0&&(E.beginPath(),E.rect(0,-c,l,c),E.clip());let k=H*g;if(w.length==1&&(F<l||h==0)){switch(u){case 0:{W=-c+k;break}case 2:{W=-(c-k)*.5;break}case 1:break}if(D.width<l)switch(d){case 0:break;case 2:{L=(l-D.width)*.5;break}case 1:{L=l-D.width;break}}o.setTranslate(Math.round(L),Math.round(W)),p&&p!=="none"&&(o.setLineWidth(V),E.beginPath(),p=="overline"?(E.moveTo(0,-H),E.lineTo(F,-H)):p=="line-through"?(E.moveTo(0,-H/2),E.lineTo(F,-H/2)):p=="underline"&&(E.moveTo(0,0),E.lineTo(F,0)),E.closePath(),E.stroke()),E.fillText(z,0,0)}else{let N=[];for(let B=0;B<w.length;B+=1){let G="",Y=w[B];for(let X=0;X<Y.length;X+=1){let K=G+Y[X];E.measureText(K).width>l?(N.push(G),W+=k,G=Y[X]):G=K}N.push(G)}let U=N.length;for(let B=0;B<U;B+=1){switch(u){case 0:{W=-c+k+k*B;break}case 2:{W=-((c-k*U)*.5)-(U-1-B)*k;break}case 1:{W=-k*(U-1-B);break}}let G=E.measureText(N[B]).width;switch(d){case 0:break;case 2:{L=(l-G)*.5;break}case 1:{L=l-G;break}}p&&p!=="none"&&(o.setLineWidth(V),E.beginPath(),p=="overline"?(E.moveTo(L,W-H),E.lineTo(L+G,W-H)):p=="line-through"?(E.moveTo(L,W-H*.5),E.lineTo(L+G,W-H*.5)):p=="underline"&&(E.moveTo(L,W),E.lineTo(L+G,W)),E.closePath(),E.stroke()),E.fillText(N[B],Math.round(L),Math.round(W))}}C?o.originRestore():o.restore()}function Frt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=iwe(e,t,r);l&&(Gg(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&Q1e(o,l),(n=l.highLightInfo)!=null&&n.ctx&&Q1e(l.highLightInfo.ctx,l,"groupId"))}function iwe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix3:s,sampling:a,scale:l}=e,c=o.get(t+14),h=i.getPtColorIndex(o.get(t+10),c);if(r!=="select"&&!ad(h,i.scene.colors))return;let u=o.get(t+1),d=o.get(t+2),p=o.get(t+3),m=o.get(t+4),g=o.get(t+5),y=o.get(t+6),b=o.get(t+7),P=o.get(t+8),T=o.get(t+9),I=o.get(t+11),C=o.get(t+12),E=r==="select"?null:n(c),O=new S(u,d).multiply3(s),_=new S(p,m).multiply3(s),x=new S(g,y).multiply3(s),v=new S(b,P).multiply3(s),D=i.getRenderLineWidth(a,T,l),w=i.getDashedArray(I,l,T),F=sJ[C];return{...e,groupId:c,highLightInfo:E,strokeColorIndex:h,endPoint1:O,endPoint2:_,control1:x,control2:v,stroke:D,dashedArray:w,lineCap:F}}function Q1e(o,t,e="none"){let{plane:r,dashedArray:i,lineCap:n,stroke:s,strokeColorIndex:a,groupId:l,endPoint1:c,endPoint2:h,control1:u,control2:d,highLightInfo:p,camera:m,material:g,renderMode:y}=t;switch(o.save(),e){case"none":{r.ptSetCustomizedColor(o,m,a,g,y,l);break}case"groupId":{r.setGroupHighLightColor(o,m,a,p.isForceHighLight);break}}let b=o.getContext();o.setLineWidth(s),o.setLineDash(i),n&&o.setLineCap(n),b.beginPath(),b.moveTo(c.x,c.y),b.bezierCurveTo(u.x,u.y,d.x,d.y,h.x,h.y),b.stroke(),o.restore()}function Vrt(o,t,e,r){if(!qm(r))return;let i=iwe(e,t,r,"select");Q1e(o,i,"select")}var nwe=(o=>(o[o.ID=0]="ID",o[o.LEFT_POINT_X=1]="LEFT_POINT_X",o[o.LEFT_POINT_Y=2]="LEFT_POINT_Y",o[o.WIDTH=3]="WIDTH",o[o.HEIGHT=4]="HEIGHT",o[o.ANGLE=5]="ANGLE",o[o.ORDER=6]="ORDER",o[o.SHADOW_COLOR_INDEX=7]="SHADOW_COLOR_INDEX",o[o.SHADOW_BLUR=8]="SHADOW_BLUR",o[o.GROUP_ID=9]="GROUP_ID",o))(nwe||{}),Grt=10,EC=[],Urt=class extends Up{create(o,t,e,r,i,n,s,a,l=-1){return EC[0]=o+(20<<Js)+cs,EC[1]=t.x,EC[2]=t.y,EC[3]=e,EC[4]=r,EC[5]=i,EC[6]=a||0,EC[7]=n||0,EC[8]=s||0,EC[9]=l,EC}getBBox(o,t){let e=new S(o[t+1],o[t+2]),r=o[t+3],i=o[t+4],n=o[t+5];if(n===0)return Xa.modify(e.x,e.x+r,e.y-i,e.y);let s=El(0,0,n),a=El(0,-i,n),l=El(r,0,n),c=El(r,-i,n),h=e.add1(s.x,s.y),u=e.add1(a.x,a.y),d=e.add1(l.x,l.y),p=e.add1(c.x,c.y);return Xa.modify(Math.min(h.x,u.x,d.x,p.x),Math.max(h.x,u.x,d.x,p.x),Math.min(h.y,u.y,d.y,p.y),Math.max(h.y,u.y,d.y,p.y))}},Hrt=new Urt(20,Grt,nwe);function Wrt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=zrt(e,t,r);l&&(Gg(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&Hve(o,l),(n=l.highLightInfo)!=null&&n.ctx&&Hve(l.highLightInfo.ctx,l,"groupId"))}function zrt(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,pxLength:a,scale:l}=e,c=o.get(t+9),h=i.getPtColorIndex(o.get(t+7),c);if(!ad(h,i.scene.colors))return null;let u=o.get(t+8),d=e.highLightColorIndex,p=r==="select"?null:n(c),m=Math.max(o.get(t+3),a),g=Math.max(o.get(t+4),a),y=o.get(t+5),b=ih.isDoubleRgb(c,i.scene.ptGroup.getData()),P=new S(o.get(t+1),o.get(t+2)).multiply4(s);return{...e,highLightInfo:p,shadowColorIndex:h,shadowBlur:u,groupIdIndex:c,leftUpPoint:P,width:m*l,height:g*l,isDoubleRgb:b,angle:y,highLightColorIndex:d}}function Hve(o,t,e="none"){let{plane:r,shadowColorIndex:i,leftUpPoint:n,height:s,width:a,isDoubleRgb:l,shadowBlur:c,angle:h,isMirrored:u}=t,d=o.getContext();o.save(),o.setStrokeStyle(ee.BLACK.toCSS());let p=-a,m=-s;o.setTranslate(p,m),o.setScale(u?-1:1,1),o.setRotate(-h);let g=n.rotate(new S(p,m),-h);g=n.add1(-p,-m),r.setRenderRectShadowInfo(o,c,i,g.x,g.y,l),d.beginPath(),d.moveTo(0,0),d.lineTo(a,0),d.lineTo(a,s),d.lineTo(0,s),d.closePath(),d.stroke(),o.restore()}var H0=class{static init(o){let t=!1;try{Lye.value.location.search}catch{t=!0}t||(this.url=new URLSearchParams(o.location.search),this._useProxy=this.url.has("useProxy"),this._useCpuEngine=this.url.has("cpuEngine"),this._useGpuEngine=this.url.has("gpuEngine"),this._minRenderGridWH=Number(this.url.get("minRenderGridWH"))||0,this._enableLog=this.url.has("enableLog"),this._infiniteScaling=this.url.has("infiniteScaling"),this._isContinuedRender=this.url.has("isContinuedRender"))}static useProxy(){return this._useProxy}static useCpuEngine(){return this._useCpuEngine}static useGpuEngine(){return this._useGpuEngine}static getMinRenderGridWH(){return this._minRenderGridWH}static isEnableLog(){return this._enableLog}static getInfiniteScaling(){return this._infiniteScaling}static isContinuedRender(){return this._isContinuedRender}};H0.url=null,H0._useProxy=!1,H0._useCpuEngine=!1,H0._useGpuEngine=!1,H0._minRenderGridWH=0,H0._enableLog=!1,H0._infiniteScaling=!1,H0._isContinuedRender=!1;var q1=class extends H0{static init(o){super.init(o),this.url&&(this._logFps=this.url.has("logFps"),this._forceRender=this.url.has("render"),this._textureSize=Number(this.url.get("textureSize"))||0,this._macNoOnSubmittedWorkDone=this.url.has("macNoOnSubmittedWorkDone"),this._closeGridMulAcc=this.url.has("closeGridMulAcc"),this._closeGirdRender=this.url.has("closeGridRender"))}static macNoOnSubmittedWorkDone(){return this._macNoOnSubmittedWorkDone}static useLogFps(){return this._logFps}static useForceRender(){return this._forceRender}static getTextureSize(){return this._textureSize}static isCloseGridMulAcc(){return this._closeGridMulAcc}static isCloseGridRender(){return this._closeGirdRender}};q1._logFps=!1,q1._forceRender=!1,q1._textureSize=0,q1._macNoOnSubmittedWorkDone=!1,q1._closeGridMulAcc=!1,q1._closeGirdRender=!1;var SH=class extends H0{static init(o){super.init(o),this.url&&this.url.get("alpha")&&(this._alpha=Number(this.url.get("alpha")))}static getAlpha(){return this._alpha}};SH._alpha=void 0;var Yrt=GT*3,owe=(o=>(o[o.ID=0]="ID",o[o.POSITION_X=1]="POSITION_X",o[o.POSITION_Y=2]="POSITION_Y",o[o.WIDTH=3]="WIDTH",o[o.HEIGHT=4]="HEIGHT",o[o.ANGLE=5]="ANGLE",o[o.STRING_LENGTH=6]="STRING_LENGTH",o[o.STRING_INDEX=7]="STRING_INDEX",o[o.GROUP_ID=8]="GROUP_ID",o[o.COLOR_INDEX=9]="COLOR_INDEX",o[o.ORDER=10]="ORDER",o[o.WIDTH_OFFSET_RATIO=11]="WIDTH_OFFSET_RATIO",o[o.HEIGHT_OFFSET_RATIO=12]="HEIGHT_OFFSET_RATIO",o))(owe||{}),jrt=13,X2=[],Xrt=class extends Up{create(o,t,e,r,i,n,s,a=-1,l,c,h,u){return X2[0]=o+(66<<Js)+cs,X2[1]=t.x,X2[2]=t.y,X2[3]=e,X2[4]=r,X2[5]=(i%Zs+Zs)%Zs,X2[6]=n,X2[7]=s,X2[8]=a,X2[9]=l||0,X2[10]=c||0,X2[11]=h||0,X2[12]=u||0,X2}getBBox(o,t){let e=o[t+1],r=o[t+2],i=o[t+5],n=o[t+3]/2,s=o[t+4]/2,a=o[t+11],l=o[t+12];if(e+=a*n*2,r+=l*s*2,i===0||i===Math.PI)return Xa.modify(e-n,e+n,r-s,r+s);if(i===GT||i===Yrt)return Xa.modify(e-s,e+s,r-n,r+n);let c=El(n,-s,i),h=El(n,s,i),u=El(-n,-s,i),d=El(-n,s,i),p={x:e+d.x,y:r+d.y},m={x:e+u.x,y:r+u.y},g={x:e+h.x,y:r+h.y},y={x:e+c.x,y:r+c.y};return Xa.modify(Math.min(p.x,m.x,g.x,y.x),Math.max(p.x,m.x,g.x,y.x),Math.min(p.y,m.y,g.y,y.y),Math.max(p.y,m.y,g.y,y.y))}},swe=new Xrt(66,jrt,owe);function qrt(o,t,e,r){var i;let{plane:n}=r,s=awe(e,t,r);s&&(n.getSceneGlobalHighLightType()==1&&(i=s.highLightInfo)!=null&&i.ctx?eye(s.highLightInfo.ctx,s,"groupId"):eye(o,s))}function awe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,highLightColorIndex:a}=e,l=o.get(t+8),c=i.getPtColorIndex(o.get(t+9),l);if(r!=="select"&&!ad(c,i.scene.colors))return;let h=new S(o.get(t+1),o.get(t+2)).multiply4(s),u=i.scene.stringInfos[o.get(t+7)],d=o.get(t+5),p=o.get(t+3),m=o.get(t+4),g=r==="select"?null:n(l),y=ih.isDoubleRgb(l,i.scene.ptGroup.getData()),b=p*o.get(t+11),P=m*o.get(t+12);return{...e,colorIndex:c,groupIdIndex:l,point:h,text:u,angle:d,height:m,isDoubleRgb:y,highLightInfo:g,highLightColorIndex:a,widthOffset:b,heightOffset:P}}function eye(o,t,e="none"){let{plane:r,colorIndex:i,point:n,text:s,angle:a,height:l,samplingPxLength:c,sampling:h,isDoubleRgb:u,highLightColorIndex:d,highLightInfo:p,widthOffset:m,heightOffset:g,camera:y}=t;o.save();let b=o.getContext();switch(e){case"none":{o.setFillStyle(r.getNetStringColor(i,u,!1,y));break}case"groupId":{r.setGroupHighLightStringColor(o,i,p.isForceHighLight,y);break}case"select":{r.highLightPtSetCustomizedColor(o,d,i,10);break}}o.setTranslate(n.x,n.y),o.setRotate(-a),o.setTextAlign("center"),o.setTextBaseLine("middle");let P=l/c;o.setFont(`normal ${P}px ${Z7}`),b.fillText(s,m/c,-g/c),o.restore()}function $rt(o,t,e,r){if(!qm(r))return;let i=awe(e,t,r,"select");eye(o,i,"select")}var N4t=GT*3,p2e=(o=>(o[o.ID=0]="ID",o[o.POSITION_X=1]="POSITION_X",o[o.POSITION_Y=2]="POSITION_Y",o[o.ANGLE=3]="ANGLE",o[o.ORDER=4]="ORDER",o[o.GROUP_ID=5]="GROUP_ID",o))(p2e||{}),lwe=6,T9=[],cwe=class extends Up{create(o,t,e,r,i=-1){return T9[1]=t.x,T9[2]=t.y,T9[3]=e,T9[4]=r||0,T9[5]=i,T9}getBBox(o,t,e,r){let i=r[1],n=i+r[3],s=r[2],a=r[4]/2,l=s/2,c=o[t+1],h=o[t+2],u=o[t+3];if(u===0)return Xa.modify(c,c+n,h-l,h+l);let d=El(0,0,u),p=El(i,l,u),m=El(i,-l,u),g=El(n,a,u),y=El(n,-a,u),b={x:c+d.x,y:h+d.y},P={x:c+p.x,y:h+p.y},T={x:c+m.x,y:h+m.y},I={x:c+g.x,y:h+g.y},C={x:c+y.x,y:h+y.y};return Xa.modify(Math.min(b.x,P.x,T.x,I.x,C.x),Math.max(b.x,P.x,T.x,I.x,C.x),Math.min(b.y,P.y,T.y,I.y,C.y),Math.max(b.y,P.y,T.y,I.y,C.y))}},Krt=class extends cwe{create(o,t,e,r,i=-1){return super.create(o,t,e,r,i),T9[0]=o+(67<<Js)+cs,T9}},Zrt=class extends cwe{create(o,t,e,r,i=-1){return super.create(o,t,e,r,i),T9[0]=o+(68<<Js)+cs,T9}},hwe=new Krt(67,lwe,p2e),uwe=new Zrt(68,lwe,p2e);function Jrt(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=dwe(e,t,r);l&&(Gg(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&tye(o,l),(n=l.highLightInfo)!=null&&n.ctx&&tye(l.highLightInfo.ctx,l,"groupId"))}function dwe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,highLightColorIndex:a,pxLength:l,scale:c}=e,h=o.get(t+5),u=i.getFixedPtData(),d=i.getPtColorIndex(u[0],h);if(r!=="select"&&!ad(d,i.scene.colors))return;let p=new S(o.get(t+1),o.get(t+2)).multiply4(s),m=o.get(t+3),g=Math.max(u[1],l),y=Math.max(u[2],l),b=Math.max(u[3],l),P=Math.max(u[4],l),T=r==="select"?null:n(h),I=ih.isDoubleRgb(h,i.scene.ptGroup.getData());return{...e,colorIndex:d,groupIdIndex:h,point:p,angle:m,isDoubleRgb:I,highLightInfo:T,highLightColorIndex:a,arrowWidth:g*c,arrowHeight:y*c,arrowLineLength:b*c,arrowLineWidth:P*c}}function tye(o,t,e="none"){let{plane:r,colorIndex:i,point:n,angle:s,isDoubleRgb:a,highLightColorIndex:l,highLightInfo:c,arrowWidth:h,arrowHeight:u,arrowLineLength:d,arrowLineWidth:p,camera:m}=t;o.save();let g=o.getContext();switch(e){case"none":{o.setFillStyle(r.getNetStringColor(i,a,!1,m));break}case"groupId":{r.setGroupHighLightStringColor(o,i,c.isForceHighLight,m);break}case"select":{r.highLightPtSetCustomizedColor(o,l,i,10);break}}o.setTranslate(n.x,n.y),o.setRotate(-s),g.beginPath(),g.moveTo(0,0),g.lineTo(h,-u/2),g.lineTo(h,u/2),g.moveTo(h,-p/2),g.lineTo(h+d,-p/2),g.lineTo(h+d,p/2),g.lineTo(h,p/2),g.closePath(),g.fill(),o.restore()}function Qrt(o,t,e,r){if(!qm(r))return;let i=dwe(e,t,r,"select");tye(o,i,"select")}function eit(o,t,e,r){var i,n;let{onlyRenderHighLightPt:s,globalHighLightType:a}=r,l=pwe(e,t,r);l&&(Gg(s,(i=l.highLightInfo)==null?void 0:i.isForceHighLight,a)&&rye(o,l),(n=l.highLightInfo)!=null&&n.ctx&&rye(l.highLightInfo.ctx,l,"groupId"))}function pwe(o,t,e,r="none"){let{plane:i,getHighLightDrawInfo:n,renderMatrix:s,highLightColorIndex:a,pxLength:l,scale:c}=e,h=o.get(t+5),u=i.getFixedPtData(),d=i.getPtColorIndex(u[0],h);if(r!=="select"&&!ad(d,i.scene.colors))return;let p=new S(o.get(t+1),o.get(t+2)).multiply4(s),m=o.get(t+3),g=u[5],y=u[1],b=u[2],P=u[3],T=g/b,I=Math.max(Math.min(y*c,y*T),1),C=Math.max(Math.min(b*c,b*T),1),E=Math.max(Math.min(P*c,P*T),1),O=1,_=r==="select"?null:n(h),x=ih.isDoubleRgb(h,i.scene.ptGroup.getData());return{...e,colorIndex:d,groupIdIndex:h,point:p,angle:m,isDoubleRgb:x,highLightInfo:_,highLightColorIndex:a,arrowWidth:I,arrowHeight:C,arrowLineLength:E,arrowLineWidth:O}}function rye(o,t,e="none"){let{plane:r,colorIndex:i,point:n,angle:s,isDoubleRgb:a,highLightColorIndex:l,highLightInfo:c,arrowWidth:h,arrowHeight:u,arrowLineLength:d,arrowLineWidth:p,camera:m}=t;o.save();let g=o.getContext();switch(e){case"none":{o.setFillStyle(r.getNetStringColor(i,a,!1,m));break}case"groupId":{r.setGroupHighLightStringColor(o,i,c.isForceHighLight,m);break}case"select":{r.highLightPtSetCustomizedColor(o,l,i,10);break}}o.setTranslate(n.x,n.y),o.setRotate(-s),g.beginPath(),g.moveTo(0,0),g.lineTo(h,-u/2),g.lineTo(h,u/2),g.moveTo(h,-p/2),g.lineTo(h+d,-p/2),g.lineTo(h+d,p/2),g.lineTo(h,p/2),g.closePath(),g.fill(),o.restore()}function tit(o,t,e,r){if(!qm(r))return;let i=pwe(e,t,r,"select");rye(o,i,"select")}var f2e=class{constructor(o,t,e){this.outMatrixParamMap=new Map,o&&(this.color=o),t&&(this.material=t),e&&(this.label=e)}getMaterial(){return this.material}setMaterial(o){this.material=o}getColor(){return this.color}setColor(o){this.color=o}updateMatrix(o){for(let t of o.entries())this.outMatrixParamMap.has(t[0])?(this.outMatrixParamMap.set(t[1],this.outMatrixParamMap.get(t[0])),this.outMatrixParamMap.delete(t[0])):this.outMatrixParamMap.set(t[1],{visible:!0,color:ee.BLACK})}markDrawn(o,t){this.outMatrixParamMap.get(o).renderI=t}hadDrawn(o,t){return this.outMatrixParamMap.get(o).renderI===t}removeOutMatrixs(o){for(let t of o)this.outMatrixParamMap.delete(t);this.outMatrixParamMap.size===0&&this.clear()}setOutMatrixVisible(o,t){this.outMatrixParamMap.get(t).visible=o}setSingleColor(o,t){this.outMatrixParamMap.get(t).color=o}getSingleColor(o){return this.outMatrixParamMap.get(o).color}},E_=2*Math.PI,rit=.75;function Wve(o,t){let e=t[2],r=t[6];return e/r>o}var VK={0(o,t,e,r,i){let n={...r,highLightColorIndex:i};lrt(o,t,e,n)},1(o,t,e,r,i){let n={...r,highLightColorIndex:i};rrt(o,t,e,n)},16(o,t,e,r,i){let n={...r,highLightColorIndex:i};wtt(o,t,e,n)},17(o,t,e,r,i){let n={...r,highLightColorIndex:i};Vrt(o,t,e,n)},19(o,t,e,r,i){let n={...r,highLightColorIndex:i};hrt(o,t,e,n)},2(o,t,e,r,i,n=!1){o.save();let s={...r,highLightColorIndex:i,isNobodyRect:n};yrt(o,t,e,s),o.restore()},5(o,t,e,r,i){o.save();let n={...r,highLightColorIndex:i};drt(o,t,e,n),o.restore()},15(o,t,e,r,i){let n={...r,highLightColorIndex:i};Ftt(o,t,e,n)},3(o,t,e,r,i){let n={...r,highLightColorIndex:i};Prt(o,t,e,n)},4(o,t,e,r,i){let n={...r,highLightColorIndex:i};Irt(o,t,e,n)},6(o,t,e,r){ztt(o,t,{...e,highLightColorIndex:r})},7(o,t,e,r){Ktt(o,t,{...e,highLightColorIndex:r})},8(o,t,e,r,i){Jtt(o,t,{...e,staticPolygonInfoBuilder:r,highLightColorIndex:i})},9(o,t,e,r,i){ert(o,t,{...e,staticPolygonInfoBuilder:r,highLightColorIndex:i})},10(o,t,e,r,i){let n={...r,highLightColorIndex:i};frt(o,t,e,n)},66(o,t,e,r,i){let n={...r,highLightColorIndex:i};$rt(o,t,e,n)},67(o,t,e,r,i){let n={...r,highLightColorIndex:i};Qrt(o,t,e,n)},68(o,t,e,r,i){let n={...r,highLightColorIndex:i};tit(o,t,e,n)}},yw=class extends f2e{constructor(o,t,e,r=!0,i=!0,n=!1,s=!1,a=!1){i||(r=!1),super(t,void 0,e),this.ignoreForceHighLightEffect=s,this.textures=[],this.bboxFac2=new _e,this.ptNum=0,this.ptTypeNum=Array(69).fill(0),this.id=1,this.isColorful=!1,this.visible=!0,this._highLightPtByIdNum=0,this.networkTextColor=ee.WHITE,this.polygonColorAlphaRatio=1,this.alphaOverlay=1,this.schNetworkHighLightStatus=!1,this.isUnderGrid=!1,this.interPlanes=[this],this.deactivateAlphaRatio=1,this.setNoBodyRectColor=(l,c,h,u,d,p,m=null,g=this.scene.getRenderMode())=>{let y=p!==void 0?p:ih.isDoubleRgb(d,this.scene.ptGroup.getData()),{noSetCustomizedColor:b,color:P}=this.getCustomizedColor(u,y,void 0,c,!1,m,g);b&&(P=this.scene.highLightColor[h]),P=P.mulAlpha(.5);let T=P.toCSS();l.setFillStyle(T),l.setStrokeStyle(T)},this.subPlanes=[],this.transparentObjs=[],this.renderTexture=!0,this.renderOther=!0,this.parts=[{matrix:Qe.ORIGIN,plane:this}],this.alwaysUpdateBBox=!0,this.dictOutMatrixRenderCfg={},this.originalColor=t,this.scene=o,this.isNormal=r,this.label=e,this.isUnderGrid=a,this.underGridError(),this.builder=new Ket(o,this),this.panelize=i,this.isHighLight=n,!r&&!n?o.hardRenderPlane.push(this):(n||(this.levelTextureManager=o.levelTextureManager,o.normalPlanes.push(this)),this.highLightTextureManager=o.highLightLevelTextureManager)}set highLightPtByIdNum(o){this._highLightPtByIdNum=o}get highLightPtByIdNum(){return this._highLightPtByIdNum}setIsColorful(o){this.isColorful!=o&&(this.isColorful=o)}getPtBBox(o,t=0,e=this.scene.staticPolygonInfoBuilder,r=this.scene.getFixedPtData()){return Fr.getBBox(o,t,e,r)}underGridError(){if(this.isUnderGrid&&this.isNormal)throw new Error("Under grid plane is normal")}setNetworkHighLightStatus(o){o!=this.schNetworkHighLightStatus&&(this.schNetworkHighLightStatus=o,this.scene.clearAccelerateTexture(),this.scene.needRender=!0)}setNetworkTextColor(o){this.networkTextColor!=o&&(this.networkTextColor=o)}setPolygonColorAlphaRatio(o){this.polygonColorAlphaRatio!=o&&(this.polygonColorAlphaRatio=o)}setAlphaOverlay(o){this.alphaOverlay!=o&&(this.alphaOverlay=o,this.setColor(ee.of6(this.color,this.color.alpha*o)))}getPtNum(){return this.ptNum||0}getPtTypeNum(){return this.ptTypeNum}getHighLightPtNumById(){return this.highLightPtByIdNum}getDashedArray(o,t,e){let r=[];return o==-1||(r=Array.from(this.scene.dashedInfoBuilder.slice(o+1,this.scene.dashedInfoBuilder.get(o)+o+1)),this.isSchOnePxStatus(e))||(r=r.map(i=>i*t)),r}getStringColor(){return ee.of6(this.networkTextColor,this.networkTextColor.alpha+.1)}getPtColorIndex(o,t){if(YE(o))return o;let e=ih.getColorIndex(t,this.scene.ptGroup.getData());return YE(e)?e:o}ptSetCustomizedColor(o,t,e,r,i,n,s,a=!1){let l=this.scene.ptGroup.getData(),c=s!==void 0?s:ih.isDoubleRgb(n,l),h=ih.isForceHighLight(n,l),{style:u,noSetCustomizedColor:d}=this.getCustomizedColor(e,c,h,t,a,r,i);d||u&&(o.setFillStyle(u),o.setStrokeStyle(u))}setGroupHighLightColor(o,t,e,r,i=!1){let n=this.getGroupHighLightColor(e,r,t,i);n&&(o.setFillStyle(n),o.setStrokeStyle(n))}getGroupHighLightColor(o,t,e,r=!1,i=null,n=this.scene.getRenderMode()){if(this.scene.getGlobalHighLightType()===0||!t)return;let{style:s}=this.getCustomizedColor(o,!1,t,e,r,i,n);return s}setGroupHighLightStringColor(o,t,e,r){if(this.scene.getGlobalHighLightType()===0||!e)return;let i=this.getNetStringColor(t,!1,!!e,r);i&&(o.setFillStyle(i),o.setStrokeStyle(i))}setRenderShadowInfo(o,t,e,r=0,i=0){if(e===0||!t)return;o.setShadowBlur(t);let n=YE(e);o.setShadowColor(this.scene.colors[n].toCSS()),o.setShadowOffsetX(r),o.setShadowOffsetY(i)}setRenderRectShadowInfo(o,t,e,r=0,i=0,n){if(e===0||!t)return;let s=YE(e),a;EH.includes(this.scene.getSceneType())&&!n&&this.schNetworkHighLightStatus&&(a=this.getSchPtColor(s)),o.setShadowBlur(t),o.setShadowColor(a.toCSS()),o.setShadowOffsetX(r),o.setShadowOffsetY(i)}highLightPtSetCustomizedColor(o,t,e,r,i){let n=0;if(!t&&t!==0?n=1:n=vw(t),!this.scene.getForceVisibleHighLightPt()&&!this.isColorful&&n&&r!==10){let l=this.color.toCSS();o.setFillStyle(l),o.setStrokeStyle(l);return}let s;if(n)if(r==10&&e==0)s=this.getStringColor();else{let l=YE(e);s=this.getPtColor(l,!0,i)}else{let l=YE(t);if(l==0||(s=this.scene.colors[l],s.r+s.g+s.b===0))return}let a=s.toCSS();o.setFillStyle(a),o.setStrokeStyle(a)}getSemicirclePtHighLightFillStyle(o,t){let e=YE(o);return this.getPtColor(e,t).toCSS()}getOrInitId(){return 1}createOrUpdatePt(o,t){return t!=null&&t>=0?this.updatePt(t,o):t=this.addPt(o),t}createOrUpdateCircle(o,t,e,r,i,n,s){return this.createOrUpdatePt(u2e.create(this.getOrInitId(),t,e,i,this.scene.getColorIndex(r),n,s),o)}createOrUpdatePoint(o,t,e,r,i,n,s){return this.createOrUpdatePt(Bye.create(this.getOrInitId(),t,e,r,this.scene.getColorIndex(i),n,s),o)}createOrUpdateLine(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.scene.getColorIndex(c),m=this.scene.addDashedInfo(l);return this.createOrUpdatePt(BDe.create(this.getOrInitId(),t,e,r,i,s,this.scene.getColorIndex(n),a,m,p,h,u,d),o)}createOrUpdateRectShadowFrame(o,t,e,r,i,n,s,a,l){return this.createOrUpdatePt(Hrt.create(this.id,t,e,r,i,this.scene.getColorIndex(n),s,a,l),o)}createOrUpdateRect(o,t,e,r,i,n=0,s,a,l,c){return this.createOrUpdatePt(gDe.create(this.id,t,e,r,i,n,a,this.scene.getColorIndex(s),l,c),o)}createRect(o,t,e,r,i,n){this.createOrUpdateRect(-1,o.leftUpPoint,o.width,o.height,Ih.toRadians(o.angle),o.radius,t,e,r,i)}createOrUpdateDrcArrow(o,t,e,r,i){return this.createOrUpdatePt(this.scene.drcRenderModel===1?hwe.create(this.id,t,e,r,i):uwe.create(this.id,t,e,r,i),o)}addHighLightPt(o,t,e,r=0){var i;let n=this.scene.getColorIndex(e,r),s=this.builder.addHighLightPt(o,t,n);(i=this.highLightTextureManager)==null||i.update(this.getPtBBox(s)),this.highLightPtByIdNum++}removeHighLightPt(o,t,e,r=0){var i;let n=this.scene.getColorIndex(e,r),{pt:s,num:a}=this.builder.removeHighLightPt(o,t,n);(i=this.highLightTextureManager)==null||i.update(this.getPtBBox(s)),this.highLightPtByIdNum-=a}setHighLightPtNum(o,t,e,r,i=0){let n=this.scene.getColorIndex(r,i),s=this.builder.setHighLightPtNum(o,t,e,n);this.scene.highLightLevelTextureManager.update(this.getPtBBox(s)),this.highLightPtByIdNum+=e}addHighLightPts(o,t,e,r=0){switch(o[0]){case 1:for(let i=1;i<o.length;i++)this.addHighLightPt(o[i],t,e,r);break;case 0:for(let i=2;i<o.length;i++)this.addHighLightPt(o[i],t,e,r);break;default:throw new Error("addHighLightPts not support")}}removeHighLightPts(o,t,e,r=0){switch(o[0]){case 1:for(let i=1;i<o.length;i++)this.removeHighLightPt(o[i],t,e,r);break;case 0:for(let i=2;i<o.length;i++)this.removeHighLightPt(o[i],t,e,r);break;default:throw new Error("removeHighLightPts not support")}}setHighLightPtsNum(o,t,e,r,i=0){switch(o[0]){case 1:for(let n=1;n<o.length;n++)this.setHighLightPtNum(o[n],t,e,r,i);break;case 0:for(let n=2;n<o.length;n++)this.setHighLightPtNum(o[n],t,e,r,i);break;default:throw new Error("setHighLightPtsNum not support")}}createOrUpdateLineSegment(o,t,e,r,i,n,s,a,l){return this.createOrUpdatePt(Vye.create(this.getOrInitId(),t,e,r,i,n,a,this.scene.getColorIndex(s),l),o)}createOrUpdateArc(o,t,e,r,i,n,s,a,l,c,h){e<GZ&&(e=GZ),n<0&&(i+=n,n=-n),i%=E_,i<0&&(i+=E_);let u=this.scene.addDashedInfo(h);return this.createOrUpdatePt(dDe.create(this.getOrInitId(),t,e,r,i,n,a,this.scene.getColorIndex(s),l,u,c),o)}createOrUpdateEllipse(o,t,e,r,i,n,s,a,l,c,h="round",u,d=0,p,m){let g=this.scene.addDashedInfo(c),y=$7[h],b=this.scene.getColorIndex(l),P=this.scene.getColorIndex(u);return this.createOrUpdatePt(rJ.create(this.id,t,e,r,i,n,s,a,b,g,y,P,d,p,m),o)}createOrUpdateBezier(o,t,e,r,i,n,s,a,l="round",c,h){let u=this.scene.addDashedInfo(a),d=$7[l],p=this.scene.getColorIndex(s);return this.createOrUpdatePt(e2e.create(this.id,t,e,r,i,n,p,u,d,c,h),o)}createOrUpdateSemicircle(o,t,e,r,i,n,s){return this.createOrUpdatePt(Wye.create(this.getOrInitId(),t,e,this.scene.getColorIndex(r),this.scene.getColorIndex(i),n,s),o)}createWireFramePts(o,t,e,r,i,n,s){o.forEach(a=>{if(a instanceof q){let l=Ih.toRadians(a.sweepAngle),c=Ih.toRadians(a.startAngle);l<0&&(c=c+l,l=-l),c%=E_,c<0&&(c+=E_),e.push(this.addPt($ye.create(t,a.center,a.rx,c,l,r,i,s)))}else if(a instanceof Dr){let l=a.points(.1);for(let c=0;c<l.length-1;c+=1)e.push(this.addPt(IH.create(t,l[c],l[c+1],r,i,s)))}else a instanceof M?e.push(this.addPt(IH.create(t,a.start(),a.end(),r,i,s))):console.error("Not Support Primitive Type")})}createStaticWireFramePts(o,t,e,r,i,n){o.forEach(s=>{if(s instanceof q){let a=Ih.toRadians(s.sweepAngle),l=Ih.toRadians(s.startAngle);a<0&&(l=l+a,a=-a),l%=E_,l<0&&(l+=E_),e.push(this.addPt(Jye.create(t,s.center,s.rx,l,a,r),n))}else if(s instanceof Dr){let a=s.points(.1);for(let l=0;l<a.length-1;l+=1)e.push(this.addPt(CH.create(t,a[l],a[l+1],r),n))}else s instanceof M?e.push(this.addPt(CH.create(t,s.start(),s.end(),r),n)):console.error("Not Support Primitive Type")})}createPolygon0(o,t,e,r,i,n,s=null,a,l,c,h=.1){var u,d;this.scene.addPolygonGroupId(l);let p=[],m=this.scene.getColorIndex(e);for(let g of t){if(!((u=g.primitives)!=null&&u.length))continue;o[0]===1?n(g.primitives,this.id,o,a,m,null,l):n(g.primitives,this.id,o,o[1],null,s);let y=[],b,P,T,I,C,E=(d=g.primitives)==null?void 0:d[g.primitives.length-1].end(),O=()=>{if(b){if(I>0)for(let D=0;D<I;D+=360)o.push(this.addPt(r(this.id,b,P,Ih.toRadians(T+D),Ih.toRadians(Math.min(I-D,360)),C,E,a,m,l),s));else for(let D=0;D>I;D-=360)o.push(this.addPt(r(this.id,b,P,Ih.toRadians(T+D),Ih.toRadians(Math.max(I-D,-360)),C,E,a,m,l),s));C.equals(E)||y.push(new M(C,E)),b=null}};if(g.primitives.forEach((D,w)=>{if(D instanceof q&&D.rx===D.ry){if(b){if(P===D.rx&&b.equals(D.center)&&V_.eq(Ih.regularD(T+I),Ih.regularD(D.startAngle))){I+=D.sweepAngle,E=D.end();return}O()}b=D.center,P=D.rx,T=D.startAngle,I=D.sweepAngle,D.start().equals(E)||y.push(new M(E,D.start())),C=D.start()}else O(),D.start().equals(E)||y.push(new M(E,D.start())),y.push(D);E=D.end()}),O(),y.length===0)continue;let _=[];for(ge.build2(y).points(h,D=>_.push(D));_.length!==0&&_[0].equals(_[_.length-1]);)_.pop();if(_.length<3)continue;let x=_[0],v=[x];for(let D=1;D<_.length;D++){let w=_[D];x.equals(w)||(v.push(w),x=w)}v.length>=3&&p.push(v)}for(let g of p){let y=g.slice();for(let b=0;b<y.length-2;b+=2)o.push(this.addPt(i(this.id,y[b],y[b+1],y[b+2],a,m,l),s)),y.push(y[b])}return o}createPolygon(o,t,e,r,i,n=.1){return this.createPolygon0([1],o,t,(s,a,l,c,h,u,d,p,m)=>l2e.create(s,a,l,c,h,u,d,p,m,r,i),(s,a,l,c,h,u)=>o2e.create(s,a,l,c,h,u,r,i),this.createWireFramePts.bind(this),null,e,r,n)}createStaticPolygon(o,t,e,r,i,n,s,a){let l=this.scene.addStaticPolygonInfo(e,t,r,i);return this.createPolygon0([0,l],o,t,(c,h,u,d,p,m,g)=>NH.create(c,h,u,d,p,m,g,l,n),(c,h,u,d)=>MH.create(c,h,u,d,l,n),this.createStaticWireFramePts.bind(this),this.scene.staticPolygonInfoBuilder,e,r,s,a)}createStringPt(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.scene.getColorIndex(a),p=this.scene.addStringInfo(o),{strWidth:m,strHeight:g}=F_.getStrInfo(o,n,s);return J7.create(this.getOrInitId(),t,m,g,e,o.length,p,r,i,l,d,c,h,u)}createScaleStringPt(o,t,e,r,i,n,s,a,l,c){let h=this.scene.getColorIndex(n),u=this.scene.addStringInfo(o),{strWidth:d,strHeight:p}=F_.getStrInfo(o,r,i);return swe.create(this.getOrInitId(),t,d,p,e,o.length,u,s,h,a,l,c)}createTextPt(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m){let g=this.scene.getColorIndex(n);i["font-family"]=det.getInstance().getApplyFontFamily(i["font-family"],this.scene.getTextFontFamilyCorrectionEnabled());let y=this.scene.addTextInfo(o,i),b=this.scene.getColorIndex(p);return rwe.create(this.getOrInitId(),y,r,t,e,g,s,a,l,c,h,u,d,b,m)}createOrUpdateNetWorkText(o,t,e,r,i,n,s,a,l,c,h,u,d){return this.createOrUpdatePt(this.createStringPt(t,e,r,i,n,s,a,l,h,c,u,d),o)}createOrUpdateScaleString(o,t,e,r,i,n,s,a,l,c,h){return this.createOrUpdatePt(this.createScaleStringPt(t,e,r,i,n,s,l,a,c,h),o)}createOrUpdateDrc(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.scene.getColorIndex(c),p=this.scene.addStringInfo(a),m=this.scene.addStringInfo(l);return this.createOrUpdatePt(Nye.create(this.id,t,n,s,e,r,i,p,m,u,d,h),o)}createOrUpdateNormalString(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I){let C=Qe.ORIGIN.translate(e.x,e.y).rotate(n).setOrigin(e.x,e.y).scale(a?-l:l,s?-c:c);return this.createOrUpdateNormalStringMatrix(o,t,r,i,C,h,u,d,p,m,g,y,b,P,T,I)}createOrUpdateNormalStringMatrix(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g){return this.createOrUpdatePt(this.createTextPt(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g),o)}createOrUpdateTexture(o,t,e,r,i,n,s,a,l,c,h){var u,d,p;if(o==null||o<0){let m=new Tw(n,e,t,i,r,a,l,c,h,this.scene);o=this.textures.findIndex(y=>!y),o===-1?(this.textures.push(m),o=this.textures.length-1):this.textures[o]=m;let g=m.getBBox();this.bboxFac2.ext5(g.minX,g.maxX,g.minY,g.maxY),this.isNormal&&((u=this.levelTextureManager)==null||u.update(g)),this.ptNum++,this.ptTypeNum[70]++}else{let m=this.textures[o],g=m.getBBox();this.isNormal&&((d=this.levelTextureManager)==null||d.update(g)),m.sycnStatus(n,e,t,i,r,a,l,c,h);let y=m.getBBox();this.bboxFac2.ext5(y.minX,y.maxX,y.minY,y.maxY),this.isNormal&&((p=this.levelTextureManager)==null||p.update(y))}return this.scene.needRender=!0,o}isRender(){return this.scene.getHasGroupForceHighLight()&&this.scene.getForceVisibleHighLightPt()&&!this.ignoreForceHighLightEffect?!0:this.visible}isVisible(){return this.visible}isHiddenGroupPt(o,t,e){let r=Fr.getGroupIdByBuilder(o,t,e);if(r==-1)return!1;let i=this.scene.ptGroup.getData();if(ih.isHidden(r,i))return!0;let n=ih.isForceHighLight(r,this.scene.ptGroup.getData());return!this.visible&&!n?!0:(!this.visible&&n&&(!this.scene.getForceVisibleHighLightPt()||this.ignoreForceHighLightEffect),!1)}setVisible(o){o!==void 0&&o!==this.visible&&this.scene.setStateInfo("plane_visible_"+this.label,o,this.isNormal),this.visible=o,this.scene.needRender=!0}clear(){this.ptNum=0,this.ptTypeNum=Array(69).fill(0),this.bboxFac2.clear(),this.builder.clear()}getArcSweepAngle(o,t,e){return e===ae.CCW?t>o?t-o:t-o+E_:t<o?t-o:t-o-E_}createOrUpdateArcSegment(o,t,e,r,i,n,s,a,l){return this.createOrUpdateArc(o,t,e,0,r,this.getArcSweepAngle(r,i,n),s,a,l,"round",[])}setEmpty(){this.bboxFac2.clear()}isEmpty(){return this.parts.every(({plane:o})=>!o.bboxFac2.valid())}removeTexture(o){var t;this.isNormal&&((t=this.levelTextureManager)==null||t.update(this.textures[o].getBBox())),delete this.textures[o],--this.ptNum===0&&this.setEmpty(),this.ptTypeNum[70]--,this.scene.needRender=!0}removePt(o,t=this.scene.staticPolygonInfoBuilder){var e,r;let{oldPt:i,isHighLightPt:n}=this.builder.removePt(o);--this.ptNum===0&&this.setEmpty();let s=Fr.getType(i[0]);if(this.ptTypeNum[s]--,this.isUpdateAccelerateTexture(s)){let a=this.getPtBBox(i,0,t);(e=this.levelTextureManager)==null||e.update(a),n&&((r=this.highLightTextureManager)==null||r.update(a))}else if(this.isUpdateHighLightAccelerateTexture(s)){let a=this.getPtBBox(i,0,t);this.scene.highLightLevelTextureManager.update(a)}return{pt:i}}hiddenPt(o){var t;let{isUpdate:e,ptData:r}=this.builder.setPtVisible(o,!1);this.isNormal&&e&&((t=this.levelTextureManager)==null||t.update(this.getPtBBox(r)))}showPt(o){var t;let{isUpdate:e,ptData:r}=this.builder.setPtVisible(o,!0);this.isNormal&&e&&((t=this.levelTextureManager)==null||t.update(this.getPtBBox(r)))}removePoint(o){this.builder.removePt(o),--this.ptNum===0&&this.setEmpty(),this.ptTypeNum[5]--}hiddenPoint(o){this.builder.setPtVisible(o,!1)}showPoint(o){this.builder.setPtVisible(o,!0)}removePolygonPt(o){let t=this.scene.staticPolygonInfoBuilder,e;switch(o[0]){case 1:for(let i=1;i<o.length;i++){let{pt:n}=this.removePt(o[i],t);e===void 0&&(e=Fr.getGroupId(n,0,t))}break;case 0:let r=o[1];this.scene.removeStaticPolygonInfo(r);for(let i=2;i<o.length;i++){let{pt:n}=this.removePt(o[i],t);e===void 0&&(e=Fr.getGroupId(n,0,t))}break;default:throw new Error("ids error")}this.scene.removePolygonGroupId(e)}hiddenPolygonPt(o){switch(o[0]){case 1:for(let t=1;t<o.length;t++)this.hiddenPt(o[t]);break;case 0:for(let t=2;t<o.length;t++)this.hiddenPt(o[t]);break;default:throw new Error("ids error")}}showPolygonPt(o){switch(o[0]){case 1:for(let t=1;t<o.length;t++)this.showPt(o[t]);break;case 0:for(let t=2;t<o.length;t++)this.showPt(o[t]);break;default:throw new Error("ids error")}}setStaticPolygonInfo(o,t){let e=o[1],r=this.scene.staticPolygonInfoBuilder.copy();this.scene.setStaticPolygonInfo(e,t);let i=this.scene.staticPolygonInfoBuilder,n=s=>{var a,l;let c=this.builder.getPt(s);this.builder.updatePt(s,c,i);let h=this.getPtBBox(c,0,i);this.bboxFac2.ext5(h.minX,h.maxX,h.minY,h.maxY),this.isNormal&&((a=this.levelTextureManager)==null||a.update(h),(l=this.levelTextureManager)==null||l.update(this.getPtBBox(c,0,r)))};for(let s=2;s<o.length;s++)n(o[s])}updatePt(o,t){var e,r,i,n,s,a;let l=this.getPtBBox(t);this.bboxFac2.ext5(l.minX,l.maxX,l.minY,l.maxY);let{oldPt:c,isHighLightPt:h}=this.builder.updatePt(o,t,null),u=Fr.getType(c[0]);if(this.isUpdateAccelerateTexture(u)){(e=this.levelTextureManager)==null||e.update(l);let d;h&&((r=this.highLightTextureManager)==null||r.update(l),d=this.getPtBBox(c),(i=this.highLightTextureManager)==null||i.update(d)),(n=this.levelTextureManager)==null||n.update(d||this.getPtBBox(c))}else this.isUpdateHighLightAccelerateTexture(u)&&((s=this.highLightTextureManager)==null||s.update(l),(a=this.highLightTextureManager)==null||a.update(this.getPtBBox(c)))}setIsUnderGrid(o){this.isUnderGrid!=o&&(this.underGridError(),this.scene.setStateInfo("plane_isUnderGrid_"+this.label,o,this.isNormal),this.isUnderGrid=o,this.scene.needRender=!0)}getIsUnderGrid(){return this.isUnderGrid}getOriginalColor(){return this.originalColor||this.color}setColor(o){this.isColorful&&(this.originalColor=o),o!==this.color&&o!==void 0&&(this.scene.setStateInfo("plane_color"+this.label,o,this.isNormal),super.setColor(o),this.scene.needRender=!0)}getAllPtBbox(){return this.bboxFac2.valid()?this.bboxFac2.build1():null}getAllRgbRatio(){return this.scene.getForceDeactivateRatio()*this.getRgbRatio()}isUpdateAccelerateTexture(o){return!!(this.isNormal&&o!==10&&o!==5&&o!==19||o===19&&this.scene.drcRenderModel===1)}isUpdateHighLightAccelerateTexture(o){return!!this.isHighLight}addPt(o,t){var e,r;let i=this.getPtBBox(o,0,t),n=Fr.getType(o[0]);return this.bboxFac2.ext5(i.minX,i.maxX,i.minY,i.maxY),this.isUpdateAccelerateTexture(n)?(e=this.levelTextureManager)==null||e.update(i):this.isUpdateHighLightAccelerateTexture(n)&&((r=this.highLightTextureManager)==null||r.update(i)),this.ptNum++,this.ptTypeNum[n]++,this.builder.addPt(o,t,void 0,i)}render(o,t,e,r,i=!1,n,s,a){let l=!0;this.isNormal&&(l=!n),this.render0(s,o,t,!0,!this.isNormal||!n||i||this.scene.drcRenderModel===0,!0,l||i,a,!0,e,r,i,n,this.getMaterial(),this.renderTexture,this.renderOther)}render0(o,t,e,r,i,n,s,a,l=!1,c,h,u=!1,d=!1,p,m,g){let y=!1;this.renderedPtNum=0;let b=this.outMatrixParamMap.get(o);if(b){if(b.renderI===this.scene.renderI)return;b.renderI=this.scene.renderI}if(this.interPlanes.length===0||!this.isColorful&&(a===2&&this.getMaterial().alpha===0||(a===0||a===1)&&this.getColor().alpha===0)||this.noDrawing)return;let P=this.interPlanes.slice(),T=this.subPlanes.slice(),I=this.dictOutMatrixRenderCfg[o.toString()];if(I)if(I.replacePlane){T=I.listSubPlane;for(let _ of I.listInterPlane)_&&P.push(_)}else{for(let _ of I.listSubPlane)_&&T.push(_);for(let _ of I.listInterPlane)_&&P.push(_)}if(P.length==1&&!T.length){y=P[0].renderByMatrix0(o,t,e,r,i,n,s,a,l,c,h,u,d,p,!1,m,g);return}this.planeCanvas?this.planeCanvasCtx.reset():(this.planeCanvas=document.createElement("canvas"),this.planeCanvasCtx=new U0(this.planeCanvas.getContext("2d"))),this.tempCanvas?this.tempCanvasCtx.reset():(this.tempCanvas=document.createElement("canvas"),this.tempCanvasCtx=new U0(this.tempCanvas.getContext("2d")));let C=t.getWidth(),E=t.getHeight();this.planeCanvas.width=C,this.planeCanvas.height=E,this.tempCanvas.width=C,this.tempCanvas.height=E;let O=P[0].renderByMatrix0(o,t,this.planeCanvasCtx,r,i,n,s,a,l,c,h,u,d,p,!1,m,g);if(O&&(y=O),P.length!==1){this.planeCanvasCtx.setGlobalCompositeOperation("destination-in");for(let _=0;_<P.length;_++){let x=P[_].renderByMatrix0(o,t,this.tempCanvasCtx,r,i,n,s,a,l,c,h,u,d,p,!0,m,g);this.planeCanvasCtx.getContext().drawImage(this.tempCanvas,0,0),this.tempCanvasCtx.getContext().clearRect(0,0,C,E),x&&(y=x)}}this.planeCanvasCtx.setGlobalCompositeOperation("destination-out");for(let _ of T){let x=_.renderByMatrix0(o,t,this.planeCanvasCtx,r,i,n,s,a,l,c,h,u,d,p,!0,m,g);x&&(y=x)}return e.getContext().drawImage(this.planeCanvas,0,0),this.planeCanvasCtx.setGlobalCompositeOperation("source-over"),y}renderHighLightPt(o,t,e,r,i,n,s){this.builder.getPtNum()!==0&&this.renderHighLightMatrix(o,t,e,!0,r,i,n,s)}getPtColor(o,t,e=!1){let r,i=this.color;return t&&!this.isColorful&&this.scene.getForceVisibleHighLightPt()&&(i=this.getOriginalColor()),o==0?(r=i,e&&(r=r.mulAlpha(this.polygonColorAlphaRatio))):(r=this.scene.colors[o],r.r+r.g+r.b==0&&(r=ee.of6(i,r.alpha)),r=r.mulAlpha(i.alpha)),r}getSchPtColor(o){let t=o===0?this.color:this.scene.colors[o],e=SH.getAlpha()||rit,r=this.scene.getDrawingBgColor().mulAlpha(e);t=t.mul(t.alpha),r=r.mul(r.alpha);let i=r.r+t.r*(1-r.alpha),n=r.g+t.g*(1-r.alpha),s=r.b+t.b*(1-r.alpha),a=r.alpha+t.alpha*(1-r.alpha);return ee.build(i,n,s,a).mul(1/a)}getCustomizedColor(o,t=!1,e=!1,r,i,n,s){let a,l=!1,c,h=YE(o);if(s===2){if(h===0)return l=!0,{style:null,noSetCustomizedColor:l};let{style:u,color:d}=this.getPlaneMaterialColorString(r,h,n);a=u,c=d}else{if(!e&&(h===0&&!t||!this.isColorful))return l=!0,{style:null,noSetCustomizedColor:l};if(c=h===0?this.color:this.scene.colors[h],EH.includes(this.scene.getSceneType()))!t&&this.schNetworkHighLightStatus&&(c=this.getSchPtColor(h));else if(c=this.getPtColor(h,e,i),!t&&!e){let u=this.getAllRgbRatio();c=c.mul(u)}a=c.toCSS()}return{style:a,noSetCustomizedColor:l,color:c}}getPlaneMaterialColorString(o,t,e){let r,i=this.scene.colors[t],n=i,s=o.getViewMatrix(),a=new Dt(0,0,1).multiply4(new Ae([s.data[0],s.data[1],s.data[2],s.data[3],s.data[4],s.data[5],s.data[6],s.data[7],s.data[8],s.data[9],s.data[10],s.data[11],0,0,0,1])).normalize(),l=ee.build(i.r*this.scene.ambientLight.color.r,i.g*this.scene.ambientLight.color.g,i.b*this.scene.ambientLight.color.b,1),c=Math.abs(a.dot(this.scene.directionalLight.direction())),h=ee.build(n.r*this.scene.directionalLight.color.r*c,n.g*this.scene.directionalLight.color.g*c,n.b*this.scene.directionalLight.color.b*c,1),u=ee.build(l.r+h.r,l.g+h.g,l.b+h.b,(e==null?void 0:e.alpha)||0);return r=u.toCSS(),{style:r,color:u}}setFillStyle(o,t,e,r,i,n=!1,s,a=!1,l,c){if(t===1){let h=this.getCustomizedColor(e,r,n,s,a,l,c).style;h&&o.setFillStyle(h)}else if(t===0)o.setFillStyle("rgba(0, 0, 0, 0)");else{let h=this.getCustomizedColor(e,r,void 0,s,a,l,c).style;h||(h=o.getContext().fillStyle),o.setFillStyle(this.scene.fillParam.getPattern(t,h,i))}}getNetStringColor(o,t,e,r,i=null,n=0){if(o==0){let s=this.getStringColor();if(t||e)return s.toCSS();let a=this.getAllRgbRatio();return s.mul(a).toCSS()}return this.getCustomizedColor(o,t,e,r,!1,i,n).style}isPanelize(){return this.panelize}getFillStyle(o,t,e,r=!1,i,n){return this.getCustomizedColor(o,t,void 0,e,r,i,n).style}setHighLightColor(o,t){let e=this.scene.highLightColor[t];if(e){let r=e.toCSS();o.setFillStyle(r),o.setStrokeStyle(r)}}renderByMatrix0(o,t,e,r,i,n,s,a,l=!1,c,h,u=!1,d=!1,p,m=!1,g,y){let b=!1;for(let P of this.parts){let T=P.matrix.toMatrix4().multiply4(o);P.plane.renderByMatrix(T,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y)&&(b=!0)}return b}getDefaultMaterialStyle(o,t=this.getMaterial()){let e=(t==null?void 0:t.ambient)||ee.BLACK,r=(t==null?void 0:t.diffuse)||ee.BLACK,i=o.getViewMatrix(),n=new Dt(0,0,1).multiply4(new Ae([i.data[0],i.data[1],i.data[2],i.data[3],i.data[4],i.data[5],i.data[6],i.data[7],i.data[8],i.data[9],i.data[10],i.data[11],0,0,0,1])).normalize(),s=ee.build(e.r*this.scene.ambientLight.color.r,e.g*this.scene.ambientLight.color.g,e.b*this.scene.ambientLight.color.b,1),a=Math.abs(n.dot(this.scene.directionalLight.direction())),l=ee.build(r.r*this.scene.directionalLight.color.r*a,r.g*this.scene.directionalLight.color.g*a,r.b*this.scene.directionalLight.color.b*a,1),c=ee.build(s.r+l.r,s.g+l.g,s.b+l.b,(t==null?void 0:t.alpha)||0);return{style:c.toCSS(),color:c}}renderByMatrix(o,t,e,r,i,n,s,a,l=!1,c,h,u=!1,d=!1,p,m=!1,g,y){var b,P,T,I,C,E;let O={style:"",ratio:1};d=this.isNormal&&d;let _=!1,x=!1,v=this.scene,D=o.multiply4(t.getRenderMatrix()),w=D.toMatrix3(),F=!w.isMirrored(),H=new Uint8ClampedArray(4),z=this.getAllRgbRatio(),V;a===2?V=this.getDefaultMaterialStyle(t,p).style:this.color&&(H.set([this.color.r*z*255,this.color.g*z*255,this.color.b*z*255,this.color.alpha]),V=ee.build(this.color.r*z,this.color.g*z,this.color.b*z,this.color.alpha).toCSS());let W=t.getSampling(),L=t.getScale()*W,k=t.getPxLength(),N=k/W,U=Wve(k,this.getFixedPtData()),B=t.getWidth()*W-1,G=t.getHeight()*W-1,Y={},X={},K={},J={},se=[],ce=[],te={},oe={};this.setHighLightColor(c,0),this.setHighLightColor(h,1),e.setFillStyle(V),e.setStrokeStyle(V),e.setLineCap("round");let $=a!==1,fe=this.scene.ptGroup.getData(),Oe=[],Te={plane:this,getHighLightDrawInfo:Z=>{if(Z==-1)return null;if(ih.isHighLight(Z,fe)){let ie=ih.getHighLightGroupId(Z,fe),de=ih.isForceHighLight(Z,fe);if(ie==0)return{highLightGroupId:ie,ctx:c,isForceHighLight:de};if(ie==1)return{highLightGroupId:ie,ctx:c,isForceHighLight:de}}return null},renderMatrix3:w,scale:L,sampling:W,onlyRenderHighLightPt:u,bNeedFill:$,camera:t,globalHighLightType:this.scene.getGlobalHighLightType(),renderMatrix:D,samplingPxLength:N,isMirrored:F,pxLength:k,currentRenderFont:O,groupIdBuilder:fe,material:p,renderMode:a};Oe[0]=(Z,ie)=>{art(e,Z,ie,Te)},Oe[1]=(Z,ie)=>{trt(e,Z,ie,Te)},Oe[4]=(Z,ie)=>{Trt(e,Z,ie,Te)},Oe[16]=(Z,ie)=>{Dtt(e,Z,ie,Te)},Oe[17]=(Z,ie)=>{Frt(e,Z,ie,Te)},Oe[19]=(Z,ie)=>{crt(e,Z,ie,Te)},Oe[2]=(Z,ie)=>{mrt(e,Z,ie,Te)},Oe[20]=(Z,ie)=>{Wrt(e,Z,ie,Te)},Oe[15]=(Z,ie)=>{Btt(e,Z,ie,Te)},Oe[3]=(Z,ie)=>{brt(e,Z,ie,Te)},Oe[11]=(Z,ie)=>{Art(e,Z,ie,Te)},Oe[13]=(Z,ie)=>{vrt(e,Z,ie,Te)},Oe[12]=(Z,ie)=>{Crt(e,Z,ie,Te)},Oe[14]=(Z,ie)=>{Ert(e,Z,ie,Te)},Oe[5]=(Z,ie)=>{urt(e,Z,ie,Te)},Oe[6]=(Z,ie)=>{Wtt(Z,ie,{...Te,triangleContainerArr:{trianglesArr:Y,doubleRgbTrianglesArr:K,groupHighLightTrianglesArr:se,groupForceHighLightTrianglesArr:te}})},Oe[7]=(Z,ie)=>{$tt(Z,ie,{...Te,circleContainerArr:{circlesArr:X,doubleRgbCirclesArr:J,groupHighLightCirclesArr:ce,groupForceHighLightCirclesArr:oe}})},Oe[8]=(Z,ie)=>{Ztt(Z,ie,{...Te,triangleContainerArr:{trianglesArr:Y,doubleRgbTrianglesArr:K,groupHighLightTrianglesArr:se,groupForceHighLightTrianglesArr:te}})},Oe[9]=(Z,ie)=>{Qtt(Z,ie,{...Te,circleContainerArr:{circlesArr:X,doubleRgbCirclesArr:J,groupHighLightCirclesArr:ce,groupForceHighLightCirclesArr:oe}})},Oe[10]=(Z,ie)=>{prt(e,Z,ie,Te)},Oe[66]=(Z,ie)=>{qrt(e,Z,ie,Te)},Oe[18]=(Z,ie)=>{Nrt(e,Z,ie,Te)},Oe[67]=(Z,ie)=>{Jrt(e,Z,ie,Te)},Oe[68]=(Z,ie)=>{eit(e,Z,ie,Te)};let ue=v.staticPolygonInfoBuilder,be=(Z,ie,de)=>{let me=Oe[ie];if(!me){console.warn("Unsupported render type:",ie);return}let Se=Fr.getPtLengthByType(ie);for(let Re=0;Re<de*Se;Re+=Se)if(!(!(Z.get(Re)&cs)||this.isHiddenGroupPt(Z,Re,ue))){if(!this.scene.getRunCapture()){let Je=this.getPtBBox(Z.slice(Re,Re+Se),0,ue).transform4(D);if(Je.minX>B||Je.maxX<0||Je.minY>G||Je.maxY<0)continue}_=!0,l&&this.renderedPtNum++,me(Re,Z)}},j;if(!m&&!y?j=[]:j=this.builder.getBlocks(o,t,r,n,s,i),s){let Z={};j.forEach((de,me)=>{de.getBuilders().forEach((Se,Re)=>{if(Re===10||Re===19||Fr.isWireFramePolygonType(Re)&&$&&!this.scene.getGroupUseWireFramePolygon()||Re===68&&!U)return;let Je=de.getMaxLength(Re);if(!Je)return;let Ke=Fr.getPtLengthByType(Re);for(let Gt=0;Gt<Je*Ke;Gt+=Ke){if(!(Se.get(Gt)&cs)||this.isHiddenGroupPt(Se,Gt,ue))continue;let Nr=Se.slice(Gt,Gt+Ke);if(!this.scene.getRunCapture()){let _r=this.getPtBBox(Nr,0,ue).transform4(D);if(_r.minX>B||_r.maxX<0||_r.minY>G||_r.maxY<0)continue}let xr=Fr.getOrder(Nr,0,ue),vr=(a!==1||this.scene.getGroupUseColorPolygon())&&Fr.isNormalPolygonType(Re);if(Z[xr]||(Z[xr]={otherPts:[],polygonPts:!1}),vr){let _r=Oe[Re];_r(Gt,Se),Z[xr].polygonPts=!0}else Z[xr].otherPts.push(me,Re,Gt)}})}),d||this.textures.forEach(de=>{let me=de.getOrder();Z[me]||(Z[me]={otherPts:[],polygonPts:!1}),Z[me].otherPts.push(de)});let ie=Object.keys(Z).sort((de,me)=>Number(me)-Number(de));for(let de=0;de<ie.length;de++){let me=ie[de],Se=Z[me].otherPts,Re=Z[me].polygonPts;for(let Je=0;Je<Se.length;Je+=0){if(_=!0,l&&this.renderedPtNum++,Se[Je]instanceof Tw){g&&Se[Je].render(t,e,o),Je+=1;continue}let Ke=Se[Je+1],Gt=j[Se[Je]].getBuilders()[Ke],Nr=Se[Je+2],xr=Oe[Ke];if(Ke==5&&!n||Fr.isNormalType(Ke)&&!s){Je+=3;continue}xr(Nr,Gt),Je+=3}if(Re){x=!0,_=!0;let Je=this.color,Ke=V;this.polygonColorAlphaRatio!==1&&(this.color=ee.of6(this.color,this.polygonColorAlphaRatio*this.color.alpha),V=ee.build(this.color.r*z,this.color.g*z,this.color.b*z,this.color.alpha).toCSS(),e.setFillStyle(V),e.setStrokeStyle(V));let Gt=Math.max(((b=Y[me])==null?void 0:b.length)||0,((P=X[me])==null?void 0:P.length)||0);$ge(this,e,Gt,Y[me]||[],X[me]||[],$,!1,N,void 0,t,p,a);let Nr=Math.max(((T=K[me])==null?void 0:T.length)||0,((I=J[me])==null?void 0:I.length)||0);$ge(this,e,Nr,K[me]||[],J[me]||[],$,!0,N,void 0,t,p,a);let xr=Math.max(((C=te[me])==null?void 0:C.length)||0,((E=oe[me])==null?void 0:E.length)||0);$ge(this,e,xr,te[me]||[],oe[me]||[],$,!0,N,!0,t,p,a),e.setFillStyle(Ke),e.setStrokeStyle(Ke),this.color=Je,V=Ke}}}if(x){let Z=this.color,ie=V;this.polygonColorAlphaRatio!==1&&(this.color=ee.of6(this.color,this.polygonColorAlphaRatio*this.color.alpha),V=ee.build(this.color.r*z,this.color.g*z,this.color.b*z,this.color.alpha).toCSS(),e.setFillStyle(V),e.setStrokeStyle(V)),_tt(c,h,$,se,ce),e.setFillStyle(ie),e.setStrokeStyle(ie),this.color=Z,V=ie}return r&&j.forEach(Z=>{Z.getStringMaxPxLength()<k||Z.drawString(k,(ie,de,me)=>be(ie,10,me))}),i&&j.forEach(Z=>{let ie=Z.getBuilders()[19],de=Z.getMaxLength(19);!de||this.scene.drcRenderModel===0&&Z.getDrcPxLength()<k||be(ie,19,de)}),_}renderHighLightMatrix(o,t,e,r=!0,i,n,s,a){let l=this.scene.staticPolygonInfoBuilder,c=o.getRenderMatrix(),h=c.toMatrix3(),u=!h.isMirrored(),d=o.getSampling(),p=o.getScale()*d,m=o.getWidth()*d,g=m-1,y=o.getHeight()*d-1,b=[],P=[],T=o.getPxLength(),I=Wve(T,this.getFixedPtData()),C=T/d,E=this.scene.getRenderMode()!==1,O=this.scene.highLightColor[e].toCSS();t.setFillStyle(O),t.setStrokeStyle(O),t.setLineCap("round");let _=this.scene.drcRenderModel===0,x=this.scene.drcRenderStyle===0,v={sampling:d,scale:p,width:m,trianglesArr:b,circlesArr:P,isMirrored:u,renderMatrix:c,renderMatrix3:h,pxLength:T,bNeedFill:E,samplingPxLength:C,isDrcRenderFixed:_,isDrcStyleCross:x,plane:this,camera:o,groupIdBuilder:this.scene.ptGroup.getData()},D=(H,z,V,W)=>{let L=Fr.getPtLengthByType(z);for(let k=0;k<W*g9;k+=g9){let N=V.get(k),U=V.get(k+1);if(N==-1)continue;let B=N*L;if(!(H.get(B)&cs))continue;let G=this.getPtBBox(H.slice(B,B+L),0,l).transform4(c);G.minX>g||G.maxX<0||G.minY>y||G.maxY<0||(z==8||z==9?VK[z].call(this,B,H,v,l,U):z==6||z==7?VK[z].call(this,B,H,v,U):VK[z].call(this,t,B,H,v,U))}r&&(this.renderedPtNum+=W)},w=(H,z,V)=>{let W=Fr.getPtLengthByType(z);for(let L=0;L<V*W;L+=W){if(!(H.get(L)&cs))continue;let k=this.getPtBBox(H.slice(L,L+W),0,l).transform4(c);k.minX>g||k.maxX<0||k.minY>y||k.maxY<0||VK[z].call(this,t,L,H,v,e,!0)}},F=this.builder.getBlocks(Ae.ORIGIN,o,s,a,i,n);this.isHighLight?F.forEach(H=>{H.getBuilders().forEach((z,V)=>{if(V!==2)throw new Error("Highlight Plane data is incorrect");let W=H.getMaxLength(V);W&&w(z,V,W)})}):F.forEach(H=>{let z=H.getHighLightIds(e);if(!z)return;let V=H.getBuilders();i&&V.forEach((W,L)=>{if(!H.getMaxLength(L)||L===10||L===19||Fr.isWireFramePolygonType(L)||L===68&&!I)return;let k=z[L],N=k==null?void 0:k.getMaxLength();N&&D(W,L,k.getData(),N)})}),Rtt(t,E,b,P,this),s&&F.forEach(H=>{let z=H.getHighLightIds(e,10);if(!z||H.getStringMaxPxLength()<T)return;let V;H.drawString(T,(W,L)=>{V=z[L];let k=V==null?void 0:V.getMaxLength();k&&D(W,10,V.getData(),k)})}),n&&F.forEach(H=>{let z=H.getHighLightIds(e);if(!z)return;let V=H.getBuilders()[19],W=z[19],L=W==null?void 0:W.getMaxLength();!L||!H.getMaxLength(19)||this.scene.drcRenderModel===0&&H.getDrcPxLength()<T||D(V,19,W.getData(),L)}),a&&F.forEach(H=>{let z=H.getHighLightIds(e);if(!z)return;let V=5,W=H.getBuilders()[V],L=z[V],k=L==null?void 0:L.getMaxLength();!k||H!=null&&H.getMaxLength(V)||D(W,V,L.getData(),k)})}getSceneGlobalHighLightType(){return this.scene.getGlobalHighLightType()}isSchOnePxStatus(o){return this.scene.getDrawLineWidthStyle()==1&&o===1}getRenderLineWidth(o,t,e){return this.isSchOnePxStatus(t)?o:Math.max(o,t*e)}setTemplateInstancePt(o,t,e,r){}setTemplateInstancePts(o,t,e,r){}addTemplateHighLightPt(o,t,e,r,i=0){}setTemplateHighLightPtNum(o,t,e,r,i,n=0){}removeTemplateHighLightPt(o,t,e,r,i=0){}addTemplateHighLightPts(o,t,e,r,i=0){}removeTemplateHighLightPts(o,t,e,r,i=0){}setTemplateHighLightPtsNum(o,t,e,r,i,n=0){}getPtBboxById(o){let t=this.builder.getPt(o);return this.getPtBBox(t).build()}getBBox(){try{let o=Number.NEGATIVE_INFINITY,t=Number.NEGATIVE_INFINITY,e=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY;for(let i of this.interPlanes){let n=i.getBBox2ContainsPart();o=Math.max(n.minX,o),e=Math.min(n.maxX,e),t=Math.max(n.minY,t),r=Math.min(n.maxY,r)}return new U1(o,t,0,e,r,0)}catch{return null}}getFixedPtData(){return this.scene.getFixedPtData()}setRgbRatio(o){o!==this.deactivateAlphaRatio&&(this.deactivateAlphaRatio=o,this.scene.setStateInfo("plane_deactivateAlphaRatio"+this.label,o,this.isNormal),this.scene.needRender=!0)}getRgbRatio(){return this.deactivateAlphaRatio}setRenderProcess(o=[this],t=[]){this.interPlanes=o.filter(e=>e),this.subPlanes=t.filter(e=>e&&!e.isEmpty())}sortTransparentObjs(){}getIsColorFul(){return this.isColorful}addPart(o,t){this.parts.push({matrix:o,plane:t}),this.scene.clearAccelerateTexture()}clearParts(){this.parts.length=0,this.scene.clearAccelerateTexture()}setPolygonAbleInter(o){}setAlwaysUpdateBBox(o){this.alwaysUpdateBBox=o}updateBBox(){try{let o=Number.NEGATIVE_INFINITY,t=Number.NEGATIVE_INFINITY,e=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY;for(let i of this.interPlanes){let n=i.getAllPtBbox();o=Math.max(n.minX,o),e=Math.min(n.maxX,e),t=Math.max(n.minY,t),r=Math.min(n.maxY,r)}return this.bBox=new U1(o,t,0,e,r,0),this.bBox}catch{return this.bBox=null,this.bBox}}addRenderProcess(o=[this],t=[]){for(let e of o)this.interPlanes.indexOf(e)<=-1&&this.interPlanes.push(e);for(let e of t)this.subPlanes.indexOf(e)<=-1&&this.subPlanes.push(e)}removeRenderProcess(o=[this],t=[]){for(let e of o){let r=this.interPlanes.indexOf(e);r>=0&&this.interPlanes.splice(r,1)}for(let e of t){let r=this.subPlanes.indexOf(e);r>=0&&this.subPlanes.splice(r,1)}}addOutMatrixRenderCfg(o,t){let e=o.getSelfAsOutToChildMatrix();for(let r of e){let i=this.outMatrixParamMap.get(r);i&&(t.visible=i.visible,this.dictOutMatrixRenderCfg[r.toString()]=t)}}removeOutMatrixRenderCfg(o,t){let e=o.getSelfAsOutToChildMatrix();for(let r of e)this.outMatrixParamMap.get(r)&&delete this.dictOutMatrixRenderCfg[r.toString()]}getBBox2ContainsPart(){let o=new _e;for(let t of this.parts){let{plane:e,matrix:r}=t,i=e.getAllPtBbox();i&&o.ext1(i.transform(r))}return o.valid()?o.build():null}getBBox2(){let o,t=this.getBBox();return t&&(o=t.toBBox2()),o}clearCpuMemory(){}getUnPanelBBox(){let o=new _e,{plane:t,matrix:e}=this.parts[0],r=t.getAllPtBbox();return r&&o.ext1(r.transform(e)),o.build()}};function Kge(o,t){iit(o.iterator(),t)}function iit(o,t){let e=0;for(;o.hasNext();){let r=o.next();t(e++,r)}}var GK=new Error("list is empty"),UK=class{constructor(o,t){this.prev=null,this.next=null,this.parent=o,this.item=t}insertAfter(o){o.next=this.next,this.next=o,o.prev=this,o.next!==null&&(o.next.prev=o)}insertBefore(o){o.prev=this.prev,this.prev=o,o.next=this,o.prev!==null&&(o.prev.next=o)}remove(){this.prev!==null&&(this.prev.next=this.next),this.next!==null&&(this.next.prev=this.prev)}set(o){this.item=o}},nit=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o.item;throw new Error("iterator is null")}},oit=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o;throw new Error("iterator is null")}},M7=class{constructor(){this.first=null,this.last=null,this.cnt=0}add(o){return this.addLast(o)}push(o){return this.addLast(o)}pop(){return this.removeLast()}shift(){return this.removeFirst()}removeFirst(){let o=this.first;if(o===null)throw GK;return this.remove(o),o.item}removeLast(){let o=this.last;if(o===null)throw GK;return this.remove(o),o.item}addLast(o){return this.first===null||this.last===null?(this.first=new UK(this,o),this.last=this.first,this.cnt=1,this.first):this.insertAfter(this.last,o)}addFirst(o){if(this.first===null||this.last===null){let t=new UK(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertBefore(this.first,o)}getFirst(){if(this.first===null)throw GK;return this.first.item}getLast(){if(this.last===null)throw GK;return this.last.item}insertAfter(o,t){let e=new UK(this,t);return o.insertAfter(e),o===this.last&&(this.last=e),this.cnt++,e}insertBefore(o,t){let e=new UK(this,t);return o.insertBefore(e),o===this.first&&(this.first=e),this.cnt++,e}remove(o){o.remove(),o===this.first&&(this.first=o.next),o===this.last&&(this.last=o.prev),this.cnt--}size(){return this.cnt}clear(){this.first=null,this.last=null,this.cnt=0}iterator(){return new nit(this.first)}listIterator(){return new oit(this.first)}toArray(){let o=new Array(this.cnt),t=this.first,e=0;for(;t!=null&&(o[e]=t.item,t=t.next,e++,!(t==this.first||e==this.cnt)););return o}};function Zge(o){throw new Error("")}var HK=class{constructor(o,t){this.node1=null,this.node2=null,this.key=o,this.value=t}},sit=class{constructor(o){this.itors=o}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().key}},ait=class{constructor(o){this.itors=o}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().value}},fwe=class{constructor(){this.innerList=new M7,this.innerMap={}}replace(o,t){o.node1!==null&&(o.node1.set(t),t.node1=o.node1),o.node2!==null&&(o.node2.set(t),t.node2=o.node2)}clear(){this.innerList.clear();for(let o in this.innerMap)delete this.innerMap[o]}put(o,t){let e=o.hashCode(),r=new HK(o,t),i=this.innerMap[e];if(i===void 0)return r.node1=this.innerList.add(r),this.innerMap[e]=r,null;if(i instanceof HK){if(i.key.equals(o))return this.innerMap[e]=r,this.replace(i,r),i.value;{r.node1=this.innerList.add(r);let n=new M7;return i.node2=n.add(i),r.node2=n.add(r),this.innerMap[e]=n,null}}if(i instanceof M7){let n=null;return Kge(i,(s,a)=>a.key.equals(o)?(this.replace(a,r),n=a.value,!1):!0),n===null?(r.node1=this.innerList.add(r),r.node2=i.push(r),null):n}return Zge(i)}get(o){let t=o.hashCode(),e=this.innerMap[t];if(e===void 0)return null;if(e instanceof HK)return e.key.equals(o)?e.value:null;if(e instanceof M7){let r=null;return Kge(e,(i,n)=>n.key.equals(o)?(r=n.value,!1):!0),r}return Zge(e)}containsKey(o){return this.get(o)!==null}delete(o){o.node1!==null&&o.node1.parent.remove(o.node1),o.node2===null?delete this.innerMap[o.key.hashCode()]:o.node2.parent.remove(o.node2)}remove(o){let t=o.hashCode(),e=this.innerMap[t];if(e===void 0)return null;if(e instanceof HK)return e.key.equals(o)?(this.delete(e),e.value):null;if(e instanceof M7){let r=null;return Kge(e,(i,n)=>n.key.equals(o)?(r=n.value,this.delete(n),!1):!0),r}return Zge(e)}computeIfAbsent(o,t){let e=this.get(o);if(e===null){let r=t(o);return this.put(o,r),r}else return e}size(){return this.innerList.size()}isEmpty(){return this.innerList.size()===0}keys(){return new sit(this.innerList.iterator())}values(){return new ait(this.innerList.iterator())}entries(){return this.innerList.iterator()}},Ug=(o=>(o[o.NOTSHOW=0]="NOTSHOW",o[o.ONLYAXIS=1]="ONLYAXIS",o[o.SHOW=2]="SHOW",o))(Ug||{}),NC=(o=>(o[o.Line=0]="Line",o[o.Point=1]="Point",o[o.None=2]="None",o))(NC||{}),lit=class{constructor(){this._visible=0,this._flip=!1,this._currentCoord=!0,this._gridColor=ee.WHITE,this._transparency=.3,this._multiGridColor=ee.WHITE,this._multiTransparency=.55,this._coordinateAxisColor=ee.WHITE,this._coordinateAxisTransparency=1,this._stepX=.5,this._stepY=.5,this._snapX=.5,this._snapY=.5,this._pattern=!0,this._multiRatio=5,this._multiStyle=2,this._angleDelta=Math.PI/4,this._startAngle=0,this._endAngle=Zs,this._step=39.37,this._minRadius=3.937,this._maxRadius=393.7,this.updateListeners=[],this._gridInstance=null,this.pointSize=1,this._renderGrid=!0,this._renderCoordinateAxis=!0}set renderGrid(o){this._renderGrid!==o&&(this._renderGrid=o,this.updateListeners.forEach(t=>t()))}get renderGrid(){return this._renderGrid}set visible(o){o!==this._visible&&(this._visible=o,this.updateListeners.forEach(t=>t()))}get visible(){return this._visible}get flip(){return this._flip}set flip(o){this._flip=o,this.updateListeners.forEach(t=>t())}get gridColor(){return this._gridColor}set gridColor(o){this._gridColor=o,this._gridInstance!=null&&this._gridInstance.modifyColor(o,1-this.transparency),this.updateListeners.forEach(t=>t())}get currentCoord(){return this._currentCoord}set currentCoord(o){this._currentCoord=o,this.updateListeners.forEach(t=>t())}get minRadius(){return this._minRadius}set minRadius(o){this._minRadius=o,this.updateListeners.forEach(t=>t())}get maxRadius(){return this._maxRadius}set maxRadius(o){this._maxRadius=o,this.updateListeners.forEach(t=>t())}get angleDelta(){return this._angleDelta}set angleDelta(o){this._angleDelta=o,this.updateListeners.forEach(t=>t())}get radius(){return this._step}set radius(o){this._step=o,this.updateListeners.forEach(t=>t())}get startAngle(){return this._startAngle}set startAngle(o){o%=Zs,o<0&&(o+=Zs),this._startAngle=o,this.updateListeners.forEach(t=>t())}get endAngle(){return this._endAngle}set endAngle(o){this._endAngle=o,this.updateListeners.forEach(t=>t())}get sweepAngle(){return this.endAngle>this.startAngle?this.endAngle-this.startAngle:this.endAngle-this.startAngle+Zs}addUpdateListener(o){this.updateListeners.push(o)}modify(o,t,e,r,i){this._stepX=o,this._stepY=t,this._snapX=e,this._snapY=r,this._pattern=i,this._gridInstance!=null&&this._gridInstance.flush(),this.updateListeners.forEach(n=>n())}updateGridParam(o,t,e,r){let i=o?2:1;this._stepX=t,this._stepY=e,o!==void 0&&(this.visible=i),r!==void 0&&(this._pattern=r),this._gridInstance!=null&&this._gridInstance.flush(),this.updateListeners.forEach(n=>n())}attach(o){this._gridInstance=o,this._gridInstance!=null&&(this._gridInstance.flush(),this._gridInstance.modifyColor(this._gridColor,1-this.transparency)),this.updateListeners.forEach(t=>t())}setGridX(o){o>0&&(this.updateListeners.forEach(t=>t()),this._stepX=o,this._gridInstance!=null&&this._gridInstance.flush())}getGridX(){return this._stepX}setGridY(o){o>0&&(this.updateListeners.forEach(t=>t()),this._stepY=o,this._gridInstance!=null&&this._gridInstance.flush())}getGridY(){return this._stepY}getPointSize(){return this.pointSize}setPointSize(o){o<0||o===this.pointSize||(this.pointSize=o,this.updateListeners.forEach(t=>t()))}getMultiRatio(){return this._multiRatio}setMultiRatio(o){o>=1&&(this._multiRatio=o,this.updateListeners.forEach(t=>t()))}getMultiStyle(){return this._multiStyle}setMultiStyle(o){return this.updateListeners.forEach(t=>t()),this._multiStyle=o}setSnapX(o){o>0&&(this.updateListeners.forEach(t=>t()),this._snapX=o)}getSnapX(){return this._snapX}setSnapY(o){o>0&&(this.updateListeners.forEach(t=>t()),this._snapY=o)}getSnapY(){return this._snapY}get pattern(){return this._pattern}set pattern(o){this.updateListeners.forEach(t=>t()),this._pattern=o,this._gridInstance!=null&&this._gridInstance.flush()}get transparency(){return this._transparency}set transparency(o){this.updateListeners.forEach(t=>t()),this._transparency=o,this._gridInstance!=null&&this._gridInstance.modifyColor(this._gridColor,1-this.transparency)}get multiGridColor(){return this._multiGridColor}set multiGridColor(o){this.updateListeners.forEach(t=>t()),this._multiGridColor=o}get multiTransparency(){return this._multiTransparency}set multiTransparency(o){this.updateListeners.forEach(t=>t()),this._multiTransparency=o}get coordinateAxisColor(){return this._coordinateAxisColor}set coordinateAxisColor(o){this.updateListeners.forEach(t=>t()),this._coordinateAxisColor=o}get coordinateAxisTransparency(){return this._coordinateAxisTransparency}set coordinateAxisTransparency(o){this.updateListeners.forEach(t=>t()),this._coordinateAxisTransparency=o}set renderCoordinateAxis(o){this.updateListeners.forEach(t=>t()),this._renderCoordinateAxis=o}get renderCoordinateAxis(){return this._renderCoordinateAxis}},Jge=1e5;function mwe(o,t,e,r){let i=o.getScale(),n=0,s=i;for(;;)if(s>=1){if(s=s/10,s<1)break;n++}else if(s=s*10,n--,s>=1)break;let a=i/Math.pow(10,n);return a>=1&&a<2?i=Math.pow(10,n):a>=2&&a<5?i=2*Math.pow(10,n):i=5*Math.pow(10,n),i=i>500?500:i,t.conversion1("mil",e,r)/i}var Qge=7,gwe=class{constructor(o,t,e){this.plane=o,this.camera=t,this.arcTextColor=ee.WHITE,this.textDxDyFontSize=14,this.textDlFontSize=14,this.textAngleFontSize=14,this.unitConversion=new Aw,this.unit="mil",this.longLinePxLength=20,this.middleLinePxLength=14,this.shortLinePxLength=8,this.scaleFontSize=14,this.arcRadius=40,this.showAngleInfo=!0,this.showTextMilInfo=!0,this.unitScale=1,this.useEnTranslate=!1,this.leftAndRightSpacing=9,this.backgroundRectHeight=24,this.strokeLineColor=ee.Gray,this.data=e,this.bitmap=new Xm(4),this.bitmap.addTrimListener(r=>{this.data.trimChunk(r)}),this.measureIdAndNormalIds=new Map,this.measureIdAndRulerIds=new Map,this.measureIdAnTextInfoIds=new Map}get spacing(){return this.unitScale*10*10}setUseEnTranslate(o){this.useEnTranslate=o}setShowAngleInfo(o){this.showAngleInfo=o}setShowTextMilInfo(o){this.showTextMilInfo=o}setMeasureToolPtStyle(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T){this.scaleColor=o,this.scaleTextColor=t,this.textColor=e,this.textDxDyBackgroundColor=r,this.textDLBackgroundColor=i,this.textAngleBackgroundColor=n,this.angleArcColor=s,this.textHeightMaxPxLimit=l,this.longLinePxLength=c,this.middleLinePxLength=h,this.shortLinePxLength=u,this.scaleFontSize=d,this.arcRadius=p,this.leftAndRightSpacing=m,this.textDxDyFontSize=g,this.textDlFontSize=y,this.textAngleFontSize=b,this.backgroundRectHeight=P,this.strokeLineColor=a,this.arcTextColor=T}getAngle(o,t){let e=o.sub(t).normalize();return Math.atan2(e.y,e.x)}getStartAndEndAngle(o,t){let e=0,r=0;return t.x>o.x?(e=t.y<=o.y?90*(Math.PI/180):-90*(Math.PI/180),r=this.getAngle(o,t)):t.x<o.x&&(e=this.getAngle(o,t),r=t.y<=o.y?90*(Math.PI/180):-90*(Math.PI/180)),{startAngle:e,endAngle:r}}getSweep(o,t){let e=o.sub(t).normalize();return new S(1,0).cross(e)>=0?ae.CCW:ae.CW}createLineSegment(o,t){return this.plane.createOrUpdateLineSegment(-1,o,t,!0,0,0,this.scaleColor,4)}createArcSegment(o,t){let{startAngle:e,endAngle:r}=this.getStartAndEndAngle(o,t);return this.plane.createOrUpdateArcSegment(-1,t,this.arcRadius,e,r,this.getSweep(o,t),this.angleArcColor)}conversion(o){let t=this.unitConversion.conversion("mil",this.unit,o);return t=Math.round(t*1e4)/1e3,t.toString()}createRuler(o,t,e,r){let i=mwe(this.camera,this.unitConversion,this.unit,this.spacing);i=this.unitConversion.conversion(this.unit,"mil",i)/10;let n=this.camera.getScale();this.LastScale=n;let s=[],a=t.distance1(r),l=e.distance1(r),c=e.sub(r).normalize(),h=t.sub(r).normalize(),u=1,d=this.shortLinePxLength/n,p=this.middleLinePxLength/n,m=this.longLinePxLength/n;for(let g=i;g<=a;g+=i){let y=r.add(h.mul(g)),b;if(u%10==0){b=y.add(c.mul(m));let T=this.plane.createOrUpdateNetWorkText(-1,this.conversion(g),b,0,5,15,Jge,this.scaleFontSize,this.scaleTextColor);s.push(T)}else u%5==0?b=y.add(c.mul(p)):b=y.add(c.mul(d));let P=this.plane.createOrUpdateLineSegment(-1,y,b,!0,0,0,this.scaleColor,4);s.push(P),u++}u=1;for(let g=i;g<=l;g+=i){let y=r.add(c.mul(g)),b;if(u%10==0){b=y.add(h.mul(m));let T=this.plane.createOrUpdateNetWorkText(-1,this.conversion(g),b.add(h.mul(m)),0,5,this.textHeightMaxPxLimit,Jge,this.scaleFontSize,this.scaleTextColor);s.push(T)}else u%5==0?b=y.add(h.mul(p)):b=y.add(h.mul(d));let P=this.plane.createOrUpdateLineSegment(-1,y,b,!0,0,0,this.scaleColor,4);s.push(P),u++}this.measureIdAndRulerIds.set(o,s)}getLengthInfo(o){let t=this.unitConversion.conversion("mil","mm",o)*10;t=Math.round(t*1e3)/1e3;let e="";return this.showTextMilInfo&&(e="("+(Math.round(o*100)/10).toFixed(1)+"mil)"),t.toFixed(3)+"mm"+e}createTextInfo(o,t,e,r,i){let n=this.camera.getScale(),s=(this.plane.scene.getPixelRatio()||1)/n,a=t,l=e;i&&(a=e,l=t);let c=a.distance1(r),h=l.distance1(r),u=t.distance1(e),{startAngle:d,endAngle:p}=this.getStartAndEndAngle(t,e),m=(Math.abs(d-p)/Math.PI*180).toFixed(3)+"\xB0",g=this.getLengthInfo(c),y=this.getLengthInfo(h),b=this.getLengthInfo(u),P=m,T=a.sub(r).normalize(),I=l.sub(r).normalize(),C=this.arcRadius,E=a.add(r).mul(.5),O=l.add(r).mul(.5),_=t.add(e).mul(.5).add(T.mul(10*s)),x=e,v=T.dot(new S(this.camera.getTar2Pos().z<0?-1:1,0))>0,D=I.dot(new S(0,1))>0,w=D?"topCenter":"bottomCenter",F=v?"rightCenter":"leftCenter",H=Number(D)^Number(i)?"bottomCenter":"topCenter",z=v?"leftBottom":"rightBottom";if(D||(z=v?"leftTop":"rightTop"),i?x=e.sub(I.mul(23*s)):D||(H=v?"leftTop":"rightTop"),i?c>.1&&h<.1?(F=v?"rightTop":"leftTop",x=x.add(new S(0,1).mul(43*s))):c<.1&&h>.1&&(F="rightCenter",E=E.sub(I.mul(43*s)),D?(H="leftTop",w="leftTop"):(H="leftBottom",w="leftBottom")):c>.1&&h<.1?(v?(F="rightTop",O=O.sub(T.mul(C+10*s))):F="leftTop",x=x.add(new S(0,1).mul(65*s))):c<.1&&h>.1&&(D?(H="rightBottom",w="rightTop"):(H="rightTop",w="rightBottom")),c<.1&&h<.1&&(x=r.add(new S(0,1).mul(C)),E=r.add(new S(-1,0).mul(C)),O=r.add(new S(1,0).mul(C)),H="bottomCenter",w="rightCenter",F="leftCenter"),h>.1&&c>.1){let W=this.backgroundRectHeight*s,L,k=!1;i?(v&&h<C||!v&&c<C)&&(L=a.add(new S(1,0).mul(C)),k=!0):(!v&&h<C||v&&c<C)&&(L=D?l:r,L=L.add(new S(1,0).mul(C)),k=!0),k&&(L=L.add(new S(0,1).mul(W)),w="leftTop",F="leftTop",H="leftTop",z="leftTop",E=L,O=E.add(new S(0,-1).mul(W)),x=O.add(new S(0,-1).mul(W)),_=x.add(new S(0,-1).mul(W)),g="DX: "+g,y="DY: "+y,P=this.useEnTranslate?"R":"\u89D2\u5EA6: "+P,b=this.useEnTranslate?"L":"\u957F\u5EA6: "+b)}let V=[];this.createTextAndRect(g,E,w,V,this.textDxDyBackgroundColor,this.textDxDyFontSize),this.createTextAndRect(y,O,F,V,this.textDxDyBackgroundColor,this.textDxDyFontSize),this.createTextAndRect(P,x,H,V,this.textAngleBackgroundColor,this.textAngleFontSize,this.arcTextColor),Math.abs(c)>=1e-8&&Math.abs(h)>=1e-8&&this.createTextAndRect(b,_,z,V,this.textDLBackgroundColor,this.textDlFontSize),this.measureIdAnTextInfoIds.set(o,V)}createStrokeLine(o,t){return this.plane.createOrUpdateLineSegment(-1,o,t,!0,0,0,this.strokeLineColor,2)}createTextAndRect(o,t,e,r,i,n,s=this.textColor){let a=Jge,l=this.camera.getScale(),c=n,h=this.backgroundRectHeight/l,{strWidth:u,strHeight:d}=F_.getStrInfo(o,a,c),p=(u+this.leftAndRightSpacing*2)/l,m=p*.5,g=h*.5,y;switch(e){case"bottomCenter":{y=t.add1(-m,h);break}case"leftBottom":{y=t.add1(0,h);break}case"leftCenter":{y=t.add1(0,g);break}case"leftTop":{y=t;break}case"rightBottom":{y=t.add1(-p,h);break}case"rightCenter":{y=t.add1(-p,g);break}case"rightTop":{y=t.add1(-p,0);break}case"topCenter":{y=t.add1(-m,0);break}}let b=this.plane.createOrUpdateRect(-1,y,p,h,0,0,i,3);r.push(b);let P=this.createStrokeLine(y,y.add1(p,0)),T=this.createStrokeLine(y.add1(p,0),y.add1(p,-h)),I=this.createStrokeLine(y.add1(p,-h),y.add1(0,-h)),C=this.createStrokeLine(y.add1(0,-h),y);r.push(P,T,I,C);let E=this.plane.createOrUpdateScaleString(-1,o,y.add1(m,-g),0,a,c/l,s,1,-1);r.push(E)}modifyUnit(o){o!=this.unit&&(o!="mil"?this.unitScale=this.unitConversion.conversion(o,"mil",1)/100:this.unitScale=1,this.unit=o)}createMeasureTool(o,t,e,r){let i=this.bitmap.findEmpty();i===-1&&(this.bitmap=this.bitmap.extSize(this.bitmap.size*2),i=this.bitmap.findEmpty()),this.bitmap.markUsed(i),this.data.setArr([o.x,o.y,t.x,t.y,e.x,e.y,r?1:0],i*Qge);let n=[],s=this.createLineSegment(o,t),a=this.createLineSegment(e,o),l=this.createLineSegment(e,t);if(n.push(s,a,l),this.showAngleInfo){let c=this.createArcSegment(o,t);n.push(c)}return this.measureIdAndNormalIds.set(i,n),this.createRuler(i,o,t,e),this.createTextInfo(i,o,t,e,r),i}removeMeasureTool(o){this.data.setArr(new Array(6).fill(0),o*Qge),this.bitmap.markRemove(o);let t=this.measureIdAndNormalIds.get(o),e=this.measureIdAndRulerIds.get(o);if(!t||!e){console.error("measureToolId error");return}let r=this.measureIdAnTextInfoIds.get(o);t.forEach(i=>{this.plane.removePt(i)}),e.forEach(i=>{this.plane.removePt(i)}),r.forEach(i=>{this.plane.removePt(i)}),this.measureIdAndNormalIds.delete(o),this.measureIdAndRulerIds.delete(o),this.measureIdAnTextInfoIds.delete(o)}updateRuler(){Math.abs(this.LastScale-this.camera.getScale())<1e-8||this.measureIdAndRulerIds.forEach((o,t)=>{let e=this.measureIdAndRulerIds.get(t),r=this.measureIdAnTextInfoIds.get(t);e||console.error("measureToolId error"),e.forEach(g=>{this.plane.removePt(g)}),r.forEach(g=>{this.plane.removePt(g)});let i=t*Qge,n=this.data.get(i+0),s=this.data.get(i+1),a=this.data.get(i+2),l=this.data.get(i+3),c=this.data.get(i+4),h=this.data.get(i+5),u=this.data.get(i+6),d=new S(n,s),p=new S(a,l),m=new S(c,h);this.createRuler(t,d,p,m),this.createTextInfo(t,d,p,m,!!u)})}};function ywe(o){return ee.build(o.r,o.g,o.b,o.alpha+.1)}var pH=class{constructor(t){this.bgRuler=new cit(t),this.scaleRuler=new hit}render(t,e,r,i,n){n=ywe(n),this.bgRuler.render(t,i,n),this.scaleRuler.render(t,e,r,n)}};pH.DELTA=18,pH.canvasOrigin=new S(pH.DELTA,pH.DELTA);var Th=pH,cit=class{constructor(o){this.sceneType=o}render(o,t,e){let r=o.getContext();o.setFillStyle(t.toRGBAString()),r.fillRect(0,0,r.canvas.width,Th.DELTA),r.fillRect(0,0,Th.DELTA,r.canvas.height),EH.includes(this.sceneType)&&(o.setLineWidth(1),o.setStrokeStyle(e.toRGBAString()),r.beginPath(),r.moveTo(Th.DELTA,Th.DELTA),r.lineTo(Th.DELTA,r.canvas.height),r.stroke(),r.beginPath(),r.moveTo(Th.DELTA,Th.DELTA),r.lineTo(r.canvas.width,Th.DELTA),r.stroke())}},hit=class{constructor(){this.primitives=[],this.spacing=2,this.scale=1,this.ratio=5,this.delta=1,this.unit="mil",this.magnification=10,this.unitConversion=new Aw,this.fontSize=14,this.offNum=5}get spacing10(){return this.spacing*this.ratio*this.scale*10}modifyUnit(o){o!=this.unit&&(o!="mil"?this.scale=this.unitConversion.conversion(o,"mil",1)/100:this.scale=1,this.unit=o)}clearPrimitives(){this.primitives.length=0}updateMagnification(o){this.magnification=b9(o)}updateDelta(o){this.delta=b9(o)}createRuler(o,t,e,r){let i,n,s;t===0?(i=-1,n=0,s=2):(i=1,n=1,s=3);let a=b9(i*Math.floor(e/r)*this.delta),l=e%r;if(t===0)if(e>=0){let c=10-Math.abs(b9(a/this.delta)%10),h=b9(a+i*this.delta*c),u=h.toString(),d=this.ctx.getContext().measureText(u).width;if((c-1)*r<d){let p=Th.DELTA-c*r+Math.abs(l),m=new zK(u,h,t,new Dt(p+d+3,Th.DELTA/2,0),!0);this.primitives.push(m)}}else{let c=Math.abs(a/this.delta)%10;if(c!==0){let h=b9(a+i*this.delta*c),u=h.toString(),d=this.ctx.getContext().measureText(u).width;if((c-1)*r<d){let p=Th.DELTA-c*r+(l+r),m=new zK(u,h,t,new Dt(p+d+3,Th.DELTA/2,0),!0);this.primitives.push(m)}}}for(let c=l<0?l+r:l;c<=o;c+=r){let h=c+Th.DELTA,u=[Th.DELTA,Th.DELTA,Th.DELTA-this.offNum,Th.DELTA-this.offNum];u[n]=h,u[s]=h,this.createScale(u,a,t),a=b9(a-i*this.delta)}}createScale(o,t,e){let r=iye(t,this.magnification)===0,i=iye(t,this.magnification/2)===0;r?e===0?o[3]=0:o[2]=0:i&&(e===0?o[3]=Th.DELTA/2:o[2]=Th.DELTA/2);let n=new WK(e,o);if(this.primitives.push(n),r){let s=t.toString(),a=new zK(s,t,e,new Dt(e===0?o[0]+3:Th.DELTA/2,e===0?Th.DELTA/2:o[1]-3,0));this.primitives.push(a)}}createScaleIdentification(o){let t=o.getScreenPosition().multiply4(o.get2dCameraMatrix().getInverseMatrix()),{x:e,y:r}=t.multiply4(o.getRenderMatrix()).scale(1/o.getSampling());if(e>=Th.canvasOrigin.x){let i=[e,Th.DELTA,e,0];this.primitives.push(new WK(0,i))}if(r>=Th.canvasOrigin.y){let i=[Th.DELTA,r,0,r];this.primitives.push(new WK(1,i))}}autoScale(o){let t=mwe(o,this.unitConversion,this.unit,this.spacing10),e=10,r=1;this.unit=="inch"&&(e=1,r=.1),this.updateMagnification(t*e),this.updateDelta(t*r)}render(o,t,e,r){this.autoScale(t);let i=o.getContext();this.ctx=o,o.save();let n=ywe(r).toRGBAString();o.setStrokeStyle(n),o.setLineWidth(1),o.setFillStyle(n),o.setTextBaseLine("middle"),o.setFont(`normal ${this.fontSize}px ${Z7}`);let s=i.canvas.width,a=i.canvas.height,l=e,c=l.multiply4(t.getRenderMatrix()).scale(1/t.getSampling()),h=c.sub(Th.canvasOrigin),u=this.unitConversion.conversion1(this.unit,"mil",this.magnification)/10,d=new S(u,0).add(l).multiply4(t.getRenderMatrix()).scale(1/t.getSampling()),p=Math.abs(d.x-c.x)/10,m=b9(-1*Math.floor(Math.max(Math.abs(h.x),Math.abs(h.y))/p)*this.delta);this.ctx.getContext().measureText(m.toString()).width>p*10&&(this.magnification*=2),this.createRuler(s,0,h.x,p),this.createRuler(a,1,h.y,p),this.createScaleIdentification(t);let g=7;this.primitives.forEach(y=>{if(i.beginPath(),y instanceof WK){let{startPoint:{x:b,y:P},width:T,height:I}=y.getRectInfo();i.fillRect(b,P,T,I)}else if(y instanceof zK){if(y.text==="")return;let{x:b,y:P}=y.getPosition();if(y.direction===1){let T=0,I=0;if(y.text[0]==="-"){if(P-i.measureText("-").width<=Th.DELTA)return;o.save(),o.setTranslate(b,P),o.setRotate(-Math.PI/2),i.fillText("-",0,0),o.restore(),I=g/2,T=1}for(;T<y.text.length;T++){let C=P-T*g+I;if(C-i.measureText(y.text[T]).width<=Th.DELTA)return;o.save(),o.setTranslate(b,C),o.setRotate(-Math.PI/2),i.fillText(y.text[T],0,0),o.restore()}}else if(y.isSpecial){o.save();let T=i.measureText(y.text).width,I=b-T;o.setTranslate(I,P);let C=0;for(let E=0;E<y.text.length;E++){let O=y.text[E],_=i.measureText(O).width;I+C>=Th.DELTA&&i.fillText(O,C,0),C=C+_}o.restore()}else i.fillText(y.text,b,P)}else throw Error("not support")}),o.restore(),this.clearPrimitives()}},WK=class{constructor(o,t){if(this.lineWidth=1,this.direction=o,o===0)this.rectInfo={startPoint:new Dt(t[2],t[3],0),width:this.lineWidth,height:b9(t[1]-t[3])};else if(o===1)this.rectInfo={startPoint:new Dt(t[2],t[3],0),width:b9(t[0]-t[2]),height:this.lineWidth};else throw new Error("not support the DIRECTION")}getRectInfo(){return this.rectInfo}},zK=class{constructor(o,t,e,r,i){this.text=o,this.scale=t,this.direction=e,this.position=r,this.isSpecial=i}getPosition(){return this.position}};function b9(o){return Math.round(o*1e3)/1e3}function iye(o,t){let{integerPart:e,divisor:r}=s(o),{integerPart:i,divisor:n}=s(t);if(r>n)return e%Math.round(t*r)/r;return r<n?Math.round(o*n)%i/n:e%i/r;function s(a){let l=a.toString(),c=l.indexOf(".");if(c===-1)return{integerPart:a,divisor:1};let h=l.length-c-1,u=Math.pow(10,h);return{integerPart:Math.round(a*u),divisor:u}}}var uit=class{constructor(o,t){this.scene=o,this.rectangularProgram=new dit(t,this.scene.gridParam),this.polarProgram=new pit(t,this.scene.gridParam)}render(o,t){this.scene.gridParam.currentCoord?this.rectangularProgram.render(o,t,this.scene.getOrigin()):this.polarProgram.render(o,t,this.rectangularProgram.getRenderColor(),this.scene.getAntialias(),this.scene.getOrigin())}modifyModel(o){this.scene.gridParam.pattern=o}getRectangularProgram(){return this.rectangularProgram}getPolarProgram(){return this.polarProgram}},YK=2,dit=class{constructor(o,t){this.gridParam=t,this.m_color=o,this.gridColor=this.getRenderColor(),this.boldColor=ee.of6(t.multiGridColor,1-t.multiTransparency),this.axisColor=ee.of6(t.coordinateAxisColor,1-t.coordinateAxisTransparency),t.attach(this)}getRenderColor(){return this.m_color}get visible(){return this.gridParam.visible}set visible(o){this.gridParam.visible=o}setGridX(o){o>0&&this.gridParam.setGridX(o)}getGridX(){return this.gridParam.getGridX()}setGridY(o){o>0&&this.gridParam.setGridY(o)}getGridY(){return this.gridParam.getGridY()}setSnapX(o){o>0&&this.gridParam.setSnapX(o)}getSnapX(){return this.gridParam.getSnapX()}setSnapY(o){o>0&&this.gridParam.setSnapY(o)}getSnapY(){return this.gridParam.getSnapY()}getPointSize(){return this.gridParam.getPointSize()}setPointSize(o){this.gridParam.setPointSize(o)}get pattern(){return this.gridParam.pattern}modifyColor(o,t=o.alpha){this.m_color=ee.of6(o,t)}getRenderState(){let o=this.gridParam,t=o.getMultiStyle(),e=!1,r=!1,i=!1,n=!1,s=!1;if(this.visible==0&&t==2)return{showCoor:e,showLine:r,showBoldLine:i,showPoint:n,showBoldPoint:s};e=!0;let a=this.visible==2;return r=a&&o.pattern,n=a&&!o.pattern,i=t==0,s=t==1,{showCoor:e,showLine:r,showBoldLine:i,showPoint:n,showBoldPoint:s}}flush(){let o=this.gridParam;this.gridColor=this.getRenderColor(),this.boldColor=ee.of6(o.multiGridColor,1-o.multiTransparency),this.axisColor=ee.of6(o.coordinateAxisColor,1-o.coordinateAxisTransparency)}autoScale(o){let t=o.getScale(),e=this.gridParam,r=e.getGridX(),i=e.getGridY(),n=parseInt(e.getMultiRatio().toString()),s=r*n,a=i*n,l=Math.min(r,i),c=Math.min(s,a),h=l*t,u=c*t,d=5,p=20,m=P(h),g=P(u),y=r*t,b=i*t;return{stepX:y,stepY:b,multiRatio:n,gridAlphaRatio:m,multiGridAlphaRatio:g};function P(T){return T<=d?0:T>=p?1:(T-d)/(p-d)}}render(o,t,e){let r=this.gridParam.getMultiStyle();if(this.visible==0&&r==2)return;let{showCoor:i,showLine:n,showPoint:s,showBoldLine:a,showBoldPoint:l}=this.getRenderState(),c=this.getPointSize(),h=1;this.flush(),s&&(this.gridColor=this.gridColor.mulAlpha(2)),l&&(this.boldColor=this.boldColor.mulAlpha(2));let u=o.getContext(),d=e.multiply4(t.getRenderMatrix()),p=new S(d.x,d.y),m=u.canvas.width,g=u.canvas.height,{stepX:y,stepY:b,multiRatio:P,gridAlphaRatio:T,multiGridAlphaRatio:I}=this.autoScale(t),C=T==0,E=I==0,O=this.gridParam.renderCoordinateAxis;if(O&&(!(s||l||n||a)||C&&E)){o.setFillStyle(this.axisColor.toRGBAString()),u.fillRect(p.x,0,1,g),u.fillRect(0,p.y,m,1);return}let _=this.gridColor.mulAlpha(T).toRGBAString(),x=this.boldColor.mulAlpha(I).toRGBAString(),v=(D,w,F,H,z,V,W)=>{let L=z.getContext(),k=V?G=>{L.fillRect(G,0,h,H)}:G=>{L.fillRect(0,G,H,h)},{start:N,count:U,divisor:B}=e1e(D,w);for(;N<=F;N+=w){if(Math.abs(N-D)<=Number.EPSILON){U+=B;continue}!E&&W&&U%W===0?(z.setFillStyle(x),k(N)):!C&&n&&(z.setFillStyle(_),k(N)),U+=B}};if(s||l){let{start:D,count:w,divisor:F}=e1e(p.x,y),{start:H,count:z,divisor:V}=e1e(p.y,b);if(n||a){let W=a?P:void 0;v(p.x,y,m,g,o,!0,W),v(p.y,b,g,m,o,!1,W);let L=s?this.gridColor.mulAlpha(T):this.boldColor.mulAlpha(I);o.setFillStyle(L.toRGBAString());for(let k=D,N=w;k<=m;k+=y){for(let U=H,B=z;U<=g;U+=b){if(!E&&l&&N%P===0&&B%P===0){if(O&&(NK(k,p.x)||NK(U,p.y)))continue;u.fillRect(k,U,c*YK,c*YK)}else!C&&s&&u.fillRect(k,U,c,c);B+=V}N+=F}}else for(let W=D,L=w;W<=m;W+=y){for(let k=H,N=z;k<=g;k+=b)O&&(NK(W,p.x)||NK(k,p.y))||(!E&&l&&L%P===0&&N%P===0?(o.setFillStyle(x),u.fillRect(W,k,c*YK,c*YK)):!C&&s&&(o.setFillStyle(_),u.fillRect(W,k,c,c)),N+=V);L+=F}}else{let D=a?P:void 0;v(p.x,y,m,g,o,!0,D),v(p.y,b,g,m,o,!1,D)}O&&(o.setFillStyle(this.axisColor.toRGBAString()),u.fillRect(p.x,0,1,g),u.fillRect(0,p.y,m,1))}};function e1e(o,t){let e=iye(o,t),r=Math.floor(o/t),i=-1;return e<0&&(e=e+t,i=1,r=Math.abs(r)),{start:e,count:r,divisor:i}}var pit=class{constructor(o,t){this.gridParam=t}getStep(o){let t=10,e=o.getPxLength(),r=this.gridParam.radius/e;if(r<t)for(let i=0;;i++){let n=this.gridParam.radius*Math.pow(5,i);if(r=n/e,!(r<t))return n}return this.gridParam.radius}render(o,t,e,r,i){if(this.gridParam.visible!==2)return;let n=o.getContext();o.setLineWidth(1);let s=2,a=r?[.3,.8]:[.15,.4],l=[this.gridParam.minRadius,this.gridParam.maxRadius],c=this.getStep(t)*t.getScale(),h=l[1]*t.getScale(),u=l[0]*t.getScale(),d=i.multiply4(t.getRenderMatrix()),p=new S(d.x,d.y),m=Math.floor((h-u)/c);m<=1&&(u=0);let g=Math.ceil(this.gridParam.sweepAngle/this.gridParam.angleDelta),y=this.gridParam.sweepAngle===Math.PI*2?g:g+1,b=this.gridParam.startAngle,P=this.gridParam.angleDelta;if(this.gridParam.pattern){let T=ee.of6(e,a[1]),I=ee.of6(e,a[0]);o.setStrokeStyle(I.toRGBAString());for(let C=1;C<=m;C++){let E=u+C*c;n.beginPath(),n.arc(p.x,p.y,E,0,2*Math.PI),n.stroke(),n.closePath()}o.save(),o.setFillStyle(T.toRGBAString()),o.setTranslate(p.x,p.y);for(let C=0;C<y;C++)o.setRotate(Math.PI*2-(C==0?b:P)),n.fillRect(u,0,h,1);o.restore(),u>0&&(o.setStrokeStyle(I.toRGBAString()),n.beginPath(),n.arc(p.x,p.y,u,0,2*Math.PI),n.closePath(),n.stroke())}else{let T=ee.of6(e,a[1]);o.setFillStyle(T.toRGBAString());for(let I=0;I<m+1;I++){let C=u+I*c;for(let E=0;E<y;E++){let O=Math.PI*2-(b+E*P),_=p.x+C*Math.cos(O),x=p.y+C*Math.sin(O);n.fillRect(_,x,s,s)}}}}},fit=class{constructor(){this.spacing=10,this.patternMap=new Map,this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d")}setSpacing(o){this.spacing=o}updateSize(o,t){this.canvas.width=o,this.canvas.height=t}renderGrid(o,t){let e=this.spacing/t;this.updateSize(e+1,e+1),this.context.strokeStyle=o,this.context.beginPath(),this.context.moveTo(0,e),this.context.lineTo(this.canvas.width,e),this.context.stroke(),this.context.beginPath(),this.context.moveTo(e,0),this.context.lineTo(e,this.canvas.height),this.context.stroke();let r=this.context.createPattern(this.canvas,"repeat");return this.patternMap.get(2).set(`${o}-${t}`,r),r}renderHorizontalLine(o,t){let e=this.spacing/t;this.updateSize(1,e+1),this.context.strokeStyle=o,this.context.beginPath(),this.context.moveTo(0,e),this.context.lineTo(1,e),this.context.stroke();let r=this.context.createPattern(this.canvas,"repeat");return this.patternMap.get(3).set(`${o}-${t}`,r),r}renderVerticalLine(o,t){let e=this.spacing/t;this.updateSize(e+1,1),this.context.strokeStyle=o,this.context.beginPath(),this.context.moveTo(e,0),this.context.lineTo(e,1),this.context.stroke();let r=this.context.createPattern(this.canvas,"repeat");return this.patternMap.get(4).set(`${o}-${t}`,r),r}renderRhombicGrid(o,t){let e=this.spacing/t;this.updateSize(Math.max(e,1),Math.max(e,1)),this.context.strokeStyle=o,this.context.beginPath(),this.context.moveTo(0,e),this.context.lineTo(e,0),this.context.stroke(),this.context.beginPath(),this.context.moveTo(0,0),this.context.lineTo(e,e),this.context.stroke();let r=this.context.createPattern(this.canvas,"repeat");return this.patternMap.get(5).set(`${o}-${t}`,r),r}renderLeftSlashLine(o,t){let e=this.spacing/t;this.updateSize(Math.max(e,1),Math.max(e,1)),this.context.strokeStyle=o,this.context.beginPath(),this.context.moveTo(0,e),this.context.lineTo(e,0),this.context.stroke();let r=this.context.createPattern(this.canvas,"repeat");return this.patternMap.get(6).set(`${o}-${t}`,r),r}renderRightSlashLine(o,t){let e=this.spacing/t;this.updateSize(Math.max(e,1),Math.max(e,1)),this.context.strokeStyle=o,this.context.beginPath(),this.context.moveTo(0,0),this.context.lineTo(e,e),this.context.stroke();let r=this.context.createPattern(this.canvas,"repeat");return this.patternMap.get(7).set(`${o}-${t}`,r),r}getCatchPattern(o,t,e){let r=this.patternMap.get(o);if(r){let i=r.get(`${t}-${e}`);if(i)return i}else{let i=new Map;this.patternMap.set(o,i)}return null}getPattern(o,t,e){let r=this.getCatchPattern(o,t,e);if(r)return r;switch(o){case 2:return this.renderGrid(t,e);case 3:return this.renderHorizontalLine(t,e);case 4:return this.renderVerticalLine(t,e);case 5:return this.renderRhombicGrid(t,e);case 6:return this.renderLeftSlashLine(t,e);case 7:return this.renderRightSlashLine(t,e)}}},mit=class{constructor(o,t){this.x=o,this.y=t,this.indexsArr=new Array(0),this.bitmaps=new Array(0),this.highLightNum=0}getPtNum(){return this.bitmaps.reduce((o,t)=>o+(t==null?void 0:t.getMarked())||0,0)}getSdfStringInfo(o){return this.blockGPU.getSdfStringInfo(o)}addHighLightPt(o,t,e,r){this.blockGPU.addHighLightPt(o,this.indexsArr[o][t],e,r)}removeHighLightPt(o,t,e,r){return this.blockGPU.removeHighLightPt(o,this.indexsArr[o][t],e,r)}getHighLightInfo(o,t){return this.blockGPU.getHighLightInfo(o,this.indexsArr[o][t])}getHighLightIdNum(o,t,e){return this.blockGPU.getHighLightIdInfo(o,this.indexsArr[o][t],e)}removeHighLightPtAll(o,t,e,r){let i=this.blockGPU.removeHighLightPtAll(o,this.indexsArr[o][t],e,r);return this.highLightNum-=i,i}addHighLightPtAll(o,t,e){let r=this.blockGPU.addHighLightPtAll(o,this.indexsArr[o][t],e);return this.highLightNum+=r,r}setHighLightPtNum(o,t,e,r,i){let{operate:n,highLightNum:s}=this.blockGPU.setHighLightPtNum(o,this.indexsArr[o][t],e,r,i);return n==="add"?this.highLightNum+=s:n==="remove"&&(this.highLightNum-=s),{operate:n,highLightNum:s}}initBitmap(o){this.indexsArr[o]=[];let t=new Xm(32);return this.bitmaps[o]=t,t.addTrimListener(e=>{this.indexsArr[o].length=e}),t}addPt(o,t){let e=this.bitmaps[o];e==null&&(e=this.initBitmap(o));let r=e.findEmpty();return r===-1&&(this.bitmaps[o]=e=e.extSize(e.size*2),r=e.findEmpty()),e.markUsed(r),this.indexsArr[o][r]=this.blockGPU.addPt(o,t),r}removePt(o,t){var e;this.blockGPU.removePt(o,this.indexsArr[o][t]),delete this.indexsArr[o][t],(e=this.bitmaps[o])==null||e.markRemove(t)}updatePt(o,t,e){return this.blockGPU.updatePt(o,this.indexsArr[o][t],e)}getPt(o,t){return this.blockGPU.getPt(o,this.indexsArr[o][t])}getStringInfo(o,t){return this.blockGPU.getStringInfo(this.indexsArr[10][o],t)}setPtVisible(o,t,e){return this.blockGPU.setPtVisible(o,this.indexsArr[o][t],e)}setPtBlockGPU(o){o.addPts(this.blockGPU,this.indexsArr),this.blockGPU=o}getLoc(){return this.blockGPU.loc}},LT=3,git=class{constructor(o,t,e,r){this.plane=o,this.builders=[],this.bitmaps=[],this.ptInfoBuilder=new XE(Float32Array),this.ptIdAndHighLightColorIndexMap=new Map,this.highLightGroupIds=[],this.createBuilder=t,this.createHighLightIdsBuilder=r,this.staticPolygonInfoBuilder=e,this.bitmapIndex=new Xm(32)}clear(){this.builders.length=0,this.bitmaps.length=0,this.bitmapIndex=new Xm(32),this.ptInfoBuilder.clear(),this.ptIdAndHighLightColorIndexMap.clear(),this.highLightGroupIds.length=0}getPolygonPtId(o,t,e){let r=this.bitmapIndex.getMax()+1,i;for(let n=0;n<r;n++){let s=this.ptInfoBuilder.get(n*LT),a=this.ptInfoBuilder.get(n*LT+1),l=this.ptInfoBuilder.get(n*LT+2);if(s===o&&l===e&&a===t){i=n;break}}if(i===void 0)throw new Error("getPolygonPtId error");return i}addHighLightPt(o,t,e,r){let{colorIndex:i,ptIndex:n}=this.getColorAndIndex(t);this.highLightGroupIds[e]||(this.highLightGroupIds[e]=[]),this.highLightGroupIds[e][i]||(this.highLightGroupIds[e][i]=[]),this.highLightGroupIds[e][i][r]||(this.highLightGroupIds[e][i][r]=[]),this.highLightGroupIds[e][i][r][o]||(this.highLightGroupIds[e][i][r][o]=new SZ(this.createHighLightIdsBuilder(o)));let s=this.ptIdAndHighLightColorIndexMap.get(t);if(s!=null&&s.length)s[e]?s[e].push(r):s[e]=[r],this.ptIdAndHighLightColorIndexMap.set(t,s);else{let a=[];a[e]=[r],this.ptIdAndHighLightColorIndexMap.set(t,a)}this.highLightGroupIds[e][i][r][o].add(n,r)}removeHighLightPt(o,t,e,r){let{colorIndex:i,ptIndex:n}=this.getColorAndIndex(t),s=0;if(r!==void 0)s=this.highLightGroupIds[e][i][r][o].remove(n,r);else{let l=this.ptIdAndHighLightColorIndexMap.get(t);for(let c=0;c<l.length;c+=1)s+=this.highLightGroupIds[e][i][l[e][c]][o].remove(n,r)}let a=this.ptIdAndHighLightColorIndexMap.get(t);return a[e].forEach((l,c)=>{l===r&&a[e].splice(c,1)}),this.ptIdAndHighLightColorIndexMap.set(t,a),s}getHighLightInfo(o,t){return F1e(this.ptIdAndHighLightColorIndexMap.get(t))||[]}getHighLightIdNum(o,t,e){var r;return((r=this.ptIdAndHighLightColorIndexMap.get(t))==null?void 0:r[e])||[]}getPtNum(o,t){var e;return((e=this.bitmaps[o][t])==null?void 0:e.getMarked())||0}createPtId(){let o=this.bitmapIndex.findEmpty();return o===-1&&(this.bitmapIndex=this.bitmapIndex.extSize(this.bitmapIndex.size*2),o=this.bitmapIndex.findEmpty()),this.bitmapIndex.markUsed(o),o}getColorIndex(o,t){let e;switch(o){case 6:e=t[8];break;case 7:e=t[11];break;case 8:e=this.staticPolygonInfoBuilder.get(t[7]*sd+7);break;case 9:e=this.staticPolygonInfoBuilder.get(t[10]*sd+7);break;case 26:case 27:case 28:case 29:case 41:case 42:case 43:case 44:if(e=t[3],e==0){let r=this.plane.builder.getTemplatePt(t[1],Fr.getTemplateTypeByTemplateInstanceType(o));e=Fr.getColorIndex(r,0,this.staticPolygonInfoBuilder)}break;default:throw new Error("PtType is error")}return e}addPt(o,t){var e;let r=this.getColorIndex(o,t),i=(e=this.bitmaps[r])==null?void 0:e[o],n=Fr.getPtLengthByType(o);if(!i){!this.bitmaps[r]&&(this.bitmaps[r]=[]),this.bitmaps[r][o]=i=new Xm(32),!this.builders[r]&&(this.builders[r]=[]);let l=this.builders[r][o]=this.createBuilder(o);i.addTrimListener(c=>{l.trimChunk(c*n)})}let s=i.findEmpty();s===-1&&(this.bitmaps[r][o]=i=i.extSize(i.size*2),s=i.findEmpty()),i.markUsed(s),this.builders[r][o].setArr(t,s*Fr.getPtLengthByType(o));let a=this.createPtId();return this.ptInfoBuilder.set(a*LT,r),this.ptInfoBuilder.set(a*LT+1,s),this.ptInfoBuilder.set(a*LT+2,o),a}updatePt(o,t,e){let{colorIndex:r,ptIndex:i}=this.getColorAndIndex(t),n=this.getColorIndex(o,e);return r===n?this.builders[n][o].setArr(e,i*Fr.getPtLengthByType(o)):(this.removePt(o,t),t=this.addPt(o,e)),t}getBuildersByColorIndex(o){return this.builders[o]}getBuilders(){return this.builders}getMaxLength(o,t){var e,r;return(r=(e=this.bitmaps)==null?void 0:e[t])!=null&&r[o]?this.bitmaps[t][o].getMax()+1:0}getPt(o,t){let{colorIndex:e,ptIndex:r}=this.getColorAndIndex(t),i=Fr.getPtLengthByType(o);return this.builders[e][o].slice(r*i,(r+1)*i)}getColorAndIndex(o){if(o*LT+1>this.ptInfoBuilder.getLength())throw new Error("id error");let t=this.ptInfoBuilder.get(o*LT),e=this.ptInfoBuilder.get(o*LT+1);if(t==-1||e==-1)throw new Error("id error");return{colorIndex:t,ptIndex:e}}removePt(o,t){let{colorIndex:e,ptIndex:r}=this.getColorAndIndex(t);this.builders[e][o].set(r*Fr.getPtLengthByType(o),0),this.bitmaps[e][o].markRemove(r),this.ptInfoBuilder.set(t*LT,-1),this.ptInfoBuilder.set(t*LT+1,-1),this.ptInfoBuilder.set(t*LT+2,-1),this.bitmapIndex.markRemove(t)}setPtVisible(o,t,e){let r,i=!1,{colorIndex:n,ptIndex:s}=this.getColorAndIndex(t),a=Fr.getPtLengthByType(o),l=this.builders[n][o],c=s*a,h=(l.get(c)&cs)!==0;return e!==h&&(e?l.set(c,l.get(c)|cs):l.set(c,l.get(c)&TH),r=l.slice(c,c+Fr.getPtLengthByType(o)),i=!0),{ptData:r,isUpdate:i}}},jK=3,bw=class extends kye{constructor(o,t,e,r,i,n){super(s=>ym.create(Float32Array,o,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,`ptsBuf${s} of builder`),-3,-2,s=>ym.create(Int32Array,o,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX,`${s} highLightIds of builder`)),this.sdfStringInfoBuilder=t,this.renderHighLightPtProgram=e,this.loc=r,this.staticPolygonInfoBuilder=i,this.plane=n,this.highLightBindGroups=[],this.polygonHighLightBindGroups=[],this.stringHighLightBindGroups=[],this.templateStringHighLightBindGroups=[],this.polygonPtManager=new git(n,s=>ym.create(Float32Array,o,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,`ptsBuf${s} of polygonPtManager builders`),i,s=>ym.create(Int32Array,o,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX,`${s} highLightIds of polygonPtManager`))}addHighLightPt(o,t,e,r){if(Fr.isNormalPolygonType(o)){this.polygonPtManager.addHighLightPt(o,t,e,r);return}super.addHighLightPt(o,t,e,r)}removeHighLightPt(o,t,e,r){return Fr.isNormalPolygonType(o)?this.polygonPtManager.removeHighLightPt(o,t,e,r):super.removeHighLightPt(o,t,e,r)}getPolygonHighLightIds(o){var t;return(t=this.polygonPtManager.highLightGroupIds)==null?void 0:t[o]}getHighLightInfo(o,t){return Fr.isNormalPolygonType(o)?this.polygonPtManager.getHighLightInfo(o,t):super.getHighLightInfo(o,t)}getHighLightIdInfo(o,t,e){return Fr.isNormalPolygonType(o)?this.polygonPtManager.getHighLightIdNum(o,t,e):super.getHighLightIdInfo(o,t,e)}getPolygonPtNum(o,t){return this.polygonPtManager.getPtNum(o,t)}addPt(o,t){if(Fr.isNormalPolygonType(o))return this.polygonPtManager.addPt(o,t);if(o===18){let e=this.createId(o,t);return this.addSdfString(t,e),e}return super.addPt(o,t,this.getDataPtLength(o))}addSdfString(o,t){let e=o[1],[r]=this.sdfStringInfoBuilder.slice(e,(e+1)*Hit),i=this.sdfStrBitmaps[r];if(!i){this.sdfStrBitmaps[r]=i=new Xm(32);let s=this.sdfStrBuilders[r]=this.createBuilder(18);this.sdfStrBitmaps[r].addTrimListener(a=>{s.trimChunk(a*Cw.length)})}let n=i.findEmpty();n===-1&&(this.sdfStrBitmaps[r]=i=i.extSize(i.size*2),n=i.findEmpty()),i.markUsed(n),this.sdfStrBuilders[r].setArr(o,n*Cw.length),this.builders[18].setArr([n,e,r],t*jK)}updatePt(o,t,e){if(o===18){let{pt:r,bufIndex:i,index:n}=this.getSdfStringInfo(t);return e[1]==r[1]?this.sdfStrBuilders[i].setArr(e,n*Cw.length):(this.removeSdfString(t),this.addSdfString(e,t)),t}else if(Fr.isNormalPolygonType(o))return this.polygonPtManager.updatePt(o,t,e);return super.updatePt(o,t,e)}removeSdfString(o){let{pt:t,bufIndex:e,index:r}=this.getSdfStringInfo(o);this.sdfStrBuilders[e].set(r*Cw.length,0),this.sdfStrBitmaps[e].markRemove(r)}getSdfStringInfo(o){let[t,e,r]=this.builders[18].slice(o*jK,(o+1)*jK),i=Fr.getPtLengthByType(18);return{pt:this.sdfStrBuilders[r].slice(t*i,(t+1)*i),bufIndex:r,index:t,strIndex:e}}removePt(o,t){if(Fr.isNormalPolygonType(o)){this.polygonPtManager.removePt(o,t);return}else if(o===18){this.removeSdfString(t),this.bitmaps[o].markRemove(t);return}super.removePt(o,t)}getPt(o,t){return Fr.isNormalPolygonType(o)?this.polygonPtManager.getPt(o,t):o===18?this.getSdfStringInfo(t).pt:super.getPt(o,t)}setPtVisible(o,t,e){if(Fr.isNormalPolygonType(o))return this.polygonPtManager.setPtVisible(o,t,e);if(o===18){let r,i=!1,n,{pt:s,bufIndex:a,strIndex:l,index:c}=this.getSdfStringInfo(t),h=this.sdfStrBuilders[a];n=c*Fr.getPtLengthByType(o);let u=(h.get(n)&cs)!==0;if(e!==u){e?h.set(n,h.get(n)|cs):h.set(n,h.get(n)&TH),i=!0;let d=Fr.getPtLengthByType(18);r=this.sdfStrBuilders[a].slice(c*d,(c+1)*d)}return{ptData:r,isUpdate:i}}return super.setPtVisible(o,t,e)}getPolygonHighLightBindGroup(o,t,e){return this.polygonHighLightBindGroups[o]||(this.polygonHighLightBindGroups[o]=[]),this.polygonHighLightBindGroups[o][t]?(this.getPolygonBuildersByColorIndex(o)[t].updateBuf(),Fr.isTemplateInstancePtType(t)?e.getBuilders()[Fr.getTemplateTypeByTemplateInstanceType(t)].updateBuf():this.getPolygonBuildersByColorIndex(o)[t].updateBuf()):this.polygonHighLightBindGroups[o][t]=this.initHighLightPolygonBindGroup(o,t,e),this.polygonHighLightBindGroups[o][t]}getStringHighLightBindGroup(o,t){return this.stringHighLightBindGroups[o]?t.updateBuf():this.stringHighLightBindGroups[o]=this.initStringBindGroup(t),this.stringHighLightBindGroups[o]}getTemplateStringHighLightBindGroup(o,t,e){return this.templateStringHighLightBindGroups[o]?(t.updateBuf(),e.getStringBuilders()[o].updateBuf()):this.templateStringHighLightBindGroups[o]=this.initTemplateStringBindGroup(t,e.getStringBuilders()[o]),this.templateStringHighLightBindGroups[o]}getPolygonBuildersByColorIndex(o){return this.polygonPtManager.getBuildersByColorIndex(o)}getPolygonBuilders(){return this.polygonPtManager.getBuilders()}getPolygonMaxLength(o,t){return this.polygonPtManager.getMaxLength(o,t)}getHighLightBindGroup(o,t){return this.highLightBindGroups[o]?(this.getBuilders()[o].updateBuf(),Fr.isTemplateInstancePtType(o)?t.getBuilders()[Fr.getTemplateTypeByTemplateInstanceType(o)].updateBuf():this.getBuilders()[o].updateBuf()):this.highLightBindGroups[o]=this.initRenderHighLightBindGroup(o,t),this.highLightBindGroups[o]}getHighLightBindGroup0(o){return this.highLightBindGroups[o]?this.getBuilders()[o].updateBuf():this.highLightBindGroups[o]=this.initRenderHighLightBindGroup0(o),this.highLightBindGroups[o]}initHighLightPolygonBindGroup(o,t,e){return this.renderHighLightPtProgram.createDynamicBindGroup(this.getPolygonBuildersByColorIndex(o)[t].updateBuf(),Fr.isTemplateInstancePtType(t)?e.getBuilders()[Fr.getTemplateTypeByTemplateInstanceType(t)].updateBuf():this.getPolygonBuildersByColorIndex(o)[t].updateBuf())}initStringBindGroup(o){return this.renderHighLightPtProgram.createDynamicBindGroup(o.updateBuf(),o.updateBuf())}initTemplateStringBindGroup(o,t){return this.renderHighLightPtProgram.createDynamicBindGroup(o.updateBuf(),t.updateBuf())}initRenderHighLightBindGroup(o,t){return this.renderHighLightPtProgram.createDynamicBindGroup(this.getBuilders()[o].updateBuf(),Fr.isTemplateInstancePtType(o)?t.getBuilders()[Fr.getTemplateTypeByTemplateInstanceType(o)].updateBuf():this.getBuilders()[o].updateBuf())}initRenderHighLightBindGroup0(o){let t=this.getBuilders()[o].updateBuf();return this.renderHighLightPtProgram.createDynamicBindGroup(t,t)}addPts(o,t){o&&t.forEach((e,r)=>{e.forEach((i,n)=>{let s=o.getHighLightInfo(r,i);e[n]=this.addPt(r,o.getPt(r,i)),s.length&&this.addHighLightPtAll(r,e[n],s)})})}getDataPtLength(o){let t;return o===10||o===60||o===30?t=1:o===18?t=jK:t=Fr.getPtLengthByType(o),t}createId(o,t){return super.createId(o,t,this.getDataPtLength(o))}getPolygonPtId(o,t,e){return this.polygonPtManager.getPolygonPtId(o,t,e)}reverseGetPtDataCalGrid(o,t){for(let e=0;e<this.getBuilders().length;e++){let r=this.getMaxLength(e)-1;for(;r>=0;){if(!this.bitmaps[e].isUsed(r)){r-=1;continue}let i=this.getPt(e,r);if(i[0]==0){r-=1;continue}if(o(i,e,r))return;r-=1}}t()}destroy(){this.builders.forEach(o=>o.destroy()),this.strBuilders.forEach(o=>o.destroy()),this.sdfStrBuilders.forEach(o=>o.destroy()),this.highLightGroupIds.forEach(o=>o.forEach(t=>t.getData().destroy())),this.stringHighLightGroupIds.forEach(o=>o.forEach(t=>t.getData().destroy())),this.templateStrBuilders.forEach(o=>o.destroy()),this.customTemplateStrBuilders.forEach(o=>o.destroy()),this.highLightBindGroups.forEach(o=>o.destroy()),this.polygonHighLightBindGroups.forEach(o=>o.forEach(t=>t.destroy())),this.polygonPtManager.getBuilders().forEach(o=>o.forEach(t=>t.destroy())),this.polygonPtManager.highLightGroupIds.forEach(o=>o.forEach(t=>t.forEach(e=>e.forEach(r=>r.getData().destroy())))),this.stringHighLightBindGroups.forEach(o=>o.destroy()),this.templateStringHighLightBindGroups.forEach(o=>o.destroy())}clear(){this.destroy(),super.clear(),this.highLightBindGroups.length=0,this.polygonHighLightBindGroups.length=0,this.polygonPtManager.clear(),this.stringHighLightBindGroups.length=0}},t1e=class extends kye{constructor(o,t,e,r,i,n){super(s=>ym.create(Float32Array,o,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,`ptsBuf${s} of builder`),-3,-2,s=>ym.create(Int32Array,o,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX,`${s} highLightIds of builder`)),this.sdfStringInfoBuilder=t,this.renderHighLightPtProgram=e,this.loc=r,this.staticPolygonInfoBuilder=i,this.plane=n,this.bindGroups=[],this.stringBindGroups=[]}addPt(o,t){return super.addPt(o,t,this.getDataPtLength(o))}getStringPt(o){let t=o&EZ,e=o>>RC;return this.strBuilders[t].slice(e*VZ.length,(e+1)*VZ.length)}initBindGroup(o){return this.getBuilders()[o]||(this.builders[o]=this.createBuilder(o)),this.plane.createDynamicBindGroup(this.getBuilders()[o].updateBuf())}getBindGroup(o){return this.bindGroups[o]?this.getBuilders()[o].updateBuf():this.bindGroups[o]=this.initBindGroup(o),this.bindGroups[o]}initStringTemplateBindGroup(o){return this.strBuilders[o]||(this.strBuilders[o]=this.createBuilder(60)),this.plane.createDynamicBindGroup(this.strBuilders[o].updateBuf())}getStringTemplateBindGroup(o){return this.stringBindGroups[o]?this.strBuilders[o].updateBuf():this.stringBindGroups[o]=this.initStringTemplateBindGroup(o),this.stringBindGroups[o]}getDataPtLength(o){let t;return o===10||o===60?t=1:t=Fr.getPtLengthByType(o),t}createId(o,t){return super.createId(o,t,this.getDataPtLength(o))}destroy(){this.builders.forEach(o=>o.destroy()),this.strBuilders.forEach(o=>o.destroy()),this.sdfStrBuilders.forEach(o=>o.destroy()),this.highLightGroupIds.forEach(o=>o.forEach(t=>t.getData().destroy())),this.stringHighLightGroupIds.forEach(o=>o.forEach(t=>t.getData().destroy())),this.bindGroups.forEach(o=>o.destroy()),this.stringBindGroups.forEach(o=>o.destroy())}clear(){this.destroy(),super.clear(),this.bindGroups.length=0,this.stringBindGroups.length=0}},m2e=6,zve=m2e-1,yit=2**16,bit=10,r1e=5,Yve=28,jve=14,Xve=class bwe extends aDe{constructor(t,e,r){super(),this.recordGridNum=e,this.plane=r,this.grid=new Map,this.bufGrids=new Array(m2e).fill(0).map(()=>new Map),this.isProcessing=!1,this.defaultBlockIndexIdMap=new Array(69).fill(0).map(()=>new Map),this.locInfosArr=new Array(69).fill(0).map(()=>[]),this.scene=t,this.block=new bw(t.gpu,t.sdfStringInfoBuilder,t.renderHighLightPtProgram,{level:-1,x:0,y:0},t.staticPolygonInfoBuilder,r),this.defaultBlock=new bw(t.gpu,t.sdfStringInfoBuilder,t.renderHighLightPtProgram,{level:-2,x:0,y:0},t.staticPolygonInfoBuilder,r),this.templateBlock=new t1e(t.gpu,t.sdfStringInfoBuilder,t.renderHighLightPtProgram,{level:-3,x:0,y:0},t.staticPolygonInfoBuilder,r),this.MIN_WH=t.getMinWh(),this.MIN_WH2=this.MIN_WH/2}isBigLevel(t){return t<-8||t>7}isBigLoc(t,e){return t<-8192||t>8191||e<-8192||e>8191}getBlockLocInfo(t,e=0,r=0){let i=t+8,n=e+8192,s=r+8192;return(i<<Yve)+(n<<jve)+s}expandLocLevel(t){let e=(t>>>Yve)-8,r=(t>>>jve&16383)-8192,i=(t&16383)-8192;return{level:e,x:r,y:i}}getAllPtBlock(){let{bufGrids:t,block:e,defaultBlock:r,templateBlock:i}=this,n=[r,e];return t.forEach(s=>{s.forEach(a=>{a.forEach(l=>{n.push(l)})})}),n}getInfo(t){let e=bwe.getTypeById(t),r=this.getIndexsArrIndex(t),i=this.locInfosArr[e][r],{level:n,x:s,y:a}=this.expandLocLevel(i);return n===-1?{block:this.block,type:e,ptId:r,level:n,index:this.indexsArr[e][r]}:n===-2?{block:this.defaultBlock,type:e,ptId:r,level:n,index:this.indexsArr[e][r]}:n===-3?{block:this.templateBlock,type:e,ptId:r,level:n,index:this.indexsArr[e][r]}:{block:this.grid.get(s).get(a),type:e,ptId:r,level:n,x:s,y:a,index:this.indexsArr[e][r]}}clear(){this.clearArrData(),this.locInfosArr.forEach(t=>t.length=0),this.grid.clear(),this.bufGrids.forEach(t=>t.forEach(e=>e.forEach(r=>r.destroy()))),this.bufGrids.forEach(t=>t.clear()),this.block.clear(),this.defaultBlock.clear(),this.defaultBlockIndexIdMap.forEach(t=>t.clear()),this.isProcessing=!1,this.templateBlock.clear()}getTemplatePt(t,e){return e===60?this.templateBlock.getStringPt(t):this.templateBlock.getPt(e,t)}addBufs(t,e){let r=this.bufGrids[t.level].get(t.x);if(r){let i=r.get(t.y);i||(i=new bw(this.scene.gpu,this.scene.sdfStringInfoBuilder,this.scene.renderHighLightPtProgram,t,this.scene.staticPolygonInfoBuilder,this.plane),r.set(t.y,i)),e.setPtBlockGPU(i)}else{r=new Map,this.bufGrids[t.level].set(t.x,r);let i=new bw(this.scene.gpu,this.scene.sdfStringInfoBuilder,this.scene.renderHighLightPtProgram,t,this.scene.staticPolygonInfoBuilder,this.plane);e.setPtBlockGPU(i),r.set(t.y,i)}}getBufLoc(t,e){var r;for(let i=0;i<zve;i++){if(((r=this.scene.numGrids[i].get(t))==null?void 0:r.get(e))!==void 0)return{level:i,x:t,y:e};t=Math.floor(t/2),e=Math.floor(e/2)}return{level:zve,x:t,y:e}}initPtIndexBlock(t,e){let r=new mit(t,e);return this.addBufs(this.getBufLoc(t,e),r),r}adjustGridInfo(t,e,r){let i=this.calGrid(t,this.scene.staticPolygonInfoBuilder),{block:n,locInfo:s}=i,a=this.getIndexsArrIndex(this.defaultBlockIndexIdMap[e].get(r)),l=n.addPt(e,t);this.indexsArr[e][a]=l,this.locInfosArr[e][a]=s;let c=this.defaultBlock.getHighLightInfo(e,r);return c.length&&(this.defaultBlock.removeHighLightPtAll(e,r,c),n.addHighLightPtAll(e,l,c)),this.defaultBlockIndexIdMap[e].delete(r),this.defaultBlock.removePt(e,r),this.addGridNum(n)}processData(){let t=performance.now();if(this.scene.toSplitLoc){for(let r of this.scene.planes)if(r.builder.split0(this.scene.toSplitLoc),performance.now()-t>=r1e){setTimeout(()=>this.processData());return}delete this.scene.toSplitLoc}let e=0;this.scene.processDefaultBlockData=!0,this.defaultBlock.reverseGetPtDataCalGrid((r,i,n)=>{let s=this.adjustGridInfo(r,i,n);if(++e%1e3===0&&performance.now()-t>=bit)return setTimeout(()=>this.processData()),!0;if(s){if(performance.now()-t>=r1e)return setTimeout(()=>this.processData()),!0;for(let a of this.scene.planes)if(a.builder.split0(this.scene.toSplitLoc),performance.now()-t>=r1e)return setTimeout(()=>this.processData()),!0;delete this.scene.toSplitLoc}},()=>{this.isProcessing=!1})}processCalGrid(){this.isProcessing||(this.isProcessing=!0,setTimeout(()=>this.processData()))}getDefaultBlockInfo(t){let e=Fr.getType(t[0]);return Fr.isTemplateOriginPtType(e)?{block:this.templateBlock,type:e,level:-3}:{block:this.defaultBlock,type:e,level:-2}}calGrid(t,e,r=this.plane.getPtBBox(t,void 0,e)){let i,n,s,a=-1,l=this.MIN_WH;if(!this.scene.getUseGridAccelerate())s=this.block;else{let h=r.width(),u=r.height();if(a=Math.floor(Math.log2(Math.max(h,u)/l)),a<0?a=0:a===0?(h>l&&Math.floor(r.minX/l+.5)!==Math.floor(r.maxX/l-.5)||u>l&&Math.floor(r.minY/l+.5)!==Math.floor(r.maxY/l-.5))&&(a=-1):a=-1,a===-1)s=this.block;else{let d=r.center();if(i=Math.floor(d.x/l),n=Math.floor(d.y/l),this.isBigLoc(i,n))a=-1,s=this.block,i=0,n=0;else{let p=this.grid.get(i);if(p)s=p.get(n),s||(s=this.initPtIndexBlock(i,n),p.set(n,s));else{p=new Map,this.grid.set(i,p),s=this.initPtIndexBlock(i,n),p.set(n,s);let m=s.getLoc(),g=this.scene.numGrids[m.level];g.get(m.x)||g.set(m.x,new Map)}}}}let c=Fr.getType(t[0]);return{block:s,type:c,locInfo:this.getBlockLocInfo(a,i,n)}}addPt(t,e,r,i,n=this.getDefaultBlockInfo(t)){let{type:s,block:a,level:l}=n,c=a.addPt(s,t);if(r===void 0){let h=this.getIndex(s);r=(h<<K7)+s,this.indexsArr[s][h]=c,this.locInfosArr[s][h]=this.getBlockLocInfo(l),this.ptNum++}else{let h=this.getIndexsArrIndex(r);this.indexsArr[s][h]=c,this.locInfosArr[s][h]=this.getBlockLocInfo(l)}return l===-2&&(this.defaultBlockIndexIdMap[s].set(c,r),this.processCalGrid()),this.scene.needRender=!0,r}addHighLightPt(t,e,r){let{block:i,index:n,type:s}=this.getInfo(t);return i.addHighLightPt(s,n,e,r),this.scene.needRender=!0,null}removeHighLightPt(t,e,r){let{block:i,index:n,type:s}=this.getInfo(t),a=0;if(e||e==0)a=i.removeHighLightPt(s,n,e,r);else{let l=i.getHighLightInfo(s,n);a=i.removeHighLightPtAll(s,n,l,r)}return this.scene.needRender=!0,{pt:null,num:a}}setHighLightPtNum(t,e,r,i){let{block:n,index:s,type:a}=this.getInfo(t);return n.setHighLightPtNum(a,s,e,r,i),this.scene.needRender=!0,null}split0(t){var e;let r=(e=this.bufGrids[t.level].get(t.x))==null?void 0:e.get(t.y);if(!r)return;this.bufGrids[t.level].get(t.x).delete(t.y),r.destroy();let i=t.x*2**t.level,n=(t.x+1)*2**t.level,s=t.y*2**t.level,a=(t.y+1)*2**t.level;for(let l=i;l<n;l++){let c=this.grid.get(l);if(c)for(let h=s;h<a;h++){let u=c.get(h);if(!u)continue;let d=this.getBufLoc(l,h);if(this.addBufs(d,u),this.recordGridNum){let p=this.scene.numGrids[d.level].get(d.x);p.set(d.y,(p.get(d.y)||0)+u.getPtNum())}}}}split(t){if(t.level===0)return!1;this.scene.numGrids[t.level].get(t.x).delete(t.y);let e=this.scene.numGrids[t.level-1];return e.get(t.x*2)||e.set(t.x*2,new Map),e.get(t.x*2).set(t.y*2,0),e.get(t.x*2).set(t.y*2+1,0),e.get(t.x*2+1)||e.set(t.x*2+1,new Map),e.get(t.x*2+1).set(t.y*2,0),e.get(t.x*2+1).set(t.y*2+1,0),this.scene.toSplitLoc=t,!0}decGridNum(t,e=1){if(!this.recordGridNum||t instanceof bw||t instanceof t1e)return;let r=t.getLoc(),i=this.scene.numGrids[r.level].get(r.x);i.set(r.y,i.get(r.y)-e)}addGridNum(t,e=1){if(!this.recordGridNum||t instanceof bw||t instanceof t1e)return;let r=t.getLoc(),i=this.scene.numGrids[r.level].get(r.x),n=(i.get(r.y)||0)+e;return i.set(r.y,n),n>yit?this.split(r):!1}removePt(t){let e=!1,{block:r,index:i,type:n,level:s,x:a,y:l,ptId:c}=this.getInfo(t),h=r.getPt(n,i),u=r.getHighLightInfo(n,i);return u.length&&(e=!0,r.removeHighLightPtAll(n,i,u)),r.removePt(n,i),s===-2&&this.defaultBlockIndexIdMap[n].delete(i),delete this.indexsArr[n][c],delete this.locInfosArr[n][c],this.bitmaps[n].markRemove(c),this.ptNum--,this.decGridNum(r),this.scene.needRender=!0,{oldPt:h,isHighLightPt:e,highLightInfo:u}}getSdfPtInfo(t){}updatePt(t,e,r,i){let n=!1,{block:s,index:a,type:l,level:c,x:h,y:u}=this.getInfo(t),d=s.getPt(l,a),p=this.getDefaultBlockInfo(e),m=s.getHighLightInfo(l,a);if(s===p.block&&l===p.type){if(l!==8&&l!==9){let g=this.getIndexsArrIndex(t),y=s.updatePt(l,a,e),b=this.indexsArr[l][g];this.indexsArr[l][g]=y,c===-2&&(this.defaultBlockIndexIdMap[l].delete(b),this.defaultBlockIndexIdMap[l].set(y,t)),m.length&&(n=!0)}}else if(m.length&&(s.removeHighLightPtAll(l,a,m),n=!0),this.decGridNum(s),s.removePt(l,a),c===-2&&this.defaultBlockIndexIdMap[l].delete(a),this.addPt(e,r,t,i,p),m.length){let{block:g,index:y}=this.getInfo(t);g.addHighLightPtAll(l,y,m)}return this.scene.needRender=!0,{oldPt:d,isHighLightPt:n}}filterBlocks(t,e=Ae.ORIGIN){let r=t.getBBox2().transform4(e.getInverseMatrix()),i=this.MIN_WH,n=this.MIN_WH2,s=[];return this.bufGrids.forEach((a,l)=>{let c=i*2**l,h=Math.floor((r.minX-n)/c),u=Math.floor((r.maxX+n)/c),d=Math.floor((r.minY-n)/c),p=Math.floor((r.maxY+n)/c);for(let m=h;m<=u;m++){let g=a.get(m);if(g)for(let y=d;y<=p;y++){let b=g.get(y);b&&s.push(b)}}}),s.push(this.block),s.push(this.defaultBlock),s}draw(t,e,r,i,n,s,a,l,c,h="render",u,d){let p=this.filterBlocks(r,e),m=this.templateBlock;this.scene.renderPtProgram.draw(t,e,r,i,n,p,!1,!1,!1,!1,c,h,m,u,d),this.scene.renderPtProgram.draw(t,e,r,i,n,p,!1,a,l,c,!1,h,m,u,d),this.scene.renderPtProgram.draw(t,e,r,i,n,p,s,!1,!1,!1,!1,h,m,u,d)}drawHighLightPt(t,e,r,i,n,s,a,l,c,h){let u=this.filterBlocks(e),d=this.templateBlock;this.scene.renderHighLightPtProgram.draw(t,e,r,u,i,n,s,a,l,c,h,d)}},Pit=10,Pwe=(o=>(o[o.ID=0]="ID",o[o.LD_POINT_X=1]="LD_POINT_X",o[o.LD_POINT_y=2]="LD_POINT_y",o[o.LU_POINT_X=3]="LU_POINT_X",o[o.LU_POINT_Y=4]="LU_POINT_Y",o[o.RD_POINT_X=5]="RD_POINT_X",o[o.RD_POINT_Y=6]="RD_POINT_Y",o[o.RU_POINT_X=7]="RU_POINT_X",o[o.RU_POINT_Y=8]="RU_POINT_Y",o[o.ORDER=9]="ORDER",o))(Pwe||{}),Tit=class extends Up{constructor(o,t,e,r,i,n,s,a=1,l=0){super(70,Pit,Pwe),this.scene=o,this.data=this.create(t,e,r,i,n,l,s),this.alpha=a}getData(){return this.data}create(o,t,e,r,i,n=0,s){return s===null?(this.gpuTexture=s,this.bindGroup=null):s&&(this.gpuTexture=s,this.bindGroup=this.scene.textureProgram.createBindGroup(s)),[o+(70<<Js),t.x,t.y,e.x,e.y,r.x,r.y,i.x,i.y,n]}get ldPoint(){return new S(this.data[1],this.data[2])}get luPoint(){return new S(this.data[3],this.data[4])}get rdPoint(){return new S(this.data[5],this.data[6])}get ruPoint(){return new S(this.data[7],this.data[8])}getBaseBBox(){let o=Math.min(this.luPoint.x,this.ldPoint.x,this.ruPoint.x,this.rdPoint.x),t=Math.max(this.luPoint.x,this.ldPoint.x,this.ruPoint.x,this.rdPoint.x),e=Math.min(this.luPoint.y,this.ldPoint.y,this.ruPoint.y,this.rdPoint.y),r=Math.max(this.luPoint.y,this.ldPoint.y,this.ruPoint.y,this.rdPoint.y);return Xa.modify(o,t,e,r)}sycnStatus(o,t,e,r,i,n=1,s=0,a){return this.data=this.create(o,t,e,r,i,s,a),this.alpha=n,this}getBBox(o,t){return Xa.modify(Math.min(o[t+1],o[t+7]),Math.max(o[t+1],o[t+7]),Math.min(o[t+2],o[t+8]),Math.max(o[t+2],o[t+8]))}},Iit=class{constructor(o,t){this.scene=t,this.bitmap=new Xm(4),this.instanceData=o,this.templateInstanceAndIdMap=new Map}add(o){if(this.templateInstanceAndIdMap.get(o))throw new Error("instanceId error");let t=this.bitmap.findEmpty();t===-1&&(this.bitmap=this.bitmap.extSize(this.bitmap.size*2),t=this.bitmap.findEmpty()),this.bitmap.markUsed(t),this.instanceData.set(t,o),this.templateInstanceAndIdMap.set(o,t)}remove(o){let t=this.templateInstanceAndIdMap.get(o);if(t===void 0)throw new Error("InstanceId error");this.instanceData.set(t,-1),this.bitmap.markRemove(t),this.templateInstanceAndIdMap.delete(o)}getData(){return this.instanceData}getMaxTemplateInstanceIndex(){return this.bitmap.getMax()}},P9=class extends f2e{constructor(o,t,e,r,i,n,s=!0,a=!1,l=!1,c=!1){super(e,r,i),this.ignoreForceHighLightEffect=l,this.bboxFac2=new _e,this.hasColorfulPolygon=!1,this.textures=[],this.panelize=!1,this.interPlanes=[this],this.subPlanes=[],this.ptNum=0,this.ptTypeNum=Array(69).fill(0),this.highLightPtNumById=0,this._isColorful=!1,this.visible=!0,this.polygonColorAndGroupIdMap=new Map,this.networkTextColor=ee.WHITE,this.polygonColorAlphaRatio=1,this.alphaOverlay=1,this.templateFacMap=new Map,this.templateInstancePtMap=new Map,this.polygonTemplatePtColorArr=[],this.isUnderGrid=!1,this.deactivateAlphaRatio=1,this.transparentObjs=[],this.renderTexture=!0,this.renderOther=!0,this.parts=[{matrix:Qe.ORIGIN,plane:this}],this.alwaysUpdateBBox=!0,this.dictOutMatrixRenderCfg={},this.originalColor=e,s||(n=!1),this.scene=o,this.isNormal=n,this.panelize=s,this.isHighLight=a,this.isUnderGrid=c,this.underGridError(),this.builder=new Xve(o,s,this),this.templateBboxBuild=ym.create(Float32Array,o.gpu,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,"templateBboxBuild of Plane"),this.templatePtOffsetBuild=ym.create(Float32Array,o.gpu,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.STORAGE,"templatePtOffsetBuild of Plane"),this.customTemplateInstancePtNumBuilder=ym.create(Float32Array,o.gpu,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.STORAGE,"customTemplateInstancePtNumBuilder of Plane"),this.id=t,this.drawTemplateBindGroup=this.createDrawTemplateBindGroup(),this.templatePtIdMap=new Map,this.templateInstance=new Iit(ym.create(Float32Array,o.gpu,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,"templateInstanceBuild of Plane"),this.scene)}underGridError(){if(this.isUnderGrid&&this.isNormal)throw new Error("Under grid plane is normal")}setNetworkHighLightStatus(o){throw new Error("gpu not supported ")}setNetworkTextColor(o){this.networkTextColor!=o&&(this.networkTextColor=o)}getNetStringColor(){return this.networkTextColor}setPolygonColorAlphaRatio(o){this.polygonColorAlphaRatio!=o&&(this.polygonColorAlphaRatio=o)}setIsColorful(o){this._isColorful!=o&&(this._isColorful=o)}get isColorful(){return this._isColorful}setColor(o){this.isColorful&&(this.originalColor=o),o!==this.color&&(super.setColor(o),this.scene.needRender=!0)}setAlphaOverlay(o){if(this.alphaOverlay==o)return;let t=this.getColor();this.alphaOverlay=o,this.setColor(ee.of6(t,t.alpha*o))}getOriginalColor(){return this.originalColor||this.color}createDynamicBindGroup(o){return this.scene.gpu.createDynamicBindGroup(this.scene.renderPtProgram.renderPtBindGroupLayout,0,this.scene.cameraBuf,1,this.scene.renderPtProgram.uniformsBuf,4,this.scene.colorsBuf,5,this.scene.renderPtProgram.sampler,6,this.scene.char.texture,7,this.scene.staticPolygonInfoBuilder.updateBuf(),8,this.scene.stringInfoBuilder.updateBuf(),9,this.scene.ptGroup.getData().updateBuf(),10,this.scene.renderPtProgram.highLightStencilBuf,11,this.scene.sdfStringLibrary.stringInfoBuilder.updateBuf(),12,this.scene.sdfStringLibrary.getSdfBuffer(),13,this.templatePtOffsetBuild.updateBuf(),14,this.scene.ptTemplate.getTemplateInstanceData().updateBuf(),15,o)}createDrawTemplateBindGroup(){return this.scene.gpu.createDynamicBindGroup(this.scene.renderPtProgram.templateLayout,0,this.scene.renderPtProgram.drawTemplatePipelineUniformsBuf,1,this.scene.cameraBuf,2,this.scene.gpu.linearSampler,3,this.scene.renderPtProgram.templateTarget.colorTexture,4,this.templateBboxBuild.updateBuf(),5,this.templatePtOffsetBuild.updateBuf(),6,this.scene.ptTemplate.getTemplateInstanceData().updateBuf())}addHighLightPt(o,t,e,r=0){let i=this.scene.getColorIndex(e,r);this.builder.addHighLightPt(o,t,i),this.highLightPtNumById++}removeHighLightPt(o,t,e,r=0){let i=this.scene.getColorIndex(e,r),{num:n}=this.builder.removeHighLightPt(o,t,i);this.highLightPtNumById-=n}setHighLightPtNum(o,t,e,r,i=0){let n=this.scene.getColorIndex(r,i);this.builder.setHighLightPtNum(o,t,e,n),this.highLightPtNumById+=e}addHighLightPts(o,t,e,r=0){switch(o[0]){case 1:for(let i=1;i<o.length;i++)this.addHighLightPt(o[i],t,e,r);break;case 0:for(let i=2;i<o.length;i++)this.addHighLightPt(o[i],t,e,r);break;default:throw new Error("addHighLightPts not support")}}removeHighLightPts(o,t,e,r=0){switch(o[0]){case 1:for(let i=1;i<o.length;i++)this.removeHighLightPt(o[i],t,e,r);break;case 0:for(let i=2;i<o.length;i++)this.removeHighLightPt(o[i],t,e,r);break;default:throw new Error("removeHighLightPts not support")}}setHighLightPtsNum(o,t,e,r,i=0){switch(o[0]){case 1:for(let n=1;n<o.length;n++)this.setHighLightPtNum(o[n],t,e,r,i);break;case 0:for(let n=2;n<o.length;n++)this.setHighLightPtNum(o[n],t,e,r,i);break;default:throw new Error("setHighLightPtsNum not support")}}renderHighLightPt(o,t,e,r,i,n,s,a,l=!0){this.builder.drawHighLightPt(o,t,this,e,r,i,n,s,l,a)}updateMatrix(o){super.updateMatrix(o),this.scene.needRender=!0;for(let t of o.values()){let e=Dt.ORIGIN.multiply4(t),r=new Dt(1,0,0).multiply4(t),i=new Dt(0,1,0).multiply4(t);if(e.x!==0||e.y!==0||r.x!==1||r.y!==0||i.x!==0||i.y!==1)throw new Error("oP.x !== 0 || oP.y !== 0 || xP.x !== 1 || xP.y !== 0 || yP.x !== 0 || yP.y !== 1")}}getPtBBox(o,t,e=this.scene.staticPolygonInfoBuilder,r=0,i=this.scene.getFixedPtData()){if(t===void 0&&(t=Fr.getType(o[0])),Fr.isTemplateInstancePtType(t)){let n=this.builder.getTemplatePt(o[1],Fr.getTemplateTypeByTemplateInstanceType(t)),s=Fr.getBBox(n,r,e,i),a=Fr.getTemplateId(n,0,e),l=o[2];return this.scene.ptTemplate.getTemplateInstanceBBox(a,l,s)}else return Fr.getBBox(o,r,e,i)}addPt(o,t=-1){let e=this.scene.staticPolygonInfoBuilder,r=Fr.getType(o[0]),i=this.getPtBBox(o,r,e);Fr.isTemplateOriginPtType(r)&&this.updateTemplateBbox(o,i,e),this.bboxFac2.ext5(i.minX,i.maxX,i.minY,i.maxY),this.ptNum++,this.ptTypeNum[r]++;let n=this.builder.addPt(o,e);if(this.isTemplatePt(t)){let s=this.templatePtIdMap.get(t);s||(s=new Set,this.templatePtIdMap.set(t,s)),s.add(n),this.scene.ptTemplate.forEachInstanceId(t,a=>{this.createTemplateInstancePt(n,a,!0)})}return n}updatePt(o,t,e=-1){this.isTemplatePt(e)&&this.scene.ptTemplate.forEachInstanceId(e,a=>{this.removePt(this.templateInstancePtMap.get(a).get(o))});let r=this.getPtBBox(t);this.bboxFac2.ext5(r.minX,r.maxX,r.minY,r.maxY);let i=Fr.getType(t[0]);this.updateTemplateBbox(t,r);let{oldPt:n,isHighLightPt:s}=this.builder.updatePt(o,t,null,r);if(Fr.isTemplateOriginPtType(i)&&Fr.getTemplateId(n,0,null)!==Fr.getTemplateId(t,0,null))throw new Error("PtTools.getTemplateId(oldPt, 0, null) !== PtTools.getTemplateId(pt, 0, null)");this.isTemplatePt(e)&&this.scene.ptTemplate.forEachInstanceId(e,a=>{this.createTemplateInstancePt(o,a)})}createOrUpdatePt(o,t,e){return this.isExistingPt(t)?(this.updatePt(t,o,e),t):this.addPt(o,e)}removeTexture(o){delete this.textures[o],--this.ptNum===0&&this.setEmpty(),this.ptTypeNum[70]--,this.scene.needRender=!0}removePt(o,t=this.scene.staticPolygonInfoBuilder){let{oldPt:e,isHighLightPt:r,highLightInfo:i}=this.builder.removePt(o);--this.ptNum===0&&this.setEmpty();let n=Xve.getTypeById(o);if(Fr.isTemplateOriginPtType(n)){let s=Fr.getTemplateId(e,0,t);this.isTemplatePt(s)&&(this.templatePtIdMap.get(s).delete(o),this.scene.ptTemplate.forEachInstanceId(s,a=>{let l=this.templateInstancePtMap.get(a);this.removePt(l.get(s)),l.delete(s)}))}return this.ptTypeNum[n]--,{pt:e,isHighLightPt:r,highLightInfo:i}}removePoint(o){this.builder.removePt(o),--this.ptNum===0&&this.setEmpty(),this.ptTypeNum[5]--}removePolygonPt(o){let t=this.scene.staticPolygonInfoBuilder,e,r,i,n;switch(o[0]){case 1:for(let a=1;a<o.length;a++){let{pt:l}=this.removePt(o[a],t);i===void 0&&(i=Fr.getType(l[0])),e===void 0&&(e=Fr.getColorIndex(l,0,this.scene.staticPolygonInfoBuilder)),Fr.isTemplateOriginPtType(i)&&r===void 0&&(r=Fr.getTemplateId(l,0,t)),n===void 0&&(n=Fr.getGroupId(l,0,t))}break;case 0:let s=o[1];this.scene.removeStaticPolygonInfo(s);for(let a=2;a<o.length;a++){let{pt:l}=this.removePt(o[a],t);i===void 0&&(i=Fr.getType(l[0])),e===void 0&&(e=Fr.getColorIndex(l,0,this.scene.staticPolygonInfoBuilder)),Fr.isTemplateOriginPtType(i)&&r===void 0&&(r=Fr.getTemplateId(l,0,t)),n===void 0&&(n=Fr.getGroupId(l,0,t))}break;default:throw new Error("ids error")}this.isTemplatePt(r)&&this.polygonTemplatePtColorArr.forEach((s,a)=>{e==s&&this.polygonTemplatePtColorArr.splice(a,1)}),this.scene.removePolygonGroupId(n)}hiddenPolygonPt(o){switch(o[0]){case 1:for(let t=1;t<o.length;t++)this.hiddenPt(o[t]);break;case 0:for(let t=2;t<o.length;t++)this.hiddenPt(o[t]);break;default:throw new Error("ids error")}}showPolygonPt(o){switch(o[0]){case 1:for(let t=1;t<o.length;t++)this.showPt(o[t]);break;case 0:for(let t=2;t<o.length;t++)this.showPt(o[t]);break;default:throw new Error("ids error")}}createOrUpdateLine(o,t,e,r,i,n,s,a,l,c,h,u,d,p){let m;return this.isTemplatePt(p)?m=this.createOrUpdatePt(FDe.create(this.id,t,e,r,i,s,this.scene.getColorIndex(n),a,p),o,p):m=this.createOrUpdatePt(i2e.create(this.id,t,e,r,i,s,this.scene.getColorIndex(n),a),o),m}createOrUpdateRectShadowFrame(o,t,e,r,i,n,s,a,l){throw new Error("gpu not supported ")}createOrUpdateRect(o,t,e,r,i,n=0,s,a,l,c,h){let u;return this.isTemplatePt(h)?u=this.createOrUpdatePt(yDe.create(this.id,t,e,r,i,n,a,this.scene.getColorIndex(s),l,h),o,h):u=this.createOrUpdatePt(Yye.create(this.id,t,e,r,i,n,a,this.scene.getColorIndex(s),l),o),u}createRect(o,t,e,r,i,n){this.createOrUpdateRect(-1,o.leftUpPoint,o.width,o.height,Ih.toRadians(o.angle),o.radius,t,e,r,i,n)}createOrUpdateDrcArrow(o,t,e,r,i){return this.createOrUpdatePt(this.scene.drcRenderModel===1?hwe.create(this.id,t,e,r,i):uwe.create(this.id,t,e,r,i),o)}createOrUpdateLineSegment(o,t,e,r,i,n,s,a,l,c){let h;return this.isTemplatePt(c)?h=this.createOrUpdatePt(ett.create(this.id,t,e,r,i,n,a,this.scene.getColorIndex(s),l,c),o,c):h=this.createOrUpdatePt(Vye.create(this.id,t,e,r,i,n,a,this.scene.getColorIndex(s),l),o),h}getArcSweepAngle(o,t,e){return e===ae.CCW?t>o?t-o:t-o+Zs:t<o?t-o:t-o-Zs}isTemplatePt(o){return!!(o&&o!==-1||o===0)}createOrUpdateArc(o,t,e,r,i,n,s,a,l,c,h,u){e<GZ&&(e=GZ),n<0&&(i=i+n,n=-n),i%=Zs,i<0&&(i+=Zs);let d;return this.isTemplatePt(u)?d=this.createOrUpdatePt(pDe.create(this.id,t,e,r,i,n,a,this.scene.getColorIndex(s),l,u),o,u):d=this.createOrUpdatePt(Uye.create(this.id,t,e,r,i,n,a,this.scene.getColorIndex(s),l),o),d}createOrUpdateEllipse(o,t,e,r,i,n,s,a,l,c,h="round",u,d=0,p,m){let g=$7[h],y=this.scene.getColorIndex(l),b=this.scene.getColorIndex(u);return this.createOrUpdatePt(rJ.create(this.id,t,e,r,i,n,s,a,y,-1,g,b,d,p,m),o)}createOrUpdateBezier(o,t,e,r,i,n,s,a,l="round",c,h){let u=$7[l],d=this.scene.getColorIndex(s);return this.createOrUpdatePt(e2e.create(this.id,t,e,r,i,n,d,-1,u,c,h),o)}createOrUpdateCircle(o,t,e,r,i,n,s,a){let l;return this.isTemplatePt(a)?l=this.createOrUpdatePt(jDe.create(this.id,t,e,i,this.scene.getColorIndex(r),n,a),o,a):l=this.createOrUpdatePt(d2e.create(this.id,t,e,i,this.scene.getColorIndex(r),n),o),l}createOrUpdateSemicircle(o,t,e,r,i,n,s,a){let l;return this.isTemplatePt(a)?l=this.createOrUpdatePt(stt.create(this.id,t,e,this.scene.getColorIndex(r),this.scene.getColorIndex(i),n,s,a),o,a):l=this.createOrUpdatePt(Wye.create(this.id,t,e,this.scene.getColorIndex(r),this.scene.getColorIndex(i),n,s),o),l}createOrUpdatePoint(o,t,e,r,i,n,s){return this.createOrUpdatePt(Bye.create(this.id,t,e,r,this.scene.getColorIndex(i),n,s),o)}createWireFramePts(o,t,e,r,i,n,s){let a=this.isTemplatePt(s);o.forEach(l=>{if(l instanceof q){let c=Ih.toRadians(l.sweepAngle),h=Ih.toRadians(l.startAngle);c<0&&(h=h+c,c=-c),h%=Zs,h<0&&(h+=Zs);let u=a?gtt:$ye;e.push(this.addPt(u.create(t,l.center,l.rx,h,c,r,i,n,s),s))}else if(l instanceof Dr){let c=l.points(.1),h=a?wve:IH;for(let u=0;u<c.length-1;u+=1)e.push(this.addPt(h.create(t,c[u],c[u+1],r,i,n,s),s))}else if(l instanceof M){let c=a?wve:IH;e.push(this.addPt(c.create(t,l.start(),l.end(),r,i,n,s),s))}else console.error("Not Support Primitive Type")})}createStaticWireFramePts(o,t,e,r,i){let n=this.isTemplatePt(i);o.forEach(s=>{if(s instanceof q){let a=Ih.toRadians(s.sweepAngle),l=Ih.toRadians(s.startAngle);a<0&&(l=l+a,a=-a),l%=Zs,l<0&&(l+=Zs);let c=n?Ptt:Jye;e.push(this.addPt(c.create(t,s.center,s.rx,l,a,r),i))}else if(s instanceof Dr){let a=s.points(.1),l=n?Lve:CH;for(let c=0;c<a.length-1;c+=1)e.push(this.addPt(l.create(t,a[c],a[c+1],r),i))}else if(s instanceof M){let a=n?Lve:CH;e.push(this.addPt(a.create(t,s.start(),s.end(),r),i))}else console.error("Not Support Primitive Type")})}createPolygon0(o,t,e,r,i,n,s,a,l,c=.1){var h,u;this.scene.addPolygonGroupId(a);let d=[],p=this.scene.getColorIndex(e);if(p!==0&&(this.hasColorfulPolygon=!0),a||a==0){let m=this.polygonColorAndGroupIdMap.get(p);m||m==0?Array.isArray(m)?m.includes(a)||m.push(a):m!==a&&(m=[m,a],this.polygonColorAndGroupIdMap.set(p,m)):this.polygonColorAndGroupIdMap.set(p,a)}for(let m of t){if(!((h=m.primitives)!=null&&h.length))continue;o[0]===1?n(m.primitives,this.id,o,s,p,a,l):n(m.primitives,this.id,o,o[1],l);let g=[],y,b,P,T,I,C=(u=m.primitives)==null?void 0:u[m.primitives.length-1].end(),E=()=>{if(y){if(T>0)for(let v=0;v<T;v+=360)o.push(this.addPt(r(this.id,y,b,Ih.toRadians(P+v),Ih.toRadians(Math.min(T-v,360)),I,C,s,p,a),l));else for(let v=0;v>T;v-=360)o.push(this.addPt(r(this.id,y,b,Ih.toRadians(P+v),Ih.toRadians(Math.max(T-v,-360)),I,C,s,p,a),l));I.equals(C)||g.push(new M(I,C)),y=null}};if(m.primitives.forEach((v,D)=>{if(v instanceof q&&v.rx===v.ry){if(y){if(b===v.rx&&y.equals(v.center)&&V_.eq(Ih.regularD(P+T),Ih.regularD(v.startAngle))){T+=v.sweepAngle,C=v.end();return}E()}y=v.center,b=v.rx,P=v.startAngle,T=v.sweepAngle,v.start().equals(C)||g.push(new M(C,v.start())),I=v.start()}else E(),v.start().equals(C)||g.push(new M(C,v.start())),g.push(v);C=v.end()}),E(),g.length===0)continue;let O=[];for(ge.build2(g).points(c,v=>O.push(v));O.length!==0&&O[0].equals(O[O.length-1]);)O.pop();if(O.length<3)continue;let _=O[0],x=[_];for(let v=1;v<O.length;v++){let D=O[v];_.equals(D)||(x.push(D),_=D)}x.length>=3&&d.push(x)}for(let m of d){let g=m.slice();for(let y=0;y<g.length-2;y+=2){let b=this.addPt(i(this.id,g[y],g[y+1],g[y+2],s,p,a),l);o.push(b),g.push(g[y])}}return this.isTemplatePt(l)&&this.polygonTemplatePtColorArr.push(p),o}createPolygon(o,t,e,r,i,n,s=.1){let a=this.isTemplatePt(n);return this.createPolygon0([1],o,t,(l,c,h,u,d,p,m,g,y)=>a?WDe.create(l,c,h,u,d,p,m,g,y,r,n):c2e.create(l,c,h,u,d,p,m,g,y,r),(l,c,h,u,d,p)=>a?UDe.create(l,c,h,u,d,p,r,n):s2e.create(l,c,h,u,d,p,r),this.createWireFramePts.bind(this),e,r,n,s)}createStaticPolygon(o,t,e,r,i,n,s,a){let l=this.scene.addStaticPolygonInfo(e,t,r,s,i),c=this.isTemplatePt(s);return this.createPolygon0([0,l],o,t,(h,u,d,p,m,g,y)=>(c?ftt:NH).create(h,u,d,p,m,g,y,l),(h,u,d,p)=>(c?dtt:MH).create(h,u,d,p,l),this.createStaticWireFramePts.bind(this),e,r,s,a)}createOrUpdateTexture(o,t,e,r,i,n,s,a,l,c,h){if(o==null||o<0){let u=new Tit(this.scene,this.id,t,e,r,i,n,a,l);o=this.textures.findIndex(p=>!p),o===-1?(this.textures.push(u),o=this.textures.length-1):this.textures[o]=u;let d=u.getBaseBBox();this.bboxFac2.ext5(d.minX,d.maxX,d.minY,d.maxY),this.scene.needRender=!0,this.ptNum++,this.ptTypeNum[70]++}else{let u=this.textures[o];u.sycnStatus(this.id,t,e,r,i,a,l,n);let d=u.getBaseBBox();this.bboxFac2.ext5(d.minX,d.maxX,d.minY,d.maxY),this.scene.needRender=!0}return o}getPxLength(o,t){let e;if(o.isOrthCamera())e=o.getPxLength();else{let r=this.getBBox(),i=(r?r.center():o.getTarget()).multiply4(t),n=o.getTarget().sub(i).dot(o.getTar2Pos().normalize());e=o.getPxLength()*(n/o.getTar2Pos().length()+1)}return e}isEmpty(){return this.parts.every(({plane:o})=>!o.bboxFac2.valid())}getAllPtBbox(){return this.bboxFac2.valid()?this.bboxFac2.build1():null}getAllRgbRatio(){return this.scene.getForceDeactivateRatio()*this.getRgbRatio()}setEmpty(){this.bboxFac2.clear()}clear(){this.builder.clear(),this.ptNum=0,this.ptTypeNum=Array(69).fill(0),this.setEmpty()}getBBox(){try{let o=Number.NEGATIVE_INFINITY,t=Number.NEGATIVE_INFINITY,e=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY;for(let i of this.interPlanes){let n=i.getBBox2ContainsPart();o=Math.max(n.minX,o),e=Math.min(n.maxX,e),t=Math.max(n.minY,t),r=Math.min(n.maxY,r)}return new U1(o,t,0,e,r,0)}catch{return null}}drawSelf(o,t,e,r,i,n="render",s,a,l,c,h){if(!(n==="render"&&!r.renderOther))for(let u of this.parts){let d=u.matrix.toMatrix4().multiply4(e),p=u.plane;this.scene.renderPtProgram.templateCamera.setScale(t.getScale(),!1);let m=this.getPxLength(t,d),g=-L_/2,y=N7/2,b=-g,P=-y,T=0,I=!0;if(this.templateBboxBuild.setArr(new Uint8Array(this.templateBboxBuild.getLength()),0),!this.templateFacMap.size)I=!1;else for(let[C,E]of this.templateFacMap){let O=E.build(),_=O.minX/m-2,x=O.maxY/m+2,v=Math.ceil(O.width()/m)+4,D=Math.ceil(O.height()/m)+4;if(v>L_){I=!1;break}if(g+v<=b?T=Math.max(T,D):(g=-L_/2,y-=T,T=D),y-T<P){I=!1;break}let w=(g-_)*m,F=(y-x)*m;this.templatePtOffsetBuild.setArr([w,F],C*Wit),this.templateBboxBuild.setArr([_*m,x*m,v*m,D*m],C*xwe),g+=v}this.templatePtOffsetBuild.updateBuf(),this.templateBboxBuild.updateBuf(),I!==this.lastIsRenderTemplateTexture&&(console.log(p.label,I?"\u5207\u6362\u5230\u4F7F\u7528\u6A21\u677F\u7EB9\u7406\u6E32\u67D3":"\u5207\u6362\u5230\u4E0D\u4F7F\u7528\u6A21\u677F\u7EB9\u7406\u6E32\u67D3"),this.lastIsRenderTemplateTexture=I),p.builder.draw(o,d,t,r,i,a,l,c,s,n,I,h),r.renderTexture&&n==="render"&&p.drawTextures(o,d,i,r.getMaterial())}}draw(o,t,e,r,i,n=!0,s=!0,a=!0,l,c=!1){let h=this.outMatrixParamMap.get(e);if(h){if(h.renderI===this.scene.renderI)return;h.renderI=this.scene.renderI}if(this.interPlanes.length===0||!this.isColorful&&(r===2&&this.getMaterial().alpha===0||(r===0||r===1)&&this.getColor().alpha===0)||this.noDrawing)return;let u=this.interPlanes.slice(),d=this.subPlanes.slice(),p=this.dictOutMatrixRenderCfg[e.toString()];if(p)if(p.replacePlane){d=p.listSubPlane;for(let m of p.listInterPlane)m&&u.push(m)}else{for(let m of p.listSubPlane)m&&d.push(m);for(let m of p.listInterPlane)m&&u.push(m)}if(l)this.scene.drawStencilProgram.draw(o,!1,64,128),u=u.filter(m=>m!==l);else if(u.length===1){this.scene.clearStencilValue(64,o.depthStencilTexture.view,"planeDraw");for(let m of d)m.drawSelf(o,t,e,this,r,"drawNotPassStencil",i,n,s,a,c);u[0].drawSelf(o,t,e,this,r,"render",i,n,s,a,c);return}else this.scene.clearStencilValue(0,o.depthStencilTexture.view,"planeDraw"),u.pop().drawSelf(o,t,e,this,r,"drawPassStencil",i,n,s,a,c);for(let m of d)m.drawSelf(o,t,e,this,r,"drawNotPassStencil",i,n,s,a,c);if(u.length===0)this.scene.drawColorUseStencilProgram.render(o,r,e,this.getMaterial(),this.getColor(),this.getBBox());else{for(let m=1;m<u.length;m++)u[m].drawSelf(o,t,e,this,r,"drawInterStencil",i,n,s,a,c),this.scene.drawStencilProgram.draw(o,!0,192,127),this.scene.drawStencilProgram.draw(o,!0,128,128),this.scene.drawStencilProgram.draw(o,!1,64,63);u[0].drawSelf(o,t,e,this,r,"render",i,n,s,a,c)}}drawStencilPlane(o,t,e,r,i,n=!0,s=!0,a=!0,l=!1){this.scene.clearStencilValue(0,o.depthStencilTexture.view,"drawStencilPlane"),this.drawSelf(o,t,e,this,r,"drawPassStencil",i,n,s,a,l)}drawTextures(o,t,e,r){this.textures.forEach(i=>{this.scene.textureProgram.render(o,t,i,e,r)})}createStringPt(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.scene.getColorIndex(a),m=this.scene.addStringInfo(o),{strWidth:g,strHeight:y}=F_.getStrInfo(o,n,s);return this.isTemplatePt(d)?VZ.create(this.id,t,g,y,e,o.length,m,r,i,u,p,l,c,h,d):J7.create(this.id,t,g,y,e,o.length,m,r,i,u,p,l,c,h)}createScaleStringPt(o,t,e,r,i,n,s,a,l,c){let h=this.scene.getColorIndex(n),u=this.scene.addStringInfo(o),{strWidth:d,strHeight:p}=F_.getStrInfo(o,r,i);return swe.create(this.id,t,d,p,e,o.length,u,c,h,s,a,l)}createOrUpdateNetWorkText(o,t,e,r,i,n,s,a,l,c,h,u,d,p){return this.createOrUpdatePt(this.createStringPt(t,e,r,i,n,s,a,l,c,u,d,h,p),o,p)}createOrUpdateScaleString(o,t,e,r,i,n,s,a,l,c,h){return this.createOrUpdatePt(this.createScaleStringPt(t,e,r,i,n,s,a,c,h,l),o)}isExistingPt(o){return o!=null&&o>=0}createTemplateInstancePt(o,t,e=!1){let{type:r,block:i,index:n}=this.builder.getInfo(o);if(r==60){let{level:l,index:c,builder:h}=i.getStringInfo(n,r);n=(c<<RC)+l}e?this.customTemplateInstancePtNumBuilder.get(t)!==0&&(r=Fr.getCustomTemplateInstanceType(Fr.getTemplateInstanceType(r))):r=Fr.getTemplateInstanceType(r);let s=this.addPt(this.createTemplateInstancePtData(r,t,n)),a=this.templateInstancePtMap.get(t);a||(a=new Map,this.templateInstancePtMap.set(t,a)),a.set(o,s)}createOrUpdateDrc(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.scene.getColorIndex(c),p=this.scene.sdfStringLibrary.getIndex(a),m=this.scene.sdfStringLibrary.getIndex(l);return this.createOrUpdatePt(Nye.create(this.id,t,n,s,e,r,i,p,m,u,d,h),o)}createSdfStringPt(o,t,e,r,i,n,s,a,l,c){let h=this.scene.getColorIndex(s),u,{strIndex:d,fontWidth:p}=this.scene.addSdfStringInfo(o,n,u,c);return Cw.create(this.id,d,t,e,p,i,h,a,l)}createOrUpdateNormalString(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I){throw new Error("Sdf text not support")}createOrUpdateNormalStringMatrix(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g){throw new Error("Sdf text not support")}isPanelize(){return this.panelize}setIsUnderGrid(o){this.isUnderGrid!==o&&(this.underGridError(),this.isUnderGrid=o,this.scene.needRender=!0)}getIsUnderGrid(){return this.isUnderGrid}isRender(){return this.scene.getHasGroupForceHighLight()&&this.scene.getForceVisibleHighLightPt()&&!this.ignoreForceHighLightEffect?!0:this.visible}isVisible(){return this.visible}setVisible(o){this.visible=o,this.scene.needRender=!0}createOrUpdateArcSegment(o,t,e,r,i,n,s,a,l,c){return this.createOrUpdateArc(o,t,e,0,r,this.getArcSweepAngle(r,i,n),s,a,l,"round",[],c)}getPtNum(){return this.ptNum}getPtTypeNum(){return this.ptTypeNum}getHighLightPtNum(){return this.highLightPtNumById}hiddenPt(o){this.builder.setPtVisible(o,!1)}showPt(o){this.builder.setPtVisible(o,!0)}hiddenPoint(o){this.builder.setPtVisible(o,!1)}showPoint(o){this.builder.setPtVisible(o,!0)}updateTemplateBbox(o,t,e=this.scene.staticPolygonInfoBuilder,r=Fr.getType(o[0])){if(!Fr.isTemplateOriginPtType(r))return;let i=Fr.getTemplateId(o,0,e);if(this.isTemplatePt(i)){let n=this.templateFacMap.get(i);n||(n=new _e,this.templateFacMap.set(i,n)),n.ext5(t.minX,t.maxX,t.minY,t.maxY)}}setStaticPolygonInfo(o,t){let e=o[1],r=this.scene.staticPolygonInfoBuilder.copy();this.scene.setStaticPolygonInfo(e,t);let i=this.scene.staticPolygonInfoBuilder;for(let n=2;n<o.length;n++){let s=o[n],a=this.builder.getPt(s),l=this.getPtBBox(a,void 0,i);this.builder.updatePt(s,a,i,l),this.bboxFac2.ext5(l.minX,l.maxX,l.minY,l.maxY),this.updateTemplateBbox(a,l,i)}}createTemplateInstancePtData(o,t,e,r,i){switch(o){case 21:return Pet.create(this.id,e,t,r,i);case 22:return Tet.create(this.id,e,t,r,i);case 23:return Iet.create(this.id,e,t,r,i);case 24:return Cet.create(this.id,e,t,r,i);case 25:return Eet.create(this.id,e,t,r,i);case 26:return Oet.create(this.id,e,t,r,i);case 27:return Aet.create(this.id,e,t,r,i);case 29:return vet.create(this.id,e,t,r,i);case 28:return _et.create(this.id,e,t,r,i);case 31:return xet.create(this.id,e,t,r,i);case 32:return Ret.create(this.id,e,t,r,i);case 33:return Det.create(this.id,e,t,r,i);case 34:return wet.create(this.id,e,t,r,i);case 30:return D_.create(this.id,e,t,r,i);case 35:return Let.create(this.id,e,t,r,i);case 36:return Met.create(this.id,e,t,r,i);case 37:return Net.create(this.id,e,t,r,i);case 38:return ket.create(this.id,e,t,r,i);case 39:return Bet.create(this.id,e,t,r,i);case 40:return Fet.create(this.id,e,t,r,i);case 41:return Vet.create(this.id,e,t,r,i);case 42:return Get.create(this.id,e,t,r,i);case 44:return Het.create(this.id,e,t,r,i);case 43:return Uet.create(this.id,e,t,r,i);case 46:return zet.create(this.id,e,t,r,i);case 47:return Yet.create(this.id,e,t,r,i);case 48:return jet.create(this.id,e,t,r,i);case 49:return Xet.create(this.id,e,t,r,i);case 45:return Wet.create(this.id,e,t,r,i);case 50:return qet.create(this.id,e,t,r,i);default:throw new Error(`${o},type Error`)}}isCustomTemplateInstancePt(o,t=-1){return o!==0||t!==-1}removeTemplate(o,t){t.forEach(e=>this.removeTemplateInstance(e)),this.templatePtIdMap.get(o).forEach(e=>this.removePt(e)),this.templatePtIdMap.delete(o)}addTemplateInstance(o,t){let e=this.templatePtIdMap.get(o);e&&(e.forEach(r=>{this.createTemplateInstancePt(r,t)}),this.templateInstance.add(t))}updateTemplateInstance(o,t){var e;let r=this.scene.staticPolygonInfoBuilder;(e=this.templateInstancePtMap.get(t))==null||e.forEach(i=>{let n=this.builder.getPt(i),s=this.getPtBBox(n,void 0,r);this.builder.updatePt(i,n,r,s),this.bboxFac2.ext5(s.minX,s.maxX,s.minY,s.maxY)})}removeTemplateInstance(o){var t;(t=this.templateInstancePtMap.get(o))==null||t.forEach(e=>{this.removePt(e)}),this.templateInstancePtMap.delete(o),this.customTemplateInstancePtNumBuilder.set(o,0),this.templateInstance.remove(o)}getTemplatePtIndex(o){let{type:t,block:e,index:r}=this.builder.getInfo(o);if(t==60){let{level:i,index:n,builder:s}=e.getStringInfo(r,t);r=(n<<RC)+i}return r}setTemplateInstancePt(o,t,e,r){let i=this.scene.getColorIndex(e),n=this.templateInstancePtMap.get(t).get(o);if(n===void 0)throw new Error("templateInstanceId error");let s=this.builder.getPt(n),a=this.isCustomTemplateInstancePt(s[3],s[4]),l=this.isCustomTemplateInstancePt(i,r);if(a!==l){let c=this.customTemplateInstancePtNumBuilder.get(t)||0,h=c+(l?1:-1);if(this.customTemplateInstancePtNumBuilder.set(t,h),c===0!=(h===0)){let u;h===0?(u=Fr.getTemplateTypeByCustomInstanceType,this.templateInstance.add(t)):(u=Fr.getCustomTemplateInstanceType,this.templateInstance.remove(t));let d=this.templateInstancePtMap.get(t);d.forEach((p,m)=>{let{pt:g,isHighLightPt:y,highLightInfo:b}=this.removePt(p),P=Fr.getType(g[0]),T=u(P),I=this.addPt(this.createTemplateInstancePtData(T,t,this.getTemplatePtIndex(m),p===n?i:g[3],p===n?r:g[4]));if(y){let{block:C,index:E}=this.builder.getInfo(I);C.addHighLightPtAll(T,E,b)}d.set(m,I)});return}}this.updatePt(this.templateInstancePtMap.get(t).get(o),this.createTemplateInstancePtData(Fr.getType(s[0]),t,this.getTemplatePtIndex(o),i,r))}setTemplateInstancePts(o,t,e,r){switch(o[0]){case 1:for(let i=1;i<o.length;i++)this.setTemplateInstancePt(o[i],t,e,r);break;case 0:for(let i=2;i<o.length;i++)this.setTemplateInstancePt(o[i],t,e,r);break;default:throw new Error("setTemplateInstancePts not support")}}addTemplateHighLightPt(o,t,e,r,i=0){let n=this.templateInstancePtMap.get(t).get(o);if(n===void 0)throw new Error("templateInstanceId is blank");let s=this.scene.getColorIndex(r,i);this.builder.addHighLightPt(n,e,s),this.highLightPtNumById++}setTemplateHighLightPtNum(o,t,e,r,i,n=0){let s=this.templateInstancePtMap.get(t).get(o);if(s===void 0)throw new Error("templateInstanceId is blank");let a=this.scene.getColorIndex(i,n),l=this.builder.setHighLightPtNum(s,e,r,a);this.highLightPtNumById+=r}removeTemplateHighLightPt(o,t,e,r,i=0){let n=this.templateInstancePtMap.get(t).get(o);if(!n)throw new Error("templateInstanceId is blank");let s=this.scene.getColorIndex(r,i),{pt:a,num:l}=this.builder.removeHighLightPt(n,e,s);this.highLightPtNumById-=l}addTemplateHighLightPts(o,t,e,r,i=0){switch(o[0]){case 1:for(let n=1;n<o.length;n++)this.addTemplateHighLightPt(o[n],t,e,r,i);break;case 0:for(let n=2;n<o.length;n++)this.addTemplateHighLightPt(o[n],t,e,r,i);break;default:throw new Error("addHighLightPts not support")}}removeTemplateHighLightPts(o,t,e,r,i=0){switch(o[0]){case 1:for(let n=1;n<o.length;n++)this.removeTemplateHighLightPt(o[n],t,e,r,i);break;case 0:for(let n=2;n<o.length;n++)this.removeTemplateHighLightPt(o[n],t,e,r,i);break;default:throw new Error("removeTemplateHighLightPts not support")}}setTemplateHighLightPtsNum(o,t,e,r,i,n){switch(o[0]){case 1:for(let s=1;s<o.length;s++)this.setTemplateHighLightPtNum(o[s],t,e,r,i,n);break;case 0:for(let s=2;s<o.length;s++)this.setTemplateHighLightPtNum(o[s],t,e,r,i,n);break;default:throw new Error("setHighLightPtsNum not support")}}getPtBboxById(o){let t=this.builder.getPt(o);return this.getPtBBox(t).build()}setRgbRatio(o){o!==this.deactivateAlphaRatio&&(this.deactivateAlphaRatio=o,this.scene.needRender=!0)}getRgbRatio(){return this.deactivateAlphaRatio}setRenderProcess(o=[this],t=[]){this.interPlanes=o.filter(e=>e),this.subPlanes=t.filter(e=>e&&!e.isEmpty())}sortTransparentObjs(){}getIsColorFul(){return this.isColorful}addPart(o,t){this.parts.push({matrix:o,plane:t})}clearParts(){this.parts.length=0}setPolygonAbleInter(o){}setAlwaysUpdateBBox(o){this.alwaysUpdateBBox=o}updateBBox(){try{let o=Number.NEGATIVE_INFINITY,t=Number.NEGATIVE_INFINITY,e=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY;for(let i of this.interPlanes){let n=i.getAllPtBbox();o=Math.max(n.minX,o),e=Math.min(n.maxX,e),t=Math.max(n.minY,t),r=Math.min(n.maxY,r)}return this.bBox=new U1(o,t,0,e,r,0),this.bBox}catch{return this.bBox=null,this.bBox}}addRenderProcess(o=[this],t=[]){for(let e of o)this.interPlanes.indexOf(e)<=-1&&this.interPlanes.push(e);for(let e of t)this.subPlanes.indexOf(e)<=-1&&this.subPlanes.push(e)}removeRenderProcess(o=[this],t=[]){for(let e of o){let r=this.interPlanes.indexOf(e);r>=0&&this.interPlanes.splice(r,1)}for(let e of t){let r=this.subPlanes.indexOf(e);r>=0&&this.subPlanes.splice(r,1)}}addOutMatrixRenderCfg(o,t){let e=o.getSelfAsOutToChildMatrix();for(let r of e){let i=this.outMatrixParamMap.get(r);i&&(t.visible=i.visible,this.dictOutMatrixRenderCfg[r.toString()]=t)}}removeOutMatrixRenderCfg(o,t){let e=o.getSelfAsOutToChildMatrix();for(let r of e)this.outMatrixParamMap.get(r)&&delete this.dictOutMatrixRenderCfg[r.toString()]}getBBox2ContainsPart(){let o=new _e;for(let t of this.parts){let{plane:e,matrix:r}=t,i=e.getAllPtBbox();i&&o.ext1(i.transform(r))}return o.valid()?o.build():null}getBBox2(){let o,t=this.getBBox();return t&&(o=t.toBBox2()),o}clearCpuMemory(){}getUnPanelBBox(){let o=new _e,{plane:t,matrix:e}=this.parts[0],r=t.getAllPtBbox();return r&&o.ext1(r.transform(e)),o.build()}ableCover(o){let t=new Set(o.interPlanes);for(let e of this.interPlanes)if(!t.has(e))return!1;return!0}isBoard(o){return this.interPlanes.length===1&&this.interPlanes[0].label==="board"&&this.subPlanes.length===0&&o!==1&&(o!==2||this.getMaterial().alpha===1)}hasInterPlane(o){return this.interPlanes.indexOf(o)!==-1}getMutualStencilPlane(o){let t=new Set(this.interPlanes);for(let e of o.interPlanes)if(t.has(e))return e;return null}},H7=class extends f2e{constructor(o,t,e=null,r=null){super(t,e,r),this.elements=o}clear(){this.elements.decOut()}updateMatrix(o){let t=this.outMatrixParamMap.size;super.updateMatrix(o),t===0&&this.outMatrixParamMap.size!==0&&this.elements.incOut()}setMaterial(o){super.setMaterial(o)}setColor(o){super.setColor(o)}getNeedDrawParamsMap(o,t){let e=new Map;for(let r=t.length-1;r>=0;r--){let i=t[r],n=this.outMatrixParamMap.get(i.matrix);if(n.renderI!==o.renderI){let s=e.get(i.renderMode);s||(s=[],e.set(i.renderMode,s)),s.push(i)}n.renderI=o.renderI}return e}render(o,t,e){for(let r of e.entries()){let[i,n]=r;n.forEach(s=>{o.meshProgramGPU.render(t,o,i,s.matrix,this.elements,this.getMaterial(),this.color)})}}draw(o,t,e){let r=this.getNeedDrawParamsMap(o,e);r.size!==0&&this.render(o,t,r)}getBBox(){return this.elements.getBBox()}};var Twe=new ArrayBuffer(40),iH=new Float64Array(Twe),Cit=new Int32Array(Twe),DC=class Iwe{constructor(t,e,r,i=1,n=1){if(n<0||n>1)throw new Error("alpha must between 0 and 1");this.ambient=t,this.diffuse=e,this.specular=r,this.shininess=U7.positiveOr0(i),this.alpha=n,iH[0]=t.hashCode(),iH[1]=e.hashCode(),iH[2]=r.hashCode(),iH[3]=i,iH[4]=n;let s=0;for(let a=0;a<10;a++)s^=Cit[a];this.hashed=s}hashCode(){return this.hashed}equals(t){return t instanceof Iwe?t.ambient.equals(this.ambient)&&t.diffuse.equals(this.diffuse)&&t.specular.equals(this.specular)&&t.shininess===this.shininess&&t.alpha===this.alpha:!1}};function w_(o,t){let e=o.get(t);return e||(e=[],o.set(t,e)),e}var qve=class{constructor(){this.labelMapIndex={},this.transparentMap=new Map,this.opaqueMap=new Map}add(o,t){let e=t.renderMode,r=e===2||e===1?o.getMaterial().alpha:e===0?o.getColor().alpha:1;if(r===0)return;let i=V1e(this.labelMapIndex,o.label,()=>new Map);w_(i,o).push(t),r===1?w_(this.opaqueMap,o).push(t):w_(this.transparentMap,o).push(t)}addCache(o){Object.entries(o.labelMapIndex).forEach(t=>{let[e,r]=t,i=V1e(this.labelMapIndex,e,()=>new Map);for(let n of r.entries()){let[s,a]=n,l=w_(i,s);a.forEach(c=>l.push(c))}});for(let t of o.transparentMap.entries()){let[e,r]=t,i=w_(this.transparentMap,e);r.forEach(n=>i.push(n))}for(let t of o.opaqueMap.entries()){let[e,r]=t,i=w_(this.opaqueMap,e);r.forEach(n=>i.push(n))}}},Q2=class fP{constructor(t=3,e=!1,r){this.drawHighlight=!0,this.outSelfMatrixVisibleMap=new Map,this.contents=new Set,this.containers=new Set,this.planeCache=new Map,this.meshCachesArrMap=new Map,this.position=Dt.ORIGIN,this.scale=new Dt(1,1,1),this.rotation=Dt.ORIGIN,this.addMatrix=Ae.ORIGIN,this.updateFlag=!1,this.visible=!0,this.hidden=!1,this.selfMatrix=this.addMatrix,this.isChange=!1,this.renderMode=t,this.name=r,e&&this.outSelfMatrixVisibleMap.set(Ae.ORIGIN,[new Ae,!0])}clone(t){let e=new fP(3,!1,this.name);return e.setDrawHighlight(this.drawHighlight),e.setPosition(this.position),e.setScale(this.scale),e.setRotation(this.rotation),e.setAddiMatrix(this.addMatrix),e.setRenderMode(this.renderMode),e.setVisible(this.visible),e.setHidden(this.hidden),(t||this.contents).forEach(r=>e.add(r)),e}static cloneAttribute(t,e){e.setPosition(t.position),e.setScale(t.scale),e.setRotation(t.rotation),e.setAddiMatrix(t.addMatrix),e.setRenderMode(t.renderMode),e.setVisible(t.visible),e.setHidden(t.hidden)}clearOutMeshCache(){this.meshCachesArrMap.size!==0&&(this.meshCachesArrMap.clear(),this.containers.forEach(t=>t.clearOutMeshCache()))}setDrawHighlight(t){this.drawHighlight=t,this.clearOutMeshCache()}setRenderMode(t){this.renderMode=t,this.clearOutCache()}isEmpty(){for(let t of this.contents)if(t instanceof fP){if(!t.isEmpty())return!1}else return!1;return!0}setOutMatrixVisible(t,e){let r=this.outSelfMatrixVisibleMap.get(e);r[1]=t,t=t&&this.visible;for(let i of this.contents)i.setOutMatrixVisible(t,r[0])}setVisible(t){if(t!==this.visible){this.visible=t,this.containers.forEach(e=>e.clearOutCache());for(let e of this.outSelfMatrixVisibleMap.values()){let r=e[1]&&this.visible;for(let i of this.contents)i.setOutMatrixVisible(r,e[0])}}}getVisible(){return this.visible}setHidden(t){this.hidden=t}getPosition(){return this.position}getContents(){return this.contents}setPosition(t){return this.position=t,this.markChanged(),this}getScale(){return this.scale}setScale(t){return this.scale=t,this.markChanged(),this}getRotation(){return this.rotation}setRotation(t){return this.rotation=t,this.markChanged(),this}getAddiMatrix(){return this.addMatrix}setAddiMatrix(t){return this.addMatrix=t,this.markChanged(),this}setIsChange(t){this.isChange=t,this.containers.forEach(e=>{e.setIsChange(t)})}getIsChange(){return this.isChange}markChanged(){this.updateFlag=!0,this.clearOutCache()}getMatrix(){return this.updateFlag&&this.update(),this.selfMatrix}getSelfAsOutToChildMatrix(){let t=[];for(let e of this.outSelfMatrixVisibleMap.values())t.push(e[0]);return t}clearOutPlaneCache(){this.planeCache.size!==0&&(this.planeCache.clear(),this.containers.forEach(t=>t.clearOutPlaneCache()))}clearOutCache(){this.clearOutMeshCache(),this.clearOutPlaneCache(),this.setIsChange(!0)}clearInMeshCache(){this.meshCachesArrMap.size!==0&&(this.meshCachesArrMap.clear(),this.contents.forEach(t=>t instanceof fP&&t.clearInMeshCache()))}clearInPlaneCache(){this.planeCache.size!==0&&(this.planeCache.clear(),this.contents.forEach(t=>t instanceof fP&&t.clearInPlaneCache()))}clearInCache(){this.clearInMeshCache(),this.clearInPlaneCache()}add(t){this.contents.add(t),this.clearOutCache();let e=new Map;for(let r of this.outSelfMatrixVisibleMap.values())e.set(new Ae,r[0]);t.updateMatrix(e);for(let r of this.outSelfMatrixVisibleMap.values())t.setOutMatrixVisible(this.visible&&r[1],r[0]);return t instanceof fP&&(t.containers.add(this),t.clearInCache()),t}addItem(t){if(t)return this.add(t)}remove(t){if(!this.contents.has(t))return;this.contents.delete(t),t instanceof fP&&(t.containers.delete(this),t.clearInCache()),this.clearOutCache();let e=new Array;for(let r of this.outSelfMatrixVisibleMap.values())e.push(r[0]);t.removeOutMatrixs(e)}removeOutMatrixs(t){let e=new Array;for(let r of t)e.push(this.outSelfMatrixVisibleMap.get(r)[0]),this.outSelfMatrixVisibleMap.delete(r);for(let r of this.contents)r.removeOutMatrixs(e)}clear(){let t=new Array;for(let e of this.outSelfMatrixVisibleMap.values())t.push(e[0]);for(let e of this.contents)e.removeOutMatrixs(t);this.contents.forEach(e=>{e instanceof fP&&e.containers.delete(this)}),this.clearOutCache(),this.contents.clear()}getBBox(t=!1){if(this.hidden||t&&!this.visible)return null;let e=this.getMatrix(),r=new mm;for(let i of this.contents){let n=i.getBBox(t);n&&r.ext4(n.transform(e))}return r.isValid()?r.build():null}updateMatrix(t){let e=new Map;for(let r of t.entries()){let[i,n]=r,s=this.getMatrix().multiply4(n),a=!0,l=this.outSelfMatrixVisibleMap.get(i);l?(a=l[1],e.set(l[0],s),this.outSelfMatrixVisibleMap.delete(i)):e.set(new Ae,s),this.outSelfMatrixVisibleMap.set(n,[s,a])}for(let r of this.contents)r.updateMatrix(e)}setSingleColor(t,e=null,r=!1){if(e){let i=this.outSelfMatrixVisibleMap.get(e)[0];for(let n of this.contents)n instanceof fP?(n.setSingleColor(t,i,!0),r&&n.meshCachesArrMap.clear()):n.setSingleColor(t,i)}else for(let i of this.contents)if(i instanceof fP){for(let n of this.outSelfMatrixVisibleMap.values())i.setSingleColor(t,n[0],!0);r&&i.meshCachesArrMap.clear()}else for(let n of this.outSelfMatrixVisibleMap.values())i.setSingleColor(t,n[0]);r||this.clearOutMeshCache()}update(){this.selfMatrix=Ae.ORIGIN.rotateZ(this.rotation.z).rotateX(this.rotation.x).rotateY(this.rotation.y).scale(this.scale.x,this.scale.y,this.scale.z).translate(this.position).multiply4(this.addMatrix),this.updateFlag=!1;let t=new Map;for(let e of this.outSelfMatrixVisibleMap.keys())t.set(e,e);this.updateMatrix(t)}getPlaneMatrixRenderModes(t=3,e=Ae.ORIGIN){if(!this.visible)return[];this.updateFlag&&this.update();let r=w_(this.planeCache,e),i=r[t];if(i)return i;i=r[t]=[],t!==4&&this.renderMode!==3&&(t=this.renderMode);let n=this.outSelfMatrixVisibleMap.get(e)[0];for(let s of this.contents)if(s instanceof fP)for(let a of s.getPlaneMatrixRenderModes(t,n))i.push(a);else(s instanceof yw||s instanceof P9)&&i.push([s,n,t]);return i}getMeshCache(t=3,e=Ae.ORIGIN,r=void 0){if(!this.visible)return new qve;this.updateFlag&&this.update();let i=w_(this.meshCachesArrMap,e),n=pet(i,r?1:0),s=n[t];if(s)return s;s=n[t]=new qve,t!==4&&this.renderMode!==3&&(t=this.renderMode);let a=this.outSelfMatrixVisibleMap.get(e)[0];for(let l of this.contents)if(l instanceof fP){if(r!==void 0&&l.drawHighlight!==r)continue;s.addCache(l.getMeshCache(t,a,r))}else l instanceof H7&&s.add(l,{matrix:a,renderMode:t,color:t===0?l.getColor():t===4?l.getSingleColor(a):null});return s}setMeshAlpha(t){Array.from(this.contents).forEach(e=>{if(e instanceof fP){let r=e.clone();this.add(r),this.remove(e),r.setMeshAlpha(t)}else e instanceof H7&&e.getMaterial()&&e.getMaterial().alpha!=t&&(this.add(new H7(e.elements,e.getColor(),new DC(e.getMaterial().ambient,e.getMaterial().diffuse,e.getMaterial().specular,e.getMaterial().shininess,t),e.label)),this.remove(e))})}},Cwe=class{constructor(){this.backgroundColor=ee.ZERO,this.drawingBackgroundColor=ee.build(0,0,0,1),this.antialias=!1,this._needRenderPanelize=!1,this.renderMode=0,this.origin=S.ORIGIN,this.forceDeactivateRatio=1,this.panelizeInfo={offset:S.ORIGIN,row:1,col:1},this.panelizeMatrix=[],this.highLightColor=[],this._needRender=!1,this._needRenderRuler=!1,this.groupIdStatusMap=new Map,this.drcRenderModel=0,this.drcRenderStyle=0,this.gridParam=new lit,this.rulerBackgroundColor=ee.WHITE,this.rulerStringColor=ee.build(.4,.4,.4,.8),this.forceVisibleHighLightPt=!1,this.fpsCounter=new Array(360).fill(-1e4),this.fpsCountI=0,this.globalHighLightType=0,this.hasGroupForceHighLight=!1,this.drawLineWidthStyle=0,this.fixedPtData=[],this.cameraSet=new Set,this.simpleModeOn=!1,this.groupHighLight=new Q2(4,!0,"groupHighLight"),this._currentCoord=!0,this.textSizeCorrectionEnabled=!0,this.textFontFamilyCorrectionEnabled=!0}set needRenderPanelize(o){this._needRenderPanelize!==o&&(this._needRenderPanelize=o,o||(this.panelizeMatrix=[Qe.ORIGIN]),this.updatePlaneArrayPart(this.panelizeMatrix),this.needRender=!0)}get needRenderPanelize(){return this._needRenderPanelize}comparisonAndRecordPtGroupStatus(o,t,e,r=!1,i,n,s,a=0){let l=this.groupIdStatusMap.get(t),c=(l==null?void 0:l.visible)===void 0?!0:l.visible,h=(l==null?void 0:l.doubleRgb)===void 0?!1:l.doubleRgb,u=l==null?void 0:l.highLightGroupId,d=(l==null?void 0:l.isForceHighLight)===void 0?!1:l==null?void 0:l.isForceHighLight,p=(l==null?void 0:l.ptColorIndex)||0,m=(l==null?void 0:l.renderMode)||0;(c!==e||h!==r||u!=i||d!=n||p!=s||m!=a)&&((c!==e||h!==r||p!=s||m!=a)&&o(),this.groupIdStatusMap.set(t,{visible:e,doubleRgb:r,highLightGroupId:i,isForceHighLight:n,ptColorIndex:s,renderMode:a}),this.needRender=!0)}groupStatusQuery(){let o=!1,t=!1;for(let e of this.groupIdStatusMap.values())if(e.highLightGroupId!=null&&(o=!0,e.isForceHighLight)){t=!0;break}return{hasGroupHighLight:o,hasGroupForceHighLight:t}}getPixelRatio(){let o=window.devicePixelRatio;return/android|iphone|symbian|windows phone|ipad|ipod/i.test(navigator.userAgent)&&(o*=window.outerWidth/window.innerWidth),o}fpsCount(){this.fpsCounter[this.fpsCountI]=performance.now(),this.fpsCountI=(this.fpsCountI+1)%this.fpsCounter.length}getFps(){let o=performance.now(),t=0;return this.fpsCounter.forEach(e=>{o-e<1e3&&t++}),t}setHighLightColor(o,t){this.highLightColor[t]=o,this.needRender=!0}setGlobalHighLightType(o){this.globalHighLightType=o,this.needRender=!0}getGlobalHighLightType(){return this.globalHighLightType}getSceneType(){return this.sceneType}setRulerBackgroundColor(o){this.rulerBackgroundColor!==o&&(this.rulerBackgroundColor=o,this._needRender=!0)}setRulerStringColor(o){this.rulerStringColor!==o&&(this.rulerStringColor=o,this._needRender=!0)}getRulerBackgroundColor(){return this.rulerBackgroundColor}getRulerStringColor(){return this.rulerStringColor}getForceVisibleHighLightPt(){return this.forceVisibleHighLightPt}get needRender(){return this._needRender}set needRender(o){this._needRender=o}get needRenderRuler(){return this._needRenderRuler}set needRenderRuler(o){this._needRenderRuler=o}addCamera(o){if(o.setScene(this),H0.getInfiniteScaling()&&(o.setMinScale(Number.NEGATIVE_INFINITY),o.setMaxScale(Number.POSITIVE_INFINITY)),this.currentCamera=o,this.cameraSet.add(o),this.cameraSet.size>1)throw new Error("Only one camera is allowed")}setRenderMode(o){this.renderMode=o,this.needRender=!0}getRenderMode(){return this.renderMode}setPanelizeInfo(o=S.ORIGIN,t=1,e=1){this.panelizeInfo.offset=o,this.panelizeInfo.row=t,this.panelizeInfo.col=e,this.panelizeMatrix=[];for(let r=0;r<t;r++)for(let i=0;i<e;i++)this.panelizeMatrix.push(Qe.translate(i*o.x,r*o.y));this.needRenderPanelize&&this.updatePlaneArrayPart(this.panelizeMatrix),this.needRender=!0}setOrigin(o){this.origin=o,this.needRender=!0}getOrigin(){return this.origin}getForceDeactivateRatio(){return this.forceDeactivateRatio}getBgColor(){return this.backgroundColor}getDrawingBgColor(){return this.drawingBackgroundColor}readPanelizeMat(){let o=[];if(!this.needRenderPanelize)return o;let{offset:t,row:e,col:r}=this.panelizeInfo;for(let i=0;i<e;i++)for(let n=0;n<r;n++)i==0&&n==0||o.push(Ae.translate(n*t.x,i*t.y,0));return o}get currentCoord(){return this.gridParam.currentCoord}set currentCoord(o){this.gridParam.currentCoord=o}getAntialias(){return this.antialias}setAntialias(o){this.antialias=o,this.needRender=!0}mouseMoveRenderRuler(){this.needRenderRuler=!0}setDrawLineWidthStyle(o){this.drawLineWidthStyle=o,this.needRender=!0}getDrawLineWidthStyle(){return this.drawLineWidthStyle}setDrcArrowPtStyle(o,t,e,r,i,n,s){this.fixedPtData[1]=t,this.fixedPtData[2]=e,this.fixedPtData[3]=r,this.fixedPtData[4]=i,this.fixedPtData[5]=n,this.fixedPtData[6]=s}getUnderAcceleratePlane(o,t,e){return e.getTar2Pos().z>0?o.filter(r=>{let i=r[0].getBBox().transform(r[1]);return!r[0].getIsUnderGrid()&&i.minZ+i.maxZ<=t}):o.filter(r=>{let i=r[0].getBBox().transform(r[1]);return!r[0].getIsUnderGrid()&&i.minZ+i.maxZ>=t})}getAboveAcceleratePlane(o,t,e){return e.getTar2Pos().z>0?o.filter(r=>{let i=r[0].getBBox().transform(r[1]);return!r[0].getIsUnderGrid()&&i.minZ+i.maxZ>t}):o.filter(r=>{let i=r[0].getBBox().transform(r[1]);return!r[0].getIsUnderGrid()&&i.minZ+i.maxZ<t})}getUnderGridPlane(o){return o.filter(t=>t[0].getIsUnderGrid()&&!t[0].isNormal)}getAboveGridPlane(o){return o.filter(t=>!t[0].getIsUnderGrid())}sortByCameraZ(o,t){if(o.isOrthCamera())o.getTar2Pos().z<0?t.sort((e,r)=>{let i=e[0].getBBox().transform(e[1]),n=r[0].getBBox().transform(r[1]);return n.minZ+n.maxZ-(i.minZ+i.maxZ)}):t.sort((e,r)=>{let i=e[0].getBBox().transform(e[1]),n=r[0].getBBox().transform(r[1]);return i.minZ+i.maxZ-(n.minZ+n.maxZ)});else{let e=o.getZ();t.sort((r,i)=>{let n=r[0].getBBox().transform(r[1]),s=i[0].getBBox().transform(i[1]);return Math.abs(e-(s.minZ+s.maxZ)/2)-Math.abs(e-(n.minZ+n.maxZ)/2)})}}getNormalPlaneLastRenderZ(o,t){let e=t.filter(n=>n[0].isNormal);this.sortByCameraZ(o,e);let r=e[0],i=r[0].getBBox().transform(r[1]);return i.minZ+i.maxZ}setCameraFlip(o){let t=this.measureTooGroup.getPosition().z;o&&t>0||!o&&t<0||this.measureTooGroup.setPosition(new Dt(0,0,-t))}getCanvas(){return this.currentCamera.getCanvas()}getSingleColor(o,t){return ee.RED}getCameraSet(){return this.cameraSet}getCurrentCamera(){return this.currentCamera}turnSimpleModeOnOrOff(o){this.simpleModeOn=o}delCamera(o){this.cameraSet.delete(o),this.needRender=!0}getImageData(o,t,e,r){return null}onGlLost(o){console.error("onGlLost")}get isCartesian(){return this._currentCoord}set isCartesian(o){this._currentCoord=o}setTextSizeCorrectionEnabled(o){this.textSizeCorrectionEnabled=o}getTextSizeCorrectionEnabled(){return this.textSizeCorrectionEnabled}setTextFontFamilyCorrectionEnabled(o){this.textFontFamilyCorrectionEnabled=o}getTextFontFamilyCorrectionEnabled(){return this.textFontFamilyCorrectionEnabled}},Swe=class extends Cwe{constructor(){super(...arguments),this.polygonGroupIds=new Map,this.useWireFrameGroup=new Set,this.useColorGroup=new Set,this.polygonUseWireFrameGroup=new Set,this.polygonUseColorGroup=new Set}addPolygonGroupId(o){if(o||o===0){let t=this.polygonGroupIds.get(o);t?this.polygonGroupIds.set(o,t+1):this.polygonGroupIds.set(o,1),this.useWireFrameGroup.has(o)&&this.polygonUseWireFrameGroup.add(o),this.useColorGroup.has(o)&&this.polygonUseColorGroup.add(o)}}removePolygonGroupId(o){(o||o===0)&&this.polygonGroupIds.forEach((t,e)=>{if(e===o){t>1?this.polygonGroupIds.set(o,t-1):(this.polygonGroupIds.delete(o),this.polygonUseWireFrameGroup.delete(o),this.polygonUseColorGroup.delete(o));return}})}getGroupUseWireFramePolygon(){return this.polygonUseWireFrameGroup.size}getGroupUseColorPolygon(){return this.polygonUseColorGroup.size}updateGroupRenderModeRecord(o,t){let e=this.polygonGroupIds.has(o);t===0?(this.useWireFrameGroup.delete(o),e&&(this.polygonUseWireFrameGroup.delete(o),this.polygonUseColorGroup.delete(o))):t===1?(this.useWireFrameGroup.add(o),e&&this.polygonUseWireFrameGroup.add(o)):t===2&&(this.useColorGroup.add(o),e&&this.polygonUseColorGroup.add(o))}},N_={get:function(o,t,e){let r=Reflect.get(o,t,e),i="plane";return e instanceof Cwe&&(i="scene"),typeof r=="function"?(...n)=>{let s=LC(),a=performance.now(),l=r.apply(e,n),c=performance.now()-a;return s[i]||(s[i]={}),s[i][t]==null&&(s[i][t]=0),s[i][t]+=c,l}:r}},Sit=class{constructor(){this.color=null,this.leftUpPoint=S.ORIGIN,this.hollowWidth=0,this.hollowHeight=0}setMaskInfo(o,t=S.ORIGIN,e=0,r=0){this.color=o,this.leftUpPoint=t,this.hollowWidth=e,this.hollowHeight=r,this.scene.needRender=!0}clear(){this.color=null,this.leftUpPoint=S.ORIGIN,this.hollowWidth=0,this.hollowHeight=0,this.scene.needRender=!0}},Eit=class extends Sit{constructor(o){super(),this.scene=o}render(o,t){if(!this.color)return;let e=o.getContext();o.setFillStyle(this.color.toCSS());let r=e.canvas.width,i=e.canvas.height;if(e.beginPath(),e.moveTo(0,0),e.lineTo(r,0),e.lineTo(r,i),e.lineTo(0,i),e.closePath(),this.hollowWidth){let n=t.getSampling(),s=t.getScale()*n,a=t.getRenderMatrix(),l=new S(this.leftUpPoint.x,this.leftUpPoint.y).multiply4(a),c=this.hollowWidth*s,h=this.hollowHeight*s;e.moveTo(l.x,l.y),e.lineTo(l.x,l.y+h),e.lineTo(l.x+c,l.y+h),e.lineTo(l.x+c,l.y),e.closePath(),e.fill()}}},nH=8,Ewe=class{constructor(o){this.instanceData=o,this.templateBitmap=new Xm(4),this.instanceBitmap=new Xm(4),this.instanceBitmap.addTrimListener(t=>{this.instanceData.trimChunk(t*nH)}),this.templateIdAndTemplateInstanceMap=new Map}createTemplateId(){let o=this.templateBitmap.findEmpty();return o===-1&&(this.templateBitmap=this.templateBitmap.extSize(this.templateBitmap.size*2),o=this.templateBitmap.findEmpty()),this.templateBitmap.markUsed(o),this.templateIdAndTemplateInstanceMap.set(o,new Set),o}removeTemplateId(o){this.templateBitmap.markRemove(o),this.templateIdAndTemplateInstanceMap.get(o).forEach(t=>{this.instanceBitmap.markRemove(t)}),this.templateIdAndTemplateInstanceMap.delete(o)}getTemplateNum(){return this.templateBitmap.getMarked()}addTemplateInstance(o,t){let e=this.instanceBitmap.findEmpty();e===-1&&(this.instanceBitmap=this.instanceBitmap.extSize(this.instanceBitmap.size*2),e=this.instanceBitmap.findEmpty()),this.instanceBitmap.markUsed(e);let r=e*nH,i=t.data;return this.instanceData.setArr([i[0],i[1],i[4],i[5],i[12],i[13]],r),this.instanceData.set(r+6,o),this.instanceData.set(r+7,0),this.templateIdAndTemplateInstanceMap.get(o).add(e),e}removeTemplateInstance(o,t){if(!this.templateBitmap.isUsed(o))throw new Error("templateId does not exist");if(!this.instanceBitmap.isUsed(t))throw new Error("instanceIndex does not exist");this.instanceData.set(t*nH+6,-1),this.instanceBitmap.markRemove(t),this.templateIdAndTemplateInstanceMap.get(o).delete(t)}updateTemplateInstance(o,t,e){if(!this.templateBitmap.isUsed(o))throw new Error("templateId does not exist");if(!this.instanceBitmap.isUsed(t))throw new Error("instanceIndex does not exist");let r=e.data;this.instanceData.setArr([r[0],r[1],r[4],r[5],r[12],r[13],o],t*nH)}getTemplateInstanceData(){return this.instanceData}getMaxTemplateInstanceIndex(){return this.instanceBitmap.getMax()}getTemplateInstanceBBox(o,t,e){if(!this.templateBitmap.isUsed(o))throw new Error("templateId does not exist");let r=t*nH,i=this.instanceData.get(r+0),n=this.instanceData.get(r+1),s=this.instanceData.get(r+2),a=this.instanceData.get(r+3),l=this.instanceData.get(r+4),c=this.instanceData.get(r+5),h=e.minX,u=e.maxY,d=e.maxX,p=e.maxY,m=e.minX,g=e.minY,y=e.maxX,b=e.minY,P=h*i+u*s+l,T=h*n+u*a+c,I=d*i+p*s+l,C=d*n+p*a+c,E=m*i+g*s+l,O=m*n+g*a+c,_=y*i+b*s+l,x=y*n+b*a+c;return Xa.modify(Math.min(P,I,E,_),Math.max(P,I,E,_),Math.min(T,C,O,x),Math.max(T,C,O,x))}forEachInstanceId(o,t){return this.templateIdAndTemplateInstanceMap.get(o).forEach(t)}getInstanceIds(o){return this.templateIdAndTemplateInstanceMap.get(o)}},nye=MQe(),MC=nye.top||nye;try{MC.location&&MC.location.search}catch{MC=null}var Oit="-time-diff",Owe=MC&&Ait();function Ait(){let o=nye.PRO_LOG_LEVEL;return o=="trace"||o=="debug"}function _it(o){return o+Oit}function vit(o,t){let e=_it(o);Array.isArray(MC[e])?MC[e].push(t):MC[e]=[t]}function xit(o,t=3){return+o.toFixed(t)}function UZ(o,t=!1){if(!Owe)return;let e=new Date().getTime();t&&MC[o]||(MC[o]=e)}function HZ(o,t=0){if(!Owe)return;let e=MC[o];if(isNaN(e))return!1;let r=new Date().getTime(),i=xit((r-e)/1e3);return i>=t&&LQe(o,void 0,`${i}s`),vit(o,i),delete MC[o],!0}var Rit=class{constructor(o,t,e,r,i){this.pxLength=o,this.manager=t,this.isHighLightManager=e,this.engine=r,this.textureSize=i,this.textureGrid=new Map,this.textureByteSize=this.textureSize**2*4,this.textureLimit=4096/this.textureSize}renderCb(o,t,e,r,i,n){let s="levelTextureRender-time";UZ(s);let a=t.getBBox2();r.forEach(l=>{let c=a.transform4(l.getInverseMatrix()).intersection1(e);if(!c)return;let h=Math.floor(c.minX/this.pxLength/this.textureSize),u=Math.floor(c.maxX/this.pxLength/this.textureSize),d=Math.floor(c.minY/this.pxLength/this.textureSize),p=Math.floor(c.maxY/this.pxLength/this.textureSize);for(let m=h;m<=u;m++){let g=this.textureGrid.get(m);g||(g=new Map,this.textureGrid.set(m,g));for(let y=d;y<=p;y++){let b=g.get(y);if(b&&b.texture){i(l,b.texture);continue}let P=new B_(null,this.textureSize,this.textureSize);P.setScene(o),P.setCameraType(!0,!1),P.setCameraDirect(!0,!1);let T=new ht(m*this.textureSize*this.pxLength,(m+1)*this.textureSize*this.pxLength,y*this.textureSize*this.pxLength,(y+1)*this.textureSize*this.pxLength);P.setTarget(new Dt((T.minX+T.maxX)/2,(T.minY+T.maxY)/2,0),!1),P.setScale(1/this.pxLength,!1);let I=1;n(l,m,y,g,P,T),this.manager.levelTexturesSize+=this.textureByteSize*I}}}),HZ(s,.1)}*updateByLoc(o,t,e,r,i){if(this.getTexture(o,t))return e&&(this.getTexture(o,t).noRecycle=!0),!1;let n=new B_(null,this.textureSize,this.textureSize);n.setScene(r),n.setCameraType(!0,!1),n.setCameraDirect(!0,!1);let s=new ht(o*this.textureSize*this.pxLength,(o+1)*this.textureSize*this.pxLength,t*this.textureSize*this.pxLength,(t+1)*this.textureSize*this.pxLength);n.setTarget(new Dt((s.minX+s.maxX)/2,(s.minY+s.maxY)/2,0),!1),n.setScale(1/this.pxLength,!1);let a=this.updateByCamera(n,o,t,i),l=a.next();for(;!l.done;){let c=yield;if(l=a.next(c),c)return!1}return this.manager.levelTexturesSize+=this.textureByteSize,this.getTexture(o,t).noRecycle=e,!0}getTexture(o,t){var e;return(e=this.textureGrid.get(o))==null?void 0:e.get(t)}addTexture(o,t,e){let r=this.textureGrid.get(o);r||(r=new Map,this.textureGrid.set(o,r)),r.set(t,e)}renderBatchCb(o,t,e,r,i,n){let s="levelTextureRender-time";UZ(s);let a=t.getBBox2();r.forEach(l=>{let c=a.transform4(l.getInverseMatrix()).intersection1(e);if(!c)return;let h=Math.floor(c.minX/this.pxLength/this.textureSize),u=Math.floor(c.maxX/this.pxLength/this.textureSize),d=Math.floor(c.minY/this.pxLength/this.textureSize),p=Math.floor(c.maxY/this.pxLength/this.textureSize);for(let m=h;m<=u;m++){let g=this.textureGrid.get(m);g||(g=new Map,this.textureGrid.set(m,g));for(let y=d;y<=p;y++){let b=g.get(y);if(b&&b.texture){i(l,b.texture);continue}let P=m+1,T=y+1,I=()=>{if(P-m===this.textureLimit||P>u)return!1;let _=!0;for(let x=y;x<T;x++)if(this.getTexture(P,x)){_=!1;break}return _&&P++,_},C=()=>{if(T-y===this.textureLimit||T>p)return!1;let _=!0;for(let x=m;x<P;x++)if(this.getTexture(x,T)){_=!1;break}return _&&T++,_};for(;;)if(P===T){if(!I()&&!C())break}else if(P===T+1){if(!C()&&!I())break}else if(P>T){if(!I())break}else if(!C())break;let E=new B_(null,this.textureSize*(P-m),this.textureSize*(T-y));E.setScene(o),E.setCameraType(!0,!1),E.setCameraDirect(!0,!1),E.setTarget(new Dt((m+P)/2*this.textureSize*this.pxLength,(y+T)/2*this.textureSize*this.pxLength,0),!1),E.setScale(1/this.pxLength,!1),n(E,m,y),this.manager.levelTexturesSize+=this.textureByteSize*(P-m)*(T-y);let O=this.getTexture(m,y);O.texture&&i(l,O.texture)}}}),HZ(s,.1)}update(o){let t=Math.floor(o.minX/this.pxLength/this.textureSize),e=Math.floor(o.maxX/this.pxLength/this.textureSize),r=Math.floor(o.minY/this.pxLength/this.textureSize),i=Math.floor(o.maxY/this.pxLength/this.textureSize);for(let n=t;n<=e;n++){let s=this.textureGrid.get(n);if(s)for(let a=r;a<=i;a++){let l=s.get(a);l&&(l.texture&&(this.destroy(l.texture),this.manager.levelTexturesSize-=this.textureByteSize),s.delete(a))}}}clear(){this.textureGrid.forEach(o=>{o.forEach(t=>{t.texture&&(this.destroy(t.texture),this.manager.levelTexturesSize-=this.textureByteSize)})}),this.textureGrid.clear()}recycle(o,t){o&&t.forEach(e=>{let r=o.transform4(e.getInverseMatrix()),i=Math.floor(r.minX/this.pxLength/this.textureSize),n=Math.floor(r.maxX/this.pxLength/this.textureSize),s=Math.floor(r.minY/this.pxLength/this.textureSize),a=Math.floor(r.maxY/this.pxLength/this.textureSize);for(let l=i;l<=n;l++){let c=this.textureGrid.get(l);if(c)for(let h=s;h<=a;h++){let u=c.get(h);u&&(u.interCanvas=!0)}}}),this.textureGrid.forEach(e=>{e.forEach((r,i)=>{if(r.noRecycle||r.interCanvas){delete r.interCanvas;return}this.destroy(r.texture),this.manager.levelTexturesSize-=this.textureByteSize,e.delete(i)})})}clearTexture(o,t){let e=this.textureGrid.get(o),r=e.get(t);r.texture&&(this.destroy(r.texture),this.manager.levelTexturesSize-=this.textureByteSize),e.delete(t)}},Dit=512,wit=512,Lit=class{constructor(o,t,e,r){if(this.getCurBBox=o,this.createLevelTexture=t,this.isHighLightManager=e,this.engine=r,this.minLevel=Number.POSITIVE_INFINITY,this.textureMap=new Map,this._levelTexturesSize=0,r===0)this.textureSize=wit;else{let i=Dit;q1.getTextureSize()&&(i=q1.getTextureSize()),this.textureSize=i}this.textureByteSize=this.textureSize**2*4}get levelTexturesSize(){return this._levelTexturesSize}set levelTexturesSize(o){H0.isEnableLog()&&console.log(`levelTexturesSize${this.isHighLightManager?"(h)":""}`,"==========>",o/this.textureByteSize),this._levelTexturesSize=o}setMinPxLength(o){this.minLevel=Math.min(this.minLevel,Math.floor(Math.log2(o)))}getMinLevel(){return this.minLevel}update(o){this.textureMap.forEach(t=>t.update(o))}getOrInitTexture(o){let t=this.textureMap.get(o);return t||(t=this.createLevelTexture(2**o),this.textureMap.set(o,t)),t}clear(){this.textureMap.forEach(o=>o.clear()),this.textureMap.clear()}recycle(o,t,e){var r;let i=Math.floor(Math.log2(t.getPxLength())),n=t.getBBox2(),s=o+1;for(let a=o-1;a<=s;a++)(r=this.textureMap.get(a))==null||r.recycle(a===i-1?n:a===i?n.extendOfSize(this.textureSize*2**a):a===i+1?n.extendSize(n.width()*2,n.height()*2):null,e)}},Mit=class extends Rit{constructor(o,t,e,r,i){super(o,e,r,0,i),this.pxLength=o,this.planes=t,this.manager=e,this.isHighLightManager=r,this.textureSize=i;let n=document.createElement("canvas");n.width=this.textureSize,n.height=this.textureSize,this.highLightCtx0=new U0(n.getContext("2d"));let s=document.createElement("canvas");s.width=this.textureSize,s.height=this.textureSize,this.highLightCtx1=new U0(s.getContext("2d"))}renderHighLight(o,t,e,r,i,n){this.renderCb(o,t,r,i,(s,a)=>{a&&a.render(t,e,s)},(s,a,l,c,h,u)=>{let d={};if(this.isHighLightManager){let p=document.createElement("canvas");p.width=this.textureSize,p.height=this.textureSize;let m=new U0(p.getContext("2d")),g=document.createElement("canvas");g.width=this.textureSize,g.height=this.textureSize;let y=new U0(g.getContext("2d"));o.renderHighLightPlane(h,n,m,y,!1,o.drcRenderModel===1,!1,!1),m.getContext().drawImage(g,0,0,m.getContext().canvas.width,m.getContext().canvas.height),d.texture=Tw.build(p,u)}c.set(l,d),d.texture&&d.texture.render(t,e,s)})}renderIterator(o,t,e,r,i,n){let s="renderIterator-time";UZ(s),this.renderCbIterator(o,t,r,i,!1,(a,l)=>{l==null||l.render(t,e,a)},(a,l,c,h,u,d,p)=>{let m={},g=Ae.ORIGIN;if(p){let O=document.createElement("canvas");O.width=this.textureSize,O.height=this.textureSize;let _=new U0(O.getContext("2d")),x=!1;p.forEach(D=>{x=!0,D.render(h,_,g)});let v;if(x){v=Tw.build(O,u),m.texture=v,d||v.render(t,e,g);let D=c.get(l);(D==null?void 0:D.texture)===v&&(D.texture=v)}else m.texture=null,v=null;return c.set(l,m),v}let y=document.createElement("canvas");y.width=this.textureSize,y.height=this.textureSize;let b=new U0(y.getContext("2d")),P=document.createElement("canvas");P.width=this.textureSize,P.height=this.textureSize;let T=new U0(P.getContext("2d")),I=document.createElement("canvas");I.width=this.textureSize,I.height=this.textureSize;let C=new U0(I.getContext("2d")),E=!1;return n.forEach(O=>{E=O[0].renderByMatrix(g,h,b,!1,o.drcRenderModel==1,!1,!0,O[2],!0,T,C,!1,!1,O[0].getMaterial(),!1,!0,!0)||E}),E?m.texture=Tw.build(y,u):m.texture=null,c.set(l,m),!d&&m.texture&&m.texture.render(t,e,g),m.texture}),HZ(s,.1)}renderCbIterator(o,t,e,r,i,n,s){var a;let l=[];if(r.length==0)return l;let c=t.getBBox2(),h=Math.floor(Math.log2(this.pxLength)),u=this.pxLength*this.textureSize,d=this.manager.templateLevel,p=h==d;for(let m=0;m<r.length;m++){let g=r[m],y=c.transform4(g.getInverseMatrix()).intersection1(e);if(!y)continue;let b=Math.floor(y.minX/u),P=Math.floor(y.maxX/u),T=Math.floor(y.minY/u),I=Math.floor(y.maxY/u);for(let C=b;C<=P;C++){let E=this.textureGrid.get(C);E||(E=new Map,this.textureGrid.set(C,E));for(let O=T;O<=I;O++){let _=(a=E.get(O))==null?void 0:a.texture;if(_){i?l.push(_):n(g,_);continue}let x=new B_(null,this.textureSize,this.textureSize);x.setScene(o),x.setCameraType(!0,!1),x.setCameraDirect(!0,!1);let v=new ht(C*u,(C+1)*u,O*u,(O+1)*u);x.setTarget(new Dt((v.minX+v.maxX)/2,(v.minY+v.maxY)/2,0),!1),x.setScale(1/this.pxLength,!1);let D=0;if(p){let w=s(C,O,E,x,v,i);w&&(l.push(w),D=1)}else{let w=this.manager.getTextureByLevel(d);if(!w)continue;let F=w.renderCbIterator(o,x,e,r,!0,n,s),H=s(C,O,E,x,v,i,F);H&&(l.push(H),D=1)}D>0&&(this.manager.levelTexturesSize+=this.textureByteSize*D)}}}return l}renderIterator0(o,t,e,r,i){let n="renderIterator-time";UZ(n),this.renderCbIterator0(o,t,r,!1,s=>{s==null||s.render(t,e,Ae.ORIGIN)},(s,a,l,c,h,u,d)=>{let p={},m=Ae.ORIGIN;if(d){let E=document.createElement("canvas");E.width=this.textureSize,E.height=this.textureSize;let O=new U0(E.getContext("2d")),_=!1;d.forEach(v=>{_=!0,v.render(c,O,m)});let x;if(_){x=Tw.build(E,h),p.texture=x,u||x.render(t,e,m);let v=l.get(a);(v==null?void 0:v.texture)===x&&(v.texture=x)}else p.texture=null,x=null;return l.set(a,p),x}let g=document.createElement("canvas");g.width=this.textureSize,g.height=this.textureSize;let y=new U0(g.getContext("2d")),b=document.createElement("canvas");b.width=this.textureSize,b.height=this.textureSize;let P=new U0(b.getContext("2d")),T=document.createElement("canvas");T.width=this.textureSize,T.height=this.textureSize;let I=new U0(T.getContext("2d"));o.renderI++;let C=!1;return i.forEach(E=>{C=E[0].render0(E[1],c,y,!1,o.drcRenderModel==1,!1,!0,E[2],!0,P,I,!1,!1,E[0].getMaterial(),E[0].renderTexture,E[0].renderOther)||C}),C?p.texture=Tw.build(g,h):p.texture=null,l.set(a,p),!u&&p.texture&&p.texture.render(t,e,m),p.texture}),HZ(n,.1)}renderCbIterator0(o,t,e,r,i,n){var s;let a=[],l=t.getBBox2(),c=Math.floor(Math.log2(this.pxLength)),h=this.pxLength*this.textureSize,u=this.manager.templateLevel,d=c==u,p=l.intersection1(e);if(!p)return;let m=Math.floor(p.minX/h),g=Math.floor(p.maxX/h),y=Math.floor(p.minY/h),b=Math.floor(p.maxY/h);for(let P=m;P<=g;P++){let T=this.textureGrid.get(P);T||(T=new Map,this.textureGrid.set(P,T));for(let I=y;I<=b;I++){let C=(s=T.get(I))==null?void 0:s.texture;if(C){r?a.push(C):i(C);continue}let E=new B_(null,this.textureSize,this.textureSize);E.setScene(o),E.setCameraType(!0,!1),E.setCameraDirect(!0,!1);let O=new ht(P*h,(P+1)*h,I*h,(I+1)*h);E.setTarget(new Dt((O.minX+O.maxX)/2,(O.minY+O.maxY)/2,0),!1),E.setScale(1/this.pxLength,!1);let _=0;if(d){let x=n(P,I,T,E,O,r);x&&(a.push(x),_=1)}else{let x=this.manager.getTextureByLevel(u);if(!x)continue;let v=x.renderCbIterator0(o,E,e,!0,i,n),D=n(P,I,T,E,O,r,null);D&&(a.push(D),_=1),_>0&&(this.manager.levelTexturesSize+=this.textureByteSize*_)}}}return a}destroy(o){o instanceof Promise?o.then(t=>{t.image instanceof ImageBitmap&&t.image.close()}):o&&o.image instanceof ImageBitmap&&o.image.close()}getBBox(o){if(o instanceof Promise)throw new Error("texture instanceof Promise");return o.getBBox()}updateByCamera(o,t,e,r){throw new Error("Method not implemented.")}},Nit=2e3,$ve=class extends Lit{constructor(o,t,e=!1){super(()=>{let r=new _e;return this.planes.forEach(i=>{if(!i.isRender()||i.isEmpty())return;let n=i.getBBox2();n&&r.ext1(n)}),r.valid()&&r.build()},r=>new Mit(r,this.planes,this,e,this.textureSize),e,0),this.scene=o,this.planes=t,this.isHighLightManager=e,this.templateLevel=-4,this._notUseTexture=!1,this._forceUseTexture=!1,this._forceUseTexture&&(this.templateLevel=1),e&&(this.templateLevel=Number.NEGATIVE_INFINITY)}isUseTexture(o,t,e=!1){if(t.is3D())return!1;if(this._forceUseTexture)return!0;if(!this._forceUseTexture&&(e||this._notUseTexture))return!1;let r=this.getCurBBox();return!(!r||o<Nit||(this.autoResetTemplateLevelByNumber(o,r),!this.getUsingInfoIterator(t,r)))}render(o,t,e,r,i,n){let s=this.getUsingInfoIterator(o,this.getCurBBox());return this.renderIterator(s,o,t,e,r,i,n),!0}autoResetTemplateLevelByNumber(o,t){if(this._forceUseTexture)return;let e=t.width(),r=t.height(),i=2e3,n=500,s=2**this.templateLevel,a=0,l=!1;for(;;){let c=s*this.textureSize,h=Math.ceil(e/c),u=Math.ceil(r/c),d=h*u;if(a=Math.ceil(o/d),d>i||a<n)s*=2,l=!0;else break}if(l){let c=Math.floor(Math.log2(s));this.templateLevel=c,this.clear(),console.info("autoResetTemplateLevel","==========>",`pts(${o}), preNum(${a}), pxLength(${s}), level(${c})`)}}getUsingInfoIterator(o,t){if(!t)return;let e=Math.floor(Math.log2(o.getPxLength()));if(!(e<this.templateLevel)&&(e=Math.min(e,Math.ceil(Math.log2(Math.max(t.width(),t.height())/this.textureSize))),!(e<this.templateLevel)))return{level:e,bbox:t,texture:this.getOrInitTexture(e)}}getTextureByLevel(o){if(!(o<this.templateLevel))return this.getOrInitTexture(o)}renderIterator(o,t,e,r,i,n,s){o&&(this.isHighLightManager?o.texture.renderHighLight(e,t,r,o.bbox,i,n):s?o.texture.renderIterator0(e,t,r,o.bbox,n):o.texture.renderIterator(e,t,r,o.bbox,i,n))}},Awe=class{constructor(o){this.color=o}},_we=class{constructor(o,t,e=Dt.ORIGIN){this.color=o,this.position=t,this.target=e}direction(){return this.target.sub(this.position)}},i1e=2e3,mH=class oye extends Swe{constructor(t,e=!1,r){super(),this.planes=[],this.normalPlanes=[],this.colorMap=new fwe,this.colors=[],this.staticPolygonInfoMap=new Xm(32),this.staticPolygonInfoBuilder=new XE(Float32Array),this.stringInfoMap=new Map,this.dashedInfoBuilder=new XE(Float32Array),this.dashedInfoMap=new Map,this.stringInfos=[],this.unit="mil",this.m_dictStateInfo={},this.m_nRecordRenderMode=this.getRenderMode(),this.m_listRecordPanelizeInfo=[],this.renderedPtNum=0,this.hardRenderPlane=[],this.sdfStringInfoMap=new Map,this.sdfStringInfos=[],this.runCapture=!1,this.renderI=0,this.instantiationTime=performance.now();let i=1,n=1;this.sceneType=t,this.useGridAccelerate=!0,this.useProxy=e,EH.includes(t)?this.minWh=SH.getMinRenderGridWH()||2**5:this.minWh=SH.getMinRenderGridWH()||2**3,XRe("cpu"),this.maskCpu=new Eit(this),this.antialiasCanvas=document.createElement("canvas"),this.antialiasCanvas.width=i,this.antialiasCanvas.height=n,this.antialiasContext=new U0(this.antialiasCanvas.getContext("2d")),this.antialiasCanvas1=document.createElement("canvas"),this.antialiasCanvas1.width=i,this.antialiasCanvas1.height=n,this.antialiasContext1=new U0(this.antialiasCanvas1.getContext("2d")),this.antialiasHighLightCanvas1=document.createElement("canvas"),this.antialiasHighLightCanvas1.width=i,this.antialiasHighLightCanvas1.height=n,this.antialiasHighLightContext1=new U0(this.antialiasHighLightCanvas1.getContext("2d")),this.antialiasHighLightCanvas0=document.createElement("canvas"),this.antialiasHighLightCanvas0.width=i,this.antialiasHighLightCanvas0.height=n,this.antialiasHighLightContext0=new U0(this.antialiasHighLightCanvas0.getContext("2d")),this.m_gridProgramCpu=new uit(this,ee.WHITE),this.ruler=new Th(this.getSceneType()),this.ptGroup=new $Re(new XE(Int32Array)),this.ptTemplate=new Ewe(new XE(Float32Array)),this.fillParam=new fit,this.levelTextureManager=new $ve(this,this.normalPlanes,!1),this.highLightLevelTextureManager=new $ve(this,this.normalPlanes,!0),this.group=new Q2(3,!0,"scene"),this.highLightGroup0=new Q2(3,!1,"highLightGroup0"),this.highLightGroup1=new Q2(3,!1,"highLightGroup1"),this.measureTooGroup=new Q2(3,!1,"measureTooGroup"),this.highlightPlane0=this.createHighLightPlane(-.2,0),this.highlightPlane1=this.createHighLightPlane(-.1,1),this.measureToolPlane=this.createMeasureToolPlane(),this.ambientLight=new Awe(ee.build(.1,.1,.1)),this.directionalLight=new _we(ee.build(1,1,1),new Dt(0,0,1)),r&&this.installMessageBus(r)}static build(t,e,r){let i;return e?i=new Proxy(new oye(t,e,r),N_):i=new oye(t,e,r),i}installMessageBus(t){t.rpcService("/engine/scene/setBackgroundColor",e=>{try{this.modifyBgColor(ee.of5(...e))}catch{this.modifyBgColor(ee.of5("#000000",e[1]))}}),t.rpcService("/engine/scene/setCoordSys",e=>{this.isCartesian=e,this.needRender=!0}),t.rpcService("/engine/scene/setGridType",e=>{this.gridParam.visible=e,this.needRender=!0}),t.rpcService("/engine/scene/setGridPattern",e=>{this.m_gridProgramCpu.modifyModel(e),this.needRender=!0}),t.rpcService("/engine/scene/setGridColor",e=>{this.m_gridProgramCpu.getRectangularProgram().modifyColor(ee.of5(...e)),this.needRender=!0}),t.rpcService("/engine/scene/setCoordinateAxisColor",e=>{this.gridParam.coordinateAxisColor=ee.of5(...e),this.gridParam.coordinateAxisTransparency=1-e[1],this.needRender=!0}),t.rpcService("/engine/scene/setGridDelta",e=>{this.m_gridProgramCpu.getRectangularProgram().setGridX(e[0]),this.m_gridProgramCpu.getRectangularProgram().setGridY(e[0]),this.needRender=!0}),t.rpcService("/engine/scene/setPolarDelta",e=>{this.gridParam.angleDelta=Ih.toRadians(e[0]),this.gridParam.radius=e[1],this.needRender=!0}),t.rpcService("/engine/scene/setPolarRadius",e=>{this.gridParam.minRadius=e[0],this.gridParam.maxRadius=e[1],this.needRender=!0}),t.rpcService("/engine/scene/setPolarAngle",e=>{this.gridParam.startAngle=Ih.toRadians(e[0]),this.gridParam.endAngle=Ih.toRadians(e[1]),this.needRender=!0}),t.rpcService("/engine/scene/setOpenRuler",e=>{this.openRuler=e}),t.rpcService("/engine/scene/setUnit",e=>{this.modifyUnit(e),this.needRender=!0}),t.rpcService("/engine/scene/setRulerBackgroundColor",e=>{this.setRulerBackgroundColor(ee.build(e[0],e[1],e[2],e[3]))}),t.rpcService("/engine/scene/setRulerStringColor",e=>{this.setRulerStringColor(ee.build(e[0],e[1],e[2],e[3]))}),t.rpcService("/engine/scene/setRulerTextColor",e=>{this.setRulerStringColor(ee.build(e[0],e[1],e[2],e[3]))}),t.rpcService("/engine/scene/getRulerBackgroundColor",()=>this.getRulerBackgroundColor()),t.rpcService("/engine/scene/getRulerStringColor",()=>this.getRulerStringColor()),t.rpcService("/engine/scene/getRulerTextColor",()=>this.getRulerStringColor())}createMeasureToolPlane(){let t;return this.getUseProxy()?t=new Proxy(new yw(this,ee.WHITE,"MeasureTool",!1,!1),N_):t=new yw(this,ee.WHITE,"MeasureTool",!1,!1),t.setIsColorful(!0),this.measureTooGroup.add(t),this.measureTooGroup.setPosition(new Dt(0,0,-.1)),this.group.add(this.measureTooGroup),this.planes.push(t),t}getMinWh(){return this.minWh}init(){this.measurePtTool=new gwe(this.measureToolPlane,this.currentCamera,new XE(Float32Array)),this.renderRequestAnimationFrame(),this.gridParam.addUpdateListener(()=>{this.needRender=!0})}getUseGridAccelerate(){return this.useGridAccelerate}getUseProxy(){return this.useProxy}createHighLightPlane(t,e){let r;return this.getUseProxy()?r=new Proxy(new yw(this,ee.DefaultHighLightColor,"highLight",!1,!1,!0),N_):r=new yw(this,ee.DefaultHighLightColor,"highLight",!1,!1,!0),r.setIsColorful(!0),e===0?(this.highLightGroup0.add(r),this.highLightGroup0.setPosition(new Dt(0,0,t)),this.group.add(this.highLightGroup0)):e===1&&(this.highLightGroup1.add(r),this.highLightGroup1.setPosition(new Dt(0,0,t)),this.group.add(this.highLightGroup1)),this.planes.push(r),r}renderRequestAnimationFrame(){this.fpsCount(),this.render(),this.renderRuler(),this.animationId=requestAnimationFrame(()=>this.renderRequestAnimationFrame())}clearAccelerateTexture(){this.levelTextureManager.clear(),this.highLightLevelTextureManager.clear()}setForceVisibleHighLightPt(t){t!=this.forceVisibleHighLightPt&&(this.forceVisibleHighLightPt=t,this.clearAccelerateTexture(),this.needRender=!0)}setForceDeactivateRatio(t){this.forceDeactivateRatio!==t&&(this.forceDeactivateRatio=t,this.clearAccelerateTexture(),this.needRender=!0)}getInfo(){return{engine:"cpu",fps:this.getFps(),ptNum:this.planes.reduce((t,e)=>t+e.getPtNum(),0)}}dispose(){this.animationId&&cancelAnimationFrame(this.animationId)}addCamera(t){super.addCamera(t),this.ctx=new U0(this.currentCamera.getCanvas().getContext("2d")),this.resize(),this.init()}addCamera0(t){t.setScene(this),this.currentCamera=t,this.cameraSet.add(t)}createPtTemplateId(){return this.ptTemplate.createTemplateId()}removePtTemplateId(t){return this.ptTemplate.removeTemplateId(t)}addTemplateInstance(t,e){return this.ptTemplate.addTemplateInstance(t,e)}removeTemplateInstance(t,e){this.ptTemplate.removeTemplateInstance(t,e)}updateTemplateInstance(t,e,r){this.ptTemplate.updateTemplateInstance(t,e,r)}getHighLightPlane(t){if(t==0)return this.highlightPlane0;if(t==1)return this.highlightPlane1;throw new Error("highLightGroupId is incorrect")}setFillStyleSpacing(t){this.fillParam.setSpacing(t)}addPtGroup(){return this.ptGroup.add()}removePtGroup(t){this.ptGroup.remove(t),this.updateGroupRenderModeRecord(t,0),this.needRender=!0}setPtGroup(t,e,r=!1,i,n,s,a=0){let l=this.getColorIndex(s);this.ptGroup.set(t,e,r,i,n,l,a),this.comparisonAndRecordPtGroupStatus(this.clearAccelerateTexture.bind(this),t,e,r,i,n,l,a),this.updateGroupRenderModeRecord(t,a)}setStateInfo(t,e,r){r&&(t in this.m_dictStateInfo&&this.m_dictStateInfo[t].old===e||(t in this.m_dictStateInfo||(this.m_dictStateInfo[t]={old:void 0,new:e}),this.m_dictStateInfo[t].new=e))}isStateChange(){for(let t of Object.keys(this.m_dictStateInfo))if(this.m_dictStateInfo[t].new!==void 0&&this.m_dictStateInfo[t].old!==this.m_dictStateInfo[t].new)return gH.LogState&&console.warn("\u72B6\u6001\u4E0D\u540C",t,this.m_dictStateInfo[t].old,this.m_dictStateInfo[t].new),!0;return!1}updateStateInfo(){gH.LogState&&console.log("\u66F4\u65B0\u72B6\u6001");for(let t of Object.keys(this.m_dictStateInfo))this.m_dictStateInfo[t].old=this.m_dictStateInfo[t].new,this.m_dictStateInfo[t].new=void 0}getColorIndex(t,e=0,r=!1){EH.includes(this.getSceneType())&&(r=!0);let i;return!t||!r&&t.r+t.g+t.b===0&&t.alpha===1?i=0:i=this.colorMap.computeIfAbsent(t,()=>{let n=this.colorMap.size()+1;return this.colors[n]=t,n}),(i<<1)+e}addStaticPolygonInfo(t,e,r=-1,i){let n=this.staticPolygonInfoMap.findEmpty();n===-1&&(this.staticPolygonInfoMap=this.staticPolygonInfoMap.extSize(this.staticPolygonInfoMap.size*2),n=this.staticPolygonInfoMap.findEmpty()),this.staticPolygonInfoMap.markUsed(n),this.setStaticPolygonInfo(n,i||Ae.ORIGIN);let s=n*sd+6;return this.staticPolygonInfoBuilder.set(s,t||0),this.staticPolygonInfoBuilder.set(s+1,this.getColorIndex(e)||0),this.staticPolygonInfoBuilder.set(s+2,r),n}addDashedInfo(t){if(t!=null&&t.length){let e=JSON.stringify(t),r=this.dashedInfoMap.get(e);return r!==void 0||(r=this.dashedInfoBuilder.getLength(),this.dashedInfoMap.set(e,r),this.dashedInfoBuilder.pushArr([t.length,...t])),r}else return-1}removeStaticPolygonInfo(t){this.staticPolygonInfoMap.markRemove(t)}setStaticPolygonInfo(t,e){let r=e.data;return this.staticPolygonInfoBuilder.setArr([r[0],r[1],r[4],r[5],r[12],r[13]],t*sd),t*sd}addStringInfo(t){let e=this.stringInfoMap.get(t);return e!==void 0||(e=this.stringInfos.length,this.stringInfoMap.set(t,e),this.stringInfos.push(t)),e}addTextInfo(t,e){let r=`${t}$${JSON.stringify(e)}`,i=this.sdfStringInfoMap.get(t);return i!==void 0||(i=this.sdfStringInfos.length,this.sdfStringInfoMap.set(r,i),this.sdfStringInfos.push({value:t,...e})),i}isCoreGraphic(){return!0}get openRuler(){return this._openRuler}set openRuler(t){this._openRuler!=t&&(this._openRuler=t,this._openRuler?(this.ruler=new Th(this.getSceneType()),this.modifyUnit(this.unit)):delete this.ruler,this.needRender=!0)}getRunCapture(){return this.runCapture}createPlane(t,e,r=null,i=!0,n=!0,s=!1,a=!1){let l;return this.getUseProxy()?l=new Proxy(new yw(this,t,e,i,n,!1,s,a),N_):l=new yw(this,t,e,i,n,!1,s,a),l.setMaterial(r),this.planes.push(l),this.updatePlanePart(this.panelizeMatrix,l),l}renderPlanes(t,e,r,i,n,s,a=!1){t.forEach(l=>{l[0].render(e,r,i,n,l[0].isNormal&&a,s,l[1],l[2])})}renderHighLightPlane(t,e,r,i,n,s,a,l){for(let c=0;c<this.highLightColor.length;c++){if(!this.highLightColor[c])continue;let h;if(c==0)h=r;else if(c==1)h=i;else throw new Error("highLightGroupId is incorrect");e.forEach(u=>{u[0].renderHighLightPt(t,h,c,!(n&&u[0].isNormal),u[0].isNormal?s:!0,a,l)})}this.highlightPlane0.renderHighLightPt(t,r,0,!0,!1,!1,!1),this.highlightPlane1.renderHighLightPt(t,i,1,!0,!1,!1,!1)}renderRuler(){!this.needRender&&this.needRenderRuler&&this.openRuler&&(this.openRuler&&this.ruler.render(this.ctx,this.currentCamera,this.getOrigin(),this.getRulerBackgroundColor(),this.getRulerStringColor()),this.needRenderRuler=!1)}getHasGroupForceHighLight(){return this.hasGroupForceHighLight}render0(t){this.renderI++,this.group.getIsChange()&&(this.clearAccelerateTexture(),this.group.setIsChange(!1)),this.measurePtTool.updateRuler();let e=this.groupStatusQuery(),r=e.hasGroupHighLight;this.hasGroupForceHighLight=e.hasGroupForceHighLight;let i=this.currentCamera.copy();this.antialiasContext.getContext().clearRect(0,0,this.antialiasCanvas.width,this.antialiasCanvas.height),this.antialiasContext1.getContext().clearRect(0,0,this.antialiasCanvas.width,this.antialiasCanvas.height),this.antialiasHighLightContext0.getContext().clearRect(0,0,this.antialiasHighLightCanvas0.width,this.antialiasHighLightCanvas0.height),this.antialiasHighLightContext1.getContext().clearRect(0,0,this.antialiasHighLightCanvas1.width,this.antialiasHighLightCanvas1.height);let n=0;this.planes.forEach(P=>n+=P.getPtNum());let s=[],a=[],l=[],c=[],h=this.getRenderMode(),u=!1;this.group.getPlaneMatrixRenderModes(h).forEach(P=>{let T=P,I=T[0];I.isRender()&&!I.isHighLight&&I.getBBox()&&(s.push(T),I.isNormal&&l.push(T)),!I.isHighLight&&I.getBBox()&&(a.push(T),I.isNormal&&c.push(T)),(I.interPlanes.length!==1||I.subPlanes.length)&&(u=!0)}),this.sortByCameraZ(i,s),this.sortByCameraZ(i,l),this.sortByCameraZ(i,a),this.sortByCameraZ(i,c);let d=this.levelTextureManager.isUseTexture(n,i),p=Number.NEGATIVE_INFINITY;d&&l.length&&(p=this.getNormalPlaneLastRenderZ(i,s),this.renderPlanes(this.getUnderAcceleratePlane(s,p,i),i,this.antialiasContext,this.antialiasHighLightContext0,this.antialiasHighLightContext1,d,d&&r),this.levelTextureManager.render(i,this,this.antialiasContext,[Ae.ORIGIN].concat(this.readPanelizeMat()),l,u)),this.renderPlanes(d?this.getAboveAcceleratePlane(s,p,i):this.getAboveGridPlane(s),i,this.antialiasContext,this.antialiasHighLightContext0,this.antialiasHighLightContext1,d,d&&r),this.renderedPtNum=0;let m=!1;for(let P of this.planes)P.isEmpty()||((P.isHighLight&&P.getPtNum()>0||P.getHighLightPtNumById()>0)&&(m=!0),P.isRender()&&(this.renderedPtNum+=P.renderedPtNum));m&&(d&&this.highLightLevelTextureManager.render(i,this,this.antialiasHighLightContext0,[Ae.ORIGIN],c,!1),this.renderHighLightPlane(i,a,this.antialiasHighLightContext0,this.antialiasHighLightContext1,d,!d||this.drcRenderModel===0,!0,!0));let g=t.getContext();t.setFillStyle(this.backgroundColor.toCSS()),g.fillRect(0,0,g.canvas.width,g.canvas.height),this.renderPlanes(this.getUnderGridPlane(s),i,this.antialiasContext1,this.antialiasHighLightContext0,this.antialiasHighLightContext1,!1,!1),g.drawImage(this.antialiasCanvas1,0,0,g.canvas.width,g.canvas.height);let y=i.getSampling(),b=this.needRender;return i.setSampling(1,!1),this.m_gridProgramCpu.render(t,i),i.setSampling(y,!1),this.needRender=b,g.drawImage(this.antialiasCanvas,0,0,g.canvas.width,g.canvas.height),g.drawImage(this.antialiasHighLightCanvas0,0,0,g.canvas.width,g.canvas.height),g.drawImage(this.antialiasHighLightCanvas1,0,0,g.canvas.width,g.canvas.height),this.maskCpu.render(t,i),this.openRuler&&this.ruler.render(t,i,this.getOrigin(),this.getRulerBackgroundColor(),this.getRulerStringColor()),d}setMask(t,e,r,i){this.maskCpu.setMaskInfo(t,e,r,i)}clearMask(){this.maskCpu.clear()}setAntialias(t,e=this.currentCamera.getWidth(),r=this.currentCamera.getHeight()){super.setAntialias(t),this.setSampling(t?2:1,e,r)}setDrcRenderModel(t){this.drcRenderModel=t,this.clearAccelerateTexture(),this.needRender=!0}setDrcRenderStyle(t){this.drcRenderStyle=t,this.clearAccelerateTexture(),this.needRender=!0}checkNeedUpdateTexture(){let t;this.isStateChange()&&(t="layerChange",this.updateStateInfo());let e=this.getRenderMode();e!==this.m_nRecordRenderMode&&(t=`RenderModeChange ${this.m_nRecordRenderMode} -> ${e}`,this.m_nRecordRenderMode=e);let r=[Ae.ORIGIN,...this.readPanelizeMat()];if(r.length===this.m_listRecordPanelizeInfo.length)for(let i of r){let n=!1;for(let s of this.m_listRecordPanelizeInfo)if(s.equals(i)){n=!0;break}if(!n){t="PanelizeChange";break}}else t="PanelizeChange";this.m_listRecordPanelizeInfo=r,t!==void 0&&(gH.LogTextureChange&&console.warn("\u66F4\u65B0\u7EB9\u7406",t),this.clearAccelerateTexture())}render(t=this.currentCamera){var e,r;if(!this.needRender||!this.currentCamera.isOrthCamera())return;this.needRender=!1,this.checkNeedUpdateTexture();let i=this.currentCamera.getPxLength(),n=this.render0(this.ctx);if(this.renderedPtNum>i1e){this.levelTextureManager.setMinPxLength(i),this.highLightLevelTextureManager.setMinPxLength(i);let s=0,a=this.planes.filter(l=>!l.isRender()||l.isNormal?!1:(s+=l.renderedPtNum,!0));if(s>i1e){a.sort((c,h)=>c.renderedPtNum-h.renderedPtNum);let l=0;for(let c of a)l+=c.renderedPtNum,!(l<=i1e)&&((e=c.levelTextureManager)==null||e.setMinPxLength(i),(r=c.highLightTextureManager)==null||r.setMinPxLength(i))}}if(n!==this.lastUsingTexture&&(console.log(n?"use tex":"not use tex"),this.lastUsingTexture=n),this.instantiationTime&&this.planes.findIndex(s=>s.builder.getPtNum()!==0)!==-1){console.log("init time:",performance.now()-this.instantiationTime),delete this.instantiationTime;let s=0,a=Array(69).fill(0);this.planes.forEach(l=>{s+=l.builder.getPtNum();let c=l.getPtTypeNum();for(let h=0;h<c.length;h++)a[h]+=c[h]}),console.log("ptNum:",s),console.log("\u5404\u7C7B\u578B\u56FE\u5143\u6570\u91CF:",a)}return!0}async getTexture(t){return await createImageBitmap(t)}modifyBgColor(t){this.backgroundColor=t,this.needRender=!0}resizeExceptCanvas(t,e){this.currentCamera.updateSize(t,e);let r=this.getAntialias()?2:1;this.currentCamera.setSampling(r),this.antialiasCanvas.width=t*r,this.antialiasCanvas.height=e*r,this.antialiasContext.reset(),this.antialiasCanvas1.width=t*r,this.antialiasCanvas1.height=e*r,this.antialiasContext1.reset(),this.antialiasHighLightCanvas0.width=t*r,this.antialiasHighLightCanvas0.height=e*r,this.antialiasHighLightContext0.reset(),this.antialiasHighLightCanvas1.width=t*r,this.antialiasHighLightCanvas1.height=e*r,this.antialiasHighLightContext1.reset(),this.needRender=!0}resize(){let t=this.currentCamera.getCanvas(),e=this.getPixelRatio(),r=t.getBoundingClientRect(),i=Math.round(r.width*e),n=Math.round(r.height*e);(i===0||n===0)&&(i=1,n=1),!(t.width===i&&t.height===n)&&(this.currentCamera.updateSize(i,n),t.width=i,t.height=n,this.ctx.reset(),this.resizeExceptCanvas(i,n))}modifyUnit(t){this.openRuler&&this.ruler.scaleRuler.modifyUnit(t),this.unit=t}capture(t,e,r,i,n=1){let s=this.getSampling(),a=this.needRender;this.runCapture=!0;let l=this.currentCamera.getWidth(),c=this.currentCamera.getHeight(),h=document.createElement("canvas");h.width=t,h.height=e;let u=new U0(h.getContext("2d"));this.setSampling(n,t,e),r(),this.render0(u);let d=u.getContext().getImageData(0,0,t,e);return this.setSampling(s,l,c),i(),this.needRender=a,this.runCapture=!1,d}getCaptureImageData(t,e,r,i,n=!0,s=0){let a,l,c,h,u,d,p;return this.capture(t,e,()=>{p=this.getDrawLineWidthStyle(),this.setDrawLineWidthStyle(s),a=this.openRuler,this.openRuler=!1,l=this.gridParam.visible,d=this.gridParam.getMultiStyle(),this.gridParam.visible=0,this.gridParam.setMultiStyle(2),c=this.getBgColor(),n&&this.modifyBgColor(ee.BLACK),h=this.currentCamera.getTarget(),u=this.currentCamera.getScale(),this.currentCamera.setTarget(new Dt(r.center().x,r.center().y,0)),this.currentCamera.setScale(i)},()=>{this.setDrawLineWidthStyle(p),this.openRuler=a,this.gridParam.visible=l,this.gridParam.setMultiStyle(d),n&&this.modifyBgColor(c),this.currentCamera.setTarget(h),this.currentCamera.setScale(u)})}getCaptureImageData1(t,e,r,i){return this.capture(t,e,r,i)}setDrawingBgColor(t){this.drawingBackgroundColor=t,this.clearAccelerateTexture(),this.needRender=!0}getBBox3(){throw new Error("Method not implemented.")}setDrcArrowPtStyle(t,e,r,i,n,s,a){super.setDrcArrowPtStyle(t,e,r,i,n,s,a),this.fixedPtData[0]=this.getColorIndex(t)}getFixedPtData(){return this.fixedPtData}getMeasurePtTool(){return this.measurePtTool}setSampling(t,e=this.currentCamera.getWidth(),r=this.currentCamera.getHeight()){this.currentCamera.setSampling(t),this.resizeExceptCanvas(e,r)}getSampling(){return this.currentCamera.getSampling()}renderExternal(t=3,e=null){if(e){this.setRenderMode(t);for(let r of this.cameraSet)this.render(r)}}getMaxWH(){return 4096}getCaptureToCanvasInfo(t,e,r){let i=t.copy(new ht(-1,1,-1,1)),n=i.adapt(r),s=n[2]/i.getScale(),a=n[3]/i.getScale(),{pxLength:l,fixedWidth:c,fixedHeight:h}=e;if(l)s/=l,a/=l;else if(c)l=s/c,a*=c/s,s=c;else if(h)l=a/h,s*=h/a,a=h;else throw new Error("\u622A\u56FE\u8BBE\u7F6E\u53C2\u6570\u975E\u6CD5\uFF01");(s>rh||a>rh)&&(s>a?(l*=s/rh,a=rh*a/s,s=rh):(l*=a/rh,s=rh*s/a,a=rh));let u=this.getMaxWH(),d=Math.ceil(s/u),p=Math.ceil(a/u),m=Math.floor(s/d),g=Math.floor(a/p);return{width:d*m,height:p*g,scale:1/l}}captureToCanvas(t,e,r,i){let n=Array.from(this.cameraSet);for(let w of n)this.delCamera(w);let s=t.copy(new ht(-1,1,-1,1));this.addCamera0(s);let a=s.adapt(r),l=a[2]/s.getScale(),c=a[3]/s.getScale(),{pxLength:h,fixedWidth:u,fixedHeight:d}=e;if(h)l/=h,c/=h;else if(u)h=l/u,c*=u/l,l=u;else if(d)h=c/d,l*=d/c,c=d;else throw new Error("\u622A\u56FE\u8BBE\u7F6E\u53C2\u6570\u975E\u6CD5\uFF01");(l>rh||c>rh)&&(l>c?(h*=l/rh,c=rh*c/l,l=rh):(h*=c/rh,l=rh*l/c,c=rh));let p=i?this.getMaxWH()/8:this.getMaxWH(),m=Math.ceil(l/p),g=Math.ceil(c/p),y=Math.floor(l/m),b=Math.floor(c/g);s.setScale(1/h);let P=document.createElement("canvas");P.width=m*y,P.height=g*b;let T=P.getContext("2d"),I=this.openRuler,C=this.gridParam.visible;this.openRuler=!1,this.gridParam.visible=0;let E=(m-1)/2,O=(g-1)/2,_=r.center(),x=r.toBBox2(),v=x.width()/m,D=x.height()/g;for(let w=0;w<m;w++)for(let F=0;F<g;F++){s.setTarget(new Dt(_.x-(E-w)*v,_.y+(O-F)*D,0),!0);let H=this.capture(y,b,()=>{},()=>{},2);if(i&&i()||(T.putImageData(H,y*w,b*F),i&&i()))return null}this.openRuler=I,this.gridParam.visible=C,this.delCamera(s);for(let w of n)this.addCamera(w);return P}updatePlaneArrayPart(t){for(let e=0;e<this.planes.length;e++){let r=this.planes[e];r.clearParts();for(let i=0;i<t.length;i++)r.isPanelize()?r.addPart(t[i],r):i==0&&r.addPart(Qe.ORIGIN,r)}}updatePlanePart(t,e){if(t.length){e.clearParts();for(let r=0;r<t.length;r++)e.isPanelize()?e.addPart(t[r],e):r==0&&e.addPart(Qe.ORIGIN,e)}}},xw=(o=>(o.Auto="auto",o.WebGPU="webgpu",o.Canvas2D="canvas2d",o))(xw||{}),nJ=(o=>(o[o.PCB=0]="PCB",o[o.SCH=1]="SCH",o[o.FOOTPRINT=2]="FOOTPRINT",o[o.ECAD=3]="ECAD",o[o.SYMBOL=4]="SYMBOL",o[o.DEFAULT=5]="DEFAULT",o))(nJ||{});async function vwe(o,t="auto",e=window.top,r=5,i=!0,n){let s;Lye.value=e,H0.init(e),SH.init(e),q1.init(e);let a=H0.useProxy();if(H0.useCpuEngine())s=mH.build(r,a,n),console.log("render engine: cpu");else if(H0.useGpuEngine())s=await LZ.build(r,i,a,n),console.log("render engine: webgpu");else if(t==="canvas2d")s=mH.build(r,a,n),console.log("render engine: cpu");else if(t==="webgpu")s=await LZ.build(r,i,a,n),console.log("render engine: webgpu");else try{s=await LZ.build(r,i,a,n),console.log("render engine: webgpu")}catch(l){console.warn(l),s=mH.build(r,a,n),console.log("render engine: cpu")}return{scene:s}}var g2e=(o=>(o[o.USE_COLOR=0]="USE_COLOR",o[o.WIREFRAME=1]="WIREFRAME",o[o.USE_MATERIAL=2]="USE_MATERIAL",o[o.RELY_ON_OTHER=3]="RELY_ON_OTHER",o[o.FORCE_TO_USE_SINGLE_COLOR=4]="FORCE_TO_USE_SINGLE_COLOR",o))(g2e||{}),W7=1,Hp=(o=>(o[o.FIXED=0]="FIXED",o[o.ZOOM=1]="ZOOM",o))(Hp||{}),oJ=(o=>(o[o.CROSS=0]="CROSS",o[o.TRIANGLE=1]="TRIANGLE",o))(oJ||{}),yP=(o=>(o[o.MASK=0]="MASK",o[o.PT=1]="PT",o))(yP||{}),kit=(o=>(o[o.FOLLOW_SCALE=0]="FOLLOW_SCALE",o[o.ALWAYS_ONE_PX=1]="ALWAYS_ONE_PX",o))(kit||{}),y2e=(o=>(o.BUTT="butt",o.ROUND="round",o.SQUARE="square",o))(y2e||{}),$7={butt:0,round:1,square:2},sJ={0:"butt",1:"round",2:"square"},Bit=(o=>(o[o.None=0]="None",o[o.Solid=1]="Solid",o[o.Grid=2]="Grid",o[o.HorizontalLine=3]="HorizontalLine",o[o.VerticalLine=4]="VerticalLine",o[o.RhombicGrid=5]="RhombicGrid",o[o.LeftSlashLine=6]="LeftSlashLine",o[o.RightSlashLine=7]="RightSlashLine",o))(Bit||{}),Fit=(o=>(o[o.NoWrap=0]="NoWrap",o[o.Wrap=1]="Wrap",o))(Fit||{}),Vit=(o=>(o[o.Left=0]="Left",o[o.Right=1]="Right",o[o.Center=2]="Center",o))(Vit||{}),Git=(o=>(o[o.Top=0]="Top",o[o.Bottom=1]="Bottom",o[o.Middle=2]="Middle",o))(Git||{}),Uit=(o=>(o[o.HIDE=0]="HIDE",o[o.VISIBLE=1]="VISIBLE",o))(Uit||{}),gH=class{};gH.LogState=!0,gH.LogTextureChange=!0;var Hit=4,EH=[1,3,4],L_=256,N7=256,rh=4096,xwe=4,Wit=2,zit=(o=>(o[o.FOLLOW_SCENE=0]="FOLLOW_SCENE",o[o.WIREFRAME=1]="WIREFRAME",o[o.USE_COLOR=2]="USE_COLOR",o))(zit||{}),OH=class{constructor(o,t,e,r,i){this.gpu=o,this.buffer=o.createBuffer(t,e,r,i),o.buffers.add(this)}get usage(){return this.buffer.usage}getSize(){return this.buffer.size/rs}getBuffer(){return this.buffer}async read(o="f32"){let t;switch(o){case"f32":t=Float32Array;break;case"i32":t=Int32Array;break;case"u32":t=Uint32Array;break}return new t(await this.gpu.readBuffer(this,0,this.getSize()))}destroy(){let o=LC();o.bufferSizeGPU-=this.buffer.size,this.gpu.debugBufferSizeIndex[this.buffer.label]-=this.buffer.size,this.gpu.debugBufferSizeIndex[this.buffer.label]===0&&delete this.gpu.debugBufferSizeIndex[this.buffer.label],this.buffer.destroy(),delete this.buffer,this.gpu.buffers.delete(this)}},xZ=class extends OH{constructor(o,t,e,r){super(o,t,e,!1,r),this.listeners=new Set}static merge(o){let t=l(),e=c(h=>h.gpu),r=c(h=>h.buffer.label),i=c(h=>h.usage);if(!t)return null;let n=e.createDynamicBuffer(t,i,r),s=e.device.createCommandEncoder(),a=0;return o.forEach(h=>{let u=h.getSize();e.copyBufferToBuffer(h,0,n,a,u,s),a+=u}),e.submit(s),n;function l(){let h=0;return o.forEach(u=>h+=u.getSize()),h}function c(h){let u=Array.from(new Set(o.map(h)));if(u.length!==1)throw new Error;return u[0]}}setSize(o){o!==this.getSize()&&this.setBuffer(this.gpu.createBuffer(o,this.buffer.usage,!1,this.buffer.label))}extSize(o){if(o<=this.getSize())return;let t=this.gpu.createBuffer(o,this.buffer.usage,!1,this.buffer.label);this.gpu.copyBufferToBufferGpu(this.buffer,0,t,0,this.getSize()),this.setBuffer(t)}trim(o){if(this.getSize()===o)return;if(this.getSize()<o)throw new Error("this.getSize() < size32");let t=this.gpu.createBuffer(o,this.buffer.usage,!1,this.buffer.label);this.gpu.copyBufferToBufferGpu(this.buffer,0,t,0,o),this.setBuffer(t)}setBuffer(o){let t=LC();t.bufferSizeGPU-=this.buffer.size,this.gpu.debugBufferSizeIndex[this.buffer.label]-=this.buffer.size,this.gpu.debugBufferSizeIndex[this.buffer.label]===0&&delete this.gpu.debugBufferSizeIndex[this.buffer.label],this.buffer.destroy(),this.buffer=o,this.listeners.forEach(e=>e(this.buffer))}setDynamicBuffer(o){this.setBuffer(o.buffer),delete o.buffer}clear(o,t=0,e=this.getSize()-t){o.clearBuffer(this.buffer,t*rs,e*rs)}addListener(o){this.listeners.add(o)}delListener(o){this.listeners.delete(o)}write(o,t,e=0,r){this.gpu.writeBuffer(this,o,t,e,r)}},fH=class{constructor(o,t,e,r){this.memory=o.memoryManager.malloc(t*rs,e,r)}get usage(){return this.memory.getBuffer().usage}getSize(){return this.memory.getSize32()}getMemory(){return this.memory}read(o=0,t=this.getSize()){return this.memory.read(o*rs,t*rs)}free(){this.memory.free()}setSize(o,t=!0){this.memory.setSize(o*rs,t)}clear(o,t=0,e=this.getSize()-t){o.clearBuffer(this.memory.getBuffer(),this.memory.getOffset()+t*rs,e*rs)}write(o,t,e=0,r){this.memory.writeBuffer(o*rs,t,e&&e*rs,r&&r*rs)}toDynamicBuffer(){let o=this.memory.getWebGPU(),t=o.createDynamicBuffer(this.getSize(),this.usage,this.memory.getBuffer().label);return o.copyBufferToBuffer(this,0,t,0,this.getSize()),t}},n1e=2**31,Rwe=class{constructor(o,t,e,r,i,n){if(this.listeners=new Set,this.win=LC(),this.gpu=o,this.format=r,this.usage=i,this.isExceedMaxTextureDimension2D(Math.max(t,e)),this.win.textureSizeGPU=(this.win.textureSizeGPU||0)+t*e*4,H0.isEnableLog()&&console.log("textureSizeGPU:",this.win.textureSizeGPU/2**20,"M"),this.win.textureSizeGPU>n1e){console.warn(`textureSizeGPU is too large: ${this.win.textureSizeGPU/2**20} M`);debugger}this._texture=o.device.createTexture({size:[t,e],format:r,usage:i,label:n}),this._view=this._texture.createView(),o.textures.add(this)}get texture(){return this._texture}get view(){return this._view}get width(){return this._texture.width}get height(){return this._texture.height}get label(){return this._texture.label}getDepthView(){return this._texture.createView({aspect:"depth-only"})}getStencilView(){return this._texture.createView({aspect:"stencil-only"})}isExceedMaxTextureDimension2D(o){if(o>this.gpu.limits.maxTextureDimension2D)throw new Error("Texture exceeds maxTextureDimension2D")}updateSize(o,t){if(!(o===this.width&&t===this.height)){if(this.isExceedMaxTextureDimension2D(Math.max(o,t)),this.win.textureSizeGPU-=this._texture.width*this._texture.height*4,this._texture.destroy(),this.win.textureSizeGPU+=o*t*4,H0.isEnableLog()&&console.log("textureSizeGPU:",this.win.textureSizeGPU/2**20,"M"),this.win.textureSizeGPU>n1e){console.warn(`textureSizeGPU is too large: ${this.win.textureSizeGPU/2**20} M`);debugger}this._texture=this.gpu.device.createTexture({size:[o,t],format:this.format,usage:this.usage,label:this._texture.label}),this._view=this._texture.createView(),this.listeners.forEach(e=>e(this._view))}}extSize(o,t,e,r){let i=this.width+o+e,n=this.height+t+r;if(this.isExceedMaxTextureDimension2D(Math.max(i,n)),this.win.textureSizeGPU+=i*n*4,console.log("textureSizeGPU:",this.win.textureSizeGPU/2**20,"M"),this.win.textureSizeGPU>n1e){console.warn(`textureSizeGPU is too large: ${this.win.textureSizeGPU/2**20} M`);debugger}let s=this.gpu.device.createTexture({size:[i,n],format:this.format,usage:this.usage,label:this._texture.label});this.gpu.run(a=>a.copyTextureToTexture({texture:this._texture},{texture:s,origin:{x:o,y:t}},this._texture)),this.win.textureSizeGPU-=this._texture.width*this._texture.height*4,H0.isEnableLog()&&console.log("textureSizeGPU:",this.win.textureSizeGPU/2**20,"M"),this._texture.destroy(),this._texture=s,this._view=this._texture.createView(),this.listeners.forEach(a=>a(this._view))}addListener(o){this.listeners.add(o)}delListener(o){this.listeners.delete(o)}destroy(){this.win.textureSizeGPU-=this._texture.width*this._texture.height*4,console.log("textureSizeGPU:",this.win.textureSizeGPU/2**20,"M"),this._texture.destroy(),delete this._texture,this.gpu.textures.delete(this)}},Yit=class{constructor(o,t,...e){this.bufferListeners=[],this.gpu=o,this.layout=t,this.entries=[];for(let r=1;r<e.length;r+=2){let i=e[r-1],n=e[r];if(typeof i!="number"||typeof n=="number")throw new Error("typeof binding !== 'number' || typeof resource === 'number'");if(n instanceof fH){let s=n.getMemory(),a={buffer:s.getBuffer(),offset:s.getOffset(),size:s.getSize()};this.entries.push({binding:i,resource:a});let l=c=>{if(c.getSize()===0)throw new Error("buffer.size === 0");a.buffer=c.getBuffer(),a.offset=c.getOffset(),a.size=c.getSize(),this.updateBindGroup()};s.addListener(l),this.bufferListeners.push([s,l])}else if(n instanceof OH){let s={buffer:n.getBuffer()};if(this.entries.push({binding:i,resource:s}),n instanceof xZ){let a=l=>{if(l.size===0)throw new Error("buffer.size === 0");s.buffer=l,this.updateBindGroup()};n.addListener(a),this.bufferListeners.push([n,a])}}else if(n instanceof Rwe){let s=this.entries.push({binding:i,resource:n.view})-1,a=l=>{this.entries[s].resource=l,this.updateBindGroup()};n.addListener(a),this.bufferListeners.push([n,a])}else this.entries.push({binding:i,resource:n})}this.updateBindGroup()}updateBindGroup(){this.bindGroup=this.gpu.device.createBindGroup({layout:this.layout,entries:this.entries})}getBindGroup(){return this.bindGroup}destroy(){this.bufferListeners.forEach(([o,t])=>o.delListener(t)),delete this.bindGroup}},jit=class{constructor(o,t,e){this.listeners=new Set,this.allocator=o,this.offset=t,this.size=e}getWebGPU(){return this.allocator.gpu}getAllocator(){return this.allocator}getBuffer(){return this.allocator.getBuffer()}getOffset(){return this.offset}getSize(){return this.size}getSize32(){return this.size/rs}setSize(o,t=!0){this.allocator.gpu.memoryManager.realloc(this,o,t)}update(o,t,e){this.allocator=o,this.offset=t,this.size=e,this.listeners.forEach(r=>r(this))}free(){this.allocator.gpu.memoryManager.free(this)}addListener(o){this.listeners.add(o)}delListener(o){this.listeners.delete(o)}clear(){let o=this.allocator.gpu,t=o.device.createCommandEncoder();t.clearBuffer(this.getBuffer(),this.offset,this.size),o.submit(t)}writeBuffer(o,t,e=0,r){if(r===void 0&&(r=Math.min(this.size-o,t.byteLength-e)),o+r>this.size||e+r>t.byteLength)throw new Error("offset + size > buffer.size || dataOffset + size > data.byteLength");this.allocator.gpu.device.queue.writeBuffer(this.getBuffer(),this.offset+o,t instanceof ArrayBuffer?t:t.buffer,e,r)}async read(o,t){let e=this.getBuffer();if(!(e.usage&GPUBufferUsage.COPY_SRC))throw new Error("!(buffer.usage & GPUBufferUsage.COPY_SRC)");let r=this.allocator.gpu,i=r.device.createBuffer({size:t-o,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST,label:"readBuf"}),n=r.device.createCommandEncoder();n.copyBufferToBuffer(e,this.offset+o,i,0,i.size),r.submit(n),await i.mapAsync(GPUMapMode.READ);let s=i.getMappedRange().slice(0);return i.unmap(),i.destroy(),s}},sye=64*2**10,aye=256;if(!Number.isInteger(sye/aye))throw new Error("!Number.isInteger(MIN_BUFFER_SIZE / CHUNK_SIZE)");function yH(o){return Math.ceil(o/aye)*aye}var Xit=class{constructor(o,t,e,r){this.chunks=new M7,this.memorys=new Set,this.gpu=o;let i=Math.ceil(t/sye)*sye;this.chunks.add({start:0,size:i}),this.buffer=o.device.createBuffer({size:i,usage:e,label:r}),o.buffers.add(this.buffer);let n=LC();if(n.bufferSizeGPU=(n.bufferSizeGPU||0)+i,o.debugBufferSizeIndex[r]=(o.debugBufferSizeIndex[r]||0)+i,n.bufferSizeGPU>2**30){console.warn(`bufferSizeGPU is too large: ${n.bufferSizeGPU}`);debugger}}forEachChunk(o){let t=this.chunks.listIterator();for(;t.hasNext();)if(o(t.next()))return}getFirstChunk(){return this.chunks.listIterator().next()}useChunk(o,t){if(t=yH(t),t===o.item.size)this.chunks.remove(o);else if(t<o.item.size)o.item.start+=t,o.item.size-=t;else throw new Error("chunkNum > chunk.item.chunkNum")}releaseChunk(o){let t,e,r=this.chunks.listIterator();for(;r.hasNext();){let s=r.next();if(o.start<s.item.start){e=s;break}t=s}let i=t&&t.item.start+t.item.size===o.start,n=e&&o.start+o.size===e.item.start;i&&n?(t.item.size+=o.size+e.item.size,this.chunks.remove(e)):i?t.item.size+=o.size:n?(e.item.size+=o.size,e.item.start=o.start):e?this.chunks.insertBefore(e,o):this.chunks.addLast(o)}getMemorys(){return this.memorys}getBuffer(){return this.buffer}malloc(o,t){let e=new jit(this,t.item.start,o);return this.memorys.add(e),this.useChunk(t,o),e}transfer(o,t,e,r,i){if(i){let n=this.gpu.device.createCommandEncoder();n.copyBufferToBuffer(this.buffer,o.getOffset(),t.buffer,e.item.start,Math.min(o.getSize(),r)),this.gpu.submit(n)}o.free(),t.memorys.add(o),o.update(t,e.item.start,r),t.useChunk(e,r)}isEmpty(){return this.chunks.size()!==1?!1:this.getFirstChunk().item.size===this.buffer.size}isFull(){return this.chunks.size()===0}getResourceSize(){return this.chunks.size()}free(o){this.memorys.delete(o),this.releaseChunk({start:o.getOffset(),size:yH(o.getSize())})}destroy(){let o=this.buffer,t=LC();t.bufferSizeGPU-=o.size,this.gpu.debugBufferSizeIndex[o.label]-=o.size,o.destroy()}},qit=class{constructor(o){this.allocatorIndex={},this.gpu=o,window.logMemoryInfo=()=>{let t=0,e=0,r=0;Object.values(this.allocatorIndex).forEach(i=>i.allocators.forEach(n=>{t+=n.getMemorys().size,n.getMemorys().forEach(s=>{e+=s.getSize()}),r+=n.getBuffer().size})),H0.isEnableLog()&&(console.log("\u5171\u4EAB\u5185\u5B58\u6570\u91CF:",t),console.log("\u5171\u4EAB\u5185\u5B58\u6240\u9700\u5185\u5B58(\u5355\u4F4D: M):",e/2**20),console.log("\u5171\u4EAB\u5185\u5B58\u5B9E\u9645\u5185\u5B58(\u5355\u4F4D: M):",r/2**20))}}getMinChunk(o,t,e){t=yH(t);let r,i,n=Number.POSITIVE_INFINITY;for(let s of this.allocatorIndex[o].allocators)if(s!==e&&(s.forEachChunk(a=>{let l=a.item.size-t;return l<0||l>=n?!1:(r=a,n=l,i=s,l===0)}),n===0))break;if(!r){let s=new Xit(this.gpu,t,this.allocatorIndex[o].usage,o);this.allocatorIndex[o].allocators.add(s),r=s.getFirstChunk(),i=s}return{chunk:r,allocator:i}}malloc(o,t,e){t=t|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST;let r=this.allocatorIndex[e];if(r||(this.allocatorIndex[e]=r={allocators:new Set,usage:t}),r.usage!==t)throw new Error("\u540C\u6807\u7B7E\u7684\u7F13\u51B2 usage \u4E0D\u540C");let i=this.getMinChunk(e,o);return i.allocator.malloc(o,i.chunk)}alignMemory(){return!1}realloc(o,t,e){if(t===o.getSize())return;let r=o.getAllocator(),i=yH(t),n=yH(o.getSize());if(i===n){o.update(r,o.getOffset(),t);return}if(i<n){r.releaseChunk({start:o.getOffset()+i,size:n-i}),o.update(r,o.getOffset(),t);return}let s=this.getMinChunk(o.getBuffer().label,t,r);r.transfer(o,s.allocator,s.chunk,t,e)}free(o){let t=o.getAllocator();if(t.free(o),!t.isEmpty())return;let e=t.getBuffer().label;t.destroy(),this.allocatorIndex[e].allocators.delete(t)}},$it=class extends OH{constructor(o,t,e,r){super(o,t.length,e,!0,r),new Uint32Array(this.buffer.getMappedRange()).set(t),this.buffer.unmap()}},Dwe=class wwe{constructor(t){this.presentationFormat=navigator.gpu.getPreferredCanvasFormat(),this.memoryManager=new qit(this),this.tempBufIndex={},this.buffers=new Set,this.textures=new Set,this.debugBufferSizeIndex={},this.device=t,this.coordXOffsetBuf=this.createStaticBuffer(new Uint32Array(1024).map((r,i)=>i*t.limits.maxComputeWorkgroupsPerDimension*t.limits.maxComputeWorkgroupSizeX),GPUBufferUsage.COPY_SRC,"coordXOffsetBuf of WebGPU"),this.groupOffsetXsBuf=this.createStaticBuffer(new Uint32Array(new Array(1024).fill(0).map((r,i)=>i*this.limits.maxComputeWorkgroupsPerDimension)),GPUBufferUsage.COPY_SRC,"groupOffsetXsBuf of WebGPU"),this.numBuf=this.createStaticBuffer(new Uint32Array(1024).map((r,i)=>i),GPUBufferUsage.COPY_SRC,"numBuf of WebGPU"),t.features.has("texture-compression-bc")?this.textureCompression="bc":t.features.has("texture-compression-etc2")?this.textureCompression="etc2":t.features.has("texture-compression-astc")&&(this.textureCompression="astc"),this.linearSampler=t.createSampler({magFilter:"linear",minFilter:"linear"}),this.nearestSampler=t.createSampler({magFilter:"nearest",minFilter:"nearest"}),window.addEventListener("unload",()=>{this.buffers.forEach(r=>r.destroy()),this.textures.forEach(r=>r.destroy())});let e=LC();e.bufferSizeIndex=this.debugBufferSizeIndex,e.getBufferInfo=()=>{let r={},i=0,n=0;this.buffers.forEach(s=>{let a=s instanceof OH?s.getBuffer().size:s.size;r[a]=(r[a]||0)+1,i+=a,n+=Math.ceil(a/65536)*65536}),console.log(r),console.log("size:",i/2**20),console.log("realSize:",n/2**20)},e.getTextureInfo=()=>{this.textures.forEach(r=>{console.log("width:",r.width),console.log("height:",r.height)});for(let r=0;r<20;r++){let i=2**r,n=0,s=0;this.textures.forEach(a=>{n+=a.width*a.height*4,s+=Math.ceil(a.width/i)*i*Math.ceil(a.height/i)*i*4}),console.log("\u5BF9\u9F50\u50CF\u7D20\uFF1A",i),console.log("size:",n/2**20),console.log("realSize:",s/2**20)}}}static async build(){let t=LC();if(!t.navigator.gpu)throw new Error("not support WebGPU!");let e=await t.navigator.gpu.requestAdapter(),r={maxTextureDimension1D:e.limits.maxTextureDimension1D,maxTextureDimension2D:e.limits.maxTextureDimension2D,maxTextureDimension3D:e.limits.maxTextureDimension3D,maxTextureArrayLayers:e.limits.maxTextureArrayLayers,maxBindGroups:e.limits.maxBindGroups,maxBindGroupsPlusVertexBuffers:e.limits.maxBindGroupsPlusVertexBuffers,maxBindingsPerBindGroup:e.limits.maxBindingsPerBindGroup,maxDynamicUniformBuffersPerPipelineLayout:e.limits.maxDynamicUniformBuffersPerPipelineLayout,maxDynamicStorageBuffersPerPipelineLayout:e.limits.maxDynamicStorageBuffersPerPipelineLayout,maxSampledTexturesPerShaderStage:e.limits.maxSampledTexturesPerShaderStage,maxSamplersPerShaderStage:e.limits.maxSamplersPerShaderStage,maxStorageBuffersPerShaderStage:e.limits.maxStorageBuffersPerShaderStage,maxStorageTexturesPerShaderStage:e.limits.maxStorageTexturesPerShaderStage,maxUniformBuffersPerShaderStage:e.limits.maxUniformBuffersPerShaderStage,maxUniformBufferBindingSize:e.limits.maxUniformBufferBindingSize,maxStorageBufferBindingSize:e.limits.maxStorageBufferBindingSize,minUniformBufferOffsetAlignment:e.limits.minUniformBufferOffsetAlignment,minStorageBufferOffsetAlignment:e.limits.minStorageBufferOffsetAlignment,maxVertexBuffers:e.limits.maxVertexBuffers,maxBufferSize:e.limits.maxBufferSize,maxVertexAttributes:e.limits.maxVertexAttributes,maxVertexBufferArrayStride:e.limits.maxVertexBufferArrayStride,maxInterStageShaderComponents:e.limits.maxInterStageShaderComponents,maxInterStageShaderVariables:e.limits.maxInterStageShaderVariables,maxColorAttachments:e.limits.maxColorAttachments,maxColorAttachmentBytesPerSample:e.limits.maxColorAttachmentBytesPerSample,maxComputeWorkgroupStorageSize:e.limits.maxComputeWorkgroupStorageSize,maxComputeInvocationsPerWorkgroup:e.limits.maxComputeInvocationsPerWorkgroup,maxComputeWorkgroupSizeX:e.limits.maxComputeWorkgroupSizeX,maxComputeWorkgroupSizeY:e.limits.maxComputeWorkgroupSizeY,maxComputeWorkgroupSizeZ:e.limits.maxComputeWorkgroupSizeZ,maxComputeWorkgroupsPerDimension:e.limits.maxComputeWorkgroupsPerDimension};for(let n in r)r[n]===void 0&&delete r[n];let i=await e.requestDevice({requiredLimits:r,requiredFeatures:e.features});return H0.isEnableLog()&&console.log(i.limits,Array.from(e.features)),i.lost.then(n=>t._WEBGPU_DEVICE_LOST_INFO_=n),i.addEventListener("uncapturederror",n=>{throw n.error.message}),new wwe(i)}get limits(){return this.device.limits}get features(){return this.device.features}createShaderModule(t){return this.device.createShaderModule({code:t})}getTempBuf(t){return t=2**Math.ceil(Math.log2(t)),this.tempBufIndex[t]||(this.tempBufIndex[t]=this.createDynamicBuffer(t,GPUBufferUsage.STORAGE|GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,`tempBuf ${t} of WebGPU`)),this.tempBufIndex[t]}createBuffer(t,e,r,i){let n=LC();if(n.bufferSizeGPU=(n.bufferSizeGPU||0)+t*rs,this.debugBufferSizeIndex[i]=(this.debugBufferSizeIndex[i]||0)+t*rs,n.bufferSizeGPU>2**30){console.warn(`bufferSizeGPU is too large: ${n.bufferSizeGPU}`);debugger}return this.device.createBuffer({size:t*rs,usage:e,mappedAtCreation:r,label:i})}createDynamicBuffer(t,e,r){return new xZ(this,t,e,r)}createDynamicBufferWithData(t,e,r){if(t instanceof Float32Array){let i=new xZ(this,t.length,e,r);return this.writeBuffer(i,0,t),i}if(Array.isArray(t))return this.createDynamicBufferWithData(new Float32Array(t),e,r);if(typeof t=="number")return new xZ(this,t,e,r);throw new TypeError("Invalid data type provided")}createStorageDynamicBuffer(t,e){let r=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC;return this.createDynamicBufferWithData(t,r,e)}createUniformDynamicBuffer(t,e){let r=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC;return this.createDynamicBufferWithData(t,r,e)}createSharedBuffer(t,e,r){return new fH(this,t,e,r)}createStaticBuffer(t,e,r){return new $it(this,t,e,r)}createDynamicTexture(t,e,r,i,n){return new Rwe(this,t,e,r,i,n)}createComputePipeline(t,e,r,i="auto",n){return typeof t=="string"&&(t=this.createShaderModule(t)),this.device.createComputePipeline({layout:i,compute:{module:t,entryPoint:e,constants:n},label:r})}async createComputePipelineAsync(t,e,r,i="auto",n){return typeof t=="string"&&(t=this.createShaderModule(t)),await this.device.createComputePipelineAsync({layout:i,compute:{module:t,entryPoint:e,constants:n},label:r})}submit(...t){this.device.queue.submit(t.map(e=>e.finish()))}copyBufferToBufferGpu(t,e,r,i,n,s){if(e+n>t.size/rs||i+n>r.size/rs)throw new Error("sourceOffset32 + size32 > source || destinationOffset32 + size32 > destination");if(s)s.copyBufferToBuffer(t,e*rs,r,i*rs,n*rs);else{let a=this.device.createCommandEncoder();a.copyBufferToBuffer(t,e*rs,r,i*rs,n*rs),this.submit(a)}}copyBufferToBuffer(t,e,r,i,n,s){if(e+n>t.getSize()||i+n>r.getSize())throw new Error("sourceOffset32 + size32 > source.getSize() || destinationOffset32 + size32 > destination.getSize()");let a,l,c,h,u=n*rs;if(t instanceof fH){let d=t.getMemory();a=d.getBuffer(),l=d.getOffset()+e*rs}else a=t.getBuffer(),l=e*rs;if(r instanceof fH){let d=r.getMemory();c=d.getBuffer(),h=d.getOffset()+i*rs}else c=r.getBuffer(),h=i*rs;if(s)s.copyBufferToBuffer(a,l,c,h,u);else{let d=this.device.createCommandEncoder();d.copyBufferToBuffer(a,l,c,h,u),this.submit(d)}}writeBuffer(t,e,r,i=0,n){if(n===void 0&&(n=Math.min(t.getSize()-e,r.byteLength/rs-i)),e+n>t.getSize()||(i+n)*rs>r.byteLength)throw new Error("bufferOffset32 + size32 > buffer.getSize() || (dataOffset32 + size32) * BYTES32 > data.byteLength");this.device.queue.writeBuffer(t.getBuffer(),e*rs,r instanceof ArrayBuffer?r:r.buffer,i*rs,n*rs)}runComputePass(t,e,r,i,n=s=>{if(s!==0)throw new Error("i !== 0")}){let{maxComputeWorkgroupsPerDimension:s,maxComputeWorkgroupSizeX:a}=this.limits,l=Math.ceil(i/a);for(let c=0;c<l;c+=s){n(c/s);let h=t.beginComputePass();h.setPipeline(e),h.setBindGroup(0,r),h.dispatchWorkgroups(Math.min(l-c,s)),h.end()}}run(t){let e=this.device.createCommandEncoder();t(e),this.submit(e)}runComputePassIndirect(t,e,r,i,n=0){let s=t.beginComputePass();s.setPipeline(e),s.setBindGroup(0,r),s.dispatchWorkgroupsIndirect(i.getBuffer(),n),s.end()}createBindGroup(t,e,...r){let i=[];for(let n=1;n<r.length;n+=2){let s=r[n-1],a=r[n];if(typeof s!="number"||typeof a=="number")throw new Error("typeof binding !== 'number' || typeof resource === 'number'");if(a instanceof OH)i.push({binding:s,resource:{buffer:a.getBuffer()}});else if(a instanceof fH){let l=a.getMemory();i.push({binding:s,resource:{buffer:l.getBuffer(),offset:l.getOffset(),size:l.getSize()}})}else i.push({binding:s,resource:a})}return this.device.createBindGroup({layout:e,entries:i,label:t})}createDynamicBindGroup(t,...e){return new Yit(this,t,...e)}clearColorView(t,e,r=e,i=e,n=1){let s=this.device.createCommandEncoder();s.beginRenderPass({colorAttachments:[{view:t,clearValue:{r:e,g:r,b:i,a:n},loadOp:"clear",storeOp:"store"}]}).end(),this.submit(s)}clearDepthView(t,e=0){let r=this.device.createCommandEncoder();r.beginRenderPass({colorAttachments:[],depthStencilAttachment:{view:t,depthClearValue:e,depthLoadOp:"clear",depthStoreOp:"store"}}).end(),this.submit(r)}async readBuffer(t,e=0,r=t.getSize()){if(!(t.usage&GPUBufferUsage.COPY_SRC))throw new Error("!(buffer.usage & GPUBufferUsage.COPY_SRC)");let i=this.createDynamicBuffer(r-e,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST,"readBuf");this.copyBufferToBuffer(t,e,i,0,r-e),await i.getBuffer().mapAsync(GPUMapMode.READ);let n=i.getBuffer().getMappedRange().slice(0);return i.getBuffer().unmap(),i.destroy(),n}},Lwe=60;function Kit(o,t){let e=new Float32Array(Lwe);e.set(o.getRenderMatrix().data),e.set(o.getViewMatrix().data,16),e.set(o.getInverseMatrix().data,32);let r=o.getPosition();e[48]=r.x,e[49]=r.y,e[50]=r.z,e[51]=o.isOrthCamera()?1:0;let i=o.getTar2Pos().scale(-1);return e[52]=i.x,e[53]=i.y,e[54]=i.z,e[55]=t===Number.NEGATIVE_INFINITY?-1:o.getBorderZ(t),e[56]=o.getPxLength(),e[57]=Dt.X_UNIT_VECTOR.multiply4(o.getRenderMatrix()).x<Dt.ORIGIN.multiply4(o.getRenderMatrix()).x?1:0,e[58]=o.getWidth(),e[59]=o.getHeight(),e}var Kve="struct O_a { O_b : mat4x4 < f32 > , O_c : mat4x4 < f32 > , O_d : mat4x4 < f32 > , O_e : vec3 < f32 > , O_f : f32 , O_g : vec3 < f32 > , O_h : f32 , O_i : f32 , O_j : f32 , O_k : f32 , O_l : f32 , } struct O_m { O_n : mat3x2 < f32 > , O_o : f32 , O_p : f32 , O_q : f32 , O_r : f32 , O_s : f32 , O_t : f32 , } struct O_u { O_n : mat3x2 < f32 > , O_r : f32 , O_v : f32 , } struct O_w { O_x : f32 , O_y : f32 , O_z : f32 , O_aa : f32 , O_ab : f32 , O_ac : f32 , O_ad : f32 , } struct O_ae { O_p : f32 , O_af : f32 , O_ag : f32 , O_ah : f32 , O_ai : f32 , O_aj : f32 , O_ak : f32 , } struct O_al { O_am : vec3 < f32 > , O_an : vec3 < f32 > , } struct O_ao { O_n : mat4x4 < f32 > , O_ap : vec3 < f32 > , O_aq : vec3 < f32 > , O_ar : vec3 < f32 > , O_as : f32 , O_ad : f32 , O_at : f32 , } @ group ( 0 ) @ binding ( 0 ) var < uniform > O_au : O_ao ; @ group ( 0 ) @ binding ( 1 ) var < uniform > O_av : O_a ; @ group ( 0 ) @ binding ( 2 ) var O_aw : sampler ; @ group ( 0 ) @ binding ( 3 ) var O_ax : texture_2d < f32 > ; struct O_ay { @ builtin ( position ) O_az : vec4 < f32 > , @ location ( 0 ) O_ba : vec2 < f32 > , @ location ( 1 ) O_am : vec3 < f32 > , @ location ( 2 ) O_an : vec3 < f32 > , } struct O_bb { @ location ( 0 ) O_bc : vec4 < f32 > , } @ vertex fn v_main ( @ location ( 0 ) O_bd : vec2 < f32 > , @ location ( 1 ) O_ba : vec2 < f32 > , ) -> O_ay { var O_be : O_ay ; O_be . O_az = O_av . O_b * O_au . O_n * vec4 ( O_bd , 0 , 1.0 ) ; if ( O_au . O_ad == 2 ) { let O_n = O_av . O_c * O_au . O_n ; O_be . O_am = mat3x3 ( vec3 ( O_n [ 0 ] . xyz ) , vec3 ( O_n [ 1 ] . xyz ) , vec3 ( O_n [ 2 ] . xyz ) ) * vec3 < f32 > ( 0 , 0 , 1 ) ; let O_e = O_n * vec4 ( O_bd . xy , 0 , 1 ) ; O_be . O_an = - O_e . xyz / O_e . w ; } O_be . O_ba = O_ba ; return O_be ; } @ fragment fn f_main ( @ location ( 0 ) O_ba : vec2 < f32 > , @ location ( 1 ) O_am : vec3 < f32 > , @ location ( 2 ) O_an : vec3 < f32 > , ) -> O_bb { var O_be : O_bb ; if ( O_au . O_ad != 2 ) { var O_bc = textureSample ( O_ax , O_aw , O_ba ) ; O_bc . a *= O_au . O_as ; O_be . O_bc = O_bc ; return O_be ; } let O_bf = vec2 < i32 > ( floor ( O_ba * vec2 < f32 > ( textureDimensions ( O_ax ) ) ) ) ; var O_bc = textureLoad ( O_ax , O_bf , 0 ) ; if ( O_bc . a < 0.01 ) { discard ; } let O_bg : vec3 < f32 > = vec3 ( 0 , 0 , 0 ) ; let O_bh : vec3 < f32 > = vec3 ( O_bc . r , O_bc . g , O_bc . b ) ; let O_bi : vec3 < f32 > = vec3 ( 0 , 0 , 0 ) ; var O_bj = O_bg * O_au . O_ap ; var O_bk = normalize ( O_am ) ; var O_ar = O_au . O_ar ; var O_bl = abs ( dot ( O_bk , O_ar ) ) * O_bh * O_au . O_aq ; var O_bm = - 2.0 * O_bk * dot ( O_ar , O_bk ) + O_ar ; var O_bn = normalize ( O_an ) ; var O_bo = abs ( dot ( O_bm , O_bn ) ) ; var O_bp = O_bi * O_au . O_aq * pow ( O_bo , 300.0 ) * O_au . O_at * 0.1 ; O_be . O_bc = vec4 ( O_bj + O_bl + O_bp , O_au . O_as ) ; return O_be ; } ",Zve=36,Zit=class{constructor(o){this.vertexStrideLen=4,this.scene=o;let t=o.gpu;this.gpu=t,this.device=t.device,this.pipeline=this.createPipeline(),this.renderDesc=this.createRenderDesc(),this.uniformBuffer=t.createDynamicBuffer(Zve,GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,"uniformBuffer of TextureProgram"),this.vertexBuf=t.createDynamicBuffer(this.vertexStrideLen*6,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,"vertexBuf of TextureProgram")}createPipeline(){return this.device.createRenderPipeline({layout:"auto",vertex:{module:this.gpu.createShaderModule(Kve),entryPoint:"v_main",buffers:[{arrayStride:this.vertexStrideLen*rs,attributes:[{shaderLocation:0,offset:0,format:"float32x2"},{shaderLocation:1,offset:8,format:"float32x2"}]}]},fragment:{module:this.gpu.createShaderModule(Kve),entryPoint:"f_main",targets:[{format:_a,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"},depthStencil:{depthWriteEnabled:!1,depthCompare:"always",format:J2,stencilReadMask:255,stencilBack:{compare:"equal"},stencilFront:{compare:"equal"}}})}createRenderDesc(){return{colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"}}}createBindGroup(o){return this.gpu.createBindGroup("Pt Texture",this.pipeline.getBindGroupLayout(0),0,this.uniformBuffer,1,this.scene.cameraBuf,2,this.gpu.linearSampler,3,o.view)}render(o,t,e,r,i){if(!e.gpuTexture)return;this.renderDesc.colorAttachments[0].view=o.colorTexture.view,this.renderDesc.depthStencilAttachment.view=o.depthStencilTexture.view;let n=new Float32Array(Zve);n.set(t.data),n.set(this.scene.ambientLight.color.getData(),16),n.set(this.scene.directionalLight.color.getData(),20);let s=this.scene.directionalLight.direction();n.set([s.x,s.y,s.z],24),n[27]=e.alpha,n[28]=r,n[29]=i==null?void 0:i.shininess,this.scene.addData(new Uint32Array(n.buffer),this.uniformBuffer),this.scene.addData(new Uint32Array(new Float32Array([e.rdPoint.x,e.rdPoint.y,1,1,e.ldPoint.x,e.ldPoint.y,0,1,e.luPoint.x,e.luPoint.y,0,0,e.ruPoint.x,e.ruPoint.y,1,0,e.rdPoint.x,e.rdPoint.y,1,1,e.luPoint.x,e.luPoint.y,0,0]).buffer),this.vertexBuf);let a=this.scene.commandEncoder.beginRenderPass(this.renderDesc);a.setPipeline(this.pipeline),a.setStencilReference(64),a.setBindGroup(0,e.bindGroup),a.setVertexBuffer(0,this.vertexBuf.getBuffer()),a.draw(6,1,0,0),a.end()}},Jit=class extends F_{constructor(o){super(),this.gpu=o,this.texture=o.createDynamicTexture(this.canvas.width,this.canvas.height,_a,GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,"PixelCharGPU")}flush(){if(!this.changed)return;this.changed=!1;let{width:o,height:t}=this.canvas,e=this.context.getImageData(0,0,o,t);this.gpu.device.queue.writeTexture({texture:this.texture.texture},e.data,{bytesPerRow:o*4},[o,t])}},Qit="@ group ( 0 ) @ binding ( 0 ) var O_a : sampler ; @ group ( 0 ) @ binding ( 1 ) var O_b : texture_2d < f32 > ; struct O_c { @ builtin ( position ) O_d : vec4 < f32 > , @ location ( 0 ) O_e : vec2 < f32 > , } @ vertex fn vert ( @ location ( 0 ) O_f : vec2 < f32 > , ) -> O_c { var O_g : O_c ; O_g . O_d = vec4 ( O_f , 0.0 , 1.0 ) ; O_g . O_e = ( O_f + 1.0 ) * 0.5 ; O_g . O_e . y = 1.0 - O_g . O_e . y ; return O_g ; } @ fragment fn frag ( @ location ( 0 ) O_e : vec2 < f32 > , ) -> @ location ( 0 ) vec4 < f32 > { return textureSample ( O_b , O_a , O_e ) ; } ",ent=class{constructor(o){this.m_nSampling=1,this.m_scene=o;let t=o.gpu;this.gpu=t,this.m_device=t.device,this.m_renderDesc={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]},this.m_sampler=this.gpu.linearSampler,this.m_posBuf=t.createStaticBuffer(new Uint32Array(new Float32Array([-1,-1,-1,1,1,1,-1,-1,1,1,1,-1]).buffer),GPUBufferUsage.VERTEX,"PosBuf of SSAAGPU"),this.m_nPosBufCount=this.m_posBuf.getSize()/2;let e=t.createShaderModule(Qit);this.m_pipeline=this.m_device.createRenderPipeline({layout:"auto",vertex:{module:e,entryPoint:"vert",buffers:[{arrayStride:2*rs,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]}]},fragment:{module:e,entryPoint:"frag",targets:[{format:_a,blend:{color:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}}),this.colorTexture=t.createDynamicTexture(1,1,_a,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_SRC,"colorTexture of ScreenAAGPU"),this.highLightColorTexture0=t.createDynamicTexture(1,1,_a,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_SRC,"highLightColorTexture of ScreenAAGPU"),this.highLightColorTexture1=t.createDynamicTexture(1,1,_a,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_SRC,"highLightColorTexture of ScreenAAGPU"),this.clearColorDesc=this.createRenderDesc(this.colorTexture.view),this.clearHighLightColorDesc0=this.createRenderDesc(this.highLightColorTexture0.view),this.clearHighLightColorDesc1=this.createRenderDesc(this.highLightColorTexture1.view),this.colorTexture.addListener(r=>this.clearColorDesc.colorAttachments[0].view=r),this.highLightColorTexture0.addListener(r=>this.clearHighLightColorDesc0.colorAttachments[0].view=r),this.highLightColorTexture1.addListener(r=>this.clearHighLightColorDesc1.colorAttachments[0].view=r),this.m_bindGroup=this.createDynamicBindGroup(this.colorTexture),this.m_bindGroup_highLight0=this.createDynamicBindGroup(this.highLightColorTexture0),this.m_bindGroup_highLight1=this.createDynamicBindGroup(this.highLightColorTexture1)}createRenderDesc(o){return{colorAttachments:[{view:o,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}],label:"renderDesc of ScreenAAGPU"}}createDynamicBindGroup(o){return this.m_scene.gpu.createDynamicBindGroup(this.m_pipeline.getBindGroupLayout(0),0,this.m_sampler,1,o)}clearColor(){this.m_scene.commandEncoder.beginRenderPass(this.clearColorDesc).end(),this.m_scene.commandEncoder.beginRenderPass(this.clearHighLightColorDesc0).end(),this.m_scene.commandEncoder.beginRenderPass(this.clearHighLightColorDesc1).end()}setSampling(o){this.m_nSampling=U7.positive(o)}getSampling(){return this.m_nSampling}renderSSAA(o,t){this.m_renderDesc.colorAttachments[0].view=o;let e=this.m_bindGroup.getBindGroup();t!=null&&(t==0?e=this.m_bindGroup_highLight0.getBindGroup():e=this.m_bindGroup_highLight1.getBindGroup());let r=this.m_scene.commandEncoder.beginRenderPass(this.m_renderDesc);r.setPipeline(this.m_pipeline),r.setBindGroup(0,e),r.setVertexBuffer(0,this.m_posBuf.getBuffer()),r.draw(this.m_nPosBufCount),r.end(),this.m_scene.submitCommandEncoder()}},tnt="struct O_a { O_b : vec4 < f32 > , O_c : f32 , O_d : f32 , O_e : f32 , O_f : f32 , O_g : vec4 < f32 > , O_h : vec4 < f32 > , } @ binding ( 0 ) @ group ( 0 ) var < uniform > O_i : O_a ; @ binding ( 1 ) @ group ( 0 ) var < storage , read > O_j : array < vec4 < f32 > > ; override RENDER_HIGHLIGHT_TYPE_SHIFT : f32 ; fn O_k ( O_l : f32 , ) -> u32 { return u32 ( O_l ) >> u32 ( RENDER_HIGHLIGHT_TYPE_SHIFT ) ; } fn O_m ( O_c : u32 , ) -> vec4 < f32 > { var O_b : vec4 < f32 > ; if ( O_c > 0 ) { O_b = O_j [ O_c ] ; if ( O_b . r + O_b . g + O_b . b == 0 ) { O_b . r = O_i . O_g . r ; O_b . g = O_i . O_g . g ; O_b . b = O_i . O_g . b ; } O_b . a *= O_i . O_g . a ; } else { O_b = O_i . O_g ; } return O_b ; } fn O_n ( O_c : f32 , ) -> vec4 < f32 > { var O_b : vec4 < f32 > ; let O_l = O_k ( O_c ) ; if ( O_i . O_e == 0 && O_i . O_d == 1 ) { if ( O_i . O_f == 1 ) { O_b = O_i . O_h ; } else { O_b = O_i . O_g ; } } else { if ( O_i . O_d == 1 ) { O_b = O_m ( O_l ) ; } else { if ( O_l > 0 ) { O_b = O_j [ O_l ] ; if ( O_b . r + O_b . g + O_b . b == 0 ) { O_b = O_i . O_b ; } } else { O_b = O_i . O_b ; } } } return O_b ; } @ vertex fn fullVert ( @ builtin ( vertex_index ) O_o : u32 , ) -> @ builtin ( position ) vec4 < f32 > { var O_p = array < vec2 < f32 > , 6 > ( vec2 < f32 > ( 1.0 , 1.0 ) , vec2 < f32 > ( 1.0 , - 1.0 ) , vec2 < f32 > ( - 1.0 , - 1.0 ) , vec2 < f32 > ( 1.0 , 1.0 ) , vec2 < f32 > ( - 1.0 , - 1.0 ) , vec2 < f32 > ( - 1.0 , 1.0 ) ) ; return vec4 < f32 > ( O_p [ O_o ] , 0.5 , 1.0 ) ; } @ fragment fn fullFrag ( ) -> @ location ( 0 ) vec4 < f32 > { return O_n ( O_i . O_c ) ; } ",rnt="struct O_a { O_b : mat4x4 < f32 > , O_c : mat4x4 < f32 > , O_d : mat4x4 < f32 > , O_e : vec3 < f32 > , O_f : f32 , O_g : vec3 < f32 > , O_h : f32 , O_i : f32 , O_j : f32 , O_k : f32 , O_l : f32 , } struct O_m { O_n : mat3x2 < f32 > , O_o : f32 , O_p : f32 , O_q : f32 , O_r : f32 , O_s : f32 , O_t : f32 , } struct O_u { O_n : mat3x2 < f32 > , O_r : f32 , O_v : f32 , } struct O_w { O_x : f32 , O_y : f32 , O_z : f32 , O_aa : f32 , O_ab : f32 , O_ac : f32 , O_ad : f32 , } struct O_ae { O_p : f32 , O_af : f32 , O_ag : f32 , O_ah : f32 , O_ai : f32 , O_aj : f32 , O_ak : f32 , } struct O_al { O_am : vec3 < f32 > , O_an : vec3 < f32 > , } struct O_ao { O_ap : vec4 < f32 > , O_i : f32 , O_ad : u32 , O_aq : f32 , O_ar : f32 , O_as : u32 , O_at : f32 , O_au : f32 , O_av : f32 , O_aw : vec4 < f32 > , O_ax : vec4 < f32 > , O_ay : vec4 < f32 > , O_az : f32 , O_ba : f32 , @ align ( 16 ) O_bb : O_ae , } @ binding ( 0 ) @ group ( 0 ) var < uniform > O_bc : O_a ; @ binding ( 1 ) @ group ( 0 ) var < uniform > O_bd : O_ao ; @ binding ( 2 ) @ group ( 0 ) var < storage , read > O_be : array < f32 > ; @ binding ( 3 ) @ group ( 0 ) var < storage , read > O_bf : array < O_m > ; @ binding ( 4 ) @ group ( 0 ) var < storage , read > O_bg : array < u32 > ; @ binding ( 5 ) @ group ( 0 ) var O_bh : texture_2d < f32 > ; @ binding ( 6 ) @ group ( 0 ) var O_bi : sampler ; @ binding ( 7 ) @ group ( 0 ) var < storage , read > O_bj : array < f32 > ; @ binding ( 8 ) @ group ( 0 ) var < storage , read > O_bk : array < f32 > ; @ binding ( 9 ) @ group ( 0 ) var < storage , read > O_bl : array < vec4 < f32 > > ; @ binding ( 10 ) @ group ( 0 ) var < storage , read > O_bm : array < O_u > ; @ binding ( 11 ) @ group ( 0 ) var < storage , read > O_bn : array < f32 > ; @ binding ( 12 ) @ group ( 0 ) var < storage , read > O_bo : array < u32 > ; override CIRCLE_PT_LENGTH : i32 ; override ARC_PT_LENGTH : i32 ; override TRIANGLE_PT_LENGTH : i32 ; override RECT_PT_LENGTH : i32 ; override LINE_PT_LENGTH : i32 ; override CUTED_CIRCLE_PT_LENGTH : i32 ; override LINESEGMENT_PT_LENGTH : i32 ; override SEMICIRCLE_PT_LENGTH : i32 ; override STATIC_TRIANGLE_PT_LENGTH : i32 ; override STATIC_CUTED_CIRCLE_PT_LENGTH : i32 ; override MATH_PI : f32 ; override ANTIALIAS_RATIO : f32 ; override DRC_PT_LENGTH : i32 ; override CHAR_WIDTH : f32 ; override CHAR_HEIGHT : f32 ; override CANVAS_WIDTH : f32 ; override CANVAS_HEIGHT : f32 ; override MIN_PX_LENGTH_RATIO : f32 ; override SDF_WIDTH : f32 ; override SDF_HEIGHT : f32 ; override RENDER_HIGHLIGHT_TYPE_SHIFT : f32 ; override STRING_PT_LENGTH : i32 ; override TEMPLATE_INSTANCE_PT_LENGTH : i32 ; override STRING_LEVEL_BITLENGTH : u32 ; override POINT_PT_LENGTH : i32 ; override SCALE_STRING_PT_LENGTH : i32 ; override SCALE_ARROW_PT_LENGTH : i32 ; override FIXED_ARROW_PT_LENGTH : i32 ; override GROUP_DATA_LENGTH : u32 ; override PTGROUP_VISIBLE_SHIFT : u32 ; override PTGROUP_DOUBLERGB_SHIFT : u32 ; override PTGROUP_HIGH_LIGHT_SHIFT : u32 ; override PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT : u32 ; override PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT : u32 ; fn O_bp ( O_p : f32 , ) -> f32 { return f32 ( u32 ( O_p ) & u32 ( RENDER_HIGHLIGHT_TYPE_SHIFT ) ) ; } fn O_bq ( id : i32 , O_p : f32 , ) -> i32 { var O_br = 1 ; if ( id == - 1 ) { O_br = 0 ; } let O_bs = O_bp ( O_p ) ; if ( ( O_bd . O_au == 0 && O_bs == 1 && ( O_bd . O_av == 0 || O_bd . O_az == 1 ) ) ) { O_br = 0 ; } return O_br ; } fn O_bt ( O_p : u32 , ) -> vec4 < f32 > { var O_ap : vec4 < f32 > ; var O_ax = O_bd . O_ax ; if ( O_bd . O_at == 0 && O_bd . O_av == 1 ) { O_ax = O_bd . O_ay ; } if ( O_p > 0 ) { O_ap = O_bl [ O_p ] ; if ( O_ap . r + O_ap . g + O_ap . b == 0 ) { O_ap . r = O_ax . r ; O_ap . g = O_ax . g ; O_ap . b = O_ax . b ; } O_ap . a *= O_ax . a ; } else { O_ap = O_ax ; } return O_ap ; } fn O_bu ( O_p : f32 , O_bv : f32 , O_bw : f32 , O_bx : f32 , ) -> vec4 < f32 > { var O_ap : vec4 < f32 > ; let O_by = O_bz ( O_p ) ; if ( O_bx == 1 ) { O_ap = O_bt ( O_by ) ; } else { if ( O_by > 0 ) { O_ap = O_bl [ O_by ] ; if ( O_ap . r + O_ap . g + O_ap . b == 0 ) { O_ap = O_bd . O_ap ; } } else { O_ap = O_bd . O_ap ; } } O_ap = vec4 ( O_ap . r , O_ap . g , O_ap . b , O_ap . a * O_bv ) ; return O_ap ; } fn O_ca ( O_cb : f32 , O_q : f32 , ) -> f32 { let O_cc = O_cd ( O_q ) ; let O_ac = O_ce ( O_cb , O_cc . O_ac ) ; return O_ac ; } fn O_cf ( O_cb : f32 , O_q : f32 , ) -> f32 { let O_cc = O_cd ( O_q ) ; return O_cc . O_ad ; } fn O_bz ( O_by : f32 , ) -> u32 { return u32 ( O_by ) >> u32 ( RENDER_HIGHLIGHT_TYPE_SHIFT ) ; } fn O_cg ( O_ch : f32 , O_ci : vec2 < f32 > , ) -> vec2 < f32 > { let O_cj = O_bm [ i32 ( O_ch ) ] ; return O_cj . O_n * vec3 ( O_ci , 1.0 ) ; } fn O_ck ( O_cl : vec2 < f32 > , vec2 : vec2 < f32 > , ) -> f32 { return O_cl . x * vec2 . y - O_cl . y * vec2 . x ; } fn O_cm ( O_cn : f32 , ) -> vec4 < f32 > { let O_co = vec4 ( 1.0 , 2.0 , 3.0 , 4.0 ) - O_cn ; let O_cp = O_co * O_co * O_co ; let O_cq = O_cp . x ; let O_cr = O_cp . y - 4.0 * O_cp . x ; let O_cs = O_cp . z - 4.0 * O_cp . y + 6.0 * O_cp . x ; let O_ct = 6.0 - O_cq - O_cr - O_cs ; return vec4 ( O_cq , O_cr , O_cs , O_ct ) * ( 1.0 / 6.0 ) ; } fn O_cu ( O_cv : vec2 < f32 > , O_cw : f32 , O_cx : f32 , O_cy : f32 , ) -> f32 { let size = vec2 < f32 > ( O_cw , O_cx ) ; let O_cz = 1.0 / size ; var O_da = O_cv * size - 0.5 ; let O_db = fract ( O_da ) ; O_da = O_da - O_db ; let O_dc = O_cm ( O_db . x ) ; let O_dd = O_cm ( O_db . y ) ; let O_de = O_da . xxyy + vec4 ( - 0.5 , 1.5 , - 0.5 , 1.5 ) ; let O_cp = vec4 ( O_dc . xz + O_dc . yw , O_dd . xz + O_dd . yw ) ; var O_df = O_de + vec4 ( O_dc . yw , O_dd . yw ) / O_cp ; O_df = O_df * O_cz . xxyy ; let O_dg = O_dh ( O_df . xz , O_cw , O_cx , O_cy ) ; let O_di = O_dh ( O_df . yz , O_cw , O_cx , O_cy ) ; let O_dj = O_dh ( O_df . xw , O_cw , O_cx , O_cy ) ; let O_dk = O_dh ( O_df . yw , O_cw , O_cx , O_cy ) ; let O_dl = O_cp . x / ( O_cp . x + O_cp . y ) ; let O_dm = O_cp . z / ( O_cp . z + O_cp . w ) ; return mix ( mix ( O_dk , O_dj , O_dl ) , mix ( O_di , O_dg , O_dl ) , O_dm ) ; } fn O_dh ( O_cv : vec2 < f32 > , O_cw : f32 , O_cx : f32 , O_cy : f32 , ) -> f32 { let O_k = i32 ( O_cw ) ; let O_l = i32 ( O_cx ) ; let O_dn = O_cv . x * O_cw - 0.5 ; let O_do = O_cv . y * O_cx - 0.5 ; let O_dp = fract ( O_dn ) ; let O_dq = fract ( O_do ) ; let O_df = i32 ( O_cy ) ; let O_dr = i32 ( floor ( O_dn ) ) ; let O_ds = i32 ( floor ( O_do ) ) ; let O_dt = clamp ( O_dr , 0 , O_k - 1 ) ; let O_du = clamp ( O_dr + 1 , 0 , O_k - 1 ) ; let O_dv = clamp ( O_ds , 0 , O_l - 1 ) ; let O_dw = clamp ( O_ds + 1 , 0 , O_l - 1 ) ; let O_dx = O_bk [ O_df + ( O_dv * O_k + O_dt ) ] ; let O_dy = O_bk [ O_df + ( O_dv * O_k + O_du ) ] ; let O_dz = O_bk [ O_df + ( O_dw * O_k + O_dt ) ] ; let O_ea = O_bk [ O_df + ( O_dw * O_k + O_du ) ] ; let O_eb = mix ( O_dx , O_dy , O_dp ) ; let O_ec = mix ( O_dz , O_ea , O_dp ) ; return mix ( O_eb , O_ec , O_dq ) ; } fn O_ed ( O_ee : u32 , O_ef : vec2 < f32 > , O_eg : f32 , O_eh : f32 , O_ei : f32 , O_ej : f32 , O_ek : f32 , ) -> vec2 < f32 > { let O_el = O_ei + O_ej / 2 ; let O_em = vec2 ( cos ( O_el ) , sin ( O_el ) ) ; var O_en = vec2 ( O_em . y , - O_em . x ) ; let O_eo = cos ( O_ej / 2 ) * O_eh - O_ek ; let O_ep = O_em * O_eo ; let O_cq = ( - O_eo + sqrt ( O_eo * O_eo + 8 * O_eg * O_eg ) ) / 2 ; let O_eq = O_em * O_cq ; let tan = sqrt ( O_cq * O_cq - O_eg * O_eg ) / O_eg ; let O_er = O_en * ( ( O_cq - O_eo ) / tan ) ; var O_ci = O_ef ; if ( O_ej < 0 ) { if ( O_ee == 0 ) { O_ci += O_er ; O_ci += O_ep ; } else if ( O_ee == 1 ) { O_ci -= O_er ; O_ci += O_ep ; } else { O_ci += O_eq ; } } else { if ( O_ee == 0 ) { O_ci -= O_er ; O_ci += O_ep ; } else if ( O_ee == 1 ) { O_ci += O_er ; O_ci += O_ep ; } else { O_ci += O_eq ; } } return O_ci ; } fn O_es ( O_ee : u32 , O_ef : vec2 < f32 > , O_eg : f32 , O_ei : f32 , O_ej : f32 , O_et : vec2 < f32 > , O_eu : vec2 < f32 > , ) -> vec2 < f32 > { var O_ci = vec2f ( 0 , 0 ) ; if ( abs ( abs ( O_ej ) - 6.283185307179586 ) <= 1e-8 ) { O_ci = O_ef ; if ( O_ej > 0 ) { if ( O_ee == 0 ) { O_ci . x += O_eg * ( - sqrt ( 3.0 ) ) ; O_ci . y += O_eg * ( - 1.0 ) ; } else if ( O_ee == 1 ) { O_ci . x += O_eg * ( sqrt ( 3.0 ) ) ; O_ci . y += O_eg * ( - 1.0 ) ; } else { O_ci . y += O_eg * ( 2.0 ) ; } } else { if ( O_ee == 0 ) { O_ci . x += O_eg * ( sqrt ( 3.0 ) ) ; O_ci . y += O_eg * ( - 1.0 ) ; } else if ( O_ee == 1 ) { O_ci . x += O_eg * ( - sqrt ( 3.0 ) ) ; O_ci . y += O_eg * ( - 1.0 ) ; } else { O_ci . y += O_eg * ( 2.0 ) ; } } } else { let O_el = O_ei + O_ej / 2 ; let O_em = vec2 ( cos ( O_el ) , sin ( O_el ) ) ; var O_en = normalize ( O_eu - O_et ) ; let O_eo = cos ( O_ej / 2 ) * O_eg ; let O_cq = ( - O_eo + sqrt ( O_eo * O_eo + 8 * O_eg * O_eg ) ) / 2 ; let O_eq = O_em * O_cq ; let tan = sqrt ( O_cq * O_cq - O_eg * O_eg ) / O_eg ; let O_er = O_en * ( ( O_cq - O_eo ) / tan ) - ( O_eu - O_et ) / 2 ; if ( O_ee == 0 ) { O_ci = O_eu + O_er ; } else if ( O_ee == 1 ) { O_ci = O_et - O_er ; } else { O_ci = O_ef + O_eq ; } } return O_ci ; } struct O_ev { O_et : vec2f , O_eu : vec2f , O_en : vec2f , } fn O_ew ( O_et : vec2f , O_eu : vec2f , O_ex : f32 , O_k : f32 , O_ey : f32 , ) -> O_ev { var O_ez : O_ev ; var O_en = normalize ( O_eu - O_et ) ; if ( O_ex == 1 || O_ex == 2 ) { var O_fa : vec2f ; if ( all ( O_et == O_eu ) ) { O_en = vec2 ( 1 , 0 ) ; } O_fa = O_en * max ( O_k , O_ey ) / 2 ; O_ez . O_et = O_et - O_fa ; O_ez . O_eu = O_eu + O_fa ; O_ez . O_en = O_en ; return O_ez ; } O_ez . O_et = O_et ; O_ez . O_eu = O_eu ; O_ez . O_en = O_en ; return O_ez ; } fn O_fb ( O_fc : u32 , ) -> u32 { return O_fc >> PTGROUP_VISIBLE_SHIFT ; } fn O_fd ( O_fc : u32 , ) -> u32 { return ( O_fc >> PTGROUP_DOUBLERGB_SHIFT ) & 1 ; } fn O_fe ( O_fc : u32 , ) -> u32 { return ( O_fc >> PTGROUP_HIGH_LIGHT_SHIFT ) & 1 ; } fn O_ff ( O_fc : u32 , ) -> u32 { return ( O_fc >> PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT ) & 1 ; } fn O_fg ( O_fc : u32 , ) -> u32 { return O_fc & 1 ; } fn O_fh ( O_fc : u32 , ) -> u32 { return O_fc >> PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT ; } fn O_cd ( O_q : f32 , ) -> O_w { var O_ez : O_w ; if ( O_q != - 1 ) { let O_fc = O_bo [ u32 ( O_q ) * GROUP_DATA_LENGTH ] ; O_ez . O_ac = f32 ( O_bo [ u32 ( O_q ) * GROUP_DATA_LENGTH + 1 ] ) ; O_ez . O_y = f32 ( O_fe ( O_fc ) ) ; O_ez . O_x = f32 ( O_fb ( O_fc ) ) ; if ( O_ez . O_y == 1 ) { O_ez . O_z = f32 ( O_ff ( O_fc ) ) ; O_ez . O_ab = f32 ( O_fg ( O_fc ) ) ; } O_ez . O_aa = f32 ( O_fd ( O_fc ) ) ; O_ez . O_ad = f32 ( O_fh ( O_fc ) ) ; } return O_ez ; } fn O_ce ( O_cb : f32 , O_fi : f32 , ) -> f32 { if ( O_bz ( O_cb ) != 0 ) { return O_cb ; } if ( O_bz ( O_fi ) != 0 ) { return O_fi ; } return O_cb ; } fn O_fj ( O_p : f32 , O_fk : f32 , ) -> bool { if ( O_bd . O_ba != O_p || O_fk == 1 ) { return false ; } return true ; } fn O_fl ( O_fk : f32 , O_fm : u32 , ) -> bool { if ( O_fk == 0 ) { if ( O_fm == 1 ) { return true ; } return false ; } if ( O_fk == 1 ) { return true ; } if ( O_fk == 2 ) { return false ; } return false ; } struct O_fn { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_fp : f32 , @ location ( 1 ) @ interpolate ( flat ) r : f32 , @ location ( 2 ) @ interpolate ( flat ) O_ef : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_ei : f32 , @ location ( 4 ) @ interpolate ( flat ) O_fq : f32 , @ location ( 5 ) O_ci : vec2 < f32 > , @ location ( 6 ) @ interpolate ( flat ) O_p : f32 , @ location ( 7 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 8 ) @ interpolate ( flat ) O_fk : f32 , } fn O_fr ( O_ee : u32 , O_ef : vec2 < f32 > , O_eh : f32 , O_k : f32 , O_ei : f32 , O_ej : f32 , O_ey : f32 , O_q : f32 , ) -> O_fn { var O_ez : O_fn ; O_ez . O_ef = O_ef ; O_ez . O_fq = O_ei + O_ej ; let O_ek = max ( O_k , O_ey ) / 2 ; O_ez . O_fp = O_eh + O_ek ; O_ez . r = O_eh - O_ek ; let O_eg = O_ez . O_fp ; O_ez . O_ci = O_ed ( O_ee , O_ef , O_eg , O_eh , O_ei , O_ej , O_ek ) ; O_ez . O_ei = O_ei ; let O_cc = O_cd ( O_q ) ; O_ez . O_fk = O_cc . O_ad ; return O_ez ; } @ vertex fn arcVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_fn { var O_ez : O_fn ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * ARC_PT_LENGTH ; let O_ef = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_eh = O_be [ O_ft + 3 ] ; let O_k = max ( O_be [ O_ft + 4 ] , O_bd . O_i ) ; let O_ei = O_be [ O_ft + 5 ] ; let O_ej = O_be [ O_ft + 6 ] ; let O_fu = O_be [ O_ft + 9 ] ; O_ez = O_fr ( O_ee , O_ef , O_eh , O_k , O_ei , O_ej , O_bd . O_i * MIN_PX_LENGTH_RATIO , O_fu ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 8 ] , O_be [ O_ft + 9 ] ) ; } return O_ez ; } @ vertex fn arcTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_fn { var O_ez : O_fn ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_ft = i32 ( O_by ) * ( ARC_PT_LENGTH + 1 ) ; let O_ef = vec2 ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_eh = O_bn [ O_ft + 3 ] ; let O_k = max ( O_bn [ O_ft + 4 ] , O_bd . O_i ) ; let O_ei = O_bn [ O_ft + 5 ] ; let O_ej = O_bn [ O_ft + 6 ] ; let O_fu = O_bn [ O_ft + 9 ] ; O_ez = O_fr ( O_ee , O_ef , O_eh , O_k , O_ei , O_ej , O_bd . O_i * MIN_PX_LENGTH_RATIO , O_fu ) ; let O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 3 ] , O_be [ O_ft + 9 ] ) ; } return O_ez ; } @ fragment fn arcFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_fp : f32 , @ location ( 1 ) @ interpolate ( flat ) O_eh : f32 , @ location ( 2 ) @ interpolate ( flat ) O_ef : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_ei : f32 , @ location ( 4 ) @ interpolate ( flat ) O_fq : f32 , @ location ( 5 ) O_ci : vec2 < f32 > , @ location ( 6 ) @ interpolate ( flat ) O_p : f32 , @ location ( 7 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 8 ) @ interpolate ( flat ) O_fk : f32 , ) -> @ location ( 0 ) vec4 < f32 > { let O_fx = length ( O_ci - O_ef ) ; if ( O_fx > O_fp || O_fx < O_eh ) { discard ; } let O_en = O_ci - O_ef ; let O_fy = vec2 ( cos ( O_ei ) , sin ( O_ei ) ) ; let O_fz = O_fy . x * O_en . y - O_fy . y * O_en . x ; let O_ga = vec2 ( cos ( O_fq ) , sin ( O_fq ) ) ; let O_gb = O_ga . x * O_en . y - O_ga . y * O_en . x ; let O_gc = O_fq - O_ei ; let O_gd = O_fl ( O_fk , O_bd . O_ad ) ; if ( ( O_gc < MATH_PI && ( O_fz < 0.0 || O_gb > 0.0 ) ) || ( O_gc >= MATH_PI && ( O_fz < 0.0 && O_gb > 0.0 ) ) ) { let O_ge = ( O_fp - O_eh ) / 2.0 ; let O_eg = ( O_fp + O_eh ) / 2.0 ; let O_gf = O_ef + O_fy * O_eg ; let O_gg = O_ef + O_ga * O_eg ; let O_gh = length ( O_ci - O_gf ) ; let O_gi = length ( O_ci - O_gg ) ; if ( O_gh > O_ge && O_gi > O_ge ) { discard ; } if ( O_gd && ( O_gh < O_ge - O_bd . O_i || O_gi < O_ge - O_bd . O_i ) ) { discard ; } } else if ( O_gd && O_fx < O_fp - O_bd . O_i && O_fx > O_eh + O_bd . O_i ) { discard ; } var O_ap = O_bu ( O_p , 1 , 0 , O_bx ) ; return O_ap ; } struct O_gj { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_ci : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) r : f32 , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 4 ) @ interpolate ( flat ) O_fk : f32 , } fn O_gk ( O_ee : u32 , O_ef : vec2 < f32 > , O_eh : f32 , O_ey : f32 , O_i : f32 , O_q : f32 , ) -> O_gj { var O_ez : O_gj ; O_ez . r = max ( O_eh , O_ey / 2 ) ; var O_gl = sqrt ( 3.0 ) ; var O_eg = O_ez . r ; O_eg += O_i * sqrt ( 0.5 ) ; if ( O_ee == 0 ) { O_ez . O_ci = O_ef + vec2 ( - O_eg * O_gl , - O_eg ) ; } else if ( O_ee == 1 ) { O_ez . O_ci = O_ef + vec2 ( O_eg * O_gl , - O_eg ) ; } else { O_ez . O_ci = O_ef + vec2 ( 0 , 2 * O_eg ) ; } let O_cc = O_cd ( O_q ) ; O_ez . O_fk = O_cc . O_ad ; return O_ez ; } @ vertex fn circleVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_gj { var O_ez : O_gj ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * CIRCLE_PT_LENGTH ; let O_ef = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_eh = O_be [ O_ft + 3 ] ; let O_fu = O_be [ O_ft + 6 ] ; O_ez = O_gk ( O_ee , O_ef , O_eh , O_bd . O_i * MIN_PX_LENGTH_RATIO , 0 , O_fu ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci , 0 , 1 ) ; O_ez . O_ci -= O_ef ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 5 ] , O_be [ O_ft + 6 ] ) ; } return O_ez ; } @ vertex fn circleTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , @ location ( 2 ) @ interpolate ( flat ) O_fk : f32 , ) -> O_gj { var O_ez : O_gj ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_gm = i32 ( O_by ) * ( CIRCLE_PT_LENGTH + 1 ) ; let O_ef = vec2 ( O_bn [ O_gm + 1 ] , O_bn [ O_gm + 2 ] ) ; let O_eh = O_bn [ O_gm + 3 ] ; let O_fu = O_bn [ O_gm + 6 ] ; O_ez = O_gk ( O_ee , O_ef , O_eh , O_bd . O_i * MIN_PX_LENGTH_RATIO , 0 , O_fu ) ; let O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; O_ez . O_ci -= O_ef ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_be [ O_fv + 3 ] ; } return O_ez ; } @ fragment fn circleFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_ci : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_eh : f32 , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 4 ) @ interpolate ( flat ) O_fk : f32 , ) -> @ location ( 0 ) vec4 < f32 > { let O_gd = O_fl ( O_fk , O_bd . O_ad ) ; if ( length ( O_ci ) > O_eh ) { discard ; } if ( O_gd && length ( O_ci ) < O_eh - O_bd . O_i ) { discard ; } return O_bu ( O_p , 1 , 0 , O_bx ) ; } struct O_gn { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_ci : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_et : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_eu : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_go : f32 , @ location ( 4 ) @ interpolate ( flat ) O_eg : f32 , @ location ( 5 ) @ interpolate ( flat ) O_gp : f32 , @ location ( 6 ) @ interpolate ( flat ) O_gq : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_gr : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_p : f32 , @ location ( 9 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 10 ) @ interpolate ( flat ) O_fk : f32 , } fn O_gs ( O_ee : u32 , O_gt : vec2 < f32 > , O_gu : f32 , O_gv : f32 , O_gc : f32 , O_eg : f32 , O_ey : f32 , O_i : f32 , O_q : f32 , ) -> O_gn { var O_ez : O_gn ; let O_k = max ( O_gu , O_ey ) ; let O_l = max ( O_gv , O_ey ) ; O_ez . O_go = O_l / 2 ; let O_gw = cos ( O_gc ) ; let O_gx = sin ( O_gc ) ; let O_gy = mat2x2 < f32 > ( O_gw , O_gx , - O_gx , O_gw ) ; O_ez . O_et = O_gt + O_gy * vec2 ( 0 , - O_ez . O_go ) ; O_ez . O_eu = O_gt + O_gy * vec2 ( O_k , - O_ez . O_go ) ; let O_en = normalize ( O_ez . O_eu - O_ez . O_et ) ; let O_em = vec2 ( - O_en . y , O_en . x ) ; let O_gq = vec2 ( O_em * O_ez . O_go ) ; let O_gz = O_em * sqrt ( 0.5 ) * O_i ; var O_fa = O_en * sqrt ( 0.5 ) * O_i ; if ( O_ee == 0 || O_ee == 5 ) { O_ez . O_ci = O_ez . O_et - O_gq - O_gz - O_fa ; } else if ( O_ee == 1 ) { O_ez . O_ci = O_ez . O_eu - O_gq - O_gz + O_fa ; } else if ( O_ee == 2 || O_ee == 3 ) { O_ez . O_ci = O_ez . O_eu + O_gq + O_gz + O_fa ; } else if ( O_ee == 4 ) { O_ez . O_ci = O_ez . O_et + O_gq + O_gz - O_fa ; } O_ez . O_gq = O_gq ; O_ez . O_gr = O_en * O_k * 0.5 ; O_ez . O_eg = O_eg ; let O_cc = O_cd ( O_q ) ; O_ez . O_fk = O_cc . O_ad ; return O_ez ; } @ vertex fn rectVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_gn { var O_ez : O_gn ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } O_ez . O_gp = 0 ; let O_ft = id * RECT_PT_LENGTH ; let O_gt = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_gu = O_be [ O_ft + 3 ] ; let O_gv = O_be [ O_ft + 4 ] ; let O_gc = O_be [ O_ft + 5 ] ; let O_eg = O_be [ O_ft + 6 ] ; let O_fu = O_be [ O_ft + 9 ] ; O_ez = O_gs ( O_ee , O_gt , O_gu , O_gv , O_gc , O_eg , O_bd . O_i * MIN_PX_LENGTH_RATIO , O_bd . O_i , O_fu ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 8 ] , O_be [ O_ft + 9 ] ) ; } return O_ez ; } @ vertex fn noBodyRectVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , ) -> O_gn { var O_ez : O_gn ; let O_ft = i32 ( O_fs ) * RECT_PT_LENGTH ; let O_ha = u32 ( O_be [ O_ft ] ) ; if ( O_ha == 0 ) { return O_ez ; } let O_gt = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_gu = O_be [ O_ft + 3 ] ; let O_gv = O_be [ O_ft + 4 ] ; let O_gc = O_be [ O_ft + 5 ] ; let O_eg = O_be [ O_ft + 6 ] ; let O_fu = O_be [ O_ft + 9 ] ; O_ez = O_gs ( O_ee , O_gt , O_gu , O_gv , O_gc , O_eg , O_bd . O_i * MIN_PX_LENGTH_RATIO , O_bd . O_i , O_fu ) ; O_ez . O_p = O_be [ O_ft + 8 ] ; O_ez . O_gp = 1 ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci , 0 , 1 ) ; return O_ez ; } @ vertex fn rectTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_gn { var O_ez : O_gn ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } O_ez . O_gp = 0 ; let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_ft = i32 ( O_by ) * ( RECT_PT_LENGTH + 1 ) ; let O_gt = vec2 ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_gu = O_bn [ O_ft + 3 ] ; let O_gv = O_bn [ O_ft + 4 ] ; let O_gc = O_bn [ O_ft + 5 ] ; let O_eg = O_bn [ O_ft + 6 ] ; let O_fu = O_bn [ O_ft + 9 ] ; O_ez = O_gs ( O_ee , O_gt , O_gu , O_gv , O_gc , O_eg , O_bd . O_i * MIN_PX_LENGTH_RATIO , O_bd . O_i , O_fu ) ; let O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_be [ O_ft + 3 ] ; } return O_ez ; } @ fragment fn rectFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_ci : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_et : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_eu : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_go : f32 , @ location ( 4 ) @ interpolate ( flat ) O_eg : f32 , @ location ( 5 ) @ interpolate ( flat ) O_gp : f32 , @ location ( 6 ) @ interpolate ( flat ) O_gq : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_gr : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_p : f32 , @ location ( 9 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 10 ) @ interpolate ( flat ) O_fk : f32 , ) -> @ location ( 0 ) vec4 < f32 > { var O_bv : f32 = 1 ; var O_en = O_eu - O_et ; let O_hb = length ( O_en ) ; if ( O_hb == 0 ) { O_en = vec2 ( 1 , 0 ) ; } else { O_en = normalize ( O_en ) ; } let O_ef = ( O_et + O_eu ) * 0.5 ; let O_hc = O_ci - O_ef ; let O_cq = abs ( dot ( O_en , O_hc ) ) ; let O_cr = abs ( O_hc . x * O_en . y - O_hc . y * O_en . x ) ; let O_hd = O_hb * 0.5 - O_eg ; let O_he = O_go - O_eg ; let O_gd = O_fl ( O_fk , O_bd . O_ad ) ; if ( O_gd ) { let O_hf = O_cq - O_hd ; let O_hg = O_cr - O_he ; if ( O_cq > O_hd && O_cr > O_he ) { let O_hh = length ( vec2 ( O_hf , O_hg ) ) ; if ( O_hh > O_eg || O_hh < O_eg - O_bd . O_i ) { discard ; } } else { if ( O_hg < O_eg - O_bd . O_i ) { if ( O_hf < O_eg - O_bd . O_i ) { discard ; } } } } else { let O_eh = sqrt ( 1.0 / 2.0 ) * O_bd . O_i ; if ( O_cq > O_hd && O_cr > O_he ) { let O_hf = O_cq - O_hd ; let O_hg = O_cr - O_he ; let O_hh = length ( vec2 ( O_hf , O_hg ) ) ; if ( O_hh > ( O_eg + O_eh ) ) { discard ; } } let O_hi = length ( O_gr ) ; let O_hj = length ( O_gq ) ; let O_hk = O_hi - O_hj ; let O_hl = vec2f ( O_hi - O_eg , O_hj - O_eg ) ; if ( O_eg >= O_eh && O_cq > O_hl . x && O_cr > O_hl . y ) { var distance = length ( vec2 ( O_cq , O_cr ) - O_hl ) ; if ( distance >= O_eg + O_eh ) { discard ; } else if ( distance <= O_eg - O_eh ) { O_bv = 1 ; } else { let O_hm : f32 = MATH_PI * O_eh * O_eh ; let O_hn : f32 = 0 ; let O_ho = acos ( ( O_eg * O_eg + distance * distance - O_eh * O_eh ) / ( 2 * O_eg * distance ) ) ; let O_hp = acos ( ( O_eh * O_eh + distance * distance - O_eg * O_eg ) / ( 2 * O_eh * distance ) ) ; let O_hq = O_ho * O_eg * O_eg ; let O_hr = O_hp * O_eh * O_eh ; let O_hs = O_eg * sin ( O_ho ) * distance ; var O_ht = O_hq + O_hr - O_hs ; O_bv = smoothstep ( O_hn , O_hm , O_ht ) ; } } else { let O_hu = select ( ( O_cr > - O_hk && O_cr + O_hk > O_cq ) , ( O_cq <= O_hk ) || ( O_cq - O_hk < O_cr ) , ( O_hk > 0 ) ) ; let distance = - select ( O_hi - O_cq , O_hj - O_cr , O_hu ) ; if ( distance <= - O_eh ) { O_bv = 1 ; } else { let O_hm : f32 = MATH_PI * O_eh * O_eh ; let O_hn : f32 = 0 ; let O_gc = acos ( abs ( distance ) / O_eh ) ; let O_hv = abs ( O_gc * O_eh * O_eh ) ; let O_hw = sqrt ( O_eh * O_eh - distance * distance ) ; let O_hs = O_hw * abs ( distance ) ; var O_ht = O_hv - O_hs ; if ( distance < 0 ) { O_ht = O_hm - O_ht ; } O_bv = smoothstep ( O_hn , O_hm * ANTIALIAS_RATIO , O_ht ) ; } } } if ( O_gp == 0 ) { return O_bu ( O_p , O_bv , 0 , O_bx ) ; } return O_bu ( O_p , O_bv * 0.5 , 0 , O_bx ) ; } struct O_hx { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_ci : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_et : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_eu : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_go : f32 , @ location ( 4 ) @ interpolate ( flat ) O_eg : f32 , @ location ( 5 ) @ interpolate ( flat ) O_gq : vec2 < f32 > , @ location ( 6 ) @ interpolate ( flat ) O_gr : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_p : f32 , @ location ( 8 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 9 ) @ interpolate ( flat ) O_fk : f32 , } fn O_hy ( O_ee : u32 , O_et : vec2 < f32 > , O_eu : vec2 < f32 > , O_k : f32 , O_ex : f32 , O_ey : f32 , O_i : f32 , O_q : f32 , ) -> O_hx { var O_ez : O_hx ; let O_hz = O_ew ( O_et , O_eu , O_ex , O_k , O_ey ) ; O_ez . O_et = O_hz . O_et ; O_ez . O_eu = O_hz . O_eu ; let O_en = O_hz . O_en ; O_ez . O_go = max ( O_k , O_ey ) / 2 ; if ( O_ex == 1 ) { O_ez . O_eg = O_ez . O_go ; } let O_em = vec2 ( - O_en . y , O_en . x ) ; let O_gq = vec2 ( O_em * O_ez . O_go ) ; let O_gz = O_em * sqrt ( 0.5 ) * O_i ; var O_fa = O_en * sqrt ( 0.5 ) * O_i ; if ( O_ee == 0 || O_ee == 5 ) { O_ez . O_ci = O_ez . O_et - O_gq - O_gz - O_fa ; } else if ( O_ee == 1 ) { O_ez . O_ci = O_ez . O_eu - O_gq - O_gz + O_fa ; } else if ( O_ee == 2 || O_ee == 3 ) { O_ez . O_ci = O_ez . O_eu + O_gq + O_gz + O_fa ; } else if ( O_ee == 4 ) { O_ez . O_ci = O_ez . O_et + O_gq + O_gz - O_fa ; } O_ez . O_gq = O_gq ; O_ez . O_gr = O_en * length ( O_ez . O_eu - O_ez . O_et ) * 0.5 ; let O_cc = O_cd ( O_q ) ; O_ez . O_fk = O_cc . O_ad ; return O_ez ; } @ vertex fn lineVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_hx { var O_ez : O_hx ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * LINE_PT_LENGTH ; let O_et = vec2f ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_eu = vec2f ( O_be [ O_ft + 3 ] , O_be [ O_ft + 4 ] ) ; let O_k = O_be [ O_ft + 5 ] ; let O_ex = O_be [ O_ft + 9 ] ; let O_fu = O_be [ O_ft + 8 ] ; let O_ey = O_bd . O_i * MIN_PX_LENGTH_RATIO ; O_ez = O_hy ( O_ee , O_et , O_eu , O_k , O_ex , O_ey , O_bd . O_i , O_fu ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 7 ] , O_be [ O_ft + 8 ] ) ; } return O_ez ; } @ vertex fn lineTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_hx { var O_ez : O_hx ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_ft = i32 ( O_by ) * ( LINE_PT_LENGTH + 1 ) ; let O_et = vec2f ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_eu = vec2f ( O_bn [ O_ft + 3 ] , O_bn [ O_ft + 4 ] ) ; let O_k = O_bn [ O_ft + 5 ] ; let O_ex = O_bn [ O_ft + 9 ] ; let O_ey = O_bd . O_i * MIN_PX_LENGTH_RATIO ; let O_fu = O_bn [ O_ft + 8 ] ; O_ez = O_hy ( O_ee , O_et , O_eu , O_k , O_ex , O_ey , O_bd . O_i , O_fu ) ; let O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_be [ O_ft + 7 ] ; } return O_ez ; } @ fragment fn lineFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_ci : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_et : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_eu : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_go : f32 , @ location ( 4 ) @ interpolate ( flat ) O_eg : f32 , @ location ( 5 ) @ interpolate ( flat ) O_gq : vec2 < f32 > , @ location ( 6 ) @ interpolate ( flat ) O_gr : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_p : f32 , @ location ( 8 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 9 ) @ interpolate ( flat ) O_fk : f32 , ) -> @ location ( 0 ) vec4 < f32 > { let O_gd = O_fl ( O_fk , O_bd . O_ad ) ; var O_bv : f32 = 1 ; var O_en = O_eu - O_et ; let O_hb = length ( O_en ) ; if ( O_hb == 0 ) { O_en = vec2 ( 1 , 0 ) ; } else { O_en = normalize ( O_en ) ; } let O_ef = ( O_et + O_eu ) * 0.5 ; let O_hc = O_ci - O_ef ; let O_cq = abs ( dot ( O_en , O_hc ) ) ; let O_cr = abs ( O_hc . x * O_en . y - O_hc . y * O_en . x ) ; let O_hd = O_hb * 0.5 - O_eg ; let O_he = O_go - O_eg ; if ( O_gd ) { let O_hf = O_cq - O_hd ; let O_hg = O_cr - O_he ; if ( O_cq > O_hd && O_cr > O_he ) { let O_hh = length ( vec2 ( O_hf , O_hg ) ) ; if ( O_hh > O_eg || O_hh < O_eg - O_bd . O_i ) { discard ; } } else { if ( O_hg < O_eg - O_bd . O_i ) { if ( O_hf < O_eg - O_bd . O_i ) { discard ; } } } } else { let O_eh = sqrt ( 1.0 / 2.0 ) * O_bd . O_i ; if ( O_cq > O_hd && O_cr > O_he ) { let O_hf = O_cq - O_hd ; let O_hg = O_cr - O_he ; let O_hh = length ( vec2 ( O_hf , O_hg ) ) ; if ( O_hh > ( O_eg + O_eh ) ) { discard ; } } let O_hi = length ( O_gr ) ; let O_hj = length ( O_gq ) ; let O_hk = O_hi - O_hj ; let O_hl = vec2f ( O_hi - O_eg , O_hj - O_eg ) ; if ( O_eg >= O_eh && O_cq > O_hl . x && O_cr > O_hl . y ) { var distance = length ( vec2 ( O_cq , O_cr ) - O_hl ) ; if ( distance >= O_eg + O_eh ) { discard ; } else if ( distance <= O_eg - O_eh ) { O_bv = 1 ; } else { let O_hm : f32 = MATH_PI * O_eh * O_eh ; let O_hn : f32 = 0 ; let O_ho = acos ( ( O_eg * O_eg + distance * distance - O_eh * O_eh ) / ( 2 * O_eg * distance ) ) ; let O_hp = acos ( ( O_eh * O_eh + distance * distance - O_eg * O_eg ) / ( 2 * O_eh * distance ) ) ; let O_hq = O_ho * O_eg * O_eg ; let O_hr = O_hp * O_eh * O_eh ; let O_hs = O_eg * sin ( O_ho ) * distance ; var O_ht = O_hq + O_hr - O_hs ; O_bv = smoothstep ( O_hn , O_hm , O_ht ) ; } } else { let O_hu = select ( ( O_cr > - O_hk && O_cr + O_hk > O_cq ) , ( O_cq <= O_hk ) || ( O_cq - O_hk < O_cr ) , ( O_hk > 0 ) ) ; let distance = - select ( O_hi - O_cq , O_hj - O_cr , O_hu ) ; if ( distance <= - O_eh ) { O_bv = 1 ; } else { let O_hm : f32 = MATH_PI * O_eh * O_eh ; let O_hn : f32 = 0 ; let O_gc = acos ( abs ( distance ) / O_eh ) ; let O_hv = abs ( O_gc * O_eh * O_eh ) ; let O_hw = sqrt ( O_eh * O_eh - distance * distance ) ; let O_hs = O_hw * abs ( distance ) ; var O_ht = O_hv - O_hs ; if ( distance < 0 ) { O_ht = O_hm - O_ht ; } O_bv = smoothstep ( O_hn , O_hm * ANTIALIAS_RATIO , O_ht ) ; } } } return O_bu ( O_p , O_bv , 0 , O_bx ) ; } struct O_ia { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_hh : f32 , @ location ( 1 ) @ interpolate ( flat ) O_ib : f32 , @ location ( 2 ) @ interpolate ( flat ) O_ic : f32 , @ location ( 3 ) @ interpolate ( flat ) O_en : vec2 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_et : vec2 < f32 > , @ location ( 5 ) O_ci : vec2 < f32 > , @ location ( 6 ) @ interpolate ( flat ) O_gq : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_p : f32 , @ location ( 8 ) @ interpolate ( flat ) O_bx : f32 , } fn O_id ( O_ee : u32 , O_et : vec2 < f32 > , O_eu : vec2 < f32 > , O_ib : f32 , O_ic : f32 , O_i : f32 , ) -> O_ia { var O_ez : O_ia ; var O_ci : vec2 < f32 > ; let O_en = normalize ( O_eu - O_et ) ; let O_em = vec2 ( - O_en . y , O_en . x ) ; let O_gq = O_em * O_i * 0.5 ; if ( O_ee == 0 || O_ee == 5 ) { O_ci = O_et - O_gq ; O_ez . O_hh = 0 ; } else if ( O_ee == 1 ) { O_ci = O_eu - O_gq ; O_ez . O_hh = distance ( O_et , O_eu ) / O_i ; } else if ( O_ee == 2 || O_ee == 3 ) { O_ci = O_eu + O_gq ; O_ez . O_hh = distance ( O_et , O_eu ) / O_i ; } else if ( O_ee == 4 ) { O_ci = O_et + O_gq ; O_ez . O_hh = 0 ; } O_ez . O_et = O_et ; O_ez . O_en = O_en ; O_ez . O_ci = O_ci ; O_ez . O_gq = O_gq ; O_ez . O_ib = O_ib ; O_ez . O_ic = O_ic ; return O_ez ; } @ vertex fn lineSegmentVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_ia { var O_ez : O_ia ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * LINESEGMENT_PT_LENGTH ; let O_et = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_eu = vec2 ( O_be [ O_ft + 3 ] , O_be [ O_ft + 4 ] ) ; let O_ib = O_be [ O_ft + 5 ] ; let O_ic = O_be [ O_ft + 6 ] ; O_ez = O_id ( O_ee , O_et , O_eu , O_ib , O_ic , O_bd . O_i ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 8 ] , O_be [ O_ft + 9 ] ) ; } return O_ez ; } @ vertex fn lineSegmentTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_ia { var O_ez : O_ia ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_ft = i32 ( O_by ) * ( LINESEGMENT_PT_LENGTH + 1 ) ; let O_et = vec2 ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_eu = vec2 ( O_bn [ O_ft + 3 ] , O_bn [ O_ft + 4 ] ) ; let O_ib = O_bn [ O_ft + 5 ] ; let O_ic = O_bn [ O_ft + 6 ] ; O_ez = O_id ( O_ee , O_et , O_eu , O_ib , O_ic , O_bd . O_i ) ; let O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_bn [ O_ft + 8 ] ; } return O_ez ; } @ fragment fn lineSegmentFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_hh : f32 , @ location ( 1 ) @ interpolate ( flat ) O_ib : f32 , @ location ( 2 ) @ interpolate ( flat ) O_ic : f32 , @ location ( 3 ) @ interpolate ( flat ) O_en : vec2 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_et : vec2 < f32 > , @ location ( 5 ) O_ci : vec2 < f32 > , @ location ( 6 ) @ interpolate ( flat ) O_gq : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_p : f32 , @ location ( 8 ) @ interpolate ( flat ) O_bx : f32 , ) -> @ location ( 0 ) vec4 < f32 > { if ( O_hh % O_ib > O_ic ) { discard ; } var O_bv : f32 = 0 ; let O_ie = O_ci - O_et ; let O_hj = length ( O_gq ) ; let O_eh = sqrt ( 1.0 / 2.0 ) * O_bd . O_i ; let distance : f32 = abs ( dot ( O_ie , vec2 ( O_en . y , - O_en . x ) ) ) - O_hj ; if ( distance <= - O_eh ) { O_bv = 1 ; } else { let O_hm : f32 = MATH_PI * O_eh * O_eh ; let O_hn : f32 = 0 ; let O_gc = acos ( abs ( distance ) / O_eh ) ; let O_hv = abs ( O_gc * O_eh * O_eh ) ; let O_hw = sqrt ( O_eh * O_eh - distance * distance ) ; let O_hs = O_hw * abs ( distance ) ; var O_ht = O_hv - O_hs ; if ( distance < 0 ) { O_ht = O_hm - O_ht ; } O_bv = smoothstep ( O_hn , O_hm * ANTIALIAS_RATIO , O_ht ) ; } return O_bu ( O_p , O_bv , 0 , O_bx ) ; } struct O_if { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_ci : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) r : f32 , @ location ( 2 ) @ interpolate ( flat ) O_ig : f32 , @ location ( 3 ) @ interpolate ( flat ) O_ih : f32 , @ location ( 4 ) @ interpolate ( flat ) O_bx : f32 , } fn O_ii ( O_ee : u32 , O_ef : vec2 < f32 > , O_eh : f32 , O_i : f32 , ) -> O_if { var O_ez : O_if ; O_ez . r = max ( O_eh , O_i / 2 ) ; let O_gl = sqrt ( 3.0 ) ; if ( O_ee == 0 ) { O_ez . O_ci = O_ef + vec2 ( - O_ez . r * O_gl , - O_ez . r ) ; } else if ( O_ee == 1 ) { O_ez . O_ci = O_ef + vec2 ( O_ez . r * O_gl , - O_ez . r ) ; } else { O_ez . O_ci = O_ef + vec2 ( 0 , 2 * O_ez . r ) ; } return O_ez ; } @ vertex fn semicircleVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_if { var O_ez : O_if ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * SEMICIRCLE_PT_LENGTH ; let O_ef = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_eh = O_be [ O_ft + 3 ] ; O_ez = O_ii ( O_ee , O_ef , O_eh , O_bd . O_i ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci , 0 , 1 ) ; O_ez . O_ci -= O_ef ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 0 ) { O_ez . O_ig = O_cb ; } else { O_ez . O_ig = O_be [ O_ft + 4 ] ; O_ez . O_ih = O_be [ O_ft + 5 ] ; } O_ez . O_bx = f32 ( O_bx ) ; return O_ez ; } @ vertex fn semicircleTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_if { var O_ez : O_if ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_ft = i32 ( O_by ) * ( SEMICIRCLE_PT_LENGTH + 1 ) ; let O_ef = vec2 ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_eh = O_bn [ O_ft + 3 ] ; O_ez = O_ii ( O_ee , O_ef , O_eh , O_bd . O_i ) ; let O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; O_ez . O_ci -= O_ef ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 0 ) { O_ez . O_ig = O_cb ; } else { O_ez . O_ig = O_bn [ O_ft + 4 ] ; O_ez . O_ih = O_bn [ O_ft + 5 ] ; } O_ez . O_bx = f32 ( O_bx ) ; return O_ez ; } @ fragment fn semicircleFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_ci : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_eh : f32 , @ location ( 2 ) @ interpolate ( flat ) O_ig : f32 , @ location ( 3 ) @ interpolate ( flat ) O_ih : f32 , @ location ( 4 ) @ interpolate ( flat ) O_bx : f32 , ) -> @ location ( 0 ) vec4 < f32 > { if ( length ( O_ci ) > O_eh ) { discard ; } var O_p = O_ig ; if ( O_bx == 1 ) { O_p = select ( O_ig , O_ih , O_ci . x < 0 ) ; } return O_bu ( O_p , 1 , 0 , O_bx ) ; } struct O_ij { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_p : f32 , @ location ( 1 ) @ interpolate ( flat ) O_ik : f32 , @ location ( 2 ) @ interpolate ( flat ) O_il : f32 , @ location ( 3 ) O_im : vec2 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_ek : f32 , @ location ( 5 ) @ interpolate ( flat ) O_go : f32 , @ location ( 6 ) O_ci : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_ef : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_bx : f32 , } fn O_in ( O_ee : u32 , O_e : vec2 < f32 > , O_k : f32 , O_l : f32 , O_gc : f32 , O_io : f32 , O_ik : f32 , O_il : f32 , O_aq : f32 , O_i : f32 , O_ip : f32 , MATH_PI : f32 , SDF_WIDTH : f32 , SDF_HEIGHT : f32 , ) -> O_ij { var O_ez : O_ij ; O_ez . O_ef = O_e ; var O_iq = 1.0 ; let O_ir = O_l / O_ip ; if ( O_aq == 1 && O_ir > O_io ) { O_iq = O_io / O_ir ; } let O_ek = O_k * 0.5 * O_iq ; let O_go = O_l * 0.5 * O_iq ; O_ez . O_ek = O_ek ; O_ez . O_go = O_go ; var O_ci : vec2 < f32 > ; let O_hj = O_i ; let O_is = O_go / O_ek ; let O_ho = atan ( O_is ) ; let O_hp = ( MATH_PI * 0.5 - O_ho ) * 0.5 ; let O_it : f32 = O_hj / sin ( O_ho ) ; let O_iu : f32 = O_hj / tan ( O_hp ) ; let O_er = 0.25 ; let O_iv = O_ek * 2 ; let O_iw = SDF_HEIGHT / SDF_WIDTH ; var O_cq = O_iv * O_go / ( O_iw * O_go + O_iv ) ; var O_cr = O_iw * O_cq ; let O_ix = O_ek / O_cq ; let O_iy = ( O_go - O_cr * 0.5 ) / O_cr ; if ( O_ee == 0 ) { O_ci = vec2 ( - O_ek - O_hj , - O_go - O_iu ) ; O_ez . O_im = vec2 ( 0 , - O_iy ) ; } else if ( O_ee == 1 ) { O_ci = vec2 ( O_it , 0 ) ; O_ez . O_im = vec2 ( O_ix , 0.5 ) ; } else if ( O_ee == 2 ) { O_ci = vec2 ( - O_ek - O_hj , O_go + O_iu ) ; O_ez . O_im = vec2 ( 0 , 1 + O_iy ) ; } else if ( O_ee == 3 ) { O_ci = vec2 ( O_ek + O_hj , - O_go - O_iu ) ; O_ez . O_im = vec2 ( 1 , - O_iy ) ; } else if ( O_ee == 4 ) { O_ci = vec2 ( O_ek + O_hj , O_go + O_iu ) ; O_ez . O_im = vec2 ( 1 , 1 + O_iy ) ; } else { O_ci = vec2 ( - O_it , 0 ) ; O_ez . O_im = vec2 ( 1 - O_ix , 0.5 ) ; } if ( O_ee < 3 ) { O_ez . O_im . x -= O_er ; } else { O_ez . O_im . x += O_er ; } let cos = cos ( O_gc ) ; let sin = sin ( O_gc ) ; O_ci = mat2x2 ( cos , sin , - sin , cos ) * O_ci ; O_ci += O_e ; O_ez . O_ci = O_ci ; return O_ez ; } @ vertex fn drcVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_ij { var O_ez : O_ij ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } O_ez . O_p = O_cb ; let O_ft = id * DRC_PT_LENGTH ; let O_ik = O_be [ O_ft + 8 ] ; let O_il = O_be [ O_ft + 9 ] ; let O_e = vec2f ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_k = O_be [ O_ft + 3 ] ; let O_l = O_be [ O_ft + 4 ] ; let O_io = O_be [ O_ft + 7 ] ; let O_gc = O_be [ O_ft + 5 ] ; O_ez = O_in ( O_ee , O_e , O_k , O_l , O_gc , O_io , O_ik , O_il , O_bd . O_aq , O_bd . O_i , O_bc . O_i , MATH_PI , SDF_WIDTH , SDF_HEIGHT ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci . xy , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 12 ] , O_be [ O_ft + 11 ] ) ; } return O_ez ; } @ fragment fn drcFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_p : f32 , @ location ( 1 ) @ interpolate ( flat ) O_ik : f32 , @ location ( 2 ) @ interpolate ( flat ) O_il : f32 , @ location ( 3 ) O_im : vec2 < f32 > , @ location ( 4 ) @ interpolate ( flat ) O_ek : f32 , @ location ( 5 ) @ interpolate ( flat ) O_go : f32 , @ location ( 6 ) O_ci : vec2 < f32 > , @ location ( 7 ) @ interpolate ( flat ) O_ef : vec2 < f32 > , @ location ( 8 ) @ interpolate ( flat ) O_bx : f32 , ) -> @ location ( 0 ) vec4 < f32 > { var O_bv : f32 = 1 ; let O_i = O_bd . O_i ; let O_is = O_go / O_ek ; let O_iz = atan ( O_is ) ; let O_en = vec2f ( 1.0 , 0 ) ; var O_ja = 1.0 ; if ( dot ( O_en , O_ci - O_ef ) < 0 ) { O_ja = - 1.0 ; } var O_jb = normalize ( vec2f ( O_ja , O_is ) ) ; if ( O_ck ( O_ci - O_ef , O_en ) > 0 ) { O_jb = normalize ( vec2f ( O_ja , - O_is ) ) ; } let O_ie = O_ci - O_ef ; var O_hj = 0.5 * O_i ; if ( O_bd . O_ar == 1 ) { O_hj = 1.5 * O_i ; } let O_eh = sqrt ( 1.0 / 2.0 ) * O_i ; let distance : f32 = abs ( dot ( O_ie , vec2 ( O_jb . y , - O_jb . x ) ) ) - O_hj ; let O_jc = abs ( dot ( O_ie , O_jb ) ) ; if ( distance <= - O_eh ) { O_bv = 1 ; } else { let O_hm : f32 = MATH_PI * O_eh * O_eh ; let O_hn : f32 = 0 ; let O_gc = acos ( abs ( distance ) / O_eh ) ; let O_hv = abs ( O_gc * O_eh * O_eh ) ; let O_hw = sqrt ( O_eh * O_eh - distance * distance ) ; let O_hs = O_hw * abs ( distance ) ; var O_ht = O_hv - O_hs ; if ( distance < 0 ) { O_ht = O_hm - O_ht ; } O_bv = smoothstep ( O_hn , O_hm * ANTIALIAS_RATIO , O_ht ) ; } if ( O_bd . O_ar == 1 ) { if ( O_jc >= ( O_ek ) / cos ( O_iz ) - O_eh ) { discard ; } } else { let O_cq = abs ( dot ( O_en , O_ci - O_ef ) ) ; let O_jd = dot ( O_en , O_ci - O_ef ) ; if ( O_cq >= O_ek - O_i ) { O_bv = 1 ; } let O_ix = O_im . x ; let O_iy = 1 - O_im . y ; if ( O_bv == 0 && ( O_ix > 1 || O_ix < 0 || O_iy > 1 || O_iy < 0 ) ) { discard ; } var O_by : f32 = 0 ; if ( O_jd < 0 ) { O_by = O_bj [ u32 ( O_ik ) ] ; } else if ( O_jd > 0 ) { O_by = O_bj [ u32 ( O_il ) ] ; } let O_dn = clamp ( O_ix , 0 , 1 ) ; let O_do = clamp ( O_iy , 0 , 1 ) ; let O_df = O_by * SDF_WIDTH * SDF_HEIGHT ; let O_cw = SDF_WIDTH ; let O_cx = SDF_HEIGHT ; let O_je : f32 = O_cu ( vec2 ( O_dn , O_do ) , O_cw , O_cx , O_df ) ; let O_jf = fwidth ( O_je ) * 0.7 ; let O_jg = smoothstep ( 0.5 - O_jf , 0.5 + O_jf , O_je ) ; if ( O_bv == 0 ) { O_bv = O_jg ; } } return O_bu ( O_p , O_bv , 0 , O_bx ) ; } struct O_jh { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_im : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_ji : f32 , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 4 ) O_ci : vec2 < f32 > , } fn O_jj ( O_ee : u32 , O_e : vec2 < f32 > , O_k : f32 , O_l : f32 , O_gc : f32 , O_jk : f32 , O_ji : f32 , O_io : f32 , O_ip : f32 , O_jl : f32 , O_jm : f32 , O_jn : f32 , O_jo : bool , O_jp : f32 , ) -> O_jh { var O_ez : O_jh ; if ( O_jo && O_jp < O_bc . O_i ) { return O_ez ; } let O_ek = O_k / 2 ; let O_go = O_l / 2 ; O_ez . O_ji = O_ji ; var O_ci : vec2 < f32 > ; if ( O_jl == 0 ) { if ( O_ee == 0 || O_ee == 5 ) { O_ci = vec2 ( - O_ek , - O_go ) ; O_ez . O_im = vec2 ( 0 , 0 ) ; } else if ( O_ee == 1 ) { O_ci = vec2 ( O_ek , - O_go ) ; O_ez . O_im = vec2 ( O_jk , 0 ) ; } else if ( O_ee == 2 || O_ee == 3 ) { O_ci = vec2 ( O_ek , O_go ) ; O_ez . O_im = vec2 ( O_jk , 1 ) ; } else if ( O_ee == 4 ) { O_ci = vec2 ( - O_ek , O_go ) ; O_ez . O_im = vec2 ( 0 , 1 ) ; } } else { if ( O_ee == 0 || O_ee == 5 ) { O_ci = vec2 ( - O_ek , - O_go ) ; O_ez . O_im = vec2 ( O_jk , 0 ) ; } else if ( O_ee == 1 ) { O_ci = vec2 ( O_ek , - O_go ) ; O_ez . O_im = vec2 ( 0 , 0 ) ; } else if ( O_ee == 2 || O_ee == 3 ) { O_ci = vec2 ( O_ek , O_go ) ; O_ez . O_im = vec2 ( 0 , 1 ) ; } else if ( O_ee == 4 ) { O_ci = vec2 ( - O_ek , O_go ) ; O_ez . O_im = vec2 ( O_jk , 1 ) ; } } O_ci . x += O_k * O_jm ; O_ci . y += O_l * O_jn ; if ( O_jo ) { let O_ir = O_l / O_ip ; if ( O_ir > O_io ) { O_ci *= O_io / O_ir ; } } let cos = cos ( O_gc ) ; let sin = sin ( O_gc ) ; O_ci = mat2x2 ( cos , sin , - sin , cos ) * O_ci ; O_ci += O_e ; O_ez . O_ci = O_ci ; return O_ez ; } @ vertex fn stringVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_jh { var O_ez : O_jh ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * STRING_PT_LENGTH ; let O_e = vec2f ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_k = O_be [ O_ft + 3 ] ; let O_l = O_be [ O_ft + 4 ] ; let O_gc = O_be [ O_ft + 5 ] ; let O_jk = O_be [ O_ft + 6 ] ; let O_ji = O_be [ O_ft + 7 ] ; let O_jp = O_be [ O_ft + 8 ] ; let O_io = O_be [ O_ft + 9 ] ; let O_jm = O_be [ O_ft + 13 ] ; let O_jn = O_be [ O_ft + 14 ] ; O_ez = O_jj ( O_ee , O_e , O_k , O_l , O_gc , O_jk , O_ji , O_io , O_bc . O_i , O_bc . O_j , O_jm , O_jn , true , O_jp ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci . xy , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_be [ O_ft + 11 ] ; } return O_ez ; } @ vertex fn stringTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_jh { var O_ez : O_jh ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_jq = u32 ( O_by ) >> STRING_LEVEL_BITLENGTH ; var O_ft = i32 ( O_jq ) * ( STRING_PT_LENGTH + 1 ) ; let O_e = vec2f ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_k = O_bn [ O_ft + 3 ] ; let O_l = O_bn [ O_ft + 4 ] ; let O_gc = O_bn [ O_ft + 5 ] ; let O_jk = O_bn [ O_ft + 6 ] ; let O_ji = O_bn [ O_ft + 7 ] ; let O_jp = O_bn [ O_ft + 8 ] ; let O_io = O_bn [ O_ft + 9 ] ; let O_jm = O_be [ O_ft + 13 ] ; let O_jn = O_be [ O_ft + 14 ] ; O_ez = O_jj ( O_ee , O_e , O_k , O_l , O_gc , O_jk , O_ji , O_io , O_bc . O_i , O_bc . O_j , O_jm , O_jn , true , O_jp ) ; let O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 3 ] , O_be [ O_ft + 10 ] ) ; } return O_ez ; } @ fragment fn stringFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) O_im : vec2 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_ji : f32 , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_bx : f32 , ) -> @ location ( 0 ) vec4 < f32 > { let O_jr = CHAR_WIDTH + CHAR_HEIGHT / 8.0 ; let O_js = CHAR_HEIGHT + CHAR_HEIGHT / 4.0 ; let O_jt = u32 ( CANVAS_WIDTH / O_jr ) ; let O_by = O_bg [ u32 ( O_ji + O_im . x ) ] ; let O_ju = O_by / O_jt ; let O_jv = O_by % O_jt ; let O_jw = O_jr * f32 ( O_jv ) ; let O_jx = O_js * f32 ( O_ju ) ; let O_jy = O_jw ; let O_jz = O_jx ; let O_ka = O_jy + CHAR_WIDTH ; let O_kb = O_jz + CHAR_HEIGHT ; let O_kc = O_jy / CANVAS_WIDTH ; let O_kd = O_ka / CANVAS_WIDTH ; let O_ke = O_kb / CANVAS_HEIGHT ; let O_kf = O_jz / CANVAS_HEIGHT ; let O_ap = textureSample ( O_bh , O_bi , vec2 ( O_kc + ( O_kd - O_kc ) * ( O_im . x % 1.0 ) , O_ke + ( O_kf - O_ke ) * O_im . y ) ) ; if ( O_ap . r <= 0.1 ) { discard ; } var O_kg : vec4 < f32 > ; if ( O_bx == 1 && O_p < 0.5 ) { O_kg = O_bd . O_aw ; } else { O_kg = O_bu ( O_p , 1 , 1 , O_bx ) ; } return vec4 ( O_kg . rgb , O_kg . a * O_ap . r + 0.1 ) ; } @ vertex fn scaleStringVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_jh { var O_ez : O_jh ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * SCALE_STRING_PT_LENGTH ; let O_e = vec2f ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_k = O_be [ O_ft + 3 ] ; let O_l = O_be [ O_ft + 4 ] ; let O_gc = O_be [ O_ft + 5 ] ; let O_jk = O_be [ O_ft + 6 ] ; let O_ji = O_be [ O_ft + 7 ] ; let O_jp = O_be [ O_ft + 8 ] ; let O_io = O_be [ O_ft + 9 ] ; let O_jm = O_be [ O_ft + 13 ] ; let O_jn = O_be [ O_ft + 14 ] ; O_ez = O_jj ( O_ee , O_e , O_k , O_l , O_gc , O_jk , O_ji , O_io , O_bc . O_i , O_bc . O_j , O_jm , O_jn , false , 0 ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci . xy , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 11 ] , O_be [ O_ft + 8 ] ) ; } return O_ez ; } struct O_kh { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_ki : f32 , @ location ( 1 ) O_ci : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_bx : f32 , } fn O_kj ( O_ee : u32 , O_ki : f32 , ) -> O_kh { var O_ez : O_kh ; O_ez . O_ki = O_ki ; let O_gl = sqrt ( 3.0 ) ; if ( O_ee == 0 ) { O_ez . O_ci = vec2 ( - O_gl , - 1 ) ; } else if ( O_ee == 1 ) { O_ez . O_ci = vec2 ( O_gl , - 1 ) ; } else { O_ez . O_ci = vec2 ( 0 , 2 ) ; } return O_ez ; } @ vertex fn pointVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kh { var O_ez : O_kh ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * POINT_PT_LENGTH ; let O_ef = vec2f ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_ki = O_be [ O_ft + 3 ] ; let size = O_be [ O_ft + 4 ] ; let O_eh = size * O_bc . O_i / 4 * O_ki * select ( 0.5 , 1 , O_ki == 1 ) ; O_ez = O_kj ( O_ee , O_ki ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ef + O_ez . O_ci * O_eh , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_be [ O_ft + 6 ] , O_be [ O_ft + 7 ] ) ; } return O_ez ; } @ fragment fn pointFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_ki : f32 , @ location ( 1 ) O_ci : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_p : f32 , @ location ( 3 ) @ interpolate ( flat ) O_bx : f32 , ) -> @ location ( 0 ) vec4 < f32 > { if ( O_ki < 1.25 && dot ( O_ci , O_ci ) > 1 ) { discard ; } return O_bu ( O_p , 1 , 0 , O_bx ) ; } struct O_kk { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_kl : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_km : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_kn : vec2 < f32 > , @ location ( 4 ) O_ci : vec2 < f32 > , } fn O_ko ( id : i32 , O_p : f32 , O_ee : u32 , O_kl : vec2 < f32 > , O_km : vec2 < f32 > , O_kn : vec2 < f32 > , ) -> O_kk { var O_ez : O_kk ; if ( O_bq ( id , O_p ) == 0 || ! O_fj ( O_p , 0 ) ) { return O_ez ; } var O_ci : vec2 < f32 > ; if ( O_ee == 0 ) { O_ci = O_kl ; } else if ( O_ee == 1 ) { O_ci = O_km ; } else { O_ci = O_kn ; } O_ez . O_kl = O_kl ; O_ez . O_km = O_km ; O_ez . O_kn = O_kn ; O_ez . O_ci = O_ci ; return O_ez ; } @ vertex fn triangleVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kk { var O_ez : O_kk ; let O_ft = id * TRIANGLE_PT_LENGTH ; var O_cb = f32 ( O_p ) ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 1 ) { O_cb = O_ca ( O_be [ O_ft + 8 ] , O_be [ O_ft + 9 ] ) ; } var O_kl : vec2 < f32 > = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; var O_km : vec2 < f32 > = vec2 ( O_be [ O_ft + 3 ] , O_be [ O_ft + 4 ] ) ; var O_kn : vec2 < f32 > = vec2 ( O_be [ O_ft + 5 ] , O_be [ O_ft + 6 ] ) ; O_ez = O_ko ( id , O_cb , O_ee , O_kl , O_km , O_kn ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci , 0 , 1 ) ; return O_ez ; } @ vertex fn triangleTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kk { var O_ez : O_kk ; var O_cb = f32 ( O_p ) ; let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 1 ) { O_cb = O_ca ( O_be [ O_fv + 3 ] , O_be [ O_fv + 4 ] ) ; } let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_ft = i32 ( O_by ) * ( TRIANGLE_PT_LENGTH + 1 ) ; let O_kl : vec2 < f32 > = vec2 ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_km : vec2 < f32 > = vec2 ( O_bn [ O_ft + 3 ] , O_bn [ O_ft + 4 ] ) ; let O_kn : vec2 < f32 > = vec2 ( O_bn [ O_ft + 5 ] , O_bn [ O_ft + 6 ] ) ; O_ez = O_ko ( id , O_cb , O_ee , O_kl , O_km , O_kn ) ; let O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; return O_ez ; } @ fragment fn triangleFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_kl : vec2 < f32 > , @ location ( 2 ) @ interpolate ( flat ) O_km : vec2 < f32 > , @ location ( 3 ) @ interpolate ( flat ) O_kn : vec2 < f32 > , @ location ( 4 ) O_ci : vec2 < f32 > , ) -> @ location ( 0 ) vec4 < f32 > { return O_bd . O_ap ; } @ vertex fn staticTriangleVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kk { var O_ez : O_kk ; let O_ft = id * STATIC_TRIANGLE_PT_LENGTH ; let O_cj = O_bf [ u32 ( O_be [ O_ft + 7 ] ) ] ; var O_cb = f32 ( O_p ) ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 1 ) { O_cb = O_ca ( O_cj . O_p , O_cj . O_q ) ; } let O_kl = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_km = vec2 ( O_be [ O_ft + 3 ] , O_be [ O_ft + 4 ] ) ; let O_kn = vec2 ( O_be [ O_ft + 5 ] , O_be [ O_ft + 6 ] ) ; O_ez = O_ko ( id , O_cb , O_ee , O_kl , O_km , O_kn ) ; let O_fw = O_cj . O_n * vec3 ( O_ez . O_ci , 1 ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; return O_ez ; } @ vertex fn staticTriangleTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kk { var O_ez : O_kk ; let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; var O_cb = f32 ( O_p ) ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 1 ) { O_cb = O_ca ( O_be [ O_fv + 3 ] , O_be [ O_fv + 4 ] ) ; } let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_ft = i32 ( id ) * STATIC_TRIANGLE_PT_LENGTH ; let O_kl = vec2 ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_km = vec2 ( O_bn [ O_ft + 3 ] , O_bn [ O_ft + 4 ] ) ; let O_kn = vec2 ( O_bn [ O_ft + 5 ] , O_bn [ O_ft + 6 ] ) ; O_ez = O_ko ( id , O_cb , O_ee , O_kl , O_km , O_kn ) ; let O_cj = O_bf [ u32 ( O_bn [ O_ft + 7 ] ) ] ; var O_ci = O_cj . O_n * vec3 ( O_ez . O_ci , 1 ) ; O_ci = O_cg ( O_ch , O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ci , 0 , 1 ) ; return O_ez ; } struct O_kp { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) r : f32 , @ location ( 1 ) @ interpolate ( flat ) O_ef : vec2 < f32 > , @ location ( 2 ) O_ci : vec2 < f32 > , } fn O_kq ( id : i32 , O_p : f32 , O_ee : u32 , O_ef : vec2 < f32 > , O_eh : f32 , O_ei : f32 , O_ej : f32 , O_et : vec2 < f32 > , O_eu : vec2 < f32 > , ) -> O_kp { var O_ez : O_kp ; if ( O_bq ( id , O_p ) == 0 || ! O_fj ( O_p , 0 ) ) { return O_ez ; } O_ez . O_ci = O_es ( O_ee , O_ef , O_eh , O_ei , O_ej , O_et , O_eu ) ; O_ez . O_ef = O_ef ; O_ez . r = O_eh ; return O_ez ; } @ vertex fn cutedCircleVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kp { var O_ez : O_kp ; let O_ft = id * CUTED_CIRCLE_PT_LENGTH ; var O_cb = f32 ( O_p ) ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 1 ) { O_cb = O_ca ( O_be [ O_ft + 11 ] , O_be [ O_ft + 12 ] ) ; } let O_ef = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_eh = O_be [ O_ft + 3 ] ; let O_ei = O_be [ O_ft + 4 ] ; let O_ej = O_be [ O_ft + 5 ] ; let O_et = vec2f ( O_be [ O_ft + 6 ] , O_be [ O_ft + 7 ] ) ; let O_eu = vec2f ( O_be [ O_ft + 8 ] , O_be [ O_ft + 9 ] ) ; O_ez = O_kq ( id , O_cb , O_ee , O_ef , O_eh , O_ei , O_ej , O_et , O_eu ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci , 0 , 1 ) ; return O_ez ; } @ vertex fn cutedCircleTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kp { var O_ez : O_kp ; var O_cb = f32 ( O_p ) ; let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 1 ) { O_cb = O_ca ( O_be [ O_fv + 3 ] , O_be [ O_fv + 4 ] ) ; } let O_by = O_be [ O_fv + 1 ] ; let O_ft = i32 ( O_by ) * ( CUTED_CIRCLE_PT_LENGTH + 1 ) ; let O_ch = O_be [ O_fv + 2 ] ; let O_ef = vec2 ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_eh = O_bn [ O_ft + 3 ] ; let O_ei = O_bn [ O_ft + 4 ] ; let O_ej = O_bn [ O_ft + 5 ] ; let O_et = vec2f ( O_bn [ O_ft + 6 ] , O_bn [ O_ft + 7 ] ) ; let O_eu = vec2f ( O_bn [ O_ft + 8 ] , O_bn [ O_ft + 9 ] ) ; O_ez = O_kq ( id , O_cb , O_ee , O_ef , O_eh , O_ei , O_ej , O_et , O_eu ) ; let O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; return O_ez ; } @ fragment fn cutedCircleFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 0 ) @ interpolate ( flat ) O_eh : f32 , @ location ( 1 ) @ interpolate ( flat ) O_ef : vec2 < f32 > , @ location ( 2 ) O_ci : vec2 < f32 > , ) -> @ location ( 0 ) vec4 < f32 > { if ( length ( O_ci - O_ef ) > O_eh ) { discard ; } return O_bd . O_ap ; } @ vertex fn staticCutedCircleVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kp { var O_ez : O_kp ; let O_ft = id * STATIC_CUTED_CIRCLE_PT_LENGTH ; let O_cj = O_bf [ u32 ( O_be [ O_ft + 10 ] ) ] ; var O_cb = f32 ( O_p ) ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 1 ) { O_cb = O_ca ( O_cj . O_p , O_cj . O_q ) ; } let O_ef = vec2 ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_eh = O_be [ O_ft + 3 ] ; let O_ei = O_be [ O_ft + 4 ] ; let O_ej = O_be [ O_ft + 5 ] ; let O_et = vec2f ( O_be [ O_ft + 6 ] , O_be [ O_ft + 7 ] ) ; let O_eu = vec2f ( O_be [ O_ft + 8 ] , O_be [ O_ft + 9 ] ) ; O_ez = O_kq ( id , O_cb , O_ee , O_ef , O_eh , O_ei , O_ej , O_et , O_eu ) ; let O_ci = O_cj . O_n * vec3 ( O_ez . O_ci , 1 ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ci , 0 , 1 ) ; return O_ez ; } @ vertex fn staticCutedCircleTemplateInstanceVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kp { var O_ez : O_kp ; let O_fv = id * TEMPLATE_INSTANCE_PT_LENGTH ; var O_cb = f32 ( O_p ) ; let O_bx = O_bp ( O_cb ) ; if ( O_bx == 1 ) { O_cb = O_ca ( O_be [ O_fv + 3 ] , O_be [ O_fv + 4 ] ) ; } let O_by = O_be [ O_fv + 1 ] ; let O_ch = O_be [ O_fv + 2 ] ; let O_ft = i32 ( id ) * STATIC_CUTED_CIRCLE_PT_LENGTH ; let O_cj = O_bf [ u32 ( O_bn [ O_ft + 10 ] ) ] ; let O_ef = vec2 ( O_bn [ O_ft + 1 ] , O_bn [ O_ft + 2 ] ) ; let O_eh = O_bn [ O_ft + 3 ] ; let O_ei = O_bn [ O_ft + 4 ] ; let O_ej = O_bn [ O_ft + 5 ] ; let O_et = vec2f ( O_bn [ O_ft + 6 ] , O_bn [ O_ft + 7 ] ) ; let O_eu = vec2f ( O_bn [ O_ft + 8 ] , O_bn [ O_ft + 9 ] ) ; O_ez = O_kq ( id , O_cb , O_ee , O_ef , O_eh , O_ei , O_ej , O_et , O_eu ) ; var O_fw = O_cj . O_n * vec3 ( O_ez . O_ci , 1 ) ; O_fw = O_cg ( O_ch , O_ez . O_ci ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_fw , 0 , 1 ) ; return O_ez ; } struct O_kr { @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_p : f32 , @ location ( 2 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 3 ) @ interpolate ( flat ) O_ci : vec2 < f32 > , } fn O_ks ( O_ee : u32 , O_e : vec2 < f32 > , O_gc : f32 , O_q : f32 , O_ey : f32 , O_jo : bool , ) -> O_kr { var O_ez : O_kr ; let O_af = max ( O_bd . O_bb . O_af , O_ey ) ; let O_ag = max ( O_bd . O_bb . O_ag , O_ey ) ; let O_ah = max ( O_bd . O_bb . O_ah , O_ey ) ; let O_ai = max ( O_bd . O_bb . O_ai , O_ey ) ; let O_aj = O_bd . O_bb . O_aj ; O_ez . O_p = O_bd . O_bb . O_p ; var O_ci : vec2 < f32 > ; if ( O_ee == 0 ) { O_ci = vec2f ( 0 , 0 ) ; } else if ( O_ee == 1 ) { O_ci = vec2f ( O_af , - O_ag / 2 ) ; } else if ( O_ee == 2 ) { O_ci = vec2f ( O_af , O_ag / 2 ) ; } else if ( O_ee == 3 || O_ee == 8 ) { O_ci = vec2f ( O_af , O_ai / 2 ) ; } else if ( O_ee == 4 ) { O_ci = vec2f ( O_af + O_ah , O_ai / 2 ) ; } else if ( O_ee == 5 || O_ee == 6 ) { O_ci = vec2f ( O_af + O_ah , - O_ai / 2 ) ; } else if ( O_ee == 7 ) { O_ci = vec2f ( O_af , - O_ai / 2 ) ; } if ( O_jo ) { let O_ir = O_ag / O_bc . O_i ; if ( O_ir > O_aj ) { O_ci *= O_aj / O_ir ; } let O_go = O_ey / 2 ; if ( O_ee == 3 || O_ee == 8 || O_ee == 4 ) { O_ci . y = O_go ; } else if ( O_ee == 5 || O_ee == 6 || O_ee == 7 ) { O_ci . y = - O_go ; } } let cos = cos ( O_gc ) ; let sin = sin ( O_gc ) ; O_ci = mat2x2 ( cos , sin , - sin , cos ) * O_ci ; O_ci += O_e ; O_ez . O_ci = O_ci ; return O_ez ; } @ vertex fn scaleArrowVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kr { var O_ez : O_kr ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * SCALE_ARROW_PT_LENGTH ; let O_e = vec2f ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_gc = O_be [ O_ft + 3 ] ; let O_q = O_be [ O_ft + 5 ] ; let O_ey = O_bd . O_i * MIN_PX_LENGTH_RATIO ; O_ez = O_ks ( O_ee , O_e , O_gc , O_q , O_ey , false ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci . xy , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_bd . O_bb . O_p , O_be [ O_ft + 5 ] ) ; } return O_ez ; } @ fragment fn scaleArrowFrag ( @ builtin ( position ) O_fo : vec4 < f32 > , @ location ( 1 ) @ interpolate ( flat ) O_p : f32 , @ location ( 2 ) @ interpolate ( flat ) O_bx : f32 , @ location ( 3 ) @ interpolate ( flat ) O_ci : vec2 < f32 > , ) -> @ location ( 0 ) vec4 < f32 > { return O_bu ( O_p , 1 , 1 , O_bx ) ; } @ vertex fn fixedArrowVert ( @ builtin ( vertex_index ) O_ee : u32 , @ builtin ( instance_index ) O_fs : u32 , @ location ( 0 ) id : i32 , @ location ( 1 ) O_p : i32 , ) -> O_kr { var O_ez : O_kr ; let O_cb = f32 ( O_p ) ; if ( O_bq ( id , O_cb ) == 0 ) { return O_ez ; } let O_ft = id * FIXED_ARROW_PT_LENGTH ; let O_e = vec2f ( O_be [ O_ft + 1 ] , O_be [ O_ft + 2 ] ) ; let O_gc = O_be [ O_ft + 3 ] ; let O_q = O_be [ O_ft + 5 ] ; let O_ey = O_bd . O_i * MIN_PX_LENGTH_RATIO ; O_ez = O_ks ( O_ee , O_e , O_gc , O_q , O_ey , true ) ; O_ez . O_fo = O_bc . O_b * vec4 ( O_ez . O_ci . xy , 0 , 1 ) ; let O_bx = O_bp ( O_cb ) ; O_ez . O_bx = O_bx ; if ( O_bx == 0 ) { O_ez . O_p = O_cb ; } else { O_ez . O_p = O_ca ( O_bd . O_bb . O_p , O_be [ O_ft + 5 ] ) ; } return O_ez ; } ",Jve=44,Qve=20,int=[0,1,2,15,3,4,5,6,7,8,9,10,11,12,13,14,16,17,18,19,20,66,67,68],exe={circleVert:["CIRCLE_PT_LENGTH","MIN_PX_LENGTH_RATIO"],circleFrag:[],arcVert:["ARC_PT_LENGTH","MIN_PX_LENGTH_RATIO"],arcFrag:["MATH_PI"],ellipseVert:["ELLIPSE_PT_LENGTH"],ellipseFrag:[],triangleVert:["TRIANGLE_PT_LENGTH"],rectVert:["RECT_PT_LENGTH","MIN_PX_LENGTH_RATIO"],noBodyRectVert:["RECT_PT_LENGTH","MIN_PX_LENGTH_RATIO"],pointVert:["POINT_PT_LENGTH"],rectFrag:["MATH_PI","ANTIALIAS_RATIO"],lineVert:["LINE_PT_LENGTH","MIN_PX_LENGTH_RATIO"],lineFrag:["MATH_PI","ANTIALIAS_RATIO"],cutedCircleVert:["CUTED_CIRCLE_PT_LENGTH"],lineSegmentVert:["LINESEGMENT_PT_LENGTH"],lineSegmentFrag:["MATH_PI","ANTIALIAS_RATIO"],semicircleVert:["SEMICIRCLE_PT_LENGTH"],semicircleFrag:[],staticTriangleVert:["STATIC_TRIANGLE_PT_LENGTH"],staticCutedCircleVert:["STATIC_CUTED_CIRCLE_PT_LENGTH"],drcVert:["DRC_PT_LENGTH","MATH_PI","SDF_HEIGHT","SDF_WIDTH"],drcFrag:["ANTIALIAS_RATIO","MATH_PI","SDF_HEIGHT","SDF_WIDTH"],stringVert:["STRING_PT_LENGTH"],scaleStringVert:["SCALE_STRING_PT_LENGTH"],stringFrag:["CHAR_HEIGHT","CANVAS_HEIGHT","CHAR_WIDTH","CANVAS_WIDTH"],circleTemplateInstanceVert:["CIRCLE_PT_LENGTH","MIN_PX_LENGTH_RATIO","TEMPLATE_INSTANCE_PT_LENGTH"],triangleTemplateInstanceVert:["TRIANGLE_PT_LENGTH","TEMPLATE_INSTANCE_PT_LENGTH"],stringTemplateInstanceVert:["STRING_PT_LENGTH","TEMPLATE_INSTANCE_PT_LENGTH","STRING_LEVEL_BITLENGTH"],arcTemplateInstanceVert:["ARC_PT_LENGTH","MIN_PX_LENGTH_RATIO","TEMPLATE_INSTANCE_PT_LENGTH"],rectTemplateInstanceVert:["RECT_PT_LENGTH","MIN_PX_LENGTH_RATIO","TEMPLATE_INSTANCE_PT_LENGTH"],lineSegmentTemplateInstanceVert:["LINESEGMENT_PT_LENGTH","TEMPLATE_INSTANCE_PT_LENGTH"],semicircleTemplateInstanceVert:["SEMICIRCLE_PT_LENGTH","TEMPLATE_INSTANCE_PT_LENGTH"],lineTemplateInstanceVert:["LINE_PT_LENGTH","MIN_PX_LENGTH_RATIO","TEMPLATE_INSTANCE_PT_LENGTH"],cutedCircleTemplateInstanceVert:["CUTED_CIRCLE_PT_LENGTH","TEMPLATE_INSTANCE_PT_LENGTH"],staticTriangleTemplateInstanceVert:["STATIC_TRIANGLE_PT_LENGTH","TEMPLATE_INSTANCE_PT_LENGTH"],staticCutedCircleTemplateInstanceVert:["STATIC_CUTED_CIRCLE_PT_LENGTH","TEMPLATE_INSTANCE_PT_LENGTH"],scaleArrowVert:["SCALE_ARROW_PT_LENGTH","MIN_PX_LENGTH_RATIO"],fixedArrowVert:["FIXED_ARROW_PT_LENGTH","MIN_PX_LENGTH_RATIO"]},txe=[18,11,12,13,14,31,32,33,34,46,47,48,49,16,17,20],nnt=class{constructor(o){this.scene=o;let t=o.gpu;this.gpu=t;let e=t.device;this.allConstants={CIRCLE_PT_LENGTH:Fr.getPtLengthByType(0),ARC_PT_LENGTH:Fr.getPtLengthByType(1),ELLIPSE_PT_LENGTH:Fr.getPtLengthByType(16),TRIANGLE_PT_LENGTH:Fr.getPtLengthByType(6),RECT_PT_LENGTH:Fr.getPtLengthByType(2),LINE_PT_LENGTH:Fr.getPtLengthByType(15),CUTED_CIRCLE_PT_LENGTH:Fr.getPtLengthByType(7),LINESEGMENT_PT_LENGTH:Fr.getPtLengthByType(3),SEMICIRCLE_PT_LENGTH:Fr.getPtLengthByType(4),STATIC_TRIANGLE_PT_LENGTH:Fr.getPtLengthByType(8),STATIC_CUTED_CIRCLE_PT_LENGTH:Fr.getPtLengthByType(9),DRC_PT_LENGTH:Fr.getPtLengthByType(19),STRING_PT_LENGTH:Fr.getPtLengthByType(10),SCALE_STRING_PT_LENGTH:Fr.getPtLengthByType(66),POINT_PT_LENGTH:Fr.getPtLengthByType(5),MATH_PI:Math.PI,ANTIALIAS_RATIO:QRe,CHAR_WIDTH:108,CHAR_HEIGHT:200,CANVAS_WIDTH:4e3,CANVAS_HEIGHT:4e3,MIN_PX_LENGTH_RATIO:wye,SDF_HEIGHT:Iw,SDF_WIDTH:M_,RENDER_HIGHLIGHT_TYPE_SHIFT:W7,TEMPLATE_INSTANCE_PT_LENGTH:Fr.getPtLengthByType(21),STRING_LEVEL_BITLENGTH:RC,SCALE_ARROW_PT_LENGTH:Fr.getPtLengthByType(67),FIXED_ARROW_PT_LENGTH:Fr.getPtLengthByType(68),GROUP_DATA_LENGTH:VT,PTGROUP_VISIBLE_SHIFT:JZ,PTGROUP_DOUBLERGB_SHIFT:tJ,PTGROUP_HIGH_LIGHT_SHIFT:QZ,PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT:eJ,PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT:ZZ},this.uniformsBuf=t.createDynamicBuffer(Jve,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"uniformsBuf of RenderHighLightPtProgram"),this.drawFullUniformsBuf=t.createDynamicBuffer(Qve,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"bboxIndexBuf of RenderHighLightPtProgram"),this.desc={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"},label:"desc of RenderHighLightPtProgram"},this.clearStencilDesc={colorAttachments:[],depthStencilAttachment:{view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"clear",stencilStoreOp:"store",stencilClearValue:64},label:"clearStencilDesc of RenderHighLightPtProgram"},this.layout=e.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{}},{binding:1,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{}},{binding:2,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}},{binding:3,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}},{binding:4,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:5,visibility:GPUShaderStage.FRAGMENT,texture:{}},{binding:6,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:7,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:8,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:9,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}},{binding:10,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}},{binding:11,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}},{binding:12,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}}]});let r=e.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{}},{binding:1,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"read-only-storage"}}]}),i=t.createShaderModule(rnt),n=t.createShaderModule(tnt);this.fullScreenBindGroup=this.gpu.createDynamicBindGroup(r,0,this.drawFullUniformsBuf,1,this.scene.colorsBuf);let s=e.createPipelineLayout({bindGroupLayouts:[this.layout]}),a=(l,c,h,u)=>{let d=[];return int.forEach(p=>{let m=Rs[p],g=`${m}Vert`;if(Fr.isNormalPolygonType(p)){let y=`${FZ(m,p)}Frag`;d[p]=e.createRenderPipeline({layout:s,vertex:{module:i,entryPoint:g,constants:this.getConstants(g),buffers:[{arrayStride:rs*2,attributes:[{shaderLocation:0,offset:0,format:"sint32"},{shaderLocation:1,offset:rs,format:"sint32"}],stepMode:"instance"}]},fragment:{module:i,entryPoint:y,constants:this.getConstants(y),targets:[{format:_a,writeMask:0}]},primitive:{topology:"triangle-list"},depthStencil:{format:J2,depthCompare:"always",depthWriteEnabled:!1,stencilReadMask:u,stencilFront:{compare:"not-equal",passOp:"increment-wrap"},stencilBack:{compare:"not-equal",passOp:"decrement-wrap"}},label:`renderHighLightPt ${p} pipeline`})}else{if(txe.includes(p))return;{let y=`${FZ(m,p)}Frag`;d[p]=e.createRenderPipeline({layout:s,vertex:{module:i,entryPoint:g,constants:this.getConstants(g),buffers:[{arrayStride:2*rs,attributes:[{shaderLocation:0,offset:0,format:"sint32"},{shaderLocation:1,offset:rs,format:"sint32"}],stepMode:"instance"}]},fragment:{module:i,entryPoint:y,constants:this.getConstants(y),targets:[{format:_a,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}},writeMask:l?15:0}]},primitive:{topology:"triangle-list"},depthStencil:{format:J2,depthCompare:"always",depthWriteEnabled:!1,stencilReadMask:c,stencilFront:h,stencilBack:h},label:`renderHighLightPt ${p} pipeline`})}}}),d};this.renderPipelines=a(!0,255,{compare:"always"},127),this.drawFullScreenPipeline=e.createRenderPipeline({layout:e.createPipelineLayout({bindGroupLayouts:[r]}),vertex:{module:n,entryPoint:"fullVert"},fragment:{module:n,entryPoint:"fullFrag",constants:{RENDER_HIGHLIGHT_TYPE_SHIFT:W7},targets:[{format:_a,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"},depthStencil:{format:J2,depthCompare:"always",depthWriteEnabled:!1,stencilReadMask:63,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}}),this.noBodyRectPipeline=e.createRenderPipeline({layout:s,vertex:{module:i,entryPoint:"noBodyRectVert",constants:this.getConstants("noBodyRectVert")},fragment:{module:i,entryPoint:"rectFrag",constants:this.getConstants("rectFrag"),targets:[{format:_a,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}},writeMask:15}]},primitive:{topology:"triangle-list"},depthStencil:{format:J2,depthCompare:"always",depthWriteEnabled:!1,stencilReadMask:255,stencilFront:{compare:"always"},stencilBack:{compare:"always"}}})}getConstants(o){let t={};return["triangleFrag","cutedCircleFrag","noBodyRectVert"].includes(o)||(t.RENDER_HIGHLIGHT_TYPE_SHIFT=this.allConstants.RENDER_HIGHLIGHT_TYPE_SHIFT),t.GROUP_DATA_LENGTH=this.allConstants.GROUP_DATA_LENGTH,o.indexOf("Vert")&&(t.PTGROUP_VISIBLE_SHIFT=this.allConstants.PTGROUP_VISIBLE_SHIFT,t.PTGROUP_DOUBLERGB_SHIFT=this.allConstants.PTGROUP_DOUBLERGB_SHIFT,t.PTGROUP_HIGH_LIGHT_SHIFT=this.allConstants.PTGROUP_HIGH_LIGHT_SHIFT,t.PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT=this.allConstants.PTGROUP_HIGH_LIGHT_GROUP_ID_SHIFT,t.PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT=this.allConstants.PTGROUP_USE_WIRE_FRAME_RENDER_SHIFT),exe[o]&&exe[o].forEach(e=>{t[e]=this.allConstants[e]}),t}createDynamicBindGroup(o,t){return this.gpu.createDynamicBindGroup(this.layout,0,this.scene.cameraBuf,1,this.uniformsBuf,2,o,3,this.scene.staticPolygonInfoBuilder.updateBuf(),4,this.scene.stringInfoBuilder.updateBuf(),5,this.scene.char.texture,6,this.gpu.linearSampler,7,this.scene.sdfStringLibrary.stringInfoBuilder.updateBuf(),8,this.scene.sdfStringLibrary.getSdfBuffer(),9,this.scene.colorsBuf,10,this.scene.ptTemplate.getTemplateInstanceData().updateBuf(),11,t,12,this.scene.ptGroup.getData().updateBuf())}afterDraw(o,t,e,r,i){let n=new Float32Array(Qve);n.set(this.scene.highLightColor[t].getData()),n[4]=e,n[5]=r,n[6]=i.isColorful?1:0,n[7]=i.scene.getForceVisibleHighLightPt()?1:0;let s=i.getColor(),a=i.getOriginalColor();n.set([s.r,s.g,s.b,s.alpha*i.polygonColorAlphaRatio],8),n.set([a.r,a.g,a.b,a.alpha*i.polygonColorAlphaRatio],12),this.scene.addData(new Uint32Array(n.buffer),this.drawFullUniformsBuf),t==0?this.desc.colorAttachments[0].view=o.highLightColorTexture0.view:this.desc.colorAttachments[0].view=o.highLightColorTexture1.view,this.desc.depthStencilAttachment.view=o.depthStencilTexture.view;let l=this.scene.commandEncoder.beginRenderPass(this.desc);l.setStencilReference(64),l.setPipeline(this.drawFullScreenPipeline),l.setBindGroup(0,this.fullScreenBindGroup.getBindGroup()),l.draw(6),l.end()}getRenderHighLightTypeByColorIndex(o){return o&W7}render(o,t,e,r){Fr.isNormalPolygonType(o)?this.draw0(o,e,0,t,r):this.draw0(o,e,64,t,r)}getPolygonRenderColors(o,t){let e=[t],r=o.polygonColorAndGroupIdMap.get(t);if(!r&&r!==0)return e;let i=this.scene.ptGroup.getData();if(Array.isArray(r))for(let n=0;n<r.length;n+=1){let s=r[n],a=ih.getColorIndex(s,i);e.includes(a)||e.push(a)}else{let n=ih.getColorIndex(r,i);e.includes(n)||e.push(n)}return e}renderNoBodyRect(o,t){let e=this.scene.commandEncoder.beginRenderPass(this.desc);e.setPipeline(this.noBodyRectPipeline),e.setBindGroup(0,o.getBindGroup()),e.setStencilReference(64),e.draw(6,t),e.end(),this.scene.renderPtNum+=t,this.scene.renderPtTypeNum[2]+=t,this.scene.renderVertexNum+=t*6,this.scene.drawTimes++}draw0(o,t,e,r,i){let n=o;Fr.isCustomTemplateInstanceType(o)&&(o=Fr.getTemplateTypeByCustomInstanceType(o));let s=this.scene.commandEncoder.beginRenderPass(this.desc),a=this.renderPipelines;if(!a[o])throw new Error(`pipelines type error${o}`);s.setPipeline(a[o]),s.setBindGroup(0,r.getBindGroup()),s.setStencilReference(e);let l=i.getMemory();s.setVertexBuffer(0,l.getBuffer(),l.getOffset(),l.getSize());let c=BZ(o);s.draw(c,t),s.end(),this.scene.renderPtNum+=t,this.scene.renderPtTypeNum[n]+=t,this.scene.renderVertexNum+=t*c,this.scene.drawTimes++}draw(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.scene.renderPtNum,p=()=>{i==0?this.desc.colorAttachments[0].view=o.highLightColorTexture0.view:this.desc.colorAttachments[0].view=o.highLightColorTexture1.view,this.desc.depthStencilAttachment.view=o.depthStencilTexture.view,this.clearStencilDesc.depthStencilAttachment.view=o.depthStencilTexture.view,this.scene.char.flush(),this.scene.sdfStringLibrary.stringInfoBuilder.updateBuf(),this.scene.ptGroup.getData().updateBuf(),d=this.scene.renderPtNum,this.scene.addData(y,this.uniformsBuf)},m=e.getPxLength(t,Ae.ORIGIN),g=eDe(m,this.scene.getFixedPtData()),y=new Uint32Array(Jve),b=new Float32Array(y.buffer);b.set(this.scene.highLightColor[i].getData()),b[4]=m,y[5]=n;let P=this.scene.drcRenderModel===0;b[6]=P?1:0,b[7]=this.scene.drcRenderStyle===0?1:0,y[8]=0,b[9]=e.isColorful?1:0,b[10]=e.isVisible()?1:0,b[11]=e.scene.getForceVisibleHighLightPt()?1:0,b.set(e.networkTextColor.getData(),12),b.set(e.getColor().getData(),16),b.set(e.getOriginalColor().getData(),20),b[24]=e.ignoreForceHighLightEffect?1:0;let T=this.scene.getFixedPtData();if(b[28]=T[0],b[29]=T[1],b[30]=T[2],b[31]=T[3],b[32]=T[4],b[33]=T[5],b[34]=T[6],p(),e.isHighLight)for(let I of r){let C=I.getBuilders();for(let E=0;E<C.length;E++){if(!C[E])continue;if(E!==2)throw new Error("Highlight Plane data is incorrect");let O=I.getMaxLength(2);if(!O)continue;let _=I.getHighLightBindGroup0(E);this.renderNoBodyRect(_,O)}}else{let I={};r.forEach(E=>{let O=E.getPolygonHighLightIds(i);if(!O)return;let _={};E.getPolygonBuilders().forEach((x,v)=>{x.forEach((D,w)=>{_[v]||(_[v]={}),_[v][w]||(_[v][w]={}),_[v][w]={builder:D,bindGroup:E.getPolygonHighLightBindGroup(v,w,u)}})}),O.forEach((x,v)=>{x.forEach((D,w)=>{let F=this.getRenderHighLightTypeByColorIndex(w),H=w;D.forEach((z,V)=>{F&&(H=v),I[F]||(I[F]={}),I[F][H]||(I[F][H]={}),I[F][H][V]||(I[F][H][V]=[]),I[F][H][V].push({builder:_[v][V].builder,bindGroup:_[v][V].bindGroup,highLightIds:z})})})})});let C=0;if(c){for(let E of Object.keys(I))for(let O of Object.keys(I[E])){C++;let _=I[E][O],x=this.getPolygonRenderColors(e,Number(O));for(let v=0;v<x.length;v++){v!==0&&this.scene.commandEncoder.beginRenderPass(this.clearStencilDesc).end();let D=x[v];b[25]=D,this.scene.addData(y,this.uniformsBuf);for(let w of Object.keys(_)){let F=_[w];for(let H of Object.keys(F)){let z=F[H],V=z.highLightIds,W=V==null?void 0:V.getMaxLength();W&&this.render(Number(w),z.bindGroup,W,V.getData().updateBuf())}}this.afterDraw(o,i,Number(D),Number(E),e)}}for(let E of r){let O=E.getHighLightIds(i);if(O!=null&&O.length){let _=E.getBuilders();for(let x=0;x<_.length;x++){if(Fr.isNormalPolygonType(x)||!E.getMaxLength(x)||txe.includes(x)||x==19||x===68&&!g)continue;let v=O[x],D=v==null?void 0:v.getMaxLength();if(!D)continue;let w=E.getHighLightBindGroup(x,u);this.render(x,w,D,v.getData().updateBuf())}}}}if(l)for(let E of r){let O=E.getHighLightIds(i,10),_=E.getHighLightIds(i,30);if(!(O!=null&&O.length)&&!(_!=null&&_.length))continue;let x,v;E.drawString(m,(D,w)=>{x=O[w];let F=x==null?void 0:x.getMaxLength();F&&(v=E.getStringHighLightBindGroup(w,D),this.render(10,v,F,x.getData().updateBuf()))}),E.drawTemplateString(m,(D,w)=>{x=_[w];let F=x==null?void 0:x.getMaxLength();F&&(v=E.getTemplateStringHighLightBindGroup(w,D,u),this.render(30,v,F,x.getData().updateBuf()))}),E.drawCustomTemplateString(m,(D,w)=>{x=_[w];let F=x==null?void 0:x.getMaxLength();F&&(v=E.getTemplateStringHighLightBindGroup(w,D,u),this.render(45,v,F,x.getData().updateBuf()))})}if(a)for(let E of r){let O=E.getHighLightIds(i);if(O!=null&&O.length){let _=O[19],x=_==null?void 0:_.getMaxLength();if(!x||!(E!=null&&E.getMaxLength(19))||P&&E.getDrcPxLength()<m)continue;let v=E.getHighLightBindGroup(19,u);this.render(19,v,x,_.getData().updateBuf())}}}}},rxe="@ group ( 0 ) @ binding ( 0 ) var O_a : texture_2d < f32 > ; struct O_b { @ builtin ( position ) O_c : vec4 < f32 > , @ location ( 0 ) O_d : vec2 < f32 > , } @ vertex fn v_main ( @ builtin ( vertex_index ) O_e : u32 , ) -> O_b { var O_f : O_b ; var O_g = array ( vec2f ( - 1.0 , - 1.0 ) , vec2f ( 1.0 , - 1.0 ) , vec2f ( - 1.0 , 1.0 ) , vec2f ( - 1.0 , 1.0 ) , vec2f ( 1.0 , - 1.0 ) , vec2f ( 1.0 , 1.0 ) , ) ; var O_h = array ( vec2f ( 0.0 , 0.0 ) , vec2f ( 1.0 , 0.0 ) , vec2f ( 0.0 , 1.0 ) , vec2f ( 0.0 , 1.0 ) , vec2f ( 1.0 , 0.0 ) , vec2f ( 1.0 , 1.0 ) , ) ; O_f . O_c = vec4f ( O_g [ O_e ] , 0.0 , 1.0 ) ; O_f . O_d = vec2f ( O_h [ O_e ] . x , 1 - O_h [ O_e ] . y ) ; return O_f ; } @ fragment fn f_main ( @ builtin ( position ) O_h : vec4 < f32 > , @ location ( 0 ) O_d : vec2 < f32 > , ) -> @ location ( 0 ) vec4 < f32 > { var O_i = textureLoad ( O_a , vec2 < i32 > ( O_h . xy ) , 0 ) ; return O_i ; } ",ont=class{constructor(o){this.scene=o;let t=o.gpu;this.gpu=t,this.device=t.device,this.pipeline=this.createPipeline(),this.renderDesc=this.createRenderDesc(),this.bindGroup0=this.createDynamicBindGroup0(),this.bindGroup1=this.createDynamicBindGroup1()}createPipeline(){return this.device.createRenderPipeline({layout:"auto",vertex:{module:this.gpu.createShaderModule(rxe),entryPoint:"v_main"},fragment:{module:this.gpu.createShaderModule(rxe),entryPoint:"f_main",targets:[{format:_a,blend:{color:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}})}createRenderDesc(){return{colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}}createDynamicBindGroup0(){return this.gpu.createDynamicBindGroup(this.pipeline.getBindGroupLayout(0),0,this.scene.highLightColorTexture0)}createDynamicBindGroup1(){return this.gpu.createDynamicBindGroup(this.pipeline.getBindGroupLayout(0),0,this.scene.highLightColorTexture1)}render(o,t){this.renderDesc.colorAttachments[0].view=o;let e=this.scene.commandEncoder.beginRenderPass(this.renderDesc);e.setPipeline(this.pipeline),e.setBindGroup(0,t==0?this.bindGroup0.getBindGroup():this.bindGroup1.getBindGroup()),e.draw(6,1,0,0),e.end(),this.scene.submitCommandEncoder()}},Mwe=Symbol("release"),ixe=2**32;function o1e(o,t,e,r){return`${o}-${t}-${e}-${r}`}var snt=class{constructor(o,...t){this.gpu=o,this.size=0,this.texturesIndex={};for(let e of t){let[r,i,n,s,a]=e,l=this.getOrInitTextures(r,i,n,s);for(let c=0;c<a;c++)l.push(this.createTexture(r,i,n,s))}}getOrInitTextures(o,t,e,r){let i=o1e(o,t,e,r);return this.texturesIndex[i]||(this.texturesIndex[i]=[])}createTexture(o,t,e,r){return this.size+=o*t*4,new ant(this,this.gpu.createDynamicTexture(o,t,e,r,"texturePool-"+o1e(o,t,e,r)))}getTexture(o,t,e,r){let i=this.getOrInitTextures(o,t,e,r);return i.length===0?this.createTexture(o,t,e,r):i.pop()}[Mwe](o){let{width:t,height:e,format:r,usage:i}=o.texture;this.texturesIndex[o1e(t,e,r,i)].push(o)}recall(){if(this.size<=ixe)return;let o=Object.values(this.texturesIndex),t=o.pop();for(;this.size>ixe&&t;){let e=t.pop();if(e){let r=e.texture;this.size-=r.width*r.height*4,r.destroy()}else t=o.pop()}}},ant=class{constructor(o,t){this.pool=o,this.texture=t}release(){this.pool[Mwe](this)}},lnt="struct O_a { O_b : mat4x4 < f32 > , O_c : vec4 < f32 > , O_d : vec4 < f32 > , O_e : vec2 < f32 > , } @ binding ( 0 ) @ group ( 0 ) var < uniform > O_f : O_a ; struct O_g { @ builtin ( position ) O_h : vec4 < f32 > , @ location ( 0 ) O_e : vec4 < f32 > , @ location ( 1 ) O_i : vec4 < f32 > , } @ vertex fn vert ( @ location ( 0 ) O_e : vec2 < f32 > , ) -> O_g { var O_j : O_g ; O_j . O_h = vec4 ( O_e , 0 , 1 ) ; if ( abs ( O_e . x ) > 1.0 ) { if ( O_e . x > 0.0 ) { O_j . O_h . x = 1.0 - 18.0 * O_f . O_b [ 0 ] [ 0 ] ; } else { O_j . O_h . x = - 1.0 + 18.0 * O_f . O_b [ 0 ] [ 0 ] ; } } else if ( abs ( O_e . y ) > 1.0 ) { if ( O_e . y > 0.0 ) { O_j . O_h . y = 1.0 - 18.0 * O_f . O_b [ 1 ] [ 1 ] ; } else { O_j . O_h . y = - 1.0 + 18.0 * O_f . O_b [ 1 ] [ 1 ] ; } } O_j . O_i = vec4 ( O_j . O_h . xy , 1.0 - 18.0 * O_f . O_b [ 1 ] [ 1 ] , - 1.0 + 18.0 * O_f . O_b [ 0 ] [ 0 ] ) ; let O_k = vec4 ( O_f . O_e , 0 , 1 ) * O_f . O_b ; let O_l = O_f . O_b [ 0 ] [ 0 ] ; let O_m = O_f . O_b [ 1 ] [ 1 ] ; O_j . O_e = vec4 ( O_k . x - O_l , O_k . x + O_l , O_k . y - O_m , O_k . y + O_m ) ; return O_j ; } @ fragment fn frag ( @ builtin ( position ) O_h : vec4 < f32 > , @ location ( 0 ) O_e : vec4 < f32 > , @ location ( 1 ) O_i : vec4 < f32 > , ) -> @ location ( 0 ) vec4 < f32 > { return select ( O_f . O_c , O_f . O_d , ( O_i . x >= O_e [ 0 ] && O_i . x <= O_e [ 1 ] && O_i . y > O_i . z ) || ( O_i . y >= O_e [ 2 ] && O_i . y <= O_e [ 3 ] && O_i . x < O_i . w ) ) ; } ",cnt="struct O_a { O_b : vec4 < f32 > , O_c : vec2 < f32 > , } @ binding ( 0 ) @ group ( 0 ) var < uniform > O_d : O_a ; @ vertex fn vert ( @ location ( 0 ) O_e : f32 , ) -> @ builtin ( position ) vec4 < f32 > { var O_f : vec4 < f32 > = vec4 < f32 > ( - 1.0 , 1.0 , 0.0 , 1.0 ) ; if ( O_e == 1.0 ) { O_f . y = 1.0 - 18.0 * O_d . O_c . y ; } else if ( O_e == 2.0 ) { O_f . x = - 1.0 + 18.0 * O_d . O_c . x ; O_f . y = 1.0 - 18.0 * O_d . O_c . y ; } else if ( O_e == 3.0 ) { O_f . x = - 1.0 + 18.0 * O_d . O_c . x ; } else if ( O_e == 4.0 ) { O_f . y = 1.0 - 18.0 * O_d . O_c . y ; } else if ( O_e == 5.0 ) { O_f . x = - 1.0 + 18.0 * O_d . O_c . x ; } return O_f ; } @ fragment fn frag ( ) -> @ location ( 0 ) vec4 < f32 > { return O_d . O_b ; } ",hnt="struct O_a { O_b : mat4x4 < f32 > , O_c : vec4 < f32 > , } @ binding ( 0 ) @ group ( 0 ) var < uniform > O_d : O_a ; @ vertex fn vert ( @ location ( 0 ) O_e : vec3 < f32 > , ) -> @ builtin ( position ) vec4 < f32 > { var O_b = O_d . O_b ; if ( O_e . z == 1 ) { O_b [ 0 ] [ 0 ] = 1 ; O_b [ 3 ] [ 0 ] = 0 ; } else { O_b [ 1 ] [ 1 ] = 1 ; O_b [ 3 ] [ 1 ] = 0 ; } return O_b * vec4 ( O_e . xy , 0 , 1 ) ; } @ fragment fn frag ( ) -> @ location ( 0 ) vec4 < f32 > { return O_d . O_c ; } ",unt=Symbol("ruler"),dnt=class{constructor(o){this.scale=1,this.ratio=5,this.spacing=2,this.centerSpace=5,this.endSpace=10,this.unit="mil",this.origin=S.ORIGIN,this.size=0,this.unitConversion=new Aw,this.ratioScale=1,this.scene=o;let t=o.gpu,e=t.device;this.desc={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]},this.backgroundUniformsBuf=t.createDynamicBuffer(28,GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"backgroundUniformsBuf of RulerProgram");let r=18;this.backgroundPosBuf=t.createStaticBuffer(new Uint32Array(new Float32Array([-1,-1,-r,-1,-r,1,-1,-1,-r,1,-1,1,-1,r,1,r,1,1,-1,r,1,1,-1,1]).buffer),GPUBufferUsage.VERTEX,"backgroundPosBuf of RulerProgram"),this.backgroundArrayCount=this.backgroundPosBuf.getSize()/2;let i=t.createShaderModule(lnt);this.backgroundPipeline=e.createRenderPipeline({layout:"auto",vertex:{module:i,entryPoint:"vert",buffers:[{arrayStride:2*rs,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]}]},fragment:{module:i,entryPoint:"frag",targets:[{format:_a}]},primitive:{topology:"triangle-list"}}),this.backgroundBindGroup=t.createBindGroup("ruler background",this.backgroundPipeline.getBindGroupLayout(0),0,this.backgroundUniformsBuf),this.rulerMaskUniformsBuf=t.createDynamicBuffer(8,GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,"rulerMaskUniformsBuf of RulerProgram"),this.rulerMaskPosBuf=t.createStaticBuffer(new Uint32Array(new Float32Array([1,2,3,4,5,6]).buffer),GPUBufferUsage.VERTEX,"rulerMaskPosBuf of RulerProgram");let n=t.createShaderModule(cnt);this.rulerMaskPipeline=e.createRenderPipeline({label:"Shadow Pipeline",layout:"auto",vertex:{module:n,entryPoint:"vert",buffers:[{arrayStride:1*rs,attributes:[{shaderLocation:0,offset:0,format:"float32"}]}]},fragment:{module:n,entryPoint:"frag",targets:[{format:_a}]},primitive:{topology:"triangle-list"}}),this.rulerMaskBindGroup=t.createDynamicBindGroup(this.rulerMaskPipeline.getBindGroupLayout(0),0,this.rulerMaskUniformsBuf),this.scaleUniformsBuf=t.createDynamicBuffer(28,GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"scaleUniformsBuf of RulerProgram"),this.scalePosBuf=t.createDynamicBuffer(1,GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX,"scalePosBuf of RulerProgram");let s=t.createShaderModule(hnt);this.scalePipeline=e.createRenderPipeline({layout:"auto",vertex:{module:s,entryPoint:"vert",buffers:[{arrayStride:3*rs,attributes:[{shaderLocation:0,offset:0,format:"float32x3"}]}]},fragment:{module:s,entryPoint:"frag",targets:[{format:_a,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"line-list"}}),this.scaleBindGroup=t.createDynamicBindGroup(this.scalePipeline.getBindGroupLayout(0),0,this.scaleUniformsBuf),this.strPlane=new P9(o,1,ee.build(0,0,0),void 0,unt,!1,!1),this.builder=ym.create(Float32Array,t,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,"ptsBuf of RulerProgram");let a=ym.create(Float32Array,t,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX|GPUBufferUsage.STORAGE,"testBuf of RulerProgram");this.bindGroup=this.createDynamicBindGroup(a.updateBuf())}createDynamicBindGroup(o){return this.scene.gpu.createDynamicBindGroup(this.scene.renderPtProgram.renderPtBindGroupLayout,0,this.scene.cameraBuf,1,this.scene.renderPtProgram.uniformsBuf,4,this.scene.colorsBuf,5,this.scene.renderPtProgram.sampler,6,this.scene.char.texture,7,this.scene.staticPolygonInfoBuilder.updateBuf(),8,this.scene.stringInfoBuilder.updateBuf(),9,this.scene.ptGroup.getData().updateBuf(),10,this.scene.renderPtProgram.highLightStencilBuf,11,this.scene.sdfStringLibrary.stringInfoBuilder.updateBuf(),12,this.scene.sdfStringLibrary.getSdfBuffer(),13,this.strPlane.templatePtOffsetBuild.updateBuf(),14,this.scene.ptTemplate.getTemplateInstanceData().updateBuf(),15,o)}updateScaleData(o,t){this.deltaX=1-36/o,this.deltaY=1-36/t;let e=[],r=0,i=0,n=o/2,s=t/2,a=(1-this.deltaY)/2;for(let c=0;c<n;c+=this.spacing)r=this.fillVertical(e,c,a,r,i),i+=1;i=0;for(let c=0;c>-n;c-=this.spacing)r=this.fillVertical(e,c,a,r,i),i+=1;i=0;let l=(1-this.deltaX)/2;for(let c=0;c<s;c+=this.spacing)r=this.fillHorizontal(e,c,l,r,i),i+=1;i=0;for(let c=0;c>-s;c-=this.spacing)r=this.fillHorizontal(e,c,l,r,i),i+=1;this.scalePosBuf.setSize(e.length),this.scalePosBuf.write(0,new Float32Array(e)),this.scaleArrayCount=e.length/3}resize(o,t){o===this.width&&t===this.height||(this.width=o,this.height=t,this.updateScaleData(o,t))}getOrigin(){return this.origin}fillVertical(o,t,e,r,i){let n=i%this.centerSpace,s=i%this.endSpace;return o[r++]=t,o[r++]=this.deltaY,o[r++]=0,o[r++]=t,s==0?o[r++]=this.deltaY+e*2:n==0?o[r++]=this.deltaY+e:o[r++]=this.deltaY+e*.5,o[r++]=0,r}fillHorizontal(o,t,e,r,i){let n=i%this.centerSpace;return i%this.endSpace==0?o[r++]=-this.deltaX-e*2:n==0?o[r++]=-this.deltaX-e:o[r++]=-this.deltaX-e*.5,o[r++]=t,o[r++]=1,o[r++]=-this.deltaX,o[r++]=t,o[r++]=1,r}get spacing10(){return this.spacing*this.ratio*this.scale*10*this.ratioScale}modifyUnit(o){o!=this.unit&&(o!="mil"?this.scale=this.unitConversion.conversion(o,"mil",1)/100:this.scale=1,this.unit=o)}autoScale(o){let t=o.getViewMatrix().multiply4(Ae.scale(o.getScale(),o.getScale(),1)),e=Math.sqrt(t.data[0]*t.data[0]+t.data[1]*t.data[1]),r=0,i=e;for(;;)if(i>=1){if(i=i/10,i<1)break;r++}else if(i=i*10,r--,i>=1)break;let n=e/Math.pow(10,r);n>=1&&n<2?e=e/Math.pow(10,r):n>=2&&n<5?e=e/(2*Math.pow(10,r)):e=e/(5*Math.pow(10,r));let s=this.origin.multiply4(o.getViewMatrix().multiply4(Ae.scale(o.getScale(),o.getScale(),1))),a=this.spacing10*e,l=this.spacing10*e,c=s.x%a,h=s.y%l;return Ae.scale(e*this.ratio*this.scale,e*this.ratio*this.scale,1).translate1(c,h,0).multiply4(o.getProjectMatrix().multiply4(Ae.scale(1/o.getScale(),1/o.getScale(),1))).data}render(o,t,e,r){this.origin=this.scene.gridProgram.origin,this.desc.colorAttachments[0].view=o;let i=t.getScreenPosition();this.scene.updateCameraBuf(t,Number.NEGATIVE_INFINITY);let n=this.scene.getColorIndex(r,void 0,!0);this.updateStrings(t,n);{this.scene.addData(new Uint32Array(new Float32Array(t.getProjectMatrix().multiply4(Ae.scale(1/t.getScale(),1/t.getScale(),1)).data.concat(e.r,e.g,e.b,e.alpha,r.r,r.g,r.b,r.alpha,i.x,i.y)).buffer),this.backgroundUniformsBuf);let s=this.scene.commandEncoder.beginRenderPass(this.desc);s.setPipeline(this.backgroundPipeline),s.setBindGroup(0,this.backgroundBindGroup),s.setVertexBuffer(0,this.backgroundPosBuf.getBuffer()),s.draw(this.backgroundArrayCount),s.end()}{this.scene.addData(new Uint32Array(new Float32Array(this.autoScale(t).concat(r.r,r.g,r.b,r.alpha)).buffer),this.scaleUniformsBuf);let s=this.scene.commandEncoder.beginRenderPass(this.desc);s.setPipeline(this.scalePipeline),s.setBindGroup(0,this.scaleBindGroup.getBindGroup()),s.setVertexBuffer(0,this.scalePosBuf.getBuffer()),s.draw(this.scaleArrayCount),s.end()}this.scene.renderPtProgram.drawString(o,t,this.strPlane,this.builder,this.bindGroup);{this.scene.addData(new Uint32Array(new Float32Array([e.r,e.g,e.b,e.alpha].concat([2/t.getWidth(),2/t.getHeight()])).buffer),this.rulerMaskUniformsBuf);let s=this.scene.commandEncoder.beginRenderPass(this.desc);s.setPipeline(this.rulerMaskPipeline),s.setBindGroup(0,this.rulerMaskBindGroup.getBindGroup()),s.setVertexBuffer(0,this.rulerMaskPosBuf.getBuffer()),s.draw(6),s.end()}}updateStrings(o,t){this.builder.clear();let e=o.getScale(),r=1-18/o.getWidth(),i=1-18/o.getHeight();this.size=15/e;let n=o.getRenderMatrix().inverse(),s=new S(-1,-1).multiply4(n),a=new S(1,1).multiply4(n);this.scene.gridParam.flip&&(s=new S(1,-1).multiply4(n),a=new S(-1,1).multiply4(n)),s=s.sub(this.origin),a=a.sub(this.origin);let l=0,c=e;for(;;)if(c>=1){if(c=c/10,c<1)break;l++}else if(c=c*10,l--,c>=1)break;let h=e/Math.pow(10,l);h>=1&&h<2?e=Math.pow(10,l):h>=2&&h<5?e=2*Math.pow(10,l):e=5*Math.pow(10,l),e=e>500?500:e;let u=this.spacing10/e,d=this.unitConversion.conversion1("mil",this.unit,this.spacing10);d=d/e;let p=Math.max(Math.abs(Math.ceil(s.y/u)),Math.abs(Math.ceil(s.x/u)))*-1*d*10;p=Math.round(p*1e3)/1e3;let m=F_.getStrInfo(p.toString(),1e10,this.size).strWidth*.9;u<m?(this.ratioScale*=2,u*=2,this.endSpace*=2,this.centerSpace*=2,this.updateScaleData(this.width,this.height)):u/2>m&&this.ratioScale>1&&(this.ratioScale/=2,this.endSpace/=2,this.centerSpace/=2,this.updateScaleData(this.width,this.height));{let g=0,y=0,b=a.x;s.x>0&&(g=Math.ceil(s.x/u),y=g*u);for(let P=y,T=g;P<b;P+=u,T++){let I=new S(P+this.origin.x,0).multiply4(o.getRenderMatrix());this.fillVerticalStrings(I.x,i,d*T*10,n,t)}}{let g=Math.ceil(s.x/u);g>0&&(g=0);let y=g*u,b=a.x;b>0&&(b=0);for(let P=y,T=g;P<b;P+=u,T++){let I=new S(P+this.origin.x,0).multiply4(o.getRenderMatrix());this.fillVerticalStrings(I.x,i,d*T*10,n,t)}}{let g=0,y=0,b=a.y;s.y>0&&(g=Math.ceil(s.y/u),y=g*u);for(let P=y,T=g;P<b;P+=u,T++){let I=new S(0,P+this.origin.y).multiply4(o.getRenderMatrix());this.fillHorizontalStrings(-r,I.y,d*T*10,n,t)}}{let g=Math.ceil(s.y/u);g>0&&(g=0);let y=g*u,b=a.y;b>0&&(b=0);for(let P=y,T=g;P<b;P+=u,T++){let I=new S(0,P+this.origin.y).multiply4(o.getRenderMatrix());this.fillHorizontalStrings(-r,I.y,d*T*10,n,t)}}}fillHorizontalStrings(o,t,e,r,i){e=Math.round(e*1e3)/1e3;let n=new S(o,t).multiply4(r);this.createString(e.toString(),n,GT,5,13,1e10,this.size,i)}fillVerticalStrings(o,t,e,r,i){e=Math.round(e*1e3)/1e3;let n=new S(o,t).multiply4(r);this.createString(e.toString(),n,0,5,13,1e10,this.size,i)}createString(o,t,e,r,i,n,s,a){let l=this.scene.addStringInfo(o),{strWidth:c,strHeight:h}=F_.getStrInfo(o,n,s),u=J7.create(0,t,c*.9,h*.9,e,o.length,l,r,i,-1,a,void 0,.5);this.builder.pushArr(u)}},pnt="struct O_a { O_b : mat4x4 < f32 > , O_c : vec4 < f32 > , O_d : vec4 < f32 > , O_e : vec4 < f32 > , O_f : vec2 < f32 > , O_g : vec2 < f32 > , O_h : vec2 < f32 > , O_i : f32 , O_j : f32 , O_k : f32 , O_l : f32 , O_m : f32 , } @ group ( 0 ) @ binding ( 0 ) var < uniform > O_n : O_a ; struct O_o { @ builtin ( position ) O_p : vec4 < f32 > , @ location ( 0 ) O_q : vec4 < f32 > , @ location ( 1 ) O_r : f32 , } fn O_s ( O_t : f32 , ) -> bool { return abs ( O_t ) <= 0.0000001 ; } fn O_u ( O_v : f32 , O_w : f32 , ) -> f32 { return floor ( O_v - O_w * floor ( O_v / O_w ) ) ; } fn O_x ( O_y : f32 , O_z : f32 , ) -> bool { return O_s ( O_u ( round ( O_y / O_z ) , O_n . O_k ) ) ; } @ vertex fn vert ( @ location ( 0 ) O_aa : vec3 < f32 > , ) -> O_o { var O_ab : O_o ; var O_f = O_n . O_f ; var O_b = O_n . O_b ; var O_g = O_n . O_g ; var O_h = O_n . O_h ; var O_c = O_n . O_c ; var O_d = O_n . O_d ; var O_e = O_n . O_e ; var O_j = O_n . O_j ; var O_i = O_n . O_i ; var O_k = O_n . O_k ; var O_ac = O_aa ; var O_p = O_b * vec4 ( O_ac , 1.0 ) ; var O_ad = vec2 ( O_p . xy ) ; var O_ae = O_ad - O_h ; var O_af = false ; var O_ag = false ; var O_ah = O_g . x ; var O_ai = O_g . y ; if ( O_ae . x > 0.0 ) { O_ae . x = - O_ae . x ; } if ( O_ae . y > 0.0 ) { O_ae . y = - O_ae . y ; } if ( O_aa . z == 0.1 ) { O_af = O_s ( O_ae . x ) ; O_ag = O_x ( O_ae . x , O_ah ) ; } else if ( O_aa . z == 0.2 ) { O_af = O_s ( O_ae . y ) ; O_ag = O_x ( O_ae . y , O_ai ) ; } else { O_af = O_s ( O_ae . x ) || O_s ( O_ae . y ) ; O_ag = O_x ( O_ae . x , O_ah ) && O_x ( O_ae . y , O_ai ) ; } if ( O_n . O_m == 0 ) { O_af = false ; } if ( O_aa . z == 0.3 && O_af ) { return O_ab ; } if ( O_n . O_l != 0 ) { if ( O_j != 0.2 && O_j != 0.4 ) { return O_ab ; } if ( O_aa . z != 0.3 || ! O_ag || O_af ) { return O_ab ; } } var O_q : vec4 < f32 > ; var O_r : f32 = 2.0 ; if ( O_j == 0.1 || O_af ) { if ( ! O_af ) { return O_ab ; } O_q = O_e ; } else if ( O_j == 0.2 ) { if ( ! O_ag ) { return O_ab ; } O_q = O_d ; } else if ( O_j == 0.3 ) { O_q = O_c ; } else { if ( O_ag ) { O_q = O_d ; } else { O_q = O_c ; } } if ( O_i == 0.1 ) { O_r = 1.0 ; } O_ab . O_p = O_p ; O_ab . O_q = O_q ; O_ab . O_r = O_r ; return O_ab ; } @ fragment fn frag ( @ builtin ( position ) O_p : vec4 < f32 > , @ location ( 0 ) O_q : vec4 < f32 > , @ location ( 1 ) O_r : f32 , ) -> @ location ( 0 ) vec4 < f32 > { return vec4 ( O_q . xyz , O_q . w * O_r ) ; } ",fnt=class{constructor(o,t,e,r){this.vertexSize=3,this.u_origin=new S(0,0),this.templateGridScale=.1,this.scene=o;let i=o.gpu,n=i.device;this.color=new Float32Array([r.r,r.g,r.b,r.alpha]);let s=i.createShaderModule(pnt);this.desc={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]};let a=4,l=42,c=l%a,h=c==0?l:l+(a-c);this.gridUniformBuffer=i.createDynamicBuffer(h,GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"gridUniformBuffer of GridProgram"),this.gridLinePosBuffer=i.createDynamicBuffer(1,GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX,"gridLinePosBuffer of GridProgram"),this.gridPointPosBuffer=i.createDynamicBuffer(1,GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX,"gridPointPosBuffer of GridProgram"),this.gridLinePipeline=n.createRenderPipeline({layout:"auto",vertex:{module:s,entryPoint:"vert",buffers:[{arrayStride:3*rs,attributes:[{shaderLocation:0,offset:0,format:"float32x3"}]}]},fragment:{module:s,entryPoint:"frag",targets:[{format:_a,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"line-list"}}),this.gridLineBindGroup=i.createBindGroup("Grid Line",this.gridLinePipeline.getBindGroupLayout(0),0,this.gridUniformBuffer),this.gridPointPipeline=n.createRenderPipeline({layout:"auto",vertex:{module:s,entryPoint:"vert",buffers:[{arrayStride:3*rs,attributes:[{shaderLocation:0,offset:0,format:"float32x3"}]}]},fragment:{module:s,entryPoint:"frag",targets:[{format:_a,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"point-list"}}),this.gridPointBindGroup=i.createBindGroup("Grid Point",this.gridPointPipeline.getBindGroupLayout(0),0,this.gridUniformBuffer),this.resize(t,e),this.scene.gridParam.attach(this)}get visible(){return this.scene.gridParam.visible}set visible(o){this.scene.gridParam.visible=o}get origin(){return this.scene.getOrigin()}fillVertical(o,t,e,r){return o[r++]=t,o[r++]=-e,o[r++]=.1,o[r++]=t,o[r++]=e,o[r++]=.1,r}fillHorizontal(o,t,e,r){return o[r++]=-e,o[r++]=t,o[r++]=.2,o[r++]=e,o[r++]=t,o[r++]=.2,r}fillPoint(o,t,e,r){return o[r++]=t,o[r++]=e,o[r++]=.3,r}setGridX(o){o>0&&this.scene.gridParam.setGridX(o)}getGridX(){return this.scene.gridParam.getGridX()}setGridY(o){o>0&&this.scene.gridParam.setGridY(o)}getGridY(){return this.scene.gridParam.getGridY()}setSnapX(o){o>0&&this.scene.gridParam.setSnapX(o)}getSnapX(){return this.scene.gridParam.getSnapX()}setSnapY(o){o>0&&this.scene.gridParam.setSnapY(o)}getSnapY(){return this.scene.gridParam.getSnapY()}get pattern(){return this.scene.gridParam.pattern}modifyColor(o,t=o.alpha){this.color=this.colorData(o,t)}colorData(o,t=o.alpha){return new Float32Array([o.r,o.g,o.b,t])}getColor(){return ee.build(this.color[0],this.color[1],this.color[2])}resize(o,t){o===this.width&&t===this.height||(this.width=o,this.height=t,this.flush())}getRenderState(){let o=this.scene.gridParam,t=o.getMultiStyle(),e=!1,r=!1,i=!1,n=!1,s=!1;if(this.visible==0&&t==2)return{showCoor:e,showLine:r,showBoldLine:i,showPoint:n,showBoldPoint:s};e=!0;let a=this.visible==2;return r=a&&o.pattern,n=a&&!o.pattern,i=t==0,s=t==1,{showCoor:e,showLine:r,showBoldLine:i,showPoint:n,showBoldPoint:s}}flush(){let{showCoor:o,showLine:t,showBoldLine:e,showPoint:r,showBoldPoint:i}=this.getRenderState();if(!o)return;let n=new Array;this.lines(n),this.gridLinePosBuffer.setSize(n.length),this.gridLinePosBuffer.write(0,new Float32Array(n)),this.gridLineDrawCount=n.length/this.vertexSize;let s=new Array;this.points(s),this.gridPointPosBuffer.setSize(s.length),this.gridPointPosBuffer.write(0,new Float32Array(s)),this.gridPointDrawCount=s.length/this.vertexSize}lines(o){let t=0,e=this.templateGridScale,r=this.scene.gridParam,i=r.getGridX(),n=r.getGridY(),s=this.width*e*i,a=this.height*e*n;for(let l=0;l<s;l+=i)t=this.fillVertical(o,l,a,t);for(let l=-i;l>-s;l-=i)t=this.fillVertical(o,l,a,t);for(let l=0;l<a;l+=n)t=this.fillHorizontal(o,l,s,t);for(let l=-n;l>-a;l-=n)t=this.fillHorizontal(o,l,s,t)}points(o){let t=0,e=this.templateGridScale,r=this.scene.gridParam,i=r.getGridX(),n=r.getGridY(),s=this.width*e*i,a=this.height*e*n;for(let l=0;l<s;l+=i){for(let c=0;c<a;c+=n)t=this.fillPoint(o,l,c,t);for(let c=-n;c>-a;c-=n)t=this.fillPoint(o,l,c,t)}for(let l=-i;l>-s;l-=i){for(let c=0;c<a;c+=n)t=this.fillPoint(o,l,c,t);for(let c=-n;c>-a;c-=n)t=this.fillPoint(o,l,c,t)}}getListFromArray(o){let t=[];for(let e=0;e<o.length;e++)t[e]=o[e];return t}updateGridParam(o,t,e,r,i){t&&this.modifyColor(t),this.scene.gridParam.updateGridParam(o,e,r,i)}modifyModel(o){this.scene.gridParam.pattern=o}autoScale(o,t){let e=o.getScale(),r=this.scene.gridParam,i=r.getGridX(),n=r.getGridY(),s=parseInt(r.getMultiRatio().toString()),a=s,l=r.getMultiStyle(),c=Math.min(i,n),h=this.templateGridScale*c*2,u=1/(h*e),d=1;for(;u>d;)l==2?d=Math.ceil(u):(d=a>=u?a:a*Math.ceil(u/a),a=1);let p=i*a,m=n*a,g=Math.min(p,m),y=c*e,b=g*e,P=1,T=.5,I=1,C=1,E=2,O=20;if(d==1)P=X(Y(E,O,y),T,I),C=Y(E,O,b);else{let K=1/h,J=e/K;P=X(Y(E,O,c*K)*J,T,I),C=Y(E,O,g*(s/a)*K)*J,a==1&&(P=0)}let _=this.origin.x,x=this.origin.y,v=o.getPxLength();t==1?_+=v:t==2?x-=v:t==3&&(_+=v,x-=v);let D=Ae.scale(d,d,1).translate1(_,x,0).multiply4(o.getViewMatrix().multiply4(Ae.scale(o.getScale(),o.getScale(),1))),w=d*e,F=S.ORIGIN.multiply4(D),H=i*w,z=n*w,V=F.x-F.x%H,W=F.y-F.y%z,L=o.getProjectMatrix().multiply4(Ae.scale(1/o.getScale(),1/o.getScale(),1));this.u_origin=F.multiply4(L);let k=D.translate1(-V,-W,0).multiply4(L),N=S.ORIGIN.multiply4(k),U=new S(i,n).multiply4(k),B=Math.abs(U.x-N.x),G=Math.abs(U.y-N.y);return{matrix:k,deltaX:B,deltaY:G,multiRatio:a,gridAlphaRatio:P,multiGridAlphaRatio:C};function Y(K,J,se){return se<=K?0:se>=J?1:(se-K)/(J-K)}function X(K,J,se){return Math.max(J,Math.min(se,K))}}getRenderColor(o=1){let t=new Array;return this.color.forEach((e,r)=>{r==3&&(e*=o),t.push(e)}),new Float32Array(t)}render0(o,t,e){if(!this.gridLineDrawCount)return;let r=this.scene.gridParam.getMultiStyle();if(this.visible==0&&r==2)return;this.desc.colorAttachments[0].view=o;let i=this.getUniformData(t,e),n=this.getRenderState(),s=[];if(n.showBoldPoint||n.showPoint){i.u_viewState=[this.getViewState(n.showBoldPoint,n.showPoint)],i.u_mode=[.2],s.length=0;for(let a in i)s.push(...i[a]);this.setUniformData(s),this.drawPoints()}i.u_viewState=[this.getViewState(n.showBoldLine,n.showLine)],i.u_mode=[.1],s.length=0;for(let a in i)s.push(...i[a]);this.setUniformData(s),this.drawLines()}render(o,t){this.render0(o,t,0),(this.scene.gridParam.getMultiStyle()===1||q1.isCloseGridMulAcc())&&(this.render0(o,t,1),this.render0(o,t,2),this.render0(o,t,3))}getUniformData(o,t){let e=this.scene,r=this.scene.gridParam,{matrix:i,multiRatio:n,deltaX:s,deltaY:a,gridAlphaRatio:l,multiGridAlphaRatio:c}=this.autoScale(o,t);return{u_matrix:Array.from(i.data),u_gridColor:this.getListFromArray(this.getRenderColor(l)),u_boldColor:this.getListFromArray(this.colorData(r.multiGridColor,(1-r.multiTransparency)*c)),u_axisColor:this.getListFromArray(this.colorData(r.coordinateAxisColor,1-r.coordinateAxisTransparency)),u_antialias:[.5,e.isCoreGraphic()?0:1],u_deltaSize:[s,a],u_origin:[this.u_origin.x,this.u_origin.y],u_mode:[0],u_viewState:[0],u_gridSize:[n],currentRenderNumber:[t],renderCoordinateAxis:[e.gridParam.renderCoordinateAxis?1:0]}}getViewState(o,t){return o&&t?.4:o?.2:t?.3:.1}setUniformData(o){this.scene.addData(new Uint32Array(new Float32Array(o).buffer),this.gridUniformBuffer)}drawLines(){let o=this.scene.commandEncoder.beginRenderPass(this.desc);o.setPipeline(this.gridLinePipeline),o.setBindGroup(0,this.gridLineBindGroup),o.setVertexBuffer(0,this.gridLinePosBuffer.getBuffer()),o.draw(this.gridLineDrawCount),o.end()}drawPoints(){let o=this.scene.commandEncoder.beginRenderPass(this.desc);o.setPipeline(this.gridPointPipeline),o.setBindGroup(0,this.gridPointBindGroup),o.setVertexBuffer(0,this.gridPointPosBuffer.getBuffer()),o.draw(this.gridPointDrawCount),o.end()}},mnt="struct O_a { O_b : f32 , O_c : f32 , O_d : f32 , O_e : f32 , } struct O_f { O_g : mat4x4 < f32 > , O_h : vec2 < f32 > , O_i : vec4 < f32 > , O_j : O_a , O_k : vec2 < f32 > , O_l : vec4 < f32 > , } @ group ( 0 ) @ binding ( 0 ) var < uniform > O_m : O_f ; override MATH_PI : f32 ; struct O_n { @ builtin ( position ) O_o : vec4 < f32 > , @ location ( 0 ) O_p : vec2 < f32 > , } fn O_q ( O_r : bool , O_s : f32 , O_t : f32 , ) -> f32 { if ( O_r ) { return O_s ; } else { return O_t ; } } fn O_u ( O_s : f32 , O_t : f32 , ) -> f32 { return O_s - O_t * floor ( O_s / O_t ) ; } fn O_v ( O_w : f32 , ) -> vec2 < f32 > { if ( O_w == 0.5 ) { return vec2 ( 0.15 , 0.4 ) ; } else { return vec2 ( 0.3 , 0.8 ) ; } } fn O_x ( O_y : vec2 < f32 > , ) -> bool { let step = O_m . O_i [ 3 ] ; let O_z = length ( O_y ) - O_m . O_k . x - O_m . O_j . O_b ; let O_aa = O_u ( O_z , step ) ; let O_ab = O_u ( O_z + O_m . O_j . O_b , step ) ; if ( ( abs ( O_aa ) <= O_m . O_j . O_b || abs ( O_ab ) <= O_m . O_j . O_b ) ) { return true ; } else { return false ; } } fn O_ac ( O_y : vec2 < f32 > , ) -> bool { let O_ad = MATH_PI * 2.0 ; let O_z = length ( O_y ) ; let O_ae = atan2 ( O_m . O_j . O_b , O_z ) ; let O_af = O_u ( atan2 ( O_y . y , O_y . x ) + O_ad , O_ad ) ; let O_aa = O_u ( O_af - O_m . O_i [ 1 ] , O_m . O_i [ 0 ] ) ; let O_ab = O_u ( O_af - O_m . O_i [ 1 ] + O_ae , O_m . O_i [ 0 ] ) ; if ( abs ( O_aa ) <= O_ae || abs ( O_ab ) <= O_ae ) { return true ; } else { return false ; } } fn O_ag ( O_y : vec2 < f32 > , ) -> bool { let O_ad = MATH_PI * 2.0 ; let O_z = length ( O_y ) ; let O_ae = atan2 ( O_m . O_j . O_b , O_z ) ; let O_af = O_u ( atan2 ( O_y . y , O_y . x ) + O_ad , O_ad ) ; let O_aa = O_u ( O_af - O_m . O_i [ 1 ] , O_ad ) ; let O_ab = O_u ( O_af - O_m . O_i [ 2 ] , O_ad ) ; let O_ah = O_u ( O_af + O_ae - O_m . O_i [ 1 ] , O_ad ) ; let O_ai = O_u ( O_af + O_ae - O_m . O_i [ 2 ] , O_ad ) ; if ( abs ( O_aa ) <= O_ae || abs ( O_ab ) <= O_ae || abs ( O_ah ) <= O_ae || abs ( O_ai ) <= O_ae ) { return true ; } else { return false ; } } @ vertex fn vert ( @ location ( 0 ) O_aj : vec3 < f32 > , ) -> O_n { var O_ak : O_n ; O_ak . O_p = ( O_m . O_g * vec4 ( O_aj , 1.0 ) ) . xy - O_m . O_h ; O_ak . O_o = vec4 ( O_aj , 1.0 ) ; return O_ak ; } @ fragment fn frag ( @ builtin ( position ) O_o : vec4 < f32 > , @ location ( 0 ) O_p : vec2 < f32 > , ) -> @ location ( 0 ) vec4 < f32 > { let O_ad = MATH_PI * 2.0 ; let O_al = normalize ( O_p ) ; let O_am = vec2 ( cos ( O_m . O_i [ 1 ] ) , sin ( O_m . O_i [ 1 ] ) ) ; let O_an = vec2 ( cos ( O_m . O_i [ 2 ] ) , sin ( O_m . O_i [ 2 ] ) ) ; let O_ao = O_am . x * O_al . y - O_am . y * O_al . x ; let O_ap = O_an . x * O_al . y - O_an . y * O_al . x ; let O_af = O_m . O_j . O_c ; let O_z = length ( O_p ) ; if ( O_z < O_m . O_k . x - O_m . O_j . O_b || O_z > O_m . O_k . y + O_m . O_j . O_b ) { discard ; } else if ( ( O_af < MATH_PI && O_ao >= 0.0 && O_ap <= 0.0 ) || ( O_af >= MATH_PI && ( O_ao >= 0.0 || O_ap <= 0.0 ) ) || O_ag ( O_p ) ) { let O_aq = O_m . O_j . O_e ; let O_ar = O_v ( O_m . O_j . O_d ) ; if ( O_aq == 1.0 ) { if ( O_ac ( O_p ) ) { return vec4 ( O_m . O_l . xyz , O_ar . y ) ; } else if ( O_x ( O_p ) ) { return vec4 ( O_m . O_l . xyz , O_ar . x ) ; } else { discard ; } } else { if ( O_ac ( O_p ) && O_x ( O_p ) ) { return vec4 ( O_m . O_l . xyz , O_ar . y ) ; } else { discard ; } } } else { discard ; } return vec4 ( 0 ) ; } ",gnt=class{constructor(o,t,e,r){this.scene=o;let i=o.gpu,n=i.device;this.desc={colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]},this.polarUniformBuffer=i.createDynamicBuffer(36,GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM,"polarUniformBuffer of GridProgram"),this.polarPosBuffer=i.createStaticBuffer(new Uint32Array(new Float32Array([-1,-1,1,-1,1,1,1,1,-1,1,-1,-1]).buffer),GPUBufferUsage.VERTEX,"polarPosBuffer of RulerProgram"),this.polarDrawCount=this.polarPosBuffer.getSize()/2;let s=n.createShaderModule({code:mnt});this.polarPipeline=n.createRenderPipeline({layout:"auto",vertex:{module:s,entryPoint:"vert",buffers:[{arrayStride:2*rs,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]}]},fragment:{module:s,entryPoint:"frag",constants:{MATH_PI:Math.PI},targets:[{format:_a,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}}),this.polarBindGroup=i.createBindGroup("polar",this.polarPipeline.getBindGroupLayout(0),0,this.polarUniformBuffer)}get minRadius(){return this.scene.gridParam.minRadius}set minRadius(o){this.scene.gridParam.minRadius=o}get maxRadius(){return this.scene.gridParam.maxRadius}set maxRadius(o){this.scene.gridParam.maxRadius=o}get angleDelta(){return this.scene.gridParam.angleDelta}set angleDelta(o){this.scene.gridParam.angleDelta=o}get radius(){return this.scene.gridParam.radius}set radius(o){this.scene.gridParam.radius=o}get startAngle(){return this.scene.gridParam.startAngle}set startAngle(o){this.scene.gridParam.startAngle=o}get endAngle(){return this.scene.gridParam.endAngle}set endAngle(o){this.scene.gridParam.endAngle=o}get sweepAngle(){return this.scene.gridParam.sweepAngle}getListFromArray(o){let t=[];for(let e=0;e<o.length;e++)t[e]=o[e];return t}getPxRatio(o){let t=o.getWidth(),e=o.getHeight(),r=o.getRenderMatrix(),i=Dt.ORIGIN.multiply4(r);if(t>e){let n=new Dt(0,1,0).multiply4(r);return 2/e/i.sub(n).length()}else{let n=new Dt(1,0,0).multiply4(r);return 2/t/i.sub(n).length()}}getStep(o){let t=10,e=o.getPxLength(),r=this.scene.gridParam.radius/e;if(r<t)for(let i=0;;i++){let n=this.scene.gridParam.radius*Math.pow(5,i);if(r=n/e,!(r<t))return n}return this.scene.gridParam.radius}render(o,t){if(this.scene.gridProgram.visible!=2)return;let e=t.getRenderMatrix().inverse().data,r=this.scene.gridProgram.origin,i=[r.x,r.y],n=[this.scene.gridParam.angleDelta,this.startAngle,this.endAngle,this.getStep(t)],s=[t.getPxLength(),this.sweepAngle,this.scene.getAntialias()?1.5:.5,this.scene.gridProgram.pattern?1:2],a=[this.scene.gridParam.minRadius,this.scene.gridParam.maxRadius],l=this.getListFromArray(this.scene.gridProgram.getRenderColor()),c=new Float32Array(36);c.set(e,0),c.set(i,16),c.set(n,20),c.set(s,24),c.set(a,28),c.set(l,32),this.scene.addData(new Uint32Array(c.buffer),this.polarUniformBuffer),this.desc.colorAttachments[0].view=o;let h=this.scene.commandEncoder.beginRenderPass(this.desc);h.setPipeline(this.polarPipeline),h.setBindGroup(0,this.polarBindGroup),h.setVertexBuffer(0,this.polarPosBuffer.getBuffer()),h.draw(this.polarDrawCount),h.end()}},ynt=pRe(kRe()),lye=0,bnt=1,nxe=1,oxe=100,sxe=204,axe=205,lxe=0,cxe=1,hxe=2,WZ=3,uxe=4,dxe=5,pxe=6,fxe=7,Pnt=0,Nwe=300,Tnt=301,mxe=1e3,k_=1001,gxe=1002,G_=1003,z7=1006,kwe=1008,Int=1009,Cnt=1014,RZ=1015,XK=1016,Snt=1020,Ent=1023,s1e=1026,yxe=1027,zZ=2300,cye=2301,a1e=2302,bxe=2400,Pxe=2401,Txe=2402,Bwe="",xC="srgb",hye="srgb-linear",Ixe="linear",l1e="srgb",I7=7680,Cxe=519,Sxe=35044,Sw=2e3,uye=2001,aJ=class{addEventListener(o,t){this._listeners===void 0&&(this._listeners={});let e=this._listeners;e[o]===void 0&&(e[o]=[]),e[o].indexOf(t)===-1&&e[o].push(t)}hasEventListener(o,t){if(this._listeners===void 0)return!1;let e=this._listeners;return e[o]!==void 0&&e[o].indexOf(t)!==-1}removeEventListener(o,t){if(this._listeners===void 0)return;let e=this._listeners[o];if(e!==void 0){let r=e.indexOf(t);r!==-1&&e.splice(r,1)}}dispatchEvent(o){if(this._listeners===void 0)return;let t=this._listeners[o.type];if(t!==void 0){o.target=this;let e=t.slice(0);for(let r=0,i=e.length;r<i;r++)e[r].call(this,o);o.target=null}}},W1=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],Ont=Math.PI/180,p6t=180/Math.PI;function eN(){let o=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(W1[o&255]+W1[o>>8&255]+W1[o>>16&255]+W1[o>>24&255]+"-"+W1[t&255]+W1[t>>8&255]+"-"+W1[t>>16&15|64]+W1[t>>24&255]+"-"+W1[e&63|128]+W1[e>>8&255]+"-"+W1[e>>16&255]+W1[e>>24&255]+W1[r&255]+W1[r>>8&255]+W1[r>>16&255]+W1[r>>24&255]).toLowerCase()}function hl(o,t,e){return Math.max(t,Math.min(e,o))}function Ant(o,t){return(o%t+t)%t}function c1e(o,t,e){return(1-e)*o+e*t}function oH(o,t){switch(t.constructor){case Float32Array:return o;case Uint32Array:return o/4294967295;case Uint16Array:return o/65535;case Uint8Array:return o/255;case Int32Array:return Math.max(o/2147483647,-1);case Int16Array:return Math.max(o/32767,-1);case Int8Array:return Math.max(o/127,-1);default:throw new Error("Invalid component type.")}}function q2(o,t){switch(t.constructor){case Float32Array:return o;case Uint32Array:return Math.round(o*4294967295);case Uint16Array:return Math.round(o*65535);case Uint8Array:return Math.round(o*255);case Int32Array:return Math.round(o*2147483647);case Int16Array:return Math.round(o*32767);case Int8Array:return Math.round(o*127);default:throw new Error("Invalid component type.")}}var fn=class Fwe{constructor(t=0,e=0){Fwe.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,r=this.y,i=t.elements;return this.x=i[0]*e+i[3]*r+i[6],this.y=i[1]*e+i[4]*r+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=hl(this.x,t.x,e.x),this.y=hl(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=hl(this.x,t,e),this.y=hl(this.y,t,e),this}clampLength(t,e){let r=this.length();return this.divideScalar(r||1).multiplyScalar(hl(r,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let r=this.dot(t)/e;return Math.acos(hl(r,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,r=this.y-t.y;return e*e+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let r=Math.cos(e),i=Math.sin(e),n=this.x-t.x,s=this.y-t.y;return this.x=n*r-s*i+t.x,this.y=n*i+s*r+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Sl=class Vwe{constructor(t,e,r,i,n,s,a,l,c){Vwe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,r,i,n,s,a,l,c)}set(t,e,r,i,n,s,a,l,c){let h=this.elements;return h[0]=t,h[1]=i,h[2]=a,h[3]=e,h[4]=n,h[5]=l,h[6]=r,h[7]=s,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this}extractBasis(t,e,r){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let r=t.elements,i=e.elements,n=this.elements,s=r[0],a=r[3],l=r[6],c=r[1],h=r[4],u=r[7],d=r[2],p=r[5],m=r[8],g=i[0],y=i[3],b=i[6],P=i[1],T=i[4],I=i[7],C=i[2],E=i[5],O=i[8];return n[0]=s*g+a*P+l*C,n[3]=s*y+a*T+l*E,n[6]=s*b+a*I+l*O,n[1]=c*g+h*P+u*C,n[4]=c*y+h*T+u*E,n[7]=c*b+h*I+u*O,n[2]=d*g+p*P+m*C,n[5]=d*y+p*T+m*E,n[8]=d*b+p*I+m*O,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],r=t[1],i=t[2],n=t[3],s=t[4],a=t[5],l=t[6],c=t[7],h=t[8];return e*s*h-e*a*c-r*n*h+r*a*l+i*n*c-i*s*l}invert(){let t=this.elements,e=t[0],r=t[1],i=t[2],n=t[3],s=t[4],a=t[5],l=t[6],c=t[7],h=t[8],u=h*s-a*c,d=a*l-h*n,p=c*n-s*l,m=e*u+r*d+i*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);let g=1/m;return t[0]=u*g,t[1]=(i*c-h*r)*g,t[2]=(a*r-i*s)*g,t[3]=d*g,t[4]=(h*e-i*l)*g,t[5]=(i*n-a*e)*g,t[6]=p*g,t[7]=(r*l-c*e)*g,t[8]=(s*e-r*n)*g,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,r,i,n,s,a){let l=Math.cos(n),c=Math.sin(n);return this.set(r*l,r*c,-r*(l*s+c*a)+s+t,-i*c,i*l,-i*(-c*s+l*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(h1e.makeScale(t,e)),this}rotate(t){return this.premultiply(h1e.makeRotation(-t)),this}translate(t,e){return this.premultiply(h1e.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,r,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,r=t.elements;for(let i=0;i<9;i++)if(e[i]!==r[i])return!1;return!0}fromArray(t,e=0){for(let r=0;r<9;r++)this.elements[r]=t[r+e];return this}toArray(t=[],e=0){let r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t}clone(){return new this.constructor().fromArray(this.elements)}},h1e=new Sl;function _nt(o){for(let t=o.length-1;t>=0;--t)if(o[t]>=65535)return!0;return!1}function Exe(o){return document.createElementNS("http://www.w3.org/1999/xhtml",o)}var Oxe=new Sl().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Axe=new Sl().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function vnt(){let o={enabled:!0,workingColorSpace:hye,spaces:{},convert:function(i,n,s){return this.enabled===!1||n===s||!n||!s||(this.spaces[n].transfer===l1e&&(i.r=$E(i.r),i.g=$E(i.g),i.b=$E(i.b)),this.spaces[n].primaries!==this.spaces[s].primaries&&(i.applyMatrix3(this.spaces[n].toXYZ),i.applyMatrix3(this.spaces[s].fromXYZ)),this.spaces[s].transfer===l1e&&(i.r=Y7(i.r),i.g=Y7(i.g),i.b=Y7(i.b))),i},fromWorkingColorSpace:function(i,n){return this.convert(i,this.workingColorSpace,n)},toWorkingColorSpace:function(i,n){return this.convert(i,n,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Bwe?Ixe:this.spaces[i].transfer},getLuminanceCoefficients:function(i,n=this.workingColorSpace){return i.fromArray(this.spaces[n].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,n,s){return i.copy(this.spaces[n].toXYZ).multiply(this.spaces[s].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],r=[.3127,.329];return o.define({[hye]:{primaries:t,whitePoint:r,transfer:Ixe,toXYZ:Oxe,fromXYZ:Axe,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:xC},outputColorSpaceConfig:{drawingBufferColorSpace:xC}},[xC]:{primaries:t,whitePoint:r,transfer:l1e,toXYZ:Oxe,fromXYZ:Axe,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:xC}}}),o}var OC=vnt();function $E(o){return o<.04045?o*.0773993808:Math.pow(o*.9478672986+.0521327014,2.4)}function Y7(o){return o<.0031308?o*12.92:1.055*Math.pow(o,.41666)-.055}var C7,xnt=class{static getDataURL(o){if(/^data:/i.test(o.src)||typeof HTMLCanvasElement>"u")return o.src;let t;if(o instanceof HTMLCanvasElement)t=o;else{C7===void 0&&(C7=Exe("canvas")),C7.width=o.width,C7.height=o.height;let e=C7.getContext("2d");o instanceof ImageData?e.putImageData(o,0,0):e.drawImage(o,0,0,o.width,o.height),t=C7}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",o),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(o){if(typeof HTMLImageElement<"u"&&o instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&o instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&o instanceof ImageBitmap){let t=Exe("canvas");t.width=o.width,t.height=o.height;let e=t.getContext("2d");e.drawImage(o,0,0,o.width,o.height);let r=e.getImageData(0,0,o.width,o.height),i=r.data;for(let n=0;n<i.length;n++)i[n]=$E(i[n]/255)*255;return e.putImageData(r,0,0),t}else if(o.data){let t=o.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor($E(t[e]/255)*255):t[e]=$E(t[e]);return{data:t,width:o.width,height:o.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),o}},Rnt=0,Dnt=class{constructor(o=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Rnt++}),this.uuid=eN(),this.data=o,this.dataReady=!0,this.version=0}set needsUpdate(o){o===!0&&this.version++}toJSON(o){let t=o===void 0||typeof o=="string";if(!t&&o.images[this.uuid]!==void 0)return o.images[this.uuid];let e={uuid:this.uuid,url:""},r=this.data;if(r!==null){let i;if(Array.isArray(r)){i=[];for(let n=0,s=r.length;n<s;n++)r[n].isDataTexture?i.push(u1e(r[n].image)):i.push(u1e(r[n]))}else i=u1e(r);e.url=i}return t||(o.images[this.uuid]=e),e}};function u1e(o){return typeof HTMLImageElement<"u"&&o instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&o instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&o instanceof ImageBitmap?xnt.getDataURL(o):o.data?{data:Array.from(o.data),width:o.width,height:o.height,type:o.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var wnt=0,ZE=class DZ extends aJ{constructor(t=DZ.DEFAULT_IMAGE,e=DZ.DEFAULT_MAPPING,r=k_,i=k_,n=z7,s=kwe,a=Ent,l=Int,c=DZ.DEFAULT_ANISOTROPY,h=Bwe){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:wnt++}),this.uuid=eN(),this.name="",this.source=new Dnt(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=n,this.minFilter=s,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new fn(0,0),this.repeat=new fn(1,1),this.center=new fn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Sl,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let r={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(r.userData=this.userData),e||(t.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Nwe)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case mxe:t.x=t.x-Math.floor(t.x);break;case k_:t.x=t.x<0?0:1;break;case gxe:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case mxe:t.y=t.y-Math.floor(t.y);break;case k_:t.y=t.y<0?0:1;break;case gxe:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}};ZE.DEFAULT_IMAGE=null;ZE.DEFAULT_MAPPING=Nwe;ZE.DEFAULT_ANISOTROPY=1;var BH=class Gwe{constructor(t=0,e=0,r=0,i=1){Gwe.prototype.isVector4=!0,this.x=t,this.y=e,this.z=r,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,r=this.y,i=this.z,n=this.w,s=t.elements;return this.x=s[0]*e+s[4]*r+s[8]*i+s[12]*n,this.y=s[1]*e+s[5]*r+s[9]*i+s[13]*n,this.z=s[2]*e+s[6]*r+s[10]*i+s[14]*n,this.w=s[3]*e+s[7]*r+s[11]*i+s[15]*n,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,r,i,n,s=t.elements,a=s[0],l=s[4],c=s[8],h=s[1],u=s[5],d=s[9],p=s[2],m=s[6],g=s[10];if(Math.abs(l-h)<.01&&Math.abs(c-p)<.01&&Math.abs(d-m)<.01){if(Math.abs(l+h)<.1&&Math.abs(c+p)<.1&&Math.abs(d+m)<.1&&Math.abs(a+u+g-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let b=(a+1)/2,P=(u+1)/2,T=(g+1)/2,I=(l+h)/4,C=(c+p)/4,E=(d+m)/4;return b>P&&b>T?b<.01?(r=0,i=.707106781,n=.707106781):(r=Math.sqrt(b),i=I/r,n=C/r):P>T?P<.01?(r=.707106781,i=0,n=.707106781):(i=Math.sqrt(P),r=I/i,n=E/i):T<.01?(r=.707106781,i=.707106781,n=0):(n=Math.sqrt(T),r=C/n,i=E/n),this.set(r,i,n,e),this}let y=Math.sqrt((m-d)*(m-d)+(c-p)*(c-p)+(h-l)*(h-l));return Math.abs(y)<.001&&(y=1),this.x=(m-d)/y,this.y=(c-p)/y,this.z=(h-l)/y,this.w=Math.acos((a+u+g-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=hl(this.x,t.x,e.x),this.y=hl(this.y,t.y,e.y),this.z=hl(this.z,t.z,e.z),this.w=hl(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=hl(this.x,t,e),this.y=hl(this.y,t,e),this.z=hl(this.z,t,e),this.w=hl(this.w,t,e),this}clampLength(t,e){let r=this.length();return this.divideScalar(r||1).multiplyScalar(hl(r,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this.w=t.w+(e.w-t.w)*r,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},Lnt=class extends ZE{constructor(o=null,t=1,e=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:o,width:t,height:e,depth:r},this.magFilter=G_,this.minFilter=G_,this.wrapR=k_,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(o){this.layerUpdates.add(o)}clearLayerUpdates(){this.layerUpdates.clear()}},Mnt=class extends ZE{constructor(o=null,t=1,e=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:o,width:t,height:e,depth:r},this.magFilter=G_,this.minFilter=G_,this.wrapR=k_,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},z_=class{constructor(o=0,t=0,e=0,r=1){this.isQuaternion=!0,this._x=o,this._y=t,this._z=e,this._w=r}static slerpFlat(o,t,e,r,i,n,s){let a=e[r+0],l=e[r+1],c=e[r+2],h=e[r+3],u=i[n+0],d=i[n+1],p=i[n+2],m=i[n+3];if(s===0){o[t+0]=a,o[t+1]=l,o[t+2]=c,o[t+3]=h;return}if(s===1){o[t+0]=u,o[t+1]=d,o[t+2]=p,o[t+3]=m;return}if(h!==m||a!==u||l!==d||c!==p){let g=1-s,y=a*u+l*d+c*p+h*m,b=y>=0?1:-1,P=1-y*y;if(P>Number.EPSILON){let I=Math.sqrt(P),C=Math.atan2(I,y*b);g=Math.sin(g*C)/I,s=Math.sin(s*C)/I}let T=s*b;if(a=a*g+u*T,l=l*g+d*T,c=c*g+p*T,h=h*g+m*T,g===1-s){let I=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=I,l*=I,c*=I,h*=I}}o[t]=a,o[t+1]=l,o[t+2]=c,o[t+3]=h}static multiplyQuaternionsFlat(o,t,e,r,i,n){let s=e[r],a=e[r+1],l=e[r+2],c=e[r+3],h=i[n],u=i[n+1],d=i[n+2],p=i[n+3];return o[t]=s*p+c*h+a*d-l*u,o[t+1]=a*p+c*u+l*h-s*d,o[t+2]=l*p+c*d+s*u-a*h,o[t+3]=c*p-s*h-a*u-l*d,o}get x(){return this._x}set x(o){this._x=o,this._onChangeCallback()}get y(){return this._y}set y(o){this._y=o,this._onChangeCallback()}get z(){return this._z}set z(o){this._z=o,this._onChangeCallback()}get w(){return this._w}set w(o){this._w=o,this._onChangeCallback()}set(o,t,e,r){return this._x=o,this._y=t,this._z=e,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(o){return this._x=o.x,this._y=o.y,this._z=o.z,this._w=o.w,this._onChangeCallback(),this}setFromEuler(o,t=!0){let e=o._x,r=o._y,i=o._z,n=o._order,s=Math.cos,a=Math.sin,l=s(e/2),c=s(r/2),h=s(i/2),u=a(e/2),d=a(r/2),p=a(i/2);switch(n){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+n)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(o,t){let e=t/2,r=Math.sin(e);return this._x=o.x*r,this._y=o.y*r,this._z=o.z*r,this._w=Math.cos(e),this._onChangeCallback(),this}setFromRotationMatrix(o){let t=o.elements,e=t[0],r=t[4],i=t[8],n=t[1],s=t[5],a=t[9],l=t[2],c=t[6],h=t[10],u=e+s+h;if(u>0){let d=.5/Math.sqrt(u+1);this._w=.25/d,this._x=(c-a)*d,this._y=(i-l)*d,this._z=(n-r)*d}else if(e>s&&e>h){let d=2*Math.sqrt(1+e-s-h);this._w=(c-a)/d,this._x=.25*d,this._y=(r+n)/d,this._z=(i+l)/d}else if(s>h){let d=2*Math.sqrt(1+s-e-h);this._w=(i-l)/d,this._x=(r+n)/d,this._y=.25*d,this._z=(a+c)/d}else{let d=2*Math.sqrt(1+h-e-s);this._w=(n-r)/d,this._x=(i+l)/d,this._y=(a+c)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(o,t){let e=o.dot(t)+1;return e<Number.EPSILON?(e=0,Math.abs(o.x)>Math.abs(o.z)?(this._x=-o.y,this._y=o.x,this._z=0,this._w=e):(this._x=0,this._y=-o.z,this._z=o.y,this._w=e)):(this._x=o.y*t.z-o.z*t.y,this._y=o.z*t.x-o.x*t.z,this._z=o.x*t.y-o.y*t.x,this._w=e),this.normalize()}angleTo(o){return 2*Math.acos(Math.abs(hl(this.dot(o),-1,1)))}rotateTowards(o,t){let e=this.angleTo(o);if(e===0)return this;let r=Math.min(1,t/e);return this.slerp(o,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(o){return this._x*o._x+this._y*o._y+this._z*o._z+this._w*o._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let o=this.length();return o===0?(this._x=0,this._y=0,this._z=0,this._w=1):(o=1/o,this._x=this._x*o,this._y=this._y*o,this._z=this._z*o,this._w=this._w*o),this._onChangeCallback(),this}multiply(o){return this.multiplyQuaternions(this,o)}premultiply(o){return this.multiplyQuaternions(o,this)}multiplyQuaternions(o,t){let e=o._x,r=o._y,i=o._z,n=o._w,s=t._x,a=t._y,l=t._z,c=t._w;return this._x=e*c+n*s+r*l-i*a,this._y=r*c+n*a+i*s-e*l,this._z=i*c+n*l+e*a-r*s,this._w=n*c-e*s-r*a-i*l,this._onChangeCallback(),this}slerp(o,t){if(t===0)return this;if(t===1)return this.copy(o);let e=this._x,r=this._y,i=this._z,n=this._w,s=n*o._w+e*o._x+r*o._y+i*o._z;if(s<0?(this._w=-o._w,this._x=-o._x,this._y=-o._y,this._z=-o._z,s=-s):this.copy(o),s>=1)return this._w=n,this._x=e,this._y=r,this._z=i,this;let a=1-s*s;if(a<=Number.EPSILON){let d=1-t;return this._w=d*n+t*this._w,this._x=d*e+t*this._x,this._y=d*r+t*this._y,this._z=d*i+t*this._z,this.normalize(),this}let l=Math.sqrt(a),c=Math.atan2(l,s),h=Math.sin((1-t)*c)/l,u=Math.sin(t*c)/l;return this._w=n*h+this._w*u,this._x=e*h+this._x*u,this._y=r*h+this._y*u,this._z=i*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(o,t,e){return this.copy(o).slerp(t,e)}random(){let o=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),e=Math.random(),r=Math.sqrt(1-e),i=Math.sqrt(e);return this.set(r*Math.sin(o),r*Math.cos(o),i*Math.sin(t),i*Math.cos(t))}equals(o){return o._x===this._x&&o._y===this._y&&o._z===this._z&&o._w===this._w}fromArray(o,t=0){return this._x=o[t],this._y=o[t+1],this._z=o[t+2],this._w=o[t+3],this._onChangeCallback(),this}toArray(o=[],t=0){return o[t]=this._x,o[t+1]=this._y,o[t+2]=this._z,o[t+3]=this._w,o}fromBufferAttribute(o,t){return this._x=o.getX(t),this._y=o.getY(t),this._z=o.getZ(t),this._w=o.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(o){return this._onChangeCallback=o,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},vt=class Uwe{constructor(t=0,e=0,r=0){Uwe.prototype.isVector3=!0,this.x=t,this.y=e,this.z=r}set(t,e,r){return r===void 0&&(r=this.z),this.x=t,this.y=e,this.z=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(_xe.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(_xe.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,r=this.y,i=this.z,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6]*i,this.y=n[1]*e+n[4]*r+n[7]*i,this.z=n[2]*e+n[5]*r+n[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,r=this.y,i=this.z,n=t.elements,s=1/(n[3]*e+n[7]*r+n[11]*i+n[15]);return this.x=(n[0]*e+n[4]*r+n[8]*i+n[12])*s,this.y=(n[1]*e+n[5]*r+n[9]*i+n[13])*s,this.z=(n[2]*e+n[6]*r+n[10]*i+n[14])*s,this}applyQuaternion(t){let e=this.x,r=this.y,i=this.z,n=t.x,s=t.y,a=t.z,l=t.w,c=2*(s*i-a*r),h=2*(a*e-n*i),u=2*(n*r-s*e);return this.x=e+l*c+s*u-a*h,this.y=r+l*h+a*c-n*u,this.z=i+l*u+n*h-s*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,r=this.y,i=this.z,n=t.elements;return this.x=n[0]*e+n[4]*r+n[8]*i,this.y=n[1]*e+n[5]*r+n[9]*i,this.z=n[2]*e+n[6]*r+n[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=hl(this.x,t.x,e.x),this.y=hl(this.y,t.y,e.y),this.z=hl(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=hl(this.x,t,e),this.y=hl(this.y,t,e),this.z=hl(this.z,t,e),this}clampLength(t,e){let r=this.length();return this.divideScalar(r||1).multiplyScalar(hl(r,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let r=t.x,i=t.y,n=t.z,s=e.x,a=e.y,l=e.z;return this.x=i*l-n*a,this.y=n*s-r*l,this.z=r*a-i*s,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let r=t.dot(this)/e;return this.copy(t).multiplyScalar(r)}projectOnPlane(t){return d1e.copy(this).projectOnVector(t),this.sub(d1e)}reflect(t){return this.sub(d1e.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let r=this.dot(t)/e;return Math.acos(hl(r,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,r){let i=Math.sin(e)*t;return this.x=i*Math.sin(r),this.y=Math.cos(e)*t,this.z=i*Math.cos(r),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,r){return this.x=t*Math.sin(e),this.y=r,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),r=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=r,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,r=Math.sqrt(1-e*e);return this.x=r*Math.cos(t),this.y=e,this.z=r*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},d1e=new vt,_xe=new z_,Y_=class{constructor(o=new vt(1/0,1/0,1/0),t=new vt(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=o,this.max=t}set(o,t){return this.min.copy(o),this.max.copy(t),this}setFromArray(o){this.makeEmpty();for(let t=0,e=o.length;t<e;t+=3)this.expandByPoint(AC.fromArray(o,t));return this}setFromBufferAttribute(o){this.makeEmpty();for(let t=0,e=o.count;t<e;t++)this.expandByPoint(AC.fromBufferAttribute(o,t));return this}setFromPoints(o){this.makeEmpty();for(let t=0,e=o.length;t<e;t++)this.expandByPoint(o[t]);return this}setFromCenterAndSize(o,t){let e=AC.copy(t).multiplyScalar(.5);return this.min.copy(o).sub(e),this.max.copy(o).add(e),this}setFromObject(o,t=!1){return this.makeEmpty(),this.expandByObject(o,t)}clone(){return new this.constructor().copy(this)}copy(o){return this.min.copy(o.min),this.max.copy(o.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(o){return this.isEmpty()?o.set(0,0,0):o.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(o){return this.isEmpty()?o.set(0,0,0):o.subVectors(this.max,this.min)}expandByPoint(o){return this.min.min(o),this.max.max(o),this}expandByVector(o){return this.min.sub(o),this.max.add(o),this}expandByScalar(o){return this.min.addScalar(-o),this.max.addScalar(o),this}expandByObject(o,t=!1){o.updateWorldMatrix(!1,!1);let e=o.geometry;if(e!==void 0){let i=e.getAttribute("position");if(t===!0&&i!==void 0&&o.isInstancedMesh!==!0)for(let n=0,s=i.count;n<s;n++)o.isMesh===!0?o.getVertexPosition(n,AC):AC.fromBufferAttribute(i,n),AC.applyMatrix4(o.matrixWorld),this.expandByPoint(AC);else o.boundingBox!==void 0?(o.boundingBox===null&&o.computeBoundingBox(),qK.copy(o.boundingBox)):(e.boundingBox===null&&e.computeBoundingBox(),qK.copy(e.boundingBox)),qK.applyMatrix4(o.matrixWorld),this.union(qK)}let r=o.children;for(let i=0,n=r.length;i<n;i++)this.expandByObject(r[i],t);return this}containsPoint(o){return o.x>=this.min.x&&o.x<=this.max.x&&o.y>=this.min.y&&o.y<=this.max.y&&o.z>=this.min.z&&o.z<=this.max.z}containsBox(o){return this.min.x<=o.min.x&&o.max.x<=this.max.x&&this.min.y<=o.min.y&&o.max.y<=this.max.y&&this.min.z<=o.min.z&&o.max.z<=this.max.z}getParameter(o,t){return t.set((o.x-this.min.x)/(this.max.x-this.min.x),(o.y-this.min.y)/(this.max.y-this.min.y),(o.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(o){return o.max.x>=this.min.x&&o.min.x<=this.max.x&&o.max.y>=this.min.y&&o.min.y<=this.max.y&&o.max.z>=this.min.z&&o.min.z<=this.max.z}intersectsSphere(o){return this.clampPoint(o.center,AC),AC.distanceToSquared(o.center)<=o.radius*o.radius}intersectsPlane(o){let t,e;return o.normal.x>0?(t=o.normal.x*this.min.x,e=o.normal.x*this.max.x):(t=o.normal.x*this.max.x,e=o.normal.x*this.min.x),o.normal.y>0?(t+=o.normal.y*this.min.y,e+=o.normal.y*this.max.y):(t+=o.normal.y*this.max.y,e+=o.normal.y*this.min.y),o.normal.z>0?(t+=o.normal.z*this.min.z,e+=o.normal.z*this.max.z):(t+=o.normal.z*this.max.z,e+=o.normal.z*this.min.z),t<=-o.constant&&e>=-o.constant}intersectsTriangle(o){if(this.isEmpty())return!1;this.getCenter(sH),$K.subVectors(this.max,sH),S7.subVectors(o.a,sH),E7.subVectors(o.b,sH),O7.subVectors(o.c,sH),O_.subVectors(E7,S7),A_.subVectors(O7,E7),dw.subVectors(S7,O7);let t=[0,-O_.z,O_.y,0,-A_.z,A_.y,0,-dw.z,dw.y,O_.z,0,-O_.x,A_.z,0,-A_.x,dw.z,0,-dw.x,-O_.y,O_.x,0,-A_.y,A_.x,0,-dw.y,dw.x,0];return!p1e(t,S7,E7,O7,$K)||(t=[1,0,0,0,1,0,0,0,1],!p1e(t,S7,E7,O7,$K))?!1:(KK.crossVectors(O_,A_),t=[KK.x,KK.y,KK.z],p1e(t,S7,E7,O7,$K))}clampPoint(o,t){return t.copy(o).clamp(this.min,this.max)}distanceToPoint(o){return this.clampPoint(o,AC).distanceTo(o)}getBoundingSphere(o){return this.isEmpty()?o.makeEmpty():(this.getCenter(o.center),o.radius=this.getSize(AC).length()*.5),o}intersect(o){return this.min.max(o.min),this.max.min(o.max),this.isEmpty()&&this.makeEmpty(),this}union(o){return this.min.min(o.min),this.max.max(o.max),this}applyMatrix4(o){return this.isEmpty()?this:(VE[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(o),VE[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(o),VE[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(o),VE[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(o),VE[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(o),VE[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(o),VE[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(o),VE[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(o),this.setFromPoints(VE),this)}translate(o){return this.min.add(o),this.max.add(o),this}equals(o){return o.min.equals(this.min)&&o.max.equals(this.max)}},VE=[new vt,new vt,new vt,new vt,new vt,new vt,new vt,new vt],AC=new vt,qK=new Y_,S7=new vt,E7=new vt,O7=new vt,O_=new vt,A_=new vt,dw=new vt,sH=new vt,$K=new vt,KK=new vt,pw=new vt;function p1e(o,t,e,r,i){for(let n=0,s=o.length-3;n<=s;n+=3){pw.fromArray(o,n);let a=i.x*Math.abs(pw.x)+i.y*Math.abs(pw.y)+i.z*Math.abs(pw.z),l=t.dot(pw),c=e.dot(pw),h=r.dot(pw);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>a)return!1}return!0}var Nnt=new Y_,aH=new vt,f1e=new vt,j_=class{constructor(o=new vt,t=-1){this.isSphere=!0,this.center=o,this.radius=t}set(o,t){return this.center.copy(o),this.radius=t,this}setFromPoints(o,t){let e=this.center;t!==void 0?e.copy(t):Nnt.setFromPoints(o).getCenter(e);let r=0;for(let i=0,n=o.length;i<n;i++)r=Math.max(r,e.distanceToSquared(o[i]));return this.radius=Math.sqrt(r),this}copy(o){return this.center.copy(o.center),this.radius=o.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(o){return o.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(o){return o.distanceTo(this.center)-this.radius}intersectsSphere(o){let t=this.radius+o.radius;return o.center.distanceToSquared(this.center)<=t*t}intersectsBox(o){return o.intersectsSphere(this)}intersectsPlane(o){return Math.abs(o.distanceToPoint(this.center))<=this.radius}clampPoint(o,t){let e=this.center.distanceToSquared(o);return t.copy(o),e>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(o){return this.isEmpty()?(o.makeEmpty(),o):(o.set(this.center,this.center),o.expandByScalar(this.radius),o)}applyMatrix4(o){return this.center.applyMatrix4(o),this.radius=this.radius*o.getMaxScaleOnAxis(),this}translate(o){return this.center.add(o),this}expandByPoint(o){if(this.isEmpty())return this.center.copy(o),this.radius=0,this;aH.subVectors(o,this.center);let t=aH.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),r=(e-this.radius)*.5;this.center.addScaledVector(aH,r/e),this.radius+=r}return this}union(o){return o.isEmpty()?this:this.isEmpty()?(this.copy(o),this):(this.center.equals(o.center)===!0?this.radius=Math.max(this.radius,o.radius):(f1e.subVectors(o.center,this.center).setLength(o.radius),this.expandByPoint(aH.copy(o.center).add(f1e)),this.expandByPoint(aH.copy(o.center).sub(f1e))),this)}equals(o){return o.center.equals(this.center)&&o.radius===this.radius}clone(){return new this.constructor().copy(this)}},GE=new vt,m1e=new vt,ZK=new vt,__=new vt,g1e=new vt,JK=new vt,y1e=new vt,lJ=class{constructor(o=new vt,t=new vt(0,0,-1)){this.origin=o,this.direction=t}set(o,t){return this.origin.copy(o),this.direction.copy(t),this}copy(o){return this.origin.copy(o.origin),this.direction.copy(o.direction),this}at(o,t){return t.copy(this.origin).addScaledVector(this.direction,o)}lookAt(o){return this.direction.copy(o).sub(this.origin).normalize(),this}recast(o){return this.origin.copy(this.at(o,GE)),this}closestPointToPoint(o,t){t.subVectors(o,this.origin);let e=t.dot(this.direction);return e<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,e)}distanceToPoint(o){return Math.sqrt(this.distanceSqToPoint(o))}distanceSqToPoint(o){let t=GE.subVectors(o,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(o):(GE.copy(this.origin).addScaledVector(this.direction,t),GE.distanceToSquared(o))}distanceSqToSegment(o,t,e,r){m1e.copy(o).add(t).multiplyScalar(.5),ZK.copy(t).sub(o).normalize(),__.copy(this.origin).sub(m1e);let i=o.distanceTo(t)*.5,n=-this.direction.dot(ZK),s=__.dot(this.direction),a=-__.dot(ZK),l=__.lengthSq(),c=Math.abs(1-n*n),h,u,d,p;if(c>0)if(h=n*a-s,u=n*s-a,p=i*c,h>=0)if(u>=-p)if(u<=p){let m=1/c;h*=m,u*=m,d=h*(h+n*u+2*s)+u*(n*h+u+2*a)+l}else u=i,h=Math.max(0,-(n*u+s)),d=-h*h+u*(u+2*a)+l;else u=-i,h=Math.max(0,-(n*u+s)),d=-h*h+u*(u+2*a)+l;else u<=-p?(h=Math.max(0,-(-n*i+s)),u=h>0?-i:Math.min(Math.max(-i,-a),i),d=-h*h+u*(u+2*a)+l):u<=p?(h=0,u=Math.min(Math.max(-i,-a),i),d=u*(u+2*a)+l):(h=Math.max(0,-(n*i+s)),u=h>0?i:Math.min(Math.max(-i,-a),i),d=-h*h+u*(u+2*a)+l);else u=n>0?-i:i,h=Math.max(0,-(n*u+s)),d=-h*h+u*(u+2*a)+l;return e&&e.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(m1e).addScaledVector(ZK,u),d}intersectSphere(o,t){GE.subVectors(o.center,this.origin);let e=GE.dot(this.direction),r=GE.dot(GE)-e*e,i=o.radius*o.radius;if(r>i)return null;let n=Math.sqrt(i-r),s=e-n,a=e+n;return a<0?null:s<0?this.at(a,t):this.at(s,t)}intersectsSphere(o){return this.distanceSqToPoint(o.center)<=o.radius*o.radius}distanceToPlane(o){let t=o.normal.dot(this.direction);if(t===0)return o.distanceToPoint(this.origin)===0?0:null;let e=-(this.origin.dot(o.normal)+o.constant)/t;return e>=0?e:null}intersectPlane(o,t){let e=this.distanceToPlane(o);return e===null?null:this.at(e,t)}intersectsPlane(o){let t=o.distanceToPoint(this.origin);return t===0||o.normal.dot(this.direction)*t<0}intersectBox(o,t){let e,r,i,n,s,a,l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(e=(o.min.x-u.x)*l,r=(o.max.x-u.x)*l):(e=(o.max.x-u.x)*l,r=(o.min.x-u.x)*l),c>=0?(i=(o.min.y-u.y)*c,n=(o.max.y-u.y)*c):(i=(o.max.y-u.y)*c,n=(o.min.y-u.y)*c),e>n||i>r||((i>e||isNaN(e))&&(e=i),(n<r||isNaN(r))&&(r=n),h>=0?(s=(o.min.z-u.z)*h,a=(o.max.z-u.z)*h):(s=(o.max.z-u.z)*h,a=(o.min.z-u.z)*h),e>a||s>r)||((s>e||e!==e)&&(e=s),(a<r||r!==r)&&(r=a),r<0)?null:this.at(e>=0?e:r,t)}intersectsBox(o){return this.intersectBox(o,GE)!==null}intersectTriangle(o,t,e,r,i){g1e.subVectors(t,o),JK.subVectors(e,o),y1e.crossVectors(g1e,JK);let n=this.direction.dot(y1e),s;if(n>0){if(r)return null;s=1}else if(n<0)s=-1,n=-n;else return null;__.subVectors(this.origin,o);let a=s*this.direction.dot(JK.crossVectors(__,JK));if(a<0)return null;let l=s*this.direction.dot(g1e.cross(__));if(l<0||a+l>n)return null;let c=-s*__.dot(y1e);return c<0?null:this.at(c/n,i)}applyMatrix4(o){return this.origin.applyMatrix4(o),this.direction.transformDirection(o),this}equals(o){return o.origin.equals(this.origin)&&o.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Wc=class dye{constructor(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y){dye.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y)}set(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y){let b=this.elements;return b[0]=t,b[4]=e,b[8]=r,b[12]=i,b[1]=n,b[5]=s,b[9]=a,b[13]=l,b[2]=c,b[6]=h,b[10]=u,b[14]=d,b[3]=p,b[7]=m,b[11]=g,b[15]=y,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new dye().fromArray(this.elements)}copy(t){let e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],this}copyPosition(t){let e=this.elements,r=t.elements;return e[12]=r[12],e[13]=r[13],e[14]=r[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,r){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(t,e,r){return this.set(t.x,e.x,r.x,0,t.y,e.y,r.y,0,t.z,e.z,r.z,0,0,0,0,1),this}extractRotation(t){let e=this.elements,r=t.elements,i=1/A7.setFromMatrixColumn(t,0).length(),n=1/A7.setFromMatrixColumn(t,1).length(),s=1/A7.setFromMatrixColumn(t,2).length();return e[0]=r[0]*i,e[1]=r[1]*i,e[2]=r[2]*i,e[3]=0,e[4]=r[4]*n,e[5]=r[5]*n,e[6]=r[6]*n,e[7]=0,e[8]=r[8]*s,e[9]=r[9]*s,e[10]=r[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,r=t.x,i=t.y,n=t.z,s=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),h=Math.cos(n),u=Math.sin(n);if(t.order==="XYZ"){let d=s*h,p=s*u,m=a*h,g=a*u;e[0]=l*h,e[4]=-l*u,e[8]=c,e[1]=p+m*c,e[5]=d-g*c,e[9]=-a*l,e[2]=g-d*c,e[6]=m+p*c,e[10]=s*l}else if(t.order==="YXZ"){let d=l*h,p=l*u,m=c*h,g=c*u;e[0]=d+g*a,e[4]=m*a-p,e[8]=s*c,e[1]=s*u,e[5]=s*h,e[9]=-a,e[2]=p*a-m,e[6]=g+d*a,e[10]=s*l}else if(t.order==="ZXY"){let d=l*h,p=l*u,m=c*h,g=c*u;e[0]=d-g*a,e[4]=-s*u,e[8]=m+p*a,e[1]=p+m*a,e[5]=s*h,e[9]=g-d*a,e[2]=-s*c,e[6]=a,e[10]=s*l}else if(t.order==="ZYX"){let d=s*h,p=s*u,m=a*h,g=a*u;e[0]=l*h,e[4]=m*c-p,e[8]=d*c+g,e[1]=l*u,e[5]=g*c+d,e[9]=p*c-m,e[2]=-c,e[6]=a*l,e[10]=s*l}else if(t.order==="YZX"){let d=s*l,p=s*c,m=a*l,g=a*c;e[0]=l*h,e[4]=g-d*u,e[8]=m*u+p,e[1]=u,e[5]=s*h,e[9]=-a*h,e[2]=-c*h,e[6]=p*u+m,e[10]=d-g*u}else if(t.order==="XZY"){let d=s*l,p=s*c,m=a*l,g=a*c;e[0]=l*h,e[4]=-u,e[8]=c*h,e[1]=d*u+g,e[5]=s*h,e[9]=p*u-m,e[2]=m*u-p,e[6]=a*h,e[10]=g*u+d}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(knt,t,Bnt)}lookAt(t,e,r){let i=this.elements;return uP.subVectors(t,e),uP.lengthSq()===0&&(uP.z=1),uP.normalize(),v_.crossVectors(r,uP),v_.lengthSq()===0&&(Math.abs(r.z)===1?uP.x+=1e-4:uP.z+=1e-4,uP.normalize(),v_.crossVectors(r,uP)),v_.normalize(),QK.crossVectors(uP,v_),i[0]=v_.x,i[4]=QK.x,i[8]=uP.x,i[1]=v_.y,i[5]=QK.y,i[9]=uP.y,i[2]=v_.z,i[6]=QK.z,i[10]=uP.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let r=t.elements,i=e.elements,n=this.elements,s=r[0],a=r[4],l=r[8],c=r[12],h=r[1],u=r[5],d=r[9],p=r[13],m=r[2],g=r[6],y=r[10],b=r[14],P=r[3],T=r[7],I=r[11],C=r[15],E=i[0],O=i[4],_=i[8],x=i[12],v=i[1],D=i[5],w=i[9],F=i[13],H=i[2],z=i[6],V=i[10],W=i[14],L=i[3],k=i[7],N=i[11],U=i[15];return n[0]=s*E+a*v+l*H+c*L,n[4]=s*O+a*D+l*z+c*k,n[8]=s*_+a*w+l*V+c*N,n[12]=s*x+a*F+l*W+c*U,n[1]=h*E+u*v+d*H+p*L,n[5]=h*O+u*D+d*z+p*k,n[9]=h*_+u*w+d*V+p*N,n[13]=h*x+u*F+d*W+p*U,n[2]=m*E+g*v+y*H+b*L,n[6]=m*O+g*D+y*z+b*k,n[10]=m*_+g*w+y*V+b*N,n[14]=m*x+g*F+y*W+b*U,n[3]=P*E+T*v+I*H+C*L,n[7]=P*O+T*D+I*z+C*k,n[11]=P*_+T*w+I*V+C*N,n[15]=P*x+T*F+I*W+C*U,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],r=t[4],i=t[8],n=t[12],s=t[1],a=t[5],l=t[9],c=t[13],h=t[2],u=t[6],d=t[10],p=t[14],m=t[3],g=t[7],y=t[11],b=t[15];return m*(+n*l*u-i*c*u-n*a*d+r*c*d+i*a*p-r*l*p)+g*(+e*l*p-e*c*d+n*s*d-i*s*p+i*c*h-n*l*h)+y*(+e*c*u-e*a*p-n*s*u+r*s*p+n*a*h-r*c*h)+b*(-i*a*h-e*l*u+e*a*d+i*s*u-r*s*d+r*l*h)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,r){let i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=r),this}invert(){let t=this.elements,e=t[0],r=t[1],i=t[2],n=t[3],s=t[4],a=t[5],l=t[6],c=t[7],h=t[8],u=t[9],d=t[10],p=t[11],m=t[12],g=t[13],y=t[14],b=t[15],P=u*y*c-g*d*c+g*l*p-a*y*p-u*l*b+a*d*b,T=m*d*c-h*y*c-m*l*p+s*y*p+h*l*b-s*d*b,I=h*g*c-m*u*c+m*a*p-s*g*p-h*a*b+s*u*b,C=m*u*l-h*g*l-m*a*d+s*g*d+h*a*y-s*u*y,E=e*P+r*T+i*I+n*C;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let O=1/E;return t[0]=P*O,t[1]=(g*d*n-u*y*n-g*i*p+r*y*p+u*i*b-r*d*b)*O,t[2]=(a*y*n-g*l*n+g*i*c-r*y*c-a*i*b+r*l*b)*O,t[3]=(u*l*n-a*d*n-u*i*c+r*d*c+a*i*p-r*l*p)*O,t[4]=T*O,t[5]=(h*y*n-m*d*n+m*i*p-e*y*p-h*i*b+e*d*b)*O,t[6]=(m*l*n-s*y*n-m*i*c+e*y*c+s*i*b-e*l*b)*O,t[7]=(s*d*n-h*l*n+h*i*c-e*d*c-s*i*p+e*l*p)*O,t[8]=I*O,t[9]=(m*u*n-h*g*n-m*r*p+e*g*p+h*r*b-e*u*b)*O,t[10]=(s*g*n-m*a*n+m*r*c-e*g*c-s*r*b+e*a*b)*O,t[11]=(h*a*n-s*u*n-h*r*c+e*u*c+s*r*p-e*a*p)*O,t[12]=C*O,t[13]=(h*g*i-m*u*i+m*r*d-e*g*d-h*r*y+e*u*y)*O,t[14]=(m*a*i-s*g*i-m*r*l+e*g*l+s*r*y-e*a*y)*O,t[15]=(s*u*i-h*a*i+h*r*l-e*u*l-s*r*d+e*a*d)*O,this}scale(t){let e=this.elements,r=t.x,i=t.y,n=t.z;return e[0]*=r,e[4]*=i,e[8]*=n,e[1]*=r,e[5]*=i,e[9]*=n,e[2]*=r,e[6]*=i,e[10]*=n,e[3]*=r,e[7]*=i,e[11]*=n,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],r=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,r,i))}makeTranslation(t,e,r){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,r,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),r=Math.sin(t);return this.set(1,0,0,0,0,e,-r,0,0,r,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),r=Math.sin(t);return this.set(e,0,r,0,0,1,0,0,-r,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,0,r,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let r=Math.cos(e),i=Math.sin(e),n=1-r,s=t.x,a=t.y,l=t.z,c=n*s,h=n*a;return this.set(c*s+r,c*a-i*l,c*l+i*a,0,c*a+i*l,h*a+r,h*l-i*s,0,c*l-i*a,h*l+i*s,n*l*l+r,0,0,0,0,1),this}makeScale(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1),this}makeShear(t,e,r,i,n,s){return this.set(1,r,n,0,t,1,s,0,e,i,1,0,0,0,0,1),this}compose(t,e,r){let i=this.elements,n=e._x,s=e._y,a=e._z,l=e._w,c=n+n,h=s+s,u=a+a,d=n*c,p=n*h,m=n*u,g=s*h,y=s*u,b=a*u,P=l*c,T=l*h,I=l*u,C=r.x,E=r.y,O=r.z;return i[0]=(1-(g+b))*C,i[1]=(p+I)*C,i[2]=(m-T)*C,i[3]=0,i[4]=(p-I)*E,i[5]=(1-(d+b))*E,i[6]=(y+P)*E,i[7]=0,i[8]=(m+T)*O,i[9]=(y-P)*O,i[10]=(1-(d+g))*O,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,r){let i=this.elements,n=A7.set(i[0],i[1],i[2]).length(),s=A7.set(i[4],i[5],i[6]).length(),a=A7.set(i[8],i[9],i[10]).length();this.determinant()<0&&(n=-n),t.x=i[12],t.y=i[13],t.z=i[14],_C.copy(this);let l=1/n,c=1/s,h=1/a;return _C.elements[0]*=l,_C.elements[1]*=l,_C.elements[2]*=l,_C.elements[4]*=c,_C.elements[5]*=c,_C.elements[6]*=c,_C.elements[8]*=h,_C.elements[9]*=h,_C.elements[10]*=h,e.setFromRotationMatrix(_C),r.x=n,r.y=s,r.z=a,this}makePerspective(t,e,r,i,n,s,a=Sw){let l=this.elements,c=2*n/(e-t),h=2*n/(r-i),u=(e+t)/(e-t),d=(r+i)/(r-i),p,m;if(a===Sw)p=-(s+n)/(s-n),m=-2*s*n/(s-n);else if(a===uye)p=-s/(s-n),m=-s*n/(s-n);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=h,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,e,r,i,n,s,a=Sw){let l=this.elements,c=1/(e-t),h=1/(r-i),u=1/(s-n),d=(e+t)*c,p=(r+i)*h,m,g;if(a===Sw)m=(s+n)*u,g=-2*u;else if(a===uye)m=n*u,g=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=g,l[14]=-m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){let e=this.elements,r=t.elements;for(let i=0;i<16;i++)if(e[i]!==r[i])return!1;return!0}fromArray(t,e=0){for(let r=0;r<16;r++)this.elements[r]=t[r+e];return this}toArray(t=[],e=0){let r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15],t}},A7=new vt,_C=new Wc,knt=new vt(0,0,0),Bnt=new vt(1,1,1),v_=new vt,QK=new vt,uP=new vt,vxe=new Wc,xxe=new z_,FH=class Hwe{constructor(t=0,e=0,r=0,i=Hwe.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=r,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,r,i=this._order){return this._x=t,this._y=e,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,r=!0){let i=t.elements,n=i[0],s=i[4],a=i[8],l=i[1],c=i[5],h=i[9],u=i[2],d=i[6],p=i[10];switch(e){case"XYZ":this._y=Math.asin(hl(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-s,n)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-hl(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,n),this._z=0);break;case"ZXY":this._x=Math.asin(hl(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(l,n));break;case"ZYX":this._y=Math.asin(-hl(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,n)):(this._x=0,this._z=Math.atan2(-s,c));break;case"YZX":this._z=Math.asin(hl(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,n)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-hl(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,n)):(this._x=Math.atan2(-h,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,r===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,r){return vxe.makeRotationFromQuaternion(t),this.setFromRotationMatrix(vxe,e,r)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return xxe.setFromEuler(this),this.setFromQuaternion(xxe,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};FH.DEFAULT_ORDER="XYZ";var Fnt=class{constructor(){this.mask=1}set(o){this.mask=(1<<o|0)>>>0}enable(o){this.mask|=1<<o|0}enableAll(){this.mask=-1}toggle(o){this.mask^=1<<o|0}disable(o){this.mask&=~(1<<o|0)}disableAll(){this.mask=0}test(o){return(this.mask&o.mask)!==0}isEnabled(o){return(this.mask&(1<<o|0))!==0}},Vnt=0,Rxe=new vt,_7=new z_,UE=new Wc,eZ=new vt,lH=new vt,Gnt=new vt,Unt=new z_,Dxe=new vt(1,0,0),wxe=new vt(0,1,0),Lxe=new vt(0,0,1),Mxe={type:"added"},Hnt={type:"removed"},v7={type:"childadded",child:null},b1e={type:"childremoved",child:null},tN=class wZ extends aJ{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Vnt++}),this.uuid=eN(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=wZ.DEFAULT_UP.clone();let t=new vt,e=new FH,r=new z_,i=new vt(1,1,1);function n(){r.setFromEuler(e,!1)}function s(){e.setFromQuaternion(r,void 0,!1)}e._onChange(n),r._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Wc},normalMatrix:{value:new Sl}}),this.matrix=new Wc,this.matrixWorld=new Wc,this.matrixAutoUpdate=wZ.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=wZ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Fnt,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return _7.setFromAxisAngle(t,e),this.quaternion.multiply(_7),this}rotateOnWorldAxis(t,e){return _7.setFromAxisAngle(t,e),this.quaternion.premultiply(_7),this}rotateX(t){return this.rotateOnAxis(Dxe,t)}rotateY(t){return this.rotateOnAxis(wxe,t)}rotateZ(t){return this.rotateOnAxis(Lxe,t)}translateOnAxis(t,e){return Rxe.copy(t).applyQuaternion(this.quaternion),this.position.add(Rxe.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(Dxe,t)}translateY(t){return this.translateOnAxis(wxe,t)}translateZ(t){return this.translateOnAxis(Lxe,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(UE.copy(this.matrixWorld).invert())}lookAt(t,e,r){t.isVector3?eZ.copy(t):eZ.set(t,e,r);let i=this.parent;this.updateWorldMatrix(!0,!1),lH.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?UE.lookAt(lH,eZ,this.up):UE.lookAt(eZ,lH,this.up),this.quaternion.setFromRotationMatrix(UE),i&&(UE.extractRotation(i.matrixWorld),_7.setFromRotationMatrix(UE),this.quaternion.premultiply(_7.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Mxe),v7.child=t,this.dispatchEvent(v7),v7.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Hnt),b1e.child=t,this.dispatchEvent(b1e),b1e.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),UE.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),UE.multiply(t.parent.matrixWorld)),t.applyMatrix4(UE),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Mxe),v7.child=t,this.dispatchEvent(v7),v7.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let r=0,i=this.children.length;r<i;r++){let n=this.children[r].getObjectByProperty(t,e);if(n!==void 0)return n}}getObjectsByProperty(t,e,r=[]){this[t]===e&&r.push(this);let i=this.children;for(let n=0,s=i.length;n<s;n++)i[n].getObjectsByProperty(t,e,r);return r}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(lH,t,Gnt),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(lH,Unt,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let r=0,i=e.length;r<i;r++)e[r].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let r=0,i=e.length;r<i;r++)e[r].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let r=0,i=e.length;r<i;r++)e[r].updateMatrixWorld(t)}updateWorldMatrix(t,e){let r=this.parent;if(t===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),e===!0){let i=this.children;for(let n=0,s=i.length;n<s;n++)i[n].updateWorldMatrix(!1,!0)}}toJSON(t){let e=t===void 0||typeof t=="string",r={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(t),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function n(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=n(t.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){let u=l[c];n(t.shapes,u)}else n(t.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(n(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(n(t.materials,this.material[l]));i.material=a}else i.material=n(t.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];i.animations.push(n(t.animations,l))}}if(e){let a=s(t.geometries),l=s(t.materials),c=s(t.textures),h=s(t.images),u=s(t.shapes),d=s(t.skeletons),p=s(t.animations),m=s(t.nodes);a.length>0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),h.length>0&&(r.images=h),u.length>0&&(r.shapes=u),d.length>0&&(r.skeletons=d),p.length>0&&(r.animations=p),m.length>0&&(r.nodes=m)}return r.object=i,r;function s(a){let l=[];for(let c in a){let h=a[c];delete h.metadata,l.push(h)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let r=0;r<t.children.length;r++){let i=t.children[r];this.add(i.clone())}return this}};tN.DEFAULT_UP=new vt(0,1,0);tN.DEFAULT_MATRIX_AUTO_UPDATE=!0;tN.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var vC=new vt,HE=new vt,P1e=new vt,WE=new vt,x7=new vt,R7=new vt,Nxe=new vt,T1e=new vt,I1e=new vt,C1e=new vt,S1e=new BH,E1e=new BH,O1e=new BH,k7=class B7{constructor(t=new vt,e=new vt,r=new vt){this.a=t,this.b=e,this.c=r}static getNormal(t,e,r,i){i.subVectors(r,e),vC.subVectors(t,e),i.cross(vC);let n=i.lengthSq();return n>0?i.multiplyScalar(1/Math.sqrt(n)):i.set(0,0,0)}static getBarycoord(t,e,r,i,n){vC.subVectors(i,e),HE.subVectors(r,e),P1e.subVectors(t,e);let s=vC.dot(vC),a=vC.dot(HE),l=vC.dot(P1e),c=HE.dot(HE),h=HE.dot(P1e),u=s*c-a*a;if(u===0)return n.set(0,0,0),null;let d=1/u,p=(c*l-a*h)*d,m=(s*h-a*l)*d;return n.set(1-p-m,m,p)}static containsPoint(t,e,r,i){return this.getBarycoord(t,e,r,i,WE)===null?!1:WE.x>=0&&WE.y>=0&&WE.x+WE.y<=1}static getInterpolation(t,e,r,i,n,s,a,l){return this.getBarycoord(t,e,r,i,WE)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(n,WE.x),l.addScaledVector(s,WE.y),l.addScaledVector(a,WE.z),l)}static getInterpolatedAttribute(t,e,r,i,n,s){return S1e.setScalar(0),E1e.setScalar(0),O1e.setScalar(0),S1e.fromBufferAttribute(t,e),E1e.fromBufferAttribute(t,r),O1e.fromBufferAttribute(t,i),s.setScalar(0),s.addScaledVector(S1e,n.x),s.addScaledVector(E1e,n.y),s.addScaledVector(O1e,n.z),s}static isFrontFacing(t,e,r,i){return vC.subVectors(r,e),HE.subVectors(t,e),vC.cross(HE).dot(i)<0}set(t,e,r){return this.a.copy(t),this.b.copy(e),this.c.copy(r),this}setFromPointsAndIndices(t,e,r,i){return this.a.copy(t[e]),this.b.copy(t[r]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,r,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,r),this.c.fromBufferAttribute(t,i),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return vC.subVectors(this.c,this.b),HE.subVectors(this.a,this.b),vC.cross(HE).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return B7.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return B7.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,r,i,n){return B7.getInterpolation(t,this.a,this.b,this.c,e,r,i,n)}containsPoint(t){return B7.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return B7.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let r=this.a,i=this.b,n=this.c,s,a;x7.subVectors(i,r),R7.subVectors(n,r),T1e.subVectors(t,r);let l=x7.dot(T1e),c=R7.dot(T1e);if(l<=0&&c<=0)return e.copy(r);I1e.subVectors(t,i);let h=x7.dot(I1e),u=R7.dot(I1e);if(h>=0&&u<=h)return e.copy(i);let d=l*u-h*c;if(d<=0&&l>=0&&h<=0)return s=l/(l-h),e.copy(r).addScaledVector(x7,s);C1e.subVectors(t,n);let p=x7.dot(C1e),m=R7.dot(C1e);if(m>=0&&p<=m)return e.copy(n);let g=p*c-l*m;if(g<=0&&c>=0&&m<=0)return a=c/(c-m),e.copy(r).addScaledVector(R7,a);let y=h*m-p*u;if(y<=0&&u-h>=0&&p-m>=0)return Nxe.subVectors(n,i),a=(u-h)/(u-h+(p-m)),e.copy(i).addScaledVector(Nxe,a);let b=1/(y+g+d);return s=g*b,a=d*b,e.copy(r).addScaledVector(x7,s).addScaledVector(R7,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},Wwe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},x_={h:0,s:0,l:0},tZ={h:0,s:0,l:0};function A1e(o,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?o+(t-o)*6*e:e<1/2?t:e<2/3?o+(t-o)*6*(2/3-e):o}var W0=class{constructor(o,t,e){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(o,t,e)}set(o,t,e){if(t===void 0&&e===void 0){let r=o;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(o,t,e);return this}setScalar(o){return this.r=o,this.g=o,this.b=o,this}setHex(o,t=xC){return o=Math.floor(o),this.r=(o>>16&255)/255,this.g=(o>>8&255)/255,this.b=(o&255)/255,OC.toWorkingColorSpace(this,t),this}setRGB(o,t,e,r=OC.workingColorSpace){return this.r=o,this.g=t,this.b=e,OC.toWorkingColorSpace(this,r),this}setHSL(o,t,e,r=OC.workingColorSpace){if(o=Ant(o,1),t=hl(t,0,1),e=hl(e,0,1),t===0)this.r=this.g=this.b=e;else{let i=e<=.5?e*(1+t):e+t-e*t,n=2*e-i;this.r=A1e(n,i,o+1/3),this.g=A1e(n,i,o),this.b=A1e(n,i,o-1/3)}return OC.toWorkingColorSpace(this,r),this}setStyle(o,t=xC){function e(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+o+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(o)){let i,n=r[1],s=r[2];switch(n){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return e(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return e(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return e(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+o)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(o)){let i=r[1],n=i.length;if(n===3)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,t);if(n===6)return this.setHex(parseInt(i,16),t);console.warn("THREE.Color: Invalid hex color "+o)}else if(o&&o.length>0)return this.setColorName(o,t);return this}setColorName(o,t=xC){let e=Wwe[o.toLowerCase()];return e!==void 0?this.setHex(e,t):console.warn("THREE.Color: Unknown color "+o),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(o){return this.r=o.r,this.g=o.g,this.b=o.b,this}copySRGBToLinear(o){return this.r=$E(o.r),this.g=$E(o.g),this.b=$E(o.b),this}copyLinearToSRGB(o){return this.r=Y7(o.r),this.g=Y7(o.g),this.b=Y7(o.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(o=xC){return OC.fromWorkingColorSpace(z1.copy(this),o),Math.round(hl(z1.r*255,0,255))*65536+Math.round(hl(z1.g*255,0,255))*256+Math.round(hl(z1.b*255,0,255))}getHexString(o=xC){return("000000"+this.getHex(o).toString(16)).slice(-6)}getHSL(o,t=OC.workingColorSpace){OC.fromWorkingColorSpace(z1.copy(this),t);let e=z1.r,r=z1.g,i=z1.b,n=Math.max(e,r,i),s=Math.min(e,r,i),a,l,c=(s+n)/2;if(s===n)a=0,l=0;else{let h=n-s;switch(l=c<=.5?h/(n+s):h/(2-n-s),n){case e:a=(r-i)/h+(r<i?6:0);break;case r:a=(i-e)/h+2;break;case i:a=(e-r)/h+4;break}a/=6}return o.h=a,o.s=l,o.l=c,o}getRGB(o,t=OC.workingColorSpace){return OC.fromWorkingColorSpace(z1.copy(this),t),o.r=z1.r,o.g=z1.g,o.b=z1.b,o}getStyle(o=xC){OC.fromWorkingColorSpace(z1.copy(this),o);let t=z1.r,e=z1.g,r=z1.b;return o!==xC?`color(${o} ${t.toFixed(3)} ${e.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(e*255)},${Math.round(r*255)})`}offsetHSL(o,t,e){return this.getHSL(x_),this.setHSL(x_.h+o,x_.s+t,x_.l+e)}add(o){return this.r+=o.r,this.g+=o.g,this.b+=o.b,this}addColors(o,t){return this.r=o.r+t.r,this.g=o.g+t.g,this.b=o.b+t.b,this}addScalar(o){return this.r+=o,this.g+=o,this.b+=o,this}sub(o){return this.r=Math.max(0,this.r-o.r),this.g=Math.max(0,this.g-o.g),this.b=Math.max(0,this.b-o.b),this}multiply(o){return this.r*=o.r,this.g*=o.g,this.b*=o.b,this}multiplyScalar(o){return this.r*=o,this.g*=o,this.b*=o,this}lerp(o,t){return this.r+=(o.r-this.r)*t,this.g+=(o.g-this.g)*t,this.b+=(o.b-this.b)*t,this}lerpColors(o,t,e){return this.r=o.r+(t.r-o.r)*e,this.g=o.g+(t.g-o.g)*e,this.b=o.b+(t.b-o.b)*e,this}lerpHSL(o,t){this.getHSL(x_),o.getHSL(tZ);let e=c1e(x_.h,tZ.h,t),r=c1e(x_.s,tZ.s,t),i=c1e(x_.l,tZ.l,t);return this.setHSL(e,r,i),this}setFromVector3(o){return this.r=o.x,this.g=o.y,this.b=o.z,this}applyMatrix3(o){let t=this.r,e=this.g,r=this.b,i=o.elements;return this.r=i[0]*t+i[3]*e+i[6]*r,this.g=i[1]*t+i[4]*e+i[7]*r,this.b=i[2]*t+i[5]*e+i[8]*r,this}equals(o){return o.r===this.r&&o.g===this.g&&o.b===this.b}fromArray(o,t=0){return this.r=o[t],this.g=o[t+1],this.b=o[t+2],this}toArray(o=[],t=0){return o[t]=this.r,o[t+1]=this.g,o[t+2]=this.b,o}fromBufferAttribute(o,t){return this.r=o.getX(t),this.g=o.getY(t),this.b=o.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},z1=new W0;W0.NAMES=Wwe;var Wnt=0,znt=class extends aJ{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Wnt++}),this.uuid=eN(),this.name="",this.type="Material",this.blending=nxe,this.side=lye,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=sxe,this.blendDst=axe,this.blendEquation=oxe,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new W0(0,0,0),this.blendAlpha=0,this.depthFunc=WZ,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Cxe,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=I7,this.stencilZFail=I7,this.stencilZPass=I7,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(o){this._alphaTest>0!=o>0&&this.version++,this._alphaTest=o}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(o){if(o!==void 0)for(let t in o){let e=o[t];if(e===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(e):r&&r.isVector3&&e&&e.isVector3?r.copy(e):this[t]=e}}toJSON(o){let t=o===void 0||typeof o=="string";t&&(o={textures:{},images:{}});let e={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),this.color&&this.color.isColor&&(e.color=this.color.getHex()),this.roughness!==void 0&&(e.roughness=this.roughness),this.metalness!==void 0&&(e.metalness=this.metalness),this.sheen!==void 0&&(e.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(e.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(e.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(e.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(e.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(e.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(e.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(e.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(e.shininess=this.shininess),this.clearcoat!==void 0&&(e.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(e.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(e.clearcoatMap=this.clearcoatMap.toJSON(o).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(e.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(o).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(e.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(o).uuid,e.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(e.dispersion=this.dispersion),this.iridescence!==void 0&&(e.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(e.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(e.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(e.iridescenceMap=this.iridescenceMap.toJSON(o).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(e.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(o).uuid),this.anisotropy!==void 0&&(e.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(e.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(e.anisotropyMap=this.anisotropyMap.toJSON(o).uuid),this.map&&this.map.isTexture&&(e.map=this.map.toJSON(o).uuid),this.matcap&&this.matcap.isTexture&&(e.matcap=this.matcap.toJSON(o).uuid),this.alphaMap&&this.alphaMap.isTexture&&(e.alphaMap=this.alphaMap.toJSON(o).uuid),this.lightMap&&this.lightMap.isTexture&&(e.lightMap=this.lightMap.toJSON(o).uuid,e.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(e.aoMap=this.aoMap.toJSON(o).uuid,e.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(e.bumpMap=this.bumpMap.toJSON(o).uuid,e.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(e.normalMap=this.normalMap.toJSON(o).uuid,e.normalMapType=this.normalMapType,e.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(e.displacementMap=this.displacementMap.toJSON(o).uuid,e.displacementScale=this.displacementScale,e.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(e.roughnessMap=this.roughnessMap.toJSON(o).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(e.metalnessMap=this.metalnessMap.toJSON(o).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(e.emissiveMap=this.emissiveMap.toJSON(o).uuid),this.specularMap&&this.specularMap.isTexture&&(e.specularMap=this.specularMap.toJSON(o).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(e.specularIntensityMap=this.specularIntensityMap.toJSON(o).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(e.specularColorMap=this.specularColorMap.toJSON(o).uuid),this.envMap&&this.envMap.isTexture&&(e.envMap=this.envMap.toJSON(o).uuid,this.combine!==void 0&&(e.combine=this.combine)),this.envMapRotation!==void 0&&(e.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(e.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(e.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(e.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(e.gradientMap=this.gradientMap.toJSON(o).uuid),this.transmission!==void 0&&(e.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(e.transmissionMap=this.transmissionMap.toJSON(o).uuid),this.thickness!==void 0&&(e.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(e.thicknessMap=this.thicknessMap.toJSON(o).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(e.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(e.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(e.size=this.size),this.shadowSide!==null&&(e.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(e.sizeAttenuation=this.sizeAttenuation),this.blending!==nxe&&(e.blending=this.blending),this.side!==lye&&(e.side=this.side),this.vertexColors===!0&&(e.vertexColors=!0),this.opacity<1&&(e.opacity=this.opacity),this.transparent===!0&&(e.transparent=!0),this.blendSrc!==sxe&&(e.blendSrc=this.blendSrc),this.blendDst!==axe&&(e.blendDst=this.blendDst),this.blendEquation!==oxe&&(e.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(e.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(e.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(e.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(e.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(e.blendAlpha=this.blendAlpha),this.depthFunc!==WZ&&(e.depthFunc=this.depthFunc),this.depthTest===!1&&(e.depthTest=this.depthTest),this.depthWrite===!1&&(e.depthWrite=this.depthWrite),this.colorWrite===!1&&(e.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(e.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Cxe&&(e.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(e.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(e.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==I7&&(e.stencilFail=this.stencilFail),this.stencilZFail!==I7&&(e.stencilZFail=this.stencilZFail),this.stencilZPass!==I7&&(e.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(e.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(e.rotation=this.rotation),this.polygonOffset===!0&&(e.polygonOffset=!0),this.polygonOffsetFactor!==0&&(e.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(e.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(e.linewidth=this.linewidth),this.dashSize!==void 0&&(e.dashSize=this.dashSize),this.gapSize!==void 0&&(e.gapSize=this.gapSize),this.scale!==void 0&&(e.scale=this.scale),this.dithering===!0&&(e.dithering=!0),this.alphaTest>0&&(e.alphaTest=this.alphaTest),this.alphaHash===!0&&(e.alphaHash=!0),this.alphaToCoverage===!0&&(e.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(e.premultipliedAlpha=!0),this.forceSinglePass===!0&&(e.forceSinglePass=!0),this.wireframe===!0&&(e.wireframe=!0),this.wireframeLinewidth>1&&(e.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(e.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(e.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(e.flatShading=!0),this.visible===!1&&(e.visible=!1),this.toneMapped===!1&&(e.toneMapped=!1),this.fog===!1&&(e.fog=!1),Object.keys(this.userData).length>0&&(e.userData=this.userData);function r(i){let n=[];for(let s in i){let a=i[s];delete a.metadata,n.push(a)}return n}if(t){let i=r(o.textures),n=r(o.images);i.length>0&&(e.textures=i),n.length>0&&(e.images=n)}return e}clone(){return new this.constructor().copy(this)}copy(o){this.name=o.name,this.blending=o.blending,this.side=o.side,this.vertexColors=o.vertexColors,this.opacity=o.opacity,this.transparent=o.transparent,this.blendSrc=o.blendSrc,this.blendDst=o.blendDst,this.blendEquation=o.blendEquation,this.blendSrcAlpha=o.blendSrcAlpha,this.blendDstAlpha=o.blendDstAlpha,this.blendEquationAlpha=o.blendEquationAlpha,this.blendColor.copy(o.blendColor),this.blendAlpha=o.blendAlpha,this.depthFunc=o.depthFunc,this.depthTest=o.depthTest,this.depthWrite=o.depthWrite,this.stencilWriteMask=o.stencilWriteMask,this.stencilFunc=o.stencilFunc,this.stencilRef=o.stencilRef,this.stencilFuncMask=o.stencilFuncMask,this.stencilFail=o.stencilFail,this.stencilZFail=o.stencilZFail,this.stencilZPass=o.stencilZPass,this.stencilWrite=o.stencilWrite;let t=o.clippingPlanes,e=null;if(t!==null){let r=t.length;e=new Array(r);for(let i=0;i!==r;++i)e[i]=t[i].clone()}return this.clippingPlanes=e,this.clipIntersection=o.clipIntersection,this.clipShadows=o.clipShadows,this.shadowSide=o.shadowSide,this.colorWrite=o.colorWrite,this.precision=o.precision,this.polygonOffset=o.polygonOffset,this.polygonOffsetFactor=o.polygonOffsetFactor,this.polygonOffsetUnits=o.polygonOffsetUnits,this.dithering=o.dithering,this.alphaTest=o.alphaTest,this.alphaHash=o.alphaHash,this.alphaToCoverage=o.alphaToCoverage,this.premultipliedAlpha=o.premultipliedAlpha,this.forceSinglePass=o.forceSinglePass,this.visible=o.visible,this.toneMapped=o.toneMapped,this.userData=JSON.parse(JSON.stringify(o.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(o){o===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}},Ynt=class extends znt{constructor(o){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new W0(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new FH,this.combine=Pnt,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(o)}copy(o){return super.copy(o),this.color.copy(o.color),this.map=o.map,this.lightMap=o.lightMap,this.lightMapIntensity=o.lightMapIntensity,this.aoMap=o.aoMap,this.aoMapIntensity=o.aoMapIntensity,this.specularMap=o.specularMap,this.alphaMap=o.alphaMap,this.envMap=o.envMap,this.envMapRotation.copy(o.envMapRotation),this.combine=o.combine,this.reflectivity=o.reflectivity,this.refractionRatio=o.refractionRatio,this.wireframe=o.wireframe,this.wireframeLinewidth=o.wireframeLinewidth,this.wireframeLinecap=o.wireframeLinecap,this.wireframeLinejoin=o.wireframeLinejoin,this.fog=o.fog,this}},qE=jnt();function jnt(){let o=new ArrayBuffer(4),t=new Float32Array(o),e=new Uint32Array(o),r=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){let c=l-127;c<-27?(r[l]=0,r[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(r[l]=1024>>-c-14,r[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(r[l]=c+15<<10,r[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(r[l]=31744,r[l|256]=64512,i[l]=24,i[l|256]=24):(r[l]=31744,r[l|256]=64512,i[l]=13,i[l|256]=13)}let n=new Uint32Array(2048),s=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,h=0;for(;(c&8388608)===0;)c<<=1,h-=8388608;c&=-8388609,h+=947912704,n[l]=c|h}for(let l=1024;l<2048;++l)n[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)s[l]=l<<23;s[31]=1199570944,s[32]=2147483648;for(let l=33;l<63;++l)s[l]=2147483648+(l-32<<23);s[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:t,uint32View:e,baseTable:r,shiftTable:i,mantissaTable:n,exponentTable:s,offsetTable:a}}function Xnt(o){Math.abs(o)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),o=hl(o,-65504,65504),qE.floatView[0]=o;let t=qE.uint32View[0],e=t>>23&511;return qE.baseTable[e]+((t&8388607)>>qE.shiftTable[e])}function qnt(o){let t=o>>10;return qE.uint32View[0]=qE.mantissaTable[qE.offsetTable[t]+(o&1023)]+qE.exponentTable[t],qE.floatView[0]}var rZ={toHalfFloat:Xnt,fromHalfFloat:qnt},Pf=new vt,iZ=new fn,j7=class{constructor(o,t,e=!1){if(Array.isArray(o))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=o,this.itemSize=t,this.count=o!==void 0?o.length/t:0,this.normalized=e,this.usage=Sxe,this.updateRanges=[],this.gpuType=RZ,this.version=0}onUploadCallback(){}set needsUpdate(o){o===!0&&this.version++}setUsage(o){return this.usage=o,this}addUpdateRange(o,t){this.updateRanges.push({start:o,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(o){return this.name=o.name,this.array=new o.array.constructor(o.array),this.itemSize=o.itemSize,this.count=o.count,this.normalized=o.normalized,this.usage=o.usage,this.gpuType=o.gpuType,this}copyAt(o,t,e){o*=this.itemSize,e*=t.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[o+r]=t.array[e+r];return this}copyArray(o){return this.array.set(o),this}applyMatrix3(o){if(this.itemSize===2)for(let t=0,e=this.count;t<e;t++)iZ.fromBufferAttribute(this,t),iZ.applyMatrix3(o),this.setXY(t,iZ.x,iZ.y);else if(this.itemSize===3)for(let t=0,e=this.count;t<e;t++)Pf.fromBufferAttribute(this,t),Pf.applyMatrix3(o),this.setXYZ(t,Pf.x,Pf.y,Pf.z);return this}applyMatrix4(o){for(let t=0,e=this.count;t<e;t++)Pf.fromBufferAttribute(this,t),Pf.applyMatrix4(o),this.setXYZ(t,Pf.x,Pf.y,Pf.z);return this}applyNormalMatrix(o){for(let t=0,e=this.count;t<e;t++)Pf.fromBufferAttribute(this,t),Pf.applyNormalMatrix(o),this.setXYZ(t,Pf.x,Pf.y,Pf.z);return this}transformDirection(o){for(let t=0,e=this.count;t<e;t++)Pf.fromBufferAttribute(this,t),Pf.transformDirection(o),this.setXYZ(t,Pf.x,Pf.y,Pf.z);return this}set(o,t=0){return this.array.set(o,t),this}getComponent(o,t){let e=this.array[o*this.itemSize+t];return this.normalized&&(e=oH(e,this.array)),e}setComponent(o,t,e){return this.normalized&&(e=q2(e,this.array)),this.array[o*this.itemSize+t]=e,this}getX(o){let t=this.array[o*this.itemSize];return this.normalized&&(t=oH(t,this.array)),t}setX(o,t){return this.normalized&&(t=q2(t,this.array)),this.array[o*this.itemSize]=t,this}getY(o){let t=this.array[o*this.itemSize+1];return this.normalized&&(t=oH(t,this.array)),t}setY(o,t){return this.normalized&&(t=q2(t,this.array)),this.array[o*this.itemSize+1]=t,this}getZ(o){let t=this.array[o*this.itemSize+2];return this.normalized&&(t=oH(t,this.array)),t}setZ(o,t){return this.normalized&&(t=q2(t,this.array)),this.array[o*this.itemSize+2]=t,this}getW(o){let t=this.array[o*this.itemSize+3];return this.normalized&&(t=oH(t,this.array)),t}setW(o,t){return this.normalized&&(t=q2(t,this.array)),this.array[o*this.itemSize+3]=t,this}setXY(o,t,e){return o*=this.itemSize,this.normalized&&(t=q2(t,this.array),e=q2(e,this.array)),this.array[o+0]=t,this.array[o+1]=e,this}setXYZ(o,t,e,r){return o*=this.itemSize,this.normalized&&(t=q2(t,this.array),e=q2(e,this.array),r=q2(r,this.array)),this.array[o+0]=t,this.array[o+1]=e,this.array[o+2]=r,this}setXYZW(o,t,e,r,i){return o*=this.itemSize,this.normalized&&(t=q2(t,this.array),e=q2(e,this.array),r=q2(r,this.array),i=q2(i,this.array)),this.array[o+0]=t,this.array[o+1]=e,this.array[o+2]=r,this.array[o+3]=i,this}onUpload(o){return this.onUploadCallback=o,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let o={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(o.name=this.name),this.usage!==Sxe&&(o.usage=this.usage),o}},$nt=class extends j7{constructor(o,t,e){super(new Uint16Array(o),t,e)}},Knt=class extends j7{constructor(o,t,e){super(new Uint32Array(o),t,e)}},qa=class extends j7{constructor(o,t,e){super(new Float32Array(o),t,e)}},Znt=0,MT=new Wc,_1e=new tN,D7=new vt,dP=new Y_,cH=new Y_,Ym=new vt,$1=class zwe extends aJ{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Znt++}),this.uuid=eN(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(_nt(t)?Knt:$nt)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,r=0){this.groups.push({start:t,count:e,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let r=this.attributes.normal;if(r!==void 0){let n=new Sl().getNormalMatrix(t);r.applyNormalMatrix(n),r.needsUpdate=!0}let i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(t),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return MT.makeRotationFromQuaternion(t),this.applyMatrix4(MT),this}rotateX(t){return MT.makeRotationX(t),this.applyMatrix4(MT),this}rotateY(t){return MT.makeRotationY(t),this.applyMatrix4(MT),this}rotateZ(t){return MT.makeRotationZ(t),this.applyMatrix4(MT),this}translate(t,e,r){return MT.makeTranslation(t,e,r),this.applyMatrix4(MT),this}scale(t,e,r){return MT.makeScale(t,e,r),this.applyMatrix4(MT),this}lookAt(t){return _1e.lookAt(t),_1e.updateMatrix(),this.applyMatrix4(_1e.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(D7).negate(),this.translate(D7.x,D7.y,D7.z),this}setFromPoints(t){let e=this.getAttribute("position");if(e===void 0){let r=[];for(let i=0,n=t.length;i<n;i++){let s=t[i];r.push(s.x,s.y,s.z||0)}this.setAttribute("position",new qa(r,3))}else{let r=Math.min(t.length,e.count);for(let i=0;i<r;i++){let n=t[i];e.setXYZ(i,n.x,n.y,n.z||0)}t.length>e.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Y_);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new vt(-1/0,-1/0,-1/0),new vt(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let r=0,i=e.length;r<i;r++){let n=e[r];dP.setFromBufferAttribute(n),this.morphTargetsRelative?(Ym.addVectors(this.boundingBox.min,dP.min),this.boundingBox.expandByPoint(Ym),Ym.addVectors(this.boundingBox.max,dP.max),this.boundingBox.expandByPoint(Ym)):(this.boundingBox.expandByPoint(dP.min),this.boundingBox.expandByPoint(dP.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new j_);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new vt,1/0);return}if(t){let r=this.boundingSphere.center;if(dP.setFromBufferAttribute(t),e)for(let n=0,s=e.length;n<s;n++){let a=e[n];cH.setFromBufferAttribute(a),this.morphTargetsRelative?(Ym.addVectors(dP.min,cH.min),dP.expandByPoint(Ym),Ym.addVectors(dP.max,cH.max),dP.expandByPoint(Ym)):(dP.expandByPoint(cH.min),dP.expandByPoint(cH.max))}dP.getCenter(r);let i=0;for(let n=0,s=t.count;n<s;n++)Ym.fromBufferAttribute(t,n),i=Math.max(i,r.distanceToSquared(Ym));if(e)for(let n=0,s=e.length;n<s;n++){let a=e[n],l=this.morphTargetsRelative;for(let c=0,h=a.count;c<h;c++)Ym.fromBufferAttribute(a,c),l&&(D7.fromBufferAttribute(t,c),Ym.add(D7)),i=Math.max(i,r.distanceToSquared(Ym))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let r=e.position,i=e.normal,n=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new j7(new Float32Array(4*r.count),4));let s=this.getAttribute("tangent"),a=[],l=[];for(let _=0;_<r.count;_++)a[_]=new vt,l[_]=new vt;let c=new vt,h=new vt,u=new vt,d=new fn,p=new fn,m=new fn,g=new vt,y=new vt;function b(_,x,v){c.fromBufferAttribute(r,_),h.fromBufferAttribute(r,x),u.fromBufferAttribute(r,v),d.fromBufferAttribute(n,_),p.fromBufferAttribute(n,x),m.fromBufferAttribute(n,v),h.sub(c),u.sub(c),p.sub(d),m.sub(d);let D=1/(p.x*m.y-m.x*p.y);isFinite(D)&&(g.copy(h).multiplyScalar(m.y).addScaledVector(u,-p.y).multiplyScalar(D),y.copy(u).multiplyScalar(p.x).addScaledVector(h,-m.x).multiplyScalar(D),a[_].add(g),a[x].add(g),a[v].add(g),l[_].add(y),l[x].add(y),l[v].add(y))}let P=this.groups;P.length===0&&(P=[{start:0,count:t.count}]);for(let _=0,x=P.length;_<x;++_){let v=P[_],D=v.start,w=v.count;for(let F=D,H=D+w;F<H;F+=3)b(t.getX(F+0),t.getX(F+1),t.getX(F+2))}let T=new vt,I=new vt,C=new vt,E=new vt;function O(_){C.fromBufferAttribute(i,_),E.copy(C);let x=a[_];T.copy(x),T.sub(C.multiplyScalar(C.dot(x))).normalize(),I.crossVectors(E,x);let v=I.dot(l[_])<0?-1:1;s.setXYZW(_,T.x,T.y,T.z,v)}for(let _=0,x=P.length;_<x;++_){let v=P[_],D=v.start,w=v.count;for(let F=D,H=D+w;F<H;F+=3)O(t.getX(F+0)),O(t.getX(F+1)),O(t.getX(F+2))}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new j7(new Float32Array(e.count*3),3),this.setAttribute("normal",r);else for(let d=0,p=r.count;d<p;d++)r.setXYZ(d,0,0,0);let i=new vt,n=new vt,s=new vt,a=new vt,l=new vt,c=new vt,h=new vt,u=new vt;if(t)for(let d=0,p=t.count;d<p;d+=3){let m=t.getX(d+0),g=t.getX(d+1),y=t.getX(d+2);i.fromBufferAttribute(e,m),n.fromBufferAttribute(e,g),s.fromBufferAttribute(e,y),h.subVectors(s,n),u.subVectors(i,n),h.cross(u),a.fromBufferAttribute(r,m),l.fromBufferAttribute(r,g),c.fromBufferAttribute(r,y),a.add(h),l.add(h),c.add(h),r.setXYZ(m,a.x,a.y,a.z),r.setXYZ(g,l.x,l.y,l.z),r.setXYZ(y,c.x,c.y,c.z)}else for(let d=0,p=e.count;d<p;d+=3)i.fromBufferAttribute(e,d+0),n.fromBufferAttribute(e,d+1),s.fromBufferAttribute(e,d+2),h.subVectors(s,n),u.subVectors(i,n),h.cross(u),r.setXYZ(d+0,h.x,h.y,h.z),r.setXYZ(d+1,h.x,h.y,h.z),r.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,r=t.count;e<r;e++)Ym.fromBufferAttribute(t,e),Ym.normalize(),t.setXYZ(e,Ym.x,Ym.y,Ym.z)}toNonIndexed(){function t(a,l){let c=a.array,h=a.itemSize,u=a.normalized,d=new c.constructor(l.length*h),p=0,m=0;for(let g=0,y=l.length;g<y;g++){a.isInterleavedBufferAttribute?p=l[g]*a.data.stride+a.offset:p=l[g]*h;for(let b=0;b<h;b++)d[m++]=c[p++]}return new j7(d,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new zwe,r=this.index.array,i=this.attributes;for(let a in i){let l=i[a],c=t(l,r);e.setAttribute(a,c)}let n=this.morphAttributes;for(let a in n){let l=[],c=n[a];for(let h=0,u=c.length;h<u;h++){let d=c[h],p=t(d,r);l.push(p)}e.morphAttributes[a]=l}e.morphTargetsRelative=this.morphTargetsRelative;let s=this.groups;for(let a=0,l=s.length;a<l;a++){let c=s[a];e.addGroup(c.start,c.count,c.materialIndex)}return e}toJSON(){let t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(t[c]=l[c]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let r=this.attributes;for(let l in r){let c=r[l];t.data.attributes[l]=c.toJSON(t.data)}let i={},n=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],h=[];for(let u=0,d=c.length;u<d;u++){let p=c[u];h.push(p.toJSON(t.data))}h.length>0&&(i[l]=h,n=!0)}n&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);let s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));let a=this.boundingSphere;return a!==null&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let r=t.index;r!==null&&this.setIndex(r.clone(e));let i=t.attributes;for(let c in i){let h=i[c];this.setAttribute(c,h.clone(e))}let n=t.morphAttributes;for(let c in n){let h=[],u=n[c];for(let d=0,p=u.length;d<p;d++)h.push(u[d].clone(e));this.morphAttributes[c]=h}this.morphTargetsRelative=t.morphTargetsRelative;let s=t.groups;for(let c=0,h=s.length;c<h;c++){let u=s[c];this.addGroup(u.start,u.count,u.materialIndex)}let a=t.boundingBox;a!==null&&(this.boundingBox=a.clone());let l=t.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},kxe=new Wc,fw=new lJ,nZ=new j_,Bxe=new vt,oZ=new vt,sZ=new vt,aZ=new vt,v1e=new vt,lZ=new vt,Fxe=new vt,cZ=new vt,Ywe=class extends tN{constructor(o=new $1,t=new Ynt){super(),this.isMesh=!0,this.type="Mesh",this.geometry=o,this.material=t,this.updateMorphTargets()}copy(o,t){return super.copy(o,t),o.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=o.morphTargetInfluences.slice()),o.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},o.morphTargetDictionary)),this.material=Array.isArray(o.material)?o.material.slice():o.material,this.geometry=o.geometry,this}updateMorphTargets(){let o=this.geometry.morphAttributes,t=Object.keys(o);if(t.length>0){let e=o[t[0]];if(e!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,i=e.length;r<i;r++){let n=e[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=r}}}}getVertexPosition(o,t){let e=this.geometry,r=e.attributes.position,i=e.morphAttributes.position,n=e.morphTargetsRelative;t.fromBufferAttribute(r,o);let s=this.morphTargetInfluences;if(i&&s){lZ.set(0,0,0);for(let a=0,l=i.length;a<l;a++){let c=s[a],h=i[a];c!==0&&(v1e.fromBufferAttribute(h,o),n?lZ.addScaledVector(v1e,c):lZ.addScaledVector(v1e.sub(t),c))}t.add(lZ)}return t}raycast(o,t){let e=this.geometry,r=this.material,i=this.matrixWorld;r!==void 0&&(e.boundingSphere===null&&e.computeBoundingSphere(),nZ.copy(e.boundingSphere),nZ.applyMatrix4(i),fw.copy(o.ray).recast(o.near),!(nZ.containsPoint(fw.origin)===!1&&(fw.intersectSphere(nZ,Bxe)===null||fw.origin.distanceToSquared(Bxe)>(o.far-o.near)**2))&&(kxe.copy(i).invert(),fw.copy(o.ray).applyMatrix4(kxe),!(e.boundingBox!==null&&fw.intersectsBox(e.boundingBox)===!1)&&this._computeIntersections(o,t,fw)))}_computeIntersections(o,t,e){let r,i=this.geometry,n=this.material,s=i.index,a=i.attributes.position,l=i.attributes.uv,c=i.attributes.uv1,h=i.attributes.normal,u=i.groups,d=i.drawRange;if(s!==null)if(Array.isArray(n))for(let p=0,m=u.length;p<m;p++){let g=u[p],y=n[g.materialIndex],b=Math.max(g.start,d.start),P=Math.min(s.count,Math.min(g.start+g.count,d.start+d.count));for(let T=b,I=P;T<I;T+=3){let C=s.getX(T),E=s.getX(T+1),O=s.getX(T+2);r=hZ(this,y,o,e,l,c,h,C,E,O),r&&(r.faceIndex=Math.floor(T/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{let p=Math.max(0,d.start),m=Math.min(s.count,d.start+d.count);for(let g=p,y=m;g<y;g+=3){let b=s.getX(g),P=s.getX(g+1),T=s.getX(g+2);r=hZ(this,n,o,e,l,c,h,b,P,T),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}else if(a!==void 0)if(Array.isArray(n))for(let p=0,m=u.length;p<m;p++){let g=u[p],y=n[g.materialIndex],b=Math.max(g.start,d.start),P=Math.min(a.count,Math.min(g.start+g.count,d.start+d.count));for(let T=b,I=P;T<I;T+=3){let C=T,E=T+1,O=T+2;r=hZ(this,y,o,e,l,c,h,C,E,O),r&&(r.faceIndex=Math.floor(T/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{let p=Math.max(0,d.start),m=Math.min(a.count,d.start+d.count);for(let g=p,y=m;g<y;g+=3){let b=g,P=g+1,T=g+2;r=hZ(this,n,o,e,l,c,h,b,P,T),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}}};function Jnt(o,t,e,r,i,n,s,a){let l;if(t.side===bnt?l=r.intersectTriangle(s,n,i,!0,a):l=r.intersectTriangle(i,n,s,t.side===lye,a),l===null)return null;cZ.copy(a),cZ.applyMatrix4(o.matrixWorld);let c=e.ray.origin.distanceTo(cZ);return c<e.near||c>e.far?null:{distance:c,point:cZ.clone(),object:o}}function hZ(o,t,e,r,i,n,s,a,l,c){o.getVertexPosition(a,oZ),o.getVertexPosition(l,sZ),o.getVertexPosition(c,aZ);let h=Jnt(o,t,e,r,oZ,sZ,aZ,Fxe);if(h){let u=new vt;k7.getBarycoord(Fxe,oZ,sZ,aZ,u),i&&(h.uv=k7.getInterpolatedAttribute(i,a,l,c,u,new fn)),n&&(h.uv1=k7.getInterpolatedAttribute(n,a,l,c,u,new fn)),s&&(h.normal=k7.getInterpolatedAttribute(s,a,l,c,u,new vt),h.normal.dot(r.direction)>0&&h.normal.multiplyScalar(-1));let d={a,b:l,c,normal:new vt,materialIndex:0};k7.getNormal(oZ,sZ,aZ,d.normal),h.face=d,h.barycoord=u}return h}var Qnt=class jwe extends $1{constructor(t=1,e=1,r=1,i=1,n=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:i,heightSegments:n,depthSegments:s};let a=this;i=Math.floor(i),n=Math.floor(n),s=Math.floor(s);let l=[],c=[],h=[],u=[],d=0,p=0;m("z","y","x",-1,-1,r,e,t,s,n,0),m("z","y","x",1,-1,r,e,-t,s,n,1),m("x","z","y",1,1,t,r,e,i,s,2),m("x","z","y",1,-1,t,r,-e,i,s,3),m("x","y","z",1,-1,t,e,r,i,n,4),m("x","y","z",-1,-1,t,e,-r,i,n,5),this.setIndex(l),this.setAttribute("position",new qa(c,3)),this.setAttribute("normal",new qa(h,3)),this.setAttribute("uv",new qa(u,2));function m(g,y,b,P,T,I,C,E,O,_,x){let v=I/O,D=C/_,w=I/2,F=C/2,H=E/2,z=O+1,V=_+1,W=0,L=0,k=new vt;for(let N=0;N<V;N++){let U=N*D-F;for(let B=0;B<z;B++){let G=B*v-w;k[g]=G*P,k[y]=U*T,k[b]=H,c.push(k.x,k.y,k.z),k[g]=0,k[y]=0,k[b]=E>0?1:-1,h.push(k.x,k.y,k.z),u.push(B/O),u.push(1-N/_),W+=1}}for(let N=0;N<_;N++)for(let U=0;U<O;U++){let B=d+U+z*N,G=d+U+z*(N+1),Y=d+(U+1)+z*(N+1),X=d+(U+1)+z*N;l.push(B,G,X),l.push(G,Y,X),L+=6}a.addGroup(p,L,x),p+=L,d+=W}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new jwe(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};function eot(o){let t={};for(let e in o){t[e]={};for(let r in o[e]){let i=o[e][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][r]=null):t[e][r]=i.clone():Array.isArray(i)?t[e][r]=i.slice():t[e][r]=i}}return t}function $2(o){let t={};for(let e=0;e<o.length;e++){let r=eot(o[e]);for(let i in r)t[i]=r[i]}return t}var Xwe=class extends tN{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Wc,this.projectionMatrix=new Wc,this.projectionMatrixInverse=new Wc,this.coordinateSystem=Sw}copy(o,t){return super.copy(o,t),this.matrixWorldInverse.copy(o.matrixWorldInverse),this.projectionMatrix.copy(o.projectionMatrix),this.projectionMatrixInverse.copy(o.projectionMatrixInverse),this.coordinateSystem=o.coordinateSystem,this}getWorldDirection(o){return super.getWorldDirection(o).negate()}updateMatrixWorld(o){super.updateMatrixWorld(o),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(o,t){super.updateWorldMatrix(o,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},f6t=new vt,m6t=new fn,g6t=new fn,tot=class extends ZE{constructor(o,t,e,r,i,n,s,a,l,c){o=o!==void 0?o:[],t=t!==void 0?t:Tnt,super(o,t,e,r,i,n,s,a,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(o){this.image=o}},y6t=new vt,b6t=new vt,P6t=new vt,T6t=new vt,I6t=new fn,C6t=new fn,S6t=new Wc,E6t=new vt,O6t=new vt,A6t=new vt,_6t=new fn,v6t=new fn,x6t=new fn,R6t=new vt,D6t=new vt,w6t=new vt,L6t=new BH,M6t=new BH,N6t=new vt,k6t=new Wc,B6t=new vt,F6t=new j_,V6t=new Wc,G6t=new lJ,rot=class extends ZE{constructor(o=null,t=1,e=1,r,i,n,s,a,l=G_,c=G_,h,u){super(null,n,s,a,l,c,r,i,h,u),this.isDataTexture=!0,this.image={data:o,width:t,height:e},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},U6t=new Wc,H6t=new Wc,W6t=new Wc,z6t=new Wc,Y6t=new Y_,j6t=new Wc,X6t=new Ywe,q6t=new j_,x1e=new vt,iot=new vt,not=new Sl,w7=class{constructor(o=new vt(1,0,0),t=0){this.isPlane=!0,this.normal=o,this.constant=t}set(o,t){return this.normal.copy(o),this.constant=t,this}setComponents(o,t,e,r){return this.normal.set(o,t,e),this.constant=r,this}setFromNormalAndCoplanarPoint(o,t){return this.normal.copy(o),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(o,t,e){let r=x1e.subVectors(e,t).cross(iot.subVectors(o,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,o),this}copy(o){return this.normal.copy(o.normal),this.constant=o.constant,this}normalize(){let o=1/this.normal.length();return this.normal.multiplyScalar(o),this.constant*=o,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(o){return this.normal.dot(o)+this.constant}distanceToSphere(o){return this.distanceToPoint(o.center)-o.radius}projectPoint(o,t){return t.copy(o).addScaledVector(this.normal,-this.distanceToPoint(o))}intersectLine(o,t){let e=o.delta(x1e),r=this.normal.dot(e);if(r===0)return this.distanceToPoint(o.start)===0?t.copy(o.start):null;let i=-(o.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:t.copy(o.start).addScaledVector(e,i)}intersectsLine(o){let t=this.distanceToPoint(o.start),e=this.distanceToPoint(o.end);return t<0&&e>0||e<0&&t>0}intersectsBox(o){return o.intersectsPlane(this)}intersectsSphere(o){return o.intersectsPlane(this)}coplanarPoint(o){return o.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(o,t){let e=t||not.getNormalMatrix(o),r=this.coplanarPoint(x1e).applyMatrix4(o),i=this.normal.applyMatrix3(e).normalize();return this.constant=-r.dot(i),this}translate(o){return this.constant-=o.dot(this.normal),this}equals(o){return o.normal.equals(this.normal)&&o.constant===this.constant}clone(){return new this.constructor().copy(this)}},mw=new j_,uZ=new vt,oot=class{constructor(o=new w7,t=new w7,e=new w7,r=new w7,i=new w7,n=new w7){this.planes=[o,t,e,r,i,n]}set(o,t,e,r,i,n){let s=this.planes;return s[0].copy(o),s[1].copy(t),s[2].copy(e),s[3].copy(r),s[4].copy(i),s[5].copy(n),this}copy(o){let t=this.planes;for(let e=0;e<6;e++)t[e].copy(o.planes[e]);return this}setFromProjectionMatrix(o,t=Sw){let e=this.planes,r=o.elements,i=r[0],n=r[1],s=r[2],a=r[3],l=r[4],c=r[5],h=r[6],u=r[7],d=r[8],p=r[9],m=r[10],g=r[11],y=r[12],b=r[13],P=r[14],T=r[15];if(e[0].setComponents(a-i,u-l,g-d,T-y).normalize(),e[1].setComponents(a+i,u+l,g+d,T+y).normalize(),e[2].setComponents(a+n,u+c,g+p,T+b).normalize(),e[3].setComponents(a-n,u-c,g-p,T-b).normalize(),e[4].setComponents(a-s,u-h,g-m,T-P).normalize(),t===Sw)e[5].setComponents(a+s,u+h,g+m,T+P).normalize();else if(t===uye)e[5].setComponents(s,h,m,P).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(o){if(o.boundingSphere!==void 0)o.boundingSphere===null&&o.computeBoundingSphere(),mw.copy(o.boundingSphere).applyMatrix4(o.matrixWorld);else{let t=o.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),mw.copy(t.boundingSphere).applyMatrix4(o.matrixWorld)}return this.intersectsSphere(mw)}intersectsSprite(o){return mw.center.set(0,0,0),mw.radius=.7071067811865476,mw.applyMatrix4(o.matrixWorld),this.intersectsSphere(mw)}intersectsSphere(o){let t=this.planes,e=o.center,r=-o.radius;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<r)return!1;return!0}intersectsBox(o){let t=this.planes;for(let e=0;e<6;e++){let r=t[e];if(uZ.x=r.normal.x>0?o.max.x:o.min.x,uZ.y=r.normal.y>0?o.max.y:o.min.y,uZ.z=r.normal.z>0?o.max.z:o.min.z,r.distanceToPoint(uZ)<0)return!1}return!0}containsPoint(o){let t=this.planes;for(let e=0;e<6;e++)if(t[e].distanceToPoint(o)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},sot=class{constructor(){this.index=0,this.pool=[],this.list=[]}push(o,t,e,r){let i=this.pool,n=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});let s=i[this.index];n.push(s),this.index++,s.start=o,s.count=t,s.z=e,s.index=r}reset(){this.list.length=0,this.index=0}},$6t=new Wc,K6t=new W0(1,1,1),Z6t=new oot,J6t=new Y_,Q6t=new j_,e5t=new vt,t5t=new vt,r5t=new vt,i5t=new sot,n5t=new Ywe,o5t=new vt,s5t=new vt,a5t=new Wc,l5t=new lJ,c5t=new j_,h5t=new vt,u5t=new vt,d5t=new vt,p5t=new vt,f5t=new Wc,m5t=new lJ,g5t=new j_,y5t=new vt,aot=class extends ZE{constructor(o,t,e,r,i,n,s,a,l,c=s1e){if(c!==s1e&&c!==yxe)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");e===void 0&&c===s1e&&(e=Cnt),e===void 0&&c===yxe&&(e=Snt),super(null,r,i,n,s,a,c,e,l),this.isDepthTexture=!0,this.image={width:o,height:t},this.magFilter=s!==void 0?s:G_,this.minFilter=a!==void 0?a:G_,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(o){return super.copy(o),this.compareFunction=o.compareFunction,this}toJSON(o){let t=super.toJSON(o);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},I9=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(o,t){let e=this.getUtoTmapping(o);return this.getPoint(e,t)}getPoints(o=5){let t=[];for(let e=0;e<=o;e++)t.push(this.getPoint(e/o));return t}getSpacedPoints(o=5){let t=[];for(let e=0;e<=o;e++)t.push(this.getPointAt(e/o));return t}getLength(){let o=this.getLengths();return o[o.length-1]}getLengths(o=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===o+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],e,r=this.getPoint(0),i=0;t.push(0);for(let n=1;n<=o;n++)e=this.getPoint(n/o),i+=e.distanceTo(r),t.push(i),r=e;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(o,t){let e=this.getLengths(),r=0,i=e.length,n;t?n=t:n=o*e[i-1];let s=0,a=i-1,l;for(;s<=a;)if(r=Math.floor(s+(a-s)/2),l=e[r]-n,l<0)s=r+1;else if(l>0)a=r-1;else{a=r;break}if(r=a,e[r]===n)return r/(i-1);let c=e[r],h=e[r+1]-c,u=(n-c)/h;return(r+u)/(i-1)}getTangent(o,t){let e=o-1e-4,r=o+1e-4;e<0&&(e=0),r>1&&(r=1);let i=this.getPoint(e),n=this.getPoint(r),s=t||(i.isVector2?new fn:new vt);return s.copy(n).sub(i).normalize(),s}getTangentAt(o,t){let e=this.getUtoTmapping(o);return this.getTangent(e,t)}computeFrenetFrames(o,t){let e=new vt,r=[],i=[],n=[],s=new vt,a=new Wc;for(let d=0;d<=o;d++){let p=d/o;r[d]=this.getTangentAt(p,new vt)}i[0]=new vt,n[0]=new vt;let l=Number.MAX_VALUE,c=Math.abs(r[0].x),h=Math.abs(r[0].y),u=Math.abs(r[0].z);c<=l&&(l=c,e.set(1,0,0)),h<=l&&(l=h,e.set(0,1,0)),u<=l&&e.set(0,0,1),s.crossVectors(r[0],e).normalize(),i[0].crossVectors(r[0],s),n[0].crossVectors(r[0],i[0]);for(let d=1;d<=o;d++){if(i[d]=i[d-1].clone(),n[d]=n[d-1].clone(),s.crossVectors(r[d-1],r[d]),s.length()>Number.EPSILON){s.normalize();let p=Math.acos(hl(r[d-1].dot(r[d]),-1,1));i[d].applyMatrix4(a.makeRotationAxis(s,p))}n[d].crossVectors(r[d],i[d])}if(t===!0){let d=Math.acos(hl(i[0].dot(i[o]),-1,1));d/=o,r[0].dot(s.crossVectors(i[0],i[o]))>0&&(d=-d);for(let p=1;p<=o;p++)i[p].applyMatrix4(a.makeRotationAxis(r[p],d*p)),n[p].crossVectors(r[p],i[p])}return{tangents:r,normals:i,binormals:n}}clone(){return new this.constructor().copy(this)}copy(o){return this.arcLengthDivisions=o.arcLengthDivisions,this}toJSON(){let o={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return o.arcLengthDivisions=this.arcLengthDivisions,o.type=this.type,o}fromJSON(o){return this.arcLengthDivisions=o.arcLengthDivisions,this}},b2e=class extends I9{constructor(o=0,t=0,e=1,r=1,i=0,n=Math.PI*2,s=!1,a=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=o,this.aY=t,this.xRadius=e,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=n,this.aClockwise=s,this.aRotation=a}getPoint(o,t=new fn){let e=t,r=Math.PI*2,i=this.aEndAngle-this.aStartAngle,n=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(n?i=0:i=r),this.aClockwise===!0&&!n&&(i===r?i=-r:i=i-r);let s=this.aStartAngle+o*i,a=this.aX+this.xRadius*Math.cos(s),l=this.aY+this.yRadius*Math.sin(s);if(this.aRotation!==0){let c=Math.cos(this.aRotation),h=Math.sin(this.aRotation),u=a-this.aX,d=l-this.aY;a=u*c-d*h+this.aX,l=u*h+d*c+this.aY}return e.set(a,l)}copy(o){return super.copy(o),this.aX=o.aX,this.aY=o.aY,this.xRadius=o.xRadius,this.yRadius=o.yRadius,this.aStartAngle=o.aStartAngle,this.aEndAngle=o.aEndAngle,this.aClockwise=o.aClockwise,this.aRotation=o.aRotation,this}toJSON(){let o=super.toJSON();return o.aX=this.aX,o.aY=this.aY,o.xRadius=this.xRadius,o.yRadius=this.yRadius,o.aStartAngle=this.aStartAngle,o.aEndAngle=this.aEndAngle,o.aClockwise=this.aClockwise,o.aRotation=this.aRotation,o}fromJSON(o){return super.fromJSON(o),this.aX=o.aX,this.aY=o.aY,this.xRadius=o.xRadius,this.yRadius=o.yRadius,this.aStartAngle=o.aStartAngle,this.aEndAngle=o.aEndAngle,this.aClockwise=o.aClockwise,this.aRotation=o.aRotation,this}},lot=class extends b2e{constructor(o,t,e,r,i,n){super(o,t,e,e,r,i,n),this.isArcCurve=!0,this.type="ArcCurve"}};function P2e(){let o=0,t=0,e=0,r=0;function i(n,s,a,l){o=n,t=a,e=-3*n+3*s-2*a-l,r=2*n-2*s+a+l}return{initCatmullRom:function(n,s,a,l,c){i(s,a,c*(a-n),c*(l-s))},initNonuniformCatmullRom:function(n,s,a,l,c,h,u){let d=(s-n)/c-(a-n)/(c+h)+(a-s)/h,p=(a-s)/h-(l-s)/(h+u)+(l-a)/u;d*=h,p*=h,i(s,a,d,p)},calc:function(n){let s=n*n,a=s*n;return o+t*n+e*s+r*a}}}var dZ=new vt,R1e=new P2e,D1e=new P2e,w1e=new P2e,cot=class extends I9{constructor(o=[],t=!1,e="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=o,this.closed=t,this.curveType=e,this.tension=r}getPoint(o,t=new vt){let e=t,r=this.points,i=r.length,n=(i-(this.closed?0:1))*o,s=Math.floor(n),a=n-s;this.closed?s+=s>0?0:(Math.floor(Math.abs(s)/i)+1)*i:a===0&&s===i-1&&(s=i-2,a=1);let l,c;this.closed||s>0?l=r[(s-1)%i]:(dZ.subVectors(r[0],r[1]).add(r[0]),l=dZ);let h=r[s%i],u=r[(s+1)%i];if(this.closed||s+2<i?c=r[(s+2)%i]:(dZ.subVectors(r[i-1],r[i-2]).add(r[i-1]),c=dZ),this.curveType==="centripetal"||this.curveType==="chordal"){let d=this.curveType==="chordal"?.5:.25,p=Math.pow(l.distanceToSquared(h),d),m=Math.pow(h.distanceToSquared(u),d),g=Math.pow(u.distanceToSquared(c),d);m<1e-4&&(m=1),p<1e-4&&(p=m),g<1e-4&&(g=m),R1e.initNonuniformCatmullRom(l.x,h.x,u.x,c.x,p,m,g),D1e.initNonuniformCatmullRom(l.y,h.y,u.y,c.y,p,m,g),w1e.initNonuniformCatmullRom(l.z,h.z,u.z,c.z,p,m,g)}else this.curveType==="catmullrom"&&(R1e.initCatmullRom(l.x,h.x,u.x,c.x,this.tension),D1e.initCatmullRom(l.y,h.y,u.y,c.y,this.tension),w1e.initCatmullRom(l.z,h.z,u.z,c.z,this.tension));return e.set(R1e.calc(a),D1e.calc(a),w1e.calc(a)),e}copy(o){super.copy(o),this.points=[];for(let t=0,e=o.points.length;t<e;t++){let r=o.points[t];this.points.push(r.clone())}return this.closed=o.closed,this.curveType=o.curveType,this.tension=o.tension,this}toJSON(){let o=super.toJSON();o.points=[];for(let t=0,e=this.points.length;t<e;t++){let r=this.points[t];o.points.push(r.toArray())}return o.closed=this.closed,o.curveType=this.curveType,o.tension=this.tension,o}fromJSON(o){super.fromJSON(o),this.points=[];for(let t=0,e=o.points.length;t<e;t++){let r=o.points[t];this.points.push(new vt().fromArray(r))}return this.closed=o.closed,this.curveType=o.curveType,this.tension=o.tension,this}};function Vxe(o,t,e,r,i){let n=(r-t)*.5,s=(i-e)*.5,a=o*o,l=o*a;return(2*e-2*r+n+s)*l+(-3*e+3*r-2*n-s)*a+n*o+e}function hot(o,t){let e=1-o;return e*e*t}function uot(o,t){return 2*(1-o)*o*t}function dot(o,t){return o*o*t}function bH(o,t,e,r){return hot(o,t)+uot(o,e)+dot(o,r)}function pot(o,t){let e=1-o;return e*e*e*t}function fot(o,t){let e=1-o;return 3*e*e*o*t}function mot(o,t){return 3*(1-o)*o*o*t}function got(o,t){return o*o*o*t}function PH(o,t,e,r,i){return pot(o,t)+fot(o,e)+mot(o,r)+got(o,i)}var qwe=class extends I9{constructor(o=new fn,t=new fn,e=new fn,r=new fn){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=o,this.v1=t,this.v2=e,this.v3=r}getPoint(o,t=new fn){let e=t,r=this.v0,i=this.v1,n=this.v2,s=this.v3;return e.set(PH(o,r.x,i.x,n.x,s.x),PH(o,r.y,i.y,n.y,s.y)),e}copy(o){return super.copy(o),this.v0.copy(o.v0),this.v1.copy(o.v1),this.v2.copy(o.v2),this.v3.copy(o.v3),this}toJSON(){let o=super.toJSON();return o.v0=this.v0.toArray(),o.v1=this.v1.toArray(),o.v2=this.v2.toArray(),o.v3=this.v3.toArray(),o}fromJSON(o){return super.fromJSON(o),this.v0.fromArray(o.v0),this.v1.fromArray(o.v1),this.v2.fromArray(o.v2),this.v3.fromArray(o.v3),this}},yot=class extends I9{constructor(o=new vt,t=new vt,e=new vt,r=new vt){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=o,this.v1=t,this.v2=e,this.v3=r}getPoint(o,t=new vt){let e=t,r=this.v0,i=this.v1,n=this.v2,s=this.v3;return e.set(PH(o,r.x,i.x,n.x,s.x),PH(o,r.y,i.y,n.y,s.y),PH(o,r.z,i.z,n.z,s.z)),e}copy(o){return super.copy(o),this.v0.copy(o.v0),this.v1.copy(o.v1),this.v2.copy(o.v2),this.v3.copy(o.v3),this}toJSON(){let o=super.toJSON();return o.v0=this.v0.toArray(),o.v1=this.v1.toArray(),o.v2=this.v2.toArray(),o.v3=this.v3.toArray(),o}fromJSON(o){return super.fromJSON(o),this.v0.fromArray(o.v0),this.v1.fromArray(o.v1),this.v2.fromArray(o.v2),this.v3.fromArray(o.v3),this}},$we=class extends I9{constructor(o=new fn,t=new fn){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=o,this.v2=t}getPoint(o,t=new fn){let e=t;return o===1?e.copy(this.v2):(e.copy(this.v2).sub(this.v1),e.multiplyScalar(o).add(this.v1)),e}getPointAt(o,t){return this.getPoint(o,t)}getTangent(o,t=new fn){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(o,t){return this.getTangent(o,t)}copy(o){return super.copy(o),this.v1.copy(o.v1),this.v2.copy(o.v2),this}toJSON(){let o=super.toJSON();return o.v1=this.v1.toArray(),o.v2=this.v2.toArray(),o}fromJSON(o){return super.fromJSON(o),this.v1.fromArray(o.v1),this.v2.fromArray(o.v2),this}},bot=class extends I9{constructor(o=new vt,t=new vt){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=o,this.v2=t}getPoint(o,t=new vt){let e=t;return o===1?e.copy(this.v2):(e.copy(this.v2).sub(this.v1),e.multiplyScalar(o).add(this.v1)),e}getPointAt(o,t){return this.getPoint(o,t)}getTangent(o,t=new vt){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(o,t){return this.getTangent(o,t)}copy(o){return super.copy(o),this.v1.copy(o.v1),this.v2.copy(o.v2),this}toJSON(){let o=super.toJSON();return o.v1=this.v1.toArray(),o.v2=this.v2.toArray(),o}fromJSON(o){return super.fromJSON(o),this.v1.fromArray(o.v1),this.v2.fromArray(o.v2),this}},Kwe=class extends I9{constructor(o=new fn,t=new fn,e=new fn){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=o,this.v1=t,this.v2=e}getPoint(o,t=new fn){let e=t,r=this.v0,i=this.v1,n=this.v2;return e.set(bH(o,r.x,i.x,n.x),bH(o,r.y,i.y,n.y)),e}copy(o){return super.copy(o),this.v0.copy(o.v0),this.v1.copy(o.v1),this.v2.copy(o.v2),this}toJSON(){let o=super.toJSON();return o.v0=this.v0.toArray(),o.v1=this.v1.toArray(),o.v2=this.v2.toArray(),o}fromJSON(o){return super.fromJSON(o),this.v0.fromArray(o.v0),this.v1.fromArray(o.v1),this.v2.fromArray(o.v2),this}},Zwe=class extends I9{constructor(o=new vt,t=new vt,e=new vt){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=o,this.v1=t,this.v2=e}getPoint(o,t=new vt){let e=t,r=this.v0,i=this.v1,n=this.v2;return e.set(bH(o,r.x,i.x,n.x),bH(o,r.y,i.y,n.y),bH(o,r.z,i.z,n.z)),e}copy(o){return super.copy(o),this.v0.copy(o.v0),this.v1.copy(o.v1),this.v2.copy(o.v2),this}toJSON(){let o=super.toJSON();return o.v0=this.v0.toArray(),o.v1=this.v1.toArray(),o.v2=this.v2.toArray(),o}fromJSON(o){return super.fromJSON(o),this.v0.fromArray(o.v0),this.v1.fromArray(o.v1),this.v2.fromArray(o.v2),this}},Jwe=class extends I9{constructor(o=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=o}getPoint(o,t=new fn){let e=t,r=this.points,i=(r.length-1)*o,n=Math.floor(i),s=i-n,a=r[n===0?n:n-1],l=r[n],c=r[n>r.length-2?r.length-1:n+1],h=r[n>r.length-3?r.length-1:n+2];return e.set(Vxe(s,a.x,l.x,c.x,h.x),Vxe(s,a.y,l.y,c.y,h.y)),e}copy(o){super.copy(o),this.points=[];for(let t=0,e=o.points.length;t<e;t++){let r=o.points[t];this.points.push(r.clone())}return this}toJSON(){let o=super.toJSON();o.points=[];for(let t=0,e=this.points.length;t<e;t++){let r=this.points[t];o.points.push(r.toArray())}return o}fromJSON(o){super.fromJSON(o),this.points=[];for(let t=0,e=o.points.length;t<e;t++){let r=o.points[t];this.points.push(new fn().fromArray(r))}return this}},YZ=Object.freeze({__proto__:null,ArcCurve:lot,CatmullRomCurve3:cot,CubicBezierCurve:qwe,CubicBezierCurve3:yot,EllipseCurve:b2e,LineCurve:$we,LineCurve3:bot,QuadraticBezierCurve:Kwe,QuadraticBezierCurve3:Zwe,SplineCurve:Jwe}),Pot=class extends I9{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(o){this.curves.push(o)}closePath(){let o=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!o.equals(t)){let e=o.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new YZ[e](t,o))}return this}getPoint(o,t){let e=o*this.getLength(),r=this.getCurveLengths(),i=0;for(;i<r.length;){if(r[i]>=e){let n=r[i]-e,s=this.curves[i],a=s.getLength(),l=a===0?0:1-n/a;return s.getPointAt(l,t)}i++}return null}getLength(){let o=this.getCurveLengths();return o[o.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let o=[],t=0;for(let e=0,r=this.curves.length;e<r;e++)t+=this.curves[e].getLength(),o.push(t);return this.cacheLengths=o,o}getSpacedPoints(o=40){let t=[];for(let e=0;e<=o;e++)t.push(this.getPoint(e/o));return this.autoClose&&t.push(t[0]),t}getPoints(o=12){let t=[],e;for(let r=0,i=this.curves;r<i.length;r++){let n=i[r],s=n.isEllipseCurve?o*2:n.isLineCurve||n.isLineCurve3?1:n.isSplineCurve?o*n.points.length:o,a=n.getPoints(s);for(let l=0;l<a.length;l++){let c=a[l];e&&e.equals(c)||(t.push(c),e=c)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(o){super.copy(o),this.curves=[];for(let t=0,e=o.curves.length;t<e;t++){let r=o.curves[t];this.curves.push(r.clone())}return this.autoClose=o.autoClose,this}toJSON(){let o=super.toJSON();o.autoClose=this.autoClose,o.curves=[];for(let t=0,e=this.curves.length;t<e;t++){let r=this.curves[t];o.curves.push(r.toJSON())}return o}fromJSON(o){super.fromJSON(o),this.autoClose=o.autoClose,this.curves=[];for(let t=0,e=o.curves.length;t<e;t++){let r=o.curves[t];this.curves.push(new YZ[r.type]().fromJSON(r))}return this}},pye=class extends Pot{constructor(o){super(),this.type="Path",this.currentPoint=new fn,o&&this.setFromPoints(o)}setFromPoints(o){this.moveTo(o[0].x,o[0].y);for(let t=1,e=o.length;t<e;t++)this.lineTo(o[t].x,o[t].y);return this}moveTo(o,t){return this.currentPoint.set(o,t),this}lineTo(o,t){let e=new $we(this.currentPoint.clone(),new fn(o,t));return this.curves.push(e),this.currentPoint.set(o,t),this}quadraticCurveTo(o,t,e,r){let i=new Kwe(this.currentPoint.clone(),new fn(o,t),new fn(e,r));return this.curves.push(i),this.currentPoint.set(e,r),this}bezierCurveTo(o,t,e,r,i,n){let s=new qwe(this.currentPoint.clone(),new fn(o,t),new fn(e,r),new fn(i,n));return this.curves.push(s),this.currentPoint.set(i,n),this}splineThru(o){let t=[this.currentPoint.clone()].concat(o),e=new Jwe(t);return this.curves.push(e),this.currentPoint.copy(o[o.length-1]),this}arc(o,t,e,r,i,n){let s=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(o+s,t+a,e,r,i,n),this}absarc(o,t,e,r,i,n){return this.absellipse(o,t,e,e,r,i,n),this}ellipse(o,t,e,r,i,n,s,a){let l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(o+l,t+c,e,r,i,n,s,a),this}absellipse(o,t,e,r,i,n,s,a){let l=new b2e(o,t,e,r,i,n,s,a);if(this.curves.length>0){let h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);let c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(o){return super.copy(o),this.currentPoint.copy(o.currentPoint),this}toJSON(){let o=super.toJSON();return o.currentPoint=this.currentPoint.toArray(),o}fromJSON(o){return super.fromJSON(o),this.currentPoint.fromArray(o.currentPoint),this}},Qwe=class eLe extends $1{constructor(t=[new fn(0,-.5),new fn(.5,0),new fn(0,.5)],e=12,r=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:r,phiLength:i},e=Math.floor(e),i=hl(i,0,Math.PI*2);let n=[],s=[],a=[],l=[],c=[],h=1/e,u=new vt,d=new fn,p=new vt,m=new vt,g=new vt,y=0,b=0;for(let P=0;P<=t.length-1;P++)switch(P){case 0:y=t[P+1].x-t[P].x,b=t[P+1].y-t[P].y,p.x=b*1,p.y=-y,p.z=b*0,g.copy(p),p.normalize(),l.push(p.x,p.y,p.z);break;case t.length-1:l.push(g.x,g.y,g.z);break;default:y=t[P+1].x-t[P].x,b=t[P+1].y-t[P].y,p.x=b*1,p.y=-y,p.z=b*0,m.copy(p),p.x+=g.x,p.y+=g.y,p.z+=g.z,p.normalize(),l.push(p.x,p.y,p.z),g.copy(m)}for(let P=0;P<=e;P++){let T=r+P*h*i,I=Math.sin(T),C=Math.cos(T);for(let E=0;E<=t.length-1;E++){u.x=t[E].x*I,u.y=t[E].y,u.z=t[E].x*C,s.push(u.x,u.y,u.z),d.x=P/e,d.y=E/(t.length-1),a.push(d.x,d.y);let O=l[3*E+0]*I,_=l[3*E+1],x=l[3*E+0]*C;c.push(O,_,x)}}for(let P=0;P<e;P++)for(let T=0;T<t.length-1;T++){let I=T+P*t.length,C=I,E=I+t.length,O=I+t.length+1,_=I+1;n.push(C,E,_),n.push(O,_,E)}this.setIndex(n),this.setAttribute("position",new qa(s,3)),this.setAttribute("uv",new qa(a,2)),this.setAttribute("normal",new qa(c,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new eLe(t.points,t.segments,t.phiStart,t.phiLength)}},Tot=class tLe extends Qwe{constructor(t=1,e=1,r=4,i=8){let n=new pye;n.absarc(0,-e/2,t,Math.PI*1.5,0),n.absarc(0,e/2,t,0,Math.PI*.5),super(n.getPoints(r),i),this.type="CapsuleGeometry",this.parameters={radius:t,length:e,capSegments:r,radialSegments:i}}static fromJSON(t){return new tLe(t.radius,t.length,t.capSegments,t.radialSegments)}},Iot=class rLe extends $1{constructor(t=1,e=32,r=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:i},e=Math.max(3,e);let n=[],s=[],a=[],l=[],c=new vt,h=new fn;s.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let u=0,d=3;u<=e;u++,d+=3){let p=r+u/e*i;c.x=t*Math.cos(p),c.y=t*Math.sin(p),s.push(c.x,c.y,c.z),a.push(0,0,1),h.x=(s[d]/t+1)/2,h.y=(s[d+1]/t+1)/2,l.push(h.x,h.y)}for(let u=1;u<=e;u++)n.push(u,u+1,0);this.setIndex(n),this.setAttribute("position",new qa(s,3)),this.setAttribute("normal",new qa(a,3)),this.setAttribute("uv",new qa(l,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new rLe(t.radius,t.segments,t.thetaStart,t.thetaLength)}},iLe=class nLe extends $1{constructor(t=1,e=1,r=1,i=32,n=1,s=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:r,radialSegments:i,heightSegments:n,openEnded:s,thetaStart:a,thetaLength:l};let c=this;i=Math.floor(i),n=Math.floor(n);let h=[],u=[],d=[],p=[],m=0,g=[],y=r/2,b=0;P(),s===!1&&(t>0&&T(!0),e>0&&T(!1)),this.setIndex(h),this.setAttribute("position",new qa(u,3)),this.setAttribute("normal",new qa(d,3)),this.setAttribute("uv",new qa(p,2));function P(){let I=new vt,C=new vt,E=0,O=(e-t)/r;for(let _=0;_<=n;_++){let x=[],v=_/n,D=v*(e-t)+t;for(let w=0;w<=i;w++){let F=w/i,H=F*l+a,z=Math.sin(H),V=Math.cos(H);C.x=D*z,C.y=-v*r+y,C.z=D*V,u.push(C.x,C.y,C.z),I.set(z,O,V).normalize(),d.push(I.x,I.y,I.z),p.push(F,1-v),x.push(m++)}g.push(x)}for(let _=0;_<i;_++)for(let x=0;x<n;x++){let v=g[x][_],D=g[x+1][_],w=g[x+1][_+1],F=g[x][_+1];(t>0||x!==0)&&(h.push(v,D,F),E+=3),(e>0||x!==n-1)&&(h.push(D,w,F),E+=3)}c.addGroup(b,E,0),b+=E}function T(I){let C=m,E=new fn,O=new vt,_=0,x=I===!0?t:e,v=I===!0?1:-1;for(let w=1;w<=i;w++)u.push(0,y*v,0),d.push(0,v,0),p.push(.5,.5),m++;let D=m;for(let w=0;w<=i;w++){let F=w/i*l+a,H=Math.cos(F),z=Math.sin(F);O.x=x*z,O.y=y*v,O.z=x*H,u.push(O.x,O.y,O.z),d.push(0,v,0),E.x=H*.5+.5,E.y=z*.5*v+.5,p.push(E.x,E.y),m++}for(let w=0;w<i;w++){let F=C+w,H=D+w;I===!0?h.push(H,H+1,F):h.push(H+1,H,F),_+=3}c.addGroup(b,_,I===!0?1:2),b+=_}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new nLe(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},Cot=class oLe extends iLe{constructor(t=1,e=1,r=32,i=1,n=!1,s=0,a=Math.PI*2){super(0,t,e,r,i,n,s,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:r,heightSegments:i,openEnded:n,thetaStart:s,thetaLength:a}}static fromJSON(t){return new oLe(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},VH=class sLe extends $1{constructor(t=[],e=[],r=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:r,detail:i};let n=[],s=[];a(i),c(r),h(),this.setAttribute("position",new qa(n,3)),this.setAttribute("normal",new qa(n.slice(),3)),this.setAttribute("uv",new qa(s,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(P){let T=new vt,I=new vt,C=new vt;for(let E=0;E<e.length;E+=3)p(e[E+0],T),p(e[E+1],I),p(e[E+2],C),l(T,I,C,P)}function l(P,T,I,C){let E=C+1,O=[];for(let _=0;_<=E;_++){O[_]=[];let x=P.clone().lerp(I,_/E),v=T.clone().lerp(I,_/E),D=E-_;for(let w=0;w<=D;w++)w===0&&_===E?O[_][w]=x:O[_][w]=x.clone().lerp(v,w/D)}for(let _=0;_<E;_++)for(let x=0;x<2*(E-_)-1;x++){let v=Math.floor(x/2);x%2===0?(d(O[_][v+1]),d(O[_+1][v]),d(O[_][v])):(d(O[_][v+1]),d(O[_+1][v+1]),d(O[_+1][v]))}}function c(P){let T=new vt;for(let I=0;I<n.length;I+=3)T.x=n[I+0],T.y=n[I+1],T.z=n[I+2],T.normalize().multiplyScalar(P),n[I+0]=T.x,n[I+1]=T.y,n[I+2]=T.z}function h(){let P=new vt;for(let T=0;T<n.length;T+=3){P.x=n[T+0],P.y=n[T+1],P.z=n[T+2];let I=y(P)/2/Math.PI+.5,C=b(P)/Math.PI+.5;s.push(I,1-C)}m(),u()}function u(){for(let P=0;P<s.length;P+=6){let T=s[P+0],I=s[P+2],C=s[P+4],E=Math.max(T,I,C),O=Math.min(T,I,C);E>.9&&O<.1&&(T<.2&&(s[P+0]+=1),I<.2&&(s[P+2]+=1),C<.2&&(s[P+4]+=1))}}function d(P){n.push(P.x,P.y,P.z)}function p(P,T){let I=P*3;T.x=t[I+0],T.y=t[I+1],T.z=t[I+2]}function m(){let P=new vt,T=new vt,I=new vt,C=new vt,E=new fn,O=new fn,_=new fn;for(let x=0,v=0;x<n.length;x+=9,v+=6){P.set(n[x+0],n[x+1],n[x+2]),T.set(n[x+3],n[x+4],n[x+5]),I.set(n[x+6],n[x+7],n[x+8]),E.set(s[v+0],s[v+1]),O.set(s[v+2],s[v+3]),_.set(s[v+4],s[v+5]),C.copy(P).add(T).add(I).divideScalar(3);let D=y(C);g(E,v+0,P,D),g(O,v+2,T,D),g(_,v+4,I,D)}}function g(P,T,I,C){C<0&&P.x===1&&(s[T]=P.x-1),I.x===0&&I.z===0&&(s[T]=C/2/Math.PI+.5)}function y(P){return Math.atan2(P.z,-P.x)}function b(P){return Math.atan2(-P.y,Math.sqrt(P.x*P.x+P.z*P.z))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new sLe(t.vertices,t.indices,t.radius,t.details)}},Sot=class aLe extends VH{constructor(t=1,e=0){let r=(1+Math.sqrt(5))/2,i=1/r,n=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i],s=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(n,s,t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new aLe(t.radius,t.detail)}},pZ=new vt,fZ=new vt,L1e=new vt,mZ=new k7,Eot=class extends $1{constructor(o=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:o,thresholdAngle:t},o!==null){let e=Math.pow(10,4),r=Math.cos(Ont*t),i=o.getIndex(),n=o.getAttribute("position"),s=i?i.count:n.count,a=[0,0,0],l=["a","b","c"],c=new Array(3),h={},u=[];for(let d=0;d<s;d+=3){i?(a[0]=i.getX(d),a[1]=i.getX(d+1),a[2]=i.getX(d+2)):(a[0]=d,a[1]=d+1,a[2]=d+2);let{a:p,b:m,c:g}=mZ;if(p.fromBufferAttribute(n,a[0]),m.fromBufferAttribute(n,a[1]),g.fromBufferAttribute(n,a[2]),mZ.getNormal(L1e),c[0]=`${Math.round(p.x*e)},${Math.round(p.y*e)},${Math.round(p.z*e)}`,c[1]=`${Math.round(m.x*e)},${Math.round(m.y*e)},${Math.round(m.z*e)}`,c[2]=`${Math.round(g.x*e)},${Math.round(g.y*e)},${Math.round(g.z*e)}`,!(c[0]===c[1]||c[1]===c[2]||c[2]===c[0]))for(let y=0;y<3;y++){let b=(y+1)%3,P=c[y],T=c[b],I=mZ[l[y]],C=mZ[l[b]],E=`${P}_${T}`,O=`${T}_${P}`;O in h&&h[O]?(L1e.dot(h[O].normal)<=r&&(u.push(I.x,I.y,I.z),u.push(C.x,C.y,C.z)),h[O]=null):E in h||(h[E]={index0:a[y],index1:a[b],normal:L1e.clone()})}}for(let d in h)if(h[d]){let{index0:p,index1:m}=h[d];pZ.fromBufferAttribute(n,p),fZ.fromBufferAttribute(n,m),u.push(pZ.x,pZ.y,pZ.z),u.push(fZ.x,fZ.y,fZ.z)}this.setAttribute("position",new qa(u,3))}}copy(o){return super.copy(o),this.parameters=Object.assign({},o.parameters),this}},lLe=class extends pye{constructor(o){super(o),this.uuid=eN(),this.type="Shape",this.holes=[]}getPointsHoles(o){let t=[];for(let e=0,r=this.holes.length;e<r;e++)t[e]=this.holes[e].getPoints(o);return t}extractPoints(o){return{shape:this.getPoints(o),holes:this.getPointsHoles(o)}}copy(o){super.copy(o),this.holes=[];for(let t=0,e=o.holes.length;t<e;t++){let r=o.holes[t];this.holes.push(r.clone())}return this}toJSON(){let o=super.toJSON();o.uuid=this.uuid,o.holes=[];for(let t=0,e=this.holes.length;t<e;t++){let r=this.holes[t];o.holes.push(r.toJSON())}return o}fromJSON(o){super.fromJSON(o),this.uuid=o.uuid,this.holes=[];for(let t=0,e=o.holes.length;t<e;t++){let r=o.holes[t];this.holes.push(new pye().fromJSON(r))}return this}},Oot={triangulate:function(o,t,e=2){let r=t&&t.length,i=r?t[0]*e:o.length,n=cLe(o,0,i,e,!0),s=[];if(!n||n.next===n.prev)return s;let a,l,c,h,u,d,p;if(r&&(n=Rot(o,t,n,e)),o.length>80*e){a=c=o[0],l=h=o[1];for(let m=e;m<i;m+=e)u=o[m],d=o[m+1],u<a&&(a=u),d<l&&(l=d),u>c&&(c=u),d>h&&(h=d);p=Math.max(c-a,h-l),p=p!==0?32767/p:0}return AH(n,s,e,a,l,p,0),s}};function cLe(o,t,e,r,i){let n,s;if(i===Uot(o,t,e,r)>0)for(n=t;n<e;n+=r)s=Gxe(n,o[n],o[n+1],s);else for(n=e-r;n>=t;n-=r)s=Gxe(n,o[n],o[n+1],s);return s&&cJ(s,s.next)&&(vH(s),s=s.next),s}function Ow(o,t){if(!o)return o;t||(t=o);let e=o,r;do if(r=!1,!e.steiner&&(cJ(e,e.next)||Gp(e.prev,e,e.next)===0)){if(vH(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function AH(o,t,e,r,i,n,s){if(!o)return;!s&&n&&Not(o,r,i,n);let a=o,l,c;for(;o.prev!==o.next;){if(l=o.prev,c=o.next,n?_ot(o,r,i,n):Aot(o)){t.push(l.i/e|0),t.push(o.i/e|0),t.push(c.i/e|0),vH(o),o=c.next,a=c.next;continue}if(o=c,o===a){s?s===1?(o=vot(Ow(o),t,e),AH(o,t,e,r,i,n,2)):s===2&&xot(o,t,e,r,i,n):AH(Ow(o),t,e,r,i,n,1);break}}}function Aot(o){let t=o.prev,e=o,r=o.next;if(Gp(t,e,r)>=0)return!1;let i=t.x,n=e.x,s=r.x,a=t.y,l=e.y,c=r.y,h=i<n?i<s?i:s:n<s?n:s,u=a<l?a<c?a:c:l<c?l:c,d=i>n?i>s?i:s:n>s?n:s,p=a>l?a>c?a:c:l>c?l:c,m=r.next;for(;m!==t;){if(m.x>=h&&m.x<=d&&m.y>=u&&m.y<=p&&G7(i,a,n,l,s,c,m.x,m.y)&&Gp(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function _ot(o,t,e,r){let i=o.prev,n=o,s=o.next;if(Gp(i,n,s)>=0)return!1;let a=i.x,l=n.x,c=s.x,h=i.y,u=n.y,d=s.y,p=a<l?a<c?a:c:l<c?l:c,m=h<u?h<d?h:d:u<d?u:d,g=a>l?a>c?a:c:l>c?l:c,y=h>u?h>d?h:d:u>d?u:d,b=fye(p,m,t,e,r),P=fye(g,y,t,e,r),T=o.prevZ,I=o.nextZ;for(;T&&T.z>=b&&I&&I.z<=P;){if(T.x>=p&&T.x<=g&&T.y>=m&&T.y<=y&&T!==i&&T!==s&&G7(a,h,l,u,c,d,T.x,T.y)&&Gp(T.prev,T,T.next)>=0||(T=T.prevZ,I.x>=p&&I.x<=g&&I.y>=m&&I.y<=y&&I!==i&&I!==s&&G7(a,h,l,u,c,d,I.x,I.y)&&Gp(I.prev,I,I.next)>=0))return!1;I=I.nextZ}for(;T&&T.z>=b;){if(T.x>=p&&T.x<=g&&T.y>=m&&T.y<=y&&T!==i&&T!==s&&G7(a,h,l,u,c,d,T.x,T.y)&&Gp(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;I&&I.z<=P;){if(I.x>=p&&I.x<=g&&I.y>=m&&I.y<=y&&I!==i&&I!==s&&G7(a,h,l,u,c,d,I.x,I.y)&&Gp(I.prev,I,I.next)>=0)return!1;I=I.nextZ}return!0}function vot(o,t,e){let r=o;do{let i=r.prev,n=r.next.next;!cJ(i,n)&&hLe(i,r,r.next,n)&&_H(i,n)&&_H(n,i)&&(t.push(i.i/e|0),t.push(r.i/e|0),t.push(n.i/e|0),vH(r),vH(r.next),r=o=n),r=r.next}while(r!==o);return Ow(r)}function xot(o,t,e,r,i,n){let s=o;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&Fot(s,a)){let l=uLe(s,a);s=Ow(s,s.next),l=Ow(l,l.next),AH(s,t,e,r,i,n,0),AH(l,t,e,r,i,n,0);return}a=a.next}s=s.next}while(s!==o)}function Rot(o,t,e,r){let i=[],n,s,a,l,c;for(n=0,s=t.length;n<s;n++)a=t[n]*r,l=n<s-1?t[n+1]*r:o.length,c=cLe(o,a,l,r,!1),c===c.next&&(c.steiner=!0),i.push(Bot(c));for(i.sort(Dot),n=0;n<i.length;n++)e=wot(i[n],e);return e}function Dot(o,t){return o.x-t.x}function wot(o,t){let e=Lot(o,t);if(!e)return t;let r=uLe(e,o);return Ow(r,r.next),Ow(e,e.next)}function Lot(o,t){let e=t,r=-1/0,i,n=o.x,s=o.y;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){let d=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=n&&d>r&&(r=d,i=e.x<e.next.x?e:e.next,d===n))return i}e=e.next}while(e!==t);if(!i)return null;let a=i,l=i.x,c=i.y,h=1/0,u;e=i;do n>=e.x&&e.x>=l&&n!==e.x&&G7(s<c?n:r,s,l,c,s<c?r:n,s,e.x,e.y)&&(u=Math.abs(s-e.y)/(n-e.x),_H(e,o)&&(u<h||u===h&&(e.x>i.x||e.x===i.x&&Mot(i,e)))&&(i=e,h=u)),e=e.next;while(e!==a);return i}function Mot(o,t){return Gp(o.prev,o,t.prev)<0&&Gp(t.next,o,o.next)<0}function Not(o,t,e,r){let i=o;do i.z===0&&(i.z=fye(i.x,i.y,t,e,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==o);i.prevZ.nextZ=null,i.prevZ=null,kot(i)}function kot(o){let t,e,r,i,n,s,a,l,c=1;do{for(e=o,o=null,n=null,s=0;e;){for(s++,r=e,a=0,t=0;t<c&&(a++,r=r.nextZ,!!r);t++);for(l=c;a>0||l>0&&r;)a!==0&&(l===0||!r||e.z<=r.z)?(i=e,e=e.nextZ,a--):(i=r,r=r.nextZ,l--),n?n.nextZ=i:o=i,i.prevZ=n,n=i;e=r}n.nextZ=null,c*=2}while(s>1);return o}function fye(o,t,e,r,i){return o=(o-e)*i|0,t=(t-r)*i|0,o=(o|o<<8)&16711935,o=(o|o<<4)&252645135,o=(o|o<<2)&858993459,o=(o|o<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,o|t<<1}function Bot(o){let t=o,e=o;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==o);return e}function G7(o,t,e,r,i,n,s,a){return(i-s)*(t-a)>=(o-s)*(n-a)&&(o-s)*(r-a)>=(e-s)*(t-a)&&(e-s)*(n-a)>=(i-s)*(r-a)}function Fot(o,t){return o.next.i!==t.i&&o.prev.i!==t.i&&!Vot(o,t)&&(_H(o,t)&&_H(t,o)&&Got(o,t)&&(Gp(o.prev,o,t.prev)||Gp(o,t.prev,t))||cJ(o,t)&&Gp(o.prev,o,o.next)>0&&Gp(t.prev,t,t.next)>0)}function Gp(o,t,e){return(t.y-o.y)*(e.x-t.x)-(t.x-o.x)*(e.y-t.y)}function cJ(o,t){return o.x===t.x&&o.y===t.y}function hLe(o,t,e,r){let i=yZ(Gp(o,t,e)),n=yZ(Gp(o,t,r)),s=yZ(Gp(e,r,o)),a=yZ(Gp(e,r,t));return!!(i!==n&&s!==a||i===0&&gZ(o,e,t)||n===0&&gZ(o,r,t)||s===0&&gZ(e,o,r)||a===0&&gZ(e,t,r))}function gZ(o,t,e){return t.x<=Math.max(o.x,e.x)&&t.x>=Math.min(o.x,e.x)&&t.y<=Math.max(o.y,e.y)&&t.y>=Math.min(o.y,e.y)}function yZ(o){return o>0?1:o<0?-1:0}function Vot(o,t){let e=o;do{if(e.i!==o.i&&e.next.i!==o.i&&e.i!==t.i&&e.next.i!==t.i&&hLe(e,e.next,o,t))return!0;e=e.next}while(e!==o);return!1}function _H(o,t){return Gp(o.prev,o,o.next)<0?Gp(o,t,o.next)>=0&&Gp(o,o.prev,t)>=0:Gp(o,t,o.prev)<0||Gp(o,o.next,t)<0}function Got(o,t){let e=o,r=!1,i=(o.x+t.x)/2,n=(o.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&i<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==o);return r}function uLe(o,t){let e=new mye(o.i,o.x,o.y),r=new mye(t.i,t.x,t.y),i=o.next,n=t.prev;return o.next=t,t.prev=o,e.next=i,i.prev=e,r.next=e,e.prev=r,n.next=r,r.prev=n,r}function Gxe(o,t,e,r){let i=new mye(o,t,e);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function vH(o){o.next.prev=o.prev,o.prev.next=o.next,o.prevZ&&(o.prevZ.nextZ=o.nextZ),o.nextZ&&(o.nextZ.prevZ=o.prevZ)}function mye(o,t,e){this.i=o,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Uot(o,t,e,r){let i=0;for(let n=t,s=e-r;n<e;n+=r)i+=(o[s]-o[n])*(o[n+1]+o[s+1]),s=n;return i}var X7=class dLe{static area(t){let e=t.length,r=0;for(let i=e-1,n=0;n<e;i=n++)r+=t[i].x*t[n].y-t[n].x*t[i].y;return r*.5}static isClockWise(t){return dLe.area(t)<0}static triangulateShape(t,e){let r=[],i=[],n=[];Uxe(t),Hxe(r,t);let s=t.length;e.forEach(Uxe);for(let l=0;l<e.length;l++)i.push(s),s+=e[l].length,Hxe(r,e[l]);let a=Oot.triangulate(r,i);for(let l=0;l<a.length;l+=3)n.push(a.slice(l,l+3));return n}};function Uxe(o){let t=o.length;t>2&&o[t-1].equals(o[0])&&o.pop()}function Hxe(o,t){for(let e=0;e<t.length;e++)o.push(t[e].x),o.push(t[e].y)}var Hot=class pLe extends $1{constructor(t=new lLe([new fn(.5,.5),new fn(-.5,.5),new fn(-.5,-.5),new fn(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];let r=this,i=[],n=[];for(let a=0,l=t.length;a<l;a++){let c=t[a];s(c)}this.setAttribute("position",new qa(i,3)),this.setAttribute("uv",new qa(n,2)),this.computeVertexNormals();function s(a){let l=[],c=e.curveSegments!==void 0?e.curveSegments:12,h=e.steps!==void 0?e.steps:1,u=e.depth!==void 0?e.depth:1,d=e.bevelEnabled!==void 0?e.bevelEnabled:!0,p=e.bevelThickness!==void 0?e.bevelThickness:.2,m=e.bevelSize!==void 0?e.bevelSize:p-.1,g=e.bevelOffset!==void 0?e.bevelOffset:0,y=e.bevelSegments!==void 0?e.bevelSegments:3,b=e.extrudePath,P=e.UVGenerator!==void 0?e.UVGenerator:Wot,T,I=!1,C,E,O,_;b&&(T=b.getSpacedPoints(h),I=!0,d=!1,C=b.computeFrenetFrames(h,!1),E=new vt,O=new vt,_=new vt),d||(y=0,p=0,m=0,g=0);let x=a.extractPoints(c),v=x.shape,D=x.holes;if(!X7.isClockWise(v)){v=v.reverse();for(let oe=0,$=D.length;oe<$;oe++){let fe=D[oe];X7.isClockWise(fe)&&(D[oe]=fe.reverse())}}let w=X7.triangulateShape(v,D),F=v;for(let oe=0,$=D.length;oe<$;oe++){let fe=D[oe];v=v.concat(fe)}function H(oe,$,fe){return $||console.error("THREE.ExtrudeGeometry: vec does not exist"),oe.clone().addScaledVector($,fe)}let z=v.length,V=w.length;function W(oe,$,fe){let Oe,Te,ue,be=oe.x-$.x,j=oe.y-$.y,Z=fe.x-oe.x,ie=fe.y-oe.y,de=be*be+j*j,me=be*ie-j*Z;if(Math.abs(me)>Number.EPSILON){let Se=Math.sqrt(de),Re=Math.sqrt(Z*Z+ie*ie),Je=$.x-j/Se,Ke=$.y+be/Se,Gt=fe.x-ie/Re,Nr=fe.y+Z/Re,xr=((Gt-Je)*ie-(Nr-Ke)*Z)/(be*ie-j*Z);Oe=Je+be*xr-oe.x,Te=Ke+j*xr-oe.y;let vr=Oe*Oe+Te*Te;if(vr<=2)return new fn(Oe,Te);ue=Math.sqrt(vr/2)}else{let Se=!1;be>Number.EPSILON?Z>Number.EPSILON&&(Se=!0):be<-Number.EPSILON?Z<-Number.EPSILON&&(Se=!0):Math.sign(j)===Math.sign(ie)&&(Se=!0),Se?(Oe=-j,Te=be,ue=Math.sqrt(de)):(Oe=be,Te=j,ue=Math.sqrt(de/2))}return new fn(Oe/ue,Te/ue)}let L=[];for(let oe=0,$=F.length,fe=$-1,Oe=oe+1;oe<$;oe++,fe++,Oe++)fe===$&&(fe=0),Oe===$&&(Oe=0),L[oe]=W(F[oe],F[fe],F[Oe]);let k=[],N,U=L.concat();for(let oe=0,$=D.length;oe<$;oe++){let fe=D[oe];N=[];for(let Oe=0,Te=fe.length,ue=Te-1,be=Oe+1;Oe<Te;Oe++,ue++,be++)ue===Te&&(ue=0),be===Te&&(be=0),N[Oe]=W(fe[Oe],fe[ue],fe[be]);k.push(N),U=U.concat(N)}for(let oe=0;oe<y;oe++){let $=oe/y,fe=p*Math.cos($*Math.PI/2),Oe=m*Math.sin($*Math.PI/2)+g;for(let Te=0,ue=F.length;Te<ue;Te++){let be=H(F[Te],L[Te],Oe);K(be.x,be.y,-fe)}for(let Te=0,ue=D.length;Te<ue;Te++){let be=D[Te];N=k[Te];for(let j=0,Z=be.length;j<Z;j++){let ie=H(be[j],N[j],Oe);K(ie.x,ie.y,-fe)}}}let B=m+g;for(let oe=0;oe<z;oe++){let $=d?H(v[oe],U[oe],B):v[oe];I?(O.copy(C.normals[0]).multiplyScalar($.x),E.copy(C.binormals[0]).multiplyScalar($.y),_.copy(T[0]).add(O).add(E),K(_.x,_.y,_.z)):K($.x,$.y,0)}for(let oe=1;oe<=h;oe++)for(let $=0;$<z;$++){let fe=d?H(v[$],U[$],B):v[$];I?(O.copy(C.normals[oe]).multiplyScalar(fe.x),E.copy(C.binormals[oe]).multiplyScalar(fe.y),_.copy(T[oe]).add(O).add(E),K(_.x,_.y,_.z)):K(fe.x,fe.y,u/h*oe)}for(let oe=y-1;oe>=0;oe--){let $=oe/y,fe=p*Math.cos($*Math.PI/2),Oe=m*Math.sin($*Math.PI/2)+g;for(let Te=0,ue=F.length;Te<ue;Te++){let be=H(F[Te],L[Te],Oe);K(be.x,be.y,u+fe)}for(let Te=0,ue=D.length;Te<ue;Te++){let be=D[Te];N=k[Te];for(let j=0,Z=be.length;j<Z;j++){let ie=H(be[j],N[j],Oe);I?K(ie.x,ie.y+T[h-1].y,T[h-1].x+fe):K(ie.x,ie.y,u+fe)}}}G(),Y();function G(){let oe=i.length/3;if(d){let $=0,fe=z*$;for(let Oe=0;Oe<V;Oe++){let Te=w[Oe];J(Te[2]+fe,Te[1]+fe,Te[0]+fe)}$=h+y*2,fe=z*$;for(let Oe=0;Oe<V;Oe++){let Te=w[Oe];J(Te[0]+fe,Te[1]+fe,Te[2]+fe)}}else{for(let $=0;$<V;$++){let fe=w[$];J(fe[2],fe[1],fe[0])}for(let $=0;$<V;$++){let fe=w[$];J(fe[0]+z*h,fe[1]+z*h,fe[2]+z*h)}}r.addGroup(oe,i.length/3-oe,0)}function Y(){let oe=i.length/3,$=0;X(F,$),$+=F.length;for(let fe=0,Oe=D.length;fe<Oe;fe++){let Te=D[fe];X(Te,$),$+=Te.length}r.addGroup(oe,i.length/3-oe,1)}function X(oe,$){let fe=oe.length;for(;--fe>=0;){let Oe=fe,Te=fe-1;Te<0&&(Te=oe.length-1);for(let ue=0,be=h+y*2;ue<be;ue++){let j=z*ue,Z=z*(ue+1),ie=$+Oe+j,de=$+Te+j,me=$+Te+Z,Se=$+Oe+Z;se(ie,de,me,Se)}}}function K(oe,$,fe){l.push(oe),l.push($),l.push(fe)}function J(oe,$,fe){ce(oe),ce($),ce(fe);let Oe=i.length/3,Te=P.generateTopUV(r,i,Oe-3,Oe-2,Oe-1);te(Te[0]),te(Te[1]),te(Te[2])}function se(oe,$,fe,Oe){ce(oe),ce($),ce(Oe),ce($),ce(fe),ce(Oe);let Te=i.length/3,ue=P.generateSideWallUV(r,i,Te-6,Te-3,Te-2,Te-1);te(ue[0]),te(ue[1]),te(ue[3]),te(ue[1]),te(ue[2]),te(ue[3])}function ce(oe){i.push(l[oe*3+0]),i.push(l[oe*3+1]),i.push(l[oe*3+2])}function te(oe){n.push(oe.x),n.push(oe.y)}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes,r=this.parameters.options;return zot(e,r,t)}static fromJSON(t,e){let r=[];for(let n=0,s=t.shapes.length;n<s;n++){let a=e[t.shapes[n]];r.push(a)}let i=t.options.extrudePath;return i!==void 0&&(t.options.extrudePath=new YZ[i.type]().fromJSON(i)),new pLe(r,t.options)}},Wot={generateTopUV:function(o,t,e,r,i){let n=t[e*3],s=t[e*3+1],a=t[r*3],l=t[r*3+1],c=t[i*3],h=t[i*3+1];return[new fn(n,s),new fn(a,l),new fn(c,h)]},generateSideWallUV:function(o,t,e,r,i,n){let s=t[e*3],a=t[e*3+1],l=t[e*3+2],c=t[r*3],h=t[r*3+1],u=t[r*3+2],d=t[i*3],p=t[i*3+1],m=t[i*3+2],g=t[n*3],y=t[n*3+1],b=t[n*3+2];return Math.abs(a-h)<Math.abs(s-c)?[new fn(s,1-l),new fn(c,1-u),new fn(d,1-m),new fn(g,1-b)]:[new fn(a,1-l),new fn(h,1-u),new fn(p,1-m),new fn(y,1-b)]}};function zot(o,t,e){if(e.shapes=[],Array.isArray(o))for(let r=0,i=o.length;r<i;r++){let n=o[r];e.shapes.push(n.uuid)}else e.shapes.push(o.uuid);return e.options=Object.assign({},t),t.extrudePath!==void 0&&(e.options.extrudePath=t.extrudePath.toJSON()),e}var Yot=class fLe extends VH{constructor(t=1,e=0){let r=(1+Math.sqrt(5))/2,i=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],n=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,n,t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new fLe(t.radius,t.detail)}},jot=class mLe extends VH{constructor(t=1,e=0){let r=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(r,i,t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new mLe(t.radius,t.detail)}},Xot=class gLe extends $1{constructor(t=1,e=1,r=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:i};let n=t/2,s=e/2,a=Math.floor(r),l=Math.floor(i),c=a+1,h=l+1,u=t/a,d=e/l,p=[],m=[],g=[],y=[];for(let b=0;b<h;b++){let P=b*d-s;for(let T=0;T<c;T++){let I=T*u-n;m.push(I,-P,0),g.push(0,0,1),y.push(T/a),y.push(1-b/l)}}for(let b=0;b<l;b++)for(let P=0;P<a;P++){let T=P+c*b,I=P+c*(b+1),C=P+1+c*(b+1),E=P+1+c*b;p.push(T,I,E),p.push(I,C,E)}this.setIndex(p),this.setAttribute("position",new qa(m,3)),this.setAttribute("normal",new qa(g,3)),this.setAttribute("uv",new qa(y,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new gLe(t.width,t.height,t.widthSegments,t.heightSegments)}},qot=class yLe extends $1{constructor(t=.5,e=1,r=32,i=1,n=0,s=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:r,phiSegments:i,thetaStart:n,thetaLength:s},r=Math.max(3,r),i=Math.max(1,i);let a=[],l=[],c=[],h=[],u=t,d=(e-t)/i,p=new vt,m=new fn;for(let g=0;g<=i;g++){for(let y=0;y<=r;y++){let b=n+y/r*s;p.x=u*Math.cos(b),p.y=u*Math.sin(b),l.push(p.x,p.y,p.z),c.push(0,0,1),m.x=(p.x/e+1)/2,m.y=(p.y/e+1)/2,h.push(m.x,m.y)}u+=d}for(let g=0;g<i;g++){let y=g*(r+1);for(let b=0;b<r;b++){let P=b+y,T=P,I=P+r+1,C=P+r+2,E=P+1;a.push(T,I,E),a.push(I,C,E)}}this.setIndex(a),this.setAttribute("position",new qa(l,3)),this.setAttribute("normal",new qa(c,3)),this.setAttribute("uv",new qa(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new yLe(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}},$ot=class bLe extends $1{constructor(t=new lLe([new fn(0,.5),new fn(-.5,-.5),new fn(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};let r=[],i=[],n=[],s=[],a=0,l=0;if(Array.isArray(t)===!1)c(t);else for(let h=0;h<t.length;h++)c(t[h]),this.addGroup(a,l,h),a+=l,l=0;this.setIndex(r),this.setAttribute("position",new qa(i,3)),this.setAttribute("normal",new qa(n,3)),this.setAttribute("uv",new qa(s,2));function c(h){let u=i.length/3,d=h.extractPoints(e),p=d.shape,m=d.holes;X7.isClockWise(p)===!1&&(p=p.reverse());for(let y=0,b=m.length;y<b;y++){let P=m[y];X7.isClockWise(P)===!0&&(m[y]=P.reverse())}let g=X7.triangulateShape(p,m);for(let y=0,b=m.length;y<b;y++){let P=m[y];p=p.concat(P)}for(let y=0,b=p.length;y<b;y++){let P=p[y];i.push(P.x,P.y,0),n.push(0,0,1),s.push(P.x,P.y)}for(let y=0,b=g.length;y<b;y++){let P=g[y],T=P[0]+u,I=P[1]+u,C=P[2]+u;r.push(T,I,C),l+=3}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes;return Kot(e,t)}static fromJSON(t,e){let r=[];for(let i=0,n=t.shapes.length;i<n;i++){let s=e[t.shapes[i]];r.push(s)}return new bLe(r,t.curveSegments)}};function Kot(o,t){if(t.shapes=[],Array.isArray(o))for(let e=0,r=o.length;e<r;e++){let i=o[e];t.shapes.push(i.uuid)}else t.shapes.push(o.uuid);return t}var Zot=class PLe extends $1{constructor(t=1,e=32,r=16,i=0,n=Math.PI*2,s=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:i,phiLength:n,thetaStart:s,thetaLength:a},e=Math.max(3,Math.floor(e)),r=Math.max(2,Math.floor(r));let l=Math.min(s+a,Math.PI),c=0,h=[],u=new vt,d=new vt,p=[],m=[],g=[],y=[];for(let b=0;b<=r;b++){let P=[],T=b/r,I=0;b===0&&s===0?I=.5/e:b===r&&l===Math.PI&&(I=-.5/e);for(let C=0;C<=e;C++){let E=C/e;u.x=-t*Math.cos(i+E*n)*Math.sin(s+T*a),u.y=t*Math.cos(s+T*a),u.z=t*Math.sin(i+E*n)*Math.sin(s+T*a),m.push(u.x,u.y,u.z),d.copy(u).normalize(),g.push(d.x,d.y,d.z),y.push(E+I,1-T),P.push(c++)}h.push(P)}for(let b=0;b<r;b++)for(let P=0;P<e;P++){let T=h[b][P+1],I=h[b][P],C=h[b+1][P],E=h[b+1][P+1];(b!==0||s>0)&&p.push(T,I,E),(b!==r-1||l<Math.PI)&&p.push(I,C,E)}this.setIndex(p),this.setAttribute("position",new qa(m,3)),this.setAttribute("normal",new qa(g,3)),this.setAttribute("uv",new qa(y,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new PLe(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},Jot=class TLe extends VH{constructor(t=1,e=0){let r=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(r,i,t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new TLe(t.radius,t.detail)}},Qot=class ILe extends $1{constructor(t=1,e=.4,r=12,i=48,n=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:i,arc:n},r=Math.floor(r),i=Math.floor(i);let s=[],a=[],l=[],c=[],h=new vt,u=new vt,d=new vt;for(let p=0;p<=r;p++)for(let m=0;m<=i;m++){let g=m/i*n,y=p/r*Math.PI*2;u.x=(t+e*Math.cos(y))*Math.cos(g),u.y=(t+e*Math.cos(y))*Math.sin(g),u.z=e*Math.sin(y),a.push(u.x,u.y,u.z),h.x=t*Math.cos(g),h.y=t*Math.sin(g),d.subVectors(u,h).normalize(),l.push(d.x,d.y,d.z),c.push(m/i),c.push(p/r)}for(let p=1;p<=r;p++)for(let m=1;m<=i;m++){let g=(i+1)*p+m-1,y=(i+1)*(p-1)+m-1,b=(i+1)*(p-1)+m,P=(i+1)*p+m;s.push(g,y,P),s.push(y,b,P)}this.setIndex(s),this.setAttribute("position",new qa(a,3)),this.setAttribute("normal",new qa(l,3)),this.setAttribute("uv",new qa(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ILe(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}},est=class CLe extends $1{constructor(t=1,e=.4,r=64,i=8,n=2,s=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:r,radialSegments:i,p:n,q:s},r=Math.floor(r),i=Math.floor(i);let a=[],l=[],c=[],h=[],u=new vt,d=new vt,p=new vt,m=new vt,g=new vt,y=new vt,b=new vt;for(let T=0;T<=r;++T){let I=T/r*n*Math.PI*2;P(I,n,s,t,p),P(I+.01,n,s,t,m),y.subVectors(m,p),b.addVectors(m,p),g.crossVectors(y,b),b.crossVectors(g,y),g.normalize(),b.normalize();for(let C=0;C<=i;++C){let E=C/i*Math.PI*2,O=-e*Math.cos(E),_=e*Math.sin(E);u.x=p.x+(O*b.x+_*g.x),u.y=p.y+(O*b.y+_*g.y),u.z=p.z+(O*b.z+_*g.z),l.push(u.x,u.y,u.z),d.subVectors(u,p).normalize(),c.push(d.x,d.y,d.z),h.push(T/r),h.push(C/i)}}for(let T=1;T<=r;T++)for(let I=1;I<=i;I++){let C=(i+1)*(T-1)+(I-1),E=(i+1)*T+(I-1),O=(i+1)*T+I,_=(i+1)*(T-1)+I;a.push(C,E,_),a.push(E,O,_)}this.setIndex(a),this.setAttribute("position",new qa(l,3)),this.setAttribute("normal",new qa(c,3)),this.setAttribute("uv",new qa(h,2));function P(T,I,C,E,O){let _=Math.cos(T),x=Math.sin(T),v=C/I*T,D=Math.cos(v);O.x=E*(2+D)*.5*_,O.y=E*(2+D)*x*.5,O.z=E*Math.sin(v)*.5}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new CLe(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}},tst=class SLe extends $1{constructor(t=new Zwe(new vt(-1,-1,0),new vt(-1,1,0),new vt(1,1,0)),e=64,r=1,i=8,n=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:r,radialSegments:i,closed:n};let s=t.computeFrenetFrames(e,n);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;let a=new vt,l=new vt,c=new fn,h=new vt,u=[],d=[],p=[],m=[];g(),this.setIndex(m),this.setAttribute("position",new qa(u,3)),this.setAttribute("normal",new qa(d,3)),this.setAttribute("uv",new qa(p,2));function g(){for(let T=0;T<e;T++)y(T);y(n===!1?e:0),P(),b()}function y(T){h=t.getPointAt(T/e,h);let I=s.normals[T],C=s.binormals[T];for(let E=0;E<=i;E++){let O=E/i*Math.PI*2,_=Math.sin(O),x=-Math.cos(O);l.x=x*I.x+_*C.x,l.y=x*I.y+_*C.y,l.z=x*I.z+_*C.z,l.normalize(),d.push(l.x,l.y,l.z),a.x=h.x+r*l.x,a.y=h.y+r*l.y,a.z=h.z+r*l.z,u.push(a.x,a.y,a.z)}}function b(){for(let T=1;T<=e;T++)for(let I=1;I<=i;I++){let C=(i+1)*(T-1)+(I-1),E=(i+1)*T+(I-1),O=(i+1)*T+I,_=(i+1)*(T-1)+I;m.push(C,E,_),m.push(E,O,_)}}function P(){for(let T=0;T<=e;T++)for(let I=0;I<=i;I++)c.x=T/e,c.y=I/i,p.push(c.x,c.y)}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new SLe(new YZ[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}},rst=class extends $1{constructor(o=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:o},o!==null){let t=[],e=new Set,r=new vt,i=new vt;if(o.index!==null){let n=o.attributes.position,s=o.index,a=o.groups;a.length===0&&(a=[{start:0,count:s.count,materialIndex:0}]);for(let l=0,c=a.length;l<c;++l){let h=a[l],u=h.start,d=h.count;for(let p=u,m=u+d;p<m;p+=3)for(let g=0;g<3;g++){let y=s.getX(p+g),b=s.getX(p+(g+1)%3);r.fromBufferAttribute(n,y),i.fromBufferAttribute(n,b),Wxe(r,i,e)===!0&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}}else{let n=o.attributes.position;for(let s=0,a=n.count/3;s<a;s++)for(let l=0;l<3;l++){let c=3*s+l,h=3*s+(l+1)%3;r.fromBufferAttribute(n,c),i.fromBufferAttribute(n,h),Wxe(r,i,e)===!0&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}this.setAttribute("position",new qa(t,3))}}copy(o){return super.copy(o),this.parameters=Object.assign({},o.parameters),this}};function Wxe(o,t,e){let r=`${o.x},${o.y},${o.z}-${t.x},${t.y},${t.z}`,i=`${t.x},${t.y},${t.z}-${o.x},${o.y},${o.z}`;return e.has(r)===!0||e.has(i)===!0?!1:(e.add(r),e.add(i),!0)}var b5t=Object.freeze({__proto__:null,BoxGeometry:Qnt,CapsuleGeometry:Tot,CircleGeometry:Iot,ConeGeometry:Cot,CylinderGeometry:iLe,DodecahedronGeometry:Sot,EdgesGeometry:Eot,ExtrudeGeometry:Hot,IcosahedronGeometry:Yot,LatheGeometry:Qwe,OctahedronGeometry:jot,PlaneGeometry:Xot,PolyhedronGeometry:VH,RingGeometry:qot,ShapeGeometry:$ot,SphereGeometry:Zot,TetrahedronGeometry:Jot,TorusGeometry:Qot,TorusKnotGeometry:est,TubeGeometry:tst,WireframeGeometry:rst});function bZ(o,t,e){return!o||!e&&o.constructor===t?o:typeof t.BYTES_PER_ELEMENT=="number"?new t(o):Array.prototype.slice.call(o)}function ist(o){return ArrayBuffer.isView(o)&&!(o instanceof DataView)}var hJ=class{constructor(o,t,e,r){this.parameterPositions=o,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(e),this.sampleValues=t,this.valueSize=e,this.settings=null,this.DefaultSettings_={}}evaluate(o){let t=this.parameterPositions,e=this._cachedIndex,r=t[e],i=t[e-1];e:{t:{let n;r:{i:if(!(o<r)){for(let s=e+2;;){if(r===void 0){if(o<i)break i;return e=t.length,this._cachedIndex=e,this.copySampleValue_(e-1)}if(e===s)break;if(i=r,r=t[++e],o<r)break t}n=t.length;break r}if(!(o>=i)){let s=t[1];o<s&&(e=2,i=s);for(let a=e-2;;){if(i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(e===a)break;if(r=i,i=t[--e-1],o>=i)break t}n=e,e=0;break r}break e}for(;e<n;){let s=e+n>>>1;o<t[s]?n=s:e=s+1}if(r=t[e],i=t[e-1],i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return e=t.length,this._cachedIndex=e,this.copySampleValue_(e-1)}this._cachedIndex=e,this.intervalChanged_(e,i,r)}return this.interpolate_(e,i,o,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(o){let t=this.resultBuffer,e=this.sampleValues,r=this.valueSize,i=o*r;for(let n=0;n!==r;++n)t[n]=e[i+n];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},nst=class extends hJ{constructor(o,t,e,r){super(o,t,e,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:bxe,endingEnd:bxe}}intervalChanged_(o,t,e){let r=this.parameterPositions,i=o-2,n=o+1,s=r[i],a=r[n];if(s===void 0)switch(this.getSettings_().endingStart){case Pxe:i=o,s=2*t-e;break;case Txe:i=r.length-2,s=t+r[i]-r[i+1];break;default:i=o,s=e}if(a===void 0)switch(this.getSettings_().endingEnd){case Pxe:n=o,a=2*e-t;break;case Txe:n=1,a=e+r[1]-r[0];break;default:n=o-1,a=t}let l=(e-t)*.5,c=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(a-e),this._offsetPrev=i*c,this._offsetNext=n*c}interpolate_(o,t,e,r){let i=this.resultBuffer,n=this.sampleValues,s=this.valueSize,a=o*s,l=a-s,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(e-t)/(r-t),m=p*p,g=m*p,y=-u*g+2*u*m-u*p,b=(1+u)*g+(-1.5-2*u)*m+(-.5+u)*p+1,P=(-1-d)*g+(1.5+d)*m+.5*p,T=d*g-d*m;for(let I=0;I!==s;++I)i[I]=y*n[c+I]+b*n[l+I]+P*n[a+I]+T*n[h+I];return i}},ost=class extends hJ{constructor(o,t,e,r){super(o,t,e,r)}interpolate_(o,t,e,r){let i=this.resultBuffer,n=this.sampleValues,s=this.valueSize,a=o*s,l=a-s,c=(e-t)/(r-t),h=1-c;for(let u=0;u!==s;++u)i[u]=n[l+u]*h+n[a+u]*c;return i}},sst=class extends hJ{constructor(o,t,e,r){super(o,t,e,r)}interpolate_(o){return this.copySampleValue_(o-1)}},JE=class{constructor(o,t,e,r){if(o===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+o);this.name=o,this.times=bZ(t,this.TimeBufferType),this.values=bZ(e,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(o){let t=o.constructor,e;if(t.toJSON!==this.toJSON)e=t.toJSON(o);else{e={name:o.name,times:bZ(o.times,Array),values:bZ(o.values,Array)};let r=o.getInterpolation();r!==o.DefaultInterpolation&&(e.interpolation=r)}return e.type=o.ValueTypeName,e}InterpolantFactoryMethodDiscrete(o){return new sst(this.times,this.values,this.getValueSize(),o)}InterpolantFactoryMethodLinear(o){return new ost(this.times,this.values,this.getValueSize(),o)}InterpolantFactoryMethodSmooth(o){return new nst(this.times,this.values,this.getValueSize(),o)}setInterpolation(o){let t;switch(o){case zZ:t=this.InterpolantFactoryMethodDiscrete;break;case cye:t=this.InterpolantFactoryMethodLinear;break;case a1e:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(o!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(e);return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return zZ;case this.InterpolantFactoryMethodLinear:return cye;case this.InterpolantFactoryMethodSmooth:return a1e}}getValueSize(){return this.values.length/this.times.length}shift(o){if(o!==0){let t=this.times;for(let e=0,r=t.length;e!==r;++e)t[e]+=o}return this}scale(o){if(o!==1){let t=this.times;for(let e=0,r=t.length;e!==r;++e)t[e]*=o}return this}trim(o,t){let e=this.times,r=e.length,i=0,n=r-1;for(;i!==r&&e[i]<o;)++i;for(;n!==-1&&e[n]>t;)--n;if(++n,i!==0||n!==r){i>=n&&(n=Math.max(n,1),i=n-1);let s=this.getValueSize();this.times=e.slice(i,n),this.values=this.values.slice(i*s,n*s)}return this}validate(){let o=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),o=!1);let e=this.times,r=this.values,i=e.length;i===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),o=!1);let n=null;for(let s=0;s!==i;s++){let a=e[s];if(typeof a=="number"&&isNaN(a)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,s,a),o=!1;break}if(n!==null&&n>a){console.error("THREE.KeyframeTrack: Out of order keys.",this,s,a,n),o=!1;break}n=a}if(r!==void 0&&ist(r))for(let s=0,a=r.length;s!==a;++s){let l=r[s];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,s,l),o=!1;break}}return o}optimize(){let o=this.times.slice(),t=this.values.slice(),e=this.getValueSize(),r=this.getInterpolation()===a1e,i=o.length-1,n=1;for(let s=1;s<i;++s){let a=!1,l=o[s],c=o[s+1];if(l!==c&&(s!==1||l!==o[0]))if(r)a=!0;else{let h=s*e,u=h-e,d=h+e;for(let p=0;p!==e;++p){let m=t[h+p];if(m!==t[u+p]||m!==t[d+p]){a=!0;break}}}if(a){if(s!==n){o[n]=o[s];let h=s*e,u=n*e;for(let d=0;d!==e;++d)t[u+d]=t[h+d]}++n}}if(i>0){o[n]=o[i];for(let s=i*e,a=n*e,l=0;l!==e;++l)t[a+l]=t[s+l];++n}return n!==o.length?(this.times=o.slice(0,n),this.values=t.slice(0,n*e)):(this.times=o,this.values=t),this}clone(){let o=this.times.slice(),t=this.values.slice(),e=this.constructor,r=new e(this.name,o,t);return r.createInterpolant=this.createInterpolant,r}};JE.prototype.TimeBufferType=Float32Array;JE.prototype.ValueBufferType=Float32Array;JE.prototype.DefaultInterpolation=cye;var GH=class extends JE{constructor(o,t,e){super(o,t,e)}};GH.prototype.ValueTypeName="bool";GH.prototype.ValueBufferType=Array;GH.prototype.DefaultInterpolation=zZ;GH.prototype.InterpolantFactoryMethodLinear=void 0;GH.prototype.InterpolantFactoryMethodSmooth=void 0;var ast=class extends JE{};ast.prototype.ValueTypeName="color";var lst=class extends JE{};lst.prototype.ValueTypeName="number";var cst=class extends hJ{constructor(o,t,e,r){super(o,t,e,r)}interpolate_(o,t,e,r){let i=this.resultBuffer,n=this.sampleValues,s=this.valueSize,a=(e-t)/(r-t),l=o*s;for(let c=l+s;l!==c;l+=4)z_.slerpFlat(i,0,n,l-s,n,l,a);return i}},ELe=class extends JE{InterpolantFactoryMethodLinear(o){return new cst(this.times,this.values,this.getValueSize(),o)}};ELe.prototype.ValueTypeName="quaternion";ELe.prototype.InterpolantFactoryMethodSmooth=void 0;var UH=class extends JE{constructor(o,t,e){super(o,t,e)}};UH.prototype.ValueTypeName="string";UH.prototype.ValueBufferType=Array;UH.prototype.DefaultInterpolation=zZ;UH.prototype.InterpolantFactoryMethodLinear=void 0;UH.prototype.InterpolantFactoryMethodSmooth=void 0;var hst=class extends JE{};hst.prototype.ValueTypeName="vector";var zxe={enabled:!1,files:{},add:function(o,t){this.enabled!==!1&&(this.files[o]=t)},get:function(o){if(this.enabled!==!1)return this.files[o]},remove:function(o){delete this.files[o]},clear:function(){this.files={}}},ust=class{constructor(o,t,e){let r=this,i=!1,n=0,s=0,a,l=[];this.onStart=void 0,this.onLoad=o,this.onProgress=t,this.onError=e,this.itemStart=function(c){s++,i===!1&&r.onStart!==void 0&&r.onStart(c,n,s),i=!0},this.itemEnd=function(c){n++,r.onProgress!==void 0&&r.onProgress(c,n,s),n===s&&(i=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(c){r.onError!==void 0&&r.onError(c)},this.resolveURL=function(c){return a?a(c):c},this.setURLModifier=function(c){return a=c,this},this.addHandler=function(c,h){return l.push(c,h),this},this.removeHandler=function(c){let h=l.indexOf(c);return h!==-1&&l.splice(h,2),this},this.getHandler=function(c){for(let h=0,u=l.length;h<u;h+=2){let d=l[h],p=l[h+1];if(d.global&&(d.lastIndex=0),d.test(c))return p}return null}}},dst=new ust,T2e=class{constructor(o){this.manager=o!==void 0?o:dst,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(o,t){let e=this;return new Promise(function(r,i){e.load(o,r,t,i)})}parse(){}setCrossOrigin(o){return this.crossOrigin=o,this}setWithCredentials(o){return this.withCredentials=o,this}setPath(o){return this.path=o,this}setResourcePath(o){return this.resourcePath=o,this}setRequestHeader(o){return this.requestHeader=o,this}};T2e.DEFAULT_MATERIAL_NAME="__DEFAULT";var zE={},pst=class extends Error{constructor(o,t){super(o),this.response=t}},fst=class extends T2e{constructor(o){super(o)}load(o,t,e,r){o===void 0&&(o=""),this.path!==void 0&&(o=this.path+o),o=this.manager.resolveURL(o);let i=zxe.get(o);if(i!==void 0)return this.manager.itemStart(o),setTimeout(()=>{t&&t(i),this.manager.itemEnd(o)},0),i;if(zE[o]!==void 0){zE[o].push({onLoad:t,onProgress:e,onError:r});return}zE[o]=[],zE[o].push({onLoad:t,onProgress:e,onError:r});let n=new Request(o,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,a=this.responseType;fetch(n).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;let c=zE[o],h=l.body.getReader(),u=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),d=u?parseInt(u):0,p=d!==0,m=0,g=new ReadableStream({start(y){b();function b(){h.read().then(({done:P,value:T})=>{if(P)y.close();else{m+=T.byteLength;let I=new ProgressEvent("progress",{lengthComputable:p,loaded:m,total:d});for(let C=0,E=c.length;C<E;C++){let O=c[C];O.onProgress&&O.onProgress(I)}y.enqueue(T),b()}},P=>{y.error(P)})}}});return new Response(g)}else throw new pst(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(a){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(c=>new DOMParser().parseFromString(c,s));case"json":return l.json();default:if(s===void 0)return l.text();{let c=/charset="?([^;"\s]*)"?/i.exec(s),h=c&&c[1]?c[1].toLowerCase():void 0,u=new TextDecoder(h);return l.arrayBuffer().then(d=>u.decode(d))}}}).then(l=>{zxe.add(o,l);let c=zE[o];delete zE[o];for(let h=0,u=c.length;h<u;h++){let d=c[h];d.onLoad&&d.onLoad(l)}}).catch(l=>{let c=zE[o];if(c===void 0)throw this.manager.itemError(o),l;delete zE[o];for(let h=0,u=c.length;h<u;h++){let d=c[h];d.onError&&d.onError(l)}this.manager.itemError(o)}).finally(()=>{this.manager.itemEnd(o)}),this.manager.itemStart(o)}setResponseType(o){return this.responseType=o,this}setMimeType(o){return this.mimeType=o,this}},mst=class extends T2e{constructor(o){super(o)}load(o,t,e,r){let i=this,n=new rot,s=new fst(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(i.withCredentials),s.load(o,function(a){let l;try{l=i.parse(a)}catch(c){if(r!==void 0)r(c);else{console.error(c);return}}l.image!==void 0?n.image=l.image:l.data!==void 0&&(n.image.width=l.width,n.image.height=l.height,n.image.data=l.data),n.wrapS=l.wrapS!==void 0?l.wrapS:k_,n.wrapT=l.wrapT!==void 0?l.wrapT:k_,n.magFilter=l.magFilter!==void 0?l.magFilter:z7,n.minFilter=l.minFilter!==void 0?l.minFilter:z7,n.anisotropy=l.anisotropy!==void 0?l.anisotropy:1,l.colorSpace!==void 0&&(n.colorSpace=l.colorSpace),l.flipY!==void 0&&(n.flipY=l.flipY),l.format!==void 0&&(n.format=l.format),l.type!==void 0&&(n.type=l.type),l.mipmaps!==void 0&&(n.mipmaps=l.mipmaps,n.minFilter=kwe),l.mipmapCount===1&&(n.minFilter=z7),l.generateMipmaps!==void 0&&(n.generateMipmaps=l.generateMipmaps),n.needsUpdate=!0,t&&t(n,l)},e,r),n}},P5t=new Wc,T5t=new vt,I5t=new vt,C5t=new Wc,S5t=new vt,E5t=new vt,gst=class extends Xwe{constructor(o=-1,t=1,e=1,r=-1,i=.1,n=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=o,this.right=t,this.top=e,this.bottom=r,this.near=i,this.far=n,this.updateProjectionMatrix()}copy(o,t){return super.copy(o,t),this.left=o.left,this.right=o.right,this.top=o.top,this.bottom=o.bottom,this.near=o.near,this.far=o.far,this.zoom=o.zoom,this.view=o.view===null?null:Object.assign({},o.view),this}setViewOffset(o,t,e,r,i,n){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=o,this.view.fullHeight=t,this.view.offsetX=e,this.view.offsetY=r,this.view.width=i,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let o=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),e=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=e-o,n=e+o,s=r+t,a=r-t;if(this.view!==null&&this.view.enabled){let l=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=l*this.view.offsetX,n=i+l*this.view.width,s-=c*this.view.offsetY,a=s-c*this.view.height}this.projectionMatrix.makeOrthographic(i,n,s,a,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(o){let t=super.toJSON(o);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},O5t=new Wc,A5t=new Wc,_5t=new Wc,v5t=new vt,x5t=new z_,R5t=new vt,D5t=new vt,w5t=new vt,L5t=new z_,M5t=new vt,N5t=new vt,I2e="\\[\\]\\.:\\/",yst=new RegExp("["+I2e+"]","g"),C2e="[^"+I2e+"]",bst="[^"+I2e.replace("\\.","")+"]",Pst=/((?:WC+[\/:])*)/.source.replace("WC",C2e),Tst=/(WCOD+)?/.source.replace("WCOD",bst),Ist=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",C2e),Cst=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",C2e),Sst=new RegExp("^"+Pst+Tst+Ist+Cst+"$"),Est=["material","materials","bones","map"],Ost=class{constructor(o,t,e){let r=e||h0.parseTrackName(t);this._targetGroup=o,this._bindings=o.subscribe_(t,r)}getValue(o,t){this.bind();let e=this._targetGroup.nCachedObjects_,r=this._bindings[e];r!==void 0&&r.getValue(o,t)}setValue(o,t){let e=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=e.length;r!==i;++r)e[r].setValue(o,t)}bind(){let o=this._bindings;for(let t=this._targetGroup.nCachedObjects_,e=o.length;t!==e;++t)o[t].bind()}unbind(){let o=this._bindings;for(let t=this._targetGroup.nCachedObjects_,e=o.length;t!==e;++t)o[t].unbind()}},h0=class F7{constructor(t,e,r){this.path=e,this.parsedPath=r||F7.parseTrackName(e),this.node=F7.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,r){return t&&t.isAnimationObjectGroup?new F7.Composite(t,e,r):new F7(t,e,r)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(yst,"")}static parseTrackName(t){let e=Sst.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let r={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let n=r.nodeName.substring(i+1);Est.indexOf(n)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=n)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return r}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let r=t.skeleton.getBoneByName(e);if(r!==void 0)return r}if(t.children){let r=function(n){for(let s=0;s<n.length;s++){let a=n[s];if(a.name===e||a.uuid===e)return a;let l=r(a.children);if(l)return l}return null},i=r(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let r=this.resolvedProperty;for(let i=0,n=r.length;i!==n;++i)t[e++]=r[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let r=this.resolvedProperty;for(let i=0,n=r.length;i!==n;++i)r[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let r=this.resolvedProperty;for(let i=0,n=r.length;i!==n;++i)r[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let r=this.resolvedProperty;for(let i=0,n=r.length;i!==n;++i)r[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,r=e.objectName,i=e.propertyName,n=e.propertyIndex;if(t||(t=F7.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(r){let c=e.objectIndex;switch(r){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let h=0;h<t.length;h++)if(t[h].name===c){c=h;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[r]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[r]}if(c!==void 0){if(t[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[c]}}let s=t[i];if(s===void 0){let c=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",t);return}let a=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?a=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(n!==void 0){if(i==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[n]!==void 0&&(n=t.morphTargetDictionary[n])}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=n}else s.fromArray!==void 0&&s.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};h0.Composite=Ost;h0.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};h0.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};h0.prototype.GetterByBindingType=[h0.prototype._getValue_direct,h0.prototype._getValue_array,h0.prototype._getValue_arrayElement,h0.prototype._getValue_toArray];h0.prototype.SetterByBindingTypeAndVersioning=[[h0.prototype._setValue_direct,h0.prototype._setValue_direct_setNeedsUpdate,h0.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[h0.prototype._setValue_array,h0.prototype._setValue_array_setNeedsUpdate,h0.prototype._setValue_array_setMatrixWorldNeedsUpdate],[h0.prototype._setValue_arrayElement,h0.prototype._setValue_arrayElement_setNeedsUpdate,h0.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[h0.prototype._setValue_fromArray,h0.prototype._setValue_fromArray_setNeedsUpdate,h0.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var k5t=new Float32Array(1),B5t=new Wc,F5t=new fn,V5t=new vt,G5t=new vt,U5t=new vt,H5t=new vt,W5t=new Wc,z5t=new Wc,Y5t=new vt,j5t=new W0,X5t=new W0,q5t=new vt,$5t=new vt,K5t=new vt,Z5t=new vt,J5t=new Xwe,Q5t=new Y_,e7t=new vt;typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"172"}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="172");var Ast=`#ifdef USE_ALPHAHASH
	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,_st=`#ifdef USE_ALPHAHASH
	const float ALPHA_HASH_SCALE = 0.05;
	float hash2D( vec2 value ) {
		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
	}
	float hash3D( vec3 value ) {
		return hash2D( vec2( hash2D( value.xy ), value.z ) );
	}
	float getAlphaHashThreshold( vec3 position ) {
		float maxDeriv = max(
			length( dFdx( position.xyz ) ),
			length( dFdy( position.xyz ) )
		);
		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
		vec2 pixScales = vec2(
			exp2( floor( log2( pixScale ) ) ),
			exp2( ceil( log2( pixScale ) ) )
		);
		vec2 alpha = vec2(
			hash3D( floor( pixScales.x * position.xyz ) ),
			hash3D( floor( pixScales.y * position.xyz ) )
		);
		float lerpFactor = fract( log2( pixScale ) );
		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
		float a = min( lerpFactor, 1.0 - lerpFactor );
		vec3 cases = vec3(
			x * x / ( 2.0 * a * ( 1.0 - a ) ),
			( x - 0.5 * a ) / ( 1.0 - a ),
			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
		);
		float threshold = ( x < ( 1.0 - a ) )
			? ( ( x < a ) ? cases.x : cases.y )
			: cases.z;
		return clamp( threshold , 1.0e-6, 1.0 );
	}
#endif`,vst=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,xst=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,Rst=`#ifdef USE_ALPHATEST
	#ifdef ALPHA_TO_COVERAGE
	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
	if ( diffuseColor.a == 0.0 ) discard;
	#else
	if ( diffuseColor.a < alphaTest ) discard;
	#endif
#endif`,Dst=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,wst=`#ifdef USE_AOMAP
	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
	reflectedLight.indirectDiffuse *= ambientOcclusion;
	#if defined( USE_CLEARCOAT ) 
		clearcoatSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_SHEEN ) 
		sheenSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD )
		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
	#endif
#endif`,Lst=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,Mst=`#ifdef USE_BATCHING
	#if ! defined( GL_ANGLE_multi_draw )
	#define gl_DrawID _gl_DrawID
	uniform int _gl_DrawID;
	#endif
	uniform highp sampler2D batchingTexture;
	uniform highp usampler2D batchingIdTexture;
	mat4 getBatchingMatrix( const in float i ) {
		int size = textureSize( batchingTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
	float getIndirectIndex( const in int i ) {
		int size = textureSize( batchingIdTexture, 0 ).x;
		int x = i % size;
		int y = i / size;
		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
	}
#endif
#ifdef USE_BATCHING_COLOR
	uniform sampler2D batchingColorTexture;
	vec3 getBatchingColor( const in float i ) {
		int size = textureSize( batchingColorTexture, 0 ).x;
		int j = int( i );
		int x = j % size;
		int y = j / size;
		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
	}
#endif`,Nst=`#ifdef USE_BATCHING
	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,kst=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
	vPosition = vec3( position );
#endif`,Bst=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,Fst=`float G_BlinnPhong_Implicit( ) {
	return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
	float G = G_BlinnPhong_Implicit( );
	float D = D_BlinnPhong( shininess, dotNH );
	return F * ( G * D );
} // validated`,Vst=`#ifdef USE_IRIDESCENCE
	const mat3 XYZ_TO_REC709 = mat3(
		 3.2404542, -0.9692660,  0.0556434,
		-1.5371385,  1.8760108, -0.2040259,
		-0.4985314,  0.0415560,  1.0572252
	);
	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
		vec3 sqrtF0 = sqrt( fresnel0 );
		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
	}
	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
	}
	float IorToFresnel0( float transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
	}
	vec3 evalSensitivity( float OPD, vec3 shift ) {
		float phase = 2.0 * PI * OPD * 1.0e-9;
		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
		xyz /= 1.0685e-7;
		vec3 rgb = XYZ_TO_REC709 * xyz;
		return rgb;
	}
	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
		vec3 I;
		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
		float cosTheta2Sq = 1.0 - sinTheta2Sq;
		if ( cosTheta2Sq < 0.0 ) {
			return vec3( 1.0 );
		}
		float cosTheta2 = sqrt( cosTheta2Sq );
		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
		float T121 = 1.0 - R12;
		float phi12 = 0.0;
		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
		float phi21 = PI - phi12;
		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
		vec3 phi23 = vec3( 0.0 );
		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
		vec3 phi = vec3( phi21 ) + phi23;
		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
		vec3 r123 = sqrt( R123 );
		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
		vec3 C0 = R12 + Rs;
		I = C0;
		vec3 Cm = Rs - T121;
		for ( int m = 1; m <= 2; ++ m ) {
			Cm *= r123;
			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
			I += Cm * Sm;
		}
		return max( I, vec3( 0.0 ) );
	}
#endif`,Gst=`#ifdef USE_BUMPMAP
	uniform sampler2D bumpMap;
	uniform float bumpScale;
	vec2 dHdxy_fwd() {
		vec2 dSTdx = dFdx( vBumpMapUv );
		vec2 dSTdy = dFdy( vBumpMapUv );
		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
		return vec2( dBx, dBy );
	}
	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
		vec3 vN = surf_norm;
		vec3 R1 = cross( vSigmaY, vN );
		vec3 R2 = cross( vN, vSigmaX );
		float fDet = dot( vSigmaX, R1 ) * faceDirection;
		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
		return normalize( abs( fDet ) * surf_norm - vGrad );
	}
#endif`,Ust=`#if NUM_CLIPPING_PLANES > 0
	vec4 plane;
	#ifdef ALPHA_TO_COVERAGE
		float distanceToPlane, distanceGradient;
		float clipOpacity = 1.0;
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
			distanceGradient = fwidth( distanceToPlane ) / 2.0;
			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			if ( clipOpacity == 0.0 ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			float unionClipOpacity = 1.0;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
				distanceGradient = fwidth( distanceToPlane ) / 2.0;
				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			}
			#pragma unroll_loop_end
			clipOpacity *= 1.0 - unionClipOpacity;
		#endif
		diffuseColor.a *= clipOpacity;
		if ( diffuseColor.a == 0.0 ) discard;
	#else
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			bool clipped = true;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
			}
			#pragma unroll_loop_end
			if ( clipped ) discard;
		#endif
	#endif
#endif`,Hst=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,Wst=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`,zst=`#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`,Yst=`#if defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#elif defined( USE_COLOR )
	diffuseColor.rgb *= vColor;
#endif`,jst=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR )
	varying vec3 vColor;
#endif`,Xst=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	varying vec3 vColor;
#endif`,qst=`#if defined( USE_COLOR_ALPHA )
	vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
	vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
	vColor.xyz *= instanceColor.xyz;
#endif
#ifdef USE_BATCHING_COLOR
	vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
	vColor.xyz *= batchingColor.xyz;
#endif`,$st=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
	return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
	float precisionSafeLength( vec3 v ) { return length( v ); }
#else
	float precisionSafeLength( vec3 v ) {
		float maxComponent = max3( abs( v ) );
		return length( v / maxComponent ) * maxComponent;
	}
#endif
struct IncidentLight {
	vec3 color;
	vec3 direction;
	bool visible;
};
struct ReflectedLight {
	vec3 directDiffuse;
	vec3 directSpecular;
	vec3 indirectDiffuse;
	vec3 indirectSpecular;
};
#ifdef USE_ALPHAHASH
	varying vec3 vPosition;
#endif
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
mat3 transposeMat3( const in mat3 m ) {
	mat3 tmp;
	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
	return tmp;
}
bool isPerspectiveMatrix( mat4 m ) {
	return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
	return vec2( u, v );
}
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
	return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
} // validated`,Kst=`#ifdef ENVMAP_TYPE_CUBE_UV
	#define cubeUV_minMipLevel 4.0
	#define cubeUV_minTileSize 16.0
	float getFace( vec3 direction ) {
		vec3 absDirection = abs( direction );
		float face = - 1.0;
		if ( absDirection.x > absDirection.z ) {
			if ( absDirection.x > absDirection.y )
				face = direction.x > 0.0 ? 0.0 : 3.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		} else {
			if ( absDirection.z > absDirection.y )
				face = direction.z > 0.0 ? 2.0 : 5.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		}
		return face;
	}
	vec2 getUV( vec3 direction, float face ) {
		vec2 uv;
		if ( face == 0.0 ) {
			uv = vec2( direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 1.0 ) {
			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
		} else if ( face == 2.0 ) {
			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
		} else if ( face == 3.0 ) {
			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 4.0 ) {
			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
		} else {
			uv = vec2( direction.x, direction.y ) / abs( direction.z );
		}
		return 0.5 * ( uv + 1.0 );
	}
	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
		float face = getFace( direction );
		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
		mipInt = max( mipInt, cubeUV_minMipLevel );
		float faceSize = exp2( mipInt );
		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
		if ( face > 2.0 ) {
			uv.y += faceSize;
			face -= 3.0;
		}
		uv.x += face * faceSize;
		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
		uv.x *= CUBEUV_TEXEL_WIDTH;
		uv.y *= CUBEUV_TEXEL_HEIGHT;
		#ifdef texture2DGradEXT
			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
		#else
			return texture2D( envMap, uv ).rgb;
		#endif
	}
	#define cubeUV_r0 1.0
	#define cubeUV_m0 - 2.0
	#define cubeUV_r1 0.8
	#define cubeUV_m1 - 1.0
	#define cubeUV_r4 0.4
	#define cubeUV_m4 2.0
	#define cubeUV_r5 0.305
	#define cubeUV_m5 3.0
	#define cubeUV_r6 0.21
	#define cubeUV_m6 4.0
	float roughnessToMip( float roughness ) {
		float mip = 0.0;
		if ( roughness >= cubeUV_r1 ) {
			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
		} else if ( roughness >= cubeUV_r4 ) {
			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
		} else if ( roughness >= cubeUV_r5 ) {
			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
		} else if ( roughness >= cubeUV_r6 ) {
			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
		} else {
			mip = - 2.0 * log2( 1.16 * roughness );		}
		return mip;
	}
	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
		float mipF = fract( mip );
		float mipInt = floor( mip );
		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
		if ( mipF == 0.0 ) {
			return vec4( color0, 1.0 );
		} else {
			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
			return vec4( mix( color0, color1, mipF ), 1.0 );
		}
	}
#endif`,Zst=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
	vec3 transformedTangent = objectTangent;
#endif
#ifdef USE_BATCHING
	mat3 bm = mat3( batchingMatrix );
	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
	transformedNormal = bm * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = bm * transformedTangent;
	#endif
#endif
#ifdef USE_INSTANCING
	mat3 im = mat3( instanceMatrix );
	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
	transformedNormal = im * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = im * transformedTangent;
	#endif
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
	transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
	#ifdef FLIP_SIDED
		transformedTangent = - transformedTangent;
	#endif
#endif`,Jst=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,Qst=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,eat=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
		emissiveColor = sRGBTransferEOTF( emissiveColor );
	#endif
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,tat=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,rat="gl_FragColor = linearToOutputTexel( gl_FragColor );",iat=`vec4 LinearTransferOETF( in vec4 value ) {
	return value;
}
vec4 sRGBTransferEOTF( in vec4 value ) {
	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
}
vec4 sRGBTransferOETF( in vec4 value ) {
	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}`,nat=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vec3 cameraToFrag;
		if ( isOrthographic ) {
			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToFrag = normalize( vWorldPosition - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
		#else
			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
		#endif
	#else
		vec3 reflectVec = vReflect;
	#endif
	#ifdef ENVMAP_TYPE_CUBE
		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
	#else
		vec4 envColor = vec4( 0.0 );
	#endif
	#ifdef ENVMAP_BLENDING_MULTIPLY
		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_MIX )
		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_ADD )
		outgoingLight += envColor.xyz * specularStrength * reflectivity;
	#endif
#endif`,oat=`#ifdef USE_ENVMAP
	uniform float envMapIntensity;
	uniform float flipEnvMap;
	uniform mat3 envMapRotation;
	#ifdef ENVMAP_TYPE_CUBE
		uniform samplerCube envMap;
	#else
		uniform sampler2D envMap;
	#endif
	
#endif`,sat=`#ifdef USE_ENVMAP
	uniform float reflectivity;
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		varying vec3 vWorldPosition;
		uniform float refractionRatio;
	#else
		varying vec3 vReflect;
	#endif
#endif`,aat=`#ifdef USE_ENVMAP
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		
		varying vec3 vWorldPosition;
	#else
		varying vec3 vReflect;
		uniform float refractionRatio;
	#endif
#endif`,lat=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vWorldPosition = worldPosition.xyz;
	#else
		vec3 cameraToVertex;
		if ( isOrthographic ) {
			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vReflect = reflect( cameraToVertex, worldNormal );
		#else
			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
		#endif
	#endif
#endif`,cat=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,hat=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,uat=`#ifdef USE_FOG
	#ifdef FOG_EXP2
		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
	#else
		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
	#endif
	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,dat=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,pat=`#ifdef USE_GRADIENTMAP
	uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
	float dotNL = dot( normal, lightDirection );
	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
	#ifdef USE_GRADIENTMAP
		return vec3( texture2D( gradientMap, coord ).r );
	#else
		vec2 fw = fwidth( coord ) * 0.5;
		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
	#endif
}`,fat=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,mat=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,gat=`varying vec3 vViewPosition;
struct LambertMaterial {
	vec3 diffuseColor;
	float specularStrength;
};
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Lambert
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,yat=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
	uniform vec3 lightProbe[ 9 ];
#endif
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
	float x = normal.x, y = normal.y, z = normal.z;
	vec3 result = shCoefficients[ 0 ] * 0.886227;
	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
	return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
	return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
	vec3 irradiance = ambientLightColor;
	return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
	if ( cutoffDistance > 0.0 ) {
		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
	}
	return distanceFalloff;
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
	return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
	struct DirectionalLight {
		vec3 direction;
		vec3 color;
	};
	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
		light.color = directionalLight.color;
		light.direction = directionalLight.direction;
		light.visible = true;
	}
#endif
#if NUM_POINT_LIGHTS > 0
	struct PointLight {
		vec3 position;
		vec3 color;
		float distance;
		float decay;
	};
	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = pointLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float lightDistance = length( lVector );
		light.color = pointLight.color;
		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
		light.visible = ( light.color != vec3( 0.0 ) );
	}
#endif
#if NUM_SPOT_LIGHTS > 0
	struct SpotLight {
		vec3 position;
		vec3 direction;
		vec3 color;
		float distance;
		float decay;
		float coneCos;
		float penumbraCos;
	};
	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = spotLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float angleCos = dot( light.direction, spotLight.direction );
		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
		if ( spotAttenuation > 0.0 ) {
			float lightDistance = length( lVector );
			light.color = spotLight.color * spotAttenuation;
			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
			light.visible = ( light.color != vec3( 0.0 ) );
		} else {
			light.color = vec3( 0.0 );
			light.visible = false;
		}
	}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
	struct RectAreaLight {
		vec3 color;
		vec3 position;
		vec3 halfWidth;
		vec3 halfHeight;
	};
	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
	struct HemisphereLight {
		vec3 direction;
		vec3 skyColor;
		vec3 groundColor;
	};
	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
		float dotNL = dot( normal, hemiLight.direction );
		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
		return irradiance;
	}
#endif`,bat=`#ifdef USE_ENVMAP
	vec3 getIBLIrradiance( const in vec3 normal ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
			return PI * envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 reflectVec = reflect( - viewDir, normal );
			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
			return envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	#ifdef USE_ANISOTROPY
		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
			#ifdef ENVMAP_TYPE_CUBE_UV
				vec3 bentNormal = cross( bitangent, viewDir );
				bentNormal = normalize( cross( bentNormal, bitangent ) );
				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
				return getIBLRadiance( viewDir, bentNormal, roughness );
			#else
				return vec3( 0.0 );
			#endif
		}
	#endif
#endif`,Pat=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,Tat=`varying vec3 vViewPosition;
struct ToonMaterial {
	vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Toon
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,Iat=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,Cat=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
	vec3 diffuseColor;
	vec3 specularColor;
	float specularShininess;
	float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_BlinnPhong
#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,Sat=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
	material.ior = ior;
	#ifdef USE_SPECULAR
		float specularIntensityFactor = specularIntensity;
		vec3 specularColorFactor = specularColor;
		#ifdef USE_SPECULAR_COLORMAP
			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
		#endif
		#ifdef USE_SPECULAR_INTENSITYMAP
			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
		#endif
		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
	#else
		float specularIntensityFactor = 1.0;
		vec3 specularColorFactor = vec3( 1.0 );
		material.specularF90 = 1.0;
	#endif
	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
#else
	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
	material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
	material.clearcoat = clearcoat;
	material.clearcoatRoughness = clearcoatRoughness;
	material.clearcoatF0 = vec3( 0.04 );
	material.clearcoatF90 = 1.0;
	#ifdef USE_CLEARCOATMAP
		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
	#endif
	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
	#endif
	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
	material.clearcoatRoughness += geometryRoughness;
	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_DISPERSION
	material.dispersion = dispersion;
#endif
#ifdef USE_IRIDESCENCE
	material.iridescence = iridescence;
	material.iridescenceIOR = iridescenceIOR;
	#ifdef USE_IRIDESCENCEMAP
		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
	#endif
	#ifdef USE_IRIDESCENCE_THICKNESSMAP
		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
	#else
		material.iridescenceThickness = iridescenceThicknessMaximum;
	#endif
#endif
#ifdef USE_SHEEN
	material.sheenColor = sheenColor;
	#ifdef USE_SHEEN_COLORMAP
		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
	#endif
	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
	#ifdef USE_SHEEN_ROUGHNESSMAP
		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
	#endif
#endif
#ifdef USE_ANISOTROPY
	#ifdef USE_ANISOTROPYMAP
		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
	#else
		vec2 anisotropyV = anisotropyVector;
	#endif
	material.anisotropy = length( anisotropyV );
	if( material.anisotropy == 0.0 ) {
		anisotropyV = vec2( 1.0, 0.0 );
	} else {
		anisotropyV /= material.anisotropy;
		material.anisotropy = saturate( material.anisotropy );
	}
	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
#endif`,Eat=`struct PhysicalMaterial {
	vec3 diffuseColor;
	float roughness;
	vec3 specularColor;
	float specularF90;
	float dispersion;
	#ifdef USE_CLEARCOAT
		float clearcoat;
		float clearcoatRoughness;
		vec3 clearcoatF0;
		float clearcoatF90;
	#endif
	#ifdef USE_IRIDESCENCE
		float iridescence;
		float iridescenceIOR;
		float iridescenceThickness;
		vec3 iridescenceFresnel;
		vec3 iridescenceF0;
	#endif
	#ifdef USE_SHEEN
		vec3 sheenColor;
		float sheenRoughness;
	#endif
	#ifdef IOR
		float ior;
	#endif
	#ifdef USE_TRANSMISSION
		float transmission;
		float transmissionAlpha;
		float thickness;
		float attenuationDistance;
		vec3 attenuationColor;
	#endif
	#ifdef USE_ANISOTROPY
		float anisotropy;
		float alphaT;
		vec3 anisotropyT;
		vec3 anisotropyB;
	#endif
};
vec3 clearcoatSpecularDirect = vec3( 0.0 );
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
vec3 sheenSpecularDirect = vec3( 0.0 );
vec3 sheenSpecularIndirect = vec3(0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
    float x2 = x * x;
    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
	float a2 = pow2( alpha );
	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
	return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
	float a2 = pow2( alpha );
	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
	return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_ANISOTROPY
	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
		float v = 0.5 / ( gv + gl );
		return saturate(v);
	}
	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
		float a2 = alphaT * alphaB;
		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
		highp float v2 = dot( v, v );
		float w2 = a2 / v2;
		return RECIPROCAL_PI * a2 * pow2 ( w2 );
	}
#endif
#ifdef USE_CLEARCOAT
	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
		vec3 f0 = material.clearcoatF0;
		float f90 = material.clearcoatF90;
		float roughness = material.clearcoatRoughness;
		float alpha = pow2( roughness );
		vec3 halfDir = normalize( lightDir + viewDir );
		float dotNL = saturate( dot( normal, lightDir ) );
		float dotNV = saturate( dot( normal, viewDir ) );
		float dotNH = saturate( dot( normal, halfDir ) );
		float dotVH = saturate( dot( viewDir, halfDir ) );
		vec3 F = F_Schlick( f0, f90, dotVH );
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
		return F * ( V * D );
	}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
	vec3 f0 = material.specularColor;
	float f90 = material.specularF90;
	float roughness = material.roughness;
	float alpha = pow2( roughness );
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( f0, f90, dotVH );
	#ifdef USE_IRIDESCENCE
		F = mix( F, material.iridescenceFresnel, material.iridescence );
	#endif
	#ifdef USE_ANISOTROPY
		float dotTL = dot( material.anisotropyT, lightDir );
		float dotTV = dot( material.anisotropyT, viewDir );
		float dotTH = dot( material.anisotropyT, halfDir );
		float dotBL = dot( material.anisotropyB, lightDir );
		float dotBV = dot( material.anisotropyB, viewDir );
		float dotBH = dot( material.anisotropyB, halfDir );
		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
	#else
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
	#endif
	return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
	const float LUT_SIZE = 64.0;
	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
	const float LUT_BIAS = 0.5 / LUT_SIZE;
	float dotNV = saturate( dot( N, V ) );
	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
	uv = uv * LUT_SCALE + LUT_BIAS;
	return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
	float l = length( f );
	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
	float x = dot( v1, v2 );
	float y = abs( x );
	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
	float b = 3.4175940 + ( 4.1616724 + y ) * y;
	float v = a / b;
	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
	return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
	vec3 lightNormal = cross( v1, v2 );
	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
	vec3 T1, T2;
	T1 = normalize( V - N * dot( V, N ) );
	T2 = - cross( N, T1 );
	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
	vec3 coords[ 4 ];
	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
	coords[ 0 ] = normalize( coords[ 0 ] );
	coords[ 1 ] = normalize( coords[ 1 ] );
	coords[ 2 ] = normalize( coords[ 2 ] );
	coords[ 3 ] = normalize( coords[ 3 ] );
	vec3 vectorFormFactor = vec3( 0.0 );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
	return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
	float alpha = pow2( roughness );
	float invAlpha = 1.0 / alpha;
	float cos2h = dotNH * dotNH;
	float sin2h = max( 1.0 - cos2h, 0.0078125 );
	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float D = D_Charlie( sheenRoughness, dotNH );
	float V = V_Neubelt( dotNV, dotNL );
	return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	float r2 = roughness * roughness;
	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
	return saturate( DG * RECIPROCAL_PI );
}
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
	vec4 r = roughness * c0 + c1;
	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
	return fab;
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	#ifdef USE_IRIDESCENCE
		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
	#else
		vec3 Fr = specularColor;
	#endif
	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
	float Ess = fab.x + fab.y;
	float Ems = 1.0 - Ess;
	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
	singleScatter += FssEss;
	multiScatter += Fms * Ems;
}
#if NUM_RECT_AREA_LIGHTS > 0
	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
		vec3 normal = geometryNormal;
		vec3 viewDir = geometryViewDir;
		vec3 position = geometryPosition;
		vec3 lightPos = rectAreaLight.position;
		vec3 halfWidth = rectAreaLight.halfWidth;
		vec3 halfHeight = rectAreaLight.halfHeight;
		vec3 lightColor = rectAreaLight.color;
		float roughness = material.roughness;
		vec3 rectCoords[ 4 ];
		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
		vec2 uv = LTC_Uv( normal, viewDir, roughness );
		vec4 t1 = texture2D( ltc_1, uv );
		vec4 t2 = texture2D( ltc_2, uv );
		mat3 mInv = mat3(
			vec3( t1.x, 0, t1.y ),
			vec3(    0, 1,    0 ),
			vec3( t1.z, 0, t1.w )
		);
		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
	}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	#ifdef USE_CLEARCOAT
		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
		vec3 ccIrradiance = dotNLcc * directLight.color;
		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
	#endif
	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
	#ifdef USE_CLEARCOAT
		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
	#endif
	vec3 singleScattering = vec3( 0.0 );
	vec3 multiScattering = vec3( 0.0 );
	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
	#ifdef USE_IRIDESCENCE
		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
	#else
		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
	#endif
	vec3 totalScattering = singleScattering + multiScattering;
	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
	reflectedLight.indirectSpecular += radiance * singleScattering;
	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct				RE_Direct_Physical
#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,Oat=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryClearcoatNormal = vec3( 0.0 );
#ifdef USE_CLEARCOAT
	geometryClearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
	float dotNVi = saturate( dot( normal, geometryViewDir ) );
	if ( material.iridescenceThickness == 0.0 ) {
		material.iridescence = 0.0;
	} else {
		material.iridescence = saturate( material.iridescence );
	}
	if ( material.iridescence > 0.0 ) {
		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
	}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
	PointLight pointLight;
	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		pointLight = pointLights[ i ];
		getPointLightInfo( pointLight, geometryPosition, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
		pointLightShadow = pointLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
	SpotLight spotLight;
	vec4 spotColor;
	vec3 spotLightCoord;
	bool inSpotLightMap;
	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		spotLight = spotLights[ i ];
		getSpotLightInfo( spotLight, geometryPosition, directLight );
		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
		#else
		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#endif
		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
		#endif
		#undef SPOT_LIGHT_MAP_INDEX
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		spotLightShadow = spotLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
	DirectionalLight directionalLight;
	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		directionalLight = directionalLights[ i ];
		getDirectionalLightInfo( directionalLight, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
		directionalLightShadow = directionalLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
	RectAreaLight rectAreaLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
		rectAreaLight = rectAreaLights[ i ];
		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
	vec3 iblIrradiance = vec3( 0.0 );
	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
	#if defined( USE_LIGHT_PROBES )
		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
	#endif
	#if ( NUM_HEMI_LIGHTS > 0 )
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
		}
		#pragma unroll_loop_end
	#endif
#endif
#if defined( RE_IndirectSpecular )
	vec3 radiance = vec3( 0.0 );
	vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,Aat=`#if defined( RE_IndirectDiffuse )
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
		irradiance += lightMapIrradiance;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
		iblIrradiance += getIBLIrradiance( geometryNormal );
	#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
	#ifdef USE_ANISOTROPY
		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
	#else
		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
	#endif
	#ifdef USE_CLEARCOAT
		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
	#endif
#endif`,_at=`#if defined( RE_IndirectDiffuse )
	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif`,vat=`#if defined( USE_LOGDEPTHBUF )
	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,xat=`#if defined( USE_LOGDEPTHBUF )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,Rat=`#ifdef USE_LOGDEPTHBUF
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,Dat=`#ifdef USE_LOGDEPTHBUF
	vFragDepth = 1.0 + gl_Position.w;
	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,wat=`#ifdef USE_MAP
	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
	#ifdef DECODE_VIDEO_TEXTURE
		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
	#endif
	diffuseColor *= sampledDiffuseColor;
#endif`,Lat=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,Mat=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
	#if defined( USE_POINTS_UV )
		vec2 uv = vUv;
	#else
		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
	#endif
#endif
#ifdef USE_MAP
	diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,Nat=`#if defined( USE_POINTS_UV )
	varying vec2 vUv;
#else
	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
		uniform mat3 uvTransform;
	#endif
#endif
#ifdef USE_MAP
	uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,kat=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
	metalnessFactor *= texelMetalness.b;
#endif`,Bat=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,Fat=`#ifdef USE_INSTANCING_MORPH
	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
	}
#endif`,Vat=`#if defined( USE_MORPHCOLORS )
	vColor *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		#if defined( USE_COLOR_ALPHA )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
		#elif defined( USE_COLOR )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
		#endif
	}
#endif`,Gat=`#ifdef USE_MORPHNORMALS
	objectNormal *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,Uat=`#ifdef USE_MORPHTARGETS
	#ifndef USE_INSTANCING_MORPH
		uniform float morphTargetBaseInfluence;
		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	#endif
	uniform sampler2DArray morphTargetsTexture;
	uniform ivec2 morphTargetsTextureSize;
	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
		int y = texelIndex / morphTargetsTextureSize.x;
		int x = texelIndex - y * morphTargetsTextureSize.x;
		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
		return texelFetch( morphTargetsTexture, morphUV, 0 );
	}
#endif`,Hat=`#ifdef USE_MORPHTARGETS
	transformed *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,Wat=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
	vec3 fdx = dFdx( vViewPosition );
	vec3 fdy = dFdy( vViewPosition );
	vec3 normal = normalize( cross( fdx, fdy ) );
#else
	vec3 normal = normalize( vNormal );
	#ifdef DOUBLE_SIDED
		normal *= faceDirection;
	#endif
#endif
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
	#ifdef USE_TANGENT
		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn = getTangentFrame( - vViewPosition, normal,
		#if defined( USE_NORMALMAP )
			vNormalMapUv
		#elif defined( USE_CLEARCOAT_NORMALMAP )
			vClearcoatNormalMapUv
		#else
			vUv
		#endif
		);
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn[0] *= faceDirection;
		tbn[1] *= faceDirection;
	#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	#ifdef USE_TANGENT
		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn2[0] *= faceDirection;
		tbn2[1] *= faceDirection;
	#endif
#endif
vec3 nonPerturbedNormal = normal;`,zat=`#ifdef USE_NORMALMAP_OBJECTSPACE
	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	#ifdef FLIP_SIDED
		normal = - normal;
	#endif
	#ifdef DOUBLE_SIDED
		normal = normal * faceDirection;
	#endif
	normal = normalize( normalMatrix * normal );
#elif defined( USE_NORMALMAP_TANGENTSPACE )
	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	mapN.xy *= normalScale;
	normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,Yat=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,jat=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,Xat=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif`,qat=`#ifdef USE_NORMALMAP
	uniform sampler2D normalMap;
	uniform vec2 normalScale;
#endif
#ifdef USE_NORMALMAP_OBJECTSPACE
	uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
		vec3 q0 = dFdx( eye_pos.xyz );
		vec3 q1 = dFdy( eye_pos.xyz );
		vec2 st0 = dFdx( uv.st );
		vec2 st1 = dFdy( uv.st );
		vec3 N = surf_norm;
		vec3 q1perp = cross( q1, N );
		vec3 q0perp = cross( N, q0 );
		vec3 T = q1perp * st0.x + q0perp * st1.x;
		vec3 B = q1perp * st0.y + q0perp * st1.y;
		float det = max( dot( T, T ), dot( B, B ) );
		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
		return mat3( T * scale, B * scale, N );
	}
#endif`,$at=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,Kat=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,Zat=`#ifdef USE_CLEARCOATMAP
	uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform sampler2D clearcoatNormalMap;
	uniform vec2 clearcoatNormalScale;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform sampler2D clearcoatRoughnessMap;
#endif`,Jat=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,Qat=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,elt=`vec3 packNormalToRGB( const in vec3 normal ) {
	return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
	return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
const float Inv255 = 1. / 255.;
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
vec4 packDepthToRGBA( const in float v ) {
	if( v <= 0.0 )
		return vec4( 0., 0., 0., 0. );
	if( v >= 1.0 )
		return vec4( 1., 1., 1., 1. );
	float vuf;
	float af = modf( v * PackFactors.a, vuf );
	float bf = modf( vuf * ShiftRight8, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
}
vec3 packDepthToRGB( const in float v ) {
	if( v <= 0.0 )
		return vec3( 0., 0., 0. );
	if( v >= 1.0 )
		return vec3( 1., 1., 1. );
	float vuf;
	float bf = modf( v * PackFactors.b, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec3( vuf * Inv255, gf * PackUpscale, bf );
}
vec2 packDepthToRG( const in float v ) {
	if( v <= 0.0 )
		return vec2( 0., 0. );
	if( v >= 1.0 )
		return vec2( 1., 1. );
	float vuf;
	float gf = modf( v * 256., vuf );
	return vec2( vuf * Inv255, gf );
}
float unpackRGBAToDepth( const in vec4 v ) {
	return dot( v, UnpackFactors4 );
}
float unpackRGBToDepth( const in vec3 v ) {
	return dot( v, UnpackFactors3 );
}
float unpackRGToDepth( const in vec2 v ) {
	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
}
vec4 pack2HalfToRGBA( const in vec2 v ) {
	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( const in vec4 v ) {
	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
	return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
	return depth * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
	return ( near * far ) / ( ( far - near ) * depth - far );
}`,tlt=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,rlt=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
	mvPosition = batchingMatrix * mvPosition;
#endif
#ifdef USE_INSTANCING
	mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,ilt=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,nlt=`#ifdef DITHERING
	vec3 dithering( vec3 color ) {
		float grid_position = rand( gl_FragCoord.xy );
		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
		return color + dither_shift_RGB;
	}
#endif`,olt=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
	roughnessFactor *= texelRoughness.g;
#endif`,slt=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,alt=`#if NUM_SPOT_LIGHT_COORDS > 0
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
	}
	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
		return unpackRGBATo2Half( texture2D( shadow, uv ) );
	}
	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
		float occlusion = 1.0;
		vec2 distribution = texture2DDistribution( shadow, uv );
		float hard_shadow = step( compare , distribution.x );
		if (hard_shadow != 1.0 ) {
			float distance = compare - distribution.x ;
			float variance = max( 0.00000, distribution.y * distribution.y );
			float softness_probability = variance / (variance + distance * distance );			softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );			occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
		}
		return occlusion;
	}
	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
		float shadow = 1.0;
		shadowCoord.xyz /= shadowCoord.w;
		shadowCoord.z += shadowBias;
		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
		if ( frustumTest ) {
		#if defined( SHADOWMAP_TYPE_PCF )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx0 = - texelSize.x * shadowRadius;
			float dy0 = - texelSize.y * shadowRadius;
			float dx1 = + texelSize.x * shadowRadius;
			float dy1 = + texelSize.y * shadowRadius;
			float dx2 = dx0 / 2.0;
			float dy2 = dy0 / 2.0;
			float dx3 = dx1 / 2.0;
			float dy3 = dy1 / 2.0;
			shadow = (
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
			) * ( 1.0 / 17.0 );
		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx = texelSize.x;
			float dy = texelSize.y;
			vec2 uv = shadowCoord.xy;
			vec2 f = fract( uv * shadowMapSize + 0.5 );
			uv -= f * texelSize;
			shadow = (
				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
						  f.x ),
					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
						  f.x ),
					 f.y )
			) * ( 1.0 / 9.0 );
		#elif defined( SHADOWMAP_TYPE_VSM )
			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
		#else
			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
		#endif
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
	vec2 cubeToUV( vec3 v, float texelSizeY ) {
		vec3 absV = abs( v );
		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
		absV *= scaleToCube;
		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
		vec2 planar = v.xy;
		float almostATexel = 1.5 * texelSizeY;
		float almostOne = 1.0 - almostATexel;
		if ( absV.z >= almostOne ) {
			if ( v.z > 0.0 )
				planar.x = 4.0 - v.x;
		} else if ( absV.x >= almostOne ) {
			float signX = sign( v.x );
			planar.x = v.z * signX + 2.0 * signX;
		} else if ( absV.y >= almostOne ) {
			float signY = sign( v.y );
			planar.x = v.x + 2.0 * signY + 2.0;
			planar.y = v.z * signY - 2.0;
		}
		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
	}
	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		float shadow = 1.0;
		vec3 lightToPosition = shadowCoord.xyz;
		
		float lightToPositionLength = length( lightToPosition );
		if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
			float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );			dp += shadowBias;
			vec3 bd3D = normalize( lightToPosition );
			vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
			#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
				vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
				shadow = (
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
				) * ( 1.0 / 9.0 );
			#else
				shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
			#endif
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
#endif`,llt=`#if NUM_SPOT_LIGHT_COORDS > 0
	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
#endif`,clt=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
	vec4 shadowWorldPosition;
#endif
#if defined( USE_SHADOWMAP )
	#if NUM_DIR_LIGHT_SHADOWS > 0
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
#endif
#if NUM_SPOT_LIGHT_COORDS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
		shadowWorldPosition = worldPosition;
		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
		#endif
		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
	}
	#pragma unroll_loop_end
#endif`,hlt=`float getShadowMask() {
	float shadow = 1.0;
	#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
		directionalLight = directionalLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
		spotLight = spotLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
		pointLight = pointLightShadows[ i ];
		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#endif
	return shadow;
}`,ult=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,dlt=`#ifdef USE_SKINNING
	uniform mat4 bindMatrix;
	uniform mat4 bindMatrixInverse;
	uniform highp sampler2D boneTexture;
	mat4 getBoneMatrix( const in float i ) {
		int size = textureSize( boneTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
#endif`,plt=`#ifdef USE_SKINNING
	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
	vec4 skinned = vec4( 0.0 );
	skinned += boneMatX * skinVertex * skinWeight.x;
	skinned += boneMatY * skinVertex * skinWeight.y;
	skinned += boneMatZ * skinVertex * skinWeight.z;
	skinned += boneMatW * skinVertex * skinWeight.w;
	transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,flt=`#ifdef USE_SKINNING
	mat4 skinMatrix = mat4( 0.0 );
	skinMatrix += skinWeight.x * boneMatX;
	skinMatrix += skinWeight.y * boneMatY;
	skinMatrix += skinWeight.z * boneMatZ;
	skinMatrix += skinWeight.w * boneMatW;
	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
	#ifdef USE_TANGENT
		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
	#endif
#endif`,mlt=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,glt=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,ylt=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,blt=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
	return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 CineonToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	color = max( vec3( 0.0 ), color - 0.004 );
	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
	return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
	const mat3 ACESInputMat = mat3(
		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
		vec3( 0.04823, 0.01566, 0.83777 )
	);
	const mat3 ACESOutputMat = mat3(
		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
		vec3( -0.07367, -0.00605,  1.07602 )
	);
	color *= toneMappingExposure / 0.6;
	color = ACESInputMat * color;
	color = RRTAndODTFit( color );
	color = ACESOutputMat * color;
	return saturate( color );
}
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
	vec3( 1.6605, - 0.1246, - 0.0182 ),
	vec3( - 0.5876, 1.1329, - 0.1006 ),
	vec3( - 0.0728, - 0.0083, 1.1187 )
);
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
	vec3( 0.6274, 0.0691, 0.0164 ),
	vec3( 0.3293, 0.9195, 0.0880 ),
	vec3( 0.0433, 0.0113, 0.8956 )
);
vec3 agxDefaultContrastApprox( vec3 x ) {
	vec3 x2 = x * x;
	vec3 x4 = x2 * x2;
	return + 15.5 * x4 * x2
		- 40.14 * x4 * x
		+ 31.96 * x4
		- 6.868 * x2 * x
		+ 0.4298 * x2
		+ 0.1191 * x
		- 0.00232;
}
vec3 AgXToneMapping( vec3 color ) {
	const mat3 AgXInsetMatrix = mat3(
		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
	);
	const mat3 AgXOutsetMatrix = mat3(
		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
	);
	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
	color *= toneMappingExposure;
	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
	color = AgXInsetMatrix * color;
	color = max( color, 1e-10 );	color = log2( color );
	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
	color = clamp( color, 0.0, 1.0 );
	color = agxDefaultContrastApprox( color );
	color = AgXOutsetMatrix * color;
	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
	color = clamp( color, 0.0, 1.0 );
	return color;
}
vec3 NeutralToneMapping( vec3 color ) {
	const float StartCompression = 0.8 - 0.04;
	const float Desaturation = 0.15;
	color *= toneMappingExposure;
	float x = min( color.r, min( color.g, color.b ) );
	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
	color -= offset;
	float peak = max( color.r, max( color.g, color.b ) );
	if ( peak < StartCompression ) return color;
	float d = 1. - StartCompression;
	float newPeak = 1. - d * d / ( peak + d - StartCompression );
	color *= newPeak / peak;
	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
	return mix( color, vec3( newPeak ), g );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,Plt=`#ifdef USE_TRANSMISSION
	material.transmission = transmission;
	material.transmissionAlpha = 1.0;
	material.thickness = thickness;
	material.attenuationDistance = attenuationDistance;
	material.attenuationColor = attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
	#endif
	#ifdef USE_THICKNESSMAP
		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
	#endif
	vec3 pos = vWorldPosition;
	vec3 v = normalize( cameraPosition - pos );
	vec3 n = inverseTransformDirection( normal, viewMatrix );
	vec4 transmitted = getIBLVolumeRefraction(
		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
		material.attenuationColor, material.attenuationDistance );
	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
#endif`,Tlt=`#ifdef USE_TRANSMISSION
	uniform float transmission;
	uniform float thickness;
	uniform float attenuationDistance;
	uniform vec3 attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		uniform sampler2D transmissionMap;
	#endif
	#ifdef USE_THICKNESSMAP
		uniform sampler2D thicknessMap;
	#endif
	uniform vec2 transmissionSamplerSize;
	uniform sampler2D transmissionSamplerMap;
	uniform mat4 modelMatrix;
	uniform mat4 projectionMatrix;
	varying vec3 vWorldPosition;
	float w0( float a ) {
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
	}
	float w1( float a ) {
		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
	}
	float w2( float a ){
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
	}
	float w3( float a ) {
		return ( 1.0 / 6.0 ) * ( a * a * a );
	}
	float g0( float a ) {
		return w0( a ) + w1( a );
	}
	float g1( float a ) {
		return w2( a ) + w3( a );
	}
	float h0( float a ) {
		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
	}
	float h1( float a ) {
		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
	}
	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
		uv = uv * texelSize.zw + 0.5;
		vec2 iuv = floor( uv );
		vec2 fuv = fract( uv );
		float g0x = g0( fuv.x );
		float g1x = g1( fuv.x );
		float h0x = h0( fuv.x );
		float h1x = h1( fuv.x );
		float h0y = h0( fuv.y );
		float h1y = h1( fuv.y );
		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
	}
	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
		vec2 fLodSizeInv = 1.0 / fLodSize;
		vec2 cLodSizeInv = 1.0 / cLodSize;
		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
		return mix( fSample, cSample, fract( lod ) );
	}
	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
		vec3 modelScale;
		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
		return normalize( refractionVector ) * thickness * modelScale;
	}
	float applyIorToRoughness( const in float roughness, const in float ior ) {
		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
	}
	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
	}
	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
		if ( isinf( attenuationDistance ) ) {
			return vec3( 1.0 );
		} else {
			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
		}
	}
	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
		const in vec3 attenuationColor, const in float attenuationDistance ) {
		vec4 transmittedLight;
		vec3 transmittance;
		#ifdef USE_DISPERSION
			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
			for ( int i = 0; i < 3; i ++ ) {
				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
				vec3 refractedRayExit = position + transmissionRay;
				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
				refractionCoords += 1.0;
				refractionCoords /= 2.0;
				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
				transmittedLight[ i ] = transmissionSample[ i ];
				transmittedLight.a += transmissionSample.a;
				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
			}
			transmittedLight.a /= 3.0;
		#else
			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
			vec3 refractedRayExit = position + transmissionRay;
			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
			refractionCoords += 1.0;
			refractionCoords /= 2.0;
			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
		#endif
		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
	}
#endif`,Ilt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,Clt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	uniform mat3 mapTransform;
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	uniform mat3 alphaMapTransform;
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	uniform mat3 lightMapTransform;
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	uniform mat3 aoMapTransform;
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	uniform mat3 bumpMapTransform;
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	uniform mat3 normalMapTransform;
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
	uniform mat3 displacementMapTransform;
	varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	uniform mat3 emissiveMapTransform;
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	uniform mat3 metalnessMapTransform;
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	uniform mat3 roughnessMapTransform;
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	uniform mat3 anisotropyMapTransform;
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	uniform mat3 clearcoatMapTransform;
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform mat3 clearcoatNormalMapTransform;
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform mat3 clearcoatRoughnessMapTransform;
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	uniform mat3 sheenColorMapTransform;
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	uniform mat3 sheenRoughnessMapTransform;
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	uniform mat3 iridescenceMapTransform;
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform mat3 iridescenceThicknessMapTransform;
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
	uniform mat3 specularMapTransform;
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	uniform mat3 specularColorMapTransform;
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	uniform mat3 specularIntensityMapTransform;
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,Slt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ANISOTROPYMAP
	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
#endif`,Elt=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
	vec4 worldPosition = vec4( transformed, 1.0 );
	#ifdef USE_BATCHING
		worldPosition = batchingMatrix * worldPosition;
	#endif
	#ifdef USE_INSTANCING
		worldPosition = instanceMatrix * worldPosition;
	#endif
	worldPosition = modelMatrix * worldPosition;
#endif`,Olt=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,Alt=`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
	vec4 texColor = texture2D( t2D, vUv );
	#ifdef DECODE_VIDEO_TEXTURE
		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,_lt=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,vlt=`#ifdef ENVMAP_TYPE_CUBE
	uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
	uniform sampler2D envMap;
#endif
uniform float flipEnvMap;
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
uniform mat3 backgroundRotation;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
	#ifdef ENVMAP_TYPE_CUBE
		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
	#elif defined( ENVMAP_TYPE_CUBE_UV )
		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
	#else
		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,xlt=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,Rlt=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
	gl_FragColor = texColor;
	gl_FragColor.a *= opacity;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,Dlt=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vHighPrecisionZW = gl_Position.zw;
}`,wlt=`#if DEPTH_PACKING == 3200
	uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#if DEPTH_PACKING == 3200
		diffuseColor.a = opacity;
	#endif
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <logdepthbuf_fragment>
	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
	#if DEPTH_PACKING == 3200
		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
	#elif DEPTH_PACKING == 3201
		gl_FragColor = packDepthToRGBA( fragCoordZ );
	#elif DEPTH_PACKING == 3202
		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
	#elif DEPTH_PACKING == 3203
		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
	#endif
}`,Llt=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <worldpos_vertex>
	#include <clipping_planes_vertex>
	vWorldPosition = worldPosition.xyz;
}`,Mlt=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	float dist = length( vWorldPosition - referencePosition );
	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
	dist = saturate( dist );
	gl_FragColor = packDepthToRGBA( dist );
}`,Nlt=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,klt=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
	vec3 direction = normalize( vWorldDirection );
	vec2 sampleUV = equirectUv( direction );
	gl_FragColor = texture2D( tEquirect, sampleUV );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,Blt=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	vLineDistance = scale * lineDistance;
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,Flt=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	if ( mod( vLineDistance, totalSize ) > dashSize ) {
		discard;
	}
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,Vlt=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinbase_vertex>
		#include <skinnormal_vertex>
		#include <defaultnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <fog_vertex>
}`,Glt=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
	#else
		reflectedLight.indirectDiffuse += vec3( 1.0 );
	#endif
	#include <aomap_fragment>
	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
	vec3 outgoingLight = reflectedLight.indirectDiffuse;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Ult=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,Hlt=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_lambert_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Wlt=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
	vViewPosition = - mvPosition.xyz;
}`,zlt=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	vec3 viewDir = normalize( vViewPosition );
	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
	vec3 y = cross( viewDir, x );
	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
	#ifdef USE_MATCAP
		vec4 matcapColor = texture2D( matcap, uv );
	#else
		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
	#endif
	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Ylt=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	vViewPosition = - mvPosition.xyz;
#endif
}`,jlt=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <packing>
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
	#ifdef OPAQUE
		gl_FragColor.a = 1.0;
	#endif
}`,Xlt=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,qlt=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_phong_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,$lt=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
	varying vec3 vWorldPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
#ifdef USE_TRANSMISSION
	vWorldPosition = worldPosition.xyz;
#endif
}`,Klt=`#define STANDARD
#ifdef PHYSICAL
	#define IOR
	#define USE_SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
	uniform float ior;
#endif
#ifdef USE_SPECULAR
	uniform float specularIntensity;
	uniform vec3 specularColor;
	#ifdef USE_SPECULAR_COLORMAP
		uniform sampler2D specularColorMap;
	#endif
	#ifdef USE_SPECULAR_INTENSITYMAP
		uniform sampler2D specularIntensityMap;
	#endif
#endif
#ifdef USE_CLEARCOAT
	uniform float clearcoat;
	uniform float clearcoatRoughness;
#endif
#ifdef USE_DISPERSION
	uniform float dispersion;
#endif
#ifdef USE_IRIDESCENCE
	uniform float iridescence;
	uniform float iridescenceIOR;
	uniform float iridescenceThicknessMinimum;
	uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
	uniform vec3 sheenColor;
	uniform float sheenRoughness;
	#ifdef USE_SHEEN_COLORMAP
		uniform sampler2D sheenColorMap;
	#endif
	#ifdef USE_SHEEN_ROUGHNESSMAP
		uniform sampler2D sheenRoughnessMap;
	#endif
#endif
#ifdef USE_ANISOTROPY
	uniform vec2 anisotropyVector;
	#ifdef USE_ANISOTROPYMAP
		uniform sampler2D anisotropyMap;
	#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <roughnessmap_fragment>
	#include <metalnessmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <clearcoat_normal_fragment_begin>
	#include <clearcoat_normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_physical_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
	#include <transmission_fragment>
	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
	#ifdef USE_SHEEN
		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
	#endif
	#ifdef USE_CLEARCOAT
		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
	#endif
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Zlt=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,Jlt=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_toon_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Qlt=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#ifdef USE_POINTS_UV
	varying vec2 vUv;
	uniform mat3 uvTransform;
#endif
void main() {
	#ifdef USE_POINTS_UV
		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	#endif
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	gl_PointSize = size;
	#ifdef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
	#endif
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <fog_vertex>
}`,ect=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_particle_fragment>
	#include <color_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,tct=`#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,rct=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
	#include <logdepthbuf_fragment>
	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,ict=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	vec4 mvPosition = modelViewMatrix[ 3 ];
	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
	#ifndef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) scale *= - mvPosition.z;
	#endif
	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
	vec2 rotatedPosition;
	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
	mvPosition.xy += rotatedPosition;
	gl_Position = projectionMatrix * mvPosition;
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,nct=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,ec={alphahash_fragment:Ast,alphahash_pars_fragment:_st,alphamap_fragment:vst,alphamap_pars_fragment:xst,alphatest_fragment:Rst,alphatest_pars_fragment:Dst,aomap_fragment:wst,aomap_pars_fragment:Lst,batching_pars_vertex:Mst,batching_vertex:Nst,begin_vertex:kst,beginnormal_vertex:Bst,bsdfs:Fst,iridescence_fragment:Vst,bumpmap_pars_fragment:Gst,clipping_planes_fragment:Ust,clipping_planes_pars_fragment:Hst,clipping_planes_pars_vertex:Wst,clipping_planes_vertex:zst,color_fragment:Yst,color_pars_fragment:jst,color_pars_vertex:Xst,color_vertex:qst,common:$st,cube_uv_reflection_fragment:Kst,defaultnormal_vertex:Zst,displacementmap_pars_vertex:Jst,displacementmap_vertex:Qst,emissivemap_fragment:eat,emissivemap_pars_fragment:tat,colorspace_fragment:rat,colorspace_pars_fragment:iat,envmap_fragment:nat,envmap_common_pars_fragment:oat,envmap_pars_fragment:sat,envmap_pars_vertex:aat,envmap_physical_pars_fragment:bat,envmap_vertex:lat,fog_vertex:cat,fog_pars_vertex:hat,fog_fragment:uat,fog_pars_fragment:dat,gradientmap_pars_fragment:pat,lightmap_pars_fragment:fat,lights_lambert_fragment:mat,lights_lambert_pars_fragment:gat,lights_pars_begin:yat,lights_toon_fragment:Pat,lights_toon_pars_fragment:Tat,lights_phong_fragment:Iat,lights_phong_pars_fragment:Cat,lights_physical_fragment:Sat,lights_physical_pars_fragment:Eat,lights_fragment_begin:Oat,lights_fragment_maps:Aat,lights_fragment_end:_at,logdepthbuf_fragment:vat,logdepthbuf_pars_fragment:xat,logdepthbuf_pars_vertex:Rat,logdepthbuf_vertex:Dat,map_fragment:wat,map_pars_fragment:Lat,map_particle_fragment:Mat,map_particle_pars_fragment:Nat,metalnessmap_fragment:kat,metalnessmap_pars_fragment:Bat,morphinstance_vertex:Fat,morphcolor_vertex:Vat,morphnormal_vertex:Gat,morphtarget_pars_vertex:Uat,morphtarget_vertex:Hat,normal_fragment_begin:Wat,normal_fragment_maps:zat,normal_pars_fragment:Yat,normal_pars_vertex:jat,normal_vertex:Xat,normalmap_pars_fragment:qat,clearcoat_normal_fragment_begin:$at,clearcoat_normal_fragment_maps:Kat,clearcoat_pars_fragment:Zat,iridescence_pars_fragment:Jat,opaque_fragment:Qat,packing:elt,premultiplied_alpha_fragment:tlt,project_vertex:rlt,dithering_fragment:ilt,dithering_pars_fragment:nlt,roughnessmap_fragment:olt,roughnessmap_pars_fragment:slt,shadowmap_pars_fragment:alt,shadowmap_pars_vertex:llt,shadowmap_vertex:clt,shadowmask_pars_fragment:hlt,skinbase_vertex:ult,skinning_pars_vertex:dlt,skinning_vertex:plt,skinnormal_vertex:flt,specularmap_fragment:mlt,specularmap_pars_fragment:glt,tonemapping_fragment:ylt,tonemapping_pars_fragment:blt,transmission_fragment:Plt,transmission_pars_fragment:Tlt,uv_pars_fragment:Ilt,uv_pars_vertex:Clt,uv_vertex:Slt,worldpos_vertex:Elt,background_vert:Olt,background_frag:Alt,backgroundCube_vert:_lt,backgroundCube_frag:vlt,cube_vert:xlt,cube_frag:Rlt,depth_vert:Dlt,depth_frag:wlt,distanceRGBA_vert:Llt,distanceRGBA_frag:Mlt,equirect_vert:Nlt,equirect_frag:klt,linedashed_vert:Blt,linedashed_frag:Flt,meshbasic_vert:Vlt,meshbasic_frag:Glt,meshlambert_vert:Ult,meshlambert_frag:Hlt,meshmatcap_vert:Wlt,meshmatcap_frag:zlt,meshnormal_vert:Ylt,meshnormal_frag:jlt,meshphong_vert:Xlt,meshphong_frag:qlt,meshphysical_vert:$lt,meshphysical_frag:Klt,meshtoon_vert:Zlt,meshtoon_frag:Jlt,points_vert:Qlt,points_frag:ect,shadow_vert:tct,shadow_frag:rct,sprite_vert:ict,sprite_frag:nct},Ln={common:{diffuse:{value:new W0(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Sl},alphaMap:{value:null},alphaMapTransform:{value:new Sl},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Sl}},envmap:{envMap:{value:null},envMapRotation:{value:new Sl},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Sl}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Sl}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Sl},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Sl},normalScale:{value:new fn(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Sl},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Sl}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Sl}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Sl}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new W0(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new W0(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Sl},alphaTest:{value:0},uvTransform:{value:new Sl}},sprite:{diffuse:{value:new W0(16777215)},opacity:{value:1},center:{value:new fn(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Sl},alphaMap:{value:null},alphaMapTransform:{value:new Sl},alphaTest:{value:0}}},Yxe={basic:{uniforms:$2([Ln.common,Ln.specularmap,Ln.envmap,Ln.aomap,Ln.lightmap,Ln.fog]),vertexShader:ec.meshbasic_vert,fragmentShader:ec.meshbasic_frag},lambert:{uniforms:$2([Ln.common,Ln.specularmap,Ln.envmap,Ln.aomap,Ln.lightmap,Ln.emissivemap,Ln.bumpmap,Ln.normalmap,Ln.displacementmap,Ln.fog,Ln.lights,{emissive:{value:new W0(0)}}]),vertexShader:ec.meshlambert_vert,fragmentShader:ec.meshlambert_frag},phong:{uniforms:$2([Ln.common,Ln.specularmap,Ln.envmap,Ln.aomap,Ln.lightmap,Ln.emissivemap,Ln.bumpmap,Ln.normalmap,Ln.displacementmap,Ln.fog,Ln.lights,{emissive:{value:new W0(0)},specular:{value:new W0(1118481)},shininess:{value:30}}]),vertexShader:ec.meshphong_vert,fragmentShader:ec.meshphong_frag},standard:{uniforms:$2([Ln.common,Ln.envmap,Ln.aomap,Ln.lightmap,Ln.emissivemap,Ln.bumpmap,Ln.normalmap,Ln.displacementmap,Ln.roughnessmap,Ln.metalnessmap,Ln.fog,Ln.lights,{emissive:{value:new W0(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ec.meshphysical_vert,fragmentShader:ec.meshphysical_frag},toon:{uniforms:$2([Ln.common,Ln.aomap,Ln.lightmap,Ln.emissivemap,Ln.bumpmap,Ln.normalmap,Ln.displacementmap,Ln.gradientmap,Ln.fog,Ln.lights,{emissive:{value:new W0(0)}}]),vertexShader:ec.meshtoon_vert,fragmentShader:ec.meshtoon_frag},matcap:{uniforms:$2([Ln.common,Ln.bumpmap,Ln.normalmap,Ln.displacementmap,Ln.fog,{matcap:{value:null}}]),vertexShader:ec.meshmatcap_vert,fragmentShader:ec.meshmatcap_frag},points:{uniforms:$2([Ln.points,Ln.fog]),vertexShader:ec.points_vert,fragmentShader:ec.points_frag},dashed:{uniforms:$2([Ln.common,Ln.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ec.linedashed_vert,fragmentShader:ec.linedashed_frag},depth:{uniforms:$2([Ln.common,Ln.displacementmap]),vertexShader:ec.depth_vert,fragmentShader:ec.depth_frag},normal:{uniforms:$2([Ln.common,Ln.bumpmap,Ln.normalmap,Ln.displacementmap,{opacity:{value:1}}]),vertexShader:ec.meshnormal_vert,fragmentShader:ec.meshnormal_frag},sprite:{uniforms:$2([Ln.sprite,Ln.fog]),vertexShader:ec.sprite_vert,fragmentShader:ec.sprite_frag},background:{uniforms:{uvTransform:{value:new Sl},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ec.background_vert,fragmentShader:ec.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Sl}},vertexShader:ec.backgroundCube_vert,fragmentShader:ec.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ec.cube_vert,fragmentShader:ec.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ec.equirect_vert,fragmentShader:ec.equirect_frag},distanceRGBA:{uniforms:$2([Ln.common,Ln.displacementmap,{referencePosition:{value:new vt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ec.distanceRGBA_vert,fragmentShader:ec.distanceRGBA_frag},shadow:{uniforms:$2([Ln.lights,Ln.fog,{color:{value:new W0(0)},opacity:{value:1}}]),vertexShader:ec.shadow_vert,fragmentShader:ec.shadow_frag}};Yxe.physical={uniforms:$2([Yxe.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Sl},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Sl},clearcoatNormalScale:{value:new fn(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Sl},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Sl},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Sl},sheen:{value:0},sheenColor:{value:new W0(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Sl},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Sl},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Sl},transmissionSamplerSize:{value:new fn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Sl},attenuationDistance:{value:0},attenuationColor:{value:new W0(0)},specularColor:{value:new W0(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Sl},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Sl},anisotropyVector:{value:new fn},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Sl}}]),vertexShader:ec.meshphysical_vert,fragmentShader:ec.meshphysical_frag};var t7t=new FH,r7t=new Wc,i7t=new gst,n7t=new W0,Pw=(1+Math.sqrt(5))/2,L7=1/Pw,o7t=[new vt(-Pw,L7,0),new vt(Pw,L7,0),new vt(-L7,0,Pw),new vt(L7,0,Pw),new vt(0,Pw,-L7),new vt(0,Pw,L7),new vt(-1,1,-1),new vt(1,1,-1),new vt(-1,1,1),new vt(1,1,1)],s7t=new ZE,a7t=new aot(1,1),l7t=new Lnt,c7t=new Mnt,h7t=new tot,u7t=new Float32Array(16),d7t=new Float32Array(9),p7t=new Float32Array(4),f7t=new Sl,m7t=new vt,g7t={[lxe]:cxe,[hxe]:pxe,[uxe]:fxe,[WZ]:dxe,[cxe]:lxe,[pxe]:hxe,[fxe]:uxe,[dxe]:WZ},y7t=new FH,b7t=new Wc,oct=class extends mst{constructor(o){super(o),this.type=XK}parse(o){let t=function(g,y){switch(g){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(y||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(y||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(y||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(y||""))}},e=function(g,y,b){y=y||1024;let P=g.pos,T=-1,I=0,C="",E=String.fromCharCode.apply(null,new Uint16Array(g.subarray(P,P+128)));for(;0>(T=E.indexOf(`
`))&&I<y&&P<g.byteLength;)C+=E,I+=E.length,P+=128,E+=String.fromCharCode.apply(null,new Uint16Array(g.subarray(P,P+128)));return-1<T?(b!==!1&&(g.pos+=I+T+1),C+E.slice(0,T)):!1},r=function(g){let y=/^#\?(\S+)/,b=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,P=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,T=/^\s*FORMAT=(\S+)\s*$/,I=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,C={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0},E,O;for((g.pos>=g.byteLength||!(E=e(g)))&&t(1,"no header found"),(O=E.match(y))||t(3,"bad initial token"),C.valid|=1,C.programtype=O[1],C.string+=E+`
`;E=e(g),E!==!1;){if(C.string+=E+`
`,E.charAt(0)==="#"){C.comments+=E+`
`;continue}if((O=E.match(b))&&(C.gamma=parseFloat(O[1])),(O=E.match(P))&&(C.exposure=parseFloat(O[1])),(O=E.match(T))&&(C.valid|=2,C.format=O[1]),(O=E.match(I))&&(C.valid|=4,C.height=parseInt(O[1],10),C.width=parseInt(O[2],10)),C.valid&2&&C.valid&4)break}return C.valid&2||t(3,"missing format specifier"),C.valid&4||t(3,"missing image size specifier"),C},i=function(g,y,b){let P=y;if(P<8||P>32767||g[0]!==2||g[1]!==2||g[2]&128)return new Uint8Array(g);P!==(g[2]<<8|g[3])&&t(3,"wrong scanline width");let T=new Uint8Array(4*y*b);T.length||t(4,"unable to allocate buffer space");let I=0,C=0,E=4*P,O=new Uint8Array(4),_=new Uint8Array(E),x=b;for(;x>0&&C<g.byteLength;){C+4>g.byteLength&&t(1),O[0]=g[C++],O[1]=g[C++],O[2]=g[C++],O[3]=g[C++],(O[0]!=2||O[1]!=2||(O[2]<<8|O[3])!=P)&&t(3,"bad rgbe scanline format");let v=0,D;for(;v<E&&C<g.byteLength;){D=g[C++];let F=D>128;if(F&&(D-=128),(D===0||v+D>E)&&t(3,"bad scanline data"),F){let H=g[C++];for(let z=0;z<D;z++)_[v++]=H}else _.set(g.subarray(C,C+D),v),v+=D,C+=D}let w=P;for(let F=0;F<w;F++){let H=0;T[I]=_[F+H],H+=P,T[I+1]=_[F+H],H+=P,T[I+2]=_[F+H],H+=P,T[I+3]=_[F+H],I+=4}x--}return T},n=function(g,y,b,P){let T=g[y+3],I=Math.pow(2,T-128)/255;b[P+0]=g[y+0]*I,b[P+1]=g[y+1]*I,b[P+2]=g[y+2]*I,b[P+3]=1},s=function(g,y,b,P){let T=g[y+3],I=Math.pow(2,T-128)/255;b[P+0]=rZ.toHalfFloat(Math.min(g[y+0]*I,65504)),b[P+1]=rZ.toHalfFloat(Math.min(g[y+1]*I,65504)),b[P+2]=rZ.toHalfFloat(Math.min(g[y+2]*I,65504)),b[P+3]=rZ.toHalfFloat(1)},a=new Uint8Array(o);a.pos=0;let l=r(a),c=l.width,h=l.height,u=i(a.subarray(a.pos),c,h),d,p,m;switch(this.type){case RZ:m=u.length/4;let g=new Float32Array(m*4);for(let b=0;b<m;b++)n(u,b*4,g,b*4);d=g,p=RZ;break;case XK:m=u.length/4;let y=new Uint16Array(m*4);for(let b=0;b<m;b++)s(u,b*4,y,b*4);d=y,p=XK;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:c,height:h,data:d,header:l.string,gamma:l.gamma,exposure:l.exposure,type:p}}setDataType(o){return this.type=o,this}load(o,t,e,r){function i(n,s){switch(n.type){case RZ:case XK:n.colorSpace=hye,n.minFilter=z7,n.magFilter=z7,n.generateMipmaps=!1,n.flipY=!0;break}t&&t(n,s)}return super.load(o,i,e,r)}},sct=class OLe{constructor(t){this.gpu=t,this.size={width:4096,height:2048},this.cache=new Map,this.texture=this.gpu.createDynamicTexture(this.size.width,this.size.height,"rgba32float",GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.STORAGE_BINDING,"ambient light texture")}static async build(t,e){let r=new OLe(t);return r.setListen(()=>{}),r.setIntensity(1),r.setRotation(0),r.setColor(ee.WHITE),e?(r.addCache(e),await r.setTexture(e[0].name),r.setUseColor(!1)):r.setUseColor(!0),r}getIsChange(){return this.isChange}getTextureName(){return this.textureName}check(){return this.isChange?(this.isChange=!1,!0):!1}getUser(){return this.textureName===void 0?null:{name:this.textureName,blob:this.cache.get(this.textureName).blob}}getTextureNames(){return Array.from(this.cache).map(t=>({name:t[0],blob:t[1].blob})).map(t=>t.name)}addTexture(t){this.cache.set(t.name,{blob:t})}addCache(t){t.forEach(({name:e,blob:r})=>{this.cache.set(e,{blob:r})})}getCache(){return Array.from(this.cache).map(t=>({name:t[0],blob:t[1].blob}))}getTexture(){return this.texture}setListen(t){this.listen=t}setUseColor(t){this.useColor=t,this.listen(),this.isChange=!0}setIntensity(t){this.intensity=t,this.listen(),this.isChange=!0}setColor(t){this.color=t,this.listen(),this.isChange=!0}getColor(){return this.color}getIntensity(){return this.intensity}isUseColor(){return this.useColor}setRotation(t){this.rotation=t,this.listen(),this.isChange=!0}getRotatoin(){return this.rotation}async setTexture(t){let e=async i=>{let n=await i.arrayBuffer(),s=new oct().parse(n);if(s.width!==this.size.width||s.height!==this.size.height)throw new Error;return a(s.data);function a(c){let h=new Float32Array(c.length);for(let u=0;u<c.length;u++)h[u]=l(c[u]);return h}function l(c){let h=c&32768,u=(c&31744)>>10,d=c&1023;return u===0?d===0?h===0?0:-0:(h===0?1:-1)*Math.pow(2,-14)*(d/Math.pow(2,10)):u===31?d===0?h===0?1/0:-1/0:NaN:(h===0?1:-1)*Math.pow(2,u-15)*(1+d/Math.pow(2,10))}};this.isChange=!0,this.textureName=t;let r=this.cache.get(t);r&&(r.data||(r.data=await e(r.blob)),this.gpu.device.queue.writeTexture({texture:this.texture.texture},r.data,{offset:0,bytesPerRow:this.size.width*16,rowsPerImage:this.size.height},{width:this.size.width,height:this.size.height,depthOrArrayLayers:1}))}};function act(o){return new Promise(t=>setTimeout(t,o))}function gye(o,t){let e=[],r=1,i=Object.values(o);for(let n=0;n<i.length;n++){let s=a=>{if(a instanceof Array&&a.forEach(l=>s(l)),typeof a=="number")r=Math.max(r,1),e.push(a);else if(a instanceof Dt||a instanceof ee){r=Math.max(r,4);for(let l=e.length;l%4!=0;l++)e.push(t);a instanceof ee?e.push(a.r,a.g,a.b):e.push(a.x,a.y,a.z)}else if(typeof a=="boolean")r=Math.max(r,1),e.push(a?1:0);else{let l=gye(a,t);r=Math.max(r,l.alignmentRequirement);for(let c=e.length;c%l.alignmentRequirement!=0;c++)e.push(t);l.bufferData.forEach(c=>{e.push(c)})}};s(i[n])}for(let n=e.length;n%r!=0;n++)e.push(t);return{bufferData:e,alignmentRequirement:r}}function eb(o){try{return gye(o,0).bufferData}catch{debugger;gye(o,0).bufferData}}var lct=class{toBufferData(){return eb(this._toWGSLStructure())}},cct=class{constructor(){this.shaderCodes=[],this.isCompiling=!1}addShaderCode(o){if(this.isCompiling)throw new Error("Cannot add shader code while compiling");this.shaderCodes.push(o)}async compileAll(o){if(!(this.isCompiling||!this.shaderCodes)){this.isCompiling=!0,await act(10);for(let t of this.shaderCodes)if((await o.createShaderModule({code:t}).getCompilationInfo()).messages.length!==0){console.log(this.shaderCodes),await o.createShaderModule({code:t}).getCompilationInfo();debugger}}}},QE=new cct,S2e=class{constructor(o,t=0,e=0,r=1,i=.5,n=ee.WHITE,s=0,a=0,l=1,c=1,h=PZ(),u=PZ(),d=PZ(),p=PZ()){this.color=o,this.metallic=t,this.roughness=e,this.ior=r,this.iorLevel=i,this.clearcoatTintColor=n,this.clearcoatIntensity=s,this.clearcoatRoughness=a,this.clearcoatIor=l,this.normalIntensity=c,this.normalTexture=h,this.metallicTexture=u,this.colorTexture=d,this.roughnessTexture=p}};function PZ(){return{path:void 0,scale:100}}var jxe={encode:o=>JSON.stringify({baseColor:Du.encode(o.color),metallic:o.metallic,roughness:o.roughness,ior:o.ior,iorLevel:o.iorLevel,clearcoatTintColor:o.clearcoatTintColor?Du.encode(o.clearcoatTintColor):void 0,clearcoatIntensity:o.clearcoatIntensity,clearcoatRoughness:o.clearcoatRoughness,clearcoatIor:o.clearcoatIor,normalIntensity:o.normalIntensity,normalTexture:o.normalTexture,metallicTexture:o.metallicTexture,colorTexture:o.colorTexture,roughnessTexture:o.roughnessTexture}),decode:o=>{let t=JSON.parse(o);return new S2e(Du.decode(t.baseColor),t.metallic,t.roughness,t.ior,t.iorLevel,t.clearcoatTintColor?Du.decode(t.clearcoatTintColor):void 0,t.clearcoatIntensity,t.clearcoatRoughness,t.clearcoatIor,t.normalIntensity,t.normalTexture,t.metallicTexture,t.colorTexture,t.roughnessTexture)}},Du={decode(o){try{let{data:t}=JSON.parse(o);return ee.build(t[0],t[1],t[2],t[3])}catch{return null}},encode(o){return JSON.stringify({data:[o.r,o.g,o.b,o.alpha]})}},Z2={decode(o){let{data:t}=JSON.parse(o);return new Dt(t[0],t[1],t[2])},encode(o){return JSON.stringify({data:[o.x,o.y,o.z]})}},Xxe={decode(o){let{data:t}=JSON.parse(o);return new U1(t[0],t[1],t[2],t[3],t[4],t[5])},encode(o){return JSON.stringify({data:[o.minX,o.minY,o.minZ,o.maxX,o.maxY,o.maxZ]})}},qxe={encode(o){let t={base:kT.encode(o.base),silk:kT.encode(o.silk),copper:kT.encode(o.copper),solder:kT.encode(o.solder),copperOverlapSolder:kT.encode(o.copperOverlapSolder)};return JSON.stringify(t)},decode(o){let t=JSON.parse(o);return{base:kT.decode(t.base),silk:kT.decode(t.silk),copper:kT.decode(t.copper),solder:kT.decode(t.solder),copperOverlapSolder:kT.decode(t.copperOverlapSolder)}}},kT={encode(o){let t={ka:Du.encode(o.ambient),kd:Du.encode(o.diffuse),ks:Du.encode(o.specular)};return JSON.stringify(t)},decode(o){let{ka:t,kd:e,ks:r}=JSON.parse(o);return new DC(Du.decode(t),Du.decode(e),Du.decode(r),1,1)}},ALe={encode:function(o){let t=o.map(([e,r])=>[kT.encode(e),jxe.encode(r)]);return JSON.stringify(t)},decode:function(o){return JSON.parse(o).map(([t,e])=>[kT.decode(t),jxe.decode(e)])}},_Le={encode(o){return JSON.stringify({Ka:Du.encode(o.ka),Kd:Du.encode(o.kd),Ks:Du.encode(o.ks)})},decode(o){let{Ka:t,Kd:e,Ks:r}=JSON.parse(o);return{ka:Du.decode(t),kd:Du.decode(e),ks:Du.decode(r)}}},hct=class yye{constructor(t,e,r){this._gpu=t,this.camera=e,this.config=r,r?e.setConfig({flangeFocalDistance:0,focalLength:0,apertureSize:0,...r}):this.reset();let i=this._getData();this.buffer=this._gpu.createUniformDynamicBuffer(i,"camera"),this.camera.setMaxScale(1/0),this.camera.setMinScale(0)}static async build(t,e){try{let r=await e.config.text(),i=JSON.parse(r),n={up:Z2.decode(i.up),target:Z2.decode(i.target),tar2posDir:Z2.decode(i.tar2posDir),rotateTarget:Z2.decode(i.rotateTarget),cmosSize:i.cmosSize,scale:i.scale};return new yye(t,e.camera,n)}catch{return new yye(t,e.camera)}}getRotateTarget(){return this.config?this.config.rotateTarget:this.camera.getTarget()}setObjectByBBox3(t){this.bbox=t,this.camera.setObjectByBBox3(t),this.config||this.camera.adapt(t)}get size(){return{width:this.camera.getWidth(),height:this.camera.getHeight()}}getBlob(t){let e=this.camera.getConfig(),r=JSON.stringify({up:Z2.encode(e.up),target:Z2.encode(e.target),tar2posDir:Z2.encode(e.tar2posDir),scale:e.scale,cmosSize:e.cmosSize,rotateTarget:Z2.encode(t)});return new Blob([r])}reset(){this.camera.setConfig({up:new Dt(0,0,1),apertureSize:20,focalLength:19,cmosSize:{width:20,height:20},flangeFocalDistance:30,target:new Dt(0,0,0),tar2posDir:new Dt(1,0,0),scale:1}),this.camera.adapt(this.bbox)}check(){return this.camera.isChangedFromLastRender()?(this._update(),this.camera.rendered(),!0):!1}modifyCilkDirection(t){this._update(t)}_update(t=Dt.ORIGIN){let e=this._getData(t);this.buffer.write(0,new Float32Array(e))}_getData(t=Dt.ORIGIN){let e=this.camera,{origin:r,position:i,right:n,down:s}=e.getViewport(),a={position:i,origin:r,right:n,down:s,cilk_direction:t,aperture_size:e.getApertureSize(),focal_length:e.getFocalLength(),flange_local_distance:e.getFlangeFocalDistance(),px:n.length(),target:e.getTarget()};return eb(a)}},vLe=class{constructor(o,t,e){this.input=e,this.isEmpty()&&(e={bbox:null,bvh:new Float32Array(6).fill(0),pt:new Float32Array(1).fill(0),layerInfo:new Float32Array(8).fill(0),bvhIndex:new Float32Array(8).fill(0),material:bye()}),this.bbox=e.bbox,this.bvh=o.createStorageDynamicBuffer(e.bvh,"raytracer pcb model bvh"),this.pt=o.createStorageDynamicBuffer(e.pt,"raytracer pcb model pt"),this.layerInfo=o.createUniformDynamicBuffer(wLe(),"raytracer pcb model layerInfo"),this.bvhIndex=o.createUniformDynamicBuffer(e.bvhIndex,"raytracer pcb model bvhIndex"),this.material=o.createUniformDynamicBuffer(r(e.material,t),"raytracer pcb model material");function r(i,n){let s={base:n.register(i.base),silk:n.register(i.silk),copper:n.register(i.copper),solder:n.register(i.solder),copperOverlapSolder:n.register(i.copperOverlapSolder)},a=eb(s);return new Float32Array(a)}}static destring(o){if(o==="null")return;let t=JSON.parse(o),{bvh:e,bvhIndex:r,pt:i,layerInfo:n}=t,s=Xxe.decode(t.bbox),a=qxe.decode(t.material);return{bvh:e,bvhIndex:r,pt:i,layerInfo:n,bbox:s,material:a}}isEmpty(){return this.input===void 0}async tostring(){if(this.isEmpty())return"null";let o=Array.from(await this.bvh.read()),t=Array.from(await this.bvhIndex.read()),e=Array.from(await this.pt.read()),r=Array.from(await this.layerInfo.read()),i=Xxe.encode(this.bbox),n=qxe.encode(bye());return JSON.stringify({bvh:o,bvhIndex:t,pt:e,layerInfo:r,bbox:i,material:n})}};function bye(){return{base:new DC(ee.of2(0,79,155),ee.of2(0,0,0),ee.of2(0,0,0)),silk:new DC(ee.of2(255,255,255),ee.of2(0,0,1),ee.of2(0,0,1)),copper:new DC(ee.of2(197,159,59),ee.of2(0,0,2),ee.of2(0,0,2)),solder:new DC(ee.of2(0,41,101),ee.of2(0,0,3),ee.of2(0,0,3)),copperOverlapSolder:new DC(ee.of2(0,94,186),ee.of2(0,0,4),ee.WHITE)}}function uct(o,t){return o.mordonCode-t.mordonCode}function dct(o,t,e){return o.map(r=>({item:r,mordonCode:e.get(r.bbox.center())})).sort(uct).map(r=>r.item)}function pct(o){let{x:t,y:e}=o;return $xe(t)|$xe(e)<<1}function $xe(o){return o=(o|o<<16)&50331903,o=(o|o<<8)&50393103,o=(o|o<<4)&51130563,o=(o|o<<2)&153391689,o}var Pye=class extends ht{initMordonCode(o){let t=this.center().sub(o);this._mordonCode=pct(t)}getMordonCode(){if(this._mordonCode===void 0)throw new Error;return this._mordonCode}},fct=class{constructor(o,t){if(o.length===1){this.root=new TZ(o[0]);return}let e=this.getItemsDataOrigin(o),r=o.map(i=>new TZ(i));if(r.length<=t){this.root=new TZ(r);return}for(;;){let i=r.length;if(i===1)break;r.forEach(s=>s.bbox.initMordonCode(e)),r.sort((s,a)=>s.bbox.getMordonCode()-a.bbox.getMordonCode());let n=[];for(let s=0;s<Math.ceil(i/t);s++){let a=s*t,l=a+t>i?i:a+t,c=[];for(let h=a;h<l;h++)c.push(r[h]);if(c.length===0)throw new Error;n.push(new TZ(c))}r=n}this.root=r[0]}itor(o){return this.root.itor(o)}bboxs(){return this.root.bboxs()}initMordonCode(o){let t=this.getItemsDataOrigin(o);o.forEach(e=>e.bbox.initMordonCode(t))}getItemsDataOrigin(o){let t=1/0,e=1/0,r=1/0;return o.forEach(i=>{t=Math.min(t,i.bbox.minX),e=Math.min(e,i.bbox.minY)}),new S(t,e)}},TZ=class{constructor(o){this.items=[],o instanceof Array?(this.items=o,this.bbox=this.buildBBox(o),this.leaf=null):(this.leaf=o.index,this.bbox=o.bbox),this.bbox=new Pye(this.bbox.minX-.001,this.bbox.maxX+.001,this.bbox.minY-.001,this.bbox.maxY+.001)}buildBBox(o){let t=new _e;o.forEach(r=>t.ext1(r.bbox));let e=t.build();return new Pye(e.minX,e.maxX,e.minY,e.maxY)}isLeaf(){return this.leaf!==null}itor(o){if(this.isLeaf()){o(this.bbox,[this.leaf]);return}o(this.bbox,this.items.map(t=>t.isLeaf()?t.leaf:t.bbox)),this.items.forEach(t=>{t.isLeaf()||t.itor(o)})}bboxs(){let o=[];return this.itor(t=>{o.push(t)}),o}};function mct(o,t){let e=o.bboxs(),r=new Map;e.forEach((n,s)=>r.set(n,s));let i=[];return o.itor((n,s)=>{i.push(n.minX,n.maxX,n.minY,n.maxY),s.map(a=>a instanceof ht?r.get(a)+1:-a-1).forEach(a=>{i.push(a)});for(let a=0;a<t-s.length;a++)i.push(0)}),i}var gct=class{constructor(o,t,e,r){this.maxNodeCapacity=t,this.dep=0;let i=o.map(s=>new Kxe(s)),n=new bct(r);for(;i.length>1;){this.dep++,i=dct(i,e,n);let s=[],{length:a}=i;for(let l=0;l<a;l+=t){let c=i.slice(l,l+t);s.push(new Kxe(c))}i=s}this.root=i[0]}itor(o){this.root.itor(o)}bboxs(){return this.root.bboxs()}getItemsDataOrigin(o){let t=1/0,e=1/0,r=1/0;return o.forEach(({bbox:i})=>{t=Math.min(t,i.minX),e=Math.min(e,i.minY),r=Math.min(r,i.minZ)}),new Dt(t,e,r)}},Kxe=class{constructor(o){this.items=[],Array.isArray(o)?(this.items=o,this.bbox=this.buildBBox(o),this.leaf=null):(this.leaf=o.index,this.bbox=o.bbox),this.bbox=this.expandBBox(this.bbox)}expandBBox(o){return new U1(o.minX-.001,o.minY-.001,o.minZ-.001,o.maxX+.001,o.maxY+.001,o.maxZ+.001)}buildBBox(o){let t=new mm;return o.forEach(e=>t.ext4(e.bbox)),t.build()}isLeaf(){return this.leaf!==null}itor(o){this.isLeaf()||(o(this.bbox,this.items.map(t=>t.isLeaf()?t.leaf:t.bbox)),this.items.forEach(t=>!t.isLeaf()&&t.itor(o)))}bboxs(){let o=[];return this.itor(t=>o.push(t)),o}};function yct(o,t){let e=o.bboxs(),r=new Map;e.forEach((n,s)=>r.set(n,s));let i=[];return o.itor((n,s)=>{i.push(n.minX,n.minY,n.minZ,n.maxX,n.maxY,n.maxZ),s.forEach(a=>{i.push(a instanceof U1?r.get(a)*(o.maxNodeCapacity+6)+1:-a-1)}),i.push(...Array(t-s.length).fill(0))}),i}var bct=class{constructor(o){this.bbox=o,this.sizeX=o.maxX-o.minX,this.sizeY=o.maxY-o.minY,this.sizeZ=o.maxZ-o.minZ}get(o){let t=this.normalize(o),e=Math.floor(t.x*127),r=Math.floor(t.y*127),i=Math.floor(t.z*127);return this.interleaveBits(e,r,i)}normalize(o){return new Dt((o.x-this.bbox.minX)/this.sizeX,(o.y-this.bbox.minY)/this.sizeY,(o.z-this.bbox.minZ)/this.sizeZ)}interleaveBits(o,t,e){let r=0;for(let i=0;i<7;i++)r|=(o>>i&1)<<3*i,r|=(t>>i&1)<<3*i+1,r|=(e>>i&1)<<3*i+2;return r}decode(o){let t=0,e=0,r=0;for(let i=0;i<7;i++)t|=(o>>3*i&1)<<i,e|=(o>>3*i+1&1)<<i,r|=(o>>3*i+2&1)<<i;return new Dt(t/127,e/127,r/127)}denormalize(o){return new Dt(o.x*this.sizeX+this.bbox.minX,o.y*this.sizeY+this.bbox.minY,o.z*this.sizeZ+this.bbox.minZ)}getBBox(){return this.bbox}},Pct=class xLe{constructor(){this.map=new Map,this._inverse=new Map}static build(t){let e=new xLe;return t.forEach((r,i)=>{e.set(i,r)}),e}get inverse(){return{set:(t,e)=>{this.map.set(e,t),this._inverse.set(t,e)},get:t=>this._inverse.get(t),delete:t=>{this.map.delete(this._inverse.get(t)),this._inverse.delete(t)}}}set(t,e){return this._inverse.set(e,t),this.map.set(t,e)}get(t){return this.map.get(t)}delete(t){this._inverse.delete(this.map.get(t)),this.map.delete(t)}clear(){this.map.clear(),this._inverse.clear()}};function HH(o,t){let e=new Map;return o.forEach((r,i)=>{let n=t(r,i);n!==null&&e.set(i,n)}),e}async function Rw(o,t){let e=new Map;for(let r of o.entries()){let i=r[0],n=r[1],s=await t(n,i);s!==null&&e.set(i,s)}return e}function Tct(o,t){let e=new Map;return o.forEach(r=>{let i=t(r);i!==null&&e.set(r,i)}),e}var hH;function RLe(){return hH!=null||(hH=new Map([[0,{env:d2e,lable:"CircleEnvGpu"}],[1,{env:Uye,lable:"ArcEnvGpu"}],[2,{env:Yye,lable:"RectEnvGpu"}],[3,{env:Vye,lable:"LineSegmentEnv"}],[4,{env:Wye,lable:"SemicircleEnv"}],[5,{env:Bye,lable:"PointEnv"}],[6,{env:s2e,lable:"TriangleEnvGpu"}],[7,{env:c2e,lable:"CutedCircleEnvGpu"}],[8,{env:MH,lable:"StaticTriangleEnv"}],[10,{env:J7,lable:"StringEnv"}],[11,{env:IH,lable:"LineWireFrameEnv"}],[12,{env:$ye,lable:"ArcWireFrameEnv"}],[15,{env:i2e,lable:"LineEnvGpu"}],[16,{env:rJ,lable:"EllipseEnv"}],[17,{env:e2e,lable:"BezierEnv"}],[18,{env:Cw,lable:"TextGpuEnv"}],[19,{env:Nye,lable:"DrcEnv"}],[9,{env:NH,lable:"StaticCutedCircleEnv"}],[13,{env:CH,lable:"StaticLineWireFrameEnv"}],[14,{env:Jye,lable:"StaticArcWireFrameEnv"}]])),Array.from(hH.values()).find(o=>o.env===void 0)!==void 0&&(hH=void 0),hH}async function Ict(o,t){let e=await Rct(o);e=Dct(e),e=await wct(e),e=await xct(e,t),e=await vct(e,t);let r=await _ct(e);r=await Act(r);let{ptBuffer:i,ptIndexBuffer:n}=Oct(r);if(!i.length)return null;let s=await Sct(i,n,t);return{bvhBuffer:await Ect(s,n),ptBuffer:i,bboxBuffer:s,types:Cct(r)}}function Cct(o){let t=new Map;for(let[e,r]of o){let i=Mct(e),n=r.length/WH(e);t.set(i,n)}return t}async function Sct(o,t,e){let r=o,i=t,n=[],s=new Float32Array(r);for(let l=0;l<i.length;l++){let c=i[l],h=r[c],u=WH(h),d=[];for(let m=0;m<u;m++)d.push(r[c+m]);let p=Lct(h).createBBox(s,c,e,[]);n.push(p)}let a=[];return n.forEach(l=>a.push(l.minX,l.maxX,l.minY,l.maxY)),new Float32Array(a)}async function Ect(o,t){let e=[];for(let s=0;s<o.length;s+=4){let a=new Pye(o[s],o[s+1],o[s+2],o[s+3]),l=t[s/4];e.push({bbox:a,index:l})}let r=2,i=new fct(e,r),n=mct(i,r);return new Float32Array(n)}function Oct(o){let t=[],e=0;return o.forEach((r,i)=>{let n=WH(i);if(r.length%n!==0)throw new Error;for(let s=0;s<r.length;s+=n)t.push(e),e+=n}),{ptBuffer:DLe(Array.from(o.values())),ptIndexBuffer:new Float32Array(t)}}async function Act(o){return await Rw(o,async(t,e)=>{let r=t,i=WH(e);for(let n=0;n<r.length;n+=i)r[n]=e;return new Float32Array(r)})}async function _ct(o){return await Rw(o,async t=>DLe(t))}async function vct(o,t){let e=await Rw(o,async(i,n)=>{if(n!==9)return i;let s=[];for(let a of i){let l=a,c=[];for(let h=0;h<l.length;h+=NH.length){let u=l[h+10]*sd,d=new Qe([t.get(u),t.get(u+1),0,t.get(u+2),t.get(u+3),0,t.get(u+4),t.get(u+5),1]),p=new S(l[h+1],l[h+2]).multiply3(d),m=new S(l[h+6],l[h+7]).multiply3(d),g=new S(l[h+8],l[h+9]).multiply3(d);c.push(7,p.x,p.y,l[h+3],l[h+4],l[h+5],m.x,m.y,g.x,g.y,0,0,0)}s.push(new Float32Array(c))}return s}),r=e.get(9);if(r){e.delete(9);let i=e.get(7);i?r.forEach(n=>i.push(n)):e.set(7,r)}return e}async function xct(o,t){let e=await Rw(o,async(i,n)=>{if(n!==8)return i;let s=[];for(let a of i){let l=a,c=[];for(let h=0;h<l.length;h+=MH.length){let u=l[h+7]*sd,d=new Qe([t.get(u),t.get(u+1),0,t.get(u+2),t.get(u+3),0,t.get(u+4),t.get(u+5),1]),p=new S(l[h+1],l[h+2]).multiply3(d),m=new S(l[h+3],l[h+4]).multiply3(d),g=new S(l[h+5],l[h+6]).multiply3(d);c.push(6,p.x,p.y,m.x,m.y,g.x,g.y,0,0,0)}s.push(new Float32Array(c))}return s.length?s:null}),r=e.get(8);if(r){e.delete(8);let i=e.get(6);i?r.forEach(n=>i.push(n)):e.set(6,r)}return e}async function Rct(o){let t=Tct(new Array(69).fill(0).map((r,i)=>i),()=>new Array);for(let r of o)if(r instanceof bw)r.getPolygonBuilders().forEach(i=>{for(let[n,s]of i.entries()){if(!s)continue;let a=s.updateBuf();t.get(n).push(a.toDynamicBuffer())}}),r.getBuilders().forEach((i,n)=>{let s=i.updateBuf();t.get(n).push(s.toDynamicBuffer())});else throw new Error;return await Rw(t,async(r,i)=>r.length?await e(r):null);async function e(r){let i=[];for(let n of r)i.push(await n.read());return i}}function Dct(o){let t=new Set().add(6).add(7).add(15).add(0).add(2).add(1).add(9).add(8);return HH(o,(e,r)=>t.has(r)?e:null)}async function wct(o){return await Rw(o,async(t,e)=>{let r=WH(e),i=[];for(let n of t){let s=n.length;s%r===0&&s>=r&&s!==0&&i.push(n)}return i.length?i:null})}function Lct(o){return RLe().get(o).env}function Mct(o){return RLe().get(o).lable}function WH(o){return Fr.getPtLengthByType(o)}function DLe(o){let t=[];return o.forEach(e=>e.forEach(r=>t.push(r))),new Float32Array(t)}async function Nct(o){let t=await Vct(o),e=await Uct(t),r=await Wct(t),i=wLe(),n=bye();return{bbox:e,bvh:r.bvhData,pt:r.ptData,layerInfo:i,bvhIndex:r.bvhIndexMap,material:n}}var kct=(1.51+.035+.035+.01+.01)*3.93701;function Bct(o){let t=new Set([1,"copper of 1",7,3,5,2,"copper of 2",8,4,6,11]);return o.filter(e=>t.has(e.label))}function Fct(o){o=Bct(o);let t=new Map;return o.forEach(e=>t.set(e.label,e.builder.getAllPtBlock())),o.forEach(e=>{if(e.label===12){let r=e.builder.getAllPtBlock();if(r){let i=t.get(1),n=t.get(2);i?r.forEach(s=>i.push(s)):t.set(1,r),n?r.forEach(s=>n.push(s)):t.set(2,r)}}}),o.forEach(e=>{if(e.label=="copper of 1"){let r=t.get(1);r?e.builder.getAllPtBlock().forEach(i=>r.push(i)):t.set(1,e.builder.getAllPtBlock())}}),o.forEach(e=>{if(e.label==="copper of 2"){let r=t.get(2);r?e.builder.getAllPtBlock().forEach(i=>r.push(i)):t.set(2,e.builder.getAllPtBlock())}}),t}function wLe(){let o=new Dt(0,0,1),t=new Dt(0,0,0),e=o.scale(-1),r=t.sub(o.scale(kct)),i=.01;t=t.add(o.scale(i)),r=r.add(e.scale(i));let n=eb({"top point":t,"top normal":o,"bottom point":r,"bottom normal":e});return new Float32Array(n)}async function Vct(o){let{planeGPU:t,staticPolygonInfoBuilder:e}=o,r=Fct(t);return await Rw(r,async(i,n)=>Gct(e,i,n))}async function Gct(o,t,e){let r=await Ict(t,o);return r==null?null:{label:e,...r}}async function Uct(o){let t=Array.from(o.values()).map(r=>r.bboxBuffer),e=await Hct(t);return new U1(e.minX,e.minY,-10,e.maxX,e.maxY,10)}async function Hct(o){let t=new _e;for(let e of o){let r=e;for(let i=0;i<r.length;i+=4)t.ext1(new ht(r[i],r[i+1],r[i+2],r[i+3]))}return t.build()}async function Wct(o){let t=[],e=[],r=new Map;for(let[a,{ptBuffer:l,bvhBuffer:c}]of o.entries()){let h=l,u=c,d=t.length/6,p=e.length;for(let m=0;m<u.length;m+=6)[m+4,m+5].forEach(g=>{let y=u[g];y<0?u[g]-=p:y>0&&(u[g]+=d)});u.forEach(m=>t.push(m)),h.forEach(m=>e.push(m)),r.set(a,d)}let i=a=>r.has(a)?r.get(a):-1,n={outline:i(11),silkTop:i(3),solderTop:i(5),copperTop:i(1),silkBottom:i(4),solderBottom:i(6),copperBottom:i(2)},s=eb(n);return{bvhData:new Float32Array(t),ptData:new Float32Array(e),bvhIndexMap:new Float32Array(s)}}var wC={log(o,...t){console.log(o,...t)},time(o){return console.time(o)},timeEnd(o){return console.timeEnd(o)}},LLe=Math.PI,A7t=180/LLe,zct=LLe/180;function Yct(o){return o*zct}function MLe(o,t){if(!t)return Array.from(new Set(o));let e=[];for(let r of o)e.find(i=>t(r,i))||e.push(r);return e}var jct=class{constructor(o){this.current=0,this.lastRenderPercent=-1,this.minUpdateInterval=1e3,this.total=o,this.startTime=Date.now(),this.lastRenderTime=this.startTime,this.render(!0)}update(o){this.current=Math.min(o,this.total),this.shouldRender()&&this.render(),this.current>=this.total&&wC.log("\u2705 \u5B8C\u6210")}increment(o=1){this.update(this.current+o)}shouldRender(){let o=Date.now(),t=this.current/this.total*100,e;this.total>=1e6?e=.01:this.total>=1e4?e=.1:this.total>=1e3?e=.5:e=1;let r=Math.abs(t-this.lastRenderPercent)>=e,i=o-this.lastRenderTime>=this.minUpdateInterval*5,n=this.current===0||this.current>=this.total;return r||i||n}render(o=!1){let t=Date.now();if(!o&&t-this.lastRenderTime<this.minUpdateInterval)return;let e=this.current/this.total*100,r=this.roundPercent(e);if(!o&&r===this.lastRenderPercent)return;let i=20,n=Math.floor(this.current/this.total*i),s="\u2588".repeat(n)+"\u2591".repeat(i-n),a=t-this.startTime,l=` | ${this.formatTime(a)}`;if(this.current>0){let c=a/this.current,h=this.total-this.current,u=c*h;l+=` | ETA: ${this.formatTime(u)}`;let d=this.current/(a/1e3);l+=` | ${d.toFixed(1)}/s`}wC.log(`${s} ${r.toFixed(this.getPrecision())}%${l}`),this.lastRenderPercent=r,this.lastRenderTime=t}roundPercent(o){let t=this.getPrecision(),e=Math.pow(10,t);return Math.round(o*e)/e}getPrecision(){return this.total>=1e6?2:this.total>=1e4?1:0}formatTime(o){let t=Math.floor(o/1e3),e=Math.floor(t/60),r=Math.floor(e/60);return r>0?`${r}h${e%60}m`:e>0?`${e}m${t%60}s`:`${t}s`}};async function M1e(o){try{return await(await fetch(o)).text()}catch{return null}}function NLe(o){let t=o.name;return t.includes(".obj")?"obj":t.includes(".zip")?"zip":t.includes(".csv")?"csv":t.includes(".CUBE")?"cube":t.includes(".txt")?"txt":t.includes(".mlib")?"mlib":null}function Zxe(o){return"https://modules.lceda.cn/3dmodel/"+o}function Xct(o,t,e){let r=t.sub(o),i=e.sub(o);return r.cross(i).normalize()}function Jxe(o){let t="",e="",r=!1;for(let i=0;i<o.length;i++){let n=i+5<o.length&&o[i]+o[i+1]+o[i+2]+o[i+3]+o[i+4]+o[i+5]==="newmtl",s=i-6>=0&&o[i-6]+o[i-5]+o[i-4]+o[i-3]+o[i-2]+o[i-1]+o[i]===`endmtl
`;if(n&&(r=!0),s){r=!1,e+=o[i];continue}r?e+=o[i]:t+=o[i]}return{mtl:e,obj:t}}function qct(o,t){let e=new Map;return o.forEach(r=>{e.set(r,t(r))}),e}var kLe=class BLe{constructor(t,e){this.gpu=t,this.areas=e,this.buffer=t.createUniformDynamicBuffer(this.getData(),"light soure")}static async build(t,e){let r=await this.createConfig(e),i=new BLe(t,r);return i.setListen(()=>{}),i.setIsOpen(!0),i}static async createConfig(t){if(!t)return s();let e=await t.text(),r=JSON.parse(e);if(i(r))return s();return r.map((a,l)=>({name:a.name?a.name:"a"+l,color:Du.decode(a.color),power:a.power,normalize:a.normalize,size:a.size,position:Z2.decode(a.position),rotate:Z2.decode(a.rotate),hide:a.hide,castShadow:a.castShadow,rayVisibilityDiffuse:a.rayVisibilityDiffuse,rayVisibilityGlossy:a.rayVisibilityGlossy,spread:a.spread}));function i(a){return!!a.find(l=>n(l))}function n(a){return a.name===void 0||a.color===void 0||a.power===void 0||a.normalize===void 0||a.size===void 0||a.position===void 0||a.rotate===void 0||a.hide===void 0||a.castShadow===void 0||a.rayVisibilityDiffuse===void 0||a.rayVisibilityGlossy===void 0||a.spread===void 0}function s(){return[a("a0"),a("a1"),a("a2")];function a(l){return{name:l,color:ee.WHITE,power:10,size:{width:2,height:2},normalize:!1,position:new Dt(0,0,10),rotate:Dt.ORIGIN,hide:!1,castShadow:!0,rayVisibilityDiffuse:!0,rayVisibilityGlossy:!0,spread:180}}}}getBlob(){let t=Array.from(this.areas.values()).map(e=>({name:e.name,color:Du.encode(e.color),power:e.power,normalize:e.normalize,size:e.size,position:Z2.encode(e.position),rotate:Z2.encode(e.rotate),hide:e.hide,castShadow:e.castShadow,rayVisibilityDiffuse:e.rayVisibilityDiffuse,rayVisibilityGlossy:e.rayVisibilityGlossy,spread:e.spread}));return new Blob([JSON.stringify(t)])}get(t){return this.areas.find(e=>e.name===t)}set(t){for(let e=0;e<this.areas.length;e++)if(this.areas[e].name===t.name){this.areas[e]=t,this.isChange=!0;return}throw new Error}getAll(){return this.areas.map(t=>t.name)}setListen(t){this.listen=t}getIsOpen(){return this.isOpen}setIsOpen(t){this.isOpen=t,this.listen()}checkAndUpdate(){return this.isChange?(this.gpu.writeBuffer(this.buffer,0,new Float32Array(this.getData())),this.isChange=!1,!0):!1}getBBox(){return new mm().build()}getData(){let t=Array.from(this.areas.values()).map(r=>{let i=Dt.X_UNIT_VECTOR,n=Dt.Y_UNIT_VECTOR;return i=i.multiply4(Ae.rotateX(r.rotate.x*Math.PI/180)).normalize(),i=i.multiply4(Ae.rotateY(r.rotate.y*Math.PI/180)).normalize(),i=i.multiply4(Ae.rotateZ(r.rotate.z*Math.PI/180)).normalize(),i=i.scale(r.size.width),n=n.multiply4(Ae.rotateX(r.rotate.x*Math.PI/180)).normalize(),n=n.multiply4(Ae.rotateY(r.rotate.y*Math.PI/180)).normalize(),n=n.multiply4(Ae.rotateZ(r.rotate.z*Math.PI/180)).normalize(),n=n.scale(r.size.height),{hide:r.hide,color:r.color,power:r.power,position:r.position.sub(i.scale(.5)).sub(n.scale(.5)),u:i,v:n,cast_shadow:r.castShadow,diffuse:r.rayVisibilityDiffuse,glossy:r.rayVisibilityGlossy,spread:e(r.spread),normalize:r.normalize}});return eb(t);function e(r){return Yct(r)}}};kLe.maxAreaLights=3;var $ct=kLe,FLe=class Tye{constructor(t,e){this.data=t,this.size=e}static async fromBlob(t){return new Promise((e,r)=>{let i=new Image,n=document.createElement("canvas"),s=n.getContext("2d",{willReadFrequently:!0});if(!s){r(new Error("Canvas 2D context not supported"));return}let a=URL.createObjectURL(t);i.src=a,i.onload=()=>{try{n.width=i.width,n.height=i.height,s.drawImage(i,0,0);let l=s.getImageData(0,0,n.width,n.height).data,c=new Float32Array(l.length);for(let h=0;h<l.length;h++)c[h]=l[h]/255;e(new Tye(c,{width:n.width,height:n.height}))}catch(l){r(l)}finally{URL.revokeObjectURL(a)}},i.onerror=r})}binarize(){let t=this._calculateColorRatios(),{primary:e,secondary:r}=n(t),i=this._binarizationData(e,r);return new Tye(i,this.size);function n(s){let a,l=-1,c,h=-1;for(let[u,d]of s.entries())d>l?(a=u,l=d):d>h&&(c=u,h=d);if(l<0||h<0)throw new Error("Insufficient color data for binarization");return{primary:a,secondary:c}}}_binarizationData(t,e){let{data:r}=this,i=new Float32Array(this.data.length);for(let s=0;s<r.length;s+=4){let a=ee.build(r[s],r[s+1],r[s+2],r[s+3]),l=n(a,t),c=n(a,e);i[s/4]=l>c?1:0}return i;function n(s,a){let l=s.r-a.r,c=s.g-a.g,h=s.b-a.b;return l*l+c*c+h*h}}_calculateColorRatios(){let{data:t,size:e}=this,r=new Map;for(let n=0;n<t.length;n+=4){let s=ee.build(t[n],t[n+1],t[n+2],t[n+3]),a=!1;for(let[l,c]of r.entries())if(l.equals(s)){a=!0,r.set(l,c+1);break}a||r.set(s,1)}let i=t.length/4;return HH(r,n=>n/i)}};function Kct(o){switch(o){case"r8unorm":case"r8snorm":case"r8uint":case"r8sint":return 1;case"r16uint":case"r16sint":case"r16float":case"rg8unorm":case"rg8snorm":case"rg8uint":case"rg8sint":return 2;case"r32uint":case"r32sint":case"r32float":case"rg16uint":case"rg16sint":case"rg16float":case"rgba8unorm":case"rgba8unorm-srgb":case"rgba8snorm":case"rgba8uint":case"rgba8sint":case"bgra8unorm":case"bgra8unorm-srgb":case"rgb10a2unorm":case"rg11b10ufloat":return 4;case"rg32uint":case"rg32sint":case"rg32float":case"rgba16uint":case"rgba16sint":case"rgba16float":return 8;case"rgba32uint":case"rgba32sint":case"rgba32float":return 16;case"bc1-rgba-unorm":case"bc1-rgba-unorm-srgb":case"bc4-r-unorm":case"bc4-r-snorm":return 8;case"bc2-rgba-unorm":case"bc2-rgba-unorm-srgb":case"bc3-rgba-unorm":case"bc3-rgba-unorm-srgb":case"bc5-rg-unorm":case"bc5-rg-snorm":case"bc6h-rgb-ufloat":case"bc6h-rgb-float":case"bc7-rgba-unorm":case"bc7-rgba-unorm-srgb":return 16;case"depth16unorm":return 2;case"depth24plus":case"depth24plus-stencil8":return 4;case"depth32float":return 4;default:throw new Error(`Unsupported texture format: ${o}`)}}var Zct=class VLe{constructor(t,e,r){this.gpu=t,this.maxUserTextures=e,this.atlas=r,this.cache=new Map}static async build(t,e=7){if(e>t.limits.maxStorageTexturesPerShaderStage)throw new Error(`Exceeds GPU texture limit (max ${t.limits.maxStorageTexturesPerShaderStage})`);let r=await Jct.build(t,e);return new VLe(t,e,r)}clear(){this.atlas.clear(),this.cache.clear()}query(t){if(this.cache.has(t))return this.cache.get(t).id}getTextureNames(t){return Array.from(this.cache).filter(e=>e[1].type===t).map(e=>e[0])}getTexture(t){return Array.from(this.cache).filter(e=>e[1].type===t).map(e=>({name:e[0],blob:e[1].blob}))}create(t){let e=this.atlas.getTextures(),r=e.map((a,l)=>({binding:l,visibility:GPUShaderStage.COMPUTE,texture:{sampleType:"float"}}));r.push({binding:this.maxUserTextures,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}});let i=this.gpu.device.createBindGroupLayout({entries:r}),n=e.map((a,l)=>({binding:l,resource:a.texture.createView()}));n.push({binding:this.maxUserTextures,resource:{buffer:t}});let s=this.gpu.device.createBindGroup({label:"material",layout:i,entries:n});return{layout:i,bindGroup:s}}async add(t,e){if(e instanceof File)return this.add(t,{name:e.name,blob:e});let{name:r,blob:i}=e;if(this.cache.has(r))return this.cache.get(r).id;let n=await this.atlas.add(t,i);return this.cache.set(r,{id:n,type:t,blob:i}),n}},Jct=class GLe{constructor(t){this.atlas=t}static async build(t,e){let r=[];for(let i=0;i<e;i++)r.push(new Qct(t,i>=3)),await t.device.queue.onSubmittedWorkDone();return new GLe(r)}clear(){this.atlas.map(t=>t.clear())}getTextures(){return this.atlas.map(t=>t.getTexture())}async add(t,e){let r=0;for(let i of this.atlas)if(i.isFull())r+=i.getCapacity();else return r+=await i.add(t,e),r;throw new Error}},Qct=class{constructor(o,t){this.gpu=o,this.empty=t,this.index=0,this.format="rgba32float",this.size=this.getSize(),this.perRow=Math.floor(this.size.width/R_.width()),this.capacity=Math.floor(this.perRow*(this.size.height/R_.height())),this.texture=this.gpu.createDynamicTexture(this.size.width,this.size.height,this.format,GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,"mapping texture")}getTexture(){return this.texture}getCapacity(){return this.capacity}clear(){this.index=0}isFull(){return this.empty||this.index===this.getCapacity()}async add(o,t){let e=await R_.toData(o,t),r=this.index%this.perRow*R_.width(),i=Math.floor(this.index/this.perRow)*R_.height();return this.gpu.device.queue.writeTexture({texture:this.texture.texture,origin:{x:r,y:i}},e,{bytesPerRow:R_.width()*16},[R_.width(),R_.height(),1]),this.index++,this.index-1}getSize(){if(this.empty)return{width:1,height:1};let{maxTextureDimension2D:o,maxBufferSize:t}=this.gpu.limits,e=Kct(this.format);return{width:o,height:Math.min(o,2**Math.floor(Math.log2(t/e/o)))}}},eht=class{constructor(o={width:2048,height:2048}){this.size=o}width(){return this.size.width}height(){return this.size.height}async toData(o,t){let{data:e,size:r}=await FLe.fromBlob(t);if(this.width()!==r.width||this.height()!==r.height)throw new Error(`Invalid texture dimensions: expected ${this.size}, got ${r}`);switch(o){case 0:{let i=new Float32Array(e.length);for(let n=0;n<e.length;n+=4){let s=new Dt(e[n]-.5,e[n+1]-.5,e[n+2]-.5).normalize();i[n]=s.x,i[n+1]=s.y,i[n+2]=s.z}return i}case 1:{let i=new Float32Array(e.length);for(let n=0;n<e.length;n+=4)i[n]=e[n],i[n+1]=e[n+1],i[n+2]=e[n+2];return i}case 2:{let i=new Float32Array(e.length);for(let n=0;n<e.length;n+=4)i[n]=e[n],i[n+1]=e[n+1],i[n+2]=e[n+2];return i}case 3:{let i=new Float32Array(e.length);for(let n=0;n<e.length;n+=4)i[n]=e[n],i[n+1]=e[n+1],i[n+2]=e[n+2];return i}default:throw new Error}}},R_=new eht,ULe=class{constructor(o){let t=o.split(`
`),e=new Map,r="";for(let i of t){let n=i.trim();if(n.startsWith("newmtl "))r=n.substring(7).trim(),e.set(r,{Ka:{red:0,green:0,blue:0},Kd:{red:0,green:0,blue:0},Ks:{red:0,green:0,blue:0}});else if(n.startsWith("Ka ")&&r){let[,s,a,l]=n.split(/\s+/).map(Number);e.get(r).Ka={red:s,green:a,blue:l}}else if(n.startsWith("Kd ")&&r){let[,s,a,l]=n.split(/\s+/).map(Number);e.get(r).Kd={red:s,green:a,blue:l}}else if(n.startsWith("Ks ")&&r){let[,s,a,l]=n.split(/\s+/).map(Number);e.get(r).Ks={red:s,green:a,blue:l}}}this.table=e}getMaterialString(){let o="";return this.table.values().forEach(({Ka:e,Kd:r,Ks:i})=>{o+=JSON.stringify({a:t(e),d:t(r),s:t(i)})}),o;function t(e){let r=ee.build(e.red,e.green,e.blue);return Du.encode(r)}}createMaterialKaTable(){return HH(this.table,o=>({ka:ee.build(o.Ka.red,o.Ka.green,o.Ka.blue),kd:ee.build(o.Kd.red,o.Kd.green,o.Kd.blue),ks:ee.build(o.Ks.red,o.Ks.green,o.Ks.blue)}))}},tht=class HLe{static async build(t){let e=await(await fetch(t)).text();return new HLe(e)}constructor(t){let e=t.split(`
`),r={name:"",faces:[],vertexNormals:[],vertices:[]},i="";for(let n of e){let s=n.trim();if(s.startsWith("o "))r.name=s.substring(2).trim();else if(s.startsWith("v ")){let[,a,l,c]=s.split(/\s+/).map(Number);r.vertices.push(new Dt(a,l,c))}else if(s.startsWith("vn ")){let[,a,l,c]=s.split(/\s+/).map(Number);r.vertexNormals.push(new Dt(a,l,c))}else if(!s.startsWith("vt "))if(s.startsWith("f ")){let a=s.substring(2).split(" ").map(l=>{let[c,h,u]=l.split("/").map(d=>parseInt(d,10)-1);return{vertexIndex:c,vertexNormalIndex:u}});r.faces.push({material:i,vertices:a})}else s.startsWith("usemtl ")?i=s.substring(7).trim():s.startsWith("s ")}this.obj=r}deleteFace(t){this.obj.faces=this.obj.faces.filter(e=>!t(e.material))}scaleVertices(t){t&&this.obj.vertices.forEach((e,r)=>{this.obj.vertices[r]=e.scale(t)})}moveVertices(t){t&&this.obj.vertices.forEach((e,r)=>{this.obj.vertices[r]=this.obj.vertices[r].add(new Dt(t.x,0,-t.y))})}updateBBox(){let t=new mm;this.obj.faces.forEach(e=>{let r=new mm;r.ext3(this.obj.vertices[e.vertices[0].vertexIndex]),r.ext3(this.obj.vertices[e.vertices[1].vertexIndex]),r.ext3(this.obj.vertices[e.vertices[2].vertexIndex]),e.bbox=r.build(),t.ext4(e.bbox)}),this.bbox=t.build()}resetNormalIndex(t){this.obj.vertexNormals.length?this.obj.faces.forEach(e=>{e.vertices[0].vertexNormalIndex=t(this.obj.vertexNormals[e.vertices[0].vertexNormalIndex]),e.vertices[1].vertexNormalIndex=t(this.obj.vertexNormals[e.vertices[1].vertexNormalIndex]),e.vertices[2].vertexNormalIndex=t(this.obj.vertexNormals[e.vertices[2].vertexNormalIndex])}):this.obj.faces.forEach(e=>{let r=this.obj.vertices[e.vertices[0].vertexIndex],i=this.obj.vertices[e.vertices[1].vertexIndex],n=this.obj.vertices[e.vertices[2].vertexIndex],s=Xct(r,i,n);e.vertices[0].vertexNormalIndex=t(s),e.vertices[1].vertexNormalIndex=t(s),e.vertices[2].vertexNormalIndex=t(s)})}resetVertexIndex(t){this.obj.faces.forEach((e,r)=>{e.vertices[0].vertexIndex=t(this.obj.vertices[e.vertices[0].vertexIndex]),e.vertices[1].vertexIndex=t(this.obj.vertices[e.vertices[1].vertexIndex]),e.vertices[2].vertexIndex=t(this.obj.vertices[e.vertices[2].vertexIndex])})}setMaterialIndex(t){this.obj.faces.forEach((e,r)=>{this.obj.faces[r].materialIndex=t(e.material)})}setFaceIndex(t){this.obj.faces.forEach((e,r)=>{this.obj.faces[r].index=t({v0:e.vertices[0].vertexIndex,v1:e.vertices[1].vertexIndex,v2:e.vertices[2].vertexIndex,n0:e.vertices[0].vertexNormalIndex,n1:e.vertices[1].vertexNormalIndex,n2:e.vertices[2].vertexNormalIndex,m:e.materialIndex})})}crateItems(){let t=[];return this.obj.faces.forEach(e=>{t.push({index:e.index,bbox:new U1(e.bbox.minX,e.bbox.minY,e.bbox.minZ,e.bbox.maxX,e.bbox.maxY,e.bbox.maxZ)})}),t}getVerticesArr(){let t=[];return this.obj.vertices.forEach(e=>{t.push(e.x,e.y,e.z)}),t}getNoemalsArr(){let t=[];return this.obj.vertexNormals.forEach(e=>{t.push(e.x,e.y,e.z)}),t}putRight(){let t=new mm;this.obj.vertices.forEach(r=>{t.ext2(r.x,r.y,r.z)}),this.bbox=t.build();let e=this.bbox.center();this.obj.vertices.forEach((r,i)=>{this.obj.vertices[i]=r.sub(e)})}rotate(t){this.obj.vertexNormals.forEach((e,r)=>{let i=new Dt(e.x,e.y,e.z).multiply4(t);this.obj.vertexNormals[r]=i}),this.obj.vertices.forEach((e,r)=>{let i=new Dt(e.x,e.y,e.z).multiply4(t);this.obj.vertices[r]=i})}getMaterilas(){return new Set(this.obj.faces.map(t=>t.material))}},WLe=class Iye{constructor(t,e,r,i,n,s,a,l,c){this.bvh=t,this.face=e,this.vertexAndNormal=r,this.bbox=i,this.capacity=n,this.depth=s,this.input=a,this.gpu=l,this.material=c}static destring(t){let{mtl:e,obj:r,origin:i}=JSON.parse(t);return{mtl:e===void 0?void 0:e,obj:r,origin:i===void 0?void 0:new S(i[0],i[1])}}static async build(t,e,r,i=4){let n=new rht,{mtl:s,obj:a,origin:l,scale:c}=e,h=new tht(a),u=iht(h.getMaterilas(),s,r);h.deleteFace(y=>zLe.isPCB(u.get(y).material.ka)),h.scaleVertices(c),h.moveVertices(l),h.updateBBox(),h.resetNormalIndex(y=>n.addNormalOrVetex(y)),h.resetVertexIndex(y=>n.addNormalOrVetex(y)),h.setMaterialIndex(y=>u.get(y).index),h.setFaceIndex(y=>n.addFaceIndex(y));let d=h.crateItems(),p=new gct(d,i,new Dt(h.bbox.minX,h.bbox.minY,h.bbox.minZ),h.bbox),m=yct(p,i);n.addBVHData(m);let g=n.createBuffer(t);return new Iye(g.bvh,g.face,g.vertexAndNormal,h.bbox,p.maxNodeCapacity,p.dep,e,t,r)}async update(t,e){let r=await Iye.build(this.gpu,{obj:t,mtl:e},this.material);this.bvh.setDynamicBuffer(r.bvh),this.face.setDynamicBuffer(r.face),this.vertexAndNormal.setDynamicBuffer(r.vertexAndNormal),this.bbox=r.bbox}getBVH(){return this.bvh}getFace(){return this.face}getVertexAndNormal(){return this.vertexAndNormal}getBBox(){return this.bbox}tostring(){let{mtl:t,obj:e,origin:r}=this.input;return JSON.stringify({mtl:t===void 0?void 0:t,obj:e,origin:r==null?void 0:[r.x,r.y]})}},rht=class{constructor(){this.bvhData=[],this.normalAndVertexData=[],this.faceIndexData=[]}addBVHData(o){o.forEach(t=>this.bvhData.push(t))}addNormalOrVetex(o){return this.normalAndVertexData.push(o.x,o.y,o.z,0),this.normalAndVertexData.length/4-1}addFaceIndex(o){return this.faceIndexData.push(o.v0,o.v1,o.v2,o.n0,o.n1,o.n2,o.m),this.faceIndexData.length/7-1}createBuffer(o){return{bvh:o.createStorageDynamicBuffer(this.bvhData,"obj model bvh"),vertexAndNormal:o.createStorageDynamicBuffer(this.normalAndVertexData,"obj model vertex and normal"),face:o.createStorageDynamicBuffer(this.faceIndexData,"obj model face")}}},zLe=class{static isPCB(o){return Math.abs(o.r-this.pcb.r)<.01&&Math.abs(o.g-this.pcb.g)<.01&&Math.abs(o.b-this.pcb.b)<.01}};zLe.pcb=ee.build(0,.15,.36);function iht(o,t,e){let r=nht(o,t);return HH(r,i=>{let{ka:n,kd:s,ks:a}=i,l=new DC(n,s,a,1,1);return{index:e.register(l),material:i}})}function nht(o,t){return t?new ULe(t).createMaterialKaTable():qct(o,()=>({ka:ee.RED,kd:ee.RED,ks:ee.RED}))}var Qxe=class{constructor(o){this._table=o}getUserTextures(){let o=new Set;return this._table.map(t=>t[1]).forEach(t=>{o.add(t.colorTexture.path).add(t.normalTexture.path).add(t.metallicTexture.path).add(t.roughnessTexture.path)}),o}get table(){return this._table}get(o){let t=[];for(let[e,r]of this._table)this._equals(o,e)&&t.push(r);if(t.length===0)return this.add(o);if(t.length===1)return t[0];throw new Error}add(o){let t=new S2e(o.ambient);return this.set(o,t),t}set(o,t){let e=[];for(let r=0;r<this._table.length;r++){let[i,n]=this._table[r];this._equals(o,i)&&e.push({pbr:n,index:r})}if(e.length===0){this._table.push([o,t]);return}if(e.length===1){let r=e[0].index;this._table[r]=[o,t]}throw new Error}modify(o,t){for(let e=0;e<this._table.length;e++)this._table[e][1]===o&&(this._table[e][1]=t)}soureceData(){let o=[];for(let[t,e]of this.table)o.push([t,e]);return ALe.encode(o)}_equals(o,t){return o.ambient.equals(t.ambient)&&o.diffuse.equals(t.diffuse)&&o.specular.equals(t.specular)}},oht=class{constructor(o,t,e,r,i,n,s,a,l,c,h,u,d,p){this.color=o,this.metallic=t,this.roughness=e,this.ior=r,this.iorLevel=i,this.clearcoatTintColor=n,this.clearcoatIntensity=s,this.clearcoatRoughness=a,this.clearcoatIor=l,this.normalIntensity=c,this.normalTexture=h,this.metallicTexture=u,this.colorTexture=d,this.roughnrssTexture=p}getData(){let o={baseColor:eRe(this.color),metallic:this.metallic,roughness:this.roughness,ior:this.ior,iorLevel:this.iorLevel,clearcoatIntensity:this.clearcoatIntensity,clearcoatRoughness:this.clearcoatRoughness,clearcoatIor:this.clearcoatIor,clearcoatTintColor:eRe(this.clearcoatTintColor),normalIntensity:this.normalIntensity,normalTexture:this.normalTexture.index,normalTextureScale:this.normalTexture.scale,metallicTexture:this.metallicTexture.index,metallicTextureScale:this.metallicTexture.scale,colorTexture:this.colorTexture.index,colorTextureScale:this.colorTexture.scale,roughnrssTexture:this.roughnrssTexture.index,roughnessTextureScacle:this.roughnrssTexture.scale};return eb(o)}};function eRe(o){return new Dt(o.r,o.g,o.b)}var tRe=class YLe{constructor(t,e){this.gpu=t,this.textureRegister=e,this.cache=new Pct,this.dirty=!0,this.table=[]}static async build(t,e){let r=await Zct.build(t);if(e){for(let i of e.normal)await r.add(0,i);for(let i of e.metallic)await r.add(1,i);for(let i of e.color)await r.add(2,i);for(let i of e.roughness)await r.add(3,i)}return new YLe(t,r)}clear(){this.textureRegister.clear(),this.cache.clear(),this.table.length=0,this.dirty=!0}check(){return this.dirty?(this._updateBuffer(),!0):!1}createPipelineInfo(){this._updateBuffer();let{layout:t,bindGroup:e}=this.textureRegister.create(this.buffer.getBuffer());return{layout:t,bindGroup:e}}modify(t,e){this.dirty=!0;let r=rRe(this.textureRegister,e);this.table[t]={config:e,data:r}}registe(t){let e=rRe(this.textureRegister,t),r=this.table.push({config:t,data:e})-1;return this.cache.set(t,r),r}_updateBuffer(){let t=[];this.table.forEach(e=>{e.data.getData().forEach(r=>{t.push(r)})}),this.buffer?this.gpu.writeBuffer(this.buffer,0,new Float32Array(t)):this.buffer=this.gpu.createStorageDynamicBuffer(t,"material buffer of raytracer."),this.dirty=!1}};function rRe(o,t){return new oht(t.color,t.metallic,t.roughness,t.ior,t.iorLevel,t.clearcoatTintColor,t.clearcoatIntensity,t.clearcoatRoughness,t.clearcoatIor,t.normalIntensity,e(t.normalTexture),e(t.metallicTexture),e(t.colorTexture),e(t.roughnessTexture));function e(r){let{path:i,scale:n}=r;return{index:o.query(i)!==void 0?o.query(i):-1,scale:n}}}var sht=class Cye{constructor(t,e,r){this.table=t,this.registrar=e,this.input=r}static async build(t,e){if(e){let r=new Qxe(e.table),i=await tRe.build(t,e);return new Cye(r,i,e)}else{let r=new Qxe([]),i=await tRe.build(t);return new Cye(r,i,e)}}clear(){this.registrar.clear(),this.initPipelineInfo()}get gpu(){return this.registrar.gpu}get bindGroup(){return this._bindGroup}get layout(){return this._layout}getBlob(){return new Blob([this.soureceData()])}soureceData(){return this.table.soureceData()}register(t){let e=this.table.get(t);return this.registrar.registe(e)}getPBR(t){let e=this.registrar.cache.inverse.get(t);if(!e)throw new Error;return e}modify(t,e){this.registrar.modify(t,e);let r=this.getPBR(t);this.registrar.cache.delete(e),this.registrar.cache.set(e,t),this.table.modify(r,e)}initPipelineInfo(){let{layout:t,bindGroup:e}=this.registrar.createPipelineInfo();this._layout=t,this._bindGroup=e}},aht=class Sye{constructor(t,e,r){this.texture=t,this.parameter=e,this.input=r}static async build(t,e,r){if(!e){let g=t.createDynamicTexture(1,1,"r32float",GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,"cutting board texture empty."),y=t.createUniformDynamicBuffer(10,"board material");return new Sye(g,y,e)}let i=(await FLe.fromBlob(e.blob)).binarize(),{data:n,size:s}=i,{width:a,height:l}=s,c=t.createDynamicTexture(a,l,"r32float",GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,"cutting board texture.");t.device.queue.writeTexture({texture:c.texture},n,{bytesPerRow:a*4},[a,l,1]);let h=r.register(new DC(ee.build(.01,.09499999999999964,.06599999999999963),ee.WHITE,ee.WHITE,1,1)),u={silk:r.register(new DC(ee.build(.2499999999999999,.37499999999999967,.06599999999999963),ee.WHITE,ee.WHITE,1,1)),plane:h,width:m(300),height:m(200),cornerRadius:m(5),edgeClearance:m(10),lineBreadth:m(1/2),gridSize:m(10),slikWidth:m(100),slikHeight:m(100)/(c.width/c.height)},d=eb(u),p=t.createUniformDynamicBuffer(d,"board material");return new Sye(c,p,e);function m(g){return 3.93701*g}}getBlob(t){this.input&&t("log",this.input.blob)}},lht=class{constructor(o,t,e){this._gpu=o,this.material=e,this._isChange=!0,this.color=ee.build(.001,0,0),this.position=new Dt(0,0,100),this.width=100,this.height=100,this.visible=!0,this._materialID=e.register(new DC(this.color,ee.WHITE,ee.WHITE));let r=this._getData();this.hide=!!t,this.buffer=this._gpu.createUniformDynamicBuffer(r,"occluder model")}getVisible(){return this.visible}setVisible(o){this.visible=o,this._isChange=!0}getColor(){return this.color}setColor(o){this.color=o,this.material.modify(this._materialID,new S2e(this.color)),this._isChange=!0}getPosition(){return this.position}setPosition(o){this.position=o,this._isChange=!0}getWidth(){return this.width}setWidth(o){this.width=o,this._isChange=!0}getHeight(){return this.height}setHeight(o){this.height=o,this._isChange=!0}checkAndUpdate(){return this._isChange?(this.buffer.write(0,new Float32Array(this._getData())),this._isChange=!1,!0):!1}_getData(){return eb({position:this.position,width:this.width,height:this.height,materialID:this._materialID,hide:this.hide?1:0,visible:this.visible})}},cht=class jLe{constructor(t,e,r,i,n,s){this.material=t,this.pcb=e,this.obj=r,this.board=i,this.occluder=n,t.initPipelineInfo(),s.setObjectByBBox3(r.getBBox())}static async build(t,e,r){let i=await sht.build(t,r.material),n=await WLe.build(t,r.obj,i),s=new vLe(t,i,r.pcb),a=await aht.build(t,r.board,i),l=new lht(t,r.occluder,i);return new jLe(i,s,n,a,l,e)}checkAndUpdate(){return this.material.registrar.check()||this.occluder.checkAndUpdate()}async getBlob(){let t={version:"from pcb",pcb:await this.pcb.tostring(),obj:this.obj.tostring()},e=JSON.stringify(t);return new Blob([e])}};function hht(o){let t={backgroundTexture:o.backgroundTexture,backgroundRotation:o.backgroundRotation,backgroundIntensity:o.backgroundIntensity,backgroundColor:Du.encode(o.backgroundColor),backgroundUseColor:o.backgroundUseColor,occluderPosition:Z2.encode(o.occluderPosition),occluderWidth:o.occluderWidth,occluderHeight:o.occluderHeight,occluderVisible:o.occluderVisible,rendererMaxSample:o.rendererMaxSample,rendererEnableDenoise:o.rendererEnableDenoise,hideBoard:o.hideBoard,hideOccluder:o.hideOccluder,hidePCB:o.hidePCB,hideOBJ:o.hideOBJ,hideLight:o.hideLight,hideCoordinate:o.hideCoordinate,renderMode:o.renderMode,flangeFocalDistance:o.flangeFocalDistance,apertureSize:o.apertureSize,focalLength:o.focalLength,maxRayBounces:o.maxRayBounces,diffuseMode:o.diffuseMode,occluderColor:Du.encode(o.occluderColor),lightIsOpen:o.lightIsOpen,displayDevice:o.displayDevice,viewTransform:o.viewTransform,lutName:o.lutName},e=JSON.stringify(t);return new Blob([e])}async function uht(o){let t=await o.text(),e=JSON.parse(t);return{backgroundIntensity:e.backgroundIntensity,backgroundTexture:e.backgroundTexture,backgroundRotation:e.backgroundRotation,backgroundColor:Du.decode(e.backgroundColor)?Du.decode(e.backgroundColor):ee.WHITE,backgroundUseColor:e.backgroundUseColor,occluderColor:Du.decode(e.occluderColor)?Du.decode(e.occluderColor):ee.WHITE,occluderPosition:e.occluderPosition?Z2.decode(e.occluderPosition):void 0,occluderWidth:e.occluderWidth,occluderHeight:e.occluderHeight,occluderVisible:e.occluderVisible,rendererMaxSample:e.rendererMaxSample,rendererEnableDenoise:e.rendererEnableDenoise,hideBoard:e.hideBoard,hideOccluder:e.hideOccluder,hidePCB:e.hidePCB,hideOBJ:e.hideOBJ,hideLight:e.hideLight,hideCoordinate:e.hideCoordinate,renderMode:e.renderMode,flangeFocalDistance:e.flangeFocalDistance,apertureSize:e.apertureSize,focalLength:e.focalLength,maxRayBounces:e.maxRayBounces,diffuseMode:e.diffuseMode,lightIsOpen:e.lightIsOpen,displayDevice:e.displayDevice,viewTransform:e.viewTransform,lutName:e.lutName}}function dht(o,t){let e={};for(let r of Object.keys(t))o[r]!==t[r]&&(e[r]=t[r]),o[r]instanceof ee&&t[r]instanceof ee&&o[r].equals(t[r])&&(e[r]=void 0);return e}var pht=class{diff(o){let t=this.last===void 0?o:dht(this.last,o);return this.last=o,t}},XLe="struct O_a { O_b : vec3 < f32 > , O_c : vec3f , O_d : vec3f , O_e : f32 , O_f : f32 , O_g : f32 , } @ group ( 0 ) @ binding ( 0 ) var < storage , read > O_h : array < O_a > ; @ group ( 0 ) @ binding ( 1 ) var < storage , read_write > O_i : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 2 ) var < storage , read_write > O_j : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 3 ) var < storage , read_write > O_k : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 4 ) var < storage , read_write > O_l : array < f32 > ; @ group ( 0 ) @ binding ( 5 ) var < storage , read_write > O_m : array < f32 > ; override Width : u32 ; override Height : u32 ; @ compute @ workgroup_size ( 8 , 8 ) fn main ( @ builtin ( global_invocation_id ) O_n : vec3 < u32 > , ) { if ( O_n . x >= Width || O_n . y >= Height ) { return ; } let O_o = O_n . x + O_n . y * u32 ( Width ) ; let O_p = O_h [ O_o ] ; O_i [ O_o ] = O_p . O_b ; O_j [ O_o ] = O_p . O_c ; O_k [ O_o ] = O_p . O_d ; O_l [ O_o ] = O_p . O_f ; O_m [ O_o ] = O_p . O_g ; } ";QE.addShaderCode(XLe);var fht=class{constructor(o,t,e){this.gpu=o,this.size=t,this.geometry=e,this.initializeBuffer(),this.initializePipeline(),this.initializeBindGroup()}getBuffers(){return this.buffers}run(){let o=this.gpu.device.createCommandEncoder(),t=o.beginComputePass();t.setPipeline(this.pipeline),t.setBindGroup(0,this.bindGroup),t.dispatchWorkgroups(Math.ceil(this.size.width/8),Math.ceil(this.size.height/8)),t.end(),this.gpu.submit(o)}async runAsync(){let o=performance.now();return this.run(),await this.gpu.device.queue.onSubmittedWorkDone(),performance.now()-o}initializeBuffer(){let o=this.size.width*this.size.height;this.buffers={geometry:this.geometry,hdrColor:this.gpu.createStorageDynamicBuffer(o*4,"hdrColor"),position:this.gpu.createStorageDynamicBuffer(o*4,"position"),normal:this.gpu.createStorageDynamicBuffer(o*4,"normal"),depth:this.gpu.createStorageDynamicBuffer(o,"depth"),type:this.gpu.createStorageDynamicBuffer(o,"type")}}initializeBindGroup(){this.bindGroup=this.gpu.createBindGroup("geometry buffer dismantle",this.pipeline.getBindGroupLayout(0),0,this.buffers.geometry,1,this.buffers.hdrColor,2,this.buffers.position,3,this.buffers.normal,4,this.buffers.depth,5,this.buffers.type)}initializePipeline(){this.pipeline=this.gpu.createComputePipeline(XLe,"main","geometry buffer dismantle","auto",{Width:this.size.width,Height:this.size.height})}},qLe="override Image_Width : u32 ; override Image_Height : u32 ; fn O_a ( O_b : vec3 < f32 > , O_c : f32 , O_d : f32 , O_e : f32 , O_f : f32 , O_g : vec3 < f32 > , O_h : vec3 < f32 > , O_i : vec3 < f32 > , ) -> vec3 < f32 > { let O_j = normalize ( O_i ) ; let O_k = normalize ( O_h ) ; let O_l = max ( dot ( O_g , O_k ) , 0.0 ) ; let O_m = max ( dot ( O_g , O_j ) , 0.0 ) ; if ( O_l <= 0.0 || O_m <= 0.0 ) { return vec3 < f32 > ( 0.0 ) ; } let O_n = O_o ( O_b , O_d , O_e , O_f ) ; let O_p = O_q ( O_n , O_m ) ; let O_r = ( 1.0 - O_p ) * ( 1.0 - O_d ) ; let O_s = O_b * O_r * O_t ; let O_u = O_v ( O_b , O_c , O_d , O_e , O_f , O_g , O_j , O_k ) ; return O_s + O_u ; } const O_w : f32 = 2e-10 ; fn O_x ( O_y : f32 , O_z : f32 , ) -> f32 { let O_aa = abs ( O_z ) ; if ( O_aa >= 1.0 - 1e-5 ) { return 0.0 ; } let O_ab = max ( O_aa , 1e-5 ) ; let O_ac = 1.0 / ( O_ab * O_ab ) ; let O_ad = max ( O_ac - 1.0 , 0.0 ) ; let O_ae = O_y * O_ad ; let O_af = sqrt ( 1.0 + O_ae ) ; return 0.5 * ( O_af - 1.0 ) ; } fn O_ag ( O_ah : f32 , O_c : f32 , ) -> f32 { let O_ai = O_c * O_c ; let O_y = O_ai * O_ai ; if ( O_y <= O_w ) { return 0.0 ; } let O_aj = clamp ( O_ah , - 1.0 , 1.0 ) ; let O_ak = min ( O_aj * O_aj , 1.0 ) ; let O_al = 1.0 - O_ak ; let O_am = O_al + O_y * O_ak ; let O_an = O_am * O_am ; return O_y / max ( O_ao * O_an , 1e-10 ) ; } fn O_ap ( O_m : f32 , O_l : f32 , O_c : f32 , ) -> f32 { let O_ai = O_c * O_c ; let O_y = O_ai * O_ai ; if ( O_y <= O_w ) { return 1.0 ; } let O_aq = O_x ( O_y , O_l ) ; let O_ar = O_x ( O_y , O_m ) ; let O_as = 1.0 + O_aq + O_ar ; return 1.0 / max ( O_as , 1e-7 ) ; } fn O_v ( O_b : vec3 < f32 > , O_c : f32 , O_d : f32 , O_e : f32 , O_f : f32 , O_g : vec3 < f32 > , O_j : vec3 < f32 > , O_k : vec3 < f32 > , ) -> vec3 < f32 > { let O_at = O_j + O_k ; let O_au = length ( O_at ) ; if ( O_au < 1e-6 ) { return vec3 < f32 > ( 0.0 ) ; } let O_av = O_at / O_au ; let O_l = max ( dot ( O_g , O_k ) , 0.0 ) ; let O_m = max ( dot ( O_g , O_j ) , 0.0 ) ; let O_ah = dot ( O_g , O_av ) ; let O_aw = max ( dot ( O_j , O_av ) , 0.0 ) ; if ( O_l <= 0.0 || O_m <= 0.0 ) { return vec3 < f32 > ( 0.0 ) ; } if ( O_ah <= 0.0 ) { return vec3 < f32 > ( 0.0 ) ; } let O_n = O_o ( O_b , O_d , O_e , O_f ) ; let O_p = O_q ( O_n , O_aw ) ; let O_ax = O_ag ( O_ah , O_c ) ; if ( O_ax <= 0.0 ) { return vec3 < f32 > ( 0.0 ) ; } let O_ay = O_ap ( O_m , O_l , O_c ) ; let O_ai = O_c * O_c ; let O_y = O_ai * O_ai ; let O_aq = O_x ( O_y , O_l ) ; let O_ar = O_x ( O_y , O_m ) ; let O_az = O_ax / max ( O_l , 1e-10 ) * 0.25 ; let O_ba = 1.0 + O_ar + O_aq ; let O_bb = O_p * O_az / max ( O_ba , 1e-10 ) ; return clamp ( O_bb , vec3 < f32 > ( 0.0 ) , vec3 < f32 > ( 1e4 ) ) ; } fn O_bc ( O_b : vec3f , O_bd : vec3f , O_be : vec3f , ) -> O_bf { var O_bg : O_bf ; var O_i : vec3f ; O_i = O_bh ( ) ; O_i = O_bi ( O_i , O_be ) ; if ( dot ( O_i , O_bd ) < 0.0 ) { return O_bg ; } O_bg . O_i = O_i ; O_bg . O_bj = O_b ; return O_bg ; } fn O_bh ( ) -> vec3f { let O_bk = O_bl ( ) ; let O_bm = O_bl ( ) ; let O_bn = sqrt ( O_bk ) ; let O_bo = 2.0 * O_ao * O_bm ; return vec3f ( cos ( O_bo ) * O_bn , sin ( O_bo ) * O_bn , sqrt ( 1.0 - O_bk ) ) ; } fn O_bi ( O_bp : vec3f , O_bq : vec3f , ) -> vec3f { var O_br : vec3f ; if ( abs ( O_bq . z ) > 0.999 ) { O_br = vec3f ( 1.0 , 0.0 , 0.0 ) ; } else { O_br = normalize ( cross ( vec3f ( 0.0 , 0.0 , 1.0 ) , O_bq ) ) ; } let O_bs = cross ( O_bq , O_br ) ; return O_bp . x * O_br + O_bp . y * O_bs + O_bp . z * O_bq ; } fn O_bt ( O_b : vec3 < f32 > , O_bu : vec3 < f32 > , O_h : vec3 < f32 > , ) -> vec3 < f32 > { return O_b * dot ( O_h , O_bu ) ; } fn O_bv ( O_bw : vec3f , O_b : vec3f , O_bx : vec3f , O_by : vec3f , O_c : f32 , ) -> O_bf { var O_bz : vec3f = O_bx ; if ( dot ( - O_bw , O_bz ) < 0.0 ) { O_bz = - O_bz ; } let O_bq = O_ca ( O_bz , O_c * O_c ) ; var O_cb = O_cc ( O_bw , O_bq ) ; if ( dot ( O_cb , O_by ) < 0.0 ) { O_cb = - O_cb ; } let O_cd = O_ce ( max ( dot ( - O_bw , O_bz ) , 0.0 ) , O_b ) ; return O_bf ( O_cb , O_cd ) ; } fn O_ca ( O_bu : vec3 < f32 > , O_c : f32 , ) -> vec3 < f32 > { var O_cf : f32 = O_cg ( O_c ) ; return O_ch ( O_bu , O_cf ) ; } fn O_cg ( O_bn : f32 , ) -> f32 { if ( O_bn > 0.99999 ) { return O_bl ( ) ; } if ( O_bn < 0.00001 ) { return 1.0 ; } let O_ci = O_bn * O_bn ; let O_cj = O_ck ( O_ci , 1.0 ) ; return sqrt ( ( 1.0 - sqrt ( O_ci / O_cj ) ) / ( 1.0 - O_bn ) ) ; } fn O_ch ( O_cl : vec3 < f32 > , O_cf : f32 , ) -> vec3 < f32 > { let O_bu = normalize ( O_cl ) ; if ( O_cf == 1.0 ) { return O_bu ; } var O_cm : vec3 < f32 > ; if abs ( O_bu . x ) < 0.9 { O_cm = cross ( O_bu , vec3 < f32 > ( 1.0 , 0.0 , 0.0 ) ) ; } else { O_cm = cross ( O_bu , vec3 < f32 > ( 0.0 , 1.0 , 0.0 ) ) ; } O_cm = normalize ( O_cm ) ; let O_cn = cross ( O_bu , O_cm ) ; let O_co = O_cp ( ) ; let O_bn = O_cf * O_bu + sqrt ( 1.0 - O_cf * O_cf ) * ( cos ( O_co ) * O_cm + sin ( O_co ) * O_cn ) ; return normalize ( O_bn ) ; } const O_ao : f32 = 3.14159265359 ; const O_cq : f32 = 2.718281828459045 ; const O_cr : f32 = O_ao * 2.0 ; const O_cs : f32 = 1.5707963267948966 ; const O_ct : f32 = 0.7853981633974830 ; const O_t : f32 = 0.3183098861837907 ; const O_cu : f32 = 1e-7 ; const O_cv : f32 = 3.402823466e+38 ; const O_cw : u32 = 10 ; const O_cx : bool = true ; const O_cy : f32 = 1.4426950408889634 ; const O_cz : bool = true ; const O_da : u32 = 0 ; const O_db : u32 = 1 ; const O_dc : u32 = 2 ; const O_dd : u32 = 3 ; const O_de : u32 = 0 ; const O_df : u32 = 1 ; const O_dg : u32 = 2 ; const O_dh : u32 = 3 ; const O_di : u32 = 4 ; const O_dj : u32 = 5 ; const O_dk : u32 = 6 ; const O_dl : u32 = 7 ; const O_dm : u32 = 8 ; const O_dn : u32 = 9 ; const O_do : u32 = 10 ; const O_dp : u32 = 11 ; const O_dq : u32 = 12 ; const O_dr : u32 = 13 ; const O_ds : u32 = 14 ; const O_dt : u32 = 15 ; const O_du : u32 = 16 ; const O_dv : u32 = 17 ; const O_dw : u32 = 18 ; const O_dx : u32 = 19 ; const O_dy : u32 = 20 ; const O_dz : u32 = 20 ; const O_ea = 30 ; const O_eb : i32 = 1 ; const O_ec : i32 = 2 ; const O_ed : i32 = 3 ; const O_ee : i32 = 4 ; const O_ef : i32 = 5 ; const O_eg = 6 ; const O_eh : i32 = 3 ; const O_ei : u32 = 0 ; const O_ej : u32 = 1 ; const O_ek : u32 = 2 ; const O_el : u32 = 3 ; const O_em : u32 = 4 ; const O_en = 0 ; const O_eo = 1 ; const O_ep = 2 ; const O_eq = 3 ; const O_er : u32 = 0u ; const O_es : u32 = 1u ; @ group ( 0 ) @ binding ( 0 ) var < storage , read_write > O_et : array < O_eu > ; @ group ( 0 ) @ binding ( 1 ) var < uniform > O_ev : O_ew ; @ group ( 0 ) @ binding ( 2 ) var < uniform > O_ex : O_ey ; @ group ( 0 ) @ binding ( 3 ) var < uniform > O_ez : O_fa ; @ group ( 0 ) @ binding ( 4 ) var < uniform > O_fb : O_fc ; @ group ( 0 ) @ binding ( 5 ) var < uniform > O_fd : O_fe ; @ group ( 0 ) @ binding ( 6 ) var O_ff : texture_2d < f32 > ; @ group ( 0 ) @ binding ( 7 ) var < uniform > O_fg : array < O_fh , 3 > ; @ group ( 1 ) @ binding ( 0 ) var O_fi : texture_2d < f32 > ; @ group ( 1 ) @ binding ( 1 ) var O_fj : texture_2d < f32 > ; @ group ( 1 ) @ binding ( 2 ) var O_fk : texture_2d < f32 > ; @ group ( 1 ) @ binding ( 3 ) var O_fl : texture_2d < f32 > ; @ group ( 1 ) @ binding ( 4 ) var O_fm : texture_2d < f32 > ; @ group ( 1 ) @ binding ( 5 ) var O_fn : texture_2d < f32 > ; @ group ( 1 ) @ binding ( 6 ) var O_fo : texture_2d < f32 > ; @ group ( 1 ) @ binding ( 7 ) var < storage , read > O_fp : array < O_fq > ; @ group ( 2 ) @ binding ( 0 ) var < storage , read > O_fr : array < O_fs > ; @ group ( 2 ) @ binding ( 1 ) var < storage , read > O_ft : array < f32 > ; @ group ( 2 ) @ binding ( 2 ) var < storage , read > O_fu : array < O_fv > ; @ group ( 2 ) @ binding ( 3 ) var < storage , read > O_fw : array < vec3 < f32 > > ; @ group ( 2 ) @ binding ( 4 ) var < storage , read > O_fx : array < O_fy > ; @ group ( 2 ) @ binding ( 5 ) var < storage , read > O_fz : array < f32 > ; @ group ( 2 ) @ binding ( 6 ) var < storage , read_write > O_ga : array < f32 , 3 > ; @ group ( 2 ) @ binding ( 7 ) var < uniform > O_gb : O_gc ; @ group ( 2 ) @ binding ( 8 ) var < uniform > O_gd : O_ge ; @ group ( 3 ) @ binding ( 0 ) var O_gf : texture_2d < f32 > ; @ group ( 3 ) @ binding ( 1 ) var < storage , read_write > O_gg : array < vec2 < f32 > > ; var < private > O_gh : vec2 < u32 > ; var < private > O_gi : u32 ; var < private > O_gj : f32 ; var < private > O_gk : bool = false ; var < private > O_gl : u32 = 0 ; fn O_gm ( O_gn : vec3 < u32 > , ) { O_go ( O_gn ) ; O_gp ( ) ; } fn O_go ( O_gn : vec3 < u32 > , ) { let O_gq = u32 ( O_ev . O_gr ) + O_gn . x ; let O_gs = O_gg [ O_gq ] ; O_gh = vec2 < u32 > ( u32 ( O_gs . x ) , u32 ( O_gs . y ) ) ; O_gi = O_gh . x + O_gh . y * Image_Width ; } @ compute @ workgroup_size ( 64 ) fn main ( @ builtin ( global_invocation_id ) O_gn : vec3 < u32 > , ) { let O_gq = u32 ( O_ev . O_gr ) + O_gn . x ; if ( O_gq >= Image_Width * Image_Height ) { return ; } O_gm ( O_gn ) ; if ( O_gh . x >= Image_Width || O_gh . y >= Image_Height ) { return ; } let O_gt = O_gu ( ) ; let O_gv = O_gw ( O_gt ) ; O_gx ( O_gv , O_gt ) ; } @ compute @ workgroup_size ( 1 , 1 ) fn main_hit ( @ builtin ( global_invocation_id ) O_gn : vec3 < u32 > , ) { O_gm ( O_gn ) ; if ( O_gh . x >= Image_Width || O_gh . y >= Image_Height ) { return ; } let O_gt = O_fs ( O_ex . O_gy , normalize ( O_ex . O_gz ) ) ; let O_ha = O_hb ( O_gt , true , false , false ) ; O_ga [ 0 ] = f32 ( O_ha . O_hc ) ; O_ga [ 1 ] = O_ha . O_hd ; O_ga [ 2 ] = f32 ( O_ha . O_he ) ; } @ compute @ workgroup_size ( 8 , 8 ) fn main_demo ( @ builtin ( global_invocation_id ) O_gn : vec3 < u32 > , ) { if ( O_gn . x >= Image_Width || O_gn . y >= Image_Height ) { return ; } O_gi = O_gn . x + O_gn . y * Image_Width ; O_bl ( ) ; O_bl ( ) ; let O_gt = O_gu ( ) ; let O_ha = O_hb ( O_gt , true , false , false ) ; if ( O_ha . O_hc >= 0 ) { O_hf ( O_fp [ O_ha . O_hc ] . O_b ) ; } } fn O_o ( O_b : vec3f , O_d : f32 , O_e : f32 , O_hg : f32 , ) -> vec3f { if ( O_d >= 1.0 ) { return O_b ; } var O_hh = max ( O_e , 1e-5 ) ; var O_hi = O_hj ( O_hh ) ; if ( abs ( O_hg - 0.5 ) > 1e-5 ) { O_hi *= 2.0 * max ( O_hg , 0.0 ) ; O_hh = O_hk ( O_hi ) ; if ( O_e < 1.0 ) { O_hh = 1.0 / O_hh ; } } let O_hl = vec3f ( O_hi ) ; return mix ( O_hl , O_b , O_d ) ; } fn O_hj ( O_e : f32 , ) -> f32 { let O_hh = max ( O_e , 1e-5 ) ; let O_hm = ( O_hh - 1.0 ) / ( O_hh + 1.0 ) ; return O_hm * O_hm ; } fn O_hk ( O_hi : f32 , ) -> f32 { let O_hn = sqrt ( clamp ( O_hi , 0.0 , 0.99 ) ) ; return ( 1.0 + O_hn ) / ( 1.0 - O_hn ) ; } fn O_q ( O_n : vec3 < f32 > , O_ho : f32 , ) -> vec3 < f32 > { return O_n + ( vec3 < f32 > ( 1.0 ) - O_n ) * pow ( 1.0 - O_ho , 5.0 ) ; } fn O_ce ( O_hp : f32 , O_n : vec3 < f32 > , ) -> vec3 < f32 > { return O_n + ( vec3 < f32 > ( 1.0 ) - O_n ) * pow ( 1.0 - O_hp , 5.0 ) ; } fn O_hq ( O_bn : f32 , O_bo : f32 , ) -> vec2 < f32 > { return vec2 < f32 > ( O_bn * cos ( O_bo ) , O_bn * sin ( O_bo ) ) ; } fn O_hr ( O_hs : vec2 < f32 > , ) -> vec2 < f32 > { let O_ht = 2.0 * O_hs . x - 1.0 ; let O_hu = 2.0 * O_hs . y - 1.0 ; if ( O_ht == 0.0 && O_hu == 0.0 ) { return vec2 < f32 > ( 0.0 ) ; } var O_bn : f32 ; var O_bo : f32 ; if ( O_ht * O_ht > O_hu * O_hu ) { O_bn = O_ht ; O_bo = O_ct * ( O_hu / O_ht ) ; } else { O_bn = O_hu ; O_bo = O_cs - O_ct * ( O_ht / O_hu ) ; } return O_hq ( O_bn , O_bo ) ; } fn O_hv ( O_hw : vec3 < f32 > , O_hx : vec3 < f32 > , O_hs : vec2 < f32 > , ) -> vec3 < f32 > { return O_hw * ( 2.0 * O_hs . x - 1.0 ) + O_hx * ( 2.0 * O_hs . y - 1.0 ) ; } fn O_hy ( O_hw : vec3 < f32 > , O_hx : vec3 < f32 > , O_hs : vec2 < f32 > , ) -> vec3 < f32 > { let O_hz = O_hr ( O_hs ) ; return O_hw * O_hz . x + O_hx * O_hz . y ; } fn O_ia ( O_ht : vec3 < f32 > , O_hu : vec3 < f32 > , ) -> f32 { let O_ib = cross ( O_ht , O_hu ) ; let O_ic = dot ( O_ht , O_hu ) ; return O_id ( O_ib ) / O_ic ; } fn O_ie ( O_if : vec3 < f32 > , O_ig : vec3 < f32 > , O_co : f32 , ) -> vec3 < f32 > { let O_ih = cos ( O_co ) ; let O_ii = sin ( O_co ) ; let O_ij = 1.0 - O_ih ; return vec3 < f32 > ( ( O_ih + O_ij * O_ig . x * O_ig . x ) * O_if . x + ( O_ij * O_ig . x * O_ig . y - O_ig . z * O_ii ) * O_if . y + ( O_ij * O_ig . x * O_ig . z + O_ig . y * O_ii ) * O_if . z , ( O_ij * O_ig . x * O_ig . y + O_ig . z * O_ii ) * O_if . x + ( O_ih + O_ij * O_ig . y * O_ig . y ) * O_if . y + ( O_ij * O_ig . y * O_ig . z - O_ig . x * O_ii ) * O_if . z , ( O_ij * O_ig . x * O_ig . z - O_ig . y * O_ii ) * O_if . x + ( O_ij * O_ig . y * O_ig . z + O_ig . x * O_ii ) * O_if . y + ( O_ih + O_ij * O_ig . z * O_ig . z ) * O_if . z ) ; } fn O_ik ( radians : f32 , ) -> f32 { return radians * 180.0 / O_ao ; } fn O_il ( O_im : f32 , ) -> f32 { return O_im * O_ao / 180.0 ; } fn O_id ( O_cm : vec3 < f32 > , ) -> f32 { return length ( O_cm ) ; } fn O_in ( O_cm : vec3 < f32 > , ) -> f32 { return dot ( O_cm , O_cm ) ; } fn O_io ( O_cm : vec2 < f32 > , ) -> f32 { return dot ( O_cm , O_cm ) ; } fn O_ip ( O_cj : f32 , ) -> f32 { return O_cj * O_cj ; } fn O_iq ( O_cm : vec3 < f32 > , ) -> vec3 < f32 > { return O_cm * O_cm ; } fn O_ir ( O_cm : vec4 < f32 > , ) -> vec4 < f32 > { return O_cm * O_cm ; } fn O_is ( O_cm : vec3 < f32 > , ) -> f32 { return min ( min ( O_cm . x , O_cm . y ) , O_cm . z ) ; } fn O_it ( O_cm : vec4 < f32 > , ) -> f32 { return min ( min ( min ( O_cm . x , O_cm . y ) , O_cm . z ) , O_cm . w ) ; } fn O_iu ( O_cj : f32 , ) -> f32 { return select ( 0.0 , sqrt ( O_cj ) , O_cj > 0.0 ) ; } fn O_iv ( O_cm : vec3 < f32 > , ) -> vec3 < f32 > { let O_iw = O_id ( O_cm ) ; return select ( O_cm , O_cm / O_iw , O_iw > O_cu ) ; } fn O_ix ( O_cm : vec3 < f32 > , ) -> vec4 < f32 > { let O_iw = O_id ( O_cm ) ; let O_iy = select ( O_cm , O_cm / O_iw , O_iw > O_cu ) ; return vec4 < f32 > ( O_iy , O_iw ) ; } fn O_iz ( O_cj : f32 , ) -> f32 { return asin ( clamp ( O_cj , - 1.0 , 1.0 ) ) ; } fn O_ja ( O_ht : f32 , O_hu : f32 , ) -> f32 { return select ( 0.0 , O_ht / O_hu , abs ( O_hu ) > O_cu ) ; } fn O_jb ( O_ht : vec3 < f32 > , O_hu : f32 , ) -> vec3 < f32 > { return select ( vec3 < f32 > ( 0.0 ) , O_ht / O_hu , abs ( O_hu ) > O_cu ) ; } fn O_jc ( O_cj : f32 , O_jd : f32 , ) -> f32 { let O_je = select ( 1.0 , - 1.0 , O_jd < 0.0 ) ; return abs ( O_cj ) * O_je ; } fn O_jf ( O_if : vec2 < f32 > , ) -> vec3 < f32 > { let O_jg = dot ( O_if , O_if ) ; return vec3 < f32 > ( O_if . x , O_if . y , O_iu ( 1.0 - O_jg ) ) ; } fn O_jh ( O_if : vec3 < f32 > , O_ji : vec3 < f32 > , O_jj : vec3 < f32 > , O_jk : vec3 < f32 > , ) -> vec3 < f32 > { return O_if . x * O_ji + O_if . y * O_jj + O_if . z * O_jk ; } fn O_jl ( O_cj : f32 , ) -> f32 { return O_cj * O_cj ; } fn O_jm ( O_cj : f32 , ) -> f32 { return 1.0 / sqrt ( max ( O_cj , 1e-10 ) ) ; } fn O_jn ( O_cm : vec3 < f32 > , ) -> f32 { return ( O_cm . x + O_cm . y + O_cm . z ) / 3.0 ; } struct O_jo { O_jp : f32 , O_jq : f32 , O_jr : f32 , O_js : f32 , O_jt : f32 , O_ju : f32 , } fn O_jv ( O_jw : vec3 < f32 > , O_jx : O_jo , ) -> bool { return ( O_jw . x >= O_jx . O_jp && O_jw . x <= O_jx . O_js ) && ( O_jw . y >= O_jx . O_jq && O_jw . y <= O_jx . O_jt ) && ( O_jw . z >= O_jx . O_jr && O_jw . z <= O_jx . O_ju ) ; } fn O_jy ( O_jx : O_jo , ) -> vec3 < f32 > { let O_if = vec3 < f32 > ( O_jx . O_jp + O_jx . O_js , O_jx . O_jq + O_jx . O_jt , O_jx . O_jr + O_jx . O_ju ) ; return O_if / vec3 < f32 > ( 2.0 ) ; } fn O_jz ( O_gy : vec3 < f32 > , O_ka : f32 , ) -> O_jo { let O_kb = O_ka / 2.0 ; return O_jo ( O_gy . x - O_kb , O_gy . y - O_kb , O_gy . z - O_kb , O_gy . x + O_kb , O_gy . y + O_kb , O_gy . z + O_kb , ) ; } fn O_kc ( O_kd : O_jo , O_jw : vec3 < f32 > , ) -> vec3 < f32 > { let O_ke : f32 = 1e-5 ; if abs ( O_jw . x - O_kd . O_jp ) < O_ke { return vec3 < f32 > ( - 1.0 , 0.0 , 0.0 ) ; } if abs ( O_jw . x - O_kd . O_js ) < O_ke { return vec3 < f32 > ( 1.0 , 0.0 , 0.0 ) ; } if abs ( O_jw . y - O_kd . O_jq ) < O_ke { return vec3 < f32 > ( 0.0 , - 1.0 , 0.0 ) ; } if abs ( O_jw . y - O_kd . O_jt ) < O_ke { return vec3 < f32 > ( 0.0 , 1.0 , 0.0 ) ; } if abs ( O_jw . z - O_kd . O_jr ) < O_ke { return vec3 < f32 > ( 0.0 , 0.0 , - 1.0 ) ; } if abs ( O_jw . z - O_kd . O_ju ) < O_ke { return vec3 < f32 > ( 0.0 , 0.0 , 1.0 ) ; } return vec3 < f32 > ( 0.0 , 0.0 , 0.0 ) ; } struct O_kf { O_jp : f32 , O_js : f32 , O_jq : f32 , O_jt : f32 , } fn O_kg ( O_kd : O_kf , O_kh : f32 , ) -> O_kf { return O_kf ( ( O_kd . O_jp + O_kh ) , ( O_kd . O_js - O_kh ) , ( O_kd . O_jq + O_kh ) , ( O_kd . O_jt - O_kh ) ) ; } fn O_ki ( O_kd : O_kf , O_jw : vec2 < f32 > , ) -> bool { let O_kj = O_jw . x >= O_kd . O_jp && O_jw . x <= O_kd . O_js ; let O_kk = O_jw . y >= O_kd . O_jq && O_jw . y <= O_kd . O_jt ; return O_kj && O_kk ; } fn O_kl ( O_km : O_kf , O_kn : O_kf , ) -> bool { let O_ko = O_km . O_jp <= O_kn . O_js && O_km . O_js >= O_kn . O_jp ; let O_kp = O_km . O_jq <= O_kn . O_jt && O_km . O_jt >= O_kn . O_jq ; return O_ko && O_kp ; } struct O_ey { O_gy : vec3 < f32 > , O_kq : vec3 < f32 > , O_kr : vec3 < f32 > , O_ks : vec3 < f32 > , O_gz : vec3 < f32 > , O_kt : f32 , O_ku : f32 , O_kv : f32 , O_kw : f32 , O_kx : vec3 < f32 > , } struct O_fv { O_ky : f32 , O_kz : f32 , O_la : f32 , O_lb : f32 , O_lc : f32 , O_ld : f32 , O_le : f32 , } struct O_eu { O_bb : vec3f , O_gy : vec3f , O_bq : vec3f , O_lf : f32 , O_lg : f32 , O_lh : f32 , } struct O_li { O_hd : f32 , O_bq : vec3 < f32 > , O_lf : O_fq , O_hc : i32 , } fn O_lj ( ) -> O_li { return O_li ( - 1 , O_lk ( ) , O_ll ( ) , - 1 ) ; } struct O_fy { O_jp : f32 , O_js : f32 , O_jq : f32 , O_jt : f32 , O_lm : f32 , O_ln : f32 , } struct O_lo { O_jp : f32 , O_jq : f32 , O_jr : f32 , O_js : f32 , O_jt : f32 , O_ju : f32 , O_lm : f32 , O_ln : f32 , } struct O_fq { O_b : vec3 < f32 > , O_d : f32 , O_c : f32 , O_e : f32 , O_hg : f32 , O_lp : f32 , O_lq : f32 , O_lr : f32 , O_ls : f32 , O_lt : vec3 < f32 > , O_lu : f32 , O_lv : f32 , O_lw : f32 , O_lx : f32 , O_ly : f32 , O_lz : f32 , O_ma : f32 , O_mb : f32 , O_mc : f32 , } fn O_ll ( ) -> O_fq { return O_fq ( vec3f ( 0 ) , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , vec3f ( 0 ) , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ) ; } fn O_md ( O_bn : f32 , O_me : f32 , O_hu : f32 , ) -> O_fq { return O_fq ( vec3f ( O_bn , O_me , O_hu ) , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , vec3f ( 0 ) , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ) ; } struct O_mf { O_mg : vec3f , O_mh : vec3f , O_mi : vec3f , } struct O_mj { O_hd : u32 , O_mk : O_mf , } fn O_ml ( O_mk : O_mf , ) -> vec3f { return cross ( O_mk . O_mh , O_mk . O_mi ) ; } fn O_mm ( O_jw : vec3f , O_mk : O_mf , O_ke : f32 , ) -> bool { let O_bq = O_ml ( O_mk ) ; let O_mn = dot ( O_bq , O_jw - O_mk . O_mg ) ; return abs ( O_mn ) <= O_ke ; } fn O_mo ( O_mp : O_mf , O_mq : O_mf , O_ke : f32 , ) -> bool { let O_lc = O_ml ( O_mp ) ; let O_ld = O_ml ( O_mq ) ; let O_mr = length ( O_lc ) ; let O_ms = length ( O_ld ) ; if ( O_mr < O_ke || O_ms < O_ke ) { return false ; } let O_mt = normalize ( O_lc ) ; let O_mu = normalize ( O_ld ) ; let O_mv = dot ( O_mt , O_mu ) ; if ( abs ( O_mv ) < 1.0 - O_ke ) { return false ; } return O_mm ( O_mq . O_mg , O_mp , O_ke ) ; } fn O_mw ( O_mp : O_mf , O_mq : O_mf , ) -> O_mf { let O_mx = O_mp . O_mg ; let O_my = O_mp . O_mg + O_mp . O_mh ; let O_mz = O_mp . O_mg + O_mp . O_mi ; let O_na = O_mp . O_mg + O_mp . O_mh + O_mp . O_mi ; let O_nb = O_mq . O_mg ; let O_nc = O_mq . O_mg + O_mq . O_mh ; let O_nd = O_mq . O_mg + O_mq . O_mi ; let O_ne = O_mq . O_mg + O_mq . O_mh + O_mq . O_mi ; let O_ml = normalize ( O_ml ( O_mp ) ) ; var O_nf = vec3f ( 1.0 , 0.0 , 0.0 ) ; if ( abs ( dot ( O_ml , O_nf ) ) > 0.9 ) { O_nf = vec3f ( 0.0 , 1.0 , 0.0 ) ; } let O_ng = normalize ( cross ( O_ml , O_nf ) ) ; let O_nh = cross ( O_ml , O_ng ) ; let O_ni = array < vec2f , 4 > ( O_nj ( O_mx , O_mp . O_mg , O_ng , O_nh ) , O_nj ( O_my , O_mp . O_mg , O_ng , O_nh ) , O_nj ( O_mz , O_mp . O_mg , O_ng , O_nh ) , O_nj ( O_na , O_mp . O_mg , O_ng , O_nh ) ) ; let O_nk = array < vec2f , 4 > ( O_nj ( O_nb , O_mp . O_mg , O_ng , O_nh ) , O_nj ( O_nc , O_mp . O_mg , O_ng , O_nh ) , O_nj ( O_nd , O_mp . O_mg , O_ng , O_nh ) , O_nj ( O_ne , O_mp . O_mg , O_ng , O_nh ) ) ; let O_nl = O_nm ( O_ni ) ; let O_nn = O_nm ( O_nk ) ; let O_no = max ( O_nl . x , O_nn . x ) ; let O_np = max ( O_nl . y , O_nn . y ) ; let O_nq = min ( O_nl . z , O_nn . z ) ; let O_nr = min ( O_nl . w , O_nn . w ) ; if ( O_no >= O_nq || O_np >= O_nr ) { return O_mf ( O_mp . O_mg , vec3f ( 0.0 ) , vec3f ( 0.0 ) ) ; } let O_ns = vec2f ( O_no , O_np ) ; let O_nt = vec2f ( O_nq - O_no , O_nr - O_np ) ; let O_nu = O_mp . O_mg + O_ns . x * O_ng + O_ns . y * O_nh ; let O_nv = O_nt . x * O_ng ; let O_nw = O_nt . y * O_nh ; return O_mf ( O_nu , O_nv , O_nw ) ; } fn O_nx ( O_mp : O_mf , O_mq : O_mf , O_ke : f32 , ) -> O_mj { if ( ! O_mo ( O_mp , O_mq , O_ke ) ) { return O_mj ( O_er , O_mp ) ; } let O_ny = O_mw ( O_mp , O_mq ) ; return O_mj ( O_es , O_ny ) ; } fn O_nj ( O_jw : vec3f , O_nz : vec3f , O_ng : vec3f , O_nh : vec3f , ) -> vec2f { let O_oa = O_jw - O_nz ; return vec2f ( dot ( O_oa , O_ng ) , dot ( O_oa , O_nh ) ) ; } fn O_nm ( O_ob : array < vec2f , 4 > , ) -> vec4f { var O_oc = O_ob [ 0 ] ; var O_od = O_ob [ 0 ] ; for ( var O_oe = 1 ; O_oe < 4 ; O_oe ++ ) { O_oc = min ( O_oc , O_ob [ O_oe ] ) ; O_od = max ( O_od , O_ob [ O_oe ] ) ; } return vec4f ( O_oc . x , O_oc . y , O_od . x , O_od . y ) ; } struct O_of { O_gj : f32 , O_og : f32 , O_oh : f32 , O_oi : f32 , O_oj : f32 , O_ok : f32 , O_ol : f32 , O_om : f32 , O_on : f32 , O_oo : f32 , O_op : f32 , O_oq : f32 , } struct O_ew { O_gj : f32 , O_gr : f32 , O_oi : f32 , O_oj : f32 , O_ok : f32 , O_ol : f32 , O_om : f32 , O_on : f32 , O_oo : f32 , O_op : f32 , O_oq : f32 , O_or : f32 , O_os : vec3f , O_ot : f32 , O_ou : f32 , } struct O_gc { O_ov : O_ow , O_ox : O_ow , } struct O_ow { O_jw : vec3 < f32 > , O_bq : vec3 < f32 > , } struct O_fs { O_nz : vec3 < f32 > , O_oy : vec3 < f32 > , } fn O_oz ( ) -> O_fs { return O_fs ( vec3 < f32 > ( 0 ) , vec3 < f32 > ( 0 ) ) ; } fn O_pa ( O_gt : O_fs , O_hd : f32 , ) -> vec3 < f32 > { return O_gt . O_nz + O_hd * O_gt . O_oy ; } struct O_pb { O_hd : f32 , O_bq : vec3 < f32 > , } fn O_pc ( O_gt : O_fs , O_kd : O_jo , ) -> O_pb { let O_pd = vec3 < f32 > ( O_kd . O_jp , O_kd . O_jq , O_kd . O_jr ) ; let O_pe = vec3 < f32 > ( O_kd . O_js , O_kd . O_jt , O_kd . O_ju ) ; let O_pf = 1.0 / O_gt . O_oy ; let sign = vec3 < u32 > ( u32 ( O_pf . x < 0.0 ) , u32 ( O_pf . y < 0.0 ) , u32 ( O_pf . z < 0.0 ) ) ; var O_pg = array < vec3 < f32 > , 2 > ( O_pd , O_pe ) ; var O_ph = ( O_pg [ sign . x ] . x - O_gt . O_nz . x ) * O_pf . x ; var O_pi = ( O_pg [ 1 - sign . x ] . x - O_gt . O_nz . x ) * O_pf . x ; var O_pj = ( O_pg [ sign . y ] . y - O_gt . O_nz . y ) * O_pf . y ; var O_pk = ( O_pg [ 1 - sign . y ] . y - O_gt . O_nz . y ) * O_pf . y ; if ( O_ph > O_pk ) || ( O_pj > O_pi ) { return O_pb ( - 1.0 , vec3 < f32 > ( 0.0 ) ) ; } O_ph = max ( O_ph , O_pj ) ; O_pi = min ( O_pi , O_pk ) ; let O_pl = ( O_pg [ sign . z ] . z - O_gt . O_nz . z ) * O_pf . z ; let O_pm = ( O_pg [ 1 - sign . z ] . z - O_gt . O_nz . z ) * O_pf . z ; if ( O_ph > O_pm ) || ( O_pl > O_pi ) { return O_pb ( - 1.0 , vec3 < f32 > ( 0.0 ) ) ; } O_ph = max ( O_ph , O_pl ) ; O_pi = min ( O_pi , O_pm ) ; if ( O_ph < 0.0 ) { return O_pb ( - 1.0 , vec3 < f32 > ( 0.0 ) ) ; } var O_bq = vec3 < f32 > ( 0.0 ) ; let O_jw = O_gt . O_nz + O_ph * O_gt . O_oy ; let O_pn = 0.001 ; if ( abs ( O_jw . x - O_pd . x ) < O_pn ) { O_bq = vec3 < f32 > ( - 1.0 , 0.0 , 0.0 ) ; } else if ( abs ( O_jw . x - O_pe . x ) < O_pn ) { O_bq = vec3 < f32 > ( 1.0 , 0.0 , 0.0 ) ; } else if ( abs ( O_jw . y - O_pd . y ) < O_pn ) { O_bq = vec3 < f32 > ( 0.0 , - 1.0 , 0.0 ) ; } else if ( abs ( O_jw . y - O_pe . y ) < O_pn ) { O_bq = vec3 < f32 > ( 0.0 , 1.0 , 0.0 ) ; } else if ( abs ( O_jw . z - O_pd . z ) < O_pn ) { O_bq = vec3 < f32 > ( 0.0 , 0.0 , - 1.0 ) ; } else if ( abs ( O_jw . z - O_pe . z ) < O_pn ) { O_bq = vec3 < f32 > ( 0.0 , 0.0 , 1.0 ) ; } return O_pb ( O_ph , O_bq ) ; } fn O_cc ( O_po : vec3 < f32 > , O_bq : vec3 < f32 > , ) -> vec3 < f32 > { let O_pp = dot ( O_po , O_bq ) ; return normalize ( O_po - 2.0 * O_pp * O_bq ) ; } fn O_pq ( O_gt : O_fs , O_jx : O_jo , ) -> f32 { if O_jv ( O_gt . O_nz , O_jx ) { return 0.0 ; } var O_pr : f32 = ( O_jx . O_jp - O_gt . O_nz . x ) / O_gt . O_oy . x ; var O_ps : f32 = ( O_jx . O_js - O_gt . O_nz . x ) / O_gt . O_oy . x ; if O_pr > O_ps { let O_pt = O_pr ; O_pr = O_ps ; O_ps = O_pt ; } var O_pu : f32 = ( O_jx . O_jq - O_gt . O_nz . y ) / O_gt . O_oy . y ; var O_pv : f32 = ( O_jx . O_jt - O_gt . O_nz . y ) / O_gt . O_oy . y ; if O_pu > O_pv { let O_pt = O_pu ; O_pu = O_pv ; O_pv = O_pt ; } if ( O_pr > O_pv ) || ( O_pu > O_ps ) { return - 1.0 ; } if O_pu > O_pr { O_pr = O_pu ; } if O_pv < O_ps { O_ps = O_pv ; } var O_pw : f32 = ( O_jx . O_jr - O_gt . O_nz . z ) / O_gt . O_oy . z ; var O_px : f32 = ( O_jx . O_ju - O_gt . O_nz . z ) / O_gt . O_oy . z ; if O_pw > O_px { let O_pt = O_pw ; O_pw = O_px ; O_px = O_pt ; } if ( O_pr > O_px ) || ( O_pw > O_ps ) { return - 1.0 ; } if O_pw > O_pr { O_pr = O_pw ; } if O_px < O_ps { O_ps = O_px ; } if O_pr < 0.0 { if O_ps < 0.0 { return - 1.0 ; } return O_ps ; } return O_pr ; } fn O_py ( O_gt : O_fs , O_pz : vec3 < f32 > , O_mx : vec3 < f32 > , O_my : vec3 < f32 > , O_mz : vec3 < f32 > , ) -> bool { let O_qa = O_qb ( O_pz , O_mx , O_my ) ; let O_qc = O_qb ( O_mx , O_my , O_mz ) ; return O_qd ( O_gt , O_qa ) > 0.0 || O_qd ( O_gt , O_qc ) > 0.0 ; } fn O_qd ( O_gt : O_fs , O_qe : O_qb , ) -> f32 { let O_ke = 0.00000001 ; let O_qf = O_qe . O_kz - O_qe . O_ky ; let O_qg = O_qe . O_la - O_qe . O_ky ; let O_qh = cross ( O_gt . O_oy , O_qg ) ; let O_ht = dot ( O_qf , O_qh ) ; if O_ht > - O_ke && O_ht < O_ke { return - 1.0 ; } let O_qi = 1.0 / O_ht ; let O_qj = O_gt . O_nz - O_qe . O_ky ; let O_cn = O_qi * dot ( O_qj , O_qh ) ; if O_cn < 0.0 || O_cn > 1.0 { return - 1.0 ; } let O_qk = cross ( O_qj , O_qf ) ; let O_cm = O_qi * dot ( O_gt . O_oy , O_qk ) ; if O_cm < 0.0 || O_cn + O_cm > 1.0 { return - 1.0 ; } let O_hd = O_qi * dot ( O_qg , O_qk ) ; if O_hd > O_ke { return O_hd ; } else { return - 1.0 ; } } fn O_ql ( O_gt : O_fs , O_qm : O_qn , ) -> f32 { let O_qo = O_gt . O_nz - O_qm . O_qp ; let O_ht = dot ( O_gt . O_oy , O_gt . O_oy ) ; let O_hu = 2.0 * dot ( O_qo , O_gt . O_oy ) ; let O_qq = dot ( O_qo , O_qo ) - O_qm . O_qr * O_qm . O_qr ; let O_qs = O_hu * O_hu - 4.0 * O_ht * O_qq ; if O_qs < 0.0 { return - 1.0 ; } else { return ( - O_hu - sqrt ( O_qs ) ) / ( 2.0 * O_ht ) ; } } struct O_qt { O_hd : bool , O_jw : vec3 < f32 > , } fn O_qu ( O_gt : O_fs , O_qv : O_ow , ) -> O_qt { let O_hd = O_qw ( O_gt , O_qv ) ; if O_hd < 0.0 { return O_qt ( false , vec3 < f32 > ( 0 ) ) ; } let O_qx = O_gt . O_nz + O_hd * O_gt . O_oy ; return O_qt ( true , O_qx ) ; } struct O_qy { O_hd : f32 , O_jw : vec3 < f32 > , } fn O_qz ( O_gt : O_fs , O_qv : O_ow , ) -> O_qy { let O_hd = O_qw ( O_gt , O_qv ) ; if O_hd < 0.0 { return O_qy ( - 1 , vec3 < f32 > ( 0 ) ) ; } let O_qx = O_gt . O_nz + O_hd * O_gt . O_oy ; return O_qy ( O_hd , O_qx ) ; } fn O_qw ( O_gt : O_fs , O_qv : O_ow , ) -> f32 { let O_jw = O_qv . O_jw ; let O_bq = O_qv . O_bq ; let O_am = dot ( O_gt . O_oy , O_bq ) ; if ( O_ra ( O_gt . O_oy , O_qv . O_bq ) ) { return - 1.0 ; } let O_rb = O_jw - O_gt . O_nz ; let O_hd = dot ( O_rb , O_bq ) / O_am ; return O_hd ; } struct O_rc { O_rd : vec3 < f32 > , O_re : vec3 < f32 > , } fn O_rf ( O_rg : O_rc , O_kd : O_jo , ) -> bool { var O_ph : f32 = 0.0 ; var O_pi : f32 = 1.0 ; let O_iy : vec3 < f32 > = O_rg . O_re - O_rg . O_rd ; for ( var O_oe : i32 = 0 ; O_oe < 3 ; O_oe = O_oe + 1 ) { let O_rh : f32 = 1.0 / O_iy [ O_oe ] ; var O_qa : f32 ; var O_qc : f32 ; if O_oe == 0 { O_qa = ( O_kd . O_jp - O_rg . O_rd . x ) * O_rh ; O_qc = ( O_kd . O_js - O_rg . O_rd . x ) * O_rh ; } else if O_oe == 1 { O_qa = ( O_kd . O_jq - O_rg . O_rd . y ) * O_rh ; O_qc = ( O_kd . O_jt - O_rg . O_rd . y ) * O_rh ; } else { O_qa = ( O_kd . O_jr - O_rg . O_rd . z ) * O_rh ; O_qc = ( O_kd . O_ju - O_rg . O_rd . z ) * O_rh ; } if O_rh < 0.0 { let O_pt : f32 = O_qa ; O_qa = O_qc ; O_qc = O_pt ; } O_ph = max ( O_ph , O_qa ) ; O_pi = min ( O_pi , O_qc ) ; if O_pi <= O_ph { return false ; } } return true ; } struct O_qn { O_qp : vec3 < f32 > , O_qr : f32 , } fn O_ri ( O_qm : O_qn , O_jw : vec3 < f32 > , ) -> vec3 < f32 > { return normalize ( O_jw - O_qm . O_qp ) ; } fn O_rj ( O_po : vec3 < f32 > , O_bq : vec3 < f32 > , ) -> vec3 < f32 > { return O_po - 2.0 * dot ( O_po , O_bq ) * O_bq ; } struct O_qb { O_ky : vec3 < f32 > , O_kz : vec3 < f32 > , O_la : vec3 < f32 > , } ; fn O_rk ( ) -> O_qb { return O_qb ( vec3 < f32 > ( 0 ) , vec3 < f32 > ( 0 ) , vec3 < f32 > ( 0 ) ) ; } fn O_rl ( O_qe : O_qb , ) -> vec3 < f32 > { return normalize ( O_qe . O_ky - O_qe . O_kz ) ; } fn O_rm ( O_if : vec3 < f32 > , O_ht : vec3 < f32 > , O_hu : vec3 < f32 > , O_qq : vec3 < f32 > , ) -> bool { let O_ky = O_qq - O_ht ; let O_kz = O_hu - O_ht ; let O_la = O_if - O_ht ; let O_rn = dot ( O_ky , O_ky ) ; let O_ro = dot ( O_ky , O_kz ) ; let O_rp = dot ( O_ky , O_la ) ; let O_rq = dot ( O_kz , O_kz ) ; let O_rr = dot ( O_kz , O_la ) ; let O_rs = 1.0 / ( O_rn * O_rq - O_ro * O_ro ) ; let O_cn = ( O_rq * O_rp - O_ro * O_rr ) * O_rs ; let O_cm = ( O_rn * O_rr - O_ro * O_rp ) * O_rs ; return ( O_cn >= 0.0 ) && ( O_cm >= 0.0 ) && ( O_cn + O_cm < 1.0 ) ; } fn O_rt ( O_rg : O_rc , O_qe : O_qb , ) -> bool { let O_pz = O_rg . O_rd ; let O_mx = O_rg . O_re ; let O_ht : vec3 < f32 > = O_qe . O_ky ; let O_hu : vec3 < f32 > = O_qe . O_kz ; let O_qq : vec3 < f32 > = O_qe . O_la ; let O_ru = O_hu - O_ht ; let O_rv = O_qq - O_ht ; let O_bu = cross ( O_ru , O_rv ) ; let O_rw = dot ( O_bu , O_ht ) ; let O_hd = ( O_rw - dot ( O_bu , O_pz ) ) / dot ( O_bu , O_mx - O_pz ) ; if O_hd < 0.0 || O_hd > 1.0 { return false ; } let O_if = O_pz + O_hd * ( O_mx - O_pz ) ; return O_rm ( O_if , O_ht , O_hu , O_qq ) ; } fn O_rx ( O_if : vec3 < f32 > , O_ht : vec3 < f32 > , O_hu : vec3 < f32 > , O_qq : vec3 < f32 > , ) -> vec3 < f32 > { let O_ky = O_hu - O_ht ; let O_kz = O_qq - O_ht ; let O_la = O_if - O_ht ; let O_ry = dot ( O_ky , O_ky ) ; let O_rz = dot ( O_ky , O_kz ) ; let O_sa = dot ( O_kz , O_kz ) ; let O_sb = dot ( O_la , O_ky ) ; let O_sc = dot ( O_la , O_kz ) ; let O_am = O_ry * O_sa - O_rz * O_rz ; let O_cm = ( O_sa * O_sb - O_rz * O_sc ) / O_am ; let O_sd = ( O_ry * O_sc - O_rz * O_sb ) / O_am ; let O_cn = 1.0 - O_cm - O_sd ; return vec3 < f32 > ( O_cn , O_cm , O_sd ) ; } fn O_se ( O_qe : O_qb , O_bq : array < vec3 < f32 > , 3 > , O_sf : vec3 < f32 > , ) -> vec3 < f32 > { let O_sg = O_rx ( O_sf , O_qe . O_ky , O_qe . O_kz , O_qe . O_la ) ; return normalize ( O_sg . x * O_bq [ 0 ] + O_sg . y * O_bq [ 1 ] + O_sg . z * O_bq [ 2 ] ) ; } fn O_lk ( ) -> vec3 < f32 > { return vec3 < f32 > ( 0 , 0 , 0 ) ; } fn O_ra ( O_sh : vec3 < f32 > , O_la : vec3 < f32 > , ) -> bool { let O_pp = dot ( O_sh , O_la ) ; let O_si = length ( O_sh ) ; let O_sj = length ( O_la ) ; return ( O_si > 0.0 ) && ( O_sj > 0.0 ) && ( O_pp >= 0.0 ) ; } fn O_sk ( O_ht : vec3 < f32 > , O_hu : vec3 < f32 > , ) -> f32 { let O_pp = dot ( O_ht , O_hu ) ; let O_sl = length ( O_ht ) * length ( O_hu ) ; return O_pp / O_sl ; } fn O_sm ( O_ht : vec3 < f32 > , O_hu : vec3 < f32 > , ) -> bool { let O_oa = 1.0 / 255.0 ; return abs ( O_ht . x - O_hu . x ) < O_oa && abs ( O_ht . y - O_hu . y ) < O_oa && abs ( O_ht . z - O_hu . z ) < O_oa ; } fn O_sn ( O_bu : vec3f , O_cm : vec3f , ) -> f32 { let O_hp = max ( dot ( normalize ( O_bu ) , normalize ( O_cm ) ) , 0.0 ) ; return O_hp ; } fn O_so ( O_bu : vec3f , O_cm : vec3f , ) -> f32 { let dot = O_sn ( O_bu , O_cm ) ; return acos ( dot ) ; } struct O_fa { O_sp : f32 , O_sq : f32 , O_sr : f32 , O_ss : f32 , O_st : f32 , O_su : f32 , O_sv : f32 , } struct O_fc { O_sw : f32 , O_sx : f32 , O_sy : f32 , O_sz : f32 , O_ta : f32 , } struct O_fe { O_qv : f32 , O_sx : f32 , O_ka : f32 , O_tb : f32 , O_tc : f32 , O_td : f32 , O_te : f32 , O_tf : f32 , O_tg : f32 , O_th : f32 , } struct O_bf { O_i : vec3f , O_bj : vec3f , } fn O_ti ( O_tj : vec3 < f32 > , ) -> vec3 < f32 > { var O_tk : vec3 < f32 > = O_tj ; if ( O_tk . x != O_tk . x ) { O_tk . x = 0 ; } if ( O_tk . y != O_tk . y ) { O_tk . y = 0 ; } if ( O_tk . z != O_tk . z ) { O_tk . z = 0 ; } return O_tk ; } fn O_gu ( ) -> O_fs { O_bl ( ) ; O_bl ( ) ; return O_fr [ O_gi ] ; } fn O_tl ( O_if : vec3 < f32 > , O_ht : vec3 < f32 > , O_hu : vec3 < f32 > , O_qq : vec3 < f32 > , ) -> vec3 < f32 > { let O_ky = O_hu - O_ht ; let O_kz = O_qq - O_ht ; let O_la = O_if - O_ht ; let O_ry = dot ( O_ky , O_ky ) ; let O_rz = dot ( O_ky , O_kz ) ; let O_sa = dot ( O_kz , O_kz ) ; let O_sb = dot ( O_la , O_ky ) ; let O_sc = dot ( O_la , O_kz ) ; let O_am = O_ry * O_sa - O_rz * O_rz ; let O_cm = ( O_sa * O_sb - O_rz * O_sc ) / O_am ; let O_sd = ( O_ry * O_sc - O_rz * O_sb ) / O_am ; let O_cn = 1.0 - O_cm - O_sd ; return vec3 < f32 > ( O_cn , O_cm , O_sd ) ; } fn O_tm ( O_qe : O_qb , O_bq : array < vec3 < f32 > , 3 > , O_sf : vec3 < f32 > , ) -> vec3 < f32 > { let O_sg = O_tl ( O_sf , O_qe . O_ky , O_qe . O_kz , O_qe . O_la ) ; return normalize ( O_sg . x * O_bq [ 0 ] + O_sg . y * O_bq [ 1 ] + O_sg . z * O_bq [ 2 ] ) ; } fn O_hf ( O_tk : vec3 < f32 > , ) { if ( O_gk ) { return ; } O_et [ O_gi ] . O_bb = O_ti ( O_tk ) ; O_gk = true ; } fn O_gx ( O_gv : O_tn , O_gt : O_fs , ) { O_hf ( O_gv . O_tk ) ; O_et [ O_gi ] . O_lh = f32 ( O_gv . O_bb ) ; O_et [ O_gi ] . O_bq = O_gv . O_by ; O_et [ O_gi ] . O_gy = O_gv . O_gy ; O_et [ O_gi ] . O_lf = f32 ( O_gv . O_hc ) ; O_et [ O_gi ] . O_lg = length ( O_gv . O_gy - O_gt . O_nz ) ; } fn O_to ( O_tp : vec3 < f32 > , ) { var O_bq = normalize ( O_tp ) ; O_bq = O_bq + vec3 < f32 > ( 1.0 ) ; O_bq = O_bq * 0.5 ; O_hf ( O_bq ) ; } fn O_tq ( ) { O_hf ( vec3 < f32 > ( 1.0 , 0.0 , 0.0 ) ) ; } fn O_tr ( ) { O_hf ( vec3 < f32 > ( 0.0 , 0.0 , 1.0 ) ) ; } fn O_ts ( O_tt : u32 , O_tu : u32 , ) { let O_tv = f32 ( O_tt ) / f32 ( O_tu ) ; O_hf ( vec3 < f32 > ( O_tv , O_tv , O_tv ) ) ; } fn O_tw ( O_tk : u32 , ) { let O_qi = 1.0 / f32 ( O_tk + 1 ) ; O_hf ( vec3 < f32 > ( O_qi , O_qi , O_qi ) ) ; } fn O_tx ( O_tk : vec3 < f32 > , ) -> bool { return O_tk . x > 0.0 && O_tk . y > 0.0 && O_tk . z > 0.0 ; } fn O_ty ( O_tj : vec3 < f32 > , ) -> vec3 < f32 > { var O_tk : vec3 < f32 > = O_tj ; let O_tz : f32 = 1.0 / 2.2 ; O_tk . x = pow ( O_tk . x , O_tz ) ; O_tk . y = pow ( O_tk . y , O_tz ) ; O_tk . z = pow ( O_tk . z , O_tz ) ; return O_tk ; } fn O_gp ( ) { let O_ua = O_ev . O_gj ; O_gj = O_ua * ( f32 ( O_gi ) / f32 ( Image_Width * Image_Height ) ) ; O_gj = O_ub ( O_gj ) ; } fn O_bl ( ) -> f32 { let O_uc = O_ud ( O_gj ) ; O_gj = O_uc ; return O_uc ; } fn O_ue ( O_ua : f32 , ) -> f32 { var O_uf = u32 ( O_ua * 1e6 ) ; O_uf ^= O_uf << 13 ; O_uf ^= O_uf >> 17 ; O_uf ^= O_uf << 5 ; return f32 ( O_uf ) * 2.3283064e-10 ; } fn O_ug ( O_ua : f32 , ) -> f32 { var O_ky = u32 ( O_ua * 1e6 ) ; var O_kz = u32 ( O_ua * 1e6 + 1.0 ) ; var O_uh = 0u ; for ( var O_oe = 0u ; O_oe < 4u ; O_oe ++ ) { O_uh += 0x9e3779b9u ; O_ky += ( ( O_kz << 4u ) + 0xa341316cu ) ^ ( O_kz + O_uh ) ^ ( ( O_kz >> 5u ) + 0xc8013ea4u ) ; O_kz += ( ( O_ky << 4u ) + 0xad90777du ) ^ ( O_ky + O_uh ) ^ ( ( O_ky >> 5u ) + 0x7e95761eu ) ; } return f32 ( O_ky ^ O_kz ) / 4294967296.0 ; } fn O_ui ( O_ua : f32 , ) -> f32 { var O_uf = u32 ( O_ua * 1e6 ) ; O_uf = O_uf * 0x53a2f814u + 0x74736975u ; O_uf = ( O_uf ^ ( O_uf >> 16 ) ) * 0x7feb352du ; O_uf = ( O_uf ^ ( O_uf >> 15 ) ) * 0x846ca68bu ; return f32 ( O_uf ^ ( O_uf >> 16 ) ) / 4294967296.0 ; } fn O_ud ( O_ua : f32 , ) -> f32 { let O_ht : f32 = 1664525.0 ; let O_qq : f32 = 1013904223.0 ; let O_le : f32 = 4294967296.0 ; return fract ( ( O_ht * O_ua * 100000.0 + O_qq ) / O_le ) ; } fn O_uj ( O_ua : f32 , ) -> f32 { var O_uf = u32 ( O_ua * 1e6 ) ; O_uf = O_uf * 747796405u + 2891336453u ; let O_uk = ( ( O_uf >> ( ( O_uf >> 28u ) + 4u ) ) ^ O_uf ) * 277803737u ; return f32 ( ( O_uk >> 22u ) ^ O_uk ) / 4294967296.0 ; } fn O_ub ( O_ua : f32 , ) -> f32 { return fract ( sin ( O_ua * 43758.5453 ) * 12345.6789 ) ; } fn O_ul ( ) -> f32 { return 2.0 * O_bl ( ) - 1.0 ; } fn O_cp ( ) -> f32 { return O_ul ( ) * O_ao ; } fn O_ck ( min : f32 , max : f32 , ) -> f32 { return min + ( max - min ) * O_bl ( ) ; } fn O_um ( ) -> vec3 < f32 > { while ( true ) { let O_iy = normalize ( vec3 < f32 > ( O_un ( ) , O_un ( ) , O_un ( ) ) ) ; if ( length ( O_iy ) != 0 ) { return O_iy ; } } return vec3 < f32 > ( 0 ) ; } fn O_un ( ) -> f32 { return sqrt ( - 2 * log ( O_bl ( ) ) ) * cos ( 2 * O_ao * O_bl ( ) ) ; } fn O_gw ( O_gt : O_fs , ) -> O_tn { var O_uo = O_up ( O_gt , true , true , O_gd . O_uq == 1.0 ) ; if ( O_uo . O_bb != O_el ) { return O_uo ; } O_uo . O_tk = O_ur ( O_uo ) ; var O_h = O_gt . O_oy ; var O_bj = vec3f ( 1 ) ; var O_gv = O_uo ; for ( var O_oe = 0 ; O_oe < i32 ( O_ev . O_oi ) ; O_oe += 1 ) { var O_bg : O_us = O_ut ( O_gv . O_b , O_gv . O_c , O_gv . O_d , O_gv . O_e , O_gv . O_hg , O_gv . O_bz , - O_gv . O_bw , vec3f ( O_bl ( ) , O_bl ( ) , O_bl ( ) ) ) ; O_h = O_bg . O_i ; O_bj *= ( O_bg . O_qi / O_bg . O_uu ) ; O_gv = O_up ( O_fs ( O_gv . O_gy + 0.001 * O_h , O_h ) , false , false , false ) ; if ( O_gv . O_bb != O_el ) { O_uo . O_tk += O_gv . O_tk * O_bj ; return O_uo ; } O_uo . O_tk += O_ur ( O_gv ) * O_bj ; } return O_uo ; } fn O_ut ( O_b : vec3 < f32 > , O_c : f32 , O_d : f32 , O_e : f32 , O_f : f32 , O_g : vec3 < f32 > , O_j : vec3 < f32 > , O_hs : vec3 < f32 > , ) -> O_us { let O_uv = O_o ( vec3 < f32 > ( 1.0 ) , O_d , O_e , O_f ) ; let O_m = max ( dot ( O_g , O_j ) , 0.0 ) ; let O_p = O_q ( O_uv , O_m ) ; let O_uw = O_jn ( O_p ) * O_d + ( 1.0 - O_d ) * O_f ; let O_ux = 1.0 - O_uw ; if ( O_uw < 1e-5 ) { let O_uy = O_uz ( O_g , O_hs . xy ) ; let O_r = ( 1.0 - O_jn ( O_p ) ) * ( 1.0 - O_d ) ; let O_va = O_b * O_r * O_t ; return O_us ( O_uy . O_i , O_uy . O_uu , O_va ) ; } if ( O_ux < 1e-5 ) { return O_vb ( O_b , O_c , O_d , O_e , O_f , O_g , O_j , O_hs ) ; } if ( O_hs . z < O_uw ) { let O_vc = O_vb ( O_b , O_c , O_d , O_e , O_f , O_g , O_j , O_hs ) ; if ( O_vc . O_uu > 0.0 ) { let O_i = O_vc . O_i ; if ( O_c < 1e-5 ) { let O_n = O_o ( O_b , O_d , O_e , O_f ) ; let O_vd = max ( dot ( O_g , O_i ) , 0.0 ) ; let O_p = O_q ( O_n , O_vd ) ; let O_ve = O_uw ; let O_vf = O_p * O_ve ; return O_us ( O_i , O_ve , O_vf ) ; } let O_vd = max ( dot ( O_g , O_i ) , 0.0 ) ; let O_vg = O_vd * O_t ; let O_vh = O_uw * O_vc . O_uu + O_ux * O_vg ; let O_vi = O_a ( O_b , O_c , O_d , O_e , O_f , O_g , O_i , O_j ) ; return O_us ( O_i , O_vh , O_vi ) ; } } let O_uy = O_uz ( O_g , O_hs . xy ) ; let O_i = O_uy . O_i ; let O_av = normalize ( O_j + O_i ) ; let O_ah = max ( dot ( O_g , O_av ) , 0.0 ) ; let O_aw = max ( dot ( O_j , O_av ) , 0.0 ) ; let O_ax = O_ag ( O_ah , O_c ) ; let O_vj = O_ax * O_ah / max ( 4.0 * O_aw , 1e-10 ) ; let O_vh = O_uw * O_vj + O_ux * O_uy . O_uu ; let O_vi = O_a ( O_b , O_c , O_d , O_e , O_f , O_g , O_i , O_j ) ; return O_us ( O_i , O_vh , O_vi ) ; } fn O_vb ( O_b : vec3 < f32 > , O_c : f32 , O_d : f32 , O_e : f32 , O_f : f32 , O_g : vec3 < f32 > , O_j : vec3 < f32 > , O_hs : vec3 < f32 > , ) -> O_us { if ( O_d < 1e-5 && O_f < 1e-5 ) { return O_us ( vec3 < f32 > ( 0.0 ) , 0.0 , vec3 < f32 > ( 0.0 ) ) ; } if ( O_c < 1e-5 ) { let O_vk = normalize ( O_j ) ; let O_m = max ( dot ( O_g , O_vk ) , 0.0 ) ; if ( O_m <= 0.0 ) { return O_us ( vec3 < f32 > ( 0.0 ) , 0.0 , vec3 < f32 > ( 0.0 ) ) ; } let O_i = 2.0 * O_m * O_g - O_vk ; let O_vl = normalize ( O_i ) ; let O_uu = 1.0 ; let O_qi = O_v ( O_b , O_c , O_d , O_e , O_f , O_g , O_j , O_vl ) ; return O_us ( O_vl , O_uu , O_qi ) ; } let O_ai = O_c * O_c ; let O_vm = O_ai ; let O_vn = O_ai ; var O_ji : vec3 < f32 > ; var O_jj : vec3 < f32 > ; if ( abs ( O_g . z ) < 0.9 ) { O_ji = normalize ( cross ( O_g , vec3 < f32 > ( 0.0 , 0.0 , 1.0 ) ) ) ; } else { O_ji = normalize ( cross ( O_g , vec3 < f32 > ( 1.0 , 0.0 , 0.0 ) ) ) ; } O_jj = cross ( O_g , O_ji ) ; let O_vo = vec3 < f32 > ( dot ( O_ji , O_j ) , dot ( O_jj , O_j ) , dot ( O_g , O_j ) ) ; let O_vp = O_vq ( O_vo , O_vm , O_vn , O_hs . xy ) ; let O_av = O_jh ( O_vp , O_ji , O_jj , O_g ) ; let O_aw = max ( dot ( O_j , O_av ) , 0.0 ) ; let O_i = 2.0 * O_aw * O_av - O_j ; let O_vl = normalize ( O_i ) ; let O_vd = dot ( O_g , O_vl ) ; if ( O_vd <= 0.0 ) { return O_us ( vec3 < f32 > ( 0.0 ) , 0.0 , vec3 < f32 > ( 0.0 ) ) ; } let O_m = max ( dot ( O_g , O_j ) , 0.0 ) ; let O_ah = max ( dot ( O_g , O_av ) , 0.0 ) ; let O_y = O_ai * O_ai ; let O_ax = O_ag ( O_ah , O_c ) ; let O_uu = O_ax * O_ah / max ( 4.0 * O_aw , 1e-10 ) ; let O_qi = O_v ( O_b , O_c , O_d , O_e , O_f , O_g , O_j , O_vl ) ; return O_us ( O_vl , O_uu , O_qi ) ; } fn O_uz ( O_g : vec3 < f32 > , O_hs : vec2 < f32 > , ) -> O_us { let O_bn = sqrt ( O_hs . x ) ; let O_vr = 2.0 * O_ao * O_hs . y ; let O_cj = O_bn * cos ( O_vr ) ; let O_jd = O_bn * sin ( O_vr ) ; let O_vs = sqrt ( max ( 1.0 - O_cj * O_cj - O_jd * O_jd , 0.0 ) ) ; var O_vt : vec3 < f32 > ; var O_vu : vec3 < f32 > ; if ( abs ( O_g . z ) < 0.9 ) { O_vt = normalize ( cross ( O_g , vec3 < f32 > ( 0.0 , 0.0 , 1.0 ) ) ) ; } else { O_vt = normalize ( cross ( O_g , vec3 < f32 > ( 1.0 , 0.0 , 0.0 ) ) ) ; } O_vu = cross ( O_g , O_vt ) ; let O_i = O_cj * O_vt + O_jd * O_vu + O_vs * O_g ; let O_vl = normalize ( O_i ) ; let O_uu = O_vs * O_t ; return O_us ( O_vl , O_uu , vec3 < f32 > ( 0.0 ) ) ; } fn O_ur ( O_gv : O_tn , ) -> vec3f { if ( O_ev . O_ou == 0.0 ) { return vec3f ( ) ; } var O_tk : vec3f ; let O_vv = O_gv . O_gy ; let O_vw = O_gv . O_by ; let O_vx = O_gv . O_bz ; let O_b = O_gv . O_b ; let O_c = O_gv . O_c ; let O_d = O_gv . O_d ; let O_vy = - O_gv . O_bw ; let O_e = O_gv . O_e ; let O_vz = O_gv . O_hg ; for ( var O_oe = 0 ; O_oe < O_eh ; O_oe ++ ) { let O_wa = O_fg [ O_oe ] ; if ( O_wa . O_wb == 1.0 || O_wa . O_wc == 0.0 ) { continue ; } let O_wd = O_we ( O_wa . O_wf ) ; let O_wg = O_wh ( O_wa . O_gy + 0.50 * O_wa . O_cn + 0.5 * O_wa . O_cm , O_wi ( normalize ( O_wa . O_cn ) , normalize ( O_wa . O_cm ) , length ( O_wa . O_cn ) , length ( O_wa . O_cm ) , normalize ( cross ( O_wa . O_cn , O_wa . O_cm ) ) , 1.0 / ( length ( O_wa . O_cn ) * length ( O_wa . O_cm ) ) , O_wd . O_wj , O_wd . O_wk , ) ) ; let O_wl = O_wa . O_tk * O_wa . O_wc ; let O_wm = vec2f ( O_bl ( ) , O_bl ( ) ) ; let O_wn = vec3f ( O_bl ( ) , O_bl ( ) , O_bl ( ) ) ; let O_wo = O_wa . O_wp > 0.0 ; O_tk += O_wq ( O_vv , O_vw , O_vx , O_b , O_c , O_d , O_e , O_vz , O_vy , O_wg , O_wl , O_wm , O_wn , O_wo ) ; } return O_tk ; } fn O_wq ( O_vv : vec3 < f32 > , O_vw : vec3 < f32 > , O_vx : vec3 < f32 > , O_b : vec3 < f32 > , O_c : f32 , O_d : f32 , O_e : f32 , O_f : f32 , O_vy : vec3 < f32 > , O_wg : O_wh , O_wl : vec3 < f32 > , O_wr : vec2 < f32 > , O_wn : vec3 < f32 > , O_wo : bool , ) -> vec3 < f32 > { var O_bj = vec3 < f32 > ( 0.0 ) ; let O_ws = O_wt ( O_vv , O_vw , O_vx , O_b , O_c , O_d , O_e , O_f , O_vy , O_wg , O_wl , O_wr , O_wo ) ; let O_wu = O_wv ( O_wg , O_vv , O_wg . O_ww , O_wr , true , false ) ; let O_wx = O_wu . O_wy . O_uu ; if ( O_wx > 0.0 && O_wu . O_wz ) { let O_h = O_wu . O_wy . O_ax ; let O_xa = O_xb ( O_c , O_d , O_e , O_f , O_vx , O_h , O_vy ) ; let O_xc = O_xd ( O_wx , O_xa ) ; O_bj += O_ws * O_xc ; } let O_xe = O_xf ( O_c , O_d , O_e , O_f , O_vx , O_vy , O_wn ) ; if ( O_xe . O_uu > 0.0 ) { let O_i = O_xe . O_i ; let O_xg = O_xe . O_uu ; let O_xh = O_a ( O_b , O_c , O_d , O_e , O_f , O_vx , O_i , O_vy ) ; let O_xi = dot ( O_vw , O_i ) ; if ( O_xi > 0.0 ) { let O_xj = O_wg . O_wa . O_iy ; let O_xk = O_wg . O_ww ; let O_xl = O_xk - O_vv ; let O_xm = dot ( O_xl , O_xj ) ; let O_xn = O_xm / max ( dot ( O_i , O_xj ) , 1e-10 ) ; if ( O_xn > 0.0 ) { let O_xo = O_vv + O_i * O_xn ; let O_xp = O_xo - O_xk ; let O_xq = dot ( O_xp , O_wg . O_wa . O_xr ) ; let O_xs = dot ( O_xp , O_wg . O_wa . O_xt ) ; let O_xu = O_wg . O_wa . O_xv * 0.5 ; let O_xw = O_wg . O_wa . O_xx * 0.5 ; let O_xy = ( O_wg . O_wa . O_xz < 0.0 ) ; var O_ya = false ; if ( O_xy ) { let O_yb = O_xq / O_xu ; let O_yc = O_xs / O_xw ; O_ya = ( O_yb * O_yb + O_yc * O_yc <= 1.0 ) ; } else { O_ya = ( abs ( O_xq ) <= O_xu && abs ( O_xs ) <= O_xw ) ; } if ( O_ya ) { var O_uq = true ; if ( O_wo ) { let O_yd = O_vv + O_vw * 0.001 ; O_uq = O_ye ( O_yd , O_i , O_xn - 0.001 ) ; } if ( O_uq ) { let O_yf = O_xo - O_vv ; let O_yg = length ( O_yf ) ; let O_yh = O_yf / max ( O_yg , 1e-10 ) ; let O_yi = O_wv ( O_wg , O_vv , O_xo , vec2 < f32 > ( 0.0 ) , false , false ) ; if ( O_yi . O_wz ) { let O_yj = O_yi . O_wy . O_uu ; if ( O_yj > 0.0 ) { let O_yk = O_wl * O_yi . O_wy . O_yl ; let O_ym = max ( dot ( O_vx , O_i ) , 0.0 ) ; var O_yn : vec3 < f32 > ; if ( O_c < 1e-5 ) { let O_n = O_o ( O_b , O_d , O_e , O_f ) ; let O_yo = max ( dot ( O_vx , O_vy ) , 0.0 ) ; let O_p = O_q ( O_n , O_yo ) ; O_yn = O_yk * O_p * O_ym ; } else { O_yn = ( O_yk * O_xh * O_ym ) / max ( O_xg , 1e-10 ) ; } let O_yp = O_xd ( O_xg , O_yj ) ; O_bj += O_yn * O_yp ; } } } } } } } return clamp ( O_bj , vec3 < f32 > ( 0.0 ) , vec3 < f32 > ( 1e4 ) ) ; } fn O_yq ( O_c : f32 , O_g : vec3 < f32 > , O_j : vec3 < f32 > , O_k : vec3 < f32 > , ) -> f32 { let O_at = O_j + O_k ; let O_au = length ( O_at ) ; if ( O_au < 1e-6 ) { return 0.0 ; } let O_av = O_at / O_au ; let O_l = max ( dot ( O_g , O_k ) , 0.0 ) ; let O_m = max ( dot ( O_g , O_j ) , 0.0 ) ; let O_ah = dot ( O_g , O_av ) ; if ( O_l <= 0.0 || O_m <= 0.0 || O_ah <= 0.0 ) { return 0.0 ; } let O_ai = O_c * O_c ; let O_y = O_ai * O_ai ; if ( O_y <= O_w ) { return 0.0 ; } let O_aj = clamp ( O_ah , - 1.0 , 1.0 ) ; let O_ak = min ( O_aj * O_aj , 1.0 ) ; let O_al = 1.0 - O_ak ; let O_am = O_al + O_y * O_ak ; let O_ax = O_y / max ( O_ao * O_am * O_am , 1e-10 ) ; let O_aq = O_x ( O_y , O_l ) ; let O_az = O_ax * 0.25 ; return O_az / max ( O_l * ( 1.0 + O_aq ) , 1e-10 ) ; } fn O_xd ( O_yr : f32 , O_ys : f32 , ) -> f32 { let O_yt = O_yr * O_yr ; let O_yu = O_ys * O_ys ; return O_yt / max ( O_yt + O_yu , 1e-10 ) ; } struct O_us { O_i : vec3 < f32 > , O_uu : f32 , O_qi : vec3 < f32 > , } fn O_xf ( O_c : f32 , O_d : f32 , O_e : f32 , O_f : f32 , O_g : vec3 < f32 > , O_j : vec3 < f32 > , O_hs : vec3 < f32 > , ) -> O_us { if ( O_d < 1e-5 && O_f < 1e-5 ) { return O_us ( vec3 < f32 > ( 0.0 ) , 0.0 , vec3 < f32 > ( 0.0 ) ) ; } if ( O_c < 1e-5 ) { let O_m = max ( dot ( O_g , O_j ) , 0.0 ) ; if ( O_m <= 0.0 ) { return O_us ( vec3 < f32 > ( 0.0 ) , 0.0 , vec3 < f32 > ( 0.0 ) ) ; } let O_i = 2.0 * O_m * O_g - O_j ; let O_vl = normalize ( O_i ) ; let O_uu = 1e10 ; let O_yv = vec3 < f32 > ( 1.0 ) ; let O_qi = O_v ( O_yv , O_c , O_d , O_e , O_f , O_g , O_j , O_vl ) ; return O_us ( O_vl , O_uu , O_qi ) ; } let O_ai = max ( O_c * O_c , 1e-6 ) ; let O_vm = O_ai ; let O_vn = O_ai ; var O_ji : vec3 < f32 > ; var O_jj : vec3 < f32 > ; if ( abs ( O_g . z ) < 0.9 ) { O_ji = normalize ( cross ( O_g , vec3 < f32 > ( 0.0 , 0.0 , 1.0 ) ) ) ; } else { O_ji = normalize ( cross ( O_g , vec3 < f32 > ( 1.0 , 0.0 , 0.0 ) ) ) ; } O_jj = cross ( O_g , O_ji ) ; let O_vo = vec3 < f32 > ( dot ( O_ji , O_j ) , dot ( O_jj , O_j ) , dot ( O_g , O_j ) ) ; let O_vp = O_vq ( O_vo , O_vm , O_vn , O_hs . xy ) ; let O_av = O_jh ( O_vp , O_ji , O_jj , O_g ) ; let O_aw = max ( dot ( O_j , O_av ) , 0.0 ) ; let O_i = 2.0 * O_aw * O_av - O_j ; let O_vl = normalize ( O_i ) ; let O_vd = dot ( O_g , O_vl ) ; if ( O_vd <= 0.0 ) { return O_us ( vec3 < f32 > ( 0.0 ) , 0.0 , vec3 < f32 > ( 0.0 ) ) ; } let O_m = max ( dot ( O_g , O_j ) , 0.0 ) ; let O_ah = max ( dot ( O_g , O_av ) , 0.0 ) ; let O_y = O_ai * O_ai ; let O_ax = O_ag ( O_ah , O_c ) ; let O_uu = O_ax * O_ah / max ( 4.0 * O_aw , 1e-10 ) ; let O_yv = vec3 < f32 > ( 1.0 ) ; let O_qi = O_v ( O_yv , O_c , O_d , O_e , O_f , O_g , O_j , O_vl ) ; return O_us ( O_vl , O_uu , O_qi ) ; } fn O_vq ( O_h : vec3 < f32 > , O_vm : f32 , O_vn : f32 , O_hs : vec2 < f32 > , ) -> vec3 < f32 > { let O_yw = normalize ( vec3 < f32 > ( O_vm * O_h . x , O_vn * O_h . y , O_h . z ) ) ; let O_yx = O_jl ( O_yw . x ) + O_jl ( O_yw . y ) ; var O_yy : vec3 < f32 > ; var O_yz : vec3 < f32 > ; if ( O_yx > 1e-7 ) { O_yy = vec3 < f32 > ( - O_yw . y , O_yw . x , 0.0 ) * O_jm ( O_yx ) ; O_yz = cross ( O_yw , O_yy ) ; } else { O_yy = vec3 < f32 > ( 1.0 , 0.0 , 0.0 ) ; O_yz = vec3 < f32 > ( 0.0 , 1.0 , 0.0 ) ; } let O_hd = O_hr ( O_hs ) ; let O_za = mix ( O_iu ( 1.0 - O_jl ( O_hd . x ) ) , O_hd . y , 0.5 * ( 1.0 + O_yw . z ) ) ; let O_zb = vec2 < f32 > ( O_hd . x , O_za ) ; let O_zc = O_jh ( O_jf ( O_zb ) , O_yy , O_yz , O_yw ) ; return normalize ( vec3 < f32 > ( O_vm * O_zc . x , O_vn * O_zc . y , max ( 0.0 , O_zc . z ) ) ) ; } fn O_wt ( O_vv : vec3 < f32 > , O_vw : vec3 < f32 > , O_vx : vec3 < f32 > , O_b : vec3 < f32 > , O_c : f32 , O_d : f32 , O_e : f32 , O_f : f32 , O_vy : vec3 < f32 > , O_wg : O_wh , O_wl : vec3 < f32 > , O_wm : vec2 < f32 > , O_wo : bool , ) -> vec3 < f32 > { let O_wu = O_wv ( O_wg , O_vv , O_wg . O_ww , O_wm , true , false ) ; if ( ! O_wu . O_wz || O_wu . O_wy . O_uu <= 0.0 ) { return vec3 < f32 > ( 0.0 ) ; } let O_zd = O_wu . O_wy . O_ax ; let distance = O_wu . O_wy . O_hd ; let O_uu = O_wu . O_wy . O_uu ; let O_yl = O_wu . O_wy . O_yl ; let O_h = O_zd ; let O_ze = dot ( O_vw , O_h ) ; if ( O_ze <= 0.0 ) { return vec3 < f32 > ( 0.0 ) ; } if ( O_wo ) { let O_yd = O_vv + O_vw * 0.001 ; if ( ! O_ye ( O_yd , O_h , distance - 0.001 ) ) { return vec3 < f32 > ( 0.0 ) ; } } let O_zf = dot ( O_vx , O_h ) ; if ( O_zf <= 0.0 ) { return vec3 < f32 > ( 0.0 ) ; } let O_zg = O_wl * O_yl ; let O_qi = O_a ( O_b , O_c , O_d , O_e , O_f , O_vx , O_h , O_vy ) ; let O_bj = ( O_zg * O_qi * O_zf ) / max ( O_uu , 1e-10 ) ; return clamp ( O_bj , vec3 < f32 > ( 0.0 ) , vec3 < f32 > ( 1e4 ) ) ; } fn O_xb ( O_c : f32 , O_d : f32 , O_e : f32 , O_f : f32 , O_g : vec3 < f32 > , O_h : vec3 < f32 > , O_i : vec3 < f32 > , ) -> f32 { let O_j = normalize ( O_i ) ; let O_k = normalize ( O_h ) ; let O_l = max ( dot ( O_g , O_k ) , 0.0 ) ; let O_m = max ( dot ( O_g , O_j ) , 0.0 ) ; if ( O_l <= 0.0 || O_m <= 0.0 ) { return 0.0 ; } let O_uv = O_o ( vec3 < f32 > ( 1.0 ) , O_d , O_e , O_f ) ; let O_p = O_q ( O_uv , O_m ) ; let O_uw = O_jn ( O_p ) * O_d + ( 1.0 - O_d ) * O_f ; let O_ux = 1.0 - O_uw ; let O_vg = O_l * O_t ; let O_av = normalize ( O_j + O_k ) ; let O_ah = max ( dot ( O_g , O_av ) , 0.0 ) ; let O_aw = max ( dot ( O_j , O_av ) , 0.0 ) ; let O_ax = O_ag ( O_ah , O_c ) ; let O_vj = O_ax * O_ah / max ( 4.0 * O_aw , 1e-10 ) ; return O_ux * O_vg + O_uw * O_vj ; } fn O_zh ( O_gt : O_fs , ) -> O_li { let O_ha = O_zi ( O_gt ) ; if ( O_ha . O_hd < 0 ) { return O_lj ( ) ; } var O_hc : i32 ; if ( O_zj ( O_ha . O_jw ) ) { O_hc = i32 ( O_fd . O_sx ) ; } else { O_hc = i32 ( O_fd . O_qv ) ; } let O_lf = O_fp [ O_hc ] ; return O_li ( O_ha . O_hd , vec3 < f32 > ( 0.0 , 0.0 , 1.0 ) , O_lf , O_hc ) ; } fn O_zj ( O_jw : vec2f , ) -> bool { { let O_kb = O_fd . O_ka / 2.0 ; let O_zk = O_fd . O_tb / 2.0 ; let O_zl = vec2f ( O_kb - O_fd . O_td , O_zk - O_fd . O_td ) ; let O_kd = O_kf ( O_zl . x - O_fd . O_tg , O_zl . x , O_zl . y - O_fd . O_th , O_zl . y ) ; if ( O_ki ( O_kd , O_jw ) ) { let O_zm = O_kd . O_js - O_kd . O_jp ; let O_zn = O_kd . O_jt - O_kd . O_jq ; let O_zo = vec2f ( ( O_jw . x - O_kd . O_jp ) / O_zm , 1.0 - ( O_jw . y - O_kd . O_jq ) / O_zn ) ; let O_zp = vec2 < i32 > ( O_zo * vec2 < f32 > ( textureDimensions ( O_gf ) ) ) ; var O_tk = textureLoad ( O_gf , O_zp , 0 ) ; return O_tk . x < 0.5 ; } } { let O_kb = O_fd . O_ka / 2.0 ; let O_zk = O_fd . O_tb / 2.0 ; var O_km = O_kf ( - O_kb , O_kb , - O_zk , O_zk ) ; O_km = O_kg ( O_km , O_fd . O_td ) ; if ( ! O_ki ( O_km , O_jw ) ) { return false ; } } { let O_zq = O_fd . O_tf ; var O_zr : f32 ; if ( O_jw . x < 0 ) { O_zr = ( O_jw . x - ( O_jw . x % O_zq ) ) - O_zq ; } else { O_zr = ( O_jw . x - ( O_jw . x % O_zq ) ) ; } var O_zs : f32 ; if ( O_jw . y < 0 ) { O_zs = ( O_jw . y - ( O_jw . y % O_zq ) ) - O_zq ; } else { O_zs = ( O_jw . y - ( O_jw . y % O_zq ) ) ; } var O_kd = O_kf ( O_zr , O_zr + O_zq , O_zs , O_zs + O_zq ) ; O_kd = O_kg ( O_kd , O_fd . O_te / 2.0 ) ; if ( ! O_ki ( O_kd , O_jw ) ) { return true ; } } return false ; } struct O_zt { O_hd : f32 , O_jw : vec2f , } fn O_zi ( O_gt : O_fs , ) -> O_zt { let O_zu = O_qz ( O_gt , O_zv ( ) ) ; let O_hd = O_zu . O_hd ; let O_zw = O_zu . O_jw . xy ; if ( O_hd < 0 || O_zx ( O_zw ) ) { return O_zt ( - 1 , vec2f ( 0 ) ) ; } else { return O_zt ( O_hd , O_zw ) ; } } fn O_zx ( O_zw : vec2 < f32 > , ) -> bool { let O_zy = vec2 < f32 > ( - O_fd . O_ka / 2.0 , O_fd . O_tb / 2.0 ) ; if ( O_zw . x > O_zy . x + O_fd . O_tc && O_zw . x < O_zy . x + O_fd . O_ka - O_fd . O_tc ) { if ( O_zw . y > O_zy . y - O_fd . O_tb && O_zw . y < O_zy . y ) { return false ; } } if ( O_zw . x > O_zy . x && O_zw . x < O_zy . x + O_fd . O_ka ) { if ( O_zw . y > O_zy . y - O_fd . O_tb + O_fd . O_tc && O_zw . y < O_zy . y - O_fd . O_tc ) { return false ; } } if ( length ( O_zw - ( O_zy + vec2f ( O_fd . O_tc , - O_fd . O_tc ) ) ) < O_fd . O_tc ) { return false ; } if ( length ( O_zw - ( O_zy + vec2f ( O_fd . O_ka - O_fd . O_tc , - O_fd . O_tc ) ) ) < O_fd . O_tc ) { return false ; } if ( length ( O_zw - ( O_zy + vec2f ( O_fd . O_tc , O_fd . O_tc - O_fd . O_tb ) ) ) < O_fd . O_tc ) { return false ; } if ( length ( O_zw - ( O_zy + vec2f ( O_fd . O_ka - O_fd . O_tc , O_fd . O_tc - O_fd . O_tb ) ) ) < O_fd . O_tc ) { return false ; } return true ; } fn O_zv ( ) -> O_ow { return O_ow ( vec3 < f32 > ( 0.0 , 0.0 , O_ft [ 2 ] ) , vec3 < f32 > ( 0.0 , 0.0 , 1.0 , ) ) ; } fn O_zz ( ) -> f32 { return O_ft [ 1 ] ; } fn O_aaa ( O_gt : O_fs , ) -> O_li { var O_lf : O_fq = O_fq ( ) ; var O_hd : f32 = - 1.0 ; let O_bn = 0.001 ; let O_cj = O_aab ( O_gt , vec3f ( ) , vec3 < f32 > ( 1 , 0 , 0 ) , O_bn ) ; if ( O_cj . x != - 1.0 ) { if ( O_cj . y > 0 ) { O_lf = O_md ( 1 , 1 , 0 ) ; } else { O_lf = O_md ( 1 , 1 , 1 ) ; } O_hd = O_cj . x ; } let O_jd = O_aab ( O_gt , vec3f ( ) , vec3 < f32 > ( 0 , 1 , 0 ) , O_bn ) ; if ( O_jd . x != - 1.0 ) { if ( O_jd . y > 0 ) { O_lf = O_md ( 0 , 1 , 0 ) ; } else { O_lf = O_md ( 1 , 1 , 1 ) ; } O_hd = O_jd . x ; } let O_vs = O_aab ( O_gt , vec3f ( ) , vec3 < f32 > ( 0 , 0 , 1 ) , O_bn ) ; if ( O_vs . x != - 1.0 ) { if ( O_vs . y > 0 ) { O_lf = O_md ( 0 , 0 , 1 ) ; } else { O_lf = O_md ( 1 , 1 , 1 ) ; } O_hd = O_vs . x ; } return O_li ( O_hd , vec3f ( ) , O_lf , - 1 ) ; } fn O_aab ( O_gt : O_fs , O_aac : vec3 < f32 > , O_aad : vec3 < f32 > , O_qr : f32 , ) -> vec2f { let O_aae = O_gt . O_nz - O_aac ; let O_aaf = dot ( O_gt . O_oy , O_aad ) ; let O_aag = dot ( O_aae , O_aad ) ; let O_aah = O_gt . O_oy - O_aaf * O_aad ; let O_aai = O_aae - O_aag * O_aad ; let O_ht = dot ( O_aah , O_aah ) ; let O_hu = 2.0 * dot ( O_aai , O_aah ) ; let O_qq = dot ( O_aai , O_aai ) - O_qr * O_qr ; if abs ( O_ht ) < O_cu { let O_aaj = dot ( O_aai , O_aai ) ; if abs ( O_aaj - O_qr * O_qr ) < O_cu * O_qr { let O_aak = dot ( O_aae , O_aad ) ; var O_aal : f32 = 0.5 ; if O_aak > O_cu { O_aal = 1.0 ; } else if O_aak < - O_cu { O_aal = - 1.0 ; } return vec2 ( 0.0 , O_aal ) ; } return vec2 ( - 1.0 , 0.0 ) ; } let O_qs = O_hu * O_hu - 4.0 * O_ht * O_qq ; if O_qs < 0.0 { return vec2 ( - 1.0 , 0.0 ) ; } let O_aam = sqrt ( O_qs ) ; let O_qa = ( - O_hu - O_aam ) / ( 2.0 * O_ht ) ; let O_qc = ( - O_hu + O_aam ) / ( 2.0 * O_ht ) ; var O_aan = f32 ( - 1.0 ) ; if O_qa > O_cu { O_aan = O_qa ; } else if O_qc > O_cu { O_aan = O_qc ; } else { return vec2 ( - 1.0 , 0.0 ) ; } let O_aao = O_gt . O_nz + O_aan * O_gt . O_oy ; let O_aap = O_aao - O_aac ; let O_aaq = dot ( O_aap , O_aad ) ; var O_aal : f32 = 0.5 ; if O_aaq > O_cu { O_aal = 1.0 ; } else if O_aaq < - O_cu { O_aal = - 1.0 ; } return vec2 ( O_aan , O_aal ) ; } fn O_aar ( O_gt : O_fs , ) -> vec3 < f32 > { var O_tk : vec3f ; if ( O_ev . O_ot == 1.0 ) { O_tk = O_ev . O_os ; } else { let O_iy = O_aas ( O_gt . O_oy , O_ev . O_oq ) ; let O_zo = vec2 < f32 > ( 0.5 + atan2 ( - O_iy . y , O_iy . x ) / ( 2.0 * O_ao ) , 0.5 - asin ( O_iy . z ) / O_ao ) ; let O_zp = vec2 < i32 > ( O_zo * vec2 < f32 > ( textureDimensions ( O_ff ) ) ) ; var O_aat = textureLoad ( O_ff , O_zp , 0 ) ; O_tk = vec3 < f32 > ( O_aat . x , O_aat . y , O_aat . z ) ; } return O_tk * O_ev . O_or ; } fn O_aas ( O_aau : vec3 < f32 > , O_aav : f32 , ) -> vec3 < f32 > { let O_aaw = O_aav * 3.14159265359 / 180.0 ; let O_aax = cos ( O_aaw ) ; let O_aay = sin ( O_aaw ) ; let O_aaz = O_aau . x * O_aax - O_aau . y * O_aay ; let O_aba = O_aau . x * O_aay + O_aau . y * O_aax ; let O_abb = O_aau . z ; return vec3 < f32 > ( O_aaz , O_aba , O_abb ) ; } struct O_tn { O_bb : u32 , O_bw : vec3f , O_b : vec3f , O_d : f32 , O_c : f32 , O_e : f32 , O_hg : f32 , O_lp : f32 , O_lq : f32 , O_lr : f32 , O_lt : vec3f , O_by : vec3f , O_bz : vec3f , O_gy : vec3f , O_tk : vec3 < f32 > , O_ho : f32 , O_hc : f32 , } fn O_abc ( ) -> O_tn { let O_cm = vec3 < f32 > ( 0 ) ; return O_tn ( 0 , O_cm , O_cm , 0 , 0 , 0 , 0 , 0 , 0 , 0 , O_cm , O_cm , O_cm , O_cm , O_cm , 0 , 0 ) ; } fn O_up ( O_gt : O_fs , O_abd : bool , O_abe : bool , O_abf : bool , ) -> O_tn { var O_gv = O_abc ( ) ; O_gv . O_bw = O_gt . O_oy ; let O_abg = O_hb ( O_gt , O_abd , O_abe , O_abf ) ; if ( O_abg . O_hd < 0.0 ) { O_gv . O_bb = O_ei ; O_gv . O_tk = O_aar ( O_gt ) ; return O_gv ; } O_gv . O_gy = O_pa ( O_gt , O_abg . O_hd ) ; O_gv . O_by = normalize ( O_abg . O_bq ) ; let O_lf = O_abg . O_lf ; if ( O_abg . O_he == O_eg ) { O_gv . O_bb = O_em ; O_gv . O_tk = O_lf . O_b ; return O_gv ; } if ( O_abg . O_he == O_ef ) { O_gv . O_bb = O_ej ; O_gv . O_tk = O_abh ( ) ; return O_gv ; } O_gv . O_e = O_lf . O_e ; O_gv . O_hg = O_lf . O_hg ; O_gv . O_lp = O_lf . O_lp ; O_gv . O_lq = pow ( O_lf . O_lq , 2.0 ) ; O_gv . O_lr = O_lf . O_lr ; O_gv . O_lt = O_lf . O_lt ; if ( O_lf . O_lv < 0.0 ) { O_gv . O_bz = O_gv . O_by ; } else { O_gv . O_bz = O_abi ( O_gv . O_gy , O_gv . O_by , O_lf . O_lv , O_lf . O_lw , O_lf . O_lu ) ; } if ( O_lf . O_lx < 0.0 ) { O_gv . O_d = O_lf . O_d ; } else { O_gv . O_d = O_abj ( O_gv . O_gy , O_gv . O_by , O_lf . O_lx , O_lf . O_ly ) . x * O_lf . O_d ; } if ( O_lf . O_lz < 0.0 ) { O_gv . O_b = O_abk ( O_lf . O_b ) ; } else { O_gv . O_b = O_abk ( O_abj ( O_gv . O_gy , O_gv . O_by , O_lf . O_lz , O_lf . O_ma ) ) * O_lf . O_b ; } if ( O_lf . O_mb < 0.0 ) { O_gv . O_c = O_lf . O_c ; } else { O_gv . O_c = O_abj ( O_gv . O_gy , O_gv . O_by , O_lf . O_mb , O_lf . O_mc ) . x * O_lf . O_c ; } O_gv . O_ho = O_sn ( O_gv . O_bz , - O_gt . O_oy ) ; O_gv . O_bb = O_el ; return O_gv ; } fn O_abk ( O_tk : vec3f , ) -> vec3f { return select ( pow ( ( O_tk + 0.055 ) / 1.055 , vec3f ( 2.4 ) ) , O_tk / 12.92 , O_tk <= vec3f ( 0.04045 ) ) ; } fn O_abi ( O_gy : vec3 < f32 > , O_abl : vec3 < f32 > , O_abm : f32 , O_abn : f32 , O_wc : f32 , ) -> vec3 < f32 > { var O_abo = normalize ( O_abj ( O_gy , O_abl , O_abm , O_abn ) ) ; O_abo . x = O_abo . x * O_wc ; O_abo . y = O_abo . y * O_wc ; O_abo = normalize ( O_abo ) ; let O_abp = select ( vec3f ( 0.0 , 1.0 , 0.0 ) , vec3f ( 0.0 , 0.0 , 1.0 ) , abs ( O_abl . z ) < 0.999 ) ; let O_br = normalize ( cross ( O_abp , O_abl ) ) ; let O_bs = normalize ( cross ( O_abl , O_br ) ) ; return mat3x3 < f32 > ( O_br , O_bs , O_abl ) * O_abo ; } fn O_abj ( O_gy : vec3 < f32 > , O_bq : vec3 < f32 > , O_abm : f32 , O_abn : f32 , ) -> vec3f { let O_abq = floor ( O_abm / 32.0 ) ; let O_abr = i32 ( O_abm - O_abq * 32 ) ; let O_abs = vec2 < i32 > ( ( O_abr % 8 ) * 2048 , O_abr / 8 * 2048 ) ; let O_abt = O_abu ( O_gy . xy , O_abn ) + O_abs ; let O_abv = O_abu ( O_gy . xz , O_abn ) + O_abs ; let O_abw = O_abu ( O_gy . yz , O_abn ) + O_abs ; var O_abx : vec3 < f32 > ; var O_aby : vec3 < f32 > ; var O_abz : vec3 < f32 > ; if ( O_abq == 0 ) { O_abx = textureLoad ( O_fi , O_abt , 0 ) . rgb ; O_aby = textureLoad ( O_fi , O_abv , 0 ) . rgb ; O_abz = textureLoad ( O_fi , O_abw , 0 ) . rgb ; } else if ( O_abq == 1 ) { O_abx = textureLoad ( O_fj , O_abt , 0 ) . rgb ; O_aby = textureLoad ( O_fj , O_abv , 0 ) . rgb ; O_abz = textureLoad ( O_fj , O_abw , 0 ) . rgb ; } else if ( O_abq == 2 ) { O_abx = textureLoad ( O_fk , O_abt , 0 ) . rgb ; O_aby = textureLoad ( O_fk , O_abv , 0 ) . rgb ; O_abz = textureLoad ( O_fk , O_abw , 0 ) . rgb ; } else if ( O_abq == 3 ) { O_abx = textureLoad ( O_fl , O_abt , 0 ) . rgb ; O_aby = textureLoad ( O_fl , O_abv , 0 ) . rgb ; O_abz = textureLoad ( O_fl , O_abw , 0 ) . rgb ; } else if ( O_abq == 4 ) { O_abx = textureLoad ( O_fm , O_abt , 0 ) . rgb ; O_aby = textureLoad ( O_fm , O_abv , 0 ) . rgb ; O_abz = textureLoad ( O_fm , O_abw , 0 ) . rgb ; } else if ( O_abq == 5 ) { O_abx = textureLoad ( O_fn , O_abt , 0 ) . rgb ; O_aby = textureLoad ( O_fn , O_abv , 0 ) . rgb ; O_abz = textureLoad ( O_fn , O_abw , 0 ) . rgb ; } else if ( O_abq == 6 ) { O_abx = textureLoad ( O_fo , O_abt , 0 ) . rgb ; O_aby = textureLoad ( O_fo , O_abv , 0 ) . rgb ; O_abz = textureLoad ( O_fo , O_abw , 0 ) . rgb ; } var O_aca = abs ( O_bq ) ; O_aca = O_aca / ( O_aca . x + O_aca . y + O_aca . z ) ; return O_abx * O_aca . z + O_aby * O_aca . y + O_abz * O_aca . x ; } fn O_abu ( O_gy : vec2f , O_abn : f32 , ) -> vec2 < i32 > { return ( vec2 < i32 > ( round ( O_gy * O_abn ) ) % 2048 + 2048 ) % 2048 ; } struct O_acb { O_he : i32 , O_hd : f32 , O_bq : vec3 < f32 > , O_lf : O_fq , O_hc : i32 , } fn O_hb ( O_gt : O_fs , O_abd : bool , O_abe : bool , O_abf : bool , ) -> O_acb { var O_acc : O_li = O_lj ( ) ; var O_he : i32 = - 1 ; if ( O_ev . O_on == 0.0 ) { let O_acd = O_ace ( O_gt ) ; if O_acd . O_hd > 0.0 && ( O_acc . O_hd < 0.0 || O_acd . O_hd < O_acc . O_hd ) { O_acc = O_acd ; O_he = O_ed ; } } if ( O_ev . O_om == 0.0 ) { let O_acf = O_acg ( O_gt ) ; if O_acf . O_hd > 0.0 && ( O_acc . O_hd < 0.0 || O_acf . O_hd < O_acc . O_hd ) { O_acc = O_acf ; O_he = O_ee ; } } if ( O_ev . O_ok == 0.0 ) { let O_ach = O_zh ( O_gt ) ; if O_ach . O_hd > 0.0 && ( O_acc . O_hd < 0.0 || O_ach . O_hd < O_acc . O_hd ) { O_acc = O_ach ; O_he = O_eb ; } } if ( O_abf && O_ev . O_ol == 0.0 ) { let O_aci = O_acj ( O_gt ) ; if O_aci . O_hd > 0.0 && ( O_acc . O_hd < 0.0 || O_aci . O_hd < O_acc . O_hd ) { O_acc = O_aci ; O_he = O_ec ; } } if ( O_abd && O_ev . O_oo == 0.0 ) { let O_ack = O_acl ( O_gt ) ; if O_ack . O_hd > 0.0 && ( O_acc . O_hd < 0.0 || O_ack . O_hd < O_acc . O_hd ) { O_acc = O_ack ; O_he = O_ef ; } } if ( O_abe && O_ev . O_op == 0.0 ) { let O_acm = O_aaa ( O_gt ) ; if ( O_acm . O_hd > 0.0 && ( O_acc . O_hd < 0.0 || O_acm . O_hd < O_acc . O_hd ) ) { O_acc = O_acm ; O_he = O_eg ; } } return O_acb ( O_he , O_acc . O_hd , O_acc . O_bq , O_acc . O_lf , O_acc . O_hc ) ; } fn O_ye ( O_acn : vec3 < f32 > , O_k : vec3 < f32 > , O_ps : f32 , ) -> bool { let O_gt = O_fs ( O_acn , O_k ) ; let O_ha = O_hb ( O_gt , true , false , true ) ; return O_ha . O_he == O_ef || O_ha . O_hd < 0.00 ; } fn O_acl ( O_gt : O_fs , ) -> O_li { var O_ha = O_pb ( - 1.0 , vec3f ( 0 ) ) ; for ( var O_oe : i32 = 0 ; O_oe < O_eh ; O_oe ++ ) { if ( O_fg [ O_oe ] . O_wb == 1.0 ) { continue ; } let O_bn = O_aco ( O_gt , O_fg [ O_oe ] ) ; if ( O_bn . O_hd > 0 && ( O_ha . O_hd < 0 || O_bn . O_hd < O_ha . O_hd ) ) { O_ha = O_bn ; } } return O_li ( O_ha . O_hd , O_ha . O_bq , O_ll ( ) , - 1 ) ; } fn O_aco ( O_gt : O_fs , O_wg : O_fh , ) -> O_pb { let O_pz = O_wg . O_gy + O_wg . O_cn + O_wg . O_cm ; let O_mx = O_wg . O_gy + O_wg . O_cn ; let O_my = O_wg . O_gy + O_wg . O_cm ; let O_mz = O_wg . O_gy ; var O_hd = - 1.0 ; let O_qa = O_qd ( O_gt , O_qb ( O_pz , O_mx , O_my ) ) ; if ( O_qa > 0.0 && ( O_hd < 0.0 || O_qa < O_hd ) ) { O_hd = O_qa ; } let O_qc = O_qd ( O_gt , O_qb ( O_mx , O_my , O_mz ) ) ; if ( O_qc > 0.0 && ( O_hd < 0.0 || O_qc < O_hd ) ) { O_hd = O_qc ; } return O_pb ( O_hd , normalize ( cross ( O_wg . O_cn , O_wg . O_cm ) ) ) ; } fn O_ace ( O_gt : O_fs , ) -> O_li { var O_acp : i32 = 0 ; var O_acq = array < u32 , O_ea > ( ) ; O_acq [ 0 ] = 0 ; var O_hd = - 1.0 ; var O_bq : vec3 < f32 > ; var O_acr : u32 ; while ( O_acp >= 0 ) { let O_abm = O_acq [ O_acp ] ; O_acp -= 1 ; let O_kd = O_jo ( O_ft [ O_abm ] , O_ft [ O_abm + 1 ] , O_ft [ O_abm + 2 ] , O_ft [ O_abm + 3 ] , O_ft [ O_abm + 4 ] , O_ft [ O_abm + 5 ] ) ; let O_acs = O_pq ( O_gt , O_kd ) ; if ( O_acs < 0.0 || ( O_hd > 0.0 && O_acs > O_hd ) ) { continue ; } for ( var O_oe : u32 = 0 ; O_oe < 4 ; O_oe += 1 ) { var O_act = O_ft [ O_abm + 6 + O_oe ] ; if ( O_act > 0.0 ) { O_acp += 1 ; if ( O_acp >= O_ea ) { O_tq ( ) ; return O_lj ( ) ; } O_acq [ O_acp ] = u32 ( O_act ) - 1 ; } else if ( O_act < 0.0 ) { let O_acu = u32 ( - O_act ) - 1 ; let O_qe = O_acv ( O_acu ) ; let O_acw = O_qd ( O_gt , O_qe ) ; if ( O_acw < 0.0 || ( O_hd > 0.0 && O_acw > O_hd ) ) { continue ; } O_hd = O_acw ; O_acr = O_acu ; O_bq = O_se ( O_qe , O_acx ( O_acu ) , O_pa ( O_gt , O_acw ) ) ; } } } if ( O_hd < 0 ) { return O_lj ( ) ; } let O_hc = i32 ( O_fu [ O_acr ] . O_le ) ; let O_lf = O_fp [ O_hc ] ; return O_li ( O_hd , O_bq , O_lf , O_hc ) ; } fn O_acv ( O_abm : u32 , ) -> O_qb { let O_acy = u32 ( O_fu [ O_abm ] . O_ky ) ; let O_acz = u32 ( O_fu [ O_abm ] . O_kz ) ; let O_ada = u32 ( O_fu [ O_abm ] . O_la ) ; let O_ky = O_fw [ O_acy ] ; let O_kz = O_fw [ O_acz ] ; let O_la = O_fw [ O_ada ] ; return O_qb ( O_ky , O_kz , O_la ) ; } fn O_acx ( O_abm : u32 , ) -> array < vec3 < f32 > , 3 > { let O_adb = u32 ( O_fu [ O_abm ] . O_lb ) ; let O_adc = u32 ( O_fu [ O_abm ] . O_lc ) ; let O_add = u32 ( O_fu [ O_abm ] . O_ld ) ; let O_lb = O_fw [ O_adb ] ; let O_lc = O_fw [ O_adc ] ; let O_ld = O_fw [ O_add ] ; return array < vec3 < f32 > , 3 > ( O_lb , O_lc , O_ld ) ; } struct O_ge { O_gy : vec3f , O_ka : f32 , O_tb : f32 , O_ade : f32 , O_wb : f32 , O_uq : f32 , } fn O_acj ( O_gt : O_fs , ) -> O_li { let O_kb = O_gd . O_ka / 2.0 ; let O_zk = O_gd . O_tb / 2.0 ; let O_mg = O_gd . O_gy ; let O_kd = O_jo ( O_mg . x - O_kb , O_mg . y - O_zk , O_mg . z , O_mg . x + O_kb , O_mg . y + O_zk , O_mg . z + 0.5 ) ; let O_ha = O_pc ( O_gt , O_kd ) ; if ( O_ha . O_hd < 0 ) { return O_lj ( ) ; } let O_hc = i32 ( O_gd . O_ade ) ; let O_lf = O_fp [ O_hc ] ; return O_li ( O_ha . O_hd , O_ha . O_bq , O_lf , O_hc ) ; } fn O_acg ( O_gt : O_fs , ) -> O_li { var O_abg : O_li = O_adf ( O_gt ) ; if ( O_abg . O_hd < 0.0 ) { O_abg = O_adg ( O_gt ) ; } return O_abg ; } fn O_adf ( O_gt : O_fs , ) -> O_li { let O_adh = O_adi ( O_gt , O_gb . O_ov ) ; if ( O_adh . O_hd < 0.0 ) { return O_lj ( ) ; } let O_jw = O_adh . O_jw ; let O_hc = O_adj ( O_jw ) ; let O_lf = O_fp [ O_hc ] ; return O_li ( O_adh . O_hd , O_gb . O_ov . O_bq , O_lf , O_hc ) ; } fn O_adj ( O_jw : vec2 < f32 > , ) -> i32 { if ( O_adk ( O_jw , i32 ( O_ez . O_sq ) ) ) { return i32 ( O_fb . O_sx ) ; } let O_sz = ! O_adk ( O_jw , i32 ( O_ez . O_sr ) ) ; let O_sy = O_adk ( O_jw , i32 ( O_ez . O_ss ) ) ; if ( O_sz ) { if ( O_sy ) { return i32 ( O_fb . O_ta ) ; } else { return i32 ( O_fb . O_sz ) ; } } else { if ( O_sy ) { return i32 ( O_fb . O_sy ) ; } else { return i32 ( O_fb . O_sw ) ; } } } fn O_adg ( O_gt : O_fs , ) -> O_li { let O_adh = O_adi ( O_gt , O_gb . O_ox ) ; if ( O_adh . O_hd < 0.0 ) { return O_lj ( ) ; } let O_jw = O_adh . O_jw ; let O_hc = O_adl ( O_jw ) ; let O_lf = O_fp [ O_hc ] ; return O_li ( O_adh . O_hd , O_gb . O_ox . O_bq , O_lf , O_hc ) ; } fn O_adl ( O_jw : vec2 < f32 > , ) -> i32 { let O_sx = O_adk ( O_jw , i32 ( O_ez . O_st ) ) ; if ( O_sx ) { return i32 ( O_fb . O_sx ) ; } let O_sz = ! O_adk ( O_jw , i32 ( O_ez . O_su ) ) ; let O_sy = O_adk ( O_jw , i32 ( O_ez . O_sv ) ) ; if ( O_sz ) { if ( O_sy ) { return i32 ( O_fb . O_ta ) ; } else { return i32 ( O_fb . O_sz ) ; } } else { if ( O_sy ) { return i32 ( O_fb . O_sy ) ; } else { return i32 ( O_fb . O_sw ) ; } } } fn O_adm ( O_jw : vec3 < f32 > , ) -> vec2 < f32 > { return vec2 < f32 > ( O_jw . x , O_jw . y ) ; } fn O_adn ( ) -> O_kf { let O_ado = O_fx [ u32 ( O_ez . O_sp ) ] ; let O_kd = O_kf ( O_ado . O_jp , O_ado . O_js , O_ado . O_jq , O_ado . O_jt ) ; return O_kg ( O_kd , 1 ) ; } struct O_adp { O_hd : f32 , O_jw : vec2 < f32 > , } fn O_adi ( O_gt : O_fs , O_qv : O_ow , ) -> O_adp { let O_adh = O_qz ( O_gt , O_qv ) ; if ( O_adh . O_hd < 0.0 ) { return O_adp ( - 1.0 , vec2 < f32 > ( 0.0 ) ) ; } let O_adq = O_adm ( O_adh . O_jw ) ; let O_kd = O_adn ( ) ; if ( ! O_ki ( O_kd , O_adq ) ) { return O_adp ( - 1.0 , vec2 < f32 > ( 0.0 ) ) ; } return O_adp ( O_adh . O_hd , O_adq ) ; } fn O_adk ( O_jw : vec2f , O_adr : i32 , ) -> bool { if ( O_adr < 0 ) { return false ; } var O_acq = array < i32 , 22 > ( ) ; O_acq [ 0 ] = i32 ( O_adr ) ; var O_acp : i32 = 1 ; var O_ads : i32 = 0 ; while ( O_acp > 0 ) { let O_abm = O_acq [ O_acp - 1 ] ; O_acp -= 1 ; let O_adt = O_fx [ O_abm ] ; let O_kd = O_kf ( O_adt . O_jp , O_adt . O_js , O_adt . O_jq , O_adt . O_jt ) ; if ( ! O_ki ( O_kd , O_jw ) ) { continue ; } var O_adu = array < i32 , 2 > ( ) ; O_adu [ 0 ] = i32 ( O_adt . O_lm ) ; O_adu [ 1 ] = i32 ( O_adt . O_ln ) ; for ( var O_oe = 0 ; O_oe < 2 ; O_oe += 1 ) { let O_adv = O_adu [ O_oe ] ; if ( O_adv > 0 ) { O_acq [ O_acp ] = O_adv - 1 ; O_acp += 1 ; } else if ( O_adv < 0 ) { let O_adw = - 1 * O_adv - 1 ; let O_ha = O_adx ( O_jw , O_adw ) ; if ( O_ha == O_da ) { return true ; } if ( O_ha == O_dd ) { O_ads -= 1 ; } if ( O_ha == O_dc ) { O_ads += 1 ; } } } } return O_ads != 0 ; } fn O_adx ( O_jw : vec2f , O_adw : i32 , ) -> u32 { let O_ady = i32 ( O_adw ) ; switch u32 ( O_fz [ O_ady ] ) { case O_dt : { let O_adz = O_jw ; var O_aea = vec2 ( O_fz [ O_ady + 1 ] , O_fz [ O_ady + 2 ] ) ; var O_aeb = vec2 ( O_fz [ O_ady + 3 ] , O_fz [ O_ady + 4 ] ) ; var O_iy = normalize ( O_aeb - O_aea ) ; let O_aec = O_fz [ O_ady + 5 ] ; O_aea = O_aea + O_iy * O_aec * 0.5 ; O_aeb = O_aeb - O_iy * O_aec * 0.5 ; if ( ( length ( O_jw - O_aeb ) < ( O_aec / 2.0 ) ) || ( length ( O_jw - O_aea ) < ( O_aec / 2.0 ) ) ) { return O_da ; } let O_oy = O_aeb - O_aea ; let O_aed = dot ( O_oy , O_oy ) ; let O_aee = O_adz - O_aea ; let O_hd = dot ( O_aee , O_oy ) / O_aed ; if ( O_hd < 0.0 || O_hd > 1.0 ) { return O_db ; } let O_aef = O_aea + O_hd * O_oy ; let distance = length ( O_adz - O_aef ) ; if ( distance <= O_aec / 2.0 ) { return O_da ; } else { return O_db ; } } case O_de : { let O_qp = vec2f ( O_fz [ O_ady + 1 ] , O_fz [ O_ady + 2 ] ) ; let O_bn = O_fz [ O_ady + 3 ] ; if ( length ( O_jw - O_qp ) < O_bn ) { return O_da ; } else { return O_db ; } } case O_dg : { let O_aeg : vec2 < f32 > = vec2f ( O_fz [ O_ady + 1 ] , O_fz [ O_ady + 2 ] ) ; let O_ka : f32 = O_fz [ O_ady + 3 ] ; let O_tb : f32 = O_fz [ O_ady + 4 ] ; let O_co : f32 = O_fz [ O_ady + 5 ] ; let O_qr : f32 = O_fz [ O_ady + 6 ] ; if ( O_jw . x > O_aeg . x + O_qr && O_jw . x < O_aeg . x + O_ka - O_qr ) { if ( O_jw . y > O_aeg . y - O_tb && O_jw . y < O_aeg . y ) { return O_da ; } } if ( O_jw . x > O_aeg . x && O_jw . x < O_aeg . x + O_ka ) { if ( O_jw . y > O_aeg . y - O_tb + O_qr && O_jw . y < O_aeg . y - O_qr ) { return O_da ; } } if ( length ( O_jw - ( O_aeg + vec2f ( O_qr , - O_qr ) ) ) < O_qr ) { return O_da ; } if ( length ( O_jw - ( O_aeg + vec2f ( O_ka - O_qr , - O_qr ) ) ) < O_qr ) { return O_da ; } if ( length ( O_jw - ( O_aeg + vec2f ( O_qr , O_qr - O_tb ) ) ) < O_qr ) { return O_da ; } if ( length ( O_jw - ( O_aeg + vec2f ( O_ka - O_qr , O_qr - O_tb ) ) ) < O_qr ) { return O_da ; } return O_db ; } case O_dk : { let O_ky : vec2 < f32 > = vec2f ( O_fz [ O_ady + 1 ] , O_fz [ O_ady + 2 ] ) ; let O_kz : vec2 < f32 > = vec2f ( O_fz [ O_ady + 3 ] , O_fz [ O_ady + 4 ] ) ; let O_la : vec2 < f32 > = vec2f ( O_fz [ O_ady + 5 ] , O_fz [ O_ady + 6 ] ) ; let O_aeh = O_fz [ O_ady + 6 ] ; let O_aei = O_kz - O_ky ; let O_aej = O_la - O_ky ; let O_aek = O_jw - O_ky ; let O_rn = dot ( O_aej , O_aej ) ; let O_ro = dot ( O_aej , O_aei ) ; let O_rp = dot ( O_aej , O_aek ) ; let O_rq = dot ( O_aei , O_aei ) ; let O_rr = dot ( O_aei , O_aek ) ; let O_rs = 1.0 / ( O_rn * O_rq - O_ro * O_ro ) ; let O_cn = ( O_rq * O_rp - O_ro * O_rr ) * O_rs ; let O_cm = ( O_rn * O_rr - O_ro * O_rp ) * O_rs ; if ( ( O_cn >= 0.0 ) && ( O_cm >= 0.0 ) && ( O_cn + O_cm <= 1.0 ) ) { if ( 0.5 * ( O_ky . x * ( O_kz . y - O_la . y ) + O_kz . x * ( O_la . y - O_ky . y ) + O_la . x * ( O_ky . y - O_kz . y ) ) < 0.0 ) { return O_dc ; } else { return O_dd ; } } else { return O_db ; } } case O_dl : { let O_qp = vec2f ( O_fz [ O_ady + 1 ] , O_fz [ O_ady + 2 ] ) ; let O_bn = O_fz [ O_ady + 3 ] ; var O_ael = O_fz [ O_ady + 4 ] ; let O_aem = O_fz [ O_ady + 5 ] ; let O_aen = vec2f ( O_fz [ O_ady + 6 ] , O_fz [ O_ady + 7 ] ) ; let O_aeo = vec2f ( O_fz [ O_ady + 8 ] , O_fz [ O_ady + 9 ] ) ; let O_aep = O_jw . x - O_qp . x ; let O_aeq = O_jw . y - O_qp . y ; let O_aer = O_aep * O_aep + O_aeq * O_aeq ; if ( O_aer > O_bn * O_bn ) { return O_db ; } let O_ky = O_qp ; let O_kz = O_aen ; let O_la = O_aeo ; let O_aei = O_kz - O_ky ; let O_aej = O_la - O_ky ; let O_aek = O_jw - O_ky ; let O_rn = dot ( O_aej , O_aej ) ; let O_ro = dot ( O_aej , O_aei ) ; let O_rp = dot ( O_aej , O_aek ) ; let O_rq = dot ( O_aei , O_aei ) ; let O_rr = dot ( O_aei , O_aek ) ; let O_rs = 1.0 / ( O_rn * O_rq - O_ro * O_ro ) ; let O_cn = ( O_rq * O_rp - O_ro * O_rr ) * O_rs ; let O_cm = ( O_rn * O_rr - O_ro * O_rp ) * O_rs ; if ( ( O_cn >= 0.0 ) && ( O_cm >= 0.0 ) && ( O_cn + O_cm <= 1.0 ) ) { if ( abs ( O_aem ) >= O_ao ) { if ( O_aem > 0.0 ) { return O_dd ; } else { return O_dc ; } } else { return O_db ; } } if ( abs ( O_aem ) >= O_cr ) { if ( O_aem > 0 ) { return O_dd ; } else { return O_dc ; } } O_ael = O_ael % O_cr ; if ( O_ael < 0.0 ) { O_ael = O_ael + O_cr ; } var O_aes = atan2 ( O_aeq , O_aep ) ; if ( O_aes < 0.0 ) { O_aes = O_aes + O_cr ; } var O_aet = O_ael + O_aem ; if ( O_aem >= 0.0 ) { if ( O_aet >= O_cr ) { O_aet = O_aet - O_cr ; } if ( O_aet > O_ael ) { if ( O_aes > O_ael && O_aes < O_aet ) { return O_dd ; } else { return O_db ; } } else { if ( O_aes > O_ael || O_aes < O_aet ) { return O_dd ; } else { return O_db ; } } } else { if ( O_aet < 0.0 ) { O_aet = O_aet + O_cr ; } if ( O_aet < O_ael ) { if ( O_aes > O_ael && O_aes < O_aet ) { return O_dc ; } else { return O_db ; } } else { if ( O_aes < O_ael || O_aes > O_aet ) { return O_dc ; } else { return O_db ; } } } } case O_df : { let O_qp = vec2f ( O_fz [ O_ady + 1 ] , O_fz [ O_ady + 2 ] ) ; let O_qr = O_fz [ O_ady + 3 ] ; let O_ka = O_fz [ O_ady + 4 ] ; var O_ael = O_fz [ O_ady + 5 ] ; let O_aem = O_fz [ O_ady + 6 ] ; let O_aeu = O_ka / 2.0 ; let O_aev = length ( O_jw - O_qp ) ; if ( O_aev < ( O_qr - O_aeu ) || O_aev > ( O_qr + O_aeu ) ) { return O_db ; } var O_aet = O_ael + O_aem ; let O_aen = vec2f ( O_qp . x + cos ( O_ael ) * O_qr , O_qp . y + sin ( O_ael ) * O_qr ) ; let O_aeo = vec2f ( O_qp . x + cos ( O_aet ) * O_qr , O_qp . y + sin ( O_aet ) * O_qr ) ; if ( length ( O_jw - O_aen ) < O_aeu || length ( O_jw - O_aeo ) < O_aeu ) { return O_da ; } O_ael = O_ael % O_cr ; if ( O_ael < 0.0 ) { O_ael = O_ael + O_cr ; } var O_aes = atan2 ( O_jw . y - O_qp . y , O_jw . x - O_qp . x ) ; if ( O_aes < 0.0 ) { O_aes = O_aes + O_cr ; } if ( O_aem >= 0.0 ) { if ( O_aet >= O_cr ) { O_aet = O_aet - O_cr ; } if ( O_aet > O_ael ) { if ( O_aes > O_ael && O_aes < O_aet ) { return O_da ; } else { return O_db ; } } else { if ( O_aes > O_ael || O_aes < O_aet ) { return O_da ; } else { return O_db ; } } } else { if ( O_aet < 0.0 ) { O_aet = O_aet + O_cr ; } if ( O_aet < O_ael ) { if ( O_aes > O_ael && O_aes < O_aet ) { return O_da ; } else { return O_db ; } } else { if ( O_aes < O_ael || O_aes > O_aet ) { return O_da ; } else { return O_db ; } } } } default : { O_hf ( vec3 < f32 > ( 1 , 0 , 0 ) ) ; break ; } } return O_db ; } struct O_fh { O_wb : f32 , O_tk : vec3 < f32 > , O_wc : f32 , O_gy : vec3 < f32 > , O_cn : vec3 < f32 > , O_cm : vec3 < f32 > , O_wp : f32 , O_s : f32 , O_aew : f32 , O_wf : f32 , O_aex : f32 , } fn O_abh ( ) -> vec3 < f32 > { let O_wa = O_aey ( ) ; return O_wa . O_tk * O_wa . O_wc ; } fn O_aey ( ) -> O_fh { var O_abm = i32 ( O_bl ( ) * 3.0 ) ; if ( O_abm >= 3 ) { O_abm = 0 ; } return O_fg [ O_abm ] ; } struct O_wi { O_xr : vec3 < f32 > , O_xt : vec3 < f32 > , O_xv : f32 , O_xx : f32 , O_iy : vec3 < f32 > , O_xz : f32 , O_wj : f32 , O_wk : f32 , } struct O_wh { O_ww : vec3 < f32 > , O_wa : O_wi , } struct O_aez { O_acn : vec3 < f32 > , O_afa : vec3 < f32 > , O_ax : vec3 < f32 > , O_hd : f32 , O_uu : f32 , O_yl : f32 , O_cn : f32 , O_cm : f32 , } struct O_afb { O_wz : bool , O_afc : vec3 < f32 > , O_wy : O_aez , } fn O_afd ( O_wg : O_wi , ) -> bool { return O_wg . O_xz < 0.0 ; } fn O_afe ( O_afa : vec3 < f32 > , O_aff : vec3 < f32 > , O_hd : f32 , ) -> f32 { let O_afg = dot ( O_afa , O_aff ) ; if ( O_afg <= 0.0 ) { return 0.0 ; } return O_hd * O_hd / O_afg ; } fn O_afh ( O_ax : vec3 < f32 > , O_afi : vec3 < f32 > , O_wj : f32 , O_wk : f32 , ) -> f32 { let O_afj = O_ia ( - O_ax , O_afi ) ; if ( O_wj == 0.0 ) { return select ( 0.0 , O_ao , O_afj > 1e-5 ) ; } return max ( ( O_wj - O_afj ) * O_wk , 0.0 ) ; } struct O_afk { O_wz : bool , O_afl : vec3 < f32 > , O_xr : vec3 < f32 > , O_xv : f32 , O_xt : vec3 < f32 > , O_xx : f32 , O_afm : bool , } fn O_afn ( O_acn : vec3 < f32 > , O_afi : vec3 < f32 > , O_afl : vec3 < f32 > , O_xr : vec3 < f32 > , O_xv : f32 , O_xt : vec3 < f32 > , O_xx : f32 , O_wj : f32 , O_afm : bool , ) -> O_afk { let O_hd = dot ( O_afi , O_acn - O_afl ) ; let O_afo = O_acn - O_hd * O_afi ; let O_afp = O_hd * O_wj ; let O_afq = dot ( O_xr , O_afo - O_afl ) ; let O_afr = dot ( O_xt , O_afo - O_afl ) ; var O_bb : O_afk ; O_bb . O_afl = O_afl ; O_bb . O_xr = O_xr ; O_bb . O_xv = O_xv ; O_bb . O_xt = O_xt ; O_bb . O_xx = O_xx ; O_bb . O_afm = O_afm ; let O_afs = ! O_afm && ( O_xv == O_xx ) ; var O_aft = ( O_afp == 0.0 ) ; if ( O_afs && ! O_aft ) { let O_mn = length ( vec2 < f32 > ( O_afq , O_afr ) ) ; let O_bn = O_xv * 0.5 ; if ( O_mn >= O_bn + O_afp ) { O_bb . O_wz = false ; return O_bb ; } O_aft = ( O_mn <= abs ( O_bn - O_afp ) ) && ( O_afp < O_bn ) ; if ( O_mn > abs ( O_bn - O_afp ) ) { let O_afu = O_bn + O_afp - O_mn ; let O_afv = select ( 2.0 * min ( O_bn , O_afp ) , sqrt ( O_ip ( 2.0 * O_afp ) - O_ip ( O_mn + ( O_ip ( O_afp ) - O_ip ( O_bn ) ) / O_mn ) ) , abs ( O_ip ( O_bn ) - O_ip ( O_afp ) ) >= O_ip ( O_mn ) ) ; let O_afw = O_afu * O_afv ; let O_afx = O_ao * O_ip ( O_bn ) ; let O_afy = O_ao * O_ip ( O_afp ) ; if ( O_afw < min ( O_afx , O_afy ) ) { O_bb . O_afm = true ; O_bb . O_xr = O_iv ( O_bb . O_afl - O_afo ) ; O_bb . O_xt = O_ie ( O_bb . O_xr , O_afi , O_cs ) ; O_bb . O_xv = O_afu ; O_bb . O_xx = O_afv ; O_bb . O_afl = 0.5 * ( O_bb . O_afl + O_afo + O_bb . O_xr * ( O_afp - O_bn ) ) ; O_bb . O_wz = true ; return O_bb ; } O_aft = ( O_afy < O_afx ) ; } } else if ( ! O_afs && ! O_aft ) { let O_afz = max ( O_afq - O_afp , - O_bb . O_xv * 0.5 ) ; let O_aga = min ( O_afq + O_afp , O_bb . O_xv * 0.5 ) ; let O_agb = max ( O_afr - O_afp , - O_bb . O_xx * 0.5 ) ; let O_agc = min ( O_afr + O_afp , O_bb . O_xx * 0.5 ) ; if ( O_afz >= O_aga || O_agb >= O_agc ) { O_bb . O_wz = false ; return O_bb ; } let O_agd = O_aga - O_afz ; let O_age = O_agc - O_agb ; let O_afw = O_agd * O_age ; let O_agf = select ( O_cv , O_ao * 0.25 * O_bb . O_xv * O_bb . O_xx , ! O_bb . O_afm ) ; let O_afy = O_ao * O_ip ( O_afp ) ; if ( O_bb . O_afm || O_afw < min ( O_agf , O_afy ) ) { O_bb . O_afm = true ; let O_agg = 0.5 * ( O_afz + O_aga ) ; let O_agh = 0.5 * ( O_agb + O_agc ) ; O_bb . O_xv = O_agd ; O_bb . O_xx = O_age ; O_bb . O_afl = O_bb . O_afl + O_bb . O_xr * O_agg + O_bb . O_xt * O_agh ; O_bb . O_wz = true ; return O_bb ; } O_bb . O_afm = false ; O_aft = ( O_afy < O_agf ) ; } if ( O_aft ) { O_bb . O_afm = false ; O_bb . O_afl = O_bb . O_afl + O_bb . O_xr * O_afq + O_bb . O_xt * O_afr ; O_bb . O_xv = O_afp * 2.0 ; O_bb . O_xx = O_afp * 2.0 ; O_bb . O_wz = true ; return O_bb ; } O_bb . O_wz = true ; return O_bb ; } struct O_agi { O_uu : f32 , O_agj : vec3 < f32 > , } fn O_agk ( O_acn : vec3 < f32 > , O_agj : vec3 < f32 > , O_xr : vec3 < f32 > , O_xv : f32 , O_xt : vec3 < f32 > , O_xx : f32 , O_hs : vec2 < f32 > , O_agl : bool , ) -> O_agi { let O_cj = O_xr ; let O_jd = O_xt ; var O_vs = cross ( O_cj , O_jd ) ; var O_agm = O_agj ; let O_iy = O_agm - O_acn ; var O_agn = dot ( O_iy , O_vs ) ; if ( O_agn > 0.0 ) { O_vs = - O_vs ; O_agn = - O_agn ; } let O_ago = dot ( O_iy , O_cj ) ; let O_agp = dot ( O_iy , O_jd ) ; let O_agq = O_ago - 0.5 * O_xv ; let O_agr = O_ago + 0.5 * O_xv ; let O_ags = O_agp - 0.5 * O_xx ; let O_agt = O_agp + 0.5 * O_xx ; var O_agu = vec4 < f32 > ( - O_ags , O_agr , O_agt , - O_agq ) ; O_agu = O_agu / sqrt ( O_agu * O_agu + vec4 < f32 > ( O_agn * O_agn ) ) ; let O_agv = O_iz ( - O_agu . x * O_agu . y ) ; let O_agw = O_iz ( - O_agu . y * O_agu . z ) ; let O_agx = O_iz ( - O_agu . z * O_agu . w ) ; let O_agy = O_iz ( - O_agu . w * O_agu . x ) ; let O_agz = - ( O_agv + O_agw + O_agx + O_agy ) ; if ( O_agl ) { let O_aha = O_agu . x ; let O_ahb = O_agu . z ; let O_ahc = O_aha * O_aha ; let O_ahd = O_hs . x * O_agz + O_agx + O_agy ; let O_ahe = O_ja ( cos ( O_ahd ) * O_aha + O_ahb , sin ( O_ahd ) ) ; var O_ahf = O_jc ( 1.0 / sqrt ( O_ahe * O_ahe + O_ahc ) , O_ahe ) ; O_ahf = clamp ( O_ahf , - 1.0 , 1.0 ) ; var O_ahg = - ( O_ahf * O_agn ) / max ( sqrt ( 1.0 - O_ahf * O_ahf ) , 1e-7 ) ; O_ahg = clamp ( O_ahg , O_agq , O_agr ) ; let O_ahh = O_ip ( O_ahg ) + O_ip ( O_agn ) ; let O_ahi = O_ags / sqrt ( O_ahh + O_ip ( O_ags ) ) ; let O_ahj = O_agt / sqrt ( O_ahh + O_ip ( O_agt ) ) ; let O_ahk = O_ahi + O_hs . y * ( O_ahj - O_ahi ) ; let O_ahl = O_ahk * O_ahk ; let O_ahm = select ( O_agt , O_ahk * sqrt ( O_ahh / ( 1.0 - O_ahl ) ) , O_ahl < 1.0 - 1e-6 ) ; O_agm = O_acn + O_ahg * O_cj + O_ahm * O_jd + O_agn * O_vs ; } var O_bb : O_agi ; O_bb . O_agj = O_agm ; if ( O_agz < 1e-5 || O_it ( O_ir ( O_agu ) ) > 0.99999 ) { let O_hd = O_id ( O_iy ) ; O_bb . O_uu = O_ja ( - O_hd * O_hd * O_hd , ( O_agn * O_xv * O_xx ) ) ; } else { O_bb . O_uu = 1.0 / O_agz ; } return O_bb ; } fn O_wv ( O_ahn : O_wh , O_aho : vec3 < f32 > , O_ahp : vec3 < f32 > , O_hs : vec2 < f32 > , O_agl : bool , O_ahq : bool , ) -> O_afb { var O_xr = O_ahn . O_wa . O_xr ; var O_xt = O_ahn . O_wa . O_xt ; var O_xv = O_ahn . O_wa . O_xv ; var O_xx = O_ahn . O_wa . O_xx ; let O_afa = - O_ahn . O_wa . O_iy ; let O_xz = abs ( O_ahn . O_wa . O_xz ) ; var O_afm = O_ahn . O_wa . O_xz > 0.0 ; var O_ahr = O_ahp ; var O_wy : O_aez ; O_wy . O_acn = O_ahp ; O_wy . O_afa = O_afa ; O_wy . O_ax = vec3 < f32 > ( 0.0 ) ; O_wy . O_hd = 0.0 ; O_wy . O_uu = 0.0 ; O_wy . O_yl = 0.0 ; O_wy . O_cn = 0.0 ; O_wy . O_cm = 0.0 ; if ( O_ahq ) { if ( O_afm ) { O_ahr = O_ahr + O_hv ( O_xr * ( O_xv * 0.5 ) , O_xt * ( O_xx * 0.5 ) , O_hs ) ; } else { O_ahr = O_ahr + O_hy ( O_xr * ( O_xv * 0.5 ) , O_xt * ( O_xx * 0.5 ) , O_hs ) ; } O_wy . O_uu = O_xz ; } else { if ( O_ahn . O_wa . O_wk > 0.0 ) { let O_ahs = O_afn ( O_aho , O_afa , O_ahr , O_xr , O_xv , O_xt , O_xx , O_ahn . O_wa . O_wj , O_afm ) ; if ( ! O_ahs . O_wz ) { return O_afb ( false , O_ahp , O_wy ) ; } O_ahr = O_ahs . O_afl ; O_xr = O_ahs . O_xr ; O_xv = O_ahs . O_xv ; O_xt = O_ahs . O_xt ; O_xx = O_ahs . O_xx ; O_afm = O_ahs . O_afm ; } if ( O_afm ) { let O_aht = O_agk ( O_aho , O_ahr , O_xr , O_xv , O_xt , O_xx , O_hs , O_agl ) ; O_wy . O_uu = O_aht . O_uu ; O_ahr = O_aht . O_agj ; } else { if ( O_ahn . O_wa . O_wj == 0.0 ) { O_wy . O_uu = 1.0 ; } else { if ( O_agl ) { O_ahr = O_ahr + O_hy ( O_xr * ( O_xv * 0.5 ) , O_xt * ( O_xx * 0.5 ) , O_hs ) ; } O_wy . O_uu = 4.0 * O_t / ( O_xv * O_xx ) ; } } } O_wy . O_acn = O_ahr ; let O_bu = O_ix ( O_wy . O_acn - O_aho ) ; O_wy . O_ax = O_bu . xyz ; O_wy . O_hd = O_bu . w ; O_wy . O_yl = O_t * O_xz ; if ( O_ahn . O_wa . O_wk > 0.0 ) { let O_wf = O_afh ( O_wy . O_ax , O_afa , O_ahn . O_wa . O_wj , O_ahn . O_wa . O_wk ) ; O_wy . O_yl = O_wy . O_yl * O_wf ; } if ( O_ahq || ( ! O_afm && O_ahn . O_wa . O_wj > 0.0 ) ) { O_wy . O_uu = O_wy . O_uu * O_afe ( O_afa , - O_wy . O_ax , O_wy . O_hd ) ; } let O_wz = O_ahq || ( O_wy . O_yl > 0.0 ) ; return O_afb ( O_wz , O_ahr , O_wy ) ; } fn O_ahu ( O_wf : f32 , ) -> f32 { let O_ahv = 0.5 * max ( O_wf , 0.0 ) ; if ( O_ahv <= 0.0 ) { return O_cv ; } let O_wj = select ( O_cv , tan ( O_ahv ) , O_wf < O_ao ) ; if ( O_ahv > 0.05 ) { return 1.0 / ( O_wj - O_ahv ) ; } else { let O_ahw = O_ahv * O_ahv * O_ahv ; return 3.0 / O_ahw ; } } struct O_ahx { O_wj : f32 , O_wk : f32 , } fn O_we ( O_wf : f32 , ) -> O_ahx { let O_ahv = 0.5 * max ( O_wf , 0.0 ) ; var O_bb : O_ahx ; if ( O_ahv <= 0.0 ) { O_bb . O_wj = 0.0 ; O_bb . O_wk = O_cv ; return O_bb ; } O_bb . O_wj = select ( O_cv , tan ( O_ahv ) , O_wf < O_ao ) ; if ( O_ahv > 0.05 ) { O_bb . O_wk = 1.0 / ( O_bb . O_wj - O_ahv ) ; } else { let O_ahw = O_ahv * O_ahv * O_ahv ; O_bb . O_wk = 3.0 / O_ahw ; } return O_bb ; } ";QE.addShaderCode(qLe);var $Le=class Eye{constructor(t,e,r,i,n,s,a){this.gpu=t,this.camera=e,this.light=r,this.model=i,this.background=n,this.ray=s,this.pixelTool=a,this.parameter=new mht(t,n,r),this.initBuffers(),this.initLayout(),this.initBind(),this.initPipeline()}static async warm(t,e){wC.time("path tracing warm"),await t.device.queue.onSubmittedWorkDone(),this.cache.set(t,await this.createCache(t,e)),await t.device.queue.onSubmittedWorkDone(),wC.timeEnd("path tracing warm")}static async createCache(t,e){let r=l(t,[["storage","uniform","uniform","uniform","uniform","uniform","float","uniform"],["float","float","float","float","float","float","float","read-only-storage"],["read-only-storage","read-only-storage","read-only-storage","read-only-storage","read-only-storage","read-only-storage","storage","uniform","uniform"],["float","storage"]]),i=await a("main","path tracing pipeline  entrypoint main"),n=await a("main_hit","ray tracing calculation 1"),s=await a("main_demo","ray ");return{layouts:{0:r[0],1:r[1],2:r[2],3:r[3]},pipeline:{pathTracing:i,rayHitQuery:n,directColor:s}};async function a(h,u){let d=t.device.createPipelineLayout({bindGroupLayouts:Object.values(r)}),p={Image_Width:e.width,Image_Height:e.height};return await t.createComputePipelineAsync(qLe,h,u,d,p)}function l(h,u){return u.map(d=>{let p=[];return d.forEach((m,g)=>{let y={binding:g,visibility:GPUShaderStage.COMPUTE},b=c(m);p.push({...y,...b})}),h.device.createBindGroupLayout({entries:p})})}function c(h){switch(h){case"uniform":case"storage":case"read-only-storage":return{buffer:{type:h}};case"float":case"unfilterable-float":case"depth":case"sint":case"uint":return{texture:{sampleType:h}}}}}getParameter(){return this.parameter}getBuffer(){return this.buffers}rebind(){this.initBind()}reset(){let t=this.gpu.device.createCommandEncoder();this.buffers.geometry.clear(t),this.buffers.hdrColor.clear(t),this.buffers.depth.clear(t),this.buffers.position.clear(t),this.gpu.submit(t),this.updateParameter()}run(){this.updateParameter();{let t=this.gpu.device.createCommandEncoder(),e=t.beginComputePass();e.setPipeline(this.pipelines.pathTracing);for(let[r,i]of Object.entries(this.bindGroups))e.setBindGroup(Number(r),i);e.dispatchWorkgroups(this.pixelTool.workgroupInfo.count),e.end(),this.gpu.submit(t)}this.geometryDismantle.run()}async runAsync(){await this.gpu.device.queue.onSubmittedWorkDone();let t=performance.now();return this.run(),await this.gpu.device.queue.onSubmittedWorkDone(),performance.now()-t}async runRayHitQueryAsync(){await this.gpu.device.queue.onSubmittedWorkDone();{let e=this.gpu.device.createCommandEncoder(),r=e.beginComputePass();r.setPipeline(this.pipelines.rayHitQuery);for(let[i,n]of Object.entries(this.bindGroups))r.setBindGroup(Number(i),n);r.dispatchWorkgroups(1),r.end(),this.gpu.submit(e)}await this.gpu.device.queue.onSubmittedWorkDone();let t=await this.buffers.log.read();return{isLight:t[2]===5,...t[1]===-1?{}:{materialIndex:t[0],depth:t[1]}}}runDirectColor(){let t=this.gpu.device.createCommandEncoder(),e=t.beginComputePass();e.setPipeline(this.pipelines.directColor);for(let[r,i]of Object.entries(this.bindGroups))e.setBindGroup(Number(r),i);e.dispatchWorkgroups(Math.ceil(this.getSize().width/8),Math.ceil(this.getSize().height/8)),e.end(),this.gpu.submit(t),this.geometryDismantle.run()}async runDirectColorAsync(){await this.gpu.device.queue.onSubmittedWorkDone();let t=performance.now();return this.runDirectColor(),await this.gpu.device.queue.onSubmittedWorkDone(),performance.now()-t}getSize(){return this.camera.size}updateParameter(){let t=this.pixelTool.pixelStart,e=Math.random();this.parameter.update({pixelStart:t,randomSeed:e})}initPipeline(){this.pipelines=Eye.cache.get(this.gpu).pipeline}initBuffers(){let t=this.gpu.createStorageDynamicBuffer(this.camera.size.width*this.camera.size.height*4*4,"RayTracerCalculationRenderer image buffer");this.geometryDismantle=new fht(this.gpu,this.camera.size,t),this.buffers={depth:this.geometryDismantle.getBuffers().depth,position:this.geometryDismantle.getBuffers().position,hdrColor:this.geometryDismantle.getBuffers().hdrColor,normal:this.geometryDismantle.getBuffers().normal,type:this.geometryDismantle.getBuffers().type,geometry:t,pixel:this.pixelTool.buffer,log:this.gpu.createDynamicBuffer(3,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC,"log buffer")}}initLayout(){this.layouts=Eye.cache.get(this.gpu).layouts}initBind(){this.bindGroups={0:this.gpu.device.createBindGroup({label:"ray tracing calculation bind group 0",layout:this.layouts[0],entries:[{binding:0,resource:{buffer:this.buffers.geometry.getBuffer()}},{binding:1,resource:{buffer:this.parameter.buffer.getBuffer()}},{binding:2,resource:{buffer:this.camera.buffer.getBuffer()}},{binding:3,resource:{buffer:this.model.pcb.bvhIndex.getBuffer()}},{binding:4,resource:{buffer:this.model.pcb.material.getBuffer()}},{binding:5,resource:{buffer:this.model.board.parameter.getBuffer()}},{binding:6,resource:this.background.texture.view},{binding:7,resource:{buffer:this.light.buffer.getBuffer()}}]}),1:this.model.material.bindGroup,2:this.gpu.device.createBindGroup({label:"ray tracing calculation bind group 2",layout:this.layouts[2],entries:[{binding:0,resource:{buffer:this.ray.getBuffer()}},{binding:1,resource:{buffer:this.model.obj.getBVH().getBuffer()}},{binding:2,resource:{buffer:this.model.obj.getFace().getBuffer()}},{binding:3,resource:{buffer:this.model.obj.getVertexAndNormal().getBuffer()}},{binding:4,resource:{buffer:this.model.pcb.bvh.getBuffer()}},{binding:5,resource:{buffer:this.model.pcb.pt.getBuffer()}},{binding:6,resource:{buffer:this.buffers.log.getBuffer()}},{binding:7,resource:{buffer:this.model.pcb.layerInfo.getBuffer()}},{binding:8,resource:{buffer:this.model.occluder.buffer.getBuffer()}}]}),3:this.gpu.device.createBindGroup({label:"ray tracing calculation bind group 3",layout:this.layouts[3],entries:[{binding:0,resource:this.model.board.texture.view},{binding:1,resource:{buffer:this.buffers.pixel.getBuffer()}}]})}}};$Le.cache=new Map;var E2e=$Le,jZ=class{static get lambert(){return this.cache[0]}static get disney(){return this.cache[1]}static get(o){return this.cache.find(t=>t[0]===o)}static all(){return this.cache.map(o=>o[0])}};jZ.cache=[["lambert",0],["disney",1]];var mht=class{constructor(o,t,e){this.gpu=o,this._background=t,this._light=e,this._maxRayBounces=1,this._randomSeed=Math.random(),this._pixelStart=0,this._diffuseMode=jZ.disney,this._hideBoard=!1,this._hideOccluder=!1,this._hidePCB=!1,this._hideOBJ=!1,this._hideLight=!1,this._hideCoordinate=!1,this.buffer=this.gpu.createUniformDynamicBuffer(this._getData(),"parameters buffer of raytracer."),this._light.setListen(this._update.bind(this)),this._background.setListen(this._update.bind(this))}get hideCoordinate(){return this._hideCoordinate}set hideCoordinate(o){this._hideCoordinate=o,this._update()}get hideBoard(){return this._hideBoard}set hideBoard(o){this._hideBoard=o,this._update()}get hideOccluder(){return this._hideOccluder}set hideOccluder(o){this._hideOccluder=o,this._update()}get hidePCB(){return this._hidePCB}set hidePCB(o){this._hidePCB=o,this._update()}get hideOBJ(){return this._hideOBJ}set hideOBJ(o){this._hideOBJ=o,this._update()}get hideLight(){return this._hideLight}set hideLight(o){this._hideLight=o,this._update()}get maxRayBounces(){return this._maxRayBounces}set diffuseMode(o){this._diffuseMode=o,this._update()}get diffuseMode(){return this._diffuseMode}setMaxRayBounces(o){this._maxRayBounces=o,this._update()}update(o){let{pixelStart:t,randomSeed:e}=o;this._randomSeed=e,this._pixelStart=t,this._update()}_getData(){let o={random_seed:this._randomSeed,pixelStart:this._pixelStart,max_ray_bounces:this._maxRayBounces,diffuseMode:this._diffuseMode[1],hideBoard:this._hideBoard,hideOccluder:this._hideOccluder,hidePCB:this._hidePCB,hideOBJ:this._hideOBJ,hideLight:this._hideLight,hide_coordinate:this._hideCoordinate,backgroundRotation:this._background.getRotatoin(),backgroundIntensity:this._background.getIntensity(),backgroundColor:this._background.getColor(),backgroundSource:this._background.isUseColor(),lightIsOpen:this._light.getIsOpen()},t=eb(o);return new Float32Array(t)}_update(){this.gpu.writeBuffer(this.buffer,0,new Float32Array(this._getData()))}},ght="struct O_a { @ builtin ( position ) O_b : vec4 < f32 > , @ location ( 0 ) O_c : vec2f , } const O_d = array < vec4 < f32 > , 6 > ( vec4 ( - 1 , 1 , 0 , 0 ) , vec4 ( - 1 , - 1 , 0 , 1 ) , vec4 ( 1 , - 1 , 1 , 1 ) , vec4 ( - 1 , 1 , 0 , 0 ) , vec4 ( 1 , - 1 , 1 , 1 ) , vec4 ( 1 , 1 , 1 , 0 ) ) ; @ vertex fn vertex_main ( @ builtin ( vertex_index ) O_e : u32 , ) -> O_a { var O_f : O_a ; O_f . O_b = vec4 < f32 > ( O_d [ O_e ] . xy , 0.0 , 1.0 ) ; O_f . O_c = O_d [ O_e ] . zw ; return O_f ; } ",yht="struct O_a { O_b : f32 , O_c : f32 , O_d : f32 , O_e : f32 , } @ group ( 0 ) @ binding ( 0 ) var < storage , read_write > O_f : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 1 ) var < uniform > O_g : O_a ; @ fragment fn frag_main ( @ location ( 0 ) O_h : vec2 < f32 > , ) -> @ location ( 0 ) vec4f { var O_i = O_j ( O_h ) ; if ( O_g . O_b == 1.0 ) { O_i = O_k ( O_i ) ; } if ( O_g . O_c == 0.0 ) { O_i = O_l ( O_i ) ; } return vec4f ( O_i , 0 ) ; } fn O_j ( O_h : vec2 < f32 > , ) -> vec3f { let O_m = u32 ( O_h . x * O_g . O_d ) ; let O_n = u32 ( O_h . y * O_g . O_e ) ; let O_o = u32 ( O_m + O_n * u32 ( O_g . O_d ) ) ; return O_f [ O_o ] . rgb ; } fn O_l ( O_i : vec3f , ) -> vec3f { return vec3f ( select ( O_i * 12.92 , 1.055 * pow ( O_i , vec3f ( 1.0 / 2.4 ) ) - 0.055 , O_i > vec3f ( 0.0031308 ) ) ) ; } fn O_k ( O_i : vec3 < f32 > , ) -> vec3 < f32 > { const O_p : f32 = 2.51 ; const O_q : f32 = 0.03 ; const O_r : f32 = 2.43 ; const O_s : f32 = 0.59 ; const O_t : f32 = 0.14 ; let O_m = min ( O_i , vec3 < f32 > ( 10000.0 ) ) ; return min ( ( O_m * ( O_p * O_m + O_q ) ) / ( O_m * ( O_r * O_m + O_s ) + O_t ) , vec3f ( 1.0 ) ) ; } ",bht=class{constructor(o,t){this.gpu=o,this.size=t,this.displayDevice="sRGB",this.viewTransform="Standard",this.buffer=this.gpu.createUniformDynamicBuffer(this.getData(),"parameters buffer of DrawColorGamma.")}getDisplayDevice(){return this.displayDevice}getViewTransform(){return this.viewTransform}setDisplayDevice(o){this.displayDevice=o,this.update()}setViewTransform(o){this.viewTransform=o,this.update()}getData(){let o={viewTransform:r(this.viewTransform),displayDevice:e(this.displayDevice),width:this.size.width,height:this.size.height},t=eb(o);return new Float32Array(t);function e(i){switch(i){case"sRGB":return 0;case"Display p3":return 1}}function r(i){switch(i){case"Standard":return 0;case"ACES":return 1}}}update(){this.gpu.writeBuffer(this.buffer,0,new Float32Array(this.getData()))}},KLe=class{constructor(o,t,e){this.gpu=o,this.context=t,this.input=e,this.prameter=new bht(o,t.canvas),this.initializeBuffers(),this.initializePipeline(),this.initializeBindGroup()}get size(){let o=this.context.canvas;return{width:o.clientWidth,height:o.clientHeight}}run(){let o=this.gpu.device.createCommandEncoder(),t=o.beginRenderPass({colorAttachments:[{view:this.context.getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]});t.setPipeline(this.pipeline),t.setBindGroup(0,this.bindGroup),t.draw(6,1,0,0),t.end(),this.gpu.submit(o)}async runAsync(){this.run(),await this.gpu.device.queue.onSubmittedWorkDone()}initializeBuffers(){this.buffers={color:this.input,parameter:this.prameter.buffer}}initializeBindGroup(){this.bindGroup=this.gpu.createBindGroup("RaytracerRenderDraw",this.pipeline.getBindGroupLayout(0),0,this.buffers.color,1,this.buffers.parameter)}initializePipeline(){this.pipeline=this.gpu.device.createRenderPipeline({label:"image rendering",layout:"auto",vertex:{module:this.gpu.createShaderModule(ght),entryPoint:"vertex_main"},fragment:{module:this.gpu.createShaderModule(yht),entryPoint:"frag_main",targets:[{format:"rgba8unorm"}]},primitive:{topology:"triangle-list"}})}},Pht=class{constructor(){}},O2e=class{constructor(o){this.gpu=o}_submitEncoder(o){if(o===void 0){let t=this.gpu.device.createCommandEncoder();this._submitEncoder(t),this.gpu.submit(t)}else if(o instanceof GPUCommandEncoder){let t=o.beginComputePass();this._submitEncoder(t),t.end()}else o instanceof GPUComputePassEncoder&&this._writePassEncoder(o)}async _submitEncoderAsync(){await this.isGPUBusy(this.gpu);let o=performance.now();return this._submitEncoder(),await this.gpu.device.queue.onSubmittedWorkDone(),performance.now()-o}async isGPUBusy(o){let t=performance.now();return await o.device.queue.onSubmittedWorkDone(),performance.now()-t>1}},ZLe="struct O_a { O_b : vec3 < f32 > , O_c : vec3 < f32 > , O_d : vec3 < f32 > , O_e : vec3 < f32 > , O_f : vec3 < f32 > , O_g : f32 , O_h : f32 , O_i : f32 , O_j : f32 , O_k : vec3f , } struct O_l { O_m : f32 , O_n : f32 , } @ group ( 0 ) @ binding ( 0 ) var < storage , read_write > O_o : array < f32 > ; @ group ( 0 ) @ binding ( 1 ) var < uniform > O_p : O_a ; @ group ( 0 ) @ binding ( 2 ) var < uniform > O_q : O_l ; @ group ( 0 ) @ binding ( 3 ) var < storage , read_write > O_r : array < vec2 < f32 > > ; override Image_Width : u32 ; override Image_Height : u32 ; var < private > O_m : f32 ; @ compute @ workgroup_size ( 64 ) fn main ( @ builtin ( global_invocation_id ) O_s : vec3 < u32 > , ) { let O_t = vec2 < u32 > ( u32 ( O_r [ O_s . x + u32 ( O_q . O_n ) ] . x ) , u32 ( O_r [ O_s . x + u32 ( O_q . O_n ) ] . y ) ) ; if ( O_t . x >= Image_Width || O_t . y >= Image_Height ) { return ; } let O_u = O_t . x + O_t . y * Image_Width ; let O_v = Image_Width * Image_Height * 8 - u32 ( O_u ) * 8 ; O_m = f32 ( O_u ) * O_q . O_m ; var O_w = O_p . O_c ; O_w = O_w + ( f32 ( O_t . x ) + O_x ( ) ) * O_p . O_d ; O_w = O_w + ( f32 ( O_t . y ) + O_x ( ) ) * O_p . O_e ; O_o [ O_v ] = O_w . x ; O_o [ O_v + 1 ] = O_w . y ; O_o [ O_v + 2 ] = O_w . z ; O_o [ O_v + 3 ] = 0 ; let O_b = O_p . O_b ; var O_y = normalize ( O_b - O_w ) ; O_o [ O_v + 4 ] = O_y . x ; O_o [ O_v + 5 ] = O_y . y ; O_o [ O_v + 6 ] = O_y . z ; O_o [ O_v + 7 ] = 0 ; } fn O_x ( ) -> f32 { let O_z : f32 = 1664525.0 ; let O_aa : f32 = 1013904223.0 ; let O_ab : f32 = 4294967296.0 ; let O_ac = fract ( ( O_z * O_m + O_aa ) / O_ab ) ; O_m = 100000 * O_ac ; return O_ac ; } ";QE.addShaderCode(ZLe);var Tht=class{constructor(o){this._randomSeed=Math.random(),this._pixelCount=1,this._pixelSize=64;let t="ray generator ranfom pixel parmater";this.buffer=o.createUniformDynamicBuffer(this._getData(),t)}get pixelAllSize(){return this._pixelCount*this._pixelSize}update(o){this._randomSeed=Math.random(),this.buffer.write(0,this._getData(o))}_getData(o=0){let t={randomSeed:this._randomSeed,pixelStart:o},e=eb(t);return new Float32Array(e)}},Iht=class extends O2e{constructor(o,t,e){super(o),this._gpu=o,this._camera=t,this._pixel=e,this._parmater=new Tht(o),this._renderCount=0,this._initializeBuffers(),this._initializeLayout(),this._initializePipeline(),this._initializeBindgroup()}get buffer(){return this._buffer}get _maxRenderCount(){return Math.ceil(this._size.width*this._size.height/this._parmater.pixelAllSize)}get _size(){return this._camera.size}run(){let o=this._renderCount*this._parmater.pixelAllSize;this._parmater.update(o),this._submitEncoder(),this._renderCount++,this._renderCount===this._maxRenderCount&&this.reset()}reset(){this._renderCount=0;let o=this._size.width*this._size.height*8;this.buffer.ray.write(0,new Float32Array(new Array(o).fill(0)))}async runAsync(){let o=this._renderCount*this._parmater.pixelAllSize;this._parmater.update(o),await this._submitEncoderAsync(),this._renderCount++,this._renderCount===this._maxRenderCount&&this.reset()}async isEmpty(){let o=await this._buffer.ray.read(),t=Array.from(o).filter(r=>r),e=new Set(t);debugger;return!1}_writePassEncoder(o){o.setPipeline(this._pipeline),o.setBindGroup(0,this._bindGroup),o.dispatchWorkgroups(this._parmater._pixelCount)}_initializeBuffers(){let o=this._size.width*this._size.height*8,t=this._gpu.createStorageDynamicBuffer(o,"ray"),e=this._camera.buffer,r=this._parmater.buffer,i=this._pixel;this._buffer={ray:t,camera:e,parmater:r,pixel:i}}_initializeLayout(){let o=[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:3,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}}];this._layout=this.gpu.device.createBindGroupLayout({entries:o})}_initializePipeline(){this._pipeline=this._gpu.createComputePipeline(ZLe,"main","ray generate",this.gpu.device.createPipelineLayout({bindGroupLayouts:[this._layout]}),{Image_Width:this._size.width,Image_Height:this._size.height})}_initializeBindgroup(){this._bindGroup=this._gpu.createBindGroup("RaytracerRayGenerateRandom",this._layout,0,this._buffer.ray,1,this._buffer.camera,2,this._buffer.parmater,3,this._buffer.pixel)}},JLe="struct O_a { O_b : vec3 < f32 > , O_c : vec3 < f32 > , O_d : vec3 < f32 > , O_e : vec3 < f32 > , O_f : vec3 < f32 > , O_g : f32 , O_h : f32 , O_i : f32 , O_j : f32 , O_k : vec3f , } @ group ( 0 ) @ binding ( 0 ) var < storage , read_write > O_l : array < f32 > ; @ group ( 0 ) @ binding ( 1 ) var < uniform > O_m : O_a ; @ group ( 0 ) @ binding ( 2 ) var < uniform > O_n : f32 ; override Image_Width : u32 ; override Image_Height : u32 ; var < private > O_o : f32 ; @ compute @ workgroup_size ( 8 , 8 ) fn main ( @ builtin ( global_invocation_id ) O_p : vec3 < u32 > , ) { if ( O_p . x >= Image_Width || O_p . y >= Image_Height ) { return ; } let O_q = O_p . x + O_p . y * Image_Width ; let O_r = Image_Width * Image_Height * 8 - u32 ( O_q ) * 8 - 8 ; O_o = f32 ( O_q ) * O_n ; var O_s = O_m . O_c ; O_s = O_s + ( f32 ( O_p . x ) + O_t ( ) ) * O_m . O_d ; O_s = O_s + ( f32 ( O_p . y ) + O_t ( ) ) * O_m . O_e ; O_l [ O_r ] = O_s . x ; O_l [ O_r + 1 ] = O_s . y ; O_l [ O_r + 2 ] = O_s . z ; O_l [ O_r + 3 ] = 0 ; let O_b = O_m . O_b ; var O_u = normalize ( O_b - O_s ) ; O_l [ O_r + 4 ] = O_u . x ; O_l [ O_r + 5 ] = O_u . y ; O_l [ O_r + 6 ] = O_u . z ; O_l [ O_r + 7 ] = 0 ; } fn O_t ( ) -> f32 { let O_v : f32 = 1664525.0 ; let O_w : f32 = 1013904223.0 ; let O_x : f32 = 4294967296.0 ; let O_y = fract ( ( O_v * O_o + O_w ) / O_x ) ; O_o = 100000 * O_y ; return O_y ; } fn O_z ( O_aa : vec3f , O_ab : vec3f , O_ac : vec3f , O_ad : f32 , ) -> vec3f { let O_ae = 2.0 * 3.1415926 * O_t ( ) ; let O_af = O_t ( ) * O_ad ; let O_ag = O_af * cos ( O_ae ) ; let O_ah = O_af * sin ( O_ae ) ; return O_aa + O_ag * O_ab + O_ah * O_ac ; } ";QE.addShaderCode(JLe);var Cht=class extends O2e{constructor(o,t){super(o),this._gpu=o,this._camera=t,this._buffer={ray:this._gpu.createStorageDynamicBuffer(this._size.width*this._size.height*8,"ray"),camera:this._camera.buffer,random:this._gpu.createUniformDynamicBuffer(1,"random")};let e=this.gpu.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}}]});this._pipeline=this._gpu.createComputePipeline(JLe,"main","ray generate",this.gpu.device.createPipelineLayout({bindGroupLayouts:[e]}),{Image_Width:this._size.width,Image_Height:this._size.height}),this._bindGroup=this._gpu.createBindGroup("RaytracerRayGenerateRandom",e,0,this._buffer.ray,1,this._buffer.camera,2,this._buffer.random)}get ray(){return this._buffer.ray}get _size(){return this._camera.size}run(){this._buffer.random.write(0,new Float32Array([Math.random()])),this._submitEncoder()}async runAsync(){return this._buffer.random.write(0,new Float32Array([Math.random()])),await this._submitEncoderAsync()}async runTest(){await this.runAsync();let o=await this.ray.read("f32");console.log(o)}_writePassEncoder(o){o.setPipeline(this._pipeline),o.setBindGroup(0,this._bindGroup),o.dispatchWorkgroups(Math.ceil(this._size.width/8),Math.ceil(this._size.height/8))}},QLe="struct O_a { O_b : vec3 < f32 > , O_c : vec3 < f32 > , O_d : vec3 < f32 > , O_e : vec3 < f32 > , O_f : vec3 < f32 > , O_g : f32 , O_h : f32 , O_i : f32 , O_j : f32 , O_k : vec3f , } @ group ( 0 ) @ binding ( 0 ) var < storage , read_write > O_l : array < f32 > ; @ group ( 0 ) @ binding ( 1 ) var < uniform > O_m : O_a ; override Image_Width : u32 ; override Image_Height : u32 ; @ compute @ workgroup_size ( 8 , 8 ) fn main ( @ builtin ( global_invocation_id ) O_n : vec3 < u32 > , ) { if ( O_n . x >= Image_Width || O_n . y >= Image_Height ) { return ; } let O_o = O_n . x + O_n . y * Image_Width ; let O_p = Image_Width * Image_Height * 8 - u32 ( O_o ) * 8 ; var O_q = O_m . O_c ; O_q = O_q + f32 ( O_n . x ) * O_m . O_d ; O_q = O_q + f32 ( O_n . y ) * O_m . O_e ; O_l [ O_p ] = O_q . x ; O_l [ O_p + 1 ] = O_q . y ; O_l [ O_p + 2 ] = O_q . z ; O_l [ O_p + 3 ] = 0 ; let O_b = O_m . O_b ; var O_r = normalize ( O_b - O_q ) ; O_l [ O_p + 4 ] = O_r . x ; O_l [ O_p + 5 ] = O_r . y ; O_l [ O_p + 6 ] = O_r . z ; O_l [ O_p + 7 ] = 0 ; } ";QE.addShaderCode(QLe);var Sht=class extends O2e{constructor(o,t,e){super(o),this._gpu=o,this._camera=t,this._size=e,this._buffer={ray:this._gpu.createStorageDynamicBuffer(this._size.width*this._size.height*8,"ray"),camera:this._camera.buffer,random:this._gpu.createUniformDynamicBuffer(1,"random")};let r=this.gpu.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}}]});this._pipeline=this._gpu.createComputePipeline(QLe,"main","ray generate",this.gpu.device.createPipelineLayout({bindGroupLayouts:[r]}),{Image_Width:this._size.width,Image_Height:this._size.height}),this._bindGroup=this._gpu.createBindGroup("RaytracerRayGenerateRandom",r,0,this._buffer.ray,1,this._buffer.camera,2,this._buffer.random)}get ray(){return this._buffer.ray}run(){this._buffer.random.write(0,new Float32Array([Math.random()])),this._submitEncoder()}async runAsync(){return this._buffer.random.write(0,new Float32Array([Math.random()])),await this._submitEncoderAsync()}async runTest(){await this.runAsync();let o=await this.ray.read("f32");console.log(o)}_writePassEncoder(o){o.setPipeline(this._pipeline),o.setBindGroup(0,this._bindGroup),o.dispatchWorkgroups(Math.ceil(this._size.width/8),Math.ceil(this._size.height/8))}},eMe=class extends Pht{static std(o,t,e){return new Sht(o,t,e)}static random(o,t){return new Cht(o,t)}static random_pixel(o,t,e){return new Iht(o,t,e)}},tMe=class{setEnableDenoise(o){throw new Error("Method not implemented.")}getEnableDenoise(){throw new Error("Method not implemented.")}getMaxSampleCount(){throw new Error("Method not implemented.")}setMaxSampleCount(o){throw new Error("Method not implemented.")}getPathTracing(){throw new Error("Method not implemented.")}getDraw(){throw new Error("Method not implemented.")}getLut(){throw new Error("Method not implemented.")}setReset(){throw new Error("Method not implemented.")}render(){throw new Error("Method not implemented.")}renderAsync(){throw new Error("Method not implemented.")}hitFace(){throw new Error("Method not implemented.")}};function Eht(o,t){let e=[];for(let n=0;n<t.height;n++)for(let s=0;s<t.width;s++){let a=Math.random();e.push({x:s,y:n,z:a})}e.sort((n,s)=>n.z-s.z);let r=e.map(n=>[n.x,n.y]).flat(),i=`width:${t.width}+height:${t.height}.random coordinates buffer.`;return o.createStorageDynamicBuffer(r,i)}function iRe(o){if(o.length===0)return NaN;let t=o.length,e=0;for(let r=0;r<t;r++)e+=o[r];return e/t}var rMe=class{constructor(o,t){this._size=t,this.times=[],this._pixelStart=0,wC.time("buildRandomCoordinatesBuffer"),this.buffer=Eht(o,t),wC.timeEnd("buildRandomCoordinatesBuffer"),this.workgroupInfo={size:64,count:1}}set workgroupCount(o){o=Math.max(1,o),o=Math.min(1024,o),this.workgroupInfo.count=o}get pixelStart(){return this._pixelStart}get workgroupCount(){return this.workgroupInfo.count}get parallelCount(){return this.workgroupInfo.size*this.workgroupInfo.count}get singleSampleRenderCount(){return Math.ceil(this._size.width*this._size.height/this.parallelCount)}newRender(){this._pixelStart=0,this.time=performance.now()}isFinallyRender(){return this._pixelStart+this.parallelCount>=this._size.width*this._size.height}addRenderCount(){if(this._pixelStart+=this.parallelCount,!this.time)this.time=performance.now();else{let o=performance.now()-this.time;this.time=performance.now(),this.times.push(o)}this.times.length>8&&(Oht(this.times)<100?this.workgroupCount=this.workgroupCount+1:this.workgroupCount=this.workgroupCount-1,this.times.length=0)}reset(){window.location.href.includes("do_not_reset_work_groupcount")||(this.workgroupCount=1),this.times.length=0,this.time=void 0,this._pixelStart=0}async test(){let o=Array.from(await this.buffer.read()),t=[];for(let e=0;e<this.parallelCount;e++)t.push(o[this._pixelStart+e]);console.log(o),console.log(t);debugger}};function Oht(o){let t=iRe(o),e=o.filter(r=>r<2*t);return iRe(e)}var Aht=class iMe extends tMe{constructor(t,e,r,i,n,s,a){super(),this.camera=t,this.light=e,this.model=r,this.background=i,this.rayGenerator=n,this.pathTracing=s,this.draw=a}static async build(t,e,r,i,n,s,a){let l=eMe.random(t,e),c=new E2e(t,e,r,i,n,l.ray,new rMe(t,s.canvas)),h=new KLe(t,s,c.getBuffer().hdrColor);return new iMe(e,r,i,n,l,c,h)}async renderAsync(){(this.camera.check()||this.model.checkAndUpdate()||this.light.checkAndUpdate()||this.background.check())&&(await this.rayGenerator.runAsync(),this.pathTracing.reset()),await this.rayGenerator.runAsync(),await this.pathTracing.runDirectColorAsync(),await this.draw.runAsync()}setReset(){}getPathTracing(){return this.pathTracing}},nMe="@ group ( 0 ) @ binding ( 0 ) var < storage , read_write > O_a : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 1 ) var < storage , read > O_b : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 2 ) var < storage , read > O_c : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 3 ) var < storage , read > O_d : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 4 ) var < storage , read > O_e : array < f32 > ; @ group ( 0 ) @ binding ( 5 ) var < storage , read > O_f : array < f32 > ; override Width : u32 ; override Height : u32 ; @ compute @ workgroup_size ( 8 , 8 ) fn main ( @ builtin ( global_invocation_id ) O_g : vec3 < u32 > , ) { if ( O_g . x >= Width || O_g . y >= Height ) { return ; } let O_h = O_g . x + O_g . y * u32 ( Width ) ; let O_i = O_d [ O_h ] ; let O_j : u32 = 10 ; let O_k : u32 = O_j / 2 ; var O_l : vec3f ; var O_m = 0 ; for ( var O_n : u32 = 0 ; O_n < O_j ; O_n += 1 ) { for ( var O_o : u32 = 0 ; O_o < O_j ; O_o += 1 ) { let O_p = O_g . x + ( O_n - O_k ) ; let O_q = O_g . y + ( O_o - O_k ) ; if ( O_p >= Width ) { continue ; } if ( O_q >= Height ) { continue ; } let O_r = O_p + O_q * Width ; let O_s = O_d [ O_r ] ; if ( dot ( O_s , O_i ) < 0.98 ) { continue ; } O_l += O_b [ O_r ] ; O_m += 1 ; } } O_a [ O_h ] = O_l / f32 ( O_m ) ; } ";QE.addShaderCode(nMe);var _ht=class{constructor(o,t,e,r,i,n,s){this.gpu=o,this.size=t,this.hdrColor=e,this.depth=r,this.position=i,this.normal=n,this.type=s,this.initializeBuffer(),this.initializeLayout(),this.initializeBindGroup(),this.initializePipeline()}getBuffers(){return this.buffers}async run(){let o=this.gpu.device.createCommandEncoder(),t=o.beginComputePass();t.setPipeline(this.pipeline),t.setBindGroup(0,this.bindGroup),t.dispatchWorkgroups(Math.ceil(this.size.width/8),Math.ceil(this.size.height/8)),t.end(),this.gpu.submit(o),await this.gpu.device.queue.onSubmittedWorkDone()}initializePipeline(){this.pipeline=this.gpu.createComputePipeline(nMe,"main","draw pipeline",this.gpu.device.createPipelineLayout({bindGroupLayouts:[this._layout]}),{Width:this.size.width,Height:this.size.height})}initializeBindGroup(){this.bindGroup=this.gpu.createBindGroup("RaytracerRenderDoF",this._layout,0,this.buffers.denoiseHDRColor,1,this.buffers.hdrColor,2,this.buffers.position,3,this.buffers.normal,4,this.buffers.depth,5,this.buffers.type)}initializeLayout(){this._layout=this.gpu.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}},{binding:3,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}},{binding:4,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}},{binding:5,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}}]})}initializeBuffer(){this.buffers={hdrColor:this.hdrColor,depth:this.depth,position:this.position,normal:this.normal,type:this.type,denoiseHDRColor:this.gpu.createDynamicBuffer(this.size.height*this.size.width*4,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC,"denoise hdr color")}}},Oye="struct O_a { O_b : f32 , O_c : f32 , } @ group ( 0 ) @ binding ( 0 ) var < storage , read_write > O_d : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 1 ) var < storage , read > O_e : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 2 ) var < storage , read_write > O_f : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 3 ) var < storage , read_write > O_g : array < vec2 < f32 > > ; @ group ( 0 ) @ binding ( 4 ) var < uniform > O_h : O_a ; @ group ( 0 ) @ binding ( 5 ) var < storage , read_write > O_i : array < vec3 < f32 > > ; override Width : u32 ; override Height : u32 ; @ compute @ workgroup_size ( 64 ) fn main ( @ builtin ( global_invocation_id ) O_j : vec3 < u32 > , ) { let O_k = u32 ( O_h . O_c ) + O_j . x ; let O_l = O_g [ O_k ] ; let O_m = vec2 < u32 > ( u32 ( O_l . x ) , u32 ( O_l . y ) ) ; if ( O_m . x >= Width || O_m . y >= Height ) { return ; } var O_n = O_m . x + O_m . y * u32 ( Width ) ; O_d [ O_n ] = O_d [ O_n ] + O_e [ O_n ] ; O_f [ O_n ] = O_d [ O_n ] / O_h . O_b ; } @ compute @ workgroup_size ( 8 , 8 ) fn main2 ( @ builtin ( global_invocation_id ) O_j : vec3 < u32 > , ) { if ( O_j . x >= Width || O_j . y >= Height ) { return ; } let O_n = O_j . x + O_j . y * u32 ( Width ) ; O_d [ O_n ] -= O_e [ O_n ] ; O_d [ O_n ] += O_i [ O_n ] ; O_f [ O_n ] = O_d [ O_n ] / O_h . O_b ; } ";QE.addShaderCode(Oye);var vht=class{constructor(o,t,e,r,i){this.gpu=o,this.size=t,this.hdrColor=e,this.denoiseHDRColor=r,this.pixelTool=i,this.parmater=new xht(o),this.initializeLayout(),this.initializeBuffers(),this.initializePipeline(),this.initializeBindGroup()}get buffer(){return this.buffers}async addSimple(o){this.parmater.simpleCount+=1,o&&await this.run2()}reset(){this.parmater.simpleCount=1;let o=this.gpu.device.createCommandEncoder();this.buffers.overlay.clear(o),this.buffers.average.clear(o),this.gpu.submit(o)}run(){this.parmater.pixelStart=this.pixelTool.pixelStart;let o=this.gpu.device.createCommandEncoder(),t=o.beginComputePass();t.setPipeline(this.pipeline),t.setBindGroup(0,this.bindGroup),t.dispatchWorkgroups(this.pixelTool.workgroupInfo.count),t.end(),this.gpu.submit(o)}async run2(){this.parmater.pixelStart=this.pixelTool.pixelStart;let o=this.gpu.device.createCommandEncoder(),t=o.beginComputePass();t.setPipeline(this.pipeline2),t.setBindGroup(0,this.bindGroup),t.dispatchWorkgroups(Math.ceil(this.size.width/8),Math.ceil(this.size.height/8)),t.end(),this.gpu.submit(o),await this.gpu.device.queue.onSubmittedWorkDone()}async runAsync(){this.run(),await this.gpu.device.queue.onSubmittedWorkDone()}_writePassEncoder(o){o.setPipeline(this.pipeline),o.setBindGroup(0,this.bindGroup),o.dispatchWorkgroups(this.pixelTool.workgroupInfo.count)}initializeBuffers(){this.buffers={overlay:this.gpu.createDynamicBuffer(this.size.width*this.size.height*4,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC,"overlayImageBuffer"),average:this.gpu.createDynamicBuffer(this.size.width*this.size.height*4,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC,"overlayImageBuffer"),hdrColor:this.hdrColor,pixel:this.pixelTool.buffer,parmater:this.parmater.buffer,denoiseHDRColor:this.denoiseHDRColor}}initializePipeline(){this.pipeline=this.gpu.createComputePipeline(Oye,"main","draw pipeline",this.gpu.device.createPipelineLayout({bindGroupLayouts:[this.layout]}),{Width:this.size.width,Height:this.size.height}),this.pipeline2=this.gpu.createComputePipeline(Oye,"main2","draw pipeline",this.gpu.device.createPipelineLayout({bindGroupLayouts:[this.layout]}),{Width:this.size.width,Height:this.size.height})}initializeLayout(){this.layout=this.gpu.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:3,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:4,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:5,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}}]})}initializeBindGroup(){this.bindGroup=this.gpu.createBindGroup("RaytracerRenderEquipartition",this.layout,0,this.buffers.overlay,1,this.buffers.hdrColor,2,this.buffers.average,3,this.buffers.pixel,4,this.buffers.parmater,5,this.buffers.denoiseHDRColor)}},xht=class{constructor(o){this._gpu=o,this._pixelStart=0,this._simpleCount=1}get buffer(){return this._buffer||this._update(),this._buffer}set simpleCount(o){this._simpleCount=o,this._update()}get simpleCount(){return this._simpleCount}set pixelStart(o){this._pixelStart=o,this._update()}_update(){let o={simpleCount:this._simpleCount,pixelStart:this._pixelStart},t=eb(o),e=new Float32Array(t);if(this._buffer)this._buffer.write(0,e);else{let r="ray generator ranfom pixel parmater";this._buffer=this._gpu.createUniformDynamicBuffer(e,r)}}},oMe="struct O_a { O_b : f32 , O_c : f32 , O_d : f32 , O_e : f32 , } @ group ( 0 ) @ binding ( 0 ) var < storage , read_write > O_f : array < vec3 < f32 > > ; @ group ( 0 ) @ binding ( 1 ) var O_g : sampler ; @ group ( 0 ) @ binding ( 2 ) var O_h : texture_3d < f32 > ; @ group ( 0 ) @ binding ( 3 ) var < uniform > O_i : O_a ; @ group ( 0 ) @ binding ( 4 ) var < storage , read_write > O_j : array < vec3 < f32 > > ; @ compute @ workgroup_size ( 8 , 8 ) fn main ( @ builtin ( global_invocation_id ) O_k : vec3 < u32 > , ) { if ( O_k . x >= u32 ( O_i . O_b ) || O_k . y >= u32 ( O_i . O_c ) ) { return ; } let O_l = O_k . x + O_k . y * u32 ( O_i . O_b ) ; var O_m = O_f [ O_l ] . rgb ; O_m = clamp ( O_m , vec3f ( 0 ) , vec3f ( 1 ) ) ; if ( O_i . O_e == 1.0 ) { O_j [ O_l ] = O_m ; } else { let O_n = O_m * ( ( O_i . O_d - 1.0 ) / O_i . O_d ) + ( 0.5 / O_i . O_d ) ; let O_o = textureSampleLevel ( O_h , O_g , O_n , 0.0 ) . rgb ; O_j [ O_l ] = O_o ; } } ";QE.addShaderCode(oMe);var Rht=class sMe{constructor(t,e,r,i=64){this.gpu=t,this.input=e,this.context=r,this.size=i,this.cache=new Map,this.parameter=new wht(t,r.canvas),this.initBuffer(),this.initLayout(),this.initBindGroup(),this.initPipeline()}static async build(t,e,r,i){let n=new sMe(t,e,r);if(i)for(let s of i)await n.add(s);return n}getBuffer(){return this.buffer}size1(){return this.context.canvas}initPipeline(){let t=this.gpu.device.createPipelineLayout({label:"LUT Pipeline Layout",bindGroupLayouts:[this.bindGroupLayout]});this.renderPipeline=this.gpu.createComputePipeline(oMe,"main","geometry buffer dismantle",t)}initBindGroup(){let t=this.gpu.device.createSampler({label:"3D LUT Sampler",minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge"});this.bindGroup=this.gpu.device.createBindGroup({label:"LUT Post-Processing Bind Group",layout:this.bindGroupLayout,entries:[{binding:0,resource:{buffer:this.buffer.input.getBuffer()}},{binding:1,resource:t},{binding:2,resource:this.buffer.lut.createView()},{binding:3,resource:{buffer:this.parameter.buffer.getBuffer()}},{binding:4,resource:{buffer:this.buffer.out.getBuffer()}}]})}initLayout(){this.bindGroupLayout=this.gpu.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:1,visibility:GPUShaderStage.COMPUTE,sampler:{type:"filtering"}},{binding:2,visibility:GPUShaderStage.COMPUTE,texture:{sampleType:"float",viewDimension:"3d"}},{binding:3,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:4,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}}]})}initBuffer(){this.buffer={input:this.input,out:this.gpu.createStorageDynamicBuffer(this.size1().width*this.size1().height*4,""),lut:this.gpu.device.createTexture({label:"3D LUT",dimension:"3d",size:[this.size,this.size,this.size],format:"rgba32float",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,mipLevelCount:1})}}async renderFrame(){let t=this.gpu.device.createCommandEncoder(),e=t.beginComputePass();e.setPipeline(this.renderPipeline),e.setBindGroup(0,this.bindGroup),e.dispatchWorkgroups(Math.ceil(this.size1().width/8),Math.ceil(this.size1().height/8)),e.end(),this.gpu.submit(t),await this.gpu.device.queue.onSubmittedWorkDone()}async add(t){if(NLe(t)!=="cube")throw new Error;this.cache.set(t.name,await Dht(t)),this.use(t.name)}use(t){if(!this.cache.has(t)){this.parameter.setDisable(!0);return}this.parameter.setDisable(!1);let e=this.cache.get(t).data;this.userName=t,this.gpu.device.queue.writeTexture({texture:this.buffer.lut},e,{bytesPerRow:this.size*16,rowsPerImage:this.size},{width:this.size,height:this.size,depthOrArrayLayers:this.size})}getUser(){return this.userName}all(){return Array.from(this.cache.keys())}all2(){return Array.from(this.cache.values()).map(t=>t.file)}};async function Dht(o){let t=(await o.text()).split(`
`),e={size:0,domainMin:[0,0,0],domainMax:[1,1,1],data:new Float32Array,file:o},r=[];for(let s of t){let a=s.trim();if(a.length===0||a.startsWith("#"))continue;let l=a.split(/\s+/);l[0]==="TITLE"?e.title=l[1].replace(/"/g,""):l[0]==="LUT_3D_SIZE"?e.size=parseInt(l[1],10):l[0]==="DOMAIN_MIN"?e.domainMin=[parseFloat(l[1]),parseFloat(l[2]),parseFloat(l[3])]:l[0]==="DOMAIN_MAX"?e.domainMax=[parseFloat(l[1]),parseFloat(l[2]),parseFloat(l[3])]:l.length>=3&&r.push(parseFloat(l[0]),parseFloat(l[1]),parseFloat(l[2]),1)}let i=new Uint8Array(r.length);for(let s=0;s<r.length;s++)i[s]=Math.round(r[s]*255);let n=new Float32Array(r);return e.data=n,e}var wht=class{constructor(o,t){this.gpu=o,this.size=t,this.disable=!0,this.buffer=this.gpu.createUniformDynamicBuffer(this.getData(),"parameters buffer of DrawColorGamma.")}setDisable(o){this.disable=o,this.updata()}updata(){this.buffer.write(0,this.getData())}getData(){let o={width:this.size.width,height:this.size.height,lutSize:64,disable:this.disable},t=eb(o);return new Float32Array(t)}},Lht=class aMe extends tMe{constructor(t,e,r,i,n,s,a,l,c,h,u,d,p,m){super(),this.gpu=t,this.camera=e,this.light=r,this.model=i,this.background=n,this.context=s,this.input=a,this.pathTracing=l,this.draw=c,this.rayGenerator=h,this.equipartition=u,this.pixelTool=d,this.denoise=p,this.lut=m,this.needReset=!1,this.sampleCount=0,this.maxSampleCount=10,this.enableDenoise=!1}static async build(t,e,r,i,n,s,a){let l=new rMe(t,e.size),c=eMe.random(t,e),h=new E2e(t,e,r,i,n,c.ray,l),u=new _ht(t,e.size,h.getBuffer().hdrColor,h.getBuffer().depth,h.getBuffer().position,h.getBuffer().normal,h.getBuffer().type),d=new vht(t,e.size,h.getBuffer().hdrColor,u.getBuffers().denoiseHDRColor,l),p=await Rht.build(t,d.buffer.average,s,a.lut),m=new KLe(t,s,p.getBuffer().out);return new aMe(t,e,r,i,n,s,a,h,m,c,d,l,u,p)}setEnableDenoise(t){this.enableDenoise=t,this.setReset()}getEnableDenoise(){return this.enableDenoise}getMaxSampleCount(){return this.maxSampleCount}setMaxSampleCount(t){this.maxSampleCount=t,this.setReset(),this.setReset()}getPathTracing(){return this.pathTracing}getDraw(){return this.draw}getLut(){return this.lut}setReset(){this.needReset=!0}render(){(this.camera.check()||this.model.checkAndUpdate()||this.background.check()||this.needReset)&&(this.needReset&&(this.needReset=!1),this.rayGenerator.run(),this.pathTracing.reset(),this.equipartition.reset(),this.pixelTool.reset()),this.pathTracing.run(),this.equipartition.run(),this.draw.run(),this.pixelTool.isFinallyRender()?(this.equipartition.addSimple(!1),this.pixelTool.newRender()):this.pixelTool.addRenderCount()}async renderAsync(){if(this.checkReset()&&await this.reset(),this.stopSample()){await new Promise(t=>setTimeout(t,100));return}await this.pathTracing.runAsync(),await this.equipartition.runAsync(),await this.lut.renderFrame(),await this.draw.runAsync(),this.pixelTool.isFinallyRender()?(await this.denoise.run(),await this.equipartition.addSimple(this.enableDenoise),await this.rayGenerator.runAsync(),this.pixelTool.newRender(),console.log(this.sampleCount++)):this.pixelTool.addRenderCount()}async hitFace(){return await this.pathTracing.runRayHitQueryAsync()}stopSample(){return this.sampleCount>this.maxSampleCount}async reset(){this.needReset=!1,this.sampleCount=0,await this.rayGenerator.runAsync(),this.pathTracing.reset(),this.equipartition.reset(),this.pixelTool.reset()}checkReset(){return this.camera.check()||this.model.checkAndUpdate()||this.light.checkAndUpdate()||this.background.check()||this.needReset}},Mht=class lMe{constructor(t,e){this.raytracer=t,this.raytracerColor=e}static async build(t,e,r,i,n,s,a){return new lMe(await Lht.build(t,e,r,i,n,s,a),await Aht.build(t,e,r,i,n,s,a))}getRaytracer(){return this.raytracer}getRaytracerColor(){return this.raytracerColor}};function N1e(o,t){let e=t.getContext("webgpu");return e.configure({device:o.device,format:"rgba8unorm",alphaMode:"opaque"}),e}var k1e=class{constructor(o){this._rendererGroup=o}get renderer(){return this.mode=="color"?this._rendererGroup.getRaytracerColor():this._rendererGroup.getRaytracer()}set renderMode(o){this.mode=o,this.renderer.setReset()}startContinuousSyncRender(){this.renderer.render(),requestAnimationFrame(()=>this.startContinuousSyncRender())}startRenderDeferredAsyncLoop(){this.renderDeferredAsyncLoop(),requestAnimationFrame(()=>this.startRenderDeferredAsyncLoop())}renderDeferredAsyncLoop(){clearTimeout(this._timerId),this.renderer.render(),this._timerId=window.setTimeout(async()=>{for(this._timerId=void 0;!this._timerId;)await this.renderer.renderAsync()},2e3)}async startInfiniteAsyncRender(){for(;;)await this.renderer.renderAsync()}},Nht=pRe(kRe()),A2e=(o=>(o.model="model",o.obj="obj",o.material="material",o.globalParam="global_param",o.areaLight="area_light",o.log="log",o.cMatrix="c_matrix",o.textureNormal="texture_normal",o.textureMetallic="texture_metallic",o.textureColor="texture_color",o.textureRoughness="texture_roughness",o.camera="camera",o.background="background",o.lut="lut",o))(A2e||{});async function kht(o){let t=await Bht(o),e=Fht(t),r=u=>{let d=e.get(u);return d.length===1?d[0].blob:null},i=await nRe.model(e.get("model")),n=await nRe.material(e.get("material")),s=gw(e.get("log")),a=gw(e.get("texture_normal")),l=gw(e.get("texture_metallic")),c=gw(e.get("texture_color")),h=gw(e.get("texture_roughness"));return{background:gw(e.get("background")),model:i,camera:r("camera"),material:n,globalParam:r("global_param"),log:s,textureNormal:a,textureMetallic:l,textureColor:c,textureRoughness:h,light:r("area_light"),lut:gw(e.get("lut"))}}var nRe=class{static async model(o){if(o.length!==1)throw new Error;let{blob:t}=o[0],e=await t.text(),r=JSON.parse(e);return{text:e,...r}}static async camera(o){if(o.length===0||o===void 0)return null;if(o.length!==1)throw new Error;let{blob:t}=o[0];return{txt:await t.text()}}static async material(o){if(o===void 0||o.length===0)return null;if(o.length!==1)throw new Error;let{blob:t}=o[0];return{data:await t.text()}}};async function Bht(o){let t=await new Nht.default().loadAsync(o),e=[];t.forEach((i,n)=>{if(n.dir)return;let s=a();if(!s)return;e.push({name:l(),type:s,blob:n.async("blob")});function a(){let c=Object.entries(A2e).map(h=>h[1]);if(c=c.filter(h=>i.includes(h)),c.length!==0){if(c.length===1)return c[0];throw new Error}}function l(){let c="";for(let h=i.length-1;h>=0&&i[h]!=="/";h--)c+=i[h];return c=Array.from(c).reverse().join(""),c}});let r=[];for(let{type:i,name:n,blob:s}of e)r.push({type:i,name:n,blob:await s});return r}function gw(o){return o?{files:o,defaultFile:o[0],fileNames:o.map(t=>t.name)}:void 0}function Fht(o){let t=new Map;for(let{type:e,name:r,blob:i}of o)t.has(e)?t.get(e).push({name:r,blob:i}):t.set(e,[{name:r,blob:i}]);return t}var Vht=class cMe{constructor(t){this.txt=t}static async build(t){return new cMe(await t.text())}anasync(){this.downloadIds();let t=this.getMtlSources(!0).map(Hht).flat().flat(),e=[],r=[];for(let n of t){let{a:s,d:a,s:l}=n;s.equals(a)&&l.r===s.r/2&&l.g===s.g/2&&l.b===s.b/2?e.push(n):r.push(n)}let i={unExpect:r,expectRation:e.length/t.length};debugger}anasync2(){}getMtlSources(t=!1){return t?MLe(this.getMtlSources()):JSON.parse(this.txt).map(e=>e[1])}downloadIds(){let t=Uht.decode(this.txt),e=new Map;t.forEach(s=>{s.materials.forEach(a=>{e.has(a.hash)?e.get(a.hash).add(s.id):e.set(a.hash,new Set().add(s.id))})});let r=HH(e,s=>s.size);t.forEach(s=>s.setWight(r)),t.sort((s,a)=>a.wight-s.wight);let i=t.map(s=>s.id),n=new Blob([JSON.stringify(i)]);MZ.downloadFile("ids.mlib",n)}},Ght=class{constructor(o,t){this.id=o,this.materials=JSON.parse(t).map(e=>({mtl:_Le.decode(e),hash:e}))}setWight(o){let t=0;this.materials.forEach(e=>{t+=o.get(e.hash)}),this.wight=t}},Uht={encode:function(o){return JSON.stringify(o.map(t=>JSON.stringify({id:t.id,materila:JSON.stringify(t.materials.map(e=>_Le.encode(e.mtl)))})))},decode:function(o){return JSON.parse(o).map(t=>{let{id:e,materialsSourece:r}=JSON.parse(t);return new Ght(e,r)})}};function Hht(o){let t=[""];for(let e=0;e<o.length;e++)o[e]==="}"&&o[e+1]==="{"?(t[t.length-1]+=o[e],t.push("")):t[t.length-1]+=o[e];return t.pop(),t.map(Wht)}function Wht(o){let{a:t,d:e,s:r}=JSON.parse(o);return{a:Du.decode(t),d:Du.decode(e),s:Du.decode(r)}}var zht=class hMe{constructor(t,e){this.gpu=t,this.kitsuneCamera=e,this.diffParam=new pht,this.ids=[]}static async build(t){await new Promise(r=>setTimeout(r,1e3));let e=await Dwe.build();return this.build1(e,t)}static async build1(t,e){return await this.compileShader(t),await this.warmPathTracing(t,{width:e.getWidth(),height:e.getHeight()}),new hMe(t,e)}static async compileShader(t){await QE.compileAll(t.device)}static async warmPathTracing(t,e){await E2e.warm(t,e)}isBuild(){return this.renderer!==void 0}getCameraRotateTarget(){return this.camera.getRotateTarget()}getLight(){return this.light}getModelBBox(){return this.model.obj.getBBox()}getBBox(){let t=this.light.getBBox(),e=this.getModelBBox(),r=new mm;return r.ext4(t),r.ext4(e),r.build()}render(){this.renderer.getRaytracer().render()}resetCamera(){this.camera.reset()}getTextureList(t){if(!this.isBuild())return[];let e=this.model.material.registrar.textureRegister;switch(t){case"background_texture":return this.background.getTextureNames();case"material_normal_texture":return e.getTextureNames(0);case"material_metallic_texture":return e.getTextureNames(1);case"material_color_texture":return e.getTextureNames(2);case"material_roughness_texture":return e.getTextureNames(3);case"diffuse_mode":return jZ.all();case"area_light_name":return this.light.getAll();case"lut_name":return this.renderer.getRaytracer().getLut().all();case"model_id":return this.ids.slice(0,20);default:throw new Error}}setGlobalParam(t){if(!this.isBuild())return;let e=this.diffParam.diff(t),{backgroundTexture:r,backgroundRotation:i,backgroundIntensity:n,backgroundColor:s,backgroundUseColor:a,occluderPosition:l,occluderWidth:c,occluderHeight:h,occluderColor:u,occluderVisible:d,rendererMaxSample:p,rendererEnableDenoise:m,hideBoard:g,hideOccluder:y,hidePCB:b,hideOBJ:P,hideLight:T,hideCoordinate:I,lightIsOpen:C,displayDevice:E,viewTransform:O,renderMode:_,apertureSize:x,flangeFocalDistance:v,focalLength:D,maxRayBounces:w,diffuseMode:F,lutName:H}=e;m!==void 0&&this.renderer.getRaytracer().setEnableDenoise(m),p!==void 0&&this.renderer.getRaytracer().setMaxSampleCount(p),d!==void 0&&this.model.occluder.setVisible(d),u!==void 0&&this.model.occluder.setColor(u),l!==void 0&&this.model.occluder.setPosition(l),c!==void 0&&this.model.occluder.setWidth(c),h!==void 0&&this.model.occluder.setHeight(h),E!==void 0&&this.renderer.getRaytracer().getDraw().prameter.setDisplayDevice(E),O!==void 0&&this.renderer.getRaytracer().getDraw().prameter.setViewTransform(O),C!==void 0&&this.light.setIsOpen(C),a!==void 0&&this.background.setUseColor(a),s!==void 0&&this.background.setColor(s),n!==void 0&&this.background.setIntensity(n),i!==void 0&&this.background.setRotation(i),r!=null&&this.background.setTexture(r),_!==void 0&&(this.loopRender.renderMode=_),x!==void 0&&this.kitsuneCamera.setApertureSize(x),v!==void 0&&this.kitsuneCamera.setFlangeFocalDistance(v),D!==void 0&&this.kitsuneCamera.setFocalLength(D),w!==void 0&&this.renderer.getRaytracer().getPathTracing().getParameter().setMaxRayBounces(w),F!==void 0&&(this.renderer.getRaytracer().getPathTracing().getParameter().diffuseMode=jZ.get(F),this.renderer.getRaytracer().setReset()),g!==void 0&&(this.renderer.getRaytracer().getPathTracing().getParameter().hideBoard=g),y!==void 0&&(this.renderer.getRaytracer().getPathTracing().getParameter().hideOccluder=y),b!==void 0&&(this.renderer.getRaytracer().getPathTracing().getParameter().hidePCB=b),P!==void 0&&(this.renderer.getRaytracer().getPathTracing().getParameter().hideOBJ=P),T!==void 0&&(this.renderer.getRaytracer().getPathTracing().getParameter().hideLight=T),I!==void 0&&(this.renderer.getRaytracer().getPathTracing().getParameter().hideCoordinate=I),H!==void 0&&this.renderer.getRaytracer().getLut().use(H),this.renderer.getRaytracer().setReset()}getGlobalParam(){return{backgroundTexture:this.background.getTextureName(),backgroundIntensity:this.background.getIntensity(),backgroundRotation:this.background.getRotatoin(),backgroundColor:this.background.getColor(),backgroundUseColor:this.background.isUseColor(),occluderColor:this.model.occluder.getColor(),occluderPosition:this.model.occluder.getPosition(),occluderWidth:this.model.occluder.getWidth(),occluderHeight:this.model.occluder.getHeight(),occluderVisible:this.model.occluder.getVisible(),rendererMaxSample:this.renderer.getRaytracer().getMaxSampleCount(),rendererEnableDenoise:this.renderer.getRaytracer().getEnableDenoise(),hideBoard:this.renderer.getRaytracer().getPathTracing().getParameter().hideBoard,hideOccluder:this.renderer.getRaytracer().getPathTracing().getParameter().hideOccluder,hidePCB:this.renderer.getRaytracer().getPathTracing().getParameter().hidePCB,hideOBJ:this.renderer.getRaytracer().getPathTracing().getParameter().hideOBJ,hideLight:this.renderer.getRaytracer().getPathTracing().getParameter().hideLight,hideCoordinate:this.renderer.getRaytracer().getPathTracing().getParameter().hideCoordinate,renderMode:"pinhole",apertureSize:this.kitsuneCamera.getApertureSize(),flangeFocalDistance:this.kitsuneCamera.getFlangeFocalDistance(),focalLength:this.kitsuneCamera.getFocalLength(),maxRayBounces:this.renderer.getRaytracer().getPathTracing().getParameter().maxRayBounces,diffuseMode:this.renderer.getRaytracer().getPathTracing().getParameter().diffuseMode[0],lightIsOpen:this.light.getIsOpen(),displayDevice:this.renderer.getRaytracer().getDraw().prameter.getDisplayDevice(),viewTransform:this.renderer.getRaytracer().getDraw().prameter.getViewTransform(),lutName:this.renderer.getRaytracer().getLut().getUser()}}setMaterial(t,e){this.model.material.modify(t,e)}async addTextureList(t,e){if(!this.isBuild())return;let r=this.model.material.registrar.textureRegister;switch(t){case"background_texture":return this.background.addTexture(e);case"material_normal_texture":await r.add(0,e);return;case"material_metallic_texture":await r.add(1,e);return;case"material_color_texture":await r.add(2,e);return;case"material_roughness_texture":await r.add(3,e);return;case"lut_name":return await this.renderer.getRaytracer().getLut().add(e);default:throw new Error}}async getZip(t=Dt.ORIGIN){let e=new ynt.default;{let r=(n,s)=>{e.file(n+".txt",s)},i=A2e;r(i.camera,this.camera.getBlob(t)),r(i.model,await this.model.getBlob()),r(i.material,this.model.material.getBlob()),r(i.globalParam,hht(this.getGlobalParam())),r(i.areaLight,this.light.getBlob())}{this.renderer.getRaytracer().getLut().all2().forEach(r=>{e.file("lut/"+r.name,r)}),this.background.getCache().forEach(({name:r,blob:i})=>{e.file("background/"+r,i)}),this.model.board.getBlob((r,i)=>{e.file("log/"+r,i)});{let r=this.model.material.registrar.textureRegister,i=this.model.material.table.getUserTextures();r.getTexture(2).filter(({name:n})=>i.has(n)).forEach(({name:n,blob:s})=>{e.file("texture_color/"+n,s)}),r.getTexture(1).filter(({name:n})=>i.has(n)).forEach(({name:n,blob:s})=>{e.file("texture_metallic/"+n,s)}),r.getTexture(0).filter(({name:n})=>i.has(n)).forEach(({name:n,blob:s})=>{e.file("texture_normal/"+n,s)}),r.getTexture(3).filter(({name:n})=>i.has(n)).forEach(({name:n,blob:s})=>{e.file("texture_roughness/"+n,s)})}}return await e.generateAsync({type:"blob"})}async autoFocus(t,e){let r=this.kitsuneCamera.getScreenPointToRay(t,e);this.camera.modifyCilkDirection(r);let{depth:i}=await this.renderer.getRaytracer().hitFace();this.kitsuneCamera.autoFcous(i)}async gitRayHitInfo(t,e){let r=this.kitsuneCamera.getScreenPointToRay(t,e);this.camera.modifyCilkDirection(r);let i=await this.renderer.getRaytracer().hitFace();if(!i.depth)return null;let n=i.materialIndex;return i.depth?{material:this.model.material.getPBR(n),materialId:n,isLightSource:i.isLight}:{material:this.model.material.getPBR(n),materialId:n,isLightSource:i.isLight}}async buildByFile(t){let e=NLe(t);switch(wC.log(`build by ${e} type file.`),e){case"obj":return await this.buildByOBJFile(t);case"zip":return await this.buildByZipFile(t);case"csv":return await this.buildByCSV(t);case"txt":return await this.buildByTxt(t);case"mlib":return await this.buildByMlib(t);default:throw new Error}}async setIDS(t){let e=this.ids[t-1],r=Zxe(e),i=await M1e(r),{obj:n,mtl:s}=Jxe(i);this.model.material.clear(),await this.model.obj.update(n,s),this.renderer.getRaytracer().getPathTracing().rebind(),this.renderer.getRaytracer().setReset(),this.camera.setObjectByBBox3(this.model.obj.getBBox())}async buildByMlib(t){let e=await t.text(),r=JSON.parse(e);this.ids=r;let i=r[0],n=Zxe(i),s=await M1e(n),{obj:a,mtl:l}=Jxe(s),c=await h(this.kitsuneCamera,this.gpu);await this.build(c),this.setGlobalParam({hideBoard:!0,hideLight:!0,hidePCB:!0,hideOccluder:!0,lightIsOpen:!1,hideCoordinate:!1}),this.loopRender=new k1e(this.renderer),this.loopRender.renderMode="pinhole",this.loopRender.startInfiniteAsyncRender();async function h(u,d){let p=N1e(d,u.getCanvas());return{gpu:d,context:p,model:{obj:{obj:a,mtl:l}},camera:{camera:u},light:void 0,globalParam:void 0,background:void 0}}}async buildByTxt(t){(await Vht.build(t)).anasync()}async buildByKitsune(t,e){let r={gpu:this.gpu,context:e,model:{pcb:await Nct(t.pcb),obj:t.obj},camera:{camera:this.kitsuneCamera},light:void 0,globalParam:void 0,background:void 0};await this.build(r)}async buildByCSV(t){let e=await this.getCSVURLs(t),r=[];for(let n=0,s=e.length,a=new jct(s);n<s;n++){let l=await M1e(e[n]),c=new ULe(l).getMaterialString();r.push(c),a.increment()}console.log(r.length);let i=jht(r);console.log("material",r.length),console.log("dedup material",i.length);debugger}async getCSVURLs(t){let e=await t.text(),r=Xht(e);return r=MLe(r),r.map(i=>"https://modules.lceda.cn/3dmodel/"+i)}async buildByZipFile(t){let e=await r(this.kitsuneCamera,this.gpu);await this.build(e),this.loopRender=new k1e(this.renderer),this.loopRender.renderMode="pinhole",this.loopRender.startInfiniteAsyncRender(),e.globalParam&&this.setGlobalParam(e.globalParam);async function r(i,n){var s;let a=async()=>{let d=vLe.destring(l.model.pcb),p={scale:d?3.93701:void 0,...WLe.destring(l.model.obj)},m=l.log?{blob:l.log.defaultFile.blob,hide:!1}:void 0,g={hide:!0},y={table:ALe.decode(l.material.data),metallic:l.textureMetallic?l.textureMetallic.files:[],normal:l.textureNormal?l.textureNormal.files:[],color:l.textureColor?l.textureColor.files:[],roughness:l.textureRoughness?l.textureRoughness.files:[]};return{pcb:d,obj:p,board:m,occluder:g,material:y}},l=await kht(t),c=N1e(n,i.getCanvas()),h=await a(),u=l.light;return{camera:{camera:i,config:l.camera},context:c,gpu:n,model:h,light:u,background:(s=l.background)==null?void 0:s.files,globalParam:l.globalParam?await uht(l.globalParam):null,lut:l.lut?l.lut.files.map(d=>new File([d.blob],d.name)):[]}}}async buildByOBJFile(t){let e=await r(this.kitsuneCamera,this.gpu);await this.build(e),this.setGlobalParam({hideBoard:!0,hideLight:!0,hidePCB:!0,hideOccluder:!0,lightIsOpen:!1,hideCoordinate:!1}),this.loopRender=new k1e(this.renderer),this.loopRender.renderMode="pinhole",this.loopRender.startInfiniteAsyncRender();async function r(i,n){let s=N1e(n,i.getCanvas());return{gpu:n,context:s,model:{obj:{obj:await t.text()}},camera:{camera:i},light:void 0,globalParam:void 0,background:void 0}}}async build(t){wC.log("init editor scene."),wC.time("init");let{gpu:e,context:r}=t;this.camera=await hct.build(e,t.camera),this.model=await cht.build(e,this.camera,t.model),this.light=await $ct.build(e,t.light),this.background=await sct.build(e,t.background),this.renderer=await Mht.build(e,this.camera,this.light,this.model,this.background,r,t),wC.log("init over."),wC.timeEnd("init")}};function Yht(o){let t=new Map;return o.forEach(e=>{t.has(e)?t.set(e,t.get(e)+1):t.set(e,1)}),t}function jht(o){let t=Yht(o);return Array.from(t).sort((e,r)=>r[1]-e[1])}function Xht(o){let t=[],e=/"([^"]*)"/g,r;for(;(r=e.exec(o))!==null;)t.push(r[1]);return t}var oRe="struct O_a { O_b : mat4x4 < f32 > , O_c : mat4x4 < f32 > , O_d : mat4x4 < f32 > , O_e : vec3 < f32 > , O_f : f32 , O_g : vec3 < f32 > , O_h : f32 , O_i : f32 , O_j : f32 , O_k : f32 , O_l : f32 , } struct O_m { O_n : mat3x2 < f32 > , O_o : f32 , O_p : f32 , O_q : f32 , O_r : f32 , O_s : f32 , O_t : f32 , } struct O_u { O_n : mat3x2 < f32 > , O_r : f32 , O_v : f32 , } struct O_w { O_x : f32 , O_y : f32 , O_z : f32 , O_aa : f32 , O_ab : f32 , O_ac : f32 , O_ad : f32 , } struct O_ae { O_p : f32 , O_af : f32 , O_ag : f32 , O_ah : f32 , O_ai : f32 , O_aj : f32 , O_ak : f32 , } struct O_al { O_am : vec3 < f32 > , O_an : vec3 < f32 > , } struct O_ao { O_n : mat4x4 < f32 > , O_ap : vec4 < f32 > , O_aq : vec3 < f32 > , O_ar : vec3 < f32 > , O_as : vec3 < f32 > , O_at : vec3 < f32 > , O_au : vec3 < f32 > , O_av : vec3 < f32 > , O_aw : f32 , O_ax : f32 , O_ad : f32 , @ align ( 16 ) O_ay : vec3 < f32 > , } @ binding ( 0 ) @ group ( 0 ) var < uniform > O_az : O_a ; @ binding ( 1 ) @ group ( 0 ) var < uniform > O_ba : O_ao ; struct O_bb { @ builtin ( position ) O_bc : vec4 < f32 > , @ location ( 0 ) O_am : vec3 < f32 > , @ location ( 1 ) O_an : vec3 < f32 > , } struct O_bd { @ location ( 0 ) O_ap : vec4 < f32 > , } @ vertex fn v_main ( @ builtin ( vertex_index ) O_be : u32 , @ location ( 0 ) O_bf : vec3 < f32 > , @ location ( 1 ) O_am : vec3 < f32 > , ) -> O_bb { var O_bg : O_bb ; if ( O_ba . O_ad == 2 ) { let O_n = O_az . O_c * O_ba . O_n ; O_bg . O_am = mat3x3 ( vec3 ( O_n [ 0 ] . xyz ) , vec3 ( O_n [ 1 ] . xyz ) , vec3 ( O_n [ 2 ] . xyz ) ) * O_am ; let O_e = O_n * vec4 ( O_bf , 1 ) ; O_bg . O_an = - O_e . xyz / O_e . w ; } O_bg . O_bc = O_az . O_b * O_ba . O_n * vec4 ( O_bf , 1 ) ; O_bg . O_bc . x += O_ba . O_ay . x * O_bg . O_bc . w ; O_bg . O_bc . y += O_ba . O_ay . y * O_bg . O_bc . w ; O_bg . O_bc . z += O_ba . O_ay . z * O_bg . O_bc . w ; return O_bg ; } @ fragment fn f_main ( @ location ( 0 ) O_am : vec3 < f32 > , @ location ( 1 ) O_an : vec3 < f32 > , ) -> O_bd { var O_bg : O_bd ; if ( O_ba . O_ad == 0 ) { O_bg . O_ap = O_ba . O_ap ; return O_bg ; } let O_aq : vec3 < f32 > = O_ba . O_aq ; let O_ar : vec3 < f32 > = O_ba . O_ar ; let O_as : vec3 < f32 > = O_ba . O_as ; var O_bh = O_aq * O_ba . O_at ; var O_bi = normalize ( O_am ) ; var O_av = O_ba . O_av ; var O_bj = abs ( dot ( O_bi , O_av ) ) * O_ar * O_ba . O_au ; var O_bk = - 2.0 * O_bi * dot ( O_av , O_bi ) + O_av ; var O_bl = normalize ( O_an ) ; var O_bm = abs ( dot ( O_bk , O_bl ) ) ; var O_bn = O_as * O_ba . O_au * pow ( O_bm , 300.0 ) * O_ba . O_aw * 0.1 ; O_bg . O_ap = vec4 ( O_bh + O_bj + O_bn , O_ba . O_ax ) ; return O_bg ; } ",sRe=56,qht=class{constructor(o){this.positionVertexStrideLen=3,this.normalVertexStrideLen=3,this.viewOffsetZ=0,this.scene=o,this.gpu=o.gpu,this.device=o.gpu.device,this.linePipeline=this.createPipeline("line"),this.trianglePipeline=this.createPipeline("triangle"),this.desc=this.createRenderDesc(),this.uniformBuffer=o.gpu.createDynamicBuffer(sRe,GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,"uniformBuffer of meshProgramGPU"),this.lineBindGroup=this.createBindGroup("line"),this.triangleBindGroup=this.createBindGroup("triangle")}createPipeline(o){return this.device.createRenderPipeline({layout:"auto",vertex:{module:this.gpu.createShaderModule(oRe),entryPoint:"v_main",buffers:[{arrayStride:this.positionVertexStrideLen*rs,attributes:[{shaderLocation:0,offset:0,format:"float32x3"}]},{arrayStride:this.normalVertexStrideLen*rs,attributes:[{shaderLocation:1,offset:0,format:"float32x3"}]}]},fragment:{module:this.gpu.createShaderModule(oRe),entryPoint:"f_main",targets:[{format:_a,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:o==="line"?"line-list":"triangle-list"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater",format:J2}})}createRenderDesc(){return{colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"}}}createBindGroup(o){return this.gpu.createDynamicBindGroup(o==="line"?this.linePipeline.getBindGroupLayout(0):this.trianglePipeline.getBindGroupLayout(0),0,this.scene.cameraBuf,1,this.uniformBuffer)}setViewOffsetZ(o=0){this.viewOffsetZ=o}render(o,t,e,r,i,n,s=ee.BLACK){let a;i instanceof RQe?e===1?a="line":a="triangle":i instanceof xQe&&(a="line"),this.desc.colorAttachments[0].view=o.colorTexture.view,this.desc.depthStencilAttachment.view=o.depthStencilTexture.view;let l=new Float32Array(sRe);if(l.set(r.data),l.set(s.getData(),16),n){l.set(n.ambient.getData(),20),l.set(n.diffuse.getData(),24),l.set(n.specular.getData(),28),l.set(this.scene.ambientLight.color.getData(),32),l.set(this.scene.directionalLight.color.getData(),36);let u=this.scene.directionalLight.direction();l.set([u.x,u.y,u.z],40),l[43]=n.shininess,l[44]=n.alpha}l[45]=e;let c=this.scene.getViewOffset();l.set([c.x,c.y,this.viewOffsetZ],48),this.scene.addData(new Uint32Array(l.buffer),this.uniformBuffer);let h=this.scene.commandEncoder.beginRenderPass(this.desc);h.setPipeline(a==="line"?this.linePipeline:this.trianglePipeline),h.setBindGroup(0,a==="line"?this.lineBindGroup.getBindGroup():this.triangleBindGroup.getBindGroup()),h.setVertexBuffer(0,i.getVertexBuf(t.gpu).getBuffer()),h.setVertexBuffer(1,i.getNormalsBuf(t.gpu).getBuffer()),h.draw(i.vertexNum),h.end()}},aRe="struct O_a { O_b : mat4x4 < f32 > , O_c : mat4x4 < f32 > , O_d : mat4x4 < f32 > , O_e : vec3 < f32 > , O_f : f32 , O_g : vec3 < f32 > , O_h : f32 , O_i : f32 , O_j : f32 , O_k : f32 , O_l : f32 , } struct O_m { O_n : mat3x2 < f32 > , O_o : f32 , O_p : f32 , O_q : f32 , O_r : f32 , O_s : f32 , O_t : f32 , } struct O_u { O_n : mat3x2 < f32 > , O_r : f32 , O_v : f32 , } struct O_w { O_x : f32 , O_y : f32 , O_z : f32 , O_aa : f32 , O_ab : f32 , O_ac : f32 , O_ad : f32 , } struct O_ae { O_p : f32 , O_af : f32 , O_ag : f32 , O_ah : f32 , O_ai : f32 , O_aj : f32 , O_ak : f32 , } struct O_al { O_am : vec3 < f32 > , O_an : vec3 < f32 > , } struct O_ao { O_n : mat4x4 < f32 > , O_ap : vec4 < f32 > , O_aq : vec3 < f32 > , O_ar : vec3 < f32 > , O_as : vec3 < f32 > , O_at : vec3 < f32 > , O_au : vec3 < f32 > , O_av : vec3 < f32 > , O_aw : f32 , O_ax : f32 , O_ad : f32 , @ align ( 16 ) O_ay : vec3 < f32 > , O_az : vec2 < f32 > , O_k : f32 , O_l : f32 , } @ group ( 0 ) @ binding ( 0 ) var < uniform > O_ba : O_a ; @ group ( 0 ) @ binding ( 1 ) var < uniform > O_bb : O_ao ; struct O_bc { @ builtin ( position ) O_bd : vec4 < f32 > , @ location ( 0 ) O_am : vec3 < f32 > , @ location ( 1 ) O_an : vec3 < f32 > , } struct O_be { @ location ( 0 ) O_ap : vec4 < f32 > , } @ vertex fn v_main ( @ builtin ( vertex_index ) O_bf : u32 , ) -> O_bc { var O_bg : O_bc ; var O_bh : vec2f ; let O_bi = O_bb . O_l / 2 ; let O_bj = O_bb . O_az + vec2 ( 0 , - O_bi ) ; let O_bk = O_bb . O_az + vec2 ( O_bb . O_k , - O_bi ) ; let O_bl = normalize ( O_bk - O_bj ) ; let O_bm = vec2 ( - O_bl . y , O_bl . x ) ; let O_bn = O_bm * O_bi ; if ( O_bf == 0 || O_bf == 5 ) { O_bh = O_bj - O_bn ; } else if ( O_bf == 1 ) { O_bh = O_bk - O_bn ; } else if ( O_bf == 2 || O_bf == 3 ) { O_bh = O_bk + O_bn ; } else if ( O_bf == 4 ) { O_bh = O_bb . O_az ; } if ( O_bb . O_ad == 2 ) { let O_n = O_ba . O_c * O_bb . O_n ; O_bg . O_am = mat3x3 ( vec3 ( O_n [ 0 ] . xyz ) , vec3 ( O_n [ 1 ] . xyz ) , vec3 ( O_n [ 2 ] . xyz ) ) * vec3 < f32 > ( 0 , 0 , 1 ) ; let O_e = O_n * vec4 ( O_bh . xy , 0 , 1 ) ; O_bg . O_an = - O_e . xyz / O_e . w ; } O_bg . O_bd = O_ba . O_b * O_bb . O_n * vec4 ( O_bh . xy , 0 , 1 ) ; let O_bo = O_bb . O_ay * O_bg . O_bd . w ; O_bg . O_bd . x += O_bo . x ; O_bg . O_bd . y += O_bo . y ; return O_bg ; } @ fragment fn f_main ( @ location ( 0 ) O_am : vec3 < f32 > , @ location ( 1 ) O_an : vec3 < f32 > , ) -> O_be { var O_bg : O_be ; if ( O_bb . O_ad == 0 ) { O_bg . O_ap = O_bb . O_ap ; return O_bg ; } let O_aq : vec3 < f32 > = O_bb . O_aq ; let O_ar : vec3 < f32 > = O_bb . O_ar ; let O_as : vec3 < f32 > = O_bb . O_as ; var O_bp = O_aq * O_bb . O_at ; var O_bq = normalize ( O_am ) ; var O_av = O_bb . O_av ; var O_br = abs ( dot ( O_bq , O_av ) ) * O_ar * O_bb . O_au ; var O_bs = - 2.0 * O_bq * dot ( O_av , O_bq ) + O_av ; var O_bt = normalize ( O_an ) ; var O_bu = abs ( dot ( O_bs , O_bt ) ) ; var O_bv = O_as * O_bb . O_au * pow ( O_bu , 300.0 ) * O_bb . O_aw * 0.1 ; O_bg . O_ap = vec4 ( O_bp + O_br + O_bv , O_bb . O_ax ) ; return O_bg ; } ",lRe=64,$ht=class{constructor(o){this.scene=o,this.gpu=o.gpu,this.device=o.gpu.device,this.pipeline=this.createPipeline(),this.desc=this.createRenderDesc(),this.uniformBuffer=o.gpu.createDynamicBuffer(lRe,GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,"uniformBuffer of drawColorUseStencil"),this.bindGroup=this.createBindGroup()}createPipeline(){return this.device.createRenderPipeline({layout:"auto",vertex:{module:this.gpu.createShaderModule(aRe),entryPoint:"v_main"},fragment:{module:this.gpu.createShaderModule(aRe),entryPoint:"f_main",targets:[{format:_a,blend:{color:{operation:"add",srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{operation:"add",srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"},depthStencil:{depthWriteEnabled:!0,depthCompare:"always",stencilWriteMask:255,stencilReadMask:255,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"},format:J2}})}createRenderDesc(){return{colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"}}}createBindGroup(){return this.gpu.createDynamicBindGroup(this.pipeline.getBindGroupLayout(0),0,this.scene.cameraBuf,1,this.uniformBuffer)}render(o,t,e,r,i=ee.BLACK,n){let s=n.toBBox2();this.desc.colorAttachments[0].view=o.colorTexture.view,this.desc.depthStencilAttachment.view=o.depthStencilTexture.view;let a=new Float32Array(lRe);if(a.set(e.data),a.set(i.getData(),16),r){a.set(r.ambient.getData(),20),a.set(r.diffuse.getData(),24),a.set(r.specular.getData(),28),a.set(this.scene.ambientLight.color.getData(),32),a.set(this.scene.directionalLight.color.getData(),36);let h=this.scene.directionalLight.direction();a.set([h.x,h.y,h.z],40),a[43]=r.shininess,a[44]=r.alpha}a[45]=t;let l=this.scene.getViewOffset();a.set([l.x,l.y],48),a.set([s.UL().x,s.UL().y,s.width(),s.height()],52),this.scene.addData(new Uint32Array(a.buffer),this.uniformBuffer);let c=this.scene.commandEncoder.beginRenderPass(this.desc);c.setStencilReference(64),c.setPipeline(this.pipeline),c.setBindGroup(0,this.bindGroup.getBindGroup()),c.draw(6),c.end()}},Kht="@ vertex fn fullVert ( @ builtin ( vertex_index ) O_a : u32 , ) -> @ builtin ( position ) vec4 < f32 > { var O_b = array < vec2 < f32 > , 6 > ( vec2 < f32 > ( 1.0 , 1.0 ) , vec2 < f32 > ( 1.0 , - 1.0 ) , vec2 < f32 > ( - 1.0 , - 1.0 ) , vec2 < f32 > ( 1.0 , 1.0 ) , vec2 < f32 > ( - 1.0 , - 1.0 ) , vec2 < f32 > ( - 1.0 , 1.0 ) ) ; return vec4 < f32 > ( O_b [ O_a ] , 0.5 , 1.0 ) ; } @ fragment fn fullFrag ( ) -> @ location ( 0 ) vec4 < f32 > { return vec4 ( 1 , 0 , 0 , 1 ) ; } ",Zht=class{constructor(o){this.equalPipelineIndex={},this.notEqualPipelineIndex={},this.scene=o;let t=o.gpu;this.gpu=t,this.desc={colorAttachments:[],depthStencilAttachment:{view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"}},this.module=this.gpu.createShaderModule(Kht)}getPipeline(o,t){let e=t?this.equalPipelineIndex:this.notEqualPipelineIndex;return e[o]||(e[o]=this.gpu.device.createRenderPipeline({layout:"auto",vertex:{module:this.module,entryPoint:"fullVert"},primitive:{topology:"triangle-list"},depthStencil:{format:J2,depthWriteEnabled:!1,depthCompare:"always",stencilWriteMask:255,stencilReadMask:o,stencilFront:{compare:t?"equal":"not-equal",passOp:"replace"},stencilBack:{compare:t?"equal":"not-equal",passOp:"replace"}}})),e[o]}draw(o,t,e,r){this.desc.depthStencilAttachment.view=o.depthStencilTexture.view;let i=this.scene.commandEncoder.beginRenderPass(this.desc);i.setPipeline(this.getPipeline(r,t)),i.setStencilReference(e),i.draw(6),i.end()}},IZ=1,cRe,LZ=class Aye extends Swe{constructor(t,e,r,i=!0,n=!1,s){if(super(),this.planeIdBitmap=new Xm(het),this.dataU=new Uint32Array(2**20),this.dataOffset=0,this.normalPlanes=[],this.colorMap=new fwe,this.staticPolygonInfoMap=new Xm(32),this.stringInfoMap=new Map,this.sdfStringInfoMap=new Map,this.sdfStringIndexAndNumMap=new Map,this.sdfStringIndexWidthMap=new Map,this.planes=[],this.m_nRecordRenderMode=this.getRenderMode(),this.forceRender=!1,this.numGrids=new Array(m2e).fill(0).map(()=>new Map),this.logFps=!1,this._processDefaultBlockData=!1,this.colors=[],this.isMac=((cRe=navigator.platform)==null?void 0:cRe.toUpperCase().indexOf("MAC"))>=0||navigator.userAgent.indexOf("Macintosh")>=0||navigator.userAgent.indexOf("Mac OS X")>=0,this.isResize=!1,this.renderI=0,this.viewOffset=S.ORIGIN,this.instantiationTime=performance.now(),this.renderPtNum=0,this.renderVertexNum=0,this.drawTimes=0,this.drawTemplateToTargetTimes=0,this.renderPtTypeNum=Array(69).fill(0),this.isWaitingRender=!1,this.gpuTimes=new Float64Array(10),this.cpuTimes=new Float64Array(10),this.gpuTimeI=0,this.cpuTimeI=0,this.renderTimes=0,this.startTime=performance.now(),XRe("gpu"),this.MIN_WH=q1.getMinRenderGridWH()||2**5,this.commandEncoder=t.device.createCommandEncoder(),this.logFps=q1.useLogFps(),this.useGridAccelerate=i,this.useProxy=n,this.char=new Jit(t),this.gpu=t,this.texturePool=new snt(t),this.planeIdBitmap.markUsed(0),this.sceneType=r,this.renderColorTexture=t.createDynamicTexture(1,1,_a,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_SRC,"renderTexture of Scene"),this.highLightColorTexture0=t.createDynamicTexture(1,1,_a,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_SRC,"highLightRenderTexture0 of Scene"),this.highLightColorTexture1=t.createDynamicTexture(1,1,_a,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_SRC,"highLightRenderTexture1 of Scene"),this.depthStencilTexture=t.createDynamicTexture(1,1,J2,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING,"depthStencilTexture of Scene"),this.cameraBuf=this.gpu.createDynamicBuffer(Lwe,GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,"cameraBuf of Scene"),this.dataBuf=this.gpu.createDynamicBuffer(this.dataU.length,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"dataBuf of Scene"),this.colorsBuf=this.gpu.createDynamicBuffer(4,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"colorsBuf of Scene"),this.staticPolygonInfoBuilder=ym.create(Float32Array,t,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"staticPolygonInfoBuf of Scene"),this.staticPolygonInfoBuilder.setArr(new Float32Array(sd),0),this.stringInfoBuilder=ym.create(Uint32Array,t,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"stringInfoBuf of Scene"),this.sdfStringInfoBuilder=ym.create(Float32Array,t,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,"sdfStringInfoBuf of Scene"),this.clearCanvasDesc={colorAttachments:[{view:null,clearValue:{r:this.backgroundColor.r,g:this.backgroundColor.g,b:this.backgroundColor.b,a:this.backgroundColor.alpha},loadOp:"clear",storeOp:"store"},{view:null,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"},{view:null,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}],label:"clearCanvasDesc of Scene"},this.clearStencilDesc={colorAttachments:[],depthStencilAttachment:{view:this.depthStencilTexture.view,depthClearValue:0,depthLoadOp:"load",depthStoreOp:"store",stencilClearValue:64,stencilLoadOp:"clear",stencilStoreOp:"store"},label:"clearStencilDesc of Scene"},this.clearDepthStencilDesc={colorAttachments:[],depthStencilAttachment:{view:this.depthStencilTexture.view,depthClearValue:0,depthLoadOp:"clear",depthStoreOp:"store",stencilClearValue:64,stencilLoadOp:"clear",stencilStoreOp:"store"},label:"clearDepthStencilDesc of Scene"},this.depthStencilTexture.addListener(a=>{this.clearStencilDesc.depthStencilAttachment.view=a,this.clearDepthStencilDesc.depthStencilAttachment.view=a}),this.ptGroup=new $Re(ym.create(Int32Array,t,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.STORAGE,"ptGroup of builder")),this.ptTemplate=new Ewe(ym.create(Float32Array,t,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.STORAGE|GPUBufferUsage.VERTEX,"PtTemplate Data of builder")),this.sdfStringLibrary=new $Qe(this),this.drawStencilProgram=new Zht(this),this.renderPtProgram=new set(this,e.renderPt),this.renderHighLightPtProgram=new nnt(this),this.textureProgram=new Zit(this),this.renderColorProgram=new ont(this),this.rulerProgram=new dnt(this),this.screenAAProgram=new ent(this),this.gridProgram=new fnt(this,1,1,ee.WHITE),this.polarProgram=new gnt(this,1,1,ee.WHITE),aet){let a=document.createElement("button");a.onclick=async()=>{this.render()},a.style.position="absolute",a.innerText="Test",a.style.zIndex="999",a.style.width="200px",a.style.height="50px",a.style.left="50%",document.body.appendChild(a)}this.group=new Q2(3,!0,"scene"),this.highLightGroup0=new Q2(3,!1,"highLightGroup0"),this.highLightGroup1=new Q2(3,!1,"highLightGroup1"),this.measureTooGroup=new Q2(3,!1,"measureTooGroup"),this.sceneType===0&&this.sdfStringLibrary.init(),this.highlightPlane0=this.createHighLightPlane(-.2,0),this.highlightPlane1=this.createHighLightPlane(-.1,1),this.measureToolPlane=this.createMeasureToolPlane(),this.ambientLight=new Awe(ee.build(.1,.1,.1)),this.directionalLight=new _we(ee.build(1,1,1),new Dt(0,0,1)),s&&this.installMessageBus(s),this.meshProgramGPU=new qht(this),this.drawColorUseStencilProgram=new $ht(this)}static async build(t,e,r,i){let n=LC();try{let s=await Dwe.build(),a=await uet(s),l,c=u=>{l=u.error,s.device.removeEventListener("uncapturederror",c)};s.device.addEventListener("uncapturederror",c);let h;if(r?h=new Proxy(new Aye(s,a,t,e,r,i),N_):h=new Aye(s,a,t,e,r,i),await s.device.queue.onSubmittedWorkDone(),n._WEBGPU_DEVICE_LOST_INFO_&&(l=n._WEBGPU_DEVICE_LOST_INFO_),s.device.removeEventListener("uncapturederror",c),l)throw l;return h}catch(s){throw s}}installMessageBus(t){t.rpcService("/engine/scene/setBackgroundColor",e=>{try{this.modifyBgColor(ee.of5(...e))}catch{this.modifyBgColor(ee.of5("#000000",e[1]))}}),t.rpcService("/engine/scene/setCoordSys",e=>{this.isCartesian=e,this.needRender=!0}),t.rpcService("/engine/scene/setGridType",e=>{this.gridProgram.visible=e,this.needRender=!0}),t.rpcService("/engine/scene/setGridPattern",e=>{this.gridProgram.modifyModel(e),this.needRender=!0}),t.rpcService("/engine/scene/setGridColor",e=>{this.gridProgram.modifyColor(ee.of5(...e)),this.needRender=!0}),t.rpcService("/engine/scene/setCoordinateAxisColor",e=>{this.gridParam.coordinateAxisColor=ee.of5(...e),this.gridParam.coordinateAxisTransparency=1-e[1],this.needRender=!0}),t.rpcService("/engine/scene/setGridDelta",e=>{this.gridProgram.setGridX(e[0]),this.gridProgram.setGridY(e[0]),this.needRender=!0}),t.rpcService("/engine/scene/setPolarDelta",e=>{this.polarProgram.angleDelta=Ih.toRadians(e[0]),this.polarProgram.radius=e[1],this.needRender=!0}),t.rpcService("/engine/scene/setPolarRadius",e=>{this.polarProgram.minRadius=e[0],this.polarProgram.maxRadius=e[1],this.needRender=!0}),t.rpcService("/engine/scene/setPolarAngle",e=>{this.polarProgram.startAngle=Ih.toRadians(e[0]),this.polarProgram.endAngle=Ih.toRadians(e[1]),this.needRender=!0}),t.rpcService("/engine/scene/setOpenRuler",e=>{this.openRuler=e}),t.rpcService("/engine/scene/setUnit",e=>{this.modifyUnit(e),this.needRender=!0}),t.rpcService("/engine/scene/setRulerBackgroundColor",e=>{this.setRulerBackgroundColor(ee.build(e[0],e[1],e[2],e[3]))}),t.rpcService("/engine/scene/setRulerStringColor",e=>{this.setRulerStringColor(ee.build(e[0],e[1],e[2],e[3]))}),t.rpcService("/engine/scene/setRulerTextColor",e=>{this.setRulerStringColor(ee.build(e[0],e[1],e[2],e[3]))}),t.rpcService("/engine/scene/getRulerBackgroundColor",()=>this.getRulerBackgroundColor()),t.rpcService("/engine/scene/getRulerStringColor",()=>this.getRulerStringColor()),t.rpcService("/engine/scene/getRulerTextColor",()=>this.getRulerStringColor())}setFpsLogTime(){this.logFps&&(this.submitCommandEncoder(),this.gpu.device.queue.onSubmittedWorkDone().then(()=>{this.gpuTimes[this.gpuTimeI++]+=performance.now()-this.gpuStart,this.gpuStart=performance.now()}),this.cpuTimes[this.cpuTimeI++]+=performance.now()-this.cpuStart,this.cpuStart=performance.now())}set processDefaultBlockData(t){this._processDefaultBlockData=t}get processDefaultBlockData(){return this._processDefaultBlockData}setMask(t,e,r,i){throw new Error("not support")}clearMask(){throw new Error("not support")}getMinWh(){return this.MIN_WH}init(){this.context=this.currentCamera.getCanvas().getContext("webgpu"),this.context.configure({device:this.gpu.device,format:_a,alphaMode:"premultiplied",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST}),window.addEventListener("unload",()=>{this.context.unconfigure()}),this.forceRender=q1.useForceRender(),this.measurePtTool=new gwe(this.measureToolPlane,this.currentCamera,ym.create(Float32Array,this.gpu,GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST|GPUBufferUsage.STORAGE,"measurePtTool of builder")),this.renderRequestAnimationFrame(),this.gridParam.addUpdateListener(()=>{this.needRender=!0})}getUseGridAccelerate(){return this.useGridAccelerate}getUseProxy(){return this.useProxy}createHighLightPlane(t,e){let r=this.planeIdBitmap.findEmpty();this.planeIdBitmap.markUsed(r);let i;return this.getUseProxy()?i=new Proxy(new P9(this,r,ee.DefaultHighLightColor,void 0,"highLight",!1,!0,!0),N_):i=new P9(this,r,ee.DefaultHighLightColor,void 0,"highLight",!1,!0,!0),i.setIsColorful(!0),e===0?(this.highLightGroup0.add(i),this.highLightGroup0.setPosition(new Dt(0,0,t)),this.group.add(this.highLightGroup0)):e===1&&(this.highLightGroup1.add(i),this.highLightGroup1.setPosition(new Dt(0,0,t)),this.group.add(this.highLightGroup1)),this.planes.push(i),i}createMeasureToolPlane(){let t=this.planeIdBitmap.findEmpty();this.planeIdBitmap.markUsed(t);let e;return this.getUseProxy()?e=new Proxy(new P9(this,t,ee.WHITE,void 0,"MeasureTool",!1,!1),N_):e=new P9(this,t,ee.WHITE,void 0,"MeasureTool",!1,!1),e.setIsColorful(!0),this.measureTooGroup.add(e),this.measureTooGroup.setPosition(new Dt(0,0,-.1)),this.group.add(this.measureTooGroup),this.planes.push(e),e}setFillStyleSpacing(t){throw new Error("setFillStyleSpacing not support")}addCamera(t){super.addCamera(t),this.resize(),this.init()}addCamera0(t){t.setScene(this),this.currentCamera=t,this.cameraSet.add(t)}getHighLightPlane(t){if(t==0)return this.highlightPlane0;if(t==1)return this.highlightPlane1;throw new Error("highLightGroupId is incorrect")}addPtGroup(){return this.ptGroup.add()}removePtGroup(t){this.ptGroup.remove(t),this.updateGroupRenderModeRecord(t,0),this.needRender=!0}setPtGroup(t,e,r=!1,i,n=!1,s,a=0){let l=this.getColorIndex(s);this.ptGroup.set(t,e,r,i,n,l,a),this.comparisonAndRecordPtGroupStatus(()=>{},t,e,r,i,n,l,a),this.updateGroupRenderModeRecord(t,a)}createPtTemplateId(){return this.ptTemplate.createTemplateId()}removePtTemplateId(t){let e=this.ptTemplate.getInstanceIds(t);this.planes.forEach(r=>{r.removeTemplate(t,e)}),this.ptTemplate.removeTemplateId(t)}addTemplateInstance(t,e){let r=this.ptTemplate.addTemplateInstance(t,e);return this.planes.forEach(i=>{i.addTemplateInstance(t,r)}),r}removeTemplateInstance(t,e){this.planes.forEach(r=>r.removeTemplateInstance(e)),this.ptTemplate.removeTemplateInstance(t,e)}updateTemplateInstance(t,e,r){this.ptTemplate.updateTemplateInstance(t,e,r),this.planes.forEach(i=>{i.updateTemplateInstance(t,e)})}addStaticPolygonInfo(t,e,r=-1,i=-1,n){let s=this.staticPolygonInfoMap.findEmpty();s===-1&&(this.staticPolygonInfoMap=this.staticPolygonInfoMap.extSize(this.staticPolygonInfoMap.size*2),s=this.staticPolygonInfoMap.findEmpty()),this.staticPolygonInfoMap.markUsed(s);let a=s*sd;return this.staticPolygonInfoBuilder.setArr(new Array(sd).fill(0),a),this.setStaticPolygonInfo(s,n||Ae.ORIGIN),this.staticPolygonInfoBuilder.set(a+6,t||0),this.staticPolygonInfoBuilder.set(a+7,this.getColorIndex(e)||0),this.staticPolygonInfoBuilder.set(a+8,r),this.staticPolygonInfoBuilder.set(a+9,i),s}removeStaticPolygonInfo(t){this.staticPolygonInfoMap.markRemove(t)}setStaticPolygonInfo(t,e){let r=e.data;return this.staticPolygonInfoBuilder.setArr([r[0],r[1],r[4],r[5],r[12],r[13]],t*sd),t*sd}addStringInfo(t){if(!t)return-1;let e=this.stringInfoMap.get(t);return e!==void 0||(e=this.stringInfoBuilder.getLength(),this.stringInfoMap.set(t,e),this.char.createString(t,r=>this.stringInfoBuilder.push(r))),e}recordSdfNum(t,e,r){if(r){if(t!==e){let i=this.sdfStringIndexAndNumMap.get(t);i?i=i+1:i=1,this.sdfStringIndexAndNumMap.set(t,i);let n=this.sdfStringIndexAndNumMap.get(e)-1;this.sdfStringIndexAndNumMap.set(e,n),n<=0&&this.sdfTool.removeSdfStringInfo(e,!0)}}else{let i=this.sdfStringIndexAndNumMap.get(t);i?i=i+1:i=1,this.sdfStringIndexAndNumMap.set(t,i)}}addSdfStringInfo(t,e,r,i){let n=`${t}$${JSON.stringify(e)}`,s=this.sdfStringInfoMap.get(n);if(s!==void 0){this.recordSdfNum(s,r,i);let d=this.sdfStringIndexWidthMap.get(s);return{strIndex:s,fontWidth:d}}s=this.sdfStringInfoBuilder.getLength(),this.sdfStringInfoMap.set(n,s);let{storageBufIndex:a,offset:l,bufWidth:c,bufHeight:h,fontWidth:u}=this.sdfTool.creatSdfTexture(t,e,s);return this.sdfStringInfoBuilder.pushArr([a,l,c,h]),this.recordSdfNum(s,r,i),this.sdfStringIndexWidthMap.set(s,u),{strIndex:s,fontWidth:u}}getColorIndex(t,e=0,r=!1){let i;return!t||!r&&t.r+t.g+t.b===0&&t.alpha===1?i=0:i=this.colorMap.computeIfAbsent(t,()=>{let n=this.colorMap.size()+1;return n*4>=this.colorsBuf.getSize()&&this.colorsBuf.extSize(this.colorsBuf.getSize()*2),this.colorsBuf.write(n*4,new Float32Array([t.r,t.g,t.b,t.alpha])),this.colors[n]=t,n}),(i<<1)+e}releasePlaneId(t){this.planeIdBitmap.markRemove(t);let e=this.planes.findIndex(r=>r.id===t);this.planes[e].isNormal&&this.normalPlanes.splice(this.normalPlanes.findIndex(r=>r.id===t),1),this.planes.splice(e,1)}addData(t,e,r=0){if(this.dataOffset+t.length>this.dataU.length){if(t.length>this.dataU.length)throw new Error("data.length > this.dataU.length");this.submitCommandEncoder()}this.dataU.set(t,this.dataOffset),this.gpu.copyBufferToBuffer(this.dataBuf,this.dataOffset,e,r,t.length,this.commandEncoder),this.dataOffset+=t.length}submitCommandEncoder(){this.gpu.writeBuffer(this.dataBuf,0,this.dataU,0,this.dataOffset),this.gpu.submit(this.commandEncoder),this.texturePool.recall(),this.dataOffset=0,this.commandEncoder=this.gpu.device.createCommandEncoder()}setSampling(t,e=this.currentCamera.getWidth(),r=this.currentCamera.getHeight()){t>1?this.antialias=!0:this.antialias=!1,this.screenAAProgram.setSampling(t),this.resizeExceptCanvas(e,r)}getSampling(){return this.screenAAProgram.getSampling()}setAntialias(t,e=this.currentCamera.getWidth(),r=this.currentCamera.getHeight()){console.log("\u6297\u952F\u9F7F\u6539\u53D8",`${this.antialias} -> ${t}`),super.setAntialias(t),this.setSampling(t?2:1,e,r)}updateCameraBuf(t,e){this.addData(new Uint32Array(Kit(t,e).buffer),this.cameraBuf)}setDrcRenderModel(t){this.drcRenderModel=t,this.needRender=!0}setDrcRenderStyle(t){this.drcRenderStyle=t,this.needRender=!0}onRenderModeChange(){let t=this.getRenderMode();console.log("\u6E32\u67D3\u6A21\u5F0F\u6539\u53D8",`${this.m_nRecordRenderMode} -> ${t}`),this.m_nRecordRenderMode=t}renderHighLightPlane(t,e,r,i,n,s,a,l,c){c();for(let h=0;h<this.highLightColor.length;h+=1)if(this.highLightColor[h])for(let u of e)u[0].renderHighLightPt(t,r,h,i,n,s,a,l,!0);this.highLightColor[0]&&!this.highlightPlane0.isEmpty()&&this.highlightPlane0.renderHighLightPt(t,r,0,i,n,!1,!1,!0),this.highLightColor[1]&&!this.highlightPlane1.isEmpty()&&this.highlightPlane1.renderHighLightPt(t,r,1,i,n,!1,!1,!0)}getVisibleHighlightAndNormalBBox2(){let t=new _e;return this.normalPlanes.forEach(e=>{!e.isRender()||e.isEmpty()||t.ext1(e.getAllPtBbox())}),this.highlightPlane0.isRender()&&!this.highlightPlane0.isEmpty()&&t.ext1(this.highlightPlane0.getAllPtBbox()),this.highlightPlane1.isRender()&&!this.highlightPlane1.isEmpty()&&t.ext1(this.highlightPlane1.getAllPtBbox()),t.valid()&&t.build()}getHasGroupForceHighLight(){return this.hasGroupForceHighLight}render0(t,e,r){this.renderI++,this.group.getIsChange()&&this.group.setIsChange(!1),this.measurePtTool.updateRuler();let i=this.groupStatusQuery(),n=i.hasGroupHighLight;this.hasGroupForceHighLight=i.hasGroupForceHighLight,this.getRenderMode()!==this.m_nRecordRenderMode&&this.onRenderModeChange(),this.currentCamera.adjustAxis(this.group);let s={colorTexture:this.antialias?this.screenAAProgram.colorTexture:{view:t},highLightColorTexture0:this.antialias?this.screenAAProgram.highLightColorTexture0:{view:e},highLightColorTexture1:this.antialias?this.screenAAProgram.highLightColorTexture1:{view:r},depthStencilTexture:this.depthStencilTexture};this.clearCanvasDesc.colorAttachments[0].view=t,this.clearCanvasDesc.colorAttachments[1].view=e,this.clearCanvasDesc.colorAttachments[2].view=r,this.commandEncoder.beginRenderPass(this.clearCanvasDesc).end(),this.commandEncoder.beginRenderPass(this.clearDepthStencilDesc).end(),this.antialias&&this.screenAAProgram.clearColor();let a=this.currentCamera,l=this.getRenderMode(),c=[],h=this.group.getMeshCache(l);if(this.group.getPlaneMatrixRenderModes(l).forEach(d=>{let p=d,m=p[0];m.getBBox()&&!m.isHighLight&&c.push(p)}),this.sortByCameraZ(a,c),this.setFpsLogTime(),this.updateCameraBuf(a,Number.NEGATIVE_INFINITY),this.staticPolygonInfoBuilder.updateBuf(),this.stringInfoBuilder.updateBuf(),this.ptTemplate.getTemplateInstanceData().updateBuf(),n&&this.renderPtProgram.highLightStencilBuf.clear(this.commandEncoder),this.setFpsLogTime(),this.render1(l,a,s,h,!0),this.setFpsLogTime(),!q1.isCloseGridRender()&&this.gridParam.renderGrid&&(this.gridParam.currentCoord?this.gridProgram.render(t,a):this.polarProgram.render(t,a)),this.setFpsLogTime(),this.render1(l,a,s,h,!1),this.setFpsLogTime(),n){if(!this.highLightColor.length)return;this.renderPtProgram.afterDraw.renderPolygonHighLightColor(s,this.highLightColor[0],this.highLightColor[1])}this.hasHighLightPt()&&this.renderHighLightPlane(s,c,a,l,Number.POSITIVE_INFINITY,!0,!0,!0,()=>{this.commandEncoder.beginRenderPass(this.clearStencilDesc).end()});let u=h.labelMapIndex.pthSide;if(u){this.meshProgramGPU.setViewOffsetZ(-1e-5);for(let d of u){let[p,m]=d;p.label==="pthSide"&&p.draw(this,s,m)}this.meshProgramGPU.setViewOffsetZ(0)}this.drawMeshes(h,!1,s,a),this.drawMeshes(h,!0,s,a),this.setFpsLogTime(),this.antialias?(this.screenAAProgram.renderSSAA(t),this.screenAAProgram.renderSSAA(t,0),this.screenAAProgram.renderSSAA(t,1)):(this.renderColorProgram.render(t,0),this.renderColorProgram.render(t,1)),this.setFpsLogTime(),this.openRuler&&this.rulerProgram.render(t,a,this.getRulerBackgroundColor(),this.getRulerStringColor()),this.submitCommandEncoder(),this.setFpsLogTime(),a.rendered()}render1(t,e,r,i,n){let s=e.getRenderMatrix(),a=e.getWidth()*this.getSampling(),l=e.getHeight()*this.getSampling(),c=[],h=i.opaqueMap.size+i.transparentMap.size;for(let d in i.labelMapIndex)h+=i.labelMapIndex[d].size;if(!n){let d=i.labelMapIndex.boardSide;if(d)for(let p of d){let[m,g]=p;for(let y of g)c.push([m,y.matrix,y.renderMode])}}this.group.getPlaneMatrixRenderModes(t).forEach(d=>{let p=d,m=p[0];n&&!m.getIsUnderGrid()||!n&&m.getIsUnderGrid()||(m.isRender()&&!m.isHighLight&&m.getBBox()?c.push(p):m.markDrawn(d[1],this.renderI))});let u=[[],[]];if(e.isOrthCamera())c.sort((d,p)=>{let m=d[0].getBBox().transform(d[1]),g=p[0].getBBox().transform(p[1]);return m.minZ+m.maxZ-(g.minZ+g.maxZ)}),e.getTar2Pos().z<0&&c.reverse(),u[0]=c;else{let d=e.getZ();u[0]=c.filter(p=>{let m=p[0].getBBox().transform(p[1]);return m.minZ<=d&&m.maxZ>=d||(m.minZ+m.maxZ)/2>d}),u[1]=c.filter(p=>{let m=p[0].getBBox().transform(p[1]);return m.minZ<=d&&m.maxZ>=d||(m.minZ+m.maxZ)/2<d}),u.forEach(p=>p.sort((m,g)=>{let y=m[0].getBBox().transform(m[1]),b=g[0].getBBox().transform(g[1]);return(b.minZ<=d&&b.maxZ>=d?0:Math.abs((b.minZ+b.maxZ)/2-d))-(y.minZ<=d&&y.maxZ>=d?0:Math.abs((y.minZ+y.maxZ)/2-d))}))}for(let d of u){let p,m;for(let b=d.length-1;b>=0;b--){let[P,T,I]=d[b];if(P instanceof H7){(I===4||I===2&&P.getMaterial().alpha===1)&&(p=P),e.isOrthCamera()&&e.getTar2Pos().x+e.getTar2Pos().y===0&&(console.log("\u5254\u9664\u6E32\u67D3\u5BF9\u8C61",P.label,"\u6444\u50CF\u673A\u5728\u4FA7\u9762"),P.markDrawn(T,this.renderI),h-=1);continue}let C;if(!e.isOrthCamera()){let E=!0,O=P.getBBox();C=[new Dt(O.minX,O.minY,0),new Dt(O.minX,O.maxY,0),new Dt(O.maxX,O.minY,0),new Dt(O.maxX,O.maxY,0)].map(_=>_.multiply4(T).multiply4(s));for(let _ of C)if(_.z>1||_.z<=0){E=!1;break}if(!E){console.log("\u5254\u9664\u6E32\u67D3\u5BF9\u8C61",P.label,"\u6CA1\u6709\u5728\u89C6\u91CE\u4E2D"),P.markDrawn(T,this.renderI);continue}}if(p){if(p instanceof H7)console.log("\u5254\u9664\u6E32\u67D3\u5BF9\u8C61",P.label,"\u57FA\u677F\u906E\u6321"),P.markDrawn(T,this.renderI),h-=1;else if(V_.eq(e.getTar2Pos().z,0)&&(e.isOrthCamera()||V_.eq(Dt.ORIGIN.multiply4(T).z,e.getTarget().z)))console.log("\u5254\u9664\u6E32\u67D3\u5BF9\u8C61",P.label,"\u6444\u50CF\u673Az\u8F74"),P.markDrawn(T,this.renderI);else if(p.ableCover(P)){let E=p.getBBox(),O=!0,_=[new Dt(E.minX,E.minY,0),new Dt(E.minX,E.maxY,0),new Dt(E.maxX,E.minY,0),new Dt(E.maxX,E.maxY,0)].map(x=>x.multiply4(T).multiply4(s));for(let x=0;x<_.length;x++){let v=_[x],D=m[x];if(Math.abs(v.x-D.x)*a>IZ||Math.abs(v.x-D.x)*l>IZ){O=!1;break}}O?(console.log("\u5254\u9664\u6E32\u67D3\u5BF9\u8C61",P.label,"\u906E\u6321"),P.markDrawn(T,this.renderI)):p=null}}if(!(p instanceof P9)&&P.isBoard(I))if(p=P,C)m=C;else{let E=P.getBBox();m=[new Dt(E.minX,E.minY,0),new Dt(E.minX,E.maxY,0),new Dt(E.maxX,E.minY,0),new Dt(E.maxX,E.maxY,0)].map(O=>O.multiply4(T).multiply4(s))}}let g,y;for(let b=0;b<d.length;b++){let P=function(){let E=g.getBBox(),O=[new Dt(E.minX,E.minY,0),new Dt(E.minX,E.maxY,0),new Dt(E.maxX,E.minY,0),new Dt(E.maxX,E.maxY,0)],_=!0;for(let x of O){let v=x.multiply4(I).multiply4(s),D=x.multiply4(y).multiply4(s);if(Math.abs(v.x-D.x)*a>IZ||Math.abs(v.x-D.x)*l>IZ){_=!1;break}}return _},[T,I,C]=d[b];if(!T.hadDrawn(I,this.renderI)){if(T instanceof H7){C===2&&T.getMaterial().alpha!==1&&T.draw(this,r,[{matrix:I,renderMode:C,color:null}]);continue}if(C!==1&&(!g||!T.hasInterPlane(g)||!P())){let E,O;for(let _=b+1;_<d.length;_++){let[x,v]=d[_];if(x instanceof P9){E=x,O=v;break}}g=E==null?void 0:E.getMutualStencilPlane(T),g&&(y=O,P()?(y=I,g.drawStencilPlane(r,e,y,C,!0,!0,!0,!0,h>0)):g=null)}T.draw(r,e,I,C,!0,!0,!0,!0,g,h>0),T.lightLayer&&T.lightLayer[1].getVisible()&&!T.lightLayer[0].isEmpty()&&C===2&&(T.lightLayer[0].draw(r,e,I,0,!0,!0,!0,!0,null,h>0),g=null)}}}}drawMeshes(t,e,r,i){if(e){let n=[];for(let s of t.transparentMap.entries()){let[a,l]=s;l.filter(c=>{let h=c.renderMode,u=h===2||h===1?a.getMaterial().alpha:h===0?a.getColor().alpha:1;u!==0&&u!==1&&n.push([a,c])})}n.sort((s,a)=>{let l=s[0].getBBox().transform(s[1].matrix),c=a[0].getBBox().transform(a[1].matrix);return i.getZ()>0?l.minZ+l.maxZ-(c.minZ+c.maxZ):c.minZ+c.maxZ-(l.minZ+l.maxZ)}),n.forEach(s=>{s[0].draw(this,r,[s[1]])})}else for(let n of t.opaqueMap.entries())n[0].draw(this,r,n[1])}resetRenderInfo(){this.renderPtNum=0,this.renderVertexNum=0,this.drawTimes=0,this.drawTemplateToTargetTimes=0,this.renderPtTypeNum=Array(69).fill(0)}getGridInfo(){let t=0,e=0,r=0;return this.numGrids.forEach(i=>{i.forEach(n=>{n.forEach(s=>{t+=s,r=Math.max(r,s)}),e+=n.size})}),{gridNum:e,gridPtNum:t,maxGridPtNum:r}}renderRequestAnimationFrame(){this.fpsCount();let t=this.needRender||this.processDefaultBlockData;this.render(),this.renderRuler(this.currentCamera),!t&&this.gpu.memoryManager.alignMemory()&&(t=!0),this.processDefaultBlockData=!1,this.animationId=requestAnimationFrame(async()=>{if(!this.isMac||this.isResize){this.isResize=!1,this.renderRequestAnimationFrame();return}this.isWaitingRender||(this.isWaitingRender=!0,q1.macNoOnSubmittedWorkDone()||await this.gpu.device.queue.onSubmittedWorkDone(),this.isWaitingRender=!1,this.renderRequestAnimationFrame())})}setForceVisibleHighLightPt(t){t!=this.forceVisibleHighLightPt&&(this.forceVisibleHighLightPt=t,this.needRender=!0)}setForceDeactivateRatio(t){this.forceDeactivateRatio!==t&&(this.forceDeactivateRatio=t,this.needRender=!0)}getInfo(){return{engine:"webgpu",fps:this.getFps(),ptNum:this.planes.reduce((t,e)=>t+e.getPtNum(),0)}}dispose(){this.animationId&&cancelAnimationFrame(this.animationId)}hasHighLightPt(){for(let t of this.planes)if(!t.isEmpty()){if(t.isHighLight){if(t.getPtNum()>0)return!0}else if(t.getHighLightPtNum()>0)return!0}return!1}render(t=this.currentCamera){if(this.rayTracing){this.rayTracing.render();return}if(!this.needRender&&!this.forceRender&&!q1.isContinuedRender())return;if(this.needRender=!1,this.resetRenderInfo(),this.gpu.device.queue.onSubmittedWorkDone().then(()=>{this.gpuTimeI=0,this.gpuStart=performance.now()}),this.cpuTimeI=0,this.cpuStart=performance.now(),this.render0(this.renderColorTexture.view,this.highLightColorTexture0.view,this.highLightColorTexture1.view),this.updateCanvasTexture(),this.instantiationTime&&this.planes.findIndex(r=>r.builder.getPtNum()!==0)!==-1){console.log("init time:",performance.now()-this.instantiationTime),delete this.instantiationTime;let r=LC();console.log("bufferSizeGPU:",r.bufferSizeGPU),console.log("bufferSizeIndex:",JSON.stringify(r.bufferSizeIndex)),console.time("grids forEach");let i=this.getGridInfo();console.timeEnd("grids forEach"),console.log(JSON.stringify(i));let n=0,s=Array(69).fill(0),a=0,l=0,c=0,h=0,u=0,d=0,p=0,m=0;this.planes.forEach(g=>{n+=g.getPtNum();let y=g.getPtTypeNum();for(let b=0;b<y.length;b++){let P=y[b];s[b]+=P,m+=P*Fr.getPtLengthByType(b),c+=P*BZ(b),b>=21&&(l+=P,h+=P*BZ(b))}a+=g.templateInstancePtMap.size,g.customTemplateInstancePtNumBuilder.forEach((b,P)=>{u+=b,b!==0&&(d++,p+=g.templateInstancePtMap.get(P).size)})}),console.log("\u56FE\u5143\u603B\u6570:",n),console.log("\u56FE\u5143\u5B57\u8282\u5927\u5C0F:",m*4),console.log("\u5404\u7C7B\u578B\u56FE\u5143\u6570\u91CF:",s),console.log("\u975E\u7F51\u683C\u56FE\u5143\u6570\u91CF:",n-i.gridPtNum),console.log("\u6A21\u677F\u6570\u91CF\uFF1A",this.ptTemplate.getTemplateNum()),console.log("\u6A21\u677F\u5B9E\u4F8B\u6570\u91CF\uFF1A",this.ptTemplate.getMaxTemplateInstanceIndex()+1),console.log("=====\u540E\u7EED\u6A21\u677F\u6307\u6807\u90FD\u662F\u5206\u5C42\u7684====="),console.log("\u6240\u6709\u5C42\u4F7F\u7528\u7684\u6A21\u677F\u5B9E\u4F8B\u6570\u91CF\u603B\u548C\uFF1A",a),console.log("\u6A21\u677F\u5B9E\u4F8B\u56FE\u5143\u603B\u6570\uFF1A",l),console.log("\u6A21\u677F\u7EB9\u7406\u4E2D\u5E73\u5747\u56FE\u5143\u6570\u91CF\uFF1A",l/a),console.log("\u6A21\u677F\u7EB9\u7406\u6E32\u67D3\u65F6\u786C\u6E32\u67D3\u7684\u56FE\u5143\u603B\u6570\uFF1A",n-l+a),console.log("\u6A21\u677F\u7EB9\u7406\u6E32\u67D3\u9876\u70B9\u603B\u6570\uFF1A",c-h+a*6),console.log("\u6A21\u677F\u786C\u6E32\u67D3\u9876\u70B9\u603B\u6570\uFF08\u4E0D\u51C6\u786E\uFF0C\u672A\u6392\u9664\u6A21\u677F\u56FE\u5143\uFF09:",c),console.log("\u81EA\u5B9A\u4E49\u6A21\u677F\u5B9E\u4F8B\u56FE\u5143\u6570\u91CF:",u),console.log("\u81EA\u5B9A\u4E49\u6A21\u677F\u5B9E\u4F8B\u6570\u91CF:",d),console.log("\u81EA\u5B9A\u4E49\u6A21\u677F\u5B9E\u4F8B\u4E2D\u542B\u6709\u7684\u56FE\u5143\u6570\u91CF:",p)}if(this.logFps&&(this.submitCommandEncoder(),this.gpu.device.queue.onSubmittedWorkDone().then(()=>{this.gpuTimes[this.gpuTimeI++]+=performance.now()-this.gpuStart,this.gpuStart=performance.now()}),this.cpuTimes[this.cpuTimeI++]+=performance.now()-this.cpuStart,this.cpuStart=performance.now()),!this.logFps)return;this.renderTimes++;let e=performance.now()-this.startTime;if(e>=1e3){let r=this.renderTimes;this.renderTimes=0,console.log("frame fps:",r/e*1e3,this.currentCamera.getScale()),this.startTime=performance.now(),console.log("virtual cpu fps:",1e3/(this.cpuTimes.reduce((i,n)=>i+n,0)/r)),console.log("cpuTimes:",this.cpuTimes.map(i=>i/r)),this.cpuTimes.fill(0),this.gpu.device.queue.onSubmittedWorkDone().then(()=>{console.log("virtual gpu fps:",1e3/(this.gpuTimes.reduce((i,n)=>i+n,0)/r)),console.log("gpuTimes:",this.gpuTimes.map(i=>i/r)),this.gpuTimes.fill(0)}),console.log("renderPtNum:",this.renderPtNum),console.log("renderPtTypeNum",this.renderPtTypeNum),console.log("renderVertexNum:",this.renderVertexNum),console.log("drawTimes:",this.drawTimes),console.log("drawTemplateToTargetTimes",this.drawTemplateToTargetTimes)}}updateCanvasTexture(){let t=this.gpu.device.createCommandEncoder();t.copyTextureToTexture({texture:this.renderColorTexture.texture},{texture:this.context.getCurrentTexture()},this.renderColorTexture),this.gpu.submit(t)}renderRuler(t){!this.needRender&&this.needRenderRuler&&this.openRuler&&(this.rulerProgram.render(this.renderColorTexture.view,t,this.getRulerBackgroundColor(),this.getRulerStringColor()),this.submitCommandEncoder(),this.updateCanvasTexture(),this.needRenderRuler=!1)}capture(t,e,r,i,n=!1,s=1){var a;let l=this.getSampling(),c=this.currentCamera.getWidth(),h=this.currentCamera.getHeight();n?(this.setSampling(s,t,e),r()):(r(),this.setSampling(s,t,e));let u=this.gpu.createDynamicTexture(t,e,_a,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_SRC,"colorTexture of capture"),d=this.gpu.createDynamicTexture(t,e,_a,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_SRC,"highLightTexture0 of capture"),p=this.gpu.createDynamicTexture(t,e,_a,GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_SRC,"highLightTexture1 of capture");this.render0(u.view,d.view,p.view);let m;if((a=window.OffscreenCanvas)!=null&&a.prototype.transferToImageBitmap){let{width:g,height:y}=u,b=new window.OffscreenCanvas(g,y),P=b.getContext("webgpu");P.configure({device:this.gpu.device,format:_a,alphaMode:"premultiplied",usage:GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST});let T=this.gpu.device.createCommandEncoder();T.copyTextureToTexture({texture:u.texture},{texture:P.getCurrentTexture()},u),this.gpu.submit(T);let I=b.transferToImageBitmap(),C=document.createElement("canvas");C.width=g,C.height=y;let E=C.getContext("2d");E.drawImage(I,0,0),m=E.getImageData(0,0,g,y),I.close(),P.unconfigure()}else{let{width:g,height:y}=u,b=Math.ceil(g/64)*64,P=this.gpu.createDynamicBuffer(b*y,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST,"buf of saveResult"),T=this.gpu.device.createCommandEncoder();T.copyTextureToBuffer({texture:u.texture},{buffer:P.getBuffer(),bytesPerRow:b*rs,rowsPerImage:y},{width:g,height:y}),this.gpu.submit(T),m=P.getBuffer().mapAsync(GPUMapMode.READ).then(()=>{let I=new Uint8ClampedArray(P.getBuffer().getMappedRange().slice(0));if(P.getBuffer().unmap(),P.destroy(),b===g)return new ImageData(I,g,y);let C=new Uint8ClampedArray(g*y*4);for(let E=0;E<y;E++)C.set(I.slice(E*b*4,(E*b+g)*4),E*g*4);return new ImageData(C,g,y)})}return this.setSampling(l,c,h),i(),u.destroy(),d.destroy(),p.destroy(),m}resizeExceptCanvas(t,e){this.currentCamera.updateSize(t,e),this.rulerProgram.resize(t,e),this.gridProgram.resize(t,e),this.renderColorTexture.updateSize(t,e),this.highLightColorTexture0.updateSize(t,e),this.highLightColorTexture1.updateSize(t,e);let r=this.screenAAProgram.getSampling();t*=r,e*=r,this.screenAAProgram.colorTexture.updateSize(t,e),this.screenAAProgram.highLightColorTexture0.updateSize(t,e),this.screenAAProgram.highLightColorTexture1.updateSize(t,e),this.depthStencilTexture.updateSize(t,e),this.renderPtProgram.updateSize(t,e),this.needRender=!0,this.isResize=!0}resize(){let t=this.currentCamera.getCanvas(),e=this.getPixelRatio(),r=t.getBoundingClientRect(),i=Math.round(r.width*e),n=Math.round(r.height*e);(i===0||n===0)&&(i=1,n=1),!(t.width===i&&t.height===n)&&(t.width=i,t.height=n,this.resizeExceptCanvas(i,n))}isCoreGraphic(){return!0}createPlane(t,e,r=null,i=!0,n=!0,s=!1,a=!1){let l=this.planeIdBitmap.findEmpty();this.planeIdBitmap.markUsed(l);let c;return this.getUseProxy()?c=new Proxy(new P9(this,l,t,void 0,e,i,n,!1,s,a),N_):c=new P9(this,l,t,void 0,e,i,n,!1,s,a),c.setMaterial(r),this.planes.push(c),c.isNormal&&this.normalPlanes.push(c),this.updatePlanePart(this.panelizeMatrix,c),c}modifyUnit(t){this.rulerProgram.modifyUnit(t)}getBackgroundColor(){return this.backgroundColor}set openRuler(t){this._openRuler!==t&&(this._openRuler=t,this.needRender=!0)}get openRuler(){return this._openRuler}getCaptureImageData(t,e,r,i,n=!0,s=0){let a,l,c,h,u,d;return this.capture(t,e,()=>{a=this.openRuler,this.openRuler=!1,l=this.gridParam.visible,d=this.gridParam.getMultiStyle(),this.gridParam.visible=0,this.gridParam.setMultiStyle(2),c=this.getBgColor(),n&&this.modifyBgColor(ee.BLACK),h=this.currentCamera.getTarget(),u=this.currentCamera.getScale(),this.currentCamera.setTarget(new Dt(r.center().x,r.center().y,0)),this.currentCamera.setScale(i)},()=>{this.openRuler=a,this.gridParam.visible=l,this.gridParam.setMultiStyle(d),n&&this.modifyBgColor(c),this.currentCamera.setTarget(h),this.currentCamera.setScale(u)})}async getCaptureImageData1(t,e,r,i){return this.capture(t,e,r,i,!0)}getTexture(t){if(!(t instanceof ImageData||t instanceof HTMLCanvasElement||t instanceof HTMLImageElement))throw new Error("not support");let e=this.gpu,{width:r,height:i}=t,n=e.createDynamicTexture(r,i,_a,GPUTextureUsage.COPY_DST|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT,"texture of getTexture");if(t instanceof ImageData)this.gpu.device.queue.writeTexture({texture:n.texture},t.data,{bytesPerRow:r*4},[r,i]);else if(t instanceof HTMLCanvasElement){let{width:s,height:a}=t,l=t.getContext("2d").getImageData(0,0,s,a);this.gpu.device.queue.writeTexture({texture:n.texture},l.data,{bytesPerRow:s*4},[s,a])}else if(t instanceof HTMLImageElement){let s=document.createElement("canvas");s.width=t.width,s.height=t.height;let a=s.getContext("2d");a.drawImage(t,0,0,t.width,t.height);let l=a.getImageData(0,0,t.width,t.height);this.gpu.device.queue.writeTexture({texture:n.texture},l.data,{bytesPerRow:r*4},[r,i])}return n}modifyBgColor(t){this.clearCanvasDesc.colorAttachments[0].clearValue={r:t.r,g:t.g,b:t.b,a:t.alpha},this.backgroundColor=t,this.needRender=!0}async initRayTracer(t,e){let r=await zht.build1(this.gpu,this.currentCamera);await r.buildByKitsune({obj:{mtl:t,obj:e,origin:this.rulerProgram.getOrigin()},pcb:{planeGPU:this.planes,staticPolygonInfoBuilder:this.staticPolygonInfoBuilder}},this.context),MZ.downloadFile("raytracer.zip",await r.getZip()),this.rayTracing=r}setDrawingBgColor(){throw new Error("not support")}getBBox3(){let t=new mm;return this.planes.forEach(e=>{let r=e.getAllPtBbox();r&&t.ext1(r.minX,r.minY,0,r.maxX,r.maxY,0)}),t.isValid()&&t.build()}setDrcArrowPtStyle(t,e,r,i,n,s,a){super.setDrcArrowPtStyle(t,e,r,i,n,s,a),this.fixedPtData[0]=this.getColorIndex(t)}getFixedPtData(){return this.fixedPtData}getMeasurePtTool(){return this.measurePtTool}renderExternal(t=3,e=null){if(e){this.setRenderMode(t);for(let r of this.cameraSet)this.render(r)}}updatePlaneArrayPart(t){for(let e=0;e<this.planes.length;e++){let r=this.planes[e];r.clearParts();for(let i=0;i<t.length;i++)r.isPanelize()?r.addPart(t[i],r):i==0&&r.addPart(Qe.ORIGIN,r)}}updatePlanePart(t,e){if(t.length){e.clearParts();for(let r=0;r<t.length;r++)e.isPanelize()?e.addPart(t[r],e):r==0&&e.addPart(Qe.ORIGIN,e)}}getMaxWH(){return Math.min(this.gpu.limits.maxTextureDimension2D,Math.floor(Math.sqrt(this.gpu.limits.maxBufferSize/4)/4)*4,4096)}setViewOffset(t,e){this.viewOffset=new S(t,e),this.needRender=!0}getViewOffset(){return this.viewOffset}clearStencilValue(t,e,r){this.commandEncoder.beginRenderPass({colorAttachments:[],depthStencilAttachment:{view:e,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"clear",stencilStoreOp:"store",stencilClearValue:t},label:`clearStencilDesc of ${r}`}).end()}getCaptureToCanvasInfo(t,e,r){let i=t.copy(new ht(-1,1,-1,1)),n=i.adapt(r),s=n[2]/i.getScale(),a=n[3]/i.getScale(),{pxLength:l,fixedWidth:c,fixedHeight:h}=e;if(l)s/=l,a/=l;else if(c)l=s/c,a*=c/s,s=c;else if(h)l=a/h,s*=h/a,a=h;else throw new Error("\u622A\u56FE\u8BBE\u7F6E\u53C2\u6570\u975E\u6CD5\uFF01");(s>rh||a>rh)&&(s>a?(l*=s/rh,a=rh*a/s,s=rh):(l*=a/rh,s=rh*s/a,a=rh));let u=this.getMaxWH(),d=Math.ceil(s/u),p=Math.ceil(a/u),m=Math.floor(s/d),g=Math.floor(a/p);return{width:d*m,height:p*g,scale:1/l}}async captureToCanvas(t,e,r,i){let n=Array.from(this.cameraSet);for(let v of n)this.delCamera(v);let s=t.copy(new ht(-1,1,-1,1));this.addCamera0(s);let a=s.adapt(r),l=[a[0]/s.getScale(),a[1]/s.getScale()],c=a[2]/s.getScale(),h=a[3]/s.getScale(),{pxLength:u,fixedWidth:d,fixedHeight:p}=e;if(u)c/=u,h/=u;else if(d)u=c/d,h*=d/c,c=d;else if(p)u=h/p,c*=p/h,h=p;else throw new Error("\u622A\u56FE\u8BBE\u7F6E\u53C2\u6570\u975E\u6CD5\uFF01");(c>rh||h>rh)&&(c>h?(u*=c/rh,h=rh*h/c,c=rh):(u*=h/rh,c=rh*c/h,h=rh));let m=i?this.getMaxWH()/8:this.getMaxWH(),g=Math.ceil(c/m),y=Math.ceil(h/m),b=Math.floor(c/g),P=Math.floor(h/y);s.setScale(1/u);let T=document.createElement("canvas");T.width=g*b,T.height=y*P;let I=T.getContext("2d"),C=(g-1)/2,E=(y-1)/2,O=[l[0]/u/b*2,l[1]/u/P*2],_=this.openRuler,x=this.gridProgram.visible;this.openRuler=!1,this.gridProgram.visible=0;for(let v=0;v<g;v++)for(let D=0;D<y;D++){this.setViewOffset((C-v)*2-O[0],(D-E)*2-O[1]);let w=await this.capture(b,P,()=>{},()=>{},!1,2);if(i&&i()||(I.putImageData(w,b*v,P*D),i&&i()))return null}this.setViewOffset(0,0),this.openRuler=_,this.gridProgram.visible=x,this.delCamera(s);for(let v of n)this.addCamera(v);return T}},Jht=class extends lct{constructor(o,t,e,r){super(),this.position=o,this.origin=t,this.right=e,this.down=r}_toWGSLStructure(){return{position:this.position,origin:this.origin,right:this.right,down:this.down}}},XZ=new Dt(-1,1,4).normalize(),hRe=XZ.cross(new Dt(0,1,0)).cross(XZ).normalize(),uH=2,uRe=16,B_=class uMe{constructor(t,e=t.width,r=t.height,i,n,s,a,l=.05,c=1e3){this.updateFlag=!0,this.changedFromLastRender=!0,this.isOrth=!1,this.target=Dt.ORIGIN,this.tar2posDir=XZ,this.up=hRe,this.scale=1,this.center=Dt.ORIGIN,this.radius=1,this.rotatable=!0,this.sampling=1,this.screenPosition=S.ORIGIN,this.cmosSize={width:20,height:20},this.flangeFocalDistance=30,this.changeListeners=[],this.minScale=.05,this.maxScale=1e3,this.needRender=!0,this.axisVisible=!1,n&&(n.maxX!==1||n.minX!==-1||n.maxY!==1||n.minY!==-1)&&console.error("Camera Bbox error"),this.bbox=n,this.messageBus=a,this.updateSize(e,r),this._id=i,this.canvas=t,this.axisGroup=s,this.minScale=l,this.maxScale=c}get id(){return this._id}get tar2pos(){return this.tar2posDir.scale(this.getOriginLength())}getScreenPosition(){return this.screenPosition}getCanvas(){return this.canvas}getSampling(){return this.sampling}getPosition(){return this.target.add(this.tar2pos)}getZ(){return this.target.z+this.tar2pos.z}getOriginLength(){return this.radius*uH}getUp(){return this.up}getRelativePosition(){return new Dt(0,0,this.tar2pos.length())}getTar2Pos(){return this.tar2pos}getTarget(){return this.target}getWidth(){return this.width}getHeight(){return this.height}getPxLength(){return 1/this.scale}getBBox2(){let t=this.getPxLength(),e=this.width/2*t,r=this.height/2*t,{x:i,y:n}=this.target;return new ht(i-e,i+e,n-r,n+r)}getScale(){return this.scale}getBorderZ(t){return this.isOrth?this.scale>t?-1:2:(uH-1)/(uH*(this.scale/t))}getPhotoSize(){let{width:t,height:e}=this;return{width:t,height:e}}getCmosPosition(){return this.getPosition().add(this.tar2pos.normalize().scale(this.getOriginLength()-this.radius))}getFlangeFocalDistance(){return this.flangeFocalDistance}getScreenPointToRay(t,e){t=this.getWidth()-t,e=this.getHeight()-e;let{origin:r,right:i,down:n}=this.getViewport(),s=r.add(i.scale(t)).add(n.scale(e));return this.getPosition().sub(s).normalize()}getSensorDimensions(){let t=this.getPhotoSize().width/this.getPhotoSize().height,e=this.cmosSize.width/this.cmosSize.height;return t>e?{width:this.cmosSize.width,height:this.cmosSize.width/t}:{width:this.cmosSize.height*t,height:this.cmosSize.height}}getApertureSize(){return this.apertureSize}getFocalLength(){return this.focalLength}getConfig(){let{up:t,target:e,tar2posDir:r,apertureSize:i,focalLength:n,flangeFocalDistance:s,cmosSize:a,scale:l}=this;return{up:t,target:e,tar2posDir:r,scale:l,apertureSize:i,focalLength:n,flangeFocalDistance:s,cmosSize:a}}getOrientationFrame(){let t=this.tar2pos.normalize(),e=this.up.cross(t).normalize(),r=t.cross(e).normalize();return{zAxis:t,xAxis:e,yAxis:r}}setCanvas(t){this.canvas=t,this.updateSize(t.width,t.height)}setScreenPosition(t){this.screenPosition=t}setScene(t){this.scene=t}setSampling(t,e=!0){this.sampling=t,this.markChange(e)}setObject(t,e,r=!0){this.center=t,this.radius=e,this.markChange(r)}setObjectByBBox3(t,e=!0){let r=t.center(),i=n()/2;this.setObject(r,i,e);function n(){let s=t.maxX-t.minX,a=t.maxY-t.minY,l=t.maxZ-t.minZ;return Math.sqrt(s*s+a*a+l*l)}}setRotatable(t){this.rotatable=t}setCameraDirect(t,e=!0){this.tar2posDir=new Dt(0,0,t?1:-1),this.up=new Dt(0,1,0),this.scene&&e&&this.scene.setCameraFlip(!t),this.markChange(e)}setCameraType(t,e=!0){this.isOrth=t,this.markChange(e)}setTarget(t,e=!0){this.target=t,this.markChange(e)}setScale(t,e=!0){this.scale=Math.max(t,1e-5),this.markChange(e)}setFlangeFocalDistance(t){this.flangeFocalDistance=t,this.markChange()}setCmosSize(t){this.cmosSize=t,this.markChange()}setApertureSize(t){this.apertureSize=t,this.markChange()}setFocalLength(t){this.focalLength=t,this.markChange()}setConfig(t){let{up:e,target:r,tar2posDir:i,apertureSize:n,focalLength:s,flangeFocalDistance:a,cmosSize:l,scale:c}=t;this.up=e,this.target=r,this.tar2posDir=i.normalize(),this.apertureSize=n,this.focalLength=s,this.flangeFocalDistance=a,this.cmosSize=l,this.scale=c,this.markChange()}isChangedFromLastRender(){return this.changedFromLastRender}isOrthCamera(){return this.isOrth}is2D(){return!this.rotatable&&this.isOrth&&this.tar2pos.x===0&&this.tar2pos.y===0}is3D(){return!this.is2D()}addChangeListener(t){this.changeListeners.push(t),t(this)}copy(t=this.bbox){let e=new uMe(this.canvas,void 0,void 0,void 0,t);return e.axisGroup=this.axisGroup,e.width=this.width,e.height=this.height,e.scene=this.scene,e.isOrth=this.isOrth,e.target=this.target,e.tar2posDir=this.tar2posDir,e.up=this.up,e.scale=this.scale,e.center=this.center,e.radius=this.radius,e.rotatable=this.rotatable,e.updateFlag=this.updateFlag,e.renderMatrix=this.renderMatrix,e.projectMatrix=this.projectMatrix,e.viewMatrix=this.viewMatrix,e.sampling=this.sampling,e.screenPosition=this.screenPosition,e}rendered(){this.changedFromLastRender=!1}reset(){this.rotatable&&(this.tar2posDir=XZ),this.target=this.center,this.up=hRe,this.scale=1,this.markChange()}updateSize(t,e){this.width=t,this.height=e,this.markChange()}addOffset(t){let{xAxis:e,yAxis:r,zAxis:i}=this.getOrientationFrame();this.target=this.target.add(e.scale(t.x).add(r.scale(t.y)).add(i.scale(t.z))),this.markChange()}addOffset1(t,e){let r=t*-this.getPxLength(),i=e*this.getPxLength();this.addOffset(new Dt(r,i,0))}rotateH(t){if(!this.rotatable)return;let e=this.up.scale(-1);this.tar2posDir=this.tar2pos.rotate(e,t).normalize(),this.markChange()}rotateZ(t,e){this.rotatable&&(this.tar2posDir=this.tar2pos.rotate(Dt.Z_UNIT_VECTOR,t).normalize(),this.up=this.up.rotate(Dt.Z_UNIT_VECTOR,t).normalize(),e&&(this.target=this.target.multiply4(Ae.rotateAxis(Dt.Z_UNIT_VECTOR,t).setOrigin1(e))),this.markChange())}rotateV(t,e){if(!this.rotatable)return;let r=this.tar2pos.cross(this.up);this.up=this.up.rotate(r,t).normalize(),this.tar2posDir=this.tar2pos.rotate(r,t).normalize(),e&&(this.target=this.target.multiply4(Ae.rotateAxis(r,t).setOrigin1(e))),this.markChange()}rotateP(t){this.rotatable&&(this.up=this.up.rotate(this.tar2pos,t).normalize(),this.markChange())}scaleAtPoint(t,e,r){t=this.limitScale(t);let{xAxis:i,yAxis:n}=this.getOrientationFrame(),s=i.scale(e*this.width/2/this.scale).add(n.scale(r*this.height/2/this.scale));this.scale=this.scale*t;let a=i.scale(e*this.width/2/this.scale).add(n.scale(r*this.height/2/this.scale));this.target=this.target.add(s).sub(a),this.markChange()}scaleAtPoint1(t,e,r){let i=e/this.canvas.width*2-1,n=-(r/this.canvas.height*2-1);this.scaleAtPoint(t,i,n)}adapt(t){if(!t)return[0,0,0,0];this.setTarget(t.center());let e=this.getAdaptRenderMatrix(),r=t.getVertexes().map(h=>h.multiply4(e)),i=new _e;for(let h of r)i.ext6(h.x,h.y);let n=i.build1(),s=1/Math.max(-n.minX,n.maxX,-n.minY,n.maxY);this.setScale(this.getScale()*s),n=new ht(n.minX*s,n.maxX*s,n.minY*s,n.maxY*s);let a=this.width,l=this.height,c=n.center();return[c.x*a/2,c.y*l/2,a*n.width()/2,l*n.height()/2]}adapt1(t,e=1){if(!t)return[0,0,0,0];let r=t.width(),i=t.height(),n=this.width/r,s=this.height/i;n<=0&&(n=1),s<=0&&(s=1);let a=Math.min(n,s)*e;this.setTarget(new Dt(t.center().x,t.center().y,0)),this.setScale(a)}autoFcous(t){this.focalLength=t*this.flangeFocalDistance/(t+this.flangeFocalDistance),this.markChange()}getViewMatrix(){return this.update(),this.viewMatrix}getProjectMatrix(){return this.update(),this.projectMatrix}getRenderMatrix(){return this.update(),this.renderMatrix}getAdaptRenderMatrix(){this.updateFlag&&(this.updateViewport(),this.updateViewMatrix());let t=this.updateProjectMatrix(!0);return this.viewMatrix.multiply4(t)}get2dCameraMatrix(){return this.update(),new Ae([this.viewMatrix.data[0],this.viewMatrix.data[1],0,0,this.viewMatrix.data[4],this.viewMatrix.data[5],0,0,0,0,1,0,this.viewMatrix.data[12],this.viewMatrix.data[13],0,1]).scale(this.scale,this.scale,1)}getInverseMatrix(){return this.update(),this.invMatrix}getViewport(){return this.update(),this.viewPort}updateInvMatrix(){let{xAxis:t,yAxis:e,zAxis:r}=this.getOrientationFrame(),i=this.getPosition();this.invMatrix=Ae.translate(-this.width/2,-this.height/2,0).multiply4(Ae.flipX()).scale((this.isOrth?1:(this.getOriginLength()-this.radius)/this.getOriginLength())/this.scale).translate1(0,0,this.isOrth?this.radius:this.radius-this.getOriginLength()).multiply4(new Ae([t.x,t.y,t.z,0,e.x,e.y,e.z,0,r.x,r.y,r.z,0,i.x,i.y,i.z,1]))}updateViewMatrix(){let{xAxis:t,yAxis:e,zAxis:r}=this.getOrientationFrame(),i;if(this.isOrth){let n=this.tar2pos.normalize().scale(this.tar2pos.length()-(this.getOriginLength()-this.radius)-this.radius*uRe*(this.scene instanceof LZ?2:1));i=this.target.add(n)}else i=this.target.add(this.tar2pos);this.viewMatrix=new Ae([t.x,e.x,r.x,0,t.y,e.y,r.y,0,t.z,e.z,r.z,0,-i.dot(t),-i.dot(e),-i.dot(r),1])}updateProjectMatrix(t=!1){let e;if(this.isOrth)this.scene instanceof mH&&!t?e=new Ae([this.scale*this.sampling,0,0,0,0,-this.scale*this.sampling,0,0,0,0,1,0,this.width*this.sampling/2,this.height*this.sampling/2,0,1]):e=new Ae([2/this.width*this.scale,0,0,0,0,2/this.height*this.scale,0,0,0,0,.5/this.radius/uRe,0,0,0,0,1]);else{if(this.scene instanceof mH)throw new Error("not support");e=new Ae([2*this.getOriginLength()*this.scale/this.width,0,0,0,0,2*this.getOriginLength()*this.scale/this.height,0,0,0,0,0,-1,0,0,this.getOriginLength()-this.radius,0])}return e}updateViewport(){let{xAxis:t,yAxis:e}=this.getOrientationFrame(),{width:r,height:i}=this,n=this.scale*(uH/(uH-1));r/=n,i/=n;let s=this.getCmosPosition().sub(t.scale(r/2)).add(e.scale(i/2));this.viewPort=new Jht(this.getPosition(),s,t.scale(r).scale(1/this.getPhotoSize().width),e.scale(-1).scale(i).scale(1/this.getPhotoSize().height))}update(){this.updateFlag&&(this.updateViewport(),this.updateViewMatrix(),this.projectMatrix=this.updateProjectMatrix(),this.renderMatrix=this.viewMatrix.multiply4(this.projectMatrix),this.updateInvMatrix(),this.updateFlag=!1)}markChange(t=!0){this.updateFlag=!0,this.changedFromLastRender=!0,this.scene&&t&&(this.scene.needRender=!0),this.changeListeners.forEach(e=>e(this))}setMaxScale(t){this.maxScale=t}setMinScale(t){this.minScale=t}getMaxScale(){return this.maxScale}getMinScale(){return this.minScale}limitScale(t){let e=this.scale,r=e*t;return r<this.minScale?t=this.minScale/e:r>this.maxScale&&(t=this.maxScale/e),t}setNeedRender(t){this.needRender=t,this.markChange()}getNeedRender(){return this.needRender}setAxisVisible(t){this.axisVisible=t,this.markChange(!0)}adjustAxis(t){var e,r;(e=this.axisGroup)==null||e.setVisible(this.axisVisible),(r=this.axisGroup)==null||r.setAddiMatrix(Ae.translate1(this.target).multiply4(t.getMatrix().getInverseMatrix()))}getOffsetXY(t,e){let r=this.tar2pos,i=this.up.rotate(r,-Math.PI/2).normalize().scale(t);if(i=i.add(this.up.normalize().scale(e)),i.z!==0&&r.z!==0){let n=r.z/i.z;i=i.add(r.scale(-1/n))}return new S(i.x,i.y)}rotateZTo(t){let e=this.rotatable;this.rotatable=!0,this.up=new Dt(0,1,0),this.rotateP(t),this.rotatable=e,this.markChange()}rotateTo(t){let e=this.rotatable;this.rotatable=!0,this.up=new Dt(0,0,1),this.tar2posDir=new Dt(0,-1,0),this.rotateH(t.x),this.rotateV(t.y),this.rotateP(t.z),this.rotatable=e,this.markChange()}setAxisGroup(t){this.axisGroup=t,this.changedFromLastRender=!0}markChange0(){var t;this.updateFlag=!0,this.changedFromLastRender=!0,(t=this.messageBus)==null||t.publish("/engine/camera/update",{id:this.id,scale:this.scale})}getId(){return this.id}isTop(){return this.tar2pos.z>0}};var uJ=class uJ{conversion(t,e,r){if(t===e)return r;if(t[1]==="i"&&e[0]==="m"&&e[1]==="m")return this.mil2mm(r);if(t[0]==="m"&&t[1]==="m"&&e[1]==="i")return this.mm2mil(r);let i=t+2+e;return this[i](r)}conversion1(t,e,r){let i=t+2+e,n=this[i](r);return e=="mil"?Math.round(n*10)/10:Math.round(n*1e3)/1e3}mil2mil(t){return t}mil2mm(t){return t*.0254}mil2cm(t){return t*.00254}mil2inch(t){return t/1e3}mm2mm(t){return t}mm2mil(t){let e=Math.pow(10,5);return Math.round(t*39.37007874015748*e)/e}mm2cm(t){return t/10}mm2inch(t){let e=Math.pow(10,8);return Math.round(t*.03937007874015748*e)/e}cm2mil(t){let e=Math.pow(10,6);return Math.round(t*393.7007874015748*e)/e}cm2mm(t){return t*10}cm2inch(t){let e=Math.pow(10,7);return Math.round(t*.3937007874015748*e)/e}inch2mil(t){return t*1e3}inch2mm(t){return t*25.4}inch2cm(t){return t*2.54}};uJ.ins=new uJ;var dt=uJ;dt.prototype["px(100)2mil"]=o=>o*10;dt.prototype["px(100)2mm"]=o=>o*.254;dt.prototype["mil2px(100)"]=o=>o/10;dt.prototype["mm2px(100)"]=o=>{let t=Math.pow(10,5);return Math.round(o*3.937007874015748*t)/t};function Qht(o,t,e="px(100)"){return dt.ins.conversion(t,e,o)}function tb(o,t,e=10){return Qht(o,Wge(t),Wge(e))}var eut=Object.create,i4e=Object.defineProperty,tut=Object.getOwnPropertyDescriptor,rut=Object.getOwnPropertyNames,iut=Object.getPrototypeOf,nut=Object.prototype.hasOwnProperty,dMe=(o=>typeof od<"u"?od:typeof Proxy<"u"?new Proxy(o,{get:(t,e)=>(typeof od<"u"?od:t)[e]}):o)(function(o){if(typeof od<"u")return od.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')}),Gl=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),out=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rut(t))!nut.call(o,i)&&i!==e&&i4e(o,i,{get:()=>t[i],enumerable:!(r=tut(t,i))||r.enumerable});return o},IN=(o,t,e)=>(e=o!=null?eut(iut(o)):{},out(t||!o||!o.__esModule?i4e(e,"default",{value:o,enumerable:!0}):e,o)),uW=Gl((o,t)=>{"use strict";var e=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,s=(j,Z)=>{for(var ie in Z)e(j,ie,{get:Z[ie],enumerable:!0})},a=(j,Z,ie,de)=>{if(Z&&typeof Z=="object"||typeof Z=="function")for(let me of i(Z))!n.call(j,me)&&me!==ie&&e(j,me,{get:()=>Z[me],enumerable:!(de=r(Z,me))||de.enumerable});return j},l=j=>a(e({},"__esModule",{value:!0}),j),c={};s(c,{BroadcastChannelMessageBus:()=>J,MessageBus:()=>L,MessageBus2:()=>X,MessageBusTask:()=>W,MessageBusTask2:()=>G,WindowMessageBridge:()=>V,WorkerMessageBridge:()=>z,createBroadcastP2PStream:()=>fe,createBufferedByteBufferStream:()=>$,createBufferedStream:()=>te,createBufferedStringStream:()=>oe,dropP2PStream:()=>Oe,flowRead:()=>be,flowWrite:()=>ue}),t.exports=l(c);var h=class{constructor(j=1.5){this.growthFactor=j,this.capacity=10,this.buffer=new Array(this.capacity),this.head=0,this.tail=0,this.count=0}enqueue(j){if(this.count===this.capacity){let Z=Math.floor(this.capacity*this.growthFactor);console.log("grow",this.capacity,Z);let ie=new Array(Z);for(let de=0;de<this.count;de++)ie[de]=this.buffer[(this.head+de)%this.capacity];this.buffer=ie,this.head=0,this.tail=this.count,this.capacity=Z}this.buffer[this.tail]=j,this.tail=(this.tail+1)%this.capacity,this.count++}dequeue(){if(this.isEmpty())return;let j=this.buffer[this.head];return this.head=(this.head+1)%this.capacity,this.count--,j}peek(){return this.buffer[this.head]}isEmpty(){return this.count===0}clear(){this.buffer.length=0,this.head=0,this.tail=0,this.count=0}},u=new ArrayBuffer(8),d=new Float64Array(u),p=new Uint32Array(u),m=new Uint16Array(u),g=ArrayBuffer;try{g=self.HTMLImageElement||g}catch{}var y=typeof SharedArrayBuffer<"u";function b(j){if(typeof j!="object"||j===null||j instanceof Date||j instanceof ArrayBuffer||y&&j instanceof SharedArrayBuffer||j instanceof Blob||j instanceof FormData||j instanceof Function||j instanceof Uint8ClampedArray||j instanceof g)return j;if(Array.isArray(j))return j.map(b);{let Z={};for(let ie in j)Object.hasOwnProperty.call(j,ie)&&(Z[ie]=b(j[ie]));return Z}}function P(j,Z){return T(j,Z,()=>[])}function T(j,Z,ie){let de=j[Z];return de!==void 0||(de=ie(Z),j[Z]=de),de}var I=class{constructor(j){this.maxResources=j,this.idle=new h,this.isClosed=!1,this.resources=j}acquire(j){this.isClosed?Promise.resolve(!1).then(j):this.resources>0?(this.resources--,Promise.resolve(!0).then(j)):this.idle.enqueue(j)}acquireSync(){return new Promise(j=>{this.acquire(j)})}release(){if(!this.isClosed){let j=this.idle.dequeue();j?Promise.resolve(!0).then(j):this.resources++}}close(){if(!this.isClosed)for(this.isClosed=!0;!this.idle.isEmpty();){let j=this.idle.dequeue();Promise.resolve(!1).then(j)}}};function C(){if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof globalThis<"u")return globalThis;if(typeof global<"u")return global}function E(j,Z){let ie=0,de=j.length;for(let me=0;me<de;me++)j[me]===Z&&(j.splice(me,1),me--,de--,ie++);return ie}var O=C(),_=O.WeakRef||(j=>j);function x(j){if(j!=null){if(typeof j=="object")return new _(j);console.error(j,j instanceof Object,typeof j);return}}function v(j){return j==null?void 0:j.deref()}var D="_MSG_BUS_RPC_",w=300*1e3,F=(j=>(j.PUBLISH="publish",j.SUBSCRIBE="subscribe",j.PUSH="push",j.PULL="pull",j))(F||{}),H=class{constructor(j){this.bus=j}processRemoteMessage(j,Z){let ie=x(Z),de=j.topic,me=j.type,Se=j.message;switch(me){case"pull":this.bus.pull(de,Re=>{this.push(de,Re,v(ie))});break;case"subscribe":this.bus.subscribe(de,Re=>{this.publish(de,Re,v(ie))});break;case"publish":this.bus.publish(de,Se,this,v(ie));break;case"push":this.bus.push(de,Se,this,v(ie));break;default:console.debug("unknown message type "+me)}}rpcCall(j,Z,ie,de=w){let me=x(ie),Se=new Promise(Re=>{let Je=this.bus.uniqueRpcTopic(j);this.publish(j,{message:Z,reply:Je},v(me)),this.bus.pull(Je,(Ke,Gt,Nr)=>{Re({message:Ke,bridge:Gt,source:x(Nr)})})});return de>0?Promise.race([Se,new Promise((Re,Je)=>{setTimeout(Je,de)})]):Se}},z=class extends H{constructor(j,Z){super(j),this.worker=Z,Z.onmessage=ie=>{this.processRemoteMessage(ie.data,void 0)}}publish(j,Z){this.postMessage(j,"publish",Z)}subscribe(j){this.postMessage(j,"subscribe",null)}push(j,Z){this.postMessage(j,"push",Z)}pull(j){this.postMessage(j,"pull",null)}rpcCall(j,Z,ie=w){return super.rpcCall(j,Z,void 0,ie)}postMessage(j,Z,ie){let de={topic:j,type:Z,message:ie};this.worker.postMessage(de)}discard(){this.worker.terminate()}},V=class extends H{constructor(j){super(j),window.addEventListener("message",Z=>{this.processRemoteMessage(Z.data,Z.source)},!1)}publish(j,Z,ie){this.postMessage(j,"publish",Z,ie)}subscribe(j,Z){if(Z===window)throw new Error("regist remote subscribe from current window is not permitted");this.postMessage(j,"subscribe",null,Z)}push(j,Z,ie){this.postMessage(j,"push",Z,ie)}pull(j,Z){if(Z===window)throw new Error("regist remote pull from current window is not permitted");this.postMessage(j,"pull",null,Z)}postMessage(j,Z,ie,de){let me={topic:j,type:Z,message:ie};de&&de.postMessage(me,"*")}},W=class{constructor(j){this.isRunning=!0,this.callback=j}cancel(){this.callback=null,this.isRunning=!1}running(){return this.isRunning}execute(j,Z,ie,de){try{j=de?j:b(j),this.callback(j,Z,ie)}catch(me){console.error(me)}}},L=class{constructor(j=!1){this.subscribed={},this.pulled={},this.pushed={},this.uuid=crypto.randomUUID().replace(/-/g,""),this.rpcTicket=0,this.unsafe=j}uniqueRpcTopic(j){return`${D}-${j}-${this.uuid}-${this.rpcTicket++}`}publish(j,Z,ie,de){let me=this.subscribed[j];if(me){let Se;for(let Re of me)Re.running()?Re.execute(Z,ie,de,this.unsafe):(Se=Se||new Array,Se.push(Re));if(Se)for(let Re of Se)E(me,Re)}else console.debug("no sub on topic: "+j)}subscribe(j,Z){let ie=new W(Z);return P(this.subscribed,j).push(ie),ie}push(j,Z,ie,de){let me=!1,Se=this.pulled[j];if(Se){for(;Se.length>0;){let Re=Se.shift();if(Re.running()){Re.execute(Z,ie,de,this.unsafe),me=!0;break}}Se.length===0&&delete this.pulled[j]}me||P(this.pushed,j).push({message:Z,bridge:ie,source:x(de)})}pull(j,Z){let ie=new W(Z),de=this.pushed[j];if(de){let me=de.shift();ie.execute(me.message,me.bridge,v(me.source),this.unsafe),de.length===0&&delete this.pushed[j]}else P(this.pulled,j).push(ie);return ie}pullA(j){return new Promise(Z=>{this.pull(j,(ie,de,me)=>{Z({message:ie,bridge:de,source:x(me)})})})}rpcService(j,Z){this.subscribe(j,(ie,de,me)=>{let{message:Se,reply:Re}=ie;try{let Je=Z(Se);if(Je instanceof Promise){let Ke=x(me);Je.then(Gt=>{this.rpcReply(Gt,Re,de,v(Ke))},Gt=>{console.error(Gt),this.rpcReply(void 0,Re,de,v(Ke))})}else this.rpcReply(Je,Re,de,me)}catch(Je){console.error(Je),this.rpcReply(void 0,Re,de,me)}})}rpcCall(j,Z,ie=w){let de=new Promise(me=>{let Se=this.uniqueRpcTopic(j);this.publish(j,{message:Z,reply:Se}),this.pull(Se,(Re,Je,Ke)=>{me({message:Re,bridge:Je,source:x(Ke)})})});return ie>0?Promise.race([de,new Promise((me,Se)=>{setTimeout(Se,ie)})]):de}rpcReply(j,Z,ie,de){ie?ie.push(Z,j,de):this.push(Z,j)}},k="_MSG_BUS_RPC_";function N(j,Z){let ie=0,de=j.length;for(let me=0;me<de;me++)j[me]===Z&&(j.splice(me,1),me--,de--,ie++);return ie}function U(j,Z){return B(j,Z,()=>[])}function B(j,Z,ie){let de=j[Z];return de!==void 0||(de=ie(Z),j[Z]=de),de}var G=class{constructor(j,Z){this.callback=j,this.unsafe=Z,this.isRunning=!0}cancel(){this.callback=null,this.isRunning=!1}running(){return this.isRunning}async execute(j){try{j=this.unsafe?j:b(j),this.callback(j)}catch(Z){console.error(Z)}}},Y=class{constructor(j=crypto.randomUUID()){this.uuid=j,this.rpcTicket=0}subscribeOnce(j,Z){let ie=this.subscribe(j,de=>{ie.cancel(),Z(de)});return ie}pullA(j){return new Promise(Z=>{this.pull(j,Z)})}rpcService(j,Z){let ie=de=>{try{let{message:me,replyTopic:Se}=de;try{let Re=Z(me);Re instanceof Promise?Re.then(Je=>{this.publish(Se,{success:!0,result:Je})}).catch(Je=>{console.error(Je),this.publish(Se,{success:!1,err:String(Je)})}):this.publish(Se,{success:!0,result:Re})}catch(Re){this.publish(Se,{success:!1,err:String(Re)})}}finally{this.pull(j,ie)}};this.pull(j,ie)}rpcCall(j,Z,ie=0){let de=new Promise((me,Se)=>{let Re=`${k}-${j}-${this.uuid}-${this.rpcTicket++}`;this.subscribeOnce(Re,Je=>{Je.success?me(Je.result):Se(new Error(Je.err))}),this.push(j,{message:Z,replyTopic:Re})});return ie>0?Promise.race([de,new Promise((me,Se)=>{setTimeout(Se,ie)})]):de}},X=class extends Y{constructor(j=!1){super(),this.unsafe=j,this.subscribed={},this.pulled={},this.pushed={}}publish(j,Z){let ie=this.subscribed[j];if(ie){let de;for(let me of ie)me.running()?me.execute(Z):(de=de||new Array,de.push(me));if(de)for(let me of de)N(ie,me)}}subscribe(j,Z){let ie=new G(Z,this.unsafe);return U(this.subscribed,j).push(ie),ie}push(j,Z){let ie=!1,de=this.pulled[j];if(de){for(;de.length>0;){let me=de.shift();if(me&&me.running()){me.execute(Z),ie=!0;break}}de.length===0&&delete this.pulled[j]}ie||U(this.pushed,j).push(Z)}pull(j,Z){let ie=new G(Z,this.unsafe);return this.repull(j,ie),ie}repull(j,Z){let ie=this.pushed[j];if(ie){let de=ie.shift();de&&(Z.execute(de),ie.length===0&&delete this.pushed[j])}else U(this.pulled,j).push(Z)}},K=class extends Y{constructor(j=crypto.randomUUID()){super(j),this.subscribed={},this.pushed={},this.pulled={},this.pushCnt=0}publish(j,Z){console.debug("BC",this.uuid,"PUBLISH",j,Z),this.broadcastPublish(j,Z)}subscribe(j,Z){console.debug("BC",this.uuid,"SUBSCRIBE",j);let ie=new G(Z,!0);return U(this.subscribed,j).push(ie),ie}push(j,Z){let ie=this.pushCnt++;console.debug("BC",this.uuid,"PUSH",j,`(${ie})`,Z),U(this.pushed,j).push({id:ie,message:Z}),this.broadcastPushedHeadMessage(j)}pull(j,Z){console.debug("BC",this.uuid,"PULL",j);let ie=new G(Z,!0);return U(this.pulled,j).push(ie),this.broadcastWhoHas(j),ie}broadcastPushedHeadMessage(j){let Z=this.pushed[j];Z&&Z[0]&&this.broadcastIHave(j,Z[0].id)}onReceivedPublish(j,Z,ie){console.debug("BCMSG(",this.uuid,")","from",j,"PUBLISH",Z,"message",ie);let de=this.subscribed[Z];if(de){let me;for(let Se of de)Se.running()?Se.execute(ie):(me=me||new Array,me.push(Se));if(me)for(let Se of me)N(de,Se);de.length===0&&delete this.subscribed[Z]}}onReceivedWhoHas(j,Z){console.debug("BCMSG(",this.uuid,")","from",j,"WHOHAS",Z),this.broadcastPushedHeadMessage(Z)}onReceivedIHave(j,Z,ie){console.debug("BCMSG(",this.uuid,")","from",j,"IHAVE",Z,"id",ie);let de=this.pulled[Z];if(de){let me;for(let Se of de)if(Se.running()){this.broadcastINeed(Z,j,ie);break}else me=me||new Array,me.push(Se);if(me)for(let Se of me)N(de,Se);de.length===0&&delete this.pulled[Z]}}onReceivedINeed(j,Z,ie,de){if(console.debug("BCMSG(",this.uuid,")","from",j,"INEED",Z,"source",ie,"id",de),this.uuid===ie){let me=this.pushed[Z];if(me&&me[0]&&me[0].id===de){let{message:Se}=me.shift();this.broadcastIGive(Z,de,j,Se),this.broadcastPushedHeadMessage(Z),me.length===0&&delete this.pushed[Z]}}}onReceivedIGive(j,Z,ie,de,me){console.debug("BCMSG(",this.uuid,")","from",j,"IGIVE",Z,"id",ie,"target",de,"message",me);let Se=this.pulled[Z];if(Se&&this.uuid===de){let Re=!1;for(;Se.length>0;){let Je=Se.shift();if(Je.running()){Je.execute(me),Re=!0;break}}Re||this.push(Z,me),Se.length===0&&delete this.pulled[Z]}}},J=class extends K{constructor(j,Z=crypto.randomUUID()){super(Z),this.bc=new BroadcastChannel(j),this.bc.onmessage=ie=>{this.onMessage(ie.data)}}onMessage(j){let{type:Z,uuid:ie,topic:de}=j;switch(Z){case"PUBLISH":{let{message:me}=j;this.onReceivedPublish(ie,de,me);break}case"WHOHAS":{this.onReceivedWhoHas(ie,de);break}case"IHAVE":{let{id:me}=j;this.onReceivedIHave(ie,de,me);break}case"INEED":{let{source:me,id:Se}=j;this.onReceivedINeed(ie,de,me,Se);break}case"IGIVE":{let{target:me,id:Se,message:Re}=j;this.onReceivedIGive(ie,de,Se,me,Re);break}default:console.warn("unsupported",j)}}broadcastPublish(j,Z){this.post({type:"PUBLISH",uuid:this.uuid,topic:j,message:Z})}broadcastWhoHas(j){this.post({type:"WHOHAS",uuid:this.uuid,topic:j})}broadcastIHave(j,Z){this.post({type:"IHAVE",uuid:this.uuid,topic:j,id:Z})}broadcastINeed(j,Z,ie){this.post({type:"INEED",uuid:this.uuid,topic:j,source:Z,id:ie})}broadcastIGive(j,Z,ie,de){this.post({type:"IGIVE",uuid:this.uuid,topic:j,id:Z,target:ie,message:de})}post(j){this.bc.postMessage(j),Promise.resolve().then(()=>{this.onMessage(j)})}},se=Symbol("BLOCKING_QUEUE_RESET"),ce=class{constructor(j,Z=()=>1){if(this.maxSize=j,this.itemSizeOf=Z,this.queue=new h,this.waitingConsumers=new h,this.waitingProducers=new h,this.queueSize=0,this.closePromise=null,this.closeResolve=null,j<=0)throw new Error("Max size must be greater than 0")}enqueue(j){return this.closePromise?!1:this.isFull()?(async()=>{console.debug("queue is full",this.queueSize,this.maxSize);let Z=await new Promise(ie=>{this.waitingProducers.enqueue(ie)});return console.debug("queue is not full",this.size(),Z),Z?(this.innerEnqueue(j),!0):!1})():(this.innerEnqueue(j),!0)}innerEnqueue(j){if(this.waitingConsumers.isEmpty())this.queue.enqueue(j),this.queueSize+=this.itemSizeOf(j),console.debug("queue pushed",j,"size",this.queueSize);else{let Z=this.waitingConsumers.dequeue();Promise.resolve(j).then(Z),console.debug("queue direct",j,"size",this.queueSize)}}dequeue(){if(this.queue.isEmpty())if(this.closePromise){for(;!this.waitingConsumers.isEmpty();){let j=this.waitingConsumers.dequeue();Promise.resolve(se).then(j)}return setTimeout(()=>this.closeResolve(),0),se}else return new Promise(j=>{this.waitingConsumers.enqueue(j)});else{let j=this.queue.dequeue();if(this.queueSize-=this.itemSizeOf(j),!this.waitingProducers.isEmpty()){let Z=this.waitingProducers.dequeue();Promise.resolve(!0).then(Z)}return j}}size(){return this.queueSize}isEmpty(){return this.queueSize===0}isFull(){return this.queueSize>=this.maxSize}close(){return this.closePromise||(this.closePromise=new Promise(j=>{for(this.closeResolve=j;!this.waitingProducers.isEmpty();){let Z=this.waitingProducers.dequeue();Promise.resolve(!1).then(Z)}if(this.queueSize===0){for(;!this.waitingConsumers.isEmpty();){let Z=this.waitingConsumers.dequeue();Promise.resolve(se).then(Z)}j()}})),this.closePromise}};function te(j,Z,ie=Number.MAX_SAFE_INTEGER){let de=new ce(ie,Z),me=new ReadableStream({pull(Re){let Je=!0,Ke=(async()=>{let Gt=new Array;do{let Nr=de.dequeue();if(Nr instanceof Promise){Je=!1;let xr=await Nr;xr===se?Re.close():Gt.push(xr)}else{let xr=Nr;xr===se?Re.close():Gt.push(xr)}}while(de.size()>0);if(Gt.length>0){let Nr=j(Gt);Re.enqueue(Nr)}})();if(!Je)return console.debug("read stream stucked --------------------------------------"),Ke},async cancel(){console.debug("buffered readable cancel"),await de.close()}}),Se=new WritableStream({write(Re,Je){let Ke=!0,Gt=(async()=>{let Nr=de.enqueue(Re);typeof Nr=="boolean"?Nr||Je.error(new Error("Write stream closed")):(Ke=!1,await Nr||Je.error(new Error("Write stream closed")))})();if(!Ke)return console.debug("read stream stucked >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"),Gt},async close(){console.debug("buffered writable closing",de.size()),await de.close(),console.debug("buffered writable closed",de.size())},async abort(){console.debug("buffered writable aborting",de.size()),await de.close(),console.debug("buffered writable aborted",de.size())}});return{readable:me,writable:Se}}function oe(j=Number.MAX_SAFE_INTEGER){return te(Z=>Z.join(""),Z=>Z.length,j)}function $(j=Number.MAX_SAFE_INTEGER){return te(Z=>{let ie=new Uint8Array(Z.reduce((me,Se)=>me+Se.byteLength,0)),de=0;return Z.forEach(me=>{ie.set(me,de),de+=me.byteLength}),ie},Z=>Z.byteLength,j)}function fe(j){return new Promise((Z,ie)=>{let de=new BroadcastChannel(j),me=new ce(1),Se=new I(1),Re=null,Je=!1,Ke=!1,Gt=!1;de.onmessage=Nr=>{let xr=Nr.data,{type:vr}=xr;if(console.debug("p2p",j,"type",vr,"data",vr==="DATA"&&xr.data),vr==="DATA")me.enqueue(xr.data);else if(vr==="HI"){if(!Re){de.postMessage({type:"HI"});let Ft=0;Re={rs:new ReadableStream({async pull(ir){let Fe=await me.dequeue();Fe===se?(await Ne(),ir.close()):(ir.enqueue(Fe),de.postMessage({type:"ACK"}))},cancel(){return Ne()}}),ws:new WritableStream({async write(ir,Fe){await Se.acquireSync()?de.postMessage({type:"DATA",id:Ft++,data:ir}):(_r(),Fe.error(new Error("Write stream closed")))},close(){_r()},abort(){_r()}})},Z(Re)}}else vr==="REND"?Re?Se.close():Vt("REND1"):vr==="WEND"?Re?me.close():Vt("WEND1"):vr==="ACK"&&Se.release();function _r(){Je||(Je=!0,console.debug(j,"p2p write stream closed"),Se.close(),de.postMessage({type:"WEND"}),Ke&&(console.debug(j,"p2p channel closed on ws"),de.close()))}async function Ne(){Ke||(Ke=!0,console.debug(j,"p2p read stream closed"),de.postMessage({type:"REND"}),await me.close(),Je&&(console.debug(j,"p2p channel closed on rs"),de.close()))}async function Vt(Ft){Gt||(Gt=!0,console.debug(j,"p2p channel connection released on",Ft),Se.close(),me.close(),Re?(Re.rs.locked||(console.debug(j,"p2p unlocked read stream direct cancel"),Re.rs.cancel()),Re.ws.locked||(console.debug(j,"p2p unlocked write stream direct close"),Re.ws.close())):(de.postMessage({type:"HI"}),de.close()),ie(new Error("p2p channel connection released")))}},de.postMessage({type:"HI"})})}function Oe(j){return new Promise(Z=>{let ie=new BroadcastChannel(j);ie.onmessage=de=>{let me=de.data,{type:Se}=me;Se==="HI"&&(ie.postMessage({type:"REND"}),ie.close(),Z())},ie.postMessage({type:"REND"})})}async function Te(j){try{return await fe(j)}catch(Z){Z.message!=="p2p channel connection released"&&console.error(Z)}}async function ue(j,Z,ie=10*1024*1024,de=!0){let me=await Te(j);if(!me)return!1;let Se=!1;try{let Re,Je=Ke=>{if(!Re)if(!de)Re=me.ws.getWriter();else if(typeof Ke=="string"){let Gt=oe(ie);Gt.readable.pipeTo(me.ws),Re=Gt.writable.getWriter()}else{let Gt=$(ie);Gt.readable.pipeTo(me.ws),Re=Gt.writable.getWriter()}return Re.write(Ke)};if(Array.isArray(Z))for(let Ke of Z)await Je(Ke);else await Z({write:Je,get desiredSize(){return((Re==null?void 0:Re.desiredSize)||0)+10}});Re&&await Re.close(),Se=!0}catch(Re){console.error(Re)}finally{return me.rs.cancel(),Se}}async function be(j,Z){var ie,de;let me=await Te(j);if(me)try{let Se=me.rs.getReader();for((ie=Z.start)==null?void 0:ie.call(Z);;){let{value:Re,done:Je}=await Se.read();if(Re!==void 0){let Ke;if(Z.update instanceof Promise?Ke=await Z.update(Re):Ke=Z.update(Re),Ke){await Se.cancel();break}}if(Je){(de=Z.end)==null||de.call(Z);break}}}catch(Se){console.error(Se)}finally{me.ws.close()}}}),yc=Gl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r():typeof define=="function"&&define.amd?define([],r):e.CryptoJS=r()})(o,function(){var e=e||(function(r,i){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof global<"u"&&global.crypto&&(n=global.crypto),!n&&typeof dMe=="function")try{n=dMe("crypto")}catch{}var s=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||(function(){function T(){}return function(I){var C;return T.prototype=I,C=new T,T.prototype=null,C}})(),l={},c=l.lib={},h=c.Base=(function(){return{extend:function(T){var I=a(this);return T&&I.mixIn(T),(!I.hasOwnProperty("init")||this.init===I.init)&&(I.init=function(){I.$super.init.apply(this,arguments)}),I.init.prototype=I,I.$super=this,I},create:function(){var T=this.extend();return T.init.apply(T,arguments),T},init:function(){},mixIn:function(T){for(var I in T)T.hasOwnProperty(I)&&(this[I]=T[I]);T.hasOwnProperty("toString")&&(this.toString=T.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),u=c.WordArray=h.extend({init:function(T,I){T=this.words=T||[],I!=i?this.sigBytes=I:this.sigBytes=T.length*4},toString:function(T){return(T||p).stringify(this)},concat:function(T){var I=this.words,C=T.words,E=this.sigBytes,O=T.sigBytes;if(this.clamp(),E%4)for(var _=0;_<O;_++){var x=C[_>>>2]>>>24-_%4*8&255;I[E+_>>>2]|=x<<24-(E+_)%4*8}else for(var v=0;v<O;v+=4)I[E+v>>>2]=C[v>>>2];return this.sigBytes+=O,this},clamp:function(){var T=this.words,I=this.sigBytes;T[I>>>2]&=4294967295<<32-I%4*8,T.length=r.ceil(I/4)},clone:function(){var T=h.clone.call(this);return T.words=this.words.slice(0),T},random:function(T){for(var I=[],C=0;C<T;C+=4)I.push(s());return new u.init(I,T)}}),d=l.enc={},p=d.Hex={stringify:function(T){for(var I=T.words,C=T.sigBytes,E=[],O=0;O<C;O++){var _=I[O>>>2]>>>24-O%4*8&255;E.push((_>>>4).toString(16)),E.push((_&15).toString(16))}return E.join("")},parse:function(T){for(var I=T.length,C=[],E=0;E<I;E+=2)C[E>>>3]|=parseInt(T.substr(E,2),16)<<24-E%8*4;return new u.init(C,I/2)}},m=d.Latin1={stringify:function(T){for(var I=T.words,C=T.sigBytes,E=[],O=0;O<C;O++){var _=I[O>>>2]>>>24-O%4*8&255;E.push(String.fromCharCode(_))}return E.join("")},parse:function(T){for(var I=T.length,C=[],E=0;E<I;E++)C[E>>>2]|=(T.charCodeAt(E)&255)<<24-E%4*8;return new u.init(C,I)}},g=d.Utf8={stringify:function(T){try{return decodeURIComponent(escape(m.stringify(T)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(T){return m.parse(unescape(encodeURIComponent(T)))}},y=c.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(T){typeof T=="string"&&(T=g.parse(T)),this._data.concat(T),this._nDataBytes+=T.sigBytes},_process:function(T){var I,C=this._data,E=C.words,O=C.sigBytes,_=this.blockSize,x=_*4,v=O/x;T?v=r.ceil(v):v=r.max((v|0)-this._minBufferSize,0);var D=v*_,w=r.min(D*4,O);if(D){for(var F=0;F<D;F+=_)this._doProcessBlock(E,F);I=E.splice(0,D),C.sigBytes-=w}return new u.init(I,w)},clone:function(){var T=h.clone.call(this);return T._data=this._data.clone(),T},_minBufferSize:0}),b=c.Hasher=y.extend({cfg:h.extend(),init:function(T){this.cfg=this.cfg.extend(T),this.reset()},reset:function(){y.reset.call(this),this._doReset()},update:function(T){return this._append(T),this._process(),this},finalize:function(T){T&&this._append(T);var I=this._doFinalize();return I},blockSize:512/32,_createHelper:function(T){return function(I,C){return new T.init(C).finalize(I)}},_createHmacHelper:function(T){return function(I,C){return new P.HMAC.init(T,C).finalize(I)}}}),P=l.algo={};return l})(Math);return e})}),jJ=Gl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(yc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.Base,a=n.WordArray,l=i.x64={},c=l.Word=s.extend({init:function(u,d){this.high=u,this.low=d}}),h=l.WordArray=s.extend({init:function(u,d){u=this.words=u||[],d!=r?this.sigBytes=d:this.sigBytes=u.length*8},toX32:function(){for(var u=this.words,d=u.length,p=[],m=0;m<d;m++){var g=u[m];p.push(g.high),p.push(g.low)}return a.create(p,this.sigBytes)},clone:function(){for(var u=s.clone.call(this),d=u.words=this.words.slice(0),p=d.length,m=0;m<p;m++)d[m]=d[m].clone();return u}})})(),e})}),sut=Gl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(yc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){if(typeof ArrayBuffer=="function"){var r=e,i=r.lib,n=i.WordArray,s=n.init,a=n.init=function(l){if(l instanceof ArrayBuffer&&(l=new Uint8Array(l)),(l instanceof Int8Array||typeof Uint8ClampedArray<"u"&&l instanceof Uint8ClampedArray||l instanceof Int16Array||l instanceof Uint16Array||l instanceof Int32Array||l instanceof Uint32Array||l instanceof Float32Array||l instanceof Float64Array)&&(l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength)),l instanceof Uint8Array){for(var c=l.byteLength,h=[],u=0;u<c;u++)h[u>>>2]|=l[u]<<24-u%4*8;s.call(this,h,c)}else s.apply(this,arguments)};a.prototype=n}})(),e.lib.WordArray})}),aut=Gl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(yc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=r.enc,a=s.Utf16=s.Utf16BE={stringify:function(c){for(var h=c.words,u=c.sigBytes,d=[],p=0;p<u;p+=2){var m=h[p>>>2]>>>16-p%4*8&65535;d.push(String.fromCharCode(m))}return d.join("")},parse:function(c){for(var h=c.length,u=[],d=0;d<h;d++)u[d>>>1]|=c.charCodeAt(d)<<16-d%2*16;return n.create(u,h*2)}};s.Utf16LE={stringify:function(c){for(var h=c.words,u=c.sigBytes,d=[],p=0;p<u;p+=2){var m=l(h[p>>>2]>>>16-p%4*8&65535);d.push(String.fromCharCode(m))}return d.join("")},parse:function(c){for(var h=c.length,u=[],d=0;d<h;d++)u[d>>>1]|=l(c.charCodeAt(d)<<16-d%2*16);return n.create(u,h*2)}};function l(c){return c<<8&4278255360|c>>>8&16711935}})(),e.enc.Utf16})}),Gw=Gl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(yc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=r.enc,a=s.Base64={stringify:function(c){var h=c.words,u=c.sigBytes,d=this._map;c.clamp();for(var p=[],m=0;m<u;m+=3)for(var g=h[m>>>2]>>>24-m%4*8&255,y=h[m+1>>>2]>>>24-(m+1)%4*8&255,b=h[m+2>>>2]>>>24-(m+2)%4*8&255,P=g<<16|y<<8|b,T=0;T<4&&m+T*.75<u;T++)p.push(d.charAt(P>>>6*(3-T)&63));var I=d.charAt(64);if(I)for(;p.length%4;)p.push(I);return p.join("")},parse:function(c){var h=c.length,u=this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var p=0;p<u.length;p++)d[u.charCodeAt(p)]=p}var m=u.charAt(64);if(m){var g=c.indexOf(m);g!==-1&&(h=g)}return l(c,h,d)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function l(c,h,u){for(var d=[],p=0,m=0;m<h;m++)if(m%4){var g=u[c.charCodeAt(m-1)]<<m%4*2,y=u[c.charCodeAt(m)]>>>6-m%4*2,b=g|y;d[p>>>2]|=b<<24-p%4*8,p++}return n.create(d,p)}})(),e.enc.Base64})}),lut=Gl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(yc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=r.enc,a=s.Base64url={stringify:function(c,h){h===void 0&&(h=!0);var u=c.words,d=c.sigBytes,p=h?this._safe_map:this._map;c.clamp();for(var m=[],g=0;g<d;g+=3)for(var y=u[g>>>2]>>>24-g%4*8&255,b=u[g+1>>>2]>>>24-(g+1)%4*8&255,P=u[g+2>>>2]>>>24-(g+2)%4*8&255,T=y<<16|b<<8|P,I=0;I<4&&g+I*.75<d;I++)m.push(p.charAt(T>>>6*(3-I)&63));var C=p.charAt(64);if(C)for(;m.length%4;)m.push(C);return m.join("")},parse:function(c,h){h===void 0&&(h=!0);var u=c.length,d=h?this._safe_map:this._map,p=this._reverseMap;if(!p){p=this._reverseMap=[];for(var m=0;m<d.length;m++)p[d.charCodeAt(m)]=m}var g=d.charAt(64);if(g){var y=c.indexOf(g);y!==-1&&(u=y)}return l(c,u,p)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function l(c,h,u){for(var d=[],p=0,m=0;m<h;m++)if(m%4){var g=u[c.charCodeAt(m-1)]<<m%4*2,y=u[c.charCodeAt(m)]>>>6-m%4*2,b=g|y;d[p>>>2]|=b<<24-p%4*8,p++}return n.create(d,p)}})(),e.enc.Base64url})}),Uw=Gl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(yc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.WordArray,a=n.Hasher,l=i.algo,c=[];(function(){for(var g=0;g<64;g++)c[g]=r.abs(r.sin(g+1))*4294967296|0})();var h=l.MD5=a.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(g,y){for(var b=0;b<16;b++){var P=y+b,T=g[P];g[P]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360}var I=this._hash.words,C=g[y+0],E=g[y+1],O=g[y+2],_=g[y+3],x=g[y+4],v=g[y+5],D=g[y+6],w=g[y+7],F=g[y+8],H=g[y+9],z=g[y+10],V=g[y+11],W=g[y+12],L=g[y+13],k=g[y+14],N=g[y+15],U=I[0],B=I[1],G=I[2],Y=I[3];U=u(U,B,G,Y,C,7,c[0]),Y=u(Y,U,B,G,E,12,c[1]),G=u(G,Y,U,B,O,17,c[2]),B=u(B,G,Y,U,_,22,c[3]),U=u(U,B,G,Y,x,7,c[4]),Y=u(Y,U,B,G,v,12,c[5]),G=u(G,Y,U,B,D,17,c[6]),B=u(B,G,Y,U,w,22,c[7]),U=u(U,B,G,Y,F,7,c[8]),Y=u(Y,U,B,G,H,12,c[9]),G=u(G,Y,U,B,z,17,c[10]),B=u(B,G,Y,U,V,22,c[11]),U=u(U,B,G,Y,W,7,c[12]),Y=u(Y,U,B,G,L,12,c[13]),G=u(G,Y,U,B,k,17,c[14]),B=u(B,G,Y,U,N,22,c[15]),U=d(U,B,G,Y,E,5,c[16]),Y=d(Y,U,B,G,D,9,c[17]),G=d(G,Y,U,B,V,14,c[18]),B=d(B,G,Y,U,C,20,c[19]),U=d(U,B,G,Y,v,5,c[20]),Y=d(Y,U,B,G,z,9,c[21]),G=d(G,Y,U,B,N,14,c[22]),B=d(B,G,Y,U,x,20,c[23]),U=d(U,B,G,Y,H,5,c[24]),Y=d(Y,U,B,G,k,9,c[25]),G=d(G,Y,U,B,_,14,c[26]),B=d(B,G,Y,U,F,20,c[27]),U=d(U,B,G,Y,L,5,c[28]),Y=d(Y,U,B,G,O,9,c[29]),G=d(G,Y,U,B,w,14,c[30]),B=d(B,G,Y,U,W,20,c[31]),U=p(U,B,G,Y,v,4,c[32]),Y=p(Y,U,B,G,F,11,c[33]),G=p(G,Y,U,B,V,16,c[34]),B=p(B,G,Y,U,k,23,c[35]),U=p(U,B,G,Y,E,4,c[36]),Y=p(Y,U,B,G,x,11,c[37]),G=p(G,Y,U,B,w,16,c[38]),B=p(B,G,Y,U,z,23,c[39]),U=p(U,B,G,Y,L,4,c[40]),Y=p(Y,U,B,G,C,11,c[41]),G=p(G,Y,U,B,_,16,c[42]),B=p(B,G,Y,U,D,23,c[43]),U=p(U,B,G,Y,H,4,c[44]),Y=p(Y,U,B,G,W,11,c[45]),G=p(G,Y,U,B,N,16,c[46]),B=p(B,G,Y,U,O,23,c[47]),U=m(U,B,G,Y,C,6,c[48]),Y=m(Y,U,B,G,w,10,c[49]),G=m(G,Y,U,B,k,15,c[50]),B=m(B,G,Y,U,v,21,c[51]),U=m(U,B,G,Y,W,6,c[52]),Y=m(Y,U,B,G,_,10,c[53]),G=m(G,Y,U,B,z,15,c[54]),B=m(B,G,Y,U,E,21,c[55]),U=m(U,B,G,Y,F,6,c[56]),Y=m(Y,U,B,G,N,10,c[57]),G=m(G,Y,U,B,D,15,c[58]),B=m(B,G,Y,U,L,21,c[59]),U=m(U,B,G,Y,x,6,c[60]),Y=m(Y,U,B,G,V,10,c[61]),G=m(G,Y,U,B,O,15,c[62]),B=m(B,G,Y,U,H,21,c[63]),I[0]=I[0]+U|0,I[1]=I[1]+B|0,I[2]=I[2]+G|0,I[3]=I[3]+Y|0},_doFinalize:function(){var g=this._data,y=g.words,b=this._nDataBytes*8,P=g.sigBytes*8;y[P>>>5]|=128<<24-P%32;var T=r.floor(b/4294967296),I=b;y[(P+64>>>9<<4)+15]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360,y[(P+64>>>9<<4)+14]=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360,g.sigBytes=(y.length+1)*4,this._process();for(var C=this._hash,E=C.words,O=0;O<4;O++){var _=E[O];E[O]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360}return C},clone:function(){var g=a.clone.call(this);return g._hash=this._hash.clone(),g}});function u(g,y,b,P,T,I,C){var E=g+(y&b|~y&P)+T+C;return(E<<I|E>>>32-I)+y}function d(g,y,b,P,T,I,C){var E=g+(y&P|b&~P)+T+C;return(E<<I|E>>>32-I)+y}function p(g,y,b,P,T,I,C){var E=g+(y^b^P)+T+C;return(E<<I|E>>>32-I)+y}function m(g,y,b,P,T,I,C){var E=g+(b^(y|~P))+T+C;return(E<<I|E>>>32-I)+y}i.MD5=a._createHelper(h),i.HmacMD5=a._createHmacHelper(h)})(Math),e.MD5})}),n4e=Gl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(yc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=i.Hasher,a=r.algo,l=[],c=a.SHA1=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(h,u){for(var d=this._hash.words,p=d[0],m=d[1],g=d[2],y=d[3],b=d[4],P=0;P<80;P++){if(P<16)l[P]=h[u+P]|0;else{var T=l[P-3]^l[P-8]^l[P-14]^l[P-16];l[P]=T<<1|T>>>31}var I=(p<<5|p>>>27)+b+l[P];P<20?I+=(m&g|~m&y)+1518500249:P<40?I+=(m^g^y)+1859775393:P<60?I+=(m&g|m&y|g&y)-1894007588:I+=(m^g^y)-899497514,b=y,y=g,g=m<<30|m>>>2,m=p,p=I}d[0]=d[0]+p|0,d[1]=d[1]+m|0,d[2]=d[2]+g|0,d[3]=d[3]+y|0,d[4]=d[4]+b|0},_doFinalize:function(){var h=this._data,u=h.words,d=this._nDataBytes*8,p=h.sigBytes*8;return u[p>>>5]|=128<<24-p%32,u[(p+64>>>9<<4)+14]=Math.floor(d/4294967296),u[(p+64>>>9<<4)+15]=d,h.sigBytes=u.length*4,this._process(),this._hash},clone:function(){var h=s.clone.call(this);return h._hash=this._hash.clone(),h}});r.SHA1=s._createHelper(c),r.HmacSHA1=s._createHmacHelper(c)})(),e.SHA1})}),ube=Gl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(yc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.WordArray,a=n.Hasher,l=i.algo,c=[],h=[];(function(){function p(b){for(var P=r.sqrt(b),T=2;T<=P;T++)if(!(b%T))return!1;return!0}function m(b){return(b-(b|0))*4294967296|0}for(var g=2,y=0;y<64;)p(g)&&(y<8&&(c[y]=m(r.pow(g,1/2))),h[y]=m(r.pow(g,1/3)),y++),g++})();var u=[],d=l.SHA256=a.extend({_doReset:function(){this._hash=new s.init(c.slice(0))},_doProcessBlock:function(p,m){for(var g=this._hash.words,y=g[0],b=g[1],P=g[2],T=g[3],I=g[4],C=g[5],E=g[6],O=g[7],_=0;_<64;_++){if(_<16)u[_]=p[m+_]|0;else{var x=u[_-15],v=(x<<25|x>>>7)^(x<<14|x>>>18)^x>>>3,D=u[_-2],w=(D<<15|D>>>17)^(D<<13|D>>>19)^D>>>10;u[_]=v+u[_-7]+w+u[_-16]}var F=I&C^~I&E,H=y&b^y&P^b&P,z=(y<<30|y>>>2)^(y<<19|y>>>13)^(y<<10|y>>>22),V=(I<<26|I>>>6)^(I<<21|I>>>11)^(I<<7|I>>>25),W=O+V+F+h[_]+u[_],L=z+H;O=E,E=C,C=I,I=T+W|0,T=P,P=b,b=y,y=W+L|0}g[0]=g[0]+y|0,g[1]=g[1]+b|0,g[2]=g[2]+P|0,g[3]=g[3]+T|0,g[4]=g[4]+I|0,g[5]=g[5]+C|0,g[6]=g[6]+E|0,g[7]=g[7]+O|0},_doFinalize:function(){var p=this._data,m=p.words,g=this._nDataBytes*8,y=p.sigBytes*8;return m[y>>>5]|=128<<24-y%32,m[(y+64>>>9<<4)+14]=r.floor(g/4294967296),m[(y+64>>>9<<4)+15]=g,p.sigBytes=m.length*4,this._process(),this._hash},clone:function(){var p=a.clone.call(this);return p._hash=this._hash.clone(),p}});i.SHA256=a._createHelper(d),i.HmacSHA256=a._createHmacHelper(d)})(Math),e.SHA256})}),cut=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),ube()):typeof define=="function"&&define.amd?define(["./core","./sha256"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=r.algo,a=s.SHA256,l=s.SHA224=a.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var c=a._doFinalize.call(this);return c.sigBytes-=4,c}});r.SHA224=a._createHelper(l),r.HmacSHA224=a._createHmacHelper(l)})(),e.SHA224})}),o4e=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),jJ()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.Hasher,s=r.x64,a=s.Word,l=s.WordArray,c=r.algo;function h(){return a.create.apply(a,arguments)}var u=[h(1116352408,3609767458),h(1899447441,602891725),h(3049323471,3964484399),h(3921009573,2173295548),h(961987163,4081628472),h(1508970993,3053834265),h(2453635748,2937671579),h(2870763221,3664609560),h(3624381080,2734883394),h(310598401,1164996542),h(607225278,1323610764),h(1426881987,3590304994),h(1925078388,4068182383),h(2162078206,991336113),h(2614888103,633803317),h(3248222580,3479774868),h(3835390401,2666613458),h(4022224774,944711139),h(264347078,2341262773),h(604807628,2007800933),h(770255983,1495990901),h(1249150122,1856431235),h(1555081692,3175218132),h(1996064986,2198950837),h(2554220882,3999719339),h(2821834349,766784016),h(2952996808,2566594879),h(3210313671,3203337956),h(3336571891,1034457026),h(3584528711,2466948901),h(113926993,3758326383),h(338241895,168717936),h(666307205,1188179964),h(773529912,1546045734),h(1294757372,1522805485),h(1396182291,2643833823),h(1695183700,2343527390),h(1986661051,1014477480),h(2177026350,1206759142),h(2456956037,344077627),h(2730485921,1290863460),h(2820302411,3158454273),h(3259730800,3505952657),h(3345764771,106217008),h(3516065817,3606008344),h(3600352804,1432725776),h(4094571909,1467031594),h(275423344,851169720),h(430227734,3100823752),h(506948616,1363258195),h(659060556,3750685593),h(883997877,3785050280),h(958139571,3318307427),h(1322822218,3812723403),h(1537002063,2003034995),h(1747873779,3602036899),h(1955562222,1575990012),h(2024104815,1125592928),h(2227730452,2716904306),h(2361852424,442776044),h(2428436474,593698344),h(2756734187,3733110249),h(3204031479,2999351573),h(3329325298,3815920427),h(3391569614,3928383900),h(3515267271,566280711),h(3940187606,3454069534),h(4118630271,4000239992),h(116418474,1914138554),h(174292421,2731055270),h(289380356,3203993006),h(460393269,320620315),h(685471733,587496836),h(852142971,1086792851),h(1017036298,365543100),h(1126000580,2618297676),h(1288033470,3409855158),h(1501505948,4234509866),h(1607167915,987167468),h(1816402316,1246189591)],d=[];(function(){for(var m=0;m<80;m++)d[m]=h()})();var p=c.SHA512=n.extend({_doReset:function(){this._hash=new l.init([new a.init(1779033703,4089235720),new a.init(3144134277,2227873595),new a.init(1013904242,4271175723),new a.init(2773480762,1595750129),new a.init(1359893119,2917565137),new a.init(2600822924,725511199),new a.init(528734635,4215389547),new a.init(1541459225,327033209)])},_doProcessBlock:function(m,g){for(var y=this._hash.words,b=y[0],P=y[1],T=y[2],I=y[3],C=y[4],E=y[5],O=y[6],_=y[7],x=b.high,v=b.low,D=P.high,w=P.low,F=T.high,H=T.low,z=I.high,V=I.low,W=C.high,L=C.low,k=E.high,N=E.low,U=O.high,B=O.low,G=_.high,Y=_.low,X=x,K=v,J=D,se=w,ce=F,te=H,oe=z,$=V,fe=W,Oe=L,Te=k,ue=N,be=U,j=B,Z=G,ie=Y,de=0;de<80;de++){var me,Se,Re=d[de];if(de<16)Se=Re.high=m[g+de*2]|0,me=Re.low=m[g+de*2+1]|0;else{var Je=d[de-15],Ke=Je.high,Gt=Je.low,Nr=(Ke>>>1|Gt<<31)^(Ke>>>8|Gt<<24)^Ke>>>7,xr=(Gt>>>1|Ke<<31)^(Gt>>>8|Ke<<24)^(Gt>>>7|Ke<<25),vr=d[de-2],_r=vr.high,Ne=vr.low,Vt=(_r>>>19|Ne<<13)^(_r<<3|Ne>>>29)^_r>>>6,Ft=(Ne>>>19|_r<<13)^(Ne<<3|_r>>>29)^(Ne>>>6|_r<<26),ir=d[de-7],Fe=ir.high,tt=ir.low,ye=d[de-16],yt=ye.high,Wt=ye.low;me=xr+tt,Se=Nr+Fe+(me>>>0<xr>>>0?1:0),me=me+Ft,Se=Se+Vt+(me>>>0<Ft>>>0?1:0),me=me+Wt,Se=Se+yt+(me>>>0<Wt>>>0?1:0),Re.high=Se,Re.low=me}var pe=fe&Te^~fe&be,Xe=Oe&ue^~Oe&j,ct=X&J^X&ce^J&ce,Me=K&se^K&te^se&te,st=(X>>>28|K<<4)^(X<<30|K>>>2)^(X<<25|K>>>7),Ot=(K>>>28|X<<4)^(K<<30|X>>>2)^(K<<25|X>>>7),hr=(fe>>>14|Oe<<18)^(fe>>>18|Oe<<14)^(fe<<23|Oe>>>9),Or=(Oe>>>14|fe<<18)^(Oe>>>18|fe<<14)^(Oe<<23|fe>>>9),Xr=u[de],Oi=Xr.high,qi=Xr.low,Ni=ie+Or,Wi=Z+hr+(Ni>>>0<ie>>>0?1:0),Ni=Ni+Xe,Wi=Wi+pe+(Ni>>>0<Xe>>>0?1:0),Ni=Ni+qi,Wi=Wi+Oi+(Ni>>>0<qi>>>0?1:0),Ni=Ni+me,Wi=Wi+Se+(Ni>>>0<me>>>0?1:0),fo=Ot+Me,tl=st+ct+(fo>>>0<Ot>>>0?1:0);Z=be,ie=j,be=Te,j=ue,Te=fe,ue=Oe,Oe=$+Ni|0,fe=oe+Wi+(Oe>>>0<$>>>0?1:0)|0,oe=ce,$=te,ce=J,te=se,J=X,se=K,K=Ni+fo|0,X=Wi+tl+(K>>>0<Ni>>>0?1:0)|0}v=b.low=v+K,b.high=x+X+(v>>>0<K>>>0?1:0),w=P.low=w+se,P.high=D+J+(w>>>0<se>>>0?1:0),H=T.low=H+te,T.high=F+ce+(H>>>0<te>>>0?1:0),V=I.low=V+$,I.high=z+oe+(V>>>0<$>>>0?1:0),L=C.low=L+Oe,C.high=W+fe+(L>>>0<Oe>>>0?1:0),N=E.low=N+ue,E.high=k+Te+(N>>>0<ue>>>0?1:0),B=O.low=B+j,O.high=U+be+(B>>>0<j>>>0?1:0),Y=_.low=Y+ie,_.high=G+Z+(Y>>>0<ie>>>0?1:0)},_doFinalize:function(){var m=this._data,g=m.words,y=this._nDataBytes*8,b=m.sigBytes*8;g[b>>>5]|=128<<24-b%32,g[(b+128>>>10<<5)+30]=Math.floor(y/4294967296),g[(b+128>>>10<<5)+31]=y,m.sigBytes=g.length*4,this._process();var P=this._hash.toX32();return P},clone:function(){var m=n.clone.call(this);return m._hash=this._hash.clone(),m},blockSize:1024/32});r.SHA512=n._createHelper(p),r.HmacSHA512=n._createHmacHelper(p)})(),e.SHA512})}),hut=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),jJ(),o4e()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.x64,n=i.Word,s=i.WordArray,a=r.algo,l=a.SHA512,c=a.SHA384=l.extend({_doReset:function(){this._hash=new s.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var h=l._doFinalize.call(this);return h.sigBytes-=16,h}});r.SHA384=l._createHelper(c),r.HmacSHA384=l._createHmacHelper(c)})(),e.SHA384})}),uut=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),jJ()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.WordArray,a=n.Hasher,l=i.x64,c=l.Word,h=i.algo,u=[],d=[],p=[];(function(){for(var y=1,b=0,P=0;P<24;P++){u[y+5*b]=(P+1)*(P+2)/2%64;var T=b%5,I=(2*y+3*b)%5;y=T,b=I}for(var y=0;y<5;y++)for(var b=0;b<5;b++)d[y+5*b]=b+(2*y+3*b)%5*5;for(var C=1,E=0;E<24;E++){for(var O=0,_=0,x=0;x<7;x++){if(C&1){var v=(1<<x)-1;v<32?_^=1<<v:O^=1<<v-32}C&128?C=C<<1^113:C<<=1}p[E]=c.create(O,_)}})();var m=[];(function(){for(var y=0;y<25;y++)m[y]=c.create()})();var g=h.SHA3=a.extend({cfg:a.cfg.extend({outputLength:512}),_doReset:function(){for(var y=this._state=[],b=0;b<25;b++)y[b]=new c.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(y,b){for(var P=this._state,T=this.blockSize/2,I=0;I<T;I++){var C=y[b+2*I],E=y[b+2*I+1];C=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360,E=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360;var O=P[I];O.high^=E,O.low^=C}for(var _=0;_<24;_++){for(var x=0;x<5;x++){for(var v=0,D=0,w=0;w<5;w++){var O=P[x+5*w];v^=O.high,D^=O.low}var F=m[x];F.high=v,F.low=D}for(var x=0;x<5;x++)for(var H=m[(x+4)%5],z=m[(x+1)%5],V=z.high,W=z.low,v=H.high^(V<<1|W>>>31),D=H.low^(W<<1|V>>>31),w=0;w<5;w++){var O=P[x+5*w];O.high^=v,O.low^=D}for(var L=1;L<25;L++){var v,D,O=P[L],k=O.high,N=O.low,U=u[L];U<32?(v=k<<U|N>>>32-U,D=N<<U|k>>>32-U):(v=N<<U-32|k>>>64-U,D=k<<U-32|N>>>64-U);var B=m[d[L]];B.high=v,B.low=D}var G=m[0],Y=P[0];G.high=Y.high,G.low=Y.low;for(var x=0;x<5;x++)for(var w=0;w<5;w++){var L=x+5*w,O=P[L],X=m[L],K=m[(x+1)%5+5*w],J=m[(x+2)%5+5*w];O.high=X.high^~K.high&J.high,O.low=X.low^~K.low&J.low}var O=P[0],se=p[_];O.high^=se.high,O.low^=se.low}},_doFinalize:function(){var y=this._data,b=y.words,P=this._nDataBytes*8,T=y.sigBytes*8,I=this.blockSize*32;b[T>>>5]|=1<<24-T%32,b[(r.ceil((T+1)/I)*I>>>5)-1]|=128,y.sigBytes=b.length*4,this._process();for(var C=this._state,E=this.cfg.outputLength/8,O=E/8,_=[],x=0;x<O;x++){var v=C[x],D=v.high,w=v.low;D=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,w=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,_.push(w),_.push(D)}return new s.init(_,E)},clone:function(){for(var y=a.clone.call(this),b=y._state=this._state.slice(0),P=0;P<25;P++)b[P]=b[P].clone();return y}});i.SHA3=a._createHelper(g),i.HmacSHA3=a._createHmacHelper(g)})(Math),e.SHA3})}),dut=Gl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(yc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.WordArray,a=n.Hasher,l=i.algo,c=s.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),h=s.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),u=s.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),d=s.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),p=s.create([0,1518500249,1859775393,2400959708,2840853838]),m=s.create([1352829926,1548603684,1836072691,2053994217,0]),g=l.RIPEMD160=a.extend({_doReset:function(){this._hash=s.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(E,O){for(var _=0;_<16;_++){var x=O+_,v=E[x];E[x]=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360}var D=this._hash.words,w=p.words,F=m.words,H=c.words,z=h.words,V=u.words,W=d.words,L,k,N,U,B,G,Y,X,K,J;G=L=D[0],Y=k=D[1],X=N=D[2],K=U=D[3],J=B=D[4];for(var se,_=0;_<80;_+=1)se=L+E[O+H[_]]|0,_<16?se+=y(k,N,U)+w[0]:_<32?se+=b(k,N,U)+w[1]:_<48?se+=P(k,N,U)+w[2]:_<64?se+=T(k,N,U)+w[3]:se+=I(k,N,U)+w[4],se=se|0,se=C(se,V[_]),se=se+B|0,L=B,B=U,U=C(N,10),N=k,k=se,se=G+E[O+z[_]]|0,_<16?se+=I(Y,X,K)+F[0]:_<32?se+=T(Y,X,K)+F[1]:_<48?se+=P(Y,X,K)+F[2]:_<64?se+=b(Y,X,K)+F[3]:se+=y(Y,X,K)+F[4],se=se|0,se=C(se,W[_]),se=se+J|0,G=J,J=K,K=C(X,10),X=Y,Y=se;se=D[1]+N+K|0,D[1]=D[2]+U+J|0,D[2]=D[3]+B+G|0,D[3]=D[4]+L+Y|0,D[4]=D[0]+k+X|0,D[0]=se},_doFinalize:function(){var E=this._data,O=E.words,_=this._nDataBytes*8,x=E.sigBytes*8;O[x>>>5]|=128<<24-x%32,O[(x+64>>>9<<4)+14]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,E.sigBytes=(O.length+1)*4,this._process();for(var v=this._hash,D=v.words,w=0;w<5;w++){var F=D[w];D[w]=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360}return v},clone:function(){var E=a.clone.call(this);return E._hash=this._hash.clone(),E}});function y(E,O,_){return E^O^_}function b(E,O,_){return E&O|~E&_}function P(E,O,_){return(E|~O)^_}function T(E,O,_){return E&_|O&~_}function I(E,O,_){return E^(O|~_)}function C(E,O){return E<<O|E>>>32-O}i.RIPEMD160=a._createHelper(g),i.HmacRIPEMD160=a._createHmacHelper(g)})(Math),e.RIPEMD160})}),dbe=Gl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(yc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){(function(){var r=e,i=r.lib,n=i.Base,s=r.enc,a=s.Utf8,l=r.algo,c=l.HMAC=n.extend({init:function(h,u){h=this._hasher=new h.init,typeof u=="string"&&(u=a.parse(u));var d=h.blockSize,p=d*4;u.sigBytes>p&&(u=h.finalize(u)),u.clamp();for(var m=this._oKey=u.clone(),g=this._iKey=u.clone(),y=m.words,b=g.words,P=0;P<d;P++)y[P]^=1549556828,b[P]^=909522486;m.sigBytes=g.sigBytes=p,this.reset()},reset:function(){var h=this._hasher;h.reset(),h.update(this._iKey)},update:function(h){return this._hasher.update(h),this},finalize:function(h){var u=this._hasher,d=u.finalize(h);u.reset();var p=u.finalize(this._oKey.clone().concat(d));return p}})})()})}),put=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),ube(),dbe()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.Base,s=i.WordArray,a=r.algo,l=a.SHA256,c=a.HMAC,h=a.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:l,iterations:25e4}),init:function(u){this.cfg=this.cfg.extend(u)},compute:function(u,d){for(var p=this.cfg,m=c.create(p.hasher,u),g=s.create(),y=s.create([1]),b=g.words,P=y.words,T=p.keySize,I=p.iterations;b.length<T;){var C=m.update(d).finalize(y);m.reset();for(var E=C.words,O=E.length,_=C,x=1;x<I;x++){_=m.finalize(_),m.reset();for(var v=_.words,D=0;D<O;D++)E[D]^=v[D]}g.concat(C),P[0]++}return g.sigBytes=T*4,g}});r.PBKDF2=function(u,d,p){return h.create(p).compute(u,d)}})(),e.PBKDF2})}),tv=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),n4e(),dbe()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.Base,s=i.WordArray,a=r.algo,l=a.MD5,c=a.EvpKDF=n.extend({cfg:n.extend({keySize:128/32,hasher:l,iterations:1}),init:function(h){this.cfg=this.cfg.extend(h)},compute:function(h,u){for(var d,p=this.cfg,m=p.hasher.create(),g=s.create(),y=g.words,b=p.keySize,P=p.iterations;y.length<b;){d&&m.update(d),d=m.update(h).finalize(u),m.reset();for(var T=1;T<P;T++)d=m.finalize(d),m.reset();g.concat(d)}return g.sigBytes=b*4,g}});r.EvpKDF=function(h,u,d){return c.create(d).compute(h,u)}})(),e.EvpKDF})}),Zm=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),tv()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],r):r(e.CryptoJS)})(o,function(e){e.lib.Cipher||(function(r){var i=e,n=i.lib,s=n.Base,a=n.WordArray,l=n.BufferedBlockAlgorithm,c=i.enc,h=c.Utf8,u=c.Base64,d=i.algo,p=d.EvpKDF,m=n.Cipher=l.extend({cfg:s.extend(),createEncryptor:function(F,H){return this.create(this._ENC_XFORM_MODE,F,H)},createDecryptor:function(F,H){return this.create(this._DEC_XFORM_MODE,F,H)},init:function(F,H,z){this.cfg=this.cfg.extend(z),this._xformMode=F,this._key=H,this.reset()},reset:function(){l.reset.call(this),this._doReset()},process:function(F){return this._append(F),this._process()},finalize:function(F){F&&this._append(F);var H=this._doFinalize();return H},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:(function(){function F(H){return typeof H=="string"?w:x}return function(H){return{encrypt:function(z,V,W){return F(V).encrypt(H,z,V,W)},decrypt:function(z,V,W){return F(V).decrypt(H,z,V,W)}}}})()}),g=n.StreamCipher=m.extend({_doFinalize:function(){var F=this._process(!0);return F},blockSize:1}),y=i.mode={},b=n.BlockCipherMode=s.extend({createEncryptor:function(F,H){return this.Encryptor.create(F,H)},createDecryptor:function(F,H){return this.Decryptor.create(F,H)},init:function(F,H){this._cipher=F,this._iv=H}}),P=y.CBC=(function(){var F=b.extend();F.Encryptor=F.extend({processBlock:function(z,V){var W=this._cipher,L=W.blockSize;H.call(this,z,V,L),W.encryptBlock(z,V),this._prevBlock=z.slice(V,V+L)}}),F.Decryptor=F.extend({processBlock:function(z,V){var W=this._cipher,L=W.blockSize,k=z.slice(V,V+L);W.decryptBlock(z,V),H.call(this,z,V,L),this._prevBlock=k}});function H(z,V,W){var L,k=this._iv;k?(L=k,this._iv=r):L=this._prevBlock;for(var N=0;N<W;N++)z[V+N]^=L[N]}return F})(),T=i.pad={},I=T.Pkcs7={pad:function(F,H){for(var z=H*4,V=z-F.sigBytes%z,W=V<<24|V<<16|V<<8|V,L=[],k=0;k<V;k+=4)L.push(W);var N=a.create(L,V);F.concat(N)},unpad:function(F){var H=F.words[F.sigBytes-1>>>2]&255;F.sigBytes-=H}},C=n.BlockCipher=m.extend({cfg:m.cfg.extend({mode:P,padding:I}),reset:function(){var F;m.reset.call(this);var H=this.cfg,z=H.iv,V=H.mode;this._xformMode==this._ENC_XFORM_MODE?F=V.createEncryptor:(F=V.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==F?this._mode.init(this,z&&z.words):(this._mode=F.call(V,this,z&&z.words),this._mode.__creator=F)},_doProcessBlock:function(F,H){this._mode.processBlock(F,H)},_doFinalize:function(){var F,H=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(H.pad(this._data,this.blockSize),F=this._process(!0)):(F=this._process(!0),H.unpad(F)),F},blockSize:128/32}),E=n.CipherParams=s.extend({init:function(F){this.mixIn(F)},toString:function(F){return(F||this.formatter).stringify(this)}}),O=i.format={},_=O.OpenSSL={stringify:function(F){var H,z=F.ciphertext,V=F.salt;return V?H=a.create([1398893684,1701076831]).concat(V).concat(z):H=z,H.toString(u)},parse:function(F){var H,z=u.parse(F),V=z.words;return V[0]==1398893684&&V[1]==1701076831&&(H=a.create(V.slice(2,4)),V.splice(0,4),z.sigBytes-=16),E.create({ciphertext:z,salt:H})}},x=n.SerializableCipher=s.extend({cfg:s.extend({format:_}),encrypt:function(F,H,z,V){V=this.cfg.extend(V);var W=F.createEncryptor(z,V),L=W.finalize(H),k=W.cfg;return E.create({ciphertext:L,key:z,iv:k.iv,algorithm:F,mode:k.mode,padding:k.padding,blockSize:F.blockSize,formatter:V.format})},decrypt:function(F,H,z,V){V=this.cfg.extend(V),H=this._parse(H,V.format);var W=F.createDecryptor(z,V).finalize(H.ciphertext);return W},_parse:function(F,H){return typeof F=="string"?H.parse(F,this):F}}),v=i.kdf={},D=v.OpenSSL={execute:function(F,H,z,V,W){if(V||(V=a.random(64/8)),W)var L=p.create({keySize:H+z,hasher:W}).compute(F,V);else var L=p.create({keySize:H+z}).compute(F,V);var k=a.create(L.words.slice(H),z*4);return L.sigBytes=H*4,E.create({key:L,iv:k,salt:V})}},w=n.PasswordBasedCipher=x.extend({cfg:x.cfg.extend({kdf:D}),encrypt:function(F,H,z,V){V=this.cfg.extend(V);var W=V.kdf.execute(z,F.keySize,F.ivSize,V.salt,V.hasher);V.iv=W.iv;var L=x.encrypt.call(this,F,H,W.key,V);return L.mixIn(W),L},decrypt:function(F,H,z,V){V=this.cfg.extend(V),H=this._parse(H,V.format);var W=V.kdf.execute(z,F.keySize,F.ivSize,H.salt,V.hasher);V.iv=W.iv;var L=x.decrypt.call(this,F,H,W.key,V);return L}})})()})}),fut=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),Zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.CFB=(function(){var r=e.lib.BlockCipherMode.extend();r.Encryptor=r.extend({processBlock:function(n,s){var a=this._cipher,l=a.blockSize;i.call(this,n,s,l,a),this._prevBlock=n.slice(s,s+l)}}),r.Decryptor=r.extend({processBlock:function(n,s){var a=this._cipher,l=a.blockSize,c=n.slice(s,s+l);i.call(this,n,s,l,a),this._prevBlock=c}});function i(n,s,a,l){var c,h=this._iv;h?(c=h.slice(0),this._iv=void 0):c=this._prevBlock,l.encryptBlock(c,0);for(var u=0;u<a;u++)n[s+u]^=c[u]}return r})(),e.mode.CFB})}),mut=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),Zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.CTR=(function(){var r=e.lib.BlockCipherMode.extend(),i=r.Encryptor=r.extend({processBlock:function(n,s){var a=this._cipher,l=a.blockSize,c=this._iv,h=this._counter;c&&(h=this._counter=c.slice(0),this._iv=void 0);var u=h.slice(0);a.encryptBlock(u,0),h[l-1]=h[l-1]+1|0;for(var d=0;d<l;d++)n[s+d]^=u[d]}});return r.Decryptor=i,r})(),e.mode.CTR})}),gut=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),Zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.CTRGladman=(function(){var r=e.lib.BlockCipherMode.extend();function i(a){if((a>>24&255)===255){var l=a>>16&255,c=a>>8&255,h=a&255;l===255?(l=0,c===255?(c=0,h===255?h=0:++h):++c):++l,a=0,a+=l<<16,a+=c<<8,a+=h}else a+=1<<24;return a}function n(a){return(a[0]=i(a[0]))===0&&(a[1]=i(a[1])),a}var s=r.Encryptor=r.extend({processBlock:function(a,l){var c=this._cipher,h=c.blockSize,u=this._iv,d=this._counter;u&&(d=this._counter=u.slice(0),this._iv=void 0),n(d);var p=d.slice(0);c.encryptBlock(p,0);for(var m=0;m<h;m++)a[l+m]^=p[m]}});return r.Decryptor=s,r})(),e.mode.CTRGladman})}),yut=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),Zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.OFB=(function(){var r=e.lib.BlockCipherMode.extend(),i=r.Encryptor=r.extend({processBlock:function(n,s){var a=this._cipher,l=a.blockSize,c=this._iv,h=this._keystream;c&&(h=this._keystream=c.slice(0),this._iv=void 0),a.encryptBlock(h,0);for(var u=0;u<l;u++)n[s+u]^=h[u]}});return r.Decryptor=i,r})(),e.mode.OFB})}),but=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),Zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.ECB=(function(){var r=e.lib.BlockCipherMode.extend();return r.Encryptor=r.extend({processBlock:function(i,n){this._cipher.encryptBlock(i,n)}}),r.Decryptor=r.extend({processBlock:function(i,n){this._cipher.decryptBlock(i,n)}}),r})(),e.mode.ECB})}),Put=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),Zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.AnsiX923={pad:function(r,i){var n=r.sigBytes,s=i*4,a=s-n%s,l=n+a-1;r.clamp(),r.words[l>>>2]|=a<<24-l%4*8,r.sigBytes+=a},unpad:function(r){var i=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=i}},e.pad.Ansix923})}),Tut=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),Zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.Iso10126={pad:function(r,i){var n=i*4,s=n-r.sigBytes%n;r.concat(e.lib.WordArray.random(s-1)).concat(e.lib.WordArray.create([s<<24],1))},unpad:function(r){var i=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=i}},e.pad.Iso10126})}),Iut=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),Zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.Iso97971={pad:function(r,i){r.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(r,i)},unpad:function(r){e.pad.ZeroPadding.unpad(r),r.sigBytes--}},e.pad.Iso97971})}),Cut=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),Zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.ZeroPadding={pad:function(r,i){var n=i*4;r.clamp(),r.sigBytes+=n-(r.sigBytes%n||n)},unpad:function(r){for(var i=r.words,n=r.sigBytes-1,n=r.sigBytes-1;n>=0;n--)if(i[n>>>2]>>>24-n%4*8&255){r.sigBytes=n+1;break}}},e.pad.ZeroPadding})}),Sut=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),Zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding})}),Eut=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),Zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.CipherParams,a=i.enc,l=a.Hex,c=i.format,h=c.Hex={stringify:function(u){return u.ciphertext.toString(l)},parse:function(u){var d=l.parse(u);return s.create({ciphertext:d})}}})(),e.format.Hex})}),Out=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),Gw(),Uw(),tv(),Zm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.BlockCipher,s=r.algo,a=[],l=[],c=[],h=[],u=[],d=[],p=[],m=[],g=[],y=[];(function(){for(var T=[],I=0;I<256;I++)I<128?T[I]=I<<1:T[I]=I<<1^283;for(var C=0,E=0,I=0;I<256;I++){var O=E^E<<1^E<<2^E<<3^E<<4;O=O>>>8^O&255^99,a[C]=O,l[O]=C;var _=T[C],x=T[_],v=T[x],D=T[O]*257^O*16843008;c[C]=D<<24|D>>>8,h[C]=D<<16|D>>>16,u[C]=D<<8|D>>>24,d[C]=D;var D=v*16843009^x*65537^_*257^C*16843008;p[O]=D<<24|D>>>8,m[O]=D<<16|D>>>16,g[O]=D<<8|D>>>24,y[O]=D,C?(C=_^T[T[T[v^_]]],E^=T[T[E]]):C=E=1}})();var b=[0,1,2,4,8,16,32,64,128,27,54],P=s.AES=n.extend({_doReset:function(){var T;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var I=this._keyPriorReset=this._key,C=I.words,E=I.sigBytes/4,O=this._nRounds=E+6,_=(O+1)*4,x=this._keySchedule=[],v=0;v<_;v++)v<E?x[v]=C[v]:(T=x[v-1],v%E?E>6&&v%E==4&&(T=a[T>>>24]<<24|a[T>>>16&255]<<16|a[T>>>8&255]<<8|a[T&255]):(T=T<<8|T>>>24,T=a[T>>>24]<<24|a[T>>>16&255]<<16|a[T>>>8&255]<<8|a[T&255],T^=b[v/E|0]<<24),x[v]=x[v-E]^T);for(var D=this._invKeySchedule=[],w=0;w<_;w++){var v=_-w;if(w%4)var T=x[v];else var T=x[v-4];w<4||v<=4?D[w]=T:D[w]=p[a[T>>>24]]^m[a[T>>>16&255]]^g[a[T>>>8&255]]^y[a[T&255]]}}},encryptBlock:function(T,I){this._doCryptBlock(T,I,this._keySchedule,c,h,u,d,a)},decryptBlock:function(T,I){var C=T[I+1];T[I+1]=T[I+3],T[I+3]=C,this._doCryptBlock(T,I,this._invKeySchedule,p,m,g,y,l);var C=T[I+1];T[I+1]=T[I+3],T[I+3]=C},_doCryptBlock:function(T,I,C,E,O,_,x,v){for(var D=this._nRounds,w=T[I]^C[0],F=T[I+1]^C[1],H=T[I+2]^C[2],z=T[I+3]^C[3],V=4,W=1;W<D;W++){var L=E[w>>>24]^O[F>>>16&255]^_[H>>>8&255]^x[z&255]^C[V++],k=E[F>>>24]^O[H>>>16&255]^_[z>>>8&255]^x[w&255]^C[V++],N=E[H>>>24]^O[z>>>16&255]^_[w>>>8&255]^x[F&255]^C[V++],U=E[z>>>24]^O[w>>>16&255]^_[F>>>8&255]^x[H&255]^C[V++];w=L,F=k,H=N,z=U}var L=(v[w>>>24]<<24|v[F>>>16&255]<<16|v[H>>>8&255]<<8|v[z&255])^C[V++],k=(v[F>>>24]<<24|v[H>>>16&255]<<16|v[z>>>8&255]<<8|v[w&255])^C[V++],N=(v[H>>>24]<<24|v[z>>>16&255]<<16|v[w>>>8&255]<<8|v[F&255])^C[V++],U=(v[z>>>24]<<24|v[w>>>16&255]<<16|v[F>>>8&255]<<8|v[H&255])^C[V++];T[I]=L,T[I+1]=k,T[I+2]=N,T[I+3]=U},keySize:256/32});r.AES=n._createHelper(P)})(),e.AES})}),Aut=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),Gw(),Uw(),tv(),Zm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=i.BlockCipher,a=r.algo,l=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],c=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],h=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],d=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],p=a.DES=s.extend({_doReset:function(){for(var b=this._key,P=b.words,T=[],I=0;I<56;I++){var C=l[I]-1;T[I]=P[C>>>5]>>>31-C%32&1}for(var E=this._subKeys=[],O=0;O<16;O++){for(var _=E[O]=[],x=h[O],I=0;I<24;I++)_[I/6|0]|=T[(c[I]-1+x)%28]<<31-I%6,_[4+(I/6|0)]|=T[28+(c[I+24]-1+x)%28]<<31-I%6;_[0]=_[0]<<1|_[0]>>>31;for(var I=1;I<7;I++)_[I]=_[I]>>>(I-1)*4+3;_[7]=_[7]<<5|_[7]>>>27}for(var v=this._invSubKeys=[],I=0;I<16;I++)v[I]=E[15-I]},encryptBlock:function(b,P){this._doCryptBlock(b,P,this._subKeys)},decryptBlock:function(b,P){this._doCryptBlock(b,P,this._invSubKeys)},_doCryptBlock:function(b,P,T){this._lBlock=b[P],this._rBlock=b[P+1],m.call(this,4,252645135),m.call(this,16,65535),g.call(this,2,858993459),g.call(this,8,16711935),m.call(this,1,1431655765);for(var I=0;I<16;I++){for(var C=T[I],E=this._lBlock,O=this._rBlock,_=0,x=0;x<8;x++)_|=u[x][((O^C[x])&d[x])>>>0];this._lBlock=O,this._rBlock=E^_}var v=this._lBlock;this._lBlock=this._rBlock,this._rBlock=v,m.call(this,1,1431655765),g.call(this,8,16711935),g.call(this,2,858993459),m.call(this,16,65535),m.call(this,4,252645135),b[P]=this._lBlock,b[P+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function m(b,P){var T=(this._lBlock>>>b^this._rBlock)&P;this._rBlock^=T,this._lBlock^=T<<b}function g(b,P){var T=(this._rBlock>>>b^this._lBlock)&P;this._lBlock^=T,this._rBlock^=T<<b}r.DES=s._createHelper(p);var y=a.TripleDES=s.extend({_doReset:function(){var b=this._key,P=b.words;if(P.length!==2&&P.length!==4&&P.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var T=P.slice(0,2),I=P.length<4?P.slice(0,2):P.slice(2,4),C=P.length<6?P.slice(0,2):P.slice(4,6);this._des1=p.createEncryptor(n.create(T)),this._des2=p.createEncryptor(n.create(I)),this._des3=p.createEncryptor(n.create(C))},encryptBlock:function(b,P){this._des1.encryptBlock(b,P),this._des2.decryptBlock(b,P),this._des3.encryptBlock(b,P)},decryptBlock:function(b,P){this._des3.decryptBlock(b,P),this._des2.encryptBlock(b,P),this._des1.decryptBlock(b,P)},keySize:192/32,ivSize:64/32,blockSize:64/32});r.TripleDES=s._createHelper(y)})(),e.TripleDES})}),_ut=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),Gw(),Uw(),tv(),Zm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.StreamCipher,s=r.algo,a=s.RC4=n.extend({_doReset:function(){for(var h=this._key,u=h.words,d=h.sigBytes,p=this._S=[],m=0;m<256;m++)p[m]=m;for(var m=0,g=0;m<256;m++){var y=m%d,b=u[y>>>2]>>>24-y%4*8&255;g=(g+p[m]+b)%256;var P=p[m];p[m]=p[g],p[g]=P}this._i=this._j=0},_doProcessBlock:function(h,u){h[u]^=l.call(this)},keySize:256/32,ivSize:0});function l(){for(var h=this._S,u=this._i,d=this._j,p=0,m=0;m<4;m++){u=(u+1)%256,d=(d+h[u])%256;var g=h[u];h[u]=h[d],h[d]=g,p|=h[(h[u]+h[d])%256]<<24-m*8}return this._i=u,this._j=d,p}r.RC4=n._createHelper(a);var c=s.RC4Drop=a.extend({cfg:a.cfg.extend({drop:192}),_doReset:function(){a._doReset.call(this);for(var h=this.cfg.drop;h>0;h--)l.call(this)}});r.RC4Drop=n._createHelper(c)})(),e.RC4})}),vut=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),Gw(),Uw(),tv(),Zm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.StreamCipher,s=r.algo,a=[],l=[],c=[],h=s.Rabbit=n.extend({_doReset:function(){for(var d=this._key.words,p=this.cfg.iv,m=0;m<4;m++)d[m]=(d[m]<<8|d[m]>>>24)&16711935|(d[m]<<24|d[m]>>>8)&4278255360;var g=this._X=[d[0],d[3]<<16|d[2]>>>16,d[1],d[0]<<16|d[3]>>>16,d[2],d[1]<<16|d[0]>>>16,d[3],d[2]<<16|d[1]>>>16],y=this._C=[d[2]<<16|d[2]>>>16,d[0]&4294901760|d[1]&65535,d[3]<<16|d[3]>>>16,d[1]&4294901760|d[2]&65535,d[0]<<16|d[0]>>>16,d[2]&4294901760|d[3]&65535,d[1]<<16|d[1]>>>16,d[3]&4294901760|d[0]&65535];this._b=0;for(var m=0;m<4;m++)u.call(this);for(var m=0;m<8;m++)y[m]^=g[m+4&7];if(p){var b=p.words,P=b[0],T=b[1],I=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360,C=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360,E=I>>>16|C&4294901760,O=C<<16|I&65535;y[0]^=I,y[1]^=E,y[2]^=C,y[3]^=O,y[4]^=I,y[5]^=E,y[6]^=C,y[7]^=O;for(var m=0;m<4;m++)u.call(this)}},_doProcessBlock:function(d,p){var m=this._X;u.call(this),a[0]=m[0]^m[5]>>>16^m[3]<<16,a[1]=m[2]^m[7]>>>16^m[5]<<16,a[2]=m[4]^m[1]>>>16^m[7]<<16,a[3]=m[6]^m[3]>>>16^m[1]<<16;for(var g=0;g<4;g++)a[g]=(a[g]<<8|a[g]>>>24)&16711935|(a[g]<<24|a[g]>>>8)&4278255360,d[p+g]^=a[g]},blockSize:128/32,ivSize:64/32});function u(){for(var d=this._X,p=this._C,m=0;m<8;m++)l[m]=p[m];p[0]=p[0]+1295307597+this._b|0,p[1]=p[1]+3545052371+(p[0]>>>0<l[0]>>>0?1:0)|0,p[2]=p[2]+886263092+(p[1]>>>0<l[1]>>>0?1:0)|0,p[3]=p[3]+1295307597+(p[2]>>>0<l[2]>>>0?1:0)|0,p[4]=p[4]+3545052371+(p[3]>>>0<l[3]>>>0?1:0)|0,p[5]=p[5]+886263092+(p[4]>>>0<l[4]>>>0?1:0)|0,p[6]=p[6]+1295307597+(p[5]>>>0<l[5]>>>0?1:0)|0,p[7]=p[7]+3545052371+(p[6]>>>0<l[6]>>>0?1:0)|0,this._b=p[7]>>>0<l[7]>>>0?1:0;for(var m=0;m<8;m++){var g=d[m]+p[m],y=g&65535,b=g>>>16,P=((y*y>>>17)+y*b>>>15)+b*b,T=((g&4294901760)*g|0)+((g&65535)*g|0);c[m]=P^T}d[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,d[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,d[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,d[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,d[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,d[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,d[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,d[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.Rabbit=n._createHelper(h)})(),e.Rabbit})}),xut=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),Gw(),Uw(),tv(),Zm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.StreamCipher,s=r.algo,a=[],l=[],c=[],h=s.RabbitLegacy=n.extend({_doReset:function(){var d=this._key.words,p=this.cfg.iv,m=this._X=[d[0],d[3]<<16|d[2]>>>16,d[1],d[0]<<16|d[3]>>>16,d[2],d[1]<<16|d[0]>>>16,d[3],d[2]<<16|d[1]>>>16],g=this._C=[d[2]<<16|d[2]>>>16,d[0]&4294901760|d[1]&65535,d[3]<<16|d[3]>>>16,d[1]&4294901760|d[2]&65535,d[0]<<16|d[0]>>>16,d[2]&4294901760|d[3]&65535,d[1]<<16|d[1]>>>16,d[3]&4294901760|d[0]&65535];this._b=0;for(var y=0;y<4;y++)u.call(this);for(var y=0;y<8;y++)g[y]^=m[y+4&7];if(p){var b=p.words,P=b[0],T=b[1],I=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360,C=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360,E=I>>>16|C&4294901760,O=C<<16|I&65535;g[0]^=I,g[1]^=E,g[2]^=C,g[3]^=O,g[4]^=I,g[5]^=E,g[6]^=C,g[7]^=O;for(var y=0;y<4;y++)u.call(this)}},_doProcessBlock:function(d,p){var m=this._X;u.call(this),a[0]=m[0]^m[5]>>>16^m[3]<<16,a[1]=m[2]^m[7]>>>16^m[5]<<16,a[2]=m[4]^m[1]>>>16^m[7]<<16,a[3]=m[6]^m[3]>>>16^m[1]<<16;for(var g=0;g<4;g++)a[g]=(a[g]<<8|a[g]>>>24)&16711935|(a[g]<<24|a[g]>>>8)&4278255360,d[p+g]^=a[g]},blockSize:128/32,ivSize:64/32});function u(){for(var d=this._X,p=this._C,m=0;m<8;m++)l[m]=p[m];p[0]=p[0]+1295307597+this._b|0,p[1]=p[1]+3545052371+(p[0]>>>0<l[0]>>>0?1:0)|0,p[2]=p[2]+886263092+(p[1]>>>0<l[1]>>>0?1:0)|0,p[3]=p[3]+1295307597+(p[2]>>>0<l[2]>>>0?1:0)|0,p[4]=p[4]+3545052371+(p[3]>>>0<l[3]>>>0?1:0)|0,p[5]=p[5]+886263092+(p[4]>>>0<l[4]>>>0?1:0)|0,p[6]=p[6]+1295307597+(p[5]>>>0<l[5]>>>0?1:0)|0,p[7]=p[7]+3545052371+(p[6]>>>0<l[6]>>>0?1:0)|0,this._b=p[7]>>>0<l[7]>>>0?1:0;for(var m=0;m<8;m++){var g=d[m]+p[m],y=g&65535,b=g>>>16,P=((y*y>>>17)+y*b>>>15)+b*b,T=((g&4294901760)*g|0)+((g&65535)*g|0);c[m]=P^T}d[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,d[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,d[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,d[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,d[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,d[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,d[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,d[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.RabbitLegacy=n._createHelper(h)})(),e.RabbitLegacy})}),Rut=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),Gw(),Uw(),tv(),Zm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.BlockCipher,s=r.algo;let a=16,l=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],c=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var h={pbox:[],sbox:[]};function u(y,b){let P=b>>24&255,T=b>>16&255,I=b>>8&255,C=b&255,E=y.sbox[0][P]+y.sbox[1][T];return E=E^y.sbox[2][I],E=E+y.sbox[3][C],E}function d(y,b,P){let T=b,I=P,C;for(let E=0;E<a;++E)T=T^y.pbox[E],I=u(y,T)^I,C=T,T=I,I=C;return C=T,T=I,I=C,I=I^y.pbox[a],T=T^y.pbox[a+1],{left:T,right:I}}function p(y,b,P){let T=b,I=P,C;for(let E=a+1;E>1;--E)T=T^y.pbox[E],I=u(y,T)^I,C=T,T=I,I=C;return C=T,T=I,I=C,I=I^y.pbox[1],T=T^y.pbox[0],{left:T,right:I}}function m(y,b,P){for(let O=0;O<4;O++){y.sbox[O]=[];for(let _=0;_<256;_++)y.sbox[O][_]=c[O][_]}let T=0;for(let O=0;O<a+2;O++)y.pbox[O]=l[O]^b[T],T++,T>=P&&(T=0);let I=0,C=0,E=0;for(let O=0;O<a+2;O+=2)E=d(y,I,C),I=E.left,C=E.right,y.pbox[O]=I,y.pbox[O+1]=C;for(let O=0;O<4;O++)for(let _=0;_<256;_+=2)E=d(y,I,C),I=E.left,C=E.right,y.sbox[O][_]=I,y.sbox[O][_+1]=C;return!0}var g=s.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var y=this._keyPriorReset=this._key,b=y.words,P=y.sigBytes/4;m(h,b,P)}},encryptBlock:function(y,b){var P=d(h,y[b],y[b+1]);y[b]=P.left,y[b+1]=P.right},decryptBlock:function(y,b){var P=p(h,y[b],y[b+1]);y[b]=P.left,y[b+1]=P.right},blockSize:64/32,keySize:128/32,ivSize:64/32});r.Blowfish=n._createHelper(g)})(),e.Blowfish})}),Dut=Gl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(yc(),jJ(),sut(),aut(),Gw(),lut(),Uw(),n4e(),ube(),cut(),o4e(),hut(),uut(),dut(),dbe(),put(),tv(),Zm(),fut(),mut(),gut(),yut(),but(),Put(),Tut(),Iut(),Cut(),Sut(),Eut(),Out(),Aut(),_ut(),vut(),xut(),Rut()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./lib-typedarrays","./enc-utf16","./enc-base64","./enc-base64url","./md5","./sha1","./sha256","./sha224","./sha512","./sha384","./sha3","./ripemd160","./hmac","./pbkdf2","./evpkdf","./cipher-core","./mode-cfb","./mode-ctr","./mode-ctr-gladman","./mode-ofb","./mode-ecb","./pad-ansix923","./pad-iso10126","./pad-iso97971","./pad-zeropadding","./pad-nopadding","./format-hex","./aes","./tripledes","./rc4","./rabbit","./rabbit-legacy","./blowfish"],r):e.CryptoJS=r(e.CryptoJS)})(o,function(e){return e})}),wut=(o=>(o.Device="Device",o.Symbol="Symbol",o.Footprint="Footprint",o.OBJ="OBJ",o.ModelID="3D Model",o.ModelName="3D Model Title",o.OriginModelName="Origin 3D Model Title",o.ModelTransform="3D Model Transform",o.OriginFootprint="Origin Footprint",o))(wut||{}),Lut=(o=>(o.DOCHEAD="DOCHEAD",o.EDIT_HEAD="EDIT_HEAD",o.SCH="SCH",o.SCH_PAGE="SCH_PAGE",o.PCB="PCB",o.PANEL="PANEL",o.PANEL_LIB="PANEL_LIB",o.SYMBOL="SYMBOL",o.FOOTPRINT="FOOTPRINT",o.DEVICE="DEVICE",o.BLOB="BLOB",o.INSTANCE="INSTANCE",o.CONFIG="CONFIG",o.BOARD="BOARD",o.FONT="FONT",o.VARIANT="VARIANT",o.COMPONENT_GROUP="COMPONENT_GROUP",o.COMPONENT_GROUP_DATA="COMPONENT_GROUP_DATA",o.SIMULATION="SIMULATION",o))(Lut||{}),Mut=(o=>(o.META="META",o.META_SORT="META_SORT",o.META_CREATE="META_CREATE",o.META_MODIFY="META_MODIFY",o.FONT="FONT",o.BLOB="BLOB",o.MAX_NUM="MAX_NUM",o.INSTANCE_ATTR="INSTANCE_ATTR",o.DELETE_DOC="DELETE_DOC",o.META_Z_INDEX="META_Z_INDEX",o.VARIANT_GROUPED="VARIANT_GROUPED",o.GROUP_INDEX="GROUP_INDEX",o.GROUP_DATA="GROUP_DATA",o.RULE_TEMPLATE="RULE_TEMPLATE",o.RULE="RULE",o.RULE_SELECTOR="RULE_SELECTOR",o.ELE_PLACEHOLDER="ELE_PLACEHOLDER",o.META_PLACEHOLDER="META_PLACEHOLDER",o))(Mut||{});var s4e=`|
`;function nW(o,t,e){return o.slice(t,e)}function pMe(o,t,e){let r=o.length,i=0;for(;i<r;){let n=o.indexOf(`|
`,i);if(n<0){if(e)return o.substring(i);n=r}let s=nW(o,i,n);try{if(s){let a=s.indexOf("||"),l=a>-1,c=l?nW(s,0,a):s,h=l?nW(s,a+2):"";if(t(c,h,s,l?i+a+2:i)===!1){s=null;break}s=null}}catch(a){console.error(a)}i=n+2}o=null}var Nut=["SYMBOL","FOOTPRINT","BLOB","FONT","PANEL_LIB","DEVICE","BOARD","INSTANCE","CONFIG","VARIANT","COMPONENT_GROUP","COMPONENT_GROUP_DATA"];function oW(o,t){return Nut.includes(t)?t:o}var pbe=class{parseFull(o,t,e){let r=t,i=e,n,s=null;pMe(o,(a,l,c)=>{let h=JSON.parse(a);if(h.type==="EDIT_HEAD")s=JSON.parse(l),this.onEditHead&&this.onEditHead(s);else if(h.type==="DOCHEAD"){let u=JSON.parse(l);i=u.docType,r=u.uuid,n=u.client,u.ticket=h.ticket,this.onDocHead(u,s,c)}else this.onLine(h.id,h.ticket,l,h.type,h.client||n,i,r,h.firstTicket,h.pend,s,h.num,c)}),this.onEnd(),o=null}flowParseFull(o={}){let{cache:t,chunkLength:e=100*1024*1024,idsData:r,history:i}=o,n="",s=null,a,l=null,c=!0,h="",u=0,d=!1,p={},m=t?{}:void 0,g=new Set,y=T=>{m[T]===void 0&&(m[T]=-1),t(T,++m[T],p[T].data.join(`|
`)),p[T].data.length=0,p[T].size=0,p[T].data.push(p[T].head),p[T].size+=p[T].head.length},b=T=>{if(g.add(n),!t)return;let I=oW(n,s);p[I].data.push(T),p[I].size+=(p[I].size?2:0)+T.length,p[I].size+T.length>e&&y(I)},P=(T,I)=>pMe(T,(C,E,O,_)=>{var x,v,D,w,F,H,z,V;let W=JSON.parse(C);if(W.type==="EDIT_HEAD")l=JSON.parse(E),(x=this.onEditHead)==null||x.call(this,l),(v=o.onEditHead)==null||v.call(o,l),d=!0;else if(W.type==="DOCHEAD"){let L=JSON.parse(E);s=L.docType,n=L.uuid,a=L.client,L.ticket=W.ticket,d||(l={uuid:L.uuid,username:(D=L==null?void 0:L.user)==null?void 0:D.username,nickname:(w=L==null?void 0:L.user)==null?void 0:w.nickname,updateTime:L==null?void 0:L.updateTime},(F=o.onEditHead)==null||F.call(o,l),d=!0),this.onDocHead(L,l,O,i);let k=oW(n,s);t&&!p[k]&&(p[k]={size:0,data:[],head:""}),t&&(p[k].head=O),b(O)}else{let L=W.num,k=W.client||a;if(r){let N=(V=(z=(H=r.ids)==null?void 0:H[n])==null?void 0:z[k])==null?void 0:V[W.id];if(!N||N[0]!==W.ticket)return;L=N[1],r.size-=1,delete r.ids[n][k][W.id]}if(i){let N=oW(n,s);t&&(i.dNum=(m==null?void 0:m[N])===void 0?0:(m==null?void 0:m[N])+1),i.start=t?p[N].size+2+C.length+2:u+_,i.size=O.length,W.client&&(i.hClient=!0)}this.onLine(W.id,W.ticket,E,W.type,k,s,n,W.firstTicket,W.pend,l||(i==null?void 0:i.editHead),L,O,i),b(O)}},I);return{start:()=>{c=!0},end:()=>{if(h&&P(h,!1),t)for(let T in p)p[T].size&&p[T].data.length>1&&y(T),p[T]=null;c=!1,h="",n="",n=null,a="",l=null,this.onEnd()},update:T=>{if(!c)throw new Error("\u66F4\u65B0\u524D\u672A\u8C03\u7528 start \u65B9\u6CD5");let I=P(h+T,!0);u=u+h.length+T.length-((I==null?void 0:I.length)||0),h="",I&&(h=I)},docMap:m,getDocIds:()=>Array.from(g)}}parseLine(o,t,e){let r=o.indexOf("||"),i=r!==-1,n=i?nW(o,0,r):o,s=i?nW(o,r+2):"",a=JSON.parse(n);this.onLine(a.id,a.ticket,s,a.type,a.client,e,t,a.firstTicket,a.pend,void 0,a.num,o),o=null}onEditHead(o){}},_2e=new Uint8Array(8);function Tm(){crypto.getRandomValues(_2e);let o="";for(let t=0;t<_2e.length;t++)o+=_2e[t].toString(16).padStart(2,"0");return o}function J_(o,t,e,r,i,n,s,a){let l={docType:o,client:t,uuid:e};return(r||r===0)&&(l.updateTime=r),(i||l.updateTime||l.updateTime===0)&&(l.version=i||String(r)),(a||self!=null&&self.PRO_EDITOR_VERSION)&&(l.editVersion=a||(self==null?void 0:self.PRO_EDITOR_VERSION)),n&&(l.user=n),`${JSON.stringify({type:"DOCHEAD",ticket:s})}||${JSON.stringify(l)}`}function Sf(o,t,e,r,i,n,s,a){let l={type:o,ticket:t,id:e};return n!==void 0&&(l.firstTicket=n),s!==void 0&&(l.pend=s),a!==void 0&&(l.num=a),i&&(l.client=i),`${JSON.stringify(l)}||${r}`}var fbe=class extends pbe{constructor(o){super(),this.unique=Tm(),this.maxTicket=0,this.isPendChange=!0,this.isLocalChange=!0,this.cbArr=[],this.tempLocalIds={},this.docMaxTicket={},this.client=o||Tm()}onLine(o,t,e,r,i,n,s,a,l,c,h){this.remoteChange(t,i,s,o,e,r,n,void 0,a,l,c,void 0,void 0,h)}getUnique(){return this.unique}setUnique(o){this.unique=o}setDocMaxTicket(o,t,e){e||(!this.docMaxTicket[o]||this.docMaxTicket[o]<t)&&(this.docMaxTicket[o]=t)}getDocMaxTicket(o){var t;return(t=this.docMaxTicket[o])!=null?t:0}onDocHead(o,t){}onEnd(){}setIsPendChange(o){this.isPendChange=o}getIsPendChange(){return this.isPendChange}getMaxTicket(){return this.maxTicket}setMaxTicket(o,t){o&&(t||this.maxTicket<o)&&(this.maxTicket=o)}setIsLocalChange(o){this.isLocalChange=o}getIsLocalChange(){return this.isLocalChange}revoke(o,t,e,r,i,n,s,a,l,c,h){var u;if(!((u=this.tempLocalIds[o])!=null&&u[t]))return h?h(t,i,e,s,`${r}-1`,o,n,void 0,void 0,!0,c):this.cbArr.forEach(d=>d(o,t,e,s,`${r}-1`,i,void 0,n,void 0,void 0,void 0,c)),!0}getRandomUuid(){return Tm()}getClient(){return this.client}onChange(o){this.cbArr.push(o)}localChange(o,t,e,r,i,n){let s=this.maxTicket+1;return this.tempLocalIds[o]||(this.tempLocalIds[o]={}),this.tempLocalIds[o][t]=[this.getClient(),s],this.remoteChange(s,this.client,o,t,e,r,i,!0,void 0,!0,void 0,this.unique,void 0,n),s}remoteChange(o,t,e,r,i,n,s,a,l,c,h,u,d,p){var m;this.setMaxTicket(o);let g=u===this.unique,y=a||g,b=(!y||y&&this.isLocalChange)&&(!d||d&&this.isPendChange),P=(m=this.tempLocalIds[e])==null?void 0:m[r];!a&&g?P?(b=!1,P[0]===t&&P[1]===o&&delete this.tempLocalIds[e][r]):b=!0:!a&&P&&(P[1]>o||P[1]===o&&P[0]>t?b=!1:delete this.tempLocalIds[e][r]),this.setDocMaxTicket(e,o,c),b&&this.cbArr.forEach(T=>T(e,r,i,n,t,o,l,c,void 0,d,u,p))}},kut=class{constructor(o){this.item=o,this.parent=null,this.left=null,this.right=null,this.height=1}getParent(){return this.parent}getLeft(){return this.left}getRight(){return this.right}getHeight(){return this.height}setLeft(o){if(this.left!==null)throw new Error("insert exists left is not permitted");if(o!==null){if(o.parent!==null)throw new Error("insert left with node has parent is not permitted");this.left=o,o.parent=this,this.updateHeight()}}setRight(o){if(this.right!==null)throw new Error("insert exists right is not permitted");if(o!==null){if(o.parent!==null)throw new Error("insert right with node has parent is not permitted");this.right=o,o.parent=this,this.updateHeight()}}removeLeft(){if(this.left===null)return null;{let o=this.left;return o.parent=null,this.left=null,this.updateHeight(),o}}removeRight(){if(this.right===null)return null;{let o=this.right;return o.parent=null,this.right=null,this.updateHeight(),o}}rotateRight(o){let t=this.removeLeft();if(this.setLeft(t.removeRight()),this.parent){let e=this.parent;e.getLeft()===this?(e.removeLeft(),e.setLeft(t)):(e.removeRight(),e.setRight(t)),t.setRight(this)}else t.setRight(this),o(t)}rotateLeft(o){let t=this.removeRight();if(this.setRight(t.removeLeft()),this.parent){let e=this.parent;e.getLeft()===this?(e.removeLeft(),e.setLeft(t)):(e.removeRight(),e.setRight(t)),t.setLeft(this)}else t.setLeft(this),o(t)}updateHeight(){var o,t;let e=this;for(;e!==null;)e.height=Math.max(((o=e.left)==null?void 0:o.height)||0,((t=e.right)==null?void 0:t.height)||0)+1,e=e.parent}},$2e=class{constructor(o){this.comparator=o,this.root=null,this.size=0}balance(o){var t,e;let r=((t=o.getLeft())==null?void 0:t.getHeight())||0,i=((e=o.getRight())==null?void 0:e.getHeight())||0,n=o.getParent();r>i?r-i>1?(o.rotateRight(s=>this.root=s),this.verify()):n!==null?n.getRight()===o&&(o.rotateRight(s=>this.root=s),this.verify()):(o.rotateRight(s=>this.root=s),this.verify()):i>r&&(i-r>1?(o.rotateLeft(s=>this.root=s),this.verify()):n!==null?n.getLeft()===o&&(o.rotateLeft(s=>this.root=s),this.verify()):(o.rotateLeft(s=>this.root=s),this.verify())),n&&this.balance(n)}forwardTraverse(o){let t=new Array(10),e=this.findMin();for(;e;)switch(t.pop()||2){case 1:e.getLeft()!==null?(t.push(2),t.push(1),e=e.getLeft()):t.push(2);break;case 2:if(!o(e.item))return;e.getRight()!==null?(t.push(3),t.push(1),e=e.getRight()):t.push(3);break;case 3:e=e.getParent();break;default:throw new Error("invalid status")}}backwardTraverse(o){let t=new Array(10),e=this.findMax();for(;e;)switch(t.pop()||2){case 1:e.getRight()!==null?(t.push(2),t.push(1),e=e.getRight()):t.push(2);break;case 2:if(!o(e.item))return;e.getLeft()!==null?(t.push(3),t.push(1),e=e.getLeft()):t.push(3);break;case 3:e=e.getParent();break;default:throw new Error("invalid status")}}display(o=this.root,t=new Array,e=0){let r="| ".repeat(e);return o?(t.push(r+`\u25CF(${JSON.stringify(o.item)})
`),this.display(o.getLeft(),t,e+1),this.display(o.getRight(),t,e+1)):t.push(r+`\u2609
`),t}getHeight(){var o;return((o=this.root)==null?void 0:o.getHeight())||0}getSize(){return this.size}insert(o){let t=new kut(o);if(this.root===null)return this.root=t,this.size++,!0;{let e=this.root;for(;;){let r=this.comparator(o,e.item);if(r<0){if(e.getLeft()===null)return e.setLeft(t),this.size++,this.verify(),this.balance(e),!0;e=e.getLeft()}else if(r>0){if(e.getRight()===null)return e.setRight(t),this.size++,this.verify(),this.balance(e),!0;e=e.getRight()}else return!1}}}verify(){}remove(o){let t=this.root;for(this.verify();;){if(t===null)return!1;let e=this.comparator(o,t.item);if(e<0)t=t.getLeft();else if(e>0)t=t.getRight();else return this.removeNode(t),this.size--,this.verify(),!0}}removeNode(o){var t,e;let r=o.getParent();if(r===null)o.getLeft()===null&&o.getRight()===null?this.root=null:((((t=o.getLeft())==null?void 0:t.getHeight())||0)>(((e=o.getRight())==null?void 0:e.getHeight())||0)?(o.rotateRight(i=>this.root=i),this.verify()):(o.rotateLeft(i=>this.root=i),this.verify()),this.removeNode(o));else if(r.getLeft()===o){r.removeLeft();let i=this.combineNodes(o.removeLeft(),o.removeRight());r.setLeft(i),this.verify(),this.balance(r)}else{r.removeRight();let i=this.combineNodes(o.removeLeft(),o.removeRight());r.setRight(i),this.verify(),this.balance(r)}}combineNodes(o,t){if(o&&t)if(o.getHeight()>t.getHeight()){let e=this.findMaxChild(o);if(e){let r=e.getParent();return r.removeRight(),r.setRight(e.removeLeft()),e.setLeft(o),e.setRight(t),e}else return o.setRight(t),o}else{let e=this.findMinChild(t);if(e){let r=e.getParent();return r.removeLeft(),r.setLeft(e.removeRight()),e.setLeft(o),e.setRight(t),e}else return t.setLeft(o),t}else return o||t||null}findMax(){let o=this.root;for(;;){let t=o==null?void 0:o.getRight();if(t)o=t;else return o}}findMin(){let o=this.root;for(;;){let t=o==null?void 0:o.getLeft();if(t)o=t;else return o}}findMinChild(o){let t=o;for(;;){if(t.getLeft()===null)return t!==o?t:null;t=t.getLeft()}}findMaxChild(o){let t=o;for(;;){if(t.getRight()===null)return t!==o?t:null;t=t.getRight()}}};var XJ=/^[a-zA-Z]+(\d+)$/;function fMe(o){let t=o.match(XJ);return t?Number(t[1]):null}function An(o){if(!o||typeof o!="string")return o;let t=o.match(/[a-zA-Z]+\d+/g);return t&&t.length===2&&t.join("")===o?t.join("-"):o}function gc(o,t){return JSON.stringify([t,o])}function X_(o){try{let t=JSON.parse(o);return typeof t=="string"?o:t[1]}catch{return o}}function kw(o,t,e){let r=o[t];return r!==void 0||(r=e(t),o[t]=r),r}var But=(o=>(o.META="META",o.CANVAS="CANVAS",o.GROUP="GROUP",o.POLY="POLY",o.STRING="STRING",o.AUX_LINE="AUXLINE",o.DIMENSION="DIMENSION",o.ELE_PLACEHOLDER="ELE_PLACEHOLDER",o))(But||{}),Fut=(o=>(o.META="META",o.CANVAS="CANVAS",o.LAYER="LAYER",o.LAYER_PHYS="LAYER_PHYS",o.ACTIVE_LAYER="ACTIVE_LAYER",o.PARTITION="PARTITION",o.NET="NET",o.PRIMITIVE="PRIMITIVE",o.GROUP="GROUP",o.SILK_OPTS="SILK_OPTS",o.PREFERENCE="PREFERENCE",o.VIA="VIA",o.PAD="PAD",o.LINE="LINE",o.ARC="ARC",o.OBJ="OBJ",o.EQLEN_GRP="EQLEN_GRP",o.POLY="POLY",o.FILL="FILL",o.LAYER_FILL="LAYER_FILL",o.REGION="REGION",o.POUR="POUR",o.POURED="POURED",o.IMAGE="IMAGE",o.TEARDROP="TEARDROP",o.FPC_FILL="FPC_FILL",o.SHELL="SHELL",o.CREASE="CREASE",o.SHELLCUT="SHELLCUT",o.SHELL_ENTITY="SHELL_ENTITY",o.BOSS="BOSS",o.STRING="STRING",o.ATTR="ATTR",o.DIMENSION="DIMENSION",o.COMPONENT="COMPONENT",o.PAD_NET="PAD_NET",o.RULE_TEMPLATE="RULE_TEMPLATE",o.RULE="RULE",o.RULE_SELECTOR="RULE_SELECTOR",o.PANELIZE="PANELIZE",o.BOARD="BOARD",o.X_SIGNALS_GROUP="X_SIGNAL_GROUP",o.X_SIGNALS="X_SIGNALS",o.ELE_PLACEHOLDER="ELE_PLACEHOLDER",o))(Fut||{}),Vut=(o=>(o.META="META",o.CANVAS="CANVAS",o.GROUP="GROUP",o.ATTR="ATTR",o.LINE="LINE",o.WIRE="WIRE",o.BUS="BUS",o.TEXT="TEXT",o.POLY="POLY",o.CIRCLE="CIRCLE",o.ARC="ARC",o.BUSENTRY="BUSENTRY",o.RECT="RECT",o.MASK_REGION="MASK_REGION",o.PIN="PIN",o.OBJ="OBJ",o.COMPONENT="COMPONENT",o.PART="PART",o.ELLIPSE="ELLIPSE",o.BEZIER="BEZIER",o.TABLE="TABLE",o.ELE_PLACEHOLDER="ELE_PLACEHOLDER",o.NG_SETTING="NG_SETTING",o))(Vut||{});function mMe(o,t){return o.ticket===t.ticket?o.client<t.client:o.ticket<t.ticket}var il=class a4e{static find(t,e){return t.last&&e(t.last)?t.last:t.list?t.list.find(e):null}static getFirstTicket(t){var e,r;if(!t)return 0;if(t.last.dataType==="META"){if(t.last.firstTicket!==void 0)return t.last.firstTicket;let i=t.last.ticket;if(t.list)for(let n=t.list.length-1;n>=0;--n){let s=t.list[n];if(s.firstTicket)return s.firstTicket;i=s.ticket}return i}else{let i=a4e.getHead(t);return(r=(e=i==null?void 0:i.firstTicket)!=null?e:i==null?void 0:i.ticket)!=null?r:0}}static getHead(t){var e;return((e=t==null?void 0:t.list)==null?void 0:e[0])||t.last}static getPreNode(t,e){if(t.last===e)return t.list?t.list[t.list.length-1]:null;let r=t.list.findIndex(i=>i===e);return t.list[r-1]}static remove(t,e){var r;if(t.last===e)t.last=((r=t.list)==null?void 0:r.pop())||null;else if(t.list){let i=t.list.findIndex(n=>n===e);i>-1&&t.list.slice(i,1)}}static getLength(t){let e=0;return t&&(t.last&&(e+=1),t.list&&(e+=t.list.length)),e}static insert(t,e){if(!t.last){t.last=e;return}if(mMe(t.last,e)){let n=t.last;t.last=e,e=n}if(!t.list){t.list=[e];return}let r=0,i=t.list.length;for(;r<i;){let n=Math.floor((r+i)/2);mMe(t.list[n],e)?r=n+1:i=n}t.list.splice(r,0,e)}static preForEach(t,e){if(!(!t.last||e(t.last))&&t.list)for(let r=t.list.length-1;r>=0&&!e(t.list[r]);--r);}static async awaitPreForEach(t,e){if(!t.last)return;let r,i=e(t.last,n=>r=n);if(r===void 0&&await i,!r&&t.list)for(let n=t.list.length-1;n>=0;--n){let s,a=e(t.list[n],l=>s=l);if(s===void 0&&await a,s)break}}},Gut=["GROUP","POLY","STRING","AUXLINE","DIMENSION"],l4e=["PARTITION","VIA","PAD","LINE","ARC","OBJ","POLY","FILL","REGION","POUR","POURED","IMAGE","TEARDROP","FPC_FILL","SHELL","CREASE","SHELLCUT","SHELL_ENTITY","BOSS","STRING","ATTR","DIMENSION","COMPONENT"],Uut=["ATTR","WIRE","BUS","TEXT","POLY","CIRCLE","ARC","BUSENTRY","RECT","PIN","OBJ","COMPONENT","PART","ELLIPSE","BEZIER","TABLE","MASK_REGION"],Hut=["SCH_PAGE","SIMULATION"],gMe=o=>o==="PCB"||o==="FOOTPRINT"?0:1,c4e=o=>o==="PCB"||o==="FOOTPRINT"?l4e:o==="PANEL"||o==="PANEL_LIB"?Gut:o==="SCH_PAGE"||o==="SYMBOL"||o==="SIMULATION"?Uut:[];function yMe(o,t,e){var r,i;let n=o.get(t),s=o.get(e),a=il.getHead(n),l=il.getHead(s),c=(r=a.firstTicket)!=null?r:a.ticket,h=(i=l.firstTicket)!=null?i:l.ticket,u=a.client,d=l.client;return c===h?u===d?t===e?0:t<e?-1:1:u<d?-1:1:c<h?-1:1}var Wut=class{constructor(o){this.numSets={},this.orderCbArr=[],this.wDocData=o}orderChange(o){this.orderCbArr.push(o)}setOrderNum(o,t,e,r,i,n){var s,a;let l=r.last.dataType,c=1;if(l==="ELE_PLACEHOLDER"){let m=JSON.parse(r.last.data);l=m.dataType,c=m.max}else if(!((a=(s=c4e(t))==null?void 0:s.includes)!=null&&a.call(s,l)))return;if(c<1)throw new Error("step must be greater than 0");let h=kw(this.numSets[o].orderLists,l,()=>new $2e((m,g)=>yMe(this.wDocData.get(o),m,g))),u=kw(this.numSets[o].maxNum,l,()=>gMe(t)-1),d=this.wDocData.get(o).get(e);if(n&&(h.remove(e),u-=d.step||1),!il.getLength(d))return;d.num=0,c>1&&(d.step=c),h.insert(e),u+=c;let p=u;h.backwardTraverse(m=>{let g=this.wDocData.get(o).get(m);return g.num=p,i&&m!==e&&this.orderCbArr.forEach(y=>y(o,m,l,g.num)),p-=g.step||1,m!==e}),this.numSets[o].maxNum[l]=u}removeNode(o,t,e){let r=this.wDocData.get(o).get(e);if(r.num===void 0)return;let i=r.last.dataType,n=kw(this.numSets[o].orderLists,i,()=>new $2e((l,c)=>yMe(this.wDocData.get(o),l,c))),s=kw(this.numSets[o].maxNum,i,()=>gMe(t)-1);s-=r.step||1;let a=s;n.backwardTraverse(l=>{if(l===e)return!0;let c=this.wDocData.get(o).get(l);return c.num=a,this.orderCbArr.forEach(h=>h(o,l,i,c.num)),a-=c.step||1,!1}),this.numSets[o].maxNum[i]=s,n.remove(e)}getOrderNum(o,t){var e,r,i;return(i=(r=(e=this.wDocData.get(o))==null?void 0:e.get)==null?void 0:r.call(e,t))==null?void 0:i.num}getMaxNum(o){var t;return((t=this.numSets[o])==null?void 0:t.maxNum)||{}}delete(o){this.numSets[o]&&delete this.numSets[o]}add(o){this.numSets[o]||(this.numSets[o]={orderLists:{},maxNum:{}})}has(o){return!!this.numSets[o]}},zut=IN(uW()),Yut=(o=>(o.SOLID="SOLID",o.SHORT_DASH="SHORT_DASH",o.DOT="DOT",o.DOT_DASH="DOT_DASH",o))(Yut||{}),jut=(o=>(o.PRINT="PRINT",o.COVER="COVER",o.PRINT_AND_COVER="PRINT&COVER",o))(jut||{}),Xut=(o=>(o.LEFT="LEFT",o.CENTER="CENTER",o.RIGHT="RIGHT",o))(Xut||{}),qut=(o=>(o.TOP="TOP",o.MIDDLE="MIDDLE",o.BOTTOM="BOTTOM",o))(qut||{}),$a=(o=>(o.LEFT_BOTTOM="LEFT_BOTTOM",o.CENTER_BOTTOM="CENTER_BOTTOM",o.RIGHT_BOTTOM="RIGHT_BOTTOM",o.LEFT_MIDDLE="LEFT_MIDDLE",o.CENTER_MIDDLE="CENTER_MIDDLE",o.RIGHT_MIDDLE="RIGHT_MIDDLE",o.LEFT_TOP="LEFT_TOP",o.CENTER_TOP="CENTER_TOP",o.RIGHT_TOP="RIGHT_TOP",o))($a||{}),$ut=(o=>(o.NONE="NONE",o.SOLID="SOLID",o.GRID="GRID",o.HORIZONTAL_LINE="HORIZONTAL_LINE",o.VERTICAL_LINE="VERTICAL_LINE",o.RHOMBIC="RHOMBIC",o.LEFT_SLASH_LINE="LEFT_SLASH_LINE",o.RIGHT_SLASH_LINE="RIGHT_SLASH_LINE",o))($ut||{}),Kut=(o=>(o.NONE="NONE",o.CLOCK="CLOCK",o.INVERTED="INVERTED",o.INVERTED_CLOCK="INVERTED_CLOCK",o))(Kut||{}),aO=(o=>(o.NONE="NONE",o.GRID="GRID",o.OUTLETS="OUTLETS",o))(aO||{}),IP=(o=>(o.NONE="NONE",o.PUSH="PUSH",o.SURROUND="SURROUND",o.OBSTRUCT="OBSTRUCT",o.SURROUND_AND_PUSH="SURROUND&PUSH",o))(IP||{}),Jm=(o=>(o.ELLIPSE="ELLIPSE",o.RECT="RECT",o.OVAL="OVAL",o.POLYGON="POLYGON",o))(Jm||{}),lO=(o=>(o.ROUND="ROUND",o.RECT="RECT",o.SLOT="SLOT",o))(lO||{}),CN=(o=>(o.SOLID="SOLID",o.GRID_LINE="GRID_LINE",o.HORIZONTAL_LINE="HORIZONTAL_LINE",o.VERTICAL_LINE="VERTICAL_LINE",o))(CN||{}),rv=(o=>(o.ALL="ALL",o.PAD="PAD",o.VIA="VIA",o))(rv||{}),iv=(o=>(o.NONE="NONE",o.SINGLE="SINGLE",o.ALL="ALL",o))(iv||{}),SN=(o=>(o.OPTIMIZA_OPEN="OPTIMIZA_OPEN",o.OPTIMIZA_NONE="OPTIMIZA_NONE",o))(SN||{}),nv=(o=>(o.OPTIMIZA_STRONG="OPTIMIZA_STRONG",o.OPTIMIZA_WEAK="OPTIMIZA_WEAK",o.OPTIMIZA_NONE="OPTIMIZA_NONE",o))(nv||{}),nb=(o=>(o.L45="L45",o.L90="L90",o.L="L",o.R45="R45",o.R90="R90",o.R="R",o))(nb||{}),cO=(o=>(o.NORMAL="NORMAL",o.BLIND="BLIND",o.SUTURE="SUTURE",o))(cO||{}),hO=(o=>(o.NORMAL="NORMAL",o.TEST="TEST",o.MARKER="MARKER",o))(hO||{}),uO=(o=>(o.DIVERGENCE="DIVERGENCE",o.DIRECT="DIRECT",o.NON_CONNECT="NON_CONNECT",o))(uO||{}),Hw=(o=>(o.DOT="DOT",o.CENTER="CENT",o))(Hw||{}),Ww=(o=>(o.NORMAL="NORMAL",o.BOARD_OUTLINE="BOARD_OUTLINE",o))(Ww||{}),ob=(o=>(o.SOLID="SOLID",o.GRID="GRID",o.PLANE="PLANE",o))(ob||{}),EN=(o=>(o.PROHIBIT="PROHIBIT",o.CONSTRAINT="CONSTRAINT",o))(EN||{}),CP=(o=>(o.COMPONENT="COMPONENT",o.VIA="VIA",o.TRACK="TRACK",o.FILL="FILL",o.COPPER="COPPER",o.PLANE="PLANE",o))(CP||{}),zT=(o=>(o.PI="Polyimide",o.FR4="FR4",o.STEEL_SHEET="Stainless Steel",o.M3_DOUBLE_SIDED_TAPE="3M Tape",o.EMI_SHIELDING_FILM="EMI Shielding Film",o))(zT||{}),zw=(o=>(o.PUSH_COVER="DRAWER",o.UPPER_LOWER_SHELLS="T&B",o))(zw||{}),v9=(o=>(o.X_AXIS_POSITIVE="X_AXIS_POSITIVE",o.X_AXIS_NEGATIVE="X_AXIS_NEGATIVE",o.Y_AXIS_POSITIVE="Y_AXIS_POSITIVE",o.Y_AXIS_NEGATIVE="Y_AXIS_NEGATIVE",o))(v9||{}),ON=(o=>(o.SLOT="SLOT",o.ENTITY="ENTITY",o))(ON||{}),dO=(o=>(o.AUTO="AUTO",o.UPPER_SHELLS="UPPER_SHELLS",o.LOWER_SHELLS="LOWER_SHELLS",o))(dO||{}),pO=(o=>(o.OUTLINE="OUTLINE",o.SCREW_PILLAR="SCREW_PILLAR",o.ENTITY="ENTITY",o))(pO||{}),YT=(o=>(o.M2="M2",o.M3="M3",o.M4="M4",o.M5="M5",o.M6="M6",o))(YT||{}),Zut=(o=>(o.LENGTH="LENGTH",o.RADIUS="RADIUS",o.ANGLE="ANGLE",o))(Zut||{}),Jut=(o=>(o.MIL="mil",o.INCH="inch",o.CM="cm",o.MM="mm",o))(Jut||{}),Io=(o=>(o.SAFE="SAFE",o.OTHER="OTHER",o.CREEPAGE="CREEPAGE",o.TRACK="TRACK",o.BLIND="BLIND",o.RADIUS="RADIUS",o.PLANE="PLANE",o.COPPER="COPPER",o.PASTE="PASTE",o.SOLDER="SOLDER",o.DIFFER_ENTAIL="DIFFER_ENTAIL",o.NET_LENGTH="NET_LENGTH",o.AUTO_ROUTER="AUTO_ROUTER",o.NET_LENGTH_TOLERANCE="NET_LENGTH_TOLERANCE",o))(Io||{}),Yw=(o=>(o.NORMAL="NORMAL",o.DEFAULT="DEFAULT",o))(Yw||{}),jw=(o=>(o.ALL="ALL",o.LAYERED="LAYERED",o))(jw||{}),Xw=(o=>(o.DIRECT="DIRECT",o.NON_CONNECT="NON_CONNECT",o))(Xw||{}),fO=(o=>(o.FORTY_FIVE="L45",o.NINETY="L90",o.NINETY_ARC="A90",o))(fO||{}),mO=(o=>(o.LESS="LESS",o.MID="MID",o.MORE="MORE",o))(mO||{}),qw=(o=>(o.SPEED_FIRST="SPEED_FIRST",o.COMPLETION_FIRST="COMPLETION_FIRST",o))(qw||{}),Qut=(o=>(o.DesignRule="DesignRule",o.Board="Board",o.SlotRegion="SlotRegion",o.ProhibitedRegion="ProhibitedRegion",o.ConstraintRegion="ConstraintRegion",o.Component="Component",o.Track="Track",o.TestPoint="TestPoint",o.Pad="Pad",o.Via="Via",o.SutureHole="SutureHole",o.Text="Text",o.ColorfulImage="ColorfulImage",o.Image="Image",o.FPCStiffener="FPCStiffener",o.Dimension="Dimension",o.CopperRegion="CopperRegion",o.FillRegion="Fill Region",o.Line="Line",o.Teardrop="Teardrop",o.D3Shell="D3Shell",o))(Qut||{}),edt=IN(Dut());function tdt(o,t){return o.fontFamily==t.fontFamily&&t.text==o.text&&Math.abs(o.fontSize-t.fontSize)<1e-5&&o.reverse==t.reverse&&o.expansion==t.expansion&&o.bold==t.bold&&o.italic==t.italic}function TP(o,t,e,r,i,n,s,a){return JSON.stringify([o||"",t||"",e,r,i?1:0,n?1:0,s?1:0,a])}function K2e(o){let t=JSON.parse(o);return{text:t[0],fontFamily:t[1],fontSize:t[2],thickness:t[3],bold:!!t[4],italic:!!t[5],reverse:!!t[6],expansion:t[7]}}function qJ(o){return edt.default.SHA256(o).toString()}function zH(o,t,e,r){let i="";return e?r?i=o+":"+t:i=o:r?i=t:i="",i}function rdt(o,t){if(!o||!o.startsWith("="))return o;o=o.slice(1);let e=/\{([^\}]+)\}/g,r=[],i=[];for(;r=e.exec(o);)i.push(r[1]);for(let n=0;n<i.length;n++){let s=i[n],a=`{${s}!}`;t.has(s)&&(a=t.get(s)),o=o.replace(`{${s}}`,a)}return o}var kC=class{static getInitProps(){return{stringData:{},dData:{},oData:{},attrData:{},cData:{}}}static collectPcb(o,t,e,r,i){e==="STRING"&&(i.stringData[o]||(i.stringData[o]={}),i.stringData[o][t]=r),e==="DIMENSION"&&(i.dData[o]||(i.dData[o]={}),i.dData[o][t]=r),e==="ATTR"&&(i.attrData[o]||(i.attrData[o]={}),i.attrData[o][t]=r),e==="COMPONENT"&&(i.cData[o]||(i.cData[o]={}),i.cData[o][t]=r),e==="OBJ"&&(i.oData[o]||(i.oData[o]={}),i.oData[o][t]=r)}static collectFt(o,t,e,r,i){e==="STRING"&&(i.stringData[o]||(i.stringData[o]={}),i.stringData[o][t]=r),e==="DIMENSION"&&(i.dData[o]||(i.dData[o]={}),i.dData[o][t]=r),e==="ATTR"&&(i.attrData[o]||(i.attrData[o]={}),i.attrData[o][t]=r),e==="OBJ"&&(i.oData[o]||(i.oData[o]={}),i.oData[o][t]=r)}static collectPanel(o,t,e,r,i){e==="POLY"&&(i.oData[o]||(i.oData[o]={}),i.oData[o][t]=r)}static collectSheet(o,t,e,r,i){e==="OBJ"&&(i.oData[o]||(i.oData[o]={}),i.oData[o][t]=r),e==="ATTR"&&(i.attrData[o]||(i.attrData[o]={}),i.attrData[o][t]=r)}static collectSymbol(o,t,e,r,i){e==="OBJ"&&(i.oData[o]||(i.oData[o]={}),i.oData[o][t]=r)}static pcb(o={},t={},e={},r){var i,n,s,a;let l={devices:new Set,symbols:new Set,footprints:new Set,blobs:new Set,fonts:new Set},c={};for(let u in r.oData)for(let d in r.oData[u]){let p=r.oData[u][d];if(!p)continue;let m=JSON.parse(p);m.path&&m.path.startsWith("blob:")&&l.blobs.add(m.path.split("blob:").pop())}for(let u in r.stringData)for(let d in r.stringData[u]){let p=r.stringData[u][d];if(!p)continue;let m=JSON.parse(p);m.fontFamily==="default"||!m.text||l.fonts.add(TP(m.text,m.fontFamily,m.fontSize/10,m.strokeWidth,m.bold,m.italic,m.reverse,m.expansion))}for(let u in r.dData)for(let d in r.dData[u]){let p=r.dData[u][d];if(!p)continue;let m=JSON.parse(p).text;m.fontFamily==="default"||!m.text||l.fonts.add(TP(m.text,m.fontFamily,m.fontSize/10,m.strokeWidth,m.bold,m.italic,m.reverse,m.expansion))}let h={};for(let u in r.attrData)for(let d in r.attrData[u]){let p=r.attrData[u][d];if(!p)continue;let m=JSON.parse(p);h[u]||(h[u]={}),h[u][d]=m,m.key==="Device"&&(c[u]||(c[u]={}),c[u][m.parentId]=m.value)}for(let u in h)for(let d in h[u]){let p=h[u][d];if(!p)continue;let m=p;switch(m.key){case"Device":{m.value&&l.devices.add(m.value);break}case"Symbol":{m.value&&l.symbols.add(m.value);break}case"Footprint":{m.value&&l.footprints.add(m.value);break}}if(m.fontFamily==="default")continue;let g=m.value;if(m.key==="Device"){let y=o[g]||g;g=zH(m.key,y,m.keyVisible,m.valueVisible)}else if(m.key==="Footprint"){let y=t[g]||g;g=zH(m.key,y,m.keyVisible,m.valueVisible)}else if(m.key==="Name"){let y=new Map;if(m.parentId){y.set("ID",m.parentId);let b=(n=(i=r.cData)==null?void 0:i[u])==null?void 0:n[m.parentId];if(b){let P=JSON.parse(b);if(Object.entries(P.attrs).forEach(T=>y.set(T[0],T[1])),(s=c==null?void 0:c[u])!=null&&s[m.parentId]){let T=(a=c==null?void 0:c[u])==null?void 0:a[m.parentId],I=e[T];I&&Object.entries(I).forEach(C=>y.set(C[0],C[1]))}}}g=zH(m.key,rdt(g,y),m.keyVisible,m.valueVisible)}else g=zH(m.key,g,m.keyVisible,m.valueVisible);g&&l.fonts.add(TP(g,m.fontFamily,m.fontSize/10,m.strokeWidth,m.bold,m.italic,m.reverse,m.expansion))}return l}static footprint(o){let t={blobs:new Set,fonts:new Set};for(let e in o.oData)for(let r in o.oData[e]){let i=o.oData[e][r];if(!i)continue;let n=JSON.parse(i);n.path&&n.path.startsWith("blob:")&&t.blobs.add(n.path.split("blob:").pop())}for(let e in o.stringData)for(let r in o.stringData[e]){let i=o.stringData[e][r];if(!i)continue;let n=JSON.parse(i);n.fontFamily==="default"||!n.text||t.fonts.add(TP(n.text,n.fontFamily,n.fontSize/10,n.strokeWidth,n.bold,n.italic,n.reverse,n.expansion))}for(let e in o.dData)for(let r in o.dData[e]){let i=o.dData[e][r];if(!i)continue;let n=JSON.parse(i).text;n.fontFamily==="default"||!n.text||t.fonts.add(TP(n.text,n.fontFamily,n.fontSize/10,n.strokeWidth,n.bold,n.italic,n.reverse,n.expansion))}for(let e in o.attrData)for(let r in o.attrData[e]){let i=o.attrData[e][r];if(!i)continue;let n=JSON.parse(i);if(n.fontFamily==="default"||!n.value)continue;let s=zH(n.key,n.value,n.keyVisible,n.valueVisible);t.fonts.add(TP(s,n.fontFamily,n.fontSize/10,n.strokeWidth,n.bold,n.italic,n.reverse,n.expansion))}return t}static panel(o){let t={blobs:new Set};for(let e in o.oData)for(let r in o.oData[e]){let i=o.oData[e][r];if(!i)continue;let n=JSON.parse(i);n.fillColor&&n.fillColor.startsWith("blob:")&&t.blobs.add(n.fillColor.split("blob:").pop())}return t}static sheet(o,t){let e={devices:new Set,symbols:new Set,footprints:new Set,blobs:new Set};for(let r in o.oData)for(let i in o.oData[r]){let n=o.oData[r][i];if(!n)continue;let s=JSON.parse(n);s.content&&s.content.startsWith("blob:")&&e.blobs.add(s.content.split("blob:").pop())}for(let r in o.attrData)for(let i in o.attrData[r]){let n=o.attrData[r][i];if(!n)continue;let s=JSON.parse(n);if(s.value)switch(s.key){case"Device":{e.devices.add(s.value);break}case"Symbol":{e.symbols.add(s.value),t&&(t[s.value]=s.parentId);break}case"Footprint":{e.footprints.add(s.value),t&&(t[s.value]=s.parentId);break}}}return{dataSet:e,parentIds:t}}static symbol(o){let t={blobs:new Set};for(let e in o.oData)for(let r in o.oData[e]){let i=o.oData[e][r];if(!i)continue;let n=JSON.parse(i);n.content&&n.content.startsWith("blob:")&&t.blobs.add(n.content.split("blob:").pop())}return t}};function idt(o,t){return o.ticket===t.ticket?o.client===t.client?o.id===t.id?0:o.id<t.id?-1:1:o.client<t.client?-1:1:o.ticket<t.ticket?-1:1}var h4e=class{constructor(o=1){this.startNum=o,this.orderLists={},this.idOrderLists={},this.cbArr=new Array,this.maxNum={}}orderChange(o){this.cbArr.push(o)}setOrderNum(o,t,e,r,i=1){if(i<1)throw new Error("step must be greater than 0");let n=kw(this.orderLists,t,()=>new $2e(idt)),s=kw(this.maxNum,t,()=>this.startNum-1),a=kw(this.idOrderLists,t,()=>new Map),l=a.get(o);if(l){if(l.ticket<=e)return;n.remove(l),s-=l.step}let c={id:o,ticket:e,num:0,client:r,step:i};a.set(o,c),n.insert(c),s+=i;let h=s,u=0;n.backwardTraverse(d=>(u++,d.num=h,this.cbArr.forEach(p=>p(d.id,t,d.num)),h-=d.step,d!==c)),this.maxNum[t]=s,u>1e4&&(console.log("------------------ notify --------",c,"height: ",n.getHeight(),"total: ",n.getSize(),"notifies: ",u),console.log("------------------ all --------"))}getOrderNum(o,t){var e,r,i,n;return(n=(i=(r=(e=this.idOrderLists)==null?void 0:e[t])==null?void 0:r.get)==null?void 0:i.call(r,o))==null?void 0:n.num}getMaxNum(o){var t;return((t=this.orderLists[o])==null?void 0:t.getSize())||0}clearNum(){for(let o in this.idOrderLists)this.idOrderLists[o].clear(),delete this.idOrderLists[o];for(let o in this.orderLists)delete this.orderLists[o]}},ndt=class{constructor(o,t=1,e=[]){this.consistencyManager=o,this.startNum=t,this.needOrderType=e,this.initIng=!1,this.allOrderNum={},this.maxNum={},this.consistencyManager.onChange((r,i,n,s,a,l,c,h,u,d,p,m)=>{try{if(this.calculation)if(s==="ELE_PLACEHOLDER"){let g=n?JSON.parse(n):null;g&&this.calculation.setOrderNum(i,g.dataType,c!=null?c:l,a,g.max)}else this.calculation.setOrderNum(i,s,c!=null?c:l,a);this.onParseLine(i,s,n?JSON.parse(n):null,a,l,h,m)}catch(g){console.error(g)}})}initCalculation(){this.calculation=new h4e(this.startNum)}setIsInit(o){this.initIng=o}setNeedNum(o){this.needNum=o}setOrderNum(o,t,e){this.needNum&&this.needOrderType&&this.needOrderType.includes(e)&&t!==void 0&&(this.allOrderNum[o]=t,this.setMaxNum(e,t))}deleteOrderNum(o){delete this.allOrderNum[o]}getOrderNum(o){return this.allOrderNum[o]}setMaxNum(o,t,e){(e||this.maxNum[o]===void 0||this.maxNum[o]<t)&&(this.maxNum[o]=t)}getMaxNum(o){return this.maxNum[o]===void 0&&(this.maxNum[o]=this.startNum-1),++this.maxNum[o]}},odt=Object.create(null),sdt=class extends fbe{constructor(o){super(o),this.creators={},this.headCbArr=[],this.docHead={},this.historyDocHead={},this.uniqueIds={},this.cacheType=["META","DELETE_DOC","ELE_PLACEHOLDER","META_PLACEHOLDER","VARIANT_GROUPED"],this.docIds=new h4e,this.needDocIdDoctype=["PANEL","PCB","SCH_PAGE","SCH","SIMULATION"],this.historyMap={},this.clearTime=null,this.currentTime=0,this.wDocData=new Map,this.orderTree=new Wut(this.wDocData)}onLine(o,t,e,r,i,n,s,a,l,c,h,u,d){this.remoteChange(t,i,s,o,e,r,n,void 0,a,l,c,void 0,void 0,void 0,d)}onDocHead(o,t,e,r){r&&o!=null&&o.uuid&&o!=null&&o.updateTime&&(this.historyDocHead[r.uuid]||(this.historyDocHead[r.uuid]={}),(!this.historyDocHead[r.uuid][o.uuid]||this.historyDocHead[r.uuid][o.uuid].updateTime<o.updateTime)&&(this.historyDocHead[r.uuid][o.uuid]=o)),o.updateTime=o.updateTime||(t==null?void 0:t.updateTime),o.user=o.user||{uuid:t==null?void 0:t.uuid,username:t==null?void 0:t.username,nickname:t==null?void 0:t.nickname},this.setMaxTicket(o.ticket),this.docHead[o.uuid]?(!this.docHead[o.uuid].updateTime||this.docHead[o.uuid].updateTime<o.updateTime)&&(this.docHead[o.uuid].client=o.uuid,this.docHead[o.uuid].user=o.user,this.docHead[o.uuid].updateTime=o.updateTime,this.docHead[o.uuid].version=o.version,this.docHead[o.uuid].docType=o.docType,this.docHead[o.uuid].uuid=o.uuid,this.docHead[o.uuid].editVersion=o.editVersion,o.ticket&&o.ticket>this.docHead[o.uuid].ticket&&(this.docHead[o.uuid].ticket=o.ticket)):this.docHead[o.uuid]=o,this.creators[o.uuid]?this.creators[o.uuid].createTime>o.updateTime&&(this.creators[o.uuid].createTime=o.updateTime,this.creators[o.uuid].creator=o.user):this.creators[o.uuid]={createTime:o.updateTime,creator:o.user};for(let i of this.headCbArr)i(o,t)}onHeadChange(o){this.headCbArr.push(o)}setCacheData(o){this.getCache=o}setDoctype(o,t){this.docHead[o]?this.docHead[o].docType=t:this.docHead[o]={docType:t}}getDoctype(o){var t,e;return(e=(t=this.docHead)==null?void 0:t[o])==null?void 0:e.docType}getDataTicket(o,t){var e,r,i,n,s,a;return(a=(s=(n=(i=(r=(e=this.wDocData)==null?void 0:e.get)==null?void 0:r.call(e,o))==null?void 0:i.get)==null?void 0:n.call(i,t))==null?void 0:s.last)==null?void 0:a.ticket}getDataClient(o,t){var e,r,i,n,s,a;return(a=(s=(n=(i=(r=(e=this.wDocData)==null?void 0:e.get)==null?void 0:r.call(e,o))==null?void 0:i.get)==null?void 0:n.call(i,t))==null?void 0:s.last)==null?void 0:a.client}getAtomData(o,t){var e,r,i,n,s;return(s=(n=(i=(r=(e=this.wDocData)==null?void 0:e.get)==null?void 0:r.call(e,o))==null?void 0:i.get)==null?void 0:n.call(i,t))==null?void 0:s.last}getDataSize(o,t){var e,r,i,n;return il.getLength((n=(i=(r=(e=this.wDocData)==null?void 0:e.get)==null?void 0:r.call(e,o))==null?void 0:i.get)==null?void 0:n.call(i,t))}getFirst(o,t){var e,r,i,n,s;let a=(n=(i=(r=(e=this.wDocData)==null?void 0:e.get)==null?void 0:r.call(e,o))==null?void 0:i.get)==null?void 0:n.call(i,t);return((s=a==null?void 0:a.list)==null?void 0:s[0])||a.last}getFirstTicket(o,t){var e,r;return il.getFirstTicket((r=(e=this.wDocData.get(o))==null?void 0:e.get)==null?void 0:r.call(e,t))}getAllDataId(o){let t=[],e=o||this.wDocData.keys();for(let r of e){let i={doc:r,ids:[]},n=this.wDocData.get(r);if(n){for(let[s]of n)i.ids.push(s);i.ids.length&&t.push(i)}}return t}clear(){for(let[,o]of this.wDocData)o.clear();this.wDocData.clear(),this.creators={}}isHasData(o){if(o){if(this.uniqueIds[o]){for(let t in this.uniqueIds[o])if(this.uniqueIds[o][t].size)return!0}}else for(let[,t]of this.wDocData)for(let[,,]of t)return!0;return!1}delayClear(o=!0){this.clearTime||(this.clearTime=setTimeout(()=>{if(Date.now()-this.currentTime<5e3)this.clearTime=null,this.delayClear(!1);else{let t=!1;for(let e in this.historyMap)for(let r in this.historyMap[e])for(let i in this.historyMap[e][r])for(let n in this.historyMap[e][r][i])this.historyMap[e][r][i][n].promise?(this.clearTime=null,this.delayClear(!1),t=!0):(this.historyMap[e][r][i][n].cache.end(),this.historyMap[e][r][i][n].cache=null,delete this.historyMap[e][r][i][n]);!t&&(this.clearTime=null)}},5e3)),o&&(this.currentTime=Date.now())}getForeachKeys(o){let t=this.wDocData.keys(),e=[],r=[],i=[],n=[],s=[],a=[],l=[],c=[],h=[];for(let u of t)switch(this.getDoctype(u)){case"DEVICE":e.push(u);break;case"FOOTPRINT":i.push(u);break;case"SYMBOL":r.push(u);break;case"BOARD":n.push(u);break;case"SCH":s.push(u);break;case"SCH_PAGE":a.push(u);break;case"PCB":l.push(u);break;case"FONT":case"BLOB":h.push(u);break;default:c.push(u);break}return[...i,...r,...e,...n,...s,...a,...l,...c,...h]}getLastData(o,t,e){let r=this.wDocData.get(o);if(!r)return;let i=r.get(t);if(!i)return;let n=null;return il.preForEach(i,s=>!!s.pend==!!e?(n=s,!0):!1),n}revoke(){return!1}getPublishRevoke(o){let t={},e=(n,s,a,l,c,h,u)=>{var d,p,m;let g;u.length&&il.getLength(c)===u.length&&this.orderTree.has(n)&&(this.orderTree.removeNode(n,this.getDoctype(n),s),g=(m=(p=(d=this.orderTree.numSets)==null?void 0:d[n])==null?void 0:p.maxNum)==null?void 0:m[l.dataType],delete c.num),o&&o(n,s,h||"",a?a.client:l.client,a?a.ticket:l.ticket,l.client,l.ticket,a?a.pend:void 0,a?a.dataType:l.dataType,il.getFirstTicket(c),g),u.forEach(y=>il.remove(c,y))},r=(n,s,a,l,c,h)=>{var u;if(!this.getCache||!c||(u=c.data)!=null&&u.length||c.data===""||!c.hId)e(n,s,c,l,a,c==null?void 0:c.data,h);else{let d=c.dNum||0;t[c.hId]||(t[c.hId]={}),t[c.hId][c.hNum]||(t[c.hId][c.hNum]={}),t[c.hId][c.hNum][n]||(t[c.hId][c.hNum][n]=[]),t[c.hId][c.hNum][n][d]||(t[c.hId][c.hNum][n][d]=[]),t[c.hId][c.hNum][n][d].push([s,a,l,c,h])}},i=async(n,s,a,l,c)=>{let h=this.getCache(),u=oW(a,this.getDoctype(a));await h.init(n,s,u,l);for(let d of c){let[p,m,g,y,b]=d;if(m.last===g){let P=h.get(y.start);e(a,p,y,g,m,P,b)}else b.forEach(P=>il.remove(m,P))}};return{update:r,end:()=>{if(this.getCache){for(let n in t)for(let s in t[n])for(let a in t[n][s])for(let l in t[n][s][a])i(n,s,a,l,t[n][s][a][l]);t=null}}}}handleRevoke(o,t,e,r,i,n){let s=[];il.preForEach(e,a=>{if(a.pend&&(!i||a.client===i)){if(s.push(a),a===e.last){let l=il.getPreNode(e,a);if(n)for(;l&&l.pend;)s.push(l),l=il.getPreNode(e,l);r.update(o,t,e,a,l,s)}else s.forEach(l=>il.remove(e,l));return!0}return!1}),il.getLength(e)||this.wDocData.get(o).delete(t)}revokeOne(o,t,e){let r=this.wDocData.get(o);if(!r)return;let i=r.get(t);i&&this.handleRevoke(o,t,i,e)}foreachRevokeAll(o,t=this.getClient()){let e=this.getForeachKeys(),r=this.getPublishRevoke(o);for(let i of e){let n=this.wDocData.get(i);for(let[s,a]of n)this.handleRevoke(i,s,a,r,t,!0)}r.end()}getUniqueDocs(o,t={}){if(!this.uniqueIds[o])return t;for(let e in this.uniqueIds[o]){let r=t[e]||new Set;for(let i of this.uniqueIds[o][e])r.add(i);t[e]=r}return t}revokeByUnique(o,t,e){let r=this.uniqueIds[o];if(r)for(let i in r)this.revokeAll(i,t,Array.from(r[i]),e),r[i].clear()}revokeAll(o,t,e,r){let i=this.wDocData.get(o);if(!i)return;let n=this.getPublishRevoke(r);for(let s of e){let a=i.get(s);a&&this.handleRevoke(o,s,a,n,t)}n.end()}findPreDataByTime(o,t,e,r,i){let n=this.wDocData.get(o);if(!n)return null;let s=n.get(t);if(!s)return null;let a=null,l=0;return il.preForEach(s,c=>{let h=i(c==null?void 0:c.hId,c==null?void 0:c.hNum);return h&&(h<e||h===e&&c.client<r)&&(a?(h>l||h===l&&c.client>a.client)&&(a=c,l=h):(a=c,l=h)),!1}),a}isFilterData(o,t,e){return!!(!o||t.ignoreType&&t.ignoreType.includes(o.dataType)||t.needType&&!t.needType.includes(o.dataType)||t.isPend&&!o.pend||e&&!t.needDelete&&t.needNum&&o.data==="")}getCanvasIds(o){var t;let e=0,r={},i={},n=[],s=[],a=10*1024*1024,l=0,c=(d,p,m)=>{var g;let y=m.last;if(y.pend||(g=y.data)!=null&&g.length){l+y.data.length>a&&(n.push(s),s=[]);let b=[d,p,y.ticket,y.client,y.dataType,y.data,y.pend];o.needNum&&b.push(m.num),s.push(b);return}r[d][y.client]||(r[d][y.client]={}),r[d][y.client][p]=[y.ticket],o.needNum&&r[d][y.client][p].push(m.num),e+=1},h=d=>{let p=d.last;return!!(o.ignoreType&&o.ignoreType.includes(p.dataType)||p.dataType==="ELE_PLACEHOLDER"||!o.needDelete&&p.data==="")};for(let d of o.doc){let p=(t=this.wDocData)==null?void 0:t.get(d);if(!p)continue;r[d]={};let m=this.getDoctype(d);if(o.needNum&&!["BLOB"].includes(m)&&!this.orderTree.has(d)){this.orderTree.add(d);let g=Array.from(p.keys()).sort((y,b)=>{let P=il.getHead(p.get(y)),T=il.getHead(p.get(b)),I=P.firstTicket||P.ticket,C=T.firstTicket||T.ticket;return I===C?P.client>T.client?1:-1:I-C});for(let y of g){let b=p.get(y);b&&(b.num&&(b.num=void 0),this.orderTree.setOrderNum(d,m,y,b,!1),!h(b)&&c(d,y,b))}}else for(let[g,y]of p)h(y)||c(d,g,y);i[d]=this.orderTree.getMaxNum(d)}s.length&&(n.push(s),s=null);let u;return n.length&&(u=Tm(),(0,zut.flowWrite)(u,async d=>{for(let p of n)await d.write(JSON.stringify(p)),p.length=0;n.length=0},void 0,void 0)),{ids:r,maxNum:i,size:e,channel:u}}async getCacheData(o,t,e,r){var i,n,s,a,l;let c=o.data;if(this.getCache&&o.hId&&o.data===void 0){let h=o.dNum||0,u=oW(t,e);if(!((l=(a=(s=(n=(i=this.historyMap)==null?void 0:i[o.hId])==null?void 0:n[o.hNum])==null?void 0:s[u])==null?void 0:a[h])!=null&&l.cache)){this.historyMap[o.hId]||(this.historyMap[o.hId]={}),this.historyMap[o.hId][o.hNum]||(this.historyMap[o.hId][o.hNum]={}),this.historyMap[o.hId][o.hNum][u]||(this.historyMap[o.hId][o.hNum][u]={}),this.historyMap[o.hId][o.hNum][u][h]||(this.historyMap[o.hId][o.hNum][u][h]={cache:null,promise:null});let d=this.getCache();this.historyMap[o.hId][o.hNum][u][h].cache=d;let p=d.init(o.hId,o.hNum,u,h);this.historyMap[o.hId][o.hNum][u][h].promise=p,await p,delete this.historyMap[o.hId][o.hNum][u][h].promise}this.historyMap[o.hId][o.hNum][u][h].promise&&await this.historyMap[o.hId][o.hNum][u][h].promise,c=this.historyMap[o.hId][o.hNum][u][h].cache.get(o.start)}if(c===void 0)throw new Error(`\u83B7\u53D6\u7F13\u5B58\u6570\u636E\u5931\u8D25: hid=${o.hId}, hNum=${o.hNum}, start=${o.start}, docId=${t}`);r(c)}async compress(o,t,e){var r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,x,v,D,w,F,H,z,V;let{updateTime:W,versions:L,keepClient:k,keepFirst:N,notDocHead:U,isPend:B,user:G}=o,{headTicket:Y,clearDelete:X,needNum:K,uniqueId:J,client:se,extractData:ce}=o,{removeBoard:te,eIds:oe,notChangePend:$}=o,fe=o.docIds||(oe?[]:void 0),Oe=X&&!!ce;if(J&&this.uniqueIds[J]&&(fe=Object.keys(this.uniqueIds[J]),o.docIds&&(fe=fe.filter(ie=>o.docIds.includes(ie)))),fe||(fe=this.getForeachKeys(Oe)),oe)for(let ie in oe)fe.some(de=>de===ie)||fe.push(ie);let Te,ue;Oe&&(Te=new Set,ue=new Set);let be="",j=async ie=>{if(be){let de=be;be="",e(de.length)?await t(de,!0):t(de,!0)}e(ie.length)?await t(ie):t(ie)},Z=ie=>(be&&(ie+=2+be.length),e(ie));for(let ie of fe){be="";let de=(r=this.wDocData)==null?void 0:r.get(ie);if(!de){K&&!["FONT","BLOB"].includes(ie)&&!this.orderTree.has(ie)&&this.orderTree.add(ie);continue}let me=W||((n=(i=this.docHead)==null?void 0:i[ie])==null?void 0:n.updateTime)||new Date().getTime(),Se=(L==null?void 0:L[ie])||((a=(s=this.docHead)==null?void 0:s[ie])==null?void 0:a.version)||String(me),Re=this.getDoctype(ie);if(X){let vr=de.get("DELETE_DOC");if(vr&&vr.last.data&&(l=JSON.parse(vr.last.data))!=null&&l.isDelete){if(Hut.includes(Re)){let _r=de.get("META"),Ne=_r?JSON.parse(_r.last.data):null,Vt=!!Ne;if(Re==="SCH_PAGE"&&Vt){let Ft=(c=this.wDocData)==null?void 0:c.get(Ne.schematic),ir=(u=(h=Ft.get("DELETE_DOC"))==null?void 0:h.last)==null?void 0:u.data;Vt=Ft&&(!ir||ir&&!((d=JSON.parse(ir))!=null&&d.isDelete))}if(Vt){be=J_(((m=(p=this.docHead)==null?void 0:p[ie])==null?void 0:m.docType)||this.mainDocType,se||this.getClient(),ie,me,Se,G||((y=(g=this.docHead)==null?void 0:g[ie])==null?void 0:y.user),Y||((P=(b=this.docHead)==null?void 0:b[ie])==null?void 0:P.ticket));let Ft=Sf("DELETE_DOC",il.getFirstTicket(vr),"DELETE_DOC",vr.last.data);if(Z(Ft.length)?await j(Ft):j(Ft),_r){if(Re==="SCH_PAGE"){for(let[Fe,tt]of de)if(tt.last.dataType==="META_PLACEHOLDER"&&tt.last.data){let ye=Sf("META_PLACEHOLDER",il.getFirstTicket(tt),Ne.schematic,tt.last.data);Z(ye.length)?await j(ye):j(ye)}}let ir=Sf("META",il.getFirstTicket(_r),"META",_r.last.data);Z(ir.length)?await j(ir):j(ir)}}}continue}}let Je;if(ie==="FONT"&&Te){Je=[];for(let vr of Te)Je.push(K2e(vr))}U||(be=J_(((I=(T=this.docHead)==null?void 0:T[ie])==null?void 0:I.docType)||this.mainDocType,se||this.getClient(),ie,me,Se,G||((E=(C=this.docHead)==null?void 0:C[ie])==null?void 0:E.user),Y||((_=(O=this.docHead)==null?void 0:O[ie])==null?void 0:_.ticket),J||(v=(x=this.docHead)==null?void 0:x[ie])==null?void 0:v.editVersion),J&&this.onDocHead({docType:((w=(D=this.docHead)==null?void 0:D[ie])==null?void 0:w.docType)||this.mainDocType,uuid:ie,client:se||this.getClient(),updateTime:me,version:Se,user:G||((H=(F=this.docHead)==null?void 0:F[ie])==null?void 0:H.user),ticket:Y||((V=(z=this.docHead)==null?void 0:z[ie])==null?void 0:V.ticket),editVersion:self==null?void 0:self.PRO_EDITOR_VERSION}));let Ke;if(J&&(Ke=Array.from(this.uniqueIds[J][ie]),this.uniqueIds[J][ie].clear(),delete this.uniqueIds[J][ie]),oe&&oe[ie]&&(Ke=oe[ie]),Ke||(Ke=K||X?Array.from(de.keys()).sort((vr,_r)=>{let Ne=il.getHead(de.get(vr)),Vt=il.getHead(de.get(_r)),Ft=Ne.firstTicket||Ne.ticket,ir=Vt.firstTicket||Vt.ticket;return Ft===ir?Ne.client>Vt.client?1:-1:Ft-ir}):Array.from(de.keys())),K&&!["FONT","BLOB"].includes(Re)&&!this.orderTree.has(ie)){this.orderTree.add(ie);for(let vr of Ke){let _r=de.get(vr);_r&&(this.isFilterData(_r.last,o,!1)||(_r.num&&(_r.num=void 0),this.orderTree.setOrderNum(ie,Re,vr,_r,!1)))}}let Gt={},Nr=0,xr=kC.getInitProps();for(let vr of Ke){let _r=de.get(vr);if(!_r)continue;let Ne;if(J?il.preForEach(_r,tt=>tt.unique===J?(Ne=tt,delete tt.unique,$||(delete tt.pend,this.setDocMaxTicket(ie,tt.ticket,tt.pend),tt===_r.last&&this.cbArr.forEach(ye=>ye(ie,vr,tt.data,tt.dataType,tt.client,tt.ticket,il.getFirstTicket(_r),void 0,void 0,!0,void 0))),!0):!1):Ne=_r.last,this.isFilterData(Ne,o,!0))continue;if(Oe&&ie==="FONT"&&Je){let tt=K2e(vr);if(!Je.some(ye=>tdt(tt,ye)))continue}if(Oe&&ie==="BLOB"&&!ue.has(vr))continue;if(B&&Ne.pend&&!$&&(delete Ne.pend,this.setDocMaxTicket(ie,Ne.ticket,!1),this.cbArr.forEach(tt=>tt(ie,vr,Ne.data,Ne.dataType,Ne.client,Ne.ticket,il.getFirstTicket(_r),void 0,void 0,!0,void 0))),X){if(Ne.dataType==="ELE_PLACEHOLDER"){let ye=JSON.parse(Ne.data);Gt[ye.dataType]===void 0?Gt[ye.dataType]=ye.max:Gt[ye.dataType]+=ye.max;continue}let tt=c4e(Re);if(tt&&tt.includes(Ne.dataType))if(Ne.data!==""){if(Gt[Ne.dataType]){let ye={dataType:Ne.dataType,max:Gt[Ne.dataType]},yt=Sf("ELE_PLACEHOLDER",il.getFirstTicket(_r)-1,`placeholder${++Nr}`,JSON.stringify(ye));Z(yt.length)?await j(yt):j(yt),delete Gt[Ne.dataType]}}else{Gt[Ne.dataType]===void 0?Gt[Ne.dataType]=1:++Gt[Ne.dataType];continue}}let Vt,Ft=this.getCacheData(Ne,ie,Re,tt=>Vt=tt);if(Vt===void 0&&await Ft,Ne.dataType==="META"&&te&&te.includes(ie)&&Vt){let tt=JSON.parse(Vt);tt.board&&(tt.board="",Vt=JSON.stringify(tt))}let ir=il.getFirstTicket(_r),Fe=Sf(Ne.dataType,Ne.ticket,vr,Vt,k?Ne.client:void 0,N&&Ne.ticket!==ir?ir:void 0,void 0,K?_r.num:void 0);if(Oe)switch(Re){case"PCB":{kC.collectPcb(ie,vr,Ne.dataType,Vt,xr);break}case"FOOTPRINT":{kC.collectFt(ie,vr,Ne.dataType,Vt,xr);break}case"PANEL":{kC.collectPanel(ie,vr,Ne.dataType,Vt,xr);break}case"SYMBOL":{kC.collectSymbol(ie,vr,Ne.dataType,Vt,xr);break}case"SCH_PAGE":case"SIMULATION":{kC.collectSymbol(ie,vr,Ne.dataType,Vt,xr);break}default:break}Z(Fe.length)?await j(Fe):j(Fe)}if(K){let vr=Sf("MAX_NUM",1,"MAX_NUM",JSON.stringify(this.orderTree.getMaxNum(ie)));Z(vr.length)?await j(vr):j(vr)}if(Oe){let vr;switch(Re){case"PCB":{vr=kC.pcb(ce.deviceNames,ce.footprintNames,ce.deviceAttrs,xr);break}case"FOOTPRINT":{vr=kC.footprint(xr);break}case"PANEL":{vr=kC.panel(xr);break}case"SYMBOL":{vr=kC.symbol(xr);break}case"SCH_PAGE":case"SIMULATION":{vr=kC.sheet(xr).dataSet;break}default:break}if(vr!=null&&vr.fonts)for(let _r of vr.fonts)Te.add(_r);if(vr!=null&&vr.blobs)for(let _r of vr.blobs)ue.add(_r)}}}compressFull(o={}){if(this.getCache)throw new Error("\u6570\u636E\u5DF2\u7F13\u5B58\u5230 cacheStorage, \u4E0D\u5141\u8BB8\u540C\u6B65\u83B7\u53D6");let t=[],e=r=>{t.push(r)};return this.compress(o,e,()=>!1),t.join(`|
`)}async chunkCompressFull(o={}){let{chunkLength:t=20*1024*1024}=o,e=new Array,r=[],i=0,n="",s=l=>this.getCache?i+l>t:!1,a=async(l,c)=>{i+l.length>t&&(r.push(e.join(`|
`)),e.length=0,!c&&e.push(n),i=0),c&&(n=l),e.push(l),i+=l.length+2};return await this.compress(o,a,s),e.length>0&&(r.push(e.join(`|
`)),e.length=0,i=0),this.getCache&&this.delayClear(),r}async createSnap(o,t,e,r,i=20*1024*1024){var n,s,a,l,c,h,u,d,p,m;let g=0,y=new Set;for(let[,O]of this.wDocData){g+=150;for(let[_,x]of O)il.preForEach(x,v=>{var D;if(v.hId&&o.has(v.hId)){y.add(v.hId);let w=il.getFirstTicket(x),F=v.ticket!==w&&v.firstTicket!==w?15+w.toString().length:0,H=v.hClient?0:28;return g+=(v.size||((D=v.data)==null?void 0:D.length)||0)+2+F+H,!0}return!1})}if(y.size!==o.size)throw new Error("\u65E0\u6CD5\u521B\u5EFA\u5FEB\u7167\uFF1Ahid \u8282\u70B9\u4E0D\u4E00\u81F4\uFF01\uFF01\uFF01");await t(g);let b=[],P=0,T=!1,I="",C=O=>P+O>i,E=async(O,_)=>{P+O.length>i&&(T=!0,await e(b.join(`|
`)),b.length=0,P=0,!_&&b.push(I)),_&&(I=O),b.push(O),P+=O.length+2};for(let[O,_]of this.wDocData){let x=((s=(n=this.docHead)==null?void 0:n[O])==null?void 0:s.updateTime)||new Date().getTime(),v=((l=(a=this.docHead)==null?void 0:a[O])==null?void 0:l.version)||String(x),D=this.getDoctype(O),w=r(O),F=J_(((h=(c=this.docHead)==null?void 0:c[O])==null?void 0:h.docType)||D,this.getClient(),O,(w==null?void 0:w.updateTime)||x,(w==null?void 0:w.version)||v,(w==null?void 0:w.user)||((d=(u=this.docHead)==null?void 0:u[O])==null?void 0:d.user),(w==null?void 0:w.ticket)||((m=(p=this.docHead)==null?void 0:p[O])==null?void 0:m.ticket));for(let[H,z]of _)await il.awaitPreForEach(z,async(V,W)=>{if(V.hId&&o.has(V.hId)){F&&(C(F.length)?await E(F,!0):E(F,!0),F="");let L,k=this.getCacheData(V,O,D,B=>L=B);L===void 0&&await k;let N=il.getFirstTicket(z),U=Sf(V.dataType,V.ticket,H,L,V.client,V.ticket!==N?N:void 0);C(U.length)?await E(U):E(U),W(!0)}else W(!1)})}if(b.length>0&&(T=!0,await e(b.join(`|
`)),b.length=0,P=0),!T)throw new Error("\u65E0\u6CD5\u521B\u5EFA\u5FEB\u7167\uFF1A\u672A\u751F\u6210\u4EFB\u4F55\u6570\u636E")}async asyncCompressFull(o={}){let t=[],e=r=>{t.push(r)};return await this.compress(o,e,()=>!1),this.delayClear(),t.join(`|
`)}async flowCompressFull(o){let{writer:t,chunkLength:e=1e7}=o,r=new Array,i=0,n=!1,s=l=>i+l>e,a=async l=>{i+l.length>e&&(n=!0,await t(r.join(`|
`)),r.length=0,r.push(""),i=0),r.push(l),i+=l.length+2};await this.compress(o,a,s),r.length>0&&(n=!0,await t(r.join(`|
`)),r.length=0,i=0),n||await t(""),this.delayClear()}removeCache(o){if(o)for(let t=0;t<o.length;t++)this.wDocData.delete(o[t]);else this.wDocData.clear()}setMainDoctype(o){this.mainDocType=o}onChange(o){this.cbArr.push(o)}localChange(o,t,e,r,i){let n=this.getMaxTicket()+1;return this.remoteChange(n,this.getClient(),o,t,e,r,i,!0,void 0,!0,void 0,this.getUnique()),n}safeString(o){return o&&(o in odt,o)}remoteChange(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m){var g,y,b,P,T;this.setMaxTicket(o),s&&this.setDoctype(e,s),s=this.getDoctype(e),a=a||u===this.getUnique();let I=(P=(b=(y=(g=this.wDocData)==null?void 0:g.get)==null?void 0:y.call(g,e))==null?void 0:b.get(r))==null?void 0:P.last;u&&(this.uniqueIds[u]||(this.uniqueIds[u]={}),this.uniqueIds[u][e]||(this.uniqueIds[u][e]=new Set),this.uniqueIds[u][e].add(r)),this.wDocData.get(e)||this.wDocData.set(e,new Map),this.wDocData.get(e).has(r)||this.wDocData.get(e).set(r,{last:null});let C=this.wDocData.get(e).get(r),E=I?il.getFirstTicket(C):null,O=I&&I.ticket===o&&I.client===t&&!!I.pend!=!!c,_=n!=="ELE_PLACEHOLDER"&&n!=="META_PLACEHOLDER"&&(!a||a&&this.getIsLocalChange())&&(!O||O&&this.getIsPendChange()),x=il.find(C,H=>H.client===t&&H.ticket===o);if(x){this.setDocMaxTicket(e,o,c),m&&(x.hId=m.uuid,x.hNum=m.num,x.start=m.start,m.size&&(x.size=m.size),m.hClient&&(x.hClient=m.hClient),m.dNum&&(x.dNum=m.dNum)),this.getCache&&!this.cacheType.includes(n)&&(T=x.data)!=null&&T.length&&x!=null&&x.hId&&delete x.data,x.pend&&!c&&(delete x.pend,_&&x===C.last&&this.cbArr.forEach(H=>H(e,r,i,n,t,o,il.getFirstTicket(C),c,void 0,O,u)));return}let v=o;if(c){let H=[];il.preForEach(C,z=>z.client===t&&z.pend&&z.ticket<o?(H.push(z),!0):!1),H.length&&H.length===il.getLength(C)&&(v=E||o),H.forEach(z=>{il.remove(C,z)})}let D={client:t,ticket:v,dataType:n};m&&(D.hId=m.uuid,D.hNum=m.num,D.start=m.start,m.size&&(D.size=m.size),m.hClient&&(D.hClient=m.hClient),m.dNum&&(D.dNum=m.dNum)),(!this.getCache||!D.hId||!i||this.cacheType.includes(n)||c)&&(D.data=c?i:this.safeString(i)),l!==void 0&&(D.firstTicket=l),c!==void 0&&(D.pend=c),u!==void 0&&(D.unique=u);let w=!I||I.ticket<o||I.ticket===o&&I.client<t;il.insert(C,D);let F=this.getFirstTicket(e,r);if(this.orderTree.has(e)&&(!I||E>F))try{this.orderTree.setOrderNum(e,this.getDoctype(e),r,C,!0,E&&E>F)}catch(H){console.error(H)}if(this.needDocIdDoctype.includes(s)&&(!I||E>F)&&i)if(s==="SCH_PAGE"&&n==="META_PLACEHOLDER"){let H=JSON.parse(i),z=r.split("_"),V=r.split("_")[0],W=z[1]?z[1]:V;this.docIds.setOrderNum(W,V,F,t,H.max)}else if(s==="SCH_PAGE"&&n==="META"){let H=JSON.parse(i);this.docIds.setOrderNum(e,H.schematic,F,t)}else n==="META"&&this.docIds.setOrderNum(e,s,F,t);if(this.setDocMaxTicket(e,v,c),w){let H=il.getFirstTicket(C);_&&this.cbArr.forEach(z=>z(e,r,i,n,t,o,H,c,void 0,O,u))}}};function u4e(o){switch(o=String(o),o){case"1":return"SAFE";case"2":return"OTHER";case"3":return"TRACK";case"4":return"BLIND";case"5":return"RADIUS";case"6":return"PLANE";case"7":return"COPPER";case"8":return"PASTE";case"9":return"SOLDER";case"10":return"DIFFER_ENTAIL";case"11":return"NET_LENGTH";case"12":return"AUTO_ROUTER";case"13":return"NET_LENGTH_TOLERANCE"}return o}function hN(o){if(!o)return{};let t=["1","2","3","4","5","6","7","8","9","10","11","12","13"];for(let e of t)if(o.hasOwnProperty(e)){let r=o[e];delete o[e],o[u4e(e)]=r}return o}var bMe=class{constructor(){this.init=!1,this.defaultSafeData=null,this.defaultCopperSpace=null,this.defaultInnerSpace=null,this.copperChangeMap=new Map,this.innerChangeMap=new Map}addDefaultSafeSpaceData(o){this.init=!0,this.defaultSafeData=o}addDefaultCopperSpace(o,t){this.defaultCopperSpace={netClearance:o,boardClearance:t}}addDefaultInnerSpace(o,t){this.defaultInnerSpace={netClearance:o,boardClearance:t}}getNewDefaultData(o,t){if(o&&this.defaultSafeData==null||!o&&this.defaultInnerSpace==null)return null;let e=o?this.copperChangeMap.get(t):this.innerChangeMap.get(t);if(e==null)return null;let{netClearance:r,boardClearance:i}=e,n=this.defaultSafeData.safeSpacing[0].content,s=new Array(n.length);for(let a=0;a<n.length;a++)s[a]=Array.from(n[a]);return this.updateSafeData(s,r,i),s}fixSafeData(o){if(this.defaultCopperSpace!=null)for(let t of o.safeSpacing)this.updateSafeData(t.content,this.defaultCopperSpace.netClearance,this.defaultCopperSpace.netClearance)}updateSafeData(o,t,e){for(let r=0;r<o.length;r++){let i=o[r];for(let n=0;n<i.length;n++)r==7?n==11||n==8?i[n]=e:i[n]=t:n==7&&(r==11||r==8?i[n]=e:i[n]=t)}}addCopper2SafeChangeMap(o,t,e,r,i){this.copperChangeMap.set(o,{name:t,isDefault:e,netClearance:r,boardClearance:i})}addInner2SafeChangeMap(o,t,e,r,i){this.innerChangeMap.set(o,{name:t,isDefault:e,netClearance:r,boardClearance:i})}getSafeName4Copper(o){var t;return(t=this.copperChangeMap.get(o))==null?void 0:t.name}getSafeName4Plane(o){var t;return(t=this.innerChangeMap.get(o))==null?void 0:t.name}getDefaultCopper(){for(let[,o]of this.copperChangeMap)if(o.isDefault)return o.name;return null}getDefaultPlane(){for(let[,o]of this.innerChangeMap)if(o.isDefault)return o.name;return null}};function PMe(o,t){let e=o,r={TWO_LAYERS_BOARD:"JLCPCB Capability(Two Layers Board)",SINGLE_LAYER_BOARD:"JLCPCB Capability(Single Layer Board)",MULTIPLE_LAYERS_BOARD:"JLCPCB Capability(Multiple Layers Board)",HIGH_FREQUENCY_BOARD:"JLCPCB Capability(High Frequency Board)",ALUMINUM_SUBSTRATE_BOARD:"JLCPCB Capability(Aluminum Substrate Board)",COPPER_SUBSTRATE_BOARD:"JLCPCB Capability(Copper Substrate Board)"};if(e.length==8){Object.values(r).includes(t)&&(e[4][0]=11.811,e[5][4]=11.811),e.splice(1,0,e[1].slice(0));for(let n=2;n<e.length;n++)e[n].splice(1,0,e[n][1]);e.push([].concat(e[1][0],e.slice(1).map(n=>n[1])))}e[1].push(e[1][e[1].length-1]),e.splice(3,0,[...e[1]]),e.splice(4,0,[...e[2]]),e[1].pop();for(let n=5;n<e.length;n++)e[n].splice(3,0,e[n][1]),e[n].splice(4,0,e[n][2]);e[3][3]=e[1][1],e[4][3]=e[2][1],e[4][4]=e[2][2];let i=6;e.splice(7,0,new Array(7).fill(i));for(let n=7;n<e.length;n++)e[n].splice(7,0,i);return e}function adt(o,t){let e=o[0],r=o[1],i=[],n="ALL";if(r instanceof Array){let s=PMe(r,t);i.push({layerId:1,isOpen:!0,content:s})}else{for(let s in r){let a=r[s],l=PMe(a,t);i.push({layerId:+s,isOpen:!0,content:l})}Object.keys(r).length>1&&(n="LAYERED")}return{unit:e,isForAll:n,safeSpacing:i}}function ldt(o){let t=o[0],e=o[1],r=o[2];isNaN(r)&&(r=0);let i=o[3];return isNaN(i)&&(i=11.8),{unit:t,deviceClearance:e,thru2SmdClearance:r,holeClearance:i}}function cdt(o){let t=o[0],e=o[1],r=!0,i=[];if(e instanceof Object)for(let n in e){let s=e[n];i.push({layerId:+n,stroMin:s[0],stroDef:s[1],stroMax:s[2]})}else i.push({layerId:1,stroMin:o[1],stroDef:o[2],stroMax:o[3]});return{unit:t,track:{isOpen:r,content:i}}}function hdt(o){return{unit:o[0],netLenMin:o[1],netLenMax:o[2]}}function udt(o){return{unit:o[0],netLengthTolerance:o[1]}}function ddt(o){let t=o[0],e=o[1],r=!0,i=[],n=[],s=0;if(e instanceof Object)for(let a in e){let l=e[a],{stroke:c,spacing:h,lenTolerMax:u}=l;i.push({layerId:+a,stroMin:c[0],stroDef:c[1],stroMax:c[2]}),n.push({layerId:+a,spacMin:h[0],spacDef:h[1]}),s=u}else i.push({layerId:1,stroMin:o[1],stroDef:o[2],stroMax:o[3]}),n.push({layerId:1,spacMin:o[4],spacDef:o[5]}),s=o[7];return{unit:t,stroWidth:{isOpen:r,content:i},spacing:{isOpen:r,content:n},differPairLenTolerMax:s}}function pdt(o){let t=new Array;for(let e of o){let r=+e[1],i=+e[2];isNaN(r)||r<=0||isNaN(i)||i<=0||r===i||r===1&&i===2||r===2&&i===1||t.push({name:e[0],staLayerId:r,endLayerId:i,viaSizeRule:e[3]})}return{blinds:{content:t}}}function fdt(o){return{unit:o[0],minRadius:o[1],defRadius:o[2],maxRadius:o[3],minInner:o[4],defInner:o[5],maxInner:o[6]}}function mdt(o){let t=[{layerId:1,connType:yN(o[7]!==void 0?o[7]:o[3]),spoWidth:o[8]!==void 0?o[8]:o[4],spoSpac:o[9]!==void 0?o[9]:o[5],spoAng:o[10]?o[10]:o[6]}];return{unit:o[0],mulPad:{isOpen:!0,content:t}}}function gdt(o){let t=[{layerId:1,connType:yN(o[3]),spoWidth:o[4],spoSpac:o[5],spoAng:o[6]}],e=[{layerId:1,connType:Number(o[7])?"NON_CONNECT":"DIRECT"}],r=[{layerId:1,connType:yN(o[8]!==void 0?o[8]:o[3]),spoWidth:o[9]!==void 0?o[9]:o[4],spoSpac:o[10]!==void 0?o[10]:o[5],spoAng:o[11]?o[11]:o[6]}];return{unit:o[0],sglPad:{isOpen:!0,content:t},mulPad:{isOpen:!0,content:r},track:{isOpen:!0,content:e}}}function ydt(o){return{unit:o[0],padTopExpan:o[1],padBotExpan:o[2],testPointTopExpan:o[3]?o[3]:-1e3,testPointBotExpan:o[4]?o[4]:-1e3}}function bdt(o){return{unit:o[0],padTopExpan:o[1],padBotExpan:o[2],viaTopExpan:o[3],viaBotExpan:o[4],testPointTopExpan:o[5]?o[5]:2,testPointBotExpan:o[6]?o[6]:2}}function Pdt(o){function t(i){switch(i=i&&Number(i),i){case 0:return"L45";case 1:return"L90";case 2:return"A90";default:return"L45"}}function e(i){switch(i=i&&Number(i),i){case 0:return"LESS";case 1:return"MID";case 2:return"MORE";default:return"LESS"}}function r(i){switch(i=i&&Number(i),i){case 0:return"SPEED_FIRST";case 1:return"COMPLETION_FIRST";default:return"COMPLETION_FIRST"}}return{routingCorner:t(o[0]),isKeep:!!o[1],viaQuantity:e(o[2]),routingEffectPriority:r(o[3]),layers:o[5],ignoreNets:o[6]}}function yN(o){switch(o=o&&Number(o),o){case 0:return"DIVERGENCE";case 1:return"DIRECT";case 2:return"NON_CONNECT";default:return null}}function Tdt(o,t){let e=t;switch(o){case"SAFE":{let r=t;if(r.isForAll=r.isForAll?"LAYERED":"ALL",r.safeSpacing)for(let i of r.safeSpacing)i.isOpen=!!i.isOpen;e=r;break}case"OTHER":break;case"TRACK":{let r=t;r!=null&&r.track&&(r.track.isOpen=!!r.track.isOpen),e=r;break}case"NET_LENGTH":break;case"NET_LENGTH_TOLERANCE":break;case"DIFFER_ENTAIL":{let r=t;r!=null&&r.stroWidth&&(r.stroWidth.isOpen=!!r.stroWidth.isOpen),r!=null&&r.spacing&&(r.spacing.isOpen=!!r.spacing.isOpen),e=r;break}case"BLIND":break;case"RADIUS":break;case"PLANE":{let r=t;if(r!=null&&r.mulPad&&(r.mulPad.isOpen=!!r.mulPad.isOpen),r.mulPad&&r.mulPad.content)for(let i of r.mulPad.content)i.connType=yN(i.connType);e=r;break}case"COPPER":{let r=t;if(r!=null&&r.sglPad&&(r.sglPad.isOpen=!!r.sglPad.isOpen),r!=null&&r.mulPad&&(r.mulPad.isOpen=!!r.mulPad.isOpen),r!=null&&r.track&&(r.track.isOpen=!!r.track.isOpen),r.track&&r.track.content&&(r.track.content=r.track.content.map(i=>(i.connType=Number(i.connType)?"NON_CONNECT":"DIRECT",i))),r.sglPad&&r.sglPad.content)for(let i of r.sglPad.content)i.connType=yN(i.connType);if(r.mulPad&&r.mulPad.content)for(let i of r.mulPad.content)i.connType=yN(i.connType);e=r;break}case"PASTE":break;case"SOLDER":break;case"AUTO_ROUTER":break}return e}function Idt(o,t,e,r,i,n){if(!(r instanceof Array))return Tdt(o,r);let s,a=!1;switch(e&&(e==="NORMAL"?a=!1:e==="DEFAULT"&&(a=!0)),o){case"SAFE":{s=adt(r,n),a&&i.addDefaultSafeSpaceData(s);break}case"OTHER":{s=ldt(r);break}case"TRACK":{s=cdt(r);break}case"NET_LENGTH":{s=hdt(r);break}case"NET_LENGTH_TOLERANCE":{s=udt(r);break}case"DIFFER_ENTAIL":{s=ddt(r);break}case"BLIND":{s=pdt(r);break}case"RADIUS":{s=fdt(r);break}case"PLANE":{let l=r[1],c=r[2];a&&i.addDefaultInnerSpace(l,c),i.addInner2SafeChangeMap(t,"Plane_"+t,a,l,c),s=mdt(r);break}case"COPPER":{let l=r[1],c=r[2];a&&i.addDefaultCopperSpace(l,c),i.addCopper2SafeChangeMap(t,"Copper_"+t,a,l,c),s=gdt(r);break}case"PASTE":{s=ydt(r);break}case"SOLDER":{s=bdt(r);break}case"AUTO_ROUTER":{s=Pdt(r);break}}return s}function Cdt(o,t,e,r){if(!r.init)return null;function i(n,s){let a=n?"Copper_":"Plane_",l=["RULE"];l[1]="SAFE",l[2]=a+t,l[3]=0;let c=s.getNewDefaultData(n,t);return c==null?null:(l[4]={unit:s.defaultSafeData.unit,isForAll:"ALL",safeSpacing:[{layerId:1,isOpen:!0,content:c}]},l)}switch(o){case"SAFE":return r.fixSafeData(e),null;case"PLANE":return i(!1,r);case"COPPER":return i(!0,r);default:return null}}function Sdt(o,t,e,r){if(!r.init)return{ruleKeyValue:e};let i=o[0],n,s;if(t==4){if(i==="NET_CLASS"||i==="NET"){for(let a in e)String(a)==="COPPER"&&(n={COPPER:r.getSafeName4Copper(e[a])}),String(a)==="PLANE"&&(s={PLANE:r.getSafeName4Plane(e[a])});o[1]==""?(n!=null&&n.COPPER||(n={COPPER:"default"}),s!=null&&s.PLANE||(s={PLANE:"default"})):(n!=null&&n.COPPER||(n={COPPER:r.getDefaultCopper()}),s!=null&&s.PLANE||(s={PLANE:r.getDefaultPlane()}))}}else for(let a in e){if(String(a)==="COPPER"){let l=e[a],c=r.getSafeName4Copper(l);if(c==null&&l=="default"&&(c=r.getDefaultCopper()),c==null)continue;n={COPPER:c}}if(String(a)==="PLANE"){let l=e[a],c=r.getSafeName4Plane(l);if(c==null&&l=="default"&&(c=r.getDefaultPlane()),c==null)continue;s={PLANE:c}}}return{ruleKeyValue:e,copperRuleValue:n,innerPlaneRuleValue:s}}function d4e(o,t){let e=o.length,r=0;for(;r<e;){let i=o.indexOf(`
`,r);i<0&&(i=e);let n=o.substring(r,i);try{if(t(n)===!1)break}catch(s){console.error(s)}r=i+1}}function Edt(o){let t={};return d4e(o,e=>{if(e.startsWith('["PAD"')){let r=JSON.parse(e);t[r[5]]||(t[r[5]]=[]),t[r[5]].push(r[1])}}),t}var Odt=class{parseFull(o){d4e(o,t=>this.onParseLine(JSON.parse(t))),this.onParseEnd()}},p4e=class extends Odt{constructor(o={},t={},e=[],r=[],i=!1){super(),this.deviceName=o,this.footprintName=t,this.footprints=e,this.devices=r,this.footprintIsConnectDevice=i,this.fontCache=[],this.poured={},this.curPartition="",this.eQLenData={},this.eQLenSort=1,this.cache={},this.components={},this.errorIds={},this.dimension={},this.connects={},this.specialColors={},this.reuseBlock={},this.panelize={data:[],stamp:{h:null,v:null},size:{h:null,v:null}},this.layerPhys=0,this.fac=new bMe,this.rules=[],this.ruleSelectors=[],this.ruleTemplateName="",this.layerFill={},this.idsSet=new Set,this.oldId={},this.cachePadNet={},this.creaseIds=[],this.stringId={},this.substrateLayer=new Set,this.layerPhysCache=[],this.randomUuid=0,this.padNumId={},this.componentPadNum={}}getOldId(o){var t;return(t=this.oldId[o])!=null?t:o}handConnect(){for(let o of this.creaseIds)if(this.connects[o])for(let t of this.connects[o])this.connects[t]?this.connects[t].push(o):this.connects[t]=[o]}getConnect(o){return this.connects[o]||[]}transRuleType(o){return u4e(o)}transRuleStatus(o){switch(o=o&&Number(o),o){case 0:return"NORMAL";case 1:return"DEFAULT";default:return"NORMAL"}}transGridType(o){switch(o=o&&Number(o),o){case 0:return"NONE";case 1:return"GRID";case 2:return"OUTLETS";default:return"NONE"}}transLayerStatus(o){o=o&&Number(o);let t=!1,e=!1,r=!1;return o!=null&&!isNaN(o)?(o>=4&&(r=!0,o-=4),o>=2&&(e=!0,o-=2),o===1&&(t=!0)):t=!0,{use:t,show:e,locked:r}}transRoutingMode(o){switch(o=o&&Number(o),o){case 0:return"NONE";case 1:return"PUSH";case 2:return"SURROUND";case 3:return"OBSTRUCT";case 4:return"SURROUND&PUSH";default:return"NONE"}}transPadDef(o){switch(o==null?void 0:o[0]){case"ELLIPSE":return{padType:"ELLIPSE",width:o[1],height:o[2]};case"RECT":return{padType:"RECT",width:o[1],height:o[2],radius:o[3]};case"OVAL":return{padType:"OVAL",width:o[1],height:o[2]};case"POLYGON":case"POLY":return{padType:"POLYGON",path:o[1]};default:return null}}transHoleDef(o){return o?{holeType:o[0],width:o[1],height:o[2]}:null}transPourDef(o){function t(e){switch(e=e&&Number(e),e){case 0:return"GRID_LINE";case 1:return"HORIZONTAL_LINE";case 2:return"VERTICAL_LINE";default:return"GRID_LINE"}}switch(o==null?void 0:o[0]){case"SOLID":return{pourType:"SOLID",fineness:o[1]};case"LINE":return{pourType:t(o[1]),angle:o[2],strokeWidth:o[3],strokeSpacing:o[4]};default:return null}}transUnusedPadRange(o){switch(o=o&&Number(o),o){case 1:return"ALL";case 2:return"PAD";case 3:return"VIA";default:return"VIA"}}transPathOptimization(o){switch(o=o&&Number(o),o){case 0:return"SINGLE";case 1:return"ALL";case 2:return"NONE";default:return"SINGLE"}}transViaType(o){switch(o=o&&Number(o),o){case 0:return"NORMAL";case 1:return"SUTURE";default:return"NORMAL"}}transPadFuncType(o){switch(o=o&&Number(o),o){case 0:return"NORMAL";case 1:return"TEST";case 2:return"MARKER";default:return"NORMAL"}}transPadConnect(o){switch(o=o&&Number(o),o){case 0:return"DIVERGENCE";case 1:return"DIRECT";case 2:return"NON_CONNECT";default:return null}}transFillStyle(o){switch(o=o&&Number(o),o){case 0:return"SOLID";case 1:return"GRID";case 2:return"PLANE";default:return null}}transProhibitType(o){let t=new Set;if(!o)return[];for(let e of o)switch(e=e&&Number(e),e){case 1:t.add("TRACK"),t.add("FILL");break;case 2:t.add("COMPONENT");break;case 3:t.add("VIA");break;case 4:t.add("COPPER"),t.add("PLANE");break;case 5:t.add("TRACK");break;case 6:t.add("FILL");break;case 7:t.add("COPPER");break;case 8:t.add("PLANE");break}return Array.from(t)}transPushCoverDir(o){switch(o=o&&Number(o),o){case 1:return"X_AXIS_POSITIVE";case 2:return"X_AXIS_NEGATIVE";case 4:return"Y_AXIS_POSITIVE";case 8:return"Y_AXIS_NEGATIVE";default:return"X_AXIS_POSITIVE"}}transEntityBelong(o){switch(o=o&&Number(o),o){case 0:return"AUTO";case 1:return"UPPER_SHELLS";case 2:return"LOWER_SHELLS";default:return"AUTO"}}transSlotOption(o){o=o&&Number(o);let t=o;if(!t||t<4)return["OUTLINE","SCREW_PILLAR","ENTITY"];let e=[];return t>=16&&(e.push("ENTITY"),t-=16),t>=8&&(e.push("SCREW_PILLAR"),t-=8),t>=4&&(e.push("OUTLINE"),t-=4),e}transAlignType(o){switch(o=o&&Number(o),o){case 1:return"LEFT_TOP";case 4:return"CENTER_TOP";case 7:return"RIGHT_TOP";case 2:return"LEFT_MIDDLE";case 5:return"CENTER_MIDDLE";case 8:return"RIGHT_MIDDLE";case 3:return"LEFT_BOTTOM";case 6:return"CENTER_BOTTOM";case 9:return"RIGHT_BOTTOM";default:return"LEFT_BOTTOM"}}onParseLine(o){var t;let e=o[0];switch(e){case"DOCTYPE":this.parseDocType(o);break;case"HEAD":this.parseHead(o);break;case"CANVAS":this.parseCanvas(o);break;case"LAYER":this.parseLayer(o);break;case"LAYER_PHYS":this.layerPhysCache.push(o);break;case"ACTIVE_LAYER":this.parseActiveLayer(o);break;case"NET":this.parseNet(o);break;case"PRIMITIVE":this.parsePrimitive(o);break;case"GROUP":this.parseGroup(o);break;case"SILK_OPTS":this.parseSilkOpts(o);break;case"PREFERENCE":this.parsePreference(o);break;case"CONNECT":this.parseConnect(o);break;case"ITEM_ORDER":this.parseItemOrder(o);break;case"PROP":this.parseProp(o);break;case"EQLEN_GRP":this.parseEQLenGrp(o);break;case"EQLEN":this.parseEQLen(o);break;case"FONT":this.parseFont(o);break;case"PAD_NET":{this.cachePadNet[o[1]]||(this.cachePadNet[o[1]]=[]),this.cachePadNet[o[1]].push(o);break}case"REUSE_BLOCK":this.parseReuseBlock(o);break;case"RULE_TEMPLATE":this.parseRuleTemplate(o);break;case"RULE":this.rules.push(o);break;case"RULE_SELECTOR":this.ruleSelectors.push(o);break;case"PANELIZE":this.panelize.data=o;break;case"PANELIZE_STAMP":this.parsePanelizeStamp(o);break;case"PANELIZE_SIDE":this.parsePanelizeSide(o);break;case"POURED":{this.parsePoured(o);break}case"PARTITION":e==="PARTITION"&&(this.curPartition=o[3]?o[1]:"");case"VIA":case"PAD":case"LINE":case"ARC":case"CARC":case"OBJ":case"POLY":case"FILL":if(e==="FILL"&&o[6]===2){this.layerFill[o[4]]||(this.layerFill[o[4]]=[]),this.layerFill[o[4]].push(o);break}case"REGION":case"POUR":case"IMAGE":case"TEARDROP":case"FPC_FILL":case"SHELL":case"CREASE":e==="CREASE"&&this.creaseIds.push(o[1]);case"SHELLCUT":case"SHELL_ENTITY":case"BOSS":case"STRING":if(e==="STRING"&&!/^[a-zA-Z]+\d+$/.test(o[1])){let r=o[1],i=r.split(/([0-9].*)/);if(i.length>=2){let n=i[0],s=i[1];for(let a=0;a<s.length;a++){let l=s.charCodeAt(a);n+=l}r=n}this.stringId[r]=o[1],o[1]=r}case"DIMENSION":case"COMPONENT":{let r=e==="CARC"?"ARC":e,i=fMe(o[1]);this.cache[r]||(this.cache[r]={}),i!==null&&!this.cache[r][i]?this.cache[r][i]={part:this.curPartition,value:o}:(this.errorIds[r]||(this.errorIds[r]=[]),this.errorIds[r].push({part:this.curPartition,value:o})),r==="COMPONENT"&&(this.components[o[1]]||(this.components[o[1]]={attrs:{},footprint:"",device:""}),this.components[o[1]].attrs=o[7]||{}),r==="DIMENSION"&&(this.dimension[o[1]]={attr:[]});break}case"ATTR":{if(this.docType==="PCB"&&!o[3])break;if(o[7]==="Footprint"&&(this.components[o[3]]||(this.components[o[3]]={attrs:{},footprint:"",device:""}),this.components[o[3]].footprint=o[8]),o[7]==="Device"&&(this.components[o[3]]||(this.components[o[3]]={attrs:{},footprint:"",device:""}),this.components[o[3]].device=o[8]),this.dimension[o[1]]){this.dimension[o[1]].attr=o;break}let r=Object.keys(((t=this.cache)==null?void 0:t.COMPONENT)||{}).find(n=>this.cache.COMPONENT[n].value[1]===o[3]);if(r){let n=this.cache.COMPONENT[r];n.attr||(n.attr=[]),n.attr.push({part:this.curPartition,value:o});break}let i=fMe(o[1]);this.cache[e]||(this.cache[e]={}),i!==null&&!this.cache[e][i]?this.cache[e][i]={part:this.curPartition,value:o}:(this.errorIds[e]||(this.errorIds[e]=[]),this.errorIds[e].push({part:this.curPartition,value:o}));break}default:console.warn("can not find hanlder with",o)}}async secondParseLine(o,t,e){let r=o[0];if(this.idsSet.has(o[1])||!o[1]){let i=`randomuuid${++this.randomUuid}`;if(this.oldId[i]=o[1],o[1]=i,e)for(let n of e)n[3]=i}else this.idsSet.add(o[1]);switch(r){case"DOCTYPE":case"HEAD":case"CANVAS":case"LAYER":case"LAYER_PHYS":case"ACTIVE_LAYER":case"NET":case"PRIMITIVE":case"GROUP":case"SILK_OPTS":case"PREFERENCE":case"ITEM_ORDER":case"RULE_TEMPLATE":case"RULE":case"RULE_SELECTOR":case"PANELIZE":case"PANELIZE_STAMP":case"PANELIZE_SIDE":case"CONNECT":case"EQLEN_GRP":case"EQLEN":case"FONT":case"PAD_NET":case"REUSE_BLOCK":case"PROP":break;case"PARTITION":this.parsePartition(o);break;case"VIA":this.parseVia(o);break;case"PAD":this.parsePad(o);break;case"LINE":await this.parseLine(o);break;case"ARC":this.parseArc(o);break;case"CARC":this.parseCArc(o);break;case"OBJ":this.parseObj(o);break;case"POLY":this.parsePoly(o);break;case"FILL":this.parseFill(o);break;case"REGION":this.parseRegion(o);break;case"POUR":this.parsePour(o);break;case"IMAGE":this.parseImage(o);break;case"TEARDROP":this.parseTeardrop(o);break;case"FPC_FILL":this.parseFpcFill(o);break;case"SHELL":this.parseShell(o);break;case"CREASE":this.parseCrease(o);break;case"SHELLCUT":this.parseShellCut(o);break;case"SHELL_ENTITY":this.parseShellEntity(o);break;case"BOSS":this.parseBoss(o);break;case"STRING":this.parseString(o);break;case"ATTR":this.parseAttr(o,t);break;case"DIMENSION":this.parseDimension(o);break;case"COMPONENT":this.parseComponent(o);break;default:console.warn("can not find hanlder with",o)}}onParseEnd(){for(let t of this.layerPhysCache)this.parseLayerPhys(t);this.layerPhysCache=[];for(let t of this.rules)t[1]=this.transRuleType(t[1]),t[3]=this.transRuleStatus(t[3]),t[4]=Idt(t[1],t[2],t[3],t[4],this.fac,this.ruleTemplateName);if(this.fac.init){let t=Array.from(this.rules);for(let e of t){let r=Cdt(e[1],e[2],e[4],this.fac);r&&this.rules.push(r)}}for(let t of this.rules)this.parseRule(t);let o={};for(let t of this.ruleSelectors){let e=Sdt(t[1],t[2],hN(t[3]),this.fac),r=JSON.stringify(t[1]);o[r]?(t[2]&&(o[r].ruleOrder=t[2]),e.ruleKeyValue&&(o[r].ruleKeyValue=Object.assign(o[r].ruleKeyValue,e.ruleKeyValue)),(e.copperRuleValue||t[4])&&(o[r].copperValue=e.copperRuleValue||hN(t[4])),(e.innerPlaneRuleValue||t[5])&&(o[r].innerPlaneValue=e.innerPlaneRuleValue||hN(t[5]))):o[r]={ruleSelect:t[1],ruleOrder:t[2],ruleKeyValue:e.ruleKeyValue,copperValue:e.copperRuleValue||hN(t[4])||{},innerPlaneValue:e.innerPlaneRuleValue||hN(t[5])||{}}}for(let t in o)this.parseRuleSelector(o[t]);this.handConnect(),this.parseEQLenGrpFull(),this.parsePanelize(),this.parseLayerFill();for(let t in this.cache){let e=this.cache[t],r=Object.keys(e).sort((n,s)=>Number(n)-Number(s)),i=-1;for(let n of r){let s=Number(n),a=s-i-1;a>=1&&this.onPHolder(t,a),i=s,this.curPartition=e[s].part,this.secondParseLine(e[s].value,void 0,e[s].attr),e[s].attr&&e[s].attr.forEach(l=>{this.curPartition=l.part,this.secondParseLine(l.value)})}if(this.errorIds[t])for(let n of this.errorIds[t])this.curPartition=n.part,this.secondParseLine(n.value)}this.clearCache()}clearCache(){this.version=void 0,this.docType=void 0,this.curPartition="",this.eQLenData={},this.eQLenSort=1,this.cache={},this.components={},this.errorIds={},this.dimension={},this.connects={},this.specialColors={},this.reuseBlock={},this.panelize.data.length&&(this.panelize.data.length=0,this.panelize.stamp={h:null,v:null},this.panelize.size={h:null,v:null}),this.layerPhys=0,this.fac.init&&(this.fac=new bMe),this.rules=[],this.ruleSelectors=[],this.ruleTemplateName="",this.layerFill={},this.idsSet.clear(),this.oldId={},this.creaseIds.length=0,this.substrateLayer.clear()}fixPolygon(o){if(o[0]=="R"){let t=parseFloat(o[3])/10,e=parseFloat(o[4])/10;o[6]=Math.min(t,e)/2*(parseFloat(o[6])||0)*10}}handleSimplePolygon(o){return!o||this.version>=1.5||this.fixPolygon(o),o}handlePolygon(o){if(this.version<1.5&&o&&o.length){if(!Array.isArray(o[0]))return this.handleSimplePolygon(o);for(let t of o)this.fixPolygon(t)}return o}parseEQLen(o){this.eQLenData[o[1]]?this.eQLenData[o[1]].pads?this.eQLenData[o[1]].pads.push(o[2]):this.eQLenData[o[1]].pads=[o[2]]:this.eQLenData[o[1]]={pads:[o[2]]}}parseEQLenGrp(o){this.eQLenData[o[1]]?(this.eQLenData[o[1]].id=o[1],this.eQLenData[o[1]].name=o[2],this.eQLenData[o[1]].sort=++this.eQLenSort):this.eQLenData[o[1]]={id:o[1],name:o[2],sort:++this.eQLenSort}}parseCanvas(o){this.onCanvas(o[1],o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],this.transGridType(o[10]),this.transGridType(o[11]),o[12])}parseDocType(o){this.docType=o[1];let t=parseFloat(o[2]);this.version=t}parseHead(o){}parseLayer(o){let t=o[8];this.version<1.7&&(t=.5);let e=this.transLayerStatus(o[4]),r=Number(o[1]);if(o[2]==="SUBSTRATE"){if(this.substrateLayer.add(r),r<101)return;r<361&&(r=r+260)}this.onLayer(r,o[2],o[3],e.use,e.show,e.locked,o[5],o[6],o[7],t)}parseLayerPhys(o){let t=Number(o[1]);if(t>=101&&t<361&&this.substrateLayer.has(t))t=t+260;else if(t<101&&this.substrateLayer.has(t))return;this.onLayerPhys(t,o[2],o[3],o[4],o[5],!!o[6],++this.layerPhys)}parseActiveLayer(o){this.onActiveLayer(o[1])}parsePartition(o){this.onPartition(o[1],o[2],o[3],this.handlePolygon(o[4]))}parseNet(o){var t,e,r,i;this.onNet(o[1],(t=o[2])!=null?t:null,(e=o[3])!=null?e:null,!!o[4],(r=o[5])!=null?r:null,!!o[6],(i=o[7])!=null?i:null)}parsePrimitive(o){this.onPrimitive(o[1],!!o[2],!!o[3])}parseGroup(o){this.onGroup(o[1],o[2])}parseSilkOpts(o){this.onSilkOpts(o[1],o[2],o[3])}parsePreference(o){this.onPreference(!!o[1],o[2],!!o[3],o[4],o[5],!!o[6],this.transRoutingMode(o[7]),o[8],!!o[9],!!o[10],!!o[11],o[12],o[13],!!o[14],this.transUnusedPadRange(o[15]),o[16],this.transPathOptimization(o[17]),o[18],o[19],o[20])}parseConnect(o){this.connects[o[1]]=o[2]}parseVia(o){var t,e;this.onVia(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],this.transViaType(o[9]),(t=o[10])!=null?t:null,(e=o[11])!=null?e:null,!!o[12],o[13])}parsePad(o){var t,e,r,i,n,s,a,l,c;this.onPad(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],this.transHoleDef(o[9]),this.transPadDef(o[10]),o[11]&&(e=(t=o[11])==null?void 0:t.map(h=>({startLayer:h[0],endLayer:h[1],pad:this.transPadDef(h[2])})))!=null?e:null,o[12],o[13],o[14],!!o[15],this.transPadFuncType(o[16]),(r=o[17])!=null?r:null,(i=o[18])!=null?i:null,(n=o[19])!=null?n:null,(s=o[20])!=null?s:null,!!o[21],this.transPadConnect(o[22]),(a=o[23])!=null?a:null,(l=o[24])!=null?l:null,(c=o[25])!=null?c:null,o[26],this.getConnect(o[1]))}parseLine(o){this.onLine(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],!!o[10])}parseArc(o){this.onArc(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],o[10],!!o[11],this.specialColors[this.getOldId(o[1])])}parseCArc(o){this.onCArc(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],o[10],!!o[11],this.specialColors[this.getOldId(o[1])])}parseObj(o){this.onObj(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],!!o[10],o[11],!!o[12],this.specialColors[this.getOldId(o[1])])}parseItemOrder(o){this.itemOrder=o[1]}parseProp(o){this.specialColors[o[1]]=o[2]}parseEQLenGrpFull(){for(let o in this.eQLenData){let t=this.eQLenData[o];t.id&&this.onEQLenGrp(t.id,t.name,t.sort,t.pads||[])}this.eQLenData={},this.eQLenSort=1}parsePoly(o){this.onPoly(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],this.handleSimplePolygon(o[6]),!!o[7],this.specialColors[this.getOldId(o[1])])}parseFill(o){this.onFill(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],this.transFillStyle(o[6]),this.handlePolygon(o[7]),!!o[8],this.getConnect(o[1]),this.specialColors[this.getOldId(o[1])])}getZIndex1(o){let t=o.match(XJ);return t!=null&&t.length?t[1]:null}parseLayerFill(){for(let o in this.layerFill){let t=this.layerFill[o];this.onLayerFill(Number(o),{fill:t.map(e=>{let r=this.getZIndex1(e[1]);return{id:e[1],partitionId:this.curPartition||"",groupId:e[2],locked:!!e[8],zIndex:r===null?null:Number(r),netName:e[3],width:e[5],path:this.handlePolygon(e[7]),refs:this.getConnect(e[1]),specialColor:this.specialColors[this.getOldId(e[1])]}})})}}parseRegion(o){let t=o[5],e=t&&t.includes(9)?"CONSTRAINT":"PROHIBIT";t=e?t.filter(r=>r!==9):t,this.onRegion(o[1],this.curPartition||"",o[2],o[3],o[4],this.transProhibitType(t),this.handlePolygon(o[6]),!!o[7],o[8],e)}parsePour(o){let t=o[9];this.version<=1.7&&t&&t[0]==="SOLID"&&t[1]&&(t[1]=8),this.onPour(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],this.handlePolygon(o[8]),this.transPourDef(t),!!o[10],!!o[11]),this.poured[o[1]]&&this.onPoured(o[1],this.poured[o[1]])}parsePoured(o){if(this.version<1.1){if(this.curPourId){let t={id:o[1],strokeWidth:o[2],fill:o[3],path:this.handlePolygon(o[4])};this.poured[this.curPourId]||(this.poured[this.curPourId]={pourFill:[]}),this.poured[this.curPourId].pourFill.push(t)}}else{let t={id:o[1],strokeWidth:o[3],fill:o[4],path:this.handlePolygon(o[5])};this.poured[o[2]]||(this.poured[o[2]]={pourFill:[]}),this.poured[o[2]].pourFill.push(t)}}parseImage(o){this.onImage(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],!!o[9],o[10],!!o[11],this.specialColors[this.getOldId(o[1])])}parseTeardrop(o){let t,e,r;this.version<1.2?(t=o[5],r=o[4]):(t=o[4],e=o[5],r=this.getConnect(o[1])),this.onTeardrop(o[1],this.curPartition||"",o[2],o[3],this.handleSimplePolygon(t),e!=null?e:null,r)}parseFpcFill(o){this.onFpcFill(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],this.handlePolygon(o[6]),!!o[7])}parseShell(o){let t=o[8];t&&t.Direction&&(t.Direction=this.transPushCoverDir(t.Direction)),this.onShell(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],this.handlePolygon(o[7]),t,!!o[9])}parseCrease(o){this.onCrease(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],!!o[9])}parseShellCut(o){this.onShellCut(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],this.handlePolygon(o[6]),!!o[7],this.getConnect(o[1]))}parseShellEntity(o){this.onShellEntity(o[1],this.curPartition||"",o[2],o[3],o[4],this.transEntityBelong(o[5]),this.transSlotOption(o[5]),o[6],o[7],this.handlePolygon(o[8]),!!o[9],this.getConnect(o[1]))}parseBoss(o){var t,e,r,i,n,s;this.version<1.4?this.onBoss(o[1],this.curPartition||"",o[2],o[3],o[5],o[6],(t=o[4])!=null?t:null,o[7],null,null,(e=o[8])!=null?e:null,(r=o[9])!=null?r:null,!!o[10]):this.onBoss(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],(i=o[6])!=null?i:null,o[7],o[8],o[9],(n=o[10])!=null?n:null,(s=o[11])!=null?s:null,!!o[12])}parseDimension(o){var t;let e=this.getOldId(o[1]),r=((t=this.dimension[e])==null?void 0:t.attr)||[];if(r.length){let n=this.fontCache.find(s=>s.id&&s.id===this.getOldId(r[1]));this.version<1.6&&n&&(n.text=r[8],n.fontFamily=r[11],n.fontSize=r[12]/10,n.thickness=r[13]/10,n.bold=r[15],n.italic=r[16],n.reverse=r[18],n.expansion=r[19]/10)}let i={groupId:r[2],layerId:r[4],x:r[5],y:r[6],text:r[8],fontFamily:r[11],fontSize:r[12],strokeWidth:r[13],bold:r[14],italic:r[15],origin:r[16],angle:r[17],reverse:r[18],expansion:r[19],mirror:r[20],locked:r[21],zIndex:null,specialColor:this.specialColors[this.getOldId(r[1])]};this.onDimension(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],!!o[7],o[8],!!o[9],i,this.specialColors[this.getOldId(o[1])],r[2]||"")}parseRuleTemplate(o){this.ruleTemplateName=o[1],this.onRuleTemplate(o[1])}parseRule(o){this.onRule(o[1],o[2],o[3],o[4])}parseRuleSelector(o){this.onRuleSelector(o.ruleSelect,o.ruleOrder,o.ruleKeyValue,o.copperValue,o.innerPlaneValue)}parsePanelize(){let o=this.panelize.data;o.length&&this.onPanelize(!!o[1],o[2],o[3],o[4],o[5],!!o[6],this.panelize.stamp.h,this.panelize.stamp.v,this.panelize.size.h,this.panelize.size.v)}parsePanelizeStamp(o){let t={on:!!o[2],stampHoleGroupQuantity:o[3],stampHoleDiameter:o[4],stampHoleQuantityPerGroup:o[5],stampHoleSpacing:o[6]};o[1]?this.panelize.stamp.v=t:this.panelize.stamp.h=t}parsePanelizeSide(o){let t={on:!!o[2],sideHeight:o[3],positionHoleDiameter:o[4],markDiameter:o[5],markExpansion:o[6]};o[1]?this.panelize.size.v=t:this.panelize.size.h=t}parseComponent(o){let t=this.getOldId(o[1]),e=o[7]||{},r=this.reuseBlock[t];if(r&&Object.assign(e,{"Group ID":r[2]||"","Channel ID":r[3]||""}),this.onComponent(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],e,!!o[8],this.specialColors[t],o[9]),this.cachePadNet[t])for(let i of this.cachePadNet[t])this.parsePadNet(i)}parsePadNet(o){let t=this.getOldId(o[1]);if(o[4]===void 0&&this.components[t]){let e=this.components[t].footprint;if(!e){let i=this.components[t].device;e=this.devices.find(n=>n.uuid===i).attributes.Footprint}let r=this.padNumId[e];if(!r){let i=this.footprints.find(n=>n.uuid===e);i&&(this.padNumId[e]=Edt(i==null?void 0:i.dataStr),r=this.padNumId[e])}if(r&&r[o[2]]){this.componentPadNum[t]||(this.componentPadNum[t]={}),this.componentPadNum[t][o[2]]===void 0&&(this.componentPadNum[t][o[2]]=-1);let i=++this.componentPadNum[t][o[2]];o[4]=r[o[2]][i]}else o[4]=o[2]}this.onPadNet(o[1],this.curPartition||"",o[2],o[3],o[4])}parseReuseBlock(o){this.reuseBlock[o[1]]=o}getFontCache(o,t,e,r,i,n,s,a){let l;return this.version<1.6?l=this.fontCache.find(c=>c.id===o):l=this.fontCache.find(c=>e==c.fontFamily&&t==c.text&&r/10==c.fontSize&&!!s==c.reverse&&a==c.expansion&&!!i==c.bold&&!!n==c.italic&&c.path.length>0),{paths:l==null?void 0:l.path,width:l==null?void 0:l.width,height:l==null?void 0:l.height}}getTextValue(o,t,e,r,i){let n="";return o!=""&&t===""&&this.docType!="PCB"&&!i&&o!="Footprint"&&!this.footprintIsConnectDevice&&(t=`<${o}>`),e?r?n=o+":"+t:n=o:r?n=t:n="",n}getFormulaName(o,t){if(!o||!o.startsWith("="))return o;o=o.slice(1);let e=/\{([^\}]+)\}/g,r=[],i=[];for(;r=e.exec(o);)i.push(r[1]);for(let n=0;n<i.length;n++){let s=i[n],a=`{${s}!}`;t.has(s)&&(a=t.get(s)),o=o.replace(`{${s}}`,a)}return o}parseAttr(o,t){let e=o[11],r=o[12];r&&this.version<1.2&&(e=="default"||e=="")&&(r*=1.5);let i=o[7],n=o[8],s=!!o[9],a=!!o[10],l=this.getOldId(o[3]),c=n;if(i==="Device"){let u=this.deviceName[n]||n;c=this.getTextValue(i,u,s,a,l)}else if(i==="Footprint"){let u=this.footprintName[n]||n;c=this.getTextValue(i,u,s,a,l)}else if(i==="Name"){let u=new Map;if(l){let d=this.components[l];if(u.set("ID",l),Object.entries(d.attrs).forEach(p=>u.set(p[0],p[1])),d.device){let p=this.devices.find(m=>m.uuid===d.device);p&&Object.entries(p.attributes).forEach(m=>u.set(m[0],m[1]))}}c=this.getTextValue(i,this.getFormulaName(n,u),s,a,l)}else c=this.getTextValue(i,n,s,a,l);let h=this.fontCache.find(u=>u.id&&u.id===this.getOldId(o[1]));this.version<1.6&&h&&(h.text=c,h.fontFamily=e,h.fontSize=r/10,h.thickness=o[13]/10,h.bold=o[15],h.italic=o[16],h.reverse=o[18],h.expansion=o[19]/10),this.onAttr(o[1],this.curPartition||"",o[2],l,o[4],o[5],o[6],i,n,s,a,e,r,o[13],!!o[14],!!o[15],this.transAlignType(o[16]),o[17],!!o[18],o[19],!!o[20],!!o[21],t,this.specialColors[this.getOldId(o[1])])}parseFont(o){let t;switch(this.version){case 1:case 1.1:t={id:o[1],path:o[2]};break;case 1.2:case 1.3:case 1.4:case 1.5:t={id:o[1],width:o[2],height:o[3],path:o[4]};break;default:t={text:o[1],fontFamily:o[2],fontSize:o[3],thickness:o[4],bold:!!o[5],italic:!!o[6],reverse:!!o[7],expansion:o[8],width:o[9],height:o[10],path:o[11]};break}this.fontCache.push(t)}parseString(o){var t;let[,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P]=o,T=(t=this.stringId[e])!=null?t:e;c&&this.version<1.2&&(l=="default"||l=="")&&(c*=1.5);let I=this.fontCache.find(C=>C.id&&C.id===this.getOldId(T));this.version<1.6&&I&&(I.text=a,I.fontFamily=l,I.fontSize=c/10,I.thickness=h/10,I.bold=u,I.italic=d,I.reverse=g,I.expansion=y/10),this.onString(e,this.curPartition||"",r,i,n,s,a,l,c,h,!!u,!!d,this.transAlignType(p),m,!!g,y,!!b,!!P,this.specialColors[this.getOldId(T)])}},Adt=Object.create,f4e=Object.defineProperty,_dt=Object.getOwnPropertyDescriptor,vdt=Object.getOwnPropertyNames,xdt=Object.getPrototypeOf,Rdt=Object.prototype.hasOwnProperty,Ddt=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),wdt=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of vdt(t))!Rdt.call(o,i)&&i!==e&&f4e(o,i,{get:()=>t[i],enumerable:!(r=_dt(t,i))||r.enumerable});return o},Ldt=(o,t,e)=>(e=o!=null?Adt(xdt(o)):{},wdt(t||!o||!o.__esModule?f4e(e,"default",{value:o,enumerable:!0}):e,o)),Mdt=Ddt((o,t)=>{"use strict";t.exports=e,t.exports.default=e;function e(L,k,N){N=N||2;var U=k&&k.length,B=U?k[0]*N:L.length,G=r(L,0,B,N,!0),Y=[];if(!G||G.next===G.prev)return Y;var X,K,J,se,ce,te,oe;if(U&&(G=h(L,k,G,N)),L.length>80*N){X=J=L[0],K=se=L[1];for(var $=N;$<B;$+=N)ce=L[$],te=L[$+1],ce<X&&(X=ce),te<K&&(K=te),ce>J&&(J=ce),te>se&&(se=te);oe=Math.max(J-X,se-K),oe=oe!==0?32767/oe:0}return n(G,Y,N,X,K,oe,0),Y}function r(L,k,N,U,B){var G,Y;if(B===W(L,k,N,U)>0)for(G=k;G<N;G+=U)Y=H(G,L[G],L[G+1],Y);else for(G=N-U;G>=k;G-=U)Y=H(G,L[G],L[G+1],Y);return Y&&E(Y,Y.next)&&(z(Y),Y=Y.next),Y}function i(L,k){if(!L)return L;k||(k=L);var N=L,U;do if(U=!1,!N.steiner&&(E(N,N.next)||C(N.prev,N,N.next)===0)){if(z(N),N=k=N.prev,N===N.next)break;U=!0}else N=N.next;while(U||N!==k);return k}function n(L,k,N,U,B,G,Y){if(L){!Y&&G&&g(L,U,B,G);for(var X=L,K,J;L.prev!==L.next;){if(K=L.prev,J=L.next,G?a(L,U,B,G):s(L)){k.push(K.i/N|0),k.push(L.i/N|0),k.push(J.i/N|0),z(L),L=J.next,X=J.next;continue}if(L=J,L===X){Y?Y===1?(L=l(i(L),k,N),n(L,k,N,U,B,G,2)):Y===2&&c(L,k,N,U,B,G):n(i(L),k,N,U,B,G,1);break}}}}function s(L){var k=L.prev,N=L,U=L.next;if(C(k,N,U)>=0)return!1;for(var B=k.x,G=N.x,Y=U.x,X=k.y,K=N.y,J=U.y,se=B<G?B<Y?B:Y:G<Y?G:Y,ce=X<K?X<J?X:J:K<J?K:J,te=B>G?B>Y?B:Y:G>Y?G:Y,oe=X>K?X>J?X:J:K>J?K:J,$=U.next;$!==k;){if($.x>=se&&$.x<=te&&$.y>=ce&&$.y<=oe&&T(B,X,G,K,Y,J,$.x,$.y)&&C($.prev,$,$.next)>=0)return!1;$=$.next}return!0}function a(L,k,N,U){var B=L.prev,G=L,Y=L.next;if(C(B,G,Y)>=0)return!1;for(var X=B.x,K=G.x,J=Y.x,se=B.y,ce=G.y,te=Y.y,oe=X<K?X<J?X:J:K<J?K:J,$=se<ce?se<te?se:te:ce<te?ce:te,fe=X>K?X>J?X:J:K>J?K:J,Oe=se>ce?se>te?se:te:ce>te?ce:te,Te=b(oe,$,k,N,U),ue=b(fe,Oe,k,N,U),be=L.prevZ,j=L.nextZ;be&&be.z>=Te&&j&&j.z<=ue;){if(be.x>=oe&&be.x<=fe&&be.y>=$&&be.y<=Oe&&be!==B&&be!==Y&&T(X,se,K,ce,J,te,be.x,be.y)&&C(be.prev,be,be.next)>=0||(be=be.prevZ,j.x>=oe&&j.x<=fe&&j.y>=$&&j.y<=Oe&&j!==B&&j!==Y&&T(X,se,K,ce,J,te,j.x,j.y)&&C(j.prev,j,j.next)>=0))return!1;j=j.nextZ}for(;be&&be.z>=Te;){if(be.x>=oe&&be.x<=fe&&be.y>=$&&be.y<=Oe&&be!==B&&be!==Y&&T(X,se,K,ce,J,te,be.x,be.y)&&C(be.prev,be,be.next)>=0)return!1;be=be.prevZ}for(;j&&j.z<=ue;){if(j.x>=oe&&j.x<=fe&&j.y>=$&&j.y<=Oe&&j!==B&&j!==Y&&T(X,se,K,ce,J,te,j.x,j.y)&&C(j.prev,j,j.next)>=0)return!1;j=j.nextZ}return!0}function l(L,k,N){var U=L;do{var B=U.prev,G=U.next.next;!E(B,G)&&O(B,U,U.next,G)&&D(B,G)&&D(G,B)&&(k.push(B.i/N|0),k.push(U.i/N|0),k.push(G.i/N|0),z(U),z(U.next),U=L=G),U=U.next}while(U!==L);return i(U)}function c(L,k,N,U,B,G){var Y=L;do{for(var X=Y.next.next;X!==Y.prev;){if(Y.i!==X.i&&I(Y,X)){var K=F(Y,X);Y=i(Y,Y.next),K=i(K,K.next),n(Y,k,N,U,B,G,0),n(K,k,N,U,B,G,0);return}X=X.next}Y=Y.next}while(Y!==L)}function h(L,k,N,U){var B=[],G,Y,X,K,J;for(G=0,Y=k.length;G<Y;G++)X=k[G]*U,K=G<Y-1?k[G+1]*U:L.length,J=r(L,X,K,U,!1),J===J.next&&(J.steiner=!0),B.push(P(J));for(B.sort(u),G=0;G<B.length;G++)N=d(B[G],N);return N}function u(L,k){return L.x-k.x}function d(L,k){var N=p(L,k);if(!N)return k;var U=F(N,L);return i(U,U.next),i(N,N.next)}function p(L,k){var N=k,U=L.x,B=L.y,G=-1/0,Y;do{if(B<=N.y&&B>=N.next.y&&N.next.y!==N.y){var X=N.x+(B-N.y)*(N.next.x-N.x)/(N.next.y-N.y);if(X<=U&&X>G&&(G=X,Y=N.x<N.next.x?N:N.next,X===U))return Y}N=N.next}while(N!==k);if(!Y)return null;var K=Y,J=Y.x,se=Y.y,ce=1/0,te;N=Y;do U>=N.x&&N.x>=J&&U!==N.x&&T(B<se?U:G,B,J,se,B<se?G:U,B,N.x,N.y)&&(te=Math.abs(B-N.y)/(U-N.x),D(N,L)&&(te<ce||te===ce&&(N.x>Y.x||N.x===Y.x&&m(Y,N)))&&(Y=N,ce=te)),N=N.next;while(N!==K);return Y}function m(L,k){return C(L.prev,L,k.prev)<0&&C(k.next,L,L.next)<0}function g(L,k,N,U){var B=L;do B.z===0&&(B.z=b(B.x,B.y,k,N,U)),B.prevZ=B.prev,B.nextZ=B.next,B=B.next;while(B!==L);B.prevZ.nextZ=null,B.prevZ=null,y(B)}function y(L){var k,N,U,B,G,Y,X,K,J=1;do{for(N=L,L=null,G=null,Y=0;N;){for(Y++,U=N,X=0,k=0;k<J&&(X++,U=U.nextZ,!!U);k++);for(K=J;X>0||K>0&&U;)X!==0&&(K===0||!U||N.z<=U.z)?(B=N,N=N.nextZ,X--):(B=U,U=U.nextZ,K--),G?G.nextZ=B:L=B,B.prevZ=G,G=B;N=U}G.nextZ=null,J*=2}while(Y>1);return L}function b(L,k,N,U,B){return L=(L-N)*B|0,k=(k-U)*B|0,L=(L|L<<8)&16711935,L=(L|L<<4)&252645135,L=(L|L<<2)&858993459,L=(L|L<<1)&1431655765,k=(k|k<<8)&16711935,k=(k|k<<4)&252645135,k=(k|k<<2)&858993459,k=(k|k<<1)&1431655765,L|k<<1}function P(L){var k=L,N=L;do(k.x<N.x||k.x===N.x&&k.y<N.y)&&(N=k),k=k.next;while(k!==L);return N}function T(L,k,N,U,B,G,Y,X){return(B-Y)*(k-X)>=(L-Y)*(G-X)&&(L-Y)*(U-X)>=(N-Y)*(k-X)&&(N-Y)*(G-X)>=(B-Y)*(U-X)}function I(L,k){return L.next.i!==k.i&&L.prev.i!==k.i&&!v(L,k)&&(D(L,k)&&D(k,L)&&w(L,k)&&(C(L.prev,L,k.prev)||C(L,k.prev,k))||E(L,k)&&C(L.prev,L,L.next)>0&&C(k.prev,k,k.next)>0)}function C(L,k,N){return(k.y-L.y)*(N.x-k.x)-(k.x-L.x)*(N.y-k.y)}function E(L,k){return L.x===k.x&&L.y===k.y}function O(L,k,N,U){var B=x(C(L,k,N)),G=x(C(L,k,U)),Y=x(C(N,U,L)),X=x(C(N,U,k));return!!(B!==G&&Y!==X||B===0&&_(L,N,k)||G===0&&_(L,U,k)||Y===0&&_(N,L,U)||X===0&&_(N,k,U))}function _(L,k,N){return k.x<=Math.max(L.x,N.x)&&k.x>=Math.min(L.x,N.x)&&k.y<=Math.max(L.y,N.y)&&k.y>=Math.min(L.y,N.y)}function x(L){return L>0?1:L<0?-1:0}function v(L,k){var N=L;do{if(N.i!==L.i&&N.next.i!==L.i&&N.i!==k.i&&N.next.i!==k.i&&O(N,N.next,L,k))return!0;N=N.next}while(N!==L);return!1}function D(L,k){return C(L.prev,L,L.next)<0?C(L,k,L.next)>=0&&C(L,L.prev,k)>=0:C(L,k,L.prev)<0||C(L,L.next,k)<0}function w(L,k){var N=L,U=!1,B=(L.x+k.x)/2,G=(L.y+k.y)/2;do N.y>G!=N.next.y>G&&N.next.y!==N.y&&B<(N.next.x-N.x)*(G-N.y)/(N.next.y-N.y)+N.x&&(U=!U),N=N.next;while(N!==L);return U}function F(L,k){var N=new V(L.i,L.x,L.y),U=new V(k.i,k.x,k.y),B=L.next,G=k.prev;return L.next=k,k.prev=L,N.next=B,B.prev=N,U.next=N,N.prev=U,G.next=U,U.prev=G,U}function H(L,k,N,U){var B=new V(L,k,N);return U?(B.next=U.next,B.prev=U,U.next.prev=B,U.next=B):(B.prev=B,B.next=B),B}function z(L){L.next.prev=L.prev,L.prev.next=L.next,L.prevZ&&(L.prevZ.nextZ=L.nextZ),L.nextZ&&(L.nextZ.prevZ=L.prevZ)}function V(L,k,N){this.i=L,this.x=k,this.y=N,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}e.deviation=function(L,k,N,U){var B=k&&k.length,G=B?k[0]*N:L.length,Y=Math.abs(W(L,0,G,N));if(B)for(var X=0,K=k.length;X<K;X++){var J=k[X]*N,se=X<K-1?k[X+1]*N:L.length;Y-=Math.abs(W(L,J,se,N))}var ce=0;for(X=0;X<U.length;X+=3){var te=U[X]*N,oe=U[X+1]*N,$=U[X+2]*N;ce+=Math.abs((L[te]-L[$])*(L[oe+1]-L[te+1])-(L[te]-L[oe])*(L[$+1]-L[te+1]))}return Y===0&&ce===0?0:Math.abs((ce-Y)/Y)};function W(L,k,N,U){for(var B=0,G=k,Y=N-U;G<N;G+=U)B+=(L[Y]-L[G])*(L[G+1]+L[Y+1]),Y=G;return B}e.flatten=function(L){for(var k=L[0][0].length,N={vertices:[],holes:[],dimensions:k},U=0,B=0;B<L.length;B++){for(var G=0;G<L[B].length;G++)for(var Y=0;Y<k;Y++)N.vertices.push(L[B][G][Y]);B>0&&(U+=L[B-1].length,N.holes.push(U))}return N}}),Ndt=(o=>(o[o.MIL=1]="MIL",o[o.INCH=1e3]="INCH",o[o.FT=12e3]="FT",o[o.YARD=36e3]="YARD",o[o.MILE=6336e4]="MILE",o[o.KM=3937007874e-2]="KM",o[o.M=39370]="M",o[o.DM=3937]="DM",o[o.CM=393.7]="CM",o[o.MM=39.37]="MM",o[o.UM=.039]="UM",o[o.NM=394e-7]="NM",o[o.PT=13.88888888888889]="PT",o[o.PX72=13.88888888888889]="PX72",o[o.PX96=10.416666666666666]="PX96",o[o.PX100=10]="PX100",o[o.LTSPICE=6.25]="LTSPICE",o[o.PX1=.1]="PX1",o[o.PX001=.001]="PX001",o))(Ndt||{}),kdt=(o=>(o.MIL="mil",o.INCH="inch",o.FT="ft",o.YARD="yard",o.MILE="mile",o.KM="km",o.M="m",o.DM="dm",o.CM="cm",o.MM="mm",o.UM="um",o.NM="nm",o.PT="pt",o.PX72="px(72)",o.PX96="px(96)",o.PX100="px(100)",o))(kdt||{}),TMe={mil:1,inch:1e3,ft:12e3,yard:36e3,mile:6336e4,km:3937007874e-2,dm:3937,mm:39.37,um:.039,nm:394e-7,pt:13.88888888888889,"px(72)":13.88888888888889,"px(96)":10.416666666666666,"px(100)":10},uFt=(()=>{let o={};for(let t in TMe)o[TMe[t]]=t;return o})(),dJ,dFt=(dJ=class{constructor(o,t){this.ratio=o/t}wrap(o){return o*this.ratio}static convert(o,t,e){return o*t/e}},dJ.ASIS=new dJ(1,1),dJ),pJ=class{conversion(o,t,e){if(o===t)return e;let r=o+2+t;return this[r](e)}conversion1(o,t,e){let r=o+2+t,i=this[r](e);return t=="mil"?Math.round(i*10)/10:Math.round(i*1e3)/1e3}mil2mil(o){return o}mil2mm(o){return o*.0254}mil2cm(o){return o*.00254}mil2inch(o){return o/1e3}mm2mm(o){return o}mm2mil(o){let t=Math.pow(10,5);return Math.round(o*39.37007874015748*t)/t}mm2cm(o){return o/10}mm2inch(o){let t=Math.pow(10,8);return Math.round(o*.03937007874015748*t)/t}cm2mil(o){let t=Math.pow(10,6);return Math.round(o*393.7007874015748*t)/t}cm2mm(o){return o*10}cm2inch(o){let t=Math.pow(10,7);return Math.round(o*.3937007874015748*t)/t}inch2mil(o){return o*1e3}inch2mm(o){return o*25.4}inch2cm(o){return o*2.54}};pJ.prototype["px(100)2mil"]=o=>o*10,pJ.prototype["px(100)2mm"]=o=>o*.254,pJ.prototype["mil2px(100)"]=o=>o/10,pJ.prototype["mm2px(100)"]=o=>{let t=Math.pow(10,5);return Math.round(o*3.937007874015748*t)/t};var fJ=null,mbe=new ArrayBuffer(8),v2e=new Float64Array(mbe),x2e=new Uint32Array(mbe),IMe=new Uint16Array(mbe),CMe=class{static repeat(o,t){let e=new Array(t);for(;t-- >0;)e[t]=o;return e.join("")}static lpad(o,t,e){let r=e-o.length;return r>0?this.repeat(t,r)+o:o}static rpad(o,t,e){let r=e-o.length;return r>0?o+this.repeat(t,r):o}static strHashcode(o){if(o.length>0){let t=0;for(let e=0;e<o.length;e++)t=31*t+o.charCodeAt(e)|0;return t}else return 0}static arraycopy(o,t,e,r,i){if(o.length>=t+i&&e.length>=r+i)for(;i-- >0;)e[r++]=o[t++];else throw new Error("arraycopy out of range")}static undefAsNull(o){return null}static reverse(o,t){for(let e=0,r=o.length-1;r>=0;e++,r--)t[e]=o[r];return t}static sortAsc(o,t){return o-t}static xmlDecode(o){let t=o.length,e=new Array,r=-1;for(let i=0;i<t;i++){let n=o.charAt(i);if(r>=0){if(n===";"){let s=o.substring(r+1,i);switch(s){case"lt":e.push("<");break;case"gt":e.push(">");break;case"quot":e.push('"');break;case"apos":e.push("'");break;case"amp":e.push("&");break;default:if(s.charAt(0)==="#"){let a=parseInt(s.substring(1));e.push(String.fromCharCode(a))}else e.push("&"+s+";")}r=-1}}else n==="&"?r=i:e.push(n)}return r>=0&&e.push(o.substring(r)),e.join("")}static addAll(o,t){for(let e of t)o.push(e)}static addAllSet(o,t){for(let e of t)o.add(e)}static contains(o,t){for(let e of o)if(e.equals(t))return!0;return!1}static equals(o,t){if(o.length==t.length){for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}else return!1}static remove(o,t){let e=0,r=o.length;for(let i=0;i<r;i++)o[i]===t&&(o.splice(i,1),i--,r--,e++);return e}static getUrlVars(){for(var o={},t=location.href.slice(location.href.indexOf("?")+1).split("&"),e=0;e<t.length;e++){var r=t[e].split("=");o[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return o}static prefix(){if(!fJ){let o=this.getUrlVars().version;o?fJ="/analyzer/v"+o:fJ="/analyzer"}return fJ}static add2objS(o,t,e){if(t in o)return o[t];{let r=e(t);return o[t]=r,r}}static downloadFile(o,t){let e=document.createElement("a"),r=URL.createObjectURL(t);e.download=o,e.href=r,e.click(),URL.revokeObjectURL(r)}static uuid(){let o=new Array;v2e[0]=new Date().getTime(),o.push(x2e[1].toString(16)),v2e[0]=Math.random(),o.push(IMe[3].toString(16));let t=IMe[2].toString(16);o.push("4"+t.substr(0,3)),v2e[0]=performance.now();let e=x2e[0].toString(16)+x2e[1].toString(16);return o.push("0"+e.substr(0,3)),o.push(e.substr(3)),o.join("-")}static funcCopy(o){return(0,eval)("("+o.toString()+")")}static NVL(...o){for(let t of o)if(t!==null)return t;return null}static isSingle(o){return Array.from(new Set(o)).length===o.length}},m4e=class{static rgb(o){if(0<=o&&o<=255)return o;throw new Error(fN.format("RGB should not nagative and not over 255(0xFF): %X",o))}static normal(o){if(isFinite(o))return o;throw new Error(fN.format("%f is not permitted",o))}static positiveOr0(o){if(o>=0)return o;throw new Error(fN.format("%f must >= 0",o))}static positive(o){if(o>0)return o;throw new Error(fN.format("%f must > 0",o))}static notnull(o){if(o!=null)return o;throw new Error("invalid null value")}static mustnull(o){if(o===null)return null;throw new Error("value must be null")}static notEmpty(o){if(o==null||o.length===0)throw new Error("invalid empty string");return o}static nullOrEmpty(o){return o==null||o.length===0}static notNullOrUndef(o){if(o!=null)return o;throw new Error("null or undefined is not permitted")}},Bdt=(o=>(o[o.UNKNOWN=0]="UNKNOWN",o[o.PERCENT=1]="PERCENT",o[o.LEFT_PAD0=2]="LEFT_PAD0",o))(Bdt||{}),Fdt=/(\.?0+)$/,fN=class{static format(o,...t){return this.format1(o,t)}static format1(o,t){let e=this._format(o,t);if(typeof e=="string")return e;throw new Error(this.format("Invalid state on (%d) %s",e,o))}static _format(o,t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l),h=c.charCodeAt(0);switch(r){case 0:h===37?r=1:e.push(c);break;case 1:switch(h){case 100:if(n=t[i++],typeof n=="number")e.push(n.toFixed(0)),r=0;else return l;break;case 102:if(n=t[i++],typeof n=="number")e.push(n.toString()),r=0;else return l;break;case 120:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16)),r=0;else return l;break;case 88:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16).toUpperCase()),r=0;else return l;break;case 115:case 99:n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case 48:s=l+1,a=-1,r=2;break;case 37:e.push("%"),r=0;break;default:return l}break;case 2:switch(h){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a=l;break;case 120:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(CMe.lpad((n|0).toString(16),"0",u)),r=0;else return l}else return l;break;case 88:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(CMe.lpad((n|0).toString(16).toUpperCase(),"0",u)),r=0;else return l}else return l;break;default:return l}break;default:return l}}return e.join("")}static startsWith(o,t){return o.length>=t.length?o.substring(0,t.length)===t:!1}static endsWith(o,t){return o.length>=t.length?o.substring(o.length-t.length)===t:!1}static split(o,t){let e=new Array,r=0;for(;;){let i=o.exec(t);if(i!==null){let n=o.lastIndex-i[0].length;e.push(t.substring(r,n)),r=o.lastIndex}else{let n=t.substring(r);m4e.nullOrEmpty(n)||e.push(n);break}}return e}static fmtNumber(o){return o.toFixed(5).replace(Fdt,"")}},Vdt=(o=>(o[o.DEBUG=0]="DEBUG",o[o.INFO=1]="INFO",o[o.WARNING=2]="WARNING",o[o.ERROR=3]="ERROR",o[o.DUMMY=4]="DUMMY",o))(Vdt||{});function Gdt(o){switch(o){case 0:return"DEBUG";case 1:return"INFO";case 2:return"WARNING";case 3:return"ERROR";case 4:return"DUMMY"}}var Udt=(o,t)=>{o===3?console.error(t):console.log(t)},Hdt=(o,t)=>fN.format("%s %s: %s",new Date,Gdt(o),t),rN,$J=(rN=class{constructor(o,t=Udt,e=Hdt){this.debug=!1,this.level=o,this.writer=t,this.fmt=e}static mix(...o){let t=4;for(let e of o)e.level<t&&(t=e.level);return new rN(t,(e,r)=>{for(let i of o)i.write1(e,r)},(e,r)=>r)}wrap(o=null,t=null){let e=o===null?this.fmt:(i,n)=>(n=o(i,n),this.fmt(i,n)),r=t===null?this.writer:(i,n)=>{t(i,n),this.writer(i,n)};return new rN(this.level,r,e)}chain(o){return o.wrap(this.fmt.bind(this),this.writer.bind(this))}include(o){return this.level<=o}write3(o,t,e){this.include(o)&&this.writer(o,this.fmt(o,fN.format(t,...e)))}write2(o,t){this.include(o)&&(t instanceof Error?this.writer(o,this.fmt(o,t.stack)):this.writer(o,this.fmt(o,t.toString())))}write1(o,t){this.include(o)&&this.writer(o,this.fmt(o,t))}debug3(o,...t){this.write3(0,o,t)}debug2(o){this.write2(0,o)}debug1(o){this.write1(0,o)}info3(o,...t){this.write3(1,o,t)}info2(o){this.write2(1,o)}info1(o){this.write1(1,o)}warning3(o,...t){this.write3(2,o,t)}warning2(o){this.write2(2,o)}warning1(o){this.write1(2,o)}error3(o,...t){this.write3(3,o,t)}error2(o){this.write2(3,o)}error1(o){this.write1(3,o)}},rN.DUMMY=new rN(4),rN),gbe=new ArrayBuffer(8),R2e=new Float64Array(gbe),D2e=new Uint32Array(gbe),SMe=new Uint16Array(gbe),EMe=ArrayBuffer;try{EMe=self.HTMLImageElement||EMe}catch{}var mJ=null;function Fw(o,t,e=0,r=o.length){i(o,null,t,e,r);function i(s,a,l,c,h){let u,d,p,m;if(c<h-1){let g=h-c;if(g>50)a===null&&(a=new Array(g+1)),n(s,a,l,c,(c+h)/2|0,h);else{u=s[c],d=c,p=c,m=h;let y=d+1;for(;y<m;){if(p!=m){if(m=m+-1,l(u,s[m])<=0)continue;s[p]=s[m],p=m;continue}if(l(u,s[y])>=0){d=y,y=d+1;continue}s[p]=s[y],d=y,p=y,y=d+1}s[p]=u,i(s,a,l,c,p),i(s,a,l,p+1,h)}}}function n(s,a,l,c,h,u){i(s,a,l,c,h),i(s,a,l,h,u);for(var d=c,p=h,m=0,g=s[d],y=s[p];d<h&&p<u;){var b=l(g,y);isNaN(b)?(a[m++]=y,y=s[++p]):(b<=0&&(a[m++]=g,g=s[++d]),b>=0&&(a[m++]=y,y=s[++p]))}for(;d<h;d++)a[m++]=s[d];for(;p<u;p++)a[m++]=s[p];for(d=c,p=0;p<m;d++,p++)s[d]=a[p]}}var zg=class{static repeat(o,t){let e=new Array(t);for(;t-- >0;)e[t]=o;return e.join("")}static lpad(o,t,e){let r=e-o.length;return r>0?this.repeat(t,r)+o:o}static rpad(o,t,e){let r=e-o.length;return r>0?o+this.repeat(t,r):o}static strHashcode(o){if(o.length>0){let t=0;for(let e=0;e<o.length;e++)t=31*t+o.charCodeAt(e)|0;return t}else return 0}static arraycopy(o,t,e,r,i){if(o.length>=t+i&&e.length>=r+i)for(;i-- >0;)e[r++]=o[t++];else throw new Error("arraycopy out of range")}static undefAsNull(o){return null}static reverse(o,t){for(let e=0,r=o.length-1;r>=0;e++,r--)t[e]=o[r];return t}static sortAsc(o,t){return o-t}static xmlDecode(o){let t=o.length,e=new Array,r=-1;for(let i=0;i<t;i++){let n=o.charAt(i);if(r>=0){if(n===";"){let s=o.substring(r+1,i);switch(s){case"lt":e.push("<");break;case"gt":e.push(">");break;case"quot":e.push('"');break;case"apos":e.push("'");break;case"amp":e.push("&");break;default:if(s.charAt(0)==="#"){let a=parseInt(s.substring(1));e.push(String.fromCharCode(a))}else e.push("&"+s+";")}r=-1}}else n==="&"?r=i:e.push(n)}return r>=0&&e.push(o.substring(r)),e.join("")}static addAll(o,t){for(let e of t)o.push(e)}static addAllSet(o,t){for(let e of t)o.add(e)}static contains(o,t){for(let e of o)if(e.equals(t))return!0;return!1}static equals(o,t){if(o.length==t.length){for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}else return!1}static remove(o,t){let e=0,r=o.length;for(let i=0;i<r;i++)o[i]===t&&(o.splice(i,1),i--,r--,e++);return e}static getUrlVars(){for(var o={},t=location.href.slice(location.href.indexOf("?")+1).split("&"),e=0;e<t.length;e++){var r=t[e].split("=");o[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return o}static prefix(){if(!mJ){let o=this.getUrlVars().version;o?mJ="/analyzer/v"+o:mJ="/analyzer"}return mJ}static add2objS(o,t,e){if(t in o)return o[t];{let r=e(t);return o[t]=r,r}}static downloadFile(o,t){let e=document.createElement("a"),r=URL.createObjectURL(t);e.download=o,e.href=r,e.click(),URL.revokeObjectURL(r)}static uuid(){let o=new Array;R2e[0]=new Date().getTime(),o.push(D2e[1].toString(16)),R2e[0]=Math.random(),o.push(SMe[3].toString(16));let t=SMe[2].toString(16);o.push("4"+t.substr(0,3)),R2e[0]=performance.now();let e=D2e[0].toString(16)+D2e[1].toString(16);return o.push("0"+e.substr(0,3)),o.push(e.substr(3)),o.join("-")}static funcCopy(o){return(0,eval)("("+o.toString()+")")}static NVL(...o){for(let t of o)if(t!==null)return t;return null}static isSingle(o){return Array.from(new Set(o)).length===o.length}},Wdt=[1,10,100,1e3],gJ=0,Dw=0;function OMe(o,t,e){return gJ=Math.abs(o-t),e>=5&&gJ>1e-5||isNaN(e)&&gJ>1e-8?!1:gJ<1e-13?!0:(Dw=Math.min(AMe(o),AMe(t)),Dw<10&&(Dw=10),isNaN(e)||(Dw=Math.min(Dw,e)),_Me(o,Dw)===_Me(t,Dw))}var yJ=0,bJ=0;function AMe(o){return yJ=0,bJ=0,o>0?yJ=o-Math.floor(o):yJ=o-Math.ceil(o),bJ=(yJ.toString()||"").length,bJ>2?bJ-2:0}function _Me(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=Wdt[t]||Math.pow(10,t)||10;if(e){var i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(i+o)}else return Math.round(o*r+1e-10)/r}var zdt=(o=>(o[o.UNKNOWN=0]="UNKNOWN",o[o.PERCENT=1]="PERCENT",o[o.LEFT_PAD0=2]="LEFT_PAD0",o))(zdt||{}),Ydt=/(\.?0+)$/,mN=class{static format(o,...t){return this.format1(o,t)}static format1(o,t){let e=this._format(o,t);if(typeof e=="string")return e;throw new Error(this.format("Invalid state on (%d) %s",e,o))}static _format(o,t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l),h=c.charCodeAt(0);switch(r){case 0:h===37?r=1:e.push(c);break;case 1:switch(h){case 100:if(n=t[i++],typeof n=="number")e.push(n.toFixed(0)),r=0;else return l;break;case 102:if(n=t[i++],typeof n=="number")e.push(n.toString()),r=0;else return l;break;case 120:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16)),r=0;else return l;break;case 88:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16).toUpperCase()),r=0;else return l;break;case 115:case 99:n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case 48:s=l+1,a=-1,r=2;break;case 37:e.push("%"),r=0;break;default:return l}break;case 2:switch(h){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a=l;break;case 120:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(zg.lpad((n|0).toString(16),"0",u)),r=0;else return l}else return l;break;case 88:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(zg.lpad((n|0).toString(16).toUpperCase(),"0",u)),r=0;else return l}else return l;break;default:return l}break;default:return l}}return e.join("")}static startsWith(o,t){return o.length>=t.length?o.substring(0,t.length)===t:!1}static endsWith(o,t){return o.length>=t.length?o.substring(o.length-t.length)===t:!1}static split(o,t){let e=new Array,r=0;for(;;){let i=o.exec(t);if(i!==null){let n=o.lastIndex-i[0].length;e.push(t.substring(r,n)),r=o.lastIndex}else{let n=t.substring(r);pu.nullOrEmpty(n)||e.push(n);break}}return e}static fmtNumber(o){return o.toFixed(5).replace(Ydt,"")}},pu=class{static rgb(o){if(0<=o&&o<=255)return o;throw new Error(mN.format("RGB should not nagative and not over 255(0xFF): %X",o))}static normal(o){if(isFinite(o))return o;throw new Error(mN.format("%f is not permitted",o))}static positiveOr0(o){if(o>=0)return o;throw new Error(mN.format("%f must >= 0",o))}static positive(o){if(o>0)return o;throw new Error(mN.format("%f must > 0",o))}static notnull(o){if(o!=null)return o;throw new Error("invalid null value")}static mustnull(o){if(o===null)return null;throw new Error("value must be null")}static notEmpty(o){if(o==null||o.length===0)throw new Error("invalid empty string");return o}static nullOrEmpty(o){return o==null||o.length===0}static notNullOrUndef(o){if(o!=null)return o;throw new Error("null or undefined is not permitted")}},PJ,yr=(PJ=class{static regular(o){return Math.round(o*this.precision)/this.precision}static eq(o,t){return Math.abs(o-t)<=this.eps}static neq(o,t){return Math.abs(o-t)>this.eps}static less(o,t){return o-t<-this.eps}static lesseq(o,t){return o-t<=this.eps}static greater(o,t){return o-t>this.eps}static greatereq(o,t){return o-t>=-this.eps}static sqrt(o){return Math.abs(o)<=1e-10?0:Math.sqrt(o)}static sortAsc(o,t){return o-t}static sortDesc(o,t){return t-o}},PJ.eps=1e-8,PJ.precision=1e8,PJ);function bN(o,t){kJ(o.iterator(),t)}function kJ(o,t){let e=0;for(;o.hasNext();){let r=o.next();t(e++,r)}}var jdt=class{constructor(o){this.idx=-1,this.lst=o}hasNext(){return this.idx<this.lst.length-1}next(){if(this.idx<this.lst.length-1)return this.idx++,this.lst[this.idx];throw new Error("bug")}};function Z2e(o){return new jdt(o)}var Hg,Vo=(Hg=class{static toDegrees(o){return o*180/Math.PI}static toRadians(o){return o/180*Math.PI}static regularD(o){return o=o%360,o=o<0?360+o:o,o===360?0:o}static regular(o){return o=o%Hg.PIx2,o=o<0?Hg.PIx2+o:o,o===Hg.PIx2?0:o}static toQuarterBase(o){return Hg.regular((o+Hg.PI_4)/Hg.PI_2*Hg.PI_2)}static toQuarterBaseD(o){return Hg.regularD(((o+45)/90|0)*90)}static transformD(o,t){return Hg.toDegrees(Hg.transform(Hg.toRadians(o),t))}static transform(o,t){let e=Math.cos(o),r=Math.sin(o),i=new Yt(t.data[6],t.data[7]),n=new Yt(e,r).multiply3(t);return Hg.regular(n.angle(i))}},Hg.PIx2=Math.PI*2,Hg.PI_2=Math.PI/2,Hg.PI_4=Math.PI/4,Hg),Bd=class{static dotProd1(o,t,e,r){return o*e+t*r}static dotProd2(o,t,e,r,i,n){return this.dotProd1(e-o,r-t,i-e,n-r)}static dotProd3(o,t,e){return this.dotProd2(o.x,o.y,t.x,t.y,e.x,e.y)}static crossProd1(o,t,e,r){return o*r-t*e}static crossProd2(o,t,e,r,i,n){return this.crossProd1(e-o,r-t,i-e,n-r)}static crossProd3(o,t,e){return this.crossProd2(o.x,o.y,t.x,t.y,e.x,e.y)}static distance2(o,t,e,r){let i=e-o,n=r-t;return i*i+n*n}static distance1(o,t,e,r){return this.hypot(e-o,r-t)}static distance1p(o,t){return this.distance1(o.x,o.y,t.x,t.y)}static hypot(o,t){if(o=Math.abs(o),t=Math.abs(t),t>o){var e=t;t=o,o=e}if(o===0)return t;var r=t/o;return o*Math.sqrt(1+r*r)}},g4e=new ArrayBuffer(16),vMe=new Float64Array(g4e),TJ=new Int32Array(g4e),Vl,Yt=(Vl=class{static sortByXAsc(o,t){return o.x-t.x}static sortByYAsc(o,t){return o.y-t.y}static sortByXYAsc(o,t){return o.x<t.x?-1:o.x>t.x?1:o.y-t.y}static caculateAngle(o,t){let e=Math.cos(o),r=Math.sin(o),i=e*t.data[0]+r*t.data[4],n=e*t.data[1]+r*t.data[5],s=new Vl(i,n).normalize();return Math.atan2(s.y,s.x)}static normal(o,t,e){let r=t.sub(o),i=e.sub(t);return r.cross(i)}static getVector2(o){return new Vl(Math.cos(o),Math.sin(o))}static getCrossPoint1(o,t,e,r){if(o.equals1(t)||e.equals1(r)||yr.eq(1,Math.abs(t.sub(o).normalize().dot(r.sub(e).normalize()))))return null;let i=t.y-o.y,n=o.x-t.x,s=t.x*o.y-o.x*t.y,a=r.y-e.y,l=e.x-r.x,c=r.x*e.y-e.x*r.y,h=i*l-a*n;return new Vl((c*n-s*l)/h,(s*a-c*i)/h)}static getCrossPoint2(o,t,e,r){return this.getCrossPoint1(o,o.add(t),e,e.add(r))}constructor(o,t){this.x=pu.normal(o),this.y=pu.normal(t)}get hashed(){return this._hashed==null&&(vMe[0]=this.x,vMe[1]=this.y,this._hashed=TJ[0]^TJ[1]^TJ[2]^TJ[3]),this._hashed}dot(o){return this.x*o.x+this.y*o.y}length(){return Math.sqrt(this.dot(this))}getCos(){return this.x/this.length()}sub(o){var t=this.x-o.x,e=this.y-o.y;return new Vl(t,e)}add(o){var t=this.x+o.x,e=this.y+o.y;return new Vl(t,e)}div(o){return new Vl(this.x/o,this.y/o)}add1(o,t){return new Vl(this.x+o,this.y+t)}mul(o){return new Vl(this.x*o,this.y*o)}cross(o){return this.x*o.y-this.y*o.x}getSin(){return this.y/this.length()}angle2(o){let t=this.y-o.y,e=this.x-o.x;return t=Math.abs(t-0)<10**-4?0:t,e=Math.abs(e-0)<10**-4?0:e,Math.atan2(t,e)}angleD2(o){return Vo.toDegrees(this.angle2(o))}angle(o){return Math.atan2(this.y-o.y,this.x-o.x)}angleX(o=Vl.ORIGIN){let t=this.angle(o);return t<0&&(t=Math.PI*2+t),t}angleD(o){return Vo.toDegrees(this.angle(o))}distance1(o){let t=o.x-this.x,e=o.y-this.y;return Bd.hypot(t,e)}distance2(o){let t=o.x-this.x,e=o.y-this.y;return t*t+e*e}rotateD(o,t){return this.rotate(o,Vo.toRadians(t))}rotate(o,t){let e=Math.cos(t),r=Math.sin(t),i=this.x-o.x,n=this.y-o.y,s=i*e+n*-r,a=i*r+n*e;return o.add1(s,a)}multiply3(o){let t=this.x*o.data[0]+this.y*o.data[3]+o.data[6],e=this.x*o.data[1]+this.y*o.data[4]+o.data[7];return new Vl(t,e)}multiply4(o){let t=this.x*o.data[0]+this.y*o.data[4]+o.data[12],e=this.x*o.data[1]+this.y*o.data[5]+o.data[13];return new Vl(t,e)}hashCode(){return this.hashed}equals(o,t){return o instanceof Vl?OMe(o.x,this.x,t)&&OMe(o.y,this.y,t):!1}equals1(o){return o?yr.eq(this.x,o.x)&&yr.eq(this.y,o.y):!1}equals2(o,t){return o instanceof Vl?Math.abs(this.x-o.x)<=t&&Math.abs(this.y-o.y)<=t:!1}similarEquals(o,t=.5){return Math.abs(this.x*.1-o.x*.1)<=t&&Math.abs(this.y*.1-o.y*.1)<=t}toString(){return"Vector [X="+this.x+", Y="+this.y+"]"}bbox(){let o=this.x,t=this.y;return new Wg(o,o,t,t)}normalize(){if(this.x===0&&this.y===0)return new Vl(0,0);let o=this.x/this.length(),t=this.y/this.length();return new Vl(o,t)}regular(o=1e-4){let t=Math.round(1/o);return new Vl(Math.round(this.x*t)/t,Math.round(this.y*t)/t)}round(o=4){let t=10**(o|0);return new Vl(Math.round(this.x*t)/t,Math.round(this.y*t)/t)}mirrorX(o=Vl.ORIGIN){return new Vl(this.x,2*o.y-this.y)}mirrorY(o=Vl.ORIGIN){return new Vl(2*o.x-this.x,this.y)}mirrorCenter(o=Vl.ORIGIN){return new Vl(2*o.x-this.x,2*o.y-this.y)}clone(){return new Vl(this.x,this.y)}mirror(o=Vl.ORIGIN){return new Vl(2*o.x-this.x,2*o.y-this.y)}pointOnRays(o,t){let e=Vo.toRadians(o);return new Vl(this.x+Math.cos(e)*t,this.y+Math.sin(e)*t)}pointOnRays2(o,t){let e=o.angle(this);return new Vl(this.x+Math.cos(e)*t,this.y+Math.sin(e)*t)}scale(o){return new Vl(this.x*o,this.y*o)}},Vl.ORIGIN=new Vl(0,0),Vl.X_UNIT_VECTOR=new Vl(1,0),Vl.Y_UNIT_VECTOR=new Vl(0,1),Vl),Xdt=(o=>(o[o.LEFT=0]="LEFT",o[o.CENTER=1]="CENTER",o[o.RIGHT=2]="RIGHT",o))(Xdt||{}),qdt=(o=>(o[o.TOP=0]="TOP",o[o.CENTER=1]="CENTER",o[o.BOTTOM=2]="BOTTOM",o))(qdt||{}),Cf,eO=(Cf=class{constructor(o,t){this.horizontal=o,this.vertical=t}},Cf.LT=new Cf(0,0),Cf.LC=new Cf(0,1),Cf.LB=new Cf(0,2),Cf.CT=new Cf(1,0),Cf.CC=new Cf(1,1),Cf.CB=new Cf(1,2),Cf.RT=new Cf(2,0),Cf.RC=new Cf(2,1),Cf.RB=new Cf(2,2),Cf),$dt=(o=>(o[o.INNER=0]="INNER",o[o.OUTER=1]="OUTER",o[o.SEPARATED=2]="SEPARATED",o[o.INTERSECTED=3]="INTERSECTED",o[o.EQ=4]="EQ",o[o.INSIDE_TOUCHED=5]="INSIDE_TOUCHED",o[o.OUTSIDE_TOUCHED=6]="OUTSIDE_TOUCHED",o))($dt||{}),ib=class{constructor(){this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY}ext1(o){return this.minX=Math.min(this.minX,o.minX),this.maxX=Math.max(this.maxX,o.maxX),this.minY=Math.min(this.minY,o.minY),this.maxY=Math.max(this.maxY,o.maxY),this}ext2(o){return this.minX=Math.min(this.minX,o.x),this.maxX=Math.max(this.maxX,o.x),this.minY=Math.min(this.minY,o.y),this.maxY=Math.max(this.maxY,o.y),this}ext3(o){for(let t=0;t<o.length;t++){let e=o[t];this.ext2(e)}return this}ext4(o){return bN(o,(t,e)=>(this.ext2(e),!0)),this}ext5(o,t,e,r){return this.minX=Math.min(this.minX,o),this.maxX=Math.max(this.maxX,t),this.minY=Math.min(this.minY,e),this.maxY=Math.max(this.maxY,r),this}ext6(o,t){return this.minX=Math.min(this.minX,o),this.maxX=Math.max(this.maxX,o),this.minY=Math.min(this.minY,t),this.maxY=Math.max(this.maxY,t),this}ext7(o){if(o<0){let t=o*2;if(t<this.minX-this.maxX||t<this.minY-this.maxY)throw new Error("")}return this.minX-=o,this.maxX+=o,this.minY-=o,this.maxY+=o,this}ext8(o){let t=[];for(let e=0;e<o.length;e+=2)t.push(new Yt(o[e],o[e+1]));return this.ext3(t)}ext9(o,t,e,r){return this.minX=Math.min(this.minX,o),this.maxX=Math.max(this.maxX,o+e),this.minY=Math.min(this.minY,t),this.maxY=Math.max(this.maxY,t+r),this}ext10({x:o,y:t,width:e,height:r}){return this.ext9(o,t,e,r)}valid(){return isFinite(this.minX)&&isFinite(this.maxX)&&isFinite(this.minY)&&isFinite(this.maxY)}clear(){this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY}build(){return new Wg(this.minX,this.maxX,this.minY,this.maxY)}build1(){return this.valid()?new Wg(this.minX,this.maxX,this.minY,this.maxY):new Wg(0,0,0,0)}},YH=new Float64Array(4),Wg=class HT{static extendRect({x:t,y:e,width:r,height:i}){return new HT(t,t+r,e,e+i)}static extend1(t,e){if(t===null)return new HT(e.x,e.x,e.y,e.y);{let r=Math.min(t.minX,e.x),i=Math.max(t.maxX,e.x),n=Math.min(t.minY,e.y),s=Math.max(t.maxY,e.y);return new HT(r,i,n,s)}}static extend2(t,e){if(t){let r=Math.min(t.minX,e.minX),i=Math.max(t.maxX,e.maxX),n=Math.min(t.minY,e.minY),s=Math.max(t.maxY,e.maxY);return new HT(r,i,n,s)}else return e}static extend3(t,e){let r=Math.min(t.x,e.x),i=Math.max(t.x,e.x),n=Math.min(t.y,e.y),s=Math.max(t.y,e.y);return new HT(r,i,n,s)}static extend4(t,e,r){return new HT(t.x-e/2,t.x+e/2,t.y-r/2,t.y+r/2)}constructor(t,e,r,i){if(this.minX=pu.normal(t),this.maxX=pu.normal(e),this.minY=pu.normal(r),this.maxY=pu.normal(i),t>e||r>i)throw new Error(`min > max is not permitted: [${t}, ${e}, ${r}, ${i}]`)}get data(){return YH[0]=this.minX,YH[1]=this.maxX,YH[2]=this.minY,YH[3]=this.maxY,YH}isContains(t){return this.isContains1(t.x,t.y)}points(){return[this.LL(),this.LR(),this.UR(),this.UL(),this.LL()]}isContains1(t,e){return this.isContainsX(t)&&this.isContainsY(e)}isContains2(t,e){return this.isContainsX1(t)&&this.isContainsY1(e)}isContainsX(t){return t>=this.minX&&t<=this.maxX}isContainsX1(t){return yr.greatereq(t,this.minX)&&yr.lesseq(t,this.maxX)}isContainsY(t){return t>=this.minY&&t<=this.maxY}isContainsY1(t){return yr.greatereq(t,this.minY)&&yr.lesseq(t,this.maxY)}isIntersect(t){return!(this.maxX<t.minX||this.minX>t.maxX||this.maxY<t.minY||this.minY>t.maxY)}extendOfSize(t){return pu.positiveOr0(this.maxX-this.minX+t*2),pu.positiveOr0(this.maxY-this.minY+t*2),new HT(this.minX-t,this.maxX+t,this.minY-t,this.maxY+t)}isInside(t){return this.minX>=t.minX&&this.maxX<=t.maxX&&this.minY>=t.minY&&this.maxY<=t.maxY}isContainsBBox(t){return this.maxX>=t.maxX&&this.minX<=t.minX&&this.maxY>=t.maxY&&this.minY<=t.minY}isContainsBBox1(t){return yr.greatereq(this.maxX,t.maxX)&&yr.lesseq(this.minX,t.minX)&&yr.greatereq(this.maxY,t.maxY)&&yr.lesseq(this.minY,t.minY)}intersect(t){let e=Math.max(this.minX,t.minX),r=Math.min(this.maxX,t.maxX);if(e>r)return null;let i=Math.max(this.minY,t.minY),n=Math.min(this.maxY,t.maxY);return i>n?null:new HT(e,r,i,n)}intersection1(t){let e=Math.max(this.minX,t.minX),r=Math.min(this.maxX,t.maxX);if(yr.greater(e,r))return null;e>r&&(r=e);let i=Math.max(this.minY,t.minY),n=Math.min(this.maxY,t.maxY);return yr.greater(i,n)?null:(i>n&&(n=i),new HT(e,r,i,n))}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}UL(){return new Yt(this.minX,this.maxY)}UR(){return new Yt(this.maxX,this.maxY)}LL(){return new Yt(this.minX,this.minY)}LR(){return new Yt(this.maxX,this.minY)}center(){return new Yt(this.maxX-(this.maxX-this.minX)/2,this.maxY-(this.maxY-this.minY)/2)}area(){return this.width()*this.height()}transform(t){let e=new ib;return e.ext2(this.LL().multiply3(t)),e.ext2(this.LR().multiply3(t)),e.ext2(this.UR().multiply3(t)),e.ext2(this.UL().multiply3(t)),e.build()}transform4(t){let e=new ib;return e.ext2(this.LL().multiply4(t)),e.ext2(this.LR().multiply4(t)),e.ext2(this.UR().multiply4(t)),e.ext2(this.UL().multiply4(t)),e.build()}isSeparated(t){if(t==null||t==null)return!1;let e;this.minX>=t.minX?e=this.minX:e=t.minX;let r;if(this.maxX<=t.maxX?r=this.maxX:r=t.maxX,e>r)return!0;{let i;this.minY>=t.minY?i=this.minY:i=t.minY;let n;return this.maxY<=t.maxY?n=this.maxY:n=t.maxY,i>n}}relation(t){let e=0,r=0,i;this.minX>t.minX?(e++,i=this.minX):this.minX===t.minX?i=this.minX:(r++,i=t.minX);let n;if(this.maxX<t.maxX?(e++,n=this.maxX):this.maxX===t.maxX?n=this.maxX:(r++,n=t.maxX),i>n)return 2;{let s;this.minY>t.minY?(e++,s=this.minY):this.minY===t.minY?s=this.minY:(r++,s=t.minY);let a;return this.maxY<t.maxY?(e++,a=this.maxY):this.maxY===t.maxY?a=this.maxY:(r++,a=t.maxY),s>a?2:e===4?0:r===4?1:e===0&&r===0?4:i===n||s===a?6:e!==r?5:3}}zoom(t){let e=this.width(),r=this.height(),i=this.center();return t!=0&&(e/=t/2,r/=t/2),new HT(i.x-e,i.x+e,i.y-e,i.y+e)}toString(){return"BBox [minX="+this.minX+", maxX="+this.maxX+", minY="+this.minY+", maxY="+this.maxY+"]"}equals(t){return this.minY==t.minY&&this.minX==t.minX&&this.maxX==t.maxX&&this.maxY==t.maxY}extendSize(t,e){return Object.is(void 0,e)&&(e=t),HT.extend4(this.center(),this.width()+t,this.height()+e)}positionOnBBox(t,e=0){let r=this.center(),i=this.width()*e/2,n=this.height()*e/2,s=t.x-r.x,a=t.y-r.y;return s>i?a>n?eO.RT:a<-n?eO.RB:eO.RC:s<-i?a>n?eO.LT:a<-n?eO.LB:eO.LC:a>n?eO.CT:a<-n?eO.CB:eO.CC}bbox(){return this}},BJ=class ul{static mul(t,e,r,i,n,s){let a=0,l=0;for(let c=0;c<t;c++){for(let h=0;h<r;h++){let u=h,d=0;for(let p=0;p<e;p++)d+=i[l+p]*n[u],u+=r;s[a++]=d}l+=e}}constructor(t,e,r){this.m=pu.normal(t),this.n=pu.normal(e);let i=t*e;if(r.length===i){for(let n=0;n<r.length;n++)pu.normal(r[n]);this.data=r}else throw new Error("invalid matrix size")}mul(t){if(this.n===t.m){let e=new Array(this.m*t.n);return ul.mul(this.m,this.n,t.n,this.data,t.data,e),new ul(this.m,t.n,e)}else throw new Error("m !== p")}toString(){let t=[];t.push("Matrix ("),t.push(this.m.toString()),t.push(" x "),t.push(this.n.toString()),t.push(")");let e=0;for(let r=0;r<this.m;r++)for(let i=0;i<this.n;i++){let n=this.data[e++].toString();i===0?(t.push(`
`),t.push("	"),t.push(n)):(t.push(", "),t.push(n))}return t.join("")}static on(t,e,r){return t*e+r}initExpandMatrix(t){let e=this.m,r=this.n,i=r*2,n=new Array(e*i);for(let s=0;s<e;s++)for(let a=0;a<i;a++)a<r?n[ul.on(i,s,a)]=t[ul.on(r,s,a)]:a===e+s?n[ul.on(i,s,a)]=1:n[ul.on(i,s,a)]=0;return n}inverseMatrix(t,e,r){for(let i=0;i<e;i++){let n=t[ul.on(r,i,i)];for(let s=0;s<r;s++)t[ul.on(r,i,s)]/=n}return t}getMatrixRank(t,e,r){let i=Math.min(e,r);for(let n=0;n<e;n++){if(t[ul.on(r,n,n)]===0){let s=new Array(r),a;for(a=n;a<e;a++)if(t[ul.on(r,a,n)]!==0){zg.arraycopy(t,ul.on(r,a,0),s,0,r),zg.arraycopy(t,ul.on(r,n,0),t,ul.on(r,a,0),r),zg.arraycopy(s,0,t,ul.on(r,n,0),r);break}a>=e&&(i-=1)}if(!(i<e))for(let s=0;s<e;s++){if(s===n)continue;let a=t[ul.on(r,s,n)]/t[ul.on(r,n,n)];for(let l=0;l<r;l++)t[ul.on(r,s,l)]-=t[ul.on(r,n,l)]*a}}return i}getInverseMatrix(){if(this.m!==this.n)throw new Error("The matrix is an "+this.m+"x"+this.n+" order matrix, non-square matrix, please check!");function t(s){return yr.lesseq(Math.abs(s),0)}let e=this.initExpandMatrix(this.data.slice(0)),r=this.n*2;function i(s,a){for(let l=0;l<r;l++){let c=e[ul.on(r,s,l)];e[ul.on(r,s,l)]=e[ul.on(r,a,l)],e[ul.on(r,a,l)]=c}}for(let s=0;s<this.m;s++){let a=Math.abs(e[ul.on(r,s,s)]),l=s;if(t(e[ul.on(r,s,s)]))for(let h=s+1;h<this.m;h++){if(t(e[ul.on(r,h,s)])){Math.abs(e[ul.on(r,h,s)])>a&&(a=Math.abs(e[ul.on(r,h,s)]),l=h);continue}i(s,h);break}if(t(e[ul.on(r,s,s)])){if(a===0)throw new Error("The matrix is a non-full rank matrix, please check!");console.warn("The matrix may be a non-full rank matrix, please check!"),l!==s&&i(s,l)}let c=1/e[ul.on(r,s,s)];for(let h=0;h<r;h++)e[ul.on(r,s,h)]*=c;for(let h=0;h<this.m;h++){if(s===h)continue;let u=e[ul.on(r,h,s)];for(let d=s;d<r;d++)e[ul.on(r,h,d)]-=e[ul.on(r,s,d)]*u}}let n=[];for(let s=0;s<this.m;s++)for(let a=this.n;a<r;a++)n[ul.on(this.n,s,a-this.n)]=e[ul.on(r,s,a)];return new ul(this.m,this.n,n)}getTransposeMatrix(){let t=new Array(this.data.length);for(let e=0;e<this.m;e++)for(let r=0;r<this.n;r++)t[r*this.n+e]=this.data[e*this.m+r];return new ul(this.n,this.m,t)}hashCode(){let t=0;for(let e of this.data)t+=e;return t}equals(t){return this===t?!0:t===null?!1:t instanceof ul?!(this.m!=t.m||this.n!=t.n||!zg.equals(this.data,t.data)):!1}},Kdt=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],wu,y4e=(wu=class extends BJ{static translate(o,t,e){return new wu([1,0,0,0,0,1,0,0,0,0,1,0,o,t,e,1])}static translate1(o){return new wu([1,0,0,0,0,1,0,0,0,0,1,0,o.x,o.y,o.z,1])}static rotateX(o){let t=Math.cos(o),e=Math.sin(o);return new wu([1,0,0,0,0,t,e,0,0,-e,t,0,0,0,0,1])}static rotateY(o){let t=Math.cos(o),e=Math.sin(o);return new wu([t,0,-e,0,0,1,0,0,e,0,t,0,0,0,0,1])}static rotateZ(o){let t=Math.cos(o),e=Math.sin(o);return new wu([t,e,0,0,-e,t,0,0,0,0,1,0,0,0,0,1])}static rotateAxis(o,t){o=o.normalize();let e=o.x,r=o.y,i=o.z,n=Math.sin(t),s=Math.cos(t);return new wu([e*e*(1-s)+s,e*r*(1-s)+i*n,e*i*(1-s)-r*n,0,e*r*(1-s)-i*n,r*r*(1-s)+s,r*i*(1-s)+e*n,0,e*i*(1-s)+r*n,r*i*(1-s)-e*n,i*i*(1-s)+s,0,0,0,0,1])}static scale(o,t=o,e=o){return new wu([o,0,0,0,0,t,0,0,0,0,e,0,0,0,0,1])}static flipX(){return new wu([1,0,0,0,0,-1,0,0,0,0,1,0,0,0,0,1])}static flipY(){return new wu([-1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}static rotateZForPoint(o,t){return o.equals1(Yt.ORIGIN)?wu.rotateZ(t):wu.translate(-o.x,-o.y,0).rotateZ(t).translate1(o.x,o.y,0)}static getMatrix4(o,t,e,r){let i=Math.cos(t),n=Math.sin(t),s=e*(o.x*i-o.y*n)+r.x,a=o.x*n+o.y*i+r.y,l=[e*i,n,0,0,-n*e,i,0,0,0,0,1,0,s,a,0,1];return new wu(l)}constructor(o=Kdt){super(4,4,o)}translate(o){return this.multiply4(wu.translate1(o))}translate1(o,t,e){return this.multiply4(wu.translate(o,t,e))}rotateX(o){return this.multiply4(wu.rotateX(o))}rotateY(o){return this.multiply4(wu.rotateY(o))}rotateZ(o){return this.multiply4(wu.rotateZ(o))}scale(o,t=o,e=o){return this.multiply4(wu.scale(o,t,e))}scale1(o){return this.multiply4(wu.scale(o.x,o.y,o.z))}setOrigin(o,t,e){return wu.translate(-o,-t,-e).multiply4(this).translate1(o,t,e)}setOrigin1(o){return this.setOrigin(o.x,o.y,o.z)}multiply4(o){let t=new Array(16);return BJ.mul(4,4,4,this.data,o.data,t),new wu(t)}getInverseMatrix(){let o=super.getInverseMatrix();return new wu(o.data)}getTransposeMatrix(){let o=super.getTransposeMatrix();return new wu(o.data)}inverse(){let o=this.getInverseMatrix();return new wu(o.data)}toMatrix3(){let o=this.data;return new zp([o[0],o[1],0,o[4],o[5],0,o[12],o[13],1])}},wu.ORIGIN=new wu,wu);function jH(o){return m4e.normal(parseFloat(o))}var Zdt=[1,0,0,0,1,0,0,0,1],Wh,zp=(Wh=class extends BJ{static translate(o,t){return new Wh([1,0,0,0,1,0,o,t,1])}static translate1(o){return this.translate(o.x,o.y)}static rotate(o){let t=Math.cos(o),e=Math.sin(o);return new Wh([t,e,0,-e,t,0,0,0,1])}static rotateD(o){return this.rotate(Vo.toRadians(o))}static scale(o,t=o){return new Wh([o,0,0,0,t,0,0,0,1])}static scale1(o,t){return new Wh([o,0,0,0,t,0,0,0,1])}static toDOMMatrix(o){let[t,e,,r,i,,n,s]=o.data;return`matrix(${[t,e,r,i,n,s].join(",")})`}static svgTrasform(o){let t=o.split(" "),e=null;return t.forEach(r=>{r=r.trim();let i=r.trim().replace(")","").split("("),n=i[0],s=i[1].split(",");switch(n){case"translate":let a=jH(s[0]),l=jH(s[1]);e=e?e.translate(a,l):Wh.translate(a,l);break;case"rotate":let c=jH(s[0]),h=jH(s[1]),u=jH(s[2]);e=e?e.setOrigin(h,u):Wh.translate(h,u),e=e.rotateD(c);break;default:return}}),e}constructor(o=Zdt){super(3,3,o);let t=o[0],e=o[3],r=o[1],i=o[4];this.iScale=Math.sqrt(t*t+r*r),this.jScale=Math.sqrt(e*e+i*i)}isMirrored(){return this.det()<0}multiply3(o){let t=new Array(9);return BJ.mul(3,3,3,this.data,o.data,t),new Wh(t)}translate(o,t){return this.multiply3(Wh.translate(o,t))}translate1(o){return this.multiply3(Wh.translate1(o))}scale(o,t=o){return this.multiply3(Wh.scale(o,t))}scale1(o,t){return this.multiply3(Wh.scale1(o,t))}det(){return this.data[0]*this.data[4]-this.data[3]*this.data[1]}invert(){let o=this.getInverseMatrix();return new Wh(o.data)}rotateD(o){return this.multiply3(Wh.rotateD(o))}rotate(o){return this.multiply3(Wh.rotate(o))}resetOffset(){let o=this.data;return new Wh([o[0],o[1],0,o[3],o[4],0,0,0,1])}setOrigin(o,t){return Wh.translate(-o,-t).multiply3(this).translate(o,t)}setOrigin1(o){return this.setOrigin(o.x,o.y)}getInverseMatrix(){return new Wh(super.getInverseMatrix().data)}getTransposeMatrix(){let o=super.getTransposeMatrix();return new Wh(o.data)}toMatrix4(){let o=this.data;return new y4e([o[0],o[1],0,o[2],o[3],o[4],0,o[5],0,0,1,0,o[6],o[7],0,o[8]])}scaleNum(o){return!o||isNaN(o)?o:o*this.iScale}},Wh.ORIGIN=new Wh,Wh.MIRROR_Y=new Wh([1,0,0,0,-1,0,0,0,1]),Wh.MIRROR_X=new Wh([-1,0,0,0,1,0,0,0,1]),Wh.ROT_90=new Wh([0,1,0,-1,0,0,0,0,1]),Wh.ROT_N90=new Wh([0,-1,0,1,0,0,0,0,1]),Wh),Jdt=(o=>(o[o.BUTT=0]="BUTT",o[o.ROUND=1]="ROUND",o[o.SQUARE=2]="SQUARE",o))(Jdt||{}),Qdt=(o=>(o[o.CW=0]="CW",o[o.CCW=1]="CCW",o))(Qdt||{}),dW=class{},J2e=class ZH{constructor(t,e,r){this.p1=t,this.p2=e,this.p3=r}barycentre(){return ZH.barycentre(this.p1,this.p2,this.p3)}incentre(){return ZH.incentre(this.p1,this.p2,this.p3)}static barycentre(t,e,r){let i=t.x+e.x+r.x,n=t.y+e.y+r.y;return new Yt(i/3,n/3)}static incentre(t,e,r){let i=e.sub(r).length(),n=t.sub(r).length(),s=t.sub(e).length(),a=i+n+s,l=i*t.x+n*e.x+s*r.x,c=i*t.y+n*e.y+s*r.y;return new Yt(l/a,c/a)}area(){return ZH.area(this.p1,this.p2,this.p3)}static area(t,e,r){return this.area2(t.x,t.y,e.x,e.y,r.x,r.y)/2}static area2(t,e,r,i,n,s){return Math.abs(Bd.crossProd2(t,e,r,i,n,s))}scale(t,e){let r=zp.translate(-t.x,-t.y).scale(e).translate1(t),i=this.p1.multiply3(r),n=this.p2.multiply3(r),s=this.p3.multiply3(r);return new ZH(i,n,s)}scaleOnBarycentre(t){return this.scale(this.barycentre(),t)}scaleOnIncentre(t){return this.scale(this.incentre(),t)}extend(t){let e=this.incentre(),r=this.p1.add(this.p2).sub(e).scale(1/2),i=r.length(),n=Yt.ORIGIN.pointOnRays2(r,i+t).length()/i;return this.scaleOnIncentre(n)}container(t){let e=this.p3.sub(this.p1),r=this.p2.sub(this.p1),i=t.sub(this.p1),n=e.dot(e),s=e.dot(r),a=e.dot(i),l=r.dot(r),c=r.dot(i),h=1/(n*l-s*s),u=(l*a-s*c)*h;if(u<0||u>1)return!1;let d=(n*c-s*a)*h;return d<0||d>1?!1:u+d<=1}};function IJ(){return{minDistance:Number.POSITIVE_INFINITY,start:null,end:null}}var GC=class K_{static getMinDistanceWithoutCross(t,e){let r=IJ();return K_.minLine(t,e,r),r.minDistance}static getMinDistance(t,e){return WT(t,e)?0:this.getMinDistanceWithoutCross(t,e)}static getMinLineWithCross(t,e){let r=IJ();return K_.minLine(t,e,r),new Tt(r.start,r.end)}static getMinLine(t,e){return K_.intersection(t,e)||this.getMinLineWithCross(t,e)}static getMinDistanceFromPoint(t,e){let r=IJ();if(e instanceof Tt)this.point2LineMinLine(r,e,t);else if(e instanceof mr)this.point2ArcMinDistance(t,e,r);else throw new Error("not support");return r.minDistance}constructor(t,e){if(this.pt1=t,this.pt2=e,this.minline=K_.intersection(t,e),this.minline)this.minDistance=0;else{let r=IJ();K_.minLine(t,e,r),this.minline=new Tt(r.start,r.end),this.minDistance=r.minDistance}}getDistance(){return this.minDistance}getLine(){return this.minline}static intersection(t,e){let r=WT(t,e);if(r===0)return;let i=new Array;for(let n=0;n<r;n+=2){let s=new Yt(it[n],it[n+1]);i.push(s)}return i.length>1?new Tt(i[0],i[1]):new Tt(i[0],i[0])}static minLine(t,e,r){if(t instanceof Tt&&e instanceof Tt)return this.minDistanceForLines(t,e,r);if(t instanceof mr&&e instanceof Tt)return this.minDistanceForLineAndArc(t,e,r);if(t instanceof Tt&&e instanceof mr)return this.minDistanceForLineAndArc(e,t,r);if(t instanceof mr&&e instanceof mr)return this.minDistanceForArcs(t,e,r);throw new Error("not support")}static minDistanceForLines(t,e,r){[t.start(),t.end(),e.start(),e.end()].forEach((i,n)=>{n<2?this.point2LineMinLine(r,e,i):this.point2LineMinLine(r,t,i)})}static minDistanceForLineAndArc(t,e,r){this.point2LineMinLine(r,e,t.start()),this.point2LineMinLine(r,e,t.svgEnd);let i=K_.foot(e,t.center);e.bbox().extendOfSize(1e-8).isContains(i)&&this.point2ArcMinLine(r,t,i),this.point2ArcMinLine(r,t,e.start()),this.point2ArcMinLine(r,t,e.end())}static minDistanceForArcs(t,e,r){this.concentricArc(t,e,r),this.point2ArcMinDistance(e.start(),t,r),this.point2ArcMinDistance(e.svgEnd,t,r),this.point2ArcMinDistance(t.start(),e,r),this.point2ArcMinDistance(t.svgEnd,e,r),(BC(t,e.center)||BC(e,t.center))&&this.shortestLineForArcs(t,e,r)}static minLineForArcAndLine(t,e,r){let i=t.pointOn(r.angleD(t.center)),n=t.pointOn(t.center.angleD(r));this.arcShortestLine(t,e,r,i),this.arcShortestLine(t,e,r,n)}static arcInnerLineFootSegment(t,e,r){let i=r.distance1(t.center);if(i!==0){let n=t.rx*(r.y-t.center.y)/i+t.center.y,s=t.rx*(r.x-t.center.x)/i+t.center.x;i=t.rx-i,i<e.minDistance&&(e.minDistance=i,e.start=new Yt(s,n),e.end=r)}else i=t.rx-i,i<e.minDistance&&(e.minDistance=i,e.start=t.start(),e.end=r)}static shortestLineForArcs(t,e,r){let i=t.center.angleD(e.center),n=e.center.angleD(t.center),s=t.pointOn(i),a=t.pointOn(n),l=e.pointOn(i),c=e.pointOn(n);BC(t,s)&&(this.arcShortestLine(e,r,s,l),this.arcShortestLine(e,r,s,c)),BC(t,a)&&(this.arcShortestLine(e,r,a,l),this.arcShortestLine(e,r,a,c)),this.shortestLineForArcs1(t,e,r)}static shortestLineForArcs1(t,e,r){let i=e.start().sub(t.center).normalize(),n=e.end().sub(t.center).normalize(),s=t.start().sub(e.center).normalize(),a=t.end().sub(e.center).normalize(),l=t.center.add(i.mul(t.rx)),c=t.center.add(n.mul(t.rx)),h=e.center.add(s.mul(e.rx)),u=e.center.add(a.mul(e.rx));BC(t,l)&&yr.greater(e.start().distance2(t.center),0)&&this.arcShortestLine(t,r,e.start(),l),BC(t,c)&&yr.greater(e.end().distance2(t.center),0)&&this.arcShortestLine(t,r,e.end(),c),BC(e,h)&&yr.greater(t.start().distance2(e.center),0)&&this.arcShortestLine(e,r,t.start(),h),BC(e,u)&&yr.greater(t.end().distance2(e.center),0)&&this.arcShortestLine(e,r,t.end(),u)}static concentricArc(t,e,r){if(!(t.center.distance1(e.center)<1e-5&&t.rx===e.rx&&t.ry===e.ry))return;let i=t.start().distance1(e.svgEnd);i<r.minDistance&&(r.minDistance=i,r.start=t.start(),r.end=e.svgEnd),i=e.start().distance1(t.svgEnd),i<r.minDistance&&(r.minDistance=i,r.start=e.start(),r.end=t.svgEnd)}static point2ArcMinDistance(t,e,r){if(BC(e,t)){let i=e.pointOn(t.angleD(e.center)),n=e.pointOn(e.center.angleD(t));this.arcShortestLine(e,r,t,i),this.arcShortestLine(e,r,t,n)}else this.minLineSegment(r,e.start(),t),this.minLineSegment(r,e.svgEnd,t)}static point2ArcMinLine(t,e,r){if(BC(e,r)){let i=r.distance1(e.center);i>e.rx||i>e.ry?this.minLineForArcAndLine(e,t,r):this.arcInnerLineFootSegment(e,t,r)}}static point2LineMinLine(t,e,r){let i=K_.foot(e,r);e.bbox().extendOfSize(1e-8).isContains(i)?this.minLineSegment(t,i,r):(this.minLineSegment(t,e.start(),r),this.minLineSegment(t,e.end(),r))}static minLineSegment(t,e,r){let i=e.distance1(r);i<t.minDistance&&(t.minDistance=i,t.start=e,t.end=r)}static arcShortestLine(t,e,r,i){if(!BC(t,i))return;let n=r.distance1(i);n<e.minDistance&&(e.minDistance=n,e.start=r,e.end=i)}static foot(t,e){if(t.isPoint())return t.start();if(!yr.eq(t.b,0)&&!yr.eq(t.a,0)){let r=t.start(),i=t.direct,n=(e.x-r.x)*i.x+(e.y-r.y)*i.y;return new Yt(r.x+i.x*n,r.y+i.y*n)}else return yr.eq(t.b,0)&&!yr.eq(t.a,0)?new Yt(t.start().x,e.y):!yr.eq(t.b,0)&&yr.eq(t.a,0)?new Yt(e.x,t.start().y):e}};function BC(o,t){if(yr.eq(o.sweepAngle,360))return!0;let e=Vo.regularD(t.angleD(o.center));return o.sweepAngle>0?(yr.less(e,o.startAngle)&&(e+=360),yr.greatereq(o.endAngle(),e)):(yr.greater(e,o.startAngle)&&(e-=360),yr.lesseq(o.endAngle(),e))}var ept=[1,10,100,1e3],xMe="http://www.w3.org/2000/svg",RMe="http://www.w3.org/1999/xlink",DMe="http://www.w3.org/XML/1998/namespace",wMe="https://easyeda.com/",pFt=(function(){var o={svg:xMe,xlink:RMe,xml:DMe,c:wMe};return o[xMe]="svg",o[RMe]="xlink",o[DMe]="xml",o[wMe]="c",o})(),Wp=(function(){var o={RATLINES:9,MODEL3D:19,ALL:11,TOPSILKLAYER:3,TOPLAYER:1,TOPPASTERLAYER:5,TOPSOLDERLAYER:7,LIBBODY:99,PADSURFACE:100,BOARDOUTLINE:10,DOCUMENT:12,TOPASSEMBLY:13,MECHANICAL:15,TOPCOMPONENT:16,SUBSTRATE:18},t;for(t=21;t<53;t++)o["INNER"+(t-20)]=t;for(o.BOTTOMSILKLAYER=4,o.BOTTOMLAYER=2,o.BOTTOMPASTERLAYER=6,o.BOTTOMSOLDERLAYER=8,o.BOTTOMASSEMBLY=14,o.BOTTOMCOMPONENT=17,t=53;t<85;t++)o["BOARD"+(t-52)]=t;return o})(),fFt=(function(){var o={COPPERAREA:[1,2,21,22,23,24],PLANEZONE:[1,2,21,22,23,24],RECT:[1,2,3,4,5,6,7,8,12,13,14,15,21,22,23,24,99],TRACK:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],PAD:[11,1,2],VIA:[11],HOLE:[11],TEXT:[3,4,1,2,7,8,12,13,14,15,21,22,23,24],ARC:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],ELLIPSE:[3,4,12,13,14,15],CIRCLE:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],DIMENSION:[3,4,12,13,14,15],FOOTPRINT:[1,2],SOLIDREGION:[1,2,3,4,5,6,7,8,12,13,14,15,21,22,23,24,11,99,100],SVGNODE:[1,2,3,4,7,8,12,13,14,15],PROTRACTOR:[3,4,12,13,14,15],SHEET:[12,13,14,15]};o["3D"]=(function(){for(var i=[16,19,3,7,5,1],n=21;n<52;n++)i.push(n+32,n);return i.push(2,6,8,4,17),i})();var t,e,r;for(t in o)if(o.hasOwnProperty(t)&&(r=o[t],r.indexOf(21)>0&&r.indexOf(25)===-1))for(e=25;e<=52;e++)r.push(e);return o})(),bm=(function(){var o={1:"TopLayer",2:"BottomLayer",3:"TopSilkLayer",4:"BottomSilkLayer",5:"TopPasteMaskLayer",6:"BottomPasteMaskLayer",7:"TopSolderMaskLayer",8:"BottomSolderMaskLayer",9:"Ratlines",10:"BoardOutLine",11:"Multi-Layer",12:"Document",13:"TopAssembly",14:"BottomAssembly",15:"Mechanical",16:"TopComponents",17:"BottomComponents",18:"Substrate",19:"3DModel",99:"ComponentShapeLayer",100:"LeadShapeLayer"},t;for(t=21;t<53;t++)o[t]="Inner"+(t-20);for(t=53;t<85;t++)o[t]="Substrate"+(t-52);return o})(),mFt=(function(){var o=[],t=[];for(var e in Wp)if(Wp.hasOwnProperty(e)){if(e.match(/^BOARD\d+/))continue;o.push(Wp[e])}o.sort(),t.sort();var r={},i,n={21:"#999966",22:"#008000",23:"#00FF00",24:"#BC8E00",25:"#70DBFA",26:"#00CC66",27:"#9966FF",28:"#800080",29:"#008080",30:"#15935F",31:"#000080",32:"#00B400",33:"#2E4756",34:"#99842F",35:"#FFFFAA",36:"#99842F",37:"#2E4756",38:"#3535FF",39:"#8000BC",40:"#43AE5F",41:"#C3ECCE",42:"#728978",43:"#39503F",44:"#0C715D",45:"#5A8A80",46:"#2B937E",47:"#23999D",48:"#45B4E3",49:"#215DA1",50:"#4564D7",51:"#6969E9",52:"#9069E9"};o.forEach(function(a){switch(a){case Wp.TOPLAYER:i={name:bm[a],color:"#FF0000",darkColor:"#CC0000",visible:!0,active:!0,config:!0};break;case Wp.BOTTOMLAYER:i={name:bm[a],color:"#0000FF",darkColor:"#000080",visible:!0,active:!1,config:!0};break;case Wp.TOPSILKLAYER:i={name:bm[a],color:"#FFCC00",darkColor:"#806600",visible:!0,active:!1,config:!0};break;case Wp.BOTTOMSILKLAYER:i={name:bm[a],color:"#66CC33",darkColor:"#33661A",visible:!0,active:!1,config:!0};break;case Wp.TOPPASTERLAYER:i={name:bm[a],color:"#808080",darkColor:"#666666",visible:!0,active:!1,config:!0};break;case Wp.BOTTOMPASTERLAYER:i={name:bm[a],color:"#800000",darkColor:"#660000",visible:!0,active:!1,config:!0};break;case Wp.TOPSOLDERLAYER:i={name:bm[a],color:"#800080",darkColor:"#660066",visible:!0,active:!1,transparency:.3,config:!0};break;case Wp.BOTTOMSOLDERLAYER:i={name:bm[a],color:"#AA00FF",darkColor:"#8800CC",visible:!0,active:!1,transparency:.3,config:!0};break;case Wp.RATLINES:i={name:bm[a],color:"#6464FF",darkColor:"#5050CC",visible:!1,active:!1,config:!0};break;case Wp.BOARDOUTLINE:i={name:bm[a],color:"#FF00FF",darkColor:"#CC00CC",visible:!0,active:!1,config:!0};break;case Wp.ALL:i={name:bm[a],color:"#C0C0C0",darkColor:"#999999",visible:!0,active:!1,config:!0};break;case Wp.DOCUMENT:i={name:bm[a],color:"#FFFFFF",darkColor:"#CCCCCC",visible:!0,active:!1,config:!0};break;case Wp.TOPASSEMBLY:i={name:bm[a],color:"#33CC99",darkColor:"#33AA99",visible:!1,active:!1,config:!1};break;case Wp.BOTTOMASSEMBLY:i={name:bm[a],color:"#5555FF",darkColor:"#8888FF",visible:!1,active:!1,config:!1};break;case Wp.MECHANICAL:i={name:bm[a],color:"#F022F0",darkColor:"#F088F0",visible:!1,active:!1,config:!1};break;case Wp.MODEL3D:i={name:bm[a],color:"#66CCFF",visible:!1,active:!1,config:!1};break;case Wp.LIBBODY:i={name:bm[a],color:"#00CCCC",visible:!1,active:!1,config:!1};break;case Wp.PADSURFACE:i={name:bm[a],color:"#CC9999",visible:!1,active:!1,config:!1};break;default:a>=Wp.INNER1&&a<=Wp.INNER32?i={name:bm[a],color:n[a],darkColor:s(n[a]),visible:!1,active:!1,config:!1}:i=null;break}i&&(r[a]=i)}),r.Hole={config:!0,name:"Hole",darkColor:"#222222",color:"#222222"},r.DRCError={config:!0,name:"DRCError",color:"#FAD609",darkColor:"#FAD609"};function s(a){if(typeof a!="string"||!a.match(/#?([\da-f]{6})/i))return a;var l=parseInt(RegExp.$1,16),c=.5,h=Math.min(255,Math.round((l>>16)*c)),u=Math.min(255,Math.round((l>>8&255)*c)),d=Math.min(255,Math.round((l&255)*c)),p=((h<<16)+(u<<8)+d).toString(16);return"#"+("00000"+p).substr(-6).toUpperCase()}return r})(),LMe={BLANK:0,SCH:1,PART:2,PCB:3,FOOTPRINT:4,PRJ:5,SUBPART:6,SPICESYMBOL:7,SUBCKT:8,NETLIST:9,WAVEFORM:10,SCHLIB3D:11,PHOTOVIEW:12,SCHMODULE:13,PCBMODULE:14,VIEW3D:15,PCBLIB3D:16,BLOCK_SYMBOL:17,NETFLAG:18,NETPORT:19,SHEET_SYMBOL:20,NONEELEC_SYMBOL:21,SHORT_SYMBOL:22,FOOTPRINTVIEW:23,CNCPRINTVIEW:24,PCB2D:31,PCB3D:32},gFt=(function(){var o={};for(let t in LMe)o[LMe[t]]=t;return o})(),KJ=Math.PI*2,FJ=Math.PI/2,yFt=Math.sin(Math.PI/180);function tpt(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=ept[t]||Math.pow(10,t)||10;if(e){var i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(i+o)}else return Math.round(o*r+1e-10)/r}function b4e(o,t,e){var r=o-t;return e||(e=1e-10),(r>0?r:-r)<e}function rpt(o,t,e){var r=h(o)&&h(t)&&h(e);if(!r)return console.warn("Bad arguments"),null;var i=t.x-e.x>0?t.x:e.x,n=t.y-e.y>0?t.y:e.y,s=t.x-e.x>0?e.x:t.x,a=t.y-e.y>0?e.y:t.y,l=o.x,c=o.y;return l<=i+.001&&l>=s-.001&&c<=n+.001&&c>=a-.001;function h(u){return u?(u.x=Number(u.x),u.y=Number(u.y),isNaN(u.x)||isNaN(u.y)?(console.warn("Can not convert to Number, NaN found"),!1):!0):(console.warn("Empty input!"),!1)}}function ipt(o,t,e,r,i,n){var s=(i-e)*(o-e)+(n-r)*(t-r),a=(i-e)*(i-e)+(n-r)*(n-r),l=s/a,c=e+(i-e)*l,h=r+(n-r)*l;return s<=0?Math.sqrt((o-e)*(o-e)+(t-r)*(t-r)):s>=a?Math.sqrt((o-i)*(o-i)+(t-n)*(t-n)):Math.sqrt((o-c)*(o-c)+(h-t)*(h-t))}function npt(o,t,e){return rpt(o,t,e)?b4e((o.x-t.x)*(e.y-t.y),(e.x-t.x)*(o.y-t.y),.001):!1}var JH=1e-4,it=new Float64Array(100);function WT(o,t){if(o instanceof Tt&&t instanceof Tt)return A9(o,t);if(o instanceof mr&&t instanceof Tt)return Q2e(o,t);if(o instanceof Tt&&t instanceof mr)return Q2e(t,o);if(o instanceof mr&&t instanceof mr)return T4e(o,t);if(o instanceof Yi&&t instanceof Yi)return RJ(o,t);if(o instanceof Yi&&t instanceof Tt)return RJ(o,new Yi([t.start(),t.end()]));if(o instanceof Tt&&t instanceof Yi)return RJ(new Yi([o.start(),o.end()]),t);if(o instanceof Yi&&t instanceof mr)return GMe(t,o);if(o instanceof mr&&t instanceof Yi)return GMe(o,t);throw new Error("not supported operation")}function opt(o,t){let e=o.bbox();if(e.isContainsY1(t)){let r=new Tt(new Yt(e.minX-1,t),new Yt(e.maxX+1,t));return A9(r,o)>0?1:0}else return 0}function spt(o,t){if(o.rx===o.ry){let e=o.bbox();if(e.isContainsY1(t)){let r=new Tt(new Yt(e.minX-1,t),new Yt(e.maxX+1,t));return VJ(o,r)>0?1:0}else return 0}else throw new Error("not supported operation")}function MMe(o,t){let e=o.bbox();return e.isContainsY1(t)&&RJ(new Yi([new Yt(e.minX-1,t),new Yt(e.maxX+1,t)]),o)>0?1:0}function NMe(o,t,e){return isFinite(t)&&isFinite(e)?o.isContains2(t,e):!1}function apt(o,t){let e=t.length(),r=Bd.crossProd3(t.start(),t.end(),o.start())/e,i=Bd.crossProd3(t.start(),t.end(),o.end())/e;return Math.abs(r)<1e-8||Math.abs(i)<1e-8||r*i<0}function A9(o,t){let e=o.bbox().intersection1(t.bbox());if(!e)return 0;if(o.isPoint())if(t.isPoint()){let r=e.center();return it[0]=r.x,it[1]=r.y,2}else return kMe(t,o,e);else{if(t.isPoint())return kMe(o,t,e);{let r=function(T,I){e.isContains2(T,I)&&(it[P++]=T,it[P++]=I)};if(!apt(o,t))return 0;let i=o.start().x,n=o.start().y,s=o.end().x,a=o.end().y,l=t.start().x,c=t.start().y,h=t.end().x,u=t.end().y,d=t.length(),p=Bd.crossProd2(i,n,l,c,h,u)/d,m=Bd.crossProd2(s,a,l,c,h,u)/d;if(p*m>0&&!yr.eq(p,0)&&!yr.eq(m,0))return 0;let g=o.length(),y=Bd.crossProd2(l,c,i,n,s,a)/g,b=Bd.crossProd2(h,u,i,n,s,a)/g;if(y*b>0&&!yr.eq(y,0)&&!yr.eq(b,0))return 0;let P=0;if(yr.eq(p,0)&&yr.eq(m,0)){let T=e.UL(),I=e.UR(),C=e.LL(),E=e.LR();if(yr.eq(e.width(),0))yr.eq(e.height(),0)?(it[P++]=T.x,it[P++]=T.y):(it[P++]=T.x,it[P++]=T.y,it[P++]=C.x,it[P++]=C.y);else if(yr.eq(e.height(),0))it[P++]=T.x,it[P++]=T.y,it[P++]=I.x,it[P++]=I.y;else{let O=J2e.area2(T.x,T.y,l,c,h,u),_=J2e.area2(I.x,I.y,l,c,h,u);O<_?(it[P++]=T.x,it[P++]=T.y,it[P++]=E.x,it[P++]=E.y):(it[P++]=I.x,it[P++]=I.y,it[P++]=C.x,it[P++]=C.y)}}else if(yr.eq(p,0))r(i,n);else if(yr.eq(m,0))r(s,a);else{let T=Math.abs(p/(p-m));r(i+(s-i)*T,n+(a-n)*T)}return P}}}function kMe(o,t,e){let r=t.start(),i=t.end(),n=Bd.crossProd3(o.start(),o.end(),t.start()),s=Bd.crossProd3(o.start(),o.end(),t.end());if(n*s<0){let a=e.center();return it[0]=a.x,it[1]=a.y,2}else if(Math.abs(n)<Math.abs(s)){if(yr.eq(n/o.length(),0))return it[0]=r.x,it[1]=r.y,2}else if(yr.eq(s/o.length(),0))return it[0]=i.x,it[1]=i.y,2;return 0}function VJ(o,t){let e=o.bbox().intersection1(t.bbox());if(e!=null){e=e.extendOfSize(JH);let r=o.center.x,i=o.center.y,n=o.rx,s=o.rx2,a=t.start().x,l=t.start().y,c=t.end().x,h=t.end().y,u=o.center.distance1(t.start()),d=o.center.distance1(t.end()),p=yr.eq(u,n)?0:u>n?1:-1,m=yr.eq(d,n)?0:d>n?1:-1,g=0;if(p===-1&&m===-1)return 0;if(p===0&&m===0)it[g++]=a,it[g++]=l,it[g++]=c,it[g++]=h;else if(p===1&&m===1){let y=GC.foot(t,o.center),b=y.distance1(o.center);if(yr.greater(b,n))return 0;if(yr.eq(b,n))yr.eq(t.distance2(o.start()),0)?(it[g++]=o.start().x,it[g++]=o.start().y,it[g++]=o.start().x,it[g++]=o.start().y):yr.eq(t.distance2(o.end()),0)?(it[g++]=o.end().x,it[g++]=o.end().y,it[g++]=o.end().x,it[g++]=o.end().y):(it[g++]=y.x,it[g++]=y.y,it[g++]=y.x,it[g++]=y.y);else{g=P4e(r,i,a,l,c,h,g,y);let P=it[g-2],T=it[g-1];g-=2;let I=Bd.distance1(r,i,P,T);if(yr.eq(I,n))it[g++]=P,it[g++]=T,it[g++]=P,it[g++]=T;else if(I<n)g=$m(s,r,i,a,l,P,T,g),g=$m(s,r,i,P,T,c,h,g);else return 0}}else if(p===-1||m===-1)g=$m(s,r,i,a,l,c,h,g);else{let y=GC.foot(t,o.center),b=y.distance1(o.center);if(yr.eq(b,n)){let P=function(C){return NMe(e,C.x,C.y)&&mp(o,C)},T=o.start(),I=o.end();if(p===0){let C=t.start();if(P(C))return it[g++]=C.x,it[g++]=C.y,it[g++]=C.x,it[g++]=C.y,g;if(P(y))return it[g++]=y.x,it[g++]=y.y,it[g++]=y.x,it[g++]=y.y,g;if(yr.eq(t.distance2(T),0)&&P(T))return it[g++]=T.x,it[g++]=T.y,it[g++]=T.x,it[g++]=T.y,g;if(yr.eq(t.distance2(I),0)&&P(I))return it[g++]=I.x,it[g++]=I.y,it[g++]=I.x,it[g++]=I.y,g;if(u<=n)g=$m(s,r,i,y.x,y.y,c,h,g),g===2&&(it[g++]=it[0],it[g++]=it[1]);else if(b<n){if(g=$m(s,r,i,y.x,y.y,c,h,g),g===2&&P(new Yt(it[0],it[1])))return it[g++]=it[0],it[g++]=it[1],g;g=$m(s,r,i,y.x,y.y,a,l,0),g===2&&(it[g++]=it[0],it[g++]=it[1])}}else{let C=t.end();if(P(C))return it[g++]=C.x,it[g++]=C.y,it[g++]=C.x,it[g++]=C.y,g;if(P(y))return it[g++]=y.x,it[g++]=y.y,it[g++]=y.x,it[g++]=y.y,g;if(yr.eq(t.distance2(T),0)&&P(T))return it[g++]=T.x,it[g++]=T.y,it[g++]=T.x,it[g++]=T.y,g;if(yr.eq(t.distance2(I),0)&&P(I))return it[g++]=I.x,it[g++]=I.y,it[g++]=I.x,it[g++]=I.y,g;if(d<=n)g=$m(s,r,i,y.x,y.y,a,l,g),g===2&&(it[g++]=it[0],it[g++]=it[1]);else if(b<n){if(g=$m(s,r,i,y.x,y.y,a,l,g),g===2&&P(new Yt(it[0],it[1])))return it[g++]=it[0],it[g++]=it[1],g;g=$m(s,r,i,y.x,y.y,c,h,0),g===2&&(it[g++]=it[0],it[g++]=it[1])}}}else if(p===0){let P=t.start();it[g++]=P.x,it[g++]=P.y,(a-y.x)*(c-y.x)+(l-y.y)*(h-y.y)<0&&(g=$m(s,r,i,y.x,y.y,c,h,g))}else{let P=t.end();it[g++]=P.x,it[g++]=P.y,(a-y.x)*(c-y.x)+(l-y.y)*(h-y.y)<0&&(g=$m(s,r,i,y.x,y.y,a,l,g))}}if(g>0){let y=0;for(let b=0;b<g;b+=2){let P=it[b],T=it[b+1];isFinite(P)&&isFinite(T)&&NMe(e,P,T)&&mp(o,new Yt(P,T))&&(it[y++]=P,it[y++]=T)}return y}else return 0}else return 0}function lpt(o,t){if(o.bbox()){let e=o.center.x,r=o.center.y,i=o.rx2,n=t.start().x,s=t.start().y,a=t.end().x,l=t.end().y,c=o.center.distance2(t.start()),h=o.center.distance2(t.end()),u=yr.eq(c,i)?0:c>i?1:-1,d=yr.eq(h,i)?0:h>i?1:-1,p=0;if(u===-1&&d===-1)return 0;if(u===0&&d===0)it[p++]=n,it[p++]=s,it[p++]=a,it[p++]=l;else if(u===1&&d===1){let m=GC.foot(t,o.center),g=m.distance2(o.center);if(yr.greater(g,i))return 0;if(yr.eq(g,i)){let y=m.distance2(o.start()),b=m.distance2(o.end());yr.eq(y,0)?(it[p++]=o.start().x,it[p++]=o.start().y):yr.eq(b,0)?(it[p++]=o.end().x,it[p++]=o.end().y):(it[p++]=m.x,it[p++]=m.y)}else{p=P4e(e,r,n,s,a,l,p,m);let y=it[p-2],b=it[p-1],P=Bd.distance2(e,r,y,b);if(p-=2,yr.eq(P,i))it[p++]=y,it[p++]=b;else if(P<i)p=$m(i,e,r,n,s,y,b,p),p=$m(i,e,r,y,b,a,l,p);else return 0}}else if(u===-1||d===-1)p=$m(i,e,r,n,s,a,l,p);else{let m=GC.foot(t,o.center);u===0?(it[p++]=t.start().x,it[p++]=t.start().y,yr.neq(m.distance2(t.start()),0)&&(n-m.x)*(a-m.x)+(s-m.y)*(l-m.y)<0&&(p=$m(i,e,r,m.x,m.y,a,l,p))):(it[p++]=t.end().x,it[p++]=t.end().y,yr.neq(m.distance2(t.end()),0)&&(n-m.x)*(a-m.x)+(s-m.y)*(l-m.y)<0&&(p=$m(i,e,r,m.x,m.y,n,s,p)))}if(p>0){let m=0;for(let g=0;g<p;g+=2){let y=it[g],b=it[g+1];isFinite(y)&&isFinite(b)&&(it[m++]=y,it[m++]=b)}return m}else return 0}else return 0}function $m(o,t,e,r,i,n,s,a){if(i==s){let T=o-(i-e)*(i-e);if(yr.greater(T,0)){let I=Math.sqrt(T),C=t-I,E=t+I,O=Math.min(r,n),_=Math.max(r,n);return C>=O&&C<=_&&(it[a++]=C,it[a++]=i),E>=O&&E<=_&&(it[a++]=E,it[a++]=i),a}}let l=Bd.distance2(r,i,t,e)-o;if(l===0)return it[a++]=r,it[a++]=i,a;let c=Bd.distance2(n,s,t,e)-o;if(c===0)return it[a++]=n,it[a++]=s,a;let h=r,u=i,d=n,p=s,m=NaN,g=NaN,y=Number.POSITIVE_INFINITY,b=0;for(;y!==0;){b++;let T=Math.max(Math.min(Math.abs(l)/(Math.abs(l)+Math.abs(c)),.75),.25);if(m=h+(d-h)*T,g=u+(p-u)*T,h===m&&u===g||d===m&&p===g){Math.abs(l)>Math.abs(c)?(m=d,g=p,y=c):(m=h,g=u,y=l);break}else y=Bd.distance2(m,g,t,e)-o,y<0&&l>c||y>0&&l<c?(d=m,p=g,c=y):(h=m,u=g,l=y)}let P=Math.sqrt(o)-Bd.distance1(m,g,t,e);return(yr.eq(0,y)||yr.eq(0,P))&&(it[a++]=m,it[a++]=g),a}function P4e(o,t,e,r,i,n,s,a){let l=Bd.dotProd2(e,r,i,n,o,t),c=Bd.dotProd2(i,n,e,r,o,t);if(l>=0)return it[s++]=i,it[s++]=n,s;if(c>=0)return it[s++]=e,it[s++]=r,s;if(Bd.crossProd2(e,r,i,n,o,t)==0)return it[s++]=o,it[s++]=t,s;{let h=NaN,u=NaN,d=e,p=r,m=i,g=n,y=Bd.distance2(e,r,o,t),b=Bd.distance2(i,n,o,t),P=Number.POSITIVE_INFINITY,T=0;for(;P>0&&(T++,h=d+(m-d)*.5,u=p+(g-p)*.5,!(y==b||d==h&&p==u||m==h&&g==u));){P=Bd.distance2(h,u,o,t);let I=Bd.dotProd2(d,p,h,u,o,t);if(I==0)break;I<0?(m=h,g=u,b=P):(d=h,p=u,y=P)}return Bd.distance2(h,u,o,t)<Bd.distance2(a.x,a.y,o,t)?(it[s++]=h,it[s++]=u):(it[s++]=a.x,it[s++]=a.y),s}}function Q2e(o,t){if(o.rx===o.ry)return VJ(o,t);throw new Error("not supported")}function cpt(o,t){if(o.rx===o.ry)return lpt(o,t);throw new Error("not supported")}function T4e(o,t){if(o.bbox().intersection1(t.bbox())!=null){if(o.rx===o.ry&&t.rx===t.ry)return hpt(o,t);throw new Error("not supported operation")}return 0}function hpt(o,t){let e=o.center.x,r=o.center.y,i=t.center.x,n=t.center.y,s=o.rx,a=t.rx,l=o.rx2,c=t.rx2,h=o.center.distance1(t.center),u=Math.abs(s-a),d=s+a;if(yr.greater(h,d)||yr.less(h,u))return 0;if(yr.eq(u+h,0)){let p=0,m;return mp(o,t.start())&&(it[p]=t.start().x,it[p+1]=t.start().y,p+=2,m=t.start()),mp(o,t.end())&&(it[p]=t.end().x,it[p+1]=t.end().y,p+=2,m=t.end()),p===0?(mp(t,o.start())&&(it[p]=o.start().x,it[p+1]=o.start().y,p+=2),mp(t,o.end())&&(it[p]=o.end().x,it[p+1]=o.end().y,p+=2)):p===2&&(!m.equals1(o.start())&&mp(t,o.start())&&(it[p]=o.start().x,it[p+1]=o.start().y,p+=2),!m.equals1(o.end())&&mp(t,o.end())&&(it[p]=o.end().x,it[p+1]=o.end().y,p+=2)),p}else if(yr.eq(h,d)){if(BMe(o,t))return 4;let p=new Tt(o.center,t.center),m=VJ(t,p);return m=FMe(o,m),m!==0?m:(m=VJ(o,p),FMe(t,m))}else if(yr.eq(h,u)){if(BMe(o,t))return 4;if(s>a){let p=(s-a)/s;return it[0]=e+(i-e)/p,it[1]=r+(n-r)/p,VMe(o,t,2)}else{let p=(a-s)/a;return it[0]=i+(e-i)/p,it[1]=n+(r-n)/p,VMe(o,t,2)}}else{let p=(o.center.distance2(t.center)-c+l)/(h*2)/h,m=(i-e)*p+e,g=(n-r)*p+r,y=i-e,b=n-r,P=Math.max(s,a),T,I,C,E;if(Math.abs(y)<Math.abs(b)){let v=y/-b,D=g-v*m;T=m-P,I=v*T+D,C=m+P,E=v*C+D}else{let v=b/-y,D=m-v*g;I=g-P,T=v*I+D,E=g+P,C=v*E+D}let O=$m(l,e,r,T,I,m,g,0);if(O=$m(l,e,r,m,g,C,E,O),O!==4)throw new Error("cnt !== 4");let _=new Yt(it[0],it[1]),x=new Yt(it[2],it[3]);if(mp(o,_)&&mp(t,_))return mp(o,x)&&mp(t,x)?4:q_(o.start(),t,x,_)?(it[2]=o.start().x,it[3]=o.start().y,4):q_(o.end(),t,x,_)?(it[2]=o.end().x,it[3]=o.end().y,4):q_(t.start(),o,x,_)?(it[2]=t.start().x,it[3]=t.start().y,4):q_(t.end(),o,x,_)?(it[2]=t.end().x,it[3]=t.end().y,4):2;if(mp(o,x)&&mp(t,x))return q_(o.start(),t,_,x)?(it[0]=o.start().x,it[1]=o.start().y,4):q_(o.end(),t,_,x)?(it[0]=o.end().x,it[1]=o.end().y,4):q_(t.start(),o,_,x)?(it[0]=t.start().x,it[1]=t.start().y,4):q_(t.end(),o,_,x)?(it[0]=t.end().x,it[1]=t.end().y,4):(it[0]=it[2],it[1]=it[3],2);{let v=function(H,z){if(yr.eq(H.distance1(z.center),z.rx)&&mp(z,H)){if(H.distance2(_)<H.distance2(x)){if(D)return;D=!0}else{if(w)return;w=!0}it[F++]=H.x,it[F++]=H.y}},D=!1,w=!1,F=0;return v(o.start(),t),v(o.end(),t),v(t.start(),o),v(t.end(),o),F}}}function q_(o,t,e,r){return yr.eq(o.distance1(t.center),t.rx)&&mp(t,o)&&o.distance2(e)<o.distance2(r)}function BMe(o,t){return yr.eq(t.start().distance1(o.center),o.rx)&&mp(o,t.start())?(it[0]=t.start().x,it[1]=t.start().y,it[2]=t.start().x,it[3]=t.start().y,!0):yr.eq(t.end().distance1(o.center),o.rx)&&mp(o,t.end())?(it[0]=t.end().x,it[1]=t.end().y,it[2]=t.end().x,it[3]=t.end().y,!0):yr.eq(o.start().distance1(t.center),t.rx)&&mp(t,o.start())?(it[0]=o.start().x,it[1]=o.start().y,it[2]=o.start().x,it[3]=o.start().y,!0):yr.eq(o.end().distance1(t.center),t.rx)&&mp(t,o.end())?(it[0]=o.end().x,it[1]=o.end().y,it[2]=o.end().x,it[3]=o.end().y,!0):!1}function FMe(o,t){if(t===0)return 0;let e=it[0],r=it[1];return mp(o,new Yt(e,r))?(it[0]=e,it[1]=r,it[2]=e,it[3]=r,4):0}function VMe(o,t,e){if(e===0)return 0;let r=it[0],i=it[1],n=new Yt(r,i);return mp(o,n)&&mp(t,n)?(it[0]=r,it[1]=i,it[2]=r,it[3]=i,4):0}function iN(o,t){return Math.abs(o-t)<=1e-6}function mp(o,t){let e=o.bbox();if(t.x-e.minX>-JH&&t.x-e.maxX<JH&&t.y-e.minY>-JH&&t.y-e.maxY<JH){let r=Vo.regularD(t.angleD(o.center));return iN(r,o.startAngle)||iN(r,o.startAngle+360)||iN(r,o.startAngle-360)||iN(r,o.endAngle())||iN(r,o.endAngle()+360)||iN(r,o.endAngle()-360)?!0:o.sweepAngle>0?(yr.less(r,o.startAngle)&&(r+=360),yr.greatereq(o.endAngle(),r)):(yr.greater(r,o.startAngle)&&(r-=360),yr.lesseq(o.endAngle(),r))}else return!1}function upt(o,t){let e=o[1].x-o[0].x,r=o[1].y-o[0].y,i=t[1].x-t[0].x,n=t[1].y-t[0].y;if(e===0&&i!==0||e!==0&&i===0)return!1;if(e===0&&i===0)return!0;let s=r/e,a=n/i;return b4e(s,a,Math.sin(Math.PI/180))}function dpt(o,t,e){var r,i=+t.x,n=+t.y,s=+e.x,a=+e.y,l=+o.x,c=+o.y,h=s-i,u=a-n,d=l-i,p=c-n,m,g,y,b,P,T;return h===0&&u===0?{d:Math.sqrt(d*d+p*p),point:new Yt(i,n)}:(r=(d*h+p*u)/(h*h+u*u),r<0?{d:Math.sqrt(d*d+p*p),point:new Yt(i,n)}:r>1?(m=l-s,g=c-a,{d:Math.sqrt(m*m+g*g),point:new Yt(s,a)}):(P=i+r*h,T=n+r*u,y=l-P,b=c-T,{d:Math.sqrt(y*y+b*b),point:new Yt(P,T)}))}function VC(o,t){if(!o||!t||o.length!=t.length)return!1;let e="equals1";return!o.some((r,i)=>{let n=t[i],s=!1;return r&&n&&typeof r=="object"&&typeof n=="object"?typeof r[e]=="function"&&fpt(r,n)?s=!r[e].call(r,n):s=!(r===n||r.toString()===n.toString()):typeof r=="number"&&typeof n=="number"?s=!(ppt(r,n)||Number.isNaN(r)&&Number.isNaN(n)):s=r!==n,s})}function ppt(o,t,e=5){return Math.abs(o-t)*Math.pow(10,e)<1}function fpt(o,t){return!o||!t||typeof o!="object"||typeof t!="object"?o===t:o.constructor===t.constructor}var Gs=new Float64Array(100);function RJ(o,t){if(o.bbox().extendOfSize(yr.eps).isSeparated(t.bbox()))return 0;let e=[[o,t]],r=(o.controls.length-1)*(t.controls.length-1)*8,i=0,n=Number.POSITIVE_INFINITY;for(;e.length!==0;){let s=function(V){D=Math.min(D,V),w=Math.max(w,V)},a=function(V,W){let L=A9(V,W);if(L===0)throw new Error("cnt === 0");for(let k=0;k<L;k+=2)s(it[k])};if(i>r){for(let V=i-2;V>=2;V-=2)for(let W=V-2;W>=0;W-=2)if(yr.eq(Gs[V],Gs[W])&&yr.eq(Gs[V+1],Gs[W+1])){Gs[W]=(Gs[V]+Gs[W])/2,Gs[W+1]=(Gs[V+1]+Gs[W+1])/2;for(let L=i-3;L>=V;L--)Gs[L]=Gs[L+2];i-=2;break}if(i>r){i=0;let V=t.start(),W=new Float64Array(8);o.getPercent(V)!==null&&(W[i++]=V.x,W[i++]=V.y);let L=t.end();o.getPercent(L)!==null&&(W[i++]=L.x,W[i++]=L.y);let k=o.start();t.getPercent(k)!==null&&(W[i++]=k.x,W[i++]=k.y);let N=o.end();return t.getPercent(N)!==null&&(W[i++]=N.x,W[i++]=N.y),it.set(W),i}}let[l,c]=e.pop(),h=l.controls,u=c.controls;if(h.length===2&&u.length===2){let V=A9(new Tt(h[0],h[1]),new Tt(u[0],u[1]));for(let W=0;W<V;W++)Gs[i++]=it[W];continue}let d=h[0],p=h[h.length-1];d.equals1(p)&&(p=d.add1(1,0));let m=p.y-d.y,g=d.x-p.x,y=-m*d.x-g*d.y,b=Math.sqrt(1/(m**2+g**2));m*=b,g*=b,y*=b;let P=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY;if(h.forEach(V=>{let W=m*V.x+g*V.y+y;W<P&&(P=W),W>T&&(T=W)}),yr.eq(P,T)){if(c.controls.length===2){let V=A9(new Tt(l.start(),l.end()),new Tt(c.start(),c.end()));for(let W=0;W<V;W++)Gs[i++]=it[W];if(V!==0)continue}l=new Yi([h[0],h[h.length-1]]),h=l.controls}let I=u.map(V=>{let W=m*V.x+g*V.y+y,L=Math.abs(W);return L<n&&(n=L),W}),C=0;for(let V of I){if(yr.less(V,P))C=C|1;else if(yr.greater(V,T))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let E=0,O=0,_=p.x-d.x,x=p.y-d.y,v=Math.sqrt(1/(_**2+x**2));_*=v,x*=v;for(let V=1;V<h.length;V++){let W=h[V],L=(W.x-d.x)*_+(W.y-d.y)*x;L<E?E=L:L>O&&(O=L)}C=0;for(let V of u){let W=(V.x-d.x)*_+(V.y-d.y)*x;if(yr.less(W,E))C=C|1;else if(yr.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let D=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY;n/=2,n<=yr.eps&&(n=yr.eps),P-=n,T+=n,I.forEach((V,W)=>{V>=P&&V<=T&&s(W/(I.length-1))});let F=new Tt(new Yt(0,P),new Yt(1,P)),H=new Tt(new Yt(0,T),new Yt(1,T));for(let V=0;V<I.length-1;V++){let W=new Yt(V/(I.length-1),I[V]),L=W.y<P?1:W.y>T?2:3;for(let k=0;k<I.length;k++){let N=new Yt(k/(I.length-1),I[k]),U=N.y<P?1:N.y>T?2:3;L!==U&&(L===1?U===2?(a(new Tt(W,N),F),a(new Tt(W,N),H)):a(new Tt(W,N),F):L===2?U===1?(a(new Tt(W,N),F),a(new Tt(W,N),H)):a(new Tt(W,N),H):U===1?a(new Tt(W,N),F):a(new Tt(W,N),H))}}D!==0&&(c=c.clip(D)[1]),w!==1&&(c=c.clip((w-D)/(1-D))[0]);let z=c.bbox();if(yr.eq(z.minX,z.maxX)&&yr.eq(z.minY,z.maxY)){C=0;for(let V of c.controls){let W=(V.x-d.x)*_+(V.y-d.y)*x;if(yr.less(W,E))C=C|1;else if(yr.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C===3){let V=new Yt((z.minX+z.maxX)/2,(z.minY+z.maxY)/2);l.getPercent(V)&&(Gs[i++]=V.x,Gs[i++]=V.y)}continue}if(w-D>.8){let[V,W]=c.clip(.5);e.push([V,l]),e.push([W,l])}else e.push([c,l])}for(let s=0;s<i;s++)it[s]=Gs[s];return i}function mpt(o,t){if(o.bbox().extendOfSize(yr.eps).isSeparated(t.bbox()))return{cnt:0};let e=[[o,t]],r=(o.controls.length-1)*(t.controls.length-1)*8,i=0,n=Number.POSITIVE_INFINITY;for(;e.length!==0;){let s=function(V){D=Math.min(D,V),w=Math.max(w,V)},a=function(V,W){let L=A9(V,W);if(L===0)throw new Error("cnt === 0");for(let k=0;k<L;k+=2)s(it[k])};if(i>r){for(let V=i-2;V>=2;V-=2)for(let W=V-2;W>=0;W-=2)if(yr.eq(Gs[V],Gs[W])&&yr.eq(Gs[V+1],Gs[W+1])){Gs[W]=(Gs[V]+Gs[W])/2,Gs[W+1]=(Gs[V+1]+Gs[W+1])/2;for(let L=i-3;L>=V;L--)Gs[L]=Gs[L+2];i-=2;break}if(i>r){i=0;let V=new Float64Array(8),W=t.end(),L=0;o.getPercent(W)!==null&&(V[i++]=W.x,V[i++]=W.y,L=2);let k=o.end();return t.getPercent(k)!==null&&(V[i++]=k.x,V[i++]=k.y,L=L===0?1:3),it.set(V),{havOverlap:L,cnt:i}}}let[l,c]=e.pop(),h=l.controls,u=c.controls;if(h.length===2&&u.length===2){let V=A9(new Tt(h[0],h[1]),new Tt(u[0],u[1]));for(let W=0;W<V;W++)Gs[i++]=it[W];continue}let d=h[0],p=h[h.length-1];d.equals1(p)&&(p=d.add1(1,0));let m=p.y-d.y,g=d.x-p.x,y=-m*d.x-g*d.y,b=Math.sqrt(1/(m**2+g**2));m*=b,g*=b,y*=b;let P=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY;if(h.forEach(V=>{let W=m*V.x+g*V.y+y;W<P&&(P=W),W>T&&(T=W)}),yr.eq(P,T)){if(c.controls.length===2){let V=A9(new Tt(l.start(),l.end()),new Tt(c.start(),c.end()));for(let W=0;W<V;W++)Gs[i++]=it[W];if(V!==0)continue}l=new Yi([h[0],h[h.length-1]]),h=l.controls}let I=u.map(V=>{let W=m*V.x+g*V.y+y,L=Math.abs(W);return L<n&&(n=L),W}),C=0;for(let V of I){if(yr.less(V,P))C=C|1;else if(yr.greater(V,T))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let E=0,O=0,_=p.x-d.x,x=p.y-d.y,v=Math.sqrt(1/(_**2+x**2));_*=v,x*=v;for(let V=1;V<h.length;V++){let W=h[V],L=(W.x-d.x)*_+(W.y-d.y)*x;L<E?E=L:L>O&&(O=L)}C=0;for(let V of u){let W=(V.x-d.x)*_+(V.y-d.y)*x;if(yr.less(W,E))C=C|1;else if(yr.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let D=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY;n/=2,n<=yr.eps&&(n=yr.eps),P-=n,T+=n,I.forEach((V,W)=>{V>=P&&V<=T&&s(W/(I.length-1))});let F=new Tt(new Yt(0,P),new Yt(1,P)),H=new Tt(new Yt(0,T),new Yt(1,T));for(let V=0;V<I.length-1;V++){let W=new Yt(V/(I.length-1),I[V]),L=W.y<P?1:W.y>T?2:3;for(let k=0;k<I.length;k++){let N=new Yt(k/(I.length-1),I[k]),U=N.y<P?1:N.y>T?2:3;L!==U&&(L===1?U===2?(a(new Tt(W,N),F),a(new Tt(W,N),H)):a(new Tt(W,N),F):L===2?U===1?(a(new Tt(W,N),F),a(new Tt(W,N),H)):a(new Tt(W,N),H):U===1?a(new Tt(W,N),F):a(new Tt(W,N),H))}}D!==0&&(c=c.clip(D)[1]),w!==1&&(c=c.clip((w-D)/(1-D))[0]);let z=c.bbox();if(yr.eq(z.minX,z.maxX)&&yr.eq(z.minY,z.maxY)){C=0;for(let V of c.controls){let W=(V.x-d.x)*_+(V.y-d.y)*x;if(yr.less(W,E))C=C|1;else if(yr.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C===3){let V=new Yt((z.minX+z.maxX)/2,(z.minY+z.maxY)/2);l.getPercent(V)&&(Gs[i++]=V.x,Gs[i++]=V.y)}continue}if(w-D>.8){let[V,W]=c.clip(.5);e.push([V,l]),e.push([W,l])}else e.push([c,l])}for(let s=0;s<i;s++)it[s]=Gs[s];return{cnt:i}}var gpt=class{constructor(o=yr.eps){this.eps=o}eq(o,t){return Math.abs(o-t)<=this.eps}setEps(o){this.eps=o}},XH=new gpt;function GMe(o,t){if(o.bbox().extendOfSize(yr.eps).isSeparated(t.bbox()))return 0;let e=[[o,t]],r=(t.controls.length-1)*16,i=0;for(;e.length!==0;){if(i>r){let s=function(){for(let c=0;c<i;c+=2)for(let h=c+2;h<i;h+=2)if(!(XH.eq(Gs[c],Gs[h])&&XH.eq(Gs[c+1],Gs[h+1]))){l(Gs[h],Gs[h+1],a);break}function l(c,h,u){let d=!1;for(let p=0;p<u.length;p+=2)if(XH.eq(c,u[p])&&XH.eq(h,u[p+1])){d=!0;break}d||u.push(c,h)}},a=[Gs[0],Gs[1]];if(s(),a.length>=100&&(XH.setEps(.001),a=[Gs[0],Gs[1]],s(),a.length>=100))throw new Error("clearSamePoint()");i=a.length,a.forEach((l,c)=>Gs[c]=l)}let n=e.pop();if(n[0]instanceof mr){let s=function(H){x=Math.min(x,H),v=Math.max(v,H)},a=function(H,z){let V=A9(H,z);if(V===0)throw new Error("cnt === 0");for(let W=0;W<V;W+=2)s(it[W])},[l,c]=n,h=c.controls;if(h.length===2){let H=Q2e(l,new Tt(h[0],h[1]));for(let z=0;z<H;z++)Gs[i++]=it[z];continue}let u=Number.POSITIVE_INFINITY,d=Number.NEGATIVE_INFINITY,p,m,g,y,b;if(Math.abs(l.sweepAngle)>359){let H=l.rx;p=l.center.add1(H,0),m=l.center.add1(-H,0),u=-H,d=H,g=0,y=1,b=-l.center.y}else{p=l.start(),m=l.end(),g=m.y-p.y,y=p.x-m.x,b=-g*p.x-y*p.y;let H=Math.sqrt(1/(g**2+y**2));g*=H,y*=H,b*=H;let z=g*l.center.x+y*l.center.y+b;l.isCCW?(d=l.rx+z,u=0):(u=z-l.rx,d=0)}let P=h.map(H=>g*H.x+y*H.y+b),T=0;for(let H of P){if(yr.less(H,u))T=T|1;else if(yr.greater(H,d))T=T|2;else{T=3;break}if(T===3)break}if(T!==3)continue;let I=0,C=0,E=m.x-p.x,O=m.y-p.y,_=Math.sqrt(1/(E**2+O**2));if(E*=_,O*=_,Math.abs(l.sweepAngle)<=180)I=0,C=(m.x-p.x)*E+(m.y-p.y)*O;else throw new Error("not support");T=0;for(let H of h){let z=(H.x-p.x)*E+(H.y-p.y)*O;if(yr.less(z,I))T=T|1;else if(yr.greater(z,C))T=T|2;else{T=3;break}if(T===3)break}if(T!==3)continue;let x=Number.POSITIVE_INFINITY,v=Number.NEGATIVE_INFINITY;u-=yr.eps,d+=yr.eps,P.forEach((H,z)=>{H>=u&&H<=d&&s(z/(P.length-1))});let D=new Tt(new Yt(0,u),new Yt(1,u)),w=new Tt(new Yt(0,d),new Yt(1,d));for(let H=0;H<P.length-1;H++){let z=new Yt(H/(P.length-1),P[H]),V=z.y<u?1:z.y>d?2:3;for(let W=0;W<P.length;W++){let L=new Yt(W/(P.length-1),P[W]),k=L.y<u?1:L.y>d?2:3;V!==k&&(V===1?k===2?(a(new Tt(z,L),D),a(new Tt(z,L),w)):a(new Tt(z,L),D):V===2?k===1?(a(new Tt(z,L),D),a(new Tt(z,L),w)):a(new Tt(z,L),w):k===1?a(new Tt(z,L),D):a(new Tt(z,L),w))}}x!==0&&(c=c.clip(x)[1]),v!==1&&(c=c.clip((v-x)/(1-x))[0]);let F=c.bbox();if(yr.eq(F.minX,F.maxX)&&yr.eq(F.minY,F.maxY)){T=0;for(let H of c.controls){let z=(H.x-p.x)*E+(H.y-p.y)*O;if(yr.less(z,I))T=T|1;else if(yr.greater(z,C))T=T|2;else{T=3;break}if(T===3)break}T===3&&(Gs[i++]=(F.minX+F.maxX)/2,Gs[i++]=(F.minY+F.maxY)/2);continue}v-x>.8?c.clip(.5).forEach(H=>e.push([H,l])):e.push([c,l])}else{let[s,a]=n;e.push([mr.build3(a.center,a.startAngle,a.sweepAngle/2,a.rx,a.ry),s]),e.push([mr.build3(a.center,a.startAngle+a.sweepAngle/2,a.sweepAngle/2,a.rx,a.ry),s])}}for(let n=0;n<i;n++)it[n]=Gs[n];return i}var ypt=class{static getSweep(o){if(o.length>2){let t=0,e=o.length;for(let n=0;n<e-1;n++){let s=o[n],a=o[n+1];t+=(a.x+s.x)*(a.y-s.y)}let r=o[0],i=o[e-1];return t+=(r.x+i.x)*(r.y-i.y),t>0}else throw new Error("Unable to determine the direction of rotation!")}static isClose(o){return!!(o.primitives.length>0&&o.primitives[0].start().equals1(o.primitives[o.primitives.length-1].end()))}};function bpt(o){let t=o.primitives,e=t[0],r=e instanceof mr?e.sweepAngle%360:null;if(t.length===1&&e instanceof mr&&(yr.eq(r,0)||yr.eq(Math.abs(r),360)))return!!e.isCCW;let i=new Array;return o.points(.1,n=>{i.push(n)}),ypt.getSweep(i)}var Ppt=class{static zoomCorner(o,t){let e=new Array,r=new Array,i=new Array;return this.getPanPrimitive(o,e,i,t),this.rearrange(e,i),this.processStart(e,i),this.getResult(e,i,r,t),r.length>0?sa.build2(r):null}static zoomPolygon(o,t){let e=new Array,r=new Array,i=new Array;return bpt(o)&&(o=o.reverse().asClose()),this.getPanPrimitive(o,e,i,t),this.rearrange(e,i),this.processStart(e,i),this.getResult(e,i,r,t),r.length>0?sa.build2(r):null}static zoomLines(o,t){return this.zoomPolygon(sa.build2(o.primitives.concat(o.reverse().primitives)),t/2)}static getPanPrimitive(o,t,e,r){let i=o.primitives;for(let n of i){let s=this.panDistance(n,r);s!==void 0&&(t.push(s),e.push(n))}}static rearrange(o,t){let e=o.length,r=0;for(let s=0;s<e;s++){let a=t[s],l=o[s],c=s==e-1?o[0]:o[s+1];if(!(l instanceof mr&&c instanceof mr)&&!this.isCW(l.end(),c.start(),a.end())){if(WT(l,c)!=0){r=s==e-1?0:s+1;break}}else{r=s;break}}let i=this.start4Index(t,r),n=this.start4Index(o,r);t.length=0,o.length=0,i.forEach(s=>{t.push(s)}),n.forEach(s=>{o.push(s)})}static processStart(o,t){let e=o.length;if(e>2){let r=o[e-1],i=o[0],n=t[e-1];if(!(r instanceof mr&&i instanceof mr)&&!this.isCW(r.end(),i.start(),n.end())){let s=WT(r,i);for(let a=0;a<s;a+=2){let l=new Yt(it[a],it[a+1]);o[e-1]=this.generatePrimitive(r,r.start(),l),o[0]=this.generatePrimitive(i,l,i.end())}}}}static getResult(o,t,e,r){let i=o.length;for(let n=0;n<i;n++){let s=t[n],a=n===i-1?t[0]:t[n+1],l=n==i-1?0:n+1,c=l==i-1?t[0]:t[l+1],h=o[n],u=n==i-1?o[0]:o[n+1],d=l==i-1?o[0]:o[l+1];if(!(h instanceof mr&&u instanceof mr)&&!this.isCW(h.end(),u.start(),s.end())){let m=this.add(o,e,n,h,u,0);m=this.update(o,e,n,u,m);let g=this.generateArc(a,c,u,d,r);if(m=this.add(o,e,n,h,g,m),m=this.update(o,e,n,g,m),m>0)continue}e.push(h);let p=this.generateArc(s,a,h,u,r);p!==void 0&&e.push(p)}}static generateArc(o,t,e,r,i){if(i>0){let n=o.end(),s=t.start(),a=e.end(),l=r.start();if(a.distance2(l)>1e-8)if(n.equals(s)){let c=a.angleD(n),h=l.angleD(n);return mr.build2(n,c,h,i,i,0)}else{let c=a.angleD(n),h=l.angleD(n),u=a.angleD(s),d=l.angleD(s),p=mr.build2(n,c,h,i,i,0),m=mr.build2(s,u,d,i,i,0);return p.pointOn(p.endAngle()).equals1(l)?p:m.pointOn(m.endAngle()).equals1(l)?m:p}}}static updateNews(o,t,e,r){let i=o.length,n=t==i-1?0:t+1;o[n]=this.generatePrimitive(e,r,e.end())}static add(o,t,e,r,i,n){if(n>0)return n;if(r!=null&&i!=null){let s=WT(r,i);for(let a=0;a<s;a+=2){let l=new Yt(it[a],it[a+1]);t.push(this.generatePrimitive(r,r.start(),l)),this.updateNews(o,e,i,l);break}return s}else return 0}static update(o,t,e,r,i){if(i>0)return i;let n=t.length;if(n>0&&r!=null){let s=t[n-1],a=WT(s,r);for(let l=0;l<a;l+=2){let c=new Yt(it[l],it[l+1]);t[n-1]=this.generatePrimitive(s,s.start(),c),this.updateNews(o,e,r,c)}return a}else return 0}static generatePrimitive(o,t,e){if(o instanceof Tt)return new Tt(t,e);if(o instanceof mr){let r=o,i=t.angleD(r.center),n=e.angleD(r.center);return mr.build2(r.center,i,n,r.rx,r.ry,r.sweep())}else throw new Error("not supported operation")}static start4Index(o,t){let e=o.length,r=new Array;for(let i=t;i<e;i++)r.push(o[i]);for(let i=0;i<t;i++)r.push(o[i]);return r}static isCW(o,t,e){let r=new Tt(e,o),i=new Tt(e,t),n=r.end().x-r.start().x,s=r.end().y-r.start().y,a=i.end().x-i.start().x,l=i.end().y-i.start().y;return!(n*l-s*a>0)}static panDistance(o,t){if(o instanceof Tt){if(o.isPoint())return;{let e=o.panDistance(t);return e.length()>1e-5?e:void 0}}else if(o instanceof mr){let e=o;if(e.sweepAngle>0){if(e.rx-t<=0||e.ry-t<=0)return}else if(e.sweepAngle<0&&(e.rx+t<=0||e.ry+t<=0))return;return e=e.panDistance(t),e.start().distance1(e.end())>1e-5||yr.eq(Math.abs(e.sweepAngle),360)?e:void 0}else throw new Error("not supported operation")}},Qn=.001,jg=Qn**2;function _n(o,t){return o.distance2(t)<jg}function _9(o,t){return Math.abs(o-t)<=1e-4}function Tpt(o,t){if(o instanceof Tt)return new Tt(o.start(),t);if(o instanceof mr){let e=t.angleD(o.center);return _9(Vo.regularD(o.startAngle),Vo.regularD(e))?mr.build3(o.center,o.startAngle,0,o.rx,o.ry):mr.build2(o.center,o.startAngle,e,o.rx,o.ry,o.isCCW?1:0)}else{if(o instanceof Yi)return o.clip(o.getPercent(t,Qn))[0];throw new Error("not supported operation")}}function UC(o,t=Vo.toRadians(o.startAngle)){return o.isCCW?t+=FJ:t-=FJ,new Yt(Math.cos(t),Math.sin(t))}function lW(o,t=0){let e=o.controls;if(t===0){let r=e[0],i=e.slice(1).find(n=>!(n.x===r.x&&n.y===r.y));if(!i)throw Error("getTangentBezier(bezier: Bezier, t: number = 0)");return i.sub(r)}else if(t===1){let r=e[e.length-1],i=e.slice(0,-1).reverse().find(n=>!(n.x===r.x&&n.y===r.y));if(!i)throw Error("getTangentBezier(bezier: Bezier, t: number = 0)");return r.sub(i)}if(e.length===3){let[r,i,n]=e;return i.sub(r).mul(2*(1-t)).add(n.sub(i).mul(2*t)).normalize()}else{let[r,i,n,s]=e;return i.sub(r).mul(3*(1-t)**2).add(n.sub(i).mul(6*(1-t)*t)).add(s.sub(n).mul(3*t**2)).normalize()}}function gN(o,t,e){let r=o.slice(1).findIndex(n=>!(n.x===t.x&&n.y===t.y)),i=o[r+1];if(e&&(e.getPercent(i,Qn)!==null||new Tt(e.start(),e.end()).distance(i)<=Qn)&&(i=o[r+2]),!i)throw Error("getSecondPoint(controls: readonly Vector2[])");return i}function Jn(o,t){if(o instanceof Tt)return o.end().sub(o.start()).normalize();if(o instanceof mr)return(t?UC(o,t.angle(o.center)):UC(o)).normalize();if(o instanceof Yi)if(o.controls.length===2){let[e,r]=o.controls;if(_n(e,r))throw Error("equalsPP(p0, p1)");return r.sub(e).normalize()}else return(t?lW(o,o.getPercent(t,Qn)):lW(o)).normalize();else throw new Error("not support")}function Ipt(o,t,e){let r=[],i=t**2-4*o*e;if(i>=0){let n=-t/(2*o),s=Math.sqrt(i)/(2*o),a=n+s;if(r.push(a),i>0){let l=n-s;r.push(l)}}return r}function Cpt(o,t,e,r,i=0,n=1){let s=[],a=o*Math.pow(i,3)+t*Math.pow(i,2)+e*i+r,l=o*Math.pow(n,3)+t*Math.pow(n,2)+e*n+r,c,h;if(a*l<0)for(;Math.abs(i-n)>Qn;)if(c=(i+n)/2,h=o*Math.pow(c,3)+t*Math.pow(c,2)+e*c+r,Math.abs(h)<Qn){s.push(c);break}else a*h<0?n=c:l*h<0&&(i=c);else a*l===0&&(a===0&&s.push(i),l===0&&s.push(n));return s}function w2e(o,t,e){if(o instanceof Tt||t.distance2(e)<=jg)return new Tt(t,e);if(o instanceof mr)return mr.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.isCCW?1:0);if(o instanceof Yi){let r=o.getPercent(t,Qn),i=o.getPercent(e,Qn);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}function ebe(o){return yr.greater(o,0)&&yr.less(o,1)}function GJ(o,t,e,r){let i=o[r]-2*t[r]+e[r],n=t[r]-o[r];if(i===0)return[];let s=-n/i,a=[];return ebe(s)&&a.push(s),a}function UJ(o,t,e,r,i){let n,s,a=-o[i]+3*t[i]-3*e[i]+r[i],l=2*(o[i]-2*t[i]+e[i]),c=t[i]-o[i],h=l**2-4*a*c;if(yr.lesseq(h,0))n=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY;else{let d=Math.sqrt(h);n=(-l-d)/(2*a),s=(-l+d)/(2*a);let p=a*2;if(yr.lesseq(n,1)&&yr.greatereq(n,0)){let m=Number.NEGATIVE_INFINITY;for(;yr.neq(n,m);){m=n;let g=p*n+l;n=-(a*n**2+l*n+c-g*n)/g}}if(yr.lesseq(s,1)&&yr.greatereq(s,0)){let m=Number.NEGATIVE_INFINITY;for(;yr.neq(s,m);){m=s;let g=p*s+l;s=-(a*s**2+l*s+c-g*s)/g}}}let u=[];return ebe(s)&&u.push(s),ebe(n)&&u.push(n),u}function I4e(o,t){if(o.controls.length===2){let[a,l]=o.controls;_n(a,l)||t.push(new Tt(a,l));return}let e,r;if(o.controls.length===3){let[a,l,c]=o.controls;e=GJ(a,l,c,"x"),r=GJ(a,l,c,"y")}else{let[a,l,c,h]=o.controls;e=UJ(a,l,c,h,"x"),r=UJ(a,l,c,h,"y")}e.sort((a,l)=>l-a),r.sort((a,l)=>l-a);let i=e.pop()||1,n=r.pop()||1,s=0;for(;i!==1||n!==1;)if(yr.eq(i,n))i=e.pop()||1,n=r.pop()||1;else if(i<n){let[a,l]=o.clip((i-s)/(1-s));s=i,t.push(a),o=l,i=e.pop()||1}else{let[a,l]=o.clip((n-s)/(1-s));s=n,t.push(a),o=l,n=r.pop()||1}t.push(o)}var Spt=1e-5,ybe=1,Yi=class Z1 extends dW{constructor(t){if(super(),this._startToEndL=null,t.length<2)throw new Error("Bezier needs at least 2 endpoints");this.controls=t.slice()}get startToEndL(){return this._startToEndL===null&&(this._startToEndL=new Tt(this.start(),this.end())),this._startToEndL}build1(t){let e=[];return bN(t,(r,i)=>(e.push(i),!0)),new Z1(e)}start(){return this.controls[0]}end(){return this.controls[this.controls.length-1]}static pointOn(t,e){if(e.length<1)throw new Error("bezier must have at least 1 point");if(e.length===1)return e[0];{let r=new Array(e.length-1);for(let i=1;i<e.length;i++){let n=e[i-1],s=e[i],a=(s.x-n.x)*t,l=(s.y-n.y)*t;r[i-1]=n.add1(a,l)}return Z1.pointOn(t,r)}}clip1(t,e,r,i){if(r.push(e[0]),i.push(e[e.length-1]),e.length<2)throw new Error("bezier clip must have at least 2 point");if(e.length===2){let n=e[0],s=e[1],a=(s.x-n.x)*t,l=(s.y-n.y)*t,c=n.add1(a,l);r.push(c),i.push(c)}else{let n=new Array(e.length-1);for(let s=1;s<e.length;s++){let a=e[s-1],l=e[s],c=(l.x-a.x)*t,h=(l.y-a.y)*t;n[s-1]=a.add1(c,h)}this.clip1(t,n,r,i)}}clip(t){let e=[],r=[];return this.clip1(t,this.controls,e,r),[new Z1(e),new Z1(r.reverse())]}greater(t,e,r){return t-e>r}less(t,e,r){return t-e<-r}eq(t,e,r){return Math.abs(t-e)<=r}eqPP(t,e,r){return!t||!e?!1:this.eq(t.x,e.x,r)&&this.eq(t.y,e.y,r)}isInRange(t,e=yr.eps){let r=this.controls.map(n=>n.y-t.y),i=0;for(let n of r){if(this.less(n,0,e))i=i|1;else if(this.greater(n,0,e))i=i|2;else{i=3;break}if(i===3)break}if(i!==3)return!1;i=0;for(let n of this.controls){let s=n.x-t.x;if(this.less(s,0,e))i=i|1;else if(this.greater(s,0,e))i=i|2;else{i=3;break}if(i===3)break}return i===3}getPercent(t,e=yr.eps){if(!this.isInRange(t,e))return null;let r=Number.POSITIVE_INFINITY,i=[[this,0,1]];for(;i.length!==0;){let n=function(y){h=Math.min(h,y),u=Math.max(u,y)},s=function(y,b){let P=A9(y,b);if(P===0)throw new Error("cnt === 0");for(let T=0;T<P;T+=2)n(it[T])},[a,l,c]=i.pop();if(this.eqPP(a.start(),t,e))return l;if(this.eqPP(a.end(),t,e))return c;let h=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,d=a.controls.map(y=>y.y-t.y);r=d.reduce((y,b)=>{let P=Math.abs(b);return P<y?P:y},r),r/=2,r<=e&&(r=e),d.forEach((y,b)=>{this.eq(y,0,e)&&n(b/(d.length-1))});let p=new Tt(new Yt(0,-r),new Yt(1,-r)),m=new Tt(new Yt(0,r),new Yt(1,r));for(let y=0;y<d.length-1;y++){let b=new Yt(y/(d.length-1),d[y]),P=this.less(b.y,0,e)?1:this.greater(b.y,0,e)?2:3;for(let T=0;T<d.length;T++){let I=new Yt(T/(d.length-1),d[T]),C=this.less(I.y,0,e)?1:this.greater(I.y,0,e)?2:3;P!==C&&(P===1?C===2?(s(new Tt(b,I),p),s(new Tt(b,I),m)):s(new Tt(b,I),p):P===2?C===1?(s(new Tt(b,I),p),s(new Tt(b,I),m)):s(new Tt(b,I),m):C===1?s(new Tt(b,I),p):s(new Tt(b,I),m))}}if(!isFinite(h)){if(Math.max(...d.map(y=>Math.abs(y)))<e*4)return(l+c)/2;continue}if(h!==0&&(a=a.clip(h)[1],l=(c-l)*h+l),u!==1){let y=(u-h)/(1-h);a=a.clip(y)[0],c=(c-l)*y+l}if(!a.isInRange(t,e))continue;let g=a.controls.reduce((y,b)=>y.ext2(b),new ib).build1();if(this.eq(g.minX,g.maxX,e)&&this.eq(g.minY,g.maxY,e))return(l+c)/2;if(u-h>.8){let[y,b]=a.clip(.5);y.isInRange(t,e)?(i.push([y,l,(l+c)/2]),b.isInRange(t,e)&&i.push([b,(l+c)/2,c])):i.push([b,(l+c)/2,c])}else i.push([a,l,c])}return null}toBezier(){return this}toString(){return"Bezier ["+this.controls.join(" ")+"]"}bbox(){return this._bbox||(this._bbox=new ib().ext3(this.points(.1)).build1()),this._bbox}bboxWithControls(){return this._bbox_controls||(this._bbox_controls=new ib().ext3(this.controls).build()),this._bbox_controls}multiply3(t){let e=new Array(this.controls.length);for(let r=0;r<this.controls.length;r++){let i=this.controls[r];e[r]=i.multiply3(t)}return new Z1(e)}stroke(t,e,r,i=ybe){let n=Ppt.zoomLines(sa.build4(this.points(i)),t);return r===0?n:n.reverse()}points(t){let e=[];return this.getBezierPoints(t,r=>e.push(r)),e}getBezierPoints(t,e){if(this.controls.length===2){e(this.start()),e(this.end());return}let r=[this];for(e(this.start());r.length!==0;){let n=r.pop(),s=new Tt(n.start(),n.end());if(i(n.controls,s)<=t)e(n.end());else{let[a,l]=n.clip(.5);r.push(l,a)}}function i(n,s){let a=s.start(),l=s.end();a.equals1(l)&&(l=a.add1(1,0));let c=l.y-a.y,h=a.x-l.x,u=-c*a.x-h*a.y,d=Math.sqrt(1/(c**2+h**2));c*=d,h*=d,u*=d;let p=n.map(m=>Math.abs(c*m.x+h*m.y+u));return Math.max(...p)}}getBezierPoints3(t,e){if(this.controls.length===2){e(this.start()),e(this.end());return}let r=t*t,i=this.controls[0],n=.5;for(;n>Spt&&!(i.distance2(Z1.pointOn(n,this.controls))<=r);n*=.5);let s=Math.ceil(1/n);n=1/s,e(i);let a=0;for(let l=1;l<s;l++)a+=n,e(Z1.pointOn(a,this.controls));e(this.end())}getPointsBySlope(t){if(this.controls.length===4)return this.getPointsBySlope4(t);throw new Error("Currently, only 4 control points are supported!")}getPointsBySlope4(t){let[e,r,i,n]=this.controls,s=-3*e.x+9*r.x-9*i.x+3*n.x,a=6*e.x-12*r.x+6*i.x,l=-3*e.x+3*r.x,c=[];if(Number.isFinite(t)){let h=-3*e.y+9*r.y-9*i.y+3*n.y,u=6*e.y-12*r.y+6*i.y,d=-3*e.y+3*r.y,p=h-s*t,m=u-a*t,g=d-l*t,y=-m/(2*p),b=Math.sqrt(m**2-4*p*g)/(2*p),P=y+b;P>=0&&P<=1&&c.push(Z1.pointOn(P,this.controls));let T=y-b;T>=0&&T<=1&&c.push(Z1.pointOn(T,this.controls))}else{let h=-a/(2*s),u=Math.sqrt(a**2-4*s*l)/(2*s),d=h+u;d>=0&&d<=1&&c.push(Z1.pointOn(d,this.controls));let p=h-u;p>=0&&p<=1&&c.push(Z1.pointOn(p,this.controls))}return c}buildConverxHull(t=yr.eps){let e=[...this.controls],r=[],i=e[0],n=1;do{let s=e[n%e.length];this.eqPP(i,s,t)||r.push(new Tt(i,s)),i=s,n++}while(i!==e[0]);if(r.length===0)throw Error("buildConverxHull(diff = DoubleKit.eps)");return sa.build7(r).asClose()}getExtremePoints(t){if(!t)return s(this.controls);let e=t.start(),r=t.end(),i=r.x-e.x,n=r.y-e.y;if(Math.abs(i)<=yr.eps||Math.abs(n)<=yr.eps)return s(this.controls);{let a=n/i;if(this.controls.length===3){e.equals1(r)&&(r=e.add1(1,0));let l=r.y-e.y,c=e.x-r.x,h=-l*e.x-c*e.y,u=Math.sqrt(1/(l**2+c**2));l*=u,c*=u,h*=u;let d=this.controls.map(g=>l*g.x+c*g.y+h),p=d[0]-2*d[1]+d[2],m=d[1]-d[0]-a/2;if(p!==0){let g=-m/p;if(yr.greater(g,0)&&yr.less(g,1))return[Z1.pointOn(g,this.controls)]}}else if(this.controls.length===4)return this.getPointsBySlope(a)}return[];function s(a){let l,c;if(a.length===3){let[p,m,g]=a;l=GJ(p,m,g,"x"),c=GJ(p,m,g,"y")}else if(a.length===4){let[p,m,g,y]=a;l=UJ(p,m,g,y,"x"),c=UJ(p,m,g,y,"y")}l.sort((p,m)=>m-p),c.sort((p,m)=>m-p);let h=l.pop()||1,u=c.pop()||1,d=[];for(;h!==1||u!==1;)yr.eq(h,u)?(h=l.pop()||1,u=c.pop()||1):h<u?(d.push(Z1.pointOn(h,a)),h=l.pop()||1):(d.push(Z1.pointOn(u,a)),u=c.pop()||1);return d}}getToLineMaxDis2(t){let e=this.getExtremePoints(t),r=t.distance2(this.start()),i=t.distance2(this.end()),n=Math.max(r,i);return e.forEach(a=>s(t.distance2(a))),n;function s(a){n=Math.max(n,a)}}getToLineMinAndMaxDis_Controls(t){let e=t.start(),r=t.end();t.start().equals1(t.end())&&(r=e.add1(1,0));let i=r.y-e.y,n=e.x-r.x,s=-i*e.x-n*e.y,a=Math.sqrt(1/(i**2+n**2));i*=a,n*=a,s*=a;let l=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY;return this.controls.forEach(h=>{let u=i*h.x+n*h.y+s;u<l&&(l=u),u>c&&(c=u)}),{minDis:l,maxDis:c}}getPercentInLine(t){let e=[],r=[],i=this.controls,n=t.start(),s=t.end(),a=s.y-n.y,l=n.x-s.x,c=-a*n.x-l*n.y,h=Math.sqrt(1/(a**2+l**2));if(a*=h,l*=h,c*=h,a**2+l**2<=0)return e;if(i.length===3){let[u,d,p]=i,m=a*(u.x-2*d.x+p.x)+l*(u.y-2*d.y+p.y),g=2*(a*(d.x-u.x)+l*(d.y-u.y)),y=a*u.x+l*u.y+c;r=Ipt(m,g,y)}else if(i.length===4){let[u,d,p,m]=i,g=m.sub(p.mul(3)).add(d.mul(3)).sub(u),y=u.sub(d.mul(2)).add(p).mul(3),b=d.sub(u).mul(3),P=u,T=a*g.x+l*g.y,I=a*y.x+l*y.y,C=a*b.x+l*b.y,E=a*P.x+l*P.y+c,O=Math.sqrt(1/(T**2+I**2));T*=O,I*=O,C*=O,E*=O,r=Cpt(T,I,C,E)}else throw Error("not support getBeizerPointInLine");return r.forEach(u=>{u>=0&&u<=1&&e.push(u)}),e}reverse(){return new Z1(this.controls.slice().reverse())}},ww,C4e=(ww=class{constructor(){this.textCache=new Map,this.numCache=new Array(20),this.boxCache=new Array(4),this.textOffsetCache=new Array(9),this.BuildLineCache=new Array(7),this.BuildTrackCache=new Array(7),this.BuildViaCache=new Array(11),this.BuildBoxCache=new Array(10),this.BuildArcCache=new Array(10),this.BuildArcTrackCache=new Array(10),this.BuildTextCache=new Array(7),this.BuildPadStyleCache=new Array(4),this.BuildPadCache=new Array(12),this.ARRAY1=new Array(1),this.ARRAY2=new Array(2),this.ARRAY3=new Array(3),this.ARRAY4=new Array(4),this.ARRAY5=new Array(5),this.ARRAY6=new Array(6),this.ARRAY7=new Array(7),this.ARRAY8=new Array(8),this.ARRAY9=new Array(9),this.ARRAY10=new Array(10),this.ARRAY11=new Array(11),this.ARRAY12=new Array(12),this.textOffsetCache[0]=Yt.ORIGIN,this.textOffsetCache[1]=new Yt(0,-.5),this.textOffsetCache[2]=new Yt(0,-1),this.textOffsetCache[3]=new Yt(-.5,0),this.textOffsetCache[4]=new Yt(-.5,-.5),this.textOffsetCache[5]=new Yt(-.5,-1),this.textOffsetCache[6]=new Yt(-1,0),this.textOffsetCache[7]=new Yt(-1,-.5),this.textOffsetCache[8]=new Yt(-1,-1)}static getCache(){return ww.instance==null&&(ww.instance=new ww),ww.instance}},ww.instance=null,ww),Tt=class Lw extends dW{constructor(t,e){super(),this._a=null,this._b=null,this._c=null,this.__bbox=null,this._hashed=null,this._direct=null,this._start=t,this._end=e}get a(){return this._a===null&&(this._start.equals1(this._end)?(this._a=NaN,this._b=NaN,this._c=NaN):(this._a=this._end.y-this._start.y,this._b=this._start.x-this._end.x,this._c=this._end.x*this._start.y-this._start.x*this._end.y)),this._a}get b(){return this._b===null&&(this._start.equals1(this._end)?(this._a=NaN,this._b=NaN,this._c=NaN):(this._a=this._end.y-this._start.y,this._b=this._start.x-this._end.x,this._c=this._end.x*this._start.y-this._start.x*this._end.y)),this._b}get c(){return this._c===null&&(this._start.equals1(this._end)?(this._a=NaN,this._b=NaN,this._c=NaN):(this._a=this._end.y-this._start.y,this._b=this._start.x-this._end.x,this._c=this._end.x*this._start.y-this._start.x*this._end.y)),this._c}get hashed(){return this._hashed==null&&(this._hashed=this._hashCode()),this._hashed}get direct(){return this._direct==null&&(this._direct=this._end.sub(this._start).normalize()),this._direct}cutLine(t){if(yr.eq(this.distance(t),0)){let e=new Lw(this._start,t);return e._a=this._a,e._b=this._b,e._c=this._c,e}return new Lw(this._start,t)}get midPoint(){return this._start.add(this._end).mul(.5)}toBezier(){return new Yi([this._start,this._end])}_hashCode(){let t=31,e=1;return e=t*e+this._start.hashCode(),e=t*e+this._end.hashCode(),e}start(){return this._start}end(){return this._end}center(){let t=this.start(),e=this.end();return t.add(e).mul(.5)}panDistance(t){let e=this._end.x-this._start.x,r=this._end.y-this._start.y,i=this.length();e=e*t/i,r=-r*t/i;let n=new Yt(this._start.x+r,this._start.y+e),s=new Yt(this._end.x+r,this._end.y+e);return new Lw(n,s)}isPoint(){return this._start.distance2(this._end)<=1e-8}length(){return this._start.distance1(this._end)}toString(){return"Line [start="+this._start+", end="+this._end+"]"}bbox(){if(this.__bbox==null){let t=C4e.getCache().boxCache;t[0]=Math.min(this._start.x,this._end.x),t[1]=Math.max(this._start.x,this._end.x),t[2]=Math.min(this._start.y,this._end.y),t[3]=Math.max(this._start.y,this._end.y),this.__bbox=new Wg(t[0],t[1],t[2],t[3])}return this.__bbox}multiply3(t){return new Lw(this._start.multiply3(t),this._end.multiply3(t))}hashCode(){return this.hashed}equals(t){let e=t;return this.hashed===e.hashed&&this._start.equals(e._start)&&this._end.equals(e._end)}equals1(t){let e=t;return this.hashed===e.hashed&&this._start.equals1(e._start)&&this._end.equals1(e._end)}equals2(t){let e=[this.start(),this.end()],r=[t.start(),t.end()];return VC(e,r)||VC(e,r.reverse())}stroke(t,e,r){let i,n,s;this._end.x<this._start.x?(n=this._start.x-this._end.x,s=this._start.y-this._end.y,i=this._end):(n=this._end.x-this._start.x,s=this._end.y-this._start.y,i=this._start);let a=Math.sqrt(n*n+s*s),l=t/2,c,h,u;e===2?(h=-l,u=a+l):(h=0,u=a),e===0||e===2?r===0?c=sa.build5([h,-l,h,l,u,l,u,-l]):c=sa.build5([h,l,h,-l,u,-l,u,l]):r===0?c=sa.build2([mr.build3(new Yt(h,0),-90,-180,l,l),mr.build3(new Yt(u,0),90,-180,l,l)]):c=sa.build2([mr.build3(new Yt(h,0),90,180,l,l),mr.build3(new Yt(u,0),-90,180,l,l)]);let d=Math.atan2(s,n),p=zp.rotate(d).translate1(i);return c.asClose().multiply3(p)}points(t){return[this._start,this._end]}mirrorY(t){return new Lw(this.start().mirrorY(t),this.end().mirrorY(t))}reverse(){return new Lw(this._end,this._start)}inArea(t,e,r){let i=t.x,n=t.y,s=this._start,a=this._end,l=r==1,c=i-s.x,h=n-s.y,u=i-a.x,d=n-a.y,p=a.x-s.x,m=a.y-s.y,g=new Yt(-m,p).normalize(),y=p+g.x*e/2,b=m+g.y*e/2,P=y*y+b*b,T=c*c+h*h,I=u*u+d*d,C=Math.abs(c*m-h*p)/2,E=Math.sqrt(p*p+m*m)*e/4;if(C<=E&&T<=P&&I<=P){if(l)return!0;{let O=new Yt(i,n).sub(a).normalize(),_=new Yt(i,n).sub(s).normalize(),x=new Yt(g.x,g.y).cross(O),v=new Yt(g.x,g.y).cross(_);return x>=0&&v<=0}}else if(l){let O=e/2;return T<=O*O?!0:I<=O*O}else return!1}isParallel(t,e=!1){let r=yr.eq(Math.abs(this.direct.cross(t.direct)),0),i=!e||yr.greatereq(this.direct.dot(t.direct),0);return r&&i}distance2(t){return(this.a*t.x+this.b*t.y+this.c)**2/(this.a**2+this.b**2)}distance2ForPP(t){let{x:e,y:r}=t,{x:i,y:n}=this.start(),{x:s,y:a}=this.end();return((e-i)*(a-n)-(r-n)*(s-i))**2/((a-n)**2+(s-i)**2)}distance(t){return Math.abs(this.a*t.x+this.b*t.y+this.c)/Math.sqrt(this.a**2+this.b**2)}};function Ept(o,t=.05){if(o.length<3)return o.slice();let e=o.slice(0,1),r=(n,s,a)=>ipt(n.x,n.y,s.x,s.y,a.x,a.y);for(;;){e=o.slice(0,1);for(let n=1;n<o.length-1;n+=2)r(o[n],o[n-1],o[n+1])>t&&e.push(o[n]),e.push(o[n+1]);if(e.at(-1).equals1(o.at(-1))||e.push(o.at(-1)),o.length==e.length)break;o=e}let i=o[o.length-1];return e.push(i),e}var Opt=Ldt(Mdt()),Apt=class{constructor(){this.fac=new ib,this.length=0,this.box=null,this.pt=null,this.i=0}calcBBox(o){for(this.fac.clear(),this.length=o.length,this.box=null,this.pt=null,this.i=0;this.i<this.length;this.i++)this.pt=o[this.i],this.box=this.pt.bbox(),this.fac.ext1(this.box);return this.fac.build1()}},_pt=new Apt,sa=class fp{constructor(t,e){this.__bbox=null,this.primitives=t,this.__bbox=e}static calcBBox(t){return _pt.calcBBox(t)}static build1(t){let e=[],r=null;return kJ(t,(i,n)=>{let s=n.start();return r!==null&&!s.equals(r)&&e.push(new Tt(r,s)),e.push(n),r=n.end(),!0}),e.length===0&&r!=null&&e.push(new Tt(r,r)),new fp(e)}static build2(t){return fp.build1(Z2e(t))}static build3(t){let e=[],r=null;return kJ(t,(i,n)=>(r!==null&&e.push(new Tt(r,n)),r=n,!0)),new fp(e)}static build4(t){return this.build3(Z2e(t))}static build5(t){let e=[];for(let r=0;r<t.length;r+=2)e.push(new Yt(t[r],t[r+1]));return this.build4(e)}static build6(t){return fp.build4([t.LL(),t.LR(),t.UR(),t.UL(),t.LL()])}static build7(t){return new fp(t)}static build8(t){let e=new Yt(t[0],t[1]),r,i=[],n,s=(a,l)=>a.length==l&&a.every(c=>typeof c=="number");for(let a=2;a<t.length;)switch(typeof t[a]=="string"?n=t[a]:a-=1,n){case"ARC":{let l=t.slice(a+1,a+4);if(!s(l,3))throw new Error("invalid rawData");let c=l[0];r=new Yt(l[1],l[2]),i.push(mr.build5(e,r,c)),e=r,a+=4;break}case"L":{let l=t.slice(a+1,a+3);if(!s(l,2))throw new Error("invalid rawData");r=new Yt(l[0],l[1]),i.push(new Tt(e,r)),e=r,a+=3;break}case"C":{let l=t.slice(a+1,a+7);if(!s(l,7))throw new Error("invalid rawData");let c=new Yt(l[0],l[1]),h=new Yt(l[2],l[3]);r=new Yt(l[4],l[5]),i.push(new Yi([e,c,h,r])),e=r,a+=7;break}default:throw new Error("invalid rawData")}return fp.build2(i)}static buildBBox(t,e=0){return e===1?fp.build5([t.minX,t.minY,t.maxX,t.minY,t.maxX,t.maxY,t.minX,t.maxY,t.minX,t.minY]):fp.build5([t.minX,t.minY,t.minX,t.maxY,t.maxX,t.maxY,t.maxX,t.minY,t.minX,t.minY])}static triangulate(t,e,r=1){if(t.length===1){let l=new Array;t[0].asClose().points2(r,d=>l.push(d));let c,h=l[0],u=[];for(let d=0;d<l.length-2;d+=2){let p=l[d+1],m=l[d+2],g=p.sub(h).normalize().cross(m.sub(h).normalize());if(yr.neq(g,0)){if(c===!0){if(g<0){u.length=0;break}}else if(c===!1){if(g>0){u.length=0;break}}else c=g>0;u.push(h),u.push(p),u.push(m)}l.push(h),h=m}if(u.length!==0){for(let d=0;d<u.length;d+=3)e(u[d],u[d+1],u[d+2]);return}}let i=[],n=[];t.forEach(l=>{i.length!==0&&n.push(i.length/2),l.asClose().points2(r,c=>i.push(c.x,c.y))});let s=Opt.default(i,n),a=[];for(let l=1;l<i.length;l+=2)a.push(new Yt(i[l-1],i[l]));for(let l=0;l<s.length;l+=3)e(a[s[l]],a[s[l+1]],a[s[l+2]])}lines(t,e){let r=new Array;this.points(t,n=>r.push(n));let i=r[0];for(let n=1;n<r.length;n++){let s=r[n];e(i),e(s),i=s}}triangles(t,e){fp.triangulate([this],(...r)=>{r.forEach(i=>e(i))},t)}mirror(){let t=[];return this.primitives.forEach(e=>{if(e instanceof Tt)e=new Tt(e.start().mirror(),e.end().mirror());else if(e instanceof mr)e=e.mirror();else if(e instanceof Yi){let r=e.controls.map(i=>i.mirror());e=new Yi(r)}else throw new Error("bug");t.push(e)}),new fp(t,this.__bbox)}getPoints(t){let e=[];for(let r of this.primitives)for(let i of r.points(t))e.push(i);return e}round(t=4){let e=this.primitives.slice();for(let r=0;r<e.length;r++){let i=e[r];if(i instanceof Tt){let n=i.start().round(t),s=i.end().round(t);e[r]=new Tt(n,s)}else if(i instanceof Yi){let n=i.controls.map(s=>s.round(t));e[r]=new Yi(n)}else if(i instanceof mr){let n=i.start().round(t),s=i.end().round(t),a=i.sweepAngle;e[r]=mr.build5(n,s,a)}}return new fp(e,this.__bbox)}simplify(t=.05){let e=[],r=!1,i=[],n=this.closed();if(this.primitives.length<=1)return fp.build2(this.primitives);let s=()=>{if(i.length>2){let l=Ept(i,t);for(let c=1;c<l.length;c++)e.push(new Tt(l[c-1],l[c]))}else e.push(new Tt(i[0],i[1]));i.length=0,r=!1};for(let l=0;l<this.primitives.length;l++){let c=this.primitives[l];c instanceof Tt?(r?i.push(c.end()):(i.length=0,i.push(c.start(),c.end()),r=!0),l===this.primitives.length-1&&s()):(r&&s(),e.push(c))}let a=new fp(e,this.__bbox);return n&&!a.closed()&&(a=a.asClose()),a}hasBackLine(){let{primitives:t}=this,e;for(let r=0;r<t.length;r++){let i=t[r];if(i instanceof Tt){if(i.end().equals1(i.start()))continue;if(e&&(i.end().equals1(e.start())||npt(i.end(),e.start(),e.end())))return!0;e=i}else e=null}return!1}area(t=.1){let e=0,r=this.end();return this.primitives.forEach(i=>{let n=i.start(),s=i.end();if(e+=(n.x+r.x)*(n.y-r.y),i instanceof Tt)e+=(s.x+n.x)*(s.y-n.y);else if(i instanceof mr)e+=(s.x+n.x)*(s.y-n.y),e+=Math.PI*i.rx2*i.sweepAngle/180-Yt.normal(i.center,i.start(),i.end());else if(i instanceof Yi){let a=n;i.points(t).forEach(l=>{e+=(l.x+a.x)*(l.y-a.y),a=l}),e+=(s.x+a.x)*(s.y-a.y)}r=s}),e/2}closed(t){return this.primitives.length===0?!1:this.start().equals(this.end(),t)}asClose(){let t=this.primitives[0],e=this.primitives[this.primitives.length-1],r=t.start(),i=e.end();if(r.equals(i))return this;{let n=new Array;return zg.addAll(n,this.primitives),n.push(new Tt(i,r)),fp.build2(n)}}closeEndpoint(){let t=this.primitives[0],e=this.primitives[this.primitives.length-1],r=t.start(),i=e.end();if(r.equals1(i))return this;{let n=new Array;return zg.addAll(n,this.primitives),n.push(new Tt(i,r)),new fp(n)}}reverse(){let t=new Array(this.primitives.length);for(let e=0,r=this.primitives.length-1;r>=0;e++,r--){let i=this.primitives[r];if(i instanceof Tt)i=new Tt(i.end(),i.start());else if(i instanceof mr)i=i.exchangeSweep();else if(i instanceof Yi)i=new Yi(i.controls.slice().reverse());else throw new Error("bug");t[e]=i}return new fp(t,this.__bbox)}reverse1(){let t=new Array(this.primitives.length);for(let e=0,r=this.primitives.length-1;r>=0;e++,r--){let i=this.primitives[r];if(i instanceof Tt)i=new Tt(i.end(),i.start());else if(i instanceof mr)i=i.exchangeSweep1();else if(i instanceof Yi)i=new Yi(i.controls.slice().reverse());else throw new Error("bug");t[e]=i}return new fp(t,this.__bbox)}mirrorY(t){let e=[];return this.primitives.forEach(r=>{if(r instanceof Tt)r=r.mirrorY(t);else if(r instanceof mr)r=r.mirrorY(t);else if(r instanceof Yi){let i=r.controls.map(n=>n.mirrorY(t));r=new Yi(i)}else throw new Error("bug");e.push(r)}),new fp(e,this.__bbox)}points(t,e){if(this.primitives.length!==0){for(let r=0;r<this.primitives.length-1;r++){let i=this.primitives[r].points(t);i.pop(),i.forEach(n=>e(n))}this.primitives[this.primitives.length-1].points(t).forEach(r=>e(r))}}points1(t,e){if(this.primitives.length===0)return;for(let i=0;i<this.primitives.length-1;i++){let n=this.primitives[i],s=n instanceof mr?n.points1(t):n.points(t);s.pop(),s.forEach(a=>e(a))}let r=this.primitives[this.primitives.length-1];(r instanceof mr?r.points1(t):r.points(t)).forEach(i=>e(i))}points2(t,e){if(this.primitives.length===0)return;for(let i=0;i<this.primitives.length-1;i++){let n=this.primitives[i],s=n instanceof mr?n.points2():n.points(t);s.pop(),s.forEach(a=>e(a))}let r=this.primitives[this.primitives.length-1];(r instanceof mr?r.points2():r.points(t)).forEach(i=>e(i))}multiply3(t){let e=new Array(this.primitives.length);for(let r=0;r<this.primitives.length;r++)e[r]=this.primitives[r].multiply3(t);return fp.build7(e)}bbox(){return this.__bbox==null&&(this.__bbox=fp.calcBBox(this.primitives)),this.__bbox}start(){return this.primitives.length!==0?this.primitives[0].start():null}end(){return this.primitives.length!==0?this.primitives[this.primitives.length-1].end():null}isClose(t){if(this.primitives.length<=1&&!(this.primitives[0]instanceof mr))return!1;{let e=this.primitives[0],r=this.primitives[this.primitives.length-1];return e.start().equals(r.end(),t)}}isEqual(t){if(t instanceof fp&&t.primitives.length==this.primitives.length){let e=t.primitives.length;for(let r=0;r<e;r++){let i=t.primitives[r],n=this.primitives[r];if(JSON.stringify(i)!=JSON.stringify(n))return!1}return!0}return!1}equals(t){if(!t)return!1;let e=this.primitives,r=t.primitives;if(e.length!=r.length)return!1;if(t.isClose()){let i=0;for(;i<e.length;){let n=e.slice(i).concat(e.slice(0,i));if(VC(n,r)||VC(n.reverse(),r))return!0;i++}return!1}else return VC(this.primitives,t.primitives)}clone(){return fp.build2(this.primitives)}putItem(t,e){if(!t)return!1;if(t instanceof fp)return this.mergePolyline(t,e);let r=this.start();if(!r){this.primitives.push(t),this.__bbox=t.bbox();return}let i=this.end();if(r.equals(i,e))return!1;let n=t.start(),s=t.end(),a=!1,l=!1;if(r.equals(n,e))a=!0,l=!1;else if(r.equals(s,e))a=!1,l=!1;else if(i.equals(n,e))a=!1,l=!0;else if(i.equals(s,e))a=!0,l=!0;else return!1;return l?this.primitives.push(a?t.reverse():t):this.primitives.unshift(a?t.reverse():t),this.__bbox=Wg.extend2(this.__bbox,t.bbox()),!0}mergePolyline(t,e,r=0){if(!t)return!1;let i=this.start();if(!i){this.primitives.push(...t.primitives),this.__bbox=t.bbox();return}let n=this.end();if(i.equals(n,e))return!1;let s=t.start(),a=t.end(),l=!1,c=!1;if(i.equals(s,e))l=!0,c=!1;else if(i.equals(a,e))l=!1,c=!1;else if(n.equals(s,e))l=!1,c=!0;else if(n.equals(a,e))l=!0,c=!0;else return!1;let h=l?t.reverse():t;return c?this.primitives.push(...h.primitives):this.primitives.unshift(...h.primitives),this.__bbox=Wg.extend2(this.__bbox,t.bbox()),!0}deDuplicationPoint(t){let e=this.primitives[this.primitives.length-1].start(),r=this.primitives[this.primitives.length-1].end(),i=t.primitives[0].start(),n=t.primitives[0].end();if(this.primitives[this.primitives.length-1]instanceof Tt&&t.primitives[0]instanceof Tt&&upt([e,r],[i,n])){this.primitives.pop(),t.primitives.shift();let s=[];s.push(new Tt(e,n)),this.primitives.push(...s)}}getMaxBBoxHeightByVec(t){let e=t.normalize(),r=-1/0,i=1/0;if(this.primitives.forEach(s=>{let a=s.start().dot(e),l=s.end().dot(e);if(n(a),n(l),s instanceof mr){let c=t.angleD(Yt.ORIGIN);if(s.angleIsInArc(c)){let h=s.pointOn(c).dot(e);n(h)}if(s.angleIsInArc(c+180)){let h=s.pointOn(c-180).dot(e);n(h)}}}),r-i<=0)throw new Error("getMaxBBoxHeightByVec");return r-i;function n(s){s>r&&(r=s),s<i&&(i=s)}}getWindingNum(t){let e=this.end(),r=0,{x:i,y:n}=t;for(let a of this.primitives){if(e.y>n?a.bbox().minY>n:a.bbox().maxY<=n){e=a.end();continue}if(a instanceof mr&&(a.isCCW?Math.floor(a.startAngle/90)+1!==Math.ceil(a.endAngle()/90):Math.ceil(a.startAngle/90)-1!==Math.floor(a.endAngle()/90))){let l=a.startAngle,c=a.endAngle();if(a.sweepAngle>0){let h=90;for(;h<=c;)h>l&&(s(mr.build3(a.center,l,h-l,a.rx,a.ry)),l=h),h+=90;l<c&&s(mr.build3(a.center,l,c-l,a.rx,a.ry))}else{let h=270;for(;h>=c;)h<l&&(s(mr.build3(a.center,l,h-l,a.rx,a.ry)),l=h),h-=90;l>c&&s(mr.build3(a.center,l,c-l,a.rx,a.ry))}}else if(a instanceof Yi){let l=[];I4e(a,l),l.forEach(c=>s(c))}else s(a)}return r;function s(a){let l=a.start(),c=a.end();if(e.y>n!=l.y>n&&(e.x>i?l.x>i?r+=l.y>e.y?1:-1:e.y>l.y?(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)<0&&r--:(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)>0&&r++:l.x>i&&(e.y>l.y?(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)<0&&r--:(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)>0&&r++)),l.y>n!=c.y>n){if(l.x>i)if(c.x>i)r+=c.y>l.y?1:-1;else if(a instanceof Tt)l.y>c.y?(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)<0&&r--:(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)>0&&r++;else if(a instanceof mr){let{center:h,isCCW:u,rx2:d}=a,p=(h.x-i)**2+(h.y-n)**2;l.y>c.y?(u?p>d:p<d)&&r--:(u?p<d:p>d)&&r++}else if(a instanceof Yi){if(MMe(a,n)===0)throw new Error("no inters");it[0]>i&&(r+=c.y>l.y?1:-1)}else throw new Error("not support!");else if(c.x>i)if(a instanceof Tt)l.y>c.y?(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)<0&&r--:(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)>0&&r++;else if(a instanceof mr){let{center:h,isCCW:u,rx2:d}=a,p=(h.x-i)**2+(h.y-n)**2;l.y>c.y?(u?p>d:p<d)&&r--:(u?p<d:p>d)&&r++}else if(a instanceof Yi){if(MMe(a,n)===0)throw new Error("no inters");it[0]>i&&(r+=c.y>l.y?1:-1)}else throw new Error("not support!")}e=c}}},CJ=Math.PI*2,bFt=Math.PI/2,PFt=Math.sin(Math.PI/180),vpt=4,mr=class Eh extends dW{constructor(t,e,r,i,n){super(),this._rx2=null,this._ry2=null,this._svgEnd=null,this._hashed=null,this.__bbox=null,this.rx=t,this.ry=e,this.center=r,this.startAngle=i,this.sweepAngle=n,this._start=Yt.ORIGIN,this._end=Yt.ORIGIN,this._start=this.pointOn(i),this._end=this.pointOn(i+n)}get hashed(){return this._hashed==null&&(this._hashed=this._hashCode()),this._hashed}hashCode(){return this.hashed}_hashCode(){let t=31,e=1;return e=t*e+new Yt(this.rx,this.rx).hashCode(),e=t*e+this.center.hashCode(),e=t*e+new Yt(this.startAngle,this.sweepAngle).hashCode(),e}get rx2(){return this._rx2==null&&(this._rx2=this.rx*this.rx),this._rx2}get ry2(){return this._ry2==null&&(this._ry2=this.ry*this.ry),this._ry2}get svgEnd(){return this._svgEnd==null&&(this._svgEnd=this.getSvgEnd(this.startAngle,this.sweepAngle,this._start,this._end)),this._svgEnd}getSvgEnd(t,e,r,i){let n=e>=0?-.01:.01,s=t+e;for(;(e>=0&&s>t||e<0&&s<t)&&r.distance2(i)<2e-4;)n*=2,s+=n,i=this.pointOn(s);return i}static build1(t,e,r,i,n,s){pu.positive(r),pu.positive(i);let a=t.equals(e);if(a)return new Eh(r,i,t,0,n?360:0);{let l=t.x,c=-t.y,h=e.x,u=-e.y,d=s===0,p=(l-h)/2,m=(c-u)/2,g=Math.cos(0),y=Math.sin(0),b=g*p+y*m,P=-y*p+g*m;r=Math.abs(r),i=Math.abs(i);let T=r*r,I=i*i,C=b*b,E=P*P,O=n===d?-1:1,_=(T*I-T*E-I*C)/(T*E+I*C);_=_<0?0:_;let x=O*Math.sqrt(_),v=x*(r*P/i),D=x*-(i*b/r),w=(l+h)/2,F=(c+u)/2,H=w+(g*v-y*D),z=F+(y*v+g*D),V=(b-v)/r,W=(P-D)/i,L=(-b-v)/r,k=(-P-D)/i,N,U;U=Math.sqrt(V*V+W*W),N=V,O=W<0?-1:1;let B=Vo.toDegrees(O*Math.acos(N/U));U=Math.sqrt((V*V+W*W)*(L*L+k*k)),N=V*L+W*k,O=V*k-W*L<0?-1:1;let G=N/U,Y;G<-1?Y=Math.acos(-1):G>1?Y=Math.acos(1):Y=Math.acos(G);let X=Vo.toDegrees(O*Y);!d&&X>0?X-=360:d&&X<0&&(X+=360),pu.normal(B),pu.normal(X);let K=p*p/T+m*m/I,J=t.distance1(e)/2;r<J&&i<J&&(r*=Math.sqrt(K),i*=Math.sqrt(K));let se=a?0:Vo.regularD(-B),ce=a?n?360:0:-X;return new Eh(r,i,new Yt(H,-z),se,ce)}}static build2(t,e,r,i,n,s){pu.positive(i),pu.positive(n),pu.normal(e),pu.normal(r);let a;return e===r?(e=Vo.regularD(e),r=Vo.regularD(r),a=0):(e=Vo.regularD(e),r=Vo.regularD(r),s===1?r<=e&&(r+=360):r>=e&&(e+=360),a=r-e),new Eh(i,n,t,Vo.regularD(e),a)}static build3(t,e,r,i,n){return pu.positive(i),pu.positive(n),pu.normal(r),new Eh(i,n,t,Vo.regularD(e),r)}static build4(t,e,r,i,n,s){let a=t.angleD(r),l=e.angleD(r);return Eh.build2(r,a,l,i,n,s)}static build5(t,e,r){r=Vo.toRadians(r);let i=e.sub(t),n=new Yt(-i.y,i.x).normalize(),s=Math.abs(r)/2,a;if(s!=0)a=i.length()/2/Math.sin(s);else throw new Error("Can't represent circle!!!");let l=n.rotate(Yt.ORIGIN,s),c,h;r>0?(c=1,h=e.add(l.scale(a))):(c=0,h=t.sub(l.scale(a)));let u=Vo.toDegrees(t.angle(h)),d=Vo.toDegrees(e.angle(h));return Eh.build2(h,u,d,a,a,c)}static buildCircle(t,e,r=0){return Eh.build2(t,0,360,e,e,r)}start(){return this._start}end(){return this._end}isLarge(){return Math.abs(this.sweepAngle)>180}sweep(){return this.sweepAngle>=0?1:0}get isCCW(){return this.sweepAngle>=0}endAngle(){return this.startAngle+this.sweepAngle}pointOn(t){t=Vo.regularD(t);let e=this.rx,r=this.ry;if(t===0)return this.center.add1(e,0);if(t===90)return this.center.add1(0,r);if(t===180)return this.center.add1(-e,0);if(t===270)return this.center.add1(0,-r);{let i=this.rx2,n=this.ry2,s=Math.tan(Vo.toRadians(t)),a=s*s,l=Math.sqrt(i*n/(i+n/a)),c=Math.sqrt(i*n/(n+i*a));return t>90&&t<270&&(c=-c),t>180&&t<360&&(l=-l),isNaN(c)&&(c=0),isNaN(l)&&(l=0),this.center.add1(c,l)}}exchangeSweep(){return Eh.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle,this.rx,this.ry)}exchangeSweepAndStart(){return Eh.build1(this.end(),this.start(),this.rx,this.ry,this.isLarge(),this.sweepAngle>=0?0:1)}exchangeSweep1(){return Eh.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle+.01,this.rx,this.ry)}mirrorY(t){let e=this.start(),r=this.end();return e.equals(r)?Eh.build3(this.center.mirrorY(),0,360,this.rx,this.ry):Eh.build1(e.mirrorY(t),r.mirrorY(t),this.rx,this.ry,this.isLarge(),this.sweepAngle>=0?0:1)}mirror(t=Yt.ORIGIN){let e=this.start(),r=this.end();return e.equals(r)?Eh.build3(this.center.mirror(t),0,360,this.rx,this.ry):Eh.build1(e.mirror(t),r.mirror(t),this.rx,this.ry,this.isLarge(),this.sweep())}sectorArea(){return Math.abs(this.sweepAngle)/360*Math.PI*this.rx*this.ry}area(){let t=J2e.area(this.center,this._start,this.pointOn(this.endAngle()));return this.sectorArea()-t}multiply3(t){let e;t.isMirrored()?e=-this.sweepAngle:e=this.sweepAngle;let r;return t.equals(zp.ROT_90)?r=Vo.regularD(this.startAngle+90):t.equals(zp.ROT_N90)?r=Vo.regularD(this.startAngle-90):r=Vo.transformD(this.startAngle,t),Eh.build3(this.center.multiply3(t),r,e,t.iScale*this.rx,t.iScale*this.ry)}angleIsInArc(t){return t=Vo.regularD(t),this.sweepAngle>0?(t<this.startAngle&&(t+=360),this.endAngle()>t):(t>this.startAngle&&(t-=360),this.endAngle()<t)}toBezier(){if(Math.abs(this.sweepAngle)>90)throw new Error("not support!");let t=this.start(),e=this.end(),r=Vo.toRadians(this.sweepAngle)/2,i=4/3*(1-Math.cos(r))/Math.sin(r)*this.rx;return new Yi([t,t.add(new Yt(i,0).multiply3(zp.rotateD(this.startAngle+90))),e.add(new Yt(i,0).multiply3(zp.rotateD(this.endAngle()-90))),e])}toBezier2(){let t=[];r(this,90);let e=[];return t.forEach(i=>e.push(i.toBezier())),e;function r(i,n){if(Math.abs(i.sweepAngle)>n){let s=i.sweepAngle/2;r(Eh.build3(i.center,i.startAngle,s,i.rx,i.ry),n),r(Eh.build3(i.center,i.startAngle+s,s,i.rx,i.ry),n)}else t.push(i)}}buildBBox(){let t=C4e.getCache().boxCache,e=this.startAngle+this.sweepAngle;if(t[0]=Math.min(this._start.x,this._end.x),t[1]=Math.max(this._start.x,this._end.x),t[2]=Math.min(this._start.y,this._end.y),t[3]=Math.max(this._start.y,this._end.y),this.sweepAngle>0){let r=0;for(;r<e;){if(r>this.startAngle){let i=this.pointOn(r);t[0]=Math.min(t[0],i.x),t[1]=Math.max(t[1],i.x),t[2]=Math.min(t[2],i.y),t[3]=Math.max(t[3],i.y)}r+=90}}else if(this.sweepAngle<0){let r=360;for(;r>e;){if(r<this.startAngle){let i=this.pointOn(r);t[0]=Math.min(t[0],i.x),t[1]=Math.max(t[1],i.x),t[2]=Math.min(t[2],i.y),t[3]=Math.max(t[3],i.y)}r-=90}}return new Wg(t[0],t[1],t[2],t[3])}bbox(){return this.__bbox==null&&(this.__bbox=this.buildBBox()),this.__bbox}length(){return Math.abs(this.rx*this.sweepAngle*Math.PI/180)}toString(){return mN.format("Arc [start=%s, end=%s, rx=%s, ry=%s, center=%s, startAngle=%s, sweepAngle=%s]",this._start,this._end,this.rx,this.ry,this.center,this.startAngle,this.sweepAngle)}stroke(t,e,r){let i=t/2,n=this.rx+i,s=this.ry+i,a=this.rx-i,l=this.ry-i,c=new zp;a<0&&(a=-a,c=c.multiply3(zp.MIRROR_Y)),l<0&&(l=-l,c=c.multiply3(zp.MIRROR_X)),a===0&&(a=.001),l===0&&(l=.001),c=c.setOrigin1(this.center);let h,u;switch(r===this.sweep()?(h=Eh.build3(this.center,this.startAngle,this.sweepAngle,n,s),u=Eh.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle,a,l)):(h=Eh.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle,n,s),u=Eh.build3(this.center,this.startAngle,this.sweepAngle,a,l)),u=u.multiply3(c),e){case 1:{let d=r===1?180:-180,p=r===this.sweep()?this.pointOn(this.endAngle()):this.pointOn(this.startAngle),m=r===this.sweep()?this.pointOn(this.startAngle):this.pointOn(this.endAngle()),g=h.pointOn(h.endAngle()).angleD(p),y=u.pointOn(u.endAngle()).angleD(m);return sa.build2([h,Eh.build3(p,g,d,i,i),u,Eh.build3(m,y,d,i,i)])}default:return sa.build2([h,u])}}points2(){let t=Math.ceil(Math.abs(this.sweepAngle)/vpt),e=this.sweepAngle/t,r=[this._start];for(let i=1;i<t;i++)r.push(this.pointOn(this.startAngle+e*i));return r.push(this._end),r}points1(t){let e=Math.max(this.rx,this.ry);if(e<=t)return[this.start(),this.svgEnd];let r=(e-t)/e,i=Math.ceil(Math.abs(this.sweepAngle/Vo.toDegrees(Math.acos(r))/2)),n=new Array(i+1),s=this.sweepAngle/i,a=this.startAngle;for(let l=0;l<=i;l++,a+=s)n[l]=this.pointOn(a);return n}points(t){let e=Math.max(this.rx,this.ry);if(t=Math.abs(t),e<=t)return[this.start(),this.svgEnd];t=Math.max(t,e*1e-5),t=Math.min(t,e*(1-Math.SQRT1_2));let r=(e-t)/e,i=Math.ceil(Math.abs(this.sweepAngle/Vo.toDegrees(Math.acos(r))/2));i=Math.max(i,2);let n=new Array(i+1),s=this.sweepAngle/i,a=this.startAngle+s;n[0]=this.start();for(let l=1;l<i;l++,a+=s)n[l]=this.pointOn(a);return n[i]=this.end(),n}panDistance(t){return this.sweepAngle>0?new Eh(this.rx-t,this.ry-t,this.center,this.startAngle,this.sweepAngle):new Eh(this.rx+t,this.ry+t,this.center,this.startAngle,this.sweepAngle)}panDistance1(t){if(this.sweepAngle>0){let e=this.rx-t;return e<0?(e=Math.abs(e),Eh.build3(this.center,this.startAngle-180,this.sweepAngle,e,e)):new Eh(e,e,this.center,this.startAngle,this.sweepAngle)}else{let e=this.rx+t;return e<0?(e=Math.abs(e),Eh.build3(this.center,this.startAngle-180,this.sweepAngle,e,e)):new Eh(e,e,this.center,this.startAngle,this.sweepAngle)}}get bulge(){let t=Math.abs(tpt(this.sweepAngle,3))/180*Math.PI;return Math.tan(t/4)}get midPoint(){let t=Vo.toRadians(this.startAngle),e=Vo.toRadians(this.endAngle()),r=this.sweep(),i=this.center,n=this.rx;if(r==1)if(e>t){let s=(e-t)/2+t;return i.add(new Yt(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new Yt(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(e+CJ-t)/2+t;return i.add(new Yt(Math.cos(s),Math.sin(s)).mul(n))}}else if(e>t){let s=(t+CJ-e)/2+e;return i.add(new Yt(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new Yt(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(t-e)/2+e;return i.add(new Yt(Math.cos(s),Math.sin(s)).mul(n))}}}get svgPathData(){return[{type:"M",values:[this._start.x,this._start.y]},{type:"A",values:[this.rx,this.ry,0,this.isLarge()?1:0,this.isCCW,this._end.x,this._end.y]}]}equals(t){let e=Vo.regularD(this.startAngle),r=Vo.regularD(this.sweepAngle),i=Vo.regularD(t.startAngle),n=Vo.regularD(t.sweepAngle);return VC([this.rx,this.ry,this.center,Math.abs(r)],[t.rx,t.ry,t.center,Math.abs(n)])&&(VC([r,e],[n,i])||VC([Vo.regularD(e+r)],[i]))}equals1(t){let e=Vo.regularD(this.startAngle),r=Vo.regularD(this.sweepAngle),i=Vo.regularD(t.startAngle),n=Vo.regularD(t.sweepAngle);return VC([this.rx,this.ry,this.center,Math.abs(r)],[t.rx,t.ry,t.center,Math.abs(n)])&&(VC([r,e],[n,i])||VC([Vo.regularD(e+r)],[i]))}inArea(t,e){let r=t.x,i=t.y,n=this.center,s=this.rx,a=Vo.toRadians(this.startAngle);this.sweep()==0&&(a=Vo.toRadians(this.endAngle()));let l=Vo.toRadians(this.endAngle());this.sweep()==0&&(l=Vo.toRadians(this.startAngle));let c=s-e/2,h=s+e/2;var u=r-n.x,d=i-n.y,p=Math.atan2(d,u);if(p<0&&(p+=CJ),a<=l&&p>=a&&p<=l||a>l&&(p>=a&&p<=CJ||p>=0&&p<=l)||a==l){var m=Math.sqrt(u*u+d*d);return m<=h&&m>=c}else{var m=(h+c)/2,g=new Yt(n.x+Math.cos(a)*m,n.y+Math.sin(a)*m),y=new Yt(n.x+Math.cos(l)*m,n.y+Math.sin(l)*m),b=r-g.x,P=i-g.y,T=r-y.x,I=i-y.y;return b*b+P*P<=e*e/4?!0:T*T+I*I<=e*e/4}}isCircle(){return(yr.eq(Math.abs(this.sweepAngle),360)||this._start.equals1(this._end))&&this.rx==this.ry}reverse(){return Eh.build3(this.center,this.endAngle(),-this.sweepAngle,this.rx,this.ry)}getAngle(){let t=Math.PI*2;return this.sweep()==1?(this.endAngle()-this.startAngle+t)%t:(this.startAngle-this.endAngle()+t)%t}isValid(){return this.rx>0&&this.ry>0}},S4e=new ArrayBuffer(24),L2e=new Float64Array(S4e),nN=new Int32Array(S4e),Pm,TFt=(Pm=class{static normal(o,t,e){let r=t.sub(o),i=e.sub(t);return r.cross(i)}constructor(o,t,e){this.x=pu.normal(o),this.y=pu.normal(t),this.z=pu.normal(e),L2e[0]=o,L2e[1]=t,L2e[2]=e,this.hashed=nN[0]^nN[1]^nN[2]^nN[3]^nN[4]^nN[5]}isZeroVector(){return this.x===0&&this.y===0&&this.z===0}hashCode(){return this.hashed}equals(o){return o instanceof Pm?o.x===this.x&&o.y===this.y&&o.z===this.z:!1}cross(o){return new Pm(this.y*o.z-this.z*o.y,this.z*o.x-this.x*o.z,this.x*o.y-this.y*o.x)}dot(o){return this.x*o.x+this.y*o.y+this.z*o.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}normalize(){var o=this.length();return new Pm(this.x/o,this.y/o,this.z/o)}sub(o){return new Pm(this.x-o.x,this.y-o.y,this.z-o.z)}add(o){return new Pm(this.x+o.x,this.y+o.y,this.z+o.z)}scale(o){return new Pm(this.x*o,this.y*o,this.z*o)}neg(){return new Pm(-this.x,-this.y,-this.z)}multiply4(o){var t=this.x*o.data[0]+this.y*o.data[4]+this.z*o.data[8]+o.data[12],e=this.x*o.data[1]+this.y*o.data[5]+this.z*o.data[9]+o.data[13],r=this.x*o.data[2]+this.y*o.data[6]+this.z*o.data[10]+o.data[14],i=this.x*o.data[3]+this.y*o.data[7]+this.z*o.data[11]+o.data[15];return i!=0?new Pm(t/i,e/i,r/i):new Pm(t,e,r)}rotate(o,t){return this.multiply4(y4e.rotateAxis(o,t))}toVector2(){return new Yt(this.x,this.y)}},Pm.ORIGIN=new Pm(0,0,0),Pm.X_UNIT_VECTOR=new Pm(1,0,0),Pm.Y_UNIT_VECTOR=new Pm(0,1,0),Pm.Z_UNIT_VECTOR=new Pm(0,0,1),Pm),Fd=class uN{static build(t){return t instanceof sa?new uN([new p0([t])]):t instanceof p0?new uN([t]):t}static buildByPolygon(t){return t?new uN([t]):new uN([])}static buildByStroke(t,e,r=1,i){return this.buildByPolygon(p0.buildByStroke(t,e,r,ybe,i))}static buildCircle(t,e){return this.buildByPolygon(p0.buildCircle(t,e))}static buildRect(t){return this.buildByPolygon(p0.buildRect(t))}static buildBBox(t){return this.buildByPolygon(p0.buildBBox(t))}constructor(t){this.items=t.slice()}multiply3(t){return new uN(this.items.map(e=>e.multiply3(t)))}bbox(){return this._bbox||(this._bbox=this.items.reduce((t,e)=>t.ext1(e.bbox()),new ib).build1()),this._bbox}toPolylineGroups(){return this.items.map(t=>t.toPolylineGroup())}},Sh,Ol=(Sh=class{static isHexFormate(o){return!o||typeof o!="string"?!1:/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(o)}static of1(o){return this.of2(o>>16&255,o>>8&255,o&255)}static of2(o,t,e,r=255){return new Sh(o/255,t/255,e/255,r/255)}static of3(o){o.startsWith("#")&&(o=o.substr(1));let t=o.length;if(t==3)return new Sh(parseInt(o[0],16)/15,parseInt(o[1],16)/15,parseInt(o[2],16)/15);if(t==6)return new Sh(parseInt(o.substr(0,2),16)/255,parseInt(o.substr(2,2),16)/255,parseInt(o.substr(4,2),16)/255);if(t==8)return new Sh(parseInt(o.substr(0,2),16)/255,parseInt(o.substr(2,2),16)/255,parseInt(o.substr(4,2),16)/255,parseInt(o.substr(6,2),16)/255);throw new Error("invalid color string")}static of4(o){let t=parseInt(o.r*255+"").toString(16),e=parseInt(o.g*255+"").toString(16),r=parseInt(o.b*255+"").toString(16);return t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),("#"+t+e+r).toUpperCase()}static of5(o,t){if(o.startsWith("#")&&(o=o.substr(1)),o.length==3)return new Sh(parseInt(o[0],16)/15,parseInt(o[1],16)/15,parseInt(o[2],16)/15,t);if(o.length==6)return new Sh(parseInt(o.substr(0,2),16)/255,parseInt(o.substr(2,2),16)/255,parseInt(o.substr(4,2),16)/255,t);throw new Error("invalid color string")}static of6(o,t){return new Sh(o.r,o.g,o.b,t)}static of7(o){return o==null?null:Sh.of3(o)}constructor(o,t,e,r=1){this.r=pu.positiveOr0(o),this.g=pu.positiveOr0(t),this.b=pu.positiveOr0(e),this.alpha=r}hashCode(){return this.r+this.g+this.b+this.alpha}equals(o,t=!1){let e=this.r===o.r&&this.g===o.g&&this.b===o.b;return t?e:e&&this.alpha===o.alpha}add(o,t,e,r){return new Sh(Math.max(0,Math.min(1,this.r+o)),Math.max(0,Math.min(1,this.g+t)),Math.max(0,Math.min(1,this.b+e)),Math.max(0,Math.min(1,this.alpha+r)))}mul(o){return new Sh(Math.max(0,Math.min(1,this.r*o)),Math.max(0,Math.min(1,this.g*o)),Math.max(0,Math.min(1,this.b*o)),this.alpha)}mul1(o){return new Sh(Math.max(0,this.r*o),Math.max(0,this.g*o),Math.max(0,this.b*o),this.alpha)}getData(){return[this.r,this.g,this.b,this.alpha]}toString(){let o=(this.r*255).toString(16),t=(this.g*255).toString(16),e=(this.b*255).toString(16);return o.length<2&&(o="0"+o),t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),"#"+o.substr(0,2)+t.substr(0,2)+e.substr(0,2)}toString1(){let o=(this.r*255).toString(16),t=(this.g*255).toString(16),e=(this.b*255).toString(16),r=(this.alpha*255).toString(16);return o.length<2&&(o="0"+o),t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),"#"+o.substr(0,2)+t.substr(0,2)+e.substr(0,2)+r.substr(0,2)}toRGBA(){let o=this.r*255,t=this.g*255,e=this.b*255;return[o,t,e,this.alpha]}toRGBAString(){let o=this.r*255,t=this.g*255,e=this.b*255;return`rgba(${o},${t},${e},${this.alpha})`}isWHITE(){return this.r===1&&this.g===1&&this.b===1&&this.alpha===1}},Sh.WHITE=new Sh(1,1,1,1),Sh.BLACK=new Sh(0,0,0,1),Sh.RED=new Sh(1,0,0,1),Sh.GREEN=new Sh(0,1,0,1),Sh.BLUE=new Sh(0,0,1,1),Sh.Gray=Sh.of3("#9966ff"),Sh.Silver=Sh.of3("#D2D2D2"),Sh.Golden=Sh.of3("#DCAA14"),Sh.Pink=Sh.of3("#ffaec9"),Sh),UMe=!1,E4e=class{onRTreeBBox(o){}onResultSide(o){}onOriginSide(o){}onSplitedSide(o){}onDebugSide(o){}onSweep(o,t,e,r,i,n){}onIntersect(o,t,e){}onSegment(o,t,e,r,i,n){}onSegment1(o,t,e){if(UMe){let r=new Yt(o.getX(e),e),i=new Yt(t.getX(e),e);this.onSegment(r,o.weight,o,i,t.weight,t)}else this.onSegment(o.start,o.weight,o,t.end,t.weight,t)}onSweep1(o,t,e){if(UMe){let r=new Yt(o.getX(e),e),i=new Yt(t.getX(e),e);this.onSweep(r,o.weight,o,i,t.weight,t)}else this.onSweep(o.start,o.weight,o,t.end,t.weight,t)}},sW=class extends E4e{constructor(o){super(),this.plGrps=new Array,this.debug=o}onPolylineGroup(o,t){this.plGrps.push(o)}},pW=class{constructor(o){this.cache={},this.levels=o,this.result=new Array(o),this.weights=new Array(o),this.maxIdx=o-1,this.rule=this.decide.bind(this);let t=1;for(let e=0;e<o;e++)this.weights[e]=t,t*=50}weight(o){return this.weights[o]}decide(o){o=Math.abs(o);let t=this.cache[o];if(t===void 0){let e=o;for(let r=this.maxIdx;r>=0;r--){let i=this.weights[r],n=o/i|0,s=o%i;s>(i/2|0)?(o=i-s,n++):o=s,this.result[r]=n>0}t=this.decide1(this.result),this.cache[e]=t}return t}},xpt=o=>o!==0,Rpt=new class extends pW{decide1(o){return o[0]||o[1]}}(2),DJ=new class extends pW{decide1(o){return o[0]&&!o[1]}}(2),wJ=new class extends pW{decide1(o){return o[0]&&o[1]}}(2),M2e=new class extends pW{decide1(o){return o[0]&&!o[1]||!o[0]&&o[1]}}(2),Dpt=(o=>(o[o.UNMARKED=0]="UNMARKED",o[o.INSIDE=1]="INSIDE",o[o.OUTSIDE=2]="OUTSIDE",o[o.INVALID=3]="INVALID",o))(Dpt||{}),TN=class dN{constructor(t,e,r,i,n,s,a){this.inters=[],this.connect=new Array,this.previous=null,this.next=null,this.finalGrp=-1,this.trans=NaN,this.outsideWeight=0,this.insideWeight=0,this.invalidWeight=0,this._confidence=0,this._confidence_y=NaN,this._x=NaN,this._x_y=NaN,this.status=0,this.bo=t,this.shape=e,this.baseWeight=r,i.y>n.y?this.weight=-r:i.y==n.y?this.weight=0:this.weight=r,this.start=i,this.end=n,this.polyGrp=s,this.polyIndex=a,this._bbox=new ib().ext1(e.bbox()).ext2(i).ext2(n).build1(),this.inters.push(i),this.inters.push(n);let l=31,c=1;c=l*c+this.polyGrp,c=l*c+this.polyIndex,this._hashcode=c}static rebuild(t,e,r){if(t instanceof Tt||e.distance2(r)<1e-6)return new Tt(e,r);if(t instanceof mr){let i=t,n=t.bbox().center().x,s;e.y>r.y?s=n>i.center.x?0:1:s=n>i.center.x?1:0;let a=e.angleD(i.center),l=r.angleD(i.center);return mr.build2(i.center,a,l,i.rx,i.ry,s)}else throw new Error("not supported operation")}updateBbox(){this._bbox=new ib().ext2(this.start).ext2(this.end).build1()}is(t,e){return t===this.polyGrp&&e===this.polyIndex}confidence(t){if(this._confidence_y!=t){let e=this._bbox.height();if(e!==0)if(Math.abs(t-this._bbox.maxY)>5e-4&&Math.abs(t-this._bbox.minY)>5e-4){let r=1-Math.abs(2*t-this._bbox.maxY-this._bbox.minY)/e;this._confidence=r*1e4|0}else this._confidence=0;else this._confidence=1;this._confidence_y=t}return this._confidence}needCountWeight(){return this.outsideWeight+this.insideWeight+this.invalidWeight<5e3}revokeOutside(t){let e=this.confidence(t);return this.outsideWeight-=e,this.invalidWeight+=e,e}revokeInside(t){let e=this.confidence(t);return this.insideWeight-=e,this.invalidWeight+=e,e}setOutside(t){let e=this.confidence(t);return this.outsideWeight+=e,e}setInside(t){let e=this.confidence(t);return this.insideWeight+=e,e}setInvalid(t){let e=this.confidence(t);return this.invalidWeight+=e,e}prevNot0(){let t=this.previous;for(;t!=null&&t!=this;){if(t.weight!=0)return t;t=t.previous}return null}nextNot0(){let t=this.next;for(;t!=null&&t!=this;){if(t.weight!=0)return t;t=t.next}return null}getX(t){if(this.bo!==null)return(this._x_y!=t||isNaN(this._x))&&(Vpt(this,t)>0?this._x=it[0]:this._x=NaN,this._x_y=t),this._x;throw new Error("not supported operation")}voteStatus(){return this.outsideWeight>this.insideWeight&&this.outsideWeight>this.invalidWeight?2:this.insideWeight>this.outsideWeight&&this.insideWeight>this.invalidWeight?1:this.invalidWeight>this.outsideWeight&&this.invalidWeight>this.insideWeight?3:0}reverse(t){if(t===2)if(this.start.y>this.end.y){let e=dN.rebuild(this.shape,this.end,this.start),r=new dN(this.bo,e,this.baseWeight,this.end,this.start,this.polyGrp,this.polyIndex);return zg.addAll(r.connect,this.connect),r}else return this;else if(t===1)if(this.start.y<this.end.y){let e=dN.rebuild(this.shape,this.end,this.start),r=new dN(this.bo,e,this.baseWeight,this.end,this.start,this.polyGrp,this.polyIndex);return zg.addAll(r.connect,this.connect),r}else return this;return this}isNeedScan(t){return this.needCountWeight()&&this.confidence(t)>0}hashCode(){return this._hashcode}equals(t){return t instanceof dN?!(this.polyGrp!==t.polyGrp||this.polyIndex!==t.polyIndex):!1}bbox(){return this._bbox}toString(){return mN.format("(%d,%d,%d) (%d,%d,%d) %s %s",this.polyGrp,this.polyIndex,this.weight,this.outsideWeight,this.invalidWeight,this.insideWeight,this.start,this.end)}};function wpt(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minY+e.maxY)/2,n=(r.minY+r.maxY)/2;return i-n}function Lpt(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minX+e.maxX)/2,n=(r.minX+r.maxX)/2;return i-n}var oN=class{constructor(o){if(this.__bbox=null,typeof o<"u")if(o instanceof Array){this.__items=[];for(let t of o)this.add(t)}else this.__items=o,this.__bbox=o.bbox();else this.__items=[]}add(o){if(this.__items instanceof Array)this.__items.push(o),this.__bbox=Wg.extend2(this.__bbox,o.bbox());else throw new Error("can't insert multiple item into leaf node")}items(){return this.__items}bbox(){if(this.__bbox!==null)return this.__bbox;throw new Error("bug")}},cW=class{constructor(o){this.changed=!1,this.root=new oN,this.capacity=o,this.capacity2=o*o,this.itemList=[]}size(){return this.itemList.length}items(){return this.flushWhenNeed(),this.itemList}add(o){this.itemList.push(o),this.changed=!0}remove(o){zg.remove(this.itemList,o),this.changed=!0}clear(){this.changed=!1,this.root=new oN,this.itemList.length=0}flushWhenNeed(){if(this.changed){let o=new Array;for(let t of this.itemList)o.push(new oN(t));for(;;){let t=this.organize(o);if(t.length>1)o=t;else break}this.root=new oN(o),this.changed=!1}}organize(o){Fw(o,Lpt,0,o.length);let t=o.length,e=[];for(let r=0;r<t;)if(r+this.capacity2<=t){let i=r+this.capacity2;Fw(o,wpt,r,i);for(let n=r;n<i;n+=this.capacity){let s=new oN(o.slice(n,n+this.capacity));e.push(s)}r=r+this.capacity*this.capacity}else{let i=new oN(o.slice(r,r+this.capacity));e.push(i),r=r+this.capacity}return e}search(o){this.flushWhenNeed();let t=[],e=[];for(e.push(this.root);;){let r=e.shift();if(typeof r<"u"){let i=r.items();if(i instanceof Array){for(let n of i)if(!o.isSeparated(n.bbox())){let s=n.items();s instanceof Array?e.push(n):t.push(s)}}else o.isSeparated(r.bbox())||t.push(i)}else break}return t}walker(o){this.flushWhenNeed(),this._walker(this.root,0,o)}_walker(o,t,e){this.flushWhenNeed();let r=o.items();if(r instanceof Array)for(let i of r)this._walker(i,t+1,e);else e(r,t)}bbox(){return this.flushWhenNeed(),this.root.bbox()}};function N2e(o,t){Mpt(o.iterator(),t)}function Mpt(o,t){let e=0;for(;o.hasNext();){let r=o.next();t(e++,r)}}var SJ=new Error("list is empty"),EJ=class{constructor(o,t){this.prev=null,this.next=null,this.parent=o,this.item=t}insertAfter(o){o.next=this.next,this.next=o,o.prev=this,o.next!==null&&(o.next.prev=o)}insertBefore(o){o.prev=this.prev,this.prev=o,o.next=this,o.prev!==null&&(o.prev.next=o)}remove(){this.prev!==null&&(this.prev.next=this.next),this.next!==null&&(this.next.prev=this.prev)}set(o){this.item=o}},Npt=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o.item;throw new Error("iterator is null")}},kpt=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o;throw new Error("iterator is null")}},Nw=class{constructor(){this.first=null,this.last=null,this.cnt=0}add(o){return this.addLast(o)}push(o){return this.addLast(o)}pop(){return this.removeLast()}shift(){return this.removeFirst()}removeFirst(){let o=this.first;if(o===null)throw SJ;return this.remove(o),o.item}removeLast(){let o=this.last;if(o===null)throw SJ;return this.remove(o),o.item}addLast(o){return this.first===null||this.last===null?(this.first=new EJ(this,o),this.last=this.first,this.cnt=1,this.first):this.insertAfter(this.last,o)}addFirst(o){if(this.first===null||this.last===null){let t=new EJ(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertBefore(this.first,o)}getFirst(){if(this.first===null)throw SJ;return this.first.item}getLast(){if(this.last===null)throw SJ;return this.last.item}insertAfter(o,t){let e=new EJ(this,t);return o.insertAfter(e),o===this.last&&(this.last=e),this.cnt++,e}insertBefore(o,t){let e=new EJ(this,t);return o.insertBefore(e),o===this.first&&(this.first=e),this.cnt++,e}remove(o){o.remove(),o===this.first&&(this.first=o.next),o===this.last&&(this.last=o.prev),this.cnt--}size(){return this.cnt}clear(){this.first=null,this.last=null,this.cnt=0}iterator(){return new Npt(this.first)}listIterator(){return new kpt(this.first)}toArray(){let o=new Array(this.cnt),t=this.first,e=0;for(;t!=null;)o[e]=t.item,t=t.next,e++;return o}};function k2e(o){throw new Error("")}var OJ=class{constructor(o,t){this.node1=null,this.node2=null,this.key=o,this.value=t}},Bpt=class{constructor(o){this.itors=o}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().key}},Fpt=class{constructor(o){this.itors=o}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().value}},HJ=class{constructor(){this.innerList=new Nw,this.innerMap={}}replace(o,t){o.node1!==null&&(o.node1.set(t),t.node1=o.node1),o.node2!==null&&(o.node2.set(t),t.node2=o.node2)}clear(){this.innerList.clear();for(let o in this.innerMap)delete this.innerMap[o]}put(o,t){let e=o.hashCode(),r=new OJ(o,t),i=this.innerMap[e];if(i===void 0)return r.node1=this.innerList.add(r),this.innerMap[e]=r,null;if(i instanceof OJ){if(i.key.equals(o))return this.innerMap[e]=r,this.replace(i,r),i.value;{r.node1=this.innerList.add(r);let n=new Nw;return i.node2=n.add(i),r.node2=n.add(r),this.innerMap[e]=n,null}}if(i instanceof Nw){let n=null;return N2e(i,(s,a)=>a.key.equals(o)?(this.replace(a,r),n=a.value,!1):!0),n===null?(r.node1=this.innerList.add(r),r.node2=i.push(r),null):n}return k2e(i)}get(o){let t=o.hashCode(),e=this.innerMap[t];if(e===void 0)return null;if(e instanceof OJ)return e.key.equals(o)?e.value:null;if(e instanceof Nw){let r=null;return N2e(e,(i,n)=>n.key.equals(o)?(r=n.value,!1):!0),r}return k2e(e)}containsKey(o){return this.get(o)!==null}delete(o){o.node1!==null&&o.node1.parent.remove(o.node1),o.node2===null?delete this.innerMap[o.key.hashCode()]:o.node2.parent.remove(o.node2)}remove(o){let t=o.hashCode(),e=this.innerMap[t];if(e===void 0)return null;if(e instanceof OJ)return e.key.equals(o)?(this.delete(e),e.value):null;if(e instanceof Nw){let r=null;return N2e(e,(i,n)=>n.key.equals(o)?(r=n.value,this.delete(n),!1):!0),r}return k2e(e)}computeIfAbsent(o,t){let e=this.get(o);if(e===null){let r=t(o);return this.put(o,r),r}else return e}size(){return this.innerList.size()}isEmpty(){return this.innerList.size()===0}keys(){return new Bpt(this.innerList.iterator())}values(){return new Fpt(this.innerList.iterator())}entries(){return this.innerList.iterator()}},PN=class{constructor(){this.innerMap=new HJ}add(o){return this.innerMap.put(o,!0)!==!0}remove(o){this.innerMap.remove(o)}contains(o){return this.innerMap.get(o)===!0}iterator(){return this.innerMap.keys()}addAll(o){let t=o.iterator();for(;t.hasNext();)this.add(t.next())}size(){return this.innerMap.size()}clear(){let o=this.iterator();for(;o.hasNext();){let t=o.next();this.remove(t)}}},HMe=zg.funcCopy(Fw);function Vpt(o,t){let e=0;if(Math.abs(o.start.y-t)<=1e-4)it[e++]=o.start.x;else if(Math.abs(o.end.y-t)<=1e-4)it[e++]=o.end.x;else if(o.shape instanceof Tt)e=opt(o.shape,t);else if(o.shape instanceof mr)e=spt(o.shape,t);else throw new Error("not supported operation");return e}var LJ=class{constructor(o,t,e,r){this.sides=new Array,this.loader=o,this.loader.bo=this,this.logger=e,this.rule=t,this.event=r}static sortByBBoxMinY(o,t){return o.bbox().minY-t.bbox().minY}static sortByBBoxAreaDesc(o,t){return t.bbox().area()-o.bbox().area()}addPolyline(o,t=1,e=.01,r=!0){for(let i of this.loader.buildGroup(o,t,e,r))this.sides.push(i),this.event.onOriginSide(i)}buildRTree(){let o=new cW(10);for(let t of this.sides)o.add(t);return o}fillValidSides(o,t,e){for(let r of t)isFinite(r.getX(e))&&o.push(r)}getSortedEndpointsLineAsc(o){let t=new Array;for(let i of o)i.needCountWeight()&&(t.push(i.start),t.push(i.end));HMe(t,Yt.sortByYAsc,0,t.length);let e=new Array,r=Number.NEGATIVE_INFINITY;for(let i of t){let n=i.y;n>r&&(e.push(n),r=n)}return e}splitSides(o,t,e){let r=o.start,i=o.end,n=new Yt(i.x+(r.x-i.x)*2,i.y+(r.y-i.y)*2);HMe(o.inters,(a,l)=>a.distance2(n)-l.distance2(n),0,o.inters.length);let s=null;for(let a of o.inters)if(s==null)a.equals(r)&&(s=a);else if(!a.equals(s)){let l=TN.rebuild(o.shape,s,a);l instanceof mr&&Math.abs(l.sweepAngle)>190&&(l=new Tt(s,a));let c=new TN(this,l,o.baseWeight,s,a,o.polyGrp,e++);if(t.push(c),c.updateBbox(),a.equals(i))break;s=a}return e}splitSidesByInters(){let o=new Array;for(let t of this.sides)if(t.polyIndex==0){let e=0,r=null,i=null;do{let n=new Array;e=this.splitSides(t,n,e);for(let s of n)r!=null?(r.next=s,s.previous=r):i=s,r=s,this.event.onSplitedSide(s),o.push(s);if(t.next===null)throw new Error("not supported operation");t=t.next}while(t.polyIndex!==0);i!=null&&r!=null&&(i.previous=r,r.next=i)}this.sides.length=0;for(let t of o)this.sides.push(t)}seekIntersection(){if(this.sides.length>0){let o=this.buildRTree(),t=new PN;for(let e of this.sides){t.add(e);let r=e.bbox().extendOfSize(1e-5),i=e.shape instanceof Tt;for(let n of o.search(r))if(!t.contains(n)){let s=n.shape instanceof Tt;if(!(i&&s&&e.next!==null&&e.previous!==null&&(e.next.equals(n)||e.previous.equals(n)))){let a=WT(e.shape,n.shape);for(let l=0;l<a;l+=2){let c=new Yt(it[l],it[l+1]);e.inters.push(c),n.inters.push(c),this.event.onIntersect(c,e,n)}}}}}}},Gpt=class O4e{constructor(t){this.sides=new PN,this.others=new PN,this.id=t}add(t){this.sides.add(t),t.finalGrp=this.id;for(let e of t.connect)this.others.add(e)}polyline(){let t=new Array;return bN(this.sides,(e,r)=>(t.push(r.shape),!0)),sa.build2(t).asClose()}hashCode(){return this.id}equals(t){return t!=null&&t instanceof O4e?this.id===t.id:!1}},A4e=class{constructor(o){this.bo=null,this.sides=new Array,this.polyGrp=0,this.polyIndex=0,this.prevSide=null,this.firstSide=null,this.noWeight0=o}completeGroup(o){this.prevSide!=null&&this.firstSide!=null&&!this.prevSide.end.equals(this.firstSide.start)&&this.addSide(new Tt(this.prevSide.end,this.firstSide.start),o);let t=new Array,e=null,r=null;for(let i of this.sides)(!this.noWeight0||i.weight!==0)&&(e!=null?(e.next=i,i.previous=e):r=i,e=i,t.push(i));return e!=null&&r!=null&&(r.previous=e,e.next=r),this.polyGrp++,this.sides.length=0,this.prevSide=null,this.firstSide=null,this.polyIndex=0,t}buildGroup(o,t,e,r=!0){for(let i of o.primitives)if(i instanceof Tt)this.addSide(i,t);else if(r&&i instanceof mr&&i.rx===i.ry)this.addArc(i,t);else{let n=null;for(let s of i.points(e))n!=null&&this.addSide(new Tt(n,s),t),n=s}return this.completeGroup(t)}addArc(o,t){let e=o.sweepAngle,r=Vo.regularD(o.startAngle),i=r+e;if(e>0){let n=90;for(;n<=i;)n>r&&(this.addSide(mr.build3(o.center,r,n-r,o.rx,o.ry),t),r=n),n+=90;r<i&&this.addSide(mr.build3(o.center,r,i-r,o.rx,o.ry),t)}else if(e<0){let n=270;for(;n>=i;)n<r&&(this.addSide(mr.build3(o.center,r,n-r,o.rx,o.ry),t),r=n),n-=90;r>i&&this.addSide(mr.build3(o.center,r,i-r,o.rx,o.ry),t)}}addSide(o,t){if(o.start().equals(o.end()))return;let e=o.start(),r;this.prevSide!=null?(this.prevSide.end.equals(e)||this.addSide(new Tt(this.prevSide.end,e),t),r=new TN(this.bo,o,t,o.start(),o.end(),this.polyGrp,this.polyIndex++)):(r=new TN(this.bo,o,t,o.start(),o.end(),this.polyGrp,this.polyIndex++),this.firstSide=r),this.prevSide=r,this.sides.push(r)}},_4e=class{constructor(o,t,e){this.eps=new Array,this.curWeight=0,this.start=null,this.last=null,this.prevStart=null,this.prevEnd=null,this.y=e,this.rule=o,this.bo=t,this.event=t.event}onEp(o){this.tuningWeight(o),this.start===null?this.rule(this.curWeight)?this.in(o):o.setInvalid(this.y):this.rule(this.curWeight)?o.setInvalid(this.y):this.out(o,this.start),this.last!==null&&this.event.onSweep1(this.last,o,this.y),this.last=o}in(o){this.prevEnd!=null&&this.onSameX(o,this.prevEnd)?(this.start=this.prevStart,this.prevStart=null,this.prevEnd.revokeInside(this.y),this.prevEnd=null):(this.start=o,this.start.setOutside(this.y))}out(o,t){if(this.onSameX(t,o))t.revokeOutside(this.y);else{if(o.setInside(this.y)>0&&t.confidence(this.y)>0){let e=t.voteStatus(),r=o.voteStatus();this.isValid(e)&&this.isValid(r)?e==2&&r==1&&(o.connect.push(t),t.connect.push(o)):(o.connect.push(t),t.connect.push(o))}this.event.onSegment1(t,o,this.y),this.eps.push(t),this.eps.push(o),this.prevStart=t,this.prevEnd=o}this.start=null}isValid(o){return o==1||o==2}onSameX(o,t){return o.bbox().isIntersect(t.bbox())&&yr.eq(o.getX(this.y),t.getX(this.y))}tuningWeight(o){this.curWeight+=o.weight;let t=o.nextNot0(),e=o.prevNot0();t!=null&&o.weight===t.weight&&t.trans===this.y&&(this.curWeight-=o.weight),e!=null&&o.weight===e.weight&&e.trans===this.y&&(this.curWeight-=o.weight),o.trans=this.y}},WJ=new Error,WMe=new class extends pW{decide1(o){return o[0]&&o[1]}}(2),Upt=new class extends E4e{onPolylineGroup(o,t){throw WJ}onSegment(o,t,e,r,i,n){throw WJ}},Hpt=class{constructor(o,t){this.rtree=o,this.level=t}},Wpt=class v4e extends LJ{static isIntersect(t,e,r=$J.DUMMY){let i=new v4e(r),n=i.createGroup1(t.items),s=i.createGroup2(e.items);return n.rtree.itemList.length==0||s.rtree.itemList.length==0?!1:i.isIntersect(n,s)}constructor(t){super(new A4e(!1),WMe.rule,t,Upt)}createGroup1(t){return this.createGroup(t,0)}createGroup2(t){return this.createGroup(t,1)}createGroup(t,e){let r=WMe.weight(e);for(let n of t)this.addPolyline(n,r);let i=this.buildRTree();return this.sides.length=0,new Hpt(i,e)}isIntersect(t,e){if(t.level!==e.level){let r=t.rtree.bbox().intersection1(e.rtree.bbox());if(r!==null){try{this.inters(t,e);let i=(r.minY+r.maxY)/2;this.sweep(t,e,i)}catch(i){if(i===WJ)return!0;throw i}return!1}else return!1}else throw new Error("inersection detection should not in same group")}inters(t,e){if(t.rtree.size()>e.rtree.size()){let r=t;t=e,e=r}for(let r of t.rtree.items()){r.trans=NaN;let i=r.bbox().extendOfSize(1e-5);for(let n of e.rtree.search(i))if(n.trans=NaN,WT(r.shape,n.shape)>0)throw WJ}}sweep(t,e,r){let i=Wg.extend2(t.rtree.bbox(),e.rtree.bbox()).extendOfSize(1e-5),n=new Array;this.fillValidSides(n,t.rtree.search(i),r),this.fillValidSides(n,e.rtree.search(i),r),Fw(n,(a,l)=>a.getX(r)-l.getX(r),0,n.length);let s=new _4e(this.rule,this,r);for(let a of n)s.onEp(a)}},bbe=class tO{constructor(t){this.items=new Array(t.length),zg.arraycopy(t,0,this.items,0,t.length),this.__bbox=this.calcBBox()}static build1(t){let e=[];return kJ(t,(r,i)=>(e.push(i),!0)),new tO(e)}static build2(t){let e=t.map(r=>sa.build8(r));return new tO(e)}static combinePolylineGroupArr(t){let e=[];for(let r of t)e=e.concat(r.items);return new tO(e)}calcBBox(){let t=new ib;for(let e=0;e<this.items.length;e++)t.ext1(this.items[e].bbox());return t.build1()}multiply3(t){let e=new Array(this.items.length);for(let r=0;r<e.length;r++)e[r]=this.items[r].multiply3(t);return new tO(e)}bbox(){return this.__bbox}asClose(){return this.items.forEach(t=>t.asClose()),this}mirrorY(t){return this.items.forEach(e=>e.mirrorY(t)),this}closeEndpoint(){return this.items.forEach(t=>t.closeEndpoint()),this}get primitives(){return this.items.map(t=>t.primitives).flat(2)}isEqual(t){return t instanceof tO?this.items.every(e=>t.items.some(r=>r.isEqual(e))):!1}getOutMostPolyline(){return this.items.reduce((t,e)=>e.bbox().area()>t.bbox().area()?e:t,this.items[0])}getOutline(){let t=this.items;if(t.length===1)return{outline:t,hole:new Array};let e=new Set,r=new Set;for(let i=0,n=t.length;i<n;i++){let s=t[i];if(!e.has(s)&&!r.has(s)){i+1>=n&&e.add(s);for(let a=i+1;a<n;a++){let l=t[a];if(!e.has(l)&&!r.has(l)){if(!s.bbox().isInside(l.bbox().extendOfSize(1e-4))&&!l.bbox().isInside(s.bbox().extendOfSize(1e-4)))continue;Wpt.isIntersect(new tO([s]),new tO([l]))&&(s.bbox().area()>l.bbox().area()?(e.add(s),r.add(l)):(e.add(l),r.add(s)))}}!e.has(s)&&!r.has(s)&&e.add(s)}}return{outline:[...e],hole:[...r]}}round(t=4){let e=this.items.map(r=>r.round(t));return new tO(e)}},zpt=zg.funcCopy(Fw),Ypt=zg.funcCopy(Fw),jpt=zg.funcCopy(Fw);function Xpt(o){return new Array}function qpt(o,t){let e=new sW(!1),r=new aW(o,$J.DUMMY,e);for(let i of t)r.addPolyline(i);return r.simplify(),e.plGrps}var aW=class extends LJ{constructor(o,t,e){super(new A4e(!1),o,t,e),this.finalSides=new Array,this.sideGroups={},this.vecSides=new Array,this.scanY=NaN,this.curNetIndex=0,this.curIndex=-1,this.scanLines=0}sweep(o,t,e){this.scanY=NaN,this.scanLines=0,zpt(t,LJ.sortByBBoxMinY,0,t.length);let r=new Nw;this.curNetIndex=0;let i=Number.POSITIVE_INFINITY;for(let n of o)n>i&&this.scan(r,(i+n)/2,t),i=n;this.getAllMarkPrimitive(e,t),this.logger.debug3("scan %s %d",e,this.scanLines)}simplify(){this.seekIntersection(),this.splitSidesByInters(),this.sweep(this.getSortedEndpointsLineAsc(this.sides),this.sides,!1),this.flipSides(),this.sweep(this.getSortedEndpointsLineAsc(this.vecSides),this.vecSides,!0),this.connectSides(),this.fillResult()}addPolyline(o,t=1,e=.01,r=!0){super.addPolyline(o,t,e,r)}scan(o,t,e){if(this.scanY==t)return;this.scanY=t;let r=!1,i=o.listIterator();for(;i.hasNext();){let n=i.next(),s=n.item;yr.less(s.bbox().maxY,t)?o.remove(n):!r&&s.isNeedScan(t)&&(r=!0)}for(;this.curNetIndex<e.length;){let n=e[this.curNetIndex];if(yr.less(n.bbox().minY,t))yr.greatereq(n.bbox().maxY,t)&&(this.add2AET(o,n),!r&&n.isNeedScan(t)&&(r=!0)),this.curNetIndex++;else break}if(r){this.scanLines++;let n=new _4e(this.rule,this,t),s=o.iterator();for(;s.hasNext();){let a=s.next();n.onEp(a)}}}add2AET(o,t){let e=t.bbox().minX,r=t.bbox().maxX,i=t.bbox().minY,n=t.bbox().maxY,s=o.listIterator(),a=null;for(;s.hasNext();){let l,c=s.next(),h=c.item,u=h.bbox().minX,d=h.bbox().maxX;if(r<=u)l=-1;else if(d<=e)l=1;else{let m=h.bbox().minY,g=h.bbox().maxY,y=Math.max(i,m),b=Math.min(n,g);l=this.compareBySweep(t,h,(y+b)/2)}let p=h.shape;if(p instanceof Tt&&p.length()<.001&&a==null&&l<0){a=c;continue}if(a!=null&&l<0){o.insertBefore(a,t);return}if(l<0){o.insertBefore(c,t);return}else a=null}o.add(t)}getLineAngle(o){let t=o.start().angle(o.end());return t<0&&(t+=Math.PI),t}getArcAngle(o,t){let e=Math.asin((t-o.center.y)/o.rx);return o.startAngle>90&&o.startAngle<270&&(e=-e),e<0&&(e+=Math.PI),(e+Math.PI/2)%Math.PI}compareArcLine(o,t,e){let r=this.getArcAngle(o,e),i=this.getLineAngle(t);return yr.eq(r,i)?-o.sweepAngle:i-r}compareBySweep(o,t,e){let r=o.getX(e);if(!isFinite(r))return 0;let i=t.getX(e);if(!isFinite(i))return 0;if(!yr.eq(r,i))return r-i;if(o.shape instanceof Tt)return t.shape instanceof Tt?this.getLineAngle(t.shape)-this.getLineAngle(o.shape):-this.compareArcLine(t.shape,o.shape,e);if(t.shape instanceof Tt)return this.compareArcLine(o.shape,t.shape,e);{let n=o.shape,s=t.shape,a=this.getArcAngle(n,e),l=this.getArcAngle(s,e);return yr.eq(a,l)?n.sweepAngle*s.sweepAngle<=0?n.sweepAngle<=0?1:-1:n.sweepAngle>0?n.rx-s.rx:s.rx-n.rx:l-a}}getAllMarkPrimitive(o,t){for(let e of t)if(e.status===0&&e.bbox().height()!=0){let r=e.voteStatus();if(r===2||r===1){e.status=r;let i=e.reverse(r);if(o){this.event.onResultSide(i);let n=i.shape.multiply3(zp.ROT_N90),s=i.start.multiply3(zp.ROT_N90),a=i.end.multiply3(zp.ROT_N90);i=new TN(this,n,i.baseWeight,s,a,i.polyGrp,i.polyIndex)}this.finalSides.push(i),this.event.onResultSide(i)}}}flipSides(){for(let o of this.sides)if(o.polyIndex==0){let t=null,e=null;do{let r=o.shape.multiply3(zp.ROT_90),i=o.start.multiply3(zp.ROT_90),n=o.end.multiply3(zp.ROT_90),s=new TN(this,r,o.baseWeight,i,n,o.polyGrp,o.polyIndex);if(s.outsideWeight=o.outsideWeight,s.insideWeight=o.insideWeight,s.invalidWeight=o.invalidWeight,s.status=o.status,t!=null?(t.next=s,s.previous=t):e=s,this.vecSides.push(s),this.event.onSplitedSide(s),t=s,o.next!==null)o=o.next;else break}while(o.polyIndex!=0);e!=null&&(e.previous=t,t.next=e)}}canBeEnd(o,t){if(o.size()==1){let e=o.getFirst().shape;if(e instanceof mr){if(t&&e.rx<=t)return!1}else if(e instanceof Tt&&t&&e.length()<=t)return!1}return!0}connectSides(){let o=new HJ,t=new cW(10);for(let n of this.finalSides)o.computeIfAbsent(n.start,Xpt).push(n),t.add(n.start);let e=0,r=new PN,i=new Array;for(let n of this.finalSides)if(!r.contains(n)){let s=new PN,a=n.start,l=new Nw;l.add(n),r.add(n);let c=n.end;for(;l.size()>0;)if(this.isStart(a,c)&&this.canBeEnd(l,.01)){l.size()>1&&this.fillSideGroups(l,e++);break}else{let h=o.get(c),u=this.findNext(r,h);if(u==null&&(c=this.findNeigber(c,s,t,.01),c!==null&&(h=o.get(c),u=this.findNext(r,h))),u!=null)l.add(u),r.add(u),c=u.end;else if(c!=null?s.add(c):(i.length==0&&l.size()>1&&this.logger.warning3("unable to connect at %s",l.getLast()),i.push(l.removeLast())),l.size()>0)c=l.getLast().end;else break}}}fillSideGroups(o,t){let e=new Gpt(t);bN(o,(r,i)=>(e.add(i),!0)),this.sideGroups[e.id]=e}isStart(o,t){return o.distance2(t)<=1e-4}findNext(o,t){if(t!=null){for(let e of t)if(!o.contains(e))return e}return null}fillResult(){let o=0,t=new HJ;for(let r in this.sideGroups){let i=this.sideGroups[r];bN(i.sides,(n,s)=>(s.polyGrp!=-2&&t.put(s,s),!0))}let e=new PN;for(let r in this.sideGroups){let i=this.sideGroups[r];if(e.add(i)){let n=0,s=new Array;for(s.push(i);n<s.length;){let l=s[n],c=new Array;bN(l.others,(u,d)=>{let p=t.get(d);return p!=null&&c.push(p.finalGrp),!0}),Ypt(c,zg.sortAsc,0,c.length);let h=l.id;for(let u of c)if(u!=h&&u!=l.id){let d=this.sideGroups[u];e.add(d)&&s.push(d),h=u}n++}let a=new Array;for(let l of s)a.push(l.polyline());jpt(a,LJ.sortByBBoxAreaDesc,0,a.length),this.event.onPolylineGroup(new bbe(a),o++)}}}findNeigber(o,t,e,r){let i=r*r,n=Number.MAX_VALUE,s=null;for(let a of e.search(o.bbox().extendOfSize(r)))if(!t.contains(a)){let l=o.distance2(a);l<n&&(n=l,s=a)}return n<i?s:null}},$pt=class{constructor(){this.points=[],this.lines=[],this.arcs=[],this.beziers=[],this.listText=[],this.fonts=[]}addPt(o,t=!0){if(o instanceof Tt)this.lines.push(o);else if(o instanceof mr)this.arcs.push(o);else if(o instanceof Yi)this.beziers.push(o);else throw new Error("not support");t&&this.points.push(o.start())}addPoint(o){this.points.push(o)}addText(o,t,e=1,r=.1,i=!0){this.listText.push({pos:o,str:t,size:e,width:r}),i&&this.points.push(o)}addPly(o,t=!0){o.primitives.forEach(e=>this.addPt(e,t))}build(){let o=[],t=[],e=[],r=[],i=[],n=[];return this.points.forEach(s=>o.push(s.x,s.y)),this.lines.forEach(s=>t.push(s.start().x,s.start().y,s.end().x,s.end().y)),this.arcs.forEach(s=>e.push(s.center.x,s.center.y,s.rx,Vo.toRadians(s.startAngle),Vo.toRadians(s.endAngle()),s.sweep())),this.beziers.forEach(s=>{s.controls.forEach(a=>{r.push(a.x,a.y)}),r.push("end")}),this.listText.forEach(s=>i.push(s.pos.x,s.pos.y,s.str,s.width,s.size)),this.fonts.forEach(s=>n.push(s)),{points:o,lines:t,arcs:e,texts:i,beziers:r,fonts:n}}},qH,fW=(qH=class{constructor(o){this.map=new HJ,this.bus=o}initColor(o){return this.map.computeIfAbsent(o,()=>new $pt)}draw(){let o={},t=this.map.entries();for(;t.hasNext();){let e=t.next();o[e.key.toString()]=e.value.build()}this.bus.publish("/debug/draw",o)}clear(){this.map.clear()}static init(o){if(!o)throw new Error("bus is undefined!");this.palette=new qH(o)}static initPalette(o){this.palette=o}static getDefaultColor(){for(let o of this.colorBuffersMap)if(o[0]!==null&&o[0])return o[0]=!1,o[1];return this.colorBuffersMap.forEach(o=>{if(o[0]===null){console.log(1);return}o[0]=!0}),this.getDefaultColor()}static clear(){this.palette.clear()}static auto(o,t=this.getDefaultColor()){if(Array.isArray(o))o.forEach(e=>{this.auto(e,t)});else if(o instanceof Yt)this.point(o,t);else if(o instanceof Wg)this.bbox(o,t);else if(o instanceof dW)this.primitive(o,t);else if(o instanceof sa)this.polyline(o,t);else if(o instanceof p0)this.polygon(o,t);else if(o instanceof Fd)this.group(o,t);else if(o instanceof bbe)this.auto(o.items,t);else{debugger;throw new Error("No incoming type!")}}static text(o,t,e=.5,r=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");this.palette.initColor(r).addText(o,t,e,e/10),this.palette.draw()}static point(o,t=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");let e=this.palette.initColor(t);Array.isArray(o)?o.forEach(r=>{this.point(r,t)}):e.addPoint(o),this.palette.draw()}static bbox(o,t=this.getDefaultColor()){Array.isArray(o)?o.forEach(e=>{this.bbox(e,t)}):(this.primitive(new Tt(new Yt(o.maxX,o.maxY),new Yt(o.maxX,o.minY)),t),this.primitive(new Tt(new Yt(o.maxX,o.maxY),new Yt(o.minX,o.maxY)),t),this.primitive(new Tt(new Yt(o.minX,o.minY),new Yt(o.maxX,o.minY)),t),this.primitive(new Tt(new Yt(o.minX,o.minY),new Yt(o.minX,o.maxY)),t))}static primitive(o,t=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");let e=this.palette.initColor(t);Array.isArray(o)?o.forEach(r=>{this.primitive(r,t)}):e.addPt(o),this.palette.draw()}static polyline(o,t=this.getDefaultColor()){Array.isArray(o)?o.forEach(e=>{this.polyline(e,t)}):o.primitives.forEach(e=>{this.primitive(e,t)})}static polygon(o,t=this.getDefaultColor()){Array.isArray(o)?o.forEach(e=>{this.polygon(e,t)}):o.items.forEach(e=>{this.polyline(e,t)})}static group(o,t=this.getDefaultColor()){Array.isArray(o)?o.forEach(e=>{this.group(e,t)}):o.items.forEach(e=>{this.polygon(e,t)})}static async begin(){this.t1=performance.now()}static async end(o){console.log(o||"t1:",performance.now()-this.t1)}static async log(o){console.log(o||"==================")}},qH.colorBuffersMap=[[!0,Ol.BLUE],[!0,Ol.GREEN],[!0,Ol.WHITE],[!0,Ol.RED],[!0,Ol.Golden],[!0,Ol.Gray]],qH.t1=0,qH),Kpt=0,mW=class tbe{constructor(t,e){this.inters=[],this.shape=t,this.start=t.start(),this.end=t.end(),this.judgeOverlapMap=new Map,e&&(this.id=Kpt++)}reverse(){this.shape=this.shape.reverse();let t=this.start;this.start=this.end,this.end=t}getCenterPoint(t=this.end){let{x:e,y:r}=this.start,{x:i,y:n}=t;if(this.shape instanceof mr){let s=this.shape.rx,a=new Yt((e+i)/2,(r+n)/2),l=this.shape.center,c;return a.x!==l.x||a.y!==l.y?(c=a.angle(l),Math.abs(this.shape.sweepAngle)>180&&(c+=c>=0?-180:180)):c=(this.shape.startAngle+this.shape.endAngle())/2,new Yt(l.x+Math.cos(c)*s,l.y+Math.sin(c)*s)}else{if(this.shape instanceof Tt)return new Yt((e+i)/2,(r+n)/2);if(this.shape instanceof Yi){let s=this.shape.getPercent(t,Qn);return Yi.pointOn(s/2,this.shape.controls)}else throw Error("not support")}}static finalAngle(t,e,r){let i=t.cross(e)>0,n=Math.acos(Math.min(1,Math.max(-1,t.dot(e)/e.length())));return(r?!i:i)&&(n=KJ-n),n}sortInters(){if(this.shape instanceof mr){let t=this.shape.center,e=this.shape.start().sub(t).normalize(),r=this.shape.isCCW;this.inters.sort((i,n)=>{let s=i.coord.sub(t),a=n.coord.sub(t);return tbe.finalAngle(e,s,r)-tbe.finalAngle(e,a,r)<=0?-1:1})}else if(this.shape instanceof Tt){let t=this.start,e=this.end,r=new Yt(e.x+(t.x-e.x)*2,e.y+(t.y-e.y)*2);this.inters.sort((i,n)=>i.coord.distance2(r)-n.coord.distance2(r)<=0?-1:1)}else if(this.shape instanceof Yi){let t=this.shape;this.inters.sort((e,r)=>t.getPercent(e.coord,Qn)-t.getPercent(r.coord,Qn)<=0?-1:1)}else throw Error("not support the primitive type");this.inters.forEach((t,e)=>t.setIndex(e))}getStart(){return this.start}getEnd(){return this.end}getShape(){return this.shape}connect(t){this.nextSide=t,t.prevSide=this}static returnPolygonList(t){let e=[];return t.forEach(r=>{let i=[];r.forEach((n,s)=>{let a=[];n.forEach(l=>{a.push(l.shape)}),i.push(sa.build7(a))}),e.push(new p0(i))}),e}addInter(t){this.inters.push(t)}static returnPolygonGroup(t){let e=[];return t.forEach(r=>{let i=[];r.forEach((n,s)=>{let a=[];n.forEach(l=>{a.push(l.shape)}),i.push(sa.build7(a))}),e.push(new p0(i))}),new Fd(e)}static rebuild(t,e,r){let i;if(t instanceof Tt||e.distance2(r)<1e-6)i=new Tt(e,r);else if(t instanceof mr)i=mr.build2(t.center,e.angleD(t.center),r.angleD(t.center),t.rx,t.ry,t.isCCW?1:0);else if(t instanceof Yi){let n=t.getPercent(e,Qn),s=t.clip(n)[1];i=s.clip(s.getPercent(r,Qn))[0]}else throw new Error("not supported operation");return Jn(t,e).dot(Jn(i,e))<0?null:i}static returnPolyline(t){return sa.build7(t.map(e=>e.shape))}bbox(){return this.shape.bbox()}},Zpt=(o=>(o[o.END1=0]="END1",o[o.END2=1]="END2",o[o.END12=2]="END12",o[o.LEFT1=3]="LEFT1",o[o.LEFT2=4]="LEFT2",o))(Zpt||{});function Yg(o,t,e){if(o instanceof mr&&t instanceof mr)return e0t(o,t);if(o instanceof mr&&t instanceof Tt)return jMe(o,t);if(o instanceof Tt&&t instanceof mr)return YMe(o,t);if(o instanceof Tt&&t instanceof Tt)return Bw(o,t);if(o instanceof Yi&&t instanceof Tt)return o.controls.length===2||oO(o)?Bw(new Tt(o.start(),o.end()),t):x4e(o,t);if(o instanceof Tt&&t instanceof Yi)return t.controls.length===2||oO(t)?Bw(o,new Tt(t.start(),t.end())):rbe(o,t);if(o instanceof mr&&t instanceof Yi)return t.controls.length===2||oO(t)?jMe(o,new Tt(t.start(),t.end())):Jpt(o,t);if(o instanceof Yi&&t instanceof mr)return o.controls.length===2||oO(o)?YMe(new Tt(o.start(),o.end()),t):Qpt(o,t);if(o instanceof Yi&&t instanceof Yi)return Pbe(o,t);throw new Error("not support")}function sN(o,t){return Jn(o,t.start()).dot(Jn(t,t.start()))<=0?!1:Yg(o,t).state<=2}function B2e(o,t){let e=t.getPercent(o.end(),Qn);if(e===null)return!1;if(e===0)return!0;let r=t.clip(e)[0],i=o.buildConverxHull(Qn),n=r.buildConverxHull(Qn),s=c(i),a=c(n);return l(s,a);function l(h,u){let d=new Map([[0,1],[1,0],[2,2],[3,4],[4,3]]),p=h[0],m=u[0];if(!p||!m)throw Error("isAllOverlap(sides1: PackSide[], sides2: PackSide[])");let g=!0;do{let y=p.getShape(),b=m.getShape();if(y instanceof Tt&&b instanceof Tt){let P=g?Bw(y,b).state:d.get(Bw(b,y).state);if(P===0)p=p.nextSide,g=!1;else if(P===1)m=m.nextSide,g=!0;else if(P===2)p=p.nextSide,m=m.nextSide,g=!0;else return!1}else throw Error("not support")}while(p!==h[0].prevSide&&m!==u[0].prevSide);return!0}function c(h){let u=h.primitives.map(p=>new mW(p)),d=u[u.length-1];return u.forEach(p=>{d.connect(p),d=p}),u}}function zMe(o,t){let e=o.end().distance2(t.center);if(e>(t.rx+Qn)**2||e<(t.rx-Qn)**2||!(_n(o.end(),t.end())||Tbe(t,o.end())))return!1;if(o.center.equals1(t.center))return!0;let r=o.center.distance1(t.center),i=Math.abs(o.rx-t.rx);if(r>Math.min(o.rx,t.rx)){let n=o.center.angleD(t.center);return o.rx>t.rx?!(r+i>Qn&&S9(o,n))&&!(r-i>Qn&&o.rx+t.rx-r>Qn&&S9(o,n+180)):!(r-i>Qn&&S9(o,n))&&!(o.rx+t.rx-r>Qn&&S9(o,n+180))}else{if(r+i<=Qn)return!0;let n=o.rx>t.rx?o.center.angleD(t.center):t.center.angleD(o.center);return S9(o,n)?!1:r-i<=Qn?!0:!S9(o,n+180)}}function Jpt(o,t){let e=Ibe(o,t.start()).toBezier2(),r,i=0;for(let n=e.length;i<n;i++){let s=e[i];if(r=Pbe(s,t).state,r!==0)break}return r===2&&i!==e.length-1?{state:1}:{state:r}}function Qpt(o,t){let e=t.toBezier2(),r,i=0;for(let n=e.length;i<n;i++){let s=e[i];if(r=Pbe(o,s).state,r!==1)break}return r===2&&i!==e.length-1?{state:0}:{state:r}}function Pbe(o,t){if(o.controls.length===2||oO(o))return t.controls.length===2||oO(t)?Bw(new Tt(o.start(),t.end()),new Tt(t.start(),t.end())):rbe(new Tt(t.start(),o.end()),t);if(t.controls.length===2||oO(t))return x4e(ibe(o,t.start()),new Tt(t.start(),t.end()));let e=ibe(o,t.start());if(oO(e))return rbe(new Tt(t.start(),o.end()),t);let r=B2e(e,t),i=B2e(t,e);if(!r&&!i){let n=mpt(e,t);if(n.havOverlap){let s=n.havOverlap!==2,a=n.havOverlap!==1;return sO(o,t,s,a)}else{let s=function(){for(let u=0;u<c;u+=2)it[u]=h[u],it[u+1]=h[u+1]},a,l,c=n.cnt,h=new Array(c).fill(0).map((u,d)=>it[d]);for(let u=0;u<c;u+=2){let d=new Yt(it[u],it[u+1]),p=e.getPercent(d,Qn),m=t.getPercent(d,Qn);if(p===0||m===0)continue;let g=p===1?e:e.clip(p)[0],y=m===1?t:t.clip(m)[0];if(B2e(g,y)){let b=Jn(o,d).cross(Jn(t,d));if(b===0){a=e.end(),l=t.end();break}return{state:b<0?3:4}}s()}return(!a||!l)&&(a=gN(e.controls,e.controls[0],t),l=gN(t.controls,e.controls[0],e)),{state:a.sub(e.controls[0]).cross(l.sub(e.controls[0]))>0?4:3}}}return sO(o,t,r,i)}function x4e(o,t){let e=ibe(o,t.start());if(oO(e))return Bw(new Tt(e.start(),e.end()),t);let r=D4e(e,t),{isIn:i,bezierIsInLeft:n}=R4e(t,e);if(!r&&!i){if(n!==void 0)return{state:n?3:4};let s=null,a=o.getPercent(t.start(),Qn)+.01;for(let l=a>1?1:a;l<=1;){let c=Yi.pointOn(l,o.controls);if(hW(t,c)>jg){s=c;break}l+=.01,l>1&&(l=1)}if(!s)throw Error("!end1 && !end2 not result");return{state:t.direct.cross(s.sub(t.start()))<0?4:3}}return sO(e,t,r,i)}function rbe(o,t){let{isIn:e,bezierIsInLeft:r}=R4e(o,t),i=D4e(t,o);if(!e&&!i){if(r!==void 0)return{state:r?4:3};let n=null;for(let s=.01;s<=1;){let a=Yi.pointOn(s,t.controls);if(hW(o,a)>jg){n=a;break}s+=.01,s>1&&(s=1)}if(!n)throw Error("!end1 && !end2 not result");return{state:o.direct.cross(n.sub(o.start()))<0?3:4}}return sO(t,o,e,i)}function e0t(o,t){let e=zMe(Ibe(o,t.start()),t),r=zMe(t,o);if(!e&&!r){let i=UC(t);if(o.center.sub(t.start()).dot(t.center.sub(t.start()))>0){if(o.rx===t.rx)return o.isCCW?{state:i.dot(o.center.sub(t.center))<0?3:4,exitIsInvalid:!1}:{state:i.dot(o.center.sub(t.center))>0?3:4,exitIsInvalid:!1};let n,s;return o.rx>t.rx?(n=o,s=t):(n=t,s=o),i.dot(s.center.sub(n.center))>0&&s.rx+s.center.distance1(n.center)-n.rx>Qn?o.isCCW?{state:o.rx>t.rx?3:4,exitIsInvalid:!1}:{state:o.rx<t.rx?3:4,exitIsInvalid:!1}:o.isCCW?{state:o.rx<t.rx?3:4,exitIsInvalid:!0}:{state:o.rx>t.rx?3:4,exitIsInvalid:!0}}else return o.rx+t.rx-o.center.distance1(t.center)>Qn&&i.dot(o.center.sub(t.center))>0?{state:t.isCCW?3:4,exitIsInvalid:!1}:{state:o.isCCW?3:4,exitIsInvalid:!0}}return sO(o,t,e,r)}function YMe(o,t){let e=GC.foot(o,t.center),r=o.end().distance2(t.center),i=o.end().sub(o.start()),n=(t.rx-Qn)**2,s=r<=(t.rx+Qn)**2&&r>=n&&(i.dot(e.sub(t.start()))<=0||o.start().distance2(o.end())<=o.start().distance2(e)||e.distance2(t.center)>=n)&&(_n(o.end(),t.end())||Tbe(t,o.end())),a=w4e(t,o);if(!s&&!a){let l=o.distance2(t.center);return l<=jg?{state:i.cross(UC(t))>0?4:3}:i.dot(e.sub(t.start()))>=0&&(r<n||o.start().distance2(t.center)<n||l<n)?{state:i.cross(t.center.sub(o.start()))<0?4:3}:{state:i.cross(t.center.sub(o.start()))>0?4:3}}return sO(t,o,s,a)}function S9(o,t){return t=Vo.regularD(t),o.sweepAngle>0?(t<o.startAngle&&(t+=360),o.endAngle()>t):(t>o.startAngle&&(t-=360),o.endAngle()<t)}function Tbe(o,t){return _n(o.end(),t)||_n(o.start(),t)||S9(o,t.angleD(o.center))}function R4e(o,t){let e=o.panDistance(Qn),r=o.panDistance(-Qn),i=XMe(t,e),n=XMe(t,r);if(!i.length&&!n.length)return{isIn:t.getPercent(o.end(),Qn)!==null};let s=[...i,...n].sort((h,u)=>h.t-u.t),a=new Tt(r.start(),e.start()),l=[];for(let h=0,u=s.length;h<u;h++){let d=s[h];if(l.push(d),a.distance(d.interP)>o.length()+Qn)break;if(l.length===2){let p=(l[1].t*10+l.shift().t*10)/20,m=Yi.pointOn(p,t.controls);if(o.distance2(m)>jg)return{isIn:!1,bezierIsInLeft:o.direct.cross(m.sub(o.start()))>0}}}let c=l.length?a.distance(l[0].interP)>=o.length()+Qn:!0;return{isIn:c,bezierIsInLeft:c?void 0:o.direct.cross(l[0].interP.sub(o.start()))>0}}function D4e(o,t){if(hW(t,o.end())>jg||o.getToLineMaxDis2(t)>jg)return!1;let e=r0t(t,jg);return o.getToLineMaxDis2(e)<=(t.length()+Qn)**2}function w4e(o,t){let e=t.end().angleD(t.start()),r=t0t(t,o.end());if(r>jg)return!1;if(S9(o,e+90)){if(GC.foot(t,o.center).distance1(o.pointOn(e+90))>o.rx)return!1;r=Math.max(r,(o.rx-t.distance(o.center))**2)}if(S9(o,e-90)){if(GC.foot(t,o.center).distance1(o.pointOn(e-90))>o.rx)return!1;r=Math.max(r,(o.rx-t.distance(o.center))**2)}return r<=jg&&(_n(o.end(),t.end())||nbe(t,o.end()))}var L4e=(Qn*2)**2;function Ibe(o,t){if(_n(o.end(),t))return mr.build3(o.center,o.endAngle(),0,o.rx,o.ry);if(o.start().distance2(t)<L4e)return o;let e=Vo.regularD(t.angleD(o.center));if(!S9(o,e))throw new Error("!angleIsInArc(arc, angle)");return mr.build2(o.center,e,o.endAngle(),o.rx,o.ry,o.isCCW?1:0)}function ibe(o,t){if(_n(o.end(),t))return new Yi([t,t]);if(o.start().distance2(t)<L4e)return o;let e=o.getPercent(t,Qn);if(e===null)throw new Error("!cutBezier(bezier: Bezier, p: Vector2)");return o.clip(e)[1]}function jMe(o,t){let e=w4e(Ibe(o,t.start()),t),r=t.end().distance2(o.center),i=t.end().sub(t.start()),n=GC.foot(t,o.center),s=(o.rx-Qn)**2,a=r<=(o.rx+Qn)**2&&r>=s&&(i.dot(n.sub(t.start()))<=0||t.start().distance2(t.end())<=t.start().distance2(n)||n.distance2(o.center)>=s)&&(_n(o.end(),t.end())||Tbe(o,t.end()));if(!e&&!a){let l=t.distance2(o.center);return l<=jg?{state:i.cross(UC(o,t.start().angle(o.center)))>0?3:4}:i.dot(n.sub(t.start()))>=0&&(r<s||t.start().distance2(o.center)<s||l<s)?{state:i.cross(o.center.sub(t.start()))>0?4:3}:{state:i.cross(o.center.sub(t.start()))<0?4:3}}return sO(t,o,e,a)}function Bw(o,t){if(_n(o.end(),t.end()))return sO(o,t,!0,!0);let e=hW(t,o.end())<=jg&&nbe(t,o.end()),r=hW(o,t.end())<=jg&&nbe(o,t.end());if(!e&&!r){let i=o.direct.x===0&&o.direct.y===0,n=t.direct.x===0&&t.direct.y===0;if(i&&n)throw Error("2LineAllIsPoint");return i?{state:t.direct.cross(o.end().sub(t.start()))>0?3:4}:{state:o.end().sub(o.start()).cross(t.end().sub(o.start()))>0?4:3}}return sO(o,t,e,r)}function nbe(o,t){return GC.foot(o,t).distance2(o.start())<o.end().distance2(o.start())}function sO(o,t,e,r){if(e)return r?_n(o.end(),t.end())?{state:2}:{state:0}:{state:0};if(r)return{state:1};throw new Error("!end1 && !end2")}function hW(o,t){return(o.a*t.x+o.b*t.y+o.c)**2/(o.a**2+o.b**2)}function t0t(o,t){return Math.min(o.distance2(t),GC.foot(o,t).distance2(t))}function r0t(o,t){let e=o.panDistance(t),r=o.panDistance(-t);return new Tt(r.start(),e.start())}function oO(o){let t=o.start(),e=o.end();t.equals1(e)&&(e=t.add1(1,0));let r=e.y-t.y,i=t.x-e.x,n=-r*t.x-i*t.y,s=Math.sqrt(1/(r**2+i**2));r*=s,i*=s,n*=s;let a=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;return o.controls.forEach(c=>{let h=r*c.x+i*c.y+n;h<a&&(a=h),h>l&&(l=h)}),_9(a,l)}function XMe(o,t){let e=WT(o,t),r=[],i=new Array(e).fill(0).map((s,a)=>it[a]);for(let s=0;s<e;s+=2){let a=new Yt(it[s],it[s+1]),l=o.getPercent(a);r.push({interP:a,t:l}),n()}function n(){for(let s=0;s<e;s+=2)it[s]=i[s],it[s+1]=i[s+1]}return r}var C9=.01,i0t=270;function ev(o){let t=C9**2,e=o.end(),r=[],i=[];for(let p=0,m=o.primitives.length;p<m;p++){let g=function(v,D){return v instanceof Tt&&D instanceof Tt&&Math.abs(v.direct.cross(D.direct))<yr.eps&&v.direct.dot(D.direct)>0||v instanceof mr&&D instanceof mr&&Math.abs(v.rx-D.rx)<=yr.eps&&v.center.distance2(D.center)<yr.eps&&v.isCCW===D.isCCW},y=function(v){if(bP(v,C9))i.push(null);else{if(v instanceof Tt)i.push(v);else if(v instanceof mr&&v.rx===v.ry)u(v,i);else if(v instanceof Yi){let D=[];I4e(v,D),D.forEach(w=>{let F=w.start(),H=w.end();h(F,H)||i.push(w)})}else throw new Error("not support!");e=I}},b=function(v){if(v instanceof Tt)return v.direct.x===0&&v.direct.y===0;if(v instanceof mr)return v.sweepAngle===0;if(v instanceof Yi){let D=new Set(v.controls.map(F=>F.x)),w=new Set(v.controls.map(F=>F.y));return D.size===1&&w.size===1}else throw new Error("not support")},P=o.primitives[p],T=P.start(),I=P.end();if(b(P))continue;h(e,T)||(i.push(new Tt(e,T)),e=T);let C=(p+1)%m,E=o.primitives[C];for(;g(P,E)&&(C=(C+1)%m,E=o.primitives[C],E!==P););if(C===(p+1)%m){y(P);continue}if(E===P){if(!(P instanceof mr)){if(Math.abs(o.area(.1))<t)return null;throw new Error("simplifyPolyline not support")}let v=P instanceof mr?P.isCCW:o.area(.1)>0;i.length=0;let D=v?180:-180;i.push(mr.build3(P.center,P.startAngle,D,P.rx,P.ry),mr.build3(P.center,P.startAngle+D,D,P.rx,P.ry));break}let O=(()=>{if(P instanceof Tt)return(v,D)=>{let w=new Tt(v,D);return bP(w,C9)?null:[w]};if(P instanceof mr)return(v,D)=>{let w;if(v.equals1(D)?w=mr.build3(P.center,P.startAngle,P.sweep()===1?360:-360,P.rx,P.ry):w=mr.build4(v,D,P.center,P.rx,P.ry,P.sweep()),bP(w,C9))return null;let F=w.pointOn(w.startAngle+w.sweepAngle/2),H=mr.build4(w.start(),F,P.center,P.rx,P.ry,P.sweep()),z=mr.build4(F,w.end(),P.center,P.rx,P.ry,P.sweep());return bP(H,C9)||bP(z,C9)?[w]:[H,z]};throw new Error("not support")})(),_=C===0;if(C<p&&!_&&(_=!O(o.primitives[0].start(),o.primitives[C-1].end()),!_)){let v=O(P.start(),o.primitives[m-1].end());if(v)i.push(...v);else{let D=O(P.start(),i[0].end());if(D.length===1)i[0]=D[0];else if(D.length===2)i[0]=D[1],i.push(D[0]);else throw new Error("!!!generatorPt")}break}p=C===0?m-1:C-1,E=o.primitives[p];let x=O(P.start(),E.end());if(x?(x.forEach(v=>i.push(v)),e=E.end()):y(null),_)break}let n=i.length;if(i.forEach((p,m)=>{if(p)r.push(p);else{let g,y;m===n-1&&(g=r[0],y=r[r.length-1]);let b=(m+1)%n;if(g=g!=null?g:i[b],g){let P=m,T=!1;for(;y=y!=null?y:i[(--P+n)%n],y!==g;)if(y){T=!0;break}if(T){if(g.start().equals1(y.end()))return;if(Jn(y,y.end()).dot(Jn(g,g.start()))<0){if(!h(y.end(),g.start())){let O=new Tt(y.end(),g.start());r.push(O);return}let{rebuildPrevPt:I,rebuildNextPt:C,rebuildLinkLine:E}=qMe(i[(P-1+n)%n],y,new Tt(y.end(),g.start()),g,i[(m+2)%n]);I&&C&&(I!==y?(i[(P+n)%n]=I,r[r.length-1]&&(r[r.length-1]=I)):C!==g&&(i[(m+1)%n]=C,r[0]===g&&(r[0]=C)),E&&r.push(E))}}}}}),r.length===0)return null;h(e,r[0].start())||r.push(new Tt(e,r[0].start()));let s=r[r.length-1];if(r.length===1)return s instanceof mr?sa.build7([mr.build2(s.center,0,180,s.rx,s.ry,s.sweep()),mr.build2(s.center,180,360,s.rx,s.ry,s.sweep())]):s instanceof Yi?sa.build7(s.clip(.5)):null;let a=r.map(p=>new n0t(p)),l=a[a.length-1];for(a.forEach(p=>{p.connect(l),l=p});!l.isVisited;){let p=function(){l.next.connect(g),l=l.next,l.isConnected=!1,l.isVisited=!1},m=function(){l.connect(g.prev),l.isConnected=!1},g=l.prev;if(l===g)break;let y=l.pt,b=g.pt,P=b.end();if(!l.isConnected&&!P.equals(y.start())){let T=function(C){l.isConnected=!0,l.pt=y=C,l.next.isVisited=!1},I=function(C){l.isConnected=!0,g.pt=C,g.isVisited=!1,l=g};if(y instanceof Tt)if(h(P,y.end())){p();continue}else T(new Tt(P,y.end()));else if(b instanceof Tt){h(b.start(),y.start())?m():I(new Tt(b.start(),y.start()));continue}else if(y instanceof Yi)if(h(P,y.end())&&!(y.controls.length!==2&&y.getToLineMaxDis2(y.startToEndL)>=t)){p();continue}else T(new Yi([P,...y.controls.slice(1)]));else if(b instanceof Yi)h(b.start(),y.start())&&!(b.controls.length!==2&&b.getToLineMaxDis2(b.startToEndL)>=t)?m():I(new Yi([...b.controls.slice(0,-1),y.start()]));else if(y instanceof mr&&b instanceof mr)if(Math.abs(Math.abs(y.sweepAngle)-180)<Math.abs(Math.abs(b.sweepAngle)-180)){let C=mr.build5(P,y.end(),y.sweepAngle);if(h(C.start(),C.end())&&!(C.rx>=C9&&Math.abs(C.sweepAngle)>180)){p();continue}else T(C)}else{let C=mr.build5(b.start(),y.start(),b.sweepAngle);h(C.start(),C.end())&&!(C.rx>=C9&&Math.abs(C.sweepAngle)>180)?m():I(C);continue}else throw new Error("not support")}if(Jn(y,y.start()).dot(Jn(b,b.end()))<0){let T=function(E,O,_,x,v,D){if(l.next===g){l=null;return}let{rebuildLinkLine:w,rebuildPrevPt:F,rebuildNextPt:H}=qMe(E,O,_,x,v);F&&H&&(F!==O&&(g.prev.pt=F),H!==x&&(l.next.pt=H),w?D.pt=w:p())},I=function(){l.next===g?l=null:(l.next.connect(g.prev),l=l.next,l.isConnected=!1,l.isVisited=!1)},C=Yg(b.reverse(),y).state;if(C===0){let E=$Me(y,b.start(),y.end());if(d(E)){let O=g.prev.pt,_=l.next.pt;if(Jn(_,_.start()).dot(Jn(O,O.end()))>=0){if(I(),!l)break;continue}if(T(g.prev.prev.pt,O,E instanceof Tt?E:new Tt(E.start(),E.end()),_,l.next.next.pt,l),!l)break}else l.pt=E;m();continue}else if(C===1){let E=$Me(b,b.start(),y.end());if(d(E)){let O=g.prev.pt,_=l.next.pt;if(Jn(_,_.start()).dot(Jn(O,O.end()))>=0){if(I(),!l)break;continue}if(T(g.prev.prev.pt,O,E instanceof Tt?E:new Tt(E.start(),E.end()),_,l.next.next.pt,g),!l)break}else g.pt=E;p();continue}else if(C===2){if(I(),!l)break;continue}}l.isVisited=!0,l=l.next}if(!l)return null;r.length=0;let c=l;for(r.push(l.pt),l=l.next;l!==c;)r.push(l.pt),l=l.next;if(r.length===1){let p=r[0];return p instanceof mr?(h(p.start(),p.end())?r[0]=mr.buildCircle(p.center,p.rx,p.sweep()):r.push(new Tt(p.end(),p.start())),sa.build7(r)):p instanceof Yi?(h(p.start(),p.end())||r.push(new Tt(p.end(),p.start())),sa.build7(r)):null}if(o=sa.build7(r),Math.abs(o.area(.1))<t)return null;return o;function h(p,m){return p.distance2(m)<t}function u(p,m){if(Math.abs(p.sweepAngle)>i0t){let g=p.sweepAngle/2;u(mr.build3(p.center,p.startAngle,g,p.rx,p.ry),m),u(mr.build3(p.center,p.startAngle+g,g,p.rx,p.ry),m)}else m.push(p)}function d(p){return p.start().distance2(p.end())<t&&!(p instanceof mr&&p.rx>=C9&&Math.abs(p.sweepAngle)>180||p instanceof Yi&&p.controls.length!==2&&p.getToLineMaxDis2(new Tt(p.start().add1(1,0),p.end()))>=t)}}function bP(o,t){if(!o)return!0;let e=o.start(),r=o.end();if(e.distance2(r)<t**2)if(o instanceof mr){if(!(o.rx>=t&&Math.abs(o.sweepAngle)>180))return!0}else if(o instanceof Yi){if(!(o.controls.length!==2&&o.getToLineMaxDis2(new Tt(o.start().add1(1,0),o.end()))>=t))return!0}else return!0;return!1}function aN(o){if(o.direct.x===0&&o.direct.y===0)throw Error("getEndOfExtendLine(line: Line, distance: number)");let t=Math.abs(C9-o.length())+yr.eps,e={x:o.direct.normalize().x*t,y:o.direct.normalize().y*t},r=o.end();return new Yt(r.x+e.x,r.y+e.y)}function qMe(o,t,e,r,i){if(!o)s();else if(!i)a();else{let l=Jn(o,o.end()),c=Jn(t,o.end()),h=l.dot(c);if(h>=0)s();else{let u=Jn(r,r.end()),d=Jn(i,r.end()),p=u.dot(d);if(p>=0)a();else if(_9(h,-1)&&_9(p,-1)){let m=e.center();n(m),e=null}else h>p?s():a()}}function n(l){let c;if(t instanceof Tt)c=new Tt(t.start(),l);else if(t instanceof Yi)c=new Yi([...t.controls.slice(0,-1),l]);else if(t instanceof mr)c=mr.build5(t.start(),l,t.sweepAngle);else throw new Error("not supported");t=bP(c,Qn)?null:c;let h;if(r instanceof Tt)h=new Tt(l,r.end());else if(r instanceof Yi)h=new Yi([l,...r.controls.slice(1)]);else if(r instanceof mr)h=mr.build5(l,r.end(),r.sweepAngle);else throw new Error("supported");r=bP(h,Qn)?null:h}function s(){if(t instanceof Tt){let l=aN(e.reverse());e=new Tt(l,e.end());let c=new Tt(t.start(),l);t=bP(c,Qn)?null:c}else if(t instanceof Yi){let l=aN(e.reverse());e=new Tt(l,e.end());let c=new Yi([...t.controls.slice(0,-1),l]);t=bP(c,Qn)?null:c}else if(t instanceof mr){let l=aN(e.reverse());e=new Tt(l,e.end());let c=mr.build5(t.start(),l,t.sweepAngle);t=bP(c,Qn)?null:c}else throw new Error("not supported")}function a(){if(r instanceof Tt){let l=aN(e);e=new Tt(e.start(),l);let c=new Tt(l,r.end());r=bP(c,Qn)?null:c}else if(r instanceof Yi){let l=aN(e);e=new Tt(e.start(),l);let c=new Yi([l,...r.controls.slice(1)]);r=bP(c,Qn)?null:c}else if(r instanceof mr){let l=aN(e);e=new Tt(e.start(),l);let c=mr.build5(l,r.end(),r.sweepAngle);r=bP(c,Qn)?null:c}else throw new Error("not supported")}return{rebuildPrevPt:t,rebuildNextPt:r,rebuildLinkLine:e}}function $Me(o,t,e){if(o instanceof Tt||t.distance2(e)<=jg)return new Tt(t,e);if(o instanceof mr)return mr.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.isCCW?1:0);if(o instanceof Yi){let r=o.getPercent(t,Qn),i=o.getPercent(e,Qn);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}var n0t=class{constructor(o){this.pt=o}connect(o){this.prev=o,o.next=this}};function zJ(o){let t=gW(),e;if(o instanceof sa){let r=ev(o);if(r===null)return null;e=r}else if(o instanceof p0){let r=o.items.map(i=>zJ(i)).filter(i=>i!==null);if(r.length===0)return null;e=new p0(r)}else{let r=o.items.map(i=>zJ(i)).filter(i=>i!==null);if(r.length===0)return null;e=new Fd(r)}return O9.preprocessPolyline+=Z_(t),e}var O9={addDocShapes2RTree:0,getPour:0,prepare:0,getSinglePourLayerPolyline:0,combindOutlines:0,mergeSameNet:0,run:0,end:0,deSelfIntersection:0,changeDirect:0,extend:0,preprocessPolyline:0,runBoolean:0,IntersectionSeeker:0,BooleanTools:0,totalBool:0};function gW(){return{timeIndex:Object.assign({},O9),start:performance.now()}}function KMe(o){return Object.values(o).reduce((t,e)=>t+e,0)}function Z_(o){return performance.now()-o.start-(KMe(O9)-KMe(o.timeIndex))}function Ef(o,t,e,r){let i=Ol.RED,n=Ol.Golden;function s(){if(!r)return;let d=r.initColor(Ol.Golden);d.addPt(a),d.addPoint(a.end()),r.initColor(Ol.RED).addPt(l),r.draw();debugger}let a=o.getShape(),l=e?t.getShape():t.getShape().reverse(),c=Jn(a,l.start()),h=Jn(l),u=c.cross(h);if(_9(u,0))if(a instanceof Tt)if(l instanceof Tt){if(yr.eq(u,0)&&(c.dot(h)>0?!_n(a.end(),l.start()):!_n(a.start(),l.start())))throw s(),new Error("line and line");return u<0}else{if(l instanceof mr)return c.cross(l.center.sub(a.start()))<0;if(l instanceof Yi){let d=l.getExtremePoints(a),p=d.length?d[0]:gN(l.controls,a.start());return c.cross(p.sub(a.start()))<0}else throw new Error("not support")}else if(a instanceof mr){if(l instanceof Tt)return a.isCCW;if(l instanceof mr){if(l.center.equals1(a.center)&&(c.dot(h)>0?!_n(a.end(),l.start())&&a.end().sub(l.start()).dot(h)>0:!_n(a.start(),l.start())&&a.start().sub(l.start()).dot(h)>0))throw s(),new Error("arc and arc");return l.rx>=a.rx||l.center.distance2(a.center)>a.rx2?a.isCCW:!a.isCCW}else throw new Error("not support")}else if(a instanceof Yi)if(l instanceof Tt){let d=a.getPercent(l.start(),Qn),p=a.clip(d)[1],m=p.getExtremePoints(l);return(m.length?m[0]:gN(p.controls,l.start())).sub(l.start()).cross(h)<0}else if(l instanceof Yi){let d=a.getPercent(l.start(),Qn),p=a.clip(d)[1],m=p.getExtremePoints(new Tt(l.start(),l.end())),g=l.getExtremePoints(new Tt(p.start(),p.end())),y=m.length?m[0]:gN(p.controls,l.start()),b=g.length?g[0]:gN(l.controls,l.start()),P=y.sub(l.start()),T=b.sub(l.start());return P.cross(T)<0}else throw Error("not support");else throw new Error("not support");else return u<0}function Vw(o,t,e,r,i){let n=o.getShape(),s=t.getShape(),a=n instanceof mr?UC(n,Vo.toRadians(n.endAngle())):n instanceof Yi?lW(n,1):n.end().sub(n.start()).normalize(),l=Jn(s),c=a.dot(l);if(_9(c,-1))return Ef(o,t,!0,i)?Ef(o,e,r,i)&&Ef(t,e,r,i):Ef(o,e,r,i)||Ef(t,e,r,i);{let h=a.scale(-1).angle(Yt.ORIGIN),u=l.angle(Yt.ORIGIN);h>u&&(h-=KJ);let d=(h+u)/2,p=new Yt(Math.cos(d),Math.sin(d)),m=r?e.getShape():e.getShape().reverse(),g=Jn(m);return p.cross(g)<0?Ef(o,e,r,i):Ef(t,e,r,i)}}function F2e(o,t,e,r,i){let n=o.getShape(),s=t.getShape(),a=n instanceof mr?UC(n,Vo.toRadians(n.endAngle())):n instanceof Yi?lW(n,1):n.end().sub(n.start()).normalize(),l=Jn(s),c=a.dot(l);if(_9(c,-1))return Ef(o,t,!0,i)?Ef(o,e,r,i)&&Ef(t,e,r,i):Ef(o,e,r,i)||Ef(t,e,r,i);{let h=a.scale(-1).angle(Yt.ORIGIN),u=l.angle(Yt.ORIGIN);h>u&&(h-=KJ);let d=(h+u)/2,p=new Yt(Math.cos(d),Math.sin(d)),m=r?e.getShape():e.getShape().reverse(),g=Jn(m);if(p.cross(g)<0){let y=a.dot(g)<0,b=Yg(y?o.getShape().reverse():o.getShape(),m).state;return b!==3&&b!==4?Ef(o,e,r,i):b===(y?4:3)}else{let y=l.dot(g)<0,b=Yg(y?t.getShape().reverse():t.getShape(),m).state;return b!==3&&b!==4?Ef(t,e,r,i):b===(y?4:3)}}}var o0t=(o=>(o[o.NOT_IN=0]="NOT_IN",o[o.IS_IN=1]="IS_IN",o[o.IS_OVERLAP=2]="IS_OVERLAP",o))(o0t||{}),s0t=(o=>(o[o.AllClear=0]="AllClear",o[o.MapClear=1]="MapClear",o))(s0t||{}),E9,Q_=!1;function PP(o,t,e,r,i,n,s,a=e.side===t,l=!0,c){return E9=i,Q_=n,M4e(N4e(o,t,l,c,s,e,a,r),e,a,r,0)}function rO(o,t,e,r,i,n,s,a=r.side===e){E9=i,Q_=n;let l=k4e(o,t,e,new Map,r,a,s),c=l instanceof Array?-1:1;return M4e(l,r,a,s,c)}function M4e(o,t,e,r,i){for(;o instanceof Array;)i++,o.length===4?o=k4e(...o,t,e,r):o=N4e(...o,t,e,r);return{...o,existOverlap:i>0}}function N4e(o,t,e,r,i,n,s,a){if(YJ===-1){a.initColor(Ol.RED).addPt(o.getShape()),a.initColor(Ol.Golden).addPt(t.getShape()),a.draw();debugger}let l=o.getShape(),c=s?t.getShape().reverse():t.getShape(),h=(l instanceof mr?UC(l,e?c.start().angle(l.center):r?Vo.toRadians(l.endAngle()):void 0):l instanceof Yi?Jn(l,e?c.start():r?l.end():l.start()):l.end().sub(l.start())).normalize(),u=(c instanceof mr?UC(c,e?void 0:(r?l.end():l.start()).angle(c.center)):c instanceof Yi?Jn(c,e?void 0:r?l.end():l.start()):c.end().sub(c.start())).normalize();if(r===void 0){let m=h.dot(u);if(r=m<0,_9(m,0))return{state:Ef(o,t,!s,a)?1:0,inter:iO(o,t,n,s,e,r,i)}}else if(r?h.dot(u)>0:h.dot(u)<0)if(e){let m,g=!0;if(l instanceof Tt&&_n(GC.foot(l,c.start()),r?l.end():l.start()))g=!1;else if(l instanceof mr||l instanceof Yi){let y=r?l.reverse():l,b=Yg(c,Tpt(y,c.start()).reverse()).state;(b===1||b===2)&&(g=!1)}if(g){let y=!r;m=Yg(y?l.reverse():l,c,a).state===(y?4:3)?1:0}else r?m=Vw(o,o.nextSide,t,!s,a)?1:0:m=Vw(o.prevSide,o,t,!s,a)?1:0;return{state:m,inter:iO(o,t,n,s,e,r,i)}}else return r?{state:Ef(o,o.nextSide,!0,a)?0:1,inter:iO(o,t,n,s,e,r,i),isReversed:!0}:{state:Ef(o.prevSide,o,!0,a)?0:1,inter:iO(o,t,n,s,e,r,i),isReversed:!0};let d,p=new Map([[3,4],[4,3],[0,1],[1,0],[2,2]]);if(e)if(o.judgeOverlapMap.has(t)&&!Q_){let m=o.judgeOverlapMap.get(t);d=r?p.get(m.state):m.state}else d=Yg(r?l.reverse():l,c).state,(d===3||d===4)&&o.judgeOverlapMap.set(t,{state:r?p.get(d):d});else{if(t.judgeOverlapMap.has(o)&&!Q_){let m=t.judgeOverlapMap.get(o);d=s?p.get(m.state):m.state}else d=Yg(c,r?l.reverse():l).state,(d===3||d===4)&&t.judgeOverlapMap.set(o,{state:s?p.get(d):d});d=p.get(d)}if(d===1||d===2){let m=s?t.prevSide:t,g=m.inters,y=m.getEnd();for(let b=g.length-1;b>=0;b--){let P=g[b];if(!(m.getShape()instanceof Yi)&&!_n(y,P.coord))break;if(P===n)return{state:2,inter:iO(o,t,n,s,e,r,i)}}}if(d===3||d===4)return{state:d===(r?4:3)?1:0,inter:iO(o,t,n,s,e,r,i)};if(i.has(o)?i.get(o).mapSideList.push(t):i.set(o,{sideIsReversed:r,mapSideList:[t]}),i.has(t)?i.get(t).mapSideList.push(o):i.set(t,{sideIsReversed:s,mapSideList:[o]}),d===2)return r?[o.prevSide,o,s?t.prevSide:t.nextSide,i]:[o,o.nextSide,s?t.prevSide:t.nextSide,i];if(d===0)return[r?o.prevSide:o.nextSide,t,!1,r,i];if(d===1)return[o,s?t.prevSide:t.nextSide,!0,r,i];throw Error("not support")}function iO(o,t,e,r,i,n,s){if(Q_)return null;let a=o.getShape(),l=r?t.getShape().reverse():t.getShape(),c=r;if(!i){let p=t;t=o,o=p,r=n,e=e.getBindedInter()}let h=p=>!(i?n:c)&&_n(p,o.prevSide.getEnd())?o.prevSide:o;if(r){let p=t.inters;for(let m=0;m<p.length;m++){let g=p[m];if(g.isInvalid&&n===void 0)continue;if(g===e&&_n(l.start(),e.coord))return i?g:g.getBindedInter();let y=g.getBindedInter().side,b=h(g.coord);if(y===b&&u(g))return d(g)}for(;;){t=t.nextSide;let m=t.inters;for(let g=0;g<m.length;g++){let y=m[g];if(y===e)return i?y:y.getBindedInter();if(s.has(t)){let b=y.getBindedInter().side;if(s.get(t).mapSideList.includes(b)||_n(y.coord,b.getEnd())&&s.get(t).mapSideList.includes(b.nextSide))return d(y);if(s.has(b)){let P=t.getShape().reverse(),T=Jn(P,y.coord).dot(Jn(b.getShape(),y.coord))<0,I=T?b.getShape().reverse():b.getShape(),C=Yg(P,T?w2e(I,y.coord,I.end()):w2e(I,I.start(),y.coord)).state;if(C===1||C===2)return d(y)}else s.has(b.nextSide)}else if(y.side===e.side&&u(y))return d(y)}}}else{let p=t.inters;for(let m=p.length-1;m>=0;m--){let g=p[m];if(g.isInvalid&&n===void 0)continue;if(g===e&&_n(l.start(),e.coord))return i?g:g.getBindedInter();let y=g.getBindedInter().side,b=h(g.coord);if(y===b&&u(g))return d(g)}for(;;){t=t.prevSide;let m=t.inters;for(let g=m.length-1;g>=0;g--){let y=m[g];if(y===e)return i?y:y.getBindedInter();if(s.has(t)){let b=y.getBindedInter().side;if(s.get(t).mapSideList.includes(b)||_n(y.coord,y.getBindedInter().side.getEnd())&&s.get(t).mapSideList.includes(b.nextSide))return d(y);if(!s.has(b)&&s.has(b.prevSide)){let P=t.getShape().reverse(),T=Jn(P,y.coord).dot(Jn(b.getShape(),y.coord))<0;if(s.has(b.prevSide)){let I=T?b.getShape().reverse():b.getShape(),C=Yg(t.getShape(),w2e(I,y.coord,I.end())).state;if(C===1||C===2)return d(y)}}}else if(y.side===e.side&&u(y))return d(y)}}}function u(p){if(p.isInvalid||p.getBindedInter().side!==(_n(p.coord,o.prevSide.getEnd())?o.prevSide:o))return!1;let m;if(i){if(_n(p.coord,l.start()))return!0;m=Yg(n?a.reverse():a,g(l)).state}else{if(_n(p.coord,n?a.end():a.start()))return!0;m=Yg(l,g(n?a.reverse():a)).state}return m===2||m===1;function g(y){if(y instanceof Tt)return _n(p.coord,y.end())?y:y.cutLine(p.coord);if(y instanceof mr)return mr.build2(y.center,y.startAngle,p.coord.angleD(y.center),y.rx,y.ry,y.isCCW?1:0);if(y instanceof Yi)return y.clip(y.getPercent(p.coord,Qn))[0];throw new Error("not supported operation")}}function d(p){let m=e.getBindedInter(),g=e.side,y=m.side,b=e===p,P=e;if(r){let T=e.getIndex()-1;for(;g;){let I=g.inters;for(;T>=0;T--)if(e=I[T],e===p){b||(e.setIsInvalid(),e.isDealed(),P=e),g=null;break}else if(E9===0)!e.isInvalid&&(!_n(e.coord,p.coord)||e.side===p.side&&e.getBindedInter().side===p.getBindedInter().side)&&(e.setIsInvalid(),e.isDealed(),P=e);else if(E9===1){if(e.isInvalid)continue;let C=e.getBindedInter().side;s.has(g)&&s.get(g).mapSideList.includes(C)&&(e.setIsInvalid(),e.isDealed(),P=e)}g=g==null?void 0:g.prevSide,T=(g==null?void 0:g.inters.length)-1}}else{let T=e.getIndex()+1;for(;g;){let I=g.inters;for(;T<I.length;T++){e=I[T];let C=e.getBindedInter();if(e===p){b||(e.setIsInvalid(),e.isDealed(),P=e),g=null;break}else if(E9===0)!e.isInvalid&&(!_n(e.coord,p.coord)||g===p.side&&(_n(C.side.getEnd(),e.coord)?C.side.nextSide:C.side)===p.getBindedInter().side)&&(e.setIsInvalid(),e.isDealed(),P=e);else if(E9===1){let E=C.side;s.has(g)&&s.get(g).mapSideList.includes(E)&&(e.setIsInvalid(),e.isDealed(),P=e)}}g=g==null?void 0:g.nextSide,T=0}}if(E9===0&&!_n(m.coord,p.coord))if(i?s.has(y)?s.get(y).sideIsReversed:n:c){let T=m.getIndex()-1;for(;y;){let I=s.has(y),C=y.inters;for(;T>=0;T--){if(m=C[T],m===p.getBindedInter()){y=null;break}m.isInvalid||!I||(!_n(m.coord,p.getBindedInter().coord)||m.side===p.side&&m.getBindedInter().side===p.getBindedInter().side)&&(m.setIsInvalid(),m.isDealed())}y=y==null?void 0:y.prevSide,T=(y==null?void 0:y.inters.length)-1}}else{let T=m.getIndex()+1;for(;y;){let I=y.inters,C=s.has(y);for(;T<I.length;T++){if(m=I[T],m===p.getBindedInter()){y=null;break}let E=_n(y.getEnd(),m.coord)?s.has(y.nextSide):!1;m.isInvalid||!(C||E)||(!_n(m.coord,p.getBindedInter().coord)||m.side===p.side&&m.getBindedInter().side===p.getBindedInter().side)&&(m.setIsInvalid(),m.isDealed())}y=y==null?void 0:y.nextSide,T=0}}return i?P:P.getBindedInter()}}function k4e(o,t,e,r,i,n,s){let a=o.getShape(),l=t.getShape(),c=n?e.getShape().reverse():e.getShape(),h=(a instanceof mr?UC(a,c.start().angle(a.center)):a instanceof Yi?Jn(a,c.start()):a.end().sub(a.start())).normalize(),u=(l instanceof mr?UC(l,c.start().angle(l.center)):l instanceof Yi?Jn(l,c.start()):l.end().sub(l.start())).normalize(),d=h.dot(u);if(_9(d,-1)){let p=n?e.getShape().reverse():e.getShape(),m=Jn(p).normalize(),g=h.add(u.scale(-1)).normalize().dot(m),y=Yg(a.reverse(),l,s).state;if(g>-.9&&(y===3||y===4))return{state:y===4?0:1,inter:iO(t,e,i,n,!0,!1,r)};let b=PP(o,e,i,s,E9,Q_,r.size===0?new Map:r,n);return b.state===2?b:y===4?b.state===0||b.inter!==i?b:PP(t,e,i,s,E9,Q_,r.size===0?new Map:r,n):b.state===1||b.inter!==i?b:PP(t,e,i,s,E9,Q_,r.size===0?new Map:r,n)}else{let p=h.scale(-1).angle(Yt.ORIGIN),m=u.angle(Yt.ORIGIN);p>m&&(p-=KJ);let g=(p+m)/2,y=new Yt(Math.cos(g),Math.sin(g)),b=Jn(c).normalize(),P=b.angle(Yt.ORIGIN),T=p<P&&P<m&&a instanceof Tt&&l instanceof Tt&&c instanceof Tt;if(y.cross(b)<=0){if(h.scale(-1).dot(b)<0){let I;return i.coord.equals1(c.start())?I=Jn(a,i.coord).dot(Jn(c,i.coord))<0:c instanceof Tt&&(I=Jn(a,a.end()).dot(c.direct)<0),{state:Vw(o,t,e,!n,s)?1:0,inter:iO(o,e,i,n,!0,I,r)}}return T&&a.distance2(c.start())>jg?[t,e,!0,void 0,r]:[o,e,!0,void 0,r]}else return u.dot(b)<=0?{state:Vw(o,t,e,!n,s)?1:0,inter:iO(t,e,i,n,!0,void 0,r)}:T&&l.distance2(c.start())>jg?[o,e,!0,void 0,r]:[t,e,!0,void 0,r]}}var YJ=0;function a0t(o,t,e,r){let i=t.getBindedInter(),n=t.side,s=i.side,a=n.getShape(),l=s.getShape();if(r&&(YJ++,YJ===-1)){r.initColor(Ol.RED).addPt(a),r.initColor(Ol.Golden).addPt(l),r.draw();debugger}let c=0,h=!1;if(o===-1){let O=rO(n,n.nextSide,s,i,c,h,r),_=O.state!==0;if(O.state===2){let v=Jn(a,t.coord).add(Jn(n.nextSide.getShape(),t.coord)).normalize(),D=Jn(l,t.coord).add(Jn(s.nextSide.getShape(),t.coord)).normalize();return E(_,v.dot(D)>0)}let x=rO(n,n.nextSide,s.nextSide,i,c,h,r);return O.state!==x.state?(C(O,x),1):E(_,O.state!==rO(s,s.nextSide,n,t,c,!0,r).state,O.inter,x.inter)}if(o===1){let O=PP(n,s,i,r,c,h,new Map),_=O.state!==0;if(O.state===2)return E(_,Jn(a,t.coord).dot(Jn(l,t.coord))>0);let x;if(O.isReversed&&O.existOverlap&&_n(O.inter.coord,s.getEnd())&&O.inter.getBindedInter().side!==n){let w=O.inter.getBindedInter().side;if(w===n.nextSide)x={state:Vw(n,w,s.nextSide,!0,r)?1:0,inter:i};else if(w===n.prevSide){if(x={state:Vw(w,n,s.nextSide,!0,r)?1:0,inter:O.inter},O.state===x.state&&t!==O.inter){let F=Jn(l,t.coord),H=Jn(s.nextSide.getShape(),t.coord),z=Jn(w.getShape(),t.coord);return E(_,F.add(H).dot(z)>0,O.inter,x.inter)}}else x=PP(n,s.nextSide,i,r,c,h,new Map)}else x=PP(n,s.nextSide,i,r,c,h,new Map);if(O.state!==x.state)return C(O,x),1;let v=Jn(l,t.coord),D=Jn(s.nextSide.getShape(),t.coord);if(_9(v.dot(D),-1)){let w=Ef(s,s.nextSide,!0,r);return E(_,O.state!==PP(s.nextSide,n,t,r,c,!0,new Map,w?!_:_,!1).state,O.inter,x.inter)}else{let w=Jn(a,t.coord);return E(_,v.add(D).dot(w)>0,O.inter,x.inter)}}if(!(a instanceof Yi||l instanceof Yi))return 1;let u=Jn(a,t.coord),d=Jn(l,t.coord),p,m;if(l instanceof Tt)p=new Tt(t.coord,l.start()),m=new Tt(t.coord,l.end());else if(l instanceof mr){let O=t.coord.angleD(l.center);p=mr.build2(l.center,O,l.startAngle,l.rx,l.ry,l.isCCW?0:1),m=mr.build2(l.center,O,l.endAngle(),l.rx,l.ry,l.isCCW?1:0)}else if(l instanceof Yi){let O=l.getPercent(t.coord,Qn);[p,m]=l.clip(O),p=p.reverse()}else throw new Error("not support");let g=u.dot(d)>0,y,b;g?(y=Yg(a.reverse(),p).state,b=Yg(a,m).state):(y=Yg(a,p).state,b=Yg(a.reverse(),m).state);let P;y===0?P=PP(g?n.prevSide:n.nextSide,s,i,r,c,h,new Map,!0,!1,g):y===1?P=PP(n,s.prevSide,i,r,c,h,new Map,!0,!0,g):y===2?g?P=rO(n.prevSide,n,s.prevSide,i,c,h,r,!0):P=rO(n,n.nextSide,s.prevSide,i,c,h,r,!0):g?y===3?P={inter:i,state:0}:P={inter:i,state:1}:y===3?P={inter:i,state:1}:P={inter:i,state:0};let T=P.state!==0;if(P.state===2)return E(T,g);let I;if(b===0?I=PP(g?n.nextSide:n.prevSide,s,i,r,c,h,new Map,!1,!1,!g):b===1?I=PP(n,s.nextSide,i,r,c,h,new Map,!1,!0,!g):b===2?g?I=rO(n,n.nextSide,s.nextSide,i,c,h,r,!1):I=rO(n.prevSide,n,s.nextSide,i,c,h,r,!1):g?b===3?I={inter:i,state:1}:I={inter:i,state:0}:b===3?I={inter:i,state:0}:I={inter:i,state:1},P.state===I.state)return P.inter===I.inter?(t.setIsInvalid(),0):E(T,g,P.inter,I.inter);return C(P,I),1;function C(O,_){let x=O.state!==0;if(O.inter===_.inter){t.setOutToIn(x);return}else lN(O.inter,_.inter,!0),lN(_.inter,O.inter,!1);let v=[];if(o===-1){let w=Jn(a,t.coord),F=Jn(n.nextSide.getShape(),t.coord),H=Jn(l,t.coord),z=Jn(s.nextSide.getShape(),t.coord);v.push(w.dot(H)),v.push(w.dot(z)),v.push(F.dot(H)),v.push(F.dot(z))}else{let w=Jn(a,t.coord);v.push(Jn(l,t.coord).dot(w)),v.push(Jn(s.nextSide.getShape(),t.coord).dot(w))}if(v.reduce((w,F)=>Math.abs(w)>Math.abs(F)?w:F,0)>0)if(e===1||e===0||e===2||e===3)t.setOutToIn(x);else throw new Error("not support");else if(e===1)D(!x);else if(e===0||e===2||e===3)D(x);else throw new Error("not support");function D(w){t.setIsInvalid();let F=(w?O:_).inter;delete F.isInvalid,delete F.getBindedInter().isInvalid,F.setOutToIn(!x)}}function E(O,_,x,v){if(x===v){if(t.side.outline.inters.find(F=>!F.isInvalid&&F!==t&&_n(F.coord,t.coord)))return t.setIsInvalid(),0;let D=new nO(t.coord,n,r),w=new nO(t.coord,s,r);return D.bind(w),_?n.inters.splice(t.getIndex(),0,D):n.inters.splice(t.getIndex()+1,0,D),s.inters.splice(t.getBindedInter().getIndex(),0,w),D.setOutToIn(O),t.setOutToIn(!O),D.isDealed(),n.inters.forEach((F,H)=>F.setIndex(H)),s.inters.forEach((F,H)=>F.setIndex(H)),2}else{let D=function(){let w=x.getBindedInter(),F=v.getBindedInter();delete x.isInvalid,delete w.isInvalid,delete v.isInvalid,delete F.isInvalid,x.setOutToIn(!O),v.setOutToIn(O),lN(x,v,!0),lN(v,x,!1),lN(w,F,_),lN(F,w,!_)};if(t.setIsInvalid(),_){if(e===1||e===0||e===2||e===3)return D(),2;throw new Error("not support")}else{if(e===1)return O?0:(D(),2);if(e===0||e===2||e===3)return O?(D(),2):0;throw new Error("not support")}}}}function lN(o,t,e){let{judge:r,changeNum:i}=s(),n=o.getIndex();for(let a=n+i,l=o.side.inters;r(a);a+=i){if(l[a].isInvalid)continue;if(!_n(l[a].coord,o.coord))break;l[a].setIndex(n),l[n].setIndex(a);let c=l[a];l[a]=l[n],l[n]=c,n=a}function s(){let a=o.side===t.side;if(e){let l=a?t.getIndex():o.side.inters.length;return{judge:c=>c<l,changeNum:1}}else{let l=a?t.getIndex()+1:0;return{judge:c=>c>=l,changeNum:-1}}}}var ZMe=0,nO=class{constructor(o,t,e){this.id=ZMe++,this.coord=o,this.side=t,e&&(this.id=ZMe++,this.drawDebug=e);let r=new ib;r.ext2(o),this._bbox=r.build1()}bbox(){return this._bbox}resetVisitStatus(){this.visited=!1,this.bindedInter.visited=!1}isDealed(){this.dealed=!0,this.getBindedInter().dealed=!0}setOutToIn(o){this.outToIn=o,this.bindedInter.outToIn=!o}setIsInvalid(){this.isInvalid=!0,this.getBindedInter().isInvalid=!0}getBindedInter(){return this.bindedInter}bind(o){this.bindedInter=o,o.bindedInter=this}setIndex(o){this.index=o}isSorted(){return this.index!==void 0}getIndex(){return this.index}getVisited(){return this.visited}visitSelf(){this.visited=!0}visit(){this.visited=!0,this.bindedInter.visited=!0}getPrevPoint(){let o=this.getIndex(),t=this.side.getStart();return o&&(t=this.side.inters[o-1].coord),t}getTangent(){let o=this.side.getShape();if(o instanceof Tt)return o.end().sub(o.start());if(o instanceof mr){let t=this.coord.angle(o.center);return o.isCCW?t+=FJ:t-=FJ,new Yt(Math.cos(t),Math.sin(t))}else{if(o instanceof Yi)return lW(o,o.getPercent(this.coord,Qn));throw new Error("not support")}}findStartInter(){return this.outToIn===void 0?this.getTangent().cross(this.bindedInter.getTangent())>0?this:this.bindedInter:this.outToIn?this:this.bindedInter}run(){let o=[],t=this,e;if(this.drawDebug){V2e++;let r=V2e===-1,i=this.drawDebug.initColor(Ol.RED);if(r){this.drawDebug.draw();debugger}e=n=>{if(o.push(n),r){i.addPt(o[o.length-1]),this.drawDebug.draw();debugger}}}else e=r=>o.push(r);for(;!t.visited;){let r=function(a,l){if(yr.eq(a.distance2(l),0))return;let c=mW.rebuild(n.getShape(),a,l);if(!c)return!0;e(c)};t.visit();let i=t.getIndex(),n=t.side,s=n.inters[i+1];for(;s!=null&&s.isInvalid;)s=n.inters[s.getIndex()+1];if(s)r(t.coord,s.coord),t=s.bindedInter;else{let a=r(t.coord,n.getEnd()),l=t.coord;for(n=n.nextSide,t=null;;){for(let c of n.inters)if(!c.isInvalid){t=c.bindedInter;break}if(t)break;a?(r(l,n.getEnd()),a=!1):e(n.getShape()),n=n.nextSide}a?(yr.eq(l.distance2(t.coord),0)?r(l,n.getEnd()):r(l,t.coord),a=!1):yr.eq(n.getEnd().distance2(t.coord),0)?e(n.getShape()):r(n.getStart(),t.coord)}}if(t!==this)throw this.drawDebug&&console.log(JSON.stringify({runId:V2e,handleId:YJ,boolId:eW})),new Error("inter !== this");return ev(sa.build7(o))}},V2e=0,G2e=class obe{constructor(t,e,r,i,n){this.inters=[],this.allInterIsInvalid=!0,this.isVisit=!1,this.sides=t,this.isGroup1=r,this.isOutside=i,this.finalIsOutside=i,this.polyline=e,n&&(this.polygon=n),t.forEach(s=>s.outline=this)}static build(t,e,r,i,n){let s=t.primitives.map(l=>new mW(l,i)),a=s[s.length-1];return s.forEach(l=>{a.connect(l),a=l}),n?new obe(s,t,e,r,n):new obe(s,t,e,r)}setFinalIsOutSide(t){this.finalIsOutside=t}startAndEndIsSameOutsideFlag(){return this.isOutside===this.finalIsOutside}get hasInter(){return!!this.interOutlines}isAllInterIsInvalid(){return this.allInterIsInvalid}setAllInterIsInvalidToFalse(){this.allInterIsInvalid=!1}resetVisited(){this.isVisit=!1}intersect(t,e){if(!(t.interOutlines&&t.interOutlines===this.interOutlines))if(t.interOutlines)if(this.interOutlines){let r,i;this.interOutlines.length>t.interOutlines.length?(r=this.interOutlines,i=t.interOutlines):(r=t.interOutlines,i=this.interOutlines),i.forEach(n=>{r.push(n),n.interOutlines=r}),e.delete(i)}else t.interOutlines.push(this),this.interOutlines=t.interOutlines;else this.interOutlines?(this.interOutlines.push(t),t.interOutlines=this.interOutlines):(t.interOutlines=this.interOutlines=[this,t],e.add(this.interOutlines))}isContain(t){if(!this.polyline.bbox().extendOfSize(Qn).isContainsBBox(t.polyline.bbox()))return!1;let e=t.polyline.primitives[0].start();if(t.hasInter&&t.isAllInterIsInvalid()){let r=t.inters[0];r.getBindedInter().side.outline!==this?e=r.side.getCenterPoint():e=r.side.getCenterPoint(r.coord)}return!!this.polyline.getWindingNum(e)}isInternally(t){return!!this.polyline.getWindingNum(t)}isEqual(t){return this.polyline===t.polyline}bbox(){return this.polyline.bbox()}reverse(){this.sides.reverse();let t=this.sides[this.sides.length-1];this.sides.forEach(e=>{e.reverse(),t.connect(e),t=e})}returnPolyline(){let t=this.sides.map(r=>r.getShape()),e=this.polyline.primitives;if(this.sides.length===e.length){let r=new Set(e);if(!t.some(i=>!r.has(i)))return this.polyline}return sa.build7(t)}};function JMe(o,t,e){let r=[];return o.forEach(i=>i.forEach(n=>{if(n.hasInter&&!n.isAllInterIsInvalid())return;let s=n.bbox(),a=t.search(s.extendOfSize(Qn)).filter(l=>l.bbox().extendOfSize(Qn).isContainsBBox(s)).sort((l,c)=>l.bbox().area()-c.bbox().area());for(let l of a)if(l.isContain(n)){let c=e(!n.isOutside,l.isOutside),h=e(n.isOutside,l.isOutside);c!==h&&(r.push(n),n.setFinalIsOutSide(!c));return}e(n.isOutside,!1)!==e(!n.isOutside,!1)&&r.push(n)})),r}function l0t(o,t,e){let r;switch(e){case 0:r=(a,l)=>a&&l;break;case 1:r=(a,l)=>a||l;break;case 2:r=(a,l)=>a&&!l;break;case 3:r=(a,l)=>a&&!l||!a&&l;break;default:throw Error("not support the rule")}let i=new cW(10),n=new cW(10);o.forEach(a=>a.forEach(l=>i.add(l))),t.forEach(a=>a.forEach(l=>n.add(l)));let s=JMe(o,n,r);return JMe(t,i,(a,l)=>r(l,a)).forEach(a=>s.push(a)),s}var c0t=class{constructor(o){this.roots=[],this.nodes=o.sort((t,e)=>t.bbox().minX-e.bbox().minX).map(t=>new h0t(t)),this.nodes.forEach((t,e)=>{t.visit()&&(this.roots.push(t),this.build(e))})}build(o){let t=this.nodes[o];for(let e=o+1,r=this.nodes.length;e<r;e++){let i=this.nodes[e];if(t.key.bbox().maxX<i.key.bbox().minX)break;i.getIsVisit()||t.isContain(i)&&(i.visit(),t.addChild(i),this.build(e))}}getPolygons(){let o=[];return this.roots.forEach(t=>t.getPolygons().forEach(e=>o.push(e))),o}},h0t=class{constructor(o){this.children=[],this.isVisit=!1,this.key=o}getIsVisit(){return this.isVisit}isContain(o){return this.key.isContain(o.key)}addChild(o){this.children.push(o)}getPolygons(){let o=[];return this.getPolylineList(o),o.map(t=>{let e=t[0].polygon;if(e&&e.items.length===t.length){let r=t.map(n=>n.returnPolyline()),i=new Set(e.items);return r.some(n=>!i.has(n))?new p0(r):e}else return new p0(t.map(r=>r.returnPolyline()))})}getPolylineList(o,t){t?(t.push(this.key),t=null):(t=[this.key],o.push(t)),this.children.forEach(e=>e.getPolylineList(o,t))}visit(){return this.isVisit?!1:(this.isVisit=!0,!0)}};function QMe(o){let t="";return o.items.forEach((e,r)=>{let i="$";if(e.items.forEach((n,s)=>{let a="[";if(n.primitives.forEach((l,c)=>{let h="";if(l instanceof Tt)h=`Line,${l.start().x},${l.start().y},${l.end().x},${l.end().y}`;else if(l instanceof mr)h=`Arc,${l.center.x},${l.center.y},${l.startAngle},${l.sweepAngle},${l.rx}`;else if(l instanceof Yi)h=`Bezier,${l.controls.map(u=>`${u.x},${u.y}`).join(",")}`;else throw new Error("not supported");if(c===n.primitives.length-1){a+=`${h}]`;return}a+=`${h},`}),s===e.items.length-1){i+=`${a}$`;return}i+=`${a}_`}),r===o.items.length-1){t+=`${i}`;return}t+=`${i}^`}),console.log(t),t}function e4e(o){let t=o.split("^"),e=[];return t.forEach(i=>{let n=/\$(.*?)\$/,s=i.match(n)[1].split("_"),a=[];s.forEach(c=>{let h=/\[(.*?)\]/,u=c.match(h)[1].split(","),d=[],p=[];for(let g=0;g<u.length;g++){let y=u[g];if(y==="Line"||y==="Arc"||y==="Bezier"){if(d.length){let b=r(d);p.push(b),d.length=0}d.push(y);continue}d.push(Number(y))}d.length&&(p.push(r(d)),d.length=0);let m=sa.build7(p);a.push(m)});let l=new p0(a);e.push(l)}),new Fd(e);function r(i){let n=i[0];if(n==="Line")return new Tt(new Yt(i[1],i[2]),new Yt(i[3],i[4]));if(n==="Arc")return mr.build3(new Yt(i[1],i[2]),i[3],i[4],i[5],i[5]);if(n==="Bezier"){let s=[];for(let a=1;a<i.length;a+=2)s.push(new Yt(i[a],i[a+1]));return new Yi(s)}else throw new Error("not support")}}var u0t=class{constructor(o=1){this.group1Str="$[Line,20193.777980000017,4122.200439600661,20193.77082,4211.848760073709,Arc,20193.972672902382,4211.8487570980205,179.99915535323618,-89.99540000050294,0.2018529024026465,Line,20193.972659672283,4212.050609999989,20193.972660393258,4212.039610000013,Arc,20193.97217289501,4211.848257065248,89.85403133887164,89.99540000041924,0.19135355574930143,Line,20193.78082,4211.848759926291,20193.78897999998,4122.200440479205,Line,20193.78897999998,4122.200440479205,20193.777980000017,4122.200439600661]$",this.group2Str="$[Arc,20209.72784128151,4122.2007625157785,258.46768032837986,-75.66780748375947,4.138846238512183,Line,20205.593935808283,4121.998590004101,20193.97982992629,4121.998600000001,Arc,20193.97983290198,4122.2004529023825,269.9991553532362,-89.99540000050297,0.20185290240401074,Arc,20193.782979999996,4122.20044,180.00375535340328,-180.0000000000027,0.004999999999025513,Arc,20193.979332869207,4122.200952909754,180.15347936671733,89.99540000008247,0.19135355575111057,Line,20193.97983008845,4122.009599999999,20205.603694309226,4122.003828485546,Arc,20209.733142304296,4122.194577876843,182.64475341258483,75.73379999998886,4.133851239977064,Line,20208.900400396684,4118.145470939558,20208.902599535475,4118.156248870184,Arc,20206.972515961093,4108.700057667588,78.46393309088245,-78.46759999998636,9.65115405866796,Arc,20216.618669999996,4108.69944,359.99996825446135,-180,0.004999999999200412,Arc,20206.973015966745,4108.699445349495,359.99996822365375,78.46759999998409,9.640654033253735]$^$[Line,20193.997796883676,4095.399470032799,20205.596133314026,4095.4013992171836,Arc,20209.72470159858,4095.1923799234505,177.10172964919312,-75.64935037184974,4.133855965730166,Arc,20209.73000213952,4095.198565517174,101.5415133143569,75.7293000000185,4.128850963459707,Line,20205.605834328744,4095.395161923586,20193.997203529463,4095.389485743675,Arc,20193.994588809255,4095.197684525904,89.21896662213764,4.544099999999517,0.19181903946188483,Arc,20193.981499796217,4095.1977402038,89.85034659953621,89.9999999995926,0.19135044893494071,Arc,20193.78515,4095.19824,0,-180,0.005,Arc,20193.98200016982,4095.1982398301675,179.99995179248322,-89.99999999974185,0.20185016982129908,Arc,20193.981986624152,4095.198185381971,89.9961078637802,-4.487285276547311,0.2019046184835962]$",this.rule=o}getGroup1(){return e4e(this.group1Str)}getGroup2(){return e4e(this.group2Str)}},U2e=new $J(2),QH=class{getUnion(o,t=!0){return t&&(o=o.map(e=>this.asSameSweep([e])[0])),qpt(xpt,o)}asSameSweep(o){let t=0;return o.forEach(e=>t+=e.area(.01)),t>0?o.map(e=>e.reverse()):o}getSubtraction(o,t){let e=new sW(!1),r=new aW(DJ.rule,U2e,e);for(let i of o){let n=DJ.weight(0);r.addPolyline(i,n)}for(let i of t){let n=DJ.weight(1);r.addPolyline(i,n)}return r.simplify(),e.plGrps}getIntersection(o,t){let e=new sW(!1),r=new aW(wJ.rule,U2e,e);for(let i of o){let n=wJ.weight(0);r.addPolyline(i,n)}for(let i of t){let n=wJ.weight(1);r.addPolyline(i,n)}return r.simplify(),e.plGrps}getMutuallyExclusive(o,t){let e=new sW(!1),r=new aW(M2e.rule,U2e,e);for(let i of o){let n=M2e.weight(0);r.addPolyline(i,n)}for(let i of t){let n=M2e.weight(1);r.addPolyline(i,n)}return r.simplify(),e.plGrps}},eW=0,H2e=!1;function tW(o,t,e,r,i){let n=gW(),s=[],a=[],l=[],c=new Set,h;if(i){if(h=new fW(i),eW++,H2e){debugger;H2e=!1;let I=new u0t;tW(I.rule,I.getGroup1(),I.getGroup2(),r,i)}if(eW===-1||H2e){console.table({rule:o,group1:QMe(t),group2:QMe(e)}),h.clear();let I=h.initColor(Ol.GREEN),C=h.initColor(Ol.WHITE),E=h.initColor(Ol.BLUE),O=h.initColor(Ol.Gray);t.items.forEach(_=>_.items.forEach((x,v)=>{v>0?C.addPly(x):I.addPly(x)})),e.items.forEach(_=>_.items.forEach((x,v)=>{v>0?O.addPly(x):E.addPly(x)})),h.draw();debugger}}let u=t.items.length!==0&&e.items.length!==0?t.bbox().extendOfSize(Qn).intersection1(e.bbox().extendOfSize(Qn)):null;if(u){let I=[],C=[];switch(o){case 0:{for(let E of t.items)E.bbox().isIntersect(u)&&I.push(E);for(let E of e.items)E.bbox().isIntersect(u)&&C.push(E);break}case 1:case 3:{for(let E of t.items)E.bbox().isIntersect(u)?I.push(E):s.push(E);for(let E of e.items)E.bbox().isIntersect(u)?C.push(E):s.push(E);break}case 2:{for(let E of t.items)E.bbox().isIntersect(u)?I.push(E):s.push(E);for(let E of e.items)E.bbox().isIntersect(u)&&C.push(E);break}default:throw new Error("not support")}I.length!==t.items.length&&(t=new Fd(I)),C.length!==e.items.length&&(e=new Fd(C))}else{switch(o){case 0:break;case 1:case 3:{t.items.forEach(I=>s.push(I)),e.items.forEach(I=>s.push(I));break}case 2:{t.items.forEach(I=>s.push(I));break}default:throw new Error("not support")}t=new Fd([]),e=new Fd([])}P(t,a,!0),P(e,l,!1);let d=o===2||o===3?(I,C)=>_n(I.getEnd(),C)?I.nextSide:I:(I,C)=>_n(I.prevSide.getEnd(),C)?I.prevSide:I,p=(I,C,E)=>{if(_n(I.getEnd(),E)){if(I.inters.findIndex(O=>O.getBindedInter().side===C&&_n(O.coord,I.getEnd()))===-1)return new nO(E,I,h)}else return new nO(E,I,h)},m=o===2||o===3?(I,C,E)=>{if(_n(I.getStart(),E)){if(I.inters.findIndex(O=>O.getBindedInter().side===C&&_n(O.coord,I.getStart()))===-1)return new nO(E,I,h)}else return new nO(E,I,h)}:p;r.seek(t,e,(I,C,E,O,_,x)=>{let v=a[I][C],D=l[O][_],w=v.sides[E],F=D.sides[x],H=WT(w.getShape(),F.getShape());if((w.getShape()instanceof Yi||F.getShape()instanceof Yi)&&H>=4){if(w.getShape()instanceof mr||F.getShape()instanceof mr){let V=function(L,k){let N=!1;for(let U=0;U<k.length;U+=2)_n(new Yt(k[U],k[U+1]),L)&&(N=!0);N||k.push(L.x,L.y)},W=[it[0],it[1]];for(let L=0;L<H;L+=2){let k=new Yt(it[L],it[L+1]);for(let N=L+2;N<H;N+=2){let U=new Yt(it[N],it[N+1]);if(!_n(k,U)){V(U,W);break}}}H=W.length,W.forEach((L,k)=>it[k]=L)}else for(let V=H-2;V>=2;V-=2)for(let W=V-2;W>=0;W-=2)if(_n(new Yt(it[V],it[V+1]),new Yt(it[W],it[W+1]))){it[W]=(it[V]+it[W])/2,it[W+1]=(it[V+1]+it[W+1])/2;for(let L=H-3;L>=V;L--)it[L]=it[L+2];H-=2;break}}let z=0;if(H===4){let V=function(k){return _n(w.getEnd(),k)||_n(w.prevSide.getEnd(),k)||_n(F.prevSide.getEnd(),k)||_n(F.getEnd(),k)},W=new Yt(it[0],it[1]),L=()=>{let k=new nO(W,w,h),N=new nO(W,F,h);k.bind(N),k.setIsInvalid(),k.isDealed(),v.inters.push(k),D.inters.push(N)};if(it[0]===it[2]&&it[1]===it[3])if(V(W))z=2;else{L();return}}for(;z<H;z+=2){let V=new Yt(it[z],it[z+1]),W=w,L=F;if(_n(W.prevSide.getEnd(),V)&&(W=W.prevSide),L=d(L,V),w!==W&&F!==L){let N=o===2||o===3?F.getEnd():L.getEnd();W.getEnd().distance1(V)<N.distance1(V)?(V=W.getEnd(),_n(N,V)||(L=F)):(V=N,_n(W.getEnd(),V)||(W=w))}let k=p(W,L,V);if(k){let N=m(L,W,V);N&&(W.addInter(k),v.inters.push(k),L.addInter(N),D.inters.push(N),k.bind(N),v.intersect(D,c))}}return H},i);let g=T(),y=l0t(a,l,o);y.forEach(I=>!I.startAndEndIsSameOutsideFlag()&&I.reverse()),new c0t(g.concat(y)).getPolygons().forEach(I=>s.push(I));let b=new Fd(s);if(h){if(eW===-1){let I=h.initColor(Ol.RED),C=h.initColor(Ol.Golden);s.forEach(E=>{I.addPly(E.items[0]),E.items.slice(1).forEach(O=>C.addPly(O))}),h.draw();debugger;throw new Error}b.id=eW}return O9.BooleanTools+=Z_(n),b;function P(I,C,E){I.items.forEach(O=>{let _=[];_.push(G2e.build(O.items[0],E,!0,h,O)),O.items.slice(1).forEach(x=>{_.push(G2e.build(x,E,!1,h))}),C.push(_)})}function T(){let I=[];return c.forEach(E=>{o===2||o===3?E.forEach(_=>{_.isGroup1||_.reverse(),_.sides.forEach(x=>x.sortInters())}):E.forEach(_=>_.sides.forEach(x=>x.sortInters())),E.map(_=>_.sides.filter(x=>x.inters.length)).flat(2).sort((_,x)=>{let v=_.inters,D=x.inters,w=_n(v[v.length-1].coord,_.getEnd()),F=_n(D[D.length-1].coord,x.getEnd());if(w&&F){let H=0,z=0;for(let V=v.length-2;V>=0&&_n(v[V].coord,_.getEnd());V--)H++;for(let V=D.length-2;V>=0&&_n(D[V].coord,x.getEnd());V--)z++;return z-H}else return w?-1:1}).forEach(_=>{_.inters.forEach(x=>{if(x.dealed)return;let v=x.side,D=x.getBindedInter().side,w;_n(v.getEnd(),x.coord)&&_n(D.getEnd(),x.coord)?w=-1:_n(v.getEnd(),x.coord)?(w=1,x=x.getBindedInter()):_n(D.getEnd(),x.coord)&&(w=1);let F=a0t(w,x,o,h);x.isDealed(),F&&(v.outline.setAllInterIsInvalidToFalse(),D.outline.setAllInterIsInvalidToFalse())})}),O(E),o===3&&(E.forEach(_=>{_.reverse(),_.sides.forEach(x=>{x.sortInters(),x.inters.forEach(v=>{v.resetVisitStatus()})})}),O(E));function O(_){_.forEach(x=>{x.inters.forEach(v=>{if(v.isInvalid||v.getVisited())return;let D=v.findStartInter(),w=C(o)?D.run():D.getBindedInter().run(),F=x.polyline.primitives;if(w){if(F.length===w.primitives.length){let H=new Set(F);if(!w.primitives.some(z=>!H.has(z))){I.push(x);return}}I.push(G2e.build(w,!0,!0,h))}})})}}),I;function C(E){switch(E){case 0:case 2:case 3:return!0;case 1:return!1;default:throw Error("not support the rule")}}}}var AJ=/\bstablilizetion\b/.test(self.location.href)||!0,_J={intersect(o,t,e,r){try{return tW(0,o,t,e,r)}catch(i){if(AJ){let n=new QH().getIntersection(o.items.map(s=>s.items.map(a=>a)).flat(2),t.items.map(s=>s.items.map(a=>a)).flat(2));return new Fd(n.map(s=>new p0(s.items)))}throw i}},union(o,t,e,r){try{return tW(1,o,t,e,r)}catch(i){if(AJ){let n=new QH,s=o.items.map(l=>l.items.map(c=>c)).flat(2);t.items.forEach(l=>l.items.forEach(c=>s.push(c)));let a=n.getUnion(s);return new Fd(a.map(l=>new p0(l.items)))}throw i}},diff(o,t,e,r){try{return tW(2,o,t,e,r)}catch(i){if(AJ){let n=new QH().getSubtraction(o.items.map(s=>s.items.map(a=>a)).flat(2),t.items.map(s=>s.items.map(a=>a)).flat(2));return new Fd(n.map(s=>new p0(s.items)))}throw i}},xor(o,t,e,r){try{return tW(3,o,t,e,r)}catch(i){if(AJ){let n=new QH().getMutuallyExclusive(o.items.map(s=>s.items.map(a=>a)).flat(2),t.items.map(s=>s.items.map(a=>a)).flat(2));return new Fd(n.map(s=>new p0(s.items)))}throw i}}},d0t=class extends aW{constructor(o,t,e,r,i,n){super(o.rule,$J.DUMMY,t),this.sideGroup1=[],this.sideGroup2=[],this.group1=e,this.group2=r,this.seeker=i,this.addGroup(e,o.weight(0),this.sideGroup1),this.addGroup(r,o.weight(1),this.sideGroup2),this.bus=n}addGroup(o,t,e){if(!o)debugger;o.items.forEach(r=>{let i=[];r.items.forEach(n=>{let s=this.sides.length;this.addPolyline(n,t),i.push(this.sides.slice(s))}),e.push(i)})}seekIntersection(){this.seeker.seek(this.group1,this.group2,(o,t,e,r,i,n)=>{let s=this.sideGroup1[o][t][e],a=this.sideGroup2[r][i][n],l=WT(s.shape,a.shape);for(let c=0;c<l;c+=2){let h=new Yt(it[c],it[c+1]);s.inters.push(h),a.inters.push(h),this.event.onIntersect(h,s,a)}return l},this.bus)}},p0t=class extends sW{constructor(o){super(!!o),o&&(this.drawDebug=new fW(o),this.blueDrawing=this.drawDebug.initColor(Ol.BLUE),this.greenDrawing=this.drawDebug.initColor(Ol.GREEN),this.redDrawing=this.drawDebug.initColor(Ol.RED))}onOriginSide(o){super.onOriginSide(o),this.debug&&this.blueDrawing.addPt(o.shape)}onPolylineGroup(o,t){super.onPolylineGroup(o,t),this.debug&&o.items.forEach(e=>this.greenDrawing.addPly(e))}draw(){this.drawDebug.draw()}};function W2e(o,t,e,r,i){let n=gW(),s=new p0t(i);new d0t(o,s,t,e,r,i).simplify();let a=[];s.plGrps.forEach(c=>{let h=c.items.map(u=>zJ(u));h[0]&&a.push(new p0(h.filter(u=>u)))});let l=new Fd(a);return O9.BooleanTools+=Z_(n),l}var z2e=!0,$H={intersect(o,t,e,r){try{return _J.intersect(o,t,e,r)}catch(i){if(z2e)throw i;return console.error(i),W2e(wJ,o,t,e,r)}},union(o,t,e,r){try{return _J.union(o,t,e,r)}catch(i){if(z2e)throw i;return console.error(i),W2e(Rpt,o,t,e,r)}},diff(o,t,e,r){try{return _J.diff(o,t,e,r)}catch(i){if(z2e)throw i;return console.error(i),W2e(DJ,o,t,e,r)}},xor(o,t,e,r){return _J.xor(o,t,e,r)}},f0t=class{init(o){}seek(o,t,e,r){let i=o.bbox().extendOfSize(5e-6).intersection1(t.bbox().extendOfSize(5e-6));if(!i)return;let n=gW(),s=[];for(let d=0,p=o.items.length;d<p;d++){let m=o.items[d];if(i.isIntersect(m.bbox()))for(let g=0,y=m.items.length;g<y;g++){let b=m.items[g];if(i.isIntersect(b.bbox()))for(let P=0,T=b.primitives.length;P<T;P++){let I=b.primitives[P].bbox();i.isIntersect(I)&&s.push({bbox:I,polygonIndex:d,polylineIndex:g,ptIndex:P})}}}let a=s.length;if(a===0){O9.IntersectionSeeker+=Z_(n);return}let l=[];for(let d=0,p=t.items.length;d<p;d++){let m=t.items[d];if(i.isIntersect(m.bbox()))for(let g=0,y=m.items.length;g<y;g++){let b=m.items[g];if(i.isIntersect(b.bbox()))for(let P=0,T=b.primitives.length;P<T;P++){let I=b.primitives[P].bbox();i.isIntersect(I)&&l.push({bbox:I,polygonIndex:d,polylineIndex:g,ptIndex:P})}}}let c=l.length;if(c===0){O9.IntersectionSeeker+=Z_(n);return}if(a<5||c<5){for(let d=0,p=s.length;d<p;d++)for(let m=0,g=l.length;m<g;m++)if(s[d].bbox.isIntersect(l[m].bbox.extendOfSize(1e-5))){let y=s[d],b=l[m];e(y.polygonIndex,y.polylineIndex,y.ptIndex,b.polygonIndex,b.polylineIndex,b.ptIndex)}O9.IntersectionSeeker+=Z_(n);return}s.sort((d,p)=>d.bbox.minX-p.bbox.minX),l.sort((d,p)=>d.bbox.minX-p.bbox.minX);let h=0,u=0;for(;h<a&&u<c;)if(s[h].bbox.minX<l[u].bbox.minX){let d=s[h],p=d.bbox;for(let m=u;m<c;m++){let g=l[m],y=g.bbox;if(y.minX>p.maxX+1e-5)break;(p.minY<y.minY?y.minY:p.minY)<(p.maxY<y.maxY?p.maxY:y.maxY)+1e-5&&e(d.polygonIndex,d.polylineIndex,d.ptIndex,g.polygonIndex,g.polylineIndex,g.ptIndex)}h++}else{let d=l[u],p=d.bbox;for(let m=h;m<a;m++){let g=s[m],y=g.bbox;if(y.minX>p.maxX+1e-5)break;(y.minY<p.minY?p.minY:y.minY)<(y.maxY<p.maxY?y.maxY:p.maxY)+1e-5&&e(g.polygonIndex,g.polylineIndex,g.ptIndex,d.polygonIndex,d.polylineIndex,d.ptIndex)}u++}O9.IntersectionSeeker+=Z_(n)}},K1,Km=(K1=class{static getDebug(){return K1.drawDebug||(K1.drawDebug=new fW(K1.curBus)),K1.drawDebug}static getDrawing(o=Ol.GREEN){return this.getDebug().initColor(o)}static clearDrawing(){K1.getDebug().clear()}static drawText(o,t,e=Ol.GREEN){K1.getDrawing(e).addText(o,t,1.5,.1,!0)}static drawBBox(o,t=Ol.GREEN){if(!o)return;let e=K1.getDrawing(t),r=new Tt(o.UL(),o.UR()),i=new Tt(o.UR(),o.LR()),n=new Tt(o.LR(),o.LL()),s=new Tt(o.LL(),o.UL());e.addPt(r),e.addPt(i),e.addPt(n),e.addPt(s)}static drawPolyType(o,t){let e=K1.getDrawing(t);if(o instanceof sa)e.addPly(o);else if(o instanceof p0)for(let r of o.items)r instanceof sa?e.addPly(r):this.drawPolyType(r,t);else if(o instanceof Fd)for(let r of o.items)this.drawPolyType(r,t)}static translate(o){switch(o){case 0:return"\u2229";case 2:return"-";case 1:return"U";case 3:return"X";default:break}}},K1.UseRunArrange=!0,K1.UseOptimizeSplit=!0,K1.LocalBestThread=4,K1.HandleDiff=!0,K1.OcTreeSplitStep=4,K1.PrintStart=new Yt(150,-200),K1),KH=class sbe{static getPolyTypeLine(t){let e=[];if(t instanceof sa)for(let r of t.primitives)e.push(r);else if(t instanceof p0)for(let r of t.items)if(r instanceof sa)for(let i of r.primitives)e.push(i);else{let i=this.getPolyTypeLine(r);for(let n of i)e.push(n)}else if(t instanceof Fd)for(let r of t.items){let i=this.getPolyTypeLine(r);for(let n of i)e.push(n)}return e}static getPolyTypePolyLine(t){let e=[];if(t instanceof sa)e.push(t);else if(t instanceof p0)for(let r of t.items)if(r instanceof sa)e.push(r);else{let i=this.getPolyTypePolyLine(r);for(let n of i)e.push(n)}else if(t instanceof Fd)for(let r of t.items){let i=this.getPolyTypePolyLine(r);for(let n of i)e.push(n)}return e}static getListBBox(t){if(t.length<=0)return;let e=new ib;for(let r of t){let i=sbe.getSingleBBox(r);e.ext1(i)}return e.build1()}static getSingleBBox(t){if(t instanceof Array){let e=new ib,r=sbe.getListBBox(t.slice(1));return e.ext1(r),e.build1()}else return t.bbox()}static doDrawRule(t,e=Km.PrintStart){if(t.length<2)return[e,e,e];let r=5,i=10,n=t[0],s=Km.translate(n),a=[],l=e.y,c=e.x,h=e.x;e=e.add(new Yt(0,-i));for(let p=1;p<t.length;p++){let m=t[p];if(m instanceof Array){e=e.add(new Yt(r,0));let g=this.doDrawRule(m,e);a.push(g[0]),g[1].x<=c&&(c=g[1].x),g[2].x>=h&&(h=g[2].x),e=new Yt(g[2].x+r,e.y)}else a.push(e.clone()),e.x<=c&&(c=e.x),e.x>=h&&(h=e.x),Km.drawText(e,m.name),e=e.add(new Yt(r,0))}let u=0;for(let p of a)u+=p.x;let d=new Yt(u/a.length,e.y+i);Km.drawText(d,"N:"+s);for(let p of a){let m=new Tt(p,d),g=new Array;g.push(m);let y=sa.build1(Z2e(g));Km.drawPolyType(y,Ol.GREEN)}return[d,new Yt(c,l),new Yt(h,l)]}static drawRule(t,e=Km.PrintStart,r=!1,i){Km.clearDrawing(),this.doDrawRule(t,e),r&&this.doDrawRulePolygon(t,i),Km.getDebug().draw()}static doDrawRulePolygon(t,e){let r=t[0];for(let i=1;i<t.length;i++){let n=t[i];if(n instanceof Array)this.doDrawRulePolygon(n,e);else{let s=e;r===2&&i===1&&(s=Ol.RED),n.name&&Km.drawText(n.bbox().UL(),n.name,s),Km.drawPolyType(n,s)}}}static IsCenterBBoxPointInPolygonType(t,e){let r=t.center();for(let i of e.items)if(i.getOutMostPolyline().getWindingNum(r))return!0;return!1}static KeepBBoxPolygonGroup(t,e){let r=e.bbox().intersection1(t);if(!r)return!1;for(let i of e.items)if(i.bbox().isIntersect(r)){for(let n of i.items)if(n.bbox().isIntersect(r)){for(let s of n.primitives)if(r.isIntersect(s.bbox()))return!0}}return!!this.IsCenterBBoxPointInPolygonType(t,e)}},m0t=class pN{static createNode(t,e,r){let i=t.UL(),n=t.width()/e,s=t.height()/e,a=~~(r/e),l=r-a*e,c=i.x+l*n,h=i.y-(a+1)*s,u=c+n,d=h+s;return new Wg(c,u,h,d)}static ocTreeSplitNode(t,e,r,i,n=2){if(t.length<=r)return t;let s=[],a=n**2,l=new Array(a),c=new Array(a);for(let p=0;p<a;p++)l[p]=new Array(t.length),c[p]=0;let h=e.UL(),u=e.width()/n,d=e.height()/n;for(let p of t){let m=i(p).center(),g=~~((m.x-h.x)/u),y=~~((h.y-m.y)/d)*n+g;try{l[y][c[y]]=p,c[y]+=1}catch{s.push(p)}}for(let p=0;p<l.length;p++){let m=c[p];if(m<=0)continue;let g=l[p].slice(0,m);if(g.length===t.length)return t;let y=pN.createNode(e,n,p),b=pN.ocTreeSplitNode(g,y,r,i,n);if(b.length===t.length)return t;s.push(b)}return s}static ocTreeSplitNodeMinIntersect(t,e,r,i){let n=[];if(t.length<=r)return t;let s=3,a=e.LL(),l=e.UR(),c=e.width()/(s+1),h=e.height()/(s+1),u=-(2**32),d=[],p=[];for(let m=1;m<=s;m++)for(let g=1;g<=s;g++){let y=a.x+c*m,b=a.y+h*g,P=[[],[],[],[]],T=new Array(4),I=new Array(4);I[0]=new Wg(a.x,y,b,l.y),I[1]=new Wg(y,l.x,b,l.y),I[2]=new Wg(a.x,y,a.y,b),I[3]=new Wg(y,l.x,a.y,b);for(let _ of t){let x=i(_).center(),v=-1,D=-1;x.x===y?v=Math.random()>=.5?1:-1:x.x>y?v=1:x.x<y&&(v=-1),x.y===b?D=Math.random()>=.5?1:-1:x.y>b?D=1:x.y<b&&(D=-1),v===1&&D===1?P[1].push(_):v===1&&D===-1?P[3].push(_):v===-1&&D===-1?P[2].push(_):v===-1&&D===1&&P[0].push(_)}for(let _=0;_<4;_++){let x=P[_];if(x.length<=0)continue;let v=new ib;for(let D of x)v.ext1(i(D));T[_]=v.build1()}let C=0,E=0;for(let _ of T)_&&(C+=_.area());E=C;let O=(_,x)=>{if(!T[_]||!T[x])return 0;let v=T[_].intersection1(T[x]);return v?v.area():0};E-=O(0,1),E-=O(0,2),E-=O(0,3),E-=O(1,2),E-=O(1,3),E-=O(2,3),E/C>=u&&(d=P,p=I)}for(let m=0;m<d.length;m++){let g=d[m];if(g.length<=0)continue;let y=p[m],b;if(g.length===t.length?b=pN.ocTreeSplitNode(g,y,r,i):b=pN.ocTreeSplitNodeMinIntersect(g,y,r,i),b.length===t.length)return t;n.push(b)}return n}static ocTreeSplit(t,e,r,i){return pN.ocTreeSplitNode(t,e,r,i,Km.OcTreeSplitStep)}},g0t=class B4e{static simplifyRules(t,e){return Km.UseOptimizeSplit&&(t=this.optimizeSplit(t,e)),t}static OcTreeOptimizeSplit(t){let e=t[0];if(e!==1||t.length<=Km.LocalBestThread+1)return t;let r=t.slice(1),i=new Array(r.length);for(let c=1;c<t.length;c++)i[c-1]=c;let n=KH.getListBBox(r),s=m0t.ocTreeSplit(i,n,Km.LocalBestThread,c=>{let h=t[c];return KH.getSingleBBox(h)}),a=(c,h)=>{if(!(c.length<=0))for(let u of c)if(Array.isArray(u)){let d=[h[0]];a(u,d),h.push(d)}else{let d=t[u];h.push(d)}},l=[e];return a(s,l),l}static optimizeSplit(t,e){let r=t[0];if(r===2){if(Km.HandleDiff){let n=t[1],s;if(Array.isArray(n)){let a=this.optimizeSplit(n,e);if(a.length<=1)return[2];s=abe(a,e)}else s=abe([2,n],e);if(t.length>3){let a;a=[1];for(let l=2;l<t.length;l++){let c=t[l];if(Array.isArray(c)){let h=KH.getListBBox([...c.slice(1)]);KH.KeepBBoxPolygonGroup(h,s)&&a.push(c)}else KH.KeepBBoxPolygonGroup(c.bbox(),s)&&a.push(c)}return a.length<=1?[2,s]:(a=this.optimizeSplit(a,e),a.length>1?[2,s,...a.slice(1)]:[2,s])}else{let a=t[2];if(Array.isArray(a)&&a[0]===1&&a.length>2){let l=a.slice(1);return this.optimizeSplit([2,s,...l],e)}}}else if(t.slice(1).length>2){let n=t[1],s=t.slice(2),a=this.optimizeSplit([1,...s],e);return a.length>1?[2,n,...a.slice(1)]:n}}else if(r===1){if(t.length-1>Km.LocalBestThread){let n=!1;for(let s=1;s<t.length;s++){let a=t[s];if(!Array.isArray(a)){n=!0;break}}n&&(t=B4e.OcTreeOptimizeSplit(t))}}else if(r===0&&t.length<=2)return[0];let i=[r];for(let n=1;n<t.length;n++){let s=t[n];if(Array.isArray(s)){let a=this.optimizeSplit(s,e);if(a.length<=1)continue;i.push(a)}else i.push(s)}return i}},y0t=(o=>(o[o.INTERSECT=0]="INTERSECT",o[o.UNION=1]="UNION",o[o.DIFF=2]="DIFF",o[o.XOR=3]="XOR",o))(y0t||{});function rW(o){let t=o[0],e=[t];switch(t){case 0:for(let i=1;i<o.length;i++){let n=o[i];if(Array.isArray(n)&&(n=rW(n),!n))return null;e.push(n)}break;case 1:case 3:for(let i=1;i<o.length;i++){let n=o[i];Array.isArray(n)&&(n=rW(n),!n)||e.push(n)}break;case 2:let r=o[1];if(Array.isArray(r)&&(r=rW(r)),!r)return null;e.push(r);for(let i=2;i<o.length;i++){let n=o[i];Array.isArray(n)&&(n=rW(n),!n)||e.push(n)}break;default:throw new Error("not support boolean rule!")}return e.length===1?null:e}function Y2e(o,t,e){return Array.isArray(o)?F4e(o,t,e):o}function j2e(o,t,e,r,i=!0){if(i)for(;o.length>1;){let n,s=[];for(o.length%2===1?(s.push(o[0]),n=1):n=0;n<o.length;n+=2)s.push(t(o[n],o[n+1],e,r));o=s}else for(;o.length>1;){if(o.length===2)return t(o[0],o[1],e,r);o=[t(o[0],o[1],e,r),...o.slice(2)]}return o[0]}function F4e(o,t,e,r=!0){let i=new Array(o.length-1);for(let n=1;n<o.length;n++)i[n-1]=Y2e(o[n],t,e);switch(o[0]){case 0:return j2e(i,$H.intersect,t,e);case 1:return j2e(i,$H.union,t,e);case 2:let n=j2e(i.slice(1),$H.union,t,e);return n?$H.diff(i[0],n,t,e):i[0];case 3:let s=Y2e(o[1],t,e);for(let a=2;a<o.length;a++)s=$H.xor(s,Y2e(o[a],t,e),t,e);return s;default:throw new Error("not support boolean rule! "+o[0])}}function V4e(o){let t=[o[0]];for(let e=1;e<o.length;e++){let r=o[e];if(Array.isArray(r)){let i=V4e(r);Array.isArray(i)?i.length>1&&t.push(i):t.push(i)}else{let i=zJ(r);i!==null&&t.push(Fd.build(i))}}return t}function b0t(o,t){Km.curBus=t,o=V4e(o);let e;return Km.UseRunArrange?e=g0t.simplifyRules(o,t):e=rW(o),e.length<=1?new Fd([]):abe(e,t)}function abe(o,t,e=!0){if(!o||o.length===1)return new Fd([]);let r=o,i=new f0t,n=[];function s(a){for(let l=1;l<a.length;l++){let c=a[l];Array.isArray(c)?s(c):n.push(c)}}return s(r),i.init(n),F4e(r,i,t,e)}var vJ=new Error("list is empty"),xJ=class{constructor(o,t){this.prev=null,this.next=null,this.parent=o,this.item=t}insertAfter(o){o.next=this.next,this.next=o,o.prev=this,o.next!==null&&(o.next.prev=o)}insertBefore(o){o.prev=this.prev,this.prev=o,o.next=this,o.prev!==null&&(o.prev.next=o)}remove(){this.prev!==null&&(this.prev.next=this.next),this.next!==null&&(this.next.prev=this.prev)}set(o){this.item=o}},P0t=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o.item;throw new Error("iterator is null")}},T0t=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o;throw new Error("iterator is null")}},I0t=class{constructor(){this.first=null,this.last=null,this.cnt=0}add(o){return this.addLast(o)}push(o){return this.addLast(o)}pop(){return this.removeLast()}shift(){return this.removeFirst()}removeFirst(){let o=this.first;if(o===null)throw vJ;return this.remove(o),o.item}removeLast(){let o=this.last;if(o===null)throw vJ;return this.remove(o),o.item}addLast(o){if(this.first===null||this.last===null){let t=new xJ(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertAfter(this.last,o)}addFirst(o){if(this.first===null||this.last===null){let t=new xJ(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertBefore(this.first,o)}getFirst(){if(this.first===null)throw vJ;return this.first.item}getLast(){if(this.last===null)throw vJ;return this.last.item}insertAfter(o,t){let e=new xJ(this,t);return o.insertAfter(e),o===this.last&&(this.last=e),this.cnt++,e}insertBefore(o,t){let e=new xJ(this,t);return o.insertBefore(e),o===this.first&&(this.first=e),this.cnt++,e}remove(o){o.remove(),o===this.first&&(this.first=o.next),o===this.last&&(this.last=o.prev),this.cnt--}size(){return this.cnt}clear(){this.first=null,this.last=null,this.cnt=0}iterator(){return new P0t(this.first)}listIterator(){return new T0t(this.first)}toArray(){let o=new Array,t=this.first;for(;t!=null;)o.push(t.item),t=t.next;return o}},MJ=class{constructor(o){this.inters=[],o&&(this.inters=o)}addInter(o){this.inters.push(o),o.group=this}findInter(o){let t=this.inters.find(e=>_n(e.coord,o.coord));return t&&this.inters.find(e=>e.side===o.side)&&o.visitSelf(),t}getOutInter(o){let t=this.inters.filter(e=>!e.getVisited());if(t.length!==0)return t.length===1?t[0]:t.reduce((e,r)=>{if(!e||e.side.getShape()===o)return r;if(r.side.getShape()===o)return e;let i=e.coord,n=Jn(o,i),s=Jn(e.side.getShape(),i),a=Jn(r.side.getShape(),i);return n.dot(s)>n.dot(a)?e:r},void 0)}getEntryInter(){}},X2e=0;function G4e(o,t){let e=o.primitives[0];if(o.primitives.length===1&&e instanceof mr&&Math.abs(e.sweepAngle)===360)return[o];let r=gW();X2e++;let i,n=R0t(o);if(n.length===0)return[];let s=E0t(n);if(X2e===-1){i=new fW(t);let h=i.initColor(Ol.BLUE);n.forEach(d=>h.addPt(d.getShape()));let u=i.initColor(Ol.GREEN);s.forEach(d=>u.addPoint(d.coord)),i.draw();debugger;throw new Error}if(s.length===0)return[sa.build7(n.map(h=>h.getShape()))];O0t(s);let a=[],l=!1;try{v0t(s,i)}catch(h){h.customType==="IS_OVERLAP"?(l=!0,a=new QH().getUnion([o]).map(u=>u.items).flat(2)):console.error(h)}if(l)return a;let c=_0t(s);if(!c.length)return[sa.build7(n.map(h=>h.getShape()))];if(a=C0t(c,i),a.length===0)return console.warn("=====deSelfIntersection=====",X2e),[];if(i)throw a.forEach(h=>{i.initColor(Ol.WHITE).addPly(h),i.draw();debugger}),new Error;return O9.deSelfIntersection+=Z_(r),a}function C0t(o,t){let e=[];return o.forEach(r=>{let i=r;r.inters.forEach(n=>{if(n.getVisited())return;let s=[],a=[],l;if(t){debugger;let h=t.initColor(Ol.RED);l=u=>{s.push(u),h.addPt(s[s.length-1]),t.draw();debugger}}else l=h=>s.push(h);do{let h=function(g,y){yr.eq(g.distance2(y),0)||l(U4e(p.getShape(),g,y))},u=a.findIndex(g=>g===n.group);if(u!==-1){let g=s.findIndex(P=>P===n.group),y=s.splice(g).filter(P=>!(P instanceof MJ));if(y.length){let P=ev(sa.build7(y));P&&e.push(P)}let b=s.filter(P=>!(P instanceof MJ));if(n=a[u].getOutInter(b[b.length-1]),a.splice(u),!n)throw Error("interGroup not hav inter!!!2");continue}n.visitSelf(),a.push(n.group),s.push(n.group);let d=n.getIndex(),p=n.side,m=p.inters[d+1];for(;m!=null&&m.isInvalid||m&&m.group===n.group;)m=p.inters[m.getIndex()+1];if(m){h(n.coord,m.coord);let g=m.getBindedInter();if(n=g.getVisited()?g.group.getOutInter(g.side.getShape()):g,!n){if(m.group===i)break;throw new Error("interGroup not hav inter!!!3")}}else{for(h(n.coord,p.getEnd()),p=p.nextSide,n=null;;){for(let g of p.inters)if(!g.isInvalid){let y=g.group.getOutInter(p.getShape());if(!y){if(g.group===i){n=g;break}else if(g.getBindedInter().group===i){n=g.getBindedInter();break}continue}n=y;break}if(n)break;l(p.getShape()),p=p.nextSide}yr.eq(p.getEnd().distance2(n.coord),0)?l(p.getShape()):h(p.getStart(),n.coord)}}while(n.group!==i);let c=ev(sa.build7(s.filter(h=>!(h instanceof MJ))));c&&e.push(c)})}),e}function S0t(o){return{next(){return o.hasNext()?{value:o.next()}:{done:!0,value:void 0}},[Symbol.iterator](){return this}}}function E0t(o){let t=[],e=new I0t;for(let r of o.slice().sort((i,n)=>i.bbox().minY-n.bbox().minY)){for(let i of S0t(e.listIterator())){let n=i.item;if(n.bbox().maxY<r.bbox().minY)e.remove(i);else{let s=function(d,p){let m=new nO(p,d,null);return d.inters.push(m),t.push(m),m},a=function(d,p){let m=d.getEnd(),g=new Yt(it[0],it[1]),y=new Yt(it[2],it[3]),b=m.distance2(g)>m.distance2(y)?g:y,P=d.prevSide;s(_n(P.getEnd(),b)?P:d,b).bind(s(p,b))},l=n.getShape(),c=r.getShape(),h=WT(l,c),u=h===4&&it[0]===it[2]&&it[1]===it[3];if(u&&(h-=2),n.nextSide===r)n.prevSide!==r&&h===4&&a(n,r);else if(n.prevSide===r)h===4&&a(r,n);else if(h!==0){let d=function(m,g){let y=m.prevSide;return s(_n(y.getEnd(),g)?y:m,g)},p=new Yt(it[0],it[1]);if(u&&!_n(p,n.prevSide.getEnd())&&!_n(p,r.prevSide.getEnd())&&Jn(l,p).dot(Jn(c,p))>0)continue;for(let m=0;m<h;m+=2){let g=new Yt(it[m],it[m+1]);d(n,g).bind(d(r,g))}}}}e.add(r)}return t.forEach(r=>{r.getIndex()===void 0&&r.side.sortInters()}),t}function O0t(o){o.forEach(t=>{let e=t.side.getEnd();if(t.isInvalid||!_n(t.coord,e))return;let r=t.side.inters,i=t.getBindedInter().side;for(let n=r.length-1;n>=0;n--){let s=r[n];if(!_n(s.coord,e))break;s!==t&&s.getBindedInter().side===i&&s.setIsInvalid()}})}function A0t(o){let t=new cW(10);return o.forEach(e=>{e.isInvalid||t.add(e)}),t}function _0t(o){let t=[],e=A0t(o);return o.forEach(r=>{if(r.isInvalid||r.group)return;let i=e.search(r.bbox().extendOfSize(yr.eps)).filter(n=>!n.group);if(i.length){let n=new Set,s=new MJ(i);i.forEach(a=>{a.group=s,n.has(a.side)&&a.visitSelf(),n.add(a.side)}),t.push(s)}}),t}function v0t(o,t){o.forEach(e=>{if(e.isInvalid||e.dealed)return;let r=e.side,i=e.getBindedInter().side,n;_n(r.getEnd(),e.coord)&&_n(i.getEnd(),e.coord)?n=-1:_n(r.getEnd(),e.coord)?r.nextSide!==i&&(n=1,e=e.getBindedInter()):_n(i.getEnd(),e.coord)&&i.nextSide!==r&&(n=1),x0t(n,e,t),e.isDealed()})}function x0t(o,t,e){let r=t.getBindedInter(),i=t.side,n=r.side,s=i.getShape(),a=n.getShape(),l=1,c=!1;if(o===-1){if(sN(s.reverse(),a.reverse())||sN(i.nextSide.getShape(),n.nextSide.getShape())){let u=rO(i,i.nextSide,n,r,l,c,e);if(u.state===2){let p=new Error("info1.state === InState.IS_OVERLAP");throw p.customType="IS_OVERLAP",p}let d=rO(i,i.nextSide,n.nextSide,r,l,c,e);u.state===d.state&&h(u,d)}else if(!(sN(s.reverse(),n.nextSide.getShape())||sN(i.nextSide.getShape(),a.reverse()))){let u=F2e(i,i.nextSide,n,!1,e);u===F2e(i,i.nextSide,n.nextSide,!0,e)&&u!==F2e(n,n.nextSide,i.nextSide,!0,e)&&t.setIsInvalid()}}else if(o===1){let u=function(d,p){return Jn(d,p.start()).dot(Jn(p,p.start()))>0};if(sN(s.reverse(),a.reverse())||sN(s,n.nextSide.getShape())){let d=PP(i,n,r,e,l,c,new Map);if(d.state===2){let m=new Error("info1.state === InState.IS_OVERLAP");throw m.customType="IS_OVERLAP",m}let p=PP(i,n.nextSide,r,e,l,c,new Map);d.state===p.state&&h(d,p)}else if(u(s.reverse(),a.reverse())&&u(s,n.nextSide.getShape())){let d=Ef(i,n,!1,e);d===Ef(i,n.nextSide,!0,e)&&d!==Vw(n,n.nextSide,new mW(U4e(s,t.coord,s.end()),e),!0,e)&&t.setIsInvalid()}}function h(u,d){u.inter.setIsInvalid(),d.inter.setIsInvalid(),t.setIsInvalid()}}function U4e(o,t,e){if(o instanceof Tt||t.distance2(e)<1e-6)return new Tt(t,e);if(o instanceof mr)return mr.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.sweep());if(o instanceof Yi){let r=o.getPercent(t,Qn),i=o.getPercent(e,Qn);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}function R0t(o){let t=ev(o);if(!t)return[];let e=t.primitives.map(i=>new mW(i,null)),r=e[e.length-1];return e.forEach(i=>{r.connect(i),r=i}),e}var cN,D0t=(cN=class{static clearData(o){this.originalPrimitive=[],this.offsetPrimitive=[],this.rawOffsetPrimitive=[],this.offsetDistance=0,this.testI++,this.testI===0?this.drawDebug=new fW(o):delete this.drawDebug}static createRawOffsetEdge(){if(this.drawDebug){let o=this.drawDebug.initColor(Ol.WHITE);this.originalPrimitive.forEach(t=>o.addPt(t)),this.drawDebug.draw();debugger}for(let o=0;o<this.originalPrimitive.length;o+=1){let t=this.originalPrimitive[o];this.offsetPrimitive.push({index:o,offsetEdge:this.createOffsetEdge(t)})}if(this.drawDebug){let o=this.drawDebug.initColor(Ol.Golden);this.offsetPrimitive.forEach(t=>o.addPt(t.offsetEdge)),this.drawDebug.draw();debugger}if(this.offsetPrimitive.length>1)for(let o=0;o<this.offsetPrimitive.length;o+=1)if(o===this.offsetPrimitive.length-1){this.connectPrimitive(this.offsetPrimitive[o],this.offsetPrimitive[0]);let t=this.rawOffsetPrimitive[0],e;t instanceof mr?e=mr.build4(this.offsetPrimitive[0].offsetEdge.start(),t.end(),t.center,t.rx,t.ry,t.sweep()):e=new Tt(this.offsetPrimitive[0].offsetEdge.start(),t.end()),this.rawOffsetPrimitive.shift(),this.rawOffsetPrimitive.unshift(e)}else this.connectPrimitive(this.offsetPrimitive[o],this.offsetPrimitive[o+1]);else this.rawOffsetPrimitive=[]}static createCirclePrimitive(o,t){let e=o.width()*.5,r=o.height()*.5,i=Math.sqrt(e**2+r**2)+t;return[mr.buildCircle(o.center(),i)]}static getExtendPolyLine(o,t,e=!0,r){var i,n;if(!((i=o==null?void 0:o.primitives)!=null&&i.length))return[];let s=ev(o);if(!((n=s==null?void 0:s.primitives)!=null&&n.length)){if(this.isExpansion){let l=[1],c=t*2;o.primitives.forEach(u=>l.push(u.stroke(c,1,0)));let h=b0t(l,r);if(h.items.length!==1)throw new Error("group.items.length !== 1 ");return[h.items[0].items[0]]}return[]}if(o=s,this.clearData(r),this.originalPrimitive=o.primitives,this.isExpansion=t>0,this.offsetDistance=t,this.createRawOffsetEdge(),this.drawDebug){let l=this.drawDebug.initColor(Ol.BLUE);this.rawOffsetPrimitive.forEach(c=>l.addPt(c)),this.drawDebug.draw();debugger}let a=e?this.createClippingEdge(r):[sa.build2(this.rawOffsetPrimitive)];if(this.drawDebug){let l=this.drawDebug.initColor(Ol.RED);a.forEach(c=>l.addPly(c)),this.drawDebug.draw();debugger}if(a.length&&(!this.isExpansion||this.isExpansion&&a.length>1)&&(a=this.getValidityPrimitive(a)),this.drawDebug){let l=this.drawDebug.initColor(Ol.GREEN);a.forEach(c=>l.addPly(c)),this.drawDebug.draw();debugger;throw new Error}return a}static getValidityPrimitive(o){let t=[],e=Math.abs(this.offsetDistance);for(let r=0;r<o.length;r+=1){let i=!0,n=o[r].primitives;e:for(let s=0;s<n.length;s+=1){let a=n[s],l;if(a instanceof mr)l=a.midPoint;else if(a instanceof Tt)l=a.start();else throw new Error("not support!");for(let c=0;c<this.originalPrimitive.length;c+=1){let h=this.originalPrimitive[c],u;if(h instanceof mr?u=this.pointArcClosest(l,h):u=dpt(l,h.start(),h.end()).d,e-u>.01){i=!1;break e}}}i&&t.push(o[r])}return t}static getInters(o){let t=[];for(let e=0;e<o;e+=2)t.push(new Yt(it[e],it[e+1]));return t}static pointArcClosest(o,t){let e=t.center;if(o.equals1(t.center))return t.rx;if(t.inArea(o,0)){let n=o.sub(e);return Math.abs(n.length()-t.rx)}let r=o.distance2(t.start()),i=o.distance2(t.end());return yr.less(r,i)?Math.sqrt(r):Math.sqrt(i)}static createClippingEdge(o){let t=[],e=[],r=G4e(sa.build2(this.rawOffsetPrimitive),o);r.forEach(n=>{let s=n.area(.01);t.push(s)});let i=Math.min(...t.filter(n=>n<0));for(let n=0;n<t.length;n+=1){let s=t[n];yr.eq(s,0)||(!this.isExpansion&&s<0||this.isExpansion&&(s<0&&t[n]===i||s>0))&&e.push(r[n])}return e}static createOffsetEdge(o){if(o instanceof mr)return o.panDistance1(this.offsetDistance);if(o instanceof Tt)return o.panDistance(this.offsetDistance);throw new Error("not support!")}static connectPrimitive(o,t){o.offsetEdge instanceof Tt&&t.offsetEdge instanceof Tt?this.lineToLineConnect(o,t):o.offsetEdge instanceof mr&&t.offsetEdge instanceof mr?this.arcToArcConnect(o,t):o.offsetEdge instanceof Tt&&t.offsetEdge instanceof mr?this.lineToArcConnect(o,t):this.arcToLineConnect(o,t)}static isFalseIntersection(o){return o>1||o<0}static lineToLineConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=t.index,n=this.originalPrimitive[i].start();if(e.isParallel(r))e.bbox().intersection1(r.bbox())?this.rawOffsetPrimitive.push(e):this.lineToLineUseArcToConnect(n,e,r);else{let s=this.getLineToLineT(e,r),a=s[0],l=s[1];if(this.isFalseIntersection(a)||this.isFalseIntersection(l))a>1&&this.isFalseIntersection(l)?this.lineToLineUseArcToConnect(n,e,r):this.useLineToConnect(e,r);else if(!this.isFalseIntersection(a)&&!this.isFalseIntersection(l)){let c=e.end().sub(e.start()),h=e.start().add(c.mul(a)),u=new Tt(e.start(),h);this.rawOffsetPrimitive.push(u);let d=new Tt(h,r.end());this.updateNextOffsetPrimitive(i,d)}}}static updateNextOffsetPrimitive(o,t){this.offsetPrimitive[o].offsetEdge=t}static useLineToConnect(o,t){this.rawOffsetPrimitive.push(o);let e=new Tt(o.end(),t.start());this.rawOffsetPrimitive.push(e)}static lineToLineUseArcToConnect(o,t,e){let r=this.getSweep(o,t),i=this.getSweepAngel(t.end(),e.start(),o,r);if(i===0){this.useLineToConnect(t,e);return}this.rawOffsetPrimitive.push(t);let n=mr.build5(t.end(),e.start(),i);this.rawOffsetPrimitive.push(n)}static getSweep(o,t,e){let r=null,i=e||e===0?this.originalPrimitive[e]:t;if(i instanceof mr){let n=i.center.sub(i.end()).normalize();i.isCCW?r=new Yt(n.y,-n.x):r=new Yt(-n.y,n.x)}else r=t.end().sub(t.start()).normalize();return o.sub(t.end()).normalize().cross(r)>0?0:1}static getLineToLineT(o,t){let e=o.end().sub(o.start()),r=t.end().sub(t.start()),i=e.cross(r),n=t.start().sub(o.start()),s=o.start().sub(t.start()),a=n.cross(r)/i,l=s.cross(e)/-i;return[a,l]}static lineToArcConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=o.index,n=t.index,s=this.getLineJoinArcScalarAndIntersectionNum(e,r),a=this.originalPrimitive[n].start();if(s.intersectionNum===0)this.lineAndArcUseArcConnect(a,e,r,i);else if(s.intersectionNum===1){let l=s.points[0];this.lineAndArcConnectionDetail(e,r,s.t[0],l,a,i,n)}else if(s.intersectionNum===2){let l=s.points[0],c=s.points[1],h=l.distance2(a),u=c.distance2(a);this.lineAndArcConnectionDetail(e,r,h<u?s.t[0]:s.t[1],h<u?l:c,a,i,n)}}static lineAndArcConnectionDetail(o,t,e,r,i,n,s){let a=this.isTrueArcIntersection(t,r);if(!this.isFalseIntersection(e)&&a){let l=new Tt(o.start(),r);this.rawOffsetPrimitive.push(l);let c;!t.center.equals1(r)||t.sweepAngle>1e-4?(c=mr.build4(r,t.end(),t.center,t.rx,t.ry,t.sweep()),c instanceof mr&&c.sweepAngle===0&&(c=new Tt(c.start(),c.end()))):c=new Tt(t.center,r),this.updateNextOffsetPrimitive(s,c)}else a?this.useLineToConnect(o,t):this.lineAndArcUseArcConnect(i,o,t,n)}static lineAndArcUseArcConnect(o,t,e,r){let i=this.getSweep(o,t,r),n=this.getSweepAngel(t.end(),e.start(),o,i);if(n===0){this.useLineToConnect(t,e);return}let s=mr.build5(t.end(),e.start(),n);this.rawOffsetPrimitive.push(t),this.rawOffsetPrimitive.push(s)}static arcToLineConnectionDetail(o,t,e,r,i,n,s){let a=this.isTrueArcIntersection(o,r);if(!this.isFalseIntersection(e)&&a){let l;o.center.equals1(r)?l=new Tt(o.center,r):Math.abs(o.sweepAngle)<1e-4?l=new Tt(o.start(),r):(l=mr.build4(o.start(),r,o.center,o.rx,o.ry,o.sweep()),l instanceof mr&&l.sweepAngle===0&&(l=new Tt(l.start(),l.end()))),this.rawOffsetPrimitive.push(l);let c=new Tt(r,t.end());this.updateNextOffsetPrimitive(s,c)}else a?this.useLineToConnect(o,t):this.lineAndArcUseArcConnect(i,o,t,n)}static isTrueArcIntersection(o,t){return mp(o,t)}static getSweepAngel(o,t,e,r){let i=o.angleD(e),n=t.angleD(e),s;return i===n?s=0:(i=Vo.regularD(i),n=Vo.regularD(n),r===1?n<=i&&(n+=360):n>=i&&(i+=360),s=n-i),s}static getLineJoinArcScalarAndIntersectionNum(o,t){let e={t:[],intersectionNum:0,points:[]},r=cpt(t,o);if(r){e.intersectionNum=r/2;for(let i=0;i<r-1;i+=2){let n=new Yt(it[i],it[i+1]);e.points.push(n),n.sub(o.start()).x<1e-4||n.sub(o.start()).y<1e-4?e.t.push(0):e.t.push(n.sub(o.start()).x/o.end().sub(o.start()).x)}}else e.intersectionNum=0;return e}static arcToLineConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=o.index,n=t.index,s=this.getLineJoinArcScalarAndIntersectionNum(r,e),a=this.originalPrimitive[n].start();if(s.intersectionNum===0)this.lineAndArcUseArcConnect(a,e,r,i);else if(s.intersectionNum===1){let l=s.points[0];this.arcToLineConnectionDetail(e,r,s.t[0],l,a,i,n)}else if(s.intersectionNum===2){let l=s.points[0],c=s.points[1],h=l.distance2(a),u=c.distance2(a);this.arcToLineConnectionDetail(e,r,h<u?s.t[0]:s.t[1],h<u?l:c,a,i,n)}}static rxChangeStatus(o){return o===1?!this.isExpansion:this.isExpansion}static arcToArcConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=T4e(e,r);if(i){let n=this.getInters(i),s;if(n.length===2){let c=this.originalPrimitive[t.index].start(),h=n[0],u=n[1],d=h.distance2(c),p=u.distance2(c);d<p?s=h:s=u}else s=n[0];let a,l;s.equals1(e.center)?a=new Tt(e.center,s):Math.abs(e.sweepAngle)<1e-4?a=new Tt(e.start(),s):(a=mr.build4(e.start(),s,e.center,e.rx,e.ry,e.sweep()),a instanceof mr&&a.sweepAngle===0&&(a=new Tt(a.start(),a.end()))),this.rawOffsetPrimitive.push(a),s.equals1(r.center)?l=new Tt(s,r.center):Math.abs(r.sweepAngle)<1e-4?l=new Tt(s,r.end()):(l=mr.build4(s,r.end(),r.center,r.rx,r.ry,r.sweep()),l instanceof mr&&l.sweepAngle===0&&(l=new Tt(l.start(),l.end()))),this.updateNextOffsetPrimitive(t.index,l)}else{let n=this.originalPrimitive[o.index],s=this.originalPrimitive[t.index],a=this.rxChangeStatus(n.sweep()),l=this.rxChangeStatus(s.sweep()),c=this.originalPrimitive[t.index].start(),h=this.getSweep(c,e,o.index),u=Math.abs(this.offsetDistance),d=mr.build2(c,a?n.endAngle():n.endAngle()+180,l?s.startAngle:s.startAngle+180,u,u,h);this.rawOffsetPrimitive.push(e),this.rawOffsetPrimitive.push(d)}}},cN.originalPrimitive=[],cN.offsetPrimitive=[],cN.rawOffsetPrimitive=[],cN.testI=0,cN),w0t=class iW extends dW{constructor(t,e,r,i,n,s){if(super(),e<0||r<0)throw new Error("The width and height of rect can't be less than 0!");this.leftUpPoint=t,this.width=e,this.height=r,this.angle=i,this.isCCW=n,this.radius=Math.min(Math.max(s,0),e/2,r/2)}get radiusRatio(){return this.radius/Math.min(this.width,this.height)}start(){return this.leftUpPoint.add(new Yt(this.radius,0).multiply3(zp.rotateD(this.angle)))}end(){return this.start()}getLeftPoint(){return this.leftUpPoint.add(new Yt(0,-this.height/2).multiply3(zp.rotateD(this.angle)))}getRightPoint(){return this.leftUpPoint.add(new Yt(this.width,-this.height/2).multiply3(zp.rotateD(this.angle)))}extend(t){return new iW(this.leftUpPoint.add(new Yt(-t,t).rotateD(Yt.ORIGIN,this.angle)),this.width+t*2,this.height+t*2,this.angle,this.isCCW,this.radius+t)}bbox(){let t=zp.rotateD(this.angle),{leftUpPoint:e,width:r,height:i,radius:n}=this,s=e.add(new Yt(n,-n).multiply3(t)),a=e.add(new Yt(n,n-i).multiply3(t)),l=e.add(new Yt(r-n,-n).multiply3(t)),c=e.add(new Yt(r-n,n-i).multiply3(t));return new Wg(Math.min(s.x,a.x,l.x,c.x)-n,Math.max(s.x,a.x,l.x,c.x)+n,Math.min(s.y,a.y,l.y,c.y)-n,Math.max(s.y,a.y,l.y,c.y)+n)}toPolyline(){let t=[],{leftUpPoint:e,width:r,height:i,radius:n}=this;if(n===0){let a=Yt.ORIGIN,l=new Yt(r,0),c=new Yt(r,-i),h=new Yt(0,-i);t.push(new Tt(a,l),new Tt(l,c),new Tt(c,h),new Tt(h,a))}else{let a=new Yt(0,-n),l=new Yt(n,0),c=new Yt(r-n,0),h=new Yt(r,-n),u=new Yt(r,n-i),d=new Yt(r-n,-i),p=new Yt(n,-i),m=new Yt(0,n-i);t.push(mr.build1(a,l,n,n,!1,0),new Tt(l,c),mr.build1(c,h,n,n,!1,0),new Tt(h,u),mr.build1(u,d,n,n,!1,0),new Tt(d,p),mr.build1(p,m,n,n,!1,0),new Tt(m,a))}t=t.filter(a=>!a.start().equals1(a.end())),this.isCCW&&(t.forEach((a,l)=>t[l]=a.reverse()),t.reverse());let s=zp.rotateD(this.angle).translate1(e);return sa.build2(t.map(a=>a.multiply3(s)))}center(){return this.leftUpPoint.add1(this.width/2,this.height/2).rotateD(this.leftUpPoint,this.angle)}multiply3(t){let e=this.leftUpPoint.multiply3(t),r=new Yt(this.width,0).multiply3(zp.rotateD(this.angle)).multiply3(t),i=new Yt(0,-this.height).multiply3(zp.rotateD(this.angle)).multiply3(t);return t.isMirrored()?new iW(e,i.length(),r.length(),i.angleD(Yt.ORIGIN),this.isCCW===1?0:1,this.radius*r.length()/this.width):new iW(e,r.length(),i.length(),r.angleD(Yt.ORIGIN),this.isCCW,this.radius*r.length()/this.width)}reverse(){return new iW(this.leftUpPoint,this.width,this.height,this.angle,this.isCCW===1?0:1,this.radius)}stroke(t,e,r){let i=this.stroke1(t,e,r);if(i.length===1)return i[0];{let[n,s]=i;return sa.build2(n.primitives.concat(new Tt(n.primitives[0].start(),s.primitives[0].start()),s.primitives,new Tt(s.primitives[0].start(),n.primitives[0].start())))}}stroke1(t,e,r){let i=r===this.isCCW?this:this.reverse(),n=t/2,s=Math.min(i.width,i.height)/2,a=i.extend(n).toPolyline();return s<=n?[a]:[a,i.extend(-n).toPolyline().reverse()]}points(t){let e=this.toPolyline(),r=[];return e.points(t,i=>r.push(i)),r}toBezier(){throw new Error("Method not implemented.")}},L0t=.01,p0=class FC{static simplify(t){return t=ev(t),t?new FC([t]):null}static buildByStroke(t,e,r=1,i=ybe,n){if(t instanceof mr&&(t.rx<e/2+L0t||Math.abs(t.sweepAngle)>180&&yr.lesseq(t.start().distance1(t.end()),e))){let a=G4e(t.stroke(e,r,0),n);if(a.length===0)return null;if(a.length===1)return new FC(a);let l=[null],c=Number.POSITIVE_INFINITY;return a.forEach(h=>{let u=h.area(.1);u<0?u<c&&(l[0]=h,c=u):l.push(h)}),new FC(l)}else if(t instanceof w0t){let a=t.stroke1(e,r,0).map(l=>ev(l));return a[0]?a[1]?new FC(a):new FC([a[0]]):null}let s=t.stroke(e,r,0,i);return s?this.simplify(s):null}static buildCircle(t,e){return this.simplify(sa.build7([mr.buildCircle(t,e,0)]))}static buildRect(t){return this.simplify(t.toPolyline())}static buildBBox(t){return this.simplify(sa.buildBBox(t,0))}constructor(t){this.items=t.slice()}multiply3(t){return new FC(this.items.map(e=>e.multiply3(t)))}bbox(){return this.items[0].bbox()}isEqual(t){return t instanceof FC?this.items.every(e=>t.items.some(r=>r.isEqual(e))):!1}getOutMostPolyline(){return this.items[0]}extend(t,e){if(this.items.length!==1)throw new Error("this.items.length !== 1");if(t===0)return new Fd([this]);let r=this.items[0],i=[];for(let h of r.primitives)if(h instanceof Tt)i.push(h);else if(h instanceof mr&&h.rx===h.ry)s(h);else if(h instanceof Yi)n(h);else throw new Error("not support!");r=sa.build7(i);function n(h){let u=h.points(.1);for(let d=0;d<u.length-1;d++){let p=u[d],m=u[d+1];i.push(new Tt(p,m))}}function s(h){if(Math.abs(h.sweepAngle)>270){let u=h.sweepAngle/2;s(mr.build3(h.center,h.startAngle,u,h.rx,h.ry)),s(mr.build3(h.center,h.startAngle+u,u,h.rx,h.ry))}else i.push(h)}let a=[],l=[];D0t.getExtendPolyLine(r,t,!0,e).forEach(h=>{(h.area(.1)>0?l:a).push(h)});let c;if(a.length===1)l.forEach(h=>a.push(h)),c=new Fd([new FC(a)]);else if(a.length===0)console.warn("outlines.length === 0"),c=new Fd([]);else if(l.length===0)c=new Fd(a.map(h=>new FC([h])));else{let h=a.map(u=>[u]);l.forEach(u=>{let d=[],p=u.bbox();if(h.forEach(m=>{m[0].bbox().isContainsBBox1(p)&&d.push(m)}),d.length===1)d[0].push(u);else{if(d.length===0)throw new Error("inPlsArr.length === 0");for(let m of d.sort((g,y)=>g[0].bbox().area()-y[0].bbox().area()))if(m[0].getWindingNum(u.start())===-1){m.push(u);break}}}),c=new Fd(h.map(u=>new FC(u)))}return c}toPolylineGroup(){return new bbe(this.items)}},M0t=(o=>(o[o.POLYGON=1]="POLYGON",o[o.POLYLINE=2]="POLYLINE",o[o.LINE=3]="LINE",o[o.ARC=4]="ARC",o[o.BEZIER2=5]="BEZIER2",o[o.BEZIER3=6]="BEZIER3",o[o.BOOLEAN_OUTPUT=7]="BOOLEAN_OUTPUT",o[o.BOOLEAN_INTERSECTION=8]="BOOLEAN_INTERSECTION",o[o.BOOLEAN_UNION=9]="BOOLEAN_UNION",o[o.BOOLEAN_DIFF=10]="BOOLEAN_DIFF",o[o.BOOLEAN_RESULT=11]="BOOLEAN_RESULT",o[o.LINES=12]="LINES",o[o.ARCS=13]="ARCS",o[o.BEZIER2S=14]="BEZIER2S",o[o.BEZIER3S=15]="BEZIER3S",o[o.CIRCLE_CW=16]="CIRCLE_CW",o[o.CIRCLE_CCW=17]="CIRCLE_CCW",o[o.POLYGON_GROUP=18]="POLYGON_GROUP",o))(M0t||{});var q2e=class{static repeat(o,t){let e=new Array(t);for(;t-- >0;)e[t]=o;return e.join("")}static lpad(o,t,e){let r=e-o.length;return r>0?this.repeat(t,r)+o:o}},N0t=/(\.?0+)$/,lbe=class{static format(o,...t){return this.format1(o,t)}static format1(o,t){let e=this._format(o,t);if(typeof e=="string")return e;throw new Error(this.format("Invalid state on (%d) %s",e,o))}static _format(o,t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l),h=c.charCodeAt(0);switch(r){case 0:h===37?r=1:e.push(c);break;case 1:switch(h){case 100:if(n=t[i++],typeof n=="number")e.push(n.toFixed(0)),r=0;else return l;break;case 102:if(n=t[i++],typeof n=="number")e.push(n.toString()),r=0;else return l;break;case 120:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16)),r=0;else return l;break;case 88:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16).toUpperCase()),r=0;else return l;break;case 115:case 99:n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case 48:s=l+1,a=-1,r=2;break;case 37:e.push("%"),r=0;break;default:return l}break;case 2:switch(h){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a=l;break;case 100:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(q2e.lpad((n|0).toString(10),"0",u)),r=0;else return l}else return l;break;case 120:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(q2e.lpad((n|0).toString(16),"0",u)),r=0;else return l}else return l;break;case 88:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(q2e.lpad((n|0).toString(16).toUpperCase(),"0",u)),r=0;else return l}else return l;break;default:return l}break;default:return l}}return e.join("")}static startsWith(o,t){return o.length>=t.length?o.substring(0,t.length)===t:!1}static endsWith(o,t){return o.length>=t.length?o.substring(o.length-t.length)===t:!1}static fmtNumber(o){return o.toFixed(5).replace(N0t,"")}};function k0t(o){switch(o){case 0:return"DEBUG";case 1:return"INFO";case 2:return"WARNING";case 3:return"ERROR";case 4:return"DUMMY"}}var B0t=(o,t)=>{o===3?console.error(...t):o===2?console.warn(...t):console.log(...t)},F0t=(o,t)=>[k0t(o)].concat(t),t4e=class cbe{static mix(...t){return new cbe(0,(e,r)=>{for(let i of t)i.write(e,r)},(e,r)=>r)}constructor(t,e=B0t,r=F0t){this.level=t,this.writer=e,this.fmt=r}setLevel(t){this.level=t}prepend(t=null,e=null){let r=t===null?this.fmt:(n,s)=>(s=t(n,s),this.fmt(n,s)),i=e===null?this.writer:(n,s)=>{e(n,s),this.writer(n,s)};return new cbe(this.level,i,r)}chain(t){return t.prepend(this.fmt.bind(this),this.writer.bind(this))}include(t){return this.level<=t}formatWrite(t,e,r){this.include(t)&&this.writer(t,this.fmt(t,[lbe.format(e,...r)]))}write(t,e){this.include(t)&&this.writer(t,this.fmt(t,e))}write3(t,e,r){this.include(t)&&this.writer(t,this.fmt(t,[lbe.format(e,...r)]))}debug3(t,...e){this.write3(0,t,e)}warning3(t,...e){this.write3(2,t,e)}debugFmt(t,...e){this.formatWrite(0,t,e)}debug(...t){this.write(0,t)}infoFmt(t,...e){this.formatWrite(1,t,e)}info(...t){this.write(1,t)}warningFmt(t,...e){this.formatWrite(2,t,e)}warning(...t){this.write(2,t)}errorFmt(t,...e){this.formatWrite(3,t,e)}error(...t){this.write(3,t)}};t4e.DUMMY=new t4e(4);var IFt=String.fromCharCode;var V0t=(o=>(o[o.UNKNOW=0]="UNKNOW",o[o.NUMBER_INTEGER=1]="NUMBER_INTEGER",o[o.NUMBER_DECIMAL=2]="NUMBER_DECIMAL",o[o.NUMBER_E=3]="NUMBER_E",o[o.NUMBER_E_SIGNED=4]="NUMBER_E_SIGNED",o))(V0t||{}),G0t=(o=>(o[o.UNKNOW=0]="UNKNOW",o[o.MOVE_X=1]="MOVE_X",o[o.MOVE_Y=2]="MOVE_Y",o[o.LINE_X=3]="LINE_X",o[o.LINE_Y=4]="LINE_Y",o[o.HORIZONTAL_X=5]="HORIZONTAL_X",o[o.VERTICAL_Y=6]="VERTICAL_Y",o[o.CUBIC_BEZIER_X1=7]="CUBIC_BEZIER_X1",o[o.CUBIC_BEZIER_Y1=8]="CUBIC_BEZIER_Y1",o[o.CUBIC_BEZIER_X2=9]="CUBIC_BEZIER_X2",o[o.CUBIC_BEZIER_Y2=10]="CUBIC_BEZIER_Y2",o[o.CUBIC_BEZIER_X=11]="CUBIC_BEZIER_X",o[o.CUBIC_BEZIER_Y=12]="CUBIC_BEZIER_Y",o[o.ARC_RX=13]="ARC_RX",o[o.ARC_RY=14]="ARC_RY",o[o.ARC_ROTATION=15]="ARC_ROTATION",o[o.ARC_LARGE=16]="ARC_LARGE",o[o.ARC_SWEEP=17]="ARC_SWEEP",o[o.ARC_X=18]="ARC_X",o[o.ARC_Y=19]="ARC_Y",o[o.SMOOTH_CUBIC_BEZIER_X2=20]="SMOOTH_CUBIC_BEZIER_X2",o[o.SMOOTH_CUBIC_BEZIER_Y2=21]="SMOOTH_CUBIC_BEZIER_Y2",o[o.SMOOTH_CUBIC_BEZIER_X=22]="SMOOTH_CUBIC_BEZIER_X",o[o.SMOOTH_CUBIC_BEZIER_Y=23]="SMOOTH_CUBIC_BEZIER_Y",o[o.QUADRATIC_BEZIER_X1=24]="QUADRATIC_BEZIER_X1",o[o.QUADRATIC_BEZIER_Y1=25]="QUADRATIC_BEZIER_Y1",o[o.QUADRATIC_BEZIER_X=26]="QUADRATIC_BEZIER_X",o[o.QUADRATIC_BEZIER_Y=27]="QUADRATIC_BEZIER_Y",o))(G0t||{});var CFt=lbe.fmtNumber;var Cbe=class{constructor(){}editHead(o,t){let e={uuid:o.uuid,nickname:o.nickname,username:o.username,updateTime:t};return`${JSON.stringify({type:"EDIT_HEAD"})}||${JSON.stringify(e)}`}head(o){return J_(this.doctype,o.client,o.doc,o.updateTime,o.version||String(o.updateTime),o.user,o.ticket)}creator(o,t){let e=typeof t=="string"?t:JSON.stringify(t);return Sf("META_CREATE",o,"META_CREATE",e)}modifier(o,t){let e=typeof t=="string"?t:JSON.stringify(t);return Sf("META_MODIFY",o,"META_MODIFY",e)}delete(o,t){let e=t||JSON.stringify({isDelete:!0});return Sf("DELETE_DOC",o,"DELETE_DOC",e)}},H4e=class extends Cbe{constructor(){super(...arguments),this.doctype="BLOB"}buildStr(o,t,e){let r=typeof e=="string"?e:JSON.stringify(this.buildData(e));return Sf("BLOB",o,t,r)}buildData(o){return{filename:o.filename,content:o.content}}},W4e=class extends Cbe{meta(o,t,e){let r=typeof t=="string"?t:JSON.stringify(this.metaData(t));return Sf("META",o,"META",r,void 0,e)}},z4e=class extends W4e{constructor(){super(...arguments),this.doctype="BOARD"}metaData(o){return{title:o.title,zIndex:o.zIndex}}};var Y4e=class{constructor(){}encodeString(o,t){return{id:o,dataType:"STRING",data:JSON.stringify(t)}}encodeAttr(o,t){return{id:o,dataType:"ATTR",data:JSON.stringify(t)}}encodePadNet(o){let t=JSON.stringify(["PAD_NET",o.componentId,o.padNum,o.padId||""]),e={...o};return delete e.componentId,delete e.padNum,delete e.padId,{id:t,dataType:"PAD_NET",data:JSON.stringify(e)}}encodeComponent(o,t){return{id:o,dataType:"COMPONENT",data:JSON.stringify(t)}}encodePanelize(o){return{id:"PANELIZE",dataType:"PANELIZE",data:JSON.stringify(o)}}encodeRuleSelector(o){let t=JSON.stringify(["RULE_SELECTOR",o.ruleSelect]),e={...o};return delete e.ruleSelect,{id:t,dataType:"RULE_SELECTOR",data:JSON.stringify(e)}}encodeRule(o){let t=JSON.stringify(["RULE",o.ruleType,o.ruleName]),e={...o};return delete e.ruleType,delete e.ruleName,{id:t,dataType:"RULE",data:JSON.stringify(e)}}encodeRuleTemplate(o){return{id:"RULE_TEMPLATE",dataType:"RULE_TEMPLATE",data:JSON.stringify(o)}}encodeDimension(o,t){return{id:o,dataType:"DIMENSION",data:JSON.stringify(t)}}encodeBoss(o,t){return{id:o,dataType:"BOSS",data:JSON.stringify(t)}}encodeShellEntity(o,t){return{id:o,dataType:"SHELL_ENTITY",data:JSON.stringify(t)}}encodeShellCut(o,t){return{id:o,dataType:"SHELLCUT",data:JSON.stringify(t)}}encodeCrease(o,t){return{id:o,dataType:"CREASE",data:JSON.stringify(t)}}encodeShell(o,t){return{id:o,dataType:"SHELL",data:JSON.stringify(t)}}encodeFpcFill(o,t){return{id:o,dataType:"FPC_FILL",data:JSON.stringify(t)}}encodeTeardrop(o,t){return{id:o,dataType:"TEARDROP",data:JSON.stringify(t)}}encodeImage(o,t){return{id:o,dataType:"IMAGE",data:JSON.stringify(t)}}encodePoured(o,t){return{id:gc(o,"POURED"),dataType:"POURED",data:JSON.stringify(t)}}encodePour(o,t){return{id:o,dataType:"POUR",data:JSON.stringify(t)}}encodeRegion(o,t){return{id:o,dataType:"REGION",data:JSON.stringify(t)}}encodeFill(o,t){return{id:o,dataType:"FILL",data:JSON.stringify(t)}}encodeLayerFill(o,t){return{id:gc(o,"LAYER_FILL"),dataType:"LAYER_FILL",data:JSON.stringify(t)}}encodePoly(o,t){return{id:o,dataType:"POLY",data:JSON.stringify(t)}}encodeEQLenGrp(o,t){return{id:o,dataType:"EQLEN_GRP",data:JSON.stringify(t)}}encodeObj(o,t){return{id:o,dataType:"OBJ",data:JSON.stringify(t)}}encodeArc(o,t){return{id:o,dataType:"ARC",data:JSON.stringify(t)}}encodeLine(o,t){return{id:o,dataType:"LINE",data:JSON.stringify(t)}}encodePad(o,t){return{id:o,dataType:"PAD",data:JSON.stringify(t)}}encodeVia(o,t){return{id:o,dataType:"VIA",data:JSON.stringify(t)}}encodePreference(o){return{id:"PREFERENCE",dataType:"PREFERENCE",data:JSON.stringify(o)}}encodeSilkOpts(o,t){return{id:gc(o,"SILK_OPTS"),dataType:"SILK_OPTS",data:JSON.stringify(t)}}encodeGroup(o,t){return{id:o,dataType:"GROUP",data:JSON.stringify(t)}}encodePrimitive(o,t){return{id:gc(o,"PRIMITIVE"),dataType:"PRIMITIVE",data:JSON.stringify(t)}}encodeNet(o,t){return{id:gc(o,"NET"),dataType:"NET",data:JSON.stringify(t)}}encodePartition(o,t){return{id:o,dataType:"PARTITION",data:JSON.stringify(t)}}encodeActiveLayer(o){return{id:"ACTIVE_LAYER",dataType:"ACTIVE_LAYER",data:JSON.stringify(o)}}encodeLayerPhys(o,t){return{id:gc(o,"LAYER_PHYS"),dataType:"LAYER_PHYS",data:JSON.stringify(t)}}encodeLayer(o,t){return{id:gc(o,"LAYER"),dataType:"LAYER",data:JSON.stringify(t)}}encodeCanvas(o){return{id:"CANVAS",dataType:"CANVAS",data:JSON.stringify(o)}}},j4e=class{constructor(){}encodeString(o,t){return{id:o,dataType:"STRING",data:JSON.stringify(t)}}encodeAttr(o,t){return{id:o,dataType:"ATTR",data:JSON.stringify(t)}}encodePanelize(o){return{id:"PANELIZE",dataType:"PANELIZE",data:JSON.stringify(o)}}encodeRuleSelector(o){let t=JSON.stringify(["RULE_SELECTOR",o.ruleSelect]),e={...o};return delete e.ruleSelect,{id:t,dataType:"RULE_SELECTOR",data:JSON.stringify(e)}}encodeRule(o){let t=JSON.stringify(["RULE",o.ruleType,o.ruleName]),e={...o};return delete e.ruleType,delete e.ruleName,{id:t,dataType:"RULE",data:JSON.stringify(e)}}encodeRuleTemplate(o){return{id:"RULE_TEMPLATE",dataType:"RULE_TEMPLATE",data:JSON.stringify(o)}}encodeDimension(o,t){return{id:o,dataType:"DIMENSION",data:JSON.stringify(t)}}encodeBoss(o,t){return{id:o,dataType:"BOSS",data:JSON.stringify(t)}}encodeShellEntity(o,t){return{id:o,dataType:"SHELL_ENTITY",data:JSON.stringify(t)}}encodeShellCut(o,t){return{id:o,dataType:"SHELLCUT",data:JSON.stringify(t)}}encodeCrease(o,t){return{id:o,dataType:"CREASE",data:JSON.stringify(t)}}encodeShell(o,t){return{id:o,dataType:"SHELL",data:JSON.stringify(t)}}encodeFpcFill(o,t){return{id:o,dataType:"FPC_FILL",data:JSON.stringify(t)}}encodeTeardrop(o,t){return{id:o,dataType:"TEARDROP",data:JSON.stringify(t)}}encodeImage(o,t){return{id:o,dataType:"IMAGE",data:JSON.stringify(t)}}encodePoured(o,t){return{id:gc(o,"POURED"),dataType:"POURED",data:JSON.stringify(t)}}encodePour(o,t){return{id:o,dataType:"POUR",data:JSON.stringify(t)}}encodeRegion(o,t){return{id:o,dataType:"REGION",data:JSON.stringify(t)}}encodeFill(o,t){return{id:o,dataType:"FILL",data:JSON.stringify(t)}}encodeLayerFill(o,t){return{id:gc(o,"LAYER_FILL"),dataType:"LAYER_FILL",data:JSON.stringify(t)}}encodePoly(o,t){return{id:o,dataType:"POLY",data:JSON.stringify(t)}}encodeEQLenGrp(o,t){return{id:o,dataType:"EQLEN_GRP",data:JSON.stringify(t)}}encodeObj(o,t){return{id:o,dataType:"OBJ",data:JSON.stringify(t)}}encodeArc(o,t){return{id:o,dataType:"ARC",data:JSON.stringify(t)}}encodeLine(o,t){return{id:o,dataType:"LINE",data:JSON.stringify(t)}}encodePad(o,t){return{id:o,dataType:"PAD",data:JSON.stringify(t)}}encodeVia(o,t){return{id:o,dataType:"VIA",data:JSON.stringify(t)}}encodePreference(o){return{id:"PREFERENCE",dataType:"PREFERENCE",data:JSON.stringify(o)}}encodeSilkOpts(o,t){return{id:gc(o,"SILK_OPTS"),dataType:"SILK_OPTS",data:JSON.stringify(t)}}encodeGroup(o,t){return{id:o,dataType:"GROUP",data:JSON.stringify(t)}}encodePrimitive(o,t){return{id:gc(o,"PRIMITIVE"),dataType:"PRIMITIVE",data:JSON.stringify(t)}}encodeNet(o,t){return{id:gc(o,"NET"),dataType:"NET",data:JSON.stringify(t)}}encodeActiveLayer(o){return{id:"ACTIVE_LAYER",dataType:"ACTIVE_LAYER",data:JSON.stringify(o)}}encodeLayerPhys(o,t){return{id:gc(o,"LAYER_PHYS"),dataType:"LAYER_PHYS",data:JSON.stringify(t)}}encodeLayer(o,t){return{id:gc(o,"LAYER"),dataType:"LAYER",data:JSON.stringify(t)}}encodeCanvas(o){return{id:"CANVAS",dataType:"CANVAS",data:JSON.stringify(o)}}},X4e=class extends p4e{constructor(o=!1){super(void 0,void 0,void 0,void 0,o),this.encode=new j4e,this.maxTicket=0,this.blobEncode=new H4e,this.blobData=[],this.encodeData="",this.placeholder=0}handleData(o){this.encodeData?this.encodeData=this.encodeData+`|
`+Sf(o.dataType,++this.maxTicket,o.id,o.data):this.encodeData=Sf(o.dataType,++this.maxTicket,o.id,o.data)}getZIndex(o){let t=o.match(XJ);return t!=null&&t.length?t[1]:null}onPHolder(o,t){let e={dataType:o,max:t};this.handleData({id:`placeholder${++this.placeholder}`,dataType:"ELE_PLACEHOLDER",data:JSON.stringify(e)})}onLayerFill(o,t){this.handleData(this.encode.encodeLayerFill(o,t))}onString(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P){let T=this.getZIndex(o);this.handleData(this.encode.encodeString(An(o),{groupId:e,layerId:r,x:i,y:n,text:s,fontFamily:a,fontSize:l,strokeWidth:c,bold:h,italic:u,origin:d,angle:p,reverse:m,expansion:g,mirror:y,locked:b,zIndex:T===null?null:Number(T),specialColor:P}))}onAttr(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O){let _=this.getZIndex(o);_&&E&&(_=_+"."+String(E)),this.handleData(this.encode.encodeAttr(An(o),{groupId:e,parentId:r,layerId:i,x:n,y:s,key:a,value:l,keyVisible:c,valueVisible:h,fontFamily:u,fontSize:d,strokeWidth:p,bold:m,italic:g,origin:y,angle:b,reverse:P,expansion:T,mirror:I,locked:C,zIndex:_===null?null:Number(_),specialColor:O}))}onPadNet(o,t,e,r,i){}onComponent(o,t,e,r,i,n,s,a,l){}onPanelize(o,t,e,r,i,n,s,a,l,c){this.handleData(this.encode.encodePanelize({on:o,row:t,column:e,rowSpacing:r,columnSpacing:i,onlyOutline:n,horizontalStamp:s,verticalStamp:a,horizontalSize:l,verticalSize:c}))}onRuleSelector(o,t,e,r,i){this.handleData(this.encode.encodeRuleSelector({ruleSelect:o,ruleOrder:t,ruleKeyValue:e,copperValue:r,innerPlaneValue:i}))}onRule(o,t,e,r){this.handleData(this.encode.encodeRule({ruleType:o,ruleName:t,ruleState:e,ruleContext:r}))}onRuleTemplate(o){this.handleData(this.encode.encodeRuleTemplate({name:o}))}onDimension(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeDimension(An(o),{type:e,layerId:r,unit:i,strokeWidth:n,precision:s,textFollow:a,coords:l,locked:c,zIndex:p===null?null:Number(p),text:h,specialColor:u,groupId:d}))}onBoss(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeBoss(An(o),{groupId:e,layerId:r,centerX:i,centerY:n,specification:s,depth:a,thickness:l,holeDiameter:c,counterBore:h?{height:h[0],diameter:h[1]}:null,stiffener:u?{topWidth:u[0],bottomWidth:u[1],height:u[2],stiffThickness:u[3]}:null,locked:d,zIndex:p===null?null:Number(p)}))}onShellEntity(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.getZIndex(o),p={groupId:e,layerId:r,type:i?"ENTITY":"SLOT",depth:a,strokeWidth:l,path:c,locked:h,zIndex:d===null?null:Number(d),refs:u};p.type==="ENTITY"&&(p.entityBelong=n),p.type==="SLOT"&&(p.slotOptions=s),this.handleData(this.encode.encodeShellEntity(An(o),p))}onShellCut(o,t,e,r,i,n,s,a,l){let c=this.getZIndex(o);this.handleData(this.encode.encodeShellCut(An(o),{groupId:e,layerId:r,depth:i,strokeWidth:n,path:s,locked:a,zIndex:c===null?null:Number(c),refs:l}))}onCrease(o,t,e,r,i,n,s,a,l,c){let h=this.getZIndex(o);this.handleData(this.encode.encodeCrease(An(o),{groupId:e,layerId:r,startX:i,startY:n,endX:s,endY:a,angle:l,locked:c,zIndex:h===null?null:Number(h)}))}onShell(o,t,e,r,i,n,s,a,l,c){let h=this.getZIndex(o),u={groupId:e,shellType:r,shellHeight:i,pcbHeight:n,strokeWidth:s,path:a,thickness:l.Thickness,locked:c,zIndex:h===null?null:Number(h)};r==="DRAWER"&&(u.direction=l.Direction),r==="T&B"&&(u.bottomHeight=l.BottomHeight,u.topInnerHeight=l.TopInnerHeight,u.bottomInnerHeight=l.BottomInnerHeight),this.handleData(this.encode.encodeShell(An(o),u))}onFpcFill(o,t,e,r,i,n,s,a){let l=this.getZIndex(o);this.handleData(this.encode.encodeFpcFill(An(o),{groupId:e,layerId:r,material:i,thickness:n,path:s,locked:a,zIndex:l===null?null:Number(l)}))}onTeardrop(o,t,e,r,i,n,s){this.handleData(this.encode.encodeTeardrop(An(o),{netName:e,layerId:r,path:i,groupId:n,refs:s,locked:!1}))}onImage(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeImage(An(o),{groupId:e,layerId:r,startX:i,startY:n,width:s,height:a,angle:l,mirror:c,path:h,locked:u,zIndex:p===null?null:Number(p),specialColor:d}))}onPoured(o,t){this.handleData(this.encode.encodePoured(An(o),t))}onPour(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.getZIndex(o);this.handleData(this.encode.encodePour(An(o),{groupId:e,netName:r,layerId:i,width:n,name:s,order:a,path:l,pourType:c,keepIsland:h,locked:u,zIndex:d===null?null:Number(d)}))}onRegion(o,t,e,r,i,n,s,a,l,c){let h=this.getZIndex(o);this.handleData(this.encode.encodeRegion(An(o),{groupId:e,layerId:r,width:i,prohibitType:n,path:s,locked:a,zIndex:h===null?null:Number(h),name:l,regionType:c}))}onFill(o,t,e,r,i,n,s,a,l,c,h){let u=this.getZIndex(o);this.handleData(this.encode.encodeFill(An(o),{groupId:e,netName:r,layerId:i,width:n,fillStyle:s,path:a,locked:l,zIndex:u===null?null:Number(u),isBridgingCopper:!1,networkList:[],refs:c,specialColor:h}))}onPoly(o,t,e,r,i,n,s,a,l){let c=this.getZIndex(o);this.handleData(this.encode.encodePoly(An(o),{groupId:e,netName:r,layerId:i,width:n,path:s,locked:a,zIndex:c===null?null:Number(c),specialColor:l,polyType:i==11?"BOARD_OUTLINE":"NORMAL"}))}onEQLenGrp(o,t,e,r){this.handleData(this.encode.encodeEQLenGrp(An(o),{name:t,sort:e,pads:r}))}onObj(o,t,e,r,i,n,s,a,l,c,h,u,d,p){if(u.startsWith("data:")){let g=qJ(u);this.blobData.push(this.blobEncode.buildStr(1,g,{filename:i,content:u})),u=`blob:${g}`}let m=this.getZIndex(o);this.handleData(this.encode.encodeObj(An(o),{groupId:e,layerId:r,fileName:i,startX:n,startY:s,width:a,height:l,angle:c,mirror:h,path:u,locked:d,zIndex:m===null?null:Number(m),specialColor:p}))}onArc(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeArc(An(o),{groupId:e,netName:r,layerId:i,startX:n,startY:s,endX:a,endY:l,angle:c,width:h,locked:u,zIndex:p===null?null:Number(p),arcType:"DOT",specialColor:d}))}onCArc(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeArc(An(o),{groupId:e,netName:r,layerId:i,startX:n,startY:s,endX:a,endY:l,angle:c,width:h,locked:u,zIndex:p===null?null:Number(p),arcType:"CENT",specialColor:d}))}onLine(o,t,e,r,i,n,s,a,l,c,h){let u=this.getZIndex(o);this.handleData(this.encode.encodeLine(An(o),{groupId:e,netName:r,layerId:i,startX:n,startY:s,endX:a,endY:l,width:c,locked:h,zIndex:u===null?null:Number(u)}))}onPad(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,x,v){let D=this.getZIndex(o);this.handleData(this.encode.encodePad(An(o),{groupId:e,netName:r,layerId:i,num:n,centerX:s,centerY:a,padAngle:l,hole:c,defaultPad:h,specialPad:u,padOffsetX:d,padOffsetY:p,relativeAngle:m,plated:g,padType:y,topSolderExpansion:b,bottomSolderExpansion:P,topPasteExpansion:T,bottomPasteExpansion:I,locked:C,zIndex:D===null?null:Number(D),connectMode:E,spokeSpace:O,spokeWidth:_,spokeAngle:x,unusedInnerLayers:v,padLen:0}))}onVia(o,t,e,r,i,n,s,a,l,c,h,u,d,p){let m=this.getZIndex(o);this.handleData(this.encode.encodeVia(An(o),{groupId:e,netName:r,ruleName:i,centerX:n,centerY:s,holeDiameter:a,viaDiameter:l,viaType:c,topSolderExpansion:h,bottomSolderExpansion:u,locked:d,zIndex:m===null?null:Number(m),unusedInnerLayers:p}))}onPreference(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T){this.handleData(this.encode.encodePreference({startTrackWidthFollowLast:o,lastTrackWidth:t,startViaSizeFollowLast:e,lastViaInnerDiameter:r,lastViaDiameter:i,snap:n,routingMode:s,routingCorner:a,removeLoop:l,rotatingObject:c,trackFollow:h,stretchTrackMinCorner:u,preferenceConfig:d,realTimeUpdateUnusedLayers:p,unusedPadRange:m,pushVia:g,pathOptimization4BePushed:y,currentPathOptimization4BePushed:b,removeCircuitsContainingVias:P,removeAntenna:T}))}onSilkOpts(o,t,e){this.handleData(this.encode.encodeSilkOpts(o,{defaultColor:t,baseColor:e}))}onGroup(o,t){this.handleData(this.encode.encodeGroup(o,{groupName:t}))}onPrimitive(o,t,e){this.handleData(this.encode.encodePrimitive(o,{display:t,pick:e}))}onNet(o,t,e,r,i,n,s){this.handleData(this.encode.encodeNet(o,{netType:t,specialColor:e,retLine:r,differentialName:i,isPositiveNet:n,equalLengthGroupName:s}))}onPartition(o,t,e,r){}onActiveLayer(o){this.handleData(this.encode.encodeActiveLayer({layerId:o}))}onLayerPhys(o,t,e,r,i,n,s){this.handleData(this.encode.encodeLayerPhys(o,{material:t,thickness:e,permittivity:r,lossTangent:i,isKeepIsland:n,zIndex:s}))}onLayer(o,t,e,r,i,n,s,a,l,c){this.handleData(this.encode.encodeLayer(o,{layerType:t,layerName:e,use:r,show:i,locked:n,activeColor:s,activateTransparency:a,inactiveColor:l,inactiveTransparency:c}))}onCanvas(o,t,e,r,i,n,s,a,l,c,h,u){this.handleData(this.encode.encodeCanvas({originX:o,originY:t,unit:e,gridXSize:r,gridYSize:i,snapXSize:n,snapYSize:s,altSnapXSize:a,altSnapYSize:l,gridType:c,multiGridType:h,multiGridRatio:u,highlightValue:.5}))}},U0t=class extends p4e{constructor(o=[],t=[]){let e={};o.forEach(i=>e[i.uuid]=i.display_title||i.title);let r={};t.forEach(i=>r[i.uuid]=i.display_title||i.title),super(r,e,o,t),this.encode=new Y4e,this.maxTicket=0,this.blobEncode=new H4e,this.blobData=[],this.encodeData="",this.placeholder=0}handleData(o){this.encodeData?this.encodeData=this.encodeData+`|
`+Sf(o.dataType,++this.maxTicket,o.id,o.data):this.encodeData=Sf(o.dataType,++this.maxTicket,o.id,o.data)}getZIndex(o){let t=o.match(XJ);return t!=null&&t.length?t[1]:null}onPHolder(o,t){let e={dataType:o,max:t};this.handleData({id:`placeholder${++this.placeholder}`,dataType:"ELE_PLACEHOLDER",data:JSON.stringify(e)})}onLayerFill(o,t){this.handleData(this.encode.encodeLayerFill(o,t))}onString(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P){let T=this.getZIndex(o);this.handleData(this.encode.encodeString(An(o),{partitionId:An(t),groupId:e,layerId:r,x:i,y:n,text:s,fontFamily:a,fontSize:l,strokeWidth:c,bold:h,italic:u,origin:d,angle:p,reverse:m,expansion:g,mirror:y,locked:b,zIndex:T===null?null:Number(T),specialColor:P}))}onAttr(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O){let _=this.getZIndex(o);_&&E&&(_=_+"."+String(E)),this.handleData(this.encode.encodeAttr(An(o),{partitionId:An(t),groupId:e,parentId:An(r),layerId:i,x:n,y:s,key:a,value:l,keyVisible:c,valueVisible:h,fontFamily:u,fontSize:d,strokeWidth:p,bold:m,italic:g,origin:y,angle:b,reverse:P,expansion:T,mirror:I,locked:C,zIndex:_===null?null:Number(_),specialColor:O}))}onPadNet(o,t,e,r,i){this.handleData(this.encode.encodePadNet({partitionId:An(t),componentId:An(o),padNum:e,padNet:r,padId:An(i),padLen:0}))}onComponent(o,t,e,r,i,n,s,a,l,c,h){let u=this.getZIndex(o);this.handleData(this.encode.encodeComponent(An(o),{partitionId:An(t),groupId:e,layerId:r,x:i,y:n,angle:s,attrs:a,locked:l,zIndex:u===null?null:Number(u),specialColor:c,layerIdReplacements:h}))}onPanelize(o,t,e,r,i,n,s,a,l,c){this.handleData(this.encode.encodePanelize({on:o,row:t,column:e,rowSpacing:r,columnSpacing:i,onlyOutline:n,horizontalStamp:s,verticalStamp:a,horizontalSize:l,verticalSize:c}))}onRuleSelector(o,t,e,r,i){this.handleData(this.encode.encodeRuleSelector({ruleSelect:o,ruleOrder:t,ruleKeyValue:e,copperValue:r,innerPlaneValue:i}))}onRule(o,t,e,r){this.handleData(this.encode.encodeRule({ruleType:o,ruleName:t,ruleState:e,ruleContext:r}))}onRuleTemplate(o){this.handleData(this.encode.encodeRuleTemplate({name:o}))}onDimension(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeDimension(An(o),{partitionId:An(t),type:e,layerId:r,unit:i,strokeWidth:n,precision:s,textFollow:a,coords:l,locked:c,zIndex:p===null?null:Number(p),text:h,specialColor:u,groupId:d}))}onBoss(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeBoss(An(o),{partitionId:An(t),groupId:e,layerId:r,centerX:i,centerY:n,specification:s,depth:a,thickness:l,holeDiameter:c,counterBore:h?{height:h[0],diameter:h[1]}:null,stiffener:u?{topWidth:u[0],bottomWidth:u[1],height:u[2],stiffThickness:u[3]}:null,locked:d,zIndex:p===null?null:Number(p)}))}onShellEntity(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.getZIndex(o),p={groupId:e,layerId:r,type:i?"ENTITY":"SLOT",depth:a,strokeWidth:l,path:c,locked:h,zIndex:d===null?null:Number(d),refs:u};p.type==="ENTITY"&&(p.entityBelong=n),p.type==="SLOT"&&(p.slotOptions=s),this.handleData(this.encode.encodeShellEntity(An(o),p))}onShellCut(o,t,e,r,i,n,s,a,l){let c=this.getZIndex(o);this.handleData(this.encode.encodeShellCut(An(o),{partitionId:An(t),groupId:e,layerId:r,depth:i,strokeWidth:n,path:s,locked:a,zIndex:c===null?null:Number(c),refs:l}))}onCrease(o,t,e,r,i,n,s,a,l,c){let h=this.getZIndex(o);this.handleData(this.encode.encodeCrease(An(o),{partitionId:An(t),groupId:e,layerId:r,startX:i,startY:n,endX:s,endY:a,angle:l,locked:c,zIndex:h===null?null:Number(h)}))}onShell(o,t,e,r,i,n,s,a,l,c){let h=this.getZIndex(o),u={groupId:e,shellType:r,shellHeight:i,pcbHeight:n,strokeWidth:s,path:a,thickness:l.Thickness,locked:c,zIndex:h===null?null:Number(h)};r==="DRAWER"&&(u.direction=l.Direction),r==="T&B"&&(u.bottomHeight=l.BottomHeight,u.topInnerHeight=l.TopInnerHeight,u.bottomInnerHeight=l.BottomInnerHeight),this.handleData(this.encode.encodeShell(An(o),u))}onFpcFill(o,t,e,r,i,n,s,a){let l=this.getZIndex(o);this.handleData(this.encode.encodeFpcFill(An(o),{partitionId:An(t),groupId:e,layerId:r,material:i,thickness:n,path:s,locked:a,zIndex:l===null?null:Number(l)}))}onTeardrop(o,t,e,r,i,n,s){this.handleData(this.encode.encodeTeardrop(An(o),{partitionId:An(t),netName:e,layerId:r,path:i,groupId:n,refs:s,locked:!1}))}onImage(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeImage(An(o),{partitionId:An(t),groupId:e,layerId:r,startX:i,startY:n,width:s,height:a,angle:l,mirror:c,path:h,locked:u,zIndex:p===null?null:Number(p),specialColor:d}))}onPoured(o,t){this.handleData(this.encode.encodePoured(An(o),t))}onPour(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.getZIndex(o);this.handleData(this.encode.encodePour(An(o),{partitionId:An(t),groupId:e,netName:r,layerId:i,width:n,name:s,order:a,path:l,pourType:c,keepIsland:h,locked:u,zIndex:d===null?null:Number(d)}))}onRegion(o,t,e,r,i,n,s,a,l,c){let h=this.getZIndex(o);this.handleData(this.encode.encodeRegion(An(o),{partitionId:An(t),groupId:e,layerId:r,width:i,prohibitType:n,path:s,locked:a,zIndex:h===null?null:Number(h),name:l,regionType:c}))}onFill(o,t,e,r,i,n,s,a,l,c,h){let u=this.getZIndex(o);this.handleData(this.encode.encodeFill(An(o),{partitionId:An(t),groupId:e,netName:r,layerId:i,width:n,fillStyle:s,path:a,locked:l,zIndex:u===null?null:Number(u),isBridgingCopper:!1,networkList:[],refs:c,specialColor:h}))}onPoly(o,t,e,r,i,n,s,a,l){let c=this.getZIndex(o);this.handleData(this.encode.encodePoly(An(o),{partitionId:An(t),groupId:e,netName:r,layerId:i,width:n,path:s,locked:a,zIndex:c===null?null:Number(c),specialColor:l,polyType:i==11?"BOARD_OUTLINE":"NORMAL"}))}onEQLenGrp(o,t,e,r){this.handleData(this.encode.encodeEQLenGrp(An(o),{name:t,sort:e,pads:r}))}onObj(o,t,e,r,i,n,s,a,l,c,h,u,d,p){if(u.startsWith("data:")){let g=qJ(u);this.blobData.push(this.blobEncode.buildStr(1,g,{filename:i,content:u})),u=`blob:${g}`}let m=this.getZIndex(o);this.handleData(this.encode.encodeObj(An(o),{partitionId:An(t),groupId:e,layerId:r,fileName:i,startX:n,startY:s,width:a,height:l,angle:c,mirror:h,path:u,locked:d,zIndex:m===null?null:Number(m),specialColor:p}))}onArc(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeArc(An(o),{partitionId:An(t),groupId:e,netName:r,layerId:i,startX:n,startY:s,endX:a,endY:l,angle:c,width:h,locked:u,zIndex:p===null?null:Number(p),arcType:"DOT",specialColor:d}))}onCArc(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeArc(An(o),{partitionId:An(t),groupId:e,netName:r,layerId:i,startX:n,startY:s,endX:a,endY:l,angle:c,width:h,locked:u,zIndex:p===null?null:Number(p),arcType:"CENT",specialColor:d}))}onLine(o,t,e,r,i,n,s,a,l,c,h){let u=this.getZIndex(o);this.handleData(this.encode.encodeLine(An(o),{partitionId:An(t),groupId:e,netName:r,layerId:i,startX:n,startY:s,endX:a,endY:l,width:c,locked:h,zIndex:u===null?null:Number(u)}))}onPad(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,x,v){let D=this.getZIndex(o);this.handleData(this.encode.encodePad(An(o),{partitionId:An(t),groupId:e,netName:r,layerId:i,num:n,centerX:s,centerY:a,padAngle:l,hole:c,defaultPad:h,specialPad:u,padOffsetX:d,padOffsetY:p,relativeAngle:m,plated:g,padType:y,topSolderExpansion:b,bottomSolderExpansion:P,topPasteExpansion:T,bottomPasteExpansion:I,locked:C,zIndex:D===null?null:Number(D),connectMode:E,spokeSpace:O,spokeWidth:_,spokeAngle:x,unusedInnerLayers:v,padLen:0}))}onVia(o,t,e,r,i,n,s,a,l,c,h,u,d,p){let m=this.getZIndex(o);this.handleData(this.encode.encodeVia(An(o),{partitionId:An(t),groupId:e,netName:r,ruleName:i,centerX:n,centerY:s,holeDiameter:a,viaDiameter:l,viaType:c,topSolderExpansion:h,bottomSolderExpansion:u,locked:d,zIndex:m===null?null:Number(m),unusedInnerLayers:p}))}onPreference(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T){this.handleData(this.encode.encodePreference({startTrackWidthFollowLast:o,lastTrackWidth:t,startViaSizeFollowLast:e,lastViaInnerDiameter:r,lastViaDiameter:i,snap:n,routingMode:s,routingCorner:a,removeLoop:l,rotatingObject:c,trackFollow:h,stretchTrackMinCorner:u,preferenceConfig:d,realTimeUpdateUnusedLayers:p,unusedPadRange:m,pushVia:g,pathOptimization4BePushed:y,currentPathOptimization4BePushed:b,removeCircuitsContainingVias:P,removeAntenna:T}))}onSilkOpts(o,t,e){this.handleData(this.encode.encodeSilkOpts(o,{defaultColor:t,baseColor:e}))}onGroup(o,t){this.handleData(this.encode.encodeGroup(o,{groupName:t}))}onPrimitive(o,t,e){this.handleData(this.encode.encodePrimitive(o,{display:t,pick:e}))}onNet(o,t,e,r,i,n,s){this.handleData(this.encode.encodeNet(o,{netType:t,specialColor:e,retLine:r,differentialName:i,isPositiveNet:n,equalLengthGroupName:s}))}onPartition(o,t,e,r){this.handleData(this.encode.encodePartition(An(o),{name:t,fileUuid:e,path:r}))}onActiveLayer(o){this.handleData(this.encode.encodeActiveLayer({layerId:o}))}onLayerPhys(o,t,e,r,i,n,s){this.handleData(this.encode.encodeLayerPhys(o,{material:t,thickness:e,permittivity:r,lossTangent:i,isKeepIsland:n,zIndex:s}))}onLayer(o,t,e,r,i,n,s,a,l,c){this.handleData(this.encode.encodeLayer(o,{layerType:t,layerName:e,use:r,show:i,locked:n,activeColor:s,activateTransparency:a,inactiveColor:l,inactiveTransparency:c}))}onCanvas(o,t,e,r,i,n,s,a,l,c,h,u){this.handleData(this.encode.encodeCanvas({originX:o,originY:t,unit:e,gridXSize:r,gridYSize:i,snapXSize:n,snapYSize:s,altSnapXSize:a,altSnapYSize:l,gridType:c,multiGridType:h,multiGridRatio:u,highlightValue:.5}))}};function yW(o,t,e,r,i,n,s=new Date().getTime(),a=String(s),l){var c,h;let u=Tm(),d=t.split(`

`),p=d.filter(b=>!b.startsWith('["DOCTYPE","PCB"')),m=d.filter(b=>b.startsWith('["DOCTYPE","PCB"'))[0],g="";for(let b=0;b<p.length;b++){let P=new X4e;P.parseFull(p[b]);let T=P.metaData;i.push({uuid:T.uuid,title:T.title,dataStr:p[b]});let I=J_("FOOTPRINT",u,T.uuid,s,a,l);if(I=I+`|
`+Sf("META",1,"META",JSON.stringify({source:T.source,version:T.version,title:(c=T==null?void 0:T.title)==null?void 0:c.replace(/[A-Z]+/g,C=>C.toLowerCase()),display_title:T.title,description:T.description||"",custom_tags:T.custom_tags||"",tags:T.tags||{},docType:4})),P.blobData.length&&(I=I+`|
`+P.blobEncode.head({doc:"BLOB",client:u,updateTime:s,version:a,user:l})+`|
`+P.blobData.join(`|
`)),P.fontCache.length){let C=new hbe,E=C.head({doc:"FONT",client:Tm(),updateTime:s,version:a,user:l});for(let O of P.fontCache){let _=TP(O.text,O.fontFamily,O.fontSize,O.thickness,O.bold,O.italic,O.reverse,O.expansion),x=C.buildStr(1,_,O);E=E+`|
`+x}I=E+`|
`+I}P.encodeData&&(I=I+`|
`+P.encodeData),g=g?I+`|
`+g:I}let y=new U0t(i,n);g?g=g+`|
`+J_("PCB",u,o,s,a,l):g=J_("PCB",u,o,s,a,l),y.parseFull(e.join(`
`));for(let b=0;b<r.length;b++){let P=r[b];y.curPourId=(h=P.path.split("_"))==null?void 0:h[1],y.parseFull(P.dataStr)}if(y.parseFull(m),y.encodeData&&(g=g+`|
`+y.encodeData),y.blobData.length&&(g=g+`|
`+y.blobEncode.head({doc:"BLOB",client:u,updateTime:s,version:a,user:l})+`|
`+y.blobData.join(`|
`)),y.fontCache.length){let b=new hbe,P=b.head({doc:"FONT",client:Tm(),updateTime:s,version:a,user:l});for(let T of y.fontCache){let I=TP(T.text,T.fontFamily,T.fontSize,T.thickness,T.bold,T.italic,T.reverse,T.expansion),C=b.buildStr(1,I,T);P=P+`|
`+C}g=P+`|
`+g}return g}function q4e(o,t,e,r=new Date().getTime(),i=String(r),n){let s=new X4e(e),a="",l=Tm();if(a=J_("FOOTPRINT",l,o,r,i,n),s.parseFull(t),s.encodeData&&(a=a+`|
`+s.encodeData),s.blobData.length&&(a=a+`|
`+s.blobEncode.head({doc:"BLOB",client:l,updateTime:r,version:i,user:n})+`|
`+s.blobData.join(`|
`)),s.fontCache.length){let c=new hbe,h=c.head({doc:"FONT",client:l,updateTime:r,version:i,user:n});for(let u of s.fontCache){let d=TP(u.text,u.fontFamily,u.fontSize,u.thickness,u.bold,u.italic,u.reverse,u.expansion),p=c.buildStr(1,d,u);h=h+`|
`+p}a=h+`|
`+a}return a}var H0t=class extends W4e{canvas(o){let{client:t,ticket:e,data:r,id:i,dataType:n,firstTicket:s,pend:a}=o;return Sf(n,e,i,r,t,s,a)}};var $4e=class extends H0t{constructor(){super(...arguments),this.doctype="PCB"}metaData(o){return{title:o.title,parent:o.parent,source:o.source,board:o.board,zIndex:o.zIndex||null}}transform(o){let{doc:t,dataStr:e,fonts:r,coppers:i,footprints:n,devices:s,updateTime:a,version:l,user:c}=o;return yW(t,e,r,i,n,s,a,l,c)}};var hbe=class extends Cbe{constructor(){super(...arguments),this.doctype="FONT"}buildStr(o,t,e){let r=typeof e=="string"?e:JSON.stringify(this.buildData(e));return Sf("FONT",o,t,r)}buildData(o){return{width:o.width,height:o.height,path:o.path}}};var W0t=class extends ndt{constructor(o){let t=o||new fbe;super(t,0,l4e),this.cacheNum=null}onParseLine(o,t,e,r,i,n,s){switch(this.setOrderNum(o,s,t),this.cacheNum=s,t){case"MAX_NUM":if(e)for(let l in e)this.setMaxNum(l,e[l]);break;case"BLOB":e?this.onBlob(o,r,i,e,n):this.onDelBlob(o,r,i,n);break;case"FONT":this.parseFont(o,e,r,i,n);break;case"META":e&&this.parseDetail(e,r,i,n);break;case"ELE_PLACEHOLDER":break;case"CANVAS":e&&this.parseCanvas(e,r,i,n);break;case"BOARD":e?this.parseBoard(e,r,i,n):this.onDelBoard(r,i,n);break;case"LAYER":{let l=X_(o);e?this.parseLayer(l,e,r,i,n):this.onDelLayer(l,r,i,n);break}case"LAYER_PHYS":{let l=X_(o);e?this.parseLayerPhys(l,e,r,i,n):this.onDelLayerPhys(l,r,i,n);break}case"ACTIVE_LAYER":e&&this.parseActiveLayer(o,e,r,i,n);break;case"PARTITION":e?this.parsePartition(o,e,r,i,n):this.onDelPartition(o,r,i,n);break;case"NET":{let l=X_(o);e?this.parseNet(l,e,r,i,n):this.onDelNet(l,r,i,n);break}case"PRIMITIVE":{let l=X_(o);e?this.parsePrimitive(l,e,r,i,n):this.onDelPrimitive(l,r,i,n);break}case"GROUP":e?this.parseGroup(o,e,r,i,n):this.onDelGroup(o,r,i,n);break;case"X_SIGNAL_GROUP":e?this.parseXSignalsGroup(o,e,r,i,n):this.onDelXSignalsGroup(o,r,i,n);break;case"X_SIGNALS":e?this.parseXSignals(o,e,r,i,n):this.onDelXSignals(o,r,i,n);break;case"SILK_OPTS":{let l=X_(o);e?this.parseSilkOpts(l,e,r,i,n):this.onDelSilkOpts(l,r,i,n);break}case"PREFERENCE":e&&this.parsePreference(o,e,r,i,n);break;case"VIA":e?this.parseVia(o,e,r,i,n):this.onDelVia(o,r,i,n);break;case"PAD":e?this.parsePad(o,e,r,i,n):this.onDelPad(o,r,i,n);break;case"LINE":e?this.parseLine(o,e,r,i,n):this.onDelLine(o,r,i,n);break;case"ARC":e?this.parseArc(o,e,r,i,n):this.onDelArc(o,r,i,n);break;case"OBJ":e?this.parseObj(o,e,r,i,n):this.onDelObj(o,r,i,n);break;case"EQLEN_GRP":e?this.parseEQLenGrp(o,e,r,i,n):this.onDelEQLenGrp(o,r,i,n);break;case"POLY":e?this.parsePoly(o,e,r,i,n):this.onDelPoly(o,r,i,n);break;case"FILL":e?this.parseFill(o,e,r,i,n):this.onDelFill(o,r,i,n);break;case"LAYER_FILL":let a=X_(o);e?this.parseLayerFill(a,e,r,i,n):this.onDelLayerFill(a,r,i,n);break;case"REGION":e?this.parseRegion(o,e,r,i,n):this.onDelRegion(o,r,i,n);break;case"POUR":e?this.parsePour(o,e,r,i,n):this.onDelPour(o,r,i,n);break;case"POURED":{o=X_(o),e?this.parsePoured(o,e,r,i,n):this.onDelPoured(o,r,i,n);break}case"IMAGE":e?this.parseImage(o,e,r,i,n):this.onDelImage(o,r,i,n);break;case"TEARDROP":e?this.parseTeardrop(o,e,r,i,n):this.onDelTeardrop(o,r,i,n);break;case"FPC_FILL":e?this.parseFpcFill(o,e,r,i,n):this.onDelFpcFill(o,r,i,n);break;case"SHELL":e?this.parseShell(o,e,r,i,n):this.onDelShell(o,r,i,n);break;case"CREASE":e?this.parseCrease(o,e,r,i,n):this.onDelCrease(o,r,i,n);break;case"SHELLCUT":e?this.parseShellCut(o,e,r,i,n):this.onDelShellCut(o,r,i,n);break;case"SHELL_ENTITY":e?this.parseShellEntity(o,e,r,i,n):this.onDelShellEntity(o,r,i,n);break;case"BOSS":e?this.parseBoss(o,e,r,i,n):this.onDelBoss(o,r,i,n);break;case"STRING":e?this.parseString(o,e,r,i,n):this.onDelString(o,r,i,n);break;case"ATTR":e?this.parseAttr(o,e,r,i,n):this.onDelAttr(o,r,i,n);break;case"DIMENSION":e?this.parseDimension(o,e,r,i,n):this.onDelDimension(o,r,i,n);break;case"COMPONENT":e?this.parseComponent(o,e,r,i,n):this.onDelComponent(o,r,i,n);break;case"PAD_NET":{let l=JSON.parse(o);e?(e.componentId=l[1],e.padNum=l[2],e.padId=l[3],this.parsePadNet(e,r,i,n)):this.onDelPadNet(l[1],l[2],l[3]||"",r,i,n);break}case"RULE_TEMPLATE":e&&this.parseRuleTemplate(o,e,r,i,n);break;case"RULE":{let l=JSON.parse(o);e?(e.ruleType=l[1],e.ruleName=l[2],this.parseRule(e,r,i,n)):this.onDelRule(l[1],l[2],r,i,n);break}case"RULE_SELECTOR":{let l=JSON.parse(o);e?(e.ruleSelect=l[1],this.parseRuleSelector(e,r,i,n)):this.onDelRuleSelector(l[1],r,i,n);break}case"PANELIZE":e?this.parsePanelize(o,e,r,i,n):this.onDelPanelize(r,i,n);break;default:console.warn("can not find hanlder with",e,r,i)}this.cacheNum=null}onOrderNum(o,t,e){switch(this.setOrderNum(o,e,t),t){case"PARTITION":this.onPartitionNum&&this.onPartitionNum(o,e);break;case"VIA":this.onViaNum&&this.onViaNum(o,e);break;case"PAD":this.onPadNum&&this.onPadNum(o,e);break;case"LINE":this.onLineNum&&this.onLineNum(o,e);break;case"ARC":this.onArcNum&&this.onArcNum(o,e);break;case"OBJ":this.onObjNum&&this.onObjNum(o,e);break;case"POLY":this.onPolyNum&&this.onPolyNum(o,e);break;case"FILL":this.onFillNum&&this.onFillNum(o,e);break;case"REGION":this.onRegionNum&&this.onRegionNum(o,e);break;case"POUR":this.onPourNum&&this.onPourNum(o,e);break;case"POURED":let r=X_(o);this.onPouredNum&&this.onPouredNum(r,e);break;case"IMAGE":this.onImageNum&&this.onImageNum(o,e);break;case"TEARDROP":this.onTeardropNum&&this.onTeardropNum(o,e);break;case"FPC_FILL":this.onFpcFillNum&&this.onFpcFillNum(o,e);break;case"SHELL":this.onShellNum&&this.onShellNum(o,e);break;case"CREASE":this.onCreaseNum&&this.onCreaseNum(o,e);break;case"SHELLCUT":this.onShellCutNum&&this.onShellCutNum(o,e);break;case"SHELL_ENTITY":this.onShellEntityNum&&this.onShellEntityNum(o,e);break;case"BOSS":this.onBossNum&&this.onBossNum(o,e);break;case"STRING":this.onStringNum&&this.onStringNum(o,e);break;case"ATTR":this.onAttrNum&&this.onAttrNum(o,e);break;case"DIMENSION":this.onDimensionNum&&this.onDimensionNum(o,e);break;case"COMPONENT":this.onComponentNum&&this.onComponentNum(o,e);break}}onParseEnd(){}parseCanvas(o,t,e,r){this.onCanvas(t,e,o,r)}parseBoard(o,t,e,r){this.onBoard(o,t,e,r)}parseDetail(o,t,e,r){this.onDocDetail(t,e,o,r)}parseFont(o,t,e,r,i){let n=K2e(o);t?this.onFont(e,r,Object.assign(t,n),i):this.onDelFont(n,e,r,i)}parseLayer(o,t,e,r,i){this.onLayer(o,e,r,t,i)}parseLayerPhys(o,t,e,r,i){this.onLayerPhys(o,e,r,t,i)}parseActiveLayer(o,t,e,r,i){this.onActiveLayer(e,r,t,i)}parsePartition(o,t,e,r,i){this.onPartition(o,this.cacheNum,e,r,t,i)}parseNet(o,t,e,r,i){this.onNet(o,e,r,t,i)}parsePrimitive(o,t,e,r,i){this.onPrimitive(o,e,r,t,i)}parseGroup(o,t,e,r,i){this.onGroup(o,e,r,t,i)}parseXSignalsGroup(o,t,e,r,i){this.onXSignalsGroup(o,t,e,r,i)}parseXSignals(o,t,e,r,i){this.onXSignals(o,t,e,r,i)}parseSilkOpts(o,t,e,r,i){this.onSilkOpts(o,e,r,t,i)}parsePreference(o,t,e,r,i){this.onPreference(e,r,t,i)}parseVia(o,t,e,r,i){this.onVia(o,this.cacheNum,e,r,t,i)}parsePad(o,t,e,r,i){this.onPad(o,this.cacheNum,e,r,t,i)}parseLine(o,t,e,r,i){this.onLine(o,this.cacheNum,e,r,t,i)}parseArc(o,t,e,r,i){this.onArc(o,this.cacheNum,e,r,t,i)}parseObj(o,t,e,r,i){this.onObj(o,this.cacheNum,e,r,t,i)}parseEQLenGrp(o,t,e,r,i){this.onEQLenGrp(o,e,r,t,i)}parsePoly(o,t,e,r,i){this.onPoly(o,this.cacheNum,e,r,t,i)}parseFill(o,t,e,r,i){t.fillStyle!=="PLANE"&&this.onFill(o,this.cacheNum,e,r,t,i)}parseLayerFill(o,t,e,r,i){this.onLayerFill(o,e,r,t,i)}parseRegion(o,t,e,r,i){this.onRegion(o,this.cacheNum,e,r,t,i)}parsePour(o,t,e,r,i){this.onPour(o,this.cacheNum,e,r,t,i)}parsePoured(o,t,e,r,i){let n=t;Array.isArray(t)&&(n={pourFill:t}),n.pourFill&&this.onPoured(o,this.cacheNum,e,r,n,i)}parseImage(o,t,e,r,i){this.onImage(o,this.cacheNum,e,r,t,i)}parseTeardrop(o,t,e,r,i){this.onTeardrop(o,this.cacheNum,e,r,t,i)}parseFpcFill(o,t,e,r,i){this.onFpcFill(o,this.cacheNum,e,r,t,i)}parseShell(o,t,e,r,i){this.onShell(o,this.cacheNum,e,r,t,i)}parseCrease(o,t,e,r,i){this.onCrease(o,this.cacheNum,e,r,t,i)}parseShellCut(o,t,e,r,i){this.onShellCut(o,this.cacheNum,e,r,t,i)}parseShellEntity(o,t,e,r,i){this.onShellEntity(o,this.cacheNum,e,r,t,i)}parseBoss(o,t,e,r,i){this.onBoss(o,this.cacheNum,e,r,t,i)}parseDimension(o,t,e,r,i){this.onDimension(o,this.cacheNum,e,r,t,i)}parseRuleTemplate(o,t,e,r,i){this.onRuleTemplate(e,r,t,i)}parseRule(o,t,e,r){this.onRule(t,e,o,r)}parseRuleSelector(o,t,e,r){if(o.ruleKeyValue&&(o.ruleKeyValue=hN(o.ruleKeyValue)),o.copperValue&&o.copperValue.hasOwnProperty("7")){let i=o.copperValue[7];delete o.copperValue[7],o.copperValue.COPPER=i}if(o.innerPlaneValue&&o.innerPlaneValue.hasOwnProperty("6")){let i=o.innerPlaneValue[6];delete o.innerPlaneValue[6],o.innerPlaneValue.PLANE=i}this.onRuleSelector(t,e,o,r)}parsePanelize(o,t,e,r,i){this.onPanelize(e,r,t,i)}parseComponent(o,t,e,r,i){this.onComponent(o,this.cacheNum,e,r,t,i)}parsePadNet(o,t,e,r){this.onPadNet(t,e,o,r)}parseAttr(o,t,e,r,i){this.onAttr(o,this.cacheNum,e,r,t,i)}parseString(o,t,e,r,i){this.onString(o,this.cacheNum,e,r,t,i)}};var z0t=(o=>(o.UNIVERSAL="UNIVERSAL",o))(z0t||{}),Y0t=(o=>(o.SINGLE="SINGLE",o.MULTIPLE="MULTIPLE",o))(Y0t||{}),j0t=(o=>(o.NONE="NONE",o.NAME="NAME",o.NUMBER="NUMBER",o))(j0t||{}),X0t=(o=>(o.NONE="NONE",o.ZONE="ZONE",o))(X0t||{});var q0t=IN(uW());function f0(){return self.EDITOR_TOP||self}function NJ(o){return self[o]=self[o]||new q0t.BroadcastChannelMessageBus(o)}var Mw=(o,t)=>{let e=/{([^}]*)}/gim,r=[...new Set(o.match(e))];for(let i=0;i<r.length;i++){let n=r[i],s=n.substring(1,n.length-1);t[s]&&(o=o.replace(n,t[s]))}return o};var $0t=IN(uW()),Oh={getTime:"/pro-mgr/serverTime/now",getUserL:"/pro-ui/loginUser/get",subMaxTick:"/pro-mgr/project/ticket",subBlob:"/pro-mgr/canvas/BLOB/update",subFont:"/pro-mgr/canvas/FONT/update",subRevoke:"/pro-mgr/{uuid}/revoke",pushPend:"/pro-mgr/worker/batchPendData",pushSync:"/pro-mgr/dataWorker/sync",pushRevoke:"/pro-mgr/worker/revoke",pullASync:"/pro-mgr/dataWorker/sync/{id}",personDestroy:"/mgr/libWorker/destroy",projectUpdate:"/pro-mgr/canvas/{uuid}/update",personUpdate:"/mgr/libWorker/component/{uuid}/update",personSave:"/mgr/libWorker/save",projectSave:"/mgr/projectWorker/setCanvas",canSavePend:"/mgr/projectWorker/canSavePend",hasSaveData:"/mgr/check/hasSaveData"},K0t={projectUpdate:Oh.projectUpdate,personUpdate:Oh.personUpdate,projectCanSave:Oh.canSavePend,getProject:"/mgr/projectWorker/footprint/getCanvas",getPerson:"/mgr/libWorker/getFootprint",unwatch:"/mgr/projectWorker/footprint/unwatchCanvas"},Z0t={projectUpdate:Oh.projectUpdate,projectCanSave:Oh.canSavePend,getProject:"/mgr/projectWorker/pcb/getCanvas",unwatch:"/mgr/projectWorker/pcb/unwatchCanvas"},SFt={projectUpdate:Oh.projectUpdate,projectCanSave:Oh.canSavePend,getProject:"/mgr/projectWorker/sheet/getCanvas",unwatch:"/mgr/projectWorker/sheet/unwatchCanvas"},EFt={projectUpdate:Oh.projectUpdate,getProject:"/mgr/projectWorker/schematic/getCanvas",unwatch:"/mgr/projectWorker/schematic/unwatchCanvas"},OFt={projectUpdate:Oh.projectUpdate,projectCanSave:Oh.canSavePend,getProject:"/mgr/projectWorker/simulation/getCanvas",unwatch:"/mgr/projectWorker/simulation/unwatchCanvas"},AFt={projectUpdate:Oh.projectUpdate,personUpdate:Oh.personUpdate,projectCanSave:Oh.canSavePend,getProject:"/mgr/projectWorker/symbol/getCanvasOnCompiler",getPerson:"/mgr/libWorker/getSymbol",unwatch:"/mgr/projectWorker/symbol/unwatchCanvas"},_Ft={projectUpdate:Oh.projectUpdate,personUpdate:Oh.personUpdate,projectCanSave:Oh.canSavePend,getProject:"/mgr/projectWorker/panel/getCanvas",getPerson:"/mgr/libWorker/getPanelLib",unwatch:"/mgr/projectWorker/panel/unwatchCanvas"},J0t={projectUpdate:"/pro-mgr/device/{uuid}/update",getProject:"/mgr/projectWorker/device/getByCompiler",getPerson:"/mgr/libWorker/getDevice",unwatch:"/mgr/projectWorker/device/unwatch"};var rb={send:"/pro-mgr/notify/send",sendMsg:"/document/sendMsg/cooperation",unwatch:"/document/unwatch/cooperation",watch:"/document/watch/cooperation",message:"/pro-mgr/notify/message/{path}/{uuid}/cooperation",established:"/pro-mgr/notify/message/ws/established",getWsId:"/pro-mgr/notify/getWsId",disconnect:"/pro-mgr/notify/message/ws/disconnect"},Sbe=class{constructor(o=!0){this._lockerTicket=0,this.isPull=!1,this.compiler={},this.order={SYMBOL:1,FOOTPRINT:2,DEVICE:3,SCH_PAGE:4,PCB:5},this._locker=o?++this._lockerTicket:0}getOrder(o){return this.order[o]||6}publish(){if(!this.isPull){this.isPull=!0,this._temporaryUnlock=this._locker;try{let o=Object.keys(this.compiler).sort((e,r)=>this.getOrder(e)-this.getOrder(r)),t=!1;for(let e of o){for(let[,r]of this.compiler[e])if(t=r.publish(),t)break;if(t)break}}finally{this._temporaryUnlock=0,this.isPull=!1}}}canPush(){return!this._locker||this._locker===this._temporaryUnlock}addCompiler(o){this.compiler[o.headType]||(this.compiler[o.headType]=new Map),this.compiler[o.headType].set(o.uniqueId,o)}removeCompiler(o){var t,e,r;(r=(e=(t=this.compiler)==null?void 0:t[o.headType])==null?void 0:e.delete)==null||r.call(e,o.uniqueId)}pull(){if(!this._locker)throw Error("\u4E0D\u5141\u8BB8\u5728\u975E pause \u72B6\u6001\u4E0B\u62C9\u53D6\u6570\u636E");this.publish()}resume(){this._locker=0,this.publish()}pause(){this._locker=++this._lockerTicket}dispose(){for(let o in this.compiler)this.compiler[o].clear();this.compiler=null}},$_={publish:"publish",destroy:"destroy",init:"init",selected:"selected"},Q0t=class{constructor(o,t,e,r=(s=>(s=f0())==null?void 0:s._TAB_ID_)(),i,n){this.uuid=o,this.path=t,this.user=e,this.windowId=r,this.initIds={},this.sub=[];var s;this.wsBus=n||NJ(`/${this.windowId}/notify`),this.dataBus=i||this.wsBus,this._client=(s=f0())==null?void 0:s._WS_ID_}get client(){return this._client}watch(){this.dataBus.publish(rb.send,{topic:rb.watch,uuid:this.uuid,path:this.path})}initPublish(){var o;this.dataBus.publish(rb.send,{topic:rb.sendMsg,uuid:this.uuid,path:this.path,msg:{type:$_.publish,user:this.user,client:this.client,data:((o=this.getSelect)==null?void 0:o.call(this))||""}})}async init(){if(!this.isInit){if(this.sub.push(this.wsBus.subscribe(rb.established,o=>{this._client=o,this.watch(),this.initPublish()})),!this.client){let o=await this.wsBus.rpcCall(rb.getWsId);if(!o||this.client)return;this._client=o}this.watch(),this.sub.push(this.wsBus.subscribe(rb.disconnect,o=>{this.initIds[o]&&this.onDestroy(this.initIds[o],o)})),this.sub.push(this.dataBus.subscribe(Mw(rb.message,{uuid:this.uuid,path:this.path}),o=>{if(o.type===1)o.connectId&&this.initIds[o.connectId]&&this.onDestroy(this.initIds[o.connectId],o.connectId);else if(o.msg){let t=o.msg;if(t.client===this.client)return;switch(t.type){case $_.destroy:this.onDestroy(t.userId,t.client),delete this.initIds[t.client];break;case $_.init:this.initIds[t.client]||(this.initIds[t.client]=t.user.uuid,this.onSelected(t.user,t.client,t.data||""));break;case $_.selected:this.onSelected(t.user,t.client,t.data||"");break;case $_.publish:this.dataBus.publish(rb.send,{topic:rb.sendMsg,uuid:this.uuid,path:this.path,msg:{type:$_.init,user:this.user,client:this.client,data:this.getSelect()||""}}),this.initIds[t.client]=t.user.uuid,this.onSelected(t.user,t.client,t.data||"");break;default:break}}})),this.initPublish(),this.isInit=!0}}publishSelected(o,t){this.dataBus.publish(rb.send,{topic:rb.sendMsg,uuid:this.uuid,path:this.path,msg:{type:$_.selected,user:this.user,client:this.client,data:o}}),t&&this.onSelected(this.user,this.client,o)}destroy(){if(this.isInit){this.isInit=!1,this.dataBus.publish(rb.send,{topic:rb.unwatch,uuid:this.uuid,path:this.path,msg:{type:$_.destroy,userId:this.user.uuid,client:this.client}});for(let o of this.sub)o.cancel();this.sub=[],this.initIds={}}}},r4e=class extends Q0t{constructor(o,t,e,r,i,n,s,a){super(o,t,a,e,i,n),this.channel=r,this.selectedProps=s,this.cache=new Map,this.deleteCache=new Map}rePublish(){var o,t,e,r;if(this.channel.canPush()){for(let[i,n]of this.cache)(t=(o=this.selectedProps)==null?void 0:o.onSelect)==null||t.call(o,n.user,i,n.data);for(let[i,n]of this.deleteCache)(r=(e=this.selectedProps)==null?void 0:e.onQuit)==null||r.call(e,n,i)}}getSelect(){var o,t;return((t=(o=this.selectedProps)==null?void 0:o.getSelect)==null?void 0:t.call(o))||""}onSelected(o,t,e){var r,i;this.channel.canPush()?!this.deleteCache.has(t)&&this.cache.set(t,{user:o,data:e}):(i=(r=this.selectedProps)==null?void 0:r.onSelect)==null||i.call(r,o,t,e)}onDestroy(o,t){var e,r;this.channel.canPush()?(this.deleteCache.set(t,o),this.cache.delete(t)):(r=(e=this.selectedProps)==null?void 0:e.onQuit)==null||r.call(e,o,t)}dispose(){this.destroy(),this.cache.clear(),this.deleteCache.clear()}publishSelected(o,t){super.publishSelected(o,t)}},K4e=class{constructor(o,t,e,r=(b=>(b=f0())==null?void 0:b._TAB_ID_)(),i=new Sbe,n=null,s,a,l,c,h,u,d,p,m,g,y){this.uuid=o,this.path=t,this.isProject=e,this.windowId=r,this.channel=i,this.consistencyManager=n,this.selectedProps=l,this.setInit=c,this.onDocDetail=h,this.onUpdate=u,this.handleInit=d,this.onDelete=p,this.publishCache=m,this.onOrderNm=g,this.setMaxNum=y,this.isInit=!1,this.canSave=!0,this.sub=[],this.isInitIng=!1,this.cache={},this.deleteCache=new Map,this.pendTimer=null,this.pendPromise=null,this.pendCache={},this.pendCacheLength=0,this.wsBus=NJ(`/${r}/notify`),n||(this._unique=Tm()),this._headType=s,this.busTopic=a}get uniqueId(){return this._unique||this.consistencyManager.getUnique()}get headType(){return this._headType}setIsInitIng(o){var t;(t=this.setInit)==null||t.call(this,o),this.isInitIng=o}consoleDebug(...o){console.debug("[lc-protocol]",this._headType,this.uuid,...o)}publishLine(o,t,e,r,i,n=this.uuid,s,a,l,c,h){if(this.channel.canPush())return this.consistencyManager.remoteChange(t,i,n,o,e,r,void 0,void 0,void 0,s,void 0,a,l,h),!1;this.cache[n]||(this.cache[n]=new Map);let u=this.cache[n].get(o);return(c||!u||u.ticket<t||u.ticket===t&&(u.client<i||u.client===i&&!!u.pend!=!!s))&&this.cache[n].set(o,{client:i,ticket:t,dataType:r,data:e,pend:s,unique:a,pChange:u?void 0:l,num:h}),!0}onDocHead(){}onEnd(){}setDocType(o,t){o===this.uuid&&(this._headType=t)}setBusTopic(o){this.busTopic=o}publish(){var o,t,e;if(this.publishCache)return this.publishCache();let r=!1;for(let[i,n]of this.deleteCache){if(this.channel.canPush()){(o=this.onDelete)==null||o.call(this,n),delete this.cache[i];continue}r=!0;break}if(r)return r;for(let i in this.cache){let n=this.cache[i].keys();for(let s of n){let a=this.cache[i].get(s);if(r=this.publishLine(s,a.ticket,a.data,a.dataType,a.client,i,a.pend,a.unique,a.pChange,!1,a.num),r)break;this.cache[i].delete(s)}if(r)break}return(e=(t=this.selectManager)==null?void 0:t.rePublish)==null||e.call(t),r}publishSelected(o,t){this.selectManager.publishSelected(o,t)}clear(){var o,t;for(let e of this.sub)e.cancel();this.sub.length=0,this.cache={},this.deleteCache.clear(),this.setIsInitIng(!1),this.channel.removeCompiler(this),(t=(o=this.selectManager)==null?void 0:o.dispose)==null||t.call(o),this.selectManager=null,this.isInit=!1,this.setIsInitIng(!1)}async init(o=!0,t=!0,e=!0,r,i,n,s){try{if(this.isInit)return{success:!0};if(this.isInitIng)throw new Error("\u6B63\u5728\u521D\u59CB\u5316\u4E2D");return this.isProject?await this.initProject(o,t,e,r,n,s):await this.initLib(e,r,i,n,s)}catch(a){throw this.clear(),new Error(`${this._headType}+'Compiler' ${this.uuid} init false: ${(a==null?void 0:a.message)||a||""}`,{cause:a})}finally{this.isInitIng=!1}}async flowRead(o){let t=this.consistencyManager.flowParseFull(),e=t.update,r=this;t.update=i=>{if(r.isDestroy)return!0;e(i)},await(0,$0t.flowRead)(o,t)}pushOnLine(o,t){if(this.consistencyManager)for(let e of o)this.publishLine(e[0],e[1],e[2],e[3],e[4],t,e[5],e[6],e[7],!1,e[8])}async initProject(o,t,e,r,i,n){if(this.setIsInitIng(!0),this.channel.addCompiler(this),this.dataBus=NJ(`/${this.windowId}/project/${this.path}`),i&&this.sub.push(this.dataBus.subscribe(`/pro-mgr/${this.uuid}/number/update`,l=>{if(this.onOrderNm)for(let c of l)this.onOrderNm(c[0],c[1],c[2])})),e&&this.busTopic.projectUpdate&&this.sub.push(this.dataBus.subscribe(Mw(this.busTopic.projectUpdate,{uuid:this.uuid}),l=>{this.onUpdate?this.onUpdate(l):this.pushOnLine(l,this.uuid)})),e&&this.busTopic.projectCanSave&&this.sub.push(this.dataBus.subscribe(this.busTopic.projectCanSave,l=>{this.canSave=l})),e&&this.busTopic.subDelete&&this.sub.push(this.dataBus.subscribe(this.busTopic.subDelete,l=>{var c;this.channel.canPush()?(c=this.onDelete)==null||c.call(this,l):this.deleteCache.set(l[0],l)})),e&&this.consistencyManager&&this.sub.push(this.dataBus.subscribe(Oh.subMaxTick,l=>{this.consistencyManager.setMaxTicket(l.ticket,l.force)})),e&&t&&this.sub.push(this.dataBus.subscribe(Oh.subBlob,l=>{this.pushOnLine(l,"BLOB")})),e&&o&&this.sub.push(this.dataBus.subscribe(Oh.subFont,l=>{this.pushOnLine(l,"FONT")})),e&&this.consistencyManager&&this.sub.push(this.dataBus.subscribe(Mw(Oh.subRevoke,{uuid:this.uuid}),l=>this.revoke(l))),!this.busTopic.getProject)throw new Error("\u83B7\u53D6\u6570\u636E\u5931\u8D25\uFF01\uFF01\uFF01");this.isDestroy=!1;let s={doc:[this.uuid],watch:e,needNum:i,needDelete:n};t&&s.doc.push("BLOB"),o&&s.doc.push("FONT");let a=await this.dataBus.rpcCall(this.busTopic.getProject,s);if(this.isWatch=e,!this.isDestroy){if(!a.success)throw new Error("\u83B7\u53D6\u6570\u636E\u5931\u8D25\uFF01\uFF01\uFF01",a);if(this.canSave=!(a!=null&&a.readOnly),this.consoleDebug("init",a.result),a.maxTicket&&this.consistencyManager&&this.consistencyManager.setMaxTicket(a.maxTicket),a.data&&this.onDocDetail&&this.onDocDetail(a.client||Tm(),0,a.data,!1),a.channel&&await this.flowRead(a.channel),!this.isDestroy){if(this.handleInit?this.handleInit(a):a.result&&this.consistencyManager&&this.consistencyManager.parseFull(a.result,this.uuid,this._headType),r){let l=this.user=this.user||a.user||await this.wsBus.rpcCall(Oh.getUserL);this.selectManager=new r4e(this.uuid,this.path,this.windowId,this.channel,this.dataBus,this.wsBus,this.selectedProps,l),await this.selectManager.init()}return this.isInit=!0,this.setIsInitIng(!1),{success:!0}}}}async initLib(o,t,e,r,i){if(this.setIsInitIng(!0),this.channel.addCompiler(this),this.dataBus=NJ(`/${this.windowId}/libWorker`),!this.busTopic.getPerson)throw new Error("\u83B7\u53D6\u6570\u636E\u5931\u8D25\uFF01\uFF01\uFF01");let n=e?Tm():"";this.isDestroy=!1;let s=await this.dataBus.rpcCall(this.busTopic.getPerson,{uuid:this.uuid,path:this.path,watch:o,channel:n,needNum:r,needDelete:i});if(this.isWatch=o,this.isDestroy)return;if(!s.success)throw new Error("\u83B7\u53D6\u6570\u636E\u5931\u8D25\uFF01\uFF01\uFF01",s);this.consoleDebug("init",s.dataStr);let a=s.data||s.result;if(a&&this.onDocDetail&&this.onDocDetail(s.client||Tm(),0,a,!1),r&&this.sub.push(this.dataBus.subscribe(`/pro-mgr/${this.uuid}/number/update`,l=>{if(this.onOrderNm)for(let c of l)this.onOrderNm(c[0],c[1],c[2])})),o&&this.busTopic.personUpdate&&this.sub.push(this.dataBus.subscribe(Mw(this.busTopic.personUpdate,{uuid:this.uuid}),l=>{this.pushOnLine(l,this.uuid)})),o&&this.sub.push(this.dataBus.subscribe(Mw(Mw(Oh.subRevoke,{uuid:this.uuid}),{uuid:this.uuid}),l=>this.revoke(l))),n&&await this.flowRead(n),!this.isDestroy){if(s.dataStr&&this.consistencyManager&&this.consistencyManager.parseFull(s.dataStr),t){let l=this.user=this.user||s.user||await this.wsBus.rpcCall(Oh.getUserL);this.selectManager=new r4e(this.uuid,this.path,this.windowId,this.channel,this.wsBus,this.wsBus,this.selectedProps,l),await this.selectManager.init()}return this.isInit=!0,this.setIsInitIng(!1),{success:!0}}}revoke(o){for(let t of o)this.consistencyManager&&this.consistencyManager.revoke(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],(...e)=>this.publishLine(...e)),t[10]&&this.setMaxNum&&this.setMaxNum(t[6],t[10],t[1])}cachePendData(o,t,e,r,i,n){if(this.pendCache[o]||(this.pendCache[o]={type:n,pend:[]}),this.pendCache[o].pend.push([t,e,i,r]),this.pendCacheLength+=r.length+1,this.pendCacheLength>1e7&&this.publishPendData(),!this.pendTimer){let s;this.pendPromise=new Promise(a=>s=a),this.pendTimer=setTimeout(()=>{this.publishPendData(),s&&s(),this.pendTimer=null},0)}}publishPendData(){if(this.pendCacheLength){this.dataBus.publish(Oh.pushPend,[this.pendCache,this.consistencyManager.getClient(),this.uniqueId,this.uuid]);for(let o in this.pendCache)this.pendCache[o].pend.length=0;this.pendCache={},this.pendCacheLength=0}}localChange(o,t,e,r=this.uuid,i,n){if(!this.isInit||!this.canSave||!this.consistencyManager)return 0;if(t&&!t.startsWith("{"))return console.error("\u4E0A\u4F20\u7684\u683C\u5F0F\u4E0D\u6B63\u786E",o,e,t),0;let s=this.consistencyManager.localChange(r,o,t,e,i,n);return this.cachePendData(r,o,s,t,e,i||this.headType),s}async sync(){if(!this.isInit)throw new Error("\u6570\u636E\u672A\u521D\u59CB\u5316\uFF0C\u65E0\u6CD5\u540C\u6B65");let o=Tm();this.dataBus.publish(Oh.pushSync,o),await this.dataBus.pullA(Mw(Oh.pullASync,{id:o}))}async destroy(){return this.isDestroy?{success:!1}:(this.consistencyManager&&this.dataBus&&(this.pendPromise&&await this.pendPromise,this.dataBus.publish(Oh.pushRevoke,[this.uuid,this.uniqueId,this.consistencyManager.getClient()])),this.clear(),this.isDestroy=!0,this.isWatch&&this.dataBus&&!this.isProject&&this.dataBus.publish(Oh.personDestroy,{uuid:this.uuid,path:this.path}),this.isWatch&&this.dataBus&&this.busTopic.unwatch&&this.dataBus.publish(this.busTopic.unwatch,this.uuid),this.isWatch=!1,{success:!0})}async save(o=[this.uuid,"BLOB","FONT"]){try{if(!this.isInit)throw new Error("\u6570\u636E\u672A\u521D\u59CB\u5316\uFF0C\u65E0\u6CD5\u4FDD\u5B58");if(!this.consistencyManager)throw new Error("\u65E0\u6CD5\u652F\u6301\u4FDD\u5B58");let t=this.isProject?Oh.projectSave:Oh.personSave;if(!t)throw new Error("\u65E0\u6CD5\u652F\u6301\u4FDD\u5B58");this.pendPromise&&await this.pendPromise;let e=await this.dataBus.rpcCall(t,{uuid:this.uuid,path:this.path,docIds:o,uniqueId:this.uniqueId,client:this.consistencyManager.getClient()});return this.consoleDebug("save",e),e}catch(t){throw new Error(`${this._headType}+'Compiler' ${this.uuid} \u4FDD\u5B58\u5931\u8D25: ${(t==null?void 0:t.message)||t||""}`,{cause:t})}}async getBlob(o){return this.dataBus.rpcCall("/mgr/projectWorker/blob/getBlob",o)}async getFont(o,t,e,r,i,n,s,a){let l={text:o,fontFamily:t,fontSize:e,thickness:r,bold:i,italic:n,reverse:s,expansion:a},c=await this.dataBus.rpcCall("/mgr/projectWorker/font/get",l);return c.success?{success:!0,result:Object.assign(l,JSON.parse(c.result))}:c}async checkSave(){return this.pendPromise&&await this.pendPromise,await this.dataBus.rpcCall(Oh.hasSaveData,{uuid:this.uuid,uniqueId:this.uniqueId})}};var eft=(o=>(o.DIFFERENTIAL_PAIR="DIFFERENTIAL_PAIR",o.NET_CLASS="NET_CLASS",o.EQL_NET_GRP="EQL_NET_GRP",o))(eft||{});var tft=class{constructor(o,t,e){this.uuid=o,this.maxTicket=0,this.encodeConsistency=new sdt(e),this.encodeConsistency.setDoctype(o,t),this.encodeConsistency.setDoctype("BLOB","BLOB"),this.encodeConsistency.setDoctype("FONT","FONT")}setFlowWriter(o){this.write=o}localChange(o,t,e,r=this.uuid){let i,n=typeof t=="string"?t:JSON.stringify(t);return this.write?(i=++this.maxTicket,this.write(r,this.encodeConsistency.getDoctype(r),Sf(e,i,o,n))):i=this.encodeConsistency.localChange(r,o,n,e),i}getDataStr(o=!0){return this.encodeConsistency.compressFull({notDocHead:!o})}removeDataStr(){this.encodeConsistency.removeCache()}uploadBlob(o,t){let e=qJ(t),r={filename:o,content:t};return{success:!0,ticket:this.localChange(e,JSON.stringify(r),"BLOB","BLOB"),hash:e}}deleteBlob(o){return{success:!0,ticket:this.localChange(o,"","BLOB","BLOB")}}};var rft=class extends tft{constructor(o,t,e){super(o,t,e),this.uuid=o}uploadFont(o){let{text:t,fontFamily:e,fontSize:r,thickness:i,bold:n,italic:s,reverse:a,expansion:l,width:c,height:h,path:u}=o,d={width:c,height:h,path:u},p=TP(t,e,r,i,n,s,a,l);return{success:!0,ticket:this.localChange(p,JSON.stringify(d),"FONT","FONT")}}deleteFont(o){let{text:t,fontFamily:e,fontSize:r,thickness:i,bold:n,italic:s,reverse:a,expansion:l}=o,c=TP(t,e,r,i,n,s,a,l);return{success:!0,ticket:this.localChange(c,"","FONT","FONT")}}uploadString(o,t){return{success:!0,ticket:this.localChange(o,t,"STRING")}}deleteString(o){return{success:!0,ticket:this.localChange(o,"","STRING")}}uploadAttr(o,t){return{success:!0,ticket:this.localChange(o,t,"ATTR")}}deleteAttr(o){return{success:!0,ticket:this.localChange(o,"","ATTR")}}uploadPanelize(o){return{success:!0,ticket:this.localChange("PANELIZE",o,"PANELIZE")}}deletePanelize(){return{success:!0,ticket:this.localChange("PANELIZE","","PANELIZE")}}uploadRuleSelector(o){let t=JSON.stringify(["RULE_SELECTOR",o.ruleSelect]),e={...o};return delete e.ruleSelect,{success:!0,ticket:this.localChange(t,e,"RULE_SELECTOR")}}deleteRuleSelector(o){return{success:!0,ticket:this.localChange(JSON.stringify(["RULE_SELECTOR",o]),"","RULE_SELECTOR")}}uploadRule(o){let t=JSON.stringify(["RULE",o.ruleType,o.ruleName]),e={...o};return delete e.ruleType,delete e.ruleName,{success:!0,ticket:this.localChange(t,e,"RULE")}}deleteRule(o,t){return{success:!0,ticket:this.localChange(JSON.stringify(["RULE",o,t]),"","RULE")}}uploadRuleTemplate(o){return{success:!0,ticket:this.localChange("RULE_TEMPLATE",o,"RULE_TEMPLATE")}}uploadDimension(o,t){return{success:!0,ticket:this.localChange(o,t,"DIMENSION")}}deleteDimension(o){return{success:!0,ticket:this.localChange(o,"","DIMENSION")}}uploadBoss(o,t){return{success:!0,ticket:this.localChange(o,t,"BOSS")}}deleteBoss(o){return{success:!0,ticket:this.localChange(o,"","BOSS")}}uploadShellEntity(o,t){return{success:!0,ticket:this.localChange(o,t,"SHELL_ENTITY")}}deleteShellEntity(o){return{success:!0,ticket:this.localChange(o,"","SHELL_ENTITY")}}uploadShellCut(o,t){return{success:!0,ticket:this.localChange(o,t,"SHELLCUT")}}deleteShellCut(o){return{success:!0,ticket:this.localChange(o,"","SHELLCUT")}}uploadCrease(o,t){return{success:!0,ticket:this.localChange(o,t,"CREASE")}}deleteCrease(o){return{success:!0,ticket:this.localChange(o,"","CREASE")}}uploadShell(o,t){return{success:!0,ticket:this.localChange(o,t,"SHELL")}}deleteShell(o){return{success:!0,ticket:this.localChange(o,"","SHELL")}}uploadFpcFill(o,t){return{success:!0,ticket:this.localChange(o,t,"FPC_FILL")}}deleteFpcFill(o){return{success:!0,ticket:this.localChange(o,"","FPC_FILL")}}uploadTeardrop(o,t){return{success:!0,ticket:this.localChange(o,t,"TEARDROP")}}deleteTeardrop(o){return{success:!0,ticket:this.localChange(o,"","TEARDROP")}}uploadImage(o,t){return{success:!0,ticket:this.localChange(o,t,"IMAGE")}}deleteImage(o){return{success:!0,ticket:this.localChange(o,"","IMAGE")}}uploadPoured(o,t){return{success:!0,ticket:this.localChange(gc(o,"POURED"),t,"POURED")}}deletePoured(o){return{success:!0,ticket:this.localChange(gc(o,"POURED"),"","POURED")}}uploadPour(o,t){return{success:!0,ticket:this.localChange(o,t,"POUR")}}deletePour(o){return{success:!0,ticket:this.localChange(o,"","POUR")}}uploadRegion(o,t){return{success:!0,ticket:this.localChange(o,t,"REGION")}}deleteRegion(o){return{success:!0,ticket:this.localChange(o,"","REGION")}}uploadFill(o,t){return{success:!0,ticket:this.localChange(o,t,"FILL")}}deleteFill(o){return{success:!0,ticket:this.localChange(o,"","FILL")}}uploadLayerFill(o,t){return{success:!0,ticket:this.localChange(gc(o,"LAYER_FILL"),t,"LAYER_FILL")}}deleteLayerFill(o){return{success:!0,ticket:this.localChange(gc(o,"LAYER_FILL"),"","LAYER_FILL")}}uploadPoly(o,t){return{success:!0,ticket:this.localChange(o,t,"POLY")}}deletePoly(o){return{success:!0,ticket:this.localChange(o,"","POLY")}}uploadEQLenGrp(o,t){return{success:!0,ticket:this.localChange(o,t,"EQLEN_GRP")}}deleteEQLenGrp(o){return{success:!0,ticket:this.localChange(o,"","EQLEN_GRP")}}uploadObj(o,t){return{success:!0,ticket:this.localChange(o,t,"OBJ")}}deleteObj(o){return{success:!0,ticket:this.localChange(o,"","OBJ")}}uploadArc(o,t){return{success:!0,ticket:this.localChange(o,t,"ARC")}}deleteArc(o){return{success:!0,ticket:this.localChange(o,"","ARC")}}uploadLine(o,t){return{success:!0,ticket:this.localChange(o,t,"LINE")}}deleteLine(o){return{success:!0,ticket:this.localChange(o,"","LINE")}}uploadPad(o,t){return{success:!0,ticket:this.localChange(o,t,"PAD")}}deletePad(o){return{success:!0,ticket:this.localChange(o,"","PAD")}}uploadVia(o,t){return{success:!0,ticket:this.localChange(o,t,"VIA")}}deleteVia(o){return{success:!0,ticket:this.localChange(o,"","VIA")}}uploadPreference(o){return{success:!0,ticket:this.localChange("PREFERENCE",o,"PREFERENCE")}}uploadSilkOpts(o,t){return{success:!0,ticket:this.localChange(gc(o,"SILK_OPTS"),t,"SILK_OPTS")}}deleteSilkOpts(o){return{success:!0,ticket:this.localChange(gc(o,"SILK_OPTS"),"","SILK_OPTS")}}uploadGroup(o,t){return{success:!0,ticket:this.localChange(o,t,"GROUP")}}deleteGroup(o){return{success:!0,ticket:this.localChange(o,"","GROUP")}}uploadXSignalsGroup(o,t){return{success:!0,ticket:this.localChange(o,t,"X_SIGNAL_GROUP")}}deleteXSignalsGroup(o){return{success:!0,ticket:this.localChange(o,"","X_SIGNAL_GROUP")}}uploadXSignals(o,t){return{success:!0,ticket:this.localChange(o,t,"X_SIGNALS")}}deleteXSignals(o){return{success:!0,ticket:this.localChange(o,"","X_SIGNALS")}}uploadPrimitive(o,t){return{success:!0,ticket:this.localChange(gc(o,"PRIMITIVE"),t,"PRIMITIVE")}}deletePrimitive(o){return{success:!0,ticket:this.localChange(gc(o,"PRIMITIVE"),"","PRIMITIVE")}}uploadNet(o,t){return{success:!0,ticket:this.localChange(gc(o,"NET"),t,"NET")}}deleteNet(o){return{success:!0,ticket:this.localChange(gc(o,"NET"),"","NET")}}uploadPartition(o,t){return{success:!0,ticket:this.localChange(o,t,"PARTITION")}}deletePartition(o){return{success:!0,ticket:this.localChange(o,"","PARTITION")}}uploadActiveLayer(o){return{success:!0,ticket:this.localChange("ACTIVE_LAYER",o,"ACTIVE_LAYER")}}uploadLayerPhys(o,t){return{success:!0,ticket:this.localChange(gc(o,"LAYER_PHYS"),t,"LAYER_PHYS")}}deleteLayerPhys(o){return{success:!0,ticket:this.localChange(gc(o,"LAYER_PHYS"),"","LAYER_PHYS")}}uploadLayer(o,t){return{success:!0,ticket:this.localChange(gc(o,"LAYER"),t,"LAYER")}}deleteLayer(o){return{success:!0,ticket:this.localChange(gc(o,"LAYER"),"","LAYER")}}uploadCanvas(o){return{success:!0,ticket:this.localChange("CANVAS",o,"CANVAS")}}uploadBoard(o){return{success:!0,ticket:this.localChange("BOARD",o,"BOARD")}}deleteBoard(){return{success:!0,ticket:this.localChange("BOARD","","BOARD")}}},ZJ=class extends rft{constructor(o,t){super(o,"PCB",t)}uploadPadNet(o){let t=JSON.stringify(["PAD_NET",o.componentId,o.padNum,o.padId||""]),e={...o};return delete e.componentId,delete e.padNum,delete e.padId,{success:!0,ticket:this.localChange(t,e,"PAD_NET")}}deletePadNet(o,t,e){return{success:!0,ticket:this.localChange(JSON.stringify(["PAD_NET",o,t,e||""]),"","PAD_NET")}}uploadComponent(o,t){return{success:!0,ticket:this.localChange(o,t,"COMPONENT")}}deleteComponent(o){return{success:!0,ticket:this.localChange(o,"","COMPONENT")}}};var vFt=IN(uW()),xFt=IN(uW());var Z4e=class extends W0t{constructor(o,t,e,r,i,n,s,a=(l=>(l=f0())==null?void 0:l._TAB_ID_)()){let l=new fbe(a);super(l),this.isProject=e,this.encode=n,this.base=new K4e(o,t,e,a,r,l,i,i==="PCB"?Z0t:K0t,s,(...c)=>this.setIsInit(...c),(...c)=>this.onDocDetail(...c),void 0,void 0,void 0,void 0,(c,h,u)=>this.onOrderNum(c,h,u),(c,h,u)=>{this.setMaxNum(c,h,!!u),u&&this.deleteOrderNum(u)})}get dataBus(){return this.base.dataBus}set dataBus(o){this.base.dataBus=o}async init(o=!0,t=!0,e=!0,r,i=!0,n){return this.setNeedNum(i),this.base.init(o,t,e,r,!0,i,n)}async sync(){return this.base.sync()}async destroy(){return this.base.destroy()}async save(){return this.base.save()}checkSave(){return this.base.checkSave()}publishSelected(o,t){this.base.publishSelected(o,t)}uploadBlob(o,t){let e=qJ(t),r={filename:o,content:t};return{success:!0,ticket:this.localChange({id:e,data:JSON.stringify(r),dataType:"BLOB"},"BLOB","BLOB"),hash:e}}deleteBlob(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"BLOB"},"BLOB","BLOB")}}uploadFont(o){let{text:t,fontFamily:e,fontSize:r,thickness:i,bold:n,italic:s,reverse:a,expansion:l,width:c,height:h,path:u}=o,d={width:c,height:h,path:u},p=TP(t,e,r,i,n,s,a,l);return{success:!0,ticket:this.localChange({id:p,data:JSON.stringify(d),dataType:"FONT"},"FONT","FONT")}}deleteFont(o){let{text:t,fontFamily:e,fontSize:r,thickness:i,bold:n,italic:s,reverse:a,expansion:l}=o,c=TP(t,e,r,i,n,s,a,l);return{success:!0,ticket:this.localChange({id:c,data:"",dataType:"FONT"},"FONT","FONT")}}async updateFootprint(o){return this.isProject?this.dataBus.rpcCall("/mgr/projectWorker/footprint/update",o):{success:!1,message:"compiler \u6682\u4E0D\u652F\u6301\u4E2A\u4EBA\u5E93\u76F4\u63A5\u4FEE\u6539\u5C01\u88C5\u4FE1\u606F"}}async generateTemplate(o,t){return this.isProject?this.dataBus.rpcCall("/mgr/projectWorker/footprint/generateTemplate",{custom:o,renameKey:t}):{success:!1,message:"compiler \u6682\u4E0D\u652F\u6301\u4E2A\u4EBA\u5E93\u8C03\u7528\u8BE5\u63A5\u53E3"}}localChange(o,t=this.base.uuid,e){var r,i;let n=this.getOrderNum(o.id);return(i=(r=this.needOrderType)==null?void 0:r.includes)!=null&&i.call(r,o.dataType)&&n===void 0&&(n=this.getMaxNum(o.dataType),this.setOrderNum(o.id,n,o.dataType),this.onOrderNum(o.id,o.dataType,n)),this.base.localChange(o.id,o.data,o.dataType,t,e,n)}uploadString(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeString(o,t))}}deleteString(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"STRING"})}}uploadAttr(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeAttr(o,t))}}deleteAttr(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"ATTR"})}}uploadPanelize(o){return{success:!0,ticket:this.localChange(this.encode.encodePanelize(o))}}deletePanelize(){return{success:!0,ticket:this.localChange({id:"PANELIZE",data:"",dataType:"PANELIZE"})}}uploadRuleSelector(o){return{success:!0,ticket:this.localChange(this.encode.encodeRuleSelector(o))}}deleteRuleSelector(o){return{success:!0,ticket:this.localChange({id:JSON.stringify(["RULE_SELECTOR",o]),data:"",dataType:"RULE_SELECTOR"})}}uploadRule(o){return{success:!0,ticket:this.localChange(this.encode.encodeRule(o))}}deleteRule(o,t){return{success:!0,ticket:this.localChange({id:JSON.stringify(["RULE",o,t]),data:"",dataType:"RULE"})}}uploadRuleTemplate(o){return{success:!0,ticket:this.localChange(this.encode.encodeRuleTemplate(o))}}uploadDimension(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeDimension(o,t))}}deleteDimension(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"DIMENSION"})}}uploadBoss(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeBoss(o,t))}}deleteBoss(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"BOSS"})}}uploadShellEntity(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeShellEntity(o,t))}}deleteShellEntity(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"SHELL_ENTITY"})}}uploadShellCut(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeShellCut(o,t))}}deleteShellCut(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"SHELLCUT"})}}uploadCrease(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeCrease(o,t))}}deleteCrease(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"CREASE"})}}uploadShell(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeShell(o,t))}}deleteShell(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"SHELL"})}}uploadFpcFill(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeFpcFill(o,t))}}deleteFpcFill(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"FPC_FILL"})}}uploadTeardrop(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeTeardrop(o,t))}}deleteTeardrop(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"TEARDROP"})}}uploadImage(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeImage(o,t))}}deleteImage(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"IMAGE"})}}uploadPoured(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePoured(o,t))}}deletePoured(o){return{success:!0,ticket:this.localChange({id:gc(o,"POURED"),data:"",dataType:"POURED"})}}uploadPour(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePour(o,t))}}deletePour(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"POUR"})}}uploadRegion(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeRegion(o,t))}}deleteRegion(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"REGION"})}}uploadFill(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeFill(o,t))}}deleteFill(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"FILL"})}}uploadLayerFill(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeLayerFill(o,t))}}deleteLayerFill(o){return{success:!0,ticket:this.localChange({id:gc(o,"LAYER_FILL"),data:"",dataType:"LAYER_FILL"})}}uploadPoly(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePoly(o,t))}}deletePoly(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"POLY"})}}uploadEQLenGrp(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeEQLenGrp(o,t))}}deleteEQLenGrp(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"EQLEN_GRP"})}}uploadObj(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeObj(o,t))}}deleteObj(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"OBJ"})}}uploadArc(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeArc(o,t))}}deleteArc(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"ARC"})}}uploadLine(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeLine(o,t))}}deleteLine(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"LINE"})}}uploadPad(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePad(o,t))}}deletePad(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"PAD"})}}uploadVia(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeVia(o,t))}}deleteVia(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"VIA"})}}uploadPreference(o){return{success:!0,ticket:this.localChange(this.encode.encodePreference(o))}}uploadSilkOpts(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeSilkOpts(o,t))}}deleteSilkOpts(o){return{success:!0,ticket:this.localChange({id:gc(o,"SILK_OPTS"),data:"",dataType:"SILK_OPTS"})}}uploadGroup(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeGroup(o,t))}}deleteGroup(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"GROUP"})}}uploadPrimitive(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePrimitive(o,t))}}deletePrimitive(o){return{success:!0,ticket:this.localChange({id:gc(o,"PRIMITIVE"),data:"",dataType:"PRIMITIVE"})}}uploadNet(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeNet(o,t))}}deleteNet(o){return{success:!0,ticket:this.localChange({id:gc(o,"NET"),data:"",dataType:"NET"})}}uploadActiveLayer(o){return{success:!0,ticket:this.localChange(this.encode.encodeActiveLayer(o))}}uploadLayerPhys(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeLayerPhys(o,t))}}deleteLayerPhys(o){return{success:!0,ticket:this.localChange({id:gc(o,"LAYER_PHYS"),data:"",dataType:"LAYER_PHYS"})}}uploadLayer(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeLayer(o,t))}}deleteLayer(o){return{success:!0,ticket:this.localChange({id:gc(o,"LAYER"),data:"",dataType:"LAYER"})}}uploadCanvas(o){return{success:!0,ticket:this.localChange(this.encode.encodeCanvas(o))}}uploadBoard(o){return{success:!0,ticket:this.localChange({id:"BOARD",data:JSON.stringify(o),dataType:"BOARD"})}}deleteBoard(){return{success:!0,ticket:this.localChange({id:"BOARD",data:"",dataType:"BOARD"})}}uploadXSignalsGroup(o,t){return{success:!0,ticket:this.localChange({id:o,data:JSON.stringify(t),dataType:"X_SIGNAL_GROUP"})}}deleteXSignalsGroup(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"X_SIGNAL_GROUP"})}}uploadXSignals(o,t){return{success:!0,ticket:this.localChange({id:o,data:JSON.stringify(t),dataType:"X_SIGNALS"})}}deleteXSignals(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"X_SIGNALS"})}}},bW=class extends Z4e{constructor(o,t,e,r){let i=new Y4e;super(o,t,!0,e,"PCB",i,{getSelect:()=>{var n;return(n=this.canvasSelected)==null?void 0:n.call(this)},onSelect:(...n)=>{var s;return(s=this.onSelectChange)==null?void 0:s.call(this,n[0],n[1],n[2])},onQuit:(...n)=>{var s;return(s=this.onSelectQuit)==null?void 0:s.call(this,n[0],n[1])}},r),this.uuid=o,this.project=t,this.windowId=r,this.encoder=i}async customFootprint(o,t){return this.dataBus.rpcCall("/mgr/projectWorker/footprint/clone",{uuid:o,source:t})}async footprintIsExist(o){var t;return(t=await this.dataBus.rpcCall("/mgr/projectWorker/footprint/isExist",o))==null?void 0:t.result}uploadPadNet(o){return{success:!0,ticket:this.localChange(this.encoder.encodePadNet(o))}}deletePadNet(o,t,e){return{success:!0,ticket:this.localChange({id:JSON.stringify(["PAD_NET",o,t,e||""]),data:"",dataType:"PAD_NET"})}}uploadComponent(o,t){return{success:!0,ticket:this.localChange(this.encoder.encodeComponent(o,t))}}deleteComponent(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"COMPONENT"})}}uploadPartition(o,t){return{success:!0,ticket:this.localChange(this.encoder.encodePartition(o,t))}}deletePartition(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"PARTITION"})}}},J4e=class extends Z4e{constructor(o,t,e,r,i=(n=>(n=f0())==null?void 0:n._TAB_ID_)()){super(o,t,e,r,"FOOTPRINT",new j4e,{getSelect:()=>{var n;return(n=this.canvasSelected)==null?void 0:n.call(this)},onSelect:(...n)=>{var s;return(s=this.onSelectChange)==null?void 0:s.call(this,n[0],n[1],n[2])},onQuit:(...n)=>{var s;return(s=this.onSelectQuit)==null?void 0:s.call(this,n[0],n[1])}},i),this.uuid=o,this.path=t,this.isProject=e,this.windowId=i}onComponent(){}onComponentNum(){}onDelComponent(){}onPadNet(){}onDelPadNet(){}};var Q4e=class{constructor(o,t,e,r,i=(n=>(n=f0())==null?void 0:n._TAB_ID_)()){this.uuid=o,this.path=t,this.isProject=e,this.windowId=i,this.cache=null;let n=s=>(s||(s=this.cache),this.base.channel.canPush()?(s&&this.onDocDetail(s[0],s[1],s[2]),this.cache=null,!1):(this.cache=s,!0));this.base=new K4e(o,t,e,i,r,void 0,"DEVICE",J0t,void 0,void 0,(...s)=>this.onDocDetail(s[0],s[1],s[2]),n,s=>this.onDocDetail(s.client,s.ticket,s.result),void 0,n)}async init(o=!0){return this.base.init(!1,!1,o,!1)}async sync(){return this.base.sync()}async destroy(){let o=await this.base.destroy();return o.success&&(this.cache=null),o}};var JJ=class{};var QJ=class extends JJ{constructor(){super(...arguments);this.errorLayerData=new Set;this.errorLayerPhyData=new Set}clear(){this.errorLayerData.clear(),this.errorLayerPhyData.clear()}deleteLayerId(e){this.errorLayerData.delete(e)}deleteLayerPhyId(e){this.errorLayerPhyData.delete(e)}fix(e,r){let i=new Map,n=new Map,s=new Map;for(let l of e)i.set(l.layerId,l),l.getType()=="SUBSTRATE"&&s.set(l.layerId,l);for(let l of r)n.set(l.layerId,l);let a=260;for(let[l,c]of s)if(l>=101&&l<361){this.errorLayerData.add(l),this.errorLayerPhyData.add(l);let h=l+a;if(s.has(h))i.delete(l),n.delete(l);else{c.layerId=h;let u=n.get(l);u!=null&&(u.layerId=h)}}e.length=0,r.length=0;for(let[,l]of i)e.push(l);for(let[,l]of n)r.push(l)}};var AN=class{constructor(){this.layerPhyFix=new QJ}};var gp=class extends bW{constructor(e,r,i,n){super(e,r,i,n);this.hasSynced=new Map;this.initFinished=!1;this.mgr=new AN}onXSignalsGroup(e,r,i,n,s){throw new Error("Method not implemented.")}onDelXSignalsGroup(e,r,i,n){throw new Error("Method not implemented.")}onXSignals(e,r,i,n,s){throw new Error("Method not implemented.")}onDelXSignals(e,r,i,n){throw new Error("Method not implemented.")}getSelectHandle(){return this.selectHandle}setSelectHandle(e){this.selectHandle=e}getDocDetail(){return this.docDetail}canvasSelected(){var e;return(e=this.selectHandle)==null?void 0:e.getSelect()}onSelectChange(e,r,i){var n;(n=this.selectHandle)==null||n.onSelected(e,r,i)}onSelectQuit(e,r){var i;(i=this.selectHandle)==null||i.onDestroy(e,r)}setHandle(e,r){this.handle!=null&&!r&&this.handle.destory(),this.handle=e,this.handle.setClient(this.consistencyManager.getClient())}destroy(){return new Promise(e=>{super.destroy().then(r=>{this.handle=null,e(r)})})}setTicket(e=this.consistencyManager.getMaxTicket()+1){this.handle.setTicket(e)}getHandle(){return this.handle}onBoard(e,r,i,n){this.handle.onBoard(e,r,i,n)}onDelBoard(e,r,i){this.handle.onDelBoard(e,r,i)}onLayerFill(e,r,i,n,s){this.handle.onLayerFill(e,r,i,n,s)}onDelLayerFill(e,r,i,n){this.handle.onDelLayerFill(e,r,i,n)}onBlob(e,r,i,n,s){this.handle.onBlob(e,r,i,n,s)}onDelBlob(e,r,i,n){this.handle.onDelBlob(e,r,i,n)}onFont(e,r,i,n){this.handle.onFont(e,r,i,n)}onDelFont(e,r,i,n){this.handle.onDelFont(e,r,i,n)}onString(e,r,i,n,s,a){this.handle.onString(e,r,i,n,s,a)}onDelString(e,r,i,n){this.handle.onDelString(e,r,i,n)}onAttr(e,r,i,n,s,a){this.handle.onAttr(e,r,i,n,s,a)}onDelAttr(e,r,i,n){this.handle.onDelAttr(e,r,i,n)}onPadNet(e,r,i,n){this.handle.onPadNet(e,r,i,n)}onDelPadNet(e,r,i,n,s,a){this.handle.onDelPadNet(e,r,n,i,s,a)}onComponent(e,r,i,n,s,a){this.handle.onComponent(e,r,i,n,s,a)}onDelComponent(e,r,i,n){this.handle.onDelComponent(e,r,i,n)}onPanelize(e,r,i,n){this.handle.onPanelize(e,r,i,n)}onDelPanelize(e,r,i){this.handle.onDelPanelize(e,r,i)}onRuleSelector(e,r,i,n){this.handle.onRuleSelector(e,r,i,n)}onDelRuleSelector(e,r,i,n){this.handle.onDelRuleSelector(e,r,i,n)}onRule(e,r,i,n){this.handle.onRule(e,r,i,n)}onDelRule(e,r,i,n,s){this.handle.onDelRule(e,r,i,n,s)}onRuleTemplate(e,r,i,n){this.handle.onRuleTemplate(e,r,i,n)}onDimension(e,r,i,n,s,a){this.handle.onDimension(e,r,i,n,s,a)}onDelDimension(e,r,i,n){this.handle.onDelDimension(e,r,i,n)}onBoss(e,r,i,n,s,a){this.handle.onBoss(e,r,i,n,s,a)}onDelBoss(e,r,i,n){this.handle.onDelBoss(e,r,i,n)}onShellEntity(e,r,i,n,s,a){this.handle.onShellEntity(e,r,i,n,s,a)}onDelShellEntity(e,r,i,n){this.handle.onDelShellEntity(e,r,i,n)}onShellCut(e,r,i,n,s,a){this.handle.onShellCut(e,r,i,n,s,a)}onDelShellCut(e,r,i,n){this.handle.onDelShellCut(e,r,i,n)}onCrease(e,r,i,n,s,a){this.handle.onCrease(e,r,i,n,s,a)}onDelCrease(e,r,i,n){this.handle.onDelCrease(e,r,i,n)}onShell(e,r,i,n,s,a){this.handle.onShell(e,r,i,n,s,a)}onDelShell(e,r,i,n){this.handle.onDelShell(e,r,i,n)}onFpcFill(e,r,i,n,s,a){this.handle.onFpcFill(e,r,i,n,s,a)}onDelFpcFill(e,r,i,n){this.handle.onDelFpcFill(e,r,i,n)}onTeardrop(e,r,i,n,s,a){this.handle.onTeardrop(e,r,i,n,s,a)}onDelTeardrop(e,r,i,n){this.handle.onDelTeardrop(e,r,i,n)}onImage(e,r,i,n,s,a){this.handle.onImage(e,r,i,n,s,a)}onDelImage(e,r,i,n){this.handle.onDelImage(e,r,i,n)}onPoured(e,r,i,n,s,a){this.handle.onPoured(e,r,i,n,s,a)}onDelPoured(e,r,i,n){this.handle.onDelPoured(e,r,i,n)}onPour(e,r,i,n,s,a){this.handle.onPour(e,r,i,n,s,a)}onDelPour(e,r,i,n){this.handle.onDelPour(e,r,i,n)}onRegion(e,r,i,n,s,a){this.handle.onRegion(e,r,i,n,s,a)}onDelRegion(e,r,i,n){this.handle.onDelRegion(e,r,i,n)}onFill(e,r,i,n,s,a){s.fillStyle!=ob.PLANE&&this.handle.onFill(e,r,i,n,s,a)}onDelFill(e,r,i,n){this.handle.onDelFill(e,r,i,n)}onPoly(e,r,i,n,s,a){this.handle.onPoly(e,r,i,n,s,a)}onDelPoly(e,r,i,n){this.handle.onDelPoly(e,r,i,n)}onEQLenGrp(e,r,i,n,s){this.handle.onEQLenGrp(e,r,i,n,s)}onDelEQLenGrp(e,r,i,n){this.handle.onDelEQLenGrp(e,r,i,n)}onObj(e,r,i,n,s,a){this.handle.onObj(e,r,i,n,s,a)}onDelObj(e,r,i,n){this.handle.onDelObj(e,r,i,n)}onArc(e,r,i,n,s,a){this.handle.onArc(e,r,i,n,s,a)}onDelArc(e,r,i,n){this.handle.onDelArc(e,r,i,n)}onLine(e,r,i,n,s,a){this.initFinished&&this.hasSynced.set(e,n),this.handle.onLine(e,r,i,n,s,a)}onDelLine(e,r,i,n){this.handle.onDelLine(e,r,i,n)}onPad(e,r,i,n,s,a){this.handle.onPad(e,r,i,n,s,a)}onDelPad(e,r,i,n){this.handle.onDelPad(e,r,i,n)}onVia(e,r,i,n,s,a){this.handle.onVia(e,r,i,n,s,a)}onDelVia(e,r,i,n){this.handle.onDelVia(e,r,i,n)}onPreference(e,r,i,n){this.handle.onPreference(e,r,i,n)}onSilkOpts(e,r,i,n,s){this.handle.onSilkOpts(e,r,i,n,s)}onDelSilkOpts(e,r,i,n){this.handle.onDelSilkOpts(e,r,i,n)}onGroup(e,r,i,n,s){this.handle.onGroup(e,r,i,n,s)}onDelGroup(e,r,i,n){this.handle.onDelGroup(e,r,i,n)}onPrimitive(e,r,i,n,s){this.handle.onPrimitive(e,r,i,n,s)}onDelPrimitive(e,r,i,n){this.handle.onDelPrimitive(e,r,i,n)}onNet(e,r,i,n,s){this.handle.onNet(e,r,i,n,s)}onDelNet(e,r,i,n){this.handle.onDelNet(e,r,i,n)}onPartition(e,r,i,n,s,a){this.handle.onPartition(e,r,i,n,s,a)}onDelPartition(e,r,i,n){this.handle.onDelPartition(e,r,i,n)}onActiveLayer(e,r,i,n){this.handle.onActiveLayer(e,r,i,n)}onLayerPhys(e,r,i,n,s){this.handle.onLayerPhys(e,r,i,n,s)}onDelLayerPhys(e,r,i,n){this.mgr.layerPhyFix.deleteLayerPhyId(e),this.handle.onDelLayerPhys(e,r,i,n)}onLayer(e,r,i,n,s){this.handle.onLayer(e,r,i,n,s)}onDelLayer(e,r,i,n){this.mgr.layerPhyFix.deleteLayerId(e),this.handle.onDelLayer(e,r,i,n)}onCanvas(e,r,i,n){this.handle.onCanvas(e,r,i,n)}onDocDetail(e,r,i,n){this.docDetail=i,this.handle.onDocDetail(e,r,i,n)}onStringNum(e,r){this.handle.onStringNum(e,r)}onAttrNum(e,r){this.handle.onAttrNum(e,r)}onComponentNum(e,r){this.handle.onComponentNum(e,r)}onDimensionNum(e,r){this.handle.onDimensionNum(e,r)}onBossNum(e,r){this.handle.onBossNum(e,r)}onShellEntityNum(e,r){this.handle.onShellEntityNum(e,r)}onShellCutNum(e,r){this.handle.onShellCutNum(e,r)}onCreaseNum(e,r){this.handle.onCreaseNum(e,r)}onShellNum(e,r){this.handle.onShellNum(e,r)}onFpcFillNum(e,r){this.handle.onFpcFillNum(e,r)}onTeardropNum(e,r){this.handle.onTeardropNum(e,r)}onImageNum(e,r){this.handle.onImageNum(e,r)}onPouredNum(e,r){this.handle.onPouredNum(e,r)}onPourNum(e,r){this.handle.onPourNum(e,r)}onRegionNum(e,r){this.handle.onRegionNum(e,r)}onFillNum(e,r){this.handle.onFillNum(e,r)}onPolyNum(e,r){this.handle.onPolyNum(e,r)}onObjNum(e,r){this.handle.onObjNum(e,r)}onArcNum(e,r){this.handle.onArcNum(e,r)}onLineNum(e,r){this.handle.onLineNum(e,r)}onPadNum(e,r){this.handle.onPadNum(e,r)}onViaNum(e,r){this.handle.onViaNum(e,r)}onPartitionNum(e,r){this.handle.onPartitionNum(e,r)}uploadRuleSelector(e){return e.ruleSelect.length==0?{success:!1,message:"rule selector data error."}:super.uploadRuleSelector(e)}};var HC=class extends J4e{constructor(e,r,i,n=R.getInstance().currOpenProjectId===r){super(e,r,n,i,void 0);this.mgr=new AN}onXSignalsGroup(e,r,i,n,s){throw new Error("Method not implemented.")}onDelXSignalsGroup(e,r,i,n){throw new Error("Method not implemented.")}onXSignals(e,r,i,n,s){throw new Error("Method not implemented.")}onDelXSignals(e,r,i,n){throw new Error("Method not implemented.")}getDocDetail(){return this.docDetail}canvasSelected(){var e;return(e=this.selectHandle)==null?void 0:e.getSelect()}onSelectChange(e,r,i){var n;(n=this.selectHandle)==null||n.onSelected(e,r,i)}onSelectQuit(e,r){var i;(i=this.selectHandle)==null||i.onDestroy(e,r)}getHandle(){return this.handle}setHandle(e){this.handle!=null&&this.handle.destory(),this.handle=e,this.handle.setClient(this.consistencyManager.getClient())}destroy(){return this.handle=null,super.destroy()}setTicket(){this.handle.setTicket(this.consistencyManager.getMaxTicket()+1)}onLayerFill(e,r,i,n,s){this.handle.onLayerFill(e,r,i,n,s)}onDelLayerFill(e,r,i,n){this.handle.onDelLayerFill(e,r,i,n)}onBlob(e,r,i,n,s){this.handle.onBlob(e,r,i,n,s)}onDelBlob(e,r,i,n){this.handle.onDelBlob(e,r,i,n)}onFont(e,r,i,n){this.handle.onFont(e,r,i,n)}onDelFont(e,r,i,n){this.handle.onDelFont(e,r,i,n)}onGroup(e,r,i,n,s){this.handle.onGroup(e,r,i,n,s)}onDelGroup(e,r,i,n){this.handle.onDelGroup(e,r,i,n)}onString(e,r,i,n,s,a){this.handle.onString(e,r,i,n,s,a)}onDelString(e,r,i,n){this.handle.onDelString(e,r,i,n)}onAttr(e,r,i,n,s,a){this.handle.onAttr(e,r,i,n,s,a)}onDelAttr(e,r,i,n){this.handle.onDelAttr(e,r,i,n)}onPanelize(e,r,i,n){this.handle.onPanelize(e,r,i,n)}onDelPanelize(e,r,i){this.handle.onDelPanelize(e,r,i)}onRuleSelector(e,r,i,n){this.handle.onRuleSelector(e,r,i,n)}onDelRuleSelector(e,r,i,n){this.handle.onDelRuleSelector(e,r,i,n)}onRule(e,r,i,n){this.handle.onRule(e,r,i,n)}onDelRule(e,r,i,n,s){this.handle.onDelRule(e,r,i,n,s)}onRuleTemplate(e,r,i,n){this.handle.onRuleTemplate(e,r,i,n)}onDimension(e,r,i,n,s,a){this.handle.onDimension(e,r,i,n,s,a)}onDelDimension(e,r,i,n){this.handle.onDelDimension(e,r,i,n)}onBoss(e,r,i,n,s,a){this.handle.onBoss(e,r,i,n,s,a)}onDelBoss(e,r,i,n){this.handle.onDelBoss(e,r,i,n)}onShellEntity(e,r,i,n,s,a){this.handle.onShellEntity(e,r,i,n,s,a)}onDelShellEntity(e,r,i,n){this.handle.onDelShellEntity(e,r,i,n)}onShellCut(e,r,i,n,s,a){this.handle.onShellCut(e,r,i,n,s,a)}onDelShellCut(e,r,i,n){this.handle.onDelShellCut(e,r,i,n)}onCrease(e,r,i,n,s,a){this.handle.onCrease(e,r,i,n,s,a)}onDelCrease(e,r,i,n){this.handle.onDelCrease(e,r,i,n)}onShell(e,r,i,n,s,a){this.handle.onShell(e,r,i,n,s,a)}onDelShell(e,r,i,n){this.handle.onDelShell(e,r,i,n)}onFpcFill(e,r,i,n,s,a){this.handle.onFpcFill(e,r,i,n,s,a)}onDelFpcFill(e,r,i,n){this.handle.onDelFpcFill(e,r,i,n)}onTeardrop(e,r,i,n,s,a){let l={...s,width:.2,fillStyle:ob.SOLID,path:[s.path],locked:!1,zIndex:0};this.handle.onFill(e,r,i,n,l,a)}onDelTeardrop(e,r,i,n){this.handle.onDelTeardrop(e,r,i,n)}onImage(e,r,i,n,s,a){this.handle.onImage(e,r,i,n,s,a)}onDelImage(e,r,i,n){this.handle.onDelImage(e,r,i,n)}onPoured(e,r,i,n,s,a){this.handle.onPoured(e,r,i,n,s,a)}onDelPoured(e,r,i,n){this.handle.onDelPoured(e,r,i,n)}onPour(e,r,i,n,s,a){this.handle.onPour(e,r,i,n,s,a)}onDelPour(e,r,i,n){this.handle.onDelPour(e,r,i,n)}onRegion(e,r,i,n,s,a){this.handle.onRegion(e,r,i,n,s,a)}onDelRegion(e,r,i,n){this.handle.onDelRegion(e,r,i,n)}onFill(e,r,i,n,s,a){this.handle.onFill(e,r,i,n,s,a)}onDelFill(e,r,i,n){this.handle.onDelFill(e,r,i,n)}onPoly(e,r,i,n,s,a){this.handle.onPoly(e,r,i,n,s,a)}onDelPoly(e,r,i,n){this.handle.onDelPoly(e,r,i,n)}onEQLenGrp(e,r,i,n,s){this.handle.onEQLenGrp(e,r,i,n,s)}onDelEQLenGrp(e,r,i,n){this.handle.onDelEQLenGrp(e,r,i,n)}onObj(e,r,i,n,s,a){this.handle.onObj(e,r,i,n,s,a)}onDelObj(e,r,i,n){this.handle.onDelObj(e,r,i,n)}onArc(e,r,i,n,s,a){this.handle.onArc(e,r,i,n,s,a)}onDelArc(e,r,i,n){this.handle.onDelArc(e,r,i,n)}onLine(e,r,i,n,s,a){this.handle.onLine(e,r,i,n,s,a)}onDelLine(e,r,i,n){this.handle.onDelLine(e,r,i,n)}onPad(e,r,i,n,s,a){this.handle.onPad(e,r,i,n,s,a)}onDelPad(e,r,i,n){this.handle.onDelPad(e,r,i,n)}onVia(e,r,i,n,s,a){this.handle.onVia(e,r,i,n,s,a)}onDelVia(e,r,i,n){this.handle.onDelVia(e,r,i,n)}onPreference(e,r,i,n){this.handle.onPreference(e,r,i,n)}onSilkOpts(e,r,i,n,s){this.handle.onSilkOpts(e,r,i,n,s)}onDelSilkOpts(e,r,i,n){this.handle.onDelSilkOpts(e,r,i,n)}onPrimitive(e,r,i,n,s){this.handle.onPrimitive(e,r,i,n,s)}onDelPrimitive(e,r,i,n){this.handle.onDelPrimitive(e,r,i,n)}onNet(e,r,i,n,s){this.handle.onNet(e,r,i,n,s)}onDelNet(e,r,i,n){this.handle.onDelNet(e,r,i,n)}onPartition(e,r,i,n,s,a){this.handle.onPartition(e,r,i,n,s,a)}onDelPartition(e,r,i,n){this.handle.onDelPartition(e,r,i,n)}onActiveLayer(e,r,i,n){this.handle.onActiveLayer(e,r,i,n)}onLayerPhys(e,r,i,n,s){this.handle.onLayerPhys(e,r,i,n,s)}onDelLayerPhys(e,r,i,n){this.mgr.layerPhyFix.deleteLayerPhyId(e),this.handle.onDelLayerPhys(e,r,i,n)}onLayer(e,r,i,n,s){this.mgr.layerPhyFix.deleteLayerId(e),this.handle.onLayer(e,r,i,n,s)}onDelLayer(e,r,i,n){this.handle.onDelLayer(e,r,i,n)}onCanvas(e,r,i,n){this.handle.onCanvas(e,r,i,n)}onDocDetail(e,r,i,n){this.docDetail=i,this.handle.onDocDetail(e,r,i,n)}onBoard(e,r,i,n){this.handle.onBoard(e,r,i,n)}onDelBoard(e,r,i){this.handle.onDelBoard(e,r,i)}onStringNum(e,r){this.handle.onStringNum(e,r)}onAttrNum(e,r){this.handle.onAttrNum(e,r)}onDimensionNum(e,r){this.handle.onDimensionNum(e,r)}onBossNum(e,r){this.handle.onBossNum(e,r)}onShellEntityNum(e,r){this.handle.onShellEntityNum(e,r)}onShellCutNum(e,r){this.handle.onShellCutNum(e,r)}onCreaseNum(e,r){this.handle.onCreaseNum(e,r)}onShellNum(e,r){this.handle.onShellNum(e,r)}onFpcFillNum(e,r){this.handle.onFpcFillNum(e,r)}onTeardropNum(e,r){this.handle.onTeardropNum(e,r)}onImageNum(e,r){this.handle.onImageNum(e,r)}onPouredNum(e,r){this.handle.onPouredNum(e,r)}onPourNum(e,r){this.handle.onPourNum(e,r)}onRegionNum(e,r){this.handle.onRegionNum(e,r)}onFillNum(e,r){this.handle.onFillNum(e,r)}onPolyNum(e,r){this.handle.onPolyNum(e,r)}onObjNum(e,r){this.handle.onObjNum(e,r)}onArcNum(e,r){this.handle.onArcNum(e,r)}onLineNum(e,r){this.handle.onLineNum(e,r)}onPadNum(e,r){this.handle.onPadNum(e,r)}onViaNum(e,r){this.handle.onViaNum(e,r)}onPartitionNum(e,r){this.handle.onPartitionNum(e,r)}uploadRuleSelector(e){return e.ruleSelect.length==0?{success:!1,message:"rule selector data error."}:super.uploadRuleSelector(e)}};var kr=Math.PI*2,zh=Math.PI,Go=Math.PI/2,dl=Math.sin(Math.PI/180);var vc=.003937,Tr="e",gO=5e4,yO=5e4;var PW=class PW{constructor(){this.param=null;this._visible=Ug.SHOW;this._flip=!1;this._currentCoord=!0;this._gridColor=ee.WHITE;this._transparency=.3;this._multiGridColor=ee.WHITE;this._multiTransparency=.55;this._coordinateAxisColor=ee.WHITE;this._coordinateAxisTransparency=1;this._stepX=.5;this._stepY=.5;this._snapX=.5;this._snapY=.5;this._pattern=!0;this._multiRatio=5;this._multiStyle=NC.None;this._angleDelta=Math.PI/4;this._startAngle=0;this._endAngle=kr;this._step=39.37;this._minRadius=3.937;this._maxRadius=393.7;this._renderGrid=!0}static getInstance(){return this.ins==null&&(this.ins=new PW),this.ins}modify(t,e,r,i,n){this._stepX=t,this._stepY=e,this._snapX=r,this._snapY=i,this._pattern=n,this.param!=null&&this.param.modify(t,e,r,i,n)}attach(t){this.param=t,this.param!=null&&(this.param.visible=this._visible,this.param.flip=this._flip,this.param.currentCoord=this._currentCoord,this.param.gridColor=this._gridColor,this.param.transparency=this._transparency,this.param.multiGridColor=this._multiGridColor,this.param.multiTransparency=this._multiTransparency,this.param.coordinateAxisColor=this._coordinateAxisColor,this.param.coordinateAxisTransparency=this._coordinateAxisTransparency,this.param.modify(this._stepX,this._stepY,this._snapX,this._snapY,this._pattern),this.param.setMultiRatio(this._multiRatio),this.param.setMultiStyle(this._multiStyle),this.param.angleDelta=this._angleDelta,this.param.startAngle=this._startAngle,this.param.endAngle=this._endAngle,this.param.radius=this._step,this.param.minRadius=this._minRadius,this.param.maxRadius=this._maxRadius)}set visible(t){this._visible=t,this.param!=null&&(this.param.visible=t)}get visible(){var t;return((t=this.param)==null?void 0:t.visible)||this._visible}set renderGrid(t){this._renderGrid=t,this.param!=null&&(this.param.renderGrid=t)}get renderGrid(){var t;return((t=this.param)==null?void 0:t.renderGrid)||this._renderGrid}get flip(){var t;return((t=this.param)==null?void 0:t.flip)||this._flip}set flip(t){this._flip=t,this.param!=null&&(this.param.flip=t)}get gridColor(){var t;return((t=this.param)==null?void 0:t.gridColor)||this._gridColor}set gridColor(t){this._gridColor=t,this.param!=null&&(this.param.gridColor=t)}get currentCoord(){var t;return((t=this.param)==null?void 0:t.currentCoord)||this._currentCoord}set currentCoord(t){this._currentCoord=t,this.param!=null&&(this.param.currentCoord=t)}get minRadius(){var t;return((t=this.param)==null?void 0:t.minRadius)||this._minRadius}set minRadius(t){this._minRadius=t,this.param!=null&&(this.param.minRadius=t)}get maxRadius(){var t;return((t=this.param)==null?void 0:t.maxRadius)||this._maxRadius}set maxRadius(t){this._maxRadius=t,this.param!=null&&(this.param.maxRadius=t)}get angleDelta(){var t;return((t=this.param)==null?void 0:t.angleDelta)||this._angleDelta}set angleDelta(t){this._angleDelta=t,this.param!=null&&(this.param.angleDelta=t)}get radius(){var t;return((t=this.param)==null?void 0:t.radius)||this._step}set radius(t){this._step=t,this.param!=null&&(this.param.radius=t)}get startAngle(){var t;return((t=this.param)==null?void 0:t.startAngle)||this._startAngle}set startAngle(t){t%=kr,t<0&&(t+=kr),this._startAngle=t,this.param!=null&&(this.param.startAngle=t)}get endAngle(){var t;return((t=this.param)==null?void 0:t.endAngle)||this._endAngle}set endAngle(t){this._endAngle=t,this.param!=null&&(this.param.endAngle=t)}get sweepAngle(){var e;let t=(e=this.param)==null?void 0:e.sweepAngle;return t==null?this.endAngle>this.startAngle?this.endAngle-this.startAngle:this.endAngle-this.startAngle+kr:t}updateGridParam(t,e,r,i){let n=t?Ug.SHOW:Ug.ONLYAXIS;this._stepX=e,this._stepY=r,t!==void 0&&(this.visible=n),i!==void 0&&(this._pattern=i),this.param!=null&&this.param.updateGridParam(t,e,r,i)}setGridX(t){t>0&&(this._stepX=t),this.param!=null&&this.param.setGridX(t)}getGridX(){var t;return((t=this.param)==null?void 0:t.getGridX())||this._stepX}setGridY(t){t>0&&(this._stepY=t),this.param!=null&&this.param.setGridY(t)}getGridY(){var t;return((t=this.param)==null?void 0:t.getGridY())||this._stepY}getMultiRatio(){var t;return((t=this.param)==null?void 0:t.getMultiRatio())||this._multiRatio}setMultiRatio(t){t>=1&&(this._multiRatio=t),this.param!=null&&this.param.setMultiRatio(t)}getMultiStyle(){var t;return((t=this.param)==null?void 0:t.getMultiStyle())||this._multiStyle}setMultiStyle(t){this._multiStyle=t,this.param!=null&&this.param.setMultiStyle(t)}setSnapX(t){t>0&&(this._snapX=t),this.param!=null&&this.param.setSnapX(t)}getSnapX(){var t;return((t=this.param)==null?void 0:t.getSnapX())||this._snapX}setSnapY(t){t>0&&(this._snapY=t),this.param!=null&&this.param.setSnapY(t)}getSnapY(){var t;return((t=this.param)==null?void 0:t.getSnapY())||this._snapY}get pattern(){var t;return((t=this.param)==null?void 0:t.pattern)||this._pattern}set pattern(t){this._pattern=t,this.param!=null&&(this.param.pattern=t)}get transparency(){var t;return((t=this.param)==null?void 0:t.transparency)||this._transparency}set transparency(t){this._transparency=t,this.param!=null&&(this.param.transparency=t)}get multiGridColor(){var t;return((t=this.param)==null?void 0:t.multiGridColor)||this._multiGridColor}set multiGridColor(t){this._multiGridColor=t,this.param!=null&&(this.param.multiGridColor=t)}get multiTransparency(){var t;return((t=this.param)==null?void 0:t.multiTransparency)||this._multiTransparency}set multiTransparency(t){this._multiTransparency=t,this.param!=null&&(this.param.multiTransparency=t)}get coordinateAxisColor(){var t;return((t=this.param)==null?void 0:t.coordinateAxisColor)||this._coordinateAxisColor}set coordinateAxisColor(t){this._coordinateAxisColor=t,this.param!=null&&(this.param.coordinateAxisColor=t)}get coordinateAxisTransparency(){var t;return((t=this.param)==null?void 0:t.coordinateAxisTransparency)||this._coordinateAxisTransparency}set coordinateAxisTransparency(t){this._coordinateAxisTransparency=t,this.param!=null&&(this.param.coordinateAxisTransparency=t)}};PW.scenes=[],PW.ins=null;var It=PW;var jT=class jT{constructor(){this._isConcurrentStrictMode=!1;this._isReadOnlyMode=!1;this._origin=S.ORIGIN;this._doctype=0;this._id="";this._tabId="";this._isactive=!1;this._owner=null;this._customerCode=void 0;this._clientOnlineService=void 0;this._unit="mil";this.scenes=new Array(0);this._footprintIsConnectDevice=!1;this._editorVersion="";this._projectTitle="";this._importFlag=0;this._source="";this._envFlag=null;this.partitionId="";this.name="";this.currOpenProjectId=void 0;this.currVersionUUid=void 0;this._compiler=null;this._altGridSize={GridX:{number:5,unit:this.unit},GridY:{number:5,unit:this.unit}};this._gridType="grid";this._multiType="none";this._multiRatio=5;this._forceDeactive=!1;this._forceValue=.5;this.highLightModeIsDark=!0;this._forceVisibleHighLightPt=!1;this._forceVisibleRange=!1;this._backgroundColor=ee.build(0,0,0,1);this._openRuler=!1;this._rulerBackgroundColor=null;this._rulerStringColor=null;this.antialias=!1;this._needRenderPanelize=!1;this._renderMode=g2e.USE_COLOR;this.time=new Date().getTime();this.num=Math.floor(Math.random()*100);this._panelizeParam={success:!1,on:!1,row:1,column:1,offset:new S(0,0),onlyOutline:!0};this._coreRenderingEngine="auto";this._isPreview=!1;this.compilerChannel=new Sbe;this._isHistoryMode=!1;this.workerName="";this.needNum=!0}static getInstance(){return jT.env==null&&(jT.env=new jT),jT.env}get isPreview(){return this._isPreview}set isPreview(t){this._isPreview=t,t&&(this.openRuler=!1)}get isHistoryMode(){return this._isHistoryMode}set isHistoryMode(t){this._isHistoryMode=t}get compiler(){return this._compiler==null&&(this._doctype==4?this._compiler=new HC(this._id,this.projectId,this.compilerChannel,void 0):this._doctype==3?(this._compiler=new gp(this._id,this.projectId,this.compilerChannel,void 0),this._compiler.consistencyManager.setIsLocalChange(!1),this._compiler.consistencyManager.setIsPendChange(!1)):(this._compiler=new gp(this._id,this.projectId,this.compilerChannel,void 0),this._compiler.consistencyManager.setIsLocalChange(!1),this._compiler.consistencyManager.setIsPendChange(!1))),this._compiler}get channel(){return(this.time+this.num).toString()}async resetCompiler(){this._compiler&&(await this._compiler.destroy(),this._compiler=null)}modify(t,e,r,i,n,s,a,l){this.doctype=t,this.id=e,this.tabId=r,this.isactive=i,this.owner=n,this.customerCode=s,this.name=a,this.origin=l}get gridType(){return this._gridType}set gridType(t){if(t!=null&&this._gridType!=t&&It.getInstance().visible!=Ug.NOTSHOW)switch(this._gridType=t,t){case"grid":It.getInstance().pattern=!0,It.getInstance().visible=Ug.SHOW;break;case"outlets":It.getInstance().pattern=!1,It.getInstance().visible=Ug.SHOW;break;case"none":It.getInstance().visible=Ug.ONLYAXIS;break}}get altGridSize(){return this._altGridSize}set altGridSize(t){this._altGridSize=t}getAltGridSize(){let t=this._altGridSize.GridX,e=this._altGridSize.GridY,r=t.number/10,i=e.number/10,n=new dt;return jT.getInstance().unit=="mil"?t.unit!=jT.getInstance().unit&&(r=n.conversion(t.unit,jT.getInstance().unit,r),i=n.conversion(e.unit,jT.getInstance().unit,i)):t.unit==jT.getInstance().unit&&(r=n.conversion(t.unit,"mil",r),i=n.conversion(e.unit,"mil",i)),{snapX:r,snapY:i}}set forceValue(t){this._forceDeactive&&this._forceValue!=t&&this.updateForceDeactivateRatio(t,this._forceDeactive),this._forceValue=t}get forceValue(){return this._forceValue}set forceDeactive(t){this._forceDeactive=t,this.updateForceDeactivateRatio(this._forceValue,t)}updateForceDeactivateRatio(t,e){t=t>.99?.99:t;for(let r of this.scenes)r.setForceDeactivateRatio(e?t:1)}set forceVisibleHighLightPt(t){this._forceVisibleHighLightPt=t,this.forceVisible()}set forceVisibleHighRange(t){this._forceVisibleRange!=t&&(this._forceVisibleRange=t,this.forceVisible())}get forceVisibleHighRange(){return this._forceVisibleRange}forceVisible(){let t=this._forceVisibleRange&&this._forceVisibleHighLightPt;for(let e of this.scenes)e.setForceVisibleHighLightPt(t)}setHighLightMode(t){if(this.highLightModeIsDark!=t){for(let e of this.scenes)e.setGlobalHighLightType(t?yP.PT:yP.MASK);this.highLightModeIsDark=t}}get forceVisibleHighLightPt(){return this._forceVisibleHighLightPt}get forceDeactive(){return this._forceDeactive}get projectTitle(){return this._projectTitle}set projectTitle(t){this._projectTitle=t||""}get editorVersion(){return this._editorVersion}set editorVersion(t){this._editorVersion=t||""}get isReadOnlyMode(){return this._isReadOnlyMode}set isReadOnlyMode(t){this._isReadOnlyMode=t}get isConcurrentStrictMode(){return this._isConcurrentStrictMode}set isConcurrentStrictMode(t){this._isConcurrentStrictMode=t}get importFlag(){return this._importFlag}set importFlag(t){this._importFlag=t||0}get source(){return this._source}set source(t){this._source=t||""}get envFlag(){return this._envFlag}set envFlag(t){this._envFlag=t}get multiType(){return this._multiType}set multiType(t){let e=It.getInstance();if(this._multiType!=t&&e.visible!=Ug.NOTSHOW)switch(this._multiType=t,t){case"grid":e.setMultiStyle(NC.Line);break;case"outlets":e.setMultiStyle(NC.Point);break;case"none":e.setMultiStyle(NC.None);break}}get multiRatio(){return this._multiRatio}set multiRatio(t){let e=It.getInstance();this._multiRatio!=t&&(this._multiRatio=t,e.setMultiRatio(t))}get unit(){return this._unit}set unit(t){this._unit=t;for(let e of this.scenes)e.modifyUnit(t)}get projectId(){let t=this._tabId.split("@");return t.length>=2?t[1]:""}getRatio(){for(let t of this.scenes)return(t==null?void 0:t.getPixelRatio())||1;return 1}attachScene(t){return!this.scenes.includes(t)&&t!=null&&(this.scenes.push(t),t.modifyUnit(this._unit),t.modifyBgColor(this._backgroundColor),t.resize(),t.setAntialias(this.antialias),t.openRuler=this._openRuler,this._rulerBackgroundColor&&t.setRulerBackgroundColor(this._rulerBackgroundColor),this._rulerStringColor&&t.setRulerStringColor(this._rulerStringColor),t.needRenderPanelize=this._needRenderPanelize,t.setRenderMode(this._renderMode),t.group.setRenderMode(this._renderMode),this._panelizeParam.success&&!this._panelizeParam.onlyOutline?t.setPanelizeInfo(this._panelizeParam.offset,this._panelizeParam.row,this._panelizeParam.column):t.setPanelizeInfo(),t.setForceVisibleHighLightPt(this._forceVisibleRange&&this._forceVisibleHighLightPt),t.setGlobalHighLightType(this.highLightModeIsDark?yP.PT:yP.MASK)),!0}getBgColor(){return this._backgroundColor}get backgroundColor(){return this._backgroundColor}set backgroundColor(t){this._backgroundColor=t;for(let e of this.scenes)e.modifyBgColor(t)}get rulerBackgroundColor(){return this._rulerBackgroundColor}set rulerBackgroundColor(t){if(this._rulerBackgroundColor=t,t!=null)for(let e of this.scenes)e.setRulerBackgroundColor(t)}get rulerStringColor(){return this._rulerStringColor}set rulerStringColor(t){if(this._rulerStringColor=t,t!=null)for(let e of this.scenes)e.setRulerStringColor(t)}resize(t,e){for(let r of this.scenes)r.resize()}get openRuler(){return this._openRuler}set openRuler(t){this._openRuler=t;for(let e of this.scenes)e.openRuler=t}get needRenderPanelize(){return this._needRenderPanelize}set needRenderPanelize(t){this._needRenderPanelize=t;for(let e of this.scenes)e.needRenderPanelize=t}get renderMode(){return this._renderMode}set renderMode(t){this._renderMode=t;for(let e of this.scenes)e.setRenderMode(t),e.group.setRenderMode(t)}getAntialias(){return this.antialias}setAntialias(t){this.antialias=t;for(let e of this.scenes)e.setAntialias(t)}get origin(){return this._origin}set origin(t){this._origin=t,this.scenes.forEach(e=>{e.setOrigin(this._origin)})}get customerCode(){return this._customerCode}set customerCode(t){this._customerCode=t}get owner(){return this._owner}set owner(t){this._owner=t}get clientOnlineService(){return this._clientOnlineService}set clientOnlineService(t){this._clientOnlineService=t}get doctype(){return this._isPreview&&(this._doctype==4||this._doctype==3)?23:this._doctype}set doctype(t){this._doctype=t}get id(){return this._id}set id(t){this._id=t}get tabId(){return this._tabId}set tabId(t){this._tabId=t}get isactive(){return this._isactive}set isactive(t){this._isactive=t}get footprintIsConnectDevice(){return this._footprintIsConnectDevice}set footprintIsConnectDevice(t){this._footprintIsConnectDevice=t}get panelizeParam(){return this._panelizeParam}set panelizeParam(t){this._panelizeParam=t,this.scenes.forEach(e=>{this._panelizeParam.success&&!this._panelizeParam.onlyOutline?e.setPanelizeInfo(this._panelizeParam.offset,this._panelizeParam.row,this._panelizeParam.column):e.setPanelizeInfo()})}get coreRenderingEngine(){return this._coreRenderingEngine}set coreRenderingEngine(t){typeof t<"u"&&this._coreRenderingEngine!=t&&(this._coreRenderingEngine=t)}getSceneBbox(){let t=new mm;return this.scenes.forEach(e=>{t.ext4(e.getBBox3())}),t.build()}};jT.env=null;var R=jT;var Zw=null,Ebe=12e3;function Ai(){return Zw||(Zw=new B_(null,1920,1080),Zw.setCameraDirect(!0),Zw.setCameraType(!0),Zw.setRotatable(!1),Zw.setObject(Dt.ORIGIN,Ebe)),Zw}function XT(o,t,e){!o||!t||(o.adapt1(t,e),ift(o))}function ift(o){if(!o)return;let t=o.getScale(),e=o.getMinScale();t<e&&o.setMinScale(t)}var va={useWebgl:!1,multiThreadingOnOpen:!1,rebuildingRatlineInWorker:!1,needFlushService:!1,modelIsBuilt:!1,controllerIsBuilt:!1,engineHighlightReady:!0};var nft=Object.create,LPe=Object.defineProperty,oft=Object.getOwnPropertyDescriptor,sft=Object.getOwnPropertyNames,aft=Object.getPrototypeOf,lft=Object.prototype.hasOwnProperty,_N=(o=>typeof od<"u"?od:typeof Proxy<"u"?new Proxy(o,{get:(t,e)=>(typeof od<"u"?od:t)[e]}):o)(function(o){if(typeof od<"u")return od.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')}),cft=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),hft=(o,t)=>{for(var e in t)LPe(o,e,{get:t[e],enumerable:!0})},uft=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of sft(t))!lft.call(o,i)&&i!==e&&LPe(o,i,{get:()=>t[i],enumerable:!(r=oft(t,i))||r.enumerable});return o},$W=(o,t,e)=>(e=o!=null?nft(aft(o)):{},uft(t||!o||!o.__esModule?LPe(e,"default",{value:o,enumerable:!0}):e,o)),KW=cft((o,t)=>{"use strict";var e=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,s=(j,Z)=>{for(var ie in Z)e(j,ie,{get:Z[ie],enumerable:!0})},a=(j,Z,ie,de)=>{if(Z&&typeof Z=="object"||typeof Z=="function")for(let me of i(Z))!n.call(j,me)&&me!==ie&&e(j,me,{get:()=>Z[me],enumerable:!(de=r(Z,me))||de.enumerable});return j},l=j=>a(e({},"__esModule",{value:!0}),j),c={};s(c,{BroadcastChannelMessageBus:()=>J,MessageBus:()=>L,MessageBus2:()=>X,MessageBusTask:()=>W,MessageBusTask2:()=>G,WindowMessageBridge:()=>V,WorkerMessageBridge:()=>z,createBroadcastP2PStream:()=>fe,createBufferedByteBufferStream:()=>$,createBufferedStream:()=>te,createBufferedStringStream:()=>oe,dropP2PStream:()=>Oe,flowRead:()=>be,flowWrite:()=>ue}),t.exports=l(c);var h=class{constructor(j=1.5){this.growthFactor=j,this.capacity=10,this.buffer=new Array(this.capacity),this.head=0,this.tail=0,this.count=0}enqueue(j){if(this.count===this.capacity){let Z=Math.floor(this.capacity*this.growthFactor);console.log("grow",this.capacity,Z);let ie=new Array(Z);for(let de=0;de<this.count;de++)ie[de]=this.buffer[(this.head+de)%this.capacity];this.buffer=ie,this.head=0,this.tail=this.count,this.capacity=Z}this.buffer[this.tail]=j,this.tail=(this.tail+1)%this.capacity,this.count++}dequeue(){if(this.isEmpty())return;let j=this.buffer[this.head];return this.head=(this.head+1)%this.capacity,this.count--,j}peek(){return this.buffer[this.head]}isEmpty(){return this.count===0}clear(){this.buffer.length=0,this.head=0,this.tail=0,this.count=0}},u=new ArrayBuffer(8),d=new Float64Array(u),p=new Uint32Array(u),m=new Uint16Array(u),g=ArrayBuffer;try{g=self.HTMLImageElement||g}catch{}var y=typeof SharedArrayBuffer<"u";function b(j){if(typeof j!="object"||j===null||j instanceof Date||j instanceof ArrayBuffer||y&&j instanceof SharedArrayBuffer||j instanceof Blob||j instanceof FormData||j instanceof Function||j instanceof Uint8ClampedArray||j instanceof g)return j;if(Array.isArray(j))return j.map(b);{let Z={};for(let ie in j)Object.hasOwnProperty.call(j,ie)&&(Z[ie]=b(j[ie]));return Z}}function P(j,Z){return T(j,Z,()=>[])}function T(j,Z,ie){let de=j[Z];return de!==void 0||(de=ie(Z),j[Z]=de),de}var I=class{constructor(j){this.maxResources=j,this.idle=new h,this.isClosed=!1,this.resources=j}acquire(j){this.isClosed?Promise.resolve(!1).then(j):this.resources>0?(this.resources--,Promise.resolve(!0).then(j)):this.idle.enqueue(j)}acquireSync(){return new Promise(j=>{this.acquire(j)})}release(){if(!this.isClosed){let j=this.idle.dequeue();j?Promise.resolve(!0).then(j):this.resources++}}close(){if(!this.isClosed)for(this.isClosed=!0;!this.idle.isEmpty();){let j=this.idle.dequeue();Promise.resolve(!1).then(j)}}};function C(){if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof globalThis<"u")return globalThis;if(typeof global<"u")return global}function E(j,Z){let ie=0,de=j.length;for(let me=0;me<de;me++)j[me]===Z&&(j.splice(me,1),me--,de--,ie++);return ie}var O=C(),_=O.WeakRef||(j=>j);function x(j){if(j!=null){if(typeof j=="object")return new _(j);console.error(j,j instanceof Object,typeof j);return}}function v(j){return j==null?void 0:j.deref()}var D="_MSG_BUS_RPC_",w=300*1e3,F=(j=>(j.PUBLISH="publish",j.SUBSCRIBE="subscribe",j.PUSH="push",j.PULL="pull",j))(F||{}),H=class{constructor(j){this.bus=j}processRemoteMessage(j,Z){let ie=x(Z),de=j.topic,me=j.type,Se=j.message;switch(me){case"pull":this.bus.pull(de,Re=>{this.push(de,Re,v(ie))});break;case"subscribe":this.bus.subscribe(de,Re=>{this.publish(de,Re,v(ie))});break;case"publish":this.bus.publish(de,Se,this,v(ie));break;case"push":this.bus.push(de,Se,this,v(ie));break;default:console.debug("unknown message type "+me)}}rpcCall(j,Z,ie,de=w){let me=x(ie),Se=new Promise(Re=>{let Je=this.bus.uniqueRpcTopic(j);this.publish(j,{message:Z,reply:Je},v(me)),this.bus.pull(Je,(Ke,Gt,Nr)=>{Re({message:Ke,bridge:Gt,source:x(Nr)})})});return de>0?Promise.race([Se,new Promise((Re,Je)=>{setTimeout(Je,de)})]):Se}},z=class extends H{constructor(j,Z){super(j),this.worker=Z,Z.onmessage=ie=>{this.processRemoteMessage(ie.data,void 0)}}publish(j,Z){this.postMessage(j,"publish",Z)}subscribe(j){this.postMessage(j,"subscribe",null)}push(j,Z){this.postMessage(j,"push",Z)}pull(j){this.postMessage(j,"pull",null)}rpcCall(j,Z,ie=w){return super.rpcCall(j,Z,void 0,ie)}postMessage(j,Z,ie){let de={topic:j,type:Z,message:ie};this.worker.postMessage(de)}discard(){this.worker.terminate()}},V=class extends H{constructor(j){super(j),window.addEventListener("message",Z=>{this.processRemoteMessage(Z.data,Z.source)},!1)}publish(j,Z,ie){this.postMessage(j,"publish",Z,ie)}subscribe(j,Z){if(Z===window)throw new Error("regist remote subscribe from current window is not permitted");this.postMessage(j,"subscribe",null,Z)}push(j,Z,ie){this.postMessage(j,"push",Z,ie)}pull(j,Z){if(Z===window)throw new Error("regist remote pull from current window is not permitted");this.postMessage(j,"pull",null,Z)}postMessage(j,Z,ie,de){let me={topic:j,type:Z,message:ie};de&&de.postMessage(me,"*")}},W=class{constructor(j){this.isRunning=!0,this.callback=j}cancel(){this.callback=null,this.isRunning=!1}running(){return this.isRunning}execute(j,Z,ie,de){try{j=de?j:b(j),this.callback(j,Z,ie)}catch(me){console.error(me)}}},L=class{constructor(j=!1){this.subscribed={},this.pulled={},this.pushed={},this.uuid=crypto.randomUUID().replace(/-/g,""),this.rpcTicket=0,this.unsafe=j}uniqueRpcTopic(j){return`${D}-${j}-${this.uuid}-${this.rpcTicket++}`}publish(j,Z,ie,de){let me=this.subscribed[j];if(me){let Se;for(let Re of me)Re.running()?Re.execute(Z,ie,de,this.unsafe):(Se=Se||new Array,Se.push(Re));if(Se)for(let Re of Se)E(me,Re)}else console.debug("no sub on topic: "+j)}subscribe(j,Z){let ie=new W(Z);return P(this.subscribed,j).push(ie),ie}push(j,Z,ie,de){let me=!1,Se=this.pulled[j];if(Se){for(;Se.length>0;){let Re=Se.shift();if(Re.running()){Re.execute(Z,ie,de,this.unsafe),me=!0;break}}Se.length===0&&delete this.pulled[j]}me||P(this.pushed,j).push({message:Z,bridge:ie,source:x(de)})}pull(j,Z){let ie=new W(Z),de=this.pushed[j];if(de){let me=de.shift();ie.execute(me.message,me.bridge,v(me.source),this.unsafe),de.length===0&&delete this.pushed[j]}else P(this.pulled,j).push(ie);return ie}pullA(j){return new Promise(Z=>{this.pull(j,(ie,de,me)=>{Z({message:ie,bridge:de,source:x(me)})})})}rpcService(j,Z){this.subscribe(j,(ie,de,me)=>{let{message:Se,reply:Re}=ie;try{let Je=Z(Se);if(Je instanceof Promise){let Ke=x(me);Je.then(Gt=>{this.rpcReply(Gt,Re,de,v(Ke))},Gt=>{console.error(Gt),this.rpcReply(void 0,Re,de,v(Ke))})}else this.rpcReply(Je,Re,de,me)}catch(Je){console.error(Je),this.rpcReply(void 0,Re,de,me)}})}rpcCall(j,Z,ie=w){let de=new Promise(me=>{let Se=this.uniqueRpcTopic(j);this.publish(j,{message:Z,reply:Se}),this.pull(Se,(Re,Je,Ke)=>{me({message:Re,bridge:Je,source:x(Ke)})})});return ie>0?Promise.race([de,new Promise((me,Se)=>{setTimeout(Se,ie)})]):de}rpcReply(j,Z,ie,de){ie?ie.push(Z,j,de):this.push(Z,j)}},k="_MSG_BUS_RPC_";function N(j,Z){let ie=0,de=j.length;for(let me=0;me<de;me++)j[me]===Z&&(j.splice(me,1),me--,de--,ie++);return ie}function U(j,Z){return B(j,Z,()=>[])}function B(j,Z,ie){let de=j[Z];return de!==void 0||(de=ie(Z),j[Z]=de),de}var G=class{constructor(j,Z){this.callback=j,this.unsafe=Z,this.isRunning=!0}cancel(){this.callback=null,this.isRunning=!1}running(){return this.isRunning}async execute(j){try{j=this.unsafe?j:b(j),this.callback(j)}catch(Z){console.error(Z)}}},Y=class{constructor(j=crypto.randomUUID()){this.uuid=j,this.rpcTicket=0}subscribeOnce(j,Z){let ie=this.subscribe(j,de=>{ie.cancel(),Z(de)});return ie}pullA(j){return new Promise(Z=>{this.pull(j,Z)})}rpcService(j,Z){let ie=de=>{try{let{message:me,replyTopic:Se}=de;try{let Re=Z(me);Re instanceof Promise?Re.then(Je=>{this.publish(Se,{success:!0,result:Je})}).catch(Je=>{console.error(Je),this.publish(Se,{success:!1,err:String(Je)})}):this.publish(Se,{success:!0,result:Re})}catch(Re){this.publish(Se,{success:!1,err:String(Re)})}}finally{this.pull(j,ie)}};this.pull(j,ie)}rpcCall(j,Z,ie=0){let de=new Promise((me,Se)=>{let Re=`${k}-${j}-${this.uuid}-${this.rpcTicket++}`;this.subscribeOnce(Re,Je=>{Je.success?me(Je.result):Se(new Error(Je.err))}),this.push(j,{message:Z,replyTopic:Re})});return ie>0?Promise.race([de,new Promise((me,Se)=>{setTimeout(Se,ie)})]):de}},X=class extends Y{constructor(j=!1){super(),this.unsafe=j,this.subscribed={},this.pulled={},this.pushed={}}publish(j,Z){let ie=this.subscribed[j];if(ie){let de;for(let me of ie)me.running()?me.execute(Z):(de=de||new Array,de.push(me));if(de)for(let me of de)N(ie,me)}}subscribe(j,Z){let ie=new G(Z,this.unsafe);return U(this.subscribed,j).push(ie),ie}push(j,Z){let ie=!1,de=this.pulled[j];if(de){for(;de.length>0;){let me=de.shift();if(me&&me.running()){me.execute(Z),ie=!0;break}}de.length===0&&delete this.pulled[j]}ie||U(this.pushed,j).push(Z)}pull(j,Z){let ie=new G(Z,this.unsafe);return this.repull(j,ie),ie}repull(j,Z){let ie=this.pushed[j];if(ie){let de=ie.shift();de&&(Z.execute(de),ie.length===0&&delete this.pushed[j])}else U(this.pulled,j).push(Z)}},K=class extends Y{constructor(j=crypto.randomUUID()){super(j),this.subscribed={},this.pushed={},this.pulled={},this.pushCnt=0}publish(j,Z){console.debug("BC",this.uuid,"PUBLISH",j,Z),this.broadcastPublish(j,Z)}subscribe(j,Z){console.debug("BC",this.uuid,"SUBSCRIBE",j);let ie=new G(Z,!0);return U(this.subscribed,j).push(ie),ie}push(j,Z){let ie=this.pushCnt++;console.debug("BC",this.uuid,"PUSH",j,`(${ie})`,Z),U(this.pushed,j).push({id:ie,message:Z}),this.broadcastPushedHeadMessage(j)}pull(j,Z){console.debug("BC",this.uuid,"PULL",j);let ie=new G(Z,!0);return U(this.pulled,j).push(ie),this.broadcastWhoHas(j),ie}broadcastPushedHeadMessage(j){let Z=this.pushed[j];Z&&Z[0]&&this.broadcastIHave(j,Z[0].id)}onReceivedPublish(j,Z,ie){console.debug("BCMSG(",this.uuid,")","from",j,"PUBLISH",Z,"message",ie);let de=this.subscribed[Z];if(de){let me;for(let Se of de)Se.running()?Se.execute(ie):(me=me||new Array,me.push(Se));if(me)for(let Se of me)N(de,Se);de.length===0&&delete this.subscribed[Z]}}onReceivedWhoHas(j,Z){console.debug("BCMSG(",this.uuid,")","from",j,"WHOHAS",Z),this.broadcastPushedHeadMessage(Z)}onReceivedIHave(j,Z,ie){console.debug("BCMSG(",this.uuid,")","from",j,"IHAVE",Z,"id",ie);let de=this.pulled[Z];if(de){let me;for(let Se of de)if(Se.running()){this.broadcastINeed(Z,j,ie);break}else me=me||new Array,me.push(Se);if(me)for(let Se of me)N(de,Se);de.length===0&&delete this.pulled[Z]}}onReceivedINeed(j,Z,ie,de){if(console.debug("BCMSG(",this.uuid,")","from",j,"INEED",Z,"source",ie,"id",de),this.uuid===ie){let me=this.pushed[Z];if(me&&me[0]&&me[0].id===de){let{message:Se}=me.shift();this.broadcastIGive(Z,de,j,Se),this.broadcastPushedHeadMessage(Z),me.length===0&&delete this.pushed[Z]}}}onReceivedIGive(j,Z,ie,de,me){console.debug("BCMSG(",this.uuid,")","from",j,"IGIVE",Z,"id",ie,"target",de,"message",me);let Se=this.pulled[Z];if(Se&&this.uuid===de){let Re=!1;for(;Se.length>0;){let Je=Se.shift();if(Je.running()){Je.execute(me),Re=!0;break}}Re||this.push(Z,me),Se.length===0&&delete this.pulled[Z]}}},J=class extends K{constructor(j,Z=crypto.randomUUID()){super(Z),this.bc=new BroadcastChannel(j),this.bc.onmessage=ie=>{this.onMessage(ie.data)}}onMessage(j){let{type:Z,uuid:ie,topic:de}=j;switch(Z){case"PUBLISH":{let{message:me}=j;this.onReceivedPublish(ie,de,me);break}case"WHOHAS":{this.onReceivedWhoHas(ie,de);break}case"IHAVE":{let{id:me}=j;this.onReceivedIHave(ie,de,me);break}case"INEED":{let{source:me,id:Se}=j;this.onReceivedINeed(ie,de,me,Se);break}case"IGIVE":{let{target:me,id:Se,message:Re}=j;this.onReceivedIGive(ie,de,Se,me,Re);break}default:console.warn("unsupported",j)}}broadcastPublish(j,Z){this.post({type:"PUBLISH",uuid:this.uuid,topic:j,message:Z})}broadcastWhoHas(j){this.post({type:"WHOHAS",uuid:this.uuid,topic:j})}broadcastIHave(j,Z){this.post({type:"IHAVE",uuid:this.uuid,topic:j,id:Z})}broadcastINeed(j,Z,ie){this.post({type:"INEED",uuid:this.uuid,topic:j,source:Z,id:ie})}broadcastIGive(j,Z,ie,de){this.post({type:"IGIVE",uuid:this.uuid,topic:j,id:Z,target:ie,message:de})}post(j){this.bc.postMessage(j),Promise.resolve().then(()=>{this.onMessage(j)})}},se=Symbol("BLOCKING_QUEUE_RESET"),ce=class{constructor(j,Z=()=>1){if(this.maxSize=j,this.itemSizeOf=Z,this.queue=new h,this.waitingConsumers=new h,this.waitingProducers=new h,this.queueSize=0,this.closePromise=null,this.closeResolve=null,j<=0)throw new Error("Max size must be greater than 0")}enqueue(j){return this.closePromise?!1:this.isFull()?(async()=>{console.debug("queue is full",this.queueSize,this.maxSize);let Z=await new Promise(ie=>{this.waitingProducers.enqueue(ie)});return console.debug("queue is not full",this.size(),Z),Z?(this.innerEnqueue(j),!0):!1})():(this.innerEnqueue(j),!0)}innerEnqueue(j){if(this.waitingConsumers.isEmpty())this.queue.enqueue(j),this.queueSize+=this.itemSizeOf(j),console.debug("queue pushed",j,"size",this.queueSize);else{let Z=this.waitingConsumers.dequeue();Promise.resolve(j).then(Z),console.debug("queue direct",j,"size",this.queueSize)}}dequeue(){if(this.queue.isEmpty())if(this.closePromise){for(;!this.waitingConsumers.isEmpty();){let j=this.waitingConsumers.dequeue();Promise.resolve(se).then(j)}return setTimeout(()=>this.closeResolve(),0),se}else return new Promise(j=>{this.waitingConsumers.enqueue(j)});else{let j=this.queue.dequeue();if(this.queueSize-=this.itemSizeOf(j),!this.waitingProducers.isEmpty()){let Z=this.waitingProducers.dequeue();Promise.resolve(!0).then(Z)}return j}}size(){return this.queueSize}isEmpty(){return this.queueSize===0}isFull(){return this.queueSize>=this.maxSize}close(){return this.closePromise||(this.closePromise=new Promise(j=>{for(this.closeResolve=j;!this.waitingProducers.isEmpty();){let Z=this.waitingProducers.dequeue();Promise.resolve(!1).then(Z)}if(this.queueSize===0){for(;!this.waitingConsumers.isEmpty();){let Z=this.waitingConsumers.dequeue();Promise.resolve(se).then(Z)}j()}})),this.closePromise}};function te(j,Z,ie=Number.MAX_SAFE_INTEGER){let de=new ce(ie,Z),me=new ReadableStream({pull(Re){let Je=!0,Ke=(async()=>{let Gt=new Array;do{let Nr=de.dequeue();if(Nr instanceof Promise){Je=!1;let xr=await Nr;xr===se?Re.close():Gt.push(xr)}else{let xr=Nr;xr===se?Re.close():Gt.push(xr)}}while(de.size()>0);if(Gt.length>0){let Nr=j(Gt);Re.enqueue(Nr)}})();if(!Je)return console.debug("read stream stucked --------------------------------------"),Ke},async cancel(){console.debug("buffered readable cancel"),await de.close()}}),Se=new WritableStream({write(Re,Je){let Ke=!0,Gt=(async()=>{let Nr=de.enqueue(Re);typeof Nr=="boolean"?Nr||Je.error(new Error("Write stream closed")):(Ke=!1,await Nr||Je.error(new Error("Write stream closed")))})();if(!Ke)return console.debug("read stream stucked >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"),Gt},async close(){console.debug("buffered writable closing",de.size()),await de.close(),console.debug("buffered writable closed",de.size())},async abort(){console.debug("buffered writable aborting",de.size()),await de.close(),console.debug("buffered writable aborted",de.size())}});return{readable:me,writable:Se}}function oe(j=Number.MAX_SAFE_INTEGER){return te(Z=>Z.join(""),Z=>Z.length,j)}function $(j=Number.MAX_SAFE_INTEGER){return te(Z=>{let ie=new Uint8Array(Z.reduce((me,Se)=>me+Se.byteLength,0)),de=0;return Z.forEach(me=>{ie.set(me,de),de+=me.byteLength}),ie},Z=>Z.byteLength,j)}function fe(j){return new Promise((Z,ie)=>{let de=new BroadcastChannel(j),me=new ce(1),Se=new I(1),Re=null,Je=!1,Ke=!1,Gt=!1;de.onmessage=Nr=>{let xr=Nr.data,{type:vr}=xr;if(console.debug("p2p",j,"type",vr,"data",vr==="DATA"&&xr.data),vr==="DATA")me.enqueue(xr.data);else if(vr==="HI"){if(!Re){de.postMessage({type:"HI"});let Ft=0;Re={rs:new ReadableStream({async pull(ir){let Fe=await me.dequeue();Fe===se?(await Ne(),ir.close()):(ir.enqueue(Fe),de.postMessage({type:"ACK"}))},cancel(){return Ne()}}),ws:new WritableStream({async write(ir,Fe){await Se.acquireSync()?de.postMessage({type:"DATA",id:Ft++,data:ir}):(_r(),Fe.error(new Error("Write stream closed")))},close(){_r()},abort(){_r()}})},Z(Re)}}else vr==="REND"?Re?Se.close():Vt("REND1"):vr==="WEND"?Re?me.close():Vt("WEND1"):vr==="ACK"&&Se.release();function _r(){Je||(Je=!0,console.debug(j,"p2p write stream closed"),Se.close(),de.postMessage({type:"WEND"}),Ke&&(console.debug(j,"p2p channel closed on ws"),de.close()))}async function Ne(){Ke||(Ke=!0,console.debug(j,"p2p read stream closed"),de.postMessage({type:"REND"}),await me.close(),Je&&(console.debug(j,"p2p channel closed on rs"),de.close()))}async function Vt(Ft){Gt||(Gt=!0,console.debug(j,"p2p channel connection released on",Ft),Se.close(),me.close(),Re?(Re.rs.locked||(console.debug(j,"p2p unlocked read stream direct cancel"),Re.rs.cancel()),Re.ws.locked||(console.debug(j,"p2p unlocked write stream direct close"),Re.ws.close())):(de.postMessage({type:"HI"}),de.close()),ie(new Error("p2p channel connection released")))}},de.postMessage({type:"HI"})})}function Oe(j){return new Promise(Z=>{let ie=new BroadcastChannel(j);ie.onmessage=de=>{let me=de.data,{type:Se}=me;Se==="HI"&&(ie.postMessage({type:"REND"}),ie.close(),Z())},ie.postMessage({type:"REND"})})}async function Te(j){try{return await fe(j)}catch(Z){Z.message!=="p2p channel connection released"&&console.error(Z)}}async function ue(j,Z,ie=10*1024*1024,de=!0){let me=await Te(j);if(!me)return!1;let Se=!1;try{let Re,Je=Ke=>{if(!Re)if(!de)Re=me.ws.getWriter();else if(typeof Ke=="string"){let Gt=oe(ie);Gt.readable.pipeTo(me.ws),Re=Gt.writable.getWriter()}else{let Gt=$(ie);Gt.readable.pipeTo(me.ws),Re=Gt.writable.getWriter()}return Re.write(Ke)};if(Array.isArray(Z))for(let Ke of Z)await Je(Ke);else await Z({write:Je,get desiredSize(){return((Re==null?void 0:Re.desiredSize)||0)+10}});Re&&await Re.close(),Se=!0}catch(Re){console.error(Re)}finally{return me.rs.cancel(),Se}}async function be(j,Z){var ie,de;let me=await Te(j);if(me)try{let Se=me.rs.getReader();for((ie=Z.start)==null?void 0:ie.call(Z);;){let{value:Re,done:Je}=await Se.read();if(Re!==void 0){let Ke;if(Z.update instanceof Promise?Ke=await Z.update(Re):Ke=Z.update(Re),Ke){await Se.cancel();break}}if(Je){(de=Z.end)==null||de.call(Z);break}}}catch(Se){console.error(Se)}finally{me.ws.close()}}}),dft={UNAUTHORIZED:"Not logged in yet, please log in and try again",LOGIN_FAIL:"The login status is invalid",PERMISSION_DENIED:"No permission or project does not exist",PERMISSION_DENIED1:"No permission",PRJ_NOT_EXIST:"No permission or project does not exist",ERROR_PATH:"No permission or project does not exist",PROJECT_NOT_FOUND:"The project was not found",PERMISSION_DENIED_PARAMS:"No permission to operate {type}",DATA_NOT_FOUND:"Data not found",PARAMS_DATA_NOT_FOUND:"The {type} data was not found",REQUEST_PARAM_ILLEGAL:"Parameter error",REQUEST_PARAM_ILLEGAL1:"Parameter error",REQUEST_PARAMS_ILLEGAL2:"The {type} parameter request is incorrect",REQUEST_PARAMS_NOT_NULL:"The {type} parameter of the request cannot be empty",REQUEST_PARAMS_NOT_ALL_NULL:"The {type} parameter of the request cannot be empty simultaneously",REQUEST_PARAMS_MUST_ARRAY:"The request parameter {type} must be an array",REQUEST_PARAMS_MUST_STRING:"The request parameter {type} must be a string",REQUEST_PARAMS_MUST_NUMBER:"The request parameter {type} must be a number",REQUEST_PARAMS_MUST_NUMBER_ARRAY:"The request parameter {type} must be a numeric array",REQUEST_PARAMS_MUST_STRING_ARRAY:"The request parameter {type} must be a string array",REQUEST_PARAMS_LENGTH_ERROR:"The length of the request parameter {type} is incorrect",REQUEST_PARAMS_TYPE_ERROR:"The request parameter {type} is of incorrect type",ILLEGAL_NAME:'The name is illegal and contains illegal characters such as /:*?"<>|',ILLEGAL_NAME1:'The name is illegal and contains illegal characters such as /:*?"<>|',ILLEGAL_NAME_ZH:"The name cannot contain Chinese characters",UUID_ERROR:"uuid error",DUPLICATE_DATA:"Duplicate title",DUPLICATE_DATA1:"Library duplicate name",DUPLICATE_DATA_PARAMS:"{type} Duplicate data",UPLOAD_LIMIT:"Document {documentName} size over 15MB, it is too big to save in the server, please modify and then try again.",MORE_THAN_LIMIT:"Exceed the maximum limit",FILE_MORE_THAN_LIMIT:"Exceed the maximum upload limit of {type}",PARAMS_MORE_THAN_LIMIT:"Exceed the maximum upload limit of the parameter {type}",IMAGE_MORE_THAN_LIMIT_PARAMS:"The picture exceeds the maximum upload limit",FILE_MORE_THAN_LIMIT_PARAMS:"The file exceeds the maximum upload limit",END_MUST_AFTER_START:"The start time cannot be later than the end time",FILE_READ_ONLY:"The project file eprj or library file elib property was set as read only, please enable the read only property at File Manager and try again, and contact with support",FILE_READ_ONLY1:"The project file eprj or library file elib property was set as read only, please enable the read only property at File Manager and try again, and contact with support",DATA_NOT_EXIST:"document {documentName} not exists",REQUEST_PARAMS_TIME_ERROR:"The time request parameter is incorrect",FILES_PATH_NOT_FOUND:"The file address cannot be found",FILES_DATA_NOT_FOUND:"The file data cannot be found",FILES_TYPE_ERROR:"File type error",FILES_TYPE_MUST_BE_ONE:"The file type must be {type}",SET_WATERMARK_FAIL:"Watermark setting failed",MYSQL_CRUD_ERROR:"{type} data execution failed. Please contact technical support for resolution",PARAMS_JSON_FAILED:"{type} data parsing failed",MYSQL_ERROR:"Database operation anomaly",NOT_FOUND:"The request does not exist",PRJ_NAME_EXISTS:"The name of the project already exists",BACKUP_NAME_EXISTS:"Backup Name already exists",TITLE_ILLEGAL_LEN:"The {documentName} length must be 1~128 bytes!",LIB_NOT_EXIST:"The component library does not exist",CONFIG_API_URLS_ERROR:"Real-time prices and inventory are not enabled. Please contact the administrator",ONE_CLICK_ORDER_NOT_OPEN:"The order placement function is not enabled. Please contact the administrator",MATERIAL_NOT_OPEN:"The material warehouse is not open. Please contact the administrator",SNAPSHOT_DEPTH_LIMIT:"There is a snapshot near the latest node or the snapshot has been applied for",OCR_SYMBOL_URL_ERROR:"The OCR request address is not configured",USER_DATA_NOT_FOUND:"The user does not exist",USER_DISABLE_ERROR:"The account has been deactivated",USER_EXISTS_LOGIN_ERROR:"The user has logged in elsewhere",USER_UNAUTHORIZED_MODULES_ERROR:"This account has not authorized the module",USER_UNAUTHORIZED_ACCESS_ERROR:"Access type error",ADMIN_NOT_CHANGE_PASSWORD:"The super administrator cannot reset the password",SAME_PASSWORD_NEW_PASSWORD:"The original password is the same as the new one",USER_ONLINE_REGISTRATION_FAILED:"The registration of the user online failed",USER_PASSWORD_CAN_NOT_DEFAULT:"The default password cannot be used",USER_BEFORE_PASSWORD_ERROR:"The original password is incorrect",USER_PASSWORD_LENGTH_ERROR:"The password length is 8 to 255 characters",ORG_ROLE_NOT_CREATE:"System roles cannot be created. Please make the necessary modifications",ORG_ROLE_NAME_DUPLICATE:"The character name already exists. Please modify it",ORG_ROLE_ORIGIN_ERROR:"Unknown character source {message}",ORG_ROLE_NOT_DEFAULT:"This character is not a preset one and cannot be operated",ADMIN_ROLE_NOT_CHANGE:"Administrator privileges do not allow for modification",ADMIN_NOT_CHANGE_STATUS:"The admin account cannot change its status",PROJECT_ARCHIVED:"The project has been locked",PROJECT_UUID_NULL:"The project uuid cannot be empty",PROJECT_UUID_ERROR:"uuid error or the project uuid already exists",PROJECT_OR_TEAM_UUID_ERROR:"The project uuid is incorrect or the team uuid already exists",PROJECT_NOT_PERSON_ERROR:"Personal projects are not allowed to be created",PROJECT_DUPLICATE_NAME:"Duplicate title",ANNOTATION_HAS_BE_FOUND:"The annotation has been created",ANNOTATION_NOT_FOUND:"The annotation block does not exist",ANNOTATION_CREATE_ERROR:"The annotation block creation failed",ANNOTATION_UPDATE_ERROR:"The update of the annotation block failed",ANNOTATION_DELETE_ERROR:"The annotation failed to be deleted",PROJECT_DUPLICATE_PATH:"The same path cannot be created",TEAM_NOT_FOUND:"The team does not exist",TEAM_UUID_NULL:"The team uuid cannot be empty",TEAM_FOLDER_ERROR:"The parent folder does not exist or does not belong to the current team",TEAM_FOLDER_UUID_ERROR:"The folder uuid is incorrect or the project uuid already exists",TEAM_URL_DUPLICATE:"Team link repetition",TEAM_CAN_NOT_DELETE:"There are still projects in the team. Please transfer or delete them first",COMPONENT_UUID_NULL:"The uuid of a component cannot be empty",COMPONENT_DATA_NOT_FOUND:"The component library data does not exist",COMPONENT_NAME_DUPLICATE:"Component libraries cannot have the same name",COMPONENT_TYPE_ERROR:"Library type error",DELETE_SON_CATEGORY:"The subcategories need to be deleted first",LICENSE:"License not found",START_TIME:"The start time of the license is incorrect",END_TIME:"The end time of the license is incorrect",PROJECT_LIMIT:"Number of projects created exceeds the limit",USER_LIMIT:"The maximum number of accounts has been reached",ONLINE_NUMBER_LIMIT:"The maximum number of online users has been reached",LIMIT_PCB:"The PCB authorization quota has been reached and the addition failed",LIMIT_SCH:"The schematic authorization number is full, and the addition failed",LIMIT_PANEL:"The panel authorization number is full and the addition failed",TIME_ERROR:"If the system time is incorrect, please restart the server or fix the system time. After fixing, the private service needs to be restarted",LICENSE_ERROR:"Authorization error",LICENSE_TYPE_ERROR:"The type of authorized application is incorrect",LICENSE_ORIGIN_ERROR:"Unknown authorized application {type}",BRANCH_DATA_NOT_FOUND:"There is no engineering branch",PARENT_UUID_ERROR:"parent uuid error",BRANCH_MUST_AFTER_NODE:"The branch must be after the node",BRANCH_NAME_ERROR:"Incorrect branch name",BRANCH_NAME_DUPLICATE:"The branch name already exists",BRANCH_UUID_ERROR:"The branch uuid is incorrect",BRANCH_NODE_SET_ERROR:"Nodes cannot be set as default branches or marked as master",BRANCH_DELETE_MAIN_ERROR:"Nodes or branches on the main branch cannot be deleted",BRANCH_CHECK_OUT_ERROR:"There are documents that have been checked out",DOCUMENT_UUID_ERROR:"The document uuid is incorrect",UPDATE_FAILED:"Update failed",INNER_API_KEY_ERROR:"The ApiKey of the internal interface of the server is incorrect",BRANCH_MORE_THAN_LIMIT:"The version exceeds the maximum limit",WORKSPACE_API_ERROR:"The workspace request response is abnormal"},pft={UNAUTHORIZED:"\u5C1A\u672A\u767B\u5F55\uFF0C\u8BF7\u767B\u5F55\u540E\u518D\u8BD5",LOGIN_FAIL:"\u767B\u5F55\u72B6\u6001\u5F02\u5E38",PERMISSION_DENIED:"\u6CA1\u6709\u6743\u9650\u6216\u5DE5\u7A0B\u4E0D\u5B58\u5728",PERMISSION_DENIED1:"\u6CA1\u6709\u6743\u9650",PRJ_NOT_EXIST:"\u6CA1\u6709\u6743\u9650\u6216\u5DE5\u7A0B\u4E0D\u5B58\u5728",ERROR_PATH:"\u6CA1\u6709\u6743\u9650\u6216\u5DE5\u7A0B\u4E0D\u5B58\u5728",PROJECT_NOT_FOUND:"\u5DE5\u7A0B\u672A\u627E\u5230",PERMISSION_DENIED_PARAMS:"\u6CA1\u6709\u6743\u9650\u64CD\u4F5C{type}",DATA_NOT_FOUND:"\u6570\u636E\u672A\u627E\u5230",PARAMS_DATA_NOT_FOUND:"{type}\u6570\u636E\u672A\u627E\u5230",REQUEST_PARAM_ILLEGAL:"\u53C2\u6570\u9519\u8BEF",REQUEST_PARAM_ILLEGAL1:"\u53C2\u6570\u9519\u8BEF",REQUEST_PARAMS_ILLEGAL2:"\u8BF7\u6C42{type}\u53C2\u6570\u9519\u8BEF",REQUEST_PARAMS_NOT_NULL:"\u8BF7\u6C42{type}\u53C2\u6570\u4E0D\u80FD\u4E3A\u7A7A",REQUEST_PARAMS_NOT_ALL_NULL:"\u8BF7\u6C42{type}\u53C2\u6570\u4E0D\u80FD\u540C\u65F6\u4E3A\u7A7A",REQUEST_PARAMS_MUST_ARRAY:"\u8BF7\u6C42\u53C2\u6570{type}\u5FC5\u987B\u662F\u6570\u7EC4",REQUEST_PARAMS_MUST_STRING:"\u8BF7\u6C42\u53C2\u6570{type}\u5FC5\u987B\u662F\u5B57\u7B26\u4E32",REQUEST_PARAMS_MUST_NUMBER:"\u8BF7\u6C42\u53C2\u6570{type}\u5FC5\u987B\u662F\u6570\u5B57",REQUEST_PARAMS_MUST_NUMBER_ARRAY:"\u8BF7\u6C42\u53C2\u6570{type}\u5FC5\u987B\u662F\u6570\u5B57\u6570\u7EC4",REQUEST_PARAMS_MUST_STRING_ARRAY:"\u8BF7\u6C42\u53C2\u6570{type}\u5FC5\u987B\u662F\u5B57\u7B26\u4E32\u6570\u7EC4",REQUEST_PARAMS_LENGTH_ERROR:"\u8BF7\u6C42\u53C2\u6570{type}\u957F\u5EA6\u9519\u8BEF",REQUEST_PARAMS_TYPE_ERROR:"\u8BF7\u6C42\u53C2\u6570{type}\u7C7B\u578B\u9519\u8BEF",ILLEGAL_NAME:'\u540D\u79F0\u975E\u6CD5, \u5305\u542B /:*?"<>| \u7B49\u975E\u6CD5\u5B57\u7B26',ILLEGAL_NAME1:'\u540D\u79F0\u975E\u6CD5, \u5305\u542B /:*?"<>| \u7B49\u975E\u6CD5\u5B57\u7B26',ILLEGAL_NAME_ZH:"\u540D\u79F0\u4E0D\u80FD\u5305\u542B\u4E2D\u6587",UUID_ERROR:"uuid \u9519\u8BEF",DUPLICATE_DATA:"\u6807\u9898\u5DF2\u5B58\u5728",DUPLICATE_DATA1:"\u5E93\u91CD\u540D",DUPLICATE_DATA_PARAMS:"{type}\u91CD\u590D\u6570\u636E",UPLOAD_LIMIT:"\u6587\u6863 {documentName} \u8D85\u8FC715MB\uFF0C\u5BFC\u81F4\u65E0\u6CD5\u6B63\u5E38\u4FDD\u5B58\uFF0C\u8BF7\u4FEE\u6539\u540E\u518D\u5BFC\u5165",MORE_THAN_LIMIT:"\u8D85\u8FC7\u6700\u5927\u9650\u5236",FILE_MORE_THAN_LIMIT:"\u8D85\u8FC7{type}\u6700\u5927\u4E0A\u4F20\u9650\u5236",PARAMS_MORE_THAN_LIMIT:"\u8D85\u8FC7\u53C2\u6570{type}\u7684\u6700\u5927\u4E0A\u4F20\u9650\u5236",IMAGE_MORE_THAN_LIMIT_PARAMS:"\u56FE\u7247\u8D85\u8FC7\u6700\u5927\u4E0A\u4F20\u9650\u5236",FILE_MORE_THAN_LIMIT_PARAMS:"\u6587\u4EF6\u8D85\u8FC7\u6700\u5927\u4E0A\u4F20\u9650\u5236",END_MUST_AFTER_START:"\u5F00\u59CB\u65F6\u95F4\u4E0D\u80FD\u665A\u4E8E\u7ED3\u675F\u65F6\u95F4",FILE_READ_ONLY:"\u5DE5\u7A0B\u6587\u4EF6eprj\u6216\u5E93\u6587\u4EF6elib\u5C5E\u6027\u53D8\u4E3A\u53EA\u8BFB\uFF0C\u8BF7\u5728\u8D44\u6E90\u7BA1\u7406\u5668\u53D6\u6D88\u53EA\u8BFB\u540E\u518D\u8BD5\uFF0C\u5E76\u8054\u7CFB\u6280\u672F\u652F\u6301",FILE_READ_ONLY1:"\u5DE5\u7A0B\u6587\u4EF6eprj\u6216\u5E93\u6587\u4EF6elib\u5C5E\u6027\u53D8\u4E3A\u53EA\u8BFB\uFF0C\u8BF7\u5728\u8D44\u6E90\u7BA1\u7406\u5668\u53D6\u6D88\u53EA\u8BFB\u540E\u518D\u8BD5\uFF0C\u5E76\u8054\u7CFB\u6280\u672F\u652F\u6301",DATA_NOT_EXIST:"\u6587\u6863{documentName}\u4E0D\u5B58\u5728",REQUEST_PARAMS_TIME_ERROR:"\u65F6\u95F4\u8BF7\u6C42\u53C2\u6570\u9519\u8BEF",FILES_PATH_NOT_FOUND:"\u627E\u4E0D\u5230\u6587\u4EF6\u5730\u5740",FILES_DATA_NOT_FOUND:"\u627E\u4E0D\u5230\u6587\u4EF6\u6570\u636E",FILES_TYPE_ERROR:"\u6587\u4EF6\u7C7B\u578B\u9519\u8BEF",FILES_TYPE_MUST_BE_ONE:"\u6587\u4EF6\u7C7B\u578B\u5FC5\u987B\u4E3A{type}",SET_WATERMARK_FAIL:"\u6C34\u5370\u8BBE\u7F6E\u5931\u8D25",MYSQL_CRUD_ERROR:"{type}\u6570\u636E\u6267\u884C\u5931\u8D25, \u8BF7\u8054\u7CFB\u6280\u672F\u652F\u6301\u89E3\u51B3",PARAMS_JSON_FAILED:"{type}\u6570\u636E\u89E3\u6790\u5931\u8D25",MYSQL_ERROR:"\u6570\u636E\u5E93\u64CD\u4F5C\u5F02\u5E38",NOT_FOUND:"\u8BF7\u6C42\u4E0D\u5B58\u5728",PRJ_NAME_EXISTS:"\u5DE5\u7A0B\u540D\u79F0\u5DF2\u5B58\u5728",BACKUP_NAME_EXISTS:"\u5907\u4EFD\u540D\u79F0\u5DF2\u5B58\u5728",TITLE_ILLEGAL_LEN:"{documentName}\u957F\u5EA6\u5FC5\u987B\u4E3A1~128\u5B57\u7B26\u957F\u5EA6\uFF01",LIB_NOT_EXIST:"\u5143\u4EF6\u5E93\u4E0D\u5B58\u5728",CONFIG_API_URLS_ERROR:"\u5B9E\u65F6\u4EF7\u683C\u548C\u5E93\u5B58\u672A\u5F00\u542F, \u8BF7\u8054\u7CFB\u7BA1\u7406\u5458",ONE_CLICK_ORDER_NOT_OPEN:"\u4E00\u4EF6\u4E0B\u5355\u529F\u80FD\u672A\u5F00\u542F, \u8BF7\u8054\u7CFB\u7BA1\u7406\u5458",MATERIAL_NOT_OPEN:"\u7269\u6599\u5E93\u672A\u5F00\u542F, \u8BF7\u8054\u7CFB\u7BA1\u7406\u5458",SNAPSHOT_DEPTH_LIMIT:"\u6700\u65B0\u8282\u70B9\u9644\u8FD1\u5B58\u5728\u5FEB\u7167\u6216\u5FEB\u7167\u5DF2\u88AB\u7533\u8BF7",OCR_SYMBOL_URL_ERROR:"OCR\u8BF7\u6C42\u5730\u5740\u672A\u914D\u7F6E",USER_DATA_NOT_FOUND:"\u7528\u6237\u4E0D\u5B58\u5728",USER_DISABLE_ERROR:"\u8D26\u53F7\u5DF2\u505C\u7528",USER_EXISTS_LOGIN_ERROR:"\u7528\u6237\u5DF2\u5728\u522B\u7684\u5730\u65B9\u767B\u5F55",USER_UNAUTHORIZED_MODULES_ERROR:"\u8BE5\u8D26\u53F7\u672A\u6388\u6743\u6A21\u5757",USER_UNAUTHORIZED_ACCESS_ERROR:"\u8BBF\u95EE\u7C7B\u578B\u9519\u8BEF",ADMIN_NOT_CHANGE_PASSWORD:"\u8D85\u7EA7\u7BA1\u7406\u5458\u65E0\u6CD5\u91CD\u7F6E\u5BC6\u7801",SAME_PASSWORD_NEW_PASSWORD:"\u539F\u5BC6\u7801\u8DDF\u65B0\u5BC6\u7801\u76F8\u540C",USER_ONLINE_REGISTRATION_FAILED:"\u767B\u8BB0\u7528\u6237\u5728\u7EBF\u5931\u8D25",USER_PASSWORD_CAN_NOT_DEFAULT:"\u4E0D\u80FD\u4F7F\u7528\u9ED8\u8BA4\u5BC6\u7801",USER_BEFORE_PASSWORD_ERROR:"\u539F\u5BC6\u7801\u9519\u8BEF",USER_PASSWORD_LENGTH_ERROR:"\u5BC6\u7801\u957F\u5EA6\u4E3A8-255\u4F4D",ORG_ROLE_NOT_CREATE:"\u4E0D\u80FD\u521B\u5EFA\u7CFB\u7EDF\u89D2\u8272, \u8BF7\u4FEE\u6539",ORG_ROLE_NAME_DUPLICATE:"\u89D2\u8272\u540D\u79F0\u5DF2\u5B58\u5728, \u8BF7\u4FEE\u6539",ORG_ROLE_ORIGIN_ERROR:"\u672A\u77E5\u7684\u89D2\u8272\u6765\u6E90{message}",ORG_ROLE_NOT_DEFAULT:"\u8BE5\u89D2\u8272\u4E0D\u662F\u9884\u8BBE\u89D2\u8272, \u4E0D\u80FD\u64CD\u4F5C",ADMIN_ROLE_NOT_CHANGE:"\u7BA1\u7406\u5458\u6743\u9650\u4E0D\u5141\u8BB8\u4FEE\u6539",ADMIN_NOT_CHANGE_STATUS:"admin\u8D26\u53F7\u4E0D\u80FD\u66F4\u6539\u72B6\u6001",PROJECT_ARCHIVED:"\u5DE5\u7A0B\u5DF2\u88AB\u9501\u5B9A",PROJECT_UUID_NULL:"\u5DE5\u7A0Buuid\u4E0D\u80FD\u4E3A\u7A7A",PROJECT_UUID_ERROR:"uuid\u9519\u8BEF\u6216\u8005\u5DE5\u7A0Buuid\u5DF2\u5B58\u5728",PROJECT_OR_TEAM_UUID_ERROR:"\u5DE5\u7A0Buuid\u9519\u8BEF\u6216\u8005\u5DF2\u5B58\u5728\u56E2\u961Fuuid",PROJECT_NOT_PERSON_ERROR:"\u4E0D\u5141\u8BB8\u521B\u5EFA\u4E2A\u4EBA\u5DE5\u7A0B",PROJECT_DUPLICATE_NAME:"\u6807\u9898\u5DF2\u5B58\u5728",ANNOTATION_HAS_BE_FOUND:"\u6279\u6CE8\u5DF2\u521B\u5EFA",ANNOTATION_NOT_FOUND:"\u6279\u6CE8\u5757\u4E0D\u5B58\u5728",ANNOTATION_CREATE_ERROR:"\u6279\u6CE8\u5757\u521B\u5EFA\u5931\u8D25",ANNOTATION_UPDATE_ERROR:"\u66F4\u65B0\u6279\u6CE8\u5757\u5931\u8D25",ANNOTATION_DELETE_ERROR:"\u6279\u6CE8\u6761\u5220\u9664\u5931\u8D25",PROJECT_DUPLICATE_PATH:"\u4E0D\u80FD\u521B\u5EFA\u76F8\u540C\u7684\u8DEF\u5F84",TEAM_NOT_FOUND:"\u56E2\u961F\u4E0D\u5B58\u5728",TEAM_UUID_NULL:"\u56E2\u961Fuuid\u4E0D\u80FD\u4E3A\u7A7A",TEAM_FOLDER_ERROR:"\u7236\u6587\u4EF6\u5939\u4E0D\u5B58\u5728\u6216\u4E0D\u5C5E\u4E8E\u5F53\u524D\u56E2\u961F",TEAM_FOLDER_UUID_ERROR:"\u6587\u4EF6\u5939uuid\u9519\u8BEF\u6216\u8005\u5DE5\u7A0Buuid\u5DF2\u5B58\u5728",TEAM_URL_DUPLICATE:"\u56E2\u961F\u94FE\u63A5\u91CD\u590D",TEAM_CAN_NOT_DELETE:"\u56E2\u961F\u4ECD\u5B58\u5728\u5DE5\u7A0B, \u8BF7\u5148\u8F6C\u79FB\u6216\u8005\u5220\u9664",COMPONENT_UUID_NULL:"\u5143\u4EF6uuid\u4E0D\u80FD\u4E3A\u7A7A",COMPONENT_DATA_NOT_FOUND:"\u5143\u4EF6\u5E93\u6570\u636E\u4E0D\u5B58\u5728",COMPONENT_NAME_DUPLICATE:"\u5143\u4EF6\u5E93\u4E0D\u80FD\u91CD\u540D",COMPONENT_TYPE_ERROR:"\u5E93\u7C7B\u578B\u9519\u8BEF",DELETE_SON_CATEGORY:"\u9700\u8981\u5148\u5220\u9664\u5B50\u7C7B\u522B",LICENSE:"\u672A\u627E\u5230\u8BB8\u53EF\u8BC1",START_TIME:"\u8BB8\u53EF\u8BC1\u5F00\u59CB\u65F6\u95F4\u9519\u8BEF",END_TIME:"\u8BB8\u53EF\u8BC1\u7ED3\u675F\u65F6\u95F4\u9519\u8BEF",PROJECT_LIMIT:"\u521B\u5EFA\u7684\u9879\u76EE\u6570\u91CF\u8D85\u8FC7\u9650\u5236",USER_LIMIT:"\u5DF2\u8FBE\u5230\u6700\u5927\u8D26\u53F7\u6570",ONLINE_NUMBER_LIMIT:"\u5DF2\u8FBE\u5230\u6700\u5927\u5728\u7EBF\u6570",LIMIT_PCB:"PCB\u6388\u6743\u6570\u5DF2\u6EE1, \u6DFB\u52A0\u5931\u8D25",LIMIT_SCH:"\u539F\u7406\u56FE\u6388\u6743\u6570\u5DF2\u6EE1, \u6DFB\u52A0\u5931\u8D25",LIMIT_PANEL:"\u9762\u677F\u6388\u6743\u6570\u5DF2\u6EE1, \u6DFB\u52A0\u5931\u8D25",TIME_ERROR:"\u7CFB\u7EDF\u65F6\u95F4\u9519\u8BEF\u8BF7\u91CD\u542F\u670D\u52A1\u5668\u6216\u4FEE\u590D\u7CFB\u7EDF\u65F6\u95F4, \u4FEE\u590D\u540E\u9700\u8981\u91CD\u542F\u79C1\u6709\u5316\u670D\u52A1",LICENSE_ERROR:"\u6388\u6743\u9519\u8BEF",LICENSE_TYPE_ERROR:"\u6388\u6743\u5E94\u7528\u7C7B\u578B\u9519\u8BEF",LICENSE_ORIGIN_ERROR:"\u672A\u77E5\u7684\u6388\u6743\u5E94\u7528{type}",BRANCH_DATA_NOT_FOUND:"\u5DE5\u7A0B\u5206\u652F\u4E0D\u5B58\u5728",PARENT_UUID_ERROR:"\u7236\u7EA7uuid\u9519\u8BEF",BRANCH_MUST_AFTER_NODE:"\u5206\u652F\u5FC5\u987B\u5728\u8282\u70B9\u540E",BRANCH_NAME_ERROR:"\u5206\u652F\u540D\u9519\u8BEF",BRANCH_NAME_DUPLICATE:"\u5206\u652F\u540D\u5DF2\u5B58\u5728",BRANCH_UUID_ERROR:"\u5206\u652Fuuid\u9519\u8BEF",BRANCH_NODE_SET_ERROR:"\u8282\u70B9\u4E0D\u80FD\u8BBE\u7F6E\u4E3A\u9ED8\u8BA4\u5206\u652F\u6216\u6807\u8BB0\u4E3Amaster",BRANCH_DELETE_MAIN_ERROR:"\u4E0D\u80FD\u5220\u9664\u4E3B\u5206\u652F\u4E0A\u7684\u8282\u70B9\u6216\u5206\u652F",BRANCH_CHECK_OUT_ERROR:"\u5B58\u5728\u6587\u6863\u5DF2\u7B7E\u51FA",DOCUMENT_UUID_ERROR:"\u6587\u6863uuid\u9519\u8BEF",UPDATE_FAILED:"\u66F4\u65B0\u5931\u8D25",INNER_API_KEY_ERROR:"\u670D\u52A1\u7AEF\u5185\u90E8\u63A5\u53E3 ApiKey \u9519\u8BEF",BRANCH_MORE_THAN_LIMIT:"\u7248\u672C\u8D85\u8FC7\u6700\u5927\u9650\u5236",WORKSPACE_API_ERROR:"\u5DE5\u4F5C\u533A\u8BF7\u6C42\u54CD\u5E94\u5F02\u5E38"},t6e={codeEN:dft,codeCN:pft},s5e=class a5e{static load(){typeof t6e=="object"&&(a5e.cache=t6e)}static match(t,e,r){if(!this.cache||!this.cache[t])return;let i=this.cache[t][e];if(r&&Object.prototype.toString.call(r)==="[object Object]")for(let n in r){let s=r[n];i=i.replace(`{${n}}`,s)}return i}};s5e.cache={};var nPe=s5e;function fft(){console.log("common init----------------"),nPe.load()}function SP(o,t){throw new Error(`invalid format state on (${t}) of ${o}`)}function mft(o,...t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l);switch(r){case 0:c==="%"?r=1:e.push(c);break;case 1:switch(c){case"d":n=t[i++],typeof n=="number"?(e.push(n.toFixed(0)),r=0):SP(o,l);break;case"f":n=t[i++],typeof n=="number"?(e.push(n.toString()),r=0):SP(o,l);break;case"x":n=t[i++],typeof n=="number"?(e.push((n|0).toString(16)),r=0):SP(o,l);break;case"X":n=t[i++],typeof n=="number"?(e.push((n|0).toString(16).toUpperCase()),r=0):SP(o,l);break;case"s":case"c":n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case"0":s=l+1,a=-1,r=2;break;case"%":e.push("%"),r=0;break;default:SP(o,l)}break;case 2:switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":a=l;break;case"d":if(a>=s){let h=parseInt(o.substring(s,a+1));n=t[i++],typeof n=="number"?(e.push((n|0).toString(10).padStart(h,"0")),r=0):SP(o,l)}else SP(o,l);break;case"x":if(a>=s){let h=parseInt(o.substring(s,a+1));n=t[i++],typeof n=="number"?(e.push((n|0).toString(16).padStart(h,"0")),r=0):SP(o,l)}else SP(o,l);break;case"X":if(a>=s){let h=parseInt(o.substring(s,a+1));n=t[i++],typeof n=="number"?(e.push((n|0).toString(16).toUpperCase().padStart(h,"0")),r=0):SP(o,l)}else SP(o,l);break;default:SP(o,l)}break;default:SP(o,l)}}return e.join("")}function l5e(o){let t="";try{let e=/.*\\(.*)$/.exec(o);e&&e[1]&&typeof e[1]=="string"&&(t=e[1])}catch(e){console.error("Query Folder Name Error:",e)}return t}function c5e(o,t){let e=Math.max(o.length,t.length);for(let r=0;r<e;r++){let i=o[r],n=t[r],s=0;if(typeof i=="string"&&typeof n=="string")s=i.localeCompare(n);else if(typeof i=="number"&&typeof n=="number")s=i-n;else{if(typeof i=="number"&&typeof n=="string")return-1;if(typeof i=="string"&&typeof n=="number")return 1;if(i===void 0&&n!==void 0)return-1;if(i!==void 0&&n===void 0)return 1}if(s!==0)return s}return 0}function oPe(o){let t=/\d+/g,e=new Array,r=0;for(;;){let i=t.exec(o);if(i)r<i.index&&e.push(o.substring(r,i.index)),r=i.index+i[0].length,e.push(parseInt(i[0]));else break}return e.push(o),e}function gft(o,t,e,r){var i,n;let s=[],a=[],l=[];for(let u=0,d=o.length;u<d;u++){s[u]=u;let p;if(Array.isArray(t)){let m="";for(let g=0;g<t.length;g++)if(Object.hasOwnProperty.call(o[u],t[g])){m=o[u][t[g]];break}}else p=t?o[u][t]||((n=(i=o[u])==null?void 0:i[r])==null?void 0:n[t])||"":o[u];if(a[u]=String(p).toUpperCase().match(/\D+|\d+(?:\.\d+)?/g),l[u]=[],a[u])for(let m=0;m<a[u].length;m++)l[u][m]=a[u][m].match(/\d/)?1:2}let c=function(u,d){let p=a[u],m=a[d],g=l[u],y=l[d];if(!p||!m)return e?p==m?0:p?-1:1:p==m?0:p?1:-1;let b=Math.max(p.length,m.length);for(let P=0;P<b;P++){if(e)if(p[P])if(m[P]){if(p[P]!=m[P])return g[P]!=y[P]?g[P]==1?1:-1:g[P]==1?m[P]-p[P]:p[P]<m[P]?1:-1}else return-1;else return 1;if(p[P])if(m[P]){if(p[P]!=m[P])return g[P]!=y[P]?g[P]==1?-1:1:g[P]==1?p[P]-m[P]:p[P]<m[P]?-1:1}else return 1;else return-1}return 0};s.sort(c);let h=[];for(let u=0;u<o.length;u++)h[u]=o[s[u]];return h}function yft(o,t,e){let r=[],i=[],n=[],s=[o,t];for(let a=0,l=s.length;a<l;a++){r[a]=a;let c=s[a];if(i[a]=String(c).toUpperCase().match(/\D+|\d+(?:\.\d+)?/g),n[a]=[],i[a])for(let h=0;h<i[a].length;h++)n[a][h]=i[a][h].match(/\d/)?1:2}return(function(a,l){let c=i[a],h=i[l],u=n[a],d=n[l];if(!c||!h)return e?c==h?0:c?-1:1:c==h?0:c?1:-1;let p=Math.max(c.length,h.length);for(let m=0;m<p;m++){if(e)if(c[m])if(h[m]){if(c[m]!=h[m])return u[m]!=d[m]?u[m]==1?1:-1:u[m]==1?h[m]-c[m]:c[m]<h[m]?1:-1}else return-1;else return 1;if(c[m])if(h[m]){if(c[m]!=h[m])return u[m]!=d[m]?u[m]==1?-1:1:u[m]==1?c[m]-h[m]:c[m]<h[m]?-1:1}else return 1;else return-1}return 0})(r[0],r[1])}function JQ(o,t){let e=!1;for(let r in t)if(Object.hasOwnProperty.call(t,r)&&o.indexOf(r)!==-1){e=!0;break}return e}function bft(o,t=""){return o.sort((r,i)=>c5e(oPe(e(r)),oPe(e(i)))),o;function e(r){if(!r)return r;let i;if(Array.isArray(t)){let n="";for(let s=0;s<t.length;s++)if(Object.hasOwnProperty.call(r,t[s])){n=r[t[s]];break}}else i=r[t]||r;return i}}function Pft(o,t,e=1){var r,i,n,s;let a=(r=o.match(/^\D+/))==null?void 0:r[0],l=(i=o.match(/\d+$/))==null?void 0:i[0],c=(n=t.match(/^\D+/))==null?void 0:n[0],h=(s=t.match(/\d+$/))==null?void 0:s[0];return a&&c?a!==c?e===1?a.localeCompare(c):c.localeCompare(a):l!==h?+l>+h?1*e:-1*e:0:a?-1*e:c?1*e:0}function Tft(o){return new Promise(t=>{setTimeout(t,o)})}var CWt=Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map(o=>o.charCodeAt(0));function Ift(){try{if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof globalThis<"u")return globalThis}catch{return null}}function Q(){return self.EDITOR_TOP||self}var xc=(o,t)=>{let e=/{([^}]*)}/gim,r=[...new Set(o.match(e))];for(let i=0;i<r.length;i++){let n=r[i],s=n.substring(1,n.length-1);t[s]&&(o=o.replace(n,t[s]))}return o};function Cft(o,t,e){t=t||1,e=e||32;var r="",i=t,n=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];o&&(i=Math.round(Math.random()*(e-t))+t);for(var s=0;s<i;s++){let a=Math.round(Math.random()*(n.length-1));r+=n[a]}return r}function Sft(o){try{return JSON.parse(o)}catch{return console.error(`ParseJSON failed:
`+o),null}}var Eft=(o=>(o[o.TRACE=0]="TRACE",o[o.DEBUG=1]="DEBUG",o[o.INFO=2]="INFO",o[o.WARN=3]="WARN",o[o.ERROR=4]="ERROR",o[o.DUMMY=5]="DUMMY",o))(Eft||{}),Oft=(o,t)=>{switch(o){case 4:console.error(...t);break;case 3:console.warn(...t);break;case 2:console.info(...t);break;default:console.log(...t)}},Aft=(o,t)=>t,_ft=class _W{constructor(t,e=Oft,r=Aft){this.level=t,this.writer=e,this.formatter=r}wrap(t){return new _W(this.level,this.writer,(e,r)=>(r=this.formatter(e,r),t(e,r)))}inject(t){return new _W(this.level,this.writer,(e,r)=>(r=t(e,r),this.formatter(e,r)))}shadow(...t){return new _W(this.level,(e,r)=>{this.writer(e,r);for(let i of t)i(e,r)},this.formatter)}mix(...t){return new _W(0,(e,r)=>{this.process(e,r);for(let i of t)i.process(e,r)},(e,r)=>r)}process(t,e){this.level<=t&&this.writer(t,this.formatter(t,e))}process1(t,e,r){this.level<=t&&this.writer(t,this.formatter(t,[mft(e,...r)]))}trace(...t){this.process(0,t)}trace1(t,...e){this.process1(0,t,e)}debug(...t){this.process(1,t)}debug1(t,...e){this.process1(1,t,e)}info(...t){this.process(2,t)}info1(t,...e){this.process1(2,t,e)}warn(...t){this.process(3,t)}warn1(t,...e){this.process1(3,t,e)}error(...t){this.process(4,t)}error1(t,...e){this.process1(4,t,e)}},SWt=new _ft(5),EWt=Date.now()-performance.now(),h5e=new ArrayBuffer(10),OWt=new Float64Array(h5e,0,1),AWt=new Uint8Array(h5e);var MPe={};hft(MPe,{HAS_PANEL:()=>$ft,HAS_PCB:()=>qft,HAS_SCH:()=>Xft,HAS_SIM:()=>Kft,IS_CLIENT:()=>qC,IS_CLIENT_HALF_OFFLINE:()=>GW,IS_CLIENT_NOT_ONLINE:()=>Uft,IS_CLIENT_OFFLINE:()=>p5e,IS_CLIENT_ONLINE:()=>MQ,IS_DEV:()=>Dft,IS_EASYEDA:()=>d5e,IS_EASYEDA_CLIENT:()=>Gft,IS_ECAD:()=>wft,IS_ENTERPRISE_CLIENT:()=>Lft,IS_HALF_OFFLINE:()=>eee,IS_LCEDA:()=>u5e,IS_LCEDA_CLIENT:()=>Vft,IS_OFFLINE:()=>tee,IS_ONLINE:()=>QQ,IS_PCBLUXSHARE:()=>Mft,IS_PRIVATE:()=>ZW,PRO_EDITOR_MODE:()=>Hft,PRO_EDITOR_MODES:()=>xf,SSO_EXTERNAL_IDENTITY_DOMAIN:()=>kft,SSO_EXTERNAL_PERMISSION_DOMAIN:()=>Bft,SSO_EXTERNAL_PERMISSION_MANAGED_DOMAIN:()=>Fft,SSO_IDENTITY_CONNECT:()=>Nft});var vft=(o=>(o.ruler="ruler",o.un_ruler="un_ruler",o))(vft||{}),xft=(o=>(o[o.HOME=-1]="HOME",o[o.BLANKTAB=0]="BLANKTAB",o[o.SCH=1]="SCH",o[o.PART=2]="PART",o[o.PCB=3]="PCB",o[o.FOOTPRINT=4]="FOOTPRINT",o[o.PRJ=5]="PRJ",o[o.SUBPART=6]="SUBPART",o[o.NGSPICE_MODEL=7]="NGSPICE_MODEL",o[o.NGSPICE=8]="NGSPICE",o[o.SIMULIDE=9]="SIMULIDE",o[o.WAVEFORM=10]="WAVEFORM",o[o.SCHLIB3D=11]="SCHLIB3D",o[o.PHOTOVIEW=12]="PHOTOVIEW",o[o.SCHMODULE=13]="SCHMODULE",o[o.PCBMODULE=14]="PCBMODULE",o[o.VIEW3D=15]="VIEW3D",o[o.PCBLIB3D=16]="PCBLIB3D",o[o.BLOCK_SYMBOL=17]="BLOCK_SYMBOL",o[o.NETFLAG=18]="NETFLAG",o[o.NETPORT=19]="NETPORT",o[o.SHEET_SYMBOL=20]="SHEET_SYMBOL",o[o.NONEELEC_SYMBOL=21]="NONEELEC_SYMBOL",o[o.SHORT_SYMBOL=22]="SHORT_SYMBOL",o[o.FOOTPRINTVIEW=23]="FOOTPRINTVIEW",o[o.CNCPRINTVIEW=24]="CNCPRINTVIEW",o[o.OFF_PAGE_CONNECTOR=25]="OFF_PAGE_CONNECTOR",o[o.PANEL=26]="PANEL",o[o.PANEL3D=27]="PANEL3D",o[o.DEVICE=28]="DEVICE",o[o.PANEL_LIB=29]="PANEL_LIB",o[o.ASSEMBLY_VARIANT=30]="ASSEMBLY_VARIANT",o[o.DIFF_PAIRS_FLAG=31]="DIFF_PAIRS_FLAG",o[o.SIMULIDE_MODEL=32]="SIMULIDE_MODEL",o))(xft||{}),Rft=(o=>(o.SCH="SCH",o.PCB="PCB",o.PANEL="PANEL",o.SIM="SIM",o))(Rft||{}),r6e=Ift(),xf=String((r6e==null?void 0:r6e.PRO_EDITOR_MODE)||"LCEDA").split("-"),Dft=xf.indexOf("DEVPRO")>=0,qC=xf.indexOf("CLIENT")>=0,u5e=xf.indexOf("LCEDA")>=0,d5e=xf.indexOf("EASYEDA")>=0,ZW=xf.indexOf("PRIVATE")>=0,QQ=xf.indexOf("ONLINE")>=0,eee=xf.indexOf("HALF_OFFLINE")>=0,tee=xf.indexOf("OFFLINE")>=0,wft=xf.indexOf("ECAD")>=0,Lft=xf.indexOf("ENTERPRISE")>=0,Mft=xf.indexOf("PCB_LUXSHARE")>=0,Nft=xf.indexOf("SSO_IDENTITY_CONNECT")>=0,kft=xf.indexOf("SSO_EXTERNAL_IDENTITY_DOMAIN")>=0,Bft=xf.indexOf("SSO_EXTERNAL_PERMISSION_DOMAIN")>=0,Fft=xf.indexOf("SSO_EXTERNAL_PERMISSION_MANAGED_DOMAIN")>=0,Vft=qC&&u5e,Gft=qC&&d5e,GW=qC&&eee,Uft=qC&&!QQ,p5e=qC&&tee,MQ=qC&&QQ,Hft=qC?QQ?"ONLINE":eee?"HALF_OFFLINE":tee?"OFFLINE":"":"",Wft=xf.indexOf("SCH")>=0,zft=xf.indexOf("PCB")>=0,Yft=xf.indexOf("PANEL")>=0,jft=xf.indexOf("SIM")>=0,Xft=Wft,qft=zft,$ft=Yft,Kft=jft,NPe=(o=>(o.PROJECT_BACKUPS_MANUAL="Backup Project Manually",o.PROJECT_BACKUPS_AUTO="Backup Project Automatically",o.DELETE_BACKUPS="Delete Backup",o.SAVE="Save",o.CREATE_SHEET="New Page",o.DELETE_SHEET="Delete Page",o.RENAME_SHEET="Rename Page",o.SIGNED_SHEET="Check Out Page",o.SIGNIN_SHEET="Check In Page",o.CLEAR_SIGNED="Clear Check Out",o.PROJECT_LOCK="Lock Project",o.PROJECT_UNLOCK="Unlock Project",o.PROJECT_OPEN="Open Project",o.PROJECT_CLOSE="Close Project",o.DOCUMENT_PASTE="Paste Document",o.DOCUMENT_PASTE_ACROSS_PROJECT="Paste Document Across Projects",o.SCHEMATIC_PASTE="Paste Schematic",o.SCHEMATIC_PASTE_ACROSS_PROJECT="Paste Schematic Across Projects",o.PRIMITIVE_PASTE_ACROSS_PROJECT="Paste Elements Across Projects",o.PROJECT_SAVEAS_REMOTE="Save Project to Cloud",o.PROJECT_SAVEAS_LOCAL="Save Project to Local",o.LIBRARY_SAVEAS_LOCAL="Save Library to Local",o.DOCUMENT_SAVEAS_REMOTE="Save Document to Cloud",o.DOCUMENT_SAVEAS_LOCAL="Save Document to Local",o.CBB_SAVEAS_REMOTE="Save Reuse Module to Cloud",o.CBB_SAVEAS_LOCAL="Save Reuse Module to Local",o.SVG_EXPORT="Export SVG",o.PNG_EXPORT="Export PNG",o.PDF_EXPORT="Export PDF",o.BOM_EXPORT="Export BOM",o.PRINT="Print",o.GERBER_EXPORT="Export Gerber",o.COORDINATE_EXPORT="Export Pick and Place File",o.D3FILE_EXPORT="Export 3D File",o.D3SHELLFILE_EXPORT="Export 3D Shell File",o.TESTPOINT_REPORT_EXPORT="Export Test Point Report",o.DXF_EXPORT="Export DXF",o.ODBPLUSS_EXPORT="Export ODB++",o.AD_EXPORT="Export Altium Designer",o.DEVICE_REPLACE="Replace Device",o.FOOTPRINT_REPLACE="Replace Footprint",o.D3MODEL_REPLACE="Replace 3D Model",o.PROJECTLIB_UPDATE="Update Project Library",o.REPLACE="Find and Replace",o.TRACK_BATCH_RENAME="Rename Wires in Batch",o.SHEET_BATCH_RENAME="Rename Pages in Batch",o.NET_CREATED_AUTO="Automatic Network Generation",o.DESIGNATOR_ALLOCATION="Annotate Designator",o.UNIQUE_ID_RESET="Reset Unique ID",o.NET_TABLE_EXPORT="Export Netlist",o.REFRESH_PCB_BY_SCH="Update Schematic to PCB",o.REFRESH_SCH_BY_PCB="Update PCB to Schematic",o.CLEAR_DESIGNATOR="Clear Designator",o.UPDATE_PORT_BY_MODULE_SYMBOL="Update Ports from Module Symbol",o.DESIGN_RULE="Set Design Rules",o.NET_CLASS="Set Network Class",o.EQUAL_LENGTH_GROUP="Set Equal Length Group",o.DIFFERENTIAL_PAIR="Set Differential Pair",o))(NPe||{}),tL=class lv{constructor(t,e=crypto.randomUUID()){this.fileName=t,this.uuid=e,this._params=new URLSearchParams,this._aTarget=document.createElement("a"),this._params.append("uuid",e),this._params.append("fileName",t)}static get URL_VERSION(){var t;try{let e=location.host,r="/";return((t=new RegExp(`${e}(/[\\w|.]+)${r}`).exec(location.href))==null?void 0:t[1])||""}catch{return""}}static getOpenedStream(t){return this._openedInstances.get(t)}get createURL(){return`${lv.CREATE_URL}?${this._params}`}get writeURL(){return`${lv.WRITE_URL}?${this._params}`}get closeURL(){return`${lv.CLOSE_URL}?${this._params}`}get cancelURL(){return`${lv.CANCEL_URL}?${this._params}`}async create(){this._aTarget.href=this.createURL,this._aTarget.click(),this._aTarget.remove(),lv._openedInstances.set(this.uuid,this),await Tft(100)}async write(t){await(await fetch(this.writeURL,{method:"post",body:t})).json()}async close(){await fetch(this.closeURL,{method:"post"}),lv._openedInstances.delete(this.uuid)}async cancel(){await fetch(this.cancelURL,{method:"post"}),lv._openedInstances.delete(this.uuid)}};tL.CREATE_URL=`${tL.URL_VERSION}/sw/download/stream/create`,tL.WRITE_URL="/sw/download/stream/write",tL.CLOSE_URL="/sw/download/stream/close",tL.CANCEL_URL="/sw/download/stream/cancel",tL._openedInstances=new Map;var rk=tL;var Zft=Object.create,f5e=Object.defineProperty,Jft=Object.getOwnPropertyDescriptor,Qft=Object.getOwnPropertyNames,emt=Object.getPrototypeOf,tmt=Object.prototype.hasOwnProperty,i6e=(o=>typeof _N<"u"?_N:typeof Proxy<"u"?new Proxy(o,{get:(t,e)=>(typeof _N<"u"?_N:t)[e]}):o)(function(o){if(typeof _N<"u")return _N.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')}),Wl=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),rmt=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Qft(t))!tmt.call(o,i)&&i!==e&&f5e(o,i,{get:()=>t[i],enumerable:!(r=Jft(t,i))||r.enumerable});return o},ik=(o,t,e)=>(e=o!=null?Zft(emt(o)):{},rmt(t||!o||!o.__esModule?f5e(e,"default",{value:o,enumerable:!0}):e,o)),JW=Wl((o,t)=>{"use strict";var e=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,s=(j,Z)=>{for(var ie in Z)e(j,ie,{get:Z[ie],enumerable:!0})},a=(j,Z,ie,de)=>{if(Z&&typeof Z=="object"||typeof Z=="function")for(let me of i(Z))!n.call(j,me)&&me!==ie&&e(j,me,{get:()=>Z[me],enumerable:!(de=r(Z,me))||de.enumerable});return j},l=j=>a(e({},"__esModule",{value:!0}),j),c={};s(c,{BroadcastChannelMessageBus:()=>J,MessageBus:()=>L,MessageBus2:()=>X,MessageBusTask:()=>W,MessageBusTask2:()=>G,WindowMessageBridge:()=>V,WorkerMessageBridge:()=>z,createBroadcastP2PStream:()=>fe,createBufferedByteBufferStream:()=>$,createBufferedStream:()=>te,createBufferedStringStream:()=>oe,dropP2PStream:()=>Oe,flowRead:()=>be,flowWrite:()=>ue}),t.exports=l(c);var h=class{constructor(j=1.5){this.growthFactor=j,this.capacity=10,this.buffer=new Array(this.capacity),this.head=0,this.tail=0,this.count=0}enqueue(j){if(this.count===this.capacity){let Z=Math.floor(this.capacity*this.growthFactor);console.log("grow",this.capacity,Z);let ie=new Array(Z);for(let de=0;de<this.count;de++)ie[de]=this.buffer[(this.head+de)%this.capacity];this.buffer=ie,this.head=0,this.tail=this.count,this.capacity=Z}this.buffer[this.tail]=j,this.tail=(this.tail+1)%this.capacity,this.count++}dequeue(){if(this.isEmpty())return;let j=this.buffer[this.head];return this.head=(this.head+1)%this.capacity,this.count--,j}peek(){return this.buffer[this.head]}isEmpty(){return this.count===0}clear(){this.buffer.length=0,this.head=0,this.tail=0,this.count=0}},u=new ArrayBuffer(8),d=new Float64Array(u),p=new Uint32Array(u),m=new Uint16Array(u),g=ArrayBuffer;try{g=self.HTMLImageElement||g}catch{}var y=typeof SharedArrayBuffer<"u";function b(j){if(typeof j!="object"||j===null||j instanceof Date||j instanceof ArrayBuffer||y&&j instanceof SharedArrayBuffer||j instanceof Blob||j instanceof FormData||j instanceof Function||j instanceof Uint8ClampedArray||j instanceof g)return j;if(Array.isArray(j))return j.map(b);{let Z={};for(let ie in j)Object.hasOwnProperty.call(j,ie)&&(Z[ie]=b(j[ie]));return Z}}function P(j,Z){return T(j,Z,()=>[])}function T(j,Z,ie){let de=j[Z];return de!==void 0||(de=ie(Z),j[Z]=de),de}var I=class{constructor(j){this.maxResources=j,this.idle=new h,this.isClosed=!1,this.resources=j}acquire(j){this.isClosed?Promise.resolve(!1).then(j):this.resources>0?(this.resources--,Promise.resolve(!0).then(j)):this.idle.enqueue(j)}acquireSync(){return new Promise(j=>{this.acquire(j)})}release(){if(!this.isClosed){let j=this.idle.dequeue();j?Promise.resolve(!0).then(j):this.resources++}}close(){if(!this.isClosed)for(this.isClosed=!0;!this.idle.isEmpty();){let j=this.idle.dequeue();Promise.resolve(!1).then(j)}}};function C(){if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof globalThis<"u")return globalThis;if(typeof global<"u")return global}function E(j,Z){let ie=0,de=j.length;for(let me=0;me<de;me++)j[me]===Z&&(j.splice(me,1),me--,de--,ie++);return ie}var O=C(),_=O.WeakRef||(j=>j);function x(j){if(j!=null){if(typeof j=="object")return new _(j);console.error(j,j instanceof Object,typeof j);return}}function v(j){return j==null?void 0:j.deref()}var D="_MSG_BUS_RPC_",w=300*1e3,F=(j=>(j.PUBLISH="publish",j.SUBSCRIBE="subscribe",j.PUSH="push",j.PULL="pull",j))(F||{}),H=class{constructor(j){this.bus=j}processRemoteMessage(j,Z){let ie=x(Z),de=j.topic,me=j.type,Se=j.message;switch(me){case"pull":this.bus.pull(de,Re=>{this.push(de,Re,v(ie))});break;case"subscribe":this.bus.subscribe(de,Re=>{this.publish(de,Re,v(ie))});break;case"publish":this.bus.publish(de,Se,this,v(ie));break;case"push":this.bus.push(de,Se,this,v(ie));break;default:console.debug("unknown message type "+me)}}rpcCall(j,Z,ie,de=w){let me=x(ie),Se=new Promise(Re=>{let Je=this.bus.uniqueRpcTopic(j);this.publish(j,{message:Z,reply:Je},v(me)),this.bus.pull(Je,(Ke,Gt,Nr)=>{Re({message:Ke,bridge:Gt,source:x(Nr)})})});return de>0?Promise.race([Se,new Promise((Re,Je)=>{setTimeout(Je,de)})]):Se}},z=class extends H{constructor(j,Z){super(j),this.worker=Z,Z.onmessage=ie=>{this.processRemoteMessage(ie.data,void 0)}}publish(j,Z){this.postMessage(j,"publish",Z)}subscribe(j){this.postMessage(j,"subscribe",null)}push(j,Z){this.postMessage(j,"push",Z)}pull(j){this.postMessage(j,"pull",null)}rpcCall(j,Z,ie=w){return super.rpcCall(j,Z,void 0,ie)}postMessage(j,Z,ie){let de={topic:j,type:Z,message:ie};this.worker.postMessage(de)}discard(){this.worker.terminate()}},V=class extends H{constructor(j){super(j),window.addEventListener("message",Z=>{this.processRemoteMessage(Z.data,Z.source)},!1)}publish(j,Z,ie){this.postMessage(j,"publish",Z,ie)}subscribe(j,Z){if(Z===window)throw new Error("regist remote subscribe from current window is not permitted");this.postMessage(j,"subscribe",null,Z)}push(j,Z,ie){this.postMessage(j,"push",Z,ie)}pull(j,Z){if(Z===window)throw new Error("regist remote pull from current window is not permitted");this.postMessage(j,"pull",null,Z)}postMessage(j,Z,ie,de){let me={topic:j,type:Z,message:ie};de&&de.postMessage(me,"*")}},W=class{constructor(j){this.isRunning=!0,this.callback=j}cancel(){this.callback=null,this.isRunning=!1}running(){return this.isRunning}execute(j,Z,ie,de){try{j=de?j:b(j),this.callback(j,Z,ie)}catch(me){console.error(me)}}},L=class{constructor(j=!1){this.subscribed={},this.pulled={},this.pushed={},this.uuid=crypto.randomUUID().replace(/-/g,""),this.rpcTicket=0,this.unsafe=j}uniqueRpcTopic(j){return`${D}-${j}-${this.uuid}-${this.rpcTicket++}`}publish(j,Z,ie,de){let me=this.subscribed[j];if(me){let Se;for(let Re of me)Re.running()?Re.execute(Z,ie,de,this.unsafe):(Se=Se||new Array,Se.push(Re));if(Se)for(let Re of Se)E(me,Re)}else console.debug("no sub on topic: "+j)}subscribe(j,Z){let ie=new W(Z);return P(this.subscribed,j).push(ie),ie}push(j,Z,ie,de){let me=!1,Se=this.pulled[j];if(Se){for(;Se.length>0;){let Re=Se.shift();if(Re.running()){Re.execute(Z,ie,de,this.unsafe),me=!0;break}}Se.length===0&&delete this.pulled[j]}me||P(this.pushed,j).push({message:Z,bridge:ie,source:x(de)})}pull(j,Z){let ie=new W(Z),de=this.pushed[j];if(de){let me=de.shift();ie.execute(me.message,me.bridge,v(me.source),this.unsafe),de.length===0&&delete this.pushed[j]}else P(this.pulled,j).push(ie);return ie}pullA(j){return new Promise(Z=>{this.pull(j,(ie,de,me)=>{Z({message:ie,bridge:de,source:x(me)})})})}rpcService(j,Z){this.subscribe(j,(ie,de,me)=>{let{message:Se,reply:Re}=ie;try{let Je=Z(Se);if(Je instanceof Promise){let Ke=x(me);Je.then(Gt=>{this.rpcReply(Gt,Re,de,v(Ke))},Gt=>{console.error(Gt),this.rpcReply(void 0,Re,de,v(Ke))})}else this.rpcReply(Je,Re,de,me)}catch(Je){console.error(Je),this.rpcReply(void 0,Re,de,me)}})}rpcCall(j,Z,ie=w){let de=new Promise(me=>{let Se=this.uniqueRpcTopic(j);this.publish(j,{message:Z,reply:Se}),this.pull(Se,(Re,Je,Ke)=>{me({message:Re,bridge:Je,source:x(Ke)})})});return ie>0?Promise.race([de,new Promise((me,Se)=>{setTimeout(Se,ie)})]):de}rpcReply(j,Z,ie,de){ie?ie.push(Z,j,de):this.push(Z,j)}},k="_MSG_BUS_RPC_";function N(j,Z){let ie=0,de=j.length;for(let me=0;me<de;me++)j[me]===Z&&(j.splice(me,1),me--,de--,ie++);return ie}function U(j,Z){return B(j,Z,()=>[])}function B(j,Z,ie){let de=j[Z];return de!==void 0||(de=ie(Z),j[Z]=de),de}var G=class{constructor(j,Z){this.callback=j,this.unsafe=Z,this.isRunning=!0}cancel(){this.callback=null,this.isRunning=!1}running(){return this.isRunning}async execute(j){try{j=this.unsafe?j:b(j),this.callback(j)}catch(Z){console.error(Z)}}},Y=class{constructor(j=crypto.randomUUID()){this.uuid=j,this.rpcTicket=0}subscribeOnce(j,Z){let ie=this.subscribe(j,de=>{ie.cancel(),Z(de)});return ie}pullA(j){return new Promise(Z=>{this.pull(j,Z)})}rpcService(j,Z){let ie=de=>{try{let{message:me,replyTopic:Se}=de;try{let Re=Z(me);Re instanceof Promise?Re.then(Je=>{this.publish(Se,{success:!0,result:Je})}).catch(Je=>{console.error(Je),this.publish(Se,{success:!1,err:String(Je)})}):this.publish(Se,{success:!0,result:Re})}catch(Re){this.publish(Se,{success:!1,err:String(Re)})}}finally{this.pull(j,ie)}};this.pull(j,ie)}rpcCall(j,Z,ie=0){let de=new Promise((me,Se)=>{let Re=`${k}-${j}-${this.uuid}-${this.rpcTicket++}`;this.subscribeOnce(Re,Je=>{Je.success?me(Je.result):Se(new Error(Je.err))}),this.push(j,{message:Z,replyTopic:Re})});return ie>0?Promise.race([de,new Promise((me,Se)=>{setTimeout(Se,ie)})]):de}},X=class extends Y{constructor(j=!1){super(),this.unsafe=j,this.subscribed={},this.pulled={},this.pushed={}}publish(j,Z){let ie=this.subscribed[j];if(ie){let de;for(let me of ie)me.running()?me.execute(Z):(de=de||new Array,de.push(me));if(de)for(let me of de)N(ie,me)}}subscribe(j,Z){let ie=new G(Z,this.unsafe);return U(this.subscribed,j).push(ie),ie}push(j,Z){let ie=!1,de=this.pulled[j];if(de){for(;de.length>0;){let me=de.shift();if(me&&me.running()){me.execute(Z),ie=!0;break}}de.length===0&&delete this.pulled[j]}ie||U(this.pushed,j).push(Z)}pull(j,Z){let ie=new G(Z,this.unsafe);return this.repull(j,ie),ie}repull(j,Z){let ie=this.pushed[j];if(ie){let de=ie.shift();de&&(Z.execute(de),ie.length===0&&delete this.pushed[j])}else U(this.pulled,j).push(Z)}},K=class extends Y{constructor(j=crypto.randomUUID()){super(j),this.subscribed={},this.pushed={},this.pulled={},this.pushCnt=0}publish(j,Z){console.debug("BC",this.uuid,"PUBLISH",j,Z),this.broadcastPublish(j,Z)}subscribe(j,Z){console.debug("BC",this.uuid,"SUBSCRIBE",j);let ie=new G(Z,!0);return U(this.subscribed,j).push(ie),ie}push(j,Z){let ie=this.pushCnt++;console.debug("BC",this.uuid,"PUSH",j,`(${ie})`,Z),U(this.pushed,j).push({id:ie,message:Z}),this.broadcastPushedHeadMessage(j)}pull(j,Z){console.debug("BC",this.uuid,"PULL",j);let ie=new G(Z,!0);return U(this.pulled,j).push(ie),this.broadcastWhoHas(j),ie}broadcastPushedHeadMessage(j){let Z=this.pushed[j];Z&&Z[0]&&this.broadcastIHave(j,Z[0].id)}onReceivedPublish(j,Z,ie){console.debug("BCMSG(",this.uuid,")","from",j,"PUBLISH",Z,"message",ie);let de=this.subscribed[Z];if(de){let me;for(let Se of de)Se.running()?Se.execute(ie):(me=me||new Array,me.push(Se));if(me)for(let Se of me)N(de,Se);de.length===0&&delete this.subscribed[Z]}}onReceivedWhoHas(j,Z){console.debug("BCMSG(",this.uuid,")","from",j,"WHOHAS",Z),this.broadcastPushedHeadMessage(Z)}onReceivedIHave(j,Z,ie){console.debug("BCMSG(",this.uuid,")","from",j,"IHAVE",Z,"id",ie);let de=this.pulled[Z];if(de){let me;for(let Se of de)if(Se.running()){this.broadcastINeed(Z,j,ie);break}else me=me||new Array,me.push(Se);if(me)for(let Se of me)N(de,Se);de.length===0&&delete this.pulled[Z]}}onReceivedINeed(j,Z,ie,de){if(console.debug("BCMSG(",this.uuid,")","from",j,"INEED",Z,"source",ie,"id",de),this.uuid===ie){let me=this.pushed[Z];if(me&&me[0]&&me[0].id===de){let{message:Se}=me.shift();this.broadcastIGive(Z,de,j,Se),this.broadcastPushedHeadMessage(Z),me.length===0&&delete this.pushed[Z]}}}onReceivedIGive(j,Z,ie,de,me){console.debug("BCMSG(",this.uuid,")","from",j,"IGIVE",Z,"id",ie,"target",de,"message",me);let Se=this.pulled[Z];if(Se&&this.uuid===de){let Re=!1;for(;Se.length>0;){let Je=Se.shift();if(Je.running()){Je.execute(me),Re=!0;break}}Re||this.push(Z,me),Se.length===0&&delete this.pulled[Z]}}},J=class extends K{constructor(j,Z=crypto.randomUUID()){super(Z),this.bc=new BroadcastChannel(j),this.bc.onmessage=ie=>{this.onMessage(ie.data)}}onMessage(j){let{type:Z,uuid:ie,topic:de}=j;switch(Z){case"PUBLISH":{let{message:me}=j;this.onReceivedPublish(ie,de,me);break}case"WHOHAS":{this.onReceivedWhoHas(ie,de);break}case"IHAVE":{let{id:me}=j;this.onReceivedIHave(ie,de,me);break}case"INEED":{let{source:me,id:Se}=j;this.onReceivedINeed(ie,de,me,Se);break}case"IGIVE":{let{target:me,id:Se,message:Re}=j;this.onReceivedIGive(ie,de,Se,me,Re);break}default:console.warn("unsupported",j)}}broadcastPublish(j,Z){this.post({type:"PUBLISH",uuid:this.uuid,topic:j,message:Z})}broadcastWhoHas(j){this.post({type:"WHOHAS",uuid:this.uuid,topic:j})}broadcastIHave(j,Z){this.post({type:"IHAVE",uuid:this.uuid,topic:j,id:Z})}broadcastINeed(j,Z,ie){this.post({type:"INEED",uuid:this.uuid,topic:j,source:Z,id:ie})}broadcastIGive(j,Z,ie,de){this.post({type:"IGIVE",uuid:this.uuid,topic:j,id:Z,target:ie,message:de})}post(j){this.bc.postMessage(j),Promise.resolve().then(()=>{this.onMessage(j)})}},se=Symbol("BLOCKING_QUEUE_RESET"),ce=class{constructor(j,Z=()=>1){if(this.maxSize=j,this.itemSizeOf=Z,this.queue=new h,this.waitingConsumers=new h,this.waitingProducers=new h,this.queueSize=0,this.closePromise=null,this.closeResolve=null,j<=0)throw new Error("Max size must be greater than 0")}enqueue(j){return this.closePromise?!1:this.isFull()?(async()=>{console.debug("queue is full",this.queueSize,this.maxSize);let Z=await new Promise(ie=>{this.waitingProducers.enqueue(ie)});return console.debug("queue is not full",this.size(),Z),Z?(this.innerEnqueue(j),!0):!1})():(this.innerEnqueue(j),!0)}innerEnqueue(j){if(this.waitingConsumers.isEmpty())this.queue.enqueue(j),this.queueSize+=this.itemSizeOf(j),console.debug("queue pushed",j,"size",this.queueSize);else{let Z=this.waitingConsumers.dequeue();Promise.resolve(j).then(Z),console.debug("queue direct",j,"size",this.queueSize)}}dequeue(){if(this.queue.isEmpty())if(this.closePromise){for(;!this.waitingConsumers.isEmpty();){let j=this.waitingConsumers.dequeue();Promise.resolve(se).then(j)}return setTimeout(()=>this.closeResolve(),0),se}else return new Promise(j=>{this.waitingConsumers.enqueue(j)});else{let j=this.queue.dequeue();if(this.queueSize-=this.itemSizeOf(j),!this.waitingProducers.isEmpty()){let Z=this.waitingProducers.dequeue();Promise.resolve(!0).then(Z)}return j}}size(){return this.queueSize}isEmpty(){return this.queueSize===0}isFull(){return this.queueSize>=this.maxSize}close(){return this.closePromise||(this.closePromise=new Promise(j=>{for(this.closeResolve=j;!this.waitingProducers.isEmpty();){let Z=this.waitingProducers.dequeue();Promise.resolve(!1).then(Z)}if(this.queueSize===0){for(;!this.waitingConsumers.isEmpty();){let Z=this.waitingConsumers.dequeue();Promise.resolve(se).then(Z)}j()}})),this.closePromise}};function te(j,Z,ie=Number.MAX_SAFE_INTEGER){let de=new ce(ie,Z),me=new ReadableStream({pull(Re){let Je=!0,Ke=(async()=>{let Gt=new Array;do{let Nr=de.dequeue();if(Nr instanceof Promise){Je=!1;let xr=await Nr;xr===se?Re.close():Gt.push(xr)}else{let xr=Nr;xr===se?Re.close():Gt.push(xr)}}while(de.size()>0);if(Gt.length>0){let Nr=j(Gt);Re.enqueue(Nr)}})();if(!Je)return console.debug("read stream stucked --------------------------------------"),Ke},async cancel(){console.debug("buffered readable cancel"),await de.close()}}),Se=new WritableStream({write(Re,Je){let Ke=!0,Gt=(async()=>{let Nr=de.enqueue(Re);typeof Nr=="boolean"?Nr||Je.error(new Error("Write stream closed")):(Ke=!1,await Nr||Je.error(new Error("Write stream closed")))})();if(!Ke)return console.debug("read stream stucked >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"),Gt},async close(){console.debug("buffered writable closing",de.size()),await de.close(),console.debug("buffered writable closed",de.size())},async abort(){console.debug("buffered writable aborting",de.size()),await de.close(),console.debug("buffered writable aborted",de.size())}});return{readable:me,writable:Se}}function oe(j=Number.MAX_SAFE_INTEGER){return te(Z=>Z.join(""),Z=>Z.length,j)}function $(j=Number.MAX_SAFE_INTEGER){return te(Z=>{let ie=new Uint8Array(Z.reduce((me,Se)=>me+Se.byteLength,0)),de=0;return Z.forEach(me=>{ie.set(me,de),de+=me.byteLength}),ie},Z=>Z.byteLength,j)}function fe(j){return new Promise((Z,ie)=>{let de=new BroadcastChannel(j),me=new ce(1),Se=new I(1),Re=null,Je=!1,Ke=!1,Gt=!1;de.onmessage=Nr=>{let xr=Nr.data,{type:vr}=xr;if(console.debug("p2p",j,"type",vr,"data",vr==="DATA"&&xr.data),vr==="DATA")me.enqueue(xr.data);else if(vr==="HI"){if(!Re){de.postMessage({type:"HI"});let Ft=0;Re={rs:new ReadableStream({async pull(ir){let Fe=await me.dequeue();Fe===se?(await Ne(),ir.close()):(ir.enqueue(Fe),de.postMessage({type:"ACK"}))},cancel(){return Ne()}}),ws:new WritableStream({async write(ir,Fe){await Se.acquireSync()?de.postMessage({type:"DATA",id:Ft++,data:ir}):(_r(),Fe.error(new Error("Write stream closed")))},close(){_r()},abort(){_r()}})},Z(Re)}}else vr==="REND"?Re?Se.close():Vt("REND1"):vr==="WEND"?Re?me.close():Vt("WEND1"):vr==="ACK"&&Se.release();function _r(){Je||(Je=!0,console.debug(j,"p2p write stream closed"),Se.close(),de.postMessage({type:"WEND"}),Ke&&(console.debug(j,"p2p channel closed on ws"),de.close()))}async function Ne(){Ke||(Ke=!0,console.debug(j,"p2p read stream closed"),de.postMessage({type:"REND"}),await me.close(),Je&&(console.debug(j,"p2p channel closed on rs"),de.close()))}async function Vt(Ft){Gt||(Gt=!0,console.debug(j,"p2p channel connection released on",Ft),Se.close(),me.close(),Re?(Re.rs.locked||(console.debug(j,"p2p unlocked read stream direct cancel"),Re.rs.cancel()),Re.ws.locked||(console.debug(j,"p2p unlocked write stream direct close"),Re.ws.close())):(de.postMessage({type:"HI"}),de.close()),ie(new Error("p2p channel connection released")))}},de.postMessage({type:"HI"})})}function Oe(j){return new Promise(Z=>{let ie=new BroadcastChannel(j);ie.onmessage=de=>{let me=de.data,{type:Se}=me;Se==="HI"&&(ie.postMessage({type:"REND"}),ie.close(),Z())},ie.postMessage({type:"REND"})})}async function Te(j){try{return await fe(j)}catch(Z){Z.message!=="p2p channel connection released"&&console.error(Z)}}async function ue(j,Z,ie=10*1024*1024,de=!0){let me=await Te(j);if(!me)return!1;let Se=!1;try{let Re,Je=Ke=>{if(!Re)if(!de)Re=me.ws.getWriter();else if(typeof Ke=="string"){let Gt=oe(ie);Gt.readable.pipeTo(me.ws),Re=Gt.writable.getWriter()}else{let Gt=$(ie);Gt.readable.pipeTo(me.ws),Re=Gt.writable.getWriter()}return Re.write(Ke)};if(Array.isArray(Z))for(let Ke of Z)await Je(Ke);else await Z({write:Je,get desiredSize(){return((Re==null?void 0:Re.desiredSize)||0)+10}});Re&&await Re.close(),Se=!0}catch(Re){console.error(Re)}finally{return me.rs.cancel(),Se}}async function be(j,Z){var ie,de;let me=await Te(j);if(me)try{let Se=me.rs.getReader();for((ie=Z.start)==null?void 0:ie.call(Z);;){let{value:Re,done:Je}=await Se.read();if(Re!==void 0){let Ke;if(Z.update instanceof Promise?Ke=await Z.update(Re):Ke=Z.update(Re),Ke){await Se.cancel();break}}if(Je){(de=Z.end)==null||de.call(Z);break}}}catch(Se){console.error(Se)}finally{me.ws.close()}}}),bc=Wl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r():typeof define=="function"&&define.amd?define([],r):e.CryptoJS=r()})(o,function(){var e=e||(function(r,i){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof global<"u"&&global.crypto&&(n=global.crypto),!n&&typeof i6e=="function")try{n=i6e("crypto")}catch{}var s=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||(function(){function T(){}return function(I){var C;return T.prototype=I,C=new T,T.prototype=null,C}})(),l={},c=l.lib={},h=c.Base=(function(){return{extend:function(T){var I=a(this);return T&&I.mixIn(T),(!I.hasOwnProperty("init")||this.init===I.init)&&(I.init=function(){I.$super.init.apply(this,arguments)}),I.init.prototype=I,I.$super=this,I},create:function(){var T=this.extend();return T.init.apply(T,arguments),T},init:function(){},mixIn:function(T){for(var I in T)T.hasOwnProperty(I)&&(this[I]=T[I]);T.hasOwnProperty("toString")&&(this.toString=T.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),u=c.WordArray=h.extend({init:function(T,I){T=this.words=T||[],I!=i?this.sigBytes=I:this.sigBytes=T.length*4},toString:function(T){return(T||p).stringify(this)},concat:function(T){var I=this.words,C=T.words,E=this.sigBytes,O=T.sigBytes;if(this.clamp(),E%4)for(var _=0;_<O;_++){var x=C[_>>>2]>>>24-_%4*8&255;I[E+_>>>2]|=x<<24-(E+_)%4*8}else for(var v=0;v<O;v+=4)I[E+v>>>2]=C[v>>>2];return this.sigBytes+=O,this},clamp:function(){var T=this.words,I=this.sigBytes;T[I>>>2]&=4294967295<<32-I%4*8,T.length=r.ceil(I/4)},clone:function(){var T=h.clone.call(this);return T.words=this.words.slice(0),T},random:function(T){for(var I=[],C=0;C<T;C+=4)I.push(s());return new u.init(I,T)}}),d=l.enc={},p=d.Hex={stringify:function(T){for(var I=T.words,C=T.sigBytes,E=[],O=0;O<C;O++){var _=I[O>>>2]>>>24-O%4*8&255;E.push((_>>>4).toString(16)),E.push((_&15).toString(16))}return E.join("")},parse:function(T){for(var I=T.length,C=[],E=0;E<I;E+=2)C[E>>>3]|=parseInt(T.substr(E,2),16)<<24-E%8*4;return new u.init(C,I/2)}},m=d.Latin1={stringify:function(T){for(var I=T.words,C=T.sigBytes,E=[],O=0;O<C;O++){var _=I[O>>>2]>>>24-O%4*8&255;E.push(String.fromCharCode(_))}return E.join("")},parse:function(T){for(var I=T.length,C=[],E=0;E<I;E++)C[E>>>2]|=(T.charCodeAt(E)&255)<<24-E%4*8;return new u.init(C,I)}},g=d.Utf8={stringify:function(T){try{return decodeURIComponent(escape(m.stringify(T)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(T){return m.parse(unescape(encodeURIComponent(T)))}},y=c.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(T){typeof T=="string"&&(T=g.parse(T)),this._data.concat(T),this._nDataBytes+=T.sigBytes},_process:function(T){var I,C=this._data,E=C.words,O=C.sigBytes,_=this.blockSize,x=_*4,v=O/x;T?v=r.ceil(v):v=r.max((v|0)-this._minBufferSize,0);var D=v*_,w=r.min(D*4,O);if(D){for(var F=0;F<D;F+=_)this._doProcessBlock(E,F);I=E.splice(0,D),C.sigBytes-=w}return new u.init(I,w)},clone:function(){var T=h.clone.call(this);return T._data=this._data.clone(),T},_minBufferSize:0}),b=c.Hasher=y.extend({cfg:h.extend(),init:function(T){this.cfg=this.cfg.extend(T),this.reset()},reset:function(){y.reset.call(this),this._doReset()},update:function(T){return this._append(T),this._process(),this},finalize:function(T){T&&this._append(T);var I=this._doFinalize();return I},blockSize:512/32,_createHelper:function(T){return function(I,C){return new T.init(C).finalize(I)}},_createHmacHelper:function(T){return function(I,C){return new P.HMAC.init(T,C).finalize(I)}}}),P=l.algo={};return l})(Math);return e})}),ree=Wl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(bc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.Base,a=n.WordArray,l=i.x64={},c=l.Word=s.extend({init:function(u,d){this.high=u,this.low=d}}),h=l.WordArray=s.extend({init:function(u,d){u=this.words=u||[],d!=r?this.sigBytes=d:this.sigBytes=u.length*8},toX32:function(){for(var u=this.words,d=u.length,p=[],m=0;m<d;m++){var g=u[m];p.push(g.high),p.push(g.low)}return a.create(p,this.sigBytes)},clone:function(){for(var u=s.clone.call(this),d=u.words=this.words.slice(0),p=d.length,m=0;m<p;m++)d[m]=d[m].clone();return u}})})(),e})}),imt=Wl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(bc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){if(typeof ArrayBuffer=="function"){var r=e,i=r.lib,n=i.WordArray,s=n.init,a=n.init=function(l){if(l instanceof ArrayBuffer&&(l=new Uint8Array(l)),(l instanceof Int8Array||typeof Uint8ClampedArray<"u"&&l instanceof Uint8ClampedArray||l instanceof Int16Array||l instanceof Uint16Array||l instanceof Int32Array||l instanceof Uint32Array||l instanceof Float32Array||l instanceof Float64Array)&&(l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength)),l instanceof Uint8Array){for(var c=l.byteLength,h=[],u=0;u<c;u++)h[u>>>2]|=l[u]<<24-u%4*8;s.call(this,h,c)}else s.apply(this,arguments)};a.prototype=n}})(),e.lib.WordArray})}),nmt=Wl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(bc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=r.enc,a=s.Utf16=s.Utf16BE={stringify:function(c){for(var h=c.words,u=c.sigBytes,d=[],p=0;p<u;p+=2){var m=h[p>>>2]>>>16-p%4*8&65535;d.push(String.fromCharCode(m))}return d.join("")},parse:function(c){for(var h=c.length,u=[],d=0;d<h;d++)u[d>>>1]|=c.charCodeAt(d)<<16-d%2*16;return n.create(u,h*2)}};s.Utf16LE={stringify:function(c){for(var h=c.words,u=c.sigBytes,d=[],p=0;p<u;p+=2){var m=l(h[p>>>2]>>>16-p%4*8&65535);d.push(String.fromCharCode(m))}return d.join("")},parse:function(c){for(var h=c.length,u=[],d=0;d<h;d++)u[d>>>1]|=l(c.charCodeAt(d)<<16-d%2*16);return n.create(u,h*2)}};function l(c){return c<<8&4278255360|c>>>8&16711935}})(),e.enc.Utf16})}),pL=Wl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(bc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=r.enc,a=s.Base64={stringify:function(c){var h=c.words,u=c.sigBytes,d=this._map;c.clamp();for(var p=[],m=0;m<u;m+=3)for(var g=h[m>>>2]>>>24-m%4*8&255,y=h[m+1>>>2]>>>24-(m+1)%4*8&255,b=h[m+2>>>2]>>>24-(m+2)%4*8&255,P=g<<16|y<<8|b,T=0;T<4&&m+T*.75<u;T++)p.push(d.charAt(P>>>6*(3-T)&63));var I=d.charAt(64);if(I)for(;p.length%4;)p.push(I);return p.join("")},parse:function(c){var h=c.length,u=this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var p=0;p<u.length;p++)d[u.charCodeAt(p)]=p}var m=u.charAt(64);if(m){var g=c.indexOf(m);g!==-1&&(h=g)}return l(c,h,d)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function l(c,h,u){for(var d=[],p=0,m=0;m<h;m++)if(m%4){var g=u[c.charCodeAt(m-1)]<<m%4*2,y=u[c.charCodeAt(m)]>>>6-m%4*2,b=g|y;d[p>>>2]|=b<<24-p%4*8,p++}return n.create(d,p)}})(),e.enc.Base64})}),omt=Wl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(bc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=r.enc,a=s.Base64url={stringify:function(c,h){h===void 0&&(h=!0);var u=c.words,d=c.sigBytes,p=h?this._safe_map:this._map;c.clamp();for(var m=[],g=0;g<d;g+=3)for(var y=u[g>>>2]>>>24-g%4*8&255,b=u[g+1>>>2]>>>24-(g+1)%4*8&255,P=u[g+2>>>2]>>>24-(g+2)%4*8&255,T=y<<16|b<<8|P,I=0;I<4&&g+I*.75<d;I++)m.push(p.charAt(T>>>6*(3-I)&63));var C=p.charAt(64);if(C)for(;m.length%4;)m.push(C);return m.join("")},parse:function(c,h){h===void 0&&(h=!0);var u=c.length,d=h?this._safe_map:this._map,p=this._reverseMap;if(!p){p=this._reverseMap=[];for(var m=0;m<d.length;m++)p[d.charCodeAt(m)]=m}var g=d.charAt(64);if(g){var y=c.indexOf(g);y!==-1&&(u=y)}return l(c,u,p)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function l(c,h,u){for(var d=[],p=0,m=0;m<h;m++)if(m%4){var g=u[c.charCodeAt(m-1)]<<m%4*2,y=u[c.charCodeAt(m)]>>>6-m%4*2,b=g|y;d[p>>>2]|=b<<24-p%4*8,p++}return n.create(d,p)}})(),e.enc.Base64url})}),fL=Wl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(bc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.WordArray,a=n.Hasher,l=i.algo,c=[];(function(){for(var g=0;g<64;g++)c[g]=r.abs(r.sin(g+1))*4294967296|0})();var h=l.MD5=a.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(g,y){for(var b=0;b<16;b++){var P=y+b,T=g[P];g[P]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360}var I=this._hash.words,C=g[y+0],E=g[y+1],O=g[y+2],_=g[y+3],x=g[y+4],v=g[y+5],D=g[y+6],w=g[y+7],F=g[y+8],H=g[y+9],z=g[y+10],V=g[y+11],W=g[y+12],L=g[y+13],k=g[y+14],N=g[y+15],U=I[0],B=I[1],G=I[2],Y=I[3];U=u(U,B,G,Y,C,7,c[0]),Y=u(Y,U,B,G,E,12,c[1]),G=u(G,Y,U,B,O,17,c[2]),B=u(B,G,Y,U,_,22,c[3]),U=u(U,B,G,Y,x,7,c[4]),Y=u(Y,U,B,G,v,12,c[5]),G=u(G,Y,U,B,D,17,c[6]),B=u(B,G,Y,U,w,22,c[7]),U=u(U,B,G,Y,F,7,c[8]),Y=u(Y,U,B,G,H,12,c[9]),G=u(G,Y,U,B,z,17,c[10]),B=u(B,G,Y,U,V,22,c[11]),U=u(U,B,G,Y,W,7,c[12]),Y=u(Y,U,B,G,L,12,c[13]),G=u(G,Y,U,B,k,17,c[14]),B=u(B,G,Y,U,N,22,c[15]),U=d(U,B,G,Y,E,5,c[16]),Y=d(Y,U,B,G,D,9,c[17]),G=d(G,Y,U,B,V,14,c[18]),B=d(B,G,Y,U,C,20,c[19]),U=d(U,B,G,Y,v,5,c[20]),Y=d(Y,U,B,G,z,9,c[21]),G=d(G,Y,U,B,N,14,c[22]),B=d(B,G,Y,U,x,20,c[23]),U=d(U,B,G,Y,H,5,c[24]),Y=d(Y,U,B,G,k,9,c[25]),G=d(G,Y,U,B,_,14,c[26]),B=d(B,G,Y,U,F,20,c[27]),U=d(U,B,G,Y,L,5,c[28]),Y=d(Y,U,B,G,O,9,c[29]),G=d(G,Y,U,B,w,14,c[30]),B=d(B,G,Y,U,W,20,c[31]),U=p(U,B,G,Y,v,4,c[32]),Y=p(Y,U,B,G,F,11,c[33]),G=p(G,Y,U,B,V,16,c[34]),B=p(B,G,Y,U,k,23,c[35]),U=p(U,B,G,Y,E,4,c[36]),Y=p(Y,U,B,G,x,11,c[37]),G=p(G,Y,U,B,w,16,c[38]),B=p(B,G,Y,U,z,23,c[39]),U=p(U,B,G,Y,L,4,c[40]),Y=p(Y,U,B,G,C,11,c[41]),G=p(G,Y,U,B,_,16,c[42]),B=p(B,G,Y,U,D,23,c[43]),U=p(U,B,G,Y,H,4,c[44]),Y=p(Y,U,B,G,W,11,c[45]),G=p(G,Y,U,B,N,16,c[46]),B=p(B,G,Y,U,O,23,c[47]),U=m(U,B,G,Y,C,6,c[48]),Y=m(Y,U,B,G,w,10,c[49]),G=m(G,Y,U,B,k,15,c[50]),B=m(B,G,Y,U,v,21,c[51]),U=m(U,B,G,Y,W,6,c[52]),Y=m(Y,U,B,G,_,10,c[53]),G=m(G,Y,U,B,z,15,c[54]),B=m(B,G,Y,U,E,21,c[55]),U=m(U,B,G,Y,F,6,c[56]),Y=m(Y,U,B,G,N,10,c[57]),G=m(G,Y,U,B,D,15,c[58]),B=m(B,G,Y,U,L,21,c[59]),U=m(U,B,G,Y,x,6,c[60]),Y=m(Y,U,B,G,V,10,c[61]),G=m(G,Y,U,B,O,15,c[62]),B=m(B,G,Y,U,H,21,c[63]),I[0]=I[0]+U|0,I[1]=I[1]+B|0,I[2]=I[2]+G|0,I[3]=I[3]+Y|0},_doFinalize:function(){var g=this._data,y=g.words,b=this._nDataBytes*8,P=g.sigBytes*8;y[P>>>5]|=128<<24-P%32;var T=r.floor(b/4294967296),I=b;y[(P+64>>>9<<4)+15]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360,y[(P+64>>>9<<4)+14]=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360,g.sigBytes=(y.length+1)*4,this._process();for(var C=this._hash,E=C.words,O=0;O<4;O++){var _=E[O];E[O]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360}return C},clone:function(){var g=a.clone.call(this);return g._hash=this._hash.clone(),g}});function u(g,y,b,P,T,I,C){var E=g+(y&b|~y&P)+T+C;return(E<<I|E>>>32-I)+y}function d(g,y,b,P,T,I,C){var E=g+(y&P|b&~P)+T+C;return(E<<I|E>>>32-I)+y}function p(g,y,b,P,T,I,C){var E=g+(y^b^P)+T+C;return(E<<I|E>>>32-I)+y}function m(g,y,b,P,T,I,C){var E=g+(b^(y|~P))+T+C;return(E<<I|E>>>32-I)+y}i.MD5=a._createHelper(h),i.HmacMD5=a._createHmacHelper(h)})(Math),e.MD5})}),m5e=Wl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(bc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=i.Hasher,a=r.algo,l=[],c=a.SHA1=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(h,u){for(var d=this._hash.words,p=d[0],m=d[1],g=d[2],y=d[3],b=d[4],P=0;P<80;P++){if(P<16)l[P]=h[u+P]|0;else{var T=l[P-3]^l[P-8]^l[P-14]^l[P-16];l[P]=T<<1|T>>>31}var I=(p<<5|p>>>27)+b+l[P];P<20?I+=(m&g|~m&y)+1518500249:P<40?I+=(m^g^y)+1859775393:P<60?I+=(m&g|m&y|g&y)-1894007588:I+=(m^g^y)-899497514,b=y,y=g,g=m<<30|m>>>2,m=p,p=I}d[0]=d[0]+p|0,d[1]=d[1]+m|0,d[2]=d[2]+g|0,d[3]=d[3]+y|0,d[4]=d[4]+b|0},_doFinalize:function(){var h=this._data,u=h.words,d=this._nDataBytes*8,p=h.sigBytes*8;return u[p>>>5]|=128<<24-p%32,u[(p+64>>>9<<4)+14]=Math.floor(d/4294967296),u[(p+64>>>9<<4)+15]=d,h.sigBytes=u.length*4,this._process(),this._hash},clone:function(){var h=s.clone.call(this);return h._hash=this._hash.clone(),h}});r.SHA1=s._createHelper(c),r.HmacSHA1=s._createHmacHelper(c)})(),e.SHA1})}),kPe=Wl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(bc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.WordArray,a=n.Hasher,l=i.algo,c=[],h=[];(function(){function p(b){for(var P=r.sqrt(b),T=2;T<=P;T++)if(!(b%T))return!1;return!0}function m(b){return(b-(b|0))*4294967296|0}for(var g=2,y=0;y<64;)p(g)&&(y<8&&(c[y]=m(r.pow(g,1/2))),h[y]=m(r.pow(g,1/3)),y++),g++})();var u=[],d=l.SHA256=a.extend({_doReset:function(){this._hash=new s.init(c.slice(0))},_doProcessBlock:function(p,m){for(var g=this._hash.words,y=g[0],b=g[1],P=g[2],T=g[3],I=g[4],C=g[5],E=g[6],O=g[7],_=0;_<64;_++){if(_<16)u[_]=p[m+_]|0;else{var x=u[_-15],v=(x<<25|x>>>7)^(x<<14|x>>>18)^x>>>3,D=u[_-2],w=(D<<15|D>>>17)^(D<<13|D>>>19)^D>>>10;u[_]=v+u[_-7]+w+u[_-16]}var F=I&C^~I&E,H=y&b^y&P^b&P,z=(y<<30|y>>>2)^(y<<19|y>>>13)^(y<<10|y>>>22),V=(I<<26|I>>>6)^(I<<21|I>>>11)^(I<<7|I>>>25),W=O+V+F+h[_]+u[_],L=z+H;O=E,E=C,C=I,I=T+W|0,T=P,P=b,b=y,y=W+L|0}g[0]=g[0]+y|0,g[1]=g[1]+b|0,g[2]=g[2]+P|0,g[3]=g[3]+T|0,g[4]=g[4]+I|0,g[5]=g[5]+C|0,g[6]=g[6]+E|0,g[7]=g[7]+O|0},_doFinalize:function(){var p=this._data,m=p.words,g=this._nDataBytes*8,y=p.sigBytes*8;return m[y>>>5]|=128<<24-y%32,m[(y+64>>>9<<4)+14]=r.floor(g/4294967296),m[(y+64>>>9<<4)+15]=g,p.sigBytes=m.length*4,this._process(),this._hash},clone:function(){var p=a.clone.call(this);return p._hash=this._hash.clone(),p}});i.SHA256=a._createHelper(d),i.HmacSHA256=a._createHmacHelper(d)})(Math),e.SHA256})}),smt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),kPe()):typeof define=="function"&&define.amd?define(["./core","./sha256"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=r.algo,a=s.SHA256,l=s.SHA224=a.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var c=a._doFinalize.call(this);return c.sigBytes-=4,c}});r.SHA224=a._createHelper(l),r.HmacSHA224=a._createHmacHelper(l)})(),e.SHA224})}),g5e=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),ree()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.Hasher,s=r.x64,a=s.Word,l=s.WordArray,c=r.algo;function h(){return a.create.apply(a,arguments)}var u=[h(1116352408,3609767458),h(1899447441,602891725),h(3049323471,3964484399),h(3921009573,2173295548),h(961987163,4081628472),h(1508970993,3053834265),h(2453635748,2937671579),h(2870763221,3664609560),h(3624381080,2734883394),h(310598401,1164996542),h(607225278,1323610764),h(1426881987,3590304994),h(1925078388,4068182383),h(2162078206,991336113),h(2614888103,633803317),h(3248222580,3479774868),h(3835390401,2666613458),h(4022224774,944711139),h(264347078,2341262773),h(604807628,2007800933),h(770255983,1495990901),h(1249150122,1856431235),h(1555081692,3175218132),h(1996064986,2198950837),h(2554220882,3999719339),h(2821834349,766784016),h(2952996808,2566594879),h(3210313671,3203337956),h(3336571891,1034457026),h(3584528711,2466948901),h(113926993,3758326383),h(338241895,168717936),h(666307205,1188179964),h(773529912,1546045734),h(1294757372,1522805485),h(1396182291,2643833823),h(1695183700,2343527390),h(1986661051,1014477480),h(2177026350,1206759142),h(2456956037,344077627),h(2730485921,1290863460),h(2820302411,3158454273),h(3259730800,3505952657),h(3345764771,106217008),h(3516065817,3606008344),h(3600352804,1432725776),h(4094571909,1467031594),h(275423344,851169720),h(430227734,3100823752),h(506948616,1363258195),h(659060556,3750685593),h(883997877,3785050280),h(958139571,3318307427),h(1322822218,3812723403),h(1537002063,2003034995),h(1747873779,3602036899),h(1955562222,1575990012),h(2024104815,1125592928),h(2227730452,2716904306),h(2361852424,442776044),h(2428436474,593698344),h(2756734187,3733110249),h(3204031479,2999351573),h(3329325298,3815920427),h(3391569614,3928383900),h(3515267271,566280711),h(3940187606,3454069534),h(4118630271,4000239992),h(116418474,1914138554),h(174292421,2731055270),h(289380356,3203993006),h(460393269,320620315),h(685471733,587496836),h(852142971,1086792851),h(1017036298,365543100),h(1126000580,2618297676),h(1288033470,3409855158),h(1501505948,4234509866),h(1607167915,987167468),h(1816402316,1246189591)],d=[];(function(){for(var m=0;m<80;m++)d[m]=h()})();var p=c.SHA512=n.extend({_doReset:function(){this._hash=new l.init([new a.init(1779033703,4089235720),new a.init(3144134277,2227873595),new a.init(1013904242,4271175723),new a.init(2773480762,1595750129),new a.init(1359893119,2917565137),new a.init(2600822924,725511199),new a.init(528734635,4215389547),new a.init(1541459225,327033209)])},_doProcessBlock:function(m,g){for(var y=this._hash.words,b=y[0],P=y[1],T=y[2],I=y[3],C=y[4],E=y[5],O=y[6],_=y[7],x=b.high,v=b.low,D=P.high,w=P.low,F=T.high,H=T.low,z=I.high,V=I.low,W=C.high,L=C.low,k=E.high,N=E.low,U=O.high,B=O.low,G=_.high,Y=_.low,X=x,K=v,J=D,se=w,ce=F,te=H,oe=z,$=V,fe=W,Oe=L,Te=k,ue=N,be=U,j=B,Z=G,ie=Y,de=0;de<80;de++){var me,Se,Re=d[de];if(de<16)Se=Re.high=m[g+de*2]|0,me=Re.low=m[g+de*2+1]|0;else{var Je=d[de-15],Ke=Je.high,Gt=Je.low,Nr=(Ke>>>1|Gt<<31)^(Ke>>>8|Gt<<24)^Ke>>>7,xr=(Gt>>>1|Ke<<31)^(Gt>>>8|Ke<<24)^(Gt>>>7|Ke<<25),vr=d[de-2],_r=vr.high,Ne=vr.low,Vt=(_r>>>19|Ne<<13)^(_r<<3|Ne>>>29)^_r>>>6,Ft=(Ne>>>19|_r<<13)^(Ne<<3|_r>>>29)^(Ne>>>6|_r<<26),ir=d[de-7],Fe=ir.high,tt=ir.low,ye=d[de-16],yt=ye.high,Wt=ye.low;me=xr+tt,Se=Nr+Fe+(me>>>0<xr>>>0?1:0),me=me+Ft,Se=Se+Vt+(me>>>0<Ft>>>0?1:0),me=me+Wt,Se=Se+yt+(me>>>0<Wt>>>0?1:0),Re.high=Se,Re.low=me}var pe=fe&Te^~fe&be,Xe=Oe&ue^~Oe&j,ct=X&J^X&ce^J&ce,Me=K&se^K&te^se&te,st=(X>>>28|K<<4)^(X<<30|K>>>2)^(X<<25|K>>>7),Ot=(K>>>28|X<<4)^(K<<30|X>>>2)^(K<<25|X>>>7),hr=(fe>>>14|Oe<<18)^(fe>>>18|Oe<<14)^(fe<<23|Oe>>>9),Or=(Oe>>>14|fe<<18)^(Oe>>>18|fe<<14)^(Oe<<23|fe>>>9),Xr=u[de],Oi=Xr.high,qi=Xr.low,Ni=ie+Or,Wi=Z+hr+(Ni>>>0<ie>>>0?1:0),Ni=Ni+Xe,Wi=Wi+pe+(Ni>>>0<Xe>>>0?1:0),Ni=Ni+qi,Wi=Wi+Oi+(Ni>>>0<qi>>>0?1:0),Ni=Ni+me,Wi=Wi+Se+(Ni>>>0<me>>>0?1:0),fo=Ot+Me,tl=st+ct+(fo>>>0<Ot>>>0?1:0);Z=be,ie=j,be=Te,j=ue,Te=fe,ue=Oe,Oe=$+Ni|0,fe=oe+Wi+(Oe>>>0<$>>>0?1:0)|0,oe=ce,$=te,ce=J,te=se,J=X,se=K,K=Ni+fo|0,X=Wi+tl+(K>>>0<Ni>>>0?1:0)|0}v=b.low=v+K,b.high=x+X+(v>>>0<K>>>0?1:0),w=P.low=w+se,P.high=D+J+(w>>>0<se>>>0?1:0),H=T.low=H+te,T.high=F+ce+(H>>>0<te>>>0?1:0),V=I.low=V+$,I.high=z+oe+(V>>>0<$>>>0?1:0),L=C.low=L+Oe,C.high=W+fe+(L>>>0<Oe>>>0?1:0),N=E.low=N+ue,E.high=k+Te+(N>>>0<ue>>>0?1:0),B=O.low=B+j,O.high=U+be+(B>>>0<j>>>0?1:0),Y=_.low=Y+ie,_.high=G+Z+(Y>>>0<ie>>>0?1:0)},_doFinalize:function(){var m=this._data,g=m.words,y=this._nDataBytes*8,b=m.sigBytes*8;g[b>>>5]|=128<<24-b%32,g[(b+128>>>10<<5)+30]=Math.floor(y/4294967296),g[(b+128>>>10<<5)+31]=y,m.sigBytes=g.length*4,this._process();var P=this._hash.toX32();return P},clone:function(){var m=n.clone.call(this);return m._hash=this._hash.clone(),m},blockSize:1024/32});r.SHA512=n._createHelper(p),r.HmacSHA512=n._createHmacHelper(p)})(),e.SHA512})}),amt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),ree(),g5e()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.x64,n=i.Word,s=i.WordArray,a=r.algo,l=a.SHA512,c=a.SHA384=l.extend({_doReset:function(){this._hash=new s.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var h=l._doFinalize.call(this);return h.sigBytes-=16,h}});r.SHA384=l._createHelper(c),r.HmacSHA384=l._createHmacHelper(c)})(),e.SHA384})}),lmt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),ree()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.WordArray,a=n.Hasher,l=i.x64,c=l.Word,h=i.algo,u=[],d=[],p=[];(function(){for(var y=1,b=0,P=0;P<24;P++){u[y+5*b]=(P+1)*(P+2)/2%64;var T=b%5,I=(2*y+3*b)%5;y=T,b=I}for(var y=0;y<5;y++)for(var b=0;b<5;b++)d[y+5*b]=b+(2*y+3*b)%5*5;for(var C=1,E=0;E<24;E++){for(var O=0,_=0,x=0;x<7;x++){if(C&1){var v=(1<<x)-1;v<32?_^=1<<v:O^=1<<v-32}C&128?C=C<<1^113:C<<=1}p[E]=c.create(O,_)}})();var m=[];(function(){for(var y=0;y<25;y++)m[y]=c.create()})();var g=h.SHA3=a.extend({cfg:a.cfg.extend({outputLength:512}),_doReset:function(){for(var y=this._state=[],b=0;b<25;b++)y[b]=new c.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(y,b){for(var P=this._state,T=this.blockSize/2,I=0;I<T;I++){var C=y[b+2*I],E=y[b+2*I+1];C=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360,E=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360;var O=P[I];O.high^=E,O.low^=C}for(var _=0;_<24;_++){for(var x=0;x<5;x++){for(var v=0,D=0,w=0;w<5;w++){var O=P[x+5*w];v^=O.high,D^=O.low}var F=m[x];F.high=v,F.low=D}for(var x=0;x<5;x++)for(var H=m[(x+4)%5],z=m[(x+1)%5],V=z.high,W=z.low,v=H.high^(V<<1|W>>>31),D=H.low^(W<<1|V>>>31),w=0;w<5;w++){var O=P[x+5*w];O.high^=v,O.low^=D}for(var L=1;L<25;L++){var v,D,O=P[L],k=O.high,N=O.low,U=u[L];U<32?(v=k<<U|N>>>32-U,D=N<<U|k>>>32-U):(v=N<<U-32|k>>>64-U,D=k<<U-32|N>>>64-U);var B=m[d[L]];B.high=v,B.low=D}var G=m[0],Y=P[0];G.high=Y.high,G.low=Y.low;for(var x=0;x<5;x++)for(var w=0;w<5;w++){var L=x+5*w,O=P[L],X=m[L],K=m[(x+1)%5+5*w],J=m[(x+2)%5+5*w];O.high=X.high^~K.high&J.high,O.low=X.low^~K.low&J.low}var O=P[0],se=p[_];O.high^=se.high,O.low^=se.low}},_doFinalize:function(){var y=this._data,b=y.words,P=this._nDataBytes*8,T=y.sigBytes*8,I=this.blockSize*32;b[T>>>5]|=1<<24-T%32,b[(r.ceil((T+1)/I)*I>>>5)-1]|=128,y.sigBytes=b.length*4,this._process();for(var C=this._state,E=this.cfg.outputLength/8,O=E/8,_=[],x=0;x<O;x++){var v=C[x],D=v.high,w=v.low;D=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,w=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,_.push(w),_.push(D)}return new s.init(_,E)},clone:function(){for(var y=a.clone.call(this),b=y._state=this._state.slice(0),P=0;P<25;P++)b[P]=b[P].clone();return y}});i.SHA3=a._createHelper(g),i.HmacSHA3=a._createHmacHelper(g)})(Math),e.SHA3})}),cmt=Wl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(bc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.WordArray,a=n.Hasher,l=i.algo,c=s.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),h=s.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),u=s.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),d=s.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),p=s.create([0,1518500249,1859775393,2400959708,2840853838]),m=s.create([1352829926,1548603684,1836072691,2053994217,0]),g=l.RIPEMD160=a.extend({_doReset:function(){this._hash=s.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(E,O){for(var _=0;_<16;_++){var x=O+_,v=E[x];E[x]=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360}var D=this._hash.words,w=p.words,F=m.words,H=c.words,z=h.words,V=u.words,W=d.words,L,k,N,U,B,G,Y,X,K,J;G=L=D[0],Y=k=D[1],X=N=D[2],K=U=D[3],J=B=D[4];for(var se,_=0;_<80;_+=1)se=L+E[O+H[_]]|0,_<16?se+=y(k,N,U)+w[0]:_<32?se+=b(k,N,U)+w[1]:_<48?se+=P(k,N,U)+w[2]:_<64?se+=T(k,N,U)+w[3]:se+=I(k,N,U)+w[4],se=se|0,se=C(se,V[_]),se=se+B|0,L=B,B=U,U=C(N,10),N=k,k=se,se=G+E[O+z[_]]|0,_<16?se+=I(Y,X,K)+F[0]:_<32?se+=T(Y,X,K)+F[1]:_<48?se+=P(Y,X,K)+F[2]:_<64?se+=b(Y,X,K)+F[3]:se+=y(Y,X,K)+F[4],se=se|0,se=C(se,W[_]),se=se+J|0,G=J,J=K,K=C(X,10),X=Y,Y=se;se=D[1]+N+K|0,D[1]=D[2]+U+J|0,D[2]=D[3]+B+G|0,D[3]=D[4]+L+Y|0,D[4]=D[0]+k+X|0,D[0]=se},_doFinalize:function(){var E=this._data,O=E.words,_=this._nDataBytes*8,x=E.sigBytes*8;O[x>>>5]|=128<<24-x%32,O[(x+64>>>9<<4)+14]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,E.sigBytes=(O.length+1)*4,this._process();for(var v=this._hash,D=v.words,w=0;w<5;w++){var F=D[w];D[w]=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360}return v},clone:function(){var E=a.clone.call(this);return E._hash=this._hash.clone(),E}});function y(E,O,_){return E^O^_}function b(E,O,_){return E&O|~E&_}function P(E,O,_){return(E|~O)^_}function T(E,O,_){return E&_|O&~_}function I(E,O,_){return E^(O|~_)}function C(E,O){return E<<O|E>>>32-O}i.RIPEMD160=a._createHelper(g),i.HmacRIPEMD160=a._createHmacHelper(g)})(Math),e.RIPEMD160})}),BPe=Wl((o,t)=>{(function(e,r){typeof o=="object"?t.exports=o=r(bc()):typeof define=="function"&&define.amd?define(["./core"],r):r(e.CryptoJS)})(o,function(e){(function(){var r=e,i=r.lib,n=i.Base,s=r.enc,a=s.Utf8,l=r.algo,c=l.HMAC=n.extend({init:function(h,u){h=this._hasher=new h.init,typeof u=="string"&&(u=a.parse(u));var d=h.blockSize,p=d*4;u.sigBytes>p&&(u=h.finalize(u)),u.clamp();for(var m=this._oKey=u.clone(),g=this._iKey=u.clone(),y=m.words,b=g.words,P=0;P<d;P++)y[P]^=1549556828,b[P]^=909522486;m.sigBytes=g.sigBytes=p,this.reset()},reset:function(){var h=this._hasher;h.reset(),h.update(this._iKey)},update:function(h){return this._hasher.update(h),this},finalize:function(h){var u=this._hasher,d=u.finalize(h);u.reset();var p=u.finalize(this._oKey.clone().concat(d));return p}})})()})}),hmt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),kPe(),BPe()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.Base,s=i.WordArray,a=r.algo,l=a.SHA256,c=a.HMAC,h=a.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:l,iterations:25e4}),init:function(u){this.cfg=this.cfg.extend(u)},compute:function(u,d){for(var p=this.cfg,m=c.create(p.hasher,u),g=s.create(),y=s.create([1]),b=g.words,P=y.words,T=p.keySize,I=p.iterations;b.length<T;){var C=m.update(d).finalize(y);m.reset();for(var E=C.words,O=E.length,_=C,x=1;x<I;x++){_=m.finalize(_),m.reset();for(var v=_.words,D=0;D<O;D++)E[D]^=v[D]}g.concat(C),P[0]++}return g.sigBytes=T*4,g}});r.PBKDF2=function(u,d,p){return h.create(p).compute(u,d)}})(),e.PBKDF2})}),bv=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),m5e(),BPe()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.Base,s=i.WordArray,a=r.algo,l=a.MD5,c=a.EvpKDF=n.extend({cfg:n.extend({keySize:128/32,hasher:l,iterations:1}),init:function(h){this.cfg=this.cfg.extend(h)},compute:function(h,u){for(var d,p=this.cfg,m=p.hasher.create(),g=s.create(),y=g.words,b=p.keySize,P=p.iterations;y.length<b;){d&&m.update(d),d=m.update(h).finalize(u),m.reset();for(var T=1;T<P;T++)d=m.finalize(d),m.reset();g.concat(d)}return g.sigBytes=b*4,g}});r.EvpKDF=function(h,u,d){return c.create(d).compute(h,u)}})(),e.EvpKDF})}),ig=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),bv()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],r):r(e.CryptoJS)})(o,function(e){e.lib.Cipher||(function(r){var i=e,n=i.lib,s=n.Base,a=n.WordArray,l=n.BufferedBlockAlgorithm,c=i.enc,h=c.Utf8,u=c.Base64,d=i.algo,p=d.EvpKDF,m=n.Cipher=l.extend({cfg:s.extend(),createEncryptor:function(F,H){return this.create(this._ENC_XFORM_MODE,F,H)},createDecryptor:function(F,H){return this.create(this._DEC_XFORM_MODE,F,H)},init:function(F,H,z){this.cfg=this.cfg.extend(z),this._xformMode=F,this._key=H,this.reset()},reset:function(){l.reset.call(this),this._doReset()},process:function(F){return this._append(F),this._process()},finalize:function(F){F&&this._append(F);var H=this._doFinalize();return H},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:(function(){function F(H){return typeof H=="string"?w:x}return function(H){return{encrypt:function(z,V,W){return F(V).encrypt(H,z,V,W)},decrypt:function(z,V,W){return F(V).decrypt(H,z,V,W)}}}})()}),g=n.StreamCipher=m.extend({_doFinalize:function(){var F=this._process(!0);return F},blockSize:1}),y=i.mode={},b=n.BlockCipherMode=s.extend({createEncryptor:function(F,H){return this.Encryptor.create(F,H)},createDecryptor:function(F,H){return this.Decryptor.create(F,H)},init:function(F,H){this._cipher=F,this._iv=H}}),P=y.CBC=(function(){var F=b.extend();F.Encryptor=F.extend({processBlock:function(z,V){var W=this._cipher,L=W.blockSize;H.call(this,z,V,L),W.encryptBlock(z,V),this._prevBlock=z.slice(V,V+L)}}),F.Decryptor=F.extend({processBlock:function(z,V){var W=this._cipher,L=W.blockSize,k=z.slice(V,V+L);W.decryptBlock(z,V),H.call(this,z,V,L),this._prevBlock=k}});function H(z,V,W){var L,k=this._iv;k?(L=k,this._iv=r):L=this._prevBlock;for(var N=0;N<W;N++)z[V+N]^=L[N]}return F})(),T=i.pad={},I=T.Pkcs7={pad:function(F,H){for(var z=H*4,V=z-F.sigBytes%z,W=V<<24|V<<16|V<<8|V,L=[],k=0;k<V;k+=4)L.push(W);var N=a.create(L,V);F.concat(N)},unpad:function(F){var H=F.words[F.sigBytes-1>>>2]&255;F.sigBytes-=H}},C=n.BlockCipher=m.extend({cfg:m.cfg.extend({mode:P,padding:I}),reset:function(){var F;m.reset.call(this);var H=this.cfg,z=H.iv,V=H.mode;this._xformMode==this._ENC_XFORM_MODE?F=V.createEncryptor:(F=V.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==F?this._mode.init(this,z&&z.words):(this._mode=F.call(V,this,z&&z.words),this._mode.__creator=F)},_doProcessBlock:function(F,H){this._mode.processBlock(F,H)},_doFinalize:function(){var F,H=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(H.pad(this._data,this.blockSize),F=this._process(!0)):(F=this._process(!0),H.unpad(F)),F},blockSize:128/32}),E=n.CipherParams=s.extend({init:function(F){this.mixIn(F)},toString:function(F){return(F||this.formatter).stringify(this)}}),O=i.format={},_=O.OpenSSL={stringify:function(F){var H,z=F.ciphertext,V=F.salt;return V?H=a.create([1398893684,1701076831]).concat(V).concat(z):H=z,H.toString(u)},parse:function(F){var H,z=u.parse(F),V=z.words;return V[0]==1398893684&&V[1]==1701076831&&(H=a.create(V.slice(2,4)),V.splice(0,4),z.sigBytes-=16),E.create({ciphertext:z,salt:H})}},x=n.SerializableCipher=s.extend({cfg:s.extend({format:_}),encrypt:function(F,H,z,V){V=this.cfg.extend(V);var W=F.createEncryptor(z,V),L=W.finalize(H),k=W.cfg;return E.create({ciphertext:L,key:z,iv:k.iv,algorithm:F,mode:k.mode,padding:k.padding,blockSize:F.blockSize,formatter:V.format})},decrypt:function(F,H,z,V){V=this.cfg.extend(V),H=this._parse(H,V.format);var W=F.createDecryptor(z,V).finalize(H.ciphertext);return W},_parse:function(F,H){return typeof F=="string"?H.parse(F,this):F}}),v=i.kdf={},D=v.OpenSSL={execute:function(F,H,z,V,W){if(V||(V=a.random(64/8)),W)var L=p.create({keySize:H+z,hasher:W}).compute(F,V);else var L=p.create({keySize:H+z}).compute(F,V);var k=a.create(L.words.slice(H),z*4);return L.sigBytes=H*4,E.create({key:L,iv:k,salt:V})}},w=n.PasswordBasedCipher=x.extend({cfg:x.cfg.extend({kdf:D}),encrypt:function(F,H,z,V){V=this.cfg.extend(V);var W=V.kdf.execute(z,F.keySize,F.ivSize,V.salt,V.hasher);V.iv=W.iv;var L=x.encrypt.call(this,F,H,W.key,V);return L.mixIn(W),L},decrypt:function(F,H,z,V){V=this.cfg.extend(V),H=this._parse(H,V.format);var W=V.kdf.execute(z,F.keySize,F.ivSize,H.salt,V.hasher);V.iv=W.iv;var L=x.decrypt.call(this,F,H,W.key,V);return L}})})()})}),umt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),ig()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.CFB=(function(){var r=e.lib.BlockCipherMode.extend();r.Encryptor=r.extend({processBlock:function(n,s){var a=this._cipher,l=a.blockSize;i.call(this,n,s,l,a),this._prevBlock=n.slice(s,s+l)}}),r.Decryptor=r.extend({processBlock:function(n,s){var a=this._cipher,l=a.blockSize,c=n.slice(s,s+l);i.call(this,n,s,l,a),this._prevBlock=c}});function i(n,s,a,l){var c,h=this._iv;h?(c=h.slice(0),this._iv=void 0):c=this._prevBlock,l.encryptBlock(c,0);for(var u=0;u<a;u++)n[s+u]^=c[u]}return r})(),e.mode.CFB})}),dmt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),ig()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.CTR=(function(){var r=e.lib.BlockCipherMode.extend(),i=r.Encryptor=r.extend({processBlock:function(n,s){var a=this._cipher,l=a.blockSize,c=this._iv,h=this._counter;c&&(h=this._counter=c.slice(0),this._iv=void 0);var u=h.slice(0);a.encryptBlock(u,0),h[l-1]=h[l-1]+1|0;for(var d=0;d<l;d++)n[s+d]^=u[d]}});return r.Decryptor=i,r})(),e.mode.CTR})}),pmt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),ig()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.CTRGladman=(function(){var r=e.lib.BlockCipherMode.extend();function i(a){if((a>>24&255)===255){var l=a>>16&255,c=a>>8&255,h=a&255;l===255?(l=0,c===255?(c=0,h===255?h=0:++h):++c):++l,a=0,a+=l<<16,a+=c<<8,a+=h}else a+=1<<24;return a}function n(a){return(a[0]=i(a[0]))===0&&(a[1]=i(a[1])),a}var s=r.Encryptor=r.extend({processBlock:function(a,l){var c=this._cipher,h=c.blockSize,u=this._iv,d=this._counter;u&&(d=this._counter=u.slice(0),this._iv=void 0),n(d);var p=d.slice(0);c.encryptBlock(p,0);for(var m=0;m<h;m++)a[l+m]^=p[m]}});return r.Decryptor=s,r})(),e.mode.CTRGladman})}),fmt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),ig()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.OFB=(function(){var r=e.lib.BlockCipherMode.extend(),i=r.Encryptor=r.extend({processBlock:function(n,s){var a=this._cipher,l=a.blockSize,c=this._iv,h=this._keystream;c&&(h=this._keystream=c.slice(0),this._iv=void 0),a.encryptBlock(h,0);for(var u=0;u<l;u++)n[s+u]^=h[u]}});return r.Decryptor=i,r})(),e.mode.OFB})}),mmt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),ig()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.mode.ECB=(function(){var r=e.lib.BlockCipherMode.extend();return r.Encryptor=r.extend({processBlock:function(i,n){this._cipher.encryptBlock(i,n)}}),r.Decryptor=r.extend({processBlock:function(i,n){this._cipher.decryptBlock(i,n)}}),r})(),e.mode.ECB})}),gmt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),ig()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.AnsiX923={pad:function(r,i){var n=r.sigBytes,s=i*4,a=s-n%s,l=n+a-1;r.clamp(),r.words[l>>>2]|=a<<24-l%4*8,r.sigBytes+=a},unpad:function(r){var i=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=i}},e.pad.Ansix923})}),ymt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),ig()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.Iso10126={pad:function(r,i){var n=i*4,s=n-r.sigBytes%n;r.concat(e.lib.WordArray.random(s-1)).concat(e.lib.WordArray.create([s<<24],1))},unpad:function(r){var i=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=i}},e.pad.Iso10126})}),bmt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),ig()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.Iso97971={pad:function(r,i){r.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(r,i)},unpad:function(r){e.pad.ZeroPadding.unpad(r),r.sigBytes--}},e.pad.Iso97971})}),Pmt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),ig()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.ZeroPadding={pad:function(r,i){var n=i*4;r.clamp(),r.sigBytes+=n-(r.sigBytes%n||n)},unpad:function(r){for(var i=r.words,n=r.sigBytes-1,n=r.sigBytes-1;n>=0;n--)if(i[n>>>2]>>>24-n%4*8&255){r.sigBytes=n+1;break}}},e.pad.ZeroPadding})}),Tmt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),ig()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding})}),Imt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),ig()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(r){var i=e,n=i.lib,s=n.CipherParams,a=i.enc,l=a.Hex,c=i.format,h=c.Hex={stringify:function(u){return u.ciphertext.toString(l)},parse:function(u){var d=l.parse(u);return s.create({ciphertext:d})}}})(),e.format.Hex})}),Cmt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),pL(),fL(),bv(),ig()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.BlockCipher,s=r.algo,a=[],l=[],c=[],h=[],u=[],d=[],p=[],m=[],g=[],y=[];(function(){for(var T=[],I=0;I<256;I++)I<128?T[I]=I<<1:T[I]=I<<1^283;for(var C=0,E=0,I=0;I<256;I++){var O=E^E<<1^E<<2^E<<3^E<<4;O=O>>>8^O&255^99,a[C]=O,l[O]=C;var _=T[C],x=T[_],v=T[x],D=T[O]*257^O*16843008;c[C]=D<<24|D>>>8,h[C]=D<<16|D>>>16,u[C]=D<<8|D>>>24,d[C]=D;var D=v*16843009^x*65537^_*257^C*16843008;p[O]=D<<24|D>>>8,m[O]=D<<16|D>>>16,g[O]=D<<8|D>>>24,y[O]=D,C?(C=_^T[T[T[v^_]]],E^=T[T[E]]):C=E=1}})();var b=[0,1,2,4,8,16,32,64,128,27,54],P=s.AES=n.extend({_doReset:function(){var T;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var I=this._keyPriorReset=this._key,C=I.words,E=I.sigBytes/4,O=this._nRounds=E+6,_=(O+1)*4,x=this._keySchedule=[],v=0;v<_;v++)v<E?x[v]=C[v]:(T=x[v-1],v%E?E>6&&v%E==4&&(T=a[T>>>24]<<24|a[T>>>16&255]<<16|a[T>>>8&255]<<8|a[T&255]):(T=T<<8|T>>>24,T=a[T>>>24]<<24|a[T>>>16&255]<<16|a[T>>>8&255]<<8|a[T&255],T^=b[v/E|0]<<24),x[v]=x[v-E]^T);for(var D=this._invKeySchedule=[],w=0;w<_;w++){var v=_-w;if(w%4)var T=x[v];else var T=x[v-4];w<4||v<=4?D[w]=T:D[w]=p[a[T>>>24]]^m[a[T>>>16&255]]^g[a[T>>>8&255]]^y[a[T&255]]}}},encryptBlock:function(T,I){this._doCryptBlock(T,I,this._keySchedule,c,h,u,d,a)},decryptBlock:function(T,I){var C=T[I+1];T[I+1]=T[I+3],T[I+3]=C,this._doCryptBlock(T,I,this._invKeySchedule,p,m,g,y,l);var C=T[I+1];T[I+1]=T[I+3],T[I+3]=C},_doCryptBlock:function(T,I,C,E,O,_,x,v){for(var D=this._nRounds,w=T[I]^C[0],F=T[I+1]^C[1],H=T[I+2]^C[2],z=T[I+3]^C[3],V=4,W=1;W<D;W++){var L=E[w>>>24]^O[F>>>16&255]^_[H>>>8&255]^x[z&255]^C[V++],k=E[F>>>24]^O[H>>>16&255]^_[z>>>8&255]^x[w&255]^C[V++],N=E[H>>>24]^O[z>>>16&255]^_[w>>>8&255]^x[F&255]^C[V++],U=E[z>>>24]^O[w>>>16&255]^_[F>>>8&255]^x[H&255]^C[V++];w=L,F=k,H=N,z=U}var L=(v[w>>>24]<<24|v[F>>>16&255]<<16|v[H>>>8&255]<<8|v[z&255])^C[V++],k=(v[F>>>24]<<24|v[H>>>16&255]<<16|v[z>>>8&255]<<8|v[w&255])^C[V++],N=(v[H>>>24]<<24|v[z>>>16&255]<<16|v[w>>>8&255]<<8|v[F&255])^C[V++],U=(v[z>>>24]<<24|v[w>>>16&255]<<16|v[F>>>8&255]<<8|v[H&255])^C[V++];T[I]=L,T[I+1]=k,T[I+2]=N,T[I+3]=U},keySize:256/32});r.AES=n._createHelper(P)})(),e.AES})}),Smt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),pL(),fL(),bv(),ig()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.WordArray,s=i.BlockCipher,a=r.algo,l=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],c=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],h=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],d=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],p=a.DES=s.extend({_doReset:function(){for(var b=this._key,P=b.words,T=[],I=0;I<56;I++){var C=l[I]-1;T[I]=P[C>>>5]>>>31-C%32&1}for(var E=this._subKeys=[],O=0;O<16;O++){for(var _=E[O]=[],x=h[O],I=0;I<24;I++)_[I/6|0]|=T[(c[I]-1+x)%28]<<31-I%6,_[4+(I/6|0)]|=T[28+(c[I+24]-1+x)%28]<<31-I%6;_[0]=_[0]<<1|_[0]>>>31;for(var I=1;I<7;I++)_[I]=_[I]>>>(I-1)*4+3;_[7]=_[7]<<5|_[7]>>>27}for(var v=this._invSubKeys=[],I=0;I<16;I++)v[I]=E[15-I]},encryptBlock:function(b,P){this._doCryptBlock(b,P,this._subKeys)},decryptBlock:function(b,P){this._doCryptBlock(b,P,this._invSubKeys)},_doCryptBlock:function(b,P,T){this._lBlock=b[P],this._rBlock=b[P+1],m.call(this,4,252645135),m.call(this,16,65535),g.call(this,2,858993459),g.call(this,8,16711935),m.call(this,1,1431655765);for(var I=0;I<16;I++){for(var C=T[I],E=this._lBlock,O=this._rBlock,_=0,x=0;x<8;x++)_|=u[x][((O^C[x])&d[x])>>>0];this._lBlock=O,this._rBlock=E^_}var v=this._lBlock;this._lBlock=this._rBlock,this._rBlock=v,m.call(this,1,1431655765),g.call(this,8,16711935),g.call(this,2,858993459),m.call(this,16,65535),m.call(this,4,252645135),b[P]=this._lBlock,b[P+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function m(b,P){var T=(this._lBlock>>>b^this._rBlock)&P;this._rBlock^=T,this._lBlock^=T<<b}function g(b,P){var T=(this._rBlock>>>b^this._lBlock)&P;this._lBlock^=T,this._rBlock^=T<<b}r.DES=s._createHelper(p);var y=a.TripleDES=s.extend({_doReset:function(){var b=this._key,P=b.words;if(P.length!==2&&P.length!==4&&P.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var T=P.slice(0,2),I=P.length<4?P.slice(0,2):P.slice(2,4),C=P.length<6?P.slice(0,2):P.slice(4,6);this._des1=p.createEncryptor(n.create(T)),this._des2=p.createEncryptor(n.create(I)),this._des3=p.createEncryptor(n.create(C))},encryptBlock:function(b,P){this._des1.encryptBlock(b,P),this._des2.decryptBlock(b,P),this._des3.encryptBlock(b,P)},decryptBlock:function(b,P){this._des3.decryptBlock(b,P),this._des2.encryptBlock(b,P),this._des1.decryptBlock(b,P)},keySize:192/32,ivSize:64/32,blockSize:64/32});r.TripleDES=s._createHelper(y)})(),e.TripleDES})}),Emt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),pL(),fL(),bv(),ig()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.StreamCipher,s=r.algo,a=s.RC4=n.extend({_doReset:function(){for(var h=this._key,u=h.words,d=h.sigBytes,p=this._S=[],m=0;m<256;m++)p[m]=m;for(var m=0,g=0;m<256;m++){var y=m%d,b=u[y>>>2]>>>24-y%4*8&255;g=(g+p[m]+b)%256;var P=p[m];p[m]=p[g],p[g]=P}this._i=this._j=0},_doProcessBlock:function(h,u){h[u]^=l.call(this)},keySize:256/32,ivSize:0});function l(){for(var h=this._S,u=this._i,d=this._j,p=0,m=0;m<4;m++){u=(u+1)%256,d=(d+h[u])%256;var g=h[u];h[u]=h[d],h[d]=g,p|=h[(h[u]+h[d])%256]<<24-m*8}return this._i=u,this._j=d,p}r.RC4=n._createHelper(a);var c=s.RC4Drop=a.extend({cfg:a.cfg.extend({drop:192}),_doReset:function(){a._doReset.call(this);for(var h=this.cfg.drop;h>0;h--)l.call(this)}});r.RC4Drop=n._createHelper(c)})(),e.RC4})}),Omt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),pL(),fL(),bv(),ig()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.StreamCipher,s=r.algo,a=[],l=[],c=[],h=s.Rabbit=n.extend({_doReset:function(){for(var d=this._key.words,p=this.cfg.iv,m=0;m<4;m++)d[m]=(d[m]<<8|d[m]>>>24)&16711935|(d[m]<<24|d[m]>>>8)&4278255360;var g=this._X=[d[0],d[3]<<16|d[2]>>>16,d[1],d[0]<<16|d[3]>>>16,d[2],d[1]<<16|d[0]>>>16,d[3],d[2]<<16|d[1]>>>16],y=this._C=[d[2]<<16|d[2]>>>16,d[0]&4294901760|d[1]&65535,d[3]<<16|d[3]>>>16,d[1]&4294901760|d[2]&65535,d[0]<<16|d[0]>>>16,d[2]&4294901760|d[3]&65535,d[1]<<16|d[1]>>>16,d[3]&4294901760|d[0]&65535];this._b=0;for(var m=0;m<4;m++)u.call(this);for(var m=0;m<8;m++)y[m]^=g[m+4&7];if(p){var b=p.words,P=b[0],T=b[1],I=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360,C=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360,E=I>>>16|C&4294901760,O=C<<16|I&65535;y[0]^=I,y[1]^=E,y[2]^=C,y[3]^=O,y[4]^=I,y[5]^=E,y[6]^=C,y[7]^=O;for(var m=0;m<4;m++)u.call(this)}},_doProcessBlock:function(d,p){var m=this._X;u.call(this),a[0]=m[0]^m[5]>>>16^m[3]<<16,a[1]=m[2]^m[7]>>>16^m[5]<<16,a[2]=m[4]^m[1]>>>16^m[7]<<16,a[3]=m[6]^m[3]>>>16^m[1]<<16;for(var g=0;g<4;g++)a[g]=(a[g]<<8|a[g]>>>24)&16711935|(a[g]<<24|a[g]>>>8)&4278255360,d[p+g]^=a[g]},blockSize:128/32,ivSize:64/32});function u(){for(var d=this._X,p=this._C,m=0;m<8;m++)l[m]=p[m];p[0]=p[0]+1295307597+this._b|0,p[1]=p[1]+3545052371+(p[0]>>>0<l[0]>>>0?1:0)|0,p[2]=p[2]+886263092+(p[1]>>>0<l[1]>>>0?1:0)|0,p[3]=p[3]+1295307597+(p[2]>>>0<l[2]>>>0?1:0)|0,p[4]=p[4]+3545052371+(p[3]>>>0<l[3]>>>0?1:0)|0,p[5]=p[5]+886263092+(p[4]>>>0<l[4]>>>0?1:0)|0,p[6]=p[6]+1295307597+(p[5]>>>0<l[5]>>>0?1:0)|0,p[7]=p[7]+3545052371+(p[6]>>>0<l[6]>>>0?1:0)|0,this._b=p[7]>>>0<l[7]>>>0?1:0;for(var m=0;m<8;m++){var g=d[m]+p[m],y=g&65535,b=g>>>16,P=((y*y>>>17)+y*b>>>15)+b*b,T=((g&4294901760)*g|0)+((g&65535)*g|0);c[m]=P^T}d[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,d[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,d[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,d[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,d[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,d[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,d[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,d[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.Rabbit=n._createHelper(h)})(),e.Rabbit})}),Amt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),pL(),fL(),bv(),ig()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.StreamCipher,s=r.algo,a=[],l=[],c=[],h=s.RabbitLegacy=n.extend({_doReset:function(){var d=this._key.words,p=this.cfg.iv,m=this._X=[d[0],d[3]<<16|d[2]>>>16,d[1],d[0]<<16|d[3]>>>16,d[2],d[1]<<16|d[0]>>>16,d[3],d[2]<<16|d[1]>>>16],g=this._C=[d[2]<<16|d[2]>>>16,d[0]&4294901760|d[1]&65535,d[3]<<16|d[3]>>>16,d[1]&4294901760|d[2]&65535,d[0]<<16|d[0]>>>16,d[2]&4294901760|d[3]&65535,d[1]<<16|d[1]>>>16,d[3]&4294901760|d[0]&65535];this._b=0;for(var y=0;y<4;y++)u.call(this);for(var y=0;y<8;y++)g[y]^=m[y+4&7];if(p){var b=p.words,P=b[0],T=b[1],I=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360,C=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360,E=I>>>16|C&4294901760,O=C<<16|I&65535;g[0]^=I,g[1]^=E,g[2]^=C,g[3]^=O,g[4]^=I,g[5]^=E,g[6]^=C,g[7]^=O;for(var y=0;y<4;y++)u.call(this)}},_doProcessBlock:function(d,p){var m=this._X;u.call(this),a[0]=m[0]^m[5]>>>16^m[3]<<16,a[1]=m[2]^m[7]>>>16^m[5]<<16,a[2]=m[4]^m[1]>>>16^m[7]<<16,a[3]=m[6]^m[3]>>>16^m[1]<<16;for(var g=0;g<4;g++)a[g]=(a[g]<<8|a[g]>>>24)&16711935|(a[g]<<24|a[g]>>>8)&4278255360,d[p+g]^=a[g]},blockSize:128/32,ivSize:64/32});function u(){for(var d=this._X,p=this._C,m=0;m<8;m++)l[m]=p[m];p[0]=p[0]+1295307597+this._b|0,p[1]=p[1]+3545052371+(p[0]>>>0<l[0]>>>0?1:0)|0,p[2]=p[2]+886263092+(p[1]>>>0<l[1]>>>0?1:0)|0,p[3]=p[3]+1295307597+(p[2]>>>0<l[2]>>>0?1:0)|0,p[4]=p[4]+3545052371+(p[3]>>>0<l[3]>>>0?1:0)|0,p[5]=p[5]+886263092+(p[4]>>>0<l[4]>>>0?1:0)|0,p[6]=p[6]+1295307597+(p[5]>>>0<l[5]>>>0?1:0)|0,p[7]=p[7]+3545052371+(p[6]>>>0<l[6]>>>0?1:0)|0,this._b=p[7]>>>0<l[7]>>>0?1:0;for(var m=0;m<8;m++){var g=d[m]+p[m],y=g&65535,b=g>>>16,P=((y*y>>>17)+y*b>>>15)+b*b,T=((g&4294901760)*g|0)+((g&65535)*g|0);c[m]=P^T}d[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,d[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,d[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,d[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,d[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,d[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,d[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,d[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.RabbitLegacy=n._createHelper(h)})(),e.RabbitLegacy})}),_mt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),pL(),fL(),bv(),ig()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],r):r(e.CryptoJS)})(o,function(e){return(function(){var r=e,i=r.lib,n=i.BlockCipher,s=r.algo;let a=16,l=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],c=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var h={pbox:[],sbox:[]};function u(y,b){let P=b>>24&255,T=b>>16&255,I=b>>8&255,C=b&255,E=y.sbox[0][P]+y.sbox[1][T];return E=E^y.sbox[2][I],E=E+y.sbox[3][C],E}function d(y,b,P){let T=b,I=P,C;for(let E=0;E<a;++E)T=T^y.pbox[E],I=u(y,T)^I,C=T,T=I,I=C;return C=T,T=I,I=C,I=I^y.pbox[a],T=T^y.pbox[a+1],{left:T,right:I}}function p(y,b,P){let T=b,I=P,C;for(let E=a+1;E>1;--E)T=T^y.pbox[E],I=u(y,T)^I,C=T,T=I,I=C;return C=T,T=I,I=C,I=I^y.pbox[1],T=T^y.pbox[0],{left:T,right:I}}function m(y,b,P){for(let O=0;O<4;O++){y.sbox[O]=[];for(let _=0;_<256;_++)y.sbox[O][_]=c[O][_]}let T=0;for(let O=0;O<a+2;O++)y.pbox[O]=l[O]^b[T],T++,T>=P&&(T=0);let I=0,C=0,E=0;for(let O=0;O<a+2;O+=2)E=d(y,I,C),I=E.left,C=E.right,y.pbox[O]=I,y.pbox[O+1]=C;for(let O=0;O<4;O++)for(let _=0;_<256;_+=2)E=d(y,I,C),I=E.left,C=E.right,y.sbox[O][_]=I,y.sbox[O][_+1]=C;return!0}var g=s.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var y=this._keyPriorReset=this._key,b=y.words,P=y.sigBytes/4;m(h,b,P)}},encryptBlock:function(y,b){var P=d(h,y[b],y[b+1]);y[b]=P.left,y[b+1]=P.right},decryptBlock:function(y,b){var P=p(h,y[b],y[b+1]);y[b]=P.left,y[b+1]=P.right},blockSize:64/32,keySize:128/32,ivSize:64/32});r.Blowfish=n._createHelper(g)})(),e.Blowfish})}),vmt=Wl((o,t)=>{(function(e,r,i){typeof o=="object"?t.exports=o=r(bc(),ree(),imt(),nmt(),pL(),omt(),fL(),m5e(),kPe(),smt(),g5e(),amt(),lmt(),cmt(),BPe(),hmt(),bv(),ig(),umt(),dmt(),pmt(),fmt(),mmt(),gmt(),ymt(),bmt(),Pmt(),Tmt(),Imt(),Cmt(),Smt(),Emt(),Omt(),Amt(),_mt()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./lib-typedarrays","./enc-utf16","./enc-base64","./enc-base64url","./md5","./sha1","./sha256","./sha224","./sha512","./sha384","./sha3","./ripemd160","./hmac","./pbkdf2","./evpkdf","./cipher-core","./mode-cfb","./mode-ctr","./mode-ctr-gladman","./mode-ofb","./mode-ecb","./pad-ansix923","./pad-iso10126","./pad-iso97971","./pad-zeropadding","./pad-nopadding","./format-hex","./aes","./tripledes","./rc4","./rabbit","./rabbit-legacy","./blowfish"],r):e.CryptoJS=r(e.CryptoJS)})(o,function(e){return e})}),xmt=(o=>(o.Device="Device",o.Symbol="Symbol",o.Footprint="Footprint",o.OBJ="OBJ",o.ModelID="3D Model",o.ModelName="3D Model Title",o.OriginModelName="Origin 3D Model Title",o.ModelTransform="3D Model Transform",o.OriginFootprint="Origin Footprint",o))(xmt||{}),kW=(o=>(o.DOCHEAD="DOCHEAD",o.EDIT_HEAD="EDIT_HEAD",o.SCH="SCH",o.SCH_PAGE="SCH_PAGE",o.PCB="PCB",o.PANEL="PANEL",o.PANEL_LIB="PANEL_LIB",o.SYMBOL="SYMBOL",o.FOOTPRINT="FOOTPRINT",o.DEVICE="DEVICE",o.BLOB="BLOB",o.INSTANCE="INSTANCE",o.CONFIG="CONFIG",o.BOARD="BOARD",o.FONT="FONT",o.VARIANT="VARIANT",o.COMPONENT_GROUP="COMPONENT_GROUP",o.COMPONENT_GROUP_DATA="COMPONENT_GROUP_DATA",o.SIMULATION="SIMULATION",o))(kW||{}),Rmt=(o=>(o.META="META",o.META_SORT="META_SORT",o.META_CREATE="META_CREATE",o.META_MODIFY="META_MODIFY",o.FONT="FONT",o.BLOB="BLOB",o.MAX_NUM="MAX_NUM",o.INSTANCE_ATTR="INSTANCE_ATTR",o.DELETE_DOC="DELETE_DOC",o.META_Z_INDEX="META_Z_INDEX",o.VARIANT_GROUPED="VARIANT_GROUPED",o.GROUP_INDEX="GROUP_INDEX",o.GROUP_DATA="GROUP_DATA",o.RULE_TEMPLATE="RULE_TEMPLATE",o.RULE="RULE",o.RULE_SELECTOR="RULE_SELECTOR",o.ELE_PLACEHOLDER="ELE_PLACEHOLDER",o.META_PLACEHOLDER="META_PLACEHOLDER",o))(Rmt||{});function BW(o,t,e){return o.slice(t,e)}function NQ(o,t,e){let r=o.length,i=0;for(;i<r;){let n=o.indexOf(`|
`,i);if(n<0){if(e)return o.substring(i);n=r}let s=BW(o,i,n);try{if(s){let a=s.indexOf("||"),l=a>-1,c=l?BW(s,0,a):s,h=l?BW(s,a+2):"";if(t(c,h,s,l?i+a+2:i)===!1){s=null;break}s=null}}catch(a){console.error(a)}i=n+2}o=null}var Dmt=["SYMBOL","FOOTPRINT","BLOB","FONT","PANEL_LIB","DEVICE","BOARD","INSTANCE","CONFIG","VARIANT","COMPONENT_GROUP","COMPONENT_GROUP_DATA"];function Obe(o,t){return Dmt.includes(t)?t:o}var wmt=class{parseFull(o,t,e){let r=t,i=e,n,s=null;NQ(o,(a,l,c)=>{let h=JSON.parse(a);if(h.type==="EDIT_HEAD")s=JSON.parse(l),this.onEditHead&&this.onEditHead(s);else if(h.type==="DOCHEAD"){let u=JSON.parse(l);i=u.docType,r=u.uuid,n=u.client,u.ticket=h.ticket,this.onDocHead(u,s,c)}else this.onLine(h.id,h.ticket,l,h.type,h.client||n,i,r,h.firstTicket,h.pend,s,h.num,c)}),this.onEnd(),o=null}flowParseFull(o={}){let{cache:t,chunkLength:e=100*1024*1024,idsData:r,history:i}=o,n="",s=null,a,l=null,c=!0,h="",u=0,d=!1,p={},m=t?{}:void 0,g=new Set,y=T=>{m[T]===void 0&&(m[T]=-1),t(T,++m[T],p[T].data.join(`|
`)),p[T].data.length=0,p[T].size=0,p[T].data.push(p[T].head),p[T].size+=p[T].head.length},b=T=>{if(g.add(n),!t)return;let I=Obe(n,s);p[I].data.push(T),p[I].size+=(p[I].size?2:0)+T.length,p[I].size+T.length>e&&y(I)},P=(T,I)=>NQ(T,(C,E,O,_)=>{var x,v,D,w,F,H,z,V;let W=JSON.parse(C);if(W.type==="EDIT_HEAD")l=JSON.parse(E),(x=this.onEditHead)==null||x.call(this,l),(v=o.onEditHead)==null||v.call(o,l),d=!0;else if(W.type==="DOCHEAD"){let L=JSON.parse(E);s=L.docType,n=L.uuid,a=L.client,L.ticket=W.ticket,d||(l={uuid:L.uuid,username:(D=L==null?void 0:L.user)==null?void 0:D.username,nickname:(w=L==null?void 0:L.user)==null?void 0:w.nickname,updateTime:L==null?void 0:L.updateTime},(F=o.onEditHead)==null||F.call(o,l),d=!0),this.onDocHead(L,l,O);let k=Obe(n,s);t&&!p[k]&&(p[k]={size:0,data:[],head:""}),t&&(p[k].head=O),b(O)}else{let L=W.num,k=W.client||a;if(r){let N=(V=(z=(H=r.ids)==null?void 0:H[n])==null?void 0:z[k])==null?void 0:V[W.id];if(!N||N[0]!==W.ticket)return;L=N[1],r.size-=1,delete r.ids[n][k][W.id]}if(i){let N=Obe(n,s);t&&(i.dNum=(m==null?void 0:m[N])===void 0?0:(m==null?void 0:m[N])+1),i.start=t?p[N].size+2+C.length+2:u+_}this.onLine(W.id,W.ticket,E,W.type,k,s,n,W.firstTicket,W.pend,l||(i==null?void 0:i.editHead),L,O,i),b(O)}},I);return{start:()=>{c=!0},end:()=>{if(h&&P(h,!1),t)for(let T in p)p[T].size&&p[T].data.length>1&&y(T),p[T]=null;c=!1,h="",n="",n=null,a="",l=null,this.onEnd()},update:T=>{if(!c)throw new Error("\u66F4\u65B0\u524D\u672A\u8C03\u7528 start \u65B9\u6CD5");let I=P(h+T,!0);u=u+h.length+T.length-((I==null?void 0:I.length)||0),h="",I&&(h=I)},docMap:m,getDocIds:()=>Array.from(g)}}parseLine(o,t,e){let r=o.indexOf("||"),i=r!==-1,n=i?BW(o,0,r):o,s=i?BW(o,r+2):"",a=JSON.parse(n);this.onLine(a.id,a.ticket,s,a.type,a.client,e,t,a.firstTicket,a.pend,void 0,a.num,o),o=null}onEditHead(o){}},Abe=new Uint8Array(8);function KT(){crypto.getRandomValues(Abe);let o="";for(let t=0;t<Abe.length;t++)o+=Abe[t].toString(16).padStart(2,"0");return o}function sL(o,t,e,r,i,n,s){let a={docType:o,client:t,uuid:e};return(r||r===0)&&(a.updateTime=r),(i||a.updateTime||a.updateTime===0)&&(a.version=i||String(r)),n&&(a.user=n),`${JSON.stringify({type:"DOCHEAD",ticket:s})}||${JSON.stringify(a)}`}function lb(o,t,e,r,i,n,s,a){let l={type:o,ticket:t,id:e};return n!==void 0&&(l.firstTicket=n),s!==void 0&&(l.pend=s),a!==void 0&&(l.num=a),i&&(l.client=i),`${JSON.stringify(l)}||${r}`}var y5e=class extends wmt{constructor(o){super(),this.unique=KT(),this.maxTicket=0,this.isPendChange=!0,this.isLocalChange=!0,this.cbArr=[],this.tempLocalIds={},this.docMaxTicket={},this.client=o||KT()}onLine(o,t,e,r,i,n,s,a,l,c,h){this.remoteChange(t,i,s,o,e,r,n,void 0,a,l,c,void 0,void 0,h)}getUnique(){return this.unique}setUnique(o){this.unique=o}setDocMaxTicket(o,t,e){e||(!this.docMaxTicket[o]||this.docMaxTicket[o]<t)&&(this.docMaxTicket[o]=t)}getDocMaxTicket(o){var t;return(t=this.docMaxTicket[o])!=null?t:0}onDocHead(o,t){}onEnd(){}setIsPendChange(o){this.isPendChange=o}getIsPendChange(){return this.isPendChange}getMaxTicket(){return this.maxTicket}setMaxTicket(o,t){o&&(t||this.maxTicket<o)&&(this.maxTicket=o)}setIsLocalChange(o){this.isLocalChange=o}getIsLocalChange(){return this.isLocalChange}revoke(o,t,e,r,i,n,s,a,l,c,h){var u;if(!((u=this.tempLocalIds[o])!=null&&u[t]))return h?h(t,i,e,s,`${r}-1`,o,n,void 0,void 0,!0,c):this.cbArr.forEach(d=>d(o,t,e,s,`${r}-1`,i,void 0,n,void 0,void 0,void 0,c)),!0}getRandomUuid(){return KT()}getClient(){return this.client}onChange(o){this.cbArr.push(o)}localChange(o,t,e,r,i,n){let s=this.maxTicket+1;return this.tempLocalIds[o]||(this.tempLocalIds[o]={}),this.tempLocalIds[o][t]=[this.getClient(),s],this.remoteChange(s,this.client,o,t,e,r,i,!0,void 0,!0,void 0,this.unique,void 0,n),s}remoteChange(o,t,e,r,i,n,s,a,l,c,h,u,d,p){var m;this.setMaxTicket(o);let g=u===this.unique,y=a||g,b=(!y||y&&this.isLocalChange)&&(!d||d&&this.isPendChange),P=(m=this.tempLocalIds[e])==null?void 0:m[r];!a&&g?P?(b=!1,P[0]===t&&P[1]===o&&delete this.tempLocalIds[e][r]):b=!0:!a&&P&&(P[1]>o||P[1]===o&&P[0]>t?b=!1:delete this.tempLocalIds[e][r]),this.setDocMaxTicket(e,o,c),b&&this.cbArr.forEach(T=>T(e,r,i,n,t,o,l,c,void 0,d,u,p))}},Lmt=class{constructor(o){this.item=o,this.parent=null,this.left=null,this.right=null,this.height=1}getParent(){return this.parent}getLeft(){return this.left}getRight(){return this.right}getHeight(){return this.height}setLeft(o){if(this.left!==null)throw new Error("insert exists left is not permitted");if(o!==null){if(o.parent!==null)throw new Error("insert left with node has parent is not permitted");this.left=o,o.parent=this,this.updateHeight()}}setRight(o){if(this.right!==null)throw new Error("insert exists right is not permitted");if(o!==null){if(o.parent!==null)throw new Error("insert right with node has parent is not permitted");this.right=o,o.parent=this,this.updateHeight()}}removeLeft(){if(this.left===null)return null;{let o=this.left;return o.parent=null,this.left=null,this.updateHeight(),o}}removeRight(){if(this.right===null)return null;{let o=this.right;return o.parent=null,this.right=null,this.updateHeight(),o}}rotateRight(o){let t=this.removeLeft();if(this.setLeft(t.removeRight()),this.parent){let e=this.parent;e.getLeft()===this?(e.removeLeft(),e.setLeft(t)):(e.removeRight(),e.setRight(t)),t.setRight(this)}else t.setRight(this),o(t)}rotateLeft(o){let t=this.removeRight();if(this.setRight(t.removeLeft()),this.parent){let e=this.parent;e.getLeft()===this?(e.removeLeft(),e.setLeft(t)):(e.removeRight(),e.setRight(t)),t.setLeft(this)}else t.setLeft(this),o(t)}updateHeight(){var o,t;let e=this;for(;e!==null;)e.height=Math.max(((o=e.left)==null?void 0:o.height)||0,((t=e.right)==null?void 0:t.height)||0)+1,e=e.parent}},Mmt=class{constructor(o){this.comparator=o,this.root=null,this.minNode=null,this.maxNode=null,this.size=0}balance(o){var t,e;let r=((t=o.getLeft())==null?void 0:t.getHeight())||0,i=((e=o.getRight())==null?void 0:e.getHeight())||0,n=o.getParent();r>i?r-i>1?(o.rotateRight(s=>this.root=s),this.verify()):n!==null?n.getRight()===o&&(o.rotateRight(s=>this.root=s),this.verify()):(o.rotateRight(s=>this.root=s),this.verify()):i>r&&(i-r>1?(o.rotateLeft(s=>this.root=s),this.verify()):n!==null?n.getLeft()===o&&(o.rotateLeft(s=>this.root=s),this.verify()):(o.rotateLeft(s=>this.root=s),this.verify())),n&&this.balance(n)}forwardTraverse(o){let t=new Array(10),e=this.minNode;for(;e;)switch(t.pop()||2){case 1:e.getLeft()!==null?(t.push(2),t.push(1),e=e.getLeft()):t.push(2);break;case 2:if(!o(e.item))return;e.getRight()!==null?(t.push(3),t.push(1),e=e.getRight()):t.push(3);break;case 3:e=e.getParent();break;default:throw new Error("invalid status")}}backwardTraverse(o){let t=new Array(10),e=this.maxNode;for(;e;)switch(t.pop()||2){case 1:e.getRight()!==null?(t.push(2),t.push(1),e=e.getRight()):t.push(2);break;case 2:if(!o(e.item))return;e.getLeft()!==null?(t.push(3),t.push(1),e=e.getLeft()):t.push(3);break;case 3:e=e.getParent();break;default:throw new Error("invalid status")}}display(o=this.root,t=new Array,e=0){let r="| ".repeat(e);return t.push(r+`\u25CF(${o.item})
`),o.getLeft()?this.display(o.getLeft(),t,e+1):t.push(r+`| \u2609
`),o.getRight()?this.display(o.getRight(),t,e+1):t.push(r+`| \u2609
`),t}getHeight(){var o;return((o=this.root)==null?void 0:o.getHeight())||0}getSize(){return this.size}updateMinMax(o){this.minNode?this.comparator(o.item,this.minNode.item)<0&&(this.minNode=o):this.minNode=o,this.maxNode?this.comparator(o.item,this.maxNode.item)>0&&(this.maxNode=o):this.maxNode=o}insert(o){let t=new Lmt(o);if(this.root===null)return this.root=t,this.size++,this.updateMinMax(t),!0;{let e=this.root;for(;;){let r=this.comparator(o,e.item);if(r<0){if(e.getLeft()===null)return e.setLeft(t),this.size++,this.updateMinMax(t),this.verify(),this.balance(e),!0;e=e.getLeft()}else if(r>0){if(e.getRight()===null)return e.setRight(t),this.size++,this.updateMinMax(t),this.verify(),this.balance(e),!0;e=e.getRight()}else return!1}}}verify(){}remove(o){let t=this.root;for(this.verify();;){if(t===null)return!1;let e=this.comparator(o,t.item);if(e<0)t=t.getLeft();else if(e>0)t=t.getRight();else return this.minNode===t&&(t.getRight()?this.minNode=this.findMinChild(t.getRight()):this.minNode=t.getParent()),this.maxNode===t&&(t.getLeft()?this.maxNode=this.findMaxChild(t.getLeft()):this.maxNode=t.getParent()),this.removeNode(t),this.size--,this.verify(),!0}}removeNode(o){var t,e;let r=o.getParent();if(r===null)o.getLeft()===null&&o.getRight()===null?(this.root=null,this.minNode=null,this.maxNode=null):((((t=o.getLeft())==null?void 0:t.getHeight())||0)>(((e=o.getRight())==null?void 0:e.getHeight())||0)?(o.rotateRight(i=>this.root=i),this.verify()):(o.rotateLeft(i=>this.root=i),this.verify()),this.removeNode(o));else if(r.getLeft()===o){r.removeLeft();let i=this.combineNodes(o.removeLeft(),o.removeRight());r.setLeft(i),this.verify(),this.balance(r)}else{r.removeRight();let i=this.combineNodes(o.removeLeft(),o.removeRight());r.setRight(i),this.verify(),this.balance(r)}}combineNodes(o,t){if(o&&t)if(o.getHeight()>t.getHeight()){let e=this.findMaxChild(o);if(e){let r=e.getParent();return r.removeRight(),r.setRight(e.removeLeft()),e.setLeft(o),e.setRight(t),e}else return o.setRight(t),o}else{let e=this.findMinChild(t);if(e){let r=e.getParent();return r.removeLeft(),r.setLeft(e.removeRight()),e.setLeft(o),e.setRight(t),e}else return t.setLeft(o),t}else return o||t||null}findMinChild(o){let t=o;for(;;){if(t.getLeft()===null)return t!==o?t:null;t=t.getLeft()}}findMaxChild(o){let t=o;for(;;){if(t.getRight()===null)return t!==o?t:null;t=t.getRight()}}};var FPe=/^[a-zA-Z]+(\d+)$/;function UW(o){let t=o.match(FPe);return t?Number(t[1]):null}function Al(o){if(!o||typeof o!="string")return o;let t=o.match(/[a-zA-Z]+\d+/g);return t&&t.length===2&&t.join("")===o?t.join("-"):o}function Qm(o){return o&&typeof o=="number"&&!isNaN(o)?-o:o}function Nmt(o,t){let e=[];for(let r=0;r<o.length;r+=2){let i={x:o[r],y:t?Qm(o[r+1]):o[r+1]};e.push(i)}return e}function ab(o,t){return JSON.stringify([t,o])}function ov(o){try{let t=JSON.parse(o);return typeof t=="string"?o:t[1]}catch{return o}}function _be(o,t,e){let r=o[t];return r!==void 0||(r=e(t),o[t]=r),r}var kmt=(o=>(o.META="META",o.CANVAS="CANVAS",o.GROUP="GROUP",o.POLY="POLY",o.STRING="STRING",o.AUX_LINE="AUXLINE",o.DIMENSION="DIMENSION",o.ELE_PLACEHOLDER="ELE_PLACEHOLDER",o))(kmt||{}),Bmt=(o=>(o.META="META",o.CANVAS="CANVAS",o.LAYER="LAYER",o.LAYER_PHYS="LAYER_PHYS",o.ACTIVE_LAYER="ACTIVE_LAYER",o.PARTITION="PARTITION",o.NET="NET",o.PRIMITIVE="PRIMITIVE",o.GROUP="GROUP",o.SILK_OPTS="SILK_OPTS",o.PREFERENCE="PREFERENCE",o.VIA="VIA",o.PAD="PAD",o.LINE="LINE",o.ARC="ARC",o.OBJ="OBJ",o.EQLEN_GRP="EQLEN_GRP",o.POLY="POLY",o.FILL="FILL",o.LAYER_FILL="LAYER_FILL",o.REGION="REGION",o.POUR="POUR",o.POURED="POURED",o.IMAGE="IMAGE",o.TEARDROP="TEARDROP",o.FPC_FILL="FPC_FILL",o.SHELL="SHELL",o.CREASE="CREASE",o.SHELLCUT="SHELLCUT",o.SHELL_ENTITY="SHELL_ENTITY",o.BOSS="BOSS",o.STRING="STRING",o.ATTR="ATTR",o.DIMENSION="DIMENSION",o.COMPONENT="COMPONENT",o.PAD_NET="PAD_NET",o.RULE_TEMPLATE="RULE_TEMPLATE",o.RULE="RULE",o.RULE_SELECTOR="RULE_SELECTOR",o.PANELIZE="PANELIZE",o.BOARD="BOARD",o.X_SIGNALS_GROUP="X_SIGNAL_GROUP",o.X_SIGNALS="X_SIGNALS",o.ELE_PLACEHOLDER="ELE_PLACEHOLDER",o))(Bmt||{}),Fmt=(o=>(o.META="META",o.CANVAS="CANVAS",o.GROUP="GROUP",o.ATTR="ATTR",o.LINE="LINE",o.WIRE="WIRE",o.BUS="BUS",o.TEXT="TEXT",o.POLY="POLY",o.CIRCLE="CIRCLE",o.ARC="ARC",o.BUSENTRY="BUSENTRY",o.RECT="RECT",o.MASK_REGION="MASK_REGION",o.PIN="PIN",o.OBJ="OBJ",o.COMPONENT="COMPONENT",o.PART="PART",o.ELLIPSE="ELLIPSE",o.BEZIER="BEZIER",o.TABLE="TABLE",o.ELE_PLACEHOLDER="ELE_PLACEHOLDER",o.NG_SETTING="NG_SETTING",o))(Fmt||{}),Vmt=["PARTITION","VIA","PAD","LINE","ARC","OBJ","POLY","FILL","REGION","POUR","POURED","IMAGE","TEARDROP","FPC_FILL","SHELL","CREASE","SHELLCUT","SHELL_ENTITY","BOSS","STRING","ATTR","DIMENSION","COMPONENT"],_Wt=ik(JW()),Gmt=(o=>(o.SOLID="SOLID",o.SHORT_DASH="SHORT_DASH",o.DOT="DOT",o.DOT_DASH="DOT_DASH",o))(Gmt||{}),Umt=(o=>(o.PRINT="PRINT",o.COVER="COVER",o.PRINT_AND_COVER="PRINT&COVER",o))(Umt||{}),Hmt=(o=>(o.LEFT="LEFT",o.CENTER="CENTER",o.RIGHT="RIGHT",o))(Hmt||{}),Wmt=(o=>(o.TOP="TOP",o.MIDDLE="MIDDLE",o.BOTTOM="BOTTOM",o))(Wmt||{}),zmt=(o=>(o.LEFT_BOTTOM="LEFT_BOTTOM",o.CENTER_BOTTOM="CENTER_BOTTOM",o.RIGHT_BOTTOM="RIGHT_BOTTOM",o.LEFT_MIDDLE="LEFT_MIDDLE",o.CENTER_MIDDLE="CENTER_MIDDLE",o.RIGHT_MIDDLE="RIGHT_MIDDLE",o.LEFT_TOP="LEFT_TOP",o.CENTER_TOP="CENTER_TOP",o.RIGHT_TOP="RIGHT_TOP",o))(zmt||{}),Ymt=(o=>(o.NONE="NONE",o.SOLID="SOLID",o.GRID="GRID",o.HORIZONTAL_LINE="HORIZONTAL_LINE",o.VERTICAL_LINE="VERTICAL_LINE",o.RHOMBIC="RHOMBIC",o.LEFT_SLASH_LINE="LEFT_SLASH_LINE",o.RIGHT_SLASH_LINE="RIGHT_SLASH_LINE",o))(Ymt||{}),jmt=(o=>(o.NONE="NONE",o.CLOCK="CLOCK",o.INVERTED="INVERTED",o.INVERTED_CLOCK="INVERTED_CLOCK",o))(jmt||{}),Xmt=(o=>(o.NONE="NONE",o.GRID="GRID",o.OUTLETS="OUTLETS",o))(Xmt||{}),qmt=(o=>(o.NONE="NONE",o.PUSH="PUSH",o.SURROUND="SURROUND",o.OBSTRUCT="OBSTRUCT",o.SURROUND_AND_PUSH="SURROUND&PUSH",o))(qmt||{}),$mt=(o=>(o.ELLIPSE="ELLIPSE",o.RECT="RECT",o.OVAL="OVAL",o.POLYGON="POLYGON",o))($mt||{}),Kmt=(o=>(o.ROUND="ROUND",o.RECT="RECT",o.SLOT="SLOT",o))(Kmt||{}),Zmt=(o=>(o.SOLID="SOLID",o.GRID_LINE="GRID_LINE",o.HORIZONTAL_LINE="HORIZONTAL_LINE",o.VERTICAL_LINE="VERTICAL_LINE",o))(Zmt||{}),Jmt=(o=>(o.ALL="ALL",o.PAD="PAD",o.VIA="VIA",o))(Jmt||{}),Qmt=(o=>(o.NONE="NONE",o.SINGLE="SINGLE",o.ALL="ALL",o))(Qmt||{}),egt=(o=>(o.OPTIMIZA_OPEN="OPTIMIZA_OPEN",o.OPTIMIZA_NONE="OPTIMIZA_NONE",o))(egt||{}),tgt=(o=>(o.OPTIMIZA_STRONG="OPTIMIZA_STRONG",o.OPTIMIZA_WEAK="OPTIMIZA_WEAK",o.OPTIMIZA_NONE="OPTIMIZA_NONE",o))(tgt||{}),rgt=(o=>(o.L45="L45",o.L90="L90",o.L="L",o.R45="R45",o.R90="R90",o.R="R",o))(rgt||{}),igt=(o=>(o.NORMAL="NORMAL",o.BLIND="BLIND",o.SUTURE="SUTURE",o))(igt||{}),ngt=(o=>(o.NORMAL="NORMAL",o.TEST="TEST",o.MARKER="MARKER",o))(ngt||{}),ogt=(o=>(o.DIVERGENCE="DIVERGENCE",o.DIRECT="DIRECT",o.NON_CONNECT="NON_CONNECT",o))(ogt||{}),sgt=(o=>(o.DOT="DOT",o.CENTER="CENT",o))(sgt||{}),agt=(o=>(o.NORMAL="NORMAL",o.BOARD_OUTLINE="BOARD_OUTLINE",o))(agt||{}),lgt=(o=>(o.SOLID="SOLID",o.GRID="GRID",o.PLANE="PLANE",o))(lgt||{}),cgt=(o=>(o.PROHIBIT="PROHIBIT",o.CONSTRAINT="CONSTRAINT",o))(cgt||{}),hgt=(o=>(o.COMPONENT="COMPONENT",o.VIA="VIA",o.TRACK="TRACK",o.FILL="FILL",o.COPPER="COPPER",o.PLANE="PLANE",o))(hgt||{}),ugt=(o=>(o.PI="Polyimide",o.FR4="FR4",o.STEEL_SHEET="Stainless Steel",o.M3_DOUBLE_SIDED_TAPE="3M Tape",o.EMI_SHIELDING_FILM="EMI Shielding Film",o))(ugt||{}),dgt=(o=>(o.PUSH_COVER="DRAWER",o.UPPER_LOWER_SHELLS="T&B",o))(dgt||{}),pgt=(o=>(o.X_AXIS_POSITIVE="X_AXIS_POSITIVE",o.X_AXIS_NEGATIVE="X_AXIS_NEGATIVE",o.Y_AXIS_POSITIVE="Y_AXIS_POSITIVE",o.Y_AXIS_NEGATIVE="Y_AXIS_NEGATIVE",o))(pgt||{}),fgt=(o=>(o.SLOT="SLOT",o.ENTITY="ENTITY",o))(fgt||{}),mgt=(o=>(o.AUTO="AUTO",o.UPPER_SHELLS="UPPER_SHELLS",o.LOWER_SHELLS="LOWER_SHELLS",o))(mgt||{}),ggt=(o=>(o.OUTLINE="OUTLINE",o.SCREW_PILLAR="SCREW_PILLAR",o.ENTITY="ENTITY",o))(ggt||{}),ygt=(o=>(o.M2="M2",o.M3="M3",o.M4="M4",o.M5="M5",o.M6="M6",o))(ygt||{}),bgt=(o=>(o.LENGTH="LENGTH",o.RADIUS="RADIUS",o.ANGLE="ANGLE",o))(bgt||{}),Pgt=(o=>(o.MIL="mil",o.INCH="inch",o.CM="cm",o.MM="mm",o))(Pgt||{}),Tgt=(o=>(o.SAFE="SAFE",o.OTHER="OTHER",o.TRACK="TRACK",o.BLIND="BLIND",o.RADIUS="RADIUS",o.PLANE="PLANE",o.COPPER="COPPER",o.PASTE="PASTE",o.SOLDER="SOLDER",o.DIFFER_ENTAIL="DIFFER_ENTAIL",o.NET_LENGTH="NET_LENGTH",o.AUTO_ROUTER="AUTO_ROUTER",o.NET_LENGTH_TOLERANCE="NET_LENGTH_TOLERANCE",o))(Tgt||{}),Igt=(o=>(o.NORMAL="NORMAL",o.DEFAULT="DEFAULT",o))(Igt||{}),Cgt=(o=>(o.ALL="ALL",o.LAYERED="LAYERED",o))(Cgt||{}),Sgt=(o=>(o.DIRECT="DIRECT",o.NON_CONNECT="NON_CONNECT",o))(Sgt||{}),Egt=(o=>(o.FORTY_FIVE="L45",o.NINETY="L90",o.NINETY_ARC="A90",o))(Egt||{}),Ogt=(o=>(o.LESS="LESS",o.MID="MID",o.MORE="MORE",o))(Ogt||{}),Agt=(o=>(o.SPEED_FIRST="SPEED_FIRST",o.COMPLETION_FIRST="COMPLETION_FIRST",o))(Agt||{}),_gt=(o=>(o.DesignRule="DesignRule",o.Board="Board",o.SlotRegion="SlotRegion",o.ProhibitedRegion="ProhibitedRegion",o.ConstraintRegion="ConstraintRegion",o.Component="Component",o.Track="Track",o.TestPoint="TestPoint",o.Pad="Pad",o.Via="Via",o.SutureHole="SutureHole",o.Text="Text",o.ColorfulImage="ColorfulImage",o.Image="Image",o.FPCStiffener="FPCStiffener",o.Dimension="Dimension",o.CopperRegion="CopperRegion",o.FillRegion="Fill Region",o.Line="Line",o.Teardrop="Teardrop",o.D3Shell="D3Shell",o))(_gt||{}),vgt=ik(vmt());function sPe(o,t,e,r,i,n,s,a){return JSON.stringify([o||"",t||"",e,r,i?1:0,n?1:0,s?1:0,a])}function xgt(o){let t=JSON.parse(o);return{text:t[0],fontFamily:t[1],fontSize:t[2],thickness:t[3],bold:!!t[4],italic:!!t[5],reverse:!!t[6],expansion:t[7]}}function iee(o){return vgt.default.SHA256(o).toString()}function Rgt(o,t){let e=[],r=[],i={};NQ(o,(c,h)=>{let u=JSON.parse(c);if(u.type==="DOCHEAD"||u.type==="META"||u.type==="META_CREATE"||u.type==="META_MODIFY"||u.type==="ELE_PLACEHOLDER"||u.type==="ELE_PLACEHOLDER"||u.type==="ELE_PLACEHOLDER")return;let{id:d}=u;i[d]=Object.assign(u,{data:h})});let n={};NQ(t,(c,h="")=>{let u=JSON.parse(c);if(u.type==="BLOB")e.push(c+"||"+h);else if(u.type==="FONT")r.push(c+"||"+h);else{if(u.type==="DOCHEAD"||u.type==="META_MODIFY")return;let{id:d}=u;n[d]=Object.assign(u,{data:h})}});let s={},a={},l={};for(let c in i)if(!n.hasOwnProperty(c))a[c]=i[c];else{let{ticket:h}=i[c],{type:u,data:d,client:p}=n[c];s[c]={type:u,ticket:h,data:d,client:p},delete n[c]}for(let c in n){let{type:h,data:u,ticket:d,client:p}=n[c];l[c]={type:h,data:u,ticket:d,client:p}}return{delete:a,cover:s,add:l,blobs:e,fonts:r}}function vbe(o,t,e){let{docType:r,uuid:i,client:n,updateTime:s,version:a,user:l,ticket:c}=e,h=[sL(r,n,i,s,a,l,c)],{delete:u,cover:d,add:p,blobs:m,fonts:g}=Rgt(o,t);for(let y in u){let{ticket:b,type:P,client:T}=u[y];h.push(lb(P,b+1,y,"",T))}for(let y in d){let{type:b,ticket:P,data:T,client:I}=d[y];h.push(lb(b,P+1,y,T,I))}for(let y in p){let{type:b,ticket:P,data:T,client:I}=p[y];h.push(lb(b,P,y,T,I))}return m.length&&(h.push(sL("BLOB",n,"BLOB",s,a,l,c)),h=h.concat(m)),g.length&&(h.push(sL("FONT",n,"FONT",s,a,l,c)),h=h.concat(g)),h.join(`|
`)}function Dgt(o,t){return o.ticket===t.ticket?o.client===t.client?o.id===t.id?0:o.id<t.id?-1:1:o.client<t.client?-1:1:o.ticket<t.ticket?-1:1}var wgt=class{constructor(o=1){this.startNum=o,this.orderLists={},this.idOrderLists={},this.cbArr=new Array,this.maxNum={}}orderChange(o){this.cbArr.push(o)}setOrderNum(o,t,e,r,i=1){if(i<1)throw new Error("step must be greater than 0");let n=_be(this.orderLists,t,()=>new Mmt(Dgt)),s=_be(this.maxNum,t,()=>this.startNum-1),a=_be(this.idOrderLists,t,()=>new Map),l=a.get(o);if(l){if(l.ticket<=e)return;n.remove(l),s-=l.step}let c={id:o,ticket:e,num:0,client:r,step:i};a.set(o,c),n.insert(c),s+=i;let h=s,u=0;n.backwardTraverse(d=>(u++,d.num=h,this.cbArr.forEach(p=>p(d.id,t,d.num)),h-=d.step,d!==c)),this.maxNum[t]=s,u>1e4&&(console.log("------------------ notify --------",c,"height: ",n.getHeight(),"total: ",n.getSize(),"notifies: ",u),console.log("------------------ all --------"))}getOrderNum(o,t){var e,r,i,n;return(n=(i=(r=(e=this.idOrderLists)==null?void 0:e[t])==null?void 0:r.get)==null?void 0:i.call(r,o))==null?void 0:n.num}getMaxNum(o){var t;return((t=this.orderLists[o])==null?void 0:t.getSize())||0}clearNum(){for(let o in this.idOrderLists)this.idOrderLists[o].clear(),delete this.idOrderLists[o];for(let o in this.orderLists)delete this.orderLists[o]}},Lgt=class{constructor(o,t=1,e=[]){this.consistencyManager=o,this.startNum=t,this.needOrderType=e,this.initIng=!1,this.allOrderNum={},this.maxNum={},this.consistencyManager.onChange((r,i,n,s,a,l,c,h,u,d,p,m)=>{try{if(this.calculation)if(s==="ELE_PLACEHOLDER"){let g=n?JSON.parse(n):null;g&&this.calculation.setOrderNum(i,g.dataType,c!=null?c:l,a,g.max)}else this.calculation.setOrderNum(i,s,c!=null?c:l,a);this.onParseLine(i,s,n?JSON.parse(n):null,a,l,h,m)}catch(g){console.error(g)}})}initCalculation(){this.calculation=new wgt(this.startNum)}setIsInit(o){this.initIng=o}setNeedNum(o){this.needNum=o}setOrderNum(o,t,e){this.needNum&&this.needOrderType&&this.needOrderType.includes(e)&&t!==void 0&&(this.allOrderNum[o]=t,this.setMaxNum(e,t))}deleteOrderNum(o){delete this.allOrderNum[o]}getOrderNum(o){return this.allOrderNum[o]}setMaxNum(o,t,e){(e||this.maxNum[o]===void 0||this.maxNum[o]<t)&&(this.maxNum[o]=t)}getMaxNum(o){return this.maxNum[o]===void 0&&(this.maxNum[o]=this.startNum-1),++this.maxNum[o]}};function b5e(o){switch(o=String(o),o){case"1":return"SAFE";case"2":return"OTHER";case"3":return"TRACK";case"4":return"BLIND";case"5":return"RADIUS";case"6":return"PLANE";case"7":return"COPPER";case"8":return"PASTE";case"9":return"SOLDER";case"10":return"DIFFER_ENTAIL";case"11":return"NET_LENGTH";case"12":return"AUTO_ROUTER";case"13":return"NET_LENGTH_TOLERANCE"}return o}function BN(o){if(!o)return{};let t=["1","2","3","4","5","6","7","8","9","10","11","12","13"];for(let e of t)if(o.hasOwnProperty(e)){let r=o[e];delete o[e],o[b5e(e)]=r}return o}var n6e=class{constructor(){this.init=!1,this.defaultSafeData=null,this.defaultCopperSpace=null,this.defaultInnerSpace=null,this.copperChangeMap=new Map,this.innerChangeMap=new Map}addDefaultSafeSpaceData(o){this.init=!0,this.defaultSafeData=o}addDefaultCopperSpace(o,t){this.defaultCopperSpace={netClearance:o,boardClearance:t}}addDefaultInnerSpace(o,t){this.defaultInnerSpace={netClearance:o,boardClearance:t}}getNewDefaultData(o,t){if(o&&this.defaultSafeData==null||!o&&this.defaultInnerSpace==null)return null;let e=o?this.copperChangeMap.get(t):this.innerChangeMap.get(t);if(e==null)return null;let{netClearance:r,boardClearance:i}=e,n=this.defaultSafeData.safeSpacing[0].content,s=new Array(n.length);for(let a=0;a<n.length;a++)s[a]=Array.from(n[a]);return this.updateSafeData(s,r,i),s}fixSafeData(o){if(this.defaultCopperSpace!=null)for(let t of o.safeSpacing)this.updateSafeData(t.content,this.defaultCopperSpace.netClearance,this.defaultCopperSpace.netClearance)}updateSafeData(o,t,e){for(let r=0;r<o.length;r++){let i=o[r];for(let n=0;n<i.length;n++)r==7?n==11||n==8?i[n]=e:i[n]=t:n==7&&(r==11||r==8?i[n]=e:i[n]=t)}}addCopper2SafeChangeMap(o,t,e,r,i){this.copperChangeMap.set(o,{name:t,isDefault:e,netClearance:r,boardClearance:i})}addInner2SafeChangeMap(o,t,e,r,i){this.innerChangeMap.set(o,{name:t,isDefault:e,netClearance:r,boardClearance:i})}getSafeName4Copper(o){var t;return(t=this.copperChangeMap.get(o))==null?void 0:t.name}getSafeName4Plane(o){var t;return(t=this.innerChangeMap.get(o))==null?void 0:t.name}getDefaultCopper(){for(let[,o]of this.copperChangeMap)if(o.isDefault)return o.name;return null}getDefaultPlane(){for(let[,o]of this.innerChangeMap)if(o.isDefault)return o.name;return null}};function o6e(o,t){let e=o,r={TWO_LAYERS_BOARD:"JLCPCB Capability(Two Layers Board)",SINGLE_LAYER_BOARD:"JLCPCB Capability(Single Layer Board)",MULTIPLE_LAYERS_BOARD:"JLCPCB Capability(Multiple Layers Board)",HIGH_FREQUENCY_BOARD:"JLCPCB Capability(High Frequency Board)",ALUMINUM_SUBSTRATE_BOARD:"JLCPCB Capability(Aluminum Substrate Board)",COPPER_SUBSTRATE_BOARD:"JLCPCB Capability(Copper Substrate Board)"};if(e.length==8){Object.values(r).includes(t)&&(e[4][0]=11.811,e[5][4]=11.811),e.splice(1,0,e[1].slice(0));for(let n=2;n<e.length;n++)e[n].splice(1,0,e[n][1]);e.push([].concat(e[1][0],e.slice(1).map(n=>n[1])))}e[1].push(e[1][e[1].length-1]),e.splice(3,0,[...e[1]]),e.splice(4,0,[...e[2]]),e[1].pop();for(let n=5;n<e.length;n++)e[n].splice(3,0,e[n][1]),e[n].splice(4,0,e[n][2]);e[3][3]=e[1][1],e[4][3]=e[2][1],e[4][4]=e[2][2];let i=6;e.splice(7,0,new Array(7).fill(i));for(let n=7;n<e.length;n++)e[n].splice(7,0,i);return e}function Mgt(o,t){let e=o[0],r=o[1],i=[],n="ALL";if(r instanceof Array){let s=o6e(r,t);i.push({layerId:1,isOpen:!0,content:s})}else{for(let s in r){let a=r[s],l=o6e(a,t);i.push({layerId:+s,isOpen:!0,content:l})}Object.keys(r).length>1&&(n="LAYERED")}return{unit:e,isForAll:n,safeSpacing:i}}function Ngt(o){let t=o[0],e=o[1],r=o[2];isNaN(r)&&(r=0);let i=o[3];return isNaN(i)&&(i=11.8),{unit:t,deviceClearance:e,thru2SmdClearance:r,holeClearance:i}}function kgt(o){let t=o[0],e=o[1],r=!0,i=[];if(e instanceof Object)for(let n in e){let s=e[n];i.push({layerId:+n,stroMin:s[0],stroDef:s[1],stroMax:s[2]})}else i.push({layerId:1,stroMin:o[1],stroDef:o[2],stroMax:o[3]});return{unit:t,track:{isOpen:r,content:i}}}function Bgt(o){return{unit:o[0],netLenMin:o[1],netLenMax:o[2]}}function Fgt(o){return{unit:o[0],netLengthTolerance:o[1]}}function Vgt(o){let t=o[0],e=o[1],r=!0,i=[],n=[],s=0;if(e instanceof Object)for(let a in e){let l=e[a],{stroke:c,spacing:h,lenTolerMax:u}=l;i.push({layerId:+a,stroMin:c[0],stroDef:c[1],stroMax:c[2]}),n.push({layerId:+a,spacMin:h[0],spacDef:h[1]}),s=u}else i.push({layerId:1,stroMin:o[1],stroDef:o[2],stroMax:o[3]}),n.push({layerId:1,spacMin:o[4],spacDef:o[5]}),s=o[7];return{unit:t,stroWidth:{isOpen:r,content:i},spacing:{isOpen:r,content:n},differPairLenTolerMax:s}}function Ggt(o){let t=new Array;for(let e of o){let r=+e[1],i=+e[2];isNaN(r)||r<=0||isNaN(i)||i<=0||r===i||r===1&&i===2||r===2&&i===1||t.push({name:e[0],staLayerId:r,endLayerId:i,viaSizeRule:e[3]})}return{blinds:{content:t}}}function Ugt(o){return{unit:o[0],minRadius:o[1],defRadius:o[2],maxRadius:o[3],minInner:o[4],defInner:o[5],maxInner:o[6]}}function Hgt(o){let t=[{layerId:1,connType:$N(o[7]!==void 0?o[7]:o[3]),spoWidth:o[8]!==void 0?o[8]:o[4],spoSpac:o[9]!==void 0?o[9]:o[5],spoAng:o[10]?o[10]:o[6]}];return{unit:o[0],mulPad:{isOpen:!0,content:t}}}function Wgt(o){let t=[{layerId:1,connType:$N(o[3]),spoWidth:o[4],spoSpac:o[5],spoAng:o[6]}],e=[{layerId:1,connType:Number(o[7])?"NON_CONNECT":"DIRECT"}],r=[{layerId:1,connType:$N(o[8]!==void 0?o[8]:o[3]),spoWidth:o[9]!==void 0?o[9]:o[4],spoSpac:o[10]!==void 0?o[10]:o[5],spoAng:o[11]?o[11]:o[6]}];return{unit:o[0],sglPad:{isOpen:!0,content:t},mulPad:{isOpen:!0,content:r},track:{isOpen:!0,content:e}}}function zgt(o){return{unit:o[0],padTopExpan:o[1],padBotExpan:o[2],testPointTopExpan:o[3]?o[3]:-1e3,testPointBotExpan:o[4]?o[4]:-1e3}}function Ygt(o){return{unit:o[0],padTopExpan:o[1],padBotExpan:o[2],viaTopExpan:o[3],viaBotExpan:o[4],testPointTopExpan:o[5]?o[5]:2,testPointBotExpan:o[6]?o[6]:2}}function jgt(o){function t(i){switch(i=i&&Number(i),i){case 0:return"L45";case 1:return"L90";case 2:return"A90";default:return"L45"}}function e(i){switch(i=i&&Number(i),i){case 0:return"LESS";case 1:return"MID";case 2:return"MORE";default:return"LESS"}}function r(i){switch(i=i&&Number(i),i){case 0:return"SPEED_FIRST";case 1:return"COMPLETION_FIRST";default:return"COMPLETION_FIRST"}}return{routingCorner:t(o[0]),isKeep:!!o[1],viaQuantity:e(o[2]),routingEffectPriority:r(o[3]),layers:o[5],ignoreNets:o[6]}}function $N(o){switch(o=o&&Number(o),o){case 0:return"DIVERGENCE";case 1:return"DIRECT";case 2:return"NON_CONNECT";default:return null}}function Xgt(o,t){let e=t;switch(o){case"SAFE":{let r=t;if(r.isForAll=r.isForAll?"LAYERED":"ALL",r.safeSpacing)for(let i of r.safeSpacing)i.isOpen=!!i.isOpen;e=r;break}case"OTHER":break;case"TRACK":{let r=t;r!=null&&r.track&&(r.track.isOpen=!!r.track.isOpen),e=r;break}case"NET_LENGTH":break;case"NET_LENGTH_TOLERANCE":break;case"DIFFER_ENTAIL":{let r=t;r!=null&&r.stroWidth&&(r.stroWidth.isOpen=!!r.stroWidth.isOpen),r!=null&&r.spacing&&(r.spacing.isOpen=!!r.spacing.isOpen),e=r;break}case"BLIND":break;case"RADIUS":break;case"PLANE":{let r=t;if(r!=null&&r.mulPad&&(r.mulPad.isOpen=!!r.mulPad.isOpen),r.mulPad&&r.mulPad.content)for(let i of r.mulPad.content)i.connType=$N(i.connType);e=r;break}case"COPPER":{let r=t;if(r!=null&&r.sglPad&&(r.sglPad.isOpen=!!r.sglPad.isOpen),r!=null&&r.mulPad&&(r.mulPad.isOpen=!!r.mulPad.isOpen),r!=null&&r.track&&(r.track.isOpen=!!r.track.isOpen),r.track&&r.track.content&&(r.track.content=r.track.content.map(i=>(i.connType=Number(i.connType)?"NON_CONNECT":"DIRECT",i))),r.sglPad&&r.sglPad.content)for(let i of r.sglPad.content)i.connType=$N(i.connType);if(r.mulPad&&r.mulPad.content)for(let i of r.mulPad.content)i.connType=$N(i.connType);e=r;break}case"PASTE":break;case"SOLDER":break;case"AUTO_ROUTER":break}return e}function qgt(o,t,e,r,i,n){if(!(r instanceof Array))return Xgt(o,r);let s,a=!1;switch(e&&(e==="NORMAL"?a=!1:e==="DEFAULT"&&(a=!0)),o){case"SAFE":{s=Mgt(r,n),a&&i.addDefaultSafeSpaceData(s);break}case"OTHER":{s=Ngt(r);break}case"TRACK":{s=kgt(r);break}case"NET_LENGTH":{s=Bgt(r);break}case"NET_LENGTH_TOLERANCE":{s=Fgt(r);break}case"DIFFER_ENTAIL":{s=Vgt(r);break}case"BLIND":{s=Ggt(r);break}case"RADIUS":{s=Ugt(r);break}case"PLANE":{let l=r[1],c=r[2];a&&i.addDefaultInnerSpace(l,c),i.addInner2SafeChangeMap(t,"Plane_"+t,a,l,c),s=Hgt(r);break}case"COPPER":{let l=r[1],c=r[2];a&&i.addDefaultCopperSpace(l,c),i.addCopper2SafeChangeMap(t,"Copper_"+t,a,l,c),s=Wgt(r);break}case"PASTE":{s=zgt(r);break}case"SOLDER":{s=Ygt(r);break}case"AUTO_ROUTER":{s=jgt(r);break}}return s}function $gt(o,t,e,r){if(!r.init)return null;function i(n,s){let a=n?"Copper_":"Plane_",l=["RULE"];l[1]="SAFE",l[2]=a+t,l[3]=0;let c=s.getNewDefaultData(n,t);return c==null?null:(l[4]={unit:s.defaultSafeData.unit,isForAll:"ALL",safeSpacing:[{layerId:1,isOpen:!0,content:c}]},l)}switch(o){case"SAFE":return r.fixSafeData(e),null;case"PLANE":return i(!1,r);case"COPPER":return i(!0,r);default:return null}}function Kgt(o,t,e,r){if(!r.init)return{ruleKeyValue:e};let i=o[0],n,s;if(t==4){if(i==="NET_CLASS"||i==="NET"){for(let a in e)String(a)==="COPPER"&&(n={COPPER:r.getSafeName4Copper(e[a])}),String(a)==="PLANE"&&(s={PLANE:r.getSafeName4Plane(e[a])});o[1]==""?(n!=null&&n.COPPER||(n={COPPER:"default"}),s!=null&&s.PLANE||(s={PLANE:"default"})):(n!=null&&n.COPPER||(n={COPPER:r.getDefaultCopper()}),s!=null&&s.PLANE||(s={PLANE:r.getDefaultPlane()}))}}else for(let a in e){if(String(a)==="COPPER"){let l=e[a],c=r.getSafeName4Copper(l);if(c==null&&l=="default"&&(c=r.getDefaultCopper()),c==null)continue;n={COPPER:c}}if(String(a)==="PLANE"){let l=e[a],c=r.getSafeName4Plane(l);if(c==null&&l=="default"&&(c=r.getDefaultPlane()),c==null)continue;s={PLANE:c}}}return{ruleKeyValue:e,copperRuleValue:n,innerPlaneRuleValue:s}}function P5e(o,t){let e=o.length,r=0;for(;r<e;){let i=o.indexOf(`
`,r);i<0&&(i=e);let n=o.substring(r,i);try{if(t(n)===!1)break}catch(s){console.error(s)}r=i+1}}function Zgt(o){let t={};return P5e(o,e=>{if(e.startsWith('["PAD"')){let r=JSON.parse(e);t[r[5]]||(t[r[5]]=[]),t[r[5]].push(r[1])}}),t}var VPe=class{parseFull(o){P5e(o,t=>this.onParseLine(JSON.parse(t))),this.onParseEnd()}},Jgt=class extends VPe{constructor(o={},t={},e=[],r=[],i=!1){super(),this.deviceName=o,this.footprintName=t,this.footprints=e,this.devices=r,this.footprintIsConnectDevice=i,this.fontCache=[],this.poured={},this.curPartition="",this.eQLenData={},this.eQLenSort=1,this.cache={},this.components={},this.errorIds={},this.dimension={},this.connects={},this.specialColors={},this.reuseBlock={},this.panelize={data:[],stamp:{h:null,v:null},size:{h:null,v:null}},this.layerPhys=0,this.fac=new n6e,this.rules=[],this.ruleSelectors=[],this.ruleTemplateName="",this.layerFill={},this.idsSet=new Set,this.oldId={},this.cachePadNet={},this.creaseIds=[],this.stringId={},this.substrateLayer=new Set,this.layerPhysCache=[],this.randomUuid=0,this.padNumId={},this.componentPadNum={}}getOldId(o){var t;return(t=this.oldId[o])!=null?t:o}handConnect(){for(let o of this.creaseIds)if(this.connects[o])for(let t of this.connects[o])this.connects[t]?this.connects[t].push(o):this.connects[t]=[o]}getConnect(o){return this.connects[o]||[]}transRuleType(o){return b5e(o)}transRuleStatus(o){switch(o=o&&Number(o),o){case 0:return"NORMAL";case 1:return"DEFAULT";default:return"NORMAL"}}transGridType(o){switch(o=o&&Number(o),o){case 0:return"NONE";case 1:return"GRID";case 2:return"OUTLETS";default:return"NONE"}}transLayerStatus(o){o=o&&Number(o);let t=!1,e=!1,r=!1;return o!=null&&!isNaN(o)?(o>=4&&(r=!0,o-=4),o>=2&&(e=!0,o-=2),o===1&&(t=!0)):t=!0,{use:t,show:e,locked:r}}transRoutingMode(o){switch(o=o&&Number(o),o){case 0:return"NONE";case 1:return"PUSH";case 2:return"SURROUND";case 3:return"OBSTRUCT";case 4:return"SURROUND&PUSH";default:return"NONE"}}transPadDef(o){switch(o==null?void 0:o[0]){case"ELLIPSE":return{padType:"ELLIPSE",width:o[1],height:o[2]};case"RECT":return{padType:"RECT",width:o[1],height:o[2],radius:o[3]};case"OVAL":return{padType:"OVAL",width:o[1],height:o[2]};case"POLYGON":case"POLY":return{padType:"POLYGON",path:o[1]};default:return null}}transHoleDef(o){return o?{holeType:o[0],width:o[1],height:o[2]}:null}transPourDef(o){function t(e){switch(e=e&&Number(e),e){case 0:return"GRID_LINE";case 1:return"HORIZONTAL_LINE";case 2:return"VERTICAL_LINE";default:return"GRID_LINE"}}switch(o==null?void 0:o[0]){case"SOLID":return{pourType:"SOLID",fineness:o[1]};case"LINE":return{pourType:t(o[1]),angle:o[2],strokeWidth:o[3],strokeSpacing:o[4]};default:return null}}transUnusedPadRange(o){switch(o=o&&Number(o),o){case 1:return"ALL";case 2:return"PAD";case 3:return"VIA";default:return"VIA"}}transPathOptimization(o){switch(o=o&&Number(o),o){case 0:return"SINGLE";case 1:return"ALL";case 2:return"NONE";default:return"SINGLE"}}transViaType(o){switch(o=o&&Number(o),o){case 0:return"NORMAL";case 1:return"SUTURE";default:return"NORMAL"}}transPadFuncType(o){switch(o=o&&Number(o),o){case 0:return"NORMAL";case 1:return"TEST";case 2:return"MARKER";default:return"NORMAL"}}transPadConnect(o){switch(o=o&&Number(o),o){case 0:return"DIVERGENCE";case 1:return"DIRECT";case 2:return"NON_CONNECT";default:return null}}transFillStyle(o){switch(o=o&&Number(o),o){case 0:return"SOLID";case 1:return"GRID";case 2:return"PLANE";default:return null}}transProhibitType(o){let t=new Set;if(!o)return[];for(let e of o)switch(e=e&&Number(e),e){case 1:t.add("TRACK"),t.add("FILL");break;case 2:t.add("COMPONENT");break;case 3:t.add("VIA");break;case 4:t.add("COPPER"),t.add("PLANE");break;case 5:t.add("TRACK");break;case 6:t.add("FILL");break;case 7:t.add("COPPER");break;case 8:t.add("PLANE");break}return Array.from(t)}transPushCoverDir(o){switch(o=o&&Number(o),o){case 1:return"X_AXIS_POSITIVE";case 2:return"X_AXIS_NEGATIVE";case 4:return"Y_AXIS_POSITIVE";case 8:return"Y_AXIS_NEGATIVE";default:return"X_AXIS_POSITIVE"}}transEntityBelong(o){switch(o=o&&Number(o),o){case 0:return"AUTO";case 1:return"UPPER_SHELLS";case 2:return"LOWER_SHELLS";default:return"AUTO"}}transSlotOption(o){o=o&&Number(o);let t=o;if(!t||t<4)return["OUTLINE","SCREW_PILLAR","ENTITY"];let e=[];return t>=16&&(e.push("ENTITY"),t-=16),t>=8&&(e.push("SCREW_PILLAR"),t-=8),t>=4&&(e.push("OUTLINE"),t-=4),e}transAlignType(o){switch(o=o&&Number(o),o){case 1:return"LEFT_TOP";case 4:return"CENTER_TOP";case 7:return"RIGHT_TOP";case 2:return"LEFT_MIDDLE";case 5:return"CENTER_MIDDLE";case 8:return"RIGHT_MIDDLE";case 3:return"LEFT_BOTTOM";case 6:return"CENTER_BOTTOM";case 9:return"RIGHT_BOTTOM";default:return"LEFT_BOTTOM"}}onParseLine(o){var t;let e=o[0];switch(e){case"DOCTYPE":this.parseDocType(o);break;case"HEAD":this.parseHead(o);break;case"CANVAS":this.parseCanvas(o);break;case"LAYER":this.parseLayer(o);break;case"LAYER_PHYS":this.layerPhysCache.push(o);break;case"ACTIVE_LAYER":this.parseActiveLayer(o);break;case"NET":this.parseNet(o);break;case"PRIMITIVE":this.parsePrimitive(o);break;case"GROUP":this.parseGroup(o);break;case"SILK_OPTS":this.parseSilkOpts(o);break;case"PREFERENCE":this.parsePreference(o);break;case"CONNECT":this.parseConnect(o);break;case"ITEM_ORDER":this.parseItemOrder(o);break;case"PROP":this.parseProp(o);break;case"EQLEN_GRP":this.parseEQLenGrp(o);break;case"EQLEN":this.parseEQLen(o);break;case"FONT":this.parseFont(o);break;case"PAD_NET":{this.cachePadNet[o[1]]||(this.cachePadNet[o[1]]=[]),this.cachePadNet[o[1]].push(o);break}case"REUSE_BLOCK":this.parseReuseBlock(o);break;case"RULE_TEMPLATE":this.parseRuleTemplate(o);break;case"RULE":this.rules.push(o);break;case"RULE_SELECTOR":this.ruleSelectors.push(o);break;case"PANELIZE":this.panelize.data=o;break;case"PANELIZE_STAMP":this.parsePanelizeStamp(o);break;case"PANELIZE_SIDE":this.parsePanelizeSide(o);break;case"POURED":{this.parsePoured(o);break}case"PARTITION":e==="PARTITION"&&(this.curPartition=o[3]?o[1]:"");case"VIA":case"PAD":case"LINE":case"ARC":case"CARC":case"OBJ":case"POLY":case"FILL":if(e==="FILL"&&o[6]===2){this.layerFill[o[4]]||(this.layerFill[o[4]]=[]),this.layerFill[o[4]].push(o);break}case"REGION":case"POUR":case"IMAGE":case"TEARDROP":case"FPC_FILL":case"SHELL":case"CREASE":e==="CREASE"&&this.creaseIds.push(o[1]);case"SHELLCUT":case"SHELL_ENTITY":case"BOSS":case"STRING":if(e==="STRING"&&!/^[a-zA-Z]+\d+$/.test(o[1])){let r=o[1],i=r.split(/([0-9].*)/);if(i.length>=2){let n=i[0],s=i[1];for(let a=0;a<s.length;a++){let l=s.charCodeAt(a);n+=l}r=n}this.stringId[r]=o[1],o[1]=r}case"DIMENSION":case"COMPONENT":{let r=e==="CARC"?"ARC":e,i=UW(o[1]);this.cache[r]||(this.cache[r]={}),i!==null&&!this.cache[r][i]?this.cache[r][i]={part:this.curPartition,value:o}:(this.errorIds[r]||(this.errorIds[r]=[]),this.errorIds[r].push({part:this.curPartition,value:o})),r==="COMPONENT"&&(this.components[o[1]]||(this.components[o[1]]={attrs:{},footprint:"",device:""}),this.components[o[1]].attrs=o[7]||{}),r==="DIMENSION"&&(this.dimension[o[1]]={attr:[]});break}case"ATTR":{if(this.docType==="PCB"&&!o[3])break;if(o[7]==="Footprint"&&(this.components[o[3]]||(this.components[o[3]]={attrs:{},footprint:"",device:""}),this.components[o[3]].footprint=o[8]),o[7]==="Device"&&(this.components[o[3]]||(this.components[o[3]]={attrs:{},footprint:"",device:""}),this.components[o[3]].device=o[8]),this.dimension[o[1]]){this.dimension[o[1]].attr=o;break}let r=Object.keys(((t=this.cache)==null?void 0:t.COMPONENT)||{}).find(n=>this.cache.COMPONENT[n].value[1]===o[3]);if(r){let n=this.cache.COMPONENT[r];n.attr||(n.attr=[]),n.attr.push({part:this.curPartition,value:o});break}let i=UW(o[1]);this.cache[e]||(this.cache[e]={}),i!==null&&!this.cache[e][i]?this.cache[e][i]={part:this.curPartition,value:o}:(this.errorIds[e]||(this.errorIds[e]=[]),this.errorIds[e].push({part:this.curPartition,value:o}));break}default:console.warn("can not find hanlder with",o)}}async secondParseLine(o,t,e){let r=o[0];if(this.idsSet.has(o[1])||!o[1]){let i=`randomuuid${++this.randomUuid}`;if(this.oldId[i]=o[1],o[1]=i,e)for(let n of e)n[3]=i}else this.idsSet.add(o[1]);switch(r){case"DOCTYPE":case"HEAD":case"CANVAS":case"LAYER":case"LAYER_PHYS":case"ACTIVE_LAYER":case"NET":case"PRIMITIVE":case"GROUP":case"SILK_OPTS":case"PREFERENCE":case"ITEM_ORDER":case"RULE_TEMPLATE":case"RULE":case"RULE_SELECTOR":case"PANELIZE":case"PANELIZE_STAMP":case"PANELIZE_SIDE":case"CONNECT":case"EQLEN_GRP":case"EQLEN":case"FONT":case"PAD_NET":case"REUSE_BLOCK":case"PROP":break;case"PARTITION":this.parsePartition(o);break;case"VIA":this.parseVia(o);break;case"PAD":this.parsePad(o);break;case"LINE":await this.parseLine(o);break;case"ARC":this.parseArc(o);break;case"CARC":this.parseCArc(o);break;case"OBJ":this.parseObj(o);break;case"POLY":this.parsePoly(o);break;case"FILL":this.parseFill(o);break;case"REGION":this.parseRegion(o);break;case"POUR":this.parsePour(o);break;case"IMAGE":this.parseImage(o);break;case"TEARDROP":this.parseTeardrop(o);break;case"FPC_FILL":this.parseFpcFill(o);break;case"SHELL":this.parseShell(o);break;case"CREASE":this.parseCrease(o);break;case"SHELLCUT":this.parseShellCut(o);break;case"SHELL_ENTITY":this.parseShellEntity(o);break;case"BOSS":this.parseBoss(o);break;case"STRING":this.parseString(o);break;case"ATTR":this.parseAttr(o,t);break;case"DIMENSION":this.parseDimension(o);break;case"COMPONENT":this.parseComponent(o);break;default:console.warn("can not find hanlder with",o)}}onParseEnd(){for(let t of this.layerPhysCache)this.parseLayerPhys(t);this.layerPhysCache=[];for(let t of this.rules)t[1]=this.transRuleType(t[1]),t[3]=this.transRuleStatus(t[3]),t[4]=qgt(t[1],t[2],t[3],t[4],this.fac,this.ruleTemplateName);if(this.fac.init){let t=Array.from(this.rules);for(let e of t){let r=$gt(e[1],e[2],e[4],this.fac);r&&this.rules.push(r)}}for(let t of this.rules)this.parseRule(t);let o={};for(let t of this.ruleSelectors){let e=Kgt(t[1],t[2],BN(t[3]),this.fac),r=JSON.stringify(t[1]);o[r]?(t[2]&&(o[r].ruleOrder=t[2]),e.ruleKeyValue&&(o[r].ruleKeyValue=Object.assign(o[r].ruleKeyValue,e.ruleKeyValue)),(e.copperRuleValue||t[4])&&(o[r].copperValue=e.copperRuleValue||BN(t[4])),(e.innerPlaneRuleValue||t[5])&&(o[r].innerPlaneValue=e.innerPlaneRuleValue||BN(t[5]))):o[r]={ruleSelect:t[1],ruleOrder:t[2],ruleKeyValue:e.ruleKeyValue,copperValue:e.copperRuleValue||BN(t[4])||{},innerPlaneValue:e.innerPlaneRuleValue||BN(t[5])||{}}}for(let t in o)this.parseRuleSelector(o[t]);this.handConnect(),this.parseEQLenGrpFull(),this.parsePanelize(),this.parseLayerFill();for(let t in this.cache){let e=this.cache[t],r=Object.keys(e).sort((n,s)=>Number(n)-Number(s)),i=-1;for(let n of r){let s=Number(n),a=s-i-1;a>=1&&this.onPHolder(t,a),i=s,this.curPartition=e[s].part,this.secondParseLine(e[s].value,void 0,e[s].attr),e[s].attr&&e[s].attr.forEach(l=>{this.curPartition=l.part,this.secondParseLine(l.value)})}if(this.errorIds[t])for(let n of this.errorIds[t])this.curPartition=n.part,this.secondParseLine(n.value)}this.clearCache()}clearCache(){this.version=void 0,this.docType=void 0,this.curPartition="",this.eQLenData={},this.eQLenSort=1,this.cache={},this.components={},this.errorIds={},this.dimension={},this.connects={},this.specialColors={},this.reuseBlock={},this.panelize.data.length&&(this.panelize.data.length=0,this.panelize.stamp={h:null,v:null},this.panelize.size={h:null,v:null}),this.layerPhys=0,this.fac.init&&(this.fac=new n6e),this.rules=[],this.ruleSelectors=[],this.ruleTemplateName="",this.layerFill={},this.idsSet.clear(),this.oldId={},this.creaseIds.length=0,this.substrateLayer.clear()}fixPolygon(o){if(o[0]=="R"){let t=parseFloat(o[3])/10,e=parseFloat(o[4])/10;o[6]=Math.min(t,e)/2*(parseFloat(o[6])||0)*10}}handleSimplePolygon(o){return!o||this.version>=1.5||this.fixPolygon(o),o}handlePolygon(o){if(this.version<1.5&&o&&o.length){if(!Array.isArray(o[0]))return this.handleSimplePolygon(o);for(let t of o)this.fixPolygon(t)}return o}parseEQLen(o){this.eQLenData[o[1]]?this.eQLenData[o[1]].pads?this.eQLenData[o[1]].pads.push(o[2]):this.eQLenData[o[1]].pads=[o[2]]:this.eQLenData[o[1]]={pads:[o[2]]}}parseEQLenGrp(o){this.eQLenData[o[1]]?(this.eQLenData[o[1]].id=o[1],this.eQLenData[o[1]].name=o[2],this.eQLenData[o[1]].sort=++this.eQLenSort):this.eQLenData[o[1]]={id:o[1],name:o[2],sort:++this.eQLenSort}}parseCanvas(o){this.onCanvas(o[1],o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],this.transGridType(o[10]),this.transGridType(o[11]),o[12])}parseDocType(o){this.docType=o[1];let t=parseFloat(o[2]);this.version=t}parseHead(o){}parseLayer(o){let t=o[8];this.version<1.7&&(t=.5);let e=this.transLayerStatus(o[4]),r=Number(o[1]);if(o[2]==="SUBSTRATE"){if(this.substrateLayer.add(r),r<101)return;r<361&&(r=r+260)}this.onLayer(r,o[2],o[3],e.use,e.show,e.locked,o[5],o[6],o[7],t)}parseLayerPhys(o){let t=Number(o[1]);if(t>=101&&t<361&&this.substrateLayer.has(t))t=t+260;else if(t<101&&this.substrateLayer.has(t))return;this.onLayerPhys(t,o[2],o[3],o[4],o[5],!!o[6],++this.layerPhys)}parseActiveLayer(o){this.onActiveLayer(o[1])}parsePartition(o){this.onPartition(o[1],o[2],o[3],this.handlePolygon(o[4]))}parseNet(o){var t,e,r,i;this.onNet(o[1],(t=o[2])!=null?t:null,(e=o[3])!=null?e:null,!!o[4],(r=o[5])!=null?r:null,!!o[6],(i=o[7])!=null?i:null)}parsePrimitive(o){this.onPrimitive(o[1],!!o[2],!!o[3])}parseGroup(o){this.onGroup(o[1],o[2])}parseSilkOpts(o){this.onSilkOpts(o[1],o[2],o[3])}parsePreference(o){this.onPreference(!!o[1],o[2],!!o[3],o[4],o[5],!!o[6],this.transRoutingMode(o[7]),o[8],!!o[9],!!o[10],!!o[11],o[12],o[13],!!o[14],this.transUnusedPadRange(o[15]),o[16],this.transPathOptimization(o[17]),o[18],o[19],o[20])}parseConnect(o){this.connects[o[1]]=o[2]}parseVia(o){var t,e;this.onVia(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],this.transViaType(o[9]),(t=o[10])!=null?t:null,(e=o[11])!=null?e:null,!!o[12],o[13])}parsePad(o){var t,e,r,i,n,s,a,l,c;this.onPad(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],this.transHoleDef(o[9]),this.transPadDef(o[10]),o[11]&&(e=(t=o[11])==null?void 0:t.map(h=>({startLayer:h[0],endLayer:h[1],pad:this.transPadDef(h[2])})))!=null?e:null,o[12],o[13],o[14],!!o[15],this.transPadFuncType(o[16]),(r=o[17])!=null?r:null,(i=o[18])!=null?i:null,(n=o[19])!=null?n:null,(s=o[20])!=null?s:null,!!o[21],this.transPadConnect(o[22]),(a=o[23])!=null?a:null,(l=o[24])!=null?l:null,(c=o[25])!=null?c:null,o[26],this.getConnect(o[1]))}parseLine(o){this.onLine(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],!!o[10])}parseArc(o){this.onArc(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],o[10],!!o[11],this.specialColors[this.getOldId(o[1])])}parseCArc(o){this.onCArc(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],o[10],!!o[11],this.specialColors[this.getOldId(o[1])])}parseObj(o){this.onObj(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],!!o[10],o[11],!!o[12],this.specialColors[this.getOldId(o[1])])}parseItemOrder(o){this.itemOrder=o[1]}parseProp(o){this.specialColors[o[1]]=o[2]}parseEQLenGrpFull(){for(let o in this.eQLenData){let t=this.eQLenData[o];t.id&&this.onEQLenGrp(t.id,t.name,t.sort,t.pads||[])}this.eQLenData={},this.eQLenSort=1}parsePoly(o){this.onPoly(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],this.handleSimplePolygon(o[6]),!!o[7],this.specialColors[this.getOldId(o[1])])}parseFill(o){this.onFill(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],this.transFillStyle(o[6]),this.handlePolygon(o[7]),!!o[8],this.getConnect(o[1]),this.specialColors[this.getOldId(o[1])])}getZIndex1(o){let t=o.match(FPe);return t!=null&&t.length?t[1]:null}parseLayerFill(){for(let o in this.layerFill){let t=this.layerFill[o];this.onLayerFill(Number(o),{fill:t.map(e=>{let r=this.getZIndex1(e[1]);return{id:e[1],partitionId:this.curPartition||"",groupId:e[2],locked:!!e[8],zIndex:r===null?null:Number(r),netName:e[3],width:e[5],path:this.handlePolygon(e[7]),refs:this.getConnect(e[1]),specialColor:this.specialColors[this.getOldId(e[1])]}})})}}parseRegion(o){let t=o[5],e=t&&t.includes(9)?"CONSTRAINT":"PROHIBIT";t=e?t.filter(r=>r!==9):t,this.onRegion(o[1],this.curPartition||"",o[2],o[3],o[4],this.transProhibitType(t),this.handlePolygon(o[6]),!!o[7],o[8],e)}parsePour(o){let t=o[9];this.version<=1.7&&t&&t[0]==="SOLID"&&t[1]&&(t[1]=8),this.onPour(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],this.handlePolygon(o[8]),this.transPourDef(t),!!o[10],!!o[11]),this.poured[o[1]]&&this.onPoured(o[1],this.poured[o[1]])}parsePoured(o){if(this.version<1.1){if(this.curPourId){let t={id:o[1],strokeWidth:o[2],fill:o[3],path:this.handlePolygon(o[4])};this.poured[this.curPourId]||(this.poured[this.curPourId]={pourFill:[]}),this.poured[this.curPourId].pourFill.push(t)}}else{let t={id:o[1],strokeWidth:o[3],fill:o[4],path:this.handlePolygon(o[5])};this.poured[o[2]]||(this.poured[o[2]]={pourFill:[]}),this.poured[o[2]].pourFill.push(t)}}parseImage(o){this.onImage(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],!!o[9],o[10],!!o[11],this.specialColors[this.getOldId(o[1])])}parseTeardrop(o){let t,e,r;this.version<1.2?(t=o[5],r=o[4]):(t=o[4],e=o[5],r=this.getConnect(o[1])),this.onTeardrop(o[1],this.curPartition||"",o[2],o[3],this.handleSimplePolygon(t),e!=null?e:null,r)}parseFpcFill(o){this.onFpcFill(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],this.handlePolygon(o[6]),!!o[7])}parseShell(o){let t=o[8];t&&t.Direction&&(t.Direction=this.transPushCoverDir(t.Direction)),this.onShell(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],this.handlePolygon(o[7]),t,!!o[9])}parseCrease(o){this.onCrease(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],o[7],o[8],!!o[9])}parseShellCut(o){this.onShellCut(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],this.handlePolygon(o[6]),!!o[7],this.getConnect(o[1]))}parseShellEntity(o){this.onShellEntity(o[1],this.curPartition||"",o[2],o[3],o[4],this.transEntityBelong(o[5]),this.transSlotOption(o[5]),o[6],o[7],this.handlePolygon(o[8]),!!o[9],this.getConnect(o[1]))}parseBoss(o){var t,e,r,i,n,s;this.version<1.4?this.onBoss(o[1],this.curPartition||"",o[2],o[3],o[5],o[6],(t=o[4])!=null?t:null,o[7],null,null,(e=o[8])!=null?e:null,(r=o[9])!=null?r:null,!!o[10]):this.onBoss(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],(i=o[6])!=null?i:null,o[7],o[8],o[9],(n=o[10])!=null?n:null,(s=o[11])!=null?s:null,!!o[12])}parseDimension(o){var t;let e=this.getOldId(o[1]),r=((t=this.dimension[e])==null?void 0:t.attr)||[];if(r.length){let n=this.fontCache.find(s=>s.id&&s.id===this.getOldId(r[1]));this.version<1.6&&n&&(n.text=r[8],n.fontFamily=r[11],n.fontSize=r[12]/10,n.thickness=r[13]/10,n.bold=r[15],n.italic=r[16],n.reverse=r[18],n.expansion=r[19]/10)}let i={groupId:r[2],layerId:r[4],x:r[5],y:r[6],text:r[8],fontFamily:r[11],fontSize:r[12],strokeWidth:r[13],bold:r[14],italic:r[15],origin:r[16],angle:r[17],reverse:r[18],expansion:r[19],mirror:r[20],locked:r[21],zIndex:null,specialColor:this.specialColors[this.getOldId(r[1])]};this.onDimension(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],!!o[7],o[8],!!o[9],i,this.specialColors[this.getOldId(o[1])],r[2]||"")}parseRuleTemplate(o){this.ruleTemplateName=o[1],this.onRuleTemplate(o[1])}parseRule(o){this.onRule(o[1],o[2],o[3],o[4])}parseRuleSelector(o){this.onRuleSelector(o.ruleSelect,o.ruleOrder,o.ruleKeyValue,o.copperValue,o.innerPlaneValue)}parsePanelize(){let o=this.panelize.data;o.length&&this.onPanelize(!!o[1],o[2],o[3],o[4],o[5],!!o[6],this.panelize.stamp.h,this.panelize.stamp.v,this.panelize.size.h,this.panelize.size.v)}parsePanelizeStamp(o){let t={on:!!o[2],stampHoleGroupQuantity:o[3],stampHoleDiameter:o[4],stampHoleQuantityPerGroup:o[5],stampHoleSpacing:o[6]};o[1]?this.panelize.stamp.v=t:this.panelize.stamp.h=t}parsePanelizeSide(o){let t={on:!!o[2],sideHeight:o[3],positionHoleDiameter:o[4],markDiameter:o[5],markExpansion:o[6]};o[1]?this.panelize.size.v=t:this.panelize.size.h=t}parseComponent(o){let t=this.getOldId(o[1]),e=o[7]||{},r=this.reuseBlock[t];if(r&&Object.assign(e,{"Group ID":r[2]||"","Channel ID":r[3]||""}),this.onComponent(o[1],this.curPartition||"",o[2],o[3],o[4],o[5],o[6],e,!!o[8],this.specialColors[t]),this.cachePadNet[t])for(let i of this.cachePadNet[t])this.parsePadNet(i)}parsePadNet(o){let t=this.getOldId(o[1]);if(o[4]===void 0&&this.components[t]){let e=this.components[t].footprint;if(!e){let i=this.components[t].device;e=this.devices.find(n=>n.uuid===i).attributes.Footprint}let r=this.padNumId[e];if(!r){let i=this.footprints.find(n=>n.uuid===e);i&&(this.padNumId[e]=Zgt(i==null?void 0:i.dataStr),r=this.padNumId[e])}if(r&&r[o[2]]){this.componentPadNum[t]||(this.componentPadNum[t]={}),this.componentPadNum[t][o[2]]===void 0&&(this.componentPadNum[t][o[2]]=-1);let i=++this.componentPadNum[t][o[2]];o[4]=r[o[2]][i]}else o[4]=o[2]}this.onPadNet(o[1],this.curPartition||"",o[2],o[3],o[4])}parseReuseBlock(o){this.reuseBlock[o[1]]=o}getFontCache(o,t,e,r,i,n,s,a){let l;return this.version<1.6?l=this.fontCache.find(c=>c.id===o):l=this.fontCache.find(c=>e==c.fontFamily&&t==c.text&&r/10==c.fontSize&&!!s==c.reverse&&a==c.expansion&&!!i==c.bold&&!!n==c.italic&&c.path.length>0),{paths:l==null?void 0:l.path,width:l==null?void 0:l.width,height:l==null?void 0:l.height}}getTextValue(o,t,e,r,i){let n="";return o!=""&&t===""&&this.docType!="PCB"&&!i&&o!="Footprint"&&!this.footprintIsConnectDevice&&(t=`<${o}>`),e?r?n=o+":"+t:n=o:r?n=t:n="",n}getFormulaName(o,t){if(!o||!o.startsWith("="))return o;o=o.slice(1);let e=/\{([^\}]+)\}/g,r=[],i=[];for(;r=e.exec(o);)i.push(r[1]);for(let n=0;n<i.length;n++){let s=i[n],a=`{${s}!}`;t.has(s)&&(a=t.get(s)),o=o.replace(`{${s}}`,a)}return o}parseAttr(o,t){let e=o[11],r=o[12];r&&this.version<1.2&&(e=="default"||e=="")&&(r*=1.5);let i=o[7],n=o[8],s=!!o[9],a=!!o[10],l=this.getOldId(o[3]),c=n;if(i==="Device"){let u=this.deviceName[n]||n;c=this.getTextValue(i,u,s,a,l)}else if(i==="Footprint"){let u=this.footprintName[n]||n;c=this.getTextValue(i,u,s,a,l)}else if(i==="Name"){let u=new Map;if(l){let d=this.components[l];if(u.set("ID",l),Object.entries(d.attrs).forEach(p=>u.set(p[0],p[1])),d.device){let p=this.devices.find(m=>m.uuid===d.device);p&&Object.entries(p.attributes).forEach(m=>u.set(m[0],m[1]))}}c=this.getTextValue(i,this.getFormulaName(n,u),s,a,l)}else c=this.getTextValue(i,n,s,a,l);let h=this.fontCache.find(u=>u.id&&u.id===this.getOldId(o[1]));this.version<1.6&&h&&(h.text=c,h.fontFamily=e,h.fontSize=r/10,h.thickness=o[13]/10,h.bold=o[15],h.italic=o[16],h.reverse=o[18],h.expansion=o[19]/10),this.onAttr(o[1],this.curPartition||"",o[2],l,o[4],o[5],o[6],i,n,s,a,e,r,o[13],!!o[14],!!o[15],this.transAlignType(o[16]),o[17],!!o[18],o[19],!!o[20],!!o[21],t,this.specialColors[this.getOldId(o[1])])}parseFont(o){let t;switch(this.version){case 1:case 1.1:t={id:o[1],path:o[2]};break;case 1.2:case 1.3:case 1.4:case 1.5:t={id:o[1],width:o[2],height:o[3],path:o[4]};break;default:t={text:o[1],fontFamily:o[2],fontSize:o[3],thickness:o[4],bold:!!o[5],italic:!!o[6],reverse:!!o[7],expansion:o[8],width:o[9],height:o[10],path:o[11]};break}this.fontCache.push(t)}parseString(o){var t;let[,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P]=o,T=(t=this.stringId[e])!=null?t:e;c&&this.version<1.2&&(l=="default"||l=="")&&(c*=1.5);let I=this.fontCache.find(C=>C.id&&C.id===this.getOldId(T));this.version<1.6&&I&&(I.text=a,I.fontFamily=l,I.fontSize=c/10,I.thickness=h/10,I.bold=u,I.italic=d,I.reverse=g,I.expansion=y/10),this.onString(e,this.curPartition||"",r,i,n,s,a,l,c,h,!!u,!!d,this.transAlignType(p),m,!!g,y,!!b,!!P,this.specialColors[this.getOldId(T)])}},Qgt=Object.create,T5e=Object.defineProperty,e1t=Object.getOwnPropertyDescriptor,t1t=Object.getOwnPropertyNames,r1t=Object.getPrototypeOf,i1t=Object.prototype.hasOwnProperty,n1t=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports),o1t=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of t1t(t))!i1t.call(o,i)&&i!==e&&T5e(o,i,{get:()=>t[i],enumerable:!(r=e1t(t,i))||r.enumerable});return o},s1t=(o,t,e)=>(e=o!=null?Qgt(r1t(o)):{},o1t(t||!o||!o.__esModule?T5e(e,"default",{value:o,enumerable:!0}):e,o)),a1t=n1t((o,t)=>{"use strict";t.exports=e,t.exports.default=e;function e(L,k,N){N=N||2;var U=k&&k.length,B=U?k[0]*N:L.length,G=r(L,0,B,N,!0),Y=[];if(!G||G.next===G.prev)return Y;var X,K,J,se,ce,te,oe;if(U&&(G=h(L,k,G,N)),L.length>80*N){X=J=L[0],K=se=L[1];for(var $=N;$<B;$+=N)ce=L[$],te=L[$+1],ce<X&&(X=ce),te<K&&(K=te),ce>J&&(J=ce),te>se&&(se=te);oe=Math.max(J-X,se-K),oe=oe!==0?32767/oe:0}return n(G,Y,N,X,K,oe,0),Y}function r(L,k,N,U,B){var G,Y;if(B===W(L,k,N,U)>0)for(G=k;G<N;G+=U)Y=H(G,L[G],L[G+1],Y);else for(G=N-U;G>=k;G-=U)Y=H(G,L[G],L[G+1],Y);return Y&&E(Y,Y.next)&&(z(Y),Y=Y.next),Y}function i(L,k){if(!L)return L;k||(k=L);var N=L,U;do if(U=!1,!N.steiner&&(E(N,N.next)||C(N.prev,N,N.next)===0)){if(z(N),N=k=N.prev,N===N.next)break;U=!0}else N=N.next;while(U||N!==k);return k}function n(L,k,N,U,B,G,Y){if(L){!Y&&G&&g(L,U,B,G);for(var X=L,K,J;L.prev!==L.next;){if(K=L.prev,J=L.next,G?a(L,U,B,G):s(L)){k.push(K.i/N|0),k.push(L.i/N|0),k.push(J.i/N|0),z(L),L=J.next,X=J.next;continue}if(L=J,L===X){Y?Y===1?(L=l(i(L),k,N),n(L,k,N,U,B,G,2)):Y===2&&c(L,k,N,U,B,G):n(i(L),k,N,U,B,G,1);break}}}}function s(L){var k=L.prev,N=L,U=L.next;if(C(k,N,U)>=0)return!1;for(var B=k.x,G=N.x,Y=U.x,X=k.y,K=N.y,J=U.y,se=B<G?B<Y?B:Y:G<Y?G:Y,ce=X<K?X<J?X:J:K<J?K:J,te=B>G?B>Y?B:Y:G>Y?G:Y,oe=X>K?X>J?X:J:K>J?K:J,$=U.next;$!==k;){if($.x>=se&&$.x<=te&&$.y>=ce&&$.y<=oe&&T(B,X,G,K,Y,J,$.x,$.y)&&C($.prev,$,$.next)>=0)return!1;$=$.next}return!0}function a(L,k,N,U){var B=L.prev,G=L,Y=L.next;if(C(B,G,Y)>=0)return!1;for(var X=B.x,K=G.x,J=Y.x,se=B.y,ce=G.y,te=Y.y,oe=X<K?X<J?X:J:K<J?K:J,$=se<ce?se<te?se:te:ce<te?ce:te,fe=X>K?X>J?X:J:K>J?K:J,Oe=se>ce?se>te?se:te:ce>te?ce:te,Te=b(oe,$,k,N,U),ue=b(fe,Oe,k,N,U),be=L.prevZ,j=L.nextZ;be&&be.z>=Te&&j&&j.z<=ue;){if(be.x>=oe&&be.x<=fe&&be.y>=$&&be.y<=Oe&&be!==B&&be!==Y&&T(X,se,K,ce,J,te,be.x,be.y)&&C(be.prev,be,be.next)>=0||(be=be.prevZ,j.x>=oe&&j.x<=fe&&j.y>=$&&j.y<=Oe&&j!==B&&j!==Y&&T(X,se,K,ce,J,te,j.x,j.y)&&C(j.prev,j,j.next)>=0))return!1;j=j.nextZ}for(;be&&be.z>=Te;){if(be.x>=oe&&be.x<=fe&&be.y>=$&&be.y<=Oe&&be!==B&&be!==Y&&T(X,se,K,ce,J,te,be.x,be.y)&&C(be.prev,be,be.next)>=0)return!1;be=be.prevZ}for(;j&&j.z<=ue;){if(j.x>=oe&&j.x<=fe&&j.y>=$&&j.y<=Oe&&j!==B&&j!==Y&&T(X,se,K,ce,J,te,j.x,j.y)&&C(j.prev,j,j.next)>=0)return!1;j=j.nextZ}return!0}function l(L,k,N){var U=L;do{var B=U.prev,G=U.next.next;!E(B,G)&&O(B,U,U.next,G)&&D(B,G)&&D(G,B)&&(k.push(B.i/N|0),k.push(U.i/N|0),k.push(G.i/N|0),z(U),z(U.next),U=L=G),U=U.next}while(U!==L);return i(U)}function c(L,k,N,U,B,G){var Y=L;do{for(var X=Y.next.next;X!==Y.prev;){if(Y.i!==X.i&&I(Y,X)){var K=F(Y,X);Y=i(Y,Y.next),K=i(K,K.next),n(Y,k,N,U,B,G,0),n(K,k,N,U,B,G,0);return}X=X.next}Y=Y.next}while(Y!==L)}function h(L,k,N,U){var B=[],G,Y,X,K,J;for(G=0,Y=k.length;G<Y;G++)X=k[G]*U,K=G<Y-1?k[G+1]*U:L.length,J=r(L,X,K,U,!1),J===J.next&&(J.steiner=!0),B.push(P(J));for(B.sort(u),G=0;G<B.length;G++)N=d(B[G],N);return N}function u(L,k){return L.x-k.x}function d(L,k){var N=p(L,k);if(!N)return k;var U=F(N,L);return i(U,U.next),i(N,N.next)}function p(L,k){var N=k,U=L.x,B=L.y,G=-1/0,Y;do{if(B<=N.y&&B>=N.next.y&&N.next.y!==N.y){var X=N.x+(B-N.y)*(N.next.x-N.x)/(N.next.y-N.y);if(X<=U&&X>G&&(G=X,Y=N.x<N.next.x?N:N.next,X===U))return Y}N=N.next}while(N!==k);if(!Y)return null;var K=Y,J=Y.x,se=Y.y,ce=1/0,te;N=Y;do U>=N.x&&N.x>=J&&U!==N.x&&T(B<se?U:G,B,J,se,B<se?G:U,B,N.x,N.y)&&(te=Math.abs(B-N.y)/(U-N.x),D(N,L)&&(te<ce||te===ce&&(N.x>Y.x||N.x===Y.x&&m(Y,N)))&&(Y=N,ce=te)),N=N.next;while(N!==K);return Y}function m(L,k){return C(L.prev,L,k.prev)<0&&C(k.next,L,L.next)<0}function g(L,k,N,U){var B=L;do B.z===0&&(B.z=b(B.x,B.y,k,N,U)),B.prevZ=B.prev,B.nextZ=B.next,B=B.next;while(B!==L);B.prevZ.nextZ=null,B.prevZ=null,y(B)}function y(L){var k,N,U,B,G,Y,X,K,J=1;do{for(N=L,L=null,G=null,Y=0;N;){for(Y++,U=N,X=0,k=0;k<J&&(X++,U=U.nextZ,!!U);k++);for(K=J;X>0||K>0&&U;)X!==0&&(K===0||!U||N.z<=U.z)?(B=N,N=N.nextZ,X--):(B=U,U=U.nextZ,K--),G?G.nextZ=B:L=B,B.prevZ=G,G=B;N=U}G.nextZ=null,J*=2}while(Y>1);return L}function b(L,k,N,U,B){return L=(L-N)*B|0,k=(k-U)*B|0,L=(L|L<<8)&16711935,L=(L|L<<4)&252645135,L=(L|L<<2)&858993459,L=(L|L<<1)&1431655765,k=(k|k<<8)&16711935,k=(k|k<<4)&252645135,k=(k|k<<2)&858993459,k=(k|k<<1)&1431655765,L|k<<1}function P(L){var k=L,N=L;do(k.x<N.x||k.x===N.x&&k.y<N.y)&&(N=k),k=k.next;while(k!==L);return N}function T(L,k,N,U,B,G,Y,X){return(B-Y)*(k-X)>=(L-Y)*(G-X)&&(L-Y)*(U-X)>=(N-Y)*(k-X)&&(N-Y)*(G-X)>=(B-Y)*(U-X)}function I(L,k){return L.next.i!==k.i&&L.prev.i!==k.i&&!v(L,k)&&(D(L,k)&&D(k,L)&&w(L,k)&&(C(L.prev,L,k.prev)||C(L,k.prev,k))||E(L,k)&&C(L.prev,L,L.next)>0&&C(k.prev,k,k.next)>0)}function C(L,k,N){return(k.y-L.y)*(N.x-k.x)-(k.x-L.x)*(N.y-k.y)}function E(L,k){return L.x===k.x&&L.y===k.y}function O(L,k,N,U){var B=x(C(L,k,N)),G=x(C(L,k,U)),Y=x(C(N,U,L)),X=x(C(N,U,k));return!!(B!==G&&Y!==X||B===0&&_(L,N,k)||G===0&&_(L,U,k)||Y===0&&_(N,L,U)||X===0&&_(N,k,U))}function _(L,k,N){return k.x<=Math.max(L.x,N.x)&&k.x>=Math.min(L.x,N.x)&&k.y<=Math.max(L.y,N.y)&&k.y>=Math.min(L.y,N.y)}function x(L){return L>0?1:L<0?-1:0}function v(L,k){var N=L;do{if(N.i!==L.i&&N.next.i!==L.i&&N.i!==k.i&&N.next.i!==k.i&&O(N,N.next,L,k))return!0;N=N.next}while(N!==L);return!1}function D(L,k){return C(L.prev,L,L.next)<0?C(L,k,L.next)>=0&&C(L,L.prev,k)>=0:C(L,k,L.prev)<0||C(L,L.next,k)<0}function w(L,k){var N=L,U=!1,B=(L.x+k.x)/2,G=(L.y+k.y)/2;do N.y>G!=N.next.y>G&&N.next.y!==N.y&&B<(N.next.x-N.x)*(G-N.y)/(N.next.y-N.y)+N.x&&(U=!U),N=N.next;while(N!==L);return U}function F(L,k){var N=new V(L.i,L.x,L.y),U=new V(k.i,k.x,k.y),B=L.next,G=k.prev;return L.next=k,k.prev=L,N.next=B,B.prev=N,U.next=N,N.prev=U,G.next=U,U.prev=G,U}function H(L,k,N,U){var B=new V(L,k,N);return U?(B.next=U.next,B.prev=U,U.next.prev=B,U.next=B):(B.prev=B,B.next=B),B}function z(L){L.next.prev=L.prev,L.prev.next=L.next,L.prevZ&&(L.prevZ.nextZ=L.nextZ),L.nextZ&&(L.nextZ.prevZ=L.prevZ)}function V(L,k,N){this.i=L,this.x=k,this.y=N,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}e.deviation=function(L,k,N,U){var B=k&&k.length,G=B?k[0]*N:L.length,Y=Math.abs(W(L,0,G,N));if(B)for(var X=0,K=k.length;X<K;X++){var J=k[X]*N,se=X<K-1?k[X+1]*N:L.length;Y-=Math.abs(W(L,J,se,N))}var ce=0;for(X=0;X<U.length;X+=3){var te=U[X]*N,oe=U[X+1]*N,$=U[X+2]*N;ce+=Math.abs((L[te]-L[$])*(L[oe+1]-L[te+1])-(L[te]-L[oe])*(L[$+1]-L[te+1]))}return Y===0&&ce===0?0:Math.abs((ce-Y)/Y)};function W(L,k,N,U){for(var B=0,G=k,Y=N-U;G<N;G+=U)B+=(L[Y]-L[G])*(L[G+1]+L[Y+1]),Y=G;return B}e.flatten=function(L){for(var k=L[0][0].length,N={vertices:[],holes:[],dimensions:k},U=0,B=0;B<L.length;B++){for(var G=0;G<L[B].length;G++)for(var Y=0;Y<k;Y++)N.vertices.push(L[B][G][Y]);B>0&&(U+=L[B-1].length,N.holes.push(U))}return N}}),l1t=(o=>(o[o.MIL=1]="MIL",o[o.INCH=1e3]="INCH",o[o.FT=12e3]="FT",o[o.YARD=36e3]="YARD",o[o.MILE=6336e4]="MILE",o[o.KM=3937007874e-2]="KM",o[o.M=39370]="M",o[o.DM=3937]="DM",o[o.CM=393.7]="CM",o[o.MM=39.37]="MM",o[o.UM=.039]="UM",o[o.NM=394e-7]="NM",o[o.PT=13.88888888888889]="PT",o[o.PX72=13.88888888888889]="PX72",o[o.PX96=10.416666666666666]="PX96",o[o.PX100=10]="PX100",o[o.LTSPICE=6.25]="LTSPICE",o[o.PX1=.1]="PX1",o[o.PX001=.001]="PX001",o))(l1t||{}),c1t=(o=>(o.MIL="mil",o.INCH="inch",o.FT="ft",o.YARD="yard",o.MILE="mile",o.KM="km",o.M="m",o.DM="dm",o.CM="cm",o.MM="mm",o.UM="um",o.NM="nm",o.PT="pt",o.PX72="px(72)",o.PX96="px(96)",o.PX100="px(100)",o))(c1t||{}),s6e={mil:1,inch:1e3,ft:12e3,yard:36e3,mile:6336e4,km:3937007874e-2,dm:3937,mm:39.37,um:.039,nm:394e-7,pt:13.88888888888889,"px(72)":13.88888888888889,"px(96)":10.416666666666666,"px(100)":10},vWt=(()=>{let o={};for(let t in s6e)o[s6e[t]]=t;return o})(),eQ,xWt=(eQ=class{constructor(o,t){this.ratio=o/t}wrap(o){return o*this.ratio}static convert(o,t,e){return o*t/e}},eQ.ASIS=new eQ(1,1),eQ),tQ=class{conversion(o,t,e){if(o===t)return e;let r=o+2+t;return this[r](e)}conversion1(o,t,e){let r=o+2+t,i=this[r](e);return t=="mil"?Math.round(i*10)/10:Math.round(i*1e3)/1e3}mil2mil(o){return o}mil2mm(o){return o*.0254}mil2cm(o){return o*.00254}mil2inch(o){return o/1e3}mm2mm(o){return o}mm2mil(o){let t=Math.pow(10,5);return Math.round(o*39.37007874015748*t)/t}mm2cm(o){return o/10}mm2inch(o){let t=Math.pow(10,8);return Math.round(o*.03937007874015748*t)/t}cm2mil(o){let t=Math.pow(10,6);return Math.round(o*393.7007874015748*t)/t}cm2mm(o){return o*10}cm2inch(o){let t=Math.pow(10,7);return Math.round(o*.3937007874015748*t)/t}inch2mil(o){return o*1e3}inch2mm(o){return o*25.4}inch2cm(o){return o*2.54}};tQ.prototype["px(100)2mil"]=o=>o*10,tQ.prototype["px(100)2mm"]=o=>o*.254,tQ.prototype["mil2px(100)"]=o=>o/10,tQ.prototype["mm2px(100)"]=o=>{let t=Math.pow(10,5);return Math.round(o*3.937007874015748*t)/t};var rQ=null,GPe=new ArrayBuffer(8),xbe=new Float64Array(GPe),Rbe=new Uint32Array(GPe),a6e=new Uint16Array(GPe),l6e=class{static repeat(o,t){let e=new Array(t);for(;t-- >0;)e[t]=o;return e.join("")}static lpad(o,t,e){let r=e-o.length;return r>0?this.repeat(t,r)+o:o}static rpad(o,t,e){let r=e-o.length;return r>0?o+this.repeat(t,r):o}static strHashcode(o){if(o.length>0){let t=0;for(let e=0;e<o.length;e++)t=31*t+o.charCodeAt(e)|0;return t}else return 0}static arraycopy(o,t,e,r,i){if(o.length>=t+i&&e.length>=r+i)for(;i-- >0;)e[r++]=o[t++];else throw new Error("arraycopy out of range")}static undefAsNull(o){return null}static reverse(o,t){for(let e=0,r=o.length-1;r>=0;e++,r--)t[e]=o[r];return t}static sortAsc(o,t){return o-t}static xmlDecode(o){let t=o.length,e=new Array,r=-1;for(let i=0;i<t;i++){let n=o.charAt(i);if(r>=0){if(n===";"){let s=o.substring(r+1,i);switch(s){case"lt":e.push("<");break;case"gt":e.push(">");break;case"quot":e.push('"');break;case"apos":e.push("'");break;case"amp":e.push("&");break;default:if(s.charAt(0)==="#"){let a=parseInt(s.substring(1));e.push(String.fromCharCode(a))}else e.push("&"+s+";")}r=-1}}else n==="&"?r=i:e.push(n)}return r>=0&&e.push(o.substring(r)),e.join("")}static addAll(o,t){for(let e of t)o.push(e)}static addAllSet(o,t){for(let e of t)o.add(e)}static contains(o,t){for(let e of o)if(e.equals(t))return!0;return!1}static equals(o,t){if(o.length==t.length){for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}else return!1}static remove(o,t){let e=0,r=o.length;for(let i=0;i<r;i++)o[i]===t&&(o.splice(i,1),i--,r--,e++);return e}static getUrlVars(){for(var o={},t=location.href.slice(location.href.indexOf("?")+1).split("&"),e=0;e<t.length;e++){var r=t[e].split("=");o[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return o}static prefix(){if(!rQ){let o=this.getUrlVars().version;o?rQ="/analyzer/v"+o:rQ="/analyzer"}return rQ}static add2objS(o,t,e){if(t in o)return o[t];{let r=e(t);return o[t]=r,r}}static downloadFile(o,t){let e=document.createElement("a"),r=URL.createObjectURL(t);e.download=o,e.href=r,e.click(),URL.revokeObjectURL(r)}static uuid(){let o=new Array;xbe[0]=new Date().getTime(),o.push(Rbe[1].toString(16)),xbe[0]=Math.random(),o.push(a6e[3].toString(16));let t=a6e[2].toString(16);o.push("4"+t.substr(0,3)),xbe[0]=performance.now();let e=Rbe[0].toString(16)+Rbe[1].toString(16);return o.push("0"+e.substr(0,3)),o.push(e.substr(3)),o.join("-")}static funcCopy(o){return(0,eval)("("+o.toString()+")")}static NVL(...o){for(let t of o)if(t!==null)return t;return null}static isSingle(o){return Array.from(new Set(o)).length===o.length}},I5e=class{static rgb(o){if(0<=o&&o<=255)return o;throw new Error(zN.format("RGB should not nagative and not over 255(0xFF): %X",o))}static normal(o){if(isFinite(o))return o;throw new Error(zN.format("%f is not permitted",o))}static positiveOr0(o){if(o>=0)return o;throw new Error(zN.format("%f must >= 0",o))}static positive(o){if(o>0)return o;throw new Error(zN.format("%f must > 0",o))}static notnull(o){if(o!=null)return o;throw new Error("invalid null value")}static mustnull(o){if(o===null)return null;throw new Error("value must be null")}static notEmpty(o){if(o==null||o.length===0)throw new Error("invalid empty string");return o}static nullOrEmpty(o){return o==null||o.length===0}static notNullOrUndef(o){if(o!=null)return o;throw new Error("null or undefined is not permitted")}},h1t=(o=>(o[o.UNKNOWN=0]="UNKNOWN",o[o.PERCENT=1]="PERCENT",o[o.LEFT_PAD0=2]="LEFT_PAD0",o))(h1t||{}),u1t=/(\.?0+)$/,zN=class{static format(o,...t){return this.format1(o,t)}static format1(o,t){let e=this._format(o,t);if(typeof e=="string")return e;throw new Error(this.format("Invalid state on (%d) %s",e,o))}static _format(o,t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l),h=c.charCodeAt(0);switch(r){case 0:h===37?r=1:e.push(c);break;case 1:switch(h){case 100:if(n=t[i++],typeof n=="number")e.push(n.toFixed(0)),r=0;else return l;break;case 102:if(n=t[i++],typeof n=="number")e.push(n.toString()),r=0;else return l;break;case 120:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16)),r=0;else return l;break;case 88:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16).toUpperCase()),r=0;else return l;break;case 115:case 99:n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case 48:s=l+1,a=-1,r=2;break;case 37:e.push("%"),r=0;break;default:return l}break;case 2:switch(h){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a=l;break;case 120:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(l6e.lpad((n|0).toString(16),"0",u)),r=0;else return l}else return l;break;case 88:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push(l6e.lpad((n|0).toString(16).toUpperCase(),"0",u)),r=0;else return l}else return l;break;default:return l}break;default:return l}}return e.join("")}static startsWith(o,t){return o.length>=t.length?o.substring(0,t.length)===t:!1}static endsWith(o,t){return o.length>=t.length?o.substring(o.length-t.length)===t:!1}static split(o,t){let e=new Array,r=0;for(;;){let i=o.exec(t);if(i!==null){let n=o.lastIndex-i[0].length;e.push(t.substring(r,n)),r=o.lastIndex}else{let n=t.substring(r);I5e.nullOrEmpty(n)||e.push(n);break}}return e}static fmtNumber(o){return o.toFixed(5).replace(u1t,"")}},d1t=(o=>(o[o.DEBUG=0]="DEBUG",o[o.INFO=1]="INFO",o[o.WARNING=2]="WARNING",o[o.ERROR=3]="ERROR",o[o.DUMMY=4]="DUMMY",o))(d1t||{});function p1t(o){switch(o){case 0:return"DEBUG";case 1:return"INFO";case 2:return"WARNING";case 3:return"ERROR";case 4:return"DUMMY"}}var f1t=(o,t)=>{o===3?console.error(t):console.log(t)},m1t=(o,t)=>zN.format("%s %s: %s",new Date,p1t(o),t),vN,nee=(vN=class{constructor(o,t=f1t,e=m1t){this.debug=!1,this.level=o,this.writer=t,this.fmt=e}static mix(...o){let t=4;for(let e of o)e.level<t&&(t=e.level);return new vN(t,(e,r)=>{for(let i of o)i.write1(e,r)},(e,r)=>r)}wrap(o=null,t=null){let e=o===null?this.fmt:(i,n)=>(n=o(i,n),this.fmt(i,n)),r=t===null?this.writer:(i,n)=>{t(i,n),this.writer(i,n)};return new vN(this.level,r,e)}chain(o){return o.wrap(this.fmt.bind(this),this.writer.bind(this))}include(o){return this.level<=o}write3(o,t,e){this.include(o)&&this.writer(o,this.fmt(o,zN.format(t,...e)))}write2(o,t){this.include(o)&&(t instanceof Error?this.writer(o,this.fmt(o,t.stack)):this.writer(o,this.fmt(o,t.toString())))}write1(o,t){this.include(o)&&this.writer(o,this.fmt(o,t))}debug3(o,...t){this.write3(0,o,t)}debug2(o){this.write2(0,o)}debug1(o){this.write1(0,o)}info3(o,...t){this.write3(1,o,t)}info2(o){this.write2(1,o)}info1(o){this.write1(1,o)}warning3(o,...t){this.write3(2,o,t)}warning2(o){this.write2(2,o)}warning1(o){this.write1(2,o)}error3(o,...t){this.write3(3,o,t)}error2(o){this.write2(3,o)}error1(o){this.write1(3,o)}},vN.DUMMY=new vN(4),vN),UPe=new ArrayBuffer(8),Dbe=new Float64Array(UPe),wbe=new Uint32Array(UPe),c6e=new Uint16Array(UPe),h6e=ArrayBuffer;try{h6e=self.HTMLImageElement||h6e}catch{}var iQ=null;function hL(o,t,e=0,r=o.length){i(o,null,t,e,r);function i(s,a,l,c,h){let u,d,p,m;if(c<h-1){let g=h-c;if(g>50)a===null&&(a=new Array(g+1)),n(s,a,l,c,(c+h)/2|0,h);else{u=s[c],d=c,p=c,m=h;let y=d+1;for(;y<m;){if(p!=m){if(m=m+-1,l(u,s[m])<=0)continue;s[p]=s[m],p=m;continue}if(l(u,s[y])>=0){d=y,y=d+1;continue}s[p]=s[y],d=y,p=y,y=d+1}s[p]=u,i(s,a,l,c,p),i(s,a,l,p+1,h)}}}function n(s,a,l,c,h,u){i(s,a,l,c,h),i(s,a,l,h,u);for(var d=c,p=h,m=0,g=s[d],y=s[p];d<h&&p<u;){var b=l(g,y);isNaN(b)?(a[m++]=y,y=s[++p]):(b<=0&&(a[m++]=g,g=s[++d]),b>=0&&(a[m++]=y,y=s[++p]))}for(;d<h;d++)a[m++]=s[d];for(;p<u;p++)a[m++]=s[p];for(d=c,p=0;p<m;d++,p++)s[d]=a[p]}}var $g=class{static repeat(o,t){let e=new Array(t);for(;t-- >0;)e[t]=o;return e.join("")}static lpad(o,t,e){let r=e-o.length;return r>0?this.repeat(t,r)+o:o}static rpad(o,t,e){let r=e-o.length;return r>0?o+this.repeat(t,r):o}static strHashcode(o){if(o.length>0){let t=0;for(let e=0;e<o.length;e++)t=31*t+o.charCodeAt(e)|0;return t}else return 0}static arraycopy(o,t,e,r,i){if(o.length>=t+i&&e.length>=r+i)for(;i-- >0;)e[r++]=o[t++];else throw new Error("arraycopy out of range")}static undefAsNull(o){return null}static reverse(o,t){for(let e=0,r=o.length-1;r>=0;e++,r--)t[e]=o[r];return t}static sortAsc(o,t){return o-t}static xmlDecode(o){let t=o.length,e=new Array,r=-1;for(let i=0;i<t;i++){let n=o.charAt(i);if(r>=0){if(n===";"){let s=o.substring(r+1,i);switch(s){case"lt":e.push("<");break;case"gt":e.push(">");break;case"quot":e.push('"');break;case"apos":e.push("'");break;case"amp":e.push("&");break;default:if(s.charAt(0)==="#"){let a=parseInt(s.substring(1));e.push(String.fromCharCode(a))}else e.push("&"+s+";")}r=-1}}else n==="&"?r=i:e.push(n)}return r>=0&&e.push(o.substring(r)),e.join("")}static addAll(o,t){for(let e of t)o.push(e)}static addAllSet(o,t){for(let e of t)o.add(e)}static contains(o,t){for(let e of o)if(e.equals(t))return!0;return!1}static equals(o,t){if(o.length==t.length){for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}else return!1}static remove(o,t){let e=0,r=o.length;for(let i=0;i<r;i++)o[i]===t&&(o.splice(i,1),i--,r--,e++);return e}static getUrlVars(){for(var o={},t=location.href.slice(location.href.indexOf("?")+1).split("&"),e=0;e<t.length;e++){var r=t[e].split("=");o[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return o}static prefix(){if(!iQ){let o=this.getUrlVars().version;o?iQ="/analyzer/v"+o:iQ="/analyzer"}return iQ}static add2objS(o,t,e){if(t in o)return o[t];{let r=e(t);return o[t]=r,r}}static downloadFile(o,t){let e=document.createElement("a"),r=URL.createObjectURL(t);e.download=o,e.href=r,e.click(),URL.revokeObjectURL(r)}static uuid(){let o=new Array;Dbe[0]=new Date().getTime(),o.push(wbe[1].toString(16)),Dbe[0]=Math.random(),o.push(c6e[3].toString(16));let t=c6e[2].toString(16);o.push("4"+t.substr(0,3)),Dbe[0]=performance.now();let e=wbe[0].toString(16)+wbe[1].toString(16);return o.push("0"+e.substr(0,3)),o.push(e.substr(3)),o.join("-")}static funcCopy(o){return(0,eval)("("+o.toString()+")")}static NVL(...o){for(let t of o)if(t!==null)return t;return null}static isSingle(o){return Array.from(new Set(o)).length===o.length}},g1t=[1,10,100,1e3],nQ=0,Jw=0;function u6e(o,t,e){return nQ=Math.abs(o-t),e>=5&&nQ>1e-5||isNaN(e)&&nQ>1e-8?!1:nQ<1e-13?!0:(Jw=Math.min(d6e(o),d6e(t)),Jw<10&&(Jw=10),isNaN(e)||(Jw=Math.min(Jw,e)),p6e(o,Jw)===p6e(t,Jw))}var oQ=0,sQ=0;function d6e(o){return oQ=0,sQ=0,o>0?oQ=o-Math.floor(o):oQ=o-Math.ceil(o),sQ=(oQ.toString()||"").length,sQ>2?sQ-2:0}function p6e(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=g1t[t]||Math.pow(10,t)||10;if(e){var i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(i+o)}else return Math.round(o*r+1e-10)/r}var y1t=(o=>(o[o.UNKNOWN=0]="UNKNOWN",o[o.PERCENT=1]="PERCENT",o[o.LEFT_PAD0=2]="LEFT_PAD0",o))(y1t||{}),b1t=/(\.?0+)$/,YN=class{static format(o,...t){return this.format1(o,t)}static format1(o,t){let e=this._format(o,t);if(typeof e=="string")return e;throw new Error(this.format("Invalid state on (%d) %s",e,o))}static _format(o,t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l),h=c.charCodeAt(0);switch(r){case 0:h===37?r=1:e.push(c);break;case 1:switch(h){case 100:if(n=t[i++],typeof n=="number")e.push(n.toFixed(0)),r=0;else return l;break;case 102:if(n=t[i++],typeof n=="number")e.push(n.toString()),r=0;else return l;break;case 120:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16)),r=0;else return l;break;case 88:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16).toUpperCase()),r=0;else return l;break;case 115:case 99:n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case 48:s=l+1,a=-1,r=2;break;case 37:e.push("%"),r=0;break;default:return l}break;case 2:switch(h){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a=l;break;case 120:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push($g.lpad((n|0).toString(16),"0",u)),r=0;else return l}else return l;break;case 88:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push($g.lpad((n|0).toString(16).toUpperCase(),"0",u)),r=0;else return l}else return l;break;default:return l}break;default:return l}}return e.join("")}static startsWith(o,t){return o.length>=t.length?o.substring(0,t.length)===t:!1}static endsWith(o,t){return o.length>=t.length?o.substring(o.length-t.length)===t:!1}static split(o,t){let e=new Array,r=0;for(;;){let i=o.exec(t);if(i!==null){let n=o.lastIndex-i[0].length;e.push(t.substring(r,n)),r=o.lastIndex}else{let n=t.substring(r);fu.nullOrEmpty(n)||e.push(n);break}}return e}static fmtNumber(o){return o.toFixed(5).replace(b1t,"")}},fu=class{static rgb(o){if(0<=o&&o<=255)return o;throw new Error(YN.format("RGB should not nagative and not over 255(0xFF): %X",o))}static normal(o){if(isFinite(o))return o;throw new Error(YN.format("%f is not permitted",o))}static positiveOr0(o){if(o>=0)return o;throw new Error(YN.format("%f must >= 0",o))}static positive(o){if(o>0)return o;throw new Error(YN.format("%f must > 0",o))}static notnull(o){if(o!=null)return o;throw new Error("invalid null value")}static mustnull(o){if(o===null)return null;throw new Error("value must be null")}static notEmpty(o){if(o==null||o.length===0)throw new Error("invalid empty string");return o}static nullOrEmpty(o){return o==null||o.length===0}static notNullOrUndef(o){if(o!=null)return o;throw new Error("null or undefined is not permitted")}},aQ,br=(aQ=class{static regular(o){return Math.round(o*this.precision)/this.precision}static eq(o,t){return Math.abs(o-t)<=this.eps}static neq(o,t){return Math.abs(o-t)>this.eps}static less(o,t){return o-t<-this.eps}static lesseq(o,t){return o-t<=this.eps}static greater(o,t){return o-t>this.eps}static greatereq(o,t){return o-t>=-this.eps}static sqrt(o){return Math.abs(o)<=1e-10?0:Math.sqrt(o)}static sortAsc(o,t){return o-t}static sortDesc(o,t){return t-o}},aQ.eps=1e-8,aQ.precision=1e8,aQ);function KN(o,t){kQ(o.iterator(),t)}function kQ(o,t){let e=0;for(;o.hasNext();){let r=o.next();t(e++,r)}}var P1t=class{constructor(o){this.idx=-1,this.lst=o}hasNext(){return this.idx<this.lst.length-1}next(){if(this.idx<this.lst.length-1)return this.idx++,this.lst[this.idx];throw new Error("bug")}};function aPe(o){return new P1t(o)}var Xg,Uo=(Xg=class{static toDegrees(o){return o*180/Math.PI}static toRadians(o){return o/180*Math.PI}static regularD(o){return o=o%360,o=o<0?360+o:o,o===360?0:o}static regular(o){return o=o%Xg.PIx2,o=o<0?Xg.PIx2+o:o,o===Xg.PIx2?0:o}static toQuarterBase(o){return Xg.regular((o+Xg.PI_4)/Xg.PI_2*Xg.PI_2)}static toQuarterBaseD(o){return Xg.regularD(((o+45)/90|0)*90)}static transformD(o,t){return Xg.toDegrees(Xg.transform(Xg.toRadians(o),t))}static transform(o,t){let e=Math.cos(o),r=Math.sin(o),i=new Nt(t.data[6],t.data[7]),n=new Nt(e,r).multiply3(t);return Xg.regular(n.angle(i))}},Xg.PIx2=Math.PI*2,Xg.PI_2=Math.PI/2,Xg.PI_4=Math.PI/4,Xg),Vd=class{static dotProd1(o,t,e,r){return o*e+t*r}static dotProd2(o,t,e,r,i,n){return this.dotProd1(e-o,r-t,i-e,n-r)}static dotProd3(o,t,e){return this.dotProd2(o.x,o.y,t.x,t.y,e.x,e.y)}static crossProd1(o,t,e,r){return o*r-t*e}static crossProd2(o,t,e,r,i,n){return this.crossProd1(e-o,r-t,i-e,n-r)}static crossProd3(o,t,e){return this.crossProd2(o.x,o.y,t.x,t.y,e.x,e.y)}static distance2(o,t,e,r){let i=e-o,n=r-t;return i*i+n*n}static distance1(o,t,e,r){return this.hypot(e-o,r-t)}static distance1p(o,t){return this.distance1(o.x,o.y,t.x,t.y)}static hypot(o,t){if(o=Math.abs(o),t=Math.abs(t),t>o){var e=t;t=o,o=e}if(o===0)return t;var r=t/o;return o*Math.sqrt(1+r*r)}},C5e=new ArrayBuffer(16),f6e=new Float64Array(C5e),lQ=new Int32Array(C5e),Ul,Nt=(Ul=class{static sortByXAsc(o,t){return o.x-t.x}static sortByYAsc(o,t){return o.y-t.y}static sortByXYAsc(o,t){return o.x<t.x?-1:o.x>t.x?1:o.y-t.y}static caculateAngle(o,t){let e=Math.cos(o),r=Math.sin(o),i=e*t.data[0]+r*t.data[4],n=e*t.data[1]+r*t.data[5],s=new Ul(i,n).normalize();return Math.atan2(s.y,s.x)}static normal(o,t,e){let r=t.sub(o),i=e.sub(t);return r.cross(i)}static getVector2(o){return new Ul(Math.cos(o),Math.sin(o))}static getCrossPoint1(o,t,e,r){if(o.equals1(t)||e.equals1(r)||br.eq(1,Math.abs(t.sub(o).normalize().dot(r.sub(e).normalize()))))return null;let i=t.y-o.y,n=o.x-t.x,s=t.x*o.y-o.x*t.y,a=r.y-e.y,l=e.x-r.x,c=r.x*e.y-e.x*r.y,h=i*l-a*n;return new Ul((c*n-s*l)/h,(s*a-c*i)/h)}static getCrossPoint2(o,t,e,r){return this.getCrossPoint1(o,o.add(t),e,e.add(r))}constructor(o,t){this.x=fu.normal(o),this.y=fu.normal(t)}get hashed(){return this._hashed==null&&(f6e[0]=this.x,f6e[1]=this.y,this._hashed=lQ[0]^lQ[1]^lQ[2]^lQ[3]),this._hashed}dot(o){return this.x*o.x+this.y*o.y}length(){return Math.sqrt(this.dot(this))}getCos(){return this.x/this.length()}sub(o){var t=this.x-o.x,e=this.y-o.y;return new Ul(t,e)}add(o){var t=this.x+o.x,e=this.y+o.y;return new Ul(t,e)}div(o){return new Ul(this.x/o,this.y/o)}add1(o,t){return new Ul(this.x+o,this.y+t)}mul(o){return new Ul(this.x*o,this.y*o)}cross(o){return this.x*o.y-this.y*o.x}getSin(){return this.y/this.length()}angle2(o){let t=this.y-o.y,e=this.x-o.x;return t=Math.abs(t-0)<10**-4?0:t,e=Math.abs(e-0)<10**-4?0:e,Math.atan2(t,e)}angleD2(o){return Uo.toDegrees(this.angle2(o))}angle(o){return Math.atan2(this.y-o.y,this.x-o.x)}angleX(o=Ul.ORIGIN){let t=this.angle(o);return t<0&&(t=Math.PI*2+t),t}angleD(o){return Uo.toDegrees(this.angle(o))}distance1(o){let t=o.x-this.x,e=o.y-this.y;return Vd.hypot(t,e)}distance2(o){let t=o.x-this.x,e=o.y-this.y;return t*t+e*e}rotateD(o,t){return this.rotate(o,Uo.toRadians(t))}rotate(o,t){let e=Math.cos(t),r=Math.sin(t),i=this.x-o.x,n=this.y-o.y,s=i*e+n*-r,a=i*r+n*e;return o.add1(s,a)}multiply3(o){let t=this.x*o.data[0]+this.y*o.data[3]+o.data[6],e=this.x*o.data[1]+this.y*o.data[4]+o.data[7];return new Ul(t,e)}multiply4(o){let t=this.x*o.data[0]+this.y*o.data[4]+o.data[12],e=this.x*o.data[1]+this.y*o.data[5]+o.data[13];return new Ul(t,e)}hashCode(){return this.hashed}equals(o,t){return o instanceof Ul?u6e(o.x,this.x,t)&&u6e(o.y,this.y,t):!1}equals1(o){return o?br.eq(this.x,o.x)&&br.eq(this.y,o.y):!1}equals2(o,t){return o instanceof Ul?Math.abs(this.x-o.x)<=t&&Math.abs(this.y-o.y)<=t:!1}similarEquals(o,t=.5){return Math.abs(this.x*.1-o.x*.1)<=t&&Math.abs(this.y*.1-o.y*.1)<=t}toString(){return"Vector [X="+this.x+", Y="+this.y+"]"}bbox(){let o=this.x,t=this.y;return new qg(o,o,t,t)}normalize(){if(this.x===0&&this.y===0)return new Ul(0,0);let o=this.x/this.length(),t=this.y/this.length();return new Ul(o,t)}regular(o=1e-4){let t=Math.round(1/o);return new Ul(Math.round(this.x*t)/t,Math.round(this.y*t)/t)}round(o=4){let t=10**(o|0);return new Ul(Math.round(this.x*t)/t,Math.round(this.y*t)/t)}mirrorX(o=Ul.ORIGIN){return new Ul(this.x,2*o.y-this.y)}mirrorY(o=Ul.ORIGIN){return new Ul(2*o.x-this.x,this.y)}mirrorCenter(o=Ul.ORIGIN){return new Ul(2*o.x-this.x,2*o.y-this.y)}clone(){return new Ul(this.x,this.y)}mirror(o=Ul.ORIGIN){return new Ul(2*o.x-this.x,2*o.y-this.y)}pointOnRays(o,t){let e=Uo.toRadians(o);return new Ul(this.x+Math.cos(e)*t,this.y+Math.sin(e)*t)}pointOnRays2(o,t){let e=o.angle(this);return new Ul(this.x+Math.cos(e)*t,this.y+Math.sin(e)*t)}scale(o){return new Ul(this.x*o,this.y*o)}},Ul.ORIGIN=new Ul(0,0),Ul.X_UNIT_VECTOR=new Ul(1,0),Ul.Y_UNIT_VECTOR=new Ul(0,1),Ul),T1t=(o=>(o[o.LEFT=0]="LEFT",o[o.CENTER=1]="CENTER",o[o.RIGHT=2]="RIGHT",o))(T1t||{}),I1t=(o=>(o[o.TOP=0]="TOP",o[o.CENTER=1]="CENTER",o[o.BOTTOM=2]="BOTTOM",o))(I1t||{}),Of,bO=(Of=class{constructor(o,t){this.horizontal=o,this.vertical=t}},Of.LT=new Of(0,0),Of.LC=new Of(0,1),Of.LB=new Of(0,2),Of.CT=new Of(1,0),Of.CC=new Of(1,1),Of.CB=new Of(1,2),Of.RT=new Of(2,0),Of.RC=new Of(2,1),Of.RB=new Of(2,2),Of),C1t=(o=>(o[o.INNER=0]="INNER",o[o.OUTER=1]="OUTER",o[o.SEPARATED=2]="SEPARATED",o[o.INTERSECTED=3]="INTERSECTED",o[o.EQ=4]="EQ",o[o.INSIDE_TOUCHED=5]="INSIDE_TOUCHED",o[o.OUTSIDE_TOUCHED=6]="OUTSIDE_TOUCHED",o))(C1t||{}),s2=class{constructor(){this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY}ext1(o){return this.minX=Math.min(this.minX,o.minX),this.maxX=Math.max(this.maxX,o.maxX),this.minY=Math.min(this.minY,o.minY),this.maxY=Math.max(this.maxY,o.maxY),this}ext2(o){return this.minX=Math.min(this.minX,o.x),this.maxX=Math.max(this.maxX,o.x),this.minY=Math.min(this.minY,o.y),this.maxY=Math.max(this.maxY,o.y),this}ext3(o){for(let t=0;t<o.length;t++){let e=o[t];this.ext2(e)}return this}ext4(o){return KN(o,(t,e)=>(this.ext2(e),!0)),this}ext5(o,t,e,r){return this.minX=Math.min(this.minX,o),this.maxX=Math.max(this.maxX,t),this.minY=Math.min(this.minY,e),this.maxY=Math.max(this.maxY,r),this}ext6(o,t){return this.minX=Math.min(this.minX,o),this.maxX=Math.max(this.maxX,o),this.minY=Math.min(this.minY,t),this.maxY=Math.max(this.maxY,t),this}ext7(o){if(o<0){let t=o*2;if(t<this.minX-this.maxX||t<this.minY-this.maxY)throw new Error("")}return this.minX-=o,this.maxX+=o,this.minY-=o,this.maxY+=o,this}ext8(o){let t=[];for(let e=0;e<o.length;e+=2)t.push(new Nt(o[e],o[e+1]));return this.ext3(t)}ext9(o,t,e,r){return this.minX=Math.min(this.minX,o),this.maxX=Math.max(this.maxX,o+e),this.minY=Math.min(this.minY,t),this.maxY=Math.max(this.maxY,t+r),this}ext10({x:o,y:t,width:e,height:r}){return this.ext9(o,t,e,r)}valid(){return isFinite(this.minX)&&isFinite(this.maxX)&&isFinite(this.minY)&&isFinite(this.maxY)}clear(){this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY}build(){return new qg(this.minX,this.maxX,this.minY,this.maxY)}build1(){return this.valid()?new qg(this.minX,this.maxX,this.minY,this.maxY):new qg(0,0,0,0)}},TW=new Float64Array(4),qg=class qT{static extendRect({x:t,y:e,width:r,height:i}){return new qT(t,t+r,e,e+i)}static extend1(t,e){if(t===null)return new qT(e.x,e.x,e.y,e.y);{let r=Math.min(t.minX,e.x),i=Math.max(t.maxX,e.x),n=Math.min(t.minY,e.y),s=Math.max(t.maxY,e.y);return new qT(r,i,n,s)}}static extend2(t,e){if(t){let r=Math.min(t.minX,e.minX),i=Math.max(t.maxX,e.maxX),n=Math.min(t.minY,e.minY),s=Math.max(t.maxY,e.maxY);return new qT(r,i,n,s)}else return e}static extend3(t,e){let r=Math.min(t.x,e.x),i=Math.max(t.x,e.x),n=Math.min(t.y,e.y),s=Math.max(t.y,e.y);return new qT(r,i,n,s)}static extend4(t,e,r){return new qT(t.x-e/2,t.x+e/2,t.y-r/2,t.y+r/2)}constructor(t,e,r,i){if(this.minX=fu.normal(t),this.maxX=fu.normal(e),this.minY=fu.normal(r),this.maxY=fu.normal(i),t>e||r>i)throw new Error(`min > max is not permitted: [${t}, ${e}, ${r}, ${i}]`)}get data(){return TW[0]=this.minX,TW[1]=this.maxX,TW[2]=this.minY,TW[3]=this.maxY,TW}isContains(t){return this.isContains1(t.x,t.y)}points(){return[this.LL(),this.LR(),this.UR(),this.UL(),this.LL()]}isContains1(t,e){return this.isContainsX(t)&&this.isContainsY(e)}isContains2(t,e){return this.isContainsX1(t)&&this.isContainsY1(e)}isContainsX(t){return t>=this.minX&&t<=this.maxX}isContainsX1(t){return br.greatereq(t,this.minX)&&br.lesseq(t,this.maxX)}isContainsY(t){return t>=this.minY&&t<=this.maxY}isContainsY1(t){return br.greatereq(t,this.minY)&&br.lesseq(t,this.maxY)}isIntersect(t){return!(this.maxX<t.minX||this.minX>t.maxX||this.maxY<t.minY||this.minY>t.maxY)}extendOfSize(t){return fu.positiveOr0(this.maxX-this.minX+t*2),fu.positiveOr0(this.maxY-this.minY+t*2),new qT(this.minX-t,this.maxX+t,this.minY-t,this.maxY+t)}isInside(t){return this.minX>=t.minX&&this.maxX<=t.maxX&&this.minY>=t.minY&&this.maxY<=t.maxY}isContainsBBox(t){return this.maxX>=t.maxX&&this.minX<=t.minX&&this.maxY>=t.maxY&&this.minY<=t.minY}isContainsBBox1(t){return br.greatereq(this.maxX,t.maxX)&&br.lesseq(this.minX,t.minX)&&br.greatereq(this.maxY,t.maxY)&&br.lesseq(this.minY,t.minY)}intersect(t){let e=Math.max(this.minX,t.minX),r=Math.min(this.maxX,t.maxX);if(e>r)return null;let i=Math.max(this.minY,t.minY),n=Math.min(this.maxY,t.maxY);return i>n?null:new qT(e,r,i,n)}intersection1(t){let e=Math.max(this.minX,t.minX),r=Math.min(this.maxX,t.maxX);if(br.greater(e,r))return null;e>r&&(r=e);let i=Math.max(this.minY,t.minY),n=Math.min(this.maxY,t.maxY);return br.greater(i,n)?null:(i>n&&(n=i),new qT(e,r,i,n))}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}UL(){return new Nt(this.minX,this.maxY)}UR(){return new Nt(this.maxX,this.maxY)}LL(){return new Nt(this.minX,this.minY)}LR(){return new Nt(this.maxX,this.minY)}center(){return new Nt(this.maxX-(this.maxX-this.minX)/2,this.maxY-(this.maxY-this.minY)/2)}area(){return this.width()*this.height()}transform(t){let e=new s2;return e.ext2(this.LL().multiply3(t)),e.ext2(this.LR().multiply3(t)),e.ext2(this.UR().multiply3(t)),e.ext2(this.UL().multiply3(t)),e.build()}transform4(t){let e=new s2;return e.ext2(this.LL().multiply4(t)),e.ext2(this.LR().multiply4(t)),e.ext2(this.UR().multiply4(t)),e.ext2(this.UL().multiply4(t)),e.build()}isSeparated(t){if(t==null||t==null)return!1;let e;this.minX>=t.minX?e=this.minX:e=t.minX;let r;if(this.maxX<=t.maxX?r=this.maxX:r=t.maxX,e>r)return!0;{let i;this.minY>=t.minY?i=this.minY:i=t.minY;let n;return this.maxY<=t.maxY?n=this.maxY:n=t.maxY,i>n}}relation(t){let e=0,r=0,i;this.minX>t.minX?(e++,i=this.minX):this.minX===t.minX?i=this.minX:(r++,i=t.minX);let n;if(this.maxX<t.maxX?(e++,n=this.maxX):this.maxX===t.maxX?n=this.maxX:(r++,n=t.maxX),i>n)return 2;{let s;this.minY>t.minY?(e++,s=this.minY):this.minY===t.minY?s=this.minY:(r++,s=t.minY);let a;return this.maxY<t.maxY?(e++,a=this.maxY):this.maxY===t.maxY?a=this.maxY:(r++,a=t.maxY),s>a?2:e===4?0:r===4?1:e===0&&r===0?4:i===n||s===a?6:e!==r?5:3}}zoom(t){let e=this.width(),r=this.height(),i=this.center();return t!=0&&(e/=t/2,r/=t/2),new qT(i.x-e,i.x+e,i.y-e,i.y+e)}toString(){return"BBox [minX="+this.minX+", maxX="+this.maxX+", minY="+this.minY+", maxY="+this.maxY+"]"}equals(t){return this.minY==t.minY&&this.minX==t.minX&&this.maxX==t.maxX&&this.maxY==t.maxY}extendSize(t,e){return Object.is(void 0,e)&&(e=t),qT.extend4(this.center(),this.width()+t,this.height()+e)}positionOnBBox(t,e=0){let r=this.center(),i=this.width()*e/2,n=this.height()*e/2,s=t.x-r.x,a=t.y-r.y;return s>i?a>n?bO.RT:a<-n?bO.RB:bO.RC:s<-i?a>n?bO.LT:a<-n?bO.LB:bO.LC:a>n?bO.CT:a<-n?bO.CB:bO.CC}bbox(){return this}},BQ=class pl{static mul(t,e,r,i,n,s){let a=0,l=0;for(let c=0;c<t;c++){for(let h=0;h<r;h++){let u=h,d=0;for(let p=0;p<e;p++)d+=i[l+p]*n[u],u+=r;s[a++]=d}l+=e}}constructor(t,e,r){this.m=fu.normal(t),this.n=fu.normal(e);let i=t*e;if(r.length===i){for(let n=0;n<r.length;n++)fu.normal(r[n]);this.data=r}else throw new Error("invalid matrix size")}mul(t){if(this.n===t.m){let e=new Array(this.m*t.n);return pl.mul(this.m,this.n,t.n,this.data,t.data,e),new pl(this.m,t.n,e)}else throw new Error("m !== p")}toString(){let t=[];t.push("Matrix ("),t.push(this.m.toString()),t.push(" x "),t.push(this.n.toString()),t.push(")");let e=0;for(let r=0;r<this.m;r++)for(let i=0;i<this.n;i++){let n=this.data[e++].toString();i===0?(t.push(`
`),t.push("	"),t.push(n)):(t.push(", "),t.push(n))}return t.join("")}static on(t,e,r){return t*e+r}initExpandMatrix(t){let e=this.m,r=this.n,i=r*2,n=new Array(e*i);for(let s=0;s<e;s++)for(let a=0;a<i;a++)a<r?n[pl.on(i,s,a)]=t[pl.on(r,s,a)]:a===e+s?n[pl.on(i,s,a)]=1:n[pl.on(i,s,a)]=0;return n}inverseMatrix(t,e,r){for(let i=0;i<e;i++){let n=t[pl.on(r,i,i)];for(let s=0;s<r;s++)t[pl.on(r,i,s)]/=n}return t}getMatrixRank(t,e,r){let i=Math.min(e,r);for(let n=0;n<e;n++){if(t[pl.on(r,n,n)]===0){let s=new Array(r),a;for(a=n;a<e;a++)if(t[pl.on(r,a,n)]!==0){$g.arraycopy(t,pl.on(r,a,0),s,0,r),$g.arraycopy(t,pl.on(r,n,0),t,pl.on(r,a,0),r),$g.arraycopy(s,0,t,pl.on(r,n,0),r);break}a>=e&&(i-=1)}if(!(i<e))for(let s=0;s<e;s++){if(s===n)continue;let a=t[pl.on(r,s,n)]/t[pl.on(r,n,n)];for(let l=0;l<r;l++)t[pl.on(r,s,l)]-=t[pl.on(r,n,l)]*a}}return i}getInverseMatrix(){if(this.m!==this.n)throw new Error("The matrix is an "+this.m+"x"+this.n+" order matrix, non-square matrix, please check!");function t(s){return br.lesseq(Math.abs(s),0)}let e=this.initExpandMatrix(this.data.slice(0)),r=this.n*2;function i(s,a){for(let l=0;l<r;l++){let c=e[pl.on(r,s,l)];e[pl.on(r,s,l)]=e[pl.on(r,a,l)],e[pl.on(r,a,l)]=c}}for(let s=0;s<this.m;s++){let a=Math.abs(e[pl.on(r,s,s)]),l=s;if(t(e[pl.on(r,s,s)]))for(let h=s+1;h<this.m;h++){if(t(e[pl.on(r,h,s)])){Math.abs(e[pl.on(r,h,s)])>a&&(a=Math.abs(e[pl.on(r,h,s)]),l=h);continue}i(s,h);break}if(t(e[pl.on(r,s,s)])){if(a===0)throw new Error("The matrix is a non-full rank matrix, please check!");console.warn("The matrix may be a non-full rank matrix, please check!"),l!==s&&i(s,l)}let c=1/e[pl.on(r,s,s)];for(let h=0;h<r;h++)e[pl.on(r,s,h)]*=c;for(let h=0;h<this.m;h++){if(s===h)continue;let u=e[pl.on(r,h,s)];for(let d=s;d<r;d++)e[pl.on(r,h,d)]-=e[pl.on(r,s,d)]*u}}let n=[];for(let s=0;s<this.m;s++)for(let a=this.n;a<r;a++)n[pl.on(this.n,s,a-this.n)]=e[pl.on(r,s,a)];return new pl(this.m,this.n,n)}getTransposeMatrix(){let t=new Array(this.data.length);for(let e=0;e<this.m;e++)for(let r=0;r<this.n;r++)t[r*this.n+e]=this.data[e*this.m+r];return new pl(this.n,this.m,t)}hashCode(){let t=0;for(let e of this.data)t+=e;return t}equals(t){return this===t?!0:t===null?!1:t instanceof pl?!(this.m!=t.m||this.n!=t.n||!$g.equals(this.data,t.data)):!1}},S1t=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],Lu,S5e=(Lu=class extends BQ{static translate(o,t,e){return new Lu([1,0,0,0,0,1,0,0,0,0,1,0,o,t,e,1])}static translate1(o){return new Lu([1,0,0,0,0,1,0,0,0,0,1,0,o.x,o.y,o.z,1])}static rotateX(o){let t=Math.cos(o),e=Math.sin(o);return new Lu([1,0,0,0,0,t,e,0,0,-e,t,0,0,0,0,1])}static rotateY(o){let t=Math.cos(o),e=Math.sin(o);return new Lu([t,0,-e,0,0,1,0,0,e,0,t,0,0,0,0,1])}static rotateZ(o){let t=Math.cos(o),e=Math.sin(o);return new Lu([t,e,0,0,-e,t,0,0,0,0,1,0,0,0,0,1])}static rotateAxis(o,t){o=o.normalize();let e=o.x,r=o.y,i=o.z,n=Math.sin(t),s=Math.cos(t);return new Lu([e*e*(1-s)+s,e*r*(1-s)+i*n,e*i*(1-s)-r*n,0,e*r*(1-s)-i*n,r*r*(1-s)+s,r*i*(1-s)+e*n,0,e*i*(1-s)+r*n,r*i*(1-s)-e*n,i*i*(1-s)+s,0,0,0,0,1])}static scale(o,t=o,e=o){return new Lu([o,0,0,0,0,t,0,0,0,0,e,0,0,0,0,1])}static flipX(){return new Lu([1,0,0,0,0,-1,0,0,0,0,1,0,0,0,0,1])}static flipY(){return new Lu([-1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}static rotateZForPoint(o,t){return o.equals1(Nt.ORIGIN)?Lu.rotateZ(t):Lu.translate(-o.x,-o.y,0).rotateZ(t).translate1(o.x,o.y,0)}static getMatrix4(o,t,e,r){let i=Math.cos(t),n=Math.sin(t),s=e*(o.x*i-o.y*n)+r.x,a=o.x*n+o.y*i+r.y,l=[e*i,n,0,0,-n*e,i,0,0,0,0,1,0,s,a,0,1];return new Lu(l)}constructor(o=S1t){super(4,4,o)}translate(o){return this.multiply4(Lu.translate1(o))}translate1(o,t,e){return this.multiply4(Lu.translate(o,t,e))}rotateX(o){return this.multiply4(Lu.rotateX(o))}rotateY(o){return this.multiply4(Lu.rotateY(o))}rotateZ(o){return this.multiply4(Lu.rotateZ(o))}scale(o,t=o,e=o){return this.multiply4(Lu.scale(o,t,e))}scale1(o){return this.multiply4(Lu.scale(o.x,o.y,o.z))}setOrigin(o,t,e){return Lu.translate(-o,-t,-e).multiply4(this).translate1(o,t,e)}setOrigin1(o){return this.setOrigin(o.x,o.y,o.z)}multiply4(o){let t=new Array(16);return BQ.mul(4,4,4,this.data,o.data,t),new Lu(t)}getInverseMatrix(){let o=super.getInverseMatrix();return new Lu(o.data)}getTransposeMatrix(){let o=super.getTransposeMatrix();return new Lu(o.data)}inverse(){let o=this.getInverseMatrix();return new Lu(o.data)}toMatrix3(){let o=this.data;return new tc([o[0],o[1],0,o[4],o[5],0,o[12],o[13],1])}},Lu.ORIGIN=new Lu,Lu);function IW(o){return I5e.normal(parseFloat(o))}var E1t=[1,0,0,0,1,0,0,0,1],Yh,tc=(Yh=class extends BQ{static translate(o,t){return new Yh([1,0,0,0,1,0,o,t,1])}static translate1(o){return this.translate(o.x,o.y)}static rotate(o){let t=Math.cos(o),e=Math.sin(o);return new Yh([t,e,0,-e,t,0,0,0,1])}static rotateD(o){return this.rotate(Uo.toRadians(o))}static scale(o,t=o){return new Yh([o,0,0,0,t,0,0,0,1])}static scale1(o,t){return new Yh([o,0,0,0,t,0,0,0,1])}static toDOMMatrix(o){let[t,e,,r,i,,n,s]=o.data;return`matrix(${[t,e,r,i,n,s].join(",")})`}static svgTrasform(o){let t=o.split(" "),e=null;return t.forEach(r=>{r=r.trim();let i=r.trim().replace(")","").split("("),n=i[0],s=i[1].split(",");switch(n){case"translate":let a=IW(s[0]),l=IW(s[1]);e=e?e.translate(a,l):Yh.translate(a,l);break;case"rotate":let c=IW(s[0]),h=IW(s[1]),u=IW(s[2]);e=e?e.setOrigin(h,u):Yh.translate(h,u),e=e.rotateD(c);break;default:return}}),e}constructor(o=E1t){super(3,3,o);let t=o[0],e=o[3],r=o[1],i=o[4];this.iScale=Math.sqrt(t*t+r*r),this.jScale=Math.sqrt(e*e+i*i)}isMirrored(){return this.det()<0}multiply3(o){let t=new Array(9);return BQ.mul(3,3,3,this.data,o.data,t),new Yh(t)}translate(o,t){return this.multiply3(Yh.translate(o,t))}translate1(o){return this.multiply3(Yh.translate1(o))}scale(o,t=o){return this.multiply3(Yh.scale(o,t))}scale1(o,t){return this.multiply3(Yh.scale1(o,t))}det(){return this.data[0]*this.data[4]-this.data[3]*this.data[1]}invert(){let o=this.getInverseMatrix();return new Yh(o.data)}rotateD(o){return this.multiply3(Yh.rotateD(o))}rotate(o){return this.multiply3(Yh.rotate(o))}resetOffset(){let o=this.data;return new Yh([o[0],o[1],0,o[3],o[4],0,0,0,1])}setOrigin(o,t){return Yh.translate(-o,-t).multiply3(this).translate(o,t)}setOrigin1(o){return this.setOrigin(o.x,o.y)}getInverseMatrix(){return new Yh(super.getInverseMatrix().data)}getTransposeMatrix(){let o=super.getTransposeMatrix();return new Yh(o.data)}toMatrix4(){let o=this.data;return new S5e([o[0],o[1],0,o[2],o[3],o[4],0,o[5],0,0,1,0,o[6],o[7],0,o[8]])}scaleNum(o){return!o||isNaN(o)?o:o*this.iScale}},Yh.ORIGIN=new Yh,Yh.MIRROR_Y=new Yh([1,0,0,0,-1,0,0,0,1]),Yh.MIRROR_X=new Yh([-1,0,0,0,1,0,0,0,1]),Yh.ROT_90=new Yh([0,1,0,-1,0,0,0,0,1]),Yh.ROT_N90=new Yh([0,-1,0,1,0,0,0,0,1]),Yh),O1t=(o=>(o[o.BUTT=0]="BUTT",o[o.ROUND=1]="ROUND",o[o.SQUARE=2]="SQUARE",o))(O1t||{}),hv=(o=>(o[o.CW=0]="CW",o[o.CCW=1]="CCW",o))(hv||{}),QW=class{},lPe=class vW{constructor(t,e,r){this.p1=t,this.p2=e,this.p3=r}barycentre(){return vW.barycentre(this.p1,this.p2,this.p3)}incentre(){return vW.incentre(this.p1,this.p2,this.p3)}static barycentre(t,e,r){let i=t.x+e.x+r.x,n=t.y+e.y+r.y;return new Nt(i/3,n/3)}static incentre(t,e,r){let i=e.sub(r).length(),n=t.sub(r).length(),s=t.sub(e).length(),a=i+n+s,l=i*t.x+n*e.x+s*r.x,c=i*t.y+n*e.y+s*r.y;return new Nt(l/a,c/a)}area(){return vW.area(this.p1,this.p2,this.p3)}static area(t,e,r){return this.area2(t.x,t.y,e.x,e.y,r.x,r.y)/2}static area2(t,e,r,i,n,s){return Math.abs(Vd.crossProd2(t,e,r,i,n,s))}scale(t,e){let r=tc.translate(-t.x,-t.y).scale(e).translate1(t),i=this.p1.multiply3(r),n=this.p2.multiply3(r),s=this.p3.multiply3(r);return new vW(i,n,s)}scaleOnBarycentre(t){return this.scale(this.barycentre(),t)}scaleOnIncentre(t){return this.scale(this.incentre(),t)}extend(t){let e=this.incentre(),r=this.p1.add(this.p2).sub(e).scale(1/2),i=r.length(),n=Nt.ORIGIN.pointOnRays2(r,i+t).length()/i;return this.scaleOnIncentre(n)}container(t){let e=this.p3.sub(this.p1),r=this.p2.sub(this.p1),i=t.sub(this.p1),n=e.dot(e),s=e.dot(r),a=e.dot(i),l=r.dot(r),c=r.dot(i),h=1/(n*l-s*s),u=(l*a-s*c)*h;if(u<0||u>1)return!1;let d=(n*c-s*a)*h;return d<0||d>1?!1:u+d<=1}};function cQ(){return{minDistance:Number.POSITIVE_INFINITY,start:null,end:null}}var $C=class cv{static getMinDistanceWithoutCross(t,e){let r=cQ();return cv.minLine(t,e,r),r.minDistance}static getMinDistance(t,e){return ZT(t,e)?0:this.getMinDistanceWithoutCross(t,e)}static getMinLineWithCross(t,e){let r=cQ();return cv.minLine(t,e,r),new bt(r.start,r.end)}static getMinLine(t,e){return cv.intersection(t,e)||this.getMinLineWithCross(t,e)}static getMinDistanceFromPoint(t,e){let r=cQ();if(e instanceof bt)this.point2LineMinLine(r,e,t);else if(e instanceof dr)this.point2ArcMinDistance(t,e,r);else throw new Error("not support");return r.minDistance}constructor(t,e){if(this.pt1=t,this.pt2=e,this.minline=cv.intersection(t,e),this.minline)this.minDistance=0;else{let r=cQ();cv.minLine(t,e,r),this.minline=new bt(r.start,r.end),this.minDistance=r.minDistance}}getDistance(){return this.minDistance}getLine(){return this.minline}static intersection(t,e){let r=ZT(t,e);if(r===0)return;let i=new Array;for(let n=0;n<r;n+=2){let s=new Nt(nt[n],nt[n+1]);i.push(s)}return i.length>1?new bt(i[0],i[1]):new bt(i[0],i[0])}static minLine(t,e,r){if(t instanceof bt&&e instanceof bt)return this.minDistanceForLines(t,e,r);if(t instanceof dr&&e instanceof bt)return this.minDistanceForLineAndArc(t,e,r);if(t instanceof bt&&e instanceof dr)return this.minDistanceForLineAndArc(e,t,r);if(t instanceof dr&&e instanceof dr)return this.minDistanceForArcs(t,e,r);throw new Error("not support")}static minDistanceForLines(t,e,r){[t.start(),t.end(),e.start(),e.end()].forEach((i,n)=>{n<2?this.point2LineMinLine(r,e,i):this.point2LineMinLine(r,t,i)})}static minDistanceForLineAndArc(t,e,r){this.point2LineMinLine(r,e,t.start()),this.point2LineMinLine(r,e,t.svgEnd);let i=cv.foot(e,t.center);e.bbox().extendOfSize(1e-8).isContains(i)&&this.point2ArcMinLine(r,t,i),this.point2ArcMinLine(r,t,e.start()),this.point2ArcMinLine(r,t,e.end())}static minDistanceForArcs(t,e,r){this.concentricArc(t,e,r),this.point2ArcMinDistance(e.start(),t,r),this.point2ArcMinDistance(e.svgEnd,t,r),this.point2ArcMinDistance(t.start(),e,r),this.point2ArcMinDistance(t.svgEnd,e,r),(WC(t,e.center)||WC(e,t.center))&&this.shortestLineForArcs(t,e,r)}static minLineForArcAndLine(t,e,r){let i=t.pointOn(r.angleD(t.center)),n=t.pointOn(t.center.angleD(r));this.arcShortestLine(t,e,r,i),this.arcShortestLine(t,e,r,n)}static arcInnerLineFootSegment(t,e,r){let i=r.distance1(t.center);if(i!==0){let n=t.rx*(r.y-t.center.y)/i+t.center.y,s=t.rx*(r.x-t.center.x)/i+t.center.x;i=t.rx-i,i<e.minDistance&&(e.minDistance=i,e.start=new Nt(s,n),e.end=r)}else i=t.rx-i,i<e.minDistance&&(e.minDistance=i,e.start=t.start(),e.end=r)}static shortestLineForArcs(t,e,r){let i=t.center.angleD(e.center),n=e.center.angleD(t.center),s=t.pointOn(i),a=t.pointOn(n),l=e.pointOn(i),c=e.pointOn(n);WC(t,s)&&(this.arcShortestLine(e,r,s,l),this.arcShortestLine(e,r,s,c)),WC(t,a)&&(this.arcShortestLine(e,r,a,l),this.arcShortestLine(e,r,a,c)),this.shortestLineForArcs1(t,e,r)}static shortestLineForArcs1(t,e,r){let i=e.start().sub(t.center).normalize(),n=e.end().sub(t.center).normalize(),s=t.start().sub(e.center).normalize(),a=t.end().sub(e.center).normalize(),l=t.center.add(i.mul(t.rx)),c=t.center.add(n.mul(t.rx)),h=e.center.add(s.mul(e.rx)),u=e.center.add(a.mul(e.rx));WC(t,l)&&br.greater(e.start().distance2(t.center),0)&&this.arcShortestLine(t,r,e.start(),l),WC(t,c)&&br.greater(e.end().distance2(t.center),0)&&this.arcShortestLine(t,r,e.end(),c),WC(e,h)&&br.greater(t.start().distance2(e.center),0)&&this.arcShortestLine(e,r,t.start(),h),WC(e,u)&&br.greater(t.end().distance2(e.center),0)&&this.arcShortestLine(e,r,t.end(),u)}static concentricArc(t,e,r){if(!(t.center.distance1(e.center)<1e-5&&t.rx===e.rx&&t.ry===e.ry))return;let i=t.start().distance1(e.svgEnd);i<r.minDistance&&(r.minDistance=i,r.start=t.start(),r.end=e.svgEnd),i=e.start().distance1(t.svgEnd),i<r.minDistance&&(r.minDistance=i,r.start=e.start(),r.end=t.svgEnd)}static point2ArcMinDistance(t,e,r){if(WC(e,t)){let i=e.pointOn(t.angleD(e.center)),n=e.pointOn(e.center.angleD(t));this.arcShortestLine(e,r,t,i),this.arcShortestLine(e,r,t,n)}else this.minLineSegment(r,e.start(),t),this.minLineSegment(r,e.svgEnd,t)}static point2ArcMinLine(t,e,r){if(WC(e,r)){let i=r.distance1(e.center);i>e.rx||i>e.ry?this.minLineForArcAndLine(e,t,r):this.arcInnerLineFootSegment(e,t,r)}}static point2LineMinLine(t,e,r){let i=cv.foot(e,r);e.bbox().extendOfSize(1e-8).isContains(i)?this.minLineSegment(t,i,r):(this.minLineSegment(t,e.start(),r),this.minLineSegment(t,e.end(),r))}static minLineSegment(t,e,r){let i=e.distance1(r);i<t.minDistance&&(t.minDistance=i,t.start=e,t.end=r)}static arcShortestLine(t,e,r,i){if(!WC(t,i))return;let n=r.distance1(i);n<e.minDistance&&(e.minDistance=n,e.start=r,e.end=i)}static foot(t,e){if(t.isPoint())return t.start();if(!br.eq(t.b,0)&&!br.eq(t.a,0)){let r=t.start(),i=t.direct,n=(e.x-r.x)*i.x+(e.y-r.y)*i.y;return new Nt(r.x+i.x*n,r.y+i.y*n)}else return br.eq(t.b,0)&&!br.eq(t.a,0)?new Nt(t.start().x,e.y):!br.eq(t.b,0)&&br.eq(t.a,0)?new Nt(e.x,t.start().y):e}};function WC(o,t){if(br.eq(o.sweepAngle,360))return!0;let e=Uo.regularD(t.angleD(o.center));return o.sweepAngle>0?(br.less(e,o.startAngle)&&(e+=360),br.greatereq(o.endAngle(),e)):(br.greater(e,o.startAngle)&&(e-=360),br.lesseq(o.endAngle(),e))}var A1t=[1,10,100,1e3],m6e="http://www.w3.org/2000/svg",g6e="http://www.w3.org/1999/xlink",y6e="http://www.w3.org/XML/1998/namespace",b6e="https://easyeda.com/",RWt=(function(){var o={svg:m6e,xlink:g6e,xml:y6e,c:b6e};return o[m6e]="svg",o[g6e]="xlink",o[y6e]="xml",o[b6e]="c",o})(),Yp=(function(){var o={RATLINES:9,MODEL3D:19,ALL:11,TOPSILKLAYER:3,TOPLAYER:1,TOPPASTERLAYER:5,TOPSOLDERLAYER:7,LIBBODY:99,PADSURFACE:100,BOARDOUTLINE:10,DOCUMENT:12,TOPASSEMBLY:13,MECHANICAL:15,TOPCOMPONENT:16,SUBSTRATE:18},t;for(t=21;t<53;t++)o["INNER"+(t-20)]=t;for(o.BOTTOMSILKLAYER=4,o.BOTTOMLAYER=2,o.BOTTOMPASTERLAYER=6,o.BOTTOMSOLDERLAYER=8,o.BOTTOMASSEMBLY=14,o.BOTTOMCOMPONENT=17,t=53;t<85;t++)o["BOARD"+(t-52)]=t;return o})(),DWt=(function(){var o={COPPERAREA:[1,2,21,22,23,24],PLANEZONE:[1,2,21,22,23,24],RECT:[1,2,3,4,5,6,7,8,12,13,14,15,21,22,23,24,99],TRACK:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],PAD:[11,1,2],VIA:[11],HOLE:[11],TEXT:[3,4,1,2,7,8,12,13,14,15,21,22,23,24],ARC:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],ELLIPSE:[3,4,12,13,14,15],CIRCLE:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],DIMENSION:[3,4,12,13,14,15],FOOTPRINT:[1,2],SOLIDREGION:[1,2,3,4,5,6,7,8,12,13,14,15,21,22,23,24,11,99,100],SVGNODE:[1,2,3,4,7,8,12,13,14,15],PROTRACTOR:[3,4,12,13,14,15],SHEET:[12,13,14,15]};o["3D"]=(function(){for(var i=[16,19,3,7,5,1],n=21;n<52;n++)i.push(n+32,n);return i.push(2,6,8,4,17),i})();var t,e,r;for(t in o)if(o.hasOwnProperty(t)&&(r=o[t],r.indexOf(21)>0&&r.indexOf(25)===-1))for(e=25;e<=52;e++)r.push(e);return o})(),Im=(function(){var o={1:"TopLayer",2:"BottomLayer",3:"TopSilkLayer",4:"BottomSilkLayer",5:"TopPasteMaskLayer",6:"BottomPasteMaskLayer",7:"TopSolderMaskLayer",8:"BottomSolderMaskLayer",9:"Ratlines",10:"BoardOutLine",11:"Multi-Layer",12:"Document",13:"TopAssembly",14:"BottomAssembly",15:"Mechanical",16:"TopComponents",17:"BottomComponents",18:"Substrate",19:"3DModel",99:"ComponentShapeLayer",100:"LeadShapeLayer"},t;for(t=21;t<53;t++)o[t]="Inner"+(t-20);for(t=53;t<85;t++)o[t]="Substrate"+(t-52);return o})(),wWt=(function(){var o=[],t=[];for(var e in Yp)if(Yp.hasOwnProperty(e)){if(e.match(/^BOARD\d+/))continue;o.push(Yp[e])}o.sort(),t.sort();var r={},i,n={21:"#999966",22:"#008000",23:"#00FF00",24:"#BC8E00",25:"#70DBFA",26:"#00CC66",27:"#9966FF",28:"#800080",29:"#008080",30:"#15935F",31:"#000080",32:"#00B400",33:"#2E4756",34:"#99842F",35:"#FFFFAA",36:"#99842F",37:"#2E4756",38:"#3535FF",39:"#8000BC",40:"#43AE5F",41:"#C3ECCE",42:"#728978",43:"#39503F",44:"#0C715D",45:"#5A8A80",46:"#2B937E",47:"#23999D",48:"#45B4E3",49:"#215DA1",50:"#4564D7",51:"#6969E9",52:"#9069E9"};o.forEach(function(a){switch(a){case Yp.TOPLAYER:i={name:Im[a],color:"#FF0000",darkColor:"#CC0000",visible:!0,active:!0,config:!0};break;case Yp.BOTTOMLAYER:i={name:Im[a],color:"#0000FF",darkColor:"#000080",visible:!0,active:!1,config:!0};break;case Yp.TOPSILKLAYER:i={name:Im[a],color:"#FFCC00",darkColor:"#806600",visible:!0,active:!1,config:!0};break;case Yp.BOTTOMSILKLAYER:i={name:Im[a],color:"#66CC33",darkColor:"#33661A",visible:!0,active:!1,config:!0};break;case Yp.TOPPASTERLAYER:i={name:Im[a],color:"#808080",darkColor:"#666666",visible:!0,active:!1,config:!0};break;case Yp.BOTTOMPASTERLAYER:i={name:Im[a],color:"#800000",darkColor:"#660000",visible:!0,active:!1,config:!0};break;case Yp.TOPSOLDERLAYER:i={name:Im[a],color:"#800080",darkColor:"#660066",visible:!0,active:!1,transparency:.3,config:!0};break;case Yp.BOTTOMSOLDERLAYER:i={name:Im[a],color:"#AA00FF",darkColor:"#8800CC",visible:!0,active:!1,transparency:.3,config:!0};break;case Yp.RATLINES:i={name:Im[a],color:"#6464FF",darkColor:"#5050CC",visible:!1,active:!1,config:!0};break;case Yp.BOARDOUTLINE:i={name:Im[a],color:"#FF00FF",darkColor:"#CC00CC",visible:!0,active:!1,config:!0};break;case Yp.ALL:i={name:Im[a],color:"#C0C0C0",darkColor:"#999999",visible:!0,active:!1,config:!0};break;case Yp.DOCUMENT:i={name:Im[a],color:"#FFFFFF",darkColor:"#CCCCCC",visible:!0,active:!1,config:!0};break;case Yp.TOPASSEMBLY:i={name:Im[a],color:"#33CC99",darkColor:"#33AA99",visible:!1,active:!1,config:!1};break;case Yp.BOTTOMASSEMBLY:i={name:Im[a],color:"#5555FF",darkColor:"#8888FF",visible:!1,active:!1,config:!1};break;case Yp.MECHANICAL:i={name:Im[a],color:"#F022F0",darkColor:"#F088F0",visible:!1,active:!1,config:!1};break;case Yp.MODEL3D:i={name:Im[a],color:"#66CCFF",visible:!1,active:!1,config:!1};break;case Yp.LIBBODY:i={name:Im[a],color:"#00CCCC",visible:!1,active:!1,config:!1};break;case Yp.PADSURFACE:i={name:Im[a],color:"#CC9999",visible:!1,active:!1,config:!1};break;default:a>=Yp.INNER1&&a<=Yp.INNER32?i={name:Im[a],color:n[a],darkColor:s(n[a]),visible:!1,active:!1,config:!1}:i=null;break}i&&(r[a]=i)}),r.Hole={config:!0,name:"Hole",darkColor:"#222222",color:"#222222"},r.DRCError={config:!0,name:"DRCError",color:"#FAD609",darkColor:"#FAD609"};function s(a){if(typeof a!="string"||!a.match(/#?([\da-f]{6})/i))return a;var l=parseInt(RegExp.$1,16),c=.5,h=Math.min(255,Math.round((l>>16)*c)),u=Math.min(255,Math.round((l>>8&255)*c)),d=Math.min(255,Math.round((l&255)*c)),p=((h<<16)+(u<<8)+d).toString(16);return"#"+("00000"+p).substr(-6).toUpperCase()}return r})(),P6e={BLANK:0,SCH:1,PART:2,PCB:3,FOOTPRINT:4,PRJ:5,SUBPART:6,SPICESYMBOL:7,SUBCKT:8,NETLIST:9,WAVEFORM:10,SCHLIB3D:11,PHOTOVIEW:12,SCHMODULE:13,PCBMODULE:14,VIEW3D:15,PCBLIB3D:16,BLOCK_SYMBOL:17,NETFLAG:18,NETPORT:19,SHEET_SYMBOL:20,NONEELEC_SYMBOL:21,SHORT_SYMBOL:22,FOOTPRINTVIEW:23,CNCPRINTVIEW:24,PCB2D:31,PCB3D:32},LWt=(function(){var o={};for(let t in P6e)o[P6e[t]]=t;return o})(),oee=Math.PI*2,FQ=Math.PI/2,MWt=Math.sin(Math.PI/180);function _1t(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=A1t[t]||Math.pow(10,t)||10;if(e){var i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(i+o)}else return Math.round(o*r+1e-10)/r}function E5e(o,t,e){var r=o-t;return e||(e=1e-10),(r>0?r:-r)<e}function v1t(o,t,e){var r=h(o)&&h(t)&&h(e);if(!r)return console.warn("Bad arguments"),null;var i=t.x-e.x>0?t.x:e.x,n=t.y-e.y>0?t.y:e.y,s=t.x-e.x>0?e.x:t.x,a=t.y-e.y>0?e.y:t.y,l=o.x,c=o.y;return l<=i+.001&&l>=s-.001&&c<=n+.001&&c>=a-.001;function h(u){return u?(u.x=Number(u.x),u.y=Number(u.y),isNaN(u.x)||isNaN(u.y)?(console.warn("Can not convert to Number, NaN found"),!1):!0):(console.warn("Empty input!"),!1)}}function x1t(o,t,e,r,i,n){var s=(i-e)*(o-e)+(n-r)*(t-r),a=(i-e)*(i-e)+(n-r)*(n-r),l=s/a,c=e+(i-e)*l,h=r+(n-r)*l;return s<=0?Math.sqrt((o-e)*(o-e)+(t-r)*(t-r)):s>=a?Math.sqrt((o-i)*(o-i)+(t-n)*(t-n)):Math.sqrt((o-c)*(o-c)+(h-t)*(h-t))}function R1t(o,t,e){return v1t(o,t,e)?E5e((o.x-t.x)*(e.y-t.y),(e.x-t.x)*(o.y-t.y),.001):!1}var xW=1e-4,nt=new Float64Array(100);function ZT(o,t){if(o instanceof bt&&t instanceof bt)return M9(o,t);if(o instanceof dr&&t instanceof bt)return cPe(o,t);if(o instanceof bt&&t instanceof dr)return cPe(t,o);if(o instanceof dr&&t instanceof dr)return A5e(o,t);if(o instanceof ki&&t instanceof ki)return EQ(o,t);if(o instanceof ki&&t instanceof bt)return EQ(o,new ki([t.start(),t.end()]));if(o instanceof bt&&t instanceof ki)return EQ(new ki([o.start(),o.end()]),t);if(o instanceof ki&&t instanceof dr)return A6e(t,o);if(o instanceof dr&&t instanceof ki)return A6e(o,t);throw new Error("not supported operation")}function D1t(o,t){let e=o.bbox();if(e.isContainsY1(t)){let r=new bt(new Nt(e.minX-1,t),new Nt(e.maxX+1,t));return M9(r,o)>0?1:0}else return 0}function w1t(o,t){if(o.rx===o.ry){let e=o.bbox();if(e.isContainsY1(t)){let r=new bt(new Nt(e.minX-1,t),new Nt(e.maxX+1,t));return VQ(o,r)>0?1:0}else return 0}else throw new Error("not supported operation")}function T6e(o,t){let e=o.bbox();return e.isContainsY1(t)&&EQ(new ki([new Nt(e.minX-1,t),new Nt(e.maxX+1,t)]),o)>0?1:0}function I6e(o,t,e){return isFinite(t)&&isFinite(e)?o.isContains2(t,e):!1}function L1t(o,t){let e=t.length(),r=Vd.crossProd3(t.start(),t.end(),o.start())/e,i=Vd.crossProd3(t.start(),t.end(),o.end())/e;return Math.abs(r)<1e-8||Math.abs(i)<1e-8||r*i<0}function M9(o,t){let e=o.bbox().intersection1(t.bbox());if(!e)return 0;if(o.isPoint())if(t.isPoint()){let r=e.center();return nt[0]=r.x,nt[1]=r.y,2}else return C6e(t,o,e);else{if(t.isPoint())return C6e(o,t,e);{let r=function(T,I){e.isContains2(T,I)&&(nt[P++]=T,nt[P++]=I)};if(!L1t(o,t))return 0;let i=o.start().x,n=o.start().y,s=o.end().x,a=o.end().y,l=t.start().x,c=t.start().y,h=t.end().x,u=t.end().y,d=t.length(),p=Vd.crossProd2(i,n,l,c,h,u)/d,m=Vd.crossProd2(s,a,l,c,h,u)/d;if(p*m>0&&!br.eq(p,0)&&!br.eq(m,0))return 0;let g=o.length(),y=Vd.crossProd2(l,c,i,n,s,a)/g,b=Vd.crossProd2(h,u,i,n,s,a)/g;if(y*b>0&&!br.eq(y,0)&&!br.eq(b,0))return 0;let P=0;if(br.eq(p,0)&&br.eq(m,0)){let T=e.UL(),I=e.UR(),C=e.LL(),E=e.LR();if(br.eq(e.width(),0))br.eq(e.height(),0)?(nt[P++]=T.x,nt[P++]=T.y):(nt[P++]=T.x,nt[P++]=T.y,nt[P++]=C.x,nt[P++]=C.y);else if(br.eq(e.height(),0))nt[P++]=T.x,nt[P++]=T.y,nt[P++]=I.x,nt[P++]=I.y;else{let O=lPe.area2(T.x,T.y,l,c,h,u),_=lPe.area2(I.x,I.y,l,c,h,u);O<_?(nt[P++]=T.x,nt[P++]=T.y,nt[P++]=E.x,nt[P++]=E.y):(nt[P++]=I.x,nt[P++]=I.y,nt[P++]=C.x,nt[P++]=C.y)}}else if(br.eq(p,0))r(i,n);else if(br.eq(m,0))r(s,a);else{let T=Math.abs(p/(p-m));r(i+(s-i)*T,n+(a-n)*T)}return P}}}function C6e(o,t,e){let r=t.start(),i=t.end(),n=Vd.crossProd3(o.start(),o.end(),t.start()),s=Vd.crossProd3(o.start(),o.end(),t.end());if(n*s<0){let a=e.center();return nt[0]=a.x,nt[1]=a.y,2}else if(Math.abs(n)<Math.abs(s)){if(br.eq(n/o.length(),0))return nt[0]=r.x,nt[1]=r.y,2}else if(br.eq(s/o.length(),0))return nt[0]=i.x,nt[1]=i.y,2;return 0}function VQ(o,t){let e=o.bbox().intersection1(t.bbox());if(e!=null){e=e.extendOfSize(xW);let r=o.center.x,i=o.center.y,n=o.rx,s=o.rx2,a=t.start().x,l=t.start().y,c=t.end().x,h=t.end().y,u=o.center.distance1(t.start()),d=o.center.distance1(t.end()),p=br.eq(u,n)?0:u>n?1:-1,m=br.eq(d,n)?0:d>n?1:-1,g=0;if(p===-1&&m===-1)return 0;if(p===0&&m===0)nt[g++]=a,nt[g++]=l,nt[g++]=c,nt[g++]=h;else if(p===1&&m===1){let y=$C.foot(t,o.center),b=y.distance1(o.center);if(br.greater(b,n))return 0;if(br.eq(b,n))br.eq(t.distance2(o.start()),0)?(nt[g++]=o.start().x,nt[g++]=o.start().y,nt[g++]=o.start().x,nt[g++]=o.start().y):br.eq(t.distance2(o.end()),0)?(nt[g++]=o.end().x,nt[g++]=o.end().y,nt[g++]=o.end().x,nt[g++]=o.end().y):(nt[g++]=y.x,nt[g++]=y.y,nt[g++]=y.x,nt[g++]=y.y);else{g=O5e(r,i,a,l,c,h,g,y);let P=nt[g-2],T=nt[g-1];g-=2;let I=Vd.distance1(r,i,P,T);if(br.eq(I,n))nt[g++]=P,nt[g++]=T,nt[g++]=P,nt[g++]=T;else if(I<n)g=eg(s,r,i,a,l,P,T,g),g=eg(s,r,i,P,T,c,h,g);else return 0}}else if(p===-1||m===-1)g=eg(s,r,i,a,l,c,h,g);else{let y=$C.foot(t,o.center),b=y.distance1(o.center);if(br.eq(b,n)){let P=function(C){return I6e(e,C.x,C.y)&&bp(o,C)},T=o.start(),I=o.end();if(p===0){let C=t.start();if(P(C))return nt[g++]=C.x,nt[g++]=C.y,nt[g++]=C.x,nt[g++]=C.y,g;if(P(y))return nt[g++]=y.x,nt[g++]=y.y,nt[g++]=y.x,nt[g++]=y.y,g;if(br.eq(t.distance2(T),0)&&P(T))return nt[g++]=T.x,nt[g++]=T.y,nt[g++]=T.x,nt[g++]=T.y,g;if(br.eq(t.distance2(I),0)&&P(I))return nt[g++]=I.x,nt[g++]=I.y,nt[g++]=I.x,nt[g++]=I.y,g;if(u<=n)g=eg(s,r,i,y.x,y.y,c,h,g),g===2&&(nt[g++]=nt[0],nt[g++]=nt[1]);else if(b<n){if(g=eg(s,r,i,y.x,y.y,c,h,g),g===2&&P(new Nt(nt[0],nt[1])))return nt[g++]=nt[0],nt[g++]=nt[1],g;g=eg(s,r,i,y.x,y.y,a,l,0),g===2&&(nt[g++]=nt[0],nt[g++]=nt[1])}}else{let C=t.end();if(P(C))return nt[g++]=C.x,nt[g++]=C.y,nt[g++]=C.x,nt[g++]=C.y,g;if(P(y))return nt[g++]=y.x,nt[g++]=y.y,nt[g++]=y.x,nt[g++]=y.y,g;if(br.eq(t.distance2(T),0)&&P(T))return nt[g++]=T.x,nt[g++]=T.y,nt[g++]=T.x,nt[g++]=T.y,g;if(br.eq(t.distance2(I),0)&&P(I))return nt[g++]=I.x,nt[g++]=I.y,nt[g++]=I.x,nt[g++]=I.y,g;if(d<=n)g=eg(s,r,i,y.x,y.y,a,l,g),g===2&&(nt[g++]=nt[0],nt[g++]=nt[1]);else if(b<n){if(g=eg(s,r,i,y.x,y.y,a,l,g),g===2&&P(new Nt(nt[0],nt[1])))return nt[g++]=nt[0],nt[g++]=nt[1],g;g=eg(s,r,i,y.x,y.y,c,h,0),g===2&&(nt[g++]=nt[0],nt[g++]=nt[1])}}}else if(p===0){let P=t.start();nt[g++]=P.x,nt[g++]=P.y,(a-y.x)*(c-y.x)+(l-y.y)*(h-y.y)<0&&(g=eg(s,r,i,y.x,y.y,c,h,g))}else{let P=t.end();nt[g++]=P.x,nt[g++]=P.y,(a-y.x)*(c-y.x)+(l-y.y)*(h-y.y)<0&&(g=eg(s,r,i,y.x,y.y,a,l,g))}}if(g>0){let y=0;for(let b=0;b<g;b+=2){let P=nt[b],T=nt[b+1];isFinite(P)&&isFinite(T)&&I6e(e,P,T)&&bp(o,new Nt(P,T))&&(nt[y++]=P,nt[y++]=T)}return y}else return 0}else return 0}function M1t(o,t){if(o.bbox()){let e=o.center.x,r=o.center.y,i=o.rx2,n=t.start().x,s=t.start().y,a=t.end().x,l=t.end().y,c=o.center.distance2(t.start()),h=o.center.distance2(t.end()),u=br.eq(c,i)?0:c>i?1:-1,d=br.eq(h,i)?0:h>i?1:-1,p=0;if(u===-1&&d===-1)return 0;if(u===0&&d===0)nt[p++]=n,nt[p++]=s,nt[p++]=a,nt[p++]=l;else if(u===1&&d===1){let m=$C.foot(t,o.center),g=m.distance2(o.center);if(br.greater(g,i))return 0;if(br.eq(g,i)){let y=m.distance2(o.start()),b=m.distance2(o.end());br.eq(y,0)?(nt[p++]=o.start().x,nt[p++]=o.start().y):br.eq(b,0)?(nt[p++]=o.end().x,nt[p++]=o.end().y):(nt[p++]=m.x,nt[p++]=m.y)}else{p=O5e(e,r,n,s,a,l,p,m);let y=nt[p-2],b=nt[p-1],P=Vd.distance2(e,r,y,b);if(p-=2,br.eq(P,i))nt[p++]=y,nt[p++]=b;else if(P<i)p=eg(i,e,r,n,s,y,b,p),p=eg(i,e,r,y,b,a,l,p);else return 0}}else if(u===-1||d===-1)p=eg(i,e,r,n,s,a,l,p);else{let m=$C.foot(t,o.center);u===0?(nt[p++]=t.start().x,nt[p++]=t.start().y,br.neq(m.distance2(t.start()),0)&&(n-m.x)*(a-m.x)+(s-m.y)*(l-m.y)<0&&(p=eg(i,e,r,m.x,m.y,a,l,p))):(nt[p++]=t.end().x,nt[p++]=t.end().y,br.neq(m.distance2(t.end()),0)&&(n-m.x)*(a-m.x)+(s-m.y)*(l-m.y)<0&&(p=eg(i,e,r,m.x,m.y,n,s,p)))}if(p>0){let m=0;for(let g=0;g<p;g+=2){let y=nt[g],b=nt[g+1];isFinite(y)&&isFinite(b)&&(nt[m++]=y,nt[m++]=b)}return m}else return 0}else return 0}function eg(o,t,e,r,i,n,s,a){if(i==s){let T=o-(i-e)*(i-e);if(br.greater(T,0)){let I=Math.sqrt(T),C=t-I,E=t+I,O=Math.min(r,n),_=Math.max(r,n);return C>=O&&C<=_&&(nt[a++]=C,nt[a++]=i),E>=O&&E<=_&&(nt[a++]=E,nt[a++]=i),a}}let l=Vd.distance2(r,i,t,e)-o;if(l===0)return nt[a++]=r,nt[a++]=i,a;let c=Vd.distance2(n,s,t,e)-o;if(c===0)return nt[a++]=n,nt[a++]=s,a;let h=r,u=i,d=n,p=s,m=NaN,g=NaN,y=Number.POSITIVE_INFINITY,b=0;for(;y!==0;){b++;let T=Math.max(Math.min(Math.abs(l)/(Math.abs(l)+Math.abs(c)),.75),.25);if(m=h+(d-h)*T,g=u+(p-u)*T,h===m&&u===g||d===m&&p===g){Math.abs(l)>Math.abs(c)?(m=d,g=p,y=c):(m=h,g=u,y=l);break}else y=Vd.distance2(m,g,t,e)-o,y<0&&l>c||y>0&&l<c?(d=m,p=g,c=y):(h=m,u=g,l=y)}let P=Math.sqrt(o)-Vd.distance1(m,g,t,e);return(br.eq(0,y)||br.eq(0,P))&&(nt[a++]=m,nt[a++]=g),a}function O5e(o,t,e,r,i,n,s,a){let l=Vd.dotProd2(e,r,i,n,o,t),c=Vd.dotProd2(i,n,e,r,o,t);if(l>=0)return nt[s++]=i,nt[s++]=n,s;if(c>=0)return nt[s++]=e,nt[s++]=r,s;if(Vd.crossProd2(e,r,i,n,o,t)==0)return nt[s++]=o,nt[s++]=t,s;{let h=NaN,u=NaN,d=e,p=r,m=i,g=n,y=Vd.distance2(e,r,o,t),b=Vd.distance2(i,n,o,t),P=Number.POSITIVE_INFINITY,T=0;for(;P>0&&(T++,h=d+(m-d)*.5,u=p+(g-p)*.5,!(y==b||d==h&&p==u||m==h&&g==u));){P=Vd.distance2(h,u,o,t);let I=Vd.dotProd2(d,p,h,u,o,t);if(I==0)break;I<0?(m=h,g=u,b=P):(d=h,p=u,y=P)}return Vd.distance2(h,u,o,t)<Vd.distance2(a.x,a.y,o,t)?(nt[s++]=h,nt[s++]=u):(nt[s++]=a.x,nt[s++]=a.y),s}}function cPe(o,t){if(o.rx===o.ry)return VQ(o,t);throw new Error("not supported")}function N1t(o,t){if(o.rx===o.ry)return M1t(o,t);throw new Error("not supported")}function A5e(o,t){if(o.bbox().intersection1(t.bbox())!=null){if(o.rx===o.ry&&t.rx===t.ry)return k1t(o,t);throw new Error("not supported operation")}return 0}function k1t(o,t){let e=o.center.x,r=o.center.y,i=t.center.x,n=t.center.y,s=o.rx,a=t.rx,l=o.rx2,c=t.rx2,h=o.center.distance1(t.center),u=Math.abs(s-a),d=s+a;if(br.greater(h,d)||br.less(h,u))return 0;if(br.eq(u+h,0)){let p=0,m;return bp(o,t.start())&&(nt[p]=t.start().x,nt[p+1]=t.start().y,p+=2,m=t.start()),bp(o,t.end())&&(nt[p]=t.end().x,nt[p+1]=t.end().y,p+=2,m=t.end()),p===0?(bp(t,o.start())&&(nt[p]=o.start().x,nt[p+1]=o.start().y,p+=2),bp(t,o.end())&&(nt[p]=o.end().x,nt[p+1]=o.end().y,p+=2)):p===2&&(!m.equals1(o.start())&&bp(t,o.start())&&(nt[p]=o.start().x,nt[p+1]=o.start().y,p+=2),!m.equals1(o.end())&&bp(t,o.end())&&(nt[p]=o.end().x,nt[p+1]=o.end().y,p+=2)),p}else if(br.eq(h,d)){if(S6e(o,t))return 4;let p=new bt(o.center,t.center),m=VQ(t,p);return m=E6e(o,m),m!==0?m:(m=VQ(o,p),E6e(t,m))}else if(br.eq(h,u)){if(S6e(o,t))return 4;if(s>a){let p=(s-a)/s;return nt[0]=e+(i-e)/p,nt[1]=r+(n-r)/p,O6e(o,t,2)}else{let p=(a-s)/a;return nt[0]=i+(e-i)/p,nt[1]=n+(r-n)/p,O6e(o,t,2)}}else{let p=(o.center.distance2(t.center)-c+l)/(h*2)/h,m=(i-e)*p+e,g=(n-r)*p+r,y=i-e,b=n-r,P=Math.max(s,a),T,I,C,E;if(Math.abs(y)<Math.abs(b)){let v=y/-b,D=g-v*m;T=m-P,I=v*T+D,C=m+P,E=v*C+D}else{let v=b/-y,D=m-v*g;I=g-P,T=v*I+D,E=g+P,C=v*E+D}let O=eg(l,e,r,T,I,m,g,0);if(O=eg(l,e,r,m,g,C,E,O),O!==4)throw new Error("cnt !== 4");let _=new Nt(nt[0],nt[1]),x=new Nt(nt[2],nt[3]);if(bp(o,_)&&bp(t,_))return bp(o,x)&&bp(t,x)?4:sv(o.start(),t,x,_)?(nt[2]=o.start().x,nt[3]=o.start().y,4):sv(o.end(),t,x,_)?(nt[2]=o.end().x,nt[3]=o.end().y,4):sv(t.start(),o,x,_)?(nt[2]=t.start().x,nt[3]=t.start().y,4):sv(t.end(),o,x,_)?(nt[2]=t.end().x,nt[3]=t.end().y,4):2;if(bp(o,x)&&bp(t,x))return sv(o.start(),t,_,x)?(nt[0]=o.start().x,nt[1]=o.start().y,4):sv(o.end(),t,_,x)?(nt[0]=o.end().x,nt[1]=o.end().y,4):sv(t.start(),o,_,x)?(nt[0]=t.start().x,nt[1]=t.start().y,4):sv(t.end(),o,_,x)?(nt[0]=t.end().x,nt[1]=t.end().y,4):(nt[0]=nt[2],nt[1]=nt[3],2);{let v=function(H,z){if(br.eq(H.distance1(z.center),z.rx)&&bp(z,H)){if(H.distance2(_)<H.distance2(x)){if(D)return;D=!0}else{if(w)return;w=!0}nt[F++]=H.x,nt[F++]=H.y}},D=!1,w=!1,F=0;return v(o.start(),t),v(o.end(),t),v(t.start(),o),v(t.end(),o),F}}}function sv(o,t,e,r){return br.eq(o.distance1(t.center),t.rx)&&bp(t,o)&&o.distance2(e)<o.distance2(r)}function S6e(o,t){return br.eq(t.start().distance1(o.center),o.rx)&&bp(o,t.start())?(nt[0]=t.start().x,nt[1]=t.start().y,nt[2]=t.start().x,nt[3]=t.start().y,!0):br.eq(t.end().distance1(o.center),o.rx)&&bp(o,t.end())?(nt[0]=t.end().x,nt[1]=t.end().y,nt[2]=t.end().x,nt[3]=t.end().y,!0):br.eq(o.start().distance1(t.center),t.rx)&&bp(t,o.start())?(nt[0]=o.start().x,nt[1]=o.start().y,nt[2]=o.start().x,nt[3]=o.start().y,!0):br.eq(o.end().distance1(t.center),t.rx)&&bp(t,o.end())?(nt[0]=o.end().x,nt[1]=o.end().y,nt[2]=o.end().x,nt[3]=o.end().y,!0):!1}function E6e(o,t){if(t===0)return 0;let e=nt[0],r=nt[1];return bp(o,new Nt(e,r))?(nt[0]=e,nt[1]=r,nt[2]=e,nt[3]=r,4):0}function O6e(o,t,e){if(e===0)return 0;let r=nt[0],i=nt[1],n=new Nt(r,i);return bp(o,n)&&bp(t,n)?(nt[0]=r,nt[1]=i,nt[2]=r,nt[3]=i,4):0}function xN(o,t){return Math.abs(o-t)<=1e-6}function bp(o,t){let e=o.bbox();if(t.x-e.minX>-xW&&t.x-e.maxX<xW&&t.y-e.minY>-xW&&t.y-e.maxY<xW){let r=Uo.regularD(t.angleD(o.center));return xN(r,o.startAngle)||xN(r,o.startAngle+360)||xN(r,o.startAngle-360)||xN(r,o.endAngle())||xN(r,o.endAngle()+360)||xN(r,o.endAngle()-360)?!0:o.sweepAngle>0?(br.less(r,o.startAngle)&&(r+=360),br.greatereq(o.endAngle(),r)):(br.greater(r,o.startAngle)&&(r-=360),br.lesseq(o.endAngle(),r))}else return!1}function B1t(o,t){let e=o[1].x-o[0].x,r=o[1].y-o[0].y,i=t[1].x-t[0].x,n=t[1].y-t[0].y;if(e===0&&i!==0||e!==0&&i===0)return!1;if(e===0&&i===0)return!0;let s=r/e,a=n/i;return E5e(s,a,Math.sin(Math.PI/180))}function F1t(o,t,e){var r,i=+t.x,n=+t.y,s=+e.x,a=+e.y,l=+o.x,c=+o.y,h=s-i,u=a-n,d=l-i,p=c-n,m,g,y,b,P,T;return h===0&&u===0?{d:Math.sqrt(d*d+p*p),point:new Nt(i,n)}:(r=(d*h+p*u)/(h*h+u*u),r<0?{d:Math.sqrt(d*d+p*p),point:new Nt(i,n)}:r>1?(m=l-s,g=c-a,{d:Math.sqrt(m*m+g*g),point:new Nt(s,a)}):(P=i+r*h,T=n+r*u,y=l-P,b=c-T,{d:Math.sqrt(y*y+b*b),point:new Nt(P,T)}))}function XC(o,t){if(!o||!t||o.length!=t.length)return!1;let e="equals1";return!o.some((r,i)=>{let n=t[i],s=!1;return r&&n&&typeof r=="object"&&typeof n=="object"?typeof r[e]=="function"&&G1t(r,n)?s=!r[e].call(r,n):s=!(r===n||r.toString()===n.toString()):typeof r=="number"&&typeof n=="number"?s=!(V1t(r,n)||Number.isNaN(r)&&Number.isNaN(n)):s=r!==n,s})}function V1t(o,t,e=5){return Math.abs(o-t)*Math.pow(10,e)<1}function G1t(o,t){return!o||!t||typeof o!="object"||typeof t!="object"?o===t:o.constructor===t.constructor}var Us=new Float64Array(100);function EQ(o,t){if(o.bbox().extendOfSize(br.eps).isSeparated(t.bbox()))return 0;let e=[[o,t]],r=(o.controls.length-1)*(t.controls.length-1)*8,i=0,n=Number.POSITIVE_INFINITY;for(;e.length!==0;){let s=function(V){D=Math.min(D,V),w=Math.max(w,V)},a=function(V,W){let L=M9(V,W);if(L===0)throw new Error("cnt === 0");for(let k=0;k<L;k+=2)s(nt[k])};if(i>r){for(let V=i-2;V>=2;V-=2)for(let W=V-2;W>=0;W-=2)if(br.eq(Us[V],Us[W])&&br.eq(Us[V+1],Us[W+1])){Us[W]=(Us[V]+Us[W])/2,Us[W+1]=(Us[V+1]+Us[W+1])/2;for(let L=i-3;L>=V;L--)Us[L]=Us[L+2];i-=2;break}if(i>r){i=0;let V=t.start(),W=new Float64Array(8);o.getPercent(V)!==null&&(W[i++]=V.x,W[i++]=V.y);let L=t.end();o.getPercent(L)!==null&&(W[i++]=L.x,W[i++]=L.y);let k=o.start();t.getPercent(k)!==null&&(W[i++]=k.x,W[i++]=k.y);let N=o.end();return t.getPercent(N)!==null&&(W[i++]=N.x,W[i++]=N.y),nt.set(W),i}}let[l,c]=e.pop(),h=l.controls,u=c.controls;if(h.length===2&&u.length===2){let V=M9(new bt(h[0],h[1]),new bt(u[0],u[1]));for(let W=0;W<V;W++)Us[i++]=nt[W];continue}let d=h[0],p=h[h.length-1];d.equals1(p)&&(p=d.add1(1,0));let m=p.y-d.y,g=d.x-p.x,y=-m*d.x-g*d.y,b=Math.sqrt(1/(m**2+g**2));m*=b,g*=b,y*=b;let P=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY;if(h.forEach(V=>{let W=m*V.x+g*V.y+y;W<P&&(P=W),W>T&&(T=W)}),br.eq(P,T)){if(c.controls.length===2){let V=M9(new bt(l.start(),l.end()),new bt(c.start(),c.end()));for(let W=0;W<V;W++)Us[i++]=nt[W];if(V!==0)continue}l=new ki([h[0],h[h.length-1]]),h=l.controls}let I=u.map(V=>{let W=m*V.x+g*V.y+y,L=Math.abs(W);return L<n&&(n=L),W}),C=0;for(let V of I){if(br.less(V,P))C=C|1;else if(br.greater(V,T))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let E=0,O=0,_=p.x-d.x,x=p.y-d.y,v=Math.sqrt(1/(_**2+x**2));_*=v,x*=v;for(let V=1;V<h.length;V++){let W=h[V],L=(W.x-d.x)*_+(W.y-d.y)*x;L<E?E=L:L>O&&(O=L)}C=0;for(let V of u){let W=(V.x-d.x)*_+(V.y-d.y)*x;if(br.less(W,E))C=C|1;else if(br.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let D=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY;n/=2,n<=br.eps&&(n=br.eps),P-=n,T+=n,I.forEach((V,W)=>{V>=P&&V<=T&&s(W/(I.length-1))});let F=new bt(new Nt(0,P),new Nt(1,P)),H=new bt(new Nt(0,T),new Nt(1,T));for(let V=0;V<I.length-1;V++){let W=new Nt(V/(I.length-1),I[V]),L=W.y<P?1:W.y>T?2:3;for(let k=0;k<I.length;k++){let N=new Nt(k/(I.length-1),I[k]),U=N.y<P?1:N.y>T?2:3;L!==U&&(L===1?U===2?(a(new bt(W,N),F),a(new bt(W,N),H)):a(new bt(W,N),F):L===2?U===1?(a(new bt(W,N),F),a(new bt(W,N),H)):a(new bt(W,N),H):U===1?a(new bt(W,N),F):a(new bt(W,N),H))}}D!==0&&(c=c.clip(D)[1]),w!==1&&(c=c.clip((w-D)/(1-D))[0]);let z=c.bbox();if(br.eq(z.minX,z.maxX)&&br.eq(z.minY,z.maxY)){C=0;for(let V of c.controls){let W=(V.x-d.x)*_+(V.y-d.y)*x;if(br.less(W,E))C=C|1;else if(br.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C===3){let V=new Nt((z.minX+z.maxX)/2,(z.minY+z.maxY)/2);l.getPercent(V)&&(Us[i++]=V.x,Us[i++]=V.y)}continue}if(w-D>.8){let[V,W]=c.clip(.5);e.push([V,l]),e.push([W,l])}else e.push([c,l])}for(let s=0;s<i;s++)nt[s]=Us[s];return i}function U1t(o,t){if(o.bbox().extendOfSize(br.eps).isSeparated(t.bbox()))return{cnt:0};let e=[[o,t]],r=(o.controls.length-1)*(t.controls.length-1)*8,i=0,n=Number.POSITIVE_INFINITY;for(;e.length!==0;){let s=function(V){D=Math.min(D,V),w=Math.max(w,V)},a=function(V,W){let L=M9(V,W);if(L===0)throw new Error("cnt === 0");for(let k=0;k<L;k+=2)s(nt[k])};if(i>r){for(let V=i-2;V>=2;V-=2)for(let W=V-2;W>=0;W-=2)if(br.eq(Us[V],Us[W])&&br.eq(Us[V+1],Us[W+1])){Us[W]=(Us[V]+Us[W])/2,Us[W+1]=(Us[V+1]+Us[W+1])/2;for(let L=i-3;L>=V;L--)Us[L]=Us[L+2];i-=2;break}if(i>r){i=0;let V=new Float64Array(8),W=t.end(),L=0;o.getPercent(W)!==null&&(V[i++]=W.x,V[i++]=W.y,L=2);let k=o.end();return t.getPercent(k)!==null&&(V[i++]=k.x,V[i++]=k.y,L=L===0?1:3),nt.set(V),{havOverlap:L,cnt:i}}}let[l,c]=e.pop(),h=l.controls,u=c.controls;if(h.length===2&&u.length===2){let V=M9(new bt(h[0],h[1]),new bt(u[0],u[1]));for(let W=0;W<V;W++)Us[i++]=nt[W];continue}let d=h[0],p=h[h.length-1];d.equals1(p)&&(p=d.add1(1,0));let m=p.y-d.y,g=d.x-p.x,y=-m*d.x-g*d.y,b=Math.sqrt(1/(m**2+g**2));m*=b,g*=b,y*=b;let P=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY;if(h.forEach(V=>{let W=m*V.x+g*V.y+y;W<P&&(P=W),W>T&&(T=W)}),br.eq(P,T)){if(c.controls.length===2){let V=M9(new bt(l.start(),l.end()),new bt(c.start(),c.end()));for(let W=0;W<V;W++)Us[i++]=nt[W];if(V!==0)continue}l=new ki([h[0],h[h.length-1]]),h=l.controls}let I=u.map(V=>{let W=m*V.x+g*V.y+y,L=Math.abs(W);return L<n&&(n=L),W}),C=0;for(let V of I){if(br.less(V,P))C=C|1;else if(br.greater(V,T))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let E=0,O=0,_=p.x-d.x,x=p.y-d.y,v=Math.sqrt(1/(_**2+x**2));_*=v,x*=v;for(let V=1;V<h.length;V++){let W=h[V],L=(W.x-d.x)*_+(W.y-d.y)*x;L<E?E=L:L>O&&(O=L)}C=0;for(let V of u){let W=(V.x-d.x)*_+(V.y-d.y)*x;if(br.less(W,E))C=C|1;else if(br.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C!==3)continue;let D=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY;n/=2,n<=br.eps&&(n=br.eps),P-=n,T+=n,I.forEach((V,W)=>{V>=P&&V<=T&&s(W/(I.length-1))});let F=new bt(new Nt(0,P),new Nt(1,P)),H=new bt(new Nt(0,T),new Nt(1,T));for(let V=0;V<I.length-1;V++){let W=new Nt(V/(I.length-1),I[V]),L=W.y<P?1:W.y>T?2:3;for(let k=0;k<I.length;k++){let N=new Nt(k/(I.length-1),I[k]),U=N.y<P?1:N.y>T?2:3;L!==U&&(L===1?U===2?(a(new bt(W,N),F),a(new bt(W,N),H)):a(new bt(W,N),F):L===2?U===1?(a(new bt(W,N),F),a(new bt(W,N),H)):a(new bt(W,N),H):U===1?a(new bt(W,N),F):a(new bt(W,N),H))}}D!==0&&(c=c.clip(D)[1]),w!==1&&(c=c.clip((w-D)/(1-D))[0]);let z=c.bbox();if(br.eq(z.minX,z.maxX)&&br.eq(z.minY,z.maxY)){C=0;for(let V of c.controls){let W=(V.x-d.x)*_+(V.y-d.y)*x;if(br.less(W,E))C=C|1;else if(br.greater(W,O))C=C|2;else{C=3;break}if(C===3)break}if(C===3){let V=new Nt((z.minX+z.maxX)/2,(z.minY+z.maxY)/2);l.getPercent(V)&&(Us[i++]=V.x,Us[i++]=V.y)}continue}if(w-D>.8){let[V,W]=c.clip(.5);e.push([V,l]),e.push([W,l])}else e.push([c,l])}for(let s=0;s<i;s++)nt[s]=Us[s];return{cnt:i}}var H1t=class{constructor(o=br.eps){this.eps=o}eq(o,t){return Math.abs(o-t)<=this.eps}setEps(o){this.eps=o}},CW=new H1t;function A6e(o,t){if(o.bbox().extendOfSize(br.eps).isSeparated(t.bbox()))return 0;let e=[[o,t]],r=(t.controls.length-1)*16,i=0;for(;e.length!==0;){if(i>r){let s=function(){for(let c=0;c<i;c+=2)for(let h=c+2;h<i;h+=2)if(!(CW.eq(Us[c],Us[h])&&CW.eq(Us[c+1],Us[h+1]))){l(Us[h],Us[h+1],a);break}function l(c,h,u){let d=!1;for(let p=0;p<u.length;p+=2)if(CW.eq(c,u[p])&&CW.eq(h,u[p+1])){d=!0;break}d||u.push(c,h)}},a=[Us[0],Us[1]];if(s(),a.length>=100&&(CW.setEps(.001),a=[Us[0],Us[1]],s(),a.length>=100))throw new Error("clearSamePoint()");i=a.length,a.forEach((l,c)=>Us[c]=l)}let n=e.pop();if(n[0]instanceof dr){let s=function(H){x=Math.min(x,H),v=Math.max(v,H)},a=function(H,z){let V=M9(H,z);if(V===0)throw new Error("cnt === 0");for(let W=0;W<V;W+=2)s(nt[W])},[l,c]=n,h=c.controls;if(h.length===2){let H=cPe(l,new bt(h[0],h[1]));for(let z=0;z<H;z++)Us[i++]=nt[z];continue}let u=Number.POSITIVE_INFINITY,d=Number.NEGATIVE_INFINITY,p,m,g,y,b;if(Math.abs(l.sweepAngle)>359){let H=l.rx;p=l.center.add1(H,0),m=l.center.add1(-H,0),u=-H,d=H,g=0,y=1,b=-l.center.y}else{p=l.start(),m=l.end(),g=m.y-p.y,y=p.x-m.x,b=-g*p.x-y*p.y;let H=Math.sqrt(1/(g**2+y**2));g*=H,y*=H,b*=H;let z=g*l.center.x+y*l.center.y+b;l.isCCW?(d=l.rx+z,u=0):(u=z-l.rx,d=0)}let P=h.map(H=>g*H.x+y*H.y+b),T=0;for(let H of P){if(br.less(H,u))T=T|1;else if(br.greater(H,d))T=T|2;else{T=3;break}if(T===3)break}if(T!==3)continue;let I=0,C=0,E=m.x-p.x,O=m.y-p.y,_=Math.sqrt(1/(E**2+O**2));if(E*=_,O*=_,Math.abs(l.sweepAngle)<=180)I=0,C=(m.x-p.x)*E+(m.y-p.y)*O;else throw new Error("not support");T=0;for(let H of h){let z=(H.x-p.x)*E+(H.y-p.y)*O;if(br.less(z,I))T=T|1;else if(br.greater(z,C))T=T|2;else{T=3;break}if(T===3)break}if(T!==3)continue;let x=Number.POSITIVE_INFINITY,v=Number.NEGATIVE_INFINITY;u-=br.eps,d+=br.eps,P.forEach((H,z)=>{H>=u&&H<=d&&s(z/(P.length-1))});let D=new bt(new Nt(0,u),new Nt(1,u)),w=new bt(new Nt(0,d),new Nt(1,d));for(let H=0;H<P.length-1;H++){let z=new Nt(H/(P.length-1),P[H]),V=z.y<u?1:z.y>d?2:3;for(let W=0;W<P.length;W++){let L=new Nt(W/(P.length-1),P[W]),k=L.y<u?1:L.y>d?2:3;V!==k&&(V===1?k===2?(a(new bt(z,L),D),a(new bt(z,L),w)):a(new bt(z,L),D):V===2?k===1?(a(new bt(z,L),D),a(new bt(z,L),w)):a(new bt(z,L),w):k===1?a(new bt(z,L),D):a(new bt(z,L),w))}}x!==0&&(c=c.clip(x)[1]),v!==1&&(c=c.clip((v-x)/(1-x))[0]);let F=c.bbox();if(br.eq(F.minX,F.maxX)&&br.eq(F.minY,F.maxY)){T=0;for(let H of c.controls){let z=(H.x-p.x)*E+(H.y-p.y)*O;if(br.less(z,I))T=T|1;else if(br.greater(z,C))T=T|2;else{T=3;break}if(T===3)break}T===3&&(Us[i++]=(F.minX+F.maxX)/2,Us[i++]=(F.minY+F.maxY)/2);continue}v-x>.8?c.clip(.5).forEach(H=>e.push([H,l])):e.push([c,l])}else{let[s,a]=n;e.push([dr.build3(a.center,a.startAngle,a.sweepAngle/2,a.rx,a.ry),s]),e.push([dr.build3(a.center,a.startAngle+a.sweepAngle/2,a.sweepAngle/2,a.rx,a.ry),s])}}for(let n=0;n<i;n++)nt[n]=Us[n];return i}var W1t=class{static getSweep(o){if(o.length>2){let t=0,e=o.length;for(let n=0;n<e-1;n++){let s=o[n],a=o[n+1];t+=(a.x+s.x)*(a.y-s.y)}let r=o[0],i=o[e-1];return t+=(r.x+i.x)*(r.y-i.y),t>0}else throw new Error("Unable to determine the direction of rotation!")}static isClose(o){return!!(o.primitives.length>0&&o.primitives[0].start().equals1(o.primitives[o.primitives.length-1].end()))}};function z1t(o){let t=o.primitives,e=t[0],r=e instanceof dr?e.sweepAngle%360:null;if(t.length===1&&e instanceof dr&&(br.eq(r,0)||br.eq(Math.abs(r),360)))return!!e.isCCW;let i=new Array;return o.points(.1,n=>{i.push(n)}),W1t.getSweep(i)}var Y1t=class{static zoomCorner(o,t){let e=new Array,r=new Array,i=new Array;return this.getPanPrimitive(o,e,i,t),this.rearrange(e,i),this.processStart(e,i),this.getResult(e,i,r,t),r.length>0?Qs.build2(r):null}static zoomPolygon(o,t){let e=new Array,r=new Array,i=new Array;return z1t(o)&&(o=o.reverse().asClose()),this.getPanPrimitive(o,e,i,t),this.rearrange(e,i),this.processStart(e,i),this.getResult(e,i,r,t),r.length>0?Qs.build2(r):null}static zoomLines(o,t){return this.zoomPolygon(Qs.build2(o.primitives.concat(o.reverse().primitives)),t/2)}static getPanPrimitive(o,t,e,r){let i=o.primitives;for(let n of i){let s=this.panDistance(n,r);s!==void 0&&(t.push(s),e.push(n))}}static rearrange(o,t){let e=o.length,r=0;for(let s=0;s<e;s++){let a=t[s],l=o[s],c=s==e-1?o[0]:o[s+1];if(!(l instanceof dr&&c instanceof dr)&&!this.isCW(l.end(),c.start(),a.end())){if(ZT(l,c)!=0){r=s==e-1?0:s+1;break}}else{r=s;break}}let i=this.start4Index(t,r),n=this.start4Index(o,r);t.length=0,o.length=0,i.forEach(s=>{t.push(s)}),n.forEach(s=>{o.push(s)})}static processStart(o,t){let e=o.length;if(e>2){let r=o[e-1],i=o[0],n=t[e-1];if(!(r instanceof dr&&i instanceof dr)&&!this.isCW(r.end(),i.start(),n.end())){let s=ZT(r,i);for(let a=0;a<s;a+=2){let l=new Nt(nt[a],nt[a+1]);o[e-1]=this.generatePrimitive(r,r.start(),l),o[0]=this.generatePrimitive(i,l,i.end())}}}}static getResult(o,t,e,r){let i=o.length;for(let n=0;n<i;n++){let s=t[n],a=n===i-1?t[0]:t[n+1],l=n==i-1?0:n+1,c=l==i-1?t[0]:t[l+1],h=o[n],u=n==i-1?o[0]:o[n+1],d=l==i-1?o[0]:o[l+1];if(!(h instanceof dr&&u instanceof dr)&&!this.isCW(h.end(),u.start(),s.end())){let m=this.add(o,e,n,h,u,0);m=this.update(o,e,n,u,m);let g=this.generateArc(a,c,u,d,r);if(m=this.add(o,e,n,h,g,m),m=this.update(o,e,n,g,m),m>0)continue}e.push(h);let p=this.generateArc(s,a,h,u,r);p!==void 0&&e.push(p)}}static generateArc(o,t,e,r,i){if(i>0){let n=o.end(),s=t.start(),a=e.end(),l=r.start();if(a.distance2(l)>1e-8)if(n.equals(s)){let c=a.angleD(n),h=l.angleD(n);return dr.build2(n,c,h,i,i,0)}else{let c=a.angleD(n),h=l.angleD(n),u=a.angleD(s),d=l.angleD(s),p=dr.build2(n,c,h,i,i,0),m=dr.build2(s,u,d,i,i,0);return p.pointOn(p.endAngle()).equals1(l)?p:m.pointOn(m.endAngle()).equals1(l)?m:p}}}static updateNews(o,t,e,r){let i=o.length,n=t==i-1?0:t+1;o[n]=this.generatePrimitive(e,r,e.end())}static add(o,t,e,r,i,n){if(n>0)return n;if(r!=null&&i!=null){let s=ZT(r,i);for(let a=0;a<s;a+=2){let l=new Nt(nt[a],nt[a+1]);t.push(this.generatePrimitive(r,r.start(),l)),this.updateNews(o,e,i,l);break}return s}else return 0}static update(o,t,e,r,i){if(i>0)return i;let n=t.length;if(n>0&&r!=null){let s=t[n-1],a=ZT(s,r);for(let l=0;l<a;l+=2){let c=new Nt(nt[l],nt[l+1]);t[n-1]=this.generatePrimitive(s,s.start(),c),this.updateNews(o,e,r,c)}return a}else return 0}static generatePrimitive(o,t,e){if(o instanceof bt)return new bt(t,e);if(o instanceof dr){let r=o,i=t.angleD(r.center),n=e.angleD(r.center);return dr.build2(r.center,i,n,r.rx,r.ry,r.sweep())}else throw new Error("not supported operation")}static start4Index(o,t){let e=o.length,r=new Array;for(let i=t;i<e;i++)r.push(o[i]);for(let i=0;i<t;i++)r.push(o[i]);return r}static isCW(o,t,e){let r=new bt(e,o),i=new bt(e,t),n=r.end().x-r.start().x,s=r.end().y-r.start().y,a=i.end().x-i.start().x,l=i.end().y-i.start().y;return!(n*l-s*a>0)}static panDistance(o,t){if(o instanceof bt){if(o.isPoint())return;{let e=o.panDistance(t);return e.length()>1e-5?e:void 0}}else if(o instanceof dr){let e=o;if(e.sweepAngle>0){if(e.rx-t<=0||e.ry-t<=0)return}else if(e.sweepAngle<0&&(e.rx+t<=0||e.ry+t<=0))return;return e=e.panDistance(t),e.start().distance1(e.end())>1e-5||br.eq(Math.abs(e.sweepAngle),360)?e:void 0}else throw new Error("not supported operation")}},to=.001,Zg=to**2;function vn(o,t){return o.distance2(t)<Zg}function k9(o,t){return Math.abs(o-t)<=1e-4}function j1t(o,t){if(o instanceof bt)return new bt(o.start(),t);if(o instanceof dr){let e=t.angleD(o.center);return k9(Uo.regularD(o.startAngle),Uo.regularD(e))?dr.build3(o.center,o.startAngle,0,o.rx,o.ry):dr.build2(o.center,o.startAngle,e,o.rx,o.ry,o.isCCW?1:0)}else{if(o instanceof ki)return o.clip(o.getPercent(t,to))[0];throw new Error("not supported operation")}}function KC(o,t=Uo.toRadians(o.startAngle)){return o.isCCW?t+=FQ:t-=FQ,new Nt(Math.cos(t),Math.sin(t))}function HW(o,t=0){let e=o.controls;if(t===0){let r=e[0],i=e.slice(1).find(n=>!(n.x===r.x&&n.y===r.y));if(!i)throw Error("getTangentBezier(bezier: Bezier, t: number = 0)");return i.sub(r)}else if(t===1){let r=e[e.length-1],i=e.slice(0,-1).reverse().find(n=>!(n.x===r.x&&n.y===r.y));if(!i)throw Error("getTangentBezier(bezier: Bezier, t: number = 0)");return r.sub(i)}if(e.length===3){let[r,i,n]=e;return i.sub(r).mul(2*(1-t)).add(n.sub(i).mul(2*t)).normalize()}else{let[r,i,n,s]=e;return i.sub(r).mul(3*(1-t)**2).add(n.sub(i).mul(6*(1-t)*t)).add(s.sub(n).mul(3*t**2)).normalize()}}function jN(o,t,e){let r=o.slice(1).findIndex(n=>!(n.x===t.x&&n.y===t.y)),i=o[r+1];if(e&&(e.getPercent(i,to)!==null||new bt(e.start(),e.end()).distance(i)<=to)&&(i=o[r+2]),!i)throw Error("getSecondPoint(controls: readonly Vector2[])");return i}function eo(o,t){if(o instanceof bt)return o.end().sub(o.start()).normalize();if(o instanceof dr)return(t?KC(o,t.angle(o.center)):KC(o)).normalize();if(o instanceof ki)if(o.controls.length===2){let[e,r]=o.controls;if(vn(e,r))throw Error("equalsPP(p0, p1)");return r.sub(e).normalize()}else return(t?HW(o,o.getPercent(t,to)):HW(o)).normalize();else throw new Error("not support")}function X1t(o,t,e){let r=[],i=t**2-4*o*e;if(i>=0){let n=-t/(2*o),s=Math.sqrt(i)/(2*o),a=n+s;if(r.push(a),i>0){let l=n-s;r.push(l)}}return r}function q1t(o,t,e,r,i=0,n=1){let s=[],a=o*Math.pow(i,3)+t*Math.pow(i,2)+e*i+r,l=o*Math.pow(n,3)+t*Math.pow(n,2)+e*n+r,c,h;if(a*l<0)for(;Math.abs(i-n)>to;)if(c=(i+n)/2,h=o*Math.pow(c,3)+t*Math.pow(c,2)+e*c+r,Math.abs(h)<to){s.push(c);break}else a*h<0?n=c:l*h<0&&(i=c);else a*l===0&&(a===0&&s.push(i),l===0&&s.push(n));return s}function Lbe(o,t,e){if(o instanceof bt||t.distance2(e)<=Zg)return new bt(t,e);if(o instanceof dr)return dr.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.isCCW?1:0);if(o instanceof ki){let r=o.getPercent(t,to),i=o.getPercent(e,to);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}function hPe(o){return br.greater(o,0)&&br.less(o,1)}function GQ(o,t,e,r){let i=o[r]-2*t[r]+e[r],n=t[r]-o[r];if(i===0)return[];let s=-n/i,a=[];return hPe(s)&&a.push(s),a}function UQ(o,t,e,r,i){let n,s,a=-o[i]+3*t[i]-3*e[i]+r[i],l=2*(o[i]-2*t[i]+e[i]),c=t[i]-o[i],h=l**2-4*a*c;if(br.lesseq(h,0))n=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY;else{let d=Math.sqrt(h);n=(-l-d)/(2*a),s=(-l+d)/(2*a);let p=a*2;if(br.lesseq(n,1)&&br.greatereq(n,0)){let m=Number.NEGATIVE_INFINITY;for(;br.neq(n,m);){m=n;let g=p*n+l;n=-(a*n**2+l*n+c-g*n)/g}}if(br.lesseq(s,1)&&br.greatereq(s,0)){let m=Number.NEGATIVE_INFINITY;for(;br.neq(s,m);){m=s;let g=p*s+l;s=-(a*s**2+l*s+c-g*s)/g}}}let u=[];return hPe(s)&&u.push(s),hPe(n)&&u.push(n),u}function _5e(o,t){if(o.controls.length===2){let[a,l]=o.controls;vn(a,l)||t.push(new bt(a,l));return}let e,r;if(o.controls.length===3){let[a,l,c]=o.controls;e=GQ(a,l,c,"x"),r=GQ(a,l,c,"y")}else{let[a,l,c,h]=o.controls;e=UQ(a,l,c,h,"x"),r=UQ(a,l,c,h,"y")}e.sort((a,l)=>l-a),r.sort((a,l)=>l-a);let i=e.pop()||1,n=r.pop()||1,s=0;for(;i!==1||n!==1;)if(br.eq(i,n))i=e.pop()||1,n=r.pop()||1;else if(i<n){let[a,l]=o.clip((i-s)/(1-s));s=i,t.push(a),o=l,i=e.pop()||1}else{let[a,l]=o.clip((n-s)/(1-s));s=n,t.push(a),o=l,n=r.pop()||1}t.push(o)}var $1t=1e-5,HPe=1,ki=class Q1 extends QW{constructor(t){if(super(),this._startToEndL=null,t.length<2)throw new Error("Bezier needs at least 2 endpoints");this.controls=t.slice()}get startToEndL(){return this._startToEndL===null&&(this._startToEndL=new bt(this.start(),this.end())),this._startToEndL}build1(t){let e=[];return KN(t,(r,i)=>(e.push(i),!0)),new Q1(e)}start(){return this.controls[0]}end(){return this.controls[this.controls.length-1]}static pointOn(t,e){if(e.length<1)throw new Error("bezier must have at least 1 point");if(e.length===1)return e[0];{let r=new Array(e.length-1);for(let i=1;i<e.length;i++){let n=e[i-1],s=e[i],a=(s.x-n.x)*t,l=(s.y-n.y)*t;r[i-1]=n.add1(a,l)}return Q1.pointOn(t,r)}}clip1(t,e,r,i){if(r.push(e[0]),i.push(e[e.length-1]),e.length<2)throw new Error("bezier clip must have at least 2 point");if(e.length===2){let n=e[0],s=e[1],a=(s.x-n.x)*t,l=(s.y-n.y)*t,c=n.add1(a,l);r.push(c),i.push(c)}else{let n=new Array(e.length-1);for(let s=1;s<e.length;s++){let a=e[s-1],l=e[s],c=(l.x-a.x)*t,h=(l.y-a.y)*t;n[s-1]=a.add1(c,h)}this.clip1(t,n,r,i)}}clip(t){let e=[],r=[];return this.clip1(t,this.controls,e,r),[new Q1(e),new Q1(r.reverse())]}greater(t,e,r){return t-e>r}less(t,e,r){return t-e<-r}eq(t,e,r){return Math.abs(t-e)<=r}eqPP(t,e,r){return!t||!e?!1:this.eq(t.x,e.x,r)&&this.eq(t.y,e.y,r)}isInRange(t,e=br.eps){let r=this.controls.map(n=>n.y-t.y),i=0;for(let n of r){if(this.less(n,0,e))i=i|1;else if(this.greater(n,0,e))i=i|2;else{i=3;break}if(i===3)break}if(i!==3)return!1;i=0;for(let n of this.controls){let s=n.x-t.x;if(this.less(s,0,e))i=i|1;else if(this.greater(s,0,e))i=i|2;else{i=3;break}if(i===3)break}return i===3}getPercent(t,e=br.eps){if(!this.isInRange(t,e))return null;let r=Number.POSITIVE_INFINITY,i=[[this,0,1]];for(;i.length!==0;){let n=function(y){h=Math.min(h,y),u=Math.max(u,y)},s=function(y,b){let P=M9(y,b);if(P===0)throw new Error("cnt === 0");for(let T=0;T<P;T+=2)n(nt[T])},[a,l,c]=i.pop();if(this.eqPP(a.start(),t,e))return l;if(this.eqPP(a.end(),t,e))return c;let h=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,d=a.controls.map(y=>y.y-t.y);r=d.reduce((y,b)=>{let P=Math.abs(b);return P<y?P:y},r),r/=2,r<=e&&(r=e),d.forEach((y,b)=>{this.eq(y,0,e)&&n(b/(d.length-1))});let p=new bt(new Nt(0,-r),new Nt(1,-r)),m=new bt(new Nt(0,r),new Nt(1,r));for(let y=0;y<d.length-1;y++){let b=new Nt(y/(d.length-1),d[y]),P=this.less(b.y,0,e)?1:this.greater(b.y,0,e)?2:3;for(let T=0;T<d.length;T++){let I=new Nt(T/(d.length-1),d[T]),C=this.less(I.y,0,e)?1:this.greater(I.y,0,e)?2:3;P!==C&&(P===1?C===2?(s(new bt(b,I),p),s(new bt(b,I),m)):s(new bt(b,I),p):P===2?C===1?(s(new bt(b,I),p),s(new bt(b,I),m)):s(new bt(b,I),m):C===1?s(new bt(b,I),p):s(new bt(b,I),m))}}if(!isFinite(h)){if(Math.max(...d.map(y=>Math.abs(y)))<e*4)return(l+c)/2;continue}if(h!==0&&(a=a.clip(h)[1],l=(c-l)*h+l),u!==1){let y=(u-h)/(1-h);a=a.clip(y)[0],c=(c-l)*y+l}if(!a.isInRange(t,e))continue;let g=a.controls.reduce((y,b)=>y.ext2(b),new s2).build1();if(this.eq(g.minX,g.maxX,e)&&this.eq(g.minY,g.maxY,e))return(l+c)/2;if(u-h>.8){let[y,b]=a.clip(.5);y.isInRange(t,e)?(i.push([y,l,(l+c)/2]),b.isInRange(t,e)&&i.push([b,(l+c)/2,c])):i.push([b,(l+c)/2,c])}else i.push([a,l,c])}return null}toBezier(){return this}toString(){return"Bezier ["+this.controls.join(" ")+"]"}bbox(){return this._bbox||(this._bbox=new s2().ext3(this.points(.1)).build1()),this._bbox}bboxWithControls(){return this._bbox_controls||(this._bbox_controls=new s2().ext3(this.controls).build()),this._bbox_controls}multiply3(t){let e=new Array(this.controls.length);for(let r=0;r<this.controls.length;r++){let i=this.controls[r];e[r]=i.multiply3(t)}return new Q1(e)}stroke(t,e,r,i=HPe){let n=Y1t.zoomLines(Qs.build4(this.points(i)),t);return r===0?n:n.reverse()}points(t){let e=[];return this.getBezierPoints(t,r=>e.push(r)),e}getBezierPoints(t,e){if(this.controls.length===2){e(this.start()),e(this.end());return}let r=[this];for(e(this.start());r.length!==0;){let n=r.pop(),s=new bt(n.start(),n.end());if(i(n.controls,s)<=t)e(n.end());else{let[a,l]=n.clip(.5);r.push(l,a)}}function i(n,s){let a=s.start(),l=s.end();a.equals1(l)&&(l=a.add1(1,0));let c=l.y-a.y,h=a.x-l.x,u=-c*a.x-h*a.y,d=Math.sqrt(1/(c**2+h**2));c*=d,h*=d,u*=d;let p=n.map(m=>Math.abs(c*m.x+h*m.y+u));return Math.max(...p)}}getBezierPoints3(t,e){if(this.controls.length===2){e(this.start()),e(this.end());return}let r=t*t,i=this.controls[0],n=.5;for(;n>$1t&&!(i.distance2(Q1.pointOn(n,this.controls))<=r);n*=.5);let s=Math.ceil(1/n);n=1/s,e(i);let a=0;for(let l=1;l<s;l++)a+=n,e(Q1.pointOn(a,this.controls));e(this.end())}getPointsBySlope(t){if(this.controls.length===4)return this.getPointsBySlope4(t);throw new Error("Currently, only 4 control points are supported!")}getPointsBySlope4(t){let[e,r,i,n]=this.controls,s=-3*e.x+9*r.x-9*i.x+3*n.x,a=6*e.x-12*r.x+6*i.x,l=-3*e.x+3*r.x,c=[];if(Number.isFinite(t)){let h=-3*e.y+9*r.y-9*i.y+3*n.y,u=6*e.y-12*r.y+6*i.y,d=-3*e.y+3*r.y,p=h-s*t,m=u-a*t,g=d-l*t,y=-m/(2*p),b=Math.sqrt(m**2-4*p*g)/(2*p),P=y+b;P>=0&&P<=1&&c.push(Q1.pointOn(P,this.controls));let T=y-b;T>=0&&T<=1&&c.push(Q1.pointOn(T,this.controls))}else{let h=-a/(2*s),u=Math.sqrt(a**2-4*s*l)/(2*s),d=h+u;d>=0&&d<=1&&c.push(Q1.pointOn(d,this.controls));let p=h-u;p>=0&&p<=1&&c.push(Q1.pointOn(p,this.controls))}return c}buildConverxHull(t=br.eps){let e=[...this.controls],r=[],i=e[0],n=1;do{let s=e[n%e.length];this.eqPP(i,s,t)||r.push(new bt(i,s)),i=s,n++}while(i!==e[0]);if(r.length===0)throw Error("buildConverxHull(diff = DoubleKit.eps)");return Qs.build7(r).asClose()}getExtremePoints(t){if(!t)return s(this.controls);let e=t.start(),r=t.end(),i=r.x-e.x,n=r.y-e.y;if(Math.abs(i)<=br.eps||Math.abs(n)<=br.eps)return s(this.controls);{let a=n/i;if(this.controls.length===3){e.equals1(r)&&(r=e.add1(1,0));let l=r.y-e.y,c=e.x-r.x,h=-l*e.x-c*e.y,u=Math.sqrt(1/(l**2+c**2));l*=u,c*=u,h*=u;let d=this.controls.map(g=>l*g.x+c*g.y+h),p=d[0]-2*d[1]+d[2],m=d[1]-d[0]-a/2;if(p!==0){let g=-m/p;if(br.greater(g,0)&&br.less(g,1))return[Q1.pointOn(g,this.controls)]}}else if(this.controls.length===4)return this.getPointsBySlope(a)}return[];function s(a){let l,c;if(a.length===3){let[p,m,g]=a;l=GQ(p,m,g,"x"),c=GQ(p,m,g,"y")}else if(a.length===4){let[p,m,g,y]=a;l=UQ(p,m,g,y,"x"),c=UQ(p,m,g,y,"y")}l.sort((p,m)=>m-p),c.sort((p,m)=>m-p);let h=l.pop()||1,u=c.pop()||1,d=[];for(;h!==1||u!==1;)br.eq(h,u)?(h=l.pop()||1,u=c.pop()||1):h<u?(d.push(Q1.pointOn(h,a)),h=l.pop()||1):(d.push(Q1.pointOn(u,a)),u=c.pop()||1);return d}}getToLineMaxDis2(t){let e=this.getExtremePoints(t),r=t.distance2(this.start()),i=t.distance2(this.end()),n=Math.max(r,i);return e.forEach(a=>s(t.distance2(a))),n;function s(a){n=Math.max(n,a)}}getToLineMinAndMaxDis_Controls(t){let e=t.start(),r=t.end();t.start().equals1(t.end())&&(r=e.add1(1,0));let i=r.y-e.y,n=e.x-r.x,s=-i*e.x-n*e.y,a=Math.sqrt(1/(i**2+n**2));i*=a,n*=a,s*=a;let l=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY;return this.controls.forEach(h=>{let u=i*h.x+n*h.y+s;u<l&&(l=u),u>c&&(c=u)}),{minDis:l,maxDis:c}}getPercentInLine(t){let e=[],r=[],i=this.controls,n=t.start(),s=t.end(),a=s.y-n.y,l=n.x-s.x,c=-a*n.x-l*n.y,h=Math.sqrt(1/(a**2+l**2));if(a*=h,l*=h,c*=h,a**2+l**2<=0)return e;if(i.length===3){let[u,d,p]=i,m=a*(u.x-2*d.x+p.x)+l*(u.y-2*d.y+p.y),g=2*(a*(d.x-u.x)+l*(d.y-u.y)),y=a*u.x+l*u.y+c;r=X1t(m,g,y)}else if(i.length===4){let[u,d,p,m]=i,g=m.sub(p.mul(3)).add(d.mul(3)).sub(u),y=u.sub(d.mul(2)).add(p).mul(3),b=d.sub(u).mul(3),P=u,T=a*g.x+l*g.y,I=a*y.x+l*y.y,C=a*b.x+l*b.y,E=a*P.x+l*P.y+c,O=Math.sqrt(1/(T**2+I**2));T*=O,I*=O,C*=O,E*=O,r=q1t(T,I,C,E)}else throw Error("not support getBeizerPointInLine");return r.forEach(u=>{u>=0&&u<=1&&e.push(u)}),e}reverse(){return new Q1(this.controls.slice().reverse())}},Qw,v5e=(Qw=class{constructor(){this.textCache=new Map,this.numCache=new Array(20),this.boxCache=new Array(4),this.textOffsetCache=new Array(9),this.BuildLineCache=new Array(7),this.BuildTrackCache=new Array(7),this.BuildViaCache=new Array(11),this.BuildBoxCache=new Array(10),this.BuildArcCache=new Array(10),this.BuildArcTrackCache=new Array(10),this.BuildTextCache=new Array(7),this.BuildPadStyleCache=new Array(4),this.BuildPadCache=new Array(12),this.ARRAY1=new Array(1),this.ARRAY2=new Array(2),this.ARRAY3=new Array(3),this.ARRAY4=new Array(4),this.ARRAY5=new Array(5),this.ARRAY6=new Array(6),this.ARRAY7=new Array(7),this.ARRAY8=new Array(8),this.ARRAY9=new Array(9),this.ARRAY10=new Array(10),this.ARRAY11=new Array(11),this.ARRAY12=new Array(12),this.textOffsetCache[0]=Nt.ORIGIN,this.textOffsetCache[1]=new Nt(0,-.5),this.textOffsetCache[2]=new Nt(0,-1),this.textOffsetCache[3]=new Nt(-.5,0),this.textOffsetCache[4]=new Nt(-.5,-.5),this.textOffsetCache[5]=new Nt(-.5,-1),this.textOffsetCache[6]=new Nt(-1,0),this.textOffsetCache[7]=new Nt(-1,-.5),this.textOffsetCache[8]=new Nt(-1,-1)}static getCache(){return Qw.instance==null&&(Qw.instance=new Qw),Qw.instance}},Qw.instance=null,Qw),bt=class rL extends QW{constructor(t,e){super(),this._a=null,this._b=null,this._c=null,this.__bbox=null,this._hashed=null,this._direct=null,this._start=t,this._end=e}get a(){return this._a===null&&(this._start.equals1(this._end)?(this._a=NaN,this._b=NaN,this._c=NaN):(this._a=this._end.y-this._start.y,this._b=this._start.x-this._end.x,this._c=this._end.x*this._start.y-this._start.x*this._end.y)),this._a}get b(){return this._b===null&&(this._start.equals1(this._end)?(this._a=NaN,this._b=NaN,this._c=NaN):(this._a=this._end.y-this._start.y,this._b=this._start.x-this._end.x,this._c=this._end.x*this._start.y-this._start.x*this._end.y)),this._b}get c(){return this._c===null&&(this._start.equals1(this._end)?(this._a=NaN,this._b=NaN,this._c=NaN):(this._a=this._end.y-this._start.y,this._b=this._start.x-this._end.x,this._c=this._end.x*this._start.y-this._start.x*this._end.y)),this._c}get hashed(){return this._hashed==null&&(this._hashed=this._hashCode()),this._hashed}get direct(){return this._direct==null&&(this._direct=this._end.sub(this._start).normalize()),this._direct}cutLine(t){if(br.eq(this.distance(t),0)){let e=new rL(this._start,t);return e._a=this._a,e._b=this._b,e._c=this._c,e}return new rL(this._start,t)}get midPoint(){return this._start.add(this._end).mul(.5)}toBezier(){return new ki([this._start,this._end])}_hashCode(){let t=31,e=1;return e=t*e+this._start.hashCode(),e=t*e+this._end.hashCode(),e}start(){return this._start}end(){return this._end}center(){let t=this.start(),e=this.end();return t.add(e).mul(.5)}panDistance(t){let e=this._end.x-this._start.x,r=this._end.y-this._start.y,i=this.length();e=e*t/i,r=-r*t/i;let n=new Nt(this._start.x+r,this._start.y+e),s=new Nt(this._end.x+r,this._end.y+e);return new rL(n,s)}isPoint(){return this._start.distance2(this._end)<=1e-8}length(){return this._start.distance1(this._end)}toString(){return"Line [start="+this._start+", end="+this._end+"]"}bbox(){if(this.__bbox==null){let t=v5e.getCache().boxCache;t[0]=Math.min(this._start.x,this._end.x),t[1]=Math.max(this._start.x,this._end.x),t[2]=Math.min(this._start.y,this._end.y),t[3]=Math.max(this._start.y,this._end.y),this.__bbox=new qg(t[0],t[1],t[2],t[3])}return this.__bbox}multiply3(t){return new rL(this._start.multiply3(t),this._end.multiply3(t))}hashCode(){return this.hashed}equals(t){let e=t;return this.hashed===e.hashed&&this._start.equals(e._start)&&this._end.equals(e._end)}equals1(t){let e=t;return this.hashed===e.hashed&&this._start.equals1(e._start)&&this._end.equals1(e._end)}equals2(t){let e=[this.start(),this.end()],r=[t.start(),t.end()];return XC(e,r)||XC(e,r.reverse())}stroke(t,e,r){let i,n,s;this._end.x<this._start.x?(n=this._start.x-this._end.x,s=this._start.y-this._end.y,i=this._end):(n=this._end.x-this._start.x,s=this._end.y-this._start.y,i=this._start);let a=Math.sqrt(n*n+s*s),l=t/2,c,h,u;e===2?(h=-l,u=a+l):(h=0,u=a),e===0||e===2?r===0?c=Qs.build5([h,-l,h,l,u,l,u,-l]):c=Qs.build5([h,l,h,-l,u,-l,u,l]):r===0?c=Qs.build2([dr.build3(new Nt(h,0),-90,-180,l,l),dr.build3(new Nt(u,0),90,-180,l,l)]):c=Qs.build2([dr.build3(new Nt(h,0),90,180,l,l),dr.build3(new Nt(u,0),-90,180,l,l)]);let d=Math.atan2(s,n),p=tc.rotate(d).translate1(i);return c.asClose().multiply3(p)}points(t){return[this._start,this._end]}mirrorY(t){return new rL(this.start().mirrorY(t),this.end().mirrorY(t))}reverse(){return new rL(this._end,this._start)}inArea(t,e,r){let i=t.x,n=t.y,s=this._start,a=this._end,l=r==1,c=i-s.x,h=n-s.y,u=i-a.x,d=n-a.y,p=a.x-s.x,m=a.y-s.y,g=new Nt(-m,p).normalize(),y=p+g.x*e/2,b=m+g.y*e/2,P=y*y+b*b,T=c*c+h*h,I=u*u+d*d,C=Math.abs(c*m-h*p)/2,E=Math.sqrt(p*p+m*m)*e/4;if(C<=E&&T<=P&&I<=P){if(l)return!0;{let O=new Nt(i,n).sub(a).normalize(),_=new Nt(i,n).sub(s).normalize(),x=new Nt(g.x,g.y).cross(O),v=new Nt(g.x,g.y).cross(_);return x>=0&&v<=0}}else if(l){let O=e/2;return T<=O*O?!0:I<=O*O}else return!1}isParallel(t,e=!1){let r=br.eq(Math.abs(this.direct.cross(t.direct)),0),i=!e||br.greatereq(this.direct.dot(t.direct),0);return r&&i}distance2(t){return(this.a*t.x+this.b*t.y+this.c)**2/(this.a**2+this.b**2)}distance2ForPP(t){let{x:e,y:r}=t,{x:i,y:n}=this.start(),{x:s,y:a}=this.end();return((e-i)*(a-n)-(r-n)*(s-i))**2/((a-n)**2+(s-i)**2)}distance(t){return Math.abs(this.a*t.x+this.b*t.y+this.c)/Math.sqrt(this.a**2+this.b**2)}};function K1t(o,t=.05){if(o.length<3)return o.slice();let e=o.slice(0,1),r=(n,s,a)=>x1t(n.x,n.y,s.x,s.y,a.x,a.y);for(;;){e=o.slice(0,1);for(let n=1;n<o.length-1;n+=2)r(o[n],o[n-1],o[n+1])>t&&e.push(o[n]),e.push(o[n+1]);if(e.at(-1).equals1(o.at(-1))||e.push(o.at(-1)),o.length==e.length)break;o=e}let i=o[o.length-1];return e.push(i),e}var Z1t=s1t(a1t()),J1t=class{constructor(){this.fac=new s2,this.length=0,this.box=null,this.pt=null,this.i=0}calcBBox(o){for(this.fac.clear(),this.length=o.length,this.box=null,this.pt=null,this.i=0;this.i<this.length;this.i++)this.pt=o[this.i],this.box=this.pt.bbox(),this.fac.ext1(this.box);return this.fac.build1()}},Q1t=new J1t,Qs=class yp{constructor(t,e){this.__bbox=null,this.primitives=t,this.__bbox=e}static calcBBox(t){return Q1t.calcBBox(t)}static build1(t){let e=[],r=null;return kQ(t,(i,n)=>{let s=n.start();return r!==null&&!s.equals(r)&&e.push(new bt(r,s)),e.push(n),r=n.end(),!0}),e.length===0&&r!=null&&e.push(new bt(r,r)),new yp(e)}static build2(t){return yp.build1(aPe(t))}static build3(t){let e=[],r=null;return kQ(t,(i,n)=>(r!==null&&e.push(new bt(r,n)),r=n,!0)),new yp(e)}static build4(t){return this.build3(aPe(t))}static build5(t){let e=[];for(let r=0;r<t.length;r+=2)e.push(new Nt(t[r],t[r+1]));return this.build4(e)}static build6(t){return yp.build4([t.LL(),t.LR(),t.UR(),t.UL(),t.LL()])}static build7(t){return new yp(t)}static build8(t){let e=new Nt(t[0],t[1]),r,i=[],n,s=(a,l)=>a.length==l&&a.every(c=>typeof c=="number");for(let a=2;a<t.length;)switch(typeof t[a]=="string"?n=t[a]:a-=1,n){case"ARC":{let l=t.slice(a+1,a+4);if(!s(l,3))throw new Error("invalid rawData");let c=l[0];r=new Nt(l[1],l[2]),i.push(dr.build5(e,r,c)),e=r,a+=4;break}case"L":{let l=t.slice(a+1,a+3);if(!s(l,2))throw new Error("invalid rawData");r=new Nt(l[0],l[1]),i.push(new bt(e,r)),e=r,a+=3;break}case"C":{let l=t.slice(a+1,a+7);if(!s(l,7))throw new Error("invalid rawData");let c=new Nt(l[0],l[1]),h=new Nt(l[2],l[3]);r=new Nt(l[4],l[5]),i.push(new ki([e,c,h,r])),e=r,a+=7;break}default:throw new Error("invalid rawData")}return yp.build2(i)}static buildBBox(t,e=0){return e===1?yp.build5([t.minX,t.minY,t.maxX,t.minY,t.maxX,t.maxY,t.minX,t.maxY,t.minX,t.minY]):yp.build5([t.minX,t.minY,t.minX,t.maxY,t.maxX,t.maxY,t.maxX,t.minY,t.minX,t.minY])}static triangulate(t,e,r=1){if(t.length===1){let l=new Array;t[0].asClose().points2(r,d=>l.push(d));let c,h=l[0],u=[];for(let d=0;d<l.length-2;d+=2){let p=l[d+1],m=l[d+2],g=p.sub(h).normalize().cross(m.sub(h).normalize());if(br.neq(g,0)){if(c===!0){if(g<0){u.length=0;break}}else if(c===!1){if(g>0){u.length=0;break}}else c=g>0;u.push(h),u.push(p),u.push(m)}l.push(h),h=m}if(u.length!==0){for(let d=0;d<u.length;d+=3)e(u[d],u[d+1],u[d+2]);return}}let i=[],n=[];t.forEach(l=>{i.length!==0&&n.push(i.length/2),l.asClose().points2(r,c=>i.push(c.x,c.y))});let s=Z1t.default(i,n),a=[];for(let l=1;l<i.length;l+=2)a.push(new Nt(i[l-1],i[l]));for(let l=0;l<s.length;l+=3)e(a[s[l]],a[s[l+1]],a[s[l+2]])}lines(t,e){let r=new Array;this.points(t,n=>r.push(n));let i=r[0];for(let n=1;n<r.length;n++){let s=r[n];e(i),e(s),i=s}}triangles(t,e){yp.triangulate([this],(...r)=>{r.forEach(i=>e(i))},t)}mirror(){let t=[];return this.primitives.forEach(e=>{if(e instanceof bt)e=new bt(e.start().mirror(),e.end().mirror());else if(e instanceof dr)e=e.mirror();else if(e instanceof ki){let r=e.controls.map(i=>i.mirror());e=new ki(r)}else throw new Error("bug");t.push(e)}),new yp(t,this.__bbox)}getPoints(t){let e=[];for(let r of this.primitives)for(let i of r.points(t))e.push(i);return e}round(t=4){let e=this.primitives.slice();for(let r=0;r<e.length;r++){let i=e[r];if(i instanceof bt){let n=i.start().round(t),s=i.end().round(t);e[r]=new bt(n,s)}else if(i instanceof ki){let n=i.controls.map(s=>s.round(t));e[r]=new ki(n)}else if(i instanceof dr){let n=i.start().round(t),s=i.end().round(t),a=i.sweepAngle;e[r]=dr.build5(n,s,a)}}return new yp(e,this.__bbox)}simplify(t=.05){let e=[],r=!1,i=[],n=this.closed();if(this.primitives.length<=1)return yp.build2(this.primitives);let s=()=>{if(i.length>2){let l=K1t(i,t);for(let c=1;c<l.length;c++)e.push(new bt(l[c-1],l[c]))}else e.push(new bt(i[0],i[1]));i.length=0,r=!1};for(let l=0;l<this.primitives.length;l++){let c=this.primitives[l];c instanceof bt?(r?i.push(c.end()):(i.length=0,i.push(c.start(),c.end()),r=!0),l===this.primitives.length-1&&s()):(r&&s(),e.push(c))}let a=new yp(e,this.__bbox);return n&&!a.closed()&&(a=a.asClose()),a}hasBackLine(){let{primitives:t}=this,e;for(let r=0;r<t.length;r++){let i=t[r];if(i instanceof bt){if(i.end().equals1(i.start()))continue;if(e&&(i.end().equals1(e.start())||R1t(i.end(),e.start(),e.end())))return!0;e=i}else e=null}return!1}area(t=.1){let e=0,r=this.end();return this.primitives.forEach(i=>{let n=i.start(),s=i.end();if(e+=(n.x+r.x)*(n.y-r.y),i instanceof bt)e+=(s.x+n.x)*(s.y-n.y);else if(i instanceof dr)e+=(s.x+n.x)*(s.y-n.y),e+=Math.PI*i.rx2*i.sweepAngle/180-Nt.normal(i.center,i.start(),i.end());else if(i instanceof ki){let a=n;i.points(t).forEach(l=>{e+=(l.x+a.x)*(l.y-a.y),a=l}),e+=(s.x+a.x)*(s.y-a.y)}r=s}),e/2}closed(t){return this.primitives.length===0?!1:this.start().equals(this.end(),t)}asClose(){let t=this.primitives[0],e=this.primitives[this.primitives.length-1],r=t.start(),i=e.end();if(r.equals(i))return this;{let n=new Array;return $g.addAll(n,this.primitives),n.push(new bt(i,r)),yp.build2(n)}}closeEndpoint(){let t=this.primitives[0],e=this.primitives[this.primitives.length-1],r=t.start(),i=e.end();if(r.equals1(i))return this;{let n=new Array;return $g.addAll(n,this.primitives),n.push(new bt(i,r)),new yp(n)}}reverse(){let t=new Array(this.primitives.length);for(let e=0,r=this.primitives.length-1;r>=0;e++,r--){let i=this.primitives[r];if(i instanceof bt)i=new bt(i.end(),i.start());else if(i instanceof dr)i=i.exchangeSweep();else if(i instanceof ki)i=new ki(i.controls.slice().reverse());else throw new Error("bug");t[e]=i}return new yp(t,this.__bbox)}reverse1(){let t=new Array(this.primitives.length);for(let e=0,r=this.primitives.length-1;r>=0;e++,r--){let i=this.primitives[r];if(i instanceof bt)i=new bt(i.end(),i.start());else if(i instanceof dr)i=i.exchangeSweep1();else if(i instanceof ki)i=new ki(i.controls.slice().reverse());else throw new Error("bug");t[e]=i}return new yp(t,this.__bbox)}mirrorY(t){let e=[];return this.primitives.forEach(r=>{if(r instanceof bt)r=r.mirrorY(t);else if(r instanceof dr)r=r.mirrorY(t);else if(r instanceof ki){let i=r.controls.map(n=>n.mirrorY(t));r=new ki(i)}else throw new Error("bug");e.push(r)}),new yp(e,this.__bbox)}points(t,e){if(this.primitives.length!==0){for(let r=0;r<this.primitives.length-1;r++){let i=this.primitives[r].points(t);i.pop(),i.forEach(n=>e(n))}this.primitives[this.primitives.length-1].points(t).forEach(r=>e(r))}}points1(t,e){if(this.primitives.length===0)return;for(let i=0;i<this.primitives.length-1;i++){let n=this.primitives[i],s=n instanceof dr?n.points1(t):n.points(t);s.pop(),s.forEach(a=>e(a))}let r=this.primitives[this.primitives.length-1];(r instanceof dr?r.points1(t):r.points(t)).forEach(i=>e(i))}points2(t,e){if(this.primitives.length===0)return;for(let i=0;i<this.primitives.length-1;i++){let n=this.primitives[i],s=n instanceof dr?n.points2():n.points(t);s.pop(),s.forEach(a=>e(a))}let r=this.primitives[this.primitives.length-1];(r instanceof dr?r.points2():r.points(t)).forEach(i=>e(i))}multiply3(t){let e=new Array(this.primitives.length);for(let r=0;r<this.primitives.length;r++)e[r]=this.primitives[r].multiply3(t);return yp.build7(e)}bbox(){return this.__bbox==null&&(this.__bbox=yp.calcBBox(this.primitives)),this.__bbox}start(){return this.primitives.length!==0?this.primitives[0].start():null}end(){return this.primitives.length!==0?this.primitives[this.primitives.length-1].end():null}isClose(t){if(this.primitives.length<=1&&!(this.primitives[0]instanceof dr))return!1;{let e=this.primitives[0],r=this.primitives[this.primitives.length-1];return e.start().equals(r.end(),t)}}isEqual(t){if(t instanceof yp&&t.primitives.length==this.primitives.length){let e=t.primitives.length;for(let r=0;r<e;r++){let i=t.primitives[r],n=this.primitives[r];if(JSON.stringify(i)!=JSON.stringify(n))return!1}return!0}return!1}equals(t){if(!t)return!1;let e=this.primitives,r=t.primitives;if(e.length!=r.length)return!1;if(t.isClose()){let i=0;for(;i<e.length;){let n=e.slice(i).concat(e.slice(0,i));if(XC(n,r)||XC(n.reverse(),r))return!0;i++}return!1}else return XC(this.primitives,t.primitives)}clone(){return yp.build2(this.primitives)}putItem(t,e){if(!t)return!1;if(t instanceof yp)return this.mergePolyline(t,e);let r=this.start();if(!r){this.primitives.push(t),this.__bbox=t.bbox();return}let i=this.end();if(r.equals(i,e))return!1;let n=t.start(),s=t.end(),a=!1,l=!1;if(r.equals(n,e))a=!0,l=!1;else if(r.equals(s,e))a=!1,l=!1;else if(i.equals(n,e))a=!1,l=!0;else if(i.equals(s,e))a=!0,l=!0;else return!1;return l?this.primitives.push(a?t.reverse():t):this.primitives.unshift(a?t.reverse():t),this.__bbox=qg.extend2(this.__bbox,t.bbox()),!0}mergePolyline(t,e,r=0){if(!t)return!1;let i=this.start();if(!i){this.primitives.push(...t.primitives),this.__bbox=t.bbox();return}let n=this.end();if(i.equals(n,e))return!1;let s=t.start(),a=t.end(),l=!1,c=!1;if(i.equals(s,e))l=!0,c=!1;else if(i.equals(a,e))l=!1,c=!1;else if(n.equals(s,e))l=!1,c=!0;else if(n.equals(a,e))l=!0,c=!0;else return!1;let h=l?t.reverse():t;return c?this.primitives.push(...h.primitives):this.primitives.unshift(...h.primitives),this.__bbox=qg.extend2(this.__bbox,t.bbox()),!0}deDuplicationPoint(t){let e=this.primitives[this.primitives.length-1].start(),r=this.primitives[this.primitives.length-1].end(),i=t.primitives[0].start(),n=t.primitives[0].end();if(this.primitives[this.primitives.length-1]instanceof bt&&t.primitives[0]instanceof bt&&B1t([e,r],[i,n])){this.primitives.pop(),t.primitives.shift();let s=[];s.push(new bt(e,n)),this.primitives.push(...s)}}getMaxBBoxHeightByVec(t){let e=t.normalize(),r=-1/0,i=1/0;if(this.primitives.forEach(s=>{let a=s.start().dot(e),l=s.end().dot(e);if(n(a),n(l),s instanceof dr){let c=t.angleD(Nt.ORIGIN);if(s.angleIsInArc(c)){let h=s.pointOn(c).dot(e);n(h)}if(s.angleIsInArc(c+180)){let h=s.pointOn(c-180).dot(e);n(h)}}}),r-i<=0)throw new Error("getMaxBBoxHeightByVec");return r-i;function n(s){s>r&&(r=s),s<i&&(i=s)}}getWindingNum(t){let e=this.end(),r=0,{x:i,y:n}=t;for(let a of this.primitives){if(e.y>n?a.bbox().minY>n:a.bbox().maxY<=n){e=a.end();continue}if(a instanceof dr&&(a.isCCW?Math.floor(a.startAngle/90)+1!==Math.ceil(a.endAngle()/90):Math.ceil(a.startAngle/90)-1!==Math.floor(a.endAngle()/90))){let l=a.startAngle,c=a.endAngle();if(a.sweepAngle>0){let h=90;for(;h<=c;)h>l&&(s(dr.build3(a.center,l,h-l,a.rx,a.ry)),l=h),h+=90;l<c&&s(dr.build3(a.center,l,c-l,a.rx,a.ry))}else{let h=270;for(;h>=c;)h<l&&(s(dr.build3(a.center,l,h-l,a.rx,a.ry)),l=h),h-=90;l>c&&s(dr.build3(a.center,l,c-l,a.rx,a.ry))}}else if(a instanceof ki){let l=[];_5e(a,l),l.forEach(c=>s(c))}else s(a)}return r;function s(a){let l=a.start(),c=a.end();if(e.y>n!=l.y>n&&(e.x>i?l.x>i?r+=l.y>e.y?1:-1:e.y>l.y?(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)<0&&r--:(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)>0&&r++:l.x>i&&(e.y>l.y?(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)<0&&r--:(e.x-i)*(l.y-n)-(e.y-n)*(l.x-i)>0&&r++)),l.y>n!=c.y>n){if(l.x>i)if(c.x>i)r+=c.y>l.y?1:-1;else if(a instanceof bt)l.y>c.y?(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)<0&&r--:(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)>0&&r++;else if(a instanceof dr){let{center:h,isCCW:u,rx2:d}=a,p=(h.x-i)**2+(h.y-n)**2;l.y>c.y?(u?p>d:p<d)&&r--:(u?p<d:p>d)&&r++}else if(a instanceof ki){if(T6e(a,n)===0)throw new Error("no inters");nt[0]>i&&(r+=c.y>l.y?1:-1)}else throw new Error("not support!");else if(c.x>i)if(a instanceof bt)l.y>c.y?(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)<0&&r--:(l.x-i)*(c.y-n)-(l.y-n)*(c.x-i)>0&&r++;else if(a instanceof dr){let{center:h,isCCW:u,rx2:d}=a,p=(h.x-i)**2+(h.y-n)**2;l.y>c.y?(u?p>d:p<d)&&r--:(u?p<d:p>d)&&r++}else if(a instanceof ki){if(T6e(a,n)===0)throw new Error("no inters");nt[0]>i&&(r+=c.y>l.y?1:-1)}else throw new Error("not support!")}e=c}}},hQ=Math.PI*2,NWt=Math.PI/2,kWt=Math.sin(Math.PI/180),eyt=4,dr=class _h extends QW{constructor(t,e,r,i,n){super(),this._rx2=null,this._ry2=null,this._svgEnd=null,this._hashed=null,this.__bbox=null,this.rx=t,this.ry=e,this.center=r,this.startAngle=i,this.sweepAngle=n,this._start=Nt.ORIGIN,this._end=Nt.ORIGIN,this._start=this.pointOn(i),this._end=this.pointOn(i+n)}get hashed(){return this._hashed==null&&(this._hashed=this._hashCode()),this._hashed}hashCode(){return this.hashed}_hashCode(){let t=31,e=1;return e=t*e+new Nt(this.rx,this.rx).hashCode(),e=t*e+this.center.hashCode(),e=t*e+new Nt(this.startAngle,this.sweepAngle).hashCode(),e}get rx2(){return this._rx2==null&&(this._rx2=this.rx*this.rx),this._rx2}get ry2(){return this._ry2==null&&(this._ry2=this.ry*this.ry),this._ry2}get svgEnd(){return this._svgEnd==null&&(this._svgEnd=this.getSvgEnd(this.startAngle,this.sweepAngle,this._start,this._end)),this._svgEnd}getSvgEnd(t,e,r,i){let n=e>=0?-.01:.01,s=t+e;for(;(e>=0&&s>t||e<0&&s<t)&&r.distance2(i)<2e-4;)n*=2,s+=n,i=this.pointOn(s);return i}static build1(t,e,r,i,n,s){fu.positive(r),fu.positive(i);let a=t.equals(e);if(a)return new _h(r,i,t,0,n?360:0);{let l=t.x,c=-t.y,h=e.x,u=-e.y,d=s===0,p=(l-h)/2,m=(c-u)/2,g=Math.cos(0),y=Math.sin(0),b=g*p+y*m,P=-y*p+g*m;r=Math.abs(r),i=Math.abs(i);let T=r*r,I=i*i,C=b*b,E=P*P,O=n===d?-1:1,_=(T*I-T*E-I*C)/(T*E+I*C);_=_<0?0:_;let x=O*Math.sqrt(_),v=x*(r*P/i),D=x*-(i*b/r),w=(l+h)/2,F=(c+u)/2,H=w+(g*v-y*D),z=F+(y*v+g*D),V=(b-v)/r,W=(P-D)/i,L=(-b-v)/r,k=(-P-D)/i,N,U;U=Math.sqrt(V*V+W*W),N=V,O=W<0?-1:1;let B=Uo.toDegrees(O*Math.acos(N/U));U=Math.sqrt((V*V+W*W)*(L*L+k*k)),N=V*L+W*k,O=V*k-W*L<0?-1:1;let G=N/U,Y;G<-1?Y=Math.acos(-1):G>1?Y=Math.acos(1):Y=Math.acos(G);let X=Uo.toDegrees(O*Y);!d&&X>0?X-=360:d&&X<0&&(X+=360),fu.normal(B),fu.normal(X);let K=p*p/T+m*m/I,J=t.distance1(e)/2;r<J&&i<J&&(r*=Math.sqrt(K),i*=Math.sqrt(K));let se=a?0:Uo.regularD(-B),ce=a?n?360:0:-X;return new _h(r,i,new Nt(H,-z),se,ce)}}static build2(t,e,r,i,n,s){fu.positive(i),fu.positive(n),fu.normal(e),fu.normal(r);let a;return e===r?(e=Uo.regularD(e),r=Uo.regularD(r),a=0):(e=Uo.regularD(e),r=Uo.regularD(r),s===1?r<=e&&(r+=360):r>=e&&(e+=360),a=r-e),new _h(i,n,t,Uo.regularD(e),a)}static build3(t,e,r,i,n){return fu.positive(i),fu.positive(n),fu.normal(r),new _h(i,n,t,Uo.regularD(e),r)}static build4(t,e,r,i,n,s){let a=t.angleD(r),l=e.angleD(r);return _h.build2(r,a,l,i,n,s)}static build5(t,e,r){r=Uo.toRadians(r);let i=e.sub(t),n=new Nt(-i.y,i.x).normalize(),s=Math.abs(r)/2,a;if(s!=0)a=i.length()/2/Math.sin(s);else throw new Error("Can't represent circle!!!");let l=n.rotate(Nt.ORIGIN,s),c,h;r>0?(c=1,h=e.add(l.scale(a))):(c=0,h=t.sub(l.scale(a)));let u=Uo.toDegrees(t.angle(h)),d=Uo.toDegrees(e.angle(h));return _h.build2(h,u,d,a,a,c)}static buildCircle(t,e,r=0){return _h.build2(t,0,360,e,e,r)}start(){return this._start}end(){return this._end}isLarge(){return Math.abs(this.sweepAngle)>180}sweep(){return this.sweepAngle>=0?1:0}get isCCW(){return this.sweepAngle>=0}endAngle(){return this.startAngle+this.sweepAngle}pointOn(t){t=Uo.regularD(t);let e=this.rx,r=this.ry;if(t===0)return this.center.add1(e,0);if(t===90)return this.center.add1(0,r);if(t===180)return this.center.add1(-e,0);if(t===270)return this.center.add1(0,-r);{let i=this.rx2,n=this.ry2,s=Math.tan(Uo.toRadians(t)),a=s*s,l=Math.sqrt(i*n/(i+n/a)),c=Math.sqrt(i*n/(n+i*a));return t>90&&t<270&&(c=-c),t>180&&t<360&&(l=-l),isNaN(c)&&(c=0),isNaN(l)&&(l=0),this.center.add1(c,l)}}exchangeSweep(){return _h.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle,this.rx,this.ry)}exchangeSweepAndStart(){return _h.build1(this.end(),this.start(),this.rx,this.ry,this.isLarge(),this.sweepAngle>=0?0:1)}exchangeSweep1(){return _h.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle+.01,this.rx,this.ry)}mirrorY(t){let e=this.start(),r=this.end();return e.equals(r)?_h.build3(this.center.mirrorY(),0,360,this.rx,this.ry):_h.build1(e.mirrorY(t),r.mirrorY(t),this.rx,this.ry,this.isLarge(),this.sweepAngle>=0?0:1)}mirror(t=Nt.ORIGIN){let e=this.start(),r=this.end();return e.equals(r)?_h.build3(this.center.mirror(t),0,360,this.rx,this.ry):_h.build1(e.mirror(t),r.mirror(t),this.rx,this.ry,this.isLarge(),this.sweep())}sectorArea(){return Math.abs(this.sweepAngle)/360*Math.PI*this.rx*this.ry}area(){let t=lPe.area(this.center,this._start,this.pointOn(this.endAngle()));return this.sectorArea()-t}multiply3(t){let e;t.isMirrored()?e=-this.sweepAngle:e=this.sweepAngle;let r;return t.equals(tc.ROT_90)?r=Uo.regularD(this.startAngle+90):t.equals(tc.ROT_N90)?r=Uo.regularD(this.startAngle-90):r=Uo.transformD(this.startAngle,t),_h.build3(this.center.multiply3(t),r,e,t.iScale*this.rx,t.iScale*this.ry)}angleIsInArc(t){return t=Uo.regularD(t),this.sweepAngle>0?(t<this.startAngle&&(t+=360),this.endAngle()>t):(t>this.startAngle&&(t-=360),this.endAngle()<t)}toBezier(){if(Math.abs(this.sweepAngle)>90)throw new Error("not support!");let t=this.start(),e=this.end(),r=Uo.toRadians(this.sweepAngle)/2,i=4/3*(1-Math.cos(r))/Math.sin(r)*this.rx;return new ki([t,t.add(new Nt(i,0).multiply3(tc.rotateD(this.startAngle+90))),e.add(new Nt(i,0).multiply3(tc.rotateD(this.endAngle()-90))),e])}toBezier2(){let t=[];r(this,90);let e=[];return t.forEach(i=>e.push(i.toBezier())),e;function r(i,n){if(Math.abs(i.sweepAngle)>n){let s=i.sweepAngle/2;r(_h.build3(i.center,i.startAngle,s,i.rx,i.ry),n),r(_h.build3(i.center,i.startAngle+s,s,i.rx,i.ry),n)}else t.push(i)}}buildBBox(){let t=v5e.getCache().boxCache,e=this.startAngle+this.sweepAngle;if(t[0]=Math.min(this._start.x,this._end.x),t[1]=Math.max(this._start.x,this._end.x),t[2]=Math.min(this._start.y,this._end.y),t[3]=Math.max(this._start.y,this._end.y),this.sweepAngle>0){let r=0;for(;r<e;){if(r>this.startAngle){let i=this.pointOn(r);t[0]=Math.min(t[0],i.x),t[1]=Math.max(t[1],i.x),t[2]=Math.min(t[2],i.y),t[3]=Math.max(t[3],i.y)}r+=90}}else if(this.sweepAngle<0){let r=360;for(;r>e;){if(r<this.startAngle){let i=this.pointOn(r);t[0]=Math.min(t[0],i.x),t[1]=Math.max(t[1],i.x),t[2]=Math.min(t[2],i.y),t[3]=Math.max(t[3],i.y)}r-=90}}return new qg(t[0],t[1],t[2],t[3])}bbox(){return this.__bbox==null&&(this.__bbox=this.buildBBox()),this.__bbox}length(){return Math.abs(this.rx*this.sweepAngle*Math.PI/180)}toString(){return YN.format("Arc [start=%s, end=%s, rx=%s, ry=%s, center=%s, startAngle=%s, sweepAngle=%s]",this._start,this._end,this.rx,this.ry,this.center,this.startAngle,this.sweepAngle)}stroke(t,e,r){let i=t/2,n=this.rx+i,s=this.ry+i,a=this.rx-i,l=this.ry-i,c=new tc;a<0&&(a=-a,c=c.multiply3(tc.MIRROR_Y)),l<0&&(l=-l,c=c.multiply3(tc.MIRROR_X)),a===0&&(a=.001),l===0&&(l=.001),c=c.setOrigin1(this.center);let h,u;switch(r===this.sweep()?(h=_h.build3(this.center,this.startAngle,this.sweepAngle,n,s),u=_h.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle,a,l)):(h=_h.build3(this.center,this.startAngle+this.sweepAngle,-this.sweepAngle,n,s),u=_h.build3(this.center,this.startAngle,this.sweepAngle,a,l)),u=u.multiply3(c),e){case 1:{let d=r===1?180:-180,p=r===this.sweep()?this.pointOn(this.endAngle()):this.pointOn(this.startAngle),m=r===this.sweep()?this.pointOn(this.startAngle):this.pointOn(this.endAngle()),g=h.pointOn(h.endAngle()).angleD(p),y=u.pointOn(u.endAngle()).angleD(m);return Qs.build2([h,_h.build3(p,g,d,i,i),u,_h.build3(m,y,d,i,i)])}default:return Qs.build2([h,u])}}points2(){let t=Math.ceil(Math.abs(this.sweepAngle)/eyt),e=this.sweepAngle/t,r=[this._start];for(let i=1;i<t;i++)r.push(this.pointOn(this.startAngle+e*i));return r.push(this._end),r}points1(t){let e=Math.max(this.rx,this.ry);if(e<=t)return[this.start(),this.svgEnd];let r=(e-t)/e,i=Math.ceil(Math.abs(this.sweepAngle/Uo.toDegrees(Math.acos(r))/2)),n=new Array(i+1),s=this.sweepAngle/i,a=this.startAngle;for(let l=0;l<=i;l++,a+=s)n[l]=this.pointOn(a);return n}points(t){let e=Math.max(this.rx,this.ry);if(t=Math.abs(t),e<=t)return[this.start(),this.svgEnd];t=Math.max(t,e*1e-5),t=Math.min(t,e*(1-Math.SQRT1_2));let r=(e-t)/e,i=Math.ceil(Math.abs(this.sweepAngle/Uo.toDegrees(Math.acos(r))/2));i=Math.max(i,2);let n=new Array(i+1),s=this.sweepAngle/i,a=this.startAngle+s;n[0]=this.start();for(let l=1;l<i;l++,a+=s)n[l]=this.pointOn(a);return n[i]=this.end(),n}panDistance(t){return this.sweepAngle>0?new _h(this.rx-t,this.ry-t,this.center,this.startAngle,this.sweepAngle):new _h(this.rx+t,this.ry+t,this.center,this.startAngle,this.sweepAngle)}panDistance1(t){if(this.sweepAngle>0){let e=this.rx-t;return e<0?(e=Math.abs(e),_h.build3(this.center,this.startAngle-180,this.sweepAngle,e,e)):new _h(e,e,this.center,this.startAngle,this.sweepAngle)}else{let e=this.rx+t;return e<0?(e=Math.abs(e),_h.build3(this.center,this.startAngle-180,this.sweepAngle,e,e)):new _h(e,e,this.center,this.startAngle,this.sweepAngle)}}get bulge(){let t=Math.abs(_1t(this.sweepAngle,3))/180*Math.PI;return Math.tan(t/4)}get midPoint(){let t=Uo.toRadians(this.startAngle),e=Uo.toRadians(this.endAngle()),r=this.sweep(),i=this.center,n=this.rx;if(r==1)if(e>t){let s=(e-t)/2+t;return i.add(new Nt(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new Nt(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(e+hQ-t)/2+t;return i.add(new Nt(Math.cos(s),Math.sin(s)).mul(n))}}else if(e>t){let s=(t+hQ-e)/2+e;return i.add(new Nt(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new Nt(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(t-e)/2+e;return i.add(new Nt(Math.cos(s),Math.sin(s)).mul(n))}}}get svgPathData(){return[{type:"M",values:[this._start.x,this._start.y]},{type:"A",values:[this.rx,this.ry,0,this.isLarge()?1:0,this.isCCW,this._end.x,this._end.y]}]}equals(t){let e=Uo.regularD(this.startAngle),r=Uo.regularD(this.sweepAngle),i=Uo.regularD(t.startAngle),n=Uo.regularD(t.sweepAngle);return XC([this.rx,this.ry,this.center,Math.abs(r)],[t.rx,t.ry,t.center,Math.abs(n)])&&(XC([r,e],[n,i])||XC([Uo.regularD(e+r)],[i]))}equals1(t){let e=Uo.regularD(this.startAngle),r=Uo.regularD(this.sweepAngle),i=Uo.regularD(t.startAngle),n=Uo.regularD(t.sweepAngle);return XC([this.rx,this.ry,this.center,Math.abs(r)],[t.rx,t.ry,t.center,Math.abs(n)])&&(XC([r,e],[n,i])||XC([Uo.regularD(e+r)],[i]))}inArea(t,e){let r=t.x,i=t.y,n=this.center,s=this.rx,a=Uo.toRadians(this.startAngle);this.sweep()==0&&(a=Uo.toRadians(this.endAngle()));let l=Uo.toRadians(this.endAngle());this.sweep()==0&&(l=Uo.toRadians(this.startAngle));let c=s-e/2,h=s+e/2;var u=r-n.x,d=i-n.y,p=Math.atan2(d,u);if(p<0&&(p+=hQ),a<=l&&p>=a&&p<=l||a>l&&(p>=a&&p<=hQ||p>=0&&p<=l)||a==l){var m=Math.sqrt(u*u+d*d);return m<=h&&m>=c}else{var m=(h+c)/2,g=new Nt(n.x+Math.cos(a)*m,n.y+Math.sin(a)*m),y=new Nt(n.x+Math.cos(l)*m,n.y+Math.sin(l)*m),b=r-g.x,P=i-g.y,T=r-y.x,I=i-y.y;return b*b+P*P<=e*e/4?!0:T*T+I*I<=e*e/4}}isCircle(){return(br.eq(Math.abs(this.sweepAngle),360)||this._start.equals1(this._end))&&this.rx==this.ry}reverse(){return _h.build3(this.center,this.endAngle(),-this.sweepAngle,this.rx,this.ry)}getAngle(){let t=Math.PI*2;return this.sweep()==1?(this.endAngle()-this.startAngle+t)%t:(this.startAngle-this.endAngle()+t)%t}isValid(){return this.rx>0&&this.ry>0}},x5e=new ArrayBuffer(24),Mbe=new Float64Array(x5e),RN=new Int32Array(x5e),Cm,BWt=(Cm=class{static normal(o,t,e){let r=t.sub(o),i=e.sub(t);return r.cross(i)}constructor(o,t,e){this.x=fu.normal(o),this.y=fu.normal(t),this.z=fu.normal(e),Mbe[0]=o,Mbe[1]=t,Mbe[2]=e,this.hashed=RN[0]^RN[1]^RN[2]^RN[3]^RN[4]^RN[5]}isZeroVector(){return this.x===0&&this.y===0&&this.z===0}hashCode(){return this.hashed}equals(o){return o instanceof Cm?o.x===this.x&&o.y===this.y&&o.z===this.z:!1}cross(o){return new Cm(this.y*o.z-this.z*o.y,this.z*o.x-this.x*o.z,this.x*o.y-this.y*o.x)}dot(o){return this.x*o.x+this.y*o.y+this.z*o.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}normalize(){var o=this.length();return new Cm(this.x/o,this.y/o,this.z/o)}sub(o){return new Cm(this.x-o.x,this.y-o.y,this.z-o.z)}add(o){return new Cm(this.x+o.x,this.y+o.y,this.z+o.z)}scale(o){return new Cm(this.x*o,this.y*o,this.z*o)}neg(){return new Cm(-this.x,-this.y,-this.z)}multiply4(o){var t=this.x*o.data[0]+this.y*o.data[4]+this.z*o.data[8]+o.data[12],e=this.x*o.data[1]+this.y*o.data[5]+this.z*o.data[9]+o.data[13],r=this.x*o.data[2]+this.y*o.data[6]+this.z*o.data[10]+o.data[14],i=this.x*o.data[3]+this.y*o.data[7]+this.z*o.data[11]+o.data[15];return i!=0?new Cm(t/i,e/i,r/i):new Cm(t,e,r)}rotate(o,t){return this.multiply4(S5e.rotateAxis(o,t))}toVector2(){return new Nt(this.x,this.y)}},Cm.ORIGIN=new Cm(0,0,0),Cm.X_UNIT_VECTOR=new Cm(1,0,0),Cm.Y_UNIT_VECTOR=new Cm(0,1,0),Cm.Z_UNIT_VECTOR=new Cm(0,0,1),Cm),Gd=class FN{static build(t){return t instanceof Qs?new FN([new m0([t])]):t instanceof m0?new FN([t]):t}static buildByPolygon(t){return t?new FN([t]):new FN([])}static buildByStroke(t,e,r=1,i){return this.buildByPolygon(m0.buildByStroke(t,e,r,HPe,i))}static buildCircle(t,e){return this.buildByPolygon(m0.buildCircle(t,e))}static buildRect(t){return this.buildByPolygon(m0.buildRect(t))}static buildBBox(t){return this.buildByPolygon(m0.buildBBox(t))}constructor(t){this.items=t.slice()}multiply3(t){return new FN(this.items.map(e=>e.multiply3(t)))}bbox(){return this._bbox||(this._bbox=this.items.reduce((t,e)=>t.ext1(e.bbox()),new s2).build1()),this._bbox}toPolylineGroups(){return this.items.map(t=>t.toPolylineGroup())}},Ah,_l=(Ah=class{static isHexFormate(o){return!o||typeof o!="string"?!1:/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(o)}static of1(o){return this.of2(o>>16&255,o>>8&255,o&255)}static of2(o,t,e,r=255){return new Ah(o/255,t/255,e/255,r/255)}static of3(o){o.startsWith("#")&&(o=o.substr(1));let t=o.length;if(t==3)return new Ah(parseInt(o[0],16)/15,parseInt(o[1],16)/15,parseInt(o[2],16)/15);if(t==6)return new Ah(parseInt(o.substr(0,2),16)/255,parseInt(o.substr(2,2),16)/255,parseInt(o.substr(4,2),16)/255);if(t==8)return new Ah(parseInt(o.substr(0,2),16)/255,parseInt(o.substr(2,2),16)/255,parseInt(o.substr(4,2),16)/255,parseInt(o.substr(6,2),16)/255);throw new Error("invalid color string")}static of4(o){let t=parseInt(o.r*255+"").toString(16),e=parseInt(o.g*255+"").toString(16),r=parseInt(o.b*255+"").toString(16);return t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),("#"+t+e+r).toUpperCase()}static of5(o,t){if(o.startsWith("#")&&(o=o.substr(1)),o.length==3)return new Ah(parseInt(o[0],16)/15,parseInt(o[1],16)/15,parseInt(o[2],16)/15,t);if(o.length==6)return new Ah(parseInt(o.substr(0,2),16)/255,parseInt(o.substr(2,2),16)/255,parseInt(o.substr(4,2),16)/255,t);throw new Error("invalid color string")}static of6(o,t){return new Ah(o.r,o.g,o.b,t)}static of7(o){return o==null?null:Ah.of3(o)}constructor(o,t,e,r=1){this.r=fu.positiveOr0(o),this.g=fu.positiveOr0(t),this.b=fu.positiveOr0(e),this.alpha=r}hashCode(){return this.r+this.g+this.b+this.alpha}equals(o,t=!1){let e=this.r===o.r&&this.g===o.g&&this.b===o.b;return t?e:e&&this.alpha===o.alpha}add(o,t,e,r){return new Ah(Math.max(0,Math.min(1,this.r+o)),Math.max(0,Math.min(1,this.g+t)),Math.max(0,Math.min(1,this.b+e)),Math.max(0,Math.min(1,this.alpha+r)))}mul(o){return new Ah(Math.max(0,Math.min(1,this.r*o)),Math.max(0,Math.min(1,this.g*o)),Math.max(0,Math.min(1,this.b*o)),this.alpha)}mul1(o){return new Ah(Math.max(0,this.r*o),Math.max(0,this.g*o),Math.max(0,this.b*o),this.alpha)}getData(){return[this.r,this.g,this.b,this.alpha]}toString(){let o=(this.r*255).toString(16),t=(this.g*255).toString(16),e=(this.b*255).toString(16);return o.length<2&&(o="0"+o),t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),"#"+o.substr(0,2)+t.substr(0,2)+e.substr(0,2)}toString1(){let o=(this.r*255).toString(16),t=(this.g*255).toString(16),e=(this.b*255).toString(16),r=(this.alpha*255).toString(16);return o.length<2&&(o="0"+o),t.length<2&&(t="0"+t),e.length<2&&(e="0"+e),r.length<2&&(r="0"+r),"#"+o.substr(0,2)+t.substr(0,2)+e.substr(0,2)+r.substr(0,2)}toRGBA(){let o=this.r*255,t=this.g*255,e=this.b*255;return[o,t,e,this.alpha]}toRGBAString(){let o=this.r*255,t=this.g*255,e=this.b*255;return`rgba(${o},${t},${e},${this.alpha})`}isWHITE(){return this.r===1&&this.g===1&&this.b===1&&this.alpha===1}},Ah.WHITE=new Ah(1,1,1,1),Ah.BLACK=new Ah(0,0,0,1),Ah.RED=new Ah(1,0,0,1),Ah.GREEN=new Ah(0,1,0,1),Ah.BLUE=new Ah(0,0,1,1),Ah.Gray=Ah.of3("#9966ff"),Ah.Silver=Ah.of3("#D2D2D2"),Ah.Golden=Ah.of3("#DCAA14"),Ah.Pink=Ah.of3("#ffaec9"),Ah),_6e=!1,R5e=class{onRTreeBBox(o){}onResultSide(o){}onOriginSide(o){}onSplitedSide(o){}onDebugSide(o){}onSweep(o,t,e,r,i,n){}onIntersect(o,t,e){}onSegment(o,t,e,r,i,n){}onSegment1(o,t,e){if(_6e){let r=new Nt(o.getX(e),e),i=new Nt(t.getX(e),e);this.onSegment(r,o.weight,o,i,t.weight,t)}else this.onSegment(o.start,o.weight,o,t.end,t.weight,t)}onSweep1(o,t,e){if(_6e){let r=new Nt(o.getX(e),e),i=new Nt(t.getX(e),e);this.onSweep(r,o.weight,o,i,t.weight,t)}else this.onSweep(o.start,o.weight,o,t.end,t.weight,t)}},FW=class extends R5e{constructor(o){super(),this.plGrps=new Array,this.debug=o}onPolylineGroup(o,t){this.plGrps.push(o)}},ez=class{constructor(o){this.cache={},this.levels=o,this.result=new Array(o),this.weights=new Array(o),this.maxIdx=o-1,this.rule=this.decide.bind(this);let t=1;for(let e=0;e<o;e++)this.weights[e]=t,t*=50}weight(o){return this.weights[o]}decide(o){o=Math.abs(o);let t=this.cache[o];if(t===void 0){let e=o;for(let r=this.maxIdx;r>=0;r--){let i=this.weights[r],n=o/i|0,s=o%i;s>(i/2|0)?(o=i-s,n++):o=s,this.result[r]=n>0}t=this.decide1(this.result),this.cache[e]=t}return t}},tyt=o=>o!==0,ryt=new class extends ez{decide1(o){return o[0]||o[1]}}(2),OQ=new class extends ez{decide1(o){return o[0]&&!o[1]}}(2),AQ=new class extends ez{decide1(o){return o[0]&&o[1]}}(2),Nbe=new class extends ez{decide1(o){return o[0]&&!o[1]||!o[0]&&o[1]}}(2),iyt=(o=>(o[o.UNMARKED=0]="UNMARKED",o[o.INSIDE=1]="INSIDE",o[o.OUTSIDE=2]="OUTSIDE",o[o.INVALID=3]="INVALID",o))(iyt||{}),ek=class VN{constructor(t,e,r,i,n,s,a){this.inters=[],this.connect=new Array,this.previous=null,this.next=null,this.finalGrp=-1,this.trans=NaN,this.outsideWeight=0,this.insideWeight=0,this.invalidWeight=0,this._confidence=0,this._confidence_y=NaN,this._x=NaN,this._x_y=NaN,this.status=0,this.bo=t,this.shape=e,this.baseWeight=r,i.y>n.y?this.weight=-r:i.y==n.y?this.weight=0:this.weight=r,this.start=i,this.end=n,this.polyGrp=s,this.polyIndex=a,this._bbox=new s2().ext1(e.bbox()).ext2(i).ext2(n).build1(),this.inters.push(i),this.inters.push(n);let l=31,c=1;c=l*c+this.polyGrp,c=l*c+this.polyIndex,this._hashcode=c}static rebuild(t,e,r){if(t instanceof bt||e.distance2(r)<1e-6)return new bt(e,r);if(t instanceof dr){let i=t,n=t.bbox().center().x,s;e.y>r.y?s=n>i.center.x?0:1:s=n>i.center.x?1:0;let a=e.angleD(i.center),l=r.angleD(i.center);return dr.build2(i.center,a,l,i.rx,i.ry,s)}else throw new Error("not supported operation")}updateBbox(){this._bbox=new s2().ext2(this.start).ext2(this.end).build1()}is(t,e){return t===this.polyGrp&&e===this.polyIndex}confidence(t){if(this._confidence_y!=t){let e=this._bbox.height();if(e!==0)if(Math.abs(t-this._bbox.maxY)>5e-4&&Math.abs(t-this._bbox.minY)>5e-4){let r=1-Math.abs(2*t-this._bbox.maxY-this._bbox.minY)/e;this._confidence=r*1e4|0}else this._confidence=0;else this._confidence=1;this._confidence_y=t}return this._confidence}needCountWeight(){return this.outsideWeight+this.insideWeight+this.invalidWeight<5e3}revokeOutside(t){let e=this.confidence(t);return this.outsideWeight-=e,this.invalidWeight+=e,e}revokeInside(t){let e=this.confidence(t);return this.insideWeight-=e,this.invalidWeight+=e,e}setOutside(t){let e=this.confidence(t);return this.outsideWeight+=e,e}setInside(t){let e=this.confidence(t);return this.insideWeight+=e,e}setInvalid(t){let e=this.confidence(t);return this.invalidWeight+=e,e}prevNot0(){let t=this.previous;for(;t!=null&&t!=this;){if(t.weight!=0)return t;t=t.previous}return null}nextNot0(){let t=this.next;for(;t!=null&&t!=this;){if(t.weight!=0)return t;t=t.next}return null}getX(t){if(this.bo!==null)return(this._x_y!=t||isNaN(this._x))&&(uyt(this,t)>0?this._x=nt[0]:this._x=NaN,this._x_y=t),this._x;throw new Error("not supported operation")}voteStatus(){return this.outsideWeight>this.insideWeight&&this.outsideWeight>this.invalidWeight?2:this.insideWeight>this.outsideWeight&&this.insideWeight>this.invalidWeight?1:this.invalidWeight>this.outsideWeight&&this.invalidWeight>this.insideWeight?3:0}reverse(t){if(t===2)if(this.start.y>this.end.y){let e=VN.rebuild(this.shape,this.end,this.start),r=new VN(this.bo,e,this.baseWeight,this.end,this.start,this.polyGrp,this.polyIndex);return $g.addAll(r.connect,this.connect),r}else return this;else if(t===1)if(this.start.y<this.end.y){let e=VN.rebuild(this.shape,this.end,this.start),r=new VN(this.bo,e,this.baseWeight,this.end,this.start,this.polyGrp,this.polyIndex);return $g.addAll(r.connect,this.connect),r}else return this;return this}isNeedScan(t){return this.needCountWeight()&&this.confidence(t)>0}hashCode(){return this._hashcode}equals(t){return t instanceof VN?!(this.polyGrp!==t.polyGrp||this.polyIndex!==t.polyIndex):!1}bbox(){return this._bbox}toString(){return YN.format("(%d,%d,%d) (%d,%d,%d) %s %s",this.polyGrp,this.polyIndex,this.weight,this.outsideWeight,this.invalidWeight,this.insideWeight,this.start,this.end)}};function nyt(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minY+e.maxY)/2,n=(r.minY+r.maxY)/2;return i-n}function oyt(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minX+e.maxX)/2,n=(r.minX+r.maxX)/2;return i-n}var DN=class{constructor(o){if(this.__bbox=null,typeof o<"u")if(o instanceof Array){this.__items=[];for(let t of o)this.add(t)}else this.__items=o,this.__bbox=o.bbox();else this.__items=[]}add(o){if(this.__items instanceof Array)this.__items.push(o),this.__bbox=qg.extend2(this.__bbox,o.bbox());else throw new Error("can't insert multiple item into leaf node")}items(){return this.__items}bbox(){if(this.__bbox!==null)return this.__bbox;throw new Error("bug")}},WW=class{constructor(o){this.changed=!1,this.root=new DN,this.capacity=o,this.capacity2=o*o,this.itemList=[]}size(){return this.itemList.length}items(){return this.flushWhenNeed(),this.itemList}add(o){this.itemList.push(o),this.changed=!0}remove(o){$g.remove(this.itemList,o),this.changed=!0}clear(){this.changed=!1,this.root=new DN,this.itemList.length=0}flushWhenNeed(){if(this.changed){let o=new Array;for(let t of this.itemList)o.push(new DN(t));for(;;){let t=this.organize(o);if(t.length>1)o=t;else break}this.root=new DN(o),this.changed=!1}}organize(o){hL(o,oyt,0,o.length);let t=o.length,e=[];for(let r=0;r<t;)if(r+this.capacity2<=t){let i=r+this.capacity2;hL(o,nyt,r,i);for(let n=r;n<i;n+=this.capacity){let s=new DN(o.slice(n,n+this.capacity));e.push(s)}r=r+this.capacity*this.capacity}else{let i=new DN(o.slice(r,r+this.capacity));e.push(i),r=r+this.capacity}return e}search(o){this.flushWhenNeed();let t=[],e=[];for(e.push(this.root);;){let r=e.shift();if(typeof r<"u"){let i=r.items();if(i instanceof Array){for(let n of i)if(!o.isSeparated(n.bbox())){let s=n.items();s instanceof Array?e.push(n):t.push(s)}}else o.isSeparated(r.bbox())||t.push(i)}else break}return t}walker(o){this.flushWhenNeed(),this._walker(this.root,0,o)}_walker(o,t,e){this.flushWhenNeed();let r=o.items();if(r instanceof Array)for(let i of r)this._walker(i,t+1,e);else e(r,t)}bbox(){return this.flushWhenNeed(),this.root.bbox()}};function kbe(o,t){syt(o.iterator(),t)}function syt(o,t){let e=0;for(;o.hasNext();){let r=o.next();t(e++,r)}}var uQ=new Error("list is empty"),dQ=class{constructor(o,t){this.prev=null,this.next=null,this.parent=o,this.item=t}insertAfter(o){o.next=this.next,this.next=o,o.prev=this,o.next!==null&&(o.next.prev=o)}insertBefore(o){o.prev=this.prev,this.prev=o,o.next=this,o.prev!==null&&(o.prev.next=o)}remove(){this.prev!==null&&(this.prev.next=this.next),this.next!==null&&(this.next.prev=this.prev)}set(o){this.item=o}},ayt=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o.item;throw new Error("iterator is null")}},lyt=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o;throw new Error("iterator is null")}},oL=class{constructor(){this.first=null,this.last=null,this.cnt=0}add(o){return this.addLast(o)}push(o){return this.addLast(o)}pop(){return this.removeLast()}shift(){return this.removeFirst()}removeFirst(){let o=this.first;if(o===null)throw uQ;return this.remove(o),o.item}removeLast(){let o=this.last;if(o===null)throw uQ;return this.remove(o),o.item}addLast(o){return this.first===null||this.last===null?(this.first=new dQ(this,o),this.last=this.first,this.cnt=1,this.first):this.insertAfter(this.last,o)}addFirst(o){if(this.first===null||this.last===null){let t=new dQ(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertBefore(this.first,o)}getFirst(){if(this.first===null)throw uQ;return this.first.item}getLast(){if(this.last===null)throw uQ;return this.last.item}insertAfter(o,t){let e=new dQ(this,t);return o.insertAfter(e),o===this.last&&(this.last=e),this.cnt++,e}insertBefore(o,t){let e=new dQ(this,t);return o.insertBefore(e),o===this.first&&(this.first=e),this.cnt++,e}remove(o){o.remove(),o===this.first&&(this.first=o.next),o===this.last&&(this.last=o.prev),this.cnt--}size(){return this.cnt}clear(){this.first=null,this.last=null,this.cnt=0}iterator(){return new ayt(this.first)}listIterator(){return new lyt(this.first)}toArray(){let o=new Array(this.cnt),t=this.first,e=0;for(;t!=null;)o[e]=t.item,t=t.next,e++;return o}};function Bbe(o){throw new Error("")}var pQ=class{constructor(o,t){this.node1=null,this.node2=null,this.key=o,this.value=t}},cyt=class{constructor(o){this.itors=o}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().key}},hyt=class{constructor(o){this.itors=o}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().value}},HQ=class{constructor(){this.innerList=new oL,this.innerMap={}}replace(o,t){o.node1!==null&&(o.node1.set(t),t.node1=o.node1),o.node2!==null&&(o.node2.set(t),t.node2=o.node2)}clear(){this.innerList.clear();for(let o in this.innerMap)delete this.innerMap[o]}put(o,t){let e=o.hashCode(),r=new pQ(o,t),i=this.innerMap[e];if(i===void 0)return r.node1=this.innerList.add(r),this.innerMap[e]=r,null;if(i instanceof pQ){if(i.key.equals(o))return this.innerMap[e]=r,this.replace(i,r),i.value;{r.node1=this.innerList.add(r);let n=new oL;return i.node2=n.add(i),r.node2=n.add(r),this.innerMap[e]=n,null}}if(i instanceof oL){let n=null;return kbe(i,(s,a)=>a.key.equals(o)?(this.replace(a,r),n=a.value,!1):!0),n===null?(r.node1=this.innerList.add(r),r.node2=i.push(r),null):n}return Bbe(i)}get(o){let t=o.hashCode(),e=this.innerMap[t];if(e===void 0)return null;if(e instanceof pQ)return e.key.equals(o)?e.value:null;if(e instanceof oL){let r=null;return kbe(e,(i,n)=>n.key.equals(o)?(r=n.value,!1):!0),r}return Bbe(e)}containsKey(o){return this.get(o)!==null}delete(o){o.node1!==null&&o.node1.parent.remove(o.node1),o.node2===null?delete this.innerMap[o.key.hashCode()]:o.node2.parent.remove(o.node2)}remove(o){let t=o.hashCode(),e=this.innerMap[t];if(e===void 0)return null;if(e instanceof pQ)return e.key.equals(o)?(this.delete(e),e.value):null;if(e instanceof oL){let r=null;return kbe(e,(i,n)=>n.key.equals(o)?(r=n.value,this.delete(n),!1):!0),r}return Bbe(e)}computeIfAbsent(o,t){let e=this.get(o);if(e===null){let r=t(o);return this.put(o,r),r}else return e}size(){return this.innerList.size()}isEmpty(){return this.innerList.size()===0}keys(){return new cyt(this.innerList.iterator())}values(){return new hyt(this.innerList.iterator())}entries(){return this.innerList.iterator()}},ZN=class{constructor(){this.innerMap=new HQ}add(o){return this.innerMap.put(o,!0)!==!0}remove(o){this.innerMap.remove(o)}contains(o){return this.innerMap.get(o)===!0}iterator(){return this.innerMap.keys()}addAll(o){let t=o.iterator();for(;t.hasNext();)this.add(t.next())}size(){return this.innerMap.size()}clear(){let o=this.iterator();for(;o.hasNext();){let t=o.next();this.remove(t)}}},v6e=$g.funcCopy(hL);function uyt(o,t){let e=0;if(Math.abs(o.start.y-t)<=1e-4)nt[e++]=o.start.x;else if(Math.abs(o.end.y-t)<=1e-4)nt[e++]=o.end.x;else if(o.shape instanceof bt)e=D1t(o.shape,t);else if(o.shape instanceof dr)e=w1t(o.shape,t);else throw new Error("not supported operation");return e}var _Q=class{constructor(o,t,e,r){this.sides=new Array,this.loader=o,this.loader.bo=this,this.logger=e,this.rule=t,this.event=r}static sortByBBoxMinY(o,t){return o.bbox().minY-t.bbox().minY}static sortByBBoxAreaDesc(o,t){return t.bbox().area()-o.bbox().area()}addPolyline(o,t=1,e=.01,r=!0){for(let i of this.loader.buildGroup(o,t,e,r))this.sides.push(i),this.event.onOriginSide(i)}buildRTree(){let o=new WW(10);for(let t of this.sides)o.add(t);return o}fillValidSides(o,t,e){for(let r of t)isFinite(r.getX(e))&&o.push(r)}getSortedEndpointsLineAsc(o){let t=new Array;for(let i of o)i.needCountWeight()&&(t.push(i.start),t.push(i.end));v6e(t,Nt.sortByYAsc,0,t.length);let e=new Array,r=Number.NEGATIVE_INFINITY;for(let i of t){let n=i.y;n>r&&(e.push(n),r=n)}return e}splitSides(o,t,e){let r=o.start,i=o.end,n=new Nt(i.x+(r.x-i.x)*2,i.y+(r.y-i.y)*2);v6e(o.inters,(a,l)=>a.distance2(n)-l.distance2(n),0,o.inters.length);let s=null;for(let a of o.inters)if(s==null)a.equals(r)&&(s=a);else if(!a.equals(s)){let l=ek.rebuild(o.shape,s,a);l instanceof dr&&Math.abs(l.sweepAngle)>190&&(l=new bt(s,a));let c=new ek(this,l,o.baseWeight,s,a,o.polyGrp,e++);if(t.push(c),c.updateBbox(),a.equals(i))break;s=a}return e}splitSidesByInters(){let o=new Array;for(let t of this.sides)if(t.polyIndex==0){let e=0,r=null,i=null;do{let n=new Array;e=this.splitSides(t,n,e);for(let s of n)r!=null?(r.next=s,s.previous=r):i=s,r=s,this.event.onSplitedSide(s),o.push(s);if(t.next===null)throw new Error("not supported operation");t=t.next}while(t.polyIndex!==0);i!=null&&r!=null&&(i.previous=r,r.next=i)}this.sides.length=0;for(let t of o)this.sides.push(t)}seekIntersection(){if(this.sides.length>0){let o=this.buildRTree(),t=new ZN;for(let e of this.sides){t.add(e);let r=e.bbox().extendOfSize(1e-5),i=e.shape instanceof bt;for(let n of o.search(r))if(!t.contains(n)){let s=n.shape instanceof bt;if(!(i&&s&&e.next!==null&&e.previous!==null&&(e.next.equals(n)||e.previous.equals(n)))){let a=ZT(e.shape,n.shape);for(let l=0;l<a;l+=2){let c=new Nt(nt[l],nt[l+1]);e.inters.push(c),n.inters.push(c),this.event.onIntersect(c,e,n)}}}}}}},dyt=class D5e{constructor(t){this.sides=new ZN,this.others=new ZN,this.id=t}add(t){this.sides.add(t),t.finalGrp=this.id;for(let e of t.connect)this.others.add(e)}polyline(){let t=new Array;return KN(this.sides,(e,r)=>(t.push(r.shape),!0)),Qs.build2(t).asClose()}hashCode(){return this.id}equals(t){return t!=null&&t instanceof D5e?this.id===t.id:!1}},w5e=class{constructor(o){this.bo=null,this.sides=new Array,this.polyGrp=0,this.polyIndex=0,this.prevSide=null,this.firstSide=null,this.noWeight0=o}completeGroup(o){this.prevSide!=null&&this.firstSide!=null&&!this.prevSide.end.equals(this.firstSide.start)&&this.addSide(new bt(this.prevSide.end,this.firstSide.start),o);let t=new Array,e=null,r=null;for(let i of this.sides)(!this.noWeight0||i.weight!==0)&&(e!=null?(e.next=i,i.previous=e):r=i,e=i,t.push(i));return e!=null&&r!=null&&(r.previous=e,e.next=r),this.polyGrp++,this.sides.length=0,this.prevSide=null,this.firstSide=null,this.polyIndex=0,t}buildGroup(o,t,e,r=!0){for(let i of o.primitives)if(i instanceof bt)this.addSide(i,t);else if(r&&i instanceof dr&&i.rx===i.ry)this.addArc(i,t);else{let n=null;for(let s of i.points(e))n!=null&&this.addSide(new bt(n,s),t),n=s}return this.completeGroup(t)}addArc(o,t){let e=o.sweepAngle,r=Uo.regularD(o.startAngle),i=r+e;if(e>0){let n=90;for(;n<=i;)n>r&&(this.addSide(dr.build3(o.center,r,n-r,o.rx,o.ry),t),r=n),n+=90;r<i&&this.addSide(dr.build3(o.center,r,i-r,o.rx,o.ry),t)}else if(e<0){let n=270;for(;n>=i;)n<r&&(this.addSide(dr.build3(o.center,r,n-r,o.rx,o.ry),t),r=n),n-=90;r>i&&this.addSide(dr.build3(o.center,r,i-r,o.rx,o.ry),t)}}addSide(o,t){if(o.start().equals(o.end()))return;let e=o.start(),r;this.prevSide!=null?(this.prevSide.end.equals(e)||this.addSide(new bt(this.prevSide.end,e),t),r=new ek(this.bo,o,t,o.start(),o.end(),this.polyGrp,this.polyIndex++)):(r=new ek(this.bo,o,t,o.start(),o.end(),this.polyGrp,this.polyIndex++),this.firstSide=r),this.prevSide=r,this.sides.push(r)}},L5e=class{constructor(o,t,e){this.eps=new Array,this.curWeight=0,this.start=null,this.last=null,this.prevStart=null,this.prevEnd=null,this.y=e,this.rule=o,this.bo=t,this.event=t.event}onEp(o){this.tuningWeight(o),this.start===null?this.rule(this.curWeight)?this.in(o):o.setInvalid(this.y):this.rule(this.curWeight)?o.setInvalid(this.y):this.out(o,this.start),this.last!==null&&this.event.onSweep1(this.last,o,this.y),this.last=o}in(o){this.prevEnd!=null&&this.onSameX(o,this.prevEnd)?(this.start=this.prevStart,this.prevStart=null,this.prevEnd.revokeInside(this.y),this.prevEnd=null):(this.start=o,this.start.setOutside(this.y))}out(o,t){if(this.onSameX(t,o))t.revokeOutside(this.y);else{if(o.setInside(this.y)>0&&t.confidence(this.y)>0){let e=t.voteStatus(),r=o.voteStatus();this.isValid(e)&&this.isValid(r)?e==2&&r==1&&(o.connect.push(t),t.connect.push(o)):(o.connect.push(t),t.connect.push(o))}this.event.onSegment1(t,o,this.y),this.eps.push(t),this.eps.push(o),this.prevStart=t,this.prevEnd=o}this.start=null}isValid(o){return o==1||o==2}onSameX(o,t){return o.bbox().isIntersect(t.bbox())&&br.eq(o.getX(this.y),t.getX(this.y))}tuningWeight(o){this.curWeight+=o.weight;let t=o.nextNot0(),e=o.prevNot0();t!=null&&o.weight===t.weight&&t.trans===this.y&&(this.curWeight-=o.weight),e!=null&&o.weight===e.weight&&e.trans===this.y&&(this.curWeight-=o.weight),o.trans=this.y}},WQ=new Error,x6e=new class extends ez{decide1(o){return o[0]&&o[1]}}(2),pyt=new class extends R5e{onPolylineGroup(o,t){throw WQ}onSegment(o,t,e,r,i,n){throw WQ}},fyt=class{constructor(o,t){this.rtree=o,this.level=t}},myt=class M5e extends _Q{static isIntersect(t,e,r=nee.DUMMY){let i=new M5e(r),n=i.createGroup1(t.items),s=i.createGroup2(e.items);return n.rtree.itemList.length==0||s.rtree.itemList.length==0?!1:i.isIntersect(n,s)}constructor(t){super(new w5e(!1),x6e.rule,t,pyt)}createGroup1(t){return this.createGroup(t,0)}createGroup2(t){return this.createGroup(t,1)}createGroup(t,e){let r=x6e.weight(e);for(let n of t)this.addPolyline(n,r);let i=this.buildRTree();return this.sides.length=0,new fyt(i,e)}isIntersect(t,e){if(t.level!==e.level){let r=t.rtree.bbox().intersection1(e.rtree.bbox());if(r!==null){try{this.inters(t,e);let i=(r.minY+r.maxY)/2;this.sweep(t,e,i)}catch(i){if(i===WQ)return!0;throw i}return!1}else return!1}else throw new Error("inersection detection should not in same group")}inters(t,e){if(t.rtree.size()>e.rtree.size()){let r=t;t=e,e=r}for(let r of t.rtree.items()){r.trans=NaN;let i=r.bbox().extendOfSize(1e-5);for(let n of e.rtree.search(i))if(n.trans=NaN,ZT(r.shape,n.shape)>0)throw WQ}}sweep(t,e,r){let i=qg.extend2(t.rtree.bbox(),e.rtree.bbox()).extendOfSize(1e-5),n=new Array;this.fillValidSides(n,t.rtree.search(i),r),this.fillValidSides(n,e.rtree.search(i),r),hL(n,(a,l)=>a.getX(r)-l.getX(r),0,n.length);let s=new L5e(this.rule,this,r);for(let a of n)s.onEp(a)}},WPe=class IO{constructor(t){this.items=new Array(t.length),$g.arraycopy(t,0,this.items,0,t.length),this.__bbox=this.calcBBox()}static build1(t){let e=[];return kQ(t,(r,i)=>(e.push(i),!0)),new IO(e)}static build2(t){let e=t.map(r=>Qs.build8(r));return new IO(e)}static combinePolylineGroupArr(t){let e=[];for(let r of t)e=e.concat(r.items);return new IO(e)}calcBBox(){let t=new s2;for(let e=0;e<this.items.length;e++)t.ext1(this.items[e].bbox());return t.build1()}multiply3(t){let e=new Array(this.items.length);for(let r=0;r<e.length;r++)e[r]=this.items[r].multiply3(t);return new IO(e)}bbox(){return this.__bbox}asClose(){return this.items.forEach(t=>t.asClose()),this}mirrorY(t){return this.items.forEach(e=>e.mirrorY(t)),this}closeEndpoint(){return this.items.forEach(t=>t.closeEndpoint()),this}get primitives(){return this.items.map(t=>t.primitives).flat(2)}isEqual(t){return t instanceof IO?this.items.every(e=>t.items.some(r=>r.isEqual(e))):!1}getOutMostPolyline(){return this.items.reduce((t,e)=>e.bbox().area()>t.bbox().area()?e:t,this.items[0])}getOutline(){let t=this.items;if(t.length===1)return{outline:t,hole:new Array};let e=new Set,r=new Set;for(let i=0,n=t.length;i<n;i++){let s=t[i];if(!e.has(s)&&!r.has(s)){i+1>=n&&e.add(s);for(let a=i+1;a<n;a++){let l=t[a];if(!e.has(l)&&!r.has(l)){if(!s.bbox().isInside(l.bbox().extendOfSize(1e-4))&&!l.bbox().isInside(s.bbox().extendOfSize(1e-4)))continue;myt.isIntersect(new IO([s]),new IO([l]))&&(s.bbox().area()>l.bbox().area()?(e.add(s),r.add(l)):(e.add(l),r.add(s)))}}!e.has(s)&&!r.has(s)&&e.add(s)}}return{outline:[...e],hole:[...r]}}round(t=4){let e=this.items.map(r=>r.round(t));return new IO(e)}},gyt=$g.funcCopy(hL),yyt=$g.funcCopy(hL),byt=$g.funcCopy(hL);function Pyt(o){return new Array}function Tyt(o,t){let e=new FW(!1),r=new VW(o,nee.DUMMY,e);for(let i of t)r.addPolyline(i);return r.simplify(),e.plGrps}var VW=class extends _Q{constructor(o,t,e){super(new w5e(!1),o,t,e),this.finalSides=new Array,this.sideGroups={},this.vecSides=new Array,this.scanY=NaN,this.curNetIndex=0,this.curIndex=-1,this.scanLines=0}sweep(o,t,e){this.scanY=NaN,this.scanLines=0,gyt(t,_Q.sortByBBoxMinY,0,t.length);let r=new oL;this.curNetIndex=0;let i=Number.POSITIVE_INFINITY;for(let n of o)n>i&&this.scan(r,(i+n)/2,t),i=n;this.getAllMarkPrimitive(e,t),this.logger.debug3("scan %s %d",e,this.scanLines)}simplify(){this.seekIntersection(),this.splitSidesByInters(),this.sweep(this.getSortedEndpointsLineAsc(this.sides),this.sides,!1),this.flipSides(),this.sweep(this.getSortedEndpointsLineAsc(this.vecSides),this.vecSides,!0),this.connectSides(),this.fillResult()}addPolyline(o,t=1,e=.01,r=!0){super.addPolyline(o,t,e,r)}scan(o,t,e){if(this.scanY==t)return;this.scanY=t;let r=!1,i=o.listIterator();for(;i.hasNext();){let n=i.next(),s=n.item;br.less(s.bbox().maxY,t)?o.remove(n):!r&&s.isNeedScan(t)&&(r=!0)}for(;this.curNetIndex<e.length;){let n=e[this.curNetIndex];if(br.less(n.bbox().minY,t))br.greatereq(n.bbox().maxY,t)&&(this.add2AET(o,n),!r&&n.isNeedScan(t)&&(r=!0)),this.curNetIndex++;else break}if(r){this.scanLines++;let n=new L5e(this.rule,this,t),s=o.iterator();for(;s.hasNext();){let a=s.next();n.onEp(a)}}}add2AET(o,t){let e=t.bbox().minX,r=t.bbox().maxX,i=t.bbox().minY,n=t.bbox().maxY,s=o.listIterator(),a=null;for(;s.hasNext();){let l,c=s.next(),h=c.item,u=h.bbox().minX,d=h.bbox().maxX;if(r<=u)l=-1;else if(d<=e)l=1;else{let m=h.bbox().minY,g=h.bbox().maxY,y=Math.max(i,m),b=Math.min(n,g);l=this.compareBySweep(t,h,(y+b)/2)}let p=h.shape;if(p instanceof bt&&p.length()<.001&&a==null&&l<0){a=c;continue}if(a!=null&&l<0){o.insertBefore(a,t);return}if(l<0){o.insertBefore(c,t);return}else a=null}o.add(t)}getLineAngle(o){let t=o.start().angle(o.end());return t<0&&(t+=Math.PI),t}getArcAngle(o,t){let e=Math.asin((t-o.center.y)/o.rx);return o.startAngle>90&&o.startAngle<270&&(e=-e),e<0&&(e+=Math.PI),(e+Math.PI/2)%Math.PI}compareArcLine(o,t,e){let r=this.getArcAngle(o,e),i=this.getLineAngle(t);return br.eq(r,i)?-o.sweepAngle:i-r}compareBySweep(o,t,e){let r=o.getX(e);if(!isFinite(r))return 0;let i=t.getX(e);if(!isFinite(i))return 0;if(!br.eq(r,i))return r-i;if(o.shape instanceof bt)return t.shape instanceof bt?this.getLineAngle(t.shape)-this.getLineAngle(o.shape):-this.compareArcLine(t.shape,o.shape,e);if(t.shape instanceof bt)return this.compareArcLine(o.shape,t.shape,e);{let n=o.shape,s=t.shape,a=this.getArcAngle(n,e),l=this.getArcAngle(s,e);return br.eq(a,l)?n.sweepAngle*s.sweepAngle<=0?n.sweepAngle<=0?1:-1:n.sweepAngle>0?n.rx-s.rx:s.rx-n.rx:l-a}}getAllMarkPrimitive(o,t){for(let e of t)if(e.status===0&&e.bbox().height()!=0){let r=e.voteStatus();if(r===2||r===1){e.status=r;let i=e.reverse(r);if(o){this.event.onResultSide(i);let n=i.shape.multiply3(tc.ROT_N90),s=i.start.multiply3(tc.ROT_N90),a=i.end.multiply3(tc.ROT_N90);i=new ek(this,n,i.baseWeight,s,a,i.polyGrp,i.polyIndex)}this.finalSides.push(i),this.event.onResultSide(i)}}}flipSides(){for(let o of this.sides)if(o.polyIndex==0){let t=null,e=null;do{let r=o.shape.multiply3(tc.ROT_90),i=o.start.multiply3(tc.ROT_90),n=o.end.multiply3(tc.ROT_90),s=new ek(this,r,o.baseWeight,i,n,o.polyGrp,o.polyIndex);if(s.outsideWeight=o.outsideWeight,s.insideWeight=o.insideWeight,s.invalidWeight=o.invalidWeight,s.status=o.status,t!=null?(t.next=s,s.previous=t):e=s,this.vecSides.push(s),this.event.onSplitedSide(s),t=s,o.next!==null)o=o.next;else break}while(o.polyIndex!=0);e!=null&&(e.previous=t,t.next=e)}}canBeEnd(o,t){if(o.size()==1){let e=o.getFirst().shape;if(e instanceof dr){if(t&&e.rx<=t)return!1}else if(e instanceof bt&&t&&e.length()<=t)return!1}return!0}connectSides(){let o=new HQ,t=new WW(10);for(let n of this.finalSides)o.computeIfAbsent(n.start,Pyt).push(n),t.add(n.start);let e=0,r=new ZN,i=new Array;for(let n of this.finalSides)if(!r.contains(n)){let s=new ZN,a=n.start,l=new oL;l.add(n),r.add(n);let c=n.end;for(;l.size()>0;)if(this.isStart(a,c)&&this.canBeEnd(l,.01)){l.size()>1&&this.fillSideGroups(l,e++);break}else{let h=o.get(c),u=this.findNext(r,h);if(u==null&&(c=this.findNeigber(c,s,t,.01),c!==null&&(h=o.get(c),u=this.findNext(r,h))),u!=null)l.add(u),r.add(u),c=u.end;else if(c!=null?s.add(c):(i.length==0&&l.size()>1&&this.logger.warning3("unable to connect at %s",l.getLast()),i.push(l.removeLast())),l.size()>0)c=l.getLast().end;else break}}}fillSideGroups(o,t){let e=new dyt(t);KN(o,(r,i)=>(e.add(i),!0)),this.sideGroups[e.id]=e}isStart(o,t){return o.distance2(t)<=1e-4}findNext(o,t){if(t!=null){for(let e of t)if(!o.contains(e))return e}return null}fillResult(){let o=0,t=new HQ;for(let r in this.sideGroups){let i=this.sideGroups[r];KN(i.sides,(n,s)=>(s.polyGrp!=-2&&t.put(s,s),!0))}let e=new ZN;for(let r in this.sideGroups){let i=this.sideGroups[r];if(e.add(i)){let n=0,s=new Array;for(s.push(i);n<s.length;){let l=s[n],c=new Array;KN(l.others,(u,d)=>{let p=t.get(d);return p!=null&&c.push(p.finalGrp),!0}),yyt(c,$g.sortAsc,0,c.length);let h=l.id;for(let u of c)if(u!=h&&u!=l.id){let d=this.sideGroups[u];e.add(d)&&s.push(d),h=u}n++}let a=new Array;for(let l of s)a.push(l.polyline());byt(a,_Q.sortByBBoxAreaDesc,0,a.length),this.event.onPolylineGroup(new WPe(a),o++)}}}findNeigber(o,t,e,r){let i=r*r,n=Number.MAX_VALUE,s=null;for(let a of e.search(o.bbox().extendOfSize(r)))if(!t.contains(a)){let l=o.distance2(a);l<n&&(n=l,s=a)}return n<i?s:null}},Iyt=class{constructor(){this.points=[],this.lines=[],this.arcs=[],this.beziers=[],this.listText=[],this.fonts=[]}addPt(o,t=!0){if(o instanceof bt)this.lines.push(o);else if(o instanceof dr)this.arcs.push(o);else if(o instanceof ki)this.beziers.push(o);else throw new Error("not support");t&&this.points.push(o.start())}addPoint(o){this.points.push(o)}addText(o,t,e=1,r=.1,i=!0){this.listText.push({pos:o,str:t,size:e,width:r}),i&&this.points.push(o)}addPly(o,t=!0){o.primitives.forEach(e=>this.addPt(e,t))}build(){let o=[],t=[],e=[],r=[],i=[],n=[];return this.points.forEach(s=>o.push(s.x,s.y)),this.lines.forEach(s=>t.push(s.start().x,s.start().y,s.end().x,s.end().y)),this.arcs.forEach(s=>e.push(s.center.x,s.center.y,s.rx,Uo.toRadians(s.startAngle),Uo.toRadians(s.endAngle()),s.sweep())),this.beziers.forEach(s=>{s.controls.forEach(a=>{r.push(a.x,a.y)}),r.push("end")}),this.listText.forEach(s=>i.push(s.pos.x,s.pos.y,s.str,s.width,s.size)),this.fonts.forEach(s=>n.push(s)),{points:o,lines:t,arcs:e,texts:i,beziers:r,fonts:n}}},SW,tz=(SW=class{constructor(o){this.map=new HQ,this.bus=o}initColor(o){return this.map.computeIfAbsent(o,()=>new Iyt)}draw(){let o={},t=this.map.entries();for(;t.hasNext();){let e=t.next();o[e.key.toString()]=e.value.build()}this.bus.publish("/debug/draw",o)}clear(){this.map.clear()}static init(o){if(!o)throw new Error("bus is undefined!");this.palette=new SW(o)}static initPalette(o){this.palette=o}static getDefaultColor(){for(let o of this.colorBuffersMap)if(o[0]!==null&&o[0])return o[0]=!1,o[1];return this.colorBuffersMap.forEach(o=>{if(o[0]===null){console.log(1);return}o[0]=!0}),this.getDefaultColor()}static clear(){this.palette.clear()}static auto(o,t=this.getDefaultColor()){if(Array.isArray(o))o.forEach(e=>{this.auto(e,t)});else if(o instanceof Nt)this.point(o,t);else if(o instanceof qg)this.bbox(o,t);else if(o instanceof QW)this.primitive(o,t);else if(o instanceof Qs)this.polyline(o,t);else if(o instanceof m0)this.polygon(o,t);else if(o instanceof Gd)this.group(o,t);else if(o instanceof WPe)this.auto(o.items,t);else{debugger;throw new Error("No incoming type!")}}static text(o,t,e=.5,r=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");this.palette.initColor(r).addText(o,t,e,e/10),this.palette.draw()}static point(o,t=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");let e=this.palette.initColor(t);Array.isArray(o)?o.forEach(r=>{this.point(r,t)}):e.addPoint(o),this.palette.draw()}static bbox(o,t=this.getDefaultColor()){Array.isArray(o)?o.forEach(e=>{this.bbox(e,t)}):(this.primitive(new bt(new Nt(o.maxX,o.maxY),new Nt(o.maxX,o.minY)),t),this.primitive(new bt(new Nt(o.maxX,o.maxY),new Nt(o.minX,o.maxY)),t),this.primitive(new bt(new Nt(o.minX,o.minY),new Nt(o.maxX,o.minY)),t),this.primitive(new bt(new Nt(o.minX,o.minY),new Nt(o.minX,o.maxY)),t))}static primitive(o,t=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");let e=this.palette.initColor(t);Array.isArray(o)?o.forEach(r=>{this.primitive(r,t)}):e.addPt(o),this.palette.draw()}static polyline(o,t=this.getDefaultColor()){Array.isArray(o)?o.forEach(e=>{this.polyline(e,t)}):o.primitives.forEach(e=>{this.primitive(e,t)})}static polygon(o,t=this.getDefaultColor()){Array.isArray(o)?o.forEach(e=>{this.polygon(e,t)}):o.items.forEach(e=>{this.polyline(e,t)})}static group(o,t=this.getDefaultColor()){Array.isArray(o)?o.forEach(e=>{this.group(e,t)}):o.items.forEach(e=>{this.polygon(e,t)})}static async begin(){this.t1=performance.now()}static async end(o){console.log(o||"t1:",performance.now()-this.t1)}static async log(o){console.log(o||"==================")}},SW.colorBuffersMap=[[!0,_l.BLUE],[!0,_l.GREEN],[!0,_l.WHITE],[!0,_l.RED],[!0,_l.Golden],[!0,_l.Gray]],SW.t1=0,SW),Cyt=0,rz=class uPe{constructor(t,e){this.inters=[],this.shape=t,this.start=t.start(),this.end=t.end(),this.judgeOverlapMap=new Map,e&&(this.id=Cyt++)}reverse(){this.shape=this.shape.reverse();let t=this.start;this.start=this.end,this.end=t}getCenterPoint(t=this.end){let{x:e,y:r}=this.start,{x:i,y:n}=t;if(this.shape instanceof dr){let s=this.shape.rx,a=new Nt((e+i)/2,(r+n)/2),l=this.shape.center,c;return a.x!==l.x||a.y!==l.y?(c=a.angle(l),Math.abs(this.shape.sweepAngle)>180&&(c+=c>=0?-180:180)):c=(this.shape.startAngle+this.shape.endAngle())/2,new Nt(l.x+Math.cos(c)*s,l.y+Math.sin(c)*s)}else{if(this.shape instanceof bt)return new Nt((e+i)/2,(r+n)/2);if(this.shape instanceof ki){let s=this.shape.getPercent(t,to);return ki.pointOn(s/2,this.shape.controls)}else throw Error("not support")}}static finalAngle(t,e,r){let i=t.cross(e)>0,n=Math.acos(Math.min(1,Math.max(-1,t.dot(e)/e.length())));return(r?!i:i)&&(n=oee-n),n}sortInters(){if(this.shape instanceof dr){let t=this.shape.center,e=this.shape.start().sub(t).normalize(),r=this.shape.isCCW;this.inters.sort((i,n)=>{let s=i.coord.sub(t),a=n.coord.sub(t);return uPe.finalAngle(e,s,r)-uPe.finalAngle(e,a,r)<=0?-1:1})}else if(this.shape instanceof bt){let t=this.start,e=this.end,r=new Nt(e.x+(t.x-e.x)*2,e.y+(t.y-e.y)*2);this.inters.sort((i,n)=>i.coord.distance2(r)-n.coord.distance2(r)<=0?-1:1)}else if(this.shape instanceof ki){let t=this.shape;this.inters.sort((e,r)=>t.getPercent(e.coord,to)-t.getPercent(r.coord,to)<=0?-1:1)}else throw Error("not support the primitive type");this.inters.forEach((t,e)=>t.setIndex(e))}getStart(){return this.start}getEnd(){return this.end}getShape(){return this.shape}connect(t){this.nextSide=t,t.prevSide=this}static returnPolygonList(t){let e=[];return t.forEach(r=>{let i=[];r.forEach((n,s)=>{let a=[];n.forEach(l=>{a.push(l.shape)}),i.push(Qs.build7(a))}),e.push(new m0(i))}),e}addInter(t){this.inters.push(t)}static returnPolygonGroup(t){let e=[];return t.forEach(r=>{let i=[];r.forEach((n,s)=>{let a=[];n.forEach(l=>{a.push(l.shape)}),i.push(Qs.build7(a))}),e.push(new m0(i))}),new Gd(e)}static rebuild(t,e,r){let i;if(t instanceof bt||e.distance2(r)<1e-6)i=new bt(e,r);else if(t instanceof dr)i=dr.build2(t.center,e.angleD(t.center),r.angleD(t.center),t.rx,t.ry,t.isCCW?1:0);else if(t instanceof ki){let n=t.getPercent(e,to),s=t.clip(n)[1];i=s.clip(s.getPercent(r,to))[0]}else throw new Error("not supported operation");return eo(t,e).dot(eo(i,e))<0?null:i}static returnPolyline(t){return Qs.build7(t.map(e=>e.shape))}bbox(){return this.shape.bbox()}},Syt=(o=>(o[o.END1=0]="END1",o[o.END2=1]="END2",o[o.END12=2]="END12",o[o.LEFT1=3]="LEFT1",o[o.LEFT2=4]="LEFT2",o))(Syt||{});function Kg(o,t,e){if(o instanceof dr&&t instanceof dr)return Ayt(o,t);if(o instanceof dr&&t instanceof bt)return w6e(o,t);if(o instanceof bt&&t instanceof dr)return D6e(o,t);if(o instanceof bt&&t instanceof bt)return aL(o,t);if(o instanceof ki&&t instanceof bt)return o.controls.length===2||OO(o)?aL(new bt(o.start(),o.end()),t):N5e(o,t);if(o instanceof bt&&t instanceof ki)return t.controls.length===2||OO(t)?aL(o,new bt(t.start(),t.end())):dPe(o,t);if(o instanceof dr&&t instanceof ki)return t.controls.length===2||OO(t)?w6e(o,new bt(t.start(),t.end())):Eyt(o,t);if(o instanceof ki&&t instanceof dr)return o.controls.length===2||OO(o)?D6e(new bt(o.start(),o.end()),t):Oyt(o,t);if(o instanceof ki&&t instanceof ki)return zPe(o,t);throw new Error("not support")}function wN(o,t){return eo(o,t.start()).dot(eo(t,t.start()))<=0?!1:Kg(o,t).state<=2}function Fbe(o,t){let e=t.getPercent(o.end(),to);if(e===null)return!1;if(e===0)return!0;let r=t.clip(e)[0],i=o.buildConverxHull(to),n=r.buildConverxHull(to),s=c(i),a=c(n);return l(s,a);function l(h,u){let d=new Map([[0,1],[1,0],[2,2],[3,4],[4,3]]),p=h[0],m=u[0];if(!p||!m)throw Error("isAllOverlap(sides1: PackSide[], sides2: PackSide[])");let g=!0;do{let y=p.getShape(),b=m.getShape();if(y instanceof bt&&b instanceof bt){let P=g?aL(y,b).state:d.get(aL(b,y).state);if(P===0)p=p.nextSide,g=!1;else if(P===1)m=m.nextSide,g=!0;else if(P===2)p=p.nextSide,m=m.nextSide,g=!0;else return!1}else throw Error("not support")}while(p!==h[0].prevSide&&m!==u[0].prevSide);return!0}function c(h){let u=h.primitives.map(p=>new rz(p)),d=u[u.length-1];return u.forEach(p=>{d.connect(p),d=p}),u}}function R6e(o,t){let e=o.end().distance2(t.center);if(e>(t.rx+to)**2||e<(t.rx-to)**2||!(vn(o.end(),t.end())||YPe(t,o.end())))return!1;if(o.center.equals1(t.center))return!0;let r=o.center.distance1(t.center),i=Math.abs(o.rx-t.rx);if(r>Math.min(o.rx,t.rx)){let n=o.center.angleD(t.center);return o.rx>t.rx?!(r+i>to&&D9(o,n))&&!(r-i>to&&o.rx+t.rx-r>to&&D9(o,n+180)):!(r-i>to&&D9(o,n))&&!(o.rx+t.rx-r>to&&D9(o,n+180))}else{if(r+i<=to)return!0;let n=o.rx>t.rx?o.center.angleD(t.center):t.center.angleD(o.center);return D9(o,n)?!1:r-i<=to?!0:!D9(o,n+180)}}function Eyt(o,t){let e=jPe(o,t.start()).toBezier2(),r,i=0;for(let n=e.length;i<n;i++){let s=e[i];if(r=zPe(s,t).state,r!==0)break}return r===2&&i!==e.length-1?{state:1}:{state:r}}function Oyt(o,t){let e=t.toBezier2(),r,i=0;for(let n=e.length;i<n;i++){let s=e[i];if(r=zPe(o,s).state,r!==1)break}return r===2&&i!==e.length-1?{state:0}:{state:r}}function zPe(o,t){if(o.controls.length===2||OO(o))return t.controls.length===2||OO(t)?aL(new bt(o.start(),t.end()),new bt(t.start(),t.end())):dPe(new bt(t.start(),o.end()),t);if(t.controls.length===2||OO(t))return N5e(pPe(o,t.start()),new bt(t.start(),t.end()));let e=pPe(o,t.start());if(OO(e))return dPe(new bt(t.start(),o.end()),t);let r=Fbe(e,t),i=Fbe(t,e);if(!r&&!i){let n=U1t(e,t);if(n.havOverlap){let s=n.havOverlap!==2,a=n.havOverlap!==1;return _O(o,t,s,a)}else{let s=function(){for(let u=0;u<c;u+=2)nt[u]=h[u],nt[u+1]=h[u+1]},a,l,c=n.cnt,h=new Array(c).fill(0).map((u,d)=>nt[d]);for(let u=0;u<c;u+=2){let d=new Nt(nt[u],nt[u+1]),p=e.getPercent(d,to),m=t.getPercent(d,to);if(p===0||m===0)continue;let g=p===1?e:e.clip(p)[0],y=m===1?t:t.clip(m)[0];if(Fbe(g,y)){let b=eo(o,d).cross(eo(t,d));if(b===0){a=e.end(),l=t.end();break}return{state:b<0?3:4}}s()}return(!a||!l)&&(a=jN(e.controls,e.controls[0],t),l=jN(t.controls,e.controls[0],e)),{state:a.sub(e.controls[0]).cross(l.sub(e.controls[0]))>0?4:3}}}return _O(o,t,r,i)}function N5e(o,t){let e=pPe(o,t.start());if(OO(e))return aL(new bt(e.start(),e.end()),t);let r=B5e(e,t),{isIn:i,bezierIsInLeft:n}=k5e(t,e);if(!r&&!i){if(n!==void 0)return{state:n?3:4};let s=null,a=o.getPercent(t.start(),to)+.01;for(let l=a>1?1:a;l<=1;){let c=ki.pointOn(l,o.controls);if(zW(t,c)>Zg){s=c;break}l+=.01,l>1&&(l=1)}if(!s)throw Error("!end1 && !end2 not result");return{state:t.direct.cross(s.sub(t.start()))<0?4:3}}return _O(e,t,r,i)}function dPe(o,t){let{isIn:e,bezierIsInLeft:r}=k5e(o,t),i=B5e(t,o);if(!e&&!i){if(r!==void 0)return{state:r?4:3};let n=null;for(let s=.01;s<=1;){let a=ki.pointOn(s,t.controls);if(zW(o,a)>Zg){n=a;break}s+=.01,s>1&&(s=1)}if(!n)throw Error("!end1 && !end2 not result");return{state:o.direct.cross(n.sub(o.start()))<0?3:4}}return _O(t,o,e,i)}function Ayt(o,t){let e=R6e(jPe(o,t.start()),t),r=R6e(t,o);if(!e&&!r){let i=KC(t);if(o.center.sub(t.start()).dot(t.center.sub(t.start()))>0){if(o.rx===t.rx)return o.isCCW?{state:i.dot(o.center.sub(t.center))<0?3:4,exitIsInvalid:!1}:{state:i.dot(o.center.sub(t.center))>0?3:4,exitIsInvalid:!1};let n,s;return o.rx>t.rx?(n=o,s=t):(n=t,s=o),i.dot(s.center.sub(n.center))>0&&s.rx+s.center.distance1(n.center)-n.rx>to?o.isCCW?{state:o.rx>t.rx?3:4,exitIsInvalid:!1}:{state:o.rx<t.rx?3:4,exitIsInvalid:!1}:o.isCCW?{state:o.rx<t.rx?3:4,exitIsInvalid:!0}:{state:o.rx>t.rx?3:4,exitIsInvalid:!0}}else return o.rx+t.rx-o.center.distance1(t.center)>to&&i.dot(o.center.sub(t.center))>0?{state:t.isCCW?3:4,exitIsInvalid:!1}:{state:o.isCCW?3:4,exitIsInvalid:!0}}return _O(o,t,e,r)}function D6e(o,t){let e=$C.foot(o,t.center),r=o.end().distance2(t.center),i=o.end().sub(o.start()),n=(t.rx-to)**2,s=r<=(t.rx+to)**2&&r>=n&&(i.dot(e.sub(t.start()))<=0||o.start().distance2(o.end())<=o.start().distance2(e)||e.distance2(t.center)>=n)&&(vn(o.end(),t.end())||YPe(t,o.end())),a=F5e(t,o);if(!s&&!a){let l=o.distance2(t.center);return l<=Zg?{state:i.cross(KC(t))>0?4:3}:i.dot(e.sub(t.start()))>=0&&(r<n||o.start().distance2(t.center)<n||l<n)?{state:i.cross(t.center.sub(o.start()))<0?4:3}:{state:i.cross(t.center.sub(o.start()))>0?4:3}}return _O(t,o,s,a)}function D9(o,t){return t=Uo.regularD(t),o.sweepAngle>0?(t<o.startAngle&&(t+=360),o.endAngle()>t):(t>o.startAngle&&(t-=360),o.endAngle()<t)}function YPe(o,t){return vn(o.end(),t)||vn(o.start(),t)||D9(o,t.angleD(o.center))}function k5e(o,t){let e=o.panDistance(to),r=o.panDistance(-to),i=L6e(t,e),n=L6e(t,r);if(!i.length&&!n.length)return{isIn:t.getPercent(o.end(),to)!==null};let s=[...i,...n].sort((h,u)=>h.t-u.t),a=new bt(r.start(),e.start()),l=[];for(let h=0,u=s.length;h<u;h++){let d=s[h];if(l.push(d),a.distance(d.interP)>o.length()+to)break;if(l.length===2){let p=(l[1].t*10+l.shift().t*10)/20,m=ki.pointOn(p,t.controls);if(o.distance2(m)>Zg)return{isIn:!1,bezierIsInLeft:o.direct.cross(m.sub(o.start()))>0}}}let c=l.length?a.distance(l[0].interP)>=o.length()+to:!0;return{isIn:c,bezierIsInLeft:c?void 0:o.direct.cross(l[0].interP.sub(o.start()))>0}}function B5e(o,t){if(zW(t,o.end())>Zg||o.getToLineMaxDis2(t)>Zg)return!1;let e=vyt(t,Zg);return o.getToLineMaxDis2(e)<=(t.length()+to)**2}function F5e(o,t){let e=t.end().angleD(t.start()),r=_yt(t,o.end());if(r>Zg)return!1;if(D9(o,e+90)){if($C.foot(t,o.center).distance1(o.pointOn(e+90))>o.rx)return!1;r=Math.max(r,(o.rx-t.distance(o.center))**2)}if(D9(o,e-90)){if($C.foot(t,o.center).distance1(o.pointOn(e-90))>o.rx)return!1;r=Math.max(r,(o.rx-t.distance(o.center))**2)}return r<=Zg&&(vn(o.end(),t.end())||fPe(t,o.end()))}var V5e=(to*2)**2;function jPe(o,t){if(vn(o.end(),t))return dr.build3(o.center,o.endAngle(),0,o.rx,o.ry);if(o.start().distance2(t)<V5e)return o;let e=Uo.regularD(t.angleD(o.center));if(!D9(o,e))throw new Error("!angleIsInArc(arc, angle)");return dr.build2(o.center,e,o.endAngle(),o.rx,o.ry,o.isCCW?1:0)}function pPe(o,t){if(vn(o.end(),t))return new ki([t,t]);if(o.start().distance2(t)<V5e)return o;let e=o.getPercent(t,to);if(e===null)throw new Error("!cutBezier(bezier: Bezier, p: Vector2)");return o.clip(e)[1]}function w6e(o,t){let e=F5e(jPe(o,t.start()),t),r=t.end().distance2(o.center),i=t.end().sub(t.start()),n=$C.foot(t,o.center),s=(o.rx-to)**2,a=r<=(o.rx+to)**2&&r>=s&&(i.dot(n.sub(t.start()))<=0||t.start().distance2(t.end())<=t.start().distance2(n)||n.distance2(o.center)>=s)&&(vn(o.end(),t.end())||YPe(o,t.end()));if(!e&&!a){let l=t.distance2(o.center);return l<=Zg?{state:i.cross(KC(o,t.start().angle(o.center)))>0?3:4}:i.dot(n.sub(t.start()))>=0&&(r<s||t.start().distance2(o.center)<s||l<s)?{state:i.cross(o.center.sub(t.start()))>0?4:3}:{state:i.cross(o.center.sub(t.start()))<0?4:3}}return _O(t,o,e,a)}function aL(o,t){if(vn(o.end(),t.end()))return _O(o,t,!0,!0);let e=zW(t,o.end())<=Zg&&fPe(t,o.end()),r=zW(o,t.end())<=Zg&&fPe(o,t.end());if(!e&&!r){let i=o.direct.x===0&&o.direct.y===0,n=t.direct.x===0&&t.direct.y===0;if(i&&n)throw Error("2LineAllIsPoint");return i?{state:t.direct.cross(o.end().sub(t.start()))>0?3:4}:{state:o.end().sub(o.start()).cross(t.end().sub(o.start()))>0?4:3}}return _O(o,t,e,r)}function fPe(o,t){return $C.foot(o,t).distance2(o.start())<o.end().distance2(o.start())}function _O(o,t,e,r){if(e)return r?vn(o.end(),t.end())?{state:2}:{state:0}:{state:0};if(r)return{state:1};throw new Error("!end1 && !end2")}function zW(o,t){return(o.a*t.x+o.b*t.y+o.c)**2/(o.a**2+o.b**2)}function _yt(o,t){return Math.min(o.distance2(t),$C.foot(o,t).distance2(t))}function vyt(o,t){let e=o.panDistance(t),r=o.panDistance(-t);return new bt(r.start(),e.start())}function OO(o){let t=o.start(),e=o.end();t.equals1(e)&&(e=t.add1(1,0));let r=e.y-t.y,i=t.x-e.x,n=-r*t.x-i*t.y,s=Math.sqrt(1/(r**2+i**2));r*=s,i*=s,n*=s;let a=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;return o.controls.forEach(c=>{let h=r*c.x+i*c.y+n;h<a&&(a=h),h>l&&(l=h)}),k9(a,l)}function L6e(o,t){let e=ZT(o,t),r=[],i=new Array(e).fill(0).map((s,a)=>nt[a]);for(let s=0;s<e;s+=2){let a=new Nt(nt[s],nt[s+1]),l=o.getPercent(a);r.push({interP:a,t:l}),n()}function n(){for(let s=0;s<e;s+=2)nt[s]=i[s],nt[s+1]=i[s+1]}return r}var x9=.01,xyt=270;function mv(o){let t=x9**2,e=o.end(),r=[],i=[];for(let p=0,m=o.primitives.length;p<m;p++){let g=function(v,D){return v instanceof bt&&D instanceof bt&&Math.abs(v.direct.cross(D.direct))<br.eps&&v.direct.dot(D.direct)>0||v instanceof dr&&D instanceof dr&&Math.abs(v.rx-D.rx)<=br.eps&&v.center.distance2(D.center)<br.eps&&v.isCCW===D.isCCW},y=function(v){if(OP(v,x9))i.push(null);else{if(v instanceof bt)i.push(v);else if(v instanceof dr&&v.rx===v.ry)u(v,i);else if(v instanceof ki){let D=[];_5e(v,D),D.forEach(w=>{let F=w.start(),H=w.end();h(F,H)||i.push(w)})}else throw new Error("not support!");e=I}},b=function(v){if(v instanceof bt)return v.direct.x===0&&v.direct.y===0;if(v instanceof dr)return v.sweepAngle===0;if(v instanceof ki){let D=new Set(v.controls.map(F=>F.x)),w=new Set(v.controls.map(F=>F.y));return D.size===1&&w.size===1}else throw new Error("not support")},P=o.primitives[p],T=P.start(),I=P.end();if(b(P))continue;h(e,T)||(i.push(new bt(e,T)),e=T);let C=(p+1)%m,E=o.primitives[C];for(;g(P,E)&&(C=(C+1)%m,E=o.primitives[C],E!==P););if(C===(p+1)%m){y(P);continue}if(E===P){if(!(P instanceof dr)){if(Math.abs(o.area(.1))<t)return null;throw new Error("simplifyPolyline not support")}let v=P instanceof dr?P.isCCW:o.area(.1)>0;i.length=0;let D=v?180:-180;i.push(dr.build3(P.center,P.startAngle,D,P.rx,P.ry),dr.build3(P.center,P.startAngle+D,D,P.rx,P.ry));break}let O=(()=>{if(P instanceof bt)return(v,D)=>{let w=new bt(v,D);return OP(w,x9)?null:[w]};if(P instanceof dr)return(v,D)=>{let w;if(v.equals1(D)?w=dr.build3(P.center,P.startAngle,P.sweep()===1?360:-360,P.rx,P.ry):w=dr.build4(v,D,P.center,P.rx,P.ry,P.sweep()),OP(w,x9))return null;let F=w.pointOn(w.startAngle+w.sweepAngle/2),H=dr.build4(w.start(),F,P.center,P.rx,P.ry,P.sweep()),z=dr.build4(F,w.end(),P.center,P.rx,P.ry,P.sweep());return OP(H,x9)||OP(z,x9)?[w]:[H,z]};throw new Error("not support")})(),_=C===0;if(C<p&&!_&&(_=!O(o.primitives[0].start(),o.primitives[C-1].end()),!_)){let v=O(P.start(),o.primitives[m-1].end());if(v)i.push(...v);else{let D=O(P.start(),i[0].end());if(D.length===1)i[0]=D[0];else if(D.length===2)i[0]=D[1],i.push(D[0]);else throw new Error("!!!generatorPt")}break}p=C===0?m-1:C-1,E=o.primitives[p];let x=O(P.start(),E.end());if(x?(x.forEach(v=>i.push(v)),e=E.end()):y(null),_)break}let n=i.length;if(i.forEach((p,m)=>{if(p)r.push(p);else{let g,y;m===n-1&&(g=r[0],y=r[r.length-1]);let b=(m+1)%n;if(g=g!=null?g:i[b],g){let P=m,T=!1;for(;y=y!=null?y:i[(--P+n)%n],y!==g;)if(y){T=!0;break}if(T){if(g.start().equals1(y.end()))return;if(eo(y,y.end()).dot(eo(g,g.start()))<0){if(!h(y.end(),g.start())){let O=new bt(y.end(),g.start());r.push(O);return}let{rebuildPrevPt:I,rebuildNextPt:C,rebuildLinkLine:E}=M6e(i[(P-1+n)%n],y,new bt(y.end(),g.start()),g,i[(m+2)%n]);I&&C&&(I!==y?(i[(P+n)%n]=I,r[r.length-1]&&(r[r.length-1]=I)):C!==g&&(i[(m+1)%n]=C,r[0]===g&&(r[0]=C)),E&&r.push(E))}}}}}),r.length===0)return null;h(e,r[0].start())||r.push(new bt(e,r[0].start()));let s=r[r.length-1];if(r.length===1)return s instanceof dr?Qs.build7([dr.build2(s.center,0,180,s.rx,s.ry,s.sweep()),dr.build2(s.center,180,360,s.rx,s.ry,s.sweep())]):s instanceof ki?Qs.build7(s.clip(.5)):null;let a=r.map(p=>new Ryt(p)),l=a[a.length-1];for(a.forEach(p=>{p.connect(l),l=p});!l.isVisited;){let p=function(){l.next.connect(g),l=l.next,l.isConnected=!1,l.isVisited=!1},m=function(){l.connect(g.prev),l.isConnected=!1},g=l.prev;if(l===g)break;let y=l.pt,b=g.pt,P=b.end();if(!l.isConnected&&!P.equals(y.start())){let T=function(C){l.isConnected=!0,l.pt=y=C,l.next.isVisited=!1},I=function(C){l.isConnected=!0,g.pt=C,g.isVisited=!1,l=g};if(y instanceof bt)if(h(P,y.end())){p();continue}else T(new bt(P,y.end()));else if(b instanceof bt){h(b.start(),y.start())?m():I(new bt(b.start(),y.start()));continue}else if(y instanceof ki)if(h(P,y.end())&&!(y.controls.length!==2&&y.getToLineMaxDis2(y.startToEndL)>=t)){p();continue}else T(new ki([P,...y.controls.slice(1)]));else if(b instanceof ki)h(b.start(),y.start())&&!(b.controls.length!==2&&b.getToLineMaxDis2(b.startToEndL)>=t)?m():I(new ki([...b.controls.slice(0,-1),y.start()]));else if(y instanceof dr&&b instanceof dr)if(Math.abs(Math.abs(y.sweepAngle)-180)<Math.abs(Math.abs(b.sweepAngle)-180)){let C=dr.build5(P,y.end(),y.sweepAngle);if(h(C.start(),C.end())&&!(C.rx>=x9&&Math.abs(C.sweepAngle)>180)){p();continue}else T(C)}else{let C=dr.build5(b.start(),y.start(),b.sweepAngle);h(C.start(),C.end())&&!(C.rx>=x9&&Math.abs(C.sweepAngle)>180)?m():I(C);continue}else throw new Error("not support")}if(eo(y,y.start()).dot(eo(b,b.end()))<0){let T=function(E,O,_,x,v,D){if(l.next===g){l=null;return}let{rebuildLinkLine:w,rebuildPrevPt:F,rebuildNextPt:H}=M6e(E,O,_,x,v);F&&H&&(F!==O&&(g.prev.pt=F),H!==x&&(l.next.pt=H),w?D.pt=w:p())},I=function(){l.next===g?l=null:(l.next.connect(g.prev),l=l.next,l.isConnected=!1,l.isVisited=!1)},C=Kg(b.reverse(),y).state;if(C===0){let E=N6e(y,b.start(),y.end());if(d(E)){let O=g.prev.pt,_=l.next.pt;if(eo(_,_.start()).dot(eo(O,O.end()))>=0){if(I(),!l)break;continue}if(T(g.prev.prev.pt,O,E instanceof bt?E:new bt(E.start(),E.end()),_,l.next.next.pt,l),!l)break}else l.pt=E;m();continue}else if(C===1){let E=N6e(b,b.start(),y.end());if(d(E)){let O=g.prev.pt,_=l.next.pt;if(eo(_,_.start()).dot(eo(O,O.end()))>=0){if(I(),!l)break;continue}if(T(g.prev.prev.pt,O,E instanceof bt?E:new bt(E.start(),E.end()),_,l.next.next.pt,g),!l)break}else g.pt=E;p();continue}else if(C===2){if(I(),!l)break;continue}}l.isVisited=!0,l=l.next}if(!l)return null;r.length=0;let c=l;for(r.push(l.pt),l=l.next;l!==c;)r.push(l.pt),l=l.next;if(r.length===1){let p=r[0];return p instanceof dr?(h(p.start(),p.end())?r[0]=dr.buildCircle(p.center,p.rx,p.sweep()):r.push(new bt(p.end(),p.start())),Qs.build7(r)):p instanceof ki?(h(p.start(),p.end())||r.push(new bt(p.end(),p.start())),Qs.build7(r)):null}if(o=Qs.build7(r),Math.abs(o.area(.1))<t)return null;return o;function h(p,m){return p.distance2(m)<t}function u(p,m){if(Math.abs(p.sweepAngle)>xyt){let g=p.sweepAngle/2;u(dr.build3(p.center,p.startAngle,g,p.rx,p.ry),m),u(dr.build3(p.center,p.startAngle+g,g,p.rx,p.ry),m)}else m.push(p)}function d(p){return p.start().distance2(p.end())<t&&!(p instanceof dr&&p.rx>=x9&&Math.abs(p.sweepAngle)>180||p instanceof ki&&p.controls.length!==2&&p.getToLineMaxDis2(new bt(p.start().add1(1,0),p.end()))>=t)}}function OP(o,t){if(!o)return!0;let e=o.start(),r=o.end();if(e.distance2(r)<t**2)if(o instanceof dr){if(!(o.rx>=t&&Math.abs(o.sweepAngle)>180))return!0}else if(o instanceof ki){if(!(o.controls.length!==2&&o.getToLineMaxDis2(new bt(o.start().add1(1,0),o.end()))>=t))return!0}else return!0;return!1}function LN(o){if(o.direct.x===0&&o.direct.y===0)throw Error("getEndOfExtendLine(line: Line, distance: number)");let t=Math.abs(x9-o.length())+br.eps,e={x:o.direct.normalize().x*t,y:o.direct.normalize().y*t},r=o.end();return new Nt(r.x+e.x,r.y+e.y)}function M6e(o,t,e,r,i){if(!o)s();else if(!i)a();else{let l=eo(o,o.end()),c=eo(t,o.end()),h=l.dot(c);if(h>=0)s();else{let u=eo(r,r.end()),d=eo(i,r.end()),p=u.dot(d);if(p>=0)a();else if(k9(h,-1)&&k9(p,-1)){let m=e.center();n(m),e=null}else h>p?s():a()}}function n(l){let c;if(t instanceof bt)c=new bt(t.start(),l);else if(t instanceof ki)c=new ki([...t.controls.slice(0,-1),l]);else if(t instanceof dr)c=dr.build5(t.start(),l,t.sweepAngle);else throw new Error("not supported");t=OP(c,to)?null:c;let h;if(r instanceof bt)h=new bt(l,r.end());else if(r instanceof ki)h=new ki([l,...r.controls.slice(1)]);else if(r instanceof dr)h=dr.build5(l,r.end(),r.sweepAngle);else throw new Error("supported");r=OP(h,to)?null:h}function s(){if(t instanceof bt){let l=LN(e.reverse());e=new bt(l,e.end());let c=new bt(t.start(),l);t=OP(c,to)?null:c}else if(t instanceof ki){let l=LN(e.reverse());e=new bt(l,e.end());let c=new ki([...t.controls.slice(0,-1),l]);t=OP(c,to)?null:c}else if(t instanceof dr){let l=LN(e.reverse());e=new bt(l,e.end());let c=dr.build5(t.start(),l,t.sweepAngle);t=OP(c,to)?null:c}else throw new Error("not supported")}function a(){if(r instanceof bt){let l=LN(e);e=new bt(e.start(),l);let c=new bt(l,r.end());r=OP(c,to)?null:c}else if(r instanceof ki){let l=LN(e);e=new bt(e.start(),l);let c=new ki([l,...r.controls.slice(1)]);r=OP(c,to)?null:c}else if(r instanceof dr){let l=LN(e);e=new bt(e.start(),l);let c=dr.build5(l,r.end(),r.sweepAngle);r=OP(c,to)?null:c}else throw new Error("not supported")}return{rebuildPrevPt:t,rebuildNextPt:r,rebuildLinkLine:e}}function N6e(o,t,e){if(o instanceof bt||t.distance2(e)<=Zg)return new bt(t,e);if(o instanceof dr)return dr.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.isCCW?1:0);if(o instanceof ki){let r=o.getPercent(t,to),i=o.getPercent(e,to);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}var Ryt=class{constructor(o){this.pt=o}connect(o){this.prev=o,o.next=this}};function zQ(o){let t=iz(),e;if(o instanceof Qs){let r=mv(o);if(r===null)return null;e=r}else if(o instanceof m0){let r=o.items.map(i=>zQ(i)).filter(i=>i!==null);if(r.length===0)return null;e=new m0(r)}else{let r=o.items.map(i=>zQ(i)).filter(i=>i!==null);if(r.length===0)return null;e=new Gd(r)}return L9.preprocessPolyline+=uv(t),e}var L9={addDocShapes2RTree:0,getPour:0,prepare:0,getSinglePourLayerPolyline:0,combindOutlines:0,mergeSameNet:0,run:0,end:0,deSelfIntersection:0,changeDirect:0,extend:0,preprocessPolyline:0,runBoolean:0,IntersectionSeeker:0,BooleanTools:0,totalBool:0};function iz(){return{timeIndex:Object.assign({},L9),start:performance.now()}}function k6e(o){return Object.values(o).reduce((t,e)=>t+e,0)}function uv(o){return performance.now()-o.start-(k6e(L9)-k6e(o.timeIndex))}function vf(o,t,e,r){let i=_l.RED,n=_l.Golden;function s(){if(!r)return;let d=r.initColor(_l.Golden);d.addPt(a),d.addPoint(a.end()),r.initColor(_l.RED).addPt(l),r.draw();debugger}let a=o.getShape(),l=e?t.getShape():t.getShape().reverse(),c=eo(a,l.start()),h=eo(l),u=c.cross(h);if(k9(u,0))if(a instanceof bt)if(l instanceof bt){if(br.eq(u,0)&&(c.dot(h)>0?!vn(a.end(),l.start()):!vn(a.start(),l.start())))throw s(),new Error("line and line");return u<0}else{if(l instanceof dr)return c.cross(l.center.sub(a.start()))<0;if(l instanceof ki){let d=l.getExtremePoints(a),p=d.length?d[0]:jN(l.controls,a.start());return c.cross(p.sub(a.start()))<0}else throw new Error("not support")}else if(a instanceof dr){if(l instanceof bt)return a.isCCW;if(l instanceof dr){if(l.center.equals1(a.center)&&(c.dot(h)>0?!vn(a.end(),l.start())&&a.end().sub(l.start()).dot(h)>0:!vn(a.start(),l.start())&&a.start().sub(l.start()).dot(h)>0))throw s(),new Error("arc and arc");return l.rx>=a.rx||l.center.distance2(a.center)>a.rx2?a.isCCW:!a.isCCW}else throw new Error("not support")}else if(a instanceof ki)if(l instanceof bt){let d=a.getPercent(l.start(),to),p=a.clip(d)[1],m=p.getExtremePoints(l);return(m.length?m[0]:jN(p.controls,l.start())).sub(l.start()).cross(h)<0}else if(l instanceof ki){let d=a.getPercent(l.start(),to),p=a.clip(d)[1],m=p.getExtremePoints(new bt(l.start(),l.end())),g=l.getExtremePoints(new bt(p.start(),p.end())),y=m.length?m[0]:jN(p.controls,l.start()),b=g.length?g[0]:jN(l.controls,l.start()),P=y.sub(l.start()),T=b.sub(l.start());return P.cross(T)<0}else throw Error("not support");else throw new Error("not support");else return u<0}function uL(o,t,e,r,i){let n=o.getShape(),s=t.getShape(),a=n instanceof dr?KC(n,Uo.toRadians(n.endAngle())):n instanceof ki?HW(n,1):n.end().sub(n.start()).normalize(),l=eo(s),c=a.dot(l);if(k9(c,-1))return vf(o,t,!0,i)?vf(o,e,r,i)&&vf(t,e,r,i):vf(o,e,r,i)||vf(t,e,r,i);{let h=a.scale(-1).angle(Nt.ORIGIN),u=l.angle(Nt.ORIGIN);h>u&&(h-=oee);let d=(h+u)/2,p=new Nt(Math.cos(d),Math.sin(d)),m=r?e.getShape():e.getShape().reverse(),g=eo(m);return p.cross(g)<0?vf(o,e,r,i):vf(t,e,r,i)}}function Vbe(o,t,e,r,i){let n=o.getShape(),s=t.getShape(),a=n instanceof dr?KC(n,Uo.toRadians(n.endAngle())):n instanceof ki?HW(n,1):n.end().sub(n.start()).normalize(),l=eo(s),c=a.dot(l);if(k9(c,-1))return vf(o,t,!0,i)?vf(o,e,r,i)&&vf(t,e,r,i):vf(o,e,r,i)||vf(t,e,r,i);{let h=a.scale(-1).angle(Nt.ORIGIN),u=l.angle(Nt.ORIGIN);h>u&&(h-=oee);let d=(h+u)/2,p=new Nt(Math.cos(d),Math.sin(d)),m=r?e.getShape():e.getShape().reverse(),g=eo(m);if(p.cross(g)<0){let y=a.dot(g)<0,b=Kg(y?o.getShape().reverse():o.getShape(),m).state;return b!==3&&b!==4?vf(o,e,r,i):b===(y?4:3)}else{let y=l.dot(g)<0,b=Kg(y?t.getShape().reverse():t.getShape(),m).state;return b!==3&&b!==4?vf(t,e,r,i):b===(y?4:3)}}}var Dyt=(o=>(o[o.NOT_IN=0]="NOT_IN",o[o.IS_IN=1]="IS_IN",o[o.IS_OVERLAP=2]="IS_OVERLAP",o))(Dyt||{}),wyt=(o=>(o[o.AllClear=0]="AllClear",o[o.MapClear=1]="MapClear",o))(wyt||{}),w9,pv=!1;function AP(o,t,e,r,i,n,s,a=e.side===t,l=!0,c){return w9=i,pv=n,G5e(U5e(o,t,l,c,s,e,a,r),e,a,r,0)}function CO(o,t,e,r,i,n,s,a=r.side===e){w9=i,pv=n;let l=H5e(o,t,e,new Map,r,a,s),c=l instanceof Array?-1:1;return G5e(l,r,a,s,c)}function G5e(o,t,e,r,i){for(;o instanceof Array;)i++,o.length===4?o=H5e(...o,t,e,r):o=U5e(...o,t,e,r);return{...o,existOverlap:i>0}}function U5e(o,t,e,r,i,n,s,a){if(YQ===-1){a.initColor(_l.RED).addPt(o.getShape()),a.initColor(_l.Golden).addPt(t.getShape()),a.draw();debugger}let l=o.getShape(),c=s?t.getShape().reverse():t.getShape(),h=(l instanceof dr?KC(l,e?c.start().angle(l.center):r?Uo.toRadians(l.endAngle()):void 0):l instanceof ki?eo(l,e?c.start():r?l.end():l.start()):l.end().sub(l.start())).normalize(),u=(c instanceof dr?KC(c,e?void 0:(r?l.end():l.start()).angle(c.center)):c instanceof ki?eo(c,e?void 0:r?l.end():l.start()):c.end().sub(c.start())).normalize();if(r===void 0){let m=h.dot(u);if(r=m<0,k9(m,0))return{state:vf(o,t,!s,a)?1:0,inter:SO(o,t,n,s,e,r,i)}}else if(r?h.dot(u)>0:h.dot(u)<0)if(e){let m,g=!0;if(l instanceof bt&&vn($C.foot(l,c.start()),r?l.end():l.start()))g=!1;else if(l instanceof dr||l instanceof ki){let y=r?l.reverse():l,b=Kg(c,j1t(y,c.start()).reverse()).state;(b===1||b===2)&&(g=!1)}if(g){let y=!r;m=Kg(y?l.reverse():l,c,a).state===(y?4:3)?1:0}else r?m=uL(o,o.nextSide,t,!s,a)?1:0:m=uL(o.prevSide,o,t,!s,a)?1:0;return{state:m,inter:SO(o,t,n,s,e,r,i)}}else return r?{state:vf(o,o.nextSide,!0,a)?0:1,inter:SO(o,t,n,s,e,r,i),isReversed:!0}:{state:vf(o.prevSide,o,!0,a)?0:1,inter:SO(o,t,n,s,e,r,i),isReversed:!0};let d,p=new Map([[3,4],[4,3],[0,1],[1,0],[2,2]]);if(e)if(o.judgeOverlapMap.has(t)&&!pv){let m=o.judgeOverlapMap.get(t);d=r?p.get(m.state):m.state}else d=Kg(r?l.reverse():l,c).state,(d===3||d===4)&&o.judgeOverlapMap.set(t,{state:r?p.get(d):d});else{if(t.judgeOverlapMap.has(o)&&!pv){let m=t.judgeOverlapMap.get(o);d=s?p.get(m.state):m.state}else d=Kg(c,r?l.reverse():l).state,(d===3||d===4)&&t.judgeOverlapMap.set(o,{state:s?p.get(d):d});d=p.get(d)}if(d===1||d===2){let m=s?t.prevSide:t,g=m.inters,y=m.getEnd();for(let b=g.length-1;b>=0;b--){let P=g[b];if(!(m.getShape()instanceof ki)&&!vn(y,P.coord))break;if(P===n)return{state:2,inter:SO(o,t,n,s,e,r,i)}}}if(d===3||d===4)return{state:d===(r?4:3)?1:0,inter:SO(o,t,n,s,e,r,i)};if(i.has(o)?i.get(o).mapSideList.push(t):i.set(o,{sideIsReversed:r,mapSideList:[t]}),i.has(t)?i.get(t).mapSideList.push(o):i.set(t,{sideIsReversed:s,mapSideList:[o]}),d===2)return r?[o.prevSide,o,s?t.prevSide:t.nextSide,i]:[o,o.nextSide,s?t.prevSide:t.nextSide,i];if(d===0)return[r?o.prevSide:o.nextSide,t,!1,r,i];if(d===1)return[o,s?t.prevSide:t.nextSide,!0,r,i];throw Error("not support")}function SO(o,t,e,r,i,n,s){if(pv)return null;let a=o.getShape(),l=r?t.getShape().reverse():t.getShape(),c=r;if(!i){let p=t;t=o,o=p,r=n,e=e.getBindedInter()}let h=p=>!(i?n:c)&&vn(p,o.prevSide.getEnd())?o.prevSide:o;if(r){let p=t.inters;for(let m=0;m<p.length;m++){let g=p[m];if(g.isInvalid&&n===void 0)continue;if(g===e&&vn(l.start(),e.coord))return i?g:g.getBindedInter();let y=g.getBindedInter().side,b=h(g.coord);if(y===b&&u(g))return d(g)}for(;;){t=t.nextSide;let m=t.inters;for(let g=0;g<m.length;g++){let y=m[g];if(y===e)return i?y:y.getBindedInter();if(s.has(t)){let b=y.getBindedInter().side;if(s.get(t).mapSideList.includes(b)||vn(y.coord,b.getEnd())&&s.get(t).mapSideList.includes(b.nextSide))return d(y);if(s.has(b)){let P=t.getShape().reverse(),T=eo(P,y.coord).dot(eo(b.getShape(),y.coord))<0,I=T?b.getShape().reverse():b.getShape(),C=Kg(P,T?Lbe(I,y.coord,I.end()):Lbe(I,I.start(),y.coord)).state;if(C===1||C===2)return d(y)}else s.has(b.nextSide)}else if(y.side===e.side&&u(y))return d(y)}}}else{let p=t.inters;for(let m=p.length-1;m>=0;m--){let g=p[m];if(g.isInvalid&&n===void 0)continue;if(g===e&&vn(l.start(),e.coord))return i?g:g.getBindedInter();let y=g.getBindedInter().side,b=h(g.coord);if(y===b&&u(g))return d(g)}for(;;){t=t.prevSide;let m=t.inters;for(let g=m.length-1;g>=0;g--){let y=m[g];if(y===e)return i?y:y.getBindedInter();if(s.has(t)){let b=y.getBindedInter().side;if(s.get(t).mapSideList.includes(b)||vn(y.coord,y.getBindedInter().side.getEnd())&&s.get(t).mapSideList.includes(b.nextSide))return d(y);if(!s.has(b)&&s.has(b.prevSide)){let P=t.getShape().reverse(),T=eo(P,y.coord).dot(eo(b.getShape(),y.coord))<0;if(s.has(b.prevSide)){let I=T?b.getShape().reverse():b.getShape(),C=Kg(t.getShape(),Lbe(I,y.coord,I.end())).state;if(C===1||C===2)return d(y)}}}else if(y.side===e.side&&u(y))return d(y)}}}function u(p){if(p.isInvalid||p.getBindedInter().side!==(vn(p.coord,o.prevSide.getEnd())?o.prevSide:o))return!1;let m;if(i){if(vn(p.coord,l.start()))return!0;m=Kg(n?a.reverse():a,g(l)).state}else{if(vn(p.coord,n?a.end():a.start()))return!0;m=Kg(l,g(n?a.reverse():a)).state}return m===2||m===1;function g(y){if(y instanceof bt)return vn(p.coord,y.end())?y:y.cutLine(p.coord);if(y instanceof dr)return dr.build2(y.center,y.startAngle,p.coord.angleD(y.center),y.rx,y.ry,y.isCCW?1:0);if(y instanceof ki)return y.clip(y.getPercent(p.coord,to))[0];throw new Error("not supported operation")}}function d(p){let m=e.getBindedInter(),g=e.side,y=m.side,b=e===p,P=e;if(r){let T=e.getIndex()-1;for(;g;){let I=g.inters;for(;T>=0;T--)if(e=I[T],e===p){b||(e.setIsInvalid(),e.isDealed(),P=e),g=null;break}else if(w9===0)!e.isInvalid&&(!vn(e.coord,p.coord)||e.side===p.side&&e.getBindedInter().side===p.getBindedInter().side)&&(e.setIsInvalid(),e.isDealed(),P=e);else if(w9===1){if(e.isInvalid)continue;let C=e.getBindedInter().side;s.has(g)&&s.get(g).mapSideList.includes(C)&&(e.setIsInvalid(),e.isDealed(),P=e)}g=g==null?void 0:g.prevSide,T=(g==null?void 0:g.inters.length)-1}}else{let T=e.getIndex()+1;for(;g;){let I=g.inters;for(;T<I.length;T++){e=I[T];let C=e.getBindedInter();if(e===p){b||(e.setIsInvalid(),e.isDealed(),P=e),g=null;break}else if(w9===0)!e.isInvalid&&(!vn(e.coord,p.coord)||g===p.side&&(vn(C.side.getEnd(),e.coord)?C.side.nextSide:C.side)===p.getBindedInter().side)&&(e.setIsInvalid(),e.isDealed(),P=e);else if(w9===1){let E=C.side;s.has(g)&&s.get(g).mapSideList.includes(E)&&(e.setIsInvalid(),e.isDealed(),P=e)}}g=g==null?void 0:g.nextSide,T=0}}if(w9===0&&!vn(m.coord,p.coord))if(i?s.has(y)?s.get(y).sideIsReversed:n:c){let T=m.getIndex()-1;for(;y;){let I=s.has(y),C=y.inters;for(;T>=0;T--){if(m=C[T],m===p.getBindedInter()){y=null;break}m.isInvalid||!I||(!vn(m.coord,p.getBindedInter().coord)||m.side===p.side&&m.getBindedInter().side===p.getBindedInter().side)&&(m.setIsInvalid(),m.isDealed())}y=y==null?void 0:y.prevSide,T=(y==null?void 0:y.inters.length)-1}}else{let T=m.getIndex()+1;for(;y;){let I=y.inters,C=s.has(y);for(;T<I.length;T++){if(m=I[T],m===p.getBindedInter()){y=null;break}let E=vn(y.getEnd(),m.coord)?s.has(y.nextSide):!1;m.isInvalid||!(C||E)||(!vn(m.coord,p.getBindedInter().coord)||m.side===p.side&&m.getBindedInter().side===p.getBindedInter().side)&&(m.setIsInvalid(),m.isDealed())}y=y==null?void 0:y.nextSide,T=0}}return i?P:P.getBindedInter()}}function H5e(o,t,e,r,i,n,s){let a=o.getShape(),l=t.getShape(),c=n?e.getShape().reverse():e.getShape(),h=(a instanceof dr?KC(a,c.start().angle(a.center)):a instanceof ki?eo(a,c.start()):a.end().sub(a.start())).normalize(),u=(l instanceof dr?KC(l,c.start().angle(l.center)):l instanceof ki?eo(l,c.start()):l.end().sub(l.start())).normalize(),d=h.dot(u);if(k9(d,-1)){let p=n?e.getShape().reverse():e.getShape(),m=eo(p).normalize(),g=h.add(u.scale(-1)).normalize().dot(m),y=Kg(a.reverse(),l,s).state;if(g>-.9&&(y===3||y===4))return{state:y===4?0:1,inter:SO(t,e,i,n,!0,!1,r)};let b=AP(o,e,i,s,w9,pv,r.size===0?new Map:r,n);return b.state===2?b:y===4?b.state===0||b.inter!==i?b:AP(t,e,i,s,w9,pv,r.size===0?new Map:r,n):b.state===1||b.inter!==i?b:AP(t,e,i,s,w9,pv,r.size===0?new Map:r,n)}else{let p=h.scale(-1).angle(Nt.ORIGIN),m=u.angle(Nt.ORIGIN);p>m&&(p-=oee);let g=(p+m)/2,y=new Nt(Math.cos(g),Math.sin(g)),b=eo(c).normalize(),P=b.angle(Nt.ORIGIN),T=p<P&&P<m&&a instanceof bt&&l instanceof bt&&c instanceof bt;if(y.cross(b)<=0){if(h.scale(-1).dot(b)<0){let I;return i.coord.equals1(c.start())?I=eo(a,i.coord).dot(eo(c,i.coord))<0:c instanceof bt&&(I=eo(a,a.end()).dot(c.direct)<0),{state:uL(o,t,e,!n,s)?1:0,inter:SO(o,e,i,n,!0,I,r)}}return T&&a.distance2(c.start())>Zg?[t,e,!0,void 0,r]:[o,e,!0,void 0,r]}else return u.dot(b)<=0?{state:uL(o,t,e,!n,s)?1:0,inter:SO(t,e,i,n,!0,void 0,r)}:T&&l.distance2(c.start())>Zg?[o,e,!0,void 0,r]:[t,e,!0,void 0,r]}}var YQ=0;function Lyt(o,t,e,r){let i=t.getBindedInter(),n=t.side,s=i.side,a=n.getShape(),l=s.getShape();if(r&&(YQ++,YQ===-1)){r.initColor(_l.RED).addPt(a),r.initColor(_l.Golden).addPt(l),r.draw();debugger}let c=0,h=!1;if(o===-1){let O=CO(n,n.nextSide,s,i,c,h,r),_=O.state!==0;if(O.state===2){let v=eo(a,t.coord).add(eo(n.nextSide.getShape(),t.coord)).normalize(),D=eo(l,t.coord).add(eo(s.nextSide.getShape(),t.coord)).normalize();return E(_,v.dot(D)>0)}let x=CO(n,n.nextSide,s.nextSide,i,c,h,r);return O.state!==x.state?(C(O,x),1):E(_,O.state!==CO(s,s.nextSide,n,t,c,!0,r).state,O.inter,x.inter)}if(o===1){let O=AP(n,s,i,r,c,h,new Map),_=O.state!==0;if(O.state===2)return E(_,eo(a,t.coord).dot(eo(l,t.coord))>0);let x;if(O.isReversed&&O.existOverlap&&vn(O.inter.coord,s.getEnd())&&O.inter.getBindedInter().side!==n){let w=O.inter.getBindedInter().side;if(w===n.nextSide)x={state:uL(n,w,s.nextSide,!0,r)?1:0,inter:i};else if(w===n.prevSide){if(x={state:uL(w,n,s.nextSide,!0,r)?1:0,inter:O.inter},O.state===x.state&&t!==O.inter){let F=eo(l,t.coord),H=eo(s.nextSide.getShape(),t.coord),z=eo(w.getShape(),t.coord);return E(_,F.add(H).dot(z)>0,O.inter,x.inter)}}else x=AP(n,s.nextSide,i,r,c,h,new Map)}else x=AP(n,s.nextSide,i,r,c,h,new Map);if(O.state!==x.state)return C(O,x),1;let v=eo(l,t.coord),D=eo(s.nextSide.getShape(),t.coord);if(k9(v.dot(D),-1)){let w=vf(s,s.nextSide,!0,r);return E(_,O.state!==AP(s.nextSide,n,t,r,c,!0,new Map,w?!_:_,!1).state,O.inter,x.inter)}else{let w=eo(a,t.coord);return E(_,v.add(D).dot(w)>0,O.inter,x.inter)}}if(!(a instanceof ki||l instanceof ki))return 1;let u=eo(a,t.coord),d=eo(l,t.coord),p,m;if(l instanceof bt)p=new bt(t.coord,l.start()),m=new bt(t.coord,l.end());else if(l instanceof dr){let O=t.coord.angleD(l.center);p=dr.build2(l.center,O,l.startAngle,l.rx,l.ry,l.isCCW?0:1),m=dr.build2(l.center,O,l.endAngle(),l.rx,l.ry,l.isCCW?1:0)}else if(l instanceof ki){let O=l.getPercent(t.coord,to);[p,m]=l.clip(O),p=p.reverse()}else throw new Error("not support");let g=u.dot(d)>0,y,b;g?(y=Kg(a.reverse(),p).state,b=Kg(a,m).state):(y=Kg(a,p).state,b=Kg(a.reverse(),m).state);let P;y===0?P=AP(g?n.prevSide:n.nextSide,s,i,r,c,h,new Map,!0,!1,g):y===1?P=AP(n,s.prevSide,i,r,c,h,new Map,!0,!0,g):y===2?g?P=CO(n.prevSide,n,s.prevSide,i,c,h,r,!0):P=CO(n,n.nextSide,s.prevSide,i,c,h,r,!0):g?y===3?P={inter:i,state:0}:P={inter:i,state:1}:y===3?P={inter:i,state:1}:P={inter:i,state:0};let T=P.state!==0;if(P.state===2)return E(T,g);let I;if(b===0?I=AP(g?n.nextSide:n.prevSide,s,i,r,c,h,new Map,!1,!1,!g):b===1?I=AP(n,s.nextSide,i,r,c,h,new Map,!1,!0,!g):b===2?g?I=CO(n,n.nextSide,s.nextSide,i,c,h,r,!1):I=CO(n.prevSide,n,s.nextSide,i,c,h,r,!1):g?b===3?I={inter:i,state:1}:I={inter:i,state:0}:b===3?I={inter:i,state:0}:I={inter:i,state:1},P.state===I.state)return P.inter===I.inter?(t.setIsInvalid(),0):E(T,g,P.inter,I.inter);return C(P,I),1;function C(O,_){let x=O.state!==0;if(O.inter===_.inter){t.setOutToIn(x);return}else MN(O.inter,_.inter,!0),MN(_.inter,O.inter,!1);let v=[];if(o===-1){let w=eo(a,t.coord),F=eo(n.nextSide.getShape(),t.coord),H=eo(l,t.coord),z=eo(s.nextSide.getShape(),t.coord);v.push(w.dot(H)),v.push(w.dot(z)),v.push(F.dot(H)),v.push(F.dot(z))}else{let w=eo(a,t.coord);v.push(eo(l,t.coord).dot(w)),v.push(eo(s.nextSide.getShape(),t.coord).dot(w))}if(v.reduce((w,F)=>Math.abs(w)>Math.abs(F)?w:F,0)>0)if(e===1||e===0||e===2||e===3)t.setOutToIn(x);else throw new Error("not support");else if(e===1)D(!x);else if(e===0||e===2||e===3)D(x);else throw new Error("not support");function D(w){t.setIsInvalid();let F=(w?O:_).inter;delete F.isInvalid,delete F.getBindedInter().isInvalid,F.setOutToIn(!x)}}function E(O,_,x,v){if(x===v){if(t.side.outline.inters.find(F=>!F.isInvalid&&F!==t&&vn(F.coord,t.coord)))return t.setIsInvalid(),0;let D=new EO(t.coord,n,r),w=new EO(t.coord,s,r);return D.bind(w),_?n.inters.splice(t.getIndex(),0,D):n.inters.splice(t.getIndex()+1,0,D),s.inters.splice(t.getBindedInter().getIndex(),0,w),D.setOutToIn(O),t.setOutToIn(!O),D.isDealed(),n.inters.forEach((F,H)=>F.setIndex(H)),s.inters.forEach((F,H)=>F.setIndex(H)),2}else{let D=function(){let w=x.getBindedInter(),F=v.getBindedInter();delete x.isInvalid,delete w.isInvalid,delete v.isInvalid,delete F.isInvalid,x.setOutToIn(!O),v.setOutToIn(O),MN(x,v,!0),MN(v,x,!1),MN(w,F,_),MN(F,w,!_)};if(t.setIsInvalid(),_){if(e===1||e===0||e===2||e===3)return D(),2;throw new Error("not support")}else{if(e===1)return O?0:(D(),2);if(e===0||e===2||e===3)return O?(D(),2):0;throw new Error("not support")}}}}function MN(o,t,e){let{judge:r,changeNum:i}=s(),n=o.getIndex();for(let a=n+i,l=o.side.inters;r(a);a+=i){if(l[a].isInvalid)continue;if(!vn(l[a].coord,o.coord))break;l[a].setIndex(n),l[n].setIndex(a);let c=l[a];l[a]=l[n],l[n]=c,n=a}function s(){let a=o.side===t.side;if(e){let l=a?t.getIndex():o.side.inters.length;return{judge:c=>c<l,changeNum:1}}else{let l=a?t.getIndex()+1:0;return{judge:c=>c>=l,changeNum:-1}}}}var B6e=0,EO=class{constructor(o,t,e){this.id=B6e++,this.coord=o,this.side=t,e&&(this.id=B6e++,this.drawDebug=e);let r=new s2;r.ext2(o),this._bbox=r.build1()}bbox(){return this._bbox}resetVisitStatus(){this.visited=!1,this.bindedInter.visited=!1}isDealed(){this.dealed=!0,this.getBindedInter().dealed=!0}setOutToIn(o){this.outToIn=o,this.bindedInter.outToIn=!o}setIsInvalid(){this.isInvalid=!0,this.getBindedInter().isInvalid=!0}getBindedInter(){return this.bindedInter}bind(o){this.bindedInter=o,o.bindedInter=this}setIndex(o){this.index=o}isSorted(){return this.index!==void 0}getIndex(){return this.index}getVisited(){return this.visited}visitSelf(){this.visited=!0}visit(){this.visited=!0,this.bindedInter.visited=!0}getPrevPoint(){let o=this.getIndex(),t=this.side.getStart();return o&&(t=this.side.inters[o-1].coord),t}getTangent(){let o=this.side.getShape();if(o instanceof bt)return o.end().sub(o.start());if(o instanceof dr){let t=this.coord.angle(o.center);return o.isCCW?t+=FQ:t-=FQ,new Nt(Math.cos(t),Math.sin(t))}else{if(o instanceof ki)return HW(o,o.getPercent(this.coord,to));throw new Error("not support")}}findStartInter(){return this.outToIn===void 0?this.getTangent().cross(this.bindedInter.getTangent())>0?this:this.bindedInter:this.outToIn?this:this.bindedInter}run(){let o=[],t=this,e;if(this.drawDebug){Gbe++;let r=Gbe===-1,i=this.drawDebug.initColor(_l.RED);if(r){this.drawDebug.draw();debugger}e=n=>{if(o.push(n),r){i.addPt(o[o.length-1]),this.drawDebug.draw();debugger}}}else e=r=>o.push(r);for(;!t.visited;){let r=function(a,l){if(br.eq(a.distance2(l),0))return;let c=rz.rebuild(n.getShape(),a,l);if(!c)return!0;e(c)};t.visit();let i=t.getIndex(),n=t.side,s=n.inters[i+1];for(;s!=null&&s.isInvalid;)s=n.inters[s.getIndex()+1];if(s)r(t.coord,s.coord),t=s.bindedInter;else{let a=r(t.coord,n.getEnd()),l=t.coord;for(n=n.nextSide,t=null;;){for(let c of n.inters)if(!c.isInvalid){t=c.bindedInter;break}if(t)break;a?(r(l,n.getEnd()),a=!1):e(n.getShape()),n=n.nextSide}a?(br.eq(l.distance2(t.coord),0)?r(l,n.getEnd()):r(l,t.coord),a=!1):br.eq(n.getEnd().distance2(t.coord),0)?e(n.getShape()):r(n.getStart(),t.coord)}}if(t!==this)throw this.drawDebug&&console.log(JSON.stringify({runId:Gbe,handleId:YQ,boolId:DW})),new Error("inter !== this");return mv(Qs.build7(o))}},Gbe=0,Ube=class mPe{constructor(t,e,r,i,n){this.inters=[],this.allInterIsInvalid=!0,this.isVisit=!1,this.sides=t,this.isGroup1=r,this.isOutside=i,this.finalIsOutside=i,this.polyline=e,n&&(this.polygon=n),t.forEach(s=>s.outline=this)}static build(t,e,r,i,n){let s=t.primitives.map(l=>new rz(l,i)),a=s[s.length-1];return s.forEach(l=>{a.connect(l),a=l}),n?new mPe(s,t,e,r,n):new mPe(s,t,e,r)}setFinalIsOutSide(t){this.finalIsOutside=t}startAndEndIsSameOutsideFlag(){return this.isOutside===this.finalIsOutside}get hasInter(){return!!this.interOutlines}isAllInterIsInvalid(){return this.allInterIsInvalid}setAllInterIsInvalidToFalse(){this.allInterIsInvalid=!1}resetVisited(){this.isVisit=!1}intersect(t,e){if(!(t.interOutlines&&t.interOutlines===this.interOutlines))if(t.interOutlines)if(this.interOutlines){let r,i;this.interOutlines.length>t.interOutlines.length?(r=this.interOutlines,i=t.interOutlines):(r=t.interOutlines,i=this.interOutlines),i.forEach(n=>{r.push(n),n.interOutlines=r}),e.delete(i)}else t.interOutlines.push(this),this.interOutlines=t.interOutlines;else this.interOutlines?(this.interOutlines.push(t),t.interOutlines=this.interOutlines):(t.interOutlines=this.interOutlines=[this,t],e.add(this.interOutlines))}isContain(t){if(!this.polyline.bbox().extendOfSize(to).isContainsBBox(t.polyline.bbox()))return!1;let e=t.polyline.primitives[0].start();if(t.hasInter&&t.isAllInterIsInvalid()){let r=t.inters[0];r.getBindedInter().side.outline!==this?e=r.side.getCenterPoint():e=r.side.getCenterPoint(r.coord)}return!!this.polyline.getWindingNum(e)}isInternally(t){return!!this.polyline.getWindingNum(t)}isEqual(t){return this.polyline===t.polyline}bbox(){return this.polyline.bbox()}reverse(){this.sides.reverse();let t=this.sides[this.sides.length-1];this.sides.forEach(e=>{e.reverse(),t.connect(e),t=e})}returnPolyline(){let t=this.sides.map(r=>r.getShape()),e=this.polyline.primitives;if(this.sides.length===e.length){let r=new Set(e);if(!t.some(i=>!r.has(i)))return this.polyline}return Qs.build7(t)}};function F6e(o,t,e){let r=[];return o.forEach(i=>i.forEach(n=>{if(n.hasInter&&!n.isAllInterIsInvalid())return;let s=n.bbox(),a=t.search(s.extendOfSize(to)).filter(l=>l.bbox().extendOfSize(to).isContainsBBox(s)).sort((l,c)=>l.bbox().area()-c.bbox().area());for(let l of a)if(l.isContain(n)){let c=e(!n.isOutside,l.isOutside),h=e(n.isOutside,l.isOutside);c!==h&&(r.push(n),n.setFinalIsOutSide(!c));return}e(n.isOutside,!1)!==e(!n.isOutside,!1)&&r.push(n)})),r}function Myt(o,t,e){let r;switch(e){case 0:r=(a,l)=>a&&l;break;case 1:r=(a,l)=>a||l;break;case 2:r=(a,l)=>a&&!l;break;case 3:r=(a,l)=>a&&!l||!a&&l;break;default:throw Error("not support the rule")}let i=new WW(10),n=new WW(10);o.forEach(a=>a.forEach(l=>i.add(l))),t.forEach(a=>a.forEach(l=>n.add(l)));let s=F6e(o,n,r);return F6e(t,i,(a,l)=>r(l,a)).forEach(a=>s.push(a)),s}var Nyt=class{constructor(o){this.roots=[],this.nodes=o.sort((t,e)=>t.bbox().minX-e.bbox().minX).map(t=>new kyt(t)),this.nodes.forEach((t,e)=>{t.visit()&&(this.roots.push(t),this.build(e))})}build(o){let t=this.nodes[o];for(let e=o+1,r=this.nodes.length;e<r;e++){let i=this.nodes[e];if(t.key.bbox().maxX<i.key.bbox().minX)break;i.getIsVisit()||t.isContain(i)&&(i.visit(),t.addChild(i),this.build(e))}}getPolygons(){let o=[];return this.roots.forEach(t=>t.getPolygons().forEach(e=>o.push(e))),o}},kyt=class{constructor(o){this.children=[],this.isVisit=!1,this.key=o}getIsVisit(){return this.isVisit}isContain(o){return this.key.isContain(o.key)}addChild(o){this.children.push(o)}getPolygons(){let o=[];return this.getPolylineList(o),o.map(t=>{let e=t[0].polygon;if(e&&e.items.length===t.length){let r=t.map(n=>n.returnPolyline()),i=new Set(e.items);return r.some(n=>!i.has(n))?new m0(r):e}else return new m0(t.map(r=>r.returnPolyline()))})}getPolylineList(o,t){t?(t.push(this.key),t=null):(t=[this.key],o.push(t)),this.children.forEach(e=>e.getPolylineList(o,t))}visit(){return this.isVisit?!1:(this.isVisit=!0,!0)}};function V6e(o){let t="";return o.items.forEach((e,r)=>{let i="$";if(e.items.forEach((n,s)=>{let a="[";if(n.primitives.forEach((l,c)=>{let h="";if(l instanceof bt)h=`Line,${l.start().x},${l.start().y},${l.end().x},${l.end().y}`;else if(l instanceof dr)h=`Arc,${l.center.x},${l.center.y},${l.startAngle},${l.sweepAngle},${l.rx}`;else if(l instanceof ki)h=`Bezier,${l.controls.map(u=>`${u.x},${u.y}`).join(",")}`;else throw new Error("not supported");if(c===n.primitives.length-1){a+=`${h}]`;return}a+=`${h},`}),s===e.items.length-1){i+=`${a}$`;return}i+=`${a}_`}),r===o.items.length-1){t+=`${i}`;return}t+=`${i}^`}),console.log(t),t}function G6e(o){let t=o.split("^"),e=[];return t.forEach(i=>{let n=/\$(.*?)\$/,s=i.match(n)[1].split("_"),a=[];s.forEach(c=>{let h=/\[(.*?)\]/,u=c.match(h)[1].split(","),d=[],p=[];for(let g=0;g<u.length;g++){let y=u[g];if(y==="Line"||y==="Arc"||y==="Bezier"){if(d.length){let b=r(d);p.push(b),d.length=0}d.push(y);continue}d.push(Number(y))}d.length&&(p.push(r(d)),d.length=0);let m=Qs.build7(p);a.push(m)});let l=new m0(a);e.push(l)}),new Gd(e);function r(i){let n=i[0];if(n==="Line")return new bt(new Nt(i[1],i[2]),new Nt(i[3],i[4]));if(n==="Arc")return dr.build3(new Nt(i[1],i[2]),i[3],i[4],i[5],i[5]);if(n==="Bezier"){let s=[];for(let a=1;a<i.length;a+=2)s.push(new Nt(i[a],i[a+1]));return new ki(s)}else throw new Error("not support")}}var Byt=class{constructor(o=1){this.group1Str="$[Line,20193.777980000017,4122.200439600661,20193.77082,4211.848760073709,Arc,20193.972672902382,4211.8487570980205,179.99915535323618,-89.99540000050294,0.2018529024026465,Line,20193.972659672283,4212.050609999989,20193.972660393258,4212.039610000013,Arc,20193.97217289501,4211.848257065248,89.85403133887164,89.99540000041924,0.19135355574930143,Line,20193.78082,4211.848759926291,20193.78897999998,4122.200440479205,Line,20193.78897999998,4122.200440479205,20193.777980000017,4122.200439600661]$",this.group2Str="$[Arc,20209.72784128151,4122.2007625157785,258.46768032837986,-75.66780748375947,4.138846238512183,Line,20205.593935808283,4121.998590004101,20193.97982992629,4121.998600000001,Arc,20193.97983290198,4122.2004529023825,269.9991553532362,-89.99540000050297,0.20185290240401074,Arc,20193.782979999996,4122.20044,180.00375535340328,-180.0000000000027,0.004999999999025513,Arc,20193.979332869207,4122.200952909754,180.15347936671733,89.99540000008247,0.19135355575111057,Line,20193.97983008845,4122.009599999999,20205.603694309226,4122.003828485546,Arc,20209.733142304296,4122.194577876843,182.64475341258483,75.73379999998886,4.133851239977064,Line,20208.900400396684,4118.145470939558,20208.902599535475,4118.156248870184,Arc,20206.972515961093,4108.700057667588,78.46393309088245,-78.46759999998636,9.65115405866796,Arc,20216.618669999996,4108.69944,359.99996825446135,-180,0.004999999999200412,Arc,20206.973015966745,4108.699445349495,359.99996822365375,78.46759999998409,9.640654033253735]$^$[Line,20193.997796883676,4095.399470032799,20205.596133314026,4095.4013992171836,Arc,20209.72470159858,4095.1923799234505,177.10172964919312,-75.64935037184974,4.133855965730166,Arc,20209.73000213952,4095.198565517174,101.5415133143569,75.7293000000185,4.128850963459707,Line,20205.605834328744,4095.395161923586,20193.997203529463,4095.389485743675,Arc,20193.994588809255,4095.197684525904,89.21896662213764,4.544099999999517,0.19181903946188483,Arc,20193.981499796217,4095.1977402038,89.85034659953621,89.9999999995926,0.19135044893494071,Arc,20193.78515,4095.19824,0,-180,0.005,Arc,20193.98200016982,4095.1982398301675,179.99995179248322,-89.99999999974185,0.20185016982129908,Arc,20193.981986624152,4095.198185381971,89.9961078637802,-4.487285276547311,0.2019046184835962]$",this.rule=o}getGroup1(){return G6e(this.group1Str)}getGroup2(){return G6e(this.group2Str)}},Hbe=new nee(2),RW=class{getUnion(o,t=!0){return t&&(o=o.map(e=>this.asSameSweep([e])[0])),Tyt(tyt,o)}asSameSweep(o){let t=0;return o.forEach(e=>t+=e.area(.01)),t>0?o.map(e=>e.reverse()):o}getSubtraction(o,t){let e=new FW(!1),r=new VW(OQ.rule,Hbe,e);for(let i of o){let n=OQ.weight(0);r.addPolyline(i,n)}for(let i of t){let n=OQ.weight(1);r.addPolyline(i,n)}return r.simplify(),e.plGrps}getIntersection(o,t){let e=new FW(!1),r=new VW(AQ.rule,Hbe,e);for(let i of o){let n=AQ.weight(0);r.addPolyline(i,n)}for(let i of t){let n=AQ.weight(1);r.addPolyline(i,n)}return r.simplify(),e.plGrps}getMutuallyExclusive(o,t){let e=new FW(!1),r=new VW(Nbe.rule,Hbe,e);for(let i of o){let n=Nbe.weight(0);r.addPolyline(i,n)}for(let i of t){let n=Nbe.weight(1);r.addPolyline(i,n)}return r.simplify(),e.plGrps}},DW=0,Wbe=!1;function wW(o,t,e,r,i){let n=iz(),s=[],a=[],l=[],c=new Set,h;if(i){if(h=new tz(i),DW++,Wbe){debugger;Wbe=!1;let I=new Byt;wW(I.rule,I.getGroup1(),I.getGroup2(),r,i)}if(DW===-1||Wbe){console.table({rule:o,group1:V6e(t),group2:V6e(e)}),h.clear();let I=h.initColor(_l.GREEN),C=h.initColor(_l.WHITE),E=h.initColor(_l.BLUE),O=h.initColor(_l.Gray);t.items.forEach(_=>_.items.forEach((x,v)=>{v>0?C.addPly(x):I.addPly(x)})),e.items.forEach(_=>_.items.forEach((x,v)=>{v>0?O.addPly(x):E.addPly(x)})),h.draw();debugger}}let u=t.items.length!==0&&e.items.length!==0?t.bbox().extendOfSize(to).intersection1(e.bbox().extendOfSize(to)):null;if(u){let I=[],C=[];switch(o){case 0:{for(let E of t.items)E.bbox().isIntersect(u)&&I.push(E);for(let E of e.items)E.bbox().isIntersect(u)&&C.push(E);break}case 1:case 3:{for(let E of t.items)E.bbox().isIntersect(u)?I.push(E):s.push(E);for(let E of e.items)E.bbox().isIntersect(u)?C.push(E):s.push(E);break}case 2:{for(let E of t.items)E.bbox().isIntersect(u)?I.push(E):s.push(E);for(let E of e.items)E.bbox().isIntersect(u)&&C.push(E);break}default:throw new Error("not support")}I.length!==t.items.length&&(t=new Gd(I)),C.length!==e.items.length&&(e=new Gd(C))}else{switch(o){case 0:break;case 1:case 3:{t.items.forEach(I=>s.push(I)),e.items.forEach(I=>s.push(I));break}case 2:{t.items.forEach(I=>s.push(I));break}default:throw new Error("not support")}t=new Gd([]),e=new Gd([])}P(t,a,!0),P(e,l,!1);let d=o===2||o===3?(I,C)=>vn(I.getEnd(),C)?I.nextSide:I:(I,C)=>vn(I.prevSide.getEnd(),C)?I.prevSide:I,p=(I,C,E)=>{if(vn(I.getEnd(),E)){if(I.inters.findIndex(O=>O.getBindedInter().side===C&&vn(O.coord,I.getEnd()))===-1)return new EO(E,I,h)}else return new EO(E,I,h)},m=o===2||o===3?(I,C,E)=>{if(vn(I.getStart(),E)){if(I.inters.findIndex(O=>O.getBindedInter().side===C&&vn(O.coord,I.getStart()))===-1)return new EO(E,I,h)}else return new EO(E,I,h)}:p;r.seek(t,e,(I,C,E,O,_,x)=>{let v=a[I][C],D=l[O][_],w=v.sides[E],F=D.sides[x],H=ZT(w.getShape(),F.getShape());if((w.getShape()instanceof ki||F.getShape()instanceof ki)&&H>=4){if(w.getShape()instanceof dr||F.getShape()instanceof dr){let V=function(L,k){let N=!1;for(let U=0;U<k.length;U+=2)vn(new Nt(k[U],k[U+1]),L)&&(N=!0);N||k.push(L.x,L.y)},W=[nt[0],nt[1]];for(let L=0;L<H;L+=2){let k=new Nt(nt[L],nt[L+1]);for(let N=L+2;N<H;N+=2){let U=new Nt(nt[N],nt[N+1]);if(!vn(k,U)){V(U,W);break}}}H=W.length,W.forEach((L,k)=>nt[k]=L)}else for(let V=H-2;V>=2;V-=2)for(let W=V-2;W>=0;W-=2)if(vn(new Nt(nt[V],nt[V+1]),new Nt(nt[W],nt[W+1]))){nt[W]=(nt[V]+nt[W])/2,nt[W+1]=(nt[V+1]+nt[W+1])/2;for(let L=H-3;L>=V;L--)nt[L]=nt[L+2];H-=2;break}}let z=0;if(H===4){let V=function(k){return vn(w.getEnd(),k)||vn(w.prevSide.getEnd(),k)||vn(F.prevSide.getEnd(),k)||vn(F.getEnd(),k)},W=new Nt(nt[0],nt[1]),L=()=>{let k=new EO(W,w,h),N=new EO(W,F,h);k.bind(N),k.setIsInvalid(),k.isDealed(),v.inters.push(k),D.inters.push(N)};if(nt[0]===nt[2]&&nt[1]===nt[3])if(V(W))z=2;else{L();return}}for(;z<H;z+=2){let V=new Nt(nt[z],nt[z+1]),W=w,L=F;if(vn(W.prevSide.getEnd(),V)&&(W=W.prevSide),L=d(L,V),w!==W&&F!==L){let N=o===2||o===3?F.getEnd():L.getEnd();W.getEnd().distance1(V)<N.distance1(V)?(V=W.getEnd(),vn(N,V)||(L=F)):(V=N,vn(W.getEnd(),V)||(W=w))}let k=p(W,L,V);if(k){let N=m(L,W,V);N&&(W.addInter(k),v.inters.push(k),L.addInter(N),D.inters.push(N),k.bind(N),v.intersect(D,c))}}return H},i);let g=T(),y=Myt(a,l,o);y.forEach(I=>!I.startAndEndIsSameOutsideFlag()&&I.reverse()),new Nyt(g.concat(y)).getPolygons().forEach(I=>s.push(I));let b=new Gd(s);if(h){if(DW===-1){let I=h.initColor(_l.RED),C=h.initColor(_l.Golden);s.forEach(E=>{I.addPly(E.items[0]),E.items.slice(1).forEach(O=>C.addPly(O))}),h.draw();debugger;throw new Error}b.id=DW}return L9.BooleanTools+=uv(n),b;function P(I,C,E){I.items.forEach(O=>{let _=[];_.push(Ube.build(O.items[0],E,!0,h,O)),O.items.slice(1).forEach(x=>{_.push(Ube.build(x,E,!1,h))}),C.push(_)})}function T(){let I=[];return c.forEach(E=>{o===2||o===3?E.forEach(_=>{_.isGroup1||_.reverse(),_.sides.forEach(x=>x.sortInters())}):E.forEach(_=>_.sides.forEach(x=>x.sortInters())),E.map(_=>_.sides.filter(x=>x.inters.length)).flat(2).sort((_,x)=>{let v=_.inters,D=x.inters,w=vn(v[v.length-1].coord,_.getEnd()),F=vn(D[D.length-1].coord,x.getEnd());if(w&&F){let H=0,z=0;for(let V=v.length-2;V>=0&&vn(v[V].coord,_.getEnd());V--)H++;for(let V=D.length-2;V>=0&&vn(D[V].coord,x.getEnd());V--)z++;return z-H}else return w?-1:1}).forEach(_=>{_.inters.forEach(x=>{if(x.dealed)return;let v=x.side,D=x.getBindedInter().side,w;vn(v.getEnd(),x.coord)&&vn(D.getEnd(),x.coord)?w=-1:vn(v.getEnd(),x.coord)?(w=1,x=x.getBindedInter()):vn(D.getEnd(),x.coord)&&(w=1);let F=Lyt(w,x,o,h);x.isDealed(),F&&(v.outline.setAllInterIsInvalidToFalse(),D.outline.setAllInterIsInvalidToFalse())})}),O(E),o===3&&(E.forEach(_=>{_.reverse(),_.sides.forEach(x=>{x.sortInters(),x.inters.forEach(v=>{v.resetVisitStatus()})})}),O(E));function O(_){_.forEach(x=>{x.inters.forEach(v=>{if(v.isInvalid||v.getVisited())return;let D=v.findStartInter(),w=C(o)?D.run():D.getBindedInter().run(),F=x.polyline.primitives;if(w){if(F.length===w.primitives.length){let H=new Set(F);if(!w.primitives.some(z=>!H.has(z))){I.push(x);return}}I.push(Ube.build(w,!0,!0,h))}})})}}),I;function C(E){switch(E){case 0:case 2:case 3:return!0;case 1:return!1;default:throw Error("not support the rule")}}}}var fQ=/\bstablilizetion\b/.test(self.location.href)||!0,mQ={intersect(o,t,e,r){try{return wW(0,o,t,e,r)}catch(i){if(fQ){let n=new RW().getIntersection(o.items.map(s=>s.items.map(a=>a)).flat(2),t.items.map(s=>s.items.map(a=>a)).flat(2));return new Gd(n.map(s=>new m0(s.items)))}throw i}},union(o,t,e,r){try{return wW(1,o,t,e,r)}catch(i){if(fQ){let n=new RW,s=o.items.map(l=>l.items.map(c=>c)).flat(2);t.items.forEach(l=>l.items.forEach(c=>s.push(c)));let a=n.getUnion(s);return new Gd(a.map(l=>new m0(l.items)))}throw i}},diff(o,t,e,r){try{return wW(2,o,t,e,r)}catch(i){if(fQ){let n=new RW().getSubtraction(o.items.map(s=>s.items.map(a=>a)).flat(2),t.items.map(s=>s.items.map(a=>a)).flat(2));return new Gd(n.map(s=>new m0(s.items)))}throw i}},xor(o,t,e,r){try{return wW(3,o,t,e,r)}catch(i){if(fQ){let n=new RW().getMutuallyExclusive(o.items.map(s=>s.items.map(a=>a)).flat(2),t.items.map(s=>s.items.map(a=>a)).flat(2));return new Gd(n.map(s=>new m0(s.items)))}throw i}}},Fyt=class extends VW{constructor(o,t,e,r,i,n){super(o.rule,nee.DUMMY,t),this.sideGroup1=[],this.sideGroup2=[],this.group1=e,this.group2=r,this.seeker=i,this.addGroup(e,o.weight(0),this.sideGroup1),this.addGroup(r,o.weight(1),this.sideGroup2),this.bus=n}addGroup(o,t,e){if(!o)debugger;o.items.forEach(r=>{let i=[];r.items.forEach(n=>{let s=this.sides.length;this.addPolyline(n,t),i.push(this.sides.slice(s))}),e.push(i)})}seekIntersection(){this.seeker.seek(this.group1,this.group2,(o,t,e,r,i,n)=>{let s=this.sideGroup1[o][t][e],a=this.sideGroup2[r][i][n],l=ZT(s.shape,a.shape);for(let c=0;c<l;c+=2){let h=new Nt(nt[c],nt[c+1]);s.inters.push(h),a.inters.push(h),this.event.onIntersect(h,s,a)}return l},this.bus)}},Vyt=class extends FW{constructor(o){super(!!o),o&&(this.drawDebug=new tz(o),this.blueDrawing=this.drawDebug.initColor(_l.BLUE),this.greenDrawing=this.drawDebug.initColor(_l.GREEN),this.redDrawing=this.drawDebug.initColor(_l.RED))}onOriginSide(o){super.onOriginSide(o),this.debug&&this.blueDrawing.addPt(o.shape)}onPolylineGroup(o,t){super.onPolylineGroup(o,t),this.debug&&o.items.forEach(e=>this.greenDrawing.addPly(e))}draw(){this.drawDebug.draw()}};function zbe(o,t,e,r,i){let n=iz(),s=new Vyt(i);new Fyt(o,s,t,e,r,i).simplify();let a=[];s.plGrps.forEach(c=>{let h=c.items.map(u=>zQ(u));h[0]&&a.push(new m0(h.filter(u=>u)))});let l=new Gd(a);return L9.BooleanTools+=uv(n),l}var Ybe=!0,EW={intersect(o,t,e,r){try{return mQ.intersect(o,t,e,r)}catch(i){if(Ybe)throw i;return console.error(i),zbe(AQ,o,t,e,r)}},union(o,t,e,r){try{return mQ.union(o,t,e,r)}catch(i){if(Ybe)throw i;return console.error(i),zbe(ryt,o,t,e,r)}},diff(o,t,e,r){try{return mQ.diff(o,t,e,r)}catch(i){if(Ybe)throw i;return console.error(i),zbe(OQ,o,t,e,r)}},xor(o,t,e,r){return mQ.xor(o,t,e,r)}},Gyt=class{init(o){}seek(o,t,e,r){let i=o.bbox().extendOfSize(5e-6).intersection1(t.bbox().extendOfSize(5e-6));if(!i)return;let n=iz(),s=[];for(let d=0,p=o.items.length;d<p;d++){let m=o.items[d];if(i.isIntersect(m.bbox()))for(let g=0,y=m.items.length;g<y;g++){let b=m.items[g];if(i.isIntersect(b.bbox()))for(let P=0,T=b.primitives.length;P<T;P++){let I=b.primitives[P].bbox();i.isIntersect(I)&&s.push({bbox:I,polygonIndex:d,polylineIndex:g,ptIndex:P})}}}let a=s.length;if(a===0){L9.IntersectionSeeker+=uv(n);return}let l=[];for(let d=0,p=t.items.length;d<p;d++){let m=t.items[d];if(i.isIntersect(m.bbox()))for(let g=0,y=m.items.length;g<y;g++){let b=m.items[g];if(i.isIntersect(b.bbox()))for(let P=0,T=b.primitives.length;P<T;P++){let I=b.primitives[P].bbox();i.isIntersect(I)&&l.push({bbox:I,polygonIndex:d,polylineIndex:g,ptIndex:P})}}}let c=l.length;if(c===0){L9.IntersectionSeeker+=uv(n);return}if(a<5||c<5){for(let d=0,p=s.length;d<p;d++)for(let m=0,g=l.length;m<g;m++)if(s[d].bbox.isIntersect(l[m].bbox.extendOfSize(1e-5))){let y=s[d],b=l[m];e(y.polygonIndex,y.polylineIndex,y.ptIndex,b.polygonIndex,b.polylineIndex,b.ptIndex)}L9.IntersectionSeeker+=uv(n);return}s.sort((d,p)=>d.bbox.minX-p.bbox.minX),l.sort((d,p)=>d.bbox.minX-p.bbox.minX);let h=0,u=0;for(;h<a&&u<c;)if(s[h].bbox.minX<l[u].bbox.minX){let d=s[h],p=d.bbox;for(let m=u;m<c;m++){let g=l[m],y=g.bbox;if(y.minX>p.maxX+1e-5)break;(p.minY<y.minY?y.minY:p.minY)<(p.maxY<y.maxY?p.maxY:y.maxY)+1e-5&&e(d.polygonIndex,d.polylineIndex,d.ptIndex,g.polygonIndex,g.polylineIndex,g.ptIndex)}h++}else{let d=l[u],p=d.bbox;for(let m=h;m<a;m++){let g=s[m],y=g.bbox;if(y.minX>p.maxX+1e-5)break;(y.minY<p.minY?p.minY:y.minY)<(y.maxY<p.maxY?y.maxY:p.maxY)+1e-5&&e(g.polygonIndex,g.polylineIndex,g.ptIndex,d.polygonIndex,d.polylineIndex,d.ptIndex)}u++}L9.IntersectionSeeker+=uv(n)}},J1,tg=(J1=class{static getDebug(){return J1.drawDebug||(J1.drawDebug=new tz(J1.curBus)),J1.drawDebug}static getDrawing(o=_l.GREEN){return this.getDebug().initColor(o)}static clearDrawing(){J1.getDebug().clear()}static drawText(o,t,e=_l.GREEN){J1.getDrawing(e).addText(o,t,1.5,.1,!0)}static drawBBox(o,t=_l.GREEN){if(!o)return;let e=J1.getDrawing(t),r=new bt(o.UL(),o.UR()),i=new bt(o.UR(),o.LR()),n=new bt(o.LR(),o.LL()),s=new bt(o.LL(),o.UL());e.addPt(r),e.addPt(i),e.addPt(n),e.addPt(s)}static drawPolyType(o,t){let e=J1.getDrawing(t);if(o instanceof Qs)e.addPly(o);else if(o instanceof m0)for(let r of o.items)r instanceof Qs?e.addPly(r):this.drawPolyType(r,t);else if(o instanceof Gd)for(let r of o.items)this.drawPolyType(r,t)}static translate(o){switch(o){case 0:return"\u2229";case 2:return"-";case 1:return"U";case 3:return"X";default:break}}},J1.UseRunArrange=!0,J1.UseOptimizeSplit=!0,J1.LocalBestThread=4,J1.HandleDiff=!0,J1.OcTreeSplitStep=4,J1.PrintStart=new Nt(150,-200),J1),OW=class gPe{static getPolyTypeLine(t){let e=[];if(t instanceof Qs)for(let r of t.primitives)e.push(r);else if(t instanceof m0)for(let r of t.items)if(r instanceof Qs)for(let i of r.primitives)e.push(i);else{let i=this.getPolyTypeLine(r);for(let n of i)e.push(n)}else if(t instanceof Gd)for(let r of t.items){let i=this.getPolyTypeLine(r);for(let n of i)e.push(n)}return e}static getPolyTypePolyLine(t){let e=[];if(t instanceof Qs)e.push(t);else if(t instanceof m0)for(let r of t.items)if(r instanceof Qs)e.push(r);else{let i=this.getPolyTypePolyLine(r);for(let n of i)e.push(n)}else if(t instanceof Gd)for(let r of t.items){let i=this.getPolyTypePolyLine(r);for(let n of i)e.push(n)}return e}static getListBBox(t){if(t.length<=0)return;let e=new s2;for(let r of t){let i=gPe.getSingleBBox(r);e.ext1(i)}return e.build1()}static getSingleBBox(t){if(t instanceof Array){let e=new s2,r=gPe.getListBBox(t.slice(1));return e.ext1(r),e.build1()}else return t.bbox()}static doDrawRule(t,e=tg.PrintStart){if(t.length<2)return[e,e,e];let r=5,i=10,n=t[0],s=tg.translate(n),a=[],l=e.y,c=e.x,h=e.x;e=e.add(new Nt(0,-i));for(let p=1;p<t.length;p++){let m=t[p];if(m instanceof Array){e=e.add(new Nt(r,0));let g=this.doDrawRule(m,e);a.push(g[0]),g[1].x<=c&&(c=g[1].x),g[2].x>=h&&(h=g[2].x),e=new Nt(g[2].x+r,e.y)}else a.push(e.clone()),e.x<=c&&(c=e.x),e.x>=h&&(h=e.x),tg.drawText(e,m.name),e=e.add(new Nt(r,0))}let u=0;for(let p of a)u+=p.x;let d=new Nt(u/a.length,e.y+i);tg.drawText(d,"N:"+s);for(let p of a){let m=new bt(p,d),g=new Array;g.push(m);let y=Qs.build1(aPe(g));tg.drawPolyType(y,_l.GREEN)}return[d,new Nt(c,l),new Nt(h,l)]}static drawRule(t,e=tg.PrintStart,r=!1,i){tg.clearDrawing(),this.doDrawRule(t,e),r&&this.doDrawRulePolygon(t,i),tg.getDebug().draw()}static doDrawRulePolygon(t,e){let r=t[0];for(let i=1;i<t.length;i++){let n=t[i];if(n instanceof Array)this.doDrawRulePolygon(n,e);else{let s=e;r===2&&i===1&&(s=_l.RED),n.name&&tg.drawText(n.bbox().UL(),n.name,s),tg.drawPolyType(n,s)}}}static IsCenterBBoxPointInPolygonType(t,e){let r=t.center();for(let i of e.items)if(i.getOutMostPolyline().getWindingNum(r))return!0;return!1}static KeepBBoxPolygonGroup(t,e){let r=e.bbox().intersection1(t);if(!r)return!1;for(let i of e.items)if(i.bbox().isIntersect(r)){for(let n of i.items)if(n.bbox().isIntersect(r)){for(let s of n.primitives)if(r.isIntersect(s.bbox()))return!0}}return!!this.IsCenterBBoxPointInPolygonType(t,e)}},Uyt=class GN{static createNode(t,e,r){let i=t.UL(),n=t.width()/e,s=t.height()/e,a=~~(r/e),l=r-a*e,c=i.x+l*n,h=i.y-(a+1)*s,u=c+n,d=h+s;return new qg(c,u,h,d)}static ocTreeSplitNode(t,e,r,i,n=2){if(t.length<=r)return t;let s=[],a=n**2,l=new Array(a),c=new Array(a);for(let p=0;p<a;p++)l[p]=new Array(t.length),c[p]=0;let h=e.UL(),u=e.width()/n,d=e.height()/n;for(let p of t){let m=i(p).center(),g=~~((m.x-h.x)/u),y=~~((h.y-m.y)/d)*n+g;try{l[y][c[y]]=p,c[y]+=1}catch{s.push(p)}}for(let p=0;p<l.length;p++){let m=c[p];if(m<=0)continue;let g=l[p].slice(0,m);if(g.length===t.length)return t;let y=GN.createNode(e,n,p),b=GN.ocTreeSplitNode(g,y,r,i,n);if(b.length===t.length)return t;s.push(b)}return s}static ocTreeSplitNodeMinIntersect(t,e,r,i){let n=[];if(t.length<=r)return t;let s=3,a=e.LL(),l=e.UR(),c=e.width()/(s+1),h=e.height()/(s+1),u=-(2**32),d=[],p=[];for(let m=1;m<=s;m++)for(let g=1;g<=s;g++){let y=a.x+c*m,b=a.y+h*g,P=[[],[],[],[]],T=new Array(4),I=new Array(4);I[0]=new qg(a.x,y,b,l.y),I[1]=new qg(y,l.x,b,l.y),I[2]=new qg(a.x,y,a.y,b),I[3]=new qg(y,l.x,a.y,b);for(let _ of t){let x=i(_).center(),v=-1,D=-1;x.x===y?v=Math.random()>=.5?1:-1:x.x>y?v=1:x.x<y&&(v=-1),x.y===b?D=Math.random()>=.5?1:-1:x.y>b?D=1:x.y<b&&(D=-1),v===1&&D===1?P[1].push(_):v===1&&D===-1?P[3].push(_):v===-1&&D===-1?P[2].push(_):v===-1&&D===1&&P[0].push(_)}for(let _=0;_<4;_++){let x=P[_];if(x.length<=0)continue;let v=new s2;for(let D of x)v.ext1(i(D));T[_]=v.build1()}let C=0,E=0;for(let _ of T)_&&(C+=_.area());E=C;let O=(_,x)=>{if(!T[_]||!T[x])return 0;let v=T[_].intersection1(T[x]);return v?v.area():0};E-=O(0,1),E-=O(0,2),E-=O(0,3),E-=O(1,2),E-=O(1,3),E-=O(2,3),E/C>=u&&(d=P,p=I)}for(let m=0;m<d.length;m++){let g=d[m];if(g.length<=0)continue;let y=p[m],b;if(g.length===t.length?b=GN.ocTreeSplitNode(g,y,r,i):b=GN.ocTreeSplitNodeMinIntersect(g,y,r,i),b.length===t.length)return t;n.push(b)}return n}static ocTreeSplit(t,e,r,i){return GN.ocTreeSplitNode(t,e,r,i,tg.OcTreeSplitStep)}},Hyt=class W5e{static simplifyRules(t,e){return tg.UseOptimizeSplit&&(t=this.optimizeSplit(t,e)),t}static OcTreeOptimizeSplit(t){let e=t[0];if(e!==1||t.length<=tg.LocalBestThread+1)return t;let r=t.slice(1),i=new Array(r.length);for(let c=1;c<t.length;c++)i[c-1]=c;let n=OW.getListBBox(r),s=Uyt.ocTreeSplit(i,n,tg.LocalBestThread,c=>{let h=t[c];return OW.getSingleBBox(h)}),a=(c,h)=>{if(!(c.length<=0))for(let u of c)if(Array.isArray(u)){let d=[h[0]];a(u,d),h.push(d)}else{let d=t[u];h.push(d)}},l=[e];return a(s,l),l}static optimizeSplit(t,e){let r=t[0];if(r===2){if(tg.HandleDiff){let n=t[1],s;if(Array.isArray(n)){let a=this.optimizeSplit(n,e);if(a.length<=1)return[2];s=yPe(a,e)}else s=yPe([2,n],e);if(t.length>3){let a;a=[1];for(let l=2;l<t.length;l++){let c=t[l];if(Array.isArray(c)){let h=OW.getListBBox([...c.slice(1)]);OW.KeepBBoxPolygonGroup(h,s)&&a.push(c)}else OW.KeepBBoxPolygonGroup(c.bbox(),s)&&a.push(c)}return a.length<=1?[2,s]:(a=this.optimizeSplit(a,e),a.length>1?[2,s,...a.slice(1)]:[2,s])}else{let a=t[2];if(Array.isArray(a)&&a[0]===1&&a.length>2){let l=a.slice(1);return this.optimizeSplit([2,s,...l],e)}}}else if(t.slice(1).length>2){let n=t[1],s=t.slice(2),a=this.optimizeSplit([1,...s],e);return a.length>1?[2,n,...a.slice(1)]:n}}else if(r===1){if(t.length-1>tg.LocalBestThread){let n=!1;for(let s=1;s<t.length;s++){let a=t[s];if(!Array.isArray(a)){n=!0;break}}n&&(t=W5e.OcTreeOptimizeSplit(t))}}else if(r===0&&t.length<=2)return[0];let i=[r];for(let n=1;n<t.length;n++){let s=t[n];if(Array.isArray(s)){let a=this.optimizeSplit(s,e);if(a.length<=1)continue;i.push(a)}else i.push(s)}return i}},Wyt=(o=>(o[o.INTERSECT=0]="INTERSECT",o[o.UNION=1]="UNION",o[o.DIFF=2]="DIFF",o[o.XOR=3]="XOR",o))(Wyt||{});function LW(o){let t=o[0],e=[t];switch(t){case 0:for(let i=1;i<o.length;i++){let n=o[i];if(Array.isArray(n)&&(n=LW(n),!n))return null;e.push(n)}break;case 1:case 3:for(let i=1;i<o.length;i++){let n=o[i];Array.isArray(n)&&(n=LW(n),!n)||e.push(n)}break;case 2:let r=o[1];if(Array.isArray(r)&&(r=LW(r)),!r)return null;e.push(r);for(let i=2;i<o.length;i++){let n=o[i];Array.isArray(n)&&(n=LW(n),!n)||e.push(n)}break;default:throw new Error("not support boolean rule!")}return e.length===1?null:e}function jbe(o,t,e){return Array.isArray(o)?z5e(o,t,e):o}function Xbe(o,t,e,r,i=!0){if(i)for(;o.length>1;){let n,s=[];for(o.length%2===1?(s.push(o[0]),n=1):n=0;n<o.length;n+=2)s.push(t(o[n],o[n+1],e,r));o=s}else for(;o.length>1;){if(o.length===2)return t(o[0],o[1],e,r);o=[t(o[0],o[1],e,r),...o.slice(2)]}return o[0]}function z5e(o,t,e,r=!0){let i=new Array(o.length-1);for(let n=1;n<o.length;n++)i[n-1]=jbe(o[n],t,e);switch(o[0]){case 0:return Xbe(i,EW.intersect,t,e);case 1:return Xbe(i,EW.union,t,e);case 2:let n=Xbe(i.slice(1),EW.union,t,e);return n?EW.diff(i[0],n,t,e):i[0];case 3:let s=jbe(o[1],t,e);for(let a=2;a<o.length;a++)s=EW.xor(s,jbe(o[a],t,e),t,e);return s;default:throw new Error("not support boolean rule! "+o[0])}}function Y5e(o){let t=[o[0]];for(let e=1;e<o.length;e++){let r=o[e];if(Array.isArray(r)){let i=Y5e(r);Array.isArray(i)?i.length>1&&t.push(i):t.push(i)}else{let i=zQ(r);i!==null&&t.push(Gd.build(i))}}return t}function zyt(o,t){tg.curBus=t,o=Y5e(o);let e;return tg.UseRunArrange?e=Hyt.simplifyRules(o,t):e=LW(o),e.length<=1?new Gd([]):yPe(e,t)}function yPe(o,t,e=!0){if(!o||o.length===1)return new Gd([]);let r=o,i=new Gyt,n=[];function s(a){for(let l=1;l<a.length;l++){let c=a[l];Array.isArray(c)?s(c):n.push(c)}}return s(r),i.init(n),z5e(r,i,t,e)}var gQ=new Error("list is empty"),yQ=class{constructor(o,t){this.prev=null,this.next=null,this.parent=o,this.item=t}insertAfter(o){o.next=this.next,this.next=o,o.prev=this,o.next!==null&&(o.next.prev=o)}insertBefore(o){o.prev=this.prev,this.prev=o,o.next=this,o.prev!==null&&(o.prev.next=o)}remove(){this.prev!==null&&(this.prev.next=this.next),this.next!==null&&(this.next.prev=this.prev)}set(o){this.item=o}},Yyt=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o.item;throw new Error("iterator is null")}},jyt=class{constructor(o){this._next=o}hasNext(){return this._next!==null}next(){let o=this._next;if(o!==null)return this._next=o.next,o;throw new Error("iterator is null")}},Xyt=class{constructor(){this.first=null,this.last=null,this.cnt=0}add(o){return this.addLast(o)}push(o){return this.addLast(o)}pop(){return this.removeLast()}shift(){return this.removeFirst()}removeFirst(){let o=this.first;if(o===null)throw gQ;return this.remove(o),o.item}removeLast(){let o=this.last;if(o===null)throw gQ;return this.remove(o),o.item}addLast(o){if(this.first===null||this.last===null){let t=new yQ(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertAfter(this.last,o)}addFirst(o){if(this.first===null||this.last===null){let t=new yQ(this,o);return this.first=t,this.last=t,this.cnt++,t}else return this.insertBefore(this.first,o)}getFirst(){if(this.first===null)throw gQ;return this.first.item}getLast(){if(this.last===null)throw gQ;return this.last.item}insertAfter(o,t){let e=new yQ(this,t);return o.insertAfter(e),o===this.last&&(this.last=e),this.cnt++,e}insertBefore(o,t){let e=new yQ(this,t);return o.insertBefore(e),o===this.first&&(this.first=e),this.cnt++,e}remove(o){o.remove(),o===this.first&&(this.first=o.next),o===this.last&&(this.last=o.prev),this.cnt--}size(){return this.cnt}clear(){this.first=null,this.last=null,this.cnt=0}iterator(){return new Yyt(this.first)}listIterator(){return new jyt(this.first)}toArray(){let o=new Array,t=this.first;for(;t!=null;)o.push(t.item),t=t.next;return o}},vQ=class{constructor(o){this.inters=[],o&&(this.inters=o)}addInter(o){this.inters.push(o),o.group=this}findInter(o){let t=this.inters.find(e=>vn(e.coord,o.coord));return t&&this.inters.find(e=>e.side===o.side)&&o.visitSelf(),t}getOutInter(o){let t=this.inters.filter(e=>!e.getVisited());if(t.length!==0)return t.length===1?t[0]:t.reduce((e,r)=>{if(!e||e.side.getShape()===o)return r;if(r.side.getShape()===o)return e;let i=e.coord,n=eo(o,i),s=eo(e.side.getShape(),i),a=eo(r.side.getShape(),i);return n.dot(s)>n.dot(a)?e:r},void 0)}getEntryInter(){}},qbe=0;function j5e(o,t){let e=o.primitives[0];if(o.primitives.length===1&&e instanceof dr&&Math.abs(e.sweepAngle)===360)return[o];let r=iz();qbe++;let i,n=r2t(o);if(n.length===0)return[];let s=Kyt(n);if(qbe===-1){i=new tz(t);let h=i.initColor(_l.BLUE);n.forEach(d=>h.addPt(d.getShape()));let u=i.initColor(_l.GREEN);s.forEach(d=>u.addPoint(d.coord)),i.draw();debugger;throw new Error}if(s.length===0)return[Qs.build7(n.map(h=>h.getShape()))];Zyt(s);let a=[],l=!1;try{e2t(s,i)}catch(h){h.customType==="IS_OVERLAP"?(l=!0,a=new RW().getUnion([o]).map(u=>u.items).flat(2)):console.error(h)}if(l)return a;let c=Qyt(s);if(!c.length)return[Qs.build7(n.map(h=>h.getShape()))];if(a=qyt(c,i),a.length===0)return console.warn("=====deSelfIntersection=====",qbe),[];if(i)throw a.forEach(h=>{i.initColor(_l.WHITE).addPly(h),i.draw();debugger}),new Error;return L9.deSelfIntersection+=uv(r),a}function qyt(o,t){let e=[];return o.forEach(r=>{let i=r;r.inters.forEach(n=>{if(n.getVisited())return;let s=[],a=[],l;if(t){debugger;let h=t.initColor(_l.RED);l=u=>{s.push(u),h.addPt(s[s.length-1]),t.draw();debugger}}else l=h=>s.push(h);do{let h=function(g,y){br.eq(g.distance2(y),0)||l(X5e(p.getShape(),g,y))},u=a.findIndex(g=>g===n.group);if(u!==-1){let g=s.findIndex(P=>P===n.group),y=s.splice(g).filter(P=>!(P instanceof vQ));if(y.length){let P=mv(Qs.build7(y));P&&e.push(P)}let b=s.filter(P=>!(P instanceof vQ));if(n=a[u].getOutInter(b[b.length-1]),a.splice(u),!n)throw Error("interGroup not hav inter!!!2");continue}n.visitSelf(),a.push(n.group),s.push(n.group);let d=n.getIndex(),p=n.side,m=p.inters[d+1];for(;m!=null&&m.isInvalid||m&&m.group===n.group;)m=p.inters[m.getIndex()+1];if(m){h(n.coord,m.coord);let g=m.getBindedInter();if(n=g.getVisited()?g.group.getOutInter(g.side.getShape()):g,!n){if(m.group===i)break;throw new Error("interGroup not hav inter!!!3")}}else{for(h(n.coord,p.getEnd()),p=p.nextSide,n=null;;){for(let g of p.inters)if(!g.isInvalid){let y=g.group.getOutInter(p.getShape());if(!y){if(g.group===i){n=g;break}else if(g.getBindedInter().group===i){n=g.getBindedInter();break}continue}n=y;break}if(n)break;l(p.getShape()),p=p.nextSide}br.eq(p.getEnd().distance2(n.coord),0)?l(p.getShape()):h(p.getStart(),n.coord)}}while(n.group!==i);let c=mv(Qs.build7(s.filter(h=>!(h instanceof vQ))));c&&e.push(c)})}),e}function $yt(o){return{next(){return o.hasNext()?{value:o.next()}:{done:!0,value:void 0}},[Symbol.iterator](){return this}}}function Kyt(o){let t=[],e=new Xyt;for(let r of o.slice().sort((i,n)=>i.bbox().minY-n.bbox().minY)){for(let i of $yt(e.listIterator())){let n=i.item;if(n.bbox().maxY<r.bbox().minY)e.remove(i);else{let s=function(d,p){let m=new EO(p,d,null);return d.inters.push(m),t.push(m),m},a=function(d,p){let m=d.getEnd(),g=new Nt(nt[0],nt[1]),y=new Nt(nt[2],nt[3]),b=m.distance2(g)>m.distance2(y)?g:y,P=d.prevSide;s(vn(P.getEnd(),b)?P:d,b).bind(s(p,b))},l=n.getShape(),c=r.getShape(),h=ZT(l,c),u=h===4&&nt[0]===nt[2]&&nt[1]===nt[3];if(u&&(h-=2),n.nextSide===r)n.prevSide!==r&&h===4&&a(n,r);else if(n.prevSide===r)h===4&&a(r,n);else if(h!==0){let d=function(m,g){let y=m.prevSide;return s(vn(y.getEnd(),g)?y:m,g)},p=new Nt(nt[0],nt[1]);if(u&&!vn(p,n.prevSide.getEnd())&&!vn(p,r.prevSide.getEnd())&&eo(l,p).dot(eo(c,p))>0)continue;for(let m=0;m<h;m+=2){let g=new Nt(nt[m],nt[m+1]);d(n,g).bind(d(r,g))}}}}e.add(r)}return t.forEach(r=>{r.getIndex()===void 0&&r.side.sortInters()}),t}function Zyt(o){o.forEach(t=>{let e=t.side.getEnd();if(t.isInvalid||!vn(t.coord,e))return;let r=t.side.inters,i=t.getBindedInter().side;for(let n=r.length-1;n>=0;n--){let s=r[n];if(!vn(s.coord,e))break;s!==t&&s.getBindedInter().side===i&&s.setIsInvalid()}})}function Jyt(o){let t=new WW(10);return o.forEach(e=>{e.isInvalid||t.add(e)}),t}function Qyt(o){let t=[],e=Jyt(o);return o.forEach(r=>{if(r.isInvalid||r.group)return;let i=e.search(r.bbox().extendOfSize(br.eps)).filter(n=>!n.group);if(i.length){let n=new Set,s=new vQ(i);i.forEach(a=>{a.group=s,n.has(a.side)&&a.visitSelf(),n.add(a.side)}),t.push(s)}}),t}function e2t(o,t){o.forEach(e=>{if(e.isInvalid||e.dealed)return;let r=e.side,i=e.getBindedInter().side,n;vn(r.getEnd(),e.coord)&&vn(i.getEnd(),e.coord)?n=-1:vn(r.getEnd(),e.coord)?r.nextSide!==i&&(n=1,e=e.getBindedInter()):vn(i.getEnd(),e.coord)&&i.nextSide!==r&&(n=1),t2t(n,e,t),e.isDealed()})}function t2t(o,t,e){let r=t.getBindedInter(),i=t.side,n=r.side,s=i.getShape(),a=n.getShape(),l=1,c=!1;if(o===-1){if(wN(s.reverse(),a.reverse())||wN(i.nextSide.getShape(),n.nextSide.getShape())){let u=CO(i,i.nextSide,n,r,l,c,e);if(u.state===2){let p=new Error("info1.state === InState.IS_OVERLAP");throw p.customType="IS_OVERLAP",p}let d=CO(i,i.nextSide,n.nextSide,r,l,c,e);u.state===d.state&&h(u,d)}else if(!(wN(s.reverse(),n.nextSide.getShape())||wN(i.nextSide.getShape(),a.reverse()))){let u=Vbe(i,i.nextSide,n,!1,e);u===Vbe(i,i.nextSide,n.nextSide,!0,e)&&u!==Vbe(n,n.nextSide,i.nextSide,!0,e)&&t.setIsInvalid()}}else if(o===1){let u=function(d,p){return eo(d,p.start()).dot(eo(p,p.start()))>0};if(wN(s.reverse(),a.reverse())||wN(s,n.nextSide.getShape())){let d=AP(i,n,r,e,l,c,new Map);if(d.state===2){let m=new Error("info1.state === InState.IS_OVERLAP");throw m.customType="IS_OVERLAP",m}let p=AP(i,n.nextSide,r,e,l,c,new Map);d.state===p.state&&h(d,p)}else if(u(s.reverse(),a.reverse())&&u(s,n.nextSide.getShape())){let d=vf(i,n,!1,e);d===vf(i,n.nextSide,!0,e)&&d!==uL(n,n.nextSide,new rz(X5e(s,t.coord,s.end()),e),!0,e)&&t.setIsInvalid()}}function h(u,d){u.inter.setIsInvalid(),d.inter.setIsInvalid(),t.setIsInvalid()}}function X5e(o,t,e){if(o instanceof bt||t.distance2(e)<1e-6)return new bt(t,e);if(o instanceof dr)return dr.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.sweep());if(o instanceof ki){let r=o.getPercent(t,to),i=o.getPercent(e,to);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}function r2t(o){let t=mv(o);if(!t)return[];let e=t.primitives.map(i=>new rz(i,null)),r=e[e.length-1];return e.forEach(i=>{r.connect(i),r=i}),e}var NN,i2t=(NN=class{static clearData(o){this.originalPrimitive=[],this.offsetPrimitive=[],this.rawOffsetPrimitive=[],this.offsetDistance=0,this.testI++,this.testI===0?this.drawDebug=new tz(o):delete this.drawDebug}static createRawOffsetEdge(){if(this.drawDebug){let o=this.drawDebug.initColor(_l.WHITE);this.originalPrimitive.forEach(t=>o.addPt(t)),this.drawDebug.draw();debugger}for(let o=0;o<this.originalPrimitive.length;o+=1){let t=this.originalPrimitive[o];this.offsetPrimitive.push({index:o,offsetEdge:this.createOffsetEdge(t)})}if(this.drawDebug){let o=this.drawDebug.initColor(_l.Golden);this.offsetPrimitive.forEach(t=>o.addPt(t.offsetEdge)),this.drawDebug.draw();debugger}if(this.offsetPrimitive.length>1)for(let o=0;o<this.offsetPrimitive.length;o+=1)if(o===this.offsetPrimitive.length-1){this.connectPrimitive(this.offsetPrimitive[o],this.offsetPrimitive[0]);let t=this.rawOffsetPrimitive[0],e;t instanceof dr?e=dr.build4(this.offsetPrimitive[0].offsetEdge.start(),t.end(),t.center,t.rx,t.ry,t.sweep()):e=new bt(this.offsetPrimitive[0].offsetEdge.start(),t.end()),this.rawOffsetPrimitive.shift(),this.rawOffsetPrimitive.unshift(e)}else this.connectPrimitive(this.offsetPrimitive[o],this.offsetPrimitive[o+1]);else this.rawOffsetPrimitive=[]}static createCirclePrimitive(o,t){let e=o.width()*.5,r=o.height()*.5,i=Math.sqrt(e**2+r**2)+t;return[dr.buildCircle(o.center(),i)]}static getExtendPolyLine(o,t,e=!0,r){var i,n;if(!((i=o==null?void 0:o.primitives)!=null&&i.length))return[];let s=mv(o);if(!((n=s==null?void 0:s.primitives)!=null&&n.length)){if(this.isExpansion){let l=[1],c=t*2;o.primitives.forEach(u=>l.push(u.stroke(c,1,0)));let h=zyt(l,r);if(h.items.length!==1)throw new Error("group.items.length !== 1 ");return[h.items[0].items[0]]}return[]}if(o=s,this.clearData(r),this.originalPrimitive=o.primitives,this.isExpansion=t>0,this.offsetDistance=t,this.createRawOffsetEdge(),this.drawDebug){let l=this.drawDebug.initColor(_l.BLUE);this.rawOffsetPrimitive.forEach(c=>l.addPt(c)),this.drawDebug.draw();debugger}let a=e?this.createClippingEdge(r):[Qs.build2(this.rawOffsetPrimitive)];if(this.drawDebug){let l=this.drawDebug.initColor(_l.RED);a.forEach(c=>l.addPly(c)),this.drawDebug.draw();debugger}if(a.length&&(!this.isExpansion||this.isExpansion&&a.length>1)&&(a=this.getValidityPrimitive(a)),this.drawDebug){let l=this.drawDebug.initColor(_l.GREEN);a.forEach(c=>l.addPly(c)),this.drawDebug.draw();debugger;throw new Error}return a}static getValidityPrimitive(o){let t=[],e=Math.abs(this.offsetDistance);for(let r=0;r<o.length;r+=1){let i=!0,n=o[r].primitives;e:for(let s=0;s<n.length;s+=1){let a=n[s],l;if(a instanceof dr)l=a.midPoint;else if(a instanceof bt)l=a.start();else throw new Error("not support!");for(let c=0;c<this.originalPrimitive.length;c+=1){let h=this.originalPrimitive[c],u;if(h instanceof dr?u=this.pointArcClosest(l,h):u=F1t(l,h.start(),h.end()).d,e-u>.01){i=!1;break e}}}i&&t.push(o[r])}return t}static getInters(o){let t=[];for(let e=0;e<o;e+=2)t.push(new Nt(nt[e],nt[e+1]));return t}static pointArcClosest(o,t){let e=t.center;if(o.equals1(t.center))return t.rx;if(t.inArea(o,0)){let n=o.sub(e);return Math.abs(n.length()-t.rx)}let r=o.distance2(t.start()),i=o.distance2(t.end());return br.less(r,i)?Math.sqrt(r):Math.sqrt(i)}static createClippingEdge(o){let t=[],e=[],r=j5e(Qs.build2(this.rawOffsetPrimitive),o);r.forEach(n=>{let s=n.area(.01);t.push(s)});let i=Math.min(...t.filter(n=>n<0));for(let n=0;n<t.length;n+=1){let s=t[n];br.eq(s,0)||(!this.isExpansion&&s<0||this.isExpansion&&(s<0&&t[n]===i||s>0))&&e.push(r[n])}return e}static createOffsetEdge(o){if(o instanceof dr)return o.panDistance1(this.offsetDistance);if(o instanceof bt)return o.panDistance(this.offsetDistance);throw new Error("not support!")}static connectPrimitive(o,t){o.offsetEdge instanceof bt&&t.offsetEdge instanceof bt?this.lineToLineConnect(o,t):o.offsetEdge instanceof dr&&t.offsetEdge instanceof dr?this.arcToArcConnect(o,t):o.offsetEdge instanceof bt&&t.offsetEdge instanceof dr?this.lineToArcConnect(o,t):this.arcToLineConnect(o,t)}static isFalseIntersection(o){return o>1||o<0}static lineToLineConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=t.index,n=this.originalPrimitive[i].start();if(e.isParallel(r))e.bbox().intersection1(r.bbox())?this.rawOffsetPrimitive.push(e):this.lineToLineUseArcToConnect(n,e,r);else{let s=this.getLineToLineT(e,r),a=s[0],l=s[1];if(this.isFalseIntersection(a)||this.isFalseIntersection(l))a>1&&this.isFalseIntersection(l)?this.lineToLineUseArcToConnect(n,e,r):this.useLineToConnect(e,r);else if(!this.isFalseIntersection(a)&&!this.isFalseIntersection(l)){let c=e.end().sub(e.start()),h=e.start().add(c.mul(a)),u=new bt(e.start(),h);this.rawOffsetPrimitive.push(u);let d=new bt(h,r.end());this.updateNextOffsetPrimitive(i,d)}}}static updateNextOffsetPrimitive(o,t){this.offsetPrimitive[o].offsetEdge=t}static useLineToConnect(o,t){this.rawOffsetPrimitive.push(o);let e=new bt(o.end(),t.start());this.rawOffsetPrimitive.push(e)}static lineToLineUseArcToConnect(o,t,e){let r=this.getSweep(o,t),i=this.getSweepAngel(t.end(),e.start(),o,r);if(i===0){this.useLineToConnect(t,e);return}this.rawOffsetPrimitive.push(t);let n=dr.build5(t.end(),e.start(),i);this.rawOffsetPrimitive.push(n)}static getSweep(o,t,e){let r=null,i=e||e===0?this.originalPrimitive[e]:t;if(i instanceof dr){let n=i.center.sub(i.end()).normalize();i.isCCW?r=new Nt(n.y,-n.x):r=new Nt(-n.y,n.x)}else r=t.end().sub(t.start()).normalize();return o.sub(t.end()).normalize().cross(r)>0?0:1}static getLineToLineT(o,t){let e=o.end().sub(o.start()),r=t.end().sub(t.start()),i=e.cross(r),n=t.start().sub(o.start()),s=o.start().sub(t.start()),a=n.cross(r)/i,l=s.cross(e)/-i;return[a,l]}static lineToArcConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=o.index,n=t.index,s=this.getLineJoinArcScalarAndIntersectionNum(e,r),a=this.originalPrimitive[n].start();if(s.intersectionNum===0)this.lineAndArcUseArcConnect(a,e,r,i);else if(s.intersectionNum===1){let l=s.points[0];this.lineAndArcConnectionDetail(e,r,s.t[0],l,a,i,n)}else if(s.intersectionNum===2){let l=s.points[0],c=s.points[1],h=l.distance2(a),u=c.distance2(a);this.lineAndArcConnectionDetail(e,r,h<u?s.t[0]:s.t[1],h<u?l:c,a,i,n)}}static lineAndArcConnectionDetail(o,t,e,r,i,n,s){let a=this.isTrueArcIntersection(t,r);if(!this.isFalseIntersection(e)&&a){let l=new bt(o.start(),r);this.rawOffsetPrimitive.push(l);let c;!t.center.equals1(r)||t.sweepAngle>1e-4?(c=dr.build4(r,t.end(),t.center,t.rx,t.ry,t.sweep()),c instanceof dr&&c.sweepAngle===0&&(c=new bt(c.start(),c.end()))):c=new bt(t.center,r),this.updateNextOffsetPrimitive(s,c)}else a?this.useLineToConnect(o,t):this.lineAndArcUseArcConnect(i,o,t,n)}static lineAndArcUseArcConnect(o,t,e,r){let i=this.getSweep(o,t,r),n=this.getSweepAngel(t.end(),e.start(),o,i);if(n===0){this.useLineToConnect(t,e);return}let s=dr.build5(t.end(),e.start(),n);this.rawOffsetPrimitive.push(t),this.rawOffsetPrimitive.push(s)}static arcToLineConnectionDetail(o,t,e,r,i,n,s){let a=this.isTrueArcIntersection(o,r);if(!this.isFalseIntersection(e)&&a){let l;o.center.equals1(r)?l=new bt(o.center,r):Math.abs(o.sweepAngle)<1e-4?l=new bt(o.start(),r):(l=dr.build4(o.start(),r,o.center,o.rx,o.ry,o.sweep()),l instanceof dr&&l.sweepAngle===0&&(l=new bt(l.start(),l.end()))),this.rawOffsetPrimitive.push(l);let c=new bt(r,t.end());this.updateNextOffsetPrimitive(s,c)}else a?this.useLineToConnect(o,t):this.lineAndArcUseArcConnect(i,o,t,n)}static isTrueArcIntersection(o,t){return bp(o,t)}static getSweepAngel(o,t,e,r){let i=o.angleD(e),n=t.angleD(e),s;return i===n?s=0:(i=Uo.regularD(i),n=Uo.regularD(n),r===1?n<=i&&(n+=360):n>=i&&(i+=360),s=n-i),s}static getLineJoinArcScalarAndIntersectionNum(o,t){let e={t:[],intersectionNum:0,points:[]},r=N1t(t,o);if(r){e.intersectionNum=r/2;for(let i=0;i<r-1;i+=2){let n=new Nt(nt[i],nt[i+1]);e.points.push(n),n.sub(o.start()).x<1e-4||n.sub(o.start()).y<1e-4?e.t.push(0):e.t.push(n.sub(o.start()).x/o.end().sub(o.start()).x)}}else e.intersectionNum=0;return e}static arcToLineConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=o.index,n=t.index,s=this.getLineJoinArcScalarAndIntersectionNum(r,e),a=this.originalPrimitive[n].start();if(s.intersectionNum===0)this.lineAndArcUseArcConnect(a,e,r,i);else if(s.intersectionNum===1){let l=s.points[0];this.arcToLineConnectionDetail(e,r,s.t[0],l,a,i,n)}else if(s.intersectionNum===2){let l=s.points[0],c=s.points[1],h=l.distance2(a),u=c.distance2(a);this.arcToLineConnectionDetail(e,r,h<u?s.t[0]:s.t[1],h<u?l:c,a,i,n)}}static rxChangeStatus(o){return o===1?!this.isExpansion:this.isExpansion}static arcToArcConnect(o,t){let e=o.offsetEdge,r=t.offsetEdge,i=A5e(e,r);if(i){let n=this.getInters(i),s;if(n.length===2){let c=this.originalPrimitive[t.index].start(),h=n[0],u=n[1],d=h.distance2(c),p=u.distance2(c);d<p?s=h:s=u}else s=n[0];let a,l;s.equals1(e.center)?a=new bt(e.center,s):Math.abs(e.sweepAngle)<1e-4?a=new bt(e.start(),s):(a=dr.build4(e.start(),s,e.center,e.rx,e.ry,e.sweep()),a instanceof dr&&a.sweepAngle===0&&(a=new bt(a.start(),a.end()))),this.rawOffsetPrimitive.push(a),s.equals1(r.center)?l=new bt(s,r.center):Math.abs(r.sweepAngle)<1e-4?l=new bt(s,r.end()):(l=dr.build4(s,r.end(),r.center,r.rx,r.ry,r.sweep()),l instanceof dr&&l.sweepAngle===0&&(l=new bt(l.start(),l.end()))),this.updateNextOffsetPrimitive(t.index,l)}else{let n=this.originalPrimitive[o.index],s=this.originalPrimitive[t.index],a=this.rxChangeStatus(n.sweep()),l=this.rxChangeStatus(s.sweep()),c=this.originalPrimitive[t.index].start(),h=this.getSweep(c,e,o.index),u=Math.abs(this.offsetDistance),d=dr.build2(c,a?n.endAngle():n.endAngle()+180,l?s.startAngle:s.startAngle+180,u,u,h);this.rawOffsetPrimitive.push(e),this.rawOffsetPrimitive.push(d)}}},NN.originalPrimitive=[],NN.offsetPrimitive=[],NN.rawOffsetPrimitive=[],NN.testI=0,NN),n2t=class MW extends QW{constructor(t,e,r,i,n,s){if(super(),e<0||r<0)throw new Error("The width and height of rect can't be less than 0!");this.leftUpPoint=t,this.width=e,this.height=r,this.angle=i,this.isCCW=n,this.radius=Math.min(Math.max(s,0),e/2,r/2)}get radiusRatio(){return this.radius/Math.min(this.width,this.height)}start(){return this.leftUpPoint.add(new Nt(this.radius,0).multiply3(tc.rotateD(this.angle)))}end(){return this.start()}getLeftPoint(){return this.leftUpPoint.add(new Nt(0,-this.height/2).multiply3(tc.rotateD(this.angle)))}getRightPoint(){return this.leftUpPoint.add(new Nt(this.width,-this.height/2).multiply3(tc.rotateD(this.angle)))}extend(t){return new MW(this.leftUpPoint.add(new Nt(-t,t).rotateD(Nt.ORIGIN,this.angle)),this.width+t*2,this.height+t*2,this.angle,this.isCCW,this.radius+t)}bbox(){let t=tc.rotateD(this.angle),{leftUpPoint:e,width:r,height:i,radius:n}=this,s=e.add(new Nt(n,-n).multiply3(t)),a=e.add(new Nt(n,n-i).multiply3(t)),l=e.add(new Nt(r-n,-n).multiply3(t)),c=e.add(new Nt(r-n,n-i).multiply3(t));return new qg(Math.min(s.x,a.x,l.x,c.x)-n,Math.max(s.x,a.x,l.x,c.x)+n,Math.min(s.y,a.y,l.y,c.y)-n,Math.max(s.y,a.y,l.y,c.y)+n)}toPolyline(){let t=[],{leftUpPoint:e,width:r,height:i,radius:n}=this;if(n===0){let a=Nt.ORIGIN,l=new Nt(r,0),c=new Nt(r,-i),h=new Nt(0,-i);t.push(new bt(a,l),new bt(l,c),new bt(c,h),new bt(h,a))}else{let a=new Nt(0,-n),l=new Nt(n,0),c=new Nt(r-n,0),h=new Nt(r,-n),u=new Nt(r,n-i),d=new Nt(r-n,-i),p=new Nt(n,-i),m=new Nt(0,n-i);t.push(dr.build1(a,l,n,n,!1,0),new bt(l,c),dr.build1(c,h,n,n,!1,0),new bt(h,u),dr.build1(u,d,n,n,!1,0),new bt(d,p),dr.build1(p,m,n,n,!1,0),new bt(m,a))}t=t.filter(a=>!a.start().equals1(a.end())),this.isCCW&&(t.forEach((a,l)=>t[l]=a.reverse()),t.reverse());let s=tc.rotateD(this.angle).translate1(e);return Qs.build2(t.map(a=>a.multiply3(s)))}center(){return this.leftUpPoint.add1(this.width/2,this.height/2).rotateD(this.leftUpPoint,this.angle)}multiply3(t){let e=this.leftUpPoint.multiply3(t),r=new Nt(this.width,0).multiply3(tc.rotateD(this.angle)).multiply3(t),i=new Nt(0,-this.height).multiply3(tc.rotateD(this.angle)).multiply3(t);return t.isMirrored()?new MW(e,i.length(),r.length(),i.angleD(Nt.ORIGIN),this.isCCW===1?0:1,this.radius*r.length()/this.width):new MW(e,r.length(),i.length(),r.angleD(Nt.ORIGIN),this.isCCW,this.radius*r.length()/this.width)}reverse(){return new MW(this.leftUpPoint,this.width,this.height,this.angle,this.isCCW===1?0:1,this.radius)}stroke(t,e,r){let i=this.stroke1(t,e,r);if(i.length===1)return i[0];{let[n,s]=i;return Qs.build2(n.primitives.concat(new bt(n.primitives[0].start(),s.primitives[0].start()),s.primitives,new bt(s.primitives[0].start(),n.primitives[0].start())))}}stroke1(t,e,r){let i=r===this.isCCW?this:this.reverse(),n=t/2,s=Math.min(i.width,i.height)/2,a=i.extend(n).toPolyline();return s<=n?[a]:[a,i.extend(-n).toPolyline().reverse()]}points(t){let e=this.toPolyline(),r=[];return e.points(t,i=>r.push(i)),r}toBezier(){throw new Error("Method not implemented.")}},o2t=.01,m0=class YC{static simplify(t){return t=mv(t),t?new YC([t]):null}static buildByStroke(t,e,r=1,i=HPe,n){if(t instanceof dr&&(t.rx<e/2+o2t||Math.abs(t.sweepAngle)>180&&br.lesseq(t.start().distance1(t.end()),e))){let a=j5e(t.stroke(e,r,0),n);if(a.length===0)return null;if(a.length===1)return new YC(a);let l=[null],c=Number.POSITIVE_INFINITY;return a.forEach(h=>{let u=h.area(.1);u<0?u<c&&(l[0]=h,c=u):l.push(h)}),new YC(l)}else if(t instanceof n2t){let a=t.stroke1(e,r,0).map(l=>mv(l));return a[0]?a[1]?new YC(a):new YC([a[0]]):null}let s=t.stroke(e,r,0,i);return s?this.simplify(s):null}static buildCircle(t,e){return this.simplify(Qs.build7([dr.buildCircle(t,e,0)]))}static buildRect(t){return this.simplify(t.toPolyline())}static buildBBox(t){return this.simplify(Qs.buildBBox(t,0))}constructor(t){this.items=t.slice()}multiply3(t){return new YC(this.items.map(e=>e.multiply3(t)))}bbox(){return this.items[0].bbox()}isEqual(t){return t instanceof YC?this.items.every(e=>t.items.some(r=>r.isEqual(e))):!1}getOutMostPolyline(){return this.items[0]}extend(t,e){if(this.items.length!==1)throw new Error("this.items.length !== 1");if(t===0)return new Gd([this]);let r=this.items[0],i=[];for(let h of r.primitives)if(h instanceof bt)i.push(h);else if(h instanceof dr&&h.rx===h.ry)s(h);else if(h instanceof ki)n(h);else throw new Error("not support!");r=Qs.build7(i);function n(h){let u=h.points(.1);for(let d=0;d<u.length-1;d++){let p=u[d],m=u[d+1];i.push(new bt(p,m))}}function s(h){if(Math.abs(h.sweepAngle)>270){let u=h.sweepAngle/2;s(dr.build3(h.center,h.startAngle,u,h.rx,h.ry)),s(dr.build3(h.center,h.startAngle+u,u,h.rx,h.ry))}else i.push(h)}let a=[],l=[];i2t.getExtendPolyLine(r,t,!0,e).forEach(h=>{(h.area(.1)>0?l:a).push(h)});let c;if(a.length===1)l.forEach(h=>a.push(h)),c=new Gd([new YC(a)]);else if(a.length===0)console.warn("outlines.length === 0"),c=new Gd([]);else if(l.length===0)c=new Gd(a.map(h=>new YC([h])));else{let h=a.map(u=>[u]);l.forEach(u=>{let d=[],p=u.bbox();if(h.forEach(m=>{m[0].bbox().isContainsBBox1(p)&&d.push(m)}),d.length===1)d[0].push(u);else{if(d.length===0)throw new Error("inPlsArr.length === 0");for(let m of d.sort((g,y)=>g[0].bbox().area()-y[0].bbox().area()))if(m[0].getWindingNum(u.start())===-1){m.push(u);break}}}),c=new Gd(h.map(u=>new YC(u)))}return c}toPolylineGroup(){return new WPe(this.items)}},s2t=(o=>(o[o.POLYGON=1]="POLYGON",o[o.POLYLINE=2]="POLYLINE",o[o.LINE=3]="LINE",o[o.ARC=4]="ARC",o[o.BEZIER2=5]="BEZIER2",o[o.BEZIER3=6]="BEZIER3",o[o.BOOLEAN_OUTPUT=7]="BOOLEAN_OUTPUT",o[o.BOOLEAN_INTERSECTION=8]="BOOLEAN_INTERSECTION",o[o.BOOLEAN_UNION=9]="BOOLEAN_UNION",o[o.BOOLEAN_DIFF=10]="BOOLEAN_DIFF",o[o.BOOLEAN_RESULT=11]="BOOLEAN_RESULT",o[o.LINES=12]="LINES",o[o.ARCS=13]="ARCS",o[o.BEZIER2S=14]="BEZIER2S",o[o.BEZIER3S=15]="BEZIER3S",o[o.CIRCLE_CW=16]="CIRCLE_CW",o[o.CIRCLE_CCW=17]="CIRCLE_CCW",o[o.POLYGON_GROUP=18]="POLYGON_GROUP",o))(s2t||{}),a2t=class{constructor(o){this.idx=-1,this.lst=o}hasNext(){return this.idx<this.lst.length-1}next(){if(this.idx<this.lst.length-1)return this.idx++,this.lst[this.idx];throw new Error("bug")}};function l2t(o){return new a2t(o)}function c2t(o){return o===32||o===9||o===13||o===10}var h2t=class{constructor(){this._line=1,this._col=0}line(){return this._line}col(){return this._col}_feed(o){return o===10?(this._col=0,this._line++):this._col++,this.feed(o)}parse(o){let t=o.length;for(let e=0;e<t;e++){let r=o.charCodeAt(e);if(!this._feed(r))return this}return this.finish(),this}},$be=class{static repeat(o,t){let e=new Array(t);for(;t-- >0;)e[t]=o;return e.join("")}static lpad(o,t,e){let r=e-o.length;return r>0?this.repeat(t,r)+o:o}},u2t=/(\.?0+)$/,bPe=class{static format(o,...t){return this.format1(o,t)}static format1(o,t){let e=this._format(o,t);if(typeof e=="string")return e;throw new Error(this.format("Invalid state on (%d) %s",e,o))}static _format(o,t){let e=[],r=0,i=0,n,s=0,a=0;for(let l=0;l<o.length;l++){let c=o.charAt(l),h=c.charCodeAt(0);switch(r){case 0:h===37?r=1:e.push(c);break;case 1:switch(h){case 100:if(n=t[i++],typeof n=="number")e.push(n.toFixed(0)),r=0;else return l;break;case 102:if(n=t[i++],typeof n=="number")e.push(n.toString()),r=0;else return l;break;case 120:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16)),r=0;else return l;break;case 88:if(n=t[i++],typeof n=="number")e.push((n|0).toString(16).toUpperCase()),r=0;else return l;break;case 115:case 99:n=t[i++],e.push(n===null?"null":n.toString()),r=0;break;case 48:s=l+1,a=-1,r=2;break;case 37:e.push("%"),r=0;break;default:return l}break;case 2:switch(h){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a=l;break;case 100:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push($be.lpad((n|0).toString(10),"0",u)),r=0;else return l}else return l;break;case 120:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push($be.lpad((n|0).toString(16),"0",u)),r=0;else return l}else return l;break;case 88:if(a>=s){let u=parseInt(o.substring(s,a+1));if(n=t[i++],typeof n=="number")e.push($be.lpad((n|0).toString(16).toUpperCase(),"0",u)),r=0;else return l}else return l;break;default:return l}break;default:return l}}return e.join("")}static startsWith(o,t){return o.length>=t.length?o.substring(0,t.length)===t:!1}static endsWith(o,t){return o.length>=t.length?o.substring(o.length-t.length)===t:!1}static fmtNumber(o){return o.toFixed(5).replace(u2t,"")}};function d2t(o){switch(o){case 0:return"DEBUG";case 1:return"INFO";case 2:return"WARNING";case 3:return"ERROR";case 4:return"DUMMY"}}var p2t=(o,t)=>{o===3?console.error(...t):o===2?console.warn(...t):console.log(...t)},f2t=(o,t)=>[d2t(o)].concat(t),PPe=class TPe{static mix(...t){return new TPe(0,(e,r)=>{for(let i of t)i.write(e,r)},(e,r)=>r)}constructor(t,e=p2t,r=f2t){this.level=t,this.writer=e,this.fmt=r}setLevel(t){this.level=t}prepend(t=null,e=null){let r=t===null?this.fmt:(n,s)=>(s=t(n,s),this.fmt(n,s)),i=e===null?this.writer:(n,s)=>{e(n,s),this.writer(n,s)};return new TPe(this.level,i,r)}chain(t){return t.prepend(this.fmt.bind(this),this.writer.bind(this))}include(t){return this.level<=t}formatWrite(t,e,r){this.include(t)&&this.writer(t,this.fmt(t,[bPe.format(e,...r)]))}write(t,e){this.include(t)&&this.writer(t,this.fmt(t,e))}write3(t,e,r){this.include(t)&&this.writer(t,this.fmt(t,[bPe.format(e,...r)]))}debug3(t,...e){this.write3(0,t,e)}warning3(t,...e){this.write3(2,t,e)}debugFmt(t,...e){this.formatWrite(0,t,e)}debug(...t){this.write(0,t)}infoFmt(t,...e){this.formatWrite(1,t,e)}info(...t){this.write(1,t)}warningFmt(t,...e){this.formatWrite(2,t,e)}warning(...t){this.write(2,t)}errorFmt(t,...e){this.formatWrite(3,t,e)}error(...t){this.write(3,t)}};PPe.DUMMY=new PPe(4);var m2t=PPe,Kbe=500,U6e=String.fromCharCode,g2t=class{constructor(){this.buffer=new Array}size(){return this.buffer.length}isEOF(){return!1}write(o){return this.buffer.push(o),1}writen1(o){return this.writen2(o,0,o.length)}writen2(o,t,e){let r=this.buffer;for(let i=0,n=t;i<e;i++,n++)r.push(o[n]);return e}writeAsync(o,t){t(this.write(o))}writenAsync1(o,t){t(this.writen1(o))}writenAsync2(o,t,e,r){r(this.writen2(o,t,e))}writeStr(o){let t=o.length,e=new Array(t);for(let r=0;r<t;r++)e[r]=o.charCodeAt(r);return this.writen1(e)}clear(){this.buffer.length=0}toString(){let o=this.buffer,t=o.length;if(t<=Kbe)return U6e.apply(null,o);{let e=new Array;for(let r=0;r<o.length;r+=Kbe){let i=Math.min(t-r,Kbe),n=U6e.apply(null,o.slice(r,r+i));e.push(n)}return e.join("")}}},q5e=(o=>(o[o.UNKNOW=0]="UNKNOW",o[o.NUMBER_INTEGER=1]="NUMBER_INTEGER",o[o.NUMBER_DECIMAL=2]="NUMBER_DECIMAL",o[o.NUMBER_E=3]="NUMBER_E",o[o.NUMBER_E_SIGNED=4]="NUMBER_E_SIGNED",o))(q5e||{}),$5e=(o=>(o[o.UNKNOW=0]="UNKNOW",o[o.MOVE_X=1]="MOVE_X",o[o.MOVE_Y=2]="MOVE_Y",o[o.LINE_X=3]="LINE_X",o[o.LINE_Y=4]="LINE_Y",o[o.HORIZONTAL_X=5]="HORIZONTAL_X",o[o.VERTICAL_Y=6]="VERTICAL_Y",o[o.CUBIC_BEZIER_X1=7]="CUBIC_BEZIER_X1",o[o.CUBIC_BEZIER_Y1=8]="CUBIC_BEZIER_Y1",o[o.CUBIC_BEZIER_X2=9]="CUBIC_BEZIER_X2",o[o.CUBIC_BEZIER_Y2=10]="CUBIC_BEZIER_Y2",o[o.CUBIC_BEZIER_X=11]="CUBIC_BEZIER_X",o[o.CUBIC_BEZIER_Y=12]="CUBIC_BEZIER_Y",o[o.ARC_RX=13]="ARC_RX",o[o.ARC_RY=14]="ARC_RY",o[o.ARC_ROTATION=15]="ARC_ROTATION",o[o.ARC_LARGE=16]="ARC_LARGE",o[o.ARC_SWEEP=17]="ARC_SWEEP",o[o.ARC_X=18]="ARC_X",o[o.ARC_Y=19]="ARC_Y",o[o.SMOOTH_CUBIC_BEZIER_X2=20]="SMOOTH_CUBIC_BEZIER_X2",o[o.SMOOTH_CUBIC_BEZIER_Y2=21]="SMOOTH_CUBIC_BEZIER_Y2",o[o.SMOOTH_CUBIC_BEZIER_X=22]="SMOOTH_CUBIC_BEZIER_X",o[o.SMOOTH_CUBIC_BEZIER_Y=23]="SMOOTH_CUBIC_BEZIER_Y",o[o.QUADRATIC_BEZIER_X1=24]="QUADRATIC_BEZIER_X1",o[o.QUADRATIC_BEZIER_Y1=25]="QUADRATIC_BEZIER_Y1",o[o.QUADRATIC_BEZIER_X=26]="QUADRATIC_BEZIER_X",o[o.QUADRATIC_BEZIER_Y=27]="QUADRATIC_BEZIER_Y",o))($5e||{});function y2t(o){return 97<=o&&o<=122||65<=o&&o<=90}function Af(o){let t=parseFloat(o);if(isFinite(t))return t;throw new Error("expect number")}var H6e=class extends h2t{constructor(o,t=!0,e=m2t.DUMMY){super(),this.buffer=new g2t,this.group=new Array,this.subPartStart=Nt.ORIGIN,this.curPoint=Nt.ORIGIN,this.lexState=0,this.parseState=0,this.isAbsolute=!1,this.isLargeArc=!1,this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN,this.x=Number.NaN,this.y=Number.NaN,this.rx=Number.NaN,this.ry=Number.NaN,this.rotation=Number.NaN,this.sweep=hv.CCW,this.prevBezierCtrl2=null,this.logger=e,this.cb=o,this.yAxis=t?-1:1}on(o){return this.cb(o)}feed(o){switch(this.logger.include(0)&&this.logger.debug3("L: %c(%s)|%s",o,String.fromCharCode(o),q5e[this.lexState]),this.lexState){case 0:return c2t(o)?!0:48<=o&&o<=57||o===45||o===43?(this.pushBuffer(o),this.lexState=1,!0):o===46?(this.pushBuffer(o),this.lexState=2,!0):y2t(o)?this.feedS(String.fromCharCode(o)):(this.logger.warning3("unknow letter %c",o),!0);case 1:return 48<=o&&o<=57?(this.pushBuffer(o),!0):o===46?(this.pushBuffer(o),this.lexState=2,!0):o===101||o===69?(this.pushBuffer(o),this.lexState=3,!0):this.feedS(this.getCleanBuffer())?(this.lexState=0,this.feed(o)):!1;case 2:return 48<=o&&o<=57?(this.pushBuffer(o),!0):o===101||o===69?(this.pushBuffer(o),this.lexState=3,!0):this.feedS(this.getCleanBuffer())?(this.lexState=0,this.feed(o)):!1;case 3:return 48<=o&&o<=57?(this.pushBuffer(o),!0):o===45||o===43?(this.pushBuffer(o),this.lexState=4,!0):this.feedS(this.getCleanBuffer())?(this.lexState=0,this.feed(o)):!1;case 4:return 48<=o&&o<=57?(this.pushBuffer(o),!0):this.feedS(this.getCleanBuffer())?(this.lexState=0,this.feed(o)):!1;default:return!0}}finish(){this.feed(32),this.tryNotify()}feedS(o){switch(this.logger.include(0)&&this.logger.debug3("P: %s|%s|%s|%s",o,$5e[this.parseState],this.curPoint,this.subPartStart),this.parseState){case 0:switch(o){case"M":this.isAbsolute=!0,this.parseState=1;break;case"m":this.isAbsolute=!1,this.parseState=1;break;case"L":this.isAbsolute=!0,this.parseState=3;break;case"l":this.isAbsolute=!1,this.parseState=3;break;case"H":this.isAbsolute=!0,this.parseState=5;break;case"h":this.isAbsolute=!1,this.parseState=5;break;case"V":this.isAbsolute=!0,this.parseState=6;break;case"v":this.isAbsolute=!1,this.parseState=6;break;case"z":case"Z":{this.group.push(new bt(this.curPoint,this.subPartStart));let r=this.tryNotify();return this.curPoint=this.subPartStart,r}case"C":this.isAbsolute=!0,this.parseState=7;break;case"c":this.isAbsolute=!1,this.parseState=7;break;case"S":this.isAbsolute=!0,this.parseState=20;break;case"s":this.isAbsolute=!1,this.parseState=20;break;case"A":this.isAbsolute=!0,this.parseState=13;break;case"a":this.isAbsolute=!1,this.parseState=13;break;case"Q":this.isAbsolute=!0,this.parseState=24;break;case"q":this.isAbsolute=!1,this.parseState=24;break;default:this.logger.warning3("unknow %s",o)}return!0;case 1:let t=this.tryNotify();return this.x=Af(o),this.parseState=2,t;case 2:{this.y=this.yAxis*Af(o);let r;return this.isAbsolute?r=new Nt(this.x,this.y):r=this.curPoint.add1(this.x,this.y),this.curPoint=r,this.subPartStart=r,this.parseState=3,!0}case 3:return this.x=parseFloat(o),isFinite(this.x)?(this.parseState=4,!0):(this.parseState=0,this.feedS(o));case 4:{this.y=this.yAxis*Af(o);let r;return this.isAbsolute?r=new Nt(this.x,this.y):r=this.curPoint.add1(this.x,this.y),this.group.push(new bt(this.curPoint,r)),this.curPoint=r,this.parseState=3,!0}case 5:if(this.x=parseFloat(o),isFinite(this.x)){let r;return this.isAbsolute?r=new Nt(this.x,this.curPoint.y):r=this.curPoint.add1(this.x,0),this.group.push(new bt(this.curPoint,r)),this.curPoint=r,!0}else return this.parseState=0,this.feedS(o);case 6:if(this.y=parseFloat(o),isFinite(this.y)){this.y=this.yAxis*this.y;let r;return this.isAbsolute?r=new Nt(this.curPoint.x,this.y):r=this.curPoint.add1(0,this.y),this.group.push(new bt(this.curPoint,r)),this.curPoint=r,!0}else return this.parseState=0,this.feedS(o);case 7:let e=parseFloat(o);return isFinite(e)?(this.x1=e,this.parseState=8,!0):(o!=="s"&&o!=="S"&&(this.prevBezierCtrl2=null),this.parseState=0,this.feedS(o));case 8:return this.y1=this.yAxis*Af(o),this.parseState=9,!0;case 9:return this.x2=Af(o),this.parseState=10,!0;case 10:return this.y2=this.yAxis*Af(o),this.parseState=11,!0;case 11:return this.x=Af(o),this.parseState=12,!0;case 12:{this.y=this.yAxis*Af(o);let r,i,n;return this.isAbsolute?(r=new Nt(this.x1,this.y1),i=new Nt(this.x2,this.y2),n=new Nt(this.x,this.y)):(r=this.curPoint.add1(this.x1,this.y1),i=this.curPoint.add1(this.x2,this.y2),n=this.curPoint.add1(this.x,this.y)),this.prevBezierCtrl2=i,this.group.push(new ki([this.curPoint,r,i,n])),this.curPoint=n,this.parseState=7,!0}case 13:return this.rx=parseFloat(o),isFinite(this.rx)?(this.parseState=14,!0):(this.parseState=0,this.feedS(o));case 14:return this.ry=Af(o),this.parseState=15,!0;case 15:return this.rotation=Af(o),this.parseState=16,!0;case 16:return this.isLargeArc=Af(o)===1,this.parseState=17,!0;case 17:return this.sweep=Af(o)===1?hv.CW:hv.CCW,this.parseState=18,!0;case 18:return this.x=Af(o),this.parseState=19,!0;case 19:{this.y=this.yAxis*Af(o);let r;return this.isAbsolute?r=new Nt(this.x,this.y):r=this.curPoint.add1(this.x,this.y),this.rx&&this.ry&&this.group.push(dr.build1(this.curPoint,r,this.rx,this.ry,this.isLargeArc,this.sweep)),this.curPoint=r,this.parseState=13,!0}case 20:return this.x2=parseFloat(o),isFinite(this.x2)?(this.parseState=21,!0):(o!=="s"&&o!=="S"&&(this.prevBezierCtrl2=null),this.parseState=0,this.feedS(o));case 21:return this.y2=this.yAxis*Af(o),this.parseState=22,!0;case 22:return this.x=Af(o),this.parseState=23,!0;case 23:{this.y=this.yAxis*Af(o);let r,i;this.isAbsolute?(r=new Nt(this.x2,this.y2),i=new Nt(this.x,this.y)):(r=this.curPoint.add1(this.x2,this.y2),i=this.curPoint.add1(this.x,this.y));let n;return this.prevBezierCtrl2?n=this.curPoint.add(this.curPoint.sub(this.prevBezierCtrl2)):n=this.curPoint,this.prevBezierCtrl2=r,this.group.push(new ki([this.curPoint,n,r,i])),this.curPoint=i,this.parseState=20,!0}case 24:return this.x1=parseFloat(o),isFinite(this.x1)?(this.parseState=25,!0):(o!=="s"&&o!=="S"&&(this.prevBezierCtrl2=null),this.parseState=0,this.feedS(o));case 25:return this.y1=this.yAxis*Af(o),this.parseState=26,!0;case 26:return this.x=Af(o),this.parseState=27,!0;case 27:{this.y=this.yAxis*Af(o);let r,i;return this.isAbsolute?(r=new Nt(this.x1,this.y1),i=new Nt(this.x,this.y)):(r=this.curPoint.add1(this.x1,this.y1),i=this.curPoint.add1(this.x,this.y)),this.prevBezierCtrl2=r,this.group.push(new ki([this.curPoint,r,i])),this.curPoint=i,this.parseState=24,!0}default:return this.logger.warning3("unsupported parse state %s",this.parseState),!0}}pushBuffer(o){this.buffer.write(o)}getCleanBuffer(){let o=this.buffer.toString();return this.buffer.clear(),o}tryNotify(){if(this.group.length===0)return!0;{let o=Qs.build1(l2t(this.group));return this.group.length=0,this.on(o)}}onException(o){throw o}},FWt=bPe.fmtNumber,W6e=class{constructor(o=!0){this.buffer=new Array,this.state=0,this.prev=null,this.yAxis=o?-1:1}encPl(o){for(let t of o.primitives)this.encPt(t);return this}encPt(o){if(o instanceof bt)this.encLine1(o);else if(o instanceof dr)this.encArc(o);else if(o instanceof ki)this.encBezier(o);else throw new Error("");return this}encBezier(o){if(o.controls.length===3){let t=o.controls[0],e=o.controls[1],r=o.controls[2];this.state===0?this.buffer.push("M",t.x,this.yAxis*t.y,"Q",e.x,this.yAxis*e.y,r.x,this.yAxis*r.y):t.equals1(this.prev)?this.state!==4?this.buffer.push("Q",e.x,this.yAxis*e.y,r.x,this.yAxis*r.y):this.buffer.push(e.x,this.yAxis*e.y,r.x,this.yAxis*r.y):this.buffer.push("L",t.x,this.yAxis*t.y,"Q",e.x,this.yAxis*e.y,r.x,this.yAxis*r.y),this.prev=r,this.state=4}else if(o.controls.length===4){let t=o.controls[0],e=o.controls[1],r=o.controls[2],i=o.controls[3];this.state===0?this.buffer.push("M",t.x,this.yAxis*t.y,"C",e.x,this.yAxis*e.y,r.x,this.yAxis*r.y,i.x,this.yAxis*i.y):t.equals1(this.prev)?this.state!==3?this.buffer.push("C",e.x,this.yAxis*e.y,r.x,this.yAxis*r.y,i.x,this.yAxis*i.y):this.buffer.push(e.x,this.yAxis*e.y,r.x,this.yAxis*r.y,i.x,this.yAxis*i.y):this.buffer.push("L",t.x,this.yAxis*t.y,"C",e.x,this.yAxis*e.y,r.x,this.yAxis*r.y,i.x,this.yAxis*i.y),this.prev=i,this.state=3}else throw new Error("only bezier has 3 or 4 control points supported");return this}encArc(o){let t=o.svgEnd;return this.state===0?this.buffer.push("M",o.start().x,this.yAxis*o.start().y,"A",o.rx,o.ry,0,o.isLarge()?1:0,o.sweep()===hv.CCW?0:1,t.x,this.yAxis*t.y):o.start().equals1(this.prev)?this.state!==2?this.buffer.push("A",o.rx,o.ry,0,o.isLarge()?1:0,o.sweep()===hv.CCW?0:1,t.x,this.yAxis*t.y):this.buffer.push(o.rx,o.ry,0,o.isLarge()?1:0,o.sweep()===hv.CCW?0:1,t.x,this.yAxis*t.y):this.buffer.push("L",o.start().x,this.yAxis*o.start().y,"A",o.rx,o.ry,0,o.isLarge()?1:0,o.sweep()===hv.CCW?0:1,t.x,this.yAxis*t.y),this.prev=t,this.state=2,this}encLine1(o){return this.encLine2(o.start(),o.end()),this}encLine2(o,t){return this.state===0?this.buffer.push("M",o.x,this.yAxis*o.y,"L",t.x,this.yAxis*t.y):(this.state!==1&&this.buffer.push("L"),o.equals1(this.prev)?this.buffer.push(t.x,this.yAxis*t.y):this.buffer.push(o.x,this.yAxis*o.y,t.x,this.yAxis*t.y)),this.prev=t,this.state=1,this}close(o){return this.state!==0&&(o&&this.buffer.push("Z"),this.state=0,this.prev=null),this}fixNumber(o=4){return this.buffer.forEach((t,e,r)=>{typeof t=="number"&&(t|0)!==t&&(r[e]=+t.toFixed(o))}),this}toString(){return this.buffer.join(" ")}toArray(){return this.buffer}},b2t=class extends VPe{constructor(){super(),this.lockConfig=[],this.hideConfig=[],this.invisibleConfig=[],this.coverConfig={},this.commentConfig={},this.trnCtrlConfig={},this.transformConfig={},this.fontCache={},this.cache={},this.zIndex=0,this.zIndexMap=new Map}onParseLine(o){let t=o[0];switch(t){case"DOCTYPE":this.parseDocType(o);break;case"HEAD":this.parseHead(o);break;case"LOCK":this.parseLock(o);break;case"HIDE":this.parseHide(o);break;case"INVISIBLE":this.parseInvisible(o);break;case"COVER":this.parseCover(o);break;case"TRN_CTRL":this.parseTrnCtrl(o);break;case"COMMENT":this.parseComment(o);break;case"FONT_CACHE":this.parseFontCache(o);break;case"TRANSFORM":this.parseTransform(o);break;case"GROUP":{let e=o[1];this.cache[t]||(this.cache[t]={errorIds:[]}),e!==null&&!this.cache[t][e]?this.cache[t][e]=o:this.cache[t].errorIds.push(o);break}case"POLY":case"STRING":case"AUXLINE":case"DIMENSION":{this.zIndexMap.set(o[1],++this.zIndex);let e=UW(o[1]);this.cache[t]||(this.cache[t]={errorIds:[]}),e!==null&&!this.cache[t][e]?this.cache[t][e]=o:this.cache[t].errorIds.push(o);break}default:console.warn("can not find hanlder with",o)}}getZIndex(o){var t;return(t=this.zIndexMap.get(o))!=null?t:null}secondParseLine(o){switch(o[0]){case"GROUP":this.parseGroup(o);break;case"POLY":this.parsePoly(o);break;case"STRING":this.parseString(o);break;case"AUXLINE":this.parseAuxLine(o);break;case"DIMENSION":this.parseDimension(o);break}}onParseEnd(){for(let o in this.cache){let t=this.cache[o],e=Object.keys(t).sort((i,n)=>Number(i)-Number(n)),r=0;for(let i of e){if(i==="errorIds")continue;let n=Number(i),s=n-r-1;s>=1&&this.onPHolder(o,s),r=n,this.secondParseLine(t[n])}t.errorIds.forEach(i=>this.secondParseLine(i))}this.clearCache()}clearCache(){this.lockConfig=[],this.hideConfig=[],this.invisibleConfig=[],this.coverConfig={},this.commentConfig={},this.trnCtrlConfig={},this.transformConfig={},this.fontCache={},this.cache={},this.version=void 0}parseDocType(o){this.version=Number(o[2])}parseHead(o){this.version<2&&o[1]&&o[1].print==="AHead Side"&&(o[1].print="Ahead Side"),this.onCanvas(o[1])}parseGroup(o){this.onGroup(o[1],o[2],o[3],!!o[4],!!o[5])}parseLock(o){this.lockConfig.push(...o[1])}parseHide(o){this.hideConfig.push(...o[1])}parseInvisible(o){this.invisibleConfig.push(...o[1])}parseCover(o){this.coverConfig[o[1]]=o[2]}parseTrnCtrl(o){this.trnCtrlConfig[o[1]]={scope:o[2],trans_print:o[3],trans_white:o[4]}}parseComment(o){this.commentConfig[o[1]]=o[2]}matrix2svg(o){let[t,e,r,i,n,s,a,l,c]=o.data;return[t,e,i,n,a,l]}encPath(o){let t=new Array;return new H6e(e=>(t.push(new W6e(!0).encPl(e).toArray().slice(1)),!0),!0).parse(o),t}parseRect(o){var t,e,r,i,n,s,a,l;let[,c,,h,u,d,p,m,g,,,y,b]=o,P=y[0],T=P[1],I=-P[2],C=P[1]+P[3],E=-P[2]+P[4],O=P[5],_=P[6],x=+P[7],v=+P[8],D=tc.scale(C-T,E-I).rotateD(-x);v&&(D=D.multiply3(tc.MIRROR_X)),D=D.translate(T,I),D=this.matrix2svg(D),D=this.encMatrix(D),this.onPoly(c,0,h,-x,u,d,p,m,g,!0,[["R",0,0,1,1,O,_,0,0]],!0,!0,this.lockConfig.some(w=>w===o[1]),this.hideConfig.some(w=>w===o[1]),this.invisibleConfig.some(w=>w===o[1]),h===1?1:(t=this.coverConfig[o[1]])!=null?t:null,b||((e=this.commentConfig[o[1]])!=null?e:null),h===2?3:(i=(r=this.trnCtrlConfig[o[1]])==null?void 0:r.scope)!=null?i:null,h===2?g:(s=(n=this.trnCtrlConfig[o[1]])==null?void 0:n.trans_print)!=null?s:null,h===2?1-g:(l=(a=this.trnCtrlConfig[o[1]])==null?void 0:a.trans_white)!=null?l:null,D!=null?D:null)}parseObj(o){var t,e,r,i,n,s,a,l;let[,c,,h,u,d,p,m,g,,,y,b]=o,[P,T,I,C,E,O,_,x,v]=y[0],D=tc.rotateD(x);v&&(D=D.multiply3(tc.MIRROR_X));let w;v?w=new bt(new Nt(0,0),new Nt(0,-E)).multiply3(D):w=new bt(new Nt(0,0),new Nt(C,0)).multiply3(D);let F=w.end().angleD(w.start()),H=v===1;C=v===1?E:C,E=v===1?C:E;let z=tc.scale(C,E).rotateD(-F);H&&(z=z.multiply3(tc.MIRROR_X)),z=z.translate(T,-I),z=this.matrix2svg(z),z=this.encMatrix(z),this.onPoly(c,0,h,-F,u,d,p,m,g,!0,[["R",0,0,1,1,0,0,0,0]],!1,!1,this.lockConfig.some(V=>V===o[1]),this.hideConfig.some(V=>V===o[1]),this.invisibleConfig.some(V=>V===o[1]),h===1?1:(t=this.coverConfig[o[1]])!=null?t:null,b||((e=this.commentConfig[o[1]])!=null?e:null),h===2?3:(i=(r=this.trnCtrlConfig[o[1]])==null?void 0:r.scope)!=null?i:null,h===2?g:(s=(n=this.trnCtrlConfig[o[1]])==null?void 0:n.trans_print)!=null?s:null,h===2?1-g:(l=(a=this.trnCtrlConfig[o[1]])==null?void 0:a.trans_white)!=null?l:null,z!=null?z:null)}parseEllipse(o){var t,e,r,i,n,s,a,l;let[,c,,h,u,d,p,m,g,,,y,b]=o,P=y[0],T=P[1],I=-P[2],C=P[3],E=P[4],O=+P[5],_=+P[6],x=tc.scale(C,E).rotateD(-O);_&&(x=x.multiply3(tc.MIRROR_X)),x=x.translate(T,I),x=this.matrix2svg(x),x=this.encMatrix(x),this.onPoly(c,0,h,-O,u,d,p,m,g,!0,[["ELLIPSE",0,0,1,1,0,0]],!0,!0,this.lockConfig.some(v=>v===o[1]),this.hideConfig.some(v=>v===o[1]),this.invisibleConfig.some(v=>v===o[1]),h===1?1:(t=this.coverConfig[o[1]])!=null?t:null,b||((e=this.commentConfig[o[1]])!=null?e:null),h===2?3:(i=(r=this.trnCtrlConfig[o[1]])==null?void 0:r.scope)!=null?i:null,h===2?g:(s=(n=this.trnCtrlConfig[o[1]])==null?void 0:n.trans_print)!=null?s:null,h===2?1-g:(l=(a=this.trnCtrlConfig[o[1]])==null?void 0:a.trans_white)!=null?l:null,x!=null?x:null)}parsePolyGroup(o){var t,e,r,i,n,s,a,l;let[,c,,h,u,d,p,m,g,,,y,b]=o,P=!0,T=!0,I=this.decMultiPoly(y).d;this.onPoly(c,0,h,0,u,d,p,m,g,!0,this.encPath(I),P,T,this.lockConfig.some(C=>C===o[1]),this.hideConfig.some(C=>C===o[1]),this.invisibleConfig.some(C=>C===o[1]),h===1?1:(t=this.coverConfig[o[1]])!=null?t:null,b||((e=this.commentConfig[o[1]])!=null?e:null),h===2?3:(i=(r=this.trnCtrlConfig[o[1]])==null?void 0:r.scope)!=null?i:null,h===2?g:(s=(n=this.trnCtrlConfig[o[1]])==null?void 0:n.trans_print)!=null?s:null,h===2?1-g:(l=(a=this.trnCtrlConfig[o[1]])==null?void 0:a.trans_white)!=null?l:null,null)}parsePoly(o){var t,e,r,i,n,s,a,l,c,h;if(this.version<2)if(o[11].length===1)switch(o[11][0][0]){case"R":{let u=o[7];return u.startsWith("data:")||u.startsWith("blob:")?this.parseObj(o):this.parseRect(o)}case"ELLIPSE":return this.parseEllipse(o);default:return this.parsePolyGroup(o)}else return this.parsePolyGroup(o);else this.onPoly(o[1],o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],o[10],o[11],!!(o[12]||o[12]===void 0),!!(o[13]||o[13]===void 0),this.lockConfig.some(u=>u===o[1]),this.hideConfig.some(u=>u===o[1]),this.invisibleConfig.some(u=>u===o[1]),(t=this.coverConfig[o[1]])!=null?t:null,(e=this.commentConfig[o[1]])!=null?e:null,(i=(r=this.trnCtrlConfig[o[1]])==null?void 0:r.scope)!=null?i:null,(s=(n=this.trnCtrlConfig[o[1]])==null?void 0:n.trans_print)!=null?s:null,(l=(a=this.trnCtrlConfig[o[1]])==null?void 0:a.trans_white)!=null?l:null,(h=(c=this.transformConfig[o[1]])==null?void 0:c.matrix)!=null?h:null)}decMultiPoly(o){let t=new s2,e=o.map(r=>{let i="";return new H6e(n=>(t.ext1(n.bbox()),i=new W6e().encPl(n).toString(),!1),!1).parse("M"+r.join(" ")),i}).join(" ");return{bbox:t.build(),d:e}}encMatrix(o){let[t,e,r,i,n,s]=o,a=new tc([t,e,0,r,i,0,n,s,1]);a=tc.MIRROR_Y.multiply3(a).multiply3(tc.MIRROR_Y);let[l,c,h,u,d,p,m,g,y]=a.data;return[l,u,m,c,d,g]}parseString(o){var t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T;if(this.version<2){let[,I,C,E,O,_,x,v,D,w,F,H,z,V,W,L,k,N,U,B]=o;_=Qm(_);let G=D;v=v===1,z=z===1,V=V===1,W=W===1;let Y=-(L[15]/3|0)+2,X=L%3;U=U||1,B=B||1;let K=this.fontCache[o[1]],{bbox:J,d:se}=this.decMultiPoly(K),ce=J.width(),te=J.height();te=te||0,ce=ce||0;let oe=0;switch(X){case 1:oe=-ce/2;break;case 2:oe=-ce;break}let $=0;switch(Y){case 1:$=te/2;break;case 0:$=te;break}let fe=tc.translate(oe,$).scale(U,B).rotateD(-x);v&&(fe=fe.multiply3(tc.MIRROR_X)),fe=fe.translate(O,_);let Oe=this.matrix2svg(fe),Te=this.encMatrix(Oe);this.onString(I,C,E,x,G,w,F,H,z,V,W,((-Y||0)+2)*3+(X||0),k,N,this.lockConfig.some(ue=>ue===o[1]),this.hideConfig.some(ue=>ue===o[1]),this.invisibleConfig.some(ue=>ue===o[1]),E===1?1:(t=this.coverConfig[o[1]])!=null?t:null,(e=this.commentConfig[o[1]])!=null?e:null,E===2?3:(i=(r=this.trnCtrlConfig[o[1]])==null?void 0:r.scope)!=null?i:null,E===2?N:(s=(n=this.trnCtrlConfig[o[1]])==null?void 0:n.trans_print)!=null?s:null,E===2?1-N:(l=(a=this.trnCtrlConfig[o[1]])==null?void 0:a.trans_white)!=null?l:null,Te,!!Te,this.encPath(se))}else this.onString(o[1],o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9]===1,o[10]===1,o[11]===1,o[12],o[13],o[14],this.lockConfig.some(I=>I===o[1]),this.hideConfig.some(I=>I===o[1]),this.invisibleConfig.some(I=>I===o[1]),(c=this.coverConfig[o[1]])!=null?c:null,(h=this.commentConfig[o[1]])!=null?h:null,(d=(u=this.trnCtrlConfig[o[1]])==null?void 0:u.scope)!=null?d:null,(m=(p=this.trnCtrlConfig[o[1]])==null?void 0:p.trans_print)!=null?m:null,(y=(g=this.trnCtrlConfig[o[1]])==null?void 0:g.trans_white)!=null?y:null,(P=(b=this.transformConfig[o[1]])==null?void 0:b.matrix)!=null?P:null,!!((T=this.transformConfig[o[1]])!=null&&T.matrix),this.fontCache[o[1]])}parseFontCache(o){this.fontCache[o[1]]=o[2]}parseDimension(o){var t,e,r,i,n,s,a,l,c,h,u,d;this.onDimension(o[1],o[2],o[3],(t=o[4])!=null?t:null,o[5],o[6],o[7],o[8],this.lockConfig.some(p=>p===o[1]),this.hideConfig.some(p=>p===o[1]),this.invisibleConfig.some(p=>p===o[1]),(e=this.coverConfig[o[1]])!=null?e:null,(r=this.commentConfig[o[1]])!=null?r:null,(n=(i=this.trnCtrlConfig[o[1]])==null?void 0:i.scope)!=null?n:null,(a=(s=this.trnCtrlConfig[o[1]])==null?void 0:s.trans_print)!=null?a:null,(c=(l=this.trnCtrlConfig[o[1]])==null?void 0:l.trans_white)!=null?c:null,(u=(h=this.transformConfig[o[1]])==null?void 0:h.matrix)!=null?u:null,!!((d=this.transformConfig[o[1]])!=null&&d.matrix))}parseTransform(o){this.transformConfig[o[1]]={matrix:o[2],strokes:!!o[3]}}parseAuxLine(o){var t,e,r,i,n,s,a,l,c,h,u;this.onAuxLine(o[1],o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],o[10],this.lockConfig.some(d=>d===o[1]),this.hideConfig.some(d=>d===o[1]),this.invisibleConfig.some(d=>d===o[1]),(t=this.coverConfig[o[1]])!=null?t:null,(e=this.commentConfig[o[1]])!=null?e:null,(i=(r=this.trnCtrlConfig[o[1]])==null?void 0:r.scope)!=null?i:null,(s=(n=this.trnCtrlConfig[o[1]])==null?void 0:n.trans_print)!=null?s:null,(l=(a=this.trnCtrlConfig[o[1]])==null?void 0:a.trans_white)!=null?l:null,(h=(c=this.transformConfig[o[1]])==null?void 0:c.matrix)!=null?h:null,!!((u=this.transformConfig[o[1]])!=null&&u.matrix))}},P2t=class extends VPe{constructor(o={},t=[]){super(),this.symbolPartIds=o,this.device=t,this.defaultPartId="pid8a0e77bacb214e",this.curPart="",this.onlyPart="",this.partIdMap={},this.fontStyleIndex={},this.lineStyleIndex={},this.groupIndex={},this.zIndex=0,this.zIndexMap=new Map,this.cache={},this.errorIds={},this.tableCell={},this.hasPart=!1,this.components={},this.busEntryMap={},this.defaultLineStyle={strokeColor:null,strokeStyle:null,fillColor:null,strokeWidth:null,fillStyle:null},this.defaultFontStyle={color:null,fillColor:null,fontFamily:null,fontSize:null,strikeout:null,underline:null,italic:null,fontWeight:null,hAlign:null,vAlign:null}}getZIndex(o){var t;return(t=this.zIndexMap.get(o))!=null?t:null}transPinAttrKey(o){switch(o){case"NUMBER":{o="Pin Number";break}case"NAME":{o="Pin Name";break}}return o}transFontStyle(o){return{color:o.color,fillColor:o.fillColor,fontFamily:o.fontFamily,fontSize:o.fontSize,strikeout:o.strikeout,underline:o.underline,italic:o.italic,fontWeight:o.fontWeight,align:this.transAlign(o.vAlign,o.hAlign)}}transTableFontStyle(o){return{color:o.color,fillColor:o.fillColor,fontFamily:o.fontFamily,fontSize:o.fontSize,strikeout:o.strikeout,underline:o.underline,italic:o.italic,fontWeight:o.fontWeight,vAlign:this.transVAlign(o.vAlign),hAlign:this.transHAlign(o.hAlign)}}transVAlign(o){switch(o=o&&Number(o),o){case 0:return"TOP";case 1:return"MIDDLE";case 2:return"BOTTOM";default:return null}}transHAlign(o){switch(o=o&&Number(o),o){case 0:return"LEFT";case 1:return"CENTER";case 2:return"RIGHT";default:return null}}transAlign(o,t){if(o=o&&Number(o),t=t&&Number(t),t===0)switch(o){case 0:return"LEFT_TOP";case 1:return"LEFT_MIDDLE";case 2:return"LEFT_BOTTOM";default:return"LEFT_BOTTOM"}if(t===1)switch(o){case 0:return"CENTER_TOP";case 1:return"CENTER_MIDDLE";case 2:return"CENTER_BOTTOM";default:return"CENTER_BOTTOM"}if(t===2)switch(o){case 0:return"RIGHT_TOP";case 1:return"RIGHT_MIDDLE";case 2:return"RIGHT_BOTTOM";default:return"RIGHT_BOTTOM"}switch(o){case 0:return"LEFT_TOP";case 1:return"LEFT_MIDDLE";case 2:return"LEFT_BOTTOM";default:return null}}transStrokeStyle(o){switch(o=o&&Number(o),o){case 0:return"SOLID";case 1:return"SHORT_DASH";case 2:return"DOT";case 3:return"DOT_DASH";default:return null}}transFillStyle(o){switch(o=o&&Number(o),o){case 0:return"NONE";case 1:return"SOLID";case 2:return"GRID";case 3:return"HORIZONTAL_LINE";case 4:return"VERTICAL_LINE";case 5:return"RHOMBIC";case 6:return"LEFT_SLASH_LINE";case 7:return"RIGHT_SLASH_LINE";default:return null}}transPinShape(o){switch(o=o&&Number(o),o){case 0:return"NONE";case 1:return"CLOCK";case 2:return"INVERTED";case 3:return"INVERTED_CLOCK";default:return"NONE"}}onParseLine(o){var t,e;let r=o[0];switch(r){case"DOCTYPE":this.parseDocType(o);break;case"HEAD":this.parseHead(o);break;case"GROUP":this.parseGroup(o);break;case"FONTSTYLE":this.parseFontStyle(o);break;case"LINESTYLE":this.parseLineStyle(o);break;case"TERM":break;case"PART":this.hasPart=!0,this.parsePart(o);break;case"TABEL_CELL":this.parseTableCell(o);break;case"BUSENTRY":{this.parseBusEntry(o);break}case"WIRE":case"BUS":case"TEXT":case"POLY":case"CIRCLE":case"ARC":case"RECT":case"PIN":case"OBJ":case"COMPONENT":case"ELLIPSE":case"BEZIER":case"TABLE":{this.zIndexMap.set(o[1],++this.zIndex);let i=UW(o[1]);this.cache[r]||(this.cache[r]={}),i!==null&&!this.cache[r][i]?this.cache[r][i]={part:this.curPart,value:o}:(this.errorIds[r]||(this.errorIds[r]=[]),this.errorIds[r].push({part:this.curPart,value:o}));break}case"ATTR":{this.zIndexMap.set(o[1],++this.zIndex),o[3]==="Symbol"&&(this.components[o[2]]||(this.components[o[2]]={symbol:"",device:""}),this.components[o[2]].symbol=o[4]),o[3]==="Device"&&(this.components[o[3]]||(this.components[o[3]]={symbol:"",device:""}),this.components[o[3]].device=o[4]);let i=Object.keys(((t=this.cache)==null?void 0:t.COMPONENT)||{}).find(a=>this.cache.COMPONENT[a].value[1]===o[2]);if(i){let a=this.cache.COMPONENT[i];a.attr||(a.attr=[]),a.attr.push({part:this.curPart,value:o});break}let n=Object.keys(((e=this.cache)==null?void 0:e.PIN)||{}).find(a=>this.cache.PIN[a].value[1]===o[2]);if(n){let a=this.cache.PIN[n];a.attr||(a.attr=[]),a.attr.push({part:this.curPart,value:o});break}let s=UW(o[1]);this.cache[r]||(this.cache[r]={}),s!==null&&!(this.cache[r][s]&&this.cache[r][s].value[1]!==o[1])?this.cache[r][s]||(this.cache[r][s]={part:this.curPart,value:o}):(this.errorIds[r]||(this.errorIds[r]=[]),this.errorIds[r].push({part:this.curPart,value:o}));break}default:console.warn("can not find hanlder with",o)}}secondParseLine(o){switch(o[0]){case"DOCTYPE":case"HEAD":case"GROUP":case"FONTSTYLE":case"LINESTYLE":break;case"ATTR":this.parseAttr(o);break;case"WIRE":this.parseWire(o);break;case"BUS":this.parseBus(o);break;case"TEXT":this.parseText(o);break;case"POLY":this.parsePoly(o);break;case"CIRCLE":this.parseCircle(o);break;case"ARC":this.parseArc(o);break;case"BUSENTRY":break;case"RECT":this.parseRect(o);break;case"PIN":this.parsePin(o);break;case"OBJ":this.parseObj(o);break;case"COMPONENT":this.parseComponent(o);break;case"ELLIPSE":this.parseEllipse(o);break;case"BEZIER":this.parseBezier(o);break;case"TABLE":this.parseTable(o);break;case"TABEL_CELL":break}}onParseEnd(){this.docType==="SYMBOL"&&!this.hasPart&&(this.curPart=this.defaultPartId,this.onlyPart=this.curPart,this.partIdMap[""]=this.curPart,this.onPart(this.curPart,{title:""}));for(let o in this.cache){let t=this.cache[o],e=Object.keys(t).sort((i,n)=>Number(i)-Number(n)),r=0;for(let i of e){let n=Number(i),s=n-r-1;s>=1&&this.onPHolder(o,s),r=n,this.curPart=this.hasPart?t[n].part||this.onlyPart:this.curPart,this.secondParseLine(t[n].value),t[n].attr&&t[n].attr.forEach(a=>{this.curPart=this.hasPart?a.part||this.onlyPart:this.curPart,this.secondParseLine(a.value)})}if(this.errorIds[o])for(let i of this.errorIds[o])this.curPart=this.hasPart?i.part||this.onlyPart:this.curPart,this.secondParseLine(i.value)}this.clearCache()}clearCache(){this.fontStyleIndex={},this.lineStyleIndex={},this.groupIndex={},this.cache={},this.errorIds={},this.curPart="",this.components={},this.tableCell={},this.hasPart=!1,this.version=void 0,this.docType=void 0}parseDocType(o){this.docType=o[1];let t=parseFloat(o[2]);this.version=t}parseHead(o){this.onCanvas(o[1])}parseFontStyle(o){this.fontStyleIndex[o[1]]={color:o[3]===""?"none":o[3],fillColor:o[2],fontFamily:o[4],fontSize:typeof o[5]=="number"?o[5]:null,strikeout:o[9]===null?null:o[9]===1,underline:o[8]===null?null:o[8]===1,italic:o[6]===null?null:o[6]===1,fontWeight:o[7]===null?null:o[7]===1,vAlign:o[10],hAlign:o[11]}}parseLineStyle(o){this.lineStyleIndex[o[1]]={strokeColor:o[2],strokeStyle:this.transStrokeStyle(o[3]),fillColor:o[4]===""?"none":o[4],strokeWidth:o[5],fillStyle:this.transFillStyle(o[6])}}getGroupId(o){let t=this;for(let e in t.groupIndex){let r=t.groupIndex[e];if(r!=null&&r.includes(o))return e}return""}parseBezier(o){let t=this.lineStyleIndex[o[3]];t||(t=this.defaultLineStyle,console.warn("style not found",o));let e=this.getGroupId(o[1]);for(let r=0;r<o[2].length;r+=2)o[2][r+1]=Qm(o[2][r+1]);this.onBezier(o[1],this.curPart,e,!!o[4],o[2],t.strokeColor,t.strokeStyle,t.fillColor,t.strokeWidth,t.fillStyle)}parseGroup(o){this.groupIndex[o[1]]=o[4]||[],this.onGroup(o[1],o[2]||"",o[3]||"")}parseBus(o){let t=this.lineStyleIndex[o[3]];t||(t=this.defaultLineStyle,console.warn("style not found",o));let e=o[2]||[],r=this.getGroupId(o[1]);this.onBus(o[1],this.curPart,r,!!o[4],e,t.strokeColor,t.strokeStyle,t.fillColor,t.strokeWidth,t.fillStyle,this.busEntryMap[o[1]]||{})}parseWire(o){let t=this.lineStyleIndex[o[3]];t||(t=this.defaultLineStyle,console.warn("style not found",o));let e=o[2]||[],r=this.getGroupId(o[1]);this.onWire(o[1],this.curPart,r,!!o[4],e,t.strokeColor,t.strokeStyle,t.fillColor,t.strokeWidth,t.fillStyle)}parseText(o){let t=this.fontStyleIndex[o[6]];t||(t=this.defaultFontStyle,console.warn("font not found",o));let e=this.transFontStyle(t),r=this.getGroupId(o[1]);this.onText(o[1],this.curPart,r,!!o[7],o[2],o[3],o[4],o[5],e.color,e.fillColor,e.fontFamily,e.fontSize,e.strikeout,e.underline,e.italic,e.fontWeight,e.align)}parsePoly(o){let t=this.lineStyleIndex[o[4]];t||(t=this.defaultLineStyle,console.warn("style not found",o));let e=this.getGroupId(o[1]);this.onPoly(o[1],this.curPart,e,!!o[5],o[2]||[],!!o[3],t.strokeColor,t.strokeStyle,t.fillColor,t.strokeWidth,t.fillStyle)}parseCircle(o){let t=this.lineStyleIndex[o[5]];t||(t=this.defaultLineStyle,console.warn("style not found",o));let e=this.getGroupId(o[1]);this.onCircle(o[1],this.curPart,e,!!o[6],o[2],o[3],o[4],t.strokeColor,t.strokeStyle,t.fillColor,t.strokeWidth,t.fillStyle)}parseArc(o){let t=this.lineStyleIndex[o[8]];t||(t=this.defaultLineStyle,console.warn("style not found",o));let e=this.getGroupId(o[1]);this.onArc(o[1],this.curPart,e,!!o[9],o[2],o[3],o[4],o[5],o[6],o[7],t.strokeColor,t.strokeStyle,t.fillColor,t.strokeWidth,t.fillStyle)}parseBusEntry(o){let t=o[2],e={groupId:this.getGroupId(o[1]),locked:!1,zIndex:++this.zIndex,order:o[3],pointX:o[4],pointY:Qm(o[5]),rotation:o[6]};this.busEntryMap[t]||(this.busEntryMap[t]={}),this.busEntryMap[t][o[1]]=e}parseRect(o){let t=this.lineStyleIndex[o[9]];t||(t=this.defaultLineStyle,console.warn("style not found",o));let e=this.getGroupId(o[1]);this.onRect(o[1],this.curPart,e,!!o[10],o[2],o[3],o[4],o[5],o[6],o[7],o[8],t.strokeColor,t.strokeStyle,t.fillColor,t.strokeWidth,t.fillStyle)}parsePin(o){let t=this.getGroupId(o[1]);this.onPin(o[1],this.curPart,t,!!o[10],!!o[2],o[3],o[4],o[5],o[6],o[7],o[8],this.transPinShape(o[9]))}parseObj(o){let t=this.getGroupId(o[1]);this.version>=1.1?this.onObj(o[1],this.curPart,t,!!o[10],o[2],o[3],o[4],o[5],o[6],o[7],!!o[8],o[9]):this.onObj(o[1],this.curPart,t,!!o[10],o[2],o[4],o[5],o[6],o[7],o[8],!1,`data:${o[3]},${o[9]}`)}parseComponent(o){var t,e,r;let i=this.getGroupId(o[1]),n=o[2],s=this.components[o[1]];if(s){if(s.symbol){let a=this.symbolPartIds[s.symbol];a&&(n=a[o[2]]||o[2]||a[(t=Object.keys(a))==null?void 0:t[0]]||"")}else if(s.device){let a=this.device.find(c=>c.uuid===s.device),l=a?this.symbolPartIds[(e=a==null?void 0:a.attributes)==null?void 0:e.Symbol]:null;l&&(n=l[o[2]]||o[2]||l[(r=Object.keys(l))==null?void 0:r[0]]||"")}}this.onComponent(o[1],!!o[8],n,i,o[3],o[4],o[5],o[6]===1,o[7])}parseEllipse(o){let t=this.lineStyleIndex[o[7]];t||(t=this.defaultLineStyle,console.warn("style not found",o));let e=this.getGroupId(o[1]);this.onEllipse(o[1],this.curPart,e,!!o[8],o[2],o[3],o[4],o[5],o[6],t.strokeColor,t.strokeStyle,t.fillColor,t.strokeWidth,t.fillStyle)}parseTable(o){let t=this.getGroupId(o[1]);this.onTable(o[1],this.curPart,t,o[2],o[3],o[4],o[5],o[6],o[7],o[8],this.tableCell[o[1]]||[])}parseTableCell(o){let t=this.lineStyleIndex[o[8]],e=this.lineStyleIndex[o[9]],r=this.lineStyleIndex[o[10]],i=this.lineStyleIndex[o[11]],n=this.fontStyleIndex[o[12]],s=Object.assign({},n);s.color=n.fillColor,s.fillColor=n.color,(!t||!e||!r||!i||!s)&&console.warn("style not found",o);let a={id:o[1],value:o[3],rowIndex:o[4],columnIndex:o[5],rowSpan:o[6],colSpan:o[7],topStyle:t||this.defaultLineStyle,rightStyle:e||this.defaultLineStyle,bottomStyle:r||this.defaultLineStyle,leftStyle:i||this.defaultLineStyle,fontStyle:this.transTableFontStyle(s||this.defaultFontStyle),lineHeight:o[13],zIndex:++this.zIndex};this.tableCell[o[2]]||(this.tableCell[o[2]]=[]),this.tableCell[o[2]].push(a)}parseAttr(o){let t=this.fontStyleIndex[o[10]];t||(t=this.defaultFontStyle,console.warn("fontStyle not found",o));let e=this.transFontStyle(t),r=this.getGroupId(o[1]);this.onAttr(o[1],this.curPart,r,!!o[11],o[2]||"",this.transPinAttrKey(String(o[3])),o[4],o[5]===null?null:!!o[5],o[6]===null?null:!!o[6],o[7]!==null?o[7]:null,o[8]!==null?o[8]:null,o[9],e.color,e.fillColor,e.fontFamily,e.fontSize,e.strikeout,e.underline,e.italic,e.fontWeight,e.align)}parsePart(o){this.curPart=o[1]||this.defaultPartId,this.onlyPart=this.curPart,this.partIdMap[o[1]]=this.curPart;let t=Object.assign(o[2]||{},{title:o[1]||""});this.onPart(this.curPart,t)}},T2t=class{constructor(){}encodeCanvas(o){return{id:"CANVAS",dataType:"CANVAS",data:JSON.stringify(o)}}encodeGroup(o,t){return{id:o,dataType:"GROUP",data:JSON.stringify(t)}}encodeAuxLine(o,t){return{id:o,dataType:"AUXLINE",data:JSON.stringify(t)}}encodeDimension(o,t){return{id:o,dataType:"DIMENSION",data:JSON.stringify(t)}}encodeString(o,t){return{id:o,dataType:"STRING",data:JSON.stringify(t)}}encodePoly(o,t){return{id:o,dataType:"POLY",data:JSON.stringify(t)}}},K5e=class{constructor(){}editHead(o,t){let e={uuid:o.uuid,nickname:o.nickname,username:o.username,updateTime:t};return`${JSON.stringify({type:"EDIT_HEAD"})}||${JSON.stringify(e)}`}head(o){return sL(this.doctype,o.client,o.doc,o.updateTime,o.version||String(o.updateTime),o.user,o.ticket)}creator(o,t){let e=typeof t=="string"?t:JSON.stringify(t);return lb("META_CREATE",o,"META_CREATE",e)}modifier(o,t){let e=typeof t=="string"?t:JSON.stringify(t);return lb("META_MODIFY",o,"META_MODIFY",e)}delete(o,t){let e=t||JSON.stringify({isDelete:!0});return lb("DELETE_DOC",o,"DELETE_DOC",e)}},XPe=class extends K5e{constructor(){super(...arguments),this.doctype="BLOB"}buildStr(o,t,e){let r=typeof e=="string"?e:JSON.stringify(this.buildData(e));return lb("BLOB",o,t,r)}buildData(o){return{filename:o.filename,content:o.content}}};var Z5e=class{constructor(){}encodeString(o,t){return{id:o,dataType:"STRING",data:JSON.stringify(t)}}encodeAttr(o,t){return{id:o,dataType:"ATTR",data:JSON.stringify(t)}}encodePanelize(o){return{id:"PANELIZE",dataType:"PANELIZE",data:JSON.stringify(o)}}encodeRuleSelector(o){let t=JSON.stringify(["RULE_SELECTOR",o.ruleSelect]),e={...o};return delete e.ruleSelect,{id:t,dataType:"RULE_SELECTOR",data:JSON.stringify(e)}}encodeRule(o){let t=JSON.stringify(["RULE",o.ruleType,o.ruleName]),e={...o};return delete e.ruleType,delete e.ruleName,{id:t,dataType:"RULE",data:JSON.stringify(e)}}encodeRuleTemplate(o){return{id:"RULE_TEMPLATE",dataType:"RULE_TEMPLATE",data:JSON.stringify(o)}}encodeDimension(o,t){return{id:o,dataType:"DIMENSION",data:JSON.stringify(t)}}encodeBoss(o,t){return{id:o,dataType:"BOSS",data:JSON.stringify(t)}}encodeShellEntity(o,t){return{id:o,dataType:"SHELL_ENTITY",data:JSON.stringify(t)}}encodeShellCut(o,t){return{id:o,dataType:"SHELLCUT",data:JSON.stringify(t)}}encodeCrease(o,t){return{id:o,dataType:"CREASE",data:JSON.stringify(t)}}encodeShell(o,t){return{id:o,dataType:"SHELL",data:JSON.stringify(t)}}encodeFpcFill(o,t){return{id:o,dataType:"FPC_FILL",data:JSON.stringify(t)}}encodeTeardrop(o,t){return{id:o,dataType:"TEARDROP",data:JSON.stringify(t)}}encodeImage(o,t){return{id:o,dataType:"IMAGE",data:JSON.stringify(t)}}encodePoured(o,t){return{id:ab(o,"POURED"),dataType:"POURED",data:JSON.stringify(t)}}encodePour(o,t){return{id:o,dataType:"POUR",data:JSON.stringify(t)}}encodeRegion(o,t){return{id:o,dataType:"REGION",data:JSON.stringify(t)}}encodeFill(o,t){return{id:o,dataType:"FILL",data:JSON.stringify(t)}}encodeLayerFill(o,t){return{id:ab(o,"LAYER_FILL"),dataType:"LAYER_FILL",data:JSON.stringify(t)}}encodePoly(o,t){return{id:o,dataType:"POLY",data:JSON.stringify(t)}}encodeEQLenGrp(o,t){return{id:o,dataType:"EQLEN_GRP",data:JSON.stringify(t)}}encodeObj(o,t){return{id:o,dataType:"OBJ",data:JSON.stringify(t)}}encodeArc(o,t){return{id:o,dataType:"ARC",data:JSON.stringify(t)}}encodeLine(o,t){return{id:o,dataType:"LINE",data:JSON.stringify(t)}}encodePad(o,t){return{id:o,dataType:"PAD",data:JSON.stringify(t)}}encodeVia(o,t){return{id:o,dataType:"VIA",data:JSON.stringify(t)}}encodePreference(o){return{id:"PREFERENCE",dataType:"PREFERENCE",data:JSON.stringify(o)}}encodeSilkOpts(o,t){return{id:ab(o,"SILK_OPTS"),dataType:"SILK_OPTS",data:JSON.stringify(t)}}encodeGroup(o,t){return{id:o,dataType:"GROUP",data:JSON.stringify(t)}}encodePrimitive(o,t){return{id:ab(o,"PRIMITIVE"),dataType:"PRIMITIVE",data:JSON.stringify(t)}}encodeNet(o,t){return{id:ab(o,"NET"),dataType:"NET",data:JSON.stringify(t)}}encodeActiveLayer(o){return{id:"ACTIVE_LAYER",dataType:"ACTIVE_LAYER",data:JSON.stringify(o)}}encodeLayerPhys(o,t){return{id:ab(o,"LAYER_PHYS"),dataType:"LAYER_PHYS",data:JSON.stringify(t)}}encodeLayer(o,t){return{id:ab(o,"LAYER"),dataType:"LAYER",data:JSON.stringify(t)}}encodeCanvas(o){return{id:"CANVAS",dataType:"CANVAS",data:JSON.stringify(o)}}},I2t=class extends Jgt{constructor(o=!1){super(void 0,void 0,void 0,void 0,o),this.encode=new Z5e,this.maxTicket=0,this.blobEncode=new XPe,this.blobData=[],this.encodeData="",this.placeholder=0}handleData(o){this.encodeData?this.encodeData=this.encodeData+`|
`+lb(o.dataType,++this.maxTicket,o.id,o.data):this.encodeData=lb(o.dataType,++this.maxTicket,o.id,o.data)}getZIndex(o){let t=o.match(FPe);return t!=null&&t.length?t[1]:null}onPHolder(o,t){let e={dataType:o,max:t};this.handleData({id:`placeholder${++this.placeholder}`,dataType:"ELE_PLACEHOLDER",data:JSON.stringify(e)})}onLayerFill(o,t){this.handleData(this.encode.encodeLayerFill(o,t))}onString(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P){let T=this.getZIndex(o);this.handleData(this.encode.encodeString(Al(o),{groupId:e,layerId:r,x:i,y:n,text:s,fontFamily:a,fontSize:l,strokeWidth:c,bold:h,italic:u,origin:d,angle:p,reverse:m,expansion:g,mirror:y,locked:b,zIndex:T===null?null:Number(T),specialColor:P}))}onAttr(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O){let _=this.getZIndex(o);_&&E&&(_=_+"."+String(E)),this.handleData(this.encode.encodeAttr(Al(o),{groupId:e,parentId:r,layerId:i,x:n,y:s,key:a,value:l,keyVisible:c,valueVisible:h,fontFamily:u,fontSize:d,strokeWidth:p,bold:m,italic:g,origin:y,angle:b,reverse:P,expansion:T,mirror:I,locked:C,zIndex:_===null?null:Number(_),specialColor:O}))}onPadNet(o,t,e,r,i){}onComponent(o,t,e,r,i,n,s,a,l){}onPanelize(o,t,e,r,i,n,s,a,l,c){this.handleData(this.encode.encodePanelize({on:o,row:t,column:e,rowSpacing:r,columnSpacing:i,onlyOutline:n,horizontalStamp:s,verticalStamp:a,horizontalSize:l,verticalSize:c}))}onRuleSelector(o,t,e,r,i){this.handleData(this.encode.encodeRuleSelector({ruleSelect:o,ruleOrder:t,ruleKeyValue:e,copperValue:r,innerPlaneValue:i}))}onRule(o,t,e,r){this.handleData(this.encode.encodeRule({ruleType:o,ruleName:t,ruleState:e,ruleContext:r}))}onRuleTemplate(o){this.handleData(this.encode.encodeRuleTemplate({name:o}))}onDimension(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeDimension(Al(o),{type:e,layerId:r,unit:i,strokeWidth:n,precision:s,textFollow:a,coords:l,locked:c,zIndex:p===null?null:Number(p),text:h,specialColor:u,groupId:d}))}onBoss(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeBoss(Al(o),{groupId:e,layerId:r,centerX:i,centerY:n,specification:s,depth:a,thickness:l,holeDiameter:c,counterBore:h?{height:h[0],diameter:h[1]}:null,stiffener:u?{topWidth:u[0],bottomWidth:u[1],height:u[2],stiffThickness:u[3]}:null,locked:d,zIndex:p===null?null:Number(p)}))}onShellEntity(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.getZIndex(o),p={groupId:e,layerId:r,type:i?"ENTITY":"SLOT",depth:a,strokeWidth:l,path:c,locked:h,zIndex:d===null?null:Number(d),refs:u};p.type==="ENTITY"&&(p.entityBelong=n),p.type==="SLOT"&&(p.slotOptions=s),this.handleData(this.encode.encodeShellEntity(Al(o),p))}onShellCut(o,t,e,r,i,n,s,a,l){let c=this.getZIndex(o);this.handleData(this.encode.encodeShellCut(Al(o),{groupId:e,layerId:r,depth:i,strokeWidth:n,path:s,locked:a,zIndex:c===null?null:Number(c),refs:l}))}onCrease(o,t,e,r,i,n,s,a,l,c){let h=this.getZIndex(o);this.handleData(this.encode.encodeCrease(Al(o),{groupId:e,layerId:r,startX:i,startY:n,endX:s,endY:a,angle:l,locked:c,zIndex:h===null?null:Number(h)}))}onShell(o,t,e,r,i,n,s,a,l,c){let h=this.getZIndex(o),u={groupId:e,shellType:r,shellHeight:i,pcbHeight:n,strokeWidth:s,path:a,thickness:l.Thickness,locked:c,zIndex:h===null?null:Number(h)};r==="DRAWER"&&(u.direction=l.Direction),r==="T&B"&&(u.bottomHeight=l.BottomHeight,u.topInnerHeight=l.TopInnerHeight,u.bottomInnerHeight=l.BottomInnerHeight),this.handleData(this.encode.encodeShell(Al(o),u))}onFpcFill(o,t,e,r,i,n,s,a){let l=this.getZIndex(o);this.handleData(this.encode.encodeFpcFill(Al(o),{groupId:e,layerId:r,material:i,thickness:n,path:s,locked:a,zIndex:l===null?null:Number(l)}))}onTeardrop(o,t,e,r,i,n,s){this.handleData(this.encode.encodeTeardrop(Al(o),{netName:e,layerId:r,path:i,groupId:n,refs:s,locked:!1}))}onImage(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeImage(Al(o),{groupId:e,layerId:r,startX:i,startY:n,width:s,height:a,angle:l,mirror:c,path:h,locked:u,zIndex:p===null?null:Number(p),specialColor:d}))}onPoured(o,t){this.handleData(this.encode.encodePoured(Al(o),t))}onPour(o,t,e,r,i,n,s,a,l,c,h,u){let d=this.getZIndex(o);this.handleData(this.encode.encodePour(Al(o),{groupId:e,netName:r,layerId:i,width:n,name:s,order:a,path:l,pourType:c,keepIsland:h,locked:u,zIndex:d===null?null:Number(d)}))}onRegion(o,t,e,r,i,n,s,a,l,c){let h=this.getZIndex(o);this.handleData(this.encode.encodeRegion(Al(o),{groupId:e,layerId:r,width:i,prohibitType:n,path:s,locked:a,zIndex:h===null?null:Number(h),name:l,regionType:c}))}onFill(o,t,e,r,i,n,s,a,l,c,h){let u=this.getZIndex(o);this.handleData(this.encode.encodeFill(Al(o),{groupId:e,netName:r,layerId:i,width:n,fillStyle:s,path:a,locked:l,zIndex:u===null?null:Number(u),isBridgingCopper:!1,networkList:[],refs:c,specialColor:h}))}onPoly(o,t,e,r,i,n,s,a,l){let c=this.getZIndex(o);this.handleData(this.encode.encodePoly(Al(o),{groupId:e,netName:r,layerId:i,width:n,path:s,locked:a,zIndex:c===null?null:Number(c),specialColor:l,polyType:i==11?"BOARD_OUTLINE":"NORMAL"}))}onEQLenGrp(o,t,e,r){this.handleData(this.encode.encodeEQLenGrp(Al(o),{name:t,sort:e,pads:r}))}onObj(o,t,e,r,i,n,s,a,l,c,h,u,d,p){if(u.startsWith("data:")){let g=iee(u);this.blobData.push(this.blobEncode.buildStr(1,g,{filename:i,content:u})),u=`blob:${g}`}let m=this.getZIndex(o);this.handleData(this.encode.encodeObj(Al(o),{groupId:e,layerId:r,fileName:i,startX:n,startY:s,width:a,height:l,angle:c,mirror:h,path:u,locked:d,zIndex:m===null?null:Number(m),specialColor:p}))}onArc(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeArc(Al(o),{groupId:e,netName:r,layerId:i,startX:n,startY:s,endX:a,endY:l,angle:c,width:h,locked:u,zIndex:p===null?null:Number(p),arcType:"DOT",specialColor:d}))}onCArc(o,t,e,r,i,n,s,a,l,c,h,u,d){let p=this.getZIndex(o);this.handleData(this.encode.encodeArc(Al(o),{groupId:e,netName:r,layerId:i,startX:n,startY:s,endX:a,endY:l,angle:c,width:h,locked:u,zIndex:p===null?null:Number(p),arcType:"CENT",specialColor:d}))}onLine(o,t,e,r,i,n,s,a,l,c,h){let u=this.getZIndex(o);this.handleData(this.encode.encodeLine(Al(o),{groupId:e,netName:r,layerId:i,startX:n,startY:s,endX:a,endY:l,width:c,locked:h,zIndex:u===null?null:Number(u)}))}onPad(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,x,v){let D=this.getZIndex(o);this.handleData(this.encode.encodePad(Al(o),{groupId:e,netName:r,layerId:i,num:n,centerX:s,centerY:a,padAngle:l,hole:c,defaultPad:h,specialPad:u,padOffsetX:d,padOffsetY:p,relativeAngle:m,plated:g,padType:y,topSolderExpansion:b,bottomSolderExpansion:P,topPasteExpansion:T,bottomPasteExpansion:I,locked:C,zIndex:D===null?null:Number(D),connectMode:E,spokeSpace:O,spokeWidth:_,spokeAngle:x,unusedInnerLayers:v,padLen:0}))}onVia(o,t,e,r,i,n,s,a,l,c,h,u,d,p){let m=this.getZIndex(o);this.handleData(this.encode.encodeVia(Al(o),{groupId:e,netName:r,ruleName:i,centerX:n,centerY:s,holeDiameter:a,viaDiameter:l,viaType:c,topSolderExpansion:h,bottomSolderExpansion:u,locked:d,zIndex:m===null?null:Number(m),unusedInnerLayers:p}))}onPreference(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T){this.handleData(this.encode.encodePreference({startTrackWidthFollowLast:o,lastTrackWidth:t,startViaSizeFollowLast:e,lastViaInnerDiameter:r,lastViaDiameter:i,snap:n,routingMode:s,routingCorner:a,removeLoop:l,rotatingObject:c,trackFollow:h,stretchTrackMinCorner:u,preferenceConfig:d,realTimeUpdateUnusedLayers:p,unusedPadRange:m,pushVia:g,pathOptimization4BePushed:y,currentPathOptimization4BePushed:b,removeCircuitsContainingVias:P,removeAntenna:T}))}onSilkOpts(o,t,e){this.handleData(this.encode.encodeSilkOpts(o,{defaultColor:t,baseColor:e}))}onGroup(o,t){this.handleData(this.encode.encodeGroup(o,{groupName:t}))}onPrimitive(o,t,e){this.handleData(this.encode.encodePrimitive(o,{display:t,pick:e}))}onNet(o,t,e,r,i,n,s){this.handleData(this.encode.encodeNet(o,{netType:t,specialColor:e,retLine:r,differentialName:i,isPositiveNet:n,equalLengthGroupName:s}))}onPartition(o,t,e,r){}onActiveLayer(o){this.handleData(this.encode.encodeActiveLayer({layerId:o}))}onLayerPhys(o,t,e,r,i,n,s){this.handleData(this.encode.encodeLayerPhys(o,{material:t,thickness:e,permittivity:r,lossTangent:i,isKeepIsland:n,zIndex:s}))}onLayer(o,t,e,r,i,n,s,a,l,c){this.handleData(this.encode.encodeLayer(o,{layerType:t,layerName:e,use:r,show:i,locked:n,activeColor:s,activateTransparency:a,inactiveColor:l,inactiveTransparency:c}))}onCanvas(o,t,e,r,i,n,s,a,l,c,h,u){this.handleData(this.encode.encodeCanvas({originX:o,originY:t,unit:e,gridXSize:r,gridYSize:i,snapXSize:n,snapYSize:s,altSnapXSize:a,altSnapYSize:l,gridType:c,multiGridType:h,multiGridRatio:u,highlightValue:.5}))}};function C2t(o,t,e,r=new Date().getTime(),i=String(r),n){let s=new I2t(e),a="",l=KT();if(a=sL("FOOTPRINT",l,o,r,i,n),s.parseFull(t),s.encodeData&&(a=a+`|
`+s.encodeData),s.blobData.length&&(a=a+`|
`+s.blobEncode.head({doc:"BLOB",client:l,updateTime:r,version:i,user:n})+`|
`+s.blobData.join(`|
`)),s.fontCache.length){let c=new A2t,h=c.head({doc:"FONT",client:l,updateTime:r,version:i,user:n});for(let u of s.fontCache){let d=sPe(u.text,u.fontFamily,u.fontSize,u.thickness,u.bold,u.italic,u.reverse,u.expansion),p=c.buildStr(1,d,u);h=h+`|
`+p}a=h+`|
`+a}return a}var S2t=class{constructor(){}encodePart(o,t){return{id:o,dataType:"PART",data:JSON.stringify(t)}}encodeCanvas(o){return{id:"CANVAS",dataType:"CANVAS",data:JSON.stringify(o)}}encodeAttr(o,t){return{id:o,dataType:"ATTR",data:JSON.stringify(t)}}encodeTable(o,t){return{id:o,dataType:"TABLE",data:JSON.stringify(t)}}encodeEllipse(o,t){return{id:o,dataType:"ELLIPSE",data:JSON.stringify(t)}}encodeObj(o,t){return{id:o,dataType:"OBJ",data:JSON.stringify(t)}}encodePin(o,t){return{id:o,dataType:"PIN",data:JSON.stringify(t)}}encodeRect(o,t){return{id:o,dataType:"RECT",data:JSON.stringify(t)}}encodeArc(o,t){return{id:o,dataType:"ARC",data:JSON.stringify(t)}}encodeCircle(o,t){return{id:o,dataType:"CIRCLE",data:JSON.stringify(t)}}encodePoly(o,t){return{id:o,dataType:"POLY",data:JSON.stringify(t)}}encodeText(o,t){return{id:o,dataType:"TEXT",data:JSON.stringify(t)}}encodeBezier(o,t){return{id:o,dataType:"BEZIER",data:JSON.stringify(t)}}encodeGroup(o,t){return{id:o,dataType:"GROUP",data:JSON.stringify(t)}}},E2t=class extends P2t{constructor(){super(),this.encode=new S2t,this.maxTicket=0,this.blobEncode=new XPe,this.blobData=[],this.encodeData="",this.placeholder=0}handleData(o){this.encodeData?this.encodeData=this.encodeData+`|
`+lb(o.dataType,++this.maxTicket,o.id,o.data):this.encodeData=lb(o.dataType,++this.maxTicket,o.id,o.data)}onPHolder(o,t){let e={dataType:o,max:t};this.handleData({id:`placeholder${++this.placeholder}`,dataType:"ELE_PLACEHOLDER",data:JSON.stringify(e)})}onPart(o,t){this.handleData(this.encode.encodePart(o,t||{}))}onAttr(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I){this.handleData(this.encode.encodeAttr(Al(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),parentId:i,key:n,value:s,keyVisible:a,valueVisible:l,x:c,y:Qm(h),rotation:u,color:d,fillColor:p,fontFamily:m,fontSize:g,strikeout:y,underline:b,italic:P,fontWeight:T,align:I,version:"2.0"}))}onTable(o,t,e,r,i,n,s,a,l,c,h){this.handleData(this.encode.encodeTable(Al(o),{partId:t,groupId:e,startX:r,startY:Qm(i),rowSizes:n,colSizes:s,rowLocked:a,colLocked:l,rotation:c,tableCell:h,zIndex:this.getZIndex(o)}))}onEllipse(o,t,e,r,i,n,s,a,l,c,h,u,d,p){this.handleData(this.encode.encodeEllipse(Al(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),centerX:i,centerY:Qm(n),radiusX:s,radiusY:Qm(a),rotation:l,strokeColor:c,strokeStyle:h,fillColor:u,strokeWidth:d,fillStyle:p}))}onComponent(){}onObj(o,t,e,r,i,n,s,a,l,c,h,u){if(u.startsWith("data:")){let d=iee(u);this.blobData.push(this.blobEncode.buildStr(1,d,{filename:"",content:u})),u=`blob:${d}`}this.handleData(this.encode.encodeObj(Al(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),fileName:i,startX:n,startY:Qm(s),width:a,height:l,rotation:c,isMirror:h,content:u}))}onPin(o,t,e,r,i,n,s,a,l,c,h,u){this.handleData(this.encode.encodePin(Al(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),display:i,x:s,y:Qm(a),length:l,rotation:c,color:h,pinShape:u}))}onRect(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g){this.handleData(this.encode.encodeRect(Al(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),dotX1:i,dotY1:Qm(n),dotX2:s,dotY2:Qm(a),radiusX:l,radiusY:c,rotation:h,strokeColor:u,strokeStyle:d,fillColor:p,strokeWidth:m,fillStyle:g}))}onArc(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m){this.handleData(this.encode.encodeArc(Al(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),startX:i,startY:Qm(n),referX:s,referY:Qm(a),endX:l,endY:Qm(c),strokeColor:h,strokeStyle:u,fillColor:d,strokeWidth:p,fillStyle:m}))}onCircle(o,t,e,r,i,n,s,a,l,c,h,u){this.handleData(this.encode.encodeCircle(Al(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),centerX:i,centerY:Qm(n),radius:s,strokeColor:a,strokeStyle:l,fillColor:c,strokeWidth:h,fillStyle:u}))}onPoly(o,t,e,r,i,n,s,a,l,c,h){this.handleData(this.encode.encodePoly(Al(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),points:Nmt(i,!0),closed:n,strokeColor:s,strokeStyle:a,fillColor:l,strokeWidth:c,fillStyle:h}))}onText(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y){this.handleData(this.encode.encodeText(Al(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),x:i,y:Qm(n),rotation:s,value:a,color:l,fillColor:c,fontFamily:h,fontSize:u,strikeout:d,underline:p,italic:m,fontWeight:g,align:y,version:"2.0"}))}onCanvas(o){this.handleData(this.encode.encodeCanvas({originX:o.originX,originY:Qm(o.originY)}))}onBezier(o,t,e,r,i,n,s,a,l,c){this.handleData(this.encode.encodeBezier(Al(o),{partId:t,groupId:e,locked:r,zIndex:this.getZIndex(o),controls:i,strokeColor:n,strokeStyle:s,fillColor:a,strokeWidth:l,fillStyle:c}))}onGroup(o,t,e){this.handleData(this.encode.encodeGroup(String(o),{parentId:t,title:e}))}onBus(){}onWire(){}};function O2t(o,t,e=new Date().getTime(),r=String(e),i){let n=new E2t,s="";n.parseFull(t);let a=KT();n.encodeData&&(s=sL("SYMBOL",a,o,e,r,i)+`|
`+n.encodeData),s&&n.blobData.length&&(s=s+`|
`+n.blobEncode.head({doc:"BLOB",client:a,updateTime:e,version:r,user:i})+`|
`+n.blobData.join(`|
`));let l=n.partIdMap;return n.partIdMap={},{dataStr:s,partIdMap:l}}var A2t=class extends K5e{constructor(){super(...arguments),this.doctype="FONT"}buildStr(o,t,e){let r=typeof e=="string"?e:JSON.stringify(this.buildData(e));return lb("FONT",o,t,r)}buildData(o){return{width:o.width,height:o.height,path:o.path}}};var _2t=class extends b2t{constructor(){super(),this.encode=new T2t,this.maxTicket=0,this.blobEncode=new XPe,this.blobData=[],this.encodeData="",this.placeholder=0}handleData(o){this.encodeData?this.encodeData=this.encodeData+`|
`+lb(o.dataType,++this.maxTicket,o.id,o.data):this.encodeData=lb(o.dataType,++this.maxTicket,o.id,o.data)}onPHolder(o,t){let e={dataType:o,max:t};this.handleData({id:`placeholder${++this.placeholder}`,dataType:"ELE_PLACEHOLDER",data:JSON.stringify(e)})}strokeStyleType(o){switch(o=o&&Number(o),o){case 0:return"SOLID";case 1:return"SHORT_DASH";case 2:return"DOT";case 3:return"DOT_DASH";default:return null}}transScopeType(o){switch(o=o&&Number(o),o){case 1:return"PRINT";case 2:return"COVER";case 3:return"PRINT&COVER";default:return null}}transAlignType(o){switch(o=o&&Number(o),o){case 0:return"LEFT_BOTTOM";case 1:return"CENTER_BOTTOM";case 2:return"RIGHT_BOTTOM";case 3:return"LEFT_MIDDLE";case 4:return"CENTER_MIDDLE";case 5:return"RIGHT_MIDDLE";case 6:return"LEFT_TOP";case 7:return"CENTER_TOP";case 8:return"RIGHT_TOP";default:return null}}onAuxLine(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T){this.handleData(this.encode.encodeAuxLine(Al(o),{groupId:t?`e${t}`:"",layer:e,x:r,y:i,rotation:n,strokeWidth:s,strokeStyle:this.strokeStyleType(a),color:l,length:c,locked:h,zIndex:this.getZIndex(o),visible:!d,cover:p,name:m}))}onDimension(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b){this.handleData(this.encode.encodeDimension(Al(o),{layer:t,dimensionType:e,unit:r,strokeWidth:i,accuracy:n,controlDot:s,relationIds:a,locked:l,zIndex:this.getZIndex(o),valid:!c,visible:!h,cover:u,name:d,rotation:0}))}onString(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_){this.handleData(this.encode.encodeString(Al(o),{groupId:t?`e${t}`:"",layer:e,rotation:r,value:i,fontFamily:n,fontSize:s,fontWeight:a,italic:l,underline:c,strikeout:h,align:this.transAlignType(u),strokeColor:d,opacity:p,locked:m,zIndex:this.getZIndex(o),valid:!g,visible:!y,cover:b,transScope:this.transScopeType(T),transPrint:I,transWhite:C,matrix:E,strokes:O,path:_,name:P}))}onPoly(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C){if(typeof a=="string"&&a.startsWith("data:")){let E=iee(a);this.blobData.push(this.blobEncode.buildStr(1,E,{filename:"",content:a})),a=`blob:${E}`}this.handleData(this.encode.encodePoly(Al(o),{groupId:t?`e${t}`:"",layer:e,rotation:r,strokeWidth:i,strokeStyle:this.strokeStyleType(n),strokeColor:s,fillColor:a,opacity:l,autoClose:c,ploys:h,displayFill:u,displayStroke:d,locked:p,zIndex:this.getZIndex(o),valid:!m,visible:!g,cover:y,transScope:this.transScopeType(P),transPrint:T,transWhite:I,matrix:C,name:b}))}onGroup(o,t,e,r,i){this.handleData(this.encode.encodeGroup(`e${o}`,{parentId:t?`e${t}`:"",title:e,visible:r,locked:i}))}onCanvas(o){this.handleData(this.encode.encodeCanvas(o))}};function v2t(o,t,e,r=new Date().getTime(),i=String(r),n){let s=new _2t,a="";s.parseFull(t);let l=KT();return s.encodeData&&(a=sL(e,l,o,r,i,n)+`|
`+s.encodeData),a&&s.blobData.length&&(a=a+`|
`+s.blobEncode.head({doc:"BLOB",client:l,updateTime:r,version:i,user:n})+`|
`+s.blobData.join(`|
`)),a}var J5e=class extends Lgt{constructor(o){let t=o||new y5e;super(t,0,Vmt),this.cacheNum=null}onParseLine(o,t,e,r,i,n,s){switch(this.setOrderNum(o,s,t),this.cacheNum=s,t){case"MAX_NUM":if(e)for(let l in e)this.setMaxNum(l,e[l]);break;case"BLOB":e?this.onBlob(o,r,i,e,n):this.onDelBlob(o,r,i,n);break;case"FONT":this.parseFont(o,e,r,i,n);break;case"META":e&&this.parseDetail(e,r,i,n);break;case"ELE_PLACEHOLDER":break;case"CANVAS":e&&this.parseCanvas(e,r,i,n);break;case"BOARD":e?this.parseBoard(e,r,i,n):this.onDelBoard(r,i,n);break;case"LAYER":{let l=ov(o);e?this.parseLayer(l,e,r,i,n):this.onDelLayer(l,r,i,n);break}case"LAYER_PHYS":{let l=ov(o);e?this.parseLayerPhys(l,e,r,i,n):this.onDelLayerPhys(l,r,i,n);break}case"ACTIVE_LAYER":e&&this.parseActiveLayer(o,e,r,i,n);break;case"PARTITION":e?this.parsePartition(o,e,r,i,n):this.onDelPartition(o,r,i,n);break;case"NET":{let l=ov(o);e?this.parseNet(l,e,r,i,n):this.onDelNet(l,r,i,n);break}case"PRIMITIVE":{let l=ov(o);e?this.parsePrimitive(l,e,r,i,n):this.onDelPrimitive(l,r,i,n);break}case"GROUP":e?this.parseGroup(o,e,r,i,n):this.onDelGroup(o,r,i,n);break;case"X_SIGNAL_GROUP":e?this.parseXSignalsGroup(o,e,r,i,n):this.onDelXSignalsGroup(o,r,i,n);break;case"X_SIGNALS":e?this.parseXSignals(o,e,r,i,n):this.onDelXSignals(o,r,i,n);break;case"SILK_OPTS":{let l=ov(o);e?this.parseSilkOpts(l,e,r,i,n):this.onDelSilkOpts(l,r,i,n);break}case"PREFERENCE":e&&this.parsePreference(o,e,r,i,n);break;case"VIA":e?this.parseVia(o,e,r,i,n):this.onDelVia(o,r,i,n);break;case"PAD":e?this.parsePad(o,e,r,i,n):this.onDelPad(o,r,i,n);break;case"LINE":e?this.parseLine(o,e,r,i,n):this.onDelLine(o,r,i,n);break;case"ARC":e?this.parseArc(o,e,r,i,n):this.onDelArc(o,r,i,n);break;case"OBJ":e?this.parseObj(o,e,r,i,n):this.onDelObj(o,r,i,n);break;case"EQLEN_GRP":e?this.parseEQLenGrp(o,e,r,i,n):this.onDelEQLenGrp(o,r,i,n);break;case"POLY":e?this.parsePoly(o,e,r,i,n):this.onDelPoly(o,r,i,n);break;case"FILL":e?this.parseFill(o,e,r,i,n):this.onDelFill(o,r,i,n);break;case"LAYER_FILL":let a=ov(o);e?this.parseLayerFill(a,e,r,i,n):this.onDelLayerFill(a,r,i,n);break;case"REGION":e?this.parseRegion(o,e,r,i,n):this.onDelRegion(o,r,i,n);break;case"POUR":e?this.parsePour(o,e,r,i,n):this.onDelPour(o,r,i,n);break;case"POURED":{o=ov(o),e?this.parsePoured(o,e,r,i,n):this.onDelPoured(o,r,i,n);break}case"IMAGE":e?this.parseImage(o,e,r,i,n):this.onDelImage(o,r,i,n);break;case"TEARDROP":e?this.parseTeardrop(o,e,r,i,n):this.onDelTeardrop(o,r,i,n);break;case"FPC_FILL":e?this.parseFpcFill(o,e,r,i,n):this.onDelFpcFill(o,r,i,n);break;case"SHELL":e?this.parseShell(o,e,r,i,n):this.onDelShell(o,r,i,n);break;case"CREASE":e?this.parseCrease(o,e,r,i,n):this.onDelCrease(o,r,i,n);break;case"SHELLCUT":e?this.parseShellCut(o,e,r,i,n):this.onDelShellCut(o,r,i,n);break;case"SHELL_ENTITY":e?this.parseShellEntity(o,e,r,i,n):this.onDelShellEntity(o,r,i,n);break;case"BOSS":e?this.parseBoss(o,e,r,i,n):this.onDelBoss(o,r,i,n);break;case"STRING":e?this.parseString(o,e,r,i,n):this.onDelString(o,r,i,n);break;case"ATTR":e?this.parseAttr(o,e,r,i,n):this.onDelAttr(o,r,i,n);break;case"DIMENSION":e?this.parseDimension(o,e,r,i,n):this.onDelDimension(o,r,i,n);break;case"COMPONENT":e?this.parseComponent(o,e,r,i,n):this.onDelComponent(o,r,i,n);break;case"PAD_NET":{let l=JSON.parse(o);e?(e.componentId=l[1],e.padNum=l[2],e.padId=l[3],this.parsePadNet(e,r,i,n)):this.onDelPadNet(l[1],l[2],l[3]||"",r,i,n);break}case"RULE_TEMPLATE":e&&this.parseRuleTemplate(o,e,r,i,n);break;case"RULE":{let l=JSON.parse(o);e?(e.ruleType=l[1],e.ruleName=l[2],this.parseRule(e,r,i,n)):this.onDelRule(l[1],l[2],r,i,n);break}case"RULE_SELECTOR":{let l=JSON.parse(o);e?(e.ruleSelect=l[1],this.parseRuleSelector(e,r,i,n)):this.onDelRuleSelector(l[1],r,i,n);break}case"PANELIZE":e?this.parsePanelize(o,e,r,i,n):this.onDelPanelize(r,i,n);break;default:console.warn("can not find hanlder with",e,r,i)}this.cacheNum=null}onOrderNum(o,t,e){switch(this.setOrderNum(o,e,t),t){case"PARTITION":this.onPartitionNum&&this.onPartitionNum(o,e);break;case"VIA":this.onViaNum&&this.onViaNum(o,e);break;case"PAD":this.onPadNum&&this.onPadNum(o,e);break;case"LINE":this.onLineNum&&this.onLineNum(o,e);break;case"ARC":this.onArcNum&&this.onArcNum(o,e);break;case"OBJ":this.onObjNum&&this.onObjNum(o,e);break;case"POLY":this.onPolyNum&&this.onPolyNum(o,e);break;case"FILL":this.onFillNum&&this.onFillNum(o,e);break;case"REGION":this.onRegionNum&&this.onRegionNum(o,e);break;case"POUR":this.onPourNum&&this.onPourNum(o,e);break;case"POURED":let r=ov(o);this.onPouredNum&&this.onPouredNum(r,e);break;case"IMAGE":this.onImageNum&&this.onImageNum(o,e);break;case"TEARDROP":this.onTeardropNum&&this.onTeardropNum(o,e);break;case"FPC_FILL":this.onFpcFillNum&&this.onFpcFillNum(o,e);break;case"SHELL":this.onShellNum&&this.onShellNum(o,e);break;case"CREASE":this.onCreaseNum&&this.onCreaseNum(o,e);break;case"SHELLCUT":this.onShellCutNum&&this.onShellCutNum(o,e);break;case"SHELL_ENTITY":this.onShellEntityNum&&this.onShellEntityNum(o,e);break;case"BOSS":this.onBossNum&&this.onBossNum(o,e);break;case"STRING":this.onStringNum&&this.onStringNum(o,e);break;case"ATTR":this.onAttrNum&&this.onAttrNum(o,e);break;case"DIMENSION":this.onDimensionNum&&this.onDimensionNum(o,e);break;case"COMPONENT":this.onComponentNum&&this.onComponentNum(o,e);break}}onParseEnd(){}parseCanvas(o,t,e,r){this.onCanvas(t,e,o,r)}parseBoard(o,t,e,r){this.onBoard(o,t,e,r)}parseDetail(o,t,e,r){this.onDocDetail(t,e,o,r)}parseFont(o,t,e,r,i){let n=xgt(o);t?this.onFont(e,r,Object.assign(t,n),i):this.onDelFont(n,e,r,i)}parseLayer(o,t,e,r,i){this.onLayer(o,e,r,t,i)}parseLayerPhys(o,t,e,r,i){this.onLayerPhys(o,e,r,t,i)}parseActiveLayer(o,t,e,r,i){this.onActiveLayer(e,r,t,i)}parsePartition(o,t,e,r,i){this.onPartition(o,this.cacheNum,e,r,t,i)}parseNet(o,t,e,r,i){this.onNet(o,e,r,t,i)}parsePrimitive(o,t,e,r,i){this.onPrimitive(o,e,r,t,i)}parseGroup(o,t,e,r,i){this.onGroup(o,e,r,t,i)}parseXSignalsGroup(o,t,e,r,i){this.onXSignalsGroup(o,t,e,r,i)}parseXSignals(o,t,e,r,i){this.onXSignals(o,t,e,r,i)}parseSilkOpts(o,t,e,r,i){this.onSilkOpts(o,e,r,t,i)}parsePreference(o,t,e,r,i){this.onPreference(e,r,t,i)}parseVia(o,t,e,r,i){this.onVia(o,this.cacheNum,e,r,t,i)}parsePad(o,t,e,r,i){this.onPad(o,this.cacheNum,e,r,t,i)}parseLine(o,t,e,r,i){this.onLine(o,this.cacheNum,e,r,t,i)}parseArc(o,t,e,r,i){this.onArc(o,this.cacheNum,e,r,t,i)}parseObj(o,t,e,r,i){this.onObj(o,this.cacheNum,e,r,t,i)}parseEQLenGrp(o,t,e,r,i){this.onEQLenGrp(o,e,r,t,i)}parsePoly(o,t,e,r,i){this.onPoly(o,this.cacheNum,e,r,t,i)}parseFill(o,t,e,r,i){t.fillStyle!=="PLANE"&&this.onFill(o,this.cacheNum,e,r,t,i)}parseLayerFill(o,t,e,r,i){this.onLayerFill(o,e,r,t,i)}parseRegion(o,t,e,r,i){this.onRegion(o,this.cacheNum,e,r,t,i)}parsePour(o,t,e,r,i){this.onPour(o,this.cacheNum,e,r,t,i)}parsePoured(o,t,e,r,i){let n=t;Array.isArray(t)&&(n={pourFill:t}),n.pourFill&&this.onPoured(o,this.cacheNum,e,r,n,i)}parseImage(o,t,e,r,i){this.onImage(o,this.cacheNum,e,r,t,i)}parseTeardrop(o,t,e,r,i){this.onTeardrop(o,this.cacheNum,e,r,t,i)}parseFpcFill(o,t,e,r,i){this.onFpcFill(o,this.cacheNum,e,r,t,i)}parseShell(o,t,e,r,i){this.onShell(o,this.cacheNum,e,r,t,i)}parseCrease(o,t,e,r,i){this.onCrease(o,this.cacheNum,e,r,t,i)}parseShellCut(o,t,e,r,i){this.onShellCut(o,this.cacheNum,e,r,t,i)}parseShellEntity(o,t,e,r,i){this.onShellEntity(o,this.cacheNum,e,r,t,i)}parseBoss(o,t,e,r,i){this.onBoss(o,this.cacheNum,e,r,t,i)}parseDimension(o,t,e,r,i){this.onDimension(o,this.cacheNum,e,r,t,i)}parseRuleTemplate(o,t,e,r,i){this.onRuleTemplate(e,r,t,i)}parseRule(o,t,e,r){this.onRule(t,e,o,r)}parseRuleSelector(o,t,e,r){if(o.ruleKeyValue&&(o.ruleKeyValue=BN(o.ruleKeyValue)),o.copperValue&&o.copperValue.hasOwnProperty("7")){let i=o.copperValue[7];delete o.copperValue[7],o.copperValue.COPPER=i}if(o.innerPlaneValue&&o.innerPlaneValue.hasOwnProperty("6")){let i=o.innerPlaneValue[6];delete o.innerPlaneValue[6],o.innerPlaneValue.PLANE=i}this.onRuleSelector(t,e,o,r)}parsePanelize(o,t,e,r,i){this.onPanelize(e,r,t,i)}parseComponent(o,t,e,r,i){this.onComponent(o,this.cacheNum,e,r,t,i)}parsePadNet(o,t,e,r){this.onPadNet(t,e,o,r)}parseAttr(o,t,e,r,i){this.onAttr(o,this.cacheNum,e,r,t,i)}parseString(o,t,e,r,i){this.onString(o,this.cacheNum,e,r,t,i)}},x2t=(o=>(o.UNIVERSAL="UNIVERSAL",o))(x2t||{}),R2t=(o=>(o.SINGLE="SINGLE",o.MULTIPLE="MULTIPLE",o))(R2t||{}),D2t=(o=>(o.NONE="NONE",o.NAME="NAME",o.NUMBER="NUMBER",o))(D2t||{}),w2t=(o=>(o.NONE="NONE",o.ZONE="ZONE",o))(w2t||{}),L2t=ik(JW());function YW(){return self.EDITOR_TOP||self}function JN(o){return self[o]=self[o]||new L2t.BroadcastChannelMessageBus(o)}var iL=(o,t)=>{let e=/{([^}]*)}/gim,r=[...new Set(o.match(e))];for(let i=0;i<r.length;i++){let n=r[i],s=n.substring(1,n.length-1);t[s]&&(o=o.replace(n,t[s]))}return o},M2t=ik(JW()),vh={getTime:"/pro-mgr/serverTime/now",getUserL:"/pro-ui/loginUser/get",subMaxTick:"/pro-mgr/project/ticket",subBlob:"/pro-mgr/canvas/BLOB/update",subFont:"/pro-mgr/canvas/FONT/update",subRevoke:"/pro-mgr/{uuid}/revoke",pushPend:"/pro-mgr/worker/batchPendData",pushSync:"/pro-mgr/dataWorker/sync",pushRevoke:"/pro-mgr/worker/revoke",pullASync:"/pro-mgr/dataWorker/sync/{id}",personDestroy:"/mgr/libWorker/destroy",projectUpdate:"/pro-mgr/canvas/{uuid}/update",personUpdate:"/mgr/libWorker/component/{uuid}/update",personSave:"/mgr/libWorker/save",projectSave:"/mgr/projectWorker/setCanvas",canSavePend:"/mgr/projectWorker/canSavePend",hasSaveData:"/mgr/check/hasSaveData"},N2t={projectUpdate:vh.projectUpdate,personUpdate:vh.personUpdate,projectCanSave:vh.canSavePend,getProject:"/mgr/projectWorker/footprint/getCanvas",getPerson:"/mgr/libWorker/getFootprint",unwatch:"/mgr/projectWorker/footprint/unwatchCanvas"},k2t={projectUpdate:vh.projectUpdate,projectCanSave:vh.canSavePend,getProject:"/mgr/projectWorker/pcb/getCanvas",unwatch:"/mgr/projectWorker/pcb/unwatchCanvas"},VWt={projectUpdate:vh.projectUpdate,projectCanSave:vh.canSavePend,getProject:"/mgr/projectWorker/sheet/getCanvas",unwatch:"/mgr/projectWorker/sheet/unwatchCanvas"},GWt={projectUpdate:vh.projectUpdate,getProject:"/mgr/projectWorker/schematic/getCanvas",unwatch:"/mgr/projectWorker/schematic/unwatchCanvas"},UWt={projectUpdate:vh.projectUpdate,projectCanSave:vh.canSavePend,getProject:"/mgr/projectWorker/simulation/getCanvas",unwatch:"/mgr/projectWorker/simulation/unwatchCanvas"},HWt={projectUpdate:vh.projectUpdate,personUpdate:vh.personUpdate,projectCanSave:vh.canSavePend,getProject:"/mgr/projectWorker/symbol/getCanvasOnCompiler",getPerson:"/mgr/libWorker/getSymbol",unwatch:"/mgr/projectWorker/symbol/unwatchCanvas"},WWt={projectUpdate:vh.projectUpdate,personUpdate:vh.personUpdate,projectCanSave:vh.canSavePend,getProject:"/mgr/projectWorker/panel/getCanvas",getPerson:"/mgr/libWorker/getPanelLib",unwatch:"/mgr/projectWorker/panel/unwatchCanvas"},sb={send:"/pro-mgr/notify/send",sendMsg:"/document/sendMsg/cooperation",unwatch:"/document/unwatch/cooperation",watch:"/document/watch/cooperation",message:"/pro-mgr/notify/message/{path}/{uuid}/cooperation",established:"/pro-mgr/notify/message/ws/established",getWsId:"/pro-mgr/notify/getWsId",disconnect:"/pro-mgr/notify/message/ws/disconnect"},qPe=class{constructor(o=!0){this._lockerTicket=0,this.isPull=!1,this.compiler={},this.order={SYMBOL:1,FOOTPRINT:2,DEVICE:3,SCH_PAGE:4,PCB:5},this._locker=o?++this._lockerTicket:0}getOrder(o){return this.order[o]||6}publish(){if(!this.isPull){this.isPull=!0,this._temporaryUnlock=this._locker;try{let o=Object.keys(this.compiler).sort((e,r)=>this.getOrder(e)-this.getOrder(r)),t=!1;for(let e of o){for(let[,r]of this.compiler[e])if(t=r.publish(),t)break;if(t)break}}finally{this._temporaryUnlock=0,this.isPull=!1}}}canPush(){return!this._locker||this._locker===this._temporaryUnlock}addCompiler(o){this.compiler[o.headType]||(this.compiler[o.headType]=new Map),this.compiler[o.headType].set(o.uniqueId,o)}removeCompiler(o){var t,e,r;(r=(e=(t=this.compiler)==null?void 0:t[o.headType])==null?void 0:e.delete)==null||r.call(e,o.uniqueId)}pull(){if(!this._locker)throw Error("\u4E0D\u5141\u8BB8\u5728\u975E pause \u72B6\u6001\u4E0B\u62C9\u53D6\u6570\u636E");this.publish()}resume(){this._locker=0,this.publish()}pause(){this._locker=++this._lockerTicket}dispose(){for(let o in this.compiler)this.compiler[o].clear();this.compiler=null}},av={publish:"publish",destroy:"destroy",init:"init",selected:"selected"},B2t=class{constructor(o,t,e,r=(s=>(s=YW())==null?void 0:s._TAB_ID_)(),i,n){this.uuid=o,this.path=t,this.user=e,this.windowId=r,this.initIds={},this.sub=[];var s;this.wsBus=n||JN(`/${this.windowId}/notify`),this.dataBus=i||this.wsBus,this._client=(s=YW())==null?void 0:s._WS_ID_}get client(){return this._client}watch(){this.dataBus.publish(sb.send,{topic:sb.watch,uuid:this.uuid,path:this.path})}initPublish(){var o;this.dataBus.publish(sb.send,{topic:sb.sendMsg,uuid:this.uuid,path:this.path,msg:{type:av.publish,user:this.user,client:this.client,data:((o=this.getSelect)==null?void 0:o.call(this))||""}})}async init(){if(!this.isInit){if(this.sub.push(this.wsBus.subscribe(sb.established,o=>{this._client=o,this.watch(),this.initPublish()})),!this.client){let o=await this.wsBus.rpcCall(sb.getWsId);if(!o||this.client)return;this._client=o}this.watch(),this.sub.push(this.wsBus.subscribe(sb.disconnect,o=>{this.initIds[o]&&this.onDestroy(this.initIds[o],o)})),this.sub.push(this.dataBus.subscribe(iL(sb.message,{uuid:this.uuid,path:this.path}),o=>{if(o.type===1)o.connectId&&this.initIds[o.connectId]&&this.onDestroy(this.initIds[o.connectId],o.connectId);else if(o.msg){let t=o.msg;if(t.client===this.client)return;switch(t.type){case av.destroy:this.onDestroy(t.userId,t.client),delete this.initIds[t.client];break;case av.init:this.initIds[t.client]||(this.initIds[t.client]=t.user.uuid,this.onSelected(t.user,t.client,t.data||""));break;case av.selected:this.onSelected(t.user,t.client,t.data||"");break;case av.publish:this.dataBus.publish(sb.send,{topic:sb.sendMsg,uuid:this.uuid,path:this.path,msg:{type:av.init,user:this.user,client:this.client,data:this.getSelect()||""}}),this.initIds[t.client]=t.user.uuid,this.onSelected(t.user,t.client,t.data||"");break;default:break}}})),this.initPublish(),this.isInit=!0}}publishSelected(o,t){this.dataBus.publish(sb.send,{topic:sb.sendMsg,uuid:this.uuid,path:this.path,msg:{type:av.selected,user:this.user,client:this.client,data:o}}),t&&this.onSelected(this.user,this.client,o)}destroy(){if(this.isInit){this.isInit=!1,this.dataBus.publish(sb.send,{topic:sb.unwatch,uuid:this.uuid,path:this.path,msg:{type:av.destroy,userId:this.user.uuid,client:this.client}});for(let o of this.sub)o.cancel();this.sub=[],this.initIds={}}}},z6e=class extends B2t{constructor(o,t,e,r,i,n,s,a){super(o,t,a,e,i,n),this.channel=r,this.selectedProps=s,this.cache=new Map,this.deleteCache=new Map}rePublish(){var o,t,e,r;if(this.channel.canPush()){for(let[i,n]of this.cache)(t=(o=this.selectedProps)==null?void 0:o.onSelect)==null||t.call(o,n.user,i,n.data);for(let[i,n]of this.deleteCache)(r=(e=this.selectedProps)==null?void 0:e.onQuit)==null||r.call(e,n,i)}}getSelect(){var o,t;return((t=(o=this.selectedProps)==null?void 0:o.getSelect)==null?void 0:t.call(o))||""}onSelected(o,t,e){var r,i;this.channel.canPush()?!this.deleteCache.has(t)&&this.cache.set(t,{user:o,data:e}):(i=(r=this.selectedProps)==null?void 0:r.onSelect)==null||i.call(r,o,t,e)}onDestroy(o,t){var e,r;this.channel.canPush()?(this.deleteCache.set(t,o),this.cache.delete(t)):(r=(e=this.selectedProps)==null?void 0:e.onQuit)==null||r.call(e,o,t)}dispose(){this.destroy(),this.cache.clear(),this.deleteCache.clear()}publishSelected(o,t){super.publishSelected(o,t)}},F2t=class{constructor(o,t,e,r=(b=>(b=YW())==null?void 0:b._TAB_ID_)(),i=new qPe,n=null,s,a,l,c,h,u,d,p,m,g,y){this.uuid=o,this.path=t,this.isProject=e,this.windowId=r,this.channel=i,this.consistencyManager=n,this.selectedProps=l,this.setInit=c,this.onDocDetail=h,this.onUpdate=u,this.handleInit=d,this.onDelete=p,this.publishCache=m,this.onOrderNm=g,this.setMaxNum=y,this.isInit=!1,this.canSave=!0,this.sub=[],this.isInitIng=!1,this.cache={},this.deleteCache=new Map,this.pendTimer=null,this.pendCache={},this.pendCacheLength=0,this.wsBus=JN(`/${r}/notify`),n||(this._unique=KT()),this._headType=s,this.busTopic=a}get uniqueId(){return this._unique||this.consistencyManager.getUnique()}get headType(){return this._headType}setIsInitIng(o){var t;(t=this.setInit)==null||t.call(this,o),this.isInitIng=o}consoleDebug(...o){console.debug("[lc-protocol]",this._headType,this.uuid,...o)}publishLine(o,t,e,r,i,n=this.uuid,s,a,l,c,h){if(this.channel.canPush())return this.consistencyManager.remoteChange(t,i,n,o,e,r,void 0,void 0,void 0,s,void 0,a,l,h),!1;this.cache[n]||(this.cache[n]=new Map);let u=this.cache[n].get(o);return(c||!u||u.ticket<t||u.ticket===t&&(u.client<i||u.client===i&&!!u.pend!=!!s))&&this.cache[n].set(o,{client:i,ticket:t,dataType:r,data:e,pend:s,unique:a,pChange:u?void 0:l,num:h}),!0}onDocHead(){}onEnd(){}setDocType(o,t){o===this.uuid&&(this._headType=t)}setBusTopic(o){this.busTopic=o}publish(){var o,t,e;if(this.publishCache)return this.publishCache();let r=!1;for(let[i,n]of this.deleteCache){if(this.channel.canPush()){(o=this.onDelete)==null||o.call(this,n),delete this.cache[i];continue}r=!0;break}if(r)return r;for(let i in this.cache){let n=this.cache[i].keys();for(let s of n){let a=this.cache[i].get(s);if(r=this.publishLine(s,a.ticket,a.data,a.dataType,a.client,i,a.pend,a.unique,a.pChange,!1,a.num),r)break;this.cache[i].delete(s)}if(r)break}return(e=(t=this.selectManager)==null?void 0:t.rePublish)==null||e.call(t),r}publishSelected(o,t){this.selectManager.publishSelected(o,t)}clear(){var o,t;for(let e of this.sub)e.cancel();this.sub.length=0,this.cache={},this.deleteCache.clear(),this.setIsInitIng(!1),this.channel.removeCompiler(this),(t=(o=this.selectManager)==null?void 0:o.dispose)==null||t.call(o),this.selectManager=null,this.isInit=!1,this.setIsInitIng(!1)}async init(o=!0,t=!0,e=!0,r,i,n,s){try{if(this.isInit)return{success:!0};if(this.isInitIng)throw new Error("\u6B63\u5728\u521D\u59CB\u5316\u4E2D");return this.isProject?await this.initProject(o,t,e,r,n,s):await this.initLib(e,r,i,n,s)}catch(a){throw this.clear(),new Error(`${this._headType}+'Compiler' ${this.uuid} init false: ${(a==null?void 0:a.message)||a||""}`,{cause:a})}finally{this.isInitIng=!1}}async flowRead(o){let t=this.consistencyManager.flowParseFull(),e=t.update,r=this;t.update=i=>{if(r.isDestroy)return!0;e(i)},await(0,M2t.flowRead)(o,t)}pushOnLine(o,t){if(this.consistencyManager)for(let e of o)this.publishLine(e[0],e[1],e[2],e[3],e[4],t,e[5],e[6],e[7],!1,e[8])}async initProject(o,t,e,r,i,n){if(this.setIsInitIng(!0),this.channel.addCompiler(this),this.dataBus=JN(`/${this.windowId}/project/${this.path}`),i&&this.sub.push(this.dataBus.subscribe(`/pro-mgr/${this.uuid}/number/update`,l=>{if(this.onOrderNm)for(let c of l)this.onOrderNm(c[0],c[1],c[2])})),e&&this.busTopic.projectUpdate&&this.sub.push(this.dataBus.subscribe(iL(this.busTopic.projectUpdate,{uuid:this.uuid}),l=>{this.onUpdate?this.onUpdate(l):this.pushOnLine(l,this.uuid)})),e&&this.busTopic.projectCanSave&&this.sub.push(this.dataBus.subscribe(this.busTopic.projectCanSave,l=>{this.canSave=l})),e&&this.busTopic.subDelete&&this.sub.push(this.dataBus.subscribe(this.busTopic.subDelete,l=>{var c;this.channel.canPush()?(c=this.onDelete)==null||c.call(this,l):this.deleteCache.set(l[0],l)})),e&&this.consistencyManager&&this.sub.push(this.dataBus.subscribe(vh.subMaxTick,l=>{this.consistencyManager.setMaxTicket(l.ticket,l.force)})),e&&t&&this.sub.push(this.dataBus.subscribe(vh.subBlob,l=>{this.pushOnLine(l,"BLOB")})),e&&o&&this.sub.push(this.dataBus.subscribe(vh.subFont,l=>{this.pushOnLine(l,"FONT")})),e&&this.consistencyManager&&this.sub.push(this.dataBus.subscribe(iL(vh.subRevoke,{uuid:this.uuid}),l=>this.revoke(l))),!this.busTopic.getProject)throw new Error("\u83B7\u53D6\u6570\u636E\u5931\u8D25\uFF01\uFF01\uFF01");this.isDestroy=!1;let s={doc:[this.uuid],watch:e,needNum:i,needDelete:n};t&&s.doc.push("BLOB"),o&&s.doc.push("FONT");let a=await this.dataBus.rpcCall(this.busTopic.getProject,s);if(this.isWatch=e,!this.isDestroy){if(!a.success)throw new Error("\u83B7\u53D6\u6570\u636E\u5931\u8D25\uFF01\uFF01\uFF01",a);if(this.canSave=!(a!=null&&a.readOnly),this.consoleDebug("init",a.result),a.maxTicket&&this.consistencyManager&&this.consistencyManager.setMaxTicket(a.maxTicket),a.data&&this.onDocDetail&&this.onDocDetail(a.client||KT(),0,a.data,!1),a.channel&&await this.flowRead(a.channel),!this.isDestroy){if(this.handleInit?this.handleInit(a):a.result&&this.consistencyManager&&this.consistencyManager.parseFull(a.result,this.uuid,this._headType),r){let l=this.user=this.user||a.user||await this.wsBus.rpcCall(vh.getUserL);this.selectManager=new z6e(this.uuid,this.path,this.windowId,this.channel,this.dataBus,this.wsBus,this.selectedProps,l),await this.selectManager.init()}return this.isInit=!0,this.setIsInitIng(!1),{success:!0}}}}async initLib(o,t,e,r,i){if(this.setIsInitIng(!0),this.channel.addCompiler(this),this.dataBus=JN(`/${this.windowId}/libWorker`),!this.busTopic.getPerson)throw new Error("\u83B7\u53D6\u6570\u636E\u5931\u8D25\uFF01\uFF01\uFF01");let n=e?KT():"";this.isDestroy=!1;let s=await this.dataBus.rpcCall(this.busTopic.getPerson,{uuid:this.uuid,path:this.path,watch:o,channel:n,needNum:r,needDelete:i});if(this.isWatch=o,this.isDestroy)return;if(!s.success)throw new Error("\u83B7\u53D6\u6570\u636E\u5931\u8D25\uFF01\uFF01\uFF01",s);this.consoleDebug("init",s.dataStr);let a=s.data||s.result;if(a&&this.onDocDetail&&this.onDocDetail(s.client||KT(),0,a,!1),r&&this.sub.push(this.dataBus.subscribe(`/pro-mgr/${this.uuid}/number/update`,l=>{if(this.onOrderNm)for(let c of l)this.onOrderNm(c[0],c[1],c[2])})),o&&this.busTopic.personUpdate&&this.sub.push(this.dataBus.subscribe(iL(this.busTopic.personUpdate,{uuid:this.uuid}),l=>{this.pushOnLine(l,this.uuid)})),o&&this.sub.push(this.dataBus.subscribe(iL(iL(vh.subRevoke,{uuid:this.uuid}),{uuid:this.uuid}),l=>this.revoke(l))),n&&await this.flowRead(n),!this.isDestroy){if(s.dataStr&&this.consistencyManager&&this.consistencyManager.parseFull(s.dataStr),t){let l=this.user=this.user||s.user||await this.wsBus.rpcCall(vh.getUserL);this.selectManager=new z6e(this.uuid,this.path,this.windowId,this.channel,this.wsBus,this.wsBus,this.selectedProps,l),await this.selectManager.init()}return this.isInit=!0,this.setIsInitIng(!1),{success:!0}}}revoke(o){for(let t of o)this.consistencyManager&&this.consistencyManager.revoke(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],(...e)=>this.publishLine(...e)),t[10]&&this.setMaxNum&&this.setMaxNum(t[6],t[10],t[1])}cachePendData(o,t,e,r,i,n){this.pendCache[o]||(this.pendCache[o]={type:n,pend:[]}),this.pendCache[o].pend.push([t,e,i,r]),this.pendCacheLength+=r.length+1,this.pendCacheLength>1e7&&this.publishPendData(),this.pendTimer||(this.pendTimer=setTimeout(()=>{this.publishPendData(),this.pendTimer=null},0))}publishPendData(){if(this.pendCacheLength){this.dataBus.publish(vh.pushPend,[this.pendCache,this.consistencyManager.getClient(),this.uniqueId,this.uuid]);for(let o in this.pendCache)this.pendCache[o].pend.length=0;this.pendCache={},this.pendCacheLength=0}}localChange(o,t,e,r=this.uuid,i,n){if(!this.isInit||!this.canSave||!this.consistencyManager)return 0;if(t&&!t.startsWith("{"))return console.error("\u4E0A\u4F20\u7684\u683C\u5F0F\u4E0D\u6B63\u786E",o,e,t),0;let s=this.consistencyManager.localChange(r,o,t,e,i,n);return this.cachePendData(r,o,s,t,e,i||this.headType),s}async sync(){if(!this.isInit)throw new Error("\u6570\u636E\u672A\u521D\u59CB\u5316\uFF0C\u65E0\u6CD5\u540C\u6B65");let o=KT();this.dataBus.publish(vh.pushSync,o),await this.dataBus.pullA(iL(vh.pullASync,{id:o}))}async destroy(){return this.isDestroy?{success:!1}:(this.consistencyManager&&this.dataBus&&this.dataBus.publish(vh.pushRevoke,[this.uuid,this.uniqueId,this.consistencyManager.getClient()]),this.clear(),this.isDestroy=!0,this.isWatch&&this.dataBus&&!this.isProject&&this.dataBus.publish(vh.personDestroy,{uuid:this.uuid,path:this.path}),this.isWatch&&this.dataBus&&this.busTopic.unwatch&&this.dataBus.publish(this.busTopic.unwatch,this.uuid),this.isWatch=!1,{success:!0})}async save(o=[this.uuid,"BLOB","FONT"]){try{if(!this.isInit)throw new Error("\u6570\u636E\u672A\u521D\u59CB\u5316\uFF0C\u65E0\u6CD5\u4FDD\u5B58");if(!this.consistencyManager)throw new Error("\u65E0\u6CD5\u652F\u6301\u4FDD\u5B58");let t=this.isProject?vh.projectSave:vh.personSave;if(!t)throw new Error("\u65E0\u6CD5\u652F\u6301\u4FDD\u5B58");let e=await this.dataBus.rpcCall(t,{uuid:this.uuid,path:this.path,docIds:o,uniqueId:this.uniqueId,client:this.consistencyManager.getClient()});return this.consoleDebug("save",e),e}catch(t){throw new Error(`${this._headType}+'Compiler' ${this.uuid} \u4FDD\u5B58\u5931\u8D25: ${(t==null?void 0:t.message)||t||""}`,{cause:t})}}async getBlob(o){return this.dataBus.rpcCall("/mgr/projectWorker/blob/getBlob",o)}async getFont(o,t,e,r,i,n,s,a){let l={text:o,fontFamily:t,fontSize:e,thickness:r,bold:i,italic:n,reverse:s,expansion:a},c=await this.dataBus.rpcCall("/mgr/projectWorker/font/get",l);return c.success?{success:!0,result:Object.assign(l,JSON.parse(c.result))}:c}async checkSave(){return await this.dataBus.rpcCall(vh.hasSaveData,{uuid:this.uuid,uniqueId:this.uniqueId})}},V2t=(o=>(o.DIFFERENTIAL_PAIR="DIFFERENTIAL_PAIR",o.NET_CLASS="NET_CLASS",o.EQL_NET_GRP="EQL_NET_GRP",o))(V2t||{}),G2t=class extends J5e{constructor(o){super(o)}onComponent(){}onComponentNum(){}onDelComponent(){}onPadNet(){}onDelPadNet(){}};var zWt=ik(JW()),YWt=ik(JW());var U2t=class extends J5e{constructor(o,t,e,r,i,n,s,a=(l=>(l=YW())==null?void 0:l._TAB_ID_)()){let l=new y5e(a);super(l),this.isProject=e,this.encode=n,this.base=new F2t(o,t,e,a,r,l,i,i==="PCB"?k2t:N2t,s,(...c)=>this.setIsInit(...c),(...c)=>this.onDocDetail(...c),void 0,void 0,void 0,void 0,(c,h,u)=>this.onOrderNum(c,h,u),(c,h,u)=>{this.setMaxNum(c,h,!!u),u&&this.deleteOrderNum(u)})}get dataBus(){return this.base.dataBus}set dataBus(o){this.base.dataBus=o}async init(o=!0,t=!0,e=!0,r,i=!0,n){return this.setNeedNum(i),this.base.init(o,t,e,r,!0,i,n)}async sync(){return this.base.sync()}async destroy(){return this.base.destroy()}async save(){return this.base.save()}checkSave(){return this.base.checkSave()}publishSelected(o,t){this.base.publishSelected(o,t)}uploadBlob(o,t){let e=iee(t),r={filename:o,content:t};return{success:!0,ticket:this.localChange({id:e,data:JSON.stringify(r),dataType:"BLOB"},"BLOB","BLOB"),hash:e}}deleteBlob(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"BLOB"},"BLOB","BLOB")}}uploadFont(o){let{text:t,fontFamily:e,fontSize:r,thickness:i,bold:n,italic:s,reverse:a,expansion:l,width:c,height:h,path:u}=o,d={width:c,height:h,path:u},p=sPe(t,e,r,i,n,s,a,l);return{success:!0,ticket:this.localChange({id:p,data:JSON.stringify(d),dataType:"FONT"},"FONT","FONT")}}deleteFont(o){let{text:t,fontFamily:e,fontSize:r,thickness:i,bold:n,italic:s,reverse:a,expansion:l}=o,c=sPe(t,e,r,i,n,s,a,l);return{success:!0,ticket:this.localChange({id:c,data:"",dataType:"FONT"},"FONT","FONT")}}async updateFootprint(o){return this.isProject?this.dataBus.rpcCall("/mgr/projectWorker/footprint/update",o):{success:!1,message:"compiler \u6682\u4E0D\u652F\u6301\u4E2A\u4EBA\u5E93\u76F4\u63A5\u4FEE\u6539\u5C01\u88C5\u4FE1\u606F"}}async generateTemplate(o,t){return this.isProject?this.dataBus.rpcCall("/mgr/projectWorker/footprint/generateTemplate",{custom:o,renameKey:t}):{success:!1,message:"compiler \u6682\u4E0D\u652F\u6301\u4E2A\u4EBA\u5E93\u8C03\u7528\u8BE5\u63A5\u53E3"}}localChange(o,t=this.base.uuid,e){var r,i;let n=this.getOrderNum(o.id);return(i=(r=this.needOrderType)==null?void 0:r.includes)!=null&&i.call(r,o.dataType)&&n===void 0&&(n=this.getMaxNum(o.dataType),this.setOrderNum(o.id,n,o.dataType),this.onOrderNum(o.id,o.dataType,n)),this.base.localChange(o.id,o.data,o.dataType,t,e,n)}uploadString(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeString(o,t))}}deleteString(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"STRING"})}}uploadAttr(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeAttr(o,t))}}deleteAttr(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"ATTR"})}}uploadPanelize(o){return{success:!0,ticket:this.localChange(this.encode.encodePanelize(o))}}deletePanelize(){return{success:!0,ticket:this.localChange({id:"PANELIZE",data:"",dataType:"PANELIZE"})}}uploadRuleSelector(o){return{success:!0,ticket:this.localChange(this.encode.encodeRuleSelector(o))}}deleteRuleSelector(o){return{success:!0,ticket:this.localChange({id:JSON.stringify(["RULE_SELECTOR",o]),data:"",dataType:"RULE_SELECTOR"})}}uploadRule(o){return{success:!0,ticket:this.localChange(this.encode.encodeRule(o))}}deleteRule(o,t){return{success:!0,ticket:this.localChange({id:JSON.stringify(["RULE",o,t]),data:"",dataType:"RULE"})}}uploadRuleTemplate(o){return{success:!0,ticket:this.localChange(this.encode.encodeRuleTemplate(o))}}uploadDimension(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeDimension(o,t))}}deleteDimension(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"DIMENSION"})}}uploadBoss(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeBoss(o,t))}}deleteBoss(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"BOSS"})}}uploadShellEntity(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeShellEntity(o,t))}}deleteShellEntity(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"SHELL_ENTITY"})}}uploadShellCut(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeShellCut(o,t))}}deleteShellCut(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"SHELLCUT"})}}uploadCrease(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeCrease(o,t))}}deleteCrease(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"CREASE"})}}uploadShell(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeShell(o,t))}}deleteShell(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"SHELL"})}}uploadFpcFill(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeFpcFill(o,t))}}deleteFpcFill(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"FPC_FILL"})}}uploadTeardrop(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeTeardrop(o,t))}}deleteTeardrop(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"TEARDROP"})}}uploadImage(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeImage(o,t))}}deleteImage(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"IMAGE"})}}uploadPoured(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePoured(o,t))}}deletePoured(o){return{success:!0,ticket:this.localChange({id:ab(o,"POURED"),data:"",dataType:"POURED"})}}uploadPour(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePour(o,t))}}deletePour(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"POUR"})}}uploadRegion(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeRegion(o,t))}}deleteRegion(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"REGION"})}}uploadFill(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeFill(o,t))}}deleteFill(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"FILL"})}}uploadLayerFill(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeLayerFill(o,t))}}deleteLayerFill(o){return{success:!0,ticket:this.localChange({id:ab(o,"LAYER_FILL"),data:"",dataType:"LAYER_FILL"})}}uploadPoly(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePoly(o,t))}}deletePoly(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"POLY"})}}uploadEQLenGrp(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeEQLenGrp(o,t))}}deleteEQLenGrp(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"EQLEN_GRP"})}}uploadObj(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeObj(o,t))}}deleteObj(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"OBJ"})}}uploadArc(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeArc(o,t))}}deleteArc(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"ARC"})}}uploadLine(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeLine(o,t))}}deleteLine(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"LINE"})}}uploadPad(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePad(o,t))}}deletePad(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"PAD"})}}uploadVia(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeVia(o,t))}}deleteVia(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"VIA"})}}uploadPreference(o){return{success:!0,ticket:this.localChange(this.encode.encodePreference(o))}}uploadSilkOpts(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeSilkOpts(o,t))}}deleteSilkOpts(o){return{success:!0,ticket:this.localChange({id:ab(o,"SILK_OPTS"),data:"",dataType:"SILK_OPTS"})}}uploadGroup(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeGroup(o,t))}}deleteGroup(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"GROUP"})}}uploadPrimitive(o,t){return{success:!0,ticket:this.localChange(this.encode.encodePrimitive(o,t))}}deletePrimitive(o){return{success:!0,ticket:this.localChange({id:ab(o,"PRIMITIVE"),data:"",dataType:"PRIMITIVE"})}}uploadNet(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeNet(o,t))}}deleteNet(o){return{success:!0,ticket:this.localChange({id:ab(o,"NET"),data:"",dataType:"NET"})}}uploadActiveLayer(o){return{success:!0,ticket:this.localChange(this.encode.encodeActiveLayer(o))}}uploadLayerPhys(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeLayerPhys(o,t))}}deleteLayerPhys(o){return{success:!0,ticket:this.localChange({id:ab(o,"LAYER_PHYS"),data:"",dataType:"LAYER_PHYS"})}}uploadLayer(o,t){return{success:!0,ticket:this.localChange(this.encode.encodeLayer(o,t))}}deleteLayer(o){return{success:!0,ticket:this.localChange({id:ab(o,"LAYER"),data:"",dataType:"LAYER"})}}uploadCanvas(o){return{success:!0,ticket:this.localChange(this.encode.encodeCanvas(o))}}uploadBoard(o){return{success:!0,ticket:this.localChange({id:"BOARD",data:JSON.stringify(o),dataType:"BOARD"})}}deleteBoard(){return{success:!0,ticket:this.localChange({id:"BOARD",data:"",dataType:"BOARD"})}}uploadXSignalsGroup(o,t){return{success:!0,ticket:this.localChange({id:o,data:JSON.stringify(t),dataType:"X_SIGNAL_GROUP"})}}deleteXSignalsGroup(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"X_SIGNAL_GROUP"})}}uploadXSignals(o,t){return{success:!0,ticket:this.localChange({id:o,data:JSON.stringify(t),dataType:"X_SIGNALS"})}}deleteXSignals(o){return{success:!0,ticket:this.localChange({id:o,data:"",dataType:"X_SIGNALS"})}}},Q5e=class extends U2t{constructor(o,t,e,r,i=(n=>(n=YW())==null?void 0:n._TAB_ID_)()){super(o,t,e,r,"FOOTPRINT",new Z5e,{getSelect:()=>{var n;return(n=this.canvasSelected)==null?void 0:n.call(this)},onSelect:(...n)=>{var s;return(s=this.onSelectChange)==null?void 0:s.call(this,n[0],n[1],n[2])},onQuit:(...n)=>{var s;return(s=this.onSelectQuit)==null?void 0:s.call(this,n[0],n[1])}},i),this.uuid=o,this.path=t,this.isProject=e,this.windowId=i}onComponent(){}onComponentNum(){}onDelComponent(){}onPadNet(){}onDelPadNet(){}},H2t=class extends G2t{constructor(){super(...arguments),this.data={}}onXSignalsGroup(o,t,e,r,i){}onDelXSignalsGroup(o,t,e,r){}onXSignals(o,t,e,r,i){}onDelXSignals(o,t,e,r){}onBoard(o,t,e,r){}onDelBoard(o,t,e){}onLayerFill(o,t,e,r,i){}onDelLayerFill(o,t,e,r){}onBlob(o,t,e,r,i){}onDelBlob(o,t,e,r){}onFont(o,t,e,r){}onDelFont(o,t,e,r){}onString(o,t,e,r,i,n){this.data[o]=i}onDelString(o,t,e,r){delete this.data[o]}onStringNum(o,t){}onAttr(o,t,e,r,i,n){this.data[o]=i}onDelAttr(o,t,e,r){delete this.data[o]}onAttrNum(o,t){}onPanelizeSide(o,t,e,r){}onDelPanelizeSide(o,t,e,r){}onPanelizeStamp(o,t,e,r){}onDelPanelizeStamp(o,t,e,r){}onPanelize(o,t,e,r){}onDelPanelize(o,t,e){}onRuleSelector(o,t,e,r){}onDelRuleSelector(o,t,e,r){}onRule(o,t,e,r){}onDelRule(o,t,e,r,i){}onRuleTemplate(o,t,e,r){}onDimension(o,t,e,r,i,n){this.data[o]=i}onDelDimension(o,t,e,r){delete this.data[o]}onDimensionNum(o,t){}onBoss(o,t,e,r,i,n){this.data[o]=i}onDelBoss(o,t,e,r){delete this.data[o]}onBossNum(o,t){}onShellEntity(o,t,e,r,i,n){this.data[o]=i}onDelShellEntity(o,t,e,r){}onShellEntityNum(o,t){}onShellCut(o,t,e,r,i,n){this.data[o]=i}onDelShellCut(o,t,e,r){delete this.data[o]}onShellCutNum(o,t){}onCrease(o,t,e,r,i,n){this.data[o]=i}onDelCrease(o,t,e,r){delete this.data[o]}onCreaseNum(o,t){}onShell(o,t,e,r,i,n){this.data[o]=i}onDelShell(o,t,e,r){delete this.data[o]}onShellNum(o,t){}onFpcFill(o,t,e,r,i,n){this.data[o]=i}onDelFpcFill(o,t,e,r){delete this.data[o]}onFpcFillNum(o,t){}onTeardrop(o,t,e,r,i,n){this.data[o]=i}onDelTeardrop(o,t,e,r){delete this.data[o]}onTeardropNum(o,t){}onImage(o,t,e,r,i,n){this.data[o]=i}onDelImage(o,t,e,r){delete this.data[o]}onImageNum(o,t){}onPoured(o,t,e,r,i,n){this.data[o]=i}onDelPoured(o,t,e,r){delete this.data[o]}onPouredNum(o,t){}onPour(o,t,e,r,i,n){this.data[o]=i}onDelPour(o,t,e,r){delete this.data[o]}onPourNum(o,t){}onRegion(o,t,e,r,i,n){this.data[o]=i}onDelRegion(o,t,e,r){delete this.data[o]}onRegionNum(o,t){}onFill(o,t,e,r,i,n){this.data[o]=i}onDelFill(o,t,e,r){delete this.data[o]}onFillNum(o,t){}onPoly(o,t,e,r,i,n){this.data[o]=i}onDelPoly(o,t,e,r){delete this.data[o]}onPolyNum(o,t){}onEQLenGrp(o,t,e,r,i){this.data[o]=r}onDelEQLenGrp(o,t,e,r){delete this.data[o]}onDelProp(o,t,e,r){delete this.data[o]}onObj(o,t,e,r,i,n){this.data[o]=i}onDelObj(o,t,e,r){delete this.data[o]}onObjNum(o,t){}onArc(o,t,e,r,i,n){this.data[o]=i}onDelArc(o,t,e,r){delete this.data[o]}onArcNum(o,t){}onCArc(o,t,e,r,i,n){this.data[o]=i}onDelCArc(o,t,e,r){delete this.data[o]}onCArcNum(o,t){}onLine(o,t,e,r,i,n){this.data[o]=i}onDelLine(o,t,e,r){delete this.data[o]}onLineNum(o,t){}onPad(o,t,e,r,i,n){this.data[o]=i}onDelPad(o,t,e,r){delete this.data[o]}onPadNum(o,t){}onVia(o,t,e,r,i,n){this.data[o]=i}onDelVia(o,t,e,r){delete this.data[o]}onViaNum(o,t){}onDelConnect(o,t,e,r){}onPreference(o,t,e,r){}onSilkOpts(o,t,e,r,i){this.data[o]=r}onDelSilkOpts(o,t,e,r){delete this.data[o]}onGroup(o,t,e,r,i){this.data[o]=r}onDelGroup(o,t,e,r){delete this.data[o]}onPrimitive(o,t,e,r,i){}onDelPrimitive(o,t,e,r){}onNet(o,t,e,r,i){}onDelNet(o,t,e,r){}onPartition(o,t,e,r,i,n){this.data[o]=i}onDelPartition(o,t,e,r){delete this.data[o]}onPartitionNum(o,t){}onEditorMeta(o,t,e,r){}onDocDetail(o,t,e,r){}onActiveLayer(o,t,e,r){}onLayerPhys(o,t,e,r,i){this.data[o]=r}onDelLayerPhys(o,t,e,r){delete this.data[o]}onLayer(o,t,e,r,i){this.data[o]=r}onDelLayer(o,t,e,r){}onCanvas(o,t,e,r){}},W2t=class extends Q5e{onXSignalsGroup(o,t,e,r,i){}onDelXSignalsGroup(o,t,e,r){}onXSignals(o,t,e,r,i){}onDelXSignals(o,t,e,r){}onBoard(o,t,e,r){}onDelBoard(o,t,e){}onLayerFill(o,t,e,r,i){}onDelLayerFill(o,t,e,r){}constructor(o,t,e,r){super(o,t,e,new qPe,r)}canvasSelected(){return""}onSelectChange(o,t,e){}onSelectQuit(o,t){}async getByDataType(o){let t="";if(this.isProject?(this.dataBus=this.dataBus||JN(`/${this.windowId}/project/${this.path}`),t=await this.dataBus.rpcCall("/mgr/projectWorker/getDataByType",{doc:this.uuid,dataType:o})):(this.dataBus=this.dataBus||JN(`/${this.windowId}/libWorker`),t=await this.dataBus.rpcCall("/mgr/libWorker/getDataByType",{uuid:this.uuid,path:this.path,dataType:o,docType:"FOOTPRINT"})),!t)return{};let e=new H2t;return e.consistencyManager.parseFull(t,this.uuid,"FOOTPRINT"),e.data}async getPads(){return this.getByDataType("PAD")}onBlob(o,t,e,r,i){}onDelBlob(o,t,e,r){}onFont(o,t,e,r){}onDelFont(o,t,e,r){}onString(o,t,e,r,i,n){}onDelString(o,t,e,r){}onStringNum(o,t){}onAttr(o,t,e,r,i,n){}onDelAttr(o,t,e,r){}onAttrNum(o,t){}onPanelizeSide(o,t,e,r){}onDelPanelizeSide(o,t,e,r){}onPanelizeStamp(o,t,e,r){}onDelPanelizeStamp(o,t,e,r){}onPanelize(o,t,e,r){}onDelPanelize(o,t,e){}onRuleSelector(o,t,e,r){}onDelRuleSelector(o,t,e,r){}onRule(o,t,e,r){}onDelRule(o,t,e,r,i){}onRuleTemplate(o,t,e,r){}onDimension(o,t,e,r,i,n){}onDelDimension(o,t,e,r){}onDimensionNum(o,t){}onBoss(o,t,e,r,i,n){}onDelBoss(o,t,e,r){}onBossNum(o,t){}onShellEntity(o,t,e,r,i,n){}onDelShellEntity(o,t,e,r){}onShellEntityNum(o,t){}onShellCut(o,t,e,r,i,n){}onDelShellCut(o,t,e,r){}onShellCutNum(o,t){}onCrease(o,t,e,r,i,n){}onDelCrease(o,t,e,r){}onCreaseNum(o,t){}onShell(o,t,e,r,i,n){}onDelShell(o,t,e,r){}onShellNum(o,t){}onFpcFill(o,t,e,r,i,n){}onDelFpcFill(o,t,e,r){}onFpcFillNum(o,t){}onTeardrop(o,t,e,r,i,n){}onDelTeardrop(o,t,e,r){}onTeardropNum(o,t){}onImage(o,t,e,r,i,n){}onDelImage(o,t,e,r){}onImageNum(o,t){}onPoured(o,t,e,r,i,n){}onDelPoured(o,t,e,r){}onPouredNum(o,t){}onPour(o,t,e,r,i,n){}onDelPour(o,t,e,r){}onPourNum(o,t){}onRegion(o,t,e,r,i,n){}onDelRegion(o,t,e,r){}onRegionNum(o,t){}onFill(o,t,e,r,i,n){}onDelFill(o,t,e,r){}onFillNum(o,t){}onPoly(o,t,e,r,i,n){}onDelPoly(o,t,e,r){}onPolyNum(o,t){}onEQLenGrp(o,t,e,r,i){}onDelEQLenGrp(o,t,e,r){}onDelProp(o,t,e,r){}onObj(o,t,e,r,i,n){}onDelObj(o,t,e,r){}onObjNum(o,t){}onArc(o,t,e,r,i,n){}onDelArc(o,t,e,r){}onArcNum(o,t){}onCArc(o,t,e,r,i,n){}onDelCArc(o,t,e,r){}onCArcNum(o,t){}onLine(o,t,e,r,i,n){}onDelLine(o,t,e,r){}onLineNum(o,t){}onPad(o,t,e,r,i,n){}onDelPad(o,t,e,r){}onPadNum(o,t){}onVia(o,t,e,r,i,n){}onDelVia(o,t,e,r){}onViaNum(o,t){}onDelConnect(o,t,e,r){}onPreference(o,t,e,r){}onSilkOpts(o,t,e,r,i){}onDelSilkOpts(o,t,e,r){}onGroup(o,t,e,r,i){}onDelGroup(o,t,e,r){}onPrimitive(o,t,e,r,i){}onDelPrimitive(o,t,e,r){}onNet(o,t,e,r,i){}onDelNet(o,t,e,r){}onPartition(o,t,e,r,i,n){}onDelPartition(o,t,e,r){}onPartitionNum(o,t){}onEditorMeta(o,t,e,r){}onDocDetail(o,t,e,r){}onActiveLayer(o,t,e,r){}onLayerPhys(o,t,e,r,i){}onDelLayerPhys(o,t,e,r){}onLayer(o,t,e,r,i){}onDelLayer(o,t,e,r){}onCanvas(o,t,e,r){}},e7e=(o=>(o.LIST="/pro-mgr/api/project/list",o.CREATE="/pro-mgr/api/project/create",o.GET="/pro-mgr/api/project/get",o.UPDATE="/pro-mgr/api/project/update",o.DELETE="/pro-mgr/api/project/delete",o.TICKET="/pro-mgr/api/project/ticket",o.TICKET1="/pro-mgr/api/project/ticket1",o.BACKUP_LIST="/pro-mgr/api/project/backupList",o.BACKUP="/pro-mgr/api/project/backup",o.GET_BACKUP="/pro-mgr/api/project/getBackup",o.DELETE_BACKUP="/pro-mgr/api/project/deleteBackup",o.ARCHIVE="/pro-mgr/api/project/archive",o.CREATE_BOARD="/pro-mgr/api/project/createBoards",o.STAR="/pro-mgr/api/project/star",o.UNSTAR="/pro-mgr/api/project/unstar",o.GET_PROFILE="/pro-mgr/api/project/getProfile",o))(e7e||{}),t7e=(o=>(o.LIST="/pro-mgr/api/branch/list",o.GET="/pro-mgr/api/branch/get",o.CREATE="/pro-mgr/api/branch/create",o.UPDATE="/pro-mgr/api/branch/update",o.DELETE="/pro-mgr/api/branch/delete",o))(t7e||{}),r7e=(o=>(o.LIST="/pro-mgr/api/schematic/list",o.CREATE="/pro-mgr/api/schematic/create",o.UPLOAD="/pro-mgr/api/schematic/upload",o.DELETE="/pro-mgr/api/schematic/delete",o.UPDATE="/pro-mgr/api/schematic/update",o))(r7e||{}),i7e=(o=>(o.LIST="/pro-mgr/api/document/list",o.SEARCH_LIST="/pro-mgr/api/document/searchList",o.CREATE="/pro-mgr/api/document/create",o.UPLOAD="/pro-mgr/api/document/upload",o.UPDATE="/pro-mgr/api/document/update",o.BATCH_UPDATE="/pro-mgr/api/document/batchUpdate",o.DELETE="/pro-mgr/api/document/delete",o.GET="/pro-mgr/api/document/get",o.GET_BY_SID="/pro-mgr/api/document/getBySid",o.MOVE="/pro-mgr/api/document/move",o.CHECK_IN="/pro-mgr/api/document/checkIn",o.CHECK_OUT="/pro-mgr/api/document/checkOut",o.GET_CHECK="/pro-mgr/api/document/getCheck",o.DELETE_PCB_RELATED="/pro-mgr/api/document/deletePcbRelated",o))(i7e||{}),n7e=(o=>(o.LIST="/pro-mgr/api/device/list",o.SEARCH_LIST="/pro-mgr/api/device/searchList",o.CREATE="/pro-mgr/api/device/create",o.UPLOAD="/pro-mgr/api/device/upload",o.UPDATE="/pro-mgr/api/device/update",o.BATCH_UPDATE="/pro-mgr/api/device/batchUpdate",o.GET="/pro-mgr/api/device/get",o.SEARCH_BY_USERS_AND_TITLES="/pro-mgr/api/device/searchByUsersAndTitles",o.GET_ATTR_VALUES="/pro-mgr/api/device/getAttributeValues",o.GET_ATTR_KEYS="/pro-mgr/api/device/getAttrKeys",o.DELETE="/pro-mgr/api/device/delete",o.STAR="/pro-mgr/api/device/star",o.UNSTAR="/pro-mgr/api/device/unstar",o.PLACE="/pro-mgr/api/device/place",o))(n7e||{}),o7e=(o=>(o.LIST="/pro-mgr/api/component/list",o.SEARCH_LIST="/pro-mgr/api/component/searchList",o.CREATE="/pro-mgr/api/component/create",o.UPLOAD="/pro-mgr/api/component/upload",o.UPDATE="/pro-mgr/api/component/update",o.BATCH_UPDATE="/pro-mgr/api/component/batchUpdate",o.DELETE="/pro-mgr/api/component/delete",o.GET="/pro-mgr/api/component/get",o.SEARCH_BY_USERS_AND_TITLES="/pro-mgr/api/component/searchByUsersAndTitles",o.STAR="/pro-mgr/api/component/star",o.UNSTAR="/pro-mgr/api/component/unstar",o.GET_HISTORY="/pro-mgr/api/component/getHistory",o.SET_HISTORY="/pro-mgr/api/component/setHistory",o.GET_HISTORY_DATA="/pro-mgr/api/component/getHistoryData",o))(o7e||{}),s7e=(o=>(o.LIST="/pro-mgr/api/tag/list",o.CREATE="/pro-mgr/api/tag/create",o.UPDATE="/pro-mgr/api/tag/update",o.DELETE="/pro-mgr/api/tag/delete",o))(s7e||{}),a7e=(o=>(o.SEARCH_LIST="/pro-mgr/api/copper/searchList",o.SET="/pro-mgr/api/copper/set",o.DELETE="/pro-mgr/api/copper/delete",o))(a7e||{}),l7e=(o=>(o.SEARCH_LIST="/pro-mgr/api/font/searchList",o.SET="/pro-mgr/api/font/set",o.DELETE="/pro-mgr/api/font/delete",o))(l7e||{}),c7e=(o=>(o.SEARCH_LIST="/pro-mgr/api/blob/searchList",o.SET="/pro-mgr/api/blob/set",o))(c7e||{}),h7e=(o=>(o.LIST="/pro-mgr/api/attr/list",o.SEARCH_LIST="/pro-mgr/api/attr/searchList",o.CREATE="/pro-mgr/api/attr/create",o.UPLOAD="/pro-mgr/api/attr/upload",o.DELETE="/pro-mgr/api/attr/delete",o.TICKET="/pro-mgr/api/attr/ticket",o))(h7e||{}),u7e=(o=>(o.GET_BACKUP="/pro-mgr/api/client/getBackup",o.GET_LIBS="/pro-mgr/api/client/getLibs",o.CREATE_LIB="/pro-mgr/api/client/createLib",o.CREATE_PROJECT="/pro-mgr/api/client/createProject",o.OPEN_PROJECT="/pro-mgr/api/client/openProject",o.DELETE_PROJECT="/pro-mgr/api/client/deleteProject",o.COPY_PROJECT="/pro-mgr/api/client/copyProject",o.CLOSE_PROJECT="/pro-mgr/api/client/closeProject",o.GET_PROJECT_PATHS="/pro-mgr/api/client/getProjectPaths",o.SELECT_PATH="/pro-mgr/api/client/selectPath",o.OPEN_DIALOG="/pro-mgr/api/client/openDialog",o.SELECT_DIR="/pro-mgr/api/client/selectDir",o.SELECT_FILE="/pro-mgr/api/client/selectFile",o.EXPORT_FILE="/pro-mgr/api/client/exportFile",o.CACHE_LIST="/pro-mgr/api/client/cacheList",o.GET_CACHE="/pro-mgr/api/client/getCache",o.SET_CACHE="/pro-mgr/api/client/setCache",o.DELETE_CACHE="/pro-mgr/api/client/deleteCache",o.PROJECT_HISTORY="/pro-mgr/api/client/projectHistory",o.DELETE_HISTORY="/pro-mgr/api/client/deletHistory",o.IS_EXIST_KV_CACHE="/pro-mgr/api/client/isExistKVCache",o.OPEN_URL="/pro-mgr/api/client/openURL",o))(u7e||{}),d7e=(o=>(o.LOG="/pro-mgr/api/other/log",o.COMPONENT_LOG="/pro-mgr/api/other/componentLog",o.TEAMS="/pro-mgr/api/other/teams",o.GET_EDITOR_VERSION="/pro-mgr/api/other/getEditorVersion",o.SET_EDITOR_VERSION="/pro-mgr/api/other/setEditorVersion",o))(d7e||{}),vO={PROJECT:e7e,BRANCH:t7e,SCHEMATIC:r7e,DOCUMENT:i7e,DEVICE:n7e,COMPONENT:o7e,TAG:s7e,COPPER:a7e,FONT:l7e,BLOB:c7e,ATTR:h7e,CLIENT:u7e,OTHER:d7e},bQ=$W(KW()),NW={bus:void 0,get messageBus(){if(NW.bus===void 0)if(typeof window<"u"){let o=Q();o._MSG_BUS_=o._MSG_BUS_||new bQ.MessageBus,NW.bus=o._MSG_BUS_}else self._WORKER_BUS_=self._WORKER_BUS_||new bQ.WorkerMessageBridge(new bQ.MessageBus,self),NW.bus=self._WORKER_BUS_;return NW.bus},get messageBus2(){return self._MSG_BUS2_=self._MSG_BUS2_||new bQ.MessageBus2},loginedUserUuid:void 0},on=NW,z2t=(o=>(o[o.COMPONENT=2]="COMPONENT",o[o.NET_FLAG=18]="NET_FLAG",o[o.NET_PORT=19]="NET_PORT",o[o.DRAWING=20]="DRAWING",o[o.NON_ELECTRICAL=21]="NON_ELECTRICAL",o[o.SHORT_CIRCUIT_FLAG=22]="SHORT_CIRCUIT_FLAG",o[o.BLOCK_SYMBOL=17]="BLOCK_SYMBOL",o))(z2t||{}),Y2t=(o=>(o.SYMBOL="S",o.FOOTPRINT="F",o.PRODUCT="P",o.MODEL_3D="3D",o))(Y2t||{}),j2t=(o=>(o.BOTTOM_COMPONENT_LIB="BOTTOM_COMPONENT_LIB",o.DIALOG="DIALOG",o))(j2t||{}),X2t=["S","F","P","3D"],q2t=["F","3D"],$2t=(o=>(o.ZIP=".zip",o.PRJ=".epro",o.PRJ2=".epro2",o.EPRU=".epru",o.SCH=".esch",o.PCB=".epcb",o.PANEL=".epan",o.PANEL_LIB=".epanl",o.SYMBOL=".esym",o.FOOTPRINT=".efoo",o.INSTANCE=".eins",o.COPPER=".ecop",o.BLOB=".eblob",o.FONT=".efon",o.ELIBZ=".elibz",o.ELIBZ2=".elibz2",o.ELIBU=".elibu",o.IMAGE=".webp",o))($2t||{}),fv="|",K2t=/^[^|]+(\|[^|]+)?$/,Z2t=(o=>(o.Board="Board",o.Schematic="Schematic",o.Sheet="Sheet",o.Simulation="Simulation",o.Pcb="Pcb",o.Panel="Panel",o.SchCanvas="SchCanvas",o.PcbCanvas="PcbCanvas",o.PanelCanvas="PanelCanvas",o.SimulationCanvas="SimulationCanvas",o))(Z2t||{}),J2t=(o=>(o.Device="Device",o.Symbol="Symbol",o.Footprint="Footprint",o))(J2t||{}),Y6e=[{value:"",text:"All"},{value:2,text:"Component"},{value:20,text:{content:"symbolType",value:"Drawing",options:null}},{value:18,text:"Net Flag"},{value:19,text:"Net Port"},{value:25,text:"Off Page Connector"},{value:31,text:"Differential Pairs Flag"},{value:21,text:{content:"symbolType",value:"Non-Electronic Flag",options:null}},{value:22,text:"Short Flag"}],j6e=[{value:"",text:"All"},{value:2,text:"Component Symbol"},{value:20,text:"Drawing Symbol"},{value:18,text:"Netflag Symbol"},{value:19,text:"Netport Symbol"},{value:25,text:"Off Page Connector Symbol"},{value:31,text:"Differential Pairs Flag Symbol"},{value:21,text:"Non-Electronic Symbol"},{value:22,text:"Short Flag"}],Q2t=["S"],ebt=["S"],tbt=["S"],rbt=["3D"],ibt={footprint:q2t,device:X2t,symbol:Q2t,model3D:rbt,panelLib:ebt,cbb:tbt,modelSimLib:[]},nbt=(o=>(o.eprj=".eprj",o.eprj_backup=".eprj_backup",o.eprj2=".eprj2",o))(nbt||{});async function obt(o){let t=new TextEncoder().encode(o),e=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(e)).map(r=>r.toString(16).padStart(2,"0")).join("")}var p7e=[2,20,18,19,21,22,17,25,31];function jQ(o){return o&&p7e.indexOf(o)>=0}function f7e(o){return p7e.indexOf(o)>=0&&o!==17}function sbt(o){return o===""?!1:!!(o&&K2t.test(o))}var abt=async o=>{let{keys:t,values:e}=m7e(o);return await obt([...t,...e].sort().join(""))},m7e=o=>{let t=new Set,e=new Set;for(let r in o){let i=o[r];if(t.add(r),Array.isArray(i))e.add(JSON.stringify(i.sort()));else if(Object.prototype.toString.call(i)==="[object Object]"){let{keys:n,values:s}=m7e(i);t=new Set([...t,...n]),e=new Set([...e,...s])}else e.add(JSON.stringify(i))}return{keys:t,values:e}};function X6e(o){let{uuid:t,path:e}=o;return t?t+(e?`${fv}${e}`:""):void 0}function lbt(o){let{source:t,path:e}=o;return t+(e?`${fv}${e}`:"")}async function Zbe(o,t){if(t)return t;let{updateTime:e}=o;return e?String(e):await abt(o)}async function cbt(o){let{data:t,force:e=!0,defalut:r}=o,{source:i,version:n}=t;i?(sbt(i)||(t.source=X6e(t)),i.includes(fv)||(t.source=lbt(t)),n?n==="1"&&(t.version=await Zbe(t)):t.version=await Zbe(t,r)):e&&(t.source=X6e(t),t.version=await Zbe(t,r))}function g7e(){let o=navigator.userLanguage||navigator.language;return o&&o.includes("zh")?"zh-cn":"en"}function Jbe(o){let{tags:t,custom_tags:e="[]"}=o;if(e==="[object Object]"&&(e=""),(!e||typeof e!="string"||e==="[]")&&t){if(Array.isArray(t)&&t.length)e=JSON.stringify(t);else if(Object.prototype.toString.call(t)==="[object Object]"){let r=g7e()==="en",i=[];if(t.parent_tag){let{name:n,name_cn:s}=t.parent_tag;if(r&&n?i.push(n):!r&&s?i.push(s):n&&i.push(n),t.child_tag){let{name:a,name_cn:l}=t.child_tag;r&&a?i.push(a):!r&&l?i.push(l):a&&i.push(a)}}e=JSON.stringify(i)}}return o.custom_tags=e,o.custom_tags}function Jg(o){return String(o).length===13?Number(o):String(o).length===10?Number(o)*1e3:Number(o)}function nk(o){var t;return o.path||o.project_uuid||((t=o.owner)==null?void 0:t.uuid)}var hbt=$W(KW()),y7e=(o=>o)(y7e||{}),b7e=(o=>(o.GET="/PrjDB/project/getData",o.UPDATE="/PrjDB/project/updateData",o.COUNT_DOC="/PrjDB/project/countDoc",o.GET_HISTORY_NODE="/PrjDB/project/getHistoricalNodes",o.GET_HISTORY_UPDATETIME="/PrjDB/project/getHistoryUpdatetime",o.GET_HISTORY_PROJECT="/PrjDB/project/getHistoricalProject",o.START_BATCH_UPLOAD="/PrjDB/project/startBatchUpload",o.END_BATCH_UPLOAD="/PrjDB/project/endBatchUpload",o.AWAIT_UPLOAD_END="/PrjDB/project/awaitUploadEnd",o.GET_MAX_TICKET="/PrjDB/project/getMaxTicket",o.GET_DOC_MAX_TICKET="/PrjDB/project/getDocMaxTicket",o.SAVE_PEND_DATA="/PrjDB/project/savePendData",o.REVOKE_PEND_DATA="/PrjDB/project/revokePendData",o.GET_CLIENT="/PrjDB/project/getClient",o.GET_BRANCH_DATA="/PrjDB/project/getBranchData",o.HISTORIES="/PrjDB/project/histories",o.COMPRESS="/PrjDB/project/compress",o.FLOW_WRITE="/PrjDB/project/flowWrite",o.GET_RELATED="/PrjDB/project/getRelated",o))(b7e||{}),P7e=(o=>(o.GET="/PrjDB/config/getData",o.UPDATE="/PrjDB/config/updateData",o))(P7e||{}),T7e=(o=>(o.GET="/PrjDB/board/getData",o.ADD="/PrjDB/board/addData",o.UPDATE="/PrjDB/board/updateData",o.DELETE="/PrjDB/board/deleteData",o.GET_ALL_KV="/PrjDB/board/getAllKVData",o.GET_ALL_ARR="/PrjDB/board/getAllArrData",o.TRY_RENAME="/PrjDB/board/tryRename",o.IS_RENAME="/PrjDB/board/isRename",o.BATCH_DELETE="/PrjDB/board/batchDelete",o.GET_BIND_KEYS="/PrjDB/board/getBindKeys",o))(T7e||{}),I7e=(o=>(o.GET="/PrjDB/schematic/getData",o.GET_BY_NAME="/PrjDB/schematic/getDataByName",o.TRY_RENAME="/PrjDB/schematic/tryRename",o.UPDATE_IN_LOCAL="/PrjDB/schematic/updateDataInLocal",o.ADD="/PrjDB/schematic/addData",o.UPDATE="/PrjDB/schematic/updateData",o.DEL="/PrjDB/schematic/delData",o.GET_ALL_KV="/PrjDB/schematic/getAllKVDatas",o.GET_UUID_BY_NAME="/PrjDB/schematic/getIdByName",o.GET_NAME_BY_UUID="/PrjDB/schematic/getNameById",o.GET_DISPLAY_NAME_BY_UUID="/PrjDB/schematic/getDisplayNameById",o.GET_ALL_ARR="/PrjDB/schematic/getAllArrDatas",o.GET_BY_SOURCE_VERSION="/PrjDB/schematic/getDataBySourceAndVersion",o.GET_LAST="/PrjDB/schematic/getLastData",o.GET_ALL_ARR_BY_SOURCE="/PrjDB/schematic/getAllArrDatasBySource",o.IS_RENAME="/PrjDB/schematic/isRename",o.BATCH_DELETE="/PrjDB/schematic/batchDelete",o))(I7e||{}),C7e=(o=>(o.ADD="/PrjDB/sheet/addData",o.DEL="/PrjDB/sheet/delData",o.UPDATE="/PrjDB/sheet/updateData",o.UPDATE_LOTS="/PrjDB/sheet/updateLotDatas",o.GET_ALL_KV="/PrjDB/sheet/getAllKVDatas",o.GET="/PrjDB/sheet/getData",o.GET_ALL_ARR="/PrjDB/sheet/getAllArrDatas",o.GET_LOTS_ARR="/PrjDB/sheet/getLotsArrDatas",o.GET_CANVAS="/PrjDB/sheet/getCanvas",o.SET_CANVAS="/PrjDB/sheet/setCanvas",o.WATCH_CANVAS_UPDATE="/PrjDB/sheet/watchCanvas",o.UNWATCH_CANVAS_UPDATE="/PrjDB/sheet/unwatchCanvas",o.GET_BY_SOURCE_VERSION="/PrjDB/sheet/getDataBySourceAndVersion",o.GET_LAST="/PrjDB/sheet/getLastData",o.GET_ALL_ARR_BY_SOURCE="/PrjDB/sheet/getAllArrDatasBySource",o.TRY_RENAME="/PrjDB/sheet/tryRename",o.IS_RENAME="/PrjDB/sheet/isRename",o.BATCH_DELETE="/PrjDB/sheet/batchDelete",o.GET_ALL_KEYS="/PrjDB/sheet/getAllPrimaryKeys",o))(C7e||{}),S7e=(o=>(o.ADD="/PrjDB/simulation/addData",o.DEL="/PrjDB/simulation/delData",o.UPDATE="/PrjDB/simulation/updateData",o.UPDATE_LOTS="/PrjDB/simulation/updateLotDatas",o.GET_ALL_KV="/PrjDB/simulation/getAllKVDatas",o.GET="/PrjDB/simulation/getData",o.GET_ALL_ARR="/PrjDB/simulation/getAllArrDatas",o.GET_LOTS_ARR="/PrjDB/simulation/getLotsArrDatas",o.GET_CANVAS="/PrjDB/simulation/getCanvas",o.SET_CANVAS="/PrjDB/simulation/setCanvas",o.WATCH_CANVAS_UPDATE="/PrjDB/simulation/watchCanvas",o.UNWATCH_CANVAS_UPDATE="/PrjDB/simulation/unwatchCanvas",o.GET_BY_SOURCE_VERSION="/PrjDB/simulation/getDataBySourceAndVersion",o.GET_LAST="/PrjDB/simulation/getLastData",o.GET_ALL_ARR_BY_SOURCE="/PrjDB/simulation/getAllArrDatasBySource",o.TRY_RENAME="/PrjDB/simulation/tryRename",o.IS_RENAME="/PrjDB/simulation/isRename",o.BATCH_DELETE="/PrjDB/simulation/batchDelete",o.GET_ALL_KEYS="/PrjDB/simulation/getAllPrimaryKeys",o))(S7e||{}),E7e=(o=>(o.GET="/PrjDB/pcb/getData",o.GET_BY_TITLE="/PrjDB/pcb/getDataByTitle",o.GET_UUID_BY_TITLE="/PrjDB/pcb/getIdByTitle",o.ADD="/PrjDB/pcb/addData",o.DEL="/PrjDB/pcb/delData",o.CREATE_SUB="/PrjDB/pcb/createSub",o.UPDATE_SUB="/PrjDB/pcb/updateSubInherit",o.UPDATE="/PrjDB/pcb/updateData",o.UPDATE_LOTS="/PrjDB/pcb/updateLotDatas",o.GET_ALL_KV="/PrjDB/pcb/getAllKVDatas",o.GET_ALL_ARR="/PrjDB/pcb/getAllArrDatas",o.GET_CANVAS="/PrjDB/pcb/getCanvas",o.SET_CANVAS="/PrjDB/pcb/setCanvas",o.WATCH_CANVAS_UPDATE="/PrjDB/pcb/watchCanvas",o.UNWATCH_CANVAS_UPDATE="/PrjDB/pcb/unwatchCanvas",o.GET_BY_SOURCE_VERSION="/PrjDB/pcb/getDataBySourceAndVersion",o.GET_LAST="/PrjDB/pcb/getLastData",o.GET_ALL_ARR_BY_SOURCE="/PrjDB/pcb/getAllArrDatasBySource",o.TRY_RENAME="/PrjDB/pcb/tryRename",o.IS_RENAME="/PrjDB/pcb/isRename",o.BATCH_DELETE="/PrjDB/pcb/batchDelete",o.GET_ALL_KEYS="/PrjDB/pcb/getAllPrimaryKeys",o))(E7e||{}),O7e=(o=>(o.GET="/PrjDB/panel/getData",o.ADD="/PrjDB/panel/addData",o.DEL="/PrjDB/panel/delData",o.UPDATE="/PrjDB/panel/updateData",o.UPDATE_LOTS="/PrjDB/panel/updateLotDatas",o.GET_ALL_KV="/PrjDB/panel/getAllKVDatas",o.GET_ALL_ARR="/PrjDB/panel/getAllArrDatas",o.GET_CANVAS="/PrjDB/panel/getCanvas",o.SET_CANVAS="/PrjDB/panel/setCanvas",o.WATCH_CANVAS_UPDATE="/PrjDB/panel/watchCanvas",o.UNWATCH_CANVAS_UPDATE="/PrjDB/panel/unwatchCanvas",o.TRY_RENAME="/PrjDB/panel/tryRename",o.IS_RENAME="/PrjDB/panel/isRename",o.BATCH_DELETE="/PrjDB/panel/batchDelete",o.GET_ALL_KEYS="/PrjDB/panel/getAllPrimaryKeys",o))(O7e||{}),A7e=(o=>(o.GET_BY_TITLE="/PrjDB/symbol/getDataByTitle",o.GET="/PrjDB/symbol/getData",o.ADD="/PrjDB/symbol/addData",o.CREATE="/PrjDB/symbol/createData",o.COVER="/PrjDB/symbol/coverData",o.CLONE="/PrjDB/symbol/cloneData",o.DEL="/PrjDB/symbol/delData",o.UPDATE="/PrjDB/symbol/updateData",o.GET_UUIDS_BY_TITLE="/PrjDB/symbol/getIdsByTitle",o.GET_TITLE_BY_UUID="/PrjDB/symbol/getTitleById",o.GET_ALL_KV="/PrjDB/symbol/getAllKVDatas",o.GET_BY_SOURCE_VERSION="/PrjDB/symbol/getDataBySourceAndVersion",o.GET_COMPARE_TICKET="/PrjDB/symbol/getDataCompareTicket",o.GET_LAST="/PrjDB/symbol/getLastData",o.IS_EXIST="/PrjDB/symbol/isExist",o.GET_ALL_KEYS="/PrjDB/symbol/getAllPrimaryKeys",o.GET_TYPE_KEYS="/PrjDB/symbol/getTypePrimaryKeys",o.GET_ALL_ARR="/PrjDB/symbol/getAllArrDatas",o.GET_ALL_ARR_BY_SOURCE="/PrjDB/symbol/getAllArrDatasBySource",o.GET_KEYS_BY_SOURCE="/PrjDB/symbol/getKeysBySource",o.GET_ALL_ARR_BY_TYPE="/PrjDB/symbol/getTypeDatas",o.GET_STR="/PrjDB/symbol/getStr",o.GET_CANVAS="/PrjDB/symbol/getCanvas",o.SET_CANVAS="/PrjDB/symbol/setCanvas",o.WATCH_CANVAS_UPDATE="/PrjDB/symbol/watchCanvas",o.UNWATCH_CANVAS_UPDATE="/PrjDB/symbol/unwatchCanvas",o.TRY_RENAME="/PrjDB/symbol/tryRename",o.WITH_ORIGINS="/PrjDB/symbol/withOrigins",o.IS_RENAME="/PrjDB/symbol/isRename",o.IS_CHANGE="/PrjDB/symbol/isChange",o.BATCH_DELETE="/PrjDB/symbol/batchDelete",o.GET_LIST="/PrjDB/symbol/getList",o))(A7e||{}),_7e=(o=>(o.GET_BY_TITLE="/PrjDB/footprint/getDataByTitle",o.GET="/PrjDB/footprint/getData",o.IS_EXIST="/PrjDB/footprint/isExist",o.ADD="/PrjDB/footprint/addData",o.CREATE="/PrjDB/footprint/createData",o.COVER="/PrjDB/footprint/coverData",o.CLONE="/PrjDB/footprint/cloneData",o.DEL="/PrjDB/footprint/delData",o.GET_ALL_KV="/PrjDB/footprint/getAllKVDatas",o.UPDATE="/PrjDB/footprint/updateData",o.UPDATE_IN_LOCAL="/PrjDB/footprint/updateDataInLocal",o.GET_TITLE_BY_UUID="/PrjDB/footprint/getTitleById",o.GET_BY_SOURCE_VERSION="/PrjDB/footprint/getDataBySourceAndVersion",o.GET_COMPARE_TICKET="/PrjDB/footprint/getDataCompareTicket",o.GET_LAST="/PrjDB/footprint/getLastData",o.GET_ALL_KEYS="/PrjDB/footprint/getAllPrimaryKeys",o.GET_ALL_ARR="/PrjDB/footprint/getAllArrDatas",o.GET_ALL_ARR_BY_SOURCE="/PrjDB/footprint/getAllArrDatasBySource",o.GET_KEYS_BY_SOURCE="/PrjDB/footprint/getKeysBySource",o.GET_ALL_ARR_BY_PCB_UUID="/PrjDB/footprint/getAllArrDatasByPcbId",o.GET_KEYS_BY_PCB_UUID="/PrjDB/footprint/getKeysByPcbId",o.GET_STR="/PrjDB/footprint/getStr",o.GET_CANVAS="/PrjDB/footprint/getCanvas",o.SET_CANVAS="/PrjDB/footprint/setCanvas",o.WATCH_CANVAS_UPDATE="/PrjDB/footprint/watchCanvas",o.UNWATCH_CANVAS_UPDATE="/PrjDB/footprint/unwatchCanvas",o.TRY_RENAME="/PrjDB/footprint/tryRename",o.WITH_ORIGINS="/PrjDB/footprint/withOrigins",o.IS_CHANGE="/PrjDB/footprint/isChange",o.IS_RENAME="/PrjDB/footprint/isRename",o.BATCH_DELETE="/PrjDB/footprint/batchDelete",o.GET_LIST="/PrjDB/footprint/getList",o))(_7e||{}),v7e=(o=>(o.GET="/PrjDB/device/getData",o.GET_ATTRIBUTES_KEYS="/PrjDB/device/getDeviceAttributesKeys",o.GET_ATTRIBUTES_VALUES="/PrjDB/device/getDeviceAttributesValues",o.GET_BY_TITLE="/PrjDB/device/getDataByTitle",o.ADD="/PrjDB/device/addData",o.CREATE="/PrjDB/device/createData",o.DEL="/PrjDB/device/delData",o.GET_ALL_KV="/PrjDB/device/getAllKVDatas",o.UPDATE="/PrjDB/device/updateData",o.GET_TITLE_BY_UUID="/PrjDB/device/getTitleById",o.GET_SYMBOL_UUID="/PrjDB/device/getSymbolIdById",o.GET_BY_SOURCE_VERSION="/PrjDB/device/getDataBySourceAndVersion",o.GET_LAST="/PrjDB/device/getLastData",o.GET_ALL_ARR_BY_SOURCE="/PrjDB/device/getAllArrDatasBySource",o.GET_KEYS_BY_SOURCE="/PrjDB/device/getKeysBySource",o.GET_COMPARE_TICKET="/PrjDB/device/getDataCompareTicket",o.IS_EXIST="/PrjDB/device/isExist",o.GET_ALL_KEYS="/PrjDB/device/getAllPrimaryKeys",o.GET_ALL_ARR="/PrjDB/device/getAllArrDatas",o.GET_ALL_ARR_BY_SYMBOL_UUID="/PrjDB/device/getAllArrDatasBySymbolId",o.GET_ALL_ARR_BY_FOOTPRINT_UUID="/PrjDB/device/getAllArrDatasByfootprintId",o.TRY_RENAME="/PrjDB/device/tryRename",o.BIND_SYMBOL="/PrjDB/device/bindSymbol",o.BIND_fOOTPRINT="/PrjDB/device/bindFootprint",o.WITH_ORIGINS="/PrjDB/device/withOrigins",o.IS_CHANGE="/PrjDB/device/isChange",o.IS_RENAME="/PrjDB/device/isRename",o.BATCH_DELETE="/PrjDB/device/batchDelete",o.GET_LIST="/PrjDB/device/getList",o))(v7e||{}),x7e=(o=>(o.GET="/PrjDB/attr/getData",o.UPDATE="/PrjDB/attr/updateData",o.BATCH_UPDATE="/PrjDB/attr/batchUpdateData",o.ADD="/PrjDB/attr/addData",o.DEL="/PrjDB/attr/delData",o.GET_ALL_KV="/PrjDB/attr/getAllKVDatas",o.GET_ALL_ARR="/PrjDB/attr/getAllArrDatas",o.GET_ALL_ARR_BY_HASH="/PrjDB/attr/getAllArrDatasByHash",o.BATCH_DELETE="/PrjDB/attr/batchDelete",o))(x7e||{}),R7e=(o=>(o.GET="/PrjDB/blob/getData",o.ADD="/PrjDB/blob/addData",o.DEL="/PrjDB/blob/delData",o.GET_ALL_ARR="/PrjDB/blob/getAllArrDatas",o.BATCH_DELETE="/PrjDB/blob/batchDelete",o))(R7e||{}),D7e=(o=>(o.GET="/PrjDB/copper/getData",o.ADD="/PrjDB/copper/addData",o.DEL_LOTS="/PrjDB/copper/delLotDatas",o.DEL="/PrjDB/copper/delData",o.GET_ALL_KEYS="/PrjDB/copper/getAllPrimaryKeys",o.UPDATE="/PrjDB/copper/updateData",o.GET_ALL_ARR="/PrjDB/copper/getAllArrDatas",o.GET_ALL_ARR_BY_PCB_UUID="/PrjDB/copper/getAllArrDatasByPcbId",o.GET_ALL_KEYS_BY_PCB_UUID="/PrjDB/copper/getAllArrKeysByPcbId",o))(D7e||{}),w7e=(o=>(o.GET="/PrjDB/font/getData",o.ADD="/PrjDB/font/addData",o.DEL_LOTS="/PrjDB/font/delLotDatas",o.DEL="/PrjDB/font/delData",o.GET_ALL_KEYS="/PrjDB/font/getAllPrimaryKeys",o.UPDATE="/PrjDB/font/updateData",o.GET_ALL_ARR="/PrjDB/font/getAllArrDatas",o.GET_ALL_ARR_BY_PCB_UUID="/PrjDB/font/getAllArrDatasByPcbId",o.GET_ALL_KEYS_BY_PCB_UUID="/PrjDB/font/getAllArrKeysByPcbId",o))(w7e||{}),L7e=(o=>(o.BATCH_ADD="/PrjDB/variant/batchAddVariant",o.ADD="/PrjDB/variant/addData",o.DELETE="/PrjDB/variant/deleteData",o.BATCH_DELETE="/PrjDB/variant/batchDeleteData",o.BATCH_RESTORE="/PrjDB/variant/batchRestoreData",o.GET="/PrjDB/variant/getData",o.GET_ALL_ARR_BY_SID="/PrjDB/variant/getAllArrDatasBySid",o.UPDATE_TITLE="/PrjDB/variant/updateTitle",o.UPDATE_NOT_GROUPED="/PrjDB/variant/updateNotGrouped",o.BATCH_UPDATE_SORT="/PrjDB/variant/batchUpdateZIndex",o))(L7e||{}),M7e=(o=>(o.BATCH_ADD="/PrjDB/componentGroup/batchAddData",o.ADD="/PrjDB/componentGroup/addData",o.DELETE="/PrjDB/componentGroup/deleteData",o.BATCH_DELETE="/PrjDB/componentGroup/batchDeleteData",o.BATCH_RESTORE="/PrjDB/componentGroup/batchRestoreData",o.GET="/PrjDB/componentGroup/getData",o.GET_ALL_ARR_BY_SID="/PrjDB/componentGroup/getAllArrDatasBySid",o.GET_ATTR_DATA="/PrjDB/componentGroup/getComponentGroupData",o.UPDATE_TITLE="/PrjDB/componentGroup/updateTitle",o.BATCH_UPDATE_SORT="/PrjDB/componentGroup/batchUpdateZIndex",o.BATCH_UPLOAD_VARIANT_INDEX="/PrjDB/componentGroup/batchUploadGroupSortInVariant",o.BATCH_DELETE_VARIANT_INDEX="/PrjDB/componentGroup/batchDeleteGroupSortInVariant",o.UPLOAD_ATTR_DATA="/PrjDB/componentGroup/uploadComponentGroupData",o.BATCH_DELETE_ATTR_DATA="/PrjDB/componentGroup/batchDeleteComponentGroupData",o))(M7e||{}),Jo={VARIANT:L7e,COMPONENT_GROUP:M7e,COMMON:y7e,PROJECT:b7e,CONFIG:P7e,BOARD:T7e,SCHEMATIC:I7e,SHEET:C7e,SIMULATION:S7e,PCB:E7e,PANEL:O7e,SYMBOL:A7e,FOOTPRINT:_7e,DEVICE:v7e,ATTR:x7e,BLOB:R7e,COPPER:D7e,FONT:w7e};function mL(o){return!o.data}function ubt(o){return!!(o.path&&o.uuid&&o.docType&&o.isProject!==void 0&&Object.keys(o).length===4)}async function Pv(o){let{origin:t,target:e}=o;if(e.isProject){let r={uuid:e.uuid,data:t,overwriteCanvas:mL(t)};if(e.docType===4)return{success:(await on.messageBus.rpcCall(Jo.FOOTPRINT.COVER,[r,e.path])).message.success};if(jQ(e.docType))return{success:(await on.messageBus.rpcCall(Jo.SYMBOL.COVER,[r,e.path])).message.success};throw new Error("Api call error!")}else{let r=await o5e.getProLibSource(t);if(r.success===!1)return{success:!1,code:r.code,message:r.message};let i=r.result,n=await o5e.getProLibSource(e);if(n.success===!1)return{success:!1,code:n.code,message:n.message};let s=n.result,a=KT(),l;if(e.docType===4)l=vbe(s,i,{docType:kW.FOOTPRINT,uuid:e.uuid,client:a});else if(e.docType===29)l=vbe(s,i,{docType:kW.PANEL_LIB,uuid:e.uuid,client:a});else if(jQ(e.docType))l=vbe(s,i,{docType:kW.SYMBOL,uuid:e.uuid,client:a});else throw new Error("Api call error!");let c={path:e.path,uuid:e.uuid,dataStr:l},{message:h}=await on.messageBus.rpcCall(vO.COMPONENT.SET_HISTORY,c);return h.success===!1?{success:!1,code:h.code,message:h.message}:{success:!0}}}function $Pe(o){return self[o]=self[o]||new hbt.BroadcastChannelMessageBus(o)}async function dbt(o){let t=Q();return $Pe(`/${t._TAB_ID_}/notify`).rpcCall("/pro-ui/libSource/getProLibSource",o)}var pbt=(o=>(o.OPEN="/pro-mgr/project/open",o.CLOSE="/pro-mgr/project/close",o.TEMP_OPEN="/pro-mgr/project/tempOpen",o.TEMP_OPEN_BY_STRING="/pro-mgr/project/tempOpenByString",o.TEMP_CLOSE="/pro-mgr/project/tempClose",o.ON_OPENED="/pro-mgr/project/onOpened",o.ON_TEMP_OPENED="/pro-mgr/project/onTempOpened",o.BEFORE_CLOSE="/pro-mgr/project/beforeClose",o.ON_CLOSED="/pro-mgr/project/onClosed",o.ON_TEMP_CLOSED="/pro-mgr/project/onTempClosed",o.ON_FAILED="/pro-mgr/project/onFailed",o.GET_RECENT_PROJECT_LIST="/pro-mgr/getRecentPrjList",o.UPDATE_PROJECT="/pro-mgr/updateProject",o.DEL_PROJECT="/pro-mgr/deleteProject",o.HAS="/pro-mgr/hasProject",o))(pbt||{}),fbt=(o=>(o.SYSTEM="system",o.INTERNAL="Internal",o.PERSONAL="personal",o.PROJECT="project",o.STAR="star",o.TEAMS="teams",o.USER="user",o.CLIENT="client",o.PUBLIC="public",o.OSHWHUB="oshwhub",o.EXTEND="extend",o))(fbt||{}),mbt=(o=>(o.DEVICE="device",o.SYMBOL="symbol",o.FOOTPRINT="footprint",o.CBB="cbb",o.MODEL3D="model3D",o.PANEL_LIB="panelLib",o.MODEL_SIM_LIB="modelSimLib",o))(mbt||{}),KPe={D3Model:{client3DModelList:"api/client/steps"}},Ci=class{};Ci.CANVAS_UNIT_MM="mm",Ci.CANVAS_UNIT_MIL="mil",Ci.HEX_BLACK_COLOR="#000000",Ci.HEX_WHITE_COLOR="#FFFFFF",Ci.HEX_RED_COLOR="#FF0000",Ci.HEX_GREEN_COLOR="#00FF00",Ci.HEX_BLUE_COLOR="#0000FF",Ci.HEX_GRAY_COLOR1="#F1F1F1",Ci.HEX_GRAY_COLOR2="#EFEFEF",Ci.HEX_GRAY_COLOR3="#999999",Ci.HEX_GRAY_COLOR4="#666666",Ci.HEX_GRAY_COLOR5="#333333",Ci.HEX_GRAY_COLOR6="#CCCCCC",Ci.DEFAULT_PAGESIZE=50,Ci.SYMBOLTYPE_ITEM_ALL_VALUE="@all",Ci.SYMBOLTYPE_ITEM_ALL_TITLE="All",Ci.D3MVIEW_DEFAULT_TRANSFORM="0, 0, 0, 0, 0, 0, 0, 0, 0",Ci.DEVICE_INDEX_TAG="$_",Ci.DEVICE_SPLIT_TAG="@_",Ci.LIB_SPLIT_TAG="#_",Ci.CATEGORY_ITEM_ALL_VALUE="@all",Ci.CATEGORY_ITEM_ALL_TITLE="All",Ci.FAVORITELIB_UUID="star",Ci.SYSTEMLIB_UUID="0819f05c4eef4c71ace90d822a990e87",Ci.SYSTEMLIB_UUID_ALIAS="lcsc",Ci.USERLIB_ALIAS="mine",Ci.PUBLICLIB_ALIAS="user",Ci.STD_PUBLIC_LIB_UUID="stdPublic",Ci.RECENT_LIB_UUID="recent",Ci.INTERNAL_LIB_ALIAS="Internal",Ci.PERSIONAL_WORKSPACE="Personal",Ci.EDU_WORKSPACE="6d84b27f18f540b6a31c4d657314ab13",Ci.EDA_TEST_WORKSPACE="407ec92f2a2f4275bf08cbebf64f5e08",Ci.LIB_SYSTEM_KEY="system",Ci.LIB_PROJECT_KEY="project",Ci.LIB_PERSONAL_KEY="personal",Ci.LIB_PUBLIC_KEY="public",Ci.LIB_INTERNAL_KEY="Internal",Ci.LIB_FAVORITE_KEY="favorite",Ci.LIB_TEMAS_KEY="teams",Ci.API=KPe,Ci.ERR_CODE={NORMAL:-1,DUP_NAME:-9001};var q6e={},gbt=(function(o,t,e,r,i){var n=new Worker(q6e[t]||(q6e[t]=URL.createObjectURL(new Blob([o+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return n.onmessage=function(s){var a=s.data,l=a.$e$;if(l){var c=new Error(l[0]);c.code=l[1],c.stack=l[2],i(c,null)}else i(null,a)},n.postMessage(e,r),n}),rc=Uint8Array,o2=Uint16Array,nz=Int32Array,ok=new rc([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),sk=new rc([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),jW=new rc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),N7e=function(o,t){for(var e=new o2(31),r=0;r<31;++r)e[r]=t+=1<<o[r-1];for(var i=new nz(e[30]),r=1;r<30;++r)for(var n=e[r];n<e[r+1];++n)i[n]=n-e[r]<<5|r;return{b:e,r:i}},k7e=N7e(ok,2),ZPe=k7e.b,XQ=k7e.r;ZPe[28]=258,XQ[258]=28;var B7e=N7e(sk,0),F7e=B7e.b,IPe=B7e.r,XW=new o2(32768);for(xh=0;xh<32768;++xh)PO=(xh&43690)>>1|(xh&21845)<<1,PO=(PO&52428)>>2|(PO&13107)<<2,PO=(PO&61680)>>4|(PO&3855)<<4,XW[xh]=((PO&65280)>>8|(PO&255)<<8)>>1;var PO,xh,JT=(function(o,t,e){for(var r=o.length,i=0,n=new o2(t);i<r;++i)o[i]&&++n[o[i]-1];var s=new o2(t);for(i=1;i<t;++i)s[i]=s[i-1]+n[i-1]<<1;var a;if(e){a=new o2(1<<t);var l=15-t;for(i=0;i<r;++i)if(o[i])for(var c=i<<4|o[i],h=t-o[i],u=s[o[i]-1]++<<h,d=u|(1<<h)-1;u<=d;++u)a[XW[u]>>l]=c}else for(a=new o2(r),i=0;i<r;++i)o[i]&&(a[i]=XW[s[o[i]-1]++]>>15-o[i]);return a}),xO=new rc(288);for(xh=0;xh<144;++xh)xO[xh]=8;var xh;for(xh=144;xh<256;++xh)xO[xh]=9;var xh;for(xh=256;xh<280;++xh)xO[xh]=7;var xh;for(xh=280;xh<288;++xh)xO[xh]=8;var xh,tk=new rc(32);for(xh=0;xh<32;++xh)tk[xh]=5;var xh,V7e=JT(xO,9,0),G7e=JT(xO,9,1),U7e=JT(tk,5,0),H7e=JT(tk,5,1),xQ=function(o){for(var t=o[0],e=1;e<o.length;++e)o[e]>t&&(t=o[e]);return t},$T=function(o,t,e){var r=t/8|0;return(o[r]|o[r+1]<<8)>>(t&7)&e},RQ=function(o,t){var e=t/8|0;return(o[e]|o[e+1]<<8|o[e+2]<<16)>>(t&7)},ak=function(o){return(o+7)/8|0},N9=function(o,t,e){return(t==null||t<0)&&(t=0),(e==null||e>o.length)&&(e=o.length),new rc(o.subarray(t,e))},W7e=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],xa=function(o,t,e){var r=new Error(t||W7e[o]);if(r.code=o,Error.captureStackTrace&&Error.captureStackTrace(r,xa),!e)throw r;return r},see=function(o,t,e,r){var i=o.length,n=r?r.length:0;if(!i||t.f&&!t.l)return e||new rc(0);var s=!e,a=s||t.i!=2,l=t.i;s&&(e=new rc(i*3));var c=function(oe){var $=e.length;if(oe>$){var fe=new rc(Math.max($*2,oe));fe.set(e),e=fe}},h=t.f||0,u=t.p||0,d=t.b||0,p=t.l,m=t.d,g=t.m,y=t.n,b=i*8;do{if(!p){h=$T(o,u,1);var P=$T(o,u+1,3);if(u+=3,P)if(P==1)p=G7e,m=H7e,g=9,y=5;else if(P==2){var T=$T(o,u,31)+257,I=$T(o,u+10,15)+4,C=T+$T(o,u+5,31)+1;u+=14;for(var E=new rc(C),O=new rc(19),_=0;_<I;++_)O[jW[_]]=$T(o,u+_*3,7);u+=I*3;for(var x=xQ(O),v=(1<<x)-1,D=JT(O,x,1),_=0;_<C;){var w=D[$T(o,u,v)];u+=w&15;var F=w>>4;if(F<16)E[_++]=F;else{var H=0,z=0;for(F==16?(z=3+$T(o,u,3),u+=2,H=E[_-1]):F==17?(z=3+$T(o,u,7),u+=3):F==18&&(z=11+$T(o,u,127),u+=7);z--;)E[_++]=H}}var V=E.subarray(0,T),W=E.subarray(T);g=xQ(V),y=xQ(W),p=JT(V,g,1),m=JT(W,y,1)}else xa(1);else{var F=ak(u)+4,L=o[F-4]|o[F-3]<<8,k=F+L;if(k>i){l&&xa(0);break}a&&c(d+L),e.set(o.subarray(F,k),d),t.b=d+=L,t.p=u=k*8,t.f=h;continue}if(u>b){l&&xa(0);break}}a&&c(d+131072);for(var N=(1<<g)-1,U=(1<<y)-1,B=u;;B=u){var H=p[RQ(o,u)&N],G=H>>4;if(u+=H&15,u>b){l&&xa(0);break}if(H||xa(2),G<256)e[d++]=G;else if(G==256){B=u,p=null;break}else{var Y=G-254;if(G>264){var _=G-257,X=ok[_];Y=$T(o,u,(1<<X)-1)+ZPe[_],u+=X}var K=m[RQ(o,u)&U],J=K>>4;K||xa(3),u+=K&15;var W=F7e[J];if(J>3){var X=sk[J];W+=RQ(o,u)&(1<<X)-1,u+=X}if(u>b){l&&xa(0);break}a&&c(d+131072);var se=d+Y;if(d<W){var ce=n-W,te=Math.min(W,se);for(ce+d<0&&xa(3);d<te;++d)e[d]=r[ce+d]}for(;d<se;++d)e[d]=e[d-W]}}t.l=p,t.p=B,t.b=d,t.f=h,p&&(h=1,t.m=g,t.d=m,t.n=y)}while(!h);return d!=e.length&&s?N9(e,0,d):e.subarray(0,d)},R9=function(o,t,e){e<<=t&7;var r=t/8|0;o[r]|=e,o[r+1]|=e>>8},UN=function(o,t,e){e<<=t&7;var r=t/8|0;o[r]|=e,o[r+1]|=e>>8,o[r+2]|=e>>16},DQ=function(o,t){for(var e=[],r=0;r<o.length;++r)o[r]&&e.push({s:r,f:o[r]});var i=e.length,n=e.slice();if(!i)return{t:dv,l:0};if(i==1){var s=new rc(e[0].s+1);return s[e[0].s]=1,{t:s,l:1}}e.sort(function(C,E){return C.f-E.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],c=0,h=1,u=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=i-1;)a=e[e[c].f<e[u].f?c++:u++],l=e[c!=h&&e[c].f<e[u].f?c++:u++],e[h++]={s:-1,f:a.f+l.f,l:a,r:l};for(var d=n[0].s,r=1;r<i;++r)n[r].s>d&&(d=n[r].s);var p=new o2(d+1),m=qQ(e[h-1],p,0);if(m>t){var r=0,g=0,y=m-t,b=1<<y;for(n.sort(function(E,O){return p[O.s]-p[E.s]||E.f-O.f});r<i;++r){var P=n[r].s;if(p[P]>t)g+=b-(1<<m-p[P]),p[P]=t;else break}for(g>>=y;g>0;){var T=n[r].s;p[T]<t?g-=1<<t-p[T]++-1:++r}for(;r>=0&&g;--r){var I=n[r].s;p[I]==t&&(--p[I],++g)}m=t}return{t:new rc(p),l:m}},qQ=function(o,t,e){return o.s==-1?Math.max(qQ(o.l,t,e+1),qQ(o.r,t,e+1)):t[o.s]=e},CPe=function(o){for(var t=o.length;t&&!o[--t];);for(var e=new o2(++t),r=0,i=o[0],n=1,s=function(l){e[r++]=l},a=1;a<=t;++a)if(o[a]==i&&a!=t)++n;else{if(!i&&n>2){for(;n>138;n-=138)s(32754);n>2&&(s(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(s(i),--n;n>6;n-=6)s(8304);n>2&&(s(n-3<<5|8208),n=0)}for(;n--;)s(i);n=1,i=o[a]}return{c:e.subarray(0,r),n:t}},HN=function(o,t){for(var e=0,r=0;r<t.length;++r)e+=o[r]*t[r];return e},JPe=function(o,t,e){var r=e.length,i=ak(t+2);o[i]=r&255,o[i+1]=r>>8,o[i+2]=o[i]^255,o[i+3]=o[i+1]^255;for(var n=0;n<r;++n)o[i+n+4]=e[n];return(i+4+r)*8},SPe=function(o,t,e,r,i,n,s,a,l,c,h){R9(t,h++,e),++i[256];for(var u=DQ(i,15),d=u.t,p=u.l,m=DQ(n,15),g=m.t,y=m.l,b=CPe(d),P=b.c,T=b.n,I=CPe(g),C=I.c,E=I.n,O=new o2(19),_=0;_<P.length;++_)++O[P[_]&31];for(var _=0;_<C.length;++_)++O[C[_]&31];for(var x=DQ(O,7),v=x.t,D=x.l,w=19;w>4&&!v[jW[w-1]];--w);var F=c+5<<3,H=HN(i,xO)+HN(n,tk)+s,z=HN(i,d)+HN(n,g)+s+14+3*w+HN(O,v)+2*O[16]+3*O[17]+7*O[18];if(l>=0&&F<=H&&F<=z)return JPe(t,h,o.subarray(l,l+c));var V,W,L,k;if(R9(t,h,1+(z<H)),h+=2,z<H){V=JT(d,p,0),W=d,L=JT(g,y,0),k=g;var N=JT(v,D,0);R9(t,h,T-257),R9(t,h+5,E-1),R9(t,h+10,w-4),h+=14;for(var _=0;_<w;++_)R9(t,h+3*_,v[jW[_]]);h+=3*w;for(var U=[P,C],B=0;B<2;++B)for(var G=U[B],_=0;_<G.length;++_){var Y=G[_]&31;R9(t,h,N[Y]),h+=v[Y],Y>15&&(R9(t,h,G[_]>>5&127),h+=G[_]>>12)}}else V=V7e,W=xO,L=U7e,k=tk;for(var _=0;_<a;++_){var X=r[_];if(X>255){var Y=X>>18&31;UN(t,h,V[Y+257]),h+=W[Y+257],Y>7&&(R9(t,h,X>>23&31),h+=ok[Y]);var K=X&31;UN(t,h,L[K]),h+=k[K],K>3&&(UN(t,h,X>>5&8191),h+=sk[K])}else UN(t,h,V[X]),h+=W[X]}return UN(t,h,V[256]),h+W[256]},z7e=new nz([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),dv=new rc(0),Y7e=function(o,t,e,r,i,n){var s=n.z||o.length,a=new rc(r+s+5*(1+Math.ceil(s/7e3))+i),l=a.subarray(r,a.length-i),c=n.l,h=(n.r||0)&7;if(t){h&&(l[0]=n.r>>3);for(var u=z7e[t-1],d=u>>13,p=u&8191,m=(1<<e)-1,g=n.p||new o2(32768),y=n.h||new o2(m+1),b=Math.ceil(e/3),P=2*b,T=function(Oe){return(o[Oe]^o[Oe+1]<<b^o[Oe+2]<<P)&m},I=new nz(25e3),C=new o2(288),E=new o2(32),O=0,_=0,x=n.i||0,v=0,D=n.w||0,w=0;x+2<s;++x){var F=T(x),H=x&32767,z=y[F];if(g[H]=z,y[F]=H,D<=x){var V=s-x;if((O>7e3||v>24576)&&(V>423||!c)){h=SPe(o,l,0,I,C,E,_,v,w,x-w,h),v=O=_=0,w=x;for(var W=0;W<286;++W)C[W]=0;for(var W=0;W<30;++W)E[W]=0}var L=2,k=0,N=p,U=H-z&32767;if(V>2&&F==T(x-U))for(var B=Math.min(d,V)-1,G=Math.min(32767,x),Y=Math.min(258,V);U<=G&&--N&&H!=z;){if(o[x+L]==o[x+L-U]){for(var X=0;X<Y&&o[x+X]==o[x+X-U];++X);if(X>L){if(L=X,k=U,X>B)break;for(var K=Math.min(U,X-2),J=0,W=0;W<K;++W){var se=x-U+W&32767,ce=g[se],te=se-ce&32767;te>J&&(J=te,z=se)}}}H=z,z=g[H],U+=H-z&32767}if(k){I[v++]=268435456|XQ[L]<<18|IPe[k];var oe=XQ[L]&31,$=IPe[k]&31;_+=ok[oe]+sk[$],++C[257+oe],++E[$],D=x+L,++O}else I[v++]=o[x],++C[o[x]]}}for(x=Math.max(x,D);x<s;++x)I[v++]=o[x],++C[o[x]];h=SPe(o,l,c,I,C,E,_,v,w,x-w,h),c||(n.r=h&7|l[h/8|0]<<3,h-=7,n.h=y,n.p=g,n.i=x,n.w=D)}else{for(var x=n.w||0;x<s+c;x+=65535){var fe=x+65535;fe>=s&&(l[h/8|0]=c,fe=s),h=JPe(l,h+1,o.subarray(x,fe))}n.i=s}return N9(a,0,r+ak(h)+i)},ybt=(function(){for(var o=new Int32Array(256),t=0;t<256;++t){for(var e=t,r=9;--r;)e=(e&1&&-306674912)^e>>>1;o[t]=e}return o})(),QPe=function(){var o=-1;return{p:function(t){for(var e=o,r=0;r<t.length;++r)e=ybt[e&255^t[r]]^e>>>8;o=e},d:function(){return~o}}},j7e=function(){var o=1,t=0;return{p:function(e){for(var r=o,i=t,n=e.length|0,s=0;s!=n;){for(var a=Math.min(s+2655,n);s<a;++s)i+=r+=e[s];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}o=r,t=i},d:function(){return o%=65521,t%=65521,(o&255)<<24|(o&65280)<<8|(t&255)<<8|t>>8}}},lk=function(o,t,e,r,i){if(!i&&(i={l:1},t.dictionary)){var n=t.dictionary.subarray(-32768),s=new rc(n.length+o.length);s.set(n),s.set(o,n.length),o=s,i.w=n.length}return Y7e(o,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(o.length)))*1.5):20:12+t.mem,e,r,i)},X7e=function(o,t){var e={};for(var r in o)e[r]=o[r];for(var r in t)e[r]=t[r];return e},$6e=function(o,t,e){for(var r=o(),i=o.toString(),n=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/\s+/g,"").split(","),s=0;s<r.length;++s){var a=r[s],l=n[s];if(typeof a=="function"){t+=";"+l+"=";var c=a.toString();if(a.prototype)if(c.indexOf("[native code]")!=-1){var h=c.indexOf(" ",8)+1;t+=c.slice(h,c.indexOf("(",h))}else{t+=c;for(var u in a.prototype)t+=";"+l+".prototype."+u+"="+a.prototype[u].toString()}else t+=c}else e[l]=a}return t},PQ=[],bbt=function(o){var t=[];for(var e in o)o[e].buffer&&t.push((o[e]=new o[e].constructor(o[e])).buffer);return t},Pbt=function(o,t,e,r){if(!PQ[e]){for(var i="",n={},s=o.length-1,a=0;a<s;++a)i=$6e(o[a],i,n);PQ[e]={c:$6e(o[s],i,n),e:n}}var l=X7e({},PQ[e].e);return gbt(PQ[e].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",e,l,bbt(l),r)},eTe=function(){return[rc,o2,nz,ok,sk,jW,ZPe,F7e,G7e,H7e,XW,W7e,JT,xQ,$T,RQ,ak,N9,xa,see,_bt,q7e,Sbt]},Tbt=function(){return[rc,o2,nz,ok,sk,jW,XQ,IPe,V7e,xO,U7e,tk,XW,z7e,dv,JT,R9,UN,DQ,qQ,CPe,HN,JPe,SPe,ak,N9,Y7e,lk,Abt,q7e]},Ibt=function(){return[tTe,K7e]},Cbt=function(){return[J7e]},q7e=function(o){return postMessage(o,[o.buffer])},Sbt=function(o){return o&&{out:o.size&&new rc(o.size),dictionary:o.dictionary}},gv=function(o){return o.ondata=function(t,e){return postMessage([t,e],[t.buffer])},function(t){t.data.length?(o.push(t.data[0],t.data[1]),postMessage([t.data[0].length])):o.flush()}},aee=function(o,t,e,r,i,n,s){var a,l=Pbt(o,r,i,function(c,h){c?(l.terminate(),t.ondata.call(t,c)):Array.isArray(h)?h.length==1?(t.queuedSize-=h[0],t.ondrain&&t.ondrain(h[0])):(h[1]&&l.terminate(),t.ondata.call(t,c,h[0],h[1])):s(h)});l.postMessage(e),t.queuedSize=0,t.push=function(c,h){t.ondata||xa(5),a&&t.ondata(xa(4,0,1),null,!!h),t.queuedSize+=c.length,l.postMessage([c,a=h],[c.buffer])},t.terminate=function(){l.terminate()},n&&(t.flush=function(){l.postMessage([])})},XN=function(o,t){return o[t]|o[t+1]<<8},qN=function(o,t){return(o[t]|o[t+1]<<8|o[t+2]<<16|o[t+3]<<24)>>>0},Qbe=function(o,t){return qN(o,t)+qN(o,t+4)*4294967296},Mu=function(o,t,e){for(;e;++t)o[t]=e,e>>>=8},$7e=function(o,t){var e=t.filename;if(o[0]=31,o[1]=139,o[2]=8,o[8]=t.level<2?4:t.level==9?2:0,o[9]=3,t.mtime!=0&&Mu(o,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),e){o[3]=8;for(var r=0;r<=e.length;++r)o[r+10]=e.charCodeAt(r)}},tTe=function(o){(o[0]!=31||o[1]!=139||o[2]!=8)&&xa(6,"invalid gzip data");var t=o[3],e=10;t&4&&(e+=(o[10]|o[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!o[e++]);return e+(t&2)},K7e=function(o){var t=o.length;return(o[t-4]|o[t-3]<<8|o[t-2]<<16|o[t-1]<<24)>>>0},Z7e=function(o){return 10+(o.filename?o.filename.length+1:0)},Ebt=function(o,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(o[0]=120,o[1]=r<<6|(t.dictionary&&32),o[1]|=31-(o[0]<<8|o[1])%31,t.dictionary){var i=j7e();i.p(t.dictionary),Mu(o,2,i.d())}},J7e=function(o,t){return((o[0]&15)!=8||o[0]>>4>7||(o[0]<<8|o[1])%31)&&xa(6,"invalid zlib data"),(o[1]>>5&1)==+!t&&xa(6,"invalid zlib data: "+(o[1]&32?"need":"unexpected")+" dictionary"),(o[1]>>3&4)+2};function oz(o,t){return typeof o=="function"&&(t=o,o={}),this.ondata=t,o}var AO=(function(){function o(t,e){if(typeof t=="function"&&(e=t,t={}),this.ondata=e,this.o=t||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new rc(98304),this.o.dictionary){var r=this.o.dictionary.subarray(-32768);this.b.set(r,32768-r.length),this.s.i=32768-r.length}}return o.prototype.p=function(t,e){this.ondata(lk(t,this.o,0,0,this.s),e)},o.prototype.push=function(t,e){this.ondata||xa(5),this.s.l&&xa(4);var r=t.length+this.s.z;if(r>this.b.length){if(r>2*this.b.length-32768){var i=new rc(r&-32768);i.set(this.b.subarray(0,this.s.z)),this.b=i}var n=this.b.length-this.s.z;this.b.set(t.subarray(0,n),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(t.subarray(n),32768),this.s.z=t.length-n+32768,this.s.i=32766,this.s.w=32768}else this.b.set(t,this.s.z),this.s.z+=t.length;this.s.l=e&1,(this.s.z>this.s.w+8191||e)&&(this.p(this.b,e||!1),this.s.w=this.s.i,this.s.i-=2)},o.prototype.flush=function(){this.ondata||xa(5),this.s.l&&xa(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},o})(),Obt=(function(){function o(t,e){aee([Tbt,function(){return[gv,AO]}],this,oz.call(this,t,e),function(r){var i=new AO(r.data);onmessage=gv(i)},6,1)}return o})();function Abt(o,t){return lk(o,t||{},0,0)}var _P=(function(){function o(t,e){typeof t=="function"&&(e=t,t={}),this.ondata=e;var r=t&&t.dictionary&&t.dictionary.subarray(-32768);this.s={i:0,b:r?r.length:0},this.o=new rc(32768),this.p=new rc(0),r&&this.o.set(r)}return o.prototype.e=function(t){if(this.ondata||xa(5),this.d&&xa(4),!this.p.length)this.p=t;else if(t.length){var e=new rc(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length),this.p=e}},o.prototype.c=function(t){this.s.i=+(this.d=t||!1);var e=this.s.b,r=see(this.p,this.s,this.o);this.ondata(N9(r,e,this.s.b),this.d),this.o=N9(r,this.s.b-32768),this.s.b=this.o.length,this.p=N9(this.p,this.s.p/8|0),this.s.p&=7},o.prototype.push=function(t,e){this.e(t),this.c(e)},o})(),Q7e=(function(){function o(t,e){aee([eTe,function(){return[gv,_P]}],this,oz.call(this,t,e),function(r){var i=new _P(r.data);onmessage=gv(i)},7,0)}return o})();function _bt(o,t){return see(o,{i:2},t&&t.out,t&&t.dictionary)}var jWt=(function(){function o(t,e){this.c=QPe(),this.l=0,this.v=1,AO.call(this,t,e)}return o.prototype.push=function(t,e){this.c.p(t),this.l+=t.length,AO.prototype.push.call(this,t,e)},o.prototype.p=function(t,e){var r=lk(t,this.o,this.v&&Z7e(this.o),e&&8,this.s);this.v&&($7e(r,this.o),this.v=0),e&&(Mu(r,r.length-8,this.c.d()),Mu(r,r.length-4,this.l)),this.ondata(r,e)},o.prototype.flush=function(){AO.prototype.flush.call(this)},o})();function ePe(o,t){t||(t={});var e=QPe(),r=o.length;e.p(o);var i=lk(o,t,Z7e(t),8),n=i.length;return $7e(i,t),Mu(i,n-8,e.d()),Mu(i,n-4,r),i}var EPe=(function(){function o(t,e){this.v=1,this.r=0,_P.call(this,t,e)}return o.prototype.push=function(t,e){if(_P.prototype.e.call(this,t),this.r+=t.length,this.v){var r=this.p.subarray(this.v-1),i=r.length>3?tTe(r):4;if(i>r.length){if(!e)return}else this.v>1&&this.onmember&&this.onmember(this.r-r.length);this.p=r.subarray(i),this.v=0}_P.prototype.c.call(this,e),this.s.f&&!this.s.l&&!e&&(this.v=ak(this.s.p)+9,this.s={i:0},this.o=new rc(0),this.push(new rc(0),e))},o})(),vbt=(function(){function o(t,e){var r=this;aee([eTe,Ibt,function(){return[gv,_P,EPe]}],this,oz.call(this,t,e),function(i){var n=new EPe(i.data);n.onmember=function(s){return postMessage(s)},onmessage=gv(n)},9,0,function(i){return r.onmember&&r.onmember(i)})}return o})();function xbt(o,t){var e=tTe(o);return e+8>o.length&&xa(6,"invalid gzip data"),see(o.subarray(e,-8),{i:2},t&&t.out||new rc(K7e(o)),t&&t.dictionary)}var XWt=(function(){function o(t,e){this.c=j7e(),this.v=1,AO.call(this,t,e)}return o.prototype.push=function(t,e){this.c.p(t),AO.prototype.push.call(this,t,e)},o.prototype.p=function(t,e){var r=lk(t,this.o,this.v&&(this.o.dictionary?6:2),e&&4,this.s);this.v&&(Ebt(r,this.o),this.v=0),e&&Mu(r,r.length-4,this.c.d()),this.ondata(r,e)},o.prototype.flush=function(){AO.prototype.flush.call(this)},o})(),OPe=(function(){function o(t,e){_P.call(this,t,e),this.v=t&&t.dictionary?2:1}return o.prototype.push=function(t,e){if(_P.prototype.e.call(this,t),this.v){if(this.p.length<6&&!e)return;this.p=this.p.subarray(J7e(this.p,this.v-1)),this.v=0}e&&(this.p.length<4&&xa(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),_P.prototype.c.call(this,e)},o})(),Rbt=(function(){function o(t,e){aee([eTe,Cbt,function(){return[gv,_P,OPe]}],this,oz.call(this,t,e),function(r){var i=new OPe(r.data);onmessage=gv(i)},11,0)}return o})(),K6e=(function(){function o(t,e){this.o=oz.call(this,t,e)||{},this.G=EPe,this.I=_P,this.Z=OPe}return o.prototype.i=function(){var t=this;this.s.ondata=function(e,r){t.ondata(e,r)}},o.prototype.push=function(t,e){if(this.ondata||xa(5),this.s)this.s.push(t,e);else{if(this.p&&this.p.length){var r=new rc(this.p.length+t.length);r.set(this.p),r.set(t,this.p.length)}else this.p=t;this.p.length>2&&(this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(this.o):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,e),this.p=null)}},o})(),qWt=(function(){function o(t,e){K6e.call(this,t,e),this.queuedSize=0,this.G=vbt,this.I=Q7e,this.Z=Rbt}return o.prototype.i=function(){var t=this;this.s.ondata=function(e,r,i){t.ondata(e,r,i)},this.s.ondrain=function(e){t.queuedSize-=e,t.ondrain&&t.ondrain(e)}},o.prototype.push=function(t,e){this.queuedSize+=t.length,K6e.prototype.push.call(this,t,e)},o})();var Z6e=typeof TextEncoder<"u"&&new TextEncoder,APe=typeof TextDecoder<"u"&&new TextDecoder,eNe=0;try{APe.decode(dv,{stream:!0}),eNe=1}catch{}var tNe=function(o){for(var t="",e=0;;){var r=o[e++],i=(r>127)+(r>223)+(r>239);if(e+i>o.length)return{s:t,r:N9(o,e-1)};i?i==3?(r=((r&15)<<18|(o[e++]&63)<<12|(o[e++]&63)<<6|o[e++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|o[e++]&63):t+=String.fromCharCode((r&15)<<12|(o[e++]&63)<<6|o[e++]&63):t+=String.fromCharCode(r)}},$Wt=(function(){function o(t){this.ondata=t,eNe?this.t=new TextDecoder:this.p=dv}return o.prototype.push=function(t,e){if(this.ondata||xa(5),e=!!e,this.t){this.ondata(this.t.decode(t,{stream:!0}),e),e&&(this.t.decode().length&&xa(8),this.t=null);return}this.p||xa(4);var r=new rc(this.p.length+t.length);r.set(this.p),r.set(t,this.p.length);var i=tNe(r),n=i.s,s=i.r;e?(s.length&&xa(8),this.p=null):this.p=s,this.ondata(n,e)},o})(),KWt=(function(){function o(t){this.ondata=t}return o.prototype.push=function(t,e){this.ondata||xa(5),this.d&&xa(4),this.ondata(_Pe(t),this.d=e||!1)},o})();function _Pe(o,t){if(t){for(var e=new rc(o.length),r=0;r<o.length;++r)e[r]=o.charCodeAt(r);return e}if(Z6e)return Z6e.encode(o);for(var i=o.length,n=new rc(o.length+(o.length>>1)),s=0,a=function(u){n[s++]=u},r=0;r<i;++r){if(s+5>n.length){var l=new rc(s+8+(i-r<<1));l.set(n),n=l}var c=o.charCodeAt(r);c<128||t?a(c):c<2048?(a(192|c>>6),a(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|o.charCodeAt(++r)&1023,a(240|c>>18),a(128|c>>12&63),a(128|c>>6&63),a(128|c&63)):(a(224|c>>12),a(128|c>>6&63),a(128|c&63))}return N9(n,0,s)}function Dbt(o,t){if(t){for(var e="",r=0;r<o.length;r+=16384)e+=String.fromCharCode.apply(null,o.subarray(r,r+16384));return e}else{if(APe)return APe.decode(o);var i=tNe(o),n=i.s,e=i.r;return e.length&&xa(8),n}}var rNe=function(o){return o==1?3:o<6?2:o==9?1:0},wbt=function(o,t){for(;XN(o,t)!=1;t+=4+XN(o,t+2));return[Qbe(o,t+12),Qbe(o,t+4),Qbe(o,t+20)]},wQ=function(o){var t=0;if(o)for(var e in o){var r=o[e].length;r>65535&&xa(9),t+=r+4}return t},J6e=function(o,t,e,r,i,n,s,a){var l=r.length,c=e.extra,h=a&&a.length,u=wQ(c);Mu(o,t,s!=null?33639248:67324752),t+=4,s!=null&&(o[t++]=20,o[t++]=e.os),o[t]=20,t+=2,o[t++]=e.flag<<1|(n<0&&8),o[t++]=i&&8,o[t++]=e.compression&255,o[t++]=e.compression>>8;var d=new Date(e.mtime==null?Date.now():e.mtime),p=d.getFullYear()-1980;if((p<0||p>119)&&xa(10),Mu(o,t,p<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>1),t+=4,n!=-1&&(Mu(o,t,e.crc),Mu(o,t+4,n<0?-n-2:n),Mu(o,t+8,e.size)),Mu(o,t+12,l),Mu(o,t+14,u),t+=16,s!=null&&(Mu(o,t,h),Mu(o,t+6,e.attrs),Mu(o,t+10,s),t+=14),o.set(r,t),t+=l,u)for(var m in c){var g=c[m],y=g.length;Mu(o,t,+m),Mu(o,t+2,y),o.set(g,t+4),t+=4+y}return h&&(o.set(a,t),t+=h),t},Lbt=function(o,t,e,r,i){Mu(o,t,101010256),Mu(o,t+8,e),Mu(o,t+10,e),Mu(o,t+12,r),Mu(o,t+16,i)},$Q=(function(){function o(t){this.filename=t,this.c=QPe(),this.size=0,this.compression=0}return o.prototype.process=function(t,e){this.ondata(null,t,e)},o.prototype.push=function(t,e){this.ondata||xa(5),this.c.p(t),this.size+=t.length,e&&(this.crc=this.c.d()),this.process(t,e||!1)},o})(),ZWt=(function(){function o(t,e){var r=this;e||(e={}),$Q.call(this,t),this.d=new AO(e,function(i,n){r.ondata(null,i,n)}),this.compression=8,this.flag=rNe(e.level)}return o.prototype.process=function(t,e){try{this.d.push(t,e)}catch(r){this.ondata(r,null,e)}},o.prototype.push=function(t,e){$Q.prototype.push.call(this,t,e)},o})(),JWt=(function(){function o(t,e){var r=this;e||(e={}),$Q.call(this,t),this.d=new Obt(e,function(i,n,s){r.ondata(i,n,s)}),this.compression=8,this.flag=rNe(e.level),this.terminate=this.d.terminate}return o.prototype.process=function(t,e){this.d.push(t,e)},o.prototype.push=function(t,e){$Q.prototype.push.call(this,t,e)},o})(),QWt=(function(){function o(t){this.ondata=t,this.u=[],this.d=1}return o.prototype.add=function(t){var e=this;if(this.ondata||xa(5),this.d&2)this.ondata(xa(4+(this.d&1)*8,0,1),null,!1);else{var r=_Pe(t.filename),i=r.length,n=t.comment,s=n&&_Pe(n),a=i!=t.filename.length||s&&n.length!=s.length,l=i+wQ(t.extra)+30;i>65535&&this.ondata(xa(11,0,1),null,!1);var c=new rc(l);J6e(c,0,t,r,a,-1);var h=[c],u=function(){for(var y=0,b=h;y<b.length;y++){var P=b[y];e.ondata(null,P,!1)}h=[]},d=this.d;this.d=0;var p=this.u.length,m=X7e(t,{f:r,u:a,o:s,t:function(){t.terminate&&t.terminate()},r:function(){if(u(),d){var y=e.u[p+1];y?y.r():e.d=1}d=1}}),g=0;t.ondata=function(y,b,P){if(y)e.ondata(y,b,P),e.terminate();else if(g+=b.length,h.push(b),P){var T=new rc(16);Mu(T,0,134695760),Mu(T,4,t.crc),Mu(T,8,g),Mu(T,12,t.size),h.push(T),m.c=g,m.b=l+g+16,m.crc=t.crc,m.size=t.size,d&&m.r(),d=1}else d&&u()},this.u.push(m)}},o.prototype.end=function(){var t=this;if(this.d&2){this.ondata(xa(4+(this.d&1)*8,0,1),null,!0);return}this.d?this.e():this.u.push({r:function(){t.d&1&&(t.u.splice(-1,1),t.e())},t:function(){}}),this.d=3},o.prototype.e=function(){for(var t=0,e=0,r=0,i=0,n=this.u;i<n.length;i++){var s=n[i];r+=46+s.f.length+wQ(s.extra)+(s.o?s.o.length:0)}for(var a=new rc(r+22),l=0,c=this.u;l<c.length;l++){var s=c[l];J6e(a,t,s,s.f,s.u,-s.c-2,e,s.o),t+=46+s.f.length+wQ(s.extra)+(s.o?s.o.length:0),e+=s.b}Lbt(a,t,this.u.length,r,e),this.ondata(null,a,!0),this.d=2},o.prototype.terminate=function(){for(var t=0,e=this.u;t<e.length;t++){var r=e[t];r.t()}this.d=2},o})();var Mbt=(function(){function o(){}return o.prototype.push=function(t,e){this.ondata(null,t,e)},o.compression=0,o})(),ezt=(function(){function o(){var t=this;this.i=new _P(function(e,r){t.ondata(null,e,r)})}return o.prototype.push=function(t,e){try{this.i.push(t,e)}catch(r){this.ondata(r,null,e)}},o.compression=8,o})(),tzt=(function(){function o(t,e){var r=this;e<32e4?this.i=new _P(function(i,n){r.ondata(null,i,n)}):(this.i=new Q7e(function(i,n,s){r.ondata(i,n,s)}),this.terminate=this.i.terminate)}return o.prototype.push=function(t,e){this.i.terminate&&(t=N9(t,0)),this.i.push(t,e)},o.compression=8,o})(),rzt=(function(){function o(t){this.onfile=t,this.k=[],this.o={0:Mbt},this.p=dv}return o.prototype.push=function(t,e){var r=this;if(this.onfile||xa(5),this.p||xa(4),this.c>0){var i=Math.min(this.c,t.length),n=t.subarray(0,i);if(this.c-=i,this.d?this.d.push(n,!this.c):this.k[0].push(n),t=t.subarray(i),t.length)return this.push(t,e)}else{var s=0,a=0,l=void 0,c=void 0;this.p.length?t.length?(c=new rc(this.p.length+t.length),c.set(this.p),c.set(t,this.p.length)):c=this.p:c=t;for(var h=c.length,u=this.c,d=u&&this.d,p=function(){var b,P=qN(c,a);if(P==67324752){s=1,l=a,m.d=null,m.c=0;var T=XN(c,a+6),I=XN(c,a+8),C=T&2048,E=T&8,O=XN(c,a+26),_=XN(c,a+28);if(h>a+30+O+_){var x=[];m.k.unshift(x),s=2;var v=qN(c,a+18),D=qN(c,a+22),w=Dbt(c.subarray(a+30,a+=30+O),!C);v==4294967295?(b=E?[-2]:wbt(c,a),v=b[0],D=b[1]):E&&(v=-1),a+=_,m.c=v;var F,H={name:w,compression:I,start:function(){if(H.ondata||xa(5),!v)H.ondata(null,dv,!0);else{var z=r.o[I];z||H.ondata(xa(14,"unknown compression type "+I,1),null,!1),F=v<0?new z(w):new z(w,v,D),F.ondata=function(k,N,U){H.ondata(k,N,U)};for(var V=0,W=x;V<W.length;V++){var L=W[V];F.push(L,!1)}r.k[0]==x&&r.c?r.d=F:F.push(dv,!0)}},terminate:function(){F&&F.terminate&&F.terminate()}};v>=0&&(H.size=v,H.originalSize=D),m.onfile(H)}return"break"}else if(u){if(P==134695760)return l=a+=12+(u==-2&&8),s=3,m.c=0,"break";if(P==33639248)return l=a-=4,s=3,m.c=0,"break"}},m=this;a<h-4;++a){var g=p();if(g==="break")break}if(this.p=dv,u<0){var y=s?c.subarray(0,l-12-(u==-2&&8)-(qN(c,l-16)==134695760&&4)):c.subarray(0,a);d?d.push(y,!!s):this.k[+(s==2)].push(y)}if(s&2)return this.push(c.subarray(a),e);this.p=c.subarray(a)}e&&(this.c&&xa(13),this.p=null)},o.prototype.register=function(t){this.o[t.compression]=t},o})(),Nbt=(o=>(o[o.UNAUTHORIZED=401]="UNAUTHORIZED",o[o.LOGIN_FAIL=402]="LOGIN_FAIL",o[o.PERMISSION_DENIED=422]="PERMISSION_DENIED",o[o.PERMISSION_DENIED1=1111111]="PERMISSION_DENIED1",o[o.PERMISSION_DENIED_PARAMS=1111112]="PERMISSION_DENIED_PARAMS",o[o.DATA_NOT_FOUND=1111113]="DATA_NOT_FOUND",o[o.PARAMS_DATA_NOT_FOUND=1111114]="PARAMS_DATA_NOT_FOUND",o[o.REQUEST_PARAM_ILLEGAL=42222]="REQUEST_PARAM_ILLEGAL",o[o.REQUEST_PARAM_ILLEGAL1=1111115]="REQUEST_PARAM_ILLEGAL1",o[o.REQUEST_PARAMS_ILLEGAL2=1111116]="REQUEST_PARAMS_ILLEGAL2",o[o.REQUEST_PARAMS_NOT_NULL=1111117]="REQUEST_PARAMS_NOT_NULL",o[o.REQUEST_PARAMS_NOT_ALL_NULL=1111118]="REQUEST_PARAMS_NOT_ALL_NULL",o[o.REQUEST_PARAMS_MUST_ARRAY=1111119]="REQUEST_PARAMS_MUST_ARRAY",o[o.REQUEST_PARAMS_MUST_STRING=1111120]="REQUEST_PARAMS_MUST_STRING",o[o.REQUEST_PARAMS_MUST_NUMBER=1111121]="REQUEST_PARAMS_MUST_NUMBER",o[o.REQUEST_PARAMS_MUST_NUMBER_ARRAY=1111122]="REQUEST_PARAMS_MUST_NUMBER_ARRAY",o[o.REQUEST_PARAMS_MUST_STRING_ARRAY=1111123]="REQUEST_PARAMS_MUST_STRING_ARRAY",o[o.REQUEST_PARAMS_LENGTH_ERROR=1111124]="REQUEST_PARAMS_LENGTH_ERROR",o[o.REQUEST_PARAMS_TYPE_ERROR=1111125]="REQUEST_PARAMS_TYPE_ERROR",o[o.ILLEGAL_NAME=2001]="ILLEGAL_NAME",o[o.ILLEGAL_NAME1=1111126]="ILLEGAL_NAME1",o[o.ILLEGAL_NAME_ZH=1111128]="ILLEGAL_NAME_ZH",o[o.UUID_ERROR=1111127]="UUID_ERROR",o[o.DUPLICATE_DATA=1000001]="DUPLICATE_DATA",o[o.DUPLICATE_DATA1=11e3]="DUPLICATE_DATA1",o[o.DUPLICATE_DATA_PARAMS=1000017]="DUPLICATE_DATA_PARAMS",o[o.UPLOAD_LIMIT=10034]="UPLOAD_LIMIT",o[o.MORE_THAN_LIMIT=1000003]="MORE_THAN_LIMIT",o[o.FILE_MORE_THAN_LIMIT=1000004]="FILE_MORE_THAN_LIMIT",o[o.PARAMS_MORE_THAN_LIMIT=1000005]="PARAMS_MORE_THAN_LIMIT",o[o.IMAGE_MORE_THAN_LIMIT_PARAMS=1000006]="IMAGE_MORE_THAN_LIMIT_PARAMS",o[o.FILE_MORE_THAN_LIMIT_PARAMS=1000007]="FILE_MORE_THAN_LIMIT_PARAMS",o[o.END_MUST_AFTER_START=1000019]="END_MUST_AFTER_START",o[o.REQUEST_PARAMS_TIME_ERROR=1000009]="REQUEST_PARAMS_TIME_ERROR",o[o.FILES_PATH_NOT_FOUND=1000018]="FILES_PATH_NOT_FOUND",o[o.FILES_DATA_NOT_FOUND=1000011]="FILES_DATA_NOT_FOUND",o[o.FILES_TYPE_ERROR=1000012]="FILES_TYPE_ERROR",o[o.FILES_TYPE_MUST_BE_ONE=1000013]="FILES_TYPE_MUST_BE_ONE",o[o.SET_WATERMARK_FAIL=1000014]="SET_WATERMARK_FAIL",o[o.MYSQL_CRUD_ERROR=1000015]="MYSQL_CRUD_ERROR",o[o.PARAMS_JSON_FAILED=1000016]="PARAMS_JSON_FAILED",o[o.MYSQL_ERROR=3000001]="MYSQL_ERROR",o[o.NOT_FOUND=404]="NOT_FOUND",o[o.PRJ_NAME_EXISTS=2002]="PRJ_NAME_EXISTS",o[o.BACKUP_NAME_EXISTS=3002]="BACKUP_NAME_EXISTS",o[o.PRJ_NOT_EXIST=2000001]="PRJ_NOT_EXIST",o[o.ERROR_PATH=4000002]="ERROR_PATH",o[o.PROJECT_NOT_FOUND=6000001]="PROJECT_NOT_FOUND",o[o.TITLE_ILLEGAL_LEN=2003]="TITLE_ILLEGAL_LEN",o[o.FILE_READ_ONLY=1000002]="FILE_READ_ONLY",o[o.FILE_READ_ONLY1=1000008]="FILE_READ_ONLY1",o[o.DATA_NOT_EXIST=1000010]="DATA_NOT_EXIST",o[o.LIB_NOT_EXIST=2000001]="LIB_NOT_EXIST",o[o.CONFIG_API_URLS_ERROR=3001001]="CONFIG_API_URLS_ERROR",o[o.ONE_CLICK_ORDER_NOT_OPEN=3001002]="ONE_CLICK_ORDER_NOT_OPEN",o[o.MATERIAL_NOT_OPEN=3001003]="MATERIAL_NOT_OPEN",o[o.SNAPSHOT_DEPTH_LIMIT=3001004]="SNAPSHOT_DEPTH_LIMIT",o[o.OCR_SYMBOL_URL_ERROR=3001005]="OCR_SYMBOL_URL_ERROR",o[o.USER_DATA_NOT_FOUND=4000001]="USER_DATA_NOT_FOUND",o[o.USER_DISABLE_ERROR=4000012]="USER_DISABLE_ERROR",o[o.USER_EXISTS_LOGIN_ERROR=4000003]="USER_EXISTS_LOGIN_ERROR",o[o.USER_UNAUTHORIZED_MODULES_ERROR=4000004]="USER_UNAUTHORIZED_MODULES_ERROR",o[o.USER_UNAUTHORIZED_ACCESS_ERROR=4000005]="USER_UNAUTHORIZED_ACCESS_ERROR",o[o.ADMIN_NOT_CHANGE_PASSWORD=4000006]="ADMIN_NOT_CHANGE_PASSWORD",o[o.SAME_PASSWORD_NEW_PASSWORD=4000007]="SAME_PASSWORD_NEW_PASSWORD",o[o.USER_ONLINE_REGISTRATION_FAILED=4000008]="USER_ONLINE_REGISTRATION_FAILED",o[o.USER_PASSWORD_CAN_NOT_DEFAULT=4000009]="USER_PASSWORD_CAN_NOT_DEFAULT",o[o.USER_BEFORE_PASSWORD_ERROR=4000010]="USER_BEFORE_PASSWORD_ERROR",o[o.USER_PASSWORD_LENGTH_ERROR=4000011]="USER_PASSWORD_LENGTH_ERROR",o[o.ORG_ROLE_NOT_CREATE=5000001]="ORG_ROLE_NOT_CREATE",o[o.ORG_ROLE_NAME_DUPLICATE=5000002]="ORG_ROLE_NAME_DUPLICATE",o[o.ORG_ROLE_ORIGIN_ERROR=5000003]="ORG_ROLE_ORIGIN_ERROR",o[o.ORG_ROLE_NOT_DEFAULT=5000004]="ORG_ROLE_NOT_DEFAULT",o[o.ADMIN_ROLE_NOT_CHANGE=5000005]="ADMIN_ROLE_NOT_CHANGE",o[o.ADMIN_NOT_CHANGE_STATUS=5000006]="ADMIN_NOT_CHANGE_STATUS",o[o.PROJECT_ARCHIVED=6000002]="PROJECT_ARCHIVED",o[o.PROJECT_UUID_NULL=6000003]="PROJECT_UUID_NULL",o[o.PROJECT_UUID_ERROR=6000004]="PROJECT_UUID_ERROR",o[o.PROJECT_OR_TEAM_UUID_ERROR=6000005]="PROJECT_OR_TEAM_UUID_ERROR",o[o.PROJECT_NOT_PERSON_ERROR=6000006]="PROJECT_NOT_PERSON_ERROR",o[o.PROJECT_DUPLICATE_NAME=6000007]="PROJECT_DUPLICATE_NAME",o[o.ANNOTATION_HAS_BE_FOUND=6000008]="ANNOTATION_HAS_BE_FOUND",o[o.ANNOTATION_NOT_FOUND=6000009]="ANNOTATION_NOT_FOUND",o[o.ANNOTATION_CREATE_ERROR=6000010]="ANNOTATION_CREATE_ERROR",o[o.ANNOTATION_UPDATE_ERROR=6000011]="ANNOTATION_UPDATE_ERROR",o[o.ANNOTATION_DELETE_ERROR=6000012]="ANNOTATION_DELETE_ERROR",o[o.PROJECT_DUPLICATE_PATH=6000013]="PROJECT_DUPLICATE_PATH",o[o.TEAM_NOT_FOUND=7000001]="TEAM_NOT_FOUND",o[o.TEAM_UUID_NULL=7000002]="TEAM_UUID_NULL",o[o.TEAM_FOLDER_ERROR=7000003]="TEAM_FOLDER_ERROR",o[o.TEAM_FOLDER_DEEP_ERROR=7000004]="TEAM_FOLDER_DEEP_ERROR",o[o.TEAM_FOLDER_UUID_ERROR=7000005]="TEAM_FOLDER_UUID_ERROR",o[o.TEAM_URL_DUPLICATE=7000006]="TEAM_URL_DUPLICATE",o[o.TEAM_CAN_NOT_DELETE=7000007]="TEAM_CAN_NOT_DELETE",o[o.COMPONENT_UUID_NULL=8000001]="COMPONENT_UUID_NULL",o[o.COMPONENT_DATA_NOT_FOUND=8000002]="COMPONENT_DATA_NOT_FOUND",o[o.COMPONENT_NAME_DUPLICATE=8000003]="COMPONENT_NAME_DUPLICATE",o[o.COMPONENT_TYPE_ERROR=8000004]="COMPONENT_TYPE_ERROR",o[o.DELETE_SON_CATEGORY=8001001]="DELETE_SON_CATEGORY",o[o.LICENSE=9000001]="LICENSE",o[o.START_TIME=9000002]="START_TIME",o[o.END_TIME=9000003]="END_TIME",o[o.PROJECT_LIMIT=9000004]="PROJECT_LIMIT",o[o.USER_LIMIT=9000005]="USER_LIMIT",o[o.ONLINE_NUMBER_LIMIT=9000006]="ONLINE_NUMBER_LIMIT",o[o.COMPANY_CODE=9000007]="COMPANY_CODE",o[o.LIMIT_PCB=9000008]="LIMIT_PCB",o[o.LIMIT_SCH=9000009]="LIMIT_SCH",o[o.LIMIT_PANEL=9000011]="LIMIT_PANEL",o[o.TIME_ERROR=9000010]="TIME_ERROR",o[o.LICENSE_ERROR=9000012]="LICENSE_ERROR",o[o.LICENSE_TYPE_ERROR=9000013]="LICENSE_TYPE_ERROR",o[o.LICENSE_ORIGIN_ERROR=9000014]="LICENSE_ORIGIN_ERROR",o[o.BRANCH_DATA_NOT_FOUND=11000001]="BRANCH_DATA_NOT_FOUND",o[o.PARENT_UUID_ERROR=11000002]="PARENT_UUID_ERROR",o[o.BRANCH_MUST_AFTER_NODE=11000003]="BRANCH_MUST_AFTER_NODE",o[o.BRANCH_NAME_ERROR=11000004]="BRANCH_NAME_ERROR",o[o.BRANCH_NAME_DUPLICATE=11000005]="BRANCH_NAME_DUPLICATE",o[o.BRANCH_UUID_ERROR=11000006]="BRANCH_UUID_ERROR",o[o.BRANCH_NODE_SET_ERROR=11000007]="BRANCH_NODE_SET_ERROR",o[o.BRANCH_DELETE_MAIN_ERROR=11000008]="BRANCH_DELETE_MAIN_ERROR",o[o.BRANCH_CHECK_OUT_ERROR=11000009]="BRANCH_CHECK_OUT_ERROR",o[o.DOCUMENT_UUID_ERROR=12000001]="DOCUMENT_UUID_ERROR",o[o.UPDATE_FAILED=12000002]="UPDATE_FAILED",o[o.INNER_API_KEY_ERROR=1000020]="INNER_API_KEY_ERROR",o[o.BRANCH_MORE_THAN_LIMIT=11000010]="BRANCH_MORE_THAN_LIMIT",o[o.WORKSPACE_API_ERROR=1000021]="WORKSPACE_API_ERROR",o))(Nbt||{}),kbt=(o=>(o[o.DB_INIT_ERROR=0]="DB_INIT_ERROR",o[o.PRJ_NOT_EXIST=1]="PRJ_NOT_EXIST",o[o.NET_ERROR=2]="NET_ERROR",o[o.IS_OPENING=3]="IS_OPENING",o[o.NOT_LOGGED_IN=4]="NOT_LOGGED_IN",o[o.HAS_UNSAVED=5]="HAS_UNSAVED",o[o.DIFF_TICKET=6]="DIFF_TICKET",o))(kbt||{});function lL(o,t={}){if(!o)return"";let{proCode:e,code:r,message:i}=o;switch(e||r){case 401:return Qr("UNAUTHORIZED");case 402:return Qr("LOGIN_FAIL");case 422:return Qr("PERMISSION_DENIED");case 1111111:return Qr("PERMISSION_DENIED1");case 2000001:return Qr("PRJ_NOT_EXIST");case 4000002:return Qr("ERROR_PATH");case 6000001:return Qr("PROJECT_NOT_FOUND");case 1111112:return Qr("PERMISSION_DENIED_PARAMS",{type:i});case 1111113:return Qr("DATA_NOT_FOUND");case 1111114:return Qr("PARAMS_DATA_NOT_FOUND",{type:i});case 42222:return Qr("REQUEST_PARAM_ILLEGAL");case 1111115:return Qr("REQUEST_PARAM_ILLEGAL1");case 1111116:return Qr("REQUEST_PARAMS_ILLEGAL2",{type:i});case 1111117:return Qr("REQUEST_PARAMS_NOT_NULL",{type:i});case 1111118:return Qr("REQUEST_PARAMS_NOT_ALL_NULL",{type:i});case 1111119:return Qr("REQUEST_PARAMS_MUST_ARRAY",{type:i});case 1111120:return Qr("REQUEST_PARAMS_MUST_STRING",{type:i});case 1111121:return Qr("REQUEST_PARAMS_MUST_NUMBER",{type:i});case 1111122:return Qr("REQUEST_PARAMS_MUST_NUMBER_ARRAY",{type:i});case 1111123:return Qr("REQUEST_PARAMS_MUST_STRING_ARRAY",{type:i});case 1111124:return Qr("REQUEST_PARAMS_LENGTH_ERROR",{type:i});case 1111125:return Qr("REQUEST_PARAMS_TYPE_ERROR",{type:i});case 2001:return Qr("ILLEGAL_NAME");case 1111126:return Qr("ILLEGAL_NAME1");case 1111128:return Qr("ILLEGAL_NAME_ZH");case 1111127:return Qr("UUID_ERROR");case 1000001:return Qr("DUPLICATE_DATA");case 11e3:return Qr("DUPLICATE_DATA1");case 1000017:return Qr("DUPLICATE_DATA_PARAMS",{type:i});case 10034:return Qr("UPLOAD_LIMIT");case 1000003:return Qr("MORE_THAN_LIMIT");case 1000004:return Qr("FILE_MORE_THAN_LIMIT",{type:i});case 1000005:return Qr("PARAMS_MORE_THAN_LIMIT",{type:i});case 1000006:return Qr("IMAGE_MORE_THAN_LIMIT_PARAMS");case 1000007:return Qr("FILE_MORE_THAN_LIMIT_PARAMS");case 1000019:return Qr("END_MUST_AFTER_START");case 1000002:return Qr("FILE_READ_ONLY");case 1000008:return Qr("FILE_READ_ONLY1");case 1000010:return Qr("DATA_NOT_EXIST",{documentName:t.documentName});case 1000009:return Qr("REQUEST_PARAMS_TIME_ERROR");case 1000018:return Qr("FILES_PATH_NOT_FOUND");case 1000011:return Qr("FILES_DATA_NOT_FOUND");case 1000012:return Qr("FILES_TYPE_ERROR");case 1000013:return Qr("FILES_TYPE_MUST_BE_ONE",{type:i});case 1000014:return Qr("SET_WATERMARK_FAIL");case 1000015:return Qr("MYSQL_CRUD_ERROR",{type:i});case 1000016:return Qr("PARAMS_JSON_FAILED",{type:i});case 3000001:return Qr("MYSQL_ERROR");case 404:return Qr("NOT_FOUND");case 2002:return Qr("PRJ_NAME_EXISTS");case 3002:return Qr("BACKUP_NAME_EXISTS");case 2003:return Qr("TITLE_ILLEGAL_LEN",{documentName:t.documentName});case 2000001:return Qr("LIB_NOT_EXIST");case 3001001:return Qr("CONFIG_API_URLS_ERROR");case 3001002:return Qr("ONE_CLICK_ORDER_NOT_OPEN");case 3001003:return Qr("MATERIAL_NOT_OPEN");case 3001004:return Qr("SNAPSHOT_DEPTH_LIMIT");case 3001005:return Qr("OCR_SYMBOL_URL_ERROR");case 4000001:return Qr("USER_DATA_NOT_FOUND");case 4000012:return Qr("USER_DISABLE_ERROR");case 4000003:return Qr("USER_EXISTS_LOGIN_ERROR");case 4000004:return Qr("USER_UNAUTHORIZED_MODULES_ERROR");case 4000005:return Qr("USER_UNAUTHORIZED_ACCESS_ERROR");case 4000006:return Qr("ADMIN_NOT_CHANGE_PASSWORD");case 4000007:return Qr("SAME_PASSWORD_NEW_PASSWORD");case 4000008:return Qr("USER_ONLINE_REGISTRATION_FAILED");case 4000009:return Qr("USER_PASSWORD_CAN_NOT_DEFAULT");case 4000010:return Qr("USER_BEFORE_PASSWORD_ERROR");case 4000011:return Qr("USER_PASSWORD_LENGTH_ERROR");case 5000001:return Qr("ORG_ROLE_NOT_CREATE");case 5000002:return Qr("ORG_ROLE_NAME_DUPLICATE");case 5000003:return Qr("ORG_ROLE_ORIGIN_ERROR",{message:i});case 5000004:return Qr("ORG_ROLE_NOT_DEFAULT");case 5000005:return Qr("ADMIN_ROLE_NOT_CHANGE");case 5000006:return Qr("ADMIN_NOT_CHANGE_STATUS");case 6000002:return Qr("PROJECT_ARCHIVED");case 6000003:return Qr("PROJECT_UUID_NULL");case 6000004:return Qr("PROJECT_UUID_ERROR");case 6000005:return Qr("PROJECT_OR_TEAM_UUID_ERROR");case 6000006:return Qr("PROJECT_NOT_PERSON_ERROR");case 6000007:return Qr("PROJECT_DUPLICATE_NAME");case 6000008:return Qr("ANNOTATION_HAS_BE_FOUND");case 6000009:return Qr("ANNOTATION_NOT_FOUND");case 6000010:return Qr("ANNOTATION_CREATE_ERROR");case 6000011:return Qr("ANNOTATION_UPDATE_ERROR");case 6000012:return Qr("ANNOTATION_DELETE_ERROR");case 6000013:return Qr("PROJECT_DUPLICATE_PATH");case 7000001:return Qr("TEAM_NOT_FOUND");case 7000002:return Qr("TEAM_UUID_NULL");case 7000003:return Qr("TEAM_FOLDER_ERROR");case 7000004:return Qr("TEAM_FOLDER_DEEP_ERROR");case 7000005:return Qr("TEAM_FOLDER_UUID_ERROR");case 7000006:return Qr("TEAM_URL_DUPLICATE");case 7000007:return Qr("TEAM_CAN_NOT_DELETE");case 8000001:return Qr("COMPONENT_UUID_NULL");case 8000002:return Qr("COMPONENT_DATA_NOT_FOUND");case 8000003:return Qr("COMPONENT_NAME_DUPLICATE");case 8000004:return Qr("COMPONENT_TYPE_ERROR");case 8001001:return Qr("DELETE_SON_CATEGORY");case 9000001:return Qr("LICENSE");case 9000002:return Qr("START_TIME");case 9000003:return Qr("END_TIME");case 9000004:return Qr("PROJECT_LIMIT");case 9000005:return Qr("USER_LIMIT");case 9000006:return Qr("ONLINE_NUMBER_LIMIT");case 9000007:return Qr("COMPANY_CODE");case 9000008:return Qr("LIMIT_PCB");case 9000009:return Qr("LIMIT_SCH");case 9000011:return Qr("LIMIT_PANEL");case 9000010:return Qr("TIME_ERROR");case 9000012:return Qr("LICENSE_ERROR");case 9000013:return Qr("LICENSE_TYPE_ERROR");case 9000014:return Qr("LICENSE_ORIGIN_ERROR",{type:i});case 11000001:return Qr("BRANCH_DATA_NOT_FOUND");case 11000002:return Qr("PARENT_UUID_ERROR");case 11000003:return Qr("BRANCH_MUST_AFTER_NODE");case 11000004:return Qr("BRANCH_NAME_ERROR");case 11000005:return Qr("BRANCH_NAME_DUPLICATE");case 11000006:return Qr("BRANCH_UUID_ERROR");case 11000007:return Qr("BRANCH_NODE_SET_ERROR");case 11000008:return Qr("BRANCH_DELETE_MAIN_ERROR");case 11000009:return Qr("BRANCH_CHECK_OUT_ERROR");case 12000001:return Qr("DOCUMENT_UUID_ERROR");case 12000002:return Qr("UPDATE_FAILED");case 1000020:return Qr("INNER_API_KEY_ERROR");case 11000010:return Qr("BRANCH_MORE_THAN_LIMIT");case 1000021:return Qr("WORKSPACE_API_ERROR")}return i}function Qr(o,t){return g7e()==="zh-cn"?nPe.match("codeCN",o,t)||"":nPe.match("codeEN",o,t)||""}function vP(o){return o===422||o===1111111||o===6000002}function QT(o){return o===1000001||o===11e3||o===8000003}var Bbt=class{static blobToUint8Array(o){return new Promise((t,e)=>{let r=new FileReader;r.onload=()=>{r.result instanceof ArrayBuffer?t(new Uint8Array(r.result)):e(new Error("FileReader result is not an ArrayBuffer"))},r.onerror=()=>e(r.error),r.readAsArrayBuffer(o)})}static bufferToString(o,t="utf-8"){return new TextDecoder(t).decode(o)}},Fbt=(o=>(o.IsActive="/pro-ui/liveness/monitor/isActive",o))(Fbt||{});async function Vbt(){var o;if(!ZW)return!0;let t=!1,e=Q();return typeof window>"u"&&e._TAB_ID_?t=await $Pe(`/${e._TAB_ID_}/notify`).rpcCall("/pro-ui/liveness/monitor/isActive"):t=(o=await on.messageBus.rpcCall("/pro-ui/liveness/monitor/isActive"))==null?void 0:o.message,t?!0:(console.error("[\u7F16\u8F91\u5668\u5904\u4E8E\u5931\u6D3B\u72B6\u6001, \u8BF7\u68B3\u7406\u903B\u8F91, \u4E0D\u8981\u53D1\u9001\u4E0D\u5FC5\u8981\u7684\u8BF7\u6C42!!!]"),!1)}var Gbt=(o=>(o.Text="text/plain;charset=UTF-8",o.Json="application/json",o.Form="application/x-www-form-urlencoded;charset=UTF-8",o.FormData="multipart/form-data",o))(Gbt||{}),Ubt=(o=>(o.ContentType="Content-Type",o.Editorversion="Editor-Version",o))(Ubt||{}),Hbt=(o=>(o.Json="json",o.Blob="blob",o))(Hbt||{});async function Vn(o,t,e={},r={},i=!1){if(!await Wbt())throw new Error("\u975E\u6CD5\u8BF7\u6C42!!!");return await zbt(o,t,e,r,i)}async function Wbt(){return await Vbt()}async function zbt(o,t,e={},r={},i=!1){return new Promise(async(n,s)=>{let a=0,l=3,c=async()=>{try{var h;o=o||"GET",Ybt(o,e,r),h=e,r=r;let u=jbt(o,t,h,r);h=u.params,t=u.url;let d=new XMLHttpRequest;r.withCredentials!==void 0&&(d.withCredentials=r.withCredentials),r.responseType!==void 0&&(d.responseType=r.responseType),d.open(o,t,!0),Xbt(d,o,r,i),h=await qbt(d,o,t,h,r);let p=!1,m=()=>{if(!p)if(p=!0,d.status===200)try{if(r.responseType==="blob")n(d.response);else{let g=JSON.parse(d.responseText);g.success===!1&&(g.message=lL(g)||g.message),n(g)}}catch(g){console.warn("catch ajax error...",g),n({success:!1,message:"Network Error!"})}else if(d.status===429)if(a<l){let g=d.getResponseHeader("Retry-After"),y=g?parseInt(g)*1e3:6e4;console.warn(`Too Many Requests, retry after ${y/1e3}s...`,d.status),a++,setTimeout(()=>{p=!1,c()},y)}else console.warn("Too Many Requests, max retry exceeded",d.status),n({success:!1,code:d.status,message:"\u8BF7\u6C42\u8FC7\u4E8E\u9891\u7E41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5"});else d.status===404?(console.warn("catch ajax error...",d.status),n({success:!1,code:d.status,message:"Network Error!"})):d.status===500?(console.warn("catch ajax error...",d.status),n({success:!1,code:d.status,message:"Network Error!"})):(console.warn("catch ajax error...",d.status),n({success:!1,code:d.status,message:"Network Error!"}))};if(d.onreadystatechange=function(){d.readyState===4&&m()},d.onerror=function(g){p||(console.warn("catch ajax error...",g),n({success:!1,message:"Network Error!"}))},d.ontimeout=function(){p||(p=!0,console.warn("ajax timeout..."),n({success:!1,message:"\u8BF7\u6C42\u8D85\u65F6"}))},d.onabort=function(){p||(p=!0,console.warn("ajax aborted..."),n({success:!1,message:"\u8BF7\u6C42\u5DF2\u53D6\u6D88"}))},h instanceof Uint8Array){let g=new Blob([h]);d.send(g)}else d.send(h)}catch(u){console.warn("catch ajax error...",u),n({success:!1,message:"Network Error!"})}};await c()})}function Ybt(o,t,e={}){var r;if(o.toLowerCase()!=="get"&&!(t instanceof FormData)&&typeof t!="string"&&(e==null?void 0:e.contentType)!==!1&&!((r=e==null?void 0:e.headers)!=null&&r["Content-Type"])&&(e=e||{},e.headers=Object.assign(e.headers||{},{"Content-Type":"application/json"})),e.headers){let i={};for(let n in e.headers){let s=e.headers[n];i[n]=s}e.headers=i}}function Q6e(o,t=50){return typeof o!="string"?!1:o.length*2>t*1024*1024}function jbt(o,t,e,r={}){var i;let n,s,a,l=[],c=r.headers,h=!1;if(e instanceof FormData)n=e;else if(typeof e=="string")n=e;else if((i=c==null?void 0:c["Content-Type"])!=null&&i.includes("application/json")){if(typeof e=="object"&&e!==null){for(let p in e)if(Q6e(e[p])){h=!0;break}}if(h){let p=new FormData;for(let m in e){let g=e[m];Q6e(g)?p.append(m,new Blob([g],{type:"text/plain"})):p.append(m,typeof g=="object"?JSON.stringify(g):g)}n=p,r.headers&&(r.headers["Content-Type"]="multipart/form-data")}else n=JSON.stringify(e)}else{for(s in e)if(a=e[s],a instanceof Array)for(let p=0;p<a.length;p++){let m=a[p];l.push(encodeURIComponent(`${s}[]`)+"="+encodeURIComponent(m))}else if(Object.prototype.toString.call(a)==="[object Object]")for(let p in a){let m=a[p];l.push(encodeURIComponent(`${s}[${p}]`)+"="+(m?encodeURIComponent(m):""))}else l.push(encodeURIComponent(s)+"="+encodeURIComponent(a));n=l.join("&"),o==="GET"&&n&&typeof n=="string"&&r.searchParams===!0&&(t=t+"?"+n,n={})}let u=/{[a-zA-Z]+}/gim,d=[...new Set(t.match(u))];for(let p of d){let m=p.substring(1,p.length-1);t=t.replace(p,e[m]||"")}return{params:n,url:t}}function Xbt(o,t,e={},r=!1){let i=e.headers;if(i){for(let n in i){let s=i[n];o.setRequestHeader(encodeURI(n),encodeURI(s))}e.contentType!==!1&&!i["Content-Type"]&&o.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8")}else e.contentType!==!1&&o.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");o.setRequestHeader("Editor-Version",self.PRO_EDITOR_VERSION||"");try{if(!r&&!i.path)throw new Error("Missing path")}catch(n){console.error(n)}if(self.document){let n=t.toUpperCase();if(n!=="GET"&&n!=="HEAD"){let s=/XSRF-TOKEN=(\S+);?/.exec(document.cookie);s&&o.setRequestHeader("X-XSRF-TOKEN",decodeURIComponent(s[1]))}}}var tPe=1e4;async function qbt(o,t,e,r,i={}){if(t.match(/post/i)&&e.startsWith("/")&&!e.startsWith("/servicecenter/")&&typeof r=="string"&&r.length>=tPe&&(r=ePe(new TextEncoder().encode(r),{level:1}),o.setRequestHeader("Content-Encoding","gzip")),t.match(/post/i)&&e.startsWith("/")&&!e.startsWith("/servicecenter/")&&r instanceof FormData&&i.gzipFormData===!0){let n=new Set;r.forEach((s,a)=>{n.add(a)});for(let s of n){let a=r.get(s);if(typeof a=="string"&&a.length>=tPe){let l=new Blob([ePe(new TextEncoder().encode(a),{level:1})]);r.set(s,l)}else if(a instanceof Blob&&a.size>=tPe){let l=new Blob([ePe(await Bbt.blobToUint8Array(a),{level:9})]);r.set(s,l,a.name)}}o.setRequestHeader("Content-Encoding","gzip")}return r}async function iNe(o,t,e,r){if(!r||!e){let s=`invalid parameters ${r}|${e}.`;return{code:Ci.ERR_CODE.NORMAL,success:!1,msg:s,message:s,result:null}}let i=await Vn("POST",t?xc(kn.DEVICE.DELETE,{uuid:r}):xc(kn.COMPONENT.DELETE,{uuid:r}),{},{headers:{"Content-Type":"application/json",path:e}});if(i.code===0&&i.success)return{code:0,success:!0,msg:"",message:"",result:{componentId:r}};let n=i.message||i.msg||"Request Error.";return{...i,msg:n,message:n,result:{componentId:r}}}async function $bt(o,t,e){if(o){let h="operations not currently supported.";return{code:Ci.ERR_CODE.NORMAL,success:!1,msg:h,message:h,result:null}}let r={code:0,success:!0,result:{devices:{succeed:[],failed:[]},symbols:{succeed:[],failed:[]},footprints:{succeed:[],failed:[]},d3models:{succeed:[],failed:[]},cbbs:{succeed:[],failed:[]},panels:{succeed:[],failed:[]}},msg:"",message:""},i=await kN(o,!0,t,e.devices||[]);r.result.devices={...i.result};let n=await kN(o,!1,t,e.symbols||[]);r.result.symbols={...n.result};let s=await kN(o,!1,t,e.footprints||[]);r.result.footprints={...s.result};let a=await kN(o,!1,t,e.d3models||[]);r.result.d3models={...a.result};let l=await kN(o,!1,t,e.cbbs||[]);r.result.cbbs={...l.result};let c=await kN(o,!1,t,e.panels||[]);return r.result.panels={...c.result},r}async function kN(o,t,e,r){let i=[],n=[];for(let s=0;s<r.length;s++){let a=await iNe(o,t,e,r[s]);if(a.code===0&&a.success){i.push(r[s]);continue}i.push(r[s])}return{code:0,success:!0,result:{succeed:i,failed:n},msg:"",message:""}}function nNe(o){if(!o)return[];if(o instanceof Array)return o;let t=[];return o!=null&&o.parent_tag&&o!=null&&o.parent_tag.uuid&&t.push(o==null?void 0:o.parent_tag.uuid),o!=null&&o.child_tag&&o!=null&&o.child_tag.uuid&&t.push(o==null?void 0:o.child_tag.uuid),t}function Tv(o){if(!o)return[];if(o instanceof Array)return o;let t=[];return o!=null&&o.parent_tag&&o!=null&&o.parent_tag.name&&t.push(o==null?void 0:o.parent_tag.name),o!=null&&o.child_tag&&o!=null&&o.child_tag.name&&t.push(o==null?void 0:o.child_tag.name),t}function sz(o,t=!1){return o?t?e5e(o):o.indexOf("@")>=0?Kbt(o):o.indexOf("_")>=0?Zbt(o):e5e(o):{componentTitleOrId:void 0,path:void 0,isLocaleFilenameMode:!1}}function e5e(o){let t={componentTitleOrId:void 0,path:void 0,isLocaleFilenameMode:!1};if(!/\|/i.test(o))return t.isLocaleFilenameMode=!1,t.componentTitleOrId=o,t;let e=o.split("|");return t.componentTitleOrId=e[0],t.path=e[1],/\./.test(e[0])?(t.isLocaleFilenameMode=!0,t):(t.isLocaleFilenameMode=!1,t)}function Kbt(o){let t={componentTitleOrId:void 0,path:void 0,isLocaleFilenameMode:!1};if(!/\@/i.test(o))return t.isLocaleFilenameMode=!1,t.componentTitleOrId=o,t;let e=o.split("@");return t.componentTitleOrId=e[0],t.path=e[1],/\./.test(e[0])?(t.isLocaleFilenameMode=!0,t):(t.isLocaleFilenameMode=!1,t)}function Zbt(o){let t={componentTitleOrId:void 0,path:void 0,isLocaleFilenameMode:!1};if(!/_/i.test(o))return t.isLocaleFilenameMode=!1,t.componentTitleOrId=o,t;let e=o.split("_");return t.componentTitleOrId=e[0],t.path=e[1],/\./.test(e[0])?(t.isLocaleFilenameMode=!0,t):(t.isLocaleFilenameMode=!1,t)}async function rTe(o,t){let e=sz(o,!0),r=e.path||t,i={code:Ci.ERR_CODE.NORMAL,success:!0,result:null,msg:""};return i.result={createTime:0,created_at:"",creator:null,dataStr:JSON.stringify({model:`${e.componentTitleOrId}|${r}`,unit:"mm"}),display_title:e.componentTitleOrId||"-",uuid:`${e.componentTitleOrId}|${r}`||"",path:r,description:"",docType:16,modifier:null,owner:null,source:"",tags:{child_tag:[],parent_tag:[]},title:e.componentTitleOrId||"",updateTime:0,updated_at:"",version:"",public:void 0},i}var Jbt=class{constructor(){if(!crypto||!crypto.subtle)throw new Error("\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301crypto api");this.tool=crypto.subtle}},Qbt=class extends Jbt{constructor(){super(),this.keyBuffer=null,this.key=null,this.iv=null}async init(o){try{return this.keyBuffer=o.key,this.key=await this.setKey(this.keyBuffer),this.iv=await this.setIV(o.iv),this}catch{throw new Error(`invalid key or iv! ${o}`)}}setKey(o){if(o instanceof ArrayBuffer)return this.tool.importKey("raw",o,"AES-GCM",!0,["encrypt","decrypt"]);throw new Error(`invalid key! ${o}`)}setIV(o){if(o instanceof ArrayBuffer)return o;throw new Error(`invalid iv! ${o}`)}encrypt(o){return this.tool.encrypt({name:"AES-GCM",iv:this.iv},this.key,o)}decrypt(o){return this.tool.decrypt({name:"AES-GCM",iv:this.iv},this.key,o)}decrypt2(o){return this.tool.decrypt({name:"AES-GCM",iv:this.iv,tagLength:128},this.key,o)}getKey(){return this.keyBuffer}getIV(){return this.iv}};function t5e(o){let t=o.match(/[\da-f]{2}/gi);return t?new Uint8Array(t.map(function(e){return parseInt(e,16)})).buffer:null}function ePt(o,t="utf-8"){var e=new TextDecoder(t);return e.decode(o)}async function az(o){try{if(o.dataStrId){let t=new Headers;t.append("Content-Type","text/plain;charset=UTF-8");let e=await(await fetch(o.dataStrId,{method:"GET",redirect:"error",headers:t})).arrayBuffer();if(e){let r=await tPt(o,e);return ePt(r)}}else if(o.dataStr)return o.dataStr;return null}catch(t){throw new Error("fetch\u5931\u8D25!!!"+t)}}async function tPt(o,t){let e=new Qbt;try{let{key:r,iv:i}=o;if(t&&i&&r){let n=t5e(r),s=t5e(i);await e.init({key:n,iv:s});let a=await e.decrypt(t);return xbt(new Uint8Array(a))}else throw new Error(`\u6570\u636E\u89E3\u5BC6\u5931\u8D25!!!\u6570\u636E\u4E0D\u6B63\u786E:data:${t},key:${r},iv:${i}`)}catch(r){throw new Error("\u6570\u636E\u89E3\u5BC6\u5931\u8D25!!!"+r)}}var oNe=(o=>(o.LIST="/api/projects",o.CBB_LIST="/api/cbbProject",o.CREATE="/api/v4/projects/add",o.GET="/api/v4/projects/{uuid}",o.UPDATE="/api/projects/{uuid}/update",o.DELETE="/api/v4/projects/{uuid}/delete",o.TICKET="/api/projects/{uuid}/ticket",o.BACKUP_LIST="/api/backups",o.BACKUP="/api/backups",o.OPERATE_BACKUP="/api/backups/{uuid}",o.ARCHIVE="/api/backups/archive",o.CREATE_BOARD="/api/projects/{uuid}/boards",o.STAR="/api/projects/{uuid}/star",o.UNSTAR="/api/projects/{uuid}/unstar",o.CREATE_DRAFT="/api/v4/projects/{project_uuid}/draft-history",o.UPLOAD_DRAFT="/api/v4/projects/{project_uuid}/draft-history/{draft_uuid}",o.STRUCTURE="/api/v4/projects/{project_uuid}/branches/{branch_uuid}/structures",o.UPDATE_IMAGES="/api/v4/projects/{projectUuid}/branches/{branchUuid}/thumbs",o.DELETE_IMAGES="/api/v4/projects/{projectUuid}/branches/{branchUuid}/thumbs/{thumbUuid}",o.GET_IMAGES="/api/v4/projects/{projectUuid}/branches/{branchUuid}/thumbs",o))(oNe||{}),sNe=(o=>(o.CREATE="/api/v4/projects/{project_uuid}/branches",o.LIST="/api/v4/projects/{project_uuid}/branches",o.GET="/api/v4/projects/{project_uuid}/branches/{branch_uuid}",o.UPDATE="/api/v4/projects/{project_uuid}/branches/{branch_uuid}",o.DELETE="/api/v4/projects/{project_uuid}/branches/{branch_uuid}",o))(sNe||{}),aNe=(o=>(o.APPLY="/api/v4/snapshots/apply",o.CREATE="/api/v4/snapshots/create",o.GET="/api/v4/projects/branches/histories?path={path}&project={project}&branch={branch}&history={history}&limit={limit}",o.UPLOAD="/api/v4/snapshots/upload-signatures",o.CONFIRM="/api/v4/snapshots/upload-confirm",o))(aNe||{}),lNe=(o=>(o.SET="/api/v4/projects/{project_uuid}/branches/{branch_uuid}/histories",o.GET="/api/v4/projects/{project_uuid}/branches/{branch_uuid}/histories/{history_uuid}",o))(lNe||{}),cNe=(o=>(o.SET="/api/v4/components/{uuid}/histories",o.GET="/api/v4/components/{uuid}/histories/{historyUuid}",o))(cNe||{}),hNe=(o=>(o.LIST="/api/schematic/lists",o.CREATE="/api/schematic/create",o.UPLOAD="/api/schematic/upload",o.DELETE="/api/schematic/{uuid}/delete",o.UPDATE="/api/schematic/{uuid}/update",o.UPDATE_SORT="/api/schematic/{uuid}/update_sort",o.UPDATE_SORT1="/api/v2/documents/updateSorts",o))(hNe||{}),uNe=(o=>(o.LIST="/api/v2/documents/lists",o.CREATE="/api/v2/documents/create",o.UPLOAD="/api/v2/documents/upload",o.UPDATE="/api/v2/documents/{uuid}/update",o.UPDATE_CANVAS="/api/v2/documents/{uuid}/update_canvas",o.BATCH_UPDATE="/api/v2/documents/updateMany",o.DELETE="/api/v2/documents/{uuid}/delete",o.GET="/api/v2/documents/{uuid}",o.GET_BY_TITLE="/api/v2/documents/searchByName",o.GET_BY_SID="/api/v2/schematic/{schematicUuid}/documents",o.MOVE="/api/v2/documents/{uuid}/sort",o.CHECK_IN="/api/v4/documents/checkin/{project}/{branch}",o.CHECK_OUT="/api/v4/documents/checkout/{project}/{branch}",o.GET_CHECK="/api/v4/documents/checkout/{project}/{branch}",o.DELETE_PCB_RELATED="/api/v2/deleteCopperFontComponents",o))(uNe||{}),dNe=(o=>(o.LIST="/api/v2/devices",o.SEARCH_LIST="/api/devices/search",o.CREATE="/api/devices",o.UPLOAD="/api/devices/upload",o.UPDATE="/api/devices/{uuid}",o.BATCH_UPDATE="/api/devices/updateMany",o.GET="/api/v2/devices/{uuid}",o.GET_ATTR_VALUE="/api/devices/attributes",o.GET_ATTR_KEYS="/api/devices/attributeKeys",o.GET_BY_USER_AND_TITLE="/api/v2/devices/searchByUserUuidAndTitle",o.BATCH_GET="/api/devices/searchByIds",o.DELETE="/api/v4/devices/{uuid}/delete",o.STAR="/api/devices/{uuid}/star",o.UNSTAR="/api/devices/{uuid}/unstar",o.PLACE="/api/v2/upload",o))(dNe||{}),pNe=(o=>(o.LIST="/api/v2/components",o.SEARCH_LIST="/api/v2/components/search",o.CREATE="/api/v2/components/add",o.UPLOAD="/api/v2/components/upload",o.UPDATE="/api/v2/components/{uuid}/update",o.UPDATE_CANVAS="/api/v2/components/{uuid}/update_canvas",o.BATCH_UPDATE="/api/v2/components/updateMany",o.DELETE="/api/v4/components/{uuid}/delete",o.GET="/api/v2/components/{uuid}",o.GET_BY_TITLE="/api/v2/searchByTitles",o.GET_BY_DOC_UUID="/api/v2/components/searchByPcbId",o.GET_BY_USER_AND_TITLE="/api/v2/components/searchByUserUuidAndTitle",o.GET_BY_C="/api/searchProductByCode",o.BATCH_GET="/api/v2/components/searchByIds",o.STAR="/api/v2/components/{uuid}/star",o.UNSTAR="/api/v2/components/{uuid}/unstar",o.UPLOAD_3DMODEL="/api/3dmodel/upload",o))(pNe||{}),fNe=(o=>(o.LIST="/api/categories",o.CREATE="/api/categories",o.DELETE="/api/categories/{uuid}/delete",o.UPDATE="/api/categories/{uuid}",o.DEVICE_CATE="/api/open/deviceCate",o))(fNe||{}),mNe=(o=>(o.SEARCH_LIST="/api/coppers/search",o.SEARCH_BY_PCB_UUID="/api/coppers/searchByPcbId",o.SET="/api/coppers/upload",o.DELETE="/api/coppers/delete",o))(mNe||{}),gNe=(o=>(o.SEARCH_LIST="/api/textpath/search",o.SEARCH_BY_PCB_UUID="/api/textpath/searchByPcbId",o.SET="/api/textpath/upload",o.DELETE="/api/textpath/delete",o))(gNe||{}),yNe=(o=>(o.SEARCH_LIST="/api/v2/resources/search",o.SET="/api/v2/resources/upload",o))(yNe||{}),bNe=(o=>(o.LIST="/api/projects/projectUuid/attributes",o.SEARCH_LIST="/api/block_symbol_attributes/search",o.CREATE="/api/block_symbol_attributes",o.UPLOAD="/api/block_symbol_attributes/upload",o.DELETE="/api/block_symbol_attributes/delete",o.TICKET="/api/block_symbol_attributes/tickets",o))(bNe||{}),PNe=(o=>(o.GET_BACKUP="/api/backups/{name}",o.GET_COMPONENT="/api/v2/components/clientSearch",o.GET_DEVICE="/api/devices/clientSearch",o.GET_LIBS="/api/client/libraryPaths",o.CREATE_LIB="/api/client/createPath",o.CREATE_PROJECT="/api/client/createProject",o.OPEN_PROJECT="/api/client/openProject",o.CLOSE_PROJECT="/api/client/closeProject",o.COPY_PROJECT="/api/client/copyProject",o.DELETE_PROJECT="/api/client/deleteProject",o.GET_PROJECT_PATHS="/api/client/projectPaths",o.SELECT_PATH_ON_OFFLINE="/api/fileDialog/saveFile",o.SELECT_PATH_ON_LINE="app://api/fileDialog/saveFile",o.OPEN_DIALOG="/api/fileDialog/openPath",o.SELECT_DIR_ON_OFFLINE="/api/fileDialog/dirtory",o.SELECT_DIR_ON_LINE="app://api/client/openDir",o.SELECT_FILE="/api/fileDialog/file",o.EXPORT_FILE_ON_OFFLINE="/api/client/uploadFile",o.EXPORT_FILE_ON_LINE="app://api/client/uploadFile",o.GET_PRJ_CACHE_LIST="/api/client/tmpBackupList",o.OPERATE_PRJ_CACHE="/api/client/tmpBackup",o.CREATE_PRJ_CACHE_ONLINE="/api/client/tmpBackup/create",o.DELETE_PRJ_CACHE_ONLINE="/api/client/tmpBackup/delete",o.GET_RECENT_PROJECT="/api/client/projectHistory",o.DELETE_RECENT_PROJECT="/api/client/projectHistory/delete",o.SET_KV_CACHE="/api/client/setEditorCache",o.GET_KV_CACHE="/api/client/getEditorCache",o.IS_EXIST_KV_CACHE="/api/client/existEditorCache",o.SEARCH_SCHEMATIC_BY_NAME="/api/schematic/searchByName",o.OPEN_URL="app://api/system/openURL",o.FIND_3DMODEL="/api/client/model/find",o))(PNe||{}),TNe=(o=>(o.LOG="/api/v3/editor_log/upload",o.COMPONENT_LOG="/api/v4/componentLogs",o.TEAMS="/api/teams",o.GET_EDITOR_VERSION="/api/editor/version",o.SET_EDITOR_VERSION="/api/editor/changeVersion",o.ONLINE="/api/userStatistics/registerOnline",o))(TNe||{}),kn={PROJECT:oNe,BRANCH:sNe,SNAPSHOT:aNe,PROJECT_HISTORY:lNe,COMPONENT_HISTORY:cNe,SCHEMATIC:hNe,DOCUMENT:uNe,DEVICE:dNe,COMPONENT:pNe,TAG:fNe,COPPER:mNe,FONT:gNe,BLOB:yNe,ATTR:bNe,CLIENT:PNe,OTHER:TNe};function yv(o=new Date,t="yyyy-MM-dd HH:ii:ss"){if(Number.isNaN(o.getTime()))return"-";let e={"M+":o.getMonth()+1,"d+":o.getDate(),"H+":o.getHours(),"h+":o.getHours(),"i+":o.getMinutes(),"s+":o.getSeconds(),"q+":Math.floor((o.getMonth()+3)/3),S:o.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(o.getFullYear()+"").substr(4-RegExp.$1.length)));for(let r in e)new RegExp("("+r+")").test(t)&&(t=t.replace(RegExp.$1,RegExp.$1.length==1?e[r]:("00"+e[r]).substr((""+e[r]).length)));return t}function rPt(o,t){function e(h){return h>=10?String(h):"0"+h}o instanceof Date?o.getTime().toString().length>13&&(o=new Date(o.getTime()/1e3)):Number.isNaN(Number(o))||o.toString().length>13&&(o=new Date(Number(o)/1e3));let r=new Date(o);if(Number.isNaN(r.getTime()))return"-";let i=r.getFullYear(),n=e(r.getMonth()+1),s=e(r.getDate()),a=e(r.getHours()),l=e(r.getMinutes()),c=e(r.getSeconds());return t==="downProject"?i+"-"+n+"-"+s:t==="migrateStandardProject"?i+"-"+n+"-"+s+"_"+a+"-"+l+"-"+c:t==="y-m-d"||t==="yyyy-MM-dd"?i+"-"+n+"-"+s:t==="y-m-d_h-m-s"?`${i}-${n}-${s}_${a}-${l}-${c}`:i+"-"+n+"-"+s+" "+a+":"+l+":"+c}function iTe(o,t,e){let r=new Date().getTime(),i=yv(new Date(r)),n={avatar:"",nickname:"",username:"",uuid:""},s=o+(e?`|${e}`:"");return{createTime:r,created_at:i,creator:{...n},dataStr:JSON.stringify({model:s,unit:"mm"}),description:"",display_title:t,docType:16,modifier:{...n},owner:{...n},path:e,public:!1,source:"",std_uuid:"",tags:{child_tag:[],parent_tag:[]},ticket:0,title:t,type:0,updateTime:r,updated_at:i,uuid:o,version:""}}async function INe(o){return o?new Promise((t,e)=>{window.fetch(`https://modules.lceda.cn/3dmodel/${o}`,{method:"GET"}).then(async r=>{let i=await r.blob();t({code:0,success:!0,result:i,message:""})}).catch(async r=>{t({code:r?r.code:-9,success:!1,result:null,message:"fetch 3D model file failed."})})}):{code:-1,success:!1,result:null,message:"missing uuid or path or detail data."}}async function lz(o,t=Ci.SYSTEMLIB_UUID,e){if(!o)return null;let r=null,i=sz(o,!0),n=i.path||t;if(i.isLocaleFilenameMode)return r=(await rTe(i.componentTitleOrId,n)).result,r;let s=await Vn("GET",xc(kn.COMPONENT.GET,{uuid:i.componentTitleOrId}),{},{headers:{"Content-Type":"application/json",path:n||void 0}});if(s.code===0&&s.success&&typeof s.result=="object"&&(r=s.result),r&&!r.dataStr)try{let a=await az(r);r.dataStr=a}catch(a){console.error(a)}if(!r&&o&&e){let a=await INe(o);a.success&&a.result instanceof Blob&&(r=iTe(o,e,n))}return r}var iPt=class{constructor(o,t){this.extendLib=t,this.getList=o.getList,this.getSupportedPreviewTypes=o.getSupportedPreviewTypes,this.getDetail=o.getDetail,this.getClassificationTree=o.getClassificationTree,this.getFile=o.getDetail}async getTransformedList(o){let t=await this.getList(o),{count:e,page:r,pageSize:i,lists:n,totalPage:s}=t;return{count:e,page:r,pageSize:i,totalPage:s,lists:n.map(a=>this.extendLib.transformer.transformCbbListItem(a))}}async getTransformedDetail(o){return await this.getDetail(o)}async getTransformedClassificationTree(){var o,t;return(t=(o=await this.getClassificationTree())==null?void 0:o.map(e=>this.extendLib.transformer.transformCategory(e)))!=null?t:[]}},nPt=class{constructor(o,t){this.extendLib=t,this.getList=o.getList,this.getSupportedPreviewTypes=o.getSupportedPreviewTypes,this.getSupportedSymbolTypes=o.getSupportedSymbolTypes,this.getDetail=o.getDetail,this.getClassificationTree=o.getClassificationTree}async getTransformedList(o){let t=await this.getList(o),{count:e,page:r,pageSize:i,lists:n,totalPage:s}=t;for(let a of n)await this.setItem3DModelTitle(a);return{count:e,page:r,pageSize:i,totalPage:s,lists:n.map(a=>this.extendLib.transformer.transformDeviceListItem(a))}}async setItem3DModelTitle(o){var t,e;let r=(t=o.attributes)==null?void 0:t["3D Model"];if(o.attributes&&r&&!((e=o.attributes)!=null&&e["3D Model Title"])){let[i,n=this.extendLib.id]=r.split("|")||[],s=await Rh.getD3Model({uuid:i,path:n,isProject:!1});o.attributes["3D Model Title"]=s.title||s.display_title,o.attributes["3D Model"]=r.includes("|")?r:[i,n].join("|")}}async getTransformedDetail(o,t){let e=await this.getDetail(o,t);return await this.setItem3DModelTitle(e),this.extendLib.transformer.transformDeviceListItem(e)}async getTransformedClassificationTree(){var o,t;return(t=(o=await this.getClassificationTree())==null?void 0:o.map(e=>this.extendLib.transformer.transformCategory(e)))!=null?t:[]}},oPt=class{constructor(o,t){this.extendLib=t,this.getList=o.getList,this.getSupportedPreviewTypes=o.getSupportedPreviewTypes,this.getDetail=o.getDetail,this.getClassificationTree=o.getClassificationTree}async getTransformedList(o){let t=await this.getList(o),{count:e,page:r,pageSize:i,lists:n=[],totalPage:s}=t,a=[];for(let l of n)a.push(await this.extendLib.transformer.transformFootprintListItem(l));return{count:e,page:r,pageSize:i,totalPage:s,lists:a}}async getTransformedDetail(o,t){let e=await this.getDetail(o,t);return await this.extendLib.transformer.transformFootprintListItem(e)}async getTransformedClassificationTree(){var o,t;return(t=(o=await this.getClassificationTree())==null?void 0:o.map(e=>this.extendLib.transformer.transformCategory(e)))!=null?t:[]}},sPt=class{constructor(o,t){this.extendLib=t,this.getList=o.getList,this.getSupportedPreviewTypes=o.getSupportedPreviewTypes,this.getDetail=o.getDetail,this.getClassificationTree=o.getClassificationTree}async getTransformedList(o){let t=await this.getList(o),{count:e,page:r,pageSize:i,lists:n=[],totalPage:s}=t,a=[];for(let l of n)a.push(await this.extendLib.transformer.transformModel3DListItem(l));return{count:e,page:r,pageSize:i,totalPage:s,lists:a}}async getTransformedDetail(o,t){let e=await this.getDetail(o,t);return await this.extendLib.transformer.transformModel3DListItem(e)}async getTransformedClassificationTree(){var o,t;return(t=(o=await this.getClassificationTree())==null?void 0:o.map(e=>this.extendLib.transformer.transformCategory(e)))!=null?t:[]}},aPt=class{constructor(o,t){this.extendLib=t,this.getList=o.getList,this.getSupportedPreviewTypes=o.getSupportedPreviewTypes,this.getDetail=o.getDetail,this.getClassificationTree=o.getClassificationTree}async getTransformedList(o){let t=await this.getList(o),{count:e,page:r,pageSize:i,lists:n=[],totalPage:s}=t,a=[];for(let l of n)a.push(await this.extendLib.transformer.transformPanelLibListItem(l));return{count:e,page:r,pageSize:i,totalPage:s,lists:a}}async getTransformedDetail(o,t){let e=await this.getDetail(o,t);return await this.extendLib.transformer.transformPanelLibListItem(e)}async getTransformedClassificationTree(){var o,t;return(t=(o=await this.getClassificationTree())==null?void 0:o.map(e=>this.extendLib.transformer.transformCategory(e)))!=null?t:[]}},lPt=class{constructor(o,t){this.extendLib=t,this.getList=o.getList,this.getSupportedPreviewTypes=o.getSupportedPreviewTypes,this.getDetail=o.getDetail,this.getClassificationTree=o.getClassificationTree}async getTransformedList(o){let t=await this.getList(o),{count:e,page:r,pageSize:i,lists:n=[],totalPage:s}=t,a=[];for(let l of n)a.push(await this.extendLib.transformer.transformSimModelListItem(l));return{count:e,page:r,pageSize:i,totalPage:s,lists:a}}async getTransformedDetail(o,t){let e=await this.getDetail(o,t);return await this.extendLib.transformer.transformSimModelListItem(e)}async getTransformedClassificationTree(){var o,t;return(t=(o=await this.getClassificationTree())==null?void 0:o.map(e=>this.extendLib.transformer.transformCategory(e)))!=null?t:[]}},cPt=class{constructor(o,t){this.extendLib=t,this.getList=o.getList,this.getSupportedPreviewTypes=o.getSupportedPreviewTypes,this.getSupportedSymbolTypes=o.getSupportedSymbolTypes,this.getDetail=o.getDetail,this.getClassificationTree=o.getClassificationTree}async getTransformedList(o){let t=await this.getList(o),{count:e,page:r,pageSize:i,lists:n,totalPage:s}=t,a=[];for(let l of n)a.push(await this.extendLib.transformer.transformSymbolListItem(l));return{count:e,page:r,pageSize:i,totalPage:s,lists:a}}async getTransformedDetail(o,t){let e=await this.getDetail(o,t);return await this.extendLib.transformer.transformSymbolListItem(e)}async getTransformedClassificationTree(){var o,t;return(t=(o=await this.getClassificationTree())==null?void 0:o.map(e=>this.extendLib.transformer.transformCategory(e)))!=null?t:[]}},hPt=class{constructor(o){this.extendLib=o}transformTime(o=Date.now()){return o.toString().length>13?o/1e3:o}transformTimeStr(o=Date.now()){let t=this.transformTime(o);return yv(new Date(t*1e3))}transformTags(o){let{primaryClassificationName:t,primaryClassificationUuid:e,secondaryClassificationName:r,secondaryClassificationUuid:i}=o||{};return{parent_tag:t?{uuid:e,name:t}:void 0,child_tag:r?{uuid:i,name:r}:void 0}}transformCategory(o,t){var e,r;let i=(e=o.uuid)!=null?e:crypto.randomUUID();return{id:i,title:o.name,titleAdditional:o.name_cn,children:(r=o.children)==null?void 0:r.map(n=>this.transformCategory(n,i)),parentId:t}}transformDeviceListItem(o){var t,e,r,i,n,s,a,l,c,h;return o.edaFormatedData?o.edaFormatedData:{title:o.name||"",description:o.description||"",images:[],uuid:o.uuid||this.extendLib.getDefaultItemId(),path:this.extendLib.id,source:"",version:"",ticket:0,updateTime:this.transformTime(o.updateTime),createTime:this.transformTime(o.createTime||o.updateTime),display_title:o.name||"",creator:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},modifier:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},owner:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},attributes:{...(t=o.attributes)!=null?t:{},Footprint:((e=o.footprint)==null?void 0:e.uuid)||"",Symbol:((r=o.symbol)==null?void 0:r.uuid)||"",Value:o.value||((i=o.attributes)==null?void 0:i.value)||"","Supplier Part":o.supplierPart||((n=o.attributes)==null?void 0:n.supplierPart)||"",Manufacturer:o.manufacturer||((s=o.attributes)==null?void 0:s.manufacturer)||"",Description:o.description||((a=o.attributes)==null?void 0:a.description)||""},symbol:o.symbol?{display_title:o.symbol.name||"",title:((l=o.symbol.name)==null?void 0:l.toLocaleLowerCase())||"",docType:+o.symbol.symbolType,path:this.extendLib.id,uuid:o.symbol.uuid,description:void 0,version:void 0,ticket:void 0,updateTime:void 0,createTime:void 0,creator:void 0,modifier:void 0,owner:void 0,tags:void 0,source:void 0,has_device:void 0,dataStr:void 0,dataStrId:void 0}:void 0,footprint:o.footprint?{display_title:o.footprint.name||"",title:((c=o.footprint.name)==null?void 0:c.toLocaleLowerCase())||"",docType:4,path:this.extendLib.id,uuid:o.footprint.uuid,description:void 0,version:void 0,ticket:void 0,updateTime:void 0,createTime:void 0,creator:void 0,modifier:void 0,owner:void 0,tags:void 0,source:void 0,has_device:void 0,dataStr:void 0,dataStrId:void 0}:void 0,tags:this.transformTags(o.classification),symbol_type:(h=o.symbol)==null?void 0:h.symbolType}}async transformSymbolListItem(o){var t,e,r,i,n,s,a,l,c,h;return o.edaFormatedData?o.edaFormatedData:{docType:o.symbolType,uuid:o.uuid||this.extendLib.getDefaultItemId(),title:o.name||"",description:o.description||"",path:this.extendLib.id,source:"",version:(t=o.version)!=null?t:"",ticket:0,updateTime:this.transformTime(o.updateTime),createTime:this.transformTime(o.createTime||o.updateTime),display_title:o.name||"",creator:o.creator?{nickname:(e=o.creator.name)!=null?e:"",username:(r=o.creator.name)!=null?r:"",uuid:(i=o.creator.uuid)!=null?i:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},modifier:o.modifier?{nickname:(n=o.modifier.name)!=null?n:"",username:(s=o.modifier.name)!=null?s:"",uuid:(a=o.modifier.uuid)!=null?a:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},owner:o.owner?{nickname:(l=o.owner.name)!=null?l:"",username:(c=o.owner.name)!=null?c:"",uuid:(h=o.owner.uuid)!=null?h:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},dataStr:o.data instanceof Blob?await o.data.text():o.data,tags:this.transformTags(o.classification)}}async transformFootprintListItem(o){var t,e,r,i,n,s,a,l,c,h;return o.edaFormatedData?o.edaFormatedData:{docType:4,uuid:o.uuid||this.extendLib.getDefaultItemId(),title:o.name||"",description:o.description||"",path:this.extendLib.id,source:"",version:(t=o.version)!=null?t:"",ticket:0,updateTime:this.transformTime(o.updateTime),createTime:this.transformTime(o.createTime||o.updateTime),display_title:o.name||"",creator:o.creator?{nickname:(e=o.creator.name)!=null?e:"",username:(r=o.creator.name)!=null?r:"",uuid:(i=o.creator.uuid)!=null?i:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},modifier:o.modifier?{nickname:(n=o.modifier.name)!=null?n:"",username:(s=o.modifier.name)!=null?s:"",uuid:(a=o.modifier.uuid)!=null?a:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},owner:o.owner?{nickname:(l=o.owner.name)!=null?l:"",username:(c=o.owner.name)!=null?c:"",uuid:(h=o.owner.uuid)!=null?h:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},dataStr:o.data instanceof Blob?await o.data.text():o.data,tags:this.transformTags(o.classification)}}async transformPanelLibListItem(o){var t,e,r,i,n,s,a,l,c;return o.edaFormatedData?o.edaFormatedData:{...o.edaFormatedData,docType:29,uuid:o.uuid||this.extendLib.getDefaultItemId(),title:o.name||"",description:o.description||"",path:this.extendLib.id,ticket:0,updateTime:this.transformTime(o.updateTime),createTime:this.transformTime(o.createTime||o.updateTime),display_title:o.name||"",creator:o.creator?{nickname:(t=o.creator.name)!=null?t:"",username:(e=o.creator.name)!=null?e:"",uuid:(r=o.creator.uuid)!=null?r:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},modifier:o.modifier?{nickname:(i=o.modifier.name)!=null?i:"",username:(n=o.modifier.name)!=null?n:"",uuid:(s=o.modifier.uuid)!=null?s:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},owner:o.owner?{nickname:(a=o.owner.name)!=null?a:"",username:(l=o.owner.name)!=null?l:"",uuid:(c=o.owner.uuid)!=null?c:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},tags:this.transformTags(o.classification)}}async transformModel3DListItem(o){var t,e,r,i,n,s,a,l,c;return o.edaFormatedData?o.edaFormatedData:{...o.edaFormatedData,uuid:o.uuid||this.extendLib.getDefaultItemId(),title:o.name||"",docType:16,description:o.description||"",path:this.extendLib.id,ticket:0,updateTime:this.transformTime(o.updateTime),createTime:this.transformTime(o.createTime||o.updateTime),display_title:o.name||"",creator:o.creator?{nickname:(t=o.creator.name)!=null?t:"",username:(e=o.creator.name)!=null?e:"",uuid:(r=o.creator.uuid)!=null?r:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},modifier:o.modifier?{nickname:(i=o.modifier.name)!=null?i:"",username:(n=o.modifier.name)!=null?n:"",uuid:(s=o.modifier.uuid)!=null?s:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},owner:o.owner?{nickname:(a=o.owner.name)!=null?a:"",username:(l=o.owner.name)!=null?l:"",uuid:(c=o.owner.uuid)!=null?c:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},tags:this.transformTags(o.classification)}}async transformSimModelListItem(o){var t,e,r,i,n,s,a,l,c;return o.edaFormatedData?o.edaFormatedData:{...o.edaFormatedData,uuid:o.uuid||this.extendLib.getDefaultItemId(),title:o.name||"",path:this.extendLib.id,ticket:0,updateTime:this.transformTime(o.updateTime),createTime:this.transformTime(o.createTime||o.updateTime),display_title:o.name||"",creator:o.creator?{nickname:(t=o.creator.name)!=null?t:"",username:(e=o.creator.name)!=null?e:"",uuid:(r=o.creator.uuid)!=null?r:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},modifier:o.modifier?{nickname:(i=o.modifier.name)!=null?i:"",username:(n=o.modifier.name)!=null?n:"",uuid:(s=o.modifier.uuid)!=null?s:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},owner:o.owner?{nickname:(a=o.owner.name)!=null?a:"",username:(l=o.owner.name)!=null?l:"",uuid:(c=o.owner.uuid)!=null?c:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},tags:this.transformTags(o.classification)}}transformCbbListItem(o){var t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,x,v,D,w,F,H,z,V,W,L,k,N,U;return o.edaFormatedData?o.edaFormatedData:{cbb_project:!0,content:(t=o.description)!=null?t:"",creator:o.creator?{avatar:"",nickname:(e=o.creator.name)!=null?e:"",username:(r=o.creator.name)!=null?r:"",uuid:(i=o.creator.uuid)!=null?i:""}:{avatar:"",nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},modifier:o.modifier?{nickname:(n=o.modifier.name)!=null?n:"",username:(s=o.modifier.name)!=null?s:"",uuid:(a=o.modifier.uuid)!=null?a:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},owner:o.owner?{avatar:"",team:!1,nickname:(l=o.owner.name)!=null?l:"",username:(c=o.owner.name)!=null?c:"",uuid:(h=o.owner.uuid)!=null?h:""}:{avatar:"",team:!1,nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},name:o.name,path:this.extendLib.id,block_symbol:(d=(u=o.blockSymbols)==null?void 0:u.map(B=>{var G;return{uuid:B.uuid,display_title:B.name,docType:17,project_uuid:(G=o.uuid)!=null?G:o.name,title:B.name.toLocaleLowerCase()}}))!=null?d:[],schematics:(m=(p=o.schematics)==null?void 0:p.map(B=>{var G,Y;let X=(Y=(G=o.sheets)==null?void 0:G.filter(K=>K.belongSchematicUuid===B.uuid).map(K=>({uuid:K.uuid,ticket:0})))!=null?Y:[];return{create_at:this.transformTimeStr(B.createTime||B.updateTime),createtime:this.transformTime(B.createTime||B.updateTime),display_name:B.name,name:B.name.toLocaleLowerCase(),project_uuid:o.uuid,sheet_count:X.length,sort:X,ticket:0,update_at:this.transformTimeStr(B.updateTime),uuid:B.uuid,updateTime:this.transformTime(B.updateTime)}}))!=null?m:[],pcb:(y=(g=o.pcbs)==null?void 0:g.map(B=>{var G,Y,X,K,J,se,ce,te,oe,$,fe;return{description:(G=B.description)!=null?G:"",display_title:B.name,docType:3,project_uuid:(Y=o.uuid)!=null?Y:"",thumb:B.thumb,title:B.name.toLocaleLowerCase(),updateTime:this.transformTime(B.updateTime),uuid:B.uuid,creator:B.creator?{avatar:"",nickname:(K=(X=B.creator)==null?void 0:X.name)!=null?K:"",username:(se=(J=B.creator)==null?void 0:J.name)!=null?se:"",uuid:(te=(ce=B.creator)==null?void 0:ce.uuid)!=null?te:""}:{avatar:"",nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},modifier:B.modifier?{nickname:(oe=B==null?void 0:B.modifier.name)!=null?oe:"",username:($=B==null?void 0:B.modifier.name)!=null?$:"",uuid:(fe=B==null?void 0:B.modifier.uuid)!=null?fe:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id}}}))!=null?y:[],schs:(P=(b=o.sheets)==null?void 0:b.map(B=>{var G,Y,X,K,J,se,ce,te;return{description:(G=B.description)!=null?G:"",display_title:B.name,docType:1,project_uuid:(Y=o.uuid)!=null?Y:"",schematic_uuid:B.belongSchematicUuid,thumb:B.thumb,title:B.name.toLocaleLowerCase(),updateTime:this.transformTime(B.updateTime),uuid:B.uuid,creator:B.creator?{avatar:"",nickname:(X=B==null?void 0:B.creator.name)!=null?X:"",username:(K=B==null?void 0:B.creator.name)!=null?K:"",uuid:(J=B==null?void 0:B.creator.uuid)!=null?J:""}:{avatar:"",nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id},modifier:B!=null&&B.modifier?{nickname:(se=B==null?void 0:B.modifier.name)!=null?se:"",username:(ce=B==null?void 0:B.modifier.name)!=null?ce:"",uuid:(te=B==null?void 0:B.modifier.uuid)!=null?te:""}:{nickname:this.extendLib.title,username:this.extendLib.title,uuid:this.extendLib.id}}}))!=null?P:[],tags:{parent_tag:{name:(I=(T=o.classification)==null?void 0:T.primaryClassificationName)!=null?I:"",name_cn:(E=(C=o.classification)==null?void 0:C.primaryClassificationName)!=null?E:"",title:(_=(O=o.classification)==null?void 0:O.primaryClassificationName)!=null?_:"",uuid:(v=(x=o.classification)==null?void 0:x.primaryClassificationUuid)!=null?v:""},child_tag:{name:(w=(D=o.classification)==null?void 0:D.secondaryClassificationName)!=null?w:"",name_cn:(H=(F=o.classification)==null?void 0:F.secondaryClassificationName)!=null?H:"",title:(V=(z=o.classification)==null?void 0:z.secondaryClassificationName)!=null?V:"",uuid:(L=(W=o.classification)==null?void 0:W.secondaryClassificationUuid)!=null?L:""}},updated_at:this.transformTimeStr(o.updateTime),uuid:(k=o.uuid)!=null?k:o.name,boards:(U=(N=o.boards)==null?void 0:N.map(B=>({name:B.name,pcb:B.pcbUuid,sch:B.schUuid})))!=null?U:[]}}},uPt=class CNe{constructor(t){this.transformer=new hPt(this),this.id=t.id,this.isVisible=e=>t.isVisible?t.isVisible(e)&&this.isInTab(e.tabName):this.isInTab(e.tabName),this.title=t.title,this.position=t.position,t.device&&(this.device=new nPt(t.device,this)),t.symbol&&(this.symbol=new cPt(t.symbol,this)),t.footprint&&(this.footprint=new oPt(t.footprint,this)),t.panelLib&&(this.panelLib=new aPt(t.panelLib,this)),t.cbb&&(this.cbb=new iPt(t.cbb,this)),t.model3D&&(this.model3D=new sPt(t.model3D,this)),t.modelSimLib&&(this.modelSimLib=new lPt(t.modelSimLib,this))}static async set(t){var e,r,i,n,s,a,l,c,h,u;let d=new CNe(t);return d._deviceSupportedSymbolTypes=await((r=(e=t.device)==null?void 0:e.getSupportedSymbolTypes)==null?void 0:r.call(e)),d._symbolSupportedSymbolTypes=await((n=(i=t.symbol)==null?void 0:i.getSupportedSymbolTypes)==null?void 0:n.call(i)),d._deviceSupportedPreviewTypes=await((a=(s=t.device)==null?void 0:s.getSupportedPriviewTypes)==null?void 0:a.call(s)),d._footprintSupportedPreviewTypes=await((c=(l=t.footprint)==null?void 0:l.getSupportedPriviewTypes)==null?void 0:c.call(l)),d._panelLibSupportedPreviewTypes=await((u=(h=t.panelLib)==null?void 0:h.getSupportedPriviewTypes)==null?void 0:u.call(h)),d}getDefaultItemId(){return crypto.randomUUID().replace("-","")}getLibraryFunctionsClassInTab(t){switch(t){case"cbb":return this==null?void 0:this.cbb;case"device":return this==null?void 0:this.device;case"symbol":return this==null?void 0:this.symbol;case"footprint":return this==null?void 0:this.footprint;case"panelLib":return this==null?void 0:this.panelLib;case"model3D":return this==null?void 0:this.model3D;case"modelSimLib":return this==null?void 0:this.modelSimLib;default:return null}}isInTab(t){return!!this.getLibraryFunctionsClassInTab(t)}isHasCategoryTreeInTab(t){let e=this.getLibraryFunctionsClassInTab(t);return!!(e!=null&&e.getClassificationTree)}async getAmountByWd(t,e){var r;let i=this.getLibraryFunctionsClassInTab(t),n=await(i==null?void 0:i.getList({page:1,pageSize:1,query:{wd:e}}));return(r=n==null?void 0:n.count)!=null?r:0}getTabByCategoryType(t){switch(t){case 1:return"cbb";case 3:return"device";case 2:return"symbol";case 4:return"footprint";default:return null}}async getClassificationTreeInTab(t){var e;return this.isHasCategoryTreeInTab(t)?await((e=this.getLibraryFunctionsClassInTab(t))==null?void 0:e.getClassificationTree()):null}async getCategoryTreeDataItemsInTab(t){let e=await this.getClassificationTreeInTab(t);return e==null?void 0:e.map(r=>this.transformer.transformCategory(r))}async getClassificationTreeByCategoryType(t){let e=this.getTabByCategoryType(t);return e&&this.getClassificationTreeInTab(e)}async getCategoryTreeDataItemsByCategoryType(t){let e=this.getTabByCategoryType(t);return e&&this.getCategoryTreeDataItemsInTab(e)}getSelectTypeListInTab(t){let e=[];if(t==="device"){let r=this._deviceSupportedSymbolTypes;e=r?Y6e.filter(i=>r.includes(Number(i.value))||!i.value):Y6e}else if(t==="symbol"){let r=this._symbolSupportedSymbolTypes;e=r?j6e.filter(i=>r.includes(Number(i.value))||!i.value):j6e}return e.length>2?e:[]}getPreviewTypesInTab(t){let e=ibt[t];return t==="device"&&this._deviceSupportedPreviewTypes?e=e.filter(r=>{var i;return(i=this._deviceSupportedPreviewTypes)==null?void 0:i.includes(r)}):t==="footprint"&&this._footprintSupportedPreviewTypes&&(e=e.filter(r=>{var i;return(i=this._footprintSupportedPreviewTypes)==null?void 0:i.includes(r)})),e}async getListInTab(t,e){var r;return await((r=this.getLibraryFunctionsClassInTab(t))==null?void 0:r.getList(e))}async getTransformedListInTab(t,e){var r;return await((r=this.getLibraryFunctionsClassInTab(t))==null?void 0:r.getTransformedList(e))}async getDetailInTab(t,e,r){var i;return await((i=this.getLibraryFunctionsClassInTab(t))==null?void 0:i.getDetail(e,r))}async getTransformedDetailInTab(t,e,r){var i;return await((i=this.getLibraryFunctionsClassInTab(t))==null?void 0:i.getTransformedDetail(e,r))}},dPt=class{constructor(o=10){this._runingCount=0,this._handleCount=0,this._queue=[],this._results=[],this._windowSize=o,this._finishCallback=null,this._taskStartCallback=null,this._taskEndCallback=null}pushTask(o){this._queue.push(o)}setFinishCallback(o){this._finishCallback=o}setTaskStartCallback(o){this._taskStartCallback=o}setTaskEndCallback(o){this._taskEndCallback=o}next(){for(;this._runingCount<this._windowSize&&this._queue.length>0;){this._runingCount+=1,this._handleCount+=1;let o=this._handleCount-1,t=this._queue.shift();this._taskStartCallback&&this._taskStartCallback(o),t(o).then(e=>{this._results.push(e)}).catch(e=>{this._results.push(e)}).finally(()=>{this._runingCount-=1,this._taskEndCallback&&this._taskEndCallback(this._results[this._results.length-1]),this.next()})}this._runingCount<=0&&this._finishCallback&&this._finishCallback(this._results)}},nTe=class{onString(o,t,e){}onAttr(o,t,e){}onGroup(o,t,e,r,i){}onDelGroup(o,t,e,r){}onDelString(o,t,e,r){}onDelAttr(o,t,e,r){}onPanelizeSide(o,t,e,r){}onDelPanelizeSide(o,t,e,r){}onPanelizeStamp(o,t,e,r){}onDelPanelizeStamp(o,t,e,r){}onPanelize(o,t,e,r){}onDelPanelize(o,t,e){}onRuleSelector(o,t,e,r){}onDelRuleSelector(o,t,e,r){}onRule(o,t,e,r){}onDelRule(o,t,e,r,i){}onRuleTemplate(o,t,e,r){}onDimension(o,t,e,r,i,n){}onDelDimension(o,t,e,r){}onBoss(o,t,e,r,i,n){}onDelBoss(o,t,e,r){}onShellEntity(o,t,e,r,i,n){}onDelShellEntity(o,t,e,r){}onShellCut(o,t,e,r,i,n){}onDelShellCut(o,t,e,r){}onCrease(o,t,e,r,i,n){}onDelCrease(o,t,e,r){}onShell(o,t,e,r,i,n){}onDelShell(o,t,e,r){}onFpcFill(o,t,e,r,i,n){}onDelFpcFill(o,t,e,r){}onTeardrop(o,t,e,r,i,n){}onDelTeardrop(o,t,e,r){}onImage(o,t,e,r,i,n){}onDelImage(o,t,e,r){}onPoured(o,t,e,r,i,n){}onDelPoured(o,t,e,r){}onPour(o,t,e,r,i,n){}onDelPour(o,t,e,r){}onRegion(o,t,e,r,i,n){}onDelRegion(o,t,e,r){}onFill(o,t,e,r,i,n){}onDelFill(o,t,e,r){}onPoly(o,t,e,r,i,n){}onDelPoly(o,t,e,r){}onEQLenGrp(o,t,e,r,i){}onDelEQLenGrp(o,t,e,r){}onDelProp(o,t,e,r){}onObj(o,t,e,r,i,n){}onDelObj(o,t,e,r){}onArc(o,t,e,r,i,n){}onDelArc(o,t,e,r){}onCArc(o,t,e,r,i,n){}onDelCArc(o,t,e,r){}onLine(o,t,e,r,i,n){}onDelLine(o,t,e,r){}onPad(o,t,e,r,i,n){}onDelPad(o,t,e,r){}onVia(o,t,e,r,i,n){}onDelVia(o,t,e,r){}onDelConnect(o,t,e,r){}onPreference(o,t,e,r){}onSilkOpts(o,t,e,r,i){}onDelSilkOpts(o,t,e,r){}onPrimitive(o,t,e,r,i){}onDelPrimitive(o,t,e,r){}onNet(o,t,e,r,i){}onDelNet(o,t,e,r){}onPartition(o,t,e,r,i,n){}onDelPartition(o,t,e,r){}onActiveLayer(o,t,e,r){}onLayerPhys(o,t,e,r,i){}onDelLayerPhys(o,t,e,r){}onLayer(o,t,e,r,i){}onDelLayer(o,t,e,r){}onCanvas(o,t,e,r){}onDocDetail(o,t,e,r){}onStringNum(o,t){}onAttrNum(o,t){}onDimensionNum(o,t){}onBossNum(o,t){}onShellEntityNum(o,t){}onShellCutNum(o,t){}onCreaseNum(o,t){}onShellNum(o,t){}onFpcFillNum(o,t){}onTeardropNum(o,t){}onImageNum(o,t){}onPouredNum(o,t){}onPourNum(o,t){}onRegionNum(o,t){}onFillNum(o,t){}onPolyNum(o,t){}onObjNum(o,t){}onArcNum(o,t){}onCArcNum(o,t){}onLineNum(o,t){}onPadNum(o,t){}onViaNum(o,t){}onPartitionNum(o,t){}},pPt=class extends nTe{constructor(o){super(),this.source={},this._action=o}get action(){return this._action}getSource(){return this.source}onString(o,t,e){this.source[o]=t}onAttr(o,t,e){e||(this.action&&this.action(o,t),this.source[o]=t)}onDimension(o,t,e,r,i,n){this.source[o]=i}onBoss(o,t,e,r,i,n){this.source[o]=i}onShellEntity(o,t,e,r,i,n){this.source[o]=i}onShellCut(o,t,e,r,i,n){this.source[o]=i}onCrease(o,t,e,r,i,n){this.source[o]=i}onShell(o,t,e,r,i,n){this.source[o]=i}onFpcFill(o,t,e,r,i,n){this.source[o]=i}onTeardrop(o,t,e,r,i,n){this.source[o]=i}onImage(o,t,e,r,i,n){this.source[o]=i}onPoured(o,t,e,r,i,n){this.source[o]=i}onPour(o,t,e,r,i,n){this.source[o]=i}onRegion(o,t,e,r,i,n){this.source[o]=i}onFill(o,t,e,r,i,n){this.source[o]=i}onPoly(o,t,e,r,i,n){this.source[o]=i}onObj(o,t,e,r,i,n){this.source[o]=i}onArc(o,t,e,r,i,n){this.source[o]=i}onCArc(o,t,e,r,i,n){this.source[o]=i}onLine(o,t,e,r,i,n){this.source[o]=i}onPad(o,t,e,r,i,n){this.source[o]=i}onVia(o,t,e,r,i,n){this.source[o]=i}},SNe=class extends Q5e{onXSignalsGroup(o,t,e,r,i){}onDelXSignalsGroup(o,t,e,r){}onXSignals(o,t,e,r,i){}onDelXSignals(o,t,e,r){}onBoard(o,t,e,r){}onDelBoard(o,t,e){}constructor(o,t,e){super(o,t,e,new qPe(!1)),this._compilerHandler=null}async init(o=!1,t=!1,e=!1,r=!1){if(!this.uuid)debugger;return super.init(o,t,e,r)}onBlob(o,t,e,r,i){}onDelBlob(o,t,e,r){}onFont(o,t,e,r){}onDelFont(o,t,e,r){}canvasSelected(){return""}onSelectChange(o,t,e){}onSelectQuit(o,t){}onLayerFill(o,t,e,r,i){}onDelLayerFill(o,t,e,r){}setHandler(o){this._compilerHandler=o}onGroup(o,t,e,r,i){this._compilerHandler&&this._compilerHandler.onGroup(o,t,e,r,i)}onDelGroup(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelGroup(o,t,e,r)}onString(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onString(o,i,n)}onDelString(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelString(o,t,e,r)}onAttr(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onAttr(o,i,n)}onDelAttr(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelAttr(o,t,e,r)}onPanelizeSide(o,t,e,r){this._compilerHandler&&this._compilerHandler.onPanelizeSide(o,t,e,r)}onDelPanelizeSide(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelPanelizeSide(o,t,e,r)}onPanelizeStamp(o,t,e,r){this._compilerHandler&&this._compilerHandler.onPanelizeStamp(o,t,e,r)}onDelPanelizeStamp(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelPanelizeStamp(o,t,e,r)}onPanelize(o,t,e,r){this._compilerHandler&&this._compilerHandler.onPanelize(o,t,e,r)}onDelPanelize(o,t,e){this._compilerHandler&&this._compilerHandler.onDelPanelize(o,t,e)}onRuleSelector(o,t,e,r){this._compilerHandler&&this._compilerHandler.onRuleSelector(o,t,e,r)}onDelRuleSelector(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelRuleSelector(o,t,e,r)}onRule(o,t,e,r){this._compilerHandler&&this._compilerHandler.onRule(o,t,e,r)}onDelRule(o,t,e,r,i){this._compilerHandler&&this._compilerHandler.onDelRule(o,t,e,r,i)}onRuleTemplate(o,t,e,r){this._compilerHandler&&this._compilerHandler.onRuleTemplate(o,t,e,r)}onDimension(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onDimension(o,t,e,r,i,n)}onDelDimension(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelDimension(o,t,e,r)}onBoss(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onBoss(o,t,e,r,i,n)}onDelBoss(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelBoss(o,t,e,r)}onShellEntity(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onShellEntity(o,t,e,r,i,n)}onDelShellEntity(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelShellEntity(o,t,e,r)}onShellCut(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onShellCut(o,t,e,r,i,n)}onDelShellCut(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelShellCut(o,t,e,r)}onCrease(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onCrease(o,t,e,r,i,n)}onDelCrease(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelCrease(o,t,e,r)}onShell(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onShell(o,t,e,r,i,n)}onDelShell(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelShell(o,t,e,r)}onFpcFill(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onFpcFill(o,t,e,r,i,n)}onDelFpcFill(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelFpcFill(o,t,e,r)}onTeardrop(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onTeardrop(o,t,e,r,i,n)}onDelTeardrop(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelTeardrop(o,t,e,r)}onImage(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onImage(o,t,e,r,i,n)}onDelImage(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelImage(o,t,e,r)}onPoured(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onPoured(o,t,e,r,i,n)}onDelPoured(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelPoured(o,t,e,r)}onPour(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onPour(o,t,e,r,i,n)}onDelPour(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelPour(o,t,e,r)}onRegion(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onRegion(o,t,e,r,i,n)}onDelRegion(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelRegion(o,t,e,r)}onFill(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onFill(o,t,e,r,i,n)}onDelFill(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelFill(o,t,e,r)}onPoly(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onPoly(o,t,e,r,i,n)}onDelPoly(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelPoly(o,t,e,r)}onEQLenGrp(o,t,e,r,i){this._compilerHandler&&this._compilerHandler.onEQLenGrp(o,t,e,r,i)}onDelEQLenGrp(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelEQLenGrp(o,t,e,r)}onDelProp(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelProp(o,t,e,r)}onObj(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onObj(o,t,e,r,i,n)}onDelObj(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelObj(o,t,e,r)}onArc(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onArc(o,t,e,r,i,n)}onDelArc(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelArc(o,t,e,r)}onCArc(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onCArc(o,t,e,r,i,n)}onDelCArc(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelCArc(o,t,e,r)}onLine(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onLine(o,t,e,r,i,n)}onDelLine(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelLine(o,t,e,r)}onPad(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onPad(o,t,e,r,i,n)}onDelPad(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelPad(o,t,e,r)}onVia(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onVia(o,t,e,r,i,n)}onDelVia(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelVia(o,t,e,r)}onDelConnect(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelConnect(o,t,e,r)}onPreference(o,t,e,r){this._compilerHandler&&this._compilerHandler.onPreference(o,t,e,r)}onSilkOpts(o,t,e,r,i){this._compilerHandler&&this._compilerHandler.onSilkOpts(o,t,e,r,i)}onDelSilkOpts(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelSilkOpts(o,t,e,r)}onPrimitive(o,t,e,r,i){this._compilerHandler&&this._compilerHandler.onPrimitive(o,t,e,r,i)}onDelPrimitive(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelPrimitive(o,t,e,r)}onNet(o,t,e,r,i){this._compilerHandler&&this._compilerHandler.onNet(o,t,e,r,i)}onDelNet(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelNet(o,t,e,r)}onPartition(o,t,e,r,i,n){this._compilerHandler&&this._compilerHandler.onPartition(o,t,e,r,i,n)}onDelPartition(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelPartition(o,t,e,r)}onActiveLayer(o,t,e,r){this._compilerHandler&&this._compilerHandler.onActiveLayer(o,t,e,r)}onLayerPhys(o,t,e,r,i){this._compilerHandler&&this._compilerHandler.onLayerPhys(o,t,e,r,i)}onDelLayerPhys(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelLayerPhys(o,t,e,r)}onLayer(o,t,e,r,i){this._compilerHandler&&this._compilerHandler.onLayer(o,t,e,r,i)}onDelLayer(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDelLayer(o,t,e,r)}onCanvas(o,t,e,r){this._compilerHandler&&this._compilerHandler.onCanvas(o,t,e,r)}onDocDetail(o,t,e,r){this._compilerHandler&&this._compilerHandler.onDocDetail(o,t,e,r)}onStringNum(o,t){this._compilerHandler&&this._compilerHandler.onStringNum(o,t)}onAttrNum(o,t){this._compilerHandler&&this._compilerHandler.onAttrNum(o,t)}onDimensionNum(o,t){this._compilerHandler&&this._compilerHandler.onDimensionNum(o,t)}onBossNum(o,t){this._compilerHandler&&this._compilerHandler.onBossNum(o,t)}onShellEntityNum(o,t){this._compilerHandler&&this._compilerHandler.onShellEntityNum(o,t)}onShellCutNum(o,t){this._compilerHandler&&this._compilerHandler.onShellCutNum(o,t)}onCreaseNum(o,t){this._compilerHandler&&this._compilerHandler.onCreaseNum(o,t)}onShellNum(o,t){this._compilerHandler&&this._compilerHandler.onShellNum(o,t)}onFpcFillNum(o,t){this._compilerHandler&&this._compilerHandler.onFpcFillNum(o,t)}onTeardropNum(o,t){this._compilerHandler&&this._compilerHandler.onTeardropNum(o,t)}onImageNum(o,t){this._compilerHandler&&this._compilerHandler.onImageNum(o,t)}onPouredNum(o,t){this._compilerHandler&&this._compilerHandler.onPouredNum(o,t)}onPourNum(o,t){this._compilerHandler&&this._compilerHandler.onPourNum(o,t)}onRegionNum(o,t){this._compilerHandler&&this._compilerHandler.onRegionNum(o,t)}onFillNum(o,t){this._compilerHandler&&this._compilerHandler.onFillNum(o,t)}onPolyNum(o,t){this._compilerHandler&&this._compilerHandler.onPolyNum(o,t)}onObjNum(o,t){this._compilerHandler&&this._compilerHandler.onObjNum(o,t)}onArcNum(o,t){this._compilerHandler&&this._compilerHandler.onArcNum(o,t)}onCArcNum(o,t){this._compilerHandler&&this._compilerHandler.onCArcNum(o,t)}onLineNum(o,t){this._compilerHandler&&this._compilerHandler.onLineNum(o,t)}onPadNum(o,t){this._compilerHandler&&this._compilerHandler.onPadNum(o,t)}onViaNum(o,t){this._compilerHandler&&this._compilerHandler.onViaNum(o,t)}onPartitionNum(o,t){this._compilerHandler&&this._compilerHandler.onPartitionNum(o,t)}};function fPt(o,t){let e=0;return function(...r){let i=new Date().getTime();i-e>t&&(o.apply(this,r),e=i)}}function mPt(o,t,e){let r,i,n,s,a,l,c=0,h=!1,u=!1,d=!0;if(typeof o!="function")throw new TypeError("Expected a function");t=Number(t)||0,typeof e=="object"&&(h=!!e.leading,u="maxWait"in e,n=u?Math.max(Number(e.maxWait)||0,t):n,d="trailing"in e?!!e.trailing:d);function p(E){let O=r,_=i;return r=i=void 0,c=E,s=o.apply(_,O),s}function m(E){return c=E,a=window.setTimeout(b,t),h?p(E):s}function g(E){let O=E-l,_=E-c,x=t-O;return u?Math.min(x,n-_):x}function y(E){let O=E-l,_=E-c;return l===void 0||O>=t||O<0||u&&_>=n}function b(){let E=Date.now();if(y(E))return P(E);a=window.setTimeout(b,g(E))}function P(E){return a=void 0,d&&r?p(E):(r=i=void 0,s)}function T(){a!==void 0&&clearTimeout(a),c=0,r=l=i=a=void 0}function I(){return a===void 0?s:P(Date.now())}function C(){let E=Date.now(),O=y(E);if(r=arguments,i=this,l=E,O){if(a===void 0)return m(l);if(u)return a=window.setTimeout(b,t),p(l)}return a===void 0&&(a=window.setTimeout(b,t)),s}return C.cancel=T,C.flush=I,C}var dL=new Map;dL.set("<","&lt;");dL.set(">","&gt;");dL.set('"',"&quot;");dL.set("'","&apos;");dL.set("&","&amp;");function ENe(o){if(typeof o!="string")return o;if(o==null)return"";function t(e){return dL.get(e)}return o==null?"":JQ(o,dL)?(o+"").replace(/[<>'"&]/g,t):o}var gL=new Map;gL.set("&lt;","<");gL.set("&gt;",">");gL.set("&quot;",'"');gL.set("&apos;","'");gL.set("&amp;","&");gL.set("&#039;","'");function gPt(o){if(typeof o!="string")return o;if(o==null)return"";let t={"&lt;":"<","&gt;":">","&quot;":'"',"&apos;":"'","&amp;":"&","&#039;":"'"};function e(r){return gL.get(r)}return JQ(o,t)?(o+"").replace(/&([^;]+);/g,e):o}var cz=new Map;cz.set("~","&#126;");cz.set("^","&#94;");cz.set("#@$","&#35;&#64;&#36;");cz.set("`","&#96;");function yPt(o){if(typeof o!="string")return o;if(o==null)return"";let t={"~":"&#126;","^":"&#94;","#@$":"&#35;&#64;&#36;","`":"&#96;"};function e(r){return cz.get(r)}return JQ(o,t)?o.replace(/(\~|\^|#@\$|\`)/g,e):o}function vPe(o){if(typeof o!="object"||o===null||o===void 0)return o;if(Array.isArray(o))return o.map(vPe);{let t={};for(let e in o)Object.hasOwnProperty.call(o,e)&&(t[e]=vPe(o[e]));return t}}function xPe(o){if(typeof o!="object"||o===null||o instanceof Date)return typeof o=="string"&&o.includes("<")&&(o=ENe(o)),o;if(Array.isArray(o))return o.map(xPe);{let t={};for(let e in o)o.hasOwnProperty(e)&&(t[e]=xPe(o[e]));return t}}function bPt(o,t){let e="",r="";for(let i=0;i<o.length;i++)String(o[i])&&(r+=o[i]+"	");r=r.slice(0,-1),e+=r+`\r
`;for(let i=0;i<t.length;i++){r="";for(let n=0;n<o.length;n++)r+='"'+(typeof t[i][n]<"u"?t[i][n]:"")+'"	';r=r.slice(0,r.length-1),e+=r+`\r
`}return e}function PPt(o,t={targetType:"blob"}){let{targetType:e,width:r,height:i}=t,n=new Image(r,i);return new Promise((s,a)=>{n.onload=function(){let l=document.createElement("canvas"),c=l.getContext("2d");switch(l.width=n.width,l.height=n.height,c.drawImage(n,0,0,n.width,n.height),e){case"dataURL":{s(l.toDataURL());break}case"blob":default:{l.toBlob(h=>{s(h)});break}}},n.onerror=l=>{a(l)},n.src=o})}async function TPt(o,t={}){return new Promise((e,r)=>{try{let{targetType:i="blob",imageType:n="image/png"}=t,s=document.createElement("canvas"),a=s.getContext("2d");switch(s.width=o.width,s.height=o.height,a.putImageData(o,0,0),i){case"dataURL":{e(s.toDataURL(n));break}case"blob":default:{s.toBlob(l=>{e(l)},n);break}}}catch(i){r(i)}})}function ey(o=[],t,e){if(!o||!o.length||!t)return{index:-1,data:null};let r={index:-1,data:null};for(let i=0;i<o.length;i++)if(typeof o[i]=="object"&&o[i][t]===e){r.data=o[i],r.index=i;break}return r}function IPt(o=[],t,e){if(!o||!o.length||!t)return{indexs:[],datas:[]};let r={indexs:[],datas:[]};for(let i=0;i<o.length;i++)typeof o[i]=="object"&&o[i][t]===e&&(r.datas.push(o[i]),r.indexs.push(i));return r}var CPt=class extends nTe{constructor(o){super(),this._action=o}get action(){return this._action}onAttr(o,t,e){e||this.action(t.key,t.value)}};async function SPt(o,t,e,r=!0){let i={initResponse:null,d3modelItem:null,d3modelItemName:void 0,d3modelItemTransform:void 0,d3modelItemPath:void 0,d3modelItemId:void 0,compiler:null},n=new Map;return new Promise(async s=>{let a=new SNe(o,t,e);i.compiler=a,a.setHandler(new CPt(async(l,c)=>{if(typeof c<"u"&&n.set(l,c),n.has("3D Model")&&n.has("3D Model Title")&&n.has("3D Model Transform")){i.d3modelItemId=n.get("3D Model"),i.d3modelItemName=n.get("3D Model Title"),i.d3modelItemTransform=n.get("3D Model Transform");let h=sz(i.d3modelItemId,!0);i.d3modelItemPath=h.path}})),i.initResponse=await a.init().catch(l=>({message:l.message,success:!1})),i.d3modelItemId&&r&&(i.d3modelItem=await lz(i.d3modelItemId)),i.compiler.destroy(),n.clear(),s(i)})}async function EPt(o,t){let e={padList:[]};return new Promise(async r=>{try{let i=new W2t(o,t,!0),n=await i.getPads()||{},s=Object.keys(n);for(let a=0;a<s.length;a++)e.padList.push({...n[s[a]]});i.destroy(),r(e)}catch{r(e)}})}function OPt(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);let r=[1,10,100,1e3][t]||Math.pow(10,t)||10;if(e){let i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),i+o}else return Math.round(o*r+1e-10)/r}function APt(o,t){typeof o=="string"&&(o=parseFloat(o));let e=Math.pow(10,t);return Math.round(o*e)/e}var _Pt={conversion(o,t,e){let r=o+2+t;return this[r](e)},conversion1(o,t,e){let r=o+2+t,i=this[r](e);return t=="mil"?Math.round(i*10)/10:Math.round(i*1e3)/1e3},mil2mil(o){return o},mil2mm(o){return o*.0254},mil2cm(o){return o*.00254},mil2inch(o){return o/1e3},mm2mm(o){return o},mm2mil(o){let t=Math.pow(10,5);return Math.round(o*39.37007874015748*t)/t},mm2cm(o){return o/10},mm2inch(o){let t=Math.pow(10,8);return Math.round(o*.03937007874015748*t)/t},cm2mil(o){let t=Math.pow(10,6);return Math.round(o*3.937007874015748*t)/t},cm2mm(o){return o*10},cm2inch(o){let t=Math.pow(10,7);return Math.round(o*.3937007874015748*t)/t},inch2mil(o){return o*1e3},inch2mm(o){return o*25.4},inch2cm(o){return o*2.54}};function vPt(o,t,e){var r=o-t;return e||(e=1e-10),(r>0?r:-r)<e}function xPt(o){return o<0?(360+o%360)%360:o>=360?o%360:o}function ONe(o,t,e,r){var i=o-e,n=t-r;return i*i+n*n}function RPt(o,t,e,r){return Math.sqrt(ONe(o,t,e,r))}function DPt(o,t,e,r){var i=e-o,n=r-t,s=Math.atan2(n,i);return s=s<0?s+Math.PI+Math.PI:s,s}function wPt(o){return ANe(o)&&Object.keys(o).length===0}function ANe(o){return Object.prototype.toString.call(o).slice(8,-1)==="Object"}function LPt(o){return _Ne(o)||vNe(o)}function _Ne(o){return Object.prototype.toString.call(o).slice(8,-1)==="AsyncFunction"}function vNe(o){return Object.prototype.toString.call(o).slice(8,-1)==="Function"}var Hl=class{};Hl.unitConversion=_Pt,Hl.ConcurrencyTaskQueue=dPt,Hl.FootprintCompilerInstance=SNe,Hl.FootprintCompilerHandlerProxy=nTe,Hl.FootprintCompilerAttr=pPt,Hl.createCSVString=bPt,Hl.svg2png=PPt,Hl.imageData2NewImage=TPt,Hl.htmlEncode=ENe,Hl.htmlDecode=gPt,Hl.strEncode=yPt,Hl.isEmptyObj=wPt,Hl.isPlainObject=ANe,Hl.isFn=LPt,Hl.isAsyncFunction=_Ne,Hl.isNormalFunction=vNe,Hl.formatDate=yv,Hl.formatDate2=rPt,Hl.deepClone=vPe,Hl.deepCloneWithHtmlEncode=xPe,Hl.naturalSortComparator=c5e,Hl.naturalSortSplitor=oPe,Hl.naturalSort=gft,Hl.naturalStrSort=yft,Hl.naturalSort1=bft,Hl.naturalCompare=Pft,Hl.isObjKeyInStr=JQ,Hl.throttle=fPt,Hl.debounce=mPt,Hl.findList=ey,Hl.findListAll=IPt,Hl.randomString=Cft,Hl.parseJSON=Sft,Hl.splitComponentId2FolderAndFilenameMixin=sz,Hl.getFootprintPadInfo=EPt,Hl.getFootprint3DInfo=SPt;var eL=class{};eL.toFixed=OPt,eL.toFixed1=APt,eL.floatEqual=vPt,eL.fixAngle=xPt,eL.getDistance=RPt,eL.getDistance2=ONe,eL.getAngleByDot=DPt;var xNe=class RPe{constructor(){this._changeCbs=new Set,this._map=new Map,this._debounceNotify=Hl.debounce(()=>{this._notify()},50)}static get context(){return Q()}static getInstance(){var t;return(t=this.context.extendLibManager)!=null?t:this.context.extendLibManager=new RPe}_notify(){for(let t of this._changeCbs)t()}onChange(t){this._changeCbs.add(t)}offChange(t){this._changeCbs.delete(t)}_getLibId(t){return`${RPe.LIB_ID_PREFFIX}${t}`}async addLibWithId(t){this._map.set(t.id,await uPt.set(t)),this._debounceNotify()}async addLib(t){let e=this._getLibId(t.title);return await this.addLibWithId({...t,id:e}),e}deleteLib(t){return this._debounceNotify(),this._map.delete(t)}hasLib(t){return this._map.has(t)}getLib(t){return this._map.get(t)}getLibs(){return Array.from(this._map.values())}updateLibTitle(t,e){let r=this._map.get(t);r&&(r.title=e,this._debounceNotify())}updateLibPosition(t,e){let r=this._map.get(t);r&&(r.position=e,this._debounceNotify())}};xNe.LIB_ID_PREFFIX="extend_lib_";var jp=xNe,oTe=class{},MPt=(o=>(o.PROJECT_DOCUMENT_LOCKED="PROJECT_DOCUMENT_LOCKED",o.PROJECT_DOCUMENT_UPDATE_REJECT="PROJECT_DOCUMENT_UPDATE_REJECT",o.NOSYMBOL_ON_TARGETPATH_BY_DEVICE_BOUND="NOSYMBOL_ON_TARGETPATH_BY_DEVICE_BOUND",o.NOFOOTPRINT_ON_TARGETPATH_BY_DEVICE_BOUND="NOFOOTPRINT_ON_TARGETPATH_BY_DEVICE_BOUND",o.DEVICE_ATTRIBUTES_ERROR="DEVICE_ATTRIBUTES_ERROR",o.DEVICE_DESCRIPTION_ERROR="DEVICE_DESCRIPTION_ERROR",o.SYMBOL_DESCRIPTION_ERROR="SYMBOL_DESCRIPTION_ERROR",o.FOOTPRINT_DESCRIPTION_ERROR="FOOTPRINT_DESCRIPTION_ERROR",o.D3MODEL_DESCRIPTION_ERROR="D3MODEL_DESCRIPTION_ERROR",o.DEVICE_NAMA_ERROR="DEVICE_NAMA_ERROR",o.SYMBOL_NAMA_ERROR="SYMBOL_NAMA_ERROR",o.FOOTPRINT_NAMA_ERROR="FOOTPRINT_NAMA_ERROR",o.PANEL_LIB_NAMA_ERROR="PANEL_LIB_NAMA_ERROR",o.D3MODEL_NAMA_ERROR="D3MODEL_NAMA_ERROR",o.SIM_MODEL_NAMA_ERROR="SIM_MODEL_NAMA_ERROR",o.DEVICE_SAME_NAMA_EXISTS="DEVICE_SAME_NAMA_EXISTS",o.SYMBOL_SAME_NAMA_EXISTS="SYMBOL_SAME_NAMA_EXISTS",o.FOOTPRINT_SAME_NAMA_EXISTS="FOOTPRINT_SAME_NAMA_EXISTS",o.D3MODEL_SAME_NAMA_EXISTS="D3MODEL_SAME_NAMA_EXISTS",o.SIM_MODEL_SAME_NAMA_EXISTS="SIM_MODEL_SAME_NAMA_EXISTS",o.PANELLIB_SAME_NAMA_EXISTS="PANELLIB_SAME_NAMA_EXISTS",o.PARAMETER_VERIFICATION="PARAMETER_VERIFICATION",o.RESULT_VERIFICATION="RESULT_VERIFICATION",o.GET_DEVICE="GET_DEVICE",o.GET_DEVICE_ATTRIBUTES_KEYS="GET_DEVICE_ATTRIBUTES_KEYS",o.GET_DEVICE_ATTRIBUTES_VALUES="GET_DEVICE_ATTRIBUTES_VALUES",o.GET_DEVICE_NOT_FOUND="GET_DEVICE_NOT_FOUND",o.GET_DEVICE_LIST="GET_DEVICE_LIST",o.GET_DEVICE_SEARCH_LIST="GET_DEVICE_SEARCH_LIST",o.GET_DEVICE_SEARCH_UUIDS="GET_DEVICE_SEARCH_UUIDS",o.STAR_DEVICE="STAR_DEVICE",o.UNSTAR_DEVICE="UNSTAR_DEVICE",o.GET_SYMBOL="GET_SYMBOL",o.GET_SYMBOL_NOT_FOUND="GET_SYMBOL_NOT_FOUND",o.GET_SYMBOL_LIST="GET_SYMBOL_LIST",o.GET_SYMBOL_SEARCH_LIST="GET_SYMBOL_SEARCH_LIST",o.GET_SYMBOL_SEARCH_UUIDS="GET_SYMBOL_SEARCH_UUIDS",o.STAR_SYMBOL="STAR_SYMBOL",o.UNSTAR_SYMBOL="UNSTAR_SYMBOL",o.GET_FOOTPRINT="GET_FOOTPRINT",o.GET_FOOTPRINT_NOT_FOUND="GET_FOOTPRINT_NOT_FOUND",o.GET_FOOTPRINT_LIST="GET_FOOTPRINT_LIST",o.GET_FOOTPRINT_SEARCH_LIST="GET_FOOTPRINT_SEARCH_LIST",o.GET_FOOTPRINT_SEARCH_UUIDS="GET_FOOTPRINT_SEARCH_UUIDS",o.STAR_FOOTPRINT="STAR_FOOTPRINT",o.UNSTAR_FOOTPRINT="UNSTAR_FOOTPRINT",o.GET_PANEL_LIB="GET_PANEL_LIB",o.GET_PANEL_LIB_LIST="GET_PANEL_LIB_LIST",o.GET_PANEL_LIB_NOT_FOUND="GET_PANEL_LIB_NOT_FOUND",o.GET_PANEL_LIB_SEARCH_LIST="GET_PANEL_LIB_SEARCH_LIST",o.GET_PANEL_LIB_SEARCH_UUIDS="GET_PANEL_LIB_SEARCH_UUIDS",o.STAR_PANEL_LIB="STAR_PANEL_LIB",o.UNSTAR_PANEL_LIB="UNSTAR_PANEL_LIB",o.GET_D3MODEL="GET_D3MODEL",o.GET_D3MODEL_NOT_FOUND="GET_D3MODEL_NOT_FOUND",o.GET_D3MODEL_LIST="GET_D3MODEL_LIST",o.GET_D3MODEL_SEARCH_LIST="GET_D3MODEL_SEARCH_LIST",o.GET_D3MODEL_SEARCH_UUIDS="GET_D3MODEL_SEARCH_UUIDS",o.GET_SIM_MODEL="GET_SIM_MODEL",o.GET_SIM_NOT_FOUND="GET_SIM_NOT_FOUND",o.GET_SIM_MODEL_LIST="GET_SIM_MODEL_LIST",o.GET_SIM_MODEL_SEARCH_LIST="GET_SIM_MODEL_SEARCH_LIST",o.GET_SIM_MODEL_SEARCH_UUIDS="GET_SIM_MODEL_SEARCH_UUIDS",o.CROSS_BIND="CROSS_BIND",o.CROSS_BIND_EXIT="CROSS_BIND_EXIT",o.IMPORT_EXIST_PROJECT="IMPORT_EXIST_PROJECT",o.CREATE_PROJECT="CREATE_PROJECT",o.CREATE_DEVICE="CREATE_DEVICE",o.CREATE_DEVICE_PERMISSIONS="CREATE_DEVICE_PERMISSIONS",o.CREATE_DEVICE_GET_ORIGIN="CREATE_DEVICE_GET_ORIGIN",o.CREATE_SYMBOL="CREATE_SYMBOL",o.CREATE_SYMBOL_PERMISSIONS="CREATE_SYMBOL_PERMISSIONS",o.CREATE_SYMBOL_GET_ORIGIN="CREATE_SYMBOL_GET_ORIGIN",o.CREATE_SYMBOL_MIGRATE_CANVAS_ERROR="CREATE_SYMBOL_MIGRATE_CANVAS_ERROR",o.CREATE_FOOTPRINT="CREATE_FOOTPRINT",o.CREATE_FOOTPRINT_PERMISSIONS="CREATE_FOOTPRINT_PERMISSIONS",o.CREATE_FOOTPRINT_GET_ORIGIN="CREATE_FOOTPRINT_GET_ORIGIN",o.CREATE_FOOTPRINT_MIGRATE_CANVAS_ERROR="CREATE_FOOTPRINT_MIGRATE_CANVAS_ERROR",o.CREATE_D3MODEL="CREATE_D3MODEL",o.CREATE_D3MODEL_PERMISSIONS="CREATE_D3MODEL_PERMISSIONS",o.CREATE_PANEL_LIB="CREATE_PANEL_LIB",o.CREATE_PANEL_LIB_PERMISSIONS="CREATE_PANEL_LIB_PERMISSIONS",o.CREATE_PANEL_LIB_MIGRATE_CANVAS_ERROR="CREATE_PANEL_LIB_MIGRATE_CANVAS_ERROR",o.CREATE_SIM_MODEL="CREATE_SIM_MODEL",o.CREATE_SIM_MODEL_PERMISSIONS="CREATE_SIM_MODEL_PERMISSIONS",o.CREATE_SIM_MODEL_MIGRATE_CANVAS_ERROR="CREATE_SIM_MODEL_MIGRATE_CANVAS_ERROR",o.UPDATE_DEVICE="UPDATE_DEVICE",o.UPDATE_DEVICE_ATTRIBUTES="UPDATE_DEVICE_ATTRIBUTES",o.UPDATE_DEVICE_PERMISSIONS="CREATE_DEVICE_PERMISSIONS",o.UPDATE_SYMBOL="UPDATE_SYMBOL",o.UPDATE_SYMBOL_MIGRATE_CANVAS_ERROR="UPDATE_SYMBOL_MIGRATE_CANVAS_ERROR",o.UPDATE_SYMBOL_PERMISSIONS="UPDATE_SYMBOL_PERMISSIONS",o.UPDATE_FOOTPRINT="UPDATE_FOOTPRINT",o.UPDATE_FOOTPRINT_MIGRATE_CANVAS_ERROR="UPDATE_FOOTPRINT_MIGRATE_CANVAS_ERROR",o.UPDATE_FOOTPRINT_PERMISSIONS="UPDATE_FOOTPRINT_PERMISSIONS",o.UPDATE_D3MODEL="UPDATE_D3MODEL",o.UPDATE_D3MODEL_PERMISSIONS="UPDATE_D3MODEL_PERMISSIONS",o.UPDATE_SIM_MODEL="UPDATE_SIM_MODEL",o.UPDATE_SIM_MODEL_PERMISSIONS="UPDATE_SIM_MODEL_PERMISSIONS",o.UPDATE_PANEL_LIB="UPDATE_PANEL_LIB",o.UPDATE_PANEL_LIB_MIGRATE_CANVAS_ERROR="UPDATE_PANEL_LIB_MIGRATE_CANVAS_ERROR",o.UPDATE_PANEL_LIB_PERMISSIONS="UPDATE_PANEL_LIB_PERMISSIONS",o.DELETE_DEVICE="DELETE_DEVICE",o.DELETE_SYMBOL="DELETE_SYMBOL",o.DELETE_FOOTPRINT="DELETE_FOOTPRINT",o.DELETE_PANEL_LIB="DELETE_PANEL_LIB",o.DELETE_SIM_MODEL="DELETE_SIM_MODEL",o.DELETE_3DMODEL="DELETE_3DMODEL",o))(MPt||{}),ft=class{constructor(o,t=""){this._message=t,this._action=o}get message(){return this._message}set message(o){this._message=o}get action(){return this._action}set action(o){this._action=o}toJSON(){return{message:this.message,action:this.action}}};function rg(o,t){let e=Object.keys(t);for(let r=0;r<e.length;r++)nIt.indexOf(e[r])<=-1||(e[r]==="title"&&"display_title"in o&&t.title&&(o.display_title=String(t.title),o.title=String(t.title).toLocaleLowerCase()),o[e[r]]=t[e[r]])}function hz(o,t){return o[t]}function RNe(o){let t=o.trim();if(!t||t.length<=0||t.length>128){let e="The title length must be between 1~128 characters!";throw new ft("DEVICE_NAMA_ERROR",e)}}function DNe(o){let t=o.trim();if(!t||t.length<=0||t.length>128){let e="The title length must be between 1~128 characters!";throw new ft("SYMBOL_NAMA_ERROR",e)}}function wNe(o){let t=o.trim();if(!t||t.length<=0||t.length>128){let e="The title length must be between 1~128 characters!";throw new ft("FOOTPRINT_NAMA_ERROR",e)}}function LNe(o){let t=o.trim();if(!t||t.length<=0||t.length>128){let e="The title length must be between 1~128 characters!";throw new ft("PANEL_LIB_NAMA_ERROR",e)}}function MNe(o){let t=o.trim();if(!t||t.length<=0||t.length>128){let e="The title length must be between 1~128 characters!";throw new ft("D3MODEL_NAMA_ERROR",e)}}function NNe(o){let t=o.trim();if(!t||t.length<=0||t.length>128){let e="The title length must be between 1~128 characters!";throw new ft("SIM_MODEL_NAMA_ERROR",e)}}async function QN(o,t){let e=[],r=[],i=async a=>{let{message:l}=await on.messageBus.rpcCall(vO.TAG.CREATE,a);return l},n=null;try{for(let a=0;a<o.length;a++){let l=await i({...o[a],path:o[a].user_uuid});if(l.code===0&&l.success){let h={...l,message:"",result:{...o[a],path:o[a].user_uuid,...l.result[0]}};e.push(h),t&&t(h,a);continue}let c={...l,result:{...o[a]}};r.push(c)}return{code:0,success:!0,result:{successList:e,failList:r},message:""}}catch(a){n=a}let s=n?n.msg||n.message:"Add Categories Batch Error";return{code:n?n.code:Ci.ERR_CODE.NORMAL,success:!1,result:null,message:s}}function AW(o=0,t=Number.MAX_SAFE_INTEGER){return Math.floor(Math.random()*(t-o+1))+o}function qW(o=36){let t=[],e="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let r=0;r<o;r++)t[r]=e.substr(Math.floor(Math.random()*16),1);return t[14]&&(t[14]=String(AW(1,9))),t[19]&&(t[19]=e.substr(+t[19]&3|8,1)),t[8]&&(t[8]=String(AW(1,9))),t[13]&&(t[13]=String(AW(1,9))),t[18]&&(t[18]=String(AW(1,9))),t[23]&&(t[23]=String(AW(1,9))),t.join("")}function r5e(o,t=!0){return(e,r)=>{let i=e[o],n=r[o];return typeof i<"u"&&typeof n<"u"?t?i-n:n-i:0}}var NPt=0;async function uz(o,t,e,r,i=!0,n,s){let a=null,l="requestid"+ ++NPt;n&&n(l);let c={user_uuid:o,path:t,type:e};r!==void 0&&(c.bindTypes=r),s&&s(c);try{if(jp.getInstance().hasLib(o))return await kPt(o,e,i);let u=await Vn("GET",kn.TAG.LIST,c,{headers:{path:t},searchParams:!0});if(u.success)return{...u,result:await sTe(u.result,i)}}catch(u){a=u,console.error("Fetch Category List Error",u)}let h=a?a.msg||a.message:void 0;return{code:a?a.code:Ci.ERR_CODE.NORMAL,success:!1,result:null,msg:h||"Fetch Category List Error"}}async function kPt(o,t,e){var r;let i=[];for(let n of t){let s=await((r=jp.getInstance().getLib(o))==null?void 0:r.getCategoryTreeDataItemsByCategoryType(n));s&&i.push(s)}return{code:0,success:!0,result:await sTe(i.flat().map(n=>({uuid:n.id,parent_uuid:n.parentId,user_uuid:o,type:void 0,order_no:void 0,name_cn:void 0,name:n.title,created_at:n.created_at,updated_at:n.updated_at,title:n.title})),e)}}async function BPt(o=!0){let t=null;try{let r=await Vn("POST",kn.TAG.DEVICE_CATE);if(r.success)return{...r,result:await sTe(r.result,o)}}catch(r){t=r,console.error("Fetch Category List Error",r)}let e=t?t.msg||t.message:void 0;return{code:t?t.code:Ci.ERR_CODE.NORMAL,success:!1,result:null,msg:e||"Fetch Category List Error"}}async function sTe(o,t=!0){let e=[],r=[],i=[],n={},s={};o.forEach(u=>{u.name&&(s[u.name]=u.name_cn||u.name)});let a=o.filter(u=>!u.parent_uuid),l=o.filter(u=>!!u.parent_uuid),c=[],h={};if(a.forEach((u,d)=>{c.push(u.uuid),i.push({name:u.name,name_cn:u.name_cn,title:u.name,titleAdditional:u.name_cn||u.name,disableTranslate:u.name_cn===""?!0:u.name_cn===u.name,id:u.uuid,children:[],order_no:+u.order_no||0,parentId:void 0,created_at:u.created_at,updated_at:u.updated_at}),n[u.uuid]=d}),l.forEach(u=>{c.push(u.uuid);let d=n[u.parent_uuid];if(typeof d<"u"&&i[d]){let p=i[d];p.children.push({name:u.name,name_cn:u.name_cn,title:u.name,titleAdditional:u.name_cn||u.name,disableTranslate:u.name_cn===""?!0:u.name_cn===u.name,id:u.uuid,order_no:+u.order_no||0,children:[],parentId:p.id,created_at:u.created_at,updated_at:u.updated_at})}h[u.uuid]=u.parent_uuid}),i.sort(r5e("order_no")),i.forEach(u=>{u.children.length>1&&u.children.sort(r5e("order_no"))}),i.forEach(u=>{e.push({...u})}),t){let u=(await on.messageBus.rpcCall("I18nTranslateService",{str:Ci.CATEGORY_ITEM_ALL_TITLE})).message;e.unshift({title:Ci.CATEGORY_ITEM_ALL_TITLE,titleAdditional:u||Ci.CATEGORY_ITEM_ALL_TITLE,id:Ci.CATEGORY_ITEM_ALL_VALUE,order_no:Number.MAX_SAFE_INTEGER,disableTranslate:!1,children:[],parentId:void 0}),r.push(Ci.CATEGORY_ITEM_ALL_VALUE)}return{languageHashtable:s,treeData:e,selectedIds:r,categoryIds:c,childCategory2ParentCategoryMap:h,sourceCategoryList:o}}async function cL(o){let{categories:t,type:e,uuid:r}=o,i=await uz(r,r,e),n=i.result?i.result.treeData:[],s=[],a=[],l=[],c=[];for(let m=0;m<t.length;m++){let{parentName:g,childName:y,parent_order_no:b,child_order_no:P}=t[m];if(g){let T=ey(n,"title",g);if(T.index>=0){if(s.push({name:T.data.title,type:e,user_uuid:r,order_no:T.data.order_no,parent_uuid:void 0,uuid:T.data.id}),y){let E=ey(T.data.children,"title",y);if(E.index>=0){a.push({name:E.data.title,type:e,user_uuid:r,order_no:E.data.order_no,parent_uuid:T.data.id,uuid:E.data.id});continue}c.push({name:y,type:e,user_uuid:r,order_no:m+1,parent_uuid:T.data.id,uuid:void 0});continue}continue}let I=qW(),C=qW();l.push({name:g,type:e,user_uuid:r,order_no:typeof b<"u"?b:m+1,parent_uuid:void 0,uuid:I}),y&&c.push({name:y,type:e,user_uuid:r,order_no:typeof P<"u"?P:m+1,parent_uuid:I,uuid:C})}}let h=[];if(l.length){let m=await QN(l,(g,y)=>{l[y].__remoteId=g.result.uuid});h=m.result?m.result.successList.map(g=>g.result):[]}let u=[];if(c.length){for(let g=0;g<c.length;g++){let y=ey(l,"uuid",c[g].parent_uuid);y.index>=0&&y.data.__remoteId&&(c[g].parent_uuid=y.data.__remoteId)}let m=await QN(c);u=m.result?m.result.successList.map(g=>g.result):[]}let d=h.concat(s),p=u.concat(a);return{allParentCreated:d,allChildCreated:p}}async function aTe(o){let{uuid:t,path:e,types:r,names:i}=o;return new Promise(async(n,s)=>{let a=await uz(t,e,r,void 0,!1);if(a.code!==0){n({...a,code:Ci.ERR_CODE.NORMAL,success:!1,result:null});return}let l={detail:[],arguments:o},{treeData:c}=a.result;for(let h=0;h<i.length;h++){let u=i[h].primary,d=i[h].secondary,p={primary:{name:u,name_cn:"",uuid:"",exist:!1,undefine:!1},secondary:{name:d,name_cn:"",uuid:"",exist:!1,undefine:!1}};if(typeof u>"u"){p.primary.exist=!1,p.primary.undefine=!0;continue}let m=ey(c,"title",u);if(m.index<=-1){p.primary.exist=!1,p.secondary.exist=!1,l.detail.push(p);continue}if(p.primary.exist=!0,p.primary.uuid=m.data.id,p.primary.name_cn=m.data.titleAdditional||u,typeof d>"u"){p.secondary.exist=!1,p.secondary.undefine=!0,l.detail.push(p);continue}let g=ey(m.data.children,"title",d);if(g.index<=-1){p.secondary.exist=!1,l.detail.push(p);continue}p.secondary.exist=!0,p.secondary.uuid=g.data.id,p.secondary.name_cn=g.data.titleAdditional||d,l.detail.push(p)}n({code:0,success:!0,result:l})})}function FPt(o){let t=new Map,e=[];for(let r of o)(!t.has(r.primary)||t.get(r.primary)!==r.secondary)&&(t.set(r.primary,r.secondary),e.push(r));return e}async function kNe(o){try{let{uuid:t,path:e,types:r,names:i}=o,n={primary:i[0],secondary:i[1]},s=await aTe({uuid:t,path:e,types:r,names:[n]});if(!s.success)return{success:!1,code:s.code,message:s.message,result:null};let a=[],{detail:l}=s.result;if(l[0]){let{primary:c,secondary:h}=l[0];c!=null&&c.uuid&&a.push(c==null?void 0:c.uuid),h!=null&&h.uuid&&a.push(h==null?void 0:h.uuid)}return{success:!0,code:0,result:a}}catch(t){return{success:!1,code:Ci.ERR_CODE.NORMAL,message:t.message,result:null}}}async function VPt(o,t,e,r=!1){let i=await aTe(o),n=[],s=[],a=[],l=[],c=[];if(!r&&i.success&&i.result.detail.length){let u=new Map,d=new Map,p=new Map;i.result.detail.forEach((m,g)=>{(m.primary.name||m.primary.name_cn)&&!m.primary.exist&&!u.has(m.primary.name||m.primary.name_cn)&&(u.set(m.primary.name||m.primary.name_cn,!0),n.push({name:m.primary.name||m.primary.name_cn,type:t,user_uuid:e,order_no:0})),(m.primary.name||m.primary.name_cn)&&!m.primary.exist&&(m.secondary.name||m.secondary.name_cn)&&!m.secondary.exist&&d.get(m.secondary.name||m.secondary.name_cn)!==(m.primary.name||m.primary.name_cn)?(d.set(m.secondary.name||m.secondary.name_cn,m.primary.name||m.primary.name_cn),s.push({name:m.secondary.name||m.secondary.name_cn,type:t,user_uuid:e,uuid:m.secondary.uuid,order_no:0,parent_uuid:m.primary.uuid,parent_title:m.primary.name||m.primary.name_cn})):m.primary.exist&&(m.secondary.name||m.secondary.name_cn)&&!m.secondary.exist&&d.get(m.secondary.name||m.secondary.name_cn)!==(m.primary.name||m.primary.name_cn)&&(d.set(m.secondary.name||m.secondary.name_cn,m.primary.name||m.primary.name_cn),s.push({name:m.secondary.name||m.secondary.name_cn,type:t,user_uuid:e,uuid:m.secondary.uuid,order_no:0,parent_uuid:m.primary.uuid,parent_title:m.primary.name||m.primary.name_cn})),m.primary.exist&&!p.has(m.primary.uuid)&&(p.set(m.primary.uuid,m.primary.name||m.primary.name_cn),c.push({title:m.primary.name||m.primary.name_cn,uuid:m.primary.uuid,parent_uuid:""})),m.secondary.exist&&!p.has(m.secondary.uuid)&&(p.set(m.secondary.uuid,m.secondary.name||m.secondary.name_cn),c.push({title:m.secondary.name||m.secondary.name_cn,uuid:m.secondary.uuid,parent_uuid:m.primary.uuid}))})}if(!r&&n.length){let u=await QN(n);if(u.success&&u.result.successList.length&&(a=u.result.successList.map(d=>d.result),s.forEach(d=>{a.forEach(p=>{!d.parent_uuid&&d.parent_title===p.name&&(d.parent_uuid=p.uuid)})})),s.length){let d=await QN(s);d.success&&d.result.successList.length&&(l=d.result.successList.map(p=>p.result))}}else if(!r&&s.length){let u=await QN(s);u.success&&u.result.successList.length&&(l=u.result.successList.map(d=>d.result))}let h=[];return h=a.map(u=>({uuid:u.uuid,title:u.name,name:u.name,parent_uuid:u.parent_uuid})),h=h.concat(l.map(u=>({uuid:u.uuid,parent_uuid:u.parent_uuid,title:u.name,name:u.name}))),h=h.concat(c),h}async function GPt(o,t){let e=[],r=[],i=async a=>{let{message:l}=await on.messageBus.rpcCall(vO.TAG.DELETE,a);return l},n=null;try{for(let a=0;a<o.length;a++){let l=await i({...o[a],path:o[a].user_uuid});if(l.code===0&&l.success){let h={...l,message:"",result:{...o[a],path:o[a].user_uuid,...l.result[0]}};e.push(h),t&&t(h,a);continue}let c={...l,result:{...o[a]}};r.push(c)}return{code:0,success:!0,result:{successList:e,failList:r},message:""}}catch(a){n=a}let s=n?n.msg||n.message:"Del Categories Batch Error";return{code:n?n.code:Ci.ERR_CODE.NORMAL,success:!1,result:null,message:s}}async function UPt(o){let{uuid:t,path:e,types:r,ids:i}=o;return new Promise(async(n,s)=>{let a=await uz(t,e,r,void 0,!1);if(a.code!==0){n({...a,code:Ci.ERR_CODE.NORMAL,success:!1,result:null});return}let l={detail:[],arguments:o},{treeData:c}=a.result;for(let h=0;h<i.length;h++){let u=i[h].primary,d=i[h].secondary,p={primary:{name:"",name_cn:"string",uuid:u,exist:!1,undefine:!1},secondary:{name:"",name_cn:"string",uuid:d,exist:!1,undefine:!1}};if(typeof u>"u"){p.primary.exist=!1,p.primary.undefine=!0;continue}let m=ey(c,"id",u);if(m.index<=-1){p.primary.exist=!1,p.secondary.exist=!1,l.detail.push(p);continue}if(p.primary.exist=!0,p.primary.name=m.data.title,p.primary.name_cn=m.data.titleAdditional||p.primary.name,typeof d>"u"){p.secondary.exist=!1,p.secondary.undefine=!0;continue}let g=ey(m.data.children,"id",d);if(g.index<=-1){p.secondary.exist=!1,l.detail.push(p);continue}p.secondary.exist=!0,p.secondary.name=g.data.title,p.secondary.name_cn=g.data.titleAdditional||p.secondary.name,l.detail.push(p)}n({code:0,success:!0,result:l})})}var HPt=class{constructor(){this._actuatorMap=new Map}clearAll(){this._actuatorMap.clear()}async addActuator(o,t,e,r){let i=o.filter(u=>!!u),n=`${i[0]}_${t[0]||0}_${e}_${r}`,s=`${i[0]}_${i[1]}_${t[1]||t[0]||0}_${e}_${r}`;if(!i[1]){if(this._actuatorMap.has(n))return this._actuatorMap.get(n);let u=new Promise(async(d,p)=>{let m=await cL({categories:[{parentName:i[0],parent_order_no:t[0]||0}],type:[r],uuid:e});d({uuids:m.allParentCreated.map(g=>g.uuid),titles:m.allParentCreated.map(g=>g.name)}),this._actuatorMap.delete(n)});return this._actuatorMap.set(n,u),u}let a=this._actuatorMap.get(n);a||(a=new Promise(async(u,d)=>{let p=await cL({categories:[{parentName:i[0],parent_order_no:t[0]||0}],type:[r],uuid:e});u({uuids:p.allParentCreated.map(m=>m.uuid),titles:p.allParentCreated.map(m=>m.name)}),this._actuatorMap.delete(n)}),this._actuatorMap.set(n,a));let l=await a,c=this._actuatorMap.get(s);c||(c=new Promise(async(u,d)=>{let p=await cL({categories:[{parentName:i[0],childName:i[1],parent_order_no:t[0]||0,child_order_no:t[1]||t[0]||0}],type:[r],uuid:e});u({uuids:p.allChildCreated.map(m=>m.uuid),titles:p.allChildCreated.map(m=>m.name)}),this._actuatorMap.delete(s)}),this._actuatorMap.set(s,c));let h=await c;return{uuids:[l.uuids[0],h.uuids[0]],titles:[l.titles[0],h.titles[0]]}}};async function WPt(o,t){let e=[],r=[],i=async a=>{let{message:l}=await on.messageBus.rpcCall(vO.TAG.UPDATE,a);return l},n=null;try{for(let a=0;a<o.length;a++){let l=await i({...o[a],path:o[a].user_uuid});if(l.code===0&&l.success){let h={...l,message:"",result:{...o[a],path:o[a].user_uuid,...l.result[0]}};e.push(h),t&&t(h,a);continue}let c={...l,result:{...o[a]}};r.push(c)}return{code:0,success:!0,result:{successList:e,failList:r},message:""}}catch(a){n=a}let s=n?n.msg||n.message:"Update Categories Batch Error";return{code:n?n.code:Ci.ERR_CODE.NORMAL,success:!1,result:null,message:s}}var _f=class{};_f.categoryAddtition=new HPt,_f.fetchCategoryList=uz,_f.fetchInternalCategoryList=BPt,_f.addCategoriesBatch=QN,_f.deleteCategoriesBatch=GPt,_f.updateCategoriesBatch=WPt,_f.addCategoriesBatchByNameArray=cL,_f.queryCategoryBatchByNames=aTe,_f.queryCategoryBatchByIds=UPt,_f.formatRepeatCategoryArr=FPt,_f.bindAndCreateCategory=VPt,_f.getCategoryNamesByTags=DO;async function DO(o,t,e){if(!o)return[];if(o instanceof Array)return o;let r=Tv(o);if(r=r.filter(c=>!!c),!r.length)return[];let i=(await on.messageBus.rpcCall("LocaleCurrFetch",{})).message||"en",n=await uz(t,t,e),s=n.result?n.result.sourceCategoryList:[],a=typeof r[1]<"u",l=[];for(let c=0;c<s.length;c++)if(s[c].name===r[0]||s[c].name_cn===r[0]){l.push(i=="en"?s[c].name:s[c].name_cn||s[c].name);break}if(a){for(let c=0;c<s.length;c++)if(s[c].name===r[1]||s[c].name_cn===r[1]){l.push(i=="en"?s[c].name:s[c].name_cn||s[c].name);break}}return l}async function BNe(o,t,e){let r=null,i=null,n=[],s=[],a=!1,l,c;if(o)if("data"in o)r=o.data,r.tags&&(r.tags instanceof Array?s=r.tags:s=Tv(r.tags));else{if(!o.uuid||!o.path)throw new ft("PARAMETER_VERIFICATION","missing 3d-model uuid or path data.");l=o.uuid,c=o.path,i=await Rh.getD3Model({isProject:o.isProject,uuid:o.uuid,path:o.path}),i&&(i.title=i.display_title,s=await DO(i.tags,o.path,[5]))}if(!e){let h=await _f.categoryAddtition.addActuator(s,[0],t,5);n=h.uuids,s=h.titles}return{d3modelItemOriginUuid:l,d3modelItemOriginPath:c,d3modelItemIn:r,d3modelItemOut:i,d3modelTagIds:n,d3modelTagTitles:s}}function ck(o){return o?{uuid:o.uuid,nickname:o.nickname,username:o.username}:{}}function zPt(o){return Array.isArray(o)?o:o?[o]:[]}function hk(o){return o?{uuid:o.uuid,nickname:o.nickname,username:o.username}:{}}function uk(o){return o?{uuid:o.uuid,nickname:o.nickname,username:o.username}:{}}function FNe(o,t){return{title:t.title,description:t.description,images:zPt(t.images),attributes:t.attributes,uuid:t.uuid,path:nk(t)||o,ticket:t.ticket,updateTime:Jg(t.updateTime),createTime:Jg(t.createTime),display_title:t.display_title,creator:ck(t.creator),modifier:hk(t.modifier),owner:uk(t.owner),symbol_type:t.symbol_type}}function Iv(o,t){return{...FNe(o,t),isFavorite:t.isFavorite,tags:t.tags,produce_code:t.produce_code}}function TQ(o,t){return{...FNe(o,t),custom_tags:t.custom_tags,source:t.source,version:t.version}}function VNe(o,t){return{title:t.title,description:t.description,docType:t.docType,path:nk(t)||o,uuid:t.uuid,ticket:t.ticket,updateTime:Jg(t.updateTime),createTime:Jg(t.createTime),display_title:t.display_title,creator:ck(t.creator),modifier:hk(t.modifier),owner:uk(t.owner)}}function B9(o,t){return{...VNe(o,t),tags:t.tags,has_device:t.has_device,history_uuid:t.history_uuid,key:t.key,iv:t.iv,dataStrId:t.dataStrId,dataStr:t.dataStr,isFavorite:t.isFavorite}}function rPe(o,t){return{...VNe(o,t),custom_tags:t.custom_tags,source:t.source,version:t.version}}function GNe(o,t){return{title:t.title,description:t.description,docType:t.docType,uuid:t.uuid,path:nk(t)||o,ticket:t.ticket,updateTime:Jg(t.updateTime),createTime:Jg(t.createTime),display_title:t.display_title,creator:ck(t.creator),modifier:hk(t.modifier),owner:uk(t.owner)}}function F9(o,t){return{...GNe(o,t),tags:t.tags,has_device:t.has_device,history_uuid:t.history_uuid,key:t.key,iv:t.iv,dataStrId:t.dataStrId,dataStr:t.dataStr,isFavorite:t.isFavorite}}function iPe(o,t){return{...GNe(o,t),custom_tags:t.custom_tags,source:t.source,version:t.version}}async function dk(o,t){return{title:t.title,description:t.description,path:nk(t)||o,docType:t.docType,uuid:t.uuid,ticket:t.ticket,updateTime:Jg(t.updateTime),createTime:Jg(t.createTime),display_title:t.display_title,creator:ck(t.creator),modifier:hk(t.modifier),owner:uk(t.owner),tags:t.tags,dataStrId:t.dataStrId,dataStr:await az(t)}}function yL(o,t){return{title:t.title,description:t.description,path:nk(t)||o,docType:t.docType,uuid:t.uuid,ticket:t.ticket,updateTime:Jg(t.updateTime),createTime:Jg(t.createTime),display_title:t.display_title,creator:ck(t.creator),modifier:hk(t.modifier),owner:uk(t.owner),tags:t.tags,history_uuid:t.history_uuid,key:t.key,iv:t.iv,dataStr:t.dataStr,dataStrId:t.dataStrId,isFavorite:t.isFavorite}}async function bL(o,t){return{title:t.title,path:nk(t)||o,docType:t.docType,uuid:t.uuid,ticket:t.ticket,updateTime:Jg(t.updateTime),createTime:Jg(t.createTime),display_title:t.display_title,creator:ck(t.creator),modifier:hk(t.modifier),owner:uk(t.owner),tags:t.tags,history_uuid:t.history_uuid,key:t.key,iv:t.iv,dataStrId:t.dataStrId,dataStr:await az(t)}}async function YPt(o){let{d3modelItemIn:t,d3modelItemOut:e,d3modelTagIds:r,d3modelTagTitles:i}=await BNe(o.d3model,o.path,o.isProject),n=t||e;if(!n)throw new ft("PARAMETER_VERIFICATION","missing 3d-model data.");MNe(n.title),"path"in o.d3model&&o.d3model.override&&rg(n,o.d3model.override);let s=await Vn("POST",kn.COMPONENT.CREATE,{...n,tags:r,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(s.code===0&&s.success){let l=s.result;return await dk(o.path,l)}let a=s.message||s.msg||"Request Error.";throw QT(s.code)?new ft("D3MODEL_SAME_NAMA_EXISTS",a):vP(s.code)?new ft("CREATE_D3MODEL_PERMISSIONS",a):new ft("CREATE_D3MODEL",a)}async function KQ(o=!1,t,e,r,i,n){let s=t.toLocaleLowerCase(),a=n?!!n.forceAsSymbol:!1,l=[];try{if(a||r&&[2,18,19,20,21,22,25,31,7,32,6].indexOf(r)>=0){let c={isProject:o,path:e,titles:[s],docType:r};l=(await Rh.getSymbolSearchList(c))[s]||[]}if(r===28){let c={isProject:o,path:e,titles:[s]};l=(await Rh.getDeviceSearchList(c))[s]||[]}if(r===4){let c={isProject:o,path:e,titles:[s]};l=(await Rh.getFootprintSearchList(c))[s]||[]}return r===16&&(l=(await Rh.getD3ModelSearchList({isProject:o,uid:e,path:e,page:1,pageSize:void 0,wd:s})).lists),{code:0,success:!0,result:l,message:""}}catch(c){return console.error(c),{code:-1,success:!1,result:[],message:c instanceof ft?`${String(c.action)}|${String(c.message)}`:c.message||"QueryComponentsByTitle call error."}}}function i5e(o,t){return o.path==t}function n5e(o){try{let t=JSON.parse(o);return{parentName:t[0],childName:t[1]}}catch{return{parentName:"",childName:""}}}function jPt(o){let t={};return t["device-owner"]=o.userIdSelected,t["device-lib"]=o.userIdSelected,t["footprint-name"]=o.footprintItem?o.footprintItem.display_title:"",t["symbol-name"]=o.symbolItem?o.symbolItem.display_title:"",t["new-symbol"]=o.isNeedCreateSymbolAndAssocia,t}function UNe(o,t){typeof o.footprintItemId<"u"&&(t.Footprint=o.footprintItemId),typeof o.symbolItemId<"u"&&(t.Symbol=o.symbolItemId)}async function HNe(o,t){let e=jPt(o),r=o.footprintItem,i=o.symbolItem,n={},s=async(T,I)=>{let C="",E="",O=!1,_=t==="zh-hans",x=T.parent_tag,v=T.child_tag;if(x&&x.uuid&&(O=!0,C=_&&x.name_cn||x.name),O&&v&&v.uuid){let D=_&&v.name_cn||v.name;C+=`:${D}`}if(C){let D=C.split(":")[0],w=C.split(":")[1],F=await cL({categories:w?[{parentName:D,childName:w}]:[{parentName:D}],type:[+I],uuid:e["device-owner"]}),H=F.allParentCreated[0]?F.allParentCreated[0].uuid:void 0,z=F.allChildCreated[0]?F.allChildCreated[0].uuid:void 0;H&&(E=z?[H,z]:[H])}return E},a={"file-owner":e["device-owner"],"file-name":e["footprint-name"],"file-describe":"","file-category":await s((r==null?void 0:r.tags)||{},4),"file-lib":e["device-lib"],"file-customTags":[]};if(r&&r!=null&&r.custom_tags&&!(a!=null&&a["file-category"])){let{parentName:T,childName:I}=n5e(r.custom_tags);if(T){let C=await cL({categories:I?[{parentName:T,childName:I}]:[{parentName:T}],type:[4],uuid:e["device-owner"]}),E=C.allParentCreated[0]?C.allParentCreated[0].uuid:void 0,O=C.allChildCreated[0]?C.allChildCreated[0].uuid:void 0;E&&(a["file-customTags"]=O?[E,O]:[E])}}let l={"file-owner":e["device-owner"],"file-name":e["symbol-name"],"file-describe":"","file-category":await s((i==null?void 0:i.tags)||{},2),"file-lib":e["device-lib"],"file-customTags":[]};if(i&&i!=null&&i.custom_tags&&!l["file-category"]){let{parentName:T,childName:I}=n5e(i.custom_tags);if(T){let C=await cL({categories:I?[{parentName:T,childName:I}]:[{parentName:T}],type:[4],uuid:e["device-owner"]}),E=C.allParentCreated[0]?C.allParentCreated[0].uuid:void 0,O=C.allChildCreated[0]?C.allChildCreated[0].uuid:void 0;E&&(l["file-customTags"]=O?[E,O]:[E])}}let c,h,u,d,p=!1,m=!1,g=!1;async function y(){if(e["footprint-name"])if(i5e(r,e["device-owner"]||e["device-lib"]))u=r,c=null;else{let T=await KQ(!1,a["file-name"],e["device-lib"],4);T.result.length<=0||(m=!0,u=r,c=T.result)}else u=null,c=null}async function b(){if(!e["new-symbol"]&&e["symbol-name"]&&i)if(i5e(i,e["device-owner"]||e["device-lib"]))d=i,h=null;else{let T=await KQ(!1,l["file-name"],e["device-lib"],i.docType);T.result.length<=0||(p=!0,h=T.result,d=i)}else d=null,h=null}await y(),await b();let P={isNeedConfirm:!1,updateCache:n,formData:e,newFootPrint:c,oldFootPrint:u,newSymbol:h,oldSymbol:d,confirmRes:o};return!p&&!m&&!g?(P.isNeedConfirm=!1,P):(P.isNeedConfirm=!0,P)}async function lTe(o,t,e,r){let i=null,n=null,s=[],a=[],l=!1,c,h;if(o)if("data"in o)o.data&&(i=o.data,i.tags&&(i.tags instanceof Array?a=i.tags:a=Tv(i.tags)));else{if(!o.uuid||!o.path)throw new ft("PARAMETER_VERIFICATION","missing footprint uuid or path data.");c=o.uuid,h=o.path,n=await Rh.getFootprint({isProject:o.isProject,uuid:o.uuid,path:o.path}),n&&(n.title=n.display_title,r&&Array.isArray(r)?a=r:a=await DO(n.tags,o.path,[4]))}if(!e){let u=await _f.categoryAddtition.addActuator(a,[0],t,4);s=u.uuids,a=u.titles}return{footprintItemOriginUuid:c,footprintItemOriginPath:h,footprintItemIn:i,footprintItemOut:n,footprintTagIds:s,footprintTagTitles:a}}async function cTe(o,t,e,r){let i=null,n=null,s=[],a=[],l=!1,c,h;if(o)if("data"in o)o.data&&(i=o.data,i.tags&&(i.tags instanceof Array?a=i.tags:a=Tv(i.tags)));else{if(!o.uuid||!o.path)throw new ft("PARAMETER_VERIFICATION","missing symbol uuid or path data.");c=o.uuid,h=o.path,n=await Rh.getSymbol({isProject:o.isProject,uuid:o.uuid,path:o.path}),n&&(n.title=n.display_title,r&&Array.isArray(r)?a=r:a=await DO(n.tags,o.path,[2])),l=o.isProject}if(!e){let u=await _f.categoryAddtition.addActuator(a,[0],t,2);s=u.uuids,a=u.titles}return{symbolItemOriginUuid:c,symbolItemOriginPath:h,symbolItemIn:i,symbolItemOut:n,symbolTagIds:s,symbolTagTitles:a}}async function WNe(o,t,e,r){let i=null,n=null,s=[],a=[],l=!1;if(o)if("data"in o)o.data&&(i=o.data,i.tags&&(i.tags instanceof Array?a=i.tags:a=Tv(i.tags)));else{if(!o.uuid||!o.path)throw new ft("PARAMETER_VERIFICATION","missing device uuid or path data.");n=await Rh.getDevice({isProject:o.isProject,uuid:o.uuid,path:o.path}),n&&(n.title=n.display_title,r&&Array.isArray(r)?a=r:a=await DO(n.tags,o.path,[3])),l=o.isProject}if(!e){let c=await _f.categoryAddtition.addActuator(a,[0],t,3);s=c.uuids,a=c.titles}return{deviceItemIn:i,deviceItemOut:n,deviceTagIds:s,deviceTagTitles:a,isDeviceFromProject:l}}async function zNe(o,t,e,r,i,n){let s=null,a=null,l=[],c=[],h,u;if(o){let{symbolItemIn:d,symbolItemOut:p,symbolTagIds:m,symbolTagTitles:g,symbolItemOriginUuid:y,symbolItemOriginPath:b}=await cTe(o,e,r,"path"in o&&o.override&&Array.isArray(o.override.tags)?o.override.tags:void 0);s=d,a=p,l=m,c=g,h=y,u=b}else if(i)if(n){let d=await Rh.getSymbol({isProject:t,uuid:i,path:n});if(h=i,u=n,d){d.title=d.display_title,a=d,c=await DO(d.tags,n,[2]);let p=await _f.categoryAddtition.addActuator(c,[0],e,2);l=p.uuids,c=p.titles}}else{let d=null;try{d=await Rh.getSymbol({isProject:t,uuid:i,path:e}),h=i,u=e}catch(p){d=null,h=i,u=e,console.warn(p)}d||console.warn("[NOSYMBOL_ON_TARGETPATH_BY_DEVICE_BOUND]: the symbol bound to this device does not exist in the target library.")}return{symbolItemOriginUuid:h,symbolItemOriginPath:u,symbolItemIn:s,symbolItemOut:a,symbolTagIds:l,symbolTagTitles:c}}async function YNe(o,t,e,r,i,n){let s=null,a=null,l=[],c=[],h,u;if(o){let{footprintItemIn:d,footprintItemOut:p,footprintTagIds:m,footprintTagTitles:g,footprintItemOriginUuid:y,footprintItemOriginPath:b}=await lTe(o,e,r,"path"in o&&o.override&&Array.isArray(o.override.tags)?o.override.tags:void 0);s=d,a=p,l=m,c=g,h=y,u=b}else if(i)if(n){let d=await Rh.getFootprint({isProject:t,uuid:i,path:n});if(h=i,u=n,d){d.title=d.display_title,a=d,c=await DO(d.tags,n,[4]);let p=await _f.categoryAddtition.addActuator(c,[0],e,4);l=p.uuids,c=p.titles}}else{let d=null;try{d=await Rh.getFootprint({isProject:t,uuid:i,path:e}),h=i,u=e}catch(p){d=null,h=i,u=e,console.warn(p)}d||console.warn("[NOFOOTPRINT_ON_TARGETPATH_BY_DEVICE_BOUND]: the footprint bound to this device does not exist in the target library.")}return{footprintItemOriginUuid:h,footprintItemOriginPath:u,footprintItemIn:s,footprintItemOut:a,footprintTagIds:l,footprintTagTitles:c}}async function jNe(o,t,e,r,i,n){if(!r)return;let s=null;if("data"in r)i.title&&(s=await Rh.createSymbol({isProject:o,path:t,symbol:{data:{...i,tags:n},ignoreDuplicateNameCheck:r.ignoreDuplicateNameCheck}})),e.attributes&&s&&typeof s=="object"&&(e.attributes.Symbol=s.uuid);else{r.override&&rg(i,r.override);try{s=await Rh.getSymbol({isProject:o,path:t,uuid:r.uuid})}catch{s=null}if(s&&typeof s=="object")e.attributes&&(e.attributes.Symbol=s.uuid);else if(i.title&&(s=await Rh.createSymbol({isProject:o,path:t,symbol:{data:{...i,tags:n},ignoreDuplicateNameCheck:r.ignoreDuplicateNameCheck}})),e.attributes&&s&&typeof s=="object"){e.attributes.Symbol=s.uuid;let a=await Pv({origin:{docType:i.docType,isProject:r.isProject,uuid:r.uuid,path:r.path},target:{docType:s.docType,isProject:o,uuid:s.uuid,path:s.path}});if(!a.success)throw new ft("CREATE_SYMBOL_MIGRATE_CANVAS_ERROR",a.message||"migrate canvas error.")}}}async function XNe(o,t,e,r,i,n){if(!r)return;let s=null;if("data"in r)i.title&&(s=await Rh.createFootprint({isProject:o,path:t,footprint:{data:{...i,tags:n}}})),e.attributes&&s&&typeof s=="object"&&(e.attributes.Footprint=s.uuid);else{r.override&&rg(i,r.override);try{s=await Rh.getFootprint({isProject:o,path:t,uuid:r.uuid})}catch{s=null}if(s&&typeof s=="object")e.attributes&&(e.attributes.Footprint=s.uuid);else if(i.title&&(s=await Rh.createFootprint({isProject:o,path:t,footprint:{data:{...i,tags:n}}})),e.attributes&&s&&typeof s=="object"){e.attributes.Footprint=s.uuid;let a=await Pv({origin:{docType:i.docType,isProject:r.isProject,uuid:r.uuid,path:r.path},target:{docType:s.docType,isProject:o,uuid:s.uuid,path:s.path}});if(!a.success)throw new ft("CREATE_FOOTPRINT_MIGRATE_CANVAS_ERROR",a.message||"migrate canvas error.")}}}async function XPt(o){let{deviceItemIn:t,deviceItemOut:e,deviceTagIds:r,deviceTagTitles:i,isDeviceFromProject:n}=await WNe(o.device,o.path,o.isProject,"path"in o.device&&o.device.override&&Array.isArray(o.device.override.tags)?o.device.override.tags:void 0),s=t||e;if(!s)throw new ft("PARAMETER_VERIFICATION","missing device data.");s.title=o.device&&"path"in o.device&&o.device.override&&hz(o.device.override,"title")||s.title,RNe(s.title);let{symbolItemIn:a,symbolItemOut:l,symbolTagIds:c,symbolTagTitles:h,symbolItemOriginUuid:u,symbolItemOriginPath:d}=await zNe(o.symbol,n,o.path,o.isProject,s.attributes?s.attributes.Symbol:void 0,"data"in o.device?void 0:o.device.path),p=a||l,m=!!(o.symbol&&"data"in o.symbol);s.attributes&&l&&typeof l=="object"&&(s.attributes.Symbol=l.uuid),o.symbol&&"path"in o.symbol&&o.symbol.override&&rg(p,o.symbol.override);let{footprintItemIn:g,footprintItemOut:y,footprintTagIds:b,footprintTagTitles:P,footprintItemOriginUuid:T,footprintItemOriginPath:I}=await YNe(o.footprint,n,o.path,o.isProject,s.attributes?s.attributes.Footprint:void 0,"data"in o.device?void 0:o.device.path),C=g||y;o.footprint&&"path"in o.footprint&&o.footprint.override&&rg(C,o.footprint.override),s.attributes&&y&&typeof y=="object"&&(s.attributes.Footprint=y.uuid);let E=!1,O=!1,_=await HNe({symbolItem:p,footprintItem:C,userIdSelected:o.path,isNeedCreateSymbolAndAssocia:m},void 0);if(_.isNeedConfirm){let D=(await on.messageBus.rpcCall("OpenSameNameSaveAsDlgService",{..._},31536e8)).message;if(!D){let w="an exception occurred while executing the cross-bind program.";throw new ft("CROSS_BIND",w)}if(D.action==="cancel"||D.action==="close"){let w="quit operate while executing the cross-bind program.";throw new ft("CROSS_BIND_EXIT",w)}_.updateCache=D.data,s.attributes&&Object.keys(_.updateCache).length&&(_.updateCache.symbolItemId&&(E=!0),_.updateCache.footprintItemId&&(O=!0),UNe(_.updateCache,s.attributes))}!E&&p&&await jNe(o.isProject,o.path,s,o.symbol,p,h),!O&&C&&await XNe(o.isProject,o.path,s,o.footprint,C,P),"path"in o.device&&o.device.override&&(delete o.device.override.tags,rg(s,o.device.override));let x=await Vn("POST",kn.DEVICE.CREATE,{...s,tags:r,owner:o.path,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(x.code===0&&x.success){let D=x.result;return Iv(o.path,D)}let v=x.message||x.msg||"Request Error.";throw QT(x.code)?new ft("DEVICE_SAME_NAMA_EXISTS",v):vP(x.code)?new ft("CREATE_DEVICE_PERMISSIONS",v):new ft("CREATE_DEVICE",v)}async function qPt(o){let{footprintItemIn:t,footprintItemOut:e,footprintTagIds:r,footprintTagTitles:i}=await lTe(o.footprint,o.path,o.isProject,"path"in o.footprint&&o.footprint.override&&Array.isArray(o.footprint.override.tags)?o.footprint.override.tags:void 0),n=t||e;if(!n)throw new ft("PARAMETER_VERIFICATION","missing footprint data.");n.title="path"in o.footprint&&o.footprint.override&&hz(o.footprint.override,"title")||n.title,wNe(n.title),"path"in o.footprint&&o.footprint.override&&(delete o.footprint.override.tags,rg(n,o.footprint.override));let s=await Vn("POST",kn.COMPONENT.CREATE,{title:n.title,tags:r,docType:n.docType||4,description:n.description,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(s.code===0&&s.success){let l=s.result;if(!("data"in o.footprint)&&o.footprint.uuid&&o.footprint.path){let c=await Pv({origin:{docType:n.docType,isProject:!!o.footprint.isProject,uuid:o.footprint.uuid,path:o.footprint.path},target:{docType:l.docType,isProject:!1,uuid:l.uuid,path:l.path}});if(!c.success)throw new ft("CREATE_FOOTPRINT_MIGRATE_CANVAS_ERROR",c.message||"migrate canvas error.")}return F9(o.path,l)}let a=s.message||s.msg||"Request Error.";throw QT(s.code)?new ft("FOOTPRINT_SAME_NAMA_EXISTS",a):vP(s.code)?new ft("CREATE_FOOTPRINT_PERMISSIONS",a):new ft("CREATE_FOOTPRINT",a)}async function qNe(o,t,e,r){let i=null,n=null,s=[],a=[],l=!1,c,h;if(o)if("data"in o)i=o.data,i.tags&&(i.tags instanceof Array?a=i.tags:a=Tv(i.tags));else{if(!o.uuid||!o.path)throw new ft("PARAMETER_VERIFICATION","missing simModel uuid or path data.");c=o.uuid,h=o.path,n=await Rh.getSimModel({isProject:o.isProject,uuid:o.uuid,path:o.path}),n&&(n.title=n.display_title,r&&Array.isArray(r)?a=r:a=await DO(n.tags,o.path,[6]))}if(!e){let u=await _f.categoryAddtition.addActuator(a,[0],t,6);s=u.uuids,a=u.titles}return{simModelItemOriginUuid:c,simModelItemOriginPath:h,simModelItemIn:i,simModelItemOut:n,simModelTagIds:s,simModelTagTitles:a}}async function $Pt(o){let{simModelItemIn:t,simModelItemOut:e,simModelTagIds:r,simModelTagTitles:i}=await qNe(o.simModel,o.path,o.isProject,"path"in o.simModel&&o.simModel.override&&Array.isArray(o.simModel.override.tags)?o.simModel.override.tags:void 0),n=t||e;if(!n)throw new ft("PARAMETER_VERIFICATION","missing sim-model data.");n.title="path"in o.simModel&&o.simModel.override&&hz(o.simModel.override,"title")||n.title,NNe(n.title),"path"in o.simModel&&o.simModel.override&&(delete o.simModel.override.tags,rg(n,o.simModel.override));let s=await Vn("POST",kn.COMPONENT.CREATE,{...n,tags:r,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(s.code===0&&s.success){let l=s.result;return await bL(o.path,l)}let a=s.message||s.msg||"Request Error.";throw QT(s.code)?new ft("SIM_MODEL_SAME_NAMA_EXISTS",a):vP(s.code)?new ft("CREATE_SIM_MODEL_PERMISSIONS",a):new ft("CREATE_SIM_MODEL",a)}async function KPt(o){let{symbolItemIn:t,symbolItemOut:e,symbolTagIds:r,symbolTagTitles:i}=await cTe(o.symbol,o.path,o.isProject,"path"in o.symbol&&o.symbol.override&&Array.isArray(o.symbol.override.tags)?o.symbol.override.tags:void 0),n=t||e;if(!n)throw new ft("PARAMETER_VERIFICATION","missing symbol data.");n.title="path"in o.symbol&&o.symbol.override&&hz(o.symbol.override,"title")||n.title,DNe(n.title),"path"in o.symbol&&o.symbol.override&&(delete o.symbol.override.tags,rg(n,o.symbol.override));let s=await Vn("POST",kn.COMPONENT.CREATE,{title:n.title,tags:r,docType:n.docType,description:n.description,owner:o.path,ignoreDuplicateNameCheck:o.symbol.ignoreDuplicateNameCheck},{headers:{"Content-Type":"application/json",path:o.path}});if(s.code===0&&s.success){let l=s.result;if(!("data"in o.symbol)&&o.symbol.uuid&&o.symbol.path){let c=await Pv({origin:{docType:n.docType,isProject:!!o.symbol.isProject,uuid:o.symbol.uuid,path:o.symbol.path},target:{docType:l.docType,isProject:!1,uuid:l.uuid,path:l.path}});if(!c.success)throw new ft("CREATE_SYMBOL_MIGRATE_CANVAS_ERROR",c.message||"migrate canvas error.")}return B9(o.path,l)}let a=s.message||s.msg||"Request Error.";throw QT(s.code)?new ft("SYMBOL_SAME_NAMA_EXISTS",a):vP(s.code)?new ft("CREATE_SYMBOL_PERMISSIONS",a):new ft("CREATE_SYMBOL",a)}async function ZPt(o){let t=await Vn("GET",xc(kn.DEVICE.GET,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result;if(typeof r.path<"u"&&r.path!==o.path)throw new ft("GET_DEVICE_NOT_FOUND","data not found");return Iv(o.path,r)}let e=t.message||t.msg||"Request Error.";throw new ft("GET_DEVICE",e)}async function JPt(o){let t=await Vn("GET",xc(kn.COMPONENT.GET,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result;if(typeof r.path<"u"&&r.path!==o.path)throw new ft("GET_FOOTPRINT_NOT_FOUND","data not found");return F9(o.path,r)}let e=t.message||t.msg||"Request Error.";throw new ft("GET_FOOTPRINT",e)}async function QPt(o){let t=await Vn("GET",xc(kn.COMPONENT.GET,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result;return await bL(o.path,r)}let e=t.message||t.msg||"Request Error.";throw new ft("GET_SIM_MODEL",e)}function ZC(o={}){let t={},e=Object.keys(o);for(let r=0;r<e.length;r++)e[r]===""||String(e[r])==="undefined"||typeof o[e[r]]>"u"||o[e[r]]==null||(t[e[r]]=o[e[r]]);return t}async function eTt(o){let t=await Vn("GET",kn.COMPONENT.LIST,{...ZC(o.query||{}),path:o.path,uid:o.uid,page:o.page,pageSize:o.pageSize,docType:o.docType,tag:o.tags||[]},{headers:{path:o.path},searchParams:!0});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result,i=[];for(let n of r.lists)i.push(await bL(o.path,n));return{count:r.count,page:r.page,pageSize:r.pageSize,totalPage:r.totalPage,lists:i}}let e=t.message||t.msg||"Request Error.";throw new ft("GET_SIM_MODEL_LIST",e)}async function tTt(o){let t=await Vn("GET",xc(kn.COMPONENT.GET,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result;if(typeof r.path<"u"&&r.path!==o.path)throw new ft("GET_SYMBOL_NOT_FOUND","data not found");return B9(o.path,r)}let e=t.message||t.msg||"Request Error.";throw new ft("GET_SYMBOL",e)}async function rTt(o){let{deviceItemIn:t,deviceItemOut:e,deviceTagIds:r,deviceTagTitles:i,isDeviceFromProject:n}=await WNe(o.device,o.path,o.isProject,"path"in o.device&&o.device.override&&Array.isArray(o.device.override.tags)?o.device.override.tags:void 0),s=t||e;if(!s)throw new ft("PARAMETER_VERIFICATION","missing device data.");s.title!==void 0&&RNe(s.title);let{symbolItemIn:a,symbolItemOut:l,symbolTagIds:c,symbolTagTitles:h,symbolItemOriginUuid:u,symbolItemOriginPath:d}=await zNe(o.symbol,n,o.path,o.isProject,s.attributes?s.attributes.Symbol:void 0,"data"in o.device?void 0:o.device.path),p=a||l,m=!!(o.symbol&&"data"in o.symbol);o.symbol&&"path"in o.symbol&&o.symbol.override&&rg(p,o.symbol.override),s.attributes&&l&&typeof l=="object"&&(s.attributes.Symbol=l.uuid);let{footprintItemIn:g,footprintItemOut:y,footprintTagIds:b,footprintTagTitles:P,footprintItemOriginUuid:T,footprintItemOriginPath:I}=await YNe(o.footprint,n,o.path,o.isProject,s.attributes?s.attributes.Footprint:void 0,"data"in o.device?void 0:o.device.path),C=g||y;o.footprint&&"path"in o.footprint&&o.footprint.override&&rg(C,o.footprint.override),s.attributes&&y&&typeof y=="object"&&(s.attributes.Footprint=y.uuid);let E=!1,O=!1,_=await HNe({symbolItem:p,footprintItem:C,userIdSelected:o.path,isNeedCreateSymbolAndAssocia:m},void 0);if(_.isNeedConfirm){let D=(await on.messageBus.rpcCall("OpenSameNameSaveAsDlgService",{..._},31536e8)).message;if(!D){let w="an exception occurred while executing the cross-bind program.";throw new ft("CROSS_BIND",w)}if(D.action==="cancel"||D.action==="close"){let w="quit operate while executing the cross-bind program.";throw new ft("CROSS_BIND_EXIT",w)}_.updateCache=D.data,s.attributes&&Object.keys(_.updateCache).length&&(_.updateCache.symbolItemId&&(E=!0),_.updateCache.footprintItemId&&(O=!0),UNe(_.updateCache,s.attributes))}!E&&p&&await jNe(o.isProject,o.path,s,o.symbol,p,h),!O&&C&&await XNe(o.isProject,o.path,s,o.footprint,C,P),"path"in o.device&&o.device.override&&(delete o.device.override.tags,rg(s,o.device.override));let x=await Vn("POST",xc(kn.DEVICE.UPDATE,{uuid:o.uuid}),{...s,tags:r,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(x.code===0&&x.success&&x.result){let D=x.result;return Iv(o.path,D)}let v=x.message||x.msg||"Request Error.";throw QT(x.code)?new ft("DEVICE_SAME_NAMA_EXISTS",v):vP(x.code)?new ft("CREATE_DEVICE_PERMISSIONS",v):new ft("UPDATE_DEVICE",v)}async function iTt(o){let{footprintItemIn:t,footprintItemOut:e,footprintTagIds:r,footprintTagTitles:i}=await lTe(o.footprint,o.path,o.isProject,"path"in o.footprint&&o.footprint.override&&Array.isArray(o.footprint.override.tags)?o.footprint.override.tags:void 0),n=t||e;if(!n)throw new ft("PARAMETER_VERIFICATION","missing footprint data.");n.title!==void 0&&wNe(n.title),"path"in o.footprint&&o.footprint.override&&(delete o.footprint.override.tags,rg(n,o.footprint.override));let s=await Vn("POST",xc(kn.COMPONENT.UPDATE,{uuid:o.uuid}),{title:n.title,tags:r,docType:n.docType||4,description:n.description,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(s.code===0&&s.success&&typeof s.result=="object"){let l=s.result;if(!("data"in o.footprint)&&o.footprint.uuid&&o.footprint.path){let c=await Pv({origin:{docType:n.docType,isProject:o.footprint.isProject,uuid:o.footprint.uuid,path:o.footprint.path},target:{docType:l.docType,isProject:o.isProject,uuid:o.uuid,path:o.path}});if(!c.success)throw new ft("UPDATE_FOOTPRINT_MIGRATE_CANVAS_ERROR",c.message||"migrate canvas error.")}return F9(o.path,l)}let a=s.message||s.msg||"Request Error.";throw QT(s.code)?new ft("FOOTPRINT_SAME_NAMA_EXISTS",a):vP(s.code)?new ft("UPDATE_FOOTPRINT_PERMISSIONS",a):new ft("UPDATE_FOOTPRINT",a)}async function nTt(o){let{simModelItemIn:t,simModelItemOut:e,simModelTagIds:r,simModelTagTitles:i}=await qNe(o.simModel,o.path,o.isProject,"path"in o.simModel&&o.simModel.override&&Array.isArray(o.simModel.override.tags)?o.simModel.override.tags:void 0),n=t||e;if(!n)throw new ft("PARAMETER_VERIFICATION","missing simModel data.");n.title!==void 0&&NNe(n.title),"path"in o.simModel&&o.simModel.override&&(delete o.simModel.override.tags,rg(n,o.simModel.override));let s=await Vn("POST",xc(kn.COMPONENT.UPDATE,{uuid:o.uuid}),{...n,tags:r,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!s.success){let l=s.message||s.msg||"Request Error.";throw new ft("UPDATE_SIM_MODEL",l)}if(n.dataStr){let l=await Vn("POST",xc(kn.COMPONENT.UPDATE_CANVAS,{uuid:o.uuid}),{...n,tags:r,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!l.success){let c=l.message||l.msg||"Request Error.";throw new ft("UPDATE_SIM_MODEL",c)}}if(s.code===0&&s.success&&typeof s.result=="object"){let l=s.result;return await bL(o.path,l)}let a=s.message||s.msg||"Request Error.";throw QT(s.code)?new ft("SIM_MODEL_SAME_NAMA_EXISTS",a):vP(s.code)?new ft("UPDATE_SIM_MODEL_PERMISSIONS",a):new ft("UPDATE_SYMBOL",a)}async function oTt(o){let{symbolItemIn:t,symbolItemOut:e,symbolTagIds:r,symbolTagTitles:i}=await cTe(o.symbol,o.path,o.isProject,"path"in o.symbol&&o.symbol.override&&Array.isArray(o.symbol.override.tags)?o.symbol.override.tags:void 0),n=t||e;if(!n)throw new ft("PARAMETER_VERIFICATION","missing symbol data.");n.title!==void 0&&DNe(n.title),"path"in o.symbol&&o.symbol.override&&(delete o.symbol.override.tags,rg(n,o.symbol.override));let s=await Vn("POST",xc(kn.COMPONENT.UPDATE,{uuid:o.uuid}),{title:n.title,tags:r,docType:n.docType,description:n.description,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(s.code===0&&s.success&&typeof s.result=="object"){let l=s.result;if(!("data"in o.symbol)&&o.symbol.uuid&&o.symbol.path){let c=await Pv({origin:{docType:n.docType,isProject:o.symbol.isProject,uuid:o.symbol.uuid,path:o.symbol.path},target:{docType:l.docType,isProject:o.isProject,uuid:o.uuid,path:o.path}});if(!c.success)throw new ft("UPDATE_SYMBOL_MIGRATE_CANVAS_ERROR",c.message||"migrate canvas error.")}return B9(o.path,l)}let a=s.message||s.msg||"Request Error.";throw QT(s.code)?new ft("SYMBOL_SAME_NAMA_EXISTS",a):vP(s.code)?new ft("UPDATE_SYMBOL_PERMISSIONS",a):new ft("UPDATE_SYMBOL",a)}async function sTt(o){let t=await Vn("GET",kn.COMPONENT.LIST,{...o.query||{},path:o.path,uid:o.uid,page:o.page,pageSize:o.pageSize,docType:[16],tag:o.tags||[]},{headers:{path:o.path},searchParams:!0});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result,i=[];for(let n of r.lists)i.push(await dk(o.path,n));return{count:r.count,page:r.page,pageSize:r.pageSize,totalPage:r.totalPage,lists:i}}let e=t.message||t.msg||"Request Error.";throw new ft("GET_D3MODEL_LIST",e)}async function aTt(o){let t=await Vn("GET",kn.COMPONENT.LIST,{...ZC(o.query||{}),path:o.path,uid:o.uid,page:o.page,pageSize:o.pageSize,docType:[4],tag:o.tags||[]},{headers:{path:o.path},searchParams:!0});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result,i=[];for(let n of r.lists)i.push(F9(o.path,n));return{count:r.count,page:r.page,pageSize:r.pageSize,totalPage:r.totalPage,lists:i}}let e=t.message||t.msg||"Request Error.";throw new ft("GET_FOOTPRINT_LIST",e)}async function lTt(o){let t=await Vn("GET",kn.COMPONENT.LIST,{...ZC(o.query||{}),path:o.path,uid:o.uid,page:o.page,pageSize:o.pageSize,docType:o.docType,tag:o.tags||[]},{headers:{path:o.path},searchParams:!0});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result,i=[];for(let n of r.lists)i.push(B9(o.path,n));return{count:r.count,page:r.page,pageSize:r.pageSize,totalPage:r.totalPage,lists:i}}let e=t.message||t.msg||"Request Error.";throw new ft("GET_SYMBOL_LIST",e)}async function cTt(o){var t,e;let r=await Vn("GET",kn.DEVICE.LIST,{...ZC(o.query||{}),path:o.path,uid:o.uid,page:o.page,pageSize:o.pageSize,tag:o.tags||[]},{headers:{path:o.path},searchParams:!0});if(r.code===0&&r.success&&typeof r.result=="object"){let n=r.result,s=[];for(let a of n.lists){let l=Iv(o.path,a);o.withPackage&&(t=a.symbol_info)!=null&&t.uuid&&(l.symbol=B9(o.path,a.symbol_info)),o.withPackage&&(e=a.footprint_info)!=null&&e.uuid&&(l.footprint=F9(o.path,a.footprint_info)),s.push(l)}return{count:n.count,page:n.page,pageSize:n.pageSize,totalPage:n.totalPage,lists:s}}let i=r.message||r.msg||"Request Error.";throw new ft("GET_DEVICE_LIST",i)}async function hTt(o){return o.titles?await uTt(o):o.uuids?await dTt(o):await pTt(o)}async function uTt(o){var t,e;let{path:r,titles:i,user_uuids:n}=o,s=await Vn("POST",kn.DEVICE.GET_BY_USER_AND_TITLE,{type:"device",titles:i,user_uuids:n||[r],path:r},{headers:{"Content-Type":"application/json",path:r}});if(s.code===0&&s.success&&s.result){let l={};for(let c in s.result){l[c]=[];let h=s.result[c];for(let u of h){let d=Iv(r,u);o.withPackage&&(t=u.symbol_info)!=null&&t.uuid&&(d.symbol=B9(r,u.symbol_info)),o.withPackage&&(e=u.footprint_info)!=null&&e.uuid&&(d.footprint=F9(r,u.footprint_info)),l[c].push(d)}}return l}let a=s.message||s.msg||"Request Error.";throw new ft("GET_DEVICE_SEARCH_LIST",a)}async function dTt(o){let{path:t,uuids:e}=o,r=await Vn("POST",kn.DEVICE.BATCH_GET,{uuids:e},{headers:{"Content-Type":"application/json",path:t}});if(r.code===0&&r.success&&r.result){let n=[];for(let s of r.result){let a=Iv(t,s);n.push(a)}return n}let i=r.message||r.msg||"Request Error.";throw new ft("GET_DEVICE_SEARCH_UUIDS",i)}async function pTt(o){var t,e;let{path:r,query:i={},uid:n,page:s,pageSize:a,tags:l=[],wd:c}=o,h=await Vn("POST",kn.DEVICE.SEARCH_LIST,{...ZC(i),path:r,uid:n,page:s,pageSize:a,tag:l,wd:c},{headers:{path:r},searchParams:!0});if(h.code===0&&h.success&&typeof h.result=="object"){let d=h.result,p=[],m=Object.keys(d.lists);for(let g=0;g<m.length;g++){let y=d.lists[m[g]];if(Array.isArray(y)&&y.length)for(let b=0;b<y.length;b++){let P=y[b],T=Iv(r,P);o.withPackage&&(t=P.symbol_info)!=null&&t.uuid&&(T.symbol=B9(r,P.symbol_info)),o.withPackage&&(e=P.footprint_info)!=null&&e.uuid&&(T.footprint=F9(r,P.footprint_info)),p.push(T)}}return{count:d.count,page:d.page,pageSize:d.pageSize,totalPage:d.totalPage,lists:p,facets:d.facets}}let u=h.message||h.msg||"Request Error.";throw new ft("GET_DEVICE_SEARCH_LIST",u)}async function fTt(o){return o.titles?await mTt(o):o.uuids?await gTt(o):await yTt(o)}async function mTt(o){let{path:t,titles:e,docType:r,user_uuids:i}=o,n=await Vn("POST",kn.COMPONENT.GET_BY_USER_AND_TITLE,{docType:r,titles:e,user_uuids:i||[t],path:t},{headers:{"Content-Type":"application/json",path:t}});if(n.code===0&&n.success&&n.result){let a={};for(let l in n.result){a[l]=[];let c=n.result[l];for(let h of c){let u=B9(t,h);a[l].push(u)}}return a}let s=n.message||n.msg||"Request Error.";throw new ft("GET_SYMBOL_SEARCH_LIST",s)}async function gTt(o){let{path:t,uuids:e}=o,r=await Vn("POST",kn.COMPONENT.BATCH_GET,{uuids:e},{headers:{"Content-Type":"application/json",path:t}});if(r.code===0&&r.success&&r.result){let n=[];for(let s of r.result){let a=B9(t,s);n.push(a)}return n}let i=r.message||r.msg||"Request Error.";throw new ft("GET_SYMBOL_SEARCH_UUIDS",i)}async function yTt(o){let{path:t,query:e,uid:r,page:i,pageSize:n,tags:s=[],wd:a,docType:l}=o,c=await Vn("POST",kn.COMPONENT.SEARCH_LIST,{...ZC(e||{}),path:t,uid:r,page:i,pageSize:n,docType:l,tag:s,wd:a},{headers:{path:t},searchParams:!0});if(c.code===0&&c.success&&typeof c.result=="object"){let u=c.result,d=[],p=Object.keys(u.lists);for(let m=0;m<p.length;m++){let g=u.lists[p[m]];if(Array.isArray(g)&&g.length)for(let y=0;y<g.length;y++){let b=g[y],P=B9(t,b);d.push(P)}}return{count:u.count,page:u.page,pageSize:u.pageSize,totalPage:u.totalPage,lists:d,facets:u.facets}}let h=c.message||c.msg||"Request Error.";throw new ft("GET_SYMBOL_SEARCH_LIST",h)}async function bTt(o){return o.titles?await PTt(o):o.uuids?await TTt(o):await ITt(o)}async function PTt(o){let{path:t,titles:e,user_uuids:r}=o,i=await Vn("POST",kn.COMPONENT.GET_BY_USER_AND_TITLE,{docType:4,titles:e,user_uuids:r||[t],path:t},{headers:{"Content-Type":"application/json",path:t}});if(i.code===0&&i.success&&i.result){let s={};for(let a in i.result){s[a]=[];let l=i.result[a];for(let c of l){let h=F9(t,c);s[a].push(h)}}return s}let n=i.message||i.msg||"Request Error.";throw new ft("GET_FOOTPRINT_SEARCH_LIST",n)}async function TTt(o){let{path:t,uuids:e}=o,r=await Vn("POST",kn.COMPONENT.BATCH_GET,{uuids:e},{headers:{"Content-Type":"application/json",path:t}});if(r.code===0&&r.success&&r.result){let n=[];for(let s of r.result){let a=F9(t,s);n.push(a)}return n}let i=r.message||r.msg||"Request Error.";throw new ft("GET_FOOTPRINT_SEARCH_UUIDS",i)}async function ITt(o){let{path:t,query:e={},uid:r,page:i,pageSize:n,tags:s=[],wd:a}=o,l=await Vn("POST",kn.COMPONENT.SEARCH_LIST,{...ZC(e),path:t,uid:r,page:i,pageSize:n,docType:[4],tag:s,wd:a},{headers:{path:t},searchParams:!0});if(l.code===0&&l.success&&typeof l.result=="object"){let h=l.result,u=[],d=Object.keys(h.lists);for(let p=0;p<d.length;p++){let m=h.lists[d[p]];if(Array.isArray(m)&&m.length)for(let g=0;g<m.length;g++){let y=m[g],b=F9(t,y);u.push(b)}}return{count:h.count,page:h.page,pageSize:h.pageSize,totalPage:h.totalPage,lists:u,facets:h.facets}}let c=l.message||l.msg||"Request Error.";throw new ft("GET_FOOTPRINT_SEARCH_LIST",c)}async function CTt(o){return o.titles?await STt(o):o.uuids?await ETt(o):await OTt(o)}async function STt(o){let{path:t,docType:e,titles:r}=o,i=await Vn("POST",kn.COMPONENT.GET_BY_USER_AND_TITLE,{docType:e,titles:r,user_uuids:[t],path:t},{headers:{"Content-Type":"application/json",path:t}});if(i.code===0&&i.success&&i.result){let s={};for(let a in i.result){s[a]=[];let l=i.result[a];for(let c of l){let h=await bL(o.path,c);s[a].push(h)}}return s}let n=i.message||i.msg||"Request Error.";throw new ft("GET_SIM_MODEL_SEARCH_LIST",n)}async function ETt(o){let{path:t,uuids:e}=o,r=await Vn("POST",kn.COMPONENT.BATCH_GET,{uuids:e},{headers:{"Content-Type":"application/json",path:t}});if(r.code===0&&r.success&&r.result){let n=[];for(let s of r.result){let a=await bL(t,s);n.push(a)}return n}let i=r.message||r.msg||"Request Error.";throw new ft("GET_SIM_MODEL_SEARCH_UUIDS",i)}async function OTt(o){let{path:t,query:e={},uid:r,page:i,pageSize:n,docType:s,tags:a=[],wd:l}=o,c=await Vn("POST",kn.COMPONENT.SEARCH_LIST,{...ZC(e),path:t,uid:r,page:i,pageSize:n,docType:s,tag:a,wd:l},{headers:{path:t},searchParams:!0});if(c.code===0&&c.success&&typeof c.result=="object"){let u=c.result,d=[],p=Object.keys(u.lists);for(let m=0;m<p.length;m++){let g=u.lists[p[m]];if(Array.isArray(g)&&g.length)for(let y=0;y<g.length;y++){let b=g[y];d.push(await bL(o.path,b))}}return{count:u.count,page:u.page,pageSize:u.pageSize,totalPage:u.totalPage,lists:d,facets:u.facets}}let h=c.message||c.msg||"Request Error.";throw new ft("GET_SIM_MODEL_SEARCH_LIST",h)}async function ATt(o){if(o.attributes.Symbol){let n=await Rh.getSymbol({isProject:o.isProject,uuid:o.attributes.Symbol,path:o.path})}if(o.attributes.Footprint){let n=await Rh.getFootprint({isProject:o.isProject,uuid:o.attributes.Footprint,path:o.path})}let t=await Rh.getDevice({isProject:o.isProject,uuid:o.uuid,path:o.path}),e=Object.keys(o.attributes||{});for(let n=0;n<e.length;n++)t.attributes[e[n]]=o.attributes[e[n]];let r=await Vn("POST",xc(kn.DEVICE.UPDATE,{uuid:o.uuid}),{...t,title:t.display_title||t.title,tags:t.tags?nNe(t.tags):[],owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(r.code===0&&r.success&&r.result){let n=r.result;return Iv(o.path,n)}let i=r.message||r.msg||"Request Error.";throw vP(r.code)?new ft("CREATE_DEVICE_PERMISSIONS",i):new ft("UPDATE_DEVICE_ATTRIBUTES",i)}async function _Tt(o){return o.titles?await vTt(o):o.uuids?await xTt(o):await RTt(o)}async function vTt(o){let{path:t,titles:e,user_uuids:r}=o;if(p5e||GW&&t!==Ci.SYSTEMLIB_UUID){let i=await Vn("POST",kn.CLIENT.FIND_3DMODEL,{titles:e},{headers:{"Content-Type":"application/json",path:t}});if(i.code===0&&i.success&&i.result){let s={};for(let a in i.result){s[a]=[];let l=i.result[a];for(let c of l){let h={fileName:c.fileName,path:c.path,lib:c.lib};s[a].push(h)}}return s}let n=i.message||i.msg||"Request Error.";throw new ft("GET_D3MODEL_SEARCH_LIST",n)}else{let i=await Vn("POST",kn.COMPONENT.GET_BY_USER_AND_TITLE,{docType:16,titles:e,user_uuids:r||[t],path:t},{headers:{"Content-Type":"application/json",path:t}});if(i.code===0&&i.success&&i.result){let s={};for(let a in i.result){s[a]=[];let l=i.result[a];for(let c of l){let h=await dk(o.path,c);s[a].push(h)}}return s}let n=i.message||i.msg||"Request Error.";throw new ft("GET_D3MODEL_SEARCH_LIST",n)}}async function xTt(o){let{path:t,uuids:e}=o,r=await Vn("POST",kn.COMPONENT.BATCH_GET,{uuids:e},{headers:{"Content-Type":"application/json",path:t}});if(r.code===0&&r.success&&r.result){let n=[];for(let s of r.result){let a=await dk(t,s);n.push(a)}return n}let i=r.message||r.msg||"Request Error.";throw new ft("GET_D3MODEL_SEARCH_UUIDS",i)}async function RTt(o){let{path:t,query:e={},uid:r,page:i,pageSize:n,tags:s=[],wd:a}=o,l=await Vn("POST",kn.COMPONENT.SEARCH_LIST,{...ZC(e),path:t,uid:r,page:i,pageSize:n,docType:[16],tag:s,wd:a},{headers:{path:t},searchParams:!0});if(l.code===0&&l.success&&typeof l.result=="object"){let h=l.result,u=[],d=Object.keys(h.lists);for(let p=0;p<d.length;p++){let m=h.lists[d[p]];if(Array.isArray(m)&&m.length)for(let g=0;g<m.length;g++){let y=m[g];u.push(await dk(o.path,y))}}return{count:h.count,page:h.page,pageSize:h.pageSize,totalPage:h.totalPage,lists:u,facets:h.facets}}let c=l.message||l.msg||"Request Error.";throw new ft("GET_D3MODEL_SEARCH_LIST",c)}async function DTt(o){return o.titles?await wTt(o):o.uuids?await LTt(o):await MTt(o)}async function wTt(o){let{path:t,titles:e}=o,r=await Vn("POST",kn.COMPONENT.GET_BY_USER_AND_TITLE,{docType:29,titles:e,user_uuids:[t],path:t},{headers:{"Content-Type":"application/json",path:t}});if(r.code===0&&r.success&&r.result){let n={};for(let s in r.result){n[s]=[];let a=r.result[s];for(let l of a){let c=yL(o.path,l);n[s].push(c)}}return n}let i=r.message||r.msg||"Request Error.";throw new ft("GET_PANEL_LIB_SEARCH_LIST",i)}async function LTt(o){let{path:t,uuids:e}=o,r=await Vn("POST",kn.COMPONENT.BATCH_GET,{uuids:e},{headers:{"Content-Type":"application/json",path:t}});if(r.code===0&&r.success&&r.result){let n=[];for(let s of r.result){let a=yL(t,s);n.push(a)}return n}let i=r.message||r.msg||"Request Error.";throw new ft("GET_PANEL_LIB_SEARCH_UUIDS",i)}async function MTt(o){let{path:t,query:e={},uid:r,page:i,pageSize:n,tags:s=[],wd:a}=o,l=await Vn("POST",kn.COMPONENT.SEARCH_LIST,{...ZC(e),path:t,uid:r,page:i,pageSize:n,docType:[29],tag:s,wd:a},{headers:{path:t},searchParams:!0});if(l.code===0&&l.success&&typeof l.result=="object"){let h=l.result,u=[],d=Object.keys(h.lists);for(let p=0;p<d.length;p++){let m=h.lists[d[p]];if(Array.isArray(m)&&m.length)for(let g=0;g<m.length;g++){let y=m[g];u.push(yL(o.path,y))}}return{count:h.count,page:h.page,pageSize:h.pageSize,totalPage:h.totalPage,lists:u,facets:h.facets}}let c=l.message||l.msg||"Request Error.";throw new ft("GET_PANEL_LIB_SEARCH_LIST",c)}async function NTt(o){let t=await Vn("GET",xc(kn.COMPONENT.GET,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result;if(typeof r.path<"u"&&r.path!==o.path)throw new ft("GET_PANEL_LIB_NOT_FOUND","data not found");return yL(o.path,r)}let e=t.message||t.msg||"Request Error.";throw new ft("GET_PANEL_LIB",e)}async function $Ne(o,t,e,r){let i=null,n=null,s=[],a=[],l=!1,c,h;if(o)if("data"in o)i=o.data,i.tags&&(i.tags instanceof Array?a=i.tags:a=Tv(i.tags));else{if(!o.uuid||!o.path)throw new ft("PARAMETER_VERIFICATION","missing panelLib uuid or path data.");c=o.uuid,h=o.path,n=await Rh.getPanelLib({isProject:o.isProject,uuid:o.uuid,path:o.path}),n&&(n.title=n.display_title,r&&Array.isArray(r)?a=r:a=await DO(n.tags,o.path,[29]))}if(!e){let u=await _f.categoryAddtition.addActuator(a,[0],t,29);s=u.uuids,a=u.titles}return{panelLibItemOriginUuid:c,panelLibItemOriginPath:h,panelLibItemIn:i,panelLibItemOut:n,panelLibTagIds:s,panelLibTagTitles:a}}async function kTt(o){let{panelLibItemIn:t,panelLibItemOut:e,panelLibTagIds:r,panelLibTagTitles:i}=await $Ne(o.panelLib,o.path,o.isProject,"path"in o.panelLib&&o.panelLib.override&&Array.isArray(o.panelLib.override.tags)?o.panelLib.override.tags:void 0),n=t||e;if(!n)throw new ft("PARAMETER_VERIFICATION","missing panelLib data.");n.title="path"in o.panelLib&&o.panelLib.override&&hz(o.panelLib.override,"title")||n.title,LNe(n.title),"path"in o.panelLib&&o.panelLib.override&&(delete o.panelLib.override.tags,rg(n,o.panelLib.override));let s=await Vn("POST",kn.COMPONENT.CREATE,{title:n.title,tags:r,docType:n.docType||29,description:n.description,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(s.code===0&&s.success){let l=s.result;if(!("data"in o.panelLib)&&o.panelLib.uuid&&o.panelLib.path){let c=await Pv({origin:{docType:n.docType,isProject:!!o.panelLib.isProject,uuid:o.panelLib.uuid,path:o.panelLib.path},target:{docType:l.docType,isProject:!1,uuid:l.uuid,path:l.path}});if(!c.success)throw new ft("CREATE_PANEL_LIB_MIGRATE_CANVAS_ERROR",c.message||"migrate canvas error.")}return yL(o.path,l)}let a=s.message||s.msg||"Request Error.";throw QT(s.code)?new ft("PANELLIB_SAME_NAMA_EXISTS",a):vP(s.code)?new ft("CREATE_PANEL_LIB_PERMISSIONS",a):new ft("CREATE_PANEL_LIB",a)}async function BTt(o){let{panelLibItemIn:t,panelLibItemOut:e,panelLibTagIds:r,panelLibTagTitles:i}=await $Ne(o.panelLib,o.path,o.isProject,"path"in o.panelLib&&o.panelLib.override&&Array.isArray(o.panelLib.override.tags)?o.panelLib.override.tags:void 0),n=t||e;if(!n)throw new ft("PARAMETER_VERIFICATION","missing panelLib data.");n.title!==void 0&&LNe(n.title),"path"in o.panelLib&&o.panelLib.override&&(delete o.panelLib.override.tags,rg(n,o.panelLib.override));let s=await Vn("POST",xc(kn.COMPONENT.UPDATE,{uuid:o.uuid}),{title:n.title,tags:r,docType:29,description:n.description,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(s.code===0&&s.success&&typeof s.result=="object"){let l=s.result;if(!("data"in o.panelLib)&&o.panelLib.uuid&&o.panelLib.path){let c=await Pv({origin:{docType:n.docType,isProject:o.panelLib.isProject,uuid:o.panelLib.uuid,path:o.panelLib.path},target:{docType:l.docType,isProject:o.isProject,uuid:o.uuid,path:o.path}});if(!c.success)throw new ft("UPDATE_PANEL_LIB_MIGRATE_CANVAS_ERROR",c.message||"migrate canvas error.")}return yL(o.path,l)}let a=s.message||s.msg||"Request Error.";throw QT(s.code)?new ft("PANELLIB_SAME_NAMA_EXISTS",a):vP(s.code)?new ft("UPDATE_PANEL_LIB_PERMISSIONS",a):new ft("UPDATE_PANEL_LIB",a)}async function FTt(o){let t=await Vn("GET",kn.COMPONENT.LIST,{...ZC(o.query||{}),path:o.path,uid:o.uid,page:o.page,pageSize:o.pageSize,docType:[29],tag:o.tags||[]},{headers:{path:o.path},searchParams:!0});if(t.code===0&&t.success&&typeof t.result=="object"){let r=t.result,i=[];for(let n of r.lists)i.push(yL(o.path,n));return{count:r.count,page:r.page,pageSize:r.pageSize,totalPage:r.totalPage,lists:i}}let e=t.message||t.msg||"Request Error.";throw new ft("GET_PANEL_LIB_LIST",e)}async function VTt(o){let{d3modelItemIn:t,d3modelItemOut:e,d3modelTagIds:r,d3modelTagTitles:i}=await BNe(o.d3model,o.path,o.isProject),n=t||e;if(!n)throw new ft("PARAMETER_VERIFICATION","missing d3Model data.");n.title!==void 0&&MNe(n.title),"path"in o.d3model&&o.d3model.override&&rg(n,o.d3model.override);let s=await Vn("POST",xc(kn.COMPONENT.UPDATE,{uuid:o.uuid}),{...n,tags:r,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!s.success){let l=s.message||s.msg||"Request Error.";throw new ft("UPDATE_D3MODEL",l)}if(n.dataStr){let l=await Vn("POST",xc(kn.COMPONENT.UPDATE_CANVAS,{uuid:o.uuid}),{...n,tags:r,owner:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!l.success){let c=l.message||l.msg||"Request Error.";throw new ft("UPDATE_D3MODEL",c)}}if(s.code===0&&s.success&&typeof s.result=="object"){let l=s.result;return await dk(o.path,l)}let a=s.message||s.msg||"Request Error.";throw QT(s.code)?new ft("D3MODEL_SAME_NAMA_EXISTS",a):vP(s.code)?new ft("UPDATE_D3MODEL_PERMISSIONS",a):new ft("UPDATE_SYMBOL",a)}async function GTt(o){let t={uid:o.uid,path:o.path};if(o.tags){let{result:i}=await kNe({uuid:o.uid,path:o.path,types:[3],names:o.tags});t.tag=i}let e=await Vn("POST",kn.DEVICE.GET_ATTR_KEYS,t,{headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",path:o.path}});if(e.code===0&&e.success&&typeof e.result=="object")return e.result;let r=e.message||e.msg||"Request Error.";throw new ft("GET_DEVICE_ATTRIBUTES_KEYS",r)}async function UTt(o){let t={uid:o.uid,path:o.path,key:o.key};if(o.tags){let{result:i}=await kNe({uuid:o.uid,path:o.path,types:[3],names:o.tags});t.tag=i}let e=await Vn("POST",kn.DEVICE.GET_ATTR_VALUE,t,{headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",path:o.path}});if(e.code===0&&e.success&&typeof e.result=="object")return e.result;let r=e.message||e.msg||"Request Error.";throw new ft("GET_DEVICE_ATTRIBUTES_VALUES",r)}var HTt=class extends oTe{async getDevice(o){return await ZPt(o)}async getDeviceAttributesKeys(o){return await GTt(o)}async getDeviceAttributesValues(o){return UTt(o)}async getSymbol(o){return await tTt(o)}async getFootprint(o){return await JPt(o)}async getPanelLib(o){return await NTt(o)}async getD3Model(o){return await lz(o.uuid,o.path)}async getSimModel(o){return await QPt(o)}async getDeviceList(o){return await cTt(o)}async getSymbolList(o){return await lTt(o)}async getFootprintList(o){return await aTt(o)}async getPanelLibList(o){return await FTt(o)}async getD3ModelList(o){return await sTt(o)}async getSimModelList(o){return eTt(o)}async getDeviceSearchList(o){return await hTt(o)}async getSymbolSearchList(o){return await fTt(o)}async getFootprintSearchList(o){return await bTt(o)}async getPanelLibSearchList(o){return await DTt(o)}async getD3ModelSearchList(o){return await _Tt(o)}async getSimModelSearchList(o){return CTt(o)}async createDevice(o){return await XPt(o)}async createSymbol(o){return await KPt(o)}async createFootprint(o){return await qPt(o)}async createD3Model(o){return await YPt(o)}async createPanelLib(o){return await kTt(o)}async createSimModel(o){return await $Pt(o)}async updateDevice(o){return await rTt(o)}async updateDeviceAttributes(o){return await ATt(o)}async updateSymbol(o){return await oTt(o)}async updateFootprint(o){return await iTt(o)}async updatePanelLib(o){return await BTt(o)}async updateD3Model(o){return await VTt(o)}async updateSimModel(o){return await nTt(o)}async deleteDevice(o){let t=await Vn("POST",xc(kn.DEVICE.DELETE,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new ft("DELETE_DEVICE",e)}}async deleteSymbol(o){let t=await Vn("POST",xc(kn.COMPONENT.DELETE,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new ft("DELETE_SYMBOL",e)}}async deleteFootprint(o){let t=await Vn("POST",xc(kn.COMPONENT.DELETE,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new ft("DELETE_FOOTPRINT",e)}}async deletePanelLib(o){let t=await Vn("POST",xc(kn.COMPONENT.DELETE,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new ft("DELETE_PANEL_LIB",e)}}async deleteSimModel(o){let t=await Vn("POST",xc(kn.COMPONENT.DELETE,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new ft("DELETE_SIM_MODEL",e)}}async delete3DModel(o){let t=await Vn("POST",xc(kn.COMPONENT.DELETE,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new ft("DELETE_3DMODEL",e)}}async starDevice(o){let t=await Vn("POST",xc(kn.DEVICE.STAR,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new ft("STAR_DEVICE",e)}}async starSymbol(o){let t=await Vn("POST",xc(kn.COMPONENT.STAR,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new ft("STAR_SYMBOL",e)}}async starFootprint(o){let t=await Vn("POST",xc(kn.COMPONENT.STAR,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new ft("STAR_FOOTPRINT",e)}}async starPanelLib(o){let t=await Vn("POST",xc(kn.COMPONENT.STAR,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new ft("STAR_PANEL_LIB",e)}}async unstarDevice(o){let t=await Vn("POST",xc(kn.DEVICE.UNSTAR,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new ft("UNSTAR_DEVICE",e)}}async unstarSymbol(o){let t=await Vn("POST",xc(kn.COMPONENT.UNSTAR,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new ft("UNSTAR_SYMBOL",e)}}async unstarFootprint(o){let t=await Vn("POST",xc(kn.COMPONENT.UNSTAR,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new ft("UNSTAR_FOOTPRINT",e)}}async unstarPanelLib(o){let t=await Vn("POST",xc(kn.COMPONENT.UNSTAR,{uuid:o.uuid}),{uuid:o.uuid,path:o.path},{headers:{"Content-Type":"application/json",path:o.path}});if(!(t.code===0&&t.success)){let e=t.message||t.msg||"Request Error.";throw new ft("UNSTAR_PANEL_LIB",e)}}},RO=class{static diffVersionDevice(o){let t=Object.keys(o);if(!t||!t.length)return;let e=[];for(let r of t)e.push(...o[r].map(i=>({device:i})));on.messageBus.publish("logI18nLogView1",{type:"warn",msg:["Devices have not been added to the project library, project library has devices with different versions from the same source,",{text:"It is recommended to update the project library:",call:{cmd:"updateComponent",args:{uuids:e,needTipModal:!1}}},t.join("\u3001")],onlyTranslateText:!0})}static diffVersionSymbol(o){let t=Object.keys(o);if(!t||!t.length)return;let e=[];for(let r of t)e.push(...o[r].map(i=>({symbol:i})));on.messageBus.publish("logI18nLogView1",{type:"warn",msg:["Symbols have not been added to the project library, project library has symbols with different versions from the same source,",{text:"It is recommended to update the project library:",call:{cmd:"updateComponent",args:{uuids:e,needTipModal:!1}}},t.join("\u3001")],onlyTranslateText:!0})}static diffVersionFootprint(o){let t=Object.keys(o);if(!t||!t.length)return;let e=[];for(let r of t)e.push(...o[r].map(i=>({footprint:i})));on.messageBus.publish("logI18nLogView1",{type:"warn",msg:["Footprints have not been added to the project library, project library has footprints with different versions from the same source,",{text:"It is recommended to update the project library:",call:{cmd:"updateComponent",args:{uuids:e,needTipModal:!1}}},t.join("\u3001")],onlyTranslateText:!0})}static sameVersionDevice(o){}static sameVersionSymbol(o){}static sameVersionFootprint(o){}static renamedDevice(o){on.messageBus.publish("logI18nLogView",{type:"warn",msg:["Devices are automatically renamed when they are added to the project library :",o.join("\u3001")]})}static renamedSymbol(o){on.messageBus.publish("logI18nLogView",{type:"warn",msg:["Symbols are automatically renamed when they are added to the project library :",o.join("\u3001")]})}static renamedFootprint(o){on.messageBus.publish("logI18nLogView",{type:"warn",msg:["Footprints are automatically renamed when they are added to the project library :",o.join("\u3001")]})}},WTt=class{constructor(o){let{renameKey:t=!0}=o;this.renameKey=t}async rename(o,...t){if(await this.hack(o,...t))return{success:!0};let e=(await on.messageBus.rpcCall("allowDuplicateNames",...t)).message;return this.renameKey||!e?this.renaming(o,...t):e?{success:!0}:this.isRename(o,...t)}async hack(o,...t){return!1}},zTt=class extends WTt{constructor(o){let{matchKey:t=!0,byUUID:e=!1,byVersion:r=!1,bySource:i=!1}=o;super(o),this.matchKey=t,this.byUUID=e,this.byVersion=r,this.bySource=i}async match(o){if(this.matchKey)return this.matching(o)}},hTe=class extends zTt{constructor(o){let{path:t,data:e,printLog:r=!0}=o;super(o),this.origin={},this.path=t,this.data=e,this.printLog=r}async onAdd(o){let t=JSON.parse(JSON.stringify(o));return t.path||(t.path=this.path),await cbt({data:t}),Jbe(t),t.project_uuid=t.path=this.path,t}async onUpdate(o){let t=JSON.parse(JSON.stringify(o));return Jbe(t),t}async getTemplate(o,t={}){let{uuid:e,path:r,updateTime:i}=o,n=`${e}${fv}${r}`,s=i==null?void 0:i.toString(),a=Object.assign(o,{path:r,source:n,version:s},t);return Jbe(a),a}},KNe=class extends hTe{async getOrigin(){var o;let{path:t,uuid:e,isProject:r}=this.data;if(mL(this.data)){let{override:i}=this.data;if(i&&i.attributes)throw new ft("CREATE_DEVICE_GET_ORIGIN","Api call error!");if(r){let{message:n}=await on.messageBus.rpcCall("/pro-mgr/hasProject",[t]);if(n){let s=[e,t],a=(await on.messageBus.rpcCall(Jo.DEVICE.GET,s)).message;if(a){let l=Object.assign(a,{uuid:e,path:t,isProject:r});this.origin=await this.getTemplate(l,i)}else throw new ft("CREATE_DEVICE_GET_ORIGIN","Device details data does not exist")}else throw new ft("CREATE_DEVICE_GET_ORIGIN","Get project library data source Project is not open!")}else if(jp.getInstance().hasLib(t)){let n=jp.getInstance().getLib(t),s=await((o=n==null?void 0:n.device)==null?void 0:o.getTransformedDetail(e));if(s){let a=Object.assign(s,{uuid:e,path:t,isProject:r});this.origin=await this.getTemplate(a,i)}else throw new ft("CREATE_DEVICE_GET_ORIGIN","Device details data does not exist")}else{let n={path:t,uuid:e},{message:s}=await on.messageBus.rpcCall(vO.DEVICE.GET,n);if(s.success){let a=s.result,l=Object.assign(a,{uuid:e,path:t,isProject:r});this.origin=await this.getTemplate(l,i)}else throw new ft("CREATE_DEVICE_GET_ORIGIN",s.message||"Device details data does not exist")}}else{let i=this.data.data,n=Object.assign(i,{isProject:r});this.origin=await this.onHandle(n)}return{success:!0,result:this.origin}}async renaming(o){let t=o.display_title||o.title,e=[t,this.path],r=(await on.messageBus.rpcCall(Jo.DEVICE.TRY_RENAME,e)).message;return r&&(o.display_title=o.title=r),this.printLog&&t!==r&&RO.renamedDevice([t]),{success:!0}}},YTt=class extends KNe{onHandle(o){return this.onAdd(o)}async matching(o){if(this.byUUID){let t=[o.uuid,this.path],e=await(await on.messageBus.rpcCall(Jo.DEVICE.GET,t)).message;if(o.ticket&&e!=null&&e.ticket&&(e==null?void 0:e.ticket)===o.ticket)return e}if(o.source){if(this.byVersion){let t=[o.source,o.version,this.path],e=(await on.messageBus.rpcCall(Jo.DEVICE.GET_BY_SOURCE_VERSION,t)).message;return this.printLog&&e&&RO.sameVersionDevice([o.display_title||o.title]),e}if(this.bySource){let t=[o.source,this.path],e=(await on.messageBus.rpcCall(Jo.DEVICE.GET_LAST,t)).message;return this.printLog&&e&&RO.diffVersionDevice({[e.display_title||e.title]:[e.uuid]}),e}}}async isRename(o){let t=[o.display_title||o.title,this.path];if((await on.messageBus.rpcCall(Jo.DEVICE.IS_RENAME,t)).message)throw new ft("DEVICE_SAME_NAMA_EXISTS","Device duplicate name");return{success:!0}}async start(){let o=await this.getOrigin();if(!o.success)throw new ft("CREATE_DEVICE",o.message||"Creation of the device failed!");let t,e;if(this.origin){let r=await this.match(this.origin);if(r)t={success:!0,result:r};else{let i=await this.rename(this.origin,{path:this.path});if(!i.success)throw new ft("CREATE_DEVICE",i.message||"Creation of the device failed!");e=this.origin}}return{success:!0,result:{respond:t,addData:e}}}},ZNe=class extends hTe{async getOrigin(){var o;let{path:t,uuid:e,isProject:r}=this.data;if(mL(this.data)){let{override:i}=this.data;if(r){let{message:n}=await on.messageBus.rpcCall("/pro-mgr/hasProject",[t]);if(n){let s=[e,t],a=(await on.messageBus.rpcCall(Jo.FOOTPRINT.GET,s)).message;if(a){let l=Object.assign(a,{uuid:e,path:t,isProject:r});this.origin=await this.getTemplate(l,i)}else throw new ft("CREATE_FOOTPRINT_GET_ORIGIN","Footprint details data does not exist")}else throw new ft("CREATE_FOOTPRINT_GET_ORIGIN","Get project library data source Project is not open!")}else if(jp.getInstance().hasLib(t)){let n=jp.getInstance().getLib(t),s=await((o=n==null?void 0:n.footprint)==null?void 0:o.getTransformedDetail(e));if(s){let a=Object.assign(s,{uuid:e,path:t,isProject:r});this.origin=await this.getTemplate(a,i)}else throw new ft("CREATE_FOOTPRINT_GET_ORIGIN","Footprint details data does not exist")}else{let n={path:t,uuid:e},{message:s}=await on.messageBus.rpcCall(vO.COMPONENT.GET,n);if(s.success){let a=s.result,l=Object.assign(a,{uuid:e,path:t,isProject:r});this.origin=await this.getTemplate(l,i)}else throw new ft("CREATE_FOOTPRINT_GET_ORIGIN",s.message||"Footprint details data does not exist")}}else{let i=this.data.data,n=Object.assign(i,{isProject:r});this.origin=await this.onHandle(n)}return{success:!0,result:this.origin}}async renaming(o){let t=o.display_title||o.title,e=[t,this.path],r=(await on.messageBus.rpcCall(Jo.FOOTPRINT.TRY_RENAME,e)).message;return r&&(o.display_title=o.title=r),this.printLog&&t!==r&&RO.renamedFootprint([t]),{success:!0}}},uTe=class extends ZNe{onHandle(o){return this.onAdd(o)}async matching(o){if(this.byUUID){let t=[o.uuid,this.path],e=(await on.messageBus.rpcCall(Jo.FOOTPRINT.GET,t)).message;if(o.ticket&&e!=null&&e.ticket&&(e==null?void 0:e.ticket)===o.ticket)return e}if(o.source){if(this.byVersion){let t=[o.source,o.version,this.path],e=(await on.messageBus.rpcCall(Jo.FOOTPRINT.GET_BY_SOURCE_VERSION,t)).message;return this.printLog&&e&&RO.sameVersionFootprint([o.display_title||o.title]),e}if(this.bySource){let t=[o.source,this.path],e=(await on.messageBus.rpcCall(Jo.FOOTPRINT.GET_LAST,t)).message;return this.printLog&&e&&RO.diffVersionFootprint({[e.display_title||e.title]:[e.uuid]}),e}}}async isRename(o){let t=[o.display_title||o.title,this.path];if((await on.messageBus.rpcCall(Jo.FOOTPRINT.IS_RENAME,t)).message)throw new ft("CREATE_FOOTPRINT","Library duplicate name");return{success:!0}}async start(){let o=await this.getOrigin();if(!o.success)throw new ft("CREATE_FOOTPRINT",o.message||"Creation of the footprint failed!");let t,e;if(this.origin){let r=await this.match(this.origin);if(r)t={success:!0,result:r};else{let i=await this.rename(this.origin,{path:this.path});if(!i.success)throw new ft("CREATE_FOOTPRINT",i.message||"Creation of the footprint failed!");e=this.origin}}return{success:!0,result:{respond:t,addData:e}}}},JNe=class extends hTe{async getOrigin(){var o;let{path:t,uuid:e,isProject:r}=this.data;if(mL(this.data)){let{override:i}=this.data;if(r){let{message:n}=await on.messageBus.rpcCall("/pro-mgr/hasProject",[t]);if(n){let s=[e,t],a=(await on.messageBus.rpcCall(Jo.SYMBOL.GET,s)).message;if(a){let l=Object.assign(a,{uuid:e,path:t,isProject:r});this.origin=await this.getTemplate(l,i)}else throw new ft("CREATE_SYMBOL_GET_ORIGIN","Symbol details data does not exist")}else throw new ft("CREATE_SYMBOL_GET_ORIGIN","Get project library data source Project is not open!")}else if(jp.getInstance().hasLib(t)){let n=jp.getInstance().getLib(t),s=await((o=n==null?void 0:n.symbol)==null?void 0:o.getTransformedDetail(e));if(s){let a=Object.assign(s,{uuid:e,path:t,isProject:r});this.origin=await this.getTemplate(a,i)}else throw new ft("CREATE_SYMBOL_GET_ORIGIN","Symbol details data does not exist")}else{let n={path:t,uuid:e},{message:s}=await on.messageBus.rpcCall(vO.COMPONENT.GET,n);if(s.success){let a=s.result,l=Object.assign(a,{uuid:e,path:t,isProject:r});this.origin=await this.getTemplate(l,i)}else throw new ft("CREATE_SYMBOL_GET_ORIGIN",s.message||"Symbol details data does not exist")}}else{let i=this.data.data,n=Object.assign(i,{isProject:r});this.origin=await this.onHandle(n)}return{success:!0,result:this.origin}}async renaming(o){let t=o.display_title||o.title,e=[t,this.path],r=(await on.messageBus.rpcCall(Jo.SYMBOL.TRY_RENAME,e)).message;return r&&(o.display_title=o.title=r),this.printLog&&t!==r&&RO.renamedSymbol([t]),{success:!0}}},dTe=class extends JNe{onHandle(o){return this.onAdd(o)}async matching(o){if(this.byUUID){let t=[o.uuid,this.path],e=(await on.messageBus.rpcCall(Jo.SYMBOL.GET,t)).message;if(o.ticket&&e!=null&&e.ticket&&(e==null?void 0:e.ticket)===o.ticket)return e}if(o.source){if(this.byVersion){let t=[o.source,o.version,this.path],e=(await on.messageBus.rpcCall(Jo.SYMBOL.GET_BY_SOURCE_VERSION,t)).message;return this.printLog&&e&&RO.sameVersionSymbol([o.display_title||o.title]),e}if(this.bySource){let t=[o.source,this.path],e=(await on.messageBus.rpcCall(Jo.SYMBOL.GET_LAST,t)).message;return this.printLog&&e&&RO.diffVersionSymbol({[e.display_title||e.title]:[e.uuid]}),e}}}async hack(o){let{docType:t}=o;return t===17}async isRename(o){let t=[o.display_title||o.title,this.path];if((await on.messageBus.rpcCall(Jo.SYMBOL.IS_RENAME,t)).message)throw new ft("CREATE_SYMBOL","Library duplicate name");return{success:!0}}async start(){let o=await this.getOrigin();if(!o.success)throw new ft("CREATE_SYMBOL",o.message||"Creation of the symbol failed!");let t,e;if(this.origin){let r=await this.match(this.origin);if(r)t={success:!0,result:r};else{let i=await this.rename(this.origin,{path:this.path});if(!i.success)throw new ft("CREATE_SYMBOL",i.message||"Creation of the symbol failed!");e=this.origin}}return{success:!0,result:{respond:t,addData:e}}}},pk=class{constructor(o){this.path=o}async check(){let{message:{hasPermission:o,errMsg:t}}=await on.messageBus.rpcCall("canAddLib",[this.path]);if(!o)throw new ft("CREATE_DEVICE_PERMISSIONS",t||"You don't have permission!");return{success:!0}}},jTt=class extends pk{constructor(o){let{path:t,data:e,options:r={}}=o,{matchKey:i=!0,byUUID:n=!0,byVersion:s=!0,bySource:a=!1,renameKey:l=!1}=r;super(t),this.addData={},this.result={device:null,symbol:null,footprint:null},this.data=e,this.matchKey=i,this.byUUID=n,this.byVersion=s,this.bySource=a,this.renameKey=l}async start(){var o,t,e,r,i,n,s,a,l,c,h,u;try{await this.check(),await this.onbefore();let d={path:this.path,matchKey:this.matchKey,byUUID:this.byUUID,byVersion:this.byVersion,bySource:this.bySource,renameKey:this.renameKey};if(this.data.device){let g={...d,data:this.data.device},y=await new YTt(g).start();if(y.success===!1)throw new ft("CREATE_DEVICE",y.message||"Creation of the device failed!");let{respond:b,addData:P}=y.result;if(this.result.device=b,P&&(this.addData.device=P),this.getBind(),!this.addData.device&&(o=this.result.device)!=null&&o.success&&(t=this.result.device)!=null&&t.result){let{attributes:T}=this.result.device.result,{Symbol:I,Footprint:C}=T,E=I&&(await on.messageBus.rpcCall(Jo.SYMBOL.GET,[I,this.path])).message,O=C&&(await on.messageBus.rpcCall(Jo.FOOTPRINT.GET,[C,this.path])).message;this.result.symbol={success:!0,result:E},this.result.footprint={success:!0,result:O}}}if(this.data.symbol){let g={...d,data:this.data.symbol},y=await new dTe(g).start();if(y.success===!1&&y.code===404){if(this.addData.device){this.addData.device.attributes.Symbol="";let{display_title:b,title:P}=this.addData.device,T=b||P;on.messageBus.publish("logI18nLogView",{type:"warn",msg:["The following devices lose bound symbol data!",T]})}}else{if(y.success===!1)throw new ft("CREATE_DEVICE",y.message||"Creation of the device failed!");{let{respond:b,addData:P}=y.result;if(this.result.symbol=b,P&&(this.addData.symbol=P),this.addData.device&&(e=this.result.symbol)!=null&&e.success&&(r=this.result.symbol)!=null&&r.result)this.addData.device.attributes.Symbol=this.result.symbol.result.uuid;else if((i=this.addData.device)!=null&&i.attributes.Symbol&&(n=this.result.symbol)!=null&&n.success&&!((s=this.result.symbol)!=null&&s.result)&&!this.addData.symbol){let T="The symbol associated with the device does not exist!";throw new ft("CREATE_DEVICE",T)}}}}if(this.data.footprint){let g={...d,data:this.data.footprint},y=await new uTe(g).start();if(y.success===!1&&y.code===404){if(this.addData.device){this.addData.device.attributes.Footprint="";let{display_title:b,title:P}=this.addData.device,T=b||P;on.messageBus.publish("logI18nLogView",{type:"warn",msg:["The following devices lose bound footprint data!",T]})}}else{if(y.success===!1)throw new ft("CREATE_DEVICE",y.message||"Creation of the device failed!");{let{respond:b,addData:P}=y.result;if(this.result.footprint=b,P&&(this.addData.footprint=P),this.addData.device&&(a=this.result.footprint)!=null&&a.success&&(l=this.result.footprint)!=null&&l.result)this.addData.device.attributes.Footprint=this.result.footprint.result.uuid;else if((c=this.addData.device)!=null&&c.attributes.Footprint&&(h=this.result.footprint)!=null&&h.success&&!((u=this.result.footprint)!=null&&u.result)&&!this.addData.footprint){let T="The footprint associated with the device does not exist!";throw new ft("CREATE_DEVICE",T)}}}}let p=await this.create();if(!p.success)throw new ft("CREATE_DEVICE",p.message||"Creation of the device failed!");let m=await this.updateBind();if(!m.success)throw new ft("CREATE_DEVICE",m.message||"Creation of the device failed!");if(!this.result)throw new ft("CREATE_DEVICE","Project library device added failed!");return await this.onsuccess(this.result),{success:!0,result:this.result}}catch(d){throw new ft("CREATE_DEVICE",d.message||"Creation of the device failed!")}}getBind(){if(this.addData.device){let{attributes:o}=this.addData.device,{Symbol:t,Footprint:e}=o,{isProject:r}=this.data.device;if(r===void 0)!this.data.symbol&&t&&(this.data.symbol={isProject:!0,path:this.path,uuid:t}),!this.data.footprint&&e&&(this.data.footprint={isProject:!0,path:this.path,uuid:e});else{let[i,n]=this.addData.device.source.split(fv);!this.data.symbol&&t&&(this.data.symbol={isProject:r,path:n,uuid:t}),!this.data.footprint&&e&&(this.data.footprint={isProject:r,path:n,uuid:e})}}}onbeforeCreate(){var o,t,e,r;if((o=this.addData.symbol)!=null&&o.docType&&!f7e((t=this.addData.symbol)==null?void 0:t.docType))throw new ft("CREATE_DEVICE","invalid symbol docType");if((e=this.addData.footprint)!=null&&e.docType&&((r=this.addData.footprint)==null?void 0:r.docType)!==4)throw new ft("CREATE_DEVICE","invalid footprint docType");if(this.addData.footprint&&(this.addData.footprint.isConnectDevice=!0),this.addData.device&&this.addData.device.attributes["3D Model"]){let i=this.addData.device.attributes["3D Model"];i.includes(fv)||(this.addData.device.attributes["3D Model"]=`${i}${fv}${this.addData.device.path}`)}return{success:!0}}async create(){if(Object.keys(this.addData).length>0){this.onbeforeCreate();let o=[this.addData,this.path],{message:t}=await on.messageBus.rpcCall(Jo.DEVICE.CREATE,o);if(!t.success)throw new ft("CREATE_DEVICE",t.message||"Creation of the device failed!");let{device:e,symbol:r,footprint:i}=t.result;e&&(this.result.device={success:!0,result:e}),r&&(this.result.symbol={success:!0,result:r}),i&&(this.result.footprint={success:!0,result:i})}return{success:!0}}async updateBind(){let{device:o,symbol:t,footprint:e}=this.result,r=o!=null&&o.success?o==null?void 0:o.result:null,i=t!=null&&t.success?t==null?void 0:t.result:null,n=e!=null&&e.success?e==null?void 0:e.result:null;if(r){let s=!1;if(i!=null&&i.uuid&&r.attributes.Symbol&&i.uuid!==r.attributes.Symbol&&(r.attributes.Symbol=i.uuid,s=!0),n!=null&&n.uuid&&r.attributes.Footprint&&n.uuid!==r.attributes.Footprint&&(r.attributes.Footprint=n.uuid,s=!0),s){let a=(await on.messageBus.rpcCall(Jo.DEVICE.UPDATE,[r,this.path])).message;this.result.device={success:!!a,result:a}}}return{success:!0}}async onbefore(){}async onsuccess(o){o.symbol&&!o.symbol.success&&(o.symbol.message=lL(o.symbol)||o.symbol.message),o.footprint&&!o.footprint.success&&(o.footprint.message=lL(o.footprint)||o.footprint.message),o.device&&!o.device.success&&(o.device.message=lL(o.device)||o.device.message)}},XTt=class extends KNe{constructor(o,t){super(t),this.uuid=o}onHandle(o){return this.onUpdate(o)}matching(o){throw new Error("Method not implemented.")}async isRename(o){return{success:!0}}async start(){let o=await this.getOrigin();if(!o.success)throw new ft("UPDATE_DEVICE",o.message||"Update of the device failed!");if(!this.origin)throw new ft("UPDATE_DEVICE","Device details data does not exist");let t=this.origin.display_title||this.origin.title,e=[{uuid:this.uuid,title:t},this.path];if((await on.messageBus.rpcCall(Jo.DEVICE.IS_CHANGE,e)).message){let r=await this.rename(this.origin,{path:this.path});if(!r.success)throw new ft("UPDATE_DEVICE",r.message||"Update of the device failed!")}return{success:!0,result:this.origin}}},qTt=class extends pk{constructor(o){let{path:t,uuid:e,data:r,options:i={}}=o,{matchKey:n=!0,byUUID:s=!0,bySource:a=!0,byVersion:l=!1,renameKey:c=!1}=i;super(t),this.addData={},this.map={},this.result={device:null,symbol:null,footprint:null,map:{}},this.uuid=e,this.data=r,this.matchKey=n,this.byUUID=s,this.bySource=a,this.byVersion=l,this.renameKey=c}async start(){var o,t,e,r,i,n,s,a,l,c;try{await this.check(),await this.onbefore();let h={path:this.path,matchKey:this.matchKey,byUUID:this.byUUID,bySource:this.bySource,byVersion:this.byVersion,renameKey:this.renameKey};if(this.data.device){let p={...h,data:this.data.device},m=await new XTt(this.uuid,p).start();if(m.success){let g=m.result;g&&(this.updateData=g),this.getBind()}else throw new ft("UPDATE_DEVICE",m.message||"Update of the device failed!")}if(this.data.symbol){let p={...h,data:this.data.symbol,renameKey:this.renameKey,printLog:!1},m=await new dTe(p).start();if(!m.success)throw new ft("UPDATE_DEVICE",m.message||"Update of the device failed!");let{respond:g,addData:y}=m.result;if(this.result.symbol=g,y&&(this.addData.symbol=y),this.updateData&&this.addData.symbol)this.updateData.attributes.Symbol=this.addData.symbol.uuid;else if(this.updateData&&(o=this.result.symbol)!=null&&o.success&&this.result.symbol.result)this.updateData.attributes.Symbol=this.result.symbol.result.uuid;else if((t=this.updateData)!=null&&t.attributes.Symbol&&(e=this.result.symbol)!=null&&e.success&&!((r=this.result.symbol)!=null&&r.result)&&!this.addData.symbol){let b="The symbol associated with the device does not exist!";throw new ft("UPDATE_DEVICE",b)}}if(this.data.footprint){let p={...h,data:this.data.footprint,renameKey:this.renameKey,printLog:!1},m=await new uTe(p).start();if(!m.success)throw new ft("UPDATE_DEVICE",m.message||"Update of the device failed!");let{respond:g,addData:y}=m.result;if(this.result.footprint=g,y&&(this.addData.footprint=y),this.updateData&&this.addData.footprint)this.updateData.attributes.Footprint=this.addData.footprint.uuid;else if(this.updateData&&(i=this.result.footprint)!=null&&i.success&&this.result.footprint.result)this.updateData.attributes.Footprint=this.result.footprint.result.uuid;else if((n=this.updateData)!=null&&n.attributes.Footprint&&(s=this.result.footprint)!=null&&s.success&&!((a=this.result.footprint)!=null&&a.result)&&!this.addData.footprint){let b="The footprint associated with the device does not exist!";throw new ft("UPDATE_DEVICE",b)}}let u=await this.create();if(!u.success)throw new ft("UPDATE_DEVICE",u.message||"Update of the device failed!");let d=await this.update();if(!d.success)throw new ft("UPDATE_DEVICE",d.message||"Update of the device failed!");if(!this.result){let p={text:"Failed to update project library device {title}!",args:{title:((l=this.updateData)==null?void 0:l.display_title)||((c=this.updateData)==null?void 0:c.title)||""}};throw new ft("UPDATE_DEVICE",p)}return await this.onsuccess(this.result),{success:!0,result:Object.assign(this.result,{map:this.map})}}catch(h){throw new ft("UPDATE_DEVICE",h.message||"Update of the device failed!")}}getBind(){if(this.updateData){let{attributes:o}=this.updateData,{Symbol:t,Footprint:e}=o||{},{isProject:r}=this.data.device;if(r===void 0)!this.data.symbol&&t&&(this.data.symbol={isProject:!0,path:this.path,uuid:t}),!this.data.footprint&&e&&(this.data.footprint={isProject:!0,path:this.path,uuid:e});else{let[i,n]=this.updateData.source.split(fv);!this.data.symbol&&t&&(this.data.symbol={isProject:r,path:n,uuid:t}),!this.data.footprint&&e&&(this.data.footprint={isProject:r,path:n,uuid:e})}}}onbeforeCreate(){var o,t,e,r;if((o=this.addData.symbol)!=null&&o.docType&&!f7e((t=this.addData.symbol)==null?void 0:t.docType))throw new ft("UPDATE_DEVICE","invalid symbol docType");if((e=this.addData.footprint)!=null&&e.docType&&((r=this.addData.footprint)==null?void 0:r.docType)!==4)throw new ft("UPDATE_DEVICE","invalid footprint docType");return this.addData.footprint&&(this.addData.footprint.isConnectDevice=!0),{success:!0}}async create(){let{symbol:o,footprint:t}=this.addData;if(this.onbeforeCreate(),o){let e=(await on.messageBus.rpcCall(Jo.SYMBOL.CREATE,[o,this.path])).message;if(!e.success)throw new ft("UPDATE_DEVICE",e.message||"Project library symbol added failed!");let r=e.result;this.result.symbol={success:!0,result:r},this.map[o.uuid]=r.uuid}if(t){let e=(await on.messageBus.rpcCall(Jo.FOOTPRINT.CREATE,[t,this.path])).message;if(!e.success)throw new ft("UPDATE_DEVICE",e.message||"Project library footprint added failed!");let r=e.result;this.result.footprint={success:!0,result:r},this.map[t.uuid]=r.uuid}return{success:!0}}async update(){var o,t,e;let r=this.updateData;if(r){(o=this.result.symbol)!=null&&o.success&&this.result.symbol.result&&(r.attributes.Symbol=(t=this.result.symbol)==null?void 0:t.result.uuid),(e=this.result.footprint)!=null&&e.success&&this.result.footprint.result&&(r.attributes.Footprint=this.result.footprint.result.uuid);let i=[{...r,uuid:this.uuid,keepVersion:this.keepVersion},this.path],n=(await on.messageBus.rpcCall(Jo.DEVICE.UPDATE,i)).message;if(!n){let s=r.display_title||r.title||"";throw new ft("UPDATE_DEVICE",`Update of the device failed! title: ${s}`)}this.result.device={success:!0,result:n}}return{success:!0}}async onbefore(){mL(this.data.device)?(this.onlyIdentity=!0,this.keepVersion=!0):(this.onlyIdentity=!1,this.keepVersion=!1)}async onsuccess(o){o.symbol&&!o.symbol.success&&(o.symbol.message=lL(o.symbol)||o.symbol.message),o.footprint&&!o.footprint.success&&(o.footprint.message=lL(o.footprint)||o.footprint.message),o.device&&!o.device.success&&(o.device.message=lL(o.device)||o.device.message)}},$Tt=class extends pk{constructor(o){let{path:t,data:e,options:r={}}=o,{matchKey:i=!0,byUUID:n=!0,byVersion:s=!0,bySource:a=!1,renameKey:l=!1}=r;super(t),this.data=e,this.byUUID=n,this.byVersion=s,this.bySource=a,this.renameKey=l,this.matchKey=i}async start(){await this.check(),await this.onbefore();let o={path:this.path,byUUID:this.byUUID,byVersion:this.byVersion,bySource:this.bySource,renameKey:this.renameKey,matchKey:this.matchKey},t=await new dTe({...o,data:this.data}).start();if(!t.success)throw new ft("CREATE_SYMBOL",t.message||"Project library symbol added failed!");let{addData:e,respond:r}=t.result;if(r&&!r.success)throw new ft("CREATE_SYMBOL",r.message||"Project library symbol added failed!");if(r&&r.success)this.result=r.result;else if(e){let i=(await on.messageBus.rpcCall(Jo.SYMBOL.CREATE,[e,this.path])).message;if(!i.success)throw new ft("CREATE_SYMBOL","Project library symbol added failed!");this.result=i.result}if(!this.result)throw new ft("CREATE_SYMBOL","Project library symbol added failed!");return await this.onsuccess(this.result),{success:!0,result:this.result}}async onbefore(){}async onsuccess(o){}},KTt=class extends pk{constructor(o){let{path:t,data:e,options:r={}}=o,{matchKey:i=!0,byUUID:n=!0,byVersion:s=!0,bySource:a=!1,renameKey:l=!1}=r;super(t),this.data=e,this.byUUID=n,this.byVersion=s,this.bySource=a,this.renameKey=l,this.matchKey=i}async start(){await this.check(),await this.onbefore();let o={path:this.path,byUUID:this.byUUID,byVersion:this.byVersion,bySource:this.bySource,renameKey:this.renameKey,matchKey:this.matchKey},t=await new uTe({...o,data:this.data}).start();if(!t.success)throw new ft("CREATE_FOOTPRINT",t.message||"Creation of the footprint failed!");let{addData:e,respond:r}=t.result;if(r&&!r.success)throw new ft("CREATE_FOOTPRINT",r.message||"Creation of the footprint failed!");if(r&&r.success)this.result=r.result;else if(e){let i=(await on.messageBus.rpcCall(Jo.FOOTPRINT.CREATE,[e,this.path])).message;if(!i.success)throw new ft("CREATE_FOOTPRINT","Project library footprint added failed!");this.result=i.result}if(!this.result)throw new ft("CREATE_FOOTPRINT","Project library footprint added failed!");return await this.onsuccess(this.result),{success:!0,result:this.result}}async onbefore(){}async onsuccess(o){}},ZTt=class extends JNe{constructor(o,t){super(t),this.uuid=o}onHandle(o){return this.onUpdate(o)}matching(o){throw new Error("Method not implemented.")}async hack(o){let{docType:t}=o;return t===17}async isRename(o){return{success:!0}}async start(){let o=await this.getOrigin();if(!o.success)throw new ft("UPDATE_SYMBOL",o.message||"Update of the symbol failed!");if(!this.origin)throw new ft("UPDATE_SYMBOL","Symbol details data does not exist");let t=this.origin.display_title||this.origin.title,e=[{uuid:this.uuid,title:t},this.path];if((await on.messageBus.rpcCall(Jo.SYMBOL.IS_CHANGE,e)).message){let r=await this.rename(this.origin,{path:this.path});if(!r.success)throw new ft("UPDATE_SYMBOL",r.message||"Update of the symbol failed!")}return{success:!0,result:this.origin}}},JTt=class extends pk{constructor(o){let{path:t,uuid:e,data:r,options:i={}}=o,{matchKey:n=!0,byUUID:s=!0,bySource:a=!0,byVersion:l=!1,renameKey:c=!1}=i;super(t),this.uuid=e,this.data=r,this.matchKey=n,this.byUUID=s,this.bySource=a,this.byVersion=l,this.renameKey=c}async start(){var o,t;await this.check(),await this.onbefore();let e={path:this.path,matchKey:this.matchKey,byUUID:this.byUUID,bySource:this.bySource,byVersion:this.byVersion,renameKey:this.renameKey,data:this.data},r=await new ZTt(this.uuid,e).start();if(!r.success)throw new ft("UPDATE_SYMBOL",r.message||"Update of the symbol failed!");this.updateData=r.result;let i={uuid:this.uuid,data:this.updateData,overwriteCanvas:this.onlyIdentity,keepVersion:this.keepVersion},n=(await on.messageBus.rpcCall(Jo.SYMBOL.COVER,[i,this.path])).message;if(!n.success)throw new ft("UPDATE_SYMBOL",n.message||"Update of the symbol failed!");if(this.result=n.result,!this.result){let s=((o=this.updateData)==null?void 0:o.display_title)||((t=this.updateData)==null?void 0:t.title)||"",a="Failed to update project library symbol {title}!";throw new ft("UPDATE_SYMBOL",{text:a,args:{title:s}})}return await this.onsuccess(this.result),{success:!0,result:this.result}}async onbefore(){mL(this.data)?(this.onlyIdentity=!0,this.keepVersion=!0):(this.onlyIdentity=!1,this.keepVersion=!1)}async onsuccess(o){}},QTt=class extends ZNe{constructor(o,t){super(t),this.uuid=o}onHandle(o){return this.onUpdate(o)}matching(o){throw new Error("Method not implemented.")}async isRename(o){return{success:!0}}async start(){let o=await this.getOrigin();if(!o.success)throw new ft("UPDATE_FOOTPRINT",o.message||"Update of the footprint failed!");if(!this.origin)throw new ft("UPDATE_FOOTPRINT","Footprint details data does not exist");let t=this.origin.display_title||this.origin.title,e=[{uuid:this.uuid,title:t},this.path];if((await on.messageBus.rpcCall(Jo.FOOTPRINT.IS_CHANGE,e)).message){let r=await this.rename(this.origin,{path:this.path});if(!r.success)throw new ft("UPDATE_FOOTPRINT",r.message||"Update of the footprint failed!")}return{success:!0,result:this.origin}}},eIt=class extends pk{constructor(o){let{path:t,uuid:e,data:r,options:i={}}=o,{matchKey:n=!0,byUUID:s=!0,bySource:a=!0,byVersion:l=!1,renameKey:c=!1}=i;super(t),this.uuid=e,this.data=r,this.matchKey=n,this.byUUID=s,this.bySource=a,this.byVersion=l,this.renameKey=c}async start(){var o,t;await this.check(),await this.onbefore();let e={path:this.path,matchKey:this.matchKey,byUUID:this.byUUID,bySource:this.bySource,byVersion:this.byVersion,renameKey:this.renameKey,data:this.data},r=await new QTt(this.uuid,e).start();if(!r.success)throw new ft("UPDATE_FOOTPRINT",r.message||"Update of the footprint failed!");this.updateData=r.result;let i={uuid:this.uuid,data:this.updateData,overwriteCanvas:this.onlyIdentity,keepVersion:this.keepVersion},n=(await on.messageBus.rpcCall(Jo.FOOTPRINT.COVER,[i,this.path])).message;if(!n.success)throw new ft("UPDATE_FOOTPRINT",n.message||"Update of the footprint failed!");if(this.result=n.result,!this.result){let s={text:"Failed to update project library footprint {title}!",args:{title:((o=this.updateData)==null?void 0:o.display_title)||((t=this.updateData)==null?void 0:t.title)||""}};throw new ft("UPDATE_FOOTPRINT",s)}return await this.onsuccess(this.result),{success:!0,result:this.result}}async onbefore(){mL(this.data)?(this.onlyIdentity=!0,this.keepVersion=!0):(this.onlyIdentity=!1,this.keepVersion=!1)}async onsuccess(o){}},tIt=class extends oTe{async getDevice(o){let t=[o.uuid,o.path],{message:e}=await on.messageBus.rpcCall(Jo.DEVICE.GET,t);if(!e)throw new ft("GET_DEVICE","Device details data does not exist");return TQ(o.path,e)}async getDeviceAttributesKeys(o){let{message:t}=await on.messageBus.rpcCall(Jo.DEVICE.GET_ATTRIBUTES_KEYS,o);if(!t.success)throw new ft("GET_DEVICE_ATTRIBUTES_KEYS",t.message);return t.result}async getDeviceAttributesValues(o){let{message:t}=await on.messageBus.rpcCall(Jo.DEVICE.GET_ATTRIBUTES_VALUES,o);if(!t.success)throw new ft("GET_DEVICE_ATTRIBUTES_VALUES",t.message);return t.result}async getSymbol(o){let t=[o.uuid,o.path],{message:e}=await on.messageBus.rpcCall(Jo.SYMBOL.GET,t);if(!e)throw new ft("GET_SYMBOL","Symbol details data does not exist");return rPe(o.path,e)}async getFootprint(o){let t=[o.uuid,o.path],{message:e}=await on.messageBus.rpcCall(Jo.FOOTPRINT.GET,t);if(!e)throw new ft("GET_FOOTPRINT","Footprint details data does not exist");return iPe(o.path,e)}async createDevice(o){let{path:t,device:e,symbol:r,footprint:i}=o,n={path:t,data:{device:e,symbol:r,footprint:i}},s=await new jTt(n).start();if(!s.success)throw new ft("CREATE_DEVICE",s.message);let a=s.result.device;if(!(a!=null&&a.success))throw new ft("CREATE_DEVICE",a==null?void 0:a.message);let l=a.result;return TQ(o.path,l)}async createSymbol(o){let{path:t,symbol:e}=o,r={path:t,data:e},i=await new $Tt(r).start();if(!i.success)throw new ft("CREATE_SYMBOL",i.message);let n=i.result;return rPe(o.path,n)}async createFootprint(o){let{path:t,footprint:e}=o,r={path:t,data:e},i=await new KTt(r).start();if(!i.success)throw new ft("CREATE_FOOTPRINT",i.message);let n=i.result;return iPe(o.path,n)}async updateDevice(o){let{uuid:t,path:e,device:r,symbol:i,footprint:n}=o,s={path:e,uuid:t,data:{device:r,symbol:i,footprint:n}},a=await new qTt(s).start();if(!a.success)throw new ft("UPDATE_DEVICE",a.message);let l=a.result.device;if(!(l!=null&&l.success))throw new ft("CREATE_DEVICE",l==null?void 0:l.message);let c=l.result;return TQ(o.path,c)}async updateDeviceAttributes(o){let t=(await on.messageBus.rpcCall(Jo.DEVICE.UPDATE,[o,o.path])).message;if(!t)throw new ft("UPDATE_DEVICE_ATTRIBUTES",t.message);return TQ(o.path,t)}async updateSymbol(o){let{uuid:t,path:e,symbol:r}=o,i={path:e,uuid:t,data:r},n=await new JTt(i).start();if(!n.success)throw new ft("UPDATE_SYMBOL",n.message);let s=n.result;return rPe(o.path,s)}async updateFootprint(o){let{uuid:t,path:e,footprint:r}=o,i={path:e,uuid:t,data:r},n=await new eIt(i).start();if(!n.success)throw new ft("UPDATE_FOOTPRINT",n.message);let s=n.result;return iPe(o.path,s)}async deleteDevice(o){if(!(await on.messageBus.rpcCall(Jo.DEVICE.DEL,[o.uuid,o.path])).message)throw new ft("DELETE_DEVICE","delete failed!")}async deleteSymbol(o){if(!(await on.messageBus.rpcCall(Jo.SYMBOL.DEL,[o.uuid,o.path])).message)throw new ft("DELETE_SYMBOL","delete failed!")}async deleteFootprint(o){if(!(await on.messageBus.rpcCall(Jo.FOOTPRINT.DEL,[o.uuid,o.path])).message)throw new ft("DELETE_FOOTPRINT","delete failed!")}async getDeviceList(o){let t=(await on.messageBus.rpcCall(Jo.DEVICE.GET_LIST,o)).message;if(!t.success)throw new ft("GET_DEVICE_LIST",t.message);return t.result}async getDeviceSearchList(o){let t=(await on.messageBus.rpcCall(Jo.DEVICE.GET_LIST,o)).message;if(!t.success)throw new ft("GET_DEVICE_LIST",t.message);return t.result}async getSymbolList(o){let t=(await on.messageBus.rpcCall(Jo.SYMBOL.GET_LIST,o)).message;if(!t.success)throw new ft("GET_SYMBOL_LIST",t.message);return t.result}async getSymbolSearchList(o){let t=(await on.messageBus.rpcCall(Jo.SYMBOL.GET_LIST,o)).message;if(!t.success)throw new ft("GET_SYMBOL_LIST",t.message);return t.result}async getFootprintList(o){let t=(await on.messageBus.rpcCall(Jo.FOOTPRINT.GET_LIST,o)).message;if(!t.success)throw new ft("GET_FOOTPRINT_LIST",t.message);return t.result}async getFootprintSearchList(o){let t=(await on.messageBus.rpcCall(Jo.FOOTPRINT.GET_LIST,o)).message;if(!t.success)throw new ft("GET_FOOTPRINT_LIST",t.message);return t.result}},rIt=class extends oTe{constructor(){super(...arguments),this._normalErrorMsg="Request Error.",this._extendLibManager=jp.getInstance()}async getDevice(o){var t;let e=await((t=this._extendLibManager.getLib(o.path))==null?void 0:t.getTransformedDetailInTab("device",o.uuid,o.path));if(e)return e;throw new ft("GET_DEVICE",this._normalErrorMsg)}async getSymbol(o){var t;let e=await((t=this._extendLibManager.getLib(o.path))==null?void 0:t.getTransformedDetailInTab("symbol",o.uuid,o.path));if(e)return e;throw new ft("GET_SYMBOL",this._normalErrorMsg)}async getFootprint(o){var t;let e=await((t=this._extendLibManager.getLib(o.path))==null?void 0:t.getTransformedDetailInTab("footprint",o.uuid,o.path));if(e)return e;throw new ft("GET_FOOTPRINT",this._normalErrorMsg)}async getModel3D(o){var t;let e=await((t=this._extendLibManager.getLib(o.path))==null?void 0:t.getTransformedDetailInTab("model3D",o.uuid,o.path));if(e)return e;throw new ft("GET_D3MODEL",this._normalErrorMsg)}async getDeviceList(o){var t,e,r,i,n,s,a,l;let c=await((l=this._extendLibManager.getLib(o.path))==null?void 0:l.getTransformedListInTab("device",{query:{attributes:(e=(t=o.query)==null?void 0:t.attributes)!=null?e:{},symbolType:(r=o.query)==null?void 0:r.symbol_type,classification:{primaryClassificationUuid:(n=(i=o.tags)==null?void 0:i[0])!=null?n:"",secondaryClassificationUuid:(a=(s=o.tags)==null?void 0:s[1])!=null?a:""}},page:o.page,pageSize:o.pageSize}));if(c)return c;throw new ft("GET_DEVICE_LIST",this._normalErrorMsg)}async getSymbolList(o){var t,e,r,i,n,s;let a=await((s=this._extendLibManager.getLib(o.path))==null?void 0:s.getTransformedListInTab("symbol",{query:{symbolType:(t=o.docType)==null?void 0:t[0],classification:{primaryClassificationUuid:(r=(e=o.tags)==null?void 0:e[0])!=null?r:"",secondaryClassificationUuid:(n=(i=o.tags)==null?void 0:i[1])!=null?n:""}},page:o.page,pageSize:o.pageSize}));if(a)return a;throw new ft("GET_SYMBOL_LIST",this._normalErrorMsg)}async getFootprintList(o){var t,e,r,i,n;let s=await((n=this._extendLibManager.getLib(o.path))==null?void 0:n.getTransformedListInTab("footprint",{query:{classification:{primaryClassificationUuid:(e=(t=o.tags)==null?void 0:t[0])!=null?e:"",secondaryClassificationUuid:(i=(r=o.tags)==null?void 0:r[1])!=null?i:""}},page:o.page,pageSize:o.pageSize}));if(s)return s;throw new ft("GET_FOOTPRINT_LIST",this._normalErrorMsg)}async getD3ModelSearchList1(o){var t,e,r;let{path:i,wd:n,query:s,tags:a,page:l,pageSize:c}=o,h=await((r=this._extendLibManager.getLib(i))==null?void 0:r.getTransformedListInTab("model3D",{query:{wd:n,classification:{primaryClassificationUuid:(t=a==null?void 0:a[0])!=null?t:"",secondaryClassificationUuid:(e=a==null?void 0:a[1])!=null?e:""}},page:l,pageSize:c}));if(h)return{...h,facets:{[i]:h.count}};throw new ft("GET_D3MODEL_LIST",this._normalErrorMsg)}async getD3ModelSearchList2(o){var t;let{path:e,titles:r}=o,i=await((t=this._extendLibManager.getLib(e))==null?void 0:t.getTransformedListInTab("model3D",{query:{listByTitles:r},page:1,pageSize:1e8}));if(i)return i.lists.reduce((n,s)=>((n[s.display_title]||(n[s.display_title]=[])).push(s),n),{});throw new ft("GET_D3MODEL_LIST",this._normalErrorMsg)}async getD3ModelSearchList3(o){var t;let{path:e,uuids:r}=o,i=await((t=this._extendLibManager.getLib(e))==null?void 0:t.getTransformedListInTab("model3D",{query:{listByUuids:r},page:1,pageSize:1e8}));if(i)return i.lists;throw new ft("GET_D3MODEL_LIST",this._normalErrorMsg)}async getD3ModelSearchList(o){return o.titles?await this.getD3ModelSearchList2(o):o.uuids?await this.getD3ModelSearchList3(o):await this.getD3ModelSearchList1(o)}async getDeviceSearchList1(o){var t,e,r,i;let{path:n,wd:s,query:a,tags:l,page:c,pageSize:h}=o,u=await((i=this._extendLibManager.getLib(n))==null?void 0:i.getTransformedListInTab("device",{query:{wd:s,attributes:(t=a==null?void 0:a.attributes)!=null?t:{},symbolType:a==null?void 0:a.symbol_type,classification:{primaryClassificationUuid:(e=l==null?void 0:l[0])!=null?e:"",secondaryClassificationUuid:(r=l==null?void 0:l[1])!=null?r:""}},page:c,pageSize:h}));if(u)return{...u,facets:{[n]:u.count}};throw new ft("GET_DEVICE_LIST",this._normalErrorMsg)}async getDeviceSearchList2(o){var t;let{path:e,titles:r}=o,i=await((t=this._extendLibManager.getLib(e))==null?void 0:t.getTransformedListInTab("device",{query:{listByTitles:r},page:1,pageSize:1e8}));if(i)return i.lists.reduce((n,s)=>((n[s.display_title]||(n[s.display_title]=[])).push(s),n),{});throw new ft("GET_DEVICE_LIST",this._normalErrorMsg)}async getDeviceSearchList3(o){var t;let{path:e,uuids:r}=o,i=await((t=this._extendLibManager.getLib(e))==null?void 0:t.getTransformedListInTab("device",{query:{listByUuids:r},page:1,pageSize:1e8}));if(i)return i.lists;throw new ft("GET_DEVICE_LIST",this._normalErrorMsg)}async getDeviceSearchList(o){return o.titles?await this.getDeviceSearchList2(o):o.uuids?await this.getDeviceSearchList3(o):await this.getDeviceSearchList1(o)}async getSymbolSearchList1(o){var t,e,r,i;let{path:n,wd:s,query:a,tags:l,page:c,pageSize:h}=o,u=await((i=this._extendLibManager.getLib(n))==null?void 0:i.getTransformedListInTab("symbol",{query:{wd:s,symbolType:(t=o.docType)==null?void 0:t[0],classification:{primaryClassificationUuid:(e=l==null?void 0:l[0])!=null?e:"",secondaryClassificationUuid:(r=l==null?void 0:l[1])!=null?r:""}},page:c,pageSize:h}));if(u)return{...u,facets:{[n]:u.count}};throw new ft("GET_DEVICE_LIST",this._normalErrorMsg)}async getSymbolSearchList2(o){var t;let{path:e,titles:r}=o,i=await((t=this._extendLibManager.getLib(e))==null?void 0:t.getTransformedListInTab("symbol",{query:{listByTitles:r},page:1,pageSize:1e8}));if(i)return i.lists.reduce((n,s)=>((n[s.display_title]||(n[s.display_title]=[])).push(s),n),{});throw new ft("GET_DEVICE_LIST",this._normalErrorMsg)}async getSymbolSearchList3(o){var t;let{path:e,uuids:r}=o,i=await((t=this._extendLibManager.getLib(e))==null?void 0:t.getTransformedListInTab("symbol",{query:{listByUuids:r},page:1,pageSize:1e8}));if(i)return i.lists;throw new ft("GET_DEVICE_LIST",this._normalErrorMsg)}async getSymbolSearchList(o){return o.titles?await this.getSymbolSearchList2(o):o.uuids?await this.getSymbolSearchList3(o):await this.getSymbolSearchList1(o)}async getFootprintSearchList1(o){var t,e,r;let{path:i,wd:n,query:s,tags:a,page:l,pageSize:c}=o,h=await((r=this._extendLibManager.getLib(i))==null?void 0:r.getTransformedListInTab("footprint",{query:{wd:n,classification:{primaryClassificationUuid:(t=a==null?void 0:a[0])!=null?t:"",secondaryClassificationUuid:(e=a==null?void 0:a[1])!=null?e:""}},page:l,pageSize:c}));if(h)return{...h,facets:{[i]:h.count}};throw new ft("GET_DEVICE_LIST",this._normalErrorMsg)}async getFootprintSearchList2(o){var t;let{path:e,titles:r}=o,i=await((t=this._extendLibManager.getLib(e))==null?void 0:t.getTransformedListInTab("footprint",{query:{listByTitles:r},page:1,pageSize:1e8}));if(i)return i.lists.reduce((n,s)=>((n[s.display_title]||(n[s.display_title]=[])).push(s),n),{});throw new ft("GET_DEVICE_LIST",this._normalErrorMsg)}async getFootprintSearchList3(o){var t;let{path:e,uuids:r}=o,i=await((t=this._extendLibManager.getLib(e))==null?void 0:t.getTransformedListInTab("footprint",{query:{listByUuids:r},page:1,pageSize:1e8}));if(i)return i.lists;throw new ft("GET_DEVICE_LIST",this._normalErrorMsg)}async getFootprintSearchList(o){return o.titles?await this.getFootprintSearchList2(o):o.uuids?await this.getFootprintSearchList3(o):await this.getFootprintSearchList1(o)}createDevice(o){throw new ft("CREATE_DEVICE","Not Supported.")}createSymbol(o){throw new ft("GET_SYMBOL","Not Supported.")}createFootprint(o){throw new ft("CREATE_FOOTPRINT","Not Supported.")}updateDevice(o){throw new ft("UPDATE_DEVICE","Not Supported.")}updateSymbol(o){throw new ft("GET_SYMBOL","Not Supported.")}updateFootprint(o){throw new ft("GET_SYMBOL","Not Supported.")}deleteDevice(o){throw new ft("GET_SYMBOL","Not Supported.")}deleteSymbol(o){throw new ft("GET_SYMBOL","Not Supported.")}deleteFootprint(o){throw new ft("GET_SYMBOL","Not Supported.")}},iIt=(o=>(o[o.CBB=1]="CBB",o[o.SYMBOL=2]="SYMBOL",o[o.DEVICE=3]="DEVICE",o[o.FOOTPRINT=4]="FOOTPRINT",o[o.MODEL3D=5]="MODEL3D",o[o.MODELSIM=6]="MODELSIM",o[o.PANEL_LIB=29]="PANEL_LIB",o))(iIt||{}),nIt=["title","description","tags","images"],Xs=new HTt,z0=new tIt,zC=new rIt,Rh=class{static getDevice(o){return jp.getInstance().hasLib(o.path)?zC.getDevice(o):o.isProject?z0.getDevice(o):Xs.getDevice(o)}static getDeviceAttributesKeys(o){return o.isProject?z0.getDeviceAttributesKeys(o):Xs.getDeviceAttributesKeys(o)}static getDeviceAttributesValues(o){return o.isProject?z0.getDeviceAttributesValues(o):Xs.getDeviceAttributesValues(o)}static getSymbol(o){return jp.getInstance().hasLib(o.path)?zC.getSymbol(o):o.isProject?z0.getSymbol(o):Xs.getSymbol(o)}static getFootprint(o){return jp.getInstance().hasLib(o.path)?zC.getFootprint(o):o.isProject?z0.getFootprint(o):Xs.getFootprint(o)}static getPanelLib(o){if(o.isProject)throw new ft("GET_PANEL_LIB","Api call error!");return Xs.getPanelLib(o)}static getD3Model(o){return jp.getInstance().hasLib(o.path)?zC.getModel3D(o):o.isProject?null:Xs.getD3Model(o)}static getSimModel(o){if(o.isProject)throw new ft("GET_SIM_MODEL","Api call error!");return Xs.getSimModel(o)}static getDeviceList(o){return jp.getInstance().hasLib(o.path)?zC.getDeviceList(o):o.isProject?z0.getDeviceList(o):Xs.getDeviceList(o)}static getSymbolList(o){return jp.getInstance().hasLib(o.path)?zC.getSymbolList(o):o.isProject?z0.getSymbolList(o):Xs.getSymbolList(o)}static getFootprintList(o){return jp.getInstance().hasLib(o.path)?zC.getFootprintList(o):o.isProject?z0.getFootprintList(o):Xs.getFootprintList(o)}static getPanelLibList(o){if(o.isProject)throw new ft("GET_D3MODEL_LIST","Api call error!");return Xs.getPanelLibList(o)}static getD3ModelList(o){if(o.isProject)throw new ft("GET_D3MODEL_LIST","Api call error!");return Xs.getD3ModelList(o)}static getSimModelList(o){if(o.isProject)throw new ft("GET_SIM_MODEL_LIST","Api call error!");return Xs.getSimModelList(o)}static getDeviceSearchList(o){return jp.getInstance().hasLib(o.path)?zC.getDeviceSearchList(o):o.isProject?z0.getDeviceSearchList(o):Xs.getDeviceSearchList(o)}static getSymbolSearchList(o){return jp.getInstance().hasLib(o.path)?zC.getSymbolSearchList(o):o.isProject?z0.getSymbolSearchList(o):Xs.getSymbolSearchList(o)}static getFootprintSearchList(o){return jp.getInstance().hasLib(o.path)?zC.getFootprintSearchList(o):o.isProject?z0.getFootprintSearchList(o):Xs.getFootprintSearchList(o)}static getPanelLibSearchList(o){if(o.isProject)throw new ft("GET_PANEL_LIB_SEARCH_LIST","Api call error!");return Xs.getPanelLibSearchList(o)}static getD3ModelSearchList(o){if(o.isProject)throw new ft("GET_D3MODEL_SEARCH_LIST","Api call error!");return jp.getInstance().hasLib(o.path)?zC.getD3ModelSearchList(o):Xs.getD3ModelSearchList(o)}static getSimModelSearchList(o){if(o.isProject)throw new ft("GET_SIM_MODEL_SEARCH_LIST","Api call error!");return Xs.getSimModelSearchList(o)}static createDevice(o){return o.isProject?z0.createDevice(o):Xs.createDevice(o)}static createSymbol(o){return o.isProject?z0.createSymbol(o):Xs.createSymbol(o)}static createFootprint(o){return o.isProject?z0.createFootprint(o):Xs.createFootprint(o)}static createD3Model(o){return o.isProject?null:Xs.createD3Model(o)}static createPanelLib(o){if(o.isProject)throw new ft("CREATE_PANEL_LIB","Api call error!");return Xs.createPanelLib(o)}static createSimModel(o){if(o.isProject)throw new ft("CREATE_SIM_MODEL","Api call error!");return Xs.createSimModel(o)}static updateDevice(o){return o.isProject?z0.updateDevice(o):Xs.updateDevice(o)}static updateDeviceAttributes(o){return o.isProject?z0.updateDeviceAttributes(o):Xs.updateDeviceAttributes(o)}static updateSymbol(o){return o.isProject?z0.updateSymbol(o):Xs.updateSymbol(o)}static updateFootprint(o){return o.isProject?z0.updateFootprint(o):Xs.updateFootprint(o)}static updatePanelLib(o){if(o.isProject)throw new ft("UPDATE_PANEL_LIB","Api call error!");return Xs.updatePanelLib(o)}static updateD3Model(o){if(o.isProject)throw new ft("UPDATE_D3MODEL","Api call error!");return Xs.updateD3Model(o)}static updateSimModel(o){if(o.isProject)throw new ft("UPDATE_SIM_MODEL","Api call error!");return Xs.updateSimModel(o)}static deleteDevice(o){return o.isProject?z0.deleteDevice(o):Xs.deleteDevice(o)}static deleteSymbol(o){return o.isProject?z0.deleteSymbol(o):Xs.deleteSymbol(o)}static deleteFootprint(o){return o.isProject?z0.deleteFootprint(o):Xs.deleteFootprint(o)}static deletePanelLib(o){if(o.isProject)throw new ft("DELETE_PANEL_LIB","Api call error!");return Xs.deletePanelLib(o)}static deleteSimModel(o){if(o.isProject)throw new ft("DELETE_SIM_MODEL","Api call error!");return Xs.deleteSimModel(o)}static deleteD3Model(o){if(o.isProject)throw new ft("DELETE_3DMODEL","Api call error!");return Xs.delete3DModel(o)}static starDevice(o){if(o.isProject)throw new ft("STAR_DEVICE","Api call error!");return Xs.starDevice(o)}static starSymbol(o){if(o.isProject)throw new ft("STAR_SYMBOL","Api call error!");return Xs.starSymbol(o)}static starFootprint(o){if(o.isProject)throw new ft("STAR_FOOTPRINT","Api call error!");return Xs.starFootprint(o)}static starPanelLib(o){if(o.isProject)throw new ft("STAR_PANEL_LIB","Api call error!");return Xs.starPanelLib(o)}static unstarDevice(o){if(o.isProject)throw new ft("UNSTAR_DEVICE","Api call error!");return Xs.unstarDevice(o)}static unstarSymbol(o){if(o.isProject)throw new ft("UNSTAR_SYMBOL","Api call error!");return Xs.unstarSymbol(o)}static unstarFootprint(o){if(o.isProject)throw new ft("UNSTAR_FOOTPRINT","Api call error!");return Xs.unstarFootprint(o)}static unstarPanelLib(o){if(o.isProject)throw new ft("UNSTAR_PANEL_LIB","Api call error!");return Xs.unstarPanelLib(o)}};async function QNe(o,t,e,r={}){r.eachProcessHook&&r.eachProcessHook(.01);let i=e||Ci.SYSTEMLIB_UUID,n=null;if(t)try{n=await Rh.getDevice({isProject:o,path:e,uuid:t})}catch(h){console.warn(h)}r.eachProcessHook&&r.eachProcessHook(.25);let s=null,a={Footprint:!1,symbol:!1,d3DModel:!1};if(n){let h=(n.attributes||{}).Symbol;if(h){try{s=await Rh.getSymbol({isProject:o,path:e,uuid:h})}catch(u){console.warn(u)}s||(a.symbol=!0)}}r.eachProcessHook&&r.eachProcessHook(.5);let l=null;if(n){let h=(n.attributes||{}).Footprint;if(h){try{l=await Rh.getFootprint({isProject:o,path:e,uuid:h})}catch(u){console.warn(u)}l||(a.Footprint=!0)}}r.eachProcessHook&&r.eachProcessHook(.75);let c=null;if(n){let h=n.attributes||{},u=h["3D Model"],d=h["3D Model Title"],p=sz(u,!0),m=p.path||Ci.SYSTEMLIB_UUID||i;if(jp.getInstance().hasLib(p.path||i)?c=await Rh.getD3Model({uuid:p.componentTitleOrId,path:p.path,isProject:!1}):p.componentTitleOrId&&(p.isLocaleFilenameMode?c=(await rTe(p.componentTitleOrId,m)).result:c=await lz(p.componentTitleOrId,m)),!c&&u&&d){if(r.isCheckD3ModelFileExist){let g=await INe(u);g.success&&g.result instanceof Blob?a.d3DModel=!1:a.d3DModel=!0}else a.d3DModel=!0;c=iTe(u,d,p.path)}}return r.eachProcessHook&&r.eachProcessHook(1),{setPath:i,deviceItem:n,symbolItem:s,footprintItem:l,d3modelItem:c,hasIdButNotFound:a}}async function oIt(o=!1,t,e,r,i){let n=i?!!i.forceAsSymbol:!1,s=i?!!i.ignoreDoctypeCheck:!1,a=i?!!i.isDevice:!1,l=i?!!i.isCheckD3ModelFileExist:!1;if(!s){if(r===28){let u=i?!!i.attachedDeviceBindingExtra:!1,d=i?i.eachProcessHook:null;try{let p=null;return u?p=await QNe(o,t,e,{eachProcessHook:d,isCheckD3ModelFileExist:l}):p=await Rh.getDevice({isProject:o,path:e,uuid:t}),{code:0,success:!0,result:p,message:""}}catch(p){return{code:-1,success:!1,result:null,message:p.message.toString()}}}if(r===4)try{return{code:0,success:!0,result:await Rh.getFootprint({isProject:o,path:e,uuid:t}),message:""}}catch(u){return{code:-1,success:!1,result:null,message:u.message.toString()}}if(n||r&&[2,18,19,20,21,22,25,31,7,32,6].indexOf(r)>=0)try{return{code:0,success:!0,result:await Rh.getSymbol({isProject:o,path:e,uuid:t}),message:""}}catch(u){return{code:-1,success:!1,result:null,message:u.message.toString()}}if(r===16)try{return{code:0,success:!0,result:await lz(t,e),message:""}}catch(u){return{code:-1,success:!1,result:null,message:u.message.toString()}}}let c=await Vn("GET",a?xc(kn.DEVICE.GET,{uuid:t}):xc(kn.COMPONENT.GET,{uuid:t}),{uuid:t,path:e},{headers:{"Content-Type":"application/json",path:e}});if(c.code===0&&c.success&&typeof c.result=="object")return{code:0,success:!0,result:c.result,message:""};let h=c.message||c.msg||"Request Error.";return{code:c.code||-1,success:!1,result:null,message:h}}function DPe(o,t){let e=o.owner||{},r=typeof o.updated_at=="string"?o.updated_at:typeof o.updated_at=="number"?yv(new Date(o.updated_at)):"",i=typeof o.updateTime=="string"?o.updateTime:typeof o.updateTime=="number"?yv(new Date(Jg(o.updateTime))):"";return{...o,$id:String(t),numberIndex:t+1,ownerBelong:e.username,updateTimeString:r||i}}function sIt(o,t,e){let r=[];for(let i=0;i<o.length;i++){let n=o[i][t]?o[i][t].toLocaleLowerCase():"",s=e?e.toLocaleLowerCase():"";n.indexOf(s)>=0&&r.push(o[i])}return r}async function aIt(o,t,e,r){let i=await new Promise(s=>{fetch(KPe.D3Model.client3DModelList+`?step_path=${o}`,{method:"GET"}).then(a=>{a.json().then(l=>{if(l){s(l);return}s(null)})})}),n={code:0,success:!0,result:{count:0,page:1,pageSize:r,totalPage:1,lists:[]},msg:""};return i&&i.success?(n.result.lists=(i.result||[]).map((s,a)=>{let l=yv(new Date(s.mtime*1e3)),c={uuid:`${s.fileName}|${t}`,rowFileTag:`${s.fileName}|${t}`,path:t,display_title:s.fileName,description:"",docType:16,isFavorite:!1,modifier:null,owner:null,tags:{child_tag:[],parent_tag:[]},title:s.fileName,updateTime:Jg(s.mtime),updated_at:l,createTime:Jg(s.mtime),created_at:l,creator:null,dataStr:"",public:void 0,type:16};return{...DPe(c,a)}}),n.result.count=i.result.length):(n.code=Ci.ERR_CODE.NORMAL,n.success=!1,n.msg=i.message||"Fetch local 3D model list error."),n}async function lIt(o,t,e,r,i){let n={};for(let c=0;c<t.length;c++){let h=t[c].id,u=await new Promise(d=>{fetch(KPe.D3Model.client3DModelList+`?step_path=${h}`,{method:"GET"}).then(p=>{p.json().then(m=>{if(m){d(m);return}d(null)})})});if(u&&u.success){n[h]={list:u.result.map((d,p)=>DPe(d,p))};continue}n[h]=null}let s={},a={},l={count:0};for(let c=0;c<t.length;c++){let h=t[c].id;if(n[h]){let u=sIt(n[h].list,"fileName",r);if(!u.length){s[h]=0,a[h]=[];continue}s[h]=u.length,a[h]=u.map((d,p)=>{let m=yv(new Date(d.mtime*1e3)),g={uuid:`${d.fileName}|${d.path}`,path:d.path,rowFileTag:`${d.fileName}|${d.path}`,display_title:d.fileName,description:"",docType:16,isFavorite:!1,modifier:null,owner:null,tags:{child_tag:[],parent_tag:[]},title:d.fileName,updateTime:Jg(d.mtime),updated_at:m,createTime:Jg(d.mtime),created_at:m,creator:null,dataStr:"",public:void 0,source:void 0,std_uuid:void 0,ticket:0,type:16};return{...DPe(g,p)}}),l.count++;continue}s[h]=0,a[h]=[]}return{code:0,success:!0,result:{count:l.count,facets:s,lists:a[o]||[],uid:o,wd:r,page:1,pageSize:i,totalPage:1},msg:""}}function eke(o){let t=null;return t=pTe(o.title),!t.success||(t=tke(o.description),!t.success)?t:{code:0,success:!0,message:"",key:"",result:null}}function cIt(o){let t=null;return t=pTe(o.name),!t.success||(t=hIt(o.type),!t.success)||(t=uIt(o.model),!t.success)?t:{code:0,success:!0,message:"",key:"",result:null}}function pTe(o){let t={code:0,success:!0,message:"",key:"",result:null};return(!o||o.length<=0||o.length>128)&&(t.code=Ci.ERR_CODE.NORMAL,t.success=!1,t.message="The title length must be between 1~128 characters!"),t}function tke(o){let t={code:0,success:!0,message:"",key:"",result:null};return o&&o.length>255&&(t.code=Ci.ERR_CODE.NORMAL,t.success=!1,t.message="Description should be no more than 255 letters"),t}function hIt(o){let t={code:0,success:!0,message:"",key:"",result:null};return o||(t.code=Ci.ERR_CODE.NORMAL,t.success=!1,t.message="The 3D model type is incorrect!"),t}function uIt(o){let t={code:0,success:!0,message:"",key:"",result:null};return o||(t.code=Ci.ERR_CODE.NORMAL,t.success=!1,t.message="The 3D model is incorrect!"),t}async function dIt(o,t,e,r){if(!t||!e||!r)return{code:-1,success:!1,result:null,message:"missing uuid or path or detail data."};let i=eke({title:r.title,description:r.description});if(!i.success)return{code:i.code,success:!1,result:null,message:i.message};let n=await Vn("POST",xc(kn.COMPONENT.UPDATE,{uuid:t}),{...r,owner:e},{headers:{"Content-Type":"application/json",path:e}});if(n.code===0&&n.success&&typeof n.result=="object")return{code:0,success:!0,result:n.result,message:""};let s=n.message||n.msg||"Request Error.";return{code:n.code||-1,success:!1,result:null,message:s}}async function pIt(o){let t=cIt(o);if(!t.success)return{code:t.code,success:!1,message:t.message};let e=new FormData;o.content&&e.append("src",new Blob([o.content]),o.name),e.append("mesh",new Blob([o.model]),"model.obj");let r=await Vn("POST",kn.COMPONENT.UPLOAD_3DMODEL,e,{contentType:!1,gzipFormData:!0},!0);if(r.success)return{success:!0,result:r.result};let i=r.message||r.msg||"Request Error.";return{success:!1,code:r.code,message:i}}var jC=class{};jC.createDefaultD3modelItem=iTe,jC.fetchD3ModelItemHandle=lz,jC.updateD3ModelItem=dIt,jC.uploadD3ModelItem=pIt,jC.d3modelInfoVerify=eke,jC.d3modelInfoTitleVerify=pTe,jC.d3modelInfoDescriptionVerify=tke,jC.fetchD3ModelListOnLocaleFolder=aIt,jC.fetchD3ModelListBySearchOnLocaleFolder=lIt,jC.fetchD3ModelItemOnLocaleFolder=rTe;function fIt(o,t=void 0){let e=null;if(e=rke(o.title),!e.success||(e=ike(o.description),!e.success)||(e=nke(o.attributes),!e.success))return e;let r={code:0,success:!0,message:"",key:"",result:null};return typeof t<"u"&&(t.length<=0||t.length>128)&&(r.code=Ci.ERR_CODE.NORMAL,r.success=!1,r.message="The title length must be between 1~128 characters!"),r}function rke(o){let t={code:0,success:!0,message:"",key:"",result:null};return(!o||o.length<=0||o.length>128)&&(t.code=Ci.ERR_CODE.NORMAL,t.success=!1,t.message="The title length must be between 1~128 characters!"),t}function ike(o){let t={code:0,success:!0,message:"",key:"",result:null};return o&&o.length>255&&(t.code=Ci.ERR_CODE.NORMAL,t.success=!1,t.message="Description should be no more than 255 letters"),t}function nke(o){let t={code:0,success:!0,message:"",key:"",result:null},e=Object.keys(o);for(let r=0;r<e.length;r++){let i=e[r],n=o[i];if(typeof n=="string"&&n.trim().length>255)return t.code=Ci.ERR_CODE.NORMAL,t.message="{0} should be no more than 255 letters",t.key=i,t}return t}var WN=class{};WN.deviceInfoVerify=fIt,WN.deviceInfoTitleVerify=rke,WN.deviceInfoDescriptionVerify=ike,WN.deviceInfoAttributesVerify=nke,WN.fetchDeviceItem=QNe;function mIt(){return[["DOCTYPE","FOOTPRINT",""],["HEAD",{editorVersion:"dev",importFlag:0}],["CANVAS",0,0,"mm",5,5,5,5,5,5,2,2,5]].map(o=>JSON.stringify(o)).join(`
`)}function gIt(o="",t="",e=""){let r=t||"[Empty Footprint Component Item]",i=new Date().getTime(),n=yv(new Date(i)),s={avatar:"",nickname:"",username:"",uuid:""};return{$emptyItem:!0,createTime:i,created_at:n,creator:{...s},dataStr:o,description:"",display_title:r,docType:4,modifier:{...s},owner:{...s},path:Ci.SYSTEMLIB_UUID,public:!1,source:"",std_uuid:"",tags:{child_tag:null,parent_tag:null},ticket:0,title:r,type:0,updateTime:i,updated_at:n,uuid:e||"",version:""}}function yIt(o){let t=null;return t=bIt(o.title),t.success?{code:0,success:!0,message:"",key:void 0,result:null}:t}function bIt(o){let t={code:0,success:!0,message:"",key:void 0,result:null};return(!o||o.length<=0||o.length>128)&&(t.code=Ci.ERR_CODE.NORMAL,t.success=!1,t.message="The title length must be between 1~128 characters!"),t}var LQ=class{};LQ.footprintInfoVerify=yIt,LQ.createEmptyFootprintItem=gIt,LQ.createEmptyFootprintDataStr=mIt;function PIt(o){let t=null;return t=TIt(o.title),!t.success||(t=IIt(o.docType),!t.success)?t:{code:0,success:!0,message:"",key:void 0,result:null}}function TIt(o){let t={code:0,success:!0,message:"",key:void 0,result:null};return(!o||o.length<=0||o.length>128)&&(t.code=Ci.ERR_CODE.NORMAL,t.success=!1,t.message="The title length must be between 1~128 characters!"),t}function IIt(o){let t={code:0,success:!0,message:"",key:void 0,result:null};return(typeof o>"u"||!o)&&(t.code=Ci.ERR_CODE.NORMAL,t.success=!1,t.message="Document data abnormality"),t}var oke=class{};oke.symbolInfoVerify=PIt;async function CIt(o=!1,t,e,r,i=[]){let n={isDuplicate:!1,path:r,uuids:[]},s=e.toLocaleLowerCase(),a=await KQ(o,s,r,t,on.loginedUserUuid);if(a.success&&a.result&&a.result.length){let l=[];for(let c=0;c<a.result.length;c++){if(i.indexOf(a.result[c].uuid)>=0)continue;let h=(a.result[c].title||a.result[c].display_title).toLocaleLowerCase();if(s===h&&a.result[c].path===r){if(typeof t>"u"||t===28){l.push(a.result[c]);continue}if(typeof a.result[c].docType>"u"){l.push(a.result[c]);continue}if(a.result[c].docType===t){l.push(a.result[c]);continue}}}for(let c=0;c<l.length;c++)n.uuids.push(l[c].uuid);n.isDuplicate=!!n.uuids.length}return n}var ske=(o=>(o.UNZIP="/pro-mgr/unzip",o.EXTRACT="/pro-mgr/unzip/extract",o.FLOW="/pro-mgr/unzip/flow",o.PARSE="/pro-mgr/unzip/parse",o.CHECK="/pro-mgr/unzip/check",o.GET_PROJECT_IN_CLOUD="/pro-mgr/getProjectInCloud",o.GET_PROJECT_IN_LOCAL="/pro-mgr/getProjectInLocal",o.GET_PROJECT_BY_IN_LOCAL="/pro-mgr/getProjectByInLocal",o.EXPORT_ZIP="/pro-mgr/export/zip",o.EXPORT_DOCUMENT="/pro-mgr/export/document",o.EXPORT_DEVICE="/pro-mgr/export/lib/device",o.EXPORT_SYMBOL="/pro-mgr/export/lib/symbol",o.EXPORT_FOOTPRIN="/pro-mgr/export/lib/footprint",o.EXPORT_PANEL_LIB="/pro-mgr/export/lib/panelLib",o.DOWNLOAD_PROJECT="/pro-mgr/export/download/project",o.DOWNLOAD_CBB="/pro-mgr/export/download/cbb",o.DOWNLOAD_DOCUMENT="/pro-mgr/export/download/document",o.BACKUP="/pro-mgr/backup",o.ARCHIVE="/pro-mgr/archive",o.LOAD_FILE="/pro-mgr/loadFile",o.CONVERT_PROJECT="/pro-mgr/convertProject/start",o.CONVERT_PROJECT_FLOWWIRTE="/pro-mgr/convertProject/flowWrite",o.CONVERT_PROJECT_FLOWREAD="/pro-mgr/convertProject/flowRead",o.IMPORT_NEW_PROJECT="/pro-mgr/importNewProject",o.PROJECT_AS_CLOUD="/pro-mgr/projectAsCloud",o.CBB_AS_CLOUD="/pro-mgr/cbbAsCloud",o.DOCUMENT_AS_CLOUD="/pro-mgr/documentAsCloud",o.COMPONENT_AS_CLOUD="/pro-mgr/componentAsCloud",o.IMPORT_TARGET_PROJECT="/pro-mgr/importTargetProject",o.UPDATE_BLOCK_SYMBOL_CONNECT="/pro-mgr/updateBlockSymbolConnect",o.IMPORT_SYMBOLS="/pro-mgr/importSymbols",o.IMPORT_FOOTPRINTS="/pro-mgr/importFootprints",o.IMPORT_DEVICES="/pro-mgr/importDevices",o.COPY_BOARD="/pro-mgr/copyBoards",o.COPY_SCHEMATIC="/pro-mgr/copySchematics",o.COPY_PAGE="/pro-mgr/copyPages",o.COPY_SIMULATION_CANVAS="/pro-mgr/copySimulationCanvas",o.COPY_SCH_CANVAS="/pro-mgr/copySchCanvas",o.COPY_PCB_CANVAS="/pro-mgr/copyPcbCanvas",o.COPY_PANEL_CANVAS="/pro-mgr/copyPanelCanvas",o.PASTE_BOARD="/pro-mgr/pasteBoards",o.PASTE_SCHEMATIC="/pro-mgr/pasteSchematics",o.PASTE_PAGE="/pro-mgr/pastePages",o.PASTE_SCH_TOP="/pro-mgr/pasteSchTop",o.PASTE_PCB="/pro-mgr/pastePcb",o.PASTE_PANEL="/pro-mgr/pastePanel",o.PASTE_SIMULATION="/pro-mgr/pasteSimulation",o.PASTE_SCH_BOTTOM="/pro-mgr/pasteSchBottom",o.BUILD_EXPORT="/pro-mgr/buildExport",o.BUILD_TARGET="/pro-mgr/buildTarget",o.PARSE_PROJECT="/pro-mgr/parseProject",o.COMPARE_LOCAL="/pro-mgr/compare/local",o.COMPARE_CLOUD="/pro-mgr/compare/cloud",o.COMPARE_DESTORY="/pro-mgr/compare/destory",o.UPDATE_REUSE_BLOCK="/pro-mgr/updateReuseBlock",o))(ske||{});async function ake(){let o=await new Promise(t=>{fetch("/api/client/config",{method:"GET"}).then(e=>{e.json().then(r=>{t(r)})})});if(o&&o.success&&o.result){let t=o.result,e=t.projectDir instanceof Array?t.projectDir:[t.projectDir];return{basePath:t.appBaseDir,cbbPath:t.reuseBlock,libPath:t.systemLib,projectPath:e,onlinePrjBackupPath:t.appOnlineBackupDir,appBaseDir:t.appBaseDir,autoCheckVersionUpdate:!!t.checkUpdate,activation:t.activation,appTmpBackupDir:t.appTmpBackupDir,cacheDir:t.cacheDir,proxy:t.proxy,log:t.log}}else return null}function lee(o,t){let e=[],r=[];ZW?r=o:t&&t.length?r=t:r=o;let i=null;return r.forEach(n=>{n.uuid===Ci.SYSTEMLIB_UUID?i={title:n.nickname,id:n.uuid,key:Ci.LIB_SYSTEM_KEY}:e.push({title:n.nickname,id:n.uuid,key:Ci.LIB_PERSONAL_KEY})}),i&&e.unshift(i),e}async function cee(o,t){let e=lee(o,t)||[],r=[],i=null;return e.forEach((n,s)=>{n.id===Ci.SYSTEMLIB_UUID?i=s:r.push({title:n.title,id:n.id,key:n.key})}),(i||i===0)&&r.splice(0,0,{title:e[i].title,id:e[i].id,key:e[i].key}),r.splice(1,0,{title:"Project",id:"",key:Ci.LIB_PROJECT_KEY}),[...r]}async function SIt(o,t){let e=await ake();if(!e)return await cee(o,t);let r=lee(o,t),i=ey(r,"id",Ci.SYSTEMLIB_UUID),n=[];i.index>=0&&n.splice(0,0,{...i.data});let{projectPath:s,cbbPath:a,libPath:l=[],onlinePrjBackupPath:c,autoCheckVersionUpdate:h}=e;return l.forEach(u=>{n.push({title:l5e(u),id:u,key:u})}),n.splice(1,0,{title:"Project",id:"",key:Ci.LIB_PROJECT_KEY}),[...n]}function EIt(o,t,e,r){let i=[],n=[],s={},a=[];return o.forEach(l=>{switch(l.titleAdditional=l.title,l.title){case"Project":{if(!r||!e||!e.uuid)return;l.id=e.uuid,a.push(e.uuid);break}default:}l.id||(l.id="@"+qW(new Date().getTime())),typeof s[l.id]<"u"?(s[l.id]+=1,l.id=l.id+Ci.LIB_SPLIT_TAG+s[l.id]):s[l.id]=0,t&&t.indexOf(l.id)>=0&&n.push(l.id),i.push(l)}),{treeData:i,projectsIds:a,selectedIds:n}}async function lke(o,t){let e=lee(o,t)||[],r=[],i=null;return e.forEach((n,s)=>{n.id===Ci.SYSTEMLIB_UUID?i=s:r.push({title:n.title,id:n.id,key:n.key})}),(i||i===0)&&r.splice(0,0,{title:e[i].title,id:e[i].id,key:e[i].key}),r.splice(1,0,{title:"Project",id:"",key:Ci.LIB_PROJECT_KEY}),[...r]}async function OIt(o,t){let e=await ake();if(!e)return await cee(o,t);let r=[],{projectPath:i,cbbPath:n,libPath:s=[],onlinePrjBackupPath:a,autoCheckVersionUpdate:l}=e;return s.forEach(c=>{r.push({title:l5e(c),id:c,key:c})}),r.splice(1,0,{title:"Project",id:"",key:Ci.LIB_PROJECT_KEY}),[...r]}function AIt(o,t,e,r){let i=[],n=[],s={},a=[];return o.forEach(l=>{switch(l.titleAdditional=l.title,l.title){case"Project":{if(!r||!e||!e.uuid)return;l.id=e.uuid,a.push(e.uuid);break}default:}l.id||(l.id="@"+qW(new Date().getTime())),typeof s[l.id]<"u"?(s[l.id]+=1,l.id=l.id+Ci.LIB_SPLIT_TAG+s[l.id]):s[l.id]=0,t&&t.indexOf(l.id)>=0&&n.push(l.id),i.push(l)}),{treeData:i,projectsIds:a,selectedIds:n}}function cke(o,t){let e=[],r=[];return ZW?r=o:t&&t.length?r=t:r=o,r.forEach(i=>{e.push({title:i.nickname,id:i.uuid,key:Ci.LIB_TEMAS_KEY})}),e}async function ZQ(o,t){let e=cke(o,t);return[{title:"System",id:Ci.SYSTEMLIB_UUID,key:Ci.LIB_SYSTEM_KEY},{title:"Project",id:"",key:Ci.LIB_PROJECT_KEY},{title:"Personal",id:"",key:Ci.LIB_PERSONAL_KEY},{title:"Favorite",id:Ci.FAVORITELIB_UUID,key:Ci.LIB_FAVORITE_KEY},...e]}function hke(o,t,e,r,i){let n=[],s=[],a={},l=[];return o.forEach(c=>{switch(c.title){case"Project":{if(!i||!r||!r.uuid)return;c.id=r.uuid,l.push(r.uuid);break}case"Personal":{if(!e||!e.uuid)return;c.id=e.uuid;break}case"Public":{c.id=Ci.PUBLICLIB_ALIAS;break}default:}c.id||(c.id="@"+qW(new Date().getTime())),typeof a[c.id]<"u"?(a[c.id]+=1,c.id=c.id+Ci.LIB_SPLIT_TAG+a[c.id]):a[c.id]=0,t&&t.indexOf(c.id)>=0&&s.push(c.id),n.push(c)}),{treeData:n,projectsIds:l,selectedIds:s}}async function wPe(o,t){return await ZQ(o,t)}function _It(o,t,e,r,i){return hke(o,t,e,r,i)}function uke(o,t,e,r,i,n,s){if(!qC){let l=hke(o,e,r,i,typeof n<"u"?!!n:s);return IQ(l,t),CQ(l)}if(MQ){let l=_It(o,e,r,i,typeof n<"u"?!!n:s);return IQ(l,t),CQ(l)}if(GW){let l=EIt(o,e,i,typeof n<"u"?!!n:s);return IQ(l,t),CQ(l)}let a=AIt(o,e,i,typeof n<"u"?!!n:s);return IQ(a,t),CQ(a)}function IQ(o,t){let e=ey(o.treeData,"key",Ci.LIB_SYSTEM_KEY);e.index>=0&&o.treeData.splice(e.index,1);let r=ey(o.treeData,"key",Ci.LIB_PERSONAL_KEY);r.index>=0&&o.treeData.splice(r.index,1);let i=ey(o.treeData,"key","project");i.index>=0&&o.treeData.splice(i.index,1);let n=ey(o.treeData,"key",Ci.LIB_FAVORITE_KEY);n.index>=0&&o.treeData.splice(n.index,1);let s=ey(o.treeData,"key","selected");s.index>=0&&o.treeData.splice(s.index,1);let a=ey(o.treeData,"key","oshwhub");a.index>=0&&o.treeData.splice(a.index,1),o.treeData.sort((l,c)=>(l.title||"").localeCompare(c.title||"")),n.index>=0&&o.treeData.unshift(n.data),i.index>=0&&o.treeData.unshift(i.data),t==="Personal"?ZW||r.index>=0&&o.treeData.unshift(r.data):o.selectedIds=o.selectedIds.filter(l=>{var c;return l!==((c=r==null?void 0:r.data)==null?void 0:c.id)}),a.index>=0&&o.treeData.unshift(a.data),e.index>=0&&o.treeData.unshift(e.data),s.index>=0&&o.treeData.push(s.data)}function CQ(o){return o.selectedIds.length?o.selectedIds:o.selectedIds.push(o.treeData[0].id),o}async function vIt(o,t,e,r,i,n,s,a,l=!0,c=!0,h=!0){let u={username:n.username,uuid:n.uuid},{projectId:d,title:p,isCBB:m}=i,g={uuid:d,title:p,isCBB:m},y=await dke(t,s,a,o,e,l),b=uke(y,r,[],u,g,!l),P=[];for(let T=0;T<b.treeData.length;T++){let I=b.treeData[T];I.id===Ci.SYSTEMLIB_UUID&&c||I.id===Ci.FAVORITELIB_UUID&&h||(eee||tee||I.key===Ci.LIB_PERSONAL_KEY&&(I.title=I.titleAdditional=u.username),I.title&&P.push(I))}return P}var xIt=(o=>(o.Normal="Normal",o.D3Model="D3Model",o.AssociateDeviceDialog="associateDeviceDialog",o.Cbb="Cbb",o))(xIt||{}),TO=class{};TO.createInitLibList=dke,TO.createFixLibList=vIt,TO.filterInitLibList=uke,TO.fetchTeamsLibsFromGVars=cke,TO.fetchClientTeamsLibsFromGVars=lee,TO.createSourceLibListByWebMode=ZQ,TO.createSourceLibListByOnlineClientMode=wPe,TO.createSourceLibListByOfflineClientMode=lke,TO.createSourceLibListByHalfofflineClientMode=cee;async function dke(o,t,e,r,i,n){let s=[];return o==="Normal"?qC?MQ?(s=await wPe(t,e),n&&SQ(s),s):GW?(s=await cee(t,e),n&&SQ(s),s):(s=await lke(t,e),n&&SQ(s),s):(s=await ZQ(t,e),n&&SQ(s),s):o==="D3Model"?qC?MQ?(s=await wPe(t,e),s):GW?(s=await SIt(t,e),s):(s=await OIt(t,e),s):(s=await ZQ(t,e),s):[]}function SQ(o){let t=ey(o,"key",Ci.LIB_PROJECT_KEY);t.index>=0&&o.splice(t.index,1)}var izt=$W(KW());var nzt=$W(KW());var ozt=$W(KW());var EP=class{};EP.D3Model=jC,EP.Device=WN,EP.Footprint=LQ,EP.Symbol=oke,EP.deleteComponentItem=iNe,EP.deleteComponents=$bt,EP.fetchComponentItem=oIt,EP.queryComponentsByTitle=KQ,EP.pickUpComponentTags2Ids=nNe,EP.pickUpComponentTags2Names=Tv,EP.getDataStrById=az,EP.duplicateNameDetection=CIt;var o5e=class nL{static async getOldLibByNet(t){try{let{dataStrId:e,dataStr:r}=t;return e||r?{success:!0,result:await az(t)||""}:{success:!1,message:"Failed to obtain the source code of the existing component library!"}}catch(e){return{success:!1,message:e.message}}}static transform(t,e){let{uuid:r,docType:i}=e,n="";if(i===4){let s=e.isConnectDevice;n=C2t(r,t,s)}else i===29?n=v2t(r,t,kW.PANEL_LIB):jQ(i)&&(n=O2t(r,t).dataStr);return n}static async getOtherLibByNet(t){try{let{isProject:e,uuid:r,path:i,docType:n}=t;if(ubt(t)){let c={ignoreDoctypeCheck:!0},h=(await EP.fetchComponentItem(e,r,i,n,c)).result;t=Object.assign(t,h)}let{history_uuid:s,dataStrId:a,dataStr:l}=t;if(s){let c={path:i,uuid:r,historyUuid:s},h=(await on.messageBus.rpcCall(vO.COMPONENT.GET_HISTORY,c)).message;if(!h.success){let u=["Conversion component format failed!",h.message];return{success:!1,code:h.code,message:u}}return{success:!0,result:(await on.messageBus.rpcCall(vO.COMPONENT.GET_HISTORY_DATA,[h.result])).message}}else if(a||l){let c=await nL.getOldLibByNet(t);if(!c.success){let d=["Conversion component format failed!",c.message];return{success:!1,code:c.code,message:d}}let h=c.result,u=nL.transform(h,t);return u?{success:!0,result:u}:{success:!1,message:["Conversion component format failed!","Illegal docType!"]}}else return{success:!0,result:""}}catch(e){return{success:!1,message:e.message}}}static async getOtherLibByWorker(t){try{let e=Q();return{success:!0,result:await $Pe(`/${e._TAB_ID_}/libWorker`).rpcCall("/mgr/libWorker/getDataByType",t)}}catch(e){return{success:!1,message:e.message}}}static async getProjectLibByWorker(t){try{let{path:e,uuid:r,docType:i}=t,{message:n}=await on.messageBus.rpcCall("/pro-mgr/hasProject",[e]);return n?i===4?{success:!0,result:(await on.messageBus.rpcCall(Jo.FOOTPRINT.GET_STR,[r,e])).message||""}:jQ(i)?{success:!0,result:(await on.messageBus.rpcCall(Jo.SYMBOL.GET_STR,[r,e])).message||""}:{success:!1,message:"Api call error! The api does not exist!"}:{success:!1,message:"Get project library data source Project is not open!"}}catch(e){return{success:!1,message:e.message}}}static async getExtendLib(t){var e,r;let{path:i,uuid:n,docType:s}=t,a=jp.getInstance().getLib(i),l;if(s===4?l=await((e=a==null?void 0:a.footprint)==null?void 0:e.getTransformedDetail(n)):l=await((r=a==null?void 0:a.symbol)==null?void 0:r.getTransformedDetail(n)),!(l!=null&&l.dataStr))return{success:!1,message:["Conversion component format failed!","Failed to obtain the source code of the existing component library!"]};let c;return l.dataStr.trim().startsWith("[")?c=nL.transform(l.dataStr,t):c=l.dataStr,c?{success:!0,result:c}:{success:!1,message:["Conversion component format failed!","Illegal docType!"]}}static async getProLibSource(t){if(typeof window>"u")return await dbt(t);try{let{isProject:e,path:r}=t;return jp.getInstance().hasLib(r)?nL.getExtendLib(t):e?nL.getProjectLibByWorker(t):nL.getOtherLibByWorker(t)}catch(e){return{success:!1,message:e.message}}}},pke=(o=>(o.INIT_DB="/CommonDB/initDB",o))(pke||{}),fke=(o=>(o.GET="/CommonDB/project/getData",o.GET_ALL="/CommonDB/project/getAllArrData",o))(fke||{}),mke=(o=>(o.GET="/CommonDB/copyAndPaste/getData",o.SET="/CommonDB/copyAndPaste/setData",o.IS_EXIST="/CommonDB/copyAndPaste/isExist",o.GET_DATA_FROM_PCB_CANVAS="/CommonDB/copyAndPaste/getDataFromPcbCanvas",o))(mke||{}),gke=(o=>(o.GET="/CommonDB/copyAndPasteTableCell/getData",o.SET="/CommonDB/copyAndPasteTableCell/setData",o.IS_EXIST="/CommonDB/copyAndPasteTableCell/isExist",o))(gke||{}),yke=(o=>(o.SET="/CommonDB/log/setData",o.DEL="/CommonDB/log/delData",o.DEL_LOTS="/CommonDB/log/delLotsData",o.GET_ALL="/CommonDB/log/getAllArrData",o))(yke||{}),bke=(o=>(o.SET="/CommonDB/Component/log/setData",o.DEL="/CommonDB/Component/log/delData",o.DEL_LOTS="/CommonDB/Component/log/delLotsData",o.GET_ALL="/CommonDB/Component/log/getAllArrData",o))(bke||{}),Pke=(o=>(o.SET="/CommonDB/basicLibraryList/addData",o.GET="/CommonDB/basicLibraryList/getData",o.IS_EXIST="/CommonDB/basicLibraryList/isExist",o))(Pke||{}),Tke=(o=>(o.SET="/CommonDB/clipBoard/addData",o.GET="/CommonDB/clipBoard/getData",o.IS_EXIST="/CommonDB/clipBoard/isExist",o))(Tke||{}),Ike=(o=>(o.GET="/CommonDB/lockPrj/getData",o.READ_WRITE="/CommonDB/lockPrj/readwriteData",o))(Ike||{}),Cke=(o=>(o.GET="/CommonDB/prjCache/getData",o.SET="/CommonDB/prjCache/addData",o.DEL="/CommonDB/prjCache/delData",o.DEL_LOTS="/CommonDB/prjCache/delLotsData",o.GET_INDEXS="/CommonDB/prjCache/getAllIndexs",o.GET_COUNT="/CommonDB/prjCache/getCount",o.GET_EARLIEST="/CommonDB/prjCache/getEarliest",o))(Cke||{}),fTe={COMMON:pke,PROJECT:fke,COPYANDPASTE:mke,COPYANDPASTE_TABLE_CELL:gke,LOG:yke,COMPONENT_LOG:bke,LIB:Pke,CLIP_BOARD:Tke,LOCK_PROJECT:Ike,PROJECT_CACHE:Cke},RIt=(o=>(o.CREATE="/pro-mg/cbb/create",o.DRAW="/pro-mg/cbb/draw",o.GET_EXPORT="/pro-mg/cbb/getExport",o.GET_TARGET="/pro-mg/cbb/getTarget",o.LIST="/pro-mg/cbb/list",o.SEARCH="/pro-mg/cbb/search",o.PLACE="/pro-mg/cbb/place",o))(RIt||{}),DIt=(o=>(o.GET="/pro-mg/thumb/get",o.UPLOAD="/pro-mg/thumb/upload",o.DELETE="/pro-mg/thumb/delete",o.LIST="/pro-mg/thumb/list",o))(DIt||{}),wIt=(o=>(o.CREATE="/pro-mgr/new/cloud/create",o.PROJECT="/pro-mgr/new/cloud/project",o.BOARD="/pro-mgr/new/cloud/board",o.SCHEMATIC="/pro-mgr/new/cloud/schematic",o.SHEET="/pro-mgr/new/cloud/sheet",o.SIMULATION="/pro-mgr/new/cloud/simulation",o.PCB="/pro-mgr/new/cloud/pcb",o.PANEL="/pro-mgr/new/cloud/panel",o))(wIt||{}),LIt=(o=>(o.BOARD="/pro-mgr/new/local/board",o.SCHEMATIC="/pro-mgr/new/local/schematic",o.SHEET="/pro-mgr/new/local/sheet",o.SIMULATION="/pro-mgr/new/local/simulation",o.PCB="/pro-mgr/new/local/pcb",o.PANEL="/pro-mgr/new/local/panel",o))(LIt||{});var MIt=(o=>(o.FORCE="/pro-mgr/project/updateData/force",o.SUSPEND="/pro-mgr/project/updateData/suspend",o.RESUME="/pro-mgr/project/updateData/resume",o.GET="/pro-mgr/project/updateData/getLastest",o.IS_PUBLIC="/pro-mgr/project/updateData/isPublic",o.UPDATE_TEAM="/pro-mgr/project/updateData/updateTeam",o))(MIt||{}),NIt=(o=>(o.UPDATE="/pro-mgr/project/updateData/schematic/update",o.GET="/pro-mgr/project/updateData/schematic/getData",o.MAP="/pro-mgr/project/updateData/schematic/map",o.NOTIFY="/pro-mgr/project/updateData/schematic/notify",o))(NIt||{}),kIt=(o=>(o.UPDATE="/pro-mgr/project/updateData/sheet/update",o.GET="/pro-mgr/project/updateData/sheet/getData",o.MAP="/pro-mgr/project/updateData/sheet/map",o.NOTIFY="/pro-mgr/project/updateData/sheet/notify",o))(kIt||{}),BIt=(o=>(o.UPDATE="/pro-mgr/project/updateData/pcb/update",o.GET="/pro-mgr/project/updateData/pcb/getData",o.MAP="/pro-mgr/project/updateData/pcb/map",o.NOTIFY="/pro-mgr/project/updateData/pcb/notify",o))(BIt||{}),FIt=(o=>(o.UPDATE="/pro-mgr/project/updateData/blockSymbol/update",o.GET="/pro-mgr/project/updateData/blockSymbol/getData",o.MAP="/pro-mgr/project/updateData/blockSymbol/map",o.NOTIFY="/pro-mgr/project/updateData/blockSymbol/notify",o))(FIt||{}),VIt=(o=>(o.UPDATE="/pro-mgr/project/updateData/symbol/update",o.GET="/pro-mgr/project/updateData/symbol/getData",o.MAP="/pro-mgr/project/updateData/symbol/map",o.NOTIFY="/pro-mgr/project/updateData/symbol/notify",o))(VIt||{}),GIt=(o=>(o.UPDATE="/pro-mgr/project/updateData/footprint/update",o.GET="/pro-mgr/project/updateData/footprint/getData",o.MAP="/pro-mgr/project/updateData/footprint/map",o.NOTIFY="/pro-mgr/project/updateData/footprint/notify",o))(GIt||{}),UIt=(o=>(o.UPDATE="/pro-mgr/project/updateData/device/update",o.GET="/pro-mgr/project/updateData/device/getData",o.MAP="/pro-mgr/project/updateData/device/map",o.NOTIFY="/pro-mgr/project/updateData/device/notify",o))(UIt||{});var HIt=(o=>(o.PROGRESS="/pro-ui/progressUpdate",o.OPENED_PROJECT="/pro-ui/project/openedProject",o.HAS_UNSAVED="/pro-ui/project/hasUnsaved",o.OPEN="/pro-ui/project/open",o.CLOSE="/pro-ui/project/close",o.ON_OPENED="/pro-ui/project/onOpened",o.ON_FAILED="/pro-mgr/project/onFailed",o.ON_CLOSED="/pro-ui/project/onClosed",o.ADD_HASH="/pro-ui/hash/add/id",o.REMOVE_HASH="/pro-ui/hash/remove/id",o))(HIt||{}),WIt=(o=>(o.ON_UPDATE="/pro-mgr/project/project/onUpdate",o.UPLOAD_FAILED="/pro-mgr/project/upload/onfailed",o))(WIt||{}),zIt=(o=>(o.ON_UPDATE="/pro-mgr/project/config/onUpdate",o))(zIt||{}),YIt=(o=>(o.ON_ADD="/pro-mgr/project/board/onAdd",o.ON_DELETE="/pro-mgr/project/board/onDelete",o.ON_UPDATE="/pro-mgr/project/board/onUpdate",o))(YIt||{}),jIt=(o=>(o.ON_ADD="/pro-mgr/project/schematic/onAdd",o.ON_DELETE="/pro-mgr/project/schematic/onDelete",o.ON_UPDATE="/pro-mgr/project/schematic/onUpdate",o.ON_UPDATETIME="/pro-mgr/project/schematic/onUpdateTime",o))(jIt||{}),XIt=(o=>(o.ON_ADD="/pro-mgr/project/sheet/onAdd",o.ON_DELETE="/pro-mgr/project/sheet/onDelete",o.ON_UPDATE="/pro-mgr/project/sheet/onUpdate",o.ON_UPDATETIME="/pro-mgr/project/sheet/onUpdateTime",o))(XIt||{}),qIt=(o=>(o.ON_ADD="/pro-mgr/project/pcb/onAdd",o.ON_DELETE="/pro-mgr/project/pcb/onDelete",o.ON_UPDATE="/pro-mgr/project/pcb/onUpdate",o.ON_UPDATETIME="/pro-mgr/project/pcb/onUpdateTime",o))(qIt||{}),$It=(o=>(o.ON_ADD="/pro-mgr/project/panel/onAdd",o.ON_DELETE="/pro-mgr/project/panel/onDelete",o.ON_UPDATE="/pro-mgr/project/panel/onUpdate",o.ON_UPDATETIME="/pro-mgr/project/panel/onUpdateTime",o))($It||{}),KIt=(o=>(o.ON_ADD="/pro-mgr/project/simulation/onAdd",o.ON_DELETE="/pro-mgr/project/simulation/onDelete",o.ON_UPDATE="/pro-mgr/project/simulation/onUpdate",o.ON_UPDATETIME="/pro-mgr/project/simulation/onUpdateTime",o))(KIt||{}),ZIt=(o=>(o.ON_ADD="/pro-mgr/project/device/onAdd",o.ON_DELETE="/pro-mgr/project/device/onDelete",o.ON_UPDATE="/pro-mgr/project/device/onUpdate",o.ON_UPDATETIME="/pro-mgr/project/device/onUpdateTime",o))(ZIt||{}),JIt=(o=>(o.ON_ADD="/pro-mgr/project/symbol/onAdd",o.ON_DELETE="/pro-mgr/project/symbol/onDelete",o.ON_UPDATE="/pro-mgr/project/symbol/onUpdate",o.ON_UPDATETIME="/pro-mgr/project/symbol/onUpdateTime",o))(JIt||{}),QIt=(o=>(o.ON_ADD="/pro-mgr/project/footprint/onAdd",o.ON_DELETE="/pro-mgr/project/footprint/onDelete",o.ON_UPDATE="/pro-mgr/project/footprint/onUpdate",o.ON_UPDATETIME="/pro-mgr/project/footprint/onUpdateTime",o))(QIt||{}),eCt=(o=>(o.ON_ADD="/pro-mgr/project/attr/onAdd",o.ON_DELETE="/pro-mgr/project/attr/onDelete",o.ON_UPDATE="/pro-mgr/project/attr/onUpdate",o))(eCt||{}),tCt=(o=>(o.ON_ADD="/pro-mgr/project/blob/onAdd",o.ON_DELETE="/pro-mgr/project/blob/onDelete",o.ON_UPDATE="/pro-mgr/project/blob/onUpdate",o))(tCt||{}),rCt=(o=>(o.ON_ADD="/pro-mgr/project/variant/onAdd",o.ON_DELETE="/pro-mgr/project/variant/onDelete",o.ON_UPDATE_TITLE="/pro-mgr/project/variant/onUpdatetitle",o.ON_UPDATE_NOT_GROUPED="/pro-mgr/project/variant/onUpdateNotGrouped",o.ON_UPDATE_ZINDEX="/pro-mgr/project/variant/onUpdateZIndex",o.ON_ADD_COMPONENT_GROUP="/pro-mgr/project/variant/onAddComponentGroup",o.ON_DELETE_COMPONENT_GROUP="/pro-mgr/project/variant/onDeleteComponentGroup",o.ON_UPDATE_COMPONENT_GROUP_TITLE="/pro-mgr/project/variant/onUpdateComponentGroupTitle",o.ON_UPDATE_COMPONENT_GROUP_ZINDEX="/pro-mgr/project/variant/onUpdateComponentGroupZIndex",o.ON_UPLOAD_COMPONENT_GROUP_INDEX_IN_VARIANT="/pro-mgr/project/variant/onUploadComponentGroupZIndexInVariant",o.ON_DELETE_COMPONENT_GROUP_INDEX_IN_VARIANT="/pro-mgr/project/variant/onDeleteComponentGroupZIndexInVariant",o.ON_UPLOAD_COMPONENT_GROUP_DATA="/pro-mgr/project/variant/onUploadComponentGroupData",o.ON_DELETE_COMPONENT_GROUP_DATA="/pro-mgr/project/variant/onDeleteComponentGroupData",o))(rCt||{});var szt=new Error("list is empty");var iCt=(o=>(o.ALL_VALUE="@all",o.ALL_TITLE="All",o.ComponentSymbol="2",o.NetflagSymbol="18",o.NetportSymbol="19",o.DrawingSymbol="20",o.NonElectronicSymbol="21",o.OffPageConnectorSymbol="25",o.DiffPairsFlagSymbol="31",o))(iCt||{});var nCt=class{};nCt.syncLoginedUserInfo=o=>{on.loginedUserUuid=o.uuid};var oCt=(o=>(o.PROJECT="project.json",o.DEVICE="device.json",o.SYMBOL="symbol.json",o.FOOTPRINT="footprint.json",o.PANEL_LIB="panel-lib.json",o.PROJECT2="project2.json",o.DEVICE2="device2.json",o.SYMBOL2="symbol2.json",o.FOOTPRINT2="footprint2.json",o.PANEL_LIB2="panel-lib2.json",o))(oCt||{});fft();var hee=class{constructor(t){this.renderPerFrame=!window["META-PANELIZE-ENV"]&&/\brenderPerFrame\b/.test(Q().location.search);this.updateFrame=!0;this.canvas=t,he.subscribe("updateFrame",e=>{this.updateFrame=!0,e==="mousemove"&&this._scene&&this._scene.mouseMoveRenderRuler()}),he.subscribe("maskUpdateFrame",()=>{this.updateFrame=!1})}async initScene(t){if(this._scene)throw new Error("initScene cannot be called multiple times!");let{scene:e}=await vwe(this.canvas,this.getRenderEngine(),Q(),t===3?nJ.PCB:nJ.DEFAULT);va.useWebgl=!window["META-PANELIZE-ENV"]&&/\bglEngine\b/.test(Q().location.search),this._scene=e;let r=Ai();r.setCanvas(this.canvas),this._scene.addCamera(r),R.getInstance().attachScene(this._scene),It.getInstance().attach(this._scene.gridParam)}get scene(){return this._scene}getRenderEngine(){if(navigator.userAgent.includes("Firefox"))return xw.Canvas2D;switch(R.getInstance().coreRenderingEngine){case"auto":return xw.Auto;case"webgpu":return xw.WebGPU;case"canvas2d":return xw.Canvas2D;default:return xw.Auto}}renderFrame(){(this.updateFrame||this.renderPerFrame)&&this._scene&&(this.updateFrame=!1,he.publish("updateModify",""),va.useWebgl&&this._scene.render())}};var ne=class{static regular(t){return Math.round(t*this.precision)/this.precision}static eq(t,e){return Math.abs(t-e)<=this.eps}static neq(t,e){return Math.abs(t-e)>this.eps}static less(t,e){return t-e<-this.eps}static lesseq(t,e){return t-e<this.eps}static greater(t,e){return t-e>this.eps}static greatereq(t,e){return t-e>-this.eps}static sqrt(t){return Math.abs(t)<=1e-10?0:Math.sqrt(t)}static sortAsc(t,e){return t-e}static sortDesc(t,e){return e-t}};ne.eps=1e-8,ne.precision=1e8;var fk=class{static getSweep(t){if(t.length>2){let e=0,r=t.length;for(let s=0;s<r-1;s++){let a=t[s],l=t[s+1];e+=(l.x+a.x)*(l.y-a.y)}let i=t[0],n=t[r-1];return e+=(i.x+n.x)*(i.y-n.y),e>0}else throw console.error(t),new Error("Unable to determine the direction of rotation!")}static isClose(t){return!!(t.primitives.length>0&&t.primitives[0].start().equals1(t.primitives[t.primitives.length-1].end()))}};function nh(o){let t=o.primitives,e=t[0],r=e instanceof q?e.sweepAngle%360:null;if(t.length===1&&e instanceof q&&(ne.eq(r,0)||ne.eq(Math.abs(r),360)))return!!e.isCCW;let i=new Array;return o.points(.1,n=>{i.push(n)}),fk.getSweep(i)}var Ske="3.2.131",Eke="05/06/2026";var wO={ui_instance:!1,ui_module:!0,messageBus:void 0,windowBridge:void 0,pcbMessageBus:void 0,moveRocord:void 0,moveRocordNext:void 0,selectBox1:void 0,gControlDots:void 0,gRotateHelper:void 0,gControlRects:void 0,gControlLines:void 0,gCopperAreaOutlineCushions:void 0,gPanelizedOutlines:void 0,gPanelizedOutlinesOverG1:void 0,gCanvas:void 0,Canvas:void 0,doctype:void 0,cmdToken:void 0,gZoom:1,currZoom:100,jsonMgr:void 0,svgRoot:void 0,activeElement:void 0,helperCursor:void 0,showControlDots:void 0,_RotateCache:{},moveAction:void 0,localStorageDisabled:void 0,data3D:void 0,defaultImage:{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA1MCA0MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB4PSIxIiB5PSIxIiB3aWR0aD0iNDgiIGhlaWdodD0iMzgiIGZpbGw9IiNGRkYiIHN0cm9rZT0iI0NDQyIgc3Ryb2tlLXdpZHRoPSIyIi8+PHBvbHlsaW5lIHBvaW50cz0iMS41LDIzLDE2LDEzLDM0LDI2LDQ4LjUsMjAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0NDQyIgc3Ryb2tlLXdpZHRoPSIyIi8+PGNpcmNsZSBjeD0iMzUiIGN5PSIxMiIgcj0iNCIgZmlsbD0iI0NDQyIgc3Ryb2tlPSJub25lIi8+PC9zdmc+",width:50,height:40},worker:void 0,tearDropWorker:null,notCheckPrefix:void 0,drawing:void 0,loading:void 0,userAvatar:void 0,loginHandle:void 0,isMouseOnEditFrame:!1,isOn3dView:void 0,terminalWorker:void 0,hoverCache:void 0,contextmenuDisableOnce:void 0,pcbNetTextVisible:void 0,gRecover:void 0,gNets:void 0,updateNetTextTimer:void 0,netTextCharWidth:void 0,helperCursorConfig:{},rotateParts:void 0,waveFormObj:void 0,setCanvas:void 0,preMgr:void 0,sheetMgr:void 0,findShape:void 0,moveSelectedObjs:void 0,rotateSelectedObjs:void 0,vectorEffectSupported:void 0,modifyText:void 0,prjData:void 0,importChanges:void 0,DragAction:void 0,DragAction2:void 0,DragAction3:void 0,Draw:void 0,toggleTrackWidthPanel:void 0,arrowKeyMove:void 0,importShape:void 0,zoom:void 0,getCanvas:void 0,moveSelectedObjsTo:void 0,bringSelectedObjsToFront:void 0,sendSelectedObjsToBack:void 0,getComponents:void 0,isDragging:void 0,groupSymbol:void 0,cutSelectedObjs:void 0,copySelectedObjs:void 0,pasteFromGlobalClipboard:void 0,pasteFromClipboardAfterCloseRatline:void 0,cloneObjects:void 0,flipSelectedObjects:void 0,attrpanelApply:void 0,attrpanelGetData:void 0,deletePathNode:void 0,dragMoveSwitch:void 0,dragMoveCheck:void 0,dragMoveEndHandlerForPaste:void 0,importJsonCache:void 0,fixedDecimal:!1,decimalPlaces:2,decimalPlacesShow:2,schDecimalPlaces:2,schDecimalPlacesShow:2,pcbDecimalPlaces:4,pcbDecimalPlacesShow:3,pcbServersFonts:["NotoSerifCJKsc-Medium","NotoSansCJKjp-DemiLight"],pcbFontsRegExp:/[^!"\\#\$%&'`\(\)\*\+,\-\.\/a-zA-z0-9:<;\=\?>@\[\]\^_\{\|\}~°\s\t\r\n]/,checkNotificationInterval:12e4,checkUpdateInterval:36e5,saveFileTimeout:3e5,autoSaveMaxCount:1e3,autoSaveMaxBackupLevel:10,autoGzipAjaxPostSize:1e4,cooperationSites:["elektroda","amobbs","allaboutcircuits","diyaudio","hifidiy","edaboard"],cushionShape:null,cushionShapeFor:null,fileOperationAPI:"/EditorBridge/fileOperation",svgFileAPI:"/EditorBridge/svgFile",treeDataAPI:"/EditorBridge/treeData",anonymousPid:"441bd07389f646ac82c8d1dbc45a6021",version:"V"+Ske,buildDate:Eke,lcscUUID:"0819f05c4eef4c71ace90d822a990e87",easyedaUUID:"4251c6ae97414f38bb1d929da02c4173",ignoreConfirmClose:!1,globalVariableCookieData:{},teams:[],networkWarn:"Network Error! Please check your network and try again!",updatePcbFileInfo:[],multiSelect:!1,copperNetRelation:{},isSaving:!1,pasteCount:0,pasteFrom:null,canvasStrTolerance:10,logTypes:{BOM_EXPORT:1,BOM_LCSC:2,GERBER_DOWNLOAD:3,GERBER_JLC:4},apis:{model:{upload:"/api/3dmodel/upload"}},deleteObjs:void 0,currentProject:{projectId:void 0,title:void 0},blockSymbolAttr:void 0,selectableObjMap:{SCH:{symbol:!0,wire:!0,pin:!1,name:!0,property:!0,text:!0,arc:!0,rect:!0,circle:!0,polyline:!0,table:!0,sheet:!0},SYMBOL:{pin:!0,name:!0,property:!0,text:!0,arc:!0,rect:!0,circle:!0,polyline:!0}},importFileDataStr:void 0,profileSetting:null,defaultFont:null,batchExportInfo:null,extensionApiMessageBus2:void 0},QXt=(function(){try{var o=location.hostname;return o.indexOf("lceda")>-1?"lceda":(o.indexOf("easyeda")>-1,"easyeda")}catch{}})(),Oke=(function(){try{var o=location.hostname,t=o.split(".");return t.length>2?t.length===3&&(t[0]==="www"||t[0]==="alpha")?"online":"dev":"online"}catch{}})();var Ra={unRebuildCopperWhenOpening:!1,unRebuildRatline:!1,unRefreshViews:!1,unRefreshScene:!1,unAmountCounts:!0,generateGerberUnEncryption:!1,colorSilkCreateUseCoordinate:!1,colorSilkCreateUseMarkPoints:!1};if(Oke=="online"&&location&&location.hostname!="localhost")for(let o in Ra)Ra[o]=!1;var dz=class{constructor(t,e,r,i,n=!1,s=!1,a){this.layerGroup=a;this.id=0;this.syncViewStatus=null;let l=this.useTexture(i);this.group=new Q2(void 0,!1,i),this.plane=t.createPlane(r,i,null,l,this.isPanelize(e,i),n,s),this.group.setPosition(new Dt(0,0,-e)),this.group.add(this.plane),this.layerGroup.add(this.group),this.funCreateNoPanelizePlane=()=>{let c=t.createPlane(r,i,null,l,!1,n);return this.panelizePlaneGroup=new Q2(void 0,!1,i),this.panelizePlaneGroup.add(c),this.panelizePlaneGroup.setPosition(new Dt(0,0,-e)),this.layerGroup.add(this.panelizePlaneGroup),c}}setSyncViewStatusCb(t){this.syncViewStatus=t}useTexture(t){return![57,1002,1006].includes(t)}getCreateNoPanelizePlane(){return this.noPanelizePlane||(this.noPanelizePlane=this.funCreateNoPanelizePlane(),this.syncViewStatus!=null&&this.syncViewStatus()),this.noPanelizePlane}isPanelize(t,e){return!(t===1||[53,54,55].includes(e))}getId(){return this.id++}getEngineGroupId(t){if(t)return cn.getInstance().getEngineGroupId(t)}addPolygon(t,e,r){return Ra.unRefreshScene?[]:(t.primitives.length>1&&nh(t)&&(t=t.reverse().asClose()),this.plane.createPolygon([t],e,void 0,r))}addStaticPolygon(t,e,r){return Ra.unRefreshScene?[]:this.plane.createStaticPolygon(t,e,void 0,r)}};var mk=class{constructor(t=3){this.state=3;this.state=t}getValue(t){return(this.state>>t&1)==1}setValue(t,e){let r=1<<t;e?this.state=this.state|r:this.state=this.state&(15^r)}};var gk=class o extends mk{static build(t,e,r,i=!0,n=!1){let a=new o(0);return a.used=t,a.visible=e,a.status=r,a.isColorful=i,a.isPlane=n,a}constructor(t){super(t)}get used(){return this.getValue(0)}set used(t){this.setValue(0,t)}get visible(){return this.getValue(1)}set visible(t){this.setValue(1,t)}get status(){return this.getValue(2)}set status(t){this.setValue(2,t)}get isColorful(){return this.getValue(3)}set isColorful(t){this.setValue(3,t)}get isPlane(){return this.getValue(4)}set isPlane(t){this.setValue(4,t)}};var Ake=ee.of3("#999999"),uee=class{constructor(t,e,r,i,n,s,a=!1,l=!1,c,h){this.layerGroup=c;this._copperLayer=null;this._layer=null;this.ignoreForceHighLight=!1;this._isUnderGrid=!1;this.scene=t,this.layerId=e,this._order=r,this._isUnderGrid=l,this._activeColor=i,this._deactiveColor=n,this._stats=s,this.ignoreForceHighLight=a,this._copperOrder=h}get order(){return this._order}set order(t){var r,i,n;this._order=t;let e=It.getInstance().flip;(r=this._layer)==null||r.group.setPosition(new Dt(0,0,e?t:-t)),(n=(i=this._layer)==null?void 0:i.panelizePlaneGroup)==null||n.setPosition(new Dt(0,0,e?t:-t))}get copperOrder(){return this._copperOrder}set copperOrder(t){var r,i,n;this._copperOrder=t;let e=It.getInstance().flip;(r=this._copperLayer)==null||r.group.setPosition(new Dt(0,0,e?t:-t)),(n=(i=this._copperLayer)==null?void 0:i.panelizePlaneGroup)==null||n.setPosition(new Dt(0,0,e?t:-t))}set isUnderGrid(t){var e;this._isUnderGrid=t,(e=this._layer)==null||e.plane.setIsUnderGrid(this._isUnderGrid)}get isUnderGrid(){return this._isUnderGrid}get activeColor(){return this._activeColor}set activeColor(t){this._activeColor=t}get deactiveColor(){return this._deactiveColor}set deactiveColor(t){this._deactiveColor=t}get status(){return this._stats}set status(t){let e=this._stats!=t;this._stats=t,(e||this._stats.used)&&(this.syncStatus(this.layer,this._stats.state),this.syncStatus(this.copperLayer,this._stats.state))}get layer(){return this._layer==null&&(this._layer=new dz(this.scene,this._order,this._activeColor,this.layerId,this.ignoreForceHighLight,this._isUnderGrid,this.layerGroup),this._layer.setSyncViewStatusCb(()=>{this.syncStatus(this._layer,this._stats.state)}),this.syncStatus(this._layer,this._stats.state)),this._layer}get copperLayer(){return this._copperLayer==null&&(this.layerId==2||this.layerId==1)&&(this._copperOrder==null&&(this._copperOrder=this._order),this._copperLayer=new dz(this.scene,this._copperOrder,this._activeColor,this.layerId,this.ignoreForceHighLight,this._isUnderGrid,this.layerGroup),this._copperLayer.setSyncViewStatusCb(()=>{this.syncStatus(this._copperLayer,this._stats.state)}),this.syncStatus(this._copperLayer,this._stats.state)),this._copperLayer}setDeactiveAlpha(t,e){if(t==null)return;let r=e?1:this.getDeactiveColorAlpha();t.setRgbRatio(r)}syncStatus(t,e){var r,i,n,s,a,l,c;if(t!=null){let h=new gk(e);t.plane.setIsColorful(h.isColorful),(r=t.noPanelizePlane)==null||r.setIsColorful(h.isColorful),h.isColorful?(t.plane.setColor(this.getColorByStatus(h.status)),(l=t.noPanelizePlane)==null||l.setColor(this.getColorByStatus(h.status)),this.setDeactiveAlpha(t.plane,h.status),this.setDeactiveAlpha(t.noPanelizePlane,h.status)):(t.plane.setIsColorful(!0),(i=t.noPanelizePlane)==null||i.setIsColorful(!0),t.plane.setColor(this.getColorByStatus(h.status)),this.setDeactiveAlpha(t.plane,h.status),(n=t.noPanelizePlane)==null||n.setColor(this.getColorByStatus(h.status)),this.setDeactiveAlpha(t.noPanelizePlane,h.status),t.plane.setIsColorful(!1),(s=t.noPanelizePlane)==null||s.setIsColorful(!1),t.plane.setColor(Ake),(a=t.noPanelizePlane)==null||a.setColor(Ake)),this.setNetworkColor(t),this.setPlane(t,h.isPlane),t.plane.setVisible(h.visible),(c=t.noPanelizePlane)==null||c.setVisible(h.visible)}}getColorByStatus(t){return this.activeColor}getDeactiveColorAlpha(){return this.scene.getForceDeactivateRatio()<1?1:this._deactiveColor.alpha}setNetworkColor(t){let e=ee.build(1,1,1,.6);this.layerId==1001?e=t.plane.getColor():this.layerId==1003?e=ee.build(.2,.4,.8,1):this.scene.getAntialias()&&(e=ee.build(1,1,1,.8)),t.plane.setNetworkTextColor(e)}setPlane(t,e){e?t.plane.setPolygonColorAlphaRatio(.65):t.plane.setPolygonColorAlphaRatio(1)}clear(){var t,e,r,i;(t=this._layer)==null||t.plane.clear(),(e=this._layer)==null||e.setSyncViewStatusCb(null),(r=this._copperLayer)==null||r.plane.clear(),(i=this._copperLayer)==null||i.setSyncViewStatusCb(null)}};var jh=class{constructor(t,e=null){this.id=-1;this.layerId=t,e!=null&&(this._removeCb=e)}setRemoveCb(t){this._removeCb=t}get layer(){return cn.getInstance().getLayer(this.layerId).layer}getHighLightPlane(t){if(!va.useWebgl)return cn.getInstance().getHighLightPlane(t)}get plane(){return this.layer.plane}isValidId(){return this.id>=0}resetId(){this.id=-1}getPlane(t){var e,r;return(r=(e=cn.getInstance().getLayer(t))==null?void 0:e.layer)==null?void 0:r.plane}forceVisibleHighLight(t){va.engineHighlightReady&&this.isValidId()&&(t?(this.lastHighLightForce||this.plane.addHighLightPt(this.id,0,null,yP.PT),this.lastHighLightForce=!0):this.lastHighLightForce&&(this.plane.removeHighLightPt(this.id,0,null,this.lastHighLightForce?yP.PT:yP.MASK),delete this.lastHighLightForce))}highlight(t,e,r){if(va.engineHighlightReady&&this.isValidId()){let i=this.plane;t?i.addHighLightPt(this.id,e,r):i.removeHighLightPt(this.id,e,r)}}forceVisibleHighLights(t,e){va.engineHighlightReady&&this.isValidId()&&(e?(this.lastHighLightForce||this.plane.addHighLightPts(t,0,null,yP.PT),this.lastHighLightForce=!0):this.lastHighLightForce&&(this.plane.removeHighLightPts(t,0,null,this.lastHighLightForce?yP.PT:yP.MASK),delete this.lastHighLightForce))}highlights(t,e,r,i){va.engineHighlightReady&&t&&t.length>0&&(e?this.plane.addHighLightPts(t,r,i):this.plane.removeHighLightPts(t,r,i))}removeEngineGroup(t){if(t)return cn.getInstance().removeEngineGroup(t)}setEngineGroupVisible(t,e){if(t)return cn.getInstance().setEngineGroupVisible(t,e)}remove(...t){this.isValidId()&&(this._removeCb&&(this._removeCb(),this.plane.removeHighLightPt(this.id)),this.lastHighLightForce=null,this.plane.removePt(this.id)),this.resetId()}hidden(){this.isValidId()&&this.plane.hiddenPt(this.id)}show(){this.isValidId()&&this.plane.showPt(this.id)}};var Ka=class extends jh{constructor(t,e=null,r){super(t,e),r!=null&&(this.canPanelize=r)}get layer(){if(this.layerId<0){let t=cn.getInstance().getLayer(Math.abs(this.layerId));return t.copperLayer?t.copperLayer:t.layer}return cn.getInstance().getLayer(this.layerId).layer}get plane(){return this.canPanelize==null?this.layer.plane:this.layer.getCreateNoPanelizePlane()}getArcSweepAngle(t,e,r){let i=Math.PI*2;return r===ae.CCW?e>t?e-t:e-t+i:e<t?e-t:e-t-i}visible(t,e,r,i,n,s,a,l,c){this.layerId!=t&&this.remove(),!Ra.unRefreshScene&&(this.layerId=t,this.id=this.plane.createOrUpdateArc(this.id,e,r,i,n,this.getArcSweepAngle(n,s,a),l,void 0,c))}getId(){return this.id}getBBox(){return this.plane.getPtBboxById(this.id)}},ng=class extends Ka{};var Pc=12,Tc=30,vl=class extends jh{constructor(t,e=null){super(t,e)}getId(){return this.id}visible(t,e,r,i,n,s,a,l,c,h=null){if(this.layerId!=t&&this.isValidId()){let u=this.plane;this.forceVisibleHighLight(!1),u.removePt(this.id),this.resetId()}this.layerId=t,!Ra.unRefreshScene&&(this.id=this.plane.createOrUpdateNetWorkText(this.id,e,r,i,n,s,a,l,c,void 0,h))}getBBox(){return this.plane.getPtBboxById(this.id)}createMaskView(t){}};function Y0(o,t){return o?o.hasOwnProperty(t):!1}function _ke(o,t){let e;for(let r in t)if(Y0(t,r)&&o.indexOf(r)!==-1){e=!0;break}return e}function Ss(o){if(typeof o!="object"||o===null||o instanceof Date||o instanceof ArrayBuffer)return o;if(Array.isArray(o))return o.map(Ss);{let t={};for(let e in o)o.hasOwnProperty(e)&&(t[e]=Ss(o[e]));return t}}function pee(o,t){if(!o||o=="#")return null;try{return(t||document).querySelector(o)}catch{return null}}function a2(o,t){let e=[],r=[],i=[];for(let c=0,h=o.length;c<h;c++){e[c]=c;let u=(t?o[c][t]||"":o[c]).toString();if(r[c]=u.toUpperCase().match(/\D+|\d+(?:\.\d+)?/g),i[c]=[],r[c])for(let d=0;d<r[c].length;d++)i[c][d]=r[c][d].match(/\d/)?1:2}let a=function(c,h){let u=r[c],d=r[h],p=i[c],m=i[h];if(!u||!d)return u==d?0:u?1:-1;for(let g=0;g<Math.min(u.length,d.length);g++)if(u[g]!=d[g])return p[g]==1&&m[g]==1?Number(u[g])-Number(d[g]):p[g]!=1&&m[g]!=1?u[g].localeCompare(d[g]):p[g]==1?-1:1;return u.length-d.length};e.sort(a);let l=[];for(let c=0;c<o.length;c++)l[c]=o[e[c]];return l}function mTe(o){if(typeof o!="string")return o;if(o==null)return"";let t={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&apos;","&":"&amp;","&#039;":"'"};function e(r){return t[r]}return o==null?"":_ke(o,t)?(o+"").replace(/[<>'"&]/g,e):o}function vke(o){if(typeof o!="string")return o;if(o==null)return"";let t={"&lt;":"<","&gt;":">","&quot;":'"',"&apos;":"'","&amp;":"&","&#039;":"'"};function e(r){return t[r]}return _ke(o,t)?(o+"").replace(/&([^;]+);/g,e):o}function nr(o=0){return Tm()}function fee(o){function t(c){return c>=10?c:"0"+c}let e=new Date(o),r=e.getFullYear(),i=t(e.getMonth()+1),n=t(e.getDate()),s=t(e.getHours()),a=t(e.getMinutes()),l=t(e.getSeconds());return r+"-"+i+"-"+n+" "+s+":"+a+":"+l}function gTe(o,t){if(!o||Object.prototype.toString.call(o)!="[object Date]")return"";let e={"M+":o.getMonth()+1,"d+":o.getDate(),"h+":o.getHours(),"m+":o.getMinutes(),"s+":o.getSeconds(),S:o.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(/y+/,i=>(o.getFullYear()+"").slice(i.length==2?-2:0))),/(Z+)/.test(t)&&(t=t.replace(/Z+/,i=>r(o,i.length==1?":":"")));for(let i of Object.keys(e)){let n=new RegExp(i);n.test(t)&&(t=t.replace(n,s=>s.length==1?e[i]:("00"+e[i]).slice(-2)))}return t;function r(i,n){let s=-Math.round(i.getTimezoneOffset()/15)*15,a=~~(s/60),l=~~s%60,c="+";return s<0&&(c="-"),c+("00"+a).slice(-2)+n+("00"+l).slice(-2)}}function Hn(o,t){if(Array.isArray(o)){for(let e=0,r=o.length;e<r;e++)if(t(void 0,o[e],e)===!1)return}else{let e=0;for(let r in o)if(o.hasOwnProperty(r)){let i=o[r];if(t(r,i,e)===!1)return;e++}}}async function pz(o,t){if(Array.isArray(o)){for(let e=0,r=o.length;e<r;e++)if(await t(void 0,o[e],e)===!1)return}else{let e=0;for(let r in o)if(o.hasOwnProperty(r)){let i=o[r];if(await t(r,i,e)===!1)return;e++}}}function yTe(o,t){let e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);if(e){let r=e.slice(1,4).map(i=>parseInt(i,16));return t?r.map(i=>+i/255):r}}function l2(o,t){return yk(o,t,()=>[])}function yk(o,t,e){let r=o[t];return r!==void 0||(r=e(t),o[t]=r),r}function mee(o,t){if(!o||!o.length)return;let e=o.indexOf(t);if(!(e<0))return o.splice(e,1),t}function sCt(o,t=1,e=!1){if(!/^\d+$/.test(o)||!Number.isSafeInteger(t))return o;let r=BigInt(o),i=BigInt(Math.round(t)),n=r+i;if(n<0)return n.toString();if(e){let s=n.toString();return s.length>o.length?s:s.padStart(o.length,"0")}return n.toString()}function aCt(o,t="_",e=!0){if(!o)return t+"1";let r=s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`${r(t)}(\\d+)$`),n=o.match(i);if(n){let s=sCt(n[1],1,e);return o.replace(i,t+s)}else return o+t+"1"}function xke(o,t,e,r="_",i=!0){t=t||[],e&&(t=t.map(n=>n.toLowerCase()));do o=aCt(o,r,i);while(t.includes(e?o.toLowerCase():o));return t.push(o),o}function PL(o,t){let e={same:[],more:[],less:[]};return o.forEach(r=>{t.includes(r)?e.same.push(r):e.less.push(r)}),t.forEach(r=>{o.includes(r)?!e.same.includes(r)&&e.same.push(r):e.more.push(r)}),e}function fz(o,t,e,r){let i=o[t];if(o[t])i=r(o,t,i),o[t]=i;else return i=e(t),o[t]=i,i}function bTe(o,t){var r=parseFloat(o);if(isNaN(r))return!1;let e=Math.pow(10,t);var r=Math.round(o*e)/e,i=r.toString(),n=i.indexOf(".");for(n<0&&(n=i.length,i+=".");i.length<=n+t;)i+="0";return i}function Rke(o){let t=null;return()=>(t===null&&(t=o()),t)}function Dke(o){let t=o.length,e,r;for(;t;)r=Math.floor(Math.random()*t--),e=o[t],o[t]=o[r],o[r]=e;return o}function wke(o){return Object.prototype.toString.call(o).slice(8,-1).toLowerCase()==="object"}function mz(o,t={}){let e=document.createElement("span");if(e.classList.add("i18n"),e.innerHTML=mTe(o),t){let{context:r,attr:i,params:n}=t;r&&e.setAttribute("data-i18n-context",r),i&&e.setAttribute("data-i18n-attr",i),n&&Hn(n,(s,a)=>{e.setAttribute(`i18n-params-${s}`,a+"")})}return e.outerHTML}function gee(o,t=""){if(!o)return"A";let e=o.charCodeAt(o.length-1),r="";do e===90?(o=gee(o.slice(0,o.length-1),t)+"A",r="A"):r=String.fromCharCode(e+1),e=r.charCodeAt(0);while(t.includes(r));return o.slice(0,o.length-1)+r}var Lke=/^([A-Z]+)(\d+)$/;function gz(o){return new Promise(t=>{setTimeout(t,o)})}function Qg(o,t){try{o.push(...t)}catch{o=o.concat(t)}return o}function yee(o,t,e=!1){if(o.length!==t.length)return!1;if(e){let r=new Set(o),i=new Set(t);if(r.size!==i.size)return!1;for(let n of r)if(!i.has(n))return!1;return!0}else{for(let r=0;r<o.length;r++)if(o[r]!==t[r])return!1;return!0}}function PTe(o){let t=n=>/^rgba?\(\s*\d{1,3}\s*(?:,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*(?:\d*\.?\d+|\d+%)\s*)?)?\)$/.test(n)||/^rgba?\(\s*\d{1,3}\s+\d{1,3}\s+\d{1,3}\s*(?:\/\s*(?:\d*\.?\d+|\d+%)\s*)?\)$/.test(n),e=n=>/^hsla?\(\s*\d{1,3}\s*(?:,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*(?:,\s*(?:\d*\.?\d+|\d+%)\s*)?)?\)$/.test(n)||/^hsla?\(\s*\d{1,3}\s+\d{1,3}%\s+\d{1,3}%\s*(?:\/\s*(?:\d*\.?\d+|\d+%)\s*)?\)$/.test(n),r=n=>{let a=/^rgba?\(\s*(\d{1,3})\s*(?:,\s*|\s+)(\d{1,3})\s*(?:,\s*|\s+)(\d{1,3})\s*(?:,\s*(\d*\.?\d+|\d+%)\s*|\/\s*(\d*\.?\d+|\d+%)\s*)?\)$/.exec(n);if(!a)throw new Error("Invalid RGBA or RGB string");let l=parseInt(a[1],10)/255,c=parseInt(a[2],10)/255,h=parseInt(a[3],10)/255,u=1;return a[4]!==void 0?u=a[4].endsWith("%")?parseFloat(a[4])/100:parseFloat(a[4]):a[5]!==void 0&&(u=a[5].endsWith("%")?parseFloat(a[5])/100:parseFloat(a[5])),[l,c,h,u]},i=n=>{let a=/^hsla?\(\s*(\d{1,3})\s*(?:,\s*|\s+)(\d{1,3})%\s*(?:,\s*|\s+)(\d{1,3})%\s*(?:,\s*(\d*\.?\d+|\d+%)\s*|\/\s*(\d*\.?\d+|\d+%)\s*)?\)$/.exec(n);if(!a)throw new Error("Invalid HSLA or HSL string");let l=parseInt(a[1],10)/360,c=parseInt(a[2],10)/100,h=parseInt(a[3],10)/100,u=1;a[4]!==void 0?u=a[4].endsWith("%")?parseFloat(a[4])/100:parseFloat(a[4]):a[5]!==void 0&&(u=a[5].endsWith("%")?parseFloat(a[5])/100:parseFloat(a[5]));let d=(1-Math.abs(2*h-1))*c,p=d*(1-Math.abs(l*6%2-1)),m=h-d/2,g=0,y=0,b=0;return 0<=l&&l<.16666666666666666?(g=d,y=p,b=0):.16666666666666666<=l&&l<.3333333333333333?(g=p,y=d,b=0):.3333333333333333<=l&&l<.5?(g=0,y=d,b=p):.5<=l&&l<.6666666666666666?(g=0,y=p,b=d):.6666666666666666<=l&&l<.8333333333333334?(g=p,y=0,b=d):.8333333333333334<=l&&l<=1&&(g=d,y=0,b=p),g=g+m,y=y+m,b=b+m,[g,y,b,u]};if(t(o)){let n=r(o);return ee.build(n[0],n[1],n[2],n[3])}else if(e(o)){let n=i(o);return ee.build(n[0],n[1],n[2],n[3])}else{if(ee.isHexFormate(o))return ee.of3(o);throw new Error("Invalid color string")}}function Mke(o){return Object.is(o,void 0)||Object.is(o,"")||Object.is(o,null)}function Nke(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(isNaN(t))return o;if(t<=0||!o&&!e)return Math.round(o);let i=[1,10,100,1e3][t]||Math.pow(10,t)||10;if(e){let n=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*i)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(n+o)}else return Math.round(o*i+1e-10)/i}function g0(o){let t="";if(o.replace)for(let s in o.replace)t+=` i18n-params-${s}="${o.replace[s]}"`;Object.is(o.openTab,void 0)&&(o.openTab=!0);let e=o.openTab?1:2,r=[],i=[];if(Array.isArray(o.message))o.message.forEach(s=>{if(typeof s=="string")r.push(s),i.push(`<span class="i18n">${s}</span>`);else if(s.attr||s.call){let a=s.i18nContext?`data-i18n-context="${s.i18nContext}"`:"",l="";(s.i18n||a)&&(l=`<span class="i18n" ${a}>${s.text}</span>`,delete s.i18n,delete s.i18nContext),r.push(s),l?i.push(Object.assign({},s,{text:l})):i.push(s)}else{r.push(s.text);let a=s.i18nContext?`data-i18n-context="${s.i18nContext}"`:"";i.push(s.i18n||a?`<span class="i18n" ${a}>${s.text}</span>`:s.text)}});else{let s=o.i18nContext?`data-i18n-context="${o.i18nContext}"`:"";r.push({value:o.message,options:o.replace}),i.push(`<span class="i18n" ${s} ${t}>${o.message}</span>`)}let n={type:o.type||"error",msg:i,tabType:void 0};he.publish("ui/toastMsg",{type:o.type||"error",msg:o.shortMsg||r,bottomBarMsg:n},Q())}function og(o,t={},...e){o||(o=""),t=Object.assign({color:"#75de75","font-style":"italic","background-color":"#333",padding:"2px","font-size":"16px"},t),o.includes("%c")||(o="%c "+o),console.log(o,JSON.stringify(t).replace(/[\"\{\}]/g,"").replace(/,/g,";"),...e)}var bk=new Set,lCt={"data/model/ArcModel":[36,228],"data/model/LineModel":[36,220],"data/model/PolygonModel":[52,444],"data/model/ArcTrackModel":[48,252],"data/model/TrackModel":[48,224],"data/model/TextModel":[100,5256],"data/model/PadModel":[104,1688],"data/model/ViaModel":[80,264],"data/model/ComponentModel":[104,356],"editor/common/PCBRTreeItem":[24,24],"editor/shape/PcbArc":[44,44],"editor/shape/PcbLine":[44,44],"editor/shape/PcbPolygon":[64,77],"editor/shape/ArcTrack":[52,84],"editor/shape/Track":[52,84],"editor/shape/PcbText":[40,52],"editor/shape/Pad":[48,48],"editor/shape/PolygonPad":[52,52],"editor/shape/Via":[48,48],"editor/shape/Component":[52,112],"view/pcb/ArcView":[24,76],"view/pcb/LineView":[28,72],"view/pcb/PolygonView":[36,36],"view/pcb/ArcTrackView":[20,72],"view/pcb/TrackView":[20,68],"view/pcb/TextView":[24,1524],"view/pcb/PadView":[24,108],"view/pcb/PolygonPadView":[28,528],"view/pcb/ViaView":[28,152],"view/pcb/ComponentView":[16,156]},TTe=xT(),Cv=TTe.top||TTe,kke=Cv&&cCt()&&!Ra.unAmountCounts;function cCt(){let o=TTe.PRO_LOG_LEVEL;return o=="trace"||o=="debug"}function Ro(o){kke&&Cv&&(isNaN(Cv[o])?(Cv[o]=1,bk.add(o)):Cv[o]+=1)}function Bke(){bk.forEach(o=>{delete Cv[o]}),bk.clear()}function ITe(){if(!kke||bk.size==0)return;let o=0,t=0,e={};a2(Array.from(bk)).forEach(r=>{let i=Cv[r]||0,[n,s]=lCt[r]||[0,0],a=n>0,l=+(n*i/1e6).toFixed(2),c=+(s*i/1e6).toFixed(2);o+=i,t+=a?c:0,e[r]={amount:i,"pre(B)":a?[n,s].join(", "):"-","totalSelf(M)":a?l:"-","totalRetained(M)":a?c:"-"},delete Cv[r]}),bk.clear(),og("CountsAmount",{color:"#ffff00"},o,`${t.toFixed(2)}M`),console.table(e)}var G9=class{constructor(t=1){this.netDefaultColor=new Map;this.customColor=new Map;this.ratio=t,this.alpha=1,this.defaultColor=ee.of6(ee.BLACK,this.alpha*this.ratio)}getAlpha(){return this.alpha}getColor(t,e){return this.customColor.get(t)||this.netDefaultColor.get(e)||this.defaultColor}setCustomColor(t,e){this.setColor(this.customColor,t,e)}getCustomColor(t){return this.customColor.get(t)}setNetColor(t,e){this.setColor(this.netDefaultColor,t,e)}setShapeAlpha(t){this.alpha=t,this.defaultColor=ee.of6(this.defaultColor,this.alpha*this.ratio),this.modifyAlpha(this.netDefaultColor),this.modifyAlpha(this.customColor)}modifyAlpha(t){for(let[e,r]of t)t.set(e,ee.of6(r,this.alpha*this.ratio))}setColor(t,e,r){r==null?t.delete(e):t.set(e,ee.of6(r,r.alpha*this.alpha*this.ratio))}};var yz=class extends G9{constructor(e=1,r=!1){super(e);this.selectNetDefaultColor=new Map;this.selectCustomColor=new Map;this.selectNetSingleDefaultColor=new Map;this.selectSingleCustomColor=new Map;this.needSelectColor=!1;this.hasSingle=!1;this.selectRatio=1,this.selectDefaultColor=this.defaultColor,this.selectSingleDefaultColor=this.defaultColor,this.hasSingle=r,this.update()}selectOpen(){return this.needSelectColor}update(){this.needSelectColor=this.alpha!=0&&this.selectRatio!=1}getSelectAlpha(e=!1){return this.getNoSelectColor(e)?1:this.selectRatio*.5}getColor(e,r,i=!1,n=!0){return this.getNoSelectColor(i)?super.getColor(e,r):n?this.selectCustomColor.get(e)||this.selectNetDefaultColor.get(r)||this.selectDefaultColor:this.selectSingleCustomColor.get(e)||this.selectNetSingleDefaultColor.get(r)||this.selectSingleDefaultColor}setCustomColor(e,r){super.setCustomColor(e,r),this.needSelectColor&&(this.setSelectColor(this.selectCustomColor,e,r),this.hasSingle&&this.setSelectColor(this.selectSingleCustomColor,e,r,!1))}getCustomColor(e,r=!1,i=!0){return this.getNoSelectColor(r)?super.getCustomColor(e):i?this.selectCustomColor.get(e):this.selectSingleCustomColor.get(e)}setNetColor(e,r){super.setNetColor(e,r),this.needSelectColor&&(this.setSelectColor(this.selectNetDefaultColor,e,r),this.hasSingle&&this.setSelectColor(this.selectNetSingleDefaultColor,e,r,!1))}getNoSelectColor(e=!1){return e==!1||this.needSelectColor==!1}setShapeAlpha(e){if(!isNaN(e)){let r=e!=this.alpha;super.setShapeAlpha(e),r&&this.updateSelect()}this.update()}setSelectAlpha(e){isNaN(e)||this.selectRatio!=e&&(this.selectRatio=e,this.updateSelect()),this.update()}updateSelect(){this.selectRatio==1?this.clearSelect():(this.selectDefaultColor=ee.of6(this.selectDefaultColor,this.getColorAlpha()),this.modifySelectAlpha(this.selectNetDefaultColor),this.modifySelectAlpha(this.selectCustomColor),this.hasSingle&&(this.selectSingleDefaultColor=ee.of6(this.selectDefaultColor,this.getColorAlpha(!1)),this.modifySelectAlpha(this.selectNetDefaultColor,!1),this.modifySelectAlpha(this.selectCustomColor,!1)),this.update())}getColorAlpha(e=!0){return e?this.alpha*this.ratio*this.selectRatio*.5:this.alpha*this.ratio*this.selectRatio}clearSelect(){this.selectNetDefaultColor.clear(),this.selectCustomColor.clear()}modifySelectAlpha(e,r=!0){for(let[i,n]of e)e.set(i,ee.of6(n,this.getColorAlpha(r)))}setSelectColor(e,r,i,n=!0){i==null?e.delete(r):e.set(r,ee.of6(i,this.getColorAlpha(n)))}};var TL=class TL{constructor(){this.padConfig=new yz(void 0,!0);this.viaConfig=new yz;this.trackConfig=new G9;this.textConfig=new G9;this.readonlyPadConfig=new G9(.5);this.readonlyViaConfig=new G9(.5);this.readonlyTrackConfig=new G9(.5)}static getInstance(){return TL.ins==null&&(TL.ins=new TL),TL.ins}selectOpen(){return this.padConfig.selectOpen()}doAction(t,e){this.padConfig.setNetColor(t,e),this.viaConfig.setNetColor(t,e),this.trackConfig.setNetColor(t,e),this.readonlyPadConfig.setNetColor(t,e),this.readonlyViaConfig.setNetColor(t,e),this.readonlyTrackConfig.setNetColor(t,e)}};TL.ins=null;var uo=TL;var IL=class IL{constructor(){this._padShowNet=!0;this._padShowNum=!0;this._trackShowNet=!0;this._viaShowNet=!0;this._viaShowPair=!0}static getInstance(){return IL.config==null&&(IL.config=new IL),IL.config}get padShowNet(){return this._padShowNet}set padShowNet(t){this._padShowNet=t}get padShowNum(){return this._padShowNum}set padShowNum(t){this._padShowNum=t}get trackShowNet(){return this._trackShowNet}set trackShowNet(t){this._trackShowNet=t}get viaShowPair(){return this._viaShowPair}set viaShowPair(t){this._viaShowPair=t}get viaShowNet(){return this._viaShowNet}set viaShowNet(t){this._viaShowNet=t}};IL.config=null;var ea=IL;var Do=class{get highLightType(){var t;return(t=this._viewDataModel)==null?void 0:t.highLightType}get lastHighLightColor(){return this._lastHighLightColor||ee.BLACK}set lastHighLightColor(t){this._lastHighLightColor=t}get manualHighLight(){var t;return(t=this._viewDataModel)==null?void 0:t.manualHighLight}get manualHighLightModified(){var t;return(t=this._viewDataModel)==null?void 0:t.manualHighLightModified}get layerModified(){var t;return(t=this._viewDataModel)==null?void 0:t.layerModified}get shapeModified(){var t;return(t=this._viewDataModel)==null?void 0:t.shapeModified}get netModified(){var t;return(t=this._viewDataModel)==null?void 0:t.netModified}resetHighLightState(){this.lastHighLightType=null}get highlightColor(){var t;return(t=this._viewDataModel)==null?void 0:t.highlightColor}get viewGroupId(){return this.engineGroupId}getEngineGroupId(t){if(t)return cn.getInstance().getEngineGroupId(t)}get viewGroupIdModified(){var t;return(t=this._viewDataModel)==null?void 0:t.viewGroupIdModified}get forceUpdateMask(){var t;return(t=this._viewDataModel)==null?void 0:t.forceUpdateMask}mainMaskHighLightColor(t,e,r,i){!t||!e&&this.lastHighLightType==r||(this.lastHighLightType!=null&&t.highlight(!1,this.lastHighLightType,this.lastHighLightColor),r!=null&&t.highlight(!0,r,i),this.lastHighLightType=r,this.lastHighLightColor=i)}mainsMaskHighLightColor(t,e,r,i){if(t!=null&&t.length&&!(!e&&this.lastHighLightType==r)){if(this.lastHighLightType!=null)for(let s of t)s.highlight(!1,this.lastHighLightType,this.lastHighLightColor);if(r!=null)for(let s of t)s.highlight(!0,r,i);this.lastHighLightType=r,this.lastHighLightColor=i}}isWebglEnv(){return va.useWebgl}setDataModel(t){this._viewDataModel=t}getDataModel(){return this._viewDataModel}modify(t,e,...r){this.setDataModel(t)}remove(){}};var bz=class o extends Do{constructor(){super(),Ro("view/pcb/ArcTrackView")}get highLightType(){var t;return(t=o._viewDataModel)==null?void 0:t.highLightType}get manualHighLight(){var t;return(t=o._viewDataModel)==null?void 0:t.manualHighLight}get manualHighLightModified(){var t;return(t=o._viewDataModel)==null?void 0:t.manualHighLightModified}get layerModified(){var t;return(t=o._viewDataModel)==null?void 0:t.layerModified}get shapeModified(){var t;return(t=o._viewDataModel)==null?void 0:t.shapeModified}get netModified(){var t;return(t=o._viewDataModel)==null?void 0:t.netModified}get highlightColor(){var t;return(t=o._viewDataModel)==null?void 0:t.highlightColor}get viewGroupIdModified(){var t;return(t=o._viewDataModel)==null?void 0:t.viewGroupIdModified}get forceUpdateMask(){var t;return(t=o._viewDataModel)==null?void 0:t.forceUpdateMask}get layerId(){var t;return(t=o._viewDataModel)==null?void 0:t.layerId}get net(){var t;return(t=o._viewDataModel)==null?void 0:t.net}get showNet(){return o._viewDataModel.showNet}get width(){var t;return(t=o._viewDataModel)==null?void 0:t.width}get shouldShowNet(){return ea.getInstance().trackShowNet}get color(){return o._viewDataModel.partition==R.getInstance().partitionId?uo.getInstance().trackConfig.getColor(o._viewDataModel.globalIndex,this.showNet):uo.getInstance().readonlyTrackConfig.getColor(o._viewDataModel.globalIndex,this.showNet)}get center(){var t;return(t=o._viewDataModel)==null?void 0:t.center}get radius(){var t;return(t=o._viewDataModel)==null?void 0:t.radius}get startAngle(){var t;return(t=o._viewDataModel)==null?void 0:t.startAngle}get endAngle(){var t;return(t=o._viewDataModel)==null?void 0:t.endAngle}get sweep(){var t;return(t=o._viewDataModel)==null?void 0:t.sweep}get midPoint(){let t=this.startAngle,e=this.endAngle,r=this.sweep,i=this.center,n=this.radius;if(r==ae.CCW)if(e>t){let s=(e-t)/2+t;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new S(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(e+kr-t)/2+t;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}}else if(e>t){let s=(t+kr-e)/2+e;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new S(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(t-e)/2+e;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}}}get length(){let t=0;return this.sweep==ae.CCW?t=(this.endAngle-this.startAngle+kr)%kr:t=(this.startAngle-this.endAngle+kr)%kr,t*this.radius}getAngle(){let t=this.midPoint.sub(this.center).normalize(),e=Math.atan2(t.x,-t.y);return e<-Go?e+=Math.PI:e>Go&&(e-=Math.PI),e}mainVisible(){let t=this.layerId,e=this.color,r=!1,i=!this.main||!1;if(this.main)this.layerModified&&(this.mainRemove(),i=!0);else{let n=this.resetHighLightState;this.main=new ng(t,n),i=!0}i||(i=this.shapeModified),(i||this.viewGroupIdModified||!e.equals(this._lastLineColor))&&(i=!0,this._lastLineColor=e),this.shouldShowNet&&this.showNet?(r=!this.netView||i||this.netModified,this.netView||(this.netView=new vl(t),r=!0),r&&(r=!0)):this.removeNetView(),this.show(i,r,e),this.netView&&this.netView.forceVisibleHighLight(this.manualHighLight),this.main.forceVisibleHighLight(this.manualHighLight)}show(t,e,r){if(t||e){let{layerId:i,showNet:n,center:s,radius:a,width:l,startAngle:c,endAngle:h,sweep:u,engineGroupId:d}=this;t&&this.main.visible(i,s,a,l,c,h,u,r,d),e&&this.netView.visible(i,n,this.midPoint,this.getAngle(),Pc,Tc,this.length,l,void 0,this.viewGroupId)}}maskVisible(t,e=!1){if(!this.main)return;let r=this.highlightColor||this.color;if(this.isWebglEnv()){if(t){let i=this.highlightColor||this.color;this.mask||(this.mask=new Ka(1002)),this.mask.visible(1002,this.center,this.radius,this.width,this.startAngle,this.endAngle,this.sweep,i,null)}else this.mask&&(this.mask.remove(),delete this.mask);return}this.mainMaskHighLightColor(this.main,e,t?this.highLightType:null,r)}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0,this.forceUpdateMask)}modify(t,e){switch(o._viewDataModel=t,e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}mainRemove(){var t;this.maskVisible(!1,!0),(t=this.main)==null||t.remove()}removeNetView(){this.netView&&(this.netView.remove(),delete this.netView)}remove(){this.mainRemove(),this.removeNetView()}};var ty=class extends jh{visible(t,e,r,i,n,s,a,l){this.layerId!=t&&this.remove(),this.layerId=t,a=a==null?ee.BLACK:a,!Ra.unRefreshScene&&(this.id=this.plane.createOrUpdateArcSegment(this.id,e,r,i,n,s,a,void 0,l))}},U9=class extends ty{};var eI=class extends Do{get lineColor(){var t;return((t=this._viewDataModel)==null?void 0:t.lineColor)||ee.WHITE}get lineSolid(){return this._lineSolid==null?!0:this._lineSolid}set lineSolid(t){this._lineSolid==null&&t||(this._lineSolid=t)}get isPixel(){var t;return((t=this._viewDataModel)==null?void 0:t.isPixel)||!1}lineType(t,e=.01){return this.isPixel||t<e?"lineSegment":"line"}modify(t,e){super.modify(t,e),this.lineSolid=t.lineSolid}};var Pz=class extends eI{constructor(){super(),Ro("view/pcb/ArcView")}get layerId(){var t;return(t=this._viewDataModel)==null?void 0:t.layerId}get center(){var t;return(t=this._viewDataModel)==null?void 0:t.center}get radius(){var t;return(t=this._viewDataModel)==null?void 0:t.radius}get startAngle(){var t;return(t=this._viewDataModel)==null?void 0:t.startAngle}get endAngle(){var t;return(t=this._viewDataModel)==null?void 0:t.endAngle}get sweep(){var t;return(t=this._viewDataModel)==null?void 0:t.sweep}get width(){var t;return(t=this._viewDataModel)==null?void 0:t.width}get length(){var t;return(t=this._viewDataModel)==null?void 0:t.length}get color(){var t;return(t=this._viewDataModel)==null?void 0:t.color}lineTypeChanged(t){return t=="lineSegment"?this.main&&this.main instanceof Ka:this.main&&this.main instanceof ty}shapeVisible(t,e,r){t&&(t instanceof Ka?t.visible(e,this.center,this.radius,this.width,this.startAngle,this.endAngle,this.sweep,r,this.viewGroupId):t.visible(e,this.center,this.radius,this.startAngle,this.endAngle,this.sweep,r,this.viewGroupId))}mainVisible(){let t=this.layerId,e=!1;this.main&&this.layerModified&&(this.mainRemove(),e=!0);let r=this.lineType(this.width);if(!this.main||this.lineTypeChanged(r)){if(this.mainRemove(),r=="line"){let s=this.resetHighLightState;this.main=new ng(t,s)}else{let s=this.resetHighLightState;this.main=new U9(t,s)}e=!0}let i=this.lineColor,n=!i.equals(this._lastLineColor);e||(e=this.shapeModified||this.viewGroupIdModified||n),e&&(this.shapeVisible(this.main,this.layerId,this.lineColor),this._lastLineColor=i),this.main.forceVisibleHighLight(this.manualHighLight)}maskVisible(t,e=!1){var i;if(!this.main)return;let r=this.highlightColor||this.color;if(this.isWebglEnv()){if(!t){this._mask&&(this._mask.remove(),delete this._mask);return}(this.shapeModified||!this._mask)&&((i=this._mask)==null||i.remove(),this.lineType(this.width)=="line"?this._mask=new Ka(1002):this._mask=new ty(1002)),this.shapeVisible(this._mask,1002,r);return}this.mainMaskHighLightColor(this.main,e,t?this.highLightType:null,r)}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0,this.forceUpdateMask)}modify(t,e){super.modify(t,e);let{lineSolid:r}=t;if(this.lineSolid=r,this.radius==0||this.length==0){this.mainRemove();return}switch(e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}mainRemove(){var t;this.maskVisible(!1,!0),(t=this.main)==null||t.remove()}remove(){this.mainRemove()}};var ta=class extends jh{constructor(t,e=null,r){super(t,e),r!=null&&(this.canPanelize=r)}get plane(){return this.canPanelize==null?this.layer.plane:this.layer.getCreateNoPanelizePlane()}visible(t,e,r,i,n){this.layerId!=t&&this.remove(),this.layerId=t,!Ra.unRefreshScene&&(this.id=this.plane.createOrUpdateCircle(this.id,e,r,i,void 0,n))}},H9=class extends ta{};var bee=class extends jh{visible(t,e,r,i,n,s){this.layerId!=t&&this.remove(),this.layerId=t,!Ra.unRefreshScene&&(this.id=this.plane.createOrUpdateSemicircle(this.id,e,r,i,n,void 0,s))}};var Tz=class extends Do{constructor(){super(...arguments);this.hole=new bee(47);this.cushions=[new ta(12)]}get wireViewGroupId(){var e;return this.getEngineGroupId((e=this._viewDataModel)==null?void 0:e.wireViewGroupId)}get net(){var e;return(e=this._viewDataModel)==null?void 0:e.net}get center(){var e;return(e=this._viewDataModel)==null?void 0:e.center}get radius(){var e;return(e=this._viewDataModel)==null?void 0:e.radius}get holeRadius(){var e;return(e=this._viewDataModel)==null?void 0:e.holeRadius}get startLayerId(){var e;return(e=this._viewDataModel)==null?void 0:e.startLayer}get endLayerId(){var e;return(e=this._viewDataModel)==null?void 0:e.endLayer}get topExpansion(){var r;return[this.startLayerId,this.endLayerId].includes(1)?(r=this._viewDataModel)==null?void 0:r.topExpansion:-1e3}get bottomExpansion(){var r;return[this.startLayerId,this.endLayerId].includes(2)?(r=this._viewDataModel)==null?void 0:r.bottomExpansion:-1e3}get color(){return this._viewDataModel.partition==R.getInstance().partitionId?uo.getInstance().viaConfig.getColor(this._viewDataModel.globalIndex,this._viewDataModel.net):uo.getInstance().readonlyViaConfig.getColor(this._viewDataModel.globalIndex,this._viewDataModel.net)}get showNet(){return ea.getInstance().viaShowNet}get layerPairStr(){var e;return(e=this._viewDataModel)==null?void 0:e.layerPairStr}get highlightByComponent(){var e;return(e=this._viewDataModel)==null?void 0:e.highlightByComponent}get usedLayers(){var e;return(e=this._viewDataModel)==null?void 0:e.usedLayers}get allLayers(){var e;return(e=this._viewDataModel)==null?void 0:e.allLayers}get unusedInnerLayers(){var e;return(e=this._viewDataModel)==null?void 0:e.unusedInnerLayers}get radiusModified(){var e;return(e=this._viewDataModel)==null?void 0:e.radiusModified}get holeRadiusModified(){var e;return(e=this._viewDataModel)==null?void 0:e.holeRadiusModified}get topExpansionModified(){var e;return(e=this._viewDataModel)==null?void 0:e.topExpansionModified}get bottomExpansionModified(){var e;return(e=this._viewDataModel)==null?void 0:e.bottomExpansionModified}get holeViewGroupId(){var e;return(e=this._viewDataModel)==null?void 0:e.holeViewGroupId}getFontPosition(e,r){return e!=""&&r!=""?1:e!=""&&r==""?2:e==""&&r!=""?2:3}createNetAndLayerPairView(){let e=47,r=this.showNet?this.net:"",i=this.layerPairStr,n=!1;if(r?this._netView||(this._netView=new vl(e),n=!0):this.removeNetView(),i?this._layerPair||(this._layerPair=new vl(e)):this.removeLayerPairView(),!this._netView&&!this._layerPair)return;let a=this.shapeModified||this.holeRadiusModified||this.radiusModified||this.netModified||n,l=a||this._lastLayerPairStr!=i;if(!(a||l)){this._netView&&this._netView.forceVisibleHighLight(this.manualHighLight),this._layerPair&&this._layerPair.forceVisibleHighLight(this.manualHighLight);return}let c=this.wireViewGroupId,h=this.center,u=0,d=this.radius*2,p=this.holeRadius*2,m=this.getFontPosition(r,i),g=h,y=h;if(m==1){let b=p*.25;g=new S(h.x,h.y-b),y=new S(h.x,h.y+b),p*=.5}this._netView&&a&&this._netView.visible(e,r,g,u,Pc,Tc,d,p,null,c),this._netView&&this._netView.forceVisibleHighLight(this.manualHighLight),this._layerPair&&l&&(this._layerPair.visible(e,i,y,u,Pc,Tc,d,p,null,c),this._lastLayerPairStr=i),this._layerPair&&this._layerPair.forceVisibleHighLight(this.manualHighLight)}cushionVisible(){var s;let e=this.unusedInnerLayers.length>0?this.usedLayers:[12],r=this.shapeModified||this.radiusModified||this.viewGroupIdModified,i=this.color;if(r||(r=e.toString()!=((s=this._lastCushionLayerIds)==null?void 0:s.toString())||!i.equals(this._lastColor)),!r){for(let a=0;a<Math.max(this.cushions.length,e.length);a++)this.cushions[a]&&this.cushions[a].forceVisibleHighLight(this.manualHighLight);return}let n=this.wireViewGroupId;for(let a=0;a<Math.max(this.cushions.length,e.length);a++){if(!e[a]){this.removeLastMaskShape(this.cushions[a]);continue}this.cushions[a]||(this.cushions[a]=new ta(e[a])),this.cushions[a].visible(e[a],this.center,this.radius,this.color,n),this.cushions[a].forceVisibleHighLight(this.manualHighLight)}this.cushions.length=e.length,this._lastCushionLayerIds=e,this._lastColor=i}mainVisible(){this.createNetAndLayerPairView();let e=this.shapeModified||this.radiusModified||this.viewGroupIdModified,r=e||this.topExpansionModified,i=this.topExpansion+this.radius,n=this.wireViewGroupId;i>0?(this._expansionTop||(this._expansionTop=new ta(5),r=!0),r&&this._expansionTop.visible(5,this.center,i,ee.BLACK,n),this._expansionTop.forceVisibleHighLight(this.manualHighLight)):this.removeExpansionTop(),this.cushionVisible();let s=e||this.bottomExpansionModified,a=this.bottomExpansion+this.radius;a>0?(this._expansionBot||(this._expansionBot=new ta(6),s=!0),s&&this._expansionBot.visible(6,this.center,a,ee.BLACK,n),this._expansionBot.forceVisibleHighLight(this.manualHighLight)):this.removeExpansionBot();let l=e||this.holeRadiusModified,c=cn.getInstance().getLayer(this.startLayerId).activeColor,h=cn.getInstance().getLayer(this.endLayerId).activeColor;if(l||(l=!c.equals(this._lastStartColor)||!h.equals(this._lastEndColor)),l){let p=this.getEngineGroupId(this.holeViewGroupId);this.hole.visible(47,this.center,this.holeRadius,c,h,p),this._lastStartColor=c,this._lastEndColor=h}this.hole.forceVisibleHighLight(this.manualHighLight);let u=12,d=!1;if(!this.maskShape){let p=this.resetHighLightState;this.maskShape=new H9(u,p),d=!0}(d||e||r||s)&&this.maskShape.visible(u,this.center,this.radius+this.getMaxExpansion(),ee.of6(ee.BLACK,1e-6),this.viewGroupId)}getMaxExpansion(){return Math.max(0,this.topExpansion,this.bottomExpansion)}maskVisible(e,r=!1){if(!this.maskShape)return;if(this.isWebglEnv()){let n=this.highlightColor||ee.BLACK;if(!e){this._mask&&(this._mask.remove(),delete this._mask);return}let s=Math.max(this.radius,this.holeRadius)+Math.max(this.topExpansion,this.bottomExpansion,0);this._mask||(this._mask=new ta(1002)),this._mask.visible(1002,this.center,s,n,null);return}let i=this.forceUpdateMask?this.highlightColor:ee.of6(ee.BLACK,1e-6);this.mainMaskHighLightColor(this.maskShape,r,e?this.highLightType:null,i)}removeLastMaskShape(e){e&&e.remove()}componentMaskVisible(e){e&&this.highlightByComponent?(this._maskByComponent||(this._maskByComponent=new ta(1002)),this._maskByComponent.visible(1002,this.center,this.radius+Math.max(this.topExpansion,this.bottomExpansion,0),ee.BLACK,null)):this._maskByComponent&&(this._maskByComponent.remove(),delete this._maskByComponent)}visible(){this.maskVisible(!1,!0),this.mainVisible(),this.componentMaskVisible()}highlight(){this.maskVisible(!1,!0),this.mainVisible(),this.maskVisible(!0,this.forceUpdateMask),this.componentMaskVisible()}modify(e,r){switch(super.modify(e,r),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){this.maskVisible(!1,!0),this.removeLastMaskShape(this.hole),this.cushions.forEach(e=>this.removeLastMaskShape(e)),this.removeExpansionTop(),this.removeExpansionBot(),this.removeNetView(),this.removeLayerPairView(),this.removeMaskShape()}removeNetView(){this._netView&&(this._netView.remove(),delete this._netView)}removeLayerPairView(){this._layerPair&&(this._layerPair.remove(),delete this._layerPair)}removeExpansionTop(){this._expansionTop&&(this.removeLastMaskShape(this._expansionTop),delete this._expansionTop)}removeExpansionBot(){this._expansionBot&&(this.removeLastMaskShape(this._expansionBot),delete this._expansionBot)}removeMaskShape(){this.maskShape&&(this.maskShape.remove(),delete this.maskShape)}};var CL=118.11,cb=.1/10,wo=new dt().conversion("mm","mil",1)/10,CKt=3.6*wo,SKt={M2:7.874,M3:11.811,M4:15.748,M5:19.685,M6:23.622},Tee=90,EKt=new nn(39.37,10).ratio,Ov={M2:{holeDiameterWithoutSpigot:1.8*wo,holeDiameterWithSpigot:2.2*wo,topStiffWidth:3*wo,botStiffWidth:5*wo,topStiffDistance:2*wo,stiffThickness:1.2*wo,screwheadHeight:2.5*wo,screwheadDiameter:4*wo,thickness:1.27*wo},M3:{holeDiameterWithoutSpigot:2.8*wo,holeDiameterWithSpigot:3.2*wo,topStiffWidth:3*wo,botStiffWidth:5*wo,topStiffDistance:2*wo,stiffThickness:1.2*wo,screwheadHeight:3.2*wo,screwheadDiameter:5.8*wo,thickness:1.27*wo},M4:{holeDiameterWithoutSpigot:3.8*wo,holeDiameterWithSpigot:4.2*wo,topStiffWidth:3*wo,botStiffWidth:5*wo,topStiffDistance:2*wo,stiffThickness:1.5*wo,screwheadHeight:4.2*wo,screwheadDiameter:7.5*wo,thickness:1.27*wo},M5:{holeDiameterWithoutSpigot:4.8*wo,holeDiameterWithSpigot:5.2*wo,topStiffWidth:3*wo,botStiffWidth:6*wo,topStiffDistance:3*wo,stiffThickness:1.5*wo,screwheadHeight:5.2*wo,screwheadDiameter:9*wo,thickness:1.27*wo},M6:{holeDiameterWithoutSpigot:5.8*wo,holeDiameterWithSpigot:6.2*wo,topStiffWidth:3*wo,botStiffWidth:6*wo,topStiffDistance:3*wo,stiffThickness:2*wo,screwheadHeight:6.2*wo,screwheadDiameter:10.5*wo,thickness:1.27*wo}};var Iz=class{updatePropsBySpecification(t,e,r,i){let n=Ov[e];if(e!=="Custom"&&n){let s=this.specificationToProps(n,t.height,i);t.thickness=s.thickness,t.holeDiameter=s.holeDiameter,r?t.stiffenerProps=s.stiffenerProps:t.stiffenerProps=null,i?t.counterboreProps=s.counterboreProps:t.counterboreProps=null}}specificationToProps(t,e,r){return{thickness:t.thickness,holeDiameter:r?t.holeDiameterWithSpigot:t.holeDiameterWithoutSpigot,counterboreProps:{height:t.screwheadHeight,diameter:t.screwheadDiameter},stiffenerProps:{topWidth:t.topStiffWidth,bottomWidth:t.botStiffWidth,height:e-t.topStiffDistance,stiffThickness:t.stiffThickness}}}getSpecificationByFuzzyMatch(t){let{needCounterbore:e,holeDiameter:r,height:i}=t,n,s=Number.MAX_VALUE,a=Ov;return Object.keys(a).map(l=>{let{holeDiameterWithSpigot:c,holeDiameterWithoutSpigot:h}=a[l],d=Math.abs((e?c:h)-r);d<s&&(s=d,n=l)}),this.specificationToProps(Ov[n],i,e)}getScrewPillarSize(t){let{holeDiameter:e,counterboreProps:r,stiffenerProps:i}=t,n=e/2,s=n;r&&(s=r.diameter/2);let a=0,l=0;return i&&(a=Math.max(i.topWidth,i.bottomWidth)+n,l=i.stiffThickness),{innerRadius:n,outerRadius:s,stiffToCenterLength:a,stiffStrokeWidth:l}}},xP=new Iz;var Ds=class extends jh{constructor(t,e=null,r){super(t,e),r!=null&&(this.canPanelize=r)}get plane(){return this.canPanelize==null?this.layer.plane:this.layer.getCreateNoPanelizePlane()}getPlane(){let t=this._highLightType;return isNaN(t)?this.plane:this.getHighLightPlane(t)}get layer(){if(this.layerId<0){let t=cn.getInstance().getLayer(Math.abs(this.layerId));return t.copperLayer?t.copperLayer:t.layer}return cn.getInstance().getLayer(this.layerId).layer}visible(t,e,r,i,n,s,a){(this.layerId!=t||!isNaN(a)&&this._highLightType!=a)&&this.remove(),!Ra.unRefreshScene&&(this.layerId=t,this._highLightType!=a&&(this._highLightType=a),this.id=this.getPlane().createOrUpdateLine(this.id,e,r,i,y2e.ROUND,n,void 0,s))}remove(){this.isValidId()&&(this._removeCb&&(this._removeCb(),this.plane.removeHighLightPt(this.id),this.lastHighLightForce=null),this.getPlane().removePt(this.id)),this.resetId()}getBBox(){return this.plane.getPtBboxById(this.id)}getId(){return this.id}},ld=class extends Ds{};var Ic=class extends jh{visible(t,e,r,i,n,s,a,l){this.layerId!=t&&this.remove(),this.layerId=t,a=a==null?ee.BLACK:a,!Ra.unRefreshScene&&(this.id=this.plane.createOrUpdateLineSegment(this.id,e,r,i,n,s,a,void 0,l))}},Av=class extends Ic{};var cd=class o{constructor(){this.groupID=null;this.watcher=null}setWatcher(t){this.watcher=t}setGroupID(t){this.groupID=t}clone(){return new o}toJSON(){return{}}};var Iee=.1/10,y0=class o extends cd{constructor(e,r,i,n,s){super();this._pushCoverDir=1;this._topInnerHeight=new dt().conversion("mm","mil",0)/10;this._bottomInnerHeight=new dt().conversion("mm","mil",0)/10;this._type=e,this._shellHeight=r,this._isDftSubstrateHeight=i===0,this._botShellHeight=n===0?r*2/3:n,this._botShellHeight=Math.max(this._botShellHeight,Iee);let a={shellHeight:r,botShellHeight:this._botShellHeight},l=this.getDefaultSubstrateHeight(e,a);this._substrateHeight=i===0?l:i,this._isDftBotShellHeight=n===0,this._shellThickness=s,this._topShellHeight=this._shellHeight-this._botShellHeight}getDefaultSubstrateHeight(e,r){let i=new dt().conversion("mm","mil",2)/10,{shellHeight:n,botShellHeight:s}=r;return e==="T&B"&&typeof s=="number"?s-i:e==="DRAWER"&&typeof n=="number"?n*2/3-i:0}get type(){return this._type}set type(e){let r=this._type;if(this._type=e,r==="DRAWER"&&e==="T&B"&&(isNaN(this._botShellHeight)||this._botShellHeight<Iee||this._botShellHeight>this.shellHeight)){let i=this.shellHeight*2/3;this._botShellHeight=Math.max(i,Iee)}}get shellHeight(){return this._shellHeight}set shellHeight(e){if(this._shellHeight=e,this._isDftSubstrateHeight){let r={shellHeight:e,botShellHeight:e*2/3},i=this.getDefaultSubstrateHeight(this.type,r);this._substrateHeight=i}if(this._isDftBotShellHeight){let r=e*2/3;this._botShellHeight=Math.max(r,Iee)}this._topShellHeight=this._shellHeight-this._botShellHeight,this._topInnerHeight>0&&(this._topInnerHeight=this.getTopInnerHeight(this._topInnerHeight,this._botShellHeight,this._shellThickness),this._bottomInnerHeight=0),this._bottomInnerHeight>0&&(this._bottomInnerHeight=this.getBottomInnerHeight(this._bottomInnerHeight,this._topShellHeight,this._shellThickness),this._topInnerHeight=0)}getTopInnerHeight(e,r,i){let n=r-i;return n<0?e:e<0?0:e>n?n:e}getBottomInnerHeight(e,r,i){let n=r-i;return n<0?e:e<0?0:e>n?n:e}get substrateHeight(){return this._substrateHeight}set substrateHeight(e){this._substrateHeight=e,this._isDftSubstrateHeight=!1}get botShellHeight(){return this._botShellHeight}set botShellHeight(e){this._botShellHeight=e,this._topShellHeight=this._shellHeight-e,this._isDftBotShellHeight=!1,this.topInnerHeight>0&&(this.topInnerHeight=this.getTopInnerHeight(this.topInnerHeight,this._botShellHeight,this._shellThickness)),this.bottomInnerHeight>0&&(this.bottomInnerHeight=this.getBottomInnerHeight(this.bottomInnerHeight,this._topShellHeight,this._shellThickness))}get topShellHeight(){return this._topShellHeight}set topShellHeight(e){this._topShellHeight=e,this._botShellHeight=this._shellHeight-e,this.topInnerHeight>0&&(this.topInnerHeight=this.getTopInnerHeight(this.topInnerHeight,this._botShellHeight,this._shellThickness)),this.bottomInnerHeight>0&&(this.bottomInnerHeight=this.getBottomInnerHeight(this.bottomInnerHeight,this._topShellHeight,this._shellThickness))}get pushCoverDir(){return this._pushCoverDir}set pushCoverDir(e){this._pushCoverDir=e}get topInnerHeight(){return this._topInnerHeight}set topInnerHeight(e){e<0||(this._topInnerHeight=this.getTopInnerHeight(e,this.botShellHeight,this.shellThickness),this._topInnerHeight>0&&(this._bottomInnerHeight=0))}get bottomInnerHeight(){return this._bottomInnerHeight}set bottomInnerHeight(e){e<0||(this._bottomInnerHeight=this.getBottomInnerHeight(e,this._topShellHeight,this._shellThickness),this._bottomInnerHeight>0&&(this._topInnerHeight=0))}get shellThickness(){return this._shellThickness}set shellThickness(e){this._shellThickness=e,this._topInnerHeight>0&&(this._topInnerHeight=this.getTopInnerHeight(this._topInnerHeight,this._botShellHeight,this._shellThickness),this._bottomInnerHeight=0),this._bottomInnerHeight>0&&(this._bottomInnerHeight=this.getBottomInnerHeight(this._bottomInnerHeight,this._topShellHeight,this._shellThickness),this._topInnerHeight=0)}get isDftBotShellHeight(){return this._isDftBotShellHeight}get isDftSubstrateHeight(){return this._isDftSubstrateHeight}getAttrs(){let[e,r,i,n,s]=[this._shellThickness,this.botShellHeight,this.topInnerHeight,this.bottomInnerHeight,this.pushCoverDir];switch(this._type){case"DRAWER":return{Thickness:e,Direction:s};case"T&B":return{Thickness:e,BottomHeight:r,TopInnerHeight:i,BottomInnerHeight:n}}}getShowType(){switch(this.type){case"DRAWER":return"Push cover";case"T&B":return"Upper and lower shell"}}toJSON(){return{type:this.type,botShellHeight:this.botShellHeight,isDftBotShellHeight:this.isDftBotShellHeight,isDftSubstrateHeight:this.isDftSubstrateHeight,shellHeight:this.shellHeight,shellThickness:this.shellThickness,substrateHeight:this.substrateHeight,pushCoverDir:this.pushCoverDir,topInnerHeight:this.topInnerHeight,bottomInnerHeight:this.bottomInnerHeight}}clone(){return new o(this.type,this.shellHeight,this.substrateHeight,this.botShellHeight,this.shellThickness)}};var Cee=null,ETe=new ArrayBuffer(8),CTe=new Float64Array(ETe),STe=new Uint32Array(ETe),Fke=new Uint16Array(ETe);function Er(o,t,e=0,r=o.length){i(o,null,t,e,r);function i(s,a,l,c,h){let u,d,p,m;if(c<h-1){let g=h-c;if(g>50)a===null&&(a=new Array(g+1)),n(s,a,l,c,(c+h)/2|0,h);else{u=s[c],d=c,p=c,m=h;let y=d+1;for(;y<m;){if(p!=m){if(m=m+-1,l(u,s[m])<=0)continue;s[p]=s[m],p=m;continue}if(l(u,s[y])>=0){d=y,y=d+1;continue}s[p]=s[y],d=y,p=y,y=d+1}s[p]=u,i(s,a,l,c,p),i(s,a,l,p+1,h)}}}function n(s,a,l,c,h,u){i(s,a,l,c,h),i(s,a,l,h,u);for(var d=c,p=h,m=0,g=s[d],y=s[p];d<h&&p<u;){var b=l(g,y);isNaN(b)?(a[m++]=y,y=s[++p]):(b<=0&&(a[m++]=g,g=s[++d]),b>=0&&(a[m++]=y,y=s[++p]))}for(;d<h;d++)a[m++]=s[d];for(;p<u;p++)a[m++]=s[p];for(d=c,p=0;p<m;d++,p++)s[d]=a[p]}}var xe=class{static repeat(t,e){let r=new Array(e);for(;e-- >0;)r[e]=t;return r.join("")}static lpad(t,e,r){let i=r-t.length;return i>0?this.repeat(e,i)+t:t}static rpad(t,e,r){let i=r-t.length;return i>0?t+this.repeat(e,i):t}static strHashcode(t){if(t.length>0){let e=0;for(let r=0;r<t.length;r++)e=31*e+t.charCodeAt(r)|0;return e}else return 0}static arraycopy(t,e,r,i,n){if(t.length>=e+n&&r.length>=i+n)for(;n-- >0;)r[i++]=t[e++];else throw new Error("arraycopy out of range")}static undefAsNull(t){return null}static reverse(t,e){for(let r=0,i=t.length-1;i>=0;r++,i--)e[r]=t[i];return e}static sortAsc(t,e){return t-e}static xmlDecode(t){let e=t.length,r=new Array,i=-1;for(let n=0;n<e;n++){let s=t.charAt(n);if(i>=0){if(s===";"){let a=t.substring(i+1,n);switch(a){case"lt":r.push("<");break;case"gt":r.push(">");break;case"quot":r.push('"');break;case"apos":r.push("'");break;case"amp":r.push("&");break;default:if(a.charAt(0)==="#"){let l=parseInt(a.substring(1));r.push(String.fromCharCode(l))}else r.push("&"+a+";")}i=-1}}else s==="&"?i=n:r.push(s)}return i>=0&&r.push(t.substring(i)),r.join("")}static queryItem(t,e,r){let i={index:-1,data:null};for(let n=0;n<t.length;n++){let s=t[n];if(s[e]===r)return i.index=n,i.data=s,i}return i}static addAll(t,e){for(let r of e)t.push(r)}static addAllSet(t,e){for(let r of e)t.add(r)}static contains(t,e){for(let r of t)if(r.equals(e))return!0;return!1}static equals(t,e){if(t.length==e.length){for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}else return!1}static remove(t,e){let r=0,i=t.length;for(let n=0;n<i;n++)t[n]===e&&(t.splice(n,1),n--,i--,r++);return r}static getUrlVars(){for(var t={},e=location.href.slice(location.href.indexOf("?")+1).split("&"),r=0;r<e.length;r++){var i=e[r].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}static prefix(){if(!Cee){let t=this.getUrlVars().version;t?Cee="/analyzer/v"+t:Cee="/analyzer"}return Cee}static add2objS(t,e,r){if(e in t)return t[e];{let i=r(e);return t[e]=i,i}}static downloadFile(t,e){let r=document.createElement("a"),i=URL.createObjectURL(e);r.download=t,r.href=i,r.click(),URL.revokeObjectURL(i)}static uuid(){let t=new Array;CTe[0]=new Date().getTime(),t.push(STe[1].toString(16)),CTe[0]=Math.random(),t.push(Fke[3].toString(16));let e=Fke[2].toString(16);t.push("4"+e.substr(0,3)),CTe[0]=performance.now();let r=STe[0].toString(16)+STe[1].toString(16);return t.push("0"+r.substr(0,3)),t.push(r.substr(3)),t.join("-")}static funcCopy(t){return(0,eval)("("+t.toString()+")")}static NVL(...t){for(let e of t)if(e!==null)return e;return null}static isSingle(t){return Array.from(new Set(t)).length===t.length}},hCt=[1,10,100,1e3];function oh(o){return typeof o=="number"&&!isNaN(o)}function RP(o){return new dt().conversion("mm","mil",o)}function Gke(o,t,e){if(oh(t)&&oh(t)&&t>e)throw new Error("error params: min > max");return oh(t)&&o<t?{check:!1,value:t}:oh(e)&&o>e?{check:!1,value:e}:{check:!0,value:o}}var See=0,SL=0;function Aee(o,t,e){return See=Math.abs(o-t),e>=5&&See>1e-5||isNaN(e)&&See>1e-8?!1:See<1e-13?!0:(SL=Math.min(Vke(o),Vke(t)),SL<10&&(SL=10),isNaN(e)||(SL=Math.min(SL,e)),Pa(o,SL)===Pa(t,SL))}var Eee=0,Oee=0;function Vke(o){return Eee=0,Oee=0,o>0?Eee=o-Math.floor(o):Eee=o-Math.ceil(o),Oee=(Eee.toString()||"").length,Oee>2?Oee-2:0}function Pa(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=hCt[t]||Math.pow(10,t)||10;if(e){var i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(i+o)}else return Math.round(o*r+1e-10)/r}function _ee(o,t){let e=new Set;for(let r of o)e.add(r);for(let r of t)e.add(r);return e}var QKt=.1/10,Rf=class o extends cd{constructor(e,r){super();this._stiffenerProps=null;this._counterboreProps=null;this._height=r,this._specification=e}get specification(){return this._specification}set specification(e){if(e!=="Custom"){let{needCounterbore:r,needStiffener:i}=this;xP.updatePropsBySpecification(this,e,i,r)}this._specification=e,this.syncLatestData()}syncLatestData(){var e;(e=this.watcher)==null||e.syncLatestData(this)}get height(){return this._height}set height(e){this._height=e,this.syncLatestData()}get holeDiameter(){return this._holeDiameter}set holeDiameter(e){e!==this._holeDiameter&&(this._holeDiameter=e,this.syncLatestData())}get thickness(){return this._thickness}set thickness(e){e!==this._thickness&&(this._thickness=e,this.syncLatestData())}get stiffenerProps(){return this._stiffenerProps?{...this._stiffenerProps}:null}set stiffenerProps(e){this._stiffenerProps=e?{...e}:null,this.syncLatestData()}updateStiffenerProps(e){let r=this._stiffenerProps;r&&(oh(e.topWidth)&&e.topWidth!==r.topWidth&&(r.topWidth=e.topWidth),oh(e.bottomWidth)&&e.bottomWidth!==r.bottomWidth&&(r.bottomWidth=e.bottomWidth),oh(e.height)&&e.height!==r.height&&(r.height=e.height),oh(e.stiffThickness)&&e.stiffThickness!==r.stiffThickness&&(r.stiffThickness=e.stiffThickness))}get counterboreProps(){return this._counterboreProps?{...this._counterboreProps}:null}set counterboreProps(e){this._counterboreProps=e?{...e}:null,this.syncLatestData()}updateCounterboreProps(e){let r=this._counterboreProps;r&&(oh(e.height)&&e.height!==r.height&&(r.height=e.height),oh(e.diameter)&&e.diameter!==r.diameter&&(r.diameter=e.diameter))}get needStiffener(){return!!this.stiffenerProps}set needStiffener(e){if(e){if(!this.needStiffener){let r=xP.getSpecificationByFuzzyMatch(this);this.stiffenerProps=r.stiffenerProps}}else this.stiffenerProps=null;this.syncLatestData()}get needCounterbore(){return!!this.counterboreProps}set needCounterbore(e){if(this.specification!=="Custom"){let r=Ov[this.specification];if(e!==this.needCounterbore&&r){let i=xP.specificationToProps(r,this.height,e);this.holeDiameter=i.holeDiameter}}if(e){if(!this.needCounterbore){let r=xP.getSpecificationByFuzzyMatch(this);this.counterboreProps=r.counterboreProps}}else this.counterboreProps=null;this.syncLatestData()}toJSON(){return{height:this.height,specification:this.specification,holeDiameter:this.holeDiameter,thickness:this.thickness,counterboreProps:this.counterboreProps,stiffenerProps:this.stiffenerProps}}clone(){let e=new o(this.specification,this.height);return e.holeDiameter=this.holeDiameter,e.thickness=this.thickness,e.counterboreProps=this.counterboreProps?{...this.counterboreProps}:null,e.stiffenerProps=this.stiffenerProps?{...this.stiffenerProps}:null,e}getParameters(){}};var uCt=[48,49,50,51],EL=class extends eI{constructor(){super(...arguments);this.filling=new Array(0)}get type(){var e;return(e=this._viewDataModel)==null?void 0:e.type}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get center(){var e;return(e=this._viewDataModel)==null?void 0:e.center}get radius(){var e;return(e=this._viewDataModel)==null?void 0:e.radius}get strokeWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.strokeWidth}get color(){var e;return(e=this._viewDataModel)==null?void 0:e.color}get partitionName(){var e;return(e=this._viewDataModel)==null?void 0:e.partitionName}get constrainName(){return this._constrainName}set constrainName(e){this._constrainName=e}get fillColor(){return this._fillColor}set fillColor(e){this._fillColor=e}get fpcMaterial(){return this._fpcMaterial}set fpcMaterial(e){this._fpcMaterial=e}get fpcThickness(){return this._fpcThickness}set fpcThickness(e){this._fpcThickness=e}get component(){var e;return(e=this._viewDataModel)==null?void 0:e.component}shapeVisible(e,r,i){e&&(e instanceof Ka?e.visible(r,this.center,this.radius,this.strokeWidth,0,kr,ae.CCW,i,this.viewGroupId):e.visible(r,this.center,this.radius,0,kr,ae.CCW,i,this.viewGroupId))}removeFill(){for(let e of this.filling)e.remove();this.holeBaseNetRemove(),this.fpcBaseNetRemove(),this.filling.length=0}fill(){var r;let e=this.filling==null||this.filling.length==0;switch(this.type){case"Board Outline":break;case"Fill Region":this.filling.length==0&&this.filling.push(this.fillRegion(this.layerId));break;case"FPC Stiffener":this.filling.length==0&&(this.filling=this.fillFPC(this.layerId));break;case"Slot Region":this.filling.length==0&&this.filling.push(this.fillRegion(47));break;case"Prohibited Region":this.filling.length==0&&(this.filling=this.fillGrid());break;case"Constraint Region":this.filling.length==0&&(this.filling=this.fillConstraint(this.layerId));break;case"Partition":{this.filling.forEach(i=>{i.remove&&i.remove()}),this.filling=this.fillPartition(this.layerId);break}case"Line":break;case"Copper Region":break;case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":this.filling.length==0&&this.filling.push(this.fillRegion(this.layerId));break;case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":this.filling.length==0&&this.filling.push(this.fillRegion(this.layerId));break;case"3D Shell - Screw Pillar":{this.filling.length==0&&(this.filling=this.fillScrewPillar());break}case"3D Shell - Outline":{this.filling.length==0&&(this.filling=this.fillCircleOutline());break}case"Board":{this.filling.length==0&&(this.filling=[this.fillRegion(this.layerId)]);break}}(e&&this.manualHighLight||this.manualHighLightModified)&&((r=this.filling)==null||r.forEach(i=>{i.forceVisibleHighLight(this.manualHighLight)}),this._fpcNameBaseNet&&this._fpcNameBaseNet.forceVisibleHighLight(this.manualHighLight),this._fpcNumberBaseNet&&this._fpcNumberBaseNet.forceVisibleHighLight(this.manualHighLight),this._holeBaseNet&&this._holeBaseNet.forceVisibleHighLight(this.manualHighLight))}fillRegion(e){let r=new ta(e);return r.visible(e,this.center,this.radius,this.fillColor,this.viewGroupId),r}fillScrewPillar(){let e=new Array,r=this.component;if(r instanceof Rf){let i=xP.getScrewPillarSize(r),{innerRadius:n,stiffToCenterLength:s,stiffStrokeWidth:a}=i,l=this.customFillRegion(this.layerId,n);if(e.push(l),s>0&&a>0){let c=new S(this.center.x,this.center.y+s),h=new S(this.center.x,this.center.y-s),u=new Ds(this.layerId);u.visible(this.layerId,c,h,a,ee.WHITE,this.viewGroupId,void 0);let d=new S(this.center.x-s,this.center.y),p=new S(this.center.x+s,this.center.y),m=new Ds(this.layerId);m.visible(this.layerId,d,p,a,ee.WHITE,this.viewGroupId,void 0),e.push(u,m)}}return e}fillGrid(){let e=this.fillColor||ee.Gray,r=new Array,i=this.center.add(new S(-1,1).mul(this.radius*Math.sqrt(2)/2)),n=this.center.add(new S(1,-1).mul(this.radius*Math.sqrt(2)/2)),s=i.y-i.x,a=n.y-n.x,l=this.radius*2,c=Math.max(1,Math.min(6,l));for(s-=c;s>a;s-=c){let m=2*(s-this.center.y-this.center.x),g=this.center.x*this.center.x-this.radius*this.radius+(s-this.center.y)*(s-this.center.y),y=Math.sqrt(m*m-8*g),b=(-m+y)/4,P=(-m-y)/4,T=b+s,I=P+s,C=new Ic(this.layerId);C.visible(this.layerId,new S(b,T),new S(P,I),!0,0,0,e,this.viewGroupId),r.push(C)}let h=this.center.add(new S(1,1).mul(this.radius*Math.sqrt(2)/2)),u=this.center.add(new S(-1,-1).mul(this.radius*Math.sqrt(2)/2)),d=h.y+h.x,p=u.y+u.x;for(d-=c;d>p;d-=c){let m=2*(this.center.y-d-this.center.x),g=this.center.x*this.center.x-this.radius*this.radius+(this.center.y-d)*(this.center.y-d),y=Math.sqrt(m*m-8*g),b=(-m+y)/4,P=(-m-y)/4,T=-b+d,I=-P+d,C=new Ic(this.layerId);C.visible(this.layerId,new S(b,T),new S(P,I),!0,0,0,e,this.viewGroupId),r.push(C)}return r}fillConstraint(e){let r=[];return r.push(this.fillRegion(e)),this.holeBaseNetVisible(),r}fillPartition(e){let r=[];return r.push(this.fillRegion(e)),this.holeBaseNetVisible(!0,e),r}fillFPC(e){let r=[];return r.push(this.fillRegion(e)),this.fpcMaterial&&this.fpcBaseNetVisible(),r}fillCircleOutline(){if(this.component instanceof y0){let e=this.component;if(!e||e.topInnerHeight<=0&&e.bottomInnerHeight<=0)return[];let r=cn.getInstance().getLayer(54),i=cn.getInstance().getLayer(55),n=e.topInnerHeight>0?r.activeColor:i.activeColor,l=this.strokeWidth/2+5.90551/2+.3937,c=new Ka(this.layerId);return c.visible(this.layerId,this.center,this.radius-l,l,0,kr,ae.CCW,n,this.viewGroupId),[c]}return[]}customFillRegion(e,r){let i=new ta(e);return i.visible(e,this.center,r,this.fillColor,this.viewGroupId),i}mainVisible(){let e=this.lineColor,r=this.lineSolid,{layerId:i,lineSolid:n}=this._viewDataModel,s=!this.main||this.layerModified||this.shapeModified||this.viewGroupIdModified||!e.equals(this._lastLineColor);if(this.main==null||n!=r){if(this.mainRemove(),n){let a=this.resetHighLightState;this.main=new ng(i,a)}else{let a=this.resetHighLightState;this.main=new U9(i,a)}this.lineSolid=n}s&&(this.shapeVisible(this.main,this.layerId,e),this._lastLineColor=e),this.main.forceVisibleHighLight(this.manualHighLight)}maskVisible(e,r,i=!1){this.circleMaskVisible(e,i),this.fillMaskVisible(r)}circleMaskVisible(e,r=!1){if(!this.main)return;let i=this.highlightColor||ee.BLACK;if(this.isWebglEnv()){if(!e){this._mask&&(this._mask.remove(),delete this._mask);return}this._mask||(this._mask=new Ka(1002)),this._mask.visible(1002,this.center,this.radius,this.strokeWidth,0,kr,ae.CCW,i,this.viewGroupId);return}this.mainMaskHighLightColor(this.main,r,e?this.highLightType:null,i)}fillMaskVisible(e){if(e=e&&!["Line","Board Outline","3D Shell - Outline"].includes(this.type)&&!uCt.includes(this.layerId),!e){this._fillMask&&(this._fillMask.remove(),delete this._fillMask);return}let r=this.highlightColor||ee.BLACK;this._fillMask||(this._fillMask=new ta(1002)),this._fillMask.visible(1002,this.center,this.radius,r,this.viewGroupId)}visible(){this.maskVisible(!1,!1),this.mainVisible(),this.fill()}highlight(){this.mainVisible(),this.removeFill(),this.maskVisible(!0,!0,this.forceUpdateMask)}visibleMain(){this.mainVisible(),this.removeFill(),this.maskVisible(!0,!1)}modify(e,r){let i=this.fillColor,n=this.constrainName||"",s=this.fpcMaterial||"",a=this.fpcThickness||"";super.modify(e,r);let{fillColor:l,constrainName:c,fpcMaterial:h,fpcThickness:u}=e;switch(this.fillColor=l,this.constrainName=c||void 0,this.fpcMaterial=h||void 0,this.fpcThickness=u||void 0,(this.layerModified||this.shapeModified||this.viewGroupIdModified||!l.equals(i)||c!=n||h!=s||u!=a)&&(this.removeFill(),this.layerModified&&this.mainRemove()),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}case"Not Show Fill":{this.visibleMain();break}default:break}}holeBaseNetVisible(e=!1,r=47){if(e)this._holeBaseNet&&this._holeBaseNet.remove();else if(this._holeBaseNet)return;let i="";switch(this.type){case"Constraint Region":i=this.constrainName;break;case"Partition":i=this.lineColor.alpha===0?"":this.partitionName;break;default:break}if(!i||!cn.getInstance().getLayer(this.layerId).status.visible)return;let n=r||47,s=this.center,a=this.radius*2,l=a;this._holeBaseNet||(this._holeBaseNet=new vl(n)),this._holeBaseNet.visible(n,i,s,0,10,15,a*.75,l)}holeBaseNetRemove(){this._holeBaseNet&&(this._holeBaseNet.remove(),delete this._holeBaseNet)}fpcBaseNetVisible(){let e=this.fpcMaterial,r=this.fpcThickness;if(!e||!cn.getInstance().getLayer(this.layerId).status.visible)return;let i=this.center,n=this.radius*2,s=n,a=1003,l=i.add1(0,.25*s),c=i.add1(0,-.25*s);this._fpcNameBaseNet||(this._fpcNameBaseNet=new vl(a)),this._fpcNumberBaseNet||(this._fpcNumberBaseNet=new vl(a)),this._fpcNameBaseNet.visible(a,e,l,0,Pc,Tc,n*.75,s,void 0,void 0),this._fpcNumberBaseNet.visible(a,`${r}mm`,c,0,Pc,Tc,n*.75,s,void 0,void 0)}fpcBaseNetRemove(){this._fpcNameBaseNet&&(this._fpcNameBaseNet.remove(),delete this._fpcNameBaseNet),this._fpcNumberBaseNet&&(this._fpcNumberBaseNet.remove(),delete this._fpcNumberBaseNet)}mainRemove(){var e;this.circleMaskVisible(!1,!0),(e=this.main)==null||e.remove(),this.main=null}remove(){var e;this.maskVisible(!1,!1,!0),(e=this.main)==null||e.remove(),this.removeFill()}};var Cz=class extends Do{constructor(){super(),Ro("view/pcb/ComponentView")}get layerId(){var t;return(t=this._viewDataModel)==null?void 0:t.layerId}get position(){var t;return(t=this._viewDataModel)==null?void 0:t.position}get leftLow(){var t;return(t=this._viewDataModel)==null?void 0:t.leftLow}get leftUp(){var t;return(t=this._viewDataModel)==null?void 0:t.leftUp}get rightUp(){var t;return(t=this._viewDataModel)==null?void 0:t.rightUp}get rightLow(){var t;return(t=this._viewDataModel)==null?void 0:t.rightLow}get update(){var t;return(t=this._viewDataModel)==null?void 0:t.updateView}showUpdateBox(){if(!this.updateBox){this.updateBox=[];for(let r=0;r<4;r++)this.updateBox.push(new Ic(1002))}let t=0,e=[this.leftLow,this.rightLow,this.rightUp,this.leftUp,this.leftLow];for(let r of this.updateBox)r.visible(1002,e[t],e[t+1],!0,0,0,ee.Gray,this.viewGroupId),t++}removeUpdateBox(){this.updateBox&&(this.updateBox.forEach(t=>{t.remove()}),delete this.updateBox)}showSelectBox(t){if(!this.selectBox){this.selectBox=[];for(let i=0;i<4;i++)this.selectBox.push(new Ic(1002))}let e=[this.leftLow,this.rightLow,this.rightUp,this.leftUp,this.leftLow],r=0;for(let i of this.selectBox)i.visible(1002,e[r],e[r+1],!1,3,2,t,this.viewGroupId),r++}removeSelectBox(){this.selectBox&&(this.selectBox.forEach(t=>{t.remove()}),delete this.selectBox)}showMask(t){this.mask||(this.mask=[new Ic(1002),new Ic(1002)]);let e=new S(2.5,0),r=new S(0,2.5);this.mask[0].visible(1002,this.position.add(e),this.position.sub(e),!0,0,0,t,this.viewGroupId),this.mask[1].visible(1002,this.position.add(r),this.position.sub(r),!0,0,0,t,this.viewGroupId)}removeMask(){this.mask&&(this.mask.forEach(t=>{t.remove()}),delete this.mask)}visible(){this.update?this.showUpdateBox():this.removeUpdateBox(),this.removeSelectBox(),this.removeMask()}highlight(){let t=this.highlightColor||ee.BLACK;this.update?this.showUpdateBox():this.removeUpdateBox(),this.showSelectBox(t),this.showMask(t)}modify(t,e){switch(super.modify(t,e),e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){this.removeMask(),this.removeUpdateBox(),this.removeSelectBox()}};function Uke(){return[{value:"solid",text:"Solid"},{value:"45grid",text:"Grid 45\xB0"},{value:"90grid",text:"Grid 90\xB0"}]}var JC=class extends jh{constructor(e,r=null,i){super(e,r);this.ids=new Array(0);i!=null&&(this.canPanelize=i)}get layer(){if(this.layerId<0){let e=cn.getInstance().getLayer(Math.abs(this.layerId));return e.copperLayer?e.copperLayer:e.layer}return cn.getInstance().getLayer(this.layerId).layer}get plane(){return this.canPanelize==null?this.layer.plane:this.layer.getCreateNoPanelizePlane()}hidden(){this.isValidId()&&this.plane.hiddenPolygonPt(this.ids)}show(){this.isValidId()&&this.plane.showPolygonPt(this.ids)}visible(e,r,i,n){this.layerId!=e&&this.remove(),!Ra.unRefreshScene&&(this.layerId=e,this.ids=this.layer.addStaticPolygon(r,i,n))}setMatrix(e){this.plane.setStaticPolygonInfo(this.ids,e)}isValidId(){return this.ids.length>=0}resetId(){this.ids=[]}forceVisibleHighLight(e){this.forceVisibleHighLights(this.ids,e)}highlight(e,r,i){this.highlights(this.ids,e,r,i)}remove(){var e;this.isValidId()&&((e=this._removeCb)==null||e.call(this),this.plane.removeHighLightPts(this.ids),this.plane.removePolygonPt(this.ids),this.lastHighLightForce=null),this.resetId()}},vee=class extends JC{};var Sz=class extends Do{constructor(){super(...arguments);this.copper=new Array(0)}get layerId(){var r;let e=(r=this._viewDataModel)==null?void 0:r.layerId;return e==1||e==2?-e:e}get style(){var e;return(e=this._viewDataModel)==null?void 0:e.viewStyle}get pls(){var e;return(e=this._viewDataModel)==null?void 0:e.pls}get gridLineWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.gridLineWidth}get optimization(){var e;return(e=this._viewDataModel)==null?void 0:e.optimization}get viewColor(){var e;return(e=this._viewDataModel)==null?void 0:e.viewColor}get isPlaneZone(){var e;return(e=this._viewDataModel)==null?void 0:e.isPlaneZone}get optimizationWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.optimizationWidth}removeShapes(e,r){if(r.length===0)return;let i=cn.getInstance().getLayer(Math.abs(e)),s=(i.copperLayer?i.copperLayer:i.layer).plane;for(let a of r)Array.isArray(a)?s.removePolygonPt(a):a.remove();r.length=0}createShapes(e,r,i=!1){let n=new Array;if(this.style=="solid"){let s=this.resetHighLightState,a=this.pls,l=i?new vee(e,s):new JC(e);if(l.visible(e,a,r,this.engineGroupId),n.push(l),this.optimization){let{optimizationWidth:c,viewGroupId:h}=this;for(let u of a)for(let d of u.primitives)if(d instanceof M){let p=i?new ld(e,s):new Ds(e,void 0);p.visible(e,d.start(),d.end(),c,r,h,void 0),n.push(p)}else if(d instanceof q){let p=i?new ng(e,s):new Ka(e);p.visible(e,d.center,d.rx,c,d.startAngle/180*Math.PI,d.endAngle()/180*Math.PI,d.sweep(),r,h),n.push(p)}}}else if(this.style=="90grid"||this.style=="45grid"){let s=this.resetHighLightState,{gridLineWidth:a,viewGroupId:l}=this;for(let c of this.pls)for(let h of c.primitives)if(h instanceof M){let u=i?new ld(e,s):new Ds(e);u.visible(e,h.start(),h.end(),a,r,l,void 0),n.push(u)}else if(h instanceof q){let u=i?new ng(e,s):new Ka(e);u.visible(e,h.center,h.rx,a,h.startAngle/180*Math.PI,h.endAngle()/180*Math.PI,h.sweep(),r,l),n.push(u)}}return n}mainVisible(){let e=this._color||this.viewColor,r=this.copper.length==0||this.shapeModified;return r&&this.remove(),r&&(this.copper=this.createShapes(this.layerId,e,!0),this._copperLayerId=this.layerId),(r&&this.manualHighLight||this.manualHighLightModified)&&this.copper.forEach(i=>{i.forceVisibleHighLight(this.manualHighLight)}),r}maskVisible(e,r=!1){if(this.isWebglEnv()){if(!e){this.mask&&(this.removeShapes(1002,this.mask),delete this.mask);return}this.mask=this.createShapes(1002,this.highlightColor||ee.BLACK);return}if(this.copper.length==0)return;let i=this.highlightColor||ee.BLACK,n=e?this.highLightType:null;this.mainsMaskHighLightColor(this.copper,r,n,i)}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){let e=this.mainVisible();this.maskVisible(!0,e||this.forceUpdateMask)}modify(e,r){super.modify(e,r);let i=this.viewColor,n=this._color;switch((!n||!i.equals(n))&&(n=this._color=i,this.remove()),this.isPlaneZone&&!n.equals(ee.BLACK)&&n.alpha==1&&(n=ee.of6(n,.65),this._color=n),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}hasCopper(){return this.copper!=null&&this.copper.length>0}remove(){this.maskVisible(!1,!0),this.removeShapes(this._copperLayerId||this.layerId,this.copper)}};function Pk(o,t,e,r){let i=t.sub(o).normalize(),n=o.distance1(t);if(n>=e+6){let s=t.angle(o),a=(n-e)/2;return s>-Go&&s<Go?o.add(i.mul(a)):t.add(i.mul(-a))}else{i.length()==0&&(i=new S(1,0));let s=t.angle(o),a=o.add(t).mul(.5);if(s>-Go&&s<Go){let l=new S(-i.y,i.x);return a.add(l.mul(r).add(i.mul(-e/2)))}else{let l=new S(i.y,-i.x);return a.add(l.mul(r).add(i.mul(e/2)))}}}function Tk(o,t,e,r,i,n,s,a){let l=QC(o,t,e,r,(n==null?void 0:n.box.width)||0,s,a),c=new _e;for(let h of l)c.ext1(h.bbox());return c.ext7(i/2),c.ext1(n.bbox),c.build1()}function Ik(o,t,e,r,i,n,s){let a=QC(o,t,e,r,0,n,s),l=new _e;for(let c of a)l.ext1(c.bbox());return l.ext7(i/2),l.build1()}function QC(o,t,e,r,i,n,s){let a=Ae.rotateZ(Math.PI/12),l=Ae.rotateZ(-Math.PI/12),c=new Array,h=o.distance1(t);if(o.equals(t)){let u=new S(1,0),d=u.multiply4(a).mul(s),p=u.multiply4(l).mul(s),m=new M(o,o.add(d)),g=new M(o,o.add(p)),y=new M(t,t.sub(p)),b=new M(t,t.sub(d));c.push(m,g,y,b)}else{let u=t.sub(o).normalize();if(o.equals(e)&&t.equals(r)){let p=new S(-u.y,u.x).mul(n),m=p.add(o),g=p.add(t),y=new M(m,o),b=new M(g,t),P=u.multiply4(a).mul(s),T=u.multiply4(l).mul(s),I=new M(o,o.add(P)),C=new M(o,o.add(T)),E=new M(t,t.sub(T)),O=new M(t,t.sub(P));if(c.push(y,b,I,C,E,O),h>=i+6){let _=(h-i)/2,x=new M(o,o.add(u.mul(_))),v=new M(t.sub(u.mul(_)),t);c.push(x,v)}else{let _=new M(o,t);c.push(_)}}else{let d=o.sub(e).normalize().mul(n),p=t.sub(r).normalize().mul(n);d.length()<=0&&(d=p),p.length()<=0&&(p=d);let m=new M(e,o.add(d)),g=new M(r,t.add(p)),y=u.multiply4(a).mul(s),b=u.multiply4(l).mul(s),P=new M(o,o.add(y)),T=new M(o,o.add(b)),I=new M(t,t.sub(b)),C=new M(t,t.sub(y));if(c.push(m,g,P,T,I,C),h>=i+6){let E=(h-i)/2,O=new M(o,o.add(u.mul(E))),_=new M(t.sub(u.mul(E)),t);c.push(O,_)}else{let E=new M(o,t);c.push(E)}}}return c}var b0=class extends jh{constructor(t,e=null,r){super(t,e),r!=null&&(this.canPanelize=r)}get plane(){return this.canPanelize==null?this.layer.plane:this.layer.getCreateNoPanelizePlane()}getPlane(){let t=this._highLightType;return isNaN(t)?this.plane:this.getHighLightPlane(t)}get layer(){return cn.getInstance().getLayer(this.layerId).layer}visible(t,e,r,i,n,s,a,l,c){(this.layerId!=t||!isNaN(c)&&this._highLightType!=c)&&this.remove(),!Ra.unRefreshScene&&(this.layerId=t,this._highLightType!=c&&(this._highLightType=c),this.id=this.getPlane().createOrUpdateRect(this.id,e,r,i,n,s,a,void 0,l))}remove(){this.isValidId()&&(this._removeCb&&(this._removeCb(),this.plane.removeHighLightPt(this.id),this.lastHighLightForce=null),this.getPlane().removePt(this.id)),this.resetId()}},xee=class extends b0{};var OTe=ee.of6(ee.BLACK,.5),DP=class extends Do{constructor(e){super();this.main=new Array;e!=null&&(this.canPanelize=e),Ro("view/pcb/TextView")}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get strokeWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.strokeWidth}get path(){var e;return(e=this._viewDataModel)==null?void 0:e.path}get matrix(){var e;return(e=this._viewDataModel)==null?void 0:e.matrix}get width(){var e;return(e=this._viewDataModel)==null?void 0:e.width}get height(){var e;return(e=this._viewDataModel)==null?void 0:e.height}get color(){return this._viewDataModel.partition==R.getInstance().partitionId?uo.getInstance().textConfig.getCustomColor(this._viewDataModel.globalIndex)||ee.BLACK:OTe}get outlineModified(){var e;return(e=this._viewDataModel)==null?void 0:e.outlineModified}mainVisible(){let e=this.layerModified||this.outlineModified;if(e){this.maskVisible(!1);for(let i of this.main)i.remove();this.main.length=0}let r=this.color;if(this.main.length==0){let i=this.layerId,n=this.strokeWidth,s=this.matrix.toMatrix3(),a=this.engineGroupId,l=this.resetHighLightState;for(let c of this.path)for(let h of c.primitives)if(h=h.multiply3(s),h instanceof M){let u=new ld(i,l,this.canPanelize);u.visible(i,h.start(),h.end(),n,r,a,void 0),this.main.push(u)}else if(h instanceof q){let u=new ng(i,l,this.canPanelize);u.visible(i,h.center.clone(),h.rx,n,h.startAngle/180*Math.PI,h.endAngle()/180*Math.PI,h.sweep(),r,a),this.main.push(u)}}else{if(e||(e=this.shapeModified||!r.equals(this._lastColor)),!e){this.manualHighLightModified&&this.main.forEach(c=>{c.forceVisibleHighLight(this.manualHighLight)});return}let i=this.layerId,n=this.strokeWidth,s=this.matrix.toMatrix3(),a=this.engineGroupId,l=0;for(let c of this.path)for(let h of c.primitives){if(h=h.multiply3(s),h instanceof M){let u=this.main[l];u instanceof Ds&&u.visible(i,h.start().clone(),h.end().clone(),n,r,a,void 0)}else if(h instanceof q){let u=this.main[l];u instanceof Ka&&u.visible(i,h.center.clone(),h.rx,n,h.startAngle/180*Math.PI,h.endAngle()/180*Math.PI,h.sweep(),r,a)}l++}}this._lastColor=r,this.main.forEach(i=>{i.forceVisibleHighLight(this.manualHighLight)})}maskVisible(e){if(!e){this.mask&&(this.mask.remove(),delete this.mask);return}let r=this.highlightColor||ee.BLACK;this.mask||(this.mask=new b0(1002));let i=this._viewDataModel.box,n=i.isFlipX()?i.leftLow:i.leftUp,s=i.width,a=i.height,l=i.rotation;this.mask.visible(1002,n,s,a,l,0,r,null,this.highLightType)}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0)}modify(e,r){switch(super.modify(e,r),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}hidden(){var e;(e=this.mask)==null||e.hidden();for(let r of this.main)r.hidden()}show(){var e;(e=this.mask)==null||e.show();for(let r of this.main)r.show()}remove(){this.maskVisible(!1);for(let e of this.main)e.remove();this.main.length=0}};var Ez=class extends Do{constructor(){super(...arguments);this.shape=new Array(0);this.text=new DP}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get start(){var e;return(e=this._viewDataModel)==null?void 0:e.start}get end(){var e;return(e=this._viewDataModel)==null?void 0:e.end}get left(){var e;return(e=this._viewDataModel)==null?void 0:e.left}get right(){var e;return(e=this._viewDataModel)==null?void 0:e.right}get strokeWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.strokeWidth}get textPath(){var e;return(e=this._viewDataModel)==null?void 0:e.textPath}get textMatrix(){var e;return(e=this._viewDataModel)==null?void 0:e.textMatrix}get width(){var e;return(e=this._viewDataModel)==null?void 0:e.viewWidth}get height(){var e;return(e=this._viewDataModel)==null?void 0:e.viewHeight}get lineLen(){var e;return(e=this._viewDataModel)==null?void 0:e.lineLen}get arrLineLen(){var e;return(e=this._viewDataModel)==null?void 0:e.arrLineLen}get dimensionIsSelect(){var e;return(e=this._viewDataModel)==null?void 0:e.dimensionIsSelect}get viewHeight(){var e;return(e=this._viewDataModel)==null?void 0:e.viewHeight}get viewWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.viewWidth}get leftCenter(){var e;return(e=this._viewDataModel)==null?void 0:e.leftCenter}get leftRadius(){var e;return(e=this._viewDataModel)==null?void 0:e.leftRadius}get rightCenter(){var e;return(e=this._viewDataModel)==null?void 0:e.rightCenter}get rightRadius(){var e;return(e=this._viewDataModel)==null?void 0:e.rightRadius}get outlineModified(){var e;return(e=this._viewDataModel)==null?void 0:e.outlineModified}shapeVisible(e,r){let i=this.highlightColor||ee.RED,n=this.dimensionIsSelect?i:ee.BLACK;if(!(e.length==0||this.layerModified||this.shapeModified||this.viewGroupIdModified||!n.equals(this._lastColor))){e.forEach(c=>{c.forceVisibleHighLight(this.manualHighLight)});return}this._lastColor=n;let a=this.strokeWidth,l=QC(this.start,this.end,this.left,this.right,this.text.width,this.lineLen,this.arrLineLen);if(e.length==0){let c=this.resetHighLightState;for(let h of l){let u=new ld(r,c);u.visible(r,h.start(),h.end(),a,n,this.viewGroupId,void 0),e.push(u)}}else{let c=0,h=-1,u=this.resetHighLightState;for(let p of l){let m=e[c];m==null&&(m=new ld(r,u),e.push(m),h==-1&&(h=c)),m.visible(r,p.start(),p.end(),a,n,this.viewGroupId,void 0),c++}h!=-1&&this.maskVisible(!1,!0,this.shape.slice(0,h));let d=e.splice(c,e.length-c);for(let p of d)p.remove()}e.forEach(c=>{c.forceVisibleHighLight(this.manualHighLight)})}textVisible(e){let{layerId:r,strokeWidth:i,textPath:n,textMatrix:s,dimensionIsSelect:a=!1,highlightColor:l,viewHeight:c,viewWidth:h}=this,u=this._viewDataModel.box;uo.getInstance().textConfig.setCustomColor(this._viewDataModel.globalIndex,a?l:null),this.text.modify({partition:this._viewDataModel.partition,globalIndex:this._viewDataModel.globalIndex,layerId:r,box:u,strokeWidth:i,path:n,matrix:s,width:h,height:c,highLightType:this.highLightType,highlightColor:l,layerModified:this.layerModified,outlineModified:this.outlineModified,shapeModified:this.shapeModified,manualHighLight:this.manualHighLight,manualHighLightModified:this.manualHighLightModified},e)}smartVisible(){let{layerId:e,leftCenter:r,leftRadius:i,rightCenter:n,rightRadius:s}=this;if(this._dimensionType=="smartDimension"){this._leftSpot||(this._leftSpot=new ta(e)),this._rightSpot||(this._rightSpot=new ta(e));let a=ee.build(.7,.7,0,.7);this._leftSpot.visible(e,r,i,a,this.viewGroupId),this._rightSpot.visible(e,n,s,a,this.viewGroupId)}else this._leftSpot&&(this._leftSpot.remove(),delete this._leftSpot),this._rightSpot&&(this._rightSpot.remove(),delete this._rightSpot);this._leftSpot&&this._leftSpot.forceVisibleHighLight(this.manualHighLight),this._rightSpot&&this._rightSpot.forceVisibleHighLight(this.manualHighLight)}mainVisible(e){this.layerModified&&this.mainRemove(),this.textVisible(e),this.shapeVisible(this.shape,this.layerId),this.smartVisible()}maskVisible(e,r=!1,i){if(this.isWebglEnv()){if(!e){this._mask&&(this._mask.forEach(s=>s.remove()),delete this._mask);return}this._mask||(this._mask=[]),this.shapeVisible(this._mask,1002);return}let n=this.highlightColor;this.mainsMaskHighLightColor(i||this.shape,r,e?this.highLightType:null,n)}visible(){this.maskVisible(!1),this.mainVisible("Only Main")}highlight(){this.mainVisible("Main And Highlight"),this.maskVisible(!0,this.forceUpdateMask)}modify(e,r){super.modify(e,r);let{Type:i}=e;switch(this._dimensionType=i,r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}mainRemove(){this.maskVisible(!1,!0);for(let e of this.shape)e.remove();this.shape.length=0}remove(){this.mainRemove(),this.text.remove(),this.removeLeftSpot(),this.removeRightSpot()}removeLeftSpot(){this._leftSpot&&(this._leftSpot.remove(),delete this._leftSpot)}removeRightSpot(){this._rightSpot&&(this._rightSpot.remove(),delete this._rightSpot)}};var Oz=class extends Do{constructor(){super(...arguments);this.shape=null}get strokeWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.strokeWidth}get path(){var e;return(e=this._viewDataModel)==null?void 0:e.path}get matrix(){var e;return(e=this._viewDataModel)==null?void 0:e.matrix}get width(){var e;return(e=this._viewDataModel)==null?void 0:e.width}get height(){var e;return(e=this._viewDataModel)==null?void 0:e.height}get color(){return this._viewDataModel.partition==R.getInstance().partitionId?ee.BLACK:OTe}get outlineModified(){var e;return(e=this._viewDataModel)==null?void 0:e.outlineModified}get layer(){return cn.getInstance().getLayer(this.layerId).layer}get plane(){return this.layer.plane}mainVisible(){let e=this.shapeModified;this.shape||(this.shape&&this.shape.remove(),this.shape=new JC(this.layerId),this.shape.visible(this.layerId,this.path,this.color,this.viewGroupId),e=!0),e&&this.shape.setMatrix(this.matrix),this.manualHighLightModified&&this.shape.ids.length&&this.shape.forceVisibleHighLight(this.manualHighLight)}maskVisible(e){if(!e){this._mask&&(this._mask.remove(),delete this._mask);return}this._mask||(this._mask=new b0(1002));let r=this.highlightColor||ee.BLACK,i=this._viewDataModel.box,n=i.isFlipX()?i.leftLow:i.leftUp,s=i.rotation,a=i.width,l=i.height;this._mask.visible(1002,n,a,l,s,0,r,this.viewGroupId,this.highLightType),this._lastColor=this.color}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0)}modify(e,r){let i=this.layerId;super.modify(e,r);let{layerId:n}=e;switch(this.shape&&(i!=n||this.outlineModified||!this.color.equals(this._lastColor))&&(this.maskVisible(!1),this.shape.remove(),this.shape=null),this.layerId=n,r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){this.maskVisible(!1),this.shape&&this.shape.remove(),this.shape=null}};var Az=class extends Do{constructor(){super(...arguments);this.shape=null}get path(){var e;return(e=this._viewDataModel)==null?void 0:e.path}get matrix(){var e;return(e=this._viewDataModel)==null?void 0:e.matrix}get leftLow(){var e;return(e=this._viewDataModel)==null?void 0:e.leftLow}get leftUp(){var e;return(e=this._viewDataModel)==null?void 0:e.leftUp}get rightUp(){var e;return(e=this._viewDataModel)==null?void 0:e.rightUp}get rightLow(){var e;return(e=this._viewDataModel)==null?void 0:e.rightLow}get templateModified(){var e;return(e=this._viewDataModel)==null?void 0:e.templateModified}get layer(){return cn.getInstance().getLayer(this.layerId).layer}get plane(){return this.layer.plane}get lineColor(){var e;return((e=this._viewDataModel)==null?void 0:e.lineColor)||ee.BLACK}mainVisible(){this.layerId||(this.layerId=this._viewDataModel.layerId);let e=this.shapeModified;this.shape&&(this.layerModified||this.templateModified)&&(this.maskVisible(!1),this.shape.remove(),this.shape=null,this.layerId=this._viewDataModel.layerId,e=!0),this.shape||(this.shape=new JC(this.layerId),this.shape.visible(this.layerId,this.path,this.lineColor,this.viewGroupId),e=!0),this.manualHighLightModified&&this.shape&&this.shape.forceVisibleHighLight(this.manualHighLight),e&&this.shape.setMatrix(this.matrix)}maskVisible(e){if(!e){this._mask&&(this._mask.remove(),delete this._mask);return}this._mask||(this._mask=new b0(1002));let r=this.highlightColor||ee.BLACK,i=this._viewDataModel.box,n=i.isFlipX()?i.leftLow:i.leftUp,s=i.width,a=i.height,l=i.rotation;this._mask.visible(1002,n,s,a,l,0,r,this.viewGroupId,this.highLightType)}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0)}modify(e,r){switch(super.modify(e,r),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){this.maskVisible(!1),this.shape.remove(),this.shape=null}};var _z=class extends eI{constructor(){super(),Ro("view/pcb/LineView")}get layerId(){var t;return(t=this._viewDataModel)==null?void 0:t.layerId}get start(){var t;return(t=this._viewDataModel)==null?void 0:t.start}get end(){var t;return(t=this._viewDataModel)==null?void 0:t.end}get width(){var t;return(t=this._viewDataModel)==null?void 0:t.width}get color(){var t;return(t=this._viewDataModel)==null?void 0:t.color}lineTypeChanged(t){return t=="lineSegment"?this.main&&this.main instanceof Ds:this.main&&this.main instanceof Ic}shapeVisible(t,e,r){t&&(t instanceof Ic?t.visible(e,this.start,this.end,this.lineSolid,3,2,r,this.viewGroupId):t.visible(e,this.start,this.end,this.width,r,this.viewGroupId,void 0))}mainVisible(){let t=this.layerId,e=!1;this.main&&this.layerModified&&(this.mainRemove(),e=!0);let r=this.lineType(this.width);if(!this.main||this.lineTypeChanged(r)){this.mainRemove();let n=this.resetHighLightState;r=="line"?this.main=new ld(t,n):this.main=new Av(t,n),e=!0}let i=this.lineColor;e||(e=this.shapeModified||this.viewGroupIdModified||!i.equals(this._lastColor)),e&&(this.shapeVisible(this.main,this.layerId,i),this._lastColor=i),this.main.forceVisibleHighLight(this.manualHighLight)}maskVisible(t,e=!1){if(!this.main)return;let r=this.highlightColor||ee.BLACK;if(this.isWebglEnv()){if(!t){this._mask&&(this._mask.remove(),delete this._mask);return}let i=this.lineType(this.width);(!this._mask||this._mask&&i=="lineSegment"&&this._mask instanceof Ds)&&(this._mask&&this._mask.remove(),i=="line"?this._mask=new Ds(1002):this._mask=new Ic(1002)),this.shapeVisible(this._mask,1002,r);return}this.mainMaskHighLightColor(this.main,e,t?this.highLightType:null,r)}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0,this.forceUpdateMask)}modify(t,e){if(super.modify(t,e),this.start.equals(this.end)){this.remove();return}switch(e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}mainRemove(){var t;this.maskVisible(!1,!0),(t=this.main)==null||t.remove()}remove(){this.mainRemove()}};var Ck=class{constructor(t){this.lastHighLightColor=ee.BLACK;this._parentView=t}get width(){return this._viewDataModel.holeRadius*2}get height(){return this._viewDataModel.holeLength}get type(){return this._viewDataModel.holeShape}get holeShape(){var t;return(t=this._viewDataModel)==null?void 0:t.holeShape}get holeLength(){var t;return(t=this._viewDataModel)==null?void 0:t.holeLength}get holeRadius(){var t;return(t=this._viewDataModel)==null?void 0:t.holeRadius}get holeRotation(){var t;return(t=this._viewDataModel)==null?void 0:t.holeRotation}get holeOffset(){var t;return(t=this._viewDataModel)==null?void 0:t.holeOffset}get viewGroupId(){var t;return(t=this._parentView)==null?void 0:t.viewGroupId}get viewGroupIdModified(){var t;return(t=this._parentView)==null?void 0:t.viewGroupIdModified}get manualHighLightModified(){return this._parentView.manualHighLightModified}get manualHighLight(){return this._parentView.manualHighLight}get forceUpdateMask(){return this._parentView.forceUpdateMask}get highLightType(){var t;return(t=this._parentView)==null?void 0:t.highLightType}get holeModified(){var t;return(t=this._parentView)==null?void 0:t.holeModified}isWebglEnv(){return va.useWebgl}get shapeModified(){return this._parentView.holeModified||this._parentView.shapeModified}shapeVisible(t,e,r,i=!1){let n=this.width/2,s=Ae.rotateZ(this.holeRotation).translate1(this.holeOffset.x,this.holeOffset.y,0).rotateZ(this._parentView.rotation).translate1(this._parentView.center.x,this._parentView.center.y,0),a=S.ORIGIN.multiply4(s),l=this.shapeModified||i&&!this.shape,c=!i||l||this.holeModified||!r.equals(this._lastColor)||this._parentView.viewGroupIdModified;if(this.type=="ROUND"){let h=new ta(e);if(t instanceof ta?h=t:t&&(t.remove(),c=!0),c)return h.visible(e,a,n,r,this._parentView.viewGroupId),i&&(this._lastColor=r),h}else if(this.type=="RECT"){let h=new b0(e);if(t instanceof b0?h=t:t&&(t.remove(),c=!0),c){let u=new S(-n,this.width/2).multiply4(s),d=new S(-n,0).multiply4(s),m=new S(n,0).multiply4(s).angle(d);return h.visible(e,u,n*2,this.width,m,0,r,this._parentView.viewGroupId),i&&(this._lastColor=r),h}}else{let h=this.height-this.width;if(h>1e-4){let u=new S(-h/2,0).multiply4(s),d=new S(h/2,0).multiply4(s),p=new Ds(e);if(t instanceof Ds?p=t:t&&(t.remove(),c=!0),c)return p.visible(e,u,d,this.width,r,this._parentView.viewGroupId),i&&(this._lastColor=r),p}else{let u=new ta(e);if(t instanceof ta?u=t:t&&(t.remove(),c=!0),c)return u.visible(e,a,n,r,this._parentView.viewGroupId),i&&(this._lastColor=r),u}}}mainVisible(t,e){let r=this.shapeVisible(this.shape,t,e,!0);r&&(this.shape=r),this.shape&&this.shape.forceVisibleHighLight(this.manualHighLight)}maskVisible(t,e=!1){if(!this.shape)return;let r=this._parentView.highlightColor||ee.BLACK;if(this.isWebglEnv()){if(!t){this._mask&&(this._mask.remove(),delete this._mask);return}let n=this._parentView.highlightColor||ee.BLACK;this._mask=this.shapeVisible(this._mask,1002,n);return}let i=this.resetHighLightState;this.shape.setRemoveCb(i),this.mainMaskHighLightColor(this.shape,e,t?this.highLightType:null,r)}componentMaskVisible(t,e){t&&e?this._maskByComponent=this.shapeVisible(this._maskByComponent,1002,ee.BLACK):this._maskByComponent&&(this._maskByComponent.remove(),delete this._maskByComponent)}visible(t,e,r){this.maskVisible(!1),this.mainVisible(t,e),this.componentMaskVisible(!0,r)}highlight(t,e,r){this.mainVisible(t,e),this.maskVisible(!0,this.forceUpdateMask),this.componentMaskVisible(!0,r)}modify(t,e,r,i,n){switch(this._viewDataModel=t,this.holeModified&&this.shape&&this.mainRemove(),e){case"Only Main":{this.visible(r,i,n);break}case"Main And Highlight":{this.highlight(r,i,n);break}default:break}}mainRemove(){var t;this.maskVisible(!1,!0),(t=this.shape)==null||t.remove(),delete this.shape}remove(){this.mainRemove(),this.componentMaskVisible(!1,!1)}resetHighLightState(){this.lastHighLightType=null}mainMaskHighLightColor(t,e,r,i){!t||!e&&this.lastHighLightType==r||(this.lastHighLightType!=null&&t.highlight(!1,this.lastHighLightType,this.lastHighLightColor),r!=null&&t.highlight(!0,r,i),this.lastHighLightType=r,this.lastHighLightColor=i)}};function hb(o){return o==1||o==3||o==5||o==7||o==9||o==58}function is(o){return o==2||o==4||o==6||o==8||o==10||o==59}function sg(o){return o==2?1:o==4?3:o==6?5:o==8?7:o==10?9:o==1?2:o==3?4:o==5?6:o==7?8:o==9?10:o==58?59:o==59?58:o}function ns(o){return o==="SIGNAL"||o==="TOP"?!0:o==="BOTTOM"}function mu(o){return o==="PLANE"}function Ree(o){return["TOP","BOTTOM","PLANE","SIGNAL"].includes(o)}function Hke(o){return o==="DRILL_DRAWING"}function Es(o){return(o|0)===o&&o>=15&&o<=46}function Ud(o){return(o|0)===o&&(o>=15&&o<=46||o==1||o==2||o==12)}function LO(o){return[49,50,51].includes(o)}function W9(o){return[48,49,50,51].includes(o)}function _v(o){return[49,50,51,52].includes(o)}function z9(o){return[51,50].includes(o)}function ra(o){return[53,54,55].includes(o)}function Dee(o){return o==50||o==51||o==48||o==49}function ar(o){return 12==o}function ub(o){return 11==o}function wee(o){return 14===o}function ao(o){return 1==o}function ic(o){return[58,59].includes(o)}function vv(o){return 2==o}var sh=class o{constructor(t){t!=null&&(this.canPanelize=t)}isWebglEnv(){return va.useWebgl}get originLayer(){return o._parentView.layerId}get center(){return o._parentView.center}get rotation(){return o._parentView.rotation}get color(){return o._parentView.color}get manualHighLightModified(){return o._parentView.manualHighLightModified}get manualHighLight(){return o._parentView.manualHighLight}get forceUpdateMask(){return o._parentView.forceUpdateMask}get highlightColor(){return o._parentView.highlightColor}get topSolderExpansion(){return o._parentView.topSolderExpansion}get bottomSolderExpansion(){return o._parentView.bottomSolderExpansion}get highlightByComponent(){return o._parentView.highlightByComponent}get shapeModified(){switch(this._singlePadType){case 0:return o._parentView.topModified;case 2:return o._parentView.bottom;default:return o._parentView.innerModified}}get solderModified(){switch(this._singlePadType){case 0:return this.topSolderExpansionModified;case 2:return this.bottomSolderExpansionModified;default:return!1}}get pasteExpansionModified(){return o._parentView.pasteExpansionModified}get topSolderExpansionModified(){return o._parentView.topSolderExpansionModified}get bottomSolderExpansionModified(){return o._parentView.bottomSolderExpansionModified}get isInner(){return this._singlePadType==1}get isTop(){return this._singlePadType==0}get isBot(){return this._singlePadType==2}get solderExpansion(){return this.isTop?o._parentView.topSolderExpansion:this.isInner?-1e3:o._parentView.bottomSolderExpansion}get pasteExpansion(){return this.isInner?-1e3:o._parentView.pasteExpansion}get viewGroupId(){var t;return(t=o._parentView)==null?void 0:t.viewGroupId}get wireViewGroupId(){var t;return(t=o._parentView)==null?void 0:t.wireViewGroupId}get viewGroupIdModified(){var t;return(t=o._parentView)==null?void 0:t.viewGroupIdModified}get highLightType(){var t;return(t=o._parentView)==null?void 0:t.highLightType}generate(t,e,r,i,n,s,a,l,c,h,u){switch(e){case"ELLIPSE":{let p;return t instanceof ta?p=t:(this.removeLastMaskShape(t),p=u?new H9(a,u,this.canPanelize):new ta(a,null,this.canPanelize)),p.visible(a,r,n/2,c,h),p}case"OVAL":{let p=Math.abs(n-s);if(n>s&&p>1e-4){let m=(n-s)/2,g=new S(-m,0).rotate(S.ORIGIN,i).add(r),y=new S(m,0).rotate(S.ORIGIN,i).add(r),b;return t instanceof Ds?b=t:(this.removeLastMaskShape(t),b=u?new ld(a,u,this.canPanelize):new Ds(a,null,this.canPanelize)),b.visible(a,g,y,s,c,h),b}else if(n<s&&p>1e-4){let m=(s-n)/2,g=new S(0,-m).rotate(S.ORIGIN,i).add(r),y=new S(0,m).rotate(S.ORIGIN,i).add(r),b;return t instanceof Ds?b=t:(this.removeLastMaskShape(t),b=u?new ld(a,u,this.canPanelize):new Ds(a,null,this.canPanelize)),b.visible(a,g,y,n,c,h),b}else{let m;return t instanceof ta?m=t:(this.removeLastMaskShape(t),m=u?new H9(a,u,this.canPanelize):new ta(a,null,this.canPanelize)),m.visible(a,r,n/2,c,h),m}}case"RECT":{let p=n/2,m;t instanceof b0?m=t:(this.removeLastMaskShape(t),m=u?new xee(a,u,this.canPanelize):new b0(a,null,this.canPanelize));let g=new S(-p,s/2).rotate(S.ORIGIN,i).add(r),y=Math.min(p,s/2)*l;return m.visible(a,g,n,s,i,y,c,h),m}}let d;return t instanceof ta?d=t:(this.removeLastMaskShape(t),d=u?new H9(a,u,this.canPanelize):new ta(a,null,this.canPanelize)),d.visible(a,r,n/2,c,h),d}getMaxExpansion(){return Math.max(0,this.solderExpansion,ar(this.originLayer)?0:this.pasteExpansion)}getExpansionRatio(t,e,r,i){let n=Math.min(e,r)/2,s=n*t+i;return Math.max(0,s/(n+i))}mainVisible(t,e,r){var E;let{type:i,width:n,height:s,ratio:a}=r,l=this.color,c=ee.of6(ee.BLACK,l.alpha),h=l.alpha!=((E=this._lastPadColor)==null?void 0:E.alpha),u=!this._pad||this.shapeModified||this.viewGroupIdModified,d=this.viewGroupId,p=this.wireViewGroupId,m=this.isTop?5:6,g=this.isTop?7:8,y=this.originLayer;(u||!l.equals(this._lastPadColor))&&(this._pad=this.generate(this._pad,i,t,e,n,s,this._singlePadLayerId,a,l,p),this._lastPadColor=l),this._pad.forceVisibleHighLight(this.manualHighLight);let P=this.solderExpansion;if(this._singlePadType!=1&&(u||h||!this._solder||this.solderModified)){let O=n+P*2,_=s+P*2;O>0&&_>0?this._solder=this.generate(this._solder,i,t,e,O,_,m,this.getExpansionRatio(a,n,s,P),c,p):this.removeSolder()}this._solder&&this._solder.forceVisibleHighLight(this.manualHighLight);let I=this.pasteExpansion;if(this._singlePadType!=1&&(u||h||!this._paste||this.pasteExpansionModified)){let O=n+I*2,_=s+I*2;O>0&&_>0&&!ar(y)?this._paste=this.generate(this._paste,i,t,e,O,_,g,this.getExpansionRatio(a,n,s,I),c,p):this.removePaste()}this._paste&&this._paste.forceVisibleHighLight(this.manualHighLight)}removeLastMaskShape(t){t&&t.remove()}createMask(t,e,r,i){let{type:n,width:s,height:a,ratio:l}=i,c=Math.max(0,this.solderExpansion,ar(this.originLayer)?0:this.pasteExpansion),h=s+c*2,u=a+c*2,d=ee.BLACK;return this.generate(t,n,e,r,h,u,1002,this.getExpansionRatio(l,s,a,c),d,null)}visible(t){let{center:e,rotation:r}=this;this.mainVisible(e,r,t)}modify(t,e,r,i,n){o._parentView=t;let s=this._singlePadLayerId;this._singlePadLayerId=i,Object.is(n,void 0)&&(n=i==1?0:i==2?2:1),this._singlePadType=n,i!=s&&this.mainRemove(),this.visible(e)}hidden(){var t,e,r,i;(t=this._pad)==null||t.hidden(),(e=this._mask)==null||e.hidden(),(r=this._solder)==null||r.hidden(),(i=this._paste)==null||i.hidden()}show(){var t,e,r,i;(t=this._pad)==null||t.show(),(e=this._mask)==null||e.show(),(r=this._solder)==null||r.show(),(i=this._paste)==null||i.show()}removePad(){this._pad&&(this.removeLastMaskShape(this._pad),delete this._pad)}removeSolder(){this._solder&&(this.removeLastMaskShape(this._solder),delete this._solder)}removePaste(){this._paste&&(this.removeLastMaskShape(this._paste),delete this._paste)}mainRemove(){this.removePad(),this.removeSolder(),this.removePaste()}remove(){this.mainRemove()}};function zke(o){return o=(o+Math.PI)%kr-Math.PI,o<=-Go?o+=Math.PI:o>=Go&&(o-=Math.PI),o}var Sk=class extends sh{constructor(){super(...arguments);this.lastHighLightColor=ee.BLACK}isWebglEnv(){return va.useWebgl}get originLayer(){return sh._parentView.layerId}get center(){return sh._parentView.center}get rotation(){return sh._parentView.rotation}get color(){return sh._parentView.color}get manualHighLightModified(){return sh._parentView.manualHighLightModified}get manualHighLight(){return sh._parentView.manualHighLight}get forceUpdateMask(){return sh._parentView.forceUpdateMask}get highlightColor(){return sh._parentView.highlightColor}get highlightMaskColor(){return sh._parentView.highlightMaskColor}get topSolderExpansion(){return sh._parentView.topSolderExpansion}get bottomSolderExpansion(){return sh._parentView.bottomSolderExpansion}get highlightByComponent(){return sh._parentView.highlightByComponent}get shapeModified(){switch(this._singlePadType){case 0:return sh._parentView.topModified;case 2:return sh._parentView.bottom;default:return sh._parentView.innerModified}}get solderModified(){switch(this._singlePadType){case 0:return this.topSolderExpansionModified;case 2:return this.bottomSolderExpansionModified;default:return!1}}get pasteExpansionModified(){return sh._parentView.pasteExpansionModified}get topSolderExpansionModified(){return sh._parentView.topSolderExpansionModified}get bottomSolderExpansionModified(){return sh._parentView.bottomSolderExpansionModified}get isInner(){return this._singlePadType==1}get isTop(){return this._singlePadType==0}get isBot(){return this._singlePadType==2}get solderExpansion(){return this.isTop?sh._parentView.topSolderExpansion:this.isInner?-1e3:sh._parentView.bottomSolderExpansion}get pasteExpansion(){return this.isInner?-1e3:sh._parentView.pasteExpansion}get viewGroupId(){var e;return(e=sh._parentView)==null?void 0:e.viewGroupId}get wireViewGroupId(){var e;return(e=sh._parentView)==null?void 0:e.wireViewGroupId}get viewGroupIdModified(){var e;return(e=sh._parentView)==null?void 0:e.viewGroupIdModified}get highLightType(){var e;return(e=sh._parentView)==null?void 0:e.highLightType}getMaxExpansion(){return Math.max(0,this.solderExpansion,ar(this.originLayer)?0:this.pasteExpansion)}getExpansionRatio(e,r,i,n){let s=Math.min(r,i)/2,a=s*e+n;return Math.max(0,a/(s+n))}mainVisible(e,r,i){var O;let{type:n,width:s,height:a,ratio:l}=i,c=this.color,h=ee.of6(ee.BLACK,c.alpha),u=c.alpha!=((O=this._lastPadColor)==null?void 0:O.alpha),d=!this._pad||this.shapeModified||this.viewGroupIdModified,p=this.viewGroupId,m=this.wireViewGroupId,g=this.isTop?5:6,y=this.isTop?7:8,b=this.originLayer,P=d||!c.equals(this._lastPadColor);P&&(this._pad=this.generate(this._pad,n,e,r,s,a,this._singlePadLayerId,l,c,m),this._lastPadColor=c),this._pad.forceVisibleHighLight(this.manualHighLight);let T=this.solderExpansion,I=this._singlePadType!=1&&(d||u||!this._solder||this.solderModified);if(I){let _=s+T*2,x=a+T*2;_>0&&x>0?this._solder=this.generate(this._solder,n,e,r,_,x,g,this.getExpansionRatio(l,s,a,T),h,m):this.removeSolder()}this._solder&&this._solder.forceVisibleHighLight(this.manualHighLight);let C=this.pasteExpansion,E=this._singlePadType!=1&&(d||u||!this._paste||this.pasteExpansionModified);if(E){let _=s+C*2,x=a+C*2;_>0&&x>0&&!ar(b)?this._paste=this.generate(this._paste,n,e,r,_,x,y,this.getExpansionRatio(l,s,a,C),h,m):this.removePaste()}if(this._paste&&this._paste.forceVisibleHighLight(this.manualHighLight),!this.maskShape||P||I||E){let _=this.getMaxExpansion(),x=_*2,v=s+x,D=a+x;this.maskVisible(i,!1,e,r,!0);let w=this.resetHighLightState;this.maskShape=this.generate(this.maskShape,n,e,r,v,D,1002,this.getExpansionRatio(l,s,a,_),ee.of6(ee.BLACK,1e-6),p,w)}}resetHighLightState(){this.lastHighLightType=null}maskVisible(e,r,i,n,s=!1){if(!this.maskShape)return;if(this.isWebglEnv()){r?this._mask=this.createMask(this._mask,i,n,e):this._mask&&(this._mask.remove(),delete this._mask);return}let a=this.highlightColor;this.mainMaskHighLightColor(this.maskShape,s,r?this.highLightType:null,a)}removeLastMaskShape(e){e&&e.remove()}componentMaskVisible(e,r,i,n){e&&this.highlightByComponent?this._maskByComponent=this.createMask(this._maskByComponent,r,i,n):this._maskByComponent&&(this._maskByComponent.remove(),delete this._maskByComponent)}createMask(e,r,i,n){let{type:s,width:a,height:l,ratio:c}=n,h=Math.max(0,this.solderExpansion,ar(this.originLayer)?0:this.pasteExpansion),u=a+h*2,d=l+h*2,p=this.highlightMaskColor||ee.BLACK;return this.generate(e,s,r,i,u,d,1002,this.getExpansionRatio(c,a,l,h),p,null)}visible(e){let{center:r,rotation:i}=this;this.maskVisible(e,!1,r,i),this.mainVisible(r,i,e),this.componentMaskVisible(!0,r,i,e)}highlight(e){let{center:r,rotation:i}=this;this.mainVisible(r,i,e),this.maskVisible(e,!0,r,i,this.forceUpdateMask),this.componentMaskVisible(!0,r,i,e)}modify(e,r,i,n,s){sh._parentView=e;let a=this._singlePadLayerId;this._singlePadLayerId=n,Object.is(s,void 0)&&(s=n==1?0:n==2?2:1),this._singlePadType=s,n!=a&&this.mainRemove(),i=="Main And Highlight"?this.highlight(r):this.visible(r)}hidden(){var e,r,i,n,s,a;(e=this._pad)==null||e.hidden(),(r=this._mask)==null||r.hidden(),(i=this._solder)==null||i.hidden(),(n=this._paste)==null||n.hidden(),(s=this._maskByComponent)==null||s.hidden(),(a=this.maskShape)==null||a.hidden()}show(){var e,r,i,n,s,a;(e=this._pad)==null||e.show(),(r=this._mask)==null||r.show(),(i=this._solder)==null||i.show(),(n=this._paste)==null||n.show(),(s=this._maskByComponent)==null||s.show(),(a=this.maskShape)==null||a.show()}removePad(){this._pad&&(this.removeLastMaskShape(this._pad),delete this._pad)}removeSolder(){this._solder&&(this.removeLastMaskShape(this._solder),delete this._solder)}removePaste(){this._paste&&(this.removeLastMaskShape(this._paste),delete this._paste)}removeMaskShape(){this.maskShape&&(this.maskShape.remove(),delete this.maskShape)}mainRemove(){this.maskVisible(null,!1,null,null,!0),this.removePad(),this.removeSolder(),this.removePaste(),this.removeMaskShape()}remove(){this.mainRemove(),this.componentMaskVisible(!1,null,null,null),this.removeMaskShape()}mainMaskHighLightColor(e,r,i,n){!e||!r&&this.lastHighLightType==i||(this.lastHighLightType!=null&&e.highlight(!1,this.lastHighLightType,this.lastHighLightColor),i!=null&&e.highlight(!0,i,n),this.lastHighLightType=i,this.lastHighLightColor=n)}};var vz=class o extends Do{constructor(){super(),Ro("view/pcb/PadView")}get highLightType(){var t;return(t=o._viewDataModel)==null?void 0:t.highLightType}get manualHighLight(){var t;return(t=o._viewDataModel)==null?void 0:t.manualHighLight}get manualHighLightModified(){var t;return(t=o._viewDataModel)==null?void 0:t.manualHighLightModified}get layerModified(){var t;return(t=o._viewDataModel)==null?void 0:t.layerModified}get shapeModified(){var t;return(t=o._viewDataModel)==null?void 0:t.shapeModified}get highlightMaskColor(){var t;return(t=o._viewDataModel)==null?void 0:t.highlightMaskColor}get netModified(){var t;return(t=o._viewDataModel)==null?void 0:t.netModified}get highlightColor(){var t;return(t=o._viewDataModel)==null?void 0:t.highlightColor}get wireViewGroupId(){var t;return this.getEngineGroupId((t=o._viewDataModel)==null?void 0:t.wireViewGroupId)}get viewGroupIdModified(){var t;return(t=o._viewDataModel)==null?void 0:t.viewGroupIdModified}get forceUpdateMask(){var t;return(t=o._viewDataModel)==null?void 0:t.forceUpdateMask}get layerId(){var t;return(t=o._viewDataModel)==null?void 0:t.layerId}get type(){var t;return(t=o._viewDataModel)==null?void 0:t.type}get center(){var t;return(t=o._viewDataModel)==null?void 0:t.center}get rotation(){var t;return(t=o._viewDataModel)==null?void 0:t.rotation}get pasteExpansion(){var t;return(t=o._viewDataModel)==null?void 0:t.pasteExpansion}get topSolderExpansion(){var t;return(t=o._viewDataModel)==null?void 0:t.topSolderExpansion}get bottomSolderExpansion(){var t;return(t=o._viewDataModel)==null?void 0:t.bottomSolderExpansion}get hole(){var t;return(t=o._viewDataModel)==null?void 0:t.hole}get color(){return o._viewDataModel.partition==R.getInstance().partitionId?uo.getInstance().padConfig.getColor(o._viewDataModel.globalIndex,o._viewDataModel.net,o._viewDataModel.selectItem,o._viewDataModel.layerId==12):uo.getInstance().readonlyPadConfig.getColor(o._viewDataModel.globalIndex,o._viewDataModel.net)}get highlightByComponent(){var t;return(t=o._viewDataModel)==null?void 0:t.highlightByComponent}get usedLayers(){var t;return(t=o._viewDataModel)==null?void 0:t.usedLayers}get holeColor(){var t;return(t=o._viewDataModel)==null?void 0:t.holeColor}get pasteExpansionModified(){var t;return(t=o._viewDataModel)==null?void 0:t.pasteExpansionModified}get topSolderExpansionModified(){var t;return(t=o._viewDataModel)==null?void 0:t.topSolderExpansionModified}get bottomSolderExpansionModified(){var t;return(t=o._viewDataModel)==null?void 0:t.bottomSolderExpansionModified}get numModified(){var t;return(t=o._viewDataModel)==null?void 0:t.numModified}get topModified(){var t;return((t=o._viewDataModel)==null?void 0:t.topModified)||o._viewDataModel.shapeModified||o._viewDataModel.topSolderExpansionModified||o._viewDataModel.pasteExpansionModified}get bottomModified(){var t;return((t=o._viewDataModel)==null?void 0:t.bottomModified)||o._viewDataModel.shapeModified||o._viewDataModel.bottomSolderExpansionModified||o._viewDataModel.pasteExpansionModified}get innerModified(){var t;return((t=o._viewDataModel)==null?void 0:t.innerModified)||o._viewDataModel.shapeModified}get holeModified(){var t;return(t=o._viewDataModel)==null?void 0:t.holeModified}get net(){var t;return(t=o._viewDataModel)==null?void 0:t.showNet}get num(){var t;return(t=o._viewDataModel)==null?void 0:t.num}get top(){var t;return(t=o._viewDataModel)==null?void 0:t.top}get bottom(){var t;return(t=o._viewDataModel)==null?void 0:t.bottom}get inner(){var t;return(t=o._viewDataModel)==null?void 0:t.inner}get padShowNet(){return ea.getInstance().padShowNet}get showNum(){return ea.getInstance().padShowNum}modifyInnerViews(t,e,r){let i=e?r.filter(n=>![1,2].includes(n)):[this.layerId];this.innerViews||(this.innerViews=[]);for(let n=0;n<Math.max(this.innerViews.length,i.length);n++){if(!i[n]){this.innerViews[n].remove();continue}this.innerViews[n]=this.generate(this.innerViews[n],this.inner,i[n],1,t)}i.length>0?this.innerViews.length=i.length:delete this.innerViews}getFontPosition(t,e){return this.padShowNet||(t=""),this.showNum||(e=""),t!=""&&e!=""?1:t!=""&&e==""?2:t==""&&e!=""?2:3}getFontHigh(){var t,e;return this.layerId==2?(t=this.bottom)==null?void 0:t.height:(e=this.top)==null?void 0:e.height}getFontWidth(){var t,e;return this.layerId==2?(t=this.bottom)==null?void 0:t.width:(e=this.top)==null?void 0:e.width}isCircle(){return this.layerId==2?this.bottom.type=="ELLIPSE":this.top.type=="ELLIPSE"}getNetLayerId(){return this.layerId==12?47:this.layerId}createNetAndNumberView(){if(!this.shapeModified&&!this.netModified&&!this.numModified&&!this.layerModified){let{net:y,num:b}=this,P=this.padShowNet&&y,T=this.showNum&&b;if(P&&T){if(this.netView!=null&&this.numView!=null){this.manualHighLightModified&&(this.netView.forceVisibleHighLight(this.manualHighLight),this.numView.forceVisibleHighLight(this.manualHighLight));return}}else if(P&&!T){if(this.netView!=null&&this.numView==null){this.manualHighLightModified&&this.netView.forceVisibleHighLight(this.manualHighLight);return}}else if(!P&&T){if(this.netView==null&&this.numView!=null){this.manualHighLightModified&&this.numView.forceVisibleHighLight(this.manualHighLight);return}}else if(this.netView==null&&this.numView==null)return}let{net:t,num:e,wireViewGroupId:r}=this,i=this.getNetLayerId();if(this.padShowNet&&t?this.netView||(this.netView=new vl(i)):this.removeNetView(),this.showNum&&e?this.numView||(this.numView=new vl(i)):this.removeNumView(),!this.netView&&!this.numView)return;let{rotation:n,center:s}=this,a=this.getFontPosition(t,e),l=new S(Math.cos(n),Math.sin(n));this.isCircle()&&(l=new S(1,0));let c=new S(-l.y,l.x),h=Math.atan2(l.y,l.x);(h<-Go||h>Go)&&(c=new S(l.y,-l.x)),h<0&&(l=l.mul(-1));let u=s,d=s,p=this.getFontHigh(),m=this.getFontWidth();if(a==1)if(m>=p){let y=c.mul(p*.25);u=s.sub(y),d=s.add(y),p*=.5}else{let y=l.mul(m*.25);u=s.sub(y),d=this.center.add(y),m*=.5}let g=n;m==p||this.isCircle()?g=0:(m<p&&(g+=Go),g=zke(g)),this.netView&&(m>=p?this.netView.visible(i,t,u,g,Pc,Tc,m,p,void 0,r):this.netView.visible(i,t,u,g,Pc,Tc,p,m,void 0,r)),this.numView&&(m>=p?this.numView.visible(i,e,d,g,Pc,Tc,m,p,void 0,r):this.numView.visible(i,e,d,g,Pc,Tc,p,m,void 0,r)),this.netView&&this.netView.forceVisibleHighLight(this.manualHighLight),this.numView&&this.numView.forceVisibleHighLight(this.manualHighLight)}generate(t,e,r,i,n){let s=this.layerId,a=!1;return s==1||s==12?a=r==1||i==0:s==2&&(a=r==2||i==2),t?a&&!(t instanceof Sk)&&(t.remove(),t=new Sk):a?t=new Sk:t=new sh,t.modify(this,e,n,r,i),t}visible(t){this.refreshShapeViews(t)}highlight(t){this.refreshShapeViews(t)}refreshShapeViews(t,e){e!=null&&(this.grayIndex=e);let r=this.usedLayers,i=r.length>0||this.type==2||this.grayIndex!=0;this.top?this.topView=this.generate(this.topView,this.top,i?1:this.layerId,0,t):this.removeTopView(),this.inner?this.modifyInnerViews(t,i,r):this.removeInnerViews(),this.bottom?this.bottomView=this.generate(this.bottomView,this.bottom,i?2:this.layerId,2,t):this.removeBottomView(),this.hole!=null?(this.holeView||(this.holeView=new Ck(this)),this.holeView.modify(this.hole,t,47,this.holeColor,this.highlightByComponent)):this.removeHoleView()}modify(t,e){switch(o._viewDataModel=t,this.grayIndex=t.grayIndex,this.createNetAndNumberView(),e){case"Only Main":{this.visible(e);break}case"Main And Highlight":{this.highlight(e);break}default:break}}remove(){this.removeTopView(),this.removeInnerViews(),this.removeBottomView(),this.removeHoleView(),this.removeNetView(),this.removeNumView()}removeTopView(){this.topView&&(this.topView.remove(),delete this.topView)}removeInnerViews(){this.innerViews&&(this.innerViews.forEach(t=>t.remove()),delete this.innerViews)}removeBottomView(){this.bottomView&&(this.bottomView.remove(),delete this.bottomView)}removeHoleView(){this.holeView&&(this.holeView.remove(),delete this.holeView)}removeNetView(){this.netView&&(this.netView.remove(),delete this.netView)}removeNumView(){this.numView&&(this.numView.remove(),delete this.numView)}};var Lee=class extends jh{visible(t,e,r,i,n,s,a=.5){if(this.layerId!=t&&this.remove(),this.layerId=t,!Ra.unRefreshScene)if(this.isValidId())this.plane.createOrUpdateTexture(this.id,r,i,n,s,void 0,void 0,a);else{let l=cn.getInstance().getLayer(t).layer.plane.scene.getTexture(e);this.id=this.plane.createOrUpdateTexture(-1,r,i,n,s,l,[],a)}}remove(){this.isValidId()&&(this._removeCb&&(this._removeCb(),this.plane.removeHighLightPt(this.id),this.lastHighLightForce=null),this.plane.removeTexture(this.id)),this.resetId()}};var xz=class extends Do{constructor(){super(...arguments);this._lastAlpha=0}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get source(){var e;return(e=this._viewDataModel)==null?void 0:e.source}get leftDown(){var e;return(e=this._viewDataModel)==null?void 0:e.leftDown}get leftUp(){var e;return(e=this._viewDataModel)==null?void 0:e.leftUp}get rightDown(){var e;return(e=this._viewDataModel)==null?void 0:e.rightDown}get rightUp(){var e;return(e=this._viewDataModel)==null?void 0:e.rightUp}get alpha(){var e;return(e=this._viewDataModel)==null?void 0:e.alpha}get hashIdModified(){var e;return(e=this._viewDataModel)==null?void 0:e.hashIdModified}mainVisible(){var i;let e=!1;(this.layerModified||this.hashIdModified)&&(this.maskVisible(!1),(i=this.main)==null||i.remove(),e=!0),this.main||(this.main=new Lee(this.layerId),e=!0);let r=this.alpha;e||(e=this.layerModified||this.shapeModified||this.hashIdModified||this._lastAlpha!=r),this._lastAlpha=r,e&&this.main.visible(this.layerId,this.source,this.leftDown,this.leftUp,this.rightDown,this.rightUp,r)}maskVisible(e){if(!e){this._mask&&(this._mask.remove(),delete this._mask);return}this._mask||(this._mask=new b0(1002));let r=this.highlightColor||ee.BLACK,i=this._viewDataModel.box,n=i.isFlipX()?i.leftLow:i.leftUp,s=i.width,a=i.height,l=i.rotation;this._mask.visible(1002,n,s,a,l,0,r,null,this.highLightType)}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0)}modify(e,r){switch(super.modify(e,r),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){var e;this.maskVisible(!1),(e=this.main)==null||e.remove()}};var dCt=/(\.?0+)$/,ju=class{static format(t,...e){return this.format1(t,e)}static format1(t,e){let r=this._format(t,e);if(typeof r=="string")return r;throw new Error(this.format("Invalid state on (%d) %s",r,t))}static _format(t,e){let r=[],i=0,n=0,s,a=0,l=0;for(let c=0;c<t.length;c++){let h=t.charAt(c),u=h.charCodeAt(0);switch(i){case 0:u===37?i=1:r.push(h);break;case 1:switch(u){case 100:if(s=e[n++],typeof s=="number")r.push(s.toFixed(0)),i=0;else return c;break;case 102:if(s=e[n++],typeof s=="number")r.push(s.toString()),i=0;else return c;break;case 120:if(s=e[n++],typeof s=="number")r.push((s|0).toString(16)),i=0;else return c;break;case 88:if(s=e[n++],typeof s=="number")r.push((s|0).toString(16).toUpperCase()),i=0;else return c;break;case 115:case 99:s=e[n++],r.push(s===null?"null":s.toString()),i=0;break;case 48:a=c+1,l=-1,i=2;break;case 37:r.push("%"),i=0;break;default:return c}break;case 2:switch(u){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:l=c;break;case 120:if(l>=a){let d=parseInt(t.substring(a,l+1));if(s=e[n++],typeof s=="number")r.push(xe.lpad((s|0).toString(16),"0",d)),i=0;else return c}else return c;break;case 88:if(l>=a){let d=parseInt(t.substring(a,l+1));if(s=e[n++],typeof s=="number")r.push(xe.lpad((s|0).toString(16).toUpperCase(),"0",d)),i=0;else return c}else return c;break;default:return c}break;default:return c}}return r.join("")}static startsWith(t,e){return t.length>=e.length?t.substring(0,e.length)===e:!1}static endsWith(t,e){return t.length>=e.length?t.substring(t.length-e.length)===e:!1}static split(t,e){let r=new Array,i=0;for(;;){let n=t.exec(e);if(n!==null){let s=t.lastIndex-n[0].length;r.push(e.substring(i,s)),i=t.lastIndex}else{let s=e.substring(i);Ki.nullOrEmpty(s)||r.push(s);break}}return r}static fmtNumber(t){return t.toFixed(5).replace(dCt,"")}};var Ki=class{static rgb(t){if(0<=t&&t<=255)return t;throw new Error(ju.format("RGB should not nagative and not over 255(0xFF): %X",t))}static normal(t){if(isFinite(t))return t;throw new Error(ju.format("%f is not permitted",t))}static positiveOr0(t){if(t>=0)return t;throw new Error(ju.format("%f must >= 0",t))}static positive(t){if(t>0)return t;throw new Error(ju.format("%f must > 0",t))}static notnull(t){if(t!=null)return t;throw new Error("invalid null value")}static mustnull(t){if(t===null)return null;throw new Error("value must be null")}static notEmpty(t){if(t==null||t.length===0)throw new Error("invalid empty string");return t}static nullOrEmpty(t){return t==null||t.length===0}static notNullOrUndef(t){if(t!=null)return t;throw new Error("null or undefined is not permitted")}};var gu=class gu{static isTop(t){switch(t){case 4:case 3:case 2:case 1:return!0;default:return!1}}static isBot(t){switch(t){case 7:case 8:case 9:case 10:return!0;default:return!1}}constructor(t,e){this._resetLayer(t,e)}_resetLayer(t,e){switch(this.type=t,t){case 5:case 13:case 6:this.order=Ki.positive(e);break;default:if(e===0)this.order=e;else throw new Error(ju.format("layer type %s order must eq 0, not %d",t,e))}this.setHash()}setHash(){this.hashed=32*(32+this.type)+this.order}hashCode(){return this.hashed}toString(){return"PcbLayer [type="+this.type+", order="+this.order+"]"}equals(t){return t instanceof gu?this.type===t.type&&this.order===t.order:!1}};gu.MULTI=new gu(0,0),gu.TOP_SILK=new gu(1,0),gu.TOP_SOLDER_MASK=new gu(2,0),gu.TOP_PASTE=new gu(3,0),gu.TOP_COPPER=new gu(4,0),gu.BOT_COPPER=new gu(7,0),gu.BOT_PASTE=new gu(8,0),gu.BOT_SOLDER_MASK=new gu(9,0),gu.BOT_SILK=new gu(10,0),gu.OUTLINE=new gu(11,0),gu.DOCUMENT=new gu(12,0),gu.RATELINE=new gu(14,0),gu.OTHER=new gu(16,0);var $r=gu;var Yke=!1,Ek=class{onRTreeBBox(t){}onResultSide(t){}onOriginSide(t){}onSplitedSide(t){}onDebugSide(t){}onSweep(t,e,r,i,n,s){}onIntersect(t,e,r){}onSegment(t,e,r,i,n,s){}onSegment1(t,e,r){if(Yke){let i=new S(t.getX(r),r),n=new S(e.getX(r),r);this.onSegment(i,t.weight,t,n,e.weight,e)}else this.onSegment(t.start,t.weight,t,e.end,e.weight,e)}onSweep1(t,e,r){if(Yke){let i=new S(t.getX(r),r),n=new S(e.getX(r),r);this.onSweep(i,t.weight,t,n,e.weight,e)}else this.onSweep(t.start,t.weight,t,e.end,e.weight,e)}};var ia=class{constructor(t,e,r){this.id=t,this.net=e,this.layer=r}};var MO=class o extends ia{constructor(t,e,r,i,n,s){super(s||"",t,e),this.kind=r,this.outlines=i,this.__bbox=this._bbox(),this.targets=n}multiply3(t){return new o(this.net,this.layer,this.kind,this.outlines.multiply3(t),this.targets)}bbox(){return this.__bbox}_bbox(){return this.outlines.bbox()}shape(t,e){return this.layer.equals(t)||this.layer.equals($r.MULTI)?this.outlines:null}};var Os=class o extends ia{constructor(t,e,r,i,n,s){super(s||"",t,e),this.start=r,this.end=i,this.width=Ki.normal(n),this.__bbox=this._bbox()}multiply3(t){return new o(this.net,this.layer,this.start.multiply3(t),this.end.multiply3(t),t.iScale*this.width,this.id)}reverse(){return new o(this.net,this.layer,this.end,this.start,this.width,this.id)}bbox(){return this.__bbox}_bbox(){let t=this.width/2;return new _e().ext2(this.start.add1(t,t)).ext2(this.start.add1(-t,-t)).ext2(this.end.add1(t,t)).ext2(this.end.add1(-t,-t)).build1()}shape(t,e){return this.layer.equals(t)?new M(this.start,this.end).stroke(this.width+e*2,wr.ROUND,ae.CW):null}};var Ok=class o extends ia{constructor(t,e,r,i,n){super("",t,e),this.arc=r,this.width=i,this.keepout=n}multiply3(t){return new o(this.net,this.layer,this.arc.multiply3(t),t.iScale*this.width,this.keepout)}bbox(){return this.arc.bbox()}shape(t,e){return this.layer.equals(t)?this.arc.stroke(this.width+e*2,wr.ROUND,ae.CW):null}};var e1=class e1{static toDegrees(t){return t*180/Math.PI}static toRadians(t){return t/180*Math.PI}static regularD(t){return t=t%360,t=t<0?360+t:t,t===360?0:t}static regular(t){return t=t%e1.PIx2,t=t<0?e1.PIx2+t:t,t===e1.PIx2?0:t}static toQuarterBase(t){return e1.regular((t+e1.PI_4)/e1.PI_2*e1.PI_2)}static toQuarterBaseD(t){return e1.regularD(((t+45)/90|0)*90)}static transformD(t,e){return e1.toDegrees(e1.transform(e1.toRadians(t),e))}static transform(t,e){let r=Math.cos(t),i=Math.sin(t),n=new S(e.data[6],e.data[7]),s=new S(r,i).multiply3(e);return e1.regular(s.angle(n))}};e1.PIx2=Math.PI*2,e1.PI_2=Math.PI/2,e1.PI_4=Math.PI/4;var zt=e1;var eS=class o extends ia{constructor(t,e,r,i,n,s,a){super("",t,e),this.location=r,this.rotation=Ki.normal(i),this.text=n,this.font=s,this.mirror=a,this.__bbox=this._bbox()}multiply3(t){return new o(this.net,this.layer,this.location.multiply3(t),zt.transformD(this.rotation,t),this.text,this.font.transform(t),this.mirror)}bbox(){return this.__bbox}_bbox(){let t=this.font.size*this.text.length/2,e=this.rotation;this.mirror&&(e+=180);let r=this.location,i=this.location.add1(t,this.font.size);if(e%360===0)return new _e().ext2(r).ext2(i).build1();{let n=this.location.add1(t,0),s=this.location.add1(0,this.font.size),a=Qe.rotateD(e).setOrigin1(this.location);return new _e().ext2(r.multiply3(a)).ext2(i.multiply3(a)).ext2(n.multiply3(a)).ext2(s.multiply3(a)).build1()}}shape(t,e){return null}};var xv=class o{constructor(t,e,r,i=!1,n=!1){this.familly=t,this.size=e,this.weight=r,this.italic=i,this.bold=n}transform(t){return new o(this.familly,t.iScale*this.size,t.iScale*this.weight,this.italic,this.bold)}hashCode(){return xe.strHashcode(this.familly)^this.size^this.weight}equals(t){return this===t?!0:t==null?!1:t instanceof o?!(this.familly!==t.familly||this.size!==t.size||this.weight!==t.weight||this.italic!==t.italic||this.bold!==t.bold):!1}};var jke=new eS("",$r.DOCUMENT,S.ORIGIN,0,"",new xv("",0,0),!1),ATe=class o{constructor(){this.layer=null;this.location=null;this.orientation=Number.NaN;this.pattern=null;this.showDesignator=!1;this.showComment=!1;this.designator=null;this.comment=null;this.shapes=[]}clone(t){let e=new o;e.layer=t.layer,e.location=t.location,e.orientation=t.orientation,e.pattern=t.pattern,e.uniqueId=t.uniqueId,e.showDesignator=t.showDesignator,e.showComment=t.showComment,e.designator=t.designator,e.comment=t.comment;for(let r of t.shapes)e.shapes.push(r);return e}asContainer(){return this.orientation=0,this.pattern="",this.showDesignator=!1,this.showComment=!1,this.designator=jke,this.comment=jke,this}build(){return new Rz(this)}},Rz=class extends ia{constructor(t){if(super(t.id||"","",Ki.notnull(t.layer)),this.uniqueId=t.uniqueId||t.id,this.location=Ki.notnull(t.location),this.orientation=Ki.normal(t.orientation),this.pattern=Ki.notnull(t.pattern),this.showDesignator=t.showDesignator,this.showComment=t.showComment,this.designator=Ki.notnull(t.designator),this.comment=Ki.notnull(t.comment),this.props=t.props,t.shapes.length==0)throw new Error("no shape in component ");this.shapes=t.shapes.slice(0),this.__bbox=this._bbox()}multiply3(t){let e=new ATe;e.layer=this.layer,e.props=this.props,e.location=this.location.multiply3(t),e.orientation=zt.transformD(this.orientation,t),e.pattern=this.pattern,e.id=this.id,e.uniqueId=this.uniqueId,e.showDesignator=this.showDesignator,e.showComment=this.showComment,e.designator=this.designator.multiply3(t),e.comment=this.comment.multiply3(t);for(let r of this.shapes)e.shapes.push(r.multiply3(t));return e.build()}bbox(){return this.__bbox}_bbox(){let t=new _e;for(let e of this.shapes)t.ext1(e.bbox());return this.showDesignator&&t.ext1(this.designator.bbox()),this.showComment&&t.ext1(this.comment.bbox()),t.build1()}shape(t,e){throw new Error("unsupported operation")}};var Mee=class{constructor(t,e,r){this.sourceName=t,this.contributor=e,this.scale=r}};function tI(o,t){vTe(o.iterator(),t)}function vTe(o,t){let e=0;for(;o.hasNext();){let r=o.next();t(e++,r)}}var _Te=class{constructor(t){this.idx=-1;this.lst=t}hasNext(){return this.idx<this.lst.length-1}next(){if(this.idx<this.lst.length-1)return this.idx++,this.lst[this.idx];throw new Error("bug")}};function Nee(o){return new _Te(o)}var kee=class{constructor(){this.inner=new Array}contains(t){for(let e of this.inner)if(e.equals(t))return!0;return!1}add(t){this.contains(t)||this.inner.push(t)}addAll1(t){this.addAll2(t.iterator())}addAll2(t){vTe(t,(e,r)=>(this.add(r),!0))}array(){return this.inner}size(){return this.inner.length}isEmpty(){return this.inner.length===0}iterator(){return Nee(this.inner)}};var Bee=class{constructor(){this.sourceName=null;this.contributor=null;this.scale=Number.NaN;this.location=null;this.rules={};this.shapes=[];this.layerStack=new kee;this.layerInfos={};this.ruleCache=null;this.ruleNetCache=null;this.ruleOptions={}}build(){return new xTe(this)}addLayerOrder(...t){if(t!==null)for(let e=0;e<t.length;e++){let r=Ki.notnull(t[e]);if(this.layerStack.contains(r))throw new Error(ju.format("duplicate layer %s",r));this.layerStack.add(r)}}getRules(t){return this.rules[t]||(this.rules[t]=[]),this.rules[t]}},xTe=class extends Mee{constructor(e){super(Ki.notnull(e.sourceName),Ki.notnull(e.contributor),e.scale);this.ruleCache=null;this.ruleNetCache=null;this.ruleOptions={};this.rules=e.rules,this.shapes=e.shapes.slice(0),this.layerStack=e.layerStack.array().slice(0),this.layerInfos=e.layerInfos||{},this.ruleCache=e.ruleCache,this.ruleNetCache=e.ruleNetCache,this.ruleOptions=e.ruleOptions}components(){let e={},r=[];for(let i of this.shapes)i instanceof Rz&&(i.pattern in e||(e[i.pattern]=!0,r.push(i)));return r}};var pCt=!1,fCt=!0,mCt=!1,gCt=!1,yCt=!0,bCt=!0,PCt=!0,TCt=!0,ICt=new $r(5,1),CCt=new $r(5,2),SCt=new $r(5,3),ECt=new $r(5,4),OCt=new $r(5,5),ACt=new $r(5,6),Ak=class extends Ek{constructor(e){super();this.shapes=[];this.debug=e}display(){let e=new Bee;return e.contributor="",e.sourceName="",e.scale=10,xe.addAll(e.shapes,this.shapes),e.build()}onPolylineGroup(e,r){if(this.debug)for(let i of e.items)this.debug1(OCt,r.toString(),i)}onRTreeBBox(e){if(this.debug&&pCt)for(let r of ge.build4([e.LL(),e.UL(),e.UR(),e.LR(),e.LL()]).primitives)this.debug2($r.TOP_SILK,"",r,.003)}onSegment(e,r,i,n,s,a){if(this.debug&&fCt){let l=ju.format("SG (%d,%d,%d) : (%d,%d,%d) : %s : %s",i.polyGrp,i.polyIndex,r,a.polyGrp,a.polyIndex,s,e,n);this.debug2($r.BOT_COPPER,l,new M(e,n),.003)}}onIntersect(e,r,i){if(this.debug&&gCt){let n=ju.format("%d,%d:%d,%d:%s",r.polyGrp,r.polyIndex,i.polyGrp,i.polyIndex,e);this.debug2(CCt,n,new M(e.add1(-.01,0),e.add1(.01,0)),.01)}}onResultSide(e){this.debug&&yCt&&this.debug2(ECt,e.toString(),e.shape,.003)}onOriginSide(e){this.debug&&bCt&&this.debug2($r.TOP_COPPER,e.toString(),e.shape,.003)}onSplitedSide(e){this.debug&&PCt&&this.debug2(SCt,e.toString(),e.shape,.003)}onDebugSide(e){this.debug&&TCt&&this.debug2(ACt,e.toString(),e.shape,.003)}onSweep(e,r,i,n,s,a){if(this.debug&&mCt){let l=ju.format("SW (%d,%d,%d) : (%d,%d,%d) : %s : %s",i.polyGrp,i.polyIndex,r,a.polyGrp,a.polyIndex,s,e,n);this.debug2(ICt,l,new M(e,n),.003)}}debug1(e,r,...i){for(let n of i)this.shapes.push(new MO(r,e,0,n))}debug2(e,r,i,n){i instanceof M?this.shapes.push(new Os(r,e,i.start(),i.end(),n)):i instanceof q?this.shapes.push(new Ok(r,e,i,n,!1)):this.debug1(e,r,i.stroke(n,wr.BUTT,ae.CW))}};var j0=class{static dotProd1(t,e,r,i){return t*r+e*i}static dotProd2(t,e,r,i,n,s){return this.dotProd1(r-t,i-e,n-r,s-i)}static dotProd3(t,e,r){return this.dotProd2(t.x,t.y,e.x,e.y,r.x,r.y)}static crossProd1(t,e,r,i){return t*i-e*r}static crossProd2(t,e,r,i,n,s){return this.crossProd1(r-t,i-e,n-r,s-i)}static crossProd3(t,e,r){return this.crossProd2(t.x,t.y,e.x,e.y,r.x,r.y)}static distance2(t,e,r,i){let n=r-t,s=i-e;return n*n+s*s}static distance1(t,e,r,i){return this.hypot(r-t,i-e)}static distance1p(t,e){return this.distance1(t.x,t.y,e.x,e.y)}static hypot(t,e){if(t=Math.abs(t),e=Math.abs(e),e>t){var r=e;e=t,t=r}if(t===0)return e;var i=e/t;return t*Math.sqrt(1+i*i)}};var Zke=[1,10,100,1e3],Xke="http://www.w3.org/2000/svg",qke="http://www.w3.org/1999/xlink",$ke="http://www.w3.org/XML/1998/namespace",Kke="https://easyeda.com/",kO=(function(){var o={svg:Xke,xlink:qke,xml:$ke,c:Kke};return o[Xke]="svg",o[qke]="xlink",o[$ke]="xml",o[Kke]="c",o})();var Hd=(function(){var o={RATLINES:9,MODEL3D:19,ALL:11,TOPSILKLAYER:3,TOPLAYER:1,TOPPASTERLAYER:5,TOPSOLDERLAYER:7,LIBBODY:99,PADSURFACE:100,BOARDOUTLINE:10,DOCUMENT:12,TOPASSEMBLY:13,MECHANICAL:15,TOPCOMPONENT:16,SUBSTRATE:18},t;for(t=21;t<53;t++)o["INNER"+(t-20)]=t;for(o.BOTTOMSILKLAYER=4,o.BOTTOMLAYER=2,o.BOTTOMPASTERLAYER=6,o.BOTTOMSOLDERLAYER=8,o.BOTTOMASSEMBLY=14,o.BOTTOMCOMPONENT=17,t=53;t<85;t++)o["BOARD"+(t-52)]=t;return o})(),Htr=(function(){var o={COPPERAREA:[1,2,21,22,23,24],PLANEZONE:[1,2,21,22,23,24],RECT:[1,2,3,4,5,6,7,8,12,13,14,15,21,22,23,24,99],TRACK:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],PAD:[11,1,2],VIA:[11],HOLE:[11],TEXT:[3,4,1,2,7,8,12,13,14,15,21,22,23,24],ARC:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],ELLIPSE:[3,4,12,13,14,15],CIRCLE:[1,2,3,4,5,6,7,8,10,12,13,14,15,21,22,23,24,99],DIMENSION:[3,4,12,13,14,15],FOOTPRINT:[1,2],SOLIDREGION:[1,2,3,4,5,6,7,8,12,13,14,15,21,22,23,24,11,99,100],SVGNODE:[1,2,3,4,7,8,12,13,14,15],PROTRACTOR:[3,4,12,13,14,15],SHEET:[12,13,14,15]};o["3D"]=(function(){for(var i=[16,19,3,7,5,1],n=21;n<52;n++)i.push(n+32,n);return i.push(2,6,8,4,17),i})();var t,e,r;for(t in o)if(o.hasOwnProperty(t)&&(r=o[t],r.indexOf(21)>0&&r.indexOf(25)===-1))for(e=25;e<=52;e++)r.push(e);return o})(),Sm=(function(){var o={1:"TopLayer",2:"BottomLayer",3:"TopSilkLayer",4:"BottomSilkLayer",5:"TopPasteMaskLayer",6:"BottomPasteMaskLayer",7:"TopSolderMaskLayer",8:"BottomSolderMaskLayer",9:"Ratlines",10:"BoardOutLine",11:"Multi-Layer",12:"Document",13:"TopAssembly",14:"BottomAssembly",15:"Mechanical",16:"TopComponents",17:"BottomComponents",18:"Substrate",19:"3DModel",99:"ComponentShapeLayer",100:"LeadShapeLayer"},t;for(t=21;t<53;t++)o[t]="Inner"+(t-20);for(t=53;t<85;t++)o[t]="Substrate"+(t-52);return o})(),Wtr=(function(){var o=[],t=[];for(var e in Hd)if(Hd.hasOwnProperty(e)){if(e.match(/^BOARD\d+/))continue;o.push(Hd[e])}o.sort(),t.sort();var r={},i,n={21:"#999966",22:"#008000",23:"#00FF00",24:"#BC8E00",25:"#70DBFA",26:"#00CC66",27:"#9966FF",28:"#800080",29:"#008080",30:"#15935F",31:"#000080",32:"#00B400",33:"#2E4756",34:"#99842F",35:"#FFFFAA",36:"#99842F",37:"#2E4756",38:"#3535FF",39:"#8000BC",40:"#43AE5F",41:"#C3ECCE",42:"#728978",43:"#39503F",44:"#0C715D",45:"#5A8A80",46:"#2B937E",47:"#23999D",48:"#45B4E3",49:"#215DA1",50:"#4564D7",51:"#6969E9",52:"#9069E9"};o.forEach(function(a){switch(a){case Hd.TOPLAYER:i={name:Sm[a],color:"#FF0000",darkColor:"#CC0000",visible:!0,active:!0,config:!0};break;case Hd.BOTTOMLAYER:i={name:Sm[a],color:"#0000FF",darkColor:"#000080",visible:!0,active:!1,config:!0};break;case Hd.TOPSILKLAYER:i={name:Sm[a],color:"#FFCC00",darkColor:"#806600",visible:!0,active:!1,config:!0};break;case Hd.BOTTOMSILKLAYER:i={name:Sm[a],color:"#66CC33",darkColor:"#33661A",visible:!0,active:!1,config:!0};break;case Hd.TOPPASTERLAYER:i={name:Sm[a],color:"#808080",darkColor:"#666666",visible:!0,active:!1,config:!0};break;case Hd.BOTTOMPASTERLAYER:i={name:Sm[a],color:"#800000",darkColor:"#660000",visible:!0,active:!1,config:!0};break;case Hd.TOPSOLDERLAYER:i={name:Sm[a],color:"#800080",darkColor:"#660066",visible:!0,active:!1,transparency:.3,config:!0};break;case Hd.BOTTOMSOLDERLAYER:i={name:Sm[a],color:"#AA00FF",darkColor:"#8800CC",visible:!0,active:!1,transparency:.3,config:!0};break;case Hd.RATLINES:i={name:Sm[a],color:"#6464FF",darkColor:"#5050CC",visible:!1,active:!1,config:!0};break;case Hd.BOARDOUTLINE:i={name:Sm[a],color:"#FF00FF",darkColor:"#CC00CC",visible:!0,active:!1,config:!0};break;case Hd.ALL:i={name:Sm[a],color:"#C0C0C0",darkColor:"#999999",visible:!0,active:!1,config:!0};break;case Hd.DOCUMENT:i={name:Sm[a],color:"#FFFFFF",darkColor:"#CCCCCC",visible:!0,active:!1,config:!0};break;case Hd.TOPASSEMBLY:i={name:Sm[a],color:"#33CC99",darkColor:"#33AA99",visible:!1,active:!1,config:!1};break;case Hd.BOTTOMASSEMBLY:i={name:Sm[a],color:"#5555FF",darkColor:"#8888FF",visible:!1,active:!1,config:!1};break;case Hd.MECHANICAL:i={name:Sm[a],color:"#F022F0",darkColor:"#F088F0",visible:!1,active:!1,config:!1};break;case Hd.MODEL3D:i={name:Sm[a],color:"#66CCFF",visible:!1,active:!1,config:!1};break;case Hd.LIBBODY:i={name:Sm[a],color:"#00CCCC",visible:!1,active:!1,config:!1};break;case Hd.PADSURFACE:i={name:Sm[a],color:"#CC9999",visible:!1,active:!1,config:!1};break;default:a>=Hd.INNER1&&a<=Hd.INNER32?i={name:Sm[a],color:n[a],darkColor:s(n[a]),visible:!1,active:!1,config:!1}:i=null;break}i&&(r[a]=i)}),r.Hole={config:!0,name:"Hole",darkColor:"#222222",color:"#222222"},r.DRCError={config:!0,name:"DRCError",color:"#FAD609",darkColor:"#FAD609"};function s(a){if(typeof a!="string"||!a.match(/#?([\da-f]{6})/i))return a;var l=parseInt(RegExp.$1,16),c=.5,h=Math.min(255,Math.round((l>>16)*c)),u=Math.min(255,Math.round((l>>8&255)*c)),d=Math.min(255,Math.round((l&255)*c)),p=((h<<16)+(u<<8)+d).toString(16);return"#"+("00000"+p).substr(-6).toUpperCase()}return r})(),pi={BLANK:0,SCH:1,PART:2,PCB:3,FOOTPRINT:4,PRJ:5,SUBPART:6,SPICESYMBOL:7,SUBCKT:8,NETLIST:9,WAVEFORM:10,SCHLIB3D:11,PHOTOVIEW:12,SCHMODULE:13,PCBMODULE:14,VIEW3D:15,PCBLIB3D:16,BLOCK_SYMBOL:17,NETFLAG:18,NETPORT:19,SHEET_SYMBOL:20,NONEELEC_SYMBOL:21,SHORT_SYMBOL:22,FOOTPRINTVIEW:23,PCB2D:31,PCB3D:32},ztr=(function(){var o={};for(let t in pi)o[pi[t]]=t;return o})(),xl={PRJ:"1",BOARDS:"2",BOARD:"3",BLOCKS:"4",BLOCK:"5",SCH:"6",SHEET:"7",SYMBOLS:"8",SYMBOL:"9",NETS:"10",NET:"11",WIRE:"13",BLOCK_SYMBOL:"12",BUS:"14",SYMBOLCOLLECT:"15",NETCLASS:"16",NETCOLLECT:"17",NETTREENODE:"18",REUSEBLOCKS:"19",REUSEBLOCK:"20",NETPORTS:"23",NETPORT:"24",NETFLAGS:"25",NETFLAG:"26",SHORTSYMBOLS:"27",SHORTSYMBOL:"28",NONEELECSYMBOLS:"29",NONEELECSYMBOL:"30",PRIMITIVES:"31",PRIMITIVE:"32",PCB:"101",ALLNETROOT:"106",ObjectRoot:"objectRoot",Object:"object",TrackNet:"trackNet",TestPadNet:"testPadNet",CopperLayer:"copperLayer",Copper:"copper",Group:"group",ComponentClassification:"componentClassification",Nets:"nets",Net:"net",NetClasses:"netClasses",NetClass:"netClass",RatlineNets:"ratlineNets",RatlineNet:"ratlineNet",Ratline:"ratline",Differentials:"differentials",Differential:"differential",EqualLengthGroups:"equalLengthGroups",EqualLengthGroup:"equalLengthGroup",PadsPairGroups:"PadsPairGroups",PadsPairGroup:"padsPairGroup",PadsPair:"padsPair",NetComponents:"netComponents",layerPair:"layerpair",Radiuse:"radiuse",Errors:"errors",ErrorType:"errorType",ErrorObjType:"errorObjType"};var Qke=Math.PI*2,RTe=Math.PI/2,DTe=Math.sin(Math.PI/180);function gn(o,t,e){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=Zke[t]||Math.pow(10,t)||10;if(e){var i=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*r)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),parseFloat(i+o)}else return Math.round(o*r+1e-10)/r}function Jke(o){let t=0;o>0?t=o-Math.floor(o):t=o-Math.ceil(o);let e=(t.toString()||"").length;return e>2?e-2:0}function Rv(o,t,e){if(e>=5&&Math.abs(o-t)>1e-5)return!1;let r=Math.min(Jke(o),Jke(t));return r<10&&(r=10),isNaN(e)||(r=Math.min(r,e)),gn(o,r)===gn(t,r)}function Fee(o,t,e,r){var i=o.x,n=o.y,s=t.x,a=t.y,l=e.x,c=e.y,h=s-i,u=a-n,d=h*h+u*u,p=((l-i)*h+(c-n)*u)/d;if((p>1||p<0)&&r)return null;var m=i+p*h,g=n+p*u;return{x:m,y:g}}function Vee(o,t,e,r){function i(g,y){return g.x==y.x&&g.y==y.y}var n=i(o,e)||i(o,r)?o:i(t,e)||i(t,r)?t:null;if(n)return{x:n.x,y:n.y};var s,a,l,c,h,u,d,p,m;return s=t.x-o.x,a=t.y-o.y,l=r.x-e.x,c=r.y-e.y,d=l*a-c*s,d===0?!1:(p=e.x-o.x,m=e.y-o.y,u=(s*m-a*p)/d,h=(l*m-c*p)/d,u>=0&&u<=1&&h>=0&&h<=1?{x:o.x+h*s,y:o.y+h*a}:!1)}function eBe(o,t,e){var r,i=+t.x,n=+t.y,s=+e.x,a=+e.y,l=+o.x,c=+o.y,h=s-i,u=a-n,d=l-i,p=c-n,m,g,y,b,P,T;return h===0&&u===0?{d:Math.sqrt(d*d+p*p),point:{x:i,y:n}}:(r=(d*h+p*u)/(h*h+u*u),r<0?{d:Math.sqrt(d*d+p*p),point:{x:i,y:n}}:r>1?(m=l-s,g=c-a,{d:Math.sqrt(m*m+g*g),point:{x:s,y:a}}):(P=i+r*h,T=n+r*u,y=l-P,b=c-T,{d:Math.sqrt(y*y+b*b),point:{x:P,y:T}}))}function OL(o,t,e,r){var i=e-o,n=r-t,s=Math.atan2(n,i);return s=s<0?s+Math.PI+Math.PI:s,s}function Gee(o){return o<0?(360+o%360)%360:o>=360?o%360:o}function db(o,t,e){var r=o-t;return e||(e=1e-10),(r>0?r:-r)<e}function Dz(o){if(!o.length)return[];for(var t=[],e={},r=0;r<o.length;r++){var i=typeof o[r]+o[r];e[i]||(t.push(o[r]),e[i]=!0)}return t}function AL(o,t,e,r,i,n){var s=(i-e)*(o-e)+(n-r)*(t-r),a=(i-e)*(i-e)+(n-r)*(n-r),l=s/a,c=e+(i-e)*l,h=r+(n-r)*l;return s<=0?Math.sqrt((o-e)*(o-e)+(t-r)*(t-r)):s>=a?Math.sqrt((o-i)*(o-i)+(t-n)*(t-n)):Math.sqrt((o-c)*(o-c)+(h-t)*(h-t))}var wz=1e-4,Ee=new Float64Array(100);function Pt(o,t){if(o instanceof M&&t instanceof M)return Y9(o,t);if(o instanceof q&&t instanceof M)return Wee(o,t);if(o instanceof M&&t instanceof q)return Wee(t,o);if(o instanceof q&&t instanceof q)return vCt(o,t);throw new Error("not supported operation")}function vk(o,t){let e=o.primitives,r=t.primitives,i=e.length>r.length?r:e,n=e.length>r.length?e:r,s=!1;return i.some(a=>(n.some(l=>(s=Pt(a,l)>0,s)),s)),s}function oBe(o,t){let e=o.bbox();if(e.isContainsY1(t)){let r=new M(new S(e.minX-1,t),new S(e.maxX+1,t));return Y9(r,o)>0?1:0}else return 0}function sBe(o,t){if(o.rx===o.ry){let e=o.bbox();if(e.isContainsY1(t)){let r=new M(new S(e.minX-1,t),new S(e.maxX+1,t));return Hee(o,r)>0?1:0}else return 0}else throw new Error("not supported operation")}function tBe(o,t,e){return isFinite(t)&&isFinite(e)?o.isContains2(t,e):!1}function wTe(o,t){let e=o.bbox().intersection1(t.bbox());if(e!=null){let r=j0.crossProd3(t.start(),t.end(),o.start()),i=j0.crossProd3(t.start(),t.end(),o.end());return Math.abs(r)<1e-8||Math.abs(i)<1e-8||r*i<0?e:null}else return null}function Y9(o,t){if(o.isPoint())return LP(t,o.start());if(t.isPoint())return LP(o,t.start());{let e=wTe(o,t);if(e!=null){let P=function(T,I){e.isContains2(T,I)&&(Ee[b++]=T,Ee[b++]=I)},r=o.start().x,i=o.start().y,n=o.end().x,s=o.end().y,a=t.start().x,l=t.start().y,c=t.end().x,h=t.end().y,u=t.length(),d=j0.crossProd2(r,i,a,l,c,h)/u,p=j0.crossProd2(n,s,a,l,c,h)/u;if(d*p>0&&!ne.eq(d,0)&&!ne.eq(p,0))return 0;let m=o.length(),g=j0.crossProd2(a,l,r,i,n,s)/m,y=j0.crossProd2(c,h,r,i,n,s)/m;if(g*y>0&&!ne.eq(g,0)&&!ne.eq(y,0))return 0;let b=0;if(ne.eq(d,0)&&ne.eq(p,0)){let T=e.UL(),I=e.UR(),C=e.LL(),E=e.LR();if(ne.eq(e.width(),0))ne.eq(e.height(),0)?(Ee[b++]=T.x,Ee[b++]=T.y):(Ee[b++]=T.x,Ee[b++]=T.y,Ee[b++]=C.x,Ee[b++]=C.y);else if(ne.eq(e.height(),0))Ee[b++]=T.x,Ee[b++]=T.y,Ee[b++]=I.x,Ee[b++]=I.y;else{let O=ME.area2(T.x,T.y,a,l,c,h),_=ME.area2(I.x,I.y,a,l,c,h);O<_?(Ee[b++]=T.x,Ee[b++]=T.y,Ee[b++]=E.x,Ee[b++]=E.y):(Ee[b++]=I.x,Ee[b++]=I.y,Ee[b++]=C.x,Ee[b++]=C.y)}}else if(ne.eq(d,0))P(r,i);else if(ne.eq(p,0))P(n,s);else{let T=Math.abs(d/(d-p));P(r+(n-r)*T,i+(s-i)*T)}return b}else return 0}}function LP(o,t){return o.bbox().extendOfSize(1e-8).isContains(t)?o.isPoint()?t.equals1(o.start())?(Ee[0]=t.x,Ee[1]=t.y,2):0:ne.eq(ME.area2(o.start().x,o.start().y,o.end().x,o.end().y,t.x,t.y),0)?(Ee[0]=t.x,Ee[1]=t.y,2):0:0}function Lz(o,t,e,r=.5){let i=RCt(o,t,e);i.d<=r&&(o=i.point);let n=t.distance1(e),s=t.distance1(o),a=e.distance1(o);return!!db(s+a,n,.001)}function Hee(o,t){let e=o.bbox().intersection1(t.bbox());if(e!=null){e=e.extendOfSize(wz);let r=o.center.x,i=o.center.y,n=o.rx,s=o.rx2,a=t.start().x,l=t.start().y,c=t.end().x,h=t.end().y,u=o.center.distance1(t.start()),d=o.center.distance1(t.end()),p=ne.eq(u,n)?0:u>n?1:-1,m=ne.eq(d,n)?0:d>n?1:-1,g=0;if(p===-1&&m===-1)return 0;if(p===0&&m===0)Ee[g++]=a,Ee[g++]=l,Ee[g++]=c,Ee[g++]=h;else if(p===1&&m===1){let y=er.foot(t,o.center),b=y.distance1(o.center);if(ne.greater(b,n))return 0;if(ne.eq(b,n))ne.eq(t.distance2(o.start()),0)?(Ee[g++]=o.start().x,Ee[g++]=o.start().y,Ee[g++]=o.start().x,Ee[g++]=o.start().y):ne.eq(t.distance2(o.end()),0)?(Ee[g++]=o.end().x,Ee[g++]=o.end().y,Ee[g++]=o.end().x,Ee[g++]=o.end().y):(Ee[g++]=y.x,Ee[g++]=y.y,Ee[g++]=y.x,Ee[g++]=y.y);else{g=_Ct(r,i,a,l,c,h,g);let P=Ee[g-2],T=Ee[g-1],I=j0.distance1(r,i,P,T);if(g-=2,ne.eq(I,n))Ee[g++]=P,Ee[g++]=T;else if(I<n)g=wP(s,r,i,a,l,P,T,g),g=wP(s,r,i,P,T,c,h,g);else return 0}}else if(p===-1||m===-1)g=wP(s,r,i,a,l,c,h,g);else{let y=er.foot(t,o.center),b=y.distance1(o.center);if(ne.eq(b,n)){let P=function(T){return tBe(e,T.x,T.y)&&Wn(o,T)};if(p===0){let T=t.start();if(P(T))return Ee[g++]=T.x,Ee[g++]=T.y,Ee[g++]=T.x,Ee[g++]=T.y,g;if(P(y))return Ee[g++]=y.x,Ee[g++]=y.y,Ee[g++]=y.x,Ee[g++]=y.y,g;if(u<=n)g=wP(s,r,i,y.x,y.y,c,h,g),g===2&&(Ee[g++]=Ee[0],Ee[g++]=Ee[1]);else if(b<n){if(g=wP(s,r,i,y.x,y.y,c,h,g),g===2&&P(new S(Ee[0],Ee[1])))return Ee[g++]=Ee[0],Ee[g++]=Ee[1],g;g=wP(s,r,i,y.x,y.y,a,l,0),g===2&&(Ee[g++]=Ee[0],Ee[g++]=Ee[1])}}else{let T=t.end();if(P(T))return Ee[g++]=T.x,Ee[g++]=T.y,Ee[g++]=T.x,Ee[g++]=T.y,g;if(P(y))return Ee[g++]=y.x,Ee[g++]=y.y,Ee[g++]=y.x,Ee[g++]=y.y,g;if(d<=n)g=wP(s,r,i,y.x,y.y,a,l,g),g===2&&(Ee[g++]=Ee[0],Ee[g++]=Ee[1]);else if(b<n){if(g=wP(s,r,i,y.x,y.y,a,l,g),g===2&&P(new S(Ee[0],Ee[1])))return Ee[g++]=Ee[0],Ee[g++]=Ee[1],g;g=wP(s,r,i,y.x,y.y,c,h,0),g===2&&(Ee[g++]=Ee[0],Ee[g++]=Ee[1])}}}else if(p===0){let P=t.start();Ee[g++]=P.x,Ee[g++]=P.y,(a-y.x)*(c-y.x)+(l-y.y)*(h-y.y)<0&&(g=wP(s,r,i,y.x,y.y,c,h,g))}else{let P=t.end();Ee[g++]=P.x,Ee[g++]=P.y,(a-y.x)*(c-y.x)+(l-y.y)*(h-y.y)<0&&(g=wP(s,r,i,y.x,y.y,a,l,g))}}if(g>0){let y=0;for(let b=0;b<g;b+=2){let P=Ee[b],T=Ee[b+1];isFinite(P)&&isFinite(T)&&tBe(e,P,T)&&Wn(o,new S(P,T))&&(Ee[y++]=P,Ee[y++]=T)}return y}else return 0}else return 0}function wP(o,t,e,r,i,n,s,a){if(i==s){let T=o-(i-e)*(i-e);if(ne.greater(T,0)){let I=Math.sqrt(T),C=t-I,E=t+I,O=Math.min(r,n),_=Math.max(r,n);return C>=O&&C<=_&&(Ee[a++]=C,Ee[a++]=i),E>=O&&E<=_&&(Ee[a++]=E,Ee[a++]=i),a}}let l=j0.distance2(r,i,t,e)-o;if(l==0)return Ee[a++]=r,Ee[a++]=i,a;let c=j0.distance2(n,s,t,e)-o;if(c==0)return Ee[a++]=n,Ee[a++]=s,a;let h=r,u=i,d=n,p=s,m=NaN,g=NaN,y=Number.POSITIVE_INFINITY,b=0;for(;y!==0;){b++;let T=Math.max(Math.min(Math.abs(l)/(Math.abs(l)+Math.abs(c)),.75),.25);if(m=h+(d-h)*T,g=u+(p-u)*T,h===m&&u===g||d===m&&p===g){Math.abs(l)>Math.abs(c)?(m=d,g=p,y=c):(m=h,g=u,y=l);break}else y=j0.distance2(m,g,t,e)-o,y<0&&l>c||y>0&&l<c?(d=m,p=g,c=y):(h=m,u=g,l=y)}let P=Math.sqrt(o)-j0.distance1(m,g,t,e);return(ne.eq(0,y)||ne.eq(0,P))&&(Ee[a++]=m,Ee[a++]=g),a}function _Ct(o,t,e,r,i,n,s){if(j0.crossProd2(e,r,i,n,o,t)==0){let l=j0.dotProd2(e,r,i,n,o,t),c=j0.dotProd2(i,n,e,r,o,t);return l<0&&c<0?(Ee[s++]=o,Ee[s++]=t,s):l>=0?(Ee[s++]=i,Ee[s++]=n,s):(Ee[s++]=e,Ee[s++]=r,s)}else{let l=NaN,c=NaN,h=e,u=r,d=i,p=n,m=j0.distance2(e,r,o,t),g=j0.distance2(i,n,o,t),y=Number.POSITIVE_INFINITY,b=0;for(;y>0&&(b++,l=h+(d-h)*.5,c=u+(p-u)*.5,!(m==g||h==l&&u==c||d==l&&p==c));){y=j0.distance2(l,c,o,t);let P=j0.dotProd2(h,u,l,c,o,t);if(P==0)break;P<0?(d=l,p=c,g=y):(h=l,u=c,m=y)}return Ee[s++]=l,Ee[s++]=c,s}}function Wee(o,t){if(o.rx===o.ry)return Hee(o,t);throw new Error("not supported")}function vCt(o,t){if(o.bbox().intersection1(t.bbox())!=null){if(o.rx===o.ry&&t.rx===t.ry)return xCt(o,t);throw new Error("not supported operation")}return 0}function xCt(o,t){let e=o.center.x,r=o.center.y,i=t.center.x,n=t.center.y,s=o.rx,a=t.rx,l=o.rx2,c=t.rx2,h=o.center.distance1(t.center),u=Math.abs(s-a),d=s+a;if(ne.greater(h,d)||ne.less(h,u))return 0;if(ne.eq(u+h,0)){let p=0,m;return Wn(o,t.start())&&(Ee[p]=t.start().x,Ee[p+1]=t.start().y,p+=2,m=t.start()),Wn(o,t.end())&&(Ee[p]=t.end().x,Ee[p+1]=t.end().y,p+=2,m=t.end()),p===0?(Wn(t,o.start())&&(Ee[p]=o.start().x,Ee[p+1]=o.start().y,p+=2),Wn(t,o.end())&&(Ee[p]=o.end().x,Ee[p+1]=o.end().y,p+=2)):p===2&&(!m.equals1(o.start())&&Wn(t,o.start())&&(Ee[p]=o.start().x,Ee[p+1]=o.start().y,p+=2),!m.equals1(o.end())&&Wn(t,o.end())&&(Ee[p]=o.end().x,Ee[p+1]=o.end().y,p+=2)),p}else if(ne.eq(h,d)){if(rBe(o,t))return 4;let p=new M(o.center,t.center),m=Hee(t,p);return m=iBe(o,m),m!==0?m:(m=Hee(o,p),iBe(t,m))}else if(ne.eq(h,u)){if(rBe(o,t))return 4;if(s>a){let p=(s-a)/s;return Ee[0]=e+(i-e)/p,Ee[1]=r+(n-r)/p,nBe(o,t,2)}else{let p=(a-s)/a;return Ee[0]=i+(e-i)/p,Ee[1]=n+(r-n)/p,nBe(o,t,2)}}else{let m=(o.center.distance2(t.center)-c+l)/(h*2)/h,g=(i-e)*m+e,y=(n-r)*m+r,b=i-e,P=n-r,T=Math.max(s,a),I,C,E,O;if(Math.abs(b)<Math.abs(P)){let D=b/-P,w=y-D*g;I=g-T,C=D*I+w,E=g+T,O=D*E+w}else{let D=P/-b,w=g-D*y;C=y-T,I=D*C+w,O=y+T,E=D*O+w}let _=wP(l,e,r,I,C,g,y,0);if(_=wP(l,e,r,g,y,E,O,_),_!==4)throw new Error("cnt !== 4");let x=new S(Ee[0],Ee[1]),v=new S(Ee[2],Ee[3]);if(Wn(o,x)&&Wn(t,x))return Wn(o,v)&&Wn(t,v)?4:ry(o.start(),t,v,x)?(Ee[2]=o.start().x,Ee[3]=o.start().y,4):ry(o.end(),t,v,x)?(Ee[2]=o.end().x,Ee[3]=o.end().y,4):ry(t.start(),o,v,x)?(Ee[2]=t.start().x,Ee[3]=t.start().y,4):ry(t.end(),o,v,x)?(Ee[2]=t.end().x,Ee[3]=t.end().y,4):ry(o.start(),t,x,v)?(Ee[0]=o.start().x,Ee[1]=o.start().y,2):ry(o.end(),t,x,v)?(Ee[0]=o.end().x,Ee[1]=o.end().y,2):ry(t.start(),o,x,v)?(Ee[0]=t.start().x,Ee[1]=t.start().y,2):(ry(t.end(),o,x,v)&&(Ee[0]=t.end().x,Ee[1]=t.end().y),2);if(Wn(o,v)&&Wn(t,v))return ry(o.start(),t,x,v)?(Ee[0]=o.start().x,Ee[1]=o.start().y,4):ry(o.end(),t,x,v)?(Ee[0]=o.end().x,Ee[1]=o.end().y,4):ry(t.start(),o,x,v)?(Ee[0]=t.start().x,Ee[1]=t.start().y,4):ry(t.end(),o,x,v)?(Ee[0]=t.end().x,Ee[1]=t.end().y,4):ry(o.start(),t,v,x)?(Ee[0]=o.start().x,Ee[1]=o.start().y,2):ry(o.end(),t,v,x)?(Ee[0]=o.end().x,Ee[1]=o.end().y,2):ry(t.start(),o,v,x)?(Ee[0]=t.start().x,Ee[1]=t.start().y,2):ry(t.end(),o,v,x)?(Ee[0]=t.end().x,Ee[1]=t.end().y,2):(Ee[0]=Ee[2],Ee[1]=Ee[3],2);{let H=function(z,V){if(ne.eq(z.distance1(V.center),V.rx)&&Wn(V,z)){if(z.distance2(x)<z.distance2(v)){if(D)return;D=!0}else{if(w)return;w=!0}Ee[F++]=z.x,Ee[F++]=z.y}},D=!1,w=!1,F=0;return H(o.start(),t),H(o.end(),t),H(t.start(),o),H(t.end(),o),F}}}function ry(o,t,e,r){return ne.eq(o.distance1(t.center),t.rx)&&Wn(t,o)&&o.distance2(e)<o.distance2(r)}function rBe(o,t){return ne.eq(t.start().distance1(o.center),o.rx)&&Wn(o,t.start())?(Ee[0]=t.start().x,Ee[1]=t.start().y,Ee[2]=t.start().x,Ee[3]=t.start().y,!0):ne.eq(t.end().distance1(o.center),o.rx)&&Wn(o,t.end())?(Ee[0]=t.end().x,Ee[1]=t.end().y,Ee[2]=t.end().x,Ee[3]=t.end().y,!0):ne.eq(o.start().distance1(t.center),t.rx)&&Wn(t,o.start())?(Ee[0]=o.start().x,Ee[1]=o.start().y,Ee[2]=o.start().x,Ee[3]=o.start().y,!0):ne.eq(o.end().distance1(t.center),t.rx)&&Wn(t,o.end())?(Ee[0]=o.end().x,Ee[1]=o.end().y,Ee[2]=o.end().x,Ee[3]=o.end().y,!0):!1}function iBe(o,t){if(t===0)return 0;let e=Ee[0],r=Ee[1];return Wn(o,new S(e,r))?(Ee[0]=e,Ee[1]=r,Ee[2]=e,Ee[3]=r,4):0}function nBe(o,t,e){if(e===0)return 0;let r=Ee[0],i=Ee[1],n=new S(r,i);return Wn(o,n)&&Wn(t,n)?(Ee[0]=r,Ee[1]=i,Ee[2]=r,Ee[3]=i,4):0}function _k(o,t){return Math.abs(o-t)<=1e-6}function Wn(o,t){let e=o.bbox();if(t.x-e.minX>-wz&&t.x-e.maxX<wz&&t.y-e.minY>-wz&&t.y-e.maxY<wz){let r=zt.regularD(t.angleD(o.center));return _k(r,o.startAngle)||_k(r,o.startAngle+360)||_k(r,o.startAngle-360)||_k(r,o.endAngle())||_k(r,o.endAngle()+360)||_k(r,o.endAngle()-360)?!0:o.sweepAngle>0?(ne.less(r,o.startAngle)&&(r+=360),ne.greatereq(o.endAngle(),r)):(ne.greater(r,o.startAngle)&&(r-=360),ne.lesseq(o.endAngle(),r))}else return!1}function Dv(o,t){return t.primitives.some(e=>Lz(o,e.start(),e.end()))}function _L(o,t,e,r=.001){let i=Uee(o[1].x-o[0].x,r),n=Uee(o[1].y-o[0].y,r),s=Uee(t[1].x-t[0].x,r),a=Uee(t[1].y-t[0].y,r);if(i===0&&s!==0||i!==0&&s===0)return!1;if(i===0&&s===0)return!0;let l=n/i,c=a/s,h=e?Math.PI*e:Math.PI;return db(l,c,Math.sin(h/180))}function Uee(o,t=1e-8){return o>0&&o<t||o<0&&o>-t?0:o}function RCt(o,t,e){var r,i=+t.x,n=+t.y,s=+e.x,a=+e.y,l=+o.x,c=+o.y,h=s-i,u=a-n,d=l-i,p=c-n,m,g,y,b,P,T;return h===0&&u===0?{d:Math.sqrt(d*d+p*p),point:new S(i,n)}:(r=(d*h+p*u)/(h*h+u*u),r<0?{d:Math.sqrt(d*d+p*p),point:new S(i,n)}:r>1?(m=l-s,g=c-a,{d:Math.sqrt(m*m+g*g),point:new S(s,a)}):(P=i+r*h,T=n+r*u,y=l-P,b=c-T,{d:Math.sqrt(y*y+b*b),point:new S(P,T)}))}function zee(o,t,e,r){function i(g,y,b){return g instanceof S&&y instanceof S?Math.abs(g.x-y.x)<=b&&Math.abs(g.y-y.y)<=b:!1}var n=i(o,e,.5)||i(o,r,.5)?o:i(t,e,.5)||i(t,r,.5)?t:null;if(n)return!1;var s,a,l,c,h,u,d,p,m;return s=t.x-o.x,a=t.y-o.y,l=r.x-e.x,c=r.y-e.y,d=l*a-c*s,d===0?!1:(p=e.x-o.x,m=e.y-o.y,u=(s*m-a*p)/d,h=(l*m-c*p)/d,u>=0&&u<=1&&h>=0&&h<=1?new S(o.x+h*s,o.y+h*a):!1)}function aBe(o,t,e=5){return Math.abs(o-t)*Math.pow(10,e)<1}function c2(o,t,e,r){var i=t.y-o.y,n=o.x-t.x,s=i*o.x+n*o.y,a=r.y-e.y,l=e.x-r.x,c=a*e.x+l*e.y,h=i*l-a*n;if(h==0)return null;var u=(l*s-n*c)/h,d=(i*c-a*s)/h;return new S(u,d)}var tS=class o{constructor(t,e,r,i,n,s,a){this.inters=[];this.connect=new Array;this.previous=null;this.next=null;this.finalGrp=-1;this.trans=NaN;this.outsideWeight=0;this.insideWeight=0;this.invalidWeight=0;this._confidence=0;this._confidence_y=NaN;this._x=NaN;this._x_y=NaN;this.status=0;this.bo=t,this.shape=e,this.baseWeight=r,i.y>n.y?this.weight=-r:i.y==n.y?this.weight=0:this.weight=r,this.start=i,this.end=n,this.polyGrp=s,this.polyIndex=a,this._bbox=new _e().ext1(e.bbox()).ext2(i).ext2(n).build1(),this.inters.push(i),this.inters.push(n);let l=31,c=1;c=l*c+this.polyGrp,c=l*c+this.polyIndex,this._hashcode=c}static rebuild(t,e,r){if(t instanceof M||e.distance2(r)<1e-6)return new M(e,r);if(t instanceof q){let i=t,n=t.bbox().center().x,s;e.y>r.y?s=n>i.center.x?ae.CW:ae.CCW:s=n>i.center.x?ae.CCW:ae.CW;let a=e.angleD(i.center),l=r.angleD(i.center);return q.build2(i.center,a,l,i.rx,i.ry,s)}else throw new Error("not supported operation")}setWeight(t){this.baseWeight=t,this.start.y>this.end.y?this.weight=-t:this.start.y==this.end.y?this.weight=0:this.weight=t,this.connect.length=0,this.finalGrp=-1,this.trans=NaN,this.outsideWeight=0,this.insideWeight=0,this.invalidWeight=0,this._confidence=0,this._confidence_y=NaN,this._x=NaN,this._x_y=NaN,this.status=0}updateBbox(){this._bbox=new _e().ext2(this.start).ext2(this.end).build1()}is(t,e){return t===this.polyGrp&&e===this.polyIndex}confidence(t){if(this._confidence_y!=t){let e=this._bbox.height();if(e!==0)if(Math.abs(t-this._bbox.maxY)>5e-4&&Math.abs(t-this._bbox.minY)>5e-4){let r=1-Math.abs(2*t-this._bbox.maxY-this._bbox.minY)/e;this._confidence=r*1e4|0}else this._confidence=0;else this._confidence=1;this._confidence_y=t}return this._confidence}needCountWeight(){return this.outsideWeight+this.insideWeight+this.invalidWeight<5e3}revokeOutside(t){let e=this.confidence(t);return this.outsideWeight-=e,this.invalidWeight+=e,e}revokeInside(t){let e=this.confidence(t);return this.insideWeight-=e,this.invalidWeight+=e,e}setOutside(t){let e=this.confidence(t);return this.outsideWeight+=e,e}setInside(t){let e=this.confidence(t);return this.insideWeight+=e,e}setInvalid(t){let e=this.confidence(t);return this.invalidWeight+=e,e}prevNot0(){let t=this.previous;for(;t!=null&&t!=this;){if(t.weight!=0)return t;t=t.previous}return null}nextNot0(){let t=this.next;for(;t!=null&&t!=this;){if(t.weight!=0)return t;t=t.next}return null}getX(t){if(this.bo!==null)return(this._x_y!=t||isNaN(this._x))&&(lBe(this,t)>0?this._x=Ee[0]:this._x=NaN,this._x_y=t),this._x;throw new Error("not supported operation")}voteStatus(){return this.outsideWeight>this.insideWeight&&this.outsideWeight>this.invalidWeight?2:this.insideWeight>this.outsideWeight&&this.insideWeight>this.invalidWeight?1:this.invalidWeight>this.outsideWeight&&this.invalidWeight>this.insideWeight?3:0}reverse(t){if(t===2)if(this.start.y>this.end.y){let e=o.rebuild(this.shape,this.end,this.start),r=new o(this.bo,e,this.baseWeight,this.end,this.start,this.polyGrp,this.polyIndex);return xe.addAll(r.connect,this.connect),r}else return this;else if(t===1)if(this.start.y<this.end.y){let e=o.rebuild(this.shape,this.end,this.start),r=new o(this.bo,e,this.baseWeight,this.end,this.start,this.polyGrp,this.polyIndex);return xe.addAll(r.connect,this.connect),r}else return this;return this}isNeedScan(t){return this.needCountWeight()&&this.confidence(t)>0}hashCode(){return this._hashcode}equals(t){return t instanceof o?!(this.polyGrp!==t.polyGrp||this.polyIndex!==t.polyIndex):!1}bbox(){return this._bbox}toString(){return ju.format("(%d,%d,%d) (%d,%d,%d) %s %s",this.polyGrp,this.polyIndex,this.weight,this.outsideWeight,this.invalidWeight,this.insideWeight,this.start,this.end)}};function LTe(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minY+e.maxY)/2,n=(r.minY+r.maxY)/2;return i-n}function MTe(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minX+e.maxX)/2,n=(r.minX+r.maxX)/2;return i-n}var h2=class{constructor(t){this.__bbox=null;if(typeof t<"u")if(t instanceof Array){this.__items=[];for(let e of t)this.add(e)}else this.__items=t,this.__bbox=t.bbox();else this.__items=[]}add(t){if(this.__items instanceof Array)this.__items.push(t),this.__bbox=ht.extend2(this.__bbox,t.bbox());else throw new Error("can't insert multiple item into leaf node")}items(){return this.__items}bbox(){if(this.__bbox!==null)return this.__bbox;throw new Error("bug")}},ji=class{constructor(t){this.changed=!1;this.root=new h2,this.capacity=t,this.capacity2=t*t,this.itemList=[]}size(){return this.itemList.length}items(){return this.flushWhenNeed(),this.itemList}add(t){this.itemList.push(t),this.changed=!0}remove(t){xe.remove(this.itemList,t),this.changed=!0}clear(){this.changed=!1,this.root=new h2,this.itemList.length=0}flushWhenNeed(){if(this.changed){let t=new Array;for(let e of this.itemList)t.push(new h2(e));for(;;){let e=this.organize(t);if(e.length>1)t=e;else break}this.root=new h2(t),this.changed=!1}}organize(t){Er(t,MTe,0,t.length);let e=t.length,r=[];for(let i=0;i<e;)if(i+this.capacity2<=e){let n=i+this.capacity2;Er(t,LTe,i,n);for(let s=i;s<n;s+=this.capacity){let a=new h2(t.slice(s,s+this.capacity));r.push(a)}i=i+this.capacity*this.capacity}else{let n=new h2(t.slice(i,i+this.capacity));r.push(n),i=i+this.capacity}return r}search(t){this.flushWhenNeed();let e=[],r=[];if(this.itemList.length==0||this.root!=null&&t.isSeparated(this.root.bbox()))return e;for(r.push(this.root);;){let i=r.shift();if(typeof i<"u"){let n=i.items();if(n instanceof Array){for(let s of n)if(!t.isSeparated(s.bbox())){let a=s.items();a instanceof Array?s.bbox().isInside(t)?this.add2Result(s,e):r.push(s):e.push(a)}}else t.isSeparated(i.bbox())||e.push(n)}else break}return e}add2Result(t,e,r){if(t!==void 0){let i=t.items();if(i instanceof Array)for(let n of i)this.add2Result(n,e,r);else(!r||r(i))&&e.push(i)}}conditionQuery(t,e){this.flushWhenNeed();let r=[];if(this.itemList.length==0||this.root!=null&&t.isSeparated(this.root.bbox()))return!1;for(r.push(this.root);;){let i=r.shift();if(typeof i<"u"){let n=i.items();if(n instanceof Array){for(let s of n)if(!t.isSeparated(s.bbox())){let a=s.items();if(a instanceof Array)r.push(s);else if(e(a))return!0}}else if(!t.isSeparated(i.bbox())&&e(n))return!0}else break}return!1}walker(t){this.flushWhenNeed(),this._walker(this.root,0,t)}_walker(t,e,r){this.flushWhenNeed();let i=t.items();if(i instanceof Array)for(let n of i)this._walker(n,e+1,r);else r(i,e)}bbox(){return this.flushWhenNeed(),this.root.bbox()}};var Yee=new Error("list is empty"),j9=class{constructor(t,e){this.prev=null;this.next=null;this.parent=t,this.item=e}insertAfter(t){t.next=this.next,this.next=t,t.prev=this,t.next!==null&&(t.next.prev=t)}insertBefore(t){t.prev=this.prev,this.prev=t,t.next=this,t.prev!==null&&(t.prev.next=t)}remove(){this.prev!==null&&(this.prev.next=this.next),this.next!==null&&(this.next.prev=this.prev)}set(t){this.item=t}},NTe=class{constructor(t){this._next=t}hasNext(){return this._next!==null}next(){let t=this._next;if(t!==null)return this._next=t.next,t.item;throw new Error("iterator is null")}},kTe=class{constructor(t){this._next=t}hasNext(){return this._next!==null}next(){let t=this._next;if(t!==null)return this._next=t.next,t;throw new Error("iterator is null")}},Tn=class{constructor(){this.first=null;this.last=null;this.cnt=0}getFirstNode(){return this.last}getLastNode(){return this.last}add(t){return this.addLast(t)}push(t){return this.addLast(t)}pop(){return this.removeLast()}shift(){return this.removeFirst()}removeFirst(){let t=this.first;if(t===null)throw Yee;return this.remove(t),t.item}removeLast(){let t=this.last;if(t===null)throw Yee;return this.remove(t),t.item}addLast(t){return this.first===null||this.last===null?(this.first=new j9(this,t),this.last=this.first,this.cnt=1,this.first):this.insertAfter(this.last,t)}addFirst(t){if(this.first===null||this.last===null){let e=new j9(this,t);return this.first=e,this.last=e,this.cnt++,e}else return this.insertBefore(this.first,t)}getFirst(){if(this.first===null)throw Yee;return this.first.item}getLast(){if(this.last===null)throw Yee;return this.last.item}insertAfter(t,e){let r=new j9(this,e);return t.insertAfter(r),t===this.last&&(this.last=r),this.cnt++,r}insertBefore(t,e){let r=new j9(this,e);return t.insertBefore(r),t===this.first&&(this.first=r),this.cnt++,r}remove(t){t.remove(),t===this.first&&(this.first=t.next),t===this.last&&(this.last=t.prev),this.cnt--}size(){return this.cnt}clear(){this.first=null,this.last=null,this.cnt=0}iterator(){return new NTe(this.first)}listIterator(){return new kTe(this.first)}toArray(){let t=new Array(this.cnt),e=this.first,r=0;for(;e!=null&&(t[r]=e.item,e=e.next,r++,!(e==this.first||r==this.cnt)););return t}};function jee(o){throw new Error("")}var xk=class{constructor(t,e){this.node1=null;this.node2=null;this.key=t,this.value=e}},BTe=class{constructor(t){this.itors=t}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().key}},FTe=class{constructor(t){this.itors=t}hasNext(){return this.itors.hasNext()}next(){return this.itors.next().value}},hd=class{constructor(){this.innerList=new Tn;this.innerMap=new Map}replace(t,e){t.node1!==null&&(t.node1.set(e),e.node1=t.node1),t.node2!==null&&(t.node2.set(e),e.node2=t.node2)}clear(){this.innerList.clear(),this.innerMap.clear()}put(t,e){let r=t.hashCode(),i=new xk(t,e),n=this.innerMap.get(r);if(n===void 0)return i.node1=this.innerList.add(i),this.innerMap.set(r,i),null;if(n instanceof xk){if(n.key.equals(t))return this.innerMap.set(r,i),this.replace(n,i),n.value;{i.node1=this.innerList.add(i);let s=new Tn;return n.node2=s.add(n),i.node2=s.add(i),this.innerMap.set(r,s),null}}if(n instanceof Tn){let s=null;return tI(n,(a,l)=>l.key.equals(t)?(this.replace(l,i),s=l.value,!1):!0),s===null?(i.node1=this.innerList.add(i),i.node2=n.push(i),null):s}return jee(n)}get(t){let e=t.hashCode(),r=this.innerMap.get(e);if(r===void 0)return null;if(r instanceof xk)return r.key.equals(t)?r.value:null;if(r instanceof Tn){let i=null;return tI(r,(n,s)=>s.key.equals(t)?(i=s.value,!1):!0),i}return jee(r)}containsKey(t){return this.get(t)!==null}delete(t){t.node1!==null&&t.node1.parent.remove(t.node1),t.node2===null?this.innerMap.delete(t.key.hashCode()):t.node2.parent.remove(t.node2)}remove(t){let e=t.hashCode(),r=this.innerMap.get(e);if(r===void 0)return null;if(r instanceof xk)return r.key.equals(t)?(this.delete(r),r.value):null;if(r instanceof Tn){let i=null;return tI(r,(n,s)=>s.key.equals(t)?(i=s.value,this.delete(s),!1):!0),i}return jee(r)}computeIfAbsent(t,e){let r=this.get(t);if(r===null){let i=e(t);return this.put(t,i),i}else return r}size(){return this.innerList.size()}isEmpty(){return this.innerList.size()===0}keys(){return new BTe(this.innerList.iterator())}values(){return new FTe(this.innerList.iterator())}entries(){return this.innerList.iterator()}};var Ta=class{constructor(){this.innerMap=new hd}add(t){return this.innerMap.put(t,!0)!==!0}remove(t){this.innerMap.remove(t)}contains(t){return this.innerMap.get(t)===!0}iterator(){return this.innerMap.keys()}addAll(t){let e=t.iterator();for(;e.hasNext();)this.add(e.next())}size(){return this.innerMap.size()}clear(){let t=this.iterator();for(;t.hasNext();){let e=t.next();this.remove(e)}}};var cBe=xe.funcCopy(Er);function lBe(o,t){let e=0;if(Math.abs(o.start.y-t)<=1e-4)Ee[e++]=o.start.x;else if(Math.abs(o.end.y-t)<=1e-4)Ee[e++]=o.end.x;else if(o.shape instanceof M)e=oBe(o.shape,t);else if(o.shape instanceof q)e=sBe(o.shape,t);else throw new Error("not supported operation");return e}var X9=class{constructor(t,e,r,i){this.sides=new Array;this.loader=t,this.loader.bo=this,this.logger=r,this.rule=e,this.event=i}static sortByBBoxMinY(t,e){return t.bbox().minY-e.bbox().minY}static sortByBBoxAreaDesc(t,e){return e.bbox().area()-t.bbox().area()}addPolyline(t,e=1,r=.01,i=!0){for(let n of this.loader.buildGroup(t,e,r,i))this.sides.push(n),this.event.onOriginSide(n)}buildRTree(){let t=new ji(10);for(let e of this.sides)t.add(e);return t}fillValidSides(t,e,r){for(let i of e)i.bbox().isContainsY1(r)&&isFinite(i.getX(r))&&t.push(i)}getSortedEndpointsLineAsc(t){let e=new Array;for(let n of t)n.needCountWeight()&&(e.push(n.start),e.push(n.end));cBe(e,S.sortByYAsc,0,e.length);let r=new Array,i=Number.NEGATIVE_INFINITY;for(let n of e){let s=n.y;s>i&&(r.push(s),i=s)}return r}splitSides(t,e,r){let i=t.start,n=t.end,s=new S(n.x+(i.x-n.x)*2,n.y+(i.y-n.y)*2);cBe(t.inters,(l,c)=>l.distance2(s)-c.distance2(s),0,t.inters.length);let a=null;for(let l of t.inters)if(a==null)l.equals(i)&&(a=l);else if(!l.equals(a)){let c=tS.rebuild(t.shape,a,l);c instanceof q&&Math.abs(c.sweepAngle)>190&&(c=new M(a,l));let h=new tS(this,c,t.baseWeight,a,l,t.polyGrp,r++);if(e.push(h),h.updateBbox(),l.equals(n))break;a=l}return r}splitSidesByInters(){let t=new Array;for(let e of this.sides)if(e.polyIndex==0){let r=0,i=null,n=null;do{let s=new Array;r=this.splitSides(e,s,r);for(let a of s)i!=null?(i.next=a,a.previous=i):n=a,i=a,this.event.onSplitedSide(a),t.push(a);if(e.next===null)throw new Error("not supported operation");e=e.next}while(e.polyIndex!==0);n!=null&&i!=null&&(n.previous=i,i.next=n)}this.sides.length=0;for(let e of t)this.sides.push(e)}seekIntersection(){if(this.sides.length>0){let t=this.buildRTree(),e=new Ta;for(let r of this.sides){e.add(r);let i=r.bbox().extendOfSize(1e-5),n=r.shape instanceof M;for(let s of t.search(i))if(!e.contains(s)){let a=s.shape instanceof M;if(!(n&&a&&r.next!==null&&r.previous!==null&&(r.next.equals(s)||r.previous.equals(s)))){let l=Pt(r.shape,s.shape);for(let c=0;c<l;c+=2){let h=new S(Ee[c],Ee[c+1]);r.inters.push(h),s.inters.push(h),this.event.onIntersect(h,r,s)}}}}}}};var BO=class{constructor(t){this.cache={};this.levels=t,this.result=new Array(t),this.weights=new Array(t),this.maxIdx=t-1,this.rule=this.decide.bind(this);let e=1;for(let r=0;r<t;r++)this.weights[r]=e,e*=50}weight(t){return this.weights[t]}decide(t){t=Math.abs(t);let e=this.cache[t];if(e===void 0){let r=t;for(let i=this.maxIdx;i>=0;i--){let n=this.weights[i],s=t/n|0,a=t%n;a>(n/2|0)?(t=n-a,s++):t=a,this.result[i]=s>0}e=this.decide1(this.result),this.cache[r]=e}return e}};var FO=o=>o!==0,hBe=o=>o>0;var Mz=new class extends BO{decide1(t){return t[0]||t[1]}}(2),Xee=new class extends BO{decide1(t){return t[0]&&!t[1]}}(2),Yrr=new class extends BO{decide1(t){return t[0]&&t[1]}}(2),Xrr=new class extends BO{decide1(t){return t[0]&&!t[1]||!t[0]&&t[1]}}(2);var wv=class{constructor(t){this.bo=null;this.sides=new Array;this.polyGrp=0;this.polyIndex=0;this.prevSide=null;this.firstSide=null;this.noWeight0=t}completeGroup(t){this.prevSide!=null&&this.firstSide!=null&&!this.prevSide.end.equals(this.firstSide.start)&&this.addSide(new M(this.prevSide.end,this.firstSide.start),t);let e=new Array,r=null,i=null;for(let n of this.sides)(!this.noWeight0||n.weight!==0)&&(r!=null?(r.next=n,n.previous=r):i=n,r=n,e.push(n));return r!=null&&i!=null&&(i.previous=r,r.next=i),this.polyGrp++,this.sides.length=0,this.prevSide=null,this.firstSide=null,this.polyIndex=0,e}buildGroup(t,e,r,i=!0){for(let n of t.primitives)if(n instanceof M)this.addSide(n,e);else if(i&&n instanceof q&&n.rx===n.ry)this.addArc(n,e);else{let s=null;for(let a of n.points(r))s!=null&&this.addSide(new M(s,a),e),s=a}return this.completeGroup(e)}addArc(t,e){let r=t.sweepAngle,i=zt.regularD(t.startAngle),n=i+r;if(r>0){let s=90;for(;s<=n;)s>i&&(this.addSide(q.build3(t.center,i,s-i,t.rx,t.ry),e),i=s),s+=90;i<n&&this.addSide(q.build3(t.center,i,n-i,t.rx,t.ry),e)}else if(r<0){let s=270;for(;s>=n;)s<i&&(this.addSide(q.build3(t.center,i,s-i,t.rx,t.ry),e),i=s),s-=90;i>n&&this.addSide(q.build3(t.center,i,n-i,t.rx,t.ry),e)}}addSide(t,e){if(t.start().equals(t.end()))return;let r=t.start(),i;this.prevSide!=null?(this.prevSide.end.equals(r)||this.addSide(new M(this.prevSide.end,r),e),i=new tS(this.bo,t,e,t.start(),t.end(),this.polyGrp,this.polyIndex++)):(i=new tS(this.bo,t,e,t.start(),t.end(),this.polyGrp,this.polyIndex++),this.firstSide=i),this.prevSide=i,this.sides.push(i)}};var Lv=class{constructor(t,e,r){this.eps=new Array;this.curWeight=0;this.start=null;this.last=null;this.prevStart=null;this.prevEnd=null;this.y=r,this.rule=t,this.bo=e,this.event=e.event}onEp(t){this.tuningWeight(t),this.start===null?this.rule(this.curWeight)?this.in(t):t.setInvalid(this.y):this.rule(this.curWeight)?t.setInvalid(this.y):this.out(t,this.start),this.last!==null&&this.event.onSweep1(this.last,t,this.y),this.last=t}in(t){this.prevEnd!=null&&this.onSameX(t,this.prevEnd)?(this.start=this.prevStart,this.prevStart=null,this.prevEnd.revokeInside(this.y),this.prevEnd=null):(this.start=t,this.start.setOutside(this.y))}out(t,e){if(this.onSameX(e,t))e.revokeOutside(this.y);else{if(t.setInside(this.y)>0&&e.confidence(this.y)>0){let r=e.voteStatus(),i=t.voteStatus();this.isValid(r)&&this.isValid(i)?r==2&&i==1&&(t.connect.push(e),e.connect.push(t)):(t.connect.push(e),e.connect.push(t))}this.event.onSegment1(e,t,this.y),this.eps.push(e),this.eps.push(t),this.prevStart=e,this.prevEnd=t}this.start=null}isValid(t){return t==1||t==2}onSameX(t,e){return t.bbox().isIntersect(e.bbox())&&ne.eq(t.getX(this.y),e.getX(this.y))}tuningWeight(t){this.curWeight+=t.weight;let e=t.nextNot0(),r=t.prevNot0();e!=null&&t.weight===e.weight&&e.trans===this.y&&(this.curWeight-=t.weight),r!=null&&t.weight===r.weight&&r.trans===this.y&&(this.curWeight-=t.weight),t.trans=this.y}};var VTe=class extends Ak{constructor(e){super(e);this.segments=new Array;this.y=NaN}onSegment(e,r,i,n,s,a){e=new S(i.getX(this.y),this.y),n=new S(a.getX(this.y),this.y),super.onSegment(e,r,i,n,s,a),this.segments.push(new M(e,n))}},q9=class extends X9{constructor(e){super(new wv(!0),FO,e,new VTe(!1));this.rtree=null;this.collector=this.event}addPolyline(e,r=1){super.addPolyline(e,r)}scan(e,r){this.rtree===null&&(this.rtree=this.buildRTree()),this.collector.y=e;let i=r.bbox().extendOfSize(1e-5),n=new Array;this.fillValidSides(n,this.rtree.search(i),e),Er(n,(l,c)=>l.getX(e)-c.getX(e),0,n.length);let s=new Lv(this.rule,this,e);for(let l of n)s.onEp(l);let a=new Array;return xe.addAll(a,this.collector.segments),this.collector.segments.length=0,a}};function wCt(o){switch(o){case 0:return"DEBUG";case 1:return"INFO";case 2:return"WARNING";case 3:return"ERROR";case 4:return"DUMMY"}}var LCt=(o,t)=>{o===3?console.error(t):console.log(t)},MCt=(o,t)=>ju.format("%s %s: %s",new Date,wCt(o),t),Rk=class Rk{constructor(t,e=LCt,r=MCt){this.debug=!1;this.level=t,this.writer=e,this.fmt=r}static mix(...t){let e=4;for(let r of t)r.level<e&&(e=r.level);return new Rk(e,(r,i)=>{for(let n of t)n.write1(r,i)},(r,i)=>i)}wrap(t=null,e=null){let r=t===null?this.fmt:(n,s)=>(s=t(n,s),this.fmt(n,s)),i=e===null?this.writer:(n,s)=>{e(n,s),this.writer(n,s)};return new Rk(this.level,i,r)}chain(t){return t.wrap(this.fmt.bind(this),this.writer.bind(this))}include(t){return this.level<=t}write3(t,e,r){this.include(t)&&this.writer(t,this.fmt(t,ju.format(e,...r)))}write2(t,e){this.include(t)&&(e instanceof Error?this.writer(t,this.fmt(t,e.stack)):this.writer(t,this.fmt(t,e.toString())))}write1(t,e){this.include(t)&&this.writer(t,this.fmt(t,e))}debug3(t,...e){this.write3(0,t,e)}debug2(t){this.write2(0,t)}debug1(t){this.write1(0,t)}info3(t,...e){this.write3(1,t,e)}info2(t){this.write2(1,t)}info1(t){this.write1(1,t)}warning3(t,...e){this.write3(2,t,e)}warning2(t){this.write2(2,t)}warning1(t){this.write1(2,t)}error3(t,...e){this.write3(3,t,e)}error2(t){this.write2(3,t)}error1(t){this.write1(3,t)}};Rk.DUMMY=new Rk(4);var Di=Rk;function VO(o){let t=Qe.rotate(Math.PI/4),e=Qe.rotate(-Math.PI/4),r=o.multiply3(t),i=o.multiply3(e),n=o.bbox(),s=n.width(),a=n.height(),l=Math.max(1,Math.min(6,s)),c=Math.max(1,Math.min(6,a));o.primitives.length>4&&(s<10&&(l=1),a<10&&(c=1));let h=r.bbox(),u=i.bbox(),d=new Array,p=new q9(new Di(1));p.addPolyline(r);for(let b=h.minY;b<=h.maxY;b+=l){let P=new M(new S(h.minX,b),new S(h.maxX,b));xe.addAll(d,p.scan(b,P))}let m=new Array,g=new q9(new Di(1));g.addPolyline(i);for(let b=u.minY;b<=u.maxY;b+=c){let P=new M(new S(u.minX,b),new S(u.maxX,b));xe.addAll(m,g.scan(b,P))}let y=new Array;for(let b of d){let P=b.multiply3(e);y.push(P)}for(let b of m){let P=b.multiply3(t);y.push(P)}return y}var rI=class{constructor(t){this.center=new S(0,0);this.high=0;this.shapes=t,this.calcu()}calcu(){let e=this.shapes.bbox().center(),r=new Array;this.shapes.primitives.forEach(s=>{s instanceof M?this.calcuLine(s,e,r):this.calcuArc(s,e,r)}),Er(r,(s,a)=>a-s,0,r.length);let i=new Set,n=8;if(r.forEach(s=>{i.add(this.toFix(s,n))}),r=Array.from(i),r.length>1){this.center=new S(e.x,(r[0]+r[1])/2);let s=this.shapes instanceof Bt&&this.shapes.items.length>1;this.high=s?r[0]-r[1]:r[0]-r[r.length-1]}else this.center=e;this.optimization()}toFix(t,e=1){let r=Math.pow(10,e);return Math.round(t*r)/r}optimization(){if(this.high==0){let t=this.shapes.bbox();this.high=t.height(),this.center.equals(S.ORIGIN)&&(this.center=t.center())}}calcuLine(t,e,r){t.bbox().isContainsX(e.x)&&(t.isPoint()?r.push(t.start().y):t.b!=0&&r.push(-(t.a*e.x+t.c)/t.b))}calcuArc(t,e,r){let i=t.bbox();if(i.isContainsX(e.x)){let s=t.rx2-(e.x-t.center.x)*(e.x-t.center.x);if(s>=0){let a=Math.sqrt(s);i.isContainsY(t.center.y-a)&&r.push(t.center.y-a),i.isContainsY(t.center.y+a)&&r.push(t.center.y+a)}}}};var qee=class o{constructor(t){this.sides=new Ta;this.others=new Ta;this.id=t}add(t){this.sides.add(t),t.finalGrp=this.id;for(let e of t.connect)this.others.add(e)}polyline(){let t=new Array;return tI(this.sides,(e,r)=>(t.push(r.shape),!0)),ge.build2(t).asClose()}hashCode(){return this.id}equals(t){return t!=null&&t instanceof o?this.id===t.id:!1}};var MP=class extends Ak{constructor(e){super(e);this.plGrps=new Array}onPolylineGroup(e,r){super.onPolylineGroup(e,r),this.plGrps.push(e)}};var NCt=xe.funcCopy(Er),kCt=xe.funcCopy(Er),BCt=xe.funcCopy(Er);function FCt(o){return new Array}function Nz(o,t){let e=new MP(!1),r=new iI(o,Di.DUMMY,e);for(let i of t)r.addPolyline(i);return r.simplify(),e.plGrps}function X0(o,t){o=o.asClose();let e=Nz(FO,[o]),r=[];for(let i of e)xe.addAll(r,i.items);if(t>0){for(let i of o.primitives)i instanceof M&&i.length()<1e-4||r.push(i.stroke(t*2,wr.ROUND,ae.CW));return Nz(FO,r)}else if(t<0){t=-t;for(let i of o.primitives)r.push(i.stroke(t*2,wr.ROUND,ae.CCW));return Nz(hBe,r)}else return e}var iI=class extends X9{constructor(e,r,i){super(new wv(!1),e,r,i);this.finalSides=new Array;this.sideGroups={};this.vecSides=new Array;this.scanY=NaN;this.curNetIndex=0;this.curIndex=-1;this.scanLines=0}sweep(e,r,i){this.scanY=NaN,this.scanLines=0,NCt(r,X9.sortByBBoxMinY,0,r.length);let n=new Tn;this.curNetIndex=0;let s=Number.POSITIVE_INFINITY;for(let a of e)a>s&&this.scan(n,(s+a)/2,r),s=a;this.getAllMarkPrimitive(i,r),this.logger.debug3("scan %s %d",i,this.scanLines)}simplify(){this.seekIntersection(),this.splitSidesByInters(),this.sweep(this.getSortedEndpointsLineAsc(this.sides),this.sides,!1),this.flipSides(),this.sweep(this.getSortedEndpointsLineAsc(this.vecSides),this.vecSides,!0),this.connectSides(),this.fillResult()}addPolyline(e,r=1,i=.01,n=!0){super.addPolyline(e,r,i,n)}scan(e,r,i){if(this.scanY==r)return;this.scanY=r;let n=!1,s=e.listIterator();for(;s.hasNext();){let a=s.next(),l=a.item;ne.less(l.bbox().maxY,r)?e.remove(a):!n&&l.isNeedScan(r)&&(n=!0)}for(;this.curNetIndex<i.length;){let a=i[this.curNetIndex];if(ne.less(a.bbox().minY,r))ne.greatereq(a.bbox().maxY,r)&&(this.add2AET(e,a),!n&&a.isNeedScan(r)&&(n=!0)),this.curNetIndex++;else break}if(n){this.scanLines++;let a=new Lv(this.rule,this,r),l=e.iterator();for(;l.hasNext();){let c=l.next();a.onEp(c)}}}add2AET(e,r){let i=r.bbox().minX,n=r.bbox().maxX,s=r.bbox().minY,a=r.bbox().maxY,l=e.listIterator(),c=null;for(;l.hasNext();){let h,u=l.next(),d=u.item,p=d.bbox().minX,m=d.bbox().maxX;if(n<=p)h=-1;else if(m<=i)h=1;else{let y=d.bbox().minY,b=d.bbox().maxY,P=Math.max(s,y),T=Math.min(a,b);h=this.compareBySweep(r,d,(P+T)/2)}let g=d.shape;if(g instanceof M&&g.length()<.001&&c==null&&h<0){c=u;continue}if(c!=null&&h<0){e.insertBefore(c,r);return}if(h<0){e.insertBefore(u,r);return}else c=null}e.add(r)}getLineAngle(e){let r=e.start().angle(e.end());return r<0&&(r+=Math.PI),r}getArcAngle(e,r){let i=Math.asin((r-e.center.y)/e.rx);return e.startAngle>90&&e.startAngle<270&&(i=-i),i<0&&(i+=Math.PI),(i+Math.PI/2)%Math.PI}compareArcLine(e,r,i){let n=this.getArcAngle(e,i),s=this.getLineAngle(r);return ne.eq(n,s)?-e.sweepAngle:s-n}compareBySweep(e,r,i){let n=e.getX(i);if(!isFinite(n))return 0;let s=r.getX(i);if(!isFinite(s))return 0;if(!ne.eq(n,s))return n-s;if(e.shape instanceof M)return r.shape instanceof M?this.getLineAngle(r.shape)-this.getLineAngle(e.shape):-this.compareArcLine(r.shape,e.shape,i);if(r.shape instanceof M)return this.compareArcLine(e.shape,r.shape,i);{let a=e.shape,l=r.shape,c=this.getArcAngle(a,i),h=this.getArcAngle(l,i);return ne.eq(c,h)?a.sweepAngle*l.sweepAngle<=0?a.sweepAngle<=0?1:-1:a.sweepAngle>0?a.rx-l.rx:l.rx-a.rx:h-c}}getAllMarkPrimitive(e,r){for(let i of r)if(i.status===0&&i.bbox().height()!=0){let n=i.voteStatus();if(n===2||n===1){i.status=n;let s=i.reverse(n);if(e){this.event.onResultSide(s);let a=s.shape.multiply3(Qe.ROT_N90),l=s.start.multiply3(Qe.ROT_N90),c=s.end.multiply3(Qe.ROT_N90);s=new tS(this,a,s.baseWeight,l,c,s.polyGrp,s.polyIndex)}this.finalSides.push(s),this.event.onResultSide(s)}}}flipSides(){for(let e of this.sides)if(e.polyIndex==0){let r=null,i=null;do{let n=e.shape.multiply3(Qe.ROT_90),s=e.start.multiply3(Qe.ROT_90),a=e.end.multiply3(Qe.ROT_90),l=new tS(this,n,e.baseWeight,s,a,e.polyGrp,e.polyIndex);if(l.outsideWeight=e.outsideWeight,l.insideWeight=e.insideWeight,l.invalidWeight=e.invalidWeight,l.status=e.status,r!=null?(r.next=l,l.previous=r):i=l,this.vecSides.push(l),this.event.onSplitedSide(l),r=l,e.next!==null)e=e.next;else break}while(e.polyIndex!=0);i!=null&&(i.previous=r,r.next=i)}}canBeEnd(e,r){if(e.size()==1){let i=e.getFirst().shape;if(i instanceof q){if(r&&i.rx<=r)return!1}else if(i instanceof M&&r&&i.length()<=r)return!1}return!0}connectSides(){let e=new hd,r=new ji(10);for(let a of this.finalSides)e.computeIfAbsent(a.start,FCt).push(a),r.add(a.start);let i=0,n=new Ta,s=new Array;for(let a of this.finalSides)if(!n.contains(a)){let l=new Ta,c=a.start,h=new Tn;h.add(a),n.add(a);let u=a.end;for(;h.size()>0;)if(this.isStart(c,u)&&this.canBeEnd(h,.01)){h.size()>1&&this.fillSideGroups(h,i++);break}else{let d=e.get(u),p=this.findNext(n,d,h);if(p==null&&(u=this.findNeigber(u,l,r,.01),u!==null&&(d=e.get(u),p=this.findNext(n,d,h))),p!=null)h.add(p),n.add(p),u=p.end;else if(u!=null?l.add(u):(s.length==0&&h.size()>1&&this.logger.warning3("unable to connect at %s",h.getLast()),s.push(h.removeLast())),h.size()>0)u=h.getLast().end;else break}}}fillSideGroups(e,r){let i=new qee(r);tI(e,(n,s)=>(i.add(s),!0)),this.sideGroups[i.id]=i}isStart(e,r){return e.distance2(r)<=1e-4}findNext(e,r,i){if(r!=null){let n=null,s=null;for(let a of r)if(!e.contains(a)){let l=this.getDirect(a);if(n==null&&s==null)n=a,s=l;else{let c=s.cross(l);if(ne.greater(c,0))n=a,s=l;else if(ne.eq(c,0)&&i.size()>0){let h=i.getLast(),u=this.getDirect(h,!0),d=u.cross(l),p=u.cross(s);d<p&&(n=a,s=l)}}}return n}return null}getDirect(e,r=!1){let i=e.shape;if(i instanceof M)return i.direct;if(i instanceof q){let s=(r?i.end():i.start()).sub(i.center).normalize();return i.sweep()==ae.CCW?new S(-s.y,s.x):new S(s.y,-s.x)}else return new S(1,0)}fillResult(){let e=0,r=new hd;for(let n in this.sideGroups){let s=this.sideGroups[n];tI(s.sides,(a,l)=>(l.polyGrp!=-2&&r.put(l,l),!0))}let i=new Ta;for(let n in this.sideGroups){let s=this.sideGroups[n];if(i.add(s)){let a=0,l=new Array;for(l.push(s);a<l.length;){let h=l[a],u=new Array;tI(h.others,(p,m)=>{let g=r.get(m);return g!=null&&u.push(g.finalGrp),!0}),kCt(u,xe.sortAsc,0,u.length);let d=h.id;for(let p of u)if(p!=d&&p!=h.id){let m=this.sideGroups[p];i.add(m)&&l.push(m),d=p}a++}let c=new Array;for(let h of l)c.push(h.polyline());BCt(c,X9.sortByBBoxAreaDesc,0,c.length),this.event.onPolylineGroup(new Bt(c),e++)}}}findNeigber(e,r,i,n){let s=n*n,a=Number.MAX_VALUE,l=null;for(let c of i.search(e.bbox().extendOfSize(n)))if(!r.contains(c)){let h=e.distance2(c);h<a&&(a=h,l=c)}return a<s?l:null}};function ud(o){if(o instanceof M)return o.length();if(o instanceof q){let t=zt.toRadians(o.sweepAngle);return Math.abs(o.rx*t)}}function Da(o,t,e,r,i){r===0&&i!=null&&(r=10/i);let{x:n,y:s}=o,a=n-t.x,l=s-t.y,c=n-e.x,h=s-e.y,u=e.x-t.x,d=e.y-t.y,p=new S(-d,u).normalize(),m=u+p.x*r/2,g=d+p.y*r/2,y=m*m+g*g,b=a*a+l*l,P=c*c+h*h,T=Math.abs(a*d-l*u)/2,C=Math.sqrt(u*u+d*d)*r/4;if(T<=C&&b<=y&&P<=y)return!0;{let E=r/2;return b<=E*E?!0:P<=E*E}}function ag(o,t,e,r,i=ae.CW){let n=t.sub(o).normalize(),s=new S(-n.y,n.x),a=Math.min(o.distance1(t),e)/2*r,l=s.mul((e-a*2)/2),c=n.mul(a),h=s.mul(a),u=o.add(l),d=o.sub(l),p=t.add(l),m=t.sub(l),g=u.add(c),y=d.add(c),b=p.sub(c),P=m.sub(c),T=g.add(h),I=b.add(h),C=y.sub(h),E=P.sub(h);if(i==ae.CCW){let O=new M(u,d),_=new M(C,E),x=new M(m,p),v=new M(I,T),D=new Array;if(a>0){let w=q.build1(d,C,a,a,!1,ae.CCW),F=q.build1(E,m,a,a,!1,ae.CCW),H=q.build1(p,I,a,a,!1,ae.CCW),z=q.build1(T,u,a,a,!1,ae.CCW);for(let V of[O,w,_,F,x,H,v,z])V!=null&&ud(V)>0&&D.push(V)}else for(let w of[O,_,x,v])w!=null&&ud(w)>0&&D.push(w);return ge.build2(D).asClose()}else{let O=new M(d,u),_=new M(T,I),x=new M(p,m),v=new M(E,C),D=new Array;if(a>0){let w=q.build1(u,T,a,a,!1,ae.CW),F=q.build1(I,p,a,a,!1,ae.CW),H=q.build1(m,E,a,a,!1,ae.CW),z=q.build1(C,d,a,a,!1,ae.CW);for(let V of[O,w,_,F,x,H,v,z])V!=null&&ud(V)>0&&D.push(V)}else for(let w of[O,_,x,v])w!=null&&ud(w)>0&&D.push(w);return ge.build2(D)}}function uBe(o,t,e,r,i,n,s){let a=t.sub(o).normalize(),l=new S(-a.y,a.x),c=Math.min(o.distance1(t),e)/2*r,h=l.mul((e-c*2)/2),u=a.mul(c),d=l.mul(c),p=o.add(h),m=o.sub(h),g=t.add(h),y=t.sub(h),b=p.add(u),P=m.add(u),T=g.sub(u),I=y.sub(u),C=b.add(d),E=T.add(d),O=P.sub(d),_=I.sub(d),x=new M(m,p),v=new M(C,E),D=new M(g,y),w=new M(_,O),F=0;for(let H of[x,v,D,w]){if(H!=null&&ud(H)>0&&Da(n,H.start(),H.end(),i,s))return F*2;F++}return null}var Wd=Math.PI*2;var $9=Math.PI/2,$ee=Math.PI/4,mnr=Math.sin(Math.PI/180);function NP(o){return o=o%Wd,o<=-$9?o+=Math.PI:o>=$9&&(o-=Math.PI),o}function pb(o){return o/Math.PI*180}function rS(o){return o==null?vc:o<=vc?vc:o}function oo(o){return o>vc?o:vc}function Kee(o){return o=o%Wd,o<=-$9?o+=Math.PI:o>=$9&&(o-=Math.PI),o}function Xh(o){return o/180*Math.PI}function vL(o){return o*180/Math.PI}function dBe(o){return o/180*Math.PI}function ve(o,t=1){let e=Math.pow(10,t);return Math.round(o*e+1e-10)/e}function GTe(o,t){var n,s;let e=Math.min((n=o.toString().split(".")[1])==null?void 0:n.length,(s=t.toString().split(".")[1])==null?void 0:s.length),r=o.toFixed(e+1),i=t.toFixed(e+1);return ve(+r)==ve(+i)}function Yl(o,t=3){return ve((o%360+360)%360,t)}var Rc=class{constructor(t){this.eps=1e-8;this.precision=1e8;this.precision=t,this.eps=t}regular(t){return Math.round(t*this.precision)/this.precision}eq(t,e){return Math.abs(t-e)<=this.eps}neq(t,e){return Math.abs(t-e)>this.eps}less(t,e){return t-e<-this.eps}lesseq(t,e){return t-e<this.eps}greater(t,e){return t-e>this.eps}greatereq(t,e){return t-e>-this.eps}};var UTe=class{constructor(t,e,r){this._start=null;this._previous=null;this.next=null;this.interInStart=!1;this.intersInEnd=!1;this.othersIntersCount=0;this.shape=t,this.group=e,this.index=r,this._end=t.end()}reset(){this.interInStart=!1,this.intersInEnd=!1,this.othersIntersCount=0}set previous(t){this._previous=t,this.previous!=null&&(this._start=this.previous.shape.end())}get previous(){return this._previous}get start(){return this._start}get end(){return this._end}getNext(){let t=null,e=this.intersInEnd,r=this.next;for(;e&&r!=this;)if(r.interInStart){t=r;break}else r=r.next;return t}getStartDirect(){if(this.shape instanceof M)return this.shape.direct;if(this.shape instanceof q){let t=Math.abs((this.shape.startAngle+360)%360);return this.interInStart&&this.othersIntersCount==0&&(t=ve(t,1)),this.shape.sweep()==ae.CCW?ne.greatereq(t,90)&&ne.less(t,270)?new S(0,-1):new S(0,1):ne.greater(t,90)&&ne.lesseq(t,270)?new S(0,1):new S(0,-1)}else return null}getEndDirect(){if(this.shape instanceof M)return this.shape.direct;if(this.shape instanceof q){let t=Math.abs((this.shape.endAngle()+360)%360);return this.intersInEnd&&this.othersIntersCount==0&&(t=ve(t,1)),this.shape.sweep()==ae.CCW?ne.greater(t,90)&&ne.lesseq(t,270)?new S(0,-1):new S(0,1):ne.greatereq(t,90)&&ne.less(t,270)?new S(0,1):new S(0,-1)}else return null}},Dc=class{constructor(){this.horizontal=new S(1,0)}pointInPolyline(t,e){if(!e.bbox().isContains(t))return!1;for(let n of e.primitives)if(this.inEdge(t,n))return!0;if(!this.isClose(e))return!1;let i=[];return e.points(.1,n=>{i.push(n)}),this.isSelect(t.x,t.y,i)}inEdge(t,e,r){let i=r?new Rc(r):ne,n=r||1e-8,s=e.bbox().extendOfSize(n);if(!s.isContains2(t.x,t.y))return!1;if(e instanceof M){let l=er.foot(e,t).distance1(t);return i.eq(l,0)?s.isContains2(t.x,t.y):!1}else if(e instanceof q){let a=t.distance1(e.center);return i.eq(a,e.rx)?V0(e,t):!1}return!1}isSelect(t,e,r){let i=!1;for(let a=0,l=r.length-1;a<l;a++){let c=r[a],h=r[a+1];if(t==c.x&&e==c.y||t==h.x&&e==h.y)return!0;if(c.y<e&&h.y>=e||c.y>=e&&h.y<e){let u=c.x+(e-c.y)*(h.x-c.x)/(h.y-c.y);if(t==u)return!0;u>t&&(i=!i)}}let n=r[r.length-1],s=r[0];if(t==n.x&&e==n.y||t==s.x&&e==s.y)return!0;if(n.y<e&&s.y>=e||n.y>=e&&s.y<e){let a=n.x+(e-n.y)*(s.x-n.x)/(s.y-n.y);if(t==a)return!0;a>t&&(i=!i)}return i}isClose(t){return t.primitives.length>0&&t.primitives[0].start().distance2(t.primitives[t.primitives.length-1].end())<1e-8}map2Sides(t,e){let r=new Array,i=[];t.points(.1,a=>{i.push(a)}),t=ge.build4(i),t=t.closeEndpoint();let n=0,s=null;for(let a of t.primitives){let l=new UTe(a,e,n);s!=null&&(s.next=l,l.previous=s),r.push(l),s=l,n++}return r[r.length-1].next=r[0],r[0].previous=r[r.length-1],r}inEdge4Polyline(t,e,r){for(let i of e.primitives)if(this.inEdge(t,i,r))return!0;return!1}inPrimitive(t,e,r){return!!this.inEdge(t,e,r)}inPolyline(t,e,r=0,i=!1,n){let{x:s,y:a}=t;if(!(n?e.bbox().extendOfSize(n):e.bbox()).isContains1(s,a))return!1;if(!i){for(let c of e.primitives)if(this.inPrimitive(t,c,n))return!0}return!!e.getWindingNum(t)}inPolygon(t,e){let r=!1;for(let i of e)this.inPolyline(t,i)&&(r=!r);return r}},Zee=class{inPolyline(t,e,r=0){let i=e.bbox(),{x:n,y:s}=t;return i.isContains1(n,s)?!!e.getWindingNum(t):!1}inPolygon(t,e){let r=!1;for(let i of e)this.inPolyline(t,i)&&(r=!r);return r}},jr=new Dc;function t1(o,t,e){return t.distance1(o)<=e}var nI=class{constructor(t,e,r,i,n){this.type=t,this.width=rS(e),this.height=rS(r),this.ratio=i,this.pl=n}getStrokePolyline(t,e,r,i){if(i===ae.CW)try{return ge.build2([q.build3(t,-90,-180,r,r),q.build3(e,90,-180,r,r)])}catch(n){console.error(n)}else return ge.build2([q.build3(t,90,180,r,r),q.build3(e,-90,180,r,r)])}getStrokePolyline1(t,e,r,i){return i===ae.CW?ge.build2([q.build3(t,0,-180,r,r),q.build3(e,180,-180,r,r)]):ge.build2([q.build3(t,180,180,r,r),q.build3(e,0,180,r,r)])}inShape(t,e,r,i,n){let s=n==null?1:n.getScale();switch(this.type){case"ELLIPSE":return t1(new S(t,e),r,this.width/2);case"OVAL":{let a=Ae.rotateZForPoint(r,i);if(this.width>this.height){let l=(this.width-this.height)/2,c=r.add1(-l,0).multiply4(a),h=r.add1(l,0).multiply4(a);return Da(new S(t,e),c,h,this.height,s)}else if(this.height>this.width){let l=(this.height-this.width)/2,c=r.add1(0,-l).multiply4(a),h=r.add1(0,l).multiply4(a);return Da(new S(t,e),c,h,this.width,s)}else{let l=this.width/2;return t1(new S(t,e),r,l)}}case"RECT":{let a=Ae.rotateZForPoint(r,-i),l=new S(t,e).multiply4(a),c=this.width/2,h=this.height/2,u=Math.min(c,h)*this.ratio,d=r.add1(-c,h),p=r.add1(-c,-h),m=r.add1(c,h),g=r.add1(c,-h),y=p.add1(u,u),b=g.add1(-u,u),P=m.add1(-u,-u),T=d.add1(u,-u);if(new ht(p.x,m.x,p.y,m.y).isContains(l)){if(l.x<y.x){if(l.y<y.y)return l.distance1(y)<=u;if(l.y>T.y)return l.distance1(T)<=u}if(l.x>b.x){if(l.y<b.y)return l.distance1(b)<=u;if(l.y>P.y)return l.distance1(P)<=u}return!0}else return!1}default:return jr.inPolygon(new S(t,e),[this.pl])}}clone(){let t=this.pl;return this.pl!=null&&(t=t.clone()),Lo.getStyle(this.type,this.width,this.height,this.ratio,t)}getShape(t,e,r){let{width:i,height:n,type:s}=this,a;switch(s){case"ELLIPSE":{let l=i/2+t;if(l<=0)return null;a=ge.build2([q.build2(e,0,360,l,l,ae.CW)]);break}case"OVAL":{let l=Ae.getMatrix4(e.mul(-1),r,1,e);if(i>n){let c=(i-n)/2,h=n+t*2;if(h<=0)return null;a=this.getStrokePolyline(e.add(new S(-c,0)),e.add(new S(c,0)),h/2,ae.CW)}else if(i<n){let c=(n-i)/2,h=i+t*2;if(h<=0)return null;a=this.getStrokePolyline1(e.add(new S(0,-c)),e.add(new S(0,c)),h/2,ae.CW)}else{let c=i/2+t;if(c<=0)return null;a=ge.build2([q.build2(e,0,360,c,c,ae.CW)])}a=a.multiply3(l.toMatrix3());break}case"RECT":{let l=Ae.getMatrix4(e.mul(-1),r,1,e),c=i/2+t;if(c<=0)return null;let h=n+t*2;if(h<=0)return null;a=ag(e.add(new S(-c,0)),e.add(new S(c,0)),h,this.ratio),a=a.multiply3(l.toMatrix3());break}case"POLYGON":{a=this.pl,t!=0&&(a=xL(a,t));break}}return a==null?void 0:a.asClose()}remove(){}isSimilarTo(t){return this.type==t.type&&this.width==t.width&&this.height==t.height&&this.ratio==t.ratio&&this.type!="POLYGON"}};var HTe=class{constructor(){this.padStylePool=new Map}getPadStyleByType(t,e){return t==="ELLIPSE"?this.getStyle(t,e.width,e.width,e.ratio,e.pl):this.getStyle(t,e.width,e.height,e.ratio,e.pl)}getPadStyleByWidth(t,e){return e.type==="ELLIPSE"?this.getStyle(e.type,t,t,e.ratio,e.pl):this.getStyle(e.type,t,e.height,e.ratio,e.pl)}getPadStyleByHeight(t,e){return e.type==="ELLIPSE"?this.getStyle(e.type,t,t,e.ratio,e.pl):this.getStyle(e.type,e.width,t,e.ratio,e.pl)}getPadStyleByRatio(t,e){return this.getStyle(e.type,e.width,e.height,t,e.pl)}getPadStyleByPl(t,e){return this.getStyle(e.type,e.width,e.height,e.ratio,t)}getStyle(t,e,r,i,n){let s=this.generateStyleId({type:t,width:e,height:r,ratio:i,pl:n});if(this.padStylePool.has(s))return this.padStylePool.get(s);{let a=new nI(t,e,r,i,n);return this.padStylePool.set(s,a),a}}generateStyleId(t){let{type:e,width:r,height:i,ratio:n,pl:s}=t;return s?`${e}_${r}_${i}_${n}_${JSON.stringify(s)}`:`${e}_${r}_${i}_${n}`}},Lo=new HTe;function pBe(o,t,e,r,i,n,s){let a=new _e;switch(i){case"ROUND":{let l=s.add(o);return a.ext2(l).ext7(r),a.build1()}case"SLOT":{let l=(e-r*2)/2,c=Ae.getMatrix4(S.ORIGIN,n+t,1,s.add(o)),h=new S(-l,0).multiply4(c),u=new S(l,0).multiply4(c);return a.ext2(h).ext2(u).ext7(r),a.build1()}case"RECT":{let l=s.add(o),c=n+t,h=Ae.getMatrix4(S.ORIGIN,c,1,l);return new ht(-e/2,e/2,-r,r).transform(h.toMatrix3())}default:throw new Error("this hole style is not supported !!!")}}var Mv=class{constructor(t,e,r,i,n){let s=rS(e*2);t=rS(t),r=="ROUND"&&(t=s),s>t&&(t=s),e=s/2,this.holeLength=t,this.holeRadius=e,this.holeShape=r,this.holeRotation=i,this.holeOffset=n}getHolebbox(t,e){return pBe(t,e,this.holeLength,this.holeRadius,this.holeShape,this.holeRotation,this.holeOffset)}inShape(t,e,r,i,n){let s=n==null?1:n.getScale();switch(this.holeShape){case"ROUND":{let a=this.holeOffset.add(r);return t1(new S(t,e),a,this.holeRadius)}case"SLOT":{let a=(this.holeLength-this.holeRadius*2)/2,l=Ae.rotateZ(this.holeRotation+i).translate1(this.holeOffset.x+r.x,r.y+this.holeOffset.y,0),c=new S(-a,0).multiply4(l),h=new S(a,0).multiply4(l);return Da(new S(t,e),c,h,this.holeRadius,s)}case"RECT":{let a=this.holeOffset.add(r),l=this.holeRotation+i,c=Ae.rotateZForPoint(a,-l),h=this.holeLength/2;return new ht(a.x-h,a.x+h,a.y-this.holeRadius,a.y+this.holeRadius).isContains(a.multiply4(c))}default:throw new Error("this hole style is not supported !!!")}}getShape(t,e,r){let i=Ae.rotateZ(this.holeRotation).translate1(this.holeOffset.x,this.holeOffset.y,0).rotateZ(r).translate1(e.x,e.y,0),n=S.ORIGIN,s;if(this.holeShape=="ROUND")s=ge.build2([q.build2(n,0,-360,this.holeRadius+t,this.holeRadius+t,ae.CW)]);else if(this.holeShape=="RECT"){let a=this.holeRadius*2+t*2,l=n.add1(-this.holeRadius-t,0),c=n.add1(this.holeRadius+t,0);s=new M(l,c).stroke(a,wr.BUTT,ae.CW).asClose()}else{let a=this.holeLength-this.holeRadius*2,l=n.add1(-a/2,0),c=n.add1(a/2,0);s=new M(l,c).stroke(this.holeRadius*2+t*2,wr.ROUND,ae.CW).asClose()}return s.multiply3(i.toMatrix3())}clone(){return nc.getHoleStyle(this.holeLength,this.holeRadius,this.holeShape,this.holeRotation,this.holeOffset)}remove(){}};var WTe=class{constructor(){this.holePool=new Map}getHoleStyleByLength(t,e){return this.getHoleStyle(t,e.holeRadius,e.holeShape,e.holeRotation,e.holeOffset)}getHoleStyleByRadius(t,e){return this.getHoleStyle(e.holeLength,t,e.holeShape,e.holeRotation,e.holeOffset)}getHoleStyleByShape(t,e){return this.getHoleStyle(e.holeLength,e.holeRadius,t,e.holeRotation,e.holeOffset)}getHoleStyleByRotation(t,e){return this.getHoleStyle(e.holeLength,e.holeRadius,e.holeShape,t,e.holeOffset)}getHoleStyleByOffset(t,e){return this.getHoleStyle(e.holeLength,e.holeRadius,e.holeShape,e.holeRotation,t)}getHoleStyle(t,e,r,i,n){if(t==null||e==null||r==null||i==null||n==null)return null;let s=this.generateStyleId({holeLength:t,holeRadius:e,holeShape:r,holeRotation:i,holeOffset:n});if(this.holePool.has(s))return this.holePool.get(s)||null;{let a=new Mv(t,e,r,i,n);return this.holePool.set(s,a),a}}generateStyleId(t){let{holeLength:e,holeRadius:r,holeShape:i,holeRotation:n,holeOffset:s}=t;return`${i}_${e}_${r}_${n}_${s.x}_${s.y}`}},nc=new WTe;var Xp=class{static _getCode(t){return t<0&&(t=0),this.code=1,this.code=this.code<<t,this.code}static _has(t,e){return(e&t)>0}static _add(t,e){return this._has(t,e)||(t+=e),t}static isVisible(t){return(t&7)==1}static setVisible(t){return this.isVisible(t)||(t=(t>>3<<3)+1),t}static isHidden(t){return(t&7)==0}static setHidden(t){return this.isHidden(t)||(t=t>>3<<3),t}static isSelect(t){return(t&7)==3}static setSelect(t){return this.isSelect(t)||(t=(t>>3<<3)+3),t}static isHover(t){return(t&7)==5}static setHover(t){return this.isHover(t)||(t=(t>>3<<3)+5),t}static _remove(t,e){return this._has(t,e)&&(t-=e),t}static _updateCodeState(t,e,r){return r?this._add(t,e):this._remove(t,e)}static has(t,e){return this._has(t,this._getCode(e))}static add(t,e){return this._add(t,this._getCode(e))}static remove(t,e){return this._remove(t,this._getCode(e))}static update(t,e,r){return this._updateCodeState(t,this._getCode(e),r)}};Xp.code=1;var K9=class{constructor(){this._dataState=0}hasDataState(t){return Xp.has(this._dataState,t)}setDataState(t,e){this._dataState=Xp.update(this._dataState,t,e)}setHidden(){this._dataState=Xp.setHidden(this._dataState)}setVisible(){this._dataState=Xp.setVisible(this._dataState)}setSelect(){this._dataState=Xp.setSelect(this._dataState)}setHover(){this._dataState=Xp.setHover(this._dataState)}};var fb=class extends K9{get zIndex(){return this._zIndex||-1}set zIndex(t){this._zIndex=t}get number(){return this._number!=null?this._number:-1}set number(t){this._number=t}get globalIndex(){return this._globalIndex}set globalIndex(t){this._globalIndex=t}get partition(){return this._partition||""}set partition(t){t==""&&this._partition==null||(this._partition=t)}get layerModified(){return this.hasDataState(3)}set layerModified(t){t&&(this.layerOrBoxModified=!0),this.setDataState(3,t)}get layerOrBoxModified(){return this.hasDataState(6)}set layerOrBoxModified(t){this.setDataState(6,t)}get shapeModified(){return this.hasDataState(5)}set shapeModified(t){this.setDataState(5,t)}get netModified(){return this.hasDataState(4)}set netModified(t){this.setDataState(4,t)}getParent(){return this._parent}setParent(t){this._parent=t}getGroupID(){return this._groupID||void 0}setGroupID(t){t?this._groupID=t:delete this._groupID}rotateFor(t,e){let r=Ae.rotateZForPoint(t,e);this.transform(r)}remove(){}update4Childs(){}};var xi=class extends fb{get refreshBBox(){return this.hasDataState(1)}set refreshBBox(t){t&&(this.layerOrBoxModified=!0),this.setDataState(1,t)}get stateWatcher(){return this._stateWatcher}get isEmpty(){return this.hasDataState(2)}set isEmpty(t){t&&(this.layerOrBoxModified=!0),this.setDataState(2,t)}constructor(t){super(),this.setModelWatcher(t)}get center(){return S.ORIGIN}setModelWatcher(t){this._stateWatcher=t}resetDataState(){let t=this.isEmpty,e=this.refreshBBox,r=this.layerOrBoxModified;this._dataState=0,this.isEmpty=t,this.refreshBBox=e,this.layerOrBoxModified=r}updateShapeData(){this._parent!=null&&this._parent.update4Childs(),this.refreshBBox=!0,this.shapeModified=!0,this.watchBBoxModify()}watchBBoxModify(){this._stateWatcher&&this._stateWatcher.setBBoxModify&&this._stateWatcher.setBBoxModify()}watchLayerIdModify(t){this._stateWatcher&&this._stateWatcher.setLayerModify&&this._stateWatcher.setLayerModify(t)}recycle(){this.isEmpty=!0,this.watchBBoxModify(),super.remove(),this._stateWatcher=void 0}remove(){this.recycle()}inOutline(t,e){return this.inShape(t.x,t.y,e)}buildBBox(){return this.isEmpty?null:(this.refreshBBox?(this._bbox=this.updateBox(),this.refreshBBox=!1):this._bbox||(this._bbox=this.bbox||this.updateBox()),this._bbox)}getMathGraphics(t,e){let r=this.buildBBox();if(r!=null){let i=new Array,n=new M(r.LL(),r.LR()),s=new M(r.LR(),r.UR()),a=new M(r.UR(),r.UL()),l=new M(r.UL(),r.LL());return i.push(n),i.push(s),i.push(a),i.push(l),ge.build2(i)}else return null}};var zTe=class{constructor(){this.padRulePool=new Map}getPadRuleByconnectMode(t,e){return this.getPadRule(t,e.lineClearance,e.lineWidth,e.lineAngle)}getPadRuleBylineClearance(t,e){return this.getPadRule(e.connectMode,t,e.lineWidth,e.lineAngle)}getPadRuleBylineWidth(t,e){return this.getPadRule(e.connectMode,e.lineClearance,t,e.lineAngle)}getPadRuleBylineAngle(t,e){return this.getPadRule(e.connectMode,e.lineClearance,e.lineWidth,t)}getPadRule(t,e,r,i){let n=this.generateId({connectMode:t,lineAngle:i,lineClearance:e,lineWidth:r}),s=this.padRulePool.get(n);return s!=null||(t===0?s=new q0(t,e,r,i):s=new q0(t),this.padRulePool.set(n,s)),s}generateId(t){let{connectMode:e,lineAngle:r,lineClearance:i,lineWidth:n}=t;return e===0?`${e}_${r}_${i}_${n}`:`${e}`}},qh=new zTe;var q0=class{static buildByJson(t){if(t)return t.connectMode===0?qh.getPadRule(t.connectMode,t.lineClearance,t.lineWidth,t.lineAngle):qh.getPadRule(t.connectMode)}constructor(t,e,r,i){this.connectMode=t,t===0&&(this.lineClearance=e,this.lineWidth=r,this.lineAngle=i)}toJSON(){return{lineAngle:this.lineAngle,lineWidth:this.lineWidth,lineClearance:this.lineClearance,connectMode:this.connectMode}}clone(){return this.connectMode===0?qh.getPadRule(this.connectMode,this.lineClearance,this.lineWidth,this.lineAngle):qh.getPadRule(this.connectMode)}};var Z9=class{static compress(t){if(!t)return 0;let e=0;for(let r of t)e+=1<<r-15;return e}static decompress(t){let e=[];for(let r=0;r<31;r++)t>>r&1&&e.push(r+15);return e}};var Ei=class{constructor(){this.map=new Map;this._last=void 0}getItem(t){return this.map.get(t)}getAllItem(){let t=new Array(this.map.size),e=this.map.values(),r=0;for(let i of e)t[r]=i,r++;return t}iterator(t){this.map.forEach((e,r)=>{t(e,r)})}iteratorBreakable(t){for(let[e,r]of this.map)if(t(r,e)===!1)break}get itemsCount(){return this.map.size}recycle(){this.map.clear()}deleteById(t){this.map.delete(t)}};var mb=class{constructor(t){this._name=t}get name(){return this._name}set name(t){this._name=t}};var gb=class extends mb{constructor(){super(...arguments);this._safeSpacing="default";this._trackPhysics="default";this._creepageSpacing="default";this._differentialPhysics="default";this._netLengthPhysics="default";this._netLengthTolerancePhysics=null;this._targetNet=null;this._blindViaPhysics="default";this._radiusPhysics="default";this._innerPlane="default";this._copperPlane="default";this._solderExpansion="default";this._pasteExpansion="default";this._safeCopperPlane=null;this._safeInnerPlane=null}get safeSpacing(){return this._safeSpacing}set safeSpacing(e){this._safeSpacing=e}get creepageSpacing(){return this._creepageSpacing}set creepageSpacing(e){this._creepageSpacing=e}get trackPhysics(){return this._trackPhysics}set trackPhysics(e){this._trackPhysics=e}get netLengthPhysics(){return this._netLengthPhysics}set netLengthPhysics(e){this._netLengthPhysics=e}get netLengthTolerancePhysics(){return this._netLengthTolerancePhysics}set netLengthTolerancePhysics(e){this._netLengthTolerancePhysics=e}get targetNet(){return this._targetNet}set targetNet(e){this._targetNet=e}get differentialPhysics(){return this._differentialPhysics}set differentialPhysics(e){this._differentialPhysics=e}get blindViaPhysics(){return this._blindViaPhysics}set blindViaPhysics(e){this._blindViaPhysics=e}get radiusPhysics(){return this._radiusPhysics}set radiusPhysics(e){this._radiusPhysics=e}get innerPlane(){return this._innerPlane}set innerPlane(e){this._innerPlane=e}get copperPlane(){return this._copperPlane}set copperPlane(e){this._copperPlane=e}get safeInnerPlane(){return this._safeInnerPlane}set safeInnerPlane(e){this._safeInnerPlane=e}get safeCopperPlane(){return this._safeCopperPlane}set safeCopperPlane(e){this._safeCopperPlane=e}get solderExpansion(){return this._solderExpansion}set solderExpansion(e){this._solderExpansion=e}get pasteExpansion(){return this._pasteExpansion}set pasteExpansion(e){this._pasteExpansion=e}};var RL=class RL{constructor(){this.actions=new Array}static getInstance(){return RL.ins==null&&(RL.ins=new RL),RL.ins}attach(t){this.actions.push(t)}sycnColor(t,e){for(let r of this.actions)r.doAction(t,e)}};RL.ins=null;var DL=RL;var zd=class o extends gb{constructor(e,r="default",i="default",n="default",s="default",a=null,l="default",c="default",h="default",u="default",d="default",p="default",m=null,g=null,y=null,b=!0,P=null,T="default"){super(e);this._netClassName=null;this._equalLengthGroupName=null;this._netDifferentialName=null;this._showRatline=!0;this._color=null;this._safeSpacing=r,this._trackPhysics=i,this._differentialPhysics=n,this._netLengthPhysics=s,this._netLengthTolerancePhysics=a,this._blindViaPhysics=l,this._radiusPhysics=c,this._innerPlane=h,this._copperPlane=u,this._solderExpansion=d,this._pasteExpansion=p,this._netClassName=m,this._equalLengthGroupName=g,this._netDifferentialName=y,this._showRatline=b,this._color=P,this._creepageSpacing=T,DL.getInstance().sycnColor(this.name,P)}hasNet(e){return this.name!=null&&this.name==e}get color(){return this._color}set color(e){this._color=e,DL.getInstance().sycnColor(this.name,e)}get showRatline(){return this._showRatline}set showRatline(e){this._showRatline=e}get netLengthPhysics(){return this._netLengthPhysics}set netLengthPhysics(e){this._netLengthPhysics=e,this.equalLengthGroup!=null&&(this.equalLengthGroup.netLengthPhysics=e)}get netLengthTolerancePhysics(){return this._netLengthTolerancePhysics}set netLengthTolerancePhysics(e){this._netLengthTolerancePhysics=e,this.equalLengthGroup!=null&&(this.equalLengthGroup.netLengthTolerancePhysics=e)}get netClass(){return re.getInstance().getNetClass(this._netClassName)}set netClass(e){e!=null?this._netClassName=e.name:this._netClassName=null}get equalLengthGroup(){return re.getInstance().getEqualLengthGroup(this._equalLengthGroupName)}set equalLengthGroup(e){e!=null?this._equalLengthGroupName=e.name:this._equalLengthGroupName=null}get differentialPhysics(){return this._differentialPhysics}set differentialPhysics(e){this._differentialPhysics=e,this.netDifferential!=null&&(this.netDifferential.differentialPhysics=e)}get netDifferentialName(){return this._netDifferentialName}get netDifferential(){return re.getInstance().getNetDifferential(this._netDifferentialName)}set netDifferential(e){e!=null?this._netDifferentialName=e.name:this._netDifferentialName=null}get isPositiveNet(){return this.netDifferential!=null?this.netDifferential.positiveNet==this:!1}remove(){this.netClass!=null&&this.netClass.removeNetwork(this._name),this.equalLengthGroup!=null&&this.equalLengthGroup.removeNetwork(this._name)}clone(){return new o(this.name,this._safeSpacing,this._trackPhysics,this._differentialPhysics,this._netLengthPhysics,this.netLengthTolerancePhysics,this._blindViaPhysics,this._radiusPhysics,this._innerPlane,this._copperPlane,this._solderExpansion,this._pasteExpansion,this._netClassName,this._equalLengthGroupName,this._netDifferentialName,this._showRatline,this._color,this._creepageSpacing)}toJSON(){return{name:this.name,safeSpacing:this._safeSpacing,trackPhysics:this._trackPhysics,differentialPhysics:this._differentialPhysics,netLengthPhysics:this._netLengthPhysics,netLengthTolerancePhysics:this._netLengthTolerancePhysics,blindViaPhysics:this._blindViaPhysics,radiusPhysics:this._radiusPhysics,innerPlane:this._innerPlane,copperPlane:this._copperPlane,solderExpansion:this._solderExpansion,pasteExpansion:this._pasteExpansion,netClassName:this._netClassName,equalLengthGroupName:this._equalLengthGroupName,netDifferentialName:this._netDifferentialName,targetNet:this._targetNet,creepageSpacing:this._creepageSpacing}}};var $h=class o extends gb{constructor(e,r="default",i="default",n="default",s="default",a=null,l="default",c="default",h="default",u="default",d="default",p="default",m="default",g=new Set){super(e);this._nets=new Set;this.update(r,i,n,s,a,l,c,h,u,d,p,m,g)}getNets(){return this._nets}update(e="default",r="default",i="default",n="default",s=null,a="default",l="default",c="default",h="default",u="default",d="default",p="default",m=new Set){this._safeSpacing=e,this._trackPhysics=r,this._differentialPhysics=i,this._netLengthPhysics=n,this._netLengthTolerancePhysics=s,this._blindViaPhysics=a,this._radiusPhysics=l,this._innerPlane=c,this._copperPlane=h,this._solderExpansion=u,this._pasteExpansion=d,this._creepageSpacing=p,this._nets.clear(),xe.addAllSet(this._nets,m)}hasNet(e){return this._nets.has(e)}addNetwork(e){this._nets.add(e.name),e.netClass=this}getNet(e){return this._nets.has(e)?re.getInstance().getNet(e):null}removeNetwork(e){if(this._nets.has(e)){let r=re.getInstance().getNet(e);r!=null&&r.netClass===this&&(r.netClass=null),this._nets.delete(e),e==this.targetNet&&(this.targetNet=null)}}getAllNets(){let e=new Array;for(let r of this._nets){let i=re.getInstance().getNet(r);e.push(i)}return e}remove(){for(let e of this._nets){let r=re.getInstance().getNet(e);r!=null&&r.netClass===this&&(r.netClass=null)}this._nets.clear()}clone(){let e=new o(this._name,this._safeSpacing,this._trackPhysics,this._differentialPhysics,this._netLengthPhysics,this._netLengthTolerancePhysics,this._blindViaPhysics,this._radiusPhysics,this._innerPlane,this._copperPlane,this._solderExpansion,this._pasteExpansion,this._creepageSpacing,new Set(this._nets));return e._targetNet=this._targetNet,e}toJSON(){return{name:this.name,safeSpacing:this._safeSpacing,trackPhysics:this._trackPhysics,differentialPhysics:this._differentialPhysics,netLengthPhysics:this._netLengthPhysics,netLengthTolerancePhysics:this._netLengthTolerancePhysics,blindViaPhysics:this._blindViaPhysics,radiusPhysics:this._radiusPhysics,innerPlane:this._innerPlane,copperPlane:this._copperPlane,solderExpansion:this._solderExpansion,pasteExpansion:this._pasteExpansion,targetNet:this._targetNet,creepageSpacing:this._creepageSpacing,nets:new Set(this._nets)}}};var dd=class o extends gb{constructor(e,r="default",i="default",n="default",s="default",a=null,l="default",c="default",h="default",u="default",d="default",p="default",m="default",g=new Set){super(e);this._nets=new Set;this.update(r,i,n,s,a,l,c,h,u,d,p,m,g)}update(e="default",r="default",i="default",n="default",s=null,a="default",l="default",c="default",h="default",u="default",d="default",p="default",m=new Set){this._safeSpacing=e,this._trackPhysics=r,this._differentialPhysics=i,this._netLengthPhysics=n,this._netLengthTolerancePhysics=s,this._blindViaPhysics=a,this._radiusPhysics=l,this._innerPlane=c,this._copperPlane=h,this._solderExpansion=u,this._pasteExpansion=d,this._creepageSpacing=p,this._nets.clear(),xe.addAllSet(this._nets,m)}hasNet(e){return this._nets.has(e)}getNet(e){return this._nets.has(e)?re.getInstance().getNet(e):null}addNetwork(e){this._nets.add(e.name)}removeNetwork(e){if(this._nets.has(e)){let r=re.getInstance().getNet(e);r!=null&&r.equalLengthGroup===this&&(r.equalLengthGroup=null),this._nets.delete(e),e==this.targetNet&&(this.targetNet=null)}}getAllNetIds(){return Array.from(this._nets)}getAllNets(){let e=new Array;for(let r of this._nets){let i=re.getInstance().getNet(r);i!=null&&e.push(i)}return e}remove(){for(let e of this._nets){let r=re.getInstance().getNet(e);r!=null&&r.equalLengthGroup===this&&(r.equalLengthGroup=null)}this._nets.clear()}addEqualLengthGroup(e){this._nets.add(e.name),e.equalLengthGroup=this}getEqualLengthGroup(e){}getNets(){return this._nets}deleteNet(e){return this._nets.delete(e)}clone(){let e=new o(this._name,this._safeSpacing,this._trackPhysics,this._differentialPhysics,this._netLengthPhysics,this._netLengthTolerancePhysics,this._blindViaPhysics,this._radiusPhysics,this._innerPlane,this._copperPlane,this._solderExpansion,this._pasteExpansion,this._creepageSpacing,new Set(this._nets));return e._targetNet=this._targetNet,e}toJSON(){return{name:this.name,safeSpacing:this._safeSpacing,trackPhysics:this._trackPhysics,differentialPhysics:this._differentialPhysics,netLengthPhysics:this._netLengthPhysics,netLengthTolerancePhysics:this._netLengthTolerancePhysics,blindViaPhysics:this._blindViaPhysics,radiusPhysics:this._radiusPhysics,innerPlane:this._innerPlane,copperPlane:this._copperPlane,solderExpansion:this._solderExpansion,pasteExpansion:this._pasteExpansion,nets:new Set(this._nets),targetNet:this._targetNet,creepageSpacing:this._creepageSpacing}}};var lg=class o{constructor(t,e,r,i){this._ruleName=null;this._safeCopperPlane=null;this._safeInnerPlane=null;this._creepageRule=null;this._net1Type=t,this._net1=e,this._net2Type=r,this._net2=i}get ruleName(){return this._ruleName}set ruleName(t){this._ruleName=t}get creepageRule(){return this._creepageRule}set creepageRule(t){this._creepageRule=t}getNet(t,e){switch(t){case"net":return re.getInstance().getNet(e);case"netClass":return re.getInstance().getNetClass(e);case"equalLengthGroup":return re.getInstance().getEqualLengthGroup(e);default:return null}}get net1(){return this.getNet(this._net1Type,this._net1)}get net2(){return this.getNet(this._net2Type,this._net2)}get safeInnerPlane(){return this._safeInnerPlane}set safeInnerPlane(t){this._safeInnerPlane=t}get safeCopperPlane(){return this._safeCopperPlane}set safeCopperPlane(t){this._safeCopperPlane=t}getNets(t){if(t instanceof zd)return[t.name];if(t instanceof $h||t instanceof dd){let e=t.getAllNets(),r=[];return e.forEach(i=>{r.push(i.name)}),r}return[]}equals(t){if(this.net1==t.net1&&this._net1Type==t._net1Type&&this.net2==t.net2&&this._net2Type==t._net2Type||this.net1==t.net2&&this._net1Type==t._net2Type&&this.net2==t.net1&&this._net2Type==t._net1Type)return!0}clone(){let t=new o(this._net1Type,this._net1,this._net2Type,this._net2);return t._ruleName=this._ruleName,t._safeCopperPlane=this._safeCopperPlane,t._safeInnerPlane=this._safeInnerPlane,t._creepageRule=this._creepageRule,t}};var Jee=class o extends mb{constructor(){super(...arguments);this.rule=new Array;this.cacheRuleMap=new Array}addRule(e){this.rule.push(e)}deltetRule4Net(e){this.deleteRule(this.rule,e)}getRule(e,r){for(let i of this.rule)if(i._net1==e&&i._net2==r||i._net1==r&&i._net2==e)return i;return null}getRuleWithType(e,r,i,n){for(let s of this.rule)if(s._net1Type===e&&s._net1===r&&s._net2Type===i&&s._net2===n||s._net1Type===i&&s._net1===n&&s._net2Type===e&&s._net2===r)return s;return null}deleteRule4(e,r){let i=this.rule.findIndex(n=>n._net1==e&&n._net2==r||n._net1==r&&n._net2==e);if(i>-1){let n=this.rule[i];this.cacheRuleMap.push({net1Type:n._net1Type,net1:n._net1,net2Type:n._net2Type,net2:n._net2,ruleName:n.ruleName,creepageRule:n.creepageRule,safeCopperPlane:n.safeCopperPlane,safeInnerPlane:n.safeInnerPlane}),this.rule.splice(i,1)}}deleteRuleWithType(e,r,i,n){let s=this.rule.findIndex(a=>a._net1Type===e&&a._net1===r&&a._net2Type===i&&a._net2===n||a._net1Type===i&&a._net1===n&&a._net2Type===e&&a._net2===r);if(s>-1){let a=this.rule[s];this.cacheRuleMap.push({net1Type:a._net1Type,net1:a._net1,net2Type:a._net2Type,net2:a._net2,ruleName:a.ruleName,creepageRule:a.creepageRule,safeCopperPlane:a.safeCopperPlane,safeInnerPlane:a.safeInnerPlane}),this.rule.splice(s,1)}}rebuild(e){if(this.cacheRuleMap.length){for(let r of this.cacheRuleMap){let{net1Type:i,net1:n,net2Type:s,net2:a,ruleName:l,creepageRule:c,safeCopperPlane:h,safeInnerPlane:u}=r;if(n==e.name||a==e.name){let d=this.getRule(n,a);d||(d=new lg(i,n,s,a),this.addRule(d)),d.ruleName=l,d.creepageRule=c,d.safeCopperPlane=h,d.safeInnerPlane=u}}this.cacheRuleMap.length=0}}deleteRule(e,r){let i=Array.from(e);for(let n of i)if(n.net1==r||n.net2==r){let s=e.indexOf(n);s>=0&&(this.cacheRuleMap.push({net1Type:n._net1Type,net1:n._net1,net2Type:n._net2Type,net2:n._net2,ruleName:n.ruleName,creepageRule:n.creepageRule,safeCopperPlane:n.safeCopperPlane,safeInnerPlane:n.safeInnerPlane}),e.splice(s,1))}}clone(){let e=new o(this._name);for(let r of this.rule)e.addRule(r.clone());return e}};var GO=class{constructor(t,e,r,i,n,s=!0,a=-1){this._isKeepIsland=!0;this.zIndex=-1;this._layerId=t,this._thickness=r,this._permittivity=i,this._lossTangent=n,this._material=e,this._isKeepIsland=s,this.zIndex=a}get layerId(){return this._layerId}get material(){return this._material}set material(t){this._material=t}get thickness(){return this._thickness}set thickness(t){this._thickness=t}get permittivity(){return this._permittivity}set permittivity(t){this._permittivity=t}get lossTangent(){return this._lossTangent}set lossTangent(t){this._lossTangent=t}get layerName(){return Ze.getInstance().getLayer(this.layerId).name}get layerType(){return Ze.getInstance().getLayer(this.layerId).type}get isKeepIsland(){return this._isKeepIsland}set isKeepIsland(t){this._isKeepIsland=t}modify(t,e,r,i,n=!0,s=-1){this._thickness=e,this._permittivity=r,this._lossTangent=i,this._material=t,this._isKeepIsland=n,this.zIndex=s}};var ny=class o extends mk{static build(t,e,r){let i=new o;return i.config=t,i.visible=e,i.locked=r,i}constructor(t=6){super(t)}get config(){return this.getValue(0)}set config(t){this.setValue(0,t)}get visible(){return this.getValue(1)}set visible(t){this.setValue(1,t)}get locked(){return this.getValue(2)}set locked(t){this.setValue(2,t)}};var UO=class o{constructor(t,e,r,i,n,s){this._temporaryActiveColor=void 0;this.layerId=t,this.type=e,this.hashed=t,this.name=r,this.status=i,this._activeColor=n,this.deactiveColor=s}get config(){return this.status.config}set config(t){this.status.config=t}get visible(){return this.status.visible}set visible(t){this.status.visible=t}get locked(){return this.status.locked}set locked(t){this.status.locked=t}get state(){return this.status.state}get activeColor(){return this._temporaryActiveColor||this._activeColor}setActiveColor(t,e){e?this._temporaryActiveColor=t:this._activeColor=t}get realActiveColor(){return this._activeColor}hashCode(){return this.hashed}equals(t){return t instanceof o?this.layerId===t.layerId:!1}};var YTe=[10066278,32768,65280,12357120,7396346,52326,10053375,8388736,32896,1413983,128,46080,3032918,10060847,16777130,10060847,3032918,3487231,8388796,4435551,12840142,7506296,3756095,815453,5933696,2855806,2333085,4568291,2186657,4547799,6908393,9464297],VCt=(function(){let o=[],t=YTe.reverse();for(let e=71;e<=270;e++){let r=(e-71)%YTe.length;o.push({layerId:e,type:"CUSTOM",name:`Custom${e-71+1}`,order:1e3+e,activeColor:ee.of1(t[r]),deactiveColor:ee.of1(t[r]).mul(.5),active:!1,layerStatus:0})}return o})(),mBe=(function(){let o=[],t=YTe.reverse();for(let e=101;e<=270;e++)o.push({layerId:e,type:"CUSTOM",name:`Custom${e-70}`,order:1e3+e,activeColor:ee.of1(t[e-71]),deactiveColor:ee.of1(t[e-71]).mul(.5),active:!1,layerStatus:0});return o})(),oy=[{layerId:1,type:"TOP",name:"Top Layer",order:24,activeColor:ee.of1(16711680),deactiveColor:ee.of1(16711680).mul(.5),active:!0,layerStatus:1},{layerId:2,type:"BOTTOM",name:"Bottom Layer",order:39,activeColor:ee.of1(255),deactiveColor:ee.of1(255).mul(.5),active:!1,layerStatus:1},{layerId:3,type:"TOP_SILK",name:"Top Silkscreen Layer",order:21,activeColor:ee.of1(16763904),deactiveColor:ee.of1(16763904).mul(.5),active:!1,layerStatus:1},{layerId:4,type:"BOT_SILK",name:"Bottom Silkscreen Layer",order:36,activeColor:ee.of1(6736947),deactiveColor:ee.of1(6736947).mul(.5),active:!1,layerStatus:1},{layerId:5,type:"TOP_SOLDER_MASK",name:"Top Solder Mask Layer",order:27,activeColor:ee.of5("#800080",.7),deactiveColor:ee.of1(8388736).mul(.5),active:!1,layerStatus:1},{layerId:6,type:"BOT_SOLDER_MASK",name:"Bottom Solder Mask Layer",order:42,activeColor:ee.of5("#aa00ff",.7),deactiveColor:ee.of1(11141375).mul(.5),active:!1,layerStatus:1},{layerId:7,type:"TOP_PASTE_MASK",name:"Top Paste Mask Layer",order:30,activeColor:ee.of1(8421504),deactiveColor:ee.of1(8421504).mul(.5),active:!1,layerStatus:1},{layerId:8,type:"BOT_PASTE_MASK",name:"Bottom Paste Mask Layer",order:45,activeColor:ee.of1(8388608),deactiveColor:ee.of1(8388608).mul(.5),active:!1,layerStatus:1},{layerId:9,type:"TOP_ASSEMBLY",name:"Top Assembly Layer",order:33,activeColor:ee.of1(3394713),deactiveColor:ee.of1(3394713).mul(.5),active:!1,layerStatus:1},{layerId:10,type:"BOT_ASSEMBLY",name:"Bottom Assembly Layer",order:48,activeColor:ee.of1(5592575),deactiveColor:ee.of1(5592575).mul(.5),active:!1,layerStatus:1},{layerId:11,type:"OUTLINE",name:"Board Outline Layer",order:147,activeColor:ee.of1(16711935),deactiveColor:ee.of1(16711935).mul(.5),active:!1,layerStatus:1},{layerId:12,type:"MULTI",name:"Multi-Layer",order:8,activeColor:ee.of1(12632256),deactiveColor:ee.of1(12632256).mul(.5),active:!1,layerStatus:1},{layerId:13,type:"DOCUMENT",name:"Document Layer",order:150,activeColor:ee.of1(16777215),deactiveColor:ee.of1(16777215).mul(.5),active:!1,layerStatus:1},{layerId:14,type:"MECHANICAL",name:"Mechanical Layer",order:153,activeColor:ee.of1(15737584),deactiveColor:ee.of1(15737584).mul(.5),active:!1,layerStatus:1},{layerId:15,type:"SIGNAL",name:"Inner1",order:51,activeColor:ee.of1(10066278),deactiveColor:ee.of1(10066278).mul(.5),active:!1,layerStatus:0},{layerId:16,type:"SIGNAL",name:"Inner2",order:54,activeColor:ee.of1(32768),deactiveColor:ee.of1(32768).mul(.5),active:!1,layerStatus:0},{layerId:17,type:"SIGNAL",name:"Inner3",order:57,activeColor:ee.of1(65280),deactiveColor:ee.of1(65280).mul(.5),active:!1,layerStatus:0},{layerId:18,type:"SIGNAL",name:"Inner4",order:60,activeColor:ee.of1(12357120),deactiveColor:ee.of1(12357120).mul(.5),active:!1,layerStatus:0},{layerId:19,type:"SIGNAL",name:"Inner5",order:63,activeColor:ee.of1(7396346),deactiveColor:ee.of1(7396346).mul(.5),active:!1,layerStatus:0},{layerId:20,type:"SIGNAL",name:"Inner6",order:66,activeColor:ee.of1(52326),deactiveColor:ee.of1(52326).mul(.5),active:!1,layerStatus:0},{layerId:21,type:"SIGNAL",name:"Inner7",order:69,activeColor:ee.of1(10053375),deactiveColor:ee.of1(10053375).mul(.5),active:!1,layerStatus:0},{layerId:22,type:"SIGNAL",name:"Inner8",order:72,activeColor:ee.of1(8388736),deactiveColor:ee.of1(8388736).mul(.5),active:!1,layerStatus:0},{layerId:23,type:"SIGNAL",name:"Inner9",order:75,activeColor:ee.of1(32896),deactiveColor:ee.of1(32896).mul(.5),active:!1,layerStatus:0},{layerId:24,type:"SIGNAL",name:"Inner10",order:79,activeColor:ee.of1(1413983),deactiveColor:ee.of1(1413983).mul(.5),active:!1,layerStatus:0},{layerId:25,type:"SIGNAL",name:"Inner11",order:81,activeColor:ee.of1(128),deactiveColor:ee.of1(128).mul(.5),active:!1,layerStatus:0},{layerId:26,type:"SIGNAL",name:"Inner12",order:84,activeColor:ee.of1(46080),deactiveColor:ee.of1(46080).mul(.5),active:!1,layerStatus:0},{layerId:27,type:"SIGNAL",name:"Inner13",order:87,activeColor:ee.of1(3032918),deactiveColor:ee.of1(3032918).mul(.5),active:!1,layerStatus:0},{layerId:28,type:"SIGNAL",name:"Inner14",order:90,activeColor:ee.of1(10060847),deactiveColor:ee.of1(10060847).mul(.5),active:!1,layerStatus:0},{layerId:29,type:"SIGNAL",name:"Inner15",order:93,activeColor:ee.of1(16777130),deactiveColor:ee.of1(16777130).mul(.5),active:!1,layerStatus:0},{layerId:30,type:"SIGNAL",name:"Inner16",order:96,activeColor:ee.of1(10060847),deactiveColor:ee.of1(10060847).mul(.5),active:!1,layerStatus:0},{layerId:31,type:"SIGNAL",name:"Inner17",order:99,activeColor:ee.of1(3032918),deactiveColor:ee.of1(3032918).mul(.5),active:!1,layerStatus:0},{layerId:32,type:"SIGNAL",name:"Inner18",order:102,activeColor:ee.of1(3487231),deactiveColor:ee.of1(3487231).mul(.5),active:!1,layerStatus:0},{layerId:33,type:"SIGNAL",name:"Inner19",order:105,activeColor:ee.of1(8388796),deactiveColor:ee.of1(8388796).mul(.5),active:!1,layerStatus:0},{layerId:34,type:"SIGNAL",name:"Inner20",order:108,activeColor:ee.of1(4435551),deactiveColor:ee.of1(4435551).mul(.5),active:!1,layerStatus:0},{layerId:35,type:"SIGNAL",name:"Inner21",order:111,activeColor:ee.of1(12840142),deactiveColor:ee.of1(12840142).mul(.5),active:!1,layerStatus:0},{layerId:36,type:"SIGNAL",name:"Inner22",order:114,activeColor:ee.of1(7506296),deactiveColor:ee.of1(7506296).mul(.5),active:!1,layerStatus:0},{layerId:37,type:"SIGNAL",name:"Inner23",order:117,activeColor:ee.of1(3756095),deactiveColor:ee.of1(3756095).mul(.5),active:!1,layerStatus:0},{layerId:38,type:"SIGNAL",name:"Inner24",order:120,activeColor:ee.of1(815453),deactiveColor:ee.of1(815453).mul(.5),active:!1,layerStatus:0},{layerId:39,type:"SIGNAL",name:"Inner25",order:123,activeColor:ee.of1(5933696),deactiveColor:ee.of1(5933696).mul(.5),active:!1,layerStatus:0},{layerId:40,type:"SIGNAL",name:"Inner26",order:126,activeColor:ee.of1(2855806),deactiveColor:ee.of1(2855806).mul(.5),active:!1,layerStatus:0},{layerId:41,type:"SIGNAL",name:"Inner27",order:129,activeColor:ee.of1(2333085),deactiveColor:ee.of1(2333085).mul(.5),active:!1,layerStatus:0},{layerId:42,type:"SIGNAL",name:"Inner28",order:132,activeColor:ee.of1(4568291),deactiveColor:ee.of1(4568291).mul(.5),active:!1,layerStatus:0},{layerId:43,type:"SIGNAL",name:"Inner29",order:135,activeColor:ee.of1(2186657),deactiveColor:ee.of1(2186657).mul(.5),active:!1,layerStatus:0},{layerId:44,type:"SIGNAL",name:"Inner30",order:138,activeColor:ee.of1(4547799),deactiveColor:ee.of1(4547799).mul(.5),active:!1,layerStatus:0},{layerId:45,type:"SIGNAL",name:"Inner31",order:141,activeColor:ee.of1(6908393),deactiveColor:ee.of1(6908393).mul(.5),active:!1,layerStatus:0},{layerId:46,type:"SIGNAL",name:"Inner32",order:144,activeColor:ee.of1(9464297),deactiveColor:ee.of1(9464297).mul(.5),active:!1,layerStatus:0},{layerId:47,type:"HOLE",name:"Hole Layer",order:6,activeColor:ee.of1(2236962),deactiveColor:ee.of1(2236962).mul(.5),active:!1,layerStatus:1},{layerId:48,type:"COMPONENT_SHAPE",name:"Component Shape Layer",order:200,activeColor:ee.of1(52428),deactiveColor:ee.of1(52428).mul(.5),active:!1,layerStatus:2},{layerId:49,type:"COMPONENT_MARKING",name:"Component Marking Layer",order:203,activeColor:ee.of1(6750156),deactiveColor:ee.of1(6750156).mul(.5),active:!1,layerStatus:2},{layerId:50,type:"PIN_SOLDERING",name:"Pin Soldering Layer",order:206,activeColor:ee.of1(13408665),deactiveColor:ee.of1(13408665).mul(.5),active:!1,layerStatus:2},{layerId:51,type:"PIN_FLOATING",name:"Pin Floating Layer",order:209,activeColor:ee.of1(16751103),deactiveColor:ee.of1(16751103).mul(.5),active:!1,layerStatus:2},{layerId:52,type:"COMPONENT_MODEL",name:"Component Model Layer",order:212,activeColor:ee.of1(16777215),deactiveColor:ee.of1(16777215).mul(.5),active:!1,layerStatus:0},{layerId:53,type:"3D_SHELL_OUTLINE",name:"3D Shell Outline Layer",order:10215,activeColor:ee.of1(6750105),deactiveColor:ee.of1(6750105).mul(.5),active:!1,layerStatus:1},{layerId:54,type:"3D_SHELL_TOP",name:"3D Shell Top Layer",order:10218,activeColor:ee.of1(16764159),deactiveColor:ee.of1(16764159).mul(.5),active:!1,layerStatus:1},{layerId:55,type:"3D_SHELL_BOTTOM",name:"3D Shell Bottom Layer",order:10221,activeColor:ee.of1(26316),deactiveColor:ee.of1(26316).mul(.5),active:!1,layerStatus:1},{layerId:56,type:"DRILL_DRAWING",name:"Drill Drawing Layer",order:222,activeColor:ee.of1(32896),deactiveColor:ee.of1(32896).mul(.5),active:!1,layerStatus:1},{layerId:57,type:"OTHER",name:"Ratline Layer",order:2,activeColor:ee.of1(6579455),deactiveColor:ee.of1(6579455).mul(.5),active:!1,layerStatus:1},{layerId:58,type:"TOP_STIFFENER",name:"Top Stiffener Layer",order:35,activeColor:ee.of1(15656550),deactiveColor:ee.of1(15656550).mul(.5),active:!1,layerStatus:0},{layerId:59,type:"BOTTOM_STIFFENER",name:"Bottom Stiffener Layer",order:50,activeColor:ee.of1(13434624),deactiveColor:ee.of1(13434624).mul(.5),active:!1,layerStatus:0},...VCt],Bz=(()=>{let o={};return oy.forEach(t=>{o[t.layerId]=t.name.replaceAll(" ","")}),o})(),HO=[48,49,50,51,52],wL=[52,53,54,55,56],jTe={1:24,2:39,3:21,4:36,7:30,8:45,5:27,6:42,11:147,12:8,13:150,9:33,58:35,10:48,59:50,14:153,15:51,16:54,17:57,18:60,19:63,20:66,21:69,22:72,23:75,24:78,25:81,26:84,27:87,28:90,29:93,30:96,31:99,32:102,33:105,34:108,35:111,36:114,37:117,38:120,39:123,40:126,41:129,42:132,43:135,44:138,45:141,46:144,47:6,48:200,49:203,50:206,51:209,52:212,53:10215,54:10218,55:10221,57:2};var gBe=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,47,48,49,50,51,53,54,55,56,57];var LL=class LL extends Ei{constructor(){super();this.map=new Map;this._deactiveAlpha=.5;this.activeLayer=0;this._layerPhys=new Map;this.helpLayerMask={};this.initLayer()}static getInstance(){return LL.manager==null&&(LL.manager=new LL),LL.manager}get deactiveAlpha(){return this._deactiveAlpha}set deactiveAlpha(e){this._deactiveAlpha=e;for(let[,r]of this.map)r.deactiveColor=ee.of6(r.deactiveColor,this._deactiveAlpha)}hasInner(){var e;return(e=this.map.get(15))==null?void 0:e.config}initLayer(){for(let e of oy){let r=e.layerStatus,i=ny.build(e.layerStatus!=0,r==1,!1);this.addLayer(e.layerId,e.type,e.name,i,e.activeColor,e.deactiveColor)}}getLayerPhys(){let e=Array.from(this._layerPhys.values());return e.sort((r,i)=>r.zIndex-i.zIndex),e}addLayerPhyModel(e){this._layerPhys.set(e.layerId,e)}addLayerPhy(e,r,i,n,s,a,l){let c=new GO(e,r,i,n,s,a,l);return this._layerPhys.set(e,c),c}modifyLayerPhy(e,r,i,n,s,a,l){let c=this._layerPhys.get(e);return c!=null?c.modify(r,i,n,s,a,l):(c=new GO(e,r,i,n,s,a,l),this._layerPhys.set(e,c)),c}deleteLayerPhy(e){this._layerPhys.delete(e)}getLayerPhy(e){return this._layerPhys.get(e)}getfilterPhyLayers(){let e={};for(let[r,i]of this.map)i.type=="SUBSTRATE"?this.getLayerPhy(i.layerId)!=null&&(e[r]=i):e[r]=i;return e}addLayer(e,r,i,n,s,a){let l=new UO(e,r,i,n,s,a);return this.map.set(e,l),l}addHelpLayer(e,r,i,n,s,a){let l=new UO(e,r,i,n,s,a);return this.helpLayerMask[e]=l,l}getHelpLayer(e){return this.helpLayerMask[e]}getAllHelpLayer(){return Object.keys(this.helpLayerMask)}modifyLayer(e,r,i,n,s,a){let l=this.map.get(e);return l==null?this.addLayer(e,r,i,n,s,a):(l.type=r,l.name=i,l.config=n.config,l.visible=n.visible,l.locked=n.locked,l.setActiveColor(s),l.deactiveColor=a,l)}getLayer(e){return this.map.get(e)}getUseLayer(){let e=new Array;for(let[r,i]of this.map)i.config&&e.push(i);return e}setLayer(e){let r=e.layerId;this.map.set(r,e)}getAllCopperLayer(){let e=new Array;for(let[r,i]of this.map)i.config&&Ree(i.type)&&e.push(i);return e}getAllCopperLayerIds(){return this.getAllCopperLayer().map(e=>e.layerId)}getAllSignalLayers(){return this.getAllCopperLayer().filter(e=>ns(e.type))}getAllSignalLayerIds(){return this.getAllSignalLayers().map(e=>e.layerId)}getAllPlaneLayer(){let e=new Array;for(let[r,i]of this.map)i.config&&mu(i.type)&&e.push(i);return e}isValidLayer(e){var r;return Es(e)?((r=this.map.get(e))==null?void 0:r.config)||!1:!0}isSignalLayer(e){let r=this.map.get(e);return r!=null&&r.config&&ns(r.type)}isCustomLayer(e,r=!1){let i=this.map.get(e);return i!=null&&"CUSTOM"==i.type&&(!r||i.config)}getSingleLayerId4Order(){let e=new Array;e.push(1);for(let r=15;r<=46;r++){let i=this.map.get(r);i!=null&&i.config&&ns(i.type)&&e.push(r)}return e.push(2),e}getAllCopperLayerId4Order(){let e=new Array;e.push(1);for(let r=15;r<=46;r++){let i=this.map.get(r);i!=null&&i.config&&e.push(r)}return e.push(2),e}getAllPlaneLayerIds(){return this.getAllPlaneLayer().map(e=>e.layerId)}recycle(){this.map.clear(),this._layerPhys.clear()}};LL.manager=null;var Ze=LL;var Qee=class{constructor(t,e){this.used=new Set;this.resetState(t,e)}resetState(t,e){this.state=0,this.mask=0,t==1?(this.mask=1,this.init4Inner(15,e)):t==2?(this.mask=2,this.init4Inner(e,this.getLastInner())):e==1?(this.mask=1,this.init4Inner(15,t)):e==2?(this.mask=2,this.init4Inner(t,this.getLastInner())):t>e?this.init4Inner(e,t):this.init4Inner(t,e)}getLastInner(){let t=Ze.getInstance().getAllCopperLayer(),e=null;for(let r of t)Es(r.layerId)&&r.layerId>e&&(e=r.layerId);return e}init4Inner(t,e){for(let r=t-15;r<=e-15;r++)this.state=this.state|1<<r}setVisible(t,e){e?t==1?this.mask=this.mask|1:t==2?this.mask=this.mask|2:this.state=this.state|1<<t-15:t==1?this.mask=this.mask&16777214:t==2?this.mask=this.mask&16777213:this.state=this.state&(16777215^1<<t-15)}isVisible(){return this.mask!=0||this.state!=0}};function Fz(o,t,e,r,i){let n=new _e;n.ext2(t).ext7(Math.max(o,e));let s=Math.max(r,i);return s>0&&n.ext7(s),n.build1()}function u2(o,t,e,r){switch(t){case 1:{if(e===o||r===o)return!0;{let i=Math.min(e,r),n=Math.max(e,r);if(i==1){if(o!=2&&o<n)return!0}else if(i==2){if(o!=1&&o>n)return!0}else if(n==1){if(o!=2&&o<i)return!0}else if(n==2){if(o!=1&&o>i)return!0}else if(o!=1&&o!=2&&o>i&&o<n)return!0}return!1}default:return!0}}function ML(o){let t,e=re.getInstance();if(o.name==="")t=e.getRadiusPhysicsByNet(o.net);else{let n=e.getDefaultBlindPhysics().getBlindViaContentByName(o.name);t=e.getRadiusPhysicsByName(n.viaSizeRule)}let r=ve(o.model.radius*2,2),i=ve(o.model.holeRadius*2,2);(r>ve(t.maxRadius*2,2)||r<ve(t.minRadius*2,2))&&(o.model.radius=t.defalutRadius),(i>ve(t.maxInner*2,2)||i<ve(t.minInner*2,2))&&(o.model.holeRadius=t.defalutInner)}var yBe={UNIT_NAME:"mm"},kP=1,r1=class{constructor(t,e){this.referenceLayer=kP;this._name=t,this._isDefault=e}get unit(){return yBe.UNIT_NAME}set unit(t){t&&(yBe.UNIT_NAME=t)}getValue(t,e){if(e==null)return t.get(this.referenceLayer);{let r=t.get(e);return r==null&&(r=t.get(this.referenceLayer)),r}}get name(){return this._name}set name(t){this._name=t}get isDefault(){return this._isDefault}set isDefault(t){this._isDefault=t}};var yb=class extends r1{},Dk=class o{constructor(t,e,r){this._minValue=t,this._defaultValue=e,this._maxValue=r}static build(t,e,r){return new o(t,e,r)}get minValue(){return this._minValue}set minValue(t){this._minValue=t}get defaultValue(){return this._defaultValue}set defaultValue(t){this._defaultValue=t}get maxValue(){return this._maxValue}set maxValue(t){this._maxValue=t}toJSON(){return{minValue:this.minValue,defaultValue:this.defaultValue,maxValue:this.maxValue}}clone(){return new o(this.minValue,this.defaultValue,this.maxValue)}};var GCt=0,ete=class o{constructor(t,e,r,i,n){this._name=t,this._startLayer=e,this._endLayer=r,this._viaSizeRule=n||"",this._used=i,this.status=new Qee(this.startLayer,this.endLayer),this.key="blind"+GCt++}static build(t,e,r,i=!1){return new o(t,e,r,i)}get name(){return this._name}set name(t){this._name=t}get startLayer(){return this._startLayer}set startLayer(t){this._startLayer=t}get endLayer(){return this._endLayer}set endLayer(t){this._endLayer=t}isContains(t){return u2(t,1,this.startLayer,this.endLayer)}get viaSizeRule(){return this._viaSizeRule}set viaSizeRule(t){this._viaSizeRule=t}get used(){return this._used}set used(t){this._used=t}clone(){return new o(this.name,this.startLayer,this.endLayer,this.used)}getMenu(){return{name:this._name,cmd:this._name,tips:""}}},kv=class o extends yb{constructor(){super(...arguments);this.blindVias=new Array;this.map=new Map}static build(e,r){return new o(e,r)}getBlindVia(e){for(let r of this.blindVias)if(r.name===e)return r;return null}addBlind(e,r,i,n){let s=new ete(e,r,i,!1,n);return this.blindVias.push(s),this.map.set(s.key,s),s}get data(){let e=new Array;for(let r of this.blindVias)e.push({name:r.name,startLayer:r.startLayer,endLayer:r.endLayer,used:r.used,key:r.key,viaSizeRule:r.viaSizeRule});return e}set data(e){let r=new Array;for(let i of e){let n=i.name,s=parseInt(i.startLayer),a=parseInt(i.endLayer),l=i.viaSizeRule;if(s==1){if(a==2||s==a)continue}else if(s==2){if(a==1||s==a)continue}else if(s==a)continue;let c=this.map.get(i.key);c==null?c=new ete(n,s,a,!1,l):(c.name=n,c.startLayer=s,c.endLayer=a,c.viaSizeRule=l),r.push(c)}this.blindVias.length=0,this.blindVias=r,this.map.clear();for(let i of r)this.map.set(i.key,i)}getBlindViaContentByName(e){for(let r of this.blindVias)if(r.name===e)return{name:r.name,staLayerId:r.startLayer,endLayerId:r.endLayer,viaSizeRule:r.viaSizeRule};return null}getAllVias(){return Array.from(this.blindVias)}getContainsLayerVias(e){let r=new Set;return this.blindVias.forEach(i=>{i.isContains(e)&&r.add(i)}),r}getFirst(){return this.blindVias.length>0?this.blindVias[0]:null}getOptions(){let e=new Array;for(let r of this.blindVias){let i={value:r.name,text:r.name,startLayerId:r.startLayer,endLayerId:r.endLayer,viaSizeRule:r.viaSizeRule};e.push(i)}return e}clone(){let e=new o(this.name,this.isDefault);return e.data=this.data,e}};var wk=class{constructor(t,e,r,i,n){this._type=t,this._connectMode=e,this._lineClearance=r,this._lineWidth=i,this._lineAngle=n}get type(){return this._type}get connectMode(){return this._connectMode}set connectMode(t){this._connectMode=t}get lineClearance(){return this._lineClearance}set lineClearance(t){this._lineClearance=t}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t}get lineAngle(){return this._lineAngle}set lineAngle(t){this._lineAngle=t}get PadConnectRule(){return{connectMode:this.connectMode,lineClearance:this.lineClearance,lineWidth:this.lineWidth,lineAngle:this.lineAngle}}set PadConnectRule(t){this.connectMode=t.connectMode,this.lineClearance=t.lineClearance,this.lineWidth=t.lineWidth,this.lineAngle=t.lineAngle}equals(t){return this._type==t._type&&this._connectMode==t._connectMode&&this._lineClearance==t._lineClearance&&this._lineWidth==t._lineWidth&&this._lineAngle==t._lineAngle}},iS=class extends r1{};iS.defUnitName="mil",iS.defPadConnectRule={connectMode:0,lineClearance:1,lineWidth:1,lineAngle:$9};var wa=class{constructor(t,e){this.tableData=t,this.layerStatus=e}hasStatus(t){return"status"in t}build(t){let e=new Map;if(this.tableData instanceof Map)for(let[r,i]of this.tableData){let n=t(i);this.layerStatus&&this.layerStatus.has(r)&&this.hasStatus(n)&&(n.status=this.layerStatus.get(r)),e.set(r,n)}else{let r=t(this.tableData);this.layerStatus&&this.layerStatus.has(kP)&&this.hasStatus(r)&&(r.status=this.layerStatus.get(kP)),e.set(kP,r)}return e}};var XTe=class{constructor(t){this._trackConnect=t}get trackConnect(){return this._trackConnect}set trackConnect(t){this._trackConnect=t}},HCt=new Map([[0,1],[1,1],[2,1]]),Lk=class Lk extends iS{constructor(e,r,i,n,s,a){super(e,r);this.layerStatus=new Map;this.layerStatus=i,this.singleLayerPadModel=this.createLayeredPadModel(n,0),this.multiLayerPadModel=this.createLayeredPadModel(s,1),this.trackConnectModel=this.createTrackConnectModel(a)}static build(e,r=!1,i=HCt,n=new wa(iS.defPadConnectRule),s=new wa(iS.defPadConnectRule),a=new wa(Lk.defTrackConnect)){return new Lk(e,r,i,n,s,a)}createLayeredPadModel(e,r){return e.build(i=>new wk(r,i.connectMode,i.lineClearance,i.lineWidth,i.lineAngle))}createTrackConnectModel(e){return e.build(r=>new XTe(r))}getTable(e,r){let i;switch(e){case 0:i=this.singleLayerPadModel;break;case 1:i=this.multiLayerPadModel;break;case 2:i=this.trackConnectModel;break}return this.getValue(i,r)}overWriteTables(e,r){switch(r){case 0:this.singleLayerPadModel=this.createLayeredPadModel(e,r);break;case 1:this.multiLayerPadModel=this.createLayeredPadModel(e,r);break;case 2:this.trackConnectModel=this.createTrackConnectModel(e);break}}getLayerStatus(e){return this.layerStatus.get(e)||0}setLayerStatus(e,r){this.layerStatus.set(e,r)}getTrackConnect(e){return this.getTable(2,e).trackConnect}setTrackConnect(e,r){this.getTable(2,r).trackConnect=e}getSingleConnectMode(e){return this.getTable(0,e).connectMode}setSingleConnectMode(e,r){this.getTable(0,r).connectMode=e}getSingleLineClearance(e){return this.getTable(0,e).lineClearance}setSingleLineClearance(e,r){this.getTable(0,r).lineClearance=e}getSingleLineWidth(e){return this.getTable(0,e).lineWidth}setSingleLineWidth(e,r){this.getTable(0,r).lineWidth=e}getSingleLineAngle(e){return this.getTable(0,e).lineAngle}setSingleLineAngle(e,r){this.getTable(0,r).lineAngle=e}getMultiConnectMode(e){return this.getTable(1,e).connectMode}setMultiConnectMode(e,r){this.getTable(1,r).connectMode=e}getMultiLineClearance(e){return this.getTable(1,e).lineClearance}setMultiLineClearance(e,r){this.getTable(1,r).lineClearance=e}getMultiLineWidth(e){return this.getTable(1,e).lineWidth}setMultiLineWidth(e,r){this.getTable(1,r).lineWidth=e}getMultiLineAngle(e){return this.getTable(1,e).lineAngle}setMultiLineAngle(e,r){this.getTable(1,r).lineAngle=e}getSinglePadConnectRule(e){let r=this.getTable(0,e);return r?{connectMode:r.connectMode,lineClearance:r.lineClearance,lineWidth:r.lineWidth,lineAngle:r.lineAngle}:void 0}setSinglePadConnectRule(e,r){let i=this.getTable(0,r);i&&(i.connectMode=e.connectMode,i.lineClearance=e.lineClearance,i.lineWidth=e.lineWidth,i.lineAngle=e.lineAngle)}getMultiPadConnectRule(e){let r=this.getTable(1,e);return r?{connectMode:r.connectMode,lineClearance:r.lineClearance,lineWidth:r.lineWidth,lineAngle:r.lineAngle}:void 0}setMultiPadConnectRule(e,r){let i=this.getTable(1,r);i&&(i.connectMode=e.connectMode,i.lineClearance=e.lineClearance,i.lineWidth=e.lineWidth,i.lineAngle=e.lineAngle)}toJSON(){let e=(r,i)=>{let n=new Map;return i.forEach((s,a)=>{r!==2?n.set(a,s.PadConnectRule):n.set(a,s.trackConnect)}),{status:this.getLayerStatus(r),tables:n}};return{singleLayerPadModel:e(0,this.singleLayerPadModel),multiLayerPadModel:e(1,this.multiLayerPadModel),trackConnectModel:e(2,this.trackConnectModel)}}clone(){let{singleLayerPadModel:e,multiLayerPadModel:r,trackConnectModel:i}=this.toJSON();return Lk.build(this.name,this.isDefault,new Map(this.layerStatus),new wa(e.tables||this.getSinglePadConnectRule()),new wa(r.tables||this.getMultiPadConnectRule()),new wa(i.tables||this.getTrackConnect()))}};Lk.defTrackConnect=0;var Bv=Lk;var WCt=new Map([[0,1],[1,1]]),d2=class o extends yb{constructor(e,r,i,n,s,a){super(e,r);this.layerStatus=new Map;this.strokeWidthTables=new Map;this.diffPairSpacingTables=new Map;this.layerStatus=i,this.strokeWidthTables=this.createTables(n),this.diffPairSpacingTables=this.createTables(s),this._differentialPairLenTolerMax=a}static build(e,r,i=WCt,n=new wa({minValue:.5,defaultValue:1,maxValue:10}),s=new wa({minValue:.6,defaultValue:.6,maxValue:5}),a=1){return new o(e,r,i,n,s,a)}createTables(e){return e.build(r=>new Dk(r.minValue,r.defaultValue,r.maxValue))}getTable(e,r){let i=e===0?this.strokeWidthTables:this.diffPairSpacingTables;if(r==null)return i.get(this.referenceLayer);{let n=i.get(r);return n==null&&(n=i.get(this.referenceLayer)),n}}overWriteTables(e,r){switch(e){case 0:this.strokeWidthTables=this.createTables(r);break;case 1:this.diffPairSpacingTables=this.createTables(r);break}}getLayerStatus(e){return this.layerStatus.get(e)}setLayerStatus(e,r){this.layerStatus.set(e,r)}getStrokeWidthMin(e){return this.getTable(0,e).minValue}setStrokeWidthMin(e,r){this.getTable(0,r).minValue=e}getStrokeWidthDefault(e){return this.getTable(0,e).defaultValue}setStrokeWidthDefault(e,r){this.getTable(0,r).defaultValue=e}getStrokeWidthMax(e){return this.getTable(0,e).maxValue}setStrokeWidthMax(e,r){this.getTable(0,r).maxValue=e}getDifferentialPairSpacingMin(e){return this.getTable(1,e).minValue}setDifferentialPairSpacingMin(e,r){this.getTable(1,r).minValue=e}getDifferentialPairSpacingDefault(e){return this.getTable(1,e).defaultValue}setDifferentialPairSpacingDefault(e,r){this.getTable(1,r).defaultValue=e}getDifferentialPairSpacingMax(e){return this.getTable(1,e).maxValue}setDifferentialPairSpacingMax(e,r){this.getTable(1,r).maxValue=e}get differentialPairLenTolerMax(){return this._differentialPairLenTolerMax}set differentialPairLenTolerMax(e){this._differentialPairLenTolerMax=e}getMaxClearanceFromTables(e){let r=0;for(let[,i]of this.diffPairSpacingTables){let n=e(i);n>r&&(r=n)}return r}getMaxSpacingMin(e){return e?this.getDifferentialPairSpacingMin(e):this.getMaxClearanceFromTables(r=>r.minValue)}toJSON(){let e=(r,i)=>{let n=new Map;return i.forEach((s,a)=>{n.set(a,s.toJSON())}),{status:this.getLayerStatus(r),tables:n}};return{strokeWidthTables:e(0,this.strokeWidthTables),diffPairSpacingTables:e(1,this.diffPairSpacingTables)}}clone(){let{strokeWidthTables:e,diffPairSpacingTables:r}=this.toJSON();return new o(this.name,this.isDefault,new Map(this.layerStatus),new wa(e.tables),new wa(r.tables),this.differentialPairLenTolerMax)}};var Fv=class o extends iS{constructor(e,r,i,n){super(e,r);this.layerStatus=1;this.layerStatus=i,this.multiLayerPadModel=this.createTables(n)}static build(e,r=!1,i=1,n=new wa(iS.defPadConnectRule)){return new o(e,r,i,n)}createTables(e){return e.build(r=>new wk(1,r.connectMode,r.lineClearance,r.lineWidth,r.lineAngle))}getTable(e){var r;return(r=this.multiLayerPadModel.get(e))!=null?r:this.multiLayerPadModel.get(this.referenceLayer)}overWriteTables(e){this.multiLayerPadModel=this.createTables(e)}getLayerStatus(){return this.layerStatus}setLayerStatus(e){this.layerStatus=e}getMultiConnectMode(e){return this.getTable(e).connectMode}setMultiConnectMode(e,r){this.getTable(r).connectMode=e}getMultiLineClearance(e){return this.getTable(e).lineClearance}setMultiLineClearance(e,r){this.getTable(r).lineClearance=e}getMultiLineWidth(e){return this.getTable(e).lineWidth}setMultiLineWidth(e,r){this.getTable(r).lineWidth=e}getMultiLineAngle(e){return this.getTable(e).lineAngle}setMultiLineAngle(e,r){this.getTable(r).lineAngle=e}getMultiPadConnectRule(e){let r=this.getTable(e);return r?{connectMode:r.connectMode,lineClearance:r.lineClearance,lineWidth:r.lineWidth,lineAngle:r.lineAngle}:void 0}setMultiPadConnectRule(e,r){let i=this.getTable(r);i&&(i.connectMode=e.connectMode,i.lineClearance=e.lineClearance,i.lineWidth=e.lineWidth,i.lineAngle=e.lineAngle)}toJSON(){let e=new Map;return this.multiLayerPadModel.forEach((r,i)=>{e.set(i,r.PadConnectRule)}),{status:this.layerStatus,tables:e}}clone(){let e=this.toJSON().tables;return o.build(this.name,this.isDefault,this.layerStatus,new wa(e||this.getMultiPadConnectRule()))}};var bb=class o extends mb{constructor(e,r=null,i=null,n="default"){super(e);this._positiveNet=null;this._negativeNet=null;this._differentialPhysics=null;this._positiveNet=r,this._negativeNet=i,this._differentialPhysics=n}hasNet(e){return this._positiveNet!=null&&this._positiveNet==e||this._negativeNet!=null&&this._negativeNet==e}get positiveNet(){return re.getInstance().getNet(this._positiveNet)}set positiveNet(e){this._positiveNet=e==null?void 0:e.name}get negativeNet(){return re.getInstance().getNet(this._negativeNet)}set negativeNet(e){this._negativeNet=e==null?void 0:e.name}get differentialPhysics(){return this._differentialPhysics}set differentialPhysics(e){this._differentialPhysics=e}getNets(){return[this._positiveNet,this._negativeNet]}addNetDifferential(e){e.netDifferential=this}removeNetDifferential(e){this._positiveNet==e&&this.positiveNet!=null&&(this.positiveNet.netDifferential=null,this.positiveNet=null),this._negativeNet==e&&this.negativeNet!=null&&(this.negativeNet.netDifferential=null,this.negativeNet=null)}getAllNets(){let e=new Array;return this.positiveNet!=null&&e.push(this.positiveNet),this.negativeNet!=null&&e.push(this.negativeNet),e}remove(){this.removeNetDifferential(this._positiveNet),this.removeNetDifferential(this._negativeNet)}fillPositiveNet(e){this._positiveNet=e==null?void 0:e.name,this.addNetDifferential(e)}fillNegativeNet(e){this._negativeNet=e==null?void 0:e.name,this.addNetDifferential(e)}clone(){return new o(this._name,this._positiveNet,this._negativeNet,this._differentialPhysics)}toJSON(){return{name:this._name,positiveNet:this._positiveNet,negativeNet:this._negativeNet,differentialPhysics:this._differentialPhysics}}};var Vv=class o extends yb{constructor(t,e,r,i){super(t,e),this._netLengthMin=r,this._netLengthMax=i}static build(t,e,r,i){return new o(t,e,r,i)}get netLengthMin(){return this._netLengthMin}set netLengthMin(t){this._netLengthMin=t}get netLengthMax(){return this._netLengthMax}set netLengthMax(t){this._netLengthMax=t}clone(){return new o(this.name,this.isDefault,this.netLengthMin,this.netLengthMax)}};var Gv=class o extends yb{constructor(t,e,r,i){super(t,e),this._netLengthTolerance=r,this._targetNet=i}static build(t,e,r,i){return new o(t,e,r,i)}get netLengthTolerance(){return this._netLengthTolerance}set netLengthTolerance(t){this._netLengthTolerance=t}get targetNet(){return this._targetNet}set targetNet(t){this._targetNet=t}clone(){return new o(this.name,this.isDefault,this.netLengthTolerance,this.targetNet)}};var Uv=class extends r1{};function Vz(o,t){return t=t||wO,gn(o,t.decimalPlacesShow,t.fixedDecimal)}function Xu(o,t){return t=t&&typeof t.decimalPlaces=="number"?t:wO,gn(o,t.decimalPlaces)}function $Te(...o){var t=0,e=o.length,r,i=!1;if(e<1)return{};for(typeof o[0]=="boolean"?(i=o[0],r=o[1],t=1):typeof o[e-1]=="boolean"?(i=o[e-1],r=o[0],e--):r=o[0],(!r||typeof r!="object"&&typeof r!="function")&&(r={});t<e;t++){var n=o[t];if(n&&typeof n=="object"){if(n==r)continue;for(var s in n)Y0(n,s)&&(i&&n[s]&&typeof n[s]=="object"?r[s]=$Te({},n[s]):r[s]=n[s])}}return r}function Hv(o=[],t,e){if(!o||!o.length||!t)return{index:-1,data:null};let r={index:-1,data:null};for(let i=0;i<o.length;i++)if(typeof o[i]=="object"&&o[i][t]===e){r.data=o[i],r.index=i;break}return r}function Gz(o){return/^(pixel|mil|mm|inch)$/i.test(o)}function na(o,t,e){if(t==e)return o*1;if(typeof o=="string"){if(!isNaN(+o))return+o;arguments.length==2&&(e=t,t=o.replace(/^[-+.\d\s]+/,""),o=o.replace(/[^-+.\d\s]+$/,"")),o=+o}if(typeof o!="number"||!isFinite(o))throw Error("Invalid value for unit convert");if(t=t.toLowerCase(),e=e.toLowerCase(),t=="cm"?(t="mm",o*=10):t=="px"&&(t="pixel"),e=="cm"?(e="mm",o*=.1):e=="px"&&(e="pixel"),t==e)return o*1;if(!Gz(t)||!Gz(e))throw Error("Not supported unit convert "+t+" to "+e);switch(t+"2"+e){case"mil2pixel":return o*.1;case"mil2mm":return o*.0254;case"mil2inch":return o*.001;case"mm2pixel":return o/.254;case"mm2mil":return o/.0254;case"mm2inch":return o/25.4;case"pixel2mil":return o*10;case"pixel2mm":return o*.254;case"pixel2inch":return o*.01;case"inch2pixel":return o*100;case"inch2mil":return o*1e3;case"inch2mm":return o*25.4;default:break}throw Error("Not supported unit convert "+t+" to "+e)}function aa(o,t,e){let r=e||t,i;!isNaN(+o)&&e==null?i=na(o,"mil",t)*10:i=na(o,t,e);let n=r=="mil"?1:3;return Vz(i,{decimalPlacesShow:n})+r}function KTe(o,t,e){let r=e||t,i;!isNaN(+o)&&e==null?i=na(o,"mil",t)*10:i=na(o,t,e);let n=r=="mil"?1:3;return Vz(i,{decimalPlacesShow:n})}var p2=class o extends Uv{constructor(t,e=!1,r,i,n){super(t,e),this._device2Device=r,this._thru2SMD=i,this._hole2Hole=n}static build(t,e=!1){return new o(t,e,0,0,na(.3,"mm","mil")/10)}get clearances(){return[this._device2Device,this._thru2SMD,this._hole2Hole]}set clearances(t){this._device2Device=t[0],this._thru2SMD=t[1],this._hole2Hole=t[2]}get deviceClearance(){return this._device2Device}get thru2SmdClearance(){return this._thru2SMD>=0?this._thru2SMD:0}get holeClearance(){return this._hole2Hole>=0?this._hole2Hole:.69}clone(){return new o(this.name,this.isDefault,this._device2Device,this._thru2SMD,this._hole2Hole)}};var Wv=class extends r1{};var zv=class o extends Wv{constructor(t,e=!1,r=0,i=0,n=-100,s=-100){super(t,e),this._padTopExpansion=r,this._padBottomExpansion=i,this._testPointTopExpansion=n,this._testPointBottomExpansion=s}static build(t,e=!1,r=0,i=0,n=-100,s=-100){return new o(t,e,r,i,n,s)}get padTopExpansion(){return this._padTopExpansion}set padTopExpansion(t){this._padTopExpansion=t}get padBottomExpansion(){return this._padBottomExpansion}set padBottomExpansion(t){this._padBottomExpansion=t}get testPointTopExpansion(){return this._testPointTopExpansion}set testPointTopExpansion(t){this._testPointTopExpansion=t}get testPointBottomExpansion(){return this._testPointBottomExpansion}set testPointBottomExpansion(t){this._testPointBottomExpansion=t}clone(){return new o(this.name,this.isDefault,this.padTopExpansion,this.padBottomExpansion,this.testPointTopExpansion,this.testPointBottomExpansion)}};var Yv=class o extends yb{constructor(t,e=!1,r=RP(.025),i=RP(.0305),n=RP(.5),s=RP(.015),a=RP(.01525),l=RP(.3)){super(t,e),this._minRadius=r,this._defaultRadius=i,this._maxRadius=n,this._minInner=s,this._defaultInner=a,this._maxInner=l}static build(t,e=!1,r=RP(.025),i=RP(.0305),n=RP(.5),s=RP(.015),a=RP(.01525),l=RP(.3)){return new o(t,e,r,i,n,s,a,l)}get minRadius(){return this._minRadius}set minRadius(t){this._minRadius=t}get defalutRadius(){return this._defaultRadius}set defalutRadius(t){this._defaultRadius=t}get maxRadius(){return this._maxRadius}set maxRadius(t){this._maxRadius=t}get minInner(){return this._minInner}set minInner(t){this._minInner=t}get defalutInner(){return this._defaultInner}set defalutInner(t){this._defaultInner=t}get maxInner(){return this._maxInner}set maxInner(t){this._maxInner=t}clone(){return new o(this.name,this.isDefault,this.minRadius,this.defalutRadius,this.maxRadius,this.minInner,this.defalutInner,this.maxInner)}};var sI=class o extends mb{constructor(e,r=null,i=null){super(e);this._regionType="region";this._safeClearance=null;this._otherClearance=null;this._creepageClearance=null;this._track=null;this._diff=null;this._radius=null;this._innerPlane=null;this._copperPlane=null;this._safeCopperPlane=null;this._safeInnerPlane=null;this._innerPlane=r,this._copperPlane=i}static build(e,r="region"){let i=new o(e);return i._regionType=r,i}get regionType(){return this._regionType}get safeClearance(){return this._safeClearance}set safeClearance(e){this._safeClearance=e}get otherClearance(){return this._otherClearance}set otherClearance(e){this._otherClearance=e}get creepageClearance(){return this._creepageClearance}set creepageClearance(e){this._creepageClearance=e}get track(){return this._track}set track(e){this._track=e}get diff(){return this._diff}set diff(e){this._diff=e}get radius(){return this._radius}set radius(e){this._radius=e}get innerPlane(){return this._innerPlane}set innerPlane(e){this._innerPlane=e}get copperPlane(){return this._copperPlane}set copperPlane(e){this._copperPlane=e}get safeInnerPlane(){return this._safeInnerPlane}set safeInnerPlane(e){this._safeInnerPlane=e}get safeCopperPlane(){return this._safeCopperPlane}set safeCopperPlane(e){this._safeCopperPlane=e}toJSON(){return{safeClearance:this.safeClearance,safeCopperPlane:this.safeCopperPlane,safeInnerPlane:this.safeInnerPlane,otherClearance:this.otherClearance,creepageClearance:this.creepageClearance,track:this.track,diff:this.diff,radius:this.radius,innerPlane:this.innerPlane,copperPlane:this.copperPlane}}clone(){let e=new o(this._name,this._innerPlane,this._copperPlane);return e._regionType=this._regionType,e._safeClearance=this._safeClearance,e._otherClearance=this._otherClearance,e._creepageClearance=this._creepageClearance,e._track=this._track,e._diff=this._diff,e._radius=this._radius,e._safeCopperPlane=this._safeCopperPlane,e._safeInnerPlane=this._safeInnerPlane,e}};var zCt=[.6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,.6,.6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,.6,.6,.6,-1,-1,-1,-1,-1,-1,-1,-1,-1,.6,.6,.6,.6,-1,-1,-1,-1,-1,-1,-1,-1,.6,.6,.6,.6,.6,-1,-1,-1,-1,-1,-1,-1,.6,.6,.6,.6,.6,.6,-1,-1,-1,-1,-1,-1,.6,.6,.6,.6,.6,.6,.6,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,-1,-1,-1,-1,1.18,.6,.6,.6,.6,.6,.6,1,.6,-1,-1,-1,.6,.6,.6,.6,.6,.6,.6,1,1.18,.6,-1,-1,.6,.6,.6,.6,.6,.6,.6,1,.6,.6,.6,-1,1.18,1.18,1.18,1.18,1.18,1.18,1.18,1,1.18,1.18,1.18,-1,.6929,.6929,.6929,.6929,.6929,.6929,.6929,1,.6929,.6929,.6929,.6929],YCt=[0,1,2,3,4,5,6,7,8,9,10,11],Wz=[0,1,2,3,4,5,6,7,8,9,10,11,12],Uz=13,ZTe=12,jCt=12,XCt=YCt,qCt=Wz,Hz=class o{constructor(t=zCt){this.status=1;this._data=Array.from(t)}getPosition(t,e){return t*jCt+e}get data(){let t=new Array;for(let e=0;e<Uz;e++){let r=new Array;for(let i=0;i<ZTe&&i<=e;i++)e>=11&&i>=e||r.push(this._data[this.getPosition(e,i)]);t.push(r)}return t}setData(t){this._data=Array.from(t)}modifyClearance(t,e,r){this._data[this.getPosition(t,e)]=Math.abs(r)}modifyAllClearance(t){for(let e=0;e<Uz;e++)for(let r=0;r<ZTe&&r<=e;r++)e>=11&&r>=e||this.modifyClearance(e,r,t(e,r))}getClearance(t,e){return t>=e?this._data[this.getPosition(t,e)]||0:this._data[this.getPosition(e,t)]||0}getMaxClearance(){let t=0;for(let e=0;e<Uz;e++)for(let r=0;r<ZTe&&r<=e;r++){let i=this._data[this.getPosition(e,r)];i>t&&(t=i)}return t}getItemMaxClearance(t,e){let r=0;for(let i=0;i<Uz;i++){if(e&&!e.includes(i))continue;let n=this.getClearance(i,t);r=Math.max(r,n)}return r}getItemsMaxClearance(t,e){let r=0;for(let i=0;i<Uz;i++)e&&!e.includes(i)||t.forEach(n=>{let s=this.getClearance(i,n);r=Math.max(r,s)});return r}clone(){let t=Array.from(this._data);return new o(t)}},bBe=new Set([8,11,12]),aI=class o extends Uv{constructor(e,r,i,n){super(e,r);this.tables=new Map;this._status=i,this.overWriteTables(n)}static build(e,r=!1,i=0,n){return new o(e,r,i,n)}overWriteTables(e){e?e.build(i=>{let n=new Hz;return n.modifyAllClearance((s,a)=>i[s][a]),n}).forEach((i,n)=>{this.tables.set(n,i)}):this.tables.set(this.referenceLayer,new Hz)}get status(){return this._status}set status(e){this._status=e}getLabel(e){switch(e){case 0:return"Track";case 1:return"SMD Pad";case 2:return"TH Pad";case 3:return"SMD Test Point";case 4:return"TH Test Point";case 5:return"Via";case 6:return"Fill Region/Teardrop";case 7:return"Copper/Plane Zone";case 8:return"Slot Region";case 9:return"Line";case 10:return"Text/Image";case 11:return"Board Outline";case 12:return"Hole";default:return}}getRowLabel(){let e=new Array;for(let r of XCt){let i=this.getLabel(r);i!=null&&e.push(i)}return e}getColLabel(){let e=new Array;for(let r of qCt){let i=this.getLabel(r);i!=null&&e.push(i)}return e}getTable(e){return this.status==1?this.getValue(this.tables,e):this.tables.get(this.referenceLayer)}addTable(e,r,i=(n,s,a)=>n[s][a]/10){let n=(a,l)=>i(e,a,l),s=new Hz;return s.modifyAllClearance(n),this.tables.set(r,s)}deleteTable(e){return this.tables.delete(e)}getData(e){return this.getTable(e).data}setData(e,r){this.getTable(r).setData(e)}getLayerStatus(e){return this.getTable(e).status}setLayerStatus(e,r){this.getTable(e).status=r}getAllLayerStates(){let e=new Map;return this.tables.forEach((r,i)=>{e.set(i,r.status)}),e}getClearance(e,r,i=this.referenceLayer){return bBe.has(e)&&bBe.has(r)?this.getMaxClearanceFromTables(s=>s.getClearance(e,r)):(e=[13,14].includes(e)?7:e,r=[13,14].includes(r)?7:r,this.getTable(i).getClearance(e,r))}modifyClearance(e,r,i,n){this.getTable(n).modifyClearance(e,r,i)}modifyAllClearance(e,r){this.getTable(r).modifyAllClearance(e)}getMaxClearanceFromTables(e){let r=0;for(let[,i]of this.tables){let n=e(i);n>r&&(r=n)}return r}getMaxClearance(e){return e?this.getTable(e).getMaxClearance():this.getMaxClearanceFromTables(r=>r.getMaxClearance())}getItemMaxClearance(e,r,i){return i?this.getTable(i).getItemMaxClearance(e,r):this.getMaxClearanceFromTables(n=>n.getItemMaxClearance(e,r))}getItemsMaxClearance(e,r,i){return i?this.getTable(i).getItemsMaxClearance(e,r):this.getMaxClearanceFromTables(n=>n.getItemsMaxClearance(e,r))}toJSON(){let e=new Map;if(this.status===0){let r=this.getTable(this.referenceLayer);e.set(this.referenceLayer,{layerState:r.status,table:r.data})}else this.tables.forEach((r,i)=>{e.set(i,{layerState:r.status,table:r.data})});return e}clone(){let e=new Map;this.tables.forEach((i,n)=>{e.set(n,i.clone().data)});let r=new wa(e,this.getAllLayerStates());return new o(this.name,this.isDefault,this.status,r)}};var jv=class o extends Wv{constructor(t,e=!1,r=.2,i=.2,n=.2,s=.2,a=-100,l=-100){super(t,e),this._padTopExpansion=r,this._padBottomExpansion=i,this._testPointTopExpansion=n,this._testPointBottomExpansion=s,this._viaTopExpansion=a,this._viaBottomExpansion=l}static build(t,e=!1,r=.2,i=.2,n=.2,s=.2,a=-100,l=-100){return new o(t,e,r,i,n,s,a,l)}get padTopExpansion(){return this._padTopExpansion}set padTopExpansion(t){this._padTopExpansion=t}get padBottomExpansion(){return this._padBottomExpansion}set padBottomExpansion(t){this._padBottomExpansion=t}get testPointTopExpansion(){return this._testPointTopExpansion}set testPointTopExpansion(t){this._testPointTopExpansion=t}get testPointBottomExpansion(){return this._testPointBottomExpansion}set testPointBottomExpansion(t){this._testPointBottomExpansion=t}get viaTopExpansion(){return this._viaTopExpansion}set viaTopExpansion(t){this._viaTopExpansion=t}get viaBottomExpansion(){return this._viaBottomExpansion}set viaBottomExpansion(t){this._viaBottomExpansion=t}clone(){return new o(this.name,this.isDefault,this.padTopExpansion,this.padBottomExpansion,this.testPointTopExpansion,this.testPointBottomExpansion,this.viaTopExpansion,this.viaBottomExpansion)}};var Xv=class o extends yb{constructor(e,r,i,n){super(e,r);this.tables=new Map;this.layerStatus=1;this.layerStatus=i,this.tables=this.createTables(n)}static build(e,r=!1,i=1,n=new wa({minValue:.5,defaultValue:1,maxValue:10})){return new o(e,r,i,n)}createTables(e){return e.build(r=>new Dk(r.minValue,r.defaultValue,r.maxValue))}getTable(e){return this.getValue(this.tables,e)}getAllLayerCodes(){return Array.from(this.tables.keys())}overWriteTables(e){this.tables=this.createTables(e)}getLayerStatus(){return this.layerStatus}setLayerStatus(e){this.layerStatus=e}getMinWidth(e){return this.getTable(e).minValue}setMinWidth(e,r){this.getTable(r).minValue=e}getDefaultWidth(e){return this.getTable(e).defaultValue}setDefaultWidth(e,r){this.getTable(r).defaultValue=e}getMaxWidth(e){return this.getTable(e).maxValue}setMaxWidth(e,r){this.getTable(r).maxValue=e}toJSON(){let e=new Map;return this.tables.forEach((r,i)=>{e.set(i,r.toJSON())}),e}iterateTable(e){for(let[r,i]of this.tables)if(e(i,r))return!0;return!1}clone(){let e=this.toJSON();return new o(this.name,this.isDefault,this.layerStatus,new wa(e))}};var PBe={routingRange:0,routingCorner:0,isKeep:!0,viaQuatity:0,routingEffectPriority:1,routingNetPriority:0,layers:[1,2,12],ignoreNets:[]};var qv=class o extends r1{constructor(t,e,r,i,n,s,a,l,c=!1){super(t,c),this.layers=e,this.ignoreNets=r,this._routingCorner=i,this._isKeep=n,this._viaQuatity=s,this._routingEffectPriority=a,this._routingNetPriority=l}static build(t,e,r,i,n,s,a,l,c=!1){return new o(t,e,r,i,n,s,a,l,c)}get routingCorner(){return this._routingCorner}set routingCorner(t){this._routingCorner=t}get isKeep(){return this._isKeep}set isKeep(t){this._isKeep=t}get viaQuatity(){return this._viaQuatity}set viaQuatity(t){this._viaQuatity=t}get routingEffectPriority(){return this._routingEffectPriority}set routingEffectPriority(t){this._routingEffectPriority=t}get routingNetPriority(){return this._routingNetPriority}set routingNetPriority(t){this._routingNetPriority=t}get config(){return{routingRange:0,layers:this.layers,ignoreNets:this.ignoreNets,routingCorner:this.routingCorner,isKeep:this.isKeep,viaQuatity:this.viaQuatity,routingEffectPriority:this.routingEffectPriority,routingNetPriority:this.routingNetPriority}}updateConfig(t){Object.assign(this,t)}clone(){return new o(this.name,Array.from(this.layers),Array.from(this.ignoreNets),this.routingCorner,this.isKeep,this.viaQuatity,this.routingEffectPriority,this.routingNetPriority,this.isDefault)}};var Em=class o{constructor(t,e){this._pad1=t,this._pad2=e}static createPadItemJSON(t,e,r,i,n=""){return{id:i||"",isDissociate:t,designator:e,number:r,nets:[],belongDeiviceId:n}}static createPadItemShowTitle(t){return t.isDissociate?t.text:t.designator?`${t.designator}:${t.number}`:t.belongDeiviceId?`${t.belongDeiviceId}:${t.number}`:t.text}get pad1Title(){return this._pad1}get pad2Title(){return this._pad2}get parent(){return this._parent}get pad1(){return this.createPadItemJSON(this._pad1)}get pad2(){return this.createPadItemJSON(this._pad2)}createPadItemJSON(t){if(t==null)return null;let e="",r="",i=!0,n="";return t.indexOf(":")>=0?(e=t.split(":")[0],r=t.split(":")[1],i=!1):n=t,o.createPadItemJSON(i,e,r,n)}set parent(t){this._parent=t}toJSON(){return{pad1:this.pad1,pad2:this.pad2}}clone(){return new o(this._pad1,this._pad2)}};var lI=class o extends mb{constructor(t,e=[],r=t+nr()){super(t),this._number=r,this._details=e,this.details.forEach(i=>{i.parent=this})}static build(t){return new o(t)}get groupName(){return this._name}set groupName(t){this._name=t}get details(){return this._details}set details(t){this._details=t}get groupColor(){return this._groupColor}set groupColor(t){this._groupColor=t}get number(){return this._number}set number(t){this._number=t}deletePadsPairGroupDetailItemByPairName(t,e="-"){let r=-1;for(let i=0;i<this.details.length;i++){let n=Em.createPadItemShowTitle(this.details[i].pad1),s=Em.createPadItemShowTitle(this.details[i].pad2);if(`${n}${e}${s}`===t){r=i;break}}if(r<=-1)return!1;this.details.splice(r,1)}updatePadsPairGroupDetails(t){return this.details=t,this.details.forEach(e=>{e.parent=this}),this.details}toJSON_ofDeatails(){let t=[];return this.details.forEach(e=>{t.push({pad1:e.toJSON().pad1,pad2:e.toJSON().pad2})}),t}clone(){let t=this._details.length,e=new Array(this._details.length);for(let r=0;r<t;r++)e[r]=this._details[r].clone();return new o(this.groupName,e,this._number)}};function $v(o,t,e=!1){return o===13||t===13?13:o===14||t===14?14:e?t:o}var zz=class zz{constructor(){this._operation="Default"}static getInstance(){return zz._context}set(t){this._operation=t}get(){return this._operation}};zz._context=new zz;var sy=zz;var Yz=class Yz{constructor(){this.strategys=new Array}static getInstance(){return Yz.dispatcher}subscript(t){this.strategys.push(t)}dispatcher(t){for(let e of this.strategys)e.supports(t)&&e.execute(t)}};Yz.dispatcher=new Yz;var Nk=Yz;var jz=class jz{static getInstance(){return jz._pub}constructor(){}publish(t,e){Nk.getInstance().dispatcher({data:e,action:t,operation:sy.getInstance().get()})}};jz._pub=new jz;var Pp=jz;var cI=class o extends Uv{constructor(t,e,r,i){super(t,e),this._creepageDistance=r,this._ignoreLayer=i}static build(t,e){return new o(t,e,na(0,"mm","mil")/10,!0)}get creepageDistance(){return this._creepageDistance>=0?this._creepageDistance:0}set creepageDistance(t){this._creepageDistance=t}get ignoreLayer(){return this._ignoreLayer}set ignoreLayer(t){this._ignoreLayer=t}clone(){return new o(this.name,this.isDefault,this._creepageDistance,this._ignoreLayer)}};var IBe=["BetweenNetRule","CustomPlaneRule","NetRule"],go=class go extends Ei{constructor(){super();this.safeSpacings=new Map;this.otherSpacings=new Map;this.creepageSpacings=new Map;this.trackPhysics=new Map;this.netLengthPhysics=new Map;this.netLengthTolerancePhysics=new Map;this.differentialPhysics=new Map;this.blindViaPhysics=new Map;this.radiusPhysics=new Map;this.innerPlanes=new Map;this.copperPlanes=new Map;this.solderExpansions=new Map;this.pasteExpansions=new Map;this.nets=new Map;this.netClass=new Map;this.netDifferentials=new Map;this.regionSelectors=new Map;this.autoRouters=new Map;this.equalLengthGroups=new Map;this.padsPairGroups=new Map;this.betweenNetRule=new Jee("");this.ruleTemplateName="";this.cacheNetModel=new Map;this.defaultRuleMap=new Map;this.max=null}static getInstance(){return go.manager==null&&(go.manager=new go),go.manager}correctRuleData(){let e=vc,r=go.getInstance().getAllTrackPhysics(),i=n=>{n.minValue=Math.max(n.minValue,e),n.maxValue=Math.max(n.maxValue,e),n.defaultValue=Math.max(n.defaultValue,n.minValue),n.defaultValue=Math.min(n.defaultValue,n.maxValue)};for(let n of r){let s=n.toJSON();for(let[,a]of s)i(a)}}correctDefault(){let e=(I,C)=>{if(!I||!I.size)return;let E=Array.from(I),O=E.filter(_=>_==null?void 0:_.isDefault);if(O.length>1){O.slice(1).forEach(_=>{_.isDefault=!1});return}O.length===0&&(E[0].isDefault=!0)},r="Common";if(go.getInstance().getDefaultSafeSpacing()==null){let I=go.getInstance().getAllSafeSpacing();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=go.getInstance().addSafeSpacing("safeClearance");C.isDefault=!0}}if(go.getInstance().getDefaultOtherSpacing()==null){let I=go.getInstance().getAllOtherSpacing();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=go.getInstance().addOtherSpacing("otherClearance");C.isDefault=!0}}if(go.getInstance().getDefaultCreepageSpacing()==null){let I=go.getInstance().getAllCreepageSpacing();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=go.getInstance().addCreepageSpacing("creepage");C.isDefault=!0}}if(go.getInstance().getDefaultTrackPhysics()==null){let I=go.getInstance().getAllTrackPhysics();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=go.getInstance().addTrackPhysics("trackWidth");C.isDefault=!0}}if(go.getInstance().getDefaultNetLengthPhysics()==null){let I=go.getInstance().getAllNetLengthPhysics();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=go.getInstance().addNetLengthPhysics("netLength");C.isDefault=!0}}if(go.getInstance().getDefaultNetLengthTolerancePhysics()==null){let I=go.getInstance().getAllNetLengthTolerancePhysics();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=go.getInstance().addNetLengthTolerancePhysics("netLengthTolerance");C.isDefault=!0}}if(go.getInstance().getDefaultDifferentialPhysics()==null){let I=go.getInstance().getAllDifferentialPhysics();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=go.getInstance().addDifferentialPhysics("differentialPair");C.isDefault=!0}}if(go.getInstance().getDefaultBlindPhysics()==null){let I=go.getInstance().getAllBlindPhysics();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=go.getInstance().addBlindPhysics("blindVia");C.isDefault=!0}}if(go.getInstance().getDefaultRadiusPhysics()==null){let I=go.getInstance().getAllRadiusPhysics();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=go.getInstance().addRadiusPhysics("viaSize");C.isDefault=!0}}let p=go.getInstance().getDefaultInnerPlane();if(p==null){let I=go.getInstance().getAllInnerPlane();if(I.size>0)for(let C of I){C.isDefault=!0;break}else p=go.getInstance().addInnerPlane("innerPlane"),p.isDefault=!0}let m=go.getInstance().getDefaultCopperPlane();if(m==null){let I=go.getInstance().getAllCopperPlane();if(I.size>0)for(let C of I){C.isDefault=!0;break}else m=go.getInstance().addCopperPlane("copperRegion"),m.isDefault=!0}if(go.getInstance().getDefaultSolderExpansion()==null){let I=go.getInstance().getAllSolderExpansion();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=go.getInstance().addSolderExpansion("solderMaskExpansion");C.isDefault=!0}}if(go.getInstance().getDefaultPasteExpansion()==null){let I=go.getInstance().getAllPasteExpansion();if(I.size>0)for(let C of I){C.isDefault=!0;break}else{let C=go.getInstance().addPasteExpansion("pasteMaskExpansion");C.isDefault=!0}}e(go.getInstance().getAllSafeSpacing(),"safe"),e(go.getInstance().getAllOtherSpacing(),"other"),e(go.getInstance().getAllTrackPhysics(),"track"),e(go.getInstance().getAllNetLengthPhysics(),"netLength"),e(go.getInstance().getAllNetLengthTolerancePhysics(),"netLengthTolerance"),e(go.getInstance().getAllDifferentialPhysics(),"differential"),e(go.getInstance().getAllBlindPhysics(),"blind"),e(go.getInstance().getAllRadiusPhysics(),"radius"),e(go.getInstance().getAllInnerPlane(),"inner"),e(go.getInstance().getAllCopperPlane(),"copper"),e(go.getInstance().getAllSolderExpansion(),"solder"),e(go.getInstance().getAllPasteExpansion(),"paste"),this.getDefaultAutoRouter()==null&&(this.addAutoRouter(r).isDefault=!0);let P=go.getInstance().getAllNetDifferentials(),T=new Array;for(let I of P)(I.negativeNet==null||I.positiveNet==null)&&T.push(I.name);go.getInstance().deleteNetDifferential(T)}correctRegion(){this.getAllRegions().forEach(r=>{r.copperPlane!=null&&(this.getCopperPlane(r.copperPlane)||this.addCopperPlane(r.copperPlane)),r.innerPlane!=null&&(this.getInnerPlane(r.innerPlane)||this.addInnerPlane(r.innerPlane))})}addAutoRouter(e,r){let i=Object.assign({},PBe,r),n=qv.build(e,i.layers,i.ignoreNets,i.routingCorner,i.isKeep,i.viaQuatity,i.routingEffectPriority,i.routingNetPriority);return this.autoRouters.set(e,n),n}addSafeSpacing(e,r,i,n){let s=aI.build(e,r,i,n);return this.safeSpacings.set(e,s),s}addOtherSpacing(e){let r=p2.build(e);return this.otherSpacings.set(e,r),r}addCreepageSpacing(e,r){let i=cI.build(e,r);return this.creepageSpacings.set(e,i),i}addTrackPhysics(e,r,i,n){let s=Xv.build(e,r,i,n);return this.trackPhysics.set(e,s),s}addDifferentialPhysics(e,r,i,n,s,a){let l=d2.build(e,r||!1,i,n,s,a);return this.differentialPhysics.set(e,l),l}addNetLengthPhysics(e,r=!1,i=0,n=0){let s=Vv.build(e,r,i,n);return this.netLengthPhysics.set(e,s),s}addNetLengthTolerancePhysics(e,r=!1,i=100,n=null){let s=Gv.build(e,r,i,n);return this.netLengthTolerancePhysics.set(e,s),s}addBlindPhysics(e){let r=kv.build(e,!1);return this.blindViaPhysics.set(e,r),r}addRadiusPhysics(e){let r=Yv.build(e);return this.radiusPhysics.set(e,r),r}addInnerPlane(e,r,i,n){let s=Fv.build(e,r,i,n);return this.innerPlanes.set(e,s),s}addCopperPlane(e,r,i,n,s,a){let l=Bv.build(e,r,i,n,s,a);return this.copperPlanes.set(e,l),l}addSolderExpansion(e){let r=jv.build(e);return this.solderExpansions.set(e,r),r}addPasteExpansion(e){let r=zv.build(e);return this.pasteExpansions.set(e,r),r}addNet(e){if(e==null)return null;e=e==null?void 0:e.toUpperCase();let r=this.nets.get(e);return r==null&&(r=new zd(e),this.nets.set(e,r),this.cacheNetModel.get(e)&&this.rebuild(this.cacheNetModel.get(e))),r}addRegionSelector(e){let r=this.regionSelectors.get(e);return r==null&&(r=sI.build(e),this.regionSelectors.set(e,r)),r}addRegionSelectorByRuleModel(e,r){this.regionSelectors.set(e,r)}addConstraintSelector(e){let r=this.regionSelectors.get(e);return r==null&&(r=sI.build(e,"constraint"),this.regionSelectors.set(e,r),r.safeClearance=null,r.otherClearance=null,r.creepageClearance=null,r.track=null,r.diff=null,r.radius=null,r.innerPlane=null,r.copperPlane=null),r}updateRegionSelector(e,r,i=!1){let n=this.getRegion(e);if(n==null||r==null){n!=null&&i&&Pp.getInstance().publish("modify",n);return}let s=[],{safeClearance:a,safeCopperPlane:l,safeInnerPlane:c,otherClearance:h,track:u,diff:d,radius:p,innerPlane:m,copperPlane:g,creepageClearance:y}=r;if(r.safeClearance!==void 0&&(!a||!this.getSafeSpacing(a)?(n.safeClearance=null,a&&s.push({type:"Safe Spacing",name:a})):n.safeClearance=a),r.safeCopperPlane!==void 0){let b=l;(b==""||!b)&&(b=null),n.safeCopperPlane=b}if(r.safeInnerPlane!==void 0){let b=c;(b==""||!b)&&(b=null),n.safeInnerPlane=b}return r.otherClearance!==void 0&&(!h||!this.getOtherSpacing(h)?(n.otherClearance=null,h&&s.push({type:"Other Spacing",name:h})):n.otherClearance=h),r.creepageClearance!==void 0&&(!y||!this.getCreepageSpacing(y)?(n.creepageClearance=null,y&&s.push({type:"Creepage Distance",name:y})):n.creepageClearance=y),r.track!==void 0&&(!u||!this.getTrackPhysics(u)?(n.track=null,u&&s.push({type:"Track",name:u})):n.track=u),r.diff!==void 0&&(!d||!this.getDifferentialPhysics(d)?(n.diff=null,d&&s.push({type:"Differential Pair",name:d})):n.diff=d),r.radius!==void 0&&(!p||!this.getRadiusPhysics(p)?(n.radius=null,p&&s.push({type:"Via Size",name:p})):n.radius=p),r.innerPlane!==void 0&&(!m||!this.getInnerPlane(m)?(n.innerPlane=null,m&&s.push({type:"Plane Zone",name:m})):n.innerPlane=m),r.copperPlane!==void 0&&(!g||!this.getCopperPlane(g)?(n.copperPlane=null,g&&s.push({type:"Copper Zone",name:g})):n.copperPlane=g),i&&Pp.getInstance().publish("modify",n),s}addNetClass(e,r){let i;return r?i=r:i=new $h(e),this.netClass.set(e,i),i}addNetDifferential(e,r,i,n){let s=new bb(e);if(this.netDifferentials.set(e,s),r){let a=this.getNet(r);a&&s.fillPositiveNet(a)}if(i){let a=this.getNet(i);a&&s.fillNegativeNet(a)}return n&&(s.differentialPhysics=n),s}addEqualLengthGroup(e,r){let i;return r?i=r:i=new dd(e),this.equalLengthGroups.set(e,i),i}getSafeSpacing(e){return this.getRule(this.safeSpacings,e)}getNetClearance(e){let r=this.getDefaultSafeSpacing();return r==null&&(this.correctDefault(),r=this.getDefaultSafeSpacing()),r.getData(e)[0][0]}getOtherSpacing(e){return this.getRule(this.otherSpacings,e)}getCreepageSpacing(e){return this.getRule(this.creepageSpacings,e)}getTrackPhysics(e){return this.getRule(this.trackPhysics,e)}getTrackWidth(e){let r=this.getDefaultTrackPhysics();return r==null&&(this.correctDefault(),r=this.getDefaultTrackPhysics()),r.getDefaultWidth(e)}getDifferentialPhysics(e){return this.getRule(this.differentialPhysics,e)}getNetLengthPhysics(e){return this.getRule(this.netLengthPhysics,e)}getNetLengthTolerancePhysics(e){return e?this.getRule(this.netLengthTolerancePhysics,e):null}getBlindPhysics(e){return this.getRule(this.blindViaPhysics,e)}getRadiusPhysics(e){return this.getRule(this.radiusPhysics,e)}getViaDiameter(){let e=this.getDefaultRadiusPhysics();return e==null&&(this.correctDefault(),e=this.getDefaultRadiusPhysics()),e.defalutRadius*2}getViaHoleD(){let e=this.getDefaultRadiusPhysics();return e==null&&(this.correctDefault(),e=this.getDefaultRadiusPhysics()),e.defalutInner*2}getInnerPlane(e){return this.getRule(this.innerPlanes,e)}getCopperPlane(e){return this.getRule(this.copperPlanes,e)}getSolderExpansion(e){return this.getRule(this.solderExpansions,e)}getPasteExpansion(e){return this.getRule(this.pasteExpansions,e)}getMaxSafe(e){if(this.max==null){let r=this.getDefaultSafeSpacing();r==null&&(this.correctDefault(),r=this.getDefaultSafeSpacing()),this.max=r.getMaxClearance(e);for(let[,i]of this.safeSpacings){let n=i.getMaxClearance(e);n>this.max&&(this.max=n)}this.max=Math.max(this.max,this.getMaxDiffPair(e))}return this.max}getMaxSafeTrack(e){let r=0,i=this.getDefaultSafeSpacing();i==null&&(this.correctDefault(),i=this.getDefaultSafeSpacing()),r=i.getItemMaxClearance(0,void 0,e);for(let[,n]of this.safeSpacings){let s=n.getItemMaxClearance(0,void 0,e);s>r&&(r=s)}return r=Math.max(r,this.getMaxDiffPair(e)),r}getMaxDiffPair(e){let r=0;for(let[,i]of this.differentialPhysics)r=Math.max(i.getMaxSpacingMin(e),r);return r}getItemMaxClearance(e,r){switch(e){case 12:{let n=0;for(let[,s]of this.otherSpacings)n=Math.max(n,s.holeClearance);for(let[,s]of this.safeSpacings){let a=s.getItemMaxClearance(e);n=Math.max(n,a)}return n}case 16:{let n=0;for(let[,s]of this.otherSpacings)n=Math.max(n,s.deviceClearance,s.thru2SmdClearance);return n}case 15:return 0;case 0:{let n=0;for(let[,s]of this.safeSpacings){let a=s.getItemMaxClearance(e,void 0,r);n=Math.max(n,a)}return n}case 13:case 14:case 7:{let n=0;for(let[,s]of this.safeSpacings){let a=s.getItemMaxClearance(7,void 0,r);n=Math.max(n,a)}return n}default:let i=0;for(let[,n]of this.safeSpacings){let s=n.getItemMaxClearance(e,void 0,r);i=Math.max(i,s)}return i}}getModelPairMaxClearance(e,r,i,n){let s=0,a=u=>{s=Math.max(s,u)},l=u=>u===2||u===4||u===5,c=r===16&&i===16,h=r===2&&i===16||r===16&&i===2;if(c||h)for(let[,u]of this.otherSpacings)c?a(u.deviceClearance):h&&a(u.thru2SmdClearance);else{let u=l(r),d=l(i),p=Array.from(new Set([r,u?12:r])),m=Array.from(new Set([i,d?12:i]));if(u||d||r==8||i==8){for(let y of e.safeSpacing){let b=y.getItemsMaxClearance(p,m,n);a(b)}if(u&&d)for(let[,y]of this.otherSpacings)a(y.holeClearance)}else{for(let y of e.safeSpacing){let b=y.getItemMaxClearance(r,[i],n);a(b)}if(r===0&&i===0)for(let y of e.diffPair){let b=y.getDifferentialPairSpacingMin(n);a(b)}}}return s}getNet(e){return this.getRuleSelector(this.nets,e)}getSpecctraNetClass(e=1){let r=[];for(let[i,n]of this.nets)r.push({net:i,width:this.getTrackPhysics(n.trackPhysics).getDefaultWidth(e),clearance:this.getSafeSpacing(n.safeSpacing).getData(e)[0][0],viaHoleD:this.getRadiusPhysics(n.radiusPhysics).defalutInner*2,viaHoleDiameter:this.getRadiusPhysics(n.radiusPhysics).defalutRadius*2});return r}getNetClass(e){return this.netClass.get(e)}getNetDifferential(e){return this.netDifferentials.get(e)}getRegion(e){return this.regionSelectors.get(e)}getAutoRouter(e){return this.autoRouters.get(e)}getEqualLengthGroup(e){return this.equalLengthGroups.get(e)}deleteSafeSpacing(e){this._last=this.safeSpacings.get(e),this._last!=null&&(this.safeSpacings.delete(e),this.defaultRuleMap.clear())}deleteOtherSpacing(e){this._last=this.otherSpacings.get(e),this._last!=null&&this.otherSpacings.delete(e)}deleteCreepageSpacing(e){this._last=this.creepageSpacings.get(e),this._last!=null&&this.creepageSpacings.delete(e)}deleteTrackPhysics(e){this._last=this.trackPhysics.get(e),this._last!=null&&this.trackPhysics.delete(e)}deleteDifferentialPhysics(e){this._last=this.differentialPhysics.get(e),this._last!=null&&this.differentialPhysics.delete(e)}deleteNetLengthPhysics(e){this._last=this.netLengthPhysics.get(e),this._last!=null&&this.netLengthPhysics.delete(e)}deleteNetLengthTolerancePhysics(e){this._last=this.netLengthTolerancePhysics.get(e),this._last!=null&&this.netLengthTolerancePhysics.delete(e)}deleteBlindPhysics(e){this._last=this.blindViaPhysics.get(e),this._last!=null&&this.blindViaPhysics.delete(e)}deleteRadiusPhysics(e){this._last=this.radiusPhysics.get(e),this._last!=null&&this.radiusPhysics.delete(e)}deleteInnerPlane(e){this._last=this.innerPlanes.get(e),this._last!=null&&this.innerPlanes.delete(e)}deleteCopperPlane(e){if(this._last=this.copperPlanes.get(e),this._last!=null){for(let[,r]of this.nets)r.copperPlane==this._last.name&&(r.copperPlane="default");for(let r of this.getAllCopperPlaneRegions())r.copperPlane==this._last.name&&(r.copperPlane="default");this.copperPlanes.delete(e)}}deleteSolderExpansion(e){this._last=this.solderExpansions.get(e),this._last!=null&&this.solderExpansions.delete(e)}deletePasteExpansion(e){this._last=this.pasteExpansions.get(e),this._last!=null&&this.pasteExpansions.delete(e)}deleteAutoRouter(e){this._last=this.autoRouters.get(e),this._last!=null&&this.autoRouters.delete(e)}deleteNet(e,r=!0){let i=this.nets.get(e);if(i==null)return;let n=i.netDifferential,s=i.netClass,a=i.equalLengthGroup;if(r){let l={name:i.name,safeSpacing:i.safeSpacing,trackPhysics:i.trackPhysics,differentailPhysics:i.differentialPhysics,netLengthPhysics:i.netLengthPhysics,netLengthTolerancePhysics:i.netLengthTolerancePhysics,blindViaPhysics:i.blindViaPhysics,radiusPhysics:i.radiusPhysics,innerPlane:i.innerPlane,copperPlane:i.copperPlane,solderExpansion:i.solderExpansion,pasteExpansion:i.pasteExpansion,showRatline:i.showRatline,color:i.color,creepageSpacing:i.creepageSpacing};this.cacheNetModel.set(e,l),n!=null&&(this.cacheNetModel.get(e).netDifferentail={name:n.name,positiveNet:n.positiveNet.name,negativeNet:n.negativeNet.name,differentailPhysics:n.differentialPhysics},n.remove(),this.netDifferentials.delete(n.name)),s!=null&&(this.cacheNetModel.get(e).netClass={name:s.name,safeSpacing:s.safeSpacing,trackPhysics:s.trackPhysics,differentialPhysics:s.differentialPhysics,netLengthPhysics:s.netLengthPhysics,netLengthTolerancePhysics:s.netLengthTolerancePhysics,blindViaPhysics:s.blindViaPhysics,radiusPhysics:s.radiusPhysics,innerPlane:s.innerPlane,copperPlane:s.copperPlane,solderExpansion:s.solderExpansion,pasteExpansion:s.pasteExpansion,creepageSpacing:s.creepageSpacing,nets:new Set(s.getNets())}),a!=null&&(this.cacheNetModel.get(e).equalLengthGroup={name:a.name,netLengthPhysics:a.netLengthPhysics,netLengthTolerancePhysics:i.netLengthTolerancePhysics,targetNet:i.equalLengthGroup.targetNet,nets:new Set(i.equalLengthGroup.getNets())})}for(let l of this.betweenNetRule.rule)if(l.net1===i||l.net2===i){R.getInstance().compiler.deleteRuleSelector([this.getRuleSelect(l.net1),this.getRuleSelect(l.net2)]);break}this.betweenNetRule.deltetRule4Net(i),i!=null&&i.remove(),this.nets.delete(e),R.getInstance().compiler.deleteRuleSelector(["NET",e]),r&&(s&&s.getAllNets().length==0&&this.deleteNetClass(s.name),a&&a.getAllNets().length==0&&this.deleteEqualLengthGroup(a.name))}rebuild(e){if(this.nets.get(e.name)){let{name:r,safeSpacing:i,trackPhysics:n,differentialPhysics:s,netLengthPhysics:a,netLengthTolerancePhysics:l,blindViaPhysics:c,radiusPhysics:h,innerPlane:u,copperPlane:d,solderExpansion:p,pasteExpansion:m,netClassName:g,equalLengthGroupName:y,netDifferentialName:b,showRatline:P,color:T,creepageSpacing:I}=e,C=new zd(r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I);if(this.betweenNetRule.rebuild(C),this.nets.set(r,C),e.netDifferentail){let{name:E,positiveNet:O,negativeNet:_,differentailPhysics:x}=e.netDifferentail;if(!this.getNet(O)){let v=new zd(O);this.nets.set(O,v)}if(!this.getNet(_)){let v=new zd(_);this.nets.set(_,v)}this.addNetDifferential(E,O,_,x)}if(e.netClass){let{name:E,safeSpacing:O,trackPhysics:_,differentailPhysics:x,netLengthTolerancePhysics:v,netLengthPhysics:D,blindViaPhysics:w,radiusPhysics:F,innerPlane:H,copperPlane:z,solderExpansion:V,pasteExpansion:W,nets:L,creepageSpacing:k}=e.netClass,N=new $h(E,O,_,x,D,v,w,F,H,z,V,W,L,k);this.netClass.set(E,N),this.nets.get(e.name).netClass=N,this.betweenNetRule.rebuild(N)}if(e.equalLengthGroup){let{name:E,netLengthPhysics:O,nets:_,netLengthTolerancePhysics:x,targetNet:v}=e.equalLengthGroup,D=new dd(E,O,_);D.netLengthTolerancePhysics=x,D.targetNet=v,this.equalLengthGroups.set(E,D),this.nets.get(e.name).equalLengthGroup=D}return this.cacheNetModel.delete(e.name),C}}deleteNetClass(e){let r=this.netClass.get(e);r!=null&&(r.getAllNets().forEach(i=>{i.safeSpacing="default",i.trackPhysics="default",i.blindViaPhysics="default",i.radiusPhysics="default",i.innerPlane="default",i.copperPlane="default",i.solderExpansion="default",i.pasteExpansion="default",i.creepageSpacing="default"}),this.betweenNetRule.deltetRule4Net(r),r!=null&&r.remove(),this.netClass.delete(e)),R.getInstance().compiler.deleteRuleSelector(["NET_CLASS",r.name])}deleteNetDifferential(e){e.forEach(r=>{let i=this.netDifferentials.get(r);i!=null&&(i.getAllNets().forEach(s=>s.differentialPhysics="default"),i.remove(),this.netDifferentials.delete(r)),R.getInstance().compiler.deleteRuleSelector(["DIFF_PAIR",i.name])})}deleteRegion(e){this.regionSelectors.delete(e)}deleteEqualLengthGroup(e){let r=this.equalLengthGroups.get(e);return r!=null&&(r.getAllNets().forEach(i=>{i.netLengthPhysics="default",i.netLengthTolerancePhysics=null}),r.remove()),R.getInstance().compiler.deleteRuleSelector(["EQ_LEN_GRP",r.name]),this.equalLengthGroups.delete(e)}deletePadsPairGroup(e){this.padsPairGroups.delete(e)}getDefaultSafeSpacing(){return this.getDefault(this.safeSpacings)}getDefaultOtherSpacing(){return this.getDefault(this.otherSpacings)}getDefaultCreepageSpacing(){return this.getDefault(this.creepageSpacings)}getDefaultTrackPhysics(){return this.getDefault(this.trackPhysics)}getDefaultDifferentialPhysics(){return this.getDefault(this.differentialPhysics)}getDefaultNetLengthPhysics(){return this.getDefault(this.netLengthPhysics)}getDefaultNetLengthTolerancePhysics(){return this.getDefault(this.netLengthTolerancePhysics)}getDefaultBlindPhysics(){return this.getDefault(this.blindViaPhysics)}getDefaultRadiusPhysics(){return this.getDefault(this.radiusPhysics)}getDefaultInnerPlane(){return this.getDefault(this.innerPlanes)}getDefaultCopperPlane(){return this.getDefault(this.copperPlanes)}getDefaultSolderExpansion(){return this.getDefault(this.solderExpansions)}getDefaultPasteExpansion(){return this.getDefault(this.pasteExpansions)}getDefaultAutoRouter(){return this.getDefault(this.autoRouters)}getAllSafeSpacing(){return this.getAll(this.safeSpacings)}getAllOtherSpacing(){return this.getAll(this.otherSpacings)}getAllCreepageSpacing(){return this.getAll(this.creepageSpacings)}getAllTrackPhysics(){return this.getAll(this.trackPhysics)}getAllDifferentialPhysics(){return this.getAll(this.differentialPhysics)}getAllNetLengthPhysics(){return this.getAll(this.netLengthPhysics)}getAllNetLengthTolerancePhysics(){return this.getAll(this.netLengthTolerancePhysics)}getAllBlindPhysics(){return this.getAll(this.blindViaPhysics)}getAllRadiusPhysics(){return this.getAll(this.radiusPhysics)}getAllInnerPlane(){return this.getAll(this.innerPlanes)}getAllCopperPlane(){return this.getAll(this.copperPlanes)}getAllSolderExpansion(){return this.getAll(this.solderExpansions)}getAllPasteExpansion(){return this.getAll(this.pasteExpansions)}getAllNets(){let e=new Set;for(let[,r]of this.nets)e.add(r);return e}getAllRegions(){let e=new Set;for(let[,r]of this.regionSelectors)e.add(r);return e}getAllCopperPlaneRegions(){let e=new Set;for(let[,r]of this.regionSelectors)r.regionType==="region"&&e.add(r);return e}getAllConstraintRegions(){let e=new Set;for(let[,r]of this.regionSelectors)r.regionType==="constraint"&&e.add(r);return e}getNoDifferentail(){let e=new Set;for(let[,r]of this.nets)r.netDifferential==null&&e.add(r);return e}getAllNetClass(){return this.getAllSelector(this.netClass)}getAllEqualLengthGroups(){return this.getAllSelector(this.equalLengthGroups)}getAllNetDifferentials(){return this.getAllSelector(this.netDifferentials)}getAllAutoRouterRules(){return this.getAll(this.autoRouters)}getAll(e){let r=new Set;for(let[,i]of e)r.add(i);return r}getAllSelector(e){let r=new Set;for(let[,i]of e)r.add(i);return r}getDefault(e){if(e==this.safeSpacings){let r=this.defaultRuleMap.get("safe");if(r&&r!==null)return r;for(let[,i]of e)if(i.isDefault)return this.defaultRuleMap.set("safe",i),i}for(let[,r]of e)if(r.isDefault)return r}getRule(e,r){return!r||r=="default"?(e.size==0&&this.correctDefault(),this.getDefault(e)):e.get(r)}getRuleSelector(e,r){if(r!=null)return e.get(r==null?void 0:r.toUpperCase())}renameNetClass(e,r){let i=this.netClass.get(e);i!=null&&(i.name=r,this.netClass.set(r,i),e!==r&&(this.netClass.delete(e),R.getInstance().compiler.deleteRuleSelector(["NET_CLASS",e]))),this.renameBetweenNetRule(this.betweenNetRule.rule,e,r)}renameBetweenNetRule(e,r,i){for(let n of e)n.net1 instanceof $h&&n.net1.name==r&&(n.net1.name=i),n.net2 instanceof $h&&n.net2.name==r&&(n.net2.name=i)}renameEqualLengthGroup(e,r){let i=this.equalLengthGroups.get(e);i!=null&&(i.name=r,this.equalLengthGroups.set(r,i),e!==r&&(this.equalLengthGroups.delete(e),R.getInstance().compiler.deleteRuleSelector(["EQ_LEN_GRP",e])))}renameNetDifferential(e,r,i,n){this.netDifferentials.get(e)!=null&&(this.deleteNetDifferential([e]),R.getInstance().compiler.deleteRuleSelector(["DIFF_PAIR",e])),this.addNetDifferential(r,i,n)}getBetweenNetRuleByNet(e,r,i,n,s=kP){return this.betweenNetRule.rule.length==0?null:this.getSafeRuleByNets(e,r,i,n,s)}getCreepageBetweenNetRuleByNet(e,r,i,n,s=kP){return this.betweenNetRule.rule.length==0?null:this.getCreepageRuleByNets(e,r,i,n,s)}getSafeRuleByNets(e,r,i,n,s){let a=this.getBetweenNetRule(this.betweenNetRule.rule,i,n),l,c=e==13||r==13,h=e==14||r==14;for(let u of a){let d;c&&u.safeCopperPlane?d=this.getSafeSpacing(u.safeCopperPlane):h&&u.safeInnerPlane&&(d=this.getSafeSpacing(u.safeInnerPlane));let p=u.ruleName;!d&&p&&(d=this.getSafeSpacing(p)),(l==null||d&&l.getClearance(e,r,s)<d.getClearance(e,r,s))&&(l=d)}return l}getCreepageRuleByNets(e,r,i,n,s){let a=this.getBetweenNetRule(this.betweenNetRule.rule,i,n),l;for(let c of a){let h=c.creepageRule;if(!h)continue;let u=this.getCreepageSpacing(h);(l==null||u&&l.creepageDistance<u.creepageDistance)&&(l=u)}return l}getBetweenNetRule(e,r,i){let n=new Array;for(let s of e)s.net1==null||s.net2==null||(s.net1.hasNet(r)&&s.net2.hasNet(i)||s.net1.hasNet(i)&&s.net2.hasNet(r))&&n.push(s);return n}getRuleByID(e,r){let i=this.getRegion(e);if(!i)return;let n={13:i.safeCopperPlane||i.safeClearance,14:i.safeInnerPlane||i.safeClearance};return n[r]?this.getSafeSpacing(n[r]):void 0}getRuleByNet(e,r,i){switch(r){case 0:return this.getSafeSpacingByNet(e,i);case 1:return this.getOtherSpacingByNet(e);case 2:return this.getCreepageSpacingByNet(e);case 3:return this.getTrackPhysicsByNet(e);case 4:return this.getNetLengthPhysicsByNet(e);case 5:return this.getNetLengthTolerancePhysicsByNet(e);case 6:return this.getDifferentialPhysicsByNet(e);case 7:return this.getBlindPhysicsByNet(e);case 8:return this.getRadiusPhysicsByNet(e);case 9:return this.getInnerPlaneByNet(e);case 10:return this.getCopperPlaneByNet(e);case 11:return this.getPasteExpansionByNet(e);case 12:return this.getSolderExpansionByNet(e)}}getDefaultRule(e){switch(e){case 0:return this.getDefaultSafeSpacing();case 1:return this.getDefaultOtherSpacing();case 2:return this.getDefaultCreepageSpacing();case 3:return this.getDefaultTrackPhysics();case 6:return this.getDefaultDifferentialPhysics();case 7:return this.getDefaultBlindPhysics();case 8:return this.getDefaultRadiusPhysics();case 9:return this.getDefaultInnerPlane();case 10:return this.getDefaultCopperPlane();case 11:return this.getDefaultPasteExpansion();case 12:return this.getDefaultSolderExpansion();default:throw new Error("Get default rule fail,Input rule type error!!!")}}getSafeSpacingByNet(e,r){let i=this.getNet(e),n;return r==13&&(i!=null&&i.safeCopperPlane)?n=this.getSafeSpacing(i.safeCopperPlane):r==14&&(i!=null&&i.safeInnerPlane)&&(n=this.getSafeSpacing(i.safeInnerPlane)),!n&&(i!=null&&i.safeSpacing)&&(n=this.getSafeSpacing(i.safeSpacing)),n||this.getDefaultSafeSpacing()}getOtherSpacingByNet(e){return this.getDefaultOtherSpacing()}getCreepageSpacingByNet(e){let r=this.getNet(e);return this.getCreepageSpacing(r==null?void 0:r.creepageSpacing)}getTrackPhysicsByNet(e){let r=this.getNet(e);return this.getTrackPhysics(r==null?void 0:r.trackPhysics)}getNetLengthPhysicsByNet(e){let r=this.getNet(e);return this.getNetLengthPhysics(r==null?void 0:r.netLengthPhysics)}getNetLengthTolerancePhysicsByNet(e){let r=this.getNet(e);return this.getNetLengthTolerancePhysics(r==null?void 0:r.netLengthTolerancePhysics)}getDifferentialPhysicsByNet(e){var i;let r=this.getNet(e);return this.getDifferentialPhysics((i=r==null?void 0:r.netDifferential)==null?void 0:i.differentialPhysics)}getBlindPhysicsByNet(e){let r=this.getNet(e);return this.getBlindPhysics(r==null?void 0:r.blindViaPhysics)}getRadiusPhysicsByName(e){return this.getRadiusPhysics(e)}getRadiusPhysicsByNet(e){let r=this.getNet(e);return this.getRadiusPhysics(r==null?void 0:r.radiusPhysics)}getInnerPlaneByNet(e){let r=this.getNet(e);return this.getInnerPlane(r==null?void 0:r.innerPlane)}getCopperPlaneByNet(e){let r=this.getNet(e);return this.getCopperPlane(r==null?void 0:r.copperPlane)}getSolderExpansionByNet(e){let r=this.getNet(e);return this.getSolderExpansion(r==null?void 0:r.solderExpansion)}getPasteExpansionByNet(e){let r=this.getNet(e);return this.getPasteExpansion(r==null?void 0:r.pasteExpansion)}isDiffPair(e,r){var i;if(e!=null&&r!=null&&e!=r){let n=this.getNet(e);if(n!=null&&n.netDifferentialName!=null&&((i=n.netDifferential)!=null&&i.hasNet(r)))return!0}return!1}getSafeClearanceByOrder(e,r,i,n){switch(i){case"BetweenNetRule":{if(this.betweenNetRule.rule.length==0)return null;if(e.net!=null&&r.net!=null){let s=this.getSafeRuleByNets(e.shapeType,r.shapeType,e.net,r.net,n);if(s!=null)return s.getClearance(e.shapeType,r.shapeType,n)}return null}case"CustomPlaneRule":{if(e.shapeType==0&&r.shapeType==0&&this.isDiffPair(e.net,r.net)){let a=this.getDifferentialPhysicsByNet(e.net);if(a!=null)return a.getMaxSpacingMin(n)}let s=this.getSafeRuleByOrder(e,r,"CustomPlaneRule",n);return s?s.getClearance(e.shapeType,r.shapeType,n):null}case"NetRule":{let s=this.getSafeSpacingByNet(e.net,$v(e.shapeType,r.shapeType)),a=this.getSafeSpacingByNet(r.net,$v(e.shapeType,r.shapeType,!0));return Math.max(s.getClearance(e.shapeType,r.shapeType,n),a.getClearance(e.shapeType,r.shapeType,n))}default:{let s=this.getDefaultSafeSpacing();return s==null&&(this.correctDefault(),s=this.getDefaultSafeSpacing()),s.getClearance(e.shapeType,r.shapeType,n)}}}sortRulesByClearance(e,r,i,n){return Er(e,(s,a)=>a.getClearance(r,i,n)-s.getClearance(r,i,n),0,e.length),e[0]}getSafeRuleByOrder(e,r,i,n,s){let a=this.getRule4Order(e,r,i,0,n,s);if(a.length>0){let l=e.shapeType,c=r.shapeType;return this.sortRulesByClearance(a,l,c,n),a[0]}}getSafeRule(e,r,i){let n=["BetweenNetRule","NetRule"],s=this.getDefaultSafeSpacing(),a=i||ay(e.layerId,r.layerId);for(let l of n){let c=this.getSafeRuleByOrder(e,r,l,a);if(c)return c}return s}isBridgeCopperRuleItem(e){return e&&"isBridgingCopper"in e&&e.isBridgingCopper&&Array.isArray(e.nets)}getSafeClearance(e,r,i){let n=null,s=i||ay(e.layerId,r.layerId),a=this.isBridgeCopperRuleItem(e),l=this.isBridgeCopperRuleItem(r),c=a?e.nets.length==0?[""]:e.nets:[e.net],h=l?r.nets.length==0?[""]:r.nets:[r.net],u=new Set,d=[];if(a||l){for(let m of IBe)if(!(m=="BetweenNetRule"&&a&&l)){for(let g of c)for(let y of h){if(g===y||g==null||y==null)continue;let b=`${g}-${y}`,P=`${y}-${g}`;if(!u.has(b)){let T=this.getSafeRuleByOrder(e,r,m,i,[g,y]);T&&(d.push(T),["BetweenNetRule","CustomPlaneRule"].includes(m)&&(u.add(b),u.add(P)))}}if(u.size>2&&u.size/2===c.length*h.length)break}if(d.length>0)return this.sortRulesByClearance(d,e.shapeType,r.shapeType,s).getClearance(e.shapeType,r.shapeType,s)}else for(let m of IBe)if(n=this.getSafeClearanceByOrder(e,r,m,s),n!=null)return n;let p=this.getDefaultSafeSpacing();return p==null&&(this.correctDefault(),p=this.getDefaultSafeSpacing()),p.getClearance(e.shapeType,r.shapeType,s)}getRule4Order(e,r,i,n,s,a){let l=new Array,c=e.shapeType,h=r.shapeType,u=a&&a[0]||e.net,d=a&&a[1]||r.net,p=s||ay(e.layerId,r.layerId);switch(i){case"BetweenNetRule":{if(n==0){if(u!=null&&d!=null){let m=this.getBetweenNetRuleByNet(c,h,u,d,p);m!=null&&l.push(m)}}else if(n==2&&u!=d){let m=this.getCreepageBetweenNetRuleByNet(c,h,u,d,p);m!=null&&l.push(m)}return l}case"CustomPlaneRule":{let m=c==13?this.getRuleByID(e.id,c):void 0,g=h==13?this.getRuleByID(r.id,h):void 0;if(n==0&&c==13&&h==13){if(m!=null&&g!=null)l.push(m),l.push(g);else if(m!=null&&g==null){l.push(m);let y=this.getRuleByNet(d,n,h);y!=null&&l.push(y)}else if(m==null&&g!=null){let y=this.getRuleByNet(u,n,c);y!=null&&l.push(y),l.push(g)}}else m!=null&&l.push(m),g!=null&&l.push(g);return l}case"NetRule":{let m=function(g,y,b){let P=y.getRuleByNet(g,n,b);P!=null&&l.push(P)};return n==0?u!=null&&d!=null?(m(u,this,$v(c,h)),m(d,this,$v(c,h,!0))):u!=null&&d==null?m(u,this,c):u==null&&d!=null?m(d,this,h):l.push(this.getDefaultRule(n)):(u!=null&&m(u,this,c),d!=null&&m(d,this,h)),l}default:return l.push(this.getDefaultRule(n)),l}}addPadsPairGroup(e,r=[]){let i=new lI(e,r);return this.padsPairGroups.set(e,i),i}getAllCopperPlanesRules(){return this.copperPlanes}getPadsPairGroupItemByGroupName(e){return this.padsPairGroups.get(e)}getAllPadsPairGroups(){return this.getAllSelector(this.padsPairGroups)}getAllPadsPairGroupsInstances(){let e=new Array;for(let[,r]of this.padsPairGroups)e.push(r);return e}getRuleTemplateName(){return this.ruleTemplateName}setRuleTemplateName(e){this.ruleTemplateName=e}setSpecialColor(e,r){if(e!=null){let i=this.getNet(e);i&&(r==null||r.equals(ee.BLACK)?i.color=null:i.color=r)}}recycleAll(){this.safeSpacings.clear(),this.otherSpacings.clear(),this.trackPhysics.clear(),this.netLengthPhysics.clear(),this.differentialPhysics.clear(),this.blindViaPhysics.clear(),this.radiusPhysics.clear(),this.innerPlanes.clear(),this.copperPlanes.clear(),this.solderExpansions.clear(),this.pasteExpansions.clear(),this.creepageSpacings.clear()}deleteAll(){this.safeSpacings.clear(),this.otherSpacings.clear(),this.trackPhysics.clear(),this.creepageSpacings.clear(),this.netLengthPhysics.clear(),this.differentialPhysics.clear(),this.blindViaPhysics.clear(),this.radiusPhysics.clear(),this.innerPlanes.clear(),this.copperPlanes.clear(),this.solderExpansions.clear(),this.pasteExpansions.clear(),this.defaultRuleMap.clear()}recycle(){this.deleteAll(),this.deleteAllRuleSelector()}deleteAllRuleSelector(){this.nets.clear(),this.netClass.clear(),this.netDifferentials.clear(),this.regionSelectors.clear(),this.autoRouters.clear(),this.equalLengthGroups.clear(),this.padsPairGroups.clear(),this.betweenNetRule.rule.length=0}getRuleSelect(e){return e instanceof $h?["NET_CLASS",e.name]:e instanceof dd?["EQ_LEN_GRP",e.name]:e instanceof zd?["NET",e.name]:[]}};go.manager=null;var re=go;function ay(o,t){let e=n=>n===12||n===11,r=e(o),i=e(t);return r&&i?12:(r||i)&&r?t:o}var kk=class{constructor(t,e,r){this.expansionType=t,this.topExpansion=e,this.bottomExpansion=r}cloneToCustom(){return qp.getViaExpansion(2,this.topExpansion,this.bottomExpansion)}clone(){return this.expansionType==1?this:this.cloneToCustom()}};var QTe=class{constructor(){this.viaExpansionPool=new Map}getExpansionByexpansionType(t,e){return this.getViaExpansion(t,e.topExpansion,e.bottomExpansion)}getExpansionByTopExpansion(t,e){return this.getViaExpansion(e.expansionType,t,e.bottomExpansion)}getExpansionByBottomExpansion(t,e){return this.getViaExpansion(e.expansionType,e.topExpansion,t)}getViaExpansion(t,e,r){let i=this.generateExpansionId({expansionType:t,topExpansion:e,bottomExpansion:r}),n=this.viaExpansionPool.get(i);if(n!=null)return n;{let s=new kk(t,e,r);return this.viaExpansionPool.set(i,s),s}}generateExpansionId(t){let{expansionType:e,topExpansion:r,bottomExpansion:i}=t;return`${e}_${r}_${i}`}},qp=new QTe;var Bk=class{constructor(t,e,r,i){this.expansionType=t,this.pasteExpansion=e,this.topSolderExpansion=r,this.bottomSolderExpansion=i}cloneToCustom(){return yu.getPadExpansion(2,this.pasteExpansion,this.topSolderExpansion,this.bottomSolderExpansion)}clone(){return this.expansionType==1?this:this.cloneToCustom()}};var eIe=class{constructor(){this.padExpansionPool=new Map}getExpansionByexpansionType(t,e){return this.getPadExpansion(t,e.pasteExpansion,e.topSolderExpansion,e.bottomSolderExpansion)}getExpansionByPasteExpansion(t,e){return this.getPadExpansion(e.expansionType,t,e.topSolderExpansion,e.bottomSolderExpansion)}getExpansionByTopSolderExpansion(t,e){return this.getPadExpansion(e.expansionType,e.pasteExpansion,t,e.bottomSolderExpansion)}getExpansionByBottomSolderExpansion(t,e){return this.getPadExpansion(e.expansionType,e.pasteExpansion,e.topSolderExpansion,t)}getPadExpansion(t,e,r,i){let n=this.generateExpansionId({expansionType:t,pasteExpansion:e,topSolderExpansion:r,bottomSolderExpansion:i}),s=this.padExpansionPool.get(n);return s!=null||(s=new Bk(t,e,r,i),this.padExpansionPool.set(n,s)),s}generateExpansionId(t){let{expansionType:e,pasteExpansion:r,topSolderExpansion:i,bottomSolderExpansion:n}=t;return`${e}_${r}_${i}_${n}`}},yu=new eIe;function rIe(o,t){let e;return o.layerId==2?o.isTestPad?e=t.testPointBottomExpansion:e=t.padBottomExpansion:o.isTestPad?e=t.testPointTopExpansion:e=t.padTopExpansion,e}var Xz="",J9,tIe;function $p(o){if(o.modelType=="Pad"){if(o.expansionType==1){if(Xz=o.net,J9=re.getInstance().getSolderExpansionByNet(Xz),tIe=re.getInstance().getPasteExpansionByNet(Xz),tIe){let t=rIe(o,tIe);o.pasteExpansion!=t&&(o.pasteExpansion=t)}if(J9){let t=o.isTestPad?J9.testPointTopExpansion:J9.padTopExpansion,e=o.isTestPad?J9.testPointBottomExpansion:J9.padBottomExpansion,r=yu.getPadExpansion(o.expansionType,o.pasteExpansion,t,e);o.padExpansion!=r&&(o.padExpansion=r)}}}else if(o.expansionType===1&&(Xz=o.net,J9=re.getInstance().getSolderExpansionByNet(Xz),J9)){let t=qp.getViaExpansion(o.expansionType,J9.viaTopExpansion,J9.viaBottomExpansion);o.viaExpansion!=t&&(o.viaExpansion=t)}}var et=class extends xi{constructor(){super(...arguments);this.modelType="Pad";this._attrsMap={}}get attrsMap(){return this._attrsMap}addATTRMap(e,r){this._attrsMap[e]=r}modifyATTRMap(e,r){this._attrsMap[e]=r}deleteATTRMap(e){delete this._attrsMap[e]}clearMap(){this._attrsMap={}}get numModified(){return this.hasDataState(10)}set numModified(e){this.setDataState(10,e)}get globalIndex(){return this._globalIndex}set globalIndex(e){this._globalIndex=e}get isTestPad(){return this.padType==1}set isTestPad(e){e?this.padType=1:this.padType=0}get topModified(){return this.hasDataState(12)}set topModified(e){this.setDataState(12,e)}get bottomModified(){return this.hasDataState(13)}set bottomModified(e){this.setDataState(13,e)}get innerModified(){return this.hasDataState(14)}set innerModified(e){this.setDataState(14,e)}get holeModified(){return this.hasDataState(15)}set holeModified(e){this.setDataState(15,e)}get holeShape(){var e;return(e=this.hole)==null?void 0:e.holeShape}set holeShape(e){this.hole&&e!=null&&(this.hole=nc.getHoleStyleByShape(e,this.hole),this.updateShapeData())}get holeLength(){var e;return(e=this.hole)==null?void 0:e.holeLength}set holeLength(e){if(this.hole&&e!=null){e=oo(e);let r=this.hole.holeRadius*2;e<r&&(e=r),this.hole=nc.getHoleStyleByLength(e,this.hole),this.updateShapeData()}}get holeOffset(){var e;return((e=this.hole)==null?void 0:e.holeOffset)||S.ORIGIN}set holeOffset(e){this.hole&&(this.hole=nc.getHoleStyleByOffset(e,this.hole),this.updateShapeData())}get holeRotation(){if(this.hole)return this.hole.holeRotation%kr}set holeRotation(e){this.hole&&e!=null&&(this.hole=nc.getHoleStyleByRotation(e,this.hole),this.updateShapeData())}get holeRadius(){if(this.hole)return this.hole.holeRadius}set holeRadius(e){if(this.hole&&e!=null){let r=oo(e*2);r>this.hole.holeLength&&(this.holeLength=r),e=r/2,this.hole=nc.getHoleStyleByRadius(e,this.hole),this.updateShapeData()}}get expansionType(){return this.padExpansion.expansionType}set expansionType(e){this.padExpansion.expansionType!=e&&(this.padExpansion=yu.getExpansionByexpansionType(e,this.padExpansion))}get pasteExpansion(){return this.padExpansion.pasteExpansion}set pasteExpansion(e){this.padExpansion.pasteExpansion!=e&&(this.padExpansion=yu.getExpansionByPasteExpansion(e,this.padExpansion),this.updateShapeData(),this.pasteExpansionModified=!0)}get pasteExpansionModified(){return this.hasDataState(7)}set pasteExpansionModified(e){this.setDataState(7,e)}get topSolderExpansion(){return this.padExpansion.topSolderExpansion}set topSolderExpansion(e){this.padExpansion.topSolderExpansion!=e&&(this.padExpansion=yu.getExpansionByTopSolderExpansion(e,this.padExpansion),this.updateShapeData(),this.topSolderExpansionModified=!0)}get topSolderExpansionModified(){return this.hasDataState(8)}set topSolderExpansionModified(e){this.setDataState(8,e)}get bottomSolderExpansion(){return this.padExpansion.bottomSolderExpansion}set bottomSolderExpansion(e){this.padExpansion.bottomSolderExpansion!=e&&(this.padExpansion=yu.getExpansionByBottomSolderExpansion(e,this.padExpansion),this.updateShapeData(),this.bottomSolderExpansionModified=!0)}get bottomSolderExpansionModified(){return this.hasDataState(9)}set bottomSolderExpansionModified(e){this.setDataState(9,e)}get padStyle(){return this.layerId==1?this.top:this.layerId==2?this.bottom:this.inner}updateShapeData(e){this._parent!=null&&this._parent.update4Childs(),this.refreshBBox=!0,e==null?this.shapeModified=this.shapeModified||!1:this.shapeModified=this.shapeModified||e,this.watchBBoxModify()}};var nS=class o extends et{constructor(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T=null,I=0,C,E,O){super(),this._globalIndex=t,this._layerId=e,this._type=r,this._center=n,this._rotation=s,this._plated=m,this._padExpansion=yu.getPadExpansion(c,h,u,d),this._unusedInnerLayers=p,this._locked=a,this._padType=I,this._bbox=C||Q9(e,n,s,g,y,b,P,0,0,0),this._padLen=E,this._attrsMap=O||{},this.update(i,l,g,y,b,P,T,!0),Ro("data/model/PadModel")}get padLen(){return this._padLen||0}set padLen(t){this._padLen=t}get net(){var t;return(t=this._net)==null?void 0:t.toUpperCase()}get showNet(){return this._net}set net(t){this._net!=t&&(this._parent!=null&&this._parent instanceof xi&&this._parent.modelType=="Component"&&this._parent.setNet(this._num,this.globalIndex,t),this._net=t.toString(),this.netModified=!0)}get num(){return this._num}set num(t){this._num!=t&&(this._num=t,this.numModified=!0)}get globalIndex(){return this._globalIndex}set globalIndex(t){this._globalIndex=t}get padType(){return this._padType}set padType(t){this._padType!=t&&(this._padType=t)}get isTestPad(){return this.padType==1}set isTestPad(t){t?this._padType=1:this._padType=0}get padRule(){return this._padRule}set padRule(t){this._padRule!=t&&(this._padRule=t)}get padExpansion(){return this._padExpansion}set padExpansion(t){this._padExpansion!=t&&(this.checkExpansionModify(t),this._padExpansion=t)}get pads(){return[this.top,this.bottom,this.inner].filter(t=>t!=null)}get polygonPl(){return this.top!=null?this.top.pl:this.bottom!=null?this.bottom.pl:this.inner!=null?this.inner.pl:null}get top(){return this._top}set top(t){this._top!=t&&(this._top=t,this.updateShapeData(),this.topModified=!0)}get bottom(){return this._bottom}set bottom(t){this._bottom!=t&&(this._bottom=t,this.updateShapeData(),this.bottomModified=!0)}get inner(){return this._inner}set inner(t){this._inner!=t&&(this._inner=t,this.updateShapeData(),this.innerModified=!0)}get hole(){return this._hole}set hole(t){this._hole!=t&&(this._hole=t,this.updateShapeData(),this.holeModified=!0)}get plated(){return this._plated}set plated(t){this._plated!=t&&(this._plated=t)}get unusedInnerLayers(){return this._unusedInnerLayers}set unusedInnerLayers(t){this._unusedInnerLayers.toString()!=t.toString()&&(this._unusedInnerLayers=t,this.updateShapeData(!0))}get layerId(){return this._layerId}set layerId(t){let e=this.layerId;if(e!=t){switch(this.watchLayerIdModify(e),this._layerId=t,e){case 1:{if(this._top==null)throw new Error("Pad style Error!!!");if(t==2)this._bottom=this._top,this.bottomModified=!0,$p(this),this.expansionType===2&&(this.bottomSolderExpansion=this.topSolderExpansion),this._top=null,this.topModified=!0;else{this._bottom=this._top.clone(),this._inner=this._top.clone();let r=Math.min(this._top.height,this._top.width)*.3;this._hole=nc.getHoleStyle(r,r,"ROUND",0,S.ORIGIN),this.bottomModified=!0,this.innerModified=!0,this.holeModified=!0}break}case 2:{if(this._bottom==null)throw new Error("Pad style Error!!!");if(t==1)this._top=this._bottom,this.topModified=!0,$p(this),this.expansionType===2&&(this.topSolderExpansion=this.bottomSolderExpansion),this._bottom=null,this.bottomModified=!0;else{this._top=this._bottom.clone(),this.topModified=!0,this._inner=this._bottom.clone();let r=Math.min(this._bottom.height,this._bottom.width)*.3;this._hole=nc.getHoleStyle(r,r,"ROUND",0,S.ORIGIN),this.innerModified=!0,this.holeModified=!0}break}default:t==1?(this._bottom=null,this._inner=null,this._hole=null,this.bottomModified=!0,this.innerModified=!0,this.holeModified=!0):t==2?(this._top=null,this._inner=null,this._hole=null,this.topModified=!0,this.innerModified=!0,this.holeModified=!0):(this._top=null,this._bottom=null,this._hole=null,this.topModified=!0,this.bottomModified=!0,this.holeModified=!0),this.type=1}this.updateShapeData(),this.layerModified=!0}}get type(){return this._type}set type(t){if(this.type!=t&&this.layerId==12){let r=this._top||this._bottom||this._inner;r&&(this._top&&(this._top=r.clone(),this.topModified=!0,this.updateShapeData()),this._bottom&&(this._bottom=r.clone(),this.bottomModified=!0,this.updateShapeData()),this._inner&&(this._inner=r.clone(),this.innerModified=!0,this.updateShapeData()))}this._type!=t&&(this._type=t,this.updateShapeData())}get center(){return this._center}set center(t){this._center!=t&&(this._center=t,this.updateShapeData(!0))}get rotation(){return this._rotation}set rotation(t){this._rotation!=t&&(this._rotation=Math.abs(t)<1e-8?0:t,this.updateShapeData(!0))}get expansionType(){return this._padExpansion.expansionType}set expansionType(t){this._padExpansion.expansionType!=t&&(this._padExpansion=yu.getExpansionByexpansionType(t,this._padExpansion))}get pasteExpansion(){return this._padExpansion.pasteExpansion}set pasteExpansion(t){this._padExpansion.pasteExpansion!=t&&(this._padExpansion=yu.getExpansionByPasteExpansion(t,this._padExpansion),this.updateShapeData(),this.pasteExpansionModified=!0)}get topSolderExpansion(){return this._padExpansion.topSolderExpansion}set topSolderExpansion(t){this._padExpansion.topSolderExpansion!=t&&(this._padExpansion=yu.getExpansionByTopSolderExpansion(t,this._padExpansion),this.updateShapeData(),this.topSolderExpansionModified=!0)}get bottomSolderExpansion(){return this._padExpansion.bottomSolderExpansion}set bottomSolderExpansion(t){this._padExpansion.bottomSolderExpansion!=t&&(this._padExpansion=yu.getExpansionByBottomSolderExpansion(t,this._padExpansion),this.updateShapeData(),this.bottomSolderExpansionModified=!0)}get bbox(){return this._bbox}get locked(){return this._locked}set locked(t){this._locked=t}get padStyle(){return this.layerId==1?this.top:this.layerId==2?this.bottom:this.inner}transformPl(t){let e=t.toMatrix3();if(this._top!=null&&this._top.type==="POLYGON"&&this._top.pl!=null){let r=this._top.pl.multiply3(e);r.area()>0&&(r=r.reverse()),this._top=Lo.getPadStyleByPl(r,this._top),this.topModified=!0}if(this._bottom!=null&&this._bottom.type==="POLYGON"&&this._bottom.pl!=null){let r=this._bottom.pl.multiply3(e);r.area()>0&&(r=r.reverse()),this._bottom=Lo.getPadStyleByPl(r,this._bottom),this.bottomModified=!0}if(this._inner!=null&&this._inner.type==="POLYGON"&&this._inner.pl!=null){let r=this._inner.pl.multiply3(e);r.area()>0&&(r=r.reverse()),this._inner=Lo.getPadStyleByPl(r,this._inner),this.innerModified=!0}}update(t,e,r,i,n,s,a=null,l=!1){let c=this._layerId;c===1?(Ki.notnull(r),Ki.mustnull(n),Ki.mustnull(i),Ki.mustnull(s)):c===2?(Ki.mustnull(r),Ki.mustnull(n),Ki.notnull(i),Ki.mustnull(s)):c===12?(Ki.notnull(r),Ki.notnull(n),Ki.notnull(i),Ki.notnull(s)):(Ki.mustnull(r),Ki.notnull(n),Ki.mustnull(i),Ki.mustnull(s)),this.num=t,this.net=e||"",this.top=r,this.bottom=i,this.inner=n,this.hole=s,this.padRule=a,!(l&&this._bbox)&&this.updateBox()}getExpansionRatio(t,e,r,i){let n=Math.min(e,r)/2,s=n*t+i;return s>0?Math.max(s/(n+i),0):0}isPolygon(){return this.top!=null?this.top.type=="POLYGON":this.bottom!=null?this.bottom.type=="POLYGON":!1}oppositeLayer(){if(this.layerId==12){let t=this._top;this._top=this._bottom,this._bottom=t,this.topModified=!0,this.bottomModified=!0,this.padExpansion=yu.getPadExpansion(this.padExpansion.expansionType,this.padExpansion.pasteExpansion,this.padExpansion.bottomSolderExpansion,this.padExpansion.topSolderExpansion)}}getOneInnerInUse(){for(let t=15;t<=46;t++)if(!this.isUnuseLayer(t))return t;return null}isUnuseLayer(t){if(t>46)return!1;let e=1<<t-15;return(Z9.compress(this._unusedInnerLayers)&e)!==0}flip(t){let e=this.center,r=this.rotation,i=e.multiply4(t),n=(Math.PI-r)%kr;if(this.center=i,this.rotation=n,this.transformPl(t),this.hole){let s=Ae.rotateZ(this.hole.holeRotation).translate1(this.hole.holeOffset.x,this.hole.holeOffset.y,0).rotateZ(r).translate1(e.x,e.y,0),l=S.ORIGIN.multiply4(s).multiply4(t).multiply4(Ae.translate(-i.x,-i.y,0).rotateZ(-n)),c=(Math.PI-this.hole.holeRotation)%kr;this.hole=nc.getHoleStyle(this.holeLength,this.holeRadius,this.holeShape,c,l)}}rotateFor(t,e){let r=Ae.rotateZForPoint(t,e);this.transform(r)}transform(t){this.rotation=S.caculateAngle(this.rotation,t)%kr,this.center=this.center.multiply4(t),this.transformPl(t)}remove(){var t,e,r,i;(t=this._top)==null||t.remove(),(e=this._bottom)==null||e.remove(),(r=this._inner)==null||r.remove(),(i=this._hole)==null||i.remove(),super.remove()}inShape(t,e,r){switch(this.layerId){case 1:return this._top!=null&&this._top.inShape(t,e,this.center,this.rotation,r);case 2:return this._bottom!=null&&this._bottom.inShape(t,e,this.center,this.rotation,r);default:return this._top!=null&&this._top.inShape(t,e,this.center,this.rotation,r)||this._bottom!=null&&this._bottom.inShape(t,e,this.center,this.rotation,r)||Ze.getInstance().hasInner()&&this._inner!=null&&this._inner.inShape(t,e,this.center,this.rotation,r)?!0:this._hole!=null&&this._hole.inShape(t,e,this.center,this.rotation,r)}}updateBox(){return this._bbox=Q9(this.layerId,this.center,this.rotation,this.top,this.bottom,this.inner,this.hole,0,0,0),this._bbox}getPad(t){let e=[1,7,5],r=[2,8,6];return e.includes(t)?this.top:r.includes(t)?this.bottom:this.inner}getBBox(t){let{pasteExpansion:e,topSolderExpansion:r,bottomSolderExpansion:i}=this;return t&&(e=0,r=0,i=0),Q9(this.layerId,this.center,this.rotation,this.top,this.bottom,this.inner,this.hole,e,r,i)}getFileGraphics(t,e,r){if(this.isEmpty)return null;if(t==12){let i=[];r=r||[1,2,15];for(let n of r){let s=this.getMathGraphics(n,e);s!=null&&i.push(s)}return i}else{let i=this.getMathGraphics(t,e);return i==null?null:[i]}}getMathGraphics(t=this.layerId,e=0){if(this.isEmpty||this.isUnuseLayer(t))return null;if(t==1){if(this._top!=null)return this._top.getShape(e,this.center,this.rotation)}else if(t==2){if(this._bottom!=null)return this._bottom.getShape(e,this.center,this.rotation)}else if(t==12||47===t){if(this._hole!=null)return this._hole.getShape(e,this.center,this.rotation)}else if(6==t){if(this._bottom!=null)return this._bottom.getShape(e+this.bottomSolderExpansion,this.center,this.rotation)}else if(8==t){if(this._bottom!=null)return this._bottom.getShape(e+this.pasteExpansion,this.center,this.rotation)}else if(5==t){if(this._top!=null)return this._top.getShape(e+this.topSolderExpansion,this.center,this.rotation)}else if(7==t){if(this._top!=null)return this._top.getShape(e+this.pasteExpansion,this.center,this.rotation)}else if(this._inner!=null)return this._inner.getShape(e,this.center,this.rotation);return null}cloneLayer(t,e,r,i,n,s){let a=e||null,l=r||null,c=i||null,h=n||null,u=s&&s instanceof q0?s.clone():this._padRule?this._padRule.clone():null;return new o(this.globalIndex,t,this._type,this._num,this._center,this._rotation,this._locked,this.showNet,this._padExpansion.expansionType,this._padExpansion.pasteExpansion,this._padExpansion.topSolderExpansion,this._padExpansion.bottomSolderExpansion,this._unusedInnerLayers,this._plated,a,l,c,h,u,this._padType,this._bbox)}clone(t,e,r,i,n){this.refreshBBox&&this.updateBox();let s=t&&t instanceof nI?t.clone():this._top?this._top.clone():null,a=e&&e instanceof nI?e.clone():this._bottom?this._bottom.clone():null,l=r&&r instanceof nI?r.clone():this._inner?this._inner.clone():null,c=i&&i instanceof Mv?i.clone():this._hole?this._hole.clone():null,h=n&&n instanceof q0?n.clone():this._padRule?this._padRule.clone():null,u={...this.attrsMap},d=new o(this.globalIndex,this._layerId,this._type,this._num,this._center,this._rotation,this._locked,this.showNet,this._padExpansion.expansionType,this._padExpansion.pasteExpansion,this._padExpansion.topSolderExpansion,this._padExpansion.bottomSolderExpansion,this._unusedInnerLayers,this._plated,s,a,l,c,h,this._padType,this._bbox,this._padLen,u);return d.number=this.number,d.zIndex=this.zIndex,d}multiply3(t){let e=t.toMatrix3(),r=this.getMathGraphics();return r==null?null:r.multiply3(e)}isSimilarTo(t){let e=this.layerId==t.layerId&&this.plated==t.plated&&this.rotation==t.rotation&&this.pasteExpansion==t.pasteExpansion&&this.topSolderExpansion==t.topSolderExpansion&&this.bottomSolderExpansion==t.bottomSolderExpansion&&this.holeShape==t.holeShape&&this.holeLength==t.holeLength&&this.holeOffset==t.holeOffset&&this.holeRadius==t.holeRadius&&this.holeRotation==t.holeRotation;if(!e)return!1;if(this.layerId==1)return e&&(this.top==t.top||this.top!=null&&t.top!=null&&this.top.isSimilarTo(t.top));if(this.layerId==2)return e&&(this.bottom==t.bottom||this.bottom!=null&&t.bottom!=null&&this.bottom.isSimilarTo(t.bottom));if(this.layerId==12){let r=this.top,i=t.top,n=this.bottom,s=t.bottom;return e=e&&(r==i||r!=null&&i!=null&&r.isSimilarTo(i)),e=e&&(n==s||n!=null&&s!=null&&n.isSimilarTo(s)),e}else return!1}checkExpansionModify(t){this._padExpansion.topSolderExpansion!=t.topSolderExpansion&&(this.topSolderExpansionModified=!0,this.updateShapeData()),this._padExpansion.pasteExpansion!=t.pasteExpansion&&(this.pasteExpansionModified=!0,this.updateShapeData()),this._padExpansion.bottomSolderExpansion!=t.bottomSolderExpansion&&(this.bottomSolderExpansionModified=!0,this.updateShapeData())}};var oS=class o extends et{constructor(e,r){super();this._parent=void 0;this._flip=!1;this._globalIndex=e,this._model=r,this._layerId=r.layerId,this.position=r.center,this._rotation=r.rotation,this.scaleX=1,this._net=r.net,this._number=r.number,this._bbox=r.bbox}get attrsMap(){if(!this._attrsMap||!Object.keys(this._attrsMap).length)return this._model.attrsMap;{let e={...this._model.attrsMap};for(let r in this._attrsMap){let i=this._attrsMap[r];e[r]=i}return e}}get number(){return this.model.number}set number(e){this._number=e}get model(){return this._model}reset4Model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this.position=e.center,this._rotation=e.rotation,this._type=void 0,this._plated=void 0,this._padExpansion=void 0,this._unusedInnerLayers=void 0,this._locked=void 0,this._padType=void 0,this._num=void 0,this._padRule=void 0,this._top=void 0,this._bottom=void 0,this._inner=void 0,this._hole=void 0,this._padLen=void 0,this._attrsMap={},this.scaleX=1}set model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this.position=e.center,this._rotation=e.rotation}get padLen(){return this._padLen==null?this.model.padLen:this._padLen}set padLen(e){this._padLen=e}get net(){var e;return((e=this._net)==null?void 0:e.toUpperCase())||""}get showNet(){return this._net}set net(e){this._net!=e&&(this._parent!=null&&this._parent instanceof xi&&this._parent.modelType=="Component"&&this._parent.setNet(this._num,this.globalIndex,e),this._net=e.toString(),this.netModified=!0)}get num(){return this._num==null?this.model.num:this._num}set num(e){this._num!=e&&(this._num=e,this.numModified=!0)}get globalIndex(){return this._globalIndex}set globalIndex(e){this._globalIndex=e}get padType(){return this._padType===void 0?this.model.padType:this._padType}set padType(e){this._padType!=e&&(this._padType=e)}get isTestPad(){return this.padType==1}set isTestPad(e){e?this._padType=1:this._padType=0}get padRule(){return this._padRule===void 0?this.model.padRule:this._padRule}set padRule(e){this._padRule!==e&&(this._padRule=e)}get padExpansion(){return this._padExpansion===void 0?this.model.padExpansion:this._padExpansion}set padExpansion(e){this.padExpansion!=e&&(this.checkExpansionModify(e),this._padExpansion=e)}get pads(){return[this.top,this.bottom,this.inner].filter(e=>e!=null)}get polygonPl(){let e;return this.top!=null?(e=this.getTemplatePl(this.top.pl,this.getPolygonMatrix()),e.area()>0&&(e=e.reverse()),e):this.bottom!=null?(e=this.getTemplatePl(this.bottom.pl,this.getPolygonMatrix()),e.area()>0&&(e=e.reverse()),e):this.inner!=null?(e=this.getTemplatePl(this.inner.pl,this.getPolygonMatrix()),e.area()>0&&(e=e.reverse()),e):null}getTemplatePl(e,r){return e==null?null:e.multiply3(r.toMatrix3())}get top(){return this._top==null?this._layerId==this.model.layerId?this._layerId==12?this._flip?this.model.bottom:this.model.top:this.model.top:this.model.bottom:this._top}set top(e){this._top!=e&&(this._top=e,this.updateShapeData(),this.topModified=!0)}get bottom(){return this._bottom==null?this._layerId==this.model.layerId?this._layerId==12?this._flip?this.model.top:this.model.bottom:this.model.bottom:this.model.top:this._bottom}set bottom(e){this._bottom!=e&&(this._bottom=e,this.updateShapeData(),this.bottomModified=!0)}get inner(){return this._inner||this.model.inner}set inner(e){this._inner!=e&&(this._inner=e,this.updateShapeData(),this.innerModified=!0)}get hole(){return this._hole||this.model.hole}set hole(e){this._hole!=e&&(this._hole=e,this.updateShapeData(),this.holeModified=!0)}get holeShape(){var e;return((e=this.hole)==null?void 0:e.holeShape)||this.model.holeShape}set holeShape(e){this.hole&&e!=null&&(this.hole=nc.getHoleStyleByShape(e,this.hole),this.updateShapeData())}get holeLength(){var e;return((e=this.hole)==null?void 0:e.holeLength)||this.model.holeLength}set holeLength(e){if(this.hole&&e!=null){e=oo(e);let r=this.hole.holeRadius*2;e<r&&(e=r),this.hole=nc.getHoleStyleByLength(e,this.hole),this.updateShapeData()}}get holeOffset(){var e;return((e=this.hole)==null?void 0:e.holeOffset)||this.model.holeOffset}set holeOffset(e){this.hole&&(this.hole=nc.getHoleStyleByOffset(e,this.hole),this.updateShapeData())}get holeRotation(){return this.hole?this.hole.holeRotation%Wd:this.model.holeRotation}set holeRotation(e){this.hole&&e!=null&&(this.hole=nc.getHoleStyleByRotation(e,this.hole),this.updateShapeData())}get holeRadius(){return this.hole?this.hole.holeRadius:this.model.holeRadius}set holeRadius(e){if(this.hole&&e!=null){let r=oo(e*2);r>this.hole.holeLength&&(this.holeLength=r),e=r/2,this.hole=nc.getHoleStyleByRadius(e,this.hole),this.updateShapeData()}}get plated(){return this._plated==null?this.model.plated:this._plated}set plated(e){this._plated!=e&&(this._plated=e)}get unusedInnerLayers(){return this._unusedInnerLayers||this.model.unusedInnerLayers}set unusedInnerLayers(e){this.unusedInnerLayers.toString()!=e.toString()&&(this._unusedInnerLayers=e,this.updateShapeData(!0))}get layerId(){return this._layerId}set layerId(e){let r=this.layerId;if(r!=e){switch(this.watchLayerIdModify(r),this._layerId=e,r){case 1:{if(e==2)this._top!=null&&(this._bottom=this._top,this._top=null),this.bottomModified=!0,$p(this),this.expansionType===2&&(this._padExpansion!=null?this.bottomSolderExpansion=this.topSolderExpansion:this.bottomSolderExpansionModified=!0),this.topModified=!0;else{if(this._top==null&&(r==this.model.layerId?this._top=this.model.top:this.model.layerId===12?this._top=this._flip?this.model.bottom:this.model.top:this._top=this.model.bottom),this._top==null)throw new Error("Pad style Error!!!");this._bottom=this._top.clone(),this._inner=this._top.clone();let i=Math.min(this._top.height,this._top.width)*.3;this._hole=nc.getHoleStyle(i,i,"ROUND",0,S.ORIGIN),this.bottomModified=!0,this.innerModified=!0,this.holeModified=!0}break}case 2:{if(e==1)this._bottom!=null&&(this._top=this._bottom,this._bottom=null),this.topModified=!0,$p(this),this.expansionType===2&&(this._padExpansion!=null?this.topSolderExpansion=this.bottomSolderExpansion:this.topSolderExpansionModified=!0),this.bottomModified=!0;else{if(this._bottom==null&&(r==this.model.layerId?this._bottom=this.model.bottom:this.model.layerId===12?this._bottom=this._flip?this.model.top:this.model.bottom:this._bottom=this.model.top),this._bottom==null)throw new Error("Pad style Error!!!");this._top=this._bottom.clone(),this.topModified=!0,this._inner=this._bottom.clone();let i=Math.min(this._bottom.height,this._bottom.width)*.3;this._hole=nc.getHoleStyle(i,i,"ROUND",0,S.ORIGIN),this.innerModified=!0,this.holeModified=!0}break}default:e==1?(this._top==null&&(this._top=this.model.top),this._bottom=null,this._inner=null,this._hole=null,this.bottomModified=!0,this.innerModified=!0,this.holeModified=!0):e==2?(this._bottom==null&&(this._bottom=this.model.bottom),this._top=null,this._inner=null,this._hole=null,this.topModified=!0,this.innerModified=!0,this.holeModified=!0):(this._inner==null&&(this._inner=this.model.inner),this._top=null,this._bottom=null,this._hole=null,this.topModified=!0,this.bottomModified=!0,this.holeModified=!0),this.type=1}this.updateShapeData(),this.layerModified=!0}}get type(){return this._type||this.model.type}set type(e){if(this.type!=e&&this.layerId==12){let i=this.top||this.bottom||this.inner;i&&(this._top&&(this._top=i.clone(),this.topModified=!0,this.updateShapeData()),this._bottom&&(this._bottom=i.clone(),this.bottomModified=!0,this.updateShapeData()),this._inner&&(this._inner=i.clone(),this.innerModified=!0,this.updateShapeData()))}this._type!=e&&(this._type=e,this.updateShapeData())}get center(){return this.position}set center(e){this.position!=e&&(this.position=e,this.updateShapeData(!0))}get rotation(){return this._rotation}set rotation(e){this._rotation!=e&&(this._rotation=Math.abs(e)<1e-8?0:e,this.updateShapeData(!0))}get expansionType(){return this._padExpansion?this._padExpansion.expansionType:this.model.expansionType}set expansionType(e){this.expansionType!=e&&(this._padExpansion=yu.getExpansionByexpansionType(e,this.padExpansion))}get pasteExpansion(){return this._padExpansion?this._padExpansion.pasteExpansion:this.model.pasteExpansion}set pasteExpansion(e){this.pasteExpansion!=e&&(this._padExpansion=yu.getExpansionByPasteExpansion(e,this.padExpansion),this.updateShapeData(),this.pasteExpansionModified=!0)}get topSolderExpansion(){return this._padExpansion?this._padExpansion.topSolderExpansion:this._layerId==this.model.layerId?this._layerId==12?this._flip?this.model.bottomSolderExpansion:this.model.topSolderExpansion:this.model.topSolderExpansion:this.model.bottomSolderExpansion}set topSolderExpansion(e){this.topSolderExpansion!=e&&(this._padExpansion=yu.getExpansionByTopSolderExpansion(e,this.padExpansion),this.updateShapeData(),this.topSolderExpansionModified=!0)}get bottomSolderExpansion(){return this._padExpansion?this._padExpansion.bottomSolderExpansion:this._layerId==this.model.layerId?this._layerId==12?this._flip?this.model.topSolderExpansion:this.model.bottomSolderExpansion:this.model.bottomSolderExpansion:this.model.topSolderExpansion}set bottomSolderExpansion(e){this.bottomSolderExpansion!=e&&(this._padExpansion=yu.getExpansionByBottomSolderExpansion(e,this.padExpansion),this.updateShapeData(),this.bottomSolderExpansionModified=!0)}get bbox(){return this._bbox}get locked(){return this._locked||this.model.locked}set locked(e){this._locked=e}get padStyle(){return this.layerId==1?this.top:this.layerId==2?this.bottom:this.inner}getPolygonMatrix(){return Ae.getMatrix4(this.model.center.mul(-1),-this.model.rotation,1,S.ORIGIN).multiply4(this.getMatrix())}getMatrix(){return Ae.getMatrix4(S.ORIGIN,this.rotation,this.scaleX,this.position)}transformPl(e){let r=e.data[0]*e.data[5]-e.data[1]*e.data[4]>0?1:-1;this.scaleX!=r&&(this._rotation=(Math.PI-this._rotation)%Wd),this.rotation=S.caculateAngle(this.rotation,e)%Wd,this.center=this.center.multiply4(e),this.scaleX=r,this.updateShapeData()}update(e,r,i,n,s,a,l=null,c=!1){!(c&&this._bbox)&&this.updateBox()}getExpansionRatio(e,r,i,n){let s=Math.min(r,i)/2,a=s*e+n;return a>0?Math.max(a/(s+n),0):0}isPolygon(){return this.model.isPolygon()}oppositeLayer(){this.layerId==12&&(this._flip=!this._flip)}getOneInnerInUse(){for(let e=15;e<=46;e++)if(!this.isUnuseLayer(e))return e;return null}isUnuseLayer(e){if(e>46)return!1;let r=1<<e-15;return(Z9.compress(this.unusedInnerLayers)&r)!==0}flip(e){let r=new S(this.scaleX*Math.cos(this.rotation),Math.sin(this.rotation)),i=e.data[0]*e.data[5]-e.data[1]*e.data[4]>0?1:-1;this.scaleX*=i;let n=r.x*e.data[0]+r.y*e.data[4],s=r.x*e.data[1]+r.y*e.data[5],a=new S(n*this.scaleX,s),l=this.center,c=this.rotation,h=l.multiply4(e),u=a.angle(S.ORIGIN);if(this.center=h,this.rotation=u,this.hole){let d=Ae.rotateZ(this.hole.holeRotation).translate1(this.hole.holeOffset.x,this.hole.holeOffset.y,0).rotateZ(c).translate1(l.x,l.y,0),m=S.ORIGIN.multiply4(d).multiply4(e).multiply4(Ae.translate(-h.x,-h.y,0).rotateZ(-u)),g=(Math.PI-this.hole.holeRotation)%Wd;this.hole=nc.getHoleStyle(this.holeLength,this.holeRadius,this.holeShape,g,m)}this.updateShapeData()}rotateFor(e,r){let i=Ae.rotateZForPoint(e,r);this.transform(i)}transform(e){(e.data[0]*e.data[5]-e.data[1]*e.data[4]>0?1:-1)!=1&&(this._rotation=(Math.PI-this._rotation)%Wd),this.rotation=this.isPolygon()?(this._rotation+this.scaleX*S.caculateAngle(0,e))%Wd:S.caculateAngle(this.rotation,e)%Wd,this.center=this.center.multiply4(e),this.updateShapeData(!0)}inShape(e,r,i){if(this.isPolygon()){let n=this.polygonPl;return n!=null?jr.inPolygon(new S(e,r),[n]):!1}switch(this.layerId){case 1:return this.top!=null&&this.top.inShape(e,r,this.center,this.rotation,i);case 2:return this.bottom!=null&&this.bottom.inShape(e,r,this.center,this.rotation,i);default:return this.top!=null&&this.top.inShape(e,r,this.center,this.rotation,i)||this.bottom!=null&&this.bottom.inShape(e,r,this.center,this.rotation,i)||Ze.getInstance().hasInner()&&this.inner!=null&&this.inner.inShape(e,r,this.center,this.rotation,i)?!0:this.hole!=null&&this.hole.inShape(e,r,this.center,this.rotation,i)}}updateBox(){if(this.isPolygon()){let e=this.polygonPl;if(e==null)throw new Error("polygon pad style error !!!!");this._bbox=CBe(this.layerId,this.center,this.rotation,this.hole,0,0,0,e.bbox())}else this._bbox=Q9(this.layerId,this.center,this.rotation,this.top,this.bottom,this.inner,this.hole,0,0,0);return this._bbox}getPad(e){let r=[1,7,5],i=[2,8,6];return r.includes(e)?this.top:i.includes(e)?this.bottom:this.inner}getBBox(e){let{pasteExpansion:r,topSolderExpansion:i,bottomSolderExpansion:n}=this;return e&&(r=0,i=0,n=0),Q9(this.layerId,this.center,this.rotation,this.top,this.bottom,this.inner,this.hole,r,i,n)}getFileGraphics(e,r,i){if(this.isEmpty)return null;if(e==12){let n=[];i=i||[1,2,15];for(let s of i){let a=this.getMathGraphics(s,r);a!=null&&n.push(a)}return n}else{let n=this.getMathGraphics(e,r);return n!=null?[n]:null}}getMathGraphics(e=this.layerId,r=0){if(this.isEmpty||this.isUnuseLayer(e))return null;if(e==1){if(this.top!=null)return cg(this,this.top,r)}else if(e==2){if(this.bottom!=null)return cg(this,this.bottom,r)}else if(e==12||47===e){if(this.hole!=null)return this.hole.getShape(r,this.center,this.rotation)}else if(6==e){if(this.bottom!=null)return cg(this,this.bottom,r+this.bottomSolderExpansion)}else if(8==e){if(this.bottom!=null)return cg(this,this.bottom,r+this.pasteExpansion)}else if(5==e){if(this.top!=null)return cg(this,this.top,r+this.topSolderExpansion)}else if(7==e){if(this.top!=null)return cg(this,this.top,r+this.pasteExpansion)}else if(this.inner!=null)return cg(this,this.inner,r);return null}cloneLayer(e,r,i,n,s,a){let l=r||null,c=i||null,h=n||null,u=s||null,d=a&&a instanceof q0?a.clone():this._padRule?this._padRule.clone():null;return new nS(this.globalIndex,e,this.type,this.num,this.position,this.rotation,this.locked,this.showNet,this.padExpansion.expansionType,this.padExpansion.pasteExpansion,this.padExpansion.topSolderExpansion,this.padExpansion.bottomSolderExpansion,this.unusedInnerLayers,this.plated,l,c,h,u,d,this.padType,this._bbox)}clone(){this.refreshBBox&&this.updateBox();let e=new o(this._globalIndex,this.model);e._layerId=this._layerId,e.position=this.position,e.net=this._net,e.scaleX=this.scaleX,e._rotation=this._rotation,e._flip=this._flip,this._type!=null&&(e._type=this._type),this._plated!=null&&(e._plated=this._plated),this._padExpansion!=null&&(e._padExpansion=this._padExpansion),this._unusedInnerLayers!=null&&(e._unusedInnerLayers=this._unusedInnerLayers),this._locked!=null&&(e._locked=this._locked),this._padType!=null&&(e._padType=this._padType),this._num!=null&&(e._num=this._num),this._padRule!=null&&(e._padRule=this._padRule),this._top!=null&&(e._top=this._top),this._bottom!=null&&(e._bottom=this._bottom),this._inner!=null&&(e._inner=this._inner),this._hole!=null&&(e._hole=this._hole),this._padLen!=null&&(e._padLen=this._padLen);let r={...this.attrsMap};return e._attrsMap=r,e}multiply3(e){let r=e.toMatrix3(),i=this.getMathGraphics();return i==null?null:i.multiply3(r)}isSimilarTo(e){let r=this.layerId==e.layerId&&this.plated==e.plated&&this.rotation==e.rotation&&this.pasteExpansion==e.pasteExpansion&&this.topSolderExpansion==e.topSolderExpansion&&this.bottomSolderExpansion==e.bottomSolderExpansion&&this.holeShape==e.holeShape&&this.holeLength==e.holeLength&&this.holeOffset==e.holeOffset&&this.holeRadius==e.holeRadius&&this.holeRotation==e.holeRotation;if(!r)return!1;if(this.layerId==1)return r&&(this.top==e.top||this.top!=null&&e.top!=null&&this.top.isSimilarTo(e.top));if(this.layerId==2)return r&&(this.bottom==e.bottom||this.bottom!=null&&e.bottom!=null&&this.bottom.isSimilarTo(e.bottom));if(this.layerId==12){let i=this.top,n=e.top,s=this.bottom,a=e.bottom;return r=r&&(i==n||i!=null&&n!=null&&i.isSimilarTo(n)),r=r&&(s==a||s!=null&&a!=null&&s.isSimilarTo(a)),r}else return!1}checkExpansionModify(e){this.padExpansion.topSolderExpansion!=e.topSolderExpansion&&(this.topSolderExpansionModified=!0,this.updateShapeData()),this.padExpansion.pasteExpansion!=e.pasteExpansion&&(this.pasteExpansionModified=!0,this.updateShapeData()),this.padExpansion.bottomSolderExpansion!=e.bottomSolderExpansion&&(this.bottomSolderExpansionModified=!0,this.updateShapeData())}};function $Ct(o,t,e,r,i,n,s){let a=new _e;switch(e){case"ELLIPSE":return a.ext2(o).ext7(Math.min(r,i)/2),a.build1();case"OVAL":{let l=Ae.getMatrix4(o.mul(-1),t,1,o);if(r>i){let c=(r-i)/2,h=i/2,u=o.add1(-c,0).multiply4(l),d=o.add1(c,0).multiply4(l);return a.ext2(u).ext2(d).ext7(h),a.build1()}else{let c=(i-r)/2,h=r/2,u=o.add1(0,-c).multiply4(l),d=o.add1(0,c).multiply4(l);return a.ext2(u).ext2(d).ext7(h),a.build1()}}case"RECT":{let l=r/2,c=i/2,h=n*Math.min(l,c),u=Ae.getMatrix4(o.mul(-1),t,1,o),d=new S(o.x-l,o.y+c),p=new S(o.x-l,o.y-c),m=new S(o.x+l,o.y+c),g=new S(o.x+l,o.y-c),y=p.add1(h,h).multiply4(u),b=g.add1(-h,h).multiply4(u),P=m.add1(-h,-h).multiply4(u),T=d.add1(h,-h).multiply4(u),I=new _e;return I.ext2(y).ext2(b).ext2(P).ext2(T).ext7(h),I.build1()}case"POLYGON":{if(s==null)throw new Error("Polygon pad style error!!!");return s.bbox()}default:throw new Error("this pad style is not supported !!!")}}function Vk(o,t,e){return $Ct(o,t,e.type,e.width,e.height,e.ratio,e.pl)}function CBe(o,t,e,r,i,n,s,a){switch(o){case 1:{let l=Math.max(i,n);return l>0?a.extendOfSize(l):a}case 2:{let l=Math.max(i,s);return l>0?a.extendOfSize(l):a}case 12:{if(r==null)throw new Error("Pad style Error!!!");let l=new _e,c=Math.max(i,n),h=Math.max(i,s);return l.ext1(a.extendOfSize(c>0?c:0)).ext1(a.extendOfSize(h>0?h:0)).ext1(r.getHolebbox(t,e)),l.build1()}default:return a}}function Q9(o,t,e,r,i,n,s,a,l,c){switch(o){case 1:{if(r==null)throw new Error("Pad style Error!!!");let h=Vk(t,e,r),u=Math.max(a,l);return u>0?h.extendOfSize(u):h}case 2:{if(i==null)throw new Error("Pad style Error!!!");let h=Vk(t,e,i),u=Math.max(a,c);return u>0?h.extendOfSize(u):h}case 12:{if(r==null||i==null||n==null||s==null)throw new Error("Pad style Error!!!");let h=new _e,u=Vk(t,e,r),d=Math.max(a,l),p=Vk(t,e,i),m=Math.max(a,c);return h.ext1(u.extendOfSize(d>0?d:0)).ext1(p.extendOfSize(m>0?m:0)).ext1(Vk(t,e,n)).ext1(s.getHolebbox(t,e)),h.build1()}default:if(n==null)throw new Error("Pad style Error!!!");return Vk(t,e,n)}}function xL(o,t){if(t==0)return o;let e=(r,i)=>i.bbox().area()-r.bbox().area();if(t>=0){let r=V1.getExtendPolyLine(o,t,!1);return Er(r,e),r[0]}else{let r=o.bbox();if(Math.abs(t)>r.width()||Math.abs(t)>r.height())return null;let i=X0(o,t);if(Er(i,e,0,i.length),i.length>0){let n=i[0].items;for(let s of n)return s}return null}}function SBe(o,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P){let T=null,I=null,C=null,E=null;return t===1?T=Lo.getStyle(e,r,i,n,null):t===2?I=Lo.getStyle(s,a,l,c,null):(T=Lo.getStyle(e,r,i,n,null),I=Lo.getStyle(s,a,l,c,null),C=Lo.getStyle(h,u,d,p,null),E=nc.getHoleStyle(m,g,y,b,P)),{top:T,bottom:I,inner:C,hole:E}}function EBe(o,t,e,r,i,n,s,a){let l=null,c=null,h=null,u=null,d=a;d.area()>0&&(d=d.reverse());let p=Lo.getStyle("POLYGON",-1,-1,-1,d);return t===1?l=p:t===2?c=p:(l=p,c=p.clone(),h=p.clone(),u=nc.getHoleStyle(e,r,i,n,s)),{top:l,bottom:c,inner:h,hole:u}}function cg(o,t,e){if(o instanceof oS)if(t.type=="POLYGON"){let r=t.getShape(e,o.center,o.rotation);return(r==null?void 0:r.multiply3(o.getPolygonMatrix().toMatrix3()))||null}else return t.getShape(e,o.center,o.rotation);else return t.getShape(e,o.center,o.rotation)}var Gk=class extends jh{constructor(e,r=null,i){super(e,r);this.ids=new Array(0);i!=null&&(this.canPanelize=i)}get layer(){return cn.getInstance().getLayer(this.layerId).layer}get plane(){return this.canPanelize==null?this.layer.plane:this.layer.getCreateNoPanelizePlane()}hidden(){this.isValidId()&&this.plane.hiddenPolygonPt(this.ids)}show(){this.isValidId()&&this.plane.showPolygonPt(this.ids)}visible(e,r,i,n){this.layerId!=e&&this.remove(),!Ra.unRefreshScene&&(this.layerId=e,this.ids=this.layer.addPolygon(r,i,n))}isValidId(){return this.ids.length>=0}resetId(){this.ids=[]}forceVisibleHighLight(e){this.forceVisibleHighLights(this.ids,e)}highlight(e,r,i){this.highlights(this.ids,e,r,i)}remove(){var e;this.isValidId()&&((e=this._removeCb)==null||e.call(this),this.plane.removeHighLightPts(this.ids),this.plane.removePolygonPt(this.ids),this.lastHighLightForce=null),this.resetId()}};var qz=class o extends Do{constructor(){super();this.path=new Array(0);this.pathIndex=new Array(0);this.padsLayer=new Array(0);Ro("view/pcb/PolygonPadView")}get highLightType(){var e;return(e=o._viewDataModel)==null?void 0:e.highLightType}get manualHighLight(){var e;return(e=o._viewDataModel)==null?void 0:e.manualHighLight}get manualHighLightModified(){var e;return(e=o._viewDataModel)==null?void 0:e.manualHighLightModified}get layerModified(){var e;return(e=o._viewDataModel)==null?void 0:e.layerModified}get shapeModified(){var e;return(e=o._viewDataModel)==null?void 0:e.shapeModified}get netModified(){var e;return(e=o._viewDataModel)==null?void 0:e.netModified}get highlightColor(){var e;return(e=o._viewDataModel)==null?void 0:e.highlightColor}get highlightMaskColor(){var e;return(e=o._viewDataModel)==null?void 0:e.highlightMaskColor}get viewGroupIdModified(){var e;return(e=o._viewDataModel)==null?void 0:e.viewGroupIdModified}get forceUpdateMask(){var e;return(e=o._viewDataModel)==null?void 0:e.forceUpdateMask}get layerId(){var e;return(e=o._viewDataModel)==null?void 0:e.layerId}get type(){var e;return(e=o._viewDataModel)==null?void 0:e.type}get center(){var e;return(e=o._viewDataModel)==null?void 0:e.center}get rotation(){var e;return(e=o._viewDataModel)==null?void 0:e.rotation}get pasteExpansion(){var e;return(e=o._viewDataModel)==null?void 0:e.pasteExpansion}get topSolderExpansion(){var e;return(e=o._viewDataModel)==null?void 0:e.topSolderExpansion}get bottomSolderExpansion(){var e;return(e=o._viewDataModel)==null?void 0:e.bottomSolderExpansion}get hole(){var e;return(e=o._viewDataModel)==null?void 0:e.hole}get color(){return o._viewDataModel.partition==R.getInstance().partitionId?uo.getInstance().padConfig.getColor(o._viewDataModel.globalIndex,o._viewDataModel.net,o._viewDataModel.selectItem,o._viewDataModel.layerId==12):uo.getInstance().readonlyPadConfig.getColor(o._viewDataModel.globalIndex,o._viewDataModel.net)}get highlightByComponent(){var e;return(e=o._viewDataModel)==null?void 0:e.highlightByComponent}get usedLayers(){var e;return(e=o._viewDataModel)==null?void 0:e.usedLayers}get holeColor(){var e;return(e=o._viewDataModel)==null?void 0:e.holeColor}get wireViewGroupId(){var e;return this.getEngineGroupId((e=o._viewDataModel)==null?void 0:e.wireViewGroupId)}get pasteExpansionModified(){var e;return(e=o._viewDataModel)==null?void 0:e.pasteExpansionModified}get topSolderExpansionModified(){var e;return(e=o._viewDataModel)==null?void 0:e.topSolderExpansionModified}get bottomSolderExpansionModified(){var e;return(e=o._viewDataModel)==null?void 0:e.bottomSolderExpansionModified}get numModified(){var e;return(e=o._viewDataModel)==null?void 0:e.numModified}get topModified(){var e;return((e=o._viewDataModel)==null?void 0:e.topModified)||o._viewDataModel.shapeModified||o._viewDataModel.topSolderExpansionModified||o._viewDataModel.pasteExpansionModified}get bottomModified(){var e;return((e=o._viewDataModel)==null?void 0:e.bottomModified)||o._viewDataModel.shapeModified||o._viewDataModel.bottomSolderExpansionModified||o._viewDataModel.pasteExpansionModified}get innerModified(){var e;return((e=o._viewDataModel)==null?void 0:e.innerModified)||o._viewDataModel.shapeModified}get holeModified(){var e;return(e=o._viewDataModel)==null?void 0:e.holeModified}get shapes(){var e;return(e=o._viewDataModel)==null?void 0:e.shapes}get padShowNet(){return ea.getInstance().padShowNet}get showNum(){return ea.getInstance().padShowNum}get net(){var e;return(e=o._viewDataModel)==null?void 0:e.showNet}get num(){var e;return(e=o._viewDataModel)==null?void 0:e.num}get fillState(){var e;return(e=o._viewDataModel)==null?void 0:e.fillState}get showLayers(){let e=this.usedLayers,r=e.length>0||this.type==2||this.grayIndex!=0;return this.layerId==12&&r?e.filter(i=>![1,2].includes(i)):[this.layerId]}getFontPosition(e,r){return e!=""&&r!=""?1:e!=""&&r==""?2:e==""&&r!=""?2:3}getNetLayerId(){return ar(this.layerId)?47:this.layerId}createNetAndNumberView(){if(this.padShowNet&&this.net?this.netView||(this.netView=new vl(this.layerId)):this.removeNetView(),this.showNum&&this.num?this.numView||(this.numView=new vl(this.layerId)):this.removeNumView(),!this.netView&&!this.numView)return;let e=Qe.translate(-this.center.x,-this.center.y).rotate(-this.rotation),r=this.shapes.multiply3(e),i=new rI(r),n=this.getFontPosition(this.net,this.num),s=new S(Math.cos(this.rotation),Math.sin(this.rotation)),a=new S(-s.y,s.x),l=Math.atan2(s.y,s.x);(l<-Go||l>Go)&&(a=new S(s.y,-s.x)),l<0&&(s=s.mul(-1));let c=this.center,h=this.center,u=i.high,d=r.bbox().width();n==1&&(d>=u?(c=this.center.sub(a.mul(u*.25)),h=this.center.add(a.mul(u*.25)),u*=.5):(c=this.center.sub(s.mul(d*.25)),h=this.center.add(s.mul(d*.25)),d*=.5));let p=this.rotation;d<u&&(p+=Go),p=Kee(p);let m=this.getNetLayerId(),g=this.wireViewGroupId;this.netView&&(d>=u?this.netView.visible(m,this.net,c,p,Pc,Tc,d,u,void 0,g):this.netView.visible(m,this.net,c,p,Pc,Tc,u,d,void 0,g)),this.numView&&(d>=u?this.numView.visible(m,this.num,h,p,Pc,Tc,d,u,void 0,g):this.numView.visible(m,this.num,h,p,Pc,Tc,u,d,void 0,g)),this.netView&&this.netView.forceVisibleHighLight(this.manualHighLight),this.numView&&this.numView.forceVisibleHighLight(this.manualHighLight)}updateFill(){let e=this.layerModified||this.shapeModified||this.path.length==0;this.getFillShowState(this.layerId,this.fillState).showFill?e&&this.removeFill("Not Show Fill"):this.removeFill("Not Show Fill")}getPolylineMap(e=!1){let{layerId:r,shapes:i,pasteExpansion:n,topSolderExpansion:s,bottomSolderExpansion:a,fillState:l}=o._viewDataModel,c=this.path.length==0,h=this.layerModified||this.shapeModified||c||e,u=h||this.pasteExpansionModified,d=h||this.topSolderExpansionModified,p=h||this.bottomSolderExpansionModified,m=this.getFillShowState(r,l),g,y,b,P,T=new Map;return m.showTopPaste?(u||!this.topPaste)&&(g=T.get(n)||this.getExpansion(i,n),T.set(n,g),this.removeTopPaste()):(g=null,this.removeTopPaste()),m.showBottomPaste?(u||!this.bottomPaste)&&(y=T.get(n)||this.getExpansion(i,n),T.set(n,y),this.removeBottomPaste()):(y=null,this.removeBottomPaste()),m.showTopSolder?(d||!this.topSolder)&&(b=T.get(s)||this.getExpansion(i,s),T.set(s,b),this.removeTopSolder()):(b=null,this.removeTopSolder()),m.showBottomSolder?(p||!this.bottomSolder)&&(P=T.get(s)||this.getExpansion(i,a),this.removeBottomSolder()):(P=null,this.removeBottomSolder()),{topPasteShapes:g,bottomPasteShapes:y,topSolderShapes:b,bottomSolderShapes:P}}getFillShowState(e,r){let i=!1,n=!1,s=!1,a=!1,l=!1;return r===1?{showFill:i,showTopSolder:n,showTopPaste:s,showBottomSolder:a,showBottomPaste:l}:(i=!0,e==1?(n=!0,s=!0):e==2?(a=!0,l=!0):(n=!0,a=!0),{showFill:i,showTopSolder:n,showTopPaste:s,showBottomSolder:a,showBottomPaste:l})}addPolygon(e,r,i,n){if(r.primitives.length>0){let s=new Gk(e);return s.visible(e,r,i,n),s}}getExpansion(e,r){return xL(e,r)}fillEach(e,r=!1){let i=this.showLayers;if(r||this.pathIndex.length!=i.length||this.padsLayer.length!=i.length||i.toString()!=this._lastLayerIds.toString()||this.viewGroupIdModified)this._lastLayerIds=i;else{if(this.manualHighLightModified)for(let a=0;a<Math.max(this.pathIndex.length,i.length);a++)i[a]&&this.pathIndex[a]&&this.pathIndex[a].forceVisibleHighLight(this.manualHighLight);return}let s=this.wireViewGroupId;for(let a=0;a<Math.max(this.pathIndex.length,i.length);a++)this.pathIndex[a]&&this.pathIndex[a].remove(),i[a]&&(this.pathIndex[a]=this.addPolygon(i[a],this.shapes,e,s),this.padsLayer[a]=i[a]);if(this.pathIndex.length=i.length,this.padsLayer.length=i.length,this.manualHighLightModified||this.manualHighLight)for(let a=0;a<Math.max(this.pathIndex.length,i.length);a++)i[a]&&this.pathIndex[a]&&this.pathIndex[a].forceVisibleHighLight(this.manualHighLight)}createMask(e,r,i=ee.BLACK,n=null){if(this.fillState===1){this.removeFill("Not Show Fill");return}e!=null&&e.remove();let{pasteExpansion:s,topSolderExpansion:a,bottomSolderExpansion:l}=this,{topPasteShapes:c,bottomPasteShapes:h,topSolderShapes:u,bottomSolderShapes:d}=r,p=this.shapes;!(c||h)&&this.topPaste&&(c=this.getExpansion(p,s)),!u&&this.topSolder&&(u=this.getExpansion(p,a)),!d&&this.bottomSolder&&(d=this.getExpansion(p,l));let m=0;return(c||h)&&(m=Math.max(m,s)),u&&(m=Math.max(m,a)),d&&(m=Math.max(m,l)),m===0?this.addPolygon(1002,p,i,n):(c||h)&&m===s?this.addPolygon(1002,c||h,i,n):u&&m===a?this.addPolygon(1002,u,i,n):d&&m===l?this.addPolygon(1002,d,i,n):this.addPolygon(1002,p,i,n)}drawPath(e,r,i,n,s){if(e.length==0){for(let a of r.primitives)if(a instanceof M){let l=new Ic(i);l.visible(i,a.start(),a.end(),!0,0,0,n,s),e.push(l)}else if(a instanceof q){let l=new ty(i);l.visible(i,a.center,a.rx,a.startAngle/180*Math.PI,a.endAngle()/180*Math.PI,a.sweep(),n,s),e.push(l)}}else{let a=0;for(let c of r.primitives){let h=e[a];c instanceof M?(h==null?(h=new Ic(i),e.push(h)):h instanceof Ic||(h.remove(),h=new Ic(i),e.splice(a,1,h)),h.visible(i,c.start(),c.end(),!0,0,0,n,s)):c instanceof q&&(h==null?(h=new ty(i),e.push(h)):h instanceof ty||(h.remove(),h=new ty(i),e.splice(a,1,h)),h.visible(i,c.center,c.rx,c.startAngle/180*Math.PI,c.endAngle()/180*Math.PI,c.sweep(),n,s)),a++}let l=e.splice(a,e.length-a);for(let c of l)c.remove()}}createExtendsPolygon(e=ee.BLACK,r=!1){let i=this.getPolylineMap(r),{topPasteShapes:n,bottomPasteShapes:s,topSolderShapes:a,bottomSolderShapes:l}=i,c=this.wireViewGroupId;return!this.topSolder&&a!=null&&(this.topSolder=this.addPolygon(5,a,e,c)),!this.topPaste&&n!=null&&(this.topPaste=this.addPolygon(7,n,e,c)),!this.bottomSolder&&l!=null&&(this.bottomSolder=this.addPolygon(6,l,e,c)),!this.bottomPaste&&s!=null&&(this.bottomPaste=this.addPolygon(8,s,e,c)),i}removeFill(e){this.maskVisible(!1,!0);for(let r=0;r<this.pathIndex.length;r++)this.pathIndex[r]&&this.pathIndex[r].remove();this.pathIndex.length=0,this.padsLayer.length=0,this.removeTopSolder(),this.removeTopPaste(),this.removeBottomSolder(),this.removeBottomPaste(),this.componentMaskVisible(!1,e)}mainVisible(e,r){r!=null&&(this.grayIndex=r);let i=this.color,n=!i.equals(this._lastColor);n&&(this._lastColor=i),(this.layerModified||n||this.path.length==0||this.shapeModified||this.viewGroupIdModified)&&this.drawPath(this.path,this.shapes,this.layerId,i,null);let a=this.createExtendsPolygon(i,n);this.fillEach(i,n),this.holeVisible(e),this.maskVisible(!1,!0),this.maskShapes=this.createMask(this.maskShapes,a,ee.of6(ee.BLACK,1e-6),this.viewGroupId);let l=this.resetHighLightState;return this.maskShapes.setRemoveCb(l),this.manualHighLightModified&&this.path.forEach(c=>{c.forceVisibleHighLight(this.manualHighLight)}),a}maskVisible(e,r=!1,i){if(!this.maskShapes)return;let n=this.highlightColor||this.color;if(this.isWebglEnv()){e?this.mask=this.createMask(this.mask,i,n):this.mask&&(this.mask.remove(),delete this.mask);return}this.mainMaskHighLightColor(this.maskShapes,r,e?this.highLightType:null,n)}componentMaskVisible(e,r,i){e&&this.highlightByComponent?r!="Main And Highlight"&&(this.maskByComponent=this.createMask(this.maskByComponent,i,this.highlightMaskColor)):this.maskByComponent&&(this.maskByComponent.remove(),delete this.maskByComponent)}holeVisible(e){if(this.hole!=null){let{holeColor:r=ee.BLACK}=this;this.holeView||(this.holeView=new Ck(this)),this.holeView.modify(this.hole,e,47,r,this.highlightByComponent)}else this.removeHoleView()}visible(e){this.maskVisible(!1,!1);let r=this.mainVisible("Only Main",e);return this.componentMaskVisible(!0,"Only Main",r),r}highlight(){let e=this.mainVisible("Main And Highlight");return this.maskVisible(!0,this.forceUpdateMask,e),this.componentMaskVisible(!0,"Main And Highlight",e),e}refreshShapeViews(e,r){return e?this.highlight():this.visible(r)}modify(e,r){let{grayIndex:i}=e;switch(o._viewDataModel=e,this.updateFill(),this.grayIndex=i,this.createNetAndNumberView(),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){this.removeFill("Not Show Fill");for(let e of this.path)e.remove();this.path.length=0,this.removeHoleView(),this.removeNetView(),this.removeNumView(),this.removeMaskShape()}removeHoleView(){this.holeView&&(this.holeView.remove(),delete this.holeView)}removeNetView(){this.netView&&(this.netView.remove(),delete this.netView)}removeNumView(){this.numView&&(this.numView.remove(),delete this.numView)}removeTopSolder(){this.topSolder&&(this.topSolder.remove(),delete this.topSolder)}removeTopPaste(){this.topPaste&&(this.topPaste.remove(),delete this.topPaste)}removeBottomSolder(){this.bottomSolder&&(this.bottomSolder.remove(),delete this.bottomSolder)}removeBottomPaste(){this.bottomPaste&&(this.bottomPaste.remove(),delete this.bottomPaste)}removeMaskShape(){this.maskShapes&&(this.maskShapes.remove(),delete this.maskShapes)}};var rte=Math.PI*2;function an(o,t){if(o.length==0)return o;if(t instanceof M){let e=t.start();Er(o,(r,i)=>r.distance2(e)-i.distance2(e),0,o.length)}else{let e=t.center,r=t.start().sub(e).normalize(),i=t.sweep();Er(o,(n,s)=>{let a=n.sub(e).normalize(),l=s.sub(e).normalize(),c=ite(r.dot(a)),h=ite(r.dot(l)),u=r.cross(a),d=r.cross(l),p=Math.acos(c),m=Math.acos(h);return(i==ae.CCW&&ne.less(u,0)||i==ae.CW&&ne.greater(u,0))&&(p=rte-p),(i==ae.CCW&&ne.less(d,0)||i==ae.CW&&ne.greater(d,0))&&(m=rte-m),p-m},0,o.length),t.start().equals(t.end())&&o.push(t.end())}return o}function ite(o){return o>1?1:o<-1?-1:o}function nIe(o){return o/180*Math.PI}function P0(o,t){if(o.length==0)return o;if(t instanceof M){let e=t.start();Er(o,(r,i)=>r.point.distance2(e)-i.point.distance2(e),0,o.length)}else{let e=t.center,r=t.start().sub(e).normalize(),i=t.sweep();Er(o,(n,s)=>{let a=n.point.sub(e).normalize(),l=s.point.sub(e).normalize(),c=ite(r.dot(a)),h=ite(r.dot(l)),u=r.cross(a),d=r.cross(l),p=Math.acos(c),m=Math.acos(h);return(i==ae.CCW&&ne.less(u,0)||i==ae.CW&&ne.greater(u,0))&&(p=rte-p),(i==ae.CCW&&ne.less(d,0)||i==ae.CW&&ne.greater(d,0))&&(m=rte-m),p-m},0,o.length)}return o}var KCt=[48,49,50,51],Kv=class extends eI{constructor(){super();this.lastHighlightMap={};Ro("view/pcb/PolygonView")}get type(){var e;return(e=this._viewDataModel)==null?void 0:e.type}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get outline(){var e;return(e=this._viewDataModel)==null?void 0:e.outline}get strokeWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.strokeWidth}get fillColor(){return this._fillColor}set fillColor(e){this._fillColor=e}get constrainName(){return this._constrainName}set constrainName(e){e==""?this._constrainName!=null&&(this._constrainName=e):this._constrainName!=e&&(this._constrainName=e)}get fpcMaterial(){return this._fpcMaterial}set fpcMaterial(e){e==""?this._fpcMaterial!=null&&(this._fpcMaterial=e):this._fpcMaterial!=e&&(this._fpcMaterial=e)}get fpcThickness(){return this._fpcThickness}set fpcThickness(e){e==""?this._fpcThickness!=null&&(this._fpcThickness=e):this._fpcThickness!=e&&(this._fpcThickness=e)}get partitionName(){var e;return(e=this._viewDataModel)==null?void 0:e.partitionName}get component(){var e;return(e=this._viewDataModel)==null?void 0:e.component}get fillState(){var e;return(e=this._viewDataModel)==null?void 0:e.fillState}get childrenModified(){var e;return(e=this._viewDataModel)==null?void 0:e.childrenModified}removeMask(){this._mask&&(this._mask.remove(),delete this._mask)}removeFill(){if(this.filling){for(let e of this.filling)e.remove();delete this.filling}this.holeBaseNetRemove(),this.fpcBaseNetRemove()}fill(){var i,n;let e=this.fillColor,r=this.filling==null;switch(this.type){case"Board Outline":break;case"Fill Region":case"TearDrop":this.filling||(this.filling=[this.fillRegion(this.layerId,e)]);break;case"FPC Stiffener":{this.filling||(this.filling=this.fillFPC(this.layerId,e));break}case"Slot Region":this.filling||(this.filling=[this.fillRegion(47,e)]);break;case"Prohibited Region":this.filling||(this.filling=this.fillGrid());break;case"Constraint Region":{this.filling||(this.filling=this.fillConstraint(this.layerId,e));break}case"Partition":{this.removeFill(),this.filling||(this.filling=this.fillPartition(this.layerId,e));break}case"Line":break;case"Copper Region":break;case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":this.filling||(this.filling=[this.fillRegion(this.layerId,e)]);break;case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":this.filling||(this.filling=[this.fillRegion(this.layerId,e)]);break;case"3D Shell - Side Datum Line":{(i=this.filling)==null||i.forEach(s=>{s.remove()}),this.filling=this.fillStyle();break}case"3D Shell - Outline":{this.filling||(this.filling=this.fillPolygonOutline());break}case"Board":{this.filling||(this.filling=[this.fillRegion(this.layerId,e)]);break}}(r&&this.manualHighLight||this.manualHighLightModified)&&((n=this.filling)==null||n.forEach(s=>{s.forceVisibleHighLight(this.manualHighLight)}),this._fpcNameBaseNet&&this._fpcNameBaseNet.forceVisibleHighLight(this.manualHighLight),this._fpcNumberBaseNet&&this._fpcNumberBaseNet.forceVisibleHighLight(this.manualHighLight),this._holeBaseNet&&this._holeBaseNet.forceVisibleHighLight(this.manualHighLight))}fillRegion(e,r){let i=this.outline;if(i instanceof Bt){let n=new JC(e);return n.visible(e,i.items,r,this.viewGroupId),n}else{let n=new Gk(e);return n.visible(e,i,r,this.viewGroupId),n}}fillGrid(){let e=this.outline instanceof Bt?this.outline.items[0]:this.outline,r=VO(e),i=new Array;for(let n of r){let s=new Ic(this.layerId);s.visible(this.layerId,n.start(),n.end(),!0,0,0,this.fillColor,this.viewGroupId),i.push(s)}return i}fillConstraint(e,r){let i=[];return i.push(this.fillRegion(e,r)),this.holeBaseNetVisible(),i}fillPartition(e,r){let i=[];return i.push(this.fillRegion(e,r)),this.holeBaseNetVisible(!0,e),i}fillFPC(e,r){let i=[];return i.push(this.fillRegion(e,r)),this.fpcMaterial&&this.fpcBaseNetVisible(),i}fillStyle(){let e=new Array;if(this.type=="3D Shell - Side Datum Line"){let r=this.outline.primitives[0];if(this.outline.primitives.length==1&&r instanceof M){let i=r.direct,n=1.9685,s=3,a=r.end();for(let c=0;c<s;c++){let h=a,u=h.add(i.mul(n)),d=new Ds(this.layerId);d.visible(this.layerId,h,u,this.strokeWidth,ee.WHITE,this.viewGroupId,void 0),e.push(d),a=u.add(i.mul(n))}let l=r.start();for(let c=0;c<s;c++){let h=l,u=h.sub(i.mul(n)),d=new Ds(this.layerId);d.visible(this.layerId,h,u,this.strokeWidth,ee.WHITE,this.viewGroupId,void 0),e.push(d),l=u.sub(i.mul(n))}}}return e}fillPolygonOutline(){if(this.component instanceof y0){let e=this.component;if(!e||e.topInnerHeight<=0&&e.bottomInnerHeight<=0)return[];let r=cn.getInstance().getLayer(54),i=cn.getInstance().getLayer(55),n=e.topInnerHeight>0?r.activeColor:i.activeColor,s=.3937,a=5.90551,l=this.strokeWidth/2+a/2+s,c=X0(this.outline,-l),h=new Array;if(c.length>0)for(let u of c){let d=u.items;for(let p of d)for(let m of p.primitives){let g;m instanceof M?(g=new Ds(this.layerId),g.visible(this.layerId,m.start(),m.end(),a,n,this.viewGroupId,void 0)):m instanceof q&&(g=new Ka(this.layerId),g.visible(this.layerId,m.center,m.rx,a,nIe(m.startAngle),nIe(m.endAngle()),m.sweep(),n,this.viewGroupId)),h.push(g)}}return h}return[]}mainVisible(){let e=this.lineColor,r=this.layerModified||this.viewGroupIdModified||this._lastLineColor!=e&&!e.equals(this._lastLineColor);this._lastLineColor=e;let{layerId:i,strokeWidth:n,viewGroupId:s,manualHighLight:a,manualHighLightModified:l}=this,c=this.getAllChildIds(),h=0;for(let u of this._viewDataModel.childrens)if(Array.isArray(u))for(let d of u){let p=this.visibleChild(d,i,d.modelType,this._lineType,n,e,s,r);c.delete(d.globalIndex),l&&p.forceVisibleHighLight(a),h++}else{let d=this.visibleChild(u,i,u.modelType,this._lineType,n,e,s,r);c.delete(u.globalIndex),l&&d.forceVisibleHighLight(a),h++}for(let u of c){let d=this.getChild(u);delete this.lastHighlightMap[u],d.remove(),this.deleteChild(u)}if(h>100&&!(this.mains instanceof Map)){let u=new Map;for(let d in this.mains)u.set(d,this.mains[d]);this.mains=u}}getAllChildIds(){return this.mains instanceof Map?new Set(this.mains.keys()):new Set(Object.keys(this.mains))}getChild(e){return this.mains instanceof Map?this.mains.get(e):this.mains[e]}setChild(e,r){this.mains instanceof Map?this.mains.set(e,r):this.mains[e]=r}deleteChild(e){this.mains instanceof Map?this.mains.delete(e):delete this.mains[e]}clearChilds(){if(this.mains!=null)if(this.mains instanceof Map)this.mains.forEach(e=>e.remove()),this.mains.clear(),this.mains=null;else{for(let e in this.mains)this.mains[e].remove();this.mains=null}}visibleChild(e,r,i,n,s,a,l,c){let{line:h,match:u}=this.getMain(e.globalIndex,r,i,n);if(c=c||!u||e.shapeModified,c)switch(i){case"Line":{this.visibleLine(h,e,r,s,a,l);break}case"Arc":{this.visibleArc(h,e,r,s,a,l);break}}return h}getMain(e,r,i,n){let s=this.getChild(e),a=!0;return s==null?a=!1:i=="Line"?n=="line"?a=s instanceof Ds:a=s instanceof Ic:n=="line"?a=s instanceof Ka:a=s instanceof ty,a||(i=="Line"?n=="line"?s=new Ds(r):s=new Ic(r):n=="line"?s=new Ka(r):s=new ty(r),this.setChild(e,s)),{line:s,match:a}}visibleLine(e,r,i,n,s,a){e&&(e instanceof Ic?e.visible(i,r.start,r.end,this.lineSolid,3,2,s,a):e.visible(i,r.start,r.end,n,s,a,void 0))}visibleArc(e,r,i,n,s,a){e&&(e instanceof Ka?e.visible(i,r.center,r.radius,n,r.startAngle,r.endAngle,r.sweep,s,a):e.visible(i,r.center,r.radius,r.startAngle,r.endAngle,r.sweep,s,a))}visible(){let e=this.mains==null||Object.keys(this.mains).length==0;this.maskVisible(!1),this.mainVisible(),this.type==="Partition"?this.fill():this.fillState==0?this.fill():this.removeFill(),e&&this.maskVisible(!1),this.removeMask()}highlight(){this.mainVisible(),this.removeFill();let e=this.highlightColor||ee.BLACK;this.fillState==0?this.type!="Line"&&this.type!="Board Outline"&&this.type!="3D Shell - Outline"&&this.type!="3D Shell - Side Datum Line"&&(this.removeMask(),this._mask=this.fillRegion(1002,e)):this.removeMask(),this.maskVisible(!0,this.forceUpdateMask,e)}visibleMain(){this.mainVisible(),this.removeFill();let e=this.highlightColor||ee.BLACK;this.maskVisible(!0,this.forceUpdateMask,e)}modify(e,r){let i=this.fillColor,n=this.constrainName||"",s=this.fpcMaterial||"",a=this.fpcThickness||"";super.modify(e,r);let{lineSolid:l,fillColor:c,constrainName:h,fpcMaterial:u,fpcThickness:d}=e;this.lineSolid=l,this.fillColor=c,this.constrainName=h||void 0,this.fpcMaterial=u||void 0,this.fpcThickness=d||void 0;let p=this._lineType;switch(this._lineType=this.lineType(e.strokeWidth),this.initChild(),(this.layerModified||p!=this._lineType)&&this.removePoly(),(this.layerModified||this.shapeModified||this.childrenModified||this.viewGroupIdModified||!c.equals(i)||h!=n||u!=s||d!=a)&&(this.removeMask(),this.removeFill()),this.initChild(),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}case"Not Show Fill":{this.visibleMain();break}default:break}KCt.includes(this.layerId)&&this.removeMask()}initChild(){this.mains==null&&(this.mains={})}removePoly(){this.maskVisible(!1,!0),this.clearChilds()}maskVisible(e,r=!1,i){e=r?e:!0;for(let n of this._viewDataModel.childrens)if(Array.isArray(n))for(let s of n){let a=this.getChild(s.globalIndex);s.isHighLight&&e?this.mainMaskHighLightColor(a,r,this.getHighLightType(s),i,s.globalIndex):this.mainMaskHighLightColor(a,r,e?this.highLightType:null,i,s.globalIndex)}else{let s=this.getChild(n.globalIndex);n.isHighLight&&e?this.mainMaskHighLightColor(s,r,this.getHighLightType(n),i,n.globalIndex):this.mainMaskHighLightColor(s,r,e?this.highLightType:null,i,n.globalIndex)}}getHighLightType(e){return e.highLightBySelect?1:e.highLightByHover?0:null}mainMaskHighLightColor(e,r,i,n,s){let a=this.lastHighlightMap[s];!e||!r&&(a==null?void 0:a[0])==i||(a!=null&&e.highlight(!1,a[0],a[1]),i!=null&&e.highlight(!0,i,n),i==null?delete this.lastHighlightMap[s]:this.lastHighlightMap[s]=[i,n])}holeBaseNetVisible(e=!1,r=47){var h;if(e)(h=this._holeBaseNet)==null||h.remove();else if(this._holeBaseNet)return;let i="";switch(this.type){case"Constraint Region":i=this.constrainName;break;case"Partition":i=this.lineColor.alpha===0?"":this.partitionName;break;default:break}if(!i||!cn.getInstance().getLayer(this.layerId).status.visible)return;let n=r||47,s=new rI(this.outline),a=s.center,l=this.outline.bbox().width(),c=s.high;this._holeBaseNet||(this._holeBaseNet=new vl(n)),this._holeBaseNet.visible(n,i,a,0,10,15,l*.65,c)}holeBaseNetRemove(){this._holeBaseNet&&(this._holeBaseNet.remove(),delete this._holeBaseNet)}fpcBaseNetVisible(){let e=this.fpcMaterial,r=this.fpcThickness;if(!e||!cn.getInstance().getLayer(this.layerId).status.visible)return;let i=new rI(this.outline),n=i.center,s=this.outline.bbox().width(),a=i.high,l=n.add1(0,.25*a),c=n.add1(0,-.25*a),h=1003;this._fpcNameBaseNet||(this._fpcNameBaseNet=new vl(h)),this._fpcNumberBaseNet||(this._fpcNumberBaseNet=new vl(h)),this._fpcNameBaseNet.visible(h,e,l,0,Pc,Tc,s*.65,a),this._fpcNumberBaseNet.visible(h,`${r}mm`,c,0,Pc,Tc,s*.65,a)}fpcBaseNetRemove(){this._fpcNameBaseNet&&(this._fpcNameBaseNet.remove(),delete this._fpcNameBaseNet),this._fpcNumberBaseNet&&(this._fpcNumberBaseNet.remove(),delete this._fpcNumberBaseNet)}remove(){this.removePoly(),this.removeMask(),this.removeFill()}};var $z=class extends Do{get layerId(){var t;return(t=this._viewDataModel)==null?void 0:t.layerId}get strokeWidth(){var t;return(t=this._viewDataModel)==null?void 0:t.strokeWidth}get center(){var t;return(t=this._viewDataModel)==null?void 0:t.center}get start(){var t;return(t=this._viewDataModel)==null?void 0:t.start}get end(){var t;return(t=this._viewDataModel)==null?void 0:t.end}get textPath(){var t;return(t=this._viewDataModel)==null?void 0:t.textPath}get textMatrix(){var t;return(t=this._viewDataModel)==null?void 0:t.textMatrix}get width(){var t;return(t=this._viewDataModel)==null?void 0:t.viewWidth}get height(){var t;return(t=this._viewDataModel)==null?void 0:t.viewHeight}get outlineModified(){var t;return(t=this._viewDataModel)==null?void 0:t.outlineModified}getData(){let t=this.start.sub(this.center),e=this.end.sub(this.center),r=Math.atan2(t.y,t.x),i=Math.atan2(e.y,e.x);r==i&&(i+=1e-8);let s=t.cross(e)>=0?ae.CCW:ae.CW,l=new S(this.width,this.height).multiply4(this.textMatrix).add1(is(this.layerId)?-1:1,0),c=this.strokeWidth/2+.1;return{startAngle:r,endAngle:i,sweep:s,textAngleCenter:l,textAngleRadius:c}}mainVisible(t,e){e||(e=this.getData());let{startAngle:r,endAngle:i,sweep:n,textAngleCenter:s,textAngleRadius:a}=e,{layerId:l}=this,c=!1;this.text||(c=!0,this.text=new DP);let h=this.resetHighLightState;this.startEdge||(c=!0,this.startEdge=new ld(l,h)),this.endEdge||(this.endEdge=new ld(l,h)),this.angleArc||(this.angleArc=new ng(l,h)),this.textAngle||(this.textAngle=new ng(l,h)),this.layerModified&&this.mainRemove();let{start:u,end:d,center:p,strokeWidth:m,textPath:g,textMatrix:y,width:b,height:P,viewGroupId:T}=this,I=ee.BLACK,C=this._viewDataModel.box;if(this.text.modify({partition:this._viewDataModel.partition,globalIndex:this._viewDataModel.globalIndex,layerId:l,box:C,strokeWidth:m,path:g,matrix:y,width:b,height:P,layerModified:this.layerModified,outlineModified:this.outlineModified,highLightType:this.highLightType,highlightColor:this.highlightColor,shapeModified:this.shapeModified,manualHighLight:this.manualHighLight,manualHighLightModified:this.manualHighLightModified},t),c||(c=this.layerModified||this.shapeModified||this.viewGroupIdModified),this.textAngle.visible(l,s,a,m/2,0,kr,ae.CCW,I,T),!c){this.highlightModify();return}this.startEdge.visible(l,p,u,m,I,T,void 0),this.endEdge.visible(l,p,d,m,I,T,void 0),this.angleArc.visible(l,p,10,m,r,i,n,I,T),this.highlightModify()}highlightModify(){this.manualHighLightModified&&(this.textAngle.forceVisibleHighLight(this.manualHighLight),this.startEdge.forceVisibleHighLight(this.manualHighLight),this.endEdge.forceVisibleHighLight(this.manualHighLight),this.angleArc.forceVisibleHighLight(this.manualHighLight))}maskVisible(t,e=!1,r){let i=this.highlightColor||ee.BLACK;if(this.isWebglEnv()){if(!t){this._startEdgeMask&&(this._startEdgeMask.remove(),delete this._startEdgeMask),this._endEdgeMask&&(this._endEdgeMask.remove(),delete this._endEdgeMask),this._angleArcMask&&(this._angleArcMask.remove(),delete this._angleArcMask),this._textAngleMask&&(this._textAngleMask.remove(),delete this._textAngleMask);return}let n=1002;r||(r=this.getData());let{startAngle:s,endAngle:a,sweep:l,textAngleCenter:c,textAngleRadius:h}=r;this._startEdgeMask||(this._startEdgeMask=new Ds(n)),this._endEdgeMask||(this._endEdgeMask=new Ds(n)),this._angleArcMask||(this._angleArcMask=new Ka(n)),this._textAngleMask||(this._textAngleMask=new Ka(n)),this._startEdgeMask.visible(1002,this.center,this.start,this.strokeWidth,i,null),this._endEdgeMask.visible(1002,this.center,this.end,this.strokeWidth,i,null),this._angleArcMask.visible(1002,this.center,10,this.strokeWidth,s,a,l,i,null),this._textAngleMask.visible(1002,c,h,this.strokeWidth/2,0,kr,l,i,null);return}this.mainsMaskHighLightColor([this.startEdge,this.endEdge,this.angleArc,this.textAngle],e,t?this.highLightType:null,i)}visible(){let t=this.getData();this.mainVisible("Only Main",t),this.maskVisible(!1,!1,t)}highlight(){let t=this.getData();this.mainVisible("Main And Highlight",t),this.maskVisible(!0,this.forceUpdateMask,t)}modify(t,e){switch(super.modify(t,e),e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}mainRemove(){var t,e,r,i;this.maskVisible(!1,!0),(t=this.startEdge)==null||t.remove(),(e=this.endEdge)==null||e.remove(),(r=this.angleArc)==null||r.remove(),(i=this.textAngle)==null||i.remove()}remove(){var t;this.mainRemove(),(t=this.text)==null||t.remove()}};var Kz=class extends Do{get layerId(){var t;return(t=this._viewDataModel)==null?void 0:t.layerId}get start(){var t;return(t=this._viewDataModel)==null?void 0:t.start}get end(){var t;return(t=this._viewDataModel)==null?void 0:t.end}get strokeWidth(){var t;return(t=this._viewDataModel)==null?void 0:t.strokeWidth}get textPath(){var t;return(t=this._viewDataModel)==null?void 0:t.textPath}get textMatrix(){var t;return(t=this._viewDataModel)==null?void 0:t.textMatrix}get width(){var t;return(t=this._viewDataModel)==null?void 0:t.viewWidth}get height(){var t;return(t=this._viewDataModel)==null?void 0:t.viewHeight}get outlineModified(){var t;return(t=this._viewDataModel)==null?void 0:t.outlineModified}getData(){let t=this.end.sub(this.start).normalize(),e=Ae.rotateZ(Math.PI/4),r=Ae.rotateZ(-Math.PI/4),i=t.multiply4(e).mul(3),n=t.multiply4(r).mul(3);return{v1:i,v2:n}}mainVisible(t,e){let{layerId:r}=this;e||(e=this.getData());let{v1:i,v2:n}=e,s=!1;if(this.text||(this.text=new DP,s=!0),this.lines)this.layerModified&&(this.mainRemove(),s=!0);else{let m=this.resetHighLightState;this.lines=[new ld(r,m),new ld(r,m),new ld(r,m)],s=!0}let a=this._viewDataModel.box;if(this.text.modify({partition:this._viewDataModel.partition,globalIndex:this._viewDataModel.globalIndex,layerId:r,box:a,strokeWidth:this.strokeWidth,path:this.textPath,matrix:this.textMatrix,width:this.width,height:this.height,highLightType:this.highLightType,highlightColor:this.highlightColor,layerModified:this.layerModified,shapeModified:this.shapeModified,outlineModified:this.outlineModified,manualHighLight:this.manualHighLight,manualHighLightModified:this.manualHighLightModified},t),!(s||this.layerModified||this.shapeModified||this.viewGroupIdModified)){this.highlightModify();return}let{start:c,end:h,strokeWidth:u,viewGroupId:d}=this,p=ee.BLACK;this.lines[0].visible(r,c,h,u,p,d,void 0),this.lines[1].visible(r,h,h.sub(n),u,p,d,void 0),this.lines[2].visible(r,h,h.sub(i),u,p,d,void 0),this.highlightModify()}highlightModify(){this.manualHighLightModified&&this.lines.forEach(t=>{t.forceVisibleHighLight(this.manualHighLight)})}maskVisible(t,e=!1,r){let i=this.highlightColor||ee.BLACK;if(this.isWebglEnv()){if(!t){this.masks&&(this.masks.forEach(a=>a.remove()),delete this.masks);return}r||(r=this.getData());let{v1:n,v2:s}=r;this.masks||(this.masks=[new Ds(1002),new Ds(1002),new Ds(1002)]),this.masks[0].visible(1002,this.start,this.end,this.strokeWidth,i,null),this.masks[1].visible(1002,this.end,this.end.sub(s),this.strokeWidth,i,null),this.masks[2].visible(1002,this.end,this.end.sub(n),this.strokeWidth,i,null);return}this.mainsMaskHighLightColor(this.lines,e,t?this.highLightType:null,i)}visible(){let t=this.getData();this.mainVisible("Only Main",t),this.maskVisible(!1,!1,t)}highlight(){let t=this.getData();this.mainVisible("Main And Highlight",t),this.maskVisible(!0,this.forceUpdateMask,t)}modify(t,e){switch(super.modify(t,e),e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}mainRemove(){this.maskVisible(!1,!0);for(let t of this.lines)t.remove()}remove(){var t;this.mainRemove(),(t=this.text)==null||t.remove()}};var Zz=class extends Do{constructor(){super()}get layerId(){var t;return(t=this._viewDataModel)==null?void 0:t.layerId}get start(){var t;return(t=this._viewDataModel)==null?void 0:t.start}get end(){var t;return(t=this._viewDataModel)==null?void 0:t.end}get color(){var t;return(t=this._viewDataModel)==null?void 0:t.color}mainVisible(){let t=!1;if(this.line)this.layerModified&&(this.mainRemove(),t=!0);else{let r=this.resetHighLightState;this.line=new Av(this.layerId,r),t=!0}let e=this.color;t||(t=this.layerModified||this.shapeModified||this.viewGroupIdModified||!e.equals(this._lastColor)),t&&(this.line.visible(this.layerId,this.start,this.end,!0,0,0,e,this.viewGroupId),this._lastColor=e),this.manualHighLightModified&&this.line.forceVisibleHighLight(this.manualHighLight)}maskVisible(t,e=!1){if(this.line){if(this.isWebglEnv()){if(!t){this._mask&&(this._mask.remove(),delete this._mask);return}let r=this.highlightColor||ee.BLACK;this._mask||(this._mask=new Ic(1002)),this._mask.visible(1002,this.start,this.end,!0,0,0,r,null);return}this.mainMaskHighLightColor(this.line,e,t?this.highLightType:null)}}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0,this.forceUpdateMask)}modify(t,e){switch(super.modify(t,e),e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}mainRemove(){this.maskVisible(!1,!0),this.line.remove()}remove(){this.mainRemove()}};var ZCt=[48,49,50,51],kL=class extends eI{constructor(){super(...arguments);this.lines=new Array;this.layers=[]}get type(){var e;return(e=this._viewDataModel)==null?void 0:e.type}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get leftLow(){var e;return(e=this._viewDataModel)==null?void 0:e.leftLow}get leftUp(){var e;return(e=this._viewDataModel)==null?void 0:e.leftUp}get rightUp(){var e;return(e=this._viewDataModel)==null?void 0:e.rightUp}get rightLow(){var e;return(e=this._viewDataModel)==null?void 0:e.rightLow}get radius(){var e;return(e=this._viewDataModel)==null?void 0:e.radius}get strokeWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.strokeWidth}get viewColor(){var e;return(e=this._viewDataModel)==null?void 0:e.viewColor}get constrainName(){return this._constrainName}set constrainName(e){this._constrainName=e}get fillColor(){return this._fillColor}set fillColor(e){this._fillColor=e}get fpcMaterial(){return this._fpcMaterial}set fpcMaterial(e){this._fpcMaterial=e}get fpcThickness(){return this._fpcThickness}set fpcThickness(e){this._fpcThickness=e}get partitionName(){var e;return(e=this._viewDataModel)==null?void 0:e.partitionName}get component(){var e;return(e=this._viewDataModel)==null?void 0:e.component}get outline(){let e=this.leftLow.add(this.leftUp).mul(.5),r=this.rightLow.add(this.rightUp).mul(.5),i=this.leftLow.distance1(this.leftUp),n=this.leftLow.distance1(this.rightLow),s=this.radius*2/Math.min(i,n);return ag(e,r,i,s)}drawRect(e,r,i,n){let s=this.rightLow.sub(this.leftLow).normalize(),a=this.leftUp.sub(this.leftLow).normalize(),l=this.leftLow.add(s.mul(this.radius)),c=this.rightLow.add(s.mul(-this.radius)),h=this.rightLow.add(a.mul(this.radius)),u=this.rightUp.add(a.mul(-this.radius)),d=this.rightUp.add(s.mul(-this.radius)),p=this.leftUp.add(s.mul(this.radius)),m=this.leftUp.add(a.mul(-this.radius)),g=this.leftLow.add(a.mul(this.radius)),y=[g,m,p,d,u,h,c,l],b=0;for(let x of r)x instanceof Ds?x.visible(e,y[b],y[b+1],this.strokeWidth,n,this.viewGroupId,void 0):x.visible(e,y[b],y[b+1],this.lineSolid,3,2,n,this.viewGroupId),b+=2;if(!i)return;let P=l.add(a.mul(this.radius)),T=m.add(s.mul(this.radius)),I=d.add(a.mul(-this.radius)),C=h.add(s.mul(-this.radius)),E=[P,T,I,C],O=[l,g,m,p,d,u,h,c],_=0;for(let x of i){let v=E[_],D=O[_*2].angle(v),w=O[_*2+1].angle(v);x instanceof Ka?x.visible(e,v,this.radius,this.strokeWidth,D,w,ae.CW,n,this.viewGroupId):x.visible(e,v,this.radius,D,w,ae.CW,n,this.viewGroupId),_++}}removeRect(){this.rectMasksVisible(!1,!0),this.lines.forEach(e=>e.remove()),this.lines.length=0,this.corners&&(this.corners.forEach(e=>e.remove()),delete this.corners)}rectMasksVisible(e,r=!1,i){var s,a;if(this.isWebglEnv()){if(!e){(s=this._lineMasks)==null||s.forEach(c=>c.remove()),delete this._lineMasks,(a=this._cornerMasks)==null||a.forEach(c=>c.remove()),delete this._cornerMasks;return}let l=1002;if(!this._lineMasks){this._lineMasks=[];for(let c=0;c<4;c++)this._lineMasks.push(new Ds(l))}if(this.radius>0&&!this._cornerMasks){this._cornerMasks=[];for(let c=0;c<4;c++)this._cornerMasks.push(new Ka(l))}this.drawRect(l,this._lineMasks,this._cornerMasks,i);return}let n=this._viewDataModel.selectChildId;if(this._lastSelectChildId==n)if(n!=null){let l=this.lines[n/2];this.mainsMaskHighLightColor([l],r,e?this.highLightType:null,i)}else this.mainsMaskHighLightColor([].concat(this.lines,this.corners||[]),r,e?this.highLightType:null,i);else{if(this._lastSelectChildId!=null){let l=this.lines[this._lastSelectChildId/2];this.mainsMaskHighLightColor([l],r,null,i),this._lastSelectChildId=void 0}else this.mainsMaskHighLightColor([].concat(this.lines,this.corners||[]),r,null,i);if(n==null)this.mainsMaskHighLightColor([].concat(this.lines,this.corners||[]),r,e?this.highLightType:null,i);else if(e){let l=this.lines[n/2];this.mainsMaskHighLightColor([l],r,e?this.highLightType:null,i),this._lastSelectChildId=n}else this.mainsMaskHighLightColor([].concat(this.lines,this.corners||[]),r,e?this.highLightType:null,i)}}removeAnnotationLines(){this.annotationLines&&(Hn(this.annotationLines,(e,r)=>{r.forEach(i=>i.remove())}),delete this.annotationLines)}fill(){var i;let e=this.fillColor,r=this.filling==null;switch(this.type){case"Board Outline":break;case"Fill Region":(!this.filling||this.filling.length==0)&&(this.filling=[],this.filling.push(this.fillRegion(this.layerId,e)));break;case"FPC Stiffener":(!this.filling||this.filling.length==0)&&(this.filling=this.fillFPC(this.layerId,e));break;case"Slot Region":(!this.filling||this.filling.length==0)&&(this.filling=[],this.filling.push(this.fillRegion(47,e)));break;case"Prohibited Region":(!this.filling||this.filling.length==0)&&(this.filling=this.fillGrid(e));break;case"Constraint Region":(!this.filling||this.filling.length==0)&&(this.filling=this.fillConstraint(this.layerId,e));break;case"Partition":{this.removeFill(),this.filling=this.fillPartition(this.layerId,e);break}case"Line":break;case"Copper Region":break;case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":(!this.filling||this.filling.length==0)&&(this.filling=[],this.filling.push(this.fillRegion(this.layerId,e)));break;case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":(!this.filling||this.filling.length==0)&&(this.filling=[],this.filling.push(this.fillRegion(this.layerId,e)));break;case"3D Shell - Outline":{(!this.filling||this.filling.length==0)&&(this.filling=this.fillCircleOutline());break}case"Board":{this.filling||(this.filling=[this.fillRegion(this.layerId,e)]);break}}(r&&this.manualHighLight||this.manualHighLightModified)&&((i=this.filling)==null||i.forEach(n=>{n.forceVisibleHighLight(this.manualHighLight)}),this._fpcNameBaseNet&&this._fpcNameBaseNet.forceVisibleHighLight(this.manualHighLight),this._fpcNumberBaseNet&&this._fpcNumberBaseNet.forceVisibleHighLight(this.manualHighLight),this._holeBaseNet&&this._holeBaseNet.forceVisibleHighLight(this.manualHighLight))}removeFill(){this.fillMasksVisible(!1),this.filling&&(this.filling.forEach(e=>e.remove()),delete this.filling),this.holeBaseNetRemove(),this.fpcBaseNetRemove()}fillMasksVisible(e,r){var i;if(!e){(i=this._fillMask)==null||i.remove(),delete this._fillMask;return}this._fillMask||(this._fillMask=new b0(1002)),this._fillMask.visible(1002,this.leftUp,this._viewDataModel.width,this._viewDataModel.height,this._viewDataModel.rotation,this._viewDataModel.radius,r,this.viewGroupId)}fillRegion(e,r){let i=new b0(e);return i.visible(e,this.leftUp,this._viewDataModel.width,this._viewDataModel.height,this._viewDataModel.rotation,this._viewDataModel.radius,r,this.viewGroupId,void 0),i}fillGrid(e=ee.Gray){let r=VO(this.outline),i=new Array;for(let n of r){let s=new Ic(this.layerId);s.visible(this.layerId,n.start(),n.end(),!0,0,0,e,this.viewGroupId),i.push(s)}return i}fillConstraint(e,r){let i=[];return i.push(this.fillRegion(e,r)),this.holeBaseNetVisible(),i}fillPartition(e,r){let i=[];return i.push(this.fillRegion(e,r)),this.holeBaseNetVisible(!0,e),i}fillFPC(e,r){let i=[];return i.push(this.fillRegion(e,r)),this.fpcMaterial&&this.fpcBaseNetVisible(),i}fillCircleOutline(){if(this.component instanceof y0){let e=this.component;if(!e||e.topInnerHeight<=0&&e.bottomInnerHeight<=0)return[];let r=cn.getInstance().getLayer(54),i=cn.getInstance().getLayer(55),n=e.topInnerHeight>0?r.activeColor:i.activeColor,s=.3937,a=5.90551,l=this.strokeWidth/2+a/2+s,c=X0(this.outline,-l),h=new Array;if(c.length>0)for(let u of c){let d=u.items;for(let p of d)for(let m of p.primitives){let g;m instanceof M?(g=new Ds(this.layerId),g.visible(this.layerId,m.start(),m.end(),a,n,this.viewGroupId,void 0)):m instanceof q&&(g=new Ka(this.layerId),g.visible(this.layerId,m.center,m.rx,a,Xh(m.startAngle),Xh(m.endAngle()),m.sweep(),n,this.viewGroupId)),h.push(g)}}return h}return[]}lineTypeChanged(e){if(this.lines.length>0)return e=="lineSegment"?this.lines[0]instanceof Ds:this.lines[0]instanceof Ic}mainVisible(){let e=this.lineColor;if(this._needModify||this.layerModified||this.shapeModified||this.viewGroupIdModified||!e.equals(this._lastLineColor))if(delete this._needModify,this._lastLineColor=e,this.type=="Annotation"){if(!this.annotationLines)return;this.layers.forEach(i=>{this.drawRect(i,this.annotationLines[i],this.corners,e)})}else this.drawRect(this.layerId,this.lines,this.corners,e)}hightItem(){var e,r;(this.manualHighLightModified||this._needModify&&this.manualHighLight)&&((e=this.lines)==null||e.forEach(i=>{i.forceVisibleHighLight(this.manualHighLight)}),(r=this.corners)==null||r.forEach(i=>{i.forceVisibleHighLight(this.manualHighLight)}),this.annotationLines&&this.layers.forEach(i=>{let n=this.annotationLines[i];n==null||n.forEach(s=>{s.forceVisibleHighLight(this.manualHighLight)})}))}maskVisible(e,r,i=!1,n){this.rectMasksVisible(e,i,n),this.fillMasksVisible(r,n)}visible(){this.maskVisible(!1,!1),this.mainVisible(),this.fill()}highlight(){this.mainVisible(),this.removeFill();let e=this.highlightColor||ee.BLACK,r=!["Line","Board Outline","3D Shell - Outline"].includes(this.type);this.maskVisible(!0,r,this.forceUpdateMask,e)}visibleMain(){this.mainVisible(),this.removeFill(),this.maskVisible(!0,!1,!1)}modify(e,r){var I;let i=this.fillColor,n=this.constrainName||"",s=this.fpcMaterial||"",a=this.fpcThickness||"";super.modify(e,r);let{layerId:l,lineSolid:c,radius:h,strokeWidth:u,fillColor:d,constrainName:p,fpcMaterial:m,fpcThickness:g,layers:y}=e;this.lineSolid=c,this.fillColor=d,this.constrainName=p||void 0,this.fpcMaterial=m||void 0,this.fpcThickness=g||void 0;let b=this.layers;this.layers=y;let P=this.lineType(u);(this.layerModified||this.lineTypeChanged(P))&&this.removeRect();let T=!1;if(this.type=="Annotation"){let C={};for(let _ of b)C[_]=!0;let E=[],O=[];Hn(y,(_,x)=>{if(!C[x]){E.push(x);return}delete C[x]}),Hn(C,_=>{O.push(Number(_))}),this.annotationLines||(this.annotationLines={}),E.forEach(_=>{let x=this.annotationLines[_]=new Array;for(let v=0;v<4;v++)P==="line"?x.push(new Ds(_)):x.push(new Ic(_));T=!0}),O.forEach(_=>{this.annotationLines[_].forEach(v=>{v.remove()})})}else{let C=this.resetHighLightState;if(this.lines.length==0){for(let E=0;E<4;E++)P=="line"?this.lines.push(new ld(l,C)):this.lines.push(new Av(l,C));T=!0}if(h>0&&(this.corners||(this.corners=[]),this.corners.length==0)){this.maskVisible(!1,!1);for(let E=0;E<4;E++)P=="line"?this.corners.push(new ng(l,C)):this.corners.push(new U9(l,C));T=!0}}switch(this._needModify=T,(this.shapeModified||this.layerModified||this.viewGroupIdModified||!d.equals(i)||p!=n||m!=s||g!=a)&&this.removeFill(),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}case"Not Show Fill":{this.visibleMain();break}default:break}ZCt.includes(this.layerId)&&((I=this._fillMask)==null||I.remove()),this.hightItem()}holeBaseNetVisible(e=!1,r=47){if(e)this._holeBaseNet&&this._holeBaseNet.remove();else if(this._holeBaseNet)return;let i="";switch(this.type){case"Constraint Region":i=this.constrainName;break;case"Partition":i=this.lineColor.alpha===0?"":this.partitionName;break;default:break}if(!i||!cn.getInstance().getLayer(this.layerId).status.visible)return;let n=r||47,s=this.leftLow.add(this.rightUp).mul(.5),a=this.leftLow.distance1(this.rightLow),l=this.leftLow.distance1(this.leftUp);this._holeBaseNet||(this._holeBaseNet=new vl(n)),this._holeBaseNet.visible(n,i,s,0,10,15,a*.75,l)}holeBaseNetRemove(){this._holeBaseNet&&(this._holeBaseNet.remove(),delete this._holeBaseNet)}fpcBaseNetVisible(){let e=this.fpcMaterial,r=this.fpcThickness;if(!e||!cn.getInstance().getLayer(this.layerId).status.visible)return;let i=this.leftLow.add(this.rightUp).mul(.5),n=this.leftLow.distance1(this.rightLow),s=this.leftLow.distance1(this.leftUp),a=i.add1(0,.25*s),l=i.add1(0,-.25*s),c=1003;this._fpcNameBaseNet||(this._fpcNameBaseNet=new vl(c)),this._fpcNumberBaseNet||(this._fpcNumberBaseNet=new vl(c)),this._fpcNameBaseNet.visible(c,e,a,0,Pc,Tc,n*.75,s),this._fpcNumberBaseNet.visible(c,`${r}mm`,l,0,Pc,Tc,n*.75,s)}fpcBaseNetRemove(){this._fpcNameBaseNet&&(this._fpcNameBaseNet.remove(),delete this._fpcNameBaseNet),this._fpcNumberBaseNet&&(this._fpcNumberBaseNet.remove(),delete this._fpcNumberBaseNet)}remove(){this.removeRect(),this.removeAnnotationLines(),this.removeFill()}};var Jz=class extends Do{get layerId(){var t;return(t=this._viewDataModel)==null?void 0:t.layerId}get bbox(){var t;return(t=this._viewDataModel)==null?void 0:t.bbox}get color(){var t;return(t=this._viewDataModel)==null?void 0:t.color}get spotSize(){var t;return(t=this._viewDataModel)==null?void 0:t.spotSize}getAllShapes(){return[this.leftLow,this.rightLow,this.leftUp,this.rightUp,this.center,this.leftLine,this.rightLine,this.topLine,this.bottomLine]}circleVisible(t,e,r,i=this.spotSize,n=this.color){return t=t||new ta(e),t.visible(e,r,i,n,this.viewGroupId),t.forceVisibleHighLight(this.manualHighLight),t}lineSegmentVisible(t,e,r,i,n=!1,s=6,a=4,l=this.color){return t=t||new Ic(e),t.visible(e,r,i,n,s,a,l,this.viewGroupId),t.forceVisibleHighLight(this.manualHighLight),t}mainVisible(){let{bbox:t,layerId:e}=this;this.leftLow=this.circleVisible(this.leftLow,e,t.LL()),this.rightLow=this.circleVisible(this.rightLow,e,t.LR()),this.leftUp=this.circleVisible(this.leftUp,e,t.UL()),this.rightUp=this.circleVisible(this.rightUp,e,t.UR()),this.center=this.circleVisible(this.center,e,t.center()),this.leftLine=this.lineSegmentVisible(this.leftLine,e,t.LL(),t.UL()),this.rightLine=this.lineSegmentVisible(this.rightLine,e,t.LR(),t.UR()),this.topLine=this.lineSegmentVisible(this.topLine,e,t.UR(),t.UL()),this.bottomLine=this.lineSegmentVisible(this.bottomLine,e,t.LR(),t.LL())}visible(){this.mainVisible()}highlight(){this.mainVisible()}modify(t,e){switch(super.modify(t,e),e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){this.getAllShapes().forEach(t=>t.remove())}};var Qz=class o extends Do{constructor(){super(),Ro("view/pcb/TrackView")}get highLightType(){var t;return(t=o._viewDataModel)==null?void 0:t.highLightType}get manualHighLight(){var t;return(t=o._viewDataModel)==null?void 0:t.manualHighLight}get manualHighLightModified(){var t;return(t=o._viewDataModel)==null?void 0:t.manualHighLightModified}get layerModified(){var t;return(t=o._viewDataModel)==null?void 0:t.layerModified}get shapeModified(){var t;return(t=o._viewDataModel)==null?void 0:t.shapeModified}get netModified(){var t;return(t=o._viewDataModel)==null?void 0:t.netModified}get highlightColor(){var t;return(t=o._viewDataModel)==null?void 0:t.highlightColor}get viewGroupIdModified(){var t;return(t=o._viewDataModel)==null?void 0:t.viewGroupIdModified}get forceUpdateMask(){var t;return(t=o._viewDataModel)==null?void 0:t.forceUpdateMask}get layerId(){var t;return(t=o._viewDataModel)==null?void 0:t.layerId}get net(){var t;return(t=o._viewDataModel)==null?void 0:t.net}get showNet(){return o._viewDataModel.showNet}get width(){var t;return(t=o._viewDataModel)==null?void 0:t.width}get shouldShowNet(){return ea.getInstance().trackShowNet}get color(){return o._viewDataModel.partition==R.getInstance().partitionId?uo.getInstance().trackConfig.getColor(o._viewDataModel.globalIndex,this.showNet):uo.getInstance().readonlyTrackConfig.getColor(o._viewDataModel.globalIndex,this.showNet)}get start(){var t;return(t=o._viewDataModel)==null?void 0:t.start}get end(){var t;return(t=o._viewDataModel)==null?void 0:t.end}mainVisible(){let t=this.layerId,e=this.color,r=!1,i=!this.line||!1;if(this.line)this.layerModified&&(this.mainRemove(),i=!0);else{let n=this.resetHighLightState;this.line=new ld(t,n),i=!0}i||(i=this.shapeModified),(i||this.viewGroupIdModified||!e.equals(this._lastColor))&&(i=!0,this._lastColor=e),this.shouldShowNet&&this.showNet?(r=!this.netView||i||this.netModified,this.netView||(this.netView=new vl(t),r=!0),r&&(r=!0)):this.removeNetView(),this.show(i,r,e),this.netView&&this.netView.forceVisibleHighLight(this.manualHighLight),this.line.forceVisibleHighLight(this.manualHighLight)}show(t,e,r){if(t||e){let{layerId:i,start:n,end:s,width:a,showNet:l,engineGroupId:c}=this;t&&this.line.visible(i,n,s,a,r,c,void 0),e&&this.netView.visible(i,l,n.add(s).mul(.5),NP(s.angle(n)),Pc,Tc,s.distance1(n),a,void 0,c)}}maskVisible(t,e=!1){if(!this.line)return;let r=this.highlightColor||uo.getInstance().trackConfig.getColor(o._viewDataModel.globalIndex,this.showNet);if(this.isWebglEnv()){t?(this.mask||(this.mask=new Ds(1002)),this.mask.visible(1002,this.start,this.end,this.width,r,null)):this.mask&&(this.mask.remove(),delete this.mask);return}this.mainMaskHighLightColor(this.line,e,t?this.highLightType:null,r)}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0,this.forceUpdateMask)}modify(t,e){switch(o._viewDataModel=t,e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}removeNetView(){this.netView&&(this.netView.remove(),delete this.netView)}mainRemove(){var t;this.maskVisible(!1,!0),(t=this.line)==null||t.remove()}remove(){this.mainRemove(),this.removeNetView()}};var eY=class extends Do{constructor(){super();this.cushions=[new ta(12)];this.hole=new ta(47);Ro("view/pcb/ViaView")}get wireViewGroupId(){var e;return this.getEngineGroupId((e=this._viewDataModel)==null?void 0:e.wireViewGroupId)}get net(){var e;return(e=this._viewDataModel)==null?void 0:e.showNet}get center(){var e;return(e=this._viewDataModel)==null?void 0:e.center}get radius(){var e;return(e=this._viewDataModel)==null?void 0:e.radius}get holeRadius(){var e;return(e=this._viewDataModel)==null?void 0:e.holeRadius}get topExpansion(){var e;return(e=this._viewDataModel)==null?void 0:e.topExpansion}get bottomExpansion(){var e;return(e=this._viewDataModel)==null?void 0:e.bottomExpansion}get color(){return this._viewDataModel.partition==R.getInstance().partitionId?uo.getInstance().viaConfig.getColor(this._viewDataModel.globalIndex,this._viewDataModel.net,this._viewDataModel.selectItem):uo.getInstance().readonlyViaConfig.getColor(this._viewDataModel.globalIndex,this._viewDataModel.net)}get showNet(){return ea.getInstance().viaShowNet}get layerPairStr(){var e;return(e=this._viewDataModel)==null?void 0:e.layerPairStr}get highlightByComponent(){var e;return(e=this._viewDataModel)==null?void 0:e.highlightByComponent}get usedLayers(){var e;return(e=this._viewDataModel)==null?void 0:e.usedLayers}get unusedInnerLayers(){var e;return(e=this._viewDataModel)==null?void 0:e.unusedInnerLayers}get allLayers(){var e;return(e=this._viewDataModel)==null?void 0:e.allLayers}get holeColor(){var e;return(e=this._viewDataModel)==null?void 0:e.holeColor}get radiusModified(){var e;return(e=this._viewDataModel)==null?void 0:e.radiusModified}get holeRadiusModified(){var e;return(e=this._viewDataModel)==null?void 0:e.holeRadiusModified}get topExpansionModified(){var e;return(e=this._viewDataModel)==null?void 0:e.topExpansionModified}get bottomExpansionModified(){var e;return(e=this._viewDataModel)==null?void 0:e.bottomExpansionModified}get holeViewGroupId(){var e;return(e=this._viewDataModel)==null?void 0:e.holeViewGroupId}cushionVisible(){var s;let e=this.unusedInnerLayers.length>0?this.usedLayers:this.grayIndex!=0?this.allLayers:[12],r=this.shapeModified||this.radiusModified||this.viewGroupIdModified,i=this.color;if(r||(r=e.toString()!=((s=this._lastCushionLayerIds)==null?void 0:s.toString())||!i.equals(this._lastColor)),!r){for(let a=0;a<Math.max(this.cushions.length,e.length);a++)this.cushions[a]&&this.cushions[a].forceVisibleHighLight(this.manualHighLight);return}let n=this.wireViewGroupId;for(let a=0;a<Math.max(this.cushions.length,e.length);a++){if(!e[a]){this.removeLastMaskShape(this.cushions[a]);continue}this.cushions[a]||(this.cushions[a]=new ta(e[a])),this.cushions[a].visible(e[a],this.center,this.radius,this.color,n),this.cushions[a].forceVisibleHighLight(this.manualHighLight)}this.cushions.length=e.length,this._lastCushionLayerIds=e,this._lastColor=i}mainVisible(e){e!=null&&(this.grayIndex=e);let r=this.shapeModified||this.radiusModified||this.holeRadiusModified||this.viewGroupIdModified,i=ee.BLACK,n=this.getEngineGroupId(this.holeViewGroupId),s=this.holeColor||ee.BLACK,a=r;a||(a=!s.equals(this._lastHoleColor)),a&&(this.hole.visible(47,this.center,this.holeRadius,s,n),this._lastHoleColor=s),this.hole.forceVisibleHighLight(this.manualHighLight),this.cushionVisible();let l=this.viewGroupId,c=this.wireViewGroupId,h=r||this.topExpansionModified,u=this.topExpansion+this.radius;u>0?(this.expansionTop||(this.expansionTop=new ta(5),h=!0),h&&this.expansionTop.visible(5,this.center,u,i,c),this.expansionTop.forceVisibleHighLight(this.manualHighLight)):this.removeExpansionTop();let d=r||this.bottomExpansionModified,p=this.bottomExpansion+this.radius;p>0?(this.expansionBom||(this.expansionBom=new ta(6),d=!0),d&&this.expansionBom.visible(6,this.center,p,i,c),this.expansionBom.forceVisibleHighLight(this.manualHighLight)):this.removeExpansionBom();let m=1002,g=!1;if(!this.maskShape){let y=this.resetHighLightState;this.maskShape=new H9(m,y),g=!0}(g||r||h||d)&&this.maskShape.visible(m,this.center,this.radius+this.getMaxExpansion(),ee.of6(ee.BLACK,1e-6),l)}getMaxExpansion(){return Math.max(0,this.topExpansion,this.bottomExpansion)}maskVisible(e,r=!1){if(!this.maskShape)return;let i=this.highlightColor||ee.BLACK;if(this.isWebglEnv()){if(!e){this.mask&&(this.mask.remove(),delete this.mask);return}this.mask||(this.mask=new ta(1002)),this.mask.visible(1002,this.center,Math.max(this.radius,this.holeRadius)+Math.max(this.topExpansion,this.bottomExpansion,0),i,this.viewGroupId);return}this.mainMaskHighLightColor(this.maskShape,r,e?this.highLightType:null,i)}removeLastMaskShape(e){e&&e.remove()}componentMaskVisible(e){if(e=e&&this.highlightByComponent,!e){this.maskByComponent&&(this.maskByComponent.remove(),delete this.maskByComponent);return}let r=this.highlightColor||ee.BLACK;this.maskByComponent||(this.maskByComponent=new ta(1002)),this.maskByComponent.visible(1002,this.center,this.radius+Math.max(this.topExpansion,this.bottomExpansion,0),r,this.viewGroupId)}visible(e){this.refreshShapeViews(!1,e)}highlight(){this.refreshShapeViews(!0)}createNetAndLayerPairView(){if(!this.shapeModified&&!this.netModified){if(this.showNet&&this.net){if(this.netView!=null&&this.layerPair!=null){this.manualHighLightModified&&(this.netView.forceVisibleHighLight(this.manualHighLight),this.layerPair.forceVisibleHighLight(this.manualHighLight));return}}else if(this.netView==null&&this.layerPair!=null){this.manualHighLightModified&&this.layerPair.forceVisibleHighLight(this.manualHighLight);return}}let e=47,r=this.showNet?this.net:"",i=this.layerPairStr;if(r?this.netView||(this.netView=new vl(e)):this.removeNetView(),i?this.layerPair||(this.layerPair=new vl(e)):this.removeLayerPairView(),!this.netView&&!this.layerPair)return;let n=this.wireViewGroupId,s=this.center,a=0,l=this.radius*2,c=this.holeRadius*2,h=this.getFontPosition(r,i),u=s,d=s;if(h==1){let p=c*.25;u=new S(s.x,s.y-p),d=new S(s.x,s.y+p),c*=.5}this.netView&&this.netView.visible(e,r,u,a,Pc,Tc,l,c,void 0,n),this.layerPair&&this.layerPair.visible(e,i,d,a,Pc,Tc,l,c,void 0,n)}getFontPosition(e,r){return e!=""&&r!=""?1:e!=""&&r==""?2:e==""&&r!=""?2:3}refreshShapeViews(e,r){this.maskVisible(!1,!0),this.mainVisible(r),this.maskVisible(e,this.forceUpdateMask),this.componentMaskVisible(!0)}modify(e,r){let{grayIndex:i}=e;switch(super.modify(e,r),this.grayIndex=i,this.createNetAndLayerPairView(),this.netView&&this.netView.forceVisibleHighLight(this.manualHighLight),this.layerPair&&this.layerPair.forceVisibleHighLight(this.manualHighLight),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}removeMaskShape(){this.maskShape&&(this.maskShape.remove(),delete this.maskShape)}remove(){this.maskVisible(!1,!0),this.componentMaskVisible(!1),this.removeLastMaskShape(this.hole),this.cushions.forEach(e=>this.removeLastMaskShape(e)),this.removeExpansionTop(),this.removeExpansionBom(),this.removeNetView(),this.removeLayerPairView(),this.removeMaskShape()}removeNetView(){this.netView&&(this.netView.remove(),delete this.netView)}removeLayerPairView(){this.layerPair&&(this.layerPair.remove(),delete this.layerPair)}removeExpansionTop(){this.expansionTop&&(this.removeLastMaskShape(this.expansionTop),delete this.expansionTop)}removeExpansionBom(){this.expansionBom&&(this.removeLastMaskShape(this.expansionBom),delete this.expansionBom)}};var tY=class extends Do{constructor(){super(...arguments);this.lines=Array();this.arcs=Array();this.circles=Array();this.pads=Array();this.holes=Array();this.fillings=Array();this.texts=Array();this.rects=Array()}visible(){this.lines.forEach(e=>e.show()),this.arcs.forEach(e=>e.show()),this.circles.forEach(e=>e.show()),this.holes.forEach(e=>e.show()),this.pads.forEach(e=>e.show()),this.texts.forEach(e=>e.show()),this.rects.forEach(e=>e.show())}highlight(){}modify(e,r){super.modify(e,r);let{layerId:i,lines:n,arcs:s,pads:a,circles:l,holes:c,texts:h,polygons:u,rects:d,highlightColor:p=ee.BLACK}=e;this.layerId=i,this._state=r,this.lines.forEach(m=>m.remove()),this.lines.length=0,this.arcs.forEach(m=>m.remove()),this.arcs.length=0,this.pads.forEach(m=>m.remove()),this.pads.length=0,this.circles.forEach(m=>m.remove()),this.circles.length=0,this.holes.forEach(m=>m.remove()),this.holes.length=0,this.texts.forEach(m=>m.remove()),this.texts.length=0,this.rects.forEach(m=>m.remove()),this.rects.length=0,this.removeFill(),this.lines=n.map(m=>{let{layerId:g,start:y,end:b,width:P}=m,T=new Ds(g,null,!1);return this._state=="Only Main"&&T.visible(g,y,b,P,p,this.viewGroupId,void 0),T}),this.arcs=s.map(m=>{let{layerId:g,center:y,radius:b,width:P,startAngle:T,endAngle:I,sweep:C}=m,E=new Ka(g,null,!1);return this._state=="Only Main"&&E.visible(g,y,b,P,T,I,C,p,this.viewGroupId),E}),this.pads=a.reduce((m,g)=>{let{layerId:y,center:b,width:P,height:T,solderExpansion:I}=g,C=new ta(y,null,!1),E=y==1?5:6,O=new ta(E,null,!1),_=y==1?7:8,x=new ta(_,null,!1);return this._state=="Only Main"&&(C.visible(y,b,P/2,p,this.viewGroupId),O.visible(E,b,P/2+I,p,this.viewGroupId),x.visible(_,b,P/2,p,this.viewGroupId)),m.push(C,O,x),m},new Array),this.circles=l.reduce((m,g)=>{let{layerId:y,center:b,strokeWidth:P,radius:T}=g,I=new Ka(y,null,!1);return this._state=="Only Main"&&I.visible(y,b,T,P,0,Math.PI*2,ae.CCW,p,this.viewGroupId),m.push(I),m},[]),this.holes=c.reduce((m,g)=>{let{layerId:y,center:b,radius:P}=g,T=new ta(47,null,!1),I=new Ka(y,null,!1);return this._state=="Only Main"&&(T.visible(47,b,P,p,this.viewGroupId),I.visible(y,b,P,.1,0,Math.PI*2,ae.CCW,p,this.viewGroupId)),m.push(T,I),m},[]),this.rects=d.reduce((m,g)=>{let{layerId:y,start:b,rotation:P,width:T,height:I,strokeWidth:C}=g,E=Math.min(g.radius,T/2,I/2),O=new b0(y,null,!1);O.visible(47,b,T,I,P,E,p,this.viewGroupId,void 0),m.push(O);let _=b.add1(E,0),x=b.add1(T-E,0),v=b.add1(T,-E),D=b.add1(T,-I+E),w=b.add1(T-E,-I),F=b.add1(E,-I),H=b.add1(0,-I+E),z=b.add1(0,-E),V=[_,x,v,D,w,F,H,z];for(let W=0;W<V.length;W+=2){let L=V[W].rotate(b,P),k=V[W+1].rotate(b,P),N=new Ds(y,null,!1);N.visible(y,L,k,C,p,this.viewGroupId,void 0),this.lines.push(N)}if(E>0){let W=b.add1(E,-E),L=b.add1(T-E,-E),k=b.add1(T-E,-I+E),N=b.add1(E,-I+E),U=[W,L,k,N];for(let B=0;B<U.length;B++){let G=new Ka(y,null,!1),Y=Math.PI-Math.PI/2*B+P,X=Y-Math.PI/2,K=U[B].rotate(b,P);G.visible(y,K,E,C,Y,X,ae.CW,p,this.viewGroupId),this.arcs.push(G)}}return m},[]),this.fillings=u.reduce((m,g)=>{let{layerId:y,strokeWidth:b,outline:P}=g;if(this._state=="Only Main"){if(P instanceof Bt){let I=cn.getInstance().getLayer(47).layer.addStaticPolygon(P.items,p,this.viewGroupId);m.push([47,I])}else{let I=cn.getInstance().getLayer(47).layer.addPolygon(P,p,this.viewGroupId);m.push([47,I])}(P instanceof Bt?P.items:[P]).forEach(I=>{I.primitives.forEach(C=>{if(C instanceof q){let E=new Ka(y,null,!1);this._state=="Only Main"&&E.visible(y,C.center,C.rx,b,zt.toRadians(C.startAngle),zt.toRadians(C.endAngle()),C.sweep(),p,this.viewGroupId),this.arcs.push(E)}else if(C instanceof M){let E=new Ds(y,null,!1);this._state=="Only Main"&&E.visible(y,C.start(),C.end(),b,p,this.viewGroupId),this.lines.push(E)}})})}return m},[]),this.texts=h.map(m=>{let{layerId:g,width:y,height:b,strokeWidth:P,matrix:T,path:I,box:C}=m,E=new DP(!1);return this._state=="Only Main"&&E.modify({partition:"",layerId:g,box:C,width:y,height:b,strokeWidth:P,matrix:T,path:I,highLightType:this.highLightType,highlightColor:p,layerModified:!1,shapeModified:!0,outlineModified:!0},r),E})}hidden(){this.lines.forEach(e=>e.hidden()),this.arcs.forEach(e=>e.hidden()),this.circles.forEach(e=>e.hidden()),this.holes.forEach(e=>e.hidden()),this.pads.forEach(e=>e.hidden()),this.texts.forEach(e=>e.hidden()),this.rects.forEach(e=>e.hidden()),this.removeFill()}remove(){this.lines.forEach(e=>{e!=null&&e.remove()}),this.arcs.forEach(e=>{e!=null&&e.remove()}),this.pads.forEach(e=>{e!=null&&e.remove()}),this.circles.forEach(e=>{e!=null&&e.remove()}),this.holes.forEach(e=>{e!=null&&e.remove()}),this.texts.forEach(e=>{e!=null&&e.remove()}),this.rects.forEach(e=>{e!=null&&e.remove()}),this.removeFill()}removeFill(){for(let e of this.fillings)cn.getInstance().getLayer(e[0]).layer.plane.removePolygonPt(e[1]);this.fillings.length=0}};var rY=class extends Do{constructor(){super(...arguments);this.lines=new Array(0)}get layerId(){return this._layerId}set layerId(e){this._layerId=e}get segments(){var e;return(e=this._viewDataModel)==null?void 0:e.segments}get color(){var e;return(e=this._viewDataModel)==null?void 0:e.color}get isSolid(){var e;return(e=this._viewDataModel)==null?void 0:e.isSolid}get gap(){return this._viewDataModel.gap}get len(){return this._viewDataModel.len}createLine(e,r,i){let n=r[e];return n==null&&(n=new Ic(i),r.push(n)),n}shapesVisible(e,r=this.color,i=this.layerId){let n=this.segments.length;if(n<e.length){let s=e.splice(n,e.length-n);for(let a of s)a.remove();s.length=0}for(let s=0;s<n;s++){let a=this.createLine(s,e,i),l=this.segments[s],c=this.gap||2,h=this.len||3;this.isSolid?a.visible(i,l[0],l[1],!0,0,0,r,this.viewGroupId):a.visible(i,l[0],l[1],!1,h,c,r,this.viewGroupId),a.forceVisibleHighLight(this.manualHighLight)}}mainVisible(){this.shapesVisible(this.lines)}maskVisible(e,r=!1){let i=this.highlightColor||this.color;if(this.isWebglEnv()){if(!e){this._mask&&(this._mask.forEach(n=>n.remove()),delete this._mask);return}this._mask||(this._mask=[]),this.shapesVisible(this._mask,i,1002);return}this.mainsMaskHighLightColor(this.lines,r,e?this.highLightType:null,i)}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0,this.forceUpdateMask)}modify(e,r){let i=this.layerId;super.modify(e,r);let{layerId:n}=e;switch(this.layerId=n,n!=i&&this.mainRemove(),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}mainRemove(){if(this.maskVisible(!1,!0),this.lines.length>0){for(let e of this.lines)e.remove();this.lines.length=0}}remove(){this.mainRemove()}};var iY=class extends jh{get plane(){return this.layer.plane}visible(t,e,r,i,n,s){this.layerId!=t&&this.remove(),this.layerId=t,!Ra.unRefreshScene&&(this.id=this.plane.createOrUpdatePoint(this.id,e,r,i,n,void 0,s))}};var nY=class extends Do{constructor(){super(...arguments);this.main=new iY(1002,this.resetHighLightState)}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get position(){var e;return(e=this._viewDataModel)==null?void 0:e.position}get isTriangle(){var e;return(e=this._viewDataModel)==null?void 0:e.isTriangle}get color(){var e;return(e=this._viewDataModel)==null?void 0:e.color}get colorModified(){var e;return(e=this._viewDataModel)==null?void 0:e.colorModified}mainVisible(){(this.shapeModified||this.colorModified)&&(this.main.visible(1002,this.position,16,this.isTriangle,this.color,this.viewGroupId),this.main.forceVisibleHighLight(this.manualHighLight))}maskVisible(e,r=!1){if(this.main){if(this.isWebglEnv()){if(!e){this._mask&&(this._mask.remove(),delete this._mask);return}this._mask||(this._mask=new iY(1002));let i=this.highlightColor||this.color;this._mask.visible(1002,this.position,16,this.isTriangle,i,null);return}this.mainMaskHighLightColor(this.main,r,e?this.highLightType:null)}}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0)}modify(e,r){switch(super.modify(e,r),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}mainRemove(){var e;this.maskVisible(!1,!0),(e=this.main)==null||e.remove()}remove(){this.mainRemove()}};var oY=class extends Do{constructor(){super(...arguments);this.main=null}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get fonts(){var e;return(e=this._viewDataModel)==null?void 0:e.fonts}get position(){var e;return(e=this._viewDataModel)==null?void 0:e.position}get angle(){var e;return(e=this._viewDataModel)==null?void 0:e.angle}get limitMin(){var e;return(e=this._viewDataModel)==null?void 0:e.limitMin}get limitMax(){var e;return(e=this._viewDataModel)==null?void 0:e.limitMax}get fontWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.fontWidth}get fontHeight(){var e;return(e=this._viewDataModel)==null?void 0:e.fontHeight}get color(){var e;return(e=this._viewDataModel)==null?void 0:e.color}mainVisible(){let e=this.layerId;this.main||(this.main=new vl(e)),this.main.visible(e,this.fonts,this.position,this.angle,this.limitMin,this.limitMax,this.fontWidth,this.fontHeight,this.color,this.viewGroupId)}visible(){this.mainVisible()}highlight(){this.mainVisible()}modify(e,r){switch(super.modify(e,r),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){this.main.remove()}};var sY=class extends Do{get layerId(){var t;return(t=this._viewDataModel)==null?void 0:t.layerId}get center(){var t;return(t=this._viewDataModel)==null?void 0:t.center}get radius(){var t;return(t=this._viewDataModel)==null?void 0:t.radius}get startAngle(){var t;return(t=this._viewDataModel)==null?void 0:t.startAngle}get endAngle(){var t;return(t=this._viewDataModel)==null?void 0:t.endAngle}get sweep(){var t;return(t=this._viewDataModel)==null?void 0:t.sweep}get width(){var t;return(t=this._viewDataModel)==null?void 0:t.width}get color(){var t;return(t=this._viewDataModel)==null?void 0:t.color}mainVisible(){let t=this.layerId,e=!1;if(this.main)this.layerModified&&(this.remove(),e=!0);else{let i=this.resetHighLightState;this.main=new U9(t,i),e=!0}let r=this.color;e||(e=this.shapeModified||this.viewGroupIdModified||!r.equals(this._lastLineColor)),e&&(this.main.visible(this.layerId,this.center,this.radius,this.startAngle,this.endAngle,this.sweep,this.color,this.viewGroupId),this._lastLineColor=r),this.main.forceVisibleHighLight(this.manualHighLight)}maskVisible(t,e=!1){if(this.main){if(this.isWebglEnv()){if(t){let r=this.highlightColor||this.color;this.mask||(this.mask=new ty(1002)),this.mask.visible(this.layerId,this.center,this.radius,this.startAngle,this.endAngle,this.sweep,r,null)}else this.mask&&(this.mask.remove(),delete this.mask);return}this.mainMaskHighLightColor(this.main,e,t?this.highLightType:null)}}visible(){this.maskVisible(!1),this.mainVisible()}highlight(){this.mainVisible(),this.maskVisible(!0)}modify(t,e){switch(super.modify(t,e),e){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){var t;this.maskVisible(!1,!0),(t=this.main)==null||t.remove()}};var nte=class extends Do{constructor(){super(...arguments);this.shape=null}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get center(){var e;return(e=this._viewDataModel)==null?void 0:e.center}get radius(){var e;return(e=this._viewDataModel)==null?void 0:e.radius}get color(){var e;return(e=this._viewDataModel)==null?void 0:e.color}mainVisible(){let e=!1;this.shape?this.layerModified&&(this.shape.remove(),e=!0):(this.shape=new ta(this.layerId),e=!0);let r=this.color;e||(e=this.layerModified||this.shapeModified||this.viewGroupIdModified||!r.equals(this._lastColor)),e&&(this.shape.visible(this.layerId,this.center,this.radius,r,this.viewGroupId),this._lastColor=r),this.shape.forceVisibleHighLight(this.manualHighLight)}visible(){this.mainVisible()}highlight(){this.mainVisible()}modify(e,r){switch(super.modify(e,r),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){var e;(e=this.shape)==null||e.remove()}};var Kh=class{};var ro=class extends Kh{constructor(){super(...arguments);this.groupId=void 0;this.groupName=null;this.number=-1}hasConnectChange(){return!1}getConnnectChangeCommand(){return[]}getAction(){return this.action}isDelete(e=!1){let r=!1;return(e&&this.action=="add"||!e&&this.action=="delete")&&(r=!0),r}updateFilterStatus(e){e.updateFilterVisible=!0,e.visible()}deleteGroupID(e){if(this.groupId=e.getGroupID(),this.groupName=this.groupId==null?null:Ht.getGroupNameByGroupId(this.groupId),this.groupId!=null&&this.action=="delete"){let r=Ht.getItem(this.groupId);r!=null&&r.deleteItem(e)}}addGroupID(e){if(this.groupId!=null){let r=Ht.getItem(this.groupId);r==null?r=Ht.rebuild(this.groupId,[e],this.groupName):r.addItem(e)}}modifyGroupID(e){let r=e.getGroupID();this.groupId!=r&&(r&&Ht.getItem(r)&&Ht.removeFromCombination([e],r),this.addGroupID(e)),this.groupId=r}undo(){let e=this.getItem();this.action==="add"?(e!=null||e=="ignore")&&this.remove():this.action==="modify"?(e!=null||e=="ignore")&&this.modify():this.action==="delete"&&(e==null||e=="ignore")&&this.rebuild()}redo(){let e=this.getItem();this.action==="add"?(e==null||e=="ignore")&&this.rebuild():this.action==="modify"?(e!=null||e=="ignore")&&this.modify():this.action==="delete"&&(e!=null||e=="ignore")&&this.remove()}};var BP=class extends ro{constructor(t,e){super(),this.gId=t.globalIndex,this.data=e=="add"?void 0:t.toJSON(),this.action=e,this.deleteGroupID(t)}rebuild(){let{globalIndex:t,partition:e,layerId:r,start:i,end:n,height:s,width:a,locked:l,leftPoint:c,rightPoint:h,leftSpotSize:u,rightSpotSize:d,silkColor:p}=this.data,m=p?ee.of3(p):null,g=new S(i.x,i.y),y=new S(n.x,n.y),b=new S(c.x,c.y),P=new S(h.x,h.y),T=ah.rebuild(t,r,g,y,b,P,s,a,l,u,d);return T.updateText(),T.partition=e,A.publish("hasModifyPcbItem",T),this.addGroupID(T),T.silkColor=m,this.updateFilterStatus(T),this.data=void 0,T}getItem(){return"ignore"}remove(){let t=ah.getItem(this.gId);this.data=t.toJSON(),t.remove(),A.publish("delete",t),A.publish("hasModifyPcbItem",t)}modify(){let{globalIndex:t,layerId:e,start:r,end:i,height:n,width:s,unit:a,locked:l,leftPoint:c,rightPoint:h,silkColor:u}=this.data,d=u?ee.of3(u):null,p=new S(r.x,r.y),m=new S(i.x,i.y),g=new S(c.x,c.y),y=new S(h.x,h.y),b=ah.getItem(this.gId),P=b.toJSON();b.globalIndex!=t,!b.left.equals(g)&&!b.right.equals(y)&&!b.start.equals(p)&&!b.end.equals(m)?(b.left=g,b.right=y,b.modifyDimension(p,m)):(b.start.equals(p)||(b.start=p,b.updateText()),b.end.equals(m)||(b.end=m,b.updateText()),b.left.equals(g)||(b.left=g),b.right.equals(y)||(b.right=y)),b.height!=n&&(b.height=n),b.unit!=R.getInstance().unit&&(b.unit=R.getInstance().unit,b.precision=R.getInstance().unit=="mil"?1:3),b.locked!=l&&(b.locked=l),d||(b.silkColor=void 0),d&&b.silkColor!=d&&!b.silkColor.equals(d)&&(b.silkColor=d),b.updateText(),this.modifyGroupID(b),this.data=P,A.publish("hasModifyPcbItem",b)}upload(t){}updateData(){}};var e3=class extends xi{constructor(){super();this.injectedBBoxes=[];this._bbox=new ht(0,0,0,0)}injectedBBox(e){this.injectedBBoxes.push(...e)}get bbox(){if(!this.injectedBBoxes||!this.injectedBBoxes.length)return this._bbox||new ht(0,0,0,0);let e=new _e;for(let r of this.injectedBBoxes)e.ext1(r);return e.build()}clearInjectedBBox(){this.injectedBBoxes=[]}};function Zv(o,t=10,e=30,r=null){let i=Ai().getScale();if(!(le.pcbConfig.drcErrorZoom==="keepConstantSize"))return o;let s=o.height()*i,a=o.width()*i;if(t>0&&(s<t||a<t))return null;let c=Math.min(Math.max(s,t),e)/s,h=o.width()*c,u=o.height()*c,d=o.center(),p=r?r.sub(d).mul(1-c):new S(0,0),m=d.add(p);return new ht(m.x-h/2,m.x+h/2,m.y-u/2,m.y+u/2)}var JCt=3.937,QCt=3.937,eSt=28,tSt=28,aY=class extends e3{constructor(e,r,i,n,s,a=new Array,l=ee.of3("#FFCC00"),c=1001){super();this.modelType="DRCResult";this.globalIndex=e,this._name=r,this._layerId=c,this._referenceLayerIds=a,this._position=i,this._errType=n,this._color=l,this._locked=!1,this._rectWidth=s==="followObjectScaling"?JCt:eSt,this._rectHeight=s==="followObjectScaling"?QCt:tSt}get name(){return this._name}set name(e){this._name!==e&&(this._name=e)}get locked(){return this._locked}set locked(e){this._locked!==e&&(this._locked=e)}get layerId(){return this._layerId}set layerId(e){this._layerId!==e&&(this._layerId=e,this.layerModified=!0)}get referenceLayerIds(){return this._referenceLayerIds}set referenceLayerIds(e){this._referenceLayerIds=e}get position(){return this._position}set position(e){(this._position.x!==e.x||this._position.y!==e.y)&&(this._position=e)}get errType(){return this._errType}set errType(e){this._errType!==e&&(this._errType=e)}get color(){return this._color}set color(e){(this._color.r!==e.r||this._color.g!==e.g||this._color.b!==e.b||this._color.alpha!==e.alpha)&&(this._color=e)}get rectWidth(){return this._rectWidth}get rectHeight(){return this._rectHeight}loadViewGroupId(){this.referenceLayerIds&&this.layerId==1001&&(this._viewGroupId=pd.generateViewGroupId(this))}get viewGroupId(){return this._viewGroupId}inShape(e,r){if(le.pcbConfig.drcErrorZoom==="followObjectScaling")return this.bbox.isContains(new S(e,r));{let i=Zv(this.bbox);return i?i.isContains(new S(e,r)):!1}}updateBox(){return this.bbox}transform(e){}clone(){return null}};var BL=class BL extends Ei{static getInstance(){return BL.instance==null&&(BL.instance=new BL),BL.instance}updateCache(t){this.map.set(t.globalIndex,t)}addItem(t,e,r,i,n,s,a=ee.of3("#FFCC00"),l=1001){let c=new aY(t,e,r,i,n,s,a,l);return this.updateCache(c),c}deleteItem(t){t instanceof aY&&this.map.delete(t.globalIndex)}};BL.instance=null;var Uk=BL;var ly=class ly{static getStringPath(t){let e,r,i,n;if(!t)return"";var s="",a="";if(typeof t=="object"&&(s=t.text,!s))return"";t&&(i=+t.fontSize,n=+t.fontWidth,e=t.x,r=t.y),ly.setFontHeight(i),i=ly.getFontHeight();let l,c=e;for(let h=0,u=s.length;h<u;h++){if(s[h]==" "){e+=ly.getSapceWidth();continue}if(s[h]==`
`){e=c,r+=Math.max(+i+n,+i);continue}l=ly.getCharInfo(s[h],e,r),a+=l[0],e+=l[1]+n+i*.15}return a}static setFontHeight(t){ly.height=+t}static getFontHeight(){return ly.height||4.5}static getCharInfo(t,e,r){function i(u,d,p,m,g){let y="",b=u.length;for(let P=0;P<b;P++){let T=u[P].split(" "),I=0,C=T.length;for(;I<C;I+=2)T[I]=gn(p+d*+T[I],2),T[I+1]=gn(m+d*(+T[I+1]-16),2);let E="M "+T[0]+" "+T[1];for(I=2;I<C;I++)I%2===0&&(E+="L"),E+=T[I]+" ";y+=E}return y}if(ly.fontPath[t]){var n=ly.fontPath[t].path,s=ly.getPathBBox(n),a=Math.abs(s.R-s.L),l=Math.abs(s.T-s.B);l===0&&(l=1);var c=ly.getFontHeight()/32;a=a*c;var h=i(n,c,e,r,l);return[h,a]}else return["",0]}static getPathBBox(t){for(var e=t.length,r={L:9999,T:-9999,R:-9999,B:9999},i,n,s=0;s<e;s++){for(var a=t[s].split(" "),l=0,c=a.length;l<c;l+=2)i=+a[l],n=+a[l+1],r.L>i&&(r.L=i),r.T<n&&(r.T=n),r.R<i&&(r.R=i),r.B>n&&(r.B=n);a=null}return r}static getSapceWidth(){return ly.height*.7}static everyCharHasDefaultFontPath(t){let e=t.toString().replace(/\s/g,"").split("");for(let r of e)if(ly.fontPath[r]==null)return!1;return!0}};ly._fontsCache={},ly.fontPath={"!":{path:["1 -12 1 2","1 7 0 8 1 9 2 8 1 7"]},'"':{path:["0 -12 0 -5","8 -12 8 -5"]},"#":{path:["8 -16 1 16","14 -16 7 16","1 -3 15 -3","0 3 14 3"]},$:{path:["7 -16 7 13","14 -9 12 -11 9 -12 5 -12 2 -11 0 -9 0 -7 1 -5 2 -4 4 -3 10 -1 12 0 13 1 14 3 14 6 12 8 9 9 5 9 2 8 0 6"]},"%":{path:["18 -12 0 9","5 -12 7 -10 7 -8 6 -6 4 -5 2 -5 0 -7 0 -9 1 -11 3 -12 5 -12 7 -11 10 -10 13 -10 16 -11 18 -12","14 2 12 3 11 5 11 7 13 9 15 9 17 8 18 6 18 4 16 2 14 2"]},"&":{path:["20 -3 20 -4 19 -5 18 -5 17 -4 16 -2 14 3 12 6 10 8 8 9 4 9 2 8 1 7 0 5 0 3 1 1 2 0 9 -4 10 -5 11 -7 11 -9 10 -11 8 -12 6 -11 5 -9 5 -7 6 -4 8 -1 13 6 15 8 17 9 19 9 20 8 20 7"]},"'":{path:["2 -15 2 -9"]},"`":{path:["2 -15 4 -9"]},"(":{path:["7 -16 5 -14 3 -11 1 -7 0 -2 0 2 1 7 3 11 5 14 7 16"]},")":{path:["0 -16 2 -14 4 -11 6 -7 7 -2 7 2 6 7 4 11 2 14 0 16"]},"*":{path:["5 -6 5 6","0 -3 10 3","10 -3 0 3"]},"+":{path:["9 -9 9 9","0 0 18 0"]},",":{path:["2 5 1 6 0 5 1 4 2 5 2 7 0 9"]},"-":{path:["0 0 18 0"]},".":{path:["1 4 0 5 1 6 2 5 1 4"]},"/":{path:["18 -16 0 16"]},0:{path:["6 -12 3 -11 1 -8 0 -3 0 0 1 5 3 8 6 9 8 9 11 8 13 5 14 0 14 -3 13 -8 11 -11 8 -12 6 -12"]},1:{path:["0 -8 2 -9 5 -12 5 9"]},2:{path:["1 -7 1 -8 2 -10 3 -11 5 -12 9 -12 11 -11 12 -10 13 -8 13 -6 12 -4 10 -1 0 9 14 9"]},3:{path:["2 -12 13 -12 7 -4 10 -4 12 -3 13 -2 14 1 14 3 13 6 11 8 8 9 5 9 2 8 1 7 0 5"]},4:{path:["10 -12 0 2 15 2","10 -12 10 9"]},5:{path:["12 -12 2 -12 1 -3 2 -4 5 -5 8 -5 11 -4 13 -2 14 1 14 3 13 6 11 8 8 9 5 9 2 8 1 7 0 5"]},6:{path:["12 -9 11 -11 8 -12 6 -12 3 -11 1 -8 0 -3 0 2 1 6 3 8 6 9 7 9 10 8 12 6 13 3 13 2 12 -1 10 -3 7 -4 6 -4 3 -3 1 -1 0 2"]},7:{path:["14 -12 4 9","0 -12 14 -12"]},8:{path:["5 -12 2 -11 1 -9 1 -7 2 -5 4 -4 8 -3 11 -2 13 0 14 2 14 5 13 7 12 8 9 9 5 9 2 8 1 7 0 5 0 2 1 0 3 -2 6 -3 10 -4 12 -5 13 -7 13 -9 12 -11 9 -12 5 -12"]},9:{path:["13 -5 12 -2 10 0 7 1 6 1 3 0 1 -2 0 -5 0 -6 1 -9 3 -11 6 -12 7 -12 10 -11 12 -9 13 -5 13 0 12 5 10 8 7 9 5 9 2 8 1 6"]},":":{path:["1 -3 0 -2 1 -1 2 -2 1 -3","1 4 0 5 1 6 2 5 1 4"]},";":{path:["1 -3 0 -2 1 -1 2 -2 1 -3","2 5 1 6 0 5 1 4 2 5 2 7 0 9"]},"<":{path:["16 -9 0 0 16 9"]},"=":{path:["0 -3 18 -3","0 3 18 3"]},">":{path:["0 -9 16 0 0 9"]},"?":{path:["0 -7 0 -8 1 -10 2 -11 4 -12 8 -12 10 -11 11 -10 12 -8 12 -6 11 -4 10 -3 6 -1 6 2","6 7 5 8 6 9 7 8 6 7"]},"@":{path:["15 -4 14 -6 12 -7 9 -7 7 -6 6 -5 5 -2 5 1 6 3 8 4 11 4 13 3 14 1","9 -7 7 -5 6 -2 6 1 7 3 8 4","15 -7 14 1 14 3 16 4 18 4 20 2 21 -1 21 -3 20 -6 19 -8 17 -10 15 -11 12 -12 9 -12 6 -11 4 -10 2 -8 1 -6 0 -3 0 0 1 3 2 5 4 7 6 8 9 9 12 9 15 8 17 7 18 6","16 -7 15 1 15 3 16 4"]},A:{path:["8 -12 0 9","8 -12 16 9","3 2 13 2"]},B:{path:["0 -12 0 9","0 -12 9 -12 12 -11 13 -10 14 -8 14 -6 13 -4 12 -3 9 -2","0 -2 9 -2 12 -1 13 0 14 2 14 5 13 7 12 8 9 9 0 9"]},C:{path:["15 -7 14 -9 12 -11 10 -12 6 -12 4 -11 2 -9 1 -7 0 -4 0 1 1 4 2 6 4 8 6 9 10 9 12 8 14 6 15 4"]},D:{path:["0 -12 0 9","0 -12 7 -12 10 -11 12 -9 13 -7 14 -4 14 1 13 4 12 6 10 8 7 9 0 9"]},E:{path:["0 -12 0 9","0 -12 13 -12","0 -2 8 -2","0 9 13 9"]},F:{path:["0 -12 0 9","0 -12 13 -12","0 -2 8 -2"]},G:{path:["15 -7 14 -9 12 -11 10 -12 6 -12 4 -11 2 -9 1 -7 0 -4 0 1 1 4 2 6 4 8 6 9 10 9 12 8 14 6 15 4 15 1","10 1 15 1"]},H:{path:["0 -12 0 9","14 -12 14 9","0 -2 14 -2"]},I:{path:["0 -12 0 9"]},J:{path:["10 -12 10 4 9 7 8 8 6 9 4 9 2 8 1 7 0 4 0 2"]},K:{path:["0 -12 0 9","14 -12 0 2","5 -3 14 9"]},L:{path:["0 -12 0 9","0 9 12 9"]},M:{path:["0 -12 0 9","0 -12 8 9","16 -12 8 9","16 -12 16 9"]},N:{path:["0 -12 0 9","0 -12 14 9","14 -12 14 9"]},O:{path:["6 -12 4 -11 2 -9 1 -7 0 -4 0 1 1 4 2 6 4 8 6 9 10 9 12 8 14 6 15 4 16 1 16 -4 15 -7 14 -9 12 -11 10 -12 6 -12"]},P:{path:["0 -12 0 9","0 -12 9 -12 12 -11 13 -10 14 -8 14 -5 13 -3 12 -2 9 -1 0 -1"]},Q:{path:["6 -12 4 -11 2 -9 1 -7 0 -4 0 1 1 4 2 6 4 8 6 9 10 9 12 8 14 6 15 4 16 1 16 -4 15 -7 14 -9 12 -11 10 -12 6 -12","9 5 15 11"]},R:{path:["0 -12 0 9","0 -12 9 -12 12 -11 13 -10 14 -8 14 -6 13 -4 12 -3 9 -2 0 -2","7 -2 14 9"]},S:{path:["14 -9 12 -11 9 -12 5 -12 2 -11 0 -9 0 -7 1 -5 2 -4 4 -3 10 -1 12 0 13 1 14 3 14 6 12 8 9 9 5 9 2 8 0 6"]},T:{path:["7 -12 7 9","0 -12 14 -12"]},U:{path:["0 -12 0 3 1 6 3 8 6 9 8 9 11 8 13 6 14 3 14 -12"]},V:{path:["0 -12 8 9","16 -12 8 9"]},W:{path:["0 -12 5 9","10 -12 5 9","10 -12 15 9","20 -12 15 9"]},X:{path:["0 -12 14 9","14 -12 0 9"]},Y:{path:["0 -12 8 -2 8 9","16 -12 8 -2"]},Z:{path:["14 -12 0 9","0 -12 14 -12","0 9 14 9"]},"[":{path:["0 -16 0 16","1 -16 1 16","0 -16 7 -16","0 16 7 16"]},"\\":{path:["0 -12 14 12"]},"]":{path:["6 -16 6 16","7 -16 7 16","0 -16 7 -16","0 16 7 16"]},"^":{path:["8 -14 0 0","8 -14 16 0"]},_:{path:["0 16 18 16"]},a:{path:["12 -5 12 9","12 -2 10 -4 8 -5 5 -5 3 -4 1 -2 0 1 0 3 1 6 3 8 5 9 8 9 10 8 12 6"]},b:{path:["0 -12 0 9","0 -2 2 -4 4 -5 7 -5 9 -4 11 -2 12 1 12 3 11 6 9 8 7 9 4 9 2 8 0 6"]},c:{path:["12 -2 10 -4 8 -5 5 -5 3 -4 1 -2 0 1 0 3 1 6 3 8 5 9 8 9 10 8 12 6"]},d:{path:["12 -12 12 9","12 -2 10 -4 8 -5 5 -5 3 -4 1 -2 0 1 0 3 1 6 3 8 5 9 8 9 10 8 12 6"]},e:{path:["0 1 12 1 12 -1 11 -3 10 -4 8 -5 5 -5 3 -4 1 -2 0 1 0 3 1 6 3 8 5 9 8 9 10 8 12 6"]},f:{path:["8 -12 6 -12 4 -11 3 -8 3 9","0 -5 7 -5"]},g:{path:["12 -5 12 11 11 14 10 15 8 16 5 16 3 15","12 -2 10 -4 8 -5 5 -5 3 -4 1 -2 0 1 0 3 1 6 3 8 5 9 8 9 10 8 12 6"]},h:{path:["0 -12 0 9","0 -1 3 -4 5 -5 8 -5 10 -4 11 -1 11 9"]},i:{path:["0 -12 1 -11 2 -12 1 -13 0 -12","1 -5 1 9"]},j:{path:["4 -12 5 -11 6 -12 5 -13 4 -12","5 -5 5 12 4 15 2 16 0 16"]},k:{path:["0 -12 0 9","10 -5 0 5","4 1 11 9"]},l:{path:["0 -12 0 9"]},m:{path:["0 -5 0 9","0 -1 3 -4 5 -5 8 -5 10 -4 11 -1 11 9","11 -1 14 -4 16 -5 19 -5 21 -4 22 -1 22 9"]},n:{path:["0 -5 0 9","0 -1 3 -4 5 -5 8 -5 10 -4 11 -1 11 9"]},o:{path:["5 -5 3 -4 1 -2 0 1 0 3 1 6 3 8 5 9 8 9 10 8 12 6 13 3 13 1 12 -2 10 -4 8 -5 5 -5"]},p:{path:["0 -5 0 16","0 -2 2 -4 4 -5 7 -5 9 -4 11 -2 12 1 12 3 11 6 9 8 7 9 4 9 2 8 0 6"]},q:{path:["12 -5 12 16","12 -2 10 -4 8 -5 5 -5 3 -4 1 -2 0 1 0 3 1 6 3 8 5 9 8 9 10 8 12 6"]},r:{path:["0 -5 0 9","0 1 1 -2 3 -4 5 -5 8 -5"]},s:{path:["11 -2 10 -4 7 -5 4 -5 1 -4 0 -2 1 0 3 1 8 2 10 3 11 5 11 6 10 8 7 9 4 9 1 8 0 6"]},t:{path:["3 -12 3 5 4 8 6 9 8 9","0 -5 7 -5"]},u:{path:["0 -5 0 5 1 8 3 9 6 9 8 8 11 5","11 -5 11 9"]},v:{path:["0 -5 6 9","12 -5 6 9"]},w:{path:["0 -5 4 9","8 -5 4 9","8 -5 12 9","16 -5 12 9"]},x:{path:["0 -5 11 9","11 -5 0 9"]},y:{path:["1 -5 7 9","13 -5 7 9 5 13 3 15 1 16 0 16"]},z:{path:["11 -5 0 9","0 -5 11 -5","0 9 11 9"]},"{":{path:["5 -16 3 -15 2 -14 1 -12 1 -10 2 -8 3 -7 4 -5 4 -3 2 -1","3 -15 2 -13 2 -11 3 -9 4 -8 5 -6 5 -4 4 -2 0 0 4 2 5 4 5 6 4 8 3 9 2 11 2 13 3 15","2 1 4 3 4 5 3 7 2 8 1 10 1 12 2 14 3 15 5 16"]},"|":{path:["0 -16 0 16"]},"}":{path:["0 -16 2 -15 3 -14 4 -12 4 -10 3 -8 2 -7 1 -5 1 -3 3 -1","2 -15 3 -13 3 -11 2 -9 1 -8 0 -6 0 -4 1 -2 5 0 1 2 0 4 0 6 1 8 2 9 3 11 3 13 2 15","3 1 1 3 1 5 2 7 3 8 4 10 4 12 3 14 2 15 0 16"]},"~":{path:["0 3 0 1 1 -2 3 -3 5 -3 7 -2 11 1 13 2 15 2 17 1 18 -1","0 1 1 -1 3 -2 5 -2 7 -1 11 2 13 3 15 3 17 2 18 -1 18 -3"]},"\xB0":{path:["3 -11 0 -8 3 -5 6 -8 3 -11"]},\u03A9:{path:["0 9 7 9 5 6 3 3 2 0 2 -3 3 -6 4 -8 6 -10 8 -11 12 -11 14 -10 16 -8 17 -6 18 -3 18 0 17 3 15 6 13 9 20 9"]},\u03BC:{path:["0 14 1 4 1 -6 1 4 2 7 4 8 6 8 8 7 10 4 10 -6 10 6 11 8 12 9"]}};var cy=ly;var FL=class FL{constructor(){this.textCache=new Map;this.numCache=new Array(20);this.boxCache=new Array(4);this.textOffsetCache=new Array(9);this.BuildLineCache=new Array(7);this.BuildTrackCache=new Array(7);this.BuildViaCache=new Array(11);this.BuildBoxCache=new Array(10);this.BuildArcCache=new Array(10);this.BuildArcTrackCache=new Array(10);this.BuildTextCache=new Array(7);this.BuildPadStyleCache=new Array(4);this.BuildPadCache=new Array(12);this.ARRAY1=new Array(1);this.ARRAY2=new Array(2);this.ARRAY3=new Array(3);this.ARRAY4=new Array(4);this.ARRAY5=new Array(5);this.ARRAY6=new Array(6);this.ARRAY7=new Array(7);this.ARRAY8=new Array(8);this.ARRAY9=new Array(9);this.ARRAY10=new Array(10);this.ARRAY11=new Array(11);this.ARRAY12=new Array(12);this.textOffsetCache[0]=S.ORIGIN,this.textOffsetCache[1]=new S(0,-.5),this.textOffsetCache[2]=new S(0,-1),this.textOffsetCache[3]=new S(-.5,0),this.textOffsetCache[4]=new S(-.5,-.5),this.textOffsetCache[5]=new S(-.5,-1),this.textOffsetCache[6]=new S(-1,0),this.textOffsetCache[7]=new S(-1,-.5),this.textOffsetCache[8]=new S(-1,-1)}static getCache(){return FL.instance==null&&(FL.instance=new FL),FL.instance}};FL.instance=null;var WO=FL;var FP=class FP{static setFontHeight(t){FP.height=+t}static getFontHeight(){return FP.height||4.5}static getCharInfo(t,e,r){function i(u,d,p,m,g){let y="",b=u.length;for(let P=0;P<b;P++){let T=u[P].split(" "),I=0,C=T.length;for(;I<C;I+=2)T[I]=gn(p+d*+T[I],2),T[I+1]=gn(m+d*(+T[I+1]-16),2);let E="M "+T[0]+" "+T[1];for(I=2;I<C;I++)I%2===0&&(E+="L"),E+=T[I]+" ";y+=E}return y}if(FP.fontPath[t]){var n=FP.fontPath[t].path,s=FP.getPathBBox(n),a=Math.abs(s.R-s.L),l=Math.abs(s.T-s.B);l===0&&(l=1);var c=FP.getFontHeight()/32;a=a*c;var h=i(n,c,e,r,l);return[h,a]}else return["",0]}static getPathBBox(t){for(var e=t.length,r={L:9999,T:-9999,R:-9999,B:9999},i,n,s=0;s<e;s++){for(var a=t[s].split(" "),l=0,c=a.length;l<c;l+=2)i=+a[l],n=+a[l+1],r.L>i&&(r.L=i),r.T<n&&(r.T=n),r.R<i&&(r.R=i),r.B>n&&(r.B=n);a=null}return r}static getSpaceWidth(t){return 31.9936876*t}static everyCharHasDefaultFontPath(t){let e=t.toString().replace(/\s/g,"").split("");for(let r of e)if(FP.fontPath[r]==null)return!1;return!0}static getSpacing(t){return FP.spacing[t]||10.66}};FP._fontsCache={},FP.fontPath={"!":{path:["0 16.001000000000005 0 10.668000000000003","0 5.335000000000004 0 -21.33"]},'"':{path:["21.332 -5.330999999999998 26.665000000000003 -10.663999999999998","26.665000000000003 -10.663999999999998 26.665000000000003 -21.33","0 -5.330999999999998 5.333 -10.663999999999998","5.333 -10.663999999999998 5.333 -21.33"]},"#":{path:["5.333 15.998000000000001 5.333 5.332000000000001","5.333 5.332000000000001 5.333 -5.334","5.333 -5.334 5.333 -16","0 -5.334 5.333 -5.334","5.333 -5.334 15.999 -5.334","15.999 -5.334 21.332 -5.334","0 5.332000000000001 5.333 5.332000000000001","5.333 5.332000000000001 15.999 5.332000000000001","15.999 5.332000000000001 21.332 5.332000000000001","15.999 15.998000000000001 15.999 5.332000000000001","15.999 5.332000000000001 15.999 -5.334","15.999 -5.334 15.999 -16"]},$:{path:["0 10.665000000000003 5.333 15.998000000000001","15.999 15.998000000000001 21.332 10.665000000000003","21.332 10.665000000000003 21.332 5.332000000000001","15.999 -0.0009999999999994458 21.332 5.332000000000001","0 -5.334 5.333 -0.0009999999999994458","0 -5.334 0 -10.667","0 -10.667 5.333 -16","15.999 -16 21.332 -10.667","5.333 15.998000000000001 10.666 15.998000000000001","10.666 15.998000000000001 15.999 15.998000000000001","5.333 -16 10.666 -16","10.666 -16 15.999 -16","5.333 -0.0009999999999994458 10.666 -0.0009999999999994458","10.666 -0.0009999999999994458 15.999 -0.0009999999999994458","10.666 15.998000000000001 10.666 -0.0009999999999994458","10.666 -0.0009999999999994458 10.666 -16"]},"%":{path:["21.332 16.001000000000005 21.332 10.668000000000003","21.332 16.001000000000005 26.665000000000003 16.001000000000005","26.665000000000003 16.001000000000005 26.665000000000003 10.668000000000003","21.332 10.668000000000003 26.665000000000003 10.668000000000003","0 10.668000000000003 26.665000000000003 -15.996999999999998","0 -15.996999999999998 0 -21.33","0 -15.996999999999998 5.333 -15.996999999999998","5.333 -15.996999999999998 5.333 -21.33","0 -21.33 5.333 -21.33"]},"&":{path:["15.999 10.665000000000003 21.332 15.998000000000001","15.999 5.332000000000001 21.332 -0.0009999999999994458","10.666 -0.0009999999999994458 15.999 5.332000000000001","15.999 10.665000000000003 15.999 5.332000000000001","15.999 10.665000000000003 10.666 15.998000000000001","10.666 15.998000000000001 5.333 15.998000000000001","5.333 15.998000000000001 0 10.665000000000003","0 10.665000000000003 0 5.332000000000001","0 5.332000000000001 5.333 -0.0009999999999994458","5.333 -16 0 -10.667","0 -10.667 0 -5.334","0 -5.334 5.333 -0.0009999999999994458","10.666 -0.0009999999999994458 15.999 -5.334","15.999 -5.334 15.999 -10.667","15.999 -10.667 10.666 -16","10.666 -16 5.333 -16","5.333 -0.0009999999999994458 10.666 -0.0009999999999994458"]},"'":{path:["0 -5.330999999999998 5.333 -10.663999999999998","5.333 -10.663999999999998 5.333 -21.33"]},"`":{path:["0 -10.66 10.666 0.006000000000000227"]},"(":{path:["0 5.332000000000001 10.666 15.998000000000001","0 5.332000000000001 0 -5.334","0 -5.334 10.666 -16"]},")":{path:["0 15.998000000000001 10.666 5.332000000000001","10.666 5.332000000000001 10.666 -5.334","0 -16 10.666 -5.334"]},"*":{path:["10.666 10.672 10.666 0.006000000000000227","10.666 0.006000000000000227 10.666 -10.66","0 0.006000000000000227 10.666 0.006000000000000227","10.666 0.006000000000000227 21.332 0.006000000000000227","0 10.672 10.666 0.006000000000000227","10.666 0.006000000000000227 21.332 -10.66","0 -10.66 10.666 0.006000000000000227","10.666 0.006000000000000227 21.332 10.672"]},"+":{path:["0 0.006000000000000227 10.666 0.006000000000000227","10.666 0.006000000000000227 21.332 0.006000000000000227","10.666 10.672 10.666 0.006000000000000227","10.666 0.006000000000000227 10.666 -10.66"]},",":{path:["0 26.669 10.666 16.003","10.666 16.003 10.666 10.67","5.333 10.67 10.666 10.67","5.333 16.003 5.333 10.67","5.333 16.003 10.666 16.003"]},"-":{path:["0 0 21.332 0"]},".":{path:["0 15.993 0 10.66","0 15.993 5.333 15.993","5.333 15.993 5.333 10.66","0 10.66 5.333 10.66"]},"/":{path:["0 15.992 21.332 -5.34"]},0:{path:["0 -10.667 5.333 -16","0 10.665000000000003 0 -10.667","0 10.665000000000003 5.333 15.998000000000001","5.333 15.998000000000001 15.999 15.998000000000001","15.999 15.998000000000001 21.332 10.665000000000003","21.332 10.665000000000003 21.332 -10.667","15.999 -16 21.332 -10.667","5.333 -16 15.999 -16"]},1:{path:["5.333 15.999166666666667 5.333 -15.998833333333332","0 -10.665833333333332 5.333 -15.998833333333332","0 15.999166666666667 5.333 15.999166666666667","5.333 15.999166666666667 10.666 15.999166666666667"]},2:{path:["0 15.998000000000001 21.332 15.998000000000001","0 15.998000000000001 21.332 -5.334","21.332 -5.334 21.332 -10.667","15.999 -16 21.332 -10.667","5.333 -16 15.999 -16","0 -10.667 5.333 -16"]},3:{path:["10.666 -0.0009999999999994458 15.999 -0.0009999999999994458","0 10.665000000000003 5.333 15.998000000000001","5.333 15.998000000000001 15.999 15.998000000000001","15.999 15.998000000000001 21.332 10.665000000000003","21.332 10.665000000000003 21.332 5.332000000000001","15.999 -0.0009999999999994458 21.332 5.332000000000001","15.999 -0.0009999999999994458 21.332 -5.334","21.332 -5.334 21.332 -10.667","15.999 -16 21.332 -10.667","5.333 -16 15.999 -16","0 -10.667 5.333 -16"]},4:{path:["0 -0.0009999999999994458 15.999 -16","0 -0.0009999999999994458 15.999 -0.0009999999999994458","15.999 -0.0009999999999994458 21.332 -0.0009999999999994458","15.999 15.998000000000001 15.999 -0.0009999999999994458","15.999 -0.0009999999999994458 15.999 -16"]},5:{path:["0 10.665000000000003 5.333 15.998000000000001","5.333 15.998000000000001 15.999 15.998000000000001","15.999 15.998000000000001 21.332 10.665000000000003","21.332 10.665000000000003 21.332 -0.0009999999999994458","15.999 -5.334 21.332 -0.0009999999999994458","10.666 -5.334 15.999 -5.334","0 -0.0009999999999994458 0 -16","0 -16 21.332 -16","0 -0.0009999999999994458 10.666 -5.334"]},6:{path:["0 -0.0009999999999994458 15.999 -0.0009999999999994458","15.999 -0.0009999999999994458 21.332 5.332000000000001","21.332 10.665000000000003 21.332 5.332000000000001","15.999 15.998000000000001 21.332 10.665000000000003","5.333 15.998000000000001 15.999 15.998000000000001","0 10.665000000000003 5.333 15.998000000000001","0 10.665000000000003 0 -0.0009999999999994458","0 -0.0009999999999994458 10.666 -10.667","21.332 -16 10.666 -10.667"]},7:{path:["0 15.998000000000001 0 10.665000000000003","0 10.665000000000003 21.332 -10.667","21.332 -10.667 21.332 -16","0 -16 21.332 -16"]},8:{path:["15.999 -0.0009999999999994458 21.332 5.332000000000001","21.332 10.665000000000003 21.332 5.332000000000001","15.999 15.998000000000001 21.332 10.665000000000003","5.333 15.998000000000001 15.999 15.998000000000001","0 10.665000000000003 5.333 15.998000000000001","0 10.665000000000003 0 5.332000000000001","0 5.332000000000001 5.333 -0.0009999999999994458","0 -10.667 5.333 -16","0 -5.334 0 -10.667","0 -5.334 5.333 -0.0009999999999994458","5.333 -0.0009999999999994458 15.999 -0.0009999999999994458","15.999 -0.0009999999999994458 21.332 -5.334","21.332 -5.334 21.332 -10.667","15.999 -16 21.332 -10.667","5.333 -16 15.999 -16"]},9:{path:["0 10.665000000000003 5.333 15.998000000000001","5.333 15.998000000000001 15.999 15.998000000000001","15.999 15.998000000000001 21.332 10.665000000000003","15.999 -16 21.332 -10.667","5.333 -16 15.999 -16","0 -10.667 5.333 -16","0 -5.334 0 -10.667","0 -5.334 5.333 -0.0009999999999994458","5.333 -0.0009999999999994458 21.332 -0.0009999999999994458","21.332 10.665000000000003 21.332 -0.0009999999999994458","21.332 -0.0009999999999994458 21.332 -10.667"]},":":{path:["0 15.992 0 10.659","0 15.992 5.333 15.992","5.333 15.992 5.333 10.659","0 10.659 5.333 10.659","0 -0.006999999999999673 0 -5.34","0 -0.006999999999999673 5.333 -0.006999999999999673","5.333 -0.006999999999999673 5.333 -5.34","0 -5.34 5.333 -5.34"]},";":{path:["0 21.325000000000003 5.333 15.992","5.333 15.992 5.333 10.659","0 10.659 5.333 10.659","0 15.992 0 10.659","0 15.992 5.333 15.992","0 -0.006999999999999673 0 -5.34","0 -0.006999999999999673 5.333 -0.006999999999999673","5.333 -0.006999999999999673 5.333 -5.34","0 -5.34 5.333 -5.34"]},"<":{path:["0 -0.0009999999999994458 15.999 15.998000000000001","0 -0.0009999999999994458 15.999 -16"]},"=":{path:["0 5.3260000000000005 21.332 5.3260000000000005","0 -5.34 21.332 -5.34"]},">":{path:["0 15.998000000000001 15.999 -0.0009999999999994458","0 -16 15.999 -0.0009999999999994458"]},"?":{path:["10.666 15.998000000000001 10.666 10.665000000000003","10.666 5.332000000000001 21.332 -5.334","21.332 -5.334 21.332 -10.667","15.999 -16 21.332 -10.667","5.333 -16 15.999 -16","0 -10.667 5.333 -16"]},"@":{path:["5.333 15.998000000000001 21.332 15.998000000000001","0 10.665000000000003 5.333 15.998000000000001","0 10.665000000000003 0 -10.667","0 -10.667 5.333 -16","5.333 -16 15.999 -16","15.999 -16 21.332 -10.667","21.332 -0.0009999999999994458 21.332 -10.667","15.999 5.332000000000001 21.332 -0.0009999999999994458","10.666 5.332000000000001 15.999 5.332000000000001","10.666 5.332000000000001 10.666 -0.0009999999999994458","10.666 -0.0009999999999994458 15.999 -0.0009999999999994458","15.999 5.332000000000001 15.999 -0.0009999999999994458"]},A:{path:["0 0 21.333333333333332 0","10.666666666666666 -16 21.333333333333332 -5.333333333333334","0 -5.333333333333334 10.666666666666666 -16","0 16 0 0","0 0 0 -5.333333333333334","21.333333333333332 16 21.333333333333332 0","21.333333333333332 0 21.333333333333332 -5.333333333333334"]},B:{path:["0 0.003010249999999104 15.977769749999998 0.003010249999999104","15.986834999999997 -15.9889795 21.32306775 -10.652746750000002","0 -15.9889795 15.986834999999997 -15.9889795","21.32306775 -5.328067750000001 21.32306775 -10.652746750000002","15.990389999999998 0.004609999999999559 21.32306775 -5.328067750000001","21.329289 10.663210999999997 21.329289 5.343508999999997","15.997499999999999 15.994999999999997 21.329289 10.663210999999997","0 15.994999999999997 15.997499999999999 15.994999999999997","0 15.994999999999997 0 0.003010249999999104","0 0.003010249999999104 0 -15.9889795","15.983279999999999 -0.002500000000001279 15.990389999999998 0.004609999999999559","15.990389999999998 0.004609999999999559 21.329289 5.343508999999997"]},C:{path:["15.997499999999999 15.994999999999997 21.33 10.662499999999998","5.3325 15.994999999999997 15.997499999999999 15.994999999999997","0 10.662499999999998 5.3325 15.994999999999997","0 10.662499999999998 0 -10.6675","0 -10.6675 5.3325 -16","5.3325 -16 15.997499999999999 -16","15.997499999999999 -16 21.33 -10.6675"]},D:{path:["0 -16 15.976218999999999 -16","0 16.003999999999998 0 -16","0 16.003999999999998 16.002 16.003999999999998","15.976218999999999 -16 21.325687599999995 -10.650531400000002","21.325687599999995 10.680312399999998 21.325687599999995 -10.650531400000002","16.002 16.003999999999998 21.325687599999995 10.680312399999998"]},E:{path:["0 -0.002500000000001279 10.665 -0.002500000000001279","0 15.994999999999997 21.33 15.994999999999997","0 -16 21.33 -16","0 15.994999999999997 0 -0.002500000000001279","0 -0.002500000000001279 0 -16"]},F:{path:["0.0015997499999999998 0.0051432499999997106 10.660022999999999 0.0051432499999997106","0 -16 21.33 -16","0 15.994999999999997 0 -16"]},G:{path:["15.997499999999999 -16 21.33 -10.6675","5.3325 -16 15.997499999999999 -16","0 -10.6675 5.3325 -16","0 10.662499999999998 0 -10.6675","0 10.662499999999998 5.3325 15.994999999999997","5.3325 15.994999999999997 15.997499999999999 15.994999999999997","15.997499999999999 15.994999999999997 21.33 10.662499999999998","21.33 10.662499999999998 21.33 -0.002500000000001279","10.665 -0.002500000000001279 21.33 -0.002500000000001279"]},H:{path:["0 -0.002500000000001279 21.33 -0.002500000000001279","0 15.994999999999997 0 -0.002500000000001279","0 -0.002500000000001279 0 -16","21.33 15.994999999999997 21.33 -0.002500000000001279","21.33 -0.002500000000001279 21.33 -16"]},I:{path:["5.3325 15.994999999999997 5.3325 -16","0 -16 5.3325 -16","5.3325 -16 10.665 -16","0 15.994999999999997 5.3325 15.994999999999997","5.3325 15.994999999999997 10.665 15.994999999999997"]},J:{path:["0 10.662499999999998 5.3325 15.994999999999997","5.3325 15.994999999999997 10.665 15.994999999999997","10.665 15.994999999999997 15.997499999999999 10.662499999999998","15.997499999999999 10.662499999999998 15.997499999999999 -16","10.665 -16 15.997499999999999 -16","15.997499999999999 -16 21.33 -16"]},K:{path:["5.3325 -0.002500000000001279 21.33 15.994999999999997","0 15.994999999999997 0 5.329999999999998","0 5.329999999999998 0 -16","0 5.329999999999998 5.3325 -0.002500000000001279","5.3325 -0.002500000000001279 21.33 -16"]},L:{path:["0 15.994999999999997 21.33 15.994999999999997","0 15.994999999999997 0 -16"]},M:{path:["21.33 15.994999999999997 21.33 -16","10.665 -5.335000000000001 21.33 -16","0 -16 10.665 -5.335000000000001","0 15.994999999999997 0 -16"]},N:{path:["21.33 15.994999999999997 21.33 -16","0 -16 21.33 15.994999999999997","0 15.994999999999997 0 -16"]},O:{path:["0 -10.6675 5.3325 -16","0 10.662499999999998 0 -10.6675","0 10.662499999999998 5.3325 15.994999999999997","5.3325 15.994999999999997 15.997499999999999 15.994999999999997","15.997499999999999 15.994999999999997 21.33 10.662499999999998","21.33 10.662499999999998 21.33 -10.6675","15.997499999999999 -16 21.33 -10.6675","5.3325 -16 15.997499999999999 -16"]},P:{path:["0 5.329999999999998 15.997499999999999 5.329999999999998","15.997499999999999 5.329999999999998 21.33 -0.002500000000001279","21.33 -0.002500000000001279 21.33 -10.6675","15.997499999999999 -16 21.33 -10.6675","0 -16 15.997499999999999 -16","0 15.994999999999997 0 5.329999999999998","0 5.329999999999998 0 -16"]},Q:{path:["0 -10.6675 5.3325 -16","0 10.662499999999998 0 -10.6675","0 10.662499999999998 5.3325 15.994999999999997","5.3325 15.994999999999997 15.997499999999999 15.994999999999997","21.33 10.662499999999998 21.33 -10.6675","15.997499999999999 -16 21.33 -10.6675","5.3325 -16 15.997499999999999 -16","15.997499999999999 15.994999999999997 18.663749999999997 13.32875","18.663749999999997 13.32875 21.33 10.662499999999998","10.665 5.329999999999998 18.663749999999997 13.32875","18.663749999999997 13.32875 21.33 15.994999999999997"]},R:{path:["10.665 5.329999999999998 21.33 15.994999999999997","15.997499999999999 5.329999999999998 21.33 -0.002500000000001279","21.33 -0.002500000000001279 21.33 -10.6675","15.997499999999999 -16 21.33 -10.6675","0 -16 15.997499999999999 -16","0 15.994999999999997 0 5.329999999999998","0 5.329999999999998 0 -16","0 5.329999999999998 10.665 5.329999999999998","10.665 5.329999999999998 15.997499999999999 5.329999999999998"]},S:{path:["0 10.665000000000003 5.333 15.998000000000001","5.333 15.998000000000001 15.999 15.998000000000001","15.999 15.998000000000001 21.332 10.665000000000003","21.332 10.665000000000003 21.332 5.332000000000001","15.999 -0.0009999999999994458 21.332 5.332000000000001","5.333 -0.0009999999999994458 15.999 -0.0009999999999994458","0 -5.334 5.333 -0.0009999999999994458","0 -5.334 0 -10.667","0 -10.667 5.333 -16","5.333 -16 15.999 -16","15.999 -16 21.332 -10.667"]},T:{path:["10.666 15.998000000000001 10.666 -16","0 -16 21.332 -16"]},U:{path:["21.332 10.665000000000003 21.332 -16","15.999 15.998000000000001 21.332 10.665000000000003","5.333 15.998000000000001 15.999 15.998000000000001","0 10.665000000000003 5.333 15.998000000000001","0 10.665000000000003 0 -16"]},V:{path:["21.332 5.332000000000001 21.332 -16","10.666 15.998000000000001 21.332 5.332000000000001","0 5.332000000000001 10.666 15.998000000000001","0 5.332000000000001 0 -16"]},W:{path:["21.332 15.998000000000001 21.332 -16","10.666 5.332000000000001 21.332 15.998000000000001","0 15.998000000000001 10.666 5.332000000000001","0 15.998000000000001 0 -16"]},X:{path:["0 -16 21.332 15.998000000000001","21.332 -16 0 15.998000000000001"]},Y:{path:["10.666 -0.0009999999999994458 21.332 -10.667","0 -10.667 10.666 -0.0009999999999994458","10.666 15.998000000000001 10.666 -0.0009999999999994458","21.332 -10.667 21.332 -16","0 -10.667 0 -16"]},Z:{path:["0 15.994999999999997 21.33 15.994999999999997","0 15.994999999999997 0 10.662499999999998","0 10.662499999999998 21.33 -10.6675","21.33 -10.6675 21.33 -16","0 -16 21.33 -16"]},"[":{path:["10.666 15.998000000000001 0 15.998000000000001","0 15.998000000000001 0 -16","0 -16 10.666 -16"]},"\\":{path:["0 -5.33 21.332 16.002000000000002"]},"]":{path:["0 15.998000000000001 10.666 15.998000000000001","10.666 15.998000000000001 10.666 -16","0 -16 10.666 -16"]},"^":{path:["10.666 -10.67 21.332 -0.0039999999999995595","0 -0.0039999999999995595 10.666 -10.67"]},_:{path:["0 21.333666666666666 21.332 21.333666666666666"]},a:{path:["5.333 5.3260000000000005 21.332 5.3260000000000005","0 10.659 5.333 5.3260000000000005","0 10.659 5.333 15.992","5.333 15.992 21.332 15.992","15.999 -5.34 21.332 -0.006999999999999673","5.333 -5.34 15.999 -5.34","21.332 15.992 21.332 5.3260000000000005","21.332 5.3260000000000005 21.332 -0.006999999999999673"]},b:{path:["0 -5.334 15.999 -5.334","15.999 -5.334 21.332 -0.0009999999999994458","21.332 10.665000000000003 21.332 -0.0009999999999994458","15.999 15.998000000000001 21.332 10.665000000000003","0 15.998000000000001 15.999 15.998000000000001","0 15.998000000000001 0 -5.334","0 -5.334 0 -16"]},c:{path:["5.333 15.992 21.332 15.992","0 10.659 5.333 15.992","0 10.659 0 -0.006999999999999673","0 -0.006999999999999673 5.333 -5.34","5.333 -5.34 21.332 -5.34"]},d:{path:["5.333 -5.334 21.332 -5.334","0 -0.0009999999999994458 5.333 -5.334","0 10.665000000000003 0 -0.0009999999999994458","0 10.665000000000003 5.333 15.998000000000001","5.333 15.998000000000001 21.332 15.998000000000001","21.332 15.998000000000001 21.332 -5.334","21.332 -5.334 21.332 -16"]},e:{path:["5.333 15.992 15.999 15.992","0 10.659 5.333 15.992","0 -0.006999999999999673 5.333 -5.34","5.333 -5.34 15.999 -5.34","15.999 -5.34 21.332 -0.006999999999999673","21.332 5.3260000000000005 21.332 -0.006999999999999673","0 5.3260000000000005 21.332 5.3260000000000005","0 10.659 0 5.3260000000000005","0 5.3260000000000005 0 -0.006999999999999673"]},f:{path:["5.333 -10.667 10.666 -16","0 -0.0009999999999994458 5.333 -0.0009999999999994458","5.333 -0.0009999999999994458 10.666 -0.0009999999999994458","5.333 15.998000000000001 5.333 -0.0009999999999994458","5.333 -0.0009999999999994458 5.333 -10.667"]},g:{path:["10.666 26.666833333333336 15.999 26.666833333333336","15.999 26.666833333333336 21.332 21.333833333333335","5.333 -5.331166666666666 21.332 -5.331166666666666","0 0.0018333333333337976 5.333 -5.331166666666666","0 10.667833333333334 0 0.0018333333333337976","0 10.667833333333334 5.333 16.000833333333336","5.333 16.000833333333336 21.332 16.000833333333336","21.332 21.333833333333335 21.332 16.000833333333336","21.332 16.000833333333336 21.332 -5.331166666666666"]},h:{path:["21.332 15.998000000000001 21.332 -0.0009999999999994458","15.999 -5.334 21.332 -0.0009999999999994458","5.333 -5.334 15.999 -5.334","0 -0.0009999999999994458 5.333 -5.334","0 15.998000000000001 0 -0.0009999999999994458","0 -0.0009999999999994458 0 -16"]},i:{path:["5.333 15.998000000000001 5.333 -5.334","0 -5.334 5.333 -5.334","5.333 -16 5.333 -16","0 15.998000000000001 5.333 15.998000000000001","5.333 15.998000000000001 10.666 15.998000000000001"]},j:{path:["0 26.664 5.333 26.664","5.333 26.664 10.666 21.331000000000003","10.666 21.331000000000003 10.666 -5.334","10.666 -16 10.666 -16"]},k:{path:["0 15.998000000000001 0 -16","0 5.332000000000001 15.999 -5.334","0 5.332000000000001 15.999 15.998000000000001"]},l:{path:["5.333 15.998000000000001 5.333 -16","0 -16 5.333 -16","0 15.998000000000001 5.333 15.998000000000001","5.333 15.998000000000001 10.666 15.998000000000001"]},m:{path:["10.666 15.992 10.666 -0.006999999999999673","21.332 15.992 21.332 -0.006999999999999673","15.999 -5.34 21.332 -0.006999999999999673","10.666 -0.006999999999999673 15.999 -5.34","5.333 -5.34 10.666 -0.006999999999999673","0 -5.34 5.333 -5.34","0 15.992 0 -5.34"]},n:{path:["15.999 -5.34 0 -5.34","0 -5.34 0 15.992","21.332 -0.006999999999999673 15.999 -5.34","21.332 15.992 21.332 -0.006999999999999673"]},o:{path:["0 -0.006999999999999673 5.333 -5.34","0 10.659 0 -0.006999999999999673","0 10.659 5.333 15.992","5.333 15.992 15.999 15.992","15.999 15.992 21.332 10.659","21.332 10.659 21.332 -0.006999999999999673","15.999 -5.34 21.332 -0.006999999999999673","5.333 -5.34 15.999 -5.34"]},p:{path:["0 15.992 15.999 15.992","15.999 15.992 21.332 10.659","21.332 10.659 21.332 -0.006999999999999673","15.999 -5.34 21.332 -0.006999999999999673","0 -5.34 15.999 -5.34","0 26.658 0 15.992","0 15.992 0 -5.34"]},q:{path:["5.333 15.992 21.332 15.992","0 10.659 5.333 15.992","0 10.659 0 -0.006999999999999673","0 -0.006999999999999673 5.333 -5.34","5.333 -5.34 21.332 -5.34","21.332 26.658 21.332 15.992","21.332 15.992 21.332 -5.34"]},r:{path:["0 5.3260000000000005 10.666 -5.34","10.666 -5.34 15.999 -5.34","0 15.992 0 5.3260000000000005","0 5.3260000000000005 0 -5.34"]},s:{path:["0 15.992 15.999 15.992","15.999 15.992 21.332 10.659","15.999 5.3260000000000005 21.332 10.659","5.333 5.3260000000000005 15.999 5.3260000000000005","0 -0.006999999999999673 5.333 5.3260000000000005","0 -0.006999999999999673 5.333 -5.34","5.333 -5.34 21.332 -5.34"]},t:{path:["10.666 16.005000000000003 5.333 10.672","0 -5.327 5.333 -5.327","5.333 -5.327 10.666 -5.327","5.333 10.672 5.333 -5.327","5.333 -5.327 5.333 -10.66"]},u:{path:["21.332 15.992 21.332 -5.34","5.333 15.992 21.332 15.992","0 10.659 5.333 15.992","0 10.659 0 -5.34"]},v:{path:["10.666 15.992 0 -5.34","10.666 15.992 21.332 -5.34"]},w:{path:["21.332 10.659 21.332 -5.34","15.999 15.992 21.332 10.659","10.666 10.659 15.999 15.992","5.333 15.992 10.666 10.659","0 10.659 5.333 15.992","0 10.659 0 -5.34"]},x:{path:["0 15.992 10.666 5.3260000000000005","10.666 5.3260000000000005 21.332 -5.34","0 -5.34 10.666 5.3260000000000005","10.666 5.3260000000000005 21.332 15.992"]},y:{path:["10.666 26.658 15.999 26.658","15.999 26.658 21.332 21.325000000000003","5.333 15.992 21.332 15.992","0 10.659 5.333 15.992","0 10.659 0 -5.34","21.332 21.325000000000003 21.332 15.992","21.332 15.992 21.332 -5.34"]},z:{path:["0 15.992 21.332 15.992","0 15.992 21.332 -5.34","0 -5.34 21.332 -5.34"]},"{":{path:["10.666 15.998000000000001 15.999 15.998000000000001","5.333 10.665000000000003 10.666 15.998000000000001","5.333 10.665000000000003 5.333 5.332000000000001","0 -0.0009999999999994458 5.333 5.332000000000001","0 -0.0009999999999994458 5.333 -5.334","5.333 -5.334 5.333 -10.667","5.333 -10.667 10.666 -16","10.666 -16 15.999 -16"]},"|":{path:["0 -16 0 16"]},"}":{path:["0 15.998000000000001 5.333 15.998000000000001","5.333 15.998000000000001 10.666 10.665000000000003","10.666 10.665000000000003 10.666 5.332000000000001","10.666 5.332000000000001 15.999 -0.0009999999999994458","10.666 -5.334 15.999 -0.0009999999999994458","10.666 -5.334 10.666 -10.667","5.333 -16 10.666 -10.667","0 -16 5.333 -16"]},"~":{path:["15.999 -15.996999999999998 21.332 -21.33","5.333 -15.996999999999998 15.999 -15.996999999999998","0 -10.663999999999998 5.333 -15.996999999999998"]},"\xB0":{path:["3 -11 0 -8 3 -5 6 -8 3 -11"]},\u03A9:{path:["0 9 7 9 5 6 3 3 2 0 2 -3 3 -6 4 -8 6 -10 8 -11 12 -11 14 -10 16 -8 17 -6 18 -3 18 0 17 3 15 6 13 9 20 9"]},\u03BC:{path:["0 14 1 4 1 -6 1 4 2 7 4 8 6 8 8 7 10 4 10 -6 10 6 11 8 12 9"]}},FP.spacing={1:15.99,I:15.99,f:15.99,i:15.99,k:15.99,l:15.99,r:15.99,t:15.99,"(":15.99,")":15.99,"[":15.99,"]":15.99,"'":15.99,"{":15.99,"}":15.99,'"':15.99,"|":15.99,"<":15.99,"?":15.99,j:21.32,"`":21.32,";":21.32,",":21.32,".":21.32,":":21.32};var Hk=FP;var VP=class VP{static setFontHeight(t){VP.height=+t}static getFontHeight(){return VP.height||4.5}static getCharInfo(t,e,r){function i(u,d,p,m,g){let y="",b=u.length;for(let P=0;P<b;P++){let T=u[P].split(" "),I=0,C=T.length;for(;I<C;I+=2)T[I]=gn(p+d*T[I],2),T[I+1]=gn(m+d*(+T[I+1]-16),2);let E="M "+T[0]+" "+T[1];for(I=2;I<C;I++)I%2===0&&(E+="L"),E+=T[I]+" ";y+=E}return y}if(VP.fontPath[t]){var n=VP.fontPath[t].path,s=VP.getPathBBox(n),a=Math.abs(s.R-s.L),l=Math.abs(s.T-s.B);l===0&&(l=1);var c=VP.getFontHeight()/32;a=a*c;var h=i(n,c,e,r,l);return[h,a]}else return["",0]}static getPathBBox(t){for(var e=t.length,r={L:9999,T:-9999,R:-9999,B:9999},i,n,s=0;s<e;s++){for(var a=t[s].split(" "),l=0,c=a.length;l<c;l+=2)i=+a[l],n=+a[l+1],r.L>i&&(r.L=i),r.T<n&&(r.T=n),r.R<i&&(r.R=i),r.B>n&&(r.B=n);a=null}return r}static getSpaceWidth(t){return 28.797554799999986*t}static everyCharHasDefaultFontPath(t){let e=t.toString().replace(/\s/g,"").split("");for(let r of e)if(VP.fontPath[r]==null)return!1;return!0}static getSpacing(t){return VP.spacing[t]||10.66}};VP._fontsCache={},VP.fontPath={0:{path:["12.190145800000046 -15.998443799999961 15.237282200000013 -14.474697800000012","15.237282200000013 -14.474697800000012 16.760139200000022 -12.95201859999996","16.760139200000022 -12.95201859999996 18.284240799999964 -9.9038154","18.284240799999964 -9.9038154 19.80798679999999 -2.284907599999981","19.80798679999999 2.2861525999999905 19.80798679999999 -2.284907599999981","18.289040239959657 9.88035361823414 19.80798679999999 2.2861525999999905","15.236926600000022 14.475053800000008 16.76137900652654 12.950245545572814","12.189434599999963 15.998622000000001 15.236926600000022 14.475053800000008","6.0948062 14.474876000000052 9.141586999999989 15.998622000000001","4.5710601999999705 12.951307800000059 6.0948062 14.474876000000052","3.0476698000000138 9.904526999999984 4.5710601999999705 12.951307800000059","1.5237460000000291 2.2861525999999905 3.0476698000000138 9.904526999999984","1.5237460000000291 2.2861525999999905 1.5237460000000291 -2.2859743999999544","1.5237460000000291 -2.2859743999999544 3.0473142000000224 -9.9038154","3.0473142000000224 -9.9038154 4.571415799999962 -12.951485200000011","4.571415799999962 -12.951485200000011 6.0953396000000275 -14.474875599999969","6.0953396000000275 -14.474875599999969 9.14265379999997 -15.998443799999961","4.5710601999999705 -14.474342199999942 9.14265379999997 -15.998443799999961","1.5242793999999762 -9.9038154 4.5710601999999705 -14.474342199999942","0 -2.285263199999971 1.5242793999999762 -9.9038154","0 2.2859748000000355 0 -2.285263199999971","0 2.2859748000000355 1.523568199999993 9.9038158","1.523568199999993 9.9038158 4.5710601999999705 14.475053800000008","4.5710601999999705 14.475053800000008 9.141586999999996 15.998622000000001","9.141586999999996 15.998622000000001 12.189434599999963 15.998622000000001","16.762934294775164 14.448991354225557 19.806564400000028 9.908260800000017","19.806564400000028 9.908260800000017 21.331554999999984 2.2863304000000273","21.331554999999984 2.2863304000000273 21.331554999999984 -2.285263199999971","19.808342399999983 -9.903281999999972 21.331554999999984 -2.285263199999971","16.760850400000006 -14.474697800000012 19.808342399999983 -9.903281999999972","12.190145800000035 -15.998443799999961 16.760850400000006 -14.474697800000012","9.14265379999997 -15.998443799999961 12.190145800000035 -15.998443799999961","16.76137900652654 12.950245545572814 18.289040239959657 9.880353618234139","12.189434599999963 15.998622000000001 16.762934294775164 14.448991354225557"]},1:{path:["6.094272799999972 15.920034399999999 6.094272799999972 14.42366959999997","6.094272799999972 14.42366959999997 6.094272799999972 -14.553107599999947","0 15.920034399999999 13.712825 15.920034399999999","7.6180188000000015 15.920034399999999 7.6180188000000015 -16.076675799999965","3.0467807999999943 -11.505971199999994 7.6180188000000015 -16.076675799999972","0 -9.982402999999998 3.0467807999999943 -11.505971199999994"]},2:{path:["13.713536199999984 -15.998443799999961 18.284240800000045 -14.474342199999942","18.284240800000045 -14.474342199999942 19.8076312 -12.951307399999976","19.8076312 -12.951307399999976 21.331732800000022 -9.903459800000007","21.331732800000022 -6.856679000000014 21.331732800000022 -9.903459800000007","19.808342399999983 -3.8091869999999552 21.331732800000022 -6.856679000000014","15.238171200000032 -0.7624061999999618 19.808342399999983 -3.8091869999999552","7.619441200000049 2.285085800000015 15.238171200000032 -0.7624061999999618","4.571415800000043 11.427206200000038 12.189434600000045 15.998622000000001","12.189434600000045 15.998622000000001 18.284240800000045 15.998622000000001","18.284240800000045 15.998622000000001 19.808342399999983 14.474164799999988","19.808342399999983 14.474164799999988 21.331554999999977 11.42756180000004","21.331554999999984 11.427561800000033 21.331554999999984 8.380069800000053","19.80674219999998 12.951841200000006 21.331554999999984 11.427561800000033","16.760139200000022 14.474876000000052 19.80674219999998 12.951841200000006","12.189079000000053 14.474876000000052 16.760139200000022 14.474876000000052","4.571415800000043 11.427206200000038 12.189079000000053 14.474876000000052","1.524101600000021 11.427206200000038 4.571415800000043 11.427206200000038","0.0003555999999915911 12.950418862233152 1.524101600000021 11.427206200000038","0.0003555999999915911 15.997910800000017 0.0003555999999915911 11.426673856114697","0.0003555999999915911 11.426673856114697 1.5239237999999846 6.856501600000059","1.5239237999999846 6.856501600000059 4.570526800000024 3.8102542000000117","4.570526800000024 3.8102542000000117 7.619441200000049 2.285085800000015","7.619441200000049 2.285085800000015 13.714247400000048 -0.7627617999999536","13.714247400000048 -0.7627617999999536 18.2844186 -3.8097203999999856","18.2844186 -3.8097203999999856 19.80905360000005 -6.856145599999987","19.80905360000005 -6.856145599999987 19.80905360000005 -9.902570799999989","18.284063000000007 -12.951307399999976 19.80905360000005 -9.902570799999989","16.76031699999998 -14.474875599999969 18.284063000000007 -12.951307399999976","13.713536199999984 -15.998443799999961 16.76031699999998 -14.474875599999969","7.616241297864937 -15.998443799999961 13.713536199999984 -15.998443799999961","3.0476698000000138 -14.47523119999996 7.616241297864936 -15.998443799999961","1.523568199999993 -12.951307399999976 3.0476698000000138 -14.47523119999996","0 -9.9038154 1.523568199999993 -12.951307399999976","0 -8.38095839999999 0 -9.9038154","0 -8.38095839999999 1.5237460000000294 -6.8563233999999404","1.5237460000000294 -6.8563233999999404 3.0474919999999774 -8.380069399999972","1.5244572000000125 -9.9038154 3.0474919999999774 -8.380069399999972"]},3:{path:["13.713358400000029 -15.998443800000043 16.76067259999997 -14.47487560000005","16.76067259999997 -14.47487560000005 18.284952000000025 -11.427383600000073","18.284952000000025 -6.856145600000069 18.284952000000025 -11.427383600000073","16.761028199999963 -3.809187000000037 18.284952000000025 -6.856145600000069","13.71406960000001 -2.2854410000000076 16.761028199999963 -3.809187000000037","18.28552830822789 0.7626274066353762 19.80798679999999 5.333288999999977","19.80798679999999 9.904704799999939 19.80798679999999 5.333288999999977","18.284952000000025 12.951307799999979 19.80798679999999 9.904704799999939","16.76067259999997 14.475053799999927 18.284952000000025 12.951307799999979","13.713180599999992 15.998622000000001 16.76067259999997 14.475053799999927","1.5237460000000294 9.904349199999949 3.0474919999999774 8.380069799999973","1.5237460000000294 6.85596819999995 3.0474919999999774 8.380069799999973","0 8.379714199999981 1.5237460000000294 6.85596819999995","0 9.903282399999974 0 8.379714199999981","0 9.903282399999974 1.5233904000000378 12.950596599999995","1.5233904000000378 12.950596599999995 3.0478475999999692 14.475053799999927","3.0478475999999692 14.475053799999927 7.619441199999967 15.998622000000001","7.619441199999967 15.998622000000001 13.713180599999992 15.998622000000001","13.713180599999992 15.998622000000001 18.284952000000025 14.474342599999943","18.284952000000025 14.474342599999943 19.80816460000003 12.950952199999987","19.80816460000003 12.950952199999987 21.331910599999976 9.9038158","21.331910599999976 9.9038158 21.331910599999976 5.333111199999941","19.807809000000038 2.285085799999935 21.331910599999976 5.333111199999941","16.76156159999999 -0.7615172000000232 19.807809000000038 2.285085799999935","13.71406960000001 -2.2854410000000076 16.76156159999999 -0.7615172000000232","9.142476000000013 -2.2854410000000076 13.71406960000001 -2.2854410000000076","13.71406960000001 -2.2854410000000076 18.28477419999999 -3.809187000000037","18.28477419999999 -3.809187000000037 19.80798679999999 -6.856501200000061","19.80798679999999 -6.856501200000061 19.80798679999999 -11.427561400000027","18.284063000000007 -14.475053400000004 19.80798679999999 -11.427561400000027","13.713358400000029 -15.998443800000043 18.284063000000007 -14.475053400000004","7.618552200000028 -15.998443800000043 13.713358400000029 -15.998443800000043","3.0473142000000224 -14.474697800000012 7.618552200000028 -15.998443800000043","1.5244572000000125 -12.952018600000041 3.0473142000000224 -14.474697800000012","0.000533400000027814 -9.903993200000038 1.5244572000000125 -12.952018600000041","0.000533400000027814 -8.379892841909214 0.000533400000027814 -9.903993200000038","0.000533400000027814 -8.379892841909214 1.5242793999999762 -6.856679000000014","1.5242793999999762 -6.856679000000014 3.0478475999999692 -8.380069400000053","1.5239237999999846 -9.903637600000046 3.0478475999999692 -8.380069400000053"]},4:{path:["0 6.854190199999993 24.379047000000043 6.854190199999993","0 6.854190199999993 16.760494800000014 -16.000933000000064","16.760494800000014 15.996132799999979 16.760494800000014 -16.00093300000006","15.236748800000067 15.996132799999979 15.236748800000067 -12.953618800000044","10.666399799999999 15.996132799999979 21.331555000000066 15.996132799999979"]},5:{path:["0.00906779999998771 9.913633794155809 0.00906779999998771 8.390425400000044","0.00906779999998771 -0.7511615999999515 3.0565597999999654 -15.988621599999918","0.00906779999998771 -0.7511615999999515 3.0565597999999654 -3.7986536000000104","0.00906779999998771 9.913633794155809 1.533347199999964 12.961485600000014","0.00906779999998771 8.390425400000044 1.5329915999999724 6.866501600000059","1.5329915999999724 6.866501600000059 3.0569154000000376 8.390425400000044","1.5329915999999724 9.914349200000029 3.0569154000000376 8.390425400000044","1.533347199999964 12.961485600000014 3.0569154000000376 14.485053800000008","2.75177503999997 -14.464697799999934 10.673867399999983 -14.464697799999934","3.0565597999999654 -15.988621599999918 18.292775200000005 -15.988621599999918","3.0565597999999654 -3.7986536000000104 7.627086599999989 -5.32275520000003","3.0569154000000376 14.485053800000008 7.628153399999964 16.008622000000003","7.627086599999989 -5.32275520000003 12.201880599999992 -5.32275520000003","7.628153399999964 16.008622000000003 12.198324599999996 16.008622000000003","10.673867399999983 -14.464697799999934 18.292775200000005 -15.988621599999918","12.198324599999996 16.008622000000003 15.246350000000001 14.484164799999988","12.198324599999996 16.008622000000003 16.76974040000004 14.485053800000008","12.201880599999939 -5.3227552000000475 15.245460999999981 -3.799542600000029","12.201880599999992 -5.32275520000003 16.769562600000004 -3.7991869999999555","15.245460999999981 -3.799542600000029 18.29348639999999 -0.7515172000000232","15.246350000000001 14.484164799999988 18.293574477761666 11.436940322238323","16.769562600000004 -3.7991869999999555 19.816876800000024 -0.7518727999999333","16.76974040000004 14.485053800000008 19.816876800000024 11.437917400000021","18.29348639999999 -0.7515172000000232 19.816876800000024 3.819365200000073","18.293574477761666 11.436940322238323 19.816876800000024 6.866501600000059","19.816876800000024 6.866501600000059 19.816876800000024 3.819365200000073","19.816876800000024 -0.7518727999999333 21.340622799999974 3.819187400000036","19.816876800000024 11.437917400000021 21.340622799999974 6.86685720000005","21.340622799999974 6.86685720000005 21.340622799999974 3.819187400000036"]},6:{path:["6.095161799999992 14.475587200000035 9.141586999999996 15.998622000000001","3.0476698000000138 11.427917400000021 6.095161799999992 14.475587200000035","1.523568199999993 6.856501599999978 3.0476698000000138 11.427917400000021","1.523568199999993 6.856501599999978 1.523568199999993 -2.285085400000016","1.523568199999993 -2.285085400000016 3.047136399999986 -8.37971379999998","3.047136399999986 -8.37971379999998 4.570704599999979 -11.426672400000008","4.570704599999979 -11.426672400000008 7.618729999999984 -14.47523119999996","7.618729999999984 -14.47523119999996 10.666399799999999 -15.998977199999988","12.189256800000008 15.998622000000001 15.237282200000013 14.474698200000017","15.237282200000013 14.474698200000017 18.283707400000015 11.428450799999968","18.283707400000015 11.428450799999968 19.807808999999956 6.856501599999978","19.807808999999956 6.856501599999978 19.807808999999956 5.333111200000022","18.284063000000007 0.7615176000000226 19.807808999999956 5.333111200000022","15.237104399999977 -2.285263199999971 18.284063000000007 0.7615176000000226","12.189968000000006 -3.8091870000000334 15.237104399999977 -2.285263199999971","1.523568199999993 5.333644599999885 3.0474919999999774 0.7618732000000144","3.0474919999999774 0.7618732000000144 6.094272799999972 -2.284551999999989","6.094272799999972 -2.284551999999989 10.666044200000007 -3.809187000000037","10.666044200000007 -3.809187000000037 12.189967999999991 -3.809187000000037","12.189967999999991 -3.809187000000037 16.75942799999996 -2.286507799999983","16.75942799999996 -2.286507799999983 19.8076312 0.7613397999999858","19.8076312 0.7613397999999858 21.331732800000022 5.332933399999985","21.331732800000022 6.855790399999995 21.331732800000022 5.332933399999985","19.807275600000008 11.428450799999968 21.331732800000022 6.855790399999995","16.76031699999998 14.475231599999963 19.807275600000008 11.428450799999968","12.189256800000008 15.998622000000001 16.76031699999998 14.475231599999963","9.141586999999994 15.998622000000001 12.189256800000008 15.998622000000001","4.571238000000007 14.4754094 9.141586999999994 15.998622000000001","1.5239237999999846 11.428273000000013 4.571238000000007 14.4754094","0 6.857390599999998 1.5239237999999846 11.428273000000013","0 6.857390599999998 0 -2.284907599999981","0 -2.284907599999981 1.5239237999999846 -8.380602799999998","1.5239237999999846 -8.380602799999998 3.0473142000000224 -11.427383599999992","3.0473142000000224 -11.427383599999992 6.095161799999992 -14.474875599999969","6.095161799999992 -14.474875599999969 10.666399799999999 -15.998977199999988","15.236926600000022 -15.998977199999988 18.284063000000007 -14.475053400000004","10.666399799999999 -15.998977199999988 15.236926600000022 -15.998977199999988","18.284063000000007 -14.475053400000004 19.80816460000003 -11.427205800000035","19.80816460000003 -9.904170999999991 19.80816460000003 -11.427205800000035","18.284063000000007 -8.380069399999972 19.80816460000003 -9.904170999999991","16.760494800000014 -9.903637599999964 18.284063000000007 -8.380069399999972","16.760494800000014 -9.903637599999964 18.285129799999982 -11.428450399999967"]},7:{path:["1.5241016000000207 -12.951662999999968 4.571593599999998 -14.475053400000004","4.571593599999998 -14.475053400000004 7.618729999999984 -14.475053400000004","7.618729999999984 -14.475053400000004 15.237459999999974 -11.427561400000062","9.142298200000058 15.998444200000046 9.142298200000058 8.379536400000024","9.142298200000058 8.379536400000024 10.666222000000042 3.8086540000000095","10.666222000000042 3.8086540000000095 12.189256800000008 0.7620509999999694","12.189256800000008 0.7620509999999694 19.807809000000038 -6.8565011999999825","10.665866400000052 15.998622000000001 10.665866400000052 8.380247600000008","10.665866400000052 8.380247600000008 12.189434600000045 3.8093651999999913","12.189434600000045 3.8093651999999913 13.71371400000002 0.7611620000000308","13.71371400000002 0.7611620000000308 19.807809000000038 -6.85650119999999","19.80780900000004 -6.856501199999993 21.33137720000003 -11.42827260000001","21.33137720000003 -11.42827260000001 21.33137720000003 -15.998443799999961","19.807809000000038 -12.95112960000002 21.33137720000003 -15.998443799999961","18.284240800000045 -11.427561400000027 19.807809000000038 -12.95112960000002","15.237460000000032 -11.427561400000027 18.284240800000045 -11.427561400000027","7.618907800000021 -15.998621599999996 15.237460000000029 -11.427561400000027","4.571415800000043 -15.998621599999996 7.618907800000021 -15.998621599999996","1.5241016000000207 -12.951662999999968 4.571415800000043 -15.998621599999996","0 -9.904170999999998 1.5241016000000207 -12.951662999999968","0 -6.856856799999971 0 -15.998621599999996"]},8:{path:["0 3.809542999999948 1.523568199999993 0.7622288000000061","1.523568199999993 0.7622288000000061 3.0474919999999774 -0.7620506000000518","1.5242793999999762 9.904882206453763 1.5242793999999762 3.8079421783217047","1.5242793999999762 9.904882206453763 3.047136399999986 12.950418799999959","3.047136399999986 12.950418799999959 4.57194919999999 14.475053800000008","4.57194919999999 14.475053800000008 7.618552200000029 15.998622000000001","1.5242793999999762 3.8079421783217047 3.0480254000000055 0.7599173999999387","3.0480254000000055 0.7599173999999387 4.575860799999979 -0.7648954000000643","4.575860799999979 -0.7648954000000643 7.618552200000029 -2.2856188000000444","18.28495200000003 12.950241000000004 19.80816460000003 9.90274887546099","16.75978360000003 14.475053800000008 18.28495200000003 12.950241000000004","13.713180599999992 15.998622000000001 16.75978360000003 14.475053800000008","16.759961399999987 -0.7624062000000418 18.284063000000007 0.7618731999999344","13.713358400000029 -2.2856188000000444 16.759961399999987 -0.7624062000000418","13.713358400000029 -2.2856188000000444 18.284063000000007 -0.7622284000000068","18.284063000000007 -0.7622284000000068 19.80816460000003 0.7625843999999979","21.331554999999984 9.904171399999992 21.331554999999984 3.809542999999948","19.808697999999975 12.950063199999967 21.331554999999984 9.904171399999992","18.28352959999998 14.475053800000008 19.808697999999975 12.950063199999967","13.713180599999992 15.998622000000001 18.28352959999998 14.475053800000008","7.618552200000029 15.998622000000001 13.713180599999992 15.998622000000001","3.047136399999986 14.474698199999935 7.618552200000029 15.998622000000001","1.5241016000000207 12.95166339999997 3.047136399999986 14.474698199999935","0 9.9038158 1.5241016000000207 12.95166339999997","0 9.9038158 0 3.809542999999948","3.0474919999999774 -0.7620506000000518 7.618552200000029 -2.2856188000000444","13.713713999999985 -15.998621599999996 16.76031699999998 -14.475408999999996","16.76031699999998 -14.475408999999996 18.284240799999964 -11.427205800000035","18.284240799999964 -6.8573901999999975 18.284240799999964 -11.427205800000035","16.76067259999997 -3.809364799999994 18.284240799999964 -6.8573901999999975","13.713358400000029 -2.2856188000000444 16.76067259999997 -3.809364799999994","4.5710601999999705 -3.809364799999994 7.618552200000051 -2.2856188000000444","3.0474919999999774 -6.857034600000006 4.5710601999999705 -3.809364799999994","3.0474919999999774 -6.857034600000006 3.0474919999999774 -11.427561400000027","3.0474919999999774 -11.427561400000027 4.571771400000035 -14.475408999999996","4.571771400000035 -14.475408999999996 7.618374399999992 -15.998621599999996","3.0474919999999774 -14.47487560000005 7.618374399999992 -15.998621599999996","1.5233904000000376 -11.427917000000019 3.0474919999999774 -14.47487560000005","1.5233904000000376 -6.8573901999999975 1.5233904000000376 -11.427917000000019","1.5233904000000376 -6.8573901999999975 3.047136399999986 -3.809364799999994","3.047136399999986 -3.809364799999994 7.618552200000029 -2.2856188000000444","7.618552200000029 -2.2856188000000444 13.713358400000029 -2.2856188000000444","13.713358400000029 -2.2856188000000444 18.2844186 -3.8097204000000637","18.2844186 -3.8097204000000637 19.807809000000038 -6.857034600000006","19.807809000000038 -6.857034600000006 19.807809000000038 -11.427917000000019","18.2844186 -14.47487560000005 19.807809000000038 -11.427917000000019","13.71371400000002 -15.998621599999996 18.2844186 -14.47487560000005","7.618374399999992 -15.998621599999996 13.71371400000002 -15.998621599999996","19.80816460000003 0.7625843999999979 21.331554999999984 3.809542999999948","18.284063000000007 0.7618731999999344 19.80816460000003 3.8090095999999996","19.80816460000003 9.90274887546099 19.80816460000003 3.8090095999999996"]},9:{path:["6.094983999999996 2.2861525999999905 9.142298199999976 3.809543000000028","3.047136399999986 -0.7616949999999783 6.094983999999996 2.2861525999999905","1.5239237999999846 -5.332577399999995 3.047136399999986 -0.7616949999999783","1.5239237999999846 -5.332577399999995 1.5239237999999846 -6.856501199999979","1.5239237999999846 -6.856501199999979 3.0474919999999774 -11.427561399999945","3.0474919999999774 -11.427561399999945 6.094272800000012 -14.474342199999942","6.094272800000012 -14.474342199999942 9.14247599999997 -15.99808819999997","10.666044200000007 15.998622000000001 13.713358400000029 14.474876000000052","13.713358400000029 14.474876000000052 16.76067259999997 11.427206200000038","16.76067259999997 11.427206200000038 18.283885199999972 8.3806032","18.283885199999972 8.3806032 19.807808999999956 2.283485600000013","19.807808999999956 2.283485600000013 19.807808999999956 -5.333457457212486","19.807808999999956 -5.333457457212486 19.807808999999956 -6.856145599999987","18.284063000000007 -11.427028 19.807808999999956 -6.856145599999987","15.236393199999995 -14.474697800000012 18.284063000000007 -11.427028","12.189612399999932 -15.998088199999994 15.236393199999995 -14.474697800000012","18.28495200000003 -0.7616949999999783 19.807808999999956 -5.333457457212486","15.236393199999995 2.2857969999999987 18.28495200000003 -0.7616949999999783","10.665510799999979 3.809543000000028 15.236393199999995 2.2857969999999987","9.142298199999978 3.809543000000028 10.665510799999979 3.809543000000028","4.571238000000007 2.2861525999999905 9.14229819999998 3.809543000000028","1.5237459999999887 -0.7608059999999597 4.571238000000007 2.2861525999999905","0 -5.334177599999997 1.5237459999999887 -0.7608059999999597","0 -5.334177599999997 0 -6.856679000000014","0 -6.856679000000014 1.5237459999999887 -11.427561399999945","1.5237459999999887 -11.427561399999945 4.5708824000000154 -14.474697800000012","4.5708824000000154 -14.474697800000012 9.142476000000059 -15.99808819999997","3.0474919999999774 11.42756180000003 4.571060200000011 9.904171399999992","3.047314199999982 8.380247600000008 4.571060200000011 9.904171399999992","1.5233903999999971 9.904171399999992 3.047314199999982 8.380247600000008","1.5233903999999971 11.427562152038233 1.5233903999999971 9.904171399999992","1.5233903999999971 11.427562152038233 3.04695859999999 14.474876000000052","3.04695859999999 14.474876000000052 6.0948062 15.998622000000001","6.0948062 15.998622000000001 10.666044200000007 15.998622000000001","10.666044200000007 15.998622000000001 15.236926600000022 14.474698200000017","15.236926600000022 14.474698200000017 18.284596400000037 11.426495000000056","18.284596400000037 11.426495000000056 19.80798679999999 8.379714199999981","19.80798679999999 8.379714199999981 21.33137720000003 2.2859748000000355","21.33137720000003 2.2859748000000355 21.33137720000003 -6.856501199999979","19.807808999999956 -11.427028 21.33137720000003 -6.856501199999979","9.142476000000059 -15.99808819999997 12.1896124 -15.99808819999997","12.189612400000007 -15.99808819999997 16.760850400000006 -14.474342199999942","16.760850400000006 -14.474342199999942 19.807808999999956 -11.427028"]},"!":{path:["0.0013461887890558622 -12.931154977577993 1.5249906000000402 -15.978443799999962","0.0013461887890558694 -12.931154977577993 1.5249906000000402 5.352755600000029","0.0014224000000472188 14.495053800000008 1.5249906000000402 12.971485600000014","0.0014224000000472188 14.495053800000008 1.5249906000000402 16.018622","1.524812800000004 -3.7890092000000024 1.524812800000004 -12.931307399999977","1.5249906000000402 16.018622 3.048558800000033 14.495053800000008","1.5249906000000402 12.971485600000014 3.048558800000033 14.495053800000008","1.5249906000000402 5.352755600000029 3.0487366000000695 -12.93077399999995","1.5249906000000402 -15.978443799999962 3.0487366000000695 -12.93077399999995"]},'"':{path:["0 -5.351733599999992 3.0473141999999416 -16.017066600000017","0 -5.351733599999992 1.5237459999999483 -16.01724439999997","9.599066399999968 -5.351377999999983 12.646380599999993 -16.016711000000026","9.599066399999968 -5.351377999999983 11.122812399999999 -16.016711000000026"]},"#":{path:["0 9.894749000000024 21.330843800000004 9.894749000000024","1.5244572000000125 0.7528064000000398 22.854767600000066 0.7528064000000398","10.665333000000023 26.654888200000048 21.33013260000002 -16.006977199999987","1.5221458000000265 26.658622 12.197613400000012 -15.991330799999957"]},$:{path:["7.618374399999992 22.103622 7.618374399999992 -22.083233999999997","13.713180599999992 22.10308859999997 13.713180599999992 -22.084834200000003","18.284240800000003 2.2958130000000025 21.331377199999988 5.3429493999999895","15.235682000000011 0.7713557999999914 18.284240800000003 2.2958130000000025","6.093383799999993 -2.276314000000024 15.235682000000011 0.7713557999999914","3.0476698000000138 -3.7989931999999946 6.093383799999993 -2.276314000000024","1.5237459999999887 -5.323094800000014 3.0476698000000138 -3.7989931999999946","0 -8.370053400000003 1.5237459999999887 -5.323094800000014","1.523568199999993 11.437577799999993 3.047314200000021 9.913831800000006","1.5237459999999887 8.390263599999972 3.047314200000021 9.913831800000006","0 9.9140096 1.5237459999999887 8.390263599999972","0 11.437399999999998 0 9.9140096","0 11.437399999999998 3.047492000000018 14.484891999999975","3.047492000000018 14.484891999999975 7.618196599999998 16.00846019999997","7.618196599999998 16.00846019999997 13.713350447746311 16.00846019999997","13.713350447746313 16.00846019999997 18.284240800000003 14.484180799999992","18.284240800000003 14.484180799999992 21.331377199999988 11.437044400000007","21.331377199999988 11.437044400000007 21.331377199999988 5.3429493999999895","19.807808999999995 2.2956351999999676 21.331377199999988 5.3429493999999895","18.284596399999995 0.772066999999975 19.807808999999995 2.2956351999999676","15.237282200000013 -0.7518568000000094 18.284596399999995 0.772066999999975","6.095161799999992 -3.799171000000033 15.237282200000013 -0.7518568000000094","3.047136399999986 -5.322917000000018 6.095161799999992 -3.799171000000033","0 -8.370053400000003 3.047136399999986 -5.322917000000018","0 -8.370053400000003 0 -11.41772320000002","0 -11.41772320000002 3.047136399999986 -14.464859600000006","3.047136399999986 -14.464859600000006 7.6180188000000015 -15.988783400000033","7.6180188000000015 -15.988783400000033 13.713001559534877 -15.988783400000033","13.713001559534884 -15.988783400000033 18.28388520000001 -14.465037400000002","18.28388520000001 -14.465037400000002 21.331199399999996 -11.41772320000002","21.331199399999996 -9.89397720000003 21.331199399999996 -11.41772320000002","19.807808999999995 -8.370586799999991 21.331199399999996 -9.89397720000003","18.284240800000003 -9.894155000000026 19.807808999999995 -8.370586799999991","18.284240800000003 -9.894155000000026 19.807808999999995 -11.41772320000002"]},"%":{path:["18.2844186 6.8656126000000395 21.327998999999988 5.34275560000003","16.76031699999998 9.913993600000037 18.2844186 6.8656126000000395","16.76031699999998 9.913993600000037 16.76031699999998 9.913993600000037","16.76031699999998 12.959174200000028 16.76031699999998 9.913993600000037","16.76031699999998 12.959174200000028 19.80976479999995 16.008622","19.80976479999995 16.008622 22.854767599999988 16.008622","22.854767599999988 16.008622 25.902970800000027 14.484520400000061","25.902970800000027 14.484520400000061 27.42618340000003 11.437028400000003","27.42618340000003 11.437028400000003 27.42618340000003 8.390069800000052","24.378869200000008 5.34275560000003 27.42618340000003 8.390069800000052","21.327998999999988 5.34275560000003 24.378869200000008 5.34275560000003","7.618552200000029 -15.988621599999997 10.665688600000015 -12.94148519999993","10.665688600000015 -9.893104199999938 10.665688600000015 -12.94148519999993","9.142298199999978 -6.8466789999999325 10.665688600000015 -9.893104199999938","6.094450600000008 -5.322755199999948 9.142298199999978 -6.8466789999999325","0 -8.370069399999972 3.0476698000000138 -5.322755199999948","3.0476698000000138 -5.322755199999948 6.094450600000008 -5.322755199999948","6.094450600000008 -5.322755199999948 6.094450600000008 -5.322755199999948","0 -8.370069399999972 0 -11.414534477606418","0 -11.414534477606418 1.5226791999999736 -14.464519999999977","1.5226791999999736 -14.464519999999977 4.571415799999962 -15.988621599999997","0.0012446000000109962 16.006666200000005 27.42618340000003 -15.988443799999962","24.379046999999964 -14.465053400000004 27.426183400000024 -15.988443799999962","19.8076312 -12.94148519999993 24.379046999999964 -14.465053400000004","15.236215399999958 -12.94148519999993 19.8076312 -12.94148519999993","10.665333000000023 -14.46523119999996 15.236215399999958 -12.94148519999993","7.618552200000029 -15.988621599999997 10.665333000000023 -14.46523119999996","4.571415799999962 -15.988621599999997 7.618552200000029 -15.988621599999997"]},"&":{path:["21.331732800000022 14.484875999999971 25.90243740000001 16.008622000000006","18.2844186 11.437917400000021 21.331732800000022 14.484875999999971","7.618196600000037 -3.799720399999986 18.2844186 11.437917400000021","6.094628400000045 -8.370247199999993 7.618196600000037 -3.799720399999986","28.950640600000042 14.48452039999998 28.950640600000042 12.960596599999995","27.426539000000023 16.008622 28.950640600000042 14.48452039999998","25.9024374 16.008622 27.426539000000023 16.008622","22.85334520000002 14.48327579999997 25.9024374 16.008622","19.811365000000034 11.442540199999993 22.85334520000002 14.48327579999997","7.618552200000029 -5.323110800000022 19.811365000000034 11.442540199999993","6.094628400000045 -8.370247200000007 7.618552200000029 -5.323110800000022","6.094628400000045 -8.370247200000007 6.094628400000045 -11.417917000000019","6.094628400000045 -11.417917000000019 7.617485399999973 -14.464697800000012","7.617485399999973 -14.464697800000012 10.665688600000015 -15.988799400000035","3.0473142000000224 14.484698200000016 6.0948062 16.00826640000001","1.5237460000000291 11.437739599999984 3.0473142000000224 14.484698200000016","1.5237460000000291 11.437739599999984 1.5237460000000291 6.866145999999986","1.5237460000000291 6.866145999999986 3.046069600000011 3.8204319999999665","3.046069600000011 3.8204319999999665 6.094095000000016 0.772406599999961","25.901370600000025 -2.275441000000008 27.425472200000048 -3.799542600000029","25.901370600000025 -2.275441000000008 27.42565 -0.7511616000000316","27.42565 -0.7511616000000316 28.949751600000024 -2.275263199999971","28.949751600000024 -2.275263199999971 28.949751600000024 -3.799364799999994","27.426005599999993 -5.323110800000022 28.949751600000024 -3.799364799999994","25.90368200000001 -5.323110800000022 27.426005599999993 -5.323110800000022","24.378158000000024 -3.797586800000035 25.90368200000001 -5.323110800000022","22.85156719999998 -0.7410269999999883 24.378158000000024 -3.797586800000035","19.807453400000046 6.866323800000022 22.85156719999998 -0.7410269999999883","16.760494800000014 11.437206200000038 19.807453400000046 6.866323800000022","13.713358400000029 14.48452039999998 16.760494800000014 11.437206200000038","10.665510799999979 16.00826640000001 13.713358400000029 14.48452039999998","6.0948062 16.00826640000001 10.665510799999979 16.00826640000001","1.523568199999993 14.484164799999988 6.0948062 16.00826640000001","0 11.437383999999994 1.523568199999993 14.484164799999988","0 11.437383999999994 0 6.866323800000022","0 6.866323800000022 1.5257018000000233 3.817587200000034","1.5257018000000233 3.817587200000034 6.094094999997853 0.7724066000014034","6.094095000000016 0.772406599999961 10.668533400000028 -2.278463599999977","10.668533400000028 -2.278463599999977 13.713002800000037 -5.32275520000003","13.713002800000037 -5.32275520000003 15.236748799999985 -8.370247200000007","15.236748799999985 -8.370247200000007 15.236748799999985 -11.417383599999992","13.713180599999992 -14.464875599999969 15.236748799999985 -11.417383599999992","10.665688600000015 -15.988799400000035 13.713180599999992 -14.464875599999969"]},"'":{path:["0 -5.351378 1.5237459999999483 -16.01688879999998","0 -5.351378 3.0473141999999416 -16.016711000000026"]},"`":{path:["0 -8.380124000000029 1.5233904000000376 -9.903514400000066","0 -8.380124000000029 1.5237460000000291 -6.856377999999999","0.00017780000003622264 -15.998142800000032 1.523568199999993 -14.474752399999993","1.523568199999993 -14.474752399999993 3.0469586000000306 -11.427793800000043","1.5237460000000291 -6.856377999999999 3.0469586000000306 -8.3795906","3.0469586000000306 -8.3795906 3.0469586000000306 -11.427793800000043"]},"(":{path:["4.570704599999979 -12.95075140000002 7.618196599999997 -19.046091000000008","3.047136399999986 -8.379691200000007 4.570704599999979 -12.95075140000002","1.5237459999999887 -0.7625613999999867 3.047136399999986 -8.379691200000007","1.5237459999999887 5.332600400000002 1.5237459999999887 -0.7625613999999867","1.5237459999999887 5.332600400000002 3.047136399999986 12.949907999999981","3.047136399999986 12.949907999999981 4.571237999999966 17.52185720000001","4.571237999999966 17.52185720000001 7.618196599999997 23.616129999999984","7.618196599999997 23.616129999999984 10.665688599999974 26.663622","4.570882399999975 19.04524760000001 7.618196599999996 23.616129999999984","1.5237459999999887 12.951508199999983 4.570882399999975 19.04524760000001","0 5.3320670000000145 1.5237459999999887 12.951508199999983","0 5.3320670000000145 0 -0.7614946000000113","0 -0.7614946000000113 1.523568199999993 -8.380580199999986","1.523568199999993 -8.380580199999986 4.571237999999966 -14.475386399999987","4.571237999999966 -14.475386399999987 7.618196599999999 -19.046091000000008","7.618196600000005 -19.046091000000022 10.665688599999974 -22.093760800000023"]},")":{path:["3.0480254000000055 -19.04591320000001 6.0948062 -12.951284800000007","6.0948062 -12.951284800000007 7.618907800000021 -8.377735400000017","7.618907800000021 -8.377735400000017 9.141942600000027 -0.7623835999999908","9.141942600000027 5.332778199999998 9.141942600000027 -0.7623835999999908","7.617841000000006 12.952397200000002 9.141942600000027 5.332778199999998","6.094628400000004 17.522035000000006 7.617841000000006 12.952397200000002","3.0471364207661926 23.61666333772206 6.094628400000004 17.522035000000006","0.0001777999999957956 26.663622 3.0474919792399064 23.616130010386698","3.047491979239907 23.616130010386698 6.0948062 19.04524760000001","6.0948062 19.04524760000001 9.142120400000023 12.950263599999973","9.142120400000023 12.950263599999973 10.665688600000015 5.332422600000006","10.665688600000015 5.332422600000006 10.665688600000015 -0.7623835999999908","9.141942600000027 -8.380935800000021 10.665688600000015 -0.7623835999999908","6.094984000000036 -14.474675200000004 9.141942600000027 -8.380935800000021","3.0480254000000055 -19.04591320000001 6.094984000000036 -14.474675200000004","0 -22.093760800000023 3.0480254000000055 -19.04591320000001"]},"*":{path:["0 11.422739599999984 15.237282200000013 2.280441399999927","0.0005334000000278139 2.280796999999999 15.237282200000013 11.422739599999984","7.618729999999984 15.993622 7.618729999999984 -2.2902632000000525"]},"+":{path:["0 2.2954414000000067 27.425116600000056 2.2954414000000067","13.711758200000027 16.008622 13.711758200000027 -11.418628200000002"]},",":{path:["0 22.088622 1.5241016000000207 20.564520399999978","0.0000889000000181067 14.470336499999945 1.5237460000000291 12.946679400000015","0.00008890000001811618 14.470336499999945 1.5239237999999846 15.994171399999992","1.5237460000000291 12.946679400000015 3.0473142000000224 14.470247600000008","1.5241016000000207 20.564520399999978 3.0473142000000224 17.517917400000023","3.0473142000000224 17.517917400000023 3.0473142000000224 14.470247600000008"]},"-":{path:["0 2.284622 27.439162800000005 2.284622"]},".":{path:["0 14.479698199999977 1.523923800000025 12.955952199999988","0 14.479698199999977 1.523923800000025 16.003622","1.523923800000025 16.003622 3.0478476000000096 14.479698199999977","1.523923800000025 12.955952199999988 3.0478476000000096 14.479698199999977"]},"/":{path:["0 16.018622 31.9972436 -15.978621599999997","0 16.018622 3.0473142000000224 16.018622","3.0473142000000224 16.018622 35.04455780000002 -15.978621599999997","31.9972436 -15.978621599999997 35.04455780000002 -15.978621599999997"]},":":{path:["0 14.479698199999977 1.523923800000025 12.956129999999984","0 14.479698199999977 1.523923800000025 16.003622","1.523923800000025 16.003622 3.0476698000000138 14.479875999999972","1.523923800000025 12.956129999999984 3.0476698000000138 14.479875999999972","0.0001777999999957956 -3.804186999999997 1.523923800000025 -5.327933000000025","0.0001777999999957956 -3.804186999999997 1.523923800000025 -2.280441000000007","1.523923800000025 -2.280441000000007 3.0476698000000138 -3.804186999999997","1.523923800000025 -5.327933000000025 3.0476698000000138 -3.804186999999997"]},";":{path:["0 22.088622 1.5241016000000207 20.564520399999978","0.0000889000000181161 14.470336499999945 1.5237460000000291 12.946679400000015","0.00008890000001812551 14.470336499999945 1.5239237999999846 15.994171399999992","0.0008890000000194051 -3.8134598000000075 1.5239237999999846 -5.337561400000027","0.0008890000000194051 -3.8134598000000075 1.5241016000000207 -2.2902472000000067","1.5237460000000291 12.946679400000015 3.0473142000000224 14.470247600000008","1.5239237999999846 -5.337561400000027 3.0476698000000124 -3.8138153999999993","1.5241016000000207 20.564520399999978 3.0473142000000224 17.517917400000023","1.5241016000000207 -2.2902472000000067 3.047669800000011 -3.8138153999999993","3.0473142000000224 17.517917400000023 3.0473142000000224 14.470247600000008"]},"<":{path:["0 2.2906192000000036 24.379047000000003 16.003622","0 2.2906192000000036 24.378869200000008 -11.422383599999991"]},"=":{path:["0 6.858622 27.426716799999976 6.858622","0.0005334000000278139 -2.2831427999999505 27.42689460000001 -2.2831427999999505"]},">":{path:["0 16.003622 24.378513600000016 2.2907969999999995","0 -11.422028 24.378513600000016 2.2907969999999995"]},"?":{path:["0 -8.385069400000054 1.5237460000000291 -6.861323400000022","0 -8.385069400000054 0 -9.908637600000047","0 -9.908637600000047 1.5233903999999567 -12.955596199999993","1.5233903999999567 -12.955596199999993 3.0473142000000224 -14.47952000000006","1.5237460000000291 -9.9088154 3.0474919999999774 -8.385069400000054","1.5237460000000291 -6.861323400000022 3.0474919999999774 -8.385069400000054","3.0473142000000224 -14.47952000000006 6.094633862840461 -16.003621599999995","6.094633862840461 -16.003621599999995 10.666221999999962 -16.003621599999995","7.618374399999992 14.46987599999997 9.142120400000023 15.993622","7.618374399999992 14.46987599999997 9.141942599999986 12.946129999999942","9.141942599999986 12.946129999999942 10.66586639999997 14.46987599999997","9.142120400000023 0.756784646861166 15.23657100000003 -2.2902632000000525","9.142120400000023 5.327755599999949 9.142120400000023 0.756784646861166","9.142120400000023 15.993622 10.66586639999997 14.46987599999997","10.666221999999937 -16.003621600000006 15.237459999999968 -14.479697800000013","10.666221999999951 -16.003621600000002 13.712113800000019 -14.480408999999996","12.18925662217202 -0.7666947402491352 15.23709971109142 -3.8148888216356456","13.712113800000019 -14.480408999999996 15.236037600000003 -12.956485200000012","15.236037600000003 -12.956485200000012 16.760494800000014 -9.908459800000008","15.23657100000003 -2.2902632000000525 16.760139200000022 -3.813831400000045","15.237099711091417 -3.8148888216356385 16.760494800000014 -6.861856800000052","15.237459999999968 -14.479697800000013 16.760139200000022 -12.957018600000042","16.760139200000022 -12.957018600000042 18.284063000000007 -9.90934880000003","16.760139200000022 -3.813831400000045 18.284063000000007 -6.861679000000014","16.760494800000014 -6.861856800000052 16.760494800000014 -9.908459800000008","18.284063000000007 -6.861679000000014 18.284063000000007 -9.90934880000003"]},"@":{path:["25.902259599999965 12.951307799999979 27.426005599999993 11.427739599999985","22.854234199999958 14.475231599999963 25.902259599999965 12.951307799999979","18.284596399999955 15.998622000000001 22.854234199999958 14.475231599999963","13.713002799999957 15.998622000000001 18.284596399999955 15.998622000000001","9.142120399999941 14.474698200000017 13.713002799999957 15.998622000000001","6.0948062 12.951485600000014 9.142120399999941 14.474698200000017","3.0476698000000138 9.904171399999992 6.0948062 12.951485600000014","1.5239237999999846 6.857035000000006 3.0476698000000138 9.904171399999992","0 2.285619199999962 1.5239237999999846 6.857035000000006","0 2.285619199999962 0 -2.284729800000024","0 -2.284729800000024 1.5233903999999567 -6.856145599999987","1.5233903999999567 -6.856145599999987 3.0476698000000138 -9.904170999999991","3.0476698000000138 -9.904170999999991 6.0948062 -12.951307400000058","6.0948062 -12.951307400000058 9.143009399999961 -14.475053400000004","9.143009399999961 -14.475053400000004 13.713180599999992 -15.998443800000043","9.142120399999941 6.856501599999978 12.189434599999966 8.380425399999964","7.618552199999948 3.8090095999999996 9.142120399999941 6.856501599999978","7.618552199999948 3.8090095999999996 7.618552199999948 -0.7624062000000418","7.618552199999948 -0.7624062000000418 9.142298199999978 -5.33275520000003","9.142298199999978 -5.33275520000003 10.666221999999962 -6.856679000000014","10.666221999999962 -6.856679000000014 13.713358399999947 -8.380069400000053","21.331554999999984 -6.856501200000061 22.855301000000015 -3.80865360000001","18.284063000000007 -8.380069400000053 21.331554999999984 -6.856501200000061","13.713358399999947 -8.380069400000053 18.284063000000007 -8.380069400000053","10.665688599999934 -5.33275520000003 13.713358399999947 -8.380069400000053","9.142120399999941 -0.7611616000000314 10.665688599999934 -5.33275520000003","9.142120399999941 3.8086540000000095 9.142120399999941 -0.7611616000000314","9.142120399999941 3.8086540000000095 10.66586639999997 6.856857199999969","10.66586639999997 6.856857199999969 12.189434599999963 8.380425399999964","12.189434599999963 8.380425399999964 16.76031699999998 8.380425399999964","16.76031699999998 8.380425399999964 19.807453399999964 6.857390599999998","19.807453399999964 6.857390599999998 21.33137719999995 3.809542999999948","21.33137719999995 3.809542999999948 22.85494539999994 -8.379358199999988","21.33137719999995 6.856501599999978 21.33137719999995 3.809542999999948","21.33137719999995 6.856501599999978 24.378691399999973 8.380247600000008","22.85512319999998 3.809720799999983 24.378869200000008 -8.380780600000037","22.85512319999998 6.856679400000014 22.85512319999998 3.809720799999983","22.85512319999998 6.856679400000014 24.378691399999973 8.380247600000008","24.378691399999973 8.380247600000008 27.42618339999995 8.380247600000008","27.42618339999995 8.380247600000008 30.47278639999999 5.334177999999996","30.47278639999999 5.334177999999996 31.997065799999966 0.7624065999999612","31.997065799999966 0.7624065999999612 31.997065799999966 -2.2852632000000526","30.47385319999996 -6.856145599999987 31.997065799999966 -2.2852632000000526","28.949751599999942 -9.9038154 30.47385319999996 -6.856145599999987","25.902615199999957 -12.95112960000002 28.949751599999942 -9.9038154","22.853522999999974 -14.475231200000042 25.902615199999957 -12.95112960000002","18.284596399999955 -15.998443800000043 22.853522999999974 -14.475231200000042","13.713180599999992 -15.998443800000043 18.284596399999955 -15.998443800000043"]},A:{path:["18.306821400000036 15.992043199999944 27.426005599999993 15.992754400000006","13.712647200000045 -11.427383800000003 22.855182140789015 15.992397924072641","6.094696129663703 6.850278399999994 19.806939524461992 6.850278399999994","0 15.992754400000006 9.141764800000031 15.992754400000006","3.047254931357366 15.992754400000006 13.712825 -16.00448919999999","13.712825 -16.00448919999999 24.378612177625072 15.992516735516578"]},B:{path:["18.270584389385025 16.00376340194918 21.331554999999906 14.472742400000023","0.0016002000000025875 15.99737739999999 18.290289015363342 15.997199535991482","18.290289015363346 15.997199535991482 22.8576124 14.47576499999999","22.8576124 14.47576499999999 24.381002800000037 12.949885400000012","24.381002800000037 12.949885400000012 25.901726200000017 9.908083539668437","25.901726200000017 9.908083539668437 25.901726200000017 5.3315110000000185","24.378157999999942 2.2840190000000415 25.901726200000017 5.3315110000000185","22.853878600000048 0.7604508000000472 24.378157999999942 2.2840190000000415","18.28370739999991 -0.7634729999999497 22.853878600000048 0.7604508000000472","18.28370739999994 -0.7634729999999337 22.85458980000003 -2.2872189999999666","22.85458980000003 -2.2872189999999666 24.37833579999998 -3.811142799999949","24.37833579999998 -3.811142799999949 25.902081799999927 -6.86023500000001","25.901904000000055 -9.905593399999958 25.902081799999927 -6.86023500000001","24.378869199999926 -12.95201859999996 25.901904000000055 -9.905593399999958","22.854234199999958 -14.476653600000006 24.378869199999926 -12.95201859999996","18.28352959999998 -16.000043999999964 22.854234199999958 -14.476653600000006","0 -16.000043999999964 18.28352959999998 -16.000043999999964","4.5703490029639955 -16.000043999999964 4.570882414079176 15.997332962104048","6.09391719999998 15.997318150048631 6.09391719999998 -16.00004399999996","6.09391719999998 -0.7634729999999372 18.283707399999937 -0.7634729999999372","18.28352959999998 -16.000043999999964 21.331021599999957 -14.476297999999936","21.33102159999996 -14.476297999999936 22.854767599999906 -12.952374199999952","22.854767599999906 -12.952374199999952 24.37833579999998 -9.90417062638345","24.37833579999998 -6.858101399999981 24.37833579999998 -9.90417062638345","22.854767599999906 -3.811142799999949 24.37833579999998 -6.858101399999981","21.330843799999922 -2.2872189999999666 22.854767599999906 -3.811142799999949","18.283707399999937 -0.7634729999999372 21.330843799999922 -2.2872189999999666","18.283707399999937 -0.7634729999999372 21.331199399999996 0.760628600000004","21.331199399999996 0.760628600000004 22.854767599999906 2.2843746000000333","22.854767599999906 2.2843746000000333 24.378157999999942 5.332222200000002","24.37708978640151 9.907024971344184 24.378157999999942 5.332222200000002","22.857434599999966 12.950241000000004 24.37708978640151 9.907024971344185","20.562196263333856 15.240397825550149 22.857434599999966 12.950241000000004"]},C:{path:["7.618729999999903 14.475053800000008 10.665688600000006 15.998622","4.571415800000043 11.425250399999964 7.618729999999903 14.475053800000008","3.055315200000035 8.397849799999955 4.571415800000043 11.425250399999964","1.5244571999999315 3.8145213999999914 3.055315200000035 8.397849799999955","1.5235681999999122 -3.80260839999999 1.5244571999999315 3.8145213999999914","1.5235681999999122 -3.80260839999999 3.047136399999986 -8.379891600000015","3.047136399999986 -8.379891600000015 4.575149599999995 -11.428094800000054","4.575149599999995 -11.428094800000054 7.619085599999976 -14.47487560000005","7.619085599999976 -14.47487560000005 10.664977400000003 -15.998443800000043","21.336177800000037 11.422583399999986 22.85458980000003 8.380780999999955","18.28495200000003 14.47452039999998 21.336177800000037 11.422583399999986","13.71887019999994 15.996843999999962 18.28495200000003 14.47452039999998","10.665688600000012 15.998622000000001 13.71887019999994 15.996843999999962","6.098006599999924 14.466874999999959 10.665688600000012 15.998622000000001","3.0466030000000393 11.42116099999994 6.098006599999924 14.466874999999959","1.51858980000003 8.380780999999955 3.0466030000000393 11.42116099999994","0 3.812032199999969 1.51858980000003 8.380780999999955","0 3.812032199999969 0.005333999999954722 -3.8369238000000294","0.005333999999954722 -3.8369238000000294 1.5235681999999122 -8.381491800000017","1.5235681999999122 -8.381491800000017 3.04571400000002 -11.426316800000016","3.04571400000002 -11.426316800000016 6.094806199999919 -14.47487560000005","6.094806199999919 -14.47487560000005 10.664977400000073 -15.998443800000043","10.664977400000073 -15.998443800000043 13.713536199999984 -15.998443800000043","13.713536199999984 -15.998443800000043 18.283885199999972 -14.475231200000042","18.283885199999972 -14.475231200000042 21.331554999999906 -11.428094800000054","21.331554999999906 -11.428094800000054 22.85512319999998 -15.998088200000051","21.331554999999906 -11.428094800000054 22.85547880000005 -6.857034600000006","22.85512319999998 -15.998088200000051 22.85547880000005 -6.857034600000006"]},D:{path:["0 -15.992553199999923 15.236571000000003 -15.992553199999923","0.0003555999999915912 16.00451260000004 15.236748799999985 16.00451260000004","4.5710601999999705 16.00451260000004 4.5710601999999705 -15.992553199999923","6.094450600000008 16.00451260000004 6.094450600000008 -15.992553199999927","15.236571000000005 -15.992553199999923 19.807275600000008 -14.468984999999927","15.236571000000025 -15.992553199999923 18.28352959999998 -14.469162799999966","15.236748799999983 16.004512600000044 18.28477419999999 14.480588800000056","15.236748799999988 16.00451260000004 19.807809000000038 14.48041100000002","18.28352959999998 -14.469162799999966 21.33137720000003 -11.42149299999995","18.28477419999999 14.480588800000056 21.33102160000004 11.434341400000008","19.807275600000008 -14.468984999999927 22.85458980000003 -11.421670799999989","19.807809000000038 14.48041100000002 22.855301000000015 11.432919000000043","21.33102160000004 11.434341400000008 22.855301000000015 8.385427000000066","21.33137720000003 -11.42149299999995 22.854767599999988 -8.374356599999969","22.85458980000003 -11.421670799999989 24.379935999999983 -8.372400799999975","22.854767599999988 -8.374356599999969 24.378513600000016 -3.802407399999977","22.855301000000015 8.385427000000066 24.378513600000016 3.8159670000000148","22.855301000000015 11.432919000000043 24.378691399999973 8.386316000000003","24.378513600000016 3.8159670000000148 24.378513600000016 -3.802407399999977","24.378691399999973 8.386316000000003 25.9024374 3.8147224000000044","24.379935999999983 -8.372400799999975 25.9024374 -3.8033038401951966","25.9024374 3.8147224000000044 25.9024374 -3.8033038401951966"]},E:{path:["6.098185581001718 15.989376399999976 6.1022728176978545 -16.00800034100042","4.577817118643815 15.989376399999976 4.5840395675023045 -16.008055688353792","15.243683000000024 5.3245767999999805 15.243683000000024 -6.86450219999999","6.1003264417921 -0.7705850000000112 15.243683000000024 -0.7705850000000112","22.862086964209652 15.989376399999976 24.382958600000034 6.8428110000000215","24.382958600000034 15.989376399999976 24.382958600000034 6.8428110000000215","0.011734800000045925 15.989376399999976 24.382958600000034 15.989376399999976","22.861725978033487 -16.0073893733667 24.3859812 -6.8661023999999955","24.3859812 -6.8661023999999955 24.38615900000004 -16.007333799999994","0 -16.008222800000013 24.386159000000042 -16.007333799999994"]},F:{path:["15.236393199999995 5.331130399999945 15.236393199999995 -6.857415199999998","6.094628400000045 -0.7617200000000608 15.236393199999995 -0.7617200000000608","0 15.997530199999945 10.6731562 15.997530199999945","6.094628400000045 15.997530199999945 6.094628400000045 -15.999357800000062","4.566970800000027 15.997530199999945 4.566970800000027 -15.999357800000066","22.854379561370333 -15.999357800000062 24.37869140000005 -6.852792400000027","24.37869140000005 -6.852792400000027 24.37869140000005 -15.999357800000062","0.00017780000003622264 -15.999357800000062 24.37869140000005 -15.999357800000062"]},G:{path:["7.620508000000023 14.477009600000002 10.66551080000006 15.998088599999972","4.571238000000007 11.42756179999995 7.620508000000023 14.477009600000002","3.0499811999999995 8.391982399999973 4.571238000000007 11.42756179999995","1.5232126000000015 3.808298399999936 3.0499811999999995 8.391982399999973","1.5232126000000015 3.808298399999936 1.523568199999993 -3.8098982000000206","1.523568199999993 -3.8098982000000206 3.044113800000017 -8.374202000000071","3.044113800000017 -8.374202000000071 4.569104400000057 -11.426494600000051","4.569104400000057 -11.426494600000051 7.618196600000037 -14.475231200000042","7.618196600000037 -14.475231200000042 10.664799599999988 -15.998977200000066","22.855123200000058 15.998622000000001 22.855123200000058 3.808653999999928","21.331910600000057 15.997555199999946 21.331910600000057 3.808653999999928","16.76102820000004 3.808653999999928 27.426361199999985 3.808653999999928","18.284240800000045 14.474342599999943 21.331910600000057 11.427206168883401","13.713180599999992 15.998088599999972 18.284240800000045 14.474342599999943","10.66551080000006 15.998088599999972 13.713180599999992 15.998088599999972","6.0948062 14.47452039999998 10.66551080000006 15.998088599999972","3.0480254000000055 11.428272999999933 6.0948062 14.47452039999998","22.855123200000058 -6.857034600000006 22.855123200000058 -15.998266000000008","21.331554999999984 -11.427561400000027 22.855123200000058 -6.857034600000006","21.331554999999984 -11.427561400000027 22.855123200000058 -15.998266000000008","18.2844186 -14.475409000000077 21.331554999999984 -11.427561400000027","13.713358400000029 -15.99897720000007 18.2844186 -14.475409000000077","10.664799599999995 -15.99897720000007 13.713358400000029 -15.99897720000007","6.0948062 -14.475409000000077 10.664799600000004 -15.99897720000007","3.0466030000000393 -11.427561400000027 6.0948062 -14.475409000000077","1.5244572000000125 -8.38273640000003 3.0466030000000393 -11.427561400000027","0 -3.8098982000000206 1.5244572000000125 -8.38273640000003","0 3.8093652414837305 0 -3.8098982000000206","0 3.8093652414837305 1.524279400000057 8.38184779999993","1.524279400000057 8.38184779999993 3.0480254000000055 11.428272999999933"]},H:{path:["25.902259600000047 15.977684800000004 25.902259600000047 -16.020981200000044","0.00017780000003622264 -16.020981200000044 10.663554999999985 -16.020981200000044","4.570704599999979 15.976084600000002 4.570704599999979 -16.020981200000044","0 15.976084600000002 10.673867399999983 15.976084600000002","6.094450600000008 15.976084600000002 6.094450600000008 -16.020981200000044","6.094450600000008 -0.7845880000000491 24.378513600000016 -0.7845880000000491","19.80816460000003 -16.020981200000044 30.474386599999992 -16.020981200000044","24.378513600000016 15.977684800000004 24.378513600000016 -16.020981200000044","19.784339400000025 15.977684800000004 30.468163600000018 15.977684800000004"]},I:{path:["6.094628400000045 16.003821399999993 6.094628400000045 -15.9934222","0.003911599999988358 16.003821399999993 10.66462180000004 16.003821399999993","4.5708824000000154 16.003821399999993 4.5708824000000154 -15.993422200000007","0 -15.993422200000007 10.651642400000064 -15.993422200000007"]},J:{path:["7.618730000000065 16.008622 10.665688600000015 14.485231600000043","10.665688600000015 14.485231600000043 12.189434599999963 9.914349200000029","12.189434599999963 9.914349200000029 12.189434599999963 -15.988266000000008","1.5239237999999846 9.913993600000037 3.0474920000000583 8.3906032","1.522323599999982 6.867924000000025 3.0474920000000583 8.3906032","0 8.390247600000007 1.522323599999982 6.867924000000025","0 11.437739599999984 0 8.390247600000007","0 11.437739599999984 1.5233904000000376 14.485053800000008","1.5233904000000376 14.485053800000008 4.570348999999988 16.008622","4.570348999999988 16.008622 7.618730000000065 16.008622","7.618730000000065 16.008622 9.143720599999943 14.476341600000012","9.143720599999943 14.476341600000012 10.665688600000015 9.922883599999988","10.665688600000015 9.922883599999988 10.665688600000015 -15.988266000000008","6.095161799999992 -15.988266000000008 16.760139200000022 -15.988266000000008"]},K:{path:["13.713002800000037 -2.2864645999999897 25.90190406223669 15.99795400000001","19.806208799999954 15.99795400000001 28.945840000000036 15.99795400000001","12.189057106551541 -2.2863196346695 24.37869133087971 15.997954000000012","6.094272799999972 3.808519372872059 25.901726200000017 -15.999111799999953","19.812965200000036 -15.999111799999953 28.949751600000024 -15.999111799999953","6.094272799999972 15.99795400000001 6.094272799999972 -15.999467399999945","0.0008890000000194051 15.99795400000001 10.665155200000068 15.99795400000001","4.5707046000000595 15.99795400000001 4.5707046000000595 -15.999467399999938","0 -15.999467399999945 10.664977400000032 -15.999467399999945"]},L:{path:["21.33096215369546 15.999376399999976 22.854411999999996 6.857611599999945","22.854411999999996 15.999376399999976 22.854411999999996 6.857611599999945","0.00231139999998577 15.999376399999976 22.854411999999996 15.999376399999976","6.093917200000061 15.999376399999976 6.093917200000061 -15.997867200000021","4.570348999999988 15.999376399999976 4.570348999999988 -15.997867200000021","0 -15.997867200000021 10.664977400000032 -15.997867200000021"]},M:{path:["0.007823199999976715 15.988175000000039 9.141942599999904 15.988175000000039","4.570526799999862 15.988175000000039 4.570526799999862 -16.00800179999998","27.424938799999858 15.988886200000023 27.424938799999858 -16.008535200000004","21.33173279999994 15.988886200000023 31.997421399999954 15.988886200000023","25.902259599999965 15.988886200000023 25.902259599999965 -16.00853520000002","25.902259599999965 -16.00853520000001 31.9963545999999 -16.00853520000001","15.236393199999913 15.989063999999978 25.902259599999965 -16.00853520000001","4.57076386534923 -16.00800179999998 15.236393199999913 15.989063999999978","6.094450600000008 -16.00800179999998 15.236393199999913 11.418181600000043","0 -16.00800179999998 6.094450600000008 -16.00800179999998"]},N:{path:["4.570882399999935 16.00613280000006 4.570882399999935 -15.991110799999936","0.00017779999987451448 16.00613280000006 9.141586999999994 16.00613280000006","19.808342399999905 -15.990932999999982 28.94975159999986 -15.990932999999982","24.37833579999998 16.00702180000008 24.37833579999998 -15.990932999999982","6.094450599999846 -12.943974399999954 24.37833579999998 16.00702180000008","6.094806199999919 -15.99111079999994 24.37833579999998 12.95528226121576","0 -15.99111079999994 6.094806199999919 -15.99111079999994"]},O:{path:["13.713002800000037 16.008622 16.76067259999997 14.484698200000016","16.76067259999997 14.484698200000016 19.80816460000003 11.436850600000046","19.80816460000003 11.436850600000046 21.331199399999996 8.39149220000002","21.331199399999996 8.39149220000002 22.855301000000015 2.2956192000000435","22.85512319999998 -2.275085399999936 22.855301000000015 2.2956192000000435","21.33137720000003 -8.370247200000007 22.85512319999998 -2.275085399999936","19.807808999999956 -11.417561399999945 21.33137720000003 -8.370247200000007","16.760850400000006 -14.464519999999977 19.807808999999956 -11.417561399999945","13.714069600000093 -15.988621599999997 16.760850400000006 -14.464519999999977","10.665688600000015 -15.988621599999997 13.714069600000093 -15.988621599999997","13.714069600000093 -15.988621599999997 18.284063000000007 -14.464875599999969","18.284063000000007 -14.464875599999969 21.331555000000066 -11.417383599999992","21.331555000000066 -11.417383599999992 22.855301000000015 -8.36971379999998","22.855301000000015 -8.36971379999998 24.37886920000009 -2.275263199999971","24.37886920000009 2.296508200000062 24.37886920000009 -2.275263199999971","22.85494539999994 8.39149220000002 24.37886920000009 2.296508200000062","21.33173279999994 11.437206200000038 22.85494539999994 8.39149220000002","18.28441860000008 14.484698200000016 21.33173279999994 11.437206200000038","13.713002800000037 16.008622 18.28441860000008 14.484698200000016","10.665866400000052 16.008622 13.713002800000037 16.008622","6.094983999999955 14.485053800000008 10.665866400000057 16.008622000000003","3.0482032000000414 11.438095200000058 6.094983999999955 14.485053800000008","1.5233904000000376 8.38971420000006 3.0482032000000414 11.438095200000058","0 2.2954414000000067 1.5233904000000376 8.38971420000006","0 2.2954414000000067 0.0005333999999469598 -2.2882425999999487","0.0005333999999469598 -2.2882425999999487 1.5237459999999483 -8.370247200000007","1.5237459999999483 -8.370247200000007 3.0476698000000946 -11.417916999999937","3.0476698000000946 -11.417916999999937 6.094628400000045 -14.464697799999934","6.094628400000045 -14.464697799999934 10.665688600000017 -15.988621599999997","7.618196599999957 -14.464875599999969 10.665688600000012 -15.988621599999997","4.571238000000007 -11.417916999999937 7.618196599999957 -14.464875599999969","3.04695859999995 -8.369358199999988 4.571238000000007 -11.417916999999937","1.5232126000000015 -2.2738408000000057 3.04695859999995 -8.369358199999988","1.5232126000000015 -2.2738408000000057 1.5239237999999846 2.2940190000000413","1.5239237999999846 2.2940190000000413 3.047136399999986 8.389536400000026","3.047136399999986 8.389536400000026 4.572127000000026 11.439873200000015","4.572127000000026 11.439873200000015 7.618196599999957 14.484520400000061","7.618196599999957 14.484520400000061 10.66586640000006 16.008622000000006"]},P:{path:["18.284063000000007 0.7607000000000372 21.330843799999922 -0.7619792000000185","21.330843799999922 -0.7619792000000185 22.855656599999925 -2.2867919999999415","22.855656599999925 -2.2867919999999415 24.378869199999926 -5.334817399999947","24.378869199999926 -5.334817399999947 24.3792248 -9.9039218","22.85583439999996 -12.951591600000016 24.3792248 -9.9039218","21.332799599999998 -14.4755154 22.85583439999996 -12.951591600000016","18.28761899999997 -15.999616999999938 21.332799599999998 -14.4755154","0.0007111999999831824 15.997448800000022 10.66586639999989 15.997448800000022","4.5710601999999705 15.997448800000022 4.5710601999999705 -15.999616999999946","6.094806199999919 15.997448800000022 6.094806199999919 -15.999616999999946","6.094806199999919 0.7607000000000372 18.284063000000007 0.7607000000000372","18.284063000000007 0.7607000000000372 22.855656599999925 -0.7632237999999489","22.855656599999925 -0.7632237999999489 24.3792248 -2.2873253999999683","24.3792248 -2.2873253999999683 25.902259599999965 -5.33766219999996","25.902259599999965 -5.33766219999996 25.902259599999965 -9.905522000000003","24.378157999999942 -12.952836199999945 25.902259599999965 -9.905522000000003","22.854767599999906 -14.476048799999946 24.378157999999942 -12.952836199999945","18.28761899999993 -15.999616999999938 22.854767599999906 -14.476048799999946","0 -15.999616999999938 18.28761899999993 -15.999616999999938"]},Q:{path:["16.76120600000008 11.432565599999998 18.2853076000001 22.095764999999993","18.2853076000001 22.095764999999993 19.80816460000003 23.618622000000002","19.80816460000003 23.618622000000002 22.85512319999998 23.618622000000002","22.85512319999998 23.618622000000002 24.379046999999954 20.57112999999996","24.379046999999964 20.57112999999995 24.379046999999964 19.04756179999995","22.856190000000034 22.095587199999954 24.379046999999964 20.57112999999995","21.331555000000066 22.095587199999954 22.856190000000034 22.095587199999954","19.807453400000046 20.571485599999935 21.331555000000066 22.095587199999954","18.284596400000115 17.525060399999933 19.807453400000046 20.571485599999935","16.76120600000008 11.432565599999998 18.284596400000115 17.525060399999933","15.236571000000112 8.381517599999944 16.76120600000008 11.432565599999998","12.189790200000036 6.858304999999941 15.236571000000112 8.381517599999944","10.665510799999979 6.858304999999941 12.189790200000036 6.858304999999941","7.618907800000102 8.381339799999987 10.665510799999979 6.858304999999941","6.095517400000064 11.4290096 7.618907800000102 8.381339799999987","6.095517400000064 12.953377899999955 6.095517400000064 11.4290096","13.71673659999999 -15.997351600000066 16.76031700000006 -14.473250000000043","16.76031700000006 -14.473250000000043 19.80798679999999 -11.426113600000054","19.80798679999999 -11.426113600000054 21.331199399999996 -8.379155000000026","21.331199399999996 -8.379155000000026 22.85512319999998 -2.2939500000000415","22.85512319999998 2.2870669999999365 22.85512319999998 -2.2939500000000415","21.332088400000014 8.380628599999923 22.85512319999998 2.2870669999999365","19.80763120000008 11.4290096 21.332088400000014 8.380628599999923","16.76031700000006 14.47650159999998 19.80763120000008 11.4290096","13.712825000000024 16.00024759999992 16.76031700000006 14.47650159999998","7.619441200000049 14.476679399999934 10.665688600000015 16.000247599999927","4.571593600000079 11.430076399999976 7.619441200000049 14.476679399999934","3.0474920000000583 8.381873199999935 4.571593600000079 11.430076399999976","1.5239237999999846 2.2931121999999533 3.0474920000000583 8.381873199999935","1.5239237999999846 2.2931121999999533 1.526057400000096 -2.2866602000000142","1.526057400000096 -2.2866602000000142 3.0473142000000224 -8.378266000000007","3.0473142000000224 -8.378266000000007 4.570882400000096 -11.425935800000019","4.570882400000096 -11.425935800000019 7.618730000000065 -14.473427799999996","7.618730000000065 -14.473427799999996 10.666221999999928 -15.997351600000066","6.094628400000045 -14.472894400000051 10.666221999999967 -15.997351600000066","3.0473142000000224 -11.425758000000062 6.094628400000045 -14.472894400000051","1.5235682000000739 -8.378266000000007 3.0473142000000224 -11.425758000000062","0 -2.2841710000000717 1.5235682000000739 -8.378266000000007","0 -2.2841710000000717 0.0003556000000724453 2.2876003999999632","0.0003556000000724453 2.2876003999999632 1.5219680000000713 8.377250399999962","1.5219680000000713 8.377250399999962 3.0478475999999692 11.429720799999984","3.0478475999999692 11.429720799999984 6.094095000000097 14.476323799999943","6.094095000000097 14.476323799999943 10.665688600000015 16.000247599999927","10.665688600000015 16.000247599999927 13.712825 16.000247599999927","13.712825 16.000247599999927 18.284596400000115 14.47650159999998","18.284596400000115 14.47650159999998 21.331555000000066 11.4290096","21.331555000000066 11.4290096 22.854945400000105 8.382228799999925","22.854945400000105 8.382228799999925 24.37869140000005 2.286355799999953","24.37869140000005 2.286355799999953 24.37869140000005 -2.2839932000000367","22.85565660000009 -8.377554800000024 24.37869140000005 -2.2839932000000367","21.331199399999996 -11.42629140000001 22.85565660000009 -8.377554800000024","18.283885199999972 -14.473427799999996 21.331199399999996 -11.42629140000001","13.71673659999999 -15.997351600000066 18.283885199999972 -14.473427799999996","10.666221999999967 -15.997351600000066 13.71673659999999 -15.997351600000066"]},R:{path:["0 16.01625239999999 10.66337720000003 16.01625239999999","4.5710601999999705 16.01625239999999 4.5710601999999705 -15.980991200000009","6.094983999999955 16.01625239999999 6.094983999999955 -15.980991200000009","16.76209499999994 0.7811038000000057 18.283885199999972 2.302004999999939","18.283885199999972 2.302004999999939 22.854767599999906 12.968226999999983","22.854767599999906 12.968226999999983 24.379402600000034 14.492684199999996","24.379402600000034 14.492684199999996 25.9024374 14.492684199999996","25.9024374 14.492684199999996 27.426361199999995 12.96893819999995","27.426361199999985 12.968938199999966 27.426361199999985 11.444836599999945","25.903148599999984 16.016963599999972 27.426361199999985 12.968938199999965","22.855656599999925 16.016963599999972 25.903148599999984 16.016963599999972","21.33173279999994 14.492328600000004 22.855656599999925 16.016963599999972","18.2851297999999 3.828062399999954 21.33173279999994 14.492328600000004","16.76209499999994 0.7811038000000057 18.2851297999999 3.828062399999954","13.712647614742208 -0.7440645999999909 16.76209499999994 0.7811038000000057","18.284240800000045 -0.7440645999999909 21.332088400000014 -2.268166200000012","21.332088400000014 -2.268166200000012 22.855301000000015 -3.7913788000000146","22.855301000000015 -3.7913788000000146 24.378869199999926 -6.839582000000053","24.378869199999926 -6.839582000000053 24.378869199999926 -9.886185000000012","22.85583439999996 -12.93314360000004 24.378869199999926 -9.886185000000012","21.331554999999906 -14.457245200000063 22.85583439999996 -12.93314360000004","18.289752600000085 -15.980991200000009 21.331554999999906 -14.457245200000063","6.094983999999955 -0.7440645999999909 18.284240800000045 -0.7440645999999909","18.284240800000045 -0.7440645999999909 22.85583439999996 -2.268166200000012","22.85583439999996 -2.268166200000012 24.379402600000034 -3.7919122000000414","24.379402600000034 -3.7919122000000414 25.902615200000035 -6.839048600000027","25.9024374 -9.886718400000039 25.902615200000035 -6.839048600000027","24.378869199999926 -12.933676999999989 25.9024374 -9.886718400000039","22.855301000000015 -14.457245200000063 24.378869199999926 -12.933676999999989","18.289752600000064 -15.980991200000009 22.855301000000015 -14.457245200000063","0.005689600000027167 -15.980991200000009 18.289752600000067 -15.980991200000009"]},S:{path:["18.283529600000062 2.285085800000015 21.33262179999996 5.3334668000000125","15.238348999999989 0.7622288000000061 18.283529600000062 2.285085800000015","6.0953396000000275 -2.2854409999999277 15.238348999999989 0.7622288000000061","3.0478475999999692 -3.8091869999999552 6.0953396000000275 -2.2854409999999277","1.5232126000000015 -5.33435539999995 3.0478475999999692 -3.8091869999999552","0.0003556000000724453 -8.380247199999921 1.5232126000000015 -5.33435539999995","0 15.996132800000058 1.5239237999999846 11.427206200000038","0 15.996132800000058 0 6.85561260000004","0 6.85561260000004 1.5239237999999846 11.427206200000038","1.5239237999999846 11.427206200000038 4.570882400000096 14.474698200000017","4.570882400000096 14.474698200000017 9.142120399999941 15.998622000000001","9.142120399999941 15.998622000000001 13.713002800000037 15.998622000000001","13.713002800000037 15.998622000000001 18.285129800000064 14.4754094","18.285129800000064 14.4754094 21.33262179999996 11.427917400000021","21.33262179999996 11.427917400000021 21.33262179999996 5.3334668000000125","19.80816460000003 2.285441400000007 21.33262179999996 5.3334668000000125","18.283707400000097 0.7613398000000675 19.80816460000003 2.285441400000007","15.241371599999956 -0.7606282000000046 18.283707400000097 0.7613398000000675","6.095517400000064 -3.809009200000002 15.241371599999956 -0.7606282000000046","3.047136399999986 -5.333466399999931 6.095517400000064 -3.809009200000002","0.0003556000000724453 -8.380247199999928 3.047136399999986 -5.333466399999931","0.0003556000000724453 -8.380247199999928 0.0003556000000724453 -11.427561399999945","0.0003556000000724453 -11.427561399999945 3.0476698000000946 -14.475053399999926","3.0476698000000946 -14.475053399999926 7.6144628000000045 -15.998621599999996","7.6144628000000045 -15.998621599999996 12.189434599999963 -15.998621599999996","12.189434599999963 -15.998621599999996 16.76067259999997 -14.475408999999996","16.76067259999997 -14.475408999999996 19.80798679999999 -11.427739199999984","19.80798679999999 -11.427739199999984 21.33173279999994 -15.997732599999978","19.80798679999999 -11.427739199999984 21.33173279999994 -6.8563233999999404","21.33173279999994 -6.8563233999999404 21.33173279999994 -15.997732599999978"]},T:{path:["6.09391719999998 15.995066000000005 16.76031699999998 15.995066000000005","10.665688600000015 15.995066000000005 10.665688600000015 -16.001999800000043","12.189434600000045 15.995066000000005 12.189434600000045 -16.00199980000004","21.331407174250895 -16.00199980000004 22.855656600000007 -6.859346000000073","22.855656600000007 -6.859346000000073 22.855656600000007 -16.00199980000004","0 -16.00199980000004 22.855656600000007 -16.00199980000004","0 -6.859346000000073 1.5235090992012212 -16.00199980000004","0 -6.859346000000073 0 -16.00199980000004"]},U:{path:["0 -15.998621599999996 10.67226719999998 -15.998621599999996","21.32550980000005 -15.998621599999996 30.47278639999999 -15.998621599999996","4.570171200000032 6.856146000000067 4.570171200000032 -15.998621599999996","4.570171200000032 6.856146000000067 6.094272800000053 11.427917400000021","6.094272800000053 11.427917400000021 9.141053600000047 14.474698200000017","9.141053600000047 14.474698200000017 13.712825 15.998622000000001","13.712825 15.998622000000001 16.759250200000004 15.998622000000001","16.759250200000004 15.998622000000001 21.32888800000001 14.474698200000017","21.32888800000001 14.474698200000017 24.378513600000016 11.426672800000011","24.378513600000016 11.426672800000011 25.901370600000025 6.857035000000006","25.901370600000025 6.857035000000006 25.901370600000025 -15.998621599999996","6.09391719999998 6.857035000000006 6.09391719999998 -15.998621599999996","6.09391719999998 6.857035000000006 7.616952000000026 11.42631720000002","7.616952000000026 11.42631720000002 10.665155199999987 14.47452040000006","10.665155199999987 14.47452040000006 13.712825 15.998622000000001"]},V:{path:["18.28317399999999 -15.998621599999996 27.42565 -15.998621599999996","0 -15.998621599999996 9.141409200000039 -15.998621599999996","3.0466030000000393 -15.998621599999996 13.712469400000009 15.998622000000001","13.712469400000009 15.998622000000001 24.37827652016316 -15.998621599999996","4.5707046000000595 -15.998621599999996 13.712291600000054 11.42756180000003"]},W:{path:["18.284240800000045 -16.00235539999995 22.854767600000066 8.377047200000003","6.094272800000054 -16.001822000000004 10.665688600000015 8.378647400000006","22.854945400000023 15.995243800000038 28.949523018627335 -16.001822000000004","16.76031700000006 -16.001999799999957 22.854945400000023 15.99524380000004","10.66462180000004 15.998622000000001 16.76031700000006 -16.001999799999957","0 -16.001822000000004 10.665333000000023 -16.001822000000004","24.37833580000006 -16.001822000000004 33.52063400000004 -16.001822000000004","4.568503164948301 -16.001822000000004 10.66462180000004 15.998622000000001"]},X:{path:["0 -16.023157999999984 9.142476000000014 -16.023157999999984","18.283885199999972 -16.023157999999984 27.42618340000003 -16.023157999999984","3.048380999999997 -16.023157999999984 22.85568199943541 15.973196599999996","4.571881475457717 -16.023157999999984 24.38073060955467 15.973196599999996","3.047788303694577 15.973196599999996 24.378158000000024 -16.023157999999984","0.0012446000000109962 15.973196599999996 9.142298199999978 15.973196599999996","18.284240800000045 15.973196599999996 27.42618340000003 15.973196599999996"]},Y:{path:["15.236215399999958 0.5894071999999699 25.90230818231723 -16.170554200000016","0 -16.170554200000016 9.141409199999957 -16.170554200000016","19.80674219999998 -16.170554200000016 28.949573799999985 -16.170554200000016","4.570704599999983 -16.170554200000016 15.236215399999958 0.5894071999999699","15.236215399999958 15.826511600000028 15.236215399999958 0.5894071999999699","3.047233395022224 -16.170554200000016 13.712825 0.5899405999999967","13.712825 15.826511600000028 13.712825 0.5899406000000003","9.142476000000014 15.826511600000028 19.807808999999956 15.826511600000028"]},Z:{path:["0 15.990798800000023 19.807783583490043 -16.00626700000002","19.807840749814783 15.990963901111472 21.33137720000003 6.849745199999976","21.33137720000003 15.990976599999978 21.33137720000003 6.849745199999973","0 -6.863968800000048 0 -16.00626700000002","0 -6.863968800000048 1.5239235340857213 -16.00626700000002","0 -16.00626700000002 21.33137720000003 -16.00626700000002","1.5237635274907482 15.990811500781252 21.33137720000003 -16.00626700000002","0 15.990798800000023 21.33137720000003 15.990976599999978"]},"[":{path:["0 26.65577719999999 10.665866400000011 26.65577719999999","0 26.65577719999999 0 -22.101783399999984","0 -22.101783399999984 10.664799599999995 -22.101783399999984","1.5237459999999887 26.65577719999999 1.5237459999999887 -22.101783399999984"]},"\\":{path:["0.02009140000004706 -15.994445799999987 32.01733499999997 16.00279780000001","0.02009140000004706 -15.994445799999987 3.0675833999999473 -15.994445799999987","3.0675833999999473 -15.994445799999987 35.06482700000002 16.002797800000007","32.01733499999997 16.00279780000001 35.06482700000003 16.00279780000001"]},"]":{path:["0 26.65382139999999 10.665688600000015 26.65382139999999","0.0007111999999831824 -22.103739199999985 10.665688600000015 -22.103739199999985","9.142120399999982 26.65382139999999 9.142120399999982 -22.103739199999985","10.665688600000015 26.65382139999999 10.665688600000015 -22.103739199999985"]},"^":{path:["-6.938893903907228e-18 -8.381824056927275 12.187657943122021 -14.475564399999985","0 -8.381824056927275 12.187835743122056 -15.999132599999975","12.187657943122021 -14.475564399999985 24.376558236082147 -8.381025639195748","12.187835743122056 -15.999132599999978 24.376558236082147 -8.381025639195748"]},_:{path:["1.52 26.658622 27.422259599999965 26.658622"]},a:{path:["1.5233904000000376 14.47576499999999 6.095339600000025 15.998444199999964","0 11.428095199999976 1.5233904000000376 14.47576499999999","0 11.428095199999976 0 8.380425399999964","0 8.380425399999964 1.5233904000000376 5.3334668000000125","1.5233904000000376 5.3334668000000125 6.094272800000051 3.809543000000028","15.236393199999995 2.2859748000000355 16.760139200000022 0.7622288000000079","6.094272800000054 3.809543000000028 15.236393199999995 2.2859748000000355","3.0467807999999943 5.333644599999968 6.094272800000056 3.809543000000028","1.5233904000000376 8.380958799999991 3.0467807999999943 5.333644599999968","1.5233904000000376 11.42756180000003 1.5233904000000376 8.380958799999991","1.5233904000000376 11.42756180000003 3.047136399999986 14.4754094","3.047136399999986 14.4754094 6.0953396000000275 15.998444199999964","6.0953396000000275 15.998444199999964 10.663910600000056 15.998444199999964","10.663910600000056 15.998444199999964 13.713536199999984 14.475231599999963","13.713536199999984 14.475231599999963 16.760139200000022 11.427739599999985","18.28317399999999 14.474698200000017 21.33102160000004 15.998622000000001","16.760139200000022 11.427739599999985 18.28317399999999 14.474698200000017","16.760139200000022 11.427739599999985 16.760139200000022 -2.284907599999981","16.760139200000022 -2.284907599999981 18.283707400000015 0.7618732000000144","18.283707400000015 11.428628600000005 18.283707400000015 0.7618732000000126","18.283707400000015 11.428628600000005 19.8076312 14.475231599999963","19.8076312 14.475231599999963 21.33102160000004 15.998622000000001","21.33102160000004 15.998622000000001 22.855123200000058 15.998622000000001","15.236393199999995 -3.8088313999999635 16.760139200000022 -2.284907599999981","12.189434600000045 -5.332577399999995 15.236393199999995 -3.8088313999999635","6.0948062 -5.332577399999995 12.189434600000045 -5.332577399999995","3.0474920000000583 -3.809187000000037 6.0948062 -5.332577399999995","1.523568199999993 -2.284907599999981 3.0474920000000583 -3.809187000000037","1.523568199999993 -0.7615172000000232 1.523568199999993 -2.284907599999981","1.523568199999993 -0.7615172000000232 3.0469586000000306 -0.7615172000000232","3.0469586000000306 -0.7615172000000232 3.0469586000000306 -2.284551999999989"]},b:{path:["15.23657100000003 15.998444199999964 18.284240800000045 14.475053800000008","18.284240800000045 14.475053800000008 21.331199399999996 11.427739599999985","21.331199399999996 11.427739599999985 22.854945400000023 6.85596819999995","22.854945400000023 6.85596819999995 22.854945400000023 3.8093651999999913","21.33137720000003 -0.7624062000000418 22.854945400000023 3.8093651999999913","18.283529600000062 -3.8095426000000288 21.33137720000003 -0.7624062000000418","15.23657100000003 -5.333288600000056 18.283529600000062 -3.8095426000000288","6.094628400000045 11.427384310984138 9.141586999999994 14.474698200000017","9.141586999999994 14.474698200000017 12.189079000000053 15.998444199999964","12.189079000000053 15.998444199999964 15.23657100000003 15.998444199999964","15.23657100000003 15.998444199999964 19.827544800000016 14.457985000000008","19.827544800000016 14.457985000000008 22.85458980000003 11.42756179999995","22.85458980000003 11.42756179999995 24.37869140000005 6.853479000000009","24.37869140000005 6.853479000000009 24.379047000000043 3.809542999999948","22.855301000000015 -0.7620506000000518 24.379047000000043 3.809542999999948","19.807453400000046 -3.8095426000000288 22.855301000000015 -0.7620506000000518","15.23657100000003 -5.333288600000056 19.807453400000046 -3.8095426000000288","12.189256800000008 -5.333288600000056 15.23657100000003 -5.333288600000056","9.142476000000014 -3.8098982000000206 12.189256800000008 -5.333288600000056","6.094628400000045 -0.7622284000000139 9.142476000000014 -3.8098982000000206","4.5708824000000154 15.998088599999972 4.5708824000000154 -15.999155000000027","6.094628400000045 15.998622000000001 6.094628400000045 -15.999155000000027","0 -15.999155000000027 6.094628400000045 -15.999155000000027"]},c:{path:["6.094984000000036 14.474875999999972 9.141053599999966 15.998622000000001","3.0474919999999774 11.427028400000003 6.094984000000036 14.474875999999972","1.5239237999999846 6.856679400000014 3.0474919999999774 11.427028400000003","1.5239237999999846 6.856679400000014 1.5239237999999846 3.809898599999938","1.5239237999999846 3.809898599999938 3.0482031999999606 -0.7624062000000418","3.0482031999999606 -0.7624062000000418 6.09391719999998 -3.80865360000001","6.09391719999998 -3.80865360000001 9.141409200000039 -5.3329330000000645","16.761205999999998 14.47452039999998 19.808342399999983 11.427206199999958","12.1896124 15.998622000000001 16.761205999999998 14.47452039999998","9.141053599999966 15.998622000000001 12.1896124 15.998622000000001","4.5710601999999705 14.474698199999935 9.141053599999966 15.998622000000001","1.5239237999999846 11.427739599999985 4.5710601999999705 14.474698199999935","0 6.856501599999978 1.5239237999999846 11.427739599999985","0 6.856501599999978 0 3.8093651999999913","0 3.8093651999999913 1.5239237999999846 -0.761872800000015","1.5239237999999846 -0.761872800000015 4.571771400000035 -3.809364799999994","4.571771400000035 -3.809364799999994 9.141409200000039 -5.3329330000000645","9.141409200000039 -5.3329330000000645 13.713180599999992 -5.3329330000000645","13.713180599999992 -5.3329330000000645 16.77258519999997 -3.7976300000000265","16.77258519999997 -3.7976300000000265 19.808342399999983 -0.761872800000015","19.808342399999983 0.7615175999999426 19.808342399999983 -0.761872800000015","18.283351800000023 2.28401899999996 19.808342399999983 0.7615175999999426","16.760139200000022 0.7622288000000061 18.283351800000023 2.28401899999996","16.760139200000022 0.7622288000000061 18.284240799999964 -0.7609837999999947"]},d:{path:["3.048203199999961 11.42880639999996 6.095161799999991 14.474875999999972","13.713180599999992 -15.998799400000035 19.807809000000038 -15.998799400000035","19.807809000000038 15.998622000000001 19.807809000000038 -15.998799400000035","18.284418600000002 15.998622000000001 18.284418600000002 -15.998799400000038","18.284418600000002 15.998622000000001 24.379046999999964 15.998622000000001","15.236926600000022 -3.809364799999994 18.284418600000002 -0.7627618000000336","12.188190000000032 -5.333288600000056 15.236926600000022 -3.809364799999994","9.141942599999986 -5.333288600000056 12.188190000000032 -5.333288600000056","4.570348999999987 -3.809009200000002 9.141942599999984 -5.333288600000056","1.5242793999999762 -0.76169500000006 4.570348999999987 -3.809009200000002","0 3.809542999999948 1.5242793999999762 -0.76169500000006","0 6.8712587510966685 0 3.809542999999948","0 6.8712587510966685 1.5165452245802642 11.420717506355789","1.5165452245802638 11.420717506355787 4.571415799999962 14.475231599999963","4.571415799999962 14.475231599999963 9.142653799999971 15.998622000000001","9.14265379999997 15.998622000000001 12.189434599999963 15.998622000000001","12.189434599999963 15.998622000000001 15.236215400000038 14.4754094","15.236215400000038 14.4754094 18.284418600000002 11.427383328432791","6.095161799999991 -3.8097203999999856 9.141942599999988 -5.333288600000056","3.048203199999961 -0.7625839999999986 6.095161799999991 -3.8097203999999856","1.5239237999999844 3.8104319999999667 3.048203199999961 -0.7625839999999986","1.5239237999999844 6.871770281141385 1.5239237999999844 3.8104319999999667","1.5239237999999844 6.871770281141385 3.048203199999961 11.42880639999996","6.095161799999991 14.474875999999972 9.14265379999997 15.998622000000001"]},e:{path:["6.095695200000019 14.47576499999999 9.142831600000003 15.998622000000001","3.048558800000033 11.43307359999994 6.095695200000019 14.47576499999999","1.5239237999999846 6.856323799999942 3.048558800000033 11.43307359999994","1.5239237999999846 6.856323799999942 1.5239237999999846 3.8091873999999564","1.5239237999999846 3.8091873999999564 3.0476698000000138 -0.7622284000000068","3.0476698000000138 -0.7622284000000068 6.093205999999997 -3.8079424000000266","6.093205999999997 -3.8079424000000266 9.141942599999991 -5.33275520000003","16.76138380000002 -3.8088314000000594 18.284240800000045 -0.761872800000015","18.284240800000045 3.8091873999999564 18.284240800000045 -0.761872800000015","1.5239237999999846 3.8091873999999564 19.80798679999999 3.8091873999999564","16.76067259999997 14.474875999999972 19.807809000000038 11.42756179999995","12.189256800000008 15.998622000000001 16.76067259999997 14.474875999999972","9.142831600000004 15.998622000000001 12.189256800000008 15.998622000000001","4.571593599999998 14.475053800000008 9.142831600000004 15.998622000000001","1.5241016000000207 11.427917399999941 4.571593599999998 14.475053800000008","0 6.857035000000006 1.5241016000000207 11.427917399999941","0 6.857035000000006 0.0003555999999915912 3.8090095999999996","0.0003555999999915912 3.8090095999999996 1.5244572000000125 -0.7625839999999986","1.5244572000000125 -0.7625839999999986 4.570348999999988 -3.809009200000002","4.570348999999988 -3.809009200000002 9.141942599999986 -5.33275520000003","9.141942599999986 -5.33275520000003 13.713891799999976 -5.33275520000003","13.713891799999976 -5.33275520000003 16.761383800000033 -3.808831400000045","16.761383800000033 -3.808831400000045 18.284596400000037 -2.2849076000000608","18.284596400000037 -2.2849076000000608 19.80798679999999 0.7611619999999508","19.80798679999999 3.8091873999999564 19.80798679999999 0.7611619999999508"]},f:{path:["0 15.987420599999982 10.665688600000015 15.987420599999982","0.0005334000000278139 -5.344312199999958 12.189256800000008 -5.344312199999958","7.618196600000037 -14.486610400000014 9.141764800000031 -16.00875619999996","6.094272799999972 -11.43858500000001 7.618196600000037 -14.486610400000014","6.094272799999972 15.987420599999982 6.094272799999972 -11.43858500000001","4.570704599999979 15.987420599999982 4.570704599999979 -11.438940600000002","4.570704599999979 -11.438940600000002 6.094095000000016 -14.486254800000022","6.094095000000016 -14.486254800000022 9.141764800000031 -16.00875619999996","12.188190000000032 -16.00875619999996 13.712647199999966 -14.484299000000028","9.141764800000031 -16.00875619999996 12.188190000000032 -16.00875619999996","10.665333000000023 -12.962864399999987 12.189434600000045 -14.48643259999998","10.665333000000023 -12.962864399999987 12.187834400000042 -11.437695999999988","12.187834400000042 -11.437695999999988 13.712647199999966 -12.962508799999995","13.712647199999966 -12.962508799999995 13.712647199999966 -14.484299000000028"]},g:{path:["19.8076312 19.050603199999998 21.33102160000004 20.573282399999975","15.23657100000003 17.526679399999935 19.8076312 19.050603199999998","7.618196600000037 17.526679399999935 15.23657100000003 17.526679399999935","3.047136400000067 16.00275559999995 7.618196600000037 17.526679399999935","1.5237460000000325 12.956152599999996 3.047136400000067 16.00275559999995","1.5233904000000376 17.527212799999962 6.0951618000000725 16.003111199999942","0 20.57470479999994 1.5233904000000376 17.527212799999962","0 22.09720619999996 0 20.57470479999994","0 22.09720619999996 1.5235682000000739 25.1454094","16.76031700000006 5.337778199999997 16.76031700000006 -0.7573837868518485","15.237815600000062 -3.8039866000000213 16.76031700000006 -0.7573837868518485","15.237815599999971 -3.803986600000064 16.760139200000022 -2.2805962000000743","12.189256800000008 -5.328088200000051 15.237815599999971 -3.803986600000064","9.142476000000014 -5.328088200000051 12.189256800000008 -5.328088200000051","6.094450600000008 -3.80434220000002 9.142476000000014 -5.328088200000051","4.571060200000051 -0.757205800000035 6.094450600000008 -3.80434220000002","4.571060200000051 5.337778199999997 4.571060200000051 -0.757205800000035","4.571060200000051 5.337778199999997 6.0948062 8.384914599999984","6.0948062 8.384914599999984 9.14265380000005 9.90830499999994","9.14265380000005 9.90830499999994 12.189968000000071 9.90830499999994","12.189968000000071 9.90830499999994 15.234551801262542 8.385746638332348","15.23710440000006 8.380647399999923 16.761205999999998 6.855478999999926","16.761205999999998 6.855478999999926 18.283885200000054 3.80976499999999","18.283885200000054 3.80976499999999 18.284418008721815 0.7665391838921298","16.760139200000022 -2.2805962000000743 18.284418008721815 0.7665391838921298","16.760139200000022 -2.2805962000000743 18.284240800000045 -3.805053400000004","18.284240800000063 -3.805053400000004 21.33137720000003 -5.328799400000035","18.284240800000063 -3.805053400000004 21.33137720000003 -3.805053400000004","21.33137720000003 -3.805053400000004 21.33137720000003 -5.328799400000035","15.23710440000006 8.380647399999923 16.76031700000006 5.337778199999997","4.571415800000043 -2.281307400000058 6.094450600000008 -3.80434220000002","3.0476698000000138 0.7665401999999926 4.571415800000043 -2.281307400000058","3.0476698000000138 3.813320999999986 3.0476698000000138 0.7665401999999926","3.0476698000000138 3.813320999999986 4.571415800000043 6.861524199999947","4.571415800000043 6.861524199999947 6.0948062 8.384914599999984","3.047136400000067 8.384736799999947 4.571415800000043 6.861524199999947","1.5237460000000291 11.432228799999924 3.047136400000067 8.384736799999947","1.5237460000000291 12.95615259999999 1.5237460000000291 11.432228799999924","1.5237460000000291 12.95615259999999 3.0476698000000138 14.480076399999975","3.0476698000000138 14.480076399999975 7.617841000000046 16.003111199999942","7.617841000000046 16.003111199999942 15.237104400000058 16.003111199999942","15.237104400000058 16.003111199999942 19.807986800000073 17.527034999999927","19.807986800000073 17.527034999999927 21.33102160000004 20.573282399999975","21.33102160000004 20.573282399999975 21.33137720000003 22.09756179999995","19.80816460000003 25.14505379999993 21.33137720000003 22.097561799999948","15.238349000000069 26.668622 19.80816460000003 25.14505379999993","6.0951618000000725 26.668622 15.238349000000069 26.668622","1.5235682000000739 25.1454094 6.0951618000000725 26.668622"]},h:{path:["0 -16.00107260000001 6.094450600000008 -16.00107260000001","0.00017779999995536856 15.99617099999999 10.66586639999997 15.99617099999999","4.5708824000000154 15.99617099999999 4.5708824000000154 -16.00107260000001","6.094450600000008 15.99617099999999 6.094450600000008 -16.00107260000001","6.094450600000008 -0.7641459999999884 9.141586999999994 -3.811282399999979","9.141586999999994 -3.811282399999979 13.713180599999992 -5.335206199999964","13.713180599999992 -5.335206199999964 16.760494800000014 -5.335206199999964","16.760139200000022 15.99617099999999 27.425827799999958 15.99617099999999","16.760494800000014 -5.335206199999964 21.331021599999957 -3.811637999999971","16.760494800000014 -5.335206199999964 19.807808999999956 -3.811460200000014","19.807808999999956 -3.811460200000014 21.331554999999984 -0.7637904000000002","21.331021599999957 -3.811637999999971 22.854945400000023 -0.7645015999999838","21.331554999999984 15.99617099999999 21.331554999999984 -0.763790400000002","22.854945400000023 15.99617099999999 22.854945400000023 -0.7645015999999838"]},i:{path:["0.0010667999999747736 15.99616100000002 10.666933200000026 15.99616100000002","4.571771400000035 15.99616100000002 4.571771400000035 -5.335749599999955","6.096050800000011 15.99616100000002 6.096050800000011 -5.335749599999955","0 -5.335749599999955 6.096050800000011 -5.335749599999955","3.0482032000000414 -14.477514399999984 4.572127000000026 -16.000904799999944","3.0482032000000414 -14.477514399999984 4.572304799999982 -12.954123999999949","4.572304799999982 -12.954123999999949 6.095339600000022 -14.477514399999992","4.572127000000026 -16.000904799999944 6.095339600000022 -14.477514399999992"]},j:{path:["0 23.61130780000006 1.5237460000000287 22.08756180000003","0 25.134698200000017 0 23.61130780000006","0 25.134698200000017 1.5239238000000654 26.658622","1.5235682000000739 25.135231600000044 3.0474920000000583 23.61130780000006","1.523746000000029 22.08756180000003 3.0474920000000583 23.61130780000006","1.5239238000000654 26.658622 4.570704600000061 26.658622","3.0476698000000138 -5.338443799999961 9.141764800000031 -5.338443799999961","4.5707046000000595 26.658622 6.0948062 25.134698200000017","4.570704600000061 26.658622 7.618196600000037 25.135587200000035","6.094628400000045 -14.48038639999995 7.618374400000073 -16.004132399999975","6.094628400000045 -14.48038639999995 7.618196600000037 -12.956818199999951","6.0948062 25.134698200000017 7.618374400000073 22.08756179999995","7.618196600000037 25.135587200000035 9.141764800000031 22.090584399999997","7.618196600000037 -12.956818199999951 9.141942600000066 -14.480564199999982","7.618374400000073 22.08756179999995 7.618374400000073 -5.338443799999968","7.618374400000073 -16.004132399999975 9.141942600000066 -14.480564199999982","9.141764800000031 22.090584399999997 9.141764800000031 -5.338443799999961"]},k:{path:["13.713180599999992 3.8118825999999757 22.855789957780456 16.00131720000002","16.76013919999994 16.00131720000002 25.902081799999927 16.00131720000002","12.190044189851468 3.8119842101484878 21.331777595758144 16.00131720000002","6.095339599999947 9.906688799999976 21.331910599999976 -5.3298821999999735","16.759605799999996 -5.3298821999999735 25.902615199999957 -5.3298821999999735","0.001777999999957956 16.001139399999985 10.66586639999997 16.001139399999985","4.571593599999998 16.001139399999985 4.571593599999998 -15.995748600000029","6.095339599999947 16.001139399999985 6.095339599999947 -15.995748600000022","0 -15.995748600000022 6.095339599999947 -15.995748600000022"]},l:{path:["0 -15.995748600000022 6.095339599999947 -15.995748600000022","6.095339599999947 16.001139399999985 6.095339599999947 -15.995748600000022","4.571593599999998 16.001139399999985 4.571593599999998 -15.995748600000022","0.001777999999957956 16.001139399999985 10.66586639999997 16.001139399999985"]},m:{path:["0 -5.324822400000011 6.094272800000053 -5.324822400000011","6.094272800000053 16.00655480000002 6.094272800000053 -5.324822400000011","4.570349000000069 16.00655480000002 4.570349000000069 -5.3248224000000075","0.0010668000000556277 16.00655480000002 10.664799599999995 16.00655480000002","16.75942800000004 16.00655480000002 27.425116600000056 16.00655480000002","33.52010060000001 16.00655480000002 44.18561140000007 16.00655480000002","13.712647200000045 -5.325000200000046 16.760139200000022 -5.325000200000046","30.472608600000033 -5.325000200000046 33.520456200000005 -5.325000200000046","6.094272800000053 -0.7539400207479954 9.141942600000066 -3.8014319999999717","9.141942600000066 -3.8014319999999717 13.712647200000045 -5.325000200000046","16.760139200000022 -5.325000200000046 21.329954800000063 -3.8012542000000185","21.329954800000063 -3.8012542000000185 22.854411999999996 -0.7535844000000029","22.854411999999996 16.00655480000002 22.854411999999996 -0.7535844000000029","22.854411999999996 -0.7535844000000029 25.90208180000001 -3.8012542000000185","25.90208180000001 -3.8012542000000185 30.472608600000033 -5.325000200000046","33.520456200000005 -5.325000200000046 38.09098300000002 -3.8012542000000185","38.09098300000002 -3.8012542000000185 39.61490680000001 -0.7548290000000151","39.61490680000001 16.00655480000002 39.61490680000001 -0.7548290000000151","38.09098300000002 16.00655480000002 38.09098300000002 -0.7537622000000397","36.56759260000007 -3.8014319999999717 38.09098300000002 -0.7537622000000397","33.520456200000005 -5.325000200000046 36.56759260000007 -3.8014319999999717","16.760139200000022 -5.325000200000046 19.807275600000008 -3.8008986000000267","19.807275600000008 -3.8008986000000267 21.330843800000004 -0.7542955999999865","21.330843800000004 16.00655480000002 21.330843800000004 -0.7542955999999865"]},n:{path:["16.75942799999996 -5.327014199999985 19.80727559999993 -3.8039794000000224","13.713002675533733 -5.327014199999985 16.75942799999996 -5.327014199999985","0 -5.327014199999985 6.094450599999927 -5.327014199999985","6.094450599999927 16.00418520000001 6.094450599999927 -5.327014199999985","0.0012445999999301423 16.00418520000001 10.666221999999962 16.00418520000001","16.760494799999933 16.00418520000001 27.42653899999994 16.00418520000001","22.854767599999988 16.00418520000001 22.854767599999988 -0.7557761999999784","21.331021599999957 -3.803623799999949 22.854767599999988 -0.7557761999999784","16.75942799999996 -5.327014199999985 21.331021599999957 -3.803623799999949","21.330843800000004 16.00418520000001 21.330843800000004 -0.7552427999999516","19.80727559999993 -3.8039794000000224 21.330843800000004 -0.7552427999999516","6.094450599999927 -0.7559540000000204 9.14176479999995 -3.803445999999992","9.14176479999995 -3.803445999999992 13.713002675533733 -5.327014199999985","4.570704599999979 16.00418520000001 4.570704599999979 -5.327014199999985"]},o:{path:["12.18961240000001 -5.143110800000022 15.236393199999995 -3.6193647999999943","15.236393199999995 -3.6193647999999943 18.2844186 -0.5715172000000237","18.2844186 -0.5715172000000237 19.807453400000046 3.999187400000036","19.807453400000046 7.047568400000033 19.807453400000046 3.999187400000036","18.2844186 11.61756180000003 19.807453400000046 7.047568400000033","15.236393199999995 14.665587200000035 18.2844186 11.61756180000003","12.188723400000061 16.188622 15.236393199999995 14.665587200000035","6.094095000000016 14.664164799999988 9.142120400000023 16.188622","3.0474920000000583 11.61756180000003 6.094095000000016 14.664164799999988","1.523568199999993 7.046323800000022 3.0474920000000583 11.61756180000003","1.523568199999993 7.046323800000022 1.523568199999993 3.9997207999999826","1.523568199999993 3.9997207999999826 3.0474920000000583 -0.5718728000000155","3.0474920000000583 -0.5718728000000155 6.0948062 -3.6191870000000375","6.0948062 -3.6191870000000375 9.142120400000023 -5.143110800000022","4.571593599999998 -3.619720399999986 9.142120400000023 -5.143110800000022","1.5237460000000291 -0.5718728000000155 4.571593599999998 -3.619720399999986","0 3.999187400000036 1.5237460000000291 -0.5718728000000155","0 7.046679400000014 0 3.999187400000036","0 7.046679400000014 1.5237460000000291 11.617917400000021","1.5237460000000291 11.617917400000021 4.571593599999998 14.665053800000008","4.571593599999998 14.665053800000008 9.142120400000023 16.188622","9.142120400000023 16.188622 12.188723400000061 16.188622","12.188723400000061 16.188622 16.76102820000004 14.664698200000016","16.76102820000004 14.664698200000016 19.80816460000003 11.616494999999974","19.80816460000003 11.616494999999974 21.331732800000022 7.046145999999986","21.331732800000022 7.046145999999986 21.331732800000022 4.000076399999974","19.80816460000003 -0.5715172000000237 21.331732800000022 4.000076399999974","16.76031700000006 -3.6190092000000025 19.80816460000003 -0.5715172000000237","12.1896124 -5.143110800000022 16.76031700000006 -3.6190092000000025","9.142120400000023 -5.143110800000022 12.1896124 -5.143110800000022"]},p:{path:["4.570348999999988 26.66452260000001 4.570348999999988 -5.333076599999982","0 -5.333076599999982 6.093917200000061 -5.333076599999982","6.093917200000061 26.66452260000001 6.093917200000061 -5.333076599999982","0.00640080000001035 26.66452260000001 10.665155199999987 26.66452260000001","6.093917200000061 11.42741820000003 9.140698000000056 14.474199000000025","9.140698000000056 14.474199000000025 12.188901200000016 15.998478400000002","12.188901200000016 15.998478400000002 15.236393199999995 15.998478400000002","15.236393199999995 15.998478400000002 19.807275600000008 14.47437679999998","19.807275600000008 14.47437679999998 22.854767599999988 11.427062599999958","22.854767599999988 11.427062599999958 24.37833580000006 6.8574247999999525","24.37833580000006 6.8574247999999525 24.37833580000006 3.808688199999965","22.85458980000003 -0.7609496000000373 24.37833580000006 3.808688199999965","19.807097800000054 -3.809330600000033 22.85458980000003 -0.7609496000000373","15.236037600000023 -5.332898800000015 19.807097800000054 -3.809330600000033","12.188901200000016 -5.3328988000000255 15.236037600000003 -5.3328988000000255","9.142298200000058 -3.8098639999999815 12.188901200000016 -5.3328988000000255","6.093917200000061 -0.7614830000000641 9.142298200000058 -3.8098639999999815","15.236393199999995 15.998478400000002 18.283885200000054 14.47437679999998","18.283885200000054 14.47437679999998 21.330843800000004 11.427595999999987","21.330843800000004 11.427595999999987 22.854411999999996 6.857780400000026","22.854411999999996 6.857780400000026 22.854411999999996 3.8095771999999837","21.330666000000047 -0.762194199999966 22.854411999999996 3.8095771999999837","18.283529600000062 -3.809330600000033 21.330666000000047 -0.762194199999966","15.236037600000003 -5.3328988000000255 18.283529600000062 -3.809330600000033"]},q:{path:["6.094983999999955 -3.808974999999961 9.142298199999978 -5.332720999999989","3.0474919999999774 -0.7618385999999759 6.094983999999955 -3.808974999999961","1.5241015999999399 3.8097550000000204 3.0474919999999774 -0.7618385999999759","1.5241015999999399 6.856535800000014 1.5241015999999399 3.8097550000000204","1.5241015999999399 6.856535800000014 3.0474919999999774 11.427773800000022","3.0474919999999774 11.427773800000022 6.0956951999999385 14.475799200000028","6.0956951999999385 14.475799200000028 9.142831599999925 15.99901180000003","15.237104399999977 14.475088000000044 18.284240799999964 11.427775617533953","12.1896124 15.99901180000003 15.237104399999977 14.475088000000044","9.142831599999925 15.99901180000003 12.1896124 15.99901180000003","4.571415799999962 14.475443600000036 9.142831599999923 15.99901180000003","1.5242793999999762 11.428840599999997 4.571415799999962 14.475443600000036","0 6.857602599999989 1.5242793999999762 11.428840599999997","0 6.857602599999989 0 3.8099327999999772","0 3.8099327999999772 1.5242793999999762 -0.7618385999999759","1.5242793999999762 -0.7618385999999759 4.571771399999954 -3.809152799999996","4.571771399999954 -3.809152799999996 9.14229819999998 -5.332720999999989","9.14229819999998 -5.332720999999989 12.1896124 -5.332720999999989","12.1896124 -5.332720999999989 15.237459999999968 -3.8086193999999693","15.237459999999968 -3.8086193999999693 18.284240799999964 -0.7613051999999456","18.284240799999964 26.66452260000001 18.284240799999964 -5.332187599999962","13.713891799999976 26.66452260000001 24.378157999999942 26.66452260000001","19.80798679999999 26.66452260000001 19.80798679999999 -5.332720999999989"]},r:{path:["0 -5.334360399999937 6.094095000000016 -5.334360399999937","6.094095000000016 15.997016800000013 6.094095000000016 -5.334360399999937","4.570348999999988 15.997016800000013 4.570348999999988 -5.334360399999937","0 15.997016800000013 10.665155199999987 15.997016800000013","6.094095000000016 3.8075822000000485 7.61766320000001 -0.7629445999999742","7.61766320000001 -0.7629445999999742 10.665155199999987 -3.810792199999945","10.665155199999987 -3.810792199999945 13.712113800000019 -5.334182599999981","13.712113800000019 -5.334182599999981 18.283351800000023 -5.334360399999937","18.283351800000023 -5.334360399999937 19.80692000000002 -3.8109699999999798","19.80692000000002 -2.2906021999999915 19.80692000000002 -3.8109699999999798","18.280329199999976 -0.7640113999999496 19.80692000000002 -2.2906021999999915","16.759250200000004 -2.2868683999999586 18.280329199999976 -0.7640113999999496","16.759250200000004 -2.2868683999999586 18.283351800000023 -3.810614399999988"]},s:{path:["15.237282200000013 6.856679400000014 16.76067259999997 8.379892000000016","12.1896124 5.333111200000022 15.237282200000013 6.856679400000014","4.572126999999945 2.2861525999999905 12.1896124 5.333111200000022","1.5239237999999846 0.7620509999999694 4.572126999999945 2.2861525999999905","0.00017779999995536856 -0.7616949999999783 1.5239237999999846 0.7620509999999694","0 15.998622000000001 1.5239237999999846 12.951485600000014","0 15.998622000000001 0 9.903637999999965","0 9.903637999999965 1.5239237999999846 12.951485600000014","1.5239237999999846 12.951485600000014 3.0482031999999606 14.475231599999963","3.0482031999999606 14.475231599999963 6.095161799999992 15.998622000000001","6.095161799999992 15.998622000000001 12.189434599999963 15.998622000000001","12.189434599999963 15.998622000000001 15.237282200000013 14.474342600000025","15.237282200000013 14.474342600000025 16.76067259999997 12.950952199999987","16.76067259999997 12.950952199999987 16.76067259999997 8.379892000000016","15.237637800000005 8.3806032 16.76067259999997 9.90398998400735","12.189967999999991 6.856857199999969 15.237637800000005 8.3806032","4.572304799999982 3.80989860000002 12.189967999999991 6.856857199999969","1.5237459999999483 2.285619199999962 4.572304799999982 3.80989860000002","0.00017779999995536856 0.7620509999999694 1.5237459999999483 2.285619199999962","0.00017779999995536856 0.7620509999999694 0.00017779999995536856 -2.2854410000000076","0.00017779999995536856 -2.2854410000000076 1.5241016000000207 -3.809187000000037","1.5241016000000207 -3.809187000000037 4.571415799999962 -5.332577399999995","4.571415799999962 -5.332577399999995 10.665510799999979 -5.332577399999995","10.665510799999979 -5.332577399999995 13.713358399999947 -3.809187000000037","13.713358399999947 -3.809187000000037 15.23657099999995 -2.285974400000036","15.23657099999995 -2.285974400000036 16.76067259999997 -5.33275520000003","15.23657099999995 -2.285974400000036 16.76067259999997 0.7616953999999776","16.76067259999997 0.7616953999999776 16.76067259999997 -5.33275520000003"]},t:{path:["0 -5.332932999999986 12.187656600000006 -5.332932999999986","6.093383799999953 14.475231599999963 9.141231400000002 15.998622000000001","4.570171199999951 9.904526999999984 6.093383799999953 14.475231599999963","4.570171199999951 9.904526999999984 4.570171199999951 -15.998799400000035","15.235148599999983 14.474875999999972 16.75889459999993 11.427739599999985","12.188012199999998 15.998622000000001 15.235148599999983 14.474875999999972","9.141231400000002 15.998622000000001 12.188012199999998 15.998622000000001","7.617129799999982 14.4754094 9.141231400000002 15.998622000000001","6.093383799999953 9.903993599999957 7.617129799999982 14.4754094","6.093383799999953 9.903993599999957 6.093383799999953 -15.998799400000035","4.570171199999951 -15.998799400000035 6.093383799999953 -15.998799400000035"]},u:{path:["0 -5.333110800000021 6.094450600000008 -5.333110800000021","16.760139200000022 -5.333110800000021 22.854945400000023 -5.333110800000021","22.854945400000023 15.99826640000001 22.854945400000023 -5.333110800000021","21.33102160000004 15.99826640000001 27.426005599999993 15.99826640000001","21.33102160000004 15.99826640000001 21.33102160000004 -5.333110800000018","6.094450600000008 11.427028400000003 6.094450600000008 -5.333110800000021","6.094450600000008 11.427028400000003 7.618374399999992 14.475053800000008","7.618374399999992 14.475053800000008 10.666399799999999 15.998622000000001","10.666399799999999 15.998622000000001 13.712647199999966 15.998622000000001","13.712647199999966 15.998622000000001 18.28352959999998 14.474698199999935","18.28352959999998 14.474698199999935 21.33102160000004 11.427561302773196","4.5708824000000154 11.427383999999993 4.5708824000000154 -5.333110800000021","4.5708824000000154 11.427383999999993 6.095161799999992 14.474698199999935","6.095161799999992 14.474698199999935 10.666399799999999 15.998622000000001"]},v:{path:["4.570882399999975 -5.340044999999979 12.189612399999959 12.946329400000016","3.046247400000007 -5.340044999999979 12.18885030331606 15.991450925997786","0 -5.340044999999979 9.14176479999999 -5.340044999999979","15.234259600000003 -5.336844599999974 24.376557799999983 -5.336844599999974","12.18885030331606 15.991450925997786 21.329421399999994 -5.336844599999974"]},w:{path:["0 -5.332221800000003 10.664977399999952 -5.332221800000003","24.37780239999995 -5.332221800000003 33.52063399999996 -5.332221800000003","4.570095002964017 -5.332221800000003 10.664799599999995 15.998622000000001","10.664799599999995 15.998622000000001 16.759783599999952 -5.332577400000076","16.759783599999952 -5.332577400000076 22.854234199999958 15.998622000000001","22.854234199999958 15.998622000000001 28.948938797035936 -5.332221800000003","6.094628399999964 -5.332221800000003 10.664799599999995 11.427028399999921","18.283351800000023 -5.332399600000038 22.854411999999996 11.428095199999976"]},x:{path:["0 -5.338978200000003 9.142120400000023 -5.338978200000003","15.236037600000003 -5.338978200000003 24.378513600000016 -5.338978200000003","3.047136399999986 -5.338978200000003 19.807186755564814 15.992398999999946","4.5710601999999705 -5.338978200000003 21.33111059259718 15.992398999999946","3.0467808044452034 15.992398999999946 21.330843800000004 -5.338978200000003","0.00017780000003622264 15.992398999999946 9.141764800000031 15.992398999999946","15.235859800000046 15.992398999999946 24.378513600000016 15.992398999999946"]},y:{path:["0.00017780000003622264 -5.33964519999998 9.142298200000058 -5.33964519999998","15.23657100000003 -5.33964519999998 24.378513600000016 -5.33964519999998","3.047136399999986 -5.33964519999998 12.1896124 15.99244320000003","9.14265380000005 22.085827000000066 12.1896124 15.99244320000003","6.095161799999992 25.133674600000035 9.14265380000005 22.085827000000066","3.046958351299797 26.65795400000001 6.095161799999992 25.133674600000035","1.5239237999999846 23.610462000000034 3.0476698000000138 25.134030200000026","0 25.134030200000026 1.5239237999999846 23.610462000000034","0 25.134030200000026 1.5235706720194575 26.65795400000001","1.5235706720194575 26.65795400000001 3.046958351299797 26.65795400000001","12.1896124 15.99244320000003 21.331199399999996 -5.33964519999998","4.570986117819258 -5.33964519999998 12.189967999999991 12.946195800000064"]},z:{path:["0 0.7512052000000242 1.5238783955838133 -5.343600999999975","0 0.7512052000000242 0 -5.343600999999975","0.00017780000003622383 15.98795400000001 16.76057104190339 -5.343600999999975","0.00017780000003622383 15.98795400000001 18.283707400000015 15.98795400000001","16.760361405925995 15.98795400000001 18.283707400000015 9.894214599999986","18.283707400000015 15.98795400000001 18.283707400000015 9.894214599999986","1.5239490920815293 15.98795400000001 18.284240800000045 -5.343600999999975","0 -5.343600999999975 18.284240800000045 -5.343600999999975"]},"{":{path:["3.0473141999999416 -17.527522799999936 4.5707045999999725 -20.575192599999944","3.0473141999999416 -14.480919799999974 3.0473141999999416 -17.527522799999936","3.0473141999999416 -14.480919799999974 4.570882399999935 -11.433249999999958","4.570882399999935 -11.433249999999958 6.094272799999972 -9.909859600000004","6.094272799999972 -9.909859600000004 7.618196599999957 -6.8618342000000005","7.618196599999957 -3.8154089999999954 7.618196599999957 -6.8618342000000005","6.0948062 -0.7675613999999449 7.618196599999957 -3.8154089999999954","3.047669799999954 0.7556512000000382 6.0948062 -0.7675613999999449","3.0459807363089517 3.8025209363090227 6.094450599999927 6.850990799999998","6.094450599999927 9.898127200000067 6.094450599999927 6.850990799999998","4.5712379999999255 12.94490800000006 6.094450599999927 9.898127200000067","3.0480253999999247 14.467587200000034 4.5712379999999255 12.94490800000006","1.523568199999993 17.516323800000023 3.0480253999999247 14.467587200000034","1.523568199999993 20.563638000000047 1.523568199999993 17.516323800000023","1.523568199999993 20.563638000000047 3.0474919999999774 23.611130000000024","3.0474919999999774 23.611130000000024 4.570882399999935 25.134698200000017","4.570882399999935 25.134698200000017 7.618196599999957 26.658622","3.047669799999933 22.08667280000001 4.570882399999935 25.134698200000017","3.047669799999933 22.08667280000001 3.047669799999933 19.04184780000001","3.047669799999933 19.04184780000001 4.570171199999951 15.993289000000058","4.570171199999951 15.993289000000058 6.094450599999927 14.469187400000036","6.094450599999927 14.469187400000036 7.618196599999957 11.420806400000039","7.618196599999957 11.420806400000039 7.618196599999957 8.373136600000025","6.094450599999927 5.326711400000022 7.618196599999957 8.373136600000025","0 2.2795750000000368 6.094450599999927 5.326711400000022","0 2.2795750000000368 3.0476697999999374 0.7556512000000524","3.0476697999999325 0.7556512000000559 6.094450599999927 -2.291129599999941","6.094450599999927 -2.291129599999941 6.094450599999927 -5.338977199999988","4.570882399999935 -8.385935799999938 6.094450599999927 -5.338977199999988","3.047136399999986 -9.909148399999943 4.570882399999935 -8.385935799999938","1.5233903999999567 -12.957351599999981 3.047136399999986 -9.909148399999943","1.5233903999999567 -12.957351599999981 1.5233903999999567 -16.004310200000013","1.5233903999999567 -16.004310200000013 3.046425199999922 -19.050913199999968","3.046425199999922 -19.050913199999968 4.570704599999972 -20.575192599999944","4.5707045999999725 -20.575192599999944 7.618552199999948 -22.099294199999967"]},"|":{path:["0 25.138622 0 -22.09554820000002"]},"}":{path:["3.053892799999988 -20.569836999999996 4.577283199999985 -17.52216719999998","4.577283199999985 -14.475741834180443 4.577283199999985 -17.52216719999998","3.0535371999999965 -11.428072200000006 4.577283199999985 -14.475741834180443","1.5297911999999672 -9.903792799999987 3.0535371999999965 -11.428072200000006","0.006222999999974127 -6.856478599999964 1.5297911999999672 -9.903792799999987","0.006222999999974127 -3.809697799999972 0.006222999999974127 -6.856478599999964","0.006222999999974127 -3.809697799999972 1.5294355999999756 -0.7618502000000031","1.5297911999999672 6.856346400000033 4.577816703752094 3.808320896247901","1.5297911999999672 9.903127200000027 1.5297911999999672 6.856346400000033","1.5297911999999672 9.903127200000027 3.0533594000000006 12.950619200000004","3.0533594000000006 12.950619200000004 4.577460999999981 14.474720800000025","4.577460999999981 14.474720800000025 6.1008513999999785 17.522035000000006","6.1008513999999785 20.56934920000003 6.1008513999999785 17.522035000000006","4.577460999999981 23.616485600000015 6.1008513999999785 20.56934920000003","3.0535371999999974 25.14076500000003 4.577460999999981 23.616485600000015","0.006756400000001941 26.663622 3.0535371999999974 25.14076500000003","3.053537199999997 25.14076500000003 4.577283199999985 22.09256180000003","4.577283199999985 22.09256180000003 4.577283199999985 19.04525041800855","3.053714999999992 15.998289000000018 4.577283199999985 19.04525041800855","1.5301467999999991 14.474720800000025 3.053714999999992 15.998289000000018","0.006222999999974127 11.427406600000003 1.5301467999999991 14.474720800000025","0.006222999999974127 11.427406600000003 0.006222999999974127 8.379381200000077","0.006222999999974127 8.379381200000077 1.5296133999999713 5.332600400000002","1.5296133999999713 5.332600400000002 7.624241799999977 2.2849306000000293","1.5294355999999756 -0.7618502000000031 7.624241799999975 2.2849306000000293","1.5299690000000032 -2.2861295999999793 4.578438573295234 0.7623399732952496","1.5299690000000032 -2.2861295999999793 1.5299690000000032 -5.333442135244523","1.5299690000000032 -5.333442135244523 3.053714999999992 -8.380757999999982","3.053714999999992 -8.380757999999982 4.577105399999989 -9.904148399999979","4.577105399999989 -9.904148399999979 6.1008513999999785 -12.951818199999995","6.1008513999999785 -12.951818199999995 6.1008513999999785 -15.999660012880891","4.577105399999989 -19.046624399999995 6.1008513999999785 -15.999660012880891","3.053892799999988 -20.569836999999996 4.577105399999989 -19.046624399999995","0.006578599999965718 -22.093582999999985 3.053892799999988 -20.569836999999996"]},"~":{path:["13.712647200000049 -8.376555799999952 19.8076312 -11.423514399999984","7.618374399999992 -12.947082599999977 13.712647200000049 -8.376555799999952","0 -8.376377999999999 7.618374399999992 -12.947082599999977"]},"\xB0":{path:["3 -11 0 -8 3 -5 6 -8 3 -11"]},\u03A9:{path:["0 9 7 9 5 6 3 3 2 0 2 -3 3 -6 4 -8 6 -10 8 -11 12 -11 14 -10 16 -8 17 -6 18 -3 18 0 17 3 15 6 13 9 20 9"]},\u03BC:{path:["0 14 1 4 1 -6 1 4 2 7 4 8 6 8 8 7 10 4 10 -6 10 6 11 8 12 9"]}},VP.spacing={A:4.114291999999978,B:4.266311000000059,C:4.571238000000008,D:4.266666599999979,E:4.418685599999975,F:4.418507799999929,G:4.113580799999994,H:3.8090094000000363,I:5.790057000000019,J:5.180558600000012,K:3.9612061999999924,L:4.570882400000016,M:3.6569904000000406,N:3.961739600000044,O:4.41886339999985,P:4.266310999999973,Q:4.419041200000095,R:4.113580799999909,S:4.72343479999995,T:4.570882400000187,U:3.8091871999999967,V:4.113936399999943,W:3.5042602000000898,X:4.113936399999943,Y:3.961028400000032,Z:4.723434800000177,a:4.570526800000024,b:4.41886340000001,c:4.875809400000044,d:4.41868560000006,e:4.876165000000029,f:5.48530779999998,g:4.72325699999999,h:4.114114199999932,i:5.789701399999927,j:5.941898199999969,k:4.266133199999956,l:5.789701400000013,m:2.437815799999953,n:4.1139364,o:4.723612599999967,p:4.418685600000003,q:4.418863400000021,r:4.876165000000071,s:5.180736400000001,t:5.180203000000006,u:4.113580799999909,v:4.4190411999998105,w:3.50443800000005,x:4.419574600000033,y:4.418507800000043,z:5.0278284000000895,0:4.723790400000038,1:5.485307800000022,2:4.723434799999964,3:4.723612599999996,4:4.418329999999983,5:4.72343479999995,6:4.72343479999995,7:4.723257000000018,8:4.72325700000001,9:4.723257000000018,"`":6.55210780000002,"!":6.552819000000005,"@":3.6569904000000406,"#":4.5714157999999685,$:4.72361260000001,"%":4.113936399999986,"^":4.418863399999992,"&":3.9615617999999984,"*":5.332755399999996,"(":5.789701399999927,")":5.790234799999966,_:4.114114200000017,"+":4.11411419999996,"-":4.114114200000017,"=":4.1139364,"[":5.789879200000087,"]":5.789879200000087,"{":6.094628400000033,"}":5.028006199999936,"?":5.028361799999991,";":6.551396600000038,"'":6.551396599999958,"\\":1.9806919999999764,":":6.551752200000038,'"':6.551752200000024,"|":6.5515744000000495,",":6.8566792000000305,".":6.551929999999857,"<":4.418329999999984,">":4.41815220000003,"/":-.785};var ote=VP;var GP=class GP{static setFontHeight(t){GP.height=+t}static getFontHeight(){return GP.height||4.5}static getCharInfo(t,e,r){function i(u,d,p,m,g){let y="",b=u.length;for(let P=0;P<b;P++){let T=u[P].split(" "),I=0,C=T.length;for(;I<C;I+=2)T[I]=gn(p+d*T[I],2),T[I+1]=gn(m+d*(+T[I+1]-16),2);let E="M "+T[0]+" "+T[1];for(I=2;I<C;I++)I%2===0&&(E+="L"),E+=T[I]+" ";y+=E}return y}if(GP.fontPath[t]){var n=GP.fontPath[t].path,s=GP.getPathBBox(n),a=Math.abs(s.R-s.L),l=Math.abs(s.T-s.B);l===0&&(l=1);var c=GP.getFontHeight()/32;a=a*c;var h=i(n,c,e,r,l);return[h,a]}else return["",0]}static getPathBBox(t){for(var e=t.length,r={L:9999,T:-9999,R:-9999,B:9999},i,n,s=0;s<e;s++){for(var a=t[s].split(" "),l=0,c=a.length;l<c;l+=2)i=+a[l],n=+a[l+1],r.L>i&&(r.L=i),r.T<n&&(r.T=n),r.R<i&&(r.R=i),r.B>n&&(r.B=n);a=null}return r}static getSpaceWidth(t){return 25.140742199999984*t}static everyCharHasDefaultFontPath(t){let e=t.toString().replace(/\s/g,"").split("");for(let r of e)if(GP.fontPath[r]==null)return!1;return!0}static getSpacing(t){return GP.spacing[t]||10.66}};GP._fontsCache={},GP.fontPath={0:{path:["16.760417913433997 -14.469723706878161 19.808164599999948 -9.89792639999998","19.808164599999948 -9.89792639999998 21.331554999999984 -2.28026319999997","4.571238000000007 -14.469697800000011 9.14176479999995 -15.993266000000007","1.5239237999999846 -9.898459800000007 4.571238000000007 -14.469697800000011","0 -2.27990759999998 1.5239237999999846 -9.898459800000007","0 2.290085800000016 0 -2.27990759999998","0 2.290085800000016 1.5237459999999483 9.908993599999956","1.5237459999999483 9.908993599999956 4.571415799999962 14.480231599999964","4.571415799999962 14.480231599999964 9.14176479999995 16.003622","9.14176479999995 16.003622 12.191212600000002 16.003622","12.191212600000002 16.003622 16.76013919999994 14.480942800000028","16.76013919999994 14.480942800000028 19.80798679999999 9.908637999999964","19.80798679999999 9.908637999999964 21.331554999999984 2.291508199999983","21.331554999999984 2.291508199999983 21.331554999999984 -2.28026319999997","12.190145799999947 -15.993266000000007 16.760417913433997 -14.469723706878161","9.14176479999995 -15.993266000000007 12.190145799999947 -15.993266000000007"]},1:{path:["7.6180188000000015 16.003622 7.6180188000000015 -15.994155000000026","3.0466029999999984 -11.422739199999983 7.6180188000000015 -15.994155000000026","0 -9.89917099999999 3.0466029999999984 -11.422739199999983"]},2:{path:["0 16.003622 21.33137720000003 16.003622","0 16.003622 15.236926600000022 0.7666954000000192","15.236926600000022 0.7666954000000192 18.28388520000001 -3.8036536000000094","18.28388520000001 -3.8036536000000094 19.8076312 -6.851323399999982","19.8076312 -6.851323399999982 19.8076312 -9.898637600000002","18.2844186 -12.945596199999992 19.8076312 -9.898637600000002","16.760494800000014 -14.469519999999976 18.2844186 -12.945596199999992","13.713358400000029 -15.993088200000011 16.760494800000014 -14.469519999999976","7.618379515807792 -15.993088200000011 13.713358400000029 -15.993088200000011","4.571060200000011 -14.469164399999984 7.618379515807792 -15.993088200000011","3.0473142000000224 -12.945418399999996 4.571060200000011 -14.469164399999984","1.523568199999993 -9.898459800000007 3.0473142000000224 -12.945418399999996","1.523568199999993 -8.374891599999975 1.523568199999993 -9.898459800000007"]},3:{path:["0 9.908638000000007 1.523923800000025 12.956485600000015","1.523923800000025 12.956485600000015 3.0473142000000224 14.479876000000013","3.0473142000000224 14.479876000000013 7.618907800000021 16.003622","7.618907800000021 16.003622 12.189790200000036 16.003622","12.189790200000036 16.003622 16.760850400000006 14.479520400000021","16.760850400000006 14.479520400000021 19.80816460000003 11.4322062","19.80816460000003 11.4322062 21.331555000000026 6.861679400000015","21.331555000000026 6.861679400000015 21.331555000000026 3.814365199999992","19.80816460000003 -0.7566949999999775 21.331555000000026 3.814365199999992","18.284596400000037 -2.280263200000011 19.80816460000003 -0.7566949999999775","15.236748800000026 -3.804186999999997 18.284596400000037 -2.280263200000011","10.666044200000007 -3.804186999999997 15.236748800000026 -3.804186999999997","10.666044200000007 -3.804186999999997 19.807986800000034 -15.993621599999996","3.0478476000000096 -15.993621599999996 19.80798680000003 -15.993621599999996"]},4:{path:["0 5.338466800000013 22.855301000000015 5.338466800000013","0 5.338466800000013 15.236926600000022 -15.99291039999997","15.236926600000022 16.003622 15.236926600000022 -15.99291039999997"]},5:{path:["0 9.90934920000003 1.5239237999999846 12.956485600000015","1.5239237999999846 12.956485600000015 3.0476698000000138 14.480231600000003","3.0476698000000138 14.480231600000003 7.618729999999984 16.003622","7.618729999999984 16.003622 12.189434600000004 16.003622","12.189434600000004 16.003622 16.760494800000014 14.479520400000021","16.760494800000014 14.479520400000021 19.8076312 11.432384000000035","19.8076312 11.432384000000035 21.331199399999996 6.860968200000031","21.331199399999996 6.860968200000031 21.331199399999996 3.813831800000006","19.807453400000004 -0.7570505999999693 21.331199399999996 3.813831800000006","16.760494800000014 -3.804009200000001 19.807453400000004 -0.7570505999999693","12.189434600000004 -5.32775519999999 16.760494800000014 -3.804009200000001","7.618196599999997 -5.32775519999999 12.189434600000004 -5.32775519999999","3.047136399999986 -3.804364799999993 7.618196599999997 -5.32775519999999","1.5237459999999887 -2.2809743999999945 3.047136399999986 -3.804364799999993","1.5237459999999887 -2.2809743999999945 3.0473142000000224 -15.993621599999996","3.0473142000000224 -15.993621599999996 18.284596399999995 -15.993621599999996"]},6:{path:["0 5.337577800000035 1.523568199999993 0.767051000000011","1.523568199999993 0.767051000000011 4.5710602000000105 -2.280440999999966","4.5710602000000105 -2.280440999999966 9.14176479999999 -3.804186999999997","9.14176479999999 -3.804186999999997 10.665155199999987 -3.804186999999997","10.665155199999987 -3.804186999999997 15.236748799999985 -2.280440999999966","15.236748799999985 -2.280440999999966 18.283885200000014 0.7666954000000192","18.283885200000014 0.7666954000000192 19.807631200000003 5.338644600000009","19.807631200000003 6.861679400000015 19.807631200000003 5.338644600000009","18.284240800000006 11.432384000000035 19.807631200000003 6.861679400000015","15.236748799999985 14.479876000000013 18.284240800000006 11.432384000000035","10.665155199999987 16.003622 15.236748799999985 14.479876000000013","9.142120399999982 16.003622 10.665155199999987 16.003622","4.570882400000015 14.48005380000001 9.142120399999982 16.003622","1.523568199999993 11.432739600000026 4.570882400000015 14.48005380000001","0 5.337577800000035 1.523568199999993 11.432739600000026","0 5.337577800000035 0 -2.281328388894039","0 -2.281328388894039 1.523568199999993 -9.898815399999998","1.523568199999993 -9.898815399999998 4.570882400000015 -14.469875599999968","4.570882400000015 -14.469875599999968 9.141942599999986 -15.993621599999996","9.141942599999986 -15.993621599999996 12.18872339999998 -15.993621599999996","12.18872339999998 -15.993621599999996 16.760317000000022 -14.469875599999968","16.760317000000022 -14.469875599999968 18.28406300000001 -11.422561399999987"]},7:{path:["6.0948062 16.003622 21.331199399999996 -15.993265999999965","0 -15.993265999999965 21.331199399999996 -15.993265999999965"]},8:{path:["13.71371400000002 -15.993621599999996 18.283885200000014 -14.47058679999999","18.283885200000014 -14.47058679999999 19.807453400000007 -11.422917000000018","19.807453400000007 -8.375247200000006 19.807453400000007 -11.422917000000018","18.28406300000001 -5.328110800000021 19.807453400000007 -8.375247200000006","15.235504200000015 -3.8038314000000053 18.28406300000001 -5.328110800000021","9.142653800000009 -2.2807965999999986 15.235504200000015 -3.8038314000000053","4.570526799999984 -0.7563393999999857 9.142653800000009 -2.2807965999999986","1.523568199999993 2.2906192000000036 4.570526799999984 -0.7563393999999857","0 5.338289000000017 1.523568199999993 2.2906192000000036","0 9.909169724787748 0 5.338289000000017","0 9.909169724787748 1.5237459999999887 12.956129999999984","1.5237459999999887 12.956129999999984 3.047492000000018 14.479876000000013","3.047492000000018 14.479876000000013 7.618552199999989 16.003622","7.618552199999989 16.003622 13.712113800000017 16.003622","13.712113800000017 16.003622 18.284240800000006 14.479876000000013","18.284240800000006 14.479876000000013 19.80727560000001 12.95666340000001","19.80727560000001 12.95666340000001 21.330843800000004 9.908282400000015","21.330843800000004 9.908282400000015 21.330843800000004 5.337222200000003","19.807631200000003 2.289907999999981 21.330843800000004 5.337222200000003","16.760494800000018 -0.757228400000006 19.807631200000003 2.289907999999981","12.19001988606628 -2.280427430203538 16.760494800000018 -0.757228400000006","6.0948062 -3.804186999999997 12.190019886066274 -2.28042743020354","3.047492000000018 -5.32775519999999 6.0948062 -3.804186999999997","1.5233903999999971 -8.375425000000002 3.047492000000018 -5.32775519999999","1.5233903999999971 -8.375425000000002 1.5233903999999971 -11.422384405459395","1.5233903999999971 -11.422384405459395 3.047136399999986 -14.470053400000003","3.047136399999986 -14.470053400000003 7.618552199999989 -15.993621599999996","7.618552199999989 -15.993621599999996 13.71371400000002 -15.993621599999996"]},9:{path:["4.5710601999999705 -14.475209600000005 9.141942599999986 -15.998777799999997","1.5237459999999887 -11.42789540000002 4.5710601999999705 -14.475209600000005","0 -6.856301800000027 1.5237459999999887 -11.42789540000002","0 -5.3338004000000065 0 -6.856301800000027","0 -5.3338004000000065 1.5242793999999762 -0.7618512000000184","1.5242793999999762 -0.7618512000000184 4.571415800000002 2.2852852000000095","4.571415800000002 2.2852852000000095 9.1430094 3.808853400000002","9.1430094 3.808853400000002 10.667099802593173 3.808853400000002","10.667099802593174 3.808853400000002 15.23692659999998 2.2851073999999727","15.23692659999998 2.2851073999999727 18.2844186 -0.7623846000000043","18.2844186 -0.7623846000000043 19.807555292421778 -5.33392792193264","1.523568199999993 11.427761199999983 3.0474919999999774 14.474719800000013","3.0474919999999774 14.474719800000013 7.61890779999998 15.998288000000006","7.61890779999998 15.998288000000006 10.665685499558217 15.998288000000006","10.665685499558217 15.998288000000006 15.237104399999977 14.474186399999986","15.237104399999977 14.474186399999986 18.284240800000003 9.902948399999978","18.284240800000003 9.902948399999978 19.807808999999995 2.2851073999999727","19.807808999999995 2.2851073999999727 19.807808999999995 -5.332912973451355","18.284240800000003 -11.42789540000002 19.807808999999995 -5.332912973451359","15.23746000000001 -14.474498400000021 18.284240800000003 -11.42789540000002","10.665688599999974 -15.998777799999997 15.23746000000001 -14.474498400000021","9.141942599999986 -15.998777799999997 10.665688599999974 -15.998777799999997"]},"!":{path:["0 14.48005380000001 1.523568199999993 12.956485599999935","0 14.48005380000001 1.523568199999993 16.003622","1.523568199999993 16.003622 3.047136399999986 14.480053800000007","1.523568199999993 12.956485599999935 3.047136399999986 14.480053800000007","1.523568199999993 5.3384667999999325 1.523568199999993 -15.993443800000042"]},'"':{path:["10.056368000000031 -6.846733599999993 11.579402799999997 -8.369412799999965","11.579402799999997 -8.369412799999965 13.103504400000018 -11.417260399999975","13.103504400000018 -11.417260399999975 13.103504400000018 -14.465107999999985","11.579936200000024 -15.98867619999998 13.103504400000018 -14.465107999999985","10.05601240000004 -14.464752399999993 11.579936200000024 -15.98867619999998","10.05601240000004 -14.464752399999993 11.579758399999989 -12.941006400000004","0 -14.464574599999997 1.5233903999999971 -12.941361999999994","0 -14.464574599999997 1.523568199999993 -15.988142799999991","1.523568199999993 -15.988142799999991 3.0473142000000224 -14.46439679999996","3.0473142000000224 -11.417261642053806 3.0473142000000224 -14.46439679999996","1.5228573106943262 -8.369235310694286 3.0473142000000224 -11.417261642053806","0 -6.846378000000001 1.5228573106943262 -8.369235310694286"]},"#":{path:["0 9.894749000000024 21.330843800000004 9.894749000000024","1.5244572000000125 0.7528064000000398 22.854767600000066 0.7528064000000398","10.665333000000023 26.654888200000048 21.33013260000002 -16.006977199999987","1.5221458000000265 26.658622 12.197613400000012 -15.991330799999957"]},$:{path:["7.618374399999992 22.103622 7.618374399999992 -22.083233999999997","13.713180599999992 22.10308859999997 13.713180599999992 -22.084834200000003","18.284240800000003 2.2958130000000025 21.331377199999988 5.3429493999999895","15.235682000000011 0.7713557999999914 18.284240800000003 2.2958130000000025","6.093383799999993 -2.276314000000024 15.235682000000011 0.7713557999999914","3.0476698000000138 -3.7989931999999946 6.093383799999993 -2.276314000000024","1.5237459999999887 -5.323094800000014 3.0476698000000138 -3.7989931999999946","0 -8.370053400000003 1.5237459999999887 -5.323094800000014","1.523568199999993 11.437577799999993 3.047314200000021 9.913831800000006","1.5237459999999887 8.390263599999972 3.047314200000021 9.913831800000006","0 9.9140096 1.5237459999999887 8.390263599999972","0 11.437399999999998 0 9.9140096","0 11.437399999999998 3.047492000000018 14.484891999999975","3.047492000000018 14.484891999999975 7.618196599999998 16.00846019999997","7.618196599999998 16.00846019999997 13.713350447746311 16.00846019999997","13.713350447746313 16.00846019999997 18.284240800000003 14.484180799999992","18.284240800000003 14.484180799999992 21.331377199999988 11.437044400000007","21.331377199999988 11.437044400000007 21.331377199999988 5.3429493999999895","19.807808999999995 2.2956351999999676 21.331377199999988 5.3429493999999895","18.284596399999995 0.772066999999975 19.807808999999995 2.2956351999999676","15.237282200000013 -0.7518568000000094 18.284596399999995 0.772066999999975","6.095161799999992 -3.799171000000033 15.237282200000013 -0.7518568000000094","3.047136399999986 -5.322917000000018 6.095161799999992 -3.799171000000033","0 -8.370053400000003 3.047136399999986 -5.322917000000018","0 -8.370053400000003 0 -11.41772320000002","0 -11.41772320000002 3.047136399999986 -14.464859600000006","3.047136399999986 -14.464859600000006 7.6180188000000015 -15.988783400000033","7.6180188000000015 -15.988783400000033 13.713001559534877 -15.988783400000033","13.713001559534884 -15.988783400000033 18.28388520000001 -14.465037400000002","18.28388520000001 -14.465037400000002 21.331199399999996 -11.41772320000002","21.331199399999996 -9.89397720000003 21.331199399999996 -11.41772320000002","19.807808999999995 -8.370586799999991 21.331199399999996 -9.89397720000003","18.284240800000003 -9.894155000000026 19.807808999999995 -8.370586799999991","18.284240800000003 -9.894155000000026 19.807808999999995 -11.41772320000002"]},"%":{path:["18.2844186 6.8656126000000395 21.327998999999988 5.34275560000003","16.76031699999998 9.913993600000037 18.2844186 6.8656126000000395","16.76031699999998 9.913993600000037 16.76031699999998 9.913993600000037","16.76031699999998 12.959174200000028 16.76031699999998 9.913993600000037","16.76031699999998 12.959174200000028 19.80976479999995 16.008622","19.80976479999995 16.008622 22.854767599999988 16.008622","22.854767599999988 16.008622 25.902970800000027 14.484520400000061","25.902970800000027 14.484520400000061 27.42618340000003 11.437028400000003","27.42618340000003 11.437028400000003 27.42618340000003 8.390069800000052","24.378869200000008 5.34275560000003 27.42618340000003 8.390069800000052","21.327998999999988 5.34275560000003 24.378869200000008 5.34275560000003","7.618552200000029 -15.988621599999997 10.665688600000015 -12.94148519999993","10.665688600000015 -9.893104199999938 10.665688600000015 -12.94148519999993","9.142298199999978 -6.8466789999999325 10.665688600000015 -9.893104199999938","6.094450600000008 -5.322755199999948 9.142298199999978 -6.8466789999999325","0 -8.370069399999972 3.0476698000000138 -5.322755199999948","3.0476698000000138 -5.322755199999948 6.094450600000008 -5.322755199999948","6.094450600000008 -5.322755199999948 6.094450600000008 -5.322755199999948","0 -8.370069399999972 0 -11.414534477606418","0 -11.414534477606418 1.5226791999999736 -14.464519999999977","1.5226791999999736 -14.464519999999977 4.571415799999962 -15.988621599999997","0.0012446000000109962 16.006666200000005 27.42618340000003 -15.988443799999962","24.379046999999964 -14.465053400000004 27.426183400000024 -15.988443799999962","19.8076312 -12.94148519999993 24.379046999999964 -14.465053400000004","15.236215399999958 -12.94148519999993 19.8076312 -12.94148519999993","10.665333000000023 -14.46523119999996 15.236215399999958 -12.94148519999993","7.618552200000029 -15.988621599999997 10.665333000000023 -14.46523119999996","4.571415799999962 -15.988621599999997 7.618552200000029 -15.988621599999997"]},"&":{path:["21.331732800000022 14.484875999999971 25.90243740000001 16.008622000000006","18.2844186 11.437917400000021 21.331732800000022 14.484875999999971","7.618196600000037 -3.799720399999986 18.2844186 11.437917400000021","6.094628400000045 -8.370247199999993 7.618196600000037 -3.799720399999986","28.950640600000042 14.48452039999998 28.950640600000042 12.960596599999995","27.426539000000023 16.008622 28.950640600000042 14.48452039999998","25.9024374 16.008622 27.426539000000023 16.008622","22.85334520000002 14.48327579999997 25.9024374 16.008622","19.811365000000034 11.442540199999993 22.85334520000002 14.48327579999997","7.618552200000029 -5.323110800000022 19.811365000000034 11.442540199999993","6.094628400000045 -8.370247200000007 7.618552200000029 -5.323110800000022","6.094628400000045 -8.370247200000007 6.094628400000045 -11.417917000000019","6.094628400000045 -11.417917000000019 7.617485399999973 -14.464697800000012","7.617485399999973 -14.464697800000012 10.665688600000015 -15.988799400000035","3.0473142000000224 14.484698200000016 6.0948062 16.00826640000001","1.5237460000000291 11.437739599999984 3.0473142000000224 14.484698200000016","1.5237460000000291 11.437739599999984 1.5237460000000291 6.866145999999986","1.5237460000000291 6.866145999999986 3.046069600000011 3.8204319999999665","3.046069600000011 3.8204319999999665 6.094095000000016 0.772406599999961","25.901370600000025 -2.275441000000008 27.425472200000048 -3.799542600000029","25.901370600000025 -2.275441000000008 27.42565 -0.7511616000000316","27.42565 -0.7511616000000316 28.949751600000024 -2.275263199999971","28.949751600000024 -2.275263199999971 28.949751600000024 -3.799364799999994","27.426005599999993 -5.323110800000022 28.949751600000024 -3.799364799999994","25.90368200000001 -5.323110800000022 27.426005599999993 -5.323110800000022","24.378158000000024 -3.797586800000035 25.90368200000001 -5.323110800000022","22.85156719999998 -0.7410269999999883 24.378158000000024 -3.797586800000035","19.807453400000046 6.866323800000022 22.85156719999998 -0.7410269999999883","16.760494800000014 11.437206200000038 19.807453400000046 6.866323800000022","13.713358400000029 14.48452039999998 16.760494800000014 11.437206200000038","10.665510799999979 16.00826640000001 13.713358400000029 14.48452039999998","6.0948062 16.00826640000001 10.665510799999979 16.00826640000001","1.523568199999993 14.484164799999988 6.0948062 16.00826640000001","0 11.437383999999994 1.523568199999993 14.484164799999988","0 11.437383999999994 0 6.866323800000022","0 6.866323800000022 1.5257018000000233 3.817587200000034","1.5257018000000233 3.817587200000034 6.094094999997853 0.7724066000014034","6.094095000000016 0.772406599999961 10.668533400000028 -2.278463599999977","10.668533400000028 -2.278463599999977 13.713002800000037 -5.32275520000003","13.713002800000037 -5.32275520000003 15.236748799999985 -8.370247200000007","15.236748799999985 -8.370247200000007 15.236748799999985 -11.417383599999992","13.713180599999992 -14.464875599999969 15.236748799999985 -11.417383599999992","10.665688600000015 -15.988799400000035 13.713180599999992 -14.464875599999969"]},"'":{path:["0 -6.846378000000001 1.5239237999999846 -8.370301800000025","1.5239237999999846 -8.370301800000025 3.0473142000000224 -11.417616000000006","3.0473142000000224 -11.417616000000006 3.0473142000000224 -14.46493020000003","1.5237460000000291 -15.988498400000022 3.0473142000000224 -14.46493020000003","2.7522019189376156e-16 -14.464752400000034 1.5237460000000291 -15.988498400000022","1.375940368856182e-16 -14.464752400000034 1.5233904000000376 -12.941006400000004"]},"`":{path:["1.5315692000000058 -9.903336600000028 3.054959599999963 -8.37994619999999","1.5313913999999698 -6.856377999999999 3.054959599999963 -8.379946199999992","0.007645400000021346 -8.380124000000027 1.5313913999999698 -6.856377999999999","0.007645400000021346 -8.380124000000027 0.007645400000021346 -11.427259512341902","0.007645400000021346 -11.427259512341903 1.5313913999999698 -14.474574600000036","1.5313913999999698 -14.474574600000036 3.055315199999954 -15.998854000000012"]},"(":{path:["4.570704599999979 -12.95075140000002 7.618196599999997 -19.046091000000008","3.047136399999986 -8.379691200000007 4.570704599999979 -12.95075140000002","1.5237459999999887 -0.7625613999999867 3.047136399999986 -8.379691200000007","1.5237459999999887 5.332600400000002 1.5237459999999887 -0.7625613999999867","1.5237459999999887 5.332600400000002 3.047136399999986 12.949907999999981","3.047136399999986 12.949907999999981 4.571237999999966 17.52185720000001","4.571237999999966 17.52185720000001 7.618196599999997 23.616129999999984","7.618196599999997 23.616129999999984 10.665688599999974 26.663622","4.570882399999975 19.04524760000001 7.618196599999996 23.616129999999984","1.5237459999999887 12.951508199999983 4.570882399999975 19.04524760000001","0 5.3320670000000145 1.5237459999999887 12.951508199999983","0 5.3320670000000145 0 -0.7614946000000113","0 -0.7614946000000113 1.523568199999993 -8.380580199999986","1.523568199999993 -8.380580199999986 4.571237999999966 -14.475386399999987","4.571237999999966 -14.475386399999987 7.618196599999999 -19.046091000000008","7.618196600000005 -19.046091000000022 10.665688599999974 -22.093760800000023"]},")":{path:["3.0480254000000055 -19.04591320000001 6.0948062 -12.951284800000007","6.0948062 -12.951284800000007 7.618907800000021 -8.377735400000017","7.618907800000021 -8.377735400000017 9.141942600000027 -0.7623835999999908","9.141942600000027 5.332778199999998 9.141942600000027 -0.7623835999999908","7.617841000000006 12.952397200000002 9.141942600000027 5.332778199999998","6.094628400000004 17.522035000000006 7.617841000000006 12.952397200000002","3.0471364207661926 23.61666333772206 6.094628400000004 17.522035000000006","0.0001777999999957956 26.663622 3.0474919792399064 23.616130010386698","3.047491979239907 23.616130010386698 6.0948062 19.04524760000001","6.0948062 19.04524760000001 9.142120400000023 12.950263599999973","9.142120400000023 12.950263599999973 10.665688600000015 5.332422600000006","10.665688600000015 5.332422600000006 10.665688600000015 -0.7623835999999908","9.141942600000027 -8.380935800000021 10.665688600000015 -0.7623835999999908","6.094984000000036 -14.474675200000004 9.141942600000027 -8.380935800000021","3.0480254000000055 -19.04591320000001 6.094984000000036 -14.474675200000004","0 -22.093760800000023 3.0480254000000055 -19.04591320000001"]},"*":{path:["0 -2.2853046000000203 15.247950200000004 -11.437559600000005","0.0037338000000329886 -11.430447600000011 15.241904999999985 -2.2869048000000225","7.622285999999981 2.2836220000000007 7.622285999999981 -15.999196399999997"]},"+":{path:["0 2.2954414000000067 27.425116600000056 2.2954414000000067","13.711758200000027 16.008622 13.711758200000027 -11.418628200000002"]},",":{path:["0 22.088622 1.5239238000000654 20.564164799999986","1.5239238000000654 20.564164799999986 3.047136400000067 17.51756180000003","3.047136400000067 17.51756180000003 3.047136400000067 14.4706032","0 14.4706032 1.5235682000000739 12.947035000000007","0 14.4706032 1.5235682000000745 15.994171399999992","1.523568200000074 15.994171399999992 3.047136400000067 14.4706032","1.5235682000000739 12.947035000000007 3.047136400000067 14.4706032"]},"-":{path:["0 2.284622 27.439162800000005 2.284622"]},".":{path:["0 14.479698199999977 1.523923800000025 12.955952199999988","0 14.479698199999977 1.523923800000025 16.003622","1.523923800000025 16.003622 3.0478476000000096 14.479698199999977","1.523923800000025 12.955952199999988 3.0478476000000096 14.479698199999977"]},"/":{path:["0 20.563622 21.3310216 -16.00379279999999"]},":":{path:["0 14.479698199999977 1.523923800000025 12.956129999999984","0 14.479698199999977 1.523923800000025 16.003622","1.523923800000025 16.003622 3.0476698000000138 14.479875999999972","1.523923800000025 12.956129999999984 3.0476698000000138 14.479875999999972","0.0001777999999957956 -3.804186999999997 1.523923800000025 -5.327933000000025","0.0001777999999957956 -3.804186999999997 1.523923800000025 -2.280441000000007","1.523923800000025 -2.280441000000007 3.0476698000000138 -3.804186999999997","1.523923800000025 -5.327933000000025 3.0476698000000138 -3.804186999999997"]},";":{path:["0.0005333999999873868 22.103622 1.5241015999999803 20.580053799999966","1.5241015999999803 20.580053799999966 3.0474919999999774 17.533095199999977","3.0474919999999774 17.533095199999977 3.0474919999999774 14.485425399999963","1.5239237999999846 12.961857199999969 3.0474919999999774 14.485425399999963","2.75188085013597e-16 14.485780999999996 1.5239237999999846 12.961857199999969","1.3759404250680035e-16 14.485780999999996 1.5237459999999887 16.009526999999984","1.5237459999999887 16.009526999999984 3.0474919999999774 14.485425399999963","0.00017779999999814104 -3.7982820000000146 1.5239237999999846 -5.3220279999999995","0.0001777999999981411 -3.7982820000000146 1.5239237999999846 -2.2745360000000225","1.5239237999999846 -2.2745360000000225 3.0476697999999733 -3.7982820000000146","1.5239237999999846 -5.3220279999999995 3.0476697999999733 -3.7982820000000146"]},"<":{path:["0 2.2906192000000036 24.379047000000003 16.003622","0 2.2906192000000036 24.378869200000008 -11.422383599999991"]},"=":{path:["0 6.858622 27.426716799999976 6.858622","0.0005334000000278139 -2.2831427999999505 27.42689460000001 -2.2831427999999505"]},">":{path:["0 16.003622 24.378513600000016 2.2907969999999995","0 -11.422028 24.378513600000016 2.2907969999999995"]},"?":{path:["7.618196599999997 14.479698200000017 9.142120399999982 12.956130000000023","7.618196599999997 14.479698200000017 9.142120399999982 16.003622","9.142120399999982 16.003622 10.66586639999997 14.479876000000013","9.142120399999982 12.956130000000023 10.66586639999997 14.479876000000013","9.141942599999986 5.337755600000031 9.141942599999986 0.7667835621225088","9.141942599999986 0.7667835621225088 15.23692659999998 -2.2811521999999904","15.23692659999998 -2.2811521999999904 16.760850400000006 -3.8050759999999766","16.760850400000006 -3.8050759999999766 18.284063000000007 -6.85185679999997","18.284063000000007 -6.85185679999997 18.284063000000007 -9.898815399999998","16.760494799999975 -12.946307399999975 18.284063000000007 -9.898815399999998","15.23692659999998 -14.469875599999968 16.760494799999975 -12.946307399999975","12.1896124 -15.993621599999996 15.23692659999998 -14.469875599999968","6.094628400000004 -15.993621599999996 12.1896124 -15.993621599999996","3.047136399999986 -14.469875599999968 6.094628400000004 -15.993621599999996","1.5233903999999971 -12.94612959999998 3.047136399999986 -14.469875599999968","0 -9.898815399999998 1.5233903999999971 -12.94612959999998","0 -8.375247200000006 0 -9.898815399999998"]},"@":{path:["25.902259599999965 12.951307799999979 27.426005599999993 11.427739599999985","22.854234199999958 14.475231599999963 25.902259599999965 12.951307799999979","18.284596399999955 15.998622000000001 22.854234199999958 14.475231599999963","13.713002799999957 15.998622000000001 18.284596399999955 15.998622000000001","9.142120399999941 14.474698200000017 13.713002799999957 15.998622000000001","6.0948062 12.951485600000014 9.142120399999941 14.474698200000017","3.0476698000000138 9.904171399999992 6.0948062 12.951485600000014","1.5239237999999846 6.857035000000006 3.0476698000000138 9.904171399999992","0 2.285619199999962 1.5239237999999846 6.857035000000006","0 2.285619199999962 0 -2.284729800000024","0 -2.284729800000024 1.5233903999999567 -6.856145599999987","1.5233903999999567 -6.856145599999987 3.0476698000000138 -9.904170999999991","3.0476698000000138 -9.904170999999991 6.0948062 -12.951307400000058","6.0948062 -12.951307400000058 9.143009399999961 -14.475053400000004","9.143009399999961 -14.475053400000004 13.713180599999992 -15.998443800000043","9.142120399999941 6.856501599999978 12.189434599999966 8.380425399999964","7.618552199999948 3.8090095999999996 9.142120399999941 6.856501599999978","7.618552199999948 3.8090095999999996 7.618552199999948 -0.7624062000000418","7.618552199999948 -0.7624062000000418 9.142298199999978 -5.33275520000003","9.142298199999978 -5.33275520000003 10.666221999999962 -6.856679000000014","10.666221999999962 -6.856679000000014 13.713358399999947 -8.380069400000053","21.331554999999984 -6.856501200000061 22.855301000000015 -3.80865360000001","18.284063000000007 -8.380069400000053 21.331554999999984 -6.856501200000061","13.713358399999947 -8.380069400000053 18.284063000000007 -8.380069400000053","10.665688599999934 -5.33275520000003 13.713358399999947 -8.380069400000053","9.142120399999941 -0.7611616000000314 10.665688599999934 -5.33275520000003","9.142120399999941 3.8086540000000095 9.142120399999941 -0.7611616000000314","9.142120399999941 3.8086540000000095 10.66586639999997 6.856857199999969","10.66586639999997 6.856857199999969 12.189434599999963 8.380425399999964","12.189434599999963 8.380425399999964 16.76031699999998 8.380425399999964","16.76031699999998 8.380425399999964 19.807453399999964 6.857390599999998","19.807453399999964 6.857390599999998 21.33137719999995 3.809542999999948","21.33137719999995 3.809542999999948 22.85494539999994 -8.379358199999988","21.33137719999995 6.856501599999978 21.33137719999995 3.809542999999948","21.33137719999995 6.856501599999978 24.378691399999973 8.380247600000008","22.85512319999998 3.809720799999983 24.378869200000008 -8.380780600000037","22.85512319999998 6.856679400000014 22.85512319999998 3.809720799999983","22.85512319999998 6.856679400000014 24.378691399999973 8.380247600000008","24.378691399999973 8.380247600000008 27.42618339999995 8.380247600000008","27.42618339999995 8.380247600000008 30.47278639999999 5.334177999999996","30.47278639999999 5.334177999999996 31.997065799999966 0.7624065999999612","31.997065799999966 0.7624065999999612 31.997065799999966 -2.2852632000000526","30.47385319999996 -6.856145599999987 31.997065799999966 -2.2852632000000526","28.949751599999942 -9.9038154 30.47385319999996 -6.856145599999987","25.902615199999957 -12.95112960000002 28.949751599999942 -9.9038154","22.853522999999974 -14.475231200000042 25.902615199999957 -12.95112960000002","18.284596399999955 -15.998443800000043 22.853522999999974 -14.475231200000042","13.713180599999992 -15.998443800000043 18.284596399999955 -15.998443800000043"]},A:{path:["4.571415799999962 5.332577799999993 19.8076312 5.332577799999993","12.189434599999963 -15.99879939999995 24.379046999999964 15.998622000000001","0 15.99826640000001 12.189434599999963 -15.998799399999953"]},B:{path:["0 15.997266000000003 13.714425200000003 15.997266000000003","13.714425200000003 15.997266000000003 18.284596400000034 14.473342199999937","18.284596400000034 14.473342199999937 19.80798679999999 12.949951799999981","19.80798679999999 12.949951799999981 21.331555000000066 9.902459800000004","21.331555000000066 9.902459800000004 21.331555000000066 5.331577399999988","19.80816460000003 2.284618799999958 21.331555000000066 5.331577399999988","18.284952000000025 0.7608727999999285 19.80816460000003 2.284618799999958","13.713536200000064 -0.7630510000000559 18.284952000000025 0.7608727999999285","0 -0.7630510000000559 13.713536200000064 -0.7630510000000559","13.713536200000064 -0.7630510000000559 18.284952000000025 -2.2869748000000403","18.284952000000025 -2.2869748000000403 19.807453400000046 -3.8094762000000593","19.807453400000046 -3.8094762000000593 21.33226620000005 -6.857501600000063","21.33226620000005 -6.857501600000063 21.33226620000005 -9.90499360000004","19.8076312 -12.952663400000052 21.33226620000005 -9.90499360000004","18.284063000000007 -14.476231600000048 19.8076312 -12.952663400000052","13.713180599999992 -16.000155400000033 18.284063000000007 -14.476231600000048","0 -16.000155400000033 13.713180599999992 -16.000155400000033","0 15.997266000000003 0 -16.000155400000033"]},C:{path:["21.331199399999996 11.427739599999985 22.855123200000058 8.380425400000044","18.283707400000015 14.475231600000043 21.331199399999996 11.427739599999985","15.237104400000058 15.998622000000001 18.283707400000015 14.475231600000043","9.141942599999986 15.998622000000001 15.237104400000058 15.998622000000001","6.095161799999992 14.475231600000043 9.141942599999986 15.998622000000001","3.0473142000000224 11.42756180000003 6.095161799999992 14.475231600000043","1.5237460000000291 8.3806032 3.0473142000000224 11.42756180000003","0 3.8093651999999913 1.5237460000000291 8.3806032","0 3.8093651999999913 0 -3.8084757999999717","0 -3.8084757999999717 1.5237460000000291 -8.380424999999963","1.5237460000000291 -8.380424999999963 3.0474920000000583 -11.427561399999945","3.0474920000000583 -11.427561399999945 6.094628400000045 -14.474697800000012","6.094628400000045 -14.474697800000012 9.142298200000058 -15.998621599999996","9.142298200000058 -15.998621599999996 15.236926600000022 -15.998621599999996","15.236926600000022 -15.998621599999996 18.284240800000045 -14.474697800000012","18.284240800000045 -14.474697800000012 21.331732800000022 -11.426850199999965","21.331732800000022 -11.426850199999965 22.854945400000023 -8.379891600000015"]},D:{path:["0 15.998622000000001 0 -15.998621600000003","0 15.998622000000001 10.66551080000006 15.998622000000001","10.66551080000006 15.998622000000001 15.236393199999995 14.474164799999988","15.236393199999995 14.474164799999988 18.285129800000064 11.425428199999999","18.285129800000064 11.425428199999999 19.807631200000003 8.380425399999964","19.807631200000003 8.380425399999964 21.331199399999996 3.8086540000000095","21.331199399999996 3.8086540000000095 21.331199399999996 -3.8100760000000555","19.809231400000005 -8.377580200000029 21.331199399999996 -3.8100760000000555","18.283885200000054 -11.428094800000054 19.809231400000005 -8.377580200000029","15.237104400000058 -14.47487560000005 18.283885200000054 -11.428094800000054","10.666044200000007 -15.998621599999996 15.237104400000058 -14.47487560000005","0 -15.998621599999996 10.666044200000007 -15.998621599999996"]},E:{path:["0 -0.7568728000000142 12.189434599999963 -0.7568728000000142","0 16.003622 19.808875800000013 16.003622","0 16.003622 0 -15.993443800000042","0 -15.993443800000042 19.80798679999999 -15.993443800000042"]},F:{path:["0 -0.757228400000006 12.188723399999981 -0.757228400000006","0 16.003622 0 -15.993799399999952","0 -15.993799399999952 19.807631200000003 -15.993799399999952"]},G:{path:["15.236748799999985 3.814365199999992 22.85512319999998 3.814365199999992","22.85512319999998 8.3856032 22.85512319999998 3.814365199999992","21.331554999999984 11.433095200000059 22.85512319999998 8.3856032","18.28477419999999 14.479876000000052 21.331554999999984 11.433095200000059","15.236748799999985 16.003622 18.28477419999999 14.479876000000052","6.094628400000004 14.48005380000001 9.142476000000014 16.003622","9.142476000000014 16.003622 15.236748799999985 16.003622","3.046425200000003 11.431139400000065 6.094628400000004 14.48005380000001","1.523568199999993 8.385425400000045 3.046425200000003 11.431139400000065","0 3.8148986000000207 1.523568199999993 8.385425400000045","0 3.8148986000000207 0 -3.804009200000001","0 -3.804009200000001 1.5237459999999887 -8.375247200000006","1.5237459999999887 -8.375247200000006 3.048380999999997 -11.423450399999966","3.048380999999997 -11.423450399999966 6.095161799999992 -14.469875599999968","6.095161799999992 -14.469875599999968 9.142298199999978 -15.99344379999996","9.142298199999978 -15.99344379999996 15.236215399999999 -15.99344379999996","15.236215399999999 -15.99344379999996 18.283707399999976 -14.470053400000003","18.283707399999976 -14.470053400000003 21.3310216 -11.423272599999928","21.3310216 -11.423272599999928 22.85512319999998 -8.375424999999963"]},H:{path:["0 -0.7568727999999325 21.33137720000003 -0.7568727999999325","21.33137720000003 16.003622 21.33137720000003 -15.992554799999942","0 16.003622 0 -15.993088199999969"]},I:{path:["0 16.003622 0 -15.994155000000026"]},J:{path:["0 8.385069799999972 0 5.338111200000022","0 8.385069799999972 1.5244572000000125 12.957018999999962","1.5244572000000125 12.957018999999962 3.0478475999999692 14.480231599999964","3.0478475999999692 14.480231599999964 6.095339599999947 16.003622","6.095339599999947 16.003622 9.142298199999978 16.003622","9.142298199999978 16.003622 12.190501400000018 14.478986999999952","12.190501400000018 14.478986999999952 13.713002799999957 12.95630779999998","13.713002799999957 12.95630779999998 15.236748799999985 8.385425399999964","15.236748799999985 8.385425399999964 15.236748799999985 -15.992732599999977"]},K:{path:["7.618557644362181 -2.2804337407328195 21.33137720000003 16.003622","0 5.337933399999986 21.331554999999984 -15.993088199999969","0 16.003266400000008 0 -15.99344379999996"]},L:{path:["0 16.003622 18.284240800000045 16.003622","0 16.003622 0 -15.993977199999987"]},M:{path:["12.189468441542692 15.983464102892793 24.378869200000008 -16.013535200000014","24.378869200000008 15.983530600000032 24.378869200000008 -16.013535200000014","0 -16.013001799999984 12.189468441542692 15.983464102892798","0 15.983886200000024 0 -16.013001799999984"]},N:{path:["21.331732800000022 15.953749238347944 21.331732800000022 -16.04393899999998","0 -16.04376120000002 21.331732800000022 15.953749238347942","0 15.95277119999999 0 -16.04376120000002"]},O:{path:["6.094095000000016 -14.469164399999984 9.142831600000004 -15.993621599999996","3.0469586000000306 -11.422028 6.094095000000016 -14.469164399999984","1.5237460000000291 -8.375602799999998 3.0469586000000306 -11.422028","0 -3.8038314000000053 1.5237460000000291 -8.375602799999998","0 3.814720799999984 0 -3.8038314000000053","0 3.814720799999984 1.5232126000000015 8.384536399999984","1.5232126000000015 8.384536399999984 3.0480254000000055 11.433273000000014","3.0480254000000055 11.433273000000014 6.094450600000008 14.479876000000013","6.094450600000008 14.479876000000013 9.142476000000014 16.003622","9.142476000000014 16.003622 15.23657100000003 16.003622","15.23657100000003 16.003622 18.284240800000003 14.479698200000017","18.284240800000003 14.479698200000017 21.331555000000026 11.432561799999991","21.331555000000026 11.432561799999991 22.855301000000015 8.384892000000017","22.855301000000015 8.384892000000017 24.378869200000008 3.8150764000000166","24.378869200000008 3.8150764000000166 24.378869200000008 -3.804186999999997","22.854767600000027 -8.375780599999993 24.378869200000008 -3.804186999999997","21.331732800000022 -11.422561399999987 22.854767600000027 -8.375780599999993","18.284774200000033 -14.469520000000015 21.331732800000022 -11.422561399999987","15.236926600000022 -15.993621599999996 18.284774200000033 -14.469520000000015","9.142831600000004 -15.993621599999996 15.236926600000022 -15.993621599999996"]},P:{path:["0 0.7665176000000233 13.712647200000005 0.7665176000000233","13.712647200000005 0.7665176000000233 18.284240800000003 -0.7570506000000101","18.284240800000003 -0.7570506000000101 19.80798680000003 -2.2813299999999863","19.80798680000003 -2.2813299999999863 21.331377200000027 -5.328466400000012","21.331377200000027 -5.328466400000012 21.331377200000027 -9.89917099999999","19.808520200000018 -12.945773999999988 21.331377200000027 -9.89917099999999","18.284240800000003 -14.470053400000003 19.808520200000018 -12.945773999999988","13.71371400000002 -15.993799399999991 18.284240800000003 -14.470053400000003","6.938893903907228e-18 -15.993799399999991 13.71371400000002 -15.993799399999991","6.938893903907228e-18 16.003622 6.938893903907228e-18 -15.993799399999991"]},Q:{path:["13.713358400000029 9.911145999999988 22.855656600000007 19.053622","6.0948062 -14.468078800000011 9.14265379999997 -15.991469200000008","3.0469586000000306 -11.41934220000002 6.0948062 -14.468078800000011","1.5233903999999567 -8.371850200000004 3.0469586000000306 -11.41934220000002","8.673617379884035e-19 -3.8018568000000093 1.5233903999999567 -8.371850200000004","8.673617379884035e-19 3.81634129011747 8.673617379884035e-19 -3.8018568000000093","0 3.81634129011747 1.5232126000000015 8.38651099999998","1.5232126000000015 8.38651099999998 3.0471363999999856 11.434536399999985","3.0471363999999856 11.434536399999985 6.094450600000008 14.482028399999962","6.094450600000008 14.482028399999962 9.142476000000014 16.005596599999997","9.142476000000014 16.005596599999997 15.23781559999996 16.005596599999997","15.23781559999996 16.005596599999997 18.284063000000007 14.4822062","18.284063000000007 14.4822062 21.331554999999987 11.434536399999985","21.331554999999987 11.434536399999985 22.854945400000023 8.388288999999977","22.854945400000023 8.388288999999977 24.378691399999973 3.8163397999999864","24.378691399999973 3.8163397999999864 24.378691399999973 -3.802212400000001","22.855301000000015 -8.372739200000023 24.378691399999973 -3.802212400000001","21.33137720000003 -11.420409000000038 22.855301000000015 -8.372739200000023","18.282818399999996 -14.468434400000003 21.33137720000003 -11.420409000000038","15.236926600000022 -15.991469200000008 18.282818399999996 -14.468434400000003","9.14265379999997 -15.991469200000008 15.236926600000022 -15.991469200000008"]},R:{path:["10.665866400000013 -0.7579396000000287 21.331910600000015 16.003622","0 16.00237739999999 0 -15.99486620000001","0 -0.7579396000000287 13.712647200000005 -0.7579396000000287","13.712647200000005 -0.7579396000000287 18.284063000000007 -2.281685600000017","18.284063000000007 -2.281685600000017 19.808164600000026 -3.80614280000003","19.808164600000026 -3.80614280000003 21.331555000000023 -6.853634800000007","21.331555000000023 -6.853634800000007 21.331555000000023 -9.899526600000025","19.807453400000004 -12.947374200000029 21.331555000000023 -9.899526600000025","18.28352960000002 -14.471298000000017 19.807453400000004 -12.947374200000029","13.713536200000025 -15.99486620000001 18.28352960000002 -14.471298000000017","0 -15.99486620000001 13.713536200000025 -15.99486620000001"]},S:{path:["13.713180599999992 16.003622 18.284418600000002 14.479698199999977","18.285129799999982 -14.469520000000015 21.331732799999983 -11.422383599999991","13.712469399999968 -15.993621599999996 18.285129799999982 -14.469520000000015","7.619263399999972 -15.993621599999996 13.712469399999968 -15.993621599999996","3.0474032084707825 -14.469786591124029 7.619263399999972 -15.993621599999996","0.00017779999999579556 -11.422206400325992 3.047403208470784 -14.469786591124029","0.00017779999999579556 -8.374713800000018 0.00017779999999579556 -11.422206400325992","0.00017779999999579556 -8.374713800000018 1.5246349999999678 -5.327044000000006","1.5246349999999678 -5.327044000000006 3.048025400000005 -3.8038314000000053","3.048025400000005 -3.8038314000000053 6.094272799999972 -2.2809743999999945","6.094272799999972 -2.2809743999999945 15.237459999999968 0.7670509999999702","15.237459999999968 0.7670509999999702 18.284951999999986 2.2906192000000036","18.284951999999986 2.2906192000000036 19.808520199999982 3.8141873999999962","19.808520199999982 3.8141873999999962 21.331732799999983 6.861323799999983","21.331732799999983 11.432383999999995 21.331732799999983 6.861323799999983","18.284418600000002 14.479698199999977 21.331732799999983 11.432383999999995","7.618552199999989 16.003622 13.713180599999992 16.003622","3.0474919999999774 14.48005380000001 7.618552199999989 16.003622","0 11.432561799999991 3.0474919999999774 14.48005380000001"]},T:{path:["10.66586639999997 16.003622 10.66586639999997 -15.993621599999992","0 -15.993621599999996 21.331554999999984 -15.993621599999996"]},U:{path:["21.331377199999988 6.861679400000015 21.331377199999988 -15.9934438","19.807453399999964 11.433273000000014 21.331377199999988 6.861679400000015","16.760494799999975 14.480231600000003 19.807453399999964 11.433273000000014","12.189434599999963 16.003622 16.760494799999975 14.480231600000003","9.141942599999986 16.003622 12.189434599999963 16.003622","4.5710601999999705 14.479876000000013 9.141942599999986 16.003622","1.5239237999999846 11.432739599999985 4.5710601999999705 14.479876000000013","0 6.861323799999983 1.5239237999999846 11.432739599999985","0 6.861323799999983 0 -15.993621599999996"]},V:{path:["12.189434599999963 16.003622 24.379046999999964 -15.993621599999996","0 -15.992910399999973 12.189434599999963 16.003622"]},W:{path:["22.854945399999984 16.003622 30.473319799999974 -15.993088200000011","15.236748800000026 -15.9934438 22.854945399999984 16.003622","7.618196599999997 16.00326639999997 15.236748800000026 -15.9934438","0 -15.993266000000007 7.618196599999997 16.00326639999997"]},X:{path:["0.0001777999999957956 16.003088600000012 21.331377199999988 -15.9934438","0 -15.993088200000011 21.3310216 16.003622"]},Y:{path:["12.1896124 -0.757228400000006 24.3792248 -15.993977199999987","12.1896124 16.003622 12.1896124 -0.757228400000006","0 -15.993799399999991 12.1896124 -0.757228400000006"]},Z:{path:["0 15.997043400000036 21.331436442301374 15.997043400000036","0 15.997043400000036 21.33161424230137 -16.000200199999966","0.0005926423013725259 -16.000200199999966 21.33161424230137 -16.000200199999966"]},"[":{path:["0 17.52048840000001 7.618196599999997 17.52048840000001","0 17.52048840000001 0 -12.952831399999926","0 -12.952831399999926 7.618196599999997 -12.952831399999926","1.523568199999993 17.52048840000001 1.523568199999993 -12.952831399999926"]},"\\":{path:["0 -15.993970599999983 21.331199399999996 20.573622"]},"]":{path:["6.094628400000004 17.52048840000001 6.094628400000004 -12.95247579999997","7.618374399999992 17.52048840000001 -0.0001777999999958979 17.52048840000001","7.618374399999992 17.52048840000001 7.618374399999992 -12.95247579999997","7.618374399999992 -12.95247579999997 0 -12.95247579999997"]},"^":{path:["12.188040872554353 -11.43098812999583 19.80568200000002 -5.336733600000027","4.57 -5.336378 12.188040872554353 -11.43098812999583","12.187930081181365 -12.954485518818636 19.805682 -5.336733600000041","4.57 -5.336378 12.187930081181365 -12.954485518818636"]},_:{path:["0 26.658622 24.378513600000016 26.658622"]},a:{path:["15.23746000000001 -3.8038314000000444 18.284063000000007 -0.7570506829726522","12.189434600000004 -5.327933000000064 15.23746000000001 -3.8038314000000444","7.618196599999997 -5.327933000000064 12.189434600000004 -5.327933000000064","4.5708824000000154 -3.804364800000071 7.618196599999997 -5.327933000000064","1.5237460000000291 -0.757228400000006 4.5708824000000154 -3.804364800000071","0 3.814365199999992 1.5237460000000291 -0.757228400000006","0 6.861145999999987 0 3.814365199999992","0 6.861145999999987 1.5241016000000207 11.43256179999995","1.5241016000000207 11.43256179999995 4.571593599999998 14.480053799999927","4.571593599999998 14.480053799999927 7.618730000000025 16.003622","7.618730000000025 16.003622 12.189079000000012 16.003622","12.189079000000012 16.003622 15.237282200000013 14.479342599999944","15.237282200000013 14.479342599999944 18.284063000000007 11.432206199999959","18.284063000000007 16.00326639999993 18.284063000000007 -5.327933000000064"]},b:{path:["0 11.432739599999985 3.047136399999986 14.479875999999972","3.047136399999986 14.479875999999972 6.095161799999992 16.003622","6.095161799999992 16.003622 10.66551080000002 16.003622","10.66551080000002 16.003622 13.712825 14.480587199999956","13.712825 14.480587199999956 16.760494800000014 11.432917400000022","16.760494800000014 11.432917400000022 18.284063000000007 6.861145999999987","18.284063000000007 6.861145999999987 18.284063000000007 3.814365199999992","16.760494800000014 -0.757050600000051 18.284063000000007 3.814365199999992","13.712825 -3.804364799999993 16.760494800000014 -0.757050600000051","10.665688600000015 -5.327755200000029 13.712825 -3.804364799999993","6.095161799999992 -5.327755200000029 10.665688600000015 -5.327755200000029","0 -0.7566950000000183 3.047136399999986 -3.8038314000000444","3.047136399999986 -3.8038314000000444 6.095161799999992 -5.327755200000029","0 16.003444199999965 0 -15.992732599999977"]},c:{path:["15.236037600000003 14.480231599999964 18.283707400000015 11.43256179999995","12.188901200000016 16.003622 15.236037600000003 14.480231599999964","7.618552200000029 16.003622 12.188901200000016 16.003622","4.570526800000024 14.479342599999944 7.618552200000029 16.003622","1.5233903999999971 11.432206199999959 4.570526800000024 14.479342599999944","0 6.861323799999942 1.5233903999999971 11.432206199999959","0 6.861323799999942 0 3.8136539999999286","0 3.8136539999999286 1.523923800000025 -0.757050600000051","1.523923800000025 -0.757050600000051 4.5708824000000154 -3.804009200000001","4.5708824000000154 -3.804009200000001 7.618552200000029 -5.327933000000064","7.618552200000029 -5.327933000000064 12.189790199999996 -5.327933000000064","12.189790199999996 -5.327933000000064 15.236926600000022 -3.8038314000000444","15.236926600000022 -3.8038314000000444 18.284063000000007 -0.7566950000000592"]},d:{path:["15.237282200000013 14.479698200000017 18.284240800000003 11.432739600000067","12.189079000000012 16.003622 15.237282200000013 14.479698200000017","7.618374400000033 16.003622 12.189079000000012 16.003622","4.5708824000000154 14.480231600000044 7.618374400000033 16.003622","1.5237460000000291 11.433095200000059 4.5708824000000154 14.480231600000044","0 6.86150160000006 1.5237460000000291 11.433095200000059","0 6.86150160000006 0 3.8148986000000207","0 3.8148986000000207 1.5233903999999971 -0.7566949999999775","1.5233903999999971 -0.7566949999999775 4.570526800000024 -3.8038313999999627","4.570526800000024 -3.8038313999999627 7.618907800000021 -5.327755199999947","15.23746000000001 -3.8038313999999627 18.284240800000003 -0.7570505999999693","12.189256800000008 -5.327755199999947 15.23746000000001 -3.8038313999999627","7.618907800000021 -5.327755199999947 12.189256800000008 -5.327755199999947","18.284240800000003 16.003622 18.284240800000003 -15.993621599999996"]},e:{path:["4.571060200000011 -3.8038314000000053 7.618196599999997 -5.327755200000029","1.523568199999993 -0.7563394000000265 4.571060200000011 -3.8038314000000053","8.422627534000469e-16 3.8141873999999962 1.523568199999993 -0.7563394000000265","15.236748799999985 14.479875999999972 18.28388520000001 11.432739599999985","12.189434600000004 16.003622 15.236748799999985 14.479875999999972","4.571060200000011 14.479698199999977 7.616240800000003 16.003622","7.616240800000003 16.003622 12.189434600000004 16.003622","1.523568199999993 11.4322062 4.571060200000011 14.479698199999977","0 6.862034999999966 1.523568199999993 11.4322062","0 6.862034999999966 0 3.8141873999999962","1.402594689482959e-31 3.8141873999999962 18.284240800000003 3.8141873999999962","16.760850400000006 -2.280263200000011 18.284240800000003 0.7672287999999661","18.284240800000003 3.8141873999999962 18.284240800000003 0.7672287999999661","15.236926600000022 -3.804187000000036 16.760850400000006 -2.280263200000011","12.1896124 -5.327755200000029 15.236926600000022 -3.804187000000036","7.618196599999997 -5.327755200000029 12.1896124 -5.327755200000029"]},f:{path:["0 -5.327933000000025 10.665688599999974 -5.327933000000025","4.571237999999966 16.003622 4.571237999999966 -9.898993199999994","4.571237999999966 -9.898993199999994 6.094628399999964 -14.469875600000007","6.094628399999964 -14.469875600000007 9.142831599999965 -15.993799399999991","9.142831599999965 -15.993799399999991 12.1896124 -15.993799399999991"]},g:{path:["15.236926600000022 14.4740096 18.28388520000001 11.42705099999997","12.189434600000004 15.997577799999995 15.236926600000022 14.4740096","7.618374399999992 15.997577799999995 12.189434600000004 15.997577799999995","4.570526799999983 14.473831800000006 7.618374399999992 15.997577799999995","1.5237459999999887 11.427051000000011 4.570526799999983 14.473831800000006","0 6.855813000000003 1.5237459999999887 11.427051000000011","0 6.855813000000003 0 3.8090322000000096","0 3.8090322000000096 1.5233903999999971 -0.7627392000000217","1.5233903999999971 -0.7627392000000217 4.570348999999988 -3.809697800000011","4.570348999999988 -3.809697800000011 7.617841000000006 -5.3334437999999995","15.236215399999999 -3.8102311999999987 18.28388520000001 -0.7625613999999903","12.189434600000004 -5.3334437999999995 15.236215399999999 -3.8102311999999987","7.617841000000006 -5.3334437999999995 12.189434600000004 -5.3334437999999995","4.5707046000000195 25.13969820000002 7.618552199999988 26.663622","7.618552199999988 26.663622 12.189079000000012 26.663622","12.189079000000012 26.663622 15.237104400000018 25.13952039999998","15.237104400000018 25.13952039999998 16.760494800000014 23.616129999999984","16.760494800000014 23.616129999999984 18.28388520000001 19.044891999999976","18.28388520000001 19.044891999999976 18.28388520000001 -5.335399599999997"]},h:{path:["3.0843383402867632e-19 0.7668731999999743 4.571060200000011 -3.804186999999997","4.571060200000011 -3.804186999999997 7.618552200000029 -5.327755200000029","16.76031700000002 16.003622 16.76031700000002 0.7663397999999866","15.23746000000001 -3.8038314000000053 16.76031700000002 0.7663397999999866","12.189256800000008 -5.327755200000029 15.23746000000001 -3.8038314000000053","7.618552200000029 -5.327755200000029 12.189256800000008 -5.327755200000029","0 16.00326639999997 0 -15.99273260000002"]},i:{path:["4.57410160000002 16.003622 4.57410160000002 -5.32775519999999","3.05 -15.992732599999977 4.574012705185188 -17.516745305185168","4.573923799999984 -17.516834199999998 4.573923799999984 -17.516834199999998","3.05 -15.992732599999977 3.05 -15.992910399999973","3.05 -15.992732599999977 4.57410160000002 -14.468630999999997","4.57410160000002 -14.468630999999997 6.0982032 -15.992732599999977","4.574012705185186 -17.516745305185168 6.0982032 -15.992732599999977"]},j:{path:["0 26.663622 3.0469586000000306 26.663622","3.0469586000000306 26.663622 6.094272800000012 25.13952039999998","6.094272800000012 25.13952039999998 7.617841000000006 20.568104599999977","7.617841000000006 20.568104599999977 7.617841000000006 -5.3334437999999995","6.094272800000012 -15.998776799999984 7.618196599999997 -17.52270060000001","6.094272800000012 -15.998776799999984 7.617841000000006 -14.475208599999991","7.617841000000006 -14.475208599999991 9.141764800000031 -15.999132400000018","7.618196599999997 -17.52270060000001 9.141764800000031 -15.999132400000018","7.618196599999997 -17.52270060000001 7.618196599999997 -17.52270060000001"]},k:{path:["6.094744474683139 3.8137868458414115 16.760494799999975 16.003444199999965","0 9.908460199999968 15.236748799999985 -5.328110800000021","0 16.003622 0 -15.993799400000034"]},l:{path:["0 16.003622 0 -15.993088200000011"]},m:{path:["0 0.7665176000000233 4.570349000000028 -3.8038314000000053","4.570349000000028 -3.8038314000000053 7.619263400000013 -5.327755200000029","31.997243218692567 -3.8041864880281313 33.52081180000003 0.7672287999999661","33.52081180000003 16.003622 33.52081180000003 0.7672287999999661","28.949751600000024 -5.327755200000029 31.997243218692567 -3.804186488028135","24.378869200000008 -5.327755200000029 28.949751600000024 -5.327755200000029","21.33137720000003 -3.8036536000000094 24.378869200000008 -5.327755200000029","16.760494800000014 0.7672287999999661 21.33137720000003 -3.8036536000000094","16.760494800000014 16.00326639999997 16.760494800000014 0.7672287999999661","15.236926600000022 -3.804009200000001 16.760494800000014 0.7672287999999661","12.189079000000012 -5.327755200000029 15.236926600000022 -3.804009200000001","7.619263400000013 -5.327755200000029 12.189079000000012 -5.327755200000029","0 16.003622 0 -5.327577400000033"]},n:{path:["0 0.7666953999999784 4.571415800000002 -3.804720400000024","4.571415800000002 -3.804720400000024 7.618552199999988 -5.3282886000000165","15.236852166930989 -3.804579816534522 16.76031700000002 0.7666953999999784","16.76031700000002 16.00326639999997 16.76031700000002 0.7666953999999766","12.189434600000004 -5.3282886000000165 15.236852166930989 -3.804579816534522","7.618552199999988 -5.3282886000000165 12.189434600000004 -5.3282886000000165","0 16.003622 0 -5.328110800000021"]},o:{path:["4.571060200000051 -3.804009200000001 7.618374399999992 -5.32775519999999","1.5237460000000291 -0.7566950000000183 4.571060200000051 -3.804009200000001","0 3.81489859999998 1.5237460000000291 -0.7566950000000183","0 6.861323799999983 0 3.81489859999998","0 6.861323799999983 1.524279400000057 11.432917399999981","1.524279400000057 11.432917399999981 4.571060200000051 14.479876000000013","4.571060200000051 14.479876000000013 7.618729999999984 16.003622","7.618729999999984 16.003622 12.189790200000036 16.003622","12.189790200000036 16.003622 15.237815600000042 14.478986999999993","15.237815600000042 14.478986999999993 18.284240800000045 11.432917399999981","18.284240800000045 11.432917399999981 19.80798679999999 6.861501599999979","19.80798679999999 6.861501599999979 19.80798679999999 3.814365199999992","18.2844186 -0.7566950000000183 19.80798679999999 3.814365199999992","15.237282200000013 -3.8038314000000053 18.2844186 -0.7566950000000183","12.189256800000008 -5.32775519999999 15.237282200000013 -3.8038314000000053","7.618374399999992 -5.32775519999999 12.189256800000008 -5.32775519999999"]},p:{path:["0 -0.7627391999999826 3.047136399999986 -3.809875600000007","3.047136399999986 -3.809875600000007 6.095339599999987 -5.333799399999991","0 26.663444200000004 0 -5.333799399999991","6.095339599999987 -5.333799399999991 10.665688600000015 -5.333799399999991","10.665688600000015 -5.333799399999991 13.713180807322715 -3.8102309926772815","13.71318080732271 -3.8102309926772815 16.76067260000001 -0.7627392000000217","16.76067260000001 -0.7627392000000217 18.284063000000007 3.8086765999999788","18.284063000000007 6.855457399999972 18.284063000000007 3.8086765999999788","16.76067260000001 11.425984199999997 18.284063000000007 6.855457399999972","13.713180599999992 14.473476199999974 16.76067260000001 11.425984199999997","10.665688600000015 15.99775559999999 13.713180599999992 14.473476199999974","6.095339599999987 15.99775559999999 10.665688600000015 15.99775559999999","3.0476698000000138 14.474187399999996 6.095339599999987 15.99775559999999","0 11.426517599999986 3.0476698000000138 14.474187399999996"]},q:{path:["0 6.855812999999964 1.5239237999999846 11.426695399999979","18.284063000000007 26.663622 18.284063000000007 -5.3327326000000195","7.619619000000004 -5.333621599999995 12.1896124 -5.333621599999995","12.1896124 -5.333621599999995 15.235859800000007 -3.8104090000000372","15.235859800000007 -3.8104090000000372 18.284063000000007 -0.7622057999999949","4.571238000000007 -3.810053400000003 7.619619000000004 -5.333621599999995","1.5242794000000166 -0.7630948000000135 4.571238000000007 -3.810053400000003","0 3.808498799999983 1.5242794000000166 -0.7630948000000135","0 6.855812999999964 0 3.808498799999983","7.619085600000016 15.99775559999999 12.189079000000012 15.99775559999999","12.189079000000012 15.99775559999999 15.236393199999995 14.474365199999992","15.236393199999995 14.474365199999992 18.284063000000007 11.426695399999984","4.571593599999998 14.474365199999992 7.619085600000016 15.99775559999999","1.5239237999999846 11.426695399999979 4.571593599999998 14.474365199999992"]},r:{path:["1.734723475976807e-18 3.814013642784264 1.5239237999999846 -0.7570505999999693","1.5239237999999846 -0.7570505999999693 4.571771399999994 -3.8048981999999807","4.571771399999994 -3.8048981999999807 7.619263399999972 -5.3281107999999815","7.619263399999972 -5.3281107999999815 12.188901199999975 -5.3281107999999815","0 16.003622 0 -5.3281107999999815"]},s:{path:["0 11.432028400000004 1.5237460000000291 14.479876000000013","1.5237460000000291 14.479876000000013 6.094983999999996 16.003622","6.094983999999996 16.003622 10.666399799999999 16.003622","10.666399799999999 16.003622 15.237104400000018 14.479876000000013","15.237104400000018 14.479876000000013 16.760850400000045 11.432739600000026","16.760850400000045 11.432739600000026 16.760850400000045 9.908815800000001","15.23746000000001 6.861679400000015 16.760850400000045 9.908815800000001","12.188545599999985 5.337755600000031 15.23746000000001 6.861679400000015","4.571949200000031 3.814543000000029 12.188545599999985 5.337755600000031","1.523923800000025 2.2904414000000077 4.571949200000031 3.814543000000029","0.00035560000003214185 -0.7566949999999775 1.523923800000025 2.2904414000000077","0.00035560000003214185 -0.7566949999999775 1.5235682000000335 -3.804009200000001","1.5235682000000335 -3.804009200000001 6.095517400000023 -5.327577399999994","15.236570999999989 -3.804186999999997 16.761028200000002 -0.7568727999999734","10.666044200000007 -5.327577399999994 15.236570999999989 -3.804186999999997","6.095517400000023 -5.327577399999994 10.666044200000007 -5.327577399999994"]},t:{path:["0 -5.327755200000029 10.664799599999995 -5.327755200000029","6.0941277078080205 14.480153073852616 9.14176479999995 16.003622","9.14176479999995 16.003622 12.18836779999999 16.003622","4.570348999999988 9.909171399999993 6.0941277078080205 14.480153073852616","4.570348999999988 9.909171399999993 4.570348999999988 -15.993621600000038"]},u:{path:["16.760494800000014 16.003622 16.760494800000014 -5.327577399999994","12.189967999999991 14.479698200000017 16.760494800000014 9.909171399999952","9.142298199999978 16.003622 12.189967999999991 14.479698200000017","1.5238155186039428 14.480085903686115 4.571415799999962 16.003622","4.571415799999962 16.003622 9.142298199999978 16.003622","0 9.908993599999997 1.5238155186039428 14.480085903686115","0 9.908993599999997 0 -5.327221800000002"]},v:{path:["9.142120399999982 16.003622 18.284063000000007 -5.328466400000012","0 -5.3281107999999815 9.142120399999982 16.003622"]},w:{path:["18.284075552614425 15.997659864635121 24.37869140000001 -5.333584400000002","12.189434600000004 -5.333228799999971 18.28407555261443 15.997659864635118","6.094679227397875 15.997970870594422 12.189434600000004 -5.333228799999971","0 -5.333228799999971 6.094679227397875 15.997970870594422"]},x:{path:["0.0003555999999915912 16.003622 16.761383799999994 -5.3282886000000165","0 -5.328110800000021 16.760850400000006 16.003622"]},y:{path:["0 26.663622 1.5242794000000166 26.663622","1.5242794000000166 26.663622 4.571771399999994 25.139520400000023","4.571771399999994 25.139520400000023 7.618907800000021 22.092383999999996","7.618907800000021 22.092383999999996 10.666044200000007 15.997933400000026","10.666044200000007 15.997933400000026 19.808164599999987 -5.333621599999995","1.523923800000025 -5.3334437999999995 10.666044200000007 15.997933400000026"]},z:{path:["0.0001777999999957956 16.003622 16.76067260000001 16.003622","0.0001777999999957956 16.003622 16.76031700000002 -5.327933000000025","0 -5.327933000000025 16.760317000000022 -5.327933000000025"]},"{":{path:["3.0473141999999416 -17.527522799999936 4.5707045999999725 -20.575192599999944","3.0473141999999416 -14.480919799999974 3.0473141999999416 -17.527522799999936","3.0473141999999416 -14.480919799999974 4.570882399999935 -11.433249999999958","4.570882399999935 -11.433249999999958 6.094272799999972 -9.909859600000004","6.094272799999972 -9.909859600000004 7.618196599999957 -6.8618342000000005","7.618196599999957 -3.8154089999999954 7.618196599999957 -6.8618342000000005","6.0948062 -0.7675613999999449 7.618196599999957 -3.8154089999999954","3.047669799999954 0.7556512000000382 6.0948062 -0.7675613999999449","3.0459807363089517 3.8025209363090227 6.094450599999927 6.850990799999998","6.094450599999927 9.898127200000067 6.094450599999927 6.850990799999998","4.5712379999999255 12.94490800000006 6.094450599999927 9.898127200000067","3.0480253999999247 14.467587200000034 4.5712379999999255 12.94490800000006","1.523568199999993 17.516323800000023 3.0480253999999247 14.467587200000034","1.523568199999993 20.563638000000047 1.523568199999993 17.516323800000023","1.523568199999993 20.563638000000047 3.0474919999999774 23.611130000000024","3.0474919999999774 23.611130000000024 4.570882399999935 25.134698200000017","4.570882399999935 25.134698200000017 7.618196599999957 26.658622","3.047669799999933 22.08667280000001 4.570882399999935 25.134698200000017","3.047669799999933 22.08667280000001 3.047669799999933 19.04184780000001","3.047669799999933 19.04184780000001 4.570171199999951 15.993289000000058","4.570171199999951 15.993289000000058 6.094450599999927 14.469187400000036","6.094450599999927 14.469187400000036 7.618196599999957 11.420806400000039","7.618196599999957 11.420806400000039 7.618196599999957 8.373136600000025","6.094450599999927 5.326711400000022 7.618196599999957 8.373136600000025","0 2.2795750000000368 6.094450599999927 5.326711400000022","0 2.2795750000000368 3.0476697999999374 0.7556512000000524","3.0476697999999325 0.7556512000000559 6.094450599999927 -2.291129599999941","6.094450599999927 -2.291129599999941 6.094450599999927 -5.338977199999988","4.570882399999935 -8.385935799999938 6.094450599999927 -5.338977199999988","3.047136399999986 -9.909148399999943 4.570882399999935 -8.385935799999938","1.5233903999999567 -12.957351599999981 3.047136399999986 -9.909148399999943","1.5233903999999567 -12.957351599999981 1.5233903999999567 -16.004310200000013","1.5233903999999567 -16.004310200000013 3.046425199999922 -19.050913199999968","3.046425199999922 -19.050913199999968 4.570704599999972 -20.575192599999944","4.5707045999999725 -20.575192599999944 7.618552199999948 -22.099294199999967"]},"|":{path:["0 25.138622 0 -22.09554820000002"]},"}":{path:["3.053892799999988 -20.569836999999996 4.577283199999985 -17.52216719999998","4.577283199999985 -14.475741834180443 4.577283199999985 -17.52216719999998","3.0535371999999965 -11.428072200000006 4.577283199999985 -14.475741834180443","1.5297911999999672 -9.903792799999987 3.0535371999999965 -11.428072200000006","0.006222999999974127 -6.856478599999964 1.5297911999999672 -9.903792799999987","0.006222999999974127 -3.809697799999972 0.006222999999974127 -6.856478599999964","0.006222999999974127 -3.809697799999972 1.5294355999999756 -0.7618502000000031","1.5297911999999672 6.856346400000033 4.577816703752094 3.808320896247901","1.5297911999999672 9.903127200000027 1.5297911999999672 6.856346400000033","1.5297911999999672 9.903127200000027 3.0533594000000006 12.950619200000004","3.0533594000000006 12.950619200000004 4.577460999999981 14.474720800000025","4.577460999999981 14.474720800000025 6.1008513999999785 17.522035000000006","6.1008513999999785 20.56934920000003 6.1008513999999785 17.522035000000006","4.577460999999981 23.616485600000015 6.1008513999999785 20.56934920000003","3.0535371999999974 25.14076500000003 4.577460999999981 23.616485600000015","0.006756400000001941 26.663622 3.0535371999999974 25.14076500000003","3.053537199999997 25.14076500000003 4.577283199999985 22.09256180000003","4.577283199999985 22.09256180000003 4.577283199999985 19.04525041800855","3.053714999999992 15.998289000000018 4.577283199999985 19.04525041800855","1.5301467999999991 14.474720800000025 3.053714999999992 15.998289000000018","0.006222999999974127 11.427406600000003 1.5301467999999991 14.474720800000025","0.006222999999974127 11.427406600000003 0.006222999999974127 8.379381200000077","0.006222999999974127 8.379381200000077 1.5296133999999713 5.332600400000002","1.5296133999999713 5.332600400000002 7.624241799999977 2.2849306000000293","1.5294355999999756 -0.7618502000000031 7.624241799999975 2.2849306000000293","1.5299690000000032 -2.2861295999999793 4.578438573295234 0.7623399732952496","1.5299690000000032 -2.2861295999999793 1.5299690000000032 -5.333442135244523","1.5299690000000032 -5.333442135244523 3.053714999999992 -8.380757999999982","3.053714999999992 -8.380757999999982 4.577105399999989 -9.904148399999979","4.577105399999989 -9.904148399999979 6.1008513999999785 -12.951818199999995","6.1008513999999785 -12.951818199999995 6.1008513999999785 -15.999660012880891","4.577105399999989 -19.046624399999995 6.1008513999999785 -15.999660012880891","3.053892799999988 -20.569836999999996 4.577105399999989 -19.046624399999995","0.006578599999965718 -22.093582999999985 3.053892799999988 -20.569836999999996"]},"~":{path:["13.712647200000049 -8.376555799999952 19.8076312 -11.423514399999984","7.618374399999992 -12.947082599999977 13.712647200000049 -8.376555799999952","0 -8.376377999999999 7.618374399999992 -12.947082599999977"]},"\xB0":{path:["3 -11 0 -8 3 -5 6 -8 3 -11"]},\u03A9:{path:["0 9 7 9 5 6 3 3 2 0 2 -3 3 -6 4 -8 6 -10 8 -11 12 -11 14 -10 16 -8 17 -6 18 -3 18 0 17 3 15 6 13 9 20 9"]},\u03BC:{path:["0 14 1 4 1 -6 1 4 2 7 4 8 6 8 8 7 10 4 10 -6 10 6 11 8 12 9"]}},GP.spacing={A:7.465644200000006,B:7.161250600000006,C:8.989745799999952,D:7.161072799999971,E:5.332577599999951,F:3.655923599999994,G:7.313625200000018,H:8.83737119999995,I:6.70412680000004,J:8.228050599999989,K:7.161250600000017,L:3.5044379999999933,M:9.141942599999993,N:8.837193400000046,O:7.4658220000001165,P:7.161250600000017,Q:7.465999799999963,R:7.161250600000017,S:7.1610727999999995,T:3.8091871999999967,U:8.83719340000016,V:4.113936399999943,W:6.399199800000019,X:7.161250600000017,Y:4.1137586000000965,Z:7.16107280000017,a:8.532622000000002,b:6.856679200000016,c:6.856323599999982,d:8.532622000000046,e:6.856501400000013,f:4.5708824000000154,g:8.53262200000006,h:8.380425199999962,i:5.637682400000017,j:5.942076000000018,k:5.027828400000033,l:6.7043046,m:10.056190200000003,n:8.380069600000013,o:7.008698199999969,p:6.856679199999974,q:8.53244419999993,r:2.8952951999999073,s:6.704304600000057,t:4.5708824000000154,u:8.380247399999973,v:5.180558599999927,w:7.465999799999963,x:6.704126799999813,y:5.332933199999957,z:6.704126799999926,0:7.161250600000009,1:15.846247200000045,2:7.160895000000018,3:7.1612506000000025,4:5.637682400000003,5:7.161250600000017,6:7.009053799999947,7:7.161250599999988,8:7.161250600000017,9:8.684996600000062,"`":7.009053800000009,"~":3.656812600000002,"!":7.008876000000015,"@":8.227695000000011,"#":7.313980800000067,$:7.161250600000017,"%":7.7696822000000125,"^":12.036882200000008,"&":7.925079399999959,"*":6.551752199999953,"(":6.094450599999959,")":7.771104600000058,_:4.113758599999983,"+":9.447047399999974,"-":9.446869600000014,"=":9.44651399999998,"[":4.1142920000000345,"]":5.78987920000003,"{":9.141587000000015,"}":7.466355399999884,":":7.008875999999987,'"':7.0088760000001,"|":6.7044824000000744,"<":9.142120399999953,">":9.142653799999948,"?":6.8566792000000305,";":7.008875999999987,"'":7.008698200000026,"\\":2.133244399999967,",":7.0088760000001,".":7.008875999999987,"/":2.133066600000053};var ste=GP;function oc(o,t){return is(o)!==t}function t3(o){let t=WO.getCache().textOffsetCache;switch(o){case 3:return t[0];case 2:return t[1];case 1:return t[2];case 6:return t[3];case 5:return t[4];case 4:return t[5];case 9:return t[6];case 8:return t[7];case 7:return t[8];default:return t[0]}}function fd(o,t,e){o=o.toString();let r={text:o,x:e/2,y:-e/2,fontSize:t-e,fontWidth:e},n=o.split(`
`).length,s=t*n,a=_Be(r,s-t),l=new _e;l.ext2(S.ORIGIN);for(let u of a)for(let d of u.primitives)l.ext1(d.bbox());let c=l.ext7(e/2).build1(),h=new ht(0,c.maxX,0,s);return{width:h.width(),height:h.height(),path:a}}function ABe(o,t,e,r){let i=Hk;switch(o){case"Serif":i=ote;break;case"Sans Serif":i=ste;break}let n={text:t,x:0,y:0,fontSize:e,fontWidth:r,svgFont:i},a=t.split(`
`).length,l=e*a,c=_Be(n,l-e),h=new _e;h.ext2(S.ORIGIN);for(let p of c)for(let m of p.primitives)h.ext1(m.bbox());let u=h.ext7(r/2).build1(),d=new ht(0,u.maxX,0,u.maxY);return{width:d.width(),height:d.height(),path:c}}function zO(o,t,e){let r=Math.pow(10,t),i=Math.round(o*10*r)/r,n=new dt;return e!="mil"&&(i=n.conversion1("mil",e,i)),i.toFixed(t)}function _Be(o,t){let e=new Array;if(!o)return e;let r=WO.getCache().textCache;function i(I){if(r.has(I))return r.get(I);{let C=I.split(" ");return r.set(I,C),C}}let{text:n,x:s,y:a,fontSize:l,fontWidth:c,svgFont:h}=o,{fontPath:u}=h||cy,d=s,p=a;function m(I,C=2){let E=Math.pow(10,C);return Math.round(I*E+1e-10)/E}let g=l/32,y=null,b=null,P=null,T=null;for(let I of n)switch(I){case" ":{u===cy.fontPath?d+=l*.7:d+=h.getSpaceWidth(g);break}case`
`:{d=s,p+=Math.max(l+c,l);break}default:{let C=u[I];if(C!=null){let E=C.path,O=d;for(let _ of E){let x=i(_),v=x.length,D=new Tn,w=null;for(let F=0;F<v;F+=2)y=m(d+g*+x[F]),b=t-m(p+g*(+x[F+1]-16)),O=Math.max(O,y),w==null?w=new S(y,b):(P=new S(y,b),T=new M(w,P),D.push(T),w=P);D.size()>0&&(e.push(ge.build7(D.toArray())),D.clear())}u===cy.fontPath?d=O+c+l*.15:d=O+h.getSpacing(I)*g}break}}return e}function sc(o,t){return o?o.some((e,r,i)=>t(e,r,i)):!1}function vBe(o,t){if(!t)return!1;let e=t.indexOf(o);return e>-1&&t.splice(e,1),!0}function xBe(o,t,e=!0){return!t||!e&&t.includes(o)?!1:(t.push(o),!0)}var oIe=class{constructor(){this.list=new Map;this.layers=new Set;this.viewGroupInfoMap=new Map}clear(){this.list.clear(),this.layers.clear(),this.viewGroupInfoMap.clear()}attach(t,e){if(e==null){console.log("this shape is not defined!!!");return}let r=this.list.get(e);r==null&&(r=new Array,this.list.set(e,r)),r.push(t)}remove(t,e){if(!t)return!1;let r=this.list.get(e);return!r||r.length==0?!1:vBe(t,r)}attachLayer(t){this.layers.add(t)}attachViewGroup(t,e){t&&this.viewGroupInfoMap.set(t,e)}setLayerState(t){this.layerPresenter=t}setState(t){this.shapePresenter=t}modify(){var r,i,n;if(!(this.list.size>0||this.layers.size>0||this.viewGroupInfoMap.size>0))return;Ra.unRefreshViews&&this.list.clear();let e=cn.getInstance();this.viewGroupInfoMap.forEach((s,a)=>{e.setEngineGroupVisible(a,s)}),this.viewGroupInfoMap.clear(),(r=this.layerPresenter)==null||r.notify(this.layers),this.layers.clear(),(i=this.shapePresenter)==null||i.notify(this.list),(n=this.layerPresenter)==null||n.refresh(),this.list.clear()}},Mo=new oIe;var sIe=ee.BLACK,aIe=ee.BLACK,ate=!0;function RBe(){var t,e;let o=(e=(t=le)==null?void 0:t.themeConfig)==null?void 0:e.canvasTheme;if(o){let r=o.selectColor,i=o.selectTransparency,n=ee.build(r.r,r.g,r.b,1-i);sIe.equals(n,!1)||(sIe=n,ate=!0);let s=o.hoverHighlightColor,a=o.hoverHighlightTransparency,l=ee.build(s.r,s.g,s.b,1-a);aIe.equals(l)||(aIe=l,ate=!0)}}function lY(o){return o?aIe:sIe}function DBe(){return ate}function wBe(o){ate=o}var lte=new Set,cY=new Map;function LBe(o){lte.add(o)}function MBe(o,t){if(o.layerId!=t){console.warn("layer was not modified");return}let e=cY.get(t);e||(e=new Set,cY.set(t,e)),e.add(o)}var Rl=class{constructor(){this.obj={}}contains(t){return t in this.obj}isEmpty(){for(var t in this.obj)return!1;return!0}getOrDefault(t,e){let r=this.obj[t];return r===void 0?e:r}get(t){return this.obj[t]}put(t,e){let r=this.obj[t];return this.obj[t]=e,r}del(t){let e=this.obj[t];return delete this.obj[t],e}computeIfAbsent(t,e){let r=this.obj;if(t in r)return r[t];{let i=e(t.toString());return r[t]=i,i}}iterator(t){let e=this.obj;for(let r in e){let i=e[r];if(!t(r,i))break}}origin(){return this.obj}clear(){this.obj={}}size(){return Object.keys(this.obj).length}getKeys(){return Object.keys(this.obj)}getValues(){return Object.values(this.obj)}};var VL=class VL{constructor(){this._user=null;this.selectMap=new Rl;this.colorMap=new Rl;this.maskColorMap=new Rl;this.selectIdMap=new Rl}static getInstance(){return VL.ins==null&&(VL.ins=new VL),VL.ins}set currentUser(t){this._user=t}get currentUser(){return this._user}updateSelect(t){let e=this.getSelectInfo(t);e&&e.currId&&e.currId!=this.currUser&&t.click(!1,!0)}getSelectInfo(t){let e=null,r=t;for(;r&&this.selectIdMap.size()>0&&(e=this.selectIdMap.get(r.globalIndex),r=t.syncSelectCheckParent&&r.getParent(),!(e||r==null)););return e}getHightColor(t){let e=this.getSelectInfo(t);return!e||e.currId==this.currUser?null:this.colorMap.get(e.currId)}getMaskHightColor(t){let e=this.getSelectInfo(t);return!e||e.currId==this.currUser?null:this.maskColorMap.get(e.currId)}get currUser(){return this._user.uuid}currUserHight(t){let e=this.getSelectInfo(t);e&&(e.currId=this.currUser,t.forceUpdateMask=!0)}currUserUnHight(t){let e=this.getSelectInfo(t);e&&(e.currId==this.currUser&&(e.currId=Array.from(e.selectUserIds).shift()),t.click(!1,!0))}};VL.ins=null;var f2=VL;var Ls=class o extends K9{constructor(){super(),this.setDataState(0,!0),this.setDataState(4,!0)}get item(){return this}update(){this._bbox=this.buildBBox()||void 0}bbox(){if(this._bbox==null)throw new Error("PcbItem is Empty!!!");return this._bbox}get globalIndex(){return this.model.globalIndex}set globalIndex(t){this.model.globalIndex=t}get zIndex(){return this.model.zIndex}set zIndex(t){this.model.zIndex=t}get number(){return this.model.number}set number(t){this.model.number=t}get layerId(){return null}set layerId(t){}get viewGroupId(){return""}get viewGroupIdModified(){return!1}get isEmpty(){return this.model.isEmpty}get isVisible(){return this.hasDataState(0)}set isVisible(t){this.isVisible!=t&&(this.setDataState(0,t),this.refreshRender())}get manualHighLight(){return this.hasDataState(6)||this._parent&&this._parent.manualHighLight||!1}set manualHighLight(t){this.hasDataState(6)!=t&&(this.setDataState(8,!0),this.setDataState(6,t),this.refreshRender())}get manualHighLightModified(){return this.hasDataState(8)||this._parent&&this._parent.manualHighLightModified||!1}set forceUpdateMask(t){this.setDataState(7,t)}get forceUpdateMask(){return this.hasDataState(7)}get highLightBySelect(){return this.hasDataState(1)}set highLightBySelect(t){this.highLightBySelect!=t&&(this.setDataState(1,t),this.refreshRender())}get highLightByHover(){return this.hasDataState(2)}set highLightByHover(t){this.highLightByHover!=t&&(this.setDataState(2,t),this.refreshRender())}get isHighLight(){return this.highLightBySelect||this.highLightByHover}get state(){return this.getViewState()}get partition(){var t,e;return(e=(t=this._parent)==null?void 0:t.partition)!=null?e:this.model.partition}set partition(t){this.model.partition=t,this.refreshRender()}get highLightType(){return this.highLightBySelect?1:this.highLightByHover?0:null}get syncSelectCheckParent(){return!0}get highlightColor(){var e;let t=(e=f2.getInstance())==null?void 0:e.getHightColor(this);return t||this.getHighlightColor(this.highLightByHover)}get rendering(){return this.hasDataState(3)}set rendering(t){this.setDataState(3,t)}get sendDeleteMsg(){return this.hasDataState(4)}set sendDeleteMsg(t){this.setDataState(4,t)}get updateFilterVisible(){return this.hasDataState(5)}set updateFilterVisible(t){this.setDataState(5,t)}initVisible(){this.setDataState(0,jt.getElementFilterVisible(this))}setParent(t){this._parent=t,t instanceof o&&this.model instanceof fb&&this.model.setParent(t.model)}getParent(){return this._parent}setGroupID(t){this.model.setGroupID(t)}getGroupID(){return this.model.getGroupID()}highLight(t=!1){t?(this.highLightBySelect=!1,this.highLightByHover=!0):(this.highLightBySelect=!0,this.highLightByHover=!1)}unHighLight(){this.highLightBySelect=!1,this.highLightByHover=!1}hidden(){this.setHidden(),this.refreshRender()}onlySetVisibleState(t){t?this.setVisible():this.setHidden()}visible(t=!1){var e;this.refreshFilterVisible(!1)||(this.setVisible(),t||(e=f2.getInstance())==null||e.currUserUnHight(this),this.refreshRender())}getHighlightColor(t=!1){return lY(t)}click(t=!1,e=!1){var r;this.refreshFilterVisible(!0,t)||(e?this.forceUpdateMask=!0:(r=f2.getInstance())==null||r.currUserHight(this),t?this.setHover():this.setSelect(),this.refreshRender())}otherClick(){this.refreshFilterVisible(!0,!1)||(this.setSelect(),this.refreshRender())}refreshFilterVisible(t,e){return this.updateFilterVisible?jt.updateElementFilterVisible(this,t,e):!1}remove(){this.isVisible=!1,this.unHighLight(),this.model.remove(),this.sendDeleteMsg&&A.publish("delete",this)}getMathGraphics(t=1,e=0){let r=this.buildBBox();if(r!=null){let i=new Array,n=new M(r.LL(),r.LR()),s=new M(r.LR(),r.UR()),a=new M(r.UR(),r.UL()),l=new M(r.UL(),r.LL());return i.push(n),i.push(s),i.push(a),i.push(l),ge.build2(i)}else return null}getFileGraphics(t,e,r){let i=this.getMathGraphics(t,e);return i==null?null:[i]}initRefreshRender(){Mo.attach(this,this.getType()),this.rendering=!0}refreshRender(){this.rendering||(Mo.attach(this,this.getType()),this.rendering=!0)}resetReadRender(){this.rendering=!1}resetModelNotify(){this.model instanceof xi&&this.model.resetDataState(),this.setDataState(8,!1),this.setDataState(7,!1)}get layerModified(){return this.model.layerModified}get netModified(){return this.model.netModified}get shapeModified(){return this.model.shapeModified}getRenderData(){return this.resetReadRender(),this}getViewState(){return this.isEmpty?"Not Shown":this.isVisible?this.isHighLight?"Main And Highlight":"Only Main":"Not Shown"}getType(){return null}setBBoxModify(){LBe(this)}setLayerModify(t){MBe(this,t)}};var hy=class extends Ls{constructor(){super(),this._clickTimer=null,this._bbox=new ht(0,0,0,0),this.initRefreshRender()}click(t=!1){if(super.click(t),t===!1){let e=i1.getInstance();this._clickTimer!=null&&window.clearTimeout(this._clickTimer),this._clickTimer=window.setTimeout(()=>{let r=e.clickTargetGlobalIndex;r===""?(e.clickTargetGlobalIndex=this.globalIndex,e.clickCount+=1):r===this.globalIndex?e.clickCount+=1:(e.clickTargetGlobalIndex=this.globalIndex,e.clickCount=1),e.clickCount>=3&&A.publish("ui/toastMsg",{type:"info",msg:"The filter panel on the right can disable the selection of DRC Marking.",timer:2},Q())}),A.publish("jumpToErrorSubscribe",this.globalIndex,Q())}}};var Tp=class extends hy{constructor(t,e){super(),this.model=t,this.contentModel=e||null,this.initRefreshRender()}get name(){return this.model.name}set name(t){this.model.name=t,this.refreshRender()}get locked(){return this.model.locked}set locked(t){this.model.locked=t,this.refreshRender()}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId=t,this.refreshRender()}get position(){return this.model.position}set position(t){this.model.position=t,this.refreshRender()}get errType(){return this.model.errType}set errType(t){this.model.errType=t,this.refreshRender()}get color(){return this.model.color}set color(t){this.model.color=t,this.refreshRender()}get referenceLayerIds(){return this.model.referenceLayerIds}set referenceLayerIds(t){this.model.referenceLayerIds=t,this.refreshRender()}get matrix(){return this.getMatrix()}get bbox2(){return this.model.bbox}get viewGroupId(){return this.model.viewGroupId||""}remove(){this.sendDeleteMsg=!1,super.remove(),this.refreshRender()}isSelect(t,e){return this.model.inShape(t,e)}rotateFor(t,e){}toJSON(){var e;return{globalIndex:this.model.globalIndex,partition:this.partition,name:this.name,layerId:this.layerId,locked:this.locked,position:this.position,color:this.color,errType:this.errType,contentModel:(e=this.contentModel)==null?void 0:e.toJSON(),matrix:this.getMatrix(),bbox2:this.model.bbox}}getMatrix(t=this.model.rectWidth,e=this.model.rectWidth){let r=oc(this.layerId,!1),i=t3(5),n=new S(i.x*t,i.y*e);return Ae.getMatrix4(n,0,r?-1:1,this.position)}transform(t){}buildBBox(){return this.model.updateBox()}getMathGraphics(t=this.layerId,e=0){return null}getType(){return 17}hidden(){var t;super.hidden(),(t=this.child)==null||t.hidden()}visible(t=!1){var e;this.unHighLight(),super.visible(t),(e=this.child)==null||e.visible()}onlySetVisibleState(t){var e;super.onlySetVisibleState(t),(e=this.child)==null||e.onlySetVisibleState(t)}refreshRender(){var t;super.refreshRender(),(t=this.child)==null||t.refreshRender()}injectedBBox(t){this.model.injectedBBox(t)}};var r3=class extends Ei{constructor(){super(...arguments);this._clickTargetGlobalIndex="";this._clickCount=0}get clickTargetGlobalIndex(){return this._clickTargetGlobalIndex}set clickTargetGlobalIndex(e){this._clickTargetGlobalIndex=e}get clickCount(){return this._clickCount}set clickCount(e){this._clickCount=e}resetClickStatus(){this._clickTargetGlobalIndex="",this._clickCount=0}deleteItem(e){e&&(e.remove(),this.map.delete(e.globalIndex),e.globalIndex===this.clickTargetGlobalIndex&&this.resetClickStatus())}};var Jv=class extends hy{constructor(t){super(),this.model=t,this.initRefreshRender()}getType(){return 20}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId=t,this.refreshRender()}get text(){return this.model.text}set text(t){this.model.text=t,this.refreshRender()}get ruleText(){return this.model.ruleText}set ruleText(t){this.model.ruleText=t,this.refreshRender()}get textWidth(){return this.model.textWidth}set textWidth(t){this.model.textWidth=t,this.refreshRender()}get path(){return this.model.path}get locked(){return this.model.locked}set locked(t){this.model.locked=t,this.refreshRender()}buildBBox(){return this.model.bbox}isSelect(t,e){return this.model.inShape(t,e)}get isVisible(){return this._parent.isVisible}set isVisible(t){this.isVisible!=t&&(this.setDataState(0,t),this.refreshRender())}transform(t){throw new Error("Method not implemented.")}rotateFor(t,e){throw new Error("Method not implemented.")}injectedBBox(t){this.model.injectedBBox(t)}hidden(){super.hidden()}};var lIe=class{constructor(){this.compErrorCount=new Map;this.sharedErrors=new Map}registerError(t,e){return e.filter(i=>(this.compErrorCount.get(i)||0)<8).length!==e.length?!1:(e.forEach(i=>{this.compErrorCount.set(i,(this.compErrorCount.get(i)||0)+1)}),this.sharedErrors.set(t,e),!0)}unregisterError(t){let e=this.sharedErrors.get(t);e&&(e.forEach(r=>{if(this.compErrorCount.has(r)){let i=this.compErrorCount.get(r)-1;this.compErrorCount.set(r,Math.max(0,i))}}),this.sharedErrors.delete(t))}getErrorCount(t){return this.compErrorCount.get(t)||0}reset(){this.compErrorCount.clear(),this.sharedErrors.clear()}},UL=new lIe;function NBe(o,t,e,r,i,n){if(isNaN(e))throw new Error("line error,width is NaN");if(e<0)return;function s(h){return r==i?!0:n===ae.CCW?r>i?h>=r&&h<=kr?!0:h>=0&&h<=i:h>=r&&h<=i:r>i?h>=i&&h<=r:h>=i&&h<=kr?!0:h>=0&&h<=r}let a=new _e;if(t<0)return null;if(t==0)return a.ext2(o),null;let l=o.add(new S(Math.cos(r)*t,Math.sin(r)*t)),c=o.add(new S(Math.cos(i)*t,Math.sin(i)*t));if(a.ext6(l.x,l.y).ext6(c.x,c.y),s(0)){let h=o.add(new S(t,0));a.ext6(h.x,h.y)}if(s(Go)){let h=o.add(new S(0,t));a.ext6(h.x,h.y)}if(s(Math.PI)){let h=o.add(new S(-t,0));a.ext6(h.x,h.y)}if(s(Go*3)){let h=o.add(new S(0,-t));a.ext6(h.x,h.y)}return a.ext7(e/2),a.build1()}function n1(o){return o>=0&&o<=kr||(o%=kr,o<0&&(o+=kr)),o}function cte(o,t,e,r,i=ae.CCW){if(i==ae.CCW)if(r>e){let n=(r-e)/2+e;return o.add(new S(Math.cos(n),Math.sin(n)).mul(t))}else{if(r==e)return o.add(new S(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(t));{let n=(r+kr-e)/2+e;return o.add(new S(Math.cos(n),Math.sin(n)).mul(t))}}else if(r>e){let n=(e+kr-r)/2+r;return o.add(new S(Math.cos(n),Math.sin(n)).mul(t))}else{if(r==e)return o.add(new S(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(t));{let n=(e-r)/2+r;return o.add(new S(Math.cos(n),Math.sin(n)).mul(t))}}}function $0(o,t,e,r,i,n,s,a){if(r=n1(r),i=n1(i),e==0)return!1;if(s==0&&a!=null&&(s=10/a),n==ae.CW){let O=r;r=i,i=O}let{x:l,y:c}=o,h=s/2,u=e-h,d=e+h,p=l-t.x,m=c-t.y,g=Math.atan2(m,p);if(g<0&&(g+=kr),r<=i&&g>=r&&g<=i||r>i&&(g>=r&&g<=kr||g>=0&&g<=i)||r==i){var y=Math.sqrt(p*p+m*m);return y<=d&&y>=u}else{var y=(d+u)/2,b=new Dt(t.x+Math.cos(r)*y,t.y+Math.sin(r)*y,0),P=new Dt(t.x+Math.cos(i)*y,t.y+Math.sin(i)*y,0),T=l-b.x,I=c-b.y,C=l-P.x,E=c-P.y;return T*T+I*I<=s*s/4?!0:C*C+E*E<=s*s/4}}var hte=class extends e3{constructor(e,r,i,n,s,a=1001){super();this.modelType="DrcCreepage";this.globalIndex=e,this._text=r,this._ruleText=i,this._textWidth=n,this._path=s,this._layerId=a,this.updateBox()}get layerId(){return this._layerId}set layerId(e){this._layerId!==e&&(this._layerId=e,this.layerModified=!0)}get text(){return this._text}set text(e){this._text!==e&&(this._text=e)}get ruleText(){return this._ruleText}set ruleText(e){this._ruleText!==e&&(this._ruleText=e)}get textWidth(){return this._textWidth}set textWidth(e){this._textWidth!==e&&(this._textWidth=e,this.updateBox())}get path(){return this._path}set path(e){this._path=e,this.updateBox()}get locked(){return this._locked}set locked(e){this._locked!==e&&(this._locked=e)}get color(){return this._color}set color(e){(this._color.r!==e.r||this._color.g!==e.g||this._color.b!==e.b||this._color.alpha!==e.alpha)&&(this._color=e)}updateBox(){let e=new _e,r=[...this.injectedBBoxes,...this.path.map(i=>i.bbox())];for(let i of r)e.ext1(i);return this._bbox=e.build(),this._bbox||new ht(0,0,0,0)}inShape(e,r){let i=new S(e,r),[n,s]=this.injectedBBoxes;if(Zv(s).isContains(i))return!0;if(n.isContains(i)){for(let l of this._path)if(l instanceof M){if(Da(i,l.start(),l.end(),.1))return!0}else if(l instanceof q){let c=l.center,h=l.ry,u=Xh(l.startAngle),d=Xh(l.sweepAngle),p=d+u,m=d>=0?ae.CCW:ae.CW;if($0(i,c,h,u,p,m,.1))return!0}}return!1}clone(...e){throw new Error("Method not implemented.")}transform(e){throw new Error("Method not implemented.")}};var Qv=class Qv extends r3{static getInstance(){return Qv.instance||(Qv.instance=new Qv),Qv.instance}updateCache(t){this.map.set(t.globalIndex,t)}deleteItem1(t){let e=new Jv(t);return this.map.delete(e.globalIndex),e}deleteCreepageError(t){let e=t.child;e instanceof Jv&&(Qv.getInstance().deleteItem(e),e.remove(),this.map.delete(e.globalIndex)),UL.unregisterError(t.contentModel.globalIndex),t.child=null}addItemByModel(t){let e=new Jv(t);return this.updateCache(e),e}addItem(t,e,r,i,n=1001){let s=new hte(nr(),e,r,200,i,n),a=this.addItemByModel(s);return a.setParent(t),a}};Qv.instance=null;var HL=Qv;var WL=class WL extends r3{static getInstance(){return WL._instance||(WL._instance=new WL),WL._instance}getAllItem(){let t=super.getAllItem(),e=HL.getInstance().getAllItem();for(let r of e)t.push(r);return t}updateCache(t){this.map.set(t.globalIndex,t)}addItemByModel(t){let e=new Tp(t);return this.updateCache(e),e}addItem(t,e,r,i,n,s,a=ee.of3("#FFCC00"),l=1001){let c=Uk.getInstance().addItem(t,e,r,i,n,s,a,l);return this.addItemByModel(c)}rebuildItem(t,e,r,i,n,s,a,l){let c=Uk.getInstance().addItem(t,e,r,i,n,s,a,l);return this.addItemByModel(c)}findItemByGlobalIndex(t){let e=this.map.get(t);return e||null}copyItem(t){}deleteItem(t){t instanceof Tp&&(Uk.getInstance().deleteItem(t.model),t.remove(),this.map.delete(t.globalIndex),t.globalIndex===this.clickTargetGlobalIndex&&this.resetClickStatus())}setTargetDRCItemsVisible(t){for(let e of t)e.state==="Main And Highlight"&&e.visible()}setTargetDRCItemsClicked(t){for(let e of t)e.click()}};WL._instance=null;var i1=WL;var Jt=class{getItem(t,e={}){let r={isContainDRCs:!1,...e},i=null,n=[pr,Qt,Wr,Kt,jo,Xt,ri,os,Yo,ah,Ar,pt,Bn,So,Ti,zn];for(let s of n)if(i=s.getItem(t),i!=null)return i;return(typeof i>"u"||i===null)&&r.isContainDRCs&&(i=i1.getInstance().getItem(t)),i}getLoopNode(t){let e=null,r=[pr,Wr,Qt];for(let i of r)if(e=i.getItem(t),e!=null)return e;return e}getConnectNode(t){let e=null,r=[Qt,Wr,pr,Ti,zn,Kt,Xt,pt];for(let i of r)if(e=i.getItem(t),e!=null)return e;return e}getItems(t){let e=null,r=[pr,Qt,Wr,Kt,jo,Xt,ri,os,Yo,ah,Ar,pt,Bn,So,Ti,zn],i=new Array;for(let n of r)e=n.getItem(t),e!=null&&i.push(e);return i}getItemByType(t,e){let r=this.getManageByType(e),i=r==null?void 0:r.getItem(t);return i!=null?i:null}getManageByType(t){switch(t){case"Track":case"ArcTrack":return pr;case"Pad":return Qt;case"Via":return Wr;case"Circle":return Kt;case"Radius Dimension":return jo;case"Rect":return Xt;case"Text":return ri;case"Protractor Dimension":return os;case"Length Dimension":return Yo;case"Smart Dimension":return ah;case"Component":return Ar;case"Polygon":return pt;case"Image":return Bn;case"Picture":return So;case"Copper":return Ti;case"Inner":return zn;default:return null}}getItemsByNet(t){let e=new Set;for(let r of t){let i=Ye.getSameNetItemsWithoutPourAndPlaneZone(r);for(let n of i)e.add(n)}return e}};var T0=class{constructor(){this.nums=new Set}add(t){return t==""||this.nums.has(t)?!1:(this.nums.add(t),!0)}getIncrementalNumber(t){let e="";if(typeof t>"u"||t==="")e="1";else{t.endsWith("?")&&(t=t.replace("?",""));let r=t.split(/[^0-9]+/);if(r[r.length-1]=="")e=t+"1";else if(r[r.length-1].match(/[0-9]+/)){let i=parseInt(r[r.length-1])+1;e=t.replace(new RegExp(r[r.length-1]+"$"),i.toString())}else e="A"}return this.add(e),e}getMaxNum(){let t=0;for(let e of this.nums)isNaN(Number(e))||(t=Math.max(t,Number(e)));return t}getNum(t){if(t.endsWith("?")&&(t=t.replace("?","")),this.nums.has(t.toUpperCase())){let e=t.split(/[^0-9]+/);if(e[e.length-1]=="")return this.getNum(t+"1");if(e[e.length-1].match(/[0-9]+/)){let r=parseInt(e[e.length-1])+1;return this.getNum(t.replace(new RegExp(e[e.length-1]+"$"),r.toString()))}else return this.getNum("A")}else return t==""?this.getNum("1"):t.toUpperCase()}getUniqueName(t){if(t.endsWith("?")&&(t=t.replace("?","")),this.nums.has(t)){let e=t.split(/[^0-9]+/);if(e[e.length-1]=="")return this.getUniqueName(t+"1");if(e[e.length-1].match(/[0-9]+/)){let r=parseInt(e[e.length-1])+1;return this.getUniqueName(t.replace(new RegExp(e[e.length-1]+"$"),r.toString()))}else return this.getUniqueName("A")}else return t==""?this.getUniqueName("1"):t}deleteNum(t){this.nums.delete(t)}clear(){this.nums.clear()}has(t){return this.nums.has(t)}getNums(){return Array.from(this.nums)}getArrayPadNum(t,e){let r=[];for(let i=0;i<e;i++)for(let n=0;n<t.length;n++){let s=this.getNum(t[n]);r.push(s),t[n]=s,this.add(s)}return r}};var ac=class o extends cd{constructor(t){super(),this._name=t,this._fileUuid=""}get name(){return this._name}set name(t){this.watcher!=null&&!this.watcher.modifyName(this,t)||(this._name=t)}get fileUuid(){return this._fileUuid||""}set fileUuid(t){this._fileUuid=t}toJSON(){return{name:this.name,fileUuid:this.fileUuid}}isPartitionSplitOut(){return this._fileUuid!=""&&this._fileUuid!=null}clone(){let t=new o(this.name);return t.fileUuid=this.fileUuid,t}};var or=class extends xi{get bbox(){return this._bbox}};var i3=class{constructor(t,e){this.id=t,this.layerId=e,this.hash=t+"_"+e}};var qu=class extends i3{constructor(t,e,r,i){super(t,e),this.shape=r,this.width=i}};var ku=class extends i3{constructor(t,e,r){super(t,e),this.shape=r}};var Yd=class extends i3{constructor(t,e,r,i=0){if(super(t,e),this.shape=r,this.width=i,r.length>100){this.rtree=new i2(10);for(let n of r)this.rtree.add(n)}}getShapes(t,e){return this.rtree!=null?this.rtree.search(t.bbox().extendOfSize(e)):this.shape}};var md=class extends i3{constructor(t,e,r,i){super(t,e),this.shape=r,this.width=i}};var zL=class zL{constructor(){this.hash=null;this.cache=new Map;this.treeMap=new Map;this.map=new Map;this.polyTreeMap=new Map;this.maskClear=!1}static getInstance(){return zL.manager==null&&(zL.manager=new zL),zL.manager}setMask(t){this.maskClear=t}addCache(t,e,r,i=0){if(r==null)return null;if(r instanceof rl){let n=new md(t,e,r,i);return this.cache.set(n.hash,n),n}else if(r instanceof ge){let n=new ku(t,e,r);return this.cache.set(n.hash,n),n}else if(r instanceof Bt){let n=new qu(t,e,r,i);return this.cache.set(n.hash,n),n}else{let n=new Yd(t,e,r,i);return this.cache.set(n.hash,n),n}}getCache(t,e){return this.hash=t+"_"+e,this.cache.get(this.hash)}getTree(t){let e=this.treeMap.get(t);if(e==null){e=new ji(50);for(let r of t.items)for(let i of r.primitives)e.add(i);this.treeMap.set(t,e)}return e}getPointInPolyline(t){return new Zee}getPolyTree(t){let e=this.polyTreeMap.get(t);if(e==null){e=new ji(50);for(let r of t)e.add(r);this.polyTreeMap.set(t,e)}return e}delete(t,e){this.hash=t+"_"+e;let r=this.cache.get(this.hash);r!=null&&(r instanceof qu?(this.treeMap.delete(r.shape),this.map.delete(r.shape)):r instanceof Yd&&this.polyTreeMap.delete(r.shape),this.cache.delete(this.hash))}clear(){this.maskClear||(this.cache.clear(),this.treeMap.clear(),this.map.clear())}};zL.manager=null;var Zh=zL;var Yn=class{point2Angle(t,e,r){if(t.equals(e))if(r.equals(t)){let I=t.add(new S(.001,0)),C=.001,E=t.angle(I),O=e.angle(I),_=ae.CCW;return{center:I,radius:C,startAngle:E,endAngle:O,sweep:_}}else{let I=t.add(r).mul(.5),C=r.distance1(t)/2,E=t.angle(I),O=e.angle(I),_=ae.CCW;return{center:I,radius:C,startAngle:E,endAngle:O,sweep:_}}let i=e.sub(r).normalize(),n=r.sub(t).normalize();i.cross(n)==0&&r.add(new S(-i.y,i.x).mul(.01));let s=2*(e.x-t.x),a=2*(e.y-t.y),l=e.x*e.x+e.y*e.y-t.x*t.x-t.y*t.y,c=2*(r.x-e.x),h=2*(r.y-e.y),u=r.x*r.x+r.y*r.y-e.x*e.x-e.y*e.y,d=(l*h-u*a)/(s*h-c*a),p=(s*u-c*l)/(s*h-c*a),m=new S(d,p),g=m.distance1(t),y=t.angle(m),b=e.angle(m),P=n.cross(i),T;return P>0?T=ae.CCW:T=ae.CW,{center:m,radius:g,startAngle:y,endAngle:b,sweep:T}}pointToAngle(t,e,r){let i=e.sub(t),n=new S(-i.y,i.x).normalize(),s=Math.abs(r)/2,a;if(s!=0)a=i.length()/2/Math.sin(s);else throw new Error("Can't represent circle!!!");let l=n.rotate(S.ORIGIN,s),c,h;r>0?(c=ae.CCW,h=e.add(l.mul(a))):(c=ae.CW,h=t.sub(l.mul(a)));let u=t.angle(h),d=e.angle(h);return{center:h,radius:a,startAngle:u,endAngle:d,sweep:c}}angleToPoint(t,e,r,i,n){let s=t.add(new S(Math.cos(r),Math.sin(r)).mul(e)),a=t.add(new S(Math.cos(i),Math.sin(i)).mul(e)),l;return n==ae.CCW?l=(i+kr-r)%kr:l=-(r+kr-i)%kr,{start:s,end:a,angle:l}}tangentToArc(t,e,r,i=!0){if(e.equals(r)){let m=new S(t.y,-t.x).normalize(),g=e.add(m),y=e.angle(g),b=y+kr;return i?{center:g,radius:1,startAngle:y,endAngle:b,sweep:ae.CW}:{center:g,radius:1,startAngle:b,endAngle:y,sweep:ae.CW}}let n=r.sub(e),s=t.cross(n),a,l,c;s>0?(a=ae.CCW,l=new S(-t.y,t.x).normalize(),c=new S(-n.y,n.x).normalize()):(a=ae.CW,l=new S(t.y,-t.x).normalize(),c=new S(n.y,-n.x).normalize());let h=new M(e,e.add(l.mul(1e5))),u=e.add(r).mul(.5),d=new M(u.sub(c.mul(1e5)),u.add(c.mul(1e5)));if(Pt(h,d)>0){let m=new S(Ee[0],Ee[1]),g=m.distance1(e),y=e.angle(m),b=r.angle(m);return{center:m,radius:g,startAngle:y,endAngle:b,sweep:a}}else{let m=e.add(l.mul(1e5)),g=m.distance1(e),y=e.angle(m),b=r.angle(m);return{center:m,radius:g,startAngle:y,endAngle:b,sweep:a}}}tangentAngleArc(t,e,r,i){let n=null,s=null,a=null;i>0?(n=ae.CCW,a=e.rotate(S.ORIGIN,Math.PI/2),s=t.add(a.mul(r))):(n=ae.CW,a=e.rotate(S.ORIGIN,-Math.PI/2),s=t.add(a.mul(r)));let l=a.mul(-1).angle(S.ORIGIN),c=l+i;return{center:s,radius:r,startAngle:l,endAngle:c,sweep:n}}};function I0(o,t=1){let e=new Array;return o.forEach(r=>{if(r.primitives.length==1){let a=r.primitives[0];if(a instanceof q&&Math.abs(a.sweepAngle)==360)if(a.isCCW){let l=a.sweepAngle/2;r=ge.build7([q.build3(a.center,0,l,a.rx,a.ry),q.build3(a.center,l,l,a.rx,a.ry)])}else{e.push(["CIRCLE",a.center.x*t,a.center.y*t,a.rx*t]);return}}let i=new Array,n=r.primitives,s=!1;for(let a of n)if(a instanceof M)i.push(a.start().x*t),i.push(a.start().y*t),s||(i.push("L"),s=!0);else if(a instanceof q&&ud(a)>1e-8)s=!1,i.push(a.start().x*t),i.push(a.start().y*t),i.push("ARC"),i.push(a.sweepAngle);else if(a instanceof Dr){s=!1,i.push(a.start().x*t),i.push(a.start().y*t),i.push("C");for(let l=1,c=a.controls.length;l<c-1;l++){let h=a.controls[l];i.push(h.x*t),i.push(h.y*t)}}i.length>2&&(i.push(n[n.length-1].end().x*t),i.push(n[n.length-1].end().y*t),e.push(i))}),e}function lh(o,t=1){if(o.primitives.length==1){let i=o.primitives[0];if(i instanceof q&&Math.abs(i.sweepAngle)==360)return["CIRCLE",i.center.x*t,i.center.y*t,i.rx*t]}let e=new Array,r=o instanceof Bt?o.items:[o];for(let i of r){let n=new Array;e.push(n);let s=i.primitives,a=!1;for(let l of s)if(l instanceof M)n.push(l.start().x*t),n.push(l.start().y*t),a||(n.push("L"),a=!0);else if(l instanceof q&&ud(l)>1e-8)if(Math.abs(l.sweepAngle)==360){let c=l.points(.01);c.pop();let h=!0;for(let u of c)n.push(u.x*t),n.push(u.y*t),!a&&h&&(n.push("L"),a=!0),h=!1}else a=!1,n.push(l.start().x*t),n.push(l.start().y*t),n.push("ARC"),n.push(l.sweepAngle);else if(l instanceof Dr){a=!1,n.push(l.start().x*t),n.push(l.start().y*t),n.push("C");for(let c=1,h=l.controls.length;c<h-1;c++){let u=l.controls[c];n.push(u.x*t),n.push(u.y*t)}}n.length>2&&(n.push(s[s.length-1].end().x*t),n.push(s[s.length-1].end().y*t))}return e.length==1?e[0]:e}function Jh(o,t=1){t==0&&(t=1),o=rSt(o,t);let e=o.length,r=new Array(e),i=new Yn,n=null,s=null,a=!1,l=null,c=new Tn,h=null,u=null,d=0,p=2,m=null,g=null,y=null;for(d=0;d<e;d++){if(h=o[d],h[0]==="CIRCLE"){let b=ge.build7([q.build2(new S(h[1],h[2]),0,360,h[3],h[3],ae.CW)]);r[d]=b;continue}for(n=new S(h[0],h[1]),a=!1,u=h.length,p=2;p<u;)switch(m=h[p],m){case"L":{s=new S(h[p+1],h[p+2]),l=new M(n,s),c.addLast(l),n=s,p+=3,a=!0;break}case"ARC":{if(a=!1,g=h[p+1]/180*Math.PI,s=new S(h[p+2],h[p+3]),Math.abs(g)>1e-8&&!n.equals1(s)){let{center:b,radius:P,startAngle:T,endAngle:I,sweep:C}=i.pointToAngle(n,s,g);l=q.build2(b,T/Math.PI*180,I/Math.PI*180,P,P,C),c.addLast(l)}n=s,p+=4;break}case"C":{a=!1;let b=new Array;for(b.push(n),p++;;){let P=new S(h[p],h[p+1]);if(b.push(P),typeof h[p+2]=="string"){n=P,p+=2;break}if(p+=2,p>=u)break}l=new Dr(b),c.addLast(l);break}default:{a?(s=new S(h[p],h[p+1]),l=new M(n,s),c.addLast(l),n=s,p+=2):p++;break}}c.size()>0&&(y=ge.build7(c.toArray()),r[d]=y),c.clear()}return c.clear(),h=null,r}function m2(o,t=1){if(o.length<2)return null;if(o[0]=="CIRCLE")return ge.build7([q.build2(new S(o[1],o[2]),0,360,o[3],o[3],ae.CW)]);try{let e=new Array,r=new S(o[0]/t,o[1]/t),i=!1;for(let n=2,s=o.length;n<s;)if(o[n]=="L"){let a=new S(o[n+1]/t,o[n+2]/t);if(!r.equals1(a)){let l=new M(r,a);e.push(l)}r=a,n+=3,i=!0}else if(o[n]=="ARC"||o[n]=="CARC"){i=!1;let a=o[n+1]/180*Math.PI,l=new S(o[n+2]/t,o[n+3]/t);if(ne.greater(zt.regular(a),0)&&!r.equals1(l)){let c=new Yn,{center:h,radius:u,startAngle:d,endAngle:p,sweep:m}=c.pointToAngle(r,l,a),g=q.build2(h,d/Math.PI*180,p/Math.PI*180,u,u,m);e.push(g)}r=l,n+=4}else if(o[n]=="C"){i=!1;let a=new Array;for(a.push(r),n++;;){let c=new S(o[n]/t,o[n+1]/t);if(a.push(c),typeof o[n+2]=="string"){r=c,n+=2;break}if(n+=2,n>=s)break}let l=new Dr(a);e.push(l)}else if(i){let a=new S(o[n]/t,o[n+1]/t);if(!r.equals1(a)){let l=new M(r,a);e.push(l)}r=a,n+=2,i=!0}else n++;return e.length>0?ge.build7(e):null}catch{console.warn("source is not valid: ",o);return}}function kBe(o){let t=new Array;o=o.asClose();let e=o.primitives[0].start();for(let i of o.primitives)i instanceof M?t.push(i.start()):i instanceof q?i.points(.01).forEach(s=>{t.push(s)}):i instanceof Dr&&i.points(.1).forEach(s=>{t.push(s)});let r=o.primitives[o.primitives.length-1].end();return t.push(r),r.equals(e)||t.push(e),t}function rSt(o,t=1){if(t==0||t==1)return o;let e=o.length,r=new Array(e),i="",n=null,s=null,a=null,l=0,c=0;for(;l<e;l++){n=o[l],s=n.length;let h=new Array(s);for(c=0;c<s;c++)a=n[c],i=typeof a,i==="number"?h[c]=a/t:h[c]=a;r[l]=h}return r}var jl=class extends xi{constructor(t,e,r){super(),this.globalIndex=t,this.update(e,r)}get modify(){return!1}set modify(t){}get net(){var t;return(t=this._net)==null?void 0:t.toUpperCase()}set net(t){this._net!=t&&(this._net=t,this.netModified=!0)}get showNet(){return this._net}get start(){return this.pls.length>0?this.pls[0].primitives[0].start():null}update(t,e){this._net=t,this.pls=e}get source(){return I0(this.pls)}updateBox(){let t=new _e;for(let e of this.pls)t.ext1(e.bbox());return this._bbox=t.build1(),this._bbox}};function BBe(o,t,e){if(isNaN(e)||e<0)throw new Error("line error,width is NaN");let r=WO.getCache().boxCache,i=e/2;return r[0]=Math.min(o.x,t.x)-i,r[1]=Math.max(o.x,t.x)+i,r[2]=Math.min(o.y,t.y)-i,r[3]=Math.max(o.y,t.y)+i,new ht(r[0],r[1],r[2],r[3])}var ex=class o{constructor(t,e){this._start=t,this._end=e}get start(){return this._start}set start(t){this._start.equals(t)||(this._start=t)}get end(){return this._end}set end(t){this._end.equals(t)||(this._end=t)}get direct(){return this._end.sub(this._start).normalize()}get length(){return this._start.distance1(this._end)}set length(t){let e=this._end.sub(this._start).normalize(),r=this._start.add(e.mul(t));this.end=r}get primitive(){return new M(this._start,this._end)}get center(){return this._start.add(this._end).mul(.5)}transform(t){this.start=this._start.multiply4(t),this.end=this._end.multiply4(t)}inShape(t,e,r,i){r<.05&&i!=null&&(r=10/i.getScale());let n=t-this._start.x,s=e-this._start.y,a=t-this._end.x,l=e-this._end.y,c=this._end.x-this._start.x,h=this._end.y-this._start.y,u=new S(-h,c).normalize(),d=c+u.x*r/2,p=h+u.y*r/2,m=d*d+p*p,g=n*n+s*s,y=a*a+l*l,b=Math.abs(n*h-s*c)/2,T=Math.sqrt(c*c+h*h)*r/4;if(b<=T&&g<=m&&y<=m)return!0;{let I=r/2;return g<=I*I?!0:y<=I*I}}getBBox(t){return BBe(this._start,this._end,t)}getMathGraphics(t,e){return this.primitive.stroke(t+e*2,wr.ROUND,ae.CW)}clone(){return new o(this._start,this._end)}equals(t){return t instanceof o?this._start.equals1(t.start)&&this._end.equals1(t.end):!1}};var ute=class{constructor(t,e,r,i){this.layerId=t;this.width=e;this.locked=r;this.net=i}};var YL=class YL extends Ei{static getInstance(){return YL.manager==null&&(YL.manager=new YL),YL.manager}getKey(t,e,r,i){return`${t}_${e}_${r}_${i}`}getComponent(t,e,r,i){let n=this.getKey(t,e,r,i),s=this.map.get(n);return s==null&&(s=new ute(t,e,r,i),this.map.set(n,s)),s}};YL.manager=null;var tx=YL;var gt=class extends xi{constructor(t,e,r,i,n,s,a){super(),this._globalIndex=t,this._baseModel=e,this.com=tx.getInstance().getComponent(r,i,s,n.toString()),this._bbox=a||e.getBBox(i)}get layerId(){return this.com.layerId}set layerId(t){this.com.layerId!=t&&(this.watchLayerIdModify(this.com.layerId),this.com=tx.getInstance().getComponent(t,this.com.width,this.com.locked,this.com.net),this.layerModified=!0)}get net(){var t;return(t=this.com.net)==null?void 0:t.toUpperCase()}set net(t){this.com.net!=t&&(this.com=tx.getInstance().getComponent(this.com.layerId,this.com.width,this.com.locked,t),this.netModified=!0)}get showNet(){return this.com.net}get length(){return this._baseModel.length}set length(t){t=oo(t),this._baseModel.length=t}get start(){return this._baseModel.start}set start(t){this._baseModel.start.equals(t)||(this._baseModel.start=t,this.updateShapeData())}get end(){return this._baseModel.end}set end(t){this._baseModel.end.equals(t)||(this._baseModel.end=t,this.updateShapeData())}get width(){return this.com.width}set width(t){this._baseModel instanceof ex&&(t=oo(t)),this.com.width!=t&&(this.com=tx.getInstance().getComponent(this.com.layerId,t,this.com.locked,this.com.net),this.updateShapeData())}get locked(){return this.com.locked}set locked(t){this.com=tx.getInstance().getComponent(this.com.layerId,this.com.width,t,this.com.net)}get bbox(){return this._bbox}recycle(){super.recycle()}inShape(t,e,r){return this._baseModel.inShape(t,e,this.width,r)}updateBox(){return this._bbox=this._baseModel.getBBox(this.width),this._bbox}getMathGraphics(t=this.layerId,e=0){return!this.isEmpty&&this.layerId==t?this._baseModel.getMathGraphics(this.width,e):null}};var dte=class{constructor(t,e,r,i){this.startLayer=t,this.endLayer=e,this.radius=r,this.holeRadius=i}};var cIe=class{constructor(){this.ViaBaseInfoPool=new Map}getViaBaseInfoByStartLayer(t,e){return this.getViaBaseInfo(t,e.endLayer,e.radius,e.holeRadius)}getViaBaseInfoByEndLayer(t,e){return this.getViaBaseInfo(e.startLayer,t,e.radius,e.holeRadius)}getViaBaseInfoByRadius(t,e){return this.getViaBaseInfo(e.startLayer,e.endLayer,t,e.holeRadius)}getViaBaseInfoByHoleRadius(t,e){return this.getViaBaseInfo(e.startLayer,e.endLayer,e.radius,t)}getViaBaseInfo(t,e,r,i){let n=this.generateId({startLayer:t,endLayer:e,radius:r,holeRadius:i}),s=this.ViaBaseInfoPool.get(n);return s!=null||(s=new dte(t,e,r,i),this.ViaBaseInfoPool.set(n,s)),s}generateId(t){let{startLayer:e,endLayer:r,radius:i,holeRadius:n}=t;return`${e}_${r}_${i}_${n}`}},la=new cIe;var Ct=class extends xi{constructor(){super(...arguments);this.modelType="Via"}get bbox(){return this._bbox}get expansionType(){return this.viaExpansion.expansionType}set expansionType(e){this.viaExpansion.expansionType!=e&&(this.viaExpansion=qp.getExpansionByexpansionType(e,this.viaExpansion))}get startLayer(){return this.viaBaseInfo.startLayer}set startLayer(e){this.viaBaseInfo.startLayer!=e&&(this.viaBaseInfo=la.getViaBaseInfoByStartLayer(e,this.viaBaseInfo))}get endLayer(){return this.viaBaseInfo.endLayer}set endLayer(e){this.viaBaseInfo.endLayer!=e&&(this.viaBaseInfo=la.getViaBaseInfoByEndLayer(e,this.viaBaseInfo))}get radiusModified(){return this.hasDataState(7)}set radiusModified(e){this.setDataState(7,e)}get holeRadius(){return this.viaBaseInfo.holeRadius}set holeRadius(e){e=oo(e*2)/2,this.viaBaseInfo.holeRadius!=e&&(this.viaBaseInfo=la.getViaBaseInfoByHoleRadius(e,this.viaBaseInfo),this.updateShapeData(),this.holeRadiusModified=!0)}get holeRadiusModified(){return this.hasDataState(8)}set holeRadiusModified(e){this.setDataState(8,e)}get topExpansion(){return this.viaExpansion.topExpansion}set topExpansion(e){this.viaExpansion.topExpansion!=e&&(this.viaExpansion=qp.getExpansionByTopExpansion(e,this.viaExpansion),this.updateShapeData(),this.topExpansionModified=!0)}get topExpansionModified(){return this.hasDataState(9)}set topExpansionModified(e){this.setDataState(9,e)}get bottomExpansion(){return this.viaExpansion.bottomExpansion}set bottomExpansion(e){this.viaExpansion.bottomExpansion!=e&&(this.viaExpansion=qp.getExpansionByBottomExpansion(e,this.viaExpansion),this.updateShapeData(),this.bottomExpansionModified=!0)}get bottomExpansionModified(){return this.hasDataState(10)}set bottomExpansionModified(e){this.setDataState(10,e)}};var Wk=class{getRtree(t){return Zh.getInstance().getTree(t)}getInpolylines(t){return Zh.getInstance().getPointInPolyline(t)}isPoints(t){return!!(t instanceof M&&ne.eq(t.start().distance2(t.end()),0))}};var hIe=class{auto(t,e){return e.bbox().isContains(t)?e instanceof Zo?this.pips(t,e.items):this.pip(t,e):!1}pips(t,e){for(let r=0;r<e.length;r++)if(r===0){if(!this.pip(t,e[r]))return!1}else if(this.pip(t,e[r]))return!1;return!0}pip(t,e){return r()%2!==0;function r(){let i=e.end(),n=0,{x:s,y:a}=t;for(let c of e.primitives){if(i.y>a?c.bbox().minY>a:c.bbox().maxY<=a){i=c.end();continue}if(c instanceof q&&(c.isCCW?Math.floor(c.startAngle/90)+1!==Math.ceil(c.endAngle()/90):Math.ceil(c.startAngle/90)-1!==Math.floor(c.endAngle()/90))){let h=c.startAngle,u=c.endAngle();if(c.sweepAngle>0){let d=90;for(;d<=u;)d>h&&(l(q.build3(c.center,h,d-h,c.rx,c.ry)),h=d),d+=90;h<u&&l(q.build3(c.center,h,u-h,c.rx,c.ry))}else{let d=270;for(;d>=u;)d<h&&(l(q.build3(c.center,h,d-h,c.rx,c.ry)),h=d),d-=90;h>u&&l(q.build3(c.center,h,u-h,c.rx,c.ry))}}else l(c)}return n;function l(c){let h=c.start(),u=c.end();if(i.y>a!=h.y>a&&(i.x>s?h.x>s?n+=h.y>i.y?1:-1:i.y>h.y?(i.x-s)*(h.y-a)-(i.y-a)*(h.x-s)<0&&n--:(i.x-s)*(h.y-a)-(i.y-a)*(h.x-s)>0&&n++:h.x>s&&(i.y>h.y?(i.x-s)*(h.y-a)-(i.y-a)*(h.x-s)<0&&n--:(i.x-s)*(h.y-a)-(i.y-a)*(h.x-s)>0&&n++)),h.y>a!=u.y>a){if(h.x>s)if(u.x>s)n+=u.y>h.y?1:-1;else if(c instanceof M)h.y>u.y?(h.x-s)*(u.y-a)-(h.y-a)*(u.x-s)<0&&n--:(h.x-s)*(u.y-a)-(h.y-a)*(u.x-s)>0&&n++;else if(c instanceof q){let{center:d,isCCW:p,rx2:m}=c,g=(d.x-s)**2+(d.y-a)**2;h.y>u.y?(p?g>m:g<m)&&n--:(p?g<m:g>m)&&n++}else throw new Error("not support!");else if(u.x>s)if(c instanceof M)h.y>u.y?(h.x-s)*(u.y-a)-(h.y-a)*(u.x-s)<0&&n--:(h.x-s)*(u.y-a)-(h.y-a)*(u.x-s)>0&&n++;else if(c instanceof q){let{center:d,isCCW:p,rx2:m}=c,g=(d.x-s)**2+(d.y-a)**2;h.y>u.y?(p?g>m:g<m)&&n--:(p?g<m:g>m)&&n++}else throw new Error("not support!")}i=u}}}pipsSASM(t,e,r){let i=e[0];if(!this.pip(t,i))return!1;let n=r.search(new ht(t.x-1e-5,t.x+1e-5,t.y-1e-5,t.y+1e-5));for(let s=0;s<n.length;s++)if(this.pip(t,n[s]))return!1;return!0}},rx=new hIe;var zk=class extends Wk{checkCache(t,e,r){if(r=r==0?1e-8:r,t instanceof md){if(e instanceof md)return this.check(t.shape,e.shape,(t.width+e.width)/2+r);if(e instanceof Yd){if(e.shape==null)return!1;let n=(t.width+e.width)/2+r;for(let s of e.getShapes(t.shape,n))if(this.check(t.shape,s,n))return!0;return!1}else{if(e instanceof ku)return this.check(t.shape,e.shape,t.width/2+r);if(e instanceof qu)return this.check(t.shape,e.shape,(t.width+e.width)/2+r)}}else if(t instanceof Yd){let i=t.shape;if(e instanceof md){let n=(t.width+e.width)/2+r;for(let s of t.getShapes(e.shape,n))if(this.check(e.shape,s,n))return!0;return!1}else if(e instanceof Yd){let n=(t.width+e.width)/2+r;for(let s of i)for(let a of e.getShapes(s,n))if(this.check(a,s,n))return!0;return!1}else if(e instanceof ku){let n=t.width/2+r;for(let s of t.getShapes(e.shape,n))if(this.check(e.shape,s,n))return!0;return!1}else if(e instanceof qu){let n=(t.width+e.width)/2+r;for(let s of t.getShapes(e.shape,n))if(this.check(e.shape,s,n))return!0;return!1}}else if(t instanceof ku){if(e instanceof md)return this.check(t.shape,e.shape,e.width/2+r);if(e instanceof Yd){let i=e.width/2+r;for(let n of e.getShapes(t.shape,i))if(this.check(t.shape,n,i))return!0;return!1}else{if(e instanceof ku)return this.check(t.shape,e.shape,r);if(e instanceof qu)return this.check(t.shape,e.shape,e.width/2+r)}}else if(t instanceof qu){if(e instanceof md)return this.check(t.shape,e.shape,(t.width+e.width)/2+r);if(e instanceof Yd){let i=(t.width+e.width)/2+r;for(let n of e.getShapes(t.shape,i))if(this.check(t.shape,n,i))return!0;return!1}else{if(e instanceof ku)return this.check(t.shape,e.shape,t.width/2+r);if(e instanceof qu)return this.check(t.shape,e.shape,(t.width+e.width)/2+r)}}return!1}check(t,e,r){if(!t.bbox().isIntersect(e.bbox().extendOfSize(r)))return!1;if(t instanceof rl){if(e instanceof rl)return this.checkPts(t,e,r);if(e instanceof ge)return this.checkPt2Pl(t,e,r);if(e instanceof Bt)return this.checkPt2PlGrp(t,e,r)}else if(t instanceof ge){if(e instanceof rl)return this.checkPt2Pl(e,t,r);if(e instanceof ge)return this.checkPls(t,e,r);if(e instanceof Bt)return this.checkPl2PlGrp(t,e,r)}else if(t instanceof Bt){if(e instanceof rl)return this.checkPt2PlGrp(e,t,r);if(e instanceof ge)return this.checkPl2PlGrp(e,t,r);if(e instanceof Bt)return this.checkPlGrps(t,e,r)}return!1}checkPts(t,e,r){if(t.start().distance1(e.end())<r||t.end().distance1(e.start())<r||t.start().distance1(e.start())<r||t.end().distance1(e.end())<r)return!0;let n=new er(t,e).getDistance();return ne.lesseq(n,r)}checkPt2Pl(t,e,r){let i=jr.inPolyline(t.start(),e);if(i||(i=jr.inPolyline(t.end(),e)),i)return!0;{let n=Number.MAX_VALUE,s=t.bbox().extendOfSize(r);for(let a of e.primitives)if(!this.isPoints(a)&&s.isIntersect(a.bbox())&&(n=this.getDistance(a,t,n),ne.lesseq(n,r)))return!0;return!1}}checkPt2PlGrp(t,e,r){let i=this.getInpolylines(e),n=i.inPolygon(t.start(),e.items);if(n||(n=i.inPolygon(t.end(),e.items)),n)return!0;{let s=Number.MAX_VALUE,a=t.bbox().extendOfSize(r),c=this.getRtree(e).search(a);for(let h of c)if(!this.isPoints(h)&&a.isIntersect(h.bbox())&&(s=this.getDistance(h,t,s),ne.lesseq(s,r)))return!0;return!1}}checkPls(t,e,r){let i=rx.pip(t.start(),e);if(i||(i=rx.pip(e.end(),t)),i)return!0;{let n=Number.MAX_VALUE;for(let s of t.primitives){if(this.isPoints(s))continue;let a=s.bbox().extendOfSize(r);if(a.isIntersect(e.bbox())){for(let l of e.primitives)if(!this.isPoints(l)&&a.isIntersect(l.bbox())&&(n=this.getDistance(s,l,n),ne.lesseq(n,r)))return!0}}return!1}}checkPl2PlGrp(t,e,r){let n=this.getInpolylines(e).inPolygon(t.start(),e.items);if(n||(n=jr.inPolyline(e.items[0].start(),t)),n)return!0;{let s=Number.MAX_VALUE,a=this.getRtree(e);for(let l of t.primitives){if(this.isPoints(l))continue;let c=l.bbox().extendOfSize(r),h=a.search(c);for(let u of h)if(!this.isPoints(u)&&c.isIntersect(u.bbox())&&(s=this.getDistance(u,l,s),ne.lesseq(s,r)))return!0}return!1}}checkPlGrps(t,e,r){let i=this.getInpolylines(t),n=this.getInpolylines(e),s=t.items.length>0?n.inPolygon(t.items[0].start(),e.items):!1;if(s||(s=e.items.length>0?i.inPolygon(e.items[0].start(),t.items):!1),s)return!0;{let a=Number.MAX_VALUE,l=this.getRtree(t),c=this.getRtree(e);if(t.bbox().area()>e.bbox().area())for(let h of e.items)for(let u of h.primitives){let d=u.bbox().extendOfSize(r),p=l.search(d);for(let m of p)if(!this.isPoints(m)&&d.isIntersect(m.bbox())&&(a=this.getDistance(m,u,a),ne.lesseq(a,r)))return!0}else for(let h of t.items)for(let u of h.primitives){let d=u.bbox().extendOfSize(r),p=c.search(d);for(let m of p)if(!this.isPoints(m)&&d.isIntersect(m.bbox())&&(a=this.getDistance(m,u,a),ne.lesseq(a,r)))return!0}return!1}}getDistance(t,e,r){let n=new er(t,e).getDistance();return ne.lesseq(n,r)&&(r=n),r}};var hn=class o extends jl{constructor(e,r,i,n,s,a,l,c,h,u,d=.8,p){super(e,i,p||Jh(c));this.modelType="Copper";if(this._layerId=r,this._style=n,this._gridLineWidth=s,this._clearance=a,this._optimization=l,this._locked=h,this._optimizationWidth=d,u==null){let m=new _e,g=null,y=null,b=this.pls.length;for(let P=0;P<b;P++)y=this.pls[P],g=y.bbox(),m.ext1(g);switch(n){case"solid":{l&&m.ext7(d/2);break}case"90grid":case"45grid":{m.ext7(s/2);break}case"none":break}u=m.build1()}this._bbox=u}get modify(){return!1}set modify(e){}get layerId(){return this._layerId}set layerId(e){this._layerId!=e&&(this.watchLayerIdModify(this._layerId),this._layerId=e,this.layerModified=!0)}get bbox(){return this._bbox}get locked(){return this._locked}set locked(e){this._locked=e}get style(){return this._style}set style(e){this._style!=e&&(this._style=e,this.updateShapeData())}get gridLineWidth(){return this._gridLineWidth}set gridLineWidth(e){this._gridLineWidth!=e&&(this._gridLineWidth=e,this.updateShapeData())}get clearance(){return this._clearance}set clearance(e){this._clearance!=e&&(this._clearance=e,this.updateShapeData())}get optimization(){return this._optimization}set optimization(e){this._optimization!=e&&(this._optimization=e,this.updateShapeData())}get optimizationWidth(){return this._optimizationWidth}set optimizationWidth(e){this._optimizationWidth!=e&&(this._optimizationWidth=e,this.updateShapeData())}get isSolid(){return this.style=="solid"}get copperPath(){return this.source}transform(e){}updateBox(){let e=new _e;for(let r of this.pls)e.ext1(r.bbox());switch(this.style){case"solid":{this.optimization&&e.ext7(this.optimizationWidth/2);break}case"90grid":case"45grid":{e.ext7(this.gridLineWidth/2);break}case"none":break}return this._bbox=e.build1(),this._bbox}clone(){this.refreshBBox&&this.updateBox();let e=new o(this.globalIndex,this.layerId,this.showNet,this.style,this.gridLineWidth,this.clearance,this.optimization,this.source,this.locked,this._bbox,this.optimizationWidth);return e.number=this.number,e.zIndex=this.zIndex,e}inShape(e,r){let{style:i,optimization:n,gridLineWidth:s}=this,a=new S(e,r);switch(i){case"solid":{let l=jr.inPolygon(a,this.pls);if(!l&&n){for(let c of this.pls)for(let h of c.primitives)if(h instanceof M?l=Da(a,h.start(),h.end(),this.optimizationWidth):h instanceof q&&(l=$0(a,h.center,h.rx,h.startAngle/180*Math.PI,h.endAngle()/180*Math.PI,h.sweep(),this.optimizationWidth)),l)return l}return l}case"90grid":case"45grid":{let l=!1;for(let c of this.pls)for(let h of c.primitives)if(h instanceof M?l=Da(a,h.start(),h.end(),s):h instanceof q&&(l=$0(a,h.center,h.rx,h.startAngle/180*Math.PI,h.endAngle()/180*Math.PI,h.sweep(),s)),l)return l;return!1}case"none":break}return!1}rotateFor(e,r){let i=Ae.rotateZForPoint(e,r);this.transform(i)}getOutline(e=this.layerId,r=0){return this.pls}getRealOutline(){let e=new Array,{style:r,optimization:i,gridLineWidth:n}=this;for(let s of this.pls)switch(r){case"solid":{if(e.push(s),i)for(let a of s.primitives){let l=a.stroke(this.optimizationWidth,wr.ROUND,ae.CW);e.push(l)}break}case"90grid":case"45grid":{for(let a of s.primitives){let l=a.stroke(n,wr.ROUND,ae.CW);e.push(l)}break}case"none":break}return e}getMathGraphics(e=this.layerId,r=0){let i=new Array,{style:n,optimization:s,gridLineWidth:a}=this;switch(n){case"solid":if(xe.addAll(i,this.pls),s)for(let l of this.pls)for(let c of l.primitives)i.push(c.stroke(this.optimizationWidth,wr.ROUND,ae.CW));case"90grid":case"45grid":for(let l of this.pls)for(let c of l.primitives)i.push(c.stroke(a,wr.ROUND,ae.CW));case"none":break}return new Bt(i)}initRTree(){if(this.style==="solid"||this.isEmpty)return;this._rTree||(this._rTree=new ji(10));let e=this.pls;for(let r of e){let i=r.primitives;for(let n of i)this._rTree.add(n)}}search(e){var i;return this._rTree||this.initRTree(),e=e.extendSize(this.gridLineWidth),((i=this._rTree)==null?void 0:i.search(e))||[]}};var yn=class o extends jl{constructor(e,r,i,n,s,a,l,c){super(e,i,c||Jh(s));this.modelType="Inner";if(this._layerId=r,this._style=n,this._locked=a,l==null){let h=new _e,u=null,d=null,p=this.pls.length;for(let m=0;m<p;m++)d=this.pls[m],u=d.bbox(),h.ext1(u);l=h.build1()}this._bbox=l}get layerId(){return this._layerId}set layerId(e){this._layerId!=e&&(this.watchLayerIdModify(this._layerId),this._layerId=e,this.layerModified=!0)}get bbox(){return this._bbox}get locked(){return this._locked}set locked(e){this._locked=e}get style(){return this._style}set style(e){this._style!=e&&(this._style=e,this.updateShapeData())}get showNet(){return this._net}get copperPath(){return this.source}transform(e){}inShape(e,r,i){return jr.inPolygon(new S(e,r),this.pls)}getOutline(e,r){return this.pls}clone(){this.refreshBBox&&this.updateBox();let e=new o(this.globalIndex,this.layerId,this.showNet,this.style,this.source,this.locked,this.bbox);return e.number=this.number,e.zIndex=this.zIndex,e}getMathGraphics(e=this.layerId,r=0){return new Bt(this.pls)}};var uIe=class{constructor(){this.CacheElementManagerInstance=Zh.getInstance()}getTrackCache(t){let{globalIndex:e,layerId:r}=t,i=this.CacheElementManagerInstance.getCache(e,r);return i==null&&(i=this.CacheElementManagerInstance.addCache(e,r,t.primitive,t.width)),i}getPadCache(t,e=t.layerId){let{globalIndex:r}=t,i=this.CacheElementManagerInstance.getCache(r,e);return i==null&&(i=this.CacheElementManagerInstance.addCache(r,e,t.getMathGraphics(e))),i}getViaCache(t,e=t.layerId){let{globalIndex:r}=t,i=this.CacheElementManagerInstance.getCache(r,e);return i==null&&(i=this.CacheElementManagerInstance.addCache(r,e,t.getMathGraphics(e))),i}getTearDropCache(t){let{globalIndex:e,layerId:r}=t,i=this.CacheElementManagerInstance.getCache(e,r);return i==null&&(i=this.CacheElementManagerInstance.addCache(e,r,t.getMathGraphics(r))),i}getProfileCache(t){let e=t.layerId;switch(t.type){case"Line":{let{globalIndex:r}=t,i=this.CacheElementManagerInstance.getCache(r,e);return i==null&&(i=this.CacheElementManagerInstance.addCache(r,e,t.getMathGraphics(e).primitives,t.strokeWidth)),i}case"Board Outline":{let{globalIndex:r}=t,i=this.CacheElementManagerInstance.getCache(r,e);return i==null&&(i=this.CacheElementManagerInstance.addCache(r,e,t.getMathGraphics(e))),i}case"Prohibited Region":case"Fill Region":case"TearDrop":case"Slot Region":{let{globalIndex:r}=t,i=this.CacheElementManagerInstance.getCache(r,e);return i==null&&(i=this.CacheElementManagerInstance.addCache(r,e,t.getMathGraphics(e))),i}default:return null}}getFillCache(t,e){let{globalIndex:r,layerId:i}=t;if(t instanceof hn){let n=this.CacheElementManagerInstance.getCache(r,i);if(t.style=="solid"){if(n==null){let s=t.optimization?t.optimizationWidth:0;n=this.CacheElementManagerInstance.addCache(r,i,new Bt(t.pls),s)}}else{if(e){let s=r+"_"+e.globalIndex;if(n=this.CacheElementManagerInstance.getCache(s,i),n==null){let a=t.search(e.bbox),l=t.gridLineWidth;n=this.CacheElementManagerInstance.addCache(s,i,a,l)}return n}if(n==null){let s=new Array,a=t.pls;for(let c of a)xe.addAll(s,c.primitives);let l=t.gridLineWidth;n=this.CacheElementManagerInstance.addCache(r,i,s,l)}}return n}else if(t instanceof yn){let n=this.CacheElementManagerInstance.getCache(r,i);return n==null&&(n=this.CacheElementManagerInstance.addCache(r,i,new Bt(t.pls))),n}}},lo=new uIe;var uy=class{constructor(){this.collisionCheck=new zk}checkIntersection(t,e){return t.isEmpty||e.isEmpty||t==e?!1:t instanceof gt?this.dispatchTrackCheck(t,e):t instanceof et?this.dispatchPadCheck(t,e):t instanceof Ct?this.dispatchViaCheck(t,e):t instanceof or?t.type=="TearDrop"?this.dispatchTearCheck(t,e):this.dispatchProfileCheck(t,e):t instanceof jl?this.dispatchCopperCheck(t,e):!1}dispatchTrackCheck(t,e){return e instanceof gt?this.checkTracks(t,e):e instanceof et?this.checkTrackPad(t,e):e instanceof Ct?this.checkTrackVia(t,e):e instanceof or?e.type=="TearDrop"?this.checkTrackTear(t,e):this.checkTrackProfile(t,e):e instanceof jl?this.checkTrackCopper(t,e):!1}dispatchPadCheck(t,e){return e instanceof gt?this.checkTrackPad(e,t):e instanceof et?this.checkPads(t,e):e instanceof Ct?this.checkPadVia(t,e):e instanceof or?e.type=="TearDrop"?this.checkPadTear(t,e):this.checkPadProfile(t,e):e instanceof jl?this.checkPadCopper(t,e):!1}dispatchViaCheck(t,e){return e instanceof gt?this.checkTrackVia(e,t):e instanceof et?this.checkPadVia(e,t):e instanceof Ct?this.checkVias(t,e):e instanceof or?e.type=="TearDrop"?this.checkViaTear(t,e):this.checkViaProfile(t,e):e instanceof jl?this.checkViaCopper(t,e):!1}dispatchProfileCheck(t,e){return e instanceof gt?this.checkTrackProfile(e,t):e instanceof et?this.checkPadProfile(e,t):e instanceof Ct?this.checkViaProfile(e,t):e instanceof or?e.type=="TearDrop"?this.checkTearProfile(e,t):this.checkProfiles(t,e):e instanceof jl?this.checkProfileCopper(t,e):!1}dispatchCopperCheck(t,e){return e instanceof gt?this.checkTrackCopper(e,t):e instanceof et?this.checkPadCopper(e,t):e instanceof Ct?this.checkViaCopper(e,t):e instanceof or?e.type=="TearDrop"?this.checkTearCopper(e,t):this.checkProfileCopper(e,t):e instanceof jl?this.checkCoppers(e,t):!1}dispatchTearCheck(t,e){return e instanceof gt?this.checkTrackTear(e,t):e instanceof et?this.checkPadTear(e,t):e instanceof Ct?this.checkViaTear(e,t):e instanceof or?e.type=="TearDrop"?this.checkTears(t,e):this.checkTearProfile(t,e):e instanceof jl?this.checkTearCopper(t,e):!1}checkTracks(t,e){let r=lo.getTrackCache(t),i=lo.getTrackCache(e);return this.collisionCheck.checkCache(r,i,0)}checkTrackPad(t,e){let r=lo.getTrackCache(t),i=lo.getPadCache(e,t.layerId),n=this.collisionCheck.checkCache(r,i,0);if(!n&&e.plated){let s=lo.getPadCache(e,12);return this.collisionCheck.checkCache(r,s,0)}return n}checkTrackVia(t,e){let r=lo.getTrackCache(t),i=lo.getViaCache(e,t.layerId);if(i!=null){let s=Math.max(t.width/2,e.radius);if(t.start.distance1(e.center)<s||t.end.distance1(e.center)<s)return!0}let n=this.collisionCheck.checkCache(r,i,0);if(!n){let s=lo.getViaCache(e,12);if(s!=null){let a=Math.max(t.width/2,e.holeRadius);if(t.start.distance1(e.center)<a||t.end.distance1(e.center)<a)return!0}return this.collisionCheck.checkCache(r,s,0)}return n}checkPads(t,e){let r=t.layerId,i=e.layerId,n=ar(r),s=ar(i);if(n&&s){let a=Ze.getInstance().getAllCopperLayerIds();for(let u of a){let d=lo.getPadCache(t,u),p=lo.getPadCache(e,u),m=this.collisionCheck.checkCache(d,p,0);if(m)return m}let l=lo.getPadCache(t,12);if(t.plated&&this.checkMultiPad(e,l,a))return!0;let c=lo.getPadCache(e,12);if(e.plated&&this.checkMultiPad(t,c,a))return!0;let h=t.plated&&e.plated&&this.collisionCheck.checkCache(l,c,0);return h||!1}else{let a=n?i:r,l=lo.getPadCache(t,a),c=lo.getPadCache(e,a),h=this.collisionCheck.checkCache(l,c,0);if(!h){let u=n?t:e;if(u.plated){let d=lo.getPadCache(u,12);return this.collisionCheck.checkCache(n?c:l,d,0)}}return h}}checkMultiPad(t,e,r){for(let i of r){let n=lo.getPadCache(t,i),s=this.collisionCheck.checkCache(n,e,0);if(s)return s}return!1}checkPadVia(t,e){let r=t.layerId,i=ar(r),n=lo.getViaCache(e,e.startLayer);if(i){let s=Ze.getInstance().getAllCopperLayerIds();if(n!=null)for(let h of s){let u=lo.getPadCache(t,h),d=this.collisionCheck.checkCache(u,n,0);if(d)return d}let a=lo.getPadCache(t,12);if(t.plated&&n!=null){let h=this.collisionCheck.checkCache(a,n,0);if(h)return h}let l=lo.getViaCache(e,12),c=this.checkMultiPad(t,l,s);return c||t.plated&&this.collisionCheck.checkCache(a,l,0)}else{let s=lo.getPadCache(t,t.layerId),a=this.collisionCheck.checkCache(s,n,0);if(!a){let l=lo.getViaCache(e,12);return this.collisionCheck.checkCache(s,l,0)}return a}}checkVias(t,e){let r=lo.getViaCache(t,t.startLayer),i=lo.getViaCache(e,e.startLayer),n=t.center.distance1(e.center);if(r!=null&&i!=null){if(ne.lesseq(n,t.radius+e.radius))return!0}else{let l=this.collisionCheck.checkCache(r,i,0);if(l)return l}let s=lo.getViaCache(t,12);if(s!=null&&i!=null){if(ne.lesseq(n,t.holeRadius+e.radius))return!0}else{let l=this.collisionCheck.checkCache(s,i,0);if(l)return l}let a=lo.getViaCache(e,12);if(r!=null&&a!=null){if(ne.lesseq(n,t.radius+e.holeRadius))return!0}else{let l=this.collisionCheck.checkCache(r,a,0);if(l)return l}return ne.lesseq(n,t.holeRadius+e.holeRadius)}checkTrackProfile(t,e){let r=lo.getTrackCache(t),i=lo.getProfileCache(e);return this.collisionCheck.checkCache(r,i,0)}checkTrackCopper(t,e){let r=lo.getTrackCache(t),i=lo.getFillCache(e,t);return this.collisionCheck.checkCache(r,i,0)}checkPadProfile(t,e){let r=lo.getPadCache(t,e.layerId),i=lo.getProfileCache(e),n=this.collisionCheck.checkCache(r,i,0);if(!n&&ar(t.layerId)&&t.plated){let s=lo.getPadCache(t,12);return this.collisionCheck.checkCache(s,i,0)}return n}checkPadCopper(t,e){let r=lo.getPadCache(t,e.layerId),i=lo.getFillCache(e,t),n=this.collisionCheck.checkCache(r,i,0);if(!n&&ar(t.layerId)&&t.plated){let s=lo.getPadCache(t,12);return this.collisionCheck.checkCache(s,i,0)}return n}checkViaProfile(t,e){let r=lo.getViaCache(t,t.startLayer),i=lo.getProfileCache(e),n=this.collisionCheck.checkCache(r,i,0);if(!n){let s=lo.getViaCache(t,12);return this.collisionCheck.checkCache(s,i,0)}return n}checkViaCopper(t,e){let r=lo.getViaCache(t,t.startLayer),i=lo.getFillCache(e,t),n=this.collisionCheck.checkCache(r,i,0);if(!n){let s=lo.getViaCache(t,12);return this.collisionCheck.checkCache(s,i,0)}return n}checkProfiles(t,e){let r=lo.getProfileCache(t),i=lo.getProfileCache(e);return this.collisionCheck.checkCache(r,i,0)}checkProfileCopper(t,e){let r=lo.getProfileCache(t),i=lo.getFillCache(e,t);return this.collisionCheck.checkCache(r,i,0)}checkCoppers(t,e){let r=lo.getFillCache(t,e),i=lo.getFillCache(e,t);return this.collisionCheck.checkCache(r,i,0)}checkTrackTear(t,e){let r=lo.getTrackCache(t),i=lo.getTearDropCache(e);return this.collisionCheck.checkCache(r,i,0)}checkPadTear(t,e){let r=lo.getPadCache(t,e.layerId),i=lo.getTearDropCache(e),n=this.collisionCheck.checkCache(r,i,0);if(!n&&ar(t.layerId)&&t.plated){let s=lo.getPadCache(t,12);return this.collisionCheck.checkCache(s,i,0)}return n}checkViaTear(t,e){let r=lo.getViaCache(t,t.startLayer),i=lo.getTearDropCache(e),n=this.collisionCheck.checkCache(r,i,0);if(!n){let s=lo.getViaCache(t,12);return this.collisionCheck.checkCache(s,i,0)}return n}checkTearProfile(t,e){let r=lo.getTearDropCache(t),i=lo.getProfileCache(e);return this.collisionCheck.checkCache(r,i,0)}checkTearCopper(t,e){let r=lo.getTearDropCache(t),i=lo.getFillCache(e,t);return this.collisionCheck.checkCache(r,i,0)}checkTears(t,e){let r=lo.getTearDropCache(t),i=lo.getTearDropCache(e);return this.collisionCheck.checkCache(r,i,0)}};var hY=class{constructor(t){this.result=new Map;this.tool=new uy;this.maps=t,this.check()}add2Result(t,e,r){if(t>e){let i=e;e=t,t=i}this.result.get(t)==null&&this.result.set(t,new Map),this.result.get(t).set(e,r)}check(){Zh.getInstance().clear();for(let t of this.maps){let e=this.tool.checkIntersection(t[0],t[1]);this.add2Result(t[0].globalIndex,t[1].globalIndex,e)}}};var jL=class jL extends Ei{static getInstance(){return jL.manager==null&&(jL.manager=new jL),jL.manager}addItem(t,e){this.map.set(t,e)}delete(t){this.map.delete(t)}};jL.manager=null;var pte=jL;var dIe=xT(),Pb=dIe.top||dIe;try{Pb.location&&Pb.location.search}catch{Pb=null}var nSt="-time-diff",fte=Pb&&oSt();function oSt(){let o=dIe.PRO_LOG_LEVEL;return o=="trace"||o=="debug"}function pIe(o){return o+nSt}function sSt(o,t){let e=pIe(o);Array.isArray(Pb[e])?Pb[e].push(t):Pb[e]=[t]}function uY(o){let t=pIe(o),e=Pb[t];return Array.isArray(e)?e:[]}function aSt(o){let t=0;return uY(o).forEach(e=>t+=e),t}function FBe(o){delete Pb[pIe(o)]}function Yk(o,t=3){return+o.toFixed(t)}function Cn(o,t=!1){if(!fte)return;let e=new Date().getTime();t&&Pb[o]||(Pb[o]=e)}function mte(o){if(!fte)return;let t=Pb[o];return!isNaN(t)}function Xi(o,t=0){if(!fte)return;let e=Pb[o];if(isNaN(e))return!1;let r=new Date().getTime(),i=Yk((r-e)/1e3);return i>=t&&og(o,void 0,`${i}s`),sSt(o,i),delete Pb[o],!0}function fIe(o,t=""){if(!fte)return;let e=Array.isArray(o)?o:Object.keys(o),r=t&&uY(t),i=0;if(r.length==0?e.forEach(a=>{let l=aSt(a);i+=l}):r.forEach(a=>i+=a),i==0){e.forEach(a=>{FBe(a)});return}let n={},s=0;e.forEach(a=>{let l=uY(a),c=0;l.forEach(u=>c+=u);let h=c/i*100;s+=h,n[a]={desc:o[a]||a,"time(s)":Yk(c),"ratio(%)":Yk(h),records:l.length>1?`(${l.length}): ${l.join(", ")}`:l.length},FBe(a)}),s!=0&&(og(t,{color:"#ffff00"},`${Yk(i)}s`,`${Yk(i*s/100)}s(${Yk(s)}%)`),console.table(n))}function gte(){let o="createPcbEditorToRendered-time",t="createIframe-time",e="loadFrame-time",r="rpcInitFrameInfoInit-time",i="pcbDataStrDecode-time",n="buildController-time",s="attachModify-time",a="updateRTree-time",l="rebuildRatline-time",c="annotationModify-time",h="updateDRC-time",u="ratlineResultFromWorker-time";fIe({[t]:"\u521B\u5EFAiframe",[e]:"\u52A0\u8F7Diframe",[r]:"\u7F16\u8F91\u5668\u521D\u59CB\u5316",[i]:"\u89E3\u7801 & \u6784\u5EFA\u6570\u636E\u6A21\u578B",[n]:"\u6784\u5EFA\u4E1A\u52A1\u6A21\u578B",[s]:"\u66F4\u65B0\u89C6\u56FE\u5C42\u53D8\u5316",[a]:"\u66F4\u65B0rTree",[l]:"\u91CD\u5EFA\u98DE\u7EBF",[c]:"\u66F4\u65B0\u6279\u6CE8",[h]:"\u66F4\u65B0DRC",[u]:"worker\u98DE\u7EBF\u7ED3\u679C"},o)}var ix=class o extends xi{constructor(e,r,i,n,s,a,l,c){super();this.modelType="Ratline";this.globalIndex=e,this.net=n,this.startId=s,this.endId=a,this._start=r,this._end=i,this._locked=l,this.shapeModified=!0}get modify(){return!1}set modify(e){}get layerId(){return 57}set layerId(e){}get start(){return this._start}set start(e){this._start!=e&&(this._start=e,this.updateShapeData())}get end(){return this._end}set end(e){this._end!=e&&(this._end=e,this.updateShapeData())}get bbox(){return new _e().ext2(this.start).ext2(this.end).build1()}get length(){return this.start.distance1(this.end)}get locked(){return this._locked}set locked(e){this._locked=e}rotateFor(e,r){}transform(e){}inOutline(e){return this.inShape(e.x,e.y)}inShape(e,r,i){let n=Ai().getScale();return Da(new S(e,r),this.start,this.end,0,n)}updateBox(){return this.bbox}clone(){this.refreshBBox&&this.updateBox();let e=new o(this.globalIndex,this.start,this.end,this.net,this.startId,this.endId,this.locked,this.bbox);return e.number=this.number,e.zIndex=this.zIndex,e}};var XL=class XL extends Ei{constructor(){super(...arguments);this.idMap=new Map;this._lastRatline=null}static getInstance(){return XL.manager==null&&(XL.manager=new XL),XL.manager}add(e,r,i,n,s,a){let l=new ix(e,r,i,n,s,a,!1,null),c=this.map.get(n);return c==null&&(c=new Array,this.map.set(n,c)),c.push(l),this.idMap.set(e,l),l}delete(e){let r=this.map.get(e);if(r!=null)for(let i of r)this.idMap.delete(i.globalIndex);this.map.delete(e)}deleteById(e){if(this._lastRatline=this.idMap.get(e),this.idMap.delete(e),this._lastRatline!=null&&(this._last=this.map.get(this._lastRatline.net),this._last!=null)){let r=this._last.indexOf(this._lastRatline);r>=0&&this._last.splice(r,1),this._last.length==0&&this.map.delete(this._lastRatline.net)}}getRatlineByNetName(e){return this.map.get(e)||[]}getRatlineLengthByName(e){let r=this.getRatlineByNetName(e),i=0;return r.forEach(n=>i+=n.length),i}getRatlineById(e){return this.idMap.get(e)}getAllNets(){let e=new Array(this.map.size),r=0;for(let i of this.map.values())e[r]=i,r++;return e}getAllRatlines(){return this.idMap.values()}recycle(){super.recycle(),this.idMap.clear()}};XL.manager=null;var UP=XL;var Tb=class{constructor(t){this.item=t}get near(){return this._near==null?new Set:Array.isArray(this._near)?new Set(this._near):this._near}addNear(t){if(this._near==null&&(this._near=new Array),Array.isArray(this._near)){if(this._near.includes(t))return;this._near.push(t),this._near.length>50&&(this._near=new Set(this._near))}else this._near.add(t)}deleteNear(t){if(this._near!=null)if(Array.isArray(this._near)){let e=this._near.indexOf(t);e>=0&&this._near.splice(e,1)}else this._near.delete(t)}deleteAllNear(){this._near!=null&&(this._near=new Array)}cluster(){let t=[this],e=new Set;for(e.add(this);t.length;){let r=t.pop();for(let i of r.near)e.has(i)||(t.push(i),e.add(i))}return Array.from(e)}bbox(){return this.item.bbox}};var gd=class{constructor(){this.whetherCheckNet=!0}needCheckIntersection(t,e){return t.isEmpty||e.isEmpty||t==e?!1:t instanceof gt?this.dispatchTrackCheck(t,e):t instanceof et?this.dispatchPadCheck(t,e):t instanceof Ct?this.dispatchViaCheck(t,e):t instanceof or?t.type=="TearDrop"?this.dispatchTearCheck(t,e):this.dispatchProfileCheck(t,e):t instanceof hn||t instanceof yn?this.dispatchCopperCheck(t,e):!1}dispatchTrackCheck(t,e){return e instanceof gt?this.checkTracks(t,e):e instanceof et?this.checkTrackPad(t,e):e instanceof Ct?this.checkTrackVia(t,e):e instanceof or?e.type=="TearDrop"?this.checkTrackTear(t,e):this.checkTrackProfile(t,e):e instanceof hn||e instanceof yn?this.checkTrackCopper(t,e):!1}dispatchPadCheck(t,e){return e instanceof gt?this.checkTrackPad(e,t):e instanceof et?this.checkPads(t,e):e instanceof Ct?this.checkPadVia(t,e):e instanceof or?e.type=="TearDrop"?this.checkPadTear(t,e):this.checkPadProfile(t,e):e instanceof hn||e instanceof yn?this.checkPadCopper(t,e):!1}dispatchViaCheck(t,e){return e instanceof gt?this.checkTrackVia(e,t):e instanceof et?this.checkPadVia(e,t):e instanceof Ct?this.checkVias(t,e):e instanceof or?e.type=="TearDrop"?this.checkViaTear(t,e):this.checkViaProfile(t,e):e instanceof hn||e instanceof yn?this.checkViaCopper(t,e):!1}dispatchProfileCheck(t,e){return e instanceof gt?this.checkTrackProfile(e,t):e instanceof et?this.checkPadProfile(e,t):e instanceof Ct?this.checkViaProfile(e,t):e instanceof or?e.type=="TearDrop"?this.checkProfileTear(t,e):this.checkProfiles(t,e):e instanceof hn||e instanceof yn?this.checkProfileCopper(t,e):!1}dispatchCopperCheck(t,e){return e instanceof gt?this.checkTrackCopper(e,t):e instanceof et?this.checkPadCopper(e,t):e instanceof Ct?this.checkViaCopper(e,t):e instanceof or?e.type=="TearDrop"?this.checkTearCopper(e,t):this.checkProfileCopper(e,t):e instanceof hn||e instanceof yn?this.checkCoppers(e,t):!1}dispatchTearCheck(t,e){return e instanceof gt?this.checkTrackTear(e,t):e instanceof et?this.checkPadTear(e,t):e instanceof Ct?this.checkViaTear(e,t):e instanceof or?e.type=="TearDrop"?this.checkTears(t,e):this.checkProfileTear(e,t):e instanceof hn||e instanceof yn?this.checkTearCopper(t,e):!1}checkTracks(t,e){return!(t.length<1e-8||e.length<1e-8||t.layerId!=e.layerId||this.whetherCheckNet&&t.net!=e.net)}checkTrackPad(t,e){if(t.length<1e-8)return!1;let r=ar(e.layerId);return!(!r&&t.layerId!=e.layerId||r&&!e.plated&&e.isUnuseLayer(t.layerId)||this.whetherCheckNet&&t.net!=e.net)}checkTrackVia(t,e){return!(t.length<1e-8||this.whetherCheckNet&&t.net!=e.net||!e.isContains(t.layerId))}checkPads(t,e){let r=ar(t.layerId),i=ar(e.layerId);if(r&&!i){if(!t.plated&&t.isUnuseLayer(e.layerId))return!1}else if(!r&&i&&!e.plated&&e.isUnuseLayer(t.layerId))return!1;return!(!r&&!i&&t.layerId!=e.layerId||this.whetherCheckNet&&t.net!=e.net)}checkPadVia(t,e){if(this.whetherCheckNet&&t.net!=e.net)return!1;let r=t.layerId,i=ar(r);if(!i&&!e.isContains(r))return!1;if(i&&!t.plated){if(e.isContains(1)||e.isContains(2))return!0;{let n=Ze.getInstance().getAllCopperLayerIds();for(let s of n)if(s!=1&&s!=2&&e.isContains(s)&&!t.isUnuseLayer(s))return!0;return!1}}return!0}checkVias(t,e){return!(this.whetherCheckNet&&t.net!=e.net||!e.isContains(t.startLayer)&&!e.isContains(t.endLayer))}checkTrackProfile(t,e){if(t.length<1e-8)return!1;let r=e.type;return!(r!="Fill Region"&&r!="Line"||this.whetherCheckNet&&t.net!=e.net||t.layerId!=e.layerId)}checkTrackCopper(t,e){return!(t.length<1e-8||this.whetherCheckNet&&t.net!=e.net||t.layerId!=e.layerId)}checkTrackTear(t,e){return!(t.length<1e-8||this.whetherCheckNet&&t.net!=e.net||t.layerId!=e.layerId)}checkPadProfile(t,e){let r=e.type;if(r!="Fill Region"&&r!="Line"||this.whetherCheckNet&&t.net!=e.net)return!1;let i=ar(t.layerId);return!(!i&&t.layerId!=e.layerId||i&&!t.plated&&t.isUnuseLayer(e.layerId)||!ns(Ze.getInstance().getLayer(e.layerId).type))}checkPadCopper(t,e){if(this.whetherCheckNet&&t.net!=e.net)return!1;let r=ar(t.layerId);return!(!r&&t.layerId!=e.layerId||r&&!t.plated&&t.isUnuseLayer(e.layerId))}checkPadTear(t,e){if(this.whetherCheckNet&&t.net!=e.net)return!1;let r=ar(t.layerId);return!(!r&&t.layerId!=e.layerId||r&&!t.plated&&t.isUnuseLayer(e.layerId))}checkViaProfile(t,e){let r=e.type;return!(r!="Fill Region"&&r!="Line"||this.whetherCheckNet&&t.net!=e.net||!t.isContains(e.layerId)||!ns(Ze.getInstance().getLayer(e.layerId).type))}checkViaCopper(t,e){return!(this.whetherCheckNet&&t.net!=e.net||!t.isContains(e.layerId))}checkViaTear(t,e){return!(this.whetherCheckNet&&t.net!=e.net||!t.isContains(e.layerId))}checkProfiles(t,e){var n,s;if(!ns((n=Ze.getInstance().getLayer(t.layerId))==null?void 0:n.type)||!ns((s=Ze.getInstance().getLayer(e.layerId))==null?void 0:s.type))return!1;let r=t.type,i=e.type;return!(r!="Fill Region"&&r!="Line"||i!="Fill Region"&&i!="Line"||t.layerId!=e.layerId||this.whetherCheckNet&&t.net!=e.net)}checkProfileCopper(t,e){let r=t.type;return!(r!="Fill Region"&&r!="Line"||t.layerId!=e.layerId||this.whetherCheckNet&&t.net!=e.net||!ns(Ze.getInstance().getLayer(e.layerId).type))}checkProfileTear(t,e){let r=t.type;return!(r!="Fill Region"&&r!="Line"||t.layerId!=e.layerId||this.whetherCheckNet&&t.net!=e.net||!ns(Ze.getInstance().getLayer(e.layerId).type))}checkCoppers(t,e){return!(t.layerId!=e.layerId||this.whetherCheckNet&&t.net!=e.net)}checkTearCopper(t,e){return!(t.layerId!=e.layerId||this.whetherCheckNet&&t.net!=e.net)}checkTears(t,e){return!(t.layerId!=e.layerId||this.whetherCheckNet&&t.net!=e.net)}};function nx(o,t,e=!0){Zh.getInstance().clear();let r=new gd;return r.whetherCheckNet=e,r.needCheckIntersection(o,t)?new uy().checkIntersection(o,t):!1}function jk(o,t){let e=new gd;return t.isEmpty?!1:!o.isEmpty&&o!=t?e.needCheckIntersection(t,o):!1}var Zi=class o extends cd{constructor(t,e=!1,r=[]){super(),this._padId=t,this._isBridgingCopper=e,this._networkList=r}get isBridgingCopper(){return this._isBridgingCopper}set isBridgingCopper(t){this._isBridgingCopper=t}get networkList(){return this._networkList}set networkList(t){this._networkList=t}get padId(){return this._padId}set padId(t){this._padId=t}toJSON(){return{padId:this.padId,isBridgingCopper:this.isBridgingCopper,networkList:Ss(this.networkList)}}clone(){return new o(this.padId,this.isBridgingCopper,Array.from(this.networkList))}};var mIe=class{constructor(){this.model=void 0;this.keep=t=>{if(this.model==null)return!0;switch(this.model.modelType){case"Track":case"ArcTrack":return t==12||t==this.model.layerId;case"Pad":return this.model.layerId==12?!0:t==12||t==this.model.layerId;case"Via":return!!(t==12||this.model.isContains(t));case"Polygon":case"Rect":case"Circle":case"Copper":case"Inner":return t==12||t==this.model.layerId;default:return!1}}}},ox=new mIe;var Xk=class{constructor(t){this.map=new Map;this.net=t}get conditionMap(){return this._conditionMap==null&&(this._conditionMap=new Map),this._conditionMap}insert2Rtree(t){}insertPlatedPad2Rtree(t){this.insert2Rtree(t)}remove4Rtree(t){}end(){}getModel(t){for(let e of this.map.keys())if(e.globalIndex===t)return this.map.get(e);return null}cluster(t,e){this.trim(t,e);let r=new Map(this.map),i=[];for(let[,n]of r){let s=new Set;for(let a of n.cluster())r.delete(a.item),s.add(a.item.globalIndex);i.push(s)}return i}getConnect(){this.trim();let t=new Map(this.map),e=[];return t.forEach(r=>{let i=new Set,n=new Map;for(let s of r.cluster()){if(t.delete(s.item),s.item instanceof et){let a=n.get(s.item.globalIndex);a==null&&(a=new Set,n.set(s.item.globalIndex,a)),a.add(s.item.layerId)}i.add(s.item.globalIndex)}e.push({set:i,padMap:n})}),e}trim(t,e){let{add:r,remove:i,platPads:n}=this.vary(t);if(r.size==0&&i.size==0&&n.size==0)return!1;e!=null&&e.sycnChangeData(r,i,n);for(let s of i){let a=this.map.get(s);if(a==null)continue;this.remove4Rtree(a);let l=a.near;for(let c of l)c.deleteNear(a);this.map.delete(s)}this.removeConditionMap(i);for(let s of r){let a=new Tb(s);this.insert2Rtree(a),this.map.set(s,a)}for(let s of n){let a=new Tb(s);this.insertPlatedPad2Rtree(a),this.map.set(s,a),r.add(s)}for(let s of r){let a=this.map.get(s);if(a==null)continue;a.deleteAllNear(),ox.model=s;let l=s.buildBBox();if(l==null)continue;let c=this.search(l.extendOfSize(1e-8));for(let h of c)this.condition(s,h.item)&&(a.addNear(h),h.addNear(a))}return this.end(),!0}removeConditionMap(t){for(let e of t){let r=this.getId(e),i=this.conditionMap.get(r);if(i){for(let[n]of i){let s=this.conditionMap.get(n);s&&s.delete(r)}this.conditionMap.delete(r)}}}vary(t){let e=new Set,r=new Set,{shapes:i,platPads:n,sourcePlatPads:s}=this.shapes();if(t)for(let a of s)a.layerOrBoxModified=!1;if(this.map.size===0)for(let a of i)e.add(a);else{let a=!1;for(let l of i)a=this.map.has(l),l.layerOrBoxModified?(a&&r.add(l),e.add(l),t&&(l.layerOrBoxModified=!1)):a||e.add(l);for(let[l]of this.map)(!i.has(l)||l.layerOrBoxModified)&&(r.add(l),t&&(l.layerOrBoxModified=!1))}return i.clear(),{add:e,remove:r,platPads:n}}shapes(){Zh.getInstance().clear();let t=this.netShapes(this.net),e=new Set,r=new Set,i=new Set,n=Ze.getInstance().getAllCopperLayerIds(),s=new Map;for(let[a]of this.map)if(a.modelType=="Pad"){let l=a;if(l.layerId!=12){let c=s.get(l.globalIndex);c==null&&(c=new Map,s.set(l.globalIndex,c)),c.set(l.layerId,l)}}for(let a=0,l=t.length;a<l;a++){let c=t[a];if(!(c instanceof or&&c.type=="Copper Region")&&!(c instanceof or&&c.type=="Fill Region"&&c.component instanceof Zi&&c.component.isBridgingCopper))if(c instanceof et)if(c.layerId==12&&!c.plated){if(i.add(c),c.refreshBBox&&c.buildBBox(),!c.layerOrBoxModified){let h=s.get(c.globalIndex);if(h!=null){for(let u=0,d=n.length;u<d;u++){let p=n[u];if(!c.isUnuseLayer(p)){if(p===1&&c.top!=null){let m=h.get(p);m!=null?(e.add(m),this.reversePlatCache(m)):r.add(c.cloneLayer(p,c.top.clone(),void 0,void 0,void 0))}else if(p===2&&c.bottom!=null){let m=h.get(p);m!=null?(e.add(m),this.reversePlatCache(m)):r.add(c.cloneLayer(p,void 0,c.bottom.clone(),void 0,void 0))}else if(c.inner!=null){let m=h.get(p);m!=null?(e.add(m),this.reversePlatCache(m)):r.add(c.cloneLayer(p,void 0,void 0,c.inner.clone(),void 0))}}}continue}}for(let h=0,u=n.length;h<u;h++){let d=n[h];c.isUnuseLayer(d)||(d===1&&c.top!=null?r.add(c.cloneLayer(d,c.top.clone(),void 0,void 0,void 0)):d===2&&c.bottom!=null?r.add(c.cloneLayer(d,void 0,c.bottom.clone(),void 0,void 0)):c.inner!=null&&r.add(c.cloneLayer(d,void 0,void 0,c.inner.clone(),void 0)))}}else e.add(c);else c instanceof xi&&e.add(c)}return{shapes:e,platPads:r,sourcePlatPads:i}}reversePlatCache(t){let e=this.map.get(t);this.insertPlatedPad2Rtree(e)}condition(t,e){if(t==e)return!1;let r=this.getId(t),i=this.getId(e),n=this.conditionMap.get(r),s=this.conditionMap.get(i),a;return n?(a=n.get(i),a===void 0?s?(a=s.get(r),a===void 0?(a=this.connect(t,e),n.set(i,a),s.set(r,a)):n.set(i,a)):(a=this.connect(t,e),n.set(i,a),this.conditionMap.set(i,new Map().set(r,a))):s?s.get(r)===void 0&&s.set(r,a):this.conditionMap.set(i,new Map().set(r,a))):(s?(a=s.get(r),a===void 0?(a=this.connect(t,e),s.set(r,a)):this.conditionMap.set(i,new Map().set(r,a))):(a=this.connect(t,e),this.conditionMap.set(i,new Map().set(r,a))),this.conditionMap.set(r,new Map().set(i,a))),a}getId(t){return t instanceof et?t.globalIndex+"_"+t.layerId:t.globalIndex}get capacity(){return this.net==="GND"?20:10}connect(t,e){return jk(t,e)&&new uy().checkIntersection(t,e)}};var qL=["Track","ArcTrack","Pad","Via","Polygon","Rect","Circle"],jd=["Track","ArcTrack","Pad","Via","Polygon","Rect","Circle","Copper","Inner"],yte=["Track","ArcTrack","Pad","Via","Polygon","Rect","Circle","Ratline","Copper","Inner"],Kp=["Polygon","Rect","Circle"],Df=["Track","ArcTrack","Pad","Via","Image","Picture","Length Dimension","Smart Dimension","Protractor Dimension","Radius Dimension","Polygon","Rect","Circle","Copper","Inner","Component","Ratline","Text","DRCResult","DrcComponentSpacing","DrcComponentOverlap","DrcCreepage","Line","Arc"],Mbr=["Track","ArcTrack","Pad","Via","Image","Picture","Length Dimension","Smart Dimension","Protractor Dimension","Radius Dimension","Polygon","Rect","Circle","Copper","Inner","Component","Ratline","Text","DRCResult"],$L=["Track","ArcTrack","Pad","Via","Image","Picture","Length Dimension","Smart Dimension","Protractor Dimension","Radius Dimension","Polygon","Rect","Circle","Copper","Inner","Component","Ratline","Text"],dY=["Track","ArcTrack","Pad","Via","Image","Picture","Length Dimension","Smart Dimension","Protractor Dimension","Radius Dimension","Polygon","Rect","Circle","Copper","Inner","Component","Ratline","Text"],VBe=["Track","ArcTrack","Pad","Via","Image","Picture","Length Dimension","Smart Dimension","Protractor Dimension","Radius Dimension","Polygon","Rect","Circle","Copper","Inner","Component","Ratline","Text"],GBe=["Track","ArcTrack","Pad","Via","Ratline"],gIe=["Polygon","ArcTrack","Rect","Circle"],pY=["Track","ArcTrack","Pad","Via"],UBe=["Track","ArcTrack"];function lSt(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minY+e.maxY)/2,n=(r.minY+r.maxY)/2;return i-n}function cSt(o,t){let e=o.bbox(),r=t.bbox(),i=(e.minX+e.maxX)/2,n=(r.minX+r.maxX)/2;return i-n}var HP=class o{constructor(t,e){this.childs=new Array;this._bbox=null;this.parent=null;if(this.capacity=t,typeof e<"u"&&Array.isArray(e))for(let r of e)this.insert(r)}bbox(){return Ki.notnull(this._bbox)}itor(t,e){for(let r of this.childs)r instanceof o?r.itor(t+1,e):e(r,t)}debug(t){for(let e of this.childs)console.log(t,e.bbox(),e instanceof o?"+":"-"),e instanceof o&&e.debug(t+" |--")}insert(t){let e=this.childs,r=t.bbox();if(!(t instanceof o))for(let i=0;i<e.length;i++){let n=e[i];if(n instanceof o&&r.isInside(n.bbox())){n.insert(t),this._bbox=ht.extend2(this._bbox,r);return}}t instanceof o&&(t.parent=this),e.length<=this.capacity?e.push(t):(e.push(t),this.splitNode()),this._bbox=ht.extend2(this._bbox,r)}remove(t){if(t instanceof o&&t.childs.length>0)throw new Error;let e=this.childs,r=t.bbox(),i=new Array;for(let n=0;n<e.length;n++){let s=e[n];if(s===t)return e.splice(n,1),e.length>0?(this.updateBBox(),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):this.parent!==null?(this.parent.remove(this),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):this._bbox=null,1;s instanceof o&&r.isInside(s.bbox())&&i.push(s)}if(t instanceof o)throw new Error;for(let n of i){let s=n.remove(t);if(s===1)return this.childs.length>0&&this.updateBBox(),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox(),1;if(s!==0)throw new Error}return 0}recycle(){this.childs.length=0,this._bbox=null}updateBBox(){let t=new _e;for(let e of this.childs)t.ext1(e.bbox());this._bbox=t.build1()}splitNode(){let t=this.childs,e=t.length,r=-1,i=-1,n=Number.NEGATIVE_INFINITY;for(let c=0;c<e;c++){let h=t[c];for(let u=c+1;u<e;u++){let d=t[u],p=ht.extend2(h.bbox(),d.bbox()).area();p>n&&(n=p,r=c,i=u)}}let s=this.asNode(t[r]),a=this.asNode(t[i]);for(let c=0;c<e;c++)if(c!==r&&c!==i){let h=t[c],u=h.bbox(),d=ht.extend2(s._bbox,u).area(),p=ht.extend2(a._bbox,u).area();d<p?s.insert(h):a.insert(h)}t.length=0;let l=this.parent;s.updateBBox(),a.updateBBox(),l!==null&&l.childs.length<this.capacity?(s.parent=l,a.parent=l,l.childs.push(s),l.childs.push(a),l.remove(this),l.updateBBox()):(s.parent=this,a.parent=this,t.push(s),t.push(a),this.updateBBox()),this.childs.length>0&&this.updateBBox()}asNode(t){if(t instanceof o)return t;{let e=new o(this.capacity);return e.insert(t),e}}},HBe=.5,WBe=1e5,$u=class{constructor(t){this.items=new Set;this.changeList=new Set;this.deadList=new Set;this.capacity=t,this.capacity2=t*t,this.root=new HP(t)}itor(t){this.root.itor(0,t)}size(){return this.items.size}search(t){this.flushWhenNeed();let e=[],r=[];for(r.push(this.root);;){let i=r.shift();if(i!==void 0)this.dfsSearchNode(t,i,e);else break}return e}dfsSearchNode(t,e,r){if(e!==void 0)for(let i of e.childs)t.isSeparated(i.bbox())||(i instanceof HP?i.bbox().isInside(t)?this.add2Result(i,r):this.dfsSearchNode(t,i,r):r.push(i))}addResult2Cb(t,e,r){if(t!==void 0)for(let i of t.childs)i instanceof HP?this.addResult2Cb(i,e,r):(!r||r(i))&&e(i)}search2Cb(t,e){this.flushWhenNeed(),this.root!==void 0&&this.search4Node(t,this.root,e)}search4Node(t,e,r){if(e!==void 0)for(let i of e.childs)t.isSeparated(i.bbox())||(i instanceof HP?i.bbox().isInside(t)?this.addResult2Cb(i,r):this.search4Node(t,i,r):r(i))}searchInside(t){this.flushWhenNeed();let e=[],r=[];for(r.push(this.root);;){let i=r.shift();if(i!==void 0)for(let n of i.childs){let s=n.bbox();t.isSeparated(s)||(n instanceof HP?s.isInside(t)?this.add2Result(n,e):r.push(n):s.isInside(t)&&e.push(n))}else break}return e}searchIntersect(t){this.flushWhenNeed();let e=[],r=[];for(r.push(this.root);;){let i=r.shift();if(i!==void 0)for(let n of i.childs){let s=n.bbox();t.isSeparated(s)||(n instanceof HP?s.isIntersect(t)&&!s.isInside(t)?this.add2Result(n,e):r.push(n):s.isIntersect(t)&&!s.isInside(t)&&e.push(n))}else break}return e}add2Result(t,e,r){if(t!==void 0)for(let i of t.childs)i instanceof HP?this.add2Result(i,e,r):(!r||r(i))&&e.push(i)}conditionSearch(t,e){this.flushWhenNeed();let r=[],i=[];for(i.push(this.root);;){let n=i.shift();if(n!==void 0)for(let s of n.childs)t.isSeparated(s.bbox())||(s instanceof HP?s.bbox().isInside(t)?this.add2Result(s,r,e):i.push(s):e(s)&&r.push(s));else break}return r}insert(t){this.items.add(t),this.changeList.add(t)}remove(t){this.items.delete(t),this.deadList.add(t)}bbox(){return this.flushWhenNeed(),this.root.bbox()}flushDeleteWhenNeed(){let t=this.deadList.size;if(t>0){let e=1;if(this.items.size>0&&(e=t/this.items.size),e>HBe||t>WBe)this.deadList.clear(),this.changeList.clear(),this.deadList=new Set,this.changeList=new Set,this.fullRefresh();else{for(let i of this.deadList)this.root.remove(i);this.deadList.clear(),this.deadList=new Set}}}flushWhenNeed(){let t=this.changeList.size+this.deadList.size;if(t>0){let e=1;if(this.items.size>0&&(e=t/this.items.size),e>HBe||t>WBe)this.deadList.clear(),this.changeList.clear(),this.deadList=new Set,this.changeList=new Set,this.fullRefresh();else{for(let i of this.deadList)this.root.remove(i);this.deadList.clear(),this.deadList=new Set;for(let i of this.changeList)this.items.has(i)&&this.root.insert(i)}this.changeList.clear(),this.changeList=new Set}}debug(){this.root.debug("")}recycle(){this.items.clear(),this.changeList.clear(),this.deadList.clear(),this.deadList=new Set,this.changeList=new Set,this.root.recycle()}fullRefresh(){let t=new Array;for(let e of this.items)t.push(e);for(;;){let e=this.organize(t);if(e.length>1)t=e;else break}this.root.recycle(),this.root=new HP(this.capacity,t)}organize(t){Er(t,cSt,0,t.length);let e=t.length,r=[];for(let i=0;i<e;)if(i+this.capacity2<=e){let n=i+this.capacity2;Er(t,lSt,i,n);for(let s=i;s<n;s+=this.capacity){let a=new HP(this.capacity,t.slice(s,s+this.capacity));r.push(a)}i=i+this.capacity*this.capacity}else{let n=new HP(this.capacity,t.slice(i,i+this.capacity));r.push(n),i=i+this.capacity}return r}};var fY=class extends Xk{getMap(t){let e=this.netShapes(),r=new Map;this.map.clear();let i=Ze.getInstance().getAllCopperLayerIds(),n=new Map,s;for(let l of e){if(l.layerOrBoxModified=!1,l instanceof et&&l.layerId==12&&!l.plated){let c=n.get(l.globalIndex);c==null&&(c=new Map,n.set(l.globalIndex,c));for(let h=0,u=i.length;h<u;h++){let d=i[h];l.isUnuseLayer(d)||(d===1&&l.top!=null?(s=new Tb(l.cloneLayer(d,l.top.clone(),void 0,void 0,void 0)),c.set(d,s),this.insertPlatedPad2Rtree(s),this.map.set(s.item,s)):d===2&&l.bottom!=null?(s=new Tb(l.cloneLayer(d,void 0,l.bottom.clone(),void 0,void 0)),c.set(d,s),this.insertPlatedPad2Rtree(s),this.map.set(s.item,s)):l.inner!=null&&(s=new Tb(l.cloneLayer(d,void 0,void 0,l.inner.clone(),void 0)),c.set(d,s),this.insertPlatedPad2Rtree(s),this.map.set(s.item,s)))}continue}s=new Tb(l),r.set(l.globalIndex,s),this.insert2Rtree(s),this.map.set(s.item,s)}let a=new Set;for(let{key:l,value:c,layerId:h}of t){let u=r.get(l);if(u==null){let d=n.get(l);if(d!=null&&(u=d.get(h)),u==null)continue}for(let d of c){if(a.has(d))continue;let p=r.get(d);p!=null&&(u.addNear(p),p.addNear(u))}a.add(l),c.length=0}return this}netShapes(){let t=[];return this.net?Ye.getSameNetItems(this.net,e=>e.model instanceof xi&&t.push(e.model)&&!1):Ye.getAllNoneNetsItems().forEach(e=>e.model instanceof xi&&t.push(e.model)),t}insertPlatedPad2Rtree(t){this.rtree==null&&(this.rtree=new $u(this.capacity)),this.rtree.insert(t)}getConditionMap(){return this.conditionMap}search(t){let e=kt.search4Types(t,jd,ox.keep),r=new Array;for(let i of jd){let n=e.getResults(i);for(let s of n){let a=s.model;if(a instanceof xi){let l=this.map.get(a);l!=null&&r.push(l)}}}if(e.clear(),e=null,this.rtree!=null){let i=this.rtree.search(t);for(let n of i)r.push(n)}return r}end(){this.rtree!=null&&(this.rtree=void 0,delete this.rtree)}};var hs=class extends xi{constructor(){super(...arguments);this.modelType="Line";this._parent=void 0}get isSegment(){return this.width==0}get layerModified(){return this._parent?this._parent.layerModified:this.hasDataState(3)}set layerModified(e){e&&(this.layerOrBoxModified=!0),this.setDataState(3,e)}};var ss=class extends or{constructor(){super(...arguments);this.modelType="Polygon";this._children=new Array(0)}get childrenModified(){return this.hasDataState(7)}set childrenModified(e){this.setDataState(7,e)}get start(){return this.type=="TearDrop"?this.simplyPolyline.primitives[0].start():this.childrens[0][0].start}get end(){let e=this.childrens[this.childrens.length-1];return e[e.length-1].end}rotateFor(e,r){let i=Ae.rotateZForPoint(e,r);this.transform(i)}inOutline(e){return this.inShape(e.x,e.y)}inShape(e,r,i){switch(this.type){case"Copper Region":case"Line":case"Board Outline":case"3D Shell - Outline":{for(let n of this.childrens)for(let s of n)if(s.inShape(e,r,i))return!0;return!1}default:{let n=this.isInside(new S(e,r));if(n)return n;for(let s of this.childrens)for(let a of s)if(a.inShape(e,r,i))return!0;return!1}}}isInside(e){let r=this.outline;return r!=null?jr.inPolygon(e,r instanceof Bt?r.items:[r]):!1}InnerArea(e,r,i){let n=this.isInside(new S(e,r));if(n)return n;for(let s of this.childrens)for(let a of s)if(a.inShape(e,r,i))return!0;return!1}onlyOutline(e,r){for(let i of this.childrens)for(let n of i)if(n.inShape(e,r))return!0;return!1}onOutlineShape(e,r,i){let n=this.isInside(new S(e,r));if(n)return n;for(let s of this.childrens)for(let a of s)if(a.inShape(e,r,i))return!0;return!1}isClose(){return this.childrens.every(e=>{if(e.length==2){if(e[0]instanceof hs&&e[1]instanceof hs)return!1;{let r=e[0],i=e[e.length-1];if(r.start.distance1(i.end)<this.strokeWidth)return!0}}else if(e.length>2){let r=e[0],i=e[e.length-1];if(r.start.distance1(i.end)<this.strokeWidth)return!0}return!1})}equals(e){let r=this.childrens,i=e.childrens;return r.length!=i.length||r.some((a,l)=>{let c=i[l];return a.length!=c.length})?!1:!r.some((a,l)=>{let c=i[l];return a.some((h,u)=>{let d=c[u];return!h.equals(d)})})}};function bte(o,t,e){if(isNaN(t)||t<0)throw new Error("Circle error,radius is NaN");let r=new _e;return r.ext2(o).ext7(t+e/2),r.build1()}function YBe(o,t,e){if(!(o.component instanceof Rf))return!1;let i=!1,n=uSt(o);for(let s in n){let a=n[s];switch(s){case"circle":for(let l of a)if(i=t1(new S(t,e),l.center,l.radius),i)return!1;break;case"line":for(let l of a)if(i=Da(new S(t,e),l.start,l.end,l.width),i)return!1;break}if(i)break}return i}function uSt(o){let t=o.component,e={},r=jBe(t),{innerRadius:i,stiffToCenterLength:n,stiffStrokeWidth:s}=r;if(e.circle=[{center:o.center,radius:i}],n>0&&s>0){e.line=[];let a=new S(o.center.x,o.center.y+n),l=new S(o.center.x,o.center.y-n);e.line.push({start:a,end:l,width:s});let c=new S(o.center.x-n,o.center.y),h=new S(o.center.x+n,o.center.y);e.line.push({start:c,end:h,width:s})}return e}function jBe(o){let{holeDiameter:t,counterboreProps:e,stiffenerProps:r}=o,i=t/2,n=i;e&&(n=e.diameter/2);let s=0,a=0;return r&&(s=Math.max(r.topWidth,r.bottomWidth)+i,a=r.stiffThickness),{innerRadius:i,outerRadius:n,stiffToCenterLength:s,stiffStrokeWidth:a}}function XBe(o){let t=o.component,e=o.radius+o.strokeWidth/2,r=new _e().ext2(o.center).ext7(e);if(t instanceof Rf&&t.stiffenerProps){let{stiffToCenterLength:i}=jBe(t),n=Math.max(0,i-e);r.ext7(n)}return r.build1()}var zBe=5e4;function Pu(o,t,e=vc){let r=qBe(t);if(r>0)return r;if(o>zBe)return zBe;if(o>=e)return o;switch(t){case"3D Shell - Outline":return new dt().conversion("mm","mil",1.5)/10;default:return 1}}function qBe(o){let t=R.getInstance().envFlag==="cnc-preview";switch(o){case"Slot Region":return t?5:.1;case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":return t?5:1;case"TearDrop":return t?5:.001;case"Copper Region":case"Fill Region":case"FPC Stiffener":case"Prohibited Region":case"Constraint Region":case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":return t?5:.02;default:return-1}}function qk(o,t,e){if(t==e)return o;let r=Pu(o,t);return(e!="3D Shell - Outline"&&t=="3D Shell - Outline"||qBe(e)>0&&(t=="Board Outline"||t=="Line"))&&(r=Pu(-1,t)),r}function Bu(o){switch(o){case"Board Outline":case"Slot Region":case"Copper Region":case"Fill Region":case"Prohibited Region":case"Constraint Region":case"TearDrop":case"3D Shell - Outline":case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":case"3D Shell - Screw Pillar":case"FPC Stiffener":return!0;default:return!1}}function Qh(o,t=1e-8){if(o.length==1){let e=o[0];if(e instanceof q&&ne.greatereq(Math.abs(e.sweepAngle),359.9))return!0}else if(o.length==2){if(o[0]instanceof M&&o[1]instanceof M)return!1;{let e=o[0],r=o[o.length-1];if(e.start().distance1(r.end())<=t)return!0}}else if(o.length>2){let e=o[0],r=o[o.length-1];if(e.start().distance1(r.end())<=t)return!0}return!1}function $Be(o){if(o.length===0)return!1;if(o.length===1){if(o[0]instanceof q&&ne.greatereq(Math.abs(o[0].sweepAngle),359.9))return!0}else if(o.length===2){if(o[0]instanceof M&&o[1]instanceof M)return!1}else if(o.length>2&&o[0].start().distance1(o[o.length-1].end())<.01)return!0;return!1}var yo=class extends or{constructor(){super(...arguments);this.modelType="Circle"}get primitive(){return q.build2(this.center,0,360,this.radius,this.radius,ae.CW)}transform(e){this.center=this.center.multiply4(e),this.updateShapeData()}inShape(e,r,i){let n=this.strokeWidth;switch(n<.05&&i!=null&&(n=10/i.getScale()),this.type){case"Copper Region":case"Line":case"Board Outline":case"3D Shell - Outline":{let s=this.center.distance1(new S(e,r));return s<=this.radius+n/2&&s>=this.radius-n/2}case"3D Shell - Screw Pillar":{let s=this.center.distance1(new S(e,r))<=this.radius+n/2;return s||(s=YBe(this,e,r)),s}default:return this.center.distance1(new S(e,r))<=this.radius+this.strokeWidth/2}}isInside(e){return this.center.distance1(e)<=this.radius+this.strokeWidth/2}InnerArea(e,r){return this.center.distance1(new S(e,r))<=this.radius+this.strokeWidth/2}isSelectOnlyLine(e,r){let i=this.center.distance1(new S(e,r));return i<=this.radius+this.strokeWidth/2&&i>=this.radius-this.strokeWidth/2}updateBox(){return this.type==="3D Shell - Screw Pillar"?this._bbox=XBe(this):this._bbox=bte(this.center,this.radius,this.strokeWidth),this._bbox}getMathGraphics(e=this.layerId,r=0){return this.isEmpty?null:this.layerId==e||this.layerId==12||11==this.layerId?ge.build2([q.build2(this.center,0,-360,this.radius+r,this.radius+r,ae.CW)]):null}};var Pte=class{constructor(t,e,r,i,n,s){this.num=0;this.type=t,this.layerId=e,this.strokeWidth=i,this.net=r,this.silkColor=n,this.locked=s}};var KL=class KL extends Ei{static getInstance(){return KL.manager==null&&(KL.manager=new KL),KL.manager}getKey(t,e,r,i,n,s){return n==null?`${t}/${e}/${r}/${i}/${s}`:`${t}/${e}/${r}/${i}/${n.toRGBAString()}/${s}`}getComponent(t,e,r,i,n,s){i=Pu(i,t);let a=this.getKey(t,e,r,i,n,s),l=this.map.get(a);return l==null&&(l=new Pte(t,e,r,i,n,s),this.map.set(a,l)),l.num++,l}setType(t,e){return e.num--,this.getComponent(t,e.layerId,e.net,e.strokeWidth,e.silkColor,e.locked)}setLayerId(t,e){return e.num--,this.getComponent(e.type,t,e.net,e.strokeWidth,e.silkColor,e.locked)}setNet(t,e){return e.num--,this.getComponent(e.type,e.layerId,t,e.strokeWidth,e.silkColor,e.locked)}setStrokeWidth(t,e){return e.num--,this.getComponent(e.type,e.layerId,e.net,t,e.silkColor,e.locked)}setSilkColor(t,e){return e.num--,this.getComponent(e.type,e.layerId,e.net,e.strokeWidth,t,e.locked)}setLocked(t,e){return e.num--,this.getComponent(e.type,e.layerId,e.net,e.strokeWidth,e.silkColor,t)}};KL.manager=null;var Tte=KL;var ZL=Tte.getInstance(),sx=class{constructor(t,e,r,i,n,s,a){this.data=ZL.getComponent(t,e,r,i,n,s),a!=null&&(this._component=a)}get type(){return this.data.type}set type(t){this.data.type!=t&&(this.data=ZL.setType(t,this.data))}get layerId(){return this.data.layerId}set layerId(t){this.data.layerId!=t&&(this.data=ZL.setLayerId(t,this.data))}get net(){return this.data.net}set net(t){this.data.net!=t&&(this.data=ZL.setNet(t,this.data))}get locked(){return this.data.locked}set locked(t){this.data.locked!=t&&(this.data=ZL.setLocked(t,this.data))}get strokeWidth(){return this.data.strokeWidth}set strokeWidth(t){t=Pu(t,this.type),this.data.strokeWidth!=t&&(this.data=ZL.setStrokeWidth(t,this.data))}get silkColor(){return this.data.silkColor||null}set silkColor(t){(this.data.silkColor!=null&&t!=null&&!this.data.silkColor.equals(t)||this.data.silkColor!=t)&&(this.data=ZL.setSilkColor(t,this.data))}get component(){return this._component||void 0}set component(t){this._component!=t&&(t?this._component=t:delete this._component)}addCopper(t){this._copperIndexMap||(this._copperIndexMap=new Array),this._copperIndexMap.includes(t)||this._copperIndexMap.push(t)}deleteCopper(t){if(this._copperIndexMap!=null){let e=this._copperIndexMap.indexOf(t);e>=0&&this._copperIndexMap.splice(e,0)}}iteratorCopper(t){this._copperIndexMap&&this._copperIndexMap.forEach(e=>{t(e)})}clearCopperData(){delete this._copperIndexMap}};var Ip=class o extends yo{constructor(e,r,i,n,s,a,l,c,h,u,d){super();this.modelType="Circle";this._globalIndex=e,this.base=new sx(r,i,c,a,h,l,u),this._center=n,this._radius=rS(s),this._bbox=d||bte(n,s,a)}get center(){return this._center}set center(e){this._center.equals(e)||(this._center=e,this.updateShapeData())}get radius(){return this._radius}set radius(e){e=rS(e),this._radius!=e&&(this._radius=e,this.updateShapeData())}clone(){var i;this.refreshBBox&&this.updateBox();let e=(i=this.component)==null?void 0:i.clone(),r=new o(this.globalIndex,this.type,this.layerId,this._center,this._radius,this.strokeWidth,this.locked,this.showNet,this.silkColor,e,this._bbox);return r.number=this.number,r.zIndex=this.zIndex,r}get type(){return this.base.type}set type(e){this.base.type!=e&&(this.base.type=e,this.updateShapeData())}get layerId(){return this.base.layerId}set layerId(e){this.base.layerId!=e&&(this.watchLayerIdModify(this.base.layerId),this.base.layerId=e,this.layerModified=!0)}get net(){var e;return(e=this.base.net)==null?void 0:e.toUpperCase()}set net(e){this.base.net!=e&&(this.base.net=e,this.netModified=!0)}get showNet(){return this.base.net}get locked(){return this.base.locked}set locked(e){this.base.locked=e}get strokeWidth(){return this.base.strokeWidth}set strokeWidth(e){e=Pu(e,this.type),this.base.strokeWidth!=e&&(this.base.strokeWidth=e,this.updateShapeData())}get silkColor(){return this.base.silkColor||null}set silkColor(e){this.base.silkColor=e}get component(){return this.base.component}set component(e){this.base.component!=e&&(this.base.component=e)}addCopper(e){this.base.addCopper(e)}deleteCopper(e){this.base.deleteCopper(e)}iteratorCopper(e){this.base.iteratorCopper(e)}clearCopperData(){this.base.clearCopperData()}};var JL=class JL extends Ei{static getInstance(){return JL.manager==null&&(JL.manager=new JL),JL.manager}addModel(t){this.map.set(t.globalIndex,t)}addCircle(t,e,r,i,n,s,a,l,c=null,h){return this._last=new Ip(t,e,r,i,n,s,a,l,c,h,void 0),this.addModel(this._last),this._last}delete(t){t instanceof yo&&this.map.delete(t.globalIndex)}};JL.manager=null;var Fi=JL;var mY=new Error,yIe=new class extends BO{decide1(t){return t[0]&&t[1]}}(2),dSt=new class extends Ek{onPolylineGroup(t,e){throw mY}onSegment(t,e,r,i,n,s){throw mY}},bIe=class{constructor(t,e){this.rtree=t,this.level=e}setLevel(t){if(this.level!=t){let e=yIe.weight(t);for(let r of this.rtree.itemList)r.setWeight(e);this.level=t}}},n3=class o extends X9{static isIntersect(t,e,r=Di.DUMMY){let i=new o(r),n=i.createGroup1(t.items),s=i.createGroup2(e.items);return n.rtree.itemList.length==0||s.rtree.itemList.length==0?!1:i.isIntersect(n,s)}constructor(t){super(new wv(!1),yIe.rule,t,dSt)}createGroup1(t){return this.createGroup(t,0)}createGroup2(t){return this.createGroup(t,1)}createGroup(t,e){let r=yIe.weight(e);for(let n of t)this.addPolyline(n,r);let i=this.buildRTree();return this.sides.length=0,new bIe(i,e)}isIntersect(t,e){if(t.level!==e.level){let r=t.rtree.bbox().intersection1(e.rtree.bbox());if(r!==null){try{this.inters(t,e);let i=(r.minY+r.maxY)/2;this.sweep(t,e,i)}catch(i){if(i===mY)return!0;throw i}return!1}else return!1}else throw new Error("inersection detection should not in same group")}inters(t,e){if(t.rtree.size()>e.rtree.size()){let r=t;t=e,e=r}for(let r of t.rtree.items()){r.trans=NaN;let i=r.bbox().extendOfSize(1e-5);for(let n of e.rtree.search(i))if(n.trans=NaN,Pt(r.shape,n.shape)>0)throw mY}}sweep(t,e,r){let i=new Array;this.fillValidSides(i,t.rtree.itemList,r),this.fillValidSides(i,e.rtree.itemList,r),Er(i,(s,a)=>s.getX(r)-a.getX(r),0,i.length);let n=new Lv(this.rule,this,r);for(let s of i)s.setWeight(s.baseWeight);for(let s of i)n.onEp(s)}isIntersect1(t,e){if(t.level!==e.level){let r=t.rtree.bbox().intersection1(e.rtree.bbox());if(r!==null){try{let i=(r.minY+r.maxY)/2;this.sweep(t,e,i)}catch(i){if(i===mY)return!0;throw i}return!1}else return!1}else throw new Error("inersection detection should not in same group")}};var Cp=class o{constructor(t,e,r,i,n){this.text=t,this.group=e,this.pl=r,this.flag=i,this.order=n}clone(){let{text:t,group:e,pl:r,flag:i,order:n}=this;return new o(t,e,r.clone(),i,n)}};var wf=class{constructor(t,e,r,i=!1){this.pls=new Array;this.map=new Map;this.skip=i,this.text=t,this.groupId=e,r=this.sort(r),this.checkRelate(r)}getPolyline(t,e){let r=this.map.get(t);if(r!=null)return r.setLevel(e),r;{let i=new Array;for(let l of t.primitives)if(l instanceof Dr){let c=null;for(let h of l.points(.01))c!=null&&i.push(new M(c,h)),c=h}else i.push(l);let n=ge.build2(i),s=new n3(Di.DUMMY),a=e==0?s.createGroup1([n]):s.createGroup2([n]);return this.map.set(t,a),a}}check(t,e){let r={inter:!1,outline:null,hole:null};if(!t.bbox().isInside(e.bbox().extendOfSize(1e-4))&&!e.bbox().isInside(t.bbox().extendOfSize(1e-4)))return r;let i=new n3(Di.DUMMY),n=this.getPolyline(t,0),s=this.getPolyline(e,1);return n.rtree.itemList.length==0||s.rtree.itemList.length==0?r.inter=!1:r.inter=i.isIntersect1(n,s),r.inter&&(t.bbox().area()>e.bbox().area()?(r.outline=t,r.hole=e):(r.outline=e,r.hole=t)),r}sort(t){return t.sort((e,r)=>r.bbox().area()-e.bbox().area())}checkRelate(t){let e=new Set,r=new Set;for(;t.length>0;){let i=t.shift(),n=0;if(!e.has(i)&&!r.has(i)){e.add(i);let s=this.groupId++;this.pls.push(new Cp(this.text,s,i,!0,n)),this.dfs(t,0,e,r,i,n,s)}}return{outline:e,hole:r}}dfs(t,e,r,i,n,s,a){let l=s%2!=0;for(;e<t.length;e++){let c=t[e];if(!r.has(c)&&!i.has(c)){let h=this.check(n,c);if(h.inter)if(!l)i.add(h.hole),this.pls.push(new Cp(this.text,a,c,!1,s+1)),this.dfs(t,e+1,r,i,c,s+1,a);else{r.add(h.hole);let u=this.groupId++;this.pls.push(new Cp(this.text,u,c,!0,s+1)),this.dfs(t,e+1,r,i,c,s+1,u)}}}}};var As=class{constructor(t,e,r,i=!0){this.pl1=t,this.pl2=e,this.clearance=r;let{relation:n,distance:s,line:a,pt1:l,pt2:c}=this.getRelation();this.relation=n,this.distance=s,this.line=a,this.pt1=l,this.pt2=c,this.setDistZeroWhenContain=i}getRelation(){let t=3,e=Number.MAX_VALUE,r=null,i=null,n=null,s=new i2(10),a=this.pl2.primitives.length>100;if(a)for(let c of this.pl2.primitives)s.add(c);let l=c=>a?s.search(c):this.pl2.primitives;for(let c of this.pl1.primitives){let h=c.bbox().extendOfSize(e);for(let u of l(h)){if(c instanceof M&&ne.eq(c.start().distance2(c.end()),0)||u instanceof M&&ne.eq(u.start().distance2(u.end()),0)||h.isSeparated(u.bbox()))continue;let d=new er(c,u),p=d.getDistance(),m=d.getLine();if(ne.less(p,e)&&(e=p,r=m,i=c,n=u,h=c.bbox().extendOfSize(e)),ne.eq(e,0)){t=0;break}}if(ne.eq(e,0)){t=0;break}}return t!=0&&(i!=null&&this.isClose(this.pl2)&&this.pointInPolyline(i.start(),this.pl2)?(t=2,this.setDistZeroWhenContain&&(e=0)):n!=null&&this.isClose(this.pl1)&&this.pointInPolyline(n.start(),this.pl1)&&(t=1,this.setDistZeroWhenContain&&(e=0))),{relation:t,distance:e,line:r,pt1:i,pt2:n}}pointInPolyline(t,e){if(!e.bbox().isContains(t))return!1;let i=[];return e.points(.1,n=>{i.push(n)}),this.isSelect(t.x,t.y,i)}isSelect(t,e,r){let i=!1;for(let a=0,l=r.length-1;a<l;a++){let c=r[a],h=r[a+1];if(t==c.x&&e==c.y||t==h.x&&e==h.y)return!0;if(c.y<e&&h.y>=e||c.y>=e&&h.y<e){let u=c.x+(e-c.y)*(h.x-c.x)/(h.y-c.y);if(t==u)return!0;u>t&&(i=!i)}}let n=r[r.length-1],s=r[0];if(t==n.x&&e==n.y||t==s.x&&e==s.y)return!0;if(n.y<e&&s.y>=e||n.y>=e&&s.y<e){let a=n.x+(e-n.y)*(s.x-n.x)/(s.y-n.y);if(t==a)return!0;a>t&&(i=!i)}return i}isClose(t){return t.primitives.length>0&&t.primitives[0].start().distance2(t.primitives[t.primitives.length-1].end())<1e-8}};function Om(o,t){for(let e=0;e<o;e+=2){let r=new S(Ee[e],Ee[e+1]),i=!0;for(let n of t)n.distance2(r)<1e-8&&(i=!1);i&&t.push(r)}return t}function ax(o){let t=[];if(o=o.filter(r=>r.length),o.length)for(let r=0;r<o.length;r++){let i=o[r].slice(),n=o[r],s=o[r+1];for(;s&&n[n.length-1].end().equals1(s[0].start());)i.push(...s),r++,n=o[r],s=o[r+1];if(Eo(ge.build2(i)))return!0;t.push(i)}if(t.length>=2){for(let i of t)if(i.length>=2){let n=i[0],s=i[i.length-1];if(n.start().distance2(s.end())<1e-8)return!0}let r=t.length;for(let i=0;i<r;i++)for(let n=i+1;n<r;n++)if(e(i,n))return!0}return!1;function e(r,i){let n=t[r],s=t[i];for(let a=0;a<n.length;a++)for(let l=0;l<s.length;l++){let c=n[a],h=s[l],u=Pt(c,h),d=Om(u,[]);if(u>0)if(r==0&&i==t.length-1&&a==0&&l==s.length-1){if(!(u==2&&d.length==1&&c.start().distance2(h.end())<1e-8))return!0}else return!0}return!1}}function $k(o,t){let e=[],r=[],i=t[0].start(),n=o.length-1;for(let l=0;l<t.length;l++){let c=t[l],h=s(c,n);h&&(r.push(l),n=n-h+1)}return{coincideLines:e,coincidePoint:i,drawCoincideLines:r};function s(l,c){let h=0;for(;c>=0&&l;){let u=!0,d=o[c],p=Pt(d,l);if(p>=2){let m=Om(p,[]);c==0&&r.length==1&&m.length==1&&d.start().distance2(l.end())<1e-8||(u=m.some(g=>g.distance2(i)<1e-8||g.distance2(d.end())<1e-8))}if(p>=4&&!a(d,l)&&(u=!1),p>=4&&l instanceof q&&d instanceof q&&(Math.abs(l.rx-d.rx)>1e-8||l.center.distance1(d.center)>1e-8)&&(u=!1),u){let m=Om(p,[d.end()]);p>=4&&m.length>=2&&(i=m[1],(!e.length||e[e.length-1]!=c)&&(e.push(c),h++))}else return 0;c--}return h}function a(l,c){return l instanceof M&&c instanceof M||l instanceof q&&c instanceof q}}function Eo(o){if(o instanceof ge)return KBe(o);let t=o.items;if(t.length>=2)for(let r=0;r<t.length-1;r++)for(let i=r+1;i<t.length;i++){let n=t[r],s=t[i];if(n.bbox().intersection1(s.bbox())&&new As(n,s,0).relation==0)return!0}return!!t.some(r=>KBe(r))}function KBe(o){let t=new Array;o.primitives.forEach(r=>{r instanceof M&&r.length()<.01||t.push(r)});let e=t.length;if(e==2){let r=t[0],i=t[1];if(r instanceof M&&i instanceof M&&r.end().equals1(i.start())&&i.end().equals1(r.start()))return!0;let n=Pt(t[0],t[1]);for(let s=0;s<n;s+=2){let a=new S(Ee[s],Ee[s+1]);if(!(a.distance2(t[0].start())<1e-8||a.distance2(t[0].end())<1e-8)){if(!(a.distance2(t[1].start())<1e-8||a.distance2(t[1].end())<1e-8))return!0}}}else if(e>2)for(let r=0;r<e;r++){let i=t[r];if(r+1<e){let n=t[r+1],s=[i.end()],a=Pt(i,n);if(s=Om(a,s),s.length>1)return!0}for(let n=r+2;n<e;n++){let s=t[n],a=Pt(i,s);if(r==0&&n==e-1){for(let l=0;l<a;l+=2)if(new S(Ee[l],Ee[l+1]).distance1(i.start())>=1e-4)return!0}else if(a>0)return!0}}return!1}function hI(o,t){return C_(o)}var Li=class extends xi{constructor(){super(...arguments);this.modelType="Text"}get outlineModified(){return this.hasDataState(7)}set outlineModified(e){this.setDataState(7,e)}equals(e){let r=this.silkColor==e.silkColor||this.silkColor!=null&&e.silkColor!=null&&this.silkColor.equals(e.silkColor);return this.layerId==e.layerId&&this.type==e.type&&this.value==e.value&&this.showValue==e.showValue&&this.fontFamily==e.fontFamily&&this.fontSize==e.fontSize&&this.rotation==e.rotation&&this.origin==e.origin&&this.strokeWidth==e.strokeWidth&&this.reverse==e.reverse&&this.reverseExpansion==e.reverseExpansion&&this.mirror==e.mirror&&r&&this.position.equals(e.position)}};function Ite(o){let t=o.outline.map(r=>{let i=new Array;for(let n of r.primitives)if(n instanceof Dr){let s=n.points(.1),a=ge.build4(s);xe.addAll(i,a.primitives)}else i.push(n);return ge.build2(i)});return t=pSt(t),new wf("",0,t).pls}function pSt(o){let t=[];return o.forEach(e=>{if(Eo(e)){let i=hI(e);for(let n of i)t.push(n)}else t.push(e)}),t}var lx=class extends xi{get matrix(){let t=oc(this.layerId,this.mirror);return Ae.rotateZ(this.rotation).scale(t?-1:1,1,1).translate1(this.start.x,this.start.y,0)}};var Dl=class extends lx{constructor(){super(...arguments);this.modelType="Image"}get templateModified(){return this.hasDataState(7)}set templateModified(e){this.setDataState(7,e)}getPath(){let e=this.getViewMatrix(),r=this.getTemplatePath();return r.forEach(i=>{i.pl=i.pl.multiply3(e.toMatrix3())}),r}getPathByTemplatePath(e){let r=this.getViewMatrix(),i=e;return i=i.map(n=>n.clone()),i.forEach(n=>{n.pl=n.pl.multiply3(r.toMatrix3())}),i}};var Cte=class{static rectToPolygon(t){if(t[0]=="R"){let e=new S(t[1],t[2]),r=t[3],i=t[4],n=new S(e.x+r,e.y),s=new S(e.x+r,e.y-i),a=new S(e.x,e.y-i);return[e.x,e.y,"L",n.x,n.y,s.x,s.y,a.x,a.y,e.x,e.y]}else return t}};var sS=class sS{static BaseBoxModel(t=!0){return sS._modify?(t&&(sS._modify=!1),!0):!1}constructor(t,e,r,i,n,s,a){if(this._layerId=t,this._leftLow=e,this._leftUp=r,this._rightLow=i,this._rightUp=n,this._locked=s,a==null){let l=WO.getCache().boxCache;l[0]=Math.min(e.x,r.x,i.x,n.x),l[1]=Math.max(e.x,r.x,i.x,n.x),l[2]=Math.min(e.y,r.y,i.y,n.y),l[3]=Math.max(e.y,r.y,i.y,n.y),a=new ht(l[0],l[1],l[2],l[3])}this._bbox=a}isFlipX(){return this._rightLow.sub(this._leftLow).cross(this.rightUp.sub(this._rightLow))<0}get layerId(){return this._layerId}set layerId(t){this._layerId!=t&&(this._layerId=t)}get leftLow(){return this._leftLow}set leftLow(t){this._leftLow.equals(t)||(this._leftLow=t,sS._modify=!0)}get leftUp(){return this._leftUp}set leftUp(t){this._leftUp.equals(t)||(this._leftUp=t,sS._modify=!0)}get rightLow(){return this._rightLow}set rightLow(t){this._rightLow.equals(t)||(this._rightLow=t,sS._modify=!0)}get rightUp(){return this._rightUp}set rightUp(t){this._rightUp.equals(t)||(this._rightUp=t,sS._modify=!0)}get bbox(){return this._bbox}set bbox(t){this._bbox=t}get center(){return this.leftLow.add(this.rightUp).mul(.5)}set center(t){let e=this.center;this.leftLow=this.leftLow.sub(e).add(t),this.leftUp=this.leftUp.sub(e).add(t),this.rightLow=this.rightLow.sub(e).add(t),this.rightUp=this.rightUp.sub(e).add(t)}get width(){return this.leftLow.distance1(this.rightLow)}get height(){return this.leftLow.distance1(this.leftUp)}get rotation(){return this.rightLow.sub(this.leftLow).normalize().angle(S.ORIGIN)}get primitives(){let t=new M(this.leftLow,this.rightLow),e=new M(this.rightLow,this.rightUp),r=new M(this.rightUp,this.leftUp),i=new M(this.leftUp,this.leftLow);return[t,e,r,i]}get locked(){return this._locked}set locked(t){this._locked=t}extendOfSize(t){let e=this.rightLow.sub(this.leftLow).normalize().mul(t),r=this.leftUp.sub(this.leftLow).normalize().mul(t);return this.leftLow=this.leftLow.sub(e).sub(r),this.leftUp=this.leftUp.sub(e).add(r),this.rightLow=this.rightLow.add(e).sub(r),this.rightUp=this.rightUp.add(e).add(r),this}isIntersection(t){if(this.isContainBox(t)||t.isContainBox(this))return!0;for(let e of t.primitives)for(let r of this.primitives)if(e.bbox().isIntersect(r.bbox())&&Pt(e,r)>0)return!0;return!1}isContainBox(t){let e=this.rightLow.sub(this.leftLow).normalize(),r=Math.atan2(e.y,e.x);if(ne.eq(r,0)){let m=new _e().ext2(this.leftLow).ext2(this.rightLow).ext2(this.rightUp).ext2(this.leftUp).build1();return!!(m.isContains(t.leftLow)||m.isContains(t.rightLow)||m.isContains(t.rightUp)||m.isContains(t.leftUp))}let i=Ae.translate(-this.leftLow.x,-this.leftLow.y,0).rotateZ(-r).translate1(this.leftLow.x,this.leftLow.y,0),n=this.leftLow.multiply4(i),s=this.rightLow.multiply4(i),a=this.rightUp.multiply4(i),l=this.leftUp.multiply4(i),c=new _e().ext2(n).ext2(s).ext2(a).ext2(l).build1(),h=t.leftLow.multiply4(i);if(c.isContains(h))return!0;let u=t.rightLow.multiply4(i);if(c.isContains(u))return!0;let d=t.rightUp.multiply4(i);if(c.isContains(d))return!0;let p=t.leftUp.multiply4(i);return!!c.isContains(p)}transform(t){this.leftLow=this.leftLow.multiply4(t),this.leftUp=this.leftUp.multiply4(t),this.rightLow=this.rightLow.multiply4(t),this.rightUp=this.rightUp.multiply4(t),this.updateBox()}inShape(t,e,r){if(this.width==0&&this.height==0)return!1;let i=this.leftLow.sub(this.leftUp).normalize(),n=this.rightUp.sub(this.rightLow).normalize(),s=this.rightLow.sub(this.leftLow).normalize(),a=this.leftUp.sub(this.rightUp).normalize(),l=new S(t,e),c=l.sub(this.leftUp).normalize(),h=l.sub(this.leftLow).normalize(),u=l.sub(this.rightLow).normalize(),d=l.sub(this.rightUp).normalize();return i.cross(c)*n.cross(u)>=0&&s.cross(h)*a.cross(d)>=0}updateBox(){let t=ht.extend3(this.leftLow,this.leftUp),e=ht.extend3(this.rightLow,this.rightUp);return this.bbox=ht.extend2(t,e),this.bbox}getMathGraphics(t=this.layerId,e=0){if(this.layerId==t){let r=this.rightLow.sub(this.leftLow).normalize().mul(e),i=this.leftUp.sub(this.leftLow).normalize().mul(e),n=this.leftLow.sub(r).sub(i),s=this.leftUp.sub(r).add(i),a=this.rightLow.add(r).sub(i),l=this.rightUp.add(r).add(i),c=new Array,h=new M(n,s),u=new M(s,l),d=new M(l,a),p=new M(a,n);return c.push(h),c.push(u),c.push(d),c.push(p),ge.build2(c)}return null}clone(){return new sS(this._layerId,this._leftLow,this._leftUp,this._rightLow,this._rightUp,this._locked,this._bbox)}};sS.Blength=15,sS._modify=!1;var bs=sS;var Kk=class{constructor(t,e,r,i,n,s,a,l,c,h,u,d){this.num=0;this.type=t,this.origin=s,this.strokeWidth=a,this.mirror=h,this.showKey=e,this.showValue=r,this.fontFamily=i,this.fontSize=n,this.reverse=l,this.reverseExpansion=c,this.positionIsNull=u,this.silkColor=d}};var n8e=Ru(gY());var dy=class extends Kk{constructor(t,e,r,i,n,s,a,l,c,h,u,d,p,m){super(r,i,n,s,a,l,c,h,u,d,p,m),this._layerId=t,this._locked=e}get layerId(){return this._layerId}set layerId(t){this._layerId!=t&&(this._layerId=t)}get locked(){return this._locked}set locked(t){this._locked=t}};var QL=class QL extends Ei{constructor(){super(...arguments);this.uuidMap={}}static getInstance(){return QL.mgr==null&&(QL.mgr=new QL),QL.mgr}getId(e){let r=this.uuidMap[e];return r==null&&(r=(0,n8e.default)(e),this.uuidMap[e]=r),r}get(e,r,i,n,s,a,l,c,h,u,d,p){let m=this.getId(`${e}/${r}/${i}/${n}/${s}/${a}/${l}/${c}/${h}/${u}/${d}/${p}/`),g=this.map.get(m);return g==null&&(g=new Kk(e,r,i,n,s,a,l,c,h,u,d,p),this.map.set(m,g)),g.num++,g}getSpace(e,r,i,n,s,a,l,c,h,u,d,p,m,g){let y=this.getId(`${e}/${r}/${i}/${n}/${s}/${a}/${l}/${c}/${h}/${u}/${d}/${p}/${m}/${g}/`),b=this.map.get(y);return b==null&&(b=new dy(e,r,i,n,s,a,l,c,h,u,d,p,m,g),this.map.set(y,b)),b.num++,b}setType(e,r){return r.num--,r instanceof dy?this.getSpace(r.layerId,r.locked,e,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor):this.get(e,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor)}setShowKey(e,r){return r.num--,r instanceof dy?this.getSpace(r.layerId,r.locked,r.type,e,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor):this.get(r.type,e,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor)}setShowValue(e,r){return r.num--,r instanceof dy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,e,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor):this.get(r.type,r.showKey,e,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor)}setFontFamily(e,r){return r.num--,r instanceof dy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,r.showValue,e,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor):this.get(r.type,r.showKey,r.showValue,e,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor)}setFontSize(e,r){return r.num--,r instanceof dy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,r.showValue,r.fontFamily,e,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor):this.get(r.type,r.showKey,r.showValue,r.fontFamily,e,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor)}setOrigin(e,r){return r.num--,r instanceof dy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,e,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor):this.get(r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,e,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor)}setStrokeWidth(e,r){return r.num--,r instanceof dy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,e,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor):this.get(r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,e,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor)}setReverse(e,r){return r.num--,r instanceof dy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,e,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor):this.get(r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,e,r.reverseExpansion,r.mirror,r.positionIsNull,r.silkColor)}setReverseExpansion(e,r){return r.num--,r instanceof dy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,e,r.mirror,r.positionIsNull,r.silkColor):this.get(r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,e,r.mirror,r.positionIsNull,r.silkColor)}setMirror(e,r){return r.num--,r instanceof dy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,e,r.positionIsNull,r.silkColor):this.get(r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,e,r.positionIsNull,r.silkColor)}setPositionIsNull(e,r){return r.num--,r instanceof dy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,e,r.silkColor):this.get(r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,e,r.silkColor)}setSilkColor(e,r){return r.num--,r instanceof dy?this.getSpace(r.layerId,r.locked,r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,e):this.get(r.type,r.showKey,r.showValue,r.fontFamily,r.fontSize,r.origin,r.strokeWidth,r.reverse,r.reverseExpansion,r.mirror,r.positionIsNull,e)}setLayerIdLocked(e,r,i){return i.num--,this.getSpace(e,r,i.type,i.showKey,i.showValue,i.fontFamily,i.fontSize,i.origin,i.strokeWidth,i.reverse,i.reverseExpansion,i.mirror,i.positionIsNull,i.silkColor)}toBase(e){return e.num--,this.get(e.type,e.showKey,e.showValue,e.fontFamily,e.fontSize,e.origin,e.strokeWidth,e.reverse,e.reverseExpansion,e.mirror,e.positionIsNull,e.silkColor)}};QL.mgr=null;var C0=QL;var o8e=Ru(gY());var Ste=class{constructor(t,e,r,i,n,s){this.fontFamily=t;this.fontSize=e;this.reverse=r;this.expansion=i;this.bold=n;this.italic=s;this.num=0}};var eM=class eM extends Ei{constructor(){super(...arguments);this.uuidMap={}}static getInstance(){return eM.mgr==null&&(eM.mgr=new eM),eM.mgr}getId(e){let r=this.uuidMap[e];return r==null&&(r=(0,o8e.default)(e),this.uuidMap[e]=r),r}get(e,r,i,n,s,a){let l=this.getId(`${e}/${r}/${i}/${n}/${s}/${a}/`),c=this.map.get(l);return c==null&&(c=new Ste(e,r,i,n,s,a),this.map.set(l,c)),c.num++,c}setFontFamily(e,r){if(r.num--,r.num==0){let i=this.getId(`${r.fontFamily}/${r.fontSize}/${r.reverse}/${r.expansion}/${r.bold}/${r.italic}/`);this.map.delete(i)}return this.get(e,r.fontSize,r.reverse,r.expansion,r.bold,r.italic)}setFontSize(e,r){if(r.num--,r.num==0){let i=this.getId(`${r.fontFamily}/${r.fontSize}/${r.reverse}/${r.expansion}/${r.bold}/${r.italic}/`);this.map.delete(i)}return this.get(r.fontFamily,e,r.reverse,r.expansion,r.bold,r.italic)}setReverse(e,r){if(r.num--,r.num==0){let i=this.getId(`${r.fontFamily}/${r.fontSize}/${r.reverse}/${r.expansion}/${r.bold}/${r.italic}/`);this.map.delete(i)}return this.get(r.fontFamily,r.fontSize,e,r.expansion,r.bold,r.italic)}setExpansion(e,r){if(r.num--,r.num==0){let i=this.getId(`${r.fontFamily}/${r.fontSize}/${r.reverse}/${r.expansion}/${r.bold}/${r.italic}/`);this.map.delete(i)}return this.get(r.fontFamily,r.fontSize,r.reverse,e,r.bold,r.italic)}setBold(e,r){if(r.num--,r.num==0){let i=this.getId(`${r.fontFamily}/${r.fontSize}/${r.reverse}/${r.expansion}/${r.bold}/${r.italic}/`);this.map.delete(i)}return this.get(r.fontFamily,r.fontSize,r.reverse,r.expansion,e,r.italic)}setItalic(e,r){if(r.num--,r.num==0){let i=this.getId(`${r.fontFamily}/${r.fontSize}/${r.reverse}/${r.expansion}/${r.bold}/${r.italic}/`);this.map.delete(i)}return this.get(r.fontFamily,r.fontSize,r.reverse,r.expansion,r.bold,e)}};eM.mgr=null;var Zk=eM;var Jk=Zk.getInstance(),Ete=class{constructor(t,e,r){this.width=NaN;this.height=NaN;this.id=t,this.polylines=e,this.base=r}hasOutline(){return this.polylines?this.polylines.length>0:!1}get outline(){return I0(this.polylines)}get fontFamily(){return this.base.fontFamily}set fontFamily(t){t!=this.base.fontFamily&&(this.base=Jk.setFontFamily(t,this.base))}get fontSize(){return this.base.fontSize}set fontSize(t){t!=this.base.fontSize&&(this.base=Jk.setFontSize(t,this.base))}get reverse(){return this.base.reverse}set reverse(t){t!=this.base.reverse&&(this.base=Jk.setReverse(t,this.base))}get expansion(){return this.base.expansion}set expansion(t){t!=this.base.expansion&&(this.base=Jk.setExpansion(t,this.base))}get bold(){return this.base.bold}set bold(t){t!=this.base.bold&&(this.base=Jk.setBold(t,this.base))}get italic(){return this.base.italic}set italic(t){t!=this.base.italic&&(this.base=Jk.setItalic(t,this.base))}sycnOldFontParam(t){this.text=t.text,this.fontFamily=t.fontFamily,this.fontSize=t.fontSize,this.reverse=t.reverse,this.expansion=t.expansion}toString(){var e;return this.fontFamily+":"+this.text+":"+this.fontSize+":"+this.reverse.toString()+":"+this.expansion+":"+this.bold.toString()+":"+this.italic.toString()+":"+this.width.toString()+":"+this.height.toString()+":"+((e=this.polylines)==null?void 0:e.length.toString())}toJSON(){return{id:this.id,fontFamily:this.fontFamily,text:this.text,fontSize:this.fontSize,reverse:this.reverse,expansion:this.expansion,bold:this.bold,italic:this.italic,width:this.width,height:this.height,outline:this.outline}}};var gSt=0,tM=class tM extends Ei{static getInstance(){return tM.manager==null&&(tM.manager=new tM),tM.manager}getFontCache(t,e,r,i,n,s=!1,a=!1){if(e!=""){for(let[,l]of this.map)if(this.isEqual(t,e,r,i,n,s,a,l))return l}}addFontCache(t,e,r,i,n,s,a,l,c=!1,h=!1){let u="FONT"+gSt++,d=Zk.getInstance().get(t,r,i,n,c,h),p=new Ete(u,l,d);return this.map.delete(u),this.map.set(u,p),p.fontFamily=t,p.text=e,p.fontSize=r,p.reverse=i,p.expansion=n,p.width=s,p.height=a,p.bold=c,p.italic=h,Lf.ins.updateFontCache(p),p}isEqual(t,e,r,i,n,s=!1,a=!1,l){return!!(t==l.fontFamily&&e==l.text&&ne.eq(r,l.fontSize)&&i==l.reverse&&(i&&ne.eq(n,l.expansion)||!i)&&s==l.bold&&a==l.italic&&l.hasOutline())}getAllItem(){let t=[],e={},r=io.getInstance();for(let[i]of this.map){let n=r.getItem(i),s=this.map.get(i),a=s.toString();n!=null&&s.text!=""&&s.hasOutline()&&e[a]==null&&(t.push(s),e[a]=s)}return t}getFontTemplate(t){return this.map.get(t)}copy(t,e){if(t!=null){let{id:r,fontFamily:i,text:n,fontSize:s,reverse:a,expansion:l,bold:c,italic:h,width:u,height:d,outline:p}=t;this.getFontCache(i,n,s,a,l,c,h)==null&&this.addFontCache(i,n,s,a,l,u,d,Jh(p),c,h)}}clear(){this.map.clear()}};tM.manager=null;var py=tM;function YO(o,t,e,r,i,n,s,a=!1,l=!1){if(t=="default")return fd(e,r,s);if(["default2","Serif","Sans Serif"].includes(t))return ABe(t,e,r,s);let c=py.getInstance(),h=c.getFontTemplate(o);if(h!=null&&c.isEqual(t,e,r,i,n,a,l,h)||(h=c.getFontCache(t,e,r,i,n,a,l)),h!=null){if(isNaN(h.width)||isNaN(h.height)){let u=new _e;for(let d of h.polylines)u.ext1(d.bbox());if(u.valid()){let d=u.build1();h.width=d.width(),h.height=d.height()}else h.width=0,h.height=0}return{width:h.width,height:h.height,path:h.polylines}}else return null}var Ote=class Ote{constructor(){this.footprints=new Map}add(t){for(let e of t.getItems())e instanceof Li&&Lf.ins.has(e)&&this.footprints.set(e,t)}updateFontCache(t){let e=this.footprints.get(t);e!=null&&e.refershBBox()}};Ote.ins=new Ote;var Qk=Ote;var Ate=class Ate{constructor(){this.texts=new Set}addFont(t){this.queryFont(t)||this.texts.add(t)}updateFont(t){this.queryFont(t)||this.texts.add(t)}deleteFont(t){this.texts.delete(t)}has(t){return this.texts.has(t)}queryFont(t){let e=t.getText();if(e==""||e==null)return t.outline=[],t.updateBox4(0,0),!0;let r=t.fontFamily,i=r==""||["","default","default2","Serif","Sans Serif"].includes(r);i&&!cy.everyCharHasDefaultFontPath(e)&&(t.fontFamily="\u9ED1\u4F53",i=!1),i?t.type=0:t.type=1;let n=YO(t.globalIndex,t.fontFamily,e,t.fontSize,t.reverse,t.reverseExpansion,t.strokeWidth);return n&&n.path?(t.outline=n.path,t.updateBox4(n.width,n.height),!0):!1}updateFontCache(t){let e=py.getInstance(),r=!1,i=!1,n=Array.from(this.texts);for(let s of n){let a=s.getText();s.reverseExpansion;let{fontFamily:l,fontSize:c,reverse:h,reverseExpansion:u}=s;e.isEqual(l,a,c,h,u,r,i,t)&&(s.outline=t.polylines,s.updateBox4(t.width,t.height),this.texts.delete(s),Qk.ins.updateFontCache(s))}}};Ate.ins=new Ate;var Lf=Ate;var Ku=class o extends Li{constructor(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,x){super();this._matrixChange=!1;if(this._globalIndex=e,this._position=d,this._rotation=u,this._key=n,this._value=a,this._outline=T,s||l){this.base=C0.getInstance().get(i,s,l,c,h,p,m,g,y,b,P,O);let v=oc(r,b),D=t3(p),w=new S(D.x*I,D.y*C),F=Ae.getMatrix4(w,u,v?-1:1,d),H=S.ORIGIN.multiply4(F),z=new S(0,C).multiply4(F),V=new S(I,0).multiply4(F),W=new S(I,C).multiply4(F);x||(x=new bs(r,H,z,V,W,E,_)),this._box=x}else this.base=C0.getInstance().getSpace(r,E,i,s,l,c,h,p,m,g,y,b,P,O);Lf.ins.addFont(this),Ro("data/model/TextModel")}get positionIsNull(){return this.base.positionIsNull}set positionIsNull(e){this.base.positionIsNull!=e&&(this.base=C0.getInstance().setPositionIsNull(e,this.base))}get show(){return this.showKey||this.showValue}get box(){if(!this.show||this._box==null){let{layerId:e,locked:r}=this.base;return new bs(e,this._position,this._position,this._position,this._position,r)}return this.reset4Matrix(),this._box}set box(e){this.show?this._box=e:this.base=C0.getInstance().setLayerIdLocked(e.layerId,e.locked,this.base),this._matrixChange=!1}get bbox(){return!this.show||this._box==null?this._position.bbox():this._box.bbox}get matrix(){let e=oc(this.layerId,this.mirror),r=t3(this.origin),i=new S(r.x*this.width,r.y*this.height),n=this.rotation;return Ae.getMatrix4(i,n,e?-1:1,this.position)}get layerId(){var e;return((e=this._box)==null?void 0:e.layerId)||this.base.layerId}set layerId(e){this.layerId!=e&&(this.watchLayerIdModify(this.layerId),!this.show||this._box==null?this.base=C0.getInstance().setLayerIdLocked(e,this.base.locked,this.base):this._box.layerId=e,this._matrixChange=!0,this.updateShapeData(),this.layerModified=!0)}get type(){return this.base.type}set type(e){this.base.type!=e&&(this.base=C0.getInstance().setType(e,this.base),this.updateShapeData())}get position(){return this._position}set position(e){this._position.equals(e)||(this._position=e,this.updateShapeData(),this._matrixChange=!0)}get rotation(){return this._rotation}set rotation(e){Math.abs(this.rotation-e)<1e-8||this._rotation!=e&&(this._rotation=e,this._matrixChange=!0,this.updateShapeData())}get origin(){return this.base.origin}set origin(e){this.base.origin!=e&&(this.base=C0.getInstance().setOrigin(e,this.base),this._matrixChange=!0,this.updateShapeData())}get strokeWidth(){return this.base.strokeWidth}set strokeWidth(e){e<=0&&(e=vc),this.base.strokeWidth!=e&&(this.base=C0.getInstance().setStrokeWidth(e,this.base),this.updateShapeData(),Lf.ins.updateFont(this))}get mirror(){return this.base.mirror}set mirror(e){this.base.mirror!=e&&(this.base=C0.getInstance().setMirror(e,this.base),this._matrixChange=!0,this.updateShapeData())}get width(){return!this.show||this._box==null?0:this._box.width}get height(){return!this.show||this._box==null?0:this._box.height}get locked(){return this._box!=null?this._box.locked:this.base.locked}set locked(e){!this.show||this._box==null?this.base=C0.getInstance().setLayerIdLocked(this.base.layerId,e,this.base):this._box.locked=e}get outline(){return this._outline}set outline(e){this._outline!=e&&(this._outline=e,this.outlineModified=!0)}updateShow(){if(this._box==null&&this.show){let{layerId:e,locked:r}=this.base,i=oc(e,this.base.mirror),n=t3(this.base.origin),s=new S(n.x*0,n.y*0),a=Ae.getMatrix4(s,this._rotation,i?-1:1,this._position),l=S.ORIGIN.multiply4(a),c=new S(0,0).multiply4(a),h=new S(0,0).multiply4(a),u=new S(0,0).multiply4(a);this._box=new bs(e,l,c,h,u,r),this.base=C0.getInstance().toBase(this.base)}else!this.show&&this._box!=null&&(this.base=C0.getInstance().setLayerIdLocked(this._box.layerId,this._box.locked,this.base),this._box=void 0)}get key(){return this._key}set key(e){this._key!=e&&(this._key=e,Lf.ins.updateFont(this))}get showKey(){return this.base.showKey}set showKey(e){this.base.showKey!=e&&(this.base=C0.getInstance().setShowKey(e,this.base),this.updateShow(),Lf.ins.updateFont(this))}get value(){return this._value}set value(e){this._value!=e&&(this._value=e,Lf.ins.updateFont(this))}get showValue(){return this.base.showValue}set showValue(e){this.base.showValue!=e&&(this.base=C0.getInstance().setShowValue(e,this.base),this.updateShow(),Lf.ins.updateFont(this))}get fontFamily(){return this.base.fontFamily}set fontFamily(e){this.base.fontFamily!=e&&(this.base=C0.getInstance().setFontFamily(e,this.base),Lf.ins.updateFont(this))}get fontSize(){return this.base.fontSize}set fontSize(e){this.base.fontSize!=e&&(this.base=C0.getInstance().setFontSize(e,this.base),Lf.ins.updateFont(this))}get reverse(){return this.base.reverse}set reverse(e){this.base.reverse!=e&&(this.base=C0.getInstance().setReverse(e,this.base),Lf.ins.updateFont(this))}get reverseExpansion(){return this.base.reverseExpansion}set reverseExpansion(e){this.base.reverseExpansion!=e&&(this.base=C0.getInstance().setReverseExpansion(e,this.base),Lf.ins.updateFont(this))}get silkColor(){return this.base.silkColor}set silkColor(e){this.silkColor!=e&&(this.base=C0.getInstance().setSilkColor(e,this.base))}set matrixChange(e){this._matrixChange!=e&&(this._matrixChange=e)}get matrixChange(){return this._matrixChange}reset4Matrix(){this._matrixChange&&(this.reset4(this.width,this.height,this.matrix),this._matrixChange=!1)}getMatrix(e=this.width,r=this.height){let i=oc(this.layerId,this.mirror),n=t3(this.origin),s=new S(n.x*e,n.y*r),a=this.rotation;return Ae.getMatrix4(s,a,i?-1:1,this.position)}updateBox4(e,r){let i=this.getMatrix(e,r);this.reset4(e,r,i),this._matrixChange=!1}transform(e,r){if(!r){let n=new S(e.data[0],e.data[1]).normalize(),s=Math.atan2(n.y,n.x);oc(this.layerId,this.mirror)?this.rotation=this.rotation-s:this.rotation=this.rotation+s}let i=this.position.multiply4(e);this.position=i,this._matrixChange=!0}inShape(e,r,i){return!this.show||this._box==null?!1:(this.reset4Matrix(),this._box.inShape(e,r,i))}reset4(e,r,i){if(!this.show||this._box==null)return;this._box==null&&this.updateShow();let n=new S(i.data[12],i.data[13]);this._box.leftLow=n,e==0&&r==0?(this._box.leftUp=n,this._box.rightLow=n,this._box.rightUp=n):(this._box.leftUp=new S(0,r).multiply4(i),this._box.rightLow=new S(e,0).multiply4(i),this._box.rightUp=new S(e,r).multiply4(i)),this.updateShapeData()}updateBox(){return!this.show||this._box==null?this._position.bbox():(this.reset4Matrix(),this._box.updateBox())}getMathGraphics(e=this.layerId,r=0){return this.reset4Matrix(),this.isEmpty?null:this.box.getMathGraphics(e,r)}clone(){var i;this.refreshBBox&&this.updateBox(),this.reset4Matrix();let e=new Array;for(let n of this.outline)e.push(n.clone());let r=new o(this._globalIndex,this.layerId,this.base.type,this._key,this.base.showKey,this._value,this.base.showValue,this.base.fontFamily,this.base.fontSize,this._rotation,this._position,this.base.origin,this.base.strokeWidth,this.base.reverse,this.base.reverseExpansion,this.base.mirror,this.base.positionIsNull,e,this.width,this.height,this.locked,this.silkColor,(i=this._box)==null?void 0:i.bbox);return r.number=this.number,r.zIndex=this.zIndex,r}remove(){Lf.ins.deleteFont(this),super.remove()}getRealOutline(){let e=this.matrix,r=this.outline;if(this.type==1){let i=Ite(this);return i.forEach(n=>{n.pl=n.pl.multiply3(e.toMatrix3())}),i}else return r.map(i=>i.multiply3(e.toMatrix3()))}getTextOutline(){let e=this.matrix,r=this.outline;return this.type==1?(r=r.map(i=>i.multiply3(e.toMatrix3())),r):r.map(i=>i.multiply3(e.toMatrix3()))}getText(){let e="",r=this.key,i=this.value,n=this.showKey,s=this.showValue;return r!=""&&i===""&&R.getInstance().doctype!=3&&this.getParent()==null&&r!="Footprint"&&!R.getInstance().footprintIsConnectDevice&&(i=`<${r}>`),n?s?e=r+":"+i:e=r:s?e=i:e="",e}buildBBox(){return this.isEmpty?null:(this.refreshBBox&&(this.updateBox(),this.refreshBBox=!1),this.bbox)}},o3=class o extends Ku{constructor(){super(...arguments);this._parent=void 0}clone(){var i;this.refreshBBox&&this.updateBox(),this.reset4Matrix();let e=new Array;for(let n of this.outline)e.push(n.clone());let r=new o(this._globalIndex,this.layerId,this.base.type,this._key,this.base.showKey,this._value,this.base.showValue,this.base.fontFamily,this.base.fontSize,this._rotation,this._position,this.base.origin,this.base.strokeWidth,this.base.reverse,this.base.reverseExpansion,this.base.mirror,this.base.positionIsNull,e,this.width,this.height,this.locked,this.silkColor,(i=this._box)==null?void 0:i.bbox);return r.number=this.number,r.zIndex=this.zIndex,r}};var rM=class rM extends Ei{static getInstance(){return rM.manager==null&&(rM.manager=new rM),rM.manager}addModel(t){this.map.set(t.globalIndex,t)}addText(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y=!1,b=!1,P=0,T){return r!=""?this._last=new o3(t,e,P,r,i,n,s,a,l,c,u,d,p,m,g,y,b,[],0,0,h,T):this._last=new Ku(t,e,P,r,i,n,s,a,l,c,u,d,p,m,g,y,b,[],0,0,h,T),this.addModel(this._last),this._last}delete(t){t instanceof Li&&this.map.delete(t.globalIndex)}deleteById(t){this.map.delete(t)}};rM.manager=null;var io=rM;var s3=class{constructor(t,e,r,i,n=!0){this.layers=new Array;this.items=new Array;this.attrsMap={};this.attributes=new Map;this.textOffset=S.ORIGIN;this.ids=new Set;this.resultNeedToBeCached=!0;this.componentId=r,this._footprintUUID=t,this._deviceUUID=e,this.resultNeedToBeCached=n,this._bbox=i}clear(){this.layers.length=0,this.items.length=0,this.attrsMap=null,this.attributes.clear(),this.ids.clear(),this.layers=null,this.items=null,this.attributes=null}addCloneItem(t){if(t.modelType=="Text"&&t.key!=""){let e=t;this.attributes.set(e.key,e),this.attrsMap[e.key]=e.value,this.ids.add(e.globalIndex)}else this.items.push(t),this.ids.add(t.globalIndex)}addReuseAttrMap(){this.attrsMap["Reuse Block"]==null&&(this.attrsMap["Reuse Block"]=""),this.attrsMap["Group ID"]==null&&(this.attrsMap["Group ID"]=""),this.attrsMap["Channel ID"]==null&&(this.attrsMap["Channel ID"]="")}modify(t,e){let r=this.attributes.get(t);r!=null&&(r.value=e||"")}buildModel(){let t=S.ORIGIN,e=new Array(this.attributes.size),r=0;for(let l of this.attributes.values())e[r]=l,r++;let i={...this.attrsMap},n=Array.from(this.items),s=new bs(1,this._bbox.LL(),this._bbox.UL(),this._bbox.LR(),this._bbox.UR(),!1,this._bbox);return this.resultNeedToBeCached?Ms.getInstance().add(this.componentId,1,t,0,this.textOffset,i,e,n,s,this._footprintUUID,this._deviceUUID):new Bi(this.componentId,1,t,0,this.textOffset,i,e,n,s,this._footprintUUID,this._deviceUUID,null)}getComponent(t,e,r,i,n,s,a,l){let c=this.buildModel();if(c.setLayerIdReplacementTable(l),c.layerId=r,r==2){let u=Ae.getMatrix4(S.ORIGIN,n-Math.PI,1,i);c.multiply4(u)}else{let u=Ae.getMatrix4(S.ORIGIN,n,1,i);c.multiply4(u)}c.locked=a;for(let u in s)u!="Device"&&u!="Footprint"&&c.addATTRMap(u,s[u]);return e!=null&&c.setGroupID(e),c}hasId(t){return this.ids.has(t)}addId(t){return this.ids.add(t)}getId(){let t=0,e=this.componentId+"e"+t++;for(;this.ids.has(e);)e=this.componentId+"e"+t++;return e}getNoRepeatId(t){let e=0,r=t+"r"+e++;for(;this.ids.has(r);)r=t+"r"+e++;return r}getAttr(t){return this.attributes.get(t)}transform(t){for(let e of this.items)e.transform(t);for(let e of this.attributes.values())e.transform(t)}};var ca={PartitionId:"partitionId",Index:"Index",GroupID:"groupId",Net:"netName",Name:"ruleName",StartLayer:"StartLayer",EndLayer:"EndLayer",CenterX:"centerX",CenterY:"centerY",HoleDiameter:"holeDiameter",ViaDiameter:"viaDiameter",ViaType:"viaType",TopSolderExpansion:"topSolderExpansion",BottomSolderExpansion:"bottomSolderExpansion",Locked:"locked",UnusedInnerLayers:"unusedInnerLayers",ZIndex:"zIndex"};var Ib=class{getConfig(t){return t>"1.9"?{CANVAS:this.getCANVAS(t),LAYER:this.getLAYER(t),LAYER_PHYS:this.getLAYER_PHYS(t),ACTIVE_LAYER:this.getACTIVE_LAYER(t),NET:this.getNET(t),PRIMITIVE:this.getPRIMITIVE(t),GROUP:this.getGROUP(t),VIA:this.getVIA(t),PAD:this.getPAD(t),LINE:this.getLINE(t),ARC:this.getARC(t),FILL:this.getFILL(t),FPC_FILL:this.getFPC_FILL(t),POLY:this.getPOLY(t),REGION:this.getREGION(t),PARTITION:this.getPARTITION(t),POUR:this.getPOUR(t),POURED:this.getCopper(t),BOARD:this.getBoard(t),IMAGE:this.getIMAGE(t),OBJ:this.getOBJ(t),TEARDROP:this.getTEARDROP(t),FONT:this.getFONT(t),STRING:this.getSTRING(t),ATTR:this.getATTR(t),DIMENSION:this.getDIMENSION(t),COMPONENT:this.getCOMPONENT(t),PAD_NET:this.getPAD_NET(t),RULE_TEMPLATE:this.getRULE_TEMPLATE(t),RULE:this.getRULE(t),RULE_SELECTOR:this.getRULE_SELECTOR(t),EQLEN_GRP:this.getEQLEN_GRP(t),EQLEN:this.getEQLEN(t),SHELL:this.getSHELL(t),SHELLCUT:this.getSHELLCUT(t),SHELL_ENTITY:this.getSHELLENTITY(t),CREASE:this.getCREASE(t),BOSS:this.getBOSS(t),PANELIZE:this.getPanelize(t),SILK_OPTS:this.getSILK_OPTS(t),PREFERENCE:this.getPreference(t),INNER:this.getInner()}:t>"1.7"?{CANVAS:this.getCANVAS(t),LAYER:this.getLAYER(t),LAYER_PHYS:this.getLAYER_PHYS(t),ACTIVE_LAYER:this.getACTIVE_LAYER(t),NET:this.getNET(t),PRIMITIVE:this.getPRIMITIVE(t),GROUP:this.getGROUP(t),CONNECT:this.getCONNECT(t),VIA:this.getVIA(t),PAD:this.getPAD(t),LINE:this.getLINE(t),ARC:this.getARC(t),CARC:this.getARC(t),FILL:this.getFILL(t),FPC_FILL:this.getFPC_FILL(t),POLY:this.getPOLY(t),REGION:this.getREGION(t),PARTITION:this.getPARTITION(t),POUR:this.getPOUR(t),POURED:this.getCopper(t),IMAGE:this.getIMAGE(t),OBJ:this.getOBJ(t),TEARDROP:this.getTEARDROP(t),FONT:this.getFONT(t),STRING:this.getSTRING(t),ATTR:this.getATTR(t),DIMENSION:this.getDIMENSION(t),COMPONENT:this.getCOMPONENT(t),PAD_NET:this.getPAD_NET(t),DEVICE:this.getDEVICE(t),RULE_TEMPLATE:this.getRULE_TEMPLATE(t),RULE:this.getRULE(t),RULE_SELECTOR:this.getRULE_SELECTOR(t),EQLEN_GRP:this.getEQLEN_GRP(t),EQLEN:this.getEQLEN(t),SHELL:this.getSHELL(t),SHELLCUT:this.getSHELLCUT(t),SHELL_ENTITY:this.getSHELLENTITY(t),CREASE:this.getCREASE(t),BOSS:this.getBOSS(t),PANELIZE:this.getPanelize(t),PROP:this.getProperty(t),SILK_OPTS:this.getSILK_OPTS(t),PREFERENCE:this.getPreference(t),CUSTOMFOOTPRINT:this.getCustomFootprint(t)}:{CANVAS:this.getCANVAS(t),LAYER:this.getLAYER(t),LAYER_PHYS:this.getLAYER_PHYS(t),ACTIVE_LAYER:this.getACTIVE_LAYER(t),NET:this.getNET(t),PRIMITIVE:this.getPRIMITIVE(t),GROUP:this.getGROUP(t),CONNECT:this.getCONNECT(t),VIA:this.getVIA(t),PAD:this.getPAD(t),LINE:this.getLINE(t),ARC:this.getARC(t),CARC:this.getARC(t),FILL:this.getFILL(t),FPC_FILL:this.getFPC_FILL(t),POLY:this.getPOLY(t),REGION:this.getREGION(t),PARTITION:this.getPARTITION(t),POUR:this.getPOUR(t),POURED:this.getCopper(t),IMAGE:this.getIMAGE(t),OBJ:this.getOBJ(t),TEARDROP:this.getTEARDROP(t),FONT:this.getFONT(t),STRING:this.getSTRING(t),ATTR:this.getATTR(t),DIMENSION:this.getDIMENSION(t),COMPONENT:this.getCOMPONENT(t),PAD_NET:this.getPAD_NET(t),DEVICE:this.getDEVICE(t),RULE_TEMPLATE:this.getRULE_TEMPLATE(t),RULE:this.getRULE(t),RULE_SELECTOR:this.getRULE_SELECTOR(t),EQLEN_GRP:this.getEQLEN_GRP(t),EQLEN:this.getEQLEN(t),SHELL:this.getSHELL(t),SHELLCUT:this.getSHELLCUT(t),SHELL_ENTITY:this.getSHELLENTITY(t),CREASE:this.getCREASE(t),BOSS:this.getBOSS(t),PANELIZE:this.getPanelize(t),SILK_OPTS:this.getSILK_OPTS(t),PREFERENCE:this.getPreference(t),REUSE_BLOCK:this.getReuseBlock(t),CUSTOMFOOTPRINT:this.getCustomFootprint(t),INNER:this.getInner()}}getInner(){return["fill"]}getProperty(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","color"];default:return["color"]}}getSILK_OPTS(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["layerId","defaultColor","baseColor"];default:return["defaultColor","baseColor"]}}getCANVAS(t){return["originX","originY","unit","gridXSize","gridYSize","snapXSize","snapYSize","altSnapXSize","altSnapYSize","gridType","multiGridType","multiGridRatio","highlightValue"]}getLAYER(t){return["layerId","layerType","layerName","use","show","locked","activeColor","activateTransparency","inactiveColor","inactiveTransparency"]}getLAYER_PHYS(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":"layerId","material","thickness","permittivity","lossTangent","isKeepIsland";default:return["material","thickness","permittivity","lossTangent","isKeepIsland","zIndex"]}}getACTIVE_LAYER(t){return["layerId"]}getRULE_TEMPLATE(t){return["name"]}getNET(t){switch(t){case"1.0":return["netName","netType","specialColor","retLine"];case"1.1":case"1.2":return["netName","netType","specialColor","retLine","differentialName","isPositiveNet"];case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["netName","netType","specialColor","retLine","differentialName","isPositiveNet","equalLengthGroupName"];default:return["netType","specialColor","retLine","differentialName","isPositiveNet","equalLengthGroupName"]}}getPRIMITIVE(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["primiveName","display","pick"];default:return["display","pick"]}}getGROUP(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["groupID","groupName"];default:return["groupName"]}}getCONNECT(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["mainId","relatedIds"];default:return["relatedIds"]}}getVIA(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return[ca.Index,ca.GroupID,ca.Net,ca.Name,ca.CenterX,ca.CenterY,ca.HoleDiameter,ca.ViaDiameter,ca.ViaType,ca.TopSolderExpansion,ca.BottomSolderExpansion,ca.Locked,ca.UnusedInnerLayers];default:return[ca.PartitionId,ca.GroupID,ca.Net,ca.Name,ca.CenterX,ca.CenterY,ca.HoleDiameter,ca.ViaDiameter,ca.ViaType,ca.TopSolderExpansion,ca.BottomSolderExpansion,ca.Locked,ca.UnusedInnerLayers,ca.ZIndex]}}getPAD(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return[0,"groupId","netName","layerId","num","centerX","centerY","padAngle","hole","defaultPad","specialPad","padOffsetX","padOffsetY","relativeAngle","plated","padType","topSolderExpansion","bottomSolderExpansion","topPasteExpansion","bottomPasteExpansion","locked","connectMode","spokeSpace","spokeWidth","spokeAngle","unusedInnerLayers","padLen"];default:return["partitionId","groupId","netName","layerId","num","centerX","centerY","padAngle","hole","defaultPad","specialPad","padOffsetX","padOffsetY","relativeAngle","plated","padType","topSolderExpansion","bottomSolderExpansion","topPasteExpansion","bottomPasteExpansion","locked","zIndex","connectMode","spokeSpace","spokeWidth","spokeAngle","unusedInnerLayers","padLen","attrsMap"]}}getLINE(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","netName","layerId","startX","startY","endX","endY","width","locked"];default:return["partitionId","groupId","netName","layerId","startX","startY","endX","endY","width","locked","zIndex"]}}getARC(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","netName","layerId","startX","startY","endX","endY","angle","width","locked"];default:return["partitionId","groupId","netName","layerId","startX","startY","endX","endY","angle","width","locked","zIndex","arcType"]}}getPOLY(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","netName","layerId","width","path","locked"];default:return["partitionId","groupId","netName","layerId","width","path","locked","zIndex","specialColor","polyType"]}}getFILL(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","netName","layerId","width","fillStyle","path","locked"];default:return["partitionId","groupId","netName","layerId","width","fillStyle","path","locked","zIndex","isBridgingCopper","networkList","refs","specialColor"]}}getFPC_FILL(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","layerId","material","thickness","path","locked"];default:return["partitionId","groupId","layerId","material","thickness","path","locked","zIndex"]}}getREGION(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","layerId","width","prohibitType","path","locked","name"];default:return["partitionId","groupId","layerId","width","prohibitType","path","locked","name","zIndex","regionType"]}}getBoard(t){return["path"]}getPARTITION(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","name","fileUuid","path"];default:return["name","fileUuid","path"]}}getPOUR(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","netName","layerId","width","name","order","path","pourType","keepIsland","locked"];default:return["partitionId","groupId","netName","layerId","width","name","order","path","pourType","keepIsland","locked","zIndex"]}}getCopper(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["id","targetId","strokeWidth","fill","path"];case"1.9":return["partitionId","strokeWidth","fill","path","id"];default:return["pourFill"]}}getIMAGE(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","layerId","startX","startY","width","height","angle","mirror","path","locked"];default:return["partitionId","groupId","layerId","startX","startY","width","height","angle","mirror","path","locked","zIndex","specialColor"]}}getOBJ(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","layerId","fileName","startX","startY","width","height","angle","mirror","path","locked"];default:return["partitionId","groupId","layerId","fileName","startX","startY","width","height","angle","mirror","path","locked","zIndex"]}}getTEARDROP(t){switch(t){case"1.0":case"1.1":return["index","netName","layerId","refs","path"];case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","netName","layerId","path","groupId"];default:return["partitionId","netName","layerId","path","groupId","refs","locked"]}}getFONT(t){switch(t){case"1.0":case"1.1":return[0,"path"];case"1.2":case"1.3":case"1.4":case"1.5":return[0,"width","height","path"];default:return["text","fontFamily","fontSize","thickness","bold","italic","reverse","expansion","width","height","path"]}}getSTRING(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["Index","groupId","layerId","x","y","text","fontFamily","fontSize","strokeWidth","bold","italic","origin","angle","reverse","expansion","mirror","locked"];default:return["partitionId","groupId","layerId","x","y","text","fontFamily","fontSize","strokeWidth","bold","italic","origin","angle","reverse","expansion","mirror","locked","zIndex","specialColor"]}}getATTR(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupID","parentId","layerId","x","y","key","value","keyVisible","valueVisible","fontFamily","fontSize","strokeWidth","bold","italic","origin","angle","reverse","expansion","mirror","locked"];default:return["partitionId","groupID","parentId","layerId","x","y","key","value","keyVisible","valueVisible","fontFamily","fontSize","strokeWidth","bold","italic","origin","angle","reverse","expansion","mirror","locked","zIndex","specialColor"]}}getDIMENSION(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","type","layerId","unit","strokeWidth","precision","textFollow","coords","locked"];default:return["partitionId","type","layerId","unit","strokeWidth","precision","textFollow","coords","locked","zIndex","groupId","specialColor","text"]}}getCOMPONENT(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","layerId","x","y","angle","attrs","locked"];default:return["partitionId","groupId","layerId","x","y","angle","attrs","locked","zIndex","specialColor","layerIdReplacements"]}}getPAD_NET(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["componentId","padNum","padNet","padId","padLen"];default:return["partitionId","componentId","padNum","padNet","padId","padLen","attrsMap"]}}getDEVICE(t){return[0,1]}getRULE(t){return["ruleType","ruleName","ruleState","ruleContext"]}getRULE_SELECTOR(t){return["ruleSelect","ruleOrder","ruleKeyValue","copperValue","innerPlaneValue"]}getEQLEN_GRP(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["sort","name","groupColor"];default:return["name","sort","pads"]}}getEQLEN(t){return[0,1]}getSHELL(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","shellType","shellHeight","pcbHeight","strokeWidth","path","attrs","locked"];default:return["partitionId","groupId","shellType","shellHeight","pcbHeight","strokeWidth","path","locked","zIndex","thickness","direction","bottomHeight","topInnerHeight","bottomInnerHeight"]}}getSHELLCUT(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","layerId","depth","strokeWidth","path","locked"];default:return["partitionId","groupId","layerId","depth","strokeWidth","path","locked","zIndex"]}}getSHELLENTITY(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","layerId","booleanOperation","belong","depth","strokeWidth","path","locked"];default:return["partitionId","groupId","layerId","depth","strokeWidth","path","locked","zIndex","type","entityBelong","slotOptions","refs"]}}getBOSS(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":return["index","groupId","layerId","specification","centerX","centerY","depth","counterBore","stiffener","locked"];case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","layerId","centerX","centerY","specification","depth","thickness","holeDiameter","counterBore","stiffener","locked"];default:return["partitionId","groupId","layerId","centerX","centerY","specification","depth","thickness","holeDiameter","counterBore","stiffener","locked","zIndex"]}}getPanelize(t){return["on","row","column","rowSpacing","columnSpacing","onlyOutline","horizontalStamp","verticalStamp","horizontalSize","verticalSize"]}static getPanelizeStamp(t){return["on","stampHoleGroupQuantity","stampHoleDiameter","stampHoleQuantityPerGroup","stampHoleSpacing"]}static getPanelizeSide(t){return["on","sideHeight","positionHoleDiameter","markDiameter","markExpansion"]}getCREASE(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["index","groupId","layerId","startX","startY","endX","endY","angle","locked"];default:return["partitionId","groupId","layerId","startX","startY","endX","endY","angle","locked","zIndex"]}}getPreference(t){return["startTrackWidthFollowLast","lastTrackWidth","startViaSizeFollowLast","lastViaInnerDiameter","lastViaDiameter","snap","routingMode","routingCorner","removeLoop","rotatingObject","trackFollow","stretchTrackMinCorner","preferenceConfig","realTimeUpdateUnusedLayers","unusedPadRange","pushVia","pathOptimization4BePushed","currentPathOptimization4BePushed","removeCircuitsContainingVias","removeAntenna"]}getReuseBlock(t){switch(t){case"1.0":case"1.1":case"1.2":case"1.3":case"1.4":case"1.5":case"1.6":case"1.7":case"1.8":return["shapeID","groupId","channelId"];default:return["groupId","channelId"]}}getCustomFootprint(t){return[0,1]}},iM=new Ib().getConfig("2.0");function _te(o){return o?1:0}function y2(o){return o===1}function Ia(o){let t=o.getGroupID();return t==null||R.getInstance().doctype==4?0:t}function Ca(o){return o==="0"||o===0?null:o!=null?o.toString():null}function o1(o,t=1){if(o.primitives.length==1){let n=o.primitives[0];if(n instanceof q&&n.sweepAngle==360)return["CIRCLE",ve(n.center.x*t,4),ve(n.center.y*t,4),ve(n.rx*t,4)]}let e=new Array,r=o.primitives,i=!1;for(let n of r)if(n instanceof M&&n.length()>1e-8)e.push(ve(n.start().x*t,4)),e.push(ve(n.start().y*t,4)),i||(e.push("L"),i=!0);else if(n instanceof q&&ud(n)>1e-8)i=!1,e.push(ve(n.start().x*t,4)),e.push(ve(n.start().y*t,4)),n instanceof m9?e.push("CARC"):e.push("ARC"),e.push(ve(n.sweepAngle,4));else if(n instanceof Dr){i=!1,e.push(ve(n.start().x*t,4)),e.push(ve(n.start().y*t,4)),e.push("C");for(let s=1,a=n.controls.length;s<a-1;s++){let l=n.controls[s];e.push(ve(l.x*t,4)),e.push(ve(l.y*t,4))}}return e.length>2&&(e.push(ve(r[r.length-1].end().x*t,4)),e.push(ve(r[r.length-1].end().y*t,4))),e}var In=class{getKey(){return this.id}};var eB=class extends In{};var h8e=["Polyimide","FR4","Stainless Steel","Tape","EMI Shielding Film"];var u8e=["3M468","3M9077","TESA8854"],tu=class o extends cd{constructor(e,r,i){super();this._material="Polyimide";this._fpcModel=null;this.material=e,this.fpcModel=r,this.thickness=i}get material(){return this._material}set material(e){this._material=e}get fpcModel(){return this._fpcModel}set fpcModel(e){this._fpcModel=e}get thickness(){return this._thickness}set thickness(e){this._thickness=e}toJSON(){return{material:this.material,fpcModel:this.fpcModel,thickness:this.thickness}}clone(){return new o(this.material,this.fpcModel,this.thickness)}};function vte(o){switch(o){case 3:return $a.LEFT_BOTTOM;case 6:return $a.CENTER_BOTTOM;case 9:return $a.RIGHT_BOTTOM;case 2:return $a.LEFT_MIDDLE;case 5:return $a.CENTER_MIDDLE;case 8:return $a.RIGHT_MIDDLE;case 1:return $a.LEFT_TOP;case 4:return $a.CENTER_TOP;case 7:return $a.RIGHT_TOP;default:return $a.LEFT_BOTTOM}}function CIe(o){switch(o){case $a.LEFT_BOTTOM:return 3;case $a.CENTER_BOTTOM:return 6;case $a.RIGHT_BOTTOM:return 9;case $a.LEFT_MIDDLE:return 2;case $a.CENTER_MIDDLE:return 5;case $a.RIGHT_MIDDLE:return 8;case $a.LEFT_TOP:return 1;case $a.CENTER_TOP:return 4;case $a.RIGHT_TOP:return 7}}function SIe(o){switch(o){case 0:return hO.NORMAL;case 2:return hO.MARKER;case 1:return hO.TEST;default:return hO.NORMAL}}function p8e(o){switch(o){case hO.NORMAL:return 0;case hO.MARKER:return 2;case hO.TEST:return 1;default:return 0}}function f8e(o){switch(o){case 1:return cO.BLIND;case 2:return cO.SUTURE;case 0:return cO.NORMAL;default:return cO.NORMAL}}function m8e(o){switch(o){case cO.BLIND:return 1;case cO.SUTURE:return 2;case cO.NORMAL:return 0;default:return 0}}function g8e(o){switch(o){case Hw.DOT:return 1;case Hw.CENTER:return 2;default:return 2}}function y8e(o){switch(o){case 1:return Hw.DOT;case 2:return Hw.CENTER;default:return Hw.CENTER}}function hx(o){switch(o){case Io.AUTO_ROUTER:return"12";case Io.BLIND:return"4";case Io.COPPER:return"7";case Io.DIFFER_ENTAIL:return"10";case Io.NET_LENGTH:return"11";case Io.NET_LENGTH_TOLERANCE:return"13";case Io.OTHER:return"2";case Io.PASTE:return"8";case Io.PLANE:return"6";case Io.RADIUS:return"5";case Io.SAFE:return"1";case Io.SOLDER:return"9";case Io.TRACK:return"3";case Io.CREEPAGE:return"14";default:return o}}function Nf(o){switch(o){case"12":return Io.AUTO_ROUTER;case"4":return Io.BLIND;case"7":return Io.COPPER;case"10":return Io.DIFFER_ENTAIL;case"11":return Io.NET_LENGTH;case"13":return Io.NET_LENGTH_TOLERANCE;case"2":return Io.OTHER;case"8":return Io.PASTE;case"6":return Io.PLANE;case"5":return Io.RADIUS;case"1":return Io.SAFE;case"9":return Io.SOLDER;case"3":return Io.TRACK;case"14":return Io.CREEPAGE;default:return null}}function b8e(o){switch(o){case Yw.DEFAULT:return 1;case Yw.NORMAL:return 0;default:return 0}}function P8e(o){switch(o){case 1:return Yw.DEFAULT;case 0:return Yw.NORMAL;default:return Yw.NORMAL}}function T8e(o){switch(o){case fO.FORTY_FIVE:return 0;case fO.NINETY:return 1;case fO.NINETY_ARC:return 2;default:return 0}}function I8e(o){switch(o){case 0:return fO.FORTY_FIVE;case 1:return fO.NINETY;case 2:return fO.NINETY_ARC;default:return fO.FORTY_FIVE}}function C8e(o){switch(o){case mO.LESS:return 0;case mO.MID:return 1;case mO.MORE:return 2;default:return 0}}function S8e(o){switch(o){case 0:return mO.LESS;case 1:return mO.MID;case 2:return mO.MORE;default:return mO.LESS}}function E8e(o){switch(o){case qw.COMPLETION_FIRST:return 1;case qw.SPEED_FIRST:return 0;default:return 1}}function O8e(o){switch(o){case 1:return qw.COMPLETION_FIRST;case 0:return qw.SPEED_FIRST;default:return qw.COMPLETION_FIRST}}function A8e(o){switch(o){case YT.M2:return"M2";case YT.M3:return"M3";case YT.M4:return"M4";case YT.M5:return"M5";case YT.M6:return"M6";default:return null}}function _8e(o){switch(o){case"M2":return YT.M2;case"M3":return YT.M3;case"M4":return YT.M4;case"M5":return YT.M5;case"M6":return YT.M6;default:return null}}function v8e(o){switch(o){case zw.PUSH_COVER:return"DRAWER";case zw.UPPER_LOWER_SHELLS:return"T&B";default:return"DRAWER"}}function x8e(o){switch(o){case"DRAWER":return zw.PUSH_COVER;case"T&B":return zw.UPPER_LOWER_SHELLS;default:return zw.PUSH_COVER}}function R8e(o){switch(o){case v9.X_AXIS_NEGATIVE:return 2;case v9.X_AXIS_POSITIVE:return 1;case v9.Y_AXIS_NEGATIVE:return 8;case v9.Y_AXIS_POSITIVE:return 4;default:return null}}function D8e(o){switch(o){case 2:return v9.X_AXIS_NEGATIVE;case 1:return v9.X_AXIS_POSITIVE;case 8:return v9.Y_AXIS_NEGATIVE;case 4:return v9.Y_AXIS_POSITIVE;default:return null}}function EIe(o){switch(o){case aO.GRID:return"grid";case aO.NONE:return"none";case aO.OUTLETS:return"outlets";default:return"none"}}function OIe(o){switch(o){case"grid":return aO.GRID;case"none":return aO.NONE;case"outlets":return aO.OUTLETS;default:return aO.NONE}}function w8e(o){switch(o){case zT.EMI_SHIELDING_FILM:return"EMI Shielding Film";case zT.FR4:return"FR4";case zT.M3_DOUBLE_SIDED_TAPE:return"Tape";case zT.PI:return"Polyimide";case zT.STEEL_SHEET:return"Stainless Steel";default:return o}}function AIe(o){switch(o){case"EMI Shielding Film":return zT.EMI_SHIELDING_FILM;case"FR4":return zT.FR4;case"Tape":return zT.M3_DOUBLE_SIDED_TAPE;case"Polyimide":return zT.PI;case"Stainless Steel":return zT.STEEL_SHEET;default:return o}}function L8e(o){switch(o){case IP.NONE:return"WIRING_MODE_IGNORE";case IP.OBSTRUCT:return"WIRING_MODE_OBSTRUCT";case IP.PUSH:return"WIRING_MODE_PUSHAWAY";case IP.SURROUND:return"WIRING_MODE_SURROUND";case IP.SURROUND_AND_PUSH:return"WIRING_MODE_SURROUND_AND_PUSHAWAY";default:return"WIRING_MODE_IGNORE"}}function M8e(o){switch(o){case"WIRING_MODE_IGNORE":return IP.NONE;case"WIRING_MODE_OBSTRUCT":return IP.OBSTRUCT;case"WIRING_MODE_PUSHAWAY":return IP.PUSH;case"WIRING_MODE_SURROUND":return IP.SURROUND;case"WIRING_MODE_SURROUND_AND_PUSHAWAY":return IP.SURROUND_AND_PUSH;default:return IP.NONE}}function N8e(o){switch(o){case rv.VIA:return 3;case rv.PAD:return 2;case rv.ALL:return 1;default:return null}}function k8e(o){switch(o){case 3:return rv.VIA;case 2:return rv.PAD;case 1:return rv.ALL;default:return null}}function B8e(o){switch(o){case SN.OPTIMIZA_NONE:return"OPTIMIZA_NONE";case SN.OPTIMIZA_OPEN:return"OPTIMIZA_OPEN";default:return null}}function F8e(o){switch(o){case"OPTIMIZA_NONE":return SN.OPTIMIZA_NONE;case"OPTIMIZA_OPEN":return SN.OPTIMIZA_OPEN;default:return null}}function V8e(o){switch(o){case iv.NONE:return 2;case iv.ALL:return 1;case iv.SINGLE:return 0;default:return null}}function G8e(o){switch(o){case 2:return iv.NONE;case 1:return iv.ALL;case 0:return iv.SINGLE;default:return null}}function U8e(o){switch(o){case nv.OPTIMIZA_NONE:return"OPTIMIZA_NONE";case nv.OPTIMIZA_STRONG:return"OPTIMIZA_STRONG";case nv.OPTIMIZA_WEAK:return"OPTIMIZA_WEAK";default:return null}}function H8e(o){switch(o){case"OPTIMIZA_NONE":return nv.OPTIMIZA_NONE;case"OPTIMIZA_STRONG":return nv.OPTIMIZA_STRONG;case"OPTIMIZA_WEAK":return nv.OPTIMIZA_WEAK;default:return null}}function W8e(o){switch(o){case Jm.ELLIPSE:return"ELLIPSE";case Jm.OVAL:return"OVAL";case Jm.RECT:return"RECT";case Jm.POLYGON:return"POLYGON";default:return null}}function z8e(o){switch(o){case"ELLIPSE":return Jm.ELLIPSE;case"OVAL":return Jm.OVAL;case"RECT":return Jm.RECT;case"POLYGON":return Jm.POLYGON;default:return null}}function Y8e(o){switch(o){case lO.ROUND:return"ROUND";case lO.SLOT:return"SLOT";case lO.RECT:return"RECT";default:return"ROUND"}}function j8e(o){switch(o){case"ROUND":return lO.ROUND;case"SLOT":return lO.SLOT;case"RECT":return lO.RECT;default:return lO.ROUND}}function sM(o){switch(o){case uO.DIRECT:return 1;case uO.DIVERGENCE:return 0;case uO.NON_CONNECT:return 2;default:return 1}}function aM(o){switch(o){case 1:return uO.DIRECT;case 0:return uO.DIVERGENCE;case 2:return uO.NON_CONNECT;default:return uO.DIRECT}}function WP(o){return o?1:0}function zP(o){return o==1}function X8e(o){switch(o){case Xw.DIRECT:return 0;case Xw.NON_CONNECT:return 1;default:return 0}}function q8e(o){switch(o){case 0:return Xw.DIRECT;case 1:return Xw.NON_CONNECT;default:return Xw.DIRECT}}function $8e(o){switch(o){case jw.ALL:return 0;case jw.LAYERED:return 1;default:return 0}}function K8e(o){switch(o){case 0:return jw.ALL;case 1:return jw.LAYERED;default:return jw.ALL}}function Z8e(o){switch(o){case Ww.NORMAL:return"Line";case Ww.BOARD_OUTLINE:return"Board Outline";default:return"Line"}}function J8e(o){switch(o){case"Line":return Ww.NORMAL;case"Board Outline":return Ww.BOARD_OUTLINE;default:return Ww.NORMAL}}var YP=class extends eB{constructor(t=!1){super(),this.replace=t}getData(t,e){var r;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupID":return Ia(e);case"parentId":let i=e.getParent();return i!=null?i.globalIndex:"";case"layerId":return e.layerId;case"x":return e.positionIsNull?null:ve(e.position.x*10,4);case"y":return e.positionIsNull?null:ve(e.position.y*10,4);case"key":return e.key;case"value":{let n=e.getParent();if(n!=null&&n instanceof Bi)if(this.replace){if(e.key==="Device")return Tu.getInstance().getItem(n.deviceUUID).name==e.value?n.deviceUUID:e.value;if(e.key==="Footprint")return Ji.getInstance().getItem(n.footprintUUID).footprintId==e.value?n.footprintUUID:e.value}else{if(e.key==="Device")return n.deviceUUID;if(e.key==="Footprint")return n.footprintUUID;if(e.key==="Name")return n.attrsMap.Name}return e.value}case"keyVisible":return e.showKey;case"valueVisible":return e.showValue;case"fontFamily":return e.fontFamily;case"fontSize":return ve(e.fontSize*10,4);case"strokeWidth":return ve(e.strokeWidth*10,4);case"bold":return 0;case"italic":return 0;case"origin":return this.getAlign(e.origin);case"angle":return ve(e.rotation/Math.PI*180,4);case"reverse":return e.reverse;case"expansion":return ve(e.reverseExpansion*10,4);case"mirror":return e.mirror;case"locked":return e.locked;case"zIndex":return e.zIndex;case"path":return I0(e.outline);case"width":return e.width;case"height":return e.height;case"specialColor":return(3==e.layerId||4==e.layerId)&&e.silkColor!=null&&(e.getParent()==null||e.getParent()!=null&&e.key!="")?(r=e.silkColor)==null?void 0:r.toString():null}}getAlign(t){switch(t){case 3:return $a.LEFT_BOTTOM;case 6:return $a.CENTER_BOTTOM;case 9:return $a.RIGHT_BOTTOM;case 2:return $a.LEFT_MIDDLE;case 5:return $a.CENTER_MIDDLE;case 8:return $a.RIGHT_MIDDLE;case 1:return $a.LEFT_TOP;case 4:return $a.CENTER_TOP;case 7:return $a.RIGHT_TOP}}};function bY(o,t,e){let r="";return t=="Footprint"?r=e:t=="Designator"&&(r="U?"),{id:"e"+o,partitionId:null,groupId:"0",parentId:"",layerId:3,x:null,y:null,key:t,value:r,keyVisible:!1,valueVisible:!1,fontFamily:"default",fontSize:50,strokeWidth:8,bold:!1,italic:!1,origin:vte(3),angle:0,reverse:!1,expansion:0,mirror:!1,locked:!1,zIndex:null,path:null,width:null,height:null,number:-1}}function XO(o,t,e){return e.sub(o).rotate(S.ORIGIN,-t)}function xte(o,t){if(!o)return!1;for(let e=0;e<o.length;e++){let r=o[e];if(Array.isArray(r)){let i=!1;for(let n=0;n<r.length;n++){let s=r[n];if(t(s,e,n)){i=!0;break}}if(i)return!0;continue}if(t(r,e,-1))return!0}return!1}function iB(o){return o.length==0||Array.isArray(o[0])?o:[o]}function lM(o){return o.length==1&&Array.isArray(o[0])?o[0]:o}var Rte=class extends Q4e{constructor(t,e){let r=R.getInstance().projectId;super(t,r,R.getInstance().currOpenProjectId===r,e)}setHandle(t){this.handle=t}onDocDetail(t,e,r){var i;(i=this.handle)==null||i.onDocDetail(t,e,r)}};var nB=class{constructor(){this.client="";this._ticket=-1}setClient(t){this.client=t}setTicket(t){this._ticket=t}};var oB=class extends nB{constructor(){super(...arguments);this.attr={};this.client=""}onDocDetail(e,r,i){this.client=e;let n=i,s=n==null?void 0:n.attributes,a=(n==null?void 0:n.title)||"",l=this.attr={};if(s)for(let c in s)c!="uuid"&&c!="utime"&&c!="Footprint"&&(l[c]=s[c]);this.name=a,this.utime=n==null?void 0:n.updateTime,this.footprintUUID=s==null?void 0:s.Footprint,delete this.attr.Footprint,delete this.attr.Symbol,delete this.attr["Convert to PCB"],delete this.attr["Sim Model"],delete this.attr["Sim Model Title"],delete this.attr["Sim Model Path"],delete this.attr["NGSpice Model"],delete this.attr["NGSpice Model Title"],delete this.attr["NGspice Model Path"]}};var ux=class{constructor(t,e){this._attrMap={};this.attrDataMap={};this.components=new Set;this.client="";this.compiler=new Rte(t,e),this._uuid=t}async destroy(){await this.compiler.destroy()}async parse(t,e){let r=this.compiler,i=new oB;return r.setHandle(i),(e?await e(r):await r.init(t)).success?(this.client=i.client,this.sycn(i),this.attrModel=new Ku("",3,0,"Device",!1,this._name,!1,"default",_Ie,0,S.ORIGIN,3,.6,!1,0,!1,!0,[],0,0,!1),this.addAttr(this.attrModel.key,this.getAttrData1(this.attrModel)),!0):!1}sycn(t){this._name=t.name,this._utime=t.utime,this._footprintUUID=t.footprintUUID,this._attrMap=t.attr}setHandle(t){this.compiler.setHandle(t),t.setClient(this.client)}get footprintUUID(){return this._footprintUUID}get name(){return this._name}get uuid(){return this._uuid}get utime(){return this._utime}get attrs(){return this._attrMap}get attrMap(){return this._attrMap}set name(t){this._name=t}set uuid(t){this._uuid=t}set utime(t){this._utime=t}set footprintUUID(t){this._footprintUUID=t}set attrMap(t){this._attrMap=t}createComponent(t,e){e==null&&(e=this.footprintUUID);let r=Ji.getInstance().getItem(e),i=new s3(e,this._uuid,t,r.getBBox());return i=r.generate(i),this.overlap(i),i}rebuildComponent(t,e,r,i){e==null&&(e=this.footprintUUID);let n=Ji.getInstance().getItem(e),s=new s3(e,this._uuid,t,n.getBBox(),i);return s=n.formatParseBuild(s,r),this.overlapAttr(s,r),s}getAttrData(t,e){let r=new YP,i=iM.ATTR,n=new Array(6),s=XO(t.position,t.rotation,e.position),a=e.rotation-t.rotation,l=0;for(let c=0,h=i.length;c<h;c++){let u=i[c];if(u=="x")n[l]=ve(s.x*10),l++;else if(u=="y")n[l]=ve(s.y*10),l++;else if(u=="angle")n[l]=ve(a/Math.PI*180,3),l++;else if(u=="keyVisible")n[l]=!1,l++;else if(u=="valueVisible")n[l]=!1,l++;else{let d=r.getData(u,e);n[l]=d,l++}}return n}getAttrData1(t){let e=new YP,r=iM.ATTR,i=r.length,n=new Array(i);for(let s=0;s<i;s++){let a=r[s],l=e.getData(a,t);n[s]=l}return n}addAttr(t,e){this.attrDataMap[t]=e}restoreAttr(t,e){let{componentPosition:r,angle:i,footprintId:n,componentLayerId:s}=e;n==null&&(n=this._footprintUUID);let a=Ji.getInstance().getItem(n);if(a.has(t.key))t=a.restoreAttr(t,{componentPosition:r,angle:i,componentLayerId:s}),this.has(t.key)&&(t.value=this._attrMap[t.key]);else{let l=this.attrDataMap[t.key];l!=null&&this.restore(t,r,i,l)}}copy(t,e){t==null&&(t=this._footprintUUID);let r=Ji.getInstance().getItem(t),i=new s3(t,this._uuid,e,r.getBBox());return i=r.copy(i),i}add(t){this.components.add(t)}delete(t){t instanceof Bi&&this.components.delete(t)}getComponents(){let t=new Array;return this.components.forEach(e=>{t.push(e)}),t}overlapAttr(t,e){let r=null,i=new Set;for(let s of e)this._attrMap[s.key]!=null&&s.key!="Name"&&i.add(s.key),s.key=="Device"&&(r=s);for(let s in this._attrMap){if(s=="Footprint"||i.has(s))continue;let a=this._attrMap[s];t.attrsMap[s]!=null&&t.modify(s,a),t.attrsMap[s]=a}let n=t.getAttr("Device");n==null?r!=null?(n=r.finish(),t.addCloneItem(n)):(n=this.attrModel.clone(),n.globalIndex=t.getId(),aS(n),t.addCloneItem(n)):n.value=this._name,t.attrsMap.Device=this._name}overlap(t){for(let r in this._attrMap)r!="Footprint"&&(t.attrsMap[r]!=null&&t.modify(r,this._attrMap[r]),t.attrsMap[r]=this._attrMap[r]);t.attrsMap.Device!=null&&t.modify("Device",this._name);let e=t.getAttr("Device");t.getAttr("Device")==null?(e=this.attrModel.clone(),e.globalIndex=t.getId(),aS(e),t.addCloneItem(e)):e.value=this._name,t.attrsMap.Device=this._name}overlapValue(t){let e=t.key;e!="Footprint"&&(e=="Device"?t.value!=this._name&&(t.value=this._name):this._attrMap[e]!=null&&(t.value=this._attrMap[e]))}has(t){return this._attrMap[t]!=null}checkKeyValue(t,e,r){if(t=="Footprint"){r==null&&(r=this._footprintUUID);let i=Ji.getInstance().getItem(r);return i==null||r!=this._footprintUUID?!1:e==i.footprintId}if(t=="Device")return e==this.name;if(this.has(t))return this._attrMap[t]==e;{if(r==null&&(r=this._footprintUUID),r==null)return!1;let i=Ji.getInstance().getItem(r);return i==null?!1:t=="3D Model"||t=="3D Model Title"||t=="3D Model Transform"?i.checkKeyValue(t,e)?!0:e===void 0:i.checkKeyValue(t,e)}}needSave(t,e,r,i,n){n==null&&(n=this._footprintUUID);let s=Ji.getInstance().getItem(n);return s.has(t.key)?s.needSave(t,e,r,i,this.attrMap[t.key]):this.needSave1(t,e,r)}needSave1(t,e,r){let i=.01,n=this.attrDataMap[t.key];if(n!=null){let a=iM.ATTR;for(let l=0,c=a.length;l<c;l++){let h=a[l],u=n[l];switch(h){case"layerId":{let d=parseInt(u);if(t.layerId!=d)return!0;break}case"x":{let d=parseFloat(u)/10;if(Math.abs(ve(e.x,2)-d)>i)return!0;break}case"y":{let d=parseFloat(u)/10;if(Math.abs(ve(e.y,2)-d)>i)return!0;break}case"value":if(t.value!=u)return!0;break;case"keyVisible":if(t.showKey!=y2(u))return!0;break;case"valueVisible":if(t.showValue!=y2(u))return!0;break;case"fontFamily":if(u==""&&(u="default"),t.fontFamily!=u)return!0;break;case"fontSize":{let d=parseFloat(u)/10;if(Math.abs(ve(t.fontSize,2)-d)>i)return!0;break}case"strokeWidth":{let d=parseFloat(u)/10;if(Math.abs(ve(t.strokeWidth,2)-d)>i)return!0;break}case"origin":if(u=CIe(u),t.origin!=u)return!0;break;case"angle":{let d=parseFloat(u)/180*Math.PI;if(Math.abs(d-r)>i)return!0;break}case"reverse":if(t.reverse!=y2(u))return!0;break;case"expansion":{let d=parseFloat(u)/10;if(Math.abs(ve(t.reverseExpansion,2)-d)>i)return!0;break}case"mirror":if(t.mirror!=y2(u))return!0;break;case"locked":if(t.locked!=y2(u))return!0;break}}return!1}else return!0}toJSON(){return{name:this._name,uuid:this._uuid,utime:this._utime,footprintUUID:this._footprintUUID,attrs:this._attrMap}}restore(t,e,r,i){let s=iM.ATTR,a=0,l=0;for(let c=0,h=s.length;c<h;c++){let u=s[c],d=i[c];switch(u){case"layerId":{let p=parseInt(d);isNaN(p)||(t.layerId=p);break}case"x":{let p=parseFloat(d)/10;isNaN(p)||(a=p);break}case"y":{let p=parseFloat(d)/10;isNaN(p)||(l=p);break}case"value":t.value=d;break;case"keyVisible":t.showKey=y2(d);break;case"valueVisible":t.showValue=y2(d);break;case"fontFamily":t.fontFamily=d;break;case"fontSize":{let p=parseFloat(d)/10;isNaN(p)||(t.fontSize=Math.abs(p));break}case"strokeWidth":{let p=parseFloat(d)/10;isNaN(p)||(t.strokeWidth=p);break}case"origin":t.origin=CIe(d);break;case"angle":{let p=parseFloat(d)/180*Math.PI;isNaN(p)||(t.rotation=p+r);break}case"reverse":t.reverse=y2(d);break;case"expansion":{let p=parseFloat(d)/10;isNaN(p)||(t.reverseExpansion=p);break}case"mirror":t.mirror=y2(d);break;case"locked":t.locked=y2(d);break}}t.position=new S(a,l).add(e).rotate(e,r)}};var fy=class fy extends Ei{constructor(){super();this.listener=null}static getInstance(e){e||(e=fy.otherDecodingProjectId);let r;return e?(r=fy.otherProjectManagerMap[e],r||(r=new fy,fy.otherProjectManagerMap[e]=r),r):(fy.manager||(fy.manager=new fy),r=fy.manager,r)}static async clearOtherProjectManagerMap(){fy.otherDecodingProjectId=void 0;for(let e in fy.otherProjectManagerMap)await fy.otherProjectManagerMap[e].clear(),delete fy.otherProjectManagerMap[e]}bindListener(e){this.listener=e}async bindDeviceListener(e){this.listener!=null&&await this.listener.bindListener(e)}addDevice(e,r){this.map.set(e,r)}async add(e,r,i){let n=this.map.get(e);if(n==null){n=new ux(e,r);try{await n.parse(i)&&this.addDevice(e,n)}catch(s){console.log(s);return}await this.bindDeviceListener(n)}return n}getItem(e){return this.map.get(e)}delete(e){e.modelType==="Component"&&this.deleteComponent(e)}deleteComponent(e){if(e instanceof Bi){let r=this.map.get(e.deviceUUID);r!=null&&r.delete(e)}}async clear(){for(let[,e]of this.map)await e.destroy();this.map.clear()}};fy.manager=null,fy.otherProjectManagerMap={};var Tu=fy;var Dte=class{};var wl=class extends Dte{constructor(){super(...arguments);this.resultNeedToBeCached=!0;this.keepDisabledLayerItem=!1}clearGroupId(){}changeNet4Map(e){}load(){}clear(){}isNumber(e){return e!=null&&!isNaN(e)}clearFootExcludeProps(){}get hashkey(){return this.index}get shapeLayerId(){return this.layerId}};var Zp=class extends wl{constructor(){super(...arguments);this.netModifyInter=null}loadPartitionId(e){e!==void 0&&this.model.partition!=e&&(this.model.partition=e)}clearFootExcludeProps(){this.partition=void 0}loadGroupId(e){e=Ca(e),this.model.getGroupID()!=e&&this.model.setGroupID(e)}loadLayerId(e){this.model.layerId!=e&&(this.model.layerId=e)}loadLocked(e){this.model.locked!=e&&(this.model.locked=e)}loadzIndex(e){this.model.zIndex!=e&&(this.model.zIndex=e)}loadNumber(e){e&&this.model.number!=e&&(this.model.number=e)}};var sB=class extends Zp{constructor(){super(...arguments);this.value="";this.showKey=!1;this.showValue=!0;this.strokeWidth=.6;this.reverse=!1;this.reverseExpansion=0;this.resetAttr=!1}getPosition(){let e=this.x,r=this.y;return this.x==null&&(e=S.ORIGIN.x),this.y==null&&(r=S.ORIGIN.y),new S(e,r)}getAlign(e){switch(e){case $a.LEFT_BOTTOM:return 3;case $a.CENTER_BOTTOM:return 6;case $a.RIGHT_BOTTOM:return 9;case $a.LEFT_MIDDLE:return 2;case $a.CENTER_MIDDLE:return 5;case $a.RIGHT_MIDDLE:return 8;case $a.LEFT_TOP:return 1;case $a.CENTER_TOP:return 4;case $a.RIGHT_TOP:return 7}}loadPosition(e){this.model.position.equals(e)||(this.model.position=e)}loadKey(e){this.model.key!=e&&(this.model.key=e)}loadValue(e){this.model.value!=e&&(this.model.value=e)}loadShowKey(e){this.model.showKey!=e&&(this.model.showKey=e)}loadShowValue(e){this.model.showValue!=e&&(this.model.showValue=e)}loadFontFamily(e){this.model.fontFamily!=e&&(this.model.fontFamily=e)}loadFontSize(e){this.model.fontSize!=e&&(this.model.fontSize=e)}loadStrokeWidth(e){this.model.strokeWidth!=e&&(this.model.strokeWidth=e)}loadOrigin(e){this.model.origin!=e&&(this.model.origin=e)}loadRotation(e){this.model.rotation!=e&&(this.model.rotation=e)}loadReverse(e){this.model.reverse!=e&&(this.model.reverse=e)}loadReverseExpansion(e){this.model.reverseExpansion!=e&&(this.model.reverseExpansion=e)}loadMirror(e){this.model.mirror!=e&&(this.model.mirror=e)}loadWAndH(e,r){(this.model.width!=e||this.model.height!=r)&&this.model.updateBox4(e||this.model.width,r||this.model.height)}getNameValueById(e,r){let i=r;if(e=="Device"){let n=Tu.getInstance().getItem(r);n!=null&&(i=n.name)}else if(e=="Footprint"){let n=Ji.getInstance().getItem(r);n!=null&&(i=n.footprintId)}return i}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadLayerId(this.layerId),this.loadPosition(this.getPosition()),this.loadKey(this.key||"");let e=this.getNameValueById(this.key,this.value);this.loadValue(e),this.loadShowKey(this.showKey),this.loadShowValue(this.showValue),this.loadFontFamily(this.fontFamily),this.loadFontSize(this.fontSize),this.loadStrokeWidth(this.strokeWidth),this.loadOrigin(this.origin),this.loadRotation(this.angle),this.loadReverse(this.reverse),this.loadReverseExpansion(this.reverseExpansion),this.loadMirror(this.mirror),this.loadLocked(this.locked),this.loadSpecialColor(this.specialColor)}loadSpecialColor(e){(this.model.silkColor!=e&&(this.model.silkColor==null||e==null)||this.model.silkColor!=null&&e!=null&&!this.model.silkColor.equals(e))&&(this.model.silkColor=e)}};var uI=class extends sB{constructor(){super()}feed(t){let{id:e,partitionId:r,groupId:i,parentId:n,layerId:s,x:a,y:l,key:c,value:h,keyVisible:u,valueVisible:d,fontFamily:p,fontSize:m,strokeWidth:g,bold:y,italic:b,origin:P,angle:T,reverse:I,expansion:C,mirror:E,locked:O,zIndex:_,number:x,specialColor:v}=t;if(this.partition=r,this.index=e,this.groupId=Ca(i),this.parentIndex=n,this.zIndex=_,this.number=x,this.isNumber(s)&&(this.layerId=s),this.isNumber(a)){let D=a/10;this.x=D}if(this.isNumber(l)){let D=l/10;this.y=D}this.key=c,this.value=h||"",this.showKey=u,this.showValue=d,this.fontFamily=p,this.isNumber(m)&&(this.fontSize=Math.abs(m/10)),this.isNumber(g)&&(this.strokeWidth=g/10),this.origin=this.getAlign(P),this.isNumber(T)&&(this.angle=T/180*Math.PI),this.reverse=I,this.isNumber(C)&&(this.reverseExpansion=C/10),this.mirror=E,this.locked=O,v&&(this.specialColor=ee.of3(v))}check(){return this.index==null||this.layerId==null||this.key==null||this.showKey==null||this.value==null||this.showValue==null||this.fontFamily==null||this.fontSize==null||this.angle==null||this.locked==null||this.origin==null||this.strokeWidth==null||this.mirror==null?!1:(this.showValue||this.showKey?this.positionIsNull=!1:(this.x==null||this.y==null)&&(this.positionIsNull=!0),this.x==null&&this.y==null&&!this.positionIsNull&&(this.resetAttr=!0),!0)}finish(){if(this.check()){let t=this.resultNeedToBeCached?io.getInstance().addText(this.index,this.layerId,this.key,this.showKey,this.value,this.showValue,this.fontFamily,this.fontSize,this.angle,this.locked,this.getPosition(),this.origin,this.strokeWidth,this.reverse,this.reverseExpansion,this.mirror,this.positionIsNull,null,this.specialColor):new o3(this.index,this.layerId,0,this.key,this.showKey,this.value,this.showValue,this.fontFamily,this.fontSize,this.angle,this.getPosition(),this.origin,this.strokeWidth,this.reverse,this.reverseExpansion,this.mirror,this.positionIsNull,[],0,0,this.locked,this.specialColor);return this.groupId!=null&&t.setGroupID(this.groupId),this.partition&&(t.partition=this.partition),this.isNumber(this.zIndex)&&(t.zIndex=this.zIndex),this.isNumber(this.number)&&(t.number=this.number),t}else return null}getText(t=this.value){let e="";return this.showKey?this.showValue?e=this.key+":"+t:e=this.key:this.showValue?e=t:e="",e}getOldFontParam(){let t=this.value;if(this.key=="Device"){let a=Tu.getInstance().getItem(this.value);a!=null&&(t=a.name)}else if(this.key=="Footprint"){let a=Ji.getInstance().getItem(this.value);a!=null&&(t=a.footprintId)}let e=this.getText(t),{fontFamily:r,fontSize:i,reverse:n,reverseExpansion:s}=this;return{fontFamily:r,fontSize:i,reverse:n,expansion:s,text:e}}loadDimension(t){this.model=t,this.loadGroupId(this.groupId);let e=this.getPosition();t.textPosition.equals(e)||(t.textPosition=e),t.fontSize!=this.fontSize&&(t.fontSize=this.fontSize)}loadShowKey(t){this.model.showKey!=t&&(this.model.showKey=t)}loadShowValue(t){this.model.showValue!=t&&(this.model.showValue=t)}};var cM=class extends sB{feed(t){let{id:e,partitionId:r,groupId:i,layerId:n,x:s,y:a,text:l,fontFamily:c,fontSize:h,strokeWidth:u,bold:d,italic:p,origin:m,angle:g,reverse:y,expansion:b,mirror:P,locked:T,zIndex:I,number:C,specialColor:E}=t;if(this.index=e,this.partition=r,this.groupId=Ca(i),this.layerId=n,this.zIndex=I,this.number=C,this.isNumber(s)){let _=s/10;this.x=_}if(this.isNumber(a)){let _=a/10;this.y=_}if(this.value=l,this.fontFamily=c,this.isNumber(h)){let _=h/10;this.fontSize=_}let O=u/10;if(this.isNumber(O)&&O>0&&(this.strokeWidth=O),this.origin=this.getAlign(m),this.isNumber(g)){let _=g/180*Math.PI;this.angle=_}if(this.reverse=y,this.isNumber(b)){let _=b/10;this.reverseExpansion=_}this.mirror=P,this.locked=T,E&&(this.specialColor=ee.of3(E))}check(){return!(this.index==null||this.layerId==null||((this.layerId==58||this.layerId==59)&&(this.layerId=1),this.value==null||this.value=="")||this.fontFamily==null||this.fontSize==null||this.strokeWidth==null||this.origin==null||this.angle==null||this.mirror==null||this.locked==null)}clear(){this.model=null,this.index=null,this.partition=null,this.groupId=null,this.zIndex=null,this.number=null,this.layerId=null,this.value=null,this.x=null,this.y=null,this.fontFamily=null,this.angle=null,this.mirror=null,this.origin=null,this.fontSize=null,this.zIndex=null,this.number=null,this.locked=null}clearGroupId(){this.groupId=null}finish(){if(this.check()){let t=this.resultNeedToBeCached?io.getInstance().addText(this.index,this.layerId,"",!1,this.value,!0,this.fontFamily,this.fontSize,this.angle,this.locked,new S(this.x,this.y),this.origin,this.strokeWidth,this.reverse,this.reverseExpansion<0?0:this.reverseExpansion,this.mirror,null,null,this.specialColor):new o3(this.index,this.layerId,0,"",!1,this.value,!0,this.fontFamily,this.fontSize,this.angle,new S(this.x,this.y),this.origin,this.strokeWidth,this.reverse,this.reverseExpansion<0?0:this.reverseExpansion,this.mirror,!1,[],0,0,this.locked,this.specialColor);return this.groupId!=null&&t.setGroupID(this.groupId),this.partition&&(t.partition=this.partition),this.isNumber(this.zIndex)&&(t.zIndex=this.zIndex),this.isNumber(this.number)&&(t.number=this.number),t}else return null}};var wte=class extends wl{constructor(){super(...arguments);this.activeAlpha=1;this.deactiveAlpha=.5}feed(e){let{layerId:r,layerType:i,layerName:n,use:s,show:a,locked:l,activeColor:c,activateTransparency:h,inactiveColor:u,inactiveTransparency:d}=e;this.isNumber(r)&&(this.layerId=r),this.type=i,this.name=n,this.locked=l,this.parseState(s,a),this.activeColor=ee.of3(c),this.activeAlpha=this.isNumber(h)?h:this.activeAlpha,this.deactiveColor=ee.of3(u),this.deactiveAlpha=this.isNumber(d)?d:this.deactiveAlpha}parseState(e,r){e?r?this.layerStatus=1:this.layerStatus=2:this.layerStatus=0}get hashkey(){return this.layerId}getType(){return this.type}check(){return!(!this.layerId||this.type==null||this.name==null||!this.activeColor||this.layerStatus===void 0&&isNaN(this.layerStatus)||!this.deactiveColor)}layerCheck(){return this.layerId==52&&(this.layerStatus=0),this.layerId==null?!1:(this.layerId===56&&this.layerStatus===0&&(this.layerStatus=1),this.activeColor=ee.of6(this.activeColor,this.activeAlpha),this.deactiveColor=ee.of6(this.deactiveColor,this.deactiveAlpha),!0)}finish(){if(this.layerCheck()){if(!this.resultNeedToBeCached)return this.addNotCacheLayer();let e=Ze.getInstance(),r=ny.build(this.layerStatus!=0,this.layerStatus==1,!1),i=e.modifyLayer(this.layerId,this.type,this.name,r,this.activeColor,this.deactiveColor);return i.locked=this.locked,i}else return null}addNotCacheLayer(){let e=Ze.getInstance(),r=e.getLayer(this.layerId);if(r==null){let i=ny.build(!1,!1,!1),n=e.modifyLayer(this.layerId,this.type,this.name,i,this.activeColor,this.deactiveColor);return n.locked=this.locked,n}return r}getName(){return this.name}loadLayerType(e){this.model.type!==e&&(this.model.type=e)}loadLayerName(e){this.model.name!==e&&(this.model.name=e)}loadLayerConfig(e){this.model.config!==e&&(this.model.config=e,this.loadLayerVisible(this.layerStatus==1),this.loadLayerLocked(this.locked))}loadLayerVisible(e){this.model.visible!==e&&(this.model.visible=e)}loadLayerLocked(e){this.model.locked!==e&&(this.model.locked=e)}load(){this.loadLayerType(this.type),this.loadLayerName(this.name),this.loadLayerConfig(this.layerStatus!=0)}};var Lte=class extends wl{get hashkey(){return this.layerId}feed(t){let{layerId:e,material:r,thickness:i,permittivity:n,lossTangent:s,isKeepIsland:a,zIndex:l}=t;this.isNumber(e)&&(this.layerId=e),this.material=r,this.isNumber(i)&&(this.thickness=i/10),this.permittivity=n,this.LossTangent=s,this.isKeepIsland=a,this.zIndex=l}setLayerId(t){this.layerId=t}check(){return!(!this.layerId||this.thickness!==null&&isNaN(this.thickness)||this.permittivity!==null&&isNaN(this.permittivity)||this.LossTangent!==null&&isNaN(this.LossTangent))}finish(){return this.check()?this.resultNeedToBeCached?Ze.getInstance().addLayerPhy(this.layerId,this.material,this.thickness,this.permittivity,this.LossTangent,this.isKeepIsland,this.zIndex):new GO(this.layerId,this.material,this.thickness,this.permittivity,this.LossTangent,this.isKeepIsland,this.zIndex):null}loadMaterial(t){this.model.material!==t&&(this.model.material=t)}loadThickness(t){this.model.thickness!==t&&(this.model.thickness=t)}loadPermittivity(t){this.model.permittivity!==t&&(this.model.permittivity=t)}loadLossTangent(t){this.model.lossTangent!==t&&(this.model.lossTangent=t)}loadIsKeepIsland(t){this.model.isKeepIsland!==t&&(this.model.isKeepIsland=t)}loadZIndex(t){this.model.zIndex!==t&&(this.model.zIndex=t)}load(){this.loadMaterial(this.material),this.loadThickness(this.thickness),this.loadPermittivity(this.permittivity),this.loadLossTangent(this.LossTangent),this.loadIsKeepIsland(this.isKeepIsland),this.loadZIndex(this.zIndex)}};var Mte=class extends wl{get hashkey(){return null}feed(t){let{layerId:e}=t;this.id=e}check(){return!(this.id==null||isNaN(this.id))}finish(){this.id!=null&&(Ze.getInstance().activeLayer=this.id)}};function qO(o,t){return o?Object.hasOwnProperty.call(o,t):!1}function Cb(o,t,e,r){return o?qO(o,t)?o[t]:(r&&(o[t]=e),e):e}function $O(o,t,e,r=!0){return!o||!r&&qO(o,t)||o[t]===e?!1:(o[t]=e,!0)}function kf(o,t){if(!o)return!1;for(let e in o){let r=o[e];if(t(r,e,o))return!0}return!1}function hM(o){return o?Object.keys(o):[]}function my(o){return o?hM(o).length==0:!0}function a3(o){return typeof o=="number"&&!Number.isNaN(o)&&isFinite(o)}function Q8e(o){let t={};return kf(o,(e,r)=>{t[e]||(t[e]=[]),t[e].push(r)}),t}var PY=class{static converArray2Obj(t){return{unit:t[0],padTopExpan:t[1],padBotExpan:t[2],viaTopExpan:t[3],viaBotExpan:t[4],testPointTopExpan:a3(t[5])?t[5]:2,testPointBotExpan:a3(t[6])?t[6]:2}}static decode(t,e){e.unit!==t.unit&&(e.unit=t.unit);let r=t,i=r.padTopExpan/10;e.padTopExpansion!==i&&(e.padTopExpansion=i);let n=r.padBotExpan/10;e.padBottomExpansion!==n&&(e.padBottomExpansion=n);let s=r.viaTopExpan/10;e.viaTopExpansion!==s&&(e.viaTopExpansion=s);let a=r.viaBotExpan/10;e.viaBottomExpansion!==a&&(e.viaBottomExpansion=a);let l=a3(r.testPointTopExpan)?r.testPointTopExpan/10:.2;e.testPointTopExpansion!==l&&(e.testPointTopExpansion=l);let c=a3(r.testPointBotExpan)?r.testPointBotExpan/10:.2;e.testPointBottomExpansion!==c&&(e.testPointBottomExpansion=c)}};var vIe=[.40157,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,-1,-1,-1,-1,1.1811,.6,.6,.6,.6,.6,.6,1,.6,-1,-1,-1,.6,.6,.6,.6,.6,.6,.6,1,1.1811,.6,-1,-1,.6,.6,.6,.6,.6,.6,.6,1,.6,.6,.6,-1,1.18,1.18,1.18,1.18,1.18,1.18,1.18,1,1.18,1.18,1.18,-1,.6929,.6929,.6929,.6929,.6929,.6929,.6929,1,.6929,.6929,.6929,.6929],eFe=[.79921,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,-1,-1,-1,-1,1.1811,.59843,.59843,.59843,.59843,.59843,.59843,1,.59843,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,.59843,1,.59843,.59843,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,.59843,1,.59843,.59843,.59843,-1,1.1811,1.1811,1.1811,1.1811,1.1811,1.1811,1.1811,1,1.1811,1.1811,1.1811,-1,.6929,.6929,.6929,.6929,.6929,.6929,.6929,1,.6929,.6929,.6929,.6929],tFe=[.35039,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,.59843,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,-1,-1,-1,-1,1.1811,.59843,.59843,.59843,.59843,.59843,.59843,1,.59843,-1,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,.59843,1,1.1811,.59843,-1,-1,.59843,.59843,.59843,.59843,.59843,.59843,.59843,1,.59843,.59843,.59843,-1,1.1811,1.1811,1.1811,1.1811,1.1811,1.1811,1.1811,1,1.1811,1.1811,1.1811,-1,.6929,.6929,.6929,.6929,.6929,.6929,.6929,1,.6929,.6929,.6929,.6929],b2={TWO_LAYERS_BOARD:"JLCPCB Capability(Two Layers Board)",SINGLE_LAYER_BOARD:"JLCPCB Capability(Single Layer Board)",MULTIPLE_LAYERS_BOARD:"JLCPCB Capability(Multiple Layers Board)",HIGH_FREQUENCY_BOARD:"JLCPCB Capability(High Frequency Board)",ALUMINUM_SUBSTRATE_BOARD:"JLCPCB Capability(Aluminum Substrate Board)",COPPER_SUBSTRATE_BOARD:"JLCPCB Capability(Copper Substrate Board)"};var TY=class o{static converArray2Obj(t){let e=t[0],r=t[1],i=[],n=0;if(r instanceof Array){let s=o.getTable(r);i.push({layerId:1,isOpen:1,content:s})}else{for(let s in r){let a=r[s],l=o.getTable(a);i.push({layerId:+s,isOpen:1,content:l})}Object.keys(r).length>1&&(n=1)}return{unit:e,isForAll:n,safeSpacing:i}}static getTable(t){let e=t;if(e.length==8){let i=Object.values(b2),n=re.getInstance().getRuleTemplateName();i.includes(n)&&(e[4][0]=11.811,e[5][4]=11.811),e.splice(1,0,e[1].slice(0));for(let s=2;s<e.length;s++)e[s].splice(1,0,e[s][1]);e.push([].concat(e[1][0],e.slice(1).map(s=>s[1])))}e[1].push(e[1][e[1].length-1]),e.splice(3,0,[...e[1]]),e.splice(4,0,[...e[2]]),e[1].pop();for(let i=5;i<e.length;i++)e[i].splice(3,0,e[i][1]),e[i].splice(4,0,e[i][2]);e[3][3]=e[1][1],e[4][3]=e[2][1],e[4][4]=e[2][2];let r=6;e.splice(7,0,new Array(7).fill(r));for(let i=7;i<e.length;i++)e[i].splice(7,0,r);return e}static decode(t,e){e.unit!==t.unit&&(e.unit=t.unit);let r={unit:t.unit,isForAll:$8e(t.isForAll),safeSpacing:t.safeSpacing.map(l=>({layerId:l.layerId,isOpen:WP(l.isOpen),content:l.content}))},i=r.isForAll;e.status!==i&&(e.status=i);let n=new Map,s=new Map,a=!1;for(let l of r.safeSpacing){let{layerId:c,isOpen:h,content:u}=l,d=u.map(m=>m.map(g=>g/10)),p=e.tables.get(+c);(!p||JSON.stringify(p.data)!==JSON.stringify(d)||p.status!==h)&&(a=!0),n.set(+c,d),s.set(+c,h)}a&&e.overWriteTables(new wa(n,s))}};var IY=class{static converArray2Obj(t){let e=t[0],r=t[1],i=t[2];isNaN(i)&&(i=0);let n=t[3];return isNaN(n)&&(n=11.8),{unit:e,deviceClearance:r,thru2SmdClearance:i,holeClearance:n}}static decode(t,e){e.unit!==t.unit&&(e.unit=t.unit);let r=t,i=r.deviceClearance/10,n=r.thru2SmdClearance/10;isNaN(n)&&(n=0);let s=r.holeClearance/10;isNaN(s)&&(s=1.18);let a=[i,n,s];JSON.stringify(e.clearances)!==JSON.stringify(a)&&(e.clearances=a)}};var CY=class{static converArray2Obj(t){let e=t[0],r=t[1],i=1,n=[];if(r instanceof Object)for(let s in r){let a=r[s];n.push({layerId:+s,stroMin:a[0],stroDef:a[1],stroMax:a[2]})}else n.push({layerId:1,stroMin:t[1],stroDef:t[2],stroMax:t[3]});return{unit:e,track:{isOpen:i,content:n}}}static decode(t,e){e.unit=t.unit;let r={unit:t.unit,track:{isOpen:WP(t.track.isOpen),content:t.track.content}},i=new Map,n=!1;for(let s of r.track.content){let a={minValue:s.stroMin/10,defaultValue:s.stroDef/10,maxValue:s.stroMax/10},l=e.toJSON().get(s.layerId);l&&JSON.stringify(l)!==JSON.stringify(a)&&(n=!0),i.set(s.layerId,a)}e.getLayerStatus()!==+r.track.isOpen&&e.setLayerStatus(+r.track.isOpen),n&&e.overWriteTables(new wa(i))}};var SY=class{static converArray2Obj(t){return{unit:t[0],netLenMin:t[1],netLenMax:t[2]}}static decode(t,e){e.unit!=t.unit&&(e.unit=t.unit);let r=t,i=r.netLenMin/10;e.netLengthMin!==i&&(e.netLengthMin=i);let n=r.netLenMax/10;e.netLengthMax!==n&&(e.netLengthMax=n)}};var EY=class{static converArray2Obj(t){return{unit:t[0],netLengthTolerance:t[1]}}static decode(t,e){e.unit!=t.unit&&(e.unit=t.unit);let i=t.netLengthTolerance/10;e.netLengthTolerance!=i&&(e.netLengthTolerance=i)}};var OY=class{static converArray2Obj(t){let e=t[0],r=t[1],i=1,n=[],s=[],a=0;if(r instanceof Object)for(let l in r){let c=r[l],{stroke:h,spacing:u,lenTolerMax:d}=c;n.push({layerId:+l,stroMin:h[0],stroDef:h[1],stroMax:h[2]}),s.push({layerId:+l,spacMin:u[0],spacDef:u[1]}),a=d}else n.push({layerId:1,stroMin:t[1],stroDef:t[2],stroMax:t[3]}),s.push({layerId:1,spacMin:t[4],spacDef:t[5]}),a=t[7];return{unit:e,stroWidth:{isOpen:i,content:n},spacing:{isOpen:i,content:s},differPairLenTolerMax:a}}static decode(t,e){e.unit!=t.unit&&(e.unit=t.unit);let r={unit:t.unit,stroWidth:{isOpen:WP(t.stroWidth.isOpen),content:t.stroWidth.content},spacing:{isOpen:WP(t.spacing.isOpen),content:t.spacing.content},differPairLenTolerMax:t.differPairLenTolerMax},i=e.toJSON(),n=new Map,s=!1;for(let h of r.stroWidth.content){let u={minValue:h.stroMin/10,defaultValue:h.stroDef/10,maxValue:h.stroMax/10},d=i.strokeWidthTables.tables.get(h.layerId);d&&JSON.stringify(d)!==JSON.stringify(u)&&(s=!0),n.set(h.layerId,u)}e.getLayerStatus(0)!==r.stroWidth.isOpen&&e.setLayerStatus(0,r.stroWidth.isOpen),s&&e.overWriteTables(0,new wa(n));let a=!1,l=new Map;for(let h of r.spacing.content){let u={minValue:h.spacMin/10,defaultValue:h.spacDef/10,maxValue:null},d=i.diffPairSpacingTables.tables.get(h.layerId);d&&JSON.stringify(d)!==JSON.stringify(u)&&(a=!0),l.set(h.layerId,u)}e.getLayerStatus(1)!==r.spacing.isOpen&&e.setLayerStatus(1,r.spacing.isOpen),a&&e.overWriteTables(1,new wa(l));let c=r.differPairLenTolerMax/10;e.differentialPairLenTolerMax!=c&&(e.differentialPairLenTolerMax=c)}};var AY=class{static converArray2Obj(t){let e=new Array;for(let r of t){let i=+r[1],n=+r[2];isNaN(i)||i<=0||isNaN(n)||n<=0||i===n||i===1&&n===2||i===2&&n===1||e.push({name:r[0],staLayerId:i,endLayerId:n,viaSizeRule:r[3]})}return{blinds:{content:e}}}static decode(t,e){let r=t;for(let i of r.blinds.content){let n=+i.staLayerId,s=+i.endLayerId;if(isNaN(n)||n<=0||isNaN(s)||s<=0||n===s||n===1&&s===2||n===2&&s===1)continue;let a=!1,l=e.getBlindViaContentByName(i.name);l?JSON.stringify(l)!==JSON.stringify(i)&&(a=!0):a=!0,a&&e.addBlind(i.name,n,s,i.viaSizeRule)}}};var _Y=class{static converArray2Obj(t){return{unit:t[0],minRadius:t[1],defRadius:t[2],maxRadius:t[3],minInner:t[4],defInner:t[5],maxInner:t[6]}}static decode(t,e){e.unit!==t.unit&&(e.unit=t.unit);let r=t,i=r.minRadius/10;e.minRadius!==i&&(e.minRadius=i);let n=r.defRadius/10;e.defalutRadius!==n&&(e.defalutRadius=n);let s=r.maxRadius/10;e.maxRadius!==s&&(e.maxRadius=s);let a=r.minInner/10;e.minInner!==a&&(e.minInner=a);let l=r.defInner/10;e.defalutInner!==l&&(e.defalutInner=l);let c=r.maxInner/10;e.maxInner!==c&&(e.maxInner=c)}};var vY=class{static converArray2Obj(t){let e=[{layerId:1,connType:t[7]!==void 0?t[7].toString():t[3].toString(),spoWidth:t[8]!==void 0?t[8]:t[4],spoSpac:t[9]!==void 0?t[9]:t[5],spoAng:t[10]?t[10]:t[6]}];return{unit:t[0],mulPad:{isOpen:1,content:e}}}static decode(t,e){e.unit!==t.unit&&(e.unit=t.unit);let r=t.mulPad,i={unit:t.unit,mulPad:{isOpen:WP(r.isOpen),content:r.content.map(a=>({layerId:a.layerId,connType:sM(a.connType),spoSpac:a.spoSpac,spoWidth:a.spoWidth,spoAng:a.spoAng,reserveDefData:a.reserveDefData}))}},n=new Map,s=!1;for(let a of i.mulPad.content){let l={connectMode:a.connType!==void 0?+a.connType.toString():+0 .toString(),lineAngle:a.spoAng?a.spoAng/180*Math.PI:.5*Math.PI,lineClearance:a.spoSpac!==void 0?a.spoSpac/10:1,lineWidth:a.spoWidth!==void 0?a.spoWidth/10:1},c=e.toJSON().tables.get(a.layerId);c&&JSON.stringify(c)!==JSON.stringify(l)&&(s=!0),n.set(a.layerId,l)}e.getLayerStatus()!==i.mulPad.isOpen&&e.setLayerStatus(i.mulPad.isOpen),s&&e.overWriteTables(new wa(n))}};var xY=class{static converArray2Obj(t){let e=[{layerId:1,connType:t[3].toString(),spoWidth:t[4],spoSpac:t[5],spoAng:t[6]}],r=[{layerId:1,connType:t[7]}],i=[{layerId:1,connType:t[8]!==void 0?t[8].toString():t[3].toString(),spoWidth:t[9]!==void 0?t[9]:t[4],spoSpac:t[10]!==void 0?t[10]:t[5],spoAng:t[11]?t[11]:t[6]}];return{unit:t[0],sglPad:{isOpen:1,content:e},mulPad:{isOpen:1,content:i},track:{isOpen:1,content:r}}}static decode(t,e){e.unit!==t.unit&&(e.unit=t.unit);let r=t.sglPad,i=t.mulPad,n=t.track,s={unit:t.unit,sglPad:{isOpen:WP(r.isOpen),content:r.content.map(m=>({layerId:m.layerId,connType:sM(m.connType),spoSpac:m.spoSpac,spoWidth:m.spoWidth,spoAng:m.spoAng}))},mulPad:{isOpen:WP(i.isOpen),content:i.content.map(m=>({layerId:m.layerId,connType:sM(m.connType),spoSpac:m.spoSpac,spoWidth:m.spoWidth,spoAng:m.spoAng}))},track:{isOpen:WP(n.isOpen),content:n.content.map(m=>({layerId:m.layerId,connType:X8e(m.connType)}))}},a=e.toJSON(),l=!1,c=new Map;for(let m of s.sglPad.content){let g={connectMode:m.connType,lineAngle:m.spoAng/180*Math.PI,lineClearance:m.spoSpac/10,lineWidth:m.spoWidth/10},y=a.singleLayerPadModel.tables.get(m.layerId);y&&JSON.stringify(y)!==JSON.stringify(g)&&(l=!0),c.set(m.layerId,g)}e.getLayerStatus(0)!==s.sglPad.isOpen&&e.setLayerStatus(0,s.sglPad.isOpen),l&&e.overWriteTables(new wa(c),0);let h=!1,u=new Map;for(let m of s.mulPad.content){let g={connectMode:+m.connType.toString(),lineWidth:m.spoWidth/10,lineClearance:m.spoSpac/10,lineAngle:m.spoAng/180*Math.PI},y=a.multiLayerPadModel.tables.get(m.layerId);y&&JSON.stringify(y)!==JSON.stringify(g)&&(h=!0),u.set(m.layerId,g)}e.getLayerStatus(1)!==s.mulPad.isOpen&&e.setLayerStatus(1,s.mulPad.isOpen),h&&e.overWriteTables(new wa(u),1);let d=!1,p=new Map;for(let m of s.track.content){let g=a.trackConnectModel.tables.get(m.layerId);g!=null&&g!==m.connType&&(d=!0),p.set(m.layerId,m.connType)}e.getLayerStatus(2)!==s.track.isOpen&&e.setLayerStatus(2,s.track.isOpen),d&&e.overWriteTables(new wa(p),2)}};var RY=class{static converArray2Obj(t){return{unit:t[0],padTopExpan:t[1],padBotExpan:t[2],testPointTopExpan:a3(t[3])?t[3]:-1e3,testPointBotExpan:a3(t[4])?t[4]:-1e3}}static decode(t,e){e.unit!==t.unit&&(e.unit=t.unit);let r=t,i=r.padTopExpan/10;e.padTopExpansion!==i&&(e.padTopExpansion=i);let n=r.padBotExpan/10;e.padBottomExpansion!==n&&(e.padBottomExpansion=n);let s=a3(r.testPointTopExpan)?r.testPointTopExpan/10:-100;e.testPointTopExpansion!==s&&(e.testPointTopExpansion=s);let a=a3(r.testPointBotExpan)?r.testPointBotExpan/10:-100;e.testPointBottomExpansion!==a&&(e.testPointBottomExpansion=a)}};var Nte=class{static decode(t,e){e.unit!==t.unit&&(e.unit=t.unit);let r=t,i=r.creepageDistance/10;e.creepageDistance!==i&&(e.creepageDistance=i);let n=r.ignoreLayer;e.ignoreLayer!==n&&(e.ignoreLayer=n)}};var DY=class o extends wl{get hashkey(){return this.index}clear(){this.type=null,this.name=null,this.isDefault=null,this.context=null}feed(t){let{ruleType:e,ruleName:r,ruleState:i,ruleContext:n}=t;this.type=hx(e),this.name=r,this.index=[e,r].toString();let s=b8e(i);s===0?this.isDefault=!1:s===1&&(this.isDefault=!0),this.context=n}check(){return this.type==null||this.name==null||this.context==null?!1:(this.isDefault==null&&(this.isDefault=!1),!0)}finish(){if(this.check())switch(this.type){case"1":return this.getSafeSpacing();case"2":return this.getOtherSpacing();case"14":return this.getCreepageSpacing();case"3":return this.getTrackPhysics();case"11":return this.getNetLengthPhysics();case"13":return this.getNetLengthTolerancePhysics();case"10":return this.getDifferentailPhysics();case"4":return this.getBlind();case"5":return this.getRadius();case"6":return this.getPlane();case"7":return this.getCopper();case"8":return this.getPaste();case"9":return this.getSolder();case"12":return this.getAutoRouter()}return null}toJson(){return{name:this.name,type:this.type,isDefault:this.isDefault,context:this.context}}conver2Obj(t){if(!(this.context instanceof Array))return null;switch(this.type){case"1":{this.context=TY.converArray2Obj(this.context),this.isDefault&&t.addDefaultSafeSpaceData(this.context);break}case"2":{this.context=IY.converArray2Obj(this.context);break}case"3":{this.context=CY.converArray2Obj(this.context);break}case"11":{this.context=SY.converArray2Obj(this.context);break}case"13":{this.context=EY.converArray2Obj(this.context);break}case"10":this.context instanceof Array&&(this.context=OY.converArray2Obj(this.context));break;case"4":{this.context=AY.converArray2Obj(this.context);break}case"5":{this.context=_Y.converArray2Obj(this.context);break}case"6":{let e=this.context[1],r=this.context[2];this.isDefault&&t.addDefaultInnerSpace(e,r),t.addInner2SafeChangeMap(this.name,"Plane_"+this.name,this.isDefault,e,r),this.context=vY.converArray2Obj(this.context);break}case"7":{let e=this.context[1],r=this.context[2];this.isDefault&&t.addDefaultCopperSpace(e,r),t.addCopper2SafeChangeMap(this.name,"Copper_"+this.name,this.isDefault,e,r),this.context=xY.converArray2Obj(this.context);break}case"8":{this.context=RY.converArray2Obj(this.context);break}case"9":{this.context=PY.converArray2Obj(this.context);break}case"12":break}}getNewRuleDecode(t){if(!t.init)return null;switch(this.type){case"1":return t.fixSafeData(this.context),null;case"6":return this.getSafeDecode4Plane(!1,t);case"7":return this.getSafeDecode4Plane(!0,t);default:return null}}getSafeDecode4Plane(t,e){let r=t?"Copper_":"Plane_",i=new o;i.type="1",i.name=r+this.name,i.isDefault=!1;let n=e.getNewDefaultData(t,this.name);return n==null?null:(i.context={unit:e.defaultSafeData.unit,isForAll:0,safeSpacing:[{layerId:1,isOpen:1,content:n}]},i)}getSafeSpacing(){let t=re.getInstance(),e=re.getInstance().getSafeSpacing(this.name);return e==null&&(e=re.getInstance().addSafeSpacing(this.name)),this.isDefault&&t.getDefaultSafeSpacing()!=e&&t.getDefaultSafeSpacing()!=null&&t.deleteSafeSpacing(t.getDefaultSafeSpacing().name),TY.decode(this.context,e),e.isDefault=this.isDefault,e}getOtherSpacing(){let t=re.getInstance(),e=t.getOtherSpacing(this.name);return e==null&&(e=t.addOtherSpacing(this.name)),this.isDefault&&t.getDefaultOtherSpacing()!=e&&t.getDefaultOtherSpacing()!=null&&t.deleteOtherSpacing(t.getDefaultOtherSpacing().name),IY.decode(this.context,e),e.isDefault=this.isDefault,e}getCreepageSpacing(){let t=re.getInstance(),e=t.getCreepageSpacing(this.name);return e==null&&(e=t.addCreepageSpacing(this.name)),this.isDefault&&t.getDefaultCreepageSpacing()!=e&&t.getDefaultCreepageSpacing()!=null&&t.deleteCreepageSpacing(t.getDefaultCreepageSpacing().name),Nte.decode(this.context,e),e.isDefault=this.isDefault,e}getTrackPhysics(){let t=re.getInstance(),e=t.getTrackPhysics(this.name);return e==null&&(e=t.addTrackPhysics(this.name)),this.isDefault&&t.getDefaultTrackPhysics()!=e&&t.getDefaultTrackPhysics()!=null&&t.deleteTrackPhysics(t.getDefaultTrackPhysics().name),CY.decode(this.context,e),e.isDefault=this.isDefault,e}getNetLengthPhysics(){let t=re.getInstance(),e=t.getNetLengthPhysics(this.name);return e==null&&(e=t.addNetLengthPhysics(this.name)),this.isDefault&&t.getDefaultNetLengthPhysics()!=e&&t.getDefaultNetLengthPhysics()!=null&&t.deleteNetLengthPhysics(t.getDefaultNetLengthPhysics().name),SY.decode(this.context,e),e.isDefault=this.isDefault,e}getNetLengthTolerancePhysics(){let t=re.getInstance(),e=t.getNetLengthTolerancePhysics(this.name);return e==null&&(e=t.addNetLengthTolerancePhysics(this.name)),this.isDefault&&t.getDefaultNetLengthTolerancePhysics()!=e&&t.getDefaultNetLengthTolerancePhysics()!=null&&t.deleteNetLengthTolerancePhysics(t.getDefaultNetLengthTolerancePhysics().name),EY.decode(this.context,e),e.isDefault=this.isDefault,e}getDifferentailPhysics(){let t=re.getInstance(),e=t.getDifferentialPhysics(this.name);return e==null&&(e=t.addDifferentialPhysics(this.name)),this.isDefault&&t.getDefaultDifferentialPhysics()!=e&&t.getDefaultDifferentialPhysics()!=null&&t.deleteDifferentialPhysics(t.getDefaultDifferentialPhysics().name),OY.decode(this.context,e),e.isDefault=this.isDefault,e}getBlind(){let t=re.getInstance(),e=t.getBlindPhysics(this.name);return e==null&&(e=t.addBlindPhysics(this.name)),this.isDefault&&t.getDefaultBlindPhysics()!=e&&t.getDefaultBlindPhysics()!=null&&t.deleteBlindPhysics(t.getDefaultBlindPhysics().name),AY.decode(this.context,e),e.isDefault=this.isDefault,e}getRadius(){let t=re.getInstance(),e=t.getRadiusPhysics(this.name);return e==null&&(e=t.addRadiusPhysics(this.name)),this.isDefault&&t.getDefaultRadiusPhysics()!=e&&t.getDefaultRadiusPhysics()!=null&&t.deleteRadiusPhysics(t.getDefaultRadiusPhysics().name),_Y.decode(this.context,e),e.isDefault=this.isDefault,e}getPlane(){let t=re.getInstance(),e=t.getInnerPlane(this.name);return e==null&&(e=t.addInnerPlane(this.name)),this.isDefault&&t.getDefaultInnerPlane()!=e&&t.getDefaultInnerPlane()!=null&&t.deleteInnerPlane(t.getDefaultInnerPlane().name),vY.decode(this.context,e),e.isDefault=this.isDefault,e}getCopper(){let t=re.getInstance(),e=t.getCopperPlane(this.name);return e==null&&(e=t.addCopperPlane(this.name)),this.isDefault&&t.getDefaultCopperPlane()!=e&&t.getDefaultCopperPlane()!=null&&t.deleteCopperPlane(t.getDefaultCopperPlane().name),xY.decode(this.context,e),e.isDefault=this.isDefault,e}getPaste(){let t=re.getInstance(),e=t.getPasteExpansion(this.name);return e==null&&(e=t.addPasteExpansion(this.name)),this.isDefault&&t.getDefaultPasteExpansion()!=e&&t.getDefaultPasteExpansion()!=null&&t.deletePasteExpansion(t.getDefaultPasteExpansion().name),RY.decode(this.context,e),e.isDefault=this.isDefault,e}getSolder(){let t=re.getInstance(),e=t.getSolderExpansion(this.name);return e==null&&(e=t.addSolderExpansion(this.name)),this.isDefault&&t.getDefaultSolderExpansion()!=e&&t.getDefaultSolderExpansion()!=null&&t.deleteSolderExpansion(t.getDefaultSolderExpansion().name),PY.decode(this.context,e),e.isDefault=this.isDefault,e}getAutoRouter(){let t=T8e(this.context.routingCorner),e=this.context.isKeep,r=C8e(this.context.viaQuantity),i=E8e(this.context.routingEffectPriority),n=0,s=this.context.layers,a=this.context.ignoreNets,l={routingCorner:t,isKeep:e,viaQuatity:r,routingEffectPriority:i,routingNetPriority:n,layers:s,ignoreNets:a,routingRange:0},c=re.getInstance(),h=c.getAutoRouter(this.name)||c.addAutoRouter(this.name,l);return Object.assign(h,l),this.isDefault&&c.getDefaultAutoRouter()!=h&&c.getDefaultAutoRouter()!=null&&c.deleteAutoRouter(c.getDefaultAutoRouter().name),h}};var dI=re.getInstance(),kte=class extends wl{get hashkey(){return this.index}feed(t){let{ruleSelect:e,ruleOrder:r,ruleKeyValue:i,copperValue:n,innerPlaneValue:s}=t;this.isNumber(r)&&(this.order=r),this.index=e.toString(),this.keyValue={};for(let a in i)this.keyValue[hx(a)]=i[a];this.copperRuleValue={};for(let a in n)this.copperRuleValue[hx(a)]=n[a];this.innerPlaneRuleValue={};for(let a in s)this.innerPlaneRuleValue[hx(a)]=s[a];this.select=e}versionUpgrades(t){let e=this.select[0];if(this.order==4){if(e==="NET_CLASS"||e==="NET"||e==="EQ_LEN_GRP"){for(let r in this.keyValue)String(r)==="7"&&(this.copperRuleValue={"7":t.getSafeName4Copper(this.keyValue[r])}),String(r)==="6"&&(this.innerPlaneRuleValue={"6":t.getSafeName4Plane(this.keyValue[r])});this.copperRuleValue["7"]==null&&(this.copperRuleValue={"7":t.getDefaultCopper()}),this.innerPlaneRuleValue["6"]==null&&(this.innerPlaneRuleValue={"6":t.getDefaultPlane()})}}else for(let r in this.keyValue){if(String(r)==="7"){let i=this.keyValue[r],n=t.getSafeName4Copper(i);if(n==null&&i=="default"&&(n=t.getDefaultCopper()),n==null)continue;this.copperRuleValue={"7":n}}if(String(r)==="6"){let i=this.keyValue[r],n=t.getSafeName4Plane(i);if(n==null&&i=="default"&&(n=t.getDefaultPlane()),n==null)continue;this.innerPlaneRuleValue={"6":n}}}}check(){if(this.order===void 0||isNaN(this.order)||!Array.isArray(this.select)||this.keyValue===null||typeof this.keyValue!="object")return!1;let t=!0;if(this.order==2&&this.select[0]==="POUR"){t=!1;for(let r in this.keyValue)t=!0;for(let r in this.copperRuleValue)t=!0;for(let r in this.innerPlaneRuleValue)t=!0}return!!t}finish(){if(!this.check())return;let t=re.getInstance(),e=this.select[0],r=this.select[1];if(this.order==4){if(e==="NET_CLASS"){let i=t.getNetClass(r);i==null&&(i=t.addNetClass(r));for(let n in this.keyValue)this.modifyCommonRule(i,n,this.keyValue[n]);for(let n in this.copperRuleValue)String(n)==="7"&&(i.safeCopperPlane=this.copperRuleValue[n]);for(let n in this.innerPlaneRuleValue)String(n)==="6"&&(i.safeInnerPlane=this.innerPlaneRuleValue[n]);return i}else if(e==="DIFF_PAIR"){let i=t.getNetDifferential(r);i==null&&(i=t.addNetDifferential(r));for(let n in this.keyValue)this.modifyCommonRule(i,n,this.keyValue[n]);return i}else if(e==="EQ_LEN_GRP"){let i=t.getEqualLengthGroup(r);i==null&&(i=t.addEqualLengthGroup(r));for(let n in this.keyValue)this.modifyCommonRule(i,n,this.keyValue[n]);for(let n in this.copperRuleValue)String(n)==="7"&&(i.safeCopperPlane=this.copperRuleValue[n]);for(let n in this.innerPlaneRuleValue)String(n)==="6"&&(i.safeInnerPlane=this.innerPlaneRuleValue[n]);return i}else if(e==="NET"){if(r==null)return;let i=t.getNet(r);i==null&&(i=t.addNet(r));for(let n in this.keyValue)this.modifyCommonRule(i,n,this.keyValue[n]);for(let n in this.copperRuleValue)String(n)==="7"&&(i.safeCopperPlane=this.copperRuleValue[n]);for(let n in this.innerPlaneRuleValue)String(n)==="6"&&(i.safeInnerPlane=this.innerPlaneRuleValue[n]);return i}}else if(this.order==3){let i=this.select[0],n=this.select[1];if(i[0]==null||n[0]==null)return;let s=this.getNetType(i[0]),a=this.getNetType(n[0]),l=t.betweenNetRule.getRule(i[1],n[1]);l||(l=new lg(s,i[1],a,n[1]),t.betweenNetRule.addRule(l));for(let c in this.keyValue)c==="1"&&(l.ruleName=this.keyValue[c]),c==="14"&&(l.creepageRule=this.keyValue[c]);for(let c in this.copperRuleValue)String(c)==="7"&&(l.safeCopperPlane=this.copperRuleValue[c]);for(let c in this.innerPlaneRuleValue)String(c)==="6"&&(l.safeInnerPlane=this.innerPlaneRuleValue[c]);return l}else if(this.order==2){if(e==="POUR"){let i=r,n=t.addRegionSelector(i);for(let s in this.keyValue)this.modifyRegionCommonRule(n,s,this.keyValue[s]);for(let s in this.copperRuleValue)String(s)==="7"&&(n.safeClearance=this.copperRuleValue[s]);for(let s in this.innerPlaneRuleValue)String(s)==="6"&&(n.safeClearance=this.innerPlaneRuleValue[s]);return n}else if(e==="REGION"){let i=r,n=t.addConstraintSelector(i);for(let s in this.keyValue)this.modifyRegionCommonRule(n,s,this.keyValue[s]);for(let s in this.copperRuleValue)String(s)==="7"&&(n.safeCopperPlane=this.copperRuleValue[s]);for(let s in this.innerPlaneRuleValue)String(s)==="6"&&(n.safeInnerPlane=this.innerPlaneRuleValue[s]);return n}}return null}getNetType(t){switch(t){case"NET":return"net";case"NET_CLASS":return"netClass";case"EQ_LEN_GRP":return"equalLengthGroup"}}modifyCommonRule(t,e,r){let i=this.getRuleName4NetModel(e,r);switch(e){case"1":t.safeSpacing!==i&&(t.safeSpacing=i);break;case"3":t.trackPhysics!==i&&(t.trackPhysics=i);break;case"11":t.netLengthPhysics!==i&&(t.netLengthPhysics=i);break;case"13":t.netLengthTolerancePhysics!==i&&(t.netLengthTolerancePhysics=i),t.targetNet=r instanceof Array?r[1]:null;break;case"10":t.differentialPhysics!==i&&(t.differentialPhysics=i);break;case"4":t.blindViaPhysics!==i&&(t.blindViaPhysics=i);break;case"5":t.radiusPhysics!==i&&(t.radiusPhysics=i);break;case"6":t.innerPlane!==i&&(t.innerPlane=i);break;case"7":t.copperPlane!==i&&(t.copperPlane=i);break;case"8":t.pasteExpansion!==i&&(t.pasteExpansion=i);break;case"9":t.solderExpansion!==i&&(t.solderExpansion=i);break;case"14":t.creepageSpacing!==i&&(t.creepageSpacing=i);break}}modifyCommonRuleClear(t){t.safeSpacing="default",t.trackPhysics="default",t.netLengthPhysics="default",t.netLengthTolerancePhysics=null,t.targetNet=null,t.differentialPhysics="default",t.blindViaPhysics="default",t.radiusPhysics="default",t.innerPlane="default",t.copperPlane="default",t.pasteExpansion="default",t.solderExpansion="default",t.creepageSpacing="default"}modifyCopperRule(t,e,r){switch(e){case"7":t.safeCopperPlane!=r&&(t.safeCopperPlane=r);break}}modifyInnerPlaneRule(t,e,r){switch(e){case"6":t.safeInnerPlane!=r&&(t.safeInnerPlane=r);break}}modifyRegionCommonRule(t,e,r){switch(e){case"1":t.safeClearance!==r&&(t.safeClearance=r);break;case"2":t.otherClearance!==r&&(t.otherClearance=r);break;case"3":t.track!==r&&(t.track=r);break;case"10":t.diff!==r&&(t.diff=r);break;case"5":t.radius!==r&&(t.radius=r);break;case"6":t.innerPlane!==r&&(t.innerPlane=r);break;case"7":t.copperPlane!==r&&(t.copperPlane=r);break;case"14":t.creepageClearance!==r&&(t.creepageClearance=r);break}}modifyRegionCommonRuleClear(t){t.safeClearance=null,t.otherClearance=null,t.track=null,t.diff=null,t.radius=null,t.innerPlane=null,t.copperPlane=null,t.creepageClearance=null}modifyRegionCopperRule(t,e,r){switch(e){case"1":t.safeCopperPlane=r;break}}modifyRegionInnerPlaneRule(t,e,r){switch(e){case"1":t.safeInnerPlane=r;break}}getRuleName4NetModel(t,e){let r,i=e instanceof Array?e[0]:e;switch(t){case"1":r=dI.getSafeSpacing(i);break;case"3":r=dI.getTrackPhysics(i);break;case"11":r=dI.getNetLengthPhysics(i);break;case"13":r=dI.getNetLengthTolerancePhysics(i);break;case"10":r=dI.getDifferentialPhysics(i);break;case"4":r=dI.getBlindPhysics(i);break;case"5":r=dI.getRadiusPhysics(i);break;case"6":r=dI.getInnerPlane(i);break;case"7":r=dI.getCopperPlane(i);break;case"8":r=dI.getPasteExpansion(i);break;case"9":r=dI.getSolderExpansion(i);break;case"14":r=dI.getCreepageSpacing(i);break}return t=="13"&&r==null?null:r!=null&&!r.isDefault?i:"default"}getRule(t,e){let r=re.getInstance(),i=t[0],n=t[1];if(e==4){if(i==="NET_CLASS"){let s=r.getNetClass(n);return s==null&&(s=r.addNetClass(n)),s}else if(i==="DIFF_PAIR"){let s=r.getNetDifferential(n);return s==null&&(s=r.addNetDifferential(n)),s}else if(i==="EQ_LEN_GRP"){let s=r.getEqualLengthGroup(n);return s==null&&(s=r.addEqualLengthGroup(n)),s}else if(i==="NET"){if(n==null)return;let s=r.getNet(n);return s==null&&(s=r.addNet(n)),s}}else if(e==3){let s=t[0],a=t[1];if(s[0]==null||a[0]==null)return;let l=this.getNetType(s[0]),c=this.getNetType(a[0]),h=r.betweenNetRule.getRule(s[1],a[1]);return h==null&&(h=new lg(l,s[1],c,a[1]),r.betweenNetRule.addRule(h)),h}else if(e==2){if(i==="POUR"){let s=n;return r.addRegionSelector(s)}else if(i==="REGION"){let s=n;return r.addConstraintSelector(s)}}}needUpdate(t,e){if(t==4||t==2)switch(e){case"NET_CLASS":case"NET":case"EQ_LEN_GRP":case"POUR":case"REGION":return!0}else if(t==3)return!0;return!1}loadKeyValue(t,e,r,i){if(r==4||r==2)switch(i){case"NET_CLASS":case"DIFF_PAIR":case"EQ_LEN_GRP":case"NET":this.modifyCommonRuleClear(t);break;case"POUR":case"REGION":this.modifyRegionCommonRuleClear(t);break}for(let n in e){let s=e[n];if(r==4||r==2)switch(i){case"NET_CLASS":case"DIFF_PAIR":case"EQ_LEN_GRP":case"NET":this.modifyCommonRule(t,n,s);break;case"POUR":case"REGION":this.modifyRegionCommonRule(t,n,s);break}else if(r==3)switch(n){case"1":t.ruleName!==s&&(t.ruleName=s);break;case"14":t.creepageRule!==s&&(t.creepageRule=s);break}}}loadCopperRuleValue(t,e,r,i){let n=this.needUpdate(r,i);t.safeCopperPlane&&n&&(e==null?void 0:e["7"])==null&&this.modifyCopperRule(t,"7",null);for(let s in e){let a=e[s];n&&this.modifyCopperRule(t,s,a)}}loadInnerPlaneRuleValue(t,e,r,i){let n=this.needUpdate(r,i);t.safeInnerPlane&&n&&(e==null?void 0:e["6"])==null&&this.modifyInnerPlaneRule(t,"6",null);for(let s in e){let a=e[s];n&&this.modifyInnerPlaneRule(t,s,a)}}load(){if(!this.resultNeedToBeCached)return;let t=this.getRule(this.select,this.order);this.loadKeyValue(t,this.keyValue,this.order,this.select[0]),this.loadCopperRuleValue(t,this.copperRuleValue,this.order,this.select[0]),this.loadInnerPlaneRuleValue(t,this.innerPlaneRuleValue,this.order,this.select[0])}};var Bte=class extends wl{constructor(){super(...arguments);this.origin=S.ORIGIN;this.highlightValue=.5}get hashkey(){return null}feed(e){let{originX:r,originY:i,unit:n,gridXSize:s,gridYSize:a,snapXSize:l,snapYSize:c,altSnapXSize:h,altSnapYSize:u,gridType:d,multiGridType:p,multiGridRatio:m,highlightValue:g}=e;(this.isNumber(r)||this.isNumber(i))&&(this.origin=new S(r/10,i/10)),this.unit=n,this.isNumber(s)&&(this.gridX=s/10),this.isNumber(a)&&(this.gridY=a/10),this.isNumber(l)?this.snapX=l/10:this.snapX=this.gridX,this.isNumber(c)?this.snapY=c/10:this.snapY=this.gridY,this.isNumber(h)?this.altSnapX=h:this.altSnapX=this.gridX,this.isNumber(u)?this.altSnapY=u:this.altSnapY=this.gridY,this.isNumber(g)&&(this.highlightValue=g),this.gridType=EIe(d),this.multiGridType=EIe(p),this.multiGridRatio=m}check(){return!(!(this.unit==="mm"||this.unit==="mil")||this.gridX===void 0||isNaN(this.gridX)||this.gridY===void 0||isNaN(this.gridY)||this.snapX===void 0||isNaN(this.snapX)||this.snapY===void 0||isNaN(this.snapY)||this.altSnapX===void 0||isNaN(this.altSnapX)||this.altSnapY===void 0||isNaN(this.altSnapY)||this.gridType==null||this.multiGridType==null||this.multiGridRatio<0||isNaN(this.multiGridRatio))}finish(){R.getInstance().origin=this.origin,R.getInstance().unit=this.unit,R.getInstance().forceValue=this.highlightValue,It.getInstance().setGridX(this.gridX),It.getInstance().setGridY(this.gridY),It.getInstance().setSnapX(this.snapX),It.getInstance().setSnapY(this.snapY);let e={GridX:{number:this.altSnapX,unit:this.unit},GridY:{number:this.altSnapY,unit:this.unit}};R.getInstance().altGridSize=e,R.getInstance().gridType=this.gridType,R.getInstance().multiType=this.multiGridType,R.getInstance().multiRatio=this.getGridRatio(+this.multiGridRatio),Ai().setTarget(new Dt(this.origin.x,this.origin.y,0))}getGridTypeByNum(e){switch(e){case 0:return"none";case 1:return"grid";case 2:return"outlets"}return"none"}getGridRatio(e){return e>=1?e:5}loadOrigin(e){this.model.origin.equals(e)||(this.model.origin=e)}loadUnit(e){this.model instanceof pI||this.model.unit!==e&&(this.model.unit=e)}load(){this.loadOrigin(this.origin),this.loadUnit(this.unit)}};var l9t=.001/180*Math.PI,aB=class{constructor(){this.deltaAngle=l9t;this.minLength=.01}fixStart(t,e,r,i,n){let s=t.sub(e).normalize(),a=i.sub(e).normalize(),l=Math.acos(s.dot(a));if(Math.abs(r*l)>this.minLength&&l>this.deltaAngle)return t;{let h=this.minLength/r,u=Math.max(h,this.deltaAngle),d=t.angle(e),p=i.angle(e),m=this.getAngle(n,d,p);return Math.abs(m)>Math.PI?n===ae.CCW?d=p+u:d=p-u:n===ae.CCW?d=p-u:d=p+u,new S(Math.cos(d),Math.sin(d)).mul(r).add(e)}}fixEnd(t,e,r,i,n){let s=i.sub(e).normalize(),a=t.sub(e).normalize(),l=Math.acos(s.dot(a));if(Math.abs(r*l)>this.minLength&&l>this.deltaAngle)return t;{let h=this.minLength/r,u=Math.max(h,this.deltaAngle),d=i.angle(e),p=t.angle(e),m=this.getAngle(n,d,p);return Math.abs(m)>Math.PI?n===ae.CCW?p=d-u:p=d+u:n===ae.CCW?p=d+u:p=d-u,new S(Math.cos(p),Math.sin(p)).mul(r).add(e)}}fixStartAngle(t,e,r,i){let n=this.getAngle(i,t,r),s=kr-n;if(s=Math.min(s,n),Math.abs(e*s)>this.minLength&&s>this.deltaAngle)return t;{let l=this.minLength/e,c=Math.max(l,this.deltaAngle);return Math.abs(n)>Math.PI?i===ae.CCW?t=r+c:t=r-c:i===ae.CCW?t=r-c:t=r+c,t}}fixEndAngle(t,e,r,i){let n=this.getAngle(i,r,t),s=kr-n;if(s=Math.min(s,n),Math.abs(e*s)>this.minLength&&s>this.deltaAngle)return t;{let l=this.minLength/e,c=Math.max(l,this.deltaAngle);return Math.abs(n)>Math.PI?i===ae.CCW?t=r-c:t=r+c:i===ae.CCW?t=r+c:t=r-c,t}}getAngle(t,e,r){r=(r%kr+kr)%kr,e=(e%kr+kr)%kr;let i=0;return t==ae.CCW?i=(r-e+kr)%kr:i=(e-r+kr)%kr,(i%kr+kr)%kr}};var c9t=new aB,lB=class o{constructor(t,e,r,i,n,s=1){this._center=t,this._radius=e,this._startAngle=n1(r),this._endAngle=n1(i),this._sweep=n,this._arcType=s}get center(){return this._center}set center(t){this._center!=t&&(this._center=t)}get radius(){return this._radius}set radius(t){t==0&&(t=1e-8),this._radius!=t&&(this._radius=t)}get startAngle(){return this._startAngle}set startAngle(t){t=n1(t),this._startAngle!=t&&(this._startAngle=t)}get endAngle(){return this._endAngle}set endAngle(t){t=n1(t),this._endAngle!=t&&(this._endAngle=t)}get sweep(){return this._sweep}set sweep(t){this._sweep!=t&&(this._sweep=t)}get arcType(){return this._arcType}set arcType(t){this._arcType=t}get angle(){let t=new Yn,{angle:e}=t.angleToPoint(this.center,this.radius,this.startAngle,this.endAngle,this.sweep);return e}set angle(t){let e=new Yn,{center:r,radius:i,startAngle:n,endAngle:s,sweep:a}=e.pointToAngle(this.start,this.end,t);this.center=r,this.radius=i,this.startAngle=n,this.endAngle=s,this.sweep=a}get sweepAngle(){let t=this.startAngle,e=this.endAngle;return this.sweep===ae.CCW?e<=t&&(e+=kr):e>=t&&(t+=kr),e-t}get start(){return this.center.add(new S(Math.cos(this.startAngle),Math.sin(this.startAngle)).mul(this.radius))}set start(t){t=c9t.fixStart(t,this.center,this.radius,this.end,this.sweep);let e=this.end,r=this.start,i=this.midPoint,n=e.distance2(t),s=Math.sqrt(i.distance2(r)-e.distance2(r)/4);isNaN(s)&&(s=1e-4);let a=s/2+n/s/8;a==0&&(a=1e-8),this.radius=a;let l=e.sub(t),c=t.add(e).mul(.5),h;this.sweep==ae.CCW?h=new S(-l.y,l.x).normalize():h=new S(l.y,-l.x).normalize();let u=c.add(h.mul(a-s));this.center=u;let d=t.sub(u).normalize(),p=e.sub(u).normalize();this.startAngle=Math.atan2(d.y,d.x),this.endAngle=Math.atan2(p.y,p.x)}get end(){return this.center.add(new S(Math.cos(this.endAngle),Math.sin(this.endAngle)).mul(this.radius))}set end(t){let e=this.end,r=this.start,i=this.midPoint,n=t.distance2(r),s=Math.sqrt(i.distance2(r)-e.distance2(r)/4);isNaN(s)&&(s=1e-4);let a=s/2+n/s/8;a==0&&(a=1e-8),this.radius=a;let l=t.sub(r),c=r.add(t).mul(.5),h;this.sweep==ae.CCW?h=new S(-l.y,l.x).normalize():h=new S(l.y,-l.x).normalize();let u=c.add(h.mul(a-s));this.center=u;let d=r.sub(u).normalize(),p=t.sub(u).normalize(),m=Math.atan2(d.y,d.x),g=Math.atan2(p.y,p.x);this.startAngle=m,this.endAngle=g}get length(){return Math.abs(this.radius*this.sweepAngle*Math.PI/Math.PI)}set length(t){let e=t/this.radius;this.sweep==ae.CCW?this.endAngle=this.startAngle+e:this.endAngle=this.startAngle-e}get midPoint(){let t=this.startAngle,e=this.endAngle,r=this.sweep,i=this.center,n=this.radius;if(r==ae.CCW)if(e>t){let s=(e-t)/2+t;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new S(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(e+kr-t)/2+t;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}}else if(e>t){let s=(t+kr-e)/2+e;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}else{if(e==t)return i.add(new S(Math.cos(Math.PI*3/2),Math.sin(Math.PI*3/2)).mul(n));{let s=(t-e)/2+e;return i.add(new S(Math.cos(s),Math.sin(s)).mul(n))}}}set midPoint(t){let e=this.end,r=this.start,i=this.midPoint,n=e.sub(r),s;this.sweep==ae.CCW?s=new S(-n.y,n.x).normalize():s=new S(n.y,-n.x).normalize();let a=t.sub(i),l=s.mul(a.dot(s)),c=i.add(l),h=e.distance2(r),u=Math.sqrt(c.distance2(r)-e.distance2(r)/4);isNaN(u)&&(u=1e-4);let d=u/2+h/u/8;d==0&&(d=1e-8),this.radius=d;let p=r.add(e).mul(.5),m=i.sub(p),g=c.sub(p);m.dot(g)<0&&(this.sweep==ae.CCW?this.sweep=ae.CW:this.sweep=ae.CCW),this.sweep==ae.CCW?s=new S(-n.y,n.x).normalize():s=new S(n.y,-n.x).normalize();let b=p.add(s.mul(d-u));this.center=b;let P=r.sub(b).normalize(),T=e.sub(b).normalize(),I=Math.atan2(P.y,P.x),C=Math.atan2(T.y,T.x);this.startAngle=I,this.startAngle=C}get primitive(){return this.arcType==1?q.build2(this.center,this.startAngle/Math.PI*180,this.endAngle/Math.PI*180,this.radius,this.radius,this.sweep):m9.build2(this.center,this.startAngle/Math.PI*180,this.endAngle/Math.PI*180,this.radius,this.radius,this.sweep)}getAngle(){return this.sweep==ae.CCW?(this.endAngle-this.startAngle+kr)%kr:(this.startAngle-this.endAngle+kr)%kr}setStartAngleAndEndAngle(t,e){this.startAngle=t,this.endAngle=e}transform(t){this._center=this._center.multiply4(t);let r=t.data[0]*t.data[5]-t.data[1]*t.data[4]<0,i=r?Math.atan2(-t.data[1],-t.data[0]):Math.atan2(t.data[1],t.data[0]);r?(this._sweep=this._sweep==ae.CCW?ae.CW:ae.CCW,this._startAngle=n1(Math.PI-(this._startAngle+i)),this._endAngle=n1(Math.PI-(this._endAngle+i))):(this._startAngle=n1(this._startAngle+i),this._endAngle=n1(this._endAngle+i))}inShape(t,e,r,i){r<.05&&i!=null&&(r=10/i.getScale());let n=this.sweep==ae.CW,s=n?this.endAngle:this.startAngle,a=n?this.startAngle:this.endAngle;s%=kr,s<0&&(s+=kr),a%=kr,a<0&&(a+=kr);let l=this.radius-r/2,c=this.radius+r/2,h=t-this.center.x,u=e-this.center.y,d=Math.atan2(u,h);if(d<0&&(d+=kr),s<=a&&d>=s&&d<=a||s>a&&(d>=s&&d<=kr||d>=0&&d<=a)||s==a){var p=Math.sqrt(h*h+u*u);return p<=c&&p>=l}else{var p=(c+l)/2,m=new S(this.center.x+Math.cos(s)*p,this.center.y+Math.sin(s)*p),g=new S(this.center.x+Math.cos(a)*p,this.center.y+Math.sin(a)*p),y=t-m.x,b=e-m.y,P=t-g.x,T=e-g.y;return y*y+b*b<=r*r/4?!0:P*P+T*T<=r*r/4}}getBBox(t){return NBe(this.center,this.radius,t,this.startAngle,this.endAngle,this.sweep)}getMathGraphics(t,e){return this.primitive.stroke(t+e*2,wr.ROUND,ae.CW)}clone(){return new o(this._center,this._radius,this._startAngle,this._endAngle,this._sweep,this._arcType)}equals(t){return t instanceof o?this.radius==t.radius&&this.startAngle==t.startAngle&&this.endAngle==t.endAngle&&this.sweep==t.sweep&&this.arcType==t.arcType&&this.center.equals1(t.center):!1}};var Ii=class o extends gt{constructor(e,r,i,n,s,a,l,c,h,u,d,p){super(e,new lB(i,n,a,l,c,d),r,s,u,h,p);this.modelType="ArcTrack";Ro("data/model/ArcTrackModel")}get radius(){return this._baseModel.radius}set radius(e){this._baseModel.radius!=e&&(this._baseModel.radius=e,this.updateShapeData())}get arcType(){return this._baseModel.arcType}set arcType(e){this._baseModel.arcType!=e&&(this._baseModel.arcType=e)}get startAngle(){return this._baseModel.startAngle}set startAngle(e){this._baseModel.startAngle=e,this.updateShapeData()}get endAngle(){return this._baseModel.endAngle}set endAngle(e){this._baseModel.endAngle=e,this.updateShapeData()}get center(){return this._baseModel.center}set center(e){this._baseModel.center=e,this.updateShapeData()}get midPoint(){return this._baseModel.midPoint}set midPoint(e){this._baseModel.midPoint=e}get sweepAngle(){return this._baseModel.sweepAngle}get sweep(){return this._baseModel.sweep}set sweep(e){this._baseModel.sweep!=e&&(this._baseModel.sweep=e,this.updateShapeData())}get isCCW(){return this.sweep===ae.CCW}get angle(){return this._baseModel.angle}set angle(e){this._baseModel.angle=e,this.updateShapeData()}get primitive(){return this._baseModel.primitive}transform(e){this._baseModel.transform(e),this.updateShapeData()}clone(){this.refreshBBox&&this.updateBox();let e=new o(this._globalIndex,this.layerId,this.center,this.radius,this.width,this.startAngle,this.endAngle,this.sweep,this.locked,this.showNet,this.arcType,this._bbox);return e.number=this.number,e.zIndex=this.zIndex,e}};var zr=class o extends gt{constructor(e,r,i,n,s,a,l,c){super(e,new ex(i,n),r,oo(s),l,a,c);this.modelType="Track";Ro("data/model/TrackModel")}get direct(){return this._baseModel.direct}get center(){return this._baseModel.center}get midPoint(){return this._baseModel.center}get primitive(){return this._baseModel.primitive}transform(e){this._baseModel.transform(e),this.updateShapeData()}rotateFor(e,r){let i=Ae.rotateZForPoint(e,r);this.transform(i)}inOutline(e){return this.inShape(e.x,e.y)}clone(){this.refreshBBox&&this.updateBox();let e=new o(this._globalIndex,this.layerId,this.start,this.end,this.width,this.locked,this.showNet,this._bbox);return e.number=this.number,e.zIndex=this.zIndex,e}};var uM=class uM extends Ei{static getInstance(){return uM.manager==null&&(uM.manager=new uM),uM.manager}addModel(t){return this._last=t,this.map.set(t.globalIndex,this._last),this._last}addTrack(t,e,r,i,n,s,a){return this._last=new zr(t,e,r,i,n,s,a),this.addModel(this._last),this._last}addArcTrack(t,e,r,i,n,s,a,l,c,h,u){return this._last=new Ii(t,e,r,i,l,n,s,a,c,h,u),this.addModel(this._last),this._last}delete(t,e){(t.modelType==="ArcTrack"||t.modelType==="Track")&&this.map.delete(e)}deleteById(t){this.map.delete(t)}};uM.manager=null;var Sn=uM;var cB=class extends Zp{loadNet(t){this.model.net!=t&&(this.netModifyInter!=null&&this.netModifyInter.addNetModify(this.model.net,this.model),this.model.net=t)}loadWidth(t){this.model.width!=t&&(this.model.width=t)}};var dM=class extends cB{constructor(){super(...arguments);this.start=S.ORIGIN;this.end=S.ORIGIN;this.locked=!1}feed(e){let{id:r,partitionId:i,groupId:n,netName:s,layerId:a,startX:l,startY:c,endX:h,endY:u,angle:d,width:p,locked:m,zIndex:g,number:y,arcType:b}=e;this.index=r,this.partition=i,this.groupId=Ca(n),this.net=s||"",this.zIndex=g,this.number=y,this.isNumber(a)&&(this.layerId=a),this.isNumber(l)&&this.isNumber(c)&&(this.start=new S(l/10,c/10)),this.isNumber(h)&&this.isNumber(u)&&(this.end=new S(h/10,u/10)),this.isNumber(d)&&(this.angle=d/180*Math.PI),this.isNumber(p)&&(this.width=p/10),this.locked=m,this.type=g8e(b)}clear(){this.model=null,this.index=null,this.partition=null,this.groupId=null,this.net=null,this.zIndex=null,this.number=null,this.layerId=null,this.start=S.ORIGIN,this.end=S.ORIGIN,this.angle=null,this.width=0,this.locked=null,this.type=null}clearGroupId(){this.groupId=null}changeNet4Map(e){let r=e.get(this.net);r!=null&&(this.net=r)}check(){return!(!this.layerId||!this.width||isNaN(this.angle)||this.groupId===void 0||this.net==null||this.angle==null||isNaN(this.angle)||this.start.equals1(this.end)||this.width==null||isNaN(this.width)||this.width<=0||this.locked==null)}arcCheck(){return!(this.index==null||this.net==null||this.layerId==null||this.angle==null||ne.eq(Math.abs(zt.toDegrees(this.angle)),360)||ne.eq(this.angle,0)||this.width==null||this.start.equals1(this.end))}finish(){if(this.arcCheck()){let{center:e,radius:r,startAngle:i,endAngle:n,sweep:s}=new Yn().pointToAngle(this.start,this.end,this.angle),a=this.addItem(e,r,i,n,s);return this.groupId!=null&&a.setGroupID(this.groupId),this.partition&&(a.partition=this.partition),this.isNumber(this.zIndex)&&(a.zIndex=this.zIndex),this.isNumber(this.number)&&(a.number=this.number),a}else return null}addItem(e,r,i,n,s){return this.resultNeedToBeCached?Sn.getInstance().addArcTrack(this.index,this.layerId,e,r,i,n,s,this.width,this.locked,this.net,this.type):new Ii(this.index,this.layerId,e,r,this.width,i,n,s,this.locked,this.net,this.type)}loadCenter(e){this.model.center.equals(e)||(this.model.center=e)}loadRadius(e){this.model.radius!=e&&(this.model.radius=e)}loadSweep(e){this.model.sweep!=e&&(this.model.sweep=e)}loadStartAngle(e){this.model.startAngle!=e&&(this.model.startAngle=e)}loadEndAngle(e){this.model.endAngle!=e&&(this.model.endAngle=e)}loadType(e){this.model.arcType!=e&&(this.model.arcType=e)}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.partition!==void 0&&this.loadNet(this.net),this.loadLayerId(this.layerId),this.loadWidth(this.width),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadNumber(this.number),this.loadType(this.type);let{center:e,radius:r,startAngle:i,endAngle:n,sweep:s}=new Yn().pointToAngle(this.start,this.end,this.angle);this.loadCenter(e),this.loadRadius(r),this.loadStartAngle(i),this.loadEndAngle(n),this.loadSweep(s)}};var pM=class extends cB{constructor(){super(...arguments);this.startX=0;this.startY=0;this.endX=0;this.endY=0;this.width=0}feed(e){let{id:r,partitionId:i,groupId:n,netName:s,layerId:a,startX:l,startY:c,endX:h,endY:u,width:d,locked:p,zIndex:m,number:g}=e;this.index=r,this.partition=i,this.groupId=Ca(n),this.net=s,this.zIndex=m,this.number=g,this.isNumber(a)&&(this.layerId=a),this.isNumber(l)&&(this.startX=l/10),this.isNumber(c)&&(this.startY=c/10),this.isNumber(h)&&(this.endX=h/10),this.isNumber(u)&&(this.endY=u/10),this.isNumber(d)&&(this.width=d/10),this.locked=p}clear(){this.model=null,this.index=null,this.partition=null,this.groupId=null,this.net=null,this.zIndex=null,this.number=null,this.layerId=null,this.startX=0,this.startY=0,this.endX=0,this.endY=0,this.width=0,this.locked=null}clearGroupId(){this.groupId=null}changeNet4Map(e){let r=e.get(this.net);r!=null&&(this.net=r)}check(){return!(!this.index||this.groupId===void 0||!this.layerId||this.net==null||this.width==null||isNaN(this.width)||this.width<=0||this.locked==null)}finish(){if(!this.check())return null;let e=new S(this.startX,this.startY),r=new S(this.endX,this.endY);if(e.distance1(r)<.01)return null;let i=this.getItem(e,r);return this.groupId!=null&&i.setGroupID(this.groupId),this.partition&&(i.partition=this.partition),this.isNumber(this.zIndex)&&(i.zIndex=this.zIndex),this.isNumber(this.number)&&(i.number=this.number),i}getItem(e,r){return this.resultNeedToBeCached?Sn.getInstance().addTrack(this.index,this.layerId,e,r,this.width,this.locked,this.net):new zr(this.index,this.layerId,e,r,this.width,this.locked,this.net)}loadStart(e){this.model.start.equals(e)||(this.model.start=e)}loadEnd(e){this.model.end.equals(e)||(this.model.end=e)}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.partition!==void 0&&this.loadNet(this.net),this.loadLayerId(this.layerId),this.loadWidth(this.width),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadNumber(this.number);let e=new S(this.startX,this.startY),r=new S(this.endX,this.endY);this.loadStart(e),this.loadEnd(r)}};function fM(o,t,e,r,i,n){let s=Ae.rotateZForPoint(t,-i),a=o.multiply4(s),l=Math.min(e/2,r/2,n),c=t,h=new S(t.x,t.y-r),u=new S(t.x+e,t.y),d=new S(t.x+e,t.y-r),p=h.add1(l,l),m=d.add1(-l,l),g=u.add1(-l,-l),y=c.add1(l,-l);if(new ht(h.x,u.x,h.y,u.y).isContains(a)){if(a.x<p.x){if(a.y<p.y)return a.distance1(p)<=l;if(a.y>y.y)return a.distance1(y)<=l}if(a.x>m.x){if(a.y<m.y)return a.distance1(m)<=l;if(a.y>g.y)return a.distance1(g)<=l}return!0}else return!1}function hB(o,t,e,r,i,n,s,a=!1,l){s<.05&&l!=null&&(s=10/l.getScale());let c=Ae.rotateZForPoint(t,-i),h=o.multiply4(c),u=Math.min(e/2,r/2,n),d=t,p=new S(t.x,t.y-r),m=new S(t.x+e,t.y),g=new S(t.x+e,t.y-r),y=p.add1(u,u),b=g.add1(-u,u),P=m.add1(-u,-u),T=d.add1(u,-u),I=new S(d.x,y.y),C=new S(d.x,T.y),E=new S(T.x,d.y),O=new S(P.x,d.y),_=new S(g.x,P.y),x=new S(g.x,b.y),v=new S(b.x,g.y),D=new S(y.x,g.y);return!!(Da(h,I,C,s)||Da(h,E,O,s)||Da(h,_,x,s)||Da(h,v,D,s)||!a&&($0(h,y,u,zh,zh*1.5,ae.CCW,s)||$0(h,b,u,zh*1.5,kr,ae.CCW,s)||$0(h,P,u,0,zh/2,ae.CCW,s)||$0(h,T,u,zh/2,zh,ae.CCW,s)))}function wY(o,t,e,r,i,n){let s=Math.min(t/2,e/2,i),a=Ae.rotateZForPoint(o,r),l=o,c=new S(o.x,o.y-e),h=new S(o.x+t,o.y),u=new S(o.x+t,o.y-e),d=c.add1(s,s).multiply4(a),p=u.add1(-s,s).multiply4(a),m=h.add1(-s,-s).multiply4(a),g=l.add1(s,-s).multiply4(a),y=new _e;return y.ext2(d).ext2(p).ext2(m).ext2(g).ext7(s+n/2),y.build1()}var Za=class extends or{constructor(){super(...arguments);this.modelType="Rect"}get leftLow(){let e=Ae.rotateZForPoint(this.start,this.rotation);return new S(this.start.x,this.start.y-this.height).multiply4(e)}set leftLow(e){let r=this.start,i=Ae.rotateZForPoint(r,-this.rotation),n=Ae.rotateZForPoint(r,this.rotation),s=e.multiply4(i),a=this.getBox(s,new S(this.start.x+this.width,this.start.y)),l=new S(a[0],a[3]).multiply4(n),c=Math.abs(a[2]-a[0]),h=Math.abs(a[3]-a[1]);this.start=l,this.width=c,this.height=h}get leftUp(){return this.start}set leftUp(e){let r=this.start,i=Ae.rotateZForPoint(r,-this.rotation),n=Ae.rotateZForPoint(r,this.rotation),s=e.multiply4(i),a=this.getBox(s,new S(this.start.x+this.width,this.start.y-this.height)),l=new S(a[0],a[3]).multiply4(n),c=Math.abs(a[2]-a[0]),h=Math.abs(a[3]-a[1]);this.start=l,this.width=c,this.height=h}get rightLow(){let e=Ae.rotateZForPoint(this.start,this.rotation);return new S(this.start.x+this.width,this.start.y-this.height).multiply4(e)}set rightLow(e){let r=this.start,i=Ae.rotateZForPoint(r,-this.rotation),n=Ae.rotateZForPoint(r,this.rotation),s=e.multiply4(i),a=this.getBox(s,r),l=new S(a[0],a[3]).multiply4(n),c=Math.abs(a[2]-a[0]),h=Math.abs(a[3]-a[1]);this.start=l,this.width=c,this.height=h}get rightUp(){let e=Ae.rotateZForPoint(this.start,this.rotation);return new S(this.start.x+this.width,this.start.y).multiply4(e)}set rightUp(e){let r=this.start,i=Ae.rotateZForPoint(r,-this.rotation),n=Ae.rotateZForPoint(r,this.rotation),s=e.multiply4(i),a=this.getBox(s,new S(this.start.x,this.start.y-this.height)),l=new S(a[0],a[3]).multiply4(n),c=Math.abs(a[2]-a[0]),h=Math.abs(a[3]-a[1]);this.start=l,this.width=c,this.height=h}get realCornerRadius(){return Math.min(this.width/2,this.height/2,this.radius)}get cornerRatio(){return this.realCornerRadius/Math.min(this.width/2,this.height/2)}get polyline(){return ag(this.leftLow.add(this.leftUp).mul(.5),this.rightLow.add(this.rightUp).mul(.5),this.height,2*this.realCornerRadius/Math.min(this.width,this.height))}getBox(e,r){let i=Math.min(e.x,r.x),n=Math.max(e.x,r.x),s=Math.min(e.y,r.y),a=Math.max(e.y,r.y);return n-i<.01&&(n=i+.01),a-s<.01&&(s=a-.01),[i,s,n,a]}getAllLinesInOrder(){let e=this.getLines(),r=this.getArcs();return[r[0],e[0],r[1],e[1],r[2],e[2],r[3],e[3]].filter(i=>i!=null)}rotateFor(e,r){let i=Ae.rotateZForPoint(e,r);this.transform(i)}transform(e){let r=this.rightLow,i=this.start.multiply4(e);r=r.multiply4(e),this.rotation=S.caculateAngle(this.rotation,e)%kr;let n=Ae.translate(-i.x,-i.y,0).rotateZ(-this.rotation),s=Ae.rotateZ(this.rotation).translate1(i.x,i.y,0),a=new _e;a.ext2(i.multiply4(n)).ext2(r.multiply4(n));let l=a.build1();this.start=l.UL().multiply4(s)}inOutline(e){return this.inShape(e.x,e.y)}inShape(e,r,i){switch(this.type){case"Annotation":case"Copper Region":case"Line":case"Board Outline":case"3D Shell - Outline":return hB(new S(e,r),this.start,this.width,this.height,this.rotation,this.radius,this.strokeWidth,void 0,i);default:return hB(new S(e,r),this.start,this.width,this.height,this.rotation,this.radius,this.strokeWidth,void 0,i)?!0:fM(new S(e,r),this.start,this.width,this.height,this.rotation,this.radius)}}isInside(e){return fM(e,this.start,this.width,this.height,this.rotation,this.radius)}InnerArea(e,r){return fM(new S(e,r),this.start,this.width,this.height,this.rotation,this.radius)}isSelectOnlyLine(e,r){return hB(new S(e,r),this.start,this.width,this.height,this.rotation,this.radius,this.strokeWidth,!0)}getEndPoints(){let{leftUp:e,leftLow:r,rightUp:i,rightLow:n,realCornerRadius:s}=this,a=n.sub(r).normalize(),l=e.sub(r).normalize(),c=r.add(a.mul(s)),h=n.add(a.mul(-s)),u=n.add(l.mul(s)),d=i.add(l.mul(-s)),p=i.add(a.mul(-s)),m=e.add(a.mul(s)),g=e.add(l.mul(-s)),y=r.add(l.mul(s));return[c,h,u,d,p,m,g,y]}getMidPoints(){let e=[],{leftUp:r,leftLow:i,rightUp:n,rightLow:s,realCornerRadius:a}=this,l=s.sub(i).normalize(),c=r.sub(i).normalize(),h=i.add(l.mul(a)),u=s.add(l.mul(-a)),d=s.add(c.mul(a)),p=n.add(c.mul(-a)),m=n.add(l.mul(-a)),g=r.add(l.mul(a)),y=r.add(c.mul(-a)),b=i.add(c.mul(a)),P=[h,u,d,p,m,g,y,b];for(let T=0;T<P.length;T=T+2){let I=P[T],C=P[T+1],E=I.add(C).mul(.5);e.push(E)}if(a>0){let T=h.add(c.mul(this.radius)),I=d.add(l.mul(-this.radius)),C=m.add(c.mul(-this.radius)),E=y.add(l.mul(this.radius)),O=[T,I,C,E],_=[b,h,u,d,p,m,g,y];for(let x=0;x<4;x++){let v=O[x],D=cte(v,a,_[x*2].angle(v),_[x*2+1].angle(v),ae.CCW);e.push(D)}}return e}getArcCenterPoints(){if(this.radius>0){let{leftUp:e,leftLow:r,rightUp:i,rightLow:n,realCornerRadius:s}=this,a=n.sub(r).normalize(),l=e.sub(r).normalize(),c=r.add(a.mul(s)),h=n.add(l.mul(s)),u=i.add(a.mul(-s)),d=e.add(l.mul(-s)),p=c.add(l.mul(this.radius)),m=h.add(a.mul(-this.radius)),g=u.add(l.mul(-this.radius)),y=d.add(a.mul(this.radius));return[p,m,g,y]}return[]}getLines(){let{leftUp:e,leftLow:r,rightUp:i,rightLow:n,realCornerRadius:s}=this,a=n.sub(r).normalize(),l=e.sub(r).normalize(),c=new M(r.add(a.mul(s)),n.add(a.mul(-s))),h=new M(n.add(l.mul(s)),i.add(l.mul(-s))),u=new M(i.add(a.mul(-s)),e.add(a.mul(s))),d=new M(e.add(l.mul(-s)),r.add(l.mul(s)));return[c,h,u,d]}getArcs(){let e=[],{leftUp:r,leftLow:i,rightUp:n,rightLow:s,realCornerRadius:a}=this;if(this.radius>0){let l=s.sub(i).normalize(),c=r.sub(i).normalize(),h=i.add(l.mul(a)),u=s.add(l.mul(-a)),d=s.add(c.mul(a)),p=n.add(c.mul(-a)),m=n.add(l.mul(-a)),g=r.add(l.mul(a)),y=r.add(c.mul(-a)),b=i.add(c.mul(a)),P=h.add(c.mul(a)),T=d.add(l.mul(-a)),I=m.add(c.mul(-a)),C=y.add(l.mul(a)),E=[P,T,I,C],O=[b,h,u,d,p,m,g,y];for(let _=0;_<E.length;_++){let x=E[_];e.push(q.build2(x,O[_*2].angleD(x),O[_*2+1].angleD(x),a,a,ae.CCW))}}return e}updateBox(){return this._bbox=wY(this.start,this.width,this.height,this.rotation,this.radius,this.strokeWidth),this._bbox}getMathGraphics(e=this.layerId){return this.isEmpty?null:this.layerId==e||this.layerId==12||11==this.layerId?ag(this.leftLow.add(this.leftUp).mul(.5),this.rightLow.add(this.rightUp).mul(.5),this.height,2*this.realCornerRadius/Math.min(this.width,this.height)):null}};var Sp=class o extends Za{constructor(t,e,r,i,n,s,a,l,c,h,u,d,p,m){super(),this._globalIndex=t,this.base=new sx(e,r,c,h,d,u,p),this._start=i,this._width=oo(n),this._height=oo(s),this._rotation=a,this._radius=l,this._bbox=m||wY(i,n,s,a,l,this.strokeWidth)}get start(){return this._start}set start(t){this._start.equals(t)||(this._start=t,this.updateShapeData())}get width(){return this._width}set width(t){t=oo(t),this._width!=t&&(this._width=t,this.updateShapeData())}get height(){return this._height}set height(t){t=oo(t),this._height!=t&&(this._height=t,this.updateShapeData())}get rotation(){return this._rotation}set rotation(t){this._rotation!=t&&(this._rotation=t,this.updateShapeData())}get radius(){return this._radius}set radius(t){this._radius!=t&&(this._radius=t,this.updateShapeData())}get realCornerRadius(){return Math.min(this.width/2,this.height/2,this.radius)}get cornerRatio(){return this.realCornerRadius/Math.min(this.width/2,this.height/2)}get polyline(){return ag(this.leftLow.add(this.leftUp).mul(.5),this.rightLow.add(this.rightUp).mul(.5),this.height,2*this.realCornerRadius/Math.min(this.width,this.height))}getAllLinesInOrder(){let t=this.getLines(),e=this.getArcs();return[e[0],t[0],e[1],t[1],e[2],t[2],e[3],t[3]].filter(r=>r!=null)}rotateFor(t,e){let r=Ae.rotateZForPoint(t,e);this.transform(r)}transform(t){let e=this.rightLow,r=this.start.multiply4(t);e=e.multiply4(t),this.rotation=S.caculateAngle(this.rotation,t)%kr;let i=Ae.translate(-r.x,-r.y,0).rotateZ(-this.rotation),n=Ae.rotateZ(this.rotation).translate1(r.x,r.y,0),s=new _e;s.ext2(r.multiply4(i)).ext2(e.multiply4(i));let a=s.build1();this.start=a.UL().multiply4(n)}inOutline(t){return this.inShape(t.x,t.y)}isInside(t){return fM(t,this.start,this.width,this.height,this.rotation,this.radius)}InnerArea(t,e){return fM(new S(t,e),this.start,this.width,this.height,this.rotation,this.radius)}isSelectOnlyLine(t,e){return hB(new S(t,e),this.start,this.width,this.height,this.rotation,this.radius,this.strokeWidth,!0)}getEndPoints(){let{leftUp:t,leftLow:e,rightUp:r,rightLow:i,realCornerRadius:n}=this,s=i.sub(e).normalize(),a=t.sub(e).normalize(),l=e.add(s.mul(n)),c=i.add(s.mul(-n)),h=i.add(a.mul(n)),u=r.add(a.mul(-n)),d=r.add(s.mul(-n)),p=t.add(s.mul(n)),m=t.add(a.mul(-n)),g=e.add(a.mul(n));return[l,c,h,u,d,p,m,g]}getMidPoints(){let t=[],{leftUp:e,leftLow:r,rightUp:i,rightLow:n,realCornerRadius:s}=this,a=n.sub(r).normalize(),l=e.sub(r).normalize(),c=r.add(a.mul(s)),h=n.add(a.mul(-s)),u=n.add(l.mul(s)),d=i.add(l.mul(-s)),p=i.add(a.mul(-s)),m=e.add(a.mul(s)),g=e.add(l.mul(-s)),y=r.add(l.mul(s)),b=[c,h,u,d,p,m,g,y];for(let P=0;P<b.length;P=P+2){let T=b[P],I=b[P+1],C=T.add(I).mul(.5);t.push(C)}if(s>0){let P=c.add(l.mul(this.radius)),T=u.add(a.mul(-this.radius)),I=p.add(l.mul(-this.radius)),C=g.add(a.mul(this.radius)),E=[P,T,I,C],O=[y,c,h,u,d,p,m,g];for(let _=0;_<4;_++){let x=E[_],v=cte(x,s,O[_*2].angle(x),O[_*2+1].angle(x),ae.CCW);t.push(v)}}return t}getArcCenterPoints(){if(this.radius>0){let{leftUp:t,leftLow:e,rightUp:r,rightLow:i,realCornerRadius:n}=this,s=i.sub(e).normalize(),a=t.sub(e).normalize(),l=e.add(s.mul(n)),c=i.add(a.mul(n)),h=r.add(s.mul(-n)),u=t.add(a.mul(-n)),d=l.add(a.mul(this.radius)),p=c.add(s.mul(-this.radius)),m=h.add(a.mul(-this.radius)),g=u.add(s.mul(this.radius));return[d,p,m,g]}return[]}getLines(){let{leftUp:t,leftLow:e,rightUp:r,rightLow:i,realCornerRadius:n}=this,s=i.sub(e).normalize(),a=t.sub(e).normalize(),l=new M(e.add(s.mul(n)),i.add(s.mul(-n))),c=new M(i.add(a.mul(n)),r.add(a.mul(-n))),h=new M(r.add(s.mul(-n)),t.add(s.mul(n))),u=new M(t.add(a.mul(-n)),e.add(a.mul(n)));return[l,c,h,u]}getArcs(){let t=[],{leftUp:e,leftLow:r,rightUp:i,rightLow:n,realCornerRadius:s}=this;if(this.radius>0){let a=n.sub(r).normalize(),l=e.sub(r).normalize(),c=r.add(a.mul(s)),h=n.add(a.mul(-s)),u=n.add(l.mul(s)),d=i.add(l.mul(-s)),p=i.add(a.mul(-s)),m=e.add(a.mul(s)),g=e.add(l.mul(-s)),y=r.add(l.mul(s)),b=c.add(l.mul(s)),P=u.add(a.mul(-s)),T=p.add(l.mul(-s)),I=g.add(a.mul(s)),C=[b,P,T,I],E=[y,c,h,u,d,p,m,g];for(let O=0;O<C.length;O++){let _=C[O];t.push(q.build2(_,E[O*2].angleD(_),E[O*2+1].angleD(_),s,s,ae.CCW))}}return t}updateBox(){return this._bbox=wY(this.start,this.width,this.height,this.rotation,this.radius,this.strokeWidth),this._bbox}getMathGraphics(t=this.layerId){return this.isEmpty?null:this.layerId==t||this.layerId==12||11==this.layerId?ag(this.leftLow.add(this.leftUp).mul(.5),this.rightLow.add(this.rightUp).mul(.5),this.height,2*this.realCornerRadius/Math.min(this.width,this.height)):null}clone(){var r;this.refreshBBox&&this.updateBox();let t=(r=this.component)==null?void 0:r.clone(),e=new o(this.globalIndex,this.type,this.layerId,this._start,this._width,this._height,this._rotation,this._radius,this.showNet,this.strokeWidth,this.locked,this.silkColor,t,this._bbox);return e.number=this.number,e.zIndex=this.zIndex,e}get type(){return this.base.type}set type(t){this.base.type!=t&&(this.base.type=t,this.updateShapeData())}get layerId(){return this.base.layerId}set layerId(t){this.base.layerId!=t&&(this.watchLayerIdModify(this.base.layerId),this.base.layerId=t,this.layerModified=!0)}get net(){var t;return(t=this.base.net)==null?void 0:t.toUpperCase()}set net(t){this.base.net!=t&&(this.base.net=t,this.netModified=!0)}get showNet(){return this.base.net}get locked(){return this.base.locked}set locked(t){this.base.locked=t}get strokeWidth(){return this.base.strokeWidth}set strokeWidth(t){t=Pu(t,this.type),this.base.strokeWidth!=t&&(this.base.strokeWidth=t,this.updateShapeData())}get silkColor(){return this.base.silkColor}set silkColor(t){this.base.silkColor=t}get component(){return this.base.component}set component(t){this.base.component!=t&&(this.base.component=t,this.updateShapeData())}get bbox(){return this._bbox}addCopper(t){this.base.addCopper(t)}deleteCopper(t){this.base.deleteCopper(t)}iteratorCopper(t){this.base.iteratorCopper(t)}clearCopperData(){this.base.clearCopperData()}};var mM=class mM extends Ei{static getInstance(){return mM.manager==null&&(mM.manager=new mM),mM.manager}addModel(t){this.map.set(t.globalIndex,t)}addRect(t,e,r,i,n,s,a,l,c=1,h=0,u=0,d=null,p){return this._last=new Sp(t,e,r,i,n,s,h,u,a,c,l,d,p,null),this.addModel(this._last),this._last}delete(t,e){t instanceof Za&&this.map.delete(e)}};mM.manager=null;var Qi=mM;var Va=class extends xi{constructor(){super(...arguments);this.modelType="Arc"}get layerModified(){return this._parent?this._parent.layerModified:this.hasDataState(3)}set layerModified(e){e&&(this.layerOrBoxModified=!0),this.setDataState(3,e)}get rx(){return this.radius}get ry(){return this.radius}setStartAngleAndEndAngle(e,r){this.startAngle=e,this.endAngle=r}};var wc=class o extends hs{constructor(e,r,i,n){super();this.modelType="Line";this._parent=void 0;this._globalIndex=e,this._viewProperty=n;let s=new ex(r,i);this._baseModel=s,Ro("data/model/LineModel")}get isSegment(){return this.width==0}get layerId(){return this._viewProperty.layerId}set layerId(e){this._parent?(this._parent.watchLayerIdModify(this._parent.layerId),this._viewProperty.layerId=e):this._viewProperty.layerId!=e&&(this.watchLayerIdModify(this._viewProperty.layerId),this._viewProperty.layerId=e,this.layerModified=!0)}get start(){return this._baseModel.start}set start(e){this._baseModel.start=e,this.updateShapeData()}get end(){return this._baseModel.end}set end(e){this._baseModel.end=e,this.updateShapeData()}get width(){return this._viewProperty.strokeWidth}set width(e){e=oo(e),this._parent?this._viewProperty.strokeWidth=e:this._viewProperty.strokeWidth!=e&&(this._viewProperty.strokeWidth=e,this.updateShapeData())}get bbox(){return this._baseModel.getBBox(this.width)}get direct(){return this._baseModel.direct}get length(){return this._baseModel.length}set length(e){this._baseModel.length=e,this.updateShapeData()}get primitive(){return this._baseModel.primitive}get center(){return this._baseModel.center}get locked(){return this._viewProperty.locked}set locked(e){this._parent?this._parent.locked=e:this._viewProperty.locked!=e&&(this._viewProperty.locked=e)}setParent(e){if(e)this._viewProperty=e;else{let r={layerId:this.layerId,strokeWidth:this.width,locked:this.locked};this._viewProperty=r,this.layerModified=this.layerModified,this.updateShapeData()}super.setParent(e)}transform(e){this._baseModel.transform(e),this.updateShapeData()}inShape(e,r,i){return this._baseModel.inShape(e,r,this.width,i)}updateBox(){return this._baseModel.getBBox(this.width)}getMathGraphics(e=this.layerId,r=0){return!this.isEmpty&&this.layerId==e?this._baseModel.getMathGraphics(this.width,r):null}clone(){this.refreshBBox&&this.updateBox();let e={layerId:this.layerId,strokeWidth:this.width,locked:this.locked},r=new o(this._globalIndex,this.start,this.end,e);return r.number=this.number,r.zIndex=this.zIndex,r}equals(e){return e instanceof o?this.layerId==e.layerId&&this.width==e.width&&this._baseModel.equals(e._baseModel):!1}buildBBox(){return this.isEmpty?null:this.updateBox()}};var zc=class o extends Va{constructor(t,e,r,i,n,s,a,l=1){super(),this._globalIndex=t,this._viewProperty=a;let c=new lB(e,r,i,n,s,l);this._baseModel=c,Ro("data/model/ArcModel")}get layerId(){return this._viewProperty.layerId}set layerId(t){this._parent?(this._parent.watchLayerIdModify(this._parent.layerId),this._viewProperty.layerId=t):this._viewProperty.layerId!=t&&(this.watchLayerIdModify(this._viewProperty.layerId),this._viewProperty.layerId=t,this.layerModified=!0)}get arcType(){return this._baseModel.arcType}set arcType(t){this._baseModel.arcType!=t&&(this._baseModel.arcType=t)}get angle(){let t=new Yn,{angle:e}=t.angleToPoint(this.center,this.radius,this.startAngle,this.endAngle,this.sweep);return e}set angle(t){let e=new Yn,{center:r,radius:i,startAngle:n,endAngle:s,sweep:a}=e.pointToAngle(this.start,this.end,t);this.center=r,this.radius=i,this.startAngle=n,this.endAngle=s,this.sweep=a}get center(){return this._baseModel.center}set center(t){this._baseModel.center=t,this.updateShapeData()}get radius(){return this._baseModel.radius}set radius(t){this._baseModel.radius=t,this.updateShapeData()}get rx(){return this.radius}get ry(){return this.radius}get width(){return this._viewProperty.strokeWidth}set width(t){this._parent?this._viewProperty.strokeWidth=t:this._viewProperty.strokeWidth!=t&&(this._viewProperty.strokeWidth=t,this.updateShapeData())}get startAngle(){return this._baseModel.startAngle}set startAngle(t){this._baseModel.startAngle=t,this.updateShapeData()}get endAngle(){return this._baseModel.endAngle}set endAngle(t){this._baseModel.endAngle=t,this.updateShapeData()}get sweepAngle(){return this._baseModel.sweepAngle}get sweep(){return this._baseModel.sweep}set sweep(t){this._baseModel.sweep=t,this.updateShapeData()}get bbox(){return this._baseModel.getBBox(this.width)}get isSegment(){return this.width==0}get midPoint(){return this._baseModel.midPoint}set midPoint(t){this._baseModel.midPoint=t,this.updateShapeData()}get start(){return this._baseModel.start}set start(t){this._baseModel.start=t,this.updateShapeData()}get end(){return this._baseModel.end}set end(t){this._baseModel.end=t,this.updateShapeData()}get length(){return this._baseModel.length}set length(t){this._baseModel.length=t,this.updateShapeData()}get primitive(){return this._baseModel.primitive}get locked(){return this._viewProperty.locked}set locked(t){this._viewProperty.locked!=t&&(this._viewProperty.locked=t)}setParent(t){if(t)this._viewProperty=t;else{let e={layerId:this.layerId,strokeWidth:this.width,locked:this.locked};this._viewProperty=e,this.layerModified=this.layerModified,this.updateShapeData()}super.setParent(t)}getAngle(){return this._baseModel.getAngle()}setStartAngleAndEndAngle(t,e){this.startAngle=t,this.endAngle=e}transform(t){this._baseModel.transform(t),this.updateShapeData()}inShape(t,e,r){return this._baseModel.inShape(t,e,this.width,r)}updateBox(){return this._baseModel.getBBox(this.width)}getMathGraphics(t=this.layerId,e=0){return!this.isEmpty&&this.layerId==t?this._baseModel.getMathGraphics(this.width,e):null}clone(){this.refreshBBox&&this.updateBox();let t={layerId:this.layerId,strokeWidth:this.width,locked:this.locked},e=new o(this._globalIndex,this.center,this.radius,this.startAngle,this.endAngle,this.sweep,t,this.arcType);return e.number=this.number,e.zIndex=this.zIndex,e}equals(t){return t instanceof o?this.layerId==t.layerId&&this.width==t.width&&this._baseModel.equals(t._baseModel):!1}buildBBox(){return this.isEmpty?null:this.updateBox()}};var Ep=class o extends ss{constructor(e,r,i,n,s,a,l,c,h,u,d){super();this.modelType="Polygon";this._pl=null;this._needUpdateCache=!1;this._simplify=!1;this._globalIndex=e,this.base=new sx(r,i,a,s,c,l,h),this.updateData(n,d),this._bbox=u||this.updateBox(),Ro("data/model/PolygonModel")}get simplyPolyline(){return this._simplify?this._pl:null}get isSimplify(){return this._simplify}set isSimplify(e){this._simplify=e}get childrens(){return iB(this._children)}set childrens(e){this._children=lM(e),this.iteratorChildren(r=>{r.setParent(this)}),this.updateChildrenShape(),this.updateShapeData(),this._isClose=this.isClose(),this.childrenModified=!0,this.isSimplify||(this._needUpdateCache=!0)}get childrenModified(){return this.hasDataState(7)}set childrenModified(e){this.setDataState(7,e)}get outline(){return this.getMathGraphics()}updateData(e,r){this._simplify=!!r,r?(this._pl=r,this._isClose=!0,this.updateShapeData(),this.clearChildren()):(this._children=lM(e),this.iteratorChildren(i=>{i.setParent(this)}),this._isClose=this.isClose(),this.updateShapeData(),this._pl=null)}clearChildren(){this.iteratorChildren(e=>{e.remove()})}refreshOutlineByChildren(){return this._needUpdateCache=!0,this.getMathGraphics()}refreshChildrenByOutline(e,r){if(!this._pl)return null;if(!r&&this._children.length>0)return this._children;let i=this._pl instanceof ge?[this._pl]:this._pl.items,n=new Array,s=this.globalIndex,a=this.layerId,l=this.strokeWidth,c=this.locked;for(let h=0;h<i.length;h++){let u=i[h],d=new Tn,p=!0;for(let g=0;g<u.primitives.length;g++){let y=u.primitives[g],b;if(y instanceof M){let P=s+nr();b=new wc(P,y.start(),y.end(),this)}else if(y instanceof q){let P=s+nr();b=new zc(P,y.center,y.rx,zt.toRadians(y.startAngle),zt.toRadians(y.endAngle()),y.sweep(),this,1)}else if(y instanceof m9){let P=s+nr();b=new zc(P,y.center,y.rx,zt.toRadians(y.startAngle),zt.toRadians(y.endAngle()),y.sweep(),this,2)}b!=null&&e!=null&&(b.setParent(this),d.addLast(b),e(b,p),p=!1)}let m=d.toArray();m.length>0&&n.push(m),d.clear()}return this._children=lM(n),this._isClose=this.isClose(),this._children}get lastIsClose(){return this._isClose}iteratorChildren(e){return xte(this._children,e)}rotateFor(e,r){let i=Ae.rotateZForPoint(e,r);this.transform(i)}transform(e){this.isSimplify&&this.childrens.length==0&&this._pl!=null?this._pl=this._pl.multiply3(e.toMatrix3()):this.iteratorChildren(r=>{r.transform(e)}),this.updateShapeData(),this._needUpdateCache=!0}inOutline(e){return this.inShape(e.x,e.y)}InnerArea(e,r,i){let n=this.isInside(new S(e,r));if(n)return n;for(let s of this.childrens)for(let a of s)if(a.inShape(e,r,i))return!0;return!1}onlyOutline(e,r){for(let i of this.childrens)for(let n of i)if(n.inShape(e,r))return!0;return!1}onOutlineShape(e,r,i){let n=this.isInside(new S(e,r));if(n)return n;for(let s of this.childrens)for(let a of s)if(a.inShape(e,r,i))return!0;return!1}updateBox(){if(this._simplify&&this._pl!=null)return this._bbox=this._pl.bbox(),this._bbox;if(this._children.length==1){let i=this._children[0].buildBBox();if(i==null)throw new Error("Polygon isEmpty.updateBBox Error!!!");return this._bbox=i,this._bbox}let e=new _e;return this.iteratorChildren(r=>{let i=r.buildBBox();if(i==null)throw new Error("Polygon isEmpty.updateBBox Error!!!");e.ext1(i)}),this._bbox=e.build1(),this._bbox}updateSimplyOutline(){if(this.isSimplify&&this._children.length>0){let e=this.childrens,r=new Array;for(let i of e){let n=new Array;for(let s of i)if(s instanceof hs){let a=s.primitive;n.push(a)}else if(s instanceof Va){let a=s.primitive;if(s.length>1e-8&&s.end.distance1(s.start)<.1&&s.getAngle()>Math.PI){let l=a.sweepAngle/2,c=a.startAngle+l,h=q.build3(a.center,a.startAngle,l,a.rx,a.ry),u=q.build3(a.center,c,l,a.rx,a.ry);n.push(h),n.push(u)}else n.push(a)}r.push(ge.build2(n))}if(r.length==1)this._pl=r[0].area()>0?r[0].reverse():r[0];else{let i=new Bt(r),n=i.getOutMostPolyline();this._pl=n.area()>0?new Bt(r.map(s=>s.reverse())):i}}}getMathGraphics(e,r){if(this.isEmpty)return null;if(!this._needUpdateCache&&this._pl)return this._pl;let i=this.childrens;if(i.length==0)return this._needUpdateCache=!1,this._pl;let n=new Array;for(let s of i){let a=new Array;for(let l of s)if(l instanceof hs){let c=l.primitive;a.push(c)}else if(l instanceof Va){let c=l.primitive;if(l.length>1e-8&&l.end.distance1(l.start)<.1&&l.getAngle()>Math.PI){let h=c.sweepAngle/2,u=c.startAngle+h,d=q.build3(c.center,c.startAngle,h,c.rx,c.ry),p=q.build3(c.center,u,h,c.rx,c.ry);a.push(d),a.push(p)}else a.push(c)}n.push(ge.build2(a))}if(n.length==1)this._pl=n[0].closed()&&n[0].area()>0?n[0].reverse():n[0];else{let s=new Bt(n),a=s.getOutMostPolyline();this._pl=a.area()>0?new Bt(n.map(l=>l.reverse())):s}return this._needUpdateCache=!1,this._pl}update4Childs(){this.updateShapeData(),this._needUpdateCache=!0}clone(){var n;this.refreshBBox&&this.updateBox();let e=this.childrens.map(s=>s.map(a=>a.clone())),r=(n=this.component)==null?void 0:n.clone(),i=new o(this.globalIndex,this.type,this.layerId,e,this.strokeWidth,this.showNet,this.locked,this.silkColor,r,this.bbox);return i.number=this.number,i.zIndex=this.zIndex,i}isClose(){return this.childrens.every(e=>{if(e.length==2){if(e[0]instanceof hs&&e[1]instanceof hs)return!1;{let r=e[0],i=e[e.length-1];if(r.start.distance1(i.end)<this.strokeWidth)return!0}}else if(e.length>2){let r=e[0],i=e[e.length-1];if(r.start.distance1(i.end)<this.strokeWidth)return!0}return!1})}equals(e){let r=this.childrens,i=e.childrens;return r.length!=i.length||r.some((a,l)=>{let c=i[l];return a.length!=c.length})?!1:!r.some((a,l)=>{let c=i[l];return a.some((h,u)=>{let d=c[u];return!h.equals(d)})})}get type(){return this.base.type}set type(e){this.base.type!=e&&(this.base.type=e,this.updateShapeData())}get layerId(){return this.base.layerId}set layerId(e){this.base.layerId!=e&&(this.watchLayerIdModify(this.base.layerId),this.base.layerId=e,this.layerModified=!0)}get net(){var e;return(e=this.base.net)==null?void 0:e.toUpperCase()}set net(e){this.base.net!=e&&(this.base.net=e,this.netModified=!0)}get showNet(){return this.base.net}get locked(){return this.base.locked}set locked(e){this.base.locked=e}get strokeWidth(){return this.base.strokeWidth}set strokeWidth(e){e=Pu(e,this.type),this.base.strokeWidth!=e&&(this.base.strokeWidth=e,this.updateChildrenShape(),this.updateShapeData())}get silkColor(){return this.base.silkColor||null}set silkColor(e){this.base.silkColor=e}get component(){return this.base.component}set component(e){this.base.component!=e&&(this.base.component=e,this.updateShapeData())}get bbox(){return this._bbox}addCopper(e){this.base.addCopper(e)}deleteCopper(e){this.base.deleteCopper(e)}iteratorCopper(e){this.base.iteratorCopper(e)}clearCopperData(){this.base.clearCopperData()}updateChildrenShape(){let e=this.childrens.flat(1);for(let r of e)r.shapeModified=!0}};var gM=class gM extends Ei{static getInstance(){return gM.manager==null&&(gM.manager=new gM),gM.manager}addModel(t){this.map.set(t.globalIndex,t)}addPolygon(t,e,r,i,n,s,a,l,c,h,u){return n=Pu(n,e),this._last=new Ep(t,e,r,i,n,s,a,l,c,h,u),this.addModel(this._last),this._last}delete(t,e){t instanceof ss&&this.map.delete(e)}};gM.manager=null;var vi=gM;function yM(o){let t=s=>!o||typeof o!="function"?o===s.type:o(s),e=[],r=Qi.getInstance().getAllItem(),i=Fi.getInstance().getAllItem(),n=vi.getInstance().getAllItem();for(let s of r)t(s)&&e.push(s);for(let s of i)t(s)&&e.push(s);for(let s of n)t(s)&&e.push(s);return e}function ru(o,t,e){switch(e){case"Copper Region":case"Fill Region":case"Line":case"TearDrop":let r=Ze.getInstance().getLayer(t);return r!=null&&ns(r.type)?o||"":null;default:return null}}function rFe(o){return Qi.getInstance().getItem(o)||Fi.getInstance().getItem(o)||vi.getInstance().getItem(o)}function iFe(){let o=new Array;function t(e){for(let r of e)r.layerId==11&&o.push(r)}return t(Qi.getInstance().getAllItem()),t(Fi.getInstance().getAllItem()),t(vi.getInstance().getAllItem()),o}function nFe(){let o=new Array;function t(e){for(let r of e)r.type=="Slot Region"&&o.push(r)}return t(Qi.getInstance().getAllItem()),t(Fi.getInstance().getAllItem()),t(vi.getInstance().getAllItem()),o}var dx=class o extends cd{constructor(t){super(),this._connects=t}get connects(){return this._connects||[]}set connects(t){this._connects=t}get type(){return this._connects?1:0}toJSON(){return{connects:this.connects}}clone(){return new o(this.connects)}};var Dh=class o extends cd{constructor(t){super(),this.name=t}get name(){return this._name}set name(t){this._name=t}modifyName(t){this.watcher!=null&&!this.watcher.modifyName(this,t)||(this._name=t)}toJSON(){return{name:this.name}}clone(){return new o(this.name)}};var ml=class o extends cd{constructor(t,e,r,i=0){super(),this.type=t,this.stretchLength=e,this.lineId=r,this.belong=i}get lineId(){return this._baseLineId}set lineId(t){this._baseLineId=t}get type(){return this._type}set type(t){this._type=t}get stretchLength(){return this._stretchLength}set stretchLength(t){this._stretchLength=t}get belong(){return this._belong}set belong(t){o.getBelongOptions().some(r=>r.value===t)?this._belong=t:this._belong=0}static getBelongOptions(){return[{text:"Auto",value:0},{text:"Upper shell",value:1},{text:"Lower shell",value:2}]}toJSON(){return{type:this.type,lineId:this.lineId,stretchLength:this.stretchLength,belong:this.belong}}clone(){let t=new o(this.type,this.stretchLength,this.lineId);return t.belong=this.belong,t}};var oFe=[4,8,16],wh=class o extends cd{constructor(t,e,r,i){super(),this._type=t,this._slotDepth=e,this._slotOption=r,this._baseLineId=i}syncLatestData(){var t;(t=this.watcher)==null||t.syncLatestData(this)}get lineId(){return this._baseLineId}set lineId(t){this._baseLineId=t,this.syncLatestData()}get type(){return this._type}set type(t){this._type=t,this.syncLatestData()}get slotDepth(){return this._slotDepth}set slotDepth(t){this._slotDepth=t,this.syncLatestData()}get slotOption(){return this._slotOption}set slotOption(t){this._slotOption=t,this.syncLatestData()}updateSlotOption(t,e=!0){let r=new Set(this.slotOption);e?r.add(t):r.delete(t),this.slotOption=Array.from(r)}getShowType(){switch(this.type){case"Top":return"Top/Bottom Slot Region";case"Side":return"Side Slot Region"}}toJSON(){return{type:this.type,lineId:this.lineId,slotDepth:this.slotDepth,slotOption:this.slotOption}}clone(){return new o(this.type,this.slotDepth,this.slotOption,this.lineId)}};var xn=class o extends cd{constructor(e,r,i,n,s,a,l,c=.8){super();this._copperResult=new Array(0);this._style=e,this._gridLineWidth=r,this._clearance=i,this._keepIsland=n,this._optimization=s,this._name=a,this._order=l,this._optimizationValue=c}syncLatestData(){var e;(e=this.watcher)==null||e.syncLatestData(this)}get style(){return this._style}set style(e){this._style=e,this.syncLatestData()}get gridLineWidth(){return this._gridLineWidth}set gridLineWidth(e){e=oo(e),this._gridLineWidth=e,this.syncLatestData()}get clearance(){return this._clearance}set clearance(e){this._clearance=e,this.syncLatestData()}get keepIsland(){return this._keepIsland}set keepIsland(e){this._keepIsland=e,this.syncLatestData()}get optimization(){return this._optimization}set optimization(e){this._optimization=e,this.syncLatestData()}set optimizationValue(e){this._optimizationValue=e,this.syncLatestData()}get optimizationValue(){return this._optimizationValue}set order(e){this._order=e}get order(){return this._order}get copperResult(){return this._copperResult}set copperResult(e){this._copperResult=e}get name(){return this._name}set name(e){this._name=e}modifyName(e){this.watcher!=null&&!this.watcher.modifyName(this,e)||(this._name=e)}toJSON(){return{style:this._style,gridLineWidth:this._gridLineWidth,clearance:this._clearance,keepIsland:this._keepIsland,optimization:this._optimization,name:this._name,optimizationValue:this._optimizationValue,order:this._order}}clone(){return new o(this.style,this.gridLineWidth,this.clearance,this.keepIsland,this.optimization,this.name,this.order,this._optimizationValue)}};var Fu=class o extends cd{constructor(t,e,r,i,n){super(),this._device=t,this._track=e,this._copper=r,this._fill=i,this._planzone=n}syncLatestData(){var t;(t=this.watcher)==null||t.syncLatestData(this)}get device(){return this._device}set device(t){this._device=t,this.syncLatestData()}get track(){return this._track}set track(t){this._track=t,this.syncLatestData()}get copper(){return this._copper}set copper(t){this._copper=t,this.syncLatestData()}get fill(){return this._fill}set fill(t){this._fill=t,this.syncLatestData()}get planzone(){return this._planzone}set planzone(t){this._planzone=t,this.syncLatestData()}toJSON(){return{device:this._device,track:this._track,copper:this._copper,fill:this._fill,planzone:this._planzone}}clone(){return new o(this.device,this.track,this.copper,this.fill,this.planzone)}};var Sb=class o extends cd{constructor(t){super(),this._connects=t}get connects(){return this._connects}set connects(t){this._connects=t}toJSON(){return{connects:this.connects}}clone(){return new o(this.connects)}};var S0=class extends In{getShapeInfo(t){if(t instanceof yo)return P2(0,t);if(t instanceof Za)return P2(1,t);if(t instanceof ss){let e=t.getMathGraphics(t.layerId,0);return P2(2,{pl:e})}}};function P2(o,t){if(o===0){let e=t,r=e.center,i=e.radius;return[["CIRCLE",ve(r.x*10,4),ve(r.y*10,4),ve(i*10,4)]]}else if(o===1){let e=t,r=e.start,i=e.width,n=e.height;return[["R",ve(r.x*10,4),ve(r.y*10,4),ve(i*10,4),ve(n*10,4),ve(e.rotation/Math.PI*180,4),ve(e.radius*10,4)]]}else if(o===2){let r=t.pl;if(r instanceof Bt){let i=[];for(let n of r.items)i.push(o1(n,10));return i}else return[o1(r,10)]}}var LY=class{get mainId(){return this._mainId}get relatedIds(){return this._relatedIds}constructor(t,e=new Set){this._mainId=t,this._relatedIds=e}deleteRelatedId(t){this.relatedIds.delete(t)}addRelatedId(t){this.relatedIds.add(t)}clear(){this._mainId=null,this._relatedIds=null}toJSON(){return{mainId:this.mainId,relatedIds:Array.from(this.relatedIds)}}};var bM=class bM extends Ei{static getInstance(){return bM.manager==null&&(bM.manager=new bM),bM.manager}constructor(){super()}delConnect(t){let e=this.map.get(t);e&&(e.clear(),this.map.delete(t))}addConnectRelatedId(t,e){t==""||t==null||(this.map.has(t)||this.map.set(t,new LY(t)),this.map.get(t).addRelatedId(e))}modifyMainID(t,e,r){var i;t!=e&&((i=this.map.get(t))==null||i.deleteRelatedId(r),e!=""&&e!=null&&this.addConnectRelatedId(e,r))}delConnectRelatedId(t,e){let r=this.map.get(t);r instanceof LY&&(r.deleteRelatedId(e),r.relatedIds.size===0&&this.delConnect(r.mainId))}};bM.manager=null;var La=bM;var Vte=class Vte{static createId(){return"l"+Vte.id++}};Vte.id=0;var uB=Vte,Gte=class Gte{static createId(){return"a"+Gte.id++}};Gte.id=0;var Fte=Gte;var Vu=class extends Zp{constructor(){super()}parseShapeModel(t,e,r,i,n,s,a){if(i=ru(i,r,e),a=a[0]instanceof Array?a:[a],a.length==1&&a[0].length==0)return;let l=new Array;for(let h of a)if(h[0]=="CIRCLE"||h[0]=="C"){let u=new S(parseFloat(h[1])/10,parseFloat(h[2])/10),d=parseFloat(h[3])/10;return this.resultNeedToBeCached?Fi.getInstance().addCircle(t,e,r,u,d,s,n,i):new Ip(t,e,r,u,d,s,n,i,null,null)}else if(h[0]=="R"){let u=new S(parseFloat(h[1])/10,parseFloat(h[2])/10),d=parseFloat(h[3])/10,p=parseFloat(h[4])/10,m=parseFloat(h[5])/180*Math.PI;isNaN(m)&&(m=0);let g=(parseFloat(h[6])||0)/10;return this.resultNeedToBeCached?Qi.getInstance().addRect(t,e,r,u,d,p,i,n,s,m,g):new Sp(t,e,r,u,d,p,m,g,i,s,n,null,null)}else{let u=new S(parseFloat(h[0])/10,parseFloat(h[1])/10),d=new Yn,p=new Tn,m=!1,g={layerId:r,strokeWidth:s,locked:n};for(let P=2,T=h.length;P<T;){let I=typeof h[P]=="number";if(h[P]=="L"||I&&m){let C=I?P:P+1,E=new S(parseFloat(h[C])/10,parseFloat(h[C+1])/10),O=this.index+uB.createId(),_=new wc(O,u,E,g);p.addLast(_),u=E,P=C+2,m=!0}else if(h[P]=="ARC"||h[P]=="CARC"||I&&!m){m=!1;let C=I?P:P+1,E=parseFloat(h[C])/180*Math.PI,O=new S(parseFloat(h[C+1])/10,parseFloat(h[C+2])/10);if(ne.greater(zt.regular(E),0)&&!u.equals1(O)){let{center:_,radius:x,startAngle:v,endAngle:D,sweep:w}=d.pointToAngle(u,O,E),F=null;h[P]=="ARC"?F=1:F=2;let H=this.index+Fte.createId(),z=new zc(H,_,x,v,D,w,g,F);p.addLast(z)}u=O,P=C+3}else throw Error("wrong path for poly")}let y=p.toArray();p.clear();let b=0;for(let P of y)if(b+=P.length,b>1e-8)break;if(b<1e-8||r!=11&&Bu(e)&&!Qh(y.map(P=>P.primitive),1e-4))if($Be(y.map(P=>P.primitive)))y[y.length-1].end=y[0].start;else{for(let P of y)P.remove();return null}y.length>0&&l.push(y)}let c=this.resultNeedToBeCached?vi.getInstance().addPolygon(t,e,r,l,s,i,n,null,null):new Ep(t,e,r,l,s,i,n,null,null);return c.type=="Board Outline"&&!c.isClose()&&(c.type="Line"),c}parseShapeModelSimplify(t,e,r,i,n,s,a){if(a=a[0]instanceof Array?a:[a],a.length==1&&a[0].length==0)return;i=ru(i,r,e);let l=a[0][0];if(l=="CIRCLE"||l=="C"){let p=a[0],m=new S(parseFloat(p[1])/10,parseFloat(p[2])/10),g=parseFloat(p[3])/10;return this.resultNeedToBeCached?Fi.getInstance().addCircle(t,e,r,m,g,s,n,i):new Ip(t,e,r,m,g,s,n,i,null,null)}if(l=="R"){let p=a[0],m=new S(parseFloat(p[1])/10,parseFloat(p[2])/10),g=parseFloat(p[3])/10,y=parseFloat(p[4])/10,b=parseFloat(p[5])/180*Math.PI;isNaN(b)&&(b=0);let P=(parseFloat(p[6])||0)/10;return this.resultNeedToBeCached?Qi.getInstance().addRect(t,e,r,m,g,y,i,n,s,b,P):new Sp(t,e,r,m,g,y,b,P,i,s,n,null,null)}let c=new Array;for(let p of a){let m=new S(parseFloat(p[0])/10,parseFloat(p[1])/10),g=new Yn,y=!1,b=new Array;for(let T=2,I=p.length;T<I;)if(p[T]=="L"){let C=new S(parseFloat(p[T+1])/10,parseFloat(p[T+2])/10),E=new M(m,C);b.push(E),m=C,T+=3,y=!0}else if(p[T]=="ARC"||p[T]=="CARC"){y=!1;let C=parseFloat(p[T+1])/180*Math.PI,E=new S(parseFloat(p[T+2])/10,parseFloat(p[T+3])/10);if(ne.greater(zt.regular(C),0)&&!m.equals1(E)){let{center:O,radius:_,startAngle:x,endAngle:v,sweep:D}=g.pointToAngle(m,E,C);x=zt.toDegrees(x),v=zt.toDegrees(v);let w=p[T]=="ARC"?q.build2(O,x,v,_,_,D):m9.build2(O,x,v,_,_,D);b.push(w)}m=E,T+=4}else if(y){let C=new S(parseFloat(p[T])/10,parseFloat(p[T+1])/10),E=new M(m,C);b.push(E),m=C,T+=2}let P=0;for(let T of b)if(P+=T.length(),P>1e-8)break;(P<1e-8||r!=11&&Bu(e)&&!Qh(b,1e-4))&&(b.length=0),b.length>0&&c.push(b)}if(c.length==0)return;let h=[];c.forEach(p=>{h.push(ge.build2(p))});let u=h.length==1?h[0]:new Bt(h),d=this.resultNeedToBeCached?vi.getInstance().addPolygon(t,e,r,[],s,i,n,null,null,null,u):new Ep(t,e,r,[],s,i,n,null,null,null,u);return d.type=="Board Outline"&&!d.isClose()&&(d.type="Line"),d}loadType(t){this.model.type!=t&&(this.model.type=t)}loadNet(t){t=ru(t,this.model.layerId,this.model.type),this.model.net!=t&&(this.netModifyInter!=null&&this.netModifyInter.addNetModify(this.model.net,this.model),this.model.net=t)}loadWidth(t){!isNaN(t)&&this.model.strokeWidth!=t&&(this.model.strokeWidth=t)}loadPath(t){if(t=t[0]instanceof Array?t:[t],!(t.length==1&&t[0].length==0)){if(JSON.stringify(this.getShapeInfo(this.model))!=JSON.stringify(t)){let e=new Array,{globalIndex:r,layerId:i,net:n,strokeWidth:s,locked:a,type:l}=this.model;for(let c of t)if(c[0]=="CIRCLE"||c[0]=="C"){let h=new S(parseFloat(c[1])/10,parseFloat(c[2])/10),u=parseFloat(c[3])/10;this.model instanceof yo?(this.model.center=h,this.model.radius=u):(this.resultNeedToBeCached||(this.model=new Ip(r,l,i,h,u,s,a,n,null,null)),this.model=Fi.getInstance().addCircle(r,l,i,h,u,s,a,n));return}else if(c[0]=="R"){let h=new S(parseFloat(c[1])/10,parseFloat(c[2])/10),u=parseFloat(c[3])/10,d=parseFloat(c[4])/10,p=parseFloat(c[5])/180*Math.PI;isNaN(p)&&(p=0);let m=(parseFloat(c[6])||0)/10;this.model instanceof Za?(this.model.start=h,this.model.width=u,this.model.height=d,this.model.rotation=p,this.model.radius=m):(this.resultNeedToBeCached||(this.model=new Sp(r,l,i,h,u,d,p,m,n,s,a,null,null)),this.model=Qi.getInstance().addRect(r,l,i,h,u,d,n,a,s,p,m));return}else{let h=new S(parseFloat(c[0])/10,parseFloat(c[1])/10),u=new Yn,d=new Tn,p=!1,m={layerId:i,strokeWidth:s,locked:a};for(let b=2,P=c.length;b<P;){let T=typeof c[b]=="number";if(c[b]=="L"||T&&p){let I=T?b:b+1,C=new S(parseFloat(c[I])/10,parseFloat(c[I+1])/10),E=I+uB.createId(),O=new wc(E,h,C,m);d.addLast(O),h=C,b=I+2,p=!0}else if(c[b]=="ARC"||c[b]=="CARC"||T&&!p){p=!1;let I=T?b:b+1,C=parseFloat(c[I])/180*Math.PI,E=new S(parseFloat(c[I+1])/10,parseFloat(c[I+2])/10);if(ne.greater(zt.regular(C),0)&&!h.equals1(E)){let{center:O,radius:_,startAngle:x,endAngle:v,sweep:D}=u.pointToAngle(h,E,C),w=null;c[b]=="ARC"?w=1:w=2;let F=I+uB.createId(),H=new zc(F,O,_,x,v,D,m,w);d.addLast(H)}h=E,b=I+3}else throw Error("wrong path for poly")}let g=d.toArray();d.clear();let y=0;for(let b of g)if(y+=b.length,y>1e-8)break;if(y<1e-8||i!=11&&Bu(l)&&!Qh(g.map(b=>b.primitive),1e-4)){for(let b of g)b.remove();return null}g.length>0&&e.push(g)}if(this.model instanceof ss){let c=this.model.childrens;for(let h of c)for(let u of h)u.remove();this.model.childrens=e}else this.model=this.resultNeedToBeCached?vi.getInstance().addPolygon(r,l,i,e,s,n,a,null,null):new Ep(r,l,i,e,s,n,a,null,null)}this.model instanceof ss&&(this.model.isSimplify&&this.model.refreshOutlineByChildren(),this.model.type=="Board Outline"&&!this.model.isClose()&&this.loadType("Line"))}}loadPourOrder(t,e){if(e!=null){let r=this.model.component;r instanceof xn&&(r.order=e)}}loadComponent(t){this.model.component instanceof dx&&t instanceof dx?this.model.component.connects=Array.from(t.connects):this.model.component instanceof Dh&&t instanceof Dh?this.model.component.name=t.name:this.model.component instanceof ml&&t instanceof ml?(La.getInstance().modifyMainID(this.model.component.lineId,t.lineId,this.model.globalIndex),this.model.component.type=t.type,this.model.component.stretchLength=t.stretchLength,this.model.component.lineId=t.lineId,this.model.component.belong=t.belong):this.model.component instanceof y0&&t instanceof y0?(this.model.component.shellHeight=t.shellHeight,this.model.component.substrateHeight=t.substrateHeight,this.model.component.shellThickness=t.shellThickness,this.model.component.botShellHeight=t.botShellHeight,this.model.component.topInnerHeight=t.topInnerHeight,this.model.component.bottomInnerHeight=t.bottomInnerHeight,this.model.component.pushCoverDir=t.pushCoverDir):this.model.component instanceof Rf&&t instanceof Rf?(this.model.component.specification=t.specification,this.model.component.height=t.height,this.model.component.thickness=t.thickness,this.model.component.holeDiameter=t.holeDiameter,this.model.component.counterboreProps=t.counterboreProps,this.model.component.stiffenerProps=t.stiffenerProps):this.model.component instanceof wh&&t instanceof wh?(La.getInstance().modifyMainID(this.model.component.lineId,t.lineId,this.model.globalIndex),this.model.component.slotDepth=t.slotDepth,this.model.component.lineId=t.lineId,this.model.component.type=t.type,this.model.component.slotOption=t.slotOption):this.model.component instanceof tu&&t instanceof tu?(this.model.component.material=t.material,this.model.component.fpcModel=t.fpcModel,this.model.component.thickness=t.thickness):this.model.component instanceof xn&&t instanceof xn?(this.model.component.style=t.style,this.model.component.gridLineWidth=t.gridLineWidth,this.model.component.clearance=t.clearance,this.model.component.keepIsland=t.keepIsland,this.model.component.optimization=t.optimization,this.model.component.name=t.name,this.model.component.optimizationValue=t.optimizationValue,this.model.component.order=t.order):this.model.component instanceof ac&&t instanceof ac?(this.model.component.name=t.name,this.model.component.fileUuid=t.fileUuid):this.model.component instanceof Fu&&t instanceof Fu?(this.model.component.device=t.device,this.model.component.track=t.track,this.model.component.copper=t.copper,this.model.component.fill=t.fill,this.model.component.planzone=t.planzone):this.model.component instanceof Zi&&t instanceof Zi?(La.getInstance().modifyMainID(this.model.component.padId,t.padId,this.model.globalIndex),this.model.component.padId=t.padId,this.model.component.isBridgingCopper=t.isBridgingCopper,this.model.component.networkList=t.networkList):this.model.component instanceof Sb&&t instanceof Sb?this.model.component.connects=Array.from(t.connects):(this.model.component instanceof Zi?La.getInstance().delConnectRelatedId(this.model.component.padId,this.model.globalIndex):this.model.component instanceof ml||this.model.component instanceof wh?La.getInstance().delConnectRelatedId(this.model.component.lineId,this.model.globalIndex):this.model.component instanceof Sb,t instanceof Zi?La.getInstance().addConnectRelatedId(t.padId,this.model.globalIndex):this.model.component instanceof ml||this.model.component instanceof wh?La.getInstance().addConnectRelatedId(this.model.component.lineId,this.model.globalIndex):t instanceof Sb,this.model.component=t)}getShapeInfo(t){if(t instanceof yo)return P2(0,t);if(t instanceof Za)return P2(1,t);if(t instanceof ss){let e=t.getMathGraphics(t.layerId,0);return P2(2,{pl:e})}}};var dB=class extends Vu{clearGroupId(){this.groupId=null}changeNet4Map(t){let e=t.get(this.net);e!=null&&(this.net=e)}feed(t){let{id:e,partitionId:r,groupId:i,netName:n,layerId:s,width:a,path:l,locked:c,zIndex:h,number:u,specialColor:d,polyType:p}=t;this.index=e,this.partition=r,this.groupId=Ca(i),this.net=n,this.zIndex=h,this.number=u,this.isNumber(s)&&(this.layerId=s),this.isNumber(a)&&(this.width=a/10),this.path=l,this.locked=c,d&&(this.specialColor=ee.of3(d)),p!=null?this.type=Z8e(p):(this.type="Line",ub(this.layerId)&&(this.type="Board Outline"))}check(){return!(!this.index||this.groupId===void 0||!this.layerId||this.resultNeedToBeCached&&!this.keepDisabledLayerItem&&!Ze.getInstance().isValidLayer(this.layerId)||this.width==null||isNaN(this.width)||this.width<=0||this.path==null||this.locked==null)}polyCheck(){return!(this.index==null||this.layerId==null||this.layerId==1002||this.width==null||this.path==null||this.locked==null)}finish(){try{if(this.polyCheck()){let t=this.parseShapeModel(this.index,this.type,this.layerId,this.net,this.locked,this.width,this.path);return t==null?null:(this.groupId!=null&&t.setGroupID(this.groupId),this.partition&&(t.partition=this.partition),this.specialColor!=null&&(t.silkColor=this.specialColor),this.isNumber(this.zIndex)&&(t.zIndex=this.zIndex),this.isNumber(this.number)&&(t.number=this.number),t)}else return null}catch(t){console.log(t)}}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId),this.loadType(this.type),this.loadLayerId(this.layerId),this.loadWidth(this.width),this.partition!==void 0&&this.loadNet(this.net),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadPath(this.path),this.loadSpecialColor(this.specialColor)}loadSpecialColor(t){(this.model.silkColor!=t&&(this.model.silkColor==null||t==null)||this.model.silkColor!=null&&t!=null&&!this.model.silkColor.equals(t))&&(this.model.silkColor=t)}};var PM=class PM extends Ei{constructor(){super(...arguments);this.layerMapSet={}}static getInstance(){return PM.manager==null&&(PM.manager=new PM),PM.manager}addModel(e){this.map.set(e.globalIndex,e);let r=this.layerMapSet[e.layerId];r==null&&(r=new Set,this.layerMapSet[e.layerId]=r),r.add(e)}add(e,r,i,n,s){return this._last=new yn(e,r,i,n,s,!1,void 0),this.addModel(this._last),this._last}delete(e,r){if(e instanceof yn){let i=this.layerMapSet[e.layerId];i&&i.delete(e),this.map.delete(r)}}};PM.manager=null;var Xo=PM;var px=class extends Vu{clearGroupId(){this.groupId=null}isPlane(){return this.fillStyle==2}changeNet4Map(t){let e=t.get(this.net);e!=null&&(this.net=e)}feed(t){let{id:e,partitionId:r,groupId:i,netName:n,layerId:s,width:a,fillStyle:l,path:c,locked:h,zIndex:u,number:d,isBridgingCopper:p,networkList:m,refs:g,specialColor:y}=t;this.index=e,this.partition=r,this.groupId=Ca(i),this.net=n,this.zIndex=u,this.number=d,this.isNumber(s)&&(this.layerId=s),this.isNumber(a)&&(this.width=a/10),this.fillStyle=this.getFillType(l),this.path=c,this.locked=h,this.isBridgingCopper=p,this.networkList=m||[],g&&(this.refs=g),y&&(this.specialColor=ee.of3(y))}getFillType(t){switch(t){case ob.SOLID:return 0;case ob.GRID:return 1;case ob.PLANE:return 2}}check(){var t;return!(this.index==null||this.groupId===void 0||this.layerId==null||this.resultNeedToBeCached&&!this.keepDisabledLayerItem&&!Ze.getInstance().isValidLayer(this.layerId)||this.width==null||isNaN(this.width)||this.width<0||this.path==null||!((t=this.path)!=null&&t.length)||this.locked==null||this.isBridgingCopper&&this.networkList==null||this.fillStyle==null)}getComponent(){let t=new Zi("",this.isBridgingCopper,this.networkList);return z9(this.layerId)&&this.refs!=null&&this.refs.length>0&&(t.padId=this.refs[0]),t}finish(){if(this.check())if(this.fillStyle==0){let t="Fill Region";ar(this.layerId)&&(t="Slot Region");let e=this.parseShapeModel(this.index,t,this.layerId,this.net,this.locked,this.width,this.path);if(e==null)return null;if(e.type=="Fill Region"){let r=this.getComponent();this.resultNeedToBeCached&&r.padId!=""&&La.getInstance().addConnectRelatedId(r.padId,e.globalIndex),e.component=r}return this.specialColor!=null&&(e.silkColor=this.specialColor),this.groupId!=null&&e.setGroupID(this.groupId),this.partition&&(e.partition=this.partition),this.isNumber(this.zIndex)&&(e.zIndex=this.zIndex),this.isNumber(this.number)&&(e.number=this.number),e}else if(mu(Ze.getInstance().getLayer(this.layerId).type)){let t=this.toFix(this.path,10),e=Xo.getInstance().add(this.index,this.layerId,this.net,this.fillStyle==2,t);return this.groupId!=null&&e.setGroupID(this.groupId),this.isNumber(this.zIndex)&&(e.zIndex=this.zIndex),this.isNumber(this.number)&&(e.number=this.number),e}else return null;else return null}loadPlanePath(t,e){let r=this.toFix(e,10);JSON.stringify(t.source)!==JSON.stringify(r)&&(t.pls=Jh(r))}load(){if(this.fillStyle==0){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId),this.loadLayerId(this.layerId);let t="Fill Region";ar(this.layerId)&&(t="Slot Region"),this.loadType(t);let e=t=="Fill Region"?this.getComponent():null;this.loadComponent(e),this.partition!==void 0&&this.loadNet(this.net),this.loadWidth(this.width),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadPath(this.path),this.loadSpecialColor(this.specialColor)}else{let t=Xo.getInstance().getItem(this.index);t&&(this.loadLayerId(this.layerId),this.partition!==void 0&&this.loadPlaneNet(this.net),this.loadPlanePath(t,this.path))}}loadPlaneNet(t){this.model.net!=t&&(this.netModifyInter!=null&&this.netModifyInter.addNetModify(this.model.net,this.model),this.model.net=t)}loadSpecialColor(t){(this.model.silkColor!=t&&(this.model.silkColor==null||t==null)||this.model.silkColor!=null&&t!=null&&!this.model.silkColor.equals(t))&&(this.model.silkColor=t)}toFix(t,e=1){let r=t.length,i=new Array(r),n="",s=null,a=null,l=null,c=0,h=0;for(;c<r;c++){s=t[c],a=s.length;let u=new Array(a);for(h=0;h<a;h++)l=s[h],n=typeof l,n==="number"?u[h]=l/e:u[h]=l;i[c]=u}return i}};var pB=class extends Vu{constructor(){super(...arguments);this.fpcModel=null}feed(e){let{id:r,partitionId:i,groupId:n,layerId:s,material:a,thickness:l,path:c,locked:h,zIndex:u,number:d}=e;this.index=r,this.partition=i,this.groupId=Ca(n),this.zIndex=u,this.number=d,this.isNumber(s)&&(this.layerId=s);let p=w8e(a);p==="3M468"||p==="3M9077"||p==="TESA8854"?(this.material="Tape",this.fpcModel=p):p==="Polyimide"||p==="FR4"||p==="Stainless Steel"||p==="EMI Shielding Film"?(this.material=p,this.fpcModel=null):(this.material="Polyimide",this.fpcModel=null),this.thickness=l,this.path=c,this.locked=h}clearGroupId(){this.groupId=null}check(){return!(!this.index||this.groupId===void 0||!this.layerId||this.path==null||this.locked==null)}getComponent(){return new tu(this.material,this.fpcModel,this.thickness)}finish(){if(this.check()){let e=this.parseShapeModel(this.index,"FPC Stiffener",this.layerId,"",this.locked,1,this.path);return e==null?null:(this.partition&&(e.partition=this.partition),this.isNumber(this.zIndex)&&(e.zIndex=this.zIndex),this.isNumber(this.number)&&(e.number=this.number),e.component=this.getComponent(),e.setGroupID(this.groupId),e)}else return null}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId);let e=this.getComponent();this.loadType("FPC Stiffener"),this.loadLayerId(this.layerId),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadPath(this.path),this.loadComponent(e)}};var fB=class extends Vu{constructor(){super(...arguments);this.isConstraint=!1;this.track=!1;this.copper=!1;this.component=!1;this.fill=!1;this.planzone=!1}feed(e){let{id:r,partitionId:i,groupId:n,layerId:s,width:a,prohibitType:l,path:c,locked:h,zIndex:u,name:d,number:p,regionType:m}=e;this.index=r,this.partition=i,this.groupId=Ca(n),this.zIndex=u,this.number=p,this.isNumber(s)&&(this.layerId=s),this.isNumber(a)&&(this.width=a/10),this.parseType(l),this.isConstraint=m==EN.CONSTRAINT,this.path=c,this.locked=h,this.name=d}clearGroupId(){this.groupId=null}parseType(e){if(e!=null&&Array.isArray(e))for(let r of e)switch(r){case CP.COMPONENT:this.component=!0;break;case CP.TRACK:this.track=!0;break;case CP.FILL:this.fill=!0;break;case CP.COPPER:this.copper=!0;break;case CP.PLANE:this.planzone=!0;break}}check(){return!(!this.index||this.groupId===void 0||!this.layerId||this.resultNeedToBeCached&&!this.keepDisabledLayerItem&&!Ze.getInstance().isValidLayer(this.layerId)||this.width==null||isNaN(this.width)||this.width<=0||this.path==null||this.locked==null)}regionCheck(){return!(this.index==null||this.layerId==null||this.width==null||this.path==null||this.locked==null)}getTypeAndComponent(){let e,r;return this.isConstraint?(e="Constraint Region",r=new Dh(this.name)):(e="Prohibited Region",r=new Fu(this.component,this.track,this.copper,this.fill,this.planzone)),{type:e,componentModel:r}}finish(){if(this.regionCheck()){Array.isArray(this.path)&&Array.isArray(this.path[0])&&(this.path=this.path[0]);let{type:e,componentModel:r}=this.getTypeAndComponent(),i=this.parseShapeModel(this.index,e,this.layerId,"",this.locked,this.width,this.path);return i==null?null:(this.partition&&(i.partition=this.partition),this.isNumber(this.zIndex)&&(i.zIndex=this.zIndex),this.isNumber(this.number)&&(i.number=this.number),i.component=r,i.setGroupID(this.groupId),i)}else return null}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId);let{type:e,componentModel:r}=this.getTypeAndComponent();this.loadType(e),this.loadLayerId(this.layerId),this.loadWidth(this.width),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadPath(this.path),this.loadComponent(r)}};var mB=class extends Vu{feed(t){let{id:e,name:r,fileUuid:i,path:n}=t;this.index=e,this.name=r,this.fileUuid=i||"",this.path=n}check(){return!(!this.index||!this.name||this.path==null)}finish(){if(this.check()){R.getInstance().id==this.fileUuid&&(R.getInstance().partitionId=this.index),Array.isArray(this.path)&&Array.isArray(this.path[0])&&(this.path=this.path[0]);let t="Partition",e=new ac(this.name);e.fileUuid=this.fileUuid,e.name=this.name;let r=this.parseShapeModel(this.index,t,1004,"",!1,.1,this.path);return r==null?null:(r.component=e,r)}else return null}getComponent(){return new ac(this.name)}loadPartition(t,e){R.getInstance().id==t&&R.getInstance().partitionId!=e&&(R.getInstance().partitionId=e)}load(){this.loadPartition(this.fileUuid,this.index),this.loadPourOrder(this.layerId);let t=this.getComponent();t.fileUuid=this.fileUuid,this.loadPath(this.path),this.loadComponent(t)}};var gB=class extends Vu{constructor(){super(...arguments);this.order=0}addCopperDecode(e){this.coppers=e}clearCopperDecode(){this.coppers=null}feed(e){let{id:r,partitionId:i,groupId:n,netName:s,layerId:a,width:l,name:c,order:h,path:u,pourType:d,keepIsland:p,locked:m,zIndex:g,number:y}=e;this.index=r,this.partition=i,this.groupId=Ca(n),this.net=s,this.zIndex=g,this.number=y,this.isNumber(a)&&(this.layerId=a),this.isNumber(l)&&(this.width=l/10),this.name=c,this.isNumber(h)&&(this.order=h),this.path=u,this.type=d,this.keepIsland=p,this.locked=m}clearGroupId(){this.groupId=null}changeNet4Map(e){let r=e.get(this.net);r!=null&&(this.net=r)}check(){return!(!this.pourcheck()||this.groupId===void 0||this.width==null||isNaN(this.width)||this.width<=0)}pourcheck(){if(this.index==null||this.net==null||this.layerId==null||this.resultNeedToBeCached&&!this.keepDisabledLayerItem&&!Ze.getInstance().isSignalLayer(this.layerId)||this.width==null||this.path==null||this.locked==null||this.name==null||this.type==null||this.keepIsland==null||this.path==null)return!1;if(Array.isArray(this.path)){let e=[];for(let r of this.path)r!=null&&r.length>0&&e.push(r);if(e.length>0)this.path=e;else return!1}return!0}getComponent(){let e={};if(e.name=this.name,e.keepIsland=this.keepIsland,e.gridLineWidth=1,e.clearance=2,this.type.pourType===CN.SOLID){e.style="solid",e.optimization=this.type.fineness!=0;let p=parseFloat(this.type.fineness)/10;e.optimizationValue=p}else{this.type.angle==0?e.style="90grid":e.style="45grid";let m=this.type.strokeWidth/10,g=this.type.strokeSpacing/10;e.gridLineWidth=m,e.clearance=g}let{style:i,gridLineWidth:n,clearance:s,keepIsland:a,optimization:l,name:c,optimizationValue:h}=e,u=h;return u==0&&(u=.8),new xn(i,n,s,a,l,c,this.order,u)}finish(){var e;if(this.pourcheck()){Array.isArray(this.path)&&Array.isArray(this.path[0])&&(this.path=this.path[0]);let r=this.parseShapeModel(this.index,"Copper Region",this.layerId,this.net,this.locked,this.width,this.path);return r==null?null:(r.component=this.getComponent(),this.groupId!=null&&r.setGroupID(this.groupId),this.partition&&(r.partition=this.partition),this.isNumber(this.zIndex)&&(r.zIndex=this.zIndex),this.isNumber(this.number)&&(r.number=this.number),(e=this.coppers)==null||e.finish1(r),this.clearCopperDecode(),r)}else return null}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId,this.order);let e=this.getComponent();this.loadType("Copper Region"),this.loadLayerId(this.layerId),this.partition!==void 0&&this.loadNet(this.net),this.loadWidth(this.width),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadPath(this.path),this.loadComponent(e)}};var TM=class TM extends Ei{static getInstance(){return TM.manager==null&&(TM.manager=new TM),TM.manager}addModel(t){return this.map.set(t.globalIndex,t),t}addCopper(t,e,r,i,n,s,a,l,c=!1,h=.8){return this._last=new hn(t,e,r,i,n,s,a,l,c,void 0,h),this.addModel(this._last),this._last}delete(t,e){if(t instanceof or||t instanceof hn){this.map.delete(e);let r=t.getParent();r!=null&&r instanceof or&&r.deleteCopper(e)}}};TM.manager=null;var qo=TM;var Hte=class extends Zp{constructor(){super(...arguments);this.coppers=[]}finish1(e){this.model=e;for(let r of this.coppers)r.finish1(e)}finish(){if(this.check())for(let e of this.coppers)e.finish()}check(){return!(!this.index||(this.model||(this.model=rFe(this.index),this.finish1(this.model)),!this.model))}feed(e){let{id:r,pourFill:i,number:n}=e,s;this.index=r;for(let a of i)s=new RIe,s.feed({...a,number:n}),this.coppers.push(s)}load(){}},RIe=class extends Zp{constructor(){super()}check(){return!(!this.index||!this.path)}feed(t){let{id:e,strokeWidth:r,fill:i,path:n,number:s}=t;this.index=e,this.number=s,this.strokeWidth=r,this.fill=i,this.path=n}finish1(t){this.profile=t}getStyleAndWidth(t,e){let r=t.gridLineWidth,i=t.style,{optimization:n,optimizationValue:s=.8}=t;return(i=="90grid"||i=="45grid")&&e==0&&(i="solid",n=!0,s=r,r=0),i=="solid"&&e!=0&&(i="90grid"),(i=="90grid"||i=="45grid")&&e!=0&&(r=e),{style:i,gridLineWidth:r,optimization:n,optimizationValue:s}}finish(){if(this.profile==null)return;let t=this.profile.component;if(!(t instanceof xn))return;let{style:e,gridLineWidth:r,optimization:i,optimizationValue:n}=this.getStyleAndWidth(t,this.strokeWidth);if(this.profile.addCopper(this.index),this.resultNeedToBeCached&&qo.getInstance().getItem(this.index)!=null)return;let{layerId:s,net:a}=this.profile,{clearance:l}=t,c=new hn(this.index,s,a,e,r,l,i,this.path,!1,null,n);return c.setParent(this.profile),this.isNumber(this.number)&&(c.number=this.number),this.resultNeedToBeCached&&qo.getInstance().addModel(c),c}loadNet(t){this.model.net!==t&&(this.netModifyInter!=null&&this.netModifyInter.addNetModify(this.model.net,this.model),this.model.net=t)}loadStyle(t){this.model.style!==t&&(this.model.style=t)}loadGridLineWidth(t){this.model.gridLineWidth!==t&&(this.model.gridLineWidth=t)}loadPath(t){JSON.stringify(this.model.copperPath)!==JSON.stringify(t)&&this.model.update(this.model.net,Jh(t))}load(){this.finish1(this.model.getParent()),this.loadLayerId(this.profile.layerId),this.loadNet(this.profile.net);let t=this.profile.component,{style:e,gridLineWidth:r}=this.getStyleAndWidth(t,this.strokeWidth);this.loadStyle(e),this.loadGridLineWidth(r),this.loadNumber(this.number),this.loadPath(this.path)}};var fx=class o extends Dl{constructor(e,r,i,n,s,a,l,c,h,u,d,p){super();this.modelType="Image";this._globalIndex=e,this._template=h,this._silkColor=d,this._start=i,this._width=n,this._height=s,this._rotation=a,this._mirror=l;let m=oc(r,l);if(!p){let g=Ae.translate(0,-s,0).rotateZ(a).scale(m?-1:1,1,1).translate1(i.x,i.y,0);p=new bs(r,S.ORIGIN,new S(0,s),new S(n,0),new S(n,s),c,u),p.transform(g),p.updateBox()}this.box=p}get silkColor(){return this._silkColor||void 0}set silkColor(e){this.silkColor!=e&&(e?this._silkColor=e:delete this._silkColor)}get template(){return this._template}set template(e){this._template=e,this.templateModified=!0}get templateModified(){return this.hasDataState(7)}set templateModified(e){this.setDataState(7,e)}clone(){this.refreshBBox&&this.updateBox();let e=new o(this.globalIndex,this.layerId,this.start,this.width,this.height,this.rotation,this.mirror,this.locked,this.template,this.bbox,this.silkColor);return e.number=this.number,e.zIndex=this.zIndex,e}getViewMatrix(){let e=new _e;this._template.forEach(l=>{e.ext1(l.bbox())});let r=e.build1(),i=Ae.translate(-r.UL().x,-r.UL().y,0),n=r.height(),s=r.width(),a=Ae.scale(this.width/s,this.height/n,1);return i.multiply4(a).multiply4(this.matrix)}getRealPath(){let e=this.getViewMatrix().toMatrix3();return this._template.map(r=>r.multiply3(e))}getPath(){let e=this.getViewMatrix(),r=this.getTemplatePath();return r.forEach(i=>{i.pl=i.pl.multiply3(e.toMatrix3())}),r}getPathByTemplatePath(e){let r=this.getViewMatrix(),i=e;return i=i.map(n=>n.clone()),i.forEach(n=>{n.pl=n.pl.multiply3(r.toMatrix3())}),i}getTemplatePath(){let e=this._template.map(n=>n.clone());return new wf("",0,e).pls}get matrix(){let e=oc(this.layerId,this.mirror);return Ae.rotateZ(this.rotation).scale(e?-1:1,1,1).translate1(this.start.x,this.start.y,0)}get layerId(){return this.box.layerId}set layerId(e){this.layerId!=e&&(this.watchLayerIdModify(this.layerId),this.box.layerId=e,this.reset4Matrix(this.matrix),this.layerModified=!0)}get start(){return this._start}set start(e){this._start!=e&&(this._start=e,this.reset4Matrix(this.matrix))}get width(){return this._width}set width(e){this._width!=e&&(this._width=e,this.reset4(this.width,this.height,this.matrix))}get height(){return this._height}set height(e){this._height!=e&&(this._height=e,this.reset4(this.width,this.height,this.matrix))}get rotation(){return this._rotation}set rotation(e){this._rotation!=e&&(this._rotation=e,this.reset4Matrix(this.matrix))}get mirror(){return this._mirror}set mirror(e){this._mirror!=e&&(this._mirror=e,this.reset4Matrix(this.matrix))}get center(){return this.box.center}set center(e){let r=e.sub(this.center),i=Ae.translate(r.x,r.y,0);this.transform(i)}get bbox(){return this.box.bbox}get locked(){return this.box.locked}set locked(e){this.box.locked=e}transform(e){let r=new S(e.data[0],e.data[1]).normalize(),i=Math.atan2(r.y,r.x);oc(this.layerId,this.mirror)?this.rotation-=i:this.rotation+=i,this.start=this.start.multiply4(e)}inShape(e,r,i){return this.box.inShape(e,r,i)}reset4Matrix(e){this.reset4(this.width,this.height,e)}reset4(e,r,i){this.box.leftUp=S.ORIGIN.multiply4(i),this.box.leftLow=new S(0,-r).multiply4(i),this.box.rightLow=new S(e,-r).multiply4(i),this.box.rightUp=new S(e,0).multiply4(i),this.updateShapeData()}updateBox(){return this.box.updateBox()}getMathGraphics(e=this.layerId,r){return this.isEmpty?null:this.box.getMathGraphics(e,r)}buildBBox(){return this.isEmpty?null:(this.refreshBBox&&(this.updateBox(),this.refreshBBox=!1),this.bbox)}};var IM=class IM extends Ei{static getInstance(){return IM.manager==null&&(IM.manager=new IM),IM.manager}addModel(t){this.map.set(t.globalIndex,t)}addImage(t,e,r,i,n,s,a,l,c,h){let u=new fx(t,e,r,i,n,s,a,l,c,void 0,h);return this.addModel(u),u}delete(t){t instanceof Dl&&this.map.delete(t.globalIndex)}};IM.manager=null;var Hs=IM;var yB=class extends Zp{loadStart(t){this.model.start.equals(t)||(this.model.start=t)}loadWidth(t){this.model.width!==t&&(this.model.width=t)}loadHeight(t){this.model.height!==t&&(this.model.height=t)}loadAngle(t){this.model.rotation!==t&&(this.model.rotation=t)}loadMirror(t){this.model.mirror!==t&&(this.model.mirror=t)}};var bB=class extends yB{constructor(){super();this.start=S.ORIGIN}feed(e){let{id:r,partitionId:i,groupId:n,layerId:s,startX:a,startY:l,width:c,height:h,angle:u,mirror:d,path:p,locked:m,zIndex:g,number:y,specialColor:b}=e;this.index=r,this.partition=i,this.groupId=Ca(n),this.zIndex=g,this.number=y,this.isNumber(s)&&(this.layerId=s),this.isNumber(c)&&(this.width=c/10),this.isNumber(a)&&this.isNumber(l)&&(this.start=new S(a/10,l/10)),this.isNumber(h)&&(this.height=h/10),this.isNumber(u)&&(this.angle=u/180*Math.PI),this.mirror=d,this.path=p,this.locked=m,b&&(this.specialColor=ee.of3(b))}clearGroupId(){this.groupId=null}check(){return!(!this.index||this.groupId===void 0||!this.layerId||this.resultNeedToBeCached&&!this.keepDisabledLayerItem&&!Ze.getInstance().isValidLayer(this.layerId)||((this.layerId==58||this.layerId==59)&&(this.layerId=1),this.width==null||isNaN(this.width)||this.width<=0)||this.height==null||isNaN(this.height)||this.height<=0||this.locked==null||this.angle==null||isNaN(this.angle))}finish(e=!1){if(!this.check())return null;let r=e?this.path:Jh(this.path),i=this.resultNeedToBeCached?Hs.getInstance().addImage(this.index,this.layerId,this.start,this.width,this.height,this.angle,this.mirror,this.locked,r):new fx(this.index,this.layerId,this.start,this.width,this.height,this.angle,this.mirror,this.locked,r);return this.groupId!=null&&i.setGroupID(this.groupId),this.partition&&(i.partition=this.partition),this.specialColor!=null&&(i.silkColor=this.specialColor),this.isNumber(this.zIndex)&&(i.zIndex=this.zIndex),this.isNumber(this.number)&&(i.number=this.number),i}loadPath(e){JSON.stringify(I0(this.model.template))!==JSON.stringify(e)&&(this.model.template=Jh(e))}load(){this.loadPartitionId(this.partition),this.loadLayerId(this.layerId),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadStart(this.start),this.loadWidth(this.width),this.loadHeight(this.height),this.loadAngle(this.angle),this.loadMirror(this.mirror),this.loadPath(this.path),this.loadSpecialColor(this.specialColor)}loadSpecialColor(e){(this.model.silkColor!=e&&(this.model.silkColor==null||e==null)||this.model.silkColor!=null&&e!=null&&!this.model.silkColor.equals(e))&&(this.model.silkColor=e)}};var Wte=class extends wl{get hashkey(){return this.name}feed(t){let{netName:e,netType:r,specialColor:i,retLine:n,differentialName:s,isPositiveNet:a,equalLengthGroupName:l}=t;this.name=e,this.type=r,i!=null?this.specialColor=ee.of3(i):this.specialColor=null,this.showRatline=n,s!=null?this.DifferentailName=s:s===null&&(this.DifferentailName=null),l!=null&&(this.EqualLengthGroupName=l),this.IsPositiveNet=a}check(){return!(this.name==null||this.type===void 0||this.specialColor===void 0||this.showRatline===void 0)}finish(){if(this.name==null||!this.resultNeedToBeCached)return;let t=re.getInstance().getNet(this.name);if(t==null&&(t=re.getInstance().addNet(this.name)),this.type!=null){let e=re.getInstance().getNetClass(this.type);e==null&&(e=re.getInstance().addNetClass(this.type)),e.addNetwork(t)}if(this.DifferentailName){let e=re.getInstance().getNetDifferential(this.DifferentailName);e==null&&(e=re.getInstance().addNetDifferential(this.DifferentailName)),e.positiveNet!=null?e.fillNegativeNet(t):e.positiveNet!=null||this.IsPositiveNet?e.fillPositiveNet(t):e.fillNegativeNet(t)}if(this.EqualLengthGroupName){let e=re.getInstance().getEqualLengthGroup(this.EqualLengthGroupName);e==null&&(e=re.getInstance().addEqualLengthGroup(this.EqualLengthGroupName)),e.addEqualLengthGroup(t)}return this.specialColor&&re.getInstance().setSpecialColor(t.name,this.specialColor),t.showRatline=this.showRatline,t}loadNetType(t,e){if(e!=null){let r=re.getInstance().getNetClass(e);r==null&&(r=re.getInstance().addNetClass(e)),r.getNet(this.name)||r.addNetwork(t)}else t.netClass&&t.netClass.removeNetwork(t.name)}loadDifferentialName(t,e,r){if(e){let i=re.getInstance().getNetDifferential(e);i==null&&(i=re.getInstance().addNetDifferential(e)),i.hasNet(t.name)||(i.positiveNet!=null?i.fillNegativeNet(t):i.positiveNet!=null||r?i.fillPositiveNet(t):i.fillNegativeNet(t))}else t.netDifferential&&t.netDifferential.removeNetDifferential(t.name)}loadEqualLengthGroupName(t,e){if(e){let r=re.getInstance().getEqualLengthGroup(e);r==null&&(r=re.getInstance().addEqualLengthGroup(e)),r.hasNet(t.name)||r.addEqualLengthGroup(t)}else t.equalLengthGroup&&t.equalLengthGroup.removeNetwork(t.name)}load(){if(!this.resultNeedToBeCached)return;let t=re.getInstance().getNet(this.name);t==null&&(t=re.getInstance().addNet(this.name)),this.loadNetType(t,this.type),this.loadDifferentialName(t,this.DifferentailName,this.IsPositiveNet),this.loadEqualLengthGroupName(t,this.EqualLengthGroupName)}};var lS=class extends fb{constructor(e,r,i){super();this.modelType="Combination";this._items=new Array(0);this._indexs=new Set;this.globalIndex=e,this.update(r,i)}get size(){return this._items.length}get name(){return this._name}set name(e){this._name=e}get isEmpty(){return this.hasDataState(1)}set isEmpty(e){this.setDataState(1,e)}get locked(){for(let e of this._items)if(e.locked)return!0;return!1}update(e,r){this.clearCache(),this._name=r;for(let i of e)i instanceof hs||i instanceof Va?(i.getParent().setGroupID(this.globalIndex),this._items.push(i.getParent()),this._indexs.add(i.getParent().globalIndex)):(i.setGroupID(this.globalIndex),this._items.push(i),this._indexs.add(i.globalIndex))}clearCache(){for(let e of this._items)e.setGroupID(void 0);this._items.length=0,this._indexs.clear()}getIndex(){return new Set(this._indexs)}updateIndexs(){this._indexs.clear();for(let e of this._items)this._indexs.add(e.globalIndex)}addItem(e){e instanceof hs||e instanceof Va?e.getParent().setGroupID(this.globalIndex):e.setGroupID(this.globalIndex),this._items.push(e),this._indexs.add(e.globalIndex)}deleteItem(e){let r=this._items.indexOf(e);r>=0&&(this._items.splice(r,1),this._indexs.delete(e.globalIndex),e.setGroupID(void 0))}getItems(){return this._items}setItems(e){this._items=e,this.updateIndexs()}dissolution(){for(let e of this._items)e.setGroupID(void 0);this._items.length=0,this._indexs.clear(),this.isEmpty=!0}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.transform(i)}transform(e){for(let r of this._items)r.transform(e)}getBBox(){let e=new _e;for(let r of this._items)if(r instanceof xi){let i=r.buildBBox();i!=null&&e.ext1(i)}return e.build1()}remove(){this.dissolution()}updateBox(){let e=new _e;for(let r of this._items)if(r instanceof xi){let i=r.buildBBox();i!=null&&e.ext1(i)}return e.build1()}clone(){throw new Error("Method not implemented.")}hasItem(e){return this._indexs.has(e)}};var CM=class CM extends Ei{constructor(){super(...arguments);this.numberManager=new T0;this.combinOptions=new Array;this.modifyOptions=!0}static getInstance(){return CM.manager==null&&(CM.manager=new CM),CM.manager}combination(e,r){let i=this.numberManager.getNum("");return this._last=new lS(i,e,r),this.map.set(i,this._last),this.numberManager.add(i),this.numberManager.add(r.split("group")[1]||""),this.modifyOptions=!0,this._last}getGroupByName(e){for(let r of this.map.values())if(r.name===e)return r;return null}getGroupNameByGroupId(e){var r;return e&&((r=this.getItem(e))==null?void 0:r.name)||null}getDefaultName(){return"group"+this.numberManager.getNum("")}joinCombination(e,r){let i=this.map.get(r);return i==null?(console.log("not exsit combination,join,combination fail!!!!!"),null):(e.forEach(n=>{if(n instanceof hs||n instanceof Va){let s=n.getParent();s!=null&&i.addItem(s)}else i.addItem(n)}),this.modifyOptions=!0,i)}removeFromCombination(e,r){let i=this.map.get(r);return i==null?(console.log("not exsit combination,join,combination fail!!!!!"),null):(e.forEach(n=>i.deleteItem(n)),this.modifyOptions=!0,i)}getAllGroupId(){if(this.map.size===0)return[];let e=this.map.keys(),r=new Array(this.map.size),i=0;for(let n of e)r[i]=n,i++;return r}getCombin(){return this.modifyOptions&&(this.updateCombinOptions(),this.modifyOptions=!1),this.combinOptions}updateCombinOptions(){let e=new Array;for(let r of this.map.values()){let i={};i.value=r.name,i.text=r.name,e.push(i)}this.combinOptions=e}copy(e){}rebuild(e,r,i){e=e.toString(),this.numberManager.add(e),(i==null||i=="")&&(i="group"+e);let n=new lS(e,r,i);return this.map.set(e,n),this.modifyOptions=!0,n}delete(e,r){if(e.modelType==="Combination")this.numberManager.deleteNum(r),this.map.delete(r),this.modifyOptions=!0;else if(e instanceof fb){let i=e.getGroupID();if(i!=null){let n=this.getItem(i);n!=null&&n.deleteItem(e)}}}};CM.manager=null;var Xd=CM;var zte=class extends wl{get hashkey(){return this.id}feed(t){let{id:e,groupName:r}=t;this.id=e.toString(),this.name=r}check(){return!(!this.id||!this.name)}finish(){if(!this.resultNeedToBeCached)return new lS(this.id,[],this.name);let t=Xd.getInstance(),e=t.getItem(this.id);return e==null&&(e=t.rebuild(this.id,[],this.name)),e}load(){this.model.globalIndex==this.id&&this.model.name!==this.name&&(this.model.name=this.name)}};var hg=class o extends Ct{constructor(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y){super();this.modelType="Via";c=oo(c*2)/2,u=oo(u*2)/2,this._type=r,this._name=i,this._viaBaseInfo=la.getViaBaseInfo(n,s,c,u),this._center=h,this._viaExpansion=qp.getViaExpansion(d,p,m),this._unusedInnerLayers=a,this._net=l.toString(),this._locked=g,this._bbox=y||Fz(c,h,u,p,m),this.globalIndex=e,Ro("data/model/ViaModel")}get net(){var e;return(e=this._net)==null?void 0:e.toUpperCase()}set net(e){this._net!=e&&(this._parent!=null&&this._parent instanceof xi&&this._parent.modelType=="Component"&&this._parent.setNet(this.globalIndex,this.globalIndex,e),this._net=e,this.netModified=!0)}get showNet(){return this._net}get name(){return this._name}set name(e){this.name!=e&&(this._name=e)}get unusedInnerLayers(){return this._unusedInnerLayers}set unusedInnerLayers(e){this._unusedInnerLayers.toString()!=e.toString()&&(this._unusedInnerLayers=e,this.updateShapeData())}get layerId(){return 12}set layerId(e){}get viaExpansion(){return this._viaExpansion}set viaExpansion(e){this._viaExpansion!=e&&(this.checkExpansionModify(e),this._viaExpansion=e)}get expansionType(){return this._viaExpansion.expansionType}set expansionType(e){this._viaExpansion.expansionType!=e&&(this.viaExpansion=qp.getExpansionByexpansionType(e,this.viaExpansion))}get viaBaseInfo(){return this._viaBaseInfo}set viaBaseInfo(e){this._viaBaseInfo!=e&&(this.checkBaseInfoModify(e),this._viaBaseInfo=e)}get type(){return this._type}set type(e){this.type!=e&&(this._type=e,this.updateShapeData())}get startLayer(){return this._viaBaseInfo.startLayer}set startLayer(e){this._viaBaseInfo.startLayer!=e&&(this.viaBaseInfo=la.getViaBaseInfoByStartLayer(e,this.viaBaseInfo),this.layerOrBoxModified=!0)}get endLayer(){return this._viaBaseInfo.endLayer}set endLayer(e){this._viaBaseInfo.endLayer!=e&&(this.viaBaseInfo=la.getViaBaseInfoByEndLayer(e,this.viaBaseInfo),this.layerOrBoxModified=!0)}get radius(){return this._viaBaseInfo.radius}set radius(e){this._viaBaseInfo.radius!=e&&(this._viaBaseInfo=la.getViaBaseInfoByRadius(e,this.viaBaseInfo),this.updateShapeData(),this.radiusModified=!0)}get radiusModified(){return this.hasDataState(7)}set radiusModified(e){this.setDataState(7,e)}get center(){return this._center}set center(e){this._center.equals(e)||(this._center=e,this.updateShapeData())}get holeRadius(){return this.viaBaseInfo.holeRadius}set holeRadius(e){e=oo(e*2)/2,this._viaBaseInfo.holeRadius!=e&&(this._viaBaseInfo=la.getViaBaseInfoByHoleRadius(e,this.viaBaseInfo),this.updateShapeData(),this.holeRadiusModified=!0)}get holeRadiusModified(){return this.hasDataState(8)}set holeRadiusModified(e){this.setDataState(8,e)}get topExpansion(){return this._viaExpansion.topExpansion}set topExpansion(e){this._viaExpansion.topExpansion!=e&&(this._viaExpansion=qp.getExpansionByTopExpansion(e,this.viaExpansion),this.updateShapeData(),this.topExpansionModified=!0)}get topExpansionModified(){return this.hasDataState(9)}set topExpansionModified(e){this.setDataState(9,e)}get bottomExpansion(){return this._viaExpansion.bottomExpansion}set bottomExpansion(e){this._viaExpansion.bottomExpansion!=e&&(this._viaExpansion=qp.getExpansionByBottomExpansion(e,this.viaExpansion),this.updateShapeData(),this.bottomExpansionModified=!0)}get bottomExpansionModified(){return this.hasDataState(10)}set bottomExpansionModified(e){this.setDataState(10,e)}get locked(){return this._locked}set locked(e){this._locked!=e&&(this._locked=e,this.updateShapeData())}isContains(e){return u2(e,this.type,this.startLayer,this.endLayer)}isSeparated(e){return!this.isContains(e.startLayer)&&!this.isContains(e.endLayer)&&!e.isContains(this.startLayer)&&!e.isContains(this.endLayer)}isUnuseLayer(e){let r=1<<e-15;return(Z9.compress(this._unusedInnerLayers)&r)!==0}rotateFor(e,r){let i=Ae.rotateZForPoint(e,r);this.transform(i)}transform(e){this.center=this.center.multiply4(e)}inOutline(e){let r=Math.max(this.radius,this.holeRadius);return t1(e,this.center,r)}inShape(e,r){return this.inOutline(new S(e,r))}getMathGraphics(e=this.layerId,r=0){if(this.isEmpty||this.isUnuseLayer(e))return null;if(e==12||e===47)return ge.build2([q.build3(this.center,0,-360,this.holeRadius,this.holeRadius)]);if([5,6].includes(e)){let i=e==5?this.topExpansion:this.bottomExpansion,n=this.radius+i;return n<=0?null:ge.build2([q.build3(this.center,0,-360,n,n)])}else return ge.build2([q.build3(this.center,0,-360,this.radius+r,this.radius+r)])}getFileGraphics(e,r,i){if(this.isEmpty)return null;if(ar(e)){let n=[];if(i==null){let s=this.getOneInnerInUse();s==null?i=[]:i=[s]}for(let s of i){let a=this.getMathGraphics(s,r);a!=null&&n.push(a)}return n}else{let n=this.getMathGraphics(e,r);return n!=null?[n]:null}}updateBox(){return this._bbox=Fz(this.radius,this.center,this.holeRadius,this.topExpansion,this.bottomExpansion),this._bbox}clone(){this.refreshBBox&&this.updateBox();let e=new o(this._globalIndex,this._type,this._name,this._viaBaseInfo.startLayer,this._viaBaseInfo.endLayer,this._unusedInnerLayers,this._net,this._viaBaseInfo.radius,this._center,this._viaBaseInfo.holeRadius,this._viaExpansion.expansionType,this._viaExpansion.topExpansion,this._viaExpansion.bottomExpansion,this._locked,this._bbox);return e.number=this.number,e.zIndex=this.zIndex,e}multiply3(e){let r=e.toMatrix3(),i=this.getMathGraphics();return i!=null?i.multiply3(r):null}getOneInnerInUse(){for(let e=15;e<=46;e++)if(!this.isUnuseLayer(e))return e;return null}checkBaseInfoModify(e){this._viaBaseInfo.radius!=e.radius&&(this.radiusModified=!0,this.updateShapeData()),this._viaBaseInfo.holeRadius!=e.holeRadius&&(this.holeRadiusModified=!0,this.updateShapeData()),this._viaBaseInfo.startLayer!=e.startLayer&&(this.layerOrBoxModified=!0),this._viaBaseInfo.endLayer!=e.endLayer&&(this.layerOrBoxModified=!0)}checkExpansionModify(e){this._viaExpansion.topExpansion!=e.topExpansion&&(this.topExpansionModified=!0,this.updateShapeData()),this._viaExpansion.bottomExpansion!=e.bottomExpansion&&(this.topExpansionModified=!0,this.updateShapeData())}};var SM=class SM extends Ei{static getInstance(){return SM.manager==null&&(SM.manager=new SM),SM.manager}addModel(t){this.map.set(t.globalIndex,t)}addVia(t,e,r,i,n,s,a,l,c,h,u,d,p,m=new Array,g=!1){e==0&&g&&(e=2);let y=new hg(t,e,r,i,n,m,s,a,l,c,u,d,p,h);return this.addModel(y),y}delete(t,e){t instanceof Ct&&this.map.delete(e)}};SM.manager=null;var bn=SM;var EM=class extends Zp{constructor(){super(...arguments);this.layerId=12;this.name="";this.center=S.ORIGIN;this.holeRadius=0;this.radius=0;this.isSuture=!1}feed(e){let{id:r,partitionId:i,groupId:n,netName:s,ruleName:a,centerX:l,centerY:c,holeDiameter:h,viaDiameter:u,viaType:d,topSolderExpansion:p,bottomSolderExpansion:m,locked:g,zIndex:y,unusedInnerLayers:b,number:P}=e;this.index=r,this.partition=i,this.groupId=Ca(n),this.net=s,this.zIndex=y,this.number=P,this.isNumber(l)&&this.isNumber(c)&&(this.center=new S(l/10,c/10)),this.isNumber(h)&&(this.holeRadius=h/20),this.isNumber(u)&&(this.radius=u/20),this.isSuture=m8e(d)==2,p===null?this.topSolderExpansion=null:this.isNumber(p)&&(this.topSolderExpansion=p/10),m===null?this.bottomSolderExpansion=null:this.isNumber(m)&&(this.bottomSolderExpansion=m/10),this.unusedInnerLayers=b||[],this.name=a,this.locked=g}clear(){this.model=null,this.index=null,this.partition=null,this.groupId=null,this.net=null,this.zIndex=null,this.number=null,this.layerId=null,this.name="",this.startLayer=null,this.endLayer=null,this.center=S.ORIGIN,this.holeRadius=0,this.radius=0,this.isSuture=!1,this.topSolderExpansion=null,this.bottomSolderExpansion=null,this.unusedInnerLayers=null,this.zIndex=null,this.number=null,this.locked=null}clearGroupId(){this.groupId=null}changeNet4Map(e){let r=e.get(this.net);r!=null&&(this.net=r)}check(){return!(!this.viaCheck()||this.holeRadius==null||isNaN(this.holeRadius)||this.radius==null||isNaN(this.radius)||this.topSolderExpansion===void 0||this.bottomSolderExpansion===void 0)}viaCheck(){return!(this.index==null||this.net==null||this.locked==null)}getViaType(e){let r=0;if(this.name!=""){let i=re.getInstance().getDefaultBlindPhysics(),n=i==null?void 0:i.getBlindVia(this.name);n!=null?(r=1,this.model.viaBaseInfo=la.getViaBaseInfo(n.startLayer,n.endLayer,this.radius,this.holeRadius)):r=0}return r==0&&e&&(r=2),r}finish(){if(this.viaCheck()){let e=0;if(this.name!=""){let n=re.getInstance().getDefaultBlindPhysics(),s=n==null?void 0:n.getBlindVia(this.name);s!=null?(e=1,this.startLayer=s.startLayer,this.endLayer=s.endLayer,this.resultNeedToBeCached&&s.status.used.add(this.index)):(this.name="",e=0,this.startLayer=1,this.endLayer=2)}else this.startLayer=1,this.endLayer=2;let r=1;this.topSolderExpansion==null||this.bottomSolderExpansion==null?(r=1,this.topSolderExpansion=-100,this.bottomSolderExpansion=-100):r=2;let i=this.getItem(e,r);return this.groupId!=null&&i.setGroupID(this.groupId),this.partition&&(i.partition=this.partition),this.isNumber(this.zIndex)&&(i.zIndex=this.zIndex),this.isNumber(this.number)&&(i.number=this.number),i}else return null}getItem(e,r){return this.resultNeedToBeCached?bn.getInstance().addVia(this.index,e,this.name,this.startLayer,this.endLayer,this.net,this.radius,this.center,this.holeRadius,this.locked,r,this.topSolderExpansion,this.bottomSolderExpansion,this.unusedInnerLayers,this.isSuture):(e==0&&this.isSuture&&(e=2),new hg(this.index,e,this.name,this.startLayer,this.endLayer,this.unusedInnerLayers,this.net,this.radius,this.center,this.holeRadius,r,this.topSolderExpansion,this.bottomSolderExpansion,this.locked))}getName(){return this.name}loadNet(e){this.model.net!==e&&(this.netModifyInter!=null&&this.netModifyInter.addNetModify(this.model.net,this.model),this.model.net=e)}loadName(e){this.model.name!==e&&(this.model.name=e)}loadCenter(e){this.model.center.equals(e)||(this.model.center=e)}loadHoleRadius(e){this.model.holeRadius!==e&&(this.model.holeRadius=e)}loadRadius(e){this.model.radius!=e&&(this.model.radius=e)}loadType(e){let r=this.getViaType(e);this.model.type!==r&&(this.model.type=r)}loadTopExpansion(e){this.model.topExpansion!==e&&(this.model.topExpansion=e)}loadBottomExpansion(e){this.model.bottomExpansion!==e&&(this.model.bottomExpansion=e)}loadExpansionType(){let e=2;if((this.topSolderExpansion==null||this.bottomSolderExpansion==null)&&(e=1),this.model.expansionType!=e&&(this.model.expansionType=e),e==1){let r=this.net,i=re.getInstance().getSolderExpansionByNet(r);i&&(this.topSolderExpansion=i.viaTopExpansion,this.bottomSolderExpansion=i.viaBottomExpansion)}}loadUnusedInnerLayers(e){this.model.unusedInnerLayers.toString()!=e.toString()&&(this.model.unusedInnerLayers=e)}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.partition!==void 0&&this.loadNet(this.net),this.loadName(this.name),this.loadCenter(this.center),this.loadHoleRadius(this.holeRadius),this.loadRadius(this.radius),this.loadType(this.isSuture),this.loadExpansionType(),this.loadTopExpansion(this.topSolderExpansion),this.loadBottomExpansion(this.bottomSolderExpansion),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadUnusedInnerLayers(this.unusedInnerLayers)}};var OM=class OM extends Ei{static getInstance(){return OM.manager==null&&(OM.manager=new OM),OM.manager}addModel(t){this.map.set(t.globalIndex,t)}addPad(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T=null,I,C,E){return this._last=new nS(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,void 0,C,E),this.addModel(this._last),this._last}delete(t,e){t instanceof et&&this.map.delete(e)}};OM.manager=null;var jn=OM;var mx=class extends In{getData(t,e){switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case 0:return this.id;case"groupId":return Ia(e);case"netName":return e.showNet;case"layerId":return e.layerId;case"num":return e.num;case"centerX":return ve(e.center.x*10,4);case"centerY":return ve(e.center.y*10,4);case"padAngle":return ve(e.rotation/Math.PI*180,4);case"hole":return d9t(e);case"defaultPad":return h9t(e);case"specialPad":return u9t(e);case"padOffsetX":return ve(e.holeOffset.x*10,4);case"padOffsetY":return ve(e.holeOffset.y*10,4);case"relativeAngle":return ve(e.holeRotation/Math.PI*180,4);case"plated":return e.plated;case"padType":return e.isTestPad?SIe(1):SIe(0);case"topSolderExpansion":return e.expansionType==1?null:ve(e.topSolderExpansion*10,4);case"bottomSolderExpansion":return e.expansionType==1?null:ve(e.bottomSolderExpansion*10,4);case"topPasteExpansion":return e.expansionType==1?null:ve(e.pasteExpansion*10,4);case"bottomPasteExpansion":return e.expansionType==1?null:ve(e.pasteExpansion*10,4);case"locked":return e.locked;case"zIndex":return e.zIndex;case"connectMode":{let r=e.padRule;return r?aM(r.connectMode):null}case"spokeSpace":{let r=e.padRule;return r?ve(r.lineClearance*10,4):null}case"spokeWidth":{let r=e.padRule;return r?ve(r.lineWidth*10,4):null}case"spokeAngle":{let r=e.padRule;return r?ve(r.lineAngle/Math.PI*180,4):null}case"unusedInnerLayers":return e.unusedInnerLayers;case"padLen":return ve(e.padLen*10,4);case"attrsMap":return NY(e)}}};function NY(o){let t=o.getParent(),e;t&&(e=Ji.getInstance().getItem(t.footprintUUID));let r={};for(let i in o.attrsMap){let n=o.attrsMap[i];t?(e.getValue(i)==null||e.getValue(i)!=null&&e.getValue(i)!=n)&&(r[i]=n):r[i]=n}return r}function h9t(o){if(o instanceof et)return o.isPolygon()?{padType:Jm.POLYGON,path:o1(o.polygonPl,10)}:o.layerId==12||o.layerId==1?MY(o.top):MY(o.bottom)}function MY(o){switch(o.type){case"RECT":return{padType:Jm.RECT,width:ve(o.width*10,4),height:ve(o.height*10,4),radius:o.ratio*100};default:return{padType:z8e(o.type),width:ve(o.width*10,4),height:ve(o.height*10,4)}}}function u9t(o){if(!(o instanceof et)||o.type!=2||o.isPolygon())return[];let t=MY(o.top),e=MY(o.inner),r=MY(o.bottom);return[{startLayer:1,endLayer:1,pad:t},{startLayer:1,endLayer:2,pad:e},{startLayer:2,endLayer:2,pad:r}]}function d9t(o){return ar(o.layerId)?{holeType:j8e(o.holeShape),width:ve(o.holeLength*10,4),height:ve(o.holeRadius*20,4)}:null}var AM=class extends Zp{constructor(){super(...arguments);this.center=S.ORIGIN;this.type=1;this.padType=0;this.defaultRatio=0;this.topRatio=0;this.bottomRatio=0;this.innerRatio=0;this.holeOffset=S.ORIGIN}feed(e){let{id:r,partitionId:i,groupId:n,netName:s,layerId:a,num:l,centerX:c,centerY:h,padAngle:u,hole:d,defaultPad:p,specialPad:m,padOffsetX:g,padOffsetY:y,relativeAngle:b,plated:P,padType:T,topSolderExpansion:I,bottomSolderExpansion:C,topPasteExpansion:E,bottomPasteExpansion:O,locked:_,zIndex:x,connectMode:v,spokeSpace:D,spokeWidth:w,spokeAngle:F,unusedInnerLayers:H,number:z,padLen:V,refs:W,attrsMap:L}=e;if(this.index=r,this.partition=i,this.groupId=Ca(n),this.net=s,this.zIndex=x,this.number=z,this.isNumber(c)&&this.isNumber(h)&&(this.center=new S(c/10,h/10)),this.isNumber(a)&&(this.layerId=a),this.num=l,this.isNumber(u)){let N=u/180*Math.PI;this.rotation=N}this.parseHole(d);let k=this.parseDefaultPad(p);if(k&&(k.isPolygon?this.path=k.path:(this.defaultType=k.shape,this.defaultWidth=k.width,this.defaultHeight=k.height,k.ratio&&(this.defaultRatio=k.ratio))),this.parseSpecialPad(m),this.isNumber(g)&&this.isNumber(y)&&(this.holeOffset=new S(g/10,y/10)),this.isNumber(b)&&(this.holeRotation=b/180*Math.PI),this.plated=P,this.padType=p8e(T),I==null?this.topSolderExpansion=null:this.isNumber(I)&&(this.topSolderExpansion=I/10),C==null?this.bottomSolderExpansion=null:this.isNumber(C)&&(this.bottomSolderExpansion=C/10),E==null?this.pasteExpansion=null:this.isNumber(E)&&(this.pasteExpansion=E/10),O==null?this.pasteExpansion=null:this.isNumber(O)&&(this.pasteExpansion=O/10),v==null)this.connectMode=null;else{let N=sM(v);this.connectMode=isNaN(N)?null:N}if(D==null)this.spokeSpace=null;else{let N=D/10;this.spokeSpace=isNaN(N)?null:N}if(w==null)this.spokeWidth=null;else{let N=w/10;this.spokeWidth=isNaN(N)?null:N}if(F==null)this.spokeAngle=null;else{let U=F/180*Math.PI;this.spokeAngle=isNaN(U)?null:U}this.prepareExpansion(),this.unusedInnerLayers=H||[],this.locked=_,this.padLen=(V||0)/10,this.attrsMap=L||{},W&&(this.refs=W)}clear(){this.model=null,this.index=null,this.partition=null,this.groupId=null,this.net=null,this.zIndex=null,this.number=null,this.layerId=null,this.num=null,this.center=S.ORIGIN,this.type=1,this.padType=0,this.holeRadius=null,this.defaultType=null,this.defaultWidth=null,this.defaultHeight=null,this.defaultRatio=0,this.topType=null,this.topWidth=null,this.topHeight=null,this.topRatio=0,this.bottomType=null,this.bottomWidth=null,this.bottomHeight=null,this.bottomRatio=0,this.innerType=null,this.innerWidth=null,this.innerHeight=null,this.innerRatio=0,this.rotation=null,this.expansionType=null,this.pasteExpansion=null,this.topSolderExpansion=null,this.bottomSolderExpansion=null,this.plated=null,this.holeLength=null,this.holeShape=null,this.holeRotation=null,this.holeOffset=S.ORIGIN,this.path=null,this.connectMode=null,this.spokeSpace=null,this.spokeWidth=null,this.spokeAngle=null,this.unusedInnerLayers=null,this.thermalType=null,this.padLen=null,this.attrsMap=null,this.zIndex=null,this.number=null,this.refs=null,this.locked=null}clearGroupId(){this.groupId=null}clearFootExcludeProps(){super.clearFootExcludeProps(),this.net="",this.attrsMap=null}changeNet4Map(e){let r=e.get(this.net);r!=null&&(this.net=r)}parseHole(e){e!=null&&(this.holeShape=Y8e(e.holeType),isNaN(e.width)||(this.holeLength=e.width/10),isNaN(e.height)||(this.holeRadius=e.height/20))}parseSpecialPad(e){!Array.isArray(e)||e.length==0||(this.type=2,e.forEach(r=>{if(ao(r.startLayer)&&ao(r.endLayer)){let i=this.parseDefaultPad(r.pad);if(!i)return;i.isPolygon?this.path=i.path:(this.topType=i.shape,this.topWidth=i.width,this.topHeight=i.height,i.ratio&&(this.topRatio=i.ratio))}else if(2==r.startLayer&&2==r.endLayer){let i=this.parseDefaultPad(r.pad);if(!i)return;i.isPolygon?this.path=i.path:(this.bottomType=i.shape,this.bottomWidth=i.width,this.bottomHeight=i.height,i.ratio&&(this.bottomRatio=i.ratio))}else{let i=this.parseDefaultPad(r.pad);if(!i)return;i.isPolygon?this.path=i.path:(this.innerType=i.shape,this.innerWidth=i.width,this.innerHeight=i.height,i.ratio&&(this.innerRatio=i.ratio))}}))}parseDefaultPad(e){let r=e.padType,i=W8e(e.padType);switch(r){case Jm.OVAL:case Jm.ELLIPSE:return{isPolygon:!1,shape:i,width:e.width/10,height:e.height/10,path:null};case Jm.RECT:return{isPolygon:!1,shape:i,width:e.width/10,height:e.height/10,ratio:e.radius/100,path:null};case Jm.POLYGON:return{isPolygon:!0,shape:i,width:0,height:0,path:e.path}}}check(){return!(!this.index||this.groupId===void 0||!this.layerId||this.num==null||this.rotation==null||isNaN(this.rotation)||!(this.padType===0||this.padType===1||this.padType===2)||this.topSolderExpansion===void 0||this.bottomSolderExpansion===void 0||this.pasteExpansion===void 0||this.locked==null)}padVerify(e,r){if(e=="ELLIPSE")switch(r){case"top":this.topHeight=this.topWidth;break;case"bottom":this.bottomHeight=this.bottomWidth;break;case"inner":this.innerHeight=this.innerWidth;break}}initData(){this.topType==null&&(this.topType=this.defaultType,this.topRatio=this.defaultRatio),this.topWidth==null&&(this.topWidth=this.defaultWidth),this.topHeight==null&&(this.topHeight=this.defaultHeight),this.padVerify(this.topType,"top"),this.bottomType==null&&(this.bottomType=this.defaultType,this.bottomRatio=this.defaultRatio),this.bottomWidth==null&&(this.bottomWidth=this.defaultWidth),this.bottomHeight==null&&(this.bottomHeight=this.defaultHeight),this.padVerify(this.bottomType,"bottom"),this.innerType==null&&(this.innerType=this.defaultType,this.innerRatio=this.defaultRatio),this.innerWidth==null&&(this.innerWidth=this.defaultWidth),this.innerHeight==null&&(this.innerHeight=this.defaultHeight)}padCheck(){if(this.initData(),this.index==null||this.layerId==null||this.num==null||this.rotation==null||this.locked==null||this.net==null)return!1;if(this.path!=null){if(this.path.length==0||!Array.isArray(this.path))return!1;let e=m2(this.path);if(e==null)return!1;if(e.primitives.length==2&&e.primitives[0]instanceof M&&e.primitives[1]instanceof M)return!1}return this.layerId!=12&&(this.type=1),!0}prepareExpansion(){this.topSolderExpansion==null&&this.bottomSolderExpansion==null&&this.pasteExpansion==null?(this.expansionType=1,this.topSolderExpansion=.4,this.bottomSolderExpansion=.4,this.pasteExpansion=.4):this.expansionType=2}finish(){if(this.padCheck()){if(this.resultNeedToBeCached&&this.refs!=null)for(let n of this.refs)La.getInstance().addConnectRelatedId(this.index,n);this.connectMode==null?this.thermalType=1:this.thermalType=2;let e=null;this.thermalType===2&&(e=qh.getPadRule(this.connectMode,this.spokeSpace,this.spokeWidth,this.spokeAngle));let r,i;if(this.path==null)i=SBe(this.index,this.layerId,this.topType,this.topWidth,this.topHeight,this.topRatio,this.bottomType,this.bottomWidth,this.bottomHeight,this.bottomRatio,this.innerType,this.innerWidth,this.innerHeight,this.innerRatio,this.holeLength,this.holeRadius,this.holeShape,this.holeRotation,this.holeOffset);else{let n=this.getShapes();if(!n)return null;i=EBe(this.index,this.layerId,this.holeLength,this.holeRadius,this.holeShape,this.holeRotation,this.holeOffset,n)}return r=this.getItem(i,e),this.groupId!=null&&r.setGroupID(this.groupId),this.partition&&(r.partition=this.partition),this.zIndex&&(r.zIndex=this.zIndex),this.isNumber(this.number)&&(r.number=this.number),r.padType=this.padType,r}else return null}getItem(e,r){return this.resultNeedToBeCached?jn.getInstance().addPad(this.index,this.layerId,this.type,this.num,this.center,this.rotation,this.locked,this.net,this.expansionType,this.pasteExpansion,this.topSolderExpansion,this.bottomSolderExpansion,this.unusedInnerLayers,this.plated,e.top,e.bottom,e.inner,e.hole,r,void 0,this.padLen,this.attrsMap):new nS(this.index,this.layerId,this.type,this.num,this.center,this.rotation,this.locked,this.net,this.expansionType,this.pasteExpansion,this.topSolderExpansion,this.bottomSolderExpansion,this.unusedInnerLayers,this.plated,e.top,e.bottom,e.inner,e.hole,r,void 0,void 0,this.padLen,this.attrsMap)}getShapes(e=this.path){return m2(e,10)}loadNet(e){this.model.net!=e&&(this.netModifyInter!=null&&this.netModifyInter.addNetModify(this.model.net,this.model),this.model.net=e)}loadNum(e){this.model.num!=e&&(this.model.num=e)}loadCenter(e){this.model.center.equals(e)||(this.model.center=e)}loadRotation(e){this.model.rotation!==e&&(this.model.rotation=e)}loadHoleStyle(e,r,i,n,s){this.loadHoleShape(e),this.loadHoleLength(r),this.loadHoleRadius(i),this.loadHoleRotation(n),this.loadHoleOffset(s)}loadHoleShape(e){this.model.holeShape!=e&&(this.model.holeShape=e)}loadHoleLength(e){this.model.holeLength!=e&&(this.model.holeLength=e)}loadHoleRadius(e){this.model.holeRadius!=e&&(this.model.holeRadius=e)}loadHoleOffset(e){this.model.holeOffset.equals(e)||(this.model.holeOffset=e)}loadHoleRotation(e){this.model.holeRotation!=e&&(this.model.holeRotation=e)}loadPlated(e){this.model.plated!==e&&(this.model.plated=e)}loadPadRule(e,r,i,n){this.model.padRule?this.connectMode==null?this.model.padRule=null:(this.loadConnectMode(e),this.loadLineWidth(i),this.loadLineClearance(r),this.loadLineAngle(n)):this.connectMode!=null&&(this.model.padRule=qh.getPadRule(this.connectMode,this.spokeSpace,this.spokeWidth,this.spokeAngle))}loadConnectMode(e){this.model.padRule.connectMode!=e&&(this.model.padRule=qh.getPadRuleByconnectMode(e,this.model.padRule))}loadLineWidth(e){this.model.padRule.lineWidth!=e&&(this.model.padRule=qh.getPadRuleBylineWidth(e,this.model.padRule))}loadLineClearance(e){this.model.padRule.lineClearance!=e&&(this.model.padRule=qh.getPadRuleBylineClearance(e,this.model.padRule))}loadLineAngle(e){this.model.padRule.lineAngle!=e&&(this.model.padRule=qh.getPadRuleBylineAngle(e,this.model.padRule))}loadUnusedInnerLayers(e){this.model.unusedInnerLayers.toString()!==e.toString()&&(this.model.unusedInnerLayers=e)}loadPadStyle(e,r,i,n,s,a){return e!=null?(a!=null&&(r="POLYGON"),e.pl!=null&&a!=null&&o1(e.pl,10)!=a&&(a=this.getShapes(a)),Lo.getStyle(r,i,n,s,a)):Lo.getStyle(r,i,n,s,this.getShapes(a))}loadPadType(e){this.model.padType!=e&&(this.model.padType=e)}loadType(e){this.model.type!=e&&(this.model.type=e)}loadPadLen(e){this.model.padLen!=e&&(this.model.padLen=e)}loadExpansionType(e){if(this.model.expansionType!=e&&(this.model.expansionType=e),e==1){let r=re.getInstance().getSolderExpansionByNet(this.net),i=re.getInstance().getPasteExpansionByNet(this.net);i&&(this.pasteExpansion=rIe(this.model,i)),r&&(this.topSolderExpansion=this.model.isTestPad?r.testPointTopExpansion:r.padTopExpansion,this.bottomSolderExpansion=this.model.isTestPad?r.testPointBottomExpansion:r.padBottomExpansion)}}loadExpansion(e,r,i){this.model.topSolderExpansion!=e&&(this.model.topSolderExpansion=e),this.model.bottomSolderExpansion!=r&&(this.model.bottomSolderExpansion=r),this.model.pasteExpansion!=i&&(this.model.pasteExpansion=i)}loadAttrMap(e){if(!e)return;let r=NY(this.model);if(JSON.stringify(r)!=JSON.stringify(e)){for(let i in e)this.model.modifyATTRMap(i,e[i]),delete r[i];for(let i in r)this.model.deleteATTRMap(i)}}load(){this.initData(),this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadLayerId(this.layerId),this.loadType(this.type),this.loadPadType(this.padType),this.loadNum(this.num),this.loadCenter(this.center),this.loadRotation(this.rotation),this.loadLocked(this.locked),this.partition!==void 0&&this.loadNet(this.net),this.loadExpansionType(this.expansionType),this.loadExpansion(this.topSolderExpansion,this.bottomSolderExpansion,this.pasteExpansion),this.loadUnusedInnerLayers(this.unusedInnerLayers),this.loadPlated(this.plated),this.model.top!=null&&(this.model.top=this.loadPadStyle(this.model.top,this.topType,this.topWidth,this.topHeight,this.topRatio,this.path)),this.model.bottom!=null&&(this.model.bottom=this.loadPadStyle(this.model.bottom,this.bottomType,this.bottomWidth,this.bottomHeight,this.bottomRatio,this.path)),this.model.inner!=null&&(this.model.inner=this.loadPadStyle(this.model.inner,this.innerType,this.innerWidth,this.innerHeight,this.innerRatio,this.path)),this.loadHoleStyle(this.holeShape,this.holeLength,this.holeRadius,this.holeRotation,this.holeOffset),this.loadPadRule(this.connectMode,this.spokeSpace,this.spokeWidth,this.spokeAngle),this.loadPadLen(this.padLen),this.loadAttrMap(this.attrsMap),this.loadzIndex(this.zIndex),this.loadNumber(this.number)}};function Op(o,t){let e=new Map;for(let r of t)KO(e,o(r),r);return e}function KO(o,t,e){if(t==null)return;let r=o.get(t);r==null&&(r=new Array,o.set(t,r)),r.push(e)}var ZO=class ZO extends Ei{static getInstance(){return ZO.manager==null&&(ZO.manager=new ZO),ZO.manager}constructor(){super()}setPadLenByModel(t,e){let r=t.getParent();r&&this.setPadLen(r.globalIndex,t.globalIndex,e)}setPadLen(t,e,r){let i=this.getItem(t);i||(i=new Map,this.map.set(t,i)),i.set(e,r)}getPadLenByModel(t){let e=t.getParent();if(e){let r=this.getPadLen(e.globalIndex,t.globalIndex);return r==null?t.padLen||0:r}return null}getPadLen(t,e){let r=this.getItem(t);if(r){let i=r.get(e);if(i!=null)return i}}deletePadLen(t,e){let r=this.getItem(t);r&&r.delete(e)}updatePadLen(t){let{unit:e,value:r}=t,i=ZO.getInstance(),n=new dt;r.forEach(s=>{let a=s.hashId;s.pads.forEach(l=>{if(l.padLen!=null){let c=n.conversion(e,"mil",l.padLen)/10;i.setPadLen(a,l.hashId,c)}})})}getAllCompPadLenInfo(){let t=[],e=Ms.getInstance().getAllItem(),r=ZO.getInstance(),i=R.getInstance().unit,n=new dt;return e.forEach(s=>{let a=s.designator,l=s.getFormulaName(),c=s.attrsMap,h=c.Value,u=c.Device,d=c.Footprint,p=[];s.getPads().forEach(m=>{p.push({hashId:m.globalIndex,num:m.num,padLen:n.conversion("mil",i,r.getPadLenByModel(m)*10)})}),t.push({designator:a,name:l,deviceName:u,value:h,footName:d,pads:p,hashId:s.globalIndex})}),{unit:i,data:t}}};ZO.manager=null;var $o=ZO;function PB(o){let t=Tu.getInstance().getItem(o.deviceUUID),e=Ji.getInstance().getItem(o.footprintUUID),r={},i=["3D Model Title","3D Model","3D Model Transform"];for(let n in o.attrsMap){let s=o.attrsMap[n];if(n=="Reuse Block"||n=="Group ID"||n=="Channel ID"){r[n]=s;continue}(t.attrMap[n]==null&&e.getValue(n)==null||t.attrMap[n]!=null&&t.attrMap[n]!=s||t.attrMap[n]==null&&e.getValue(n)!=null&&e.getValue(n)!=s)&&n!="Device"&&n!="Designator"&&n!="3D Model Title"&&n!="3D Model"&&n!="3D Model Transform"&&n!="Footprint"&&(r[n]=s);for(let a of i)if(n==a)if(t.attrMap[a]!=null)o.attrsMap[n]!=t.attrMap[n]&&(r[a]=o.attrsMap[a]);else{let l=e.getValue(n);o.attrsMap[n]!=l&&(o.attrsMap[a]!=null&&o.attrsMap[a]!=""||l!=null)&&(r[a]=o.attrsMap[a])}}return r}function sFe(o){let t=o.deviceUUID,e=o.footprintUUID,r=Tu.getInstance().getItem(t),i=Ji.getInstance().getItem(e),n=o.attrsMap,s=o.attrKeyText,a=o.layerId,l=o.position,c=o.rotation,h={},u=new Set(["Reuse Block","Group ID","Channel ID","Footprint","Designator"]);for(let d in n){let p=n[d];if(u.has(d)){h[d]=p;continue}if(i&&i.checkKeyValue(d,p)){let m=!(r!=null&&r.has(d)),g=s[d],y=!!g;if(g){let b=g.layerId;b=a==2?sg(b):b;let P=g.position,T=g.rotation;y=r==null?void 0:r.needSave(g,XO(l,c,P),T-c,b,e)}if(m&&!y)continue}h[d]=p}return h}var TB=class extends Zp{constructor(){super(...arguments);this.position=S.ORIGIN;this.attrs=new Array;this.padNets=new Array;this.reuseBlock=null}feed(e){let{id:r,partitionId:i,groupId:n,layerId:s,x:a,y:l,angle:c,attrs:h,locked:u,zIndex:d,number:p,specialColor:m,layerIdReplacements:g}=e;this.index=r,this.groupId=Ca(n),this.number=p,this.zIndex=d,this.isNumber(s)&&(this.layerId=s),this.partition=i,this.isNumber(a)&&this.isNumber(l)&&(this.position=new S(a/10,l/10)),this.isNumber(c)&&(this.rotation=c/180*Math.PI),this.attrsMap=h,this.locked=u,this.layerIdReplacementTable=g,m&&(this.specialColor=ee.of3(m))}get index(){return this._index}set index(e){let r=this.index;this._index=e;let i=new RegExp(`^${r}`);for(let n of this.attrs)n.parentIndex==r&&(n.parentIndex=e,n.index=e+n.index.replace(i,""));for(let n of this.padNets)n.parentIndex==r&&(n.parentIndex=e);this.reuseBlock&&(this.reuseBlock.shapeIndex=e)}check(){return!(!this.index||this.groupId===void 0||!this.layerId||this.rotation==null||isNaN(this.rotation)||this.locked==null)}setReuseBlock(e){this.reuseBlock=e}getReuseBlock(){return this.reuseBlock}getFootprintUUID(){return this.attrs.forEach(e=>{e.key==="Device"?this.device=Tu.getInstance().getItem(e.value):e.key==="Footprint"&&(this.footprint=Ji.getInstance().getItem(e.value))}),this.device==null?null:(this.footprint==null&&(this.footprint=Ji.getInstance().getItem(this.device.footprintUUID)),this.footprint!=null?this.footprint.source!=null?this.footprint.source:this.footprint.uuid:null)}addAttribute(e){e.key!=""&&this.attrs.push(e)}addPadNet(e){this.padNets.push(e)}canBuild(){for(let e of this.attrs)if(e.key=="Device")return!0;return!1}filterAttr(){let e=new Map;for(let r of this.attrs){let i=e.get(r.key);(i==null||i.ticket<r.ticket)&&e.set(r.key,r)}this.attrs.length=0;for(let[,r]of e)this.attrs.push(r)}finish(){var e;try{this.filterAttr();let r;for(let u of this.attrs)u.key==="Device"?(this.device=Tu.getInstance().getItem(u.value),u.value=(e=this.device)==null?void 0:e.name):u.key==="Footprint"&&(this.footprint=Ji.getInstance().getItem(u.value),r=u);if(this.device==null||(this.footprint==null&&(this.footprint=Ji.getInstance().getItem(this.device.footprintUUID)),this.footprint==null))return null;r&&(r.value=this.footprint.footprintId||"");let i=this.device.rebuildComponent(this.index,this.footprint.uuid,this.attrs,this.resultNeedToBeCached),n=i.getComponent(this.index,this.groupId,this.layerId,this.position,this.rotation,this.attrsMap,this.locked,this.layerIdReplacementTable);for(let u of this.attrs){let d=n.attrKeyText[u.key];if(d!=null){u.check(),d.fontFamily=u.fontFamily,d.value=u.value,d.showKey=u.showKey,d.showValue=u.showValue,d.layerId=u.layerId,d.fontSize=u.fontSize,d.strokeWidth=u.strokeWidth,d.origin=u.origin,d.rotation=u.angle,d.mirror=u.mirror,d.locked=u.locked,d.silkColor=u.specialColor;let p=u.x,m=u.y;if(u.showKey||u.showValue?d.positionIsNull=!1:p==null||m==null?d.positionIsNull=!0:(p!==null||m!==null)&&(d.positionIsNull=!1),u.resetAttr)if(d.key==="Designator"){let y=n.buildBBox().UL().add1(0,-.5);p=y.x,m=y.y}else{let g=n.getNewTextPosition();p=g.x,m=g.y}p==null&&(p=S.ORIGIN.x),m==null&&(m=S.ORIGIN.y),d.position=new S(p,m),d.reverse=u.reverse,d.reverseExpansion=u.reverseExpansion}else{if(i.componentId!=null){let p=u.index;i.addId(p),u.index=p}d=u.finish()}n.addAttribute(d)}this.attrs.length=0,this.attrsMap=null,this.layerIdReplacementTable=null;let s=new Array;xe.addAll(s,n.getPads()),xe.addAll(s,n.getVias());let a=Op(u=>u.modelType=="Pad"?u.num:u.globalIndex.replace(n.globalIndex,""),s),l=Op(u=>u.num,this.padNets),c=new Set,h=new Set;for(let[u,d]of l){let p=a.get(u);if(p!=null){if(d.length==1&&p.length==1)this.matchPadNet(p[0],d[0]),c.add(p[0]),h.add(d[0]);else for(let m of d)if(!h.has(m)){for(let g of p)if(!c.has(g)&&n.globalIndex+m.id==g.globalIndex){this.matchPadNet(g,m),c.add(g),h.add(m);break}}}}if(c.size!=s.length&&h.size!=this.padNets.length){for(let u of s)if(!c.has(u)){for(let d of this.padNets)if(!h.has(d)&&u.globalIndex==n.globalIndex+d.id){this.matchPadNet(u,d),c.add(u),h.add(d);break}}for(let u of s)if(!c.has(u)){for(let d of this.padNets)if(!h.has(d)){this.matchPadNet(u,d),c.add(u),h.add(d);break}}}return this.padNets.length=0,this.specialColor!=null&&(n.silkColor=this.specialColor),this.partition&&(n.partition=this.partition),this.isNumber(this.number)&&(n.number=this.number),this.isNumber(this.zIndex)&&(n.zIndex=this.zIndex),this.reuseBlock!=null&&(n.combinationID=this.reuseBlock.groupId,n.channelID=this.reuseBlock.channelId),this.footprint!=null&&this.footprint.modifyName(n.name,n.name),n}catch(r){console.log(r)}}matchPadNet(e,r){if(e.net=r.net,e.partition=r.partition,e instanceof et&&($o.getInstance().setPadLenByModel(e,r.padLen),r.attrsMap!=null)){let i=e.globalIndex.replace(this.index,""),n=this.footprint.getModelBy(e.modelType,i),s={};n instanceof et&&(s=n.attrsMap?{...n.attrsMap}:{});for(let a in r.attrsMap)s[a]=r.attrsMap[a];for(let a in s){let l=s[a];e.modifyATTRMap(a,l)}}}loadRotation(e){if(this.model.rotation!=e){let r=e-this.model.rotation,i=this.model.position,n=Ae.translate(-i.x,-i.y,0).rotateZ(r).translate1(i.x,i.y,0);this.model.multiply4(n,!0),this.model.rotation=e}}loadPosition(e){if(!this.model.position.equals(e)){let r=e.sub(this.model.position),i=Ae.translate(r.x,r.y,0);this.model.multiply4(i,!0)}}loadAttrmap(e){let r=PB(this.model);if(JSON.stringify(r)!=JSON.stringify(e)){for(let i in e)this.model.modifyATTRMap(i,e[i]),delete r[i];for(let i in r)this.model.deleteATTRMap(i)}}loadLayerIdReplacementTable(e){this.model.setLayerIdReplacementTable(e)}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadLayerId(this.layerId),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadNumber(this.number),this.loadRotation(this.rotation),this.loadPosition(this.position),this.loadAttrmap(this.attrsMap),this.loadSpecialColor(this.specialColor),this.loadLayerIdReplacementTable(this.layerIdReplacementTable)}loadSpecialColor(e){(this.model.silkColor!=e&&(this.model.silkColor==null||e==null)||this.model.silkColor!=null&&e!=null&&!this.model.silkColor.equals(e))&&(this.model.silkColor=e)}};var gy=class extends xi{get globalIndex(){return this._globalIndex}set globalIndex(t){this._globalIndex=t,this.text!=null&&(this.text.globalIndex=t)}get silkColor(){return this.text.silkColor}set silkColor(t){this.text!=null&&(this.text.silkColor=t)}};var Am=class o extends gy{constructor(e,r,i,n,s,a,l,c,h,u,d,p=10,m=3,g=5,y,b){super();this.modelType="Length Dimension";this._lineLen=10;this._arrLineLen=3;this._textOffset=5;let P=i.distance1(n),T=zO(P,l,u).toString()+u,{width:I,height:C,path:E}=fd(T,c,h),O=Pk(i,n,I,g),_=NP(is(r)?-n.angle(i):n.angle(i)),x=is(r)?9:3;b||(b=new Ku(e,r,0,"",!1,T,!0,"default",c,_,O,x,h,!1,0,!1,!1,E,I,C,d)),y==null&&(y=Tk(i,n,s,a,h,b,p,m)),this._globalIndex=e,this._start=i,this._end=n,this._left=s,this._right=a,this._precision=l,this._lineLen=p,this._arrLineLen=m,this._textOffset=g,this._bbox=y,this.text=b,this._unit=u}get refreshBBox(){return this.text.refreshBBox}set refreshBBox(e){this.text.refreshBBox=e}get layerId(){return this.text.layerId}set layerId(e){this.text.layerId!=e&&(this.watchLayerIdModify(this.layerId),this.text.layerId=e,is(e)&&this.text.origin!=9?this.text.origin=9:!is(e)&&this.text.origin!=3&&(this.text.origin=3),this.updateText(),this.layerModified=!0)}get unit(){return this._unit}set unit(e){this._unit!=e&&(this._unit=e,this.updateText())}get textPosition(){return this.text.position}set textPosition(e){this.text.position=e,this.updateText()}get strokeWidth(){return this.text.strokeWidth}set strokeWidth(e){this.text.strokeWidth!=e&&(this.text.strokeWidth=e,this.updateText())}get start(){return this._start}set start(e){this._start.equals(e)||(this._start=e,this.updateText())}get end(){return this._end}set end(e){this._end.equals(e)||(this._end=e,this.updateText())}get left(){return this._left}set left(e){this._left.equals(e)||(this._left=e,this.updateText())}get right(){return this._right}set right(e){this._right.equals(e)||(this._right=e,this.updateText())}get length(){return this.start.distance1(this.end)}set length(e){let i=this.end.sub(this.start).normalize().mul(e-this.length),n=Ae.translate(i.x,i.y,0);this.end=this.end.multiply4(n),this.right=this.right.multiply4(n)}get precision(){return this._precision}set precision(e){this._precision!=e&&(this._precision=e,this.updateText())}get fontSize(){return this.text.fontSize}set fontSize(e){this.text.fontSize!=e&&(this.text.fontSize=e,this.updateText())}get content(){return zO(this.length,this.precision,this.unit).toString()+this._unit}get lineLen(){return this._lineLen}set lineLen(e){this._lineLen!=e&&(this._lineLen=e)}get arrLineLen(){return this._arrLineLen}set arrLineLen(e){this._arrLineLen!=e&&(this._arrLineLen=e)}get textOffset(){return this._textOffset}set textOffset(e){this._textOffset!=e&&(this._textOffset=e)}get bbox(){return this._bbox}updateText(){let{width:e,height:r,path:i}=fd(this.content,this.fontSize,this.strokeWidth);this.text.outline=i,this.text.position=Pk(this.start,this.end,e,this.textOffset);let n=is(this.layerId);this.text.rotation=NP(n?-this.end.angle(this.start):this.end.angle(this.start)),this.text.updateBox4(e,r),this.updateShapeData()}transform(e){this.start=this.start.multiply4(e),this.end=this.end.multiply4(e),this.left=this.left.multiply4(e),this.right=this.right.multiply4(e),this.text.transform(e),this.updateText()}flip(e){let r=this.buildBBox().center().multiply4(e),i=this._start.equals(this._left),n=this._end.equals(this._right);if(this.transform(e),i&&n){let l=this._left;this._left=this._right,this._right=l,l=this._start,this._start=this._end,this._end=l,this.updateText()}let s=this.buildBBox().center(),a=r.sub(s);this.start=this.start.add(a),this.end=this.end.add(a),this.left=this.left.add(a),this.right=this.right.add(a),this.updateText()}inShape(e,r){let i=new S(e,r),n=QC(this.start,this.end,this.left,this.right,this.text.box.width,this.lineLen,this.arrLineLen);for(let s of n)if(Da(i,s.start(),s.end(),this.strokeWidth))return!0;return this.text.inShape(e,r)}get locked(){return this.text.locked}set locked(e){this.text.locked=e}calibrateLine(e,r,i,n){let s,a,l;this.start.equals(this.end)?(r?s=this.vectorProjectOnPerpendicularLine(this.right.sub(this.left),e[0].sub(e[1])):s=this.vectorProjectOnPerpendicularLine(e[0].sub(e[3]),e[1].sub(e[0])),a=0):(s=this.end.sub(this.start),a=s.length());let c=s.normalize(),h=e[3].sub(e[2]).dot(c);switch(i?l=a+h:l=a-h,n){case 0:this.end=e[3].add(c.mul(l)),this.left=e[3].add(e[1].sub(e[0]));break;case 1:this.start=e[3].sub(c.mul(l)),this.right=e[3].add(e[1].sub(e[0]));break;case 2:this.start=e[1].sub(c.mul(l));break;case 3:this.end=e[1].add(c.mul(l));break}}vectorProjectOnPerpendicularLine(e,r){let i=r.rotate(new S(0,0),Math.PI/2).normalize(),n=e.angle(i);return Math.abs(n)>Math.PI/2&&(i=i.mul(-1)),i.mul(e.dot(i))}updateBox(){return this.text.buildBBox(),this._bbox=Tk(this.start,this.end,this.left,this.right,this.strokeWidth,this.text,this.lineLen,this.arrLineLen),this._bbox}getBaseGraphics(){let e=[];return this.text.outline.forEach(i=>{e.push(i.primitives.map(n=>n.multiply3(this.text.matrix.toMatrix3())))}),QC(this.start,this.end,this.left,this.right,this.text.box.width,this.lineLen,this.arrLineLen).forEach(i=>{e.push([i])}),e}clone(){this.refreshBBox&&this.updateBox();let e=new o(this._globalIndex,this.layerId,this._start,this._end,this._left,this._right,this._precision,this.fontSize,this.strokeWidth,this._unit,this.locked,this._lineLen,this._arrLineLen,this._textOffset,this._bbox);return e.number=this.number,e.zIndex=this.zIndex,e}};var _M=class _M extends Ei{static getInstance(){return _M.manager==null&&(_M.manager=new _M),_M.manager}addModel(t){this.map.set(t.globalIndex,t)}addDimension(t,e,r,i,n,s,a,l,c,h,u){return this._last=new Am(t,e,r,i,n,s,a,l,c,h,u,void 0,void 0,void 0,void 0),this.addModel(this._last),this._last}delete(t,e){t instanceof Am&&this.map.delete(e)}};_M.manager=null;var Ma=_M;function kY(o,t,e){let r=new Array(0),i=new M(o,t),n=new M(o,e);r.push(i,n);let s=t.sub(o),a=e.sub(o),l=Math.atan2(s.y,s.x)*180/Math.PI,c=Math.atan2(a.y,a.x)*180/Math.PI;if(l==c&&(c+=1e-8),s.cross(a)>=0){let u=q.build2(o,l,c,10,10,ae.CCW);r.push(u)}else{let u=q.build2(o,l,c,10,10,ae.CW);r.push(u)}return r}function jte(o,t,e){let r=t.sub(o).normalize(),i=e.sub(o).normalize(),n=r.add(i).normalize().mul(15);return o.add(n)}function DIe(o,t,e,r){let i=Math.pow(10,r),n=t.sub(o),s=e.sub(o),a=n.normalize().dot(s.normalize()),l=Math.acos(a)/Math.PI*180,c=Math.round(l*i)/i;return isNaN(c)&&(c=0),c.toFixed(r)}function Xte(o,t,e){let r=o.add1(is(t)?-1:1,0),i=e/2+.1;return q.build2(r,0,360,i,i,ae.CCW)}function wIe(o,t,e,r,i){let n=kY(o,t,e),s=new _e;for(let l of n)s.ext1(l.bbox());s.ext7(i/2),s.ext1(r.bbox);let a=Xte(r.bbox.UR(),r.layerId,i);return s.ext1(a.bbox()),s.build1()}function aFe(o,t,e,r){let i=kY(o,t,e),n=new _e;for(let s of i)n.ext1(s.bbox());return n.ext7(r/2),n.build1()}var Ap=class o extends gy{constructor(e,r,i,n,s,a,l,c,h,u,d,p){super();this.modelType="Protractor Dimension";let m=DIe(a,l,c,s),{width:g,height:y,path:b}=fd(m.toString(),n,i),P=is(r)?9:3;p=p||new Ku(e,r,0,"",!1,m.toString(),!0,"default",n,0,h,P,i,!1,0,!1,!1,b,g,y,u),d==null&&(d=wIe(a,l,c,p,i)),this._globalIndex=e,this._precision=s,this._center=a,this._end1=l,this._end2=c,this._bbox=d,this.text=p}get modify(){return this.text.refreshBBox}set modify(e){this.text.refreshBBox=e}get layerId(){return this.text.layerId}set layerId(e){this.layerId!=e&&(this.watchLayerIdModify(this.layerId),this.text.layerId=e,is(e)&&this.text.origin!=9?this.text.origin=9:!is(e)&&this.text.origin!=3&&(this.text.origin=3),this.updateText(),this.layerModified=!0)}get start(){return this.end1}set start(e){this.end1=e}get end(){return this.end2}set end(e){this.end2=e}get strokeWidth(){return this.text.strokeWidth}set strokeWidth(e){this.text.strokeWidth!=e&&(this.text.strokeWidth=e,this.updateText())}get fontSize(){return this.text.fontSize}set fontSize(e){this.text.fontSize!=e&&(this.text.fontSize=e,this.updateText())}get precision(){return this._precision}set precision(e){this._precision!=e&&(this._precision=e,this.updateText())}get center(){return this._center}set center(e){this._center.equals(e)||(this._center=e,this.text.position=jte(this.center,this.end1,this.end2),this.updateText())}get end1(){return this._end1}set end1(e){this._end1.equals(e)||(this._end1=e,this.text.position=jte(this.center,this.end1,this.end2),this.updateText())}get end2(){return this._end2}set end2(e){this._end2.equals(e)||(this._end2=e,this.text.position=jte(this.center,this.end1,this.end2),this.updateText())}get angle(){let e=Math.pow(10,this.precision),r=this.start.sub(this.center),i=this.end.sub(this.center),n=r.normalize().dot(i.normalize()),s=Math.acos(n)/Math.PI*180,a=Math.round(s*e)/e;return isNaN(a)&&(a=0),a}set angle(e){isNaN(e)&&(e=0);let r=e/180*Math.PI,i=this.start.sub(this.center).normalize(),n=this.end.sub(this.center).normalize(),s=this.end.sub(this.center).length();if(i.cross(n)>=0){let l=i.rotate(S.ORIGIN,r);this.end=this.center.add(l.mul(s))}else{let l=i.rotate(S.ORIGIN,-r);this.end=this.center.add(l.mul(s))}}get textPosition(){return this.text.position}set textPosition(e){this.text.position=e,this.updateText()}get bbox(){return this._bbox}get content(){return DIe(this.center,this.end1,this.end2,this.precision)}get locked(){return this.text.locked}set locked(e){this.text.locked=e}updateText(){let{width:e,height:r,path:i}=fd(this.content.toString(),this.fontSize,this.strokeWidth);this.text.outline=i,this.text.updateBox4(e,r),this.updateShapeData()}rotateFor(e,r){let i=Ae.rotateZForPoint(e,r);this.transform(i)}transform(e){this.text.transform(e);let r=this.textPosition,i=this.center.multiply4(e),n=this.end1.multiply4(e),s=this.end2.multiply4(e);this.center=i,this.end1=n,this.end2=s,this.textPosition=r}flip(e){let r=this.textPosition,i=this.center.multiply4(e),n=this.end1.multiply4(e),s=this.end2.multiply4(e);this.center=i,this.end1=n,this.end2=s;let l=r.add1((this.text.width+1.4)/2,(this.text.height+.6)/2).multiply4(e);this.textPosition=l.add1(-((this.text.width+1.4)/2),-((this.text.height+.6)/2))}inOutline(e){return this.inShape(e.x,e.y)}inShape(e,r,i){let n=i==null?1:i.getScale(),s=new S(e,r),a=kY(this.center,this.end1,this.end2),l=is(this.layerId)?this.text.bbox.UL():this.text.bbox.UR(),c=Xte(l,this.text.layerId,this.strokeWidth);for(let h of a)if(h instanceof M){if(Da(s,h.start(),h.end(),this.strokeWidth,n))return!0}else if($0(s,h.center,h.rx,h.startAngle/180*Math.PI,h.endAngle()/180*Math.PI,h.sweep(),this.strokeWidth,n))return!0;return $0(s,c.center,c.rx,c.startAngle/180*Math.PI,c.endAngle()/180*Math.PI,c.sweep(),this.strokeWidth/2)?!0:this.text.inShape(e,r)}updateBox(){return this.text.updateBox(),this._bbox=wIe(this.center,this.end1,this.end2,this.text,this.strokeWidth),this._bbox}getBaseGraphics(){let e=kY(this.center,this.end1,this.end2),r=new S(this.text.width,this.text.height).multiply4(this.text.matrix),n=[[Xte(r,this.text.layerId,this.strokeWidth)]];return this.text.outline.forEach(s=>{n.push(s.primitives.map(a=>a.multiply3(this.text.matrix.toMatrix3())))}),e.forEach(s=>{n.push([s])}),n}getDegree(){return{center:this.center,radius:this.strokeWidth/2+.1,width:this.strokeWidth/2}}clone(){this.refreshBBox&&this.updateBox();let e=new o(this._globalIndex,this.layerId,this.strokeWidth,this.fontSize,this._precision,this._center,this.end1,this.end2,this.textPosition,this.locked,this._bbox);return e.number=this.number,e.zIndex=this.zIndex,e}};var vM=class vM extends Ei{static getInstance(){return vM.manager==null&&(vM.manager=new vM),vM.manager}addModel(t){this.map.set(t.globalIndex,t)}addProtractor(t,e,r,i,n,s,a,l,c){let h=a.sub(s).normalize(),u=l.sub(s).normalize(),d=h.add(u).normalize().mul(15);return this._last=new Ap(t,e,r,i,n,s,a,l,s.add(d),c,null),this.lastPrecision=this._last.precision,this.addModel(this._last),this._last}delete(t){t instanceof Ap&&this.map.delete(t.globalIndex)}};vM.manager=null;var Na=vM;function xM(o,t){let e=new M(o,t),r=t.sub(o).normalize(),i=r.rotate(S.ORIGIN,Math.PI/4).mul(3),n=r.rotate(S.ORIGIN,-Math.PI/4).mul(3),s=new M(t,t.sub(n)),a=new M(t,t.sub(i));return[e,s,a]}function gx(o,t,e){let r=t.angle(o),i=t.sub(o).normalize(),n=new S(-i.y,i.x);return r>-Go&&r<Go?t.sub(i.mul(6)).add(n.mul(5)).sub(i.mul(e)):t.sub(i.mul(6)).sub(n.mul(5))}function LIe(o,t,e,r){let i=xM(o,t),n=new _e;for(let s of i)n.ext1(s.bbox());return n.ext7(r/2),n.ext1(e.bbox),n.build1()}function lFe(o,t,e){let r=xM(o,t),i=new _e;for(let n of r)i.ext1(n.bbox());return i.ext7(e/2),i.build1()}var _m=class o extends gy{constructor(e,r,i,n,s,a,l,c,h,u,d,p,m){super();this.modelType="Radius Dimension";let g="R"+zO(l,c,h).toString()+h,{width:y,height:b,path:P}=fd(g,a,s),T=is(r)?9:3,I=NP(n.angle(i));m=m||new Ku(e,r,0,"",!1,g,!0,"default",a,I,u,T,s,!1,0,!1,!1,P,y,b,d),p==null&&(p=LIe(i,n,m,s)),this._globalIndex=e,this._start=i,this._end=n,this._radius=l,this._precision=c,this._unit=h,this._bbox=p,this.text=m}get refreshBBox(){return this.text.refreshBBox}set refreshBBox(e){this.text.refreshBBox=e}get layerId(){return this.text.layerId}set layerId(e){if(this.text.layerId!=e){this.watchLayerIdModify(this.layerId),this.text.layerId=e;let r=is(e)?9:3;this.text.origin!=r&&(this.text.origin=r),this.updateText(),this.layerModified=!0}}get textPosition(){return this.text.position}set textPosition(e){this.text.position!=e&&(this.text.position=e,this.updateShapeData())}get start(){return this._start}set start(e){this._start.equals(e)||(this._start=e,this.updateText(),this.text.position=gx(this.start,this.end,this.text.width),this.updateShapeData())}get end(){return this._end}set end(e){this._end.equals(e)||(this._end=e,this.updateText(),this.text.position=gx(this.start,this.end,this.text.width),this.updateShapeData())}get strokeWidth(){return this.text.strokeWidth}set strokeWidth(e){this.text.strokeWidth!=e&&(this.text.strokeWidth=e,this.updateText())}get fontSize(){return this.text.fontSize}set fontSize(e){this.text.fontSize!=e&&(this.text.fontSize=e,this.updateText(),this.updateShapeData())}get radius(){return this._radius}set radius(e){this._radius!=e&&(this._radius=e,this.updateText(),this.updateShapeData())}get precision(){return this._precision}set precision(e){this._precision!=e&&(this._precision=e,this.updateText(),this.updateShapeData())}get bbox(){return this._bbox}get unit(){return this._unit}set unit(e){this._unit!=e&&(this._unit=e,this.updateText())}get content(){return"R"+zO(this.radius,this.precision,this.unit).toString()+this.unit}get locked(){return this.text.locked}set locked(e){this.text.locked=e}updateText(){let{width:e,height:r,path:i}=fd(this.content,this.fontSize,this.strokeWidth),n=is(this.layerId);this.text.rotation=NP(n?-this.end.angle(this.start):this.end.angle(this.start)),this.text.outline=i,this.text.updateBox4(e,r),this.updateShapeData()}transform(e){let r=this.start.multiply4(e),i=this.end.multiply4(e);this._start=r,this._end=i,this.text.transform(e),this.updateShapeData()}flip(e){this._start=this._start.multiply4(e),this._end=this._end.multiply4(e),this.updateText(),this.text.position=gx(this._start,this._end,this.text.width),this.updateShapeData()}inOutline(e){return this.inShape(e.x,e.y)}inShape(e,r,i){let n=i==null?1:i.getScale(),s=new S(e,r),a=xM(this.start,this.end);for(let l of a)if(Da(s,l.start(),l.end(),this.strokeWidth,n))return!0;return this.text.inShape(e,r)}updateBox(){return this.text.updateBox(),this._bbox=LIe(this.start,this.end,this.text,this.strokeWidth),this._bbox}getBaseGraphics(){let e=[];return this.text.outline.forEach(i=>{e.push(i.primitives.map(n=>n.multiply3(this.text.matrix.toMatrix3())))}),xM(this.start,this.end).forEach(i=>{e.push([i])}),e}clone(){this.refreshBBox&&this.updateBox();let e=new o(this._globalIndex,this.layerId,this._start,this._end,this.strokeWidth,this.fontSize,this._radius,this._precision,this._unit,this.textPosition,this.locked,this._bbox);return e.number=this.number,e.zIndex=this.zIndex,e}};var RM=class RM extends Ei{static getInstance(){return RM.manager==null&&(RM.manager=new RM),RM.manager}addModel(t){this.map.set(t.globalIndex,t)}addRadius(t,e,r,i,n,s,a,l,c,h){let u=gx(r,i,n);return this._last=new _m(t,e,r,i,n,s,a,l,c,u,h),this.lastPrecision=this._last.precision,this.addModel(this._last),this._last}delete(t){t instanceof _m&&this.map.delete(t.globalIndex)}};RM.manager=null;var sl=RM;var IB=class extends Zp{constructor(){super(...arguments);this.attrs=new Array;this.fontSize=6}feed(e){let{id:r,partitionId:i,type:n,layerId:s,unit:a,strokeWidth:l,precision:c,coords:h,locked:u,zIndex:d,number:p,text:m,specialColor:g,groupId:y}=e;this.partition=i,this.index=r,this.type=n,this.zIndex=d,this.number=p,this.partition=i,this.isNumber(s)&&(this.layerId=s),this.unit=a,this.isNumber(l)&&(this.width=l/10),this.isNumber(c)&&(this.precision=c),this.coords=h,this.locked=u,this.groupId=Ca(y),g&&(this.specialColor=ee.of3(g)),m&&(this.fontValue=m.text,this.isNumber(m.fontSize)&&(this.fontSize=Math.abs(m.fontSize/10)),this.isNumber(m.x)&&(this.fontX=m.x/10),this.isNumber(m.y)&&(this.fontY=m.y/10))}check(){return!(!this.layerId||this.precision==null||isNaN(this.precision)||this.width==null||isNaN(this.width)||this.width<=0||this.type!=="ANGLE"&&!(this.unit==="mm"||this.unit==="cm"||this.unit==="inch"||this.unit==="mil")||this.fontValue==null||this.fontSize==null)}getAttrLength(){return this.attrs.length}getCoords(e){let r,i;switch(this.type){case"LENGTH":let n=new S(e[0]/10,e[1]/10);r=new S(e[2]/10,e[3]/10),i=new S(e[4]/10,e[5]/10);let s=new S(e[6]/10,e[7]/10);return{left:n,start:r,end:i,right:s};case"ANGLE":r=new S(e[0]/10,e[1]/10);let a=new S(e[2]/10,e[3]/10);return i=new S(e[4]/10,e[5]/10),{start:r,center:a,end:i};case"RADIUS":i=new S(e[0]/10,e[1]/10),r=new S(e[2]/10,e[3]/10);let l=e[4]/10;return{end:i,start:r,radius:l}}}finish(){let e,r,i,n,s,a=this.fontSize,l,c=this.groupId,h=this.getCoords(this.coords);switch(this.type){case"LENGTH":return r=h.left,e=h.start,n=h.end,i=h.right,l=this.resultNeedToBeCached?Ma.getInstance().addDimension(this.index,this.layerId,e,n,r,i,this.precision,a,this.width,this.unit,this.locked):new Am(this.index,this.layerId,e,n,r,i,this.precision,a,this.width,this.unit,this.locked),this.specialColor!=null&&(l.silkColor=this.specialColor),c!=null&&l.setGroupID(c),this.isNumber(this.zIndex)&&(l.zIndex=this.zIndex),this.isNumber(this.number)&&(l.number=this.number),this.partition&&(l.partition=this.partition),l;case"ANGLE":let u=this.getTextPosition();e=h.start,s=h.center,n=h.end;let d=e.sub(s).normalize(),p=n.sub(s).normalize(),m=d.add(p).normalize().mul(15);return l=this.resultNeedToBeCached?Na.getInstance().addProtractor(this.index,this.layerId,this.width,a,this.precision,s,e,n,this.locked):new Ap(this.index,this.layerId,this.width,a,this.precision,s,e,n,s.add(m),this.locked),u!=null&&(l.textPosition=u),this.specialColor!=null&&(l.silkColor=this.specialColor),c!=null&&l.setGroupID(c),this.isNumber(this.zIndex)&&(l.zIndex=this.zIndex),this.isNumber(this.number)&&(l.number=this.number),this.partition&&(l.partition=this.partition),l;case"RADIUS":{let g=this.getTextPosition();n=h.end,e=h.start;let y=h.radius,b=this.resultNeedToBeCached?sl.getInstance().addRadius(this.index,this.layerId,e,n,this.width,a,y,this.precision,this.unit,this.locked):new _m(this.index,this.layerId,e,n,this.width,a,y,this.precision,this.unit,gx(e,n,this.width),this.locked);return g!=null&&(b.textPosition=g),this.specialColor!=null&&(b.silkColor=this.specialColor),c!=null&&b.setGroupID(c),this.isNumber(this.zIndex)&&(b.zIndex=this.zIndex),this.isNumber(this.number)&&(b.number=this.number),this.partition&&(b.partition=this.partition),b}}}getTextPosition(){let e=this.fontX,r=this.fontY;return e==null&&(e=S.ORIGIN.x),r==null&&(r=S.ORIGIN.x),new S(e,r)}loadUnit(e){this.model.unit!==e&&(this.model.unit=e)}loadStrokeWidth(e){this.model.strokeWidth!=e&&(this.model.strokeWidth=e)}loadPrecision(e){this.model.precision!=e&&(this.model.precision=e)}loadCoords(e){let r=this.getCoords(e),i;switch(this.type){case"LENGTH":i=this.model,i.left.equals(r.left)||(i.left=r.left),i.start.equals(r.start)||(i.start=r.start),i.end.equals(r.end)||(i.end=r.end),i.right.equals(r.right)||(i.right=r.right);break;case"ANGLE":i=this.model,i.start.equals(r.start)||(i.start=r.start),i.center.equals(r.center)||(i.center=r.center),i.end.equals(r.end)||(i.end=r.end);break;case"RADIUS":i=this.model,i.end.equals(r.end)||(i.end=r.end),i.start.equals(r.start)||(i.start=r.start),i.radius!==r.radius&&(i.radius=r.radius);break}}loadFontGroupId(e){e!=null&&this.model.text.getGroupID()!=e&&this.model.text.setGroupID(e)}loadFontPosition(e){this.model.textPosition.equals(e)||(this.model.textPosition=e)}loadFontValue(e){this.model.text.value!=e&&(this.model.text.value=e)}loadFontSize(e){this.model.fontSize!=e&&(this.model.fontSize=e)}loadFontWidth(e){this.model.text.strokeWidth!=e&&(this.model.text.strokeWidth=e)}load(){this.loadPartitionId(this.partition),this.loadLayerId(this.layerId),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),(this.type=="LENGTH"||this.type=="RADIUS")&&this.loadUnit(this.unit),this.loadCoords(this.coords),this.loadStrokeWidth(this.width),this.loadPrecision(this.precision),this.loadFontGroupId(this.groupId),this.loadFontPosition(this.getTextPosition()),this.loadFontValue(this.fontValue),this.loadFontSize(this.fontSize),this.loadSpecialColor(this.specialColor)}loadSpecialColor(e){(this.model.silkColor!=e&&(this.model.silkColor==null||e==null)||this.model.silkColor!=null&&e!=null&&!this.model.silkColor.equals(e))&&(this.model.silkColor=e)}};var CB=class extends Vu{constructor(){super(...arguments);this.connects=new Array}feed(e){let{id:r,partitionId:i,netName:n,layerId:s,path:a,groupId:l,number:c,refs:h,locked:u}=e;this.index=r,this.partition=i,this.groupId=Ca(l),this.net=n,this.number=c,this.isNumber(s)&&(this.layerId=s),this.path=a,this.connects=h||[],this.locked=u}getConnect(){return this.connects}check(){return!(this.index==null||this.net==null||this.layerId==null||this.path==null)}clearGroupId(){this.groupId=null}changeNet4Map(e){let r=e.get(this.net);r!=null&&(this.net=r)}canBuild(){return this.connects.length>0}finish(){if(this.check()){let e=m2(this.path,10);if(!e||!Qh(e.primitives,1e-4))return null;let r=this.resultNeedToBeCached?this.parseShapeModelSimplify(this.index,"TearDrop",this.layerId,this.net,!1,.02,this.path):this.parseShapeModel(this.index,"TearDrop",this.layerId,this.net,!1,.02,this.path);return r==null?null:(r.component=new Sb(this.connects),this.groupId!=null&&r.setGroupID(this.groupId),this.partition&&(r.partition=this.partition),this.isNumber(this.number)&&(r.number=this.number),r.locked=this.locked,r)}}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId),this.loadType("TearDrop"),this.loadLayerId(this.layerId),this.partition!==void 0&&this.loadNet(this.net),this.loadPath(this.path),this.loadConnects(this.connects),this.loadLocked(this.locked)}loadConnects(e){let r=this.model.component;r.connects=e}};var l3=class extends wl{constructor(){super(...arguments);this.width=NaN;this.height=NaN}static getUniqueId(e){let{fontFamily:r,fontSize:i,text:n,bold:s,italic:a,reverse:l,expansion:c}=e;return[r,i,n,s,a,l,c].toString()}feed(e){let{fontFamily:r,fontSize:i,text:n,path:s,width:a,height:l,bold:c,italic:h,reverse:u,expansion:d}=e;this.fontFamily=r,this.text=n,this.path=s,this.width=a/10,this.height=l/10,this.fontSize=Math.abs(i),this.bold=c,this.italic=h,this.reverse=u,this.expansion=d}get hashkey(){return null}setText(e){this.text=e}clear(){this.fontFamily=null,this.text=null,this.path=null,this.width=null,this.height=null,this.fontSize=null,this.bold=null,this.italic=null,this.reverse=null,this.expansion=null,this.model=null}check(){return!(!this.width==null||!this.height==null||!this.fontFamily==null||!this.text==null||!this.fontSize==null||!this.reverse==null||!this.expansion==null||!this.bold==null||!this.italic==null||!this.path==null)}finish(){Array.isArray(this.path)&&this.path.length>0&&py.getInstance().getFontCache(this.fontFamily,this.text,this.fontSize,this.reverse,this.expansion,this.bold,this.italic)==null&&py.getInstance().addFontCache(this.fontFamily,this.text,this.fontSize,this.reverse,this.expansion,this.width,this.height,Jh(this.path),this.bold,this.italic)}load(){let e=py.getInstance().getFontCache(this.fontFamily,this.text,this.fontSize,this.reverse,this.expansion,this.bold,this.italic);e!=null?JSON.stringify(e.outline)!=JSON.stringify(this.path)&&py.getInstance().addFontCache(this.fontFamily,this.text,this.fontSize,this.reverse,this.expansion,this.width,this.height,Jh(this.path),this.bold,this.italic):py.getInstance().addFontCache(this.fontFamily,this.text,this.fontSize,this.reverse,this.expansion,this.width,this.height,Jh(this.path),this.bold,this.italic)}};var SB=class extends Vu{constructor(){super(...arguments);this.locked=!1}feed(e){let{id:r,partitionId:i,groupId:n,shellType:s,shellHeight:a,pcbHeight:l,strokeWidth:c,path:h,locked:u,zIndex:d,number:p}=e;this.index=r,this.partition=i,this.groupId=Ca(n),this.type=v8e(s),this.zIndex=d,this.number=p,this.isNumber(a)&&(this.shellHeight=a/10),this.isNumber(l)&&(this.pcbHeight=l/10),this.path=h,this.parseAttr(e),this.locked=u}parseAttr(e){let r=e.thickness,i=e.bottomHeight,n=e.topInnerHeight,s=e.bottomInnerHeight,a=R8e(e.direction),l=r/10,c=i/10,h=n/10,u=s/10;this.isNumber(r)&&(this.thickness=l),this.isNumber(i)&&(this.botHeight=c),isNaN(a)||(this.pushCoverDir=a),this.isNumber(n)&&(this.topInnerHeight=h),this.isNumber(s)&&(this.bottomInnerHeight=u)}check(){return this.index==null||this.groupId===void 0||this.type==null||this.shellHeight==null||isNaN(this.shellHeight)||(this.shellHeight<cb&&(this.shellHeight=cb),this.pcbHeight==null||isNaN(this.pcbHeight))||this.thickness==null||this.path==null||this.locked==null?!1:(this.type==="T&B"&&(this.botHeight==null||this.botHeight<cb)&&(this.botHeight=cb),!0)}clearGroupId(){this.groupId=null}getComponent(e){let r={};r.type=this.type,(e instanceof ss||e instanceof yo)&&r.type==="DRAWER"&&(r.type="T&B"),r.shellHeight=this.shellHeight,this.pcbHeight!=null&&(r.substrateHeight=this.pcbHeight),r.shellThickness=this.thickness,this.botHeight!=null&&(r.botShellHeight=this.botHeight);let{type:i,shellHeight:n,substrateHeight:s,botShellHeight:a,shellThickness:l}=r,c=new y0(i,n,s,a,l);return this.pushCoverDir!=null&&(c.pushCoverDir=this.pushCoverDir),this.topInnerHeight!=null&&(c.topInnerHeight=this.topInnerHeight),this.bottomInnerHeight!=null&&(c.bottomInnerHeight=this.bottomInnerHeight),c}finish(){if(this.check()){Array.isArray(this.path)&&Array.isArray(this.path[0])&&(this.path=this.path[0]);let e=this.thickness,r=this.parseShapeModel(this.index,"3D Shell - Outline",53,"",this.locked,e,this.path);return r==null?null:(r.component=this.getComponent(r),this.groupId!=null&&r.setGroupID(this.groupId),this.partition&&(r.partition=this.partition),this.isNumber(this.zIndex)&&(r.zIndex=this.zIndex),this.isNumber(this.number)&&(r.number=this.number),r)}else return null}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId);let e=this.getComponent(this.model);this.loadType("3D Shell - Outline"),this.loadLayerId(53),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadPath(this.path),this.loadComponent(e)}};var EB=class extends Vu{constructor(){super(...arguments);this.locked=!1}feed(e){let{id:r,partitionId:i,groupId:n,layerId:s,depth:a,strokeWidth:l,path:c,locked:h,zIndex:u,number:d,refs:p}=e;this.index=r,this.partition=i,this.groupId=Ca(n);let m=s;this.zIndex=u,this.number=d,this.isNumber(m)&&(this.layerId=m),this.isNumber(a)&&(this.depth=a/10),this.isNumber(l)&&(this.strokeWidth=l/10),this.path=c,this.locked=h,p&&(this.refs=p)}check(){return!(this.index==null||this.groupId===void 0||this.path==null||this.layerId==null||this.depth==null||this.strokeWidth==null||this.locked==null)}clearGroupId(){this.groupId=null}getComponent(){var i;let e=[4,8,16];return new wh("Top",this.depth,e,((i=this.refs)==null?void 0:i[0])||"")}finish(){if(this.check()){Array.isArray(this.path)&&Array.isArray(this.path[0])&&(this.path=this.path[0]);let e=this.parseShapeModel(this.index,"3D Shell - Top Slot Region",this.layerId,"",this.locked,this.strokeWidth,this.path);if(e==null)return null;let r=this.getComponent();return this.resultNeedToBeCached&&r.lineId!=""&&La.getInstance().addConnectRelatedId(r.lineId,e.globalIndex),e.component=r,this.groupId!=null&&e.setGroupID(this.groupId),this.partition&&(e.partition=this.partition),this.isNumber(this.zIndex)&&(e.zIndex=this.zIndex),this.isNumber(this.number)&&(e.number=this.number),e}else return null}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId);let e=this.getComponent();this.loadType("3D Shell - Top Slot Region"),this.loadLayerId(this.layerId),this.loadWidth(this.strokeWidth),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadPath(this.path),this.loadComponent(e)}};var OB=class extends Vu{constructor(){super(...arguments);this.locked=!1}feed(e){let{id:r,partitionId:i,groupId:n,layerId:s,depth:a,strokeWidth:l,path:c,locked:h,zIndex:u,number:d,refs:p,type:m,entityBelong:g,slotOptions:y}=e;this.index=r,this.partition=i,this.groupId=Ca(n),this.zIndex=u,this.number=d,this.isNumber(s)&&(this.layerId=s),this.isEntity=m==ON.ENTITY,this.isEntity?this.belong=this.getBelong(g):y?(this.slotOptions=[],y.forEach(b=>{this.slotOptions.push(this.getSlotOption(b))})):this.slotOptions=oFe,this.isNumber(a)&&(this.depth=a/10),this.isNumber(l)&&(this.strokeWidth=l/10),this.path=c,this.locked=h,p&&(this.refs=p)}getBelong(e){switch(e){case dO.AUTO:return 0;case dO.LOWER_SHELLS:return 2;case dO.UPPER_SHELLS:return 1}}getSlotOption(e){switch(e){case pO.ENTITY:return 16;case pO.OUTLINE:return 4;case pO.SCREW_PILLAR:return 8}}check(){return!(this.index==null||this.groupId===void 0||this.path==null||this.layerId==null||this.isEntity==null||this.depth==null||this.strokeWidth==null||this.locked==null)}clearGroupId(){this.groupId=null}getType(){let e=this.refs[0];return this.isEntity?e?"3D Shell - Side Entity":"3D Shell - Top/Bottom Entity":e?"3D Shell - Side Slot Region":"3D Shell - Top Slot Region"}finish(){if(this.check()){Array.isArray(this.path)&&Array.isArray(this.path[0])&&(this.path=this.path[0]);let e=this.getType(),r=this.parseShapeModel(this.index,e,this.layerId,"",this.locked,this.strokeWidth,this.path);if(r==null)return null;this.isNumber(this.zIndex)&&(r.zIndex=this.zIndex),this.isNumber(this.number)&&(r.number=this.number);let i=this.createComponentModel();return r.component=i,this.resultNeedToBeCached&&i.lineId!=""&&La.getInstance().addConnectRelatedId(i.lineId,r.globalIndex),r.setGroupID(this.groupId),r}else return null}createComponentModel(){var r;let e=((r=this.refs)==null?void 0:r[0])||"";return this.isEntity?new ml(e?"side":"top_bottom",this.depth,e,this.belong):new wh(e?"Side":"Top",this.depth,this.slotOptions,e)}load(){this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId);let e=this.createComponentModel(),r=this.getType();this.loadType(r),this.loadLayerId(this.layerId),this.loadWidth(this.strokeWidth),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadPath(this.path),this.loadComponent(e)}};var AB=class extends Vu{constructor(){super(...arguments);this.start=S.ORIGIN;this.end=S.ORIGIN;this.locked=!1}feed(e){let{id:r,partitionId:i,groupId:n,layerId:s,startX:a,startY:l,endX:c,endY:h,angle:u,locked:d,zIndex:p,number:m}=e;this.index=r,this.partition=i,this.groupId=Ca(n),this.zIndex=p,this.number=m,this.isNumber(s)&&(this.layerId=s),this.isNumber(a)&&this.isNumber(l)&&(this.start=new S(a/10,l/10)),this.isNumber(c)&&this.isNumber(h)&&(this.end=new S(c/10,h/10)),this.isNumber(u)&&(this.angle=u/180*Math.PI),this.locked=d}check(){return!(!this.index||this.groupId===void 0||!this.layerId||this.angle==null||isNaN(this.angle)||this.locked==null)}clearGroupId(){this.groupId=null}finish(){if(this.check()){let e=this.index+nr(),r=new wc(e,this.start,this.end,{layerId:this.layerId,strokeWidth:1,locked:this.locked}),i=vi.getInstance().addPolygon(this.index,"3D Shell - Side Datum Line",this.layerId,[[r]],1,null,this.locked,null,null);return this.groupId!=null&&i.setGroupID(this.groupId),this.partition&&(i.partition=this.partition),this.isNumber(this.zIndex)&&(i.zIndex=this.zIndex),this.isNumber(this.number)&&(i.number=this.number),i}else return null}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId),this.loadType("3D Shell - Side Datum Line"),this.loadLayerId(this.layerId),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadPath([[ve(this.start.x*10,4),ve(this.start.y*10,4),"L",ve(this.end.x*10,4),ve(this.end.y*10,4)]])}};var _B=class extends Vu{constructor(){super(...arguments);this.center=S.ORIGIN;this.counterbore=null;this.stiffener=null;this.locked=!1;this.needCounterbore=!1;this.needStiffener=!1}feed(e){let{id:r,partitionId:i,groupId:n,layerId:s,centerX:a,centerY:l,specification:c,depth:h,thickness:u,holeDiameter:d,counterBore:p,stiffener:m,locked:g,zIndex:y,number:b}=e;this.index=r,this.groupId=Ca(n),this.zIndex=y,this.number=b,this.partition=i,this.isNumber(s)&&(this.layerId=s),this.isNumber(a)&&this.isNumber(l)&&(this.center=new S(a/10,l/10));let P=A8e(c);P&&!["M2","M3","M4","M5","M6"].includes(P)&&(P="M2"),this.specification=P||"Custom",this.isNumber(h)&&(this.depth=h/10),this.isNumber(u)&&(this.thickness=u/10),this.isNumber(d)&&(this.holeDiameter=d/10),this.parseCounterBore(p),this.parseStiffener(m),this.locked=g}parseCounterBore(e){this.needCounterbore=!!e,e&&(this.counterbore={height:e.height/10,diameter:e.diameter/10})}parseStiffener(e){if(this.needStiffener=!!e,e){let{topWidth:r,bottomWidth:i,height:n,stiffThickness:s}=e;this.stiffener={topWidth:r/10,bottomWidth:i/10,height:n/10,stiffThickness:s/10}}}check(){if(this.index==null||this.layerId==null||this.specification==null||this.center==null||this.depth==null||isNaN(this.depth)||(this.depth<cb&&(this.depth=cb),this.locked==null))return!1;if(this.specification=="Custom"){if(!oh(this.holeDiameter)||!oh(this.thickness))return!1;this.needStiffener&&!this.stiffener&&(this.needStiffener=!1),this.needCounterbore&&!this.counterbore&&(this.needCounterbore=!1)}return!0}clearGroupId(){this.groupId=null}getComponent(){let e=new Rf(this.specification,this.depth);e.specification=this.specification,xP.updatePropsBySpecification(e,this.specification,this.needStiffener,this.needCounterbore),e.height=this.depth,oh(this.thickness)&&(e.thickness=this.thickness),oh(this.holeDiameter)&&(e.holeDiameter=this.holeDiameter),this.needCounterbore?this.counterbore&&(e.counterboreProps=this.counterbore):e.counterboreProps=null,this.needStiffener?this.stiffener&&(e.stiffenerProps=this.stiffener):e.stiffenerProps=null;let r=xP.getScrewPillarSize(e);return e}finish(){if(this.check()){let e=Fi.getInstance().addCircle(this.index,"3D Shell - Screw Pillar",this.layerId,this.center,.1,1,this.locked,null);this.isNumber(this.zIndex)&&(e.zIndex=this.zIndex),this.isNumber(this.number)&&(e.number=this.number);let r=this.getComponent();e.component=r,e.setGroupID(this.groupId);let i=xP.getScrewPillarSize(r);return e.radius=i.outerRadius,e}else return null}load(){this.loadPartitionId(this.partition),this.loadGroupId(this.groupId),this.loadPourOrder(this.layerId);let e=this.getComponent();this.loadType("3D Shell - Screw Pillar"),this.loadLayerId(this.layerId),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadComponent(e),this.loadCenter(this.center)}loadCenter(e){this.model.center.equals(e)||(this.model.center=e)}};var Ff=class extends lx{constructor(){super(...arguments);this.modelType="Picture"}get hashIdModified(){return this.hasDataState(7)}set hashIdModified(e){this.setDataState(7,e)}needMirror(){return oc(this.layerId,this.mirror)}};function VY(o){switch(o){case 3:case 4:case 13:return o;default:return 3}}var vB=class o extends Ff{constructor(e,r,i,n,s,a,l,c,h,u,d){super();this.modelType="Picture";this._globalIndex=e,this._start=i,this._width=n,this._height=s,this._rotation=a,this._mirror=l,this._hashId=c;let p=oc(r,l);if(!d){let m=Ae.translate(0,-s,0).rotateZ(a).scale(p?-1:1,1,1).translate1(i.x,i.y,0);d=new bs(r,S.ORIGIN,new S(0,s),new S(n,0),new S(n,s),h,u),d.transform(m),d.updateBox()}this.box=d}get hashId(){return this._hashId}set hashId(e){this._hashId!=e&&(this._hashId=e,this.hashIdModified=!0)}get layerId(){return this.box.layerId}set layerId(e){this.layerId!=e&&(this.watchLayerIdModify(this.layerId),this.box.layerId=e,this.reset4Matrix(this.matrix),this.layerModified=!0)}get start(){return this._start}set start(e){this._start!=e&&(this._start=e,this.reset4Matrix(this.matrix))}get width(){return this._width}set width(e){this._width!=e&&(this._width=e,this.reset4(this.width,this.height,this.matrix))}get height(){return this._height}set height(e){this._height!=e&&(this._height=e,this.reset4(this.width,this.height,this.matrix))}get rotation(){return this._rotation}set rotation(e){this._rotation!=e&&(this._rotation=e,this.reset4Matrix(this.matrix))}set mirror(e){this._mirror!=e&&(this._mirror=e,this.reset4Matrix(this.matrix))}get mirror(){return this._mirror}get center(){return this.box.center}set center(e){let r=e.sub(this.center),i=Ae.translate(r.x,r.y,0);this.transform(i)}get bbox(){return this.box.bbox}get locked(){return this.box.locked}set locked(e){this.box.locked=e}get hashIdModified(){return this.hasDataState(7)}set hashIdModified(e){this.setDataState(7,e)}get matrix(){let e=oc(this.layerId,this.mirror);return Ae.rotateZ(this.rotation).scale(e?-1:1,1,1).translate1(this.start.x,this.start.y,0)}transform(e){let r=new S(e.data[0],e.data[1]).normalize(),i=Math.atan2(r.y,r.x);oc(this.layerId,this.mirror)?this.rotation-=i:this.rotation+=i,this.start=this.start.multiply4(e)}inShape(e,r,i){return this.box.inShape(e,r,i)}reset4Matrix(e){this.reset4(this.width,this.height,e)}reset4(e,r,i){this.box.leftUp=S.ORIGIN.multiply4(i),this.box.leftLow=new S(0,-r).multiply4(i),this.box.rightLow=new S(e,-r).multiply4(i),this.box.rightUp=new S(e,0).multiply4(i),this.updateShapeData()}updateBox(){return this.box.updateBox()}getMathGraphics(e=this.layerId,r){return this.isEmpty?null:this.box.getMathGraphics(e,r)}needMirror(){return oc(this.layerId,this.mirror)}clone(){this.refreshBBox&&this.updateBox();let e=new o(this.globalIndex,this.layerId,this.start,this.width,this.height,this.rotation,this.mirror,this.hashId,this.locked,this.bbox);return e.number=this.number,e.zIndex=this.zIndex,e}buildBBox(){return this.isEmpty?null:(this.refreshBBox&&(this.updateBox(),this.refreshBBox=!1),this.bbox)}};var wM=class wM extends Ei{static getInstance(){return wM.manager==null&&(wM.manager=new wM),wM.manager}addModel(t){this.map.set(t.globalIndex,t)}addImage(t,e,r,i,n,s,a,l,c){return this._last=new vB(t,VY(e),r,i,n,s,a,c,l,void 0),this.addModel(this._last),this._last}delete(t,e){t instanceof Ff&&this.map.delete(e)}};wM.manager=null;var _p=wM;var xB=class extends yB{constructor(){super();this.start=S.ORIGIN}getPath(){return this.path}feed(e){let{id:r,partitionId:i,groupId:n,layerId:s,fileName:a,startX:l,startY:c,width:h,height:u,angle:d,mirror:p,path:m,locked:g,zIndex:y,number:b}=e;this.index=r,this.partition=i,this.groupId=Ca(n),this.zIndex=y,this.number=b,this.isNumber(s)&&(this.layerId=s),this.fileName=a,this.isNumber(l)&&this.isNumber(c)&&(this.start=new S(l/10,c/10)),this.isNumber(h)&&(this.width=h/10),this.isNumber(u)&&(this.height=u/10),this.isNumber(d)&&(this.angle=d/180*Math.PI),this.mirror=p;let P=m.split("blob:").pop();this.hashId=P,this.locked=g,this.path=m}check(){return!(!this.index||this.groupId===void 0||!this.layerId||this.width==null||isNaN(this.width)||this.width<=0||this.height==null||isNaN(this.height)||this.height<=0||this.locked==null||this.angle==null||isNaN(this.angle))}clearGroupId(){this.groupId=null}finish(){let e=this.hashId,r=this.resultNeedToBeCached?_p.getInstance().addImage(this.index,this.layerId,this.start,this.width,this.height,this.angle,this.mirror,this.locked,e):new vB(this.index,this.layerId,this.start,this.width,this.height,this.angle,this.mirror,e,this.locked);return this.groupId!=null&&r.setGroupID(this.groupId),this.partition&&(r.partition=this.partition),this.isNumber(this.zIndex)&&(r.zIndex=this.zIndex),this.isNumber(this.number)&&(r.number=this.number),r}loadHash(e){this.model.hashId!==e&&(this.model.hashId=e)}load(){this.loadPartitionId(this.partition),this.loadLayerId(this.layerId),this.loadLocked(this.locked),this.loadzIndex(this.zIndex),this.loadStart(this.start),this.loadWidth(this.width),this.loadHeight(this.height),this.loadAngle(this.angle),this.loadMirror(this.mirror),this.loadHash(this.hashId)}};var qte=class extends wl{get hashkey(){return this.name}feed(t){this.name=t.name}check(){return this.name!==void 0}finish(){this.name!=null&&re.getInstance().setRuleTemplateName(this.name)}load(){if(!this.resultNeedToBeCached)return;re.getInstance().getRuleTemplateName()!==this.name&&re.getInstance().setRuleTemplateName(this.name)}};var yx=class extends wl{constructor(){super(...arguments);this.netModifyInter=null}get hashkey(){return this.parentIndex+"|"+this.id+"|"+this.num}getPadId(){return`${this.parentIndex}${this.id}`}feed(e){let{componentId:r,padNum:i,padNet:n,padId:s,partitionId:a,padLen:l,attrsMap:c}=e;this.parentIndex=r,this.partition=a,this.num=i,this.net=n,this.id=s,this.isNumber(l)&&(this.padLen=l/10),this.attrsMap=c||{}}check(){return!(this.parentIndex==null||this.num==null||this.net==null)}finish(){}loadPadNet(e,r,i){if(!this.model)return;r=this.parentIndex+r,this.model.modelType=="Via"&&(e=r);let n=this.parentModel.isCachePadNet()?this.parentModel.getNet(e,r):this.model.net;n!=i&&(this.netModifyInter!=null&&this.netModifyInter.addNetModify(n,this.model),this.parentModel.isCachePadNet()&&this.parentModel.setNet(e,r,i),this.model.net=i)}loadPadLen(e,r,i){$o.getInstance().setPadLen(e,`${e}${r}`,i)}loadPadAttr(e){if(this.model&&this.model.modelType=="Pad")for(let r in e){let i=e[r];this.model.addATTRMap(r,i)}}load(){this.loadPadNet(this.num,this.id,this.net),this.loadPadLen(this.parentIndex,this.id,this.padLen),this.loadPadAttr(this.attrsMap)}};var $te=class extends wl{constructor(){super(),this.padsPairs=[]}get hashkey(){return this.index}get sort(){return this._sort}feed(t){let{id:e,name:r,sort:i,pads:n}=t;this.index=e,this.groupName=r,this.number=e,this.padsPairs=n,this._sort=i}check(){return!(!this.number||!this.groupName)}updateDetails(t,e){let r=[];for(let i=0;i<e.length;i++){let n=e[i];r.push(new Em(n[0],n[1]))}r.length&&t.updatePadsPairGroupDetails(r)}finish(){let t=re.getInstance(),e=t.getPadsPairGroupItemByGroupName(this.groupName);return e||(e=t.addPadsPairGroup(this.groupName)),this.updateDetails(e,this.padsPairs),this.groupColor&&(e.groupColor=this.groupColor),this.index&&(e.number=this.index),e}loadPadsPairs(t){let e=[];for(let r of this.model.details)e.push([r.pad1Title,r.pad2Title]);JSON.stringify(e)!==JSON.stringify(t)&&this.updateDetails(this.model,t)}loadGroupColor(t){this.model.groupColor!==t&&(this.model.groupColor=t)}load(){this.loadPadsPairs(this.padsPairs),this.loadGroupColor(this.groupColor)}};var Kte=class{constructor(){this.init=!1;this.defaultSafeData=null;this.defaultCopperSpace=null;this.defaultInnerSpace=null;this.copperChangeMap=new Map;this.innerChangeMap=new Map}addDefaultSafeSpaceData(t){this.init=!0,this.defaultSafeData=t}addDefaultCopperSpace(t,e){this.defaultCopperSpace={netClearance:t,boardClearance:e}}addDefaultInnerSpace(t,e){this.defaultInnerSpace={netClearance:t,boardClearance:e}}getNewDefaultData(t,e){if(t&&this.defaultSafeData==null||!t&&this.defaultInnerSpace==null)return null;let r=t?this.copperChangeMap.get(e):this.innerChangeMap.get(e);if(r==null)return null;let{netClearance:i,boardClearance:n}=r,s=this.defaultSafeData.safeSpacing[0].content,a=new Array(s.length);for(let l=0;l<s.length;l++)a[l]=Array.from(s[l]);return this.updateSafeData(a,i,n),a}fixSafeData(t){if(this.defaultCopperSpace!=null)for(let e of t.safeSpacing)this.updateSafeData(e.content,this.defaultCopperSpace.netClearance,this.defaultCopperSpace.netClearance)}updateSafeData(t,e,r){for(let i=0;i<t.length;i++){let n=t[i];for(let s=0;s<n.length;s++)i==7?s==11||s==8?n[s]=r:n[s]=e:s==7&&(i==11||i==8?n[s]=r:n[s]=e)}}addCopper2SafeChangeMap(t,e,r,i,n){this.copperChangeMap.set(t,{name:e,isDefault:r,netClearance:i,boardClearance:n})}addInner2SafeChangeMap(t,e,r,i,n){this.innerChangeMap.set(t,{name:e,isDefault:r,netClearance:i,boardClearance:n})}getSafeName4Copper(t){var e;return(e=this.copperChangeMap.get(t))==null?void 0:e.name}getSafeName4Plane(t){var e;return(e=this.innerChangeMap.get(t))==null?void 0:e.name}getDefaultCopper(){for(let[,t]of this.copperChangeMap)if(t.isDefault)return t.name;return null}getDefaultPlane(){for(let[,t]of this.innerChangeMap)if(t.isDefault)return t.name;return null}};var Zte=class{constructor(t,e,r){this._hashId=t,this._source=r,this._fileName=e}get fileName(){return this._fileName}get hashId(){return this._hashId}get source(){return this._source}};var MIe=class extends Ei{addTemplate(t,e,r){let i=this.getItem(t);return i||(i=new Zte(t,e,r),this.map.set(t,i)),i}},qd=new MIe;async function RB(o){if(!o)return;let t=[];for(let e of o){if(qd.getItem(e.hashId))continue;let r=new Promise((i,n)=>{let{hashId:s,dataUrl:a,fileName:l}=e,c=new Image;c.src=a,c.onload=()=>{qd.addTemplate(s,l,c),i(!0)},c.onerror=()=>{i(!1)}});t.push(r)}return Promise.all(t)}var Jte=class extends wl{feed(t){this.index=t.id,this.url=t.content,this.fileName=t.filename}check(){return this.url!=null}async finish(){await RB([{hashId:this.index,dataUrl:this.url,fileName:this.fileName}])}};var Qte=class extends Zp{constructor(){super(...arguments);this.coppers=[]}feed(e){let{id:r,fill:i,number:n}=e,s;this.layerId=r;for(let a of i)s=new px,s.feed({...a,number:n,layerId:r,fillStyle:ob.PLANE}),this.coppers.push(s)}get hashkey(){return this.layerId}check(){return!!this.index}finish(){if(this.check())for(let e of this.coppers)e.finish()}};var vm=class{constructor(){this.canvas=new Array;this.layer=new Array;this.layerPhys=new Array;this.activeLayer=new Array;this.net=new Array;this.ruleTemplateName=new Array;this.rule=new Array;this.ruleSelect=new Array;this.padsPairGroup=new Array;this.group=new Array;this.via=new Array;this.pad=new Array;this.line=new Array;this.arc=new Array;this.poly=new Array;this.fill=new Array;this.fpcFill=new Array;this.region=new Array;this.partition=new Array;this.pour=new Array;this.copper=new Array;this.image=new Array;this.tearDrop=new Array;this.font=new Array;this.str=new Array;this.attr=new Array;this.dimension=new Array;this.component=new Array;this.padNet=new Array;this.shells=new Array;this.shellCuts=new Array;this.shellEntity=new Array;this.creases=new Array;this.bosses=new Array;this.objs=new Array;this.blob=new Array;this.reuseBlocks=new Array;this.dimensionAttr=new Array;this.inner=new Array;this.ignoreType=new Set;this.shapeTicketRecode=new Map;this.otherTicketRecode=new Map;this.batch=1;this.index=1;this.ids=null;this._isNew=!0;this.oldTicket=null;this.lastDecodes=new Map}get isNew(){return this._isNew}isShape(t){switch(t){case"HEAD":case"LAYER":case"LAYER_PHYS":case"ACTIVE_LAYER":case"PRIMITIVE":case"RULE_TEMPLATE":case"RULE":case"RULE_SELECTOR":case"PANELIZE":case"SILK_OPTS":case"PREFERENCE":case"CANVAS":case"ATTR":return!1;default:return!0}}delete(t,e,r){this.deleteTicket(t,r,e)}delete2(t,e,r){if(this.deleteTicket(t,r,e))switch(t){case"LINE":case"ARC":Sn.getInstance().deleteById(e);break;case"STRING":io.getInstance().deleteById(e);break}}updateShapeTicket(t,e,r=1){return this.oldTicket=this.shapeTicketRecode.get(t),this.oldTicket==null||Math.abs(this.oldTicket)<e?(this.shapeTicketRecode.set(t,e*r),!0):!1}updateOtherTicket(t,e,r,i=1){let n=this.otherTicketRecode.get(t);n||(n=new Map,this.otherTicketRecode.set(t,n));let s=n.get(e)||0;return r>Math.abs(s)?(n.set(e,r*i),!0):!1}async iterator(t){let e=[[this.canvas,"CANVAS"],[this.layer,"LAYER"],[this.layerPhys,"LAYER_PHYS"],[this.activeLayer,"ACTIVE_LAYER"],[this.net,"NET"],[this.group,"GROUP"],[this.via,"VIA"],[this.pad,"PAD"],[this.line,"LINE"],[this.poly,"POLY"],[this.fill,"FILL"],[this.fpcFill,"FPC_FILL"],[this.region,"REGION"],[this.partition,"PARTITION"],[this.pour,"POUR"],[this.copper,"POURED"],[this.objs,"OBJ"],[this.tearDrop,"TEARDROP"],[this.str,"STRING"],[this.attr,"ATTR"],[this.dimension,"DIMENSION"],[this.component,"COMPONENT"],[this.padNet,"PAD_NET"],[this.ruleTemplateName,"RULE_TEMPLATE"],[this.rule,"RULE"],[this.ruleSelect,"RULE_SELECTOR"],[this.padsPairGroup,"EQLEN_GRP"],[this.shells,"SHELL"],[this.shellCuts,"SHELLCUT"],[this.shellEntity,"SHELL_ENTITY"],[this.creases,"CREASE"],[this.bosses,"BOSS"],[this.reuseBlocks,"REUSE_BLOCK"]];for(let[r,i]of e){let n=this.getTicketRecode(i);if(n==null)continue;let s,a;for(let l=r.length-1;l>=0;l--)s=r[l],a=n.get(s.hashkey),!(a==null||s.ticket>=Math.abs(a))&&r.splice(l,1)}if(t)for(let[r,i]of e)for(let n of r)await t(n)}feed(t,e,r,i=!1){if(this.ignoreType.has(t))return null;let n=this.getDecode(t,i);return n&&(n.ticket=r,n.feed(e)),this.updateTicket(t,r,n),n}feed2(t,e,r){if(this.ignoreType.has(t))return null;if(this.lastDecode=this.lastDecodes.get(t),this.lastDecode||(this.lastDecode=this.getOldDecode(t),this.lastDecodes.set(t,this.lastDecode)),this.lastDecode){if(this.lastDecode.ticket=r,this.lastDecode.feed(e),this.updateTicket(t,r,this.lastDecode))if(this.handleItem&&this.handleItem.length>0){let i=this.lastDecode.finish();for(let n of this.handleItem)n(i)}else this.lastDecode.finish();this.lastDecode.clear()}}getOldDecode(t){switch(t){case"LINE":return new pM;case"ARC":return new dM;case"FONT":return new l3;case"STRING":return new cM;case"PAD":return new AM;case"RULE":return new DY;case"VIA":return new EM}}updateTicket(t,e,r){switch(t){case"VIA":case"PAD":case"LINE":case"CARC":case"ARC":case"POLY":case"FILL":case"FPC_FILL":case"REGION":case"PARTITION":case"POUR":case"IMAGE":case"OBJ":case"TEARDROP":case"STRING":case"ATTR":case"DIMENSION":case"COMPONENT":case"SHELL":case"SHELLCUT":case"SHELL_ENTITY":case"CREASE":case"BOSS":return this.updateShapeTicket(r.index,e);case"POURED":case"GROUP":case"REUSE_BLOCK":case"EQLEN_GRP":case"RULE_TEMPLATE":case"RULE_SELECTOR":case"RULE":case"PAD_NET":case"NET":case"ACTIVE_LAYER":case"LAYER_PHYS":case"LAYER":case"BLOB":case"INNER":return this.updateOtherTicket(t,r.hashkey,e);default:return!0}}deleteTicket(t,e,r){switch(t){case"VIA":case"PAD":case"LINE":case"CARC":case"ARC":case"POLY":case"FILL":case"FPC_FILL":case"REGION":case"PARTITION":case"POUR":case"IMAGE":case"OBJ":case"TEARDROP":case"STRING":case"ATTR":case"DIMENSION":case"COMPONENT":case"SHELL":case"SHELLCUT":case"SHELL_ENTITY":case"CREASE":case"BOSS":return this.updateShapeTicket(r,e,-1);case"POURED":case"GROUP":case"REUSE_BLOCK":case"EQLEN_GRP":case"RULE_TEMPLATE":case"RULE_SELECTOR":case"RULE":case"PAD_NET":case"NET":case"ACTIVE_LAYER":case"LAYER_PHYS":case"LAYER":case"BLOB":case"INNER":return this.updateOtherTicket(t,r,e,-1);default:return!0}}getDeletedIds(){let t=new Array;for(let[e,r]of this.shapeTicketRecode)r<0&&t.push(e.toString());for(let[e,r]of this.otherTicketRecode)for(let[i,n]of r)n<0&&t.push(i.toString());return t}getTicketRecode(t){switch(t){case"VIA":case"PAD":case"LINE":case"CARC":case"ARC":case"POLY":case"FILL":case"FPC_FILL":case"REGION":case"PARTITION":case"POUR":case"IMAGE":case"OBJ":case"TEARDROP":case"STRING":case"ATTR":case"DIMENSION":case"COMPONENT":case"SHELL":case"SHELLCUT":case"SHELL_ENTITY":case"CREASE":case"BOSS":return this.shapeTicketRecode;case"POURED":case"GROUP":case"REUSE_BLOCK":case"EQLEN_GRP":case"RULE_TEMPLATE":case"RULE_SELECTOR":case"RULE":case"PAD_NET":case"NET":case"ACTIVE_LAYER":case"LAYER_PHYS":case"LAYER":case"BLOB":case"FONT":return this.otherTicketRecode.get(t);default:return null}}parse(t,e,r,i,n){return this.isShape(t)&&(this._isNew=!1),i&&(e.id=i,e.number=n),this.ids&&this.ids.add(i),this.feed(t,e,r)}parse2(t,e,r,i,n){return this.isShape(t)&&(this._isNew=!1),i&&(e.id=i,e.number=n),this.ids&&this.ids.add(i),this.feed2(t,e,r)}clientParse(t,e,r,i,n){return i!=null&&(e.id=i),n!=null&&(e.number=n),this.feed(t,e,r,!0)}getDecode(t,e=!1){switch(t){case"BLOB":{let r=new Jte;return!e&&this.blob.push(r),r}case"CANVAS":{let r=new Bte;return!e&&this.canvas.push(r),r}case"LAYER":{let r=new wte;return!e&&this.layer.push(r),r}case"LAYER_PHYS":{let r=new Lte;return!e&&this.layerPhys.push(r),r}case"ACTIVE_LAYER":{let r=new Mte;return!e&&this.activeLayer.push(r),r}case"NET":{let r=new Wte;return!e&&this.net.push(r),r}case"GROUP":{let r=new zte;return!e&&this.group.push(r),r}case"VIA":{let r=new EM;return!e&&this.via.push(r),r}case"PAD":{let r=new AM;return!e&&this.pad.push(r),r}case"LINE":{let r=new pM;return!e&&this.line.push(r),r}case"ARC":{let r=new dM;return!e&&this.arc.push(r),r}case"POLY":{let r=new dB;return!e&&this.poly.push(r),r}case"FILL":{let r=new px;return!e&&this.fill.push(r),r}case"FPC_FILL":{let r=new pB;return!e&&this.fpcFill.push(r),r}case"REGION":{let r=new fB;return!e&&this.region.push(r),r}case"PARTITION":{let r=new mB;return!e&&this.partition.push(r),r}case"POUR":{let r=new gB;return!e&&this.pour.push(r),r}case"POURED":{let r=new Hte;return!e&&this.copper.push(r),r}case"IMAGE":{let r=new bB;return!e&&this.image.push(r),r}case"OBJ":{let r=new xB;return!e&&this.objs.push(r),r}case"TEARDROP":{let r=new CB;return!e&&this.tearDrop.push(r),r}case"STRING":{let r=new cM;return!e&&this.str.push(r),r}case"FONT":{let r=new l3;return!e&&this.font.push(r),r}case"ATTR":{let r=new uI;return!e&&this.attr.push(r),r}case"DIMENSION":{let r=new IB;return!e&&this.dimension.push(r),r}case"COMPONENT":{let r=new TB;return!e&&this.component.push(r),r}case"PAD_NET":{let r=new yx;return!e&&this.padNet.push(r),r}case"RULE_TEMPLATE":{let r=new qte;return!e&&this.ruleTemplateName.push(r),r}case"RULE":{let r=new DY;return!e&&this.rule.push(r),r}case"RULE_SELECTOR":{let r=new kte;return!e&&this.ruleSelect.push(r),r}case"EQLEN_GRP":{let r=new $te;return!e&&this.padsPairGroup.push(r),r}case"SHELL":{let r=new SB;return!e&&this.shells.push(r),r}case"SHELLCUT":{let r=new EB;return!e&&this.shellCuts.push(r),r}case"SHELL_ENTITY":{let r=new OB;return!e&&this.shellEntity.push(r),r}case"CREASE":{let r=new AB;return!e&&this.creases.push(r),r}case"BOSS":{let r=new _B;return!e&&this.bosses.push(r),r}case"INNER":{let r=new Qte;return!e&&this.inner.push(r),r}default:return null}}batchs(){this.batchDecode(this.via),this.batchDecode(this.pad),this.batchDecode(this.line),this.batchDecode(this.arc),this.batchDecode(this.poly),this.batchDecode(this.fill),this.batchDecode(this.fpcFill),this.batchDecode(this.region),this.batchDecode(this.partition),this.batchDecode(this.pour),this.batchDecode(this.image),this.batchDecode(this.objs),this.batchDecode(this.tearDrop),this.batchDecode(this.str),this.batchDecode(this.attr),this.batchDecode(this.dimension),this.batchDecode(this.component),this.batchDecode(this.shells),this.batchDecode(this.shellCuts),this.batchDecode(this.shellEntity),this.batchDecode(this.creases),this.batchDecode(this.bosses)}batchDecode(t,e=this.batch){if(this.batch==1)return;let r=t.length,i=Math.ceil(r/e),n=(this.index-1)*i,s=this.index==this.batch?r-n:i,a=n+s,l=t.slice(n,a);t.length=0,xe.addAll(t,l),l.length=0}addIgnoreType(t){this.ignoreType.add(t)}preAdjust(){this.iterator(null),this.shapeTicketRecode.clear(),this.otherTicketRecode.clear();let t=new Map;for(let n of this.component)t.set(n.index,n);let e=new Array;for(let n of this.attr){let s=t.get(n.parentIndex);s!=null?s.addAttribute(n):e.push(n)}this.attr.length=0,xe.addAll(this.attr,e);for(let n of this.padNet){let s=t.get(n.parentIndex);s!=null&&s.addPadNet(n)}this.padNet.length=0;for(let n of this.reuseBlocks){let s=t.get(n.shapeIndex);s!=null&&s.setReuseBlock(n)}t.clear(),Er(this.pour,(n,s)=>n.order-s.order,0,this.pour.length);let r=new Map;for(let n of this.copper){let s=n.index;r.set(s,n)}for(let n of this.pour){let s=n.index,a=r.get(s);a&&n.addCopperDecode(a)}r.clear();let i=new Kte;for(let n of this.rule)n.conver2Obj(i);if(i.init){let n=Array.from(this.rule);for(let s of n){let a=s.getNewRuleDecode(i);a!=null&&this.rule.push(a)}for(let s of this.ruleSelect)s.versionUpgrades(i)}for(let n of this.inner)xe.addAll(this.fill,n.coppers);this.inner.length=0}getItemFormat(t){return this.format[t]}clear(){this.shapeTicketRecode.clear(),this.otherTicketRecode.clear()}};var bx=class{constructor(){this.manager=re.getInstance()}ruleInitAndCheck(){this.manager.correctDefault(),this.manager.correctRuleData(),this.manager.correctRegion()}correctEmptyNet(){let t="default",e=this.manager.getNet("");e!=null&&(e.safeSpacing=t,e.trackPhysics=t,e.differentialPhysics=t,e.netLengthPhysics=t,e.netLengthTolerancePhysics=t,e.blindViaPhysics=t,e.radiusPhysics=t,e.innerPlane=t,e.copperPlane=t,e.solderExpansion=t,e.pasteExpansion=t)}};var cS=class{constructor(t){this._isNew=!0;this.loadFont=!0;this.loadBlob=!0;this.watch=!0;this.mulSelect=!1;this.decode=new vm,this.compiler=t,this.docType=t instanceof gp?3:4}get isNew(){return this._isNew}delete(t,e,r){this.decode.delete(t,e,r)}delete2(t,e,r){this.decode.delete2(t,e,r)}getDecodeTool(){return this.decode}async init(t,e){this.compiler!=null&&(this.compiler.setHandle(t||new s1(this)),await this.compiler.init(this.loadFont,this.loadBlob,this.watch,this.mulSelect,R.getInstance().needNum,e),this.compiler instanceof gp&&(console.time("parseFootAndDevice"),await this.parseFootAndDevice(),console.timeEnd("parseFootAndDevice")))}async parseFootAndDevice(){if(this.docType!=3)return;let t=new Set,e=new Set,r=R.getInstance().compilerChannel;for(let n of this.decode.attr){let s=n.key,a=n.value;if(s=="Device"){if(e.has(a))continue;e.add(a);let l=await Tu.getInstance().add(a,r,this.watch);if(l){let c=l.footprintUUID;c!=null&&c!=""&&t.add(c)}}else s=="Footprint"&&t.add(a)}let i=new Array;for(let n of t)n.indexOf("_")>-1?i.push(Ji.getInstance().addCustomFootprint(n,r,this.watch)):i.push(Ji.getInstance().add(n,r,this.watch));await Promise.all(i)}async footprintIsExist(t){return await this.compiler.footprintIsExist(t)}async getCloneFootprint(t,e){return await Ji.getInstance().cloneFootprint(t,e,this.watch)}async parseObj(){let t=[],e=new Set,r={};for(let i of this.decode.blob)r[i.hashkey]=i;for(let i of this.decode.objs){let a=(i.getPath().match(/blob\:(.*)/)||[])[1];if(a){if(e.has(a))continue;e.add(a);let l=r[a];l&&l.check()&&t.push({hashId:l.index,dataUrl:l.url,fileName:l.fileName})}}await RB(t)}setBatch(t=1,e=1){this.decode.batch=t,this.decode.index=e}setDocType(t){this.docType=t}build(){return this.decode.preAdjust(),this.decode.batchs(),this.batchBuildItems(),!0}parse(t,e,r,i,n){t!=="BLOB"&&t!="FONT"&&(this._isNew=!1),i&&(e.id=i,e.number=n),this.decode.feed(t,e,r)}parse2(t,e,r,i,n){t!=="BLOB"&&t!="FONT"&&(this._isNew=!1),i&&(e.id=i,e.number=n),this.decode.feed2(t,e,r)}batchBuildItems(){this.handleLayers(this.decode.layer,this.decode.layerPhys),this.buildItems(this.decode.layer),this.buildItems(this.decode.layerPhys),this.buildItems(this.decode.net),this.buildItems(this.decode.ruleTemplateName),this.buildItems(this.decode.rule),this.buildItems(this.decode.ruleSelect),this.ruleInitAndCheck(),this.buildItems(this.decode.group),this.buildItems(this.decode.font),this.buildItems(this.decode.via),this.buildItems(this.decode.pad),this.buildItems(this.decode.line),this.buildItems(this.decode.arc),this.buildItems(this.decode.poly),this.buildItems(this.decode.fill),this.buildItems(this.decode.fpcFill),this.buildItems(this.decode.region),this.buildItems(this.decode.partition),this.buildItems(this.decode.pour),this.buildItems(this.decode.copper),this.buildItems(this.decode.image),this.buildItems(this.decode.objs),this.buildItems(this.decode.tearDrop),this.buildItems(this.decode.str),this.docType!=3&&this.buildItems(this.decode.attr),this.buildItems(this.decode.dimension),this.buildItems(this.decode.component),this.buildItems(this.decode.shells),this.buildItems(this.decode.shellCuts),this.buildItems(this.decode.shellEntity),this.buildItems(this.decode.creases),this.buildItems(this.decode.bosses),this.buildItems(this.decode.padsPairGroup),this.buildItems(this.decode.activeLayer),this.filterPlaneLayer()}filterPlaneLayer(){let t=new Set(Ze.getInstance().getAllPlaneLayerIds());if(t.size>0)for(let e of Sn.getInstance().getAllItem())t.has(e.layerId)&&(e.remove(),Sn.getInstance().delete(e,e.globalIndex))}ruleInitAndCheck(){let t=new bx;t.ruleInitAndCheck(),t.correctEmptyNet()}handleLayers(t,e){this.compiler.mgr.layerPhyFix.fix(t,e)}fixRuleSelectorLayers(t,e){this.compiler.mgr.layerPhyFix.fix(t,e)}buildItems(t){if(t){for(let e of t)try{e.finish()}catch(r){console.log(r)}t.length=0}}async parseSourceByCompiler(t,e){if(t==null)return!1;let r=new s1(this);this.compiler.setHandle(r);let i=this.compiler instanceof gp;e&&(t=i?yW("",t,[],[],[],[]):q4e("",t,!1)),this.compiler.consistencyManager.parseFull(t),i&&await this.parseFootAndDevice()}clear(){this.decode.clear()}};var Px=class{constructor(){this.client="";this._ticket=-1}setClient(t){this.client=t}setTicket(t){this._ticket=t}destory(){}needOn(t,e){return!1}onStringNum(t,e){}onAttrNum(t,e){}onPadNet(t,e,r,i){}onDelPadNet(t,e,r,i,n,s){}onComponent(t,e,r,i,n,s){}onDelComponent(t,e,r,i){}onComponentNum(t,e){}onDimensionNum(t,e){}onBossNum(t,e){}onShellEntityNum(t,e){}onShellCutNum(t,e){}onCreaseNum(t,e){}onShellNum(t,e){}onFpcFillNum(t,e){}onTeardropNum(t,e){}onImageNum(t,e){}onPouredNum(t,e){}onPourNum(t,e){}onRegionNum(t,e){}onFillNum(t,e){}onPolyNum(t,e){}onObjNum(t,e){}onArcNum(t,e){}onLineNum(t,e){}onPadNum(t,e){}onViaNum(t,e){}onPartitionNum(t,e){}onBoard(t,e,r,i){}onDelBoard(t,e,r){}};function c3(o,t,e){switch(t){case"Board Outline":case"Line":return R.getInstance().compiler.uploadPoly(o,e);case"Fill Region":case"Slot Region":return R.getInstance().compiler.uploadFill(o,e);case"Prohibited Region":case"Constraint Region":return R.getInstance().compiler.uploadRegion(o,e);case"Copper Region":return R.getInstance().compiler.uploadPour(o,e);case"Partition":return R.getInstance().compiler.uploadPartition(o,e);case"TearDrop":return R.getInstance().compiler.uploadTeardrop(o,e);case"FPC Stiffener":return R.getInstance().compiler.uploadFpcFill(o,e);case"3D Shell - Outline":return R.getInstance().compiler.uploadShell(o,e);case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":return R.getInstance().compiler.uploadShellEntity(o,e);case"3D Shell - Side Datum Line":return R.getInstance().compiler.uploadCrease(o,e);case"3D Shell - Screw Pillar":return R.getInstance().compiler.uploadBoss(o,e);case"Board":return R.getInstance().compiler.uploadBoard(e)}return null}function h3(o,t){switch(t){case"Board Outline":case"Line":return R.getInstance().compiler.deletePoly(o);case"Fill Region":case"Slot Region":return R.getInstance().compiler.deleteFill(o);case"Prohibited Region":case"Constraint Region":return R.getInstance().compiler.deleteRegion(o);case"Copper Region":return R.getInstance().compiler.deletePour(o);case"Partition":return R.getInstance().compiler.deletePartition(o);case"TearDrop":return R.getInstance().compiler.deleteTeardrop(o);case"FPC Stiffener":return R.getInstance().compiler.deleteFpcFill(o);case"3D Shell - Outline":return R.getInstance().compiler.deleteShell(o);case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":return R.getInstance().compiler.deleteShellEntity(o);case"3D Shell - Side Datum Line":return R.getInstance().compiler.deleteCrease(o);case"3D Shell - Screw Pillar":return R.getInstance().compiler.deleteBoss(o);case"Board":return R.getInstance().compiler.deleteBoard()}return null}var s1=class extends Px{constructor(e){super();this.componentTask=new Array;this.blobTask=new Array;this.pcbDecode=e}async awaitPromise(){await Promise.all(this.componentTask),this.componentTask.length=0}async awaitBlobPromise(){await Promise.all(this.blobTask),this.blobTask.length=0}destory(){this.pcbDecode.clear(),this.pcbDecode=null,this.clientTool=null,this.componentTask.length=0,this.blobTask.length=0}setClientTool(e){this.clientTool=e}deleteAll(e){let i=(this.pcbDecode instanceof cS?this.pcbDecode.getDecodeTool():this.pcbDecode).getDeletedIds();for(let n of i){let s=ch(n);if(!(s instanceof Li&&!s.getText())&&s){let a=s.getParent();if(a&&i.includes(a.globalIndex))continue;e(s.globalIndex),this.deleteOne(s)}}}deleteOne(e){let r=R.getInstance().compiler;e instanceof Ct?r.deleteVia(e.globalIndex):e instanceof et?r.deletePad(e.globalIndex):e instanceof zr?r.deleteLine(e.globalIndex):e instanceof Ii?r.deleteArc(e.globalIndex):e instanceof Dl?r.deleteImage(e.globalIndex):e instanceof Ff?r.deleteObj(e.globalIndex):e instanceof Li?e.getText()?r.deleteAttr(e.globalIndex):r.deleteString(e.globalIndex):e instanceof gy?r.deleteDimension(e.globalIndex):e instanceof Bi?r.deleteComponent(e.globalIndex):e instanceof or&&h3(e.globalIndex,e.type)}async setAll(e){await(this.pcbDecode instanceof cS?this.pcbDecode.getDecodeTool():this.pcbDecode).iterator(async i=>{if(!(e&&!e(i)))if(i instanceof EM)this.clientTool.setVia(i);else if(i instanceof AM)this.clientTool.setPad(i);else if(i instanceof yx)this.componentTask.length>0&&await this.awaitPromise(),this.clientTool.setPadNet(i);else if(i instanceof pM)this.clientTool.setLine(i);else if(i instanceof dM)this.clientTool.setArc(i);else if(i instanceof dB)this.clientTool.setPoly(i);else if(i instanceof px)this.clientTool.setFill(i);else if(i instanceof pB)this.clientTool.setFPCFill(i);else if(i instanceof fB)this.clientTool.setRegion(i);else if(i instanceof mB)this.clientTool.setPartition(i);else if(i instanceof gB)this.clientTool.setPour(i);else if(i instanceof bB)this.clientTool.setImage(i);else if(i instanceof xB)this.blobTask.length>0&&await this.awaitBlobPromise(),this.clientTool.setObj(i);else if(i instanceof CB)this.clientTool.setTeardrop(i);else if(i instanceof cM)this.clientTool.setString(i);else if(i instanceof uI){if(!this.clientTool.setAttrSync(i)){let s=this.clientTool.setAttr(i);this.componentTask.push(s),s.then(()=>{let a=this.componentTask.indexOf(s);a>=0&&this.componentTask.splice(a,1)})}}else i instanceof IB?this.clientTool.setDimension(i):i instanceof TB?(this.componentTask.length>0&&await this.awaitPromise(),this.clientTool.setComponent(i)):i instanceof SB?this.clientTool.setSHell(i):i instanceof EB?this.clientTool.setSHellCut(i):i instanceof OB?this.clientTool.setShellEntity(i):i instanceof AB?this.clientTool.setCrease(i):i instanceof _B&&this.clientTool.setBoss(i)})}getDecode(){return this.pcbDecode}onBoard(e,r,i,n){this.pcbDecode.parse("BOARD",e,i)}onDelBoard(e,r,i){this.pcbDecode.delete("BOARD",null,r)}onLayerFill(e,r,i,n,s){n.id=e,this.pcbDecode.parse("INNER",n,i)}onDelLayerFill(e,r,i,n){this.pcbDecode.delete("INNER",e,i)}onBlob(e,r,i,n,s){this.pcbDecode.parse("BLOB",n,i,e)}onDelBlob(e,r,i,n){this.pcbDecode.delete("BLOB",e,i)}onFont(e,r,i,n){let s=l3.getUniqueId(i);this.pcbDecode.parse("FONT",i,r,s)}onDelFont(e,r,i,n){let s=l3.getUniqueId(e);this.pcbDecode.delete("FONT",s,i)}onString(e,r,i,n,s){this.pcbDecode.parse("STRING",s,n,e,r)}onDelString(e,r,i){this.pcbDecode.delete("STRING",e,i)}onAttr(e,r,i,n,s){this.pcbDecode.parse("ATTR",s,n,e,r)}onDelAttr(e,r,i){this.pcbDecode.delete("ATTR",e,i)}onPadNet(e,r,i){this.pcbDecode.parse("PAD_NET",i,r)}onDelPadNet(e,r,i,n,s){this.pcbDecode.delete("PAD_NET",e+"|"+r,s)}onComponent(e,r,i,n,s){this.pcbDecode.parse("COMPONENT",s,n,e,r)}onDelComponent(e,r,i){this.pcbDecode.delete("COMPONENT",e,i)}onPanelize(e,r,i){this.pcbDecode.parse("PANELIZE",i,r)}onDelPanelize(e,r){this.pcbDecode.delete("PANELIZE",null,r)}onRuleSelector(e,r,i){this.pcbDecode.parse("RULE_SELECTOR",i,r)}onDelRuleSelector(e,r,i){this.pcbDecode.delete("RULE_SELECTOR",e.toString(),i)}onRule(e,r,i){this.pcbDecode.parse("RULE",i,r)}onDelRule(e,r,i,n){this.pcbDecode.delete("RULE",[e,r].toString(),n)}onRuleTemplate(e,r,i){this.pcbDecode.parse("RULE_TEMPLATE",i,r)}onDimension(e,r,i,n,s){this.pcbDecode.parse("DIMENSION",s,n,e,r)}onDelDimension(e,r,i){this.pcbDecode.delete("DIMENSION",e,i)}onBoss(e,r,i,n,s){this.pcbDecode.parse("BOSS",s,n,e,r)}onDelBoss(e,r,i){this.pcbDecode.delete("BOSS",e,i)}onShellEntity(e,r,i,n,s){this.pcbDecode.parse("SHELL_ENTITY",s,n,e,r)}onDelShellEntity(e,r,i){this.pcbDecode.delete("SHELL_ENTITY",e,i)}onShellCut(e,r,i,n,s){this.pcbDecode.parse("SHELLCUT",s,n,e,r)}onDelShellCut(e,r,i){this.pcbDecode.delete("SHELLCUT",e,i)}onCrease(e,r,i,n,s){this.pcbDecode.parse("CREASE",s,n,e,r)}onDelCrease(e,r,i){this.pcbDecode.delete("CREASE",e,i)}onShell(e,r,i,n,s){this.pcbDecode.parse("SHELL",s,n,e,r)}onDelShell(e,r,i){this.pcbDecode.delete("SHELL",e,i)}onFpcFill(e,r,i,n,s){this.pcbDecode.parse("FPC_FILL",s,n,e,r)}onDelFpcFill(e,r,i){this.pcbDecode.delete("FPC_FILL",e,i)}onTeardrop(e,r,i,n,s){this.pcbDecode.parse("TEARDROP",s,n,e,r)}onDelTeardrop(e,r,i){this.pcbDecode.delete("TEARDROP",e,i)}onImage(e,r,i,n,s){this.pcbDecode.parse("IMAGE",s,n,e,r)}onDelImage(e,r,i){this.pcbDecode.delete("IMAGE",e,i)}onPoured(e,r,i,n,s){this.pcbDecode.parse("POURED",s,n,e,r)}onDelPoured(e,r,i){this.pcbDecode.delete("POURED",e,i)}onPour(e,r,i,n,s){this.pcbDecode.parse("POUR",s,n,e,r)}onDelPour(e,r,i){this.pcbDecode.delete("POUR",e,i)}onRegion(e,r,i,n,s){this.pcbDecode.parse("REGION",s,n,e,r)}onDelRegion(e,r,i){this.pcbDecode.delete("REGION",e,i)}onFill(e,r,i,n,s){this.pcbDecode.parse("FILL",s,n,e,r)}onDelFill(e,r,i){this.pcbDecode.delete("FILL",e,i)}onPoly(e,r,i,n,s){this.pcbDecode.parse("POLY",s,n,e,r)}onDelPoly(e,r,i){this.pcbDecode.delete("POLY",e,i)}onEQLenGrp(e,r,i,n){this.pcbDecode.parse("EQLEN_GRP",n,i,e)}onDelEQLenGrp(e,r,i){this.pcbDecode.delete("EQLEN_GRP",e,i)}onObj(e,r,i,n,s){this.pcbDecode.parse("OBJ",s,n,e,r)}onDelObj(e,r,i){this.pcbDecode.delete("OBJ",e,i)}onArc(e,r,i,n,s){this.pcbDecode.parse("ARC",s,n,e,r)}onDelArc(e,r,i){this.pcbDecode.delete("ARC",e,i)}onLine(e,r,i,n,s){this.pcbDecode.parse("LINE",s,n,e,r)}onDelLine(e,r,i){this.pcbDecode.delete("LINE",e,i)}onPad(e,r,i,n,s){this.pcbDecode.parse("PAD",s,n,e,r)}onDelPad(e,r,i){this.pcbDecode.delete("PAD",e,i)}onVia(e,r,i,n,s){this.pcbDecode.parse("VIA",s,n,e,r)}onDelVia(e,r,i){this.pcbDecode.delete("VIA",e,i)}onPreference(e,r,i){this.pcbDecode.parse("PREFERENCE",i,r)}onSilkOpts(e,r,i,n){n.layerId=e,this.pcbDecode.parse("SILK_OPTS",n,i)}onDelSilkOpts(e,r,i){this.pcbDecode.delete("SILK_OPTS",e,i)}onGroup(e,r,i,n){this.pcbDecode.parse("GROUP",n,i,e)}onDelGroup(e,r,i){this.pcbDecode.delete("GROUP",e,i)}onPrimitive(e,r,i,n){n.primitiveName=e,this.pcbDecode.parse("PRIMITIVE",n,i)}onDelPrimitive(e,r,i){this.pcbDecode.delete("PRIMITIVE",e,i)}onNet(e,r,i,n){n.netName=e,this.pcbDecode.parse("NET",n,i)}onDelNet(e,r,i){this.pcbDecode.delete("NET",e,i)}onPartition(e,r,i,n,s){this.pcbDecode.parse("PARTITION",s,n,e,r)}onDelPartition(e,r,i){this.pcbDecode.delete("PARTITION",e,i)}onActiveLayer(e,r,i){this.pcbDecode.parse("ACTIVE_LAYER",i,r)}onLayerPhys(e,r,i,n){n.layerId=e,this.pcbDecode.parse("LAYER_PHYS",n,i)}onDelLayerPhys(e,r,i){this.pcbDecode.delete("LAYER_PHYS",e,i)}onLayer(e,r,i,n){n.layerId=e,this.pcbDecode.parse("LAYER",n,i)}onDelLayer(e,r,i){this.pcbDecode.delete("LAYER",e,i)}onCanvas(e,r,i){this.pcbDecode.parse("CANVAS",i,r)}onDocDetail(e,r,i){}},ere=class extends s1{onFont(t,e,r,i){let n=l3.getUniqueId(r);this.pcbDecode.parse2("FONT",r,e,n,void 0)}onDelFont(t,e,r,i){let n=l3.getUniqueId(t);this.pcbDecode.delete2("FONT",n,r)}onString(t,e,r,i,n){this.pcbDecode.parse2("STRING",n,i,t,e)}onDelString(t,e,r){this.pcbDecode.delete2("STRING",t,r)}onArc(t,e,r,i,n){this.pcbDecode.parse2("ARC",n,i,t,e)}onDelArc(t,e,r){this.pcbDecode.delete2("ARC",t,r)}onLine(t,e,r,i,n){this.pcbDecode.parse2("LINE",n,i,t,e)}onDelLine(t,e,r){this.pcbDecode.delete2("LINE",t,r)}};var DB=class o extends hs{constructor(t,e,r){super(),this._globalIndex=t,this.model=e,this._parent=r}get bbox(){return this.updateBox()}get _layerId(){return this._parent._layerId}get position(){return this._parent.position}get rotation(){return this._parent.rotation}get scaleX(){return this._parent.scaleX}get layerId(){return this._parent._layerId}set layerId(t){this._parent.layerId=t}getMatrix(){return Ae.getMatrix4(S.ORIGIN,this.rotation,this.scaleX,this.position)}get start(){return this.model.start.multiply4(this.getMatrix())}set start(t){this.model.start=t}get end(){return this.model.end.multiply4(this.getMatrix())}set end(t){this.model.end=t}get width(){return this.model.width}set width(t){this.model.width=t}get direct(){return this.end.sub(this.start).normalize()}get length(){return this.model.length}set length(t){this.model.length=t}get primitive(){return new M(this.start,this.end)}get center(){return this.start.add(this.end).mul(.5)}get locked(){return this.model.locked}set locked(t){this.model.locked=t}equals(t){return t instanceof hs?this.layerId==t.layerId&&this.width==t.width&&this.start.equals1(t.start)&&this.end.equals1(t.end):!1}inShape(t,e,r){let i=this.getMatrix().inverse(),n=new S(t,e).multiply4(i);return this.model.inShape(n.x,n.y,r)}clone(...t){return new o(this._globalIndex,this.model,this._parent)}transform(t){}updateBox(){let t=this.getMatrix().toMatrix3();return this.model.primitive.multiply3(t).bbox().extendOfSize(this.width)}getMathGraphics(t=this.layerId,e=0){let r=this.model.getMathGraphics(t,e);return r!=null&&(r=r.multiply3(this.getMatrix().toMatrix3())),r}buildBBox(){return this.isEmpty?null:this.updateBox()}};var wB=class o extends Va{constructor(t,e,r){super(),this._globalIndex=t,this.model=e,this._parent=r}get _layerId(){return this._parent._layerId}get position(){return this._parent.position}get rotation(){return this._parent.rotation}get scaleX(){return this._parent.scaleX}get layerId(){return this._parent._layerId}set layerId(t){this._parent.layerId=t}getMatrix(){return Ae.getMatrix4(S.ORIGIN,this.rotation,this.scaleX,this.position)}get center(){return this.model.center.multiply4(this.getMatrix())}set center(t){}get angle(){return this.model.angle}set angle(t){this.model.angle=t}get midPoint(){return this.model.midPoint.multiply4(this.getMatrix())}set midPoint(t){this.model.midPoint=t}get start(){return this.model.start.multiply4(this.getMatrix())}set start(t){this.model.start=t}get end(){return this.model.end.multiply4(this.getMatrix())}set end(t){this.model.end=t}get radius(){return this.model.radius}set radius(t){this.model.radius=t}get startAngle(){return this.scaleX<0?n1(Math.PI-(this.model.startAngle+this.rotation)):n1(this.model.startAngle+this.rotation)}set startAngle(t){this.model.startAngle=t}get endAngle(){return this.scaleX<0?n1(Math.PI-(this.model.endAngle+this.rotation)):n1(this.model.endAngle+this.rotation)}set endAngle(t){this.model.endAngle=t}get primitive(){return this.model.primitive.multiply3(this.getMatrix().toMatrix3())}get arcType(){return this.model.arcType}set arcType(t){}get width(){return this._parent.strokeWidth}set width(t){this._parent.strokeWidth=t}get sweepAngle(){return this.model.sweepAngle}get sweep(){return this.scaleX<0?this.model.sweep==ae.CCW?ae.CW:ae.CCW:this.model.sweep}set sweep(t){}get length(){return this.model.length}set length(t){}get locked(){return this._parent.locked}set locked(t){this._parent.locked!=t&&(this._parent.locked=t)}get bbox(){return this.updateBox()}get isSegment(){return this.model.isSegment}getAngle(){return this.model.getAngle()}equals(t){return t instanceof Va?this.layerId==t.layerId&&this.width==t.width&&this.radius==t.radius&&this.startAngle==t.startAngle&&this.endAngle==t.endAngle&&this.sweep==t.sweep&&this.arcType==t.arcType&&this.center.equals1(t.center):!1}updateBox(){let t=this.getMatrix().toMatrix3();return this.model.primitive.multiply3(t).bbox().extendOfSize(this.width)}inShape(t,e,r){let i=this.getMatrix().inverse(),n=new S(t,e).multiply4(i);return this.model.inShape(n.x,n.y,r)}transform(t){}getMathGraphics(t=this.layerId,e=0){if(!this.isEmpty&&this.layerId==t){let r=this.model.getMathGraphics(this.width,e);if(r!=null){let i=this.getMatrix();return r.multiply3(i.toMatrix3())}}return null}clone(){return new o(this._globalIndex,this.model,this._parent)}buildBBox(){return this.isEmpty?null:this.updateBox()}};var tre=class o extends ss{constructor(e,r){super();this._parent=void 0;this._globalIndex=e,this._model=r,this._layerId=r.layerId,this.position=S.ORIGIN,this.rotation=0,this.scaleX=1,this._children=new Array(this.model.childrens.length);let i=0;for(let n of this.model.childrens){let s=new Array(n.length),a=0;for(let l of n)l instanceof hs?s[a]=new DB(l.globalIndex,l,this):l instanceof Va&&(s[a]=new wB(l.globalIndex,l,this)),a++;this._children[i]=s,i++}this._bbox=r.bbox}get number(){return this.model.number}set number(e){this._number=e}updateSimplyOutline(){this._model.updateSimplyOutline()}get model(){return this._model}set model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this.position=S.ORIGIN,this.rotation=0,this.scaleX=1,this._number=e.number}get isSimplify(){return this.model.isSimplify}set isSimplify(e){this.model.isSimplify=e}get childrens(){return iB(this._children)}set childrens(e){this._children=e}get outline(){return this.model.outline}refreshOutlineByChildren(){this.model.refreshOutlineByChildren()}refreshChildrenByOutline(e,r){return this.model.refreshChildrenByOutline(e,r)}getMatrix(){return Ae.getMatrix4(S.ORIGIN,this.rotation,this.scaleX,this.position)}get lastIsClose(){return this.model.lastIsClose}iteratorChildren(e){return this.model.iteratorChildren(e)}clone(){let e=new o(this._globalIndex,this.model);return e.position=this.position,e.layerId=this.layerId,e.rotation=this.rotation,e.scaleX=this.scaleX,e}get type(){return this.model.type}set type(e){this.model.type=e}get layerId(){return this._layerId}set layerId(e){this._layerId!=e&&(this.watchLayerIdModify(this._layerId),this._layerId=e,this.layerModified=!0)}get net(){var e;return(e=this.model.net)==null?void 0:e.toUpperCase()}set net(e){this.model.net=e,this.netModified=!0}get showNet(){return this.model.net}get locked(){return this.model.locked}set locked(e){this.model.locked=this.locked}get strokeWidth(){return this.model.strokeWidth}set strokeWidth(e){this.model.strokeWidth=e}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get component(){return this.model.component}set component(e){this.model.component=e}addCopper(e){this.model.addCopper(e)}deleteCopper(e){this.model.deleteCopper(e)}iteratorCopper(e){this.model.iteratorCopper(e)}clearCopperData(){this.model.clearCopperData()}transform(e){let r=Ae.getMatrix4(S.ORIGIN,this.rotation,this.scaleX,this.position).multiply4(e);this.position=new S(r.data[12],r.data[13]),this.scaleX=r.data[0]*r.data[5]-r.data[1]*r.data[4],r=r.scale(1/this.scaleX,1,1),this.rotation=Math.atan2(r.data[1],r.data[0]);for(let i of this._children)if(Array.isArray(i))for(let n of i)n.updateShapeData();else i.updateShapeData();this.updateShapeData()}get simplyPolyline(){if(this.model.isSimplify&&this.model.simplyPolyline){let e=Ae.getMatrix4(S.ORIGIN,this.rotation,this.scaleX,this.position);return this.model.simplyPolyline.multiply3(e.toMatrix3())}else return null}isInside(e){e=e.multiply4(this.getMatrix().inverse());let r=this.outline;return r!=null?jr.inPolygon(e,r instanceof Bt?r.items:[r]):!1}updateBox(){let e=Ae.getMatrix4(S.ORIGIN,this.rotation,this.scaleX,this.position);if(this.isSimplify&&this.model.simplyPolyline)return this._bbox=this.model.simplyPolyline.multiply3(e.toMatrix3()).bbox(),this.bbox;let r=new _e;for(let i of this.childrens)for(let n of i){let s=n.buildBBox();s!=null&&r.ext1(s)}return this._bbox=r.build1(),this._bbox}getMathGraphics(e,r){let i=this.model.getMathGraphics(e,r);if(i!=null){let n=Ae.getMatrix4(S.ORIGIN,this.rotation,this.scaleX,this.position);i=i.multiply3(n.toMatrix3())}return i}};var rre=class o extends Za{constructor(e,r){super();this._parent=void 0;this.scaleX=1;this._globalIndex=e,this.model=r,this._layerId=r.layerId,this.position=r.start,this._rotation=r.rotation,this._number=r.number,this._bbox=r.bbox}get model(){return this._model}set model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this.position=e.start,this._rotation=e.rotation,this._number=e.number}get start(){return this.position}set start(e){this.position.equals(e)||(this.position=e,this.updateShapeData())}get width(){return this.model.width}set width(e){this.model.width=e}get height(){return this.model.height}set height(e){this.model.height=e}get rotation(){return this._rotation}set rotation(e){this._rotation!=e&&(this._rotation=e,this.updateShapeData())}get radius(){return this.model.radius}set radius(e){this.model.radius=e}clone(){let e=new o(this._globalIndex,this.model);return e.position=this.position,e.layerId=this.layerId,e.rotation=this.rotation,e.scaleX=this.scaleX,e}get type(){return this.model.type}set type(e){this.model.type=e}get layerId(){return this._layerId}set layerId(e){this._layerId!=e&&(this.watchLayerIdModify(this._layerId),this._layerId=e,this.layerModified=!0)}get net(){var e;return(e=this.model.net)==null?void 0:e.toUpperCase()}set net(e){this.model.net=e,this.netModified=!0}get showNet(){return this.model.net}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get strokeWidth(){return this.model.strokeWidth}set strokeWidth(e){this.model.strokeWidth=e}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get component(){return this.model.component}set component(e){this.model.component=e}addCopper(e){this.model.addCopper(e)}deleteCopper(e){this.model.deleteCopper(e)}iteratorCopper(e){this.model.iteratorCopper(e)}clearCopperData(){this.model.clearCopperData()}};var ire=class o extends yo{constructor(e,r){super();this._parent=void 0;this.scaleX=1;this._globalIndex=e,this._model=r,this._layerId=r.layerId,this.position=r.center,this._number=r.number,this._bbox=r.bbox}get model(){return this._model}set model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this.position=e.center,this._number=e.number}get rotation(){return 0}set rotation(e){}get type(){return this.model.type}set type(e){this.model.type=e}get layerId(){return this._layerId}set layerId(e){this._layerId!=e&&(this.watchLayerIdModify(this._layerId),this._layerId=e,this.layerModified=!0)}get net(){var e;return(e=this.model.net)==null?void 0:e.toUpperCase()}set net(e){this.model.net=e,this.netModified=!0}get showNet(){return this.model.net}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get strokeWidth(){return this.model.strokeWidth}set strokeWidth(e){this.model.strokeWidth=e}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get component(){return this.model.component}set component(e){this.model.component=e}addCopper(e){this.model.addCopper(e)}deleteCopper(e){this.model.deleteCopper(e)}iteratorCopper(e){this.model.iteratorCopper(e)}clearCopperData(){this.model.clearCopperData()}get center(){return this.position}set center(e){this.position.equals(e)||(this.position=e,this.updateShapeData())}get radius(){return this.model.radius}set radius(e){this.model.radius=e}clone(){let e=new o(this._globalIndex,this.model);return e.position=this.position,e.layerId=this.layerId,e.rotation=this.rotation,e.scaleX=this.scaleX,e}};var LM=class o extends Ct{constructor(e,r){super();this._parent=void 0;this.scaleX=1;this._globalIndex=e,this.model=r,this._layerId=r.layerId,this.position=r.center,this._net=r.net,this._number=r.number,this._bbox=r.bbox}reset4Model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this.position=e.center,this._number=e.number,this._locked=void 0,this._viaExpansion=void 0,this._viaBaseInfo=void 0,this._unusedInnerLayers=void 0}get model(){return this._model}set model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this.position=e.center,this._number=e.number}get rotation(){return 0}get layerId(){return this._layerId}set layerId(e){}get center(){return this.position}set center(e){this.position.equals(e)||(this.position=e,this.updateShapeData())}get radius(){return this._viaBaseInfo?this._viaBaseInfo.radius:this.model.radius}set radius(e){this.radius!=e&&(this._viaBaseInfo=la.getViaBaseInfoByRadius(e,this.viaBaseInfo),this.updateShapeData(),this.radiusModified=!0)}get net(){var e;return((e=this._net)==null?void 0:e.toUpperCase())||""}set net(e){this._net!=e&&(this._parent!=null&&this._parent instanceof xi&&this._parent.modelType=="Component"&&this._parent.setNet(this.globalIndex,this.globalIndex,e),this._net=e,this.netModified=!0)}get showNet(){return this._net}get name(){return this.model.name}set name(e){this.model.name=e}get viaExpansion(){return this._viaExpansion||this.model.viaExpansion}set viaExpansion(e){this.viaExpansion!=e&&(this.checkExpansionModify(e),this._viaExpansion=e)}get holeRadius(){return this._viaBaseInfo?this._viaBaseInfo.holeRadius:this.model.holeRadius}set holeRadius(e){this.holeRadius!=e&&(this._viaBaseInfo=la.getViaBaseInfoByHoleRadius(e,this.viaBaseInfo),this.updateShapeData(),this.holeRadiusModified=!0)}get expansionType(){return this._viaExpansion?this._viaExpansion.expansionType:this.model.expansionType}set expansionType(e){this.expansionType!=e&&(this._viaExpansion=qp.getExpansionByexpansionType(e,this.viaExpansion))}get topExpansion(){return this._viaExpansion?this._viaExpansion.topExpansion:this.model.topExpansion}set topExpansion(e){this.topExpansion!=e&&(this._viaExpansion=qp.getExpansionByTopExpansion(e,this.viaExpansion),this.updateShapeData(),this.topExpansionModified=!0)}get bottomExpansion(){return this._viaExpansion?this._viaExpansion.bottomExpansion:this.model.bottomExpansion}set bottomExpansion(e){this.bottomExpansion!=e&&(this._viaExpansion=qp.getExpansionByBottomExpansion(e,this.viaExpansion),this.updateShapeData(),this.bottomExpansionModified=!0)}get locked(){return this._locked||this.model.locked}set locked(e){this._locked=e}get type(){return this.model.type}set type(e){this.model.type=e}get startLayer(){return this._viaBaseInfo?this._viaBaseInfo.startLayer:this.model.startLayer}get endLayer(){return this._viaBaseInfo?this._viaBaseInfo.endLayer:this.model.endLayer}get viaBaseInfo(){return this._viaBaseInfo||this.model.viaBaseInfo}set viaBaseInfo(e){this.viaBaseInfo!=e&&(this.checkBaseInfoModify(e),this._viaBaseInfo=e)}get bbox(){return this._bbox}get unusedInnerLayers(){return this._unusedInnerLayers||this.model.unusedInnerLayers}set unusedInnerLayers(e){this.unusedInnerLayers.toString()!=e.toString()&&(this._unusedInnerLayers=e,this.updateShapeData())}inOutline(e){let r=Math.max(this.radius,this.holeRadius);return t1(e,this.center,r)}transform(e){this.center=this.center.multiply4(e)}isUnuseLayer(e){let r=1<<e-15;return(Z9.compress(this.unusedInnerLayers)&r)!==0}getOneInnerInUse(){for(let e=15;e<=46;e++)if(!this.isUnuseLayer(e))return e;return null}inShape(e,r){return this.inOutline(new S(e,r))}getMathGraphics(e=this.layerId,r=0){if(this.isEmpty||this.isUnuseLayer(e))return null;if(e==12||e===47)return ge.build2([q.build3(this.center,0,-360,this.holeRadius,this.holeRadius)]);if([5,6].includes(e)){let i=e==5?this.topExpansion:this.bottomExpansion,n=this.radius+i;return n<=0?null:ge.build2([q.build3(this.center,0,-360,n,n)])}else return ge.build2([q.build3(this.center,0,-360,this.radius+r,this.radius+r)])}getFileGraphics(e,r,i){if(this.isEmpty)return null;if(ar(e)){let n=[];if(i==null){let s=this.getOneInnerInUse();s==null?i=[]:i=[s]}for(let s of i){let a=this.getMathGraphics(s,r);a!=null&&n.push(a)}return n}else{let n=this.getMathGraphics(e,r);return n!=null?[n]:null}}isContains(e){return u2(e,this.type,this.startLayer,this.endLayer)}isSeparated(e){return!this.isContains(e.startLayer)&&!this.isContains(e.endLayer)&&!e.isContains(this.startLayer)&&!e.isContains(this.endLayer)}rotateFor(e,r){let i=Ae.rotateZForPoint(e,r);this.transform(i)}updateBox(){return this._bbox=Fz(this.radius,this.center,this.holeRadius,this.topExpansion,this.bottomExpansion),this._bbox}multiply3(e){let r=e.toMatrix3(),i=this.getMathGraphics();return i!=null?i.multiply3(r):null}clone(){let e=new o(this._globalIndex,this.model);return e.position=this.position,e.layerId=this.layerId,e.scaleX=this.scaleX,e}checkBaseInfoModify(e){this.viaBaseInfo.radius!=e.radius&&(this.radiusModified=!0,this.updateShapeData()),this.viaBaseInfo.holeRadius!=e.holeRadius&&(this.holeRadiusModified=!0,this.updateShapeData())}checkExpansionModify(e){this.viaExpansion.topExpansion!=e.topExpansion&&(this.topExpansionModified=!0,this.updateShapeData()),this.viaExpansion.bottomExpansion!=e.bottomExpansion&&(this.topExpansionModified=!0,this.updateShapeData())}};var nre=class o extends Dl{constructor(e,r){super();this._parent=void 0;this.scaleX=1;this._globalIndex=e,this.model=r,this._layerId=r.layerId,this.position=r.start,this._rotation=r.rotation,this._number=r.number}get model(){return this._model}set model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this.position=e.start,this._rotation=e.rotation,this._number=e.number}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get template(){return this.model.template}set template(e){this.model.template=e,this.templateModified=!0}get box(){let e=this.model.box.clone();e.layerId=this._layerId;let{width:r,height:i,matrix:n}=this;return e.leftUp=S.ORIGIN.multiply4(n),e.leftLow=new S(0,-i).multiply4(n),e.rightLow=new S(r,-i).multiply4(n),e.rightUp=new S(r,0).multiply4(n),e}set box(e){}getViewMatrix(){let e=new _e;this.template.forEach(l=>{e.ext1(l.bbox())});let r=e.build1(),i=Ae.translate(-r.UL().x,-r.UL().y,0),n=r.height(),s=r.width(),a=Ae.scale(this.width/s,this.height/n,1);return i.multiply4(a).multiply4(this.matrix)}getRealPath(){let e=this.getViewMatrix().toMatrix3();return this.template.map(r=>r.multiply3(e))}getPath(){let e=this.getViewMatrix(),r=this.getTemplatePath();return r.forEach(i=>{i.pl=i.pl.multiply3(e.toMatrix3())}),r}getPathByTemplatePath(e){let r=this.getViewMatrix(),i=e;return i=i.map(n=>n.clone()),i.forEach(n=>{n.pl=n.pl.multiply3(r.toMatrix3())}),i}getTemplatePath(){let e=this.template.map(n=>n.clone());return new wf("",0,e).pls}get matrix(){let e=oc(this.layerId,this.mirror);return Ae.rotateZ(this.rotation).scale(e?-1:1,1,1).translate1(this.start.x,this.start.y,0)}get layerId(){return this._layerId}set layerId(e){this._layerId!=e&&(this.watchLayerIdModify(this.layerId),this._layerId=e,this.layerModified=!0)}get start(){return this.position}set start(e){this.position!=e&&(this.position=e,this.reset4Matrix(this.matrix))}get width(){return this.model.width}set width(e){}get height(){return this.model.height}set height(e){}get rotation(){return this._rotation}set rotation(e){this._rotation!=e&&(this._rotation=e,this.updateShapeData())}get mirror(){return this.model.mirror}set mirror(e){this.model.mirror=e}get center(){return this.model.center.multiply4(this.matrix)}set center(e){let r=e.sub(this.center),i=Ae.translate(r.x,r.y,0);this.transform(i)}get bbox(){return this.box.bbox}get locked(){return this.model.locked}set locked(e){}transform(e){let r=new S(e.data[0],e.data[1]).normalize(),i=Math.atan2(r.y,r.x);oc(this.layerId,this.mirror)?this._rotation-=i:this._rotation+=i,this.position=this.position.multiply4(e),this.updateShapeData()}inShape(e,r,i){let n=this.matrix.inverse(),s=new S(e,r).multiply4(n);return this.model.inShape(s.x,s.y,i)}reset4Matrix(e){}reset4(e,r,i){}updateBox(){let{width:e,height:r}=this,i=this.matrix,n=new S(0,0).multiply4(i),s=new S(0,-r).multiply4(i),a=new S(e,-r).multiply4(i),l=new S(e,0).multiply4(i),c=new _e().ext2(s).ext2(n).ext2(a).ext2(l);return this._bbox=c.build(),this._bbox}getMathGraphics(e=this.layerId,r){let i=this.model.getMathGraphics(e,r);return i==null?null:i.multiply3(this.matrix.toMatrix3())}clone(){let e=new o(this._globalIndex,this.model);return e.position=this.position,e.rotation=this.rotation,e.scaleX=this.scaleX,e}getPathBytemplatePath(e){let r=this.getViewMatrix(),i=e;return i=i.map(n=>n.clone()),i.forEach(n=>{n.pl=n.pl.multiply3(r.toMatrix3())}),i}};var ore=class o extends Ff{constructor(e,r){super();this._parent=void 0;this._globalIndex=e,this._model=r,this._layerId=r.layerId,this.position=r.start,this.scaleX=1,this._rotation=r.rotation,this._number=r.number}get model(){return this._model}set model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this.position=e.start,this._rotation=e.rotation,this._number=e.number}get layerId(){return this._layerId}set layer(e){this.layerId!=e&&(this.watchLayerIdModify(this.layerId),this.layerModified=!0)}get start(){return this.position}set start(e){this.position=e,this.updateShapeData()}get width(){return this.model.width}set width(e){this.model.width=e}get height(){return this.model.height}set height(e){this.model.height=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e,this.updateShapeData()}get hashId(){return this.model.hashId}set hashId(e){this.model.hashId=e}get mirror(){return this.model.mirror}set mirror(e){this.model.mirror=e}get center(){return this.model.center.multiply4(this.matrix)}set center(e){let r=e.sub(this.center),i=Ae.translate(r.x,r.y,0);this.transform(i)}get bbox(){return this.box.bbox}get locked(){return this.model.locked}set locked(e){this.model.locked=e}transform(e){let r=new S(e.data[0],e.data[1]).normalize(),i=Math.atan2(r.y,r.x);oc(this.layerId,this.mirror)?this._rotation-=i:this._rotation+=i,this.position=this.position.multiply4(e),this.updateShapeData()}inShape(e,r,i){let n=this.matrix.inverse(),s=new S(e,r).multiply4(n);return this.model.inShape(s.x,s.y,i)}reset4Matrix(e){}reset4(e,r,i){}updateBox(){let{width:e,height:r}=this,i=this.matrix,n=new S(0,0).multiply4(i),s=new S(0,-r).multiply4(i),a=new S(e,-r).multiply4(i),l=new S(e,0).multiply4(i),c=new _e().ext2(s).ext2(n).ext2(a).ext2(l);return this._bbox=c.build(),this._bbox}getMathGraphics(e=this.layerId,r){let i=this.model.getMathGraphics(e,r);return i==null?null:i.multiply3(this.matrix.toMatrix3())}needMirror(){return oc(this.layerId,this.mirror)}get matrix(){let e=oc(this.layerId,this.mirror);return Ae.rotateZ(this.rotation).scale(e?-1:1,1,1).translate1(this.start.x,this.start.y,0)}get box(){let e=this.model.box.clone();e.layerId=this._layerId;let{width:r,height:i,matrix:n}=this;return e.leftUp=S.ORIGIN.multiply4(n),e.leftLow=new S(0,-i).multiply4(n),e.rightLow=new S(r,-i).multiply4(n),e.rightUp=new S(r,0).multiply4(n),e}set box(e){}clone(){let e=new o(this._globalIndex,this.model);return e.position=this.position,e._layerId=this._layerId,e._rotation=this._rotation,e.scaleX=this.scaleX,e}};var LB=class o extends Li{constructor(e,r){super();this._parent=void 0;this._globalIndex=e,this._model=r,this._layerId=r.layerId,this._position=r.position,this._rotation=r.rotation,this._origin=r.origin,this._number=r.number}get model(){return this._model}set model(e){this._model=e,this._layerId!=e.layerId&&this.watchLayerIdModify(this._layerId),this._layerId=e.layerId,this._position=e.position,this._rotation=e.rotation,this._origin=e.origin,this._number=e.number}get scaleX(){return 1}get positionIsNull(){return this.model.positionIsNull}set positionIsNull(e){this.model.positionIsNull!=e&&(this.model.positionIsNull=e)}get box(){let e=this.model.box.clone();e.layerId=this._layerId;let{width:r,height:i}=this,n=this.getMatrix(r,i),s=new S(n.data[12],n.data[13]);return e.leftLow=s,e.leftUp=new S(0,i).multiply4(n),e.rightLow=new S(r,0).multiply4(n),e.rightUp=new S(r,i).multiply4(n),e}set box(e){}get bbox(){return this.box.bbox}get matrix(){let e=oc(this._layerId,this.mirror),r=t3(this._origin),i=new S(r.x*this.width,r.y*this.height),n=this._rotation;return Ae.getMatrix4(i,n,e?-1:1,this._position)}get layerId(){return this._layerId}set layerId(e){this._layerId!=e&&(this.watchLayerIdModify(this._layerId),this._layerId=e,this.updateShapeData(),this.layerModified=!0)}get type(){return this.model.type}set type(e){this.model.type!=e&&(this.model.type=e,this.model.updateShapeData())}get position(){return this._position}set position(e){this._position.equals(e)||(this._position=e,this.updateShapeData())}get rotation(){return this._rotation}set rotation(e){Math.abs(this.rotation-e)<1e-8||this._rotation!=e&&(this._rotation=e,this.updateShapeData())}get origin(){return this._origin}set origin(e){this._origin!=e&&(this._origin=e,this.updateShapeData())}get strokeWidth(){return this.model.strokeWidth}set strokeWidth(e){this.model.strokeWidth=e}get mirror(){return this.model.mirror}set mirror(e){this.model.mirror=e}get width(){return this.model.width}get height(){return this.model.height}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get outline(){return this.model.outline}set outline(e){this.model.outline!=e&&(this.model.outline=e,this.outlineModified=!0)}get key(){return this.model.key}set key(e){this.model.key=e}get showKey(){return this.model.showKey}set showKey(e){this.model.showKey=e}get value(){return this.model.value}set value(e){this.model.value=e}get showValue(){return this.model.showValue}set showValue(e){this.model.showValue=e}get fontFamily(){return this.model.fontFamily}set fontFamily(e){this.model.fontFamily=e}get fontSize(){return this.model.fontSize}set fontSize(e){this.model.fontSize=e}get reverse(){return this.model.reverse}set reverse(e){this.model.reverse=e}get reverseExpansion(){return this.model.reverseExpansion}set reverseExpansion(e){this.model.reverseExpansion=e}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}set matrixChange(e){this.model.matrixChange=e}get matrixChange(){return this.model.matrixChange}reset4Matrix(){this.model.reset4Matrix()}getMatrix(e=this.width,r=this.height){let i=oc(this.layerId,this.mirror),n=t3(this.origin),s=new S(n.x*e,n.y*r),a=this.rotation;return Ae.getMatrix4(s,a,i?-1:1,this.position)}updateBox4(e,r){this.model.updateBox4(e,r)}transform(e,r){if(!r){let n=new S(e.data[0],e.data[1]).normalize(),s=Math.atan2(n.y,n.x);oc(this.layerId,this.mirror)?this._rotation=this._rotation-s:this._rotation=this._rotation+s}let i=this._position.multiply4(e);this._position=i,this.updateShapeData()}inShape(e,r,i){this.reset4Matrix();let n=this.getMatrix().inverse(),s=new S(e,r).multiply4(n);return this.model.inShape(s.x,s.y,i)}reset4(e,r,i){}updateBox(){this.reset4Matrix();let{width:e,height:r}=this,i=this.getMatrix(e,r),n=new S(0,0).multiply4(i),s=new S(0,r).multiply4(i),a=new S(e,0).multiply4(i),l=new S(e,r).multiply4(i),c=new _e().ext2(n).ext2(s).ext2(a).ext2(l);return this._bbox=c.build(),this._bbox}getMathGraphics(e=this.layerId,r=0){if(this.reset4Matrix(),this.isEmpty)return null;let i=this.box.getMathGraphics(e,r);return i==null?null:i.multiply3(this.getMatrix().toMatrix3())}getRealOutline(){let e=this.matrix,r=this.outline;if(this.type==1){let i=Ite(this);return i.forEach(n=>{n.pl=n.pl.multiply3(e.toMatrix3())}),i}else return r.map(i=>i.multiply3(e.toMatrix3()))}getTextOutline(){let e=this.matrix,r=this.outline;return this.type==1?(r=r.map(i=>i.multiply3(e.toMatrix3())),r):r.map(i=>i.multiply3(e.toMatrix3()))}getText(){return this.model.getText()}clone(){this.reset4Matrix();let e=new o(this._globalIndex,this.model);return e.position=this.position,e.layerId=this.layerId,e.rotation=this.rotation,e}};var MM=class{};MM.isRender4GPU=!1;function Tx(o,t){return o?o.has(t):!1}function ug(o,t,e,r){return o?Tx(o,t)?o.get(t):(r&&o.set(t,e),e):e}function Ix(o,t,e,r=!0){return!o||!r&&Tx(o,t)||o.get(t)===e?!1:(o.set(t,e),!0)}function JO(o,t){if(!o)return!1;for(let[e,r]of o)if(t(r,e,o))return!0;return!1}function NIe(o){let t=[];return JO(o,(e,r)=>{t.push(r)}),t}var m9t=["LAYER_PHYS","ACTIVE_LAYER","NET","PRIMITIVE","GROUP","FONT"],dg={},pI=class{constructor(t,e,r=""){this.projectId="";this._id=void 0;this._utime=void 0;this._childs=new Set;this.components=new Set;this.attrDataMap=new Map;this.layers=[];this._bbox=null;this._layeredBoxMap=null;this.items=new Map;this._isSMT=null;this.isNew=!1;this._uuid=t,this.projectId=r,this._origin=S.ORIGIN,this.instance=new HC(this.uuid,this.projectId,e)}get id(){return this._id}set id(t){this._id=t}async destroy(){this.instance!=null&&(await this.instance.destroy(),this.instance=null)}getInstance(){return this.instance}getModelBy(t,e){return this.items.get(e)}getItems(){return this.items}get isSMT(){if(this._isSMT==null){this._isSMT=!0;for(let[,t]of this.items)if(t.modelType=="Pad"&&t.layerId==12){this._isSMT=!1;break}}return this._isSMT}getId(t,e){for(;;){let r="e"+t;if(e.has(r))t++;else return t}}getBBox(){return this._bbox.transform4(Ae.translate(-this._origin.x,-this._origin.y,0))}getLayeredBoxMap(){return this._layeredBoxMap}getPads(){let t=[];for(let[,e]of this.items)e.modelType=="Pad"&&t.push(e);return t}async parse(t,e){for(let[,s]of this.items)s.remove();this.items.clear();let r=new vm;if(r.ids=new Set,this.ignoreTypes(m9t,r),this.instance==null)throw new Error("this footprint is destory!!!");let i=this.instance;i.setHandle(new s1(r)),e?await e(i):await i.init(!1,!1,t,void 0,R.getInstance().needNum),this.isNew=r.isNew;let n=i.getDocDetail();return this._id=n==null?void 0:n.title,this._utime=n==null?void 0:n.updateTime,this.attrHandle(r),this.layers=r.layer,r.preAdjust(),this.batchBuildItems(r),this.updateBBox(),Qk.ins.add(this),r}updateLayer(t){let e=!1;for(let r=0;r<this.layers.length;r++)this.layers[r].layerId==t.layerId&&(this.layers[r]=t,e=!0);e||this.layers.push(t)}deleteLayer(t){for(let e=0;e<this.layers.length;e++)if(this.layers[e].layerId==t){this.layers.splice(e,1);break}}updateBBox(){let t=new _e,e={};for(let[,r]of this.items){if(r instanceof Li&&r.key!="")continue;t.ext1(r.updateBox());let i=e[r.layerId];if(i)i.ext1(r.updateBox());else{let n=new _e;n.ext1(r.updateBox()),e[r.layerId]=n}}t.valid()?this._bbox=t.build():this._bbox=S.ORIGIN.bbox(),this.recordLayeredBbox(e)}recordLayeredBbox(t){let e={},r=Ae.translate(-this._origin.x,-this._origin.y,0);for(let i in t){let n,s=t[i];s.valid()?n=s.build():n=S.ORIGIN.bbox(),e[i]=n.transform4(r)}this._layeredBoxMap=e}updateAttrDecode(t){t instanceof uI&&this.attrDataMap.set(t.key,t)}deleteAttrDecode(t){this.attrDataMap.delete(t)}setHandle(t){this.instance!=null&&this.instance.setHandle(t)}attrHandle(t){let e=t.attr,r=!0,i=!0,n=new Map,s=new Array(0);e.forEach((h,u)=>{h.key=="Footprint"&&this._id!=null?(h.value=this._id,r=!1):h.key=="Designator"&&(i=!1),n.has(h.key)?s.unshift(u):(n.set(h.key,!0),this.attrDataMap.set(h.key,h))});for(let h of s)e.splice(h,1);let a=t.ids||new Set;t.ids=null;let l=0;if(r&&this._id!=null){l=this.getId(l,a);let h=new uI;e.push(h),h.feed(bY("e"+l,"Footprint",this._id)),l++}if(i&&this._id!=null){l=this.getId(l,a);let h=new uI;e.push(h),h.feed(bY("e"+l,"Designator",this._id))}let c=t.canvas[0];c&&(this._origin=c.origin)}addChild(t){this._childs.add(t)}getChilds(){return this._childs}getOrigin(){return this._origin}get origin(){return this._origin}set origin(t){this._origin=t}generate(t){let e=Ae.translate(-this._origin.x,-this._origin.y,0);for(let[,r]of this.items){let i=t.componentId+r.globalIndex;t.hasId(i)&&(i=t.getNoRepeatId(i));let n=this.clone(r,i);n.transform(e),t.addCloneItem(n)}return t}clone(t,e){let r=this.clone2Template(t);if(r.globalIndex=e,r.modelType=="Polygon"){let i=r.childrens;for(let n of i)for(let s of n)s.globalIndex=e+s.globalIndex}return aS(r),r}clone2Template(t){if(!MM.isRender4GPU)return t.clone(!0);switch(t.modelType){case"Pad":return new oS(t.globalIndex,t);case"Via":return new LM(t.globalIndex,t);case"Image":return new nre(t.globalIndex,t);case"Picture":return new ore(t.globalIndex,t);case"Polygon":return new tre(t.globalIndex,t);case"Rect":return new rre(t.globalIndex,t);case"Circle":return new ire(t.globalIndex,t);case"Text":return t.key!=""?t.clone(!0):new LB(t.globalIndex,t);default:return t.clone(!0)}}formatParseBuild(t,e){let r=Ae.translate(-this._origin.x,-this._origin.y,0),i=new Map;for(let n of e)i.set(n.key,n);for(let[,n]of this.items){let s=this.clone2Template(n);if(s.globalIndex=t.componentId+s.globalIndex,s.modelType=="Polygon"){let a=s.childrens;for(let l of a)for(let c of l)c.globalIndex=t.componentId+c.globalIndex}else if(s.modelType=="Text"){let a=i.get(s.key);a!=null&&(s.globalIndex=a.index,t.hasId(s.globalIndex)&&(s.globalIndex=t.getNoRepeatId(s.globalIndex)),s.silkColor=a.specialColor)}t.resultNeedToBeCached&&aS(s),s.transform(r),t.addCloneItem(s)}return i.clear(),t}buildItems(t){for(let e of t){e.resultNeedToBeCached=!1;let r=e.finish();r instanceof xi&&this.items.set(r.globalIndex,r)}}addItem(t){this.items.set(t.globalIndex,t),this.updateBBox()}deleteItem(t){this.items.delete(t.globalIndex),this.updateBBox()}refershBBox(){this.updateBBox();for(let t of this.components)t.initBox()}copy(t){let e=Ae.translate(-this._origin.x,-this._origin.y,0);for(let[,r]of this.items){if(r.modelType=="Text"&&r.key!="")continue;let i=this.clone2Template(r);if(i.globalIndex=t.componentId+i.globalIndex,t.hasId(i.globalIndex)&&(i.globalIndex=t.getNoRepeatId(i.globalIndex)),i.modelType=="Polygon"){let n=i.childrens;for(let s of n)for(let a of s)a.globalIndex=t.componentId+a.globalIndex}aS(i),i.transform(e),t.addCloneItem(i)}return t}ignoreTypes(t,e){for(let r of t)e.addIgnoreType(r)}batchBuildItems(t){this.buildItems(t.layer),this.buildItems(t.via),this.buildItems(t.pad),this.buildItems(t.line),this.buildItems(t.arc),this.buildItems(t.poly),this.buildItems(t.fill),this.buildItems(t.fpcFill),this.buildItems(t.region),this.buildItems(t.pour),this.buildItems(t.image),this.buildItems(t.objs),this.buildItems(t.tearDrop),this.buildItems(t.str),this.buildItems(t.dimension),this.buildItems(t.attr);for(let e of this.items)e instanceof or&&e.type=="TearDrop"&&(e.type="Fill Region",e.component=void 0)}getNewNum(t,e){if(["1","2"].includes(e)){let r=this.getNum(t,e),i=this.getName(t);return l2(dg,i[0]).push(r),i[0]+r}else return t}getName(t){let e=t.replace(/[?\d\？]+$/,""),r=t.replace(e,"");return[e,r]}getMax(t,e){if(t.length==0)return 1;if(e==="1"){let r=t[0];for(let i of t)i>r&&(r=i);return++r}else if(e==="2"){let r=1;for(;t.includes(r);)r++;return r}}getUniqueVluesIngoreCase(t){let e=[],r=t.toLocaleUpperCase();for(let i in dg)(typeof i=="string"?i.toLocaleUpperCase():i)===r&&e.push(...dg[i]);return e}getNum(t,e){let[r,i]=this.getName(t),n=this.getUniqueVluesIngoreCase(r);if(n==null)return n=new Array,dg[r]=n,i!=""&&i!="?"&&i!="\uFF1F"?parseInt(i):1;if(i!=""&&i!="?"&&i!="\uFF1F"){let s=parseInt(i);return this.getMax(n,e)}else return this.getMax(n,e)}get uuid(){return this._uuid}get footprintId(){return this._id}get updateTime(){return this._utime}add(t){this.components.add(t)}delete(t){if(t instanceof Bi){let e=t.name;if(e){let r=this.getName(e),i=parseInt(r[1]);if(dg[r[0]]!=null&&!isNaN(i)){let n=dg[r[0]].indexOf(i);n>=0&&dg[r[0]].splice(n,1)}}this.components.delete(t)}}modifyId(t){this.components.delete(t)}modifyName(t,e){let r=this.getName(t),i=parseInt(r[1]);if(dg[r[0]]!=null&&!isNaN(i)){let a=dg[r[0]].indexOf(i);a>-1&&dg[r[0]].splice(a,1)}let n,s;t==e?(n=r,s=i):(n=this.getName(e),s=parseInt(n[1])),isNaN(s)||(dg[n[0]]==null&&(dg[n[0]]=new Array),dg[n[0]].indexOf(s)<0&&dg[n[0]].push(s),e=n[0]+s)}addName(t){let e=this.getName(t);dg[e[0]]==null&&(dg[e[0]]=[]);let r=parseInt(e[1]);!isNaN(r)&&!dg[e[0]].includes(r)&&dg[e[0]].push(r)}getModel(){return null}getComponents(){let t=new Array;return this.components.forEach(e=>{t.push(e)}),t}has(t){return this.attrDataMap.has(t)}checkKeyValue(t,e){if(this.has(t)){let r=this.attrDataMap.get(t);return r!=null&&r.value==e}else return!1}getValue(t){let e=this.attrDataMap.get(t);return e!=null?e.value:null}restoreAttr(t,e){let{componentPosition:r,angle:i,componentLayerId:n}=e,s=this.attrDataMap.get(t.key);return s!=null&&this.restore(t,s,{componentPosition:r,rotation:i,componentLayerId:n}),t}needSave(t,e,r,i,n){let s=.01,a=this.attrDataMap.get(t.key);if(a!=null){let l=a.layerId;if(i!=l)return!0;let c=a.x-this._origin.x;if(Math.abs(ve(e.x,2)-c)>s)return!0;let h=a.y-this._origin.y;if(Math.abs(ve(e.y,2)-h)>s||(n!=null&&n!=t.value||n==null)&&t.value!=a.value&&a.value!=`<${t.key}>`||t.showKey!=a.showKey||t.showValue!=a.showValue||(a.fontFamily==""&&(a.fontFamily="default"),t.fontFamily!=a.fontFamily))return!0;let u=a.fontSize;if(Math.abs(ve(t.fontSize,2)-u)>s)return!0;let d=a.strokeWidth;if(t.fontFamily=="defalut"&&Math.abs(ve(t.strokeWidth,2)-d)>s||t.origin!=a.origin)return!0;let p=a.angle;if(Math.abs(p-r)>s||t.reverse!=a.reverse)return!0;let m=a.reverseExpansion;if(Math.abs(ve(t.reverseExpansion,2)-m)>s||t.mirror!=a.mirror||t.locked!=a.locked)return!0}return!1}restore(t,e,r){let{componentPosition:i,rotation:n,componentLayerId:s}=r,a=e.layerId,l=0,c=0;isNaN(a)||(t.layerId=s===1?3:s===2?4:a);let h=e.x;isNaN(h)||(l=h);let u=e.y;isNaN(u)||(c=u),t.value=e.value,t.showKey=e.showKey,t.showValue=e.showValue,t.fontFamily=e.fontFamily;let d=e.fontSize;isNaN(d)||(t.fontSize=Math.abs(d));let p=e.strokeWidth;isNaN(p)||(t.strokeWidth=p),t.origin=e.origin;let m=e.angle;isNaN(m)||(t.rotation=m+n);let g=e.reverseExpansion;isNaN(g)||(t.reverseExpansion=g),t.reverse=e.reverse,t.mirror=e.mirror,t.locked=e.locked,t.position=new S(l,c).sub(this._origin).add(i).rotate(i,n)}getSource(){return null}isEmpty(){return this.isNew}getFootprintLayerInfo(){let t={};return this.layers.forEach(e=>{t[e.layerId]={name:e.getName(),type:e.getType()}}),t}iterator(t){(Array.from(this.items.values())||[]).some((r,i)=>!t(r,i))}iterateModels(t){return JO(this.items,t)}getChildrenLayerIdSet(){let t=new Set;return this.iterateModels(e=>{t.add(e.layerId)}),t}getBasicLayerTable(t){t||(t=this.getChildrenLayerIdSet());let e={},r=this.layers,i=t.size,n=0;return sc(r,s=>{let a=s.layerId;if(t.has(a)){let l=s.getType(),c=s.getName(),h={layerId:a,layerType:l,layerName:c};e[a]=h,n++}return n==i}),e}};var Sc=class extends pI{constructor(t,e,r=""){super(t,e,r)}get source(){return this._source}updateSource(t){this._source=t}async parse(t,e){var n;let r=await super.parse(t,e),i=(n=this.getInstance())==null?void 0:n.getDocDetail();return i&&(this._source=this.getProjectSource(i.source)),r}getProjectSource(t){return t?t.split("|")[0]:""}};var Vf=class Vf extends Ei{constructor(){super();this.listener=null}static getInstance(e){e||(e=Vf.otherDecodingProjectId);let r;return e?(r=Vf.otherProjectManagerMap[e],r||(r=new Vf,Vf.otherProjectManagerMap[e]=r),r):(Vf.manager==null&&(Vf.manager=new Vf),r=Vf.manager,r)}static get curProjectUuid(){let e=this.otherDecodingProjectId;return e||(this._curProjectUuid||(this._curProjectUuid=R.getInstance().projectId),this._curProjectUuid)}static set curProjectUuid(e){this._curProjectUuid=e}static async clearOtherProjectManagerMap(){Vf.otherDecodingProjectId=void 0;for(let e in Vf.otherProjectManagerMap)await Vf.otherProjectManagerMap[e].clear(),delete Vf.otherProjectManagerMap[e]}bindListener(e){this.listener=e}async bindFootprintListener(e){this.listener!=null&&await this.listener.bindListener(e)}addFootPrint(e,r){this.map.set(e,r)}async add(e,r,i){let n=this.map.get(e);if(n==null){let s=new pI(e,r,Vf.curProjectUuid);try{await s.parse(i)}catch(a){console.log(a);return}return this.addFootPrint(e,s),await this.bindFootprintListener(s),s}return n}isCustomUuid(e){return e.indexOf("_")>-1}async addCustomFootprint(e,r,i){let n=this.map.get(e);if(n==null){let s=new Sc(e,r,Vf.curProjectUuid);try{await s.parse(i)}catch(l){console.log(l);return}if(s.getItems().size==0&&s.id==null){s.destroy();return}let a=await this.add(s.source,r);return a==null?console.log(`custom footprint ${e} not find Source footprint:${s.source}!!!`):a.addChild(s),this.map.set(e,s),this.addFootPrint(e,s),await this.bindFootprintListener(s),s}return n}async cloneFootprint(e,r,i){let n;if(e instanceof Sc){let s=R.getInstance().compiler,a=R.getInstance().compilerChannel;if(s instanceof gp){let l=r||R.getInstance().id+"_"+nr();(await s.customFootprint(l,e.uuid)).success&&(n=await Vf.getInstance().addCustomFootprint(l,a,i))}}else{let s=R.getInstance().compiler;if(s instanceof gp){let a=R.getInstance().compilerChannel,l=r||R.getInstance().id+"_"+nr();(await s.customFootprint(l,e.uuid)).success&&(n=await Vf.getInstance().addCustomFootprint(l,a,i))}}return n}getAllCustoms(){let e=this.getAllItem(),r=[];return e.forEach(i=>{i instanceof Sc&&r.push(i)}),r}getItem(e){if(e!=null)return this.map.get(e)}async clear(){var e;for(let[,r]of this.map)await((e=r.getInstance())==null?void 0:e.destroy());this.map.clear()}deleteComponent(e){if(e instanceof Bi){let r=e.footprintUUID,i=this.map.get(r);i!=null&&i.delete(e)}}parseFootprintFile(e,r,i,n){let s=new Array;return s.push(["FOOTPRINT",e,{uuid:r,utime:i}]),n.forEach(a=>{let l=a[0];this.isSingleItem(l)&&(l=="POLY"&&(a[6]=Cte.rectToPolygon(a[6])),s.push(a))}),s.push(["END_FOOTPRINT"]),s}isSingleItem(e){switch(e){case"POUR":case"POLY":case"REGION":case"FILL":case"PAD":case"ARC":case"LINE":case"VIA":case"STRING":case"ATTR":case"DIMENSION":return!0}return!1}getLayerTableMapping(e){let r={};return sc(e,i=>{let n=this.getItem(i);if(n){let s=n.getBasicLayerTable();$O(r,i,s)}}),r}};Vf.manager=null,Vf.otherProjectManagerMap={};var Ji=Vf;var g9t=new Set(["Name","Unique ID","3D Model","3D Model Title","3D Model Transform"]),_Ie=6.75,Bi=class o extends xi{constructor(e,r,i,n,s,a,l,c,h,u,d,p){super();this.modelType="Component";this.pads=new Array(0);this.others=new Array(0);this._attrsMap={};this.attrs={};this._globalIndex=e,this._position=i,this._rotation=n,this._textOffset=s;for(let m of g9t){let g=a[m];if(["3D Model","3D Model Title","3D Model Transform"].indexOf(m)>=0&&typeof g!="string"){a[m]=void 0;continue}g==null&&(a[m]="")}this._attrsMap=a,this._footprintUUID=u,this._deviceUUID=d,p!=null&&(this._silkColor=p),this.updateShapes(c),this.updateAttributes(l),h.layerId=r,this.box=h,c.length=0,l.length=0,Ro("data/model/ComponentModel")}get attrsMapSource(){return this._attrsMap}get attrsMap(){return this._attrsMap}get reuseBlock(){return this._attrsMap["Reuse Block"]||""}set reuseBlock(e){this._attrsMap["Reuse Block"]=e.trim()}get combinationID(){return this._attrsMap["Group ID"]||""}set combinationID(e){this._attrsMap["Group ID"]=e.trim()}get channelID(){return this._attrsMap["Channel ID"]||""}set channelID(e){this._attrsMap["Channel ID"]=e.trim()}get deviceUUID(){return this._deviceUUID}get footprintUUID(){return this._footprintUUID}set footprintUUID(e){this._footprintUUID!=e&&(this._footprintUUID=e)}get numShape(){return this.attrs.Designator}set numShape(e){this.attrs.Designator=e,e.setParent(this)}get deviceShape(){return this.attrs.Device}set deviceShape(e){this.attrs.Device=e,e.setParent(this)}get idShape(){return this.attrs.Footprint}set idShape(e){this.attrs.Footprint=e,e.setParent(this)}get attributes(){return Object.values(this.attrs)}get attrKeyText(){return this.attrs}get attrKeyValue(){let e={};for(let r in this._attrsMap)r!="Reuse Block"&&r!="Channel ID"&&r!="Group ID"&&r!="Reuse Block"&&(e[r]=this._attrsMap[r]);return e}get layerId(){return this.box.layerId}set layerId(e){if(this.layerId!=e){this.watchLayerIdModify(this.layerId);for(let l of this.pads){let c=l.layerId;c==12?l.oppositeLayer():c==1?l.layerId=2:c==2&&(l.layerId=1)}let r=new Set;for(let l of this.others){let c=l.layerId;if(c!=null){let h=sg(c);h===c&&l.modelType=="Text"&&r.add(l),l.layerId=h}}let i=Object.values(this.attrs);for(let l of i){let c=sg(l.layerId);c===l.layerId&&r.add(l),l.layerId=c}let n=this.position,s=Ae.getMatrix4(n.mul(-1),0,-1,n);for(let l of this.pads)l.flip(s);for(let l of i)r.has(l)||(l.position=l.position.multiply4(s));for(let l of this.others)l instanceof Li?r.has(l)||(l.position=l.position.multiply4(s)):l instanceof Dl?l.start=l.start.multiply4(s):l.transform(s);for(let l of r){let c=l.origin;if(c===4||c===5||c===6)l.position=l.position.multiply4(s);else{let h=1;(c===7||c===8||c===9)&&(h=-1);let u=l.mirror?(Math.PI-l.rotation)%Wd:l.rotation,d=S.getVector2(u).mul(h),p=l.position.add(d.mul(l.box.width));l.position=p.multiply4(s)}l.rotation=Math.PI*2-l.rotation}r.clear(),i.length=0;let a=(Math.PI-this.rotation)%Wd;this._rotation=a,this.box.layerId=e,this.box.transform(s),this.layerModified=!0,this.updateShapeData()}}flipShape(e){let r=new Set;if(e instanceof et){let s=e.layerId;s==12?e.oppositeLayer():s==1?e.layerId=2:s==2&&(e.layerId=1)}else{let s=e.layerId;if(s!=null){let a=sg(s);a===s&&e.modelType=="Text"&&r.add(e),e.layerId=a}}let i=this.position,n=Ae.getMatrix4(i.mul(-1),0,-1,i);if(e instanceof et)e.flip(n);else if(r.has(e)){let s=e,a=s.origin;if(a===4||a===5||a===6)s.position=s.position.multiply4(n);else{let l=1;(a===7||a===8||a===9)&&(l=-1);let c=S.getVector2(s.rotation).mul(l),h=s.position.add(c.mul(s.box.width));s.position=h.multiply4(n)}s.rotation=Math.PI*2-s.rotation}else e instanceof Li?e.position=e.position.multiply4(n):e instanceof Dl?e.start=e.start.multiply4(n):e.transform(n);r.clear(),this.updateShapeData()}get position(){return this._position}set position(e){if(e.x==this.position.x&&e.y==this.position.y)return;let r=e.sub(this.position),i=Ae.translate(r.x,r.y,0);this.transform(i)}get name(){return this._attrsMap.Designator}set name(e){this._attrsMap.Designator!=e&&(this._attrsMap.Designator=e,this.numShape.value=e)}get silkColor(){return this._silkColor}set silkColor(e){this._silkColor!=e&&(this._silkColor=e)}get footprintId(){return this._attrsMap.Footprint}set footprintId(e){this.idShape.value=e,this._attrsMap.Footprint=e}get device(){return this._attrsMap.Device}set device(e){this.deviceShape.value=e,this._attrsMap.Device=e}get designator(){return this._attrsMap.Designator}get addIntoBom(){return this._attrsMap["Add into BOM"]}get rotation(){return this._rotation}set rotation(e){if(this.rotation!=e){let r=e-this.rotation,i=this.position,n=Ae.translate(-i.x,-i.y,0).rotateZ(r).translate1(i.x,i.y,0);for(let a of this.pads)a.transform(n);let s=Object.values(this.attrs);for(let a of s)a.transform(n);for(let a of this.others)a.transform(n);this.box.transform(n),this.updateShapeData(),this._rotation=e}}get textOffset(){return this._textOffset}set textOffset(e){this._textOffset!=e&&(this._textOffset=e)}get bbox(){return this.box.bbox}get locked(){return this.box.locked}set locked(e){this.box.locked=e}getLayerIdReplacementTable(){return this.layerIdReplacementTable}setLayerIdReplacementTable(e,r,i){if(i){this.layerIdReplacementTable=e;return}let n=this.layerIdReplacementTable,s=my(n),a=my(e);if(s&&a)return;let l=hM(n),c=hM(e),{less:h,more:u,same:d}=PL(l,c),p=new Map;this.iterateAllChildren(m=>{ug(p,m.layerId,[],!0).push(m)}),sc(h,m=>{let g=n[m];if(!g)return;let y=parseInt(m),b=ug(p,g);sc(b,P=>{P.layerId=y})}),sc(u,m=>{let g=e[m];if(!g)return;let y=parseInt(m),b=ug(p,y);sc(b,P=>{P.layerId=g})}),sc(d,m=>{let g=n[m];if(!g)return;let y=e[m];if(!y||g==y)return;let b=ug(p,g);sc(b,P=>{P.layerId=y})}),r&&kf(e,m=>{Tx(p,m)||delete e[m]}),this.layerIdReplacementTable=e}updateReplacedLayerId(e){let r=this.layerIdReplacementTable;if(!e||!r)return!1;let i=e.layerId,n=r[i];return!n||n==i?!1:(e.layerId=n,!0)}updateAttributes(e){for(let r of e)this.attrs[r.key]=r,r.setParent(this)}updateShapes(e){for(let r of e)this.addCompositionItem(r)}initPadNet(){this.padNet=new Map;for(let e of this.pads){let{num:r,globalIndex:i,net:n}=e,s=this.padNet.get(r);s==null&&(s=new Map,this.padNet.set(r,s)),s.set(i,n)}for(let e of this.getVias()){let{globalIndex:r,net:i}=e,n=this.padNet.get(r);n==null&&(n=new Map,this.padNet.set(r,n)),n.set(r,i)}this.numMapNet==null&&(this.numMapNet=new Map)}setNet4Model(e){e.modelType=="Pad"?this.setNet(e.num,e.globalIndex,e.net):this.setNet(e.globalIndex,e.globalIndex,e.net)}setNet(e,r,i){var s;if(this.padNet==null)return;let n=this.padNet.get(e);n==null&&(n=new Map,this.padNet.set(e,n)),n.set(r,i),(s=this.numMapNet)==null||s.delete(e)}isCachePadNet(){return this.padNet!=null}getNet(e,r){var n,s;if(this.padNet==null)return"";let i=this.padNet.get(e);if(i==null)return((n=this.numMapNet)==null?void 0:n.get(e))||"";{let a=i.get(r);return a==null?((s=this.numMapNet)==null?void 0:s.get(e))||"":a}}deleteNet(e,r){var n;if(this.padNet==null)return;let i=this.padNet.get(e);if(i!=null){let s=i.get(r);i.delete(r),i.size==0&&s!=null&&(this.padNet.delete(e),(n=this.numMapNet)==null||n.set(e,s))}}getPads(){return this.pads}updatePads(e,r){this.updateReplacedLayerId(e),r=="add"&&(this.pads.push(e),this.setNet4Model(e),e.setParent(this)),r=="delete"&&(this.pads=this.pads.filter(i=>i!==e),this.deleteNet(e.num,e.globalIndex),e.setParent(void 0))}getVias(){let e=new Array;for(let r of this.others)r.modelType=="Via"&&e.push(r);return e}getItems(){let e=new Array;for(let r of this.pads)e.push(r);for(let r of this.others)e.push(r);return e}iterateItems(e){let r=sc(this.pads,e);return r||sc(this.others,e)}iterateAttrs(e){return kf(this.attrs,e)}iterateAllChildren(e){let r=this.iterateItems(e);return r||this.iterateAttrs(e)}getChildrenLayerIdSet(e,r){let i=new Set,n=this.layerIdReplacementTable,s=e?Q8e(n):null;return this.iterateItems(a=>{let l=a.layerId;if(e){let c=Cb(s,l.toString());if(c&&c.length>0){sc(c,h=>{i.add(+h)});return}}i.add(l)}),r||this.iterateAttrs(a=>{let l=a.layerId;if(e){let c=Cb(s,l.toString());if(c&&c.length>0){sc(c,h=>{i.add(+h)});return}}i.add(l)}),i}getOutlines(){return this.others.filter(e=>e instanceof or&&e.layerId==11)}getComponentShapes(){return this.others.filter(e=>e instanceof or&&e.layerId==48)}getAttr(e){return typeof e<"u"?{[e]:this.attrs[e]}:this.attrs}flip(e,r){let i=r||this.position,{x:n,y:s}=i,{_x:a,_y:l,_z:c}=e?{_x:1,_y:-1,_z:1}:{_x:-1,_y:1,_z:1},h=Ae.translate(-n,-s,0).scale(a,l,c).translate1(n,s,0);for(let p of this.pads)p.flip(h);for(let p of this.attributes)if(!p.locked){let m=p.position.multiply4(h);p.position=m,p.mirror=!p.mirror,e&&(p.rotation=p.rotation+Math.PI)}for(let p of this.others)if(p instanceof Li){let m=p.position.multiply4(h);p.position=m,p.mirror=!p.mirror,e&&(p.rotation=p.rotation+Math.PI)}else p instanceof Dl||p instanceof Ff?(p.start=p.start.multiply4(h),p.mirror=!p.mirror,e&&(p.rotation=p.rotation+Math.PI)):p.transform(h);let u=Math.PI*2-this.rotation;e&&(u=u+Math.PI);let d=this.position.multiply4(h);this._rotation=u,this._position=d,this.box.transform(h),this.updateShapeData()}addAttribute(e){this.updateReplacedLayerId(e),this.attrs[e.key]=e;let r=/^=\{([^\}]+)\}/g;(e.key!=="Name"||e.key=="Name"&&!r.test(this._attrsMap[e.key]))&&(this._attrsMap[e.key]=e.value),e.setParent(this)}removeAttribute(e){delete this.attrs[e.key],delete this._attrsMap[e.key],e.setParent(void 0)}deleteModel(e){if(e instanceof et){let r=this.pads.indexOf(e);r>=0&&(this.pads.splice(r,1),this.deleteNet(e.num,e.globalIndex))}else if(e instanceof Li&&e.key!="")delete this.attrs[e.key],delete this._attrsMap[e.key];else{let r=this.others.indexOf(e);r>=0&&(this.others.splice(r,1),e instanceof Ct&&this.deleteNet(e.globalIndex,e.globalIndex))}e.setParent(void 0)}getFormulaName(){let e=this._attrsMap.Name;if(!e||!e.startsWith("="))return e;e=e.slice(1);let r=/\{([^\}]+)\}/g,i=null,n=[];for(;i=r.exec(e);)n.push(i[1]);let s=this._attrsMap;s.ID=this.globalIndex;for(let a=0;a<n.length;a++){let l=n[a],c=`{${l}!}`;s[l]!=null&&(c=s[l]),e=e.replace(`{${l}}`,c)}return delete s.ID,e}multiply4(e,r=!1){for(let a of this.pads)a.transform(e);if(!r)for(let a of this.attributes)a.transform(e);for(let a of this.others)a.transform(e);let i=new S(e.data[0],e.data[1]).normalize(),n=Math.atan2(i.y,i.x);this.layerId==2?this._rotation=this.rotation+n:this._rotation=this.rotation+n;let s=this.position.multiply4(e);this._position=s,this.box.transform(e),this.updateShapeData()}transform(e){for(let a of this.pads)a.transform(e);for(let a of this.attributes)a.locked||a.transform(e);for(let a of this.others)a.transform(e);let r=new S(e.data[0],e.data[1]).normalize(),i=Math.atan2(r.y,r.x),n=(this.rotation+i)%Wd,s=this.position.multiply4(e);this._rotation=n,this._position=s,this.box.transform(e),this.updateShapeData()}getAttrBBox(){let e=new _e,r=!1;for(let i in this.attrs){let n=this.attrs[i];(n.showKey&&n.key!==""||n.showValue&&n.value!=="")&&(r=!0,e.ext1(this.attrs[i].bbox))}if(r)return e.build1()}addATTRMap(e,r){this._attrsMap[e]=r}modifyATTRMap(e,r){this._attrsMap[e]=r}deleteATTRMap(e){delete this._attrsMap[e]}clearMap(){this._attrsMap={}}getNewTextPosition(){let e=this.box.leftLow,r=this.box.leftLow.sub(this.box.leftUp).normalize(),i=this.textOffset.length(),n=e.add(r.mul(i)),s=this.attributes.length,a=_Ie+.5,l=.001;for(let c=1;c<s+1;c++){let h=e.add(r.mul(c*a)),u=!0;for(let d=0;d<s;d++){let p=this.attributes[d],m=h.add(r.mul(a-l)),g=h.sub(r.mul(a-l)),y=new _e;y.ext2(g).ext2(m);let b=y.build1();if(!p.positionIsNull&&b.isContains(p.position)){u=!1;break}}if(u){n=h;break}}return n.y>e.add(r.mul(i)).y&&(i+=-a),this.textOffset=new S(this.textOffset.x,i+a),n}resetAttr(e){e&&e.key!=""&&(e.showValue||e.showKey)&&e.positionIsNull&&(e.origin!=3&&(e.origin=3),e.position=this.getNewTextPosition(),e.positionIsNull=!1,e.key==="Name"&&(e.value=e.value))}inShape(e,r){return this.box.inShape(e,r)}updateBox(){return this.box.updateBox()}getMathGraphics(e=this.layerId,r=0){return this.isEmpty?null:this.box.getMathGraphics(e,r)}clone(){let e={...this._attrsMap},r=new Array(this.attributes.length),i=0;for(let c of this.attributes)r[i]=c.clone(),i++;let n=this.getItems(),s=new Array(n.length);i=0;for(let c of n)s[i]=c.clone(),i++;let a=this.box.clone(),l=new o(this._globalIndex,this.layerId,this._position,this._rotation,this._textOffset,e,r,s,a,this._footprintUUID,this._deviceUUID,this._silkColor);return l.number=this.number,l.zIndex=this.zIndex,l}initBox(){let e=Ji.getInstance().getItem(this.footprintUUID);if(e==null)throw new Error("Footprint not exsit!!!");let r=this.layerId,i=this.position,n=e.getBBox();n==null&&(n=e.getOrigin().bbox());let s=r==2?-1:1,a=this.rotation;a=r==2?(Math.PI-a)%Wd:a;let l=Ae.getMatrix4(S.ORIGIN,a,s,i);this.box.leftLow=n.LL(),this.box.leftUp=n.UL(),this.box.rightLow=n.LR(),this.box.rightUp=n.UR(),this.box.transform(l),this.box.updateBox(),this.refreshBBox=!0,this.watchBBoxModify()}addCompositionItem(e){this.updateReplacedLayerId(e),e.modelType==="Pad"?(this.pads.push(e),this.setNet4Model(e)):e.modelType==="Via"?(this.setNet4Model(e),this.others.push(e)):this.others.push(e),e.setParent(this)}removeCompositionItemById(e,r=!0){let i=-1,n=r?this.pads:this.others;for(let s=0;s<n.length;s++)if(n[s].globalIndex===e){i=s;break}i<=-1||n.splice(i,1)}buildBBox(){return this.isEmpty?null:(this.refreshBBox&&(this.updateBox(),this.refreshBBox=!1),this.bbox)}};var NM=class NM extends Ei{static getInstance(){return NM.manager==null&&(NM.manager=new NM),NM.manager}addModel(t){this.map.set(t.globalIndex,t)}add(t,e,r,i,n,s,a,l,c,h,u,d=null){return this._last=new Bi(t,e,r,i,n,s,a,l,c,h,u,d),this.addModel(this._last),this._last}delete(t,e){t instanceof Bi&&this.map.delete(e)}};NM.manager=null;var Ms=NM;var QO=class o extends gy{constructor(e,r,i,n,s,a,l,c,h,u,d,p,m=1.2,g=.8,y=3,b,P,T){super();this._lineLen=1.2;this._arrLineLen=.8;this._textOffset=3;let I=n.distance1(s),C=b||zO(I,c,d).toString()+d,{width:E,height:O,path:_}=fd(C,h,u),x=Pk(n,s,E,y),v=NP(is(i)?-s.angle(n):s.angle(n)),D=is(i)?9:3;T=T||new Ku(e,i,0,"",!1,C,!0,"default",h,v,x,D,u,!1,0,!1,!1,_,E,O,p),P==null&&(P=Tk(n,s,a,l,u,T,m,g)),this._globalIndex=e,this.modelType=r,this._start=n,this._end=s,this._left=a,this._right=l,this._precision=c,this._lineLen=m,this._arrLineLen=g,this._textOffset=y,this._bbox=P,this._unit=d,this.text=T}get refreshBBox(){return this.text.refreshBBox}set refreshBBox(e){this.text.refreshBBox=e}get layerId(){return this.text.layerId}set layerId(e){this.text.layerId!=e&&(this.watchLayerIdModify(this.layerId),this.text.layerId=e,is(e)&&this.text.origin!=9?this.text.origin=9:!is(e)&&this.text.origin!=3&&(this.text.origin=3),this.updateText(),this.layerModified=!0)}get unit(){return this._unit}set unit(e){this._unit!=e&&(this._unit=e,this.updateText())}get textPosition(){return this.text.position}get strokeWidth(){return this.text.strokeWidth}set strokeWidth(e){this.text.strokeWidth!=e&&(this.text.strokeWidth=e,this.updateText())}get start(){return this._start}set start(e){this._start.equals(e)||(this._start=e,this.updateText())}get end(){return this._end}set end(e){this._end.equals(e)||(this._end=e,this.updateText())}get left(){return this._left}set left(e){this._left.equals(e)||(this._left=e,this.updateText())}get right(){return this._right}set right(e){this._right.equals(e)||(this._right=e,this.updateText())}get length(){return this.start.distance1(this.end)}set length(e){let i=this.end.sub(this.start).normalize().mul(e-this.length),n=Ae.translate(i.x,i.y,0);this.end=this.end.multiply4(n),this.right=this.right.multiply4(n)}get precision(){return this._precision}set precision(e){this._precision!=e&&(this._precision=e,this.updateText())}get fontSize(){return this.text.fontSize}set fontSize(e){this.text.fontSize!=e&&(this.text.fontSize=this.fontSize,this.updateText())}get content(){return zO(this.length,this.precision,this.unit).toString()+this._unit}get lineLen(){return this._lineLen}set lineLen(e){this._lineLen!=e&&(this._lineLen=e)}get arrLineLen(){return this._arrLineLen}set arrLineLen(e){this._arrLineLen!=e&&(this._arrLineLen=e)}get textOffset(){return this._textOffset}set textOffset(e){this._textOffset!=e&&(this._textOffset=e)}get bbox(){return this._bbox}updateText(){let{width:e,height:r,path:i}=fd(this.content,this.fontSize,this.strokeWidth);this.text.outline=i,this.text.position=Pk(this.start,this.end,e,this.textOffset);let n=is(this.layerId);this.text.rotation=NP(n?-this.end.angle(this.start):this.end.angle(this.start)),this.text.updateBox4(e,r),this.updateShapeData()}transform(e){this.start=this.start.multiply4(e),this.end=this.end.multiply4(e),this.left=this.left.multiply4(e),this.right=this.right.multiply4(e),this.updateText()}inShape(e,r){let i=new S(e,r),n=QC(this.start,this.end,this.left,this.right,this.text.box.width,this.lineLen,this.arrLineLen);for(let s of n)if(Da(i,s.start(),s.end(),this.strokeWidth))return!0;return this.text.inShape(e,r)}get locked(){return this.text.locked}set locked(e){this.text.locked=e}calibrateLine(e,r,i,n){let s,a,l;this.start.equals(this.end)?(r?s=this.vectorProjectOnPerpendicularLine(this.right.sub(this.left),e[0].sub(e[1])):s=this.vectorProjectOnPerpendicularLine(e[0].sub(e[3]),e[1].sub(e[0])),a=0):(s=this.end.sub(this.start),a=s.length());let c=s.normalize(),h=e[3].sub(e[2]).dot(c);switch(i?l=a+h:l=a-h,n){case 0:this.end=e[3].add(c.mul(l)),this.left=e[3].add(e[1].sub(e[0]));break;case 1:this.start=e[3].sub(c.mul(l)),this.right=e[3].add(e[1].sub(e[0]));break;case 2:this.start=e[1].sub(c.mul(l));break;case 3:this.end=e[1].add(c.mul(l));break}}vectorProjectOnPerpendicularLine(e,r){let i=r.rotate(new S(0,0),Math.PI/2).normalize(),n=e.angle(i);return Math.abs(n)>Math.PI/2&&(i=i.mul(-1)),i.mul(e.dot(i))}updateBox(){return this.text.buildBBox(),this._bbox=Tk(this.start,this.end,this.left,this.right,this.strokeWidth,this.text,this.lineLen,this.arrLineLen),this._bbox}remove(){uo.getInstance().textConfig.setCustomColor(this.text.globalIndex,null),super.remove()}clone(){let e=new o(this._globalIndex,this.modelType,this.layerId,this._start,this._end,this._left,this._right,this._precision,this.fontSize,this.strokeWidth,this._unit,this.locked,this._lineLen,this._arrLineLen,this._textOffset,this.text.value,this._bbox);return e.number=this.number,e.zIndex=this.zIndex,e}};var kM=class kM extends Ei{static getInstance(){return kM.manager==null&&(kM.manager=new kM),kM.manager}addDimension(t,e,r,i,n,s,a,l,c,h,u){let d=new QO(t,"Smart Dimension",e,r,i,n,s,a,l,c,h,u);return this.map.set(t,d),d}copy(t){}delete(t){t instanceof QO&&this.map.delete(t.globalIndex)}};kM.manager=null;var Cx=kM;function ch(o){let t=[Sn.getInstance(),jn.getInstance(),bn.getInstance(),Fi.getInstance(),sl.getInstance(),Qi.getInstance(),io.getInstance(),Na.getInstance(),Ma.getInstance(),Cx.getInstance(),Ms.getInstance(),vi.getInstance(),Hs.getInstance(),_p.getInstance(),qo.getInstance(),Xo.getInstance()];for(let e of t){let r=e.getItem(o);if(r!=null)return r}return null}function uFe(){let o=[],t=[Sn.getInstance(),jn.getInstance(),bn.getInstance()];for(let e of t)e.getAllItem().forEach(r=>o.push(r));return o}function aS(o){switch(o.modelType){case"Track":case"ArcTrack":{Sn.getInstance().addModel(o);break}case"Pad":{jn.getInstance().addModel(o);break}case"Via":{bn.getInstance().addModel(o);break}case"Image":{Hs.getInstance().addModel(o);break}case"Picture":{_p.getInstance().addModel(o);break}case"Length Dimension":{Ma.getInstance().addModel(o);break}case"Protractor Dimension":{Na.getInstance().addModel(o);break}case"Radius Dimension":{sl.getInstance().addModel(o);break}case"Polygon":{vi.getInstance().addModel(o);break}case"Rect":{Qi.getInstance().addModel(o);break}case"Circle":{Fi.getInstance().addModel(o);break}case"Copper":{qo.getInstance().addModel(o);break}case"Inner":{Xo.getInstance().addModel(o);break}case"Component":{let e=o;for(let r of e.getItems())aS(r);for(let r of e.attributes)aS(r);Ms.getInstance().addModel(o);break}case"Text":{io.getInstance().addModel(o);break}default:}}function eA(o,t){switch(o){case"Track":case"ArcTrack":return Sn.getInstance().getItem(t);case"Pad":return jn.getInstance().getItem(t);case"Via":return bn.getInstance().getItem(t);case"Image":return Hs.getInstance().getItem(t);case"Picture":return _p.getInstance().getItem(t);case"Length Dimension":return Ma.getInstance().getItem(t);case"Protractor Dimension":return Na.getInstance().getItem(t);case"Radius Dimension":return sl.getInstance().getItem(t);case"Polygon":return vi.getInstance().getItem(t);case"Rect":return Qi.getInstance().getItem(t);case"Circle":return Fi.getInstance().getItem(t);case"Copper":return qo.getInstance().getItem(t);case"Inner":return Xo.getInstance().getItem(t);case"Component":return Ms.getInstance().getItem(t);case"Text":return io.getInstance().getItem(t);default:return}}function GY(o){let t=o[0],e=o[1];switch(t){case"NET_CLASS":return re.getInstance().getNetClass(e);case"DIFF_PAIR":return re.getInstance().getNetDifferential(e);case"EQ_LEN_GRP":return re.getInstance().getEqualLengthGroup(e);case"NET":return re.getInstance().getNet(e);case"POUR":case"REGION":return re.getInstance().getRegion(e);default:if(Array.isArray(t)&&Array.isArray(e))return re.getInstance().betweenNetRule.getRule(t[1],e[1])}}function dFe(o){let t=o[0],e=o[1];switch(t){case"NET_CLASS":re.getInstance().deleteNetClass(e);break;case"DIFF_PAIR":re.getInstance().deleteNetDifferential([e]);break;case"EQ_LEN_GRP":re.getInstance().deleteEqualLengthGroup(e);break;case"NET":re.getInstance().deleteNet(e);break;case"POUR":case"REGION":re.getInstance().deleteRegion(e);break;default:Array.isArray(t)&&Array.isArray(e)&&re.getInstance().betweenNetRule.deleteRule4(t[1],e[1]);break}}function pFe(o,t){switch(o){case"1":return re.getInstance().getSafeSpacing(t);case"2":return re.getInstance().getOtherSpacing(t);case"3":return re.getInstance().getTrackPhysics(t);case"11":return re.getInstance().getNetLengthPhysics(t);case"13":return re.getInstance().getNetLengthTolerancePhysics(t);case"10":return re.getInstance().getDifferentialPhysics(t);case"4":return re.getInstance().getBlindPhysics(t);case"5":return re.getInstance().getRadiusPhysics(t);case"6":return re.getInstance().getInnerPlane(t);case"7":return re.getInstance().getCopperPlane(t);case"8":return re.getInstance().getPasteExpansion(t);case"9":return re.getInstance().getSolderExpansion(t);case"12":return re.getInstance().getAutoRouter(t);case"14":return re.getInstance().getCreepageSpacing(t)}}function fFe(o,t){switch(o){case"1":re.getInstance().deleteSafeSpacing(t);case"2":re.getInstance().deleteOtherSpacing(t);case"3":re.getInstance().deleteTrackPhysics(t);case"11":re.getInstance().deleteNetLengthPhysics(t);case"13":re.getInstance().deleteNetLengthTolerancePhysics(t);case"10":re.getInstance().deleteDifferentialPhysics(t);case"4":re.getInstance().deleteBlindPhysics(t);case"5":re.getInstance().deleteRadiusPhysics(t);case"6":re.getInstance().deleteInnerPlane(t);case"7":re.getInstance().deleteCopperPlane(t);case"8":re.getInstance().deletePasteExpansion(t);case"9":re.getInstance().deleteSolderExpansion(t);case"12":re.getInstance().deleteAutoRouter(t);case"14":re.getInstance().deleteCreepageSpacing(t)}}function UY(o){return Qi.getInstance().getItem(o)||Fi.getInstance().getItem(o)||vi.getInstance().getItem(o)}var Sx=class{constructor(t,e){this.junctions=new Array;this.id=e,this.junctions=t}};var Ja=class o{constructor(t){this._id=null;this.point=t}hashCode(){return this.point.hashCode()}equals(t){return t instanceof o?this.point.equals(t.point):t instanceof S?this.point.equals(t):!1}bbox(){return this.point.bbox()}get id(){return this._id}set id(t){this._id=t}};var sre=class{constructor(t){this.node=t}bbox(){return this.node.bbox}},are=class extends sre{constructor(t,e){super(t),this.point=e,this.box=e.bbox().extendOfSize(Math.min(t.width/2,.1))}bbox(){return this.box}},Ex=class o{static getCluster(t,e){let r=new Array;if(t.size==1){for(let i of t)if(i instanceof et||i instanceof Ct){let n=new Ja(i.center);n.id=i.globalIndex}else if(i instanceof gt){let n=new Ja(i.start);n.id=i.globalIndex;let s=new Ja(i.end);s.id=i.globalIndex,r.push(n),r.push(s)}else if(i instanceof yo){let n=new S(i.center.x-i.radius,i.center.y),s=new Ja(n);s.id=i.globalIndex,r.push(s)}else if(i instanceof Za){let n=new Ja(i.start);n.id=i.globalIndex,r.push(n)}else if(i instanceof ss){let n=new Ja(i.start);if(n.id=i.globalIndex,r.push(n),i.type=="Line"&&!i.isClose()){let s=new Ja(i.end);s.id=i.globalIndex,r.push(s)}}else if(i instanceof jl){let n=new Ja(i.start);n.id=i.globalIndex,r.push(n)}}else{let i=new Array,n=new ji(10),s=new ji(10);for(let c of t)if(c instanceof gt){let h=new are(c,c.start),u=new are(c,c.end);n.add(h),n.add(u),i.push(h),i.push(u)}else if(c instanceof et||c instanceof Ct){s.add(new sre(c));let h=new Ja(c.center);h.id=c.globalIndex,r.push(h)}else if(c instanceof yo){let h=new S(c.center.x-c.radius,c.center.y),u=new Ja(h);u.id=c.globalIndex,r.push(u)}else if(c instanceof Za){let h=new Ja(c.start);h.id=c.globalIndex,r.push(h)}else if(c instanceof ss){let h=new Ja(c.start);if(h.id=c.globalIndex,r.push(h),c.type=="Line"&&!c.isClose()){let u=new Ja(c.end);u.id=c.globalIndex,r.push(u)}}else if(c instanceof jl){let h=new Ja(c.start);h.id=c.globalIndex,r.push(h)}let a=new gd,l=new Set;for(let c of i){if(l.has(c))continue;let h=!1,u=Math.min(c.node.width/2,.1),d=n.search(c.point.bbox().extendOfSize(u));for(let p of d)if(!(c==p||c.node==p.node||!a.needCheckIntersection(c.node,p.node))&&!l.has(p)&&c.point.distance1(p.point)<=u){l.add(p),l.add(c),h=!0;break}if(!h){let p=s.search(c.bbox());for(let m of p){if(c==m||c.node==m.node||!a.needCheckIntersection(c.node,m.node))continue;if(m.node.inOutline(c.point)){l.add(c),h=!0;break}}}if(!h){let p=new Ja(c.point);p.id=c.node.globalIndex,r.push(p)}}}if(r.length==0){let i=o.getDefault(t);i!=null&&r.push(i)}return new Sx(r,e)}static getDefault(t){for(let e of t)if(e instanceof et||e instanceof Ct){let r=new Ja(e.center);return r.id=e.globalIndex,r}else if(e instanceof gt){let r=new Ja(e.start);return r.id=e.globalIndex,r}else if(e instanceof yo){let r=new S(e.center.x-e.radius,e.center.y),i=new Ja(r);return i.id=e.globalIndex,i}else if(e instanceof Za){let r=new Ja(e.start);return r.id=e.globalIndex,r}else if(e instanceof ss){let r=new Ja(e.start);return r.id=e.globalIndex,r}else if(e instanceof jl){let r=new Ja(e.start);return r.id=e.globalIndex,r}return null}};var T2=class{constructor(t,e,r,i){this._length=null;this.cluster1=t,this.cluster2=e,this.left=r,this.right=i}get length2(){return this._length==null&&(this._length=this.left.point.distance2(this.right.point)),this._length}build(t){let e=this.left,r=this.right;return UP.getInstance().add("rat"+e.id+r.id,e.point,r.point,t,e.id,r.id)}};var Ox=class{constructor(t,e){this.p0=t,this.p1=e}eqauls(t){return this.p0.x==t.p0.x&&this.p0.y==t.p0.y?this.p1.x==t.p1.x&&this.p1.y==t.p1.y:this.p1.x==t.p0.x&&this.p1.y==t.p0.y?this.p0.x==t.p1.x&&this.p0.y==t.p1.y:!1}get length2(){return this.p0.distance2(this.p1)}},cre=class{constructor(t,e,r){this.p0=t,this.p1=e,this.p2=r}update(t,e,r){this.p0=t,this.p1=e,this.p2=r}get center(){let t=this.p1.sub(this.p0),e=this.p2.sub(this.p0),r=this.p1.distance2(S.ORIGIN)-this.p0.distance2(S.ORIGIN),i=this.p2.distance2(S.ORIGIN)-this.p0.distance2(S.ORIGIN),n=1/(2*t.cross(e)),s=(e.y*r+-t.y*i)*n,a=(-e.x*r+t.x*i)*n;return new S(s,a)}getRadius(t){return t.distance1(this.p0)}get edges(){return[new Ox(this.p0,this.p1),new Ox(this.p1,this.p2),new Ox(this.p2,this.p0)]}},lre=50;function HY(o,t,e=0){let r=lre*10**e,i=o.div(r),n=t/r,s=Math.floor(i.x-n),a=Math.floor(i.x+n),l=Math.floor(i.y-n),c=Math.floor(i.y+n);return a-s==1?c-l==1?[{x:a,y:c,level:e},{x:a,y:l,level:e},{x:s,y:c,level:e},{x:s,y:l,level:e}]:c==l?[{x:a,y:l,level:e},{x:s,y:l,level:e}]:HY(o,t,e+1):c-l==1?a==s?[{x:a,y:c,level:e},{x:a,y:l,level:e}]:HY(o,t,e+1):a==s&&c==l?[{x:a,y:l,level:e}]:HY(o,t,e+1)}function WY(o,t,e,r){if(o==null||t==null)return 1;let i=o.distance1(t);return ne.lesseq(i+r,e)?-1:ne.lesseq(i+e,r)?2:ne.greater(i,e+r)?1:0}function mFe(o,t,e,r){let i=WY(o,t,e,r);if(i==-1||t==null)return{center:o,r:e};if(i==2||o==null)return{center:t,r};let n=o.distance1(t),s=(n+e+r)/2,a=(s-e)/n;return{center:new S(o.x+a*(t.x-o.x),o.y+a*(t.y-o.y)),r:s}}var gFe=20,MB=class o{constructor(){this.childs=new Array;this.parent=null}insert(t){let e=this.childs;if(!(t instanceof o))for(let r=0;r<e.length;r++){let i=e[r];if(i instanceof o&&WY(i.center,t[1],i.radius,t[2])===-1){i.insert(t);return}}if(t instanceof o&&(t.parent=this),e.length<=gFe)if(e.push(t),this.center==null)this.center=t[1],this.radius=t[2];else{let r=mFe(this.center,t[1],this.radius,t[2]);this.center=r.center,this.radius=r.r}else e.push(t),this.splitNode()}checkNode(){this.childs.length>0?(this.updateBBox(),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):this.parent!==null?(this.parent.remove(this),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):(this.center=null,this.radius=null)}remove(t){if(t instanceof o&&t.childs.length>0)throw new Error;let e=this.childs,r=new Array,{center:i,radius:n}=this.get(t);for(let s=0;s<e.length;s++){let a=e[s];if(a===t)return e.splice(s,1),e.length>0?(this.updateBBox(),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):this.parent!==null?(this.parent.remove(this),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):(this.center=null,this.radius=null),1;a instanceof o&&WY(a.center,i,a.radius,n)===-1&&r.push(a)}if(t instanceof o)throw new Error;for(let s of r){let a=s.remove(t);if(a===1)return this.childs.length>0&&this.updateBBox(),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox(),1;if(a!==0)throw new Error}return 0}recycle(){this.childs.length=0,this.center=null,this.radius=null}get(t){let e,r;return t instanceof o?(e=t.center,r=t.radius):(e=t[1],r=t[2]),{center:e,radius:r}}updateBBox(){let t,e;for(let r of this.childs){let i=this.get(r);if(t==null)t=i.center,e=i.radius;else{let n=mFe(t,i.center,e,i.radius);t=n.center,e=n.r}}this.center=t,this.radius=e}splitNode(){let t=this.childs,e=t.length,r=-1,i=-1,n=Number.NEGATIVE_INFINITY;for(let c=0;c<e;c++){let h=this.get(t[c]);for(let u=c+1;u<e;u++){let d=this.get(t[u]),p=h.center.distance2(d.center);p>n&&(n=p,r=c,i=u)}}let s=this.asNode(t[r]),a=this.asNode(t[i]);for(let c=0;c<e;c++)if(c!==r&&c!==i){let h=this.get(t[c]),u=s.center.distance2(h.center),d=a.center.distance2(h.center);u<d?s.insert(t[c]):a.insert(t[c])}s.updateBBox(),a.updateBBox(),t.length=0;let l=this.parent;l!==null&&l.childs.length<gFe?(s.parent=l,a.parent=l,l.childs.push(s),l.childs.push(a),l.remove(this),l.updateBBox()):(s.parent=this,a.parent=this,t.push(s),t.push(a),this.updateBBox()),this.childs.length>0&&this.updateBBox()}asNode(t){if(t instanceof o)return t;{let e=new o;return e.insert(t),e}}},hre=class{constructor(){this.items=new Set;this.root=new MB}search(t,e,r){let i=[],n=[];if(this.items.size==0||this.root!=null&&WY(this.root.center,t,this.root.radius,e)==1)return i;n.push(this.root);let s=null,a=new Array;for(;s=n.shift(),s!==void 0;){for(let c=0,h=s.childs.length;c<h;c++){let u=s.childs[c],d=this.get(u),p=WY(d.center,t,d.radius,e);p!=1&&(u instanceof MB?p==2?this.add2Result(u,i,r):n.push(u):r(u)&&(i.push(u),a.push(c),this.items.delete(u)))}let l=a.length>0;for(;a.length>0;){let c=a.pop();s.childs.splice(c,1)}l&&s.checkNode()}return i}get(t){let e,r;return t instanceof MB?(e=t.center,r=t.radius):(e=t[1],r=t[2]),{center:e,radius:r}}add2Result(t,e,r){let i=[t];for(;;){let n=i.shift();if(n!==void 0)for(let s of n.childs)s instanceof MB?i.push(s):(!r||r(s))&&e.push(s);else break}}insert(t){this.items.add(t),this.root.insert(t)}remove(t){if(this.items.delete(t))return this.root.remove(t)}recycle(){this.items.clear(),this.root.recycle()}},ure=class{constructor(){this.grids=new Map;this.edges=new Array}search(t){var r;let e=new Set;for(let[i,n]of this.grids){let s=lre*10**i,a=t.div(s),l=Math.floor(a.x),c=Math.floor(a.y),h=(r=n.get(l))==null?void 0:r.get(c);if(h!=null)for(let u of h.search(t,0,d=>d[1].distance1(t)-d[2]<=1e-4))e.add(u)}return e}insertGrid(t){let[,e,r]=t,i=HY(e,r);for(let{x:n,y:s,level:a}of i){let l=this.grids.get(a);l==null&&(l=new Map,this.grids.set(a,l));let c=l.get(n);c==null&&(c=new Map,l.set(n,c));let h=c.get(s);h==null&&(h=new hre,c.set(s,h)),h.insert(t)}}delete(t){let[,e,r]=t,i=HY(e,r);if(i.length!=1)for(let{x:n,y:s,level:a}of i){let l=this.grids.get(a);l==null&&(l=new Map,this.grids.set(a,l));let c=l.get(n);c==null&&(c=new Map,l.set(n,c));let h=c.get(s);h==null&&(h=new hre,c.set(s,h)),h.remove(t)}}triangulate(t){if(t.length<1)return;if(Er(t,(v,D)=>ne.eq(v.x,D.x)?v.y-D.y:v.x-D.x,0,t.length),t.length==2){this.edges.push(new Ox(t[0],t[1]));return}let e=new _e,r=new Map,i=new Map,n=0,s=null,a=new Set;for(let v of t){if(s!=null&&s.equals1(v)){this.edges.push(new Ox(s,v)),a.add(v);continue}s=v,r.set(n,v),i.set(v,n),e.ext2(v),n++}e.ext7(20);let l=e.build();Math.max(l.width(),l.height())>1e3?lre=50:lre=20;let c=l.LL(),h=l.UL(),u=l.LR(),d=l.UR(),p=n;for(let v of[c,h,u,d])r.set(n,v),i.set(v,n),n++;let m=this.getTriangle4Index([p,p+1,p+2],r),g=this.getTriangle4Index([p+1,p+3,p+2],r);this.insertGrid(m),this.insertGrid(g),n=0;let y=new Map,b=null,P,T,I,C;for(let v of t)if(!a.has(v)){P=this.search(v);for(let D of P){let[w]=D;this.getEdge(w,y),this.delete(D)}for(let[,D]of y)if(D.length==1&&(b=D[0],I=r.get(b[0]),C=r.get(b[1]),Math.abs(I.sub(C).cross(I.sub(v)))>1e-4)){let w=this.getTriangle4Points(I,C,v,i);this.insertGrid(w)}y.clear()}let E=new Map,O=this.edges;function _(v,D){if(v>=p||D>=p)return;if(v>D){let F=v;v=D,D=F}let w=E.get(v);if(w==null&&(w=new Set,E.set(v,w)),!w.has(D)){let F=new Ox(r.get(v),r.get(D));w.add(D),O.push(F)}}let x;for(let[,v]of this.grids)for(let[,D]of v)for(let[,w]of D)for(let F of w.items)x=F[0],_(x[0],x[1]),_(x[1],x[2]),_(x[2],x[0]);this.grids.clear()}getEdge(t,e){return this.toMap(t[0],t[1],e),this.toMap(t[1],t[2],e),this.toMap(t[2],t[0],e),e}toMap(t,e,r){let i=this.getKey(t,e),n=r.get(i);n==null&&(n=[],r.set(i,n)),n.push([t,e])}getKey(t,e){return t>e?e+","+t:t+","+e}getTriangle4Points(t,e,r,i){let n=new cre(t,e,r),s=[i.get(t),i.get(e),i.get(r)],a=n.center,l=n.getRadius(a);return[s,a,l]}getTriangle4Index(t,e){let r=new cre(e.get(t[0]),e.get(t[1]),e.get(t[2])),i=r.center,n=r.getRadius(i);return[t,i,n]}};function NB(o){let t=new Uint32Array(o*2);for(let i=0;i<o;i++)t[i*2]=i,t[i*2+1]=0;let e=i=>{let n=i;for(;t[n*2]!==n;)n=t[n*2];let s=i;for(;s!==n;){let a=t[s*2];t[s*2]=n,s=a}return n};return{find:e,union:(i,n)=>{let s=e(i),a=e(n);if(s===a)return!1;let l=t[s*2+1],c=t[a*2+1];return l>c?t[a*2]=s:l<c?t[s*2]=a:(t[a*2]=s,t[s*2+1]++),!0}}}var Ax=class{constructor(t,e,r=!1){this.clusters=new Array;let i=0;this._net=t,Zh.getInstance().clear(),this.ids=e;for(let n of this.ids){if(r&&n.size<=BM)continue;let s=new Set;for(let a of n){let l=ch(a);l&&!(l instanceof jl||l instanceof ss&&l.type=="TearDrop")&&s.add(l)}if(s.size>0){let a=Ex.getCluster(s,i++);n.size>BM&&hS.add(n,a),this.clusters.push(a)}}}getConnects(){let t=new Array,e=0;for(let r of this.ids)t[e++]=Array.from(r);return t}generateRatline(){let t=this.clusters.length,e=new Array;if(t>1){let r=this.getMaters();Er(r,(s,a)=>s.length2-a.length2,0,r.length);let i=new Set,n=NB(this.clusters.length);for(let s of r)if(n.union(s.cluster1.id,s.cluster2.id)&&(i.add(s),i.size===this.clusters.length-1))break;for(let s of i)e.push(s.build(this._net));this.clusters=[]}return e}getMaters(){let t=new Map,e=new Map,r=new Map;for(let n of this.clusters)for(let s of n.junctions){let a=s.point.clone();e.set(a,n),r.set(a,s)}let i=new ure;i.triangulate(Array.from(e.keys()));for(let n of i.edges){let{p0:s,p1:a}=n,l=e.get(s),c=e.get(a);if(l!=c){let h=this.getId(l.id,c.id),u=t.get(h);u!=null?u.length2>n.length2&&t.set(h,new T2(l,c,r.get(s),r.get(a))):t.set(h,new T2(l,c,r.get(s),r.get(a)))}}return e.clear(),r.clear(),Array.from(t.values())}getId(t,e){return t<e?t+"|"+e:e+"|"+t}union(t,e){let r=new Set;for(let i of t)r.add(i);for(let i of e)r.add(i);return r}getFather(t,e){let r=null,i=null;for(let n of e)n.has(t.cluster1)&&(r=n),n.has(t.cluster2)&&(i=n);if(r==null&&i==null){let n=new Set;return n.add(t.cluster1),n.add(t.cluster2),e.add(n),!0}else{if(r!=null&&i==null)return r.add(t.cluster2),!0;if(r==null&&i!=null)return i.add(t.cluster1),!0;if(r!=i){e.delete(r),e.delete(i);let n=this.union(r,i);return e.add(n),!0}}return!1}};var BM=20,kIe=class{constructor(){this.map=new Map}updateIds(t,e){e.every(i=>!!this.get(i))||new Ax(t,e,!0)}delete(t){this.map.delete(t)}add(t,e){this.map.delete(t),this.map.set(t,e)}getCluster(t){let e=new Set;for(let r of t){let i=ch(r);i&&!(i instanceof jl||i instanceof ss&&i.type=="TearDrop")&&e.add(i)}return e.size>0?Ex.getCluster(e,0):null}get(t){return t.size<=BM?this.getCluster(t):this.map.get(t)}},BIe=class{constructor(){this.map=new Map}add(t,e){this.map.delete(t),this.map.set(t,e)}get(t){return this.map.get(t)}},vp=class{};vp.useWireClusterCache=!1,vp.emptyNetChange=!0;var tA=new BIe,hS=new kIe;var dre=class{constructor(){this.add=new Set;this.remove=new Set;this.platPads=new Set}sycnChangeData(t,e,r){this.sycn(t,this.add),this.sycn(e,this.remove),this.sycn(r,this.platPads)}sycn(t,e){for(let r of t)e.add(r.globalIndex)}has(t){return this.remove.has(t)||this.add.has(t)||this.platPads.has(t)}};var pre=class{constructor(t,e){this.rtree1=new ji(10);this.rtree2=new ji(10);this.left=null;this.right=null;this.distance=Number.MAX_VALUE;t.itemList.length==1?this.left=t.itemList[0]:this.rtree1=t,e.itemList.length==1?this.right=e.itemList[0]:this.rtree2=e,this.find()}findNearXPoint(t,e){let r=Number.MAX_VALUE,i=e[0];for(let n of e){let s=Math.abs(n.point.x-t.point.x);s<r&&(r=s,i=n)}return i}findNearest(t,e){let r=t.point.bbox().extendOfSize(this.distance),i=e.search(r),n=null,s=this.distance*this.distance;for(let a of i){let l=a.point.distance2(t.point);l<s&&(s=l,n=a)}return this.distance=Math.sqrt(s),n}find(){if(this.rtree1.itemList.length==0&&this.rtree2.itemList.length==0){this.distance=this.left.point.distance1(this.right.point);return}else if(this.rtree1.itemList.length==0&&this.rtree2.itemList.length!=0){let t=this.findNearest(this.left,this.rtree2);t!=null&&(this.right=t)}else if(this.rtree1.itemList.length!=0&&this.rtree2.itemList.length==0){let t=this.findNearest(this.right,this.rtree1);t!=null&&(this.left=t)}else{let t=this.findNearXPoint(this.rtree1.itemList[0],this.rtree2.itemList),e=this.rtree1.itemList[0].point.distance1(t.point);e<this.distance&&(this.distance=e,this.left=this.rtree1.itemList[0],this.right=t)}for(let t of this.rtree1.itemList){let e=this.findNearest(t,this.rtree2);e!=null&&(this.left=t,this.right=e)}}};var rA=class extends Sx{constructor(t,e,r){let i=new Array,n=new Map;for(let s of t)for(let a of s.junctions)n.set(a,s),i.push(a);super(i,e),this.map=n,this.max=r}},fre=class{constructor(t){this.changes=new dre;this.id=0;this.oldMap=new Map;this._net=t}rebuild(){Wo.removeNetRatlines(this._net),Iu.deleteJumpWireCache(this._net);let t=Iu.cluster(this._net,!0),e=new Ax(this._net,t).generateRatline();for(let r=0;r<e.length;r++)Wo.addRatlineByModel(e[r])}generateRatline(){let t=this.getRatlines(this._net);if(t==null||t.length==0)return this.rebuild();let e=this.getOldClusterIds(this._net);this.clearOldCache();let r=this.updateClusterIds4Net(this._net);e=this.filterNotChangeIds(e);let i=this.getClusterMap(e),n=this.getClusterMap(r),{notChanges:s,changes:a,allIds:l}=this.compareCluster(i,n),c=this.getChangeClusters(a),{oldMaters:h,clusters:u,all:d}=this.getClusterMaters(t,s,c);tA.add(this._net,l);let p=this.getSuperNode(h);xe.addAll(p,c);let m=new Map;for(let b of p){let P=this.getStaticRtree(b);m.set(b,P)}for(let b of u){let P=this.getStaticRtree(b);m.set(b,P)}let g=p.length;if(g>500)return this.rebuild();for(let b=0;b<g;b++){let P=p[b],T=m.get(P);for(let I=b+1;I<g;I++){let C=p[I],E=m.get(C);this.createSuperMaterial(T,E,P,C,m,h)}}let y=this.getRatlineResult(d,h);for(let b=0;b<y.length;b++)Wo.addRatlineByModel(y[b])}getSuperNode(t){let e=new Map,r=new Map;for(let s of t){let a=s.cluster1,l=s.cluster2,c=e.get(a),h=e.get(l);c==null&&(c=new Set,e.set(a,c)),c.add(l),h==null&&(h=new Set,e.set(l,h)),h.add(a);let u=Math.max(s.length2,r.get(a)||0),d=Math.max(s.length2,r.get(l)||0);r.set(a,u),r.set(l,d)}let i=new Set,n=new Array;for(let[s,a]of e){if(i.has(s))continue;let l=new Set,c=r.get(s);l.add(s),i.add(s);let h=Array.from(a);for(xe.addAllSet(i,h);h.length>0;){let d=h.shift();l.add(d),c=Math.max(c,r.get(d));let p=e.get(d);if(p!=null)for(let m of p)i.has(m)||(h.push(m),i.add(m))}let u=new rA(l,this.id++,Math.sqrt(c));n.push(u)}return n}clearOldCache(){Wo.removeNetRatlines(this._net),Iu.deleteJumpWireCache(this._net)}addJumpWireClusterNodeCache(t,e){t.size>BM&&hS.add(t,e)}getRatlineResult(t,e){let r=t.length,i=new Array;if(r>0){Er(e,(a,l)=>a.length2-l.length2,0,e.length);let n=new Set,s=NB(r);for(let a of e)if(s.union(a.cluster1.id,a.cluster2.id)&&(n.add(a),n.size===r-1))break;for(let a of n)i.push(a.build(this._net))}return i}createMaterial(t,e,r,i){let n=this.getNearPoint(t,e);return new T2(r,i,n.left,n.right)}createSuperMaterial(t,e,r,i,n,s){if(r instanceof rA&&i instanceof rA){let a=this.getNearPoint(t,e);r=r.map.get(a.left),i=i.map.get(a.right),s.push(new T2(r,i,a.left,a.right))}else if(r instanceof rA&&!(i instanceof rA)){let a=this.getNearPoint(t,e),l=t.search(e.bbox().extendOfSize(Math.max(a.distance,r.max))),c=new Set;for(let h of l){let u=r.map.get(h);c.add(u)}r=r.map.get(a.left),c.delete(r),s.push(new T2(r,i,a.left,a.right));for(let h of c)s.push(this.createMaterial(n.get(h),e,h,i))}else if(!(r instanceof rA)&&i instanceof rA){let a=this.getNearPoint(t,e),l=e.search(t.bbox().extendOfSize(Math.max(a.distance,i.max))),c=new Set;for(let h of l){let u=i.map.get(h);c.add(u)}i=i.map.get(a.right),c.delete(i),s.push(new T2(r,i,a.left,a.right));for(let h of c)s.push(this.createMaterial(t,n.get(h),r,h))}else{let a=this.getNearPoint(t,e);s.push(new T2(r,i,a.left,a.right))}}getNearPoint(t,e){return new pre(t,e)}getStaticRtree(t){let e=new ji(10);for(let r of t.junctions)e.add(r);return e}getChangeClusters(t){let e=new Array;for(let r of t)this.getCluster(r,e);return e}getCluster(t,e){let r=new Set;for(let i of t){let n=ch(i);n&&!(n instanceof jl||n instanceof ss&&n.type=="TearDrop")&&r.add(n)}if(r.size>0){let i=Ex.getCluster(r,this.id++);this.addJumpWireClusterNodeCache(t,i),e.push(i)}}compareCluster(t,e){let r=new Array,i=new Array,n=new Array;for(let[s,a]of e){let l=t.get(s);l!=null&&l.length==a.length?(r.push(...l),n.push(...l)):(i.push(...a),n.push(...a))}return{notChanges:r,changes:i,allIds:n}}getClusterMap(t){let e=new Map;for(let r of t){let i=this.getHash(r),n=e.get(i);n==null&&(n=[],e.set(i,n)),n.push(r)}return e}filterNotChangeIds(t){let e=new Array;for(let r of t){let i=!1;for(let n of r)if(this.changes.has(n)){i=!0;break}i||e.push(r)}return e}getHash(t){return Array.from(t).sort().join("|")}updateClusterIds4Net(t){return Iu.getNode(t).cluster(!0,this.changes)}getClusterMaters(t,e,r){let i=new Map,n=new Map,s=Array.from(r);for(let u of e){n.set(u,this.getOldClusterNode(u));for(let d of u){let p=i.get(d);p==null&&(p=[],i.set(d,p)),p.push(u)}}let a=new Array,l=new Set,c=new Map,h=new Set;for(let u of t){let d=u.model.startId==u.model.endId;if(d){if(h.has(u.model.startId))continue;h.add(u.model.startId)}let p=i.get(u.model.startId),m=i.get(u.model.endId);if(p!=null&&m!=null&&(!d||d&&p.length>1))for(let g=0,y=p.length;g<y&&!(d&&g>0||!d&&h.has(u.model.startId)&&g>0);g++){let b=p[g];for(let P=0,T=m.length;P<T;P++){let I=m[P];if(b==I||!d&&h.has(u.model.endId)&&P>0)continue;let C=n.get(b),E=n.get(I);l.has(C)||(C.id=this.id++,l.add(C),s.push(C),this.addJumpWireClusterNodeCache(b,C)),l.has(E)||(E.id=this.id++,l.add(E),s.push(E),this.addJumpWireClusterNodeCache(I,E));let O=new Ja(u.start),_=new Ja(u.end);O.id=u.model.startId,_.id=u.model.endId;let x=new T2(C,E,O,_);a.push(x)}}else{if(p!=null)for(let g of p)c.has(g)||c.set(g,n.get(g));if(m!=null)for(let g of m)c.has(g)||c.set(g,n.get(g))}}for(let[u,d]of c)l.has(d)||(d.id=this.id++,s.push(d),this.addJumpWireClusterNodeCache(u,d)),r.push(d);return{oldMaters:a,clusters:l,all:s}}getOldClusterNode(t){return this.oldMap.get(t)}getOldClusterIds(t){let e=tA.get(t)||[];for(let r of e){let i=hS.get(r);if(i==null){let n=new Set;for(let s of r){let a=ch(s);a&&!(a instanceof jl||a instanceof ss&&a.type=="TearDrop")&&n.add(a)}if(n.size==0)continue}if(r.size<=BM){if(i==null)continue}else if(i==null)throw new Error("old cluster relation error!!!");this.oldMap.set(r,i)}return Array.from(this.oldMap.keys())}getRatlines(t){return Wo.getItem(t)}};var FM=class{static rebuildConnect(t){if(!t){this.emptyNetChange(t);return}Iu.deleteJumpWireCache(t),new Ax(t,Iu.cluster(t,!0),!0)}static rebuild(t){if(!t){this.emptyNetChange(t);return}new fre(t).generateRatline()}static rebuildAll(t){Array.isArray(t)&&(t=new Set(t));for(let e of t)this.rebuild(e)}static emptyNetChange(t){t==""&&(vp.emptyNetChange=!0)}};FM.userWorker=!0;var Eb=class Eb{static updateEmptyNet(){if(vp.emptyNetChange){let e=Eb.getNode("").cluster(!0);tA.add("",e),vp.emptyNetChange=!1}}static deleteJumpWireCache(t){let e=tA.get(t);if(e!=null)for(let r of e)hS.delete(r)}static cluster(t,e=!1){if(vp.useWireClusterCache){t==""&&Eb.updateEmptyNet();let n=tA.get(t);return n==null?[]:(hS.updateIds(t,n),n)}let i=Eb.getNode(t).cluster(e);return Eb.deleteJumpWireCache(t),tA.add(t,i),t==""&&(vp.emptyNetChange=!1),i}static getNetConnectRelation(t,e=!1){if(vp.useWireClusterCache){t==""&&Eb.updateEmptyNet();let n=tA.get(t);return n==null?[]:(hS.updateIds(t,n),n)}let i=Eb.getNode(t).cluster(e);return t==""&&(vp.emptyNetChange=!1),i}static getConnect(t){return Eb.getNode(t).getConnect()}static input(t){t&&(t.forEach(e=>{let{net:r,ratline:i}=e;Eb.map.set(r,new fY(r).getMap(e.map)),e.map.length=0,Eb.deleteJumpWireCache(r),Wo.removeNetRatlines(r),FM.rebuildConnect(r),i.forEach(n=>{Wo.addRatlineByModel(UP.getInstance().add(n.globalIndex,new S(n.start.x,n.start.y),new S(n.end.x,n.end.y),r,n.startId,n.endId))}),i.length=0}),t.length=0)}static getNode(t){let e=Eb.map.get(t);if(e)return e;let r=new fY(t);return Eb.map.set(t,r),r}};Eb.map=new Map;var Iu=Eb;var Qo=class o extends Ls{searchNode(t=!0){let e=new Array;I2.filterPlane=t,I2.clear(),I2.update([this]);let r=I2.getMap(),i=new hY(r);I2.sycnResult(i.result);let n=new Set,s=I2.getResult();for(let[l,c]of s)for(let[h,u]of c)u&&(n.add(h),n.add(l));let a=new Jt;for(let l of n){let c=a.getConnectNode(l);c!=null&&c!=this&&e.push(c)}return e}searchNowNode(t=!0){var s;let e=this.net;if(e==null)return[];let r=(s=Iu.getNode(e))==null?void 0:s.map.get(this.model),i=new Jt,n=new Array;if(r!=null)for(let a of r.near){let l=i.getItemByType(a.item.globalIndex,a.item.modelType);if(l!=null&&l!=this&&l instanceof o){if(t&&(a.item.modelType=="Copper"||a.item.modelType=="Inner"))continue;n.push(l)}}return n}searchNodeLoopType(){let t=new Array;I2.clear(),I2.updateLoopTypeConnect([this]);let e=I2.getMap(),r=new hY(e);I2.sycnResult(r.result);let i=new Set,n=I2.getResult();for(let[a,l]of n)for(let[c,h]of l)h&&(i.add(c),i.add(a));let s=new Jt;for(let a of i){let l=s.getConnectNode(a);l!=null&&l!=this&&t.push(l)}return t}searchNodeIgnoreNet(){let t=I2.getFilterWhetherCheckNet();I2.changeFilterWhetherCheckNet(!1);let e=this.searchNode();return I2.changeFilterWhetherCheckNet(t),e}searchCycleNode(){return VM.searchCycleNode(this)}searchCycleNode2(){return VM.searchCycleNode2(this,void 0,!0)}searchCycleNodeTrack(){return VM.searchCycleNode2(this,!0)}searchAllConnectNode(){return yFe(this)}searchAllConnectNode1(){vp.useWireClusterCache=!0;let t=yFe(this);return vp.useWireClusterCache=!1,t}iteratorRatlines(t){this._ratlines&&this._ratlines.some(e=>t(e))}hasRatline(t){return this._ratlines?this._ratlines.includes(t):!1}addRatline(t){this._ratlines||(this._ratlines=[]),this._ratlines.push(t)}removeRatline(t){if(!this._ratlines)return;let e=this._ratlines.indexOf(t);e>=0&&this._ratlines.splice(e,1),this._ratlines.length==0&&this.clearRatlines()}clearRatlines(){this._ratlines&&delete this._ratlines}};function uS(o){let t="searchConnectNodeIds-time";Cn(t);let e=pte.getInstance().getItem(o),r=null;if(e==null)r=Iu.getNetConnectRelation(o);else{r=new Array(e.length);let i=0;for(let n of e)r[i++]=new Set(n)}return Xi(t,.05),r}function yFe(o){let t=o.net;if(t==null)return new Set;let e=uS(t),r=new Set,i=new Jt;for(let n of e)if(n.has(o.globalIndex))for(let s of n){let a=i.getConnectNode(s);a instanceof Qo&&r.add(a)}return r}function mre(o){let t=o.net;if(t==null)return new Set;vp.useWireClusterCache=!0;let e=Iu.getNetConnectRelation(t);vp.useWireClusterCache=!1;let r=new Set,i=new Jt;for(let n of e)if(n.has(o.globalIndex))for(let s of n){let a=i.getConnectNode(s);a instanceof Qo&&r.add(a)}return r}var Xl=class{constructor(t,e,r){this.pl1=t,this.pl2=e,this.clearance=r;let{relation:i,distance:n,line:s,pt1:a,pt2:l,pt1Parent:c,pt2Parent:h}=this.getRelation();this.relation=i,this.distance=n,this.line=s,this.pt1=a,this.pt2=l,this.pt1Parent=c,this.pt2Parent=h}getRelation(){let t=this.pl1 instanceof Bt?this.pl1.getOutMostPolyline():this.pl1,e=this.pl2 instanceof Bt?this.pl2.getOutMostPolyline():this.pl2,r=new As(t,e,this.clearance,!1);if(r.relation==3||r.relation==0){let{relation:p,distance:m,line:g,pt1:y,pt2:b}=r;return{relation:p,distance:m,line:g,pt1:y,pt2:b,pt1Parent:t,pt2Parent:e}}let i=this.pl1 instanceof Bt?this.pl1.items:[this.pl1],n=this.pl2 instanceof Bt?this.pl2.items:[this.pl2],s=r,a=t,l=e;for(let p of i)for(let m of n){let g=new As(p,m,this.clearance,!1);if(g.distance<s.distance&&(s=g,a=p,l=m),g.relation==0){let{relation:y,distance:b,line:P,pt1:T,pt2:I}=g;return{relation:y,distance:b,line:P,pt1:T,pt2:I,pt1Parent:a,pt2Parent:l}}}if(jr.inPolygon(n[0].start(),i)){let{relation:p,distance:m,line:g,pt1:y,pt2:b}=s;return{relation:1,distance:m,line:g,pt1:y,pt2:b,pt1Parent:a,pt2Parent:l}}else if(jr.inPolygon(i[0].start(),n)){let{relation:p,distance:m,line:g,pt1:y,pt2:b}=s;return{relation:2,distance:m,line:g,pt1:y,pt2:b,pt1Parent:a,pt2Parent:l}}let{distance:c,line:h,pt1:u,pt2:d}=s;return{relation:3,distance:c,line:h,pt1:u,pt2:d,pt1Parent:a,pt2Parent:l}}};var Ge=class o extends Qo{constructor(e){super();this.startRatline=new Array(0);this.endRatline=new Array(0);this.model=e,e.setModelWatcher(this),this.initRefreshRender()}get net(){var e;return(e=this.model.net)==null?void 0:e.toUpperCase()}get showNet(){return this.model.showNet}set net(e){this.net!=e&&(Ye.delete(this),this.model.net=e,Ye.addItem(this),this.refreshRender())}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId=e,this.refreshRender()}get color(){return uo.getInstance().trackConfig.getCustomColor(this.globalIndex)||Ye.getSpecialColor(this.net)}set color(e){uo.getInstance().trackConfig.setCustomColor(this.globalIndex,e),this.refreshRender()}get gId(){return this.model.globalIndex}set gId(e){this.model.globalIndex=e}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get length(){return this.model.length}set length(e){this.model.length=oo(e),this.refreshRender()}get midPoint(){return this.model.midPoint}get start(){return this.model.start}set start(e){this.model.start=e,this.refreshRender()}get end(){return this.model.end}set end(e){this.model.end=e,this.refreshRender()}get width(){return this.model.width}set width(e){this.model.width=oo(e),this.refreshRender()}get primitive(){return this.model.primitive}get viewGroupId(){return this.model.modelType+this.net}get viewGroupIdModified(){return this.netModified}moveRatline(e,r){var n;if((n=Pe.getLayer(57))!=null&&n.visible){for(let s of this.startRatline)s.isVisible&&(s.startNode==this&&!s.start.equals(e)&&(s.start=e,s.click()),s.endNode==this&&!s.end.equals(e)&&(s.end=e,s.click()));for(let s of this.endRatline)s.isVisible&&(s.startNode==this&&!s.start.equals(r)&&(s.start=r,s.click()),s.endNode==this&&!s.end.equals(r)&&(s.end=r,s.click()))}}addRatline(e){super.addRatline(e),e.startNode==this&&(e.start.equals1(this.start)&&this.startRatline.push(e),e.start.equals1(this.end)&&this.endRatline.push(e)),e.endNode==this&&(e.end.equals1(this.start)&&this.startRatline.push(e),e.end.equals1(this.end)&&this.endRatline.push(e))}removeRatline(e){super.removeRatline(e);let r=this.startRatline.indexOf(e);r>=0&&this.startRatline.splice(r,1);let i=this.endRatline.indexOf(e);i>=0&&this.endRatline.splice(i,1)}rotateFor(e,r){this.model.rotateFor(e,r),this.refreshRender()}transform(e){this.model.transform(e),this.refreshRender()}remove(){if(this.sendDeleteMsg){let e=this.searchNodeLoopType();if(e.length<10)for(let r of e)r instanceof o&&A.publish("hasModifyPcbItem",r);this.clearRatlines()}this.model.remove(),super.remove(),uo.getInstance().trackConfig.setCustomColor(this.globalIndex,null)}isSelect(e,r){return this.getParent()!=null?!1:this.model.inShape(e,r)}getMathGraphics(e,r=0){return this.isEmpty?null:this.model.getMathGraphics(e,r)}buildBBox(){return this.model.buildBBox()}refreshRender(){!this.model.isEmpty&&this.model!=null&&this._ratlines!=null&&this._ratlines.length>0&&this.moveRatline(this.start,this.end),super.refreshRender()}};var GM=.05,FIe=class{constructor(){this.hightItemsArr=new Set}setIsChildPcb(t){this._isChildPcb=t}isChildPcb(){return this._isChildPcb}hightItems(t){for(let e of t)this.checkIsCanEditByItem(e)||(e.click(),this.hightItemsArr.add(e))}cancelHightLightAll(){for(let t of this.hightItemsArr)t.visible();this.hightItemsArr=new Set}checkIsCanEditByPoint(t){let e=this.getJudgeCanEditArea();if(this._isChildPcb){if((e instanceof ge||e instanceof Bt)&&new Xl(e,ge.build2([new M(t,t.add(new S(.1,.1)))]),0).relation==1)return!0}else{for(let r of e)if(new Xl(r,ge.build2([new M(t,t.add(new S(.1,.1)))]),0).relation!==3)return!1;return!0}}checkTrackCanEditByPoint(t){let e=this.getJudgeCanEditArea();if(this._isChildPcb){if(e instanceof ge)return jr.inPolyline(t,e,void 0,void 0,GM);if(e instanceof Bt)return e.items.every(r=>jr.inPolyline(t,r,void 0,void 0,GM))}else{for(let r of e){if(r instanceof ge)return!(jr.inPolyline(t,r)&&!jr.inEdge4Polyline(t,r,GM));if(r instanceof Bt)return!r.items.every(i=>jr.inPolyline(t,i)&&!jr.inEdge4Polyline(t,i,GM))}return!0}}checkIsInCanEdit(t,e,r){let i=this.getJudgeCanEditArea();if(!i)return!1;if(i.length===0)return!0;let n=t instanceof Ls?t.getMathGraphics(e):ge.build2(t);if(this._isChildPcb){if(new Xl(i,n,0).relation==1)return!0;if(r=="track")return n.primitives.every(a=>{let l=[a.start(),a.midPoint,a.end()];return i instanceof Bt?l.every(c=>jr.inPolygon(c,i.items)):l.every(c=>jr.inPolyline(c,i,void 0,void 0,GM))});if(t instanceof Ge){let a=[t.start,t.midPoint,t.end];return i instanceof Bt?a.every(l=>jr.inPolygon(l,i.items)):a.every(l=>jr.inPolyline(l,i,void 0,void 0,GM))}}else{for(let s of i){let a=new Xl(s,n,0).relation;if(a==1)return!1;if(a==0){if(r=="track"){let l,c=n.primitives[n.primitives.length-1].end();if(s instanceof Bt?l=jr.inPolygon(c,s.items):l=jr.inPolyline(c,s,void 0,void 0,GM),l)return!1;let h=this.getIntersectPoints(n.primitives,s.primitives);if(!(h.length==1&&h[0].length>=1))return!1}if(t instanceof Ge){if([t.start,t.midPoint,t.end].some(h=>jr.inPolyline(h,s)&&!jr.inEdge4Polyline(h,s)))return!1}else return!1}}return!0}}getIntersectPoints(t,e){let r=[];for(let i of t)for(let n of e){let s=Pt(n,i);if(s>0){let a=Om(s,[]);for(let l=0;l<a.length;l++){let c=a[l];for(let h=0;h<r.length;h++){let u=r[h];for(let d=0;d<u.length;d++)u[d].equals1(c)&&(u.length>1?(a.splice(l,1),l--):(u.splice(d,1),d--,r.splice(h,1),h--))}}a.length&&r.push(a)}}return r}checkIsCanEditByItem(t){return t.partition==R.getInstance().partitionId}getJudgeCanEditArea(){if(this._isChildPcb){let t=bo.getInstance().getItemById(R.getInstance().partitionId);return t==null?void 0:t.getMathGraphics()}else{let t=bo.getInstance().getAllItem();return t.length==0?[]:(t=t.filter(r=>!r.isEmpty&&r instanceof He&&r.type=="Partition"&&r.getComponent().isPartitionSplitOut()),t.map(r=>r.getMathGraphics()))}}checkIsCanEditByBBox(t){let e=new Array,r=new M(t.LL(),t.LR()),i=new M(t.LR(),t.UR()),n=new M(t.UR(),t.UL()),s=new M(t.UL(),t.LL());return e.push(r),e.push(i),e.push(n),e.push(s),this.checkIsInCanEdit(e)}getTransparencyByPcbType(t,e,r){let i=(e==null?void 0:e.alpha)!=null?e==null?void 0:e.alpha:r;if(i==null)return i;if(!this.checkIsCanEditByItem(t)){let n=t.getParent();t instanceof He&&t.type=="Partition"||n!=null&&n instanceof He&&n.type=="Partition"?i=i*.8:i=i*.5}return i}showMassageTip(t,e){A.publish("ui/toastMsg",{type:"info",msg:t,bottomBarMsg:e?{type:"info",msg:`<span class="i18n" i18n="${e}">${e}</span>`}:void 0},Q())}},Mt=new FIe;var He=class extends Qo{constructor(){super(...arguments);this._notShowFill=!0}get color(){return this._color}set color(e){e?this._color=e:delete this._color}get hiddenCopperResult(){return this._hiddenCopperResult||!1}set hiddenCopperResult(e){e?this._hiddenCopperResult=e:delete this._hiddenCopperResult}get notShowFill(){return this._notShowFill}set notShowFill(e){this._notShowFill=e}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get lineColor(){var s,a;let e,r=this.color,i=(a=(s=le)==null?void 0:s.themeConfig)==null?void 0:a.canvasTheme;i?(e=i.getRegionLineStyle(this,{defaultLineColor:r}).lineColor,e.equals(ee.BLACK,!1)&&(e=r)):e=r;let n=Mt.getTransparencyByPcbType(this,e);return e!=null&&n!=null&&e.alpha!=n&&(e=ee.of6(e,n)),e}get lineSolid(){var i,n;let e=!0,r=(n=(i=le)==null?void 0:i.themeConfig)==null?void 0:n.canvasTheme;return r&&(e=r.getRegionLineStyle(this).lineSolid),e}get isPixel(){var i,n;if(this.type=="Annotation")return!0;let e=!1,r=(n=(i=le)==null?void 0:i.themeConfig)==null?void 0:n.canvasTheme;return r&&(e=r.getRegionLineStyle(this).isPixel),e}get copperResultMap(){return this._copperResultMap}checkRegion(e){this.model.type=="Fill Region"&&!Ud(this.model.layerId)&&this.model.component instanceof Zi&&(this.model.component.isBridgingCopper=!1)}fillCopper(){let e=this.getComponent();if(this.clearCopper(),e!=null&&e instanceof xn){let r=e.style,i=e.gridLineWidth,n=e.optimization,s=e.clearance,a=e.optimizationValue;s==0&&r!="solid"&&(r="solid",n=!0,a=e.gridLineWidth,i=0);let l=0;e.copperResult.forEach(c=>{let h=Ti.addCopper(this.layerId,this.net,r,i,s,n,c,a);h.number=l++,this.hiddenCopperResult?h.hidden():h.fill(),h.setParent(this),this.addCopperResult(h),this.model.addCopper(h.globalIndex),A.publish("hasModifyPcbItem",h)})}}updatePourOutline(){var e,r;if(this.type=="Copper Region"){let i=(r=(e=le)==null?void 0:e.themeConfig)==null?void 0:r.canvasTheme;if(i&&i.getRegionLineStyle(this).lineNone){if(this.isHighLight)return;if(this.hasCopperRes()){this.hidden();return}this.isVisible=!0}}}needShowOutline(){var e,r;if(this.type=="Copper Region"){let i=(r=(e=le)==null?void 0:e.themeConfig)==null?void 0:r.canvasTheme;if(i&&i.getRegionLineStyle(this).lineNone)return this.isHighLight?!0:!this.hasCopperRes()}return!0}addNewCopperModel(e){let r=Ti.addCopperByModel(e);r.setParent(this),this.addCopperResult(r),this.hiddenCopperResult?r.hidden():r.fill()}initVisible(){super.initVisible(),this.type=="Copper Region"&&(this.hiddenCopperResult=!this.isVisible)}deleteCopperById(e){if(!this._copperResultMap)return;let r=null;for(let i of this._copperResultMap)if(i.globalIndex===e){r=i;break}r!=null&&this._copperResultMap.delete(r),this.model.deleteCopper(e)}toggleCopperResult(e){if(this.type=="Copper Region"){if(!this._copperResultMap)return;this.hiddenCopperResult=!e,this._copperResultMap.forEach(r=>{e?r.visible():r.hidden()})}}refreshStyle(){this.removeFill(),this.fill()}deleteRegionRuleSelector(){let e=re.getInstance().getRegion(this.globalIndex);e!=null&&(R.getInstance().compiler.deleteRuleSelector([e.regionType=="constraint"?"REGION":"POUR",e.name]),re.getInstance().deleteRegion(this.globalIndex),R.getInstance().compiler.deleteRuleSelector(["REGION",this.globalIndex]))}getViewState(){return this.isEmpty?"Not Shown":this.notShowFill?"Not Show Fill":this.isVisible?this.isHighLight?"Main And Highlight":"Only Main":"Not Shown"}hasCopperRes(){return this._copperResultMap&&this._copperResultMap.size>0}getCopperResult(){return this._copperResultMap}addCopperResult(e){this._copperResultMap||(this._copperResultMap=new Set),this._copperResultMap.add(e)}deleteCopperResult(e,r){this._copperResultMap&&e!=null&&(this._copperResultMap.delete(e),this.model.deleteCopper(r))}clearCopper(){this._copperResultMap&&(this._copperResultMap.forEach(e=>{e.remove(),A.publish("delete",e)}),this.model.clearCopperData(),delete this._copperResultMap)}iteratorCopper(e){this._copperResultMap&&this._copperResultMap.forEach(r=>{e(r)})}};var iA=class iA{static getInstance(){return iA.manager==null&&(iA.manager=new iA),iA.manager}constructor(){this.nameManager=new T0,this.items=new Map,A.subscribe("removeFileUuids",t=>{iA.getInstance().getAllItem().forEach(r=>{r.model instanceof or&&r.model.component instanceof ac&&t.includes(r.model.component.fileUuid)&&(r.model.component.fileUuid="",bFe(r))})},Q())}hasName(t){return this.nameManager.has(t)}getName(t="partition1"){return this.nameManager.getNum(t)}addName(t){this.nameManager.add(t)}deleteName(t){this.nameManager.deleteNum(t)}hasItemById(t){return this.items.has(t)}getItemById(t){return this.items.get(t)}getAllItem(){return Array.from(this.items.values())}addItem(t){let e=t.globalIndex;this.items.set(e,t)}hasSpiltOutPartition(){for(let[,t]of this.items){if(t instanceof He&&t.type=="Partition"){let e=t.getComponent();if(e instanceof ac&&e.isPartitionSplitOut())return!0}return!1}}deleteItemById(t){this.items.delete(t),this.syncPartitionStatus()}clearItems(){this.items.clear()}recycle(){this.items.clear(),this.nameManager.clear()}syncPartitionStatus(){if(Mt.isChildPcb())return;let t=iA.getInstance().getAllItem(),e=[];for(let r of t)r.model instanceof or&&r.model.component instanceof ac&&e.push({id:r.globalIndex,fileUuid:r.model.component.fileUuid});A.publish("syncPcbPartitionStatus",{mainUuid:R.getInstance().id,partitionData:e},Q())}};iA.manager=null;var bo=iA;var gre=re.getInstance(),pg=class extends ro{constructor(){super(...arguments);this.queryTool=new Jt}equals(e,r){return e!=null&&r!=null?e.equals(r):r==e}needSendInfo(e){var i;let r=((i=this.queryTool.getItem(this.gId))==null?void 0:i.type)||"";return e.tool.type=="Copper Region"||r=="Copper Region"?e.action=="add"||e.action=="delete"?{action:"fullUpdate",data:null}:e.action=="modify"?this.comparePourChange():{action:"notUpdate",data:null}:{action:"notUpdate",data:null}}rebuildRegionSelector(e,r){if(e.type==="Constraint Region"){let i=gre.addRegionSelector(this.gId),n=gre.updateRegionSelector(this.gId,r,!0);return this.showExistRegionSelector(n),i}}modifyRegionSelector(e,r){if(e.type==="Constraint Region"){let i=gre.updateRegionSelector(this.gId,r,!0);this.showExistRegionSelector(i)}}removeRegionSelector(){gre.deleteRegion(this.gId),R.getInstance().compiler.deleteRuleSelector(["REGION",this.gId])}rebuildPartition(e){bo.getInstance().addItem(e)}showExistRegionSelector(e){for(let r of e){let i=r.type,n=`"${r.name}"`,s="When undoing/redoing, it was found that the rule name {name} does not exist, and the {type} rule in the constraint region has been cleared",a=[`<span class="i18n" i18n='${s}' i18n-params-name='${n}' i18n-params-type="${i}"></span>`];he.publish("ui/toastMsg",{type:"info",msg:{value:s,options:{name:n,type:i},translateOptionKeys:["type"]},bottomBarMsg:{type:"info",msg:a}},Q())}}};var xp=class{static getNumberManager(){return this.numberManager==null&&(this.numberManager=new T0),this.numberManager}};xp.numberManager=null,xp.isStart=!0;var Le=class extends Qo{constructor(){super(...arguments);this._highlightByComponent=!1;this._parent=void 0}set padExpansion(e){this.model.padExpansion=e,this.refreshRender(),this.updateSmartPad()}get padExpansion(){return this.model.padExpansion}get selectItem(){return this.hasDataState(9)}set selectItem(e){this.hasDataState(9)!=e&&(this.setDataState(9,e),this.refreshRender())}get hole(){return this.model.hole}set hole(e){this.hole!=e&&(this.model.hole=e,this.refreshRender())}get highlightMaskColor(){var r;let e=(r=f2.getInstance())==null?void 0:r.getMaskHightColor(this);return e||ee.BLACK}queryPasteExpansion(e){let r;return this.layerId==2?this.isTestPad?r=e.testPointBottomExpansion:r=e.padBottomExpansion:this.isTestPad?r=e.testPointTopExpansion:r=e.padTopExpansion,r}get smartPad(){return this._smartPad}set smartPad(e){this._smartPad=e,this.model.updateShapeData()}get partition(){return this.model.partition}set partition(e){super.partition=e}get padLen(){return this.model.padLen}set padLen(e){this.model.padLen=e}get attrsMap(){return this.model.attrsMap}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get num(){return this.model.num}set num(e){let r=xp.getNumberManager();e==""?r.deleteNum(this.model.num):(r.deleteNum(this.model.num),r.add(e)),this.model.num=e,this.refreshRender()}get unusedInnerLayers(){return this.model.unusedInnerLayers}set unusedInnerLayers(e){this.model.unusedInnerLayers=e,this.refreshRender()}get net(){var e;return(e=this.model.net)==null?void 0:e.toUpperCase()}get showNet(){return this.model.showNet}set net(e){this.showNet!=e&&(Ye.delete(this),this.model.net=e,Ye.addItem(this),this.refreshRender())}get highlightByComponent(){return this._highlightByComponent}set highlightByComponent(e){this._highlightByComponent=!!e,this.refreshRender()}get type(){return this.model.type}set type(e){this.model.type=e,this.refreshRender()}get isTestPad(){return this.model.isTestPad}set isTestPad(e){this.model.isTestPad=e}set padRuleType(e){if(e==1)this.padRule=null;else if(!this.padRule){let r=re.getInstance().getRuleByNet(this.net,10),i=this.layerId!==12,n=this.layerId;this.padRule=qh.getPadRule(i?r.getSingleConnectMode(n):r.getMultiConnectMode(),i?r.getSingleLineClearance(n):r.getMultiLineClearance(),i?r.getSingleLineWidth(n):r.getMultiLineWidth(),i?r.getSingleLineAngle(n):r.getMultiLineAngle())}}get padRuleType(){return this.padRule?2:1}get padRule(){return this.model.padRule}set padRule(e){this.model.padRule=e}get plated(){return this.model.plated}set plated(e){this.model.plated=e}get pasteExpansionModified(){return this.model.pasteExpansionModified}get topSolderExpansionModified(){return this.model.topSolderExpansionModified}get bottomSolderExpansionModified(){return this.model.bottomSolderExpansionModified}get numModified(){return this.model.numModified}get topModified(){return this.model.topModified}get bottomModified(){return this.model.bottomModified}get innerModified(){return this.model.innerModified}get holeModified(){return this.model.holeModified}get viewGroupId(){return this.model.modelType+this.net+"_mask"}get wireViewGroupId(){return this.model.modelType+this.net+"_mask_W"}get realSolderExpansion(){return this.layerId==1?this.topSolderExpansion:this.layerId==2?this.bottomSolderExpansion:-100}get realPasteExpansion(){return 12==this.layerId?0:this.pasteExpansion}get realMaxExpansion(){return Math.max(this.realSolderExpansion,this.realPasteExpansion)}get maxShapeLayer(){let e=this.layerId,r=this.realMaxExpansion;return r>0&&r==this.realSolderExpansion?e==1?5:6:r>0&&r==this.realPasteExpansion?e==1?7:8:e}get viewGroupIdModified(){return this.netModified}get grayIndex(){return Pe.getGrayIndex()}get usedLayers(){let e=[],r=new Set(this.unusedInnerLayers);if(r.size>0||this.type==2||this.grayIndex!=0){let i=Ze.getInstance().getAllCopperLayerIds();for(let n of i)r.has(n)||e.push(n)}return e}getMathGraphics(e=this.layerId,r=0){return this.isEmpty?null:this.model.getMathGraphics(e,r)}clearRelation(){if(jP.on){let r=this.searchNode();if(r.length<10)for(let i of r)A.publish("hasModifyPcbItem",i)}this.clearRatlines(),xp.getNumberManager().deleteNum(this.num)}refreshRatlinePosition(){var i;if(!((i=Pe.getLayer(57))==null?void 0:i.visible))return;let r=this.center;this.iteratorRatlines(n=>{n.isVisible&&(n.startNode==this&&!n.start.equals(r)&&(n.start=r,n.click()),n.endNode==this&&!n.end.equals(r)&&(n.end=r,n.click()))})}toPadRuleJson(){return this.padRule?this.padRule.toJSON():null}refreshRender(){this.model.isEmpty||this.refreshRatlinePosition(),super.refreshRender()}getOneInnerInUse(){return this.model.getOneInnerInUse()}updateSmartPad(){this.smartPad&&this.smartPad.update(this.model.getBBox(!0))}addATTRMap(e,r){this.model.addATTRMap(e,r)}modifyATTRMap(e,r){this.model.modifyATTRMap(e,r)}deleteATTRMap(e){this.model.deleteATTRMap(e)}clearMap(){this.model.clearMap()}};var nA=class{constructor(t,e){this.isEmpty=!1;this.isVisible=!0;this.locked=!1;this.viewGroupId="";this.padId=e,this.globalIndex=this.padId+"_SmartPad",this._bbox=t,this.refreshRender()}get spotSize(){return Math.min(this._bbox.height()/7.5,this._bbox.width()/7.5,.8)}adjustAssociatedDimensions(t){we.smartMode&&ah.getAllItem().forEach(r=>{r.restriction&&[r.restriction.start,r.restriction.end].includes(this.padId)&&t(r)}),this.refreshRender()}visible(){this.adjustAssociatedDimensions(t=>{t.visible(),A.publish("hasModifyPcbItem",t)}),this.isVisible=!0,this.refreshRender()}hidden(){this.adjustAssociatedDimensions(t=>{t.hidden(),A.publish("hasModifyPcbItem",t)}),_s.cancel(),this.isVisible=!1,this.refreshRender()}remove(){this.adjustAssociatedDimensions(t=>{t.remove(),A.publish("delete",t)}),_s.cancel(),this.isVisible=!1,this.isEmpty=!0,this.refreshRender()}isSelect(t,e){return this.getSelectSpotIndex(t,e)!=null}highlightSpot(t,e){let r=this.getSelectSpotIndex(t,e),i=this.getSpotCenter(r);if(i!=null){_s.highlightSpot(i,this.spotSize);let n=Qt.getItem(this.padId);n!=null&&n.visible()}this.refreshRender()}selectOnePoint(t,e){let r=this.getSelectSpotIndex(t,e);if(r!=null){let i=this.getSpotCenter(r);return i==null?!1:(_s.addRestriction(this.padId,r,i,this.spotSize),_s.justSelectOnePoint=!0,!0)}return!1}getSelectSpotIndex(t,e){let{_bbox:r,spotSize:i}=this,n=new S(t,e);return t1(n,r.center(),i)?4:t1(n,r.UL(),i)?0:t1(n,r.UR(),i)?1:t1(n,r.LR(),i)?2:t1(n,r.LL(),i)?3:null}getSpotCenter(t){let e=this._bbox;return t===4?e.center():t===0?e.UL():t===1?e.UR():t===2?e.LR():t===3?e.LL():null}update(t){let e=this._bbox;this._bbox=t,e.UL().equals1(t.UL())||this.modifySmartDimensionEnds(this.padId,0,t.UL()),e.UR().equals1(t.UR())||this.modifySmartDimensionEnds(this.padId,1,t.UR()),e.LR().equals1(t.LR())||this.modifySmartDimensionEnds(this.padId,2,t.LR()),e.LL().equals1(t.LL())||this.modifySmartDimensionEnds(this.padId,3,t.LL()),e.center().equals1(t.center())||this.modifySmartDimensionEnds(this.padId,4,t.center()),this.refreshRender()}modifySmartDimensionEnds(t,e,r){if(kB.isMoving)return;let i=u3.find([this.padId]);for(let n in i){let s=i[n];for(let a of s){if(a.start==t&&a.startIndex==e){let l=ah.getItem(a.id);l&&(l.left=r,l.setLeftSpotSize(this.spotSize))}if(a.end==t&&a.endIndex==e){let l=ah.getItem(a.id);l&&(l.right=r,l.setRightSpotSize(this.spotSize))}}}this.refreshRender()}getType(){return 10}getRenderData(){let t=this.getViewState();return{layerId:1002,bbox:this._bbox,color:ee.build(.7,.7,.7,.7),spotSize:this.spotSize,state:t,highLightType:1,highlightColor:ee.BLACK}}transform(t){this._bbox=this._bbox.transform(t)}refreshRender(){Mo.attach(this,this.getType())}getViewState(){return this.isEmpty?"Not Shown":this.isVisible?"Only Main":"Not Shown"}};var _i=class extends Le{constructor(t){super(),$p(t),this.model=t,t.setModelWatcher(this),we.smartMode&&(this.smartPad=new nA(this.model.getBBox(),this.globalIndex)),this.initRefreshRender(),Ro("editor/shape/Pad")}get top(){return this.model.top}set top(t){this.model.top=t,this.refreshRender()}get bottom(){return this.model.bottom}set bottom(t){this.model.bottom=t,this.refreshRender()}get inner(){return this.model.inner}set inner(t){this.model.inner=t,this.refreshRender()}set hole(t){this.hole!=t&&(this.model.hole=t,this.refreshRender())}get hole(){return this.model.hole}get color(){return uo.getInstance().padConfig.getCustomColor(this.globalIndex)||Ye.getSpecialColor(this.net)}set color(t){uo.getInstance().padConfig.setCustomColor(this.globalIndex,t),this.refreshRender()}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId=t,this.refreshRender()}get holeOffset(){return this.model.holeOffset||S.ORIGIN}set holeOffset(t){this.hole&&(this.model.holeOffset=t,this.refreshRender())}get holeRotation(){return this.model.holeRotation}set holeRotation(t){this.hole&&t!=null&&(this.model.holeRotation=t,this.refreshRender())}get topType(){var t;return(t=this.top)==null?void 0:t.type}set topType(t){this.top&&t!=null&&(this.top=Lo.getPadStyleByType(t,this.top),this.refreshRender())}get innerType(){var t;return(t=this.inner)==null?void 0:t.type}set innerType(t){this.inner&&t!=null&&(this.inner=Lo.getPadStyleByType(t,this.inner),this.refreshRender())}get bottomType(){var t;return(t=this.bottom)==null?void 0:t.type}set bottomType(t){this.bottom&&t!=null&&(this.bottom=Lo.getPadStyleByType(t,this.bottom),this.refreshRender())}get center(){return this.model.center}set center(t){this.model.center=t,this.refreshRender()}get topWidth(){var t;return(t=this.top)==null?void 0:t.width}set topWidth(t){this.top&&t!=null&&(this.top=Lo.getPadStyleByWidth(t,this.top),this.refreshRender())}get topHeight(){var t;return(t=this.top)==null?void 0:t.height}set topHeight(t){this.top&&t!=null&&(this.top=Lo.getPadStyleByHeight(t,this.top),this.refreshRender())}get innerWidth(){var t;return(t=this.inner)==null?void 0:t.width}set innerWidth(t){this.inner&&t!=null&&(this.inner=Lo.getPadStyleByWidth(t,this.inner),this.refreshRender())}get innerHeight(){var t;return(t=this.inner)==null?void 0:t.height}set innerHeight(t){this.inner&&t!=null&&(this.inner=Lo.getPadStyleByHeight(t,this.inner),this.refreshRender())}get bottomWidth(){var t;return(t=this.bottom)==null?void 0:t.width}set bottomWidth(t){this.bottom&&t!=null&&(this.bottom=Lo.getPadStyleByWidth(t,this.bottom),this.refreshRender())}get bottomHeight(){var t;return(t=this.bottom)==null?void 0:t.height}set bottomHeight(t){this.bottom&&t!=null&&(this.bottom=Lo.getPadStyleByHeight(t,this.bottom),this.refreshRender())}get topRatio(){var t;return(t=this.top)==null?void 0:t.ratio}set topRatio(t){this.top&&t!=null&&(this.top=Lo.getPadStyleByRatio(t,this.top),this.refreshRender())}get innerRatio(){var t;return(t=this.inner)==null?void 0:t.ratio}set innerRatio(t){this.inner&&t!=null&&(this.inner=Lo.getPadStyleByRatio(t,this.inner),this.refreshRender())}get bottomRatio(){var t;return(t=this.bottom)==null?void 0:t.ratio}set bottomRatio(t){this.bottom&&t!=null&&(this.bottom=Lo.getPadStyleByRatio(t,this.bottom),this.refreshRender())}get pasteExpansion(){return this.model.padExpansion.pasteExpansion}set pasteExpansion(t){this.model.pasteExpansion=t,this.refreshRender(),this.updateSmartPad()}get expansion(){return this.model.padExpansion}set expansion(t){this.model.padExpansion=t,this.refreshRender(),this.updateSmartPad()}get topSolderExpansion(){return this.model.topSolderExpansion}set topSolderExpansion(t){this.model.topSolderExpansion=t,this.refreshRender(),this.updateSmartPad()}get bottomSolderExpansion(){return this.model.bottomSolderExpansion}set bottomSolderExpansion(t){this.model.bottomSolderExpansion=t,this.refreshRender(),this.updateSmartPad()}get expansionType(){return this.model.expansionType}set expansionType(t){this.model.expansionType=t,$p(this.model),this.refreshRender()}get rotation(){return this.model.rotation}set rotation(t){this.model.rotation=t,this.refreshRender()}get holeShape(){return this.model.holeShape}set holeShape(t){this.hole&&t!=null&&(this.model.holeShape=t,this.refreshRender())}get holeRadius(){return this.model.holeRadius}set holeRadius(t){this.hole&&t!=null&&(this.model.holeRadius=t,this.refreshRender())}get holeLength(){return this.model.holeLength}set holeLength(t){this.hole&&t!=null&&(this.model.holeLength=t,this.refreshRender())}get holeColor(){var t,e,r;return((r=(e=(t=le)==null?void 0:t.themeConfig)==null?void 0:e.canvasTheme)==null?void 0:r.getHoleColor(this.plated,uo.getInstance().padConfig.getSelectAlpha(this.selectItem)))||ee.BLACK}queryPasteExpansion(t){let e;return this.layerId==2?this.isTestPad?e=t.testPointBottomExpansion:e=t.padBottomExpansion:this.isTestPad?e=t.testPointTopExpansion:e=t.padTopExpansion,e}oppositeLayer(){this.model.oppositeLayer(),this.refreshRender()}rotateFor(t,e){let r=Ae.translate(-t.x,-t.y,0).rotateZ(e).translate1(t.x,t.y,0);this.transform(r)}visible(t=!1){super.visible(t),this.smartPad&&this.smartPad.visible()}hidden(){super.hidden(),this.smartPad&&this.smartPad.hidden()}remove(){this.clearRelation(),this.smartPad&&this.smartPad.remove(),super.remove(),this.model.remove()}flip(t){this.model.flip(t),this.refreshRender()}transform(t){this.model.transform(t),this.refreshRender(),this.updateSmartPad()}isSelect4Layer(t,e,r){return r===1&&this.top?this.top.inShape(t,e,this.center,this.rotation):r===2&&this.bottom?this.bottom.inShape(t,e,this.center,this.rotation):this.inner?this.inner.inShape(t,e,this.center,this.rotation):!1}isSelect(t,e,r=!1){return we.smartMode&&r&&this.smartPad&&this.smartPad.isSelect(t,e)?!0:this.model.inShape(t,e)}getBBoxFilterExt(){return this.model.getBBox(!0)}toJSON(){return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,type:this.type,num:this.num,center:this.center,topType:this.topType,topWidth:this.topWidth,topHeight:this.topHeight,topRatio:this.topRatio,bottomType:this.bottomType,bottomWidth:this.bottomWidth,bottomHeight:this.bottomHeight,bottomRatio:this.bottomRatio,innerType:this.innerType,innerWidth:this.innerWidth,innerHeight:this.innerHeight,innerRatio:this.innerRatio,rotation:this.rotation,locked:this.locked,net:this.net,expansionType:this.expansionType,pasteExpansion:this.pasteExpansion,topSolderExpansion:this.topSolderExpansion,bottomSolderExpansion:this.bottomSolderExpansion,unusedInnerLayers:this.unusedInnerLayers,plated:this.plated,holeLength:this.holeLength,holeRadius:this.holeRadius,holeShape:this.holeShape,holeRotation:this.holeRotation,holeOffset:this.holeOffset,isTestPad:this.isTestPad,padRule:this.toPadRuleJson(),padLen:this.padLen,attrsMap:{...this.model.attrsMap}}}getFileGraphics(t,e,r){if(this.isEmpty)return null;if(t==12){let i=[];r=r||[1,2,15];for(let n of r){let s=this.getMathGraphics(n,e);s!=null&&i.push(s)}return i}else{let i=this.getMathGraphics(t,e);return i!=null?[i]:null}}getTopShape(t){return this.top&&(this.layerId==1||this.layerId==12)?cg(this.model,this.top,t):null}getInnerShape(t){return this.inner&&this.layerId==12?cg(this.model,this.inner,t):null}getBottomShape(t){return this.bottom&&(this.layerId==2||this.layerId==12)?cg(this.model,this.bottom,t):null}getHoleShape(t){return this.hole&&this.layerId==12?this.hole.getShape(t,this.center,this.rotation):null}buildBBox(){this.model.refreshBBox&&this.updateSmartPad();let t=this.model.buildBBox();return this.smartPad!=null&&t!=null?t.extendOfSize(this.smartPad.spotSize):t}getDimensionBBox(){return this.model.getBBox(!0)}getType(){return 9}getLines(){let t=this.buildBBox();if(t==null)throw new Error("Pad is Empty!!!");let e=[],r=new M(t.LL(),t.LR()),i=new M(t.LR(),t.UR()),n=new M(t.UR(),t.UL()),s=new M(t.UL(),t.LL()),a=new M(t.LL().add(t.UL()).mul(.5),t.UR().add(t.LR()).mul(.5)),l=new M(t.UL().add(t.UR()).mul(.5),t.LR().add(t.LL()).mul(.5));return e.push(r,i,n,s,a,l),e}};var UM=class UM{constructor(){this.layerMap=new Map;this.netHight=new Set;this.viaVisible=!0;this.forceHightRange=!1}static getInstance(){return UM.state==null&&(UM.state=new UM),UM.state}getState(t,e){return this.viaVisible?this.forceHightRange?this.layerMap.get(t)||this.netHight.has(e):this.layerMap.get(t):!1}setLayer(t,e){if(this.layerMap.get(t)!=e){if(this.layerMap.set(t,e),!this.viaVisible)return;let r=re.getInstance().getAllBlindPhysics();for(let i of r){let n=i.getBlindVia(t);if(n!=null)for(let s of n.status.used){let a=Wr.getItem(s);a!=null&&this.updateVia(a)}}}}setHighlight(t,e){let r=new Set;for(let i of t)(e&&!this.netHight.has(i)||!e&&this.netHight.has(i))&&(e?this.netHight.add(i):this.netHight.delete(i),r.add(i));this.viaVisible&&this.netChangeAction(r)}setForceHightRange(t){if(this.forceHightRange!=t){if(this.forceHightRange=t,!this.viaVisible)return;let e=this.netHight;this.netChangeAction(e)}}netChangeAction(t){if(t.size==0)return;let e=re.getInstance().getAllBlindPhysics();for(let[r,i]of this.layerMap)if(!i)for(let n of e){let s=n.getBlindVia(r);if(s!=null)for(let a of s.status.used){let l=Wr.getItem(a);if(l!=null){if(!t.has(l.net))continue;this.updateVia(l)}}}}setVisible(t){this.viaVisible!=t&&(this.viaVisible=t,this.viaVisibleChangeAction())}viaVisibleChangeAction(){let t=re.getInstance().getAllBlindPhysics();for(let e of t){let r=e.getAllVias();for(let i of r)for(let n of i.status.used){let s=Wr.getItem(n);s!=null&&this.updateVia(s)}}}changeNet(t,e,r){r.type==1&&this.viaVisible&&(this.netHight.has(e)||this.netHight.has(t))&&this.updateVia(r,e)}updateVia(t,e){this.getState(t.name,e||t.net)?(t.updateFilterVisible=!0,t.visible()):t.hidden()}};UM.state=null;var C2=UM;var Ue=class extends Qo{constructor(e){super();this.highlightByComponent=!1;$p(e),this.model=e,e.setModelWatcher(this),this.initRefreshRender(),Ro("editor/shape/Via")}get expansionType(){return this.model.expansionType}set expansionType(e){this.model.expansionType=e,$p(this.model),this.refreshRender()}initVisible(){super.initVisible(),this.isVisible&&this.visible()}get selectItem(){return this.hasDataState(9)}set selectItem(e){this.hasDataState(9)!=e&&(this.setDataState(9,e),this.refreshRender())}get type(){return this.model.type}set type(e){if(this.model.type!=e){if(e==1){let r=re.getInstance().getDefaultBlindPhysics().getFirst();if(r==null)return;this.model.type=e,this.model.viaBaseInfo=la.getViaBaseInfo(r.startLayer,r.endLayer,this.model.radius,this.model.holeRadius),this.model.name=r.name,r.status.used.add(this.globalIndex),this.updateFilterVisible=!0,this.visible()}else{let i=re.getInstance().getDefaultBlindPhysics().getBlindVia(this.model.name);i==null||i.status.used.delete(this.globalIndex),this.model.type=e,this.model.viaBaseInfo=la.getViaBaseInfo(1,2,this.model.radius,this.model.holeRadius),this.model.name="",this.updateFilterVisible=!0,this.refreshFilterVisible(!1)}this.refreshRender()}}get isSuture(){return this.model.type==2}get color(){return uo.getInstance().viaConfig.getCustomColor(this.globalIndex)||Ye.getSpecialColor(this.net)}set color(e){uo.getInstance().viaConfig.setCustomColor(this.globalIndex,e),this.refreshRender()}get name(){return this.model.name}set name(e){if(this.model.name!=e){let r=re.getInstance().getDefaultBlindPhysics(),i=r.getBlindVia(this.model.name);i==null||i.status.used.delete(this.globalIndex),this.model.name=e;let n=r.getBlindVia(this.model.name);n!=null&&this.type==1&&(n.status.used.add(this.globalIndex),this.model.viaBaseInfo=la.getViaBaseInfo(n.startLayer,n.endLayer,this.model.radius,this.model.holeRadius),this.updateFilterVisible=!0,this.visible(),this.refreshRender())}}visible(e=!1){this.type==1?re.getInstance().getDefaultBlindPhysics().getBlindVia(this.model.name)!=null&&(C2.getInstance().getState(this.name,this.net)?super.visible(e):this.hidden()):super.visible(e)}get startLayer(){return this.model.startLayer}set startLayer(e){this.model.startLayer=e,this.refreshRender()}get endLayer(){return this.model.endLayer}set endLayer(e){this.model.endLayer=e,this.refreshRender()}get unusedInnerLayers(){return this.model.unusedInnerLayers}set unusedInnerLayers(e){this.model.unusedInnerLayers=e,this.refreshRender()}get net(){var e;return(e=this.model.net)==null?void 0:e.toUpperCase()}get showNet(){return this.model.showNet}set net(e){if(this.model.net!=e){Ye.delete(this);let r=this.model.net;this.model.net=e,C2.getInstance().changeNet(r,e,this),Ye.addItem(this),this.refreshRender()}}get radius(){return this.model.radius}set radius(e){this.model.radius=e,this.refreshRender()}get center(){return this.model.center}set center(e){this.model.center=e,this.refreshRender()}get holeRadius(){return this.model.holeRadius}set holeRadius(e){this.model.holeRadius=e,this.refreshRender()}get layerId(){return this.model.layerId}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get topExpansion(){return this.model.topExpansion}set topExpansion(e){this.model.topExpansion=e,this.refreshRender()}get viaBaseInfo(){return this.model.viaBaseInfo}set viaBaseInfo(e){this.model.viaBaseInfo=e,this.refreshRender()}get viaExpansion(){return this.model.viaExpansion}set viaExpansion(e){let r=this.model.viaExpansion.expansionType;this.model.viaExpansion=e,r!==e.expansionType&&$p(this.model),this.refreshRender()}get bottomExpansion(){return this.model.bottomExpansion}set bottomExpansion(e){this.model.bottomExpansion=e,this.refreshRender()}get holeColor(){var i,n;let e=ee.BLACK,r=(n=(i=le)==null?void 0:i.themeConfig)==null?void 0:n.canvasTheme;if(r&&this.type===0){e=r.getHoleColor(!0,uo.getInstance().padConfig.getSelectAlpha(this.selectItem));let s=Mt.getTransparencyByPcbType(this,e);s&&e.alpha!=s&&(e=ee.of6(e,s))}return e}get layerPairStr(){if(!ea.getInstance().viaShowPair)return"";let e=this.startLayer,r=this.endLayer,i=a(e),n=a(r);return i<n?`${i}-${n}`:`${n}-${i}`;function a(l){return l==1?1:l==2?Pe.configInnerLayers.size+2:l-15+2}}get usedLayers(){let e=[];if(this.unusedInnerLayers.length>0){let r=Ze.getInstance().getAllCopperLayerIds();this.type==1?e=r.filter(i=>this.isContains(i)&&!this.unusedInnerLayers.includes(i)):e=r.filter(i=>!this.unusedInnerLayers.includes(i))}return e}get allLayers(){return Pe.getAllCopperLayerIds()}get grayIndex(){return Pe.getGrayIndex()}get netModified(){return this.model.netModified}get radiusModified(){return this.model.radiusModified}get holeRadiusModified(){return this.model.holeRadiusModified}get topExpansionModified(){return this.model.topExpansionModified}get bottomExpansionModified(){return this.model.bottomExpansionModified}get viewGroupId(){return this.model.modelType+this.net+"_mask"}get viewGroupIdModified(){return this.netModified}get wireViewGroupId(){return this.model.modelType+this.net+"_mask_W"}get holeViewGroupId(){return this.viewGroupId+"_hole"}get maxShapeLayer(){let e=this.topExpansion,r=this.bottomExpansion,i=this.holeRadius-this.radius;return e>0&&e>r&&e>i?5:r>0&&r>i?6:i>0?47:12}isContains(e){return this.model.isContains(e)}buildBBox(){return this.model.buildBBox()}getOneInnerInUse(){return this.model.getOneInnerInUse()}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.transform(i),this.refreshRender()}remove(){let e=this.searchNode();if(e.length<10)for(let r of e)A.publish("hasModifyPcbItem",r);this.clearRatlines(),this.model.remove(),super.remove(),uo.getInstance().viaConfig.setCustomColor(this.globalIndex,null)}transform(e){this.model.transform(e),this.refreshRender()}isSelect(e,r){return this.model.inShape(e,r)}toJSON(){return{globalIndex:this.globalIndex,partition:this.partition,type:this.type,name:this.name,startLayer:this.startLayer,endLayer:this.endLayer,unusedInnerLayers:this.unusedInnerLayers,net:this.net,radius:this.radius,center:this.center,holeRadius:this.holeRadius,locked:this.locked,expansion:this.expansionType,topExpansion:this.topExpansion,bottomExpansion:this.bottomExpansion,isSuture:this.isSuture}}getMathGraphics(e=this.model.layerId,r=0){if(this.isEmpty)return null;if(e==12||e===47)return ge.build2([q.build3(this.center,0,-360,this.holeRadius,this.holeRadius)]);if([5,6].includes(e)){let i=e==5?this.topExpansion:this.bottomExpansion,n=this.radius+i;return n<=0?null:ge.build2([q.build3(this.center,0,-360,n,n)])}else return ge.build2([q.build3(this.center,0,-360,this.radius+r,this.radius+r)])}getFileGraphics(e,r,i){if(this.isEmpty)return null;if(ar(e)){let n=[];if(i==null){let s=this.getOneInnerInUse();s==null?i=[]:i=[s]}for(let s of i){let a=this.getMathGraphics(s,r);a!=null&&n.push(a)}return n}else{let n=this.getMathGraphics(e,r);return n!=null?[n]:[]}}getType(){return this.type==1?2:23}refreshRatlinePosition(){var i;if(!((i=Pe.getLayer(57))==null?void 0:i.visible))return;let r=this.center;this.iteratorRatlines(n=>{n.isVisible&&(n.startNode==this&&!n.start.equals(r)&&(n.start=r,n.click()),n.endNode==this&&!n.end.equals(r)&&(n.end=r,n.click()))})}refreshRender(){this.refreshRatlinePosition(),super.refreshRender()}};function xm(o,t,e,r){if(o==="Partition")return 1004;if(t===52)return 1;let i=Pe.getLayer(t);if(i==null)return t;switch(o){case"Line":if(i&&!ar(i.layerID)&&47!=i.layerID&&i.layerID!=57&&!LO(i.layerID)&&!ra(i.layerID)&&!ic(i.layerID))return i.layerID;if(t==1002)return t;break;case"Copper Region":case"TearDrop":if(i&&i.isSignalLayer())return i.layerID;break;case"Prohibited Region":if(ar(i.layerID)||i.isSignalLayer()||i.isPlaneLayer())return i.layerID;break;case"Constraint Region":return ar(i.layerID)||i.isSignalLayer()||i.isPlaneLayer()?i.layerID:12;case"Cutout":case"Fill Region":if(!ar(i.layerID)&&!ub(i.layerID)&&!i.isPlaneLayer()&&!i.isDrillLayer()&&47!=i.layerID&&i.layerID!=57&&!ra(i.layerID)&&!ic(i.layerID)&&!(e!==0&&t===49))return i.layerID;break;case"FPC Stiffener":return[58,59].includes(i.layerID)?i.layerID:is(i.layerID)?59:58;case"Board Outline":return 11;case"Slot Region":return 12;case"3D Shell - Outline":case"3D Shell - Side Entity":case"3D Shell - Side Datum Line":case"3D Shell - Side Slot Region":return 53;case"3D Shell - Top Slot Region":case"3D Shell - Screw Pillar":case"3D Shell - Top/Bottom Entity":return[54,55].includes(i.layerID)?i.layerID:54}return r||1}function HM(){let o=Pe.getActiveLayerID(),t=Ze.getInstance();return o==3||o==4||o==13||t.isCustomLayer(o)||wee(o)?o:13}var VIe=class{constructor(){this.fillComponent={style:"solid",gridLineWidth:1,clearance:2,keepIsland:!1,optimization:!0,optimizationValue:.8};this.prohibitComponent={device:!0,track:!1,copper:!1,fill:!1,planzone:!1};this.d3ShellScrewPillarComponent={specification:"M2"};this.d3ShellSlotRegionComponent={slotOption:[4,8,16]};this._defaultSlotOption=[4,8,16]}get defaultSlotOption(){return this._defaultSlotOption}syncFillData(t){let{style:e,gridLineWidth:r,clearance:i,keepIsland:n,optimization:s,optimizationValue:a}=t;this.fillComponent.style=e,this.fillComponent.gridLineWidth=r,this.fillComponent.clearance=i,this.fillComponent.keepIsland=n,this.fillComponent.optimization=s,this.fillComponent.optimizationValue=a}updateFillComponent(t){t.style=this.fillComponent.style,t.gridLineWidth=this.fillComponent.gridLineWidth,t.clearance=this.fillComponent.clearance,t.keepIsland=this.fillComponent.keepIsland,t.optimization=this.fillComponent.optimization,t.optimizationValue=this.fillComponent.optimizationValue}syncProhibitData(t){let{device:e,track:r,copper:i,fill:n,planzone:s}=t;this.prohibitComponent.device=e,this.prohibitComponent.track=r,this.prohibitComponent.copper=i,this.prohibitComponent.fill=n,this.prohibitComponent.planzone=s}updateProhibitComponent(t){t.device=this.prohibitComponent.device,t.fill=this.prohibitComponent.fill,t.track=this.prohibitComponent.track,t.planzone=this.prohibitComponent.planzone,t.copper=this.prohibitComponent.copper}syncD3ShellScrewPillarData(t){let e=t.specification;this.d3ShellScrewPillarComponent.specification=e!=="Custom"?e:"M2"}syncD3ShellSlotRegionComponentData(t){this._defaultSlotOption=Array.from(t.slotOption)}},Gf=new VIe;var GIe={cursor:{color:{value:"#00FFFF"},borderStyle:{value:"dotted"}},background:{color:{value:"#000000"}},boardShape:{color:{value:"#6D6A69"},borderStyle:{value:"solid"},borderColor:{value:"#000000"}},grid:{color:{value:"#FFFFFF"},transparency:{value:"0.7"}},boldGrid:{color:{value:"#FFFFFF"},transparency:{value:"0.5"}},coordinateAxis:{color:{value:"#FFFFFF"},transparency:{value:"0.2"}},"Select Box":{color:{value:"#00FFFF"},borderStyle:{value:"dotted"}},select:{color:{value:"",tag:"default",tagValue:"#000000"},transparency:{value:"0.5"}},hoverHighlight:{color:{value:"",tag:"default",tagValue:"#000000"},transparency:{value:"0.5"}},metallicDrilling:{color:{value:"47",tag:"followLayerId",tagValue:"47"},transparency:{value:"0"}},unMetallicDrilling:{color:{value:"47",tag:"followLayerId",tagValue:"47"},transparency:{value:"0"}},pad:{transparency:{value:"0"}},via:{transparency:{value:"0"}},track:{transparency:{value:"0"}},copperRegion:{transparency:{value:"0.3"},borderColor:{value:"",tagValue:"#000000"},borderStyle:{value:"dotted"}},solidRegion:{transparency:{value:"0.3"},borderColor:{value:"",tagValue:"#000000"},borderStyle:{value:"solid"}},prohibitedRegion:{color:{value:"#9966FF"},transparency:{value:"0"},borderColor:{value:"",tagValue:"#000000"},borderStyle:{value:"solid"}},constraintRegion:{color:{value:"",tag:"followLayerId",tagValue:""},transparency:{value:"0.5"},borderColor:{value:"",tagValue:"#000000"},borderStyle:{value:"solid"}},colorfulImage:{transparency:{value:"0.5"}},annotation:{borderColor:{value:"#00CCFF"},borderStyle:{value:"solid"}},partition:{color:{value:"#FFFFFF"},transparency:{value:"100"},borderColor:{value:"#C0C0C0"},borderStyle:{value:"solid"}}};var WM=class WM{constructor(){this.nameManager=new T0}static getInstance(){return WM.manager==null&&(WM.manager=new WM),WM.manager}getName(t="constraint1"){return this.nameManager.getNum(t)}hasName(t){return this.nameManager.has(t)}addName(t){this.nameManager.add(t)}deleteName(t){this.nameManager.deleteNum(t)}};WM.manager=null;var Z0=WM;function BB(o){if(o.type==0)return Ze.getInstance().getUseLayer().map(r=>r.layerId);let t=new Set;return o.connects.forEach(e=>{let r=ch(e);r&&t.add(r.layerId)}),Array.from(t)}var rr=class extends He{constructor(e){super();this._notShowFill=!1;this._selectChildId=null;if(this.model=e,e.setModelWatcher(this),this.layerId=xm(this.type,this.layerId,1),this.net=ru(this.net,this.layerId,this.type),J0(this.type,this.model.component,this.model.layerId)||(this.model.component=a1(1,this.model)),this.type==="Constraint Region"){let r=re.getInstance().addConstraintSelector(this.globalIndex);Pp.getInstance().publish("modify",r)}Ob(this.model.component),this.initRefreshRender()}get component(){return this.getComponent()}get color(){return super.color||oA.getLineColor(this)}set color(e){super.color=e,this.refreshRender()}get type(){return this.model.type}set type(e){if(this.model.type!=e){if(this.hiddenCopperResult=!1,this.model.type=="Copper Region"?(Ti.nameManager.deleteNum(this.component.name),this.deleteRegionRuleSelector()):this.model.type==="Constraint Region"?(Z0.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()):this.model.type==="Partition"&&(bo.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()),e==="Constraint Region"){let i=re.getInstance().addConstraintSelector(this.globalIndex);Pp.getInstance().publish("modify",i)}let r=this.model.type;this.model.type=e,this.model.component=a1(1,this.model),this.layerId=xm(e,this.layerId,1),this.strokeWidth=qk(this.strokeWidth,this.model.type,r),this.net=ru(this.net,this.layerId,this.type),Ob(this.model.component),this.refreshRender()}}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId=xm(this.type,e,1,this.model.layerId),this.checkRegion(1),this.refreshRender()}get rotation(){return this.model.rotation}set rotation(e){this.model.rotation=e,this.refreshRender()}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get net(){var e;return(e=this.model.net)==null?void 0:e.toUpperCase()}get showNet(){return this.model.showNet}set net(e){if(this.model.net!=e){Ye.delete(this),this.model.net=e;let r=Pe.getLayer(this.layerId);r&&r.isSignalLayer()&&Ye.addItem(this)}}get start(){return this.model.start}set start(e){this.model.start=e,this.refreshRender()}get width(){return this.model.width}set width(e){this.model.width=e,this.refreshRender()}get height(){return this.model.height}set height(e){this.model.height=e,this.refreshRender()}get strokeWidth(){return this.model.strokeWidth}set strokeWidth(e){this.model.strokeWidth=e,this.refreshRender(),this.type=="3D Shell - Outline"&&(this.component.shellThickness=this.strokeWidth)}get cornerRadius(){return this.model.radius}get realCornerRadius(){return this.model.realCornerRadius}set cornerRadius(e){this.model.radius=e,this.refreshRender()}get leftLow(){return this.getLL()}get leftUp(){return this.getUL()}get rightUp(){return this.getUR()}get rightLow(){return this.getLR()}get radius(){return this.realCornerRadius}get viewColor(){var n,s;let e=this.color,r=(s=(n=le)==null?void 0:n.themeConfig)==null?void 0:s.canvasTheme;r&&(e=r.getRegionColor(this,e));let i=Mt.getTransparencyByPcbType(this,e);return i!=null&&e.alpha!=i&&(e=ee.of6(e,i)),e}get fillColor(){var n,s;let e=super.color||oA.getFillColor(this),r=(s=(n=le)==null?void 0:n.themeConfig)==null?void 0:s.canvasTheme;r&&(e=r.getRegionColor(this,e));let i=Mt.getTransparencyByPcbType(this,e);return i!=null&&e.alpha!=i&&(e=ee.of6(e,i)),e}get partitionName(){return this.component instanceof ac?this.component.name:""}get constrainName(){return this.component instanceof Dh?this.component.name:""}get fpcMaterial(){return this.component instanceof tu?this.component.material:""}get fpcThickness(){return this.component instanceof tu?this.component.thickness:""}get layers(){return this.type=="Annotation"?BB(this.component):[]}get viewGroupId(){return this.model.component instanceof Zi&&this.model.component.isBridgingCopper?this.model.modelType+null:this.model.modelType+this.net}get viewGroupIdModified(){return this.netModified}isSelectChild(){return this._selectChildId!=null}getSelectChildId(){return this._selectChildId}get selectChildId(){return this._selectChildId}getSelectLine(){let e=this.model.polyline.primitives,r=this._selectChildId/2,i=0;for(let n=0;n<e.length;n++){let s=e[n];if(s instanceof M){if(i==r)return s;i++}}return null}clearSelectChildId(){this._selectChildId=null}selectChild(e,r){let i=new S(e,r);this._selectChildId=uBe(this.leftLow.add(this.leftUp).mul(.5),this.rightLow.add(this.rightUp).mul(.5),this.height,2*this.realCornerRadius/Math.min(this.width,this.height),this.strokeWidth,i,Ai().getScale())}fill(){this.isEmpty||!this.notShowFill||(this.notShowFill=!1,this.refreshRender())}removeFill(){this.notShowFill=!0,this.refreshRender()}visible(e=!1){this.fill(),this._selectChildId=null,super.visible(e)}hidden(){this.fill(),this._selectChildId=null,super.hidden()}click(e=!1,r=!1){this.fill(),super.click(e,r)}remove(){this.type=="Copper Region"?(Ti.nameManager.deleteNum(this.component.name),this.clearCopper(),this.deleteRegionRuleSelector()):this.type=="Constraint Region"?(Z0.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()):this.type=="Partition"&&(bo.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()),super.remove()}getComponent(){return this.model.component}setComponent(e){J0(this.type,e,this.model.layerId)&&(this.model.component=e,Ob(this.model.component))}getPointByIndex(e){switch(e){case 2:return this.getLL();case 0:return this.getUL();case 3:return this.getLR();case 1:return this.getUR();default:return null}}setLL(e){this.model.leftLow=e,this.refreshRender()}getLL(){return this.model.leftLow}setLR(e){this.model.rightLow=e,this.refreshRender()}getLR(){return this.model.rightLow}setUR(e){this.model.rightUp=e,this.refreshRender()}getUR(){return this.model.rightUp}setUL(e){this.model.leftUp=e,this.refreshRender()}getUL(){return this.model.leftUp}getEndPoints(){return this.model.getEndPoints()}getMidPoints(){return this.model.getMidPoints()}getArcCenterPoints(){return this.model.getArcCenterPoints()}getLines(){return this.model.getLines()}getArcs(){return this.model.getArcs()}getHoveredArc(e,r){let{strokeWidth:i,realCornerRadius:n}=this;return this.getArcs().filter(a=>$0(new S(e,r),a.center,n,zt.toRadians(a.startAngle),zt.toRadians(a.endAngle()),a.sweep(),i))[0]}getHoveredLine(e,r){let i=[],{strokeWidth:n,realCornerRadius:s}=this;i.push(...this.getLines(),...this.getArcs());let a=new S(e,r);return i.filter(l=>l instanceof M?Da(a,l.start(),l.end(),n):$0(a,l.center,s,zt.toDegrees(l.startAngle),zt.toDegrees(l.endAngle()),l.sweep(),n))[0]}getPolyline(){return this.model.polyline}getStrokeWidth(){return this.model.strokeWidth}getAllLinesInOrder(){return this.model.getAllLinesInOrder()}rotateFor(e,r){this.model.rotateFor(e,r),this.refreshRender()}transform(e){this.removeFill(),this.model.transform(e),this.refreshRender()}refreshRender(){var e;this.model!=null&&((e=Pe.getLayer(57))!=null&&e.visible)&&this.iteratorRatlines(i=>{i.isVisible&&(i.startNode==this&&!i.start.equals(this.start)&&(i.start=this.start,i.click()),i.endNode==this&&!i.end.equals(this.start)&&(i.end=this.start,i.click()))}),super.refreshRender()}isSelect(e,r,i){if(this.getParent()!=null)return!1;let n=this.model.inShape(e,r,i?Ai():void 0);return this.type=="Copper Region"&&(this.needShowOutline()||(n=!1)),this.type=="Copper Region"&&this.isHighLight?n||this.isInInnerArea(e,r):n}isInInnerArea(e,r){return this.model.InnerArea(e,r)}isSelectOnlyLine(e,r){return!this.isVisible||this.getParent()!=null?!1:this.model.isSelectOnlyLine(e,r)}isInProfile(e,r){return this.isVisible?this.model.inShape(e,r):!1}toJSON(){var s;let e;this.type==="Constraint Region"&&(e=re.getInstance().getRegion(this.globalIndex).clone());let r=this.getComponent(),i=r&&typeof r.toJSON=="function"?r.toJSON():null;return{globalIndex:this.globalIndex,partition:this.partition,type:this.type,layerId:this.layerId,start:this.start,width:this.width,height:this.height,cornerRadius:this.cornerRadius,net:this.net,locked:this.locked,strokeWidth:this.strokeWidth,rotation:this.rotation,silkColor:((s=this.silkColor)==null?void 0:s.toString())||null,componentData:i,regionRuleSelector:e}}getMathGraphics(e=this.layerId,r=0){return this.model.getMathGraphics(e)}inActiveLayer(e){return this.type=="Annotation"?(this.component==null,!0):e==this.layerId}buildBBox(){return this.model.buildBBox()}getType(){return 24}getViewState(){return this.isEmpty?"Not Shown":this.isVisible?this.notShowFill?this.needShowOutline()?"Not Show Fill":"Not Shown":this.isHighLight?"Main And Highlight":this.needShowOutline()?"Only Main":"Not Shown":"Not Shown"}setSelectChildIdByOver(e){this._selectChildId=e}};var _x=class _x{constructor(){this._autoGenerate=!1;this._outlineCollect=new Map;this._bbox=new _e}static getInstance(){return _x.instance||(_x.instance=new _x),_x.instance}get outlineCollect(){return this._outlineCollect}get bbox(){return this._bbox}set bbox(t){this._bbox=t}get autoGenerate(){return this._autoGenerate&&!this._board}set autoGenerate(t){this._autoGenerate=t}set board(t){this._autoGenerate&&t&&(this.outlineCollect.clear(),this.bbox=new _e),t?Ns.getInstance().isBoard=!0:Ns.getInstance().isBoard=!1,this._board=t}get board(){return this._board}static getValidProfile(t){return!["Annotation","TearDrop","Partition"].includes(t)}getShape(t){let e=0,r=new Array(t.childrens.length);for(let i of t.childrens){let n=new Array(i.length),s=0;for(let a of i)a instanceof hs?n[s++]=Cu.addByModel(a):n[s++]=Yc.addArcByModel(a);r[e++]=n}return r}deleteBoard(t){t==this.board&&(this.board=null)}addBoard(t,e=!1){if(this.board&&!e)return null;switch(t.modelType){case"Rect":this.board=new rr(t);break;case"Circle":this.board=new Pr(t);break;case"Polygon":this.board=new lt(t,this.getShape(t));break}return this.board}};_x.id="board",_x.width=.02;var us=_x;var bre=class bre{constructor(t){this._changeMaps=null;this.profileColorMap=new Map;this.profileStyleMap=new Map;this._param=null;this._isBoard=!1;this._param=t||Ss(GIe)}static getInstance(t){return this._instance==null&&(this._instance=new bre(t)),this._instance}set isBoard(t){t!=this._isBoard&&(this._isBoard=t,this.backgroundColor=this.backgroundColor)}checkSetting(t){let e=Ss(GIe);if(!t)return this._changeMaps=null,e;this._changeMaps=[];for(let r in e){let i=e[r];if(!t[r])t[r]=i,this._changeMaps.push(r);else{let n=this._param&&this._param[r],s=t[r];this.itemEquals(n,s)||this._changeMaps.push(r)}}return t}itemEquals(t,e){return!t&&!e?!0:t&&e?this.contentDataItemEquals(t.borderColor,e.borderColor)&&this.contentDataItemEquals(t.borderStyle,e.borderStyle)&&this.contentDataItemEquals(t.color,e.color)&&this.contentDataItemEquals(t.transparency,e.transparency):!1}contentDataItemEquals(t,e){var r,i;return!t&&!e?!0:!(!(t&&e)||((r=t.value)==null?void 0:r.toLowerCase())!=((i=e.value)==null?void 0:i.toLowerCase())||(t.tag||"")!=(e.tag||"")||(t.tagValue||"")!=(e.tagValue||""))}updateAll(t){this._param=this.checkSetting(t),uo.getInstance().padConfig.setShapeAlpha(1-this.padTransparency),uo.getInstance().viaConfig.setShapeAlpha(1-this.viaTransparency),uo.getInstance().trackConfig.setShapeAlpha(1-this.trackTransparency),this.backgroundColor=this.backgroundColor,this.gridColor=this.gridColor,this.gridTransparency=this.gridTransparency,this.boldGridColor=this.boldGridColor,this.boldGridTransparency=this.boldGridTransparency,this.coordinateAxisColor=this.coordinateAxisColor,this.coordinateAxisTransparency=this.coordinateAxisTransparency,this.partitionBorderColor=this.partitionBorderColor,this.partitionColor=this.partitionColor,this.partitionLineStyle=this.partitionLineStyle,this.partitionTransparency=this.partitionTransparency,this.colorfulImageTransparency=this.colorfulImageTransparency,this.refreshRender()}updateSelectAlpha(t){if(t!=null){let e=1-t/100;uo.getInstance().padConfig.setSelectAlpha(e),uo.getInstance().viaConfig.setSelectAlpha(e)}}hasChangeKey(t){return this._changeMaps?t.some(e=>this._changeMaps.includes(e)):!0}refreshRender(){var r;let t=!1;RBe(),t=t||this.hasChangeKey(["select","hoverHighlight"]),(t||this.hasChangeKey(["metallicDrilling","unMetallicDrilling","pad"]))&&Qt.getAllItem().forEach(i=>i.refreshRender()),(t||this.hasChangeKey(["via"]))&&Wr.getAllItem().forEach(i=>i.refreshRender()),(t||this.hasChangeKey(["track"]))&&pr.getAllItem().forEach(i=>i.refreshRender()),(t||this.hasChangeKey(["copperRegion"]))&&Ti.getAllItem().forEach(i=>i.refreshRender()),(t||this.hasChangeKey(["boardShape"])||this.hasChangeKey(["background"]))&&((r=us.getInstance().board)==null||r.refreshRender());let e=["copperRegion","solidRegion","prohibitedRegion","constraintRegion","annotation","partition"].map(i=>t||this.hasChangeKey([i]));Xt.getAllItem().concat(Kt.getAllItem()).concat(pt.getAllItem()).forEach(i=>{switch(i.type){case"Copper Region":{e[0]&&i.refreshRender();break}case"Fill Region":{e[1]&&i.refreshRender();break}case"Prohibited Region":{e[2]&&i.refreshRender();break}case"Constraint Region":{e[3]&&i.refreshRender();break}case"Annotation":{e[4]&&i.refreshRender();break}case"Partition":{e[5]&&i.refreshRender();break}}}),(t||this.hasChangeKey(["colorfulImage"]))&&So.getAllItem().forEach(i=>i.refreshRender())}isSolidLine(t){return t==="solid"}getParam(t){return this._param[t]}getCommonColor(t){var i;let e=ee.BLACK;if(!t)return console.warn("has no color content!"),ee.BLACK;let r=t.value;if(t.tag==="followLayerId")return Pe.getLayer(+r)?ee.BLACK:null;if(r){if(!r)return e;r==="#000000"&&t.tag!="default"&&((i=t.tagValue)!=null&&i.startsWith("#"))&&(r="#000001");try{return ee.of3(r)}catch{return e}}return e}setCommonColor(t,e){if(e&&t){let r=e.toString();t.value=r,e instanceof ee?t.tag="":t.tag="followLayerId"}}getColor(t){return this.getCommonColor(t==null?void 0:t.color)}setColor(t,e){this.setCommonColor(t==null?void 0:t.color,e)}getBorderColor(t){return this.getCommonColor(t==null?void 0:t.borderColor)}setBorderColor(t,e){return this.setCommonColor(t==null?void 0:t.borderColor,e)}getTransparency(t){let e=parseFloat(t&&t.transparency&&t.transparency.value);return isNaN(e)?0:e}normalAlpha(t){return isNaN(t)?0:Math.min(Math.max(t,0),1)}setTransparency(t,e){if(t!=null&&t.transparency&&!isNaN(e)){e=Math.min(Math.max(e,0),1);let r=e.toString();t.transparency.value=r}}getLineStyle(t){return t&&t.borderStyle&&t.borderStyle.value}setLineStyle(t,e){t!=null&&t.borderStyle&&e&&(t.borderStyle.value=e)}getHoleColor(t,e=1){let r=t?this.metallicDrillingColor:this.unMetallicDrillingColor,n=(1-(t?this.metallicDrillingTransparency:this.unMetallicDrillingTransparency))*e;return r||(r=ee.BLACK),r=ee.of6(r,n),r}getRegionColor(t,e){let r=-1,i=e||t.color,n=i;if(t.type=="Copper Region"?r=1-this.copperRegionTransparency:t.type=="Fill Region"?r=1-this.solidRegionTransparency:t.type=="Prohibited Region"?(n=this.prohibitedRegionColor,n||(n=ee.BLACK||i),r=1-this.prohibitedRegionTransparency):t.type==="Constraint Region"?(n=this.constraintRegionColor,n||(n=ee.BLACK||i),r=1-this.constraintRegionTransparency):t.type==="Partition"?(n=this.partitionColor,n||(n=ee.of3("#C0C0C0")),r=1-this.partitionTransparency):t.type=="Annotation"&&(n=this.annotationBorderColor,r=1-.3),n==null)throw new Error("Region Color Error!!!");return r>=0?ee.of6(n,r):n}getRegionLineStyle2(t,e=ee.BLACK){let r=ee.BLACK,i="solid",n=!1,s=null;return t=="Copper Region"?(r=this.copperRegionBorderColor,i=this.copperRegionLineStyle,n=!0):t=="Fill Region"?(r=this.solidRegionBorderColor,i=this.solidRegionLineStyle):t==="Prohibited Region"?(r=this.prohibitedRegionBorderColor,i=this.prohibitedRegionLineStyle):t==="Constraint Region"?(r=this.constraintRegionBorderColor,i=this.constraintRegionLineStyle):t==="Partition"?(r=this.partitionBorderColor||ee.of3("#C0C0C0"),i=this.partitionLineStyle||"solid"):t=="Annotation"?(r=this.annotationBorderColor,i=this.annotationLineStyle):t=="TearDrop"?n=!0:t=="Segment"?(r=this.selectBoxColor,i=this.selectBoxLineStyle):t=="Board"&&(r=this.boardBorderColor,i=this.boardLineStyle,s=this.boardColor,i=="none"&&(r=this.backgroundColor)),r||(r=e),t==="Partition"&&i==="none"&&(r=ee.of2(r.r,r.g,r.b,0)),{lineColor:r,lineSolid:i==="none"?!0:i==="solid",lineNone:i==="none",isPixel:n,color:s}}getRegionLineStyle(t,e){let{defaultLineColor:r}=e||{},i=t.type,n=this.profileColorMap.get(i),s=this.profileStyleMap.get(i),a=!1;return(n==null||s==null)&&(i=="Copper Region"?(n=this.copperRegionBorderColor,s=this.copperRegionLineStyle):i=="Fill Region"?(n=this.solidRegionBorderColor,s=this.solidRegionLineStyle):i==="Prohibited Region"?(n=this.prohibitedRegionBorderColor,s=this.prohibitedRegionLineStyle):i==="Constraint Region"?(n=this.constraintRegionBorderColor,s=this.constraintRegionLineStyle):i==="Partition"?(n=this.partitionBorderColor||ee.of3("#C0C0C0"),s=this.partitionLineStyle||"solid"):i=="Annotation"?(n=this.annotationBorderColor,s=this.annotationLineStyle):i=="TearDrop"?(n=t.color,s="solid",a=!0):i=="Board"?(n=this.boardBorderColor,s=this.boardLineStyle,s==="none"&&(n=this.backgroundColor)):(n=t.color,s="solid")),n||(n=r||ee.BLACK||t.color),t.type==="Partition"&&s==="none"&&(n=ee.of2(n.r,n.g,n.b,0)),a||(a=s=="dotted"),{lineColor:n,lineSolid:s==="none"?!0:s==="solid",lineNone:s==="none",isPixel:a}}cursorParam(){return this.getParam("cursor")}get cursorColor(){return this.getColor(this.cursorParam())}set cursorColor(t){this.setColor(this.cursorParam(),t)}get cursorLineStyle(){return this.getLineStyle(this.cursorParam())}set cursorLineStyle(t){this.setLineStyle(this.cursorParam(),t)}backgroundParam(){return this.getParam("background")}get backgroundColor(){return this.getColor(this._isBoard?this.boardParam():this.backgroundParam())}set backgroundColor(t){let e=this.backgroundColor;e.equals(t)||(this.setColor(this.backgroundParam(),t),e=this.backgroundColor),R.getInstance().backgroundColor=e}get rulerBackgroundColor(){return R.getInstance().rulerBackgroundColor}set rulerBackgroundColor(t){t&&(R.getInstance().rulerBackgroundColor=t)}get rulerStringColor(){return R.getInstance().rulerStringColor}set rulerStringColor(t){t&&(R.getInstance().rulerStringColor=t)}gridParam(){return this.getParam("grid")}get gridColor(){return this.getColor(this.gridParam())}set gridColor(t){this.setColor(this.gridParam(),t);let e=this.gridColor;e&&(It.getInstance().gridColor=e)}get gridTransparency(){return this.getTransparency(this.gridParam())}set gridTransparency(t){this.setTransparency(this.gridParam(),t),It.getInstance().transparency=this.gridTransparency}boldGridParam(){return this.getParam("boldGrid")}get boldGridColor(){return this.getColor(this.boldGridParam())}set boldGridColor(t){this.setColor(this.boldGridParam(),t);let e=this.boldGridColor;e&&(It.getInstance().multiGridColor=e)}get boldGridTransparency(){return this.getTransparency(this.boldGridParam())}set boldGridTransparency(t){this.setTransparency(this.boldGridParam(),t),It.getInstance().multiTransparency=this.boldGridTransparency}coordinateAxisParam(){return this.getParam("coordinateAxis")}get coordinateAxisColor(){return this.getColor(this.coordinateAxisParam())}set coordinateAxisColor(t){this.setColor(this.coordinateAxisParam(),t);let e=this.coordinateAxisColor;e&&(It.getInstance().coordinateAxisColor=e)}get coordinateAxisTransparency(){return this.getTransparency(this.coordinateAxisParam())}set coordinateAxisTransparency(t){this.setTransparency(this.coordinateAxisParam(),t),It.getInstance().coordinateAxisTransparency=this.coordinateAxisTransparency}selectBoxParam(){return this.getParam("Select Box")}get selectBoxColor(){return this.getColor(this.selectBoxParam())}set selectBoxColor(t){this.setColor(this.selectBoxParam(),t)}get selectBoxLineStyle(){return this.getLineStyle(this.selectBoxParam())}set selectBoxLineStyle(t){this.setLineStyle(this.selectBoxParam(),t)}selectParam(){return this.getParam("select")}get selectColor(){return this.getColor(this.selectParam())}set selectColor(t){this.setColor(this.selectParam(),t)}get selectTransparency(){return this.getTransparency(this.selectParam())}set selectTransparency(t){this.setTransparency(this.selectParam(),t)}hoverHighlightParam(){return this.getParam("hoverHighlight")}get hoverHighlightColor(){return this.getColor(this.hoverHighlightParam())}set hoverHighlightColor(t){this.setColor(this.hoverHighlightParam(),t)}get hoverHighlightTransparency(){return this.getTransparency(this.hoverHighlightParam())}set hoverHighlightTransparency(t){this.setTransparency(this.hoverHighlightParam(),t)}metallicDrillingParam(){return this.getParam("metallicDrilling")}get metallicDrillingColor(){return this.getColor(this.metallicDrillingParam())}set metallicDrillingColor(t){this.setColor(this.metallicDrillingParam(),t)}get metallicDrillingTransparency(){return this.getTransparency(this.metallicDrillingParam())}set metallicDrillingTransparency(t){this.setTransparency(this.metallicDrillingParam(),t)}unMetallicDrillingParam(){return this.getParam("unMetallicDrilling")}get unMetallicDrillingColor(){return this.getColor(this.unMetallicDrillingParam())}set unMetallicDrillingColor(t){this.setColor(this.unMetallicDrillingParam(),t)}get unMetallicDrillingTransparency(){return this.getTransparency(this.unMetallicDrillingParam())}set unMetallicDrillingTransparency(t){this.setTransparency(this.unMetallicDrillingParam(),t)}padParam(){return this.getParam("pad")}get padTransparency(){return this.getTransparency(this.padParam())}set padTransparency(t){uo.getInstance().padConfig.setShapeAlpha(1-this.normalAlpha(t)),this.setTransparency(this.padParam(),t)}viaParam(){return this.getParam("via")}get viaTransparency(){return this.getTransparency(this.viaParam())}set viaTransparency(t){uo.getInstance().viaConfig.setShapeAlpha(1-this.normalAlpha(t)),this.setTransparency(this.viaParam(),t)}trackParam(){return this.getParam("track")}get trackTransparency(){return this.getTransparency(this.trackParam())}set trackTransparency(t){uo.getInstance().trackConfig.setShapeAlpha(1-this.normalAlpha(t)),this.setTransparency(this.trackParam(),t)}copperRegionParam(){return this.getParam("copperRegion")}get copperRegionTransparency(){return this.getTransparency(this.copperRegionParam())}set copperRegionTransparency(t){this.setTransparency(this.copperRegionParam(),t)}get copperRegionBorderColor(){return this.getBorderColor(this.copperRegionParam())}set copperRegionBorderColor(t){this.profileColorMap.delete("Copper Region"),this.setBorderColor(this.copperRegionParam(),t)}get copperRegionLineStyle(){return this.getLineStyle(this.copperRegionParam())}set copperRegionLineStyle(t){this.setLineStyle(this.copperRegionParam(),t)}solidRegionParam(){return this.getParam("solidRegion")}get solidRegionTransparency(){return this.getTransparency(this.solidRegionParam())}set solidRegionTransparency(t){this.setTransparency(this.solidRegionParam(),t)}get solidRegionBorderColor(){return this.getBorderColor(this.solidRegionParam())}set solidRegionBorderColor(t){this.setBorderColor(this.solidRegionParam(),t)}get solidRegionLineStyle(){return this.getLineStyle(this.solidRegionParam())}set solidRegionLineStyle(t){this.setLineStyle(this.solidRegionParam(),t)}prohibitedRegionParam(){return this.getParam("prohibitedRegion")}get prohibitedRegionColor(){return this.getColor(this.prohibitedRegionParam())}set prohibitedRegionColor(t){this.setColor(this.prohibitedRegionParam(),t)}get prohibitedRegionTransparency(){return this.getTransparency(this.prohibitedRegionParam())}set prohibitedRegionTransparency(t){this.setTransparency(this.prohibitedRegionParam(),t)}get prohibitedRegionBorderColor(){return this.getBorderColor(this.prohibitedRegionParam())}set prohibitedRegionBorderColor(t){this.setBorderColor(this.prohibitedRegionParam(),t)}get prohibitedRegionLineStyle(){return this.getLineStyle(this.prohibitedRegionParam())}set prohibitedRegionLineStyle(t){this.setLineStyle(this.prohibitedRegionParam(),t)}constraintRegionParam(){return this.getParam("constraintRegion")}get constraintRegionColor(){return this.getColor(this.constraintRegionParam())}set constraintRegionColor(t){this.setColor(this.constraintRegionParam(),t)}get constraintRegionTransparency(){return this.getTransparency(this.constraintRegionParam())}set constraintRegionTransparency(t){this.setTransparency(this.constraintRegionParam(),t)}get constraintRegionBorderColor(){return this.getBorderColor(this.constraintRegionParam())}set constraintRegionBorderColor(t){this.setBorderColor(this.constraintRegionParam(),t)}get constraintRegionLineStyle(){return this.getLineStyle(this.constraintRegionParam())}set constraintRegionLineStyle(t){this.setLineStyle(this.constraintRegionParam(),t)}partitionParam(){return this.getParam("partition")}get partitionColor(){return this.getColor(this.partitionParam())}set partitionColor(t){this.setColor(this.partitionParam(),t)}get partitionTransparency(){return this.getTransparency(this.partitionParam())}set partitionTransparency(t){this.setTransparency(this.partitionParam(),t)}get partitionBorderColor(){return this.getBorderColor(this.partitionParam())}set partitionBorderColor(t){this.setBorderColor(this.partitionParam(),t)}get partitionLineStyle(){return this.getLineStyle(this.partitionParam())}set partitionLineStyle(t){this.setLineStyle(this.partitionParam(),t)}boardOutlineInnerParam(){return this.getParam("boardOutlineInner")}get boardOutlineInnerColor(){return this.getColor(this.boardOutlineInnerParam())}set boardOutlineInnerColor(t){this.setColor(this.boardOutlineInnerParam(),t)}get boardOutlineInnerTransparency(){return this.getTransparency(this.boardOutlineInnerParam())}set boardOutlineInnerTransparency(t){this.setTransparency(this.boardOutlineInnerParam(),t)}colorfulImageParam(){return this.getParam("colorfulImage")}get colorfulImageTransparency(){return this.getTransparency(this.colorfulImageParam())}set colorfulImageTransparency(t){this.setTransparency(this.colorfulImageParam(),t)}annotationParam(){return this.getParam("annotation")}get annotationBorderColor(){return this.getBorderColor(this.annotationParam())}get annotationLineStyle(){return this.getLineStyle(this.annotationParam())}boardParam(){return this.getParam("boardShape")}get boardBorderColor(){return this.getBorderColor(this.boardParam())}get boardColor(){return this.getColor(this._isBoard?this.backgroundParam():this.boardParam())}get boardLineStyle(){return this.getLineStyle(this.boardParam())}};bre._instance=null;var Ns=bre;var PFe=Rke(()=>cn.getInstance()),UIe=class{getLineColor(t){if(t.type==="Constraint Region")return ee.WHITE;if(t.type==="Partition")return Ns.getInstance().getRegionLineStyle2("Partition").lineColor;if(t.type=="3D Shell - Side Slot Region"||t.type=="3D Shell - Top Slot Region"){let r=12;return PFe().getLayer(r).activeColor}if(t.type=="Board")return Ns.getInstance().getRegionLineStyle2("Board").lineColor;let e=Pe.getLayer(t.layerId);return e&&e.isSignalLayer()?Ye.getSpecialColor(t.net):ee.BLACK}getFillColor(t){if(t.type==="Constraint Region"){let r=PFe().getLayer(t.layerId).activeColor;return ee.of6(r,.5)}if(t.type=="Board")return Ns.getInstance().getRegionLineStyle2("Board").color;let e=Pe.getLayer(t.layerId);return e&&e.isSignalLayer()?Ye.getSpecialColor(t.net):ee.BLACK}},oA=new UIe;function HIe(o,t){return(o+t)%t}var lt=class extends He{constructor(e,r){super();this._notShowFill=!1;this._children=new Array(0);this._isSelectPolygon=!1;this._mask=!1;if(this.model=e,this.layerId=xm(e.type,e.layerId,2),this.net=ru(e.net,e.layerId,e.type),J0(e.type,e.component,this.model.layerId)||(this.model.component=a1(2,e)),e.type==="Constraint Region"){let i=re.getInstance().addConstraintSelector(e.globalIndex);Pp.getInstance().publish("modify",i)}e.isSimplify||this.setChildrens(r,!0),this.initRefreshRender(),e.setModelWatcher(this),Ob(this.model.component),Ro("editor/shape/PcbPolygon")}resetModelNotify(){super.resetModelNotify(),this.iteratorChildren(e=>{e.resetModelNotify()})}isSelectOne(){var e;return((e=this._selectModels)==null?void 0:e.length)==1}get component(){return this.getComponent()}get isSelectPolygon(){return this._isSelectPolygon}set isSelectPolygon(e){this._isSelectPolygon=e}get start(){let e=this.getOutMostChildren();if(e.length>0)return e[0].start;{let r=this.model.outline;if(r==null)throw new Error("Polygon was removed!!!");return r instanceof ge?r.start():r.primitives[0].start()}}get end(){let e=this.getOutMostChildren();if(e.length>0)return e[e.length-1].end;{let r=this.model.outline;if(r==null)throw new Error("Polygon was removed!!!");return r instanceof ge?r.end():r.primitives[r.primitives.length-1].end()}}get color(){let e=super.color||oA.getLineColor(this),r=Mt.getTransparencyByPcbType(this,e);return r!=null&&e.alpha!=r&&(e=ee.of6(e,r)),e}set color(e){super.color=e,this.refreshRender()}get net(){var e;return(e=this.model.net)==null?void 0:e.toUpperCase()}get showNet(){return this.model.net}set net(e){if(this.model.net!=e){Ye.delete(this),this.model.net=e;let r=Pe.getLayer(this.layerId);r&&r.isSignalLayer()&&Ye.addItem(this),this.refreshRender()}}get type(){return this.model.type}set type(e){if(e!=this.model.type){let r=["TearDrop"].includes(e);switch(this.isSimplify?r||(this.isSimplify=!1,this._children.length==0&&this.refreshChildrenByOutline()):r&&(this.isSimplify=!0,this._children.length>0&&this.refreshOutlineByChildren()),this.hiddenCopperResult=!1,this.model.type=="Copper Region"?(Ti.nameManager.deleteNum(this.component.name),this.deleteRegionRuleSelector()):this.model.type==="Constraint Region"?(Z0.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()):this.model.type==="Partition"&&(bo.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()),e){case"Line":case"3D Shell - Screw Pillar":break;default:if(this.checkClose())return}if(e==="Constraint Region"){let n=re.getInstance().addConstraintSelector(this.globalIndex);Pp.getInstance().publish("modify",n)}let i=this.model.type;i=="TearDrop"&&i!=e&&A.publish("deleteConnects",{item:this,connects:this.model.component.connects}),this.model.type=e,this.model.component=a1(2,this.model),this.layerId=xm(e,this.model.layerId,2),this.strokeWidth=qk(this.strokeWidth,this.model.type,i),this.net=ru(this.net,this.layerId,this.type),this.iteratorChildren(n=>{n.layerId=this.layerId,n.width=this.strokeWidth}),this.clickSelect(),Ob(this.model.component),this.refreshRender()}}get layerId(){return this.model.layerId}set layerId(e){if(this.model.layerId!=e){let r=xm(this.type,e,2,this.model.layerId);this.model.layerId=r,this.checkRegion(2),this.iteratorChildren(i=>{i.model.layerId=r}),this.clickSelect(),this.refreshRender()}}get strokeWidth(){return this.model.strokeWidth}set strokeWidth(e){this.model.strokeWidth=e,this.type=="3D Shell - Outline"&&(this.component.shellThickness=this.strokeWidth),this.refreshRender()}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get outline(){return this.getMathGraphics()}get partitionName(){return this.component instanceof ac?this.component.name:""}get constrainName(){return this.component instanceof Dh?this.component.name:""}get fpcMaterial(){return this.component instanceof tu?this.component.material:""}get fpcThickness(){return this.component instanceof tu?this.component.thickness:""}get fillColor(){var n,s;let e=super.color||oA.getFillColor(this),r=(s=(n=le)==null?void 0:n.themeConfig)==null?void 0:s.canvasTheme;r&&(e=r.getRegionColor(this,e));let i=Mt.getTransparencyByPcbType(this,e);return i!=null&&e.alpha!=i&&(e=ee.of6(e,i)),e}get fillState(){return this.notShowFill?1:0}get childrenModified(){return this.model.childrenModified}get isSimplify(){return this.model.isSimplify}set isSimplify(e){this.model.isSimplify=e}get viewGroupId(){return this.model.component instanceof Zi&&this.model.component.isBridgingCopper?this.model.modelType+null:this.model.modelType+this.model.net}get viewGroupIdModified(){return this.netModified}clickSelect(){this.iteratorSelectModels(e=>{e.isEmpty||e.click()})}onlyOneChilds(){if(this._children.length==1){let e=this._children[0];if(Array.isArray(e)){if(e.length==1)return e[0]}else return e}return null}isComplexPolygon(){return this._children.length>1&&Array.isArray(this._children[0])}outlineLength(){let e=0;for(let r of this._children)if(!Array.isArray(r))e+=r.length;else for(let i of r)e+=i.length;return e}keepOutline(){this.getChildrens().slice(1).forEach(e=>{e.forEach(r=>{r.remove(),A.publish("delete",r)})}),this.getChildrens().length=1,this.setChildrens([])}get primitives(){let e=new Array;for(let r of this._children)if(!Array.isArray(r))e.push(r.primitive);else for(let i of r)e.push(i.primitive);return e}getEdgePolylines(){let e=new Array;for(let r of this._children)if(Array.isArray(r))for(let i of r){let n=i.getMathGraphics(this.layerId,0);n!=null&&e.push(n)}else{let i=r.getMathGraphics(this.layerId,0);i!=null&&e.push(i)}return e}getAllChildrens(){let e=new Array;for(let r of this._children)if(!Array.isArray(r))e.push(r);else for(let i of r)e.push(i);return e}refreshOutlineByChildren(){this.model.refreshOutlineByChildren()}refreshChildrenByOutline(e){if(!e&&this._children.length>0)return this._children;let r=new Array,i=this.strokeWidth,n=[],s;return this.model.refreshChildrenByOutline((l,c)=>{let h;l.modelType==="Line"?h=Cu.addByModel(l):h=Yc.addArcByModel(l),h&&(h.setParent(this),n.push(h))},e),n.length>0&&r.push(n),this._children=lM(r),this._children}iteratorSelectModels(e){this._selectModels&&this._selectModels.some(r=>e(r))}addSelect(e){if(this._mask)return;this._selectModels||(this._selectModels=[]);let r=[];this._selectModels=this._selectModels.filter(i=>{let n=i.isEmpty;return n||r.push(i.globalIndex),!n}),!e.isEmpty&&!r.includes(e.globalIndex)&&this._selectModels.push(e),this._selectModels.length>0||this.clearSelectNodes()}removeSelect(e){if(this._mask||!this._selectModels)return;let r=this._selectModels.indexOf(e);r>=0&&this._selectModels.splice(r,1),this._selectModels.length==0&&(this.notShowFill=!1,this.refreshRender(),this.clearSelectNodes())}selectChild(e,r){for(let i of this._children)if(Array.isArray(i)){for(let n of i)if(n.isSelect(e,r,!0))return n}else if(i.isSelect(e,r,!0))return i}clearSelectNodes(){delete this._selectModels}getSelects(){return this._selectModels?Array.from(this._selectModels):[]}hasSelectModel(e){return this._selectModels?this._selectModels.includes(e):!1}iteratorChildren(e){return xte(this._children,e)}getChildrens(){return iB(this._children)}setChildrens(e,r=!1){if(e.length>0){this._children=lM(e);for(let s of this._children)if(Array.isArray(s))for(let a of s)a.setParent(this),a.layerId=this.model.layerId,a.width=this.model.strokeWidth;else s.setParent(this),s.layerId=this.model.layerId,s.width=this.model.strokeWidth}if(r)return;let i=this.getChildrens(),n=new Array(i.length);for(let s=0,a=i.length;s<a;s++){let l=i[s],c=new Array(l.length);for(let h=0,u=l.length;h<u;h++)c[h]=l[h].model;n[s]=c}this.model.childrens=n,this.refreshRender()}insertChildren(e,r){let[i,n]=r;this.getChildrens()[i].splice(n,0,e),e.setParent(this),e.layerId=this.model.layerId,e.width=this.model.strokeWidth,this.setChildrens([])}removeChild(e){let[r,i]=e,n=this.getChildrens();n[r][i].remove(),A.publish("delete",n[r][i]),n[r].splice(i,1),this.setChildrens([])}removeChildByIndex(e=0){let i=this.getChildrens()[e];for(let n=i.length-1;n>=0;n--)i[n].remove(),A.publish("delete",i[n]),i.splice(n,1);this.setChildrens([])}removeAllChildren(){this.iteratorChildren(e=>{e.remove(),A.publish("delete",e)}),this._children.length=0,this.setChildrens([])}getConnect(e,r,i=!1,n=this.model.lastIsClose){for(let s=0;s<this._children.length;s++){let a=this._children[s];if(Array.isArray(a)){let l=a.length;for(let c=0;c<l;c++)if(a[c]==e){let h=a[HIe(r?c-1:c+1,l)];return!n&&(r&&c==0||!r&&c==l-1)||h==null||h.isEmpty||i&&!this.hasSelectModel(h)?null:h}}else if(a==e){let l=this._children[HIe(r?s-1:s+1,this._children.length)];return!n&&(r&&s==0||!r&&s==this._children.length-1)||l==null||l.isEmpty||i&&!this.hasSelectModel(l)?null:l}}return null}outMostChildrenIndex(){let e=this.getChildrens();if(e.length<=1)return 0;let r=0,i=0;return e.map((n,s)=>{let a=new _e;n.forEach(c=>{let h=c.buildBBox();h&&a.ext1(h)});let l=a.valid()?a.build1().area():0;l>i&&(i=l,r=s)}),r}getOutMostChildren(){let e=this.outMostChildrenIndex();return this.getChildrens()[e]||[]}filterOutMostChildren(){let e=this.outMostChildrenIndex();return this.getChildrens().map((r,i)=>i==e?r:[])}setCustomColor(e){this.color=e}checkClose(){let e=this.getChildrens();if(e.length==1&&e[0].length==1&&e[0][0]instanceof mt)return!0;let r=e.map(i=>{let n=i[0].start,s=i[i.length-1].end;if(!n.equals(s)){let a=Cu.add(this.model.layerId,s,n,this.model.strokeWidth,!1);i.push(a)}return i});return this.setChildrens(r),!1}getComponent(){return this.model.component}setComponent(e){J0(this.type,e,this.model.layerId)&&(this.model.component=e,Ob(this.model.component))}fill(){this.isEmpty||!this.notShowFill||(this.notShowFill=!1,this.refreshRender())}removeFill(){this.notShowFill=!0,this.refreshRender()}deletePoint(e){let[r,i]=e,n=this.getChildrens(),s=n[r][i],a,l,c=this.getConnect(s,!0);c!=null?a=c.start:a=s.start,l=s.end;let h=Cu.add(this.layerId,a,l,this.model.strokeWidth,!1);if(s.remove(),A.publish("delete",s),h.setParent(this),n[r].splice(i,1,h),c!=null){c.remove(),A.publish("delete",c);let u=n[r].indexOf(c);n[r].splice(u,1)}this.clearSelectNodes(),this.refreshRender()}get childrens(){return this._children}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.transform(i)}visible(e=!1){this.isSimplify&&!this.isHighLight?(this.model.updateSimplyOutline(),this.removeAllChildren()):this.iteratorChildren(r=>{var i;(i=this._selectModels)!=null&&i.includes(r)||r.visible()}),this.fill(),super.visible(e)}hidden(){this.iteratorChildren(e=>{e.hidden()}),this.fill(),super.hidden()}click(e=!1,r=!1){e||this.isSimplify&&this.refreshChildrenByOutline(),this._mask=!0,this.iteratorChildren(i=>{i.click(e,r)}),this.fill(),super.click(e,r),this._mask=!1}remove(){this.removeFill(),this.iteratorChildren(this.iteratorChildrenCallback),this.type=="Copper Region"?(Ti.nameManager.deleteNum(this.component.name),this.clearCopper(),this.deleteRegionRuleSelector()):this.type=="Constraint Region"?(Z0.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()):this.type=="Partition"&&(bo.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()),super.remove(),this.refreshRender()}transform(e){this.removeFill(),this.model.transform(e),this.refreshRender()}isSelect(e,r,i){if(!this.isVisible||this.getParent()!=null)return!1;let n=this.model.inShape(e,r,i?Ai():void 0);return this.type=="Copper Region"&&(this.needShowOutline()||(n=!1)),this.type=="Copper Region"&&this.isHighLight?n||this.isInInnerArea(e,r):n}isInInnerArea(e,r){return this.model.InnerArea(e,r)}isInProfile(e,r){return this.isVisible?this.model.inShape(e,r):!1}onlyOutline(e,r){return this.model.onlyOutline(e,r)}selectEdges(e,r){let i=new Array;for(let n of this._children)if(Array.isArray(n))for(let s of n){let a=s.buildBBox();a!=null&&a.isContains1(e,r)&&s.isSelect(e,r)&&i.push(s)}else{let s=n.buildBBox();s!=null&&s.isContains1(e,r)&&n.isSelect(e,r)&&i.push(n)}return i}buildBBox(){return this.model.buildBBox()}queryBBox(){return this.model.buildBBox()}toJSON(){var c;let e=new Array;this.isSimplify&&this.refreshChildrenByOutline();let r=this.getChildrens(),i=-1;for(let h of r){i++,e.push([]);for(let u of h){if(u.model.modelType==="Line"){e[i].push({LINE:u.toJSON()});continue}e[i].push({ARC:u.toJSON()})}}let n;this.type==="Constraint Region"&&(n=re.getInstance().getRegion(this.globalIndex).clone());let s=this.getComponent(),a=s&&typeof s.toJSON=="function"?s.toJSON():null;return{globalIndex:this.globalIndex,partition:this.partition,type:this.type,layerId:this.layerId,shapes:e,strokeWidth:this.strokeWidth,net:this.net,locked:this.locked,silkColor:((c=this.silkColor)==null?void 0:c.toString())||null,componentData:a,regionRuleSelector:n,isSimplify:this.isSimplify}}isClose(e){return e!=null&&!isNaN(e)?this.isClose2(e):this.getChildrens().every((r,i)=>this.isClose2(i))}isClose2(e){let r=this.getChildrens()[e];if(r.length==2){let i=r[0],n=r[r.length-1];if(i instanceof mt&&n instanceof mt&&i.start.distance1(n.end)>=this.model.strokeWidth)return!1;if(i.start.distance1(n.end)<this.model.strokeWidth)return!0}else if(r.length>2){let i=r[0],n=r[r.length-1];if(i.start.distance1(n.end)<this.model.strokeWidth)return!0}}getMathGraphics(e,r){return this.model.getMathGraphics(e,r)}equals1(e){return this.start.equals(e.start)&&this.end.equals(e.end)?e.model.equals(this.model):!1}addRatline(e){this.type=="Line"&&!this.isClose()?(e.startNode==this&&(e.start.equals1(this.start)&&super.addRatline(e),e.start.equals1(this.end)&&(this.endRatline==null&&(this.endRatline=new Array),this.endRatline.push(e))),e.endNode==this&&(e.end.equals1(this.start)&&super.addRatline(e),e.end.equals1(this.end)&&(this.endRatline==null&&(this.endRatline=new Array),this.endRatline.push(e)))):super.addRatline(e)}removeRatline(e){if(super.removeRatline(e),this.endRatline!=null){let r=this.endRatline.indexOf(e);r>=0&&this.endRatline.splice(r,1)}}refreshRender(){var e,r,i;if(this.model!=null&&(((e=this.endRatline)==null?void 0:e.length)||0)+(((r=this._ratlines)==null?void 0:r.length)||0)>0&&((i=Pe.getLayer(57))==null?void 0:i.visible)&&(this.iteratorRatlines(s=>{s.isVisible&&(s.startNode==this&&!s.start.equals(this.start)&&(s.start=this.start,s.click()),s.endNode==this&&!s.end.equals(this.start)&&(s.end=this.start,s.click()))}),this.endRatline!=null))for(let s of this.endRatline)s.isVisible&&(s.startNode==this&&!s.start.equals(this.end)&&(s.start=this.end),s.endNode==this&&!s.start.equals(this.end)&&(s.end=this.end));super.refreshRender()}getType(){return 13}needShowOutline(){var e,r;if(this.type=="Copper Region"){let i=(r=(e=le)==null?void 0:e.themeConfig)==null?void 0:r.canvasTheme;if(i&&i.getRegionLineStyle(this).lineNone){let s=this.getChildrens().find(a=>!!a.find(c=>{if(c.isHighLight)return!0}));return this.isHighLight||this.isSelectPolygon||s?!0:!this.hasCopperRes()}}return!0}getViewState(){return this.isEmpty?"Not Shown":this.isVisible?this.notShowFill?this.needShowOutline()?"Not Show Fill":"Not Shown":this.isHighLight?"Main And Highlight":this.needShowOutline()?"Only Main":"Not Shown":"Not Shown"}iteratorChildrenCallback(e,r,i){e.remove(),A.publish("delete",e)}};var zM=new aB,_t=class extends Ls{constructor(t){super(),this.model=t,t.setModelWatcher(this),this.refreshRender(),Ro("editor/shape/PcbArc")}get modelType(){return this.model.modelType}set arcType(t){this.model.arcType=t}get arcType(){return this.model.arcType}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId=t,this.refreshRender()}set isSegment(t){}get isSegment(){return this.model.isSegment}get width(){let t=this.getParent();return t!=null&&t instanceof lt?t.strokeWidth:this.model.width}set width(t){this.model.width=t}get center(){return this.model.center}set center(t){this.model.center=t,this.refreshRender()}get radius(){return this.model.radius}set radius(t){t==0&&(t=1e-8),this.model.radius=t,this.refreshRender()}get startAngle(){return this.model.startAngle}set startAngle(t){this.model.startAngle=zM.fixStartAngle(t,this.radius,this.endAngle,this.sweep),this.refreshRender()}get endAngle(){return this.model.endAngle}set endAngle(t){this.model.endAngle=zM.fixEndAngle(t,this.radius,this.startAngle,this.sweep),this.refreshRender()}get sweep(){return this.model.sweep}set sweep(t){this.model.sweep=t,this.refreshRender()}get locked(){let t=this.getParent();return t!=null?t.locked:this.model.locked}set locked(t){let e=this.getParent();e!=null?(e.locked=t,this.model.locked=t):this.model.locked=t}get start(){return this.model.start}set start(t){this.model.start=zM.fixStart(t,this.center,this.radius,this.end,this.sweep),this.refreshRender()}get end(){return this.model.end}set end(t){this.model.end=zM.fixEnd(t,this.center,this.radius,this.start,this.sweep),this.refreshRender()}get length(){return this.model.length}set length(t){this.model.length=t,this.refreshRender()}get midPoint(){return this.model.midPoint}set midPoint(t){this.model.midPoint=t,this.refreshRender()}get direct(){return this.end.sub(this.start).normalize()}get primitive(){return this.model.primitive}get color(){let t=ee.BLACK,e=this.getParent();if(e!=null&&e instanceof He){let r=e.color;r!=null&&(t=r)}return t}get lineColor(){let t=this.getParent();return t!=null&&t instanceof He?t.lineColor:this.color}get lineSolid(){let t=this.getParent();return t!=null&&t instanceof He?t.lineSolid:!0}get isPixel(){return!1}get viewGroupId(){var t;return((t=this.getParent())==null?void 0:t.viewGroupId)||""}get viewGroupIdModified(){var t;return((t=this.getParent())==null?void 0:t.viewGroupIdModified)||!1}buildBBox(){return this.isEmpty?null:this.model.buildBBox()}getAngle(){return this.model.getAngle()}setStartAngleAndEndAngle(t,e){this.model.setStartAngleAndEndAngle(t,e),this.refreshRender()}rotateFor(t,e){this.model.rotateFor(t,e),this.refreshRender()}visible(t=!1){super.visible(t);let e=this.getParent();e!=null&&e instanceof lt&&e.removeSelect(this)}hidden(){super.hidden()}pointIsContain(t){let e=this.buildBBox();return!!(e&&e.isContains(t))}click(t=!1,e=!1){super.click(t,e);let r=this.getParent();r!=null&&r instanceof lt&&r.addSelect(this)}lineIsEqual(t){if(t instanceof mt)return!1;if(this.center.equals(t.center)&&ne.eq(this.radius,t.radius)){if(this.sweep===t.sweep){if(this.start.equals(t.start)&&this.end.equals(t.end)&&ne.eq(this.startAngle,t.startAngle)&&ne.eq(this.endAngle,t.endAngle))return!0}else if(this.start.equals(t.end)&&this.end.equals(t.start)&&ne.eq(this.startAngle,t.endAngle)&&ne.eq(this.endAngle,t.startAngle))return!0}return!1}remove(){this.model.remove(),super.remove()}applyMatrix(t){this.model.transform(t),this.refreshRender()}transform(t){let e=this.getParent();e!=null&&e instanceof lt?e.transform(t):this.model.transform(t),this.refreshRender()}isSelect(t,e,r){if(!this.isVisible)return!1;let i=this.getParent();return i&&i.getViewState()=="Not Shown"?!1:this.model.inShape(t,e,r?Ai():void 0)}queryBBox(){return this.model.buildBBox()}toJSON(){return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,center:this.center,radius:this.radius,width:this.width,startAngle:this.startAngle,endAngle:this.endAngle,sweep:this.sweep,locked:this.locked,isSegment:this.isSegment,arcType:this.arcType}}getMathGraphics(t=this.layerId,e=0){return this.isEmpty?null:this.model.getMathGraphics(t,e)}getType(){return 1}getViewState(){if(this.getParent()!=null)return"Not Shown";if(this.isEmpty)return"Not Shown";if(this.isVisible){if(this.isHighLight)return"Main And Highlight";{let t=this.getParent();return t&&t.getViewState()=="Not Shown"?"Not Shown":"Only Main"}}else return"Not Shown"}setBBoxModify(){}setLayerModify(t){}refreshRender(){if(!this.rendering){let t=this.getParent();t!=null?t.rendering||(Mo.attach(t,t.getType()),t.rendering=!0):(Mo.attach(this,this.getType()),this.rendering=!0)}return null}};function TFe(o,t){let e=t.center,r=t.radius,i=t.start,n=t.end,s=t.midPoint,a=o.distance1(e),l=db(a,r,.001),c=new M(i,s),h=new M(n,s),u=new M(o,e),d=Y9(c,u)||Y9(h,u);return l&&!!d}var mt=class extends Ls{constructor(t){super(),this.model=t,t.setModelWatcher(this),this.refreshRender(),Ro("editor/shape/PcbLine")}get modelType(){return this.model.modelType}set isPixel(t){t?this._isPixel=t:delete this._isPixel}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId=t,this.refreshRender()}get locked(){let t=this.getParent();return t!=null?t.locked:this.model.locked}set locked(t){let e=this.getParent();e!=null?(e.locked=t,this.model.locked=t):this.model.locked=t}get direct(){return this.model.direct}get length(){return this.model.length}set length(t){this.model.length=t,this.refreshRender()}get start(){return this.model.start}set start(t){this.model.start=t,this.refreshRender()}get midPoint(){return this.model.center}get end(){return this.model.end}set end(t){this.model.end=t,this.refreshRender()}get width(){let t=this.getParent();return t!=null&&t instanceof lt?t.strokeWidth:this.model.width}set width(t){this.model.width=t,this.refreshRender()}get primitive(){return this.model.primitive}get color(){let t=ee.BLACK,e=this.getParent();if(e!=null&&e instanceof He){let r=e.color;r!=null&&(t=r)}return t}get lineColor(){let t=this.getParent();return t!=null&&t instanceof He?t.lineColor:this.color}get lineSolid(){let t=this.getParent();return t!=null&&t instanceof He?t.lineSolid:!0}get isPixel(){let t=this.getParent();return t!=null&&t instanceof He?t.isPixel:this._isPixel||!1}get viewGroupId(){var t;return((t=this.getParent())==null?void 0:t.viewGroupId)||""}get viewGroupIdModified(){var t;return((t=this.getParent())==null?void 0:t.viewGroupIdModified)||!1}rotateFor(t,e){this.model.rotateFor(t,e),this.refreshRender()}hidden(){super.hidden()}visible(t=!1){super.visible(t);let e=this.getParent();e!=null&&e instanceof lt&&e.removeSelect(this)}pointIsContain(t){return LP(new M(this.start,this.end),t)>0}lineIsEqual(t){return t instanceof _t?!1:!!(Math.abs(this.direct.cross(t.direct))<dl&&(this.start.equals1(t.start)&&this.end.equals1(t.end)||this.end.equals1(t.start)&&this.start.equals1(t.end)))}click(t=!1,e=!1){super.click(t,e);let r=this.getParent();r!=null&&r instanceof lt&&r.addSelect(this)}remove(){this.model.remove(),super.remove()}applyMatrix(t){this.model.transform(t),this.refreshRender()}transform(t){let e=this.getParent();e!=null&&e instanceof lt?e.transform(t):this.model.transform(t),this.refreshRender()}isSelect(t,e,r){if(!this.isVisible)return!1;let i=this.getParent();return i&&i.getViewState()=="Not Shown"?!1:this.model.inShape(t,e,r?Ai():void 0)}queryBBox(){return this.model.buildBBox()}buildBBox(){return this.isEmpty?null:this.model.buildBBox()}toJSON(){return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,start:this.start,end:this.end,width:this.width,locked:this.locked}}getMathGraphics(t=this.layerId,e=0){return this.isEmpty?null:this.model.getMathGraphics(t,e)}getType(){return 8}getViewState(){if(this.getParent()!=null)return"Not Shown";if(this.isEmpty)return"Not Shown";if(this.isVisible){if(this.isHighLight)return"Main And Highlight";{let t=this.getParent();return t&&t.getViewState()=="Not Shown"?"Not Shown":"Only Main"}}else return"Not Shown"}setBBoxModify(){}setLayerModify(t){}refreshRender(){if(!this.rendering){let t=this.getParent();t!=null?t.rendering||(Mo.attach(t,t.getType()),t.rendering=!0):(Mo.attach(this,this.getType()),this.rendering=!0)}return null}};function WIe(o){for(let t in le.fontConfig.info)if(le.fontConfig.info[t].family==o&&!["default","default2","Serif","Sans Serif"].includes(o))return o;return["default","default2","Serif","Sans Serif"].includes(o)||o==""?ut.defaultTextFamily[1]:o}function Pre(){let o=new Array;for(let t in le.fontConfig.info){let e=le.fontConfig.info[t],r=e.family;r.toLocaleLowerCase()==="default"&&(r="Default"),o.push({value:e.family,text:r})}return o}function IFe(o,t,e){let r={fontFamily:t,type:e},i=["","default","default2","Serif","Sans Serif"].includes(t);return!cy.everyCharHasDefaultFontPath(o)&&i&&(r.fontFamily=WIe(t)),["","default","default2","Serif","Sans Serif"].includes(r.fontFamily)?e!==0&&(r.type=0):e!==1&&(r.type=1),r}var Ll=(G=>(G[G.ALL=0]="ALL",G[G.COMPONENT=1]="COMPONENT",G[G.ATTR=2]="ATTR",G[G.COMPONENTSILK=3]="COMPONENTSILK",G[G.TRACK=4]="TRACK",G[G.PAD_TEST=5]="PAD_TEST",G[G.PAD=6]="PAD",G[G.PADSPAIR=7]="PADSPAIR",G[G.NETWORK=8]="NETWORK",G[G.VIA=9]="VIA",G[G.SUTUREVIA=10]="SUTUREVIA",G[G.RATLINE=11]="RATLINE",G[G.COMBINATION=12]="COMBINATION",G[G.TEXT=13]="TEXT",G[G.PICTURE=14]="PICTURE",G[G.IMAGE=15]="IMAGE",G[G.DIMENSION=16]="DIMENSION",G[G.SHEETBOARD=17]="SHEETBOARD",G[G.SLOT=18]="SLOT",G[G.REGION=19]="REGION",G[G.FPC_STIFFENER=20]="FPC_STIFFENER",G[G.POUR=21]="POUR",G[G.COPPER=22]="COPPER",G[G.PROHIBIT=23]="PROHIBIT",G[G.CONSTRAINT=24]="CONSTRAINT",G[G.PARTITION=25]="PARTITION",G[G.LINE=26]="LINE",G[G.SHELL=27]="SHELL",G[G.BOSS=28]="BOSS",G[G.CREASE=29]="CREASE",G[G.TOPSHELLCUT=30]="TOPSHELLCUT",G[G.SIDESHELLCUT=31]="SIDESHELLCUT",G[G.TOPBOTTOMENTITY=32]="TOPBOTTOMENTITY",G[G.SIDEENTITY=33]="SIDEENTITY",G[G.TEARDROP=34]="TEARDROP",G[G.DRCTAGGING=35]="DRCTAGGING",G[G.LOCKED=36]="LOCKED",G[G.UNLOCKED=37]="UNLOCKED",G[G.ANNOTATION=38]="ANNOTATION",G))(Ll||{});var FB=class extends In{getData(t){switch(t){case"originX":return ve(R.getInstance().origin.x*10,4);case"originY":return ve(R.getInstance().origin.y*10,4);case"unit":return R.getInstance().unit;case"gridXSize":return ve(It.getInstance().getGridX()*10,6);case"gridYSize":return ve(It.getInstance().getGridY()*10,6);case"snapXSize":return ve(It.getInstance().getSnapX()*10,6);case"snapYSize":return ve(It.getInstance().getSnapY()*10,6);case"altSnapXSize":return ve(R.getInstance().altGridSize.GridX.number,6);case"altSnapYSize":return ve(R.getInstance().altGridSize.GridY.number,6);case"gridType":return OIe(R.getInstance().gridType);case"multiGridType":return OIe(R.getInstance().multiType);case"multiGridRatio":return R.getInstance().multiRatio;case"highlightValue":return ve(R.getInstance().forceValue)}}};var VB=class extends In{getData(t,e){switch(this.id=e.layerId,t){case"layerId":return this.id;case"layerType":return e.type;case"layerName":return e.name;case"show":return e.visible;case"locked":return e.locked;case"use":return e.config;case"activeColor":return e.realActiveColor.toString();case"activateTransparency":return e.realActiveColor.alpha;case"inactiveColor":return e.deactiveColor.toString();case"inactiveTransparency":return Ze.getInstance().deactiveAlpha}}};var GB=class extends In{getData(t){switch(this.id=Ze.getInstance().activeLayer,t){case"layerId":return this.id}}};var UB=class extends In{getData(t,e){switch(this.id=e.name,t){case"netName":return e.name;case"netType":let r=e.netClass;return r!=null?r.name:null;case"specialColor":{let n=Ye.getSpecialColor(e.name);return n.equals(ee.BLACK)?null:n.toString()}case"retLine":{let n=Ye.ratlineVisibleBeforeGray[e.name];return n!=null?n:e.showRatline}case"differentialName":let i=e.netDifferential;return i!=null?i.name:null;case"isPositiveNet":return e.isPositiveNet;case"equalLengthGroupName":{let n=e.equalLengthGroup;return n!=null?n.name:null}}}};var HB=class extends In{getData(t,e){switch(t){case"primiveName":return e;case"display":return this.getDisplay(e);case"pick":return this.getPick(e)}}getDisplay(t){return jt.getVisible(this.getElement(t))}getPick(t){return jt.getPick(this.getElement(t))}getElement(t){switch(t){case"ALL":return 0;case"COMPONENT":return 1;case"PROPERTY":return 2;case"COMPONENTSILK":return 3;case"TRACK":return 4;case"TESTPOINT":return 5;case"FPC_STIFFENER":return 20;case"PAD":return 6;case"PADSPAIR":return 7;case"NETWORK":return 8;case"VIA":return 9;case"SUTUREHOLE":return 10;case"RATLINE":return 11;case"GROUP":return 12;case"TEXT":return 13;case"IMAGE":return 15;case"PICTURE":return 14;case"DIMENSION":return 16;case"BOARDOUTLINE":return 17;case"SLOTREGION":return 18;case"FILLREGIEN":return 19;case"COPPEROUTLINE":return 21;case"COPPERFILLED":return 21;case"PROHIBITEDREGION":return 23;case"CONSTRAINT":return 24;case"PARTITION":return 25;case"LINE":return 26;case"SHELL":return 27;case"SIDESHELLCUT":return 31;case"TOPSHELLCUT":return 30;case"SIDEENTITY":return 33;case"TOPBOTTOMENTITY":return 32;case"CREASE":return 29;case"BOSS":return 28;case"TEARDROP":return 34;case"LOCKED":return 36;case"UNLOCKED":return 37;default:return null}}};var WB=class extends In{getData(t,e){switch(this.id=e.globalIndex,t){case"groupID":return this.id;case"groupName":return e.name}}};var d3=class extends In{getData(t,e){switch(this.id=e.globalIndex,t){case ca.PartitionId:return e.partition;case ca.Index:return this.id;case ca.GroupID:return Ia(e);case ca.Net:return e.showNet;case ca.Name:return e.name;case ca.StartLayer:return e.startLayer;case ca.EndLayer:return e.endLayer;case ca.CenterX:return ve(e.center.x*10,4);case ca.CenterY:return ve(e.center.y*10,4);case ca.HoleDiameter:return ve(e.holeRadius*20,4);case ca.ViaDiameter:return ve(e.radius*20,4);case ca.ViaType:return f8e(e.type);case ca.TopSolderExpansion:return e.expansionType==1?null:ve(e.topExpansion*10,4);case ca.BottomSolderExpansion:return e.expansionType==1?null:ve(e.bottomExpansion*10,4);case ca.Locked:return e.locked;case ca.UnusedInnerLayers:return e.unusedInnerLayers}}};var vx=class extends In{getData(t,e){switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Ia(e);case"netName":return e.showNet;case"layerId":return e.layerId;case"startX":return ve(e.start.x*10,4);case"startY":return ve(e.start.y*10,4);case"endX":return ve(e.end.x*10,4);case"endY":return ve(e.end.y*10,4);case"width":return ve(e.width*10,4);case"locked":return e.locked;case"zIndex":return e.zIndex}}};var xx=class extends In{getData(t,e){switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Ia(e);case"netName":return e.showNet;case"layerId":return e.layerId;case"startX":return ve(e.start.x*10,4);case"startY":return ve(e.start.y*10,4);case"endX":return ve(e.end.x*10,4);case"endY":return ve(e.end.y*10,4);case"angle":return ve(e.angle/Math.PI*180,4);case"width":return ve(e.width*10,4);case"locked":return e.locked;case"zIndex":return e.zIndex;case"arcType":return y8e(e.arcType)}}};var Rx=class extends S0{getData(t,e){var r;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Ia(e);case"netName":return e.showNet||"";case"layerId":return e.layerId;case"width":return ve(e.strokeWidth*10,4);case"path":return this.getShapeInfo(e)[0]||[];case"locked":return e.locked;case"zIndex":return e.zIndex;case"specialColor":return(r=e.silkColor)==null?void 0:r.toString();case"polyType":return J8e(e.type)}}};var p3=class extends S0{getData(t,e){var r;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"id":case"index":return this.id;case"groupId":return Ia(e);case"netName":return e.net||"";case"layerId":return e.layerId;case"width":return e instanceof or?ve(e.strokeWidth*10,4):0;case"fillStyle":if(e instanceof or)return ob.SOLID;if(e instanceof yn)return ob.PLANE;break;case"path":return e instanceof or?this.getShapeInfo(e):this.toFix(e.copperPath,10);case"locked":return e.locked;case"zIndex":return e.zIndex;case"isBridgingCopper":return e instanceof or&&e.component instanceof Zi&&e.component.isBridgingCopper?e.component.isBridgingCopper:!1;case"networkList":return e instanceof or&&e.component instanceof Zi&&e.component.isBridgingCopper?e.component.networkList:[];case"refs":return e instanceof or&&e.component instanceof Zi&&e.component.padId!=""?[e.component.padId]:null;case"specialColor":return(r=e.silkColor)==null?void 0:r.toString()}}toFix(t,e=1){let r=new Array;return t.forEach(i=>{let n=new Array;i.forEach(s=>{typeof s=="number"?n.push(ve(s*e,4)):n.push(s)}),r.push(n)}),r}};var Dx=class extends S0{getData(t,e){switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Ia(e);case"layerId":return e.layerId;case"width":return ve(e.strokeWidth*10,4);case"prohibitType":return this.getProhibitType(e);case"path":return this.getShapeInfo(e);case"locked":return e.locked;case"name":if(e.component instanceof Dh)return e.component.name;case"regionType":return e.component instanceof Dh?EN.CONSTRAINT:EN.PROHIBIT}}getProhibitType(t){let e=t.component,r=new Array;return e instanceof Fu&&(e.track&&r.push(CP.TRACK),e.device&&r.push(CP.COMPONENT),e.copper&&r.push(CP.COPPER),e.fill&&r.push(CP.FILL),e.planzone&&r.push(CP.PLANE)),r}};var zB=class extends S0{getData(t,e){this.id=e.globalIndex;let r=e.component;switch(t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Ia(e);case"netName":return e.showNet;case"layerId":return e.layerId;case"width":return ve(e.strokeWidth*10,4);case"name":return r!=null&&r instanceof xn?r.name:"";case"order":return r!=null&&r instanceof xn?r.order:null;case"path":return this.getShapeInfo(e);case"pourType":return this.getPourType(e);case"keepIsland":return r!=null&&r instanceof xn?r.keepIsland:"";case"HeatWeld":return 0;case"locked":return e.locked;case"zIndex":return e.zIndex}}getPourType(t){let e=t.component;if(e!=null&&e instanceof xn){let r=e.style;return r=="solid"?{pourType:CN.SOLID,fineness:e.optimization?e.optimizationValue*10:0}:{pourType:CN.GRID_LINE,angle:r==="45grid"?45:0,strokeWidth:e.gridLineWidth*10,strokeSpacing:e.clearance*10}}return null}getStyle(t){switch(t){case"solid":return 0;case"90grid":return 0;case"45grid":return 0}}};var wx=class extends In{getData(t,e){var r;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Ia(e);case"layerId":return e.layerId;case"startX":return ve(e.start.x*10,4);case"startY":return ve(e.start.y*10,4);case"width":return ve(e.width*10,4);case"height":return ve(e.height*10,4);case"angle":return ve(e.rotation/Math.PI*180,4);case"mirror":return e.mirror;case"path":return this.getPolygonsPath(e.template);case"locked":return e.locked;case"specialColor":return(3==e.layerId||4==e.layerId)&&e.getParent()==null&&e.silkColor!=null?(r=e.silkColor)==null?void 0:r.toString():null}}getPolygonsPath(t){let e=new Array;return t.forEach(r=>{let i=o1(r);e.push(i)}),e}};var Lx=class extends In{getData(t,e){switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"netName":return e.net;case"layerId":return e.layerId;case"refs":return e.component.connects;case"path":return o1(e.getMathGraphics(e.layerId,0),10);case"groupId":return Ia(e);case"locked":return e.locked}}};var sA=class extends In{getData(t,e){switch(t){case 0:return e.id;case"path":return e.outline;case"width":return e.width*10;case"height":return e.height*10;case"text":return e.text;case"fontFamily":return e.fontFamily;case"fontSize":return e.fontSize;case"thickness":return 10;case"bold":return e.bold;case"italic":return e.italic;case"reverse":return e.reverse;case"expansion":return e.expansion}}};var f3=class extends eB{getData(t,e){var r;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"Index":return this.id;case"groupId":return Ia(e);case"layerId":return e.layerId;case"x":return ve(e.position.x*10,4);case"y":return ve(e.position.y*10,4);case"text":return e.value;case"fontFamily":return e.fontFamily;case"fontSize":return ve(e.fontSize*10,4);case"strokeWidth":return ve(e.strokeWidth*10,4);case"bold":return 0;case"italic":return 0;case"origin":return vte(e.origin);case"angle":return ve(e.rotation/Math.PI*180,4);case"reverse":return e.reverse;case"expansion":return ve(e.reverseExpansion*10,4);case"mirror":return e.mirror;case"locked":return e.locked;case"zIndex":return e.zIndex;case"path":return I0(e.outline);case"width":return e.width*10;case"height":return e.height*10;case"specialColor":return(3==e.layerId||4==e.layerId)&&e.silkColor!=null&&(e.getParent()==null||e.getParent()!=null&&e.key!="")?(r=e.silkColor)==null?void 0:r.toString():null}}};var Mx=class extends In{getData(t,e){var i;this.id=e.globalIndex;let r=e.text;switch(t){case"partitionId":return e.partition;case"index":return this.id;case"type":return e instanceof Am?"LENGTH":e instanceof _m?"RADIUS":e instanceof Ap?"ANGLE":"";case"layerId":return e.layerId;case"unit":return e instanceof Am||e instanceof _m?e.unit:"";case"strokeWidth":return ve(e.strokeWidth*10,4);case"precision":return e.precision;case"textFollow":return 1;case"coords":return this.getCoords(e);case"locked":return e.locked;case"zIndex":return e.zIndex;case"groupId":return Ia(e);case"fontX":return r.positionIsNull?null:ve(r.position.x*10,4);case"fontY":return r.positionIsNull?null:ve(r.position.y*10,4);case"fontValue":return r.value;case"fontSize":return ve(r.fontSize*10,4);case"fontWidth":return ve(r.strokeWidth*10,4);case"specialColor":return(3==e.layerId||4==e.layerId)&&e.getParent()==null&&e.silkColor!=null?(i=e.silkColor)==null?void 0:i.toString():null;case"text":return this.getStr(r,r.positionIsNull)}}getStr(t,e){let r=["layerId","x","y","text","fontFamily","fontSize","strokeWidth","bold","italic","origin","angle","reverse","expansion","mirror","locked"],i={},n=new f3;return r.forEach(s=>{i[s]=n.getData(s,t)}),e&&(i.x=null,i.y=null),i}getCoords(t){let e=new Array;return t instanceof Am?(e.push(ve(t.left.x*10,4)),e.push(ve(t.left.y*10,4)),e.push(ve(t.start.x*10,4)),e.push(ve(t.start.y*10,4)),e.push(ve(t.end.x*10,4)),e.push(ve(t.end.y*10,4)),e.push(ve(t.right.x*10,4)),e.push(ve(t.right.y*10,4))):t instanceof _m?(e.push(ve(t.end.x*10,4)),e.push(ve(t.end.y*10,4)),e.push(ve(t.start.x*10,4)),e.push(ve(t.start.y*10,4)),e.push(t.radius*10)):t instanceof Ap&&(e.push(ve(t.start.x*10,4)),e.push(ve(t.start.y*10,4)),e.push(ve(t.center.x*10,4)),e.push(ve(t.center.y*10,4)),e.push(ve(t.end.x*10,4)),e.push(ve(t.end.y*10,4))),e}};var m3=class extends In{getData(t,e){var r;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Ia(e);case"layerId":return e.layerId;case"x":return ve(e.position.x*10,4);case"y":return ve(e.position.y*10,4);case"angle":return ve(e.rotation/Math.PI*180,4);case"attrs":return PB(e);case"locked":return e.locked;case"zIndex":return e.zIndex;case"specialColor":return(r=e.silkColor)==null?void 0:r.toString();case"layerIdReplacements":return e.getLayerIdReplacementTable()}}};var g3=class extends In{getData(t,e){switch(t){case"partitionId":return e.partition;case"componentId":let r=e.getParent();return r!=null?r.globalIndex:e.globalIndex;case"padNum":if(e instanceof et)return e.num;{let i=e.getParent();if(i!=null){let n=i.globalIndex,s=new RegExp(n);return e.globalIndex.replace(s,"")}return e.globalIndex}case"padNet":return e.showNet;case"padId":{let i=e.getParent();return i!=null?e.globalIndex.replace(i.globalIndex,""):e.globalIndex}case"padLen":{let i=e.getParent(),n=$o.getInstance().getPadLen(i.globalIndex,e.globalIndex);return n!=null?ve(n*10,4):null}case"attrsMap":return e instanceof et?NY(e):null}}};function zIe(o){return o instanceof $h?["NET_CLASS",o.name]:o instanceof zd?["NET",o.name]:o instanceof dd?["EQ_LEN_GRP",o.name]:[]}function Ire(o){return o instanceof gb?zIe(o):o instanceof bb?["DIFF_PAIR",o.name]:o instanceof lg?[zIe(o.net1),zIe(o.net2)]:o instanceof sI?o.regionType=="constraint"?["REGION",o.name]:["POUR",o.name]:[]}function Cre(o){return o instanceof aI?"1":o instanceof p2?"2":o instanceof cI?"14":o instanceof Xv?"3":o instanceof Vv?"11":o instanceof Gv?"13":o instanceof d2?"10":o instanceof kv?"4":o instanceof Yv?"5":o instanceof Fv?"6":o instanceof Bv?"7":o instanceof jv?"9":o instanceof zv?"8":o instanceof qv?"12":null}var YIe=class{getBetweenNetRule(t){let e={};return t.ruleName&&(e[Io.SAFE]=t.ruleName),t.creepageRule&&(e[Io.CREEPAGE]=t.creepageRule),e}getNetRule(t){let e={};return this.isNotDefault(t.safeSpacing)&&(e[Io.SAFE]=t.safeSpacing),this.isNotDefault(t.trackPhysics)&&(e[Io.TRACK]=t.trackPhysics),this.isNotDefault(t.netLengthPhysics)&&(e[Io.NET_LENGTH]=t.netLengthPhysics),t.netLengthTolerancePhysics&&(e[Io.NET_LENGTH_TOLERANCE]=[t.netLengthTolerancePhysics,t.targetNet]),this.isNotDefault(t.differentialPhysics)&&(e[Io.DIFFER_ENTAIL]=t.differentialPhysics),this.isNotDefault(t.blindViaPhysics)&&(e[Io.BLIND]=t.blindViaPhysics),this.isNotDefault(t.radiusPhysics)&&(e[Io.RADIUS]=t.radiusPhysics),this.isNotDefault(t.innerPlane)&&(e[Io.PLANE]=t.innerPlane),this.isNotDefault(t.copperPlane)&&(e[Io.COPPER]=t.copperPlane),this.isNotDefault(t.pasteExpansion)&&(e[Io.PASTE]=t.pasteExpansion),this.isNotDefault(t.solderExpansion)&&(e[Io.SOLDER]=t.solderExpansion),this.isNotDefault(t.creepageSpacing)&&(e[Io.CREEPAGE]=t.creepageSpacing),e}getRegionRule(t){let e={};return t.safeClearance&&(e[Io.SAFE]=t.safeClearance),t.otherClearance&&(e[Io.OTHER]=t.otherClearance),t.track&&(e[Io.TRACK]=t.track),t.diff&&(e[Io.DIFFER_ENTAIL]=t.diff),t.radius&&(e[Io.RADIUS]=t.radius),t.innerPlane&&(t.regionType!="region"||t.regionType=="region"&&this.isNotDefault(t.innerPlane))&&(e[Io.PLANE]=t.innerPlane),t.copperPlane&&(t.regionType!="region"||t.regionType=="region"&&this.isNotDefault(t.copperPlane))&&(e[Io.COPPER]=t.copperPlane),t.creepageClearance&&(e[Io.CREEPAGE]=t.creepageClearance),e}isNotDefault(t){return!!t&&t!=="default"}},jIe=class{getBetweenNetRule(t){return{[Io.COPPER]:t.safeCopperPlane}}getNetRule(t){let e={};return typeof t.safeCopperPlane<"u"&&t.safeCopperPlane!==null&&this.isNotDefault(t.safeCopperPlane)&&(e[Io.COPPER]=t.safeCopperPlane),e}getRegionRule(t){let e={};return typeof t.safeCopperPlane<"u"&&t.safeCopperPlane!==null&&t.safeCopperPlane&&(e[Io.COPPER]=t.safeCopperPlane),e}isNotDefault(t){return!!t&&t!=="default"}},XIe=class{getBetweenNetRule(t){return{[Io.PLANE]:t.safeInnerPlane}}getNetRule(t){let e={};return typeof t.safeInnerPlane<"u"&&t.safeInnerPlane!==null&&this.isNotDefault(t.safeInnerPlane)&&(e[Io.PLANE]=t.safeInnerPlane),e}getRegionRule(t){let e={};return typeof t.safeInnerPlane<"u"&&t.safeInnerPlane!==null&&t.safeInnerPlane&&(e[Io.PLANE]=t.safeInnerPlane),e}isNotDefault(t){return!!t&&t!=="default"}},YB=class extends In{constructor(){super(...arguments);this._commonRuleGenerator=new YIe;this._copperRuleGenerator=new jIe;this._innerPlaneRuleGenerator=new XIe}getData(e,r){switch(e){case"ruleOrder":return r instanceof $h||r instanceof zd?4:r instanceof lg?3:r instanceof bb||r instanceof dd?4:r instanceof sI?2:0;case"ruleSelect":return Ire(r);case"ruleKeyValue":return this.getRule(r);case"copperValue":return this.getCopperRule(r);case"innerPlaneValue":return this.getInnerPlaneRule(r)}}getRuleSelect(e){return e instanceof $h?["NET_CLASS",e.name]:e instanceof zd?["NET",e.name]:e instanceof dd?["EQ_LEN_GRP",e.name]:[]}getRule(e){if(e instanceof gb)return this._commonRuleGenerator.getNetRule(e);if(e instanceof bb){if(this._commonRuleGenerator.isNotDefault(e.differentialPhysics))return{[Io.DIFFER_ENTAIL]:e.differentialPhysics}}else{if(e instanceof lg)return this._commonRuleGenerator.getBetweenNetRule(e);if(e instanceof sI)return this._commonRuleGenerator.getRegionRule(e)}return{}}getCopperRule(e){return e instanceof gb?this._copperRuleGenerator.getNetRule(e):e instanceof lg?this._copperRuleGenerator.getBetweenNetRule(e):e instanceof sI?this._copperRuleGenerator.getRegionRule(e):{}}getInnerPlaneRule(e){return e instanceof gb?this._innerPlaneRuleGenerator.getNetRule(e):e instanceof lg?this._innerPlaneRuleGenerator.getBetweenNetRule(e):e instanceof sI?this._innerPlaneRuleGenerator.getRegionRule(e):{}}};var Nx=class extends In{getData(t,e){switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupID":return Ia(e);case"parentId":return e.globalIndex;case"layerId":return e.layerId;case"x":return ve(e.textPosition.x*10,4);case"y":return ve(e.textPosition.y*10,4);case"key":return"";case"value":{if(e instanceof _m)return e.radius;if(e instanceof Am)return e.length;if(e instanceof Ap)return Yl(e.angle)}case"keyVisible":return!1;case"valueVisible":return!0;case"fontFamily":return"default";case"fontSize":return ve(e.fontSize*10,4);case"strokeWidth":return ve(e.strokeWidth*10,4);case"bold":return 0;case"italic":return 0;case"origin":return 3;case"angle":return 0;case"reverse":return!1;case"expansion":return 0;case"mirror":return!1;case"locked":return!1}}};var jB=class extends In{getData(t,e){switch(this.id=e.layerId,t){case"layerId":return this.id;case"material":return e.material;case"thickness":return ve(e.thickness*10,3);case"permittivity":return e.permittivity;case"lossTangent":return e.lossTangent;case"isKeepIsland":return e.isKeepIsland;case"zIndex":return e.zIndex}}};var kx=class extends S0{getData(t,e){let r=e.component;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Ia(e);case"shellType":return x8e(r.type);case"shellHeight":return ve(r.shellHeight*10,4);case"pcbHeight":return ve(r.substrateHeight*10,4);case"strokeWidth":return ve(e.strokeWidth*10,4);case"path":return this.getShapeInfo(e);case"attrs":{let i=r.getAttrs();return i.Thickness!=null&&(i.Thickness=ve(i.Thickness*10,4)),i.BottomHeight!=null&&(i.BottomHeight=ve(i.BottomHeight*10,4)),i.Direction!=null&&(i.Direction=Number(i.Direction)),i.TopInnerHeight!=null&&(i.TopInnerHeight=ve(i.TopInnerHeight*10,4)),i.BottomInnerHeight!=null&&(i.BottomInnerHeight=ve(i.BottomInnerHeight*10,4)),i}case"thickness":{let i=r.getAttrs();return i.Thickness!=null?ve(i.Thickness*10,4):null}case"direction":{let i=r.getAttrs();return i.Direction!=null?D8e(i.Direction):null}case"bottomHeight":{let i=r.getAttrs();return i.BottomHeight!=null?ve(i.BottomHeight*10,4):null}case"topInnerHeight":{let i=r.getAttrs();return i.TopInnerHeight!=null?ve(i.TopInnerHeight*10,4):null}case"bottomInnerHeight":{let i=r.getAttrs();return i.BottomInnerHeight!=null?ve(i.BottomInnerHeight*10,4):null}case"locked":return e.locked;case"zIndex":return e.zIndex}}};var Bx=class extends In{getData(t,e){let r=e.childrens[0][0];switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Ia(e);case"layerId":return e.layerId;case"startX":return ve(r.start.x*10,4);case"startY":return ve(r.start.y*10,4);case"endX":return ve(r.end.x*10,4);case"endY":return ve(r.end.y*10,4);case"angle":return Tee;case"locked":return e.locked;case"zIndex":return e.zIndex}}};var Fx=class extends In{getData(t,e){let r=e.component;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Ia(e);case"layerId":return e.layerId;case"specification":let i=r.specification;return _8e(i!=="Custom"?i:null);case"centerX":return ve(e.center.x*10,4);case"centerY":return ve(e.center.y*10,4);case"depth":return ve(r.height*10,4);case"thickness":return ve(r.thickness*10,4);case"holeDiameter":return ve(r.holeDiameter*10,4);case"counterBore":return this.getCounterbore(r);case"stiffener":return this.getStiffener(r);case"locked":return e.locked;case"zIndex":return e.zIndex}}getCounterbore(t){if(t.counterboreProps){let{height:e,diameter:r}=t.counterboreProps;if(oh(e)&&oh(r))return{height:ve(e*10,4),diameter:ve(r*10,4)}}return null}getStiffener(t){if(t.stiffenerProps){let{topWidth:e,bottomWidth:r,height:i,stiffThickness:n}=t.stiffenerProps;if(oh(e)&&oh(r)&&oh(i)&&oh(n))return{topWidth:ve(e*10,4),bottomWidth:ve(r*10,4),height:ve(i*10,4),stiffThickness:ve(n*10,4)}}return null}};var Sre=class extends In{getData(t,e){switch(t){case"direction":return _te(e.vertical);case"on":return e.vertical?e.borderAtTopBottom:e.borderAtLeftRight;case"sideHeight":return ve(e.borderHeight*10,4);case"positionHoleDiameter":return e.createPositionHole?ve(e.positionHoleDiameter*10,4):0;case"markDiameter":return e.createMark?ve(e.markDiameter*10,4):0;case"markExpansion":return ve(e.markExpansion*10,4)}}};var Ere=class extends In{getData(t,e){switch(t){case"direction":return _te(e.vertical);case"on":return e.vertical?e.stampColumn:e.stampRow;case"stampHoleGroupQuantity":return parseInt(e.vertical?e.stampPerColumn:e.stampPerRow);case"stampHoleDiameter":return ve(e.stampHoleDiameter*10,4);case"stampHoleQuantityPerGroup":return e.stampHolePerGroup;case"stampHoleSpacing":return ve(e.stampHoleSpacing*10,4)}}};var XB=class extends In{getData(t,e){switch(t){case"on":return e.on;case"row":return e.row;case"column":return e.column;case"rowSpacing":return ve(e.rowSpacing*10,4);case"columnSpacing":return ve(e.columnSpacing*10,4);case"onlyOutline":return e.onlyOutline;case"horizontalStamp":return this.getEncodeDate(e,!0,!0);case"verticalStamp":return this.getEncodeDate(e,!0,!1);case"horizontalSize":return this.getEncodeDate(e,!1,!0);case"verticalSize":return this.getEncodeDate(e,!1,!1)}}getEncodeDate(t,e=!0,r=!0){let i,n;e?(i=Ib.getPanelizeStamp(null),n=new Ere):(n=new Sre,i=Ib.getPanelizeSide(null));let s={};t=Object.assign({vertical:!r},t);for(let a of i)s[a]=n.getData(a,t);return s}};var qB=class extends In{getData(t,e){switch(t){case"layerId":return e.layerId;case"defaultColor":return this.isTop(e)?we.topSilkscreenColor:we.bottomSilkscreenColor;case"baseColor":return this.isTop(e)?we.topBoardColor:we.bottomBoardColor}}isTop(t){return hb(t.layerId)}isBottom(t){return is(t.layerId)}};var Vx=class extends In{getData(t,e){switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Ia(e);case"layerId":return e.layerId;case"fileName":{let r=qd.getItem(e.hashId);return r?r.fileName:(console.error(`\u83B7\u53D6\u771F\u5F69\u56FE\u7247id:${e.globalIndex}template\u5931\u8D25`),"")}case"startX":return ve(e.start.x*10,4);case"startY":return ve(e.start.y*10,4);case"width":return ve(e.width*10,4);case"height":return ve(e.height*10,4);case"angle":return ve(e.rotation/Math.PI*180,4);case"mirror":return e.mirror;case"path":return"blob:"+e.hashId;case"locked":return e.locked;case"zIndex":return e.zIndex}}};var Gx=class extends S0{getData(t,e){let r=e.component;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Ia(e);case"layerId":return e.layerId;case"booleanOperation":return r instanceof ml?1:0;case"belong":if(r instanceof ml)return r.belong;{let n=0;return r.slotOption.forEach(s=>{n+=s}),n}case"depth":let i=r instanceof ml?r.stretchLength:r.slotDepth;return ve(i*10,4);case"strokeWidth":return ve(e.strokeWidth*10,4);case"path":return this.getShapeInfo(e);case"locked":return e.locked;case"refs":return e.component instanceof ml||e.component instanceof wh?[e.component.lineId]:null;case"type":return this.getType(e);case"entityBelong":return r instanceof ml?this.getBelong(r):null;case"slotOptions":return r instanceof wh?this.getSlotOption(r):null}}getType(t){let e=t.type;return e=="3D Shell - Top/Bottom Entity"||e=="3D Shell - Side Entity"?ON.ENTITY:ON.SLOT}getBelong(t){switch(t.belong){case 0:return dO.AUTO;case 2:return dO.LOWER_SHELLS;case 1:return dO.UPPER_SHELLS}}getSlotOption(t){let e=t.slotOption,r=[];e.forEach(n=>{r.push(i(n))});function i(n){switch(n){case 16:return pO.ENTITY;case 4:return pO.OUTLINE;case 8:return pO.SCREW_PILLAR}}return r}};var $B=class extends In{getData(t,e){switch(t){case"name":return e instanceof lI?e.groupName:[];case"sort":if(e instanceof lI)return e.number;case"groupColor":if(e instanceof lI)return e.groupColor;case"pads":if(e instanceof lI){let r=[];for(let i of e.details)r.push([i.pad1Title,i.pad2Title]);return r}}}};var KB=class extends In{getData(t,e){switch(t){case 1:return e instanceof Em?[e.pad1Title,e.pad2Title]:[];case 0:if(e instanceof Em)return e.parent.number}}};var YM=class YM{constructor(){this._type="WIRING_CORNER_LINE45";this._mode="WIRING_MODE_SURROUND";this.cornerType=1}static getInstance(){return YM.instance==null&&(YM.instance=new YM),YM.instance}get type(){return this._type}set type(t){this._type=t,this.setType(t)}get mode(){return this._mode}set mode(t){this._mode=t}getRoutingModeByNum(t){switch(t){case 0:return"WIRING_MODE_IGNORE";case 1:return"WIRING_MODE_PUSHAWAY";case 2:return"WIRING_MODE_SURROUND";case 3:return"WIRING_MODE_OBSTRUCT";case 4:return"WIRING_MODE_SURROUND_AND_PUSHAWAY"}}getRoutingModeByStr(t){switch(t){case"WIRING_MODE_IGNORE":return 0;case"WIRING_MODE_PUSHAWAY":return 1;case"WIRING_MODE_SURROUND":return 2;case"WIRING_MODE_OBSTRUCT":return 3;case"WIRING_MODE_SURROUND_AND_PUSHAWAY":return 4}}getRoutingTypeByStr(t){switch(t){case nb.L45:return"WIRING_CORNER_LINE45";case nb.L90:return"WIRING_CORNER_LINE90";case nb.L:return"WIRING_CORNER_FREEANGLE";case nb.R45:return"WIRING_CORNER_ARC45";case nb.R90:return"WIRING_CORNER_ARC90";case nb.R:return"WIRING_CORNER_ARC"}}getRoutingTypeByEnum(t){switch(t){case"WIRING_CORNER_LINE45":return nb.L45;case"WIRING_CORNER_LINE90":return nb.L90;case"WIRING_CORNER_FREEANGLE":return nb.L;case"WIRING_CORNER_ARC45":return nb.R45;case"WIRING_CORNER_ARC90":return nb.R90;case"WIRING_CORNER_ARC":return nb.R}}setType(t){switch(t){case"WIRING_CORNER_LINE45":this.cornerType=1;break;case"WIRING_CORNER_LINE90":this.cornerType=2;break;case"WIRING_CORNER_ARC45":this.cornerType=3;break;case"WIRING_CORNER_ARC90":this.cornerType=4;break;case"WIRING_CORNER_ARC":this.cornerType=5;break;case"WIRING_CORNER_FREEANGLE":this.cornerType=6;break}}getNextType(t){switch(t&&(this.cornerType==2||this.cornerType===3)&&(this.cornerType=4),this.cornerType){case 1:return"WIRING_CORNER_LINE90";case 2:return"WIRING_CORNER_ARC45";case 3:return"WIRING_CORNER_ARC90";case 4:return"WIRING_CORNER_ARC";case 5:return"WIRING_CORNER_FREEANGLE";case 6:return"WIRING_CORNER_LINE45"}}getNextMode(){switch(this._mode){case"WIRING_MODE_IGNORE":return"routeMode(WIRING_MODE_OBSTRUCT)";case"WIRING_MODE_OBSTRUCT":return"routeMode(WIRING_MODE_SURROUND)";case"WIRING_MODE_SURROUND":return"routeMode(WIRING_MODE_SURROUND_AND_PUSHAWAY)";case"WIRING_MODE_SURROUND_AND_PUSHAWAY":return"routeMode(WIRING_MODE_PUSHAWAY)";case"WIRING_MODE_PUSHAWAY":return"routeMode(WIRING_MODE_IGNORE)"}}};YM.instance=null;var Zt=YM;var fI=class{constructor(){}createBaseHeader(){let t={};return t.unit=R.getInstance().unit,t}};function l1(o){if(o instanceof gt)return 0;if(o instanceof et)return o.isTestPad?o.layerId==12?4:3:o.layerId==12?2:1;if(o instanceof Ct)return 5;if(o instanceof or)switch(o.type){case"Board Outline":return 11;case"TearDrop":case"Fill Region":return 6;case"Slot Region":return 8;case"Line":return o.layerId===11?11:9;case"Copper Region":return 13;case"Prohibited Region":return 15}else{if(o instanceof yn)return 14;if(o instanceof Bi)return 16;if(o instanceof jl)switch(o.modelType){case"Copper":return 13;case"Inner":return 14}else return 10}}function qIe(o){if(o instanceof gt)return o.net;if(o instanceof et)return o.net;if(o instanceof hn)return o.net;if(o instanceof yn)return o.net;if(o instanceof Ct)return o.net;if(o instanceof or)switch(o.type){case"Copper Region":case"Fill Region":case"Line":case"TearDrop":return Ud(o.layerId)?o.net:null;default:return null}return null}function ha(o,t=!1){let e,r=o,i;if((o instanceof hn||o instanceof yn)&&(e=o.globalIndex),o instanceof hs||o instanceof Va||o instanceof hn){let c=o.getParent();c instanceof or&&(r=c)}o instanceof Ct&&(i=o.name);let{globalIndex:n,layerId:s}=r,a=t?12:l1(r),l=qIe(r);if(a===6&&r instanceof or&&r.component instanceof Zi){let c=r.component;if(c.isBridgingCopper){let h=c.networkList;return{id:n,isBridgingCopper:c.isBridgingCopper,nets:h,layerId:s,shapeType:a,viaName:i}}}return{id:n,net:l,layerId:s,shapeType:a,viaName:i,...e!==void 0&&{regionId:e},item:r}}var Rm=class o extends ia{constructor(t,e,r,i,n){super(n||"",t,e),this.arc=r,this.width=i}multiply3(t){return new o(this.net,this.layer,this.arc.multiply3(t),t.iScale*this.width)}bbox(){return this.arc.bbox().extendOfSize(this.width/2)}shape(t,e){return this.layer.equals(t)?this.arc.stroke(this.width+e*2,wr.ROUND,ae.CW):null}};var yy=class o extends ia{constructor(t,e,r,i,n,s,a,l,c,h,u){super(t,e,$r.MULTI),this.center=r,this.holeDiameter=Ki.normal(i),this.startLayerPad=s,this.innerPad=Ki.normal(a),this.endLayerPad=c,this.mask=h,this.startLayer=n,this.endLayer=l,this.unuseLayers=u,this.__bbox=this._bbox()}multiply3(t){return new o(this.id,this.net,this.center.multiply3(t),t.iScale*this.holeDiameter,this.startLayer,t.iScale*this.startLayerPad,t.iScale*this.innerPad,this.endLayer,t.iScale*this.endLayerPad,this.mask,this.unuseLayers)}bbox(){return this.__bbox}isUnuseLayers(t){for(let e of this.unuseLayers)if(e.equals(t))return!0;return!1}_bbox(){let t=0;for(let e of[this.holeDiameter,this.startLayerPad,this.innerPad,this.endLayerPad])t<e&&(t=e);return t/=2,new ht(this.center.x-t,this.center.x+t,this.center.y-t,this.center.y+t)}shape(t,e){if(this.isUnuseLayers(t))return null;let r=Number.NaN;return t.type!==0?t.equals(this.startLayer)?r=this.startLayerPad/2+e:t.equals(this.endLayer)?r=this.endLayerPad/2+e:this.isContains(t)&&t.type==5?r=this.innerPad/2+e:this.isContains(t)&&t.type==6&&(r=this.innerPad/2+e):this.holeDiameter>0&&(r=this.holeDiameter/2+e),isNaN(r)?null:ge.build2([q.build3(this.center,0,-360,r,r)])}getOutsideShapeWithHole(t,e){if(!this.isContains(t,!1))return null;if(this.isUnuseLayers(t)){let i=this.holeDiameter/2+e;return ge.build2([q.build3(this.center,0,-360,i,i)])}let r;if(t.equals(this.startLayer))r=this.startLayerPad;else if(t.equals(this.endLayer))r=this.endLayerPad;else if(t.type==5||t.type==6)r=this.innerPad;else throw new Error("not support");return r=Math.max(r,this.holeDiameter)/2+e,ge.build2([q.build3(this.center,0,-360,r,r)])}isContains(t,e=!0){if(e&&this.isUnuseLayers(t))return!1;if(t.equals(this.startLayer)||t.equals(this.endLayer))return!0;if(this.startLayer.equals($r.TOP_COPPER)){if(!t.equals($r.BOT_COPPER)&&t.order<=this.endLayer.order)return!0}else if(this.startLayer.equals($r.BOT_COPPER)){if(!t.equals($r.TOP_COPPER)&&t.order>=this.endLayer.order)return!0}else if(this.endLayer.equals($r.TOP_COPPER)){if(!t.equals($r.BOT_COPPER)&&t.order<=this.startLayer.order)return!0}else if(this.endLayer.equals($r.BOT_COPPER)){if(!t.equals($r.TOP_COPPER)&&t.order>=this.startLayer.order)return!0}else if(!t.equals($r.BOT_COPPER)&&!t.equals($r.TOP_COPPER)){if(this.startLayer.order>this.endLayer.order){if(t.order<this.startLayer.order&&t.order>this.endLayer.order)return!0}else if(t.order<this.endLayer.order&&t.order>this.startLayer.order)return!0}return!1}};var E0=class o extends ia{constructor(t,e,r){super(t||"","",$r.OUTLINE),this.type=e,this.outlines=r,this.__bbox=this._bbox()}multiply3(t){return new o(this.id,this.type,this.outlines.multiply3(t))}bbox(){return this.__bbox}_bbox(){return this.outlines.bbox()}shape(t,e){return this.outlines}};var c1=class o extends ia{constructor(t,e,r,i,n,s){super(s||"","",t),this._leftLow=e,this._leftUp=r,this._rightLow=i,this._rightUp=n}multiply3(t){let e=this._leftLow.multiply3(t),r=this._leftUp.multiply3(t),i=this._rightLow.multiply3(t),n=this._rightUp.multiply3(t);return new o(this.layer,e,r,i,n)}bbox(){let t=new _e;return t.ext2(this._leftLow).ext2(this._leftUp).ext2(this._rightLow).ext2(this._rightUp),t.build1()}shape(t,e){if(this.layer.equals(t)){let r=this._rightLow.sub(this._leftLow).normalize().mul(e),i=this._leftUp.sub(this._leftLow).normalize().mul(e),n=this._leftLow.sub(r).sub(i),s=this._leftUp.sub(r).add(i),a=this._rightLow.add(r).sub(i),l=this._rightUp.add(r).add(i),c=new Array,h=new M(n,a),u=new M(a,l),d=new M(l,s),p=new M(s,n);return c.push(h),c.push(u),c.push(d),c.push(p),ge.build2(c)}else return null}};var Q0=class o extends ia{constructor(t,e,r,i,n,s){super(s||"",t,e),this.type=r,this.width=i,this.outlines=n,this.__bbox=this._bbox()}multiply3(t){return new o(this.net,this.layer,this.type,this.width,this.outlines.multiply3(t))}bbox(){return this.__bbox}_bbox(){return this.outlines.bbox().extendOfSize(this.width/2)}shape(t,e){return this.layer.equals(t)||this.layer.equals($r.MULTI)?this.outlines:null}};var XP=class{static zoomCorner(t,e){let r=new Array,i=new Array,n=new Array;return this.getPanPrimitive(t,r,n,e),this.rearrange(r,n),this.processStart(r,n),this.getResult(r,n,i,e),i.length>0?ge.build2(i):null}static zoomPolygon(t,e){let r=t.area()>0?t.reverse1():t,i=V1.getExtendPolyLine(r,e,!1);if(i.length===1)return i[0];if(i.length===0)return null;throw new Error("Call durui!")}static zoomLines(t,e){return this.zoomPolygon(ge.build2(t.primitives.concat(t.reverse().primitives)),e/2)}static getPanPrimitive(t,e,r,i){let n=t.primitives;for(let s of n){let a=this.panDistance(s,i);a!==void 0&&(e.push(a),r.push(s))}}static rearrange(t,e){let r=t.length,i=0;for(let a=0;a<r;a++){let l=e[a],c=t[a],h=a==r-1?t[0]:t[a+1];if(!(c instanceof q&&h instanceof q)&&!this.isCW(c.end(),h.start(),l.end())){if(Pt(c,h)!=0){i=a==r-1?0:a+1;break}}else{i=a;break}}let n=this.start4Index(e,i),s=this.start4Index(t,i);e.length=0,t.length=0,n.forEach(a=>{e.push(a)}),s.forEach(a=>{t.push(a)})}static processStart(t,e){let r=t.length;if(r>2){let i=t[r-1],n=t[0],s=e[r-1];if(!(i instanceof q&&n instanceof q)&&!this.isCW(i.end(),n.start(),s.end())){let a=Pt(i,n);for(let l=0;l<a;l+=2){let c=new S(Ee[l],Ee[l+1]);t[r-1]=this.generatePrimitive(i,i.start(),c),t[0]=this.generatePrimitive(n,c,n.end())}}}}static getResult(t,e,r,i){let n=t.length;for(let s=0;s<n;s++){let a=e[s],l=s===n-1?e[0]:e[s+1],c=s==n-1?0:s+1,h=c==n-1?e[0]:e[c+1],u=t[s],d=s==n-1?t[0]:t[s+1],p=c==n-1?t[0]:t[c+1];if(!(u instanceof q&&d instanceof q)&&!this.isCW(u.end(),d.start(),a.end())){let g=this.add(t,r,s,u,d,0);g=this.update(t,r,s,d,g);let y=this.generateArc(l,h,d,p,i);if(g=this.add(t,r,s,u,y,g),g=this.update(t,r,s,y,g),g>0)continue}r.push(u);let m=this.generateArc(a,l,u,d,i);m!==void 0&&r.push(m)}}static generateArc(t,e,r,i,n){if(n>0){let s=t.end(),a=e.start(),l=r.end(),c=i.start();if(l.distance2(c)>1e-8)if(s.equals(a)){let h=l.angleD(s),u=c.angleD(s);return q.build2(s,h,u,n,n,ae.CW)}else{let h=l.angleD(s),u=c.angleD(s),d=l.angleD(a),p=c.angleD(a),m=q.build2(s,h,u,n,n,ae.CW),g=q.build2(a,d,p,n,n,ae.CW);return m.pointOn(m.endAngle()).equals1(c)?m:g.pointOn(g.endAngle()).equals1(c)?g:m}}}static updateNews(t,e,r,i){let n=t.length,s=e==n-1?0:e+1;t[s]=this.generatePrimitive(r,i,r.end())}static add(t,e,r,i,n,s){if(s>0)return s;if(i!=null&&n!=null){let a=Pt(i,n);for(let l=0;l<a;l+=2){let c=new S(Ee[l],Ee[l+1]);e.push(this.generatePrimitive(i,i.start(),c)),this.updateNews(t,r,n,c);break}return a}else return 0}static update(t,e,r,i,n){if(n>0)return n;let s=e.length;if(s>0&&i!=null){let a=e[s-1],l=Pt(a,i);for(let c=0;c<l;c+=2){let h=new S(Ee[c],Ee[c+1]);e[s-1]=this.generatePrimitive(a,a.start(),h),this.updateNews(t,r,i,h)}return l}else return 0}static generatePrimitive(t,e,r){if(t instanceof M)return new M(e,r);if(t instanceof q){let i=t,n=e.angleD(i.center),s=r.angleD(i.center);return q.build2(i.center,n,s,i.rx,i.ry,i.sweep())}else throw new Error("not supported operation")}static start4Index(t,e){let r=t.length,i=new Array;for(let n=e;n<r;n++)i.push(t[n]);for(let n=0;n<e;n++)i.push(t[n]);return i}static isCW(t,e,r){let i=new M(r,t),n=new M(r,e),s=i.end().x-i.start().x,a=i.end().y-i.start().y,l=n.end().x-n.start().x,c=n.end().y-n.start().y;return!(s*c-a*l>0)}static panDistance(t,e){if(t instanceof M){if(t.isPoint())return;{let r=t.panDistance(e);return r.length()>1e-5?r:void 0}}else if(t instanceof q){let r=t;if(r.sweepAngle>0){if(r.rx-e<=0||r.ry-e<=0)return}else if(r.sweepAngle<0&&(r.rx+e<=0||r.ry+e<=0))return;return r=r.panDistance(e),r.start().distance1(r.end())>1e-5||ne.eq(Math.abs(r.sweepAngle),360)?r:void 0}else throw new Error("not supported operation")}};var Ab=class o{constructor(t,e,r,i,n){if(t===4){this.outline=Ki.notnull(n);let s=n.bbox();e=s.width(),r=s.height()}else this.outline=Ki.mustnull(n);if(this.type=t,this.xSize=e,this.ySize=r,0<=i&&i<=100)this.cornerRadius=i;else throw new Error("cornerRadius is only allowed 0-100")}transform(t){let e=this.outline!==null?this.outline.multiply3(t):null;return new o(this.type,t.iScale*this.xSize,t.iScale*this.ySize,this.cornerRadius,e)}equals(t){return t!==null&&t instanceof o?t.type!==this.type||t.xSize!==this.xSize||t.ySize!==this.ySize?!1:t.cornerRadius===this.cornerRadius:!1}},mI=class o{constructor(t,e,r,i,n){t.type===0?(Ki.notnull(e),Ki.notnull(r),Ki.notnull(i)):t.type===4?(Ki.notnull(e),Ki.mustnull(r),Ki.mustnull(i)):t.type===7?(Ki.mustnull(e),Ki.mustnull(r),Ki.notnull(i)):(Ki.mustnull(e),Ki.notnull(r),Ki.mustnull(i)),this.top=n?this.mirrorShapes(e,n):e,this.inner=r,this.bot=i,this.layer=t}mirrorShapes(t,e){let r=t&&t.outline;if(!r)return null;let i=[];return r.points(1,n=>{i.push(n.mirrorY(e))}),new Ab(t.type,t.xSize,t.ySize,t.cornerRadius,ge.build4(i))}transform(t){let e=this.top!==null?this.top.transform(t):null,r=this.inner!==null?this.inner.transform(t):null,i=this.bot!==null?this.bot.transform(t):null;return new o(this.layer,e,r,i)}};var qP=class o{constructor(t,e,r,i,n,s){if(ne.less(r,e))throw new Error(ju.format("hole size %f must less or eq than hole length %f",e,r));this.type=t,this.size=Ki.positiveOr0(e),this.length=Ki.positiveOr0(r),this.rotation=i,this.offsetX=Ki.normal(n),this.offsetY=Ki.normal(s)}transform(t){return new o(this.type,t.iScale*this.size,t.iScale*this.length,this.rotation,t.iScale*this.offsetX,t.iScale*this.offsetY)}},Jp=class o extends ia{constructor(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g=new Array,y){super(t,e,r),this.location=i,this.rotation=n,this.shapes=s,this.hole=a,this.pasteMaskEx=Ki.normal(l),this.topSolderMaskEx=Ki.normal(c),this.bottomSolderMaskEx=Ki.normal(h),this.designator=u,this.plated=d,this.flag=p,this.__bbox=this._bbox(),this.padRule=m,this.unuseLayers=g,this.type=y}multiply3(t){return new o(this.id,this.net,this.layer,this.location.multiply3(t),zt.transformD(this.rotation,t),this.shapes.transform(t),this.hole.transform(t),this.pasteMaskEx*t.iScale,this.topSolderMaskEx*t.iScale,this.bottomSolderMaskEx*t.iScale,this.designator,this.plated,this.flag,this.padRule,this.unuseLayers)}bbox(){return this.__bbox}_bbox(){let t=new _e,e=0,r=0;for(let c of[this.shapes.top,this.shapes.inner,this.shapes.bot])c!==null&&(e<c.xSize&&(e=c.xSize),r<c.ySize&&(r=c.ySize),c.outline!==null&&t.ext1(c.outline.bbox()));e/=2,r/=2;let i=this.location.add1(-e,r),n=this.location.add1(e,-r),s=this.location.add1(e,r),a=this.location.add1(-e,-r),l=Qe.rotateD(this.rotation).setOrigin1(this.location);if(t.ext2(i.multiply3(l)).ext2(n.multiply3(l)).ext2(s.multiply3(l)).ext2(a.multiply3(l)),this.layer.type===0){e=this.hole.size/2,r=this.hole.length/2;let c=this.location.add1(this.hole.offsetX,this.hole.offsetY);i=c.add1(-e,r),n=c.add1(e,-r),s=this.location.add1(e,r),a=this.location.add1(-e,-r);let h=Qe.rotateD(this.hole.rotation).setOrigin1(c);i=i.multiply3(h),n=n.multiply3(h),t.ext2(i.multiply3(l)).ext2(n.multiply3(l)).ext2(s.multiply3(l)).ext2(a.multiply3(l))}return t.build1()}isUnuseLayers(t){for(let e of this.unuseLayers)if(e.equals(t))return!0;return!1}hasHoleShape(){return this.hole&&this.hole.size>0&&this.hole.length>0}shape(t,e){return this.isUnuseLayers(t)?null:t.type!==0?this.shapes.top!==null&&t.type===4?this.generate1(this.shapes.top,e):this.shapes.bot!==null&&t.type===7?this.generate1(this.shapes.bot,e):this.shapes.inner!==null&&t.type===5?this.generate1(this.shapes.inner,e):this.shapes.inner!==null&&t.type===6?this.generate1(this.shapes.inner,e):null:this.hasHoleShape()?this.getHoleShape(e):null}getHoleShape(t){let e=this.hole.size/2+t,r=this.hole.length/2+t,i;switch(this.hole.type){case 2:i=new M(new S(-r+e,0),new S(r-e,0)).stroke(e*2,wr.ROUND,ae.CW);break;case 1:i=new M(new S(-e,0),new S(e,0)).stroke(e*2,wr.BUTT,ae.CW);break;default:i=ge.build2([q.build3(S.ORIGIN,0,-360,e,e)]);break}return i.multiply3(Qe.rotateD(this.hole.rotation).translate(this.hole.offsetX,this.hole.offsetY).rotateD(this.rotation).translate1(this.location))}generate1(t,e){let r=e*2,i=Qe.rotateD(this.rotation).translate1(this.location);switch(t.type){case 3:{let n,s;if(t.xSize>=t.ySize){let a=(t.xSize-t.ySize)/2;s=t.ySize,n=new M(new S(-a,0),new S(a,0))}else{let a=(t.ySize-t.xSize)/2;s=t.xSize,n=new M(new S(0,-a),new S(0,a))}return s=s+r,s>0?n.stroke(s,wr.ROUND,ae.CW).multiply3(i):null}case 1:if(t.cornerRadius==0){if(e>0)return this.roundRectangle(t,e).multiply3(i);{let n=t.xSize/2+e,s=t.ySize+r;return n>0&&s>0?new M(new S(-n,0),new S(n,0)).stroke(s,wr.BUTT,ae.CW).multiply3(i):null}}else{let n=Math.min(t.xSize,t.ySize)/2,a=(n/100*t.cornerRadius+e)/(n+e),l=t.xSize/2+e,c=t.ySize+r;return ag(new S(-l,0),new S(l,0),c,a,ae.CW).multiply3(i)}case 2:{let n=t.xSize/2+e,s=t.ySize+r;return n>0&&s>0?new M(new S(-n,0),new S(n,0)).stroke(s,wr.BUTT,ae.CW).multiply3(i):null}case 4:if(e!==0&&t.outline!==null){let n=t.outline.bbox();return n.width()+r>0&&n.height()+r>0?XP.zoomPolygon(t.outline,e):null}else return t.outline;default:if(t.xSize+r>0&&t.ySize+r>0){if(t.xSize===t.ySize)return ge.build2([q.build3(S.ORIGIN,0,-360,t.xSize/2+e,t.ySize/2+e)]).multiply3(i);if(t.xSize<t.ySize){let n=t.xSize+r,s=(t.ySize-t.xSize)/2;return new M(new S(0,-s),new S(0,s)).stroke(n,wr.ROUND,ae.CW).multiply3(i)}else{let n=(t.xSize-t.ySize)/2,s=t.ySize+r;return new M(new S(-n,0),new S(n,0)).stroke(s,wr.ROUND,ae.CW).multiply3(i)}}else return null}}roundRectangle(t,e){return ge.build2([new M(new S(-t.xSize/2,t.ySize/2+e),new S(t.xSize/2,t.ySize/2+e)),q.build3(new S(t.xSize/2,t.ySize/2),90,-90,e,e),new M(new S(t.xSize/2+e,t.ySize/2),new S(t.xSize/2+e,-t.ySize/2)),q.build3(new S(t.xSize/2,-t.ySize/2),0,-90,e,e),new M(new S(t.xSize/2,-t.ySize/2-e),new S(-t.xSize/2,-t.ySize/2-e)),q.build3(new S(-t.xSize/2,-t.ySize/2),-90,-90,e,e),new M(new S(-t.xSize/2-e,-t.ySize/2),new S(-t.xSize/2-e,t.ySize/2)),q.build3(new S(-t.xSize/2,t.ySize/2),-180,-90,e,e)])}pIsInLine(t,e,r){return e.start().distance2(t)<=r||e.end().distance2(t)<=r?!0:this.pointToLineSegmentDistanceSimplified2(t,e.start(),e.end())<=r}pointToLineSegmentDistanceSimplified2(t,e,r){let i=c(r,e),n=c(t,e),s=u(i);if(s===0)return u(n)**2;let a=h(n,i)/s,l=Math.max(0,Math.min(a,s));return Math.abs(u(n)**2-l**2);function c(d,p){return new S(d.x-p.x,d.y-p.y)}function h(d,p){return d.x*p.x+d.y*p.y}function u(d){return Math.sqrt(d.x*d.x+d.y*d.y)}}getOutsideShapeWithLine(t,e,r,i){let n=new S(this.hole.offsetX,this.hole.offsetY),s=Qe.rotateD(this.hole.rotation).translate1(n),a=this.hole.size/2+i,l=this.hole.length/2+i,c=[];switch(this.hole.type){case 2:{let u=new S(-l+a,0).multiply3(s),d=new S(l-a,0).multiply3(s),p=(r/2-a)**2;if(r>a*2){c.push(new M(t,e).stroke(r,wr.ROUND,ae.CW));let m=new M(t,e);this.pIsInLine(u,m,p)&&this.pIsInLine(d,m,p)||c.push(new M(u,d).stroke(a*2,wr.ROUND,ae.CW))}else{c.push(new M(u,d).stroke(a*2,wr.ROUND,ae.CW));let m=new M(u,d);this.pIsInLine(t,m,p)&&this.pIsInLine(e,m,p)||c.push(new M(t,e).stroke(r,wr.ROUND,ae.CW))}break}case 1:{let u=new S(-a,0).multiply3(s),d=new S(a,0).multiply3(s),p=(r/2-a)**2;if(r>a*2){c.push(new M(t,e).stroke(r,wr.ROUND,ae.CW));let m=new M(t,e);(!this.pIsInLine(new S(-a,-a).multiply3(s),m,p)||!this.pIsInLine(new S(-a,a).multiply3(s),m,p)||!this.pIsInLine(new S(a,-a).multiply3(s),m,p)||!this.pIsInLine(new S(a,a).multiply3(s),m,p))&&c.push(new M(u,d).stroke(a*2,wr.BUTT,ae.CW))}else{c.push(new M(u,d).stroke(a*2,wr.BUTT,ae.CW));let m=s.getInverseMatrix();t=t.multiply3(m);let g=a-r/2;t.x>g||t.x<-g||t.y>g||t.y<-g?c.push(new M(t,e).stroke(r,wr.ROUND,ae.CW)):(e=e.multiply3(m),(e.x>g||e.x<-g||e.y>g||e.y<-g)&&c.push(new M(e,e).stroke(r,wr.ROUND,ae.CW)))}break}default:{let u=(r/2-a)**2;r>a*2?(c.push(new M(t,e).stroke(r,wr.ROUND,ae.CW)),this.pIsInLine(n,new M(t,e),u)||c.push(ge.build2([q.build3(n,0,-360,a,a)]))):(c.push(ge.build2([q.build3(n,0,-360,a,a)])),t.distance2(n)<=u&&e.distance2(n)<=u||c.push(new M(t,e).stroke(r,wr.ROUND,ae.CW)));break}}let h=Qe.rotateD(this.rotation).translate1(this.location);return c.map(u=>u.multiply3(h))}getOutsideShapeWithRect(t,e,r,i=0){let n=t/2,s=e/2,l=Math.min(t,e)/2,c=n-i,h=s-i,u=[new S(-c,-h),new S(-c,h),new S(c,-h),new S(c,h)];function d(T,I=0){if(I>=i)return T.x<=n-I&&T.x>=-(n-I)&&T.y<=s-I&&T.y>=-(s-I);if(T.x<=n-I&&T.x>=-(n-I)&&T.y<=h-I&&T.y>=-(h-I)||T.x<=c-I&&T.x>=-(c-I)&&T.y<=s-I&&T.y>=-(s-I))return!0;let C=(i-I)**2;return u[0].distance2(T)<C||u[1].distance2(T)<C||u[2].distance2(T)<C||u[3].distance2(T)<C}let p=new S(this.hole.offsetX,this.hole.offsetY),m=Qe.rotateD(this.hole.rotation).translate1(p),g=this.hole.size/2+r,y=this.hole.length/2+r,b=[];switch(this.hole.type){case 2:{let T=new S(-y+g,0).multiply3(m),I=new S(y-g,0).multiply3(m);if(l>g)b.push(ag(new S(-n,0),new S(n,0),e,i/l,ae.CW)),(!d(T,g)||!d(I,g))&&b.push(new M(T,I).stroke(g*2,wr.ROUND,ae.CW));else{b.push(new M(T,I).stroke(g*2,wr.ROUND,ae.CW));let C=new M(T,I),E=(g-i)**2;(!this.pIsInLine(new S(-c,-h),C,E)||!this.pIsInLine(new S(-c,h),C,E)||!this.pIsInLine(new S(c,-h),C,E)||!this.pIsInLine(new S(c,h),C,E))&&b.push(ag(new S(-n,0),new S(n,0),e,i/l,ae.CW))}break}case 1:{let T=new S(-g,0).multiply3(m),I=new S(g,0).multiply3(m);if(l>g)b.push(ag(new S(-n,0),new S(n,0),e,i/l,ae.CW)),(!d(new S(-g,-g).multiply3(m))||!d(new S(-g,g).multiply3(m))||!d(new S(g,-g).multiply3(m))||!d(new S(g,g).multiply3(m)))&&b.push(new M(T,I).stroke(g*2,wr.BUTT,ae.CW));else{let O=function(_){return _=_.multiply3(C),_.x<=E&&_.x>=-E&&_.y<=E&&_.y>=-E};b.push(new M(T,I).stroke(g*2,wr.BUTT,ae.CW));let C=m.getInverseMatrix(),E=g-i;(!O(new S(-c,-h))||!O(new S(-c,h))||!O(new S(c,-h))||!O(new S(c,h)))&&b.push(ag(new S(-n,0),new S(n,0),e,i/l,ae.CW))}break}default:{if(l>g)b.push(ag(new S(-n,0),new S(n,0),e,i/l,ae.CW)),d(p,g)||b.push(ge.build2([q.build3(p,0,-360,g,g)]));else{b.push(ge.build2([q.build3(p,0,-360,g,g)]));let T=(g-i)**2;(new S(-c,-h).distance2(p)>T||new S(-c,h).distance2(p)>T||new S(c,-h).distance2(p)>T||new S(c,h).distance2(p)>T)&&b.push(ag(new S(-n,0),new S(n,0),e,i/l,ae.CW))}break}}let P=Qe.rotateD(this.rotation).translate1(this.location);return b.map(T=>T.multiply3(P))}getOutsideShapeWithCircle(t,e){let r=t**2,i=new S(this.hole.offsetX,this.hole.offsetY),n=Qe.rotateD(this.hole.rotation).translate1(i),s=this.hole.size/2+e,a=this.hole.length/2+e,l=[];switch(this.hole.type){case 2:{let h=new S(-a+s,0).multiply3(n),u=new S(a-s,0).multiply3(n);if(t>s){l.push(ge.build2([q.buildCircle(S.ORIGIN,t,ae.CW)]));let d=(t-s)**2;(S.ORIGIN.distance2(h)>d||S.ORIGIN.distance2(u)>d)&&l.push(new M(h,u).stroke(s*2,wr.ROUND,ae.CW))}else l.push(new M(h,u).stroke(s*2,wr.ROUND,ae.CW)),this.pIsInLine(S.ORIGIN,new M(h,u),(s-t)**2)||l.push(ge.build2([q.buildCircle(S.ORIGIN,t,ae.CW)]));break}case 1:{let h=new S(-s,0).multiply3(n),u=new S(s,0).multiply3(n);if(t>s)l.push(ge.build2([q.buildCircle(S.ORIGIN,t,ae.CW)])),(new S(-s,-s).multiply3(n).distance2(S.ORIGIN)>r||new S(-s,s).multiply3(n).distance2(S.ORIGIN)>r||new S(s,-s).multiply3(n).distance2(S.ORIGIN)>r||new S(s,s).multiply3(n).distance2(S.ORIGIN)>r)&&l.push(new M(h,u).stroke(s*2,wr.BUTT,ae.CW));else{l.push(new M(h,u).stroke(s*2,wr.BUTT,ae.CW));let d=n.getInverseMatrix(),p=S.ORIGIN.multiply3(d),m=s-t;(p.x<-m||p.x>m||p.y<-m||p.y>m)&&l.push(ge.build2([q.buildCircle(S.ORIGIN,t,ae.CW)]))}break}default:{t>s?(l.push(ge.build2([q.buildCircle(S.ORIGIN,t,ae.CW)])),i.distance2(S.ORIGIN)>(t-s)**2&&l.push(ge.build2([q.build3(i,0,-360,s,s)]))):(l.push(ge.build2([q.build3(i,0,-360,s,s)])),i.distance2(S.ORIGIN)>(s-t)**2&&l.push(ge.build2([q.buildCircle(S.ORIGIN,t,ae.CW)])));break}}let c=Qe.rotateD(this.rotation).translate1(this.location);return l.map(h=>h.multiply3(c))}getOutsideShapeWithHole(t,e,r){r==null&&(r=e);let i;if(t.type===4?i=this.shapes.top:t.type===7?i=this.shapes.bot:(t.type===5||t.type===6)&&(i=this.shapes.inner),!i||this.isUnuseLayers(t))return this.isUnuseLayers($r.MULTI)||!this.hasHoleShape()?[]:[this.getHoleShape(r)];if(this.isUnuseLayers($r.MULTI)||!this.hasHoleShape()){let s=this.generate1(i,e);return s?[s]:[]}let n=e*2;switch(i.type){case 3:{let s,a;if(i.xSize>=i.ySize){let l=(i.xSize-i.ySize)/2;a=i.ySize,s=new M(new S(-l,0),new S(l,0))}else{let l=(i.ySize-i.xSize)/2;a=i.xSize,s=new M(new S(0,-l),new S(0,l))}return a=a+n,a>0?this.getOutsideShapeWithLine(s.start(),s.end(),a,r):[this.getHoleShape(r)]}case 1:if(i.cornerRadius==0){if(e>0)return this.getOutsideShapeWithRect(i.xSize+n,i.ySize+n,r,e);{let s=i.xSize+n,a=i.ySize+n;return s>0&&a>0?this.getOutsideShapeWithRect(s,a,r):[this.getHoleShape(r)]}}else{let s=Math.min(i.xSize,i.ySize)/2,l=(s/100*i.cornerRadius+e)/(s+e),c=i.xSize+n,h=i.ySize+n;return this.getOutsideShapeWithRect(c,h,r,l*Math.min(c,h)/2)}case 2:{let s=i.xSize+n,a=i.ySize+n;return s>0&&a>0?this.getOutsideShapeWithRect(s,a,r):[this.getHoleShape(r)]}case 4:if(e!==0&&i.outline!==null){let s=i.outline.bbox();return s.width()+n>0&&s.height()+n>0?[XP.zoomPolygon(i.outline,e),this.getHoleShape(r)]:[this.getHoleShape(r)]}else return[i.outline,this.getHoleShape(r)];default:if(i.xSize+n>0&&i.ySize+n>0){if(i.xSize===i.ySize)return this.getOutsideShapeWithCircle(i.xSize/2+e,r);if(i.xSize<i.ySize){let s=i.xSize+n,a=(i.ySize-i.xSize)/2;return this.getOutsideShapeWithLine(new S(0,-a),new S(0,a),s,r)}else{let s=(i.xSize-i.ySize)/2,a=i.ySize+n;return this.getOutsideShapeWithLine(new S(-s,0),new S(s,0),a,r)}}else return[this.getHoleShape(r)]}}};var $P=class o extends ia{constructor(t,e,r,i,n="",s){super(n,t,e),this.type=r,this.outlines=i,this.__bbox=this._bbox(),this.networkList=s}get isBridgingCopper(){return!!this.networkList}multiply3(t){return new o(this.net,this.layer,this.type,this.outlines.multiply3(t))}bbox(){return this.__bbox}_bbox(){return this.outlines.bbox()}shape(t,e){return this.layer.equals(t)||this.layer.equals($r.MULTI)?this.outlines:null}};var by=class o extends ia{constructor(t,e,r){super(t||"","",$r.MULTI),this.type=e,this.outlines=r,this.__bbox=this._bbox()}multiply3(t){return new o(this.id,this.type,this.outlines.multiply3(t))}bbox(){return this.__bbox}_bbox(){return this.outlines.bbox()}shape(t,e){return this.outlines}};var gl=class o extends ia{constructor(t,e,r,i,n,s,a,l,c){super(t,e,$r.MULTI),this.center=r,this.holeDiameter=Ki.normal(i),this.topPad=n,this.innerPad=Ki.normal(s),this.botPad=a,this.mask=l,this.unuseLayers=c,this.__bbox=this._bbox()}isContains(t){return!this.isUnuseLayers(t)}multiply3(t){return new o(this.id,this.net,this.center.multiply3(t),t.iScale*this.holeDiameter,t.iScale*this.topPad,t.iScale*this.innerPad,t.iScale*this.botPad,this.mask,this.unuseLayers)}bbox(){return this.__bbox}_bbox(){let t=0;for(let e of[this.holeDiameter,this.topPad,this.innerPad,this.botPad])t<e&&(t=e);return t/=2,new ht(this.center.x-t,this.center.x+t,this.center.y-t,this.center.y+t)}shape(t,e){if(this.isUnuseLayers(t))return null;let r=Number.NaN;return t.type!==0?t.equals($r.TOP_COPPER)?r=this.topPad/2+e:t.equals($r.BOT_COPPER)?r=this.botPad/2+e:t.type===5?r=this.innerPad/2+e:t.type===6&&(r=this.innerPad/2+e):this.holeDiameter>0&&(r=this.holeDiameter/2+e),isNaN(r)?null:ge.build2([q.build3(this.center,0,-360,r,r)])}getOutsideShapeWithHole(t,e,r){if(r==null&&(r=e),this.holeDiameter<=0)return this.shape(t,e);if(this.isUnuseLayers(t)){let n=this.holeDiameter/2+r;return ge.build2([q.build3(this.center,0,-360,n,n)])}let i=Number.NaN;return t.equals($r.TOP_COPPER)?i=this.topPad/2+e:t.equals($r.BOT_COPPER)?i=this.botPad/2+e:t.type===5?i=this.innerPad/2+e:t.type===6&&(i=this.innerPad/2+e),i=isNaN(i)?this.holeDiameter/2+r:Math.max(i,this.holeDiameter/2+r),ge.build2([q.build3(this.center,0,-360,i,i)])}isUnuseLayers(t){for(let e of this.unuseLayers)if(e.equals(t))return!0;return!1}};var $Ie=re.getInstance(),CFe;(t=>{let o;(r=>{function e(i){return i instanceof or&&i.type==="Line"}r.isLine=e})(o=t.TypeCheck||(t.TypeCheck={}))})(CFe||(CFe={}));var KIe=class{constructor(){this.isHole=t=>t instanceof et&&ar(t.layerId)||t instanceof Ct;this.isBridgingCopper=t=>{var e;return t instanceof or&&((e=t.component)==null?void 0:e.isBridgingCopper)}}hasNet(t){return!!(t instanceof gt||t instanceof et||t instanceof Ct||t instanceof hn||t instanceof yn||ei.isFill(t)||ei.isLine(t)||ei.isTearDrop(t))}isConstraint(t){return t instanceof or&&t.type==="Constraint Region"}isLine(t){return t instanceof or&&t.type==="Line"}isBoardOutline(t){return t instanceof or&&t.layerId===11}isPour(t){return t instanceof or&&t.type==="Copper Region"}isFill(t){return t instanceof or&&t.type==="Fill Region"}isProhibit(t){return t instanceof or&&t.type==="Prohibited Region"}isSlot(t){return t instanceof or&&t.type==="Slot Region"}isRegion(t){return t instanceof or&&t.type==="Fill Region"}isTearDrop(t){return t instanceof or&&t.type==="TearDrop"}isPcbBoxShape(t){return t instanceof lx||t instanceof Li}isSingleLayerShape(t){return!(ar(t.layerId)||ub(t.layerId))}isPlaneLayer(t){let e=Ze.getInstance().getLayer(t);return e&&mu(e.type)}isUnuseLayer(t){let e=Ze.getInstance().getLayer(t);return e==null||!e.config}isSmdComponent(t){return t.getPads().every(r=>!ar(r.layerId))}getShapeNetDiff(t){if(t.net){let e=$Ie.getNet(t.net);return e==null?null:e.netDifferential}return null}getShape2NetDiff(t,e){if(t.net&&e.net){let r=$Ie.getNet(t.net),i=$Ie.getNet(e.net);if(r&&i&&r.netDifferential==i.netDifferential&&r.netDifferential!=null)return r.netDifferential}}getModelPairHoleStatus(t,e){let r=ei.isHole(t),i=ei.isHole(e);return r&&i?2:r?0:i?1:3}getMultiShapeEffectLayers(t){if(t instanceof Ct)return t.type==1?Ze.getInstance().getAllCopperLayerIds().filter(r=>t.isContains(r)):[12]}hasIntersectionNet(t,e,r=!1){if(r)return!0;if(typeof e=="string")return t.includes(e);for(let i of e)if(t.includes(i))return!0;return!1}getFillOutline(t){let e=t.getOutline();return t instanceof hn&&(t.style==="45grid"||t.style==="90grid")&&(e=e.filter(r=>!(r.primitives.length===1&&r.primitives[0]instanceof M))),e}},ei=new KIe;var ZIe=class{constructor(){this.cacheManager=Zh.getInstance()}clear(){this.cacheManager.clear()}getCache(t,e=t.layerId){let r=this.getCache2(t,e);return r||(t instanceof gt?this.getTrackCache(t):t instanceof or?this.getProfileCache(t):t instanceof hn?this.getCopperOutlineCache(t):t instanceof yn?this.getPlaneZoneCache(t):t instanceof et?this.getPadCache(t,e):t instanceof Ct?this.getViaCache(t,e):t instanceof Bi?this.getComponentCache(t):t instanceof Li||t instanceof Dl?this.getOtherCache(t):null)}getComponentCache(t){let e=this.getCache2(t);if(e==null){let r=t.getMathGraphics();e=this.cacheManager.addCache(t.globalIndex,t.layerId,r,0)}return e}getOtherCache(t){let e=this.getCache2(t);if(e==null){let r=t.getMathGraphics(t.layerId);e=this.cacheManager.addCache(t.globalIndex,t.layerId,r,0)}return e}getPadCache(t,e){let r=this.getCache2(t,e);if(r==null){let i=t.getMathGraphics(e);r=this.cacheManager.addCache(t.globalIndex,e,i,0)}return r}getViaCache(t,e){let r=this.getCache2(t,e);if(r==null){let i=t.getMathGraphics(e);r=this.cacheManager.addCache(t.globalIndex,e,i,0)}return r}getTrackCache(t){let e=this.getCache2(t);return e==null&&(e=this.cacheManager.addCache(t.globalIndex,t.layerId,t.primitive,t.width)),e}getProfileCache(t){let e=this.getCache2(t);if(e)return e;let r=t.type;switch(ei.isBoardOutline(t)&&(r="Board Outline"),r){case"Line":let i=t.getMathGraphics().primitives;return this.cacheManager.addCache(t.globalIndex,t.layerId,i,t.strokeWidth);case"Board Outline":{let s=t.getMathGraphics().primitives;return this.cacheManager.addCache(t.globalIndex,t.layerId,s,0)}case"Constraint Region":case"Prohibited Region":case"Fill Region":case"TearDrop":case"Slot Region":{let s=t.getMathGraphics();return this.cacheManager.addCache(t.globalIndex,t.layerId,s,0)}default:return null}}getPlaneZoneCache(t){let e=this.getCache2(t);return e==null&&(e=this.cacheManager.addCache(t.globalIndex,t.layerId,new Bt(t.pls))),e}getCopperOutlineCache(t){let e=this.getCache2(t);if(e==null){let r=t.getOutline();if(t.isSolid){r=r.map(s=>s.closeEndpoint());let i=new Bt(r),n=t.optimization?t.optimizationWidth:0;e=this.cacheManager.addCache(t.globalIndex,t.layerId,i,n)}else{let i=[];r.forEach(n=>{i.push(...n.primitives)}),e=this.cacheManager.addCache(t.globalIndex,t.layerId,i,t.gridLineWidth)}}return e}getCache2(t,e=t.layerId){return this.cacheManager.getCache(t.globalIndex,e)}},jc=new ZIe;var y3=class{clear(){jc.clear()}isInConstraint(t,e){let r,i;if(t instanceof or){let n=jc.getProfileCache(t);if(!n)return!1;i=n.layerId,r=n.shape}else r=t;if(e instanceof gt)return this.getPtsCtrlPoints(s=>this.primitiveIterator([e.primitive],s)).every(s=>jr.inPolyline(s,r));if(e instanceof or){if(e.type==="Prohibited Region")return!1;let n=[];if(e instanceof Za)n=[e.leftLow,e.rightLow,e.rightUp,e.leftUp];else if(e instanceof yo){let{center:s,radius:a}=e,l=s.add(new S(-1,0).mul(a)),c=s.add(new S(1,0).mul(a)),h=s.add(new S(0,1).mul(a)),u=s.add(new S(0,-1).mul(a));n=[s,l,c,h,u]}else e instanceof ss&&(n=this.getPtsCtrlPoints(e.iteratorChildren.bind(e)),e.type=="TearDrop"&&(n=jc.getProfileCache(e).shape.getPoints(.1)));return n.every(s=>jr.inPolyline(s,r))}else if(e instanceof Ct){let n=e.center;return(i==12||e.isContains(i))&&jr.inPolyline(n,r)}else if(e instanceof et){let n=e.center;return jr.inPolyline(n,r)}else if(e instanceof Li||e instanceof Dl){let n=e.bbox.center();return jr.inPolyline(n,r)}else if(e instanceof Bi){let n=e.position;return jr.inPolyline(n,r)}else if(e instanceof hn||e instanceof yn){if(!e.pls||e.pls.length==0)return!1;let n=e.pls[0].primitives;return this.getPtsCtrlPoints(a=>this.primitiveIterator(n,a)).every(a=>jr.inPolyline(a,r))}return!1}isTrackTouchConstraint(t,e){let r,i;if(t instanceof or){let n=jc.getProfileCache(t);i=n.layerId,r=n.shape}else r=t;return e instanceof gt?this.getPtsCtrlPoints(s=>this.primitiveIterator([e.primitive],s)).some(s=>jr.inPolyline(s,r)):!1}primitiveIterator(t,e){return t.some((r,i)=>e(r,i))}getPtsCtrlPoints(t){let e=[];return t((r,i)=>{if(r instanceof M||r instanceof hs)i==0&&e.push(r instanceof hs?r.start:r.start()),e.push(r instanceof hs?r.end:r.end());else if(r instanceof q||r instanceof Va)if(ne.less(Math.abs(r.sweepAngle),360))i==0&&e.push(r instanceof Va?r.start:r.start()),e.push(r.midPoint),e.push(r instanceof Va?r.end:r.end());else{let n=r.center,s=r.rx,a=n.add(new S(-1,0).mul(s)),l=n.add(new S(1,0).mul(s)),c=n.add(new S(0,1).mul(s)),h=n.add(new S(0,-1).mul(s));e.push(a,l,c,h)}}),e}};function gI(o){return Er(o,(t,e)=>{var n,s;let r=((n=t.component.name.match(/\d+$/))==null?void 0:n[0])||0,i=((s=e.component.name.match(/\d+$/))==null?void 0:s[0])||0;return Number(r)-Number(i)}),o}function zY(o){return o=o.filter(t=>t),Er(o,(t,e)=>{var n,s;let r=((n=t.match(/\d+$/))==null?void 0:n[0])||0,i=((s=e.match(/\d+$/))==null?void 0:s[0])||0;return Number(r)-Number(i)}),o}var iu=class extends fb{constructor(e,r,i){super();this.locked=!1;this.name=e,this.globalIndex=r,this.position=i}get name(){return this._name}set name(e){this._name=e}get position(){return this._position}set position(e){this._position=e}get isEmpty(){return!1}get layerIds(){return this._layerIds}set layerIds(e){e&&(this._layerIds=e)}updateBox(){return null}transform(e){}clone(){return null}toJSON(){let{globalIndex:e}=this;return{globalIndex:e}}};var _b=class extends iu{constructor(t,e,r,i,n,s,a){super(r,t,e),this._obj=i,this._startLayer=n,this._endLayer=s,this.layerIds=a}get obj(){return this._obj}set obj(t){this._obj=t}get startLayer(){return this._startLayer}set startLayer(t){this._startLayer=t}get endLayer(){return this._endLayer}set endLayer(t){this._endLayer=t}get errorType(){return"Blind/Buried Via"}toJSON(){return{...super.toJSON(),errorType:this.errorType,name:this.name,obj:this.obj,startLayer:this.startLayer,endLayer:this.endLayer}}};var O0=class extends iu{constructor(t,e,r,i,n,s,a,l,c,h,u,d,p){super(r,t,e),this._obj1=i,this._obj2=s,this._obj1Type=n,this._obj2Type=a,this._minDistance=l,this._clearance=c,this._errorType=h,this.layerIds=u,this._net=d,this._line=p}get errorType(){return this._errorType}get line(){return this._line}set line(t){this._line=t}get obj1(){return this._obj1}set obj1(t){this._obj1=t}get obj1Type(){return this._obj1Type}set obj1Type(t){this._obj1Type=t}get obj2(){return this._obj2}set obj2(t){this._obj2=t}get obj2Type(){return this._obj2Type}set obj2Type(t){this._obj2Type=t}get minDistance(){return this._minDistance}set minDistance(t){this._minDistance=t}get clearance(){return this._clearance}set clearance(t){this._clearance=t}get net(){return this._net}set net(t){this._net=t}toJSON(){let{globalIndex:t,position:e,name:r,obj1:i,obj1Type:n,obj2:s,obj2Type:a,minDistance:l,clearance:c,errorType:h,layerIds:u,net:d,line:p}=this;return{globalIndex:t,position:e,name:r,obj1:i,obj1Type:n,obj2:s,obj2Type:a,minDistance:l,clearance:c,errorType:h,layerIds:u,net:d,line:p}}};var Py=class extends iu{constructor(t,e,r,i,n,s,a,l){super(r,t,e),this._obj1=i,this._obj1Type=n,this._net=s,this.isFree=a,this._errorType="No Connection",this.layerIds=l}get errorType(){return this._errorType}get obj1(){return this._obj1}set obj1(t){this._obj1=t}get obj1Type(){return this._obj1Type}set obj1Type(t){this._obj1Type=t}get net(){return this._net}set net(t){this._net=t}get errInfo(){return this.isFree?this.obj1Type=="Copper Region(Filled)"||this.obj1Type=="Plane Zone"?"{obj1} is a free copper region":this.obj1Type=="Track"?"{obj1} is a free track":this.obj1Type=="Line"?"{obj1} is a free line":this.obj1Type=="Fill Region"?"{obj1} is a free fill region":"":"{obj1} is disconnected from other objects of the same network"}toJSON(){return{...super.toJSON(),errorType:this.errorType,name:this.name,obj1:this.obj1,obj1Type:this.obj1Type,net:this.net}}};var Ty=class extends iu{constructor(t,e,r,i,n,s,a,l,c,h){super(r,t,e),this._obj1=i,this._obj2=s,this._obj1Type=n,this._obj2Type=a,this._minDistance=l,this._clearance=c,this.layerIds=h}get obj1(){return this._obj1}set obj1(t){this._obj1=t}get obj1Type(){return this._obj1Type}set obj1Type(t){this._obj1Type=t}get obj2(){return this._obj2}set obj2(t){this._obj2=t}get obj2Type(){return this._obj2Type}set obj2Type(t){this._obj2Type=t}get minDistance(){return this._minDistance}set minDistance(t){this._minDistance=t}get clearance(){return this._clearance}set clearance(t){this._clearance=t}get errorType(){return"Differential Pair Error"}toJSON(){let{globalIndex:t,position:e,name:r,obj1:i,obj1Type:n,obj2:s,obj2Type:a,minDistance:l,clearance:c,layerIds:h}=this;return{globalIndex:t,position:e,name:r,obj1:i,obj1Type:n,obj2:s,obj2Type:a,minDistance:l,clearance:c,layerIds:h}}};var Iy=class extends iu{constructor(t,e,r,i,n,s,a,l){super(r,t,e),this.net_P=i,this.net_N=n,this.toleranceScope=s,this.value_P=a,this.value_N=l}get errorType(){return"Differential Pair Error"}toJSON(){let{globalIndex:t,position:e,name:r,net_P:i,net_N:n,toleranceScope:s,value_P:a,value_N:l}=this;return{globalIndex:t,position:e,name:r,net_P:i,net_N:n,toleranceScope:s,value_P:a,value_N:l}}};var Cy=class extends iu{constructor(t,e,r,i,n,s,a,l){super(r,t,e),this.obj=i,this.width=n,this.minWidth=s,this.maxWidth=a,this.layerIds=l}get errorType(){return"Differential Pair Error"}toJSON(){let{globalIndex:t,position:e,name:r,obj:i,width:n,minWidth:s,maxWidth:a,layerIds:l}=this;return{globalIndex:t,position:e,name:r,obj:i,width:n,minWidth:s,maxWidth:a,layerIds:l}}};var yI=class extends iu{constructor(t,e,r,i,n,s,a,l,c,h){super(r,t,e),this._obj1=i,this._obj2=s,this._obj1Type=n,this._obj2Type=a,this._minDistance=l,this._distance=c,this.layerIds=h}get obj1(){return this._obj1}set obj1(t){this._obj1=t}get obj1Type(){return this._obj1Type}set obj1Type(t){this._obj1Type=t}get obj2(){return this._obj2}set obj2(t){this._obj2=t}get obj2Type(){return this._obj2Type}set obj2Type(t){this._obj2Type=t}get minDistance(){return this._minDistance}set minDistance(t){this._minDistance=t}get distance(){return this._distance}set distance(t){this._distance=t}get errorType(){return"Plane Zone"}toJSON(){let{globalIndex:t,position:e,name:r,obj1:i,obj1Type:n,obj2:s,obj2Type:a,minDistance:l,distance:c,layerIds:h}=this;return{globalIndex:t,position:e,name:r,obj1:i,obj1Type:n,obj2:s,obj2Type:a,minDistance:l,clearance:c,layerIds:h}}};var Sy=class extends iu{constructor(t,e,r,i,n,s,a){super(r,t,e),this._net=i,this._netLength=n,this._minNetLength=s,this._maxNetLength=a}get net(){return this._net}set net(t){this._net=t}get netLength(){return this._netLength}set netLength(t){this._netLength=t}get minNetLength(){return this._minNetLength}set minNetLength(t){this._minNetLength=t}get maxNetLength(){return this._maxNetLength}set maxNetLength(t){this._maxNetLength=t}get errorType(){return"Net Length Range"}toJSON(){let{globalIndex:t,position:e,name:r,net:i,netLength:n,minNetLength:s,maxNetLength:a}=this;return{globalIndex:t,position:e,name:r,net:i,netLength:n,minNetLength:s,maxNetLength:a}}};var KP=class extends iu{constructor(t,e,r,i,n,s){super(r,t,e),this._net=i,this._netLengthDiff=n,this._netLengthTolerance=s}get net(){return this._net}set net(t){this._net=t}get netLengthDiff(){return this._netLengthDiff}set netLengthDiff(t){this._netLengthDiff=t}get netLengthTolerance(){return this._netLengthTolerance}set netLengthTolerance(t){this._netLengthTolerance=t}get errorType(){return"Net Length Tolerance"}toJSON(){let{globalIndex:t,position:e,name:r,net:i,netLengthDiff:n,netLengthTolerance:s}=this;return{globalIndex:t,position:e,name:r,net:i,netLengthDiff:n,netLengthTolerance:s}}};var Ey=class extends iu{constructor(t,e,r,i,n,s,a,l,c,h){super(r,t,e),this._obj1=i,this._type=n,this._radius=s,this._minRadius=a,this._maxRadius=l,this.layerIds=c,this._isBlind=h}get type(){return this._type}set type(t){this._type=t}get obj1(){return this._obj1}set obj1(t){this._obj1=t}get radius(){return this._radius}set radius(t){this._radius=t}get minRadius(){return this._minRadius}set minRadius(t){this._minRadius=t}get maxRadius(){return this._maxRadius}set maxRadius(t){this._maxRadius=t}get isBlind(){return this._isBlind}set isBlind(t){this._isBlind=t}get errorType(){return"Via Size"}toJSON(){let{globalIndex:t,position:e,name:r,obj1:i,type:n,radius:s,minRadius:a,maxRadius:l,layerIds:c,isBlind:h}=this;return{globalIndex:t,position:e,name:r,obj1:i,type:n,radius:s,minRadius:a,maxRadius:l,layerIds:c,isBlind:h}}};var Oy=class extends iu{constructor(t,e,r,i,n,s,a,l){super(r,t,e),this._obj1=i,this._width=n,this._minWidth=s,this._maxWidth=a,this.layerIds=l}get obj1(){return this._obj1}set obj1(t){this._obj1=t}get width(){return this._width}set width(t){this._width=t}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get errorType(){return"Track Error"}toJSON(){let{globalIndex:t,position:e,name:r,obj1:i,width:n,minWidth:s,maxWidth:a,layerIds:l}=this;return{globalIndex:t,position:e,name:r,obj1:i,width:n,minWidth:s,maxWidth:a,layerIds:l}}};var b3=class extends iu{constructor(t,e="",r=new S(0,0)){super(e,t,r)}get errorType(){return"Netlist Error"}};var Ore=class{constructor(t,e){this.buffer=[];this.capacity=t,this.cb=e}add(t){this.buffer.push(t),this.buffer.length>=this.capacity&&this.flush()}flush(){this.buffer.length>0&&(this.cb(this.buffer),this.buffer.length=0)}};var vb=class extends iu{constructor(t,e,r,i,n,s,a,l,c,h,u,d){super(r,t,e),this._obj1=i,this._obj2=s,this._obj1Type=n,this._obj2Type=a,this._minDistance=l,this._clearance=c,this._path=d,this._errorType="Creepage Distance",this.layerIds=u}get errorType(){return this._errorType}get obj1(){return this._obj1}set obj1(t){this._obj1=t}get obj1Type(){return this._obj1Type}set obj1Type(t){this._obj1Type=t}get obj2(){return this._obj2}set obj2(t){this._obj2=t}get obj2Type(){return this._obj2Type}set obj2Type(t){this._obj2Type=t}get minDistance(){return this._minDistance}set minDistance(t){this._minDistance=t}get clearance(){return this._clearance}set clearance(t){this._clearance=t}get path(){return this._path}set path(t){this._path=t}toJSON(){let{globalIndex:t,position:e,name:r,obj1:i,obj1Type:n,obj2:s,obj2Type:a,minDistance:l,clearance:c,errorType:h,layerIds:u,path:d}=this;return{globalIndex:t,position:e,name:r,obj1:i,obj1Type:n,obj2:s,obj2Type:a,minDistance:l,clearance:c,errorType:h,layerIds:u,path:d}}};var jM=class jM extends Ei{constructor(){super();this.errorRecordBuffer=null;this.id=0;this._id2ClearanceMap=new Map;this._id2InnerMap=new Map;this._id2TrackMap=new Map;this._id2DiffPairWidthMap=new Map;this._id2DiffPairGapMap=new Map;this._id2DiffPairLengthMap=new Map;this._id2BlindMap=new Map;this._id2NetLengthMap=new Map;this._id2NetLengthToleranceMap=new Map;this._id2RadiusMap=new Map;this._id2ConnectMap=new Map;this._id2NetlistMap=new Map;this._id2CreepageMap=new Map}static getInstance(){return jM.manager==null&&(jM.manager=new jM),jM.manager}initializeErrorRecordBuffer(){this.errorRecordBuffer=new Ore(3e4,e=>{self.workerBus.publish("syncFromContentModel",JSON.stringify(e))})}clearErrorRecordBuffer(){var e;(e=this.errorRecordBuffer)==null||e.flush(),this.errorRecordBuffer=null}get idMapClearance(){return this._id2ClearanceMap}get idMapInner(){return this._id2InnerMap}get idMapTrack(){return this._id2TrackMap}get idMapDiffPairWidth(){return this._id2DiffPairWidthMap}get idMapDiffPairGap(){return this._id2DiffPairGapMap}get idMapDiffPairLength(){return this._id2DiffPairLengthMap}get idMapBlind(){return this._id2BlindMap}get idMapNetLength(){return this._id2NetLengthMap}get idMapNetLengthTolerance(){return this._id2NetLengthToleranceMap}get idMapRadius(){return this._id2RadiusMap}get idMapConnect(){return this._id2ConnectMap}get idMapNetlist(){return this._id2NetlistMap}get idMapCreepage(){return this._id2CreepageMap}getAllClearance(){let e=new Set;for(let[,r]of this.idMapClearance)r.forEach(i=>{e.add(i)});return e}getAllCreepage(){let e=new Set;for(let[,r]of this.idMapCreepage)r.forEach(i=>{e.add(i)});return e}deleteAllError(){this.map.clear(),this._id2ClearanceMap.clear(),this._id2InnerMap.clear(),this._id2TrackMap.clear(),this._id2DiffPairWidthMap.clear(),this._id2DiffPairGapMap.clear(),this._id2DiffPairLengthMap.clear(),this._id2BlindMap.clear(),this._id2NetLengthMap.clear(),this._id2RadiusMap.clear(),this._id2ConnectMap.clear(),this._id2NetlistMap.clear(),this._id2CreepageMap.clear()}getCreepageError(e,r){let i=this.idMapCreepage.get(e);if(i==null)return null;for(let n of i)if(n.obj1==e&&n.obj2==r||n.obj2==e&&n.obj1==r)return n;return null}hasSafeErrorIgnoreCopper(e){let r=this.idMapClearance.get(e);if(r==null)return!1;for(let i of r)if(!this.isCopperOrPlane(i.obj1)&&!this.isCopperOrPlane(i.obj2))return!0;return!1}getClearanceError(e,r){let i=this.idMapClearance.get(e);if(i==null)return null;for(let n of i)if(n.obj1==e&&n.obj2==r||n.obj2==e&&n.obj1==r)return n;return null}hasDiffLengthError(e){return this.idMapDiffPairLength.has(e)}getDiffPairGapError(e,r){let i=this.idMapDiffPairGap.get(e);if(i==null)return null;for(let n of i)if(n.obj1==e&&n.obj2==r||n.obj2==e&&n.obj1==r)return n;return null}isCopperOrPlane(e){return!!(qo.getInstance().getItem(e)||Xo.getInstance().getItem(e))}addError(e){if(this.map.set(e.globalIndex,e),e instanceof O0){let{obj1:r,obj2:i}=e;this.mapAddSet(this._id2ClearanceMap,r,e),this.mapAddSet(this._id2ClearanceMap,i,e)}else if(e instanceof yI){let{obj1:r,obj2:i}=e;this.mapAddSet(this._id2InnerMap,r,e),this.mapAddSet(this._id2InnerMap,i,e)}else if(e instanceof Sy)this.idMapNetLength.set(e.net,e);else if(e instanceof KP)this.idMapNetLengthTolerance.set(e.net,e);else if(e instanceof Oy)this.idMapTrack.set(e.obj1,e);else if(e instanceof Cy)this.idMapDiffPairWidth.set(e.obj,e);else if(e instanceof Ty){let{obj1:r,obj2:i}=e;this.mapAddSet(this._id2DiffPairGapMap,r,e),this.mapAddSet(this._id2DiffPairGapMap,i,e)}else if(e instanceof Iy)this.idMapDiffPairLength.set(e.net_P,e),this.idMapDiffPairLength.set(e.net_N,e);else if(e instanceof _b)this.idMapBlind.set(e.obj,e);else if(e instanceof Ey)this.idMapRadius.set(e.obj1,e);else if(e instanceof Py){let r=e.obj1Type=="Bridging Copper"?e.globalIndex:this.getConnectMapId(e);this.idMapConnect.set(r,e)}else if(e instanceof b3)this.idMapNetlist.set(e.globalIndex,e);else if(e instanceof vb){let{obj1:r,obj2:i}=e;this.mapAddSet(this._id2CreepageMap,r,e),this.mapAddSet(this._id2CreepageMap,i,e)}}deleteError(e){if(e==null||!this.map.has(e.globalIndex))return e;if(this.map.delete(e.globalIndex),e instanceof O0){let{obj1:r,obj2:i}=e;this.mapDeleteSet(this._id2ClearanceMap,r,e),this.mapDeleteSet(this._id2ClearanceMap,i,e)}else if(e instanceof yI){let{obj1:r,obj2:i}=e;this.mapDeleteSet(this._id2InnerMap,r,e),this.mapDeleteSet(this._id2InnerMap,i,e)}else if(e instanceof Sy)this.idMapNetLength.delete(e.net);else if(e instanceof Oy)this.idMapTrack.delete(e.obj1);else if(e instanceof Cy)this.idMapDiffPairWidth.delete(e.obj);else if(e instanceof Ty){let{obj1:r,obj2:i}=e;this.mapDeleteSet(this._id2DiffPairGapMap,r,e),this.mapDeleteSet(this._id2DiffPairGapMap,i,e)}else if(e instanceof Iy)this.idMapDiffPairLength.delete(e.net_P),this.idMapDiffPairLength.delete(e.net_N);else if(e instanceof _b)this.idMapBlind.delete(e.obj);else if(e instanceof Ey)this.idMapRadius.delete(e.obj1);else if(e instanceof Py){let r=e.obj1Type=="Bridging Copper"?e.globalIndex:this.getConnectMapId(e);this.idMapConnect.delete(r)}else if(e instanceof b3)this.idMapNetlist.delete(e.globalIndex);else if(e instanceof vb){let{obj1:r,obj2:i}=e;this.mapDeleteSet(this._id2CreepageMap,r,e),this.mapDeleteSet(this._id2CreepageMap,i,e)}return e}getConnectMapId(e){return e.obj1||e.globalIndex}createId(){return"err"+this.id++}addClearanceError(e,r,i,n,s,a,l,c,h,u="Safe Spacing",d,p){let m=this.createId(),g=new O0(m,e,r,i,n,s,a,l,c,u,h,d,p);return this.addError(g),g}deleteClearanceError(e){let r=this.idMapClearance,i=new Set,n=r.get(e);if(n!=null){for(let s of n)this.deleteError(s),i.add(s);r.delete(e)}return Array.from(i)}addCreepageError(e,r,i,n,s,a,l,c,h="Creepage Distance",u,d){let p=this.createId(),m=new vb(p,e,r,i,n,s,a,l,c,h,u,d);return this.addError(m),m}deleteCreepageError(e){let r=this.idMapCreepage,i=new Set,n=this.idMapCreepage.get(e);if(n!=null){for(let s of n)this.deleteError(s),i.add(s);r.delete(e)}return Array.from(i)}addInnerError(e,r,i,n,s,a,l,c,h){let u=this.createId(),d=new yI(u,e,r,i,n,s,a,l,c,h);return this.addError(d),d}deleteInnerError(e){let r=this.idMapInner,i=new Set,n=r.get(e);if(n!=null){for(let s of n)this.deleteError(s),i.add(s);r.delete(e)}return Array.from(i)}addNetLengthError(e,r,i,n,s,a){let l=this.createId(),c=new Sy(l,e,r,i,n,s,a),h=this.idMapNetLength.get(i);return h&&this.map.delete(h.globalIndex),this.addError(c),c}deleteNetLengthError(e){let r=this.idMapNetLength.get(e);return this.deleteError(r)}addNetLengthToleranceError(e,r,i,n,s){let a=this.createId(),l=new KP(a,e,r,i,n,s),c=this.idMapNetLengthTolerance.get(i);return c&&this.map.delete(c.globalIndex),this.addError(l),l}deleteNetLengthToleranceError(e){let r=this.idMapNetLengthTolerance.get(e);return this.deleteError(r)}addTrackWidthError(e,r,i,n,s,a,l){let c=this.createId(),h=new Oy(c,e,r,i,n,s,a,l);return this.addError(h),h}deleteTrackWidthError(e){let r=this.idMapTrack.get(e);return this.deleteError(r)}addDiffPairTrackWidthError(e,r,i,n,s,a,l){let c=this.createId(),h=new Cy(c,e,r,i,n,s,a,l);return this.addError(h),h}deleteDiffPairTrackWidthError(e){let r=this.idMapDiffPairWidth.get(e);return this.deleteError(r)}addDiffPairTrackGapError(e,r,i,n,s,a,l,c,h){let u=this.createId(),d=new Ty(u,e,r,i,n,s,a,l,c,h);return this.addError(d),d}deleteDiffPairTrackGapError(e){let r=this.idMapDiffPairGap,i=new Set,n=r.get(e);if(n!=null){for(let s of n)this.deleteError(s),i.add(s);r.delete(e)}return Array.from(i)}addDiffPairTrackLengthError(e,r,i,n,s,a,l){let c=this.createId(),h=new Iy(c,e,r,i,n,s,a,l);return this.addError(h),h}deleteDiffPairTrackLengthError(e){let r=this.idMapDiffPairLength.get(e);return this.deleteError(r)}addBlindError(e,r,i,n,s,a){let l=this.createId(),c=new _b(l,e,r,i,n,s,a);return this.addError(c),c}deleteBlindError(e){let r=this.idMapBlind.get(e);return this.deleteError(r)}addRadiusError(e,r,i,n,s,a,l,c,h){let u=this.createId(),d=new Ey(u,e,r,i,n,s,a,l,c,h);return this.addError(d),d}deleteRadiusError(e){let r=this.idMapRadius.get(e);return this.deleteError(r)}addConnectError(e,r,i,n,s,a,l){let c=this.createId(),h=new Py(c,e,r,i,n,s,a,l);return this.addError(h),h}deleteConnectError(e){let r=this.idMapConnect.get(e);return this.deleteError(r)}addNetlistError(){let e=this.createId(),r=new b3(e),i=this.idMapNetlist.get(e);return i&&this.map.delete(i.globalIndex),this.addError(r),r}deleteNetlistError(e){let r=this.idMapNetlist.get(e);return this.deleteError(r)}mapAddSet(e,r,i){let n=e.get(r);n||(n=new Set,e.set(r,n)),n.add(i)}mapDeleteSet(e,r,i){let n=e.get(r);n&&(n.delete(i),n.size===0&&e.delete(r))}};jM.manager=null;var ci=jM;var Are=class{};var ZB=class extends Are{constructor(){super(...arguments);this.coppers=new Set;this.thermals=new Set}addThermalCopper(e){this.thermals.add(e)}removeThermalCopper(e){this.coppers.delete(e)}addFilterCopper(e){this.coppers.add(e)}filter(e){return this.thermals.has(e)&&this.coppers.has(e)}};var qM=class{constructor(t){this._item=t,this._bbox=this.buildBBox()}set item(t){this._item=t}get item(){return this._item}get layerId(){return this.item.isEmpty?1:this.item.layerId}update(){this._bbox=this.buildBBox()}buildBBox(){return this._item.buildBBox()}bbox(){return this._bbox}},JB=class{constructor(t){this.layerRTreeMap={};this.capacity=t}searchInside(t,e,r){var n;let i=new Array;for(let s in this.layerRTreeMap){if(e&&!e(+s))continue;let a=(n=this.layerRTreeMap[s])==null?void 0:n.searchInside(t);for(let l of a)i.push(l.item)}return i}search4Types(t,e,r){let i=this.search(t,r),n=new Set(e),s=new Array;for(let a of i)n.has(a.modelType)&&s.push(a);return s}searchByType(t,e){throw new Error("Method not implemented.")}searchByTypes(t,e){throw new Error("Method not implemented.")}searchByLayer(t,e){return this.search(t,r=>e!=null?r==e:!0)}searchByLayers(t,e){throw new Error("Method not implemented.")}flushDeleteWhenNeed(){this.flushWhenNeed()}get items(){let t=Object.values(this.layerRTreeMap),e=new Set;for(let r of t)xe.addAllSet(e,r.items);return e}get changeList(){let t=Object.values(this.layerRTreeMap),e=new Set;for(let r of t)xe.addAllSet(e,r.changeList);return e}get deadList(){let t=Object.values(this.layerRTreeMap),e=new Set;for(let r of t)xe.addAllSet(e,r.deadList);return e}getLayerKeys(){return Object.keys(this.layerRTreeMap).map(t=>Number(t))}size(){let t=Object.values(this.layerRTreeMap),e=0;for(let r of t)e+=r.items.size;return e}search(t,e){var i;let r=new Array;for(let n in this.layerRTreeMap){let s=(i=this.layerRTreeMap[n])==null?void 0:i.search(t);for(let a of s)e&&!e(+n,a.item.modelType)||r.push(a.item)}return r}insert(t){this.getRtree(t).insert(t)}getRtree(t){let e=this.layerRTreeMap[t.layerId];return e==null&&(e=new $u(this.capacity),this.layerRTreeMap[t.layerId]=e),e}remove(t){this.getRtree(t).remove(t)}bbox(){let t=new _e,e=Object.values(this.layerRTreeMap);for(let r of e)r.bbox()!=null&&t.ext1(r.bbox());return t.valid()?t.build1():null}recycle(){for(let t in this.layerRTreeMap)this.layerRTreeMap[t].recycle();this.layerRTreeMap={}}flushWhenNeed(){let t=Object.values(this.layerRTreeMap);for(let e of t)e.flushWhenNeed()}};var ZP=class{constructor(t=!1){this.shapes=[];this.clear=t,this.fillAllFilter()}fillAllFilter(){this.getVias(this.shapes),this.getTracks(this.shapes),this.getTexts(this.shapes),this.getImages(this.shapes),this.getPads(this.shapes),this.getProfiles(this.shapes),this.getComponents(this.shapes),this.getCoppers(this.shapes),this.getPlanes(this.shapes)}getVias(t){let e=bn.getInstance().getAllItem();for(let r=0;r<e.length;r++)t.push(e[r]);this.clear&&bn.getInstance().recycle()}getTracks(t){Sn.getInstance().getAllItem().forEach(r=>{r.length>1e-8&&t.push(r)}),this.clear&&Sn.getInstance().recycle()}getTexts(t){io.getInstance().getAllItem().forEach(r=>{let i=r.box;this.checkLayer(r.layerId)&&(!i||i.height==0||i.width==0||t.push(r))}),this.clear&&io.getInstance().recycle()}getImages(t){Hs.getInstance().getAllItem().forEach(r=>{this.checkLayer(r.layerId)&&t.push(r)}),this.clear&&Hs.getInstance().recycle()}getPads(t){let e=jn.getInstance().getAllItem();for(let r=0;r<e.length;r++)t.push(e[r]);this.clear&&jn.getInstance().recycle()}getProfiles(t){let e=Fi.getInstance().getAllItem(),r=Qi.getInstance().getAllItem(),i=vi.getInstance().getAllItem();for(let n of e)this.checkProfile(n)&&t.push(n);for(let n of r)this.checkProfile(n)&&t.push(n);for(let n of i)this.checkProfile(n)&&t.push(n);this.clear&&(Fi.getInstance().recycle(),Qi.getInstance().recycle(),vi.getInstance().recycle())}checkProfile(t){if(t.type=="Partition"||!this.checkLayer(t.layerId))return!1;switch(t.type){case"Line":case"Prohibited Region":case"Fill Region":case"Board Outline":case"Slot Region":case"TearDrop":return!0}return!1}getComponents(t){let e=Ms.getInstance().getAllItem();for(let r=0;r<e.length;r++)t.push(e[r]);this.clear&&Ms.getInstance().recycle()}getPlanes(t){let e=Xo.getInstance().getAllItem();for(let r=0;r<e.length;r++)t.push(e[r]);this.clear&&Xo.getInstance().recycle()}getCoppers(t){let e=qo.getInstance().getAllItem();for(let r=0;r<e.length;r++)t.push(e[r]);this.clear&&qo.getInstance().recycle()}checkLayer(t){let e=Ze.getInstance().getLayer(t);return e?!!(e.config&&(ar(t)||ns(e==null?void 0:e.type)||mu(e==null?void 0:e.type)||t==11)):!1}};function xb(o){let t=new JB(10);o==null&&(o=new ZP().shapes);for(let e of o)(Ud(e.layerId)||e.layerId==11)&&t.insert(new qM(e));return t}var ef=class{constructor(t){this.pcbTree=t}bbox(){return this.pcbTree.bbox()}search(t,e){return this.pcbTree.search(t,e)}searchByLayer(t,e){return this.pcbTree.searchByLayer(t,e)}search4Types(t,e,r){return this.pcbTree.search4Types(t,e,r)}insert(t){this.pcbTree.insert(t)}recycle(){this.pcbTree.recycle()}};var aA=class{constructor(t){this.map=new Map;this.cb=t}get(t,e){let r=this.map.get(t);if(r!==void 0)return r;let i=e?e(t):this.cb(t);return this.map.set(t,i),i}};var JIe=class{constructor(){this.clearance=new aA(t=>re.getInstance().getItemMaxClearance(t))}clear(){this.clearance.map.clear()}getShapeMaxClearance(t){let e=l1(t);return ei.isHole(t)?Math.max(this.clearance.get(e),this.clearance.get(12)):this.clearance.get(e)}},QIe=class{constructor(){this.effectiveRules={safeSpacing:new Set,diffPair:new Set};this.ruleManager=re.getInstance();this.clearance=new aA(t=>{let[e,r,i]=t.split(",");return re.getInstance().getModelPairMaxClearance(this.effectiveRules,Number(e),Number(r),Number(i))})}initEffectiveRules(){let t=this.createNameModelMap(this.ruleManager.getAllSafeSpacing(),r=>r.isDefault?"default":r.name),e=this.createNameModelMap(this.ruleManager.getAllDifferentialPhysics(),r=>r.isDefault?"default":r.name);this.collectUsedRules(t,e)}createNameModelMap(t,e){let r=new Map;for(let i of t){let n=e(i);n&&r.set(n,i)}return r}collectUsedRules(t,e){let r=(i,n=!1)=>{i&&t.has(i)&&this.effectiveRules.safeSpacing.add(t.get(i)),i&&n&&e.has(i)&&this.effectiveRules.diffPair.add(e.get(i))};this.ruleManager.getAllRegions().forEach(i=>{r(i.safeClearance),r(i.safeCopperPlane),r(i.safeInnerPlane),r(i.diff,!0)}),this.ruleManager.betweenNetRule.rule.forEach(i=>{r(i.ruleName),r(i.safeCopperPlane),r(i.safeInnerPlane)}),this.ruleManager.getAllNets().forEach(i=>{r(i.safeSpacing),r(i.safeCopperPlane),r(i.safeInnerPlane),r(i.differentialPhysics,!0)}),this.ruleManager.getAllNetClass().forEach(i=>{r(i.safeSpacing),r(i.safeCopperPlane),r(i.safeInnerPlane),r(i.differentialPhysics,!0)})}clear(){this.clearance.map.clear(),this.effectiveRules.safeSpacing.clear(),this.effectiveRules.diffPair.clear()}getShapePairMaxClearance(t,e,r){let i=r===12||r===11?void 0:r;t=[13,14].includes(t)?7:t,e=[13,14].includes(e)?7:e;let n=i?`${t},${e},${i}`:`${t},${e}`;return this.clearance.get(n)}},_re=new JIe,lA=new QIe;function P3(o,t){return o=(o|o<<8)&16711935,o=(o|o<<4)&252645135,o=(o|o<<2)&858993459,o=(o|o<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,o|t<<1}var Hf=class Hf{constructor(t,e){this.x=t,this.y=e}normalized(){}};Hf.NULL=new Hf(0,0),Hf.RIGHT=new Hf(1,0),Hf.RIGHT45=new Hf(1,1),Hf.UP=new Hf(0,1),Hf.UP45=new Hf(-1,1),Hf.LEFT=new Hf(-1,0),Hf.LEFT45=new Hf(-1,-1),Hf.DOWN=new Hf(0,-1),Hf.DOWN45=new Hf(1,-1);var JP=Hf;var Rp=class extends JP{constructor(t,e){super(t,e)}conver(){return new S(this.x,this.y)}};var dS=class{constructor(t,e){this.point=t,this.direction=e;let{x:r,y:i}=e;this.a=i,this.b=-r,this.c=-(this.a*t.x+this.b*t.y)}inter(t){let{a:e,b:r,c:i}=t;return new Rp((i*this.b-this.c*r)/(this.a*r-e*this.b),(this.c*e-i*this.a)/(this.a*r-e*this.b))}};var h1=class{constructor(t,e,r,i,n){this.start=t,this.middle=e,this.end=r,this.startPoint=i,this.endPoint=n}get _startPoint(){return this.startPoint===void 0&&(this.startPoint=this.start.inter(this.middle)),this.startPoint}get _endPoint(){return this.endPoint===void 0&&(this.endPoint=this.end.inter(this.middle)),this.endPoint}conver(){return new M(this._startPoint.conver(),this._endPoint.conver())}};var bI=class o extends ht{constructor(t,e,r,i,n,s,a,l){super(t,e,r,i),this.left_lower_x=n,this.right_lower_x=s,this.left_upper_x=a,this.right_upper_x=l}diff(t){throw new Error("Method not implemented.")}isIntersectOctagon(t){return!(this.minX>t.maxX||this.maxX<t.minX||this.minY>t.maxY||this.maxY<t.minY||this.left_lower_x>t.right_upper_x||this.right_upper_x<t.left_lower_x||this.right_lower_x<t.left_upper_x||this.left_upper_x>t.right_lower_x)}inter(t){let e=Math.max(this.minX,t.minX),r=Math.min(this.maxX,t.maxX),i=Math.max(this.minY,t.minY),n=Math.min(this.maxY,t.maxY),s=Math.max(this.left_lower_x,t.left_lower_x),a=Math.min(this.right_lower_x,t.right_lower_x),l=Math.max(this.left_upper_x,t.left_upper_x),c=Math.min(this.right_upper_x,t.right_upper_x);return new o(e,r,i,n,s,a,l,c)}union(t){let e=Math.min(this.minX,t.minX),r=Math.max(this.maxX,t.maxX),i=Math.min(this.minY,t.minY),n=Math.max(this.maxY,t.maxY),s=Math.min(this.left_lower_x,t.left_lower_x),a=Math.max(this.right_lower_x,t.right_lower_x),l=Math.min(this.left_upper_x,t.left_upper_x),c=Math.max(this.right_upper_x,t.right_upper_x);return new o(e,r,i,n,s,a,l,c)}isInside(t){return r(this.minX,t.minX)&&e(this.maxX,t.maxX)&&r(this.minY,t.minY)&&e(this.maxY,t.maxY)&&(t.left_lower_x==null||r(this.left_lower_x,t.left_lower_x))&&(t.right_upper_x==null||e(this.right_upper_x,t.right_upper_x))&&(t.left_upper_x==null||r(this.left_upper_x,t.left_upper_x))&&(t.right_lower_x==null||e(this.right_lower_x,t.right_lower_x));function e(i,n){return i<=n}function r(i,n){return i>=n}}outline(){return ge.build7(this.get().map(t=>t.conver()))}get(t=!0){if(t){if(this.left_lower_x===null&&this.right_lower_x===null&&this.left_upper_x===null&&this.right_upper_x===null)return[new h1(void 0,void 0,void 0,new Rp(this.minX,0),new Rp(0,this.minY)),new h1(void 0,void 0,void 0,new Rp(this.minX,0),new Rp(0,this.maxY)),new h1(void 0,void 0,void 0,new Rp(this.maxX,0),new Rp(0,this.minY)),new h1(void 0,void 0,void 0,new Rp(this.maxX,0),new Rp(0,this.maxY))];{let e=new dS(new Rp(this.minX,0),JP.UP),r=new dS(new Rp(this.maxX,0),JP.DOWN),i=new dS(new Rp(0,this.minY),JP.LEFT),n=new dS(new Rp(0,this.maxY),JP.RIGHT),s=new dS(new Rp(this.left_lower_x,0),JP.UP45),a=new dS(new Rp(this.right_lower_x,0),JP.LEFT45),l=new dS(new Rp(this.left_upper_x,0),JP.RIGHT45),c=new dS(new Rp(this.right_upper_x,0),JP.DOWN45),h=new h1(s,e,l),u=new h1(c,r,a),d=new h1(a,i,s),p=new h1(l,n,c),m=new h1(i,s,e),g=new h1(r,a,i),y=new h1(e,l,n),b=new h1(n,c,r);return[h,u,d,p,m,g,y,b]}}}equals(t){return t instanceof o?!!(ne.eq(this.minX,t.minX)&&ne.eq(this.minY,t.minY)&&ne.eq(this.maxX,t.maxX)&&ne.eq(this.maxY,t.maxY)&&ne.eq(this.left_lower_x,t.left_lower_x)&&ne.eq(this.right_lower_x,t.right_lower_x)&&ne.eq(this.left_upper_x,t.left_upper_x)&&ne.eq(this.right_upper_x,t.right_upper_x)):!1}static byBBox(t){return new o(t.minX,t.maxX,t.minY,t.maxY,t.minY+t.minX,t.maxX-t.minY,t.minX-t.maxY,t.maxY+t.maxX)}static byLine(t,e){let r=t.start(),i=t.end(),n=e/2,s=r.x-i.x,a,l;s<0?(a=r,l=i):(a=i,l=r);let c=a.x,h=a.y,u=l.x,d=l.y,p=h-d,m=c-n,g=u+n,y=n,b=-n;if(p<0?(b+=h,y+=d):(b+=d,y+=h),s===0||p===0)return new o(m,g,b,y,b+m,g-b,m-y,y+g);{let P,T,I,C,E,O,_,x,v;return p<0?(P=1,T=1,_=Math.sqrt(n*n*(P*P+T*T)),x=P*c+T*h,v=P*u+T*d,I=Math.min(_+x,-_+x),C=Math.max(_+v,-_+v),P=-1,T=1,_=Math.sqrt(n*n*(P*P+T*T)),x=P*c+T*h,v=P*u+T*d,(d-h)/(u-c)>1?(E=Math.min(-_-v,_-v),O=Math.max(-_-x,_-x)):(E=Math.min(-_-x,_-x),O=Math.max(-_-v,_-v))):(P=-1,T=1,_=Math.sqrt(n*n*(P*P+T*T)),x=P*c+T*h,v=P*u+T*d,E=Math.min(-_-x,_-x),O=Math.max(-_-v,_-v),P=1,T=1,_=Math.sqrt(n*n*(P*P+T*T)),x=P*c+T*h,v=P*u+T*d,(d-h)/(u-c)>-1?(I=Math.min(_+x,-_+x),C=Math.max(_+v,-_+v)):(I=Math.min(_+v,-_+v),C=Math.max(_+x,-_+x))),new o(m,g,b,y,I,O,E,C)}}};var eCe=class{converBBox(t){return t instanceof bI?t:new bI(t.minX,t.maxX,t.minY,t.maxY,t.minY+t.minX,t.maxX-t.minY,t.minX-t.maxY,t.maxY+t.maxX)}trackToOctagon(t,e,r){let i=r/2,n=t.x-e.x,s,a;n<0?(s=t,a=e):(s=e,a=t);let l=s.x,c=s.y,h=a.x,u=a.y,d=c-u,p=l-i,m=h+i,g=i,y=-i;if(d<0?(y+=c,g+=u):(y+=u,g+=c),n===0||d===0)return new bI(p,m,y,g,y+p,m-y,p-g,g+m);{let b,P,T,I,C,E,O,_,x;return d<0?(b=1,P=1,O=Math.sqrt(i*i*(b*b+P*P)),_=b*l+P*c,x=b*h+P*u,T=Math.min(O+_,-O+_),I=Math.max(O+x,-O+x),b=-1,P=1,O=Math.sqrt(i*i*(b*b+P*P)),_=b*l+P*c,x=b*h+P*u,(u-c)/(h-l)>1?(C=Math.min(-O-x,O-x),E=Math.max(-O-_,O-_)):(C=Math.min(-O-_,O-_),E=Math.max(-O-x,O-x))):(b=-1,P=1,O=Math.sqrt(i*i*(b*b+P*P)),_=b*l+P*c,x=b*h+P*u,C=Math.min(-O-_,O-_),E=Math.max(-O-x,O-x),b=1,P=1,O=Math.sqrt(i*i*(b*b+P*P)),_=b*l+P*c,x=b*h+P*u,(u-c)/(h-l)>-1?(T=Math.min(O+_,-O+_),I=Math.max(O+x,-O+x)):(T=Math.min(O+x,-O+x),I=Math.max(O+_,-O+_))),new bI(p,m,y,g,T,E,C,I)}}trackMortonCode(t,e,r){return P3((t.x+e.x)/2,(t.y+e.y)/2)}},Lc=new eCe;var tCe=class{constructor(t){this.item=t,this._bbox=this.item.buildBBox()}bbox(){return this._bbox}};var vre=class{constructor(t,e=!1){this.rtree=new $u(t)}get items(){return this.rtree.items}insert(t){this.rtree.insert(new tCe(t))}search(t,e){this.rtree.search2Cb(t,r=>e(r.item))}searchItems(t){return this.rtree.search(t)}recycle(){this.rtree.recycle(),this.rtree=null}};var xre=class{constructor(){this.constraint=[];this.singleLayerMap=new Map;this.multiLayerMap=new Map;this.groupTypes=new Set(["Track","ArcTrack","Pad","Via","Image","Picture","Polygon","Rect","Circle","Copper","Inner","Component","Line","Arc","TearDrop","Text"])}get size(){let t=0;for(let[,e]of this.singleLayerMap)for(let[,r]of e)t+=r.items.size;for(let[,e]of this.multiLayerMap)for(let[,r]of e)t+=r.items.size;return t}iterateMap(t,e,r){if(r!==void 0){let i=t.get(r);if(!i)return;for(let[n,s]of i)e(s,n)}else for(let[i,n]of t)for(let[s,a]of n)e(a,s,i)}itorTree(t,e,r){switch(t){case 1:this.iterateMap(this.singleLayerMap,e,r);break;case 2:this.iterateMap(this.multiLayerMap,e,r);break;case 3:this.iterateMap(this.singleLayerMap,e,r),this.iterateMap(this.multiLayerMap,e,r);break;default:throw new Error(`Unsupported status: ${t}`)}}getNodeGroupType(t){let e=t.modelType;if(this.groupTypes.has(e))return l1(t)}getNodeGroup(t){let e=this.getNodeGroupType(t),r=t.layerId,i=r===12||r===11,n=i?this.multiLayerMap.get(e):this.singleLayerMap.get(e),s=n&&n.get(r);return s||(s=new vre(15),n||(n=new Map,i?this.multiLayerMap.set(e,n):this.singleLayerMap.set(e,n)),n.set(r,s)),s}insert(t){t instanceof or&&t.type==="Constraint Region"?this.constraint.push(t):this.getNodeGroup(t).insert(t)}search(t,e,r,i){this.itorTree(t,(n,s,a)=>{i&&!i(s,a)||n.search(e,l=>{l.isEmpty||r(l)})})}searchItems(t,e,r){let i=new Set;return this.itorTree(t,(n,s,a)=>{if(!(r&&!r(s,a)))for(let l of n.searchItems(e)){let c=l.item;c.isEmpty||i.add(c)}}),i}searchByType(t,e,r,i,n){this.itorTree(t,(s,a)=>{n&&!n(a)||s.search(e,l=>{l.isEmpty||i(l)})},r)}getTree(t,e,r){var i,n;switch(t){case 1:return(i=this.singleLayerMap.get(e))==null?void 0:i.get(r);case 2:return(n=this.multiLayerMap.get(e))==null?void 0:n.get(r);default:return null}}};function SFe(o){let t=new xre;for(let e=0;e<o.length;e++){let r=o[e];t.insert(r)}return t}function EFe(o=new ZP().shapes){return o.filter(e=>t(e.layerId));function t(e){return Ud(e)||e==11}}var $M=class $M{constructor(){this._checkSameNet=!1;this._useForceModelPairClearance=!1;this.checkEnv=0;this.filters=new Array;this.clear()}static getInstance(){return $M.instance==null&&($M.instance=new $M),$M.instance}addFilter(t){this.filters.push(t)}filterCopper(t){for(let e of this.filters)e instanceof ZB&&e.addFilterCopper(t)}needCheck(t,e){for(let r of this.filters)if(r.filter(t)||r.filter(e))return!1;return!0}clear(){this.filters.length=0,jc.clear(),this.drcMap=new ef(xb([])),this.ruleHelper=new pS,ci.getInstance().clearErrorRecordBuffer()}initialEnv(t,e,r=!1){this.filters.length=0,jc.clear(),this.checkEnv=0,this.drcMap=t,this.ruleHelper=new pS,this.ruleHelper.constraintMap.updateByDRCMap(t,e),this.checkSameNet=r}initialEnv_Worker(t,e=!1){this.filters.length=0,jc.clear(),this.checkEnv=1,this.initDrcMap(),this.ruleHelper=new pS,this.ruleHelper.constraintMap.updateByDRCMap_Worker(t),this.checkSameNet=e,lA.initEffectiveRules(),ci.getInstance().initializeErrorRecordBuffer()}initDrcMap(){let t=EFe();this.drcMap=SFe(t),t.length=0}realeTime(t){this.ruleHelper.constraintMap.realTimeDRC(t)}get drcMap(){return this._drcMap}set drcMap(t){this._drcMap=t}get language(){return this._language}set language(t){this._language=t}get ruleHelper(){return this._ruleHelper}set ruleHelper(t){this._ruleHelper=t}get checkSameNet(){return this._checkSameNet}set checkSameNet(t){this._checkSameNet=t}get useForceModelPairClearance(){return this._useForceModelPairClearance}set useForceModelPairClearance(t){this._useForceModelPairClearance=t}};$M.instance=null;var $i=$M;var Rre=class{constructor(){this.constraintMap={};this.utils=new y3}get _constraintMap(){return this.constraintMap}getConstraints(t){let e=this.constraintMap[t];return e||new Set}isChecked(t){return this.constraintMap[t]!=null}updateByDRCMap(t,e,r=!0){r&&(this.constraintMap={});let i=this.constraintMap;e=e||yM("Constraint Region");for(let n of e){let s=n.buildBBox(),a=n.layerId,l=h=>a==11||a==12||h==11||h==12?!0:h==a,c=t.search(s,l);for(let h of c)this.utils.isInConstraint(n,h)&&(i[h.globalIndex]||(i[h.globalIndex]=new Set),i[h.globalIndex].add(n))}}updateByDRCMap_Worker(t,e=!0){e&&(this.constraintMap={});let r=this.constraintMap;t=t||yM("Constraint Region");for(let i of t){let n=i.layerId!==12?s=>s===12||s===11?!0:s===i.layerId:void 0;$i.getInstance().drcMap.search(3,i.buildBBox(),s=>{this.utils.isInConstraint(i,s)&&(r[s.globalIndex]||(r[s.globalIndex]=new Set),r[s.globalIndex].add(i))},n)}}realTimeDRC(t){t.forEach(({constraint:e,shape:r})=>{this.utils.isInConstraint(e,r)&&(this.constraintMap[r.globalIndex]=this.constraintMap[r.globalIndex]||new Set,this.constraintMap[r.globalIndex].add(e))})}updateMap(t,e=!0,r=!1){e&&(this.constraintMap={});let i=this.constraintMap;for(let n of Object.keys(t)){let s=ch(n);if(s instanceof or&&s.type==="Constraint Region"){let a=t[n];for(let l of a){let c=i[l.globalIndex];if(!r&&c&&c.has(s))continue;this.checkLayer(s,l)&&this.utils.isInConstraint(s,l)?(c||(c=new Set,i[l.globalIndex]=c),c.add(s)):c&&c.delete(s)}}}}delete(t){delete this.constraintMap[t]}checkLayer(t,e){return t.layerId===12||[12,11].includes(e.layerId)||t.layerId===e.layerId}isInConstraintCompatible(t,e){let r=t.shape(t.layer,0);if(e instanceof Os||e instanceof Rm){let i=e instanceof Os?new M(e.start,e.end):e.arc;return this.utils.getPtsCtrlPoints(s=>this.utils.primitiveIterator([i],s)).every(s=>jr.inPolyline(s,r))}else if(e instanceof Q0||e instanceof E0||e instanceof $P||e instanceof by){let i=e.shape(e.layer,0);return this.utils.getPtsCtrlPoints(s=>this.utils.primitiveIterator(i.primitives,s)).every(s=>jr.inPolyline(s,r))}else if(e instanceof gl||e instanceof yy){let i=e.center;return jr.inPolyline(i,r)}else if(e instanceof Jp){let i=e.location;return jr.inPolyline(i,r)}else if(e instanceof c1){let i=e.bbox().center();return jr.inPolyline(i,r)}return!1}};var rCe=class{constructor(){this.points=[];this.lines=[];this.arcs=[];this.listText=[]}addPt(t,e=!0){if(t instanceof M)this.lines.push(t);else if(t instanceof q)this.arcs.push(t);else throw new Error("not support");e&&this.points.push(t.start())}addPoint(t){this.points.push(t)}addText(t,e,r=1,i=.1,n=!0){this.listText.push({pos:t,str:e,size:r,width:i}),n&&this.points.push(t)}addPly(t,e=!0){t.primitives.forEach(r=>this.addPt(r,e))}build(){let t=[],e=[],r=[],i=[];return this.points.forEach(n=>t.push(n.x,n.y)),this.lines.forEach(n=>e.push(n.start().x,n.start().y,n.end().x,n.end().y)),this.arcs.forEach(n=>r.push(n.center.x,n.center.y,n.rx,zt.toRadians(n.startAngle),zt.toRadians(n.endAngle()),n.sweep())),this.listText.forEach(n=>i.push(n.pos.x,n.pos.y,n.str,n.width,n.size)),{points:t,lines:e,arcs:r,texts:i}}},YY=class YY{constructor(t){this.map=new hd;this.bus=t}initColor(t){return this.map.computeIfAbsent(t,()=>new rCe)}draw(){let t={},e=this.map.entries();for(;e.hasNext();){let r=e.next();t[r.key.toString()]=r.value.build()}this.bus.publish("/debug/draw",t)}clear(){this.map.clear()}static init(t){if(!t)throw new Error("bus is undefined!");this.palette=new YY(t)}static getDefaultColor(){for(let t of this.colorBuffersMap)if(t[0]!==null&&t[0])return t[0]=!1,t[1];return this.colorBuffersMap.forEach(t=>{if(t[0]===null){console.log(1);return}t[0]=!0}),this.getDefaultColor()}static clear(){this.palette.clear()}static auto(t,e=this.getDefaultColor()){if(Array.isArray(t))t.forEach(r=>{this.auto(r,e)});else if(t instanceof bI)this.auto(t.outline(),e);else if(t instanceof S)this.point(t,e);else if(t instanceof ht)this.bbox(t,e);else if(t instanceof rl)this.primitive(t,e);else if(t instanceof ge)this.polyline(t,e);else if(t instanceof Zo)this.polygon(t,e);else if(t instanceof Fo)this.group(t,e);else if(t instanceof Bt)this.auto(t.items,e);else{debugger;throw new Error("No incoming type!")}}static text(t,e,r=.5,i=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");this.palette.initColor(i).addText(t,e,r,r/10),this.palette.draw()}static point(t,e=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");let r=this.palette.initColor(e);Array.isArray(t)?t.forEach(i=>{this.point(i,e)}):r.addPoint(t),this.palette.draw()}static bbox(t,e=this.getDefaultColor()){Array.isArray(t)?t.forEach(r=>{this.bbox(r,e)}):(this.primitive(new M(new S(t.maxX,t.maxY),new S(t.maxX,t.minY)),e),this.primitive(new M(new S(t.maxX,t.maxY),new S(t.minX,t.maxY)),e),this.primitive(new M(new S(t.minX,t.minY),new S(t.maxX,t.minY)),e),this.primitive(new M(new S(t.minX,t.minY),new S(t.minX,t.maxY)),e))}static primitive(t,e=this.getDefaultColor()){if(!this.palette)throw new Error("palette  is not initialised!");let r=this.palette.initColor(e);Array.isArray(t)?t.forEach(i=>{this.primitive(i,e)}):r.addPt(t),this.palette.draw()}static polyline(t,e=this.getDefaultColor()){Array.isArray(t)?t.forEach(r=>{this.polyline(r,e)}):t.primitives.forEach(r=>{this.primitive(r,e)})}static polygon(t,e=this.getDefaultColor()){Array.isArray(t)?t.forEach(r=>{this.polygon(r,e)}):t.items.forEach(r=>{this.polyline(r,e)})}static group(t,e=this.getDefaultColor()){Array.isArray(t)?t.forEach(r=>{this.group(r,e)}):t.items.forEach(r=>{this.polygon(r,e)})}static async begin(){this.t1=performance.now()}static async end(t){console.log(t||"t1:",performance.now()-this.t1)}static async log(t){console.log(t||"==================")}};YY.colorBuffersMap=[[!0,ee.BLUE],[!0,ee.GREEN],[!0,ee.WHITE],[!0,ee.RED],[!0,ee.Golden],[!0,ee.Gray]],YY.t1=0;var ko=YY;var qY=Ru(r2());var Dre=class{constructor(t,e,r){this.lineMap=[];this.bbox=t,this.interval=e,this.angle=r,r===90?this.distance=(i,n)=>i.x-this.bbox.minX-n*this.interval:r===0?this.distance=(i,n)=>i.y-this.bbox.minY-n*this.interval:Zu()}interLine(t){let e=t.primitives.length,r=[],i=e-1,n=this.interPt(t.primitives[i]),s=n,a=new Array(e);s.forEach(l=>{(l.near1===!1||l.near2===!1)&&(a[i]!==void 0&&Zu(),a[i]=l.index)});for(let l=0;l<e;l++){let c=t.primitives[l],h=this.interPt(c),u=l===0?i:l-1;for(let d=0;d<h.length;d++){let p=h[d],m=p.index;l!==i&&(p.near1===!1||p.near2===!1)&&(a[l]!==void 0&&Zu(),a[l]=m);let g=p.near1===!0||p.near2===!0;if(!g&&a[u]===m)p.num===0?(p.num=1,p.point1=c.start(),p.near1=!0,p.startPosition=null):p.num===1?rn(p.point1,c.start())?Zu():(p.num=2,p.point2=c.start(),p.near2=!0,p.startPosition=null):p.num===2&&Zu();else if(g&&a[u]!==m){let y=(()=>{for(let P=0;P<s.length;P++)if(s[P].index===m)return P;Zu()})(),b=s[y];b.num===0?(b.num=1,b.point1=c.start(),b.near1=!1,b.endPosition=null):b.num===1?(b.num=2,b.point2=c.start(),b.near2=!1,b.endPosition=null):b.num===2&&Zu(),u===i?n[u]=b:r[u][y]=b}r[l]===void 0&&(r[l]=[]),r[l].push(p)}s=h}return r}position(t){return ne.eq(t,0)?null:t<0}frontier(t,e){if(t instanceof M){let i=this.distance(t.start(),0),n=this.distance(t.end(),0);return i<n?{min:Math.floor((i-1e-5)/this.interval),max:Math.floor((n+1e-5)/this.interval)+1}:{min:Math.floor((n-1e-5)/this.interval),max:Math.floor((i+1e-5)/this.interval)+1}}else if(t instanceof q){let n={min:180,max:0};e===90?n={min:270,max:90}:e===0?n={min:180,max:0}:Zu();let s=t.startAngle,a=t.endAngle();if(t.sweepAngle<0){let h=s;s=a,a=h}for(s-=1,a+=1;s<0||a<0;)s+=360,a+=360;let l=h=>{for(let u=0;u<=Math.floor(a/360);u++){let d=h+u*360;if(d<=a&&d>=s)return!0}return!1};for(;n.min<0;)n.min+=360;for(;n.max<0;)n.max+=360;let c={min:l(n.min)?Math.floor((this.distance(t.center,0)-t.rx-1e-5)/this.interval):null,max:l(n.max)?Math.floor((this.distance(t.center,0)+t.rx+1e-5)/this.interval)+1:null};if(c.min===null||c.max===null){let h=this.distance(t.start(),0),u=this.distance(t.end(),0);c.min===null&&(c.min=h<u?Math.floor((h-1e-5)/this.interval):Math.floor((u-1e-5)/this.interval)),c.max===null&&(c.max=h<u?Math.floor((u+1e-5)/this.interval)+1:Math.floor((h+1e-5)/this.interval)+1)}return c}}interArcInfo(t,e,r,i,n){let s=Pt(t,e),a,l,c;s===0?c=0:s===2?(c=1,a=new S(Ee[0],Ee[1])):s===4?(a=new S(Ee[0],Ee[1]),l=new S(Ee[2],Ee[3]),rn(a,l)?(c=1,l=void 0):c=2):Zu();let h,u;if(c!==0){let d=this.distance(t.start(),r),p=this.distance(t.end(),r),m=d*d<ne.eps,g=p*p<ne.eps;if(c===1)m&&g?Zu():m&&!g?rn(t.start(),a)?h=!0:h=null:!m&&g&&rn(t.end(),a)?h=!1:h=null;else if(c===2){let y=a.distance1(t.start()),b=l.distance1(t.start());if(m&&g)y<b?(h=!0,u=!1):(h=!1,u=!0);else if(m&&!g)y<b?(h=!0,u=null):(h=null,u=!0);else if(!m&&g){let P=a.distance1(t.end()),T=l.distance1(t.end());P<T?(h=!1,u=null):(h=null,u=!1)}else h=null,u=null}}return{index:r,num:c,point1:a,point2:l,startPosition:i,endPosition:n,near1:h,near2:u}}},wre=class extends Dre{constructor(e,r){super(e,r,90);this.angle=90;this.sortCmp=(e,r)=>e.y-r.y}positionPoint(e,r){return this.position(e.x-this.bbox.minX-r*this.interval)}interPt(e){if(e instanceof M){let i=e.start().x>e.end().x,{start:n,end:s}=i?{start:e.end(),end:e.start()}:{start:e.start(),end:e.end()},a=(s.y-n.y)/(s.x-n.x),l=[],c=null;for(let h=this.frontier(e,90),u=h.min;u<=h.max;u++){let d=this.bbox.minX+u*this.interval;if(Math.abs(e.start().x-e.end().x)<1e-4&&Math.abs(e.start().x-d)<1e-4)return l.push({index:u,num:2,point1:e.start(),point2:e.end(),startPosition:null,endPosition:null,near1:!0,near2:!1}),l;let p=this.position(e.start().x-d),m=this.position(e.end().x-d);if(n.x>d){l.push({index:u,num:0,startPosition:p,endPosition:m});continue}else if(s.x<d){let g=l.length;if(g===0&&Zu(),l[g-1].num===0){l.push({index:u,num:0,startPosition:p,endPosition:m});continue}let y=l[g-1].near1;if(!(s.x-(d-this.interval)<1e-4)){l.push({index:u,num:0,startPosition:p,endPosition:m});continue}let T=!!i;y==null?l[g-1].near1=T:y!==T&&Zu(),l.push({index:u,num:0,startPosition:p,endPosition:m})}else if(c===null){let g=d-n.x;c=new S(d,n.y+g*a);let b=g<1e-4?!i:null;l.push({index:u,num:1,point1:c,near1:b,startPosition:p,endPosition:m})}else c=new S(c.x+this.interval,c.y+a*this.interval),l.push({index:u,num:1,point1:c,near1:null,startPosition:p,endPosition:m})}return l}else if(e instanceof q){let r=[],i=this.frontier(e,0);for(let n=i.min;n<=i.max;n++){let{startPosition:s,endPosition:a}=this.getStartEndPosition(e,this.bbox.minX+n*this.interval);r.push(this.interArcInfo(e,this.getLine(n),n,s,a))}return r}else Zu()}getLine(e){if(this.lineMap[e]===void 0){let i=this.bbox.minX+e*this.interval;this.lineMap[e]=new M(new S(i,this.bbox.minY-1e-5),new S(i,this.bbox.maxY+1e-5))}return this.lineMap[e]}getStartEndPosition(e,r){return{startPosition:this.position(e.start().x-r),endPosition:this.position(e.end().x-r)}}},Lre=class extends Dre{constructor(e,r){super(e,r,0);this.angle=0;this.sortCmp=(e,r)=>e.x-r.x;this.positionPoint=(e,r)=>this.position(e.y-this.bbox.minY-r*this.interval)}interPt(e){if(e instanceof M){let i=e.start().y>e.end().y,{start:n,end:s}=i?{start:e.end(),end:e.start()}:{start:e.start(),end:e.end()},a=(s.y-n.y)/(s.x-n.x),l=[],c=null;for(let h=this.frontier(e,0),u=h.min;u<=h.max;u++){let d=this.bbox.minY+u*this.interval;if(Math.abs(e.start().y-e.end().y)<1e-4&&Math.abs(e.start().y-d)<1e-4)return l.push({index:u,num:2,point1:e.start(),point2:e.end(),startPosition:null,endPosition:null,near1:!0,near2:!1}),l;let p=this.position(e.start().y-d),m=this.position(e.end().y-d);if(n.y>d){l.push({index:u,num:0,startPosition:p,endPosition:m});continue}else if(s.y<d){let g=l.length;if(g===0&&Zu(),l[g-1].num===0){l.push({index:u,num:0,startPosition:p,endPosition:m});continue}let y=l[g-1].near1;if(!(s.y-(d-this.interval)<1e-4)){l.push({index:u,num:0,startPosition:p,endPosition:m});continue}let T=!!i;y==null?l[g-1].near1=T:Zu(),l.push({index:u,num:0,startPosition:p,endPosition:m});continue}else if(c===null){let g=d-n.y;c=new S(n.x+g/a,d);let b=g<1e-4?!i:null;l.push({index:u,num:1,point1:c,near1:b,startPosition:p,endPosition:m})}else c=new S(c.x+this.interval/a,c.y+this.interval),l.push({index:u,num:1,point1:c,near1:null,startPosition:p,endPosition:m})}return l}else if(e instanceof q){let r=[],i=this.frontier(e,90);for(let n=i.min;n<=i.max;n++){let s=this.bbox.minY+n*this.interval,a=this.position(e.start().y-s),l=this.position(e.end().y-s);r.push(this.interArcInfo(e,this.getLine(n),n,a,l))}return r}else Zu()}getLine(e){if(this.lineMap[e]===void 0){let i=this.bbox,n=i.minY+e*this.interval;this.lineMap[e]=new M(new S(i.minX-1e-5,n),new S(i.maxX+1e-5,n))}return this.lineMap[e]}},Mre=class{constructor(t,e,r,i){this.useTransform=!0;this.allGridInterPoint=[];i&&ko.init(i),this.rad=r,this.transform=this.useTransform&&r!==0,this.gridLine=this.createGridLine(t,e,r),this.interval=e,this.bbox=t}run(t){this.transform&&(t=t.multiply3(new Qe().rotate(this.rad)));let e=t.items.slice(),r=new Set(new Array(t.items.length).fill(0).map((a,l)=>l));for(let a=0;a<this.gridLine.length;a++){let l=this.gridLine[a];this.nowGridLine=a;for(let c=0;c<t.items.length;c++)this.runPolyline(t.items[c])&&r.delete(c);for(let c=0;c<this.allGridInterPoint.length;c++){if(!this.allGridInterPoint[c])continue;let h=this.allGridInterPoint[c].sort(l.sortCmp);for(let u=0;u<h.length;u+=2)e.push(ge.build2([new M(h[u],h[u+1])]))}this.allGridInterPoint=[]}let i=new Array,n=new Array;for(let a=0,l=e.length;a<l;a++)r.has(a)?i.push(e[a].reverse()):n.push(e[a]);let s=new Array;for(let a of i)s.push(this.transform?new Bt([a]).multiply3(new Qe().rotate(-this.rad)):new Bt([a]));return s.push(this.transform?new Bt(n).multiply3(new Qe().rotate(-this.rad)):new Bt(n)),s}runPolyline(t){let e=new Map;this.gridLine[this.nowGridLine].interLine(t).forEach((s,a)=>{s.forEach(l=>{let c=l.index,h=this.effectivePoint(t.primitives[a],l);e.has(c)||e.set(c,[]),h.forEach(u=>{e.get(c).push(u)})})});let n=!1;return e.forEach((s,a)=>{if(s.length%2!==0)throw new Error;this.allGridInterPoint[a]===void 0&&(this.allGridInterPoint[a]=[]),s.forEach(l=>{n=!0,this.allGridInterPoint[a].push(l)})}),n}createGridLine(t,e,r){if(this.useTransform)return this.transform&&(t=t.transform(new Qe().rotate(r))),[new wre(t,e),new Lre(t,e)];if(r===Math.PI/4)return[];if(r===0)return[new wre(t,e),new Lre(t,e)];Zu()}effectivePoint(t,e){if(e.num===0)return[];if(e.num===1){let r=e.near1===!0?null:e.startPosition,i=e.near1===!1?null:e.endPosition;return r===null?i?[e.point1]:[]:i===null?r?[e.point1]:[]:r===i?[]:[e.point1]}else if(e.num===2){let r=e.near1,i=e.near2,n=e.point1,s=e.point2,a=e.startPosition,l=e.endPosition;if(r!==null&&i!==null?r!==i?(a=null,l=null):Zu():r!==null&&i===null?r===!0?a=null:l=null:r===null&&i!==null&&(i===!0?a=null:l=null),t instanceof M){if(a===null&&l===null)return[];Zu()}else if(t instanceof q){let c=h=>{let u=t.rx/10;for(;u/=10;){let d=q.build3(h,0,360,u,u);if(Pt(d,t)===2){let p=new S(Ee[0],Ee[1]),m=this.gridLine[this.nowGridLine].positionPoint(p,e.index);return(m===null||rn(p,h))&&Zu(),m}u<1e-8&&Zu()}};if(a===null&&l===null){let h=c(n),u=c(s);if(h===u)return h?[n,s]:[];Zu()}else if(a===null&&l!==null){if(r===!0)return l?[s]:[n,s];if(i===!0)return l?[n]:[n,s];Zu()}else if(a!==null&&l===null){if(r===!1)return a?[s]:[n,s];if(i===!1)return a?[n]:[n,s];Zu()}else if(a!==null&&l!==null)return[n,s]}else Zu()}else Zu()}};function Zu(o){throw new Error(o||"gnrGrids error!")}var b9t=new aA(o=>{let t=new $u(10);return o.forEach((e,r)=>{r!==0&&t.insert(e)}),t});function AFe(o,t){let e=t[0];if(!rx.pip(o,e))return!1;let r=b9t.get(t).search(new ht(o.x-1e-5,o.x+1e-5,o.y-1e-5,o.y+1e-5));for(let i=0;i<r.length;i++)if(rx.pip(o,r[i]))return!1;return!0}var _Fe;(r=>{let o;(s=>(s[s.offsetBig=1e-5]="offsetBig",s[s.offsetSmall=ne.eps]="offsetSmall"))(o=r.Constant||(r.Constant={}));let t;(p=>(p[p._=0]="_",p[p.First=1]="First",p[p.Second=2]="Second",p[p.Third=3]="Third",p[p.Fourth=4]="Fourth",p[p.XPositive=5]="XPositive",p[p.XNegative=6]="XNegative",p[p.YPositive=7]="YPositive",p[p.YNegative=8]="YNegative"))(t=r.Quadrant||(r.Quadrant={}));let e;(l=>(l[l._=0]="_",l[l.partially=1]="partially",l[l.fully=2]="fully",l[l.empty=3]="empty"))(e=r.OccType||(r.OccType={}))})(_Fe||(_Fe={}));var jY;(C=>{let o;(O=>{class E{constructor(x){this.map=new Map;this.cb=x}get(x,v){let D=this.map.get(x);if(D!==void 0)return D;let w=v(x);return this.map.set(x,w),w}}O.Nor=E})(o||(o={}));function t(E){return new o.Nor(E)}C.Mnemonic=t;let e;(O=>{class E{constructor(){this.buffer=[]}add(x,v,D){this.buffer[x]===void 0&&(this.buffer[x]=[]),this.buffer[x][v]=D}search(x,v){return this.buffer[x]===void 0||this.buffer[x][v]===void 0?void 0:this.buffer[x][v]}}O.Nor=E})(e||(e={}));function r(){return new e.Nor}C.Buffer=r;let i;(O=>{class E{constructor(){this.buffer=[]}add(x,v,D){this.buffer[x]===void 0?(this.buffer[x]=[],this.buffer[x][v]=new Set().add(D)):this.buffer[x][v]===void 0?this.buffer[x][v]=new Set().add(D):this.buffer[x][v].add(D)}search(x,v){return this.buffer[x]===void 0||this.buffer[x][v]===void 0?void 0:this.buffer[x][v]}forEach(x){this.buffer.forEach((v,D)=>{v.forEach((w,F)=>{w.forEach(H=>x(D,F,H))})})}}O.Nor=E})(i||(i={}));function n(){return new i.Nor}C.GridBuffer=n;let s;(O=>{class E{constructor(){this.buffer=[]}add(x,v,D,w){this.buffer[x]===void 0?(this.buffer[x]=[],this.buffer[x][v]=new Map().set(D,w)):this.buffer[x][v]===void 0?this.buffer[x][v]=new Map().set(D,w):this.buffer[x][v].set(D,w)}search(x,v){return this.buffer[x]===void 0||this.buffer[x][v]===void 0?void 0:this.buffer[x][v]}forEach(x){this.buffer.forEach((v,D)=>{v.forEach((w,F)=>{w.forEach((H,z)=>x(D,F,z,H))})})}}O.Nor=E})(s||(s={}));function a(){return new s.Nor}C.GridBufferType=a;let l;(O=>{class E{constructor(){this.coord=new Map}add(x,v){let D=this.coord.get(x);D?D.add(v):this.coord.set(x,new Set().add(v))}get(x){this.coord.forEach((v,D)=>v.forEach(w=>x(D,w)))}}O.Nor=E})(l||(l={}));function c(){return new l.Nor}C.Coord=c;let h;(O=>{class E{constructor(){this.coord=new Map}get(x){this.coord.forEach((v,D)=>v.forEach((w,F)=>x(D,F,w)))}add(x,v,D){let w=this.coord.get(x);w?w.set(v,this.cmp?this.cmp(w.get(v),D):D):this.coord.set(x,new Map().set(v,D))}getArr(){let x=[];return this.get((v,D,w)=>x.push({x:v,y:D,tag:w})),x}set(x){return this.cmp=x,this}}O.Nor=E})(h||(h={}));function u(){return new h.Nor}C.CoordType=u;let d;(F=>{class E{constructor(z){this.items=new Set;this.grid=[];this.gridSize=z}getItems(){return Array.from(this.items)}add(z){if(!this.items.has(z))return this.items.add(z),nu.Occ.occBBox(z.bbox(),this.gridSize,(V,W)=>{this.grid[V]===void 0&&(this.grid[V]=[]),this.grid[V][W]===void 0&&(this.grid[V][W]=new Set),this.grid[V][W].add(z)}),this}remove(z){if(this.items.has(z))return this.items.delete(z),nu.Occ.occBBox(z.bbox(),this.gridSize,(V,W)=>{this.grid[V]===void 0||this.grid[V][W]===void 0||this.grid[V][W].delete(z)}),this}search(z){let V=new Set;nu.Occ.occBBox(z,this.gridSize,(L,k)=>{this.grid[L]&&this.grid[L][k]&&this.grid[L][k].forEach(N=>{V.add(N)})});let W=[];return V.forEach(L=>{z.isSeparated(L.bbox())||W.push(L)}),W}clear(){this.items.clear(),this.grid.length=0}}F.BBoxNor=E;class O{constructor(z){this.items=new Map;this.grid=[];this.gridSize=z}getItems(){return Array.from(this.items.keys())}add(z){if(this.items.has(z))return;let V=[];return nu.Occ.occBBox(z.bbox(),this.gridSize,(W,L)=>{V.push({x:W,y:L}),this.grid[W]===void 0&&(this.grid[W]=[]),this.grid[W][L]===void 0&&(this.grid[W][L]=new Set),this.grid[W][L].add(z)}),this.items.set(z,V),this}remove(z){let V=this.items.get(z);if(V)return V.forEach(W=>{let L=W.x,k=W.y;this.grid[L]===void 0||this.grid[L][k]===void 0||this.grid[L][k].delete(z)}),this.items.delete(z),this}search(z){let V=new Set;nu.Occ.occBBox(z,this.gridSize,(L,k)=>{this.grid[L]&&this.grid[L][k]&&this.grid[L][k].forEach(N=>{V.add(N)})});let W=[];return V.forEach(L=>{z.isSeparated(L.bbox())||W.push(L)}),W}clear(){this.items.clear(),this.grid.length=0}}F.BBoxStor=O;class _ extends O{searchItem(z){let V=this.items.get(z);if(!V)return;let W=new Set;V.forEach(k=>{let N=k.x,U=k.y;this.grid[N]&&this.grid[N][U]&&this.grid[N][U].forEach(B=>{W.add(B)})});let L=[];return W.forEach(k=>{z.bbox().isSeparated(k.bbox())||L.push(k)}),L}}F.BBoxNorDynamicBBox=_;class x extends E{add(z){if(!this.items.has(z))return this.items.add(z),z.occGrids(this.gridSize,(V,W)=>{this.grid[V]===void 0&&(this.grid[V]=[]),this.grid[V][W]===void 0&&(this.grid[V][W]=new Set),this.grid[V][W].add(z)}),this}remove(z){if(this.items.has(z))return this.items.delete(z),z.occGrids(this.gridSize,(V,W)=>{this.grid[V]===void 0||this.grid[V][W]===void 0||this.grid[V][W].delete(z)}),this}}F.OccNor=x;class v extends O{add(z){if(this.items.has(z))return;let V=[];return z.occGrids(this.gridSize,(W,L)=>{V.push({x:W,y:L}),this.grid[W]===void 0&&(this.grid[W]=[]),this.grid[W][L]===void 0&&(this.grid[W][L]=new Set),this.grid[W][L].add(z)}),this.items.set(z,V),this}}F.OccStor=v;class D extends E{add(z){if(!this.items.has(z))return this.items.add(z),nu.Occ.occPolygon(z.getMathGraphics(),this.gridSize,(V,W)=>{this.grid[V]===void 0&&(this.grid[V]=[]),this.grid[V][W]===void 0&&(this.grid[V][W]=new Set),this.grid[V][W].add(z)}),this}remove(z){if(this.items.has(z))return this.items.delete(z),nu.Occ.occPolygon(z.getMathGraphics(),this.gridSize,(V,W)=>{this.grid[V]===void 0||this.grid[V][W]===void 0||this.grid[V][W].delete(z)}),this}}F.GraphicsNor=D;class w extends O{add(z){if(this.items.has(z))return;let V=[];return nu.Occ.occPolygon(z.getMathGraphics(),this.gridSize,(W,L)=>{V.push({x:W,y:L}),this.grid[W]===void 0&&(this.grid[W]=[]),this.grid[W][L]===void 0&&(this.grid[W][L]=new Set),this.grid[W][L].add(z)}),this.items.set(z,V),this}}F.GraphicsStor=w})(d||(d={}));function p(E="bbox",O="nor",_=6,x=!1){switch(E){case"bbox":switch(O){case"nor":return x?new d.BBoxNorDynamicBBox(_):new d.BBoxNor(_);case"stor":return new d.BBoxStor(_);default:throw ks.error()}case"occ":switch(O){case"nor":return new d.OccNor(_);case"stor":return new d.OccStor(_);default:throw ks.error()}case"graphics":switch(O){case"nor":return new d.GraphicsNor(_);case"stor":return new d.GraphicsStor(_);default:throw ks.error()}default:throw ks.error()}}C.Grid=p;let m;(_=>{class E{constructor(v,D,w){this.capacity=w,this.bbox=v,this.root=new O(D,this.bbox,this.capacity)}add(v){return this}remove(v){return this}search(v){let D=new Set;return this.root.search(v,w=>D.add(w)),Array.from(D)}}_.Nor=E;class O{constructor(v,D,w){this.bbox=D,v.length>w?this.split(v,w):this.items=v}search(v,D){v.isIntersect(this.bbox)&&(this.items!==void 0?this.items.forEach(w=>D(w)):(v.isIntersect(this.nodeLU.bbox)&&this.nodeLU.search(v,D),v.isIntersect(this.nodeLD.bbox)&&this.nodeLD.search(v,D),v.isIntersect(this.nodeRU.bbox)&&this.nodeRU.search(v,D),v.isIntersect(this.nodeRD.bbox)&&this.nodeRD.search(v,D)))}split(v,D){let w=this.bbox.center(),F=new ht(this.bbox.minX,w.x,w.y,this.bbox.maxY).extendOfSize(1e-5),H=new ht(this.bbox.minX,w.x,this.bbox.minY,w.y).extendOfSize(1e-5),z=new ht(w.x,this.bbox.maxX,w.y,this.bbox.maxY).extendOfSize(1e-5),V=new ht(w.x,this.bbox.maxX,this.bbox.minY,w.y).extendOfSize(1e-5),W=[],L=[],k=[],N=[];for(let U=0;U<v.length;U++)v[U].bbox().isIntersect(F)&&W.push(v[U]),v[U].bbox().isIntersect(H)&&L.push(v[U]),v[U].bbox().isIntersect(z)&&k.push(v[U]),v[U].bbox().isIntersect(V)&&N.push(v[U]);this.nodeLU=new O(W,F,D),this.nodeLD=new O(L,H,D),this.nodeRU=new O(k,z,D),this.nodeRD=new O(N,V,D)}}})(m||(m={}));function g(E,O=[],_=6){return new m.Nor(E,O,_)}C.QuadTree=g;let y;(_=>{class E{constructor(v,D,w){this.capacity=w||2,this.root=new O(v,D,this.capacity)}search(v){let D=new Set;return this.root.search(v,w=>{D.add(w)}),Array.from(D)}}_.Nor=E;class O{constructor(v,D,w){this.items=[];this.onMedianItems=[];this.quickSelect=(v,D,w,F,H)=>{let z=Math.floor(Math.random()*(w-D+1))+D;this.swap(v,z,w);let V=D,W=D;for(;W<w;)H(v[W],v[w])&&this.swap(v,V++,W),W++;return this.swap(v,V,W),w===F+V-1?this.dimensional===!0?this.getBboxMiddleX(v[V].bbox()):this.getBboxMiddleY(v[V].bbox()):w>F+V-1?this.quickSelect(v,V+1,w,F,H):this.quickSelect(v,D,V-1,F-(w-V+1),H)};this.items=v,this.bbox=D,this.capacity=w,!(this.items.length<this.capacity)&&(this.dimensional=this.getDimensional(),this.median=this.getMedian(),this.createMedianItems(),this.createNode())}search(v,D){if(v.isIntersect(this.bbox)){if(this.items.length<this.capacity)for(let w=0;w<this.items.length;w++)D(this.items[w]);for(let w=0;w<this.onMedianItems.length;w++)D(this.onMedianItems[w]);if(this.dimensional===!0){if(this.median>v.minX&&this.median<v.maxX){this.leftNode.search(v,D),this.rightNode.search(v,D);return}v.maxX<this.median?this.leftNode.search(v,D):v.minX>this.median&&this.rightNode.search(v,D)}else{if(this.median>v.minY&&this.median<v.maxY){this.leftNode.search(v,D),this.rightNode.search(v,D);return}v.maxY<this.median?this.leftNode.search(v,D):v.minY>this.median&&this.rightNode.search(v,D)}}}createNode(){let v,D=[],w,F=[];for(let H=0;H<this.items.length;H++)this.dimensional===!0?this.items[H].bbox().maxX<this.median?D.push(this.items[H]):this.items[H].bbox().minX>this.median&&F.push(this.items[H]):this.items[H].bbox().maxY<this.median?D.push(this.items[H]):this.items[H].bbox().minY>this.median&&F.push(this.items[H]);this.dimensional===!0?(v=new ht(this.bbox.minX,this.median,this.bbox.minY,this.bbox.maxY),w=new ht(this.median,this.bbox.maxX,this.bbox.minY,this.bbox.maxY)):(v=new ht(this.bbox.minX,this.bbox.maxX,this.bbox.minY,this.median),w=new ht(this.bbox.minX,this.bbox.maxX,this.median,this.bbox.maxY)),this.leftNode=new O(D,v,this.capacity),this.rightNode=new O(F,w,this.capacity)}createMedianItems(){for(let v=0;v<this.items.length;v++)this.dimensional===!0?this.median>=this.items[v].bbox().minX&&this.median<=this.items[v].bbox().maxX&&this.onMedianItems.push(this.items[v]):this.median>=this.items[v].bbox().minY&&this.median<=this.items[v].bbox().maxY&&this.onMedianItems.push(this.items[v])}getDimensional(){return this.createDimensionalVariance()}createDimensionalDifference(){let v=this.bbox;return v.maxX-v.minX>v.maxY-v.minY}createDimensionalVariance(){let v=0,D=0;for(let H=0;H<this.items.length;H++)v+=this.getBboxMiddleX(this.items[H].bbox()),D+=this.getBboxMiddleY(this.items[H].bbox());v/=this.items.length,D/=this.items.length;let w=0,F=0;for(let H=0;H<this.items.length;H++)w+=Math.pow(v-this.getBboxMiddleX(this.items[H].bbox()),2),F+=Math.pow(D-this.getBboxMiddleY(this.items[H].bbox()),2);return w>F}getMedian(){return this.createMedianQuickSelect()}createMedianQuickSelect(){let v=this.items.length,D=v%2===0?Math.floor(v/2):Math.floor(v/2)+1;D=v-D+1;let w=this.items,F=D;if(this.dimensional===!0){let H=(z,V)=>this.getBboxMiddleX(z.bbox())<=this.getBboxMiddleX(V.bbox());return this.quickSelect(w,0,w.length-1,F,H)}else{let H=(z,V)=>this.getBboxMiddleY(z.bbox())<=this.getBboxMiddleY(V.bbox());return this.quickSelect(w,0,w.length-1,F,H)}}swap(v,D,w){return[v[D],v[w]]=[v[w],v[D]]}createMedianSort(){let v=this.items.length,D=v%2===0?Math.floor(v/2):Math.floor(v/2)+1,w;return this.dimensional===!0?w=(F,H)=>this.getBboxMiddleX(F.bbox())-this.getBboxMiddleX(H.bbox()):w=(F,H)=>this.getBboxMiddleY(F.bbox())-this.getBboxMiddleY(H.bbox()),this.items.sort(w),this.dimensional===!0?this.getBboxMiddleX(this.items[D].bbox()):this.getBboxMiddleY(this.items[D].bbox())}getBboxMiddleX(v){return(v.maxX+v.minX)/2}getBboxMiddleY(v){return(v.maxY+v.minY)/2}}})(y||(y={}));function b(E,O,_){return new y.Nor(E,O,_)}C.KDTree=b;let P;(_=>{class E{constructor(v,D){D=D||2;let w=[];for(let H=0;H<v.length;H++)w[H]=new O(v[H],"Left");w.sort((H,z)=>H.mortonCode-z.mortonCode);let F=[w,[]];for(;;){if(F[1]=[],nu.Method.splitNum(0,F[0].length,D,(H,z)=>{F[1].push(new O(F[0].slice(H,z),"Node"))}),F[1].length===1){this.rootNode=F[1][0];return}F[0]=F[1]}}search(v){return this.rootNode.search(v).map(D=>D._item)}}_.Nor=E;class O{constructor(v,D){this.nodes=[];D==="Left"?(this.item=v,this.bbox=v.bbox):(this.bbox=nu.Method.minOutsourcing(v),this.nodes=v),this.mortonCode=nu.Method.mortonCode(this.bbox.center().x,this.bbox.center().y)}search(v){let D=[];if(this.item!==void 0)return[this];for(let w=0;w<this.nodes.length;w++){let F=this.nodes[w];v.isIntersect(F.bbox)&&Array.prototype.push.apply(D,F.search(v))}return D}get _item(){return this.item}}})(P||(P={}));function T(E,O){return new P.Nor(E,O)}C.BVH=T;let I;(_=>{let E;(H=>{function x(z,V="Array"){if(V==="Array")return new H.Nor(z)}H.instance=x;class v{constructor(V){this.queue=[],this.cmp=V}remove(V){for(let W=0;W<this.size();W++)this.queue[W]===V&&this.queue.splice(W,1)}size(){return this.queue.length}empty(){return this.queue.length===0}push(V){for(let W=0;W<this.size();W++)if(this.cmp(V,this.queue[W])){this.queue.splice(W,0,V);return}this.queue.push(V)}pop(){for(let V=0;V<this.size()-1;V++)this.queue[V]=this.queue[V+1];this.queue.pop()}top(){return this.empty()&&ks.error(),this.queue[0]}}H.Nor=v;class D{static build(V,W){return new F(V,W)}}class w{constructor(V,W,L){this.item=L,this.isBigTop=V,this.cmp=W}push(V){if(this.item===void 0)this.item=V;else{let W=this.cmp(V,this.item);(this.isBigTop?W:!W)?this.leftChild===void 0?this.leftChild=new w(this.isBigTop,this.cmp,V):this.leftChild.push(V):this.rightChild===void 0?this.rightChild=new w(this.isBigTop,this.cmp,V):this.rightChild.push(V)}}}class F{constructor(V,W){this.root=new w(V,W)}push(V){this.root.push(V)}}})(E=_.Build||(_.Build={}));class O{constructor(){let v=(w,F)=>w<F,D=(w,F)=>w>F;this.minX=_.Build.instance(v),this.maxX=_.Build.instance(D),this.minY=_.Build.instance(v),this.maxY=_.Build.instance(D)}bbox(){return new ht(this.minX.top(),this.maxX.top(),this.minY.top(),this.maxY.top())}insert(v){this.minX.push(v.minX),this.maxX.push(v.maxX),this.minY.push(v.minY),this.maxY.push(v.maxY)}remove(v){this.minX.remove(v.minX),this.maxX.remove(v.maxX),this.minY.remove(v.minY),this.maxY.remove(v.maxY)}}})(I||(I={}))})(jY||(jY={}));var nu;(h=>{let o;(N=>{function u(U,B){let G=null,Y=null,X=0;return U.points(B,K=>{Y?X+=(K.x+Y.x)*(K.y-Y.y):G=K,Y=K}),X+=(G.x+Y.x)*(G.y-Y.y),X/2}N.area=u;function d(U,B){let G={p:U.primitives[0].start(),n:U.primitives[0].start().cross(B)};return U.primitives.forEach(Y=>{let X=Y.start().cross(B);X>G.n&&(G={p:Y.start(),n:X})}),G.p}N.polylineFurthestPoint=d;function p(U,B){let G=[U],Y=U.center,X=U.rx,K=U.startAngle,J=U.endAngle(),se=K;return(ce=>{let te=(()=>{let fe=B-U.center.y;if(fe===0)return{min:0,max:180};{let Oe=Math.acos(Math.abs(fe)/X)*180/Math.PI,Te=fe>0?90:270;return{min:Te-Oe,max:Te+Oe}}})(),oe=K>J?J:K,$=K>J?K:J;for(let fe=te.min;fe>oe&&ce(fe);fe-=360);for(let fe=te.min;fe<$&&ce(fe);fe+=360);for(let fe=te.max;fe>oe&&ce(fe);fe-=360);for(let fe=te.max;fe<$&&ce(fe);fe+=360);})(ce=>{for(let te=0;te<G.length;te++){if(G[te].sweep()===ae.CW&&ce>G[te].startAngle&&ce<G[te].endAngle())return G.splice(te,1,q.build2(Y,G[te].startAngle,ce,X,X,G[te].sweep())),G.splice(te+1,0,q.build2(Y,ce,G[te].endAngle(),X,X,G[te].sweep())),!1;if(G[te].sweep()===ae.CCW&&ce>G[te].endAngle()&&ce<G[te].startAngle)return G.splice(te,1,q.build2(Y,G[te].endAngle(),ce,X,X,G[te].sweep())),G.splice(te+1,0,q.build2(Y,ce,G[te].startAngle,X,X,G[te].sweep())),!1}return!0}),G}N.arcCutByY=p;function m(U,B=.1){return g.area(U,B)}N.polylineIsCW=m;let g;(G=>{function U(Y,X=.1){let K=0;return Y.primitives.forEach(se=>{if(se instanceof M)K+=(se.end().y+se.start().y)*(se.end().x-se.start().x);else if(se instanceof q)K+=(se.end().y+se.start().y)*(se.end().x-se.start().x),K+=J(se)*(se.isCCW?2:-2);else if(se instanceof Dr){let ce=se.start();se.points(X).forEach(te=>{K+=(te.y+ce.y)*(te.x-ce.x),ce=te}),K+=(se.end().y+ce.y)*(se.end().x-ce.x)}}),K>0;function J(se){let ce=Math.abs(se.sweep()),te=se.rx2*Math.PI;if(ce>=360)return te;return ce===180?te/2:te*(ce/360)+(ce<180?-1:1)*oe(se.center,se.start(),se.end());function oe($,fe,Oe){let Te=$.distance1(fe),ue=fe.distance1(Oe),be=Oe.distance1($),j=(Te+ue+be)/2;return Math.sqrt(j*(j-Te)*(j-ue)*(j-be))}}}G.area=U;function B(Y,X){let K=0;return Y.primitives.forEach(J=>{if(J instanceof M){let se=J.start(),ce=J.end();K+=(ce.x-se.x)*(ce.y+se.y)}else if(J instanceof q)(()=>{let se=[],ce=J.center,te=ce.y,oe=J.rx;return $(J,0).forEach(fe=>$(fe,te).forEach(Oe=>se.push(Oe))),se;function $(fe,Oe){let Te=[],ue=fe.startAngle,be=fe.endAngle(),j=ue,Z=fe.start();return(ie=>{let de=(()=>{let me=Oe-te;if(me===0)return{min:0,max:180};{let Se=Math.acos(Math.abs(me)/oe)*180*Math.PI,Re=me>0?90:270;return{min:Re-Se,max:Re+Se}}})();for(let me=0;!(de.min-me<ue&&(ie(de.min-me)||ie(de.min+me)));me+=360);for(let me=0;!(ie(de.max-me)||ie(de.max+me));me+=360);})(ie=>{if(ie>j&&ie<be)return Te.push(q.build3(ce,j,ie-j,oe,oe)),j=ie,!0}),Te.push(q.build3(ce,j,be-j,oe,oe)),Te}return[]})().forEach(se=>{K+=0});else if(J instanceof Dr){let se=J.points(X),ce=se.length;for(let te=0;te<ce;te++){let oe=se[te],$=se[te+1];K+=($.x-oe.x)*($.y+oe.y)}}else ks.error()}),K<0}G.green=B})(g=N.PolylineIsCW||(N.PolylineIsCW={}));function y(U,B){let G=U.center,Y=B?U.start():U.end(),X=(()=>{let te=h.Company.slope(G,Y);return Math.abs(te)>Number.MAX_SAFE_INTEGER?0:-1/te})(),K=U.rx,J=(()=>{if(X===1/0)return[new S(Y.x,Y.y+K),new S(Y.x,Y.y-K)];{let te=i.slopeToRadians(X),oe=K*Math.cos(te),$=K*Math.sin(te);return[new S(Y.x+oe,Y.y+$),new S(Y.x-oe,Y.y-$)]}})(),se=B?U.end():U.start(),ce=(()=>{let te=h.Position.checkPointVector(G,Y,se);if(te===null){let oe=U.rx/10;for(;oe/=10;){let $=e.pp(q.build3(Y,0,360,oe,oe),U);if($.length===1)return h.Position.checkPointVector(G,Y,$[0]);ks.error()}}else return te})();if(h.Position.checkPointVector(G,Y,J[0])===ce)return Math.abs(U.sweepAngle)>180?J[1]:J[0];if(h.Position.checkPointVector(G,Y,J[1])===ce)return Math.abs(U.sweepAngle)>180?J[0]:J[1];ks.error()}N.getTangentForArcEndPoint=y;function b(U,B,G){let Y=h.Company.crossProduct(U.x,U.y,B.x,B.y,G.x,G.y);return Y===0?null:Y<0}N.triangleIsCW=b;function P(U){return T.angleSW(U)===null}N.isConvexPolygon=P;let T;(B=>{function U(G){let Y=null,X=G.primitives.length;if(X===1)return null;for(let K=0;K<X;K++){let Te=function(ue){return Y===null?(Y=ue,!0):ue===Y},J=G.primitives[K],se=K===X-1?0:K+1,ce=G.primitives[se],te=J.start(),oe=J.end(),$=ce.end(),fe=null,Oe=[se,K,Y];if(J instanceof M)if(ce instanceof M){if(fe=b(te,oe,$),fe===null)throw new Error;if(Te(fe))continue;return Oe}else if(ce instanceof q){if(fe=b(te,oe,y(ce,!0)),fe===null)fe=!ce.isCCW;else if(fe===ce.isCCW)return Oe;if(Te(fe))continue;return Oe}else ks.error();else if(J instanceof q)if(ce instanceof M){if(fe=b(y(J,!1),oe,$),fe===null)fe=!J.isCCW;else if(fe===J.isCCW)return Oe;if(Te(fe))continue;return Oe}else if(ce instanceof q){if(fe=b(y(J,!1),oe,y(ce,!0)),J.isCCW!==ce.isCCW)return Oe;if(fe===null&&(fe=!J.isCCW),Te(fe))continue;return Oe}else ks.error();else ks.error()}return Y===null?ks.error():null}B.angleSW=U})(T||(T={}));function I(U){return C.cut(U)}N.cutPolygonIntoConvexParts=I;let C;(Y=>{function U(X){let K=0,J=[],se=[h.Conver.polylineArcToLine(X)];for(;se.length!==0;){let ce=B(se.shift());ce.length===1?J.push(ce[0]):ce.length===2&&(K++,se.push(ce[0]),se.push(ce[1]))}return console.log("\u5212\u5206\u4E86",K),J}Y.cut=U;function B(X){let K=G(X);if(K===null)return[X];let J=K.index,se=(fe=>{let Oe=J-2,Te=J+2;for(;Oe>0;){if(fe(Oe))return Oe;Oe--}for(;Te<X.primitives.length;){if(fe(Te))return Te;Te++}})(fe=>{let Oe=new M(X.primitives[J].end(),X.primitives[fe].end());if(!Te(fe,fe+1<X.primitives.length?fe+1:0,X.primitives[J].end())||!Te(J,J+1<X.primitives.length?J+1:0,X.primitives[fe].end()))return!1;for(let ue=0;ue<X.primitives.length;ue++){let be=X.primitives[ue],j=e.pp(be,Oe);for(let Z=0;Z<j.length;Z++)if(!rn(j[Z],Oe.start())&&!rn(j[Z],Oe.end()))return!1}return!0;function Te(ue,be,j){let Z=X.primitives[ue].start(),ie=X.primitives[ue].end(),de=X.primitives[be].end(),me=l.checkPointVector(Z,ie,j),Se=l.checkPointVector(ie,de,j);return me===null||Se===null?!1:K.norVec===!0?!me||!Se:me||Se}}),ce=X.primitives[J].end(),te=X.primitives[se].end();ko.auto(new M(ce,te),ee.WHITE);let oe=[],$=[];for(let fe=0,Oe=!1;fe<X.primitives.length;fe++){let Te=X.primitives[fe];Oe?$.push(Te):oe.push(Te),(fe===se||fe===J)&&(Oe?(fe===se?$.push(new M(te,ce)):$.push(new M(ce,te)),Oe=!1):(fe===se?oe.push(new M(te,ce)):oe.push(new M(ce,te)),Oe=!0))}return[ge.build7(oe),ge.build7($)]}function G(X){let K=h.Method.polylineIsCW(X);if(K!==X.area(.1)<0)throw new Error;let J=X.primitives.length;if(J<2)return null;for(let se=0;se<J;se++){let ue=function(be){return K===null?(K=be,!0):be===K},ce=X.primitives[se],te=se===J-1?0:se+1,oe=X.primitives[te],$=ce.start(),fe=ce.end(),Oe=oe.end(),Te={index:se,norVec:K};if(ce instanceof M)if(oe instanceof M){let be=b($,fe,Oe);if(be===null&&ks.error("\u7EBF\u6BB5\u5171\u7EBF\uFF01"),ue(be))continue;return Te}else if(oe instanceof q){let be=b($,fe,y(oe,!0));if(be===null)be=!oe.isCCW;else if(be===oe.isCCW)return Te;if(ue(be))continue;return Te}else ks.error();else if(ce instanceof q)if(oe instanceof M){let be=b(y(ce,!1),fe,Oe);if(be===null)be=!ce.isCCW;else if(be===ce.isCCW)return Te;if(ue(be))continue;return Te}else if(oe instanceof q){let be=b(y(ce,!1),fe,y(oe,!0));if(ce.isCCW!==oe.isCCW)return Te;if(be===null&&(be=!ce.isCCW),ue(be))continue;return Te}else ks.error();else ks.error()}return K===null?ks.error():null}})(C=N.CutPolygonIntoConvexParts||(N.CutPolygonIntoConvexParts={}));function E(U,B,G){if(U.length<5||B.length<5)for(let K=0,J=U.length;K<J;K++)for(let se=0,ce=B.length;se<ce;se++)U[K].bbox().isIntersect(B[se].bbox().extendOfSize(1e-5))&&G(U[K],B[se]);U.sort((K,J)=>K.bbox().minX-J.bbox().minX),B.sort((K,J)=>K.bbox().minX-J.bbox().minX);let Y=0,X=0;for(;Y<U.length&&X<B.length;){if(U[Y].bbox().minX<B[X].bbox().minX){let K=U[Y],J=K.bbox(),se=B.length;for(let ce=X;ce<se;ce++){let te=B[ce],oe=te.bbox();if(oe.minX-1e-5>J.maxX)break;Math.max(J.minY,oe.minY)<Math.min(J.maxY,oe.maxY)+1e-5&&G(K,te)}Y++}else{let K=B[X],J=K.bbox(),se=U.length;for(let ce=Y;ce<se;ce++){let te=U[ce],oe=te.bbox();if(oe.minX-1e-5>J.maxX)break;Math.max(J.minY,oe.minY)<Math.min(J.maxY,oe.maxY)+1e-5&&G(te,K)}}X++}}N.slideWindow=E;function O(U,B,G){let Y=U.distance1(B),X=B.distance1(G),K=G.distance1(U),J=(Y+X+K)/2;return Math.sqrt(J*(J-Y)*(J-X)*(J-K))}N.hailun=O;function _(U,B,G="merge"){switch(G){case"merge":return x.sortMerge(U,B);case"insert":return x.sortInsert(U,B);default:ks.error()}}N.sort=_;let x;(Y=>{function U(X,K){let J=X.length;if(J<2)return X;for(let se=1;se<J;se++){let ce=X[se],te=se-1;for(;te>=0&&K(ce,X[te]);)X[te+1]=X[te],te--;X[te+1]=ce}}Y.sortInsert=U;function B(X,K){let J=X.length;if(J<=1)return X;let se=Math.floor(J/2),ce=B(X.slice(0,se),K),te=B(X.slice(se,J),K);return G(ce,te,K)}Y.sortMerge=B;function G(X,K,J){let se=0,ce=0,te=[];for(;se<X.length&&ce<K.length;)J(X[se],K[ce])?te.push(X[se++]):te.push(K[ce++]);for(;se<X.length;)te.push(X[se++]);for(;ce<K.length;)te.push(K[ce++]);return te}})(x||(x={}));function v(U,B,G){return D.mergeOrdelyOppositeDualPointer(U,B,G)}N.mergeOrdely=v;let D;(B=>{function U(G,Y,X){let K=G.length-1,J=Y.length-1,se=K+J+1;for(;K>=0&&J>=0;)X(G[K],Y[J])?G[se--]=Y[J--]:G[se--]=G[K--];if(K<0)for(;se>=0;)G[se--]=Y[J--];return G}B.mergeOrdelyOppositeDualPointer=U})(D||(D={}));function w(U){let B=U.sweepAngle,G=U.startAngle,Y=U.endAngle(),X=U.center,K=U.rx;if(Math.abs(B)>=360)return[q.build3(X,G,G+90,K,K),q.build3(X,G+90,G+180,K,K),q.build3(X,G+180,G+270,K,K),q.build3(X,G+270,G+360,K,K)];{for(;G<0||Y<0;)G+=360,Y+=360;let J=Math.floor(Y/360),se=J===0?[0,90,180,270]:J===1?[360,450,540,630]:ks.error(),ce=[];se[0]<=Y&&se[0]>=G&&ce.push(q.build3(X,G,90,K,K))}return null}N.cutArc=w;function F(U){let B=[];if(U.isCCW?Math.floor(U.startAngle/90)+1!==Math.ceil(U.endAngle()/90):Math.ceil(U.startAngle/90)-1!==Math.floor(U.endAngle()/90)){let G=U.startAngle,Y=U.endAngle();if(U.sweepAngle>0){let X=90;for(;X<=Y;)X>G&&(B.push(q.build3(U.center,G,X-G,U.rx,U.ry)),G=X),X+=90;G<Y&&B.push(q.build3(U.center,G,Y-G,U.rx,U.ry))}else{let X=270;for(;X>=Y;)X<G&&(B.push(q.build3(U.center,G,X-G,U.rx,U.ry)),G=X),X-=90;G>Y&&B.push(q.build3(U.center,G,Y-G,U.rx,U.ry))}}else return[U];return B}N.cutArc2=F;function H(U,B,G,Y){G=G||1,Y=Y||N.minOutsourcing(U);let X=U.length,K=0;for(let J=0,se=U.length;J<se;J++)K+=U[J].bbox.area();if(B==="defaultGridInfo"){if(K===0)return{bbox:Y.extendOfSize(1e-5),width:G,height:G};{let J=Math.sqrt(X),se=Math.sqrt(Y.area()/(K/X));J>se&&(J=se);let ce,te;ce=te=J;let oe=Y.width(),$=Y.height();if(oe!==$){let be=oe/$;ce*=be,te/=be}let fe=Math.ceil(ce),Oe=Math.ceil(te),Te=Y.width()/fe,ue=Y.height()/Oe;return ue<G&&(ue=G),Te<G&&(Te=G),{bbox:Y.extendOfSize(1e-5),height:ue,width:Te}}}else if(B==="useGridNum"){let J=Math.sqrt(X),se=Math.sqrt(Y.area()/(K/X));K===0?Y=Y.extendOfSize(1e-5):J>se&&(J=se);let ce,te;ce=te=J;let oe=Y.width(),$=Y.height();if(oe!==$){let be=oe/$;ce*=be,te/=be}let fe=Math.ceil(ce),Oe=Math.ceil(te),Te=Y.width()/fe,ue=Y.height()/Oe;return ue<G&&(ue=G),Te<G&&(Te=G),{bbox:Y.extendOfSize(1e-5),height:ue,width:Te}}}N.getGridInfo=H;function z(U){let B=U.length,G=Number.MAX_SAFE_INTEGER,Y=Number.MIN_SAFE_INTEGER,X=Number.MAX_SAFE_INTEGER,K=Number.MIN_SAFE_INTEGER;for(let J=0;J<B;J++){let se=U[J];G=Math.min(se.bbox.minX,G),Y=Math.max(se.bbox.maxX,Y),X=Math.min(se.bbox.minY,X),K=Math.max(se.bbox.maxY,K)}return new ht(G,Y,X,K)}N.minOutsourcing=z;function V(U,B){if(U.length===0)return[];let G=2,Y=U,X;for(;;){let K=Y.length;if(K===1)break;X=[],h.Method.splitNum(0,K,G,(J,se)=>{if(se===K&&J===se-1){X.push(Y[J]);return}X.push(N.mergeOrdely(Y[J],Y[se-1],B))}),Y=X}return Y[0]}N.mergeArr=V;function W(U,B){let G=U.bbox().extendOfSize(1e-5).intersection1(B.bbox().extendOfSize(1e-5));if(G===null)return{pts1:null,pts2:null};let Y=this.getInterBBoxPtInfo(U,G);if(Y.length===0)return{pts1:null,pts2:null};let X=this.getInterBBoxPtInfo(B,G);return X.length===0?{pts1:null,pts2:null}:{pts1:Y,pts2:X}}N.getInterPublicBBoxPtInfo=W;function L(U,B,G,Y){let X=B;for(;;){if(B<=G){Y(X-B,X);return}Y(U*G,(U+1)*G),B-=G,U++}}N.splitNum=L;function k(U,B){return U=(U|U<<8)&16711935,U=(U|U<<4)&252645135,U=(U|U<<2)&858993459,U=(U|U<<1)&1431655765,B=(B|B<<8)&16711935,B=(B|B<<4)&252645135,B=(B|B<<2)&858993459,B=(B|B<<1)&1431655765,U|B<<1}N.mortonCode=k})(o=h.Method||(h.Method={}));let t;(T=>{function u(I,C,E){if(I instanceof rl){if(C instanceof rl)throw new Error("no support");if(C instanceof ge)throw new Error("no support");if(C instanceof Bt||C instanceof Zo)throw new Error("no support");if(C instanceof Fo)throw new Error("no support")}else if(I instanceof ge){if(C instanceof rl)throw new Error("no support");if(C instanceof ge)return m(I,C,E);if(C instanceof Bt||C instanceof Zo)throw new Error("no support");if(C instanceof Fo)throw new Error("no support")}else if(I instanceof Bt||I instanceof Zo){if(C instanceof rl)throw new Error("no support");if(C instanceof ge)throw new Error("no support");if(C instanceof Bt||C instanceof Zo)throw new Error("no support");if(C instanceof Fo)throw new Error("no support")}else if(I instanceof Fo){if(C instanceof rl)throw new Error("no support");if(C instanceof ge)throw new Error("no support");if(C instanceof Bt||C instanceof Zo)throw new Error("no support");if(C instanceof Fo)throw new Error("no support")}return null}T.auto=u;function d(I,C,E){if(I instanceof rl){if(C instanceof rl)throw new Error("no support");if(C instanceof ge)throw new Error("no support");if(C instanceof Bt||C instanceof Zo)throw new Error("no support");if(C instanceof Fo)throw new Error("no support")}else if(I instanceof ge){if(C instanceof rl)throw new Error("no support");if(C instanceof ge)throw new Error("no support");if(C instanceof Bt||C instanceof Zo)throw new Error("no support");if(C instanceof Fo)throw new Error("no support")}else if(I instanceof Bt||I instanceof Zo){if(C instanceof rl)throw new Error("no support");if(C instanceof ge)throw new Error("no support");if(C instanceof Bt||C instanceof Zo)throw new Error("no support");if(C instanceof Fo)throw new Error("no support")}else if(I instanceof Fo){if(C instanceof rl)throw new Error("no support");if(C instanceof ge)throw new Error("no support");if(C instanceof Bt||C instanceof Zo)throw new Error("no support");if(C instanceof Fo)throw new Error("no support")}return null}T.autoLine=d;function p(I,C,E=0){}T.pp=p;function m(I,C,E){return b.chek(I,C)}T.polyline=m;function g(I,C){}T.polylinePolygon=g;function y(I,C){}T.polygon=y;class b{static chek(C,E){for(this.polyline1=C,this.polyline2=E,this.d=new S(0,1),this.simplex=[this.support()],this.d=new S(0,0).sub(this.simplex[0]);;){let O=this.support();if(O.dot(this.d)<0)return!1;if(this.simplex.push(O),this.handleSimplex())return!0}}static handleSimplex(){return this.simplex.length===2?this.lineCase():this.triangleCase()}static lineCase(){let C=this.simplex[0],E=this.simplex[1],O=C.sub(E),_=new S(0,0).sub(E),x=this.tripleProd(O,_,O);return this.d=x,!1}static tripleProd(C,E,O){return new S(0,new S(0,C.cross(E)).cross(O))}static triangleCase(){let C=this.simplex[0],E=this.simplex[1],O=this.simplex[2],_=E.sub(O),x=C.sub(O),v=new S(0,0).sub(O),D=this.tripleProd(x,_,_),w=this.tripleProd(_,x,x);return D.dot(v)>0?(this.remove(C),this.d=D,!1):w.dot(v)>0?(this.remove(E),this.d=w,!1):!0}static remove(C){let E=this.simplex.indexOf(C);E>0&&this.simplex.splice(E,1)}static support(){return this.minkowskiDifference(o.polylineFurthestPoint(this.polyline1,this.d),o.polylineFurthestPoint(this.polyline2,this.d.mul(-1)))}static minkowskiDifference(C,E){return new S(E.x-C.x,E.y-C.y)}}class P extends b{static chek1(C,E,O){for(this.polyline1=C,this.polyline2=E,this.d=new S(0,1),this.simplex=[this.support()],this.d=new S(0,0).sub(this.simplex[0]);;){let _=this.support();if(_.dot(this.d)<0)return!1;if(this.simplex.push(_),this.handleSimplex())return!0}}}})(t=h.Collision||(h.Collision={}));let e;(d=>{function u(p,m){let g=Pt(p,m),y=[];for(let b=0;b<g;b+=2)y.push(new S(Ee[b],Ee[b+1]));return y}d.pp=u})(e=h.Intersect||(h.Intersect={}));let r;(p=>{function u(m,g){let y=m-g;return y>0?y>1e-5?!0:null:y<-1e-5?!1:null}p.equals=u;function d(m,g,y){return m<y+1e-5&&m>g-1e-5}p.corridor=d})(r=h.Precision||(h.Precision={}));let i;(y=>{function u(b){let P=jc.getCache(b);if(P instanceof md)return P.shape;if(P instanceof Yd)return P.shape;if(P instanceof ku)return P.shape;if(P instanceof qu)return P.shape;ks.error()}y.pcbShapeModelToShap=u;function d(b){return Math.atan(b)}y.slopeToRadians=d;function p(b){return b*180/2*Math.PI}y.radiansToAngle=p;function m(b,P=.1){let T=[],I=null;return b.points(P).forEach((C,E)=>{E!==0&&T.push(new M(I,C)),I=C}),T}y.arcToLine=m;function g(b){let P=[];return b.primitives.forEach(T=>{T instanceof q?m(T).forEach(I=>P.push(I)):P.push(T)}),ge.build7(P)}y.polylineArcToLine=g})(i=h.Conver||(h.Conver={}));let n;(m=>{function u(g,y){return(g.y-y.y)/(g.x-y.x)}m.slope=u;function d(g,y,b,P,T,I){return(b-g)*(I-y)-(T-g)*(P-y)}m.crossProduct=d;function p(g,y,b){return new S((g.x+y.x+b.x)/2,(g.y+y.y+b.y)/2)}m.triangleCentre=p})(n=h.Company||(h.Company={}));let s;(w=>{function u(F,H,z){z(Math.floor(F.x/H),Math.floor(F.y/H))}w.occPoint=u;function d(F,H,z,V){g(new ht(F.x-z,F.x+z,F.y-z,F.y+z),H,V)}w.occPointExtend=d;function p(F,H,z,V){let W=jY.CoordType().set((L,k)=>L&&k);u(F,H,(L,k)=>W.add(L,k,!1)),T(q.build3(F,0,360,z,z),H,(L,k)=>W.add(L,k,!0)),W.get(V)}w.occPointDiscernExtend=p;function m(F,H,z){u(F,H,(V,W)=>z(V,W,2))}w.occPointType=m;function g(F,H,z){for(let V=Math.floor(F.minX/H),W=Math.ceil(F.maxX/H);V<=W;V++)for(let L=Math.floor(F.minY/H),k=Math.ceil(F.maxY/H);L<=k;L++)z(V,L)}w.occBBox=g;function y(F,H,z,V){g(F.extendOfSize(z),H,V)}w.occBBoxExtend=y;function b(F,H,z,V){for(let W=Math.floor(F.minX/H),L=Math.ceil(F.maxX/H);W<L;W++)for(let k=Math.floor(F.minY/H),N=Math.ceil(F.maxY/H);k<N;k++)V(W,k)}w.occBBoxDiscernExtend=b;function P(F,H,z){let V=Math.floor(F.minX/H),W=Math.ceil(F.maxX/H),L=Math.floor(F.minY/H),k=Math.ceil(F.maxY/H),N;for(let U=V;U<W;U++){N=U===V||W?1:2;for(let B=L;B<k;B++)N=B===L||k?1:2,z(U,B,N)}}w.occBBoxType=P;function T(F,H,z){let V=F.bbox();if(Math.abs(V.maxX-V.minX)<H||Math.abs(V.maxY-V.minY)<H)return g(V,H,z);if(F instanceof M)return v.occLine(F,H,z);if(F instanceof q)return v.occArc(F,H,z);throw new Error("Method not implemented.")}w.occPt=T;function I(F,H,z,V){let W=F.bbox();if(Math.abs(W.maxX-W.minX)<H||Math.abs(W.maxY-W.minY)<H)return y(W,H,z,V);if(F instanceof M)return v.occLineExtend(F,H,z,V);if(F instanceof q)return v.occArcExtend(F,H,z,V);throw new Error("Method not implemented.")}w.occPtExtend=I;function C(F,H,z){T(F,H,(V,W)=>z(V,W,1))}w.occPtType=C;function E(F,H,z){D.Gnr.occPolygon(XY.getPolygon(F),H,z)}w.occPolygon=E;function O(F,H,z,V){D.Gnr.occPolygonExtend(XY.getPolygon(F),H,z,V)}w.occPolygonExtend=O;function _(F,H,z){D.Gnr.occPolygonType(XY.getPolygon(F),H,z)}w.occPolygonType=_;function x(F,H,z){return new ht(F*z,F*z+z,H*z,H*z+z)}w.demoGrid=x;let v;(L=>{function F(k,N,U){let B=(oe,$,fe)=>{let Oe=Math.floor($/N),Te=Math.floor(fe/N);for(let ue=Oe<Te,be=ue?Oe:Te,j=ue?Te:Oe;be<=j;be++)U(oe,be);return fe},G=k.start().x<k.end().x,Y=G?k.start():k.end(),X=G?k.end():k.start(),K=Math.floor(Y.x/N),J=Math.floor(X.x/N);if(J===K){B(K,Y.y,X.y);return}let se=(X.y-Y.y)/(X.x-Y.x),ce=se*N,te=B(K++,Y.y,Y.y+(K*N-Y.x)*se);for(;K<J;)te=B(K++,te,te+ce);B(K,te,X.y)}L.occLine=F;function H(k,N,U,B){}L.occLineExtend=H;function z(k,N,U){let B=k.bbox();for(let G=Math.floor(B.minX/N)*N,Y=Math.ceil(B.maxX/N)*N;G<=Y;G+=N){let X=new M(new S(G,B.minY),new S(G,B.maxY)),K=Math.floor(G/N),J=Pt(X,k);for(let se=0;se<J;se+=2){let ce=Ee[se+1];U(K,Math.floor(ce/N)),U(K-1,Math.floor(ce/N))}}for(let G=Math.floor(B.minY/N)*N,Y=Math.ceil(B.maxY/N)*N;G<=Y;G+=N){let X=new M(new S(B.minX,G),new S(B.maxX,G)),K=Math.floor(G/N),J=Pt(X,k);for(let se=0;se<J;se+=2){let ce=Ee[se];U(Math.floor(ce/N),K),U(Math.floor(ce/N),K-1)}}}L.occArc=z;function V(k,N,U,B){}L.occArcExtend=V;class W{constructor(N,U,B){this.bbox=N,this.gridWidth=U,this.gridHeight=B}convertLine(N){return new M(new S((N.start().x-this.bbox.minX)/this.gridWidth,(N.start().y-this.bbox.minY)/this.gridHeight),new S((N.end().x-this.bbox.minX)/this.gridWidth,(N.end().y-this.bbox.minY)/this.gridHeight))}trimLine(N){let U=Math.floor(N.start().x),B=N.end().y-N.start().y,G=N.start().x-N.end().x,Y=N.end().x*N.start().y-N.start().x*N.end().y,X=-B/G,K=-Y/G,J=X*U+K;return new M(new S(U,J),N.end())}occupy(N,U){N=this.convertLine(N),U(Math.floor(N.start().x),Math.floor(N.start().y)),console.log(Math.floor(N.start().x),Math.floor(N.start().y));let B=N.start(),G=N.end(),Y=G.x-B.x,X=G.y-B.y,K=Math.abs(X/Y);if(Y>0&&X>0)K<=1?(console.log("case:1"),this.bresenham(B,G,U)):(console.log("case:2"),this.bresenham(new S(B.y,B.x),new S(G.y,G.x),(J,se)=>{U(se,J)}));else if(Y>0&&X<0)K<=1?(console.log("case:3"),this.bresenham(new S(B.x,-B.y),new S(G.x,-G.y),(J,se)=>{U(J,-se)})):(console.log("case:4"),this.bresenham(new S(-B.y,B.x),new S(-G.y,G.x),(J,se)=>{U(se,-J)}));else if(Y<0&&X>0)K<=1?(console.log("case:5"),this.bresenham(new S(-B.x,B.y),new S(-G.x,G.y),(J,se)=>{U(-J,se)})):(console.log("case:6"),this.bresenham(new S(B.y,-B.x),new S(G.y,-G.x),(J,se)=>{U(-se,J)}));else if(Y<0&&X<0)K<=1?(console.log("case:7"),this.bresenham(G,B,(J,se)=>{U(J,se)})):(console.log("case:8"),this.bresenham(new S(G.y,G.x),new S(B.y,B.x),(J,se)=>{U(se,J)}));else throw new Error("not support")}bresenham(N,U,B){let G=this.trimLine(new M(N,U));N=G.start(),U=G.end();let Y=N.x,X=N.y,K=U.x,J=U.y,se=K-Y,ce=J-X,te=Y,oe=X,$=2*ce-se;for(;te<=K+1;)B(te,oe),$<0?($=$+2*ce,oe=oe):($=$+2*ce-2*se,oe=oe+1,B(te,this.floor(oe))),te=te+1,B(te,this.floor(oe))}bresenham2(N,U,B){let G=N.x,Y=N.y,X=U.x,J=(U.y-Y)/(X-G),se=Math.ceil(G),ce=Y+(se-G)*J;for(;se<=X;)B(se,Math.floor(ce)),se++,ce+=J}floor(N){return N<0?Math.ceil(N):Math.floor(N)}bresenham1(N,U){let B=N.start().x,G=N.start().y,Y=N.end().x,X=N.end().y,K=Y-B,J=X-G,se=Math.abs(K/J);if((K===0||J===0||se===1||se===0)&&console.warn("BRENSENHAM"),K>0&&J>0&&se>0&&se<1){let ce=B,te=G,oe=2*J-K;for(;ce<=Y+1;)console.log(1),oe<0?(oe=oe+2*J,te=te):(oe=oe+2*J-2*K,te=te+1),ce=ce+1,U(ce,te)}if(K>0&&J>0&&se>1){let ce=B,te=G,oe=2*K-J;for(;te<=X+1;)console.log(2),oe<0?(oe=oe+2*K,ce=ce):(oe=oe+2*K-2*J,ce=ce+1),te=te+1,U(ce,-te)}if(K>0&&J<0&&se>0&&se<1){let ce=B,te=-G,oe=2*J-K;for(;ce<=Y+1;)console.log(3),oe<0?(oe=oe+2*J,te=te):(oe=oe+2*J-2*K,te=te+1),ce=ce+1,U(ce,-te)}if(K<0&&J>0&&se>1){let ce=B,te=-G,oe=2*K-J;for(;te<=X+1;)console.log(4,ce,te,oe),oe<0?(oe=oe+2*K,ce=ce):(oe=oe+2*K-2*J,ce=ce+1),te=te+1,U(ce,-te)}if(K<0&&J>0&&se>0&&se<1){let ce=-B,te=G,oe=2*J-K;for(;ce<=Y+1;)console.log(5),oe<0?(oe=oe+2*J,te=te):(oe=oe+2*J-2*K,te=te+1),ce=ce+1,U(-ce,te)}if(K<0&&J>0&&se>1){let ce=-B,te=G,oe=2*K-J;for(;te<=X+1;)console.log(6),oe<0?(oe=oe+2*K,ce=ce):(oe=oe+2*K-2*J,ce=ce+1),te=te+1,U(-ce,te)}if(K<0&&J<0&&se>0&&se<1){let ce=-B,te=-G,oe=2*J-K;for(;ce<=Y+1;)console.log(7),oe<0?(oe=oe+2*J,te=te):(oe=oe+2*J-2*K,te=te+1),ce=ce+1,U(-ce,-te)}if(K<0&&J<0&&se>1){let ce=-B,te=-G,oe=2*K-J;for(;te<=X+1;)console.log(8),oe<0?(oe=oe+2*K,ce=ce):(oe=oe+2*K-2*J,ce=ce+1),te=te+1,U(-ce,-te)}}}L.Bresenham=W})(v||(v={}));let D;(z=>{let F;(N=>{function V(U,B,G){let Y=jY.Coord(),X=new k(K(),B,0);return U.items.forEach(J=>{J.primitives.forEach(se=>{let ce=se.start(),te=se.end();Y.add(Math.floor(ce.x/B),Math.floor(ce.y/B)),Y.add(Math.floor(te.x/B),Math.floor(te.y/B))})}),X.getInterPoint(U,(J,se)=>{let ce=te=>{if(te%B!==0)throw new Error("");return te/B};if(J.x===se.x){let te=ce(J.x),oe=Math.floor(Math.min(J.y,se.y)/B),$=Math.floor(Math.max(J.y,se.y)/B);Y.add(te,oe),Y.add(te,$);for(let fe=oe+1;fe<$;fe++)Y.add(te,fe);te--,Y.add(te,oe),Y.add(te,$);for(let fe=oe+1;fe<$;fe++)Y.add(te,fe)}else if(J.y===se.y){let te=ce(J.y),oe=Math.floor(Math.min(J.x,se.x)/B),$=Math.floor(Math.max(J.x,se.x)/B);Y.add(oe,te),Y.add($,te);for(let fe=oe+1;fe<$;fe++)Y.add(fe,te);te--,Y.add(oe,te),Y.add($,te);for(let fe=oe+1;fe<$;fe++)Y.add(fe,te)}}),Y.get(G);function K(){let J=U.bbox().extendOfSize(1e-5);return new ht(se(J.minX),ce(J.maxX),se(J.minY),ce(J.maxY));function se(te){return Math.floor(te/B)*B}function ce(te){return Math.ceil(te/B)*B}}}N.occPolygon=V;function W(U,B,G,Y){let X=new k((()=>{let se=U.bbox().extendOfSize(1e-5);return new ht(ce(se.minX),te(se.maxX),ce(se.minY),te(se.maxY));function ce(oe){return Math.floor(oe/B)*B}function te(oe){return Math.ceil(oe/B)*B}})(),B,0),K=jY.Coord(),J=Math.ceil(G/B);return J===0&&(J=1),U.items.forEach(se=>{se.primitives.forEach(ce=>{h.Occ.occPointExtend(ce.start(),B,G,Y),h.Occ.occPointExtend(ce.end(),B,G,Y)})}),X.getInterPoint(U,(se,ce)=>{function te(oe){return oe%B===0?oe/B:ks.error()}if(se.x===ce.x)for(let oe=Math.floor((Math.min(se.y,ce.y)-G)/B),$=te(se.x);oe<=Math.floor((Math.max(se.y,ce.y)+G)/B)+G;oe++)for(let fe=0;fe<J;fe++)K.add($+fe,oe),K.add($-fe-1,oe);else if(se.y===ce.y)for(let oe=Math.floor((Math.min(se.x,ce.x)-G)/B),$=te(se.y);oe<=Math.floor((Math.max(se.x,ce.x)+G)/B);oe++)for(let fe=0;fe<J;fe++)K.add(oe,$+fe),K.add(oe,$-fe-1);else throw new Error("")}),K.get(Y)}N.occPolygonExtend=W;function L(U,B,G){}N.occPolygonType=L;class k extends Mre{getInterPoint(B,G){this.transform&&ks.error(),this.gridLine.forEach((Y,X)=>{this.nowGridLine=X;for(let K=0;K<B.items.length;K++)this.runPolyline(B.items[K]);this.allGridInterPoint.forEach((K,J)=>{K.sort(Y.sortCmp);for(let se=0;se<K.length;se+=2)if(this.nowGridLine===0){let ce=this.interval*J+this.bbox.minX;G(new S(ce,K[se].y),new S(ce,K[se+1].y))}else if(this.nowGridLine===1){let ce=this.interval*J+this.bbox.minY;G(new S(K[se].x,ce),new S(K[se+1].x,ce))}}),this.allGridInterPoint=[]})}}})(F=z.Gnr||(z.Gnr={}));function H(V,W,L){let k=[];this.occPolyline(V,W,(B,G)=>{k[B]||(k[B]=[]),k[B][G]||(k[B][G]=1),k[B][G]++,ko.auto(this.demoGrid(B,G,W),ee.GREEN)});let N=V.bbox(),U=new Map;for(let B=Math.floor(N.minX/W),G=Math.ceil(N.maxX/W);B<G;B++){let Y=k[B],X=!1,K=0;for(let J=Math.floor(N.minY/W),se=Math.ceil(N.maxY/W);J<se;J++)for(;Y[J]--;)if(!X)K=J,X=!0;else{for(let ce=K;ce<=J;ce++)U.set(ce,B);X=!1}}U.forEach(L)}})(D||(D={}))})(s=h.Occ||(h.Occ={}));let a;(I=>{function u(){return new ZP().shapes.map(C=>{if(!C)return;let E=h.Conver.pcbShapeModelToShap(C);if(E instanceof rl)return E})}I.getLine=u;function d(){return new ZP().shapes.map(C=>{if(!C)return;let E=h.Conver.pcbShapeModelToShap(C);if(E instanceof ge)return E})}I.getPolyline=d;function p(){return Math.random()<.5}I.bool=p;function m(C,E,O){let _=[];for(;E--;)_.push(g(C,O));return _}I.numArr=m;function g(C,E){return E?Math.random()*(C.max-C.min)+C.min:Math.floor(Math.random()*(C.max-C.min)+C.min)}I.num=g;function y(C,E,O){if(O){let _=y(C,E);return ko.auto(_,O),_}return m({min:C.minX,max:C.maxX},E).map(_=>new S(_,g({min:C.minY,max:C.maxY})))}I.point=y;function b(C,E,O){if(O){let v=b(C,E);return ko.auto(v,O),v}let _=y(C,2*E),x=[];for(let v=0;v<_.length;v+=2)x.push(new M(_[v],_[v+1]));return x}I.line=b;function P(C,E,O,_,x){if(x){let z=P(C,E,O,_);return ko.auto(z,x),z}let v=[],D=y(C,_),w=m(E,_),F=m({min:1,max:360},_),H=m(O,_);for(let z=0;z<_;z++)v.push(q.build3(D[z],F[z],H[z],w[z],w[z]));return v}I.arc=P;function T(C,E,O,_,x){let v=[];for(;_--;)v.push(p()?b(C,1,x)[0]:P(C,E,O,1,x)[0]);return v}I.pt=T})(a=h.Random||(h.Random={}));let l;(w=>{function u(F,H,z=1e-5){let V=[];if(!F.bbox().extendOfSize(z).isIntersect(H.bbox()))return V;return H.primitives.forEach(k=>V.push(...W(k))),V;function W(k){let N=L(k),U=N.length;if(k instanceof M)U>1&&ks.error();else if(k instanceof q&&(U>2&&ks.error(),rn(N[0],N[1])))return[];return N}function L(k){let{interPoint:N,interPointNum:U}=w.pp(k,F);if(U===2)return N;let B=k.start(),G=k.end(),Y=w.pointOnLine(B,F),X=w.pointOnLine(G,F);if(k instanceof M){if(Y&&X)return[];if(Y){let K=w.checkPointVector(F.start(),F.end(),G);K===!0?N.push(B):K===!1||ks.error()}else if(X){let K=w.checkPointVector(F.start(),F.end(),B);K===!0?N.push(G):K===!1||ks.error()}}else if(k instanceof q){if(Y&&X&&ks.error(),Y){let K=w.checkPointVector(F.start(),F.end(),G);Math.abs(k.sweepAngle)>180?K===!0||(K===!1?N.push(B):ks.error()):K===!0?N.push(B):K===!1||ks.error()}else if(X){let K=w.checkPointVector(F.start(),F.end(),B);Math.abs(k.sweepAngle)>180?K===!0||(K===!1?N.push(G):ks.error()):K===!0?N.push(G):K===!1||ks.error()}}else ks.error();return N}}w.linePolyline=u;function d(F,H){let z=[],V=Pt(F,H);for(let W=0;W<V;W+=2)z.push(new S(Ee[W],Ee[W+1]));return{interPoint:z,interPointNum:V/2}}w.pp=d;function p(F,H){let z=F.x-H.x,V=F.y-H.y;if(z===0)return V>0?90:V<0?270:0;if(V===0)return z>0?0:z<0?180:0;let W=Math.atan(Math.abs(V)/Math.abs(z))*180/Math.PI;if(z>0){if(V>0)return W;if(V<0)return 360-W;ks.error()}else if(z<0){if(V>0)return 180-W;if(V<0)return 180+W;ks.error()}else ks.error()}w.calculateVectorAngle=p;function m(F,H){let z=F.x-H.x,V=F.y-H.y;return z>0?V>0?1:V<0?4:1:z<0?V>0?2:(V<0,3):V>0?2:(V<0,4)}w.checkQuadrant=m;function g(F,H){return F.x<=H.maxX&&F.x>=H.minX&&F.y<=H.maxY&&F.y>=H.minY}w.pointInBBox=g;function y(F,H){let z=w.calculateVectorAngle(F,H.center);if(!T(z,H))return!1;let V=F.distance2(H.center),W=H.rx**2;if(V>W)return!1;if(V===W)return null;if(Math.abs(H.sweepAngle)<180){let L=b(H.start(),H.end(),F),k=b(H.start(),H.end(),H.center);return L===null?!0:(k===null&&ks.error(),L!==k)}else return!0}w.pointInsideArcCircle=y;function b(F,H,z){let V=z.x,W=z.y,L=(F.x-V)*(H.y-W)-(F.y-W)*(H.x-V);return L>0?!0:L<0?!1:null}w.checkPointVector=b;function P(F,H,z=1e-5){return H.distance2(F)<z*z}w.pointOnLine=P;function T(F,H){let z,V,W=H.sweepAngle;if(Math.abs(W)>=360)return!0;for(W>0?(z=H.startAngle,V=z+W):(V=H.startAngle,z=V-W);F<z&&F<V;)F+=360;for(;F>z&&F>V;)F-=360;return F>=z&&F<=V}w.angleOnArc=T;function I(F,H){return F.minX>=H.minX&&F.maxX<=H.maxX&&F.minY>=H.minY&&F.maxY<=H.maxY}w.bboxInBBox=I;function C(F,H,z){return AFe(F,H)}w.pips=C;function E(F,H,z="ray"){if(!g(F,H.bbox()))return!1;let V=D.optimise(F,H);if(V!==null)return V;if(z==="ray")return D.ray(F,H);ks.error()}w.pip=E;function O(F,H,z){for(let V=0;V<H.length;V++)if(V===0){if(!_(F,H[V],z))return!1}else if(_(F,H[V],z))return!1;return!0}w.pipsUseSpaceAcceleratedStructure=O;function _(F,H,z){return V()%2!==0;function V(){let W=H.end(),L=0,{x:k,y:N}=F;for(let B of z.search(new ht(F.x,H.bbox().maxX,F.y,F.y).extendOfSize(1e-5))){if(W.y>N?B.bbox().minY>N:B.bbox().maxY<=N){W=B.end();continue}if(B instanceof q&&(B.isCCW?Math.floor(B.startAngle/90)+1!==Math.ceil(B.endAngle()/90):Math.ceil(B.startAngle/90)-1!==Math.floor(B.endAngle()/90))){let G=B.startAngle,Y=B.endAngle();if(B.sweepAngle>0){let X=90;for(;X<=Y;)X>G&&(U(q.build3(B.center,G,X-G,B.rx,B.ry)),G=X),X+=90;G<Y&&U(q.build3(B.center,G,Y-G,B.rx,B.ry))}else{let X=270;for(;X>=Y;)X<G&&(U(q.build3(B.center,G,X-G,B.rx,B.ry)),G=X),X-=90;G>Y&&U(q.build3(B.center,G,Y-G,B.rx,B.ry))}}else U(B)}return L;function U(B){let G=B.start(),Y=B.end();if(W.y>N!=G.y>N&&(W.x>k?G.x>k?L+=G.y>W.y?1:-1:W.y>G.y?(W.x-k)*(G.y-N)-(W.y-N)*(G.x-k)<0&&L--:(W.x-k)*(G.y-N)-(W.y-N)*(G.x-k)>0&&L++:G.x>k&&(W.y>G.y?(W.x-k)*(G.y-N)-(W.y-N)*(G.x-k)<0&&L--:(W.x-k)*(G.y-N)-(W.y-N)*(G.x-k)>0&&L++)),G.y>N!=Y.y>N){if(G.x>k)if(Y.x>k)L+=Y.y>G.y?1:-1;else if(B instanceof M)G.y>Y.y?(G.x-k)*(Y.y-N)-(G.y-N)*(Y.x-k)<0&&L--:(G.x-k)*(Y.y-N)-(G.y-N)*(Y.x-k)>0&&L++;else if(B instanceof q){let{center:X,isCCW:K,rx2:J}=B,se=(X.x-k)**2+(X.y-N)**2;G.y>Y.y?(K?se>J:se<J)&&L--:(K?se<J:se>J)&&L++}else throw new Error("not support!");else if(Y.x>k)if(B instanceof M)G.y>Y.y?(G.x-k)*(Y.y-N)-(G.y-N)*(Y.x-k)<0&&L--:(G.x-k)*(Y.y-N)-(G.y-N)*(Y.x-k)>0&&L++;else if(B instanceof q){let{center:X,isCCW:K,rx2:J}=B,se=(X.x-k)**2+(X.y-N)**2;G.y>Y.y?(K?se>J:se<J)&&L--:(K?se<J:se>J)&&L++}else throw new Error("not support!")}W=Y}}}w.pipUseSpaceAcceleratedStructure=_;function x(F,H,z,V){return v.hailun(F,H,z,V)}w.pointInTriangle=x;let v;(H=>{function F(z,V,W,L){let k=V.distance1(W),N=W.distance1(L),U=L.distance1(V),B=(k+N+U)/2;return Math.sqrt(B*(B-k)*(B-N)*(B-U))}H.hailun=F})(v||(v={}));let D;(W=>{function F(L,k){return N()%2!==0;function N(){let U=k.end(),B=0,{x:G,y:Y}=L;for(let K of k.primitives){if(U.y>Y?K.bbox().minY>Y:K.bbox().maxY<=Y){U=K.end();continue}if(K instanceof q&&(K.isCCW?Math.floor(K.startAngle/90)+1!==Math.ceil(K.endAngle()/90):Math.ceil(K.startAngle/90)-1!==Math.floor(K.endAngle()/90))){let J=K.startAngle,se=K.endAngle();if(K.sweepAngle>0){let ce=90;for(;ce<=se;)ce>J&&(X(q.build3(K.center,J,ce-J,K.rx,K.ry)),J=ce),ce+=90;J<se&&X(q.build3(K.center,J,se-J,K.rx,K.ry))}else{let ce=270;for(;ce>=se;)ce<J&&(X(q.build3(K.center,J,ce-J,K.rx,K.ry)),J=ce),ce-=90;J>se&&X(q.build3(K.center,J,se-J,K.rx,K.ry))}}else X(K)}return B;function X(K){let J=K.start(),se=K.end();if(U.y>Y!=J.y>Y&&(U.x>G?J.x>G?B+=J.y>U.y?1:-1:U.y>J.y?(U.x-G)*(J.y-Y)-(U.y-Y)*(J.x-G)<0&&B--:(U.x-G)*(J.y-Y)-(U.y-Y)*(J.x-G)>0&&B++:J.x>G&&(U.y>J.y?(U.x-G)*(J.y-Y)-(U.y-Y)*(J.x-G)<0&&B--:(U.x-G)*(J.y-Y)-(U.y-Y)*(J.x-G)>0&&B++)),J.y>Y!=se.y>Y){if(J.x>G)if(se.x>G)B+=se.y>J.y?1:-1;else if(K instanceof M)J.y>se.y?(J.x-G)*(se.y-Y)-(J.y-Y)*(se.x-G)<0&&B--:(J.x-G)*(se.y-Y)-(J.y-Y)*(se.x-G)>0&&B++;else if(K instanceof q){let{center:ce,isCCW:te,rx2:oe}=K,$=(ce.x-G)**2+(ce.y-Y)**2;J.y>se.y?(te?$>oe:$<oe)&&B--:(te?$<oe:$>oe)&&B++}else throw new Error("not support!");else if(se.x>G)if(K instanceof M)J.y>se.y?(J.x-G)*(se.y-Y)-(J.y-Y)*(se.x-G)<0&&B--:(J.x-G)*(se.y-Y)-(J.y-Y)*(se.x-G)>0&&B++;else if(K instanceof q){let{center:ce,isCCW:te,rx2:oe}=K,$=(ce.x-G)**2+(ce.y-Y)**2;J.y>se.y?(te?$>oe:$<oe)&&B--:(te?$<oe:$>oe)&&B++}else throw new Error("not support!")}U=se}}}W.ray=F;function H(L,k){if(N()){let{rx2:U,center:B}=k.primitives[0];return L.distance2(B)<U}return null;function N(){let U,B;if(k.primitives[0]instanceof q)U=k.primitives[0].center,B=k.primitives[0].rx;else return!1;for(let G=1;G<k.primitives.length;G++){let Y=k.primitives[G];if(Y instanceof q){if(ne.eq(U.x,Y.center.x)&&ne.eq(U.y,Y.center.y)&&ne.eq(B,Y.rx))continue;return!1}else return!1}return!0}}W.optimise=H;function z(L,k){let U=k.bbox(),{x:B,y:G}=L,Y=[K=>{let J=K.start().x,se=K.start().y,ce=K.end().x,te=K.end().y;{let oe=h.Precision.equals(se,G),$=h.Precision.equals(te,G);if(oe===$)return null;let fe=h.Precision.corridor(J,B,U.maxX),Oe=h.Precision.corridor(ce,B,U.maxX);return(!fe||!Oe)&&!h.Precision.corridor((ce-J)/(te-se)*(G-se)+J,B,U.maxX)?null:oe===null?$?!0:null:$===null?oe?!1:null:$}}],X=K=>{let J=0;return k.primitives.forEach(se=>{if(K.line.bbox().isIntersect(se.bbox().extendOfSize(1e-5)))if(se instanceof q)h.Method.cutArc2(se).forEach(ce=>{let te=K.pos(ce);te===!0?J++:te===!1&&J--});else{let ce=K.pos(se);ce===!0?J++:ce===!1&&J--}}),J};for(let K=0;K<1;K++)return X({line:new M(L,new S(U.maxX,L.y)),pos:Y[0]})%2!==0}W.ray1=z;function V(L,k){let N=B=>{if(B instanceof M){let G=w.calculateVectorAngle(B.start(),L)-w.calculateVectorAngle(B.end(),L);return Math.abs(G)===180?null:(G<-180&&(G+=360),G>180&&(G-=360),G>180&&G<-180&&ks.error(),G)}else if(B instanceof q){let G=w.calculateVectorAngle(B.start(),L)-w.calculateVectorAngle(B.end(),L);G<-180&&(G+=360),G>180&&(G-=360),G>180&&G<-180&&ks.error();let Y=w.pointInsideArcCircle(L,B);return Y===null?null:Y?360-G:G}else ks.error()},U=0;for(let B=0;B<k.primitives.length;B++){let G=N(k.primitives[B]);if(G===null)return!0;U+=G}return!ne.eq(U,0)}W.circular=V})(D||(D={}))})(l=h.Position||(h.Position={}));let c;(g=>{function u(y,b){let P=y.length;if(P===0)return null;if(P===1)return y[0];let T=y[0];for(let I=1;I<P;I++)b(T,y[I])>0&&(T=y[I]);return T}g.extremalNumb=u;function d(y,b){let P=y.length;if(P===0)return null;if(P===1)return y[0];let T=y[0];for(let I=1;I<P;I++)b(T,y[I])&&(T=y[I]);return T}g.extremalBool=d;function p(y,b,P,T,I="quickSelect"){switch(I){case"quickSelect":return m.topKQuickSelect(y,b,P,T);default:ks.error()}}g.topK=p;let m;(T=>{function y(I,C,E,O){let _=I.slice();if(O>0&&O<=E-C+1){let x=P(_,C,E,(v,D)=>v<D);return x-C===O-1?_[x]:x-C>O-1?y(_,C,x-1,O):y(_,x+1,E,O-x+C-1)}return null}T.topKQuickSelect=y;function b(I,C){return this.sort(I,(E,O)=>E<=O)[C]}T.sortIndex=b;function P(I,C,E,O){let _=I[C];for(;C<E;){for(;C<E&&!O(I[E],_);)--E;for(I[C]=I[E];C<E&&O(I[C],_);)++C;I[E]=I[C]}return I[C]=_,C}})(m||(m={}))})(c=h.Top||(h.Top={}))})(nu||(nu={}));var XY;(t=>{function o(e){if(e instanceof ge)return new Zo([e]);if(e instanceof Zo)return e;if(e instanceof Bt)return new Zo(e.items);ks.error()}t.getPolygon=o})(XY||(XY={}));var ks;(a=>{function o(l,c=!0){if(c){throw console.log(l||""),new Error;return}throw new Error(l||"")}a.error=o;function t(){return typeof window<"u"?window._MSG_BUS_=window._MSG_BUS_||new qY.MessageBus:new qY.WorkerMessageBridge(new qY.MessageBus,self)}a.getBus=t;function e(l){let c=performance.now();for(;performance.now()-c<l;);}a.sleep=e;function r(){return new i.Nor}a.Table=r;let i;(c=>{class l{constructor(){this.tab={}}add(u,d){this.tab[u]=d}print(){console.table(this.tab)}}c.Nor=l})(i||(i={}));let n;(c=>{class l{constructor(){this.scal=new Map;this.scal1=new Map}fun(u,d){this.mark(u);let p=d();return this.mark(u),p}mark(u){return this.scal.get(u)===void 0?this.scal.set(u,performance.now()):this.scal1.set(u,performance.now()-this.scal.get(u)),this}cout(){let u=r();this.scal1.forEach((d,p)=>u.add(p,{v:d})),u.print()}}c.Nor=l})(n||(n={}));function s(){return new n.Nor}a.Clok=s})(ks||(ks={}));var yl=re.getInstance(),pS=class{constructor(){this.constraintMap=new Rre;this.forceModelPairClearanceMap=new Map;this.ruleItemCache=new Map;this.getSafeClearance=(t,e,r,i)=>{let n=t.getClearance(e,r,i);return!$i.getInstance().checkSameNet&&ne.eq(n,0)?-1:n}}getRuleItem(t,e=!1){let r=t instanceof xi,i=r?t.globalIndex:t.id;if(this.ruleItemCache.has(i))return this.ruleItemCache.get(i);let n=r?ha(t):t;return e&&(n.shapeType=12),this.ruleItemCache.set(i+e,n),n}getShape2Clearance(t,e,r,i,n,s){if($i.getInstance().useForceModelPairClearance){let d=this.getModelPairClearance(t,e,n,i);if(d!==void 0){let p=yl.getDefaultSafeSpacing();return p==null&&(yl.correctDefault(),p=yl.getDefaultSafeSpacing()),{rule:p,ruleType:"Safe Spacing",clearance:d,net:void 0}}}let a=this.getRuleItem(t,0==i||2==i),l=this.getRuleItem(e,1==i||2==i),c=s!=null?s:this.determineRuleType(a,l,i),h=this.generateConstraints(c,a,l,r),u;switch(c){case"safe":u=this.getSafeRuleInfos(a,l,h,n);break;case"other":u=this.getOtherRuleInfos(a,l,h);break;case"creepage":u=this.getCreepageRuleInfos(a,l,h,n);break;case"diff":if(u=this.getDiffRuleInfos(a,l,h,n),u!=null)return u;h=this.generateConstraints("safe",a,l,r),u=this.getSafeRuleInfos(a,l,h,n);break}return u}determineRuleType(t,e,r){return r==2||[t.shapeType,e.shapeType].includes(16)?"other":t.shapeType===0&&e.shapeType===0?"diff":"safe"}generateConstraints(t,e,r,i,n,s){let a=[e,r],l=s,c=(d,p)=>p.clearance>d.clearance;switch(t){case"safe":let d=e.shapeType===14||r.shapeType===14,p=e.shapeType===13||r.shapeType===13;(e.shapeType!==0||r.shapeType!==0||ei.getShape2NetDiff(e,r)==null)&&(d?t="plane":p&&(t="copper")),l=(m=>this.getSafeClearance(m,e.shapeType,r.shapeType,n));break;case"other":a=a.filter(m=>m.shapeType===16||m.shapeType==2||m.shapeType==12),l=(m=>this.getOtherClearance(e,r,m));break;case"diff":l=(m=>this.getDiffClearance(m,n));break;case"creepage":l=(m=>this.getCreepageClearance(e,r,m)),c=(m,g)=>g.clearance<m.clearance;break}if(l==null)return null;let h=this.getConstraintRuleByCache2(a,t,i).map(d=>({rule:d,clearance:l(d)})),u=nu.Top.extremalBool(h,c);return h=null,u?u.rule:null}getRuleForDiffWidth(t,e){let r=this.getRuleItem(t),i=ei.getShapeNetDiff(r);if(i==null)return null;let n=this.getConstraintRuleByCache(r,"diff",e);if(n==null){let s=i.differentialPhysics;n=yl.getDifferentialPhysics(s)||null}return n}getRuleForTrackWidth(t,e){let r=this.getRuleItem(t),i=this.getConstraintRuleByCache(r,"track",e);if(i==null){let n=yl.getNet(r.net);n!=null?i=yl.getTrackPhysics(n.trackPhysics)||null:i=yl.getDefaultTrackPhysics()||null}return i}getRuleForViaRadius(t,e){let r=this.getRuleItem(t),i=this.getConstraintRuleByCache(r,"radius",e);if(i==null){if(r.viaName&&r.viaName!==""){let s=re.getInstance().getDefaultBlindPhysics();if(s){let a=s.getBlindVia(r.viaName);if(a&&a.viaSizeRule!=="")return re.getInstance().getRadiusPhysicsByName(a.viaSizeRule)||null}}let n=yl.getNet(r.net);n!=null?i=yl.getRadiusPhysics(n.radiusPhysics)||null:i=yl.getDefaultRadiusPhysics()||null}return i}getRuleForBlind(t){let e=yl.getNet(t.net),r;return e!=null?r=yl.getBlindPhysics(e.blindViaPhysics):r=yl.getDefaultBlindPhysics(),r}getOtherClearance(t,e,r){let i=0;return[t.shapeType,e.shapeType].includes(2)?i=r.thru2SmdClearance:[t.shapeType,e.shapeType].includes(12)?i=r.holeClearance:i=r.deviceClearance,!$i.getInstance().checkSameNet&&ne.eq(i,0)?-1:i}getCreepageClearance(t,e,r,i){let n=r.creepageDistance;return!t.net||!e.net||t.net===e.net||!$i.getInstance().checkSameNet&&ne.eq(n,0)?-1:n}getDiffClearance(t,e){let r=t.getDifferentialPairSpacingMin(e);return!$i.getInstance().checkSameNet&&ne.eq(r,0)?-1:r}getDiffRuleInfos(t,e,r,i){let n=ei.getShape2NetDiff(t,e),s=l=>this.getDiffClearance(l,i);if(n==null)return;let a=r;if(a==null&&t.net!=""&&e.net!=""){if(yl.getRule4Order(t,e,"BetweenNetRule",0,i).length>0)return;let c=n.differentialPhysics;a=yl.getDifferentialPhysics(c)}if(a){let l=s(a);return{rule:a,ruleType:"Differential Pair Error",clearance:l}}}getOtherRuleInfos(t,e,r){let i=a=>this.getOtherClearance(t,e,a),n=r;n==null&&(n=yl.getDefaultOtherSpacing(),n==null&&(yl.correctDefault(),n=yl.getDefaultOtherSpacing()));let s=i(n);return(t.shapeType===15||e.shapeType===15)&&(s=0),{rule:n,ruleType:"Other Spacing",clearance:s}}getCreepageRuleInfos(t,e,r,i,n){var c;let s=n||(h=>this.getCreepageClearance(t,e,h,i)),a=r;if(a==null){let h=["BetweenNetRule","NetRule"];for(let u of h){let d=yl.getRule4Order(t,e,u,2,i);if(d.length>0){let p=d.map(m=>({rule:m,clearance:s(m)}));a=(c=nu.Top.extremalBool(p,(m,g)=>g.clearance<m.clearance))==null?void 0:c.rule,p=null;break}}}a==null&&(a=yl.getDefaultCreepageSpacing(),a==null&&(yl.correctDefault(),a=yl.getDefaultCreepageSpacing()));let l=s(a);return(t.shapeType===15||e.shapeType===15)&&(l=0),{rule:a,ruleType:"Creepage Distance",clearance:l}}isBridgeCopperRuleItem(t){return t&&"isBridgingCopper"in t&&t.isBridgingCopper&&Array.isArray(t.nets)}getSafeRuleInfos(t,e,r,i,n){var h;let s=n||(u=>this.getSafeClearance(u,t.shapeType,e.shapeType,i)),a=r,l="";if(a==null){let u=t.shapeType===14||e.shapeType===14,d=t.shapeType===13||e.shapeType===13,p=["BetweenNetRule","NetRule"],m=["BetweenNetRule","CustomPlaneRule","NetRule"],g=u||d?m:p,y=this.isBridgeCopperRuleItem(t),b=this.isBridgeCopperRuleItem(e),P=y?t.nets.length==0?[""]:t.nets:[t.net],T=b?e.nets.length==0?[""]:e.nets:[e.net],I=new Set,C=[];if(y&&b){for(let E of P)for(let O of T){if(E===O||E==null||O==null)continue;let _=yl.getRule4Order(t,e,"NetRule",0,i,[E,O]);_.length>0&&C.push(..._.map(x=>({rule:x,net:E})))}if(C.length>0){let E=C.map(_=>({rule:_.rule,clearance:s(_.rule),net:_.net})),O=nu.Top.extremalBool(E,(_,x)=>x.clearance>_.clearance);E=null,a=O.rule,l=O.net}}else if(y||b){for(let E of g){for(let O of P)for(let _ of T){if(O===_||O==null||_==null)continue;let x=`${O}-${_}`,v=`${_}-${O}`;if(!I.has(x)){let D=yl.getRule4Order(t,e,E,0,i,[O,_]);if(D.length>0){let w=y?O:_;C.push(...D.map(F=>({rule:F,net:w}))),["BetweenNetRule","CustomPlaneRule"].includes(E)&&(I.add(x),I.add(v))}}}if(I.size>2&&I.size/2===P.length*T.length)break}if(C.length>0){let E=C.map(_=>({rule:_.rule,clearance:s(_.rule),net:_.net})),O=nu.Top.extremalBool(E,(_,x)=>x.clearance>_.clearance);E=null,a=O.rule,l=O.net}}else for(let E of g){let O=yl.getRule4Order(t,e,E,0,i);if(O.length>0){let _=O.map(x=>({rule:x,clearance:s(x)}));a=(h=nu.Top.extremalBool(_,(x,v)=>v.clearance>x.clearance))==null?void 0:h.rule,_=null;break}}}a==null&&(a=yl.getDefaultSafeSpacing(),a==null&&(yl.correctDefault(),a=yl.getDefaultSafeSpacing()));let c=s(a);return(t.shapeType===15||e.shapeType===15)&&(c=0),{rule:a,ruleType:"Safe Spacing",clearance:c,net:l||void 0}}getConstraintRuleByCache2(t,e,r){let i=[],n=["copper","plane"].includes(e),s=t.every(l=>l.shapeType===13),a=n?t.find(l=>[13,14].includes(l.shapeType)):null;for(let l of t){a=a||l;let c=this.getConstraintRuleByCache(l,e,r,a||l,s);c&&i.push(c)}return i}getConstraintRuleByCache(t,e,r,i,n=!1){if(!r){let s=n?t.regionId:t.id,a=this.constraintMap._constraintMap[s];r=a?Array.from(a):void 0}return r!=null&&r.length?this.getConstraintRule(r,e,i!=null?i:t):null}getConstraintRule(t,e,r){if(!t.length)return null;let i=r&&[12,11].includes(r.layerId);t=t.filter(u=>{if(u instanceof or)return u.layerId==12||i||!i&&u.layerId==(r==null?void 0:r.layerId)});let n=[],a=zY(t.map(u=>{if(u instanceof or){let d=`${Tr}${u.number}`;return n.push({sortValue:d,originalValue:u.globalIndex}),d}else return n.push({sortValue:u,originalValue:u}),u})).map(u=>n.find(d=>d.sortValue===u).originalValue)[0],l=yl.getRegion(a);if(!l)return null;let c=t.find(u=>u instanceof or&&u.globalIndex===a);if(r&&c&&c.layerId!==12&&!i&&r.layerId!==c.layerId)return null;let h=null;switch(e){case"safe":l.safeClearance&&(h=yl.getSafeSpacing(l.safeClearance)||null);break;case"other":l.otherClearance&&(h=yl.getOtherSpacing(l.otherClearance)||null);break;case"creepage":l.creepageClearance&&(h=yl.getCreepageSpacing(l.creepageClearance)||null);break;case"track":l.track&&(h=yl.getTrackPhysics(l.track)||null);break;case"diff":l.diff&&(h=yl.getDifferentialPhysics(l.diff)||null);break;case"radius":l.radius&&(h=yl.getRadiusPhysics(l.radius)||null);break;case"copper":l.safeCopperPlane&&(h=yl.getSafeSpacing(l.safeCopperPlane)||null),!h&&l.safeClearance&&(h=yl.getSafeSpacing(l.safeClearance)||null);break;case"plane":l.safeInnerPlane&&(h=yl.getSafeSpacing(l.safeInnerPlane)||null),!h&&l.safeClearance&&(h=yl.getSafeSpacing(l.safeClearance)||null);break}return h}setModelPairClearance(t,e,r,i,n){if($i.getInstance().useForceModelPairClearance&&this.forceModelPairClearanceMap){let s=this.generateModelPairKey(e,r,i,n);this.forceModelPairClearanceMap.set(s,t)}}getModelPairClearance(t,e,r,i){if($i.getInstance().useForceModelPairClearance&&this.forceModelPairClearanceMap){let n=this.generateModelPairKey(t,e,r,i);return this.forceModelPairClearanceMap.get(n)}}generateModelPairKey(t,e,r,i){let n,s=ei.isSingleLayerShape(t),a=ei.isSingleLayerShape(e);return!s&&a?(i===0?i=1:i===1&&(i=0),n=`${e.globalIndex}-${t.globalIndex}-${r}`):n=`${t.globalIndex}-${e.globalIndex}-${r}`,i?`${n}-${i}`:n}};var T3=class{getMaxClearance(t){return Math.max(re.getInstance().getMaxSafe(t),re.getInstance().getItemMaxClearance(12))}getSafeClearance(t,e,r,i){let n=this.getShapeType(t,r),s=this.getShapeType(e,r),a=t.shape.net,l=e.shape.net,c=i!=null?[i]:[t.regionId,e.regionId];return this.getSafeClearance2(n,s,a,l,c)}getSafeClearance1(t,e,r,i,n){let s=this.getShapeType(t,r),a=this.getShapeType(e,i),l=t.shape.net,c=e.shape.net,h=n!=null?[n]:[t.regionId,e.regionId];return s==12&&a==12?this.getHoleClearance(h):this.getSafeClearance2(s,a,l,c,h)}getSafeClearance2(t,e,r,i,n=[],s){let a=zY(n)[0],l=t==0&&e==0&&this.isDiffPair(r,i);if(a!=null){let m=l?"diff":"safe",g=new pS().getConstraintRule(n,m);if(g instanceof d2)return g.getDifferentialPairSpacingMin(s);if(g instanceof aI)return g.getClearance(t,e,s)}let c=this.getBetweenNetRule(t,e,r,i,s);if(c!=null)return c.getClearance(t,e,s);if(l){let m=this.getDiffPair(r);return re.getInstance().getDifferentialPhysics(m.differentialPhysics).getDifferentialPairSpacingMin(s)}let h=re.getInstance().getSafeSpacingByNet(r,$v(t,e)),u=re.getInstance().getSafeSpacingByNet(i,$v(t,e,!0)),d=[h,u],p=-1;for(let m of d){let g=m.getClearance(t,e,s);p=Math.max(p,g)}if(p!=-1)return p;for(let m of d){let g=m.getClearance(t,e,s);p=Math.max(p,g)}return p}getHoleClearance(t=[]){if(zY(t)[0]!=null){let r=new pS().getConstraintRule(t,"other");if(r instanceof p2)return r.holeClearance}else return re.getInstance().getDefaultOtherSpacing().holeClearance}isDiffPair(t,e){let r=re.getInstance().getNet(t);if(r!=null&&r.netDifferential!=null){let i=r.netDifferential;if(t!=e&&i.hasNet(t)&&i.hasNet(e))return!0}return!1}getDiffPair(t){let e=re.getInstance().getNet(t);return e!=null&&e.netDifferential!=null?e.netDifferential:null}getBetweenNetRule(t,e,r,i,n){let s=re.getInstance().getBetweenNetRuleByNet(t,e,r,i,n);return s!=null?re.getInstance().getSafeSpacing(s.name):null}getShapeType(t,e){switch(t.type){case"Track":return 0;case"ArcTrack":return 0;case"Region":return 6;case"BoxShape":return 10;case"Line":return 9;case"Prohibit":return 15;case"Slot":return 8;case"Via":return e.equals($r.MULTI)?12:5;case"BlindVia":return e.equals($r.MULTI)?12:5;case"Pad":return t.layerId==12?e.equals($r.MULTI)?12:2:1;case"Outline":return 11}}};var T9t={ADAPT_ALL:{name:"Fit All in Window",cmd:"ADAPT_ALL",tips:""},ADAPT_BOARDOUTLINE:{name:"Fit Board Outline View",cmd:"ADAPT_BOARDOUTLINE",tips:""},ADAPT_SELECTED:{name:"Fit Selection View",cmd:"ADAPT_SELECTED",tips:""}},vFe=T9t;var I9t={ADDWITH_ROUTING:{name:"Add Routing",cmd:"ADDWITH_ROUTING",tips:""},ADDWITH_VIA:{name:"Add Via",cmd:"ADDWITH_VIA",tips:""},ADDVIA_FENCE:{name:"Add Via Fence...",cmd:"ADDVIA_FENCE",tips:""},ADDWITH_TESTPOINTER:{name:"Add Test Point",cmd:"ADDWITH_TESTPOINTER",tips:""},ADDWITH_TEARS:{name:"Add Teardrops...",cmd:"ADDWITH_TEARS",tips:""},ADDWITH_NODE:{name:"Add Node",cmd:"ADDWITH_NODE",tips:""},ADDWITH_ARC:{name:"Add Arc",cmd:"ADDWITH_ARC",tips:""},ADDWITH_TRACK:{name:"Add Track",cmd:"ADDWITH_TRACK",tips:""},ADDWITH_EQUALLENGTHTUNING:{name:"Equal Length Tunning",cmd:"ADDWITH_EQUALLENGTHTUNING",tips:""},ADD_SOLDER_MASK:{name:"Add Solder Mask Region",cmd:"ADD_SOLDER_MASK",tips:""}},xFe=I9t;var C9t={ALIGNMENT:{name:"Alignment",cmd:"ALIGNMENT",tips:""},align_top:{name:"Align Top",cmd:"align_top",tips:""},align_vertical_center:{name:"Align Vertical Centers",cmd:"align_vertical_center",tips:""},align_bottom:{name:"Align Bottom",cmd:"align_bottom",tips:""},align_left:{name:"Align Left",cmd:"align_left",tips:""},align_horizontal_center:{name:"Align Horizontal Centers",cmd:"align_horizontal_center",tips:""},align_right:{name:"Align Right",cmd:"align_right",tips:""},align_grid:{name:"Align Grid",cmd:"align_grid",tips:""}},RFe=C9t;var S9t={COMBINATION:{name:"Group",cmd:"COMBINATION",tips:""},COMBINATION_SELECT:{name:"Group Selected",cmd:"COMBINATION_SELECT",tips:""},COMBINATION_JOIN:{name:"Join Group",cmd:"COMBINATION_JOIN",tips:""},REUSE_LAYOUT_ROUTE:{name:"Reuse Layout Route",cmd:"REUSE_LAYOUT_ROUTE",tips:""},COMBINATION_CANCEL:{name:"Ungroup",cmd:"COMBINATION_CANCEL",tips:""},COMBINATION_MOVE_OUT:{name:"Remove From Group",cmd:"COMBINATION_MOVE_OUT",tips:""}},DFe=S9t;var E9t={RAISE_PRIORITY:{name:"Raise Priority",cmd:"RAISE_PRIORITY",tips:""},LOWER_PRIORITY:{name:"Lower Priority",cmd:"LOWER_PRIORITY",tips:""},COPPER_AREA:{name:"Copper Region",cmd:"COPPER_AREA",tips:""},HIDE_SELECTED_COPPER_FILLS:{name:"Hide Selected Copper Fills",cmd:"HIDE_SELECTED_COPPER_FILLS",tips:""},SHOW_SELECTED_COPPER_FILLS:{name:"Show Selected Copper Fills",cmd:"SHOW_SELECTED_COPPER_FILLS",tips:""},HIDE_COPPER_FILLS:{name:"Hide All Copper",cmd:"HIDE_COPPER_FILLS",tips:""},SHOW_COPPER_FILLS:{name:"Show All Copper",cmd:"SHOW_COPPER_FILLS",tips:""},REBUILD_SELECTED:{name:"Rebuild Selected",cmd:"REBUILD_SELECTED",tips:""},REBUILD_ALL:{name:"Rebuild All",cmd:"REBUILD_ALL",tips:""},COPPER_MANAGER:{name:"Copper Manager...",cmd:"COPPER_MANAGER",tips:""}},wFe=E9t;var O9t={DISTRIBUTION:{name:"Distribute",cmd:"DISTRIBUTION",tips:""},distribute_horizontal_equidistant:{name:"Distribute Horizontally",cmd:"distribute_horizontal_equidistant",tips:""},distribute_vertical_equidistant:{name:"Distribute Vertically",cmd:"distribute_vertical_equidistant",tips:""},distribute_left_side_edge_equidistant:{name:"Distribute Left Edges Equidistantly",cmd:"distribute_left_side_edge_equidistant",tips:""},distribute_top_side_edge_equidistant:{name:"Distribute Top Edges Equidistantly",cmd:"distribute_top_side_edge_equidistant",tips:""},distribute_horizontal_by_center_distance:{name:"Distribute Horizontally by Center Distance...",cmd:"distribute_horizontal_by_center_distance",tips:""},distribute_vertical_by_center_distance:{name:"Distribute Vertically by Center Distance...",cmd:"distribute_vertical_by_center_distance",tips:""},distribute_horizontal_by_edges_distance:{name:"Distribute Horizontally by Edges Distance...",cmd:"distribute_horizontal_by_edges_distance",tips:""},distribute_vertical_by_edges_distance:{name:"Distribute Vertically by Edges Distance...",cmd:"distribute_vertical_by_edges_distance",tips:""},distribute:{name:"Distribute Array",cmd:"distribute",tips:""},component_distribute_by_region:{name:"Component Distribute By Region",cmd:"component_distribute_by_region",tips:""}},LFe=O9t;var A9t={ONLY_SELECT:{name:"Apply only selected components",cmd:"ONLY_SELECT",tips:""},CURRENT_PCB:{name:"Apply current PCB",cmd:"CURRENT_PCB",tips:""},ALL_PROJECT:{name:"Apply the whole project",cmd:"ALL_PROJECT",tips:""}},MFe=A9t;var _9t={FLIP:{name:"Flip",cmd:"FLIP",tips:""},FLIP_LEFTANDRIGHT:{name:"Flip Right and Left",cmd:"FLIP_LEFTANDRIGHT",tips:""},FLIP_UPANDDOWN:{name:"Flip Up and Down",cmd:"FLIP_UPANDDOWN",tips:""},FLIP_LEFTANDRIGHT_BY_REFER_POINT:{name:"Flip Right and Left by Reference Point",cmd:"FLIP_LEFTANDRIGHT_BY_REFER_POINT",tips:""},FLIP_UPANDDOWN_BY_REFER_POINT:{name:"Flip Up and Down by Reference Point",cmd:"FLIP_UPANDDOWN_BY_REFER_POINT",tips:""}},NFe=_9t;var v9t={GRID:{name:"Grid Size",cmd:"GRID",tips:""},SNAP_SIZE:{name:"Snap Size",cmd:"SNAP_SIZE",tips:""},GRIDTYPE:{name:"Grid Type",cmd:"GRIDTYPE",tips:""},GRID_1MIL:{name:"1mil",cmd:"GRID_1MIL",tips:""},GRID_5MIL:{name:"5mil",cmd:"GRID_5MIL",tips:""},GRID_10MIL:{name:"10mil",cmd:"GRID_10MIL",tips:""},GRID_20MIL:{name:"20mil",cmd:"GRID_20MIL",tips:""},GRID_25MIL:{name:"25mil",cmd:"GRID_25MIL",tips:""},GRID_50MIL:{name:"50mil",cmd:"GRID_50MIL",tips:""},GRID_0_025MM:{name:"0.025mm",cmd:"GRID_0_025MM",tips:""},GRID_0_1MM:{name:"0.100mm",cmd:"GRID_0_1MM",tips:""},GRID_0_25MM:{name:"0.250mm",cmd:"GRID_0_25MM",tips:""},GRID_0_5MM:{name:"0.500mm",cmd:"GRID_0_5MM",tips:""},GRID_1_0MM:{name:"1.000mm",cmd:"GRID_1_0MM",tips:""},GRID_CUSTOM:{name:"Custom: x(5mil), y(5mil)",cmd:"GRID_CUSTOM",tips:""},GRID_SNAP_KEEP_RATIO:{name:"Grid/Snap Keep Ratio",cmd:"GRID_SNAP_KEEP_RATIO",tips:""},GRID_SETTING:{name:"Common Grid/Snap Setting...",cmd:"GRID_SETTING",tips:""},GRID_RANGE_SETTING:{name:"Grid Range Setting(Polar coordinate)...",cmd:"GRID_RANGE_SETTING",tips:""},GRID_COORDINATE:{name:"Cartesian Coordinate System",cmd:"GRID_COORDINATE",tips:""},POLAR_COORDINATE:{name:"Polar Coordinate System",cmd:"POLAR_COORDINATE",tips:""},GRID_TYPE_DOT:{name:"Grid Dot",cmd:"GRID_TYPE_DOT",tips:""},GRID_TYPE_GRID:{name:"Grid",cmd:"GRID_TYPE_GRID",tips:""},GRID_TYPE_NONE:{name:"None",cmd:"GRID_TYPE_NONE",tips:""}},kFe=v9t;var x9t={HIGHLIGHT_AND_UNHIGHLIGHT:{name:"Highlight/Unhighlight",cmd:"HIGHLIGHT_AND_UNHIGHLIGHT",tips:""},HIGHLIGHT_CANCELALL:{name:"Unhighlight All",cmd:"HIGHLIGHT_CANCELALL",tips:""},HIGHLIGHT_CANCEL:{name:"Unhighlight",cmd:"HIGHLIGHT_CANCEL",tips:""},HIGHLIGHT_CANCEL_NET:{name:"Unhighlight Net",cmd:"HIGHLIGHT_CANCEL_NET",tips:""},HIGHLIGHT_CANCEL_COMPONENT:{name:"Unhighlight Component",cmd:"HIGHLIGHT_CANCEL_COMPONENT",tips:""},HIGHLIGHT_CANCEL_SELECTED_OBJECTS:{name:"Unhighlight Selected",cmd:"HIGHLIGHT_CANCEL_SELECTED_OBJECTS",tips:""},HIGHLIGHT:{name:"Highlight",cmd:"HIGHLIGHT",tips:""},HIGHLIGHT_NET:{name:"Highlight Net",cmd:"HIGHLIGHT_NET",tips:""},HIGHLIGHT_COMPONENT:{name:"Highlight Component",cmd:"HIGHLIGHT_COMPONENT",tips:""},HIGHLIGHT_SELECTED_OBJECTS:{name:"Highlight Selected",cmd:"HIGHLIGHT_SELECTED_OBJECTS",tips:""}},BFe=x9t;var R9t={LOCKED:{name:"Locked",cmd:"LOCKED",tips:""},LOCKED_CANCEL:{name:"Unlock",cmd:"LOCKED_CANCEL",tips:""}},FFe=R9t;var D9t={ADD_NODE:{name:"Add Node",cmd:"ADD_NODE",tips:""},EDIT_NODE:{name:"Edit Node",cmd:"EDIT_NODE",tips:""},MOVE_NODE:{name:"Move Node",cmd:"MOVE_NODE",tips:""},DELETE_NODE:{name:"Delete Node",cmd:"DELETE_NODE",tips:""}},VFe=D9t;var w9t={OFFSET:{name:"Offset",cmd:"OFFSET",tips:""},OFFSET_RELATIVE:{name:"Relative Offset...",cmd:"OFFSET_RELATIVE",tips:""},OFFSET_ABSOLUTE:{name:"Absolute Offset...",cmd:"OFFSET_ABSOLUTE",tips:""}},GFe=w9t;var L9t={DEVICE_EDIT:{name:"Edit Device...",cmd:"DEVICE_EDIT",tips:""},EASY_DEVICE_EDIT:{name:"Edit Device",cmd:"DEVICE_EDIT",tips:""},SAVE_TO_LIBRARY:{name:"Save to The Library...",cmd:"SAVE_TO_LIBRARY",tips:""},UPDATE_COMPONENT:{name:"Update Project Library",cmd:"UPDATE_COMPONENT",tips:""},PACKAGE_EDIT_IN_PCB:{name:"Edit Footprint",cmd:"PACKAGE_EDIT_IN_PCB",tips:""},PACKAGE_EDIT:{name:"Edit Footprint",cmd:"PACKAGE_EDIT",tips:""},PACKAGE_REPLACE:{name:"Replace Footprint",cmd:"PACKAGE_REPLACE",tips:""},RECOVER_FOOTPRINT:{name:"Revert to Footprint Template",cmd:"RECOVER_FOOTPRINT",tips:""},PACKAGE_ATTR:{name:"Footprint Property",cmd:"PACKAGE_ATTR",tips:""}},UFe=L9t;var M9t={PREVIOUS_PAGE:{name:"Previous Page",cmd:"PREVIOUS_PAGE",tips:""},NEXT_PAGE:{name:"Next Page",cmd:"NEXT_PAGE",tips:""},GOTO_PAGE:{name:"Goto Page",cmd:"GOTO_PAGE",tips:""}},HFe=M9t;var N9t={Default:{name:"Default",cmd:"Default",tips:""},"Only Component":{name:"Only Component",cmd:"Only Component",tips:""},"Only Component Attribute":{name:"Only Component Attribute",cmd:"Only Component Attribute",tips:""},"Only Track":{name:"Only Track",cmd:"Only Track",tips:""},"Only Via":{name:"Only Via",cmd:"Only Via",tips:""},"Only Pad Pair":{name:"Only Pad Pair",cmd:"Only Pad Pair",tips:""},"Only Net":{name:"Only Net",cmd:"Only Net",tips:""},"Only Group":{name:"Only Group",cmd:"Only Group",tips:""},"Only Pad":{name:"Only Pad",cmd:"Only Pad",tips:""},"Only Line":{name:"Only Line",cmd:"Only Line",tips:""},PRIMITIV_COMPONENT:{name:"Component",cmd:"PRIMITIV_COMPONENT",tips:""},PRIMITIV_DEVICE_ATTR:{name:"Component-ATTR",cmd:"PRIMITIV_DEVICE_ATTR",tips:""},PRIMITIV_PAD:{name:"Pad",cmd:"PRIMITIV_PAD",tips:""},PAD_NUMBER:{name:"Pad Number",cmd:"PAD_NUMBER",tips:""},PRIMITIV_TRACK:{name:"Track",cmd:"PRIMITIV_TRACK",tips:""},PRIMITIV_PADPAIR:{name:"Pad Pairs",cmd:"PRIMITIV_PADPAIR",tips:""},PRIMITIV_SUTUREVIA:{name:"Suture Via",cmd:"PRIMITIV_SUTUREVIA",tips:""},PRIMITIV_2DLINE:{name:"Outline",cmd:"PRIMITIV_2DLINE",tips:""},PRIMITIV_VIA:{name:"Via",cmd:"PRIMITIV_VIA",tips:""},SECOND_COMBINATION:{name:"Group",cmd:"SECOND_COMBINATION",tips:""},PRIMITIV_BOARD:{name:"Board Outline",cmd:"PRIMITIV_BOARD",tips:""},PRIMITIV_SLOT:{name:"Slot Region",cmd:"PRIMITIV_SLOT",tips:""},PRIMITIV_POUR:{name:"Copper Region",cmd:"PRIMITIV_POUR",tips:""},PRIMITIV_ALL:{name:"All",cmd:"PRIMITIV_ALL",tips:""},MORE:{name:"More...",cmd:"MORE",tips:""}},WFe=N9t;var k9t={PLACE_VIA:{name:"Place Via",cmd:"PLACE_VIA",tips:""},PLACE_BURIEDHOLE:{name:"Place Blind/Buried Via",cmd:"PLACE_BURIEDHOLE",tips:""}},zFe=k9t;var B9t={RATLINES_SHOW:{name:"Show Ratline",cmd:"RATLINES_SHOW",tips:""},RATLINES_HIDE:{name:"Hide Ratline",cmd:"RATLINES_HIDE",tips:""}},YFe=B9t;var F9t={ROTATE:{name:"Rotate",cmd:"ROTATE",tips:""},rotate_left:{name:"Rotate Left",cmd:"rotate_left",tips:""},rotate_right:{name:"Rotate Right",cmd:"rotate_right",tips:""},rotate_reference_point:{name:"Rotate By Reference Point",cmd:"rotate_reference_point",tips:""}},jFe=F9t;var V9t={SETUP_WINDOWINGAREA:{name:"Add Solder Mask Region",cmd:"SETUP_WINDOWINGAREA",tips:""}},XFe=V9t;var G9t={STRETCHING:{name:"Stretch",cmd:"STRETCHING",tips:""},STRETCHING_PUSHAWAY:{name:"Push and Stretch",cmd:"STRETCHING_PUSHAWAY",tips:""}},qFe=G9t;var U9t={SYMBOL_UPDATE:{name:"Update Symbol",cmd:"SYMBOL_UPDATE",tips:""},SYMBOL_EDIT:{name:"Edit Symbol in Library",cmd:"SYMBOL_EDIT",tips:""},SYMBOL_REPLACE:{name:"Replace Symbol",cmd:"SYMBOL_REPLACE",tips:""}},$Fe=U9t;var H9t={TURNOVER:{name:"Flip to Opposite Side",cmd:"TURNOVER",tips:""}},KFe=H9t;var W9t={VIA_SIZE:{name:"Via Size",cmd:"VIA_SIZE",tips:""},VIA_SIZE_FOLLOWRULES:{name:"Follow Rule",cmd:"VIA_SIZE_FOLLOWRULES",tips:""},VIA_SIZE_RULESSETTING:{name:"Rule Setting...",cmd:"VIA_SIZE_RULESSETTING",tips:""},VIA_SIZE_COMMONLY_SETTING:{name:"Common Size Setting...",cmd:"VIA_SIZE_COMMONLY_SETTING",tips:""},VIA_SIZE_INPUT:{name:"Enter Via Size...",cmd:"VIA_SIZE_INPUT",tips:""},VIA_TYPE:{name:"Via Type",cmd:"VIA_TYPE",tips:""},VIA_TYPE_THROUGH_VIA:{name:"Through Via",cmd:"VIA_TYPE_THROUGH_VIA",tips:""},VIA_TYPE_RULESSETTING:{name:"Via Type Setting...",cmd:"VIA_TYPE_RULESSETTING",tips:""}},ZFe=W9t;var z9t={WIRING_AUTO:{name:"Auto Route",cmd:"WIRING_AUTO",tips:""},WIRING_AUTO_CONNECT:{name:"Connection",cmd:"WIRING_AUTO_CONNECT",tips:""},WIRING_AUTO_NET:{name:"Net",cmd:"WIRING_AUTO_NET",tips:""},WIRING_AUTO_ALL:{name:"All",cmd:"WIRING_AUTO_ALL",tips:""},WIRING_CLEAR:{name:"Unroute",cmd:"WIRING_CLEAR",tips:""},WIRING_CLEAR_CONNECT:{name:"Connection",cmd:"WIRING_CLEAR_CONNECT",tips:""},WIRING_CLEAR_NET:{name:"Net",cmd:"WIRING_CLEAR_NET",tips:""},WIRING_CLEAR_ALL:{name:"All",cmd:"WIRING_CLEAR_ALL",tips:""},WIRING_CORNER:{name:"Routing Corner",cmd:"WIRING_CORNER",tips:""},WIRING_CORNER_LINE45:{name:"Line 45\xB0",cmd:"WIRING_CORNER_LINE45",tips:""},WIRING_CORNER_LINE90:{name:"Line 90\xB0",cmd:"WIRING_CORNER_LINE90",tips:""},WIRING_CORNER_ARC45:{name:"Arc 45\xB0",cmd:"WIRING_CORNER_ARC45",tips:""},WIRING_CORNER_ARC90:{name:"Arc 90\xB0",cmd:"WIRING_CORNER_ARC90",tips:""},WIRING_CORNER_ARC:{name:"Arc Free Angle",cmd:"WIRING_CORNER_ARC",tips:""},WIRING_CORNER_FREEANGLE:{name:"Line Free Angle",cmd:"WIRING_CORNER_FREEANGLE",tips:""},WIRING_MODE:{name:"Routing Mode",cmd:"WIRING_MODE",tips:""},WIRING_MODE_PUSHAWAY:{name:"Push",cmd:"WIRING_MODE_PUSHAWAY",tips:""},WIRING_MODE_SURROUND_AND_PUSHAWAY:{name:"Around & Push",cmd:"WIRING_MODE_SURROUND_AND_PUSHAWAY",tips:""},WIRING_MODE_SURROUND:{name:"Around",cmd:"WIRING_MODE_SURROUND",tips:""},WIRING_MODE_OBSTRUCT:{name:"Block",cmd:"WIRING_MODE_OBSTRUCT",tips:""},WIRING_MODE_IGNORE:{name:"Ignore",cmd:"WIRING_MODE_IGNORE",tips:""},WIRING_WIDTH:{name:"Routing Width",cmd:"WIRING_WIDTH",tips:"",option:{i18nContext:"router"}},WIRING_WIDTH_FOLLOWRULES:{name:"Follow Rule",cmd:"WIRING_WIDTH_FOLLOWRULES",tips:""},WIRING_WIDTH_RULESSETTING:{name:"Rule Setting...",cmd:"WIRING_WIDTH_RULESSETTING",tips:""},WIRING_WIDTH_COMMONLY_SSETTING:{name:"Common Width Setting...",cmd:"WIRING_WIDTH_COMMONLY_SSETTING",tips:""},WIDTH:{name:"Width...",cmd:"WIDTH",tips:""},WIRING_WIDTH_INPUT:{name:"Enter Width...",cmd:"WIRING_WIDTH_INPUT",tips:""},AUTO_TRIM_SILKSCREEN:{name:"Auto Trim Silkscreen",cmd:"AUTO_TRIM_SILKSCREEN",tips:""}},JFe=z9t;var Y9t={SINGlE_ROUTE:{name:"Single Routing Mode",cmd:"SINGlE_ROUTE",tips:""},CHANGETRACK:{name:"Change Track",cmd:"CHANGETRACK",tips:""},CHANGECONTROLTRACK:{name:"Switch Control Line",cmd:"CHANGECONTROLTRACK",tips:""}},QFe=Y9t;var j9t={INCREASE_GAP:{name:"Increase Gap",cmd:"INCREASE_GAP",tips:""},DECREASE_GAP:{name:"Decrease Gap",cmd:"DECREASE_GAP",tips:""},GAP_STEP_VALUE:{name:"Gap Step Value...",cmd:"GAP_STEP_VALUE",tips:""},EQUAL_LENGTH_TUNING_SETTING:{name:"Equal Length Tunning Setting...",cmd:"EQUAL_LENGTH_TUNING_SETTING",tips:""},NET_CLASS_LENGTH_TOLERANCE_RULE_SETTING:{name:"Net Class Length Tolerance Rule Setting...",cmd:"DIFFERENTIAL_PAIR_LENGTH_TOLERANCE_RULE_SETTING",tips:""},DIFFERENTIAL_PAIR_LENGTH_TOLERANCE_RULE_SETTING:{name:"Differential Pair Length Tolerance Rule Setting...",cmd:"DIFFERENTIAL_PAIR_LENGTH_TOLERANCE_RULE_SETTING",tips:""},IGNORE_DRC:{name:"Ignore DRC",cmd:"IGNORE_DRC",tips:""}},eVe=j9t;var X9t={CONVERT_TO:{name:"Convert to",cmd:"CONVERT_TO",tips:""},CONVERT_TO_PAD:{name:"Convert to Pad",cmd:"CONVERT_TO_PAD",tips:""},CONVERT_TO_TRACK:{name:"Convert to Track",cmd:"CONVERT_TO_TRACK",tips:""},CONVERT_TO_2D_LINE:{name:"Convert to Line",cmd:"CONVERT_TO_2D_LINE",tips:""},CONVERT_TO_BOARD_OUTLINE:{name:"Convert to Board Outline",cmd:"CONVERT_TO_BOARD_OUTLINE",tips:""},CONVERT_TO_CONSTRAINT_REGION:{name:"Convert to Constraint Region",cmd:"CONVERT_TO_CONSTRAINT_REGION",tips:""},CONVERT_TO_COPPER_REGION:{name:"Convert to Copper Region",cmd:"CONVERT_TO_COPPER_REGION",tips:""},CONVERT_TO_SLOT_REGION:{name:"Convert to Slot Region",cmd:"CONVERT_TO_SLOT_REGION",tips:""},CONVERT_TO_FILL_REGION:{name:"Convert to Fill Region",cmd:"CONVERT_TO_FILL_REGION",tips:""},CONVERT_TO_PROHIBITED_REGION:{name:"Convert to  Prohibited Region",cmd:"CONVERT_TO_PROHIBITED_REGION",tips:""},CONVERT_TO_D3_SHELL_OUTLINE:{name:"Convert to 3D Shell - Outline",cmd:"CONVERT_TO_D3_SHELL_OUTLINE",tips:""},CONVERT_TO_D3_SHELL_SLOT_REGION:{name:"Convert to 3D Shell -  Slot Region",cmd:"CONVERT_TO_D3_SHELL_SLOT_REGION",tips:""},CONVERT_TO_D3_SHELL_ENTITY:{name:"Convert to 3D Shell - Entity",cmd:"CONVERT_TO_D3_SHELL_ENTITY",tips:""},CONVERT_TO_FPC_STIFFENER:{name:"Convert to FPC Stiffener",cmd:"CONVERT_TO_FPC_STIFFENER",tips:""}},tVe=X9t;var Ux={...vFe,...xFe,...RFe,...DFe,...wFe,...LFe,...NFe,...kFe,...BFe,...FFe,...VFe,...GFe,...UFe,...HFe,...WFe,...zFe,...YFe,...jFe,...XFe,...qFe,...$Fe,...KFe,...ZFe,...JFe,...QFe,...MFe,...eVe,...tVe,MORE:{name:"More...",cmd:"MORE",tips:""},CANCEL:{name:"Cancel",cmd:"CANCEL",tips:"esc"},COMPLETE:{name:"Finish",cmd:"COMPLETE",tips:""},REGRESSION:{name:"Backspace",cmd:"REGRESSION",tips:""},toggleAdsorb:{name:"Snap",cmd:"toggleAdsorb",tips:""},ADSORBENT_CONFIG:{name:"Snap Setting...",cmd:"ADSORBENT_CONFIG",tips:""},CHECK_OUT:{name:"Check Out",cmd:"CHECK_OUT",tips:""},CHECK_IN:{name:"Check In",cmd:"CHECK_IN",tips:""},FILTER:{name:"Filter",cmd:"FILTER",tips:""},DISPLAY:{name:"Display",cmd:"DISPLAY",tips:""},ENLARGE:{name:"Zoom In",cmd:"ENLARGE",tips:""},NARROW:{name:"Zoom Out",cmd:"NARROW",tips:""},PASTE:{name:"Paste",cmd:"PASTE",tips:""},CUT:{name:"Cut",cmd:"CUT",tips:""},LOOKUP:{name:"Find...",cmd:"LOOKUP",tips:""},SELECT_PARENT:{name:"Parent",cmd:"SELECT_PARENT",tips:""},SELECT_CONNECTED_THERMALS:{name:"Connected Thermals",cmd:"SELECT_CONNECTED_THERMALS",tips:""},CROSSPROBE:{name:"Cross Probe...",cmd:"CROSSPROBE",tips:""},PLACETRANSFER:{name:"Placement Transfer...",cmd:"PLACETRANSFER",tips:""},REFRESH:{name:"Refresh...",cmd:"REFRESH",tips:""},RENUMBER:{name:"Renumber Pads...",cmd:"RENUMBER",tips:""},SELECT:{name:"Select",cmd:"SELECT",tips:""},COPY:{name:"Copy",cmd:"COPY",tips:""},copyToImage:{name:"Copy as an image",cmd:"copyToImage",tips:""},copyToSvg:{name:"Copy as SVG",cmd:"copyToSvg",tips:""},copyToPng:{name:"Copy as PNG",cmd:"copyToPng",tips:""},DELETE:{name:"Delete",cmd:"DELETE",tips:""},MOVE:{name:"Move",cmd:"MOVE",tips:""},MOVE_BY_CENTER_POINT:{name:"Move by Center Point",cmd:"MOVE_BY_CENTER_POINT",tips:""},MOVE_BY_ORIGIN_POINT:{name:"Move by Origin Point",cmd:"MOVE_BY_ORIGIN_POINT",tips:""},MOVE_BY_REFERENCE_POINT:{name:"Move by Reference Point",cmd:"MOVE_BY_REFERENCE_POINT",tips:""},MOVE_SEQUENTIAL:{name:"Move Sequential",cmd:"MOVE_SEQUENTIAL",tips:""},ARRAYS:{name:"Arrays",cmd:"ARRAYS",tips:""},DETACHING_WIRES_FROM_DEVICES:{name:"Detaching Wires From Devices",cmd:"DETACHING_WIRES_FROM_DEVICES",tips:""},UNROUTE_COMPONENT_CONNECTIONS:{name:"Unroute Component Connections",cmd:"UNROUTE_COMPONENT_CONNECTIONS",tips:""},ATTR_LOCATION:{name:"Property Location...",cmd:"ATTR_LOCATION",tips:""},ATTRIBUTE:{name:"Property...",cmd:"ATTRIBUTE",tips:""},IPC2552:{name:"IPC/DAC-2552 Properties...",cmd:"IPC2552",tips:""},ANNOTATION:{name:"Add Annotation",cmd:"ANNOTATION",tips:""},NET:{name:"Net",cmd:"NET",tips:""},DEVICE:{name:"Component",cmd:"DEVICE",tips:""},SELECTED_ELEMENT:{name:"Selected Element",cmd:"SELECTED_ELEMENT",tips:""},EXCHANGE_LOCATION:{name:"Swap Location",cmd:"EXCHANGE_LOCATION",tips:""},OVERLAP:{name:"Overlap",cmd:"OVERLAP",tips:""},SELECTOVERLAP:{name:"Select Overlap",cmd:"SELECTOVERLAP",tips:""},CONNECT:{name:"Connect",cmd:"CONNECT",tips:""},CONNECTED_COPPER:{name:"Connected Copper",cmd:"CONNECTED_COPPER",tips:""},NET_MENU:{name:"Net",cmd:"NET_MENU",tips:""},NET_COLOR:{name:"Net Color...",cmd:"NET_COLOR",tips:""},"new-net-class":{name:"New Net Class...",cmd:"new-net-class",tips:""},"join-net-class":{name:"Join Net Class...",cmd:"join-net-class",tips:""},"remove-from_net-class":{name:"Remove From Net Class",cmd:"remove-from_net-class",tips:""},"new-equal-length-group":{name:"New Equal Length Group...",cmd:"new-equal-length-group",tips:""},"join-equal-length-group":{name:"Join Equal Length Group...",cmd:"join-equal-length-group",tips:""},"remove-from_equal-length-group":{name:"Remove From Equal Length Group",cmd:"remove-from_equal-length-group",tips:""},"new-differentialPair":{name:"New Differential Pair...",cmd:"new-differentialPair",tips:""},"delete-differentialPair":{name:"Delete Differential Pair",cmd:"delete-differentialPair",tips:""},INSERT_NODE:{name:"Insert Node",cmd:"INSERT_NODE",tips:""},EDIT_BOUNDARY:{name:"Edit Outline",cmd:"EDIT_BOUNDARY",tips:""},GENERATE_D3_SHELL_OUTLINE:{name:"Generate 3D Shell - Outline",cmd:"GENERATE_D3_SHELL_OUTLINE",tips:""},FORMAT_BRUSH:{name:"Format Painter...",cmd:"FORMAT_BRUSH",tips:""},DIVISION:{name:"Slice",cmd:"DIVISION",tips:""},REPLACE_LAYER:{name:"Change Layer",cmd:"REPLACE_LAYER",tips:""},FLIP_PATH:{name:"Flip Path",cmd:"FLIP_PATH",tips:""},REMOVE_LOOP:{name:"Remove Loop",cmd:"REMOVE_LOOP",tips:""},SELECT_NET:{name:"Select Net",cmd:"SELECT_NET",tips:""},COMMENT:{name:"Comment",cmd:"COMMENT",tips:""},EXPAND:{name:"Expand",cmd:"EXPAND",tips:""},CORNER:{name:"Corner",cmd:"CORNER",tips:""},GROUP_OF_OBJECT:{name:"Group of Object",cmd:"GROUP_OF_OBJECT",tips:""},DUPLICATE:{name:"Duplicate",cmd:"DUPLICATE",tips:""},DUPLICATE_TO_CURSOR:{name:"Duplicate to Cursor",cmd:"DUPLICATE_TO_CURSOR",tips:""},DUPLICATE_TO_OTHER_LAYER:{name:"Duplicate to Other Layer",cmd:"DUPLICATE_TO_OTHER_LAYER",tips:""},CUTOUT:{name:"Cutout",cmd:"CUTOUT",tips:""},CUTOUT_RECT:{name:"Rectangle",cmd:"CUTOUT_RECT",tips:""},CUTOUT_CIRCLE:{name:"Circle",cmd:"CUTOUT_CIRCLE",tips:""},CUTOUT_POLYGON:{name:"Polygon",cmd:"CUTOUT_POLYGON",tips:""},avoidSlots:{name:"Avoid Slots",cmd:"avoidSlots",tips:""},avoidPads:{name:"Avoid Pads",cmd:"avoidPads",tips:""},boolOperation:{name:"Boolean Operation",cmd:"boolOperation",tips:""},boolAggregate:{name:"Merge Areas",cmd:"boolAggregate",tips:""},boolSubtraction:{name:"Subtract Top Area",cmd:"boolSubtraction",tips:""},boolIntersection:{name:"Preserve overlapping areas",cmd:"boolIntersection",tips:""},boolExclusive:{name:"Exclude Overlapping Areas",cmd:"boolExclusive",tips:""},boolSplit:{name:"Split Area with Holes",cmd:"boolSplit",tips:""},MERGE_AS_CLOSED_OBJECT:{name:"Merge as a Closed Line",cmd:"MERGE_AS_CLOSED_OBJECT",tips:""},MERGE_PADS:{name:"Merge pads",cmd:"MERGE_PADS",tips:""},DISPERSED_AS_INDEPENDENT_LIEN:{name:"Dispersed as Independent Line",cmd:"DISPERSED_AS_INDEPENDENT_LIEN",tips:""},SPLIT:{name:"Split",cmd:"SPLIT",tips:""},ADD_FILLET:{name:"Add Fillet...",cmd:"ADD_FILLET",tips:""},ADD_CHAMFER:{name:"Add Chamfer...",cmd:"ADD_CHAMFER",tips:""},UNROUTE_ATTACHED_SEGMENTS:{name:"Unroute Attached Segments",cmd:"UNROUTE_ATTACHED_SEGMENTS",tips:""},UNROUTE_CONNECTIONS:{name:"Unroute Connections",cmd:"UNROUTE_CONNECTIONS",tips:""},TABLE_SETTING:{name:"Table Setting...",cmd:"TABLE_SETTING",tips:""},OPTIMIZA_NONE:{name:"None",cmd:"OPTIMIZA_NONE",tips:""},OPTIMIZA_WEAK:{name:"Weak",cmd:"OPTIMIZA_WEAK",tips:""},OPTIMIZA_STRONG:{name:"Strong",cmd:"OPTIMIZA_STRONG",tips:""},OPTIMIZATION:{name:"Optimization",cmd:"OPTIMIZATION",tips:""},ADD:{name:{value:"Add",context:"contextMenu"},cmd:"ADD",tips:""},BATCH_FANOUT:{name:"Fanout Routing...",cmd:"BATCH_FANOUT",tips:""},OBJECT_PRIORITY:{name:"Measuring Object",cmd:"OBJECT_PRIORITY",tips:""},COLUMNS_INPUT:{name:"Enter Columns...",cmd:"COLUMNS_INPUT",tips:""},REUSE_BLOCK:{name:"Reuse Block",cmd:"REUSE_BLOCK",tips:""},selectedBSSaveAsCloud:{name:"Save as Reuse Block Based on Selected...",cmd:"selectedBSSaveAsCloud",tips:""},selectedBSSaveAsLocal:{name:"Save as Reuse Block(Local) Based on Selected...",cmd:"selectedBSSaveAsLocal",tips:""},EXIT_EDIT_PAD_SHAPE_MOE:{name:"Exit Edit Pad Shape Mode",cmd:"EXIT_EDIT_PAD_SHAPE_MOE",tips:""},"opensubmenu-boardshape":{name:"Board Shape",cmd:"opensubmenu-boardshape",tips:""},convertToBoard:{name:"Generate Board Shape from Selection",cmd:"convertToBoard",tips:""},convertToLineFromBoard:{name:"Generate Lines from Board Shape",cmd:"convertToLineFromBoard",tips:""},clearMeasureResults:{name:"Clear Results",cmd:"clearMeasureResults",tips:""},CreepageDistance:{name:"Creepage Distance",cmd:"CreepageDistance",tips:""},MeasuringDistance:{name:"Measuring Distance",cmd:"MeasuringDistance",tips:""}};function iCe(o){switch(o){case"ANNOTATION":return"createAnnotation";case"COPY":return"Copy";case"copyToImage":return"copyToImage";case"copyToSvg":return"copyToSvg";case"copyToPng":return"copyToPng";case"CUT":return"cut";case"DUPLICATE":return"Duplicate";case"DUPLICATE_TO_CURSOR":return"DuplicateToCursor";case"boolAggregate":return"BoolAggregate";case"boolIntersection":return"BoolIntersection";case"boolSubtraction":return"BoolSubtraction";case"boolExclusive":return"BoolExclusive";case"boolSplit":return"BoolSplit";case"DUPLICATE_TO_OTHER_LAYER":return"DuplicateToOtherLayer";case"PASTE":return"Paste";case"DELETE":return"Delete Selected";case"MOVE_BY_CENTER_POINT":return"Move by Center Point";case"MOVE_BY_ORIGIN_POINT":return"MOVE_BY_ORIGIN_POINT";case"MOVE_BY_REFERENCE_POINT":return"MOVE_BY_REFERENCE_POINT";case"ARRAYS":return"editArray";case"ENLARGE":return"Zoom In";case"NARROW":return"Zoom Out";case"ADAPT_ALL":return"Fit All in Window";case"LOOKUP":return"Find and Replace";case"RATLINES_HIDE":return"Show/Hide Selected Ratline";case"RATLINES_SHOW":return"Show/Hide Selected Ratline";case"HIGHLIGHT_SELECTED_OBJECTS":return"HIGHLIGHT_SELECTED_OBJECTS";case"HIGHLIGHT_COMPONENT":return"HIGHLIGHT_COMPONENT";case"HIGHLIGHT_CANCELALL":return"Unhighlight All";case"HIGHLIGHT_CANCEL_COMPONENT":return"HIGHLIGHT_CANCEL_COMPONENT";case"HIGHLIGHT_CANCEL_SELECTED_OBJECTS":return"HIGHLIGHT_CANCEL_SELECTED_OBJECTS";case"ADDWITH_VIA":return"Place Via";case"ADDVIA_FENCE":return"PlaceViaFence";case"PLACE_VIA":return"Place Via";case"COMBINATION_SELECT":return"Group Selected";case"COMBINATION_CANCEL":return"Ungroup Selected";case"rotate_left":return"Rotate Left";case"rotate_right":return"rotate_right";case"rotate_reference_point":return"rotate_reference_point";case"align_left":return"Align Left";case"align_horizontal_center":return"Align Horizontal Centers";case"align_right":return"Align Right";case"align_top":return"Align Top";case"align_vertical_center":return"Align Vertical Centers";case"align_bottom":return"Align Bottom";case"align_grid":return"Align Grid";case"distribute_horizontal_equidistant":return"Horizontal Equidistant Distribution";case"distribute_vertical_equidistant":return"Vertical Equidistant Distribution";case"distribute_left_side_edge_equidistant":return"distribute_left_side_edge_equidistant";case"distribute_top_side_edge_equidistant":return"distribute_top_side_edge_equidistant";case"distribute_horizontal_by_center_distance":return"distribute_horizontal_by_center_distance";case"distribute_vertical_by_center_distance":return"distribute_vertical_by_center_distance";case"distribute_horizontal_by_edges_distance":return"distribute_horizontal_by_edges_distance";case"distribute_vertical_by_edges_distance":return"distribute_vertical_by_edges_distance";case"distribute":return"distribute";case"component_distribute_by_region":return"component_distribute_by_region";case"component_distribute_by_region":return"Component Distribute By Region";case"FLIP_LEFTANDRIGHT":return"Flip Right and Left";case"FLIP_UPANDDOWN":return"Flip Up and Down";case"ADDWITH_TRACK":return"Single Routing";case"STRETCHING":return"Stretch Track";case"WIRING_CORNER":return"Routing Corner";case"REBUILD_ALL":return"Rebuild All Copper Area";case"SHOW_COPPER_FILLS":case"HIDE_COPPER_FILLS":return"ChangeCopperZoneVisibleorInvisible";case"COMPLETE":return"Finish";case"CANCEL":return"Cancel";case"REGRESSION":return"Backspace";case"OVERLAP":return"Select Overlap";case"CONNECTED_COPPER":return"connectedCopper";case"FLIP_PATH":return"Filp Path While Drawing";case"HIGHLIGHT_NET":return"Highlight Or Unhighlight Net";case"HIGHLIGHT_CANCEL_NET":return"Highlight Or Unhighlight Net";case"HIGHLIGHT_AND_UNHIGHLIGHT":return"Unhighlight All";case"TURNOVER":return"flip2OppositeSide";case"EQUAL_LENGTH_TUNING_SETTING":case"WIRING_WIDTH_INPUT":return"Change Track Width While Routing";case"COLUMNS_INPUT":case"VIA_SIZE_INPUT":return"Show Attribute Dialog When Placing Object";case"CROSSPROBE":return"pcbCrossProbe";case"INCREASE_GAP":return"increaseSnakeGap";case"DECREASE_GAP":return"decreaseSnakeGap";case"CHANGE_DIFFPAIR_FANOUT_MODE":return"changeDiffPairFanOutMode";case"MOVE_BY_REFERENCE_POINT":return"MOVE_BY_REFERENCE_POINT";case"WIRING_MODE":return"changeRoutingMode";case"toggleAdsorb":return"toggleAdsorb";case"GRID_SNAP_KEEP_RATIO":return"gridSnapKeepRatio";case"GRID_SETTING":return"setGridSize";case"GRID_RANGE_SETTING":return"setGridRange";case"OFFSET_ABSOLUTE":return"absoluteOffset";case"OFFSET_RELATIVE":return"relativeOffset";case"FLIP_LEFTANDRIGHT_BY_REFER_POINT":return"fliph_reference_point";case"FLIP_UPANDDOWN_BY_REFER_POINT":return"flipv_reference_point";case"ADD":return"ADD";case"ADD_FILLET":return"ADD_FILLET";case"ADD_CHAMFER":return"ADD_CHAMFER";case"ADDWITH_TEARS":return"teardrop";case"ADAPT_SELECTED":return"adaptSelectionView";case"EXCHANGE_LOCATION":return"swapLocation";case"ATTR_LOCATION":return"set-attr-text-position";case"REUSE_LAYOUT_ROUTE":return"reuseLayoutRoute";case"OBJECT_PRIORITY":return"prioritizeObjectSelection";case"clearMeasureResults":return"clearMeasureResults";case"CreepageDistance":return"creepageDistance";case"selectedBSSaveAsCloud":return"selectedBSSaveAsCloud";case"selectedBSSaveAsLocal":return"selectedBSSaveAsLocal";case"COPPER_MANAGER":return"viewCopperAreaManager";case"CUTOUT":return"Cutout";case"CUTOUT_RECT":return"draw(RCutout)";case"CUTOUT_CIRCLE":return"draw(CCutout)";case"CUTOUT_POLYGON":return"draw(PCutout)";case"avoidSlots":return"avoidSlots";case"avoidPads":return"avoidPads";case"CONVERT_TO_PAD":return"CONVERT_TO_PAD";case"CONVERT_TO_TRACK":return"CONVERT_TO_TRACK";case"CONVERT_TO_2D_LINE":return"CONVERT_TO_2D_LINE";case"CONVERT_TO_SLOT_REGION":return"CONVERT_TO_SLOT_REGION";case"CONVERT_TO_FILL_REGION":return"CONVERT_TO_FILL_REGION";case"CONVERT_TO_COPPER_REGION":return"CONVERT_TO_COPPER_REGION";case"CONVERT_TO_PROHIBITED_REGION":return"CONVERT_TO_PROHIBITED_REGION";case"CONVERT_TO_BOARD_OUTLINE":return"CONVERT_TO_BOARD_OUTLINE";case"CONVERT_TO_CONSTRAINT_REGION":return"CONVERT_TO_CONSTRAINT_REGION";case"CONVERT_TO_D3_SHELL_OUTLINE":return"CONVERT_TO_D3_SHELL_OUTLINE";case"CONVERT_TO_D3_SHELL_SLOT_REGION":return"CONVERT_TO_D3_SHELL_SLOT_REGION";case"CONVERT_TO_D3_SHELL_ENTITY":return"CONVERT_TO_D3_SHELL_ENTITY";case"CONVERT_TO_FPC_STIFFENER":return"CONVERT_TO_FPC_STIFFENER";case"convertToBoard":return"convertToBoard";case"convertToLineFromBoard":return"convertToLineFromBoard";case"opensubmenu-boardshape":return"opensubmenu-boardshape";default:return null}}var qt=class{constructor(){this.result=new Array}addObj(t,e=!1,r=!1){this.result.push({...t,separate:e,selectedTag:r})}add(t,e=!1,r=!1,i=!0,n=!1,s=!1){if(Ux[t]){let a=iCe(Ux[t].cmd),l=tr.getConfigHotkeyInfo(a),c;l||(c=KM.getMenuHotkeyConfigInfo(t)),Ux[t].tips=i&&(l==null?void 0:l.hotKey)||"";let h={...Ux[t],separate:e,selectedTag:r,uiAction:l==null?void 0:l.uiAction,subHotKey:l?l.subHotkey:c==null?void 0:c.hotkey,subHotKeyCmd:l?l.menuHotkeyCmd:c==null?void 0:c.menuCmd,disabled:n};s&&(h.option={disabledI18n:s}),this.result.push(h)}else{let a=KM.getMenuHotkeyConfigInfo(t),l={name:t,cmd:t,tips:"",separate:e,selectedTag:r,subHotKey:a==null?void 0:a.hotkey,subHotKeyCmd:a==null?void 0:a.menuCmd,disabled:n};s&&(l.option={disabledI18n:s}),this.result.push(l)}}addExtend(t,e,r=!1,i=!1,n=!1){let s=iCe(Ux[t].cmd),a=tr.getConfigHotkeyInfo(s),l;a||(l=KM.getMenuHotkeyConfigInfo(t)),Ux[t].tips=(a==null?void 0:a.hotKey)||"",this.result.push({...Ux[t],extend:e.result,separate:r,selectedTag:i,uiAction:a==null?void 0:a.uiAction,subHotKey:a?a.subHotkey:l==null?void 0:l.hotkey,subHotKeyCmd:a?a.menuHotkeyCmd:l==null?void 0:l.menuCmd,disabled:n})}addSeparate(){this.result.length>0&&(this.result[this.result.length-1].separate=!0)}};function Dm(o){let t=new qt,e=le.trackConfig,r="WIRING_WIDTH:";return e.forEach(i=>{let n=i.getMenu(r),s=!1;o==i.mil&&(s=!0),t.addObj(n,!1,s)}),t.add("WIRING_WIDTH_COMMONLY_SSETTING",!0),t}function QB(o,t){let e=new qt,r=le.viaConfig,i="VIA_SIZE:";return r.forEach((n,s)=>{let a=n.getMenu(i),l=!1;o!=null&&ve(o)==ve(n.milInnerRadius)&&t!=null&&ve(t)==ve(n.milRadius)&&(l=!0),e.addObj(a,s==r.length-1,l)}),e.add("VIA_SIZE_COMMONLY_SETTING",!1),e}function fS(o){let t=new qt;return t.add("WIRING_CORNER_LINE45",!1,o=="WIRING_CORNER_LINE45"),t.add("WIRING_CORNER_LINE90",!1,o=="WIRING_CORNER_LINE90"),we.diffTrack||(t.add("WIRING_CORNER_ARC45",!1,o=="WIRING_CORNER_ARC45"),t.add("WIRING_CORNER_ARC90",!1,o=="WIRING_CORNER_ARC90")),t.add("WIRING_CORNER_ARC",!1,o=="WIRING_CORNER_ARC"),t.add("WIRING_CORNER_FREEANGLE",!1,o=="WIRING_CORNER_FREEANGLE"),t}function Nre(o,t){let e=new qt;return e.add("VIA_SIZE_FOLLOWRULES",!1,le.pcbConfig.startViaSize=="rule"),e.add("VIA_SIZE_RULESSETTING",!0),le.viaConfig.forEach(i=>{let n=i.getMenu(),s=!1;o!=null&&GTe(o,i.milInnerRadius)&&t!=null&&GTe(t,i.milRadius)&&(s=!0),e.addObj(n,!1,s)}),e.result.length>0&&(e.result[e.result.length-1].separate=!0),e.add("VIA_SIZE_COMMONLY_SETTING",!0),e.add("VIA_SIZE_INPUT"),e}function kre(o,t){let e=new qt;for(let r of o){let i=r.getMenu(),n=!1;t==r.layerID&&(n=!0),e.addObj(i,!1,n)}return e}function rVe(o=!1){let t=new qt,e=Zt.getInstance();return o||(t.add("WIRING_MODE_PUSHAWAY",!1,e.mode=="WIRING_MODE_PUSHAWAY"),t.add("WIRING_MODE_SURROUND_AND_PUSHAWAY",!1,e.mode=="WIRING_MODE_SURROUND_AND_PUSHAWAY"),t.add("WIRING_MODE_SURROUND",!1,e.mode=="WIRING_MODE_SURROUND"),t.add("WIRING_MODE_OBSTRUCT",!1,e.mode=="WIRING_MODE_OBSTRUCT")),t.add("WIRING_MODE_IGNORE",!1,e.mode=="WIRING_MODE_IGNORE"),t}function iVe(o){let t=new qt;return t.add("WIRING_WIDTH_FOLLOWRULES",!1,le.pcbConfig.startTrackWidth=="rule"),t.add("WIRING_WIDTH_RULESSETTING",!0),le.trackConfig.forEach(r=>{let i=r.getMenu(),n=!1;o==r.mil&&(n=!0),t.addObj(i,!1,n)}),t.add("WIRING_WIDTH_COMMONLY_SSETTING",!0),t.add("WIRING_WIDTH_INPUT"),t}function nVe(o,t,e,r){let i=new qt,n=new Set;return e&&(n=re.getInstance().getDefaultBlindPhysics().getContainsLayerVias(o)),n!=null&&n.forEach(s=>{let a=s.getMenu(),l=!1;r==s.name&&(l=!0),i.addObj(a,!1,l)}),i.addSeparate(),i.add("VIA_TYPE_RULESSETTING"),i}function oVe(o,t,e=!1){let r=new qt;if(t==null?r.add("CANCEL",!0):t.tracks.length==1?(r.add("COMPLETE"),r.add("CANCEL"),r.add("REGRESSION",!0)):(r.add("COMPLETE"),r.add("CANCEL"),r.add("REGRESSION",!0),e||r.add("CHANGECONTROLTRACK"),r.add("SINGlE_ROUTE",!e,e),e&&r.add("CHANGETRACK",!0)),t!=null){let i=t.node.layerId,n=t.node.end.layerId,s=t.node.via.viaName;r.add("PLACE_VIA");let a=Pe.getAllSignalLayer(),l=kre(a,n);if(r.addExtend("REPLACE_LAYER",l),t.tracks.length==1){let c=nVe(i,t.node.net,!0,s);r.addExtend("PLACE_BURIEDHOLE",c)}}if(r.addExtend("WIRING_CORNER",fS(Zt.getInstance().type)),r.addExtend("WIRING_MODE",rVe()),t!=null){let i=iVe(t.node.width);r.addExtend("WIRING_WIDTH",i),r.addExtend("VIA_SIZE",Nre(t.node.via.inner,t.node.via.radius))}return r.add("REMOVE_LOOP",!1,pr.removeLoop),r.add("toggleAdsorb",!1,o),r.add("ADSORBENT_CONFIG"),r}var ZM=class ZM{constructor(){this.channel=R.getInstance().compilerChannel;this._allowPull=15}static getInstance(){return ZM.ins==null&&(ZM.ins=new ZM),ZM.ins}set mouseDown(t){t?this._allowPull=this._allowPull&14:this._allowPull=this._allowPull|1,this.allowPull||this.channel.pause()}set noControl(t){t?this._allowPull=this._allowPull|2:this._allowPull=this._allowPull&13,this.allowPull||this.channel.pause()}get allowPull(){return this._allowPull>=15}set allowPull(t){t?this._allowPull=15:this._allowPull=0,this.allowPull||this.channel.pause()}autoPull(){return requestAnimationFrame(()=>{this.allowPull&&this.channel.pull()})}start(){requestAnimationFrame(()=>{this.autoPull(),this.start()})}};ZM.ins=null;var On=ZM;var e8=class{constructor(){this.nextTool=null}getCanUndo(){return this.nextTool?this.nextTool.getCanUndo():!1}setNextTool(t){this.nextTool=t}getNextTool(){return this.nextTool}};var Oo=class extends e8{constructor(){super(...arguments);this.drawing=!1;this.filterItems=new Set}getToolName(){return""}handler(e){this.nextTool!=null&&e(this.nextTool)}onKeyDown(e){this.handler(r=>{r.onKeyDown(e)})}onKeyUp(e){this.handler(r=>{r.onKeyUp(e)})}onMouseLeftDown(e){this.handler(r=>{r.onMouseLeftDown(e)})}onMouseMidDown(e){this.handler(r=>{r.onMouseMidDown(e)})}onMouseRightDown(e){this.handler(r=>{r.onMouseRightDown(e)})}onMouseLeftUp(e){this.handler(r=>{r.onMouseLeftUp(e)})}onMouseMidUp(e){this.handler(r=>{r.onMouseMidUp(e)})}onMouseRightUp(e){this.handler(r=>{r.onMouseRightUp(e)})}onMouseMove(e){this.handler(r=>{r.onMouseMove(e)})}onMouseLeave(e){this.handler(r=>{r.onMouseLeave(e)})}onMouseOut(e){this.handler(r=>{r.onMouseOut(e)})}onMouseEnter(e){this.handler(r=>{r.onMouseEnter(e)})}onMouseOver(e){this.handler(r=>{r.onMouseOver(e)})}onMouseWheel(e){this.handler(r=>{r.onMouseWheel(e)})}onDoubleClick(e){this.handler(r=>{r.onDoubleClick(e)})}onResize(e){this.handler(r=>{r.onResize(e)})}interrupt(){this.handler(e=>{e.interrupt()})}restore(){this.handler(e=>{e.interrupt()})}parse(e){}};var ni=class extends Oo{constructor(){super(...arguments);this.option="OPTIONCOMPLETE"}onMouseRightUp(e){if(e.openMenu)switch(this.option){case"OPTIONCOMPLETE":{this.option1(e);break}case"OPTIONLEFTUP":{this.option2(e);break}}}option1(e){switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.completed():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}option2(e){switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}start(){On.getInstance().allowPull=!1}end(){On.getInstance().allowPull=!0}completed(e){}cancel(e){}rightClickMenuData(e){}onMouseWheel(e){this.onMouseMove(e)}canChangeWhileRouting(e){return!(["Copper Region","Fill Region","Slot Region","Prohibited Region","Constraint Region","FPC Stiffener","3D Shell - Side Datum Line","3D Shell - Side Slot Region","3D Shell - Top Slot Region","3D Shell - Side Entity","3D Shell - Top/Bottom Entity"].indexOf(e)>=0)}onEnterPlace(e){this.onMouseLeftUp(e)}};var q9t=0;function Lh(){return"BASE"+q9t++}var Vi=class o extends mt{constructor(e,r){super(e);this.isBase=!0;this._color=null;this._color=r,this.sendDeleteMsg=!1}static build(e,r,i,n,s=ee.BLACK){let a=new wc(Lh(),r,i,{layerId:e,strokeWidth:n,locked:!1});return new o(a,s)}get color(){return this._color}set color(e){this._color=e,this.refreshRender()}setBBoxModify(){}setLayerModify(e){}};var t8=class{constructor(t,e,r=null){this.len=ve(10/Ai().getScale(),2);this.layerId=e,this._position=t,this._rotation=r,this.updateBaseCross()}remove(){this.line1.remove(),this.line2.remove(),this.line1=null,this.line2=null}isRepeat(t,e){return t.x===this._position.x&&t.y===this._position.y&&e==this._rotation}getLines(){return[this.line1,this.line2]}get position(){return this._position}set position(t){this._position=t,this.updateBaseCross()}get rotation(){return this._rotation}set rotation(t){this._rotation=t,this.updateBaseCross()}updateBaseCross(){let t=Ai(),e=new S(this.len,0),r=new S(0,this.len);this.line1=Vi.build(this.layerId,e.mul(-1),e,2/t.getScale()),this.line2=Vi.build(this.layerId,r.mul(-1),r,2/t.getScale());let i=Ae.translate(this._position.x,this._position.y,0);this.line1.transform(i),this.line2.transform(i)}};var $9t=ee.of3("#5588ff"),Bre=class{constructor(t,e,r,i=!1){this.globalIndex=Lh();this.length=1e5;this.state="Only Main";this.viewGroupId="";this.start=t,this.end=e,this.layerId=r,this.midPoint=t.add(e).mul(.5),this.isSnapComponent=i,this.refreshRender()}remove(){this.state="Not Shown",this.refreshRender()}visible(){this.state="Only Main",this.refreshRender()}hidden(){this.state="Not Shown",this.refreshRender()}updateBaseExtensionCord(t=!1){let e=this.start,r=this.end,i=r.sub(e).normalize(),n=this.midPoint.sub(i.mul(this.length)),s=this.midPoint.add(i.mul(this.length));return t&&(n=e,s=r),[n,s]}getType(){return 29}refreshRender(){Mo.attach(this,this.getType())}getViewState(){return this.state}getRenderData(){let{layerId:t}=this,e=this.updateBaseExtensionCord(this.isSnapComponent);return{layerId:t,segments:[e],isSolid:!1,color:$9t,highlightColor:ee.BLACK,highLightType:null,manualHighLight:R.getInstance().forceDeactive}}};var ua=class extends Ls{get box(){return this.model.text.box}};var Qp=class extends Qo{constructor(){super()}get net(){return this.model.net.toUpperCase()}get showNet(){return this.model.net}set net(t){this.model.net!=t&&(Ye.delete(this),this.model.net=t,Ye.addItem(this),this.refreshRender())}get copperPath(){return this.model.source}get pls(){return this.model.pls}set pls(t){this.model.pls=t}get start(){return this.pls.length>0?this.pls[0].primitives[0].start():null}get locked(){return this.model.locked}set locked(t){this.model.locked=t}get layerId(){return this.model.layerId}get color(){return this._color||Ye.getSpecialColor(this.net)}set color(t){t?this._color=t:delete this._color,this.refreshRender()}rotateFor(t,e){}transform(t){}getType(){return 4}isSelect(t,e){return this.model.inShape(t,e)}inPolygon(t,e){return this.model.inShape(t,e)}inCopper(t,e){return this.isVisible?this.inPolygon(t,e):!1}buildBBox(){return this.model.buildBBox()}};var Dp=class extends Ls{constructor(){super(),this.initRefreshRender()}get mirror(){return this.model.mirror}get box(){return this.model.box}set mirror(t){this.model.mirror!=t&&(this.model.mirror=t,this.refreshRender())}get start(){return this.model.start}set start(t){this.model.start=t,this.refreshRender()}get center(){return this.model.center}set center(t){this.model.center=t,this.refreshRender()}get width(){return this.model.width}set width(t){this.model.width=t,this.refreshRender()}get height(){return this.model.height}set height(t){let e=this.model.box.leftLow;this.model.height=t;let r=e.sub(this.model.box.leftLow),i=Ae.translate(r.x,r.y,0);this.model.transform(i),this.refreshRender()}modifyHeight(t){this.model.height=t,this.refreshRender()}get rotation(){return this.model.rotation%kr}set rotation(t){this.model.rotation=t,this.refreshRender()}get locked(){return this.model.locked}set locked(t){this.model.locked=t}rotateFor(t,e){let r=Ae.translate(-t.x,-t.y,0).rotateZ(e).translate1(t.x,t.y,0);this.transform(r)}isSelect(t,e){return this.getParent()!=null?!1:this.model.inShape(t,e)}transform(t){this.model.transform(t),this.refreshRender()}getMathGraphics(t,e){return this.model.getMathGraphics(t,e)}buildBBox(){return this.model.buildBBox()}};function Xc(o,t=!1){var e;if(o instanceof xi)switch(o.modelType){case"Track":case"ArcTrack":{if(!t){let i=pr.getItem(o.globalIndex);if(i!=null)return i}return pr.addTrackByModel(o)}case"Pad":{if(!t){let i=Qt.getItem(o.globalIndex);if(i!=null)return i;let n=Qt.getItem(o.globalIndex);if(n!=null)return n}switch(o.layerId){case 1:return o.top.type=="POLYGON"?Qt.addPolygonPadByModel(o):Qt.addPadByModel(o);case 2:return o.bottom.type=="POLYGON"?Qt.addPolygonPadByModel(o):Qt.addPadByModel(o);default:return o.top.type=="POLYGON"?Qt.addPolygonPadByModel(o):Qt.addPadByModel(o)}}case"Via":{if(!t){let i=Wr.getItem(o.globalIndex);if(i!=null)return i}return Wr.addViaByModel(o)}case"Image":{if(!t){let i=Bn.getItem(o.globalIndex);if(i!=null)return i}return Bn.addImageByModel(o)}case"Picture":{if(!t){let i=So.getItem(o.globalIndex);if(i!=null)return i}return So.addImageByModel(o)}case"Length Dimension":{if(!t){let i=Yo.getItem(o.globalIndex);if(i!=null)return i}return Yo.addDimensionByModel(o)}case"Protractor Dimension":{if(!t){let i=os.getItem(o.globalIndex);if(i!=null)return i}return os.addProtractorByModel(o)}case"Radius Dimension":{if(!t){let i=jo.getItem(o.globalIndex);if(i!=null)return i}return jo.addRadiusMarkByModel(o)}case"Polygon":{if(!t){let n=pt.getItem(o.globalIndex);if(n!=null)return n}let i=new Array;for(let n of o.childrens){let s=new Array;for(let a of n)s.push(Xc(a));i.push(s)}return pt.addPolygonByModel(o,i)}case"Rect":{if(!t){let i=Xt.getItem(o.globalIndex);if(i!=null)return i}return Xt.addRectByModel(o)}case"Circle":{if(!t){let i=Kt.getItem(o.globalIndex);if(i!=null)return i}return Kt.addCircleByModel(o)}case"Copper":{if(!t){let a=Ti.getItem(o.globalIndex);if(a!=null)return a}let i,n=(e=o.getParent())==null?void 0:e.globalIndex;if(!n||(i||(i=Xt.getItem(n)),i||(i=Kt.getItem(n)),i||(i=pt.getItem(n)),!i))return;let s=Ti.addCopperByModel(o);return s.fill(),i.addCopperResult(s),s.setParent(i),s}case"Inner":{if(!t){let i=zn.getItem(o.globalIndex);if(i!=null)return i}return zn.addPlaneZoneByModel(o)}case"Component":{if(!t){let l=Ar.getItem(o.globalIndex);if(l!=null)return l}let i=o.getItems(),n=o.attributes,s=new Array,a=new Array;for(let l of i){let c=Xc(l);c!=null&&s.push(c)}for(let l of n){let c=Xc(l);a.push(c)}return Ar.addComponentByModel(a,s,o)}case"Line":return Cu.addByModel(o);case"Arc":return Yc.addArcByModel(o);case"Ratline":{if(!t){let i=Wo.getRatlineById(o.globalIndex);if(i!=null)return i}return Wo.addRatlineByModel(o)}case"Text":{if(!t){let i=ri.getItem(o.globalIndex);if(i!=null)return i}return ri.addtextByModel(o)}}return null}function QP(o,t){switch(o){case"Track":case"ArcTrack":return pr.getItem(t);case"Pad":{let e=Qt.getItem(t);if(e!=null)return e}case"Via":{let e=Wr.getItem(t);if(e!=null)return e}case"Image":{let e=Bn.getItem(t);if(e!=null)return e}case"Picture":{let e=So.getItem(t);if(e!=null)return e}case"Length Dimension":{let e=Yo.getItem(t);if(e!=null)return e}case"Protractor Dimension":{let e=os.getItem(t);if(e!=null)return e}case"Radius Dimension":{let e=jo.getItem(t);if(e!=null)return e}case"Polygon":{let e=pt.getItem(t);if(e!=null)return e}case"Rect":{let e=Xt.getItem(t);if(e!=null)return e}case"Circle":{let e=Kt.getItem(t);if(e!=null)return e}case"Copper":{let e=Ti.getItem(t);if(e!=null)return e}case"Inner":{let e=zn.getItem(t);if(e!=null)return e}case"Component":{let e=Ar.getItem(t);if(e!=null)return e}case"Ratline":{let e=Wo.getRatlineById(t);if(e!=null)return e}case"Text":{let e=ri.getItem(t);if(e!=null)return e}}}var Fre=null,lc=class o{constructor(){this._hasModified=!1;this.padNumberManger=new T0;this.UUID="";this.category="";this.describe="";this._footprintId="";this.deviceAttrsMap={};this._textOffset=S.ORIGIN}static getTemplate(){return Fre==null&&(Fre=new o),Fre}removeAttribute(t){t.isEmpty||delete this.deviceAttrsMap[t.key]}get hasModified(){return this._hasModified}set hasModified(t){this._hasModified=t}set textOffset(t){this._textOffset=t}get textOffset(){return this._textOffset}set footprintId(t){this._footprintId=t;let e=ri.getAllItem();for(let r of e)r.key=="Footprint"&&(r.value=t)}get footprintId(){return this._footprintId}checkMustAttr(){let e=iM.ATTR;this.footprintId=R.getInstance().name;let r=ri.getAllItem(),i=!1,n=new Map;for(let s of r)s.key=="Footprint"&&(i=!0),s.key!=""&&(n.has(s.key)?(s.remove(),ri.delete(s),R.getInstance().compiler.deleteAttr(s.globalIndex)):n.set(s.key,s.key));if(!i){let s=bY(nr(),"Footprint",R.getInstance().name),a=new uI;a.feed(s);let l=a.finish();l!=null&&(Xc(l),R.getInstance().compiler.uploadAttr(l.globalIndex,Sr.getInstance().encode("ATTR",l)))}}};var Wf=class{constructor(t){this.shapes=new Array;this.center=new S(0,0);this.high=0;this.shapes=t.map(e=>e instanceof mt||e instanceof _t?e.primitive:e),this.calc()}getBBox(){let t=new _e;return this.shapes.forEach(e=>{t.ext1(e.bbox())}),t.build1()}calc(){let t=this.getBBox(),e=t.center(),r=this.shapes,i=t.width()<t.height();i&&(r=this.shapes.map(l=>l.multiply3(Ae.rotateZForPoint(e,Math.PI/2).toMatrix3())));let n=new Array;r.forEach(l=>{l instanceof M?this.calcLine(l,e,n):this.calcArc(l,e,n)}),Er(n,(l,c)=>c-l,0,n.length);let s=new Set,a=8;n.forEach(l=>{s.add(this.toFix(l,a))}),n=Array.from(s),n.length>1?(this.center=new S(e.x,(n[0]+n[1])/2),i&&(this.center=this.center.multiply4(Ae.rotateZForPoint(e,-Math.PI/2))),this.high=n[0]-n[n.length-1]):this.center=e,this.optimization()}optimization(){if(this.high==0){let t=this.getBBox();this.high=t.height(),this.center.equals(S.ORIGIN)&&(this.center=t.center())}}toFix(t,e=1){let r=Math.pow(10,e);return Math.round(t*r)/r}calcLine(t,e,r){let i=t;i.bbox().isContainsX(e.x)&&(i.isPoint()?r.push(i.start().y):i.b!=0&&r.push(this.toFix(-(i.a*e.x+i.c)/i.b,4)))}calcArc(t,e,r){let i=new _e;i.ext1(t.bbox());let n=i.build1();if(n.isContainsX(e.x)){let a=t.rx*t.rx-(e.x-t.center.x)*(e.x-t.center.x);if(a>=0){let l=Math.sqrt(a);n.isContainsY(t.center.y-l)&&r.push(t.center.y-l),n.isContainsY(t.center.y+l)&&r.push(t.center.y+l)}}}};var es=class o extends _t{constructor(e,r){super(e);this._color=null;this.isBase=!0;this._color=r,this.sendDeleteMsg=!1}static build(e,r,i,n,s,a,l,c=ee.BLACK){let h=new zc(Lh(),r,i,s,a,l,{layerId:e,strokeWidth:n,locked:!1});return new o(h,c)}get color(){return this._color}set color(e){this._color=e,this.refreshRender()}setBBoxModify(){}setLayerModify(e){}};var sn=class extends Le{constructor(e){super();this._fillState=0;$p(e),this.model=e,e.setModelWatcher(this),we.smartMode&&(this.smartPad=new nA(this.model.getBBox(),this.globalIndex)),this.initRefreshRender(),Ro("editor/shape/PolygonPad")}get topSolderOutline(){var e;return(e=this.model.getMathGraphics(5))==null?void 0:e.primitives}get topPasteOutline(){var e;return(e=this.model.getMathGraphics(7))==null?void 0:e.primitives}get bottomSolderOutline(){var e;return(e=this.model.getMathGraphics(6))==null?void 0:e.primitives}get bottomPasteOutline(){var e;return(e=this.model.getMathGraphics(8))==null?void 0:e.primitives}get hole(){return this.model.hole}set hole(e){this.hole!=e&&(this.model.hole=e,this.refreshRender())}get pads(){return this.model.pads}get pl(){return this.model.polygonPl}set pl(e){let r=new Wf(e.primitives);this.model.center=r.center;let i=this.pads,n=Lo.getPadStyleByPl(e,i[0]);this.model instanceof oS&&(e=e.multiply3(this.model.getPolygonMatrix().inverse().toMatrix3()),n=Lo.getPadStyleByPl(e,i[0])),this.model.top!=null&&(this.model.top=n),this.model.bottom!=null&&(this.model.bottom=n),this.model.inner!=null&&(this.model.inner=n),this.refreshRender()}get primitives(){return this.pl.primitives}get center(){return this.model.center}set center(e){let r=e.sub(this.center),i=Ae.translate(r.x,r.y,0);this.transform(i)}get pasteExpansion(){return this.model.pasteExpansion}set pasteExpansion(e){this.model.pasteExpansion=e,this.refreshRender(),this.updateSmartPad()}get topSolderExpansion(){return this.model.topSolderExpansion}set topSolderExpansion(e){this.model.topSolderExpansion=e,this.refreshRender(),this.updateSmartPad()}get bottomSolderExpansion(){return this.model.bottomSolderExpansion}set bottomSolderExpansion(e){this.model.bottomSolderExpansion=e,this.refreshRender(),this.updateSmartPad()}get expansionType(){return this.model.expansionType}set expansionType(e){this.model.expansionType=e,$p(this.model),this.refreshRender()}get rotation(){return this.model.rotation}set rotation(e){let r=e-this.rotation,i=Ae.translate(-this.center.x,-this.center.y,0).rotateZ(r).translate1(this.center.x,this.center.y,0);this.transform(i)}get holeShape(){return this.hole?this.hole.holeShape:"ROUND"}set holeShape(e){this.hole&&e!=null&&(this.model.holeShape=e,this.refreshRender())}get holeRadius(){return this.hole?this.hole.holeRadius:this.getDefaultHoleRadius()}set holeRadius(e){this.hole&&e!=null&&(this.model.holeRadius=e,this.refreshRender())}get holeLength(){return this.hole?this.hole.holeLength:this.getDefaultHoleRadius()*2}set holeLength(e){this.hole&&e!=null&&(this.model.holeLength=e,this.refreshRender())}get holeOffset(){return this.hole?this.hole.holeOffset:new S(0,0)}set holeOffset(e){this.hole&&e!=null&&(this.model.holeOffset=e,this.refreshRender())}get holeRotation(){return this.hole?this.hole.holeRotation:0}set holeRotation(e){this.hole&&e!=null&&(this.model.holeRotation=e)}get expansion(){return this.model.padExpansion}set expansion(e){if(this.expansion!=e){let r=this.model.expansionType;this.model.padExpansion=e,e.expansionType!==r?$p(this.model):this.updateSmartPad(),this.refreshRender()}}get color(){return uo.getInstance().padConfig.getCustomColor(this.globalIndex)||Ye.getSpecialColor(this.net)}set color(e){uo.getInstance().padConfig.setCustomColor(this.globalIndex,e),this.refreshRender()}get layerId(){return this.model.layerId}set layerId(e){e=this.getLayerId(e),this.layerId!=e&&(this.model.layerId=e,this.layerId==12&&(this.hole=nc.getHoleStyle(this.holeRadius*2,this.getDefaultHoleRadius(),this.holeShape,this.holeRotation,this.holeOffset)),this.refreshRender())}get shapes(){return this.pl}get holeColor(){var e,r,i;return((i=(r=(e=le)==null?void 0:e.themeConfig)==null?void 0:r.canvasTheme)==null?void 0:i.getHoleColor(this.plated,uo.getInstance().padConfig.getSelectAlpha(this.selectItem)))||ee.BLACK}get fillState(){return this._fillState}shapeToPl(e){let r=e.map(i=>i.primitive);return ge.build2(r)}getLayerId(e){return e==1||e==2||e==12?e:1}setChildrens(e){this.pl=e}getChildrens(){return this.pl}createPreviewChildrens(){let e=this.layerId;return this.primitives.map(i=>{if(i instanceof M)return Vi.build(e,i.start(),i.end(),.02);if(i instanceof q){let n=i.startAngle/180*Math.PI,s=i.endAngle()/180*Math.PI;return es.build(e,i.center,i.rx,.02,n,s,i.sweep())}})}fill(){this._fillState=0,this.refreshRender()}removeFill(){this._fillState=1,this.refreshRender()}deletePoint(e){let i=this.pl.primitives,n=i[e],s=(e-1+i.length)%i.length,a=i[s],l=a?a.start():n.start(),c=new M(l,n.end()),h=Array.from(this.primitives);h.splice(e,1,c),s=h.indexOf(a),h.splice(s,1),this.pl=ge.build2(h)}oppositeLayer(){}getDefaultHoleRadius(){return new Wf(this.primitives).high*.3}flip(e){this.model.flip(e),this.refreshRender()}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.transform(i)}visible(e=!1){super.visible(e),this.smartPad&&this.smartPad.visible()}hidden(){super.hidden(),this.smartPad&&this.smartPad.hidden()}transform(e){this.model.transform(e),this.refreshRender(),this.updateSmartPad()}isSelect4Layer(e,r,i){return this.layerId==12||this.layerId===i?jr.inPolygon(new S(e,r),[this.pl]):!1}isSelect(e,r,i=!1){return we.smartMode&&i&&this.smartPad&&this.smartPad.isSelect(e,r)?!0:this.model.inShape(e,r)}buildBBox(){let e=this.model.buildBBox();return this.model.refreshBBox&&e!=null&&this.smartPad&&this.smartPad.update(e),this.smartPad!=null&&e!=null?e.extendOfSize(this.smartPad.spotSize):e}getDimensionBBox(){return this.model.getBBox(!0)}toJSON(){let e=this.primitives.map(i=>{if(i instanceof M)return{LINE:{start:i.start(),end:i.end()}};{let{center:n,startAngle:s,rx:a,isCCW:l}=i,c=i.endAngle(),h=l?ae.CCW:ae.CW;return{ARC:{center:n,startAngle:s,endAngle:c,rx:a,sweep:h}}}});return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,num:this.num,center:this.center,rotation:this.rotation,shapes:e,net:this.net,locked:this.locked,expansionType:this.expansionType,pasteExpansion:this.pasteExpansion,topSolderExpansion:this.topSolderExpansion,bottomSolderExpansion:this.bottomSolderExpansion,unusedInnerLayers:this.unusedInnerLayers,plated:this.plated,holeLength:this.holeLength,holeRadius:this.holeRadius,holeShape:this.holeShape,holeRotation:this.holeRotation,holeOffset:this.holeOffset,padRule:this.toPadRuleJson(),padLen:this.padLen,attrsMap:{...this.model.attrsMap}}}remove(){this.clearRelation(),this.smartPad&&this.smartPad.remove(),super.remove(),this.model.remove(),uo.getInstance().padConfig.setCustomColor(this.globalIndex,null)}getType(){return 12}getLines(){let e=this.buildBBox();if(e==null)throw new Error("Pad is Empty!!!");let r=[],i=new M(e.LL(),e.LR()),n=new M(e.LR(),e.UR()),s=new M(e.UR(),e.UL()),a=new M(e.UL(),e.LL()),l=new M(e.LL().add(e.UL()).mul(.5),e.UR().add(e.LR()).mul(.5)),c=new M(e.UL().add(e.UR()).mul(.5),e.LR().add(e.LL()).mul(.5));return r.push(i,n,s,a,l,c),r}};var qs=class extends ua{constructor(e){super();this.type="Length Dimension";this.model=e,e.setModelWatcher(this),this.initRefreshRender()}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId=e,this.refreshRender()}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get box(){return this.model.text.box}get textPosition(){return this.model.textPosition}set textPosition(e){this.model.textPosition=e}get width(){return this.model.strokeWidth}set width(e){this.model.strokeWidth=e,this.refreshRender()}get unit(){return this.model.unit}set unit(e){this.model.unit=e,this.refreshRender()}get precision(){return this.model.precision}set precision(e){this.model.precision=e,this.refreshRender(),Yo.lastPrecision=e}get start(){return this.model.start}set start(e){this.model.calibrateLine([this.start,this.left,this.start,e],!0,!1,0),this.model.start=e,this.refreshRender()}get end(){return this.model.end}set end(e){this.model.calibrateLine([this.end,this.right,this.end,e],!0,!0,1),this.model.end=e,this.refreshRender()}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get strokeWidth(){return this.model.strokeWidth}modifyEnd(e){this.model.end=e,this.model.right=e,this.refreshRender()}modifyDimension(e,r){this.model.start=e,this.model.end=r,this.refreshRender()}get length(){let e=this.model.length*10;this.unit!="mil"&&(e=new dt().conversion1("mil",this.unit,e));let r=Math.pow(10,this.precision);return e=Math.round(e*r)/r,e}set length(e){this.model.length=e,this.refreshRender()}set height(e){this.model.fontSize=e,this.refreshRender()}get height(){return this.model.fontSize}set left(e){this.model.calibrateLine([this.right,this.end,this.left,e],!1,!1,2),this.model.left=e,this.refreshRender()}get left(){return this.model.left}set right(e){this.model.calibrateLine([this.left,this.start,this.right,e],!1,!0,3),this.model.right=e,this.refreshRender()}get right(){return this.model.right}updateText(e){let r=this.model.text;r.position=e}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.transform(i)}transform(e){this.model.transform(e),this.refreshRender()}flip(e){this.model.flip(e),this.refreshRender()}isSelect(e,r){return this.getParent()!=null?!1:this.model.inShape(e,r)}buildBBox(){return this.model.buildBBox()}getLineBBox(){return Ik(this.start,this.end,this.left,this.right,this.strokeWidth,this.lineLen,this.arrLineLen)}toJSON(){var r;return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,start:this.start,end:this.end,precision:this.precision,height:this.height,width:this.width,unit:this.unit,locked:this.locked,leftPoint:this.left,rightPoint:this.right,silkColor:((r=this.silkColor)==null?void 0:r.toString())||null,content:this.model.content,valueTextPosition:this.model.text.position}}getCoords(){return[ve(this.left.x*10,4),ve(this.left.y*10,4),ve(this.start.x*10,4),ve(this.start.y*10,4),ve(this.end.x*10,4),ve(this.end.y*10,4),ve(this.right.x*10,4),ve(this.right.y*10,4)]}getBaseGraphics(){return this.model.getBaseGraphics()}getType(){return 5}get textPath(){return this.model.text.outline}get textMatrix(){return this.model.text.matrix}get viewWidth(){return this.model.text.width}get viewHeight(){return this.model.text.height}get lineLen(){return 10}get arrLineLen(){return 3}get outlineModified(){return this.model.text.outlineModified}};var Ga=class extends ua{constructor(e){super();this.type="Protractor Dimension";this.model=e,e.setModelWatcher(this),this.initRefreshRender()}get textPosition(){return this.model.textPosition}set textPosition(e){this.model.textPosition=e,this.refreshRender()}get box(){return this.model.text.box}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId=e,this.refreshRender()}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get width(){return this.model.strokeWidth}set width(e){e=oo(e),this.model.strokeWidth=e,this.refreshRender()}get precision(){return this.model.precision}set precision(e){this.model.precision=e,os.lastPrecision=e,this.refreshRender()}get center(){return this.model.center}set center(e){this.model.center=e,this.refreshRender()}get height(){return this.model.fontSize}set height(e){e=oo(e),this.model.fontSize=e,this.refreshRender()}get start(){return this.model.start}set start(e){this.model.start=e,this.refreshRender()}get end(){return this.model.end}set end(e){this.model.end=e,this.refreshRender()}get angle(){return this.model.angle}set angle(e){this.model.angle=e,this.refreshRender()}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.model.transform(i),this.refreshRender()}transform(e){this.model.transform(e),this.refreshRender()}flip(e){this.model.flip(e),this.refreshRender()}isSelect(e,r){return this.getParent()!=null?!1:this.model.inShape(e,r)}buildBBox(){return this.model.buildBBox()}getLineBBox(){return aFe(this.center,this.start,this.end,this.strokeWidth)}toJSON(){var r;return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,width:this.width,fontsize:this.model.fontSize,precision:this.precision,center:this.center,end1:this.start,end2:this.end,locked:this.locked,textPosition:this.textPosition,silkColor:((r=this.silkColor)==null?void 0:r.toString())||null}}getCoords(){return[ve(this.start.x*10,4),ve(this.start.y*10,4),ve(this.center.x*10,4),ve(this.center.y*10,4),ve(this.end.x*10,4),ve(this.end.y*10,4)]}getBaseGraphics(){return this.model.getBaseGraphics()}getDegree(){return{center:this.center,radius:this.model.strokeWidth/2+.1,width:this.model.strokeWidth/2}}getType(){return 14}get strokeWidth(){return this.width}get textPath(){return this.model.text.outline}get textMatrix(){return this.model.text.matrix}get viewWidth(){return this.model.text.width}get viewHeight(){return this.model.text.height}get outlineModified(){return this.model.text.outlineModified}};var JM=class extends ro{constructor(t,e){super(),this.gId=t.globalIndex,this.number=e=="delete"?t.number:null,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?Sr.getInstance().encode("DIMENSION",t.model):null,this.action=e,this.deleteGroupID(t)}rebuild(){let{globalIndex:t,partition:e,layerId:r,start:i,end:n,precision:s,height:a,width:l,unit:c,locked:h,leftPoint:u,rightPoint:d,silkColor:p,content:m,valueTextPosition:g}=this.data,y=p?ee.of3(p):null,b=new S(i.x,i.y),P=new S(n.x,n.y),T=new S(u.x,u.y),I=new S(d.x,d.y),C=Yo.rebuild(t,r,b,P,T,I,s,a,l,c,h);return C.updateText(new S(g.x,g.y)),C.partition=e,C.number=this.number,A.publish("hasModifyPcbItem",C),this.addGroupID(C),C.silkColor=y,this.updateFilterStatus(C),this.updateData(),this.data=void 0,C}getItem(){return Yo.getItem(this.gId)}remove(){let t=Yo.getItem(this.gId);this.data=t.toJSON(),this.number=t.number,t.remove(),A.publish("delete",t),A.publish("hasModifyPcbItem",t),this.updateData()}modify(){let{globalIndex:t,layerId:e,start:r,end:i,precision:n,height:s,width:a,unit:l,locked:c,leftPoint:h,rightPoint:u,silkColor:d,content:p,valueTextPosition:m}=this.data,g=d?ee.of3(d):null,y=new S(r.x,r.y),b=new S(i.x,i.y),P=new S(h.x,h.y),T=new S(u.x,u.y),I=Yo.getItem(this.gId),C=I.toJSON();I.globalIndex!=t,!I.left.equals(P)&&!I.right.equals(T)&&!I.start.equals(y)&&!I.end.equals(b)?(I.left=P,I.right=T,I.modifyDimension(y,b)):(I.start.equals(y)||(I.start=y,I.updateText(new S(m.x,m.y))),I.end.equals(b)||(I.end=b,I.updateText(new S(m.x,m.y))),I.left.equals(P)||(I.left=P),I.right.equals(T)||(I.right=T)),I.precision!=n&&(I.precision=n),I.height!=s&&(I.height=s),I.width!=a&&(I.width=a),I.unit!=l&&(I.unit=l),I.locked!=c&&(I.locked=c),this.equals(g,I.silkColor)||(I.silkColor=g),I.layerId!=e&&(I.layerId=e),I.updateText(new S(m.x,m.y)),this.data=C,this.modifyGroupID(I),A.publish("hasModifyPcbItem",I),this.updateData()}equals(t,e){return t!=null&&e!=null?t.equals(e):e==t}upload(t=!1){let e=this.isDelete(t),r=R.getInstance().compiler;e?(r.setTicket(),r.deleteDimension(this.gId)):(this.source==null&&this.updateData(),this.source!=null&&(r.setTicket(),r.uploadDimension(this.gId,this.source))),this.source=null}updateData(){if(this.source==null){let t=Yo.getItem(this.gId);t!=null&&(this.source=Sr.getInstance().encode("DIMENSION",t.model))}}};var zf=class{constructor(t,e,r){this.action=t,this.data=e,this.item=r}};var Hx=class{getConnectCommands(t){let e=La.getInstance().getItem(t),r=new Array;if(e!=null){for(let i of e.relatedIds){let n=this.getItem(i);if(n!=null){let s=Ce.dispatch(n,"modify");this.resetConnectItemInfo(n),r.push(s)}}La.getInstance().delConnect(t)}return r}getItem(t){let e;return e=Kt.getItem(t),e!=null||(e=Xt.getItem(t),e!=null)||(e=pt.getItem(t),e!=null),e}resetConnectItemInfo(t,e=void 0){if(t!=null){let r=t.getComponent();switch(t.type){case"3D Shell - Side Slot Region":r.lineId=e;return;case"3D Shell - Side Entity":r.lineId=e;return;case"Fill Region":r.padId=e;return}}}};var QM=class extends ro{constructor(t,e){super(),this.gId=t.globalIndex,this.data=e=="add"?void 0:t.toJSON(),this.number=e=="delete"?t.number:null,this.source=e=="delete"?Sr.getInstance().encode("PAD",t.model):null;let r=t.getParent();r&&(this.hasParent=!0,this.padNetSource=e=="delete"?Sr.getInstance().encode("PAD_NET",t.model):null,this.padLen=$o.getInstance().getPadLen(r.globalIndex,this.gId)),this.action=e,A.publish("cheakTearDrop",new zf(e,t.toJSON(),t)),this.deleteGroupID(t),le.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",[{id:t.globalIndex,net:t.net,bbox:t.buildBBox()}])}hasConnectChange(){return this.action==="delete"}getConnnectChangeCommand(){return new Hx().getConnectCommands(this.gId)}rebuild(){var G;let{globalIndex:t,partition:e,layerId:r,type:i,num:n,center:s,topType:a,topWidth:l,topHeight:c,topRatio:h,bottomType:u,bottomWidth:d,bottomHeight:p,bottomRatio:m,innerType:g,innerWidth:y,innerHeight:b,innerRatio:P,rotation:T,locked:I,net:C,expansionType:E,pasteExpansion:O,topSolderExpansion:_,bottomSolderExpansion:x,unusedInnerLayers:v,plated:D,holeLength:w,holeRadius:F,holeShape:H,holeRotation:z,holeOffset:V,isTestPad:W,padRule:L,padLen:k,attrsMap:N}=this.data;s=new S(s.x,s.y),V=new S(V.x,V.y);let U=Qt.rebuild(t,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,x,v,D,w,F,H,z,V,W,q0.buildByJson(L),k,N),B=(G=U.getParent())==null?void 0:G.globalIndex;return B&&$o.getInstance().setPadLen(B,U.globalIndex,this.padLen),U.partition=e,U.number=this.number,A.publish("hasModifyPcbItem",U),this.addGroupID(U),this.updateFilterStatus(U),this.updateData(),this.data=void 0,U}getItem(){return Qt.getItem(this.gId)}remove(){var r;this.updateData();let t=Qt.getItem(this.gId);this.data=t.toJSON(),this.number=t.number,A.publish("hasModifyPcbItem",t),t.remove();let e=(r=t.getParent())==null?void 0:r.globalIndex;e&&$o.getInstance().deletePadLen(e,t.globalIndex),A.publish("delete",t)}modify(){var X;let{globalIndex:t,partition:e,layerId:r,type:i,num:n,center:s,topType:a,topWidth:l,topHeight:c,topRatio:h,bottomType:u,bottomWidth:d,bottomHeight:p,bottomRatio:m,innerType:g,innerWidth:y,innerHeight:b,innerRatio:P,rotation:T,locked:I,net:C,expansionType:E,pasteExpansion:O,topSolderExpansion:_,bottomSolderExpansion:x,unusedInnerLayers:v,plated:D,holeLength:w,holeRadius:F,holeShape:H,holeRotation:z,holeOffset:V,padRule:W,padLen:L,attrsMap:k}=this.data;s=new S(s.x,s.y);let N=new S(V.x,V.y),U=Qt.getItem(this.gId),B=U.toJSON();U.partition!=e&&(U.partition=e),U.layerId!=r&&(U.layerId=r),U.num!=n&&(U.num=n),U.type!=i&&(U.type=i),U.padLen!=L&&(U.padLen=L),U.clearMap();for(let K in k)U.addATTRMap(K,k[K]);let G=(X=U.getParent())==null?void 0:X.globalIndex;if(G){let K=$o.getInstance().getPadLen(G,U.globalIndex);$o.getInstance().setPadLen(G,U.globalIndex,this.padLen),this.padLen=K}U.center.equals(s)||(U.center=s),U.top&&(U.top=Lo.getStyle(a,l,c,h,U.top.pl)),U.inner&&(U.inner=Lo.getStyle(g,y,b,P,U.inner.pl)),U.bottom&&(U.bottom=Lo.getStyle(u,d,p,m,U.bottom.pl)),U.rotation!=T&&(U.rotation=T),U.locked!=I&&(U.locked=I),U.net!=C&&(A.publish("hasModifyPcbItem",U),U.net=C),U.expansion=yu.getPadExpansion(E,O,_,x),U.unusedInnerLayers.toString()!=v.toString()&&(U.unusedInnerLayers=v),U.plated!=D&&(U.plated=D),U.hole&&(U.hole=nc.getHoleStyle(w,F,H,z,N));let Y=U.padRule;W==null||Y==null?W!=Y&&(U.padRule=q0.buildByJson(W)):U.padRule=qh.getPadRule(W.connectMode,W.lineClearance,W.lineWidth,W.lineAngle),this.data=B,this.modifyGroupID(U),A.publish("hasModifyPcbItem",U),this.updateData()}upload(t=!1){let e=R.getInstance().compiler,r=e.consistencyManager.getMaxTicket();this.isDelete(t)?(this.padNetSource&&(e.setTicket(++r),e.deletePadNet(this.padNetSource.componentId,this.padNetSource.padNum,this.padNetSource.padId)),this.hasParent||(e.setTicket(++r),e.deletePad(this.gId))):(this.source==null&&this.updateData(),this.padNetSource&&(e.setTicket(++r),e.uploadPadNet(this.padNetSource)),!this.hasParent&&this.source&&(e.setTicket(++r),e.uploadPad(this.gId,this.source))),this.padNetSource=void 0,this.source=void 0}updateData(){if(this.source==null){let t=Qt.getItem(this.gId);if(t!=null){let e=t.getParent();this.source=Sr.getInstance().encode("PAD",t.model),this.padNetSource=e&&Sr.getInstance().encode("PAD_NET",t.model)}}}};var K9t=new Set(["3D Shell - Outline","3D Shell - Side Slot Region","3D Shell - Top Slot Region","3D Shell - Screw Pillar","3D Shell - Side Datum Line","3D Shell - Top/Bottom Entity","3D Shell - Side Entity"]),bl=class{constructor(t,e,r=[]){this.type=e,t===null?this.componentData=t:typeof t=="string"?this.componentData=t:this.componentData=JSON.stringify(t),Array.isArray(r)&&!le.pcbConfig.isRebuildCopperAuto?this.copperData=JSON.stringify(r):this.copperData=JSON.stringify([])}is3DShell(){return K9t.has(this.type)}rebuildComponent(t){let e=t.getComponent();this.updateComponent(e,t.globalIndex,t)}setComponentData(t,e){this.componentData=t,this.copperData=e}modifyComponent(t){let e=t.getComponent();this.updateComponent(e,t.globalIndex,t)}updateComponent(t,e,r){try{t instanceof y0?this.updateD3ShellOutlineComponent(t,e):t instanceof Rf?this.updateD3ShellScrewPillarComponent(t,e):t instanceof wh?this.updateD3ShellSlotRegionComponent(t,e):t instanceof ml?this.updateD3ShellEntityComponent(t,e):t instanceof xn?this.updateFillComponent(t,e,r):t instanceof Fu?this.updateProhibitComponent(t,e):t instanceof Dh?this.updateConstraintComponent(t,e):t instanceof Zi?this.updateBridgingCopperComponent(t,e,r):t instanceof tu?this.updateFPCStiffenerComponent(t,e):t instanceof Sb?this.updateTearDropComponent(t,e):t instanceof ac&&this.updatePartitionComponent(t,e)}catch(i){console.error("Component update failed",i)}}deleteComponent(t){let e=t==null?void 0:t.getComponent();e instanceof Zi?La.getInstance().delConnectRelatedId(e.padId,t.globalIndex):(e instanceof ml||e instanceof wh)&&La.getInstance().delConnectRelatedId(e.lineId,t.globalIndex)}updateD3ShellOutlineComponent(t,e){let{shellHeight:r,botShellHeight:i,pushCoverDir:n,topInnerHeight:s,bottomInnerHeight:a,substrateHeight:l,type:c,shellThickness:h}=JSON.parse(this.componentData);t.shellHeight!==r&&(t.shellHeight=r),t.pushCoverDir!==n&&(t.pushCoverDir=n),t.botShellHeight!==i&&(t.botShellHeight=i),t.substrateHeight!==l&&(t.substrateHeight=l),t.type!==c&&(t.type=c),t.shellThickness!==h&&(t.shellThickness=h),t.topInnerHeight!==s&&(t.topInnerHeight=s),t.bottomInnerHeight!==a&&(t.bottomInnerHeight=a)}updateD3ShellScrewPillarComponent(t,e){let{specification:r,height:i,holeDiameter:n,thickness:s,counterboreProps:a,stiffenerProps:l}=JSON.parse(this.componentData);t.specification!==r&&(t.specification=r),t.height!==i&&(t.height=i),t.holeDiameter!==n&&(t.holeDiameter=n),t.thickness!==s&&(t.thickness=s),JSON.stringify(t.counterboreProps)!==JSON.stringify(a)&&(t.counterboreProps=a),JSON.stringify(t.stiffenerProps)!==JSON.stringify(l)&&(t.stiffenerProps=l)}updateD3ShellSlotRegionComponent(t,e){let{lineId:r,type:i,slotDepth:n,slotOption:s}=JSON.parse(this.componentData),a=La.getInstance(),l=t.lineId;l&&a.delConnectRelatedId(l,e),r&&a.addConnectRelatedId(r,e),l!==r&&(t.lineId=r),t.type!==i&&(t.type=i),t.slotDepth!==n&&(t.slotDepth=n),t.slotOption=s}updateD3ShellEntityComponent(t,e){let{lineId:r,type:i,stretchLength:n,belong:s}=JSON.parse(this.componentData),a=La.getInstance(),l=t.lineId;l&&a.delConnectRelatedId(l,e),r&&a.addConnectRelatedId(r,e),l!==r&&(t.lineId=r),t.type!==i&&(t.type=i),t.stretchLength!==n&&(t.stretchLength=n),t.belong!==s&&(t.belong=s)}updateFillComponent(t,e,r){let{style:i,gridLineWidth:n,clearance:s,keepIsland:a,optimization:l,name:c,optimizationValue:h,order:u}=JSON.parse(this.componentData),d=JSON.parse(this.copperData);r&&JSON.stringify(t.copperResult)!=this.copperData&&(t.copperResult=d),t.style!==i&&(t.style=i),t.gridLineWidth!==n&&(t.gridLineWidth=n),t.clearance!==s&&(t.clearance=s),t.keepIsland!==a&&(t.keepIsland=a),t.optimization!==l&&(t.optimization=l),t.name!==c&&(t.name=c),t.optimizationValue!==h&&(t.optimizationValue=h),t.order!==u&&(t.order=u)}updateProhibitComponent(t,e){let{device:r,track:i,copper:n,fill:s,planzone:a}=JSON.parse(this.componentData);t.device!==r&&(t.device=r),t.track!==i&&(t.track=i),t.copper!==n&&(t.copper=n),t.fill!==s&&(t.fill=s),t.planzone!==a&&(t.planzone=a)}updateConstraintComponent(t,e){let{name:r}=JSON.parse(this.componentData);t.name!==r&&t.modifyName(r)}updateBridgingCopperComponent(t,e,r){if(!this.componentData)return;let{padId:i,isBridgingCopper:n,networkList:s}=JSON.parse(this.componentData),a=t.padId;if(t.padId!==i){t.padId=i;let l=La.getInstance();i==null?a&&l.delConnectRelatedId(a,e):l.addConnectRelatedId(i,e)}t.isBridgingCopper!==n&&(t.isBridgingCopper=n,n&&(Ye.delete(r),r.model.netModified=!0)),yee(t.networkList,s,!0)||(t.networkList=s)}updateFPCStiffenerComponent(t,e){let{material:r,fpcModel:i,thickness:n}=JSON.parse(this.componentData);t.material!==r&&(t.material=r),t.fpcModel!==i&&(t.fpcModel=i),t.thickness!==n&&(t.thickness=n)}updateTearDropComponent(t,e){let{connects:r}=JSON.parse(this.componentData);t.connects!==r&&(t.connects=r,pt.addConncect(pt.getItem(e),r))}updatePartitionComponent(t,e){let{fileUuid:r,name:i}=JSON.parse(this.componentData);t.fileUuid!==r&&(t.fileUuid=""),t.name!==i&&(t.name=i)}};var Vre=new aA(o=>{let t=new $u(10);return o.forEach((e,r)=>{r!==0&&t.insert(e)}),t});var Jr=class extends Qp{constructor(t){super(),this.model=t,t.setModelWatcher(this),this.pls.length==1&&this.pls[0].primitives.length==1&&this.pls[0].primitives[0]instanceof M&&this.model.style=="solid"&&(this.model.style="90grid"),this.initRefreshRender()}isSelect(t,e){let{style:r,optimization:i,gridLineWidth:n,optimizationWidth:s,pls:a}=this,l=new S(t,e);switch(r){case"solid":{let c=rx.pipsSASM(l,a,Vre.get(a));if(!c&&i){for(let h of Vre.get(a).search(l.bbox().extendOfSize(this.optimizationWidth+1e-5)))for(let u of h.primitives)if(u instanceof M?c=Da(l,u.start(),u.end(),s):u instanceof q&&(c=$0(l,u.center,u.rx,u.startAngle/180*Math.PI,u.endAngle()/180*Math.PI,u.sweep(),s)),c)return c}return c}case"90grid":case"45grid":{let c=!1;for(let h of a)for(let u of h.primitives)if(u instanceof M?c=Da(l,u.start(),u.end(),n):u instanceof q&&(c=$0(l,u.center,u.rx,u.startAngle/180*Math.PI,u.endAngle()/180*Math.PI,u.sweep(),n)),c)return c;return!1}case"none":break}return!1}get viewGroupId(){return this.model.modelType+this.net}get style(){return this.model.style}get gridLineWidth(){return this.model.gridLineWidth}get clearance(){return this.model.clearance}get optimization(){return this.model.optimization}get optimizationWidth(){return this.model.optimizationWidth}get isSolid(){return this.model.style=="solid"}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId!=t&&(this.model.layerId=t,this.refreshRender())}get viewColor(){var i,n;let t=this.color,e=(n=(i=le)==null?void 0:i.themeConfig)==null?void 0:n.canvasTheme;if(e){let s=e.copperRegionTransparency;t=ee.of6(t,1-s)}let r=Mt.getTransparencyByPcbType(this,t);return r&&t.alpha!=r&&(t=ee.of6(t,r)),t}get isPlaneZone(){return!1}get viewStyle(){return this.style}fill(){jt.getVisible(21)?this.visible():this.hidden()}rotateFor(t,e){}visible(t=!1){super.visible(t)}getOutline(t=this.layerId,e=0){return this.pls}getRealOutline(){return this.model.getRealOutline()}get syncSelectCheckParent(){return!1}remove(){super.remove(),Vre.map.delete(this.pls)}toJSON(){return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,net:this.net,style:this.style,gridLineWidth:this.gridLineWidth,clearance:this.clearance,optimization:this.optimization,copperPath:this.copperPath,optimizationWidth:this.optimizationWidth}}};var e4=class{constructor(t,e=!0){this._layerId=t,this._keepIsland=e}get layerId(){return this._layerId}set layerId(t){this._layerId=t}get keepIsland(){return this._keepIsland}set keepIsland(t){this._keepIsland=t}toJSON(){return{layerId:this._layerId,keepIsland:this._keepIsland}}};var Gi=class extends Qp{constructor(t){super(),this.model=t,t.setModelWatcher(this);let e=t.layerId;Pe.getActiveLayerID()!=this.layerId?this.hidden():this.fill();let r=Pe.fetchPlanzoneLayerKeepIsland(e),i=typeof r>"u"?!0:r;if(!Pd.hasProfileItem(e))Pd.addProfileItem(e,new e4(e,i));else{let n=Pd.fetchProfileItem(e);n.keepIsland=i,Pd.updateProfileItem(e,n)}}get style(){return this.model.style}set style(t){this.model.style=t}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId!=t&&(this.model.layerId=t,this.refreshRender())}get viewColor(){let t=this.color,e=Mt.getTransparencyByPcbType(this,t);return e!=null&&t.alpha!=e&&(t=ee.of6(t,e)),t}get viewStyle(){return this.style?"solid":"none"}get isPlaneZone(){return!0}get gridLineWidth(){return 0}get optimization(){return!1}fill(){this.refreshRender()}transform(t){}toJSON(){return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,net:this.net,style:this.style,copperPath:this.copperPath}}getOutline(t,e){return this.pls}};function Z9t(o,t){return(e,r,i=!0)=>(o.whetherCheckNet=i,o.needCheckIntersection(e,r)?t.checkIntersection(e,r):!1)}var nCe=class{constructor(t){this.item=t,this._box=t.buildBBox()}bbox(){return this._box}},sCe=["Track","ArcTrack","Pad","Via","Polygon","Circle","Rect","Copper","Inner"],oCe=class{constructor(t){this.parent=new Uint32Array(t),this.rank=new Uint32Array(t);for(let e=0;e<t;e++)this.parent[e]=e,this.rank[e]=0}find(t){return this.parent[t]!==t&&(this.parent[t]=this.find(this.parent[t])),this.parent[t]}union(t,e){let r=this.find(t),i=this.find(e);r!==i&&(this.rank[r]<this.rank[i]?this.parent[r]=i:this.rank[r]>this.rank[i]?this.parent[i]=r:(this.parent[i]=r,this.rank[r]++))}getGroups(){var e;let t=new Map;for(let r=0;r<this.parent.length;r++){let i=this.find(r);t.has(i)||t.set(i,[]),(e=t.get(i))==null||e.push(r)}return t}recycle(){this.parent=null,this.rank=null}},Ay=class{constructor(t,e){this.groups=new Array;this.treeMap=new Map;this.map=new Map;let r=new gd,i=new uy;this.isTouch=Z9t(r,i),this.items=this.filter(t),this.excluded=e==null?new Set(t):e;let n=0;this.items.forEach(s=>{this.map.set(s,n++),this.insert(s)}),Zh.getInstance().clear()}insert(t){let e=new nCe(t),r=t.model;if(r instanceof xi){let i=r.modelType,n=r.layerId,s=this.treeMap.get(i);s==null&&(s=new Map,this.treeMap.set(i,s));let a=s.get(n);a==null&&(a=new $u(15),s.set(n,a)),a.insert(e)}}filter(t){return t=t.filter(e=>{var r;return e instanceof Le||e instanceof Ge||e instanceof Ue?!0:e instanceof He&&(e.type=="Line"||e.type=="Fill Region")&&((r=Pe.getLayer(e.layerId))==null?void 0:r.isSignalLayer())||!1}),t}updateScene(){if(this.items.length>1){let e=(()=>{var l;let r=new oCe(this.items.length),i=!1,n=Array.from(this.treeMap.entries()).map(([c,h])=>{let u=new Map(Array.from(h.entries()).sort(([,d],[,p])=>d.items.size-p.items.size));return[c,u]}),s=new Set(n.map(([c])=>c));for(let[c,h]of n){for(let[,u]of h){let d=this.getSearchLayerIds(c,Array.from(u.items)[0].item);for(let p of s){i=p==c;for(let m of d){let g=(l=this.treeMap.get(p))==null?void 0:l.get(m);if(g!=null)for(let y of u.items){let b=y.item,P=this.map.get(b);g.search2Cb(b.buildBBox(),T=>{let I=T.item,C=this.map.get(I);if(i&&C<=P)return;this.isTouch(b.model,I.model)&&r.union(P,C)})}}}u.recycle()}s.delete(c)}let a=r.getGroups();return r.recycle(),a})();this.groups=Array.from(e.values()).map(r=>r.map(i=>this.items[i])),this.scene=this.groups.length<=1?1:2}else this.items.length===1?this.scene=0:this.scene=void 0}getSearchLayerIds(t,e){let r;switch(t){case"Track":case"ArcTrack":r=[e.layerId,12];break;case"Pad":e.layerId==12?(r=Pe.getAllCopperLayerIds(),r.push(12)):r=[e.layerId,12];break;case"Via":r=Pe.getAllCopperLayerIds(),r.push(12);break;case"Polygon":case"Rect":case"Circle":e instanceof He&&Ud(e.layerId)&&(e.type=="Fill Region"||e.type=="Copper Region"||e.type=="Line"||e.type=="TearDrop")?r=[e.layerId,12]:r=[];break;case"Copper":case"Inner":e instanceof Qp?r=[e.layerId,12]:r=[];break;default:{r=[];break}}return r}getNetPcbItems(t){let e=new Set,r=new Set,i=!1;switch(this.scene){case 0:let n=this.items[0];if(r=this.getNearItems(n),r.size==0)break;r=this.filterItemNet(r),r=jt.selectItemFilter(t.sceneX,t.sceneY,r),r=this.checkIntersection(n,r);let s=this.getNearItemNets(r);s.size>1&&(i=!0),e.add({group:this.items,nets:s});break;case 1:case 2:for(let a of this.groups){if(!a)continue;let l=new Set;for(let c of a){let h=this.getNearItems(c);if(h.size==0)continue;h=this.filterItemNet(h),h=jt.selectItemFilter(t.sceneX,t.sceneY,h),h=this.checkIntersection(c,h);let u=this.getNearItemNets(h);if(u.size>1){i=!0;break}xe.addAllSet(l,u)}l.size===1&&e.add({group:a,nets:l})}break}return{netsGroupSet:e,isMoreThan2Nets:i}}getNearItems(t){let e=new Set,r;if(t instanceof Le?t.layerId==12?r=(i,n)=>!!(i&&Ud(i)||i==12):r=(i,n)=>t.layerId==i||i==12:t instanceof Ge?r=(i,n)=>t.layerId==i||i==12:t instanceof Ue?r=(i,n)=>!!(i&&t.isContains(i)||i==12):t instanceof He&&(t.layerId==12?r=(i,n)=>!!(i&&Ud(i)||i==12):r=(i,n)=>t.layerId==i||i==12),r!=null){let i=kt.search4Types(t.buildBBox(),sCe,r);for(let n of i.getResult(jd))t!==n&&(this.excluded.has(n)||e.add(n))}return e}getConnectItems(){let t=this.items[0];if(t==null)return new Set;let e=this.getNearItems(t);return this.checkIntersection(t,e)}filterItemNet(t){let e=new Set;return t.forEach(r=>{var i;(r instanceof Ge||r instanceof Ue||r instanceof _i||r instanceof sn||r instanceof Jr||r instanceof Gi||r instanceof He&&(r.type=="Line"||r.type=="Fill Region")&&((i=Pe.getLayer(r.layerId))!=null&&i.isSignalLayer()))&&e.add(r)}),e}getNearItemNets(t){let e=new Set;return t.forEach(r=>{let i=r.net;i&&!e.has(i)&&e.add(i)}),e}checkIntersection(t,e){let r=new Set;return e.forEach(i=>{this.isTouch(t.model,i.model,!1)&&r.add(i)}),r}recycle(){this.excluded=null,this.groups=null,this.treeMap=null,this.map=null,this.items=null}};var mn=class extends Ls{constructor(t){super();let e=new Jt;this._startNode=e.getConnectNode(t.startId),this._endNode=e.getConnectNode(t.endId),this.model=t,t.setModelWatcher(this),this._startNode.addRatline(this),this._endNode.addRatline(this),this.refreshRender()}get start(){return this.model.start}set start(t){this.model.start.equals(t)||(this.model.start=t,this.refreshRender())}get locked(){return this.model.locked}set locked(t){this.model.locked=t}get end(){return this.model.end}set end(t){this.model.end.equals(t)||(this.model.end=t,this.refreshRender())}get startNode(){return this._startNode}get endNode(){return this._endNode}get net(){return this.model.net.toUpperCase()}get showNet(){return this.model.net}get color(){return this._color||Ye.getSpecialColor(this.net)}set color(t){t?this._color=t:delete this._color}get layerId(){return this.model.layerId}get viewGroupId(){return this.model.modelType+this.net}get viewGroupIdModified(){return!1}getInfoForConnectType(t){if(t instanceof Ge)return{type:"Track",id:`${Tr}${t.number}`,net:t.net,globalIndex:t.globalIndex};if(t instanceof Ue)return{type:"Via",id:`${Tr}${t.number}`,net:t.net,globalIndex:t.globalIndex};if(t instanceof Le){let e=t.getParent();return e instanceof ke?{type:e.name,id:t.num,net:t.net,globalIndex:t.globalIndex}:{type:"Pad",id:`${Tr}${t.number}`,net:t.net,globalIndex:t.globalIndex}}else return t instanceof He?{type:t.type,id:`${Tr}${t.number}`,net:t.net||"",globalIndex:t.globalIndex}:t instanceof Jr?{type:"Copper Region(Filled)",id:`${Tr}${t.number}`,net:t.net,globalIndex:t.globalIndex}:t instanceof Gi?{type:"Plane Zone",id:`${Tr}${t.number}`,net:t.net,globalIndex:t.globalIndex}:null}rotateFor(t,e){this.model.rotateFor(t,e)}remove(){this._startNode.removeRatline(this),this._endNode.removeRatline(this),this.model.remove(),super.remove()}getViewState(){return this.isEmpty?"Not Shown":this.isVisible?this.isHighLight?"Main And Highlight":"Only Main":"Not Shown"}getType(){return 25}transform(t){}isSelect(t,e){return this.model.inShape(t,e)}getEndsInfo(){return{start:this.getInfoForConnectType(this.startNode),end:this.getInfoForConnectType(this.endNode)}}buildBBox(){return this.model.buildBBox()}getLength(){return this.model.length}};function Ao(o){return o instanceof Qo||o instanceof mn?o.showNet:null}function _y(o){if(o instanceof He&&["Line","Copper Region","Fill Region"].includes(o.type)||o instanceof sn){let t=o.net;if(o.net)return;if(Pe.getLayer(o.layerId).isSignalLayer()){let e;if(o instanceof He&&o.type=="Copper Region"){let i=o.getMathGraphics();e=Vr.getSelectContect(i)}else e=new Ay([o]).getConnectItems();let r=new Set;for(let i of e)if(i.layerId==o.layerId||ar(i.layerId)||i instanceof Ue){let n=Ao(i);n&&r.add(n)}r.size>0&&(r.has("GND")?t="GND":t=Array.from(r)[0])}o.net=t}}function mS(){let o=Xt.getAllItem(),t=Kt.getAllItem(),e=pt.getAllItem();return[].concat(o,t,e)}function u1(o){return Xt.getItem(o)||Kt.getItem(o)||pt.getItem(o)}var eT=class o{constructor(){this.data=new Set}static getInstance(){return o.proxy||(o.proxy=new o),o.proxy}addData(t){this.data.add(t)}upload(){let t=R.getInstance().compiler;this.data.forEach(e=>{t.setTicket();let r=u1(e);if(r&&r.type=="Copper Region"){let i=Sr.getInstance().encode("POURED",Array.from(r.copperResultMap||[]));t.uploadPoured(e,i)}else t.deletePoured(e)}),this.data.clear()}};var Wx=class extends ro{constructor(e,r){super();this.hasCommand=!0;if(le.pcbConfig.isRebuildCopperAuto){this.hasCommand=!1;return}this.gId=e.globalIndex,this.data=r=="add"?void 0:e.toJSON(),this.action=r,this.deleteGroupID(e);let i=e.getParent();i!=null&&(this.parentGId=i.globalIndex)}rebuild(){if(!this.hasCommand)return;let r=new Jt().getItem(this.parentGId),{globalIndex:i,layerId:n,net:s,style:a,gridLineWidth:l,clearance:c,optimization:h,copperPath:u,optimizationWidth:d}=this.data,p=Ti.rebuildCopper(i,n,s,a,l,c,h,u,d);return this.addGroupID(p),r!=null&&(r.addCopperResult(p),r.model.addCopper(this.gId),p.setParent(r),r.refreshRender()),this.updateFilterStatus(p),A.publish("hasModifyPcbItem",p),this.updateData(),this.data=void 0,p}getItem(){return Ti.getItem(this.gId)}remove(){if(!this.hasCommand)return;let r=new Jt().getItem(this.parentGId),i=Ti.getItem(this.gId);i&&(A.publish("hasModifyPcbItem",i),this.data=i.toJSON(),i.remove(),r!=null&&(r.model.deleteCopper(this.gId),r.deleteCopperResult(i,i.globalIndex)),A.publish("delete",i),this.updateData())}modify(){if(!this.hasCommand)return;let{globalIndex:e,layerId:r,net:i,style:n,gridLineWidth:s,clearance:a,optimization:l,copperPath:c,optimizationWidth:h}=this.data,u=Ti.getItem(this.gId);if(!u)return;let d=u.toJSON();u.net!=i&&(u.net=i),u.copperPath.toString()!=c.toString()&&(u.pls=Jh(c)),this.data=d,this.modifyGroupID(u),this.updateData(),A.publish("hasModifyPcbItem",u)}upload(e=!1){eT.getInstance().addData(this.parentGId)}updateData(){}};var zx=class{constructor(){this.coppers=new Array}recordCopperCommand(t,e){e=="delete"&&(t.iteratorCopper(r=>{le.pcbConfig.isRebuildCopperAuto||this.coppers.push(new Wx(r,e)),eT.getInstance().addData(t.globalIndex)}),eT.getInstance().upload())}rebuildCoppers(){for(let t of this.coppers)t.rebuild(),eT.getInstance().addData(t.parentGId);eT.getInstance().upload()}removeCoppers(){for(let t of this.coppers)t.remove(),eT.getInstance().addData(t.parentGId)}};var I3=class extends ro{constructor(e,r){super();this.dataMap=new Map;this.hasCommand=!0;if(this.parentGId=e.globalIndex,le.pcbConfig.isRebuildCopperAuto){this.hasCommand=!1;return}this.action=r,r!="add"&&e.iteratorCopper(i=>{this.dataMap.set(i.globalIndex,i.toJSON())})}rebuild(){if(!this.hasCommand)return;let e=u1(this.parentGId);this.do(e),this.updateFilterStatus(e)}do(e){let r=new Map;e.iteratorCopper(i=>{r.set(i.globalIndex,i.toJSON()),A.publish("hasModifyPcbItem",i),i.remove(),e!=null&&(e.model.deleteCopper(this.gId),e.deleteCopperResult(i,i.globalIndex)),A.publish("delete",i),this.updateData()});for(let[,i]of this.dataMap){let{globalIndex:n,layerId:s,net:a,style:l,gridLineWidth:c,clearance:h,optimization:u,copperPath:d,optimizationWidth:p}=i,m=Ti.rebuildCopper(n,s,a,l,c,h,u,d,p);this.modifyGroupID(m),e!=null&&(e.addCopperResult(m),e.model.addCopper(n),m.setParent(e),e.refreshRender()),m.fill(),A.publish("hasModifyPcbItem",m),this.updateData()}this.dataMap=r}remove(){if(!this.hasCommand)return;let e=u1(this.parentGId);this.do(e)}modify(){if(!this.hasCommand)return;let e=u1(this.parentGId);this.do(e)}getItem(){return"ignore"}upload(e){let r=R.getInstance().compiler;r.setTicket();let i=u1(this.parentGId);if(i&&i.type=="Copper Region"){let n=Sr.getInstance().encode("POURED",Array.from(i.copperResultMap||[]));r.uploadPoured(this.parentGId,n)}else r.deletePoured(this.parentGId)}updateData(){}};var cA=class extends pg{constructor(e,r){super();this.copperTool=new zx;let i=e.getComponent(),n=i instanceof xn?i.copperResult:[];this.gId=e.globalIndex,this.type=e.type,this.number=r=="delete"?e.number:null,this.data=r=="add"?void 0:e.toJSON(),this.source=r=="delete"?Sr.getInstance().encodeProfile(e.model):null,this.tool=new bl(JSON.stringify(e.getComponent()),e.type,n),this.action=r,this.deleteGroupID(e),this.copperTool.recordCopperCommand(e,r),le.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",[{id:e.globalIndex,net:e.net,bbox:e.buildBBox()}])}rebuild(){let{globalIndex:e,partition:r,type:i,layerId:n,center:s,radius:a,strokeWidth:l,locked:c,net:h,silkColor:u,regionRuleSelector:d,componentData:p}=this.data,m=u?ee.of3(u):null,g=new S(s.x,s.y),y=this.rebuildCircle(e,i,n,g,a,l,c,h,m);return y.partition=r,y.number=this.number,A.publish("hasModifyPcbItem",y),this.addGroupID(y),this.updateFilterStatus(y),this.tool.rebuildComponent(y),this.copperTool.rebuildCoppers(),y.type==="FPC Stiffener"?A.publish("checkOpenStiffenerLayer",{notShowTip:!0}):y.type=="Partition"&&this.rebuildPartition(y),this.rebuildRegionSelector(y,d),this.updateData(),this.data=void 0,y}rebuildCircle(e,r,i,n,s,a,l,c,h){return Kt.rebuild(e,r,i,n,s,a,l,c,h)}getItem(){return Kt.getItem(this.gId)}remove(){let e=this.getItem();this.data=e.toJSON(),this.number=e.number,this.tool.deleteComponent(e);let r=e.getComponent(),i=r?JSON.stringify(r):"{}",n=r instanceof xn?JSON.stringify(r.copperResult):"[]";this.tool.setComponentData(i,n),A.publish("hasModifyPcbItem",e),this.copperTool.removeCoppers(),e.remove(),this.removeRegionSelector(),A.publish("delete",e),this.updateData()}modify(){let{globalIndex:e,type:r,layerId:i,center:n,radius:s,strokeWidth:a,locked:l,net:c,silkColor:h,regionRuleSelector:u}=this.data,d=h?ee.of3(h):null,p=new S(n.x,n.y),m=this.getItem(),g=m.toJSON(),y=m.getComponent(),b=y?JSON.stringify(y):"{}",P=y instanceof xn?JSON.stringify(y.copperResult):"[]";m.removeFill(),m.type!=r&&(m.type=r),m.layerId!=i&&(m.layerId=i),m.center.equals(p)||(m.center=p),m.radius!=s&&(m.radius=s),m.strokeWidth!=a&&(m.strokeWidth=a),m.locked!=l&&(m.locked=l),m.net!=c&&(A.publish("hasModifyPcbItem",m),m.net=c),this.equals(d,m.silkColor)||(m.silkColor=d),this.data=g,this.modifyGroupID(m),this.tool.modifyComponent(m),this.tool.setComponentData(b,P),this.modifyRegionSelector(m,u),m.fill(),m.toggleCopperResult(!m.hiddenCopperResult),A.publish("hasModifyPcbItem",m),this.updateData()}compareDataChange(e){let r=Kt.getItem(this.gId);if(!r||this.action!=="modify")return!0;let i=this.data,n=r.toJSON(),s=["center","radius","strokeWidth","type"];if(a(n,s)!==a(i,s)&&(r.type=="Copper Region"||i.type=="Copper Region"))return e.push(new I3(r,"delete")),r.clearCopper(),!0;if(JSON.stringify(this.data)!==JSON.stringify(r))return!0;return!1;function a(l,c){let h=c.map(u=>l[u]);return JSON.stringify(h)}}comparePourChange(){let e=this.data,r=Kt.getItem(this.gId);return!r||this.action!=="modify"?{action:"fullUpdate",data:null}:e.type=="Copper Region"&&r.type!=="Copper Region"?{action:"fullUpdate",data:null}:e.type!=="Copper Region"&&r.type=="Copper Region"?{action:"fullUpdate",data:null}:r.model.component.name!==e.componentData.name?{action:"halfUpdate",data:{id:r.globalIndex,key:"name",value:r.model.component.name}}:r.net!==e.net?{action:"halfUpdate",data:{id:r.globalIndex,key:"net",value:r.net}}:r.layerId!==e.layerId?{action:"halfUpdate",data:{id:r.globalIndex,key:"layerId",value:r.layerId}}:{action:"notUpdate",data:null}}upload(e=!1){let r=R.getInstance().compiler,i=r.consistencyManager.getMaxTicket();this.isDelete(e)?(r.setTicket(++i),h3(this.gId,this.type)):(this.source==null&&this.updateData(),r.setTicket(++i),c3(this.gId,this.type,this.source)),this.source=null}updateData(){if(this.source==null){let e=Kt.getItem(this.gId);e!=null&&(this.source=Sr.getInstance().encodeProfile(e.model),this.type=e.type)}}};var t4=class extends ro{constructor(t,e){super(),this.gId=t.globalIndex,this.number=e=="delete"?t.number:null,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?Sr.getInstance().encode("DIMENSION",t.model):null,this.action=e,this.deleteGroupID(t)}rebuild(){let{globalIndex:t,partition:e,layerId:r,width:i,fontsize:n,precision:s,center:a,end1:l,end2:c,locked:h,textPosition:u,silkColor:d}=this.data,p=d?ee.of3(d):void 0,m=new S(a.x,a.y),g=new S(l.x,l.y),y=new S(c.x,c.y),b=new S(u.x,u.y),P=os.rebuild(t,r,i,n,s,m,g,y,h);return P.textPosition=b,P.partition=e,P.number=this.number,A.publish("hasModifyPcbItem",P),this.addGroupID(P),P.silkColor=p,this.updateFilterStatus(P),this.updateData(),this.data=void 0,P}getItem(){return os.getItem(this.gId)}remove(){let t=os.getItem(this.gId);this.data=t.toJSON(),this.number=t.number,A.publish("hasModifyPcbItem",t),t.remove(),A.publish("delete",t),this.updateData()}modify(){let{globalIndex:t,layerId:e,width:r,fontsize:i,precision:n,center:s,end1:a,end2:l,locked:c,textPosition:h,silkColor:u}=this.data,d=u?ee.of3(u):void 0,p=new S(s.x,s.y),m=new S(a.x,a.y),g=new S(l.x,l.y),y=new S(h.x,h.y),b=os.getItem(this.gId),P=b.toJSON();b.layerId!=e&&(b.layerId=e),b.width!=r&&(b.width=r),b.height!=i&&(b.height=i),b.precision!=n&&(b.precision=n),b.center.equals(p)||(b.center=p),b.start.equals(m)||(b.start=m),b.end.equals(g)||(b.end=g),b.textPosition.equals(y)||(b.textPosition=y),b.locked!=c&&(b.locked=c),d||(b.silkColor=void 0),this.equals(b.silkColor,d)||(b.silkColor=d),this.data=P,this.modifyGroupID(b),A.publish("hasModifyPcbItem",b)}equals(t,e){return t!=null&&e!=null?t.equals(e):e==t}upload(t=!1){let e=this.isDelete(t),r=R.getInstance().compiler;e?(r.setTicket(),r.deleteDimension(this.gId)):(this.source==null&&this.updateData(),this.source!=null&&(r.setTicket(),r.uploadDimension(this.gId,this.source))),this.source=void 0}updateData(){if(this.source==null){let t=os.getItem(this.gId);t!=null&&(this.source=Sr.getInstance().encode("DIMENSION",t.model))}}};var hA=class extends pg{constructor(e,r){super();this.copperTool=new zx;let i=e.getComponent(),n=i instanceof xn?i.copperResult:[];this.gId=e.globalIndex,this.type=e.type,this.number=r=="delete"?e.number:null,this.data=r=="add"?void 0:e.toJSON(),this.source=r=="delete"?Sr.getInstance().encodeProfile(e.model):null,this.tool=new bl(JSON.stringify(i),e.type,n),this.action=r,this.deleteGroupID(e),this.copperTool.recordCopperCommand(e,r),le.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",[{id:e.globalIndex,net:e.net,bbox:e.buildBBox()}])}rebuild(){let e=this.data,{globalIndex:r,partition:i,type:n,layerId:s,start:a,width:l,height:c,net:h,locked:u,strokeWidth:d,rotation:p,silkColor:m,cornerRadius:g,componentData:y}=e,b=m?ee.of3(m):null,P=new S(a.x,a.y),T=this.rebuildRect(r,n,s,P,l,c,h,u,d,p,g,b);return T.partition=i,T.number=this.number,A.publish("hasModifyPcbItem",T),this.addGroupID(T),this.updateFilterStatus(T),this.tool.rebuildComponent(T),this.copperTool.rebuildCoppers(),T.type==="FPC Stiffener"?A.publish("checkOpenStiffenerLayer",{notShowTip:!0}):T.type=="Partition"&&this.rebuildPartition(T),this.rebuildRegionSelector(T,e.regionRuleSelector),this.updateData(),this.data=void 0,T}rebuildRect(e,r,i,n,s,a,l,c,h,u,d,p){return Xt.rebuild(e,r,i,n,s,a,l,c,h,u,d,p)}getItem(){return Xt.getItem(this.gId)}remove(){let e=this.getItem();this.data=e.toJSON(),this.number=e.number,A.publish("hasModifyPcbItem",e);let r=e.getComponent(),i=r?JSON.stringify(r):"{}",n=r instanceof xn?JSON.stringify(r.copperResult):"[]";this.tool.setComponentData(i,n),this.tool.deleteComponent(e),this.copperTool.removeCoppers(),e.remove(),this.removeRegionSelector(),A.publish("delete",e),this.updateData()}modify(){let e=this.data,{globalIndex:r,type:i,layerId:n,start:s,width:a,height:l,net:c,locked:h,strokeWidth:u,rotation:d,silkColor:p,cornerRadius:m}=e,g=p?ee.of3(p):null,y=new S(s.x,s.y),b=this.getItem(),P=b.toJSON(),T=b.getComponent(),I=T?JSON.stringify(T):"{}",C=T instanceof xn?JSON.stringify(T.copperResult):"[]";b.removeFill(),b.type!=i&&(b.type=i),b.layerId!=n&&(b.layerId=n),b.width!=a&&(b.width=a),b.height!=l&&(b.height=l),b.rotation!=d&&(b.rotation=d),b.start.equals(y)||(b.start=y),b.net!=c&&(A.publish("hasModifyPcbItem",b),b.net=c),b.locked!=h&&(b.locked=h),b.strokeWidth!=u&&(b.strokeWidth=u),this.equals(g,b.silkColor)||(b.silkColor=g),b.cornerRadius!=m&&(b.cornerRadius=m),this.data=P,this.modifyGroupID(b),this.tool.modifyComponent(b),this.tool.setComponentData(I,C),this.modifyRegionSelector(b,e.regionRuleSelector),b.fill(),b.toggleCopperResult(!b.hiddenCopperResult),A.publish("hasModifyPcbItem",b),this.updateData()}compareDataChange(e){let r=Xt.getItem(this.gId);if(!r||this.action!=="modify")return!0;let i=this.data,n=r.toJSON(),s=["start","width","height","rotation","strokeWidth","cornerRadius","type"];if(a(n,s)!==a(i,s)&&(r.type=="Copper Region"||i.type=="Copper Region"))return e.push(new I3(r,"delete")),r.clearCopper(),!0;if(JSON.stringify(this.data)!==JSON.stringify(r))return!0;return!1;function a(l,c){let h=c.map(u=>l[u]);return JSON.stringify(h)}}comparePourChange(){let e=this.data,r=Xt.getItem(this.gId);return!r||this.action!=="modify"?{action:"fullUpdate",data:null}:e.type=="Copper Region"&&r.type!=="Copper Region"?{action:"fullUpdate",data:null}:e.type!=="Copper Region"&&r.type=="Copper Region"?{action:"fullUpdate",data:null}:r.model.component.name!==e.componentData.name?{action:"halfUpdate",data:{id:r.globalIndex,key:"name",value:r.model.component.name}}:r.net!==e.net?{action:"halfUpdate",data:{id:r.globalIndex,key:"net",value:r.net}}:r.layerId!==e.layerId?{action:"halfUpdate",data:{id:r.globalIndex,key:"layerId",value:r.layerId}}:{action:"notUpdate",data:null}}upload(e=!1){let r=R.getInstance().compiler,i=r.consistencyManager.getMaxTicket();this.isDelete(e)?(r.setTicket(++i),h3(this.gId,this.type)):(this.source==null&&this.updateData(),r.setTicket(++i),c3(this.gId,this.type,this.source)),this.source=null}updateData(){if(this.source==null){let e=Xt.getItem(this.gId);e!=null&&(this.source=Sr.getInstance().encodeProfile(e.model),this.type=e.type)}}};function aCe(o){let{globalIndex:t,layerId:e,key:r,showKey:i,value:n,showValue:s,fontFamily:a,fontSize:l,rotation:c,locked:h,position:u,origin:d,strokeWidth:p,reverse:m,reverseExpansion:g,mirror:y,silkColor:b,positionIsNull:P}=o,T=b?ee.of3(b):void 0,I=new S(u.x,u.y),C=ri.rebuild(t,e,r,i,n,s,a,l,c,h,I,d,p,m,g,y,P);return A.publish("hasModifyPcbItem",C),C.silkColor=T,C}var r4=class extends ro{constructor(t,e,r){super(),e=="add"?(this.groupId=t.getGroupID(),this.gId=t.globalIndex,this.action=e):(this.gId=t.globalIndex,this.data=t.toJSON(),r||(this.source=e=="delete"?Sr.getInstance().encode(t.key?"ATTR":"STRING",t.model):null),this.action=e,this.deleteGroupID(t))}rebuild(){let t=aCe(this.data);return this.addGroupID(t),this.updateFilterStatus(t),this.updateData(),this.data=void 0,t}getItem(){return ri.getItem(this.gId)}remove(){let t=ri.getItem(this.gId);this.data=t.toJSON(),A.publish("hasModifyPcbItem",t),t.remove(),A.publish("delete",t),this.updateData()}modify(){let{globalIndex:t,layerId:e,key:r,showKey:i,value:n,formulaName:s,showValue:a,fontFamily:l,fontSize:c,rotation:h,locked:u,position:d,origin:p,strokeWidth:m,reverse:g,reverseExpansion:y,mirror:b,silkColor:P,positionIsNull:T}=this.data,I=P?ee.of3(P):void 0,C=ri.getItem(this.gId),E=new S(d.x,d.y),O=C.toJSON();C.layerId!=e&&(C.layerId=e),C.key!=r&&(C.key=r),C.showKey!=i&&(C.showKey=i),C.value!=n&&(C.value=s||n),C.showValue!=a&&(C.showValue=a),C.fontFamily!=l&&(C.fontFamily=l),C.strokeWidth!=m&&(C.strokeWidth=m),C.fontSize!=c&&(C.fontSize=c),C.positionIsNull!=T&&(C.positionIsNull=T),C.rotation!=h&&(C.rotation=h),C.locked!=u&&(C.locked=u),C.position.equals(E)||(C.position=E),C.origin!=p&&(C.origin=p),C.mirror!=b&&(C.mirror=b),C.reverse!=g&&(C.reverse=g),C.reverseExpansion!=y&&(C.reverseExpansion=y),I||(C.silkColor=void 0),(I&&C.silkColor&&!C.silkColor.equals(I)||C.silkColor!=I)&&(C.silkColor=I),this.data=O,this.modifyGroupID(C),C.hasHelpLine&&C.updateHelpLine(),A.publish("hasModifyPcbItem",C),this.updateData()}uploadData(t=!1){let e=this.isDelete(t),r=R.getInstance().compiler;r.setTicket(),e?r.deleteString(this.gId):(this.updateData(),this.source&&("key"in this.source?r.uploadAttr(this.gId,this.source):r.uploadString(this.gId,this.source))),this.source=void 0}upload(t=!1){this.uploadData(t)}updateData(){if(this.source==null){let t=ri.getItem(this.gId);t!=null&&(this.source=Sr.getInstance().encode(t.key?"ATTR":"STRING",t.model))}}};var KY=null,sVe=new Array,i4=class extends ro{constructor(t,e){super(),this.gId=t.globalIndex,this.groupId=t.getGroupID(),this.number=e=="delete"?t.number:null,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?Sr.getInstance().encode("LINE",t.model):null,this.action=e,this.deleteGroupID(t),this.action==="delete"&&this.checkGroup(),A.publish("cheakTearDrop",new zf(e,t.toJSON(),t)),le.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",[{id:t.globalIndex,net:t.net,bbox:t.buildBBox()}])}checkGroup(){if(this.groupId!=null){let t=R.getInstance().tabId,e=Ht.getItem(this.groupId);if(e!=null){let r=e.name;sVe.push({attr:{id:this.groupId,pcbid:t},text:`${r} (${this.groupId})`}),KY!=null&&(clearTimeout(KY),KY=null),KY=setTimeout(()=>{sVe.length=0,KY=null},10)}}}rebuild(){var d;let{globalIndex:t,partition:e,layerId:r,start:i,end:n,width:s,locked:a,net:l}=this.data;if(!((d=Ze.getInstance().getLayer(r))!=null&&d.config))return null;let c=new S(i.x,i.y),h=new S(n.x,n.y),u=pr.rebuild(t,r,c,h,s,a,l);return u.partition=e,u.number=this.number,A.publish("hasModifyPcbItem",u),this.addGroupID(u),this.updateFilterStatus(u),this.updateData(),this.data=void 0,u}getItem(){return pr.getItem(this.gId)}remove(){let t=pr.getItem(this.gId);this.data=t.toJSON(),this.number=t.number,A.publish("hasModifyPcbItem",t),t.remove(),A.publish("delete",t),A.publish("cheakTearDrop",new zf("delete",this.data,t)),this.updateData()}modify(){let{globalIndex:t,layerId:e,start:r,end:i,width:n,locked:s,net:a}=this.data,l=new S(r.x,r.y),c=new S(i.x,i.y),h=pr.getItem(this.gId);if(!h)return;let u=h.toJSON();h.layerId!=e&&(h.layerId=e),h.start.equals(l)||(h.start=l),h.end.equals(c)||(h.end=c),h.width!=n&&(h.width=n),h.locked!=s&&(h.locked=s),h.net!=a&&(A.publish("hasModifyPcbItem",h),h.net=a),this.data=u,this.modifyGroupID(h),A.publish("hasModifyPcbItem",h),this.updateData()}upload(t=!1){let e=this.isDelete(t),r=R.getInstance().compiler;r.setTicket(),e?r.deleteLine(this.gId):(this.source==null&&this.updateData(),this.source!=null&&r.uploadLine(this.gId,this.source)),this.source=void 0}updateData(){if(this.source==null){let t=pr.getItem(this.gId);t!=null&&(this.source=Sr.getInstance().encode("LINE",t.model))}}};var n4=class extends ro{constructor(t,e){super(),this.gId=t.globalIndex,this.number=e=="delete"?t.number:null,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?Sr.getInstance().encode("VIA",t.model):null,t.getParent()&&(this.hasParent=!0,this.padNetSource=e=="delete"?Sr.getInstance().encode("PAD_NET",t.model):void 0),this.action=e,this.deleteGroupID(t),A.publish("cheakTearDrop",new zf(e,t.toJSON(),t)),le.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",[{id:t.globalIndex,net:t.net,bbox:t.buildBBox()}])}rebuild(){let{globalIndex:t,partition:e,type:r,name:i,startLayer:n,endLayer:s,net:a,radius:l,center:c,holeRadius:h,locked:u,expansion:d,topExpansion:p,bottomExpansion:m,unusedInnerLayers:g,isSuture:y}=this.data,b=new S(c.x,c.y),P=Wr.rebuild(t,r,i,n,s,a,l,b,h,u,d,p,m,g,y);return P.partition=e,P.number=this.number,this.data=void 0,A.publish("hasModifyPcbItem",P),this.addGroupID(P),this.updateFilterStatus(P),this.updateData(),this.data=void 0,P}getItem(){return Wr.getItem(this.gId)}remove(){this.updateData();let t=Wr.getItem(this.gId);t!=null&&(this.data=t.toJSON(),this.number=t.number,A.publish("hasModifyPcbItem",t),t.remove(),A.publish("delete",t))}modify(){let{type:t,name:e,startLayer:r,endLayer:i,net:n,radius:s,center:a,holeRadius:l,locked:c,expansion:h,topExpansion:u,bottomExpansion:d,unusedInnerLayers:p,isSuture:m}=this.data,g=new S(a.x,a.y),y=Wr.getItem(this.gId),b=y.toJSON();y.type!=t&&(y.type=t),y.name!=e&&(y.name=e),(y.startLayer!=r||y.endLayer!=i||y.radius!=s||y.holeRadius!=l)&&(y.viaBaseInfo=la.getViaBaseInfo(r,i,s,l)),y.net!=n&&(A.publish("hasModifyPcbItem",y),y.net=n),y.center.equals(g)||(y.center=g),y.locked!=c&&(y.locked=c),y.viaExpansion=qp.getViaExpansion(h,u,d),y.unusedInnerLayers.toString()!=p.toString()&&(y.unusedInnerLayers=p),this.data=b,this.modifyGroupID(y),A.publish("hasModifyPcbItem",y),this.updateData()}upload(t=!1){let e=this.isDelete(t),r=R.getInstance().compiler,i=r.consistencyManager.getMaxTicket();e?(this.padNetSource&&(r.setTicket(++i),r.deletePadNet(this.padNetSource.componentId,this.padNetSource.padNum,this.padNetSource.padId)),this.hasParent||(r.setTicket(++i),r.deleteVia(this.gId))):(this.source==null&&this.updateData(),this.padNetSource&&(r.setTicket(++i),r.uploadPadNet(this.padNetSource)),!this.hasParent&&this.source&&(r.setTicket(++i),r.uploadVia(this.gId,this.source))),this.padNetSource=void 0,this.source=void 0}updateData(){if(this.source==null){let t=Wr.getItem(this.gId);if(t!=null){let e=t.getParent();this.source=Sr.getInstance().encode("VIA",t.model),this.padNetSource=e&&Sr.getInstance().encode("PAD_NET",t.model)}}}};var qc=class extends Ls{constructor(t){super(),this.model=t}get name(){return this.model.name}set name(t){this.model.name=t}get locked(){return this.model.locked}get size(){return this.model.size}getIndex(){return this.model.getIndex()}addItem(t){this.model.addItem(t.model)}deleteItem(t){this.model.deleteItem(t.model)}getItems(){let t=new Array,e=new Jt;for(let r of this.model.getItems()){let i=e.getItemByType(r.globalIndex,r.modelType);i!=null&&t.push(i)}return t}setItems(t){this.model.setItems(t.map(e=>e.model))}dissolution(){this.model.dissolution()}rotateFor(t,e){let r=Ae.translate(-t.x,-t.y,0).rotateZ(e).translate1(t.x,t.y,0);this.transform(r)}visible(){}hidden(){}click(){}remove(){this.model.remove(),Ht.delete(this)}transform(t){for(let e of this.getItems())e.transform(t)}isSelect(t,e){return!0}buildBBox(){return this.model.getBBox()}hasItem(t){return this.model.hasItem(t)}};function vs(o){return ve(o*10,4)}var r8=class{static genUnitItem(t,e){e.unit=t.unit}static genForAllItem(t,e){e.isForAll=K8e(t.status)}static genSafeSpacingContentItem(t,e){e.safeSpacing=[];let r=t.toJSON();for(let[i,n]of r)e.safeSpacing.push({layerId:i,isOpen:zP(n.layerState),content:n.table.map(s=>s.map(vs)),columnNames:[]})}};var ZY=class{static genUnitItem(t,e){e.unit=t.unit}static genTrackContentItem(t,e){e.track={isOpen:zP(t.getLayerStatus()),content:[]};let r=t.toJSON();for(let[i,n]of r)e.track.content.push({layerId:i,stroMin:vs(n.minValue),stroDef:vs(n.defaultValue),stroMax:vs(n.maxValue)})}};var o4=class{static genUnitItem(t,e){e.unit=t.unit}static genStroWidthContentItem(t,e){e.stroWidth={isOpen:!1,content:[]};let i=t.toJSON().strokeWidthTables;e.stroWidth.isOpen=zP(i.status);for(let[n,s]of i.tables)e.stroWidth.content.push({layerId:n,stroMin:vs(s.minValue),stroMax:vs(s.maxValue),stroDef:vs(s.defaultValue)})}static genSpacingContentItem(t,e){e.spacing={isOpen:!1,content:[]};let i=t.toJSON().diffPairSpacingTables;e.spacing.isOpen=zP(i.status);for(let[n,s]of i.tables)e.spacing.content.push({layerId:n,spacMin:vs(s.minValue),spacDef:vs(s.defaultValue)})}static genDifferPairLenTolerMaxItem(t,e){e.differPairLenTolerMax=vs(t.differentialPairLenTolerMax)}};var JY=class{static genUnitItem(t,e){e.unit=t.unit}static genMulPadContentItem(t,e){e.mulPad={isOpen:!1,content:[]};let r=t.toJSON();e.mulPad.isOpen=zP(r.status);for(let[i,n]of r.tables)e.mulPad.content.push({layerId:i,connType:aM(n.connectMode),spoSpac:vs(n.lineClearance),spoWidth:vs(n.lineWidth),spoAng:ve(n.lineAngle/Math.PI*180,4)})}};var s4=class{static genUnitItem(t,e){e.unit=t.unit}static genSglPadContentItem(t,e){e.sglPad={isOpen:!1,content:[]};let i=t.toJSON().singleLayerPadModel;e.sglPad.isOpen=zP(i.status);for(let[n,s]of i.tables)e.sglPad.content.push({layerId:n,connType:aM(s.connectMode),spoSpac:vs(s.lineClearance),spoWidth:vs(s.lineWidth),spoAng:ve(s.lineAngle/Math.PI*180,4)})}static genMulPadContentItem(t,e){e.mulPad={isOpen:!1,content:[]};let i=t.toJSON().multiLayerPadModel;e.mulPad.isOpen=zP(i.status);for(let[n,s]of i.tables)e.mulPad.content.push({layerId:n,connType:aM(s.connectMode),spoSpac:vs(s.lineClearance),spoWidth:vs(s.lineWidth),spoAng:ve(s.lineAngle/Math.PI*180,4)})}static genTrackContentItem(t,e){e.track={isOpen:!1,content:[]};let i=t.toJSON().trackConnectModel;e.track.isOpen=zP(i.status);for(let[n,s]of i.tables)e.track.content.push({layerId:n,connType:q8e(s)})}};var a4=class{static genUnitItem(t,e){e.unit=t.unit}static genDeviceClearanceItem(t,e){e.deviceClearance=vs(t.deviceClearance)}static genThru2SmdClearanceItem(t,e){e.thru2SmdClearance=vs(t.thru2SmdClearance)}static genHoleClearanceItem(t,e){e.holeClearance=vs(t.holeClearance)}};var i8=class{static genUnitItem(t,e){e.unit=t.unit}static genNetLenMinItem(t,e){e.netLenMin=vs(t.netLengthMin)}static genNetLenMaxItem(t,e){e.netLenMax=vs(t.netLengthMax)}};var Gre=class{static genBlindItem(t,e){e.blinds={content:[]};let r=t.getAllVias();for(let i of r)e.blinds.content.push({name:i.name,staLayerId:i.startLayer,endLayerId:i.endLayer,viaSizeRule:i.viaSizeRule})}};var C3=class{static genUnitItem(t,e){e.unit=t.unit}static genMinRadiusItem(t,e){e.minRadius=vs(t.minRadius)}static genDefRadiusItem(t,e){e.defRadius=vs(t.defalutRadius)}static genMaxRadiusItem(t,e){e.maxRadius=vs(t.maxRadius)}static genMinInnerItem(t,e){e.minInner=vs(t.minInner)}static genDefInnerItem(t,e){e.defInner=vs(t.defalutInner)}static genMaxInnerItem(t,e){e.maxInner=vs(t.maxInner)}};var S3=class{static genUnitItem(t,e){e.unit=t.unit}static genPadTopExpanItem(t,e){e.padTopExpan=vs(t.padTopExpansion)}static genPadBotExpanItem(t,e){e.padBotExpan=vs(t.padBottomExpansion)}static genViaTopExpanItem(t,e){e.viaTopExpan=vs(t.viaTopExpansion)}static genViaBotExpanItem(t,e){e.viaBotExpan=vs(t.viaBottomExpansion)}static genTestPointTopExpanItem(t,e){e.testPointTopExpan=vs(t.testPointTopExpansion)}static genTestPointBotExpanItem(t,e){e.testPointBotExpan=vs(t.testPointBottomExpansion)}};var Yx=class{static genUnitItem(t,e){e.unit=t.unit}static genPadTopExpanItem(t,e){e.padTopExpan=vs(t.padTopExpansion)}static genPadBotExpanItem(t,e){e.padBotExpan=vs(t.padBottomExpansion)}static genTestPointTopExpanItem(t,e){e.testPointTopExpan=vs(t.testPointTopExpansion)}static genTestPointBotExpanItem(t,e){e.testPointBotExpan=vs(t.testPointBottomExpansion)}};var QY=class{static genUnitItem(t,e){e.unit=t.unit}static genNetLenTolerance(t,e){e.netLengthTolerance=vs(t.netLengthTolerance)}};var n8=class{static genUnitItem(t,e){e.unit=t.unit}static genCreepageClearanceItem(t,e){e.creepageDistance=vs(t.creepageDistance)}static genIgnoreLayer(t,e){e.ignoreLayer=t.ignoreLayer}};var o8=class extends In{getData(t,e){switch(t){case"ruleType":return Nf(Cre(e));case"ruleName":return e.name;case"ruleState":let r=e.isDefault?1:0;return P8e(r);case"ruleContext":return this.getContext(e)}}getContext(t){let e={};if(t instanceof aI)return r8.genUnitItem(t,e),r8.genForAllItem(t,e),r8.genSafeSpacingContentItem(t,e),e;if(t instanceof cI)return n8.genUnitItem(t,e),n8.genCreepageClearanceItem(t,e),n8.genIgnoreLayer(t,e),e;if(t instanceof p2)return a4.genUnitItem(t,e),a4.genDeviceClearanceItem(t,e),a4.genThru2SmdClearanceItem(t,e),a4.genHoleClearanceItem(t,e),e;if(t instanceof Xv)return ZY.genUnitItem(t,e),ZY.genTrackContentItem(t,e),e;if(t instanceof Vv)return i8.genUnitItem(t,e),i8.genNetLenMinItem(t,e),i8.genNetLenMaxItem(t,e),e;if(t instanceof Gv)return QY.genUnitItem(t,e),QY.genNetLenTolerance(t,e),e;if(t instanceof d2)return o4.genUnitItem(t,e),o4.genStroWidthContentItem(t,e),o4.genSpacingContentItem(t,e),o4.genDifferPairLenTolerMaxItem(t,e),e;if(t instanceof kv)return Gre.genBlindItem(t,e),e;if(t instanceof Yv)return C3.genUnitItem(t,e),C3.genMinRadiusItem(t,e),C3.genDefRadiusItem(t,e),C3.genMaxRadiusItem(t,e),C3.genMinInnerItem(t,e),C3.genDefInnerItem(t,e),C3.genMaxInnerItem(t,e),e;if(t instanceof Fv)return JY.genUnitItem(t,e),JY.genMulPadContentItem(t,e),e;if(t instanceof Bv)return s4.genUnitItem(t,e),s4.genSglPadContentItem(t,e),s4.genMulPadContentItem(t,e),s4.genTrackContentItem(t,e),e;if(t instanceof jv)return S3.genUnitItem(t,e),S3.genPadTopExpanItem(t,e),S3.genPadBotExpanItem(t,e),S3.genViaTopExpanItem(t,e),S3.genViaBotExpanItem(t,e),S3.genTestPointTopExpanItem(t,e),S3.genTestPointBotExpanItem(t,e),e;if(t instanceof zv)return Yx.genUnitItem(t,e),Yx.genPadTopExpanItem(t,e),Yx.genPadBotExpanItem(t,e),Yx.genTestPointTopExpanItem(t,e),Yx.genTestPointBotExpanItem(t,e),e;if(t instanceof qv){let r=t.config;return{routingCorner:I8e(r.routingCorner),isKeep:this.autoBool(r.isKeep),viaQuantity:S8e(r.viaQuatity),routingEffectPriority:O8e(r.routingEffectPriority),layers:r.layers,ignoreNets:r.ignoreNets}}return null}getNumber(t){return ve(t*10,4)}autoBool(t){return t?1:0}};var s8=class extends In{getData(t,e){switch(t){case"shapeID":return e.globalIndex;case"groupId":return e.combinationID;case"channelId":return e.channelID}}};var a8=class extends In{getData(t){switch(t){case"name":return re.getInstance().getRuleTemplateName()}}};var jx=class extends S0{getData(t,e){let r=e.component;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Ia(e);case"layerId":return e.layerId;case"material":return r.material==="Tape"?AIe(r.fpcModel):AIe(r.material);case"thickness":return r.thickness;case"path":return this.getShapeInfo(e);case"locked":return e.locked;case"zIndex":return e.zIndex}}};var Xx=class extends In{getData(t,e){if(!Array.isArray(e)){let s=[],a=e.getParent();if(!a)return[];a.iteratorCopper(l=>{let c=qo.getInstance().getItem(l);s.push(c)}),e=s}if(e.length==0)return[];let r=["strokeWidth","fill","path","id"],i=[],n=new lCe;for(let s of e){let a={};for(let l of r)a[l]=n.getData(l,s);i.push(a)}return i}},lCe=class extends In{getData(t,e){switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"id":return this.id;case"strokeWidth":return e.style=="90grid"||e.style=="45grid"?e.gridLineWidth:0;case"fill":return!(e.style=="90grid"||e.style=="45grid");case"path":return e.copperPath}}};var qx=class extends S0{getData(t,e){switch(this.id=e.globalIndex,t){case"index":return this.id;case"name":if(e.component instanceof ac)return e.component.name;break;case"fileUuid":if(e.component instanceof ac)return e.component.fileUuid;break;case"path":return this.getShapeInfo(e)}}};var J9t=function(o,t){return t.bbox().area()-o.bbox().area()},$c=class{constructor(t,e,r,i,n){this.rtree=new ji(20);this.cache=new Array(30);this.notConnected=new Array;this.notConnectedArcs=new Set;this.bbox=t,this.autoConnectDistance=Ki.positive(e),this.cutWidth=Ki.positive(r),this.logger=i;for(let s of n)this.rtree.add(s)}addLine(t,e){let r=null,i=null;e?(r=t.start(),i=t.end()):(r=t.end(),i=t.start());let n=new ht(r.x,r.x,r.y,r.y),s=this.rtree.search(n.extendOfSize(this.autoConnectDistance)),a=Number.MAX_VALUE,l=null;for(let c of s)if(c!=t){if(c.start().equals1(i)||c.end().equals1(i))continue;let h=c.start().distance2(r),u=c.end().distance2(r);h<a&&(a=h,l=c.start()),u<a&&(a=u,l=c.end())}return l}getDeltaLines(){let t=this.connect0().set.iterator(),e=new Array;for(;t.hasNext();){let r=t.next();e.push(r)}return e}connect0(){this.notConnected.length=0,this.notConnectedArcs.clear();let t=new Array,e=this.notConnected,r=this.notConnectedArcs,i=new Ta;for(let n of this.rtree.items()){if(t.push(n),n instanceof q&&n.isCircle())continue;let s=0,a=0,l=this.rtree.search(n.bbox().extendOfSize(this.cutWidth));for(let c of l)if(n!=c&&((n.start().equals(c.start())||n.start().equals(c.end()))&&s++,(n.end().equals(c.start())||n.end().equals(c.end()))&&a++,(n instanceof M&&c instanceof M&&n.equals2(c)||n instanceof q&&c instanceof q&&n.equals1(c))&&(s--,a--)),s>0&&a>0)break;if(s==0){let c=this.addLine(n,!0);if(c!=null){let h=new M(n.start(),c);h.length()<=this.autoConnectDistance&&(i.contains(h)||(t.push(h),i.add(h)),s++)}}if(a==0){let c=this.addLine(n,!1);if(c!=null){let h=new M(n.end(),c);h.length()<=this.autoConnectDistance&&(i.contains(h)||(t.push(h),i.add(h)),a++)}}(s==0||a==0)&&(e.push(n),n instanceof q&&r.add(n))}for(let n of e)for(let s of this.rtree.search(n.bbox().extendOfSize(this.autoConnectDistance)))if(n!=s){let a=new er(n,s),l=a.getDistance();if(this.cutWidth/10<l&&l<=this.autoConnectDistance){let c=a.getLine();n instanceof q&&(n.start().equals1(c.start())||n.start().equals1(c.end())||n.end().equals1(c.start())||n.end().equals1(c.end()))&&r.delete(n),s instanceof q&&(s.start().equals1(c.start())||s.start().equals1(c.end())||s.end().equals1(c.start())||s.end().equals1(c.end()))&&r.delete(s),i.contains(c)||(t.push(c),i.add(c))}}for(let n of r)n.end().distance1(n.start())<=this.autoConnectDistance&&t.push(new M(n.start(),n.end()));return{pts:t,set:i}}connect(){return this.connect0().pts}bboxOutline(){let t=this.bbox.extendOfSize(this.bbox.width());return new Zo([ge.build5([t.minX,t.minY,t.minX,t.maxY,t.maxX,t.maxY,t.maxX,t.minY]).asClose()])}detectBase(t,e,r){if(this.rtree.size()==0)return this.bboxOutline();let i=this.connect(),n=this.bbox.extendOfSize(Math.max(this.bbox.width(),this.bbox.height())),s=[Cl.DIFF,ge.build5([n.minX,n.minY,n.minX,n.maxY,n.maxX,n.maxY,n.maxX,n.minY,n.minX,n.minY])];for(let l of i){let c=Zo.buildByStroke(l,this.cutWidth,wr.ROUND,1,e);c&&s.push(c)}if(r!=null){for(let l of this.notConnected){let c=r.get(l);if(c!=null){let h=Zo.buildByStroke(l,c,wr.ROUND,1,e);h&&s.push(h)}}for(let l of this.notConnectedArcs){let c=r.get(l);if(c!=null){let h=Zo.buildByStroke(l,c,wr.ROUND,1,e);h&&s.push(h)}}}let a=hP(s,e);if(a.items.length<2)return this.bboxOutline();{let l=a.items.slice();return Er(l,J9t,0,l.length),t(new Fo(l))}}detect(t){let e=this.detectBase(r=>{let i=new Array,n=r.items;for(let s=1;s<n.length;s++)xe.addAll(i,n[s].items);return new Bt(i)},t);return e instanceof Bt?e:e.toPolylineGroup()}detect1(){return this.detectBase(t=>t.items[0]).toPolylineGroup()}detect2(t){let e=this.detectBase(r=>new Fo(r.items.slice(1)),t);return e instanceof Fo?e:new Fo([e])}detect3(t,e){let r=this.detectBase(i=>new Fo(i.items.slice(1)),e,t);return r instanceof Fo?r:new Fo([r])}};var si=class o{constructor(){this.items=Array();this.outlines=Array();this.slots=Array();this.originOutline=Array();this.holes=Array();this.positionHoles=new Array;this.stampGroups=new Array;this.marks=Array();this.vCutShapes=Array();this.closures=Array();this.borderClosures=[Array(),Array()];this.borderClosures_outerMost=Array();this.id=0;this.useSetJsonFirst=!1;let t=new dt,e=a=>t.conversion("mm","mil",a)/10,r=e(2),i=e(1),n=e(.5),s=e(6);this._param={success:!1,on:!1,row:1,column:1,rowSpacing:0,columnSpacing:0,onlyOutline:!0,minSpacing:e(1.6),resetCanvasOrigin:!1,description:"",minStampHoleDiameter:e(.1),minStampHoleSpacing:e(.1),stampHoleDiameter:e(.55),stampHoleSpacing:e(.85),stampHolePerGroup:8,stampRow:!1,stampColumn:!1,stampPerColumn:1,stampPerRow:1,borderHeight:s,borderAtTopBottom:!0,borderAtLeftRight:!1,createPositionHole:!0,createMark:!0,positionHoleDiameter:r,markDiameter:i,markExpansion:n,defaultBorderHeight:s,defaultMarkExpansion:n,defaultMarkDiameter:i,defaultPositionHoleDiameter:r,minBorderHeight:e(3),minMarkDiameter:e(.1),minMarkExpansion:e(.5),minPositionHoleDiameter:e(.2),borderRadius:e(1),useCustomSize:null,customWidth:e(100),customHeight:e(100),outputUnit:"mm",flipOrigin:!1,flipX:!1,flipY:!1}}static getInstance(){return o.model==null&&(o.model=new o),o.model}getDefaultPanelize(){return this._param}setDefaultPanelize(t){Object.entries(t).forEach(e=>{let r=e[0],i=e[1];i!=null&&typeof i==typeof this._param[r]&&(this._param[r]=i)})}getProfileGroup(t){let e=new Array;for(let r of this.items)if(r.layerId==t){if(r instanceof Li)continue;if(r instanceof hs)e.push({primitives:[r.primitive],strokeWidth:r.width});else if(r instanceof Va)e.push({primitives:[r.primitive],strokeWidth:r.width});else if(r instanceof yo)e.push({primitives:[r.primitive],strokeWidth:r.strokeWidth});else if(r instanceof et)continue}for(let r of this.outlines)r.layerId==t&&(r instanceof hs?e.push({primitives:[r.primitive],strokeWidth:r.width}):r instanceof Va?e.push({primitives:[r.primitive],strokeWidth:r.width}):r instanceof yo&&e.push({primitives:[r.primitive],strokeWidth:r.strokeWidth}));return e}getPadGroup(t){let e=new Array;for(let r of this.items)if(r instanceof et){let i=r.getMathGraphics(t);i!=null&&e.push(i)}return e}getText(t){let e=new Array;for(let r of this.items)r.layerId==t&&r instanceof Li&&e.push(r);return e}get bbox(){if(!this.outerBBox)return;let t=new _e;return t.ext1(this.outerBBox),this.items.forEach(e=>{t.ext1(e.buildBBox())}),t.build1()}getClosures(){let t=this._param,e=new Array;if(t.borderAtTopBottom&&t.borderAtLeftRight){let i=Array.from(this.borderClosures[0]),n=Array.from(this.borderClosures[1]);e.push([this.convert2Polyline(this.borderClosures_outerMost),this.convert2Polyline([].concat(i,n),!0)])}else e.push([this.convert2Polyline(this.borderClosures[0])],[this.convert2Polyline(this.borderClosures[1])]);return e.push(...this.closures.map(i=>[this.convert2Polyline(i)])),e.map(i=>i.filter(n=>n!=null))}convert2Polyline(t,e=!1){if(!t||!t.length)return null;let r=new _e;t.forEach(a=>r.ext1(a.bbox()));let i=r.build1().area(),s=new $c(this.outerBBox,2,.2,new Di(4),t).detect();if(s){let a=s.bbox().area();if(ne.lesseq(a,i)){let l=s.items[0];return e?l.reverse():l}}return null}remove(){this.offset=null,this.singleBBox=null,this.outerBBox=null,this.items.length=0,this.holes.length=0,this.positionHoles.length=0,this.stampGroups.length=0,this.originOutline.length=0,this.marks.length=0,this.outlines.length=0,this.slots.length=0,this.closures.length=0,this.vCutShapes.length=0,this.borderClosures[0].length=0,this.borderClosures[1].length=0,this.borderClosures_outerMost.length=0}get outputUnit(){return this._param.outputUnit}gId(){return"Panelize"+this.id++}addLine(t,e,r=11,i=!1){if(t.equals1(e))return;let n=new wc(this.gId(),t,e,{layerId:r,strokeWidth:1,locked:!1});return this.items.push(n),i&&this.vCutShapes.push(n),n}addVCutIndicator(t,e){let r=t.add1(e?22:0,e?0:-22);this.addText("V-CUT",4.5,r,2,e?0:-Math.PI/2),this.addArrow(t,e)}addHalfArrow(t,e){let r=this.singleBBox.height()*.6,i=r/9,n=t.add1(0,-i+r/2),s=n.add1(0,-r),a=n.add1(-i,-i);[s,a].forEach(l=>{let c=this.addLine(n,l,13,!1);e&&c.transform(Ae.rotateZForPoint(t,Math.PI))})}addArrow(t,e){let r=t.add1(e?2:0,e?0:-2),i=r.add1(e?18:0,e?0:-18),n=r.add1(2,e?2:-2),s=r.add1(e?2:-2,-2);[i,n,s].forEach(a=>this.addLine(r,a,13,!0))}addVCutLine(t,e,r){this.addLine(t,e,void 0,!0)}addMark(t,e,r){[1,2].forEach(i=>{let n=Lo.getStyle("ELLIPSE",e,e,0,null),s=i==1,a=new nS(this.gId(),i,1,"",t,0,!1,"",1,0,r,r,[],!0,s?n:null,s?null:n,null,null);this.items.push(a),this.marks.push(a)})}addText(t,e,r,i,n=0){let{width:a,height:l,path:c}=fd(t,e,.6),h=new Ku(this.gId(),13,0,"",!1,t,!0,"default",e,n,r,i,.6,!1,0,!1,!1,c,a,l,!1);this.items.push(h),this.vCutShapes.push(h)}addPositionHole(t,e){let r=this.addHole(t,e);this.positionHoles.push(r)}addHole(t,e){let r=new Ip(this.gId(),"Slot Region",12,t,e/2,1,!1,null,null,null);return this.items.push(r),this.holes.push(r),r}addStampHole(t,e){return this.addHole(t,e)}addStampHoleGroup(t,e){let r=t.map(i=>this.addStampHole(i,e));this.stampGroups.push(r)}addArc(t,e,r,i,n=ae.CCW,s=11){let a=new zc(this.gId(),t,e,r,i,n,{layerId:s,strokeWidth:1,locked:!1});this.items.push(a)}copyOutline(t,e,r,i){let n=new Array,s=new Array;if(t instanceof Za?t.getAllLinesInOrder().forEach(a=>n.push(a)):t instanceof yo?s.push(t):t instanceof ss&&t.childrens.forEach(l=>{l.forEach(c=>n.push(c))}),r&&this.originOutline.push([].concat(n,s)),i){let a;for(let l of n)if(l instanceof M||l instanceof hs){let c=l instanceof M?l.start():l.start,h=l instanceof M?l.end():l.end;a=new wc(this.gId(),c,h,{layerId:t.layerId,strokeWidth:t.strokeWidth,locked:!1}),a.transform(e),this.outlines.push(a)}else if(l instanceof q||l instanceof Va){let c=l instanceof q?zt.toRadians(l.startAngle):l.startAngle,h=l instanceof q?zt.toRadians(l.endAngle()):l.endAngle,u=l instanceof q?l.sweep():l.sweep,d=new zc(this.gId(),l.center,l.rx,c,h,u,{layerId:t.layerId,strokeWidth:t.strokeWidth,locked:!1});d.transform(e),this.outlines.push(d)}for(let l of s){let c=new Ip(this.gId(),"Line",l.layerId,l.center,l.radius,l.strokeWidth,!1,null,null,null);c.transform(e),this.outlines.push(c)}}}copySlot(t,e,r,i){if(i){let n;if(t instanceof ss){let s=t.childrens.map(a=>a.map(l=>l instanceof Va?new zc(this.gId(),l.center,l.rx,l.startAngle,l.endAngle,l.sweep,{layerId:t.layerId,strokeWidth:t.strokeWidth,locked:!1}):new wc(this.gId(),l.start,l.end,{layerId:t.layerId,strokeWidth:t.strokeWidth,locked:!1})));n=new Ep(this.gId(),"Slot Region",t.layerId,s,t.strokeWidth,null,!1,null,null),n.transform(e),this.slots.push(n)}else if(t instanceof Za)n=new Sp(this.gId(),"Slot Region",t.layerId,t.start,t.width,t.height,t.rotation,t.radius,null,t.strokeWidth,!1,null,null),n.transform(e),this.slots.push(n);else if(t instanceof yo){let s=new Ip(this.gId(),"Slot Region",t.layerId,t.center,t.radius,t.strokeWidth,!1,null,null,null);s.transform(e),this.slots.push(s)}}}};function PI(o){return Ji.getInstance().getItem(o.footprintUUID).isSMT}function $d(o,t,e=!1){let r=Tu.getInstance().getItem(t.deviceUUID),i=Ji.getInstance().getItem(t.footprintUUID);if(o.key=="3D Model"||o.key=="3D Model Transform")return!1;let n,s,a;if(e)n=o.layerId,s=o.position.sub(i.origin),a=o.rotation;else{n=t.layerId==2?sg(o.layerId):o.layerId;let l=t.layerId==2?(Math.PI-t.rotation)%Wd:t.rotation;a=o.rotation-l,t.layerId==2?(t.flipShape(o),s=XO(t.position,l,o.position),t.flipShape(o)):s=XO(t.position,l,o.position)}return!!(r==null||o.key=="Device"||o.key=="Designator"||o.key=="Footprint"&&t.footprintUUID!=r.footprintUUID||r!=null&&(!r.checkKeyValue(o.key,o.value,t.footprintUUID)||r.needSave(o,s,a,n,i.uuid)))}var uA=class extends In{getData(t,e){if(Array.isArray(e)||(e=Array.from(Xo.getInstance().layerMapSet[e.layerId])),e.length==0)return[];let r=["partitionId","groupId","netName","layerId","width","fillStyle","path","locked","zIndex","isBridgingCopper","networkList","refs","specialColor","id"],i=[],n=new p3;for(let s of e){let a={};for(let l of r)a[l]=n.getData(l,s);i.push(a)}return i}};var $x=class{constructor(t,e,r){this.canvas=new FB;this.layer=new VB;this.layerPhys=new jB;this.activeLayer=new GB;this.ruleTemplateName=new a8;this.rule=new o8;this.ruleSelect=new YB;this.padsPairGroup=new $B;this.padsPairGroupDetail=new KB;this.net=new UB;this.primitive=new HB;this.group=new WB;this.via=new d3;this.pad=new mx;this.line=new vx;this.arc=new xx;this.poly=new Rx;this.fill=new p3;this.fpcFill=new jx;this.region=new Dx;this.partition=new qx;this.pour=new zB;this.copper=new Xx;this.image=new wx;this.obj=new Vx;this.tear=new Lx;this.font=new sA;this.str=new f3;this.attr=new YP;this.inner=new uA;this.dimension=new Mx;this.dimensionAttr=new Nx;this.component=new m3;this.padNet=new g3;this.shell=new kx;this.shellEntity=new Gx;this.crease=new Bx;this.boss=new Fx;this.panelize=new XB;this.reuseBlock=new s8;this.source=!1;this.version=t,this.doctype=e,this.compiler=r,this.format=new Ib().getConfig(t),this.compiler==null&&(this.encoder=new ZJ(R.getInstance().id))}get ignorePartitionId(){return this.doctype!=3}saveCommonData(){this.feed("CANVAS"),Ze.getInstance().getAllItem().forEach(D=>{this.feed("LAYER",D)}),Ze.getInstance().getLayerPhys().forEach(D=>{this.feed("LAYER_PHYS",D)}),this.feed("ACTIVE_LAYER");let r=re.getInstance(),i=r.getAllSafeSpacing(),n=r.getAllOtherSpacing(),s=r.getAllTrackPhysics(),a=r.getAllCreepageSpacing(),l=r.getAllNetLengthPhysics(),c=r.getAllNetLengthTolerancePhysics(),h=r.getAllDifferentialPhysics(),u=r.getAllBlindPhysics(),d=r.getAllRadiusPhysics(),p=r.getAllInnerPlane(),m=r.getAllCopperPlane(),g=r.getAllPasteExpansion(),y=r.getAllSolderExpansion(),b=r.getAllAutoRouterRules(),P=r.getAllNetClass(),T=r.getAllNets(),I=r.getAllNetDifferentials(),C=r.getAllEqualLengthGroups(),E=r.getAllPadsPairGroups(),O=r.getAllRegions();T.forEach(D=>{this.feed("NET",D)}),this.feed("RULE_TEMPLATE"),i.forEach(D=>{this.feed("RULE",D)}),n.forEach(D=>{this.feed("RULE",D)}),a.forEach(D=>{this.feed("RULE",D)}),s.forEach(D=>{this.feed("RULE",D)}),l.forEach(D=>{this.feed("RULE",D)}),c.forEach(D=>{this.feed("RULE",D)}),h.forEach(D=>{this.feed("RULE",D)}),u.forEach(D=>{this.feed("RULE",D)}),d.forEach(D=>{this.feed("RULE",D)}),p.forEach(D=>{this.feed("RULE",D)}),m.forEach(D=>{this.feed("RULE",D)}),g.forEach(D=>{this.feed("RULE",D)}),y.forEach(D=>{this.feed("RULE",D)}),b.forEach(D=>{this.feed("RULE",D)}),E.forEach(D=>{this.feed("EQLEN_GRP",D)});let _=[];E.forEach(D=>{D.details.forEach(w=>{_.push(w)})}),_.forEach(D=>{this.feed("EQLEN",D)}),P.forEach(D=>{this.feed("RULE_SELECTOR",D)}),T.forEach(D=>{this.feed("RULE_SELECTOR",D)}),I.forEach(D=>{this.feed("RULE_SELECTOR",D)}),C.forEach(D=>{this.feed("RULE_SELECTOR",D)}),r.betweenNetRule.rule.forEach(D=>{this.feed("RULE_SELECTOR",D)}),O.forEach(D=>{this.feed("RULE_SELECTOR",D)}),this.getPrimitives().forEach(D=>{this.feed("PRIMITIVE",D)}),this.feed("SILK_OPTS",Ze.getInstance().getLayer(3)),this.feed("SILK_OPTS",Ze.getInstance().getLayer(4))}getFile(){return this.encoder.getDataStr()}getItems(t){return this.feedItems(t),this.getFile()}feed(t,e){let r=this.getItemFormat(t),i=this.getEncode(t),n={};for(let s of r)this.ignorePartitionId&&s=="partitionId"||(n[s]=this.getData(s,i,e));return this.upload2Compiler(t,n,e),this.uploadSource(t,n,e),n}feedFromGerber(t,e){let r=this.getItemFormat(t),i=this.getEncode(t),n={};for(let s of r)this.ignorePartitionId&&s=="partitionId"||(n[s]=this.getData(s,i,e));this.uploadSource(t,n,e)}feedItem(t){let e=this.getFileType(t);this.feed(e,t)}feedCopper(t){let e=new Map,r,i=[];for(let n of t)r=n.getParent().globalIndex,i=e.get(r),i||(i=[],e.set(r,i)),i.push(n);e.forEach((n,s)=>{this.feed("POURED",n)})}feedInner(t){let e=new Map,r,i=[];for(let n of t)r=n.layerId,i=e.get(r),i||(i=[],e.set(r,i)),i.push(n);e.forEach((n,s)=>{this.feed("INNER",n)})}feedComponent(t){this.feed("COMPONENT",t);let e=t.attributes,r=!0;for(let s of e)s.key=="Device"&&(r=!1),$d(s,t)&&this.feed("ATTR",s);if(r)throw new Error("The device is missing device attributes, saving will lead to data loss, please contact the official customer service in time!");t.getPads().forEach(s=>{this.feed("PAD_NET",s)}),t.getItems().filter(s=>s instanceof Ct).forEach(s=>{this.feed("PAD_NET",s)})}feed4Type(t){switch(t){case"CANVAS":return this.feed(t);case"ACTIVE_LAYER":return this.feed(t);default:break}}feedItems(t){t.forEach(e=>{if(e.getParent()==null){let r=this.getFileType(e);this.feed(r,e)}})}feedPanelize(){let t=si.getInstance(),e=JSON.parse(JSON.stringify(t.getDefaultPanelize()));this.feed("PANELIZE",e)}getFileType(t){if(t instanceof zr)return"LINE";if(t instanceof et)return"PAD";if(t instanceof Ct)return"VIA";if(t instanceof Ii)return"ARC";if(t instanceof or)switch(t.type){case"Line":case"Board Outline":return"POLY";case"Fill Region":case"Slot Region":return"FILL";case"TearDrop":return"TEARDROP";case"FPC Stiffener":return"FPC_FILL";case"Prohibited Region":case"Constraint Region":return"REGION";case"Partition":return"PARTITION";case"Copper Region":return"POUR";case"3D Shell - Outline":return"SHELL";case"3D Shell - Screw Pillar":return"BOSS";case"3D Shell - Side Datum Line":return"CREASE";case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":return"SHELL_ENTITY"}else{if(t instanceof Li)return t.key!=""?"ATTR":"STRING";if(t instanceof Ap)return"DIMENSION";if(t instanceof Am)return"DIMENSION";if(t instanceof _m)return"DIMENSION";if(t instanceof Bi)return"COMPONENT";if(t instanceof Dl)return"IMAGE";if(t instanceof Ff)return"OBJ";if(t instanceof lS)return"GROUP";if(t instanceof yn)return"FILL";if(t instanceof hn)return"POURED";throw new Error("not support this shape:"+t)}}getItemFormat(t){return this.format[t]}getEncode(t){switch(t){case"CANVAS":return this.canvas;case"LAYER":return this.layer;case"LAYER_PHYS":return this.layerPhys;case"ACTIVE_LAYER":return this.activeLayer;case"NET":return this.net;case"PRIMITIVE":return this.primitive;case"GROUP":return this.group;case"VIA":return this.via;case"PAD":return this.pad;case"LINE":return this.line;case"ARC":return this.arc;case"POLY":return this.poly;case"FILL":return this.fill;case"FPC_FILL":return this.fpcFill;case"REGION":return this.region;case"PARTITION":return this.partition;case"POUR":return this.pour;case"POURED":return this.copper;case"IMAGE":return this.image;case"OBJ":return this.obj;case"TEARDROP":return this.tear;case"FONT":return this.font;case"STRING":return this.str;case"ATTR":return this.attr;case"DIMENSION":return this.dimension;case"COMPONENT":return this.component;case"PAD_NET":return this.padNet;case"RULE_TEMPLATE":return this.ruleTemplateName;case"RULE":return this.rule;case"RULE_SELECTOR":return this.ruleSelect;case"EQLEN_GRP":return this.padsPairGroup;case"EQLEN":return this.padsPairGroupDetail;case"SHELL_ENTITY":return this.shellEntity;case"SHELL":return this.shell;case"CREASE":return this.crease;case"BOSS":return this.boss;case"PANELIZE":return this.panelize}}getData(t,e,r){return e.getData(t,r)}getPrimitives(){return["ALL","COMPONENT","PROPERTY","COMPONENTSILK","TRACK","VIA","TESTPOINT","PAD","PADSPAIR","NETWORK","SUTUREHOLE","TEARDROP","RATLINE","GROUP","TEXT","IMAGE","PICTURE","DIMENSION","BOARDOUTLINE","SLOTREGION","FILLREGIEN","COPPEROUTLINE","COPPERFILLED","PROHIBITEDREGION","CONSTRAINT","PARTITION","LINE","LOCKED","UNLOCKED","SHELL","BOSS","CREASE","TOPSHELLCUT","SIDESHELLCUT","TOPBOTTOMENTITY","SIDEENTITY","FPC_STIFFENER"]}uploadSource(t,e,r){var i;if(this.encoder!=null)switch(t){case"CANVAS":return this.encoder.uploadCanvas(e);case"LAYER":return this.encoder.uploadLayer(r.layerId,e);case"LAYER_PHYS":return this.encoder.uploadLayerPhys(r.layerId,e);case"ACTIVE_LAYER":return this.encoder.uploadActiveLayer(e);case"NET":return this.encoder.uploadNet(r.name,e);case"PRIMITIVE":return this.encoder.uploadPrimitive(r,e);case"GROUP":return this.encoder.uploadGroup(r.globalIndex,e);case"VIA":return this.encoder.uploadVia(r.globalIndex,e);case"PAD":return this.encoder.uploadPad(r.globalIndex,e);case"LINE":return this.encoder.uploadLine(r.globalIndex,e);case"ARC":case"CARC":return this.encoder.uploadArc(r.globalIndex,e);case"POLY":return this.encoder.uploadPoly(r.globalIndex,e);case"FILL":return this.encoder.uploadFill(r.globalIndex,e);case"FPC_FILL":return this.encoder.uploadFpcFill(r.globalIndex,e);case"REGION":return this.encoder.uploadRegion(r.globalIndex,e);case"PARTITION":return this.encoder.uploadPartition(r.globalIndex,e);case"POUR":return this.encoder.uploadPour(r.globalIndex,e);case"POURED":return this.encoder.uploadPoured((i=r[0])==null?void 0:i.getParent().globalIndex,e);case"IMAGE":return this.encoder.uploadImage(r.globalIndex,e);case"OBJ":return this.encoder.uploadObj(r.globalIndex,e);case"TEARDROP":return this.encoder.uploadTeardrop(r.globalIndex,e);case"STRING":return this.encoder.uploadString(r.globalIndex,e);case"ATTR":return this.encoder.uploadAttr(r.globalIndex,e);case"DIMENSION":return this.encoder.uploadDimension(r.globalIndex,e);case"COMPONENT":return this.encoder.uploadComponent(r.globalIndex,e);case"PAD_NET":return this.encoder.uploadPadNet(e);case"RULE_TEMPLATE":return this.encoder.uploadRuleTemplate(e);case"RULE":return this.encoder.uploadRule(e);case"RULE_SELECTOR":return this.encoder.uploadRuleSelector(e);case"EQLEN_GRP":return this.encoder.uploadEQLenGrp(r.number,e);case"SHELLCUT":return this.encoder.uploadShellCut(r.globalIndex,e);case"SHELL_ENTITY":return this.encoder.uploadShellEntity(r.globalIndex,e);case"SHELL":return this.encoder.uploadShell(r.globalIndex,e);case"CREASE":return this.encoder.uploadCrease(r.globalIndex,e);case"BOSS":return this.encoder.uploadBoss(r.globalIndex,e);case"PANELIZE":return this.encoder.uploadPanelize(e);case"SILK_OPTS":return this.encoder.uploadSilkOpts(r.layerId,e);case"PREFERENCE":return this.encoder.uploadPreference(e);case"INNER":return this.encoder.uploadLayerFill(r[0].layerId,e);case"BOARD":return this.encoder.uploadBoard(e)}}upload2Compiler(t,e,r){var n,s;if(this.compiler==null)return;let i=this.doctype!=3;switch(t){case"PAD":{(i||r.getParent()==null)&&this.compiler.uploadPad(r.globalIndex,e);break}case"POLY":{(i||r.getParent()==null)&&this.compiler.uploadPoly(r.globalIndex,e);break}case"POUR":{(i||r.getParent()==null)&&this.compiler.uploadPour(r.globalIndex,e);break}case"POURED":{((s=(n=r[0])==null?void 0:n.getParent())==null?void 0:s.globalIndex)!=null&&this.compiler.uploadPour(r.globalIndex,e);break}case"INNER":{e[0]&&this.compiler.uploadLayerFill(e[0].layerId,e);break}case"FILL":{(i||r.getParent()==null)&&this.compiler.uploadFill(r.globalIndex,e);break}case"FPC_FILL":{(i||r.getParent()==null)&&this.compiler.uploadFpcFill(r.globalIndex,e);break}case"REGION":{(i||r.getParent()==null)&&this.compiler.uploadRegion(r.globalIndex,e);break}case"PARTITION":{this.compiler.uploadPartition(r.globalIndex,e);break}case"ARC":{(i||r.getParent()==null)&&this.compiler.uploadArc(r.globalIndex,e);break}case"LINE":{(i||r.getParent()==null)&&this.compiler.uploadLine(r.globalIndex,e);break}case"VIA":{(i||r.getParent()==null)&&this.compiler.uploadVia(r.globalIndex,e);break}case"STRING":{(i||r.getParent()==null)&&this.compiler.uploadString(r.globalIndex,e);break}case"ATTR":{this.compiler.uploadAttr(r.globalIndex,e);break}case"FONT":this.compiler.uploadFont(e);break;case"IMAGE":{(i||r.getParent()==null)&&this.compiler.uploadImage(r.globalIndex,e);break}case"OBJ":{(i||r.getParent()==null)&&this.compiler.uploadObj(r.globalIndex,e);break}case"DIMENSION":{(i||r.getParent()==null)&&this.compiler.uploadDimension(r.globalIndex,e);break}case"DIMENSIONATTR":{this.compiler.uploadAttr(r.globalIndex,e);break}case"LAYER":{this.compiler.uploadLayer(r.layerId,e);break}case"LAYER_PHYS":{this.compiler.uploadLayerPhys(r.layerId,e);break}case"ACTIVE_LAYER":{this.compiler.uploadActiveLayer(e);break}case"COMPONENT":{this.compiler.uploadComponent(r.globalIndex,e);break}case"CANVAS":{this.compiler.uploadCanvas(e);break}case"PAD_NET":{this.compiler.uploadPadNet(e);break}case"PRIMITIVE":{this.compiler.uploadPrimitive(r,e);break}case"GROUP":{this.compiler.uploadGroup(r.globalIndex,e);break}case"NET":{this.compiler.uploadNet(r,e);break}case"TEARDROP":{this.compiler.uploadTeardrop(r.globalIndex,e);break}case"FONT":break;case"RULE_TEMPLATE":{this.compiler.uploadRuleTemplate(e);break}case"RULE":{this.compiler.uploadRule(e);break}case"RULE_SELECTOR":{this.compiler.uploadRuleSelector(e);break}case"SHELL":{this.compiler.uploadShell(r.globalIndex,e);break}case"CREASE":{this.compiler.uploadCrease(r.globalIndex,e);break}case"SHELLCUT":{this.compiler.uploadShellCut(r.globalIndex,e);break}case"SHELL_ENTITY":{this.compiler.uploadShellEntity(r.globalIndex,e);break}case"BOSS":{this.compiler.uploadBoss(r.globalIndex,e);break}case"PANELIZE":{this.compiler.uploadPanelize(e);break}case"SILK_OPTS":{this.compiler.uploadSilkOpts(r.layerId,e);break}case"EQLEN":case"EQLEN_GRP":{this.compiler.uploadEQLenGrp(r.number,e);break}case"PREFERENCE":{this.compiler.uploadPreference(e);break}case"BOARD":{this.compiler.uploadBoard(e);break}default:break}}};var ej=class extends ro{constructor(e,r){super();this.combinationIndex={};this.combinationName={};for(let i of e)this.combinationIndex[i.globalIndex]=i.getIndex(),this.combinationName[i.globalIndex]=i.name;this.action=r}rebuild(){for(let e in this.combinationIndex){let r=this.combinationIndex[e],i=new Array,n=new Jt;for(let l of r){let c=n.getItem(l);c!=null&&i.push(c)}let s=this.combinationName[e],a=Ht.rebuild(e,i,s);return this.updateFilterStatus(a),this.updateData(),a}}getItem(){return"ignore"}remove(){for(let e in this.combinationIndex){let r=Ht.getItem(e);r!=null&&(r.remove(),A.publish("delete",r),this.updateData())}}modify(){for(let e in this.combinationIndex){let r=Ht.getItem(e);if(r==null)continue;let i=r.getItems();i.forEach(a=>a.setGroupID(void 0));let n=new Jt,s=new Array;for(let a of this.combinationIndex[e]){let l=n.getItem(a);l!=null&&s.push(l)}r.setItems(s),s.forEach(a=>a.setGroupID(e)),this.combinationIndex[e].clear();for(let a of i)this.combinationIndex[e].add(a.globalIndex)}}upload(e=!1){if(R.getInstance().doctype==4)return;let r=R.getInstance().compiler;for(let i in this.combinationIndex){let n=Ht.getItem(i),s=this.isDelete(e);r.setTicket(),s||!n?r.deleteGroup(i):r.uploadGroup(i,{groupName:n.name});let a=new $x("2.0",3,r),l=this.combinationIndex[i],c=new Array,h=new Jt;for(let u of l){let d=h.getItem(u);d!=null&&(c.push(d),r.setTicket(),a.feedItem(d.model))}}}updateData(){}};var da=class extends ua{constructor(e){super();this.type="Radius Dimension";this.model=e,e.setModelWatcher(this),this.initRefreshRender()}get textPosition(){return this.model.textPosition}set textPosition(e){this.model.textPosition=e,this.refreshRender()}get box(){return this.model.text.box}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId=e,this.refreshRender()}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e,this.refreshRender()}get unit(){return this.model.unit}set unit(e){this.model.unit=e,this.refreshRender()}get precision(){return this.model.precision}set precision(e){this.model.precision=e,this.refreshRender()}get width(){return this.model.strokeWidth}set width(e){this.model.strokeWidth=e,this.refreshRender()}get height(){return this.model.fontSize}set height(e){this.model.fontSize=e,this.refreshRender()}get start(){return this.model.start}set start(e){this.model.start=e,this.refreshRender()}get end(){return this.model.end}set end(e){let r=0,i=tj(e.bbox());for(let n of i.getArcs())n.isSelect(e.x,e.y)&&(r=n.radius);for(let n of i.rects)if(n.isSelect(e.x,e.y)){let s=n.getHoveredArc(e.x,e.y);if(s)r=s.rx;else continue}for(let n of i.polygons){let s=n.getAllChildrens();for(let a of s)a.isSelect(e.x,e.y)&&l8(a.model.modelType)&&(r=a.radius)}this.model.radius=r,this.model.end=e,this.refreshRender()}getCenter(){let e,r=tj(this.end.bbox());for(let i of r.getArcs())i.isSelect(this.end.x,this.end.y)&&(e=i.center);for(let i of r.rects)if(i.isSelect(this.end.x,this.end.y)){let n=i.getHoveredArc(this.end.x,this.end.y);if(n)e=n.center;else continue}for(let i of r.polygons){let n=i.getAllChildrens();for(let s of n)s.isSelect(this.end.x,this.end.y)&&l8(s.model.modelType)&&(e=s.center)}return e}getArcRadius(){return this.model.radius*10}updateRadius(e,r){this.start=e,this.end=r}getRadiusLength(){return this.model.text.width+8}setRadiusLength(e){this.model.radius=e,this.refreshRender()}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.model.transform(i),this.refreshRender()}transform(e){this.model.transform(e),this.refreshRender()}flip(e){this.model.flip(e),this.refreshRender()}isSelect(e,r){return this.getParent()!=null?!1:this.model.inShape(e,r)}buildBBox(){return this.model.buildBBox()}getLineBBox(){return lFe(this.start,this.end,this.strokeWidth)}toJSON(){var r;return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,start:this.start,end:this.end,width:this.width,height:this.height,length:this.end.distance1(this.start),precision:this.precision,unit:this.unit,locked:this.locked,textPosition:this.textPosition,silkColor:((r=this.silkColor)==null?void 0:r.toString())||null}}getCoords(){return[ve(this.end.x*10,4),ve(this.end.y*10,4),ve(this.start.x*10,4),ve(this.start.y*10,4),this.model.radius*10]}getBaseGraphics(){return this.model.getBaseGraphics()}getType(){return 15}get strokeWidth(){return this.width}get textPath(){return this.model.text.outline}get textMatrix(){return this.model.text.matrix}get viewWidth(){return this.model.text.width}get viewHeight(){return this.model.text.height}get outlineModified(){return this.model.text.outlineModified}};var l4=class extends ro{constructor(t,e){super(),this.gId=t.globalIndex,this.number=e=="delete"?t.number:null,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?Sr.getInstance().encode("DIMENSION",t.model):null,this.action=e,this.deleteGroupID(t)}rebuild(){let{globalIndex:t,partition:e,layerId:r,start:i,end:n,width:s,height:a,length:l,precision:c,unit:h,locked:u,textPosition:d,silkColor:p}=this.data,m=p?ee.of3(p):void 0,g=new S(i.x,i.y),y=new S(n.x,n.y);d=new S(d.x,d.y);let b=jo.rebuild(t,r,g,y,s,a,l,c,h,u);return b.textPosition=d,b.partition=e,b.number=this.number,A.publish("hasModifyPcbItem",b),this.addGroupID(b),b.silkColor=m,this.updateFilterStatus(b),this.updateData(),this.data=void 0,b}getItem(){return jo.getItem(this.gId)}remove(){let t=jo.getItem(this.gId);this.data=t.toJSON(),this.number=t.number,A.publish("hasModifyPcbItem",t),t.remove(),A.publish("delete",t),this.updateData()}modify(){let{globalIndex:t,layerId:e,start:r,end:i,width:n,height:s,length:a,precision:l,unit:c,locked:h,textPosition:u,silkColor:d}=this.data,p=d?ee.of3(d):void 0,m=new S(r.x,r.y),g=new S(i.x,i.y);u=new S(u.x,u.y);let y=jo.getItem(this.gId),b=y.toJSON();y.start.equals(m)||(y.start=m),y.end.equals(g)||(y.end=g),y.layerId!=e&&(y.layerId=e),y.width!=n&&(y.width=n),y.height!=s&&(y.height=s),y.unit!=c&&(y.unit=c),y.precision!=l&&(y.precision=l),y.locked!=h&&(y.locked=h),y.textPosition.equals(u)||(y.textPosition=u),p||(y.silkColor=void 0),this.equals(p,y.silkColor)||(y.silkColor=p),this.data=b,this.modifyGroupID(y),A.publish("hasModifyPcbItem",y),this.updateData()}equals(t,e){return t!=null&&e!=null?t.equals(e):e==t}upload(t=!1){let e=this.isDelete(t),r=R.getInstance().compiler;e?(r.setTicket(),r.deleteDimension(this.gId)):(this.source==null&&this.updateData(),r.setTicket(),this.source!=null&&r.uploadDimension(this.gId,this.source)),this.source=void 0}updateData(){if(this.source==null){let t=jo.getItem(this.gId);t!=null&&(this.source=Sr.getInstance().encode("DIMENSION",t.model))}}};var Ir=class extends Ge{constructor(t){super(t),Ro("editor/shape/Track")}get direct(){return this.model.direct}toJSON(){return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,start:this.start,end:this.end,width:this.width,locked:this.locked,net:this.net}}getType(){return 22}update(){this._bbox=Lc.trackToOctagon(this.start,this.end,this.width)}octagon(){return this._bbox}};var rj=class{static rebuild(t){let{globalIndex:e,layerId:r,start:i,end:n,width:s,locked:a}=t,l=new S(i.x,i.y),c=new S(n.x,n.y);return Cu.rebuild(e,r,l,c,s,a)}};var ij=class{static rebuild(t){let{globalIndex:e,layerId:r,center:i,radius:n,width:s,startAngle:a,endAngle:l,sweep:c,locked:h,arcType:u}=t,d=new S(i.x,i.y);return Yc.rebuild(e,r,d,n,s,a,l,c,h,u)}};var tT=class extends pg{constructor(e,r){super();this.copperTool=new zx;let i=e.getComponent(),n=i instanceof xn?i.copperResult:[];this.gId=e.globalIndex,this.type=e.type,this.number=r=="delete"?e.number:null,this.data=r=="add"?void 0:e.toJSON(),this.source=r=="delete"?Sr.getInstance().encodeProfile(e.model):null,this.tool=new bl(JSON.stringify(e.getComponent()),e.type,n),this.action=r,this.deleteGroupID(e),this.copperTool.recordCopperCommand(e,r),r=="modify"&&this.type=="TearDrop"&&A.publish("addModifyTeardrop",e),le.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",[{id:e.globalIndex,net:e.net,bbox:e.buildBBox()}])}hasConnectChange(){return this.action==="delete"&&this.type=="3D Shell - Side Datum Line"}getConnnectChangeCommand(){return new Hx().getConnectCommands(this.gId)}rebuild(){let e=this.data,r=e.globalIndex,i=e.partition,n=e.type,s=e.layerId,a=e.shapes,l=e.strokeWidth,c=e.net,h=e.locked,u=e.silkColor?ee.of3(e.silkColor):null,d=e.componentData,p=!!e.isSimplify,m=a.map(y=>y.map(b=>{for(let P in b){if(P=="LINE")return rj.rebuild(b[P]);if(P=="ARC")return ij.rebuild(b[P])}}).filter(b=>b!=null)),g=this.rebuildPolygon(r,n,s,m,l,c,h,u);return p&&(g.isSimplify=!0),g.fill(),g.partition=i,g.number=this.number,A.publish("hasModifyPcbItem",g),this.addGroupID(g),this.updateFilterStatus(g),this.tool.rebuildComponent(g),this.copperTool.rebuildCoppers(),g.type==="FPC Stiffener"?A.publish("checkOpenStiffenerLayer",{notShowTip:!0}):g.type=="Partition"&&this.rebuildPartition(g),this.rebuildRegionSelector(g,e.regionRuleSelector),this.updateData(),this.data=void 0,g}rebuildPolygon(e,r,i,n,s,a,l,c){return pt.rebuild(e,r,i,n,s,a,l,c)}getItem(){return pt.getItem(this.gId)}remove(){let e=this.getItem();this.data=e.toJSON(),this.number=e.number;let r=e.getComponent(),i=r?JSON.stringify(r):"{}",n=r instanceof xn?JSON.stringify(r.copperResult):"[]";this.tool.setComponentData(i,n),this.tool.deleteComponent(e),A.publish("hasModifyPcbItem",e),this.copperTool.removeCoppers(),e.remove(),this.removeRegionSelector(),A.publish("delete",e),this.updateData()}modify(){let e=this.getItem(),r=e.toJSON(),i=e.getComponent(),n=i?JSON.stringify(i):"{}",s=i instanceof xn?JSON.stringify(i.copperResult):"[]";e.removeFill();let a=this.data,l=a.globalIndex,c=a.type,h=a.layerId,u=a.shapes,d=a.strokeWidth,p=a.net,m=a.locked,g=a.silkColor?ee.of3(a.silkColor):null,y=e.getChildrens();y.forEach(P=>{P.forEach(T=>T.remove())}),y.length=0;let b=u.map(P=>P.map(T=>{for(let I in T){if(I=="LINE")return rj.rebuild(T[I]);if(I=="ARC")return ij.rebuild(T[I])}}).filter(T=>T!=null));e.setChildrens(b),e.isSimplify&&e.refreshOutlineByChildren(),e.type!=c&&(e.type=c),e.layerId!=h&&(e.layerId=h),e.strokeWidth!=d&&(e.strokeWidth=d),e.net!=p&&(A.publish("hasModifyPcbItem",e),e.net=p),e.locked!=m&&(e.locked=m),this.equals(g,e.silkColor)||(e.silkColor=g),this.modifyRegionSelector(e,a.regionRuleSelector),e.fill(),this.data=r,this.modifyGroupID(e),this.tool.modifyComponent(e),this.tool.setComponentData(n,s),e.toggleCopperResult(!e.hiddenCopperResult),A.publish("hasModifyPcbItem",e),this.updateData()}compareDataChange(e){let r=pt.getItem(this.gId);if(!r||this.action!=="modify")return!0;let i=this.data,n=r.toJSON();if((!s(n.shapes,i.shapes)||i.type!==n.type)&&(r.type=="Copper Region"||i.type=="Copper Region"))return e.push(new I3(r,"delete")),r.clearCopper(),!0;if(JSON.stringify(this.data)!==JSON.stringify(r))return!0;return!1;function s(l,c){if(l.length!=c.length)return!1;for(let h=0;h<l.length;h++)if(a(n.shapes)!==a(i.shapes))return!1;return!0}function a(l){let c=l.map(h=>{if(Array.isArray(h))return h=h.map(u=>{let d=Object.keys(u)[0],p=u[d];return d==="LINE"?[p.start,p.end,p.width]:d==="ARC"?[p.center,p.startAngle,p.endAngle,p.radius,p.sweep,p.width]:[]}),h;{let u=Object.keys(h)[0],d=h[u];return u==="LINE"?[d.start,d.end,d.width]:u==="ARC"?[d.center,d.startAngle,d.endAngle,d.radius,d.sweep,d.width]:[]}});return JSON.stringify(c)}}comparePourChange(){let e=this.data,r=pt.getItem(this.gId);return!r||this.action!=="modify"?{action:"fullUpdate",data:null}:e.type=="Copper Region"&&r.type!=="Copper Region"?{action:"fullUpdate",data:null}:e.type!=="Copper Region"&&r.type=="Copper Region"?{action:"fullUpdate",data:null}:r.model.component.name!==e.componentData.name?{action:"halfUpdate",data:{id:r.globalIndex,key:"name",value:r.model.component.name}}:r.net!==e.net?{action:"halfUpdate",data:{id:r.globalIndex,key:"net",value:r.net}}:r.layerId!==e.layerId?{action:"halfUpdate",data:{id:r.globalIndex,key:"layerId",value:r.layerId}}:{action:"notUpdate",data:null}}upload(e=!1){let r=R.getInstance().compiler,i=r.consistencyManager.getMaxTicket();this.isDelete(e)?(r.setTicket(++i),h3(this.gId,this.type)):(this.source==null&&this.updateData(),r.setTicket(++i),c3(this.gId,this.type,this.source)),this.source=null}updateData(){if(this.source==null){let e=this.getItem();e!=null&&(this.source=Sr.getInstance().encodeProfile(e.model),this.type=e.type)}}};function Ure(){let o=re.getInstance().getAllBlindPhysics(),t=re.getInstance().getDefaultBlindPhysics();o.forEach(i=>{i.getAllVias().forEach(s=>{s.used=!1})});let e=Wr.getAllItem(),r=new Set;for(let i of e){let n=i.name;if(!r.has(n)){r.add(n);let s=t.getBlindVia(n);s!=null&&(s.used=!0)}}return o}var c8=class{};var E3=class extends c8{toPlainObj(t){let e=t.layerID,r=t.type,i=t.name,n=0;t.config&&(t.visible?n=1:n=2);let s=t.activeColor,a=t.deactiveColor;return{layerId:e,layerType:r,layerName:i,status:n,activeColor:s.toString(),activeColorAlpha:s.alpha,deactiveColor:a.toString(),deactiveColorAlpha:Ze.getInstance().deactiveAlpha,locked:t.locked}}save(t){let e=this.toPlainObj(t);return[e.layerId,e.layerType,e.layerName,e.status,e.activeColor,e.activeColorAlpha,e.deactiveColor,e.deactiveColorAlpha,e.locked]}};function A0(o,t=!1){let e=Ze.getInstance().getLayer(+o),r=R.getInstance().compiler,i=r.consistencyManager.getMaxTicket();r.setTicket(++i),e==null||t?R.getInstance().compiler.deleteLayer(+o):R.getInstance().compiler.uploadLayer(+o,Sr.getInstance().encode("LAYER",e))}function h8(o,t=!1){let e=R.getInstance().compiler,r=e.consistencyManager.getMaxTicket();e.setTicket(++r),t?R.getInstance().compiler.deleteLayerPhys(o.layerId):R.getInstance().compiler.uploadLayerPhys(o.layerId,Sr.getInstance().encode("LAYER_PHYS",o))}function u8(){let o=R.getInstance().compiler,t=o.consistencyManager.getMaxTicket();o.setTicket(++t),R.getInstance().compiler.uploadActiveLayer(Sr.getInstance().encode("ACTIVE_LAYER"))}function Hre(){let o=R.getInstance().compiler,t=o.mgr;if(t.layerPhyFix.errorLayerData.size>0||t.layerPhyFix.errorLayerPhyData.size>0){let e=Ze.getInstance().getAllItem(),r=Ze.getInstance().getLayerPhys();for(let i of t.layerPhyFix.errorLayerData)o.deleteLayer(i);for(let i of t.layerPhyFix.errorLayerPhyData)o.deleteLayerPhys(i);for(let i of e)A0(i.layerId);for(let i of r)h8(i);t.layerPhyFix.clear()}}var wm=class o{static getInstance(){return o._instance==null&&(o._instance=new o),o._instance}constructor(){A.subscribe("toggleLayerSelected",t=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e=parseInt(t.layerid),r=t.toggleType,i=t.LayerBartoggleLayer;Ua.toggleLayer(e,r,i),A.publish("updateFrame","")},Q()),A.subscribe("toggleLayerState",t=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e=t.layeridarr;e!=null&&(e.forEach(r=>{let i=parseInt(r.id);i!=null&&(r.isVisible!=null&&(Pe.getLayer(i).visible=r.isVisible),r.isLocked!=null&&(Pe.getLayer(i).locked=r.isLocked),A0(r.id))}),pd.layeredGroup.updateLayerVisibility(),pd.updateVisibility(),A.publish("updateFrame",""))},Q()),A.subscribe("DisplayLayer",t=>{if(!(!R.getInstance().isactive||23==R.getInstance().doctype)&&t.length==2){let e=new Array,r=Pe.getAllLayer().filter(i=>!_v(i.layerID));if(t[1].toLowerCase()=="all")Pe.setGray(0),r.forEach(i=>{i.visible=!0,A0(i.layerID),e.push({layerId:i.layerID,show:!0})});else{let i=parseInt(t[1]);r.forEach(n=>{n.visible=!1}),r.forEach(n=>{n.layerID==i&&(n.visible=!0),e.push({layerId:n.layerID,show:n.visible}),A0(n.layerID)}),Ua.toggleLayer(i)}A.publish("layerStatus",e,Q()),A.publish("updateFrame","")}},Q()),A.subscribe("layerNeedGray",t=>{!R.getInstance().isactive||23==R.getInstance().doctype||(Pe.setGray(t),A.publish("updateFrame",""))},Q()),A.subscribe("justSwitchToNormalBrightness",()=>{!R.getInstance().isactive||23==R.getInstance().doctype||(Pe.setGray(0),A.publish("dealMultLayer",0),A.publish("updateFrame",""))},Q()),A.subscribe("ToggleLayer",t=>{if(!(!R.getInstance().isactive||23==R.getInstance().doctype)&&t.length==2){let e=parseInt(t[1]);Ua.toggleLayer(e),A.publish("updateFrame","")}},Q()),A.messageBus.rpcService("CanRemoveLayers",t=>new Promise((e,r)=>{let i=t.layerIds,n=t.action,s=[],a=[],l=0;Ure(),re.getInstance().getAllBlindPhysics().forEach(d=>{d.data.forEach(p=>{[p.startLayer,p.endLayer].forEach(m=>{Es(m)&&(l=Math.max(m,l))})})});let h=i.some(d=>d<=l),u=Ze.getInstance();i.forEach(d=>{let p=null;try{p=Pe.getLayer(d)}finally{if(!p)return;p.isInnerLayer()||u.isCustomLayer(p.layerID)?(!aVe(p.layerID)||n==="layerTotalUpdated"&&e3t(String(p.layerID)))&&(a.push(p.layerID),s.push(p.name)):Q9t(p.layerID)||(a.push(p.layerID),s.push(p.name))}}),e({notEmpty:{layerNames:s,layerIds:a},conflictBlindViaRule:h})})),A.messageBus.rpcService("LayerConfig",t=>new Promise((e,r)=>{let i=[],n=t&&t.signal?Pe.getAllSignalLayer():Pe.getAllLayer();if(t&&t.hasMulti){let a=Pe.getMultLayer();!n.includes(a)&&n.push(a)}let s=new E3;for(let a of n)i.push(s.toPlainObj(a));e(i)})),A.messageBus.rpcService("LayerConfigForAutoRouter",t=>new Promise((e,r)=>{let i=[],n=t&&t.copper?Pe.getAllCopperLayer():Pe.getAllLayer();if(t&&t.hasMulti){let a=Pe.getMultLayer();!n.includes(a)&&n.push(a)}let s=new E3;for(let a of n)i.push(s.toPlainObj(a));e(i)})),A.messageBus.rpcService("getLineLayer",()=>new Promise((t,e)=>{let r=new Array,i=Pe.getAllLayer();for(let n of i)if(!ar(n.layerID)&&n.config&&![47,52].includes(n.layerID)&&!ra(n.layerID)&&!LO(n.layerID)){let s={text:n.name,value:n.layerID};r.push(s)}t(r)})),A.messageBus.rpcService("getCopperLayersCount",()=>new Promise((t,e)=>{let r=Pe.getAllCopperLayer().length;t(r)}))}updateLayerInfo(){let t=Array(),e=Pe.getAllLayer().filter(i=>i.layerID!=47),r=new E3;for(let i of e){let n=r.save(i);n.splice(0,0,"LAYER"),t.push(n),Pe.refreshConfigInnerLayers(i.layerID,i)}A.publish("renderLayerPanel",{tabid:R.getInstance().tabId,array:t},Q()),A.publish("setActive",{activeLayer:Pe.getActiveLayerID()},Q())}refreshLayerPanel(){A.publish("updateLayerMgrIcon",{},Q())}};function Q9t(o){let t=Kc();for(let e of t){let r=e.model;if(r!=null&&r instanceof xi&&r.layerId==o)return!1}return!0}function e3t(o){let t=Array.from(re.getInstance().getAllBlindPhysics());for(let e=0;e<t.length;e++){let r=t[e].data;for(let i=0;i<r.length;i++)if(String(r[i].startLayer)===String(o)||String(r[i].endLayer)===String(o))return!0}return!1}var E2=class{setGGEID(t){if(this.getAttr(t,"Footprint")!==null){let e=Hi.getItem(t.footprintUUID);if(this.getAttr(t,"Designator")!==null){let r=this.getAttr(t,"Designator");e.modifyName("",r.value),t.modifyATTRMap("Designator",r.value)}}}checkDesignator(t){if(this.getAttr(t,"Footprint")!=null){let r=Hi.getItem(t.footprintUUID),i=this.getAttr(t,"Designator"),n=le.pcbConfig.designatorAnnocationType;i.value=r.getNewNum(i.value,n),t.modifyATTRMap("Designator",i.value)}}getAttr(t,e){for(let r of t.attributes)if(r.key==e)return r;return null}sycnLayers(t){if(!(!t||t.length==0)){for(let e of t)Pe.getLayer(e.layerId)==null&&Pe.addPcbLayerByModel(e);wm.getInstance().updateLayerInfo()}}build(t,e,r=!1,i){t.addReuseAttrMap();let n=t.buildModel();n.setLayerIdReplacementTable(i,!0),n.position=e,this.setGGEID(n),this.checkDesignator(n);let s=n.box.bbox,a=n.position,l=.5,c=le.attributeConfig.getAttribute("Footprint"),h=le.attributeConfig.getAttribute("Designator"),u=h!=null&&(h.showKey||h.showValue),d=new Set,p=le.getDefaultFontSetting();for(let g of n.attributes)if(d.add(g.key),(g.key==="Designator"||g.key==="Footprint"||g.key==="Device")&&!g.showKey&&!g.showValue&&(g.fontFamily=p.defaultComponentFontTypeface,g.fontSize=p.defaultComponentFontHeight,g.strokeWidth=p.defaultComponentFontStrokeWidth,g.type=g.fontFamily==="default"?0:1),g.key=="Designator"&&u&&a.equals(g.position)&&g.positionIsNull){let y=s.UL().add1(0,l);g.position=y,g.origin!=3&&(g.origin=3),g.positionIsNull=!1}else if(c!=null&&(c.showKey||c.showValue)&&g.key=="Footprint"&&a.equals(g.position)){let y=s.LL().add1(0,-l);g.position=y,g.origin!=1&&(g.origin=1)}let m=Xc(n);if(!r)for(let g in m.attrsMap){let y=m.attrsMap[g],b=le.attributeConfig.getAttribute(g);if(b!=null&&(b.showKey||b.showValue)&&!d.has(g)&&!(g=="3D Model"||g=="3D Model Transform")){let P=this.createAttribute(m,y,g);P.showKey=P.showKey||b.showKey,P.showValue=P.showValue||b.showValue,m.addAttribute(P)}}return m.layerId=this.getLayer(r),m.position=e,this.resetAttr(m),this.sycnLayers(t.layers),t.clear(),m}getId(t){let e=new Set,r=t.getItems(),i=t.attributes;for(let l of r)e.add(l.globalIndex);for(let l of i)e.add(l.globalIndex);let n=t.globalIndex,s=0,a=n+"e"+s++;for(;e.has(a);)a=n+"e"+s++;return a}createAttribute(t,e,r="Device"){let i=le.getDefaultFontSetting(),n=i.defaultComponentFontTypeface,s=i.defaultComponentFontHeight,a=i.defaultComponentFontStrokeWidth,l=io.getInstance().addText(this.getId(t),3,r,!1,e,!1,n,s,0,!1,S.ORIGIN,3,a,!1,0,!1,!0);return ri.addtextByModel(l)}getLayer(t){return Pe.getActiveLayerID()==2&&!t?2:1}resetAttr(t){t.attributes.forEach(e=>{let r=le.attributeConfig.getAttribute(e.key);r!=null&&(e.showKey=e.showKey||r.showKey,e.showValue=e.showValue||r.showValue),t.resetAttr(e)})}};var d1=class{constructor(t){this.attr=new YP(!0);this.component=new m3;this.padNet=new g3;this.via=new d3;this.reuseBlock=new s8;this.file=new Array;this.format=new Ib().getConfig(t)}save(t){return this.file.length=0,this.feed("COMPONENT",t),t.attributes.forEach(n=>{$d(n,t)&&this.feed("ATTR",n)}),t.getPads().forEach(n=>{this.feed("PAD_NET",n)}),t.getItems().filter(n=>n instanceof Ct).forEach(n=>{this.feed("PAD_NET",n)}),this.file}replace(t,e,r){return this.file.length=0,this.feed("COMPONENT",t),t.attributes.forEach(a=>{a.key==e&&(a.value=r),$d(a,t)&&this.feed("ATTR",a)}),t.getPads().forEach(a=>{this.feed("PAD_NET",a)}),t.getItems().filter(a=>a instanceof Ct).forEach(a=>{this.feed("PAD_NET",a)}),this.file}restore(t){return this.file.length=0,this.feed("COMPONENT",t),t.attributes.forEach(n=>{$d(n,t)&&n.key!="Footprint"&&this.feed("ATTR",n)}),t.getPads().forEach(n=>{this.feed("PAD_NET",n)}),t.getItems().filter(n=>n instanceof Ct).forEach(n=>{this.feed("PAD_NET",n)}),this.file}feed(t,e){let r=this.getItemFormat(t),i=this.getEncode(t),n={};for(let c of r)n[c]=this.getData(c,i,e);let s=i.getKey(),a=e.number,l={id:s,number:a,type:t,data:n};return this.file.push(l),l}getItemFormat(t){return this.format[t]}getEncode(t){switch(t){case"ATTR":return this.attr;case"COMPONENT":return this.component;case"PAD_NET":return this.padNet}}getData(t,e,r){return e.getData(t,r)}};var zre=class extends wl{get hashkey(){return null}feed(t){let{startTrackWidthFollowLast:e,lastTrackWidth:r,startViaSizeFollowLast:i,lastViaInnerDiameter:n,lastViaDiameter:s,snap:a,routingMode:l,routingCorner:c,removeLoop:h,rotatingObject:u,trackFollow:d,stretchTrackMinCorner:p,preferenceConfig:m,realTimeUpdateUnusedLayers:g,unusedPadRange:y,pushVia:b,pathOptimization4BePushed:P,currentPathOptimization4BePushed:T,removeCircuitsContainingVias:I,removeAntenna:C}=t;this.startTrackWidthFollowLast=e||R.getInstance().doctype!=3,this.lastTrackWidth=r/10,this.startViaSizeFollowLast=i||R.getInstance().doctype!=3,this.lastViaInnerRadius=n/20,this.lastViaRadius=s/20,this.snap=a,this.routingMode=L8e(l),this.routingCorner=c,this.removeLoop=h,this.rotatingObject=u,this.trackFollow=d,this.stretchTrackMinCorner=p,this.preferenceConfig=m,this.realTimeUpdateUnusedLayers=g,this.unusedPadRange=N8e(y)||3,this.pushVia=B8e(b)||"OPTIMIZA_OPEN",this.pathOptimization4BePushed=V8e(P)||0,this.currentPathOptimization=U8e(T)||"OPTIMIZA_WEAK",this.removeCircuitsContainingVias=I!=null?I:!0,this.removeAntenna=C!=null?C:!0}check(){return!(this.startTrackWidthFollowLast==null||!this.isNumber(this.lastTrackWidth)||this.lastTrackWidth<=0||this.startViaSizeFollowLast==null||!this.isNumber(this.lastViaInnerRadius)||this.lastViaInnerRadius<=0||!this.isNumber(this.lastViaRadius)||this.lastViaRadius<=0||this.snap==null||this.routingMode==null||this.removeLoop==null||this.rotatingObject==null||this.trackFollow==null||this.routingCorner==null||((isNaN(this.stretchTrackMinCorner)||this.stretchTrackMinCorner<0)&&(this.stretchTrackMinCorner=1),!this.isNumber(this.unusedPadRange)||this.unusedPadRange<1||this.unusedPadRange>3)||this.pushVia==null||this.pathOptimization4BePushed==null||this.currentPathOptimization==null||this.removeCircuitsContainingVias==null||this.removeAntenna==null)}finish(){if(this.check()){le.pcbConfig.startTrackWidth=this.startTrackWidthFollowLast?"last":"rule",le.pcbConfig.startViaSize=this.startViaSizeFollowLast?"last":"rule",ut.defaultVia.radius=this.lastViaRadius,ut.defaultVia.innerRadius=this.lastViaInnerRadius,we.adsorb=this.snap;let t=Zt.getInstance();t.mode=this.routingMode,pr.removeLoop=this.removeLoop,le.pcbConfig.rotateWhole=this.rotatingObject?"single":"whole",this.trackFollow!=null&&(le.pcbConfig.trackFollow=this.trackFollow?"moveKeep":"moveDisconnect"),t.type=t.getRoutingTypeByStr(this.routingCorner),le.pcbConfig.layerPhyPerferenceConfig=this.preferenceConfig,le.pcbConfig.unusedPadRange=this.unusedPadRange,le.pcbConfig.realTimeUpdateUnusedLayers=this.realTimeUpdateUnusedLayers;let e=Ha.getInstance();e.setPushVia(this.pushVia),e.setPathOptimization4BePushed(this.pathOptimization4BePushed),e.setCurrentPathOptimization(this.currentPathOptimization),e.setRemoveLoop(this.removeCircuitsContainingVias,"Remove Circuits Containing Vias"),e.setRemoveLoop(this.removeAntenna,"Remove Antenna"),R.getInstance().isPreview||(we.widthFollowRule=le.pcbConfig.startTrackWidth=="rule",we.sizeFollowRule=le.pcbConfig.startViaSize=="rule",we.prevTrackWidth=this.lastTrackWidth,we.removeLoop=this.removeLoop,e.setTrackMinCorner(this.stretchTrackMinCorner))}else return null}loadUnusedPadRange(t){le.pcbConfig.unusedPadRange!==t&&(le.pcbConfig.unusedPadRange=t)}loadLayerPhyPerferenceConfig(t){le.pcbConfig.layerPhyPerferenceConfig!==t&&(le.pcbConfig.layerPhyPerferenceConfig=t)}loadRealTimeUpdateUnusedLayers(t){le.pcbConfig.realTimeUpdateUnusedLayers!=t&&(le.pcbConfig.realTimeUpdateUnusedLayers=t)}load(){this.resultNeedToBeCached&&(this.loadLayerPhyPerferenceConfig(this.preferenceConfig),this.loadUnusedPadRange(this.unusedPadRange),this.loadRealTimeUpdateUnusedLayers(this.realTimeUpdateUnusedLayers))}};var al=class{constructor(t,e=!0,r=!0){this.type=t,this._visible=e,this._pick=r}get visible(){return this._visible}set visible(t){t!=null&&(this._visible=t)}get pick(){return this._pick}set pick(t){t!=null&&(this._pick=t)}};var c4=class c4 extends Ei{static getInstance(){return c4.manager==null&&(c4.manager=new c4),c4.manager}constructor(){super(),this.addModel(new al(0,!0)),this.addModel(new al(1,!0)),this.addModel(new al(2,!0)),this.addModel(new al(3,!0)),this.addModel(new al(4,!0)),this.addModel(new al(5,!0)),this.addModel(new al(6,!0)),this.addModel(new al(7,!0,!1)),this.addModel(new al(8,!0,!1)),this.addModel(new al(9,!0)),this.addModel(new al(10,!0)),this.addModel(new al(12,!0,!1)),this.addModel(new al(13,!0)),this.addModel(new al(15,!0)),this.addModel(new al(14,!0)),this.addModel(new al(16,!0)),this.addModel(new al(17,!0)),this.addModel(new al(18,!0)),this.addModel(new al(19,!0)),this.addModel(new al(20,!0)),this.addModel(new al(21,!0)),this.addModel(new al(23,!0)),this.addModel(new al(24,!0)),this.addModel(new al(26,!0)),this.addModel(new al(27,!0)),this.addModel(new al(28,!0)),this.addModel(new al(29,!0)),this.addModel(new al(30,!0)),this.addModel(new al(31,!0)),this.addModel(new al(32,!0)),this.addModel(new al(33,!0)),this.addModel(new al(34,!0,!0)),this.addModel(new al(35,!0,!1)),this.addModel(new al(36,!0)),this.addModel(new al(37,!0)),this.addModel(new al(38,!0))}addModel(t){this.map.set(t.type,t)}add(t,e=!0,r=!0){let i=new al(t,e,r);return this.map.set(t,i),i}};c4.manager=null;var Ri=c4;var jre=class extends wl{get hashkey(){return this.type}feed(t){let{primitiveName:e,display:r,pick:i}=t;this.type=e,this.display=r,this.pick=i}check(){return!!this.type}finish(){switch(this.type){case"ALL":Ri.getInstance().getItem(0).pick=this.pick;break;case"COMPONENT":Ri.getInstance().getItem(1).pick=this.pick,Ri.getInstance().getItem(1).visible=this.display;break;case"PROPERTY":Ri.getInstance().getItem(2).pick=this.pick,Ri.getInstance().getItem(2).visible=this.display;break;case"COMPONENTSILK":Ri.getInstance().getItem(3).visible=this.display;break;case"TRACK":Ri.getInstance().getItem(4).pick=this.pick,Ri.getInstance().getItem(4).visible=this.display;break;case"TESTPOINT":Ri.getInstance().getItem(5).pick=this.pick,Ri.getInstance().getItem(5).visible=this.display;break;case"FPC_STIFFENER":Ri.getInstance().getItem(20).pick=this.pick,Ri.getInstance().getItem(20).visible=this.display;break;case"PAD":Ri.getInstance().getItem(6).pick=this.pick,Ri.getInstance().getItem(6).visible=this.display;break;case"VIA":Ri.getInstance().getItem(9).pick=this.pick,Ri.getInstance().getItem(9).visible=this.display;break;case"SUTUREHOLE":Ri.getInstance().getItem(10).pick=this.pick,Ri.getInstance().getItem(10).visible=this.display;break;case"TEARDROP":Ri.getInstance().getItem(34).pick=this.pick,Ri.getInstance().getItem(34).visible=this.display;break;case"TEXT":Ri.getInstance().getItem(13).pick=this.pick,Ri.getInstance().getItem(13).visible=this.display;break;case"IMAGE":Ri.getInstance().getItem(15).pick=this.pick,Ri.getInstance().getItem(15).visible=this.display;break;case"PICTURE":Ri.getInstance().getItem(14).pick=this.pick,Ri.getInstance().getItem(14).visible=this.display;break;case"DIMENSION":Ri.getInstance().getItem(16).pick=this.pick,Ri.getInstance().getItem(16).visible=this.display;break;case"BOARDOUTLINE":Ri.getInstance().getItem(17).pick=this.pick,Ri.getInstance().getItem(17).visible=this.display;break;case"SLOTREGION":Ri.getInstance().getItem(18).pick=this.pick,Ri.getInstance().getItem(18).visible=this.display;break;case"FILLREGIEN":Ri.getInstance().getItem(19).pick=this.pick,Ri.getInstance().getItem(19).visible=this.display;break;case"COPPEROUTLINE":Ri.getInstance().getItem(21).pick=this.pick,Ri.getInstance().getItem(21).visible=this.display;break;case"PROHIBITEDREGION":Ri.getInstance().getItem(23).pick=this.pick,Ri.getInstance().getItem(23).visible=this.display;break;case"CONSTRAINT":Ri.getInstance().getItem(24).pick=this.pick,Ri.getInstance().getItem(24).visible=this.display;break;case"LINE":Ri.getInstance().getItem(26).pick=this.pick,Ri.getInstance().getItem(26).visible=this.display;break;case"PADSPAIR":R.getInstance().doctype===3&&(Ri.getInstance().getItem(7).pick=this.pick);break;case"NETWORK":R.getInstance().doctype===3&&(Ri.getInstance().getItem(8).pick=this.pick);break;case"GROUP":R.getInstance().doctype===3&&(Ri.getInstance().getItem(12).pick=this.pick);break;case"COPPERFILLED":R.getInstance().doctype===3&&(Ri.getInstance().getItem(21).visible=this.display);break;case"SHELL":R.getInstance().doctype===3&&(Ri.getInstance().getItem(27).pick=this.pick,Ri.getInstance().getItem(27).visible=this.display);break;case"SIDESHELLCUT":R.getInstance().doctype===3&&(Ri.getInstance().getItem(31).pick=this.pick,Ri.getInstance().getItem(31).visible=this.display);break;case"TOPSHELLCUT":R.getInstance().doctype===3&&(Ri.getInstance().getItem(30).pick=this.pick,Ri.getInstance().getItem(30).visible=this.display);break;case"SIDEENTITY":R.getInstance().doctype===3&&(Ri.getInstance().getItem(33).pick=this.pick,Ri.getInstance().getItem(33).visible=this.display);break;case"TOPBOTTOMENTITY":R.getInstance().doctype===3&&(Ri.getInstance().getItem(32).pick=this.pick,Ri.getInstance().getItem(32).visible=this.display);break;case"CREASE":R.getInstance().doctype===3&&(Ri.getInstance().getItem(29).pick=this.pick,Ri.getInstance().getItem(29).visible=this.display);break;case"BOSS":R.getInstance().doctype===3&&(Ri.getInstance().getItem(28).pick=this.pick,Ri.getInstance().getItem(28).visible=this.display);break;case"LOCKED":Ri.getInstance().getItem(36).pick=this.pick;break;case"UNLOCKED":Ri.getInstance().getItem(37).pick=this.pick;break}}};var Xre=class extends wl{get hashkey(){return this.layerId}feed(t){let{layerId:e,defaultColor:r,baseColor:i}=t;this.layerId=e,this.defaultColor=r,this.baseColor=i}check(){return!(this.layerId!=4&&this.layerId!=3||!this.checkColor(this.defaultColor)||!this.checkColor(this.baseColor))}checkColor(t){return/^#[a-fA-F0-9]{6}$/.test(t)}finish(){if(this.check())this.layerId==3?(we.topSilkscreenColor=this.defaultColor,we.topBoardColor=this.baseColor):(we.bottomSilkscreenColor=this.defaultColor,we.bottomBoardColor=this.baseColor);else return null}loadTopSilkscreenColor(t){we.topSilkscreenColor!==t&&(we.topSilkscreenColor=t)}loadTopBoardColor(t){we.topBoardColor!==t&&(we.topBoardColor=t)}loadBottomSilkscreenColor(t){we.bottomSilkscreenColor!==t&&(we.bottomSilkscreenColor=t)}loadBottomBoardColor(t){we.bottomBoardColor!==t&&(we.bottomBoardColor=t)}load(){this.resultNeedToBeCached&&(this.layerId==3?(this.loadTopSilkscreenColor(this.defaultColor),this.loadTopBoardColor(this.baseColor)):(this.loadBottomSilkscreenColor(this.defaultColor),this.loadBottomBoardColor(this.baseColor)))}};var Kx=class extends wl{getModelData(){this.modelData=this.model.getDefaultPanelize()}};var h4=class extends Kx{get hashkey(){return this.index}feed(t){let{direction:e,on:r,stampHoleGroupQuantity:i,stampHoleDiameter:n,stampHoleQuantityPerGroup:s,stampHoleSpacing:a}=t;this.vertical=y2(e),this.index=e.toString(),this.vertical?this.stampColumn=r:this.stampRow=r,this.vertical?this.stampPerColumn=i:this.stampPerRow=i,this.isNumber(n)&&(this.stampHoleDiameter=n/10),this.stampHolePerGroup=s,this.isNumber(a)&&(this.stampHoleSpacing=a/10)}check(){if(this.vertical==null||!this.isNumber(this.stampHolePerGroup)||this.stampHolePerGroup<1||isNaN(this.stampHoleDiameter)||this.stampHoleDiameter<0||isNaN(this.stampHoleSpacing)||this.stampHoleSpacing<0)return!1;if(this.vertical){if(!this.isNumber(this.stampPerColumn)||this.stampPerColumn<1||this.vertical&&this.stampColumn==null)return!1}else if(!this.isNumber(this.stampPerRow)||this.stampPerRow<1||this.stampRow==null)return!1;return!0}finish(){if(this.check()){let t={stampHolePerGroup:this.stampHolePerGroup,stampHoleDiameter:this.stampHoleDiameter,stampHoleSpacing:this.stampHoleSpacing};this.vertical?(t.stampPerColumn=this.stampPerColumn,t.stampColumn=this.stampColumn):(t.stampPerRow=this.stampPerRow,t.stampRow=this.stampRow),si.getInstance().setDefaultPanelize(t)}else return null}loadStampRow(t){this.modelData.stampRow!==t&&this.model.setDefaultPanelize({stampRow:t})}loadStampPerRow(t){this.modelData.stampPerRow!==t&&this.model.setDefaultPanelize({stampPerRow:t})}loadStampColumn(t){this.modelData.stampColumn!==t&&this.model.setDefaultPanelize({stampColumn:t})}loadStampPerColumn(t){this.modelData.stampPerColumn!==t&&this.model.setDefaultPanelize({stampPerColumn:t})}loadStampHoleDiameter(t){this.modelData.stampHoleDiameter!==t&&this.model.setDefaultPanelize({stampHoleDiameter:t})}loadStampHolePerGroup(t){this.modelData.stampHolePerGroup!==t&&this.model.setDefaultPanelize({stampHolePerGroup:t})}loadStampHoleSpacing(t){this.modelData.stampHoleSpacing!==t&&this.model.setDefaultPanelize({stampHoleSpacing:t})}load(){this.getModelData(),this.loadStampRow(this.stampRow),this.loadStampPerRow(this.stampPerRow),this.loadStampColumn(this.stampColumn),this.loadStampPerColumn(this.stampPerColumn),this.loadStampHoleDiameter(this.stampHoleDiameter),this.loadStampHolePerGroup(this.stampHolePerGroup),this.loadStampHoleSpacing(this.stampHoleSpacing)}};var u4=class extends Kx{get hashkey(){return this.index}feed(t){let e=si.getInstance().getDefaultPanelize(),{direction:r,on:i,sideHeight:n,positionHoleDiameter:s,markDiameter:a,markExpansion:l}=t;this.index=r.toString(),this.vertical=y2(r),this.vertical?this.borderAtTopBottom=i:this.borderAtLeftRight=i,this.isNumber(n)&&(this.borderHeight=n/10),this.createPositionHole=s!=0,this.isNumber(s)&&(this.positionHoleDiameter=s>0?s/10:e.defaultPositionHoleDiameter),this.createMark=a!=0,this.isNumber(a)&&(this.markDiameter=a>0?a/10:e.markDiameter),this.isNumber(l)&&(this.markExpansion=l/10)}check(){if(this.vertical){if(this.borderAtTopBottom==null)return!1}else if(this.borderAtLeftRight==null)return!1;return!(isNaN(this.borderHeight)||this.borderHeight<=0||this.createPositionHole==null||isNaN(this.positionHoleDiameter)||this.positionHoleDiameter<0||this.createMark==null||isNaN(this.markDiameter)||this.markDiameter<0||isNaN(this.markExpansion)||this.markExpansion<0)}finish(){if(this.check()){let t={borderAtTopBottom:this.borderAtTopBottom,borderAtLeftRight:this.borderAtLeftRight,borderHeight:this.borderHeight,createPositionHole:this.createPositionHole,createMark:this.createMark,markExpansion:this.markExpansion};this.positionHoleDiameter&&(t.positionHoleDiameter=this.positionHoleDiameter),this.markDiameter&&(t.markDiameter=this.markDiameter),si.getInstance().setDefaultPanelize(t)}else return null}loadBorderAtTopBottom(t){this.modelData.borderAtTopBottom!==t&&this.model.setDefaultPanelize({borderAtTopBottom:t})}loadBorderAtLeftRight(t){this.modelData.borderAtLeftRight!==t&&this.model.setDefaultPanelize({borderAtLeftRight:t})}loadBorderHeight(t){this.modelData.borderHeight!==t&&this.model.setDefaultPanelize({borderHeight:t})}loadPositionHoleDiameter(t){this.modelData.positionHoleDiameter!==t&&this.model.setDefaultPanelize({positionHoleDiameter:t})}loadCreatePositionHole(t){this.modelData.createPositionHole!==t&&this.model.setDefaultPanelize({createPositionHole:t})}loadCreateMark(t){this.modelData.createMark!==t&&this.model.setDefaultPanelize({createMark:t})}loadMarkDiameter(t){this.modelData.markDiameter!==t&&this.model.setDefaultPanelize({markDiameter:t})}loadMarkExpansion(t){this.modelData.markExpansion!==t&&this.model.setDefaultPanelize({markExpansion:t})}load(){this.getModelData(),this.loadBorderAtTopBottom(this.borderAtTopBottom),this.loadBorderAtLeftRight(this.borderAtLeftRight),this.loadBorderHeight(this.borderHeight),this.loadPositionHoleDiameter(this.positionHoleDiameter),this.loadCreatePositionHole(this.createPositionHole),this.loadCreateMark(this.createMark),this.loadMarkDiameter(this.markDiameter),this.loadMarkExpansion(this.markExpansion)}};var qre=class extends Kx{get hashkey(){return null}feed(t){let{on:e,row:r,column:i,rowSpacing:n,columnSpacing:s,onlyOutline:a,horizontalStamp:l,verticalStamp:c,horizontalSize:h,verticalSize:u}=t;this.on=e,this.row=r,this.column=i,this.isNumber(n)&&(this.rowSpacing=n/10),this.isNumber(s)&&(this.columnSpacing=s/10),this.onlyOutline=a,this.horizontalStamp=new h4,this.horizontalStamp.feed(Object.assign({direction:0},l)),this.verticalStamp=new h4,this.verticalStamp.feed(Object.assign({direction:1},c)),this.horizontalSize=new u4,this.horizontalSize.feed(Object.assign({direction:0},h)),this.verticalSize=new u4,this.verticalSize.feed(Object.assign({direction:1},u))}check(){return!(this.on==null||!this.isNumber(this.row)||this.row<1||!this.isNumber(this.column)||this.column<1||isNaN(this.rowSpacing)||this.rowSpacing<0||isNaN(this.columnSpacing)||this.columnSpacing<0||this.onlyOutline==null)}finish(){if(this.check())this.horizontalStamp.finish(),this.verticalStamp.finish(),this.horizontalSize.finish(),this.verticalSize.finish(),si.getInstance().setDefaultPanelize({on:this.on,row:this.row,column:this.column,rowSpacing:this.rowSpacing,columnSpacing:this.columnSpacing,onlyOutline:this.onlyOutline});else return null}loadOn(t){this.modelData.on!==t&&this.model.setDefaultPanelize({on:t})}loadRow(t){this.modelData.row!==t&&this.model.setDefaultPanelize({row:t})}loadColumn(t){this.modelData.column!==t&&this.model.setDefaultPanelize({column:t})}loadRowSpacing(t){this.modelData.rowSpacing!==t&&this.model.setDefaultPanelize({rowSpacing:t})}loadColumnSpacing(t){this.modelData.columnSpacing!==t&&this.model.setDefaultPanelize({columnSpacing:t})}loadOnlyOutline(t){this.modelData.onlyOutline!==t&&this.model.setDefaultPanelize({onlyOutline:t})}load(){this.getModelData(),this.loadOn(this.on),this.loadRow(this.row),this.loadColumn(this.column),this.loadRowSpacing(this.rowSpacing),this.loadColumnSpacing(this.columnSpacing),this.loadOnlyOutline(this.onlyOutline),this.horizontalStamp.model=this.model,this.horizontalStamp.load(),this.verticalStamp.model=this.model,this.verticalStamp.load(),this.horizontalSize.model=this.model,this.horizontalSize.load(),this.verticalSize.model=this.model,this.verticalSize.load()}};var $re=class extends Vu{finish(){return this.check()&&Array.isArray(this.path)&&Array.isArray(this.path[0])&&(this.path=this.path[0]),this.resultNeedToBeCached=!1,us.getInstance().addBoard(this.parseShapeModel(us.id,"Board",1006,null,!1,this.width||us.width,this.path))}check(){return this.path!=null}feed(t){let{path:e}=t;this.path=e}load(){this.resultNeedToBeCached=!1;let t=us.getInstance().board;t&&(t.remove(),us.getInstance().board=null),this.finish()}};var vy=class extends vm{constructor(){super(...arguments);this.primitive=new Array;this.panelize=new Array;this.panelizeStamp=new Array;this.panelizeSide=new Array;this.silkOpts=new Array;this.preference=new Array}getDecode(e){let r=super.getDecode(e);if(r==null)switch(e){case"PRIMITIVE":{let i=new jre;return this.primitive.push(i),i}case"PANELIZE":{let i=new qre;return this.panelize.push(i),i}case"PANELIZE_STAMP":{let i=new h4;return this.panelizeStamp.push(i),i}case"PANELIZE_SIDE":{let i=new u4;return this.panelizeSide.push(i),i}case"SILK_OPTS":{let i=new Xre;return this.silkOpts.push(i),i}case"PREFERENCE":{let i=new zre;return this.preference.push(i),i}case"BOARD":return this.board=new $re,this.board;default:return null}else return r}};var Kre=class{constructor(t){this.items=new Array;this.file=t,this.decode=new vm}parse(){for(let t of this.file)this.decode.parse(t.type,t.data,0,t.id,t.number)}async parseFootAndDevice(){let t=new Set,e=new Set,r=R.getInstance().compilerChannel;for(let n of this.decode.attr){let s=n.key,a=n.value;if(s=="Device"){if(e.has(a))continue;e.add(a);let l=await Tu.getInstance().add(a,r);if(l){let c=l.footprintUUID;c!=null&&c!=""&&t.add(c)}}else s=="Footprint"&&t.add(a)}for(let n of t)n.indexOf("_")>-1?await Ji.getInstance().addCustomFootprint(n,r):await Ji.getInstance().add(n,r);let i=new Map;for(let n of this.decode.attr){let s=i.get(n.parentIndex);s||(i.set(n.parentIndex,[]),s=i.get(n.parentIndex)),s.push(n)}}build(){this.parse(),this.decode.preAdjust(),this.buildItems(this.decode.component)}async replaceDecode(t){this.parse();let e=new Array;for(let r=0;r<this.decode.attr.length;r++)this.decode.attr[r].key==t.key&&e.push(r);e.reverse();for(let r of e)this.decode.attr.splice(r,1);this.decode.attr.push(t),await this.parseFootAndDevice(),this.decode.preAdjust(),this.buildItems(this.decode.component)}async replaceFootprint(t){this.parse();for(let e=0;e<this.decode.attr.length;e++){let r=this.decode.attr[e];r.key=="Footprint"&&(r.value=t)}await this.parseFootAndDevice(),this.decode.preAdjust(),this.buildItems(this.decode.component)}buildItems(t){try{t.forEach(e=>{let r=e.finish();r!=null&&r instanceof Bi&&this.items.push(r)})}catch(e){console.log(e)}}};var p1=class extends Kre{constructor(e){super(e);this.items=new Array;this.file=e,this.decode=new vy}buildItems(e){try{e.forEach(r=>{let i=r.finish();if(i!=null&&i instanceof Bi){let n=Xc(i);this.items.push(n)}})}catch(r){console.log(r)}}};var Rb=class extends ro{constructor(t,e){if(super(),this.gId=t.globalIndex,this.number=e=="delete"?t.number:null,this.data=e=="add"?void 0:t.toJSON(),e=="modify"){this.saved=new Set;let r=t.attributes;for(let i of r)$d(i.model,t.model)&&this.saved.add(i.globalIndex)}this.preData=e=="delete"?Sr.getInstance().encodeComponent("COMPONENT",t.model):null,this.action=e,this.deleteGroupID(t),t.getPads().forEach(r=>{A.publish("cheakTearDrop",new zf(e,r.toJSON(),r))}),t.getVias().forEach(r=>{A.publish("cheakTearDrop",new zf(e,r.toJSON(),r))}),le.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",t.getPads().map(r=>({id:r.globalIndex,net:r.net,bbox:r.buildBBox()})))}rebuild(){let{footprint:t,device:e,globalIndex:r,partition:i,layerId:n,position:s,rotation:a,textOffset:l,locked:c,attrsMap:h,ATTR:u,pads:d,silkColor:p,custom:m,childPartition:g}=this.data,y=new Array,b=p?ee.of3(p):null;new Promise(async()=>{let _=Hi.getItem(t);m!=null&&(_=await Hi.addCustomFootprint(m,R.getInstance().compilerChannel)),_.modifyName("",h.Designator)});let P;e!=null&&(P=ts.getItem(e));let T=Hi.getItem(t);if(m!=null){let _=m;T=Hi.getItem(_)}let I;e!=null?(P=ts.getItem(e),I=P.copy(T.uuid,r)):(I=new s3(T.uuid,"",r,T.getBBox()),I=T.generate(I)),I.attrsMap=h;let E=new E2().build(I,S.ORIGIN,!0);E.layerId=n,E.rotation=a,E.textOffset=l,E.locked=c,E.position=s,p&&(E.silkColor=p),u.forEach(_=>{let x=ri.copy(_,_.globalIndex);x.key=_.key,x.showKey=_.showKey,y.push(x)}),y.forEach(_=>{if(_.key=="Designator"){let x=h.Designator;h.Designator=x,_.value=x}else _.key=="Footprint"?(h.Footprint=T.footprintId,_.value=T.footprintId):_.key=="Device"&&P!=null&&(h.Device=P.name,_.value=P.name);E.addAttribute(_)});let O=Op(_=>_.num,d);if(E.getPads().forEach(_=>{let x=O.get(_.num);if(x!=null)if(x.length==1)_.net=x[0].net,x[0].padLen!=null&&$o.getInstance().setPadLen(E.globalIndex,_.globalIndex,x[0].padLen);else{let v=_.globalIndex.replace(E.globalIndex,"");for(let D of x)D.id==v&&(_.net=D.net,D.padLen!=null&&$o.getInstance().setPadLen(E.globalIndex,_.globalIndex,D.padLen))}}),E.getVias().forEach(_=>{let x=_.getParent(),v;if(x!=null){let w=x.globalIndex,F=new RegExp(w);v=_.globalIndex.replace(F,"")}else v=_.globalIndex;let D=O.get(v);if(D!=null)if(D.length==1)_.net=D[0].net;else for(let w of D)w.id==v&&(_.net=w.net)}),P!=null)for(let _ of E.attributes){let x=P.getAttrData(E.model,_.model);P.addAttr(_.key,x)}if(E.partition=i,E.number=this.number,g!=null){for(let _ of E.getPads())_.partition=g[_.globalIndex]||"";for(let _ of E.getVias())_.partition=g[_.globalIndex]||""}if(A.publish("hasModifyPcbItem",E),P!=null)for(let _ of E.attributes){let x=P.getAttrData(E.model,_.model);P.addAttr(_.key,x)}return this.addGroupID(E),E.silkColor=b,this.updateFilterStatus(E),this.data=void 0,E}getItem(){return Ar.getItem(this.gId)}remove(){this.updateData();let t=Ar.getItem(this.gId);this.data=t.toJSON(),t.remove();let e=t.getItems();for(let r of e)r instanceof Le&&$o.getInstance().deletePadLen(t.globalIndex,r.globalIndex);A.publish("delete",t),A.publish("hasModifyPcbItem",t)}modify(){let t=Ar.getItem(this.gId);this.saved||(this.saved=new Set),this.saved.clear();let e=t.attributes;for(let T of e)$d(T.model,t.model)&&this.saved.add(T.globalIndex);let r=t.toJSON(),{footprint:i,layerId:n,position:s,rotation:a,textOffset:l,locked:c,attrsMap:h,custom:u,silkColor:d,ATTR:p}=this.data,m=u==null?i:u,g=d?ee.of3(d):null;s=new S(s.x,s.y),l=new S(l.x,l.y);let y=t.attributes;for(let T of y)t.removeAttribute(T);t.layerId!=n&&(t.layerId=n),t.textOffset.equals(l)||(t.textOffset=l);let b=!1;t.position.equals(s)||(t.position=s,b=!0),t.rotation!=a&&(t.rotation=a,b=!0),t.locked!=c&&(t.locked=c);for(let T of p){let I=aCe(T);t.addAttribute(I)}t.clearMap();for(let T in h)t.addATTRMap(T,h[T]);if(g||(t.silkColor=void 0),g&&t.silkColor!=g&&!t.silkColor.equals(g)&&(t.silkColor=g),t.footprintUUID!=m){let I=new d1("2.0").replace(t.model,"Footprint",m);t.remove(),A.publish("delete",t);let C=new p1(I);C.build(),t=C.items[0]}t.visible();let P=t.getItems();for(let T of P)T instanceof He&&T.fill();this.data=r,this.modifyGroupID(t),A.publish("hasModifyPcbItem",t)}upload(t=!1){var l;let e=this.isDelete(t);this.preData==null&&this.updateData();let{componentData:r,attrData:i,padNetData:n}=this.preData,s=R.getInstance().compiler,a=s.consistencyManager.getMaxTicket();if(s.setTicket(++a),e?s.deleteComponent(this.gId):s.uploadComponent(this.gId,r),n.length)for(let c of n)s.setTicket(++a),e?s.deletePadNet(c.componentId,c.padNum,c.padId):s.uploadPadNet(c);if(i.size){let c=[];for(let[h,u]of i)c.push(h),s.setTicket(++a),e?s.deleteAttr(h):s.uploadAttr(h,u);if((l=this.data)!=null&&l.ATTR)for(let h of this.data.ATTR){let u=h.globalIndex;(!this.saved||this.saved.has(u))&&!c.includes(u)&&s.deleteAttr(u)}}this.preData=null}updateData(){if(this.preData==null){let t=Ar.getItem(this.gId);t!=null&&(this.preData=Sr.getInstance().encodeComponent("COMPONENT",t.model))}}};var yi=class extends Ge{constructor(t){super(t),Ro("editor/shape/ArcTrack")}get arcType(){return this.model.arcType}set arcType(t){this.model.arcType=t}get angle(){return this.model.angle}set angle(t){this.model.angle=t,this.refreshRender()}get center(){return this.model.center}set center(t){this.model.center=t,this.refreshRender()}get radius(){return this.model.radius}set radius(t){this.model.radius=t,this.refreshRender()}get startAngle(){return this.model.startAngle}set startAngle(t){this.model.startAngle=t,this.refreshRender()}get endAngle(){return this.model.endAngle}set endAngle(t){this.model.endAngle=t,this.refreshRender()}get isCCW(){return this.model.isCCW}get sweep(){return this.model.sweep}set sweep(t){this.model.sweep=t,this.refreshRender()}get midPoint(){return this.model.midPoint}set midPoint(t){this.model.midPoint=t,this.refreshRender()}toJSON(){return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,center:this.center,radius:this.radius,startAngle:this.startAngle,endAngle:this.endAngle,sweep:this.sweep,width:this.width,locked:this.locked,net:this.net,arcType:this.arcType}}getType(){return 0}};var d4=class extends ro{constructor(t,e){super(),this.gId=t.globalIndex,this.number=e=="delete"?t.number:null,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?Sr.getInstance().encode("ARC",t.model):null,this.action=e,this.deleteGroupID(t),A.publish("cheakTearDrop",new zf(e,t.toJSON(),t)),le.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",[{id:t.globalIndex,net:t.net,bbox:t.buildBBox()}])}getItem(){return pr.getItem(this.gId)}rebuild(){var m;let{globalIndex:t,partition:e,layerId:r,center:i,radius:n,startAngle:s,endAngle:a,sweep:l,width:c,locked:h,net:u,arcType:d}=this.data;if(!((m=Ze.getInstance().getLayer(r))!=null&&m.config))return null;i=new S(i.x,i.y);let p=pr.rebuildArcTrack(t,r,i,n,s,a,l,c,h,u,d);return p.partition=e,p.number=this.number,this.addGroupID(p),this.updateFilterStatus(p),A.publish("hasModifyPcbItem",p),this.data=void 0,p}remove(){let t=pr.getItem(this.gId);t!=null&&t instanceof yi&&(this.data=t.toJSON(),this.number=t.number,A.publish("hasModifyPcbItem",t),t.remove(),A.publish("delete",t))}modify(){let{globalIndex:t,layerId:e,center:r,radius:i,startAngle:n,endAngle:s,sweep:a,width:l,locked:c,net:h,arcType:u}=this.data;r=new S(r.x,r.y);let d=pr.getItem(this.gId),p=d.toJSON();d.layerId!=e&&(d.layerId=e),d.center.equals(r)||(d.center=r),d.radius!=i&&(d.radius=i),d.startAngle!=n&&(d.startAngle=n),d.endAngle!=s&&(d.endAngle=s),d.sweep!=a&&(d.sweep=a),d.width!=l&&(d.width=l),d.locked!=c&&(d.locked=c),d.arcType!=u&&(d.arcType=u),d.net!=h&&(A.publish("hasModifyPcbItem",d),d.net=h),this.data=p,this.modifyGroupID(d),A.publish("hasModifyPcbItem",d)}updateData(){if(this.source==null){let t=pr.getItem(this.gId);t!=null&&(this.source=Sr.getInstance().encode("ARC",t.model))}}upload(t){let e=this.isDelete(t),r=R.getInstance().compiler;r.setTicket(),e?r.deleteArc(this.gId):(this.source==null&&this.updateData(),this.source!=null&&r.uploadArc(this.gId,this.source)),this.source=void 0}};var p4=class extends ro{constructor(t,e){super(),this.gId=t.globalIndex,this.number=e=="delete"?t.number:null,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?Sr.getInstance().encode("PAD",t.model):null;let r=t.getParent();r&&(this.hasParent=!0,this.padNetSource=e=="delete"?Sr.getInstance().encode("PAD_NET",t.model):null,this.padLen=$o.getInstance().getPadLen(r.globalIndex,this.gId)),this.action=e,A.publish("cheakTearDrop",new zf(e,t.toJSON(),t)),this.deleteGroupID(t),le.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",[{id:t.globalIndex,net:t.net,bbox:t.buildBBox()}])}hasConnectChange(){return this.action==="delete"}getConnnectChangeCommand(){return new Hx().getConnectCommands(this.gId)}rebuild(){var x;let{globalIndex:t,partition:e,layerId:r,num:i,center:n,rotation:s,shapes:a,net:l,locked:c,expansionType:h,pasteExpansion:u,topSolderExpansion:d,bottomSolderExpansion:p,unusedInnerLayers:m,plated:g,holeLength:y,holeRadius:b,holeShape:P,holeRotation:T,holeOffset:I,padRule:C}=this.data;n=new S(n.x,n.y),I=new S(I.x,I.y);let E=ge.build2(this.parseShape(a)),O=Qt.rebuildPolygonPad(t,r,i,n,s,E,l,c,h,u,d,p,m,g,y,b,P,T,I,q0.buildByJson(C)),_=(x=O.getParent())==null?void 0:x.globalIndex;return _&&this.padLen!=null&&$o.getInstance().setPadLen(_,O.globalIndex,this.padLen),O.partition=e,O.number=this.number,A.publish("hasModifyPcbItem",O),this.addGroupID(O),this.updateFilterStatus(O),this.updateData(),this.data=void 0,O}getItem(){return Qt.getItem(this.gId)}remove(){let t=Qt.getItem(this.gId);this.data=t.toJSON(),this.number=t.number,t.remove(),A.publish("hasModifyPcbItem",t),A.publish("delete",t),this.updateData()}modify(){var D;let t=Qt.getItem(this.gId),e=t.toJSON();t.removeFill();let{globalIndex:r,layerId:i,num:n,center:s,rotation:a,shapes:l,net:c,locked:h,expansionType:u,pasteExpansion:d,topSolderExpansion:p,bottomSolderExpansion:m,unusedInnerLayers:g,plated:y,holeLength:b,holeRadius:P,holeShape:T,holeRotation:I,holeOffset:C,padRule:E,padLen:O}=this.data;s=new S(s.x,s.y),C=new S(C.x,C.y),t.layerId!=i&&(t.layerId=i),t.num!=n&&(t.num=n),t.padLen!=O&&(t.padLen=O);let _=(D=t.getParent())==null?void 0:D.globalIndex;if(_){let w=$o.getInstance().getPadLen(_,t.globalIndex);this.padLen!=null&&$o.getInstance().setPadLen(_,t.globalIndex,this.padLen),this.padLen=w}t.center.equals(s)||(t.center=s),t.rotation!=a&&(t.rotation=a),t.locked!=h&&(t.locked=h),t.net!=c&&(A.publish("hasModifyPcbItem",t),t.net=c),t.expansion=yu.getPadExpansion(u,d,p,m),t.unusedInnerLayers.toString()!=g.toString()&&(t.unusedInnerLayers=g),t.plated!=y&&(t.plated=y),t.hole&&(t.hole=nc.getHoleStyle(b,P,T,I,C)),t.padRule&&E&&(t.padRule=qh.getPadRule(E.connectMode,E.lineWidth,E.lineClearance,E.lineAngle));let v=this.parseShape(l);t.pl=ge.build2(v),t.fill(),this.data=e,this.modifyGroupID(t),A.publish("hasModifyPcbItem",t),this.updateData()}parseShape(t){let e=new Array;for(let r of t)for(let i in r){let n=r[i];if(i=="LINE"){let s=new S(n.start.x,n.start.y),a=new S(n.end.x,n.end.y),l=new M(s,a);e.push(l)}if(i=="ARC"){let s=new S(n.center.x,n.center.y),a=q.build2(s,n.startAngle,n.endAngle,n.rx,n.rx,n.sweep);e.push(a)}}return e}upload(t=!1){let e=R.getInstance().compiler,r=e.consistencyManager.getMaxTicket();this.isDelete(t)?(this.padNetSource&&(e.setTicket(++r),e.deletePadNet(this.padNetSource.componentId,this.padNetSource.padNum,this.padNetSource.padId)),this.hasParent||(e.setTicket(++r),e.deletePad(this.gId))):(this.source==null&&this.updateData(),this.padNetSource&&(e.setTicket(++r),e.uploadPadNet(this.padNetSource)),!this.hasParent&&this.source&&(e.setTicket(++r),e.uploadPad(this.gId,this.source))),this.padNetSource=void 0,this.source=void 0}updateData(){if(this.source==null||this.padNetSource==null){let t=Qt.getItem(this.gId);if(t!=null){let e=t.getParent();this.source=Sr.getInstance().encode("PAD",t.model),this.padNetSource=e&&Sr.getInstance().encode("PAD_NET",t.model)}}}};var Mn=class extends Dp{constructor(t){super(),this.model=t,t.setModelWatcher(this);let e=new _e;t.template.forEach(i=>{e.ext1(i.bbox())});let r=e.build1();this.templateMatrix=Ae.translate(-r.UL().x,-r.UL().y,0),this.templateHeight=r.height(),this.templateWidth=r.width()}get template(){return this.model.template}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId!=t&&(this.model.layerId=t,this.refreshRender())}get silkColor(){return this.model.silkColor}set silkColor(t){this.model.silkColor=t}get lineColor(){return ee.BLACK}get viewMatrix(){let t=Ae.scale(this.width/this.templateWidth||1,this.height/this.templateHeight||1,1);return this.templateMatrix.multiply4(t).multiply4(this.model.matrix)}get matrix(){return this.viewMatrix}getRealPath(){let t=this.viewMatrix.toMatrix3();return this.template.map(e=>e.multiply3(t))}getPath(){let t=this.viewMatrix,e=this.getTemplatePath();return e.forEach(r=>{r.pl=r.pl.multiply3(t.toMatrix3())}),e}getPathByTemplatePath(t){let e=this.viewMatrix,r=t;return r=r.map(i=>i.clone()),r.forEach(i=>{i.pl=i.pl.multiply3(e.toMatrix3())}),r}getTemplatePath(){let t=this.template.map(i=>i.clone());return new wf("",0,t).pls}hasSameTemplateWith(t){let e=this.template,r=t.template;if(e.length!=r.length)return!1;for(let i=0;i<e.length;i++){let n=e[i],s=r[i];if(!n.equals(s))return!1}return!0}toJSON(){var e;return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,start:this.start,width:this.width,height:this.height,rotation:this.rotation,mirror:this.mirror,locked:this.locked,silkColor:((e=this.silkColor)==null?void 0:e.toString())||null,template:I0(this.template)}}getType(){return 7}get path(){return this.template}get leftLow(){return this.model.box.leftLow}get leftUp(){return this.model.box.leftUp}get rightUp(){return this.model.box.rightUp}get rightLow(){return this.model.box.rightLow}get templateModified(){return this.model.templateModified}getPolygonsPath(t){let e=new Array;return t.forEach(r=>{let i=o1(r);e.push(i)}),e}};var f4=class extends ro{constructor(t,e){super(),this.gId=t.globalIndex,this.number=e=="delete"?t.number:null,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?Sr.getInstance().encode("IMAGE",t.model):null,this.action=e,this.deleteGroupID(t)}rebuild(){let{globalIndex:t,partition:e,layerId:r,start:i,width:n,height:s,rotation:a,mirror:l,locked:c,template:h,silkColor:u}=this.data,d=u?ee.of3(u):null;i=new S(i.x,i.y),h=Jh(h);let p=Bn.rebuild(t,r,i,n,s,a,l,c,h);return p.partition=e,p.number=this.number,A.publish("hasModifyPcbItem",p),this.addGroupID(p),p.silkColor=d,this.updateFilterStatus(p),this.updateData(),this.data=void 0,p}getItem(){return Bn.getItem(this.gId)}remove(){let t=Bn.getItem(this.gId);A.publish("hasModifyPcbItem",t),this.data=t.toJSON(),this.number=t.number,t.remove(),A.publish("delete",t),this.updateData()}modify(){let{layerId:t,start:e,width:r,height:i,rotation:n,mirror:s,locked:a,template:l,silkColor:c}=this.data,h=c?ee.of3(c):null,u=Bn.getItem(this.gId),d=u.toJSON();e=new S(e.x,e.y),u.layerId!=t&&(u.layerId=t),u.width!=r&&(u.width=r),u.height!=i&&(u.height=i),u.start.equals(e)||(u.start=e),u.mirror!=s&&(u.mirror=s),u.rotation!=n&&(u.rotation=n),u.locked!=a&&(u.locked=a),h||(u.silkColor=void 0),h&&u.silkColor!=h&&!u.silkColor.equals(h)&&(u.silkColor=h),this.data=d,this.modifyGroupID(u),A.publish("hasModifyPcbItem",u),this.updateData()}upload(t=!1){let e=this.isDelete(t),r=R.getInstance().compiler;r.setTicket(),e?r.deleteImage(this.gId):(this.source==null&&this.updateData(),this.source!=null&&r.uploadImage(this.gId,this.source)),this.source=null}updateData(){if(this.source==null){let t=Bn.getItem(this.gId);t!=null&&(this.source=Sr.getInstance().encode("IMAGE",t.model))}}};var m4=class extends ro{constructor(t,e){super(),this.gId=t.globalIndex,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?Sr.getInstance().encode("OBJ",t.model):null,this.action=e,this.deleteGroupID(t)}rebuild(){let{globalIndex:t,partition:e,layerId:r,start:i,width:n,height:s,rotation:a,mirror:l,locked:c,hashId:h}=this.data,u=new S(i.x,i.y),d=So.rebuild(t,r,u,n,s,a,l,c,h);return d.partition=e,A.publish("hasModifyPcbItem",d),this.addGroupID(d),this.updateFilterStatus(d),this.updateData(),this.data=void 0,d}getItem(){return So.getItem(this.gId)}remove(){let t=So.getItem(this.gId);this.data=t.toJSON(),A.publish("hasModifyPcbItem",t),t.remove(),A.publish("delete",t),this.updateData()}modify(){let{globalIndex:t,layerId:e,start:r,width:i,height:n,rotation:s,mirror:a,locked:l,hashId:c}=this.data,h=So.getItem(this.gId),u=h.toJSON();r=new S(r.x,r.y),h.layerId!=e&&(h.layerId=e),h.width!=i&&(h.width=i),h.height!=n&&(h.height=n),h.start.equals(r)||(h.start=r),h.mirror!=a&&(h.mirror=a),h.rotation!=s&&(h.rotation=s),h.locked!=l&&(h.locked=l),this.data=u,this.modifyGroupID(h),A.publish("hasModifyPcbItem",h),this.updateData()}upload(t=!1){let e=this.isDelete(t),r=R.getInstance().compiler;r.setTicket(),e?r.deleteObj(this.gId):(this.source==null&&this.updateData(),this.source!=null&&r.uploadObj(this.gId,this.source)),this.source=void 0}updateData(){if(this.source==null){let t=So.getItem(this.gId);t!=null&&(this.source=Sr.getInstance().encode("OBJ",t.model))}}};var g4=class o{constructor(){this.data=new Set}static getInstance(){return o.proxy||(o.proxy=new o),o.proxy}addData(t){this.data.add(t)}upload(){let t=R.getInstance().compiler;this.data.forEach(e=>{t.setTicket();let r=Ze.getInstance().getLayer(e);if(r!=null&&r.type=="PLANE"){let i=Sr.getInstance().encode("INNER",Array.from(Xo.getInstance().layerMapSet[e]));t.uploadLayerFill(e,i)}else t.deleteLayerFill(e)}),this.data.clear()}};var d8=class extends ro{constructor(e,r){super();this.hasCommand=!0;if(this.layerId=e.layerId,le.pcbConfig.isRebuildCopperAuto){this.hasCommand=!1;return}this.gId=e.globalIndex,this.data=r=="add"?void 0:e.toJSON(),this.action=r,this.deleteGroupID(e),le.pcbConfig.realTimeUpdateUnusedLayers&&A.publish("addPreviousBBoxAndNet",[{id:e.globalIndex,net:e.net,bbox:e.buildBBox()}])}rebuild(){if(!this.hasCommand)return;let{globalIndex:e,partition:r,layerId:i,net:n,style:s,copperPath:a}=this.data,l=zn.rebuild(e,i,n,s,a);return l.partition=r,A.publish("hasModifyPcbItem",l),this.addGroupID(l),this.updateData(),this.data=void 0,l}getItem(){return zn.getItem(this.gId)}remove(){if(!this.hasCommand)return;let e=zn.getItem(this.gId);e&&(A.publish("hasModifyPcbItem",e),this.data=e.toJSON(),e.remove(),A.publish("delete",e),this.updateData())}modify(){if(!this.hasCommand)return;let{globalIndex:e,layerId:r,net:i,style:n,copperPath:s}=this.data,a=zn.getItem(this.gId);if(!a)return;let l=a.toJSON();a.net!=i&&(A.publish("hasModifyPcbItem",a),a.net=i),a.style!=n&&(a.style=n),this.data=l,this.modifyGroupID(a),A.publish("hasModifyPcbItem",a),this.updateData()}upload(e=!1){g4.getInstance().addData(this.layerId)}updateData(){}};var hh=class extends ua{constructor(e,r,i,n,s,a,l,c,h,u,d){super();this.restriction=null;this.type="Smart Dimension";this.leftRadius=u,this.rightRadius=d,this.model=new QO(e,"Smart Dimension",r,i,n,s,a,R.getInstance().unit=="mil"?1:3,l,c,R.getInstance().unit,h),this.refreshRender()}get box(){return this.model.text.box}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId=e,this.refreshRender()}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get textPosition(){return this.model.textPosition}get strokeWidth(){return this.model.strokeWidth}get width(){return this.model.strokeWidth}set width(e){this.model.strokeWidth=e,this.refreshRender()}get unit(){return this.model.unit}set unit(e){this.model.unit=e,this.precision=e=="mil"?1:3,this.refreshRender()}get precision(){return this.model.precision}set precision(e){this.model.precision=e,this.refreshRender()}get start(){return this.model.start}set start(e){this.model.calibrateLine([this.start,this.left,this.start,e],!0,!1,0),this.model.start=e,this.refreshRender()}get end(){return this.model.end}set end(e){this.model.calibrateLine([this.end,this.right,this.end,e],!0,!0,1),this.model.end=e,this.refreshRender()}modifyEnd(e){this.model.end=e,this.model.right=e,this.refreshRender()}modifyDimension(e,r){this.model.start=e,this.model.end=r,this.refreshRender()}get length(){let e=this.model.length*10;this.unit!="mil"&&(e=new dt().conversion1("mil",this.unit,e));let r=Math.pow(10,this.precision);return e=Math.round(e*r)/r,e}set length(e){this.model.length=e,this.refreshRender()}set height(e){this.model.fontSize=e,this.refreshRender()}get height(){return this.model.fontSize}set left(e){this.model.calibrateLine([this.right,this.end,this.left,e],!1,!1,2),this.model.left=e,this.refreshRender()}get left(){return this.model.left}set right(e){this.model.calibrateLine([this.left,this.start,this.right,e],!1,!0,3),this.model.right=e,this.refreshRender()}get right(){return this.model.right}setLeftSpotSize(e){this.leftRadius=e,this.refreshRender()}setRightSpotSize(e){this.rightRadius=e,this.refreshRender()}rotateFor(e,r){}transform(e){this.model.transform(e),this.refreshRender()}isSelect(e,r){return this.getParent()!=null?!1:this.model.inShape(e,r)}buildBBox(){return this.model.buildBBox()}getLineBBox(){return Ik(this.start,this.end,this.left,this.right,this.strokeWidth,this.lineLen,this.arrLineLen)}updateText(){this.model.updateText()}toJSON(){var r;return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,start:this.start,end:this.end,precision:this.precision,height:this.height,width:this.width,unit:this.unit,locked:this.locked,leftPoint:this.left,rightPoint:this.right,leftSpotSize:this.leftRadius,rightSpotSize:this.rightRadius,silkColor:((r=this.silkColor)==null?void 0:r.toString())||null}}getType(){return 5}get textPath(){return this.model.text.outline}get textMatrix(){return this.model.text.matrix}get viewWidth(){return this.model.text.width}get viewHeight(){return this.model.text.height}get lineLen(){return 1.2}get arrLineLen(){return .8}get highlightColor(){return ee.BLACK}set highlightColor(e){}get Type(){return"smartDimension"}get leftCenter(){return this.left}get rightCenter(){return this.right}get outlineModified(){return this.model.text.outlineModified}refreshRender(){Mo.attach(this,this.getType())}flip(e){}};var Ps=class extends Dp{constructor(t){super(),this.model=t,t.setModelWatcher(this)}needMirror(){return oc(this.layerId,this.mirror)}get hashId(){return this.model.hashId}set hashId(t){qd.getItem(t)!=null&&(this.model.hashId=t,this.refreshRender())}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId!=t&&(this.model.layerId=t,this.refreshRender())}get source(){return qd.getItem(this.hashId).source}get leftDown(){return this.model.box.leftLow}get leftUp(){return this.model.box.leftUp}get rightDown(){return this.model.box.rightLow}get rightUp(){return this.model.box.rightUp}get alpha(){var r,i;let t=.5,e=(i=(r=le)==null?void 0:r.themeConfig)==null?void 0:i.canvasTheme;return e&&(t=1-e.colorfulImageTransparency),t=Mt.getTransparencyByPcbType(this,void 0,t),t}get hashIdModified(){return this.model.hashIdModified}toJSON(){return{globalIndex:this.globalIndex,partition:this.partition,layerId:this.layerId,start:this.start,width:this.width,height:this.height,rotation:this.rotation,mirror:this.mirror,locked:this.locked,hashId:this.hashId}}getType(){return 11}};var Zre=class extends ro{constructor(e,r){super();this.dataMap=new Map;this.hasCommand=!0;if(this.parentGId=e[0].layerId,le.pcbConfig.isRebuildCopperAuto){this.hasCommand=!1;return}this.action=r,r=="add"||e.forEach(i=>{this.dataMap.set(i.globalIndex,i.toJSON())})}rebuild(){this.hasCommand&&this.do()}do(){let e=Array.from(zn.layerMapSet[this.parentGId]||[]),r=new Map;e.forEach(i=>{r.set(i.globalIndex,i.toJSON()),A.publish("hasModifyPcbItem",i),i.remove(),A.publish("delete",i),this.updateData()});for(let[,i]of this.dataMap){let{globalIndex:n,partition:s,layerId:a,net:l,style:c,copperPath:h}=i,u=zn.rebuild(n,a,l,c,h);u.partition=s,this.modifyGroupID(u),A.publish("hasModifyPcbItem",u),this.updateData()}this.dataMap=r}remove(){this.hasCommand&&this.do()}modify(){this.hasCommand&&this.do()}getItem(){return"ignore"}upload(e){let r=R.getInstance().compiler,i=zn.layerMapSet[this.parentGId];if(r.setTicket(),i){let n=Sr.getInstance().encode("INNER",Array.from(i));r.uploadLayerFill(this.parentGId,n)}else r.deleteLayerFill(this.parentGId)}updateData(){}};var _0="default",Jre=class extends ro{constructor(t,e){super(),this.netName=t.name,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?Sr.getInstance().encode("RULE_SELECTOR",t):null,this.action=e}rebuild(){let{name:t,safeSpacing:e,trackPhysics:r,differentialPhysics:i,netLengthPhysics:n,netLengthTolerancePhysics:s,blindViaPhysics:a,radiusPhysics:l,innerPlane:c,copperPlane:h,solderExpansion:u,pasteExpansion:d,netClassName:p,equalLengthGroupName:m,netDifferentialName:g,targetNet:y}=this.data;this.preCheck();let b=re.getInstance().rebuild(this.data);y&&(b.targetNet=y),p&&re.getInstance().getNetClass(p).addNetwork(b),m&&re.getInstance().getEqualLengthGroup(m).addNetwork(b),g&&R.getInstance().compiler.uploadNet(this.netName,Sr.getInstance().encode("NET",b)),this.data=void 0}remove(){let t=re.getInstance().getNet(this.netName);t!=null&&(this.data=t.toJSON(),re.getInstance().deleteNet(t.name,!1))}preCheck(){var g,y,b,P,T,I,C,E,O,_,x;let{safeSpacing:t,trackPhysics:e,differentialPhysics:r,netLengthPhysics:i,netLengthTolerancePhysics:n,blindViaPhysics:s,radiusPhysics:a,innerPlane:l,copperPlane:c,solderExpansion:h,pasteExpansion:u,netClassName:d,equalLengthGroupName:p,netDifferentialName:m}=this.data;t!==_0&&(this.data.safeSpacing=((g=re.getInstance().getSafeSpacing(t))==null?void 0:g.name)||_0),e!==_0&&(this.data.trackPhysics=((y=re.getInstance().getTrackPhysics(e))==null?void 0:y.name)||_0),r!==_0&&(this.data.differentialPhysics=((b=re.getInstance().getDifferentialPhysics(r))==null?void 0:b.name)||_0),i!==_0&&(this.data.netLengthPhysics=((P=re.getInstance().getNetLengthPhysics(i))==null?void 0:P.name)||_0),n!==_0&&(this.data.netLengthTolerancePhysics=((T=re.getInstance().getNetLengthTolerancePhysics(n))==null?void 0:T.name)||_0),s!==_0&&(this.data.blindViaPhysics=((I=re.getInstance().getBlindPhysics(s))==null?void 0:I.name)||_0),a!==_0&&(this.data.radiusPhysics=((C=re.getInstance().getRadiusPhysics(a))==null?void 0:C.name)||_0),l!==_0&&(this.data.innerPlane=((E=re.getInstance().getInnerPlane(l))==null?void 0:E.name)||_0),c!==_0&&(this.data.copperPlane=((O=re.getInstance().getCopperPlane(c))==null?void 0:O.name)||_0),h!==_0&&(this.data.solderExpansion=((_=re.getInstance().getSolderExpansion(h))==null?void 0:_.name)||_0),u!==_0&&(this.data.pasteExpansion=((x=re.getInstance().getPasteExpansion(u))==null?void 0:x.name)||_0),d&&re.getInstance().getNetClass(d)==null&&re.getInstance().addNetClass(d),p&&re.getInstance().getEqualLengthGroup(p)==null&&re.getInstance().addEqualLengthGroup(p),m&&re.getInstance().getNetDifferential(m)==null&&re.getInstance().addNetDifferential(m)}modify(){}getItem(){return"ignore"}upload(t){let e=this.isDelete(t),r=R.getInstance().compiler;r.setTicket(),e?r.deleteRuleSelector(["NET",this.netName]):(this.source==null&&this.updateData(),r.uploadRuleSelector(this.source)),this.source=void 0}updateData(){if(this.source==null){let t=re.getInstance().getNet(this.netName);t!=null&&(this.source=Sr.getInstance().encode("RULE_SELECTOR",t))}}};var Qre=class extends ro{constructor(t,e){super(),this.ruleName=t.name,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?Sr.getInstance().encode("RULE_SELECTOR",t):null,this.action=e}rebuild(){if(this.data){let{name:t,safeSpacing:e,trackPhysics:r,differentialPhysics:i,netLengthPhysics:n,netLengthTolerancePhysics:s,blindViaPhysics:a,radiusPhysics:l,innerPlane:c,copperPlane:h,solderExpansion:u,pasteExpansion:d,targetNet:p,nets:m,creepageSpacing:g}=this.data,y=new $h(t,e,r,i,n,s,a,l,c,h,u,d,g,m);y.targetNet=p,re.getInstance().addNetClass(t,y)}}modify(){}remove(){let t=re.getInstance().getNetClass(this.ruleName);t&&t.getNets().size===0&&(this.data=t.toJSON(),re.getInstance().deleteNetClass(t.name))}getItem(){return"ignore"}upload(t){let e=this.isDelete(t),r=R.getInstance().compiler;r.setTicket(),e?r.deleteRuleSelector(["NET_CLASS",this.ruleName]):(this.source==null&&this.updateData(),r.uploadRuleSelector(this.source)),this.source=void 0}updateData(){if(this.source==null){let t=re.getInstance().getNetClass(this.ruleName);t!=null&&(this.source=Sr.getInstance().encode("RULE_SELECTOR",t))}}};var eie=class extends ro{constructor(t,e){super(),this.ruleName=t.name,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?Sr.getInstance().encode("RULE_SELECTOR",t):null,this.action=e}rebuild(){if(this.data){let{name:t,safeSpacing:e,trackPhysics:r,differentialPhysics:i,netLengthPhysics:n,netLengthTolerancePhysics:s,blindViaPhysics:a,radiusPhysics:l,innerPlane:c,copperPlane:h,solderExpansion:u,pasteExpansion:d,targetNet:p,nets:m,creepageSpacing:g}=this.data,y=new dd(t,e,r,i,n,s,a,l,c,h,u,d,g,m);y.targetNet=p,re.getInstance().addEqualLengthGroup(t,y)}}modify(){}remove(){let t=re.getInstance().getEqualLengthGroup(this.ruleName);t&&t.getAllNets().length===0&&(this.data=t.toJSON(),re.getInstance().deleteEqualLengthGroup(t.name))}getItem(){return"ignore"}upload(t){let e=this.isDelete(t),r=R.getInstance().compiler;r.setTicket(),e?r.deleteRuleSelector(["EQ_LEN_GRP",this.ruleName]):(this.source==null&&this.updateData(),r.uploadRuleSelector(this.source)),this.source=void 0}updateData(){if(this.source==null){let t=re.getInstance().getEqualLengthGroup(this.ruleName);t!=null&&(this.source=Sr.getInstance().encode("RULE_SELECTOR",t))}}};var tie=class extends ro{constructor(t,e){super(),this.ruleName=t.name,this.data=e=="add"?void 0:t.toJSON(),this.source=e=="delete"?Sr.getInstance().encode("RULE_SELECTOR",t):null,this.action=e}rebuild(){let{name:t,positiveNet:e,negativeNet:r,differentialPhysics:i}=this.data;re.getInstance().addNetDifferential(t,e,r,i)}remove(){let t=re.getInstance().getNetDifferential(this.ruleName);t&&(this.data=t.toJSON(),re.getInstance().deleteNetDifferential([this.ruleName]))}modify(){}getItem(){return"ignore"}upload(t){let e=this.isDelete(t),r=R.getInstance().compiler;r.setTicket(),e?r.deleteRuleSelector(["DIFF_PAIR",this.ruleName]):(this.source==null&&this.updateData(),r.uploadRuleSelector(this.source)),this.source=void 0}updateData(){if(this.source==null){let t=re.getInstance().getNetDifferential(this.ruleName);t!=null&&(this.source=Sr.getInstance().encode("RULE_SELECTOR",t))}}};var gS=class o{constructor(){this.flag=!1}static getInstance(){return o.proxy||(o.proxy=new o),o.proxy}modify(){this.flag=!0}upload(){if(this.flag){let t=R.getInstance().compiler,e=us.getInstance().board;if(t.setTicket(),e){let r=Sr.getInstance().encode("BOARD",e.model);c3("","Board",r)}else h3("","Board");this.flag=!1}}};var p8=class extends tT{rebuildPolygon(t,e,r,i,n,s,a,l){let c=new Ep(t,e,r,[],n,"",!1,null,null),h=new lt(c,[]);return h.setChildrens(i),us.getInstance().board=h,h}getItem(){let t=us.getInstance().board;return t instanceof lt?t:null}upload(t=!1){gS.getInstance().modify()}};var f8=class extends hA{rebuildRect(t,e,r,i,n,s,a,l,c,h,u,d){let p=new Sp(t,e,r,i,n,s,h,u,a,c,l,d,null),m=new rr(p);return us.getInstance().board=m,m}getItem(){let t=us.getInstance().board;return t instanceof rr?t:null}upload(t=!1){gS.getInstance().modify()}};var m8=class extends cA{rebuildCircle(t,e,r,i,n,s,a,l,c){let h=new Ip(t,e,r,i,n,s,a,l,c,null),u=new Pr(h);return us.getInstance().board=u,u}getItem(){let t=us.getInstance().board;return t instanceof Pr?t:null}upload(t=!1){gS.getInstance().modify()}};function jf(o,t){return o instanceof t}var Ce=class{static dispatch(t,e){if(jf(t,qs))return new JM(t,e);if(jf(t,hh))return new BP(t,e);if(jf(t,_i)||jf(t,sn))return jf(t,_i)?new QM(t,e):new p4(t,e);if(jf(t,Pr))return t.type=="Board"?new m8(t,e):new cA(t,e);if(jf(t,Ga))return new t4(t,e);if(jf(t,rr))return t.type=="Board"?new f8(t,e):new hA(t,e);if(jf(t,lr))return new r4(t,e);if(jf(t,Ir))return new i4(t,e);if(jf(t,yi))return new d4(t,e);if(jf(t,Ue))return new n4(t,e);if(jf(t,qc))return new ej([t],e);if(jf(t,da))return new l4(t,e);if(jf(t,lt))return t.type=="Board"?new p8(t,e):new tT(t,e);if(jf(t,ke))return new Rb(t,e);if(jf(t,Mn))return new f4(t,e);if(jf(t,Ps))return new m4(t,e);if(jf(t,Gi))return new d8(t,e);if(jf(t,Jr))return le.pcbConfig.isRebuildCopperAuto?void 0:new Wx(t,e);if("net"in t&&"layer"in t)throw new Error("this primitive is not supported!!")}static dispatchCoppers(t,e,r){t.type=="Copper Region"&&r.addCommand(new I3(t,e))}static dispatchPlanezones(t,e,r){r.addCommand(new Zre(t,e))}static disPatchRule(t,e){let r;return t instanceof zd?r=new Jre(t,e):t instanceof $h?r=new Qre(t,e):t instanceof dd?r=new eie(t,e):t instanceof bb&&(r=new tie(t,e)),r}static getManager(t){return t instanceof i4||t instanceof d4?pr:t instanceof QM?Qt:t instanceof n4?Wr:t instanceof cA?Kt:t instanceof hA?Xt:t instanceof r4?ri:t instanceof t4?os:t instanceof JM||t instanceof BP?Yo:t instanceof l4?jo:t instanceof Rb?Ar:t instanceof tT?pt:t instanceof p4?Qt:t instanceof f4?Bn:t instanceof m4?So:null}};var cr=class{constructor(t,e,r,i,n=ee.BLACK,s=2,a=3){this.globalIndex=Lh();this.state="Only Main";this._manualHighLight=null;this.viewGroupId="";this._layerId=t,this._start=e,this._end=r,this._isSolid=i,this._color=n,this._gap=s,this._len=a,this.refreshRender()}get start(){return this._start}set start(t){this._start=t,this.refreshRender()}get end(){return this._end}set end(t){this._end=t,this.refreshRender()}set color(t){this._color=t,this.refreshRender()}get color(){return this._color}get isSolid(){return this._isSolid}set isSolid(t){this._isSolid=t,this.refreshRender()}get layerId(){return this._layerId}set layerId(t){this._layerId=t}get width(){return 0}set width(t){}get length(){return this._start.distance1(this._end)}get len(){return this._len}get gap(){return this._gap}get isEmpty(){return!1}transform(t){this.start=this.start.multiply4(t),this.end=this.end.multiply4(t)}visible(){this.state="Only Main",this.refreshRender()}click(){this.state="Main And Highlight",this.refreshRender()}remove(){this.state="Not Shown",this.refreshRender()}getType(){return 29}refreshRender(){Mo.attach(this,this.getType())}getViewState(){return this.state}set manualHighLight(t){this._manualHighLight=t}getRenderData(){var h,u;let t=(u=(h=le)==null?void 0:h.themeConfig)==null?void 0:u.canvasTheme,e=ee.BLACK;if(t){let d=t.hoverHighlightColor,p=t.hoverHighlightTransparency;e=ee.build(d.r,d.g,d.b,1-p)}let{layerId:r,color:i,isSolid:n,state:s,gap:a,len:l}=this,c=[[this.start,this.end]];return{layerId:r,segments:c,color:i,gap:a,len:l,isSolid:n,highlightColor:e,highLightType:null,manualHighLight:this._manualHighLight==null?R.getInstance().forceDeactive:this._manualHighLight}}getMathGraphics(){return new M(this._start,this._end).stroke(this.width,wr.ROUND,ae.CW)}hidden(){this.state="Not Shown",this.refreshRender()}buildBBox(){return new M(this._start,this._end).bbox()}};var hCe=class{constructor(){this.line1=null;this.line2=null}getTimer(){return this.timer}setTimer(t){this.timer=t}show(t){let e=le.themeConfig.canvasTheme,r=e.isSolidLine(e.cursorLineStyle),i=e.cursorColor,n=this.computeLength(new S(0,0)),s=this.computeLength(new S(0,-Ai().getHeight())),a=this.computeLength(new S(Ai().getWidth(),0));this.line1==null?this.line1=new cr(1002,new S(t.x,n.y),new S(t.x,s.y),r,i):(this.line1.start=new S(t.x,n.y),this.line1.end=new S(t.x,s.y)),this.line2==null?this.line2=new cr(1002,new S(n.x,t.y),new S(a.x,t.y),r,i):(this.line2.start=new S(n.x,t.y),this.line2.end=new S(a.x,t.y))}click(){this.line1!=null&&this.line1.click(),this.line2!=null&&this.line2.click()}visible(){this.line1!=null&&this.line1.visible(),this.line2!=null&&this.line2.visible()}remove(){this.line1!=null&&(this.line1.remove(),this.line1=null),this.line2!=null&&(this.line2.remove(),this.line2=null)}computeLength(t){let e=new S(Ai().getWidth()/2,-Ai().getHeight()/2);return t.sub(e).multiply4(Ai().get2dCameraMatrix().inverse())}},ql=new hCe;var ho=class{constructor(t){this._nums=[];this.push(t)}push(t){if(t)if(t instanceof Array)this._nums.push(...t);else{if(isNaN(t))return;this._nums.push(t)}}pop(){return this._nums.pop()}clear(){this._nums.length=0}get total(){let t=0;return this._nums.forEach(e=>t+=e),t}get size(){return this._nums.length}get average(){return this.total/this.size}get max(){return Math.max(...this._nums)}get min(){return Math.min(...this._nums)}};var Zx=class{constructor(t){this.type=t}};var e0=class o extends Zx{constructor(e,r,i){super(1);this.title="Warning";this.msg=e,this.cb=r,this.cbCancel=i}equal(e){return e instanceof o&&this.type==e.type&&this.msg==e.msg}open(e){return{type:this.type,option:{msg:this.msg,title:this.title,textOK:"Yes",textCancel:"No"},extra:{}}}close(e){let r=e.action;r=="confirm"&&this.cb(),(r=="cancel"||r=="close"||r==null||e==null)&&this.cbCancel&&this.cbCancel()}};var rie=class{checkInFrameInner2(t,e){let r=pt.getAllItem(),i=Xt.getAllItem(),n=Kt.getAllItem(),s=new Array,a=new Array;t.forEach(p=>{let m=p.getMathGraphics(p.layerId,0);a.push(m)});let l=new Set,c=a.length,h=new Array;for(let p=0;p<c;p++){let m=a[p];if(l.has(p))continue;let g=m.bbox(),y=g.area();for(let b=p+1;b<c;b++){let P=a[b];if(l.has(b))continue;let T=P.bbox(),I=g.intersection1(T);if(I!=null&&I.area()>=Math.min(T.area(),y)){let C=new As(m,P,0);C.relation==1?l.add(b):C.relation==2&&l.add(p)}}}r.forEach(p=>{if(p.layerId==11&&t.indexOf(p)<0&&p.getParent()==null&&(e==null||e!=null&&!e.has(p))){let m=p.getMathGraphics(p.layerId,0);p.isClose()&&(m=m.closeEndpoint()),h.push(m);let g=m.bbox(),y=g.area();for(let b=0;b<c;b++){if(l.has(b))continue;let P=a[b],T=P.bbox(),I=g.intersection1(T);if(I!=null&&I.area()>=Math.min(T.area(),y)){let C=new As(m,P,0);if(C.relation==1)l.add(b);else if(C.relation==2){s.push(p);return}}}}}),i.forEach(p=>{if(p.layerId==11&&t.indexOf(p)<0&&p.getParent()==null&&(e==null||e!=null&&!e.has(p))){let m=p.getMathGraphics(p.layerId,0);h.push(m);let g=m.bbox(),y=g.area();for(let b=0;b<c;b++){if(l.has(b))continue;let P=a[b],T=P.bbox(),I=g.intersection1(T);if(I!=null&&I.area()>=Math.min(T.area(),y)){let C=new As(m,P,0);if(C.relation==1)l.add(b);else if(C.relation==2){s.push(p);return}}}}}),n.forEach(p=>{if(p.layerId==11&&t.indexOf(p)<0&&p.getParent()==null&&(e==null||e!=null&&!e.has(p))){let m=p.getMathGraphics(p.layerId,0);h.push(m);let g=m.bbox(),y=g.area();for(let b=0,P=a.length;b<P;b++){if(l.has(b))continue;let T=a[b],I=T.bbox(),C=g.intersection1(I);if(C!=null&&C.area()>=Math.min(I.area(),y)){let E=new As(m,T,0);if(E.relation==1)l.add(b);else if(E.relation==2){s.push(p);return}}}}});let u=new _e,d=new Array;for(let p of h)u.ext1(p.bbox()),xe.addAll(d,p.primitives);if(u.valid()){let p=u.build1().extendOfSize(5),g=new $c(p,1,.1,new Di(4),d).detect();for(let y of g.items){let b=y.bbox(),P=b.area();if(!(P>p.area()))for(let T=0;T<c;T++){if(l.has(T))continue;let I=a[T],C=I.bbox(),E=b.intersection1(C);E!=null&&E.area()>=Math.min(C.area(),P)&&new As(y,I,0).relation==1&&l.add(T)}}}for(let p of l)s.push(t[p]);return s}};function TI(o){let t=new MP(!1),e=new iI(FO,new Di(4),t);for(let i of o)nh(i)||(i=i.reverse().asClose()),e.addPolyline(i.asClose());e.simplify();let r=[];for(let i of t.plGrps)Er(i.items,t3t,0,i.items.length),r.push(i.items[0]);return r}var t3t=function(o,t){return t.bbox().area()-o.bbox().area()};var Po=class{plGrpsToShapes(t,e=1,r=1,i=!1){return this.plsToShapes(t.items,e,r,i)}plsToShapes(t,e=1,r=1,i=!1){let n=new Array;for(let s of t)n.push(this.plToShapes(s,e,r,i));return n}plToShapes(t,e=1,r=1,i=!1){return this.ptsToShapes(t.primitives,e,r,i)}ptsToShapes(t,e=1,r=1,i=!1){let n=new Array;for(let s of t)n.push(this.ptToShape(s,e,r,i));return n}ptToShape(t,e=1,r=1,i=!1){if(t instanceof M)return Cu.add(e,t.start(),t.end(),r,i);if(t instanceof q){let n=zt.toRadians(t.startAngle),s=zt.toRadians(t.endAngle());return Yc.addArc(e,t.center,t.rx,r,n,s,t.sweep(),i)}else throw new Error("not surpport!!!")}clone4(t){let e=t.clone();return e.globalIndex=nr(),e.modelType=="Line"?Cu.addByModel(e):Yc.addArcByModel(e)}clone4Shape(t,e=1,r=1,i=!1){if(t instanceof M)return Cu.add(e,t.start(),t.end(),r,i);if(t instanceof q){let n=zt.toRadians(t.startAngle),s=zt.toRadians(t.endAngle());return Yc.addArc(e,t.center,t.rx,r,n,s,t.sweep(),i)}}addLine(t,e,r=1,i=1,n=!1){return Cu.add(r,t,e,i,n)}};var Mh=class{constructor(){this.fac=new Po}create4Pt(t,e,r,i,n,s){let a=this.fac.ptToShape(r,e,i,s);return pt.addPolygon(t,e,[[a]],i,n,s)}create4Pts(t,e,r,i,n,s){let a=this.fac.ptsToShapes(r,e,i,s);return pt.addPolygon(t,e,[a],i,n,s)}create4Pl(t,e,r,i,n,s){let a=this.fac.ptsToShapes(r.primitives,e,i,s);return pt.addPolygon(t,e,[a],i,n,s)}create4Pls(t,e,r,i,n,s){let a=this.fac.plsToShapes(r,e,i,s);return pt.addPolygon(t,e,a,i,n,s)}create4PlGrp(t,e,r,i,n,s){return this.create4Pls(t,e,r.items,i,n,s)}};var hi=class{constructor(){this.command=null;this.items=new Array;this.needUndo=!1}getCommand(){return this.command}createGroup(t){return this.command==null&&(this.command=new De(t)),this}addGroup(t){return this.command==null&&(this.command=t),this}addCommand4Item(t,e){let r=Ce.dispatch(t,e);if(!(t instanceof Jr)&&r==null)throw new Error("input shape error!!!");return A.publish("hasModifyPcbItem",t),this.addCommand(r)}addCommand(t){return this.command!=null&&this.command.addCommand(t),this}undo(t=!0){this.command!=null&&(this.command.undo(),this.command=null),t&&A.publish("flushService",""),A.publish("flushSelectingInfo","")}execute(){this.command!=null&&this.command.length>0&&(qe.executeCommand(this.command),this.command=null,A.publish("flushService",""))}conver2Slot(t){for(let e of t)if(this.inBoardOutline(e))if(e instanceof lt&&!e.isClose()){this.addCommand4Item(e,"delete");for(let r of e.getChildrens()){let i=r.map(s=>s.getMathGraphics());r.length>1&&(i=TI(i));let n=new Mh;i.forEach(s=>{let a=n.create4Pl("Slot Region",12,s,e.strokeWidth,"",e.locked);a.fill(),this.addCommand4Item(a,"add")})}e.remove(),A.publish("delete",e)}else this.addCommand4Item(e,"modify"),e.type="Slot Region",e.fill();return this}getInnerOutlines(t,e){let r=t.filter(i=>this.inBoardOutline(i));return r.length?new rie().checkInFrameInner2(r,e):[]}checkOutlines(t,e=new Set){this.execute(),this.checkOutlinesNoExecute(t,e)}checkOutlinesNoExecute(t,e){let r=this.getInnerOutlines(t,e);if(r.length>0){let n=['<span class="i18n">Board outline are placed inside the board outline detected, Suggesting convert the internal board outline to slot region\uFF1A</span>'];for(let s=0;s<r.length;s++){let a={text:`${Tr}${r[s].number}`,attr:{pcbId:R.getInstance().tabId,id:r[s].globalIndex}};n.push(a,"\uFF0C")}n.pop(),A.publish("logPublishProxy",{type:"info",msg:n},Q())}}openMsgBox(t){A.publish("clearSelect",""),this.highlightAndCenter(t);let e=new e0("Board outline are not allowed to be placed inside the board outline, do you want to  convert the internal highlight primitive to slot region?",()=>{this.conver2Slot(t),this.execute()},()=>{this.undo()});A.publish("openMsgbox",e)}highlightAndCenter(t){let e=new _e;for(let r of t)r.click(),e.ext1(r.buildBBox());if(A.publish("onlySelect",t),gr.model=3,e.valid()){let r=e.build1(),i=Jx();if(r.isInside(i)){let s=R.getInstance().openRuler?40:20,a=ht.extend4(r.center(),window.innerWidth-s,window.innerHeight-s);A.publish("adaptBBox",[a,Ai().getScale()])}else A.publish("adaptBBox",r)}}inBoardOutline(t){return!t.isEmpty&&t instanceof He&&(t.type=="Board Outline"||t.type=="Line"&&t.layerId==11)}};function Br(o,t){return gn(nn.convert(o,t,Pl.unit)||0,5)}function dCe(o,t){return gn(nn.convert(o,Pl.unit,t)||0,5)}var Pl=class{constructor(t,e){this.config={StencilThickness:Br(.12,39.37),StencilThicknessMultiple:3.5,FillHeight:65,DefaultSolderMaskExpansion:Br(.0508,39.37),DefaultTrackSpacing:Br(.15,39.37),DefaultStrokeWidth:Br(.1524,39.37),DefaultVIAHoleRadius:Br(.15,39.37),DefaultVIADiameter:Br(.6,39.37),DefaultVIAthermalPadSpacing:Br(1,39.37),LEADCUTOUTOVERLAP:Br(.01,39.37)};this.shapes=[];this._bbox=null;this.firstPinDesigner="1";this._firstPinPosition=null;this._firstPinBBox=null;this._origin=S.ORIGIN;this.historyGroup=null;this.pads=[];this.modelName=t,this.defaultOptions=Object.assign({},this.defaultOptions,e),this.currentOptions=this.defaultOptions}unitConvert(t,e){return Br(t,e)}unitReverse(t,e){return dCe(t,e)}fixOptions(t,e=!0){this.currentOptions=Object.assign({},this.defaultOptions,t,this.fixedOptions),e&&this.fixWidth2Height(this.currentOptions),["pinDiameter","bodyLength","bodyWidth"].forEach(i=>{let n=this.currentOptions[i];!Object.is(n,void 0)&&!(n instanceof ho)&&(this.currentOptions[i]=new ho(n))});for(let i in this.currentOptions)Array.isArray(this.currentOptions[i])&&(this.currentOptions[i]=new ho(this.currentOptions[i]).average);return this.currentOptions}fixWidth2Height(t){let e=["BGA","ChipArray","SOIC_SOP","SOT23","SOT223","TO-DPAK"],r=t.bodyWidth,i=t.bodyLength,n=t.packageName;r&&i&&e.indexOf(n)>-1&&(t.bodyWidth=i,t.bodyLength=r)}get bbox(){return this._bbox||this.updateBBox()}get firstPinPosition(){var t;return this._firstPinPosition=this._firstPinPosition||((t=this.getPinPosition(1))==null?void 0:t.center)||S.ORIGIN,this._firstPinPosition}get firstPinBBox(){var t;return this._firstPinBBox=this._firstPinBBox||((t=this.getPinPosition(1))==null?void 0:t.buildBBox())||new ht(0,0,0,0),this._firstPinBBox}get packageName(){return this.currentOptions.packageName||this.modelName}updateBBox(t){if(t)return this._bbox=t,t;let e=new _e;return this.shapes.forEach(r=>{e.ext1(r.buildBBox())}),this._bbox=e.build1(),this._bbox}resetShape(t=!1){this.shapes.length=0,(t||!this.historyGroup)&&(this.historyGroup=new hi,this.historyGroup.createGroup("footprint-generate"))}getPinPosition(t){let e=t==1,r=null,i=new _e,n=this.shapes;for(let a of n)if(a instanceof _i){if(r||(r=a),e&&a.num===this.firstPinDesigner)return this._origin=a.center,a;i.ext2(a.center)}let s=e?r&&r.center||null:i.build1().center();return e&&(this._firstPinPosition=s),this._origin=e?r.center:s,e?r:s}autoShowLayer(t){Pe.layerMap[t]||console.warn("this layerId has not been created!",t)}createPad(t,e=!0){var I,C;let r=this.currentOptions;t=Object.assign({net:"",rotation:0,spin:!1,padShape:r.padShape},t,{pasteMaskEx:null,topSolderMaskEx:null,bottomSolderMaskEx:null});let{location:i,designator:n,layer:s,net:a,pasteMaskEx:l,topSolderMaskEx:c,bottomSolderMaskEx:h,rotation:u,spin:d,padShape:p}=t,m=((I=r.pinDiameter)==null?void 0:I.average)||r.pinWidth,g=((C=r.pinDiameter)==null?void 0:C.average)||r.pinHeight,y=r.padExpansion,b=t.padSizeInfo||this.getCommonPadSize(m,g,y,d),P=0,T=Qt.addPad(s,1,n,i,p,b.padWidth,b.padHeight,P,p,b.padWidth,b.padHeight,P,p,b.padWidth,b.padHeight,P,u,!1,a,1,l,c,h,[],!0,b.holeWidth,b.holeHeight/2,"ROUND",0,ut.defalutPad.holeOffset);return e&&this.shapes.push(T),T}addThermalPad(t,e){let r=this.currentOptions.thermalPad,i=r==null?void 0:r.thermalPadWidth,n=r==null?void 0:r.thermalPadHeight;if(!i||!n)return;let s=this.getCommonPadSize(i,n,0,!1),a=this.bbox.center();if(r.hasThermalVias!=="0"&&r.hasThermalVias){let l={viaDiameter:this.config.DefaultVIADiameter,viaSPacing:this.config.DefaultVIAthermalPadSpacing,vaiHoleRadius:this.config.DefaultVIAHoleRadius},{viaDiameter:c,viaSPacing:h,vaiHoleRadius:u}=Object.assign({},l,e),d=c+h,p=Math.floor(n/d),m=Math.floor(i/d),g=a.add1(-(m-1)*h/2,(p-1)*h/2);if(p>0&&m>0)for(let y=0;y<p;y++)for(let b=0;b<m;b++){let P=Wr.addVia(0,"",1,2,"",c/2,g.add1(b*h,-y*h),u,!1,1,0,0);this.shapes.push(P)}}return this.createPad({location:a,designator:t,layer:1,padSizeInfo:s,padShape:"RECT"})}addLine(t){return this.autoShowLayer(t.layer),this.addPolygon({lineType:"Line",layer:t.layer,outline:ge.build4([t.start,t.end]),width:t.width,net:t.net,locked:t.locked})}addArc(t){return this.addPolygon({lineType:"Line",layer:t.layer,outline:ge.build2([q.build2(t.center,t.startAngle,t.endAngle,t.radius,t.radius,t.sweep)]),width:t.width,net:t.net,locked:t.locked})}addArcByArc(t){let e=t.arc;return this.addArc({layer:t.layer,width:t.width,locked:t.locked,center:e.center,radius:e.rx,startAngle:e.startAngle,endAngle:e.endAngle(),sweep:e.sweep()})}addConnectRelatedId(t,e){if(!(t&&e))return;t.component instanceof Zi&&(t.component.padId=e),La.getInstance().addConnectRelatedId(e,t.globalIndex);let r=Ce.dispatch(t,"modify")}addCicle(t){this.autoShowLayer(t.layer);let e=Kt.addCircle(t.lineType,t.layer,t.center,t.radius,t.width,!!t.locked,t.net||"");return e.fill(),A.publish("hasModifyPcbItem",e),e}addPolygon(t){this.autoShowLayer(t.layer);let e=this.config.DefaultStrokeWidth;if(t.outline.primitives.length==0)return null;Bu(t.lineType)&&(t.outline=t.outline.asClose());let i=new Mh().create4Pl(t.lineType,t.layer,t.outline,t.width||e,t.net||"",!!t.locked);return i.fill(),A.publish("hasModifyPcbItem",i),i}buildBodySilk(t=this.bbox,e=this.config.DefaultStrokeWidth,r){if(this.currentOptions.bodyDiameter>0)return this.buildCircleBodySilk(t,e);let n=t.extendSize(e),s=3;r=r||[];let a=r.includes("T")?null:this.addLine({layer:s,start:n.UL(),end:n.UR(),width:e}),l=r.includes("R")?null:this.addLine({layer:s,start:n.UR(),end:n.LR(),width:e}),c=r.includes("B")?null:this.addLine({layer:s,start:n.LR(),end:n.LL(),width:e}),h=r.includes("L")?null:this.addLine({layer:s,start:n.LL(),end:n.UL(),width:e});return[a,l,c,h].forEach(u=>u&&this.shapes.push(u)),this.trackBBox=n,n}buildCircleBodySilk(t=this.bbox,e=this.config.DefaultStrokeWidth){let r=t.center(),n=t.width()/2+e/2,s=this.addCicle({lineType:"Line",net:"",layer:3,center:r,radius:n,width:e,locked:!1});return this.shapes.push(s),s.buildBBox()}buildConerSilk(t=this.bbox,e,r){let i=3;e=e||this.config.DefaultStrokeWidth,r=r||this.unitConvert(.5,39.37);let n=e/2,s=t.UL().add1(-n,n),a=this.addLine({layer:i,start:s,end:s.add1(r,0),width:e}),l=this.addLine({layer:i,start:s,end:s.add1(0,-r),width:e});s=t.UR().add1(n,n);let c=this.addLine({layer:i,start:s,end:s.add1(-r,0),width:e}),h=this.addLine({layer:i,start:s,end:s.add1(0,-r),width:e});s=t.LR().add1(n,-n);let u=this.addLine({layer:i,start:s,end:s.add1(-r,0),width:e}),d=this.addLine({layer:i,start:s,end:s.add1(0,r),width:e});s=t.LL().add1(-n,-n);let p=this.addLine({layer:i,start:s,end:s.add1(r,0),width:e}),m=this.addLine({layer:i,start:s,end:s.add1(0,r),width:e});this.shapes.push(a,l,c,h,u,d,p,m)}createBody(){let t=this.currentOptions;if(t.bodyDiameter>0)return this.createCircleBody(t.bodyDiameter);let e=t.bodyLength.average,r=t.bodyWidth.average,i=ht.extend4(S.ORIGIN,e,r),n=ge.build6(i),s=this.addPolygon({lineType:"Line",layer:48,net:"",outline:n,width:.1});return this.shapes.push(s),this._bbox=i,i}createCircleBody(t){let e=this.currentOptions;if(t=t||e.bodyDiameter||0,t<=0)return;let r=t/2,i=this.addCicle({lineType:"Line",net:"",layer:48,center:S.ORIGIN,radius:r,width:0,locked:!1});return this.shapes.push(i),this._bbox=ht.extend4(S.ORIGIN,t,t),this._bbox}buildPasteMaskShape(t,e,r,i){let n=e?7:8;if(t=t.extendSize(r.expansionSize),r.corner==0)return this.addPolygon({lineType:"Fill Region",layer:n,net:"",outline:ge.build6(t).asClose(),width:0});{let s=i||Math.min(t.width(),t.height())*.1,a=i||s,l=t.UL().add1(s,0),c=t.UR().add1(-s,0),h=t.UR().add1(0,-a),u=t.LR().add1(0,a),d=t.LR().add1(-s,0),p=t.LL().add1(s,0),m=t.LL().add1(0,a),g=t.UL().add1(0,-a),y=null;if(r.corner==2)y=ge.build4([l,c,h,u,d,p,m,g,l]);else{s=a=Math.min(s,a);let b=[];b.push(new M(l,c)),b.push(q.build1(c,h,a,s,!1,ae.CW)),b.push(new M(h,u)),b.push(q.build1(u,d,s,a,!1,ae.CW)),b.push(new M(d,p)),b.push(q.build1(p,m,a,s,!1,ae.CW)),b.push(new M(m,g)),b.push(q.build1(g,l,s,a,!1,ae.CW)),y=ge.build2(b)}return this.addPolygon({lineType:"Fill Region",layer:n,net:"",outline:y.asClose(),width:0})}}createFootprint(){return this.getPinPosition(this.currentOptions.footprintOrigin),this.shapes}buildPoint(t,e=!0){let r={radius:this.unitConvert(.5,10),spacing:this.unitConvert(1,10),layer:3,aligment:"auto",isInner:!1,bbox:this.trackBBox||this.bbox};t=Object.assign(r,t);let i=this.getPinPosition(1);if(!i)return;let n=t.bbox,s=i.center,a=t.center;if(!a){let c=t.radius+t.spacing;if(t.isInner&&(c=-c),t.aligment=="horizontal")this.positionOnBBox(s).horizontal!=kge.RIGHT?a=new S(Math.min(n.minX,i.buildBBox().minX-(i.topSolderExpansion||i.bottomSolderExpansion))-c,s.y):a=new S(Math.max(n.maxX,i.buildBBox().maxX+(i.topSolderExpansion||i.bottomSolderExpansion))+c,s.y);else if(t.aligment=="vertical")this.positionOnBBox(s).vertical!=G1.BOTTOM?a=new S(s.x,Math.max(n.maxY,i.buildBBox().maxY+(i.topSolderExpansion||i.bottomSolderExpansion))+c):a=new S(s.x,Math.min(n.minY,i.buildBBox().minY-(i.topSolderExpansion||i.bottomSolderExpansion))-c);else{let h=this.positionOnBBox(s);(h.vertical===G1.CENTER?this.currentOptions.firstPinAt===0?G1.TOP:G1.BOTTOM:h.vertical)===G1.TOP?a=n.UL().add1(-c,c):a=n.LL().add1(-c,-c)}}let l=this.createAPoint(a,t.radius,t.layer);return e&&this.shapes.push(l),l}getCornerPositionOfFirstpin(t,e){t=t||this.bbox,e=e||this.firstPinPosition;let r=this.positionOnBBox(e,t),i=null;switch(r){case fm.LT:case fm.CT:i=t.UL();break;case fm.RT:i=t.UR();break;case fm.LB:case fm.LC:case fm.CB:case fm.CC:i=t.LL();break;case fm.RB:case fm.RC:i=t.LR();break}return i}buildComponentPoint(t,e=49,r){let i=this.getCornerPositionOfFirstpin(t,r);this.buildPoint({radius:this.unitConvert(.06,39.37),center:i,layer:e})}positionOnBBox(t,e=this.bbox){return e.positionOnBBox(t)}createAPoint(t,e,r){return this.addCicle({lineType:"Fill Region",net:"",layer:r,center:t,radius:e,width:1})}buildPinOutlineShape(t){if(!t)return;let e=50,r=t.primitives[0];return t.primitives.length==1&&r instanceof q&&r.isCircle()?this.createAPoint(r.center,r.rx,e):this.addPolygon({lineType:"Fill Region",net:"",layer:e,outline:t})}addLinesByPoints(t,e){if(!t||t.length<2)return;let r={net:"",layer:3,stroke:this.config.DefaultStrokeWidth},{layer:i,stroke:n}=Object.assign({},r,e),s=null;for(let a of t)s&&!s.equals(a)&&this.shapes.push(this.addLine({layer:i,start:s,end:a,width:n})),s=a}fixFirstPinPosition(t){if(this.currentOptions.firstPinAt==t)return;let e=t==0?90:-90,r=Ae.rotateZ(zt.toRadians(e));this.shapes.forEach(i=>{i.transform(r),i instanceof He&&i.fill()})}createPasteMask(t){t=t||this.currentOptions.customPasteMask,t&&this.shapes.forEach(e=>{e instanceof _i&&e.layerId!==12&&(this.shapes.push(this.buildPasteMaskShape(e.buildBBox(),e.layerId===1,t)),e.expansion=yu.getPadExpansion(e.expansionType,this.unitConvert(-100,39.37),this.unitConvert(2,1),this.unitConvert(2,1)))})}clonePolygonModel(t,e){return t&&e?this.addPolygon({lineType:t.type,net:t.net,layer:t.layerId,outline:e,width:t.strokeWidth,locked:t.locked}):null}resetPolygonChildren(t,e){if(t){t.removeAllChildren();let r=new Po;t.setChildrens([r.plToShapes(e,t.layerId,t.strokeWidth,t.locked)])}return t}clonePad(t,e){return this.createPad({location:e.center,padSizeInfo:{holeWidth:t.holeLength,holeHeight:t.holeRadius*2,padWidth:t.topWidth||t.innerWidth||t.bottomWidth,padHeight:t.topHeight||t.innerHeight||t.bottomHeight},layer:t.layerId,designator:t.num},e.autoPush)}cloneLine(t,e){return this.addLine({layer:t.layerId,start:e.start,end:e.end,width:t.width,locked:t.locked})}cloneArc(t,e){return this.addArc({layer:t.layerId,center:e.center,radius:t.radius,startAngle:t.startAngle,endAngle:t.endAngle,sweep:t.sweep,width:t.width,locked:t.locked})}buildPositiveAndNegative(t=!0){let e=this.bbox,i=e.height()*.8,n=i*.6,s=n/4,a=e.minX+s,l=a+n,c=s/2,h=-s/2,u=a+n/2-s/2,d=u+s,p=i/2,m=-i/2,g=13,y=ge.build4([new S(a,h),new S(a,c),new S(l,c),new S(l,h)]).asClose();this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:g,outline:y})),this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:g,outline:y.multiply3(Qe.MIRROR_X)}));let b=ge.build4([new S(Math.abs(u),m),new S(Math.abs(u),p),new S(Math.abs(d),p),new S(Math.abs(d),m)]).asClose();this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:g,outline:t?b.mirrorY():b}))}buildSilkByPackageType(t=!1){let e=this,i=this.currentOptions.componentType,n=this.config.DefaultStrokeWidth,s=n,a=n*3,c=this.getPinPosition(1).buildBBox(),h=c.extendSize(a),u=3,d=h.UL(),p=h.UR(),m=h.LR(),g=h.LL(),y=[],b,P,T,I,C,E,O=S.ORIGIN,_=n/2,x=c.height()-_/2;switch(i){case"C":default:if(!t){b=p.add1(-a/2-n/2,0),P=d.add1(s,0),T=d.add1(0,-s),I=g.add1(0,s),C=g.add1(s,0),E=m.add1(-a/2-n/2,0),y.push(this.addLine({layer:u,start:b,end:P,width:n}));let F=q.build1(P,T,s,s,!1,ae.CCW);y.push(this.addArc({layer:u,radius:F.rx,center:F.center,width:n,startAngle:F.startAngle,endAngle:F.endAngle(),sweep:F.sweep(),locked:!1})),y.push(this.addLine({layer:u,start:T,end:I,width:n}));let H=q.build1(I,C,s,s,!1,ae.CCW);y.push(this.addArc({layer:u,radius:H.rx,center:H.center,width:n,startAngle:H.startAngle,endAngle:H.endAngle(),sweep:H.sweep()})),y.push(this.addLine({layer:u,start:C,end:E,width:n})),v(y)}break;case"R":t||(b=p.add1(-a/2-n/2,0),P=d,T=g,I=m.add1(-a/2-n/2,0),y.push(this.addLine({layer:u,start:b,end:P,width:n})),y.push(this.addLine({layer:u,start:P,end:T,width:n})),y.push(this.addLine({layer:u,start:T,end:I,width:n})),v(y));break;case"I":case"BD":if(!t&&(b=p.add1(-a/2-n/2,0),P=d.add1(s,0),T=d.add1(0,-s),I=g.add1(0,s),C=g.add1(s,0),E=m.add1(-a/2-n/2,0),y.push(this.addLine({layer:u,start:b,end:P,width:n})),y.push(this.addLine({layer:u,start:P,end:T,width:n})),y.push(this.addLine({layer:u,start:T,end:I,width:n})),y.push(this.addLine({layer:u,start:I,end:C,width:n})),y.push(this.addLine({layer:u,start:C,end:E,width:n})),v(y),i==="BD")){let F=T.add1(-(a+n)/4,0),H=F.add1(-n,0),z=I.add1(-(a+n)/4,0),V=z.add1(-n,0),W=this.addPolygon({lineType:"Fill Region",net:"",layer:3,outline:ge.build4([F,H,V,z]).asClose()});v([W])}break;case"CO":t||(b=d.mirrorY(),P=d,T=g,I=T.mirrorY(),this.shapes.push(this.addLine({layer:u,start:b,end:P,width:n})),this.shapes.push(this.addLine({layer:u,start:P,end:T,width:n})),this.shapes.push(this.addLine({layer:u,start:T,end:I,width:n})),this.shapes.push(this.addLine({layer:u,start:I,end:b,width:n})));break;case"D":case"LED":if(!t){b=p.add1(-a/2-n/2,0),P=d.add1(s,0),T=d.add1(0,-s),I=g.add1(0,s),C=g.add1(s,0),E=m.add1(-a/2-n/2,0),this.shapes.push(this.addLine({layer:u,start:b,end:P,width:n})),this.shapes.push(this.addLine({layer:u,start:P,end:T,width:n})),this.shapes.push(this.addLine({layer:u,start:T,end:I,width:n})),this.shapes.push(this.addLine({layer:u,start:I,end:C,width:n})),this.shapes.push(this.addLine({layer:u,start:C,end:E,width:n})),b=b.mirrorY(),P=d.mirrorY(),T=g.mirrorY(),I=E.mirrorY(),this.shapes.push(this.addLine({layer:u,start:b,end:P,width:n})),this.shapes.push(this.addLine({layer:u,start:P,end:T,width:n})),this.shapes.push(this.addLine({layer:u,start:T,end:I,width:n})),T=d.add1(0,-s),I=g.add1(0,s);let F=T.add1(-(a+n)/4,0),H=F.add1(-n,0),z=I.add1(-(a+n)/4,0),V=z.add1(-n,0);if(i==="D"){let W=this.addPolygon({lineType:"Fill Region",net:"",layer:3,outline:ge.build4([F,H,V,z]).asClose()});this.shapes.push(W)}else if(i==="LED"){let W=new S(H.x-n,(H.y+V.y)/2);this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:3,outline:ge.build4([F,H,W,V,z]).asClose()}))}}break;case"F":t||(b=p.add1(-a/2-n/2,0),P=d.add1(s,0),T=d.add1(0,-s),I=g.add1(0,s),C=g.add1(s,0),E=m.add1(-a/2-n/2,0),y.push(this.addLine({layer:u,start:b,end:P,width:n})),y.push(this.addLine({layer:u,start:T,end:I,width:n})),y.push(this.addLine({layer:u,start:C,end:E,width:n})),v(y));let D=q.build1(O.add1(0,x/2),O,x/2,x/2,!1,ae.CCW),w=q.build1(O,O.add1(0,-x/2),x/2,x/2,!1,ae.CW);this.shapes.push(this.addPolygon({layer:u,width:_,lineType:"Line",outline:ge.build2([D,w])}));break}function v(D){e.cloneMirrorItems(D,!0,e.shapes)}}cloneMirrorItems(t,e=!0,r,i){let n=Qe.MIRROR_X,s=[],a=typeof i=="function";return t.forEach(l=>{let c=null;if(l instanceof mt)c=this.cloneLine(l,{start:l.start.multiply3(n),end:l.end.multiply3(n)});else if(l instanceof _t){let h=[],u=l.endAngle-l.startAngle;h.push(q.build1(l.start.mirrorY(),l.end.mirrorY(),l.radius,l.radius,Math.abs(u)>180,u>=0?ae.CW:ae.CCW)),c=this.addPolygon({lineType:"Line",net:"",layer:l.layerId,outline:ge.build2(h)})}else if(l instanceof lt&&!l.isComplexPolygon()){let h=l.primitives.map(u=>u.multiply3(n));c=this.clonePolygonModel(l,ge.build2(h))}else l instanceof Pr?c=this.addCicle({lineType:"Fill Region",net:l.net,layer:l.layerId,center:l.center.multiply3(n),radius:l.radius,width:l.strokeWidth}):l instanceof _i&&(c=this.clonePad(l,{center:l.center.multiply3(n),autoPush:!1}));e&&s.push(l),c&&s.push(c),r&&(e&&r.push(l),c&&r.push(c)),a&&c&&i.call(this,c)}),s}buildPlusMinusSign(t,e,r,i=13,n=!0){let s=ge.build6(ht.extend4(t,e,r)),a=ge.build6(ht.extend4(t,r,e));this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:i,outline:s})),n&&this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:i,outline:a}))}isPolarity(){return this.currentOptions.polarity||["PC","D","BD","LED"].includes(this.currentOptions.componentType)}getCommonPadSize(t,e,r,i){if(i){let a=t;t=e,e=a}t||(t=0),e||(e=0),r||(r=0);let n=t+r,s=e+r;return{holeWidth:t,holeHeight:e,padWidth:n,padHeight:s}}getStraightPassPadSize(t){let e={padExpansion:this.unitConvert(.2,39.37),padRatio:1.5};t=Object.assign({},e,t);let{pinDiameterMax:r,padExpansion:i,padRatio:n}=t;i=Math.max(0,i),n=Math.max(1,n);let s=r+i,a=s*n;return{holeWidth:s,holeHeight:s,padWidth:a,padHeight:a}}createQFPLinkPads(t){var de;let{LEADCUTOUTOVERLAP:e}=this.config,{pinsNumberLR:r,pinsNumberTB:i,leadSpan_h:n,leadSpan_v:s,rowSpace:a,columnSpace:l,startDesignator:c,padSizeOptions:h,filterFun_left:u,filterFun_right:d,filterFun_top:p,filterFun_bottom:m}=t;c||(c=1),h||(h={}),r==0&&(n=0),r<=1&&(l=0),i==0&&(s=0),i<=1&&(a=0);let{pinLength:g,pinWidth:y,padShape:b,padExpansion:P}=this.currentOptions;P||(P=0);let T=this.bbox,I=T.width(),C=T.height(),E=T.center(),O=n-I,_=O/2,x=s-C,v=x/2,D=_-g/2,w=v-g/2,F=T.extendSize(Math.max(0,O),Math.max(0,x)),H=1,z=[],V=[],W=[],L=[],k=null,N=null,U=c,B=Object.assign({},h,{pinWidth:g,pinHeight:y,pinSpacing:l,padShape:b,pinFloatingLen:isNaN(h.pinFloatingLen)?D:h.pinFloatingLen}),{holeWidth:G,holeHeight:Y,Jh:X,Jt:K}=this.getQFPLinkPadSizeInfo(B),J=this.getCommonPadSize(G,Y,P),se=Object.assign({},h,{pinWidth:g,pinHeight:y,pinSpacing:a,padShape:b,pinFloatingLen:isNaN(h.pinFloatingLen)?w:h.pinFloatingLen}),{holeWidth:ce,holeHeight:te,Jh:oe,Jt:$}=this.getQFPLinkPadSizeInfo(se),fe=this.getCommonPadSize(ce,te,P,!0),Oe=new S(T.minX-_,E.y+(r-1)*l/2),Te="";for(let me=0;me<r;me++){let Se=Oe.add1(0,-me*l),Re={};if(Re.pin_solid={lineType:"Fill Region",net:"",layer:50,outline:ge.build6(ht.extend4(Se,g,y))},D>0){let Ke=D+e*2,Gt=y,Nr=Se.x+g/2;Re.pin_float={lineType:"Fill Region",net:"",layer:51,outline:ge.build6(ht.extend4(new S(Nr+D/2,Se.y),Ke,Gt))}}let Je=Se.add1((X-K)/2,0);Re.pad={location:Je,padSizeInfo:J,layer:H,designator:(U++).toString()},z.push(Re),Te||(Te=(de=Re.pad)==null?void 0:de.designator)}U+=i+r-1;let ue=[];z.reverse().forEach(me=>{var Gt,Nr,xr;u!=null&&u.call(null,me.pad.designator)||ue.push(me);let Se=(U--).toString();if(d!=null&&d.call(null,Se))return;let Re=Qe.MIRROR_X,Je=(Gt=me.pin_solid)==null?void 0:Gt.outline.multiply3(Re),Ke=(xr=(Nr=me.pin_float)==null?void 0:Nr.outline)==null?void 0:xr.multiply3(Re);W.push({pin_solid:me.pin_solid?Object.assign({},me.pin_solid,{outline:Je}):null,pin_float:me.pin_float?Object.assign({},me.pin_float,{outline:Ke}):null,pad:me.pad?Object.assign({},me.pad,{location:me.pad.location.multiply3(Re)}):null})}),z.length=0,z.push(...ue.reverse()),U=r+1,Oe=new S(E.x-(i-1)*a/2,T.minY-v);for(let me=0;me<i;me++){let Se=Oe.add1(me*a,0),Re={};if(Re.pin_solid={lineType:"Fill Region",net:"",layer:50,outline:ge.build6(ht.extend4(Se,y,g))},w>0){let Ke=y,Gt=w+e*2,Nr=Se.y+g/2;Re.pin_float={lineType:"Fill Region",net:"",layer:51,outline:ge.build6(ht.extend4(new S(Se.x,Nr+w/2),Ke,Gt))}}let Je=Se.add1(0,(oe-$)/2);Re.pad={location:Je,padSizeInfo:fe,layer:H,designator:(U++).toString()},L.push(Re)}U=(r+r)*2,ue.length=0;let be=null,j="";L.reverse().forEach(me=>{var Gt,Nr,xr;m!=null&&m.call(null,me.pad.designator)||ue.push(me);let Se=(U--).toString();if(p!=null&&p.call(null,Se))return;let Re=Qe.MIRROR_Y,Je=(Gt=me.pin_solid)==null?void 0:Gt.outline.multiply3(Re),Ke=(Nr=me.pin_float)==null?void 0:Nr.outline.multiply3(Re);W.push({pin_solid:me.pin_solid?Object.assign({},me.pin_solid,{outline:Je}):null,pin_float:me.pin_float?Object.assign({},me.pin_float,{outline:Ke}):null,pad:me.pad?Object.assign({},me.pad,{location:me.pad.location.multiply3(Re)}):null}),j=(xr=me.pad)==null?void 0:xr.designator});let Z=[].concat(z,L.reverse(),V,W);U=c,Z.forEach(me=>{let Se=me.pin_solid&&this.addPolygon(me.pin_solid),Re=me.pin_float&&this.addPolygon(me.pin_float),Je=me.pad&&this.createPad(me.pad,!1);Je&&(!k&&me.pad.designator===Te&&(k=Je.buildBBox()),me.pad.designator===j&&(be=Je),Se&&this.addConnectRelatedId(Se,Je.globalIndex),Re&&this.addConnectRelatedId(Re,Je.globalIndex),Je.num=(U++).toString(),Je.rotation=0,this.shapes.push(Je)),Se&&this.shapes.push(Se),Re&&this.shapes.push(Re)}),be&&(N=be.buildBBox()),L.length=0,L.push(...ue.reverse()),this.firstPinDesigner="1";let ie=this.addThermalPad(U.toString());return{firstPinBBox:k,lastPinBBox:N,outSideBBox:F,thermalPad:ie}}getQFPLinkPadSizeInfo(t){let e={JtRatio:.6,bodyChamferLen:this.unitConvert(.2,39.37),pinFloatingLen:0,holeHeightRatio:1.4,holeHeightSpacingRatio:.56};t=Object.assign({},e,t);let{pinWidth:r,pinHeight:i,pinSpacing:n,padShape:s,bodyChamferLen:a,pinFloatingLen:l,JtRatio:c,holeHeightRatio:h,holeHeightSpacingRatio:u}=t;l=Math.max(l,0);let d=s==="OVAL",p=r*c,m=Math.min(r,l+a),g=d?i/2:0,y=r+p+m+g,b=0,P=this.unitConvert(.3,39.37);return n-i>=P?b=i*1.1:n>0?b=Math.min(i*h,n*u):b=i*h,{holeWidth:y,holeHeight:b,Jt:p,Jh:m}}};Pl.unit=10;var nie=class o extends Pl{constructor(e,r){super(e,r);this.pinPitchExt=0;this.fixedOptions={firstPinAt:0};this.defaultOptions={polarity:!0,componentType:"D",padShape:"ELLIPSE",pinPitch:Br(11.76,39.37),bodyLength:new ho(Br(8.5,39.37)),bodyWidth:new ho(Br(2.5,39.37)),pinDiameter:new ho(Br(.63,39.37)),footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("Axial",e),this.one=r,r)}createPads(){let e=[],{pinPitch:r,pinDiameter:i}=this.currentOptions,{LEADCUTOUTOVERLAP:n}=this.config,s=this.bbox,a=this.pinPitchExt=r-s.width(),l=a/2,c=i.max,h=i.average,u=h/2,d=new S(s.minX-l,s.center().y),p=this.createAPoint(d,u,50);e.push(p);let m=null;if(a>0){let T=l+u+n,I=h,C=d.x-u;m=this.addPolygon({lineType:"Fill Region",net:"",layer:51,outline:ge.build6(ht.extend4(new S(C+T/2,d.y),T,I))}),e.push(m)}let g=this.getStraightPassPadSize({pinDiameterMax:c}),y=this.createPad({location:d,padSizeInfo:g,layer:12,designator:"1"},!1);e.push(y),this.addConnectRelatedId(p,y.globalIndex),this.addConnectRelatedId(m,y.globalIndex);let b="",P=[];this.cloneMirrorItems(e,!0,this.shapes,T=>{T instanceof _i?(T.num="2",b=T.globalIndex):P.push(T)}),b&&P.forEach(T=>this.addConnectRelatedId(T,b)),this.firstPinDesigner="1"}refixOptions(e,r=!0){if(this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),e.pinPitch-e.bodyLength.average<this.unitConvert(.1,39.37))throw new Error("The parameter does not conform to the rules: The pin span is at least 0.1 mm more than the body length!");return this.currentOptions}buildSilk(){this.buildSilkByPackageType(!0);let e=this.buildBodySilk();if(this.isPolarity()){let i=e.width()*.1;this.addLinesByPoints([e.UL().add1(i,0),e.LL().add1(i,0)],{layer:3})}}buildPolarity(){if(this.buildComponentPoint(this.bbox.extendSize(this.pinPitchExt*2,0)),!this.isPolarity())return;let r=!1;this.buildPositiveAndNegative(r),this.buildComponentPoint(void 0,13,r?this.firstPinPosition:this.firstPinPosition.mirrorY())}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var oie=class o extends Pl{constructor(e,r){super(e,r);this.fixedOptions={padExpansion:0,polarity:!0,padShape:"ELLIPSE"};this.defaultOptions={packageName:"BGA-529_19x19x0.8P",rowsPins:23,columnsPins:23,bodyLength:new ho(Br(19,39.37)),bodyWidth:new ho(Br(19,39.37)),pinDiameter:new ho(Br(.4,39.37)),pinSpacing:Br(.8,39.37),pinPitch:Br(.8,39.37),customPasteMask:{expansionSize:0,corner:2},firstPinAt:1,footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("BGA",e),this.one=r,r)}refixOptions(e,r=!0){return this.resetShape(),this.currentOptions=this.fixOptions(e,r),this.currentOptions}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.createFootprint()}createPads(){let{rowsPins:e,columnsPins:r,pinSpacing:i,pinPitch:n,pinDiameter:s,padExpansion:a,firstPinAt:l}=this.currentOptions,c=this.getPadRule(s.average),h=this.getCommonPadSize(c.PADDiameter,c.PADDiameter,a),u=l==1,d=S.ORIGIN,p=new _e,m=[],g="",y=0,b="IOQSXZ",P=1;for(let C=0;C<r;C++){u?(g=gee(g,b),y=0):(g="",y+=1);for(let E=0;E<e;E++){u?y+=1:g=gee(g,b);let O=u?d.add1(C*n,E*i):d.add1(C*n,-E*i),_=this.createPad({location:O,designator:g+y,layer:P,padSizeInfo:h,topSolderMaskEx:this.unitConvert(.15,10),bottomSolderMaskEx:this.unitConvert(.15,10)},!1),x=s.average;m.push(this.buildPinOutlineShape(ge.build2([q.buildCircle(O,x/2,ae.CCW)]))),p.ext2(O),m.push(_)}}let T=p.build1().center(),I=Ae.translate(-T.x,-T.y,0);m.forEach(C=>{C.transform(I),this.shapes.push(C)}),this._firstPinPosition=null,this.firstPinDesigner="A1"}getPadRule(e){let r=39.37;e=this.unitReverse(e,r);let i=e,n=0,s=0;return e<=.2?(i=e*(1-.15),n=e*1,s=n*.1):e<=.5?(i=e*(1-.2),n=e*1,s=n*.15):e<=.75?(i=e*(1-.25),n=e*(1-.2),s=n*.2):(i=e*(1-.3),n=e*(1-.2),s=n*.3),{PADDiameter:this.unitConvert(i,r),OpeningWidth:this.unitConvert(n,r),Chamfer_Length:this.unitConvert(s,r)}}buildSilk(){this.buildBodySilk(),this.buildPoint({aligment:this.currentOptions.firstPinAt===0?"horizontal":"vertical",spacing:this.unitConvert(.4,39.37),radius:this.unitConvert(.1,39.37)}),this.buildGoldenTriangle()}getChamferLength(){let e=this.currentOptions,r=e.bodyWidth.average,i=(e.columnsPins-1)*e.pinPitch,n=e.bodyLength.average,s=(e.rowsPins-1)*e.pinSpacing;return Math.min((r-i)*.4,(n-s)*.4,this.unitConvert(1,39.37))}buildGoldenTriangle(e=this.config.DefaultStrokeWidth){let r=this.getChamferLength();if(r<=this.unitConvert(.3,39.37))return;let i=this.trackBBox,n=this.firstPinPosition;if(!n)return;let s=null,a=this.positionOnBBox(n),c=(a.vertical===G1.CENTER?this.currentOptions.firstPinAt===0?G1.TOP:G1.BOTTOM:a.vertical)===G1.TOP,h=3;s=c?i.UL():i.LL(),this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:h,outline:ge.build4([s,s.add1(r,0),s.add1(0,c?-r:r),s])}));let u=e*1.5,d=r+u;s=c?i.UL().add1(-u,u):i.LL().add1(-u,-u);let p=s.add1(d,0),m=c?s.add1(0,-d):s.add1(0,d);this.shapes.push(this.addLine({layer:h,start:s,end:p,width:e})),this.shapes.push(this.addLine({layer:h,start:s,end:m,width:e}))}buildPolarity(){if(this.buildComponentPoint(),!this.currentOptions.polarity)return;let e=this.unitConvert(.1,39.37),r=this.unitConvert(.2,39.37),i=this.firstPinPosition,n=13,s=this.positionOnBBox(i),l=(s.vertical===G1.CENTER?this.currentOptions.firstPinAt===0?G1.TOP:G1.BOTTOM:s.vertical)===G1.TOP;this.shapes.push(this.addArcByArc({layer:n,arc:q.buildCircle(i.add1(0,(l?1:-1)*this.unitConvert(.1,39.37)),e,ae.CCW),width:r}));let c=this.getChamferLength();if(c<=this.unitConvert(.3,39.37))return;let h=l?this.trackBBox.UL():this.trackBBox.LL();this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:n,outline:ge.build4([h,h.add1(c,0),h.add1(0,l?-c:c),h])}))}};var sie=class o extends Pl{constructor(e,r){super(e,r);this.fixedOptions={padShape:"RECT",firstPinAt:1,padExpansion:0};this.defaultOptions={polarity:!0,componentType:"D",bodyLength:new ho(Br(1,39.37)),bodyWidth:new ho(Br(.5,39.37)),pinWidth:Br(.2,39.37),height:Br(.5,39.37),customPasteMask:null,footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("Chip",e),this.one=r,r)}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createLead(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.createFootprint()}refixOptions(e,r=!0){this.resetShape(),this.currentOptions=this.fixOptions(e,r),e=this.currentOptions;let i=e.pinWidth;if(i<this.unitConvert(.2,39.37)&&i<=e.bodyLength.average*.05)throw new Error("The parameter does not conform to the rules: The pin length is not less than 0.2 mm and not less than 0.05 of the body length!");return this.currentOptions}createLead(){var l;let e=this.bbox,r=this.currentOptions.pinWidth,i=ht.extend3(e.UL(),e.LL().add1(r,0)),n=i.transform(Qe.MIRROR_X),s=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:ge.build6(i)}),a=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:ge.build6(n)});((l=this.pads)==null?void 0:l.length)>=2&&(this.addConnectRelatedId(s,this.pads[0].globalIndex),this.addConnectRelatedId(a,this.pads[1].globalIndex)),this.shapes.push(s,a)}createPads(){let{pinWidth:e,height:r,padExpansion:i}=this.currentOptions,n=this.bbox,s=n.width(),a=n.height(),l=n.center(),c=0;e>=this.unitConvert(.3,39.37)?c=s-e*2-e*.5*2:c=s-e*2-e*.4*2;let h=0,u=0,d=0,p=this.config;d=p.FillHeight/100*r,d>p.StencilThickness*p.StencilThicknessMultiple&&(d=p.StencilThickness*p.StencilThicknessMultiple),u=d*d*.5*a/a/p.StencilThickness,e>=this.unitConvert(.3,39.37)?h=e+u+e*.5:h=e+u+e*.4;let m=a+a*.08,g=this.getCommonPadSize(h,m,i),y=new S(c/2+h/2,0),b=y.mirrorY(l),P=1,T=this.createPad({location:b,layer:P,designator:"1",padSizeInfo:g}),I=this.createPad({location:y,layer:P,designator:"2",padSizeInfo:g});this.firstPinDesigner="1",this.pads=[T,I]}buildSilk(){this.buildSilkByPackageType()}buildPolarity(){if(this.buildComponentPoint(),!this.isPolarity())return;let r=!1;this.buildPositiveAndNegative(r),this.buildComponentPoint(void 0,13,r?this.firstPinPosition:this.firstPinPosition.mirrorY())}};var aie=class o extends Pl{constructor(e,r){super(e,r);this.fixedOptions={polarity:!1,padShape:"RECT",padExpansion:0};this.defaultOptions={pins:8,bodyWidth:new ho(Br(1.6,39.37)),bodyLength:new ho(Br(3.2,39.37)),pinLength:Br(.475,39.37),pinWidth:Br(.5,39.37),pinPitch:Br(.8,39.37),customPasteMask:null,firstPinAt:1,footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("ChipArray",e),this.one=r,r)}createPads(){let{pins:e,pinLength:r,pinWidth:i,pinPitch:n,padExpansion:s}=this.currentOptions,a=e/2,l=1,c=this.bbox,h=c.center(),u=r,d=i,p=n,m=this.unitConvert(.025,39.37),g=u*.6,y=u+g+m,b=d,P=this.getCommonPadSize(y,b,s),T=[],I=new S(c.minX+u/2,h.y+(a-1)*p/2),C=1;for(let E=0;E<a;E++){let O=I.add1(0,-E*p),_=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:ge.build6(ht.extend4(O,u,d))});T.push(_);let x=O.add1(m/2-g/2,0),v=this.createPad({location:x,padSizeInfo:P,layer:l,designator:(C++).toString()},!1);this.addConnectRelatedId(_,v.globalIndex),T.push(v)}C=e,this.cloneMirrorItems(T,!0,this.shapes,E=>{E instanceof _i&&(E.num=(C--).toString())}),this.firstPinDesigner="1"}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildComponentPoint(),this.fixFirstPinPosition(0),this.createFootprint()}refixOptions(e,r=!0){return this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),e.pins=Math.max(2,parseInt((((e.pins||0)+1)/2).toString())*2),this.currentOptions}buildSilk(){let e=this.config.DefaultStrokeWidth,r=e/2+this.config.DefaultTrackSpacing,i=this.getPinPosition(1),n=this.bbox,s=i.buildBBox(),a=Math.min(n.minX,s.minX),l=Math.max(n.maxY,s.maxY),h=new S(a-r,l+r).multiply3(Qe.MIRROR_Y),u=new S(s.maxX-e/2,l+r),d=ht.extend3(h,u),p=[d.UR(),d.UL(),d.LL(),d.LR()],m=p.map(y=>y.mirrorY()),g={net:"",layer:3,stroke:e};this.addLinesByPoints(p,g),this.addLinesByPoints(m,g)}};var lie=class o extends Pl{constructor(e,r){super(e,r);this.plusLen=0;this.plusWidth=0;this.fixedOptions={firstPinAt:0};this.defaultOptions={componentType:"C",padShape:"ELLIPSE",bodyDiameter:Br(10,39.37),pinDiameter:new ho(Br(.65,39.37)),pinPitch:Br(5.08,39.37),padExpansion:0,footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("Cylindrical",e),this.one=r,r)}createPads(){let e=[],r=this.bbox,{pinDiameter:i,pinPitch:n,padExpansion:s}=this.currentOptions,l=(n-r.width())/2,c=i.max,u=i.average/2,d=new S(r.minX-l,r.center().y),p=this.createAPoint(d,u,50);e.push(p);let m=this.getStraightPassPadSize({pinDiameterMax:c,padExpansion:s}),g=this.createPad({location:d,padSizeInfo:m,layer:12,designator:"1"},!1);this.addConnectRelatedId(p,g.globalIndex),e.push(g),this.cloneMirrorItems(e,!0,this.shapes,y=>{y instanceof _i&&(y.num="2")}),this.firstPinDesigner="1"}refixOptions(e,r=!0){if(this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),e.pinPitch+e.pinDiameter.average>e.bodyDiameter)throw new Error("The parameter does not conform to the rules: The sum of the pin spacing and pin diameter cannot exceed the body length!");return this.currentOptions}buildSilk(){let e=3,r=this.currentOptions.componentType,i=this.buildBodySilk(),n=r==="LED",s=this.firstPinBBox,a=s.center().mirrorY().x,l=i.width()/2;if(n){let h=this.shapes.pop();h&&h.remove();let u=(a+i.maxX)/2,d=Math.sqrt(Math.pow(l,2)-Math.pow(u,2)),p=new S(u,d),m=p.multiply3(Qe.MIRROR_Y);this.shapes.push(this.addArcByArc({layer:e,arc:q.build1(p,m,l,l,!0,ae.CCW),width:this.config.DefaultStrokeWidth})),this.addLinesByPoints([p,m])}if(!this.isPolarity())return;this.plusLen=Math.min(s.width(),s.height()),this.plusWidth=this.plusLen/4,this.polarityCenter=new S((s.minX+i.minX)/2,s.center().y),this.buildPlusMinusSign(this.polarityCenter,this.plusLen,this.plusWidth,e,!0);let c=Math.sqrt(Math.pow(l,2)-Math.pow(a,2));!n&&this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:e,outline:ge.build2([q.build1(new S(a,c),new S(a,-c),l,l,!1,ae.CW)])}))}buildPolarity(){this.buildComponentPoint(),this.isPolarity()&&(this.buildPlusMinusSign(this.polarityCenter,this.plusLen,this.plusWidth,13,!0),this.buildComponentPoint(void 0,13,this.firstPinPosition))}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var cie=class o extends Pl{constructor(e,r){super(e,r);this.lastPinBBox=null;this.outSideBBox=null;this.fixedOptions={polarity:!0,pins:2,padShape:"RECT",firstPinAt:0};this.defaultOptions={bodyLength:new ho([Br(1.15,39.37),Br(1.25,39.37)]),bodyWidth:new ho([Br(.75,39.37),Br(.8,39.37)]),pinLength:Br((.3+.4)/2,39.37),pinWidth:Br((.23+.28)/2,39.37),pinSpacing:Br(.75,39.37),pinPitch:Br(.45,39.37),customPasteMask:{expansionSize:0,corner:2},footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("DFN_4",e),this.one=r,r)}createPads(){let{pins:e,pinLength:r,pinSpacing:i,pinPitch:n}=this.currentOptions,s=r,a=i,l=this.createQFPLinkPads({pinsNumberLR:e,pinsNumberTB:0,leadSpan_h:a,leadSpan_v:0,rowSpace:0,columnSpace:n||i,padSizeOptions:{pinFloatingLen:0,bodyChamferLen:this.unitConvert(.025,39.37)}});this.firstPinDesigner="1",this._firstPinBBox=l.firstPinBBox,this.lastPinBBox=l.lastPinBBox,this.outSideBBox=l.outSideBBox}refixOptions(e,r=!0){return this.resetShape(),this.currentOptions=this.fixOptions(e,r),this.currentOptions}buildSilk(){let e=this.config.DefaultStrokeWidth,r=e/2+this.config.DefaultTrackSpacing,i=this.bbox.extendSize(e),n=this.firstPinBBox,s=this.lastPinBBox,a=3,l={layer:a,stroke:e},c=0,h=0;n&&(c=i.maxY-n.maxY-r),s&&(h=s.minX-i.minX-r);let u=i.UL(),d=i.LL(),p=i.UR(),m=i.LR();if(n?s||(this.addLinesByPoints([u,p],l),this.addLinesByPoints([d,m],l)):(this.addLinesByPoints([u,d],l),this.addLinesByPoints([p,m],l)),h>2*e){let y=u,b=u.add1(h,0),P=this.addLine({layer:a,start:y,end:b,width:e});this.shapes.push(P,this.clonePolygonModel(P,ge.build4([y.multiply3(Qe.MIRROR_X),b.multiply3(Qe.MIRROR_X)])),this.clonePolygonModel(P,ge.build4([y.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y)),b.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y))])),this.clonePolygonModel(P,ge.build4([y.multiply3(Qe.MIRROR_Y),b.multiply3(Qe.MIRROR_Y)])))}if(c>2*e){let y=u,b=u.add1(0,-c),P=this.addLine({layer:a,start:y,end:b,width:e});this.shapes.push(P,this.clonePolygonModel(P,ge.build4([y.multiply3(Qe.MIRROR_X),b.multiply3(Qe.MIRROR_X)])),this.clonePolygonModel(P,ge.build4([y.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y)),b.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y))])),this.clonePolygonModel(P,ge.build4([y.multiply3(Qe.MIRROR_Y),b.multiply3(Qe.MIRROR_Y)])))}let g=this.currentOptions.pinWidth/4;this.buildPoint({aligment:"horizontal",layer:a,spacing:g*2,radius:g})}buildPolarity(){if(this.buildComponentPoint(this.outSideBBox),!this.currentOptions.polarity)return;let e=this.currentOptions.pinWidth/4;this.buildPoint({aligment:"horizontal",layer:13,spacing:e*2,radius:e})}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var hie=class o extends Pl{constructor(e,r){super(e,r);this.leadWidth=0;this.fixedOptions={polarity:!0,customPasteMask:null,padExpansion:0};this.defaultOptions={pins:8,padShape:"OVAL",leadSpan:Br(7.62,39.37),bodyLength:new ho([Br(6.1,39.37),Br(6.6,39.37)]),bodyWidth:new ho([Br(9.02,39.37),Br(10.16,39.37)]),pinDiameter:new ho([Br(.35,39.37),Br(.53,39.37)]),pinPitch:Br(2.54,39.37),firstPinAt:0,footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("DIP",e),this.one=r,r)}createPads(){let{pins:e,pinDiameter:r,leadSpan:i,pinPitch:n,padExpansion:s}=this.currentOptions,a=e/2,l=this.bbox,c=l.center(),h=r.max,u=h/2,d=(i-l.width())/2+h/2;this.leadWidth=d;let p=n,m=0;p>0?m=Math.min((h+this.unitConvert(.2,39.37))*2,p*.6):m=(h+this.unitConvert(.2,39.37))*2;let g=(h+this.unitConvert(.2,39.37))*2.5,y=m,b=new _e,P=[],T=new S(l.minX-d/2,c.y+(a-1)*p/2),I=this.getCommonPadSize(g,m,s),C=dCe(h,39.37)+.25;I.holeWidth=I.holeHeight=this.unitConvert(gn(C,1),39.37);let E=12,O=!1,_=1,x=this.config.LEADCUTOUTOVERLAP;for(let v=0;v<a;v++){let D=T.add1(0,-v*p);O=v==0||v==a-1;let w=O?y/2-u:0,F=d>0&&this.addPolygon({lineType:"Fill Region",net:"",layer:51,outline:ge.build6(ht.extend4(D.add1(0,-w/2+x),d+x,y-w))});F&&P.push(F);let H=D.add1(u-d/2,0),z=this.createAPoint(H,u,50);P.push(z);let V=this.createPad({location:H,padSizeInfo:I,layer:E,designator:(_++).toString()},!1);this.addConnectRelatedId(F,V.globalIndex),this.addConnectRelatedId(z,V.globalIndex),P.push(V),b.ext2(D)}_=e,this.cloneMirrorItems(P,!0,this.shapes,v=>{v instanceof _i&&(v.num=(_--).toString())}),this.firstPinDesigner="1"}refixOptions(e,r=!0){return this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),e.pins=Math.max(2,parseInt((((e.pins||0)+1)/2).toString())*2),this.currentOptions}buildSilk(){let e=this.bbox,r=this.config.DefaultStrokeWidth,i=r/2+this.config.DefaultTrackSpacing,n=e.maxY+r/2,s=-n,l=this.getPinPosition(1).buildBBox(),c=Math.max(e.minX,l.maxX)+i,h=-c,u=ht.extend3(new S(c,s),new S(h,n)),d=3,p=e.width()*.125,m={net:"",layer:d,stroke:r},y=u.center().add1(-p,u.height()/2),b=y.mirrorY();this.addLinesByPoints([y,u.UL(),u.LL(),u.LR(),u.UR(),b],m),this.shapes.push(this.addArcByArc({layer:d,arc:q.build1(y,b,p,p,!1,ae.CCW),width:r,locked:!1})),this.buildPoint({aligment:"auto",layer:d,spacing:this.unitConvert(.3,39.37)+this.config.DefaultTrackSpacing,radius:this.unitConvert(.15,39.37)})}buildPolarity(){this.buildComponentPoint(this.bbox.extendSize(this.leadWidth*2,0)),this.currentOptions.polarity&&this.buildPoint({aligment:"auto",layer:13,spacing:this.unitConvert(.3,39.37)+this.config.DefaultTrackSpacing,radius:this.unitConvert(.15,39.37)})}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var uie=class o extends Pl{constructor(e,r){super(e,r);this.bodyLChamfer=0;this.padSizeInfo=null;this.fixedOptions={padShape:"RECT",polarity:!0,firstPinAt:0,padExpansion:0};this.defaultOptions={bodyLength:new ho([Br(10.1,39.37),Br(10.5,39.37)]),bodyWidth:new ho([Br(10.1,39.37),Br(10.5,39.37)]),leadSpan:Br(11,39.37),pinLength:Br(3.15,39.37),pinWidth:Br(1,39.37),customPasteMask:{expansionSize:0,corner:2},footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("E_Cap",e),this.one=r,r)}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.createFootprint()}refixOptions(e,r=!0){this.resetShape(),this.currentOptions=e=this.fixOptions(e,r);let i=e.pinLength,n=e.bodyLength.average;if(i<this.unitConvert(.2,39.37)&&i<=n*.05)throw new Error("The parameter does not conform to the rules: The pin length is not less than 0.2 mm and not less than 0.05 of the body length!");return this.currentOptions}createBody(){let e=this.currentOptions,r=e.bodyLength.average,i=e.bodyWidth.average,n=ht.extend4(S.ORIGIN,r,i),s=i*.2;this.bodyLChamfer=s;let a=n.UL(),l=n.LL(),c=ge.build4([a.add1(s,0),n.UR(),n.LR(),l.add1(s,0),l.add1(0,s),a.add1(0,-s)]).asClose(),h=this.addPolygon({lineType:"Fill Region",net:"",layer:48,outline:c});return this.shapes.push(h),this.updateBBox(n),n}createPads(){let{pinLength:e,pinWidth:r,leadSpan:i,padExpansion:n}=this.currentOptions,s=this.bbox,a=e,l=r,c=s.minX-(i-s.width())/2,h=new S(c,s.center().y),u=ht.extend4(h,a,l),d=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:ge.build6(u)});this.shapes.push(d);let p=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:ge.build6(u.transform(Qe.MIRROR_X))});this.shapes.push(p);let m=this.unitConvert(.3,39.37),g=m*2,y=m*.2,b=l*.4,P=a+g+y,T=l+b,I=c-g,C=new S(I,h.y),E=this.getCommonPadSize(P,T,n);this.padSizeInfo=E;let O=1,_=this.createPad({location:C,designator:"1",layer:O,padSizeInfo:E}),x=this.createPad({location:C.mirrorY(),designator:"2",layer:O,padSizeInfo:E});this.addConnectRelatedId(d,_.globalIndex),this.addConnectRelatedId(p,x.globalIndex),this.firstPinDesigner="1"}buildSilk(){let e=this.bbox,i=e.height()/5,n=i*.6,s=n/4,a=e.minX+s,l=new S(a+n/2,e.center().y).add1(0,-(i+s)),c=3,h=ht.extend4(l,n,s);this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:c,outline:ge.build6(h)})),this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:c,outline:ge.build6(h.transform(Qe.MIRROR_X))})),this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:c,outline:ge.build6(ht.extend4(l,s,i))}));let u=this.config.DefaultStrokeWidth,d=e.extendSize(u),p=u/2+this.config.DefaultTrackSpacing,m=this.bodyLChamfer+u/2,g=this.padSizeInfo,y=d.UL(),b=new S(d.minX,d.center().y+g.padHeight/2+p),P=[b,y.add1(0,-m),y.add1(m,0),d.UR(),b.mirrorY()],T={net:"",layer:c,stroke:u};this.addLinesByPoints(P,T),this.addLinesByPoints(P.map(I=>I.multiply3(Qe.MIRROR_Y)),T),this.trackBBox=d}buildPolarity(){if(this.buildComponentPoint(this.trackBBox),!this.currentOptions.polarity)return;let e=this.bbox,i=e.height()/5,n=i*.6,s=n/4,a=e.minX+s,l=new S(a+n/2,e.center().y),c=13,h=ht.extend4(l,n,s);this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:c,outline:ge.build6(h)})),this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:c,outline:ge.build6(h.transform(Qe.MIRROR_X))})),this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:c,outline:ge.build6(ht.extend4(l,s,i))})),this.buildComponentPoint(this.trackBBox,c)}};var die=class o extends Pl{constructor(e,r){super(e,r);this.columnsX=[];this.fixedOptions={firstPinAt:0,polarity:!0};this.defaultOptions={rowsPins:2,columnsPins:4,padShape:"ELLIPSE",bodyLength:new ho(Br(10.16,39.37)),bodyWidth:new ho(Br(2.54,39.37)),pinDiameter:new ho(Br(.64,39.37)),pinPitch:Br(2.54,39.37),pinWidth1:Br(1.52,39.37),pinSpacing:Br(2.54,39.37),pinLength:Br(1.52,39.37),footprintOrigin:1}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("HEADER_H",e),this.one=r,r)}createPads(){this.columnsX.length=0;let e=this.bbox,{rowsPins:r,columnsPins:i,pinPitch:n,pinSpacing:s,pinWidth1:a,pinDiameter:l}=this.currentOptions,c=l.max,u=l.average/2,d=this.getStraightPassPadSize({pinDiameterMax:c}),p=new S(-(i-1)*s/2,e.maxY+a),m=1,g=this.config.LEADCUTOUTOVERLAP;for(let y=0;y<i;y++)for(let b=0;b<r;b++){let P=p.add1(y*s,b*n);b===0&&(this.columnsX.push(P.x),this.outsideBBox=ht.extend1(e,P.add1(-u,u)));let T=this.createAPoint(P,u,50);this.shapes.push(T);let I=ge.build6(ht.extend3(P.add1(-u,u),new S(P.x+u,e.maxY-g))),C=this.addPolygon({lineType:"Fill Region",net:"",layer:51,outline:I});this.shapes.push(C);let E=this.createPad({location:P,padSizeInfo:d,layer:12,designator:(m++).toString()});this.addConnectRelatedId(T,E.globalIndex),this.addConnectRelatedId(C,E.globalIndex)}this.firstPinDesigner="1"}refixOptions(e,r=!0){return this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),this.currentOptions}buildSilk(){this.buildBodySilk();let e=this.config.DefaultStrokeWidth,r=3,i=this.currentOptions.pinLength,n=this.bbox.minY-e;this.columnsX.forEach(a=>{let l=new S(a,n);this.shapes.push(this.addLine({layer:r,start:l,end:l.add1(0,-i),width:e}))});let s=this.currentOptions.pinDiameter.average/4;this.buildPoint({aligment:"horizontal",layer:r,spacing:s*2,radius:s})}buildPolarity(){if(this.buildComponentPoint(this.outsideBBox),!this.currentOptions.polarity)return;let e=this.currentOptions.pinDiameter.average/4;this.buildPoint({aligment:"horizontal",layer:13,spacing:e*2,radius:e})}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var pie=class o extends Pl{constructor(e,r){super(e,r);this.fixedOptions={firstPinAt:0,polarity:!0};this.defaultOptions={rowsPins:2,columnsPins:4,padShape:"ELLIPSE",bodyLength:new ho(Br(10.16,39.37)),bodyWidth:new ho(Br(5.08,39.37)),pinDiameter:new ho(Br(.64,39.37)),pinSpacing:Br(2.54,39.37),pinPitch:Br(2.54,39.37),footprintOrigin:1}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("HEADER_V",e),this.one=r,r)}createPads(){let{rowsPins:e,columnsPins:r,pinPitch:i,pinSpacing:n,pinDiameter:s}=this.currentOptions,a=s.max,c=s.average/2,h=this.getStraightPassPadSize({pinDiameterMax:a}),u=S.ORIGIN.add1(-(r-1)*i/2,-((e-1)*n)/2),d=1;for(let p=0;p<r;p++)for(let m=0;m<e;m++){let g=u.add1(p*i,m*n),y=this.createAPoint(g,c,50);this.shapes.push(y);let b=this.createPad({location:g,padSizeInfo:h,layer:12,designator:(d++).toString()},!1);this.addConnectRelatedId(y,b.globalIndex),this.shapes.push(b)}this.firstPinDesigner="1"}refixOptions(e,r=!0){return this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),this.currentOptions}buildSilk(){let e=3;this.buildBodySilk();let r=this.currentOptions.pinDiameter.average/4;this.buildPoint({aligment:"horizontal",layer:e,spacing:r*2,radius:r})}buildPolarity(){if(this.buildComponentPoint(),!this.currentOptions.polarity)return;let e=this.currentOptions.pinDiameter.average/4;this.buildPoint({aligment:"horizontal",layer:13,spacing:e*2,radius:e})}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var fie=class o extends Pl{constructor(e,r){super(e,r);this.lastPinBBox=null;this.outSideBBox=null;this.fixedOptions={polarity:!0};this.defaultOptions={rowsPins:6,columnsPins:6,padShape:"OVAL",bodyLength:new ho([Br(2.9,39.37),Br(3.1,39.37)]),bodyWidth:new ho([Br(2.9,39.37),Br(3.1,39.37)]),pinLength:Br(.3,39.37),pinWidth:Br(.2,39.37),pinPitch:Br(.4,39.37),thermalPad:{thermalPadWidth:Br(1.8,39.37),thermalPadHeight:Br(1.8,39.37),hasThermalVias:!0},customPasteMask:{expansionSize:0,corner:2},firstPinAt:0,footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("QFN",e),this.one=r,r)}createPads(){let{rowsPins:e,columnsPins:r,pinPitch:i}=this.currentOptions,n=this.createQFPLinkPads({pinsNumberLR:e,pinsNumberTB:r,leadSpan_h:this.bbox.width(),leadSpan_v:this.bbox.height(),rowSpace:i,columnSpace:i,padSizeOptions:{pinFloatingLen:0,bodyChamferLen:this.unitConvert(.025,39.37)}});this._firstPinBBox=n.firstPinBBox,this.lastPinBBox=n.lastPinBBox,this.outSideBBox=n.outSideBBox,this.createThermalPadAndSolidPin(n.thermalPad)}refixOptions(e,r=!0){return this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),this.currentOptions}createThermalPadAndSolidPin(e){if(!e)return;let r=e.buildBBox(),i=Math.min(r.width(),r.height())*.1,n=r.UL(),s=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:ge.build4([n.add1(i,0),r.UR(),r.LR(),r.LL(),n.add1(0,-i)])});s&&(this.shapes.push(s),this.addConnectRelatedId(s,e.globalIndex))}buildSilk(){let e=this.config.DefaultStrokeWidth,r=e/2+this.config.DefaultTrackSpacing,i=this.bbox.extendSize(e),n=this.firstPinBBox,s=this.lastPinBBox,a=3,l={layer:a,stroke:e},c=0,h=0;n&&(c=i.maxY-n.maxY-r),s&&(h=s.minX-i.minX-r);let u=i.UL(),d=i.LL(),p=i.UR(),m=i.LR();if(n?s||(this.addLinesByPoints([u,p],l),this.addLinesByPoints([d,m],l)):(this.addLinesByPoints([u,d],l),this.addLinesByPoints([p,m],l)),h>2*e){let y=u,b=u.add1(h,0),P=this.addLine({layer:a,start:y,end:b,width:e});this.shapes.push(P,this.clonePolygonModel(P,ge.build4([y.multiply3(Qe.MIRROR_X),b.multiply3(Qe.MIRROR_X)])),this.clonePolygonModel(P,ge.build4([y.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y)),b.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y))])),this.clonePolygonModel(P,ge.build4([y.multiply3(Qe.MIRROR_Y),b.multiply3(Qe.MIRROR_Y)])))}if(c>2*e){let y=u,b=u.add1(0,-c),P=this.addLine({layer:a,start:y,end:b,width:e});this.shapes.push(P,this.clonePolygonModel(P,ge.build4([y.multiply3(Qe.MIRROR_X),b.multiply3(Qe.MIRROR_X)])),this.clonePolygonModel(P,ge.build4([y.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y)),b.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y))])),this.clonePolygonModel(P,ge.build4([y.multiply3(Qe.MIRROR_Y),b.multiply3(Qe.MIRROR_Y)])))}let g=this.currentOptions.pinWidth/4;this.buildPoint({aligment:this.currentOptions.rowsPins?"horizontal":"vertical",layer:a,spacing:g*2,radius:g})}buildPolarity(){if(this.buildComponentPoint(this.outSideBBox),!this.currentOptions.polarity)return;let e=this.currentOptions.pinWidth/4;this.buildPoint({aligment:this.currentOptions.rowsPins?"horizontal":"vertical",layer:13,spacing:e*2,radius:e})}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(e.rowsPins?0:1),this.createFootprint()}};var mie=class o extends Pl{constructor(e,r){super(e,r);this.lastPinBBox=null;this.outSideBBox=null;this.fixedOptions={polarity:!0};this.defaultOptions={rowsPins:44,columnsPins:44,padShape:"OVAL",leadSpan:Br(22,39.37),leadSpan2:Br(22,39.37),bodyLength:new ho([Br(20,39.37),Br(20,39.37)]),bodyWidth:new ho([Br(20,39.37),Br(20,39.37)]),pinLength:Br(.6,39.37),pinWidth:Br(.16,39.37),pinPitch:Br(.4,39.37),thermalPad:{thermalPadWidth:Br(7.5,39.37),thermalPadHeight:Br(6.74,39.37),hasThermalVias:!0},customPasteMask:{expansionSize:0,corner:2},firstPinAt:1,footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("QFP",e),this.one=r,r)}createPads(){let{rowsPins:e,columnsPins:r,leadSpan:i,leadSpan2:n,pinPitch:s}=this.currentOptions,a=this.createQFPLinkPads({pinsNumberLR:e,pinsNumberTB:r,leadSpan_h:i,leadSpan_v:n,rowSpace:s,columnSpace:s});this._firstPinBBox=a.firstPinBBox,this.lastPinBBox=a.lastPinBBox,this.outSideBBox=a.outSideBBox,this.createThermalPadAndSolidPin(a.thermalPad)}refixOptions(e,r=!0){return this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),this.currentOptions}createThermalPadAndSolidPin(e){if(!e)return;let r=e.buildBBox(),i=r.UL();this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:ge.build4([i,r.UR(),r.LR(),r.LL(),i])}))}buildSilk(){let e=this.config.DefaultStrokeWidth,r=e/2+this.config.DefaultTrackSpacing,i=this.bbox.extendSize(e),n=this.firstPinBBox,s=this.lastPinBBox,a=3,l={net:"",layer:a,stroke:e},c=0,h=0;n&&(c=i.maxY-n.maxY-r),s&&(h=s.minX-i.minX-r);let u=i.UL(),d=i.LL(),p=i.UR(),m=i.LR();if(n?s||(this.addLinesByPoints([u,p],l),this.addLinesByPoints([d,m],l)):(this.addLinesByPoints([u,d],l),this.addLinesByPoints([p,m],l)),h>2*e){let C=u,E=u.add1(h,0),O=this.addLine({layer:a,start:C,end:E,width:e});this.shapes.push(O,this.clonePolygonModel(O,ge.build4([C.multiply3(Qe.MIRROR_X),E.multiply3(Qe.MIRROR_X)])),this.clonePolygonModel(O,ge.build4([C.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y)),E.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y))])),this.clonePolygonModel(O,ge.build4([C.multiply3(Qe.MIRROR_Y),E.multiply3(Qe.MIRROR_Y)])))}if(c>2*e){let C=u,E=u.add1(0,-c),O=this.addLine({layer:a,start:C,end:E,width:e});this.shapes.push(O,this.clonePolygonModel(O,ge.build4([C.multiply3(Qe.MIRROR_X),E.multiply3(Qe.MIRROR_X)])),this.clonePolygonModel(O,ge.build4([C.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y)),E.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y))])),this.clonePolygonModel(O,ge.build4([C.multiply3(Qe.MIRROR_Y),E.multiply3(Qe.MIRROR_Y)])))}let g=this.bbox,y=0;n&&(y=Math.max(y,n.maxX-g.minX)),s&&(y=Math.max(y,g.maxY-s.minY));let b=-(2*e+y)*2,P=Math.abs(b)<g.width()&&Math.abs(b)<g.height(),T=null;if(P){T=g.extendSize(b),this.addLinesByPoints([T.UL(),T.UR(),T.LR(),T.LL(),T.UL()],l);let C=this.currentOptions.pinLength/4,E=e+C;this.shapes.push(this.createAPoint(T.UL().add1(E,-E),C,a))}let I=this.currentOptions.pinWidth/4;this.buildPoint({aligment:this.currentOptions.rowsPins?"horizontal":"vertical",layer:a,spacing:I*2,radius:I})}buildPolarity(){if(this.buildComponentPoint(this.outSideBBox),!this.currentOptions.polarity)return;let e=this.currentOptions.pinWidth/4;this.buildPoint({aligment:this.currentOptions.rowsPins?"horizontal":"vertical",layer:13,spacing:e*2,radius:e})}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(e.rowsPins?0:1),this.createFootprint()}};var gie=class o extends Pl{constructor(e,r){super(e,r);this.outSideBBox=null;this.fixedOptions={pins:2,polarity:!0,pinSpacing:0,firstPinAt:0,thermalPad:null};this.defaultOptions={padShape:"RECT",leadSpan:Br(3.75,39.37),bodyLength:new ho([Br(2.5,39.37),Br(2.8,39.37)]),bodyWidth:new ho([Br(1.5,39.37),Br(1.8,39.37)]),pinLength:Br(.35,39.37),pinWidth:Br(.6,39.37),customPasteMask:{expansionSize:0,corner:2},footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("SOD",e),this.one=r,r)}createPads(){let{pins:e,leadSpan:r,pinSpacing:i}=this.currentOptions,n=e/2,s=this.createQFPLinkPads({pinsNumberLR:n,pinsNumberTB:0,leadSpan_h:r,leadSpan_v:r,rowSpace:i,columnSpace:i});this._firstPinBBox=s.firstPinBBox,this.outSideBBox=s.outSideBBox,this.createThermalPadAndSolidPin(s.thermalPad)}refixOptions(e,r=!0){this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),e.pins=Math.max(2,parseInt((((e.pins||0)+1)/2).toString())*2);let i=(e.leadSpan-e.bodyLength.average)/2-e.pinLength,n=e.pinLength;if(i/n>2&&n<this.unitConvert(.5,39.37))throw new Error("The parameter does not conform to the rules: The length of the dangling pin cannot exceed 2 times the length of the pin, and the pin length cannot be less than 0.5 mm!");return this.currentOptions}createThermalPadAndSolidPin(e){if(!e)return;let r=e.buildBBox(),i=r.UL(),n=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:ge.build4([i,r.UR(),r.LR(),r.LL(),i])});this.shapes.push(n),this.addConnectRelatedId(n,e.globalIndex)}buildSilk(){let e=this.config.DefaultStrokeWidth,r=e/2+this.config.DefaultTrackSpacing,i=this.bbox.extendSize(e),n=this.firstPinBBox,s=3,a={net:"",layer:s,stroke:e},l=0;n&&(l=i.maxY-n.maxY-r);let c=i.UL(),h=i.LL(),u=i.UR(),d=i.LR();if(this.addLinesByPoints([c,u],a),this.addLinesByPoints([h,d],a),l>e){let g=c,y=c.add1(0,-l),b=this.addLine({layer:s,start:g,end:y,width:e}),P=this.addLine({layer:s,start:g.multiply3(Qe.MIRROR_Y),end:y.multiply3(Qe.MIRROR_Y),width:e});this.shapes.push(b,P);let T=2*e,I=l+e,C=ge.build6(ht.extend4(u.add1(-e/2+T/2,e/2-I/2),T,I));this.shapes.push(this.addPolygon({lineType:"Fill Region",net:"",layer:s,outline:C}),this.addPolygon({lineType:"Fill Region",net:"",layer:s,outline:C.multiply3(Qe.MIRROR_Y)}))}let p=Math.max(n.maxX-this.bbox.minX,0)+r+e/2,m=new S(this.bbox.maxX-p,i.maxY);this.addLinesByPoints([m,m.multiply3(Qe.MIRROR_Y)],a)}buildPolarity(){this.buildComponentPoint(this.outSideBBox),this.currentOptions.polarity&&(this.buildPositiveAndNegative(!0),this.buildComponentPoint(this.outSideBBox,13))}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.createFootprint()}};var yie=class o extends Pl{constructor(e,r){super(e,r);this.outSideBBox=null;this.fixedOptions={polarity:!0};this.defaultOptions={pins:10,padShape:"OVAL",leadSpan:Br(6,39.37),bodyWidth:new ho([Br(3.9,39.37),Br(3.9,39.37)]),bodyLength:new ho([Br(4.9,39.37),Br(4.9,39.37)]),pinLength:Br(.835,39.37),pinWidth:Br(.375,39.37),pinPitch:Br(1,39.37),thermalPad:null,customPasteMask:{expansionSize:0,corner:2},firstPinAt:1,footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("SOIC_SOP",e),this.one=r,r)}createPads(){let{pins:e,leadSpan:r,pinPitch:i}=this.currentOptions,n=e/2,s=r,a=this.createQFPLinkPads({pinsNumberLR:n,pinsNumberTB:0,leadSpan_h:s,leadSpan_v:s,rowSpace:i,columnSpace:i});this._firstPinBBox=a.firstPinBBox,this.outSideBBox=a.outSideBBox,this.createThermalPadAndSolidPin(a.thermalPad)}refixOptions(e,r=!0){this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),e.pins=Math.max(2,parseInt((((e.pins||0)+1)/2).toString())*2);let i=(e.leadSpan-e.bodyWidth.average)/2-e.pinLength,n=e.pinLength;if(i/n>2&&n<this.unitConvert(.5,39.37))throw new Error("The parameter does not conform to the rules: The length of the dangling pin cannot exceed 2 times the length of the pin, and the pin length cannot be less than 0.5 mm!");return this.currentOptions}createThermalPadAndSolidPin(e){if(!e)return;let r=e.buildBBox(),i=r.UL(),n=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:ge.build4([i,r.UR(),r.LR(),r.LL(),i])});this.shapes.push(n),this.addConnectRelatedId(n,e.globalIndex)}buildSilk(){let e=this.config.DefaultStrokeWidth,r=this.firstPinBBox,i=3,n={net:"",layer:i,stroke:e},s=this.bbox,a=0;r&&(a=Math.max(a,r.maxX-s.minX));let l=-(2*e+a)*2,c=Math.abs(l)<s.width()&&Math.abs(l)<s.height(),h=null;if(c=!0,c){h=s.extendSize(l,e),this.addLinesByPoints([h.UL(),h.UR(),h.LR(),h.LL(),h.UL()],n);let d=this.currentOptions.pinLength/4,p=e+d;this.shapes.push(this.createAPoint(h.UL().add1(p,-p),d,i))}let u=this.currentOptions.pinLength/4;this.buildPoint({aligment:"vertical",layer:i,spacing:u*2,radius:u})}buildPolarity(){if(this.buildComponentPoint(this.outSideBBox),!this.currentOptions.polarity)return;let e=this.currentOptions.pinLength/4;this.buildPoint({aligment:"horizontal",layer:13,spacing:this.currentOptions.pinWidth/2,radius:e})}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var bie=class o extends Pl{constructor(e,r){super(e,r);this.outSideBBox=null;this.fixedOptions={polarity:!1,padShape:"RECT",firstPinAt:0};this.defaultOptions={pins:4,leadSpan:Br(7,39.37),bodyWidth:new ho([Br(3.3,39.37),Br(3.7,39.37)]),bodyLength:new ho([Br(6.3,39.37),Br(6.7,39.37)]),pinLength:Br(.9,39.37),pinWidth:Br(.7,39.37),pinPitch:Br(2.3,39.37),pinWidth1:Br(3,39.37),customPasteMask:{expansionSize:0,corner:2},footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("SOT223",e),this.one=r,r)}createPads(){let{pins:e,leadSpan:r,pinPitch:i,pinWidth:n,pinWidth1:s}=this.currentOptions,l=e-1,c=this.createQFPLinkPads({pinsNumberLR:l,pinsNumberTB:0,leadSpan_h:r,leadSpan_v:r,rowSpace:i,columnSpace:i,filterFun_right:()=>!0});this._firstPinBBox=c.firstPinBBox;let h=n;this.currentOptions.pinWidth=s;let u=this.createQFPLinkPads({pinsNumberLR:1,pinsNumberTB:0,leadSpan_h:r,leadSpan_v:r,rowSpace:i,columnSpace:i,startDesignator:l+1,padSizeOptions:{holeHeightRatio:1.2},filterFun_left:()=>!0});this.currentOptions.pinHeight=h,this.firstPinDesigner="1",this.outSideBBox=ht.extend2(c.outSideBBox,u.outSideBBox)}refixOptions(e,r=!0){this.resetShape(),this.currentOptions=e=this.fixOptions(e,r);let i=(e.leadSpan-e.bodyWidth.average)/2-e.pinLength,n=e.pinLength;if(i/n>2)throw new Error("The parameter does not conform to the rules: The length of the dangling pin cannot exceed 2 times the length of the pin!");return this.currentOptions}createThermalPadAndSolidPin(e){if(!e)return;let r=e.buildBBox(),i=r.UL(),n=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:ge.build4([i,r.UR(),r.LR(),r.LL(),i])});this.shapes.push(n),this.addConnectRelatedId(n,e.globalIndex)}buildSilk(){let e=this.config.DefaultStrokeWidth,r=this.firstPinBBox,n={net:"",layer:3,stroke:e},s=this.bbox,a=0;r&&(a=Math.max(a,r.maxX-s.minX));let l=-(2*e+a)*2,c=Math.abs(l)<s.width()&&Math.abs(l)<s.height(),h=null;c&&(h=s.extendSize(l,e),this.addLinesByPoints([h.UL(),h.UR(),h.LR(),h.LL(),h.UL()],n))}buildPolarity(){this.buildComponentPoint(this.outSideBBox)}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var Pie=class o extends Pl{constructor(e,r){super(e,r);this.outSideBBox=null;this.fixedOptions={polarity:!0,padShape:"RECT"};this.defaultOptions={pins:6,leadSpan:Br(2.3,39.37),bodyWidth:new ho([Br(1.2,39.37),Br(1.4,39.37)]),bodyLength:new ho([Br(2.8,39.37),Br(3,39.37)]),pinLength:Br(.3,39.37),pinWidth:Br(.43,39.37),pinPitch:Br(.95,39.37),customPasteMask:{expansionSize:0,corner:2},firstPinAt:0,footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("SOT23",e),this.one=r,r)}createPads(){let{pins:e,leadSpan:r,pinPitch:i}=this.currentOptions,n=null,s=null;switch(e){case 3:n=l=>l==="2",s=l=>["4","6"].includes(l);break;case 5:s=l=>l==="5";break;case 6:default:break}let a=this.createQFPLinkPads({pinsNumberLR:3,pinsNumberTB:0,leadSpan_h:r,leadSpan_v:r,rowSpace:i,columnSpace:i,filterFun_left:n,filterFun_right:s});this._firstPinBBox=a.firstPinBBox,this.outSideBBox=a.outSideBBox}refixOptions(e,r=!0){if(this.resetShape(),this.currentOptions=e=this.fixOptions(e,r),![3,5,6].includes(e.pins))throw new Error("The parameter does not conform to the rules: The number of pins can only be 3, 5 or 6!");let n=(e.leadSpan-e.bodyWidth.average)/2-e.pinLength,s=e.pinLength;if(n/s>2)throw new Error("The parameter does not conform to the rules: The length of the dangling pin cannot exceed 2 times the length of the pin!");return this.currentOptions}createThermalPadAndSolidPin(e){if(!e)return;let r=e.buildBBox(),i=r.UL(),n=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:ge.build4([i,r.UR(),r.LR(),r.LL(),i])});this.shapes.push(n),this.addConnectRelatedId(n,e.globalIndex)}buildSilk(){let e=3,r=this.config.DefaultStrokeWidth,i=r/2+this.config.DefaultTrackSpacing,n=this.bbox.extendSize(r),s=this.firstPinBBox,a=n.UL(),l=n.LL(),c=n.UR(),h=n.LR(),u={net:"",layer:e,stroke:r};this.addLinesByPoints([a,c],u),this.addLinesByPoints([l,h],u);let d=0;s&&(d=n.maxY-s.maxY-i);let p=null;if(d>2*r){let y=a,b=a.add1(0,-d);p=this.addLine({layer:e,start:y,end:b,width:r});let P=this.addLine({layer:e,start:y.multiply3(Qe.MIRROR_Y),end:b.multiply3(Qe.MIRROR_Y),width:r});this.shapes.push(p,P)}let m=this.currentOptions.pins;if(p||m===3){let y=null;m===3?y=this.addLine({layer:e,start:c,end:c.add1(0,-(d+this.currentOptions.pinPitch)),width:r}):y=this.addLine({layer:e,start:p.start.multiply3(Qe.MIRROR_X),end:p.end.multiply3(Qe.MIRROR_X),width:r});let b=this.addLine({layer:e,start:y.start.multiply3(Qe.MIRROR_Y),end:y.end.multiply3(Qe.MIRROR_Y),width:r});this.shapes.push(y,b)}let g=(s.minY-i)*2;if(g>2*r){let y=n.center().add1(-n.width()/2,g/2);m===3?this.shapes.push(this.addLine({layer:e,start:y,end:y.multiply3(Qe.MIRROR_Y),width:r})):m==5&&this.shapes.push(this.addLine({layer:e,start:y.multiply3(Qe.MIRROR_X),end:y.multiply3(Qe.MIRROR_X.multiply3(Qe.MIRROR_Y)),width:r}))}this.buildPoint({aligment:"auto",layer:e,spacing:this.config.DefaultTrackSpacing,radius:this.unitConvert(.15,39.37)})}buildPolarity(){this.buildComponentPoint(this.outSideBBox),this.currentOptions.polarity&&this.buildPoint({aligment:"auto",layer:13,spacing:this.config.DefaultTrackSpacing,radius:this.unitConvert(.15,39.37)})}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var Tie=class o extends Pl{constructor(e,r){super(e,r);this.outSideBBox=null;this.fixedOptions={polarity:!1,padShape:"RECT",firstPinAt:0,padExpansion:0};this.defaultOptions={pins:4,leadSpan:Br((9.4+10.41)/2,39.37),bodyWidth:new ho([Br(5.97,39.37),Br(6.22,39.37)]),bodyLength:new ho([Br(6.35,39.37),Br(6.73,39.37)]),pinLength:Br(1.59,39.37),pinWidth:Br(.82,39.37),pinPitch:Br(2.28,39.37),pinLength1:Br((4.59+5.46)/2,39.37),pinWidth1:Br((5.21+5.5)/2,39.37),leadTabOverhang:Br((.89+1.27)/2,39.37),leadThickness:Br((.46+.61)/2,39.37),customPasteMask:{expansionSize:0,corner:2},footprintOrigin:0}}static instance(e){let r=this.one;return r?(e&&(r.defaultOptions=Object.assign(r.defaultOptions,e)),r):(r=new o("TO_DPAK",e),this.one=r,r)}createPads(){let{FillHeight:e,StencilThickness:r,StencilThicknessMultiple:i}=this.config,{pins:n,leadThickness:s=0,leadTabOverhang:a,leadSpan:l,pinLength:c,pinLength1:h,pinWidth1:u,pinPitch:d,padShape:p,padExpansion:m}=this.currentOptions,y=n-1,b=this.bbox.width(),P=l-b-a;l=b+P*2;let T=Math.min(e/100*s,r*i),I=c*.2,C=T*T*.5/r,E=this.createQFPLinkPads({pinsNumberLR:y,pinsNumberTB:0,leadSpan_h:l,leadSpan_v:l,rowSpace:d,columnSpace:d,filterFun_right:()=>!0,padSizeOptions:{holeHeightRatio:1.4,pinFloatingLen:0,bodyChamferLen:I,JtRatio:C/c,holeHeightSpacingRatio:1/0}});this._firstPinBBox=E.firstPinBBox,this.outSideBBox=E.outSideBBox;let O=h,_=u,x=this.bbox,v=new S(x.maxX,x.center().y).add1(a-O/2,0),D=ht.extend4(v,O,_),w=O*.1,F=D.UR(),H=D.LR(),z=ge.build4([D.UL(),F.add1(-w,0),F.add1(0,-w),H.add1(0,w),H.add1(-w,0),D.LL(),D.UL()]),V=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:z});this.shapes.push(V);let W=s<=0?0:C,L=this.getQFPLinkPadSizeInfo({pinWidth:O,pinHeight:_,pinSpacing:d,padShape:p,holeHeightRatio:1.04,pinFloatingLen:0,bodyChamferLen:0,JtRatio:W/O,holeHeightSpacingRatio:1/0}),k=this.createPad({location:v.add1(-L.Jh/2+L.Jt/2,0),designator:(y+1).toString(),layer:1,padSizeInfo:this.getCommonPadSize(L.holeWidth,L.holeHeight,m)});this.addConnectRelatedId(V,k.globalIndex),this.firstPinDesigner="1"}refixOptions(e,r=!0){this.resetShape(),this.currentOptions=e=this.fixOptions(e,r);let i=(e.leadSpan-e.bodyWidth.average)/2-e.pinLength,n=e.pinLength;if(i/n>2)throw new Error("The parameter does not conform to the rules: The length of the dangling pin cannot exceed 2 times the length of the pin!");return this.currentOptions}createThermalPadAndSolidPin(e){if(!e)return;let r=e.buildBBox(),i=r.UL(),n=this.addPolygon({lineType:"Fill Region",net:"",layer:50,outline:ge.build4([i,r.UR(),r.LR(),r.LL(),i])});this.shapes.push(n),this.addConnectRelatedId(n,e.globalIndex)}buildSilk(){this.buildBodySilk(this.bbox,this.config.DefaultStrokeWidth,["R"])}buildPolarity(){this.buildComponentPoint(this.outSideBBox)}generate(e){return this.refixOptions(e),this.createBody(),this.createPads(),this.createPasteMask(),this.buildSilk(),this.buildPolarity(),this.fixFirstPinPosition(0),this.createFootprint()}};var Iie=class{hasPad(t){for(let e of t)if(e instanceof Le)return!0;return!1}onlyConnectTrack(t){if(t.length==0)return!1;for(let e of t)if(!(e instanceof Ge))return!1;return!0}};var hVe=Math.cos(Math.PI/180*89),r3t=Math.cos(Math.PI/180*91),ou=class extends Iie{constructor(e){super();this._startNodes=new Array;this._endNodes=new Array;this.track=e;let r=this.track.searchCycleNode();for(let i of r)if(i instanceof Ge){let n=this.track.start.distance2(i.start),s=this.track.start.distance2(i.end),a=this.track.end.distance2(i.start),l=this.track.end.distance2(i.end),c=Math.min(n,s),h=Math.min(a,l);c<h?this._startNodes.push(i):this._endNodes.push(i)}else{let n=this.track.start.distance2(i.center),s=this.track.end.distance2(i.center);n<s?this._startNodes.push(i):this._endNodes.push(i)}if(this._startType=this.getType(this._startNodes),this._endType=this.getType(this._endNodes),this.track instanceof Ir){let i=this.track.direct;if(this._startType===6){let s=this._startNodes[0].direct.mul(-1);this._startAngleType=this.getAngleType(i,s)}if(this._startType===5){let s=this._startNodes[0].direct;this._startAngleType=this.getAngleType(i,s)}if(this._endType===6){let s=this._endNodes[0].direct;this._endAngleType=this.getAngleType(i.mul(-1),s.mul(-1))}if(this._endType===5){let s=this._endNodes[0].direct;this._endAngleType=this.getAngleType(i.mul(-1),s)}}else this._startAngleType=3,this._endAngleType=3}get startType(){return this._startType}get endType(){return this._endType}get startNodes(){return this._startNodes}get endNodes(){return this._endNodes}get startAngleType(){return this._startAngleType}get endAngleType(){return this._endAngleType}getType(e){if(e.length==1){let r=e[0];if(r instanceof Ir){if(r.width!=this.track.width)return 11;let i=r.start.distance2(this.track.start),n=r.start.distance2(this.track.end),s=r.end.distance2(this.track.start),a=r.end.distance2(this.track.end),l=Math.min(i,n),c=Math.min(s,a);return l<c?5:6}else if(r instanceof yi){if(this.track.isSelect(r.start.x,r.start.y))return 7;if(this.track.isSelect(r.end.x,r.end.y))return 8}else return r instanceof Le?1:r instanceof Ue?2:r instanceof He?4:0}else return e.length==0?0:e.some(r=>r instanceof Le)?1:11}getDot(e,r){let i=e.dot(r);return Math.abs(i)<.1&&(i=0),i}getAngleType(e,r){let i=this.getDot(e,r);return i>hVe?0:i<=hVe&&i>=r3t?1:2}isSameLayer(e,r){for(let i of r)if(i.layerId!=e.layerId)return!1;return!0}canDrag(e){return e==0||e==4||e==5||e==6||e==1}isConnectTrack(e){return e==5||e==6||e==7||e==8}get startTangent(){let e=this.track,r=e.start,n=e.center.sub(r).normalize();if(this._startType===5||this._startType===6){let a=this._startNodes[0].direct;return this.getDot(n,a)===0}else return!1}get endTangent(){let e=this.track,r=e.end,n=e.center.sub(r).normalize();if(this._endType===5||this._endType===6){let a=this._endNodes[0].direct;return this.getDot(n,a)===0}else return!1}};var nj=class{};var O2=o=>{switch(o){case 15:return 1;case 16:return 2;case 17:return 3;case 18:return 4;case 19:return 5;case 20:return 6;case 21:return 7;case 22:return 8;case 23:return 9;case 24:return 10;case 25:return 11;case 26:return 12;case 27:return 13;case 28:return 14;case 29:return 15;case 30:return 16;case 31:return 17;case 32:return 18;case 33:return 19;case 34:return 20;case 35:return 21;case 36:return 22;case 37:return 23;case 38:return 24;case 39:return 25;case 40:return 26;case 41:return 27;case 42:return 28;case 43:return 29;case 44:return 30;case 45:return 31;case 46:return 32;default:return 0}},Cie=class{constructor(t,e){this.type=t,this.order=e}getHashed(){return this.type+"-"+this.order}};var Sie=class{},pA=class o extends Sie{constructor(t){super(),this.neckThickness=Ki.positiveOr0(t)}transform(t){return new o(this.neckThickness*t.iScale)}},Qx=class o extends Sie{constructor(t,e,r=90){super(),this.gridWidth=Ki.positiveOr0(t),this.gridClearance=Ki.positiveOr0(e),this.angle=r}transform(t){let e=t.iScale;return new o(this.gridWidth*e,this.gridClearance*e)}},y4=class o extends ia{constructor(e,r,i,n,s,a,l,c,h,u,d,p,m){super(e,r,i);this.multiLayerClearance=1;this.multiLayerThermal=!1;for(let g of d)if(!(g instanceof M||g instanceof q))throw new Error("invalid outlines, must be Line or Arc");this.method=n,this.outlineClearance=Ki.normal(s),this.clearance=a,this.thermal=l,this.keepIsland=c,this.pourIndex=h,this.needCopper=u,this.outlines=d,this.coppered=p,this.__bbox=this._bbox(),this.name=m||""}multiply3(e){let r=new Array(this.outlines.length);for(let a=0;a<this.outlines.length;a++)r[a]=this.outlines[a].multiply3(e);let i;if(this.coppered!==null){i=new Array(this.coppered.length);for(let a=0;a<this.coppered.length;a++)i[a]=this.coppered[a].multiply3(e)}else i=null;let n;this.method==null?n=null:n=this.method.transform(e);let s={};for(let a in this.clearance){let l=this.clearance[a];s[a]=l*e.iScale}return new o(this.id,this.net,this.layer,n,this.outlineClearance*e.iScale,s,this.thermal,this.keepIsland,this.pourIndex,this.needCopper,r,i,this.name)}bbox(){return this.__bbox}_bbox(){let e=new _e;for(let r of this.outlines)e.ext1(r.bbox());return e.build1()}shape(e,r){return this.layer.equals(e)||this.layer.equals($r.MULTI)?ge.build2(this.outlines):null}};var Db=class o extends ia{constructor(t,e,r,i,n,s,a,l,c){super(t||"","",e),this.type=r,this.copper=i,this.track=n,this.device=s,this.region=l,this.plane=a,this.outlines=c,this.__bbox=this._bbox()}multiply3(t){return new o(this.id,this.layer,this.type,this.copper,this.track,this.device,this.plane,this.region,this.outlines.multiply3(t))}bbox(){return this.__bbox}_bbox(){return this.outlines.bbox()}shape(t,e){return this.layer.equals(t)||this.layer.equals($r.MULTI)?this.outlines:null}};var b4=class o{constructor(t,e,r,i){this._connectMode=0;this._lineWidth=1;this._lineClearance=1;this._lineAngle=Go;this._connectMode=t,this._lineWidth=e,this._lineClearance=r,this._lineAngle=i}static getPadRule(t){if(t)return new o(t.connectMode,t.lineWidth,t.lineClearance,t.lineAngle)}static getDefRule(){return new o(0,1,1,Go)}get lineAngle(){return this._lineAngle}set lineAngle(t){this._lineAngle=t}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t}get connectMode(){return this._connectMode}set connectMode(t){this._connectMode=t}get lineClearance(){return this._lineClearance}set lineClearance(t){this._lineClearance=t}};var P4=o=>{switch(o){case"MULTI":return 0;case"TOP_SILK":return 1;case"TOP_PASTE_MASK":return 2;case"TOP_PASTE_MASK":return 3;case"TOP":return 4;case"SIGNAL":return 5;case"PLANE":return 6;case"BOTTOM":return 7;case"BOT_PASTE_MASK":return 8;case"BOT_SOLDER_MASK":return 9;case"BOT_SILK":return 10;case"OUTLINE":return 11;case"DOCUMENT":return 12;case"MECHANICAL":return 13;default:return 16}};var t0=class extends Os{constructor(t,e,r,i,n,s,a){super(t,e,r,i,n,s),this.sourceIndex=a}};var fA=class extends K9{constructor(e,r,i,n){super();this._color=ee.BLACK;this._state="Only Main";this.viewGroupId="";this.globalIndex=e,this._layerId=r,this._center=i,this.radius=n,this.refreshRender()}set color(e){this._color=e,this.refreshRender()}get color(){return this._color}get radius(){return this._radius}set radius(e){this.radius!=e&&(this._radius=e,this.shapeModified=!0,this.refreshRender())}get shapeModified(){return this.hasDataState(5)}set shapeModified(e){this.setDataState(5,e)}get layerId(){return this._layerId}get layerModified(){return!1}get center(){return this._center}get highlightColor(){return ee.BLACK}get highLightType(){return null}get manualHighLight(){return R.getInstance().forceDeactive}remove(){this._state="Not Shown",this.refreshRender()}getType(){return 30}refreshRender(){Mo.attach(this,this.getType())}getViewState(){return this._state}getRenderData(){return this}};var II=class extends Os{constructor(){super(...arguments);this.pcbVia=null;this.via=null;this.isReset=!1}reset(){this.isReset=!0}used(){this.isReset=!1}getRopeStart(){return this.isReset?this.pcbVia.center:this.end}hiddenVia(){if(this.pcbVia!=null){let e=Wr.getItem(this.pcbVia.id);e!=null&&e.hidden()}}visibleVia(){if(this.pcbVia!=null){let e=Wr.getItem(this.pcbVia.id);e!=null&&e.visible()}}previewVia(){this.hiddenVia(),this.removePreviewVia(),this.via=new fA(Lh(),12,this.end,this.width/2)}removePreviewVia(){this.via!=null&&this.via.remove(),this.via=null}};var yS=class{constructor(t,e,r,i,n,s,a){this.obstacles=new Set;this.sweep=null;this.modifyPath=new Array;this.modifyVias=new Array;this.walkHulls=new Array;this.previousChain=new Array;this.sourceIndex=t,this.all=e,this.tracks=r,this.path=i,this.startVia=n,this.endVia=s,this.sweep=a}updateModifyPath(t){this.modifyPath.length=0;let e=t.sourceTrackChain[this.sourceIndex],r=this.getPath(e),i=r.length,n=this.path.length,s=!1;for(let a=0,l=0;a<i&&l<n;){let c=r[a],h=this.path[l];if(c.equals1(h))s&&this.modifyPath.push(this.tracks[l-1]),a++,l++,s=!1;else{let u=l+1;for(;u<n;u++){let d=this.path[u];if(c.equals1(d))break}if(u<n){for(let d=l;d<=u;d++)d>=1&&this.modifyPath.push(this.tracks[d-1]);l=u}else if(a++,s=!0,a==i)for(let d=l;d<n;d++)d>=1&&this.modifyPath.push(this.tracks[d-1])}}}getPath(t){let e=new Array;if(t.length==0)return e;if(t.length==1)return[t[0].start,t[0].end];{let r,i;t[0].start.distance2(t[1].start)<1e-8||t[0].start.distance2(t[1].end)<1e-8?(r=t[0].end,i=t[0].start):(r=t[0].start,i=t[0].end),e.push(r),e.push(i);for(let n=1,s=t.length;n<s;n++){let a=t[n];a.start.distance2(i)<1e-8?(e.push(a.end),i=a.end):(e.push(a.start),i=a.start)}return e}}get length(){let t=0;for(let e of this.tracks)t+=e.start.distance1(e.end);return t}clear(){this.all.clear(),this.tracks.length=0,this.path.length=0,this.obstacles.clear(),this.modifyPath.length=0,this.modifyVias.length=0,this.walkHulls.length=0,this.previousChain.length=0}};var i3t=.1,fCe=class{constructor(){this._parent=null}set parent(t){this._parent=t}get parent(){return this._parent}},wb=class{constructor(t,e,r,i){this.samePositionNeighbor=new Set;this.neighbors=new Set;this._decorator=null;this.position=t,this.range=e,this.direct=r,this.box=new ht(this.position.x,this.position.x,this.position.y,this.position.y).extendOfSize(this.range),this.component=i}set decorator(t){this._decorator=t,this._decorator.parent=this}get decorator(){return this._decorator}bbox(){return this.box}addNeighbor(t){if(this.box.isIntersect(t.box)&&this.component!=t.component)if(this.position.equals1(t.position)){let e=new Eie(this,t,0);this.samePositionNeighbor.add(e),t.samePositionNeighbor.add(e)}else{let e=Math.min(this.range,t.range),r=this.position.distance1(t.position);if(r<=e&&r<i3t){let i=new Eie(this,t,r);this.neighbors.add(i),t.neighbors.add(i)}}}vote(t){return this.samePositionNeighbor.has(t)?!0:this.samePositionNeighbor.size==1?!1:this.neighbors.has(t)}getConnectNeighbors(){let t=new Array;for(let e of this.samePositionNeighbor)e.neighbor1==this?t.push(e.neighbor2):t.push(e.neighbor1);if(t.length==0)for(let e of this.neighbors)e.isNeighbor()&&(e.neighbor1==this?t.push(e.neighbor2):t.push(e.neighbor1));return t}},Eie=class{constructor(t,e,r){this.neighbor1=t,this.neighbor2=e,this.distance=r}isNeighbor(){return this.neighbor1.vote(this)&&this.neighbor2.vote(this)}},eR=class{constructor(t){this.neighbors=t}classify(){let t=this.neighbors.length,e=new ji(10);for(let r=0;r<t;r++){let i=this.neighbors[r],n=new mCe(r);i.decorator=n,e.add(i)}for(let r=0;r<t;r++){let i=this.neighbors[r],n=e.search(i.bbox());for(let s of n)s.decorator.index>i.decorator.index&&i.addNeighbor(s)}e.clear()}},mCe=class extends fCe{constructor(t){super(),this.index=t}};var n3t=0;function uVe(o,t,e){let r=o.tracks[0].width,i=o.tracks[0].net,n=o.tracks[0].layer,s=new Array,a=t[0];for(let c=1,h=t.length;c<h;c++){let u=t[c],d=new t0(i,n,a,u,r,"chain"+n3t++,o.sourceIndex);s.push(d),a=u}let l=new Lm(e);l.path.push(s[0].start);for(let c of s)l.tracks.push(c),l.all.add(c),l.path.push(c.end);return l.sourceIndex=o.sourceIndex,l.endVia=o.endVia,l.startVia=o.startVia,l}var Lm=class{constructor(t){this.sourceIndex=null;this.all=new Set;this.tracks=new Array;this.startVia=null;this.endVia=null;this.path=new Array;this.firstTouchTrack=null;this.sweep=null;this.obstacles=new Array;this.map=t}build(){return new yS(this.sourceIndex,this.all,this.tracks,this.path,this.startVia,this.endVia,this.sweep)}canShove(){return this.sourceIndex!=null}get length(){let t=0;for(let e of this.tracks)t+=e.start.distance1(e.end);return t}getPath(){if(this.firstTouchTrack!=null){let t=new Array,e=this.firstTouchTrack;t.push(this.firstTouchTrack);let r=this.tracks.indexOf(this.firstTouchTrack);for(let i=r-1;i>=0;i--){let n=this.tracks[i];t.push(n)}for(let i=r+1,n=this.tracks.length;i<n;i++){let s=this.tracks[i];t.push(s)}return this.firstTouchTrack=null,t}else return this.tracks}clearShape(){}generateChain(t){let e=t.start,r=t.end;return this.tracks.push(t),this.path.push(e),this.all.add(t),this.getTracks(t.layer,e,t.width,t.net),this.tracks=this.tracks.reverse(),this.path=this.path.reverse(),this.path.push(r),this.getTracks(t.layer,r,t.width,t.net,!1),this}getTracks(t,e,r,i,n=!0){let s=new ht(e.x,e.x,e.y,e.y),a=this.map.getShoveItems(t,s),l=new Array,c=new Array;if(n&&this.startVia==null||!n&&this.endVia==null){let y=this.map.getMultiItems(s);for(let b of y){let P=null;if(b instanceof gl?P=b:b instanceof II&&(P=b.pcbVia),P!=null&&P.net==i&&P.center.distance2(e)<1e-4){n?this.startVia=P:this.endVia=P;return}}}let h=this.map.getObstacleItems(t,s),u=this.map.getObstacleItems($r.MULTI,s);for(let y of u)h.push(y);for(let y of h)if(y instanceof Jp&&y.net==i&&y.location.distance2(e)<.1)return;let d=new wb(e,r/2,S.ORIGIN,{point:e,item:null,isStart:n}),p=new Array;p.push(d);for(let y of a)if(y instanceof Os&&!(y instanceof II)&&!this.all.has(y)&&y.net==i){let b=new wb(y.start,y.width/2,S.ORIGIN,{point:y.end,item:y,isStart:!0}),P=new wb(y.end,y.width/2,S.ORIGIN,{point:y.start,item:y,isStart:!1});p.push(b,P)}new eR(p).classify();let g=d.getConnectNeighbors();for(let y of g){l.push(y.component.point);let b=y.component.item;this.all.add(b),c.push(b)}if(l.length==1&&c[0].width==r)this.path.push(l[0]),this.tracks.push(c[0]),this.getTracks(t,l[0],c[0].width,i,n);else for(let y of c)this.all.delete(y)}};var Id=class o extends Ir{constructor(e,r){super(e);this.isBase=!0;super.color=r,this.sendDeleteMsg=!1}static build(e,r,i,n,s){let a=new zr(Lh(),e,r,i,n,!1,s);return new o(a,null)}getAngle(){let e=this.end.sub(this.start);return Kee(Math.atan2(e.y,e.x))}setBBoxModify(){}setLayerModify(e){}};function Oie(o){let{type:t,order:e}=Aie(o.layerId),r="";return o instanceof Ir&&(r=o.globalIndex),new t0(o.net,new $r(P4(t),e),o.start,o.end,o.width,r,0)}function Aie(o){let t=Ze.getInstance().getLayer(o),e=0;switch(t.type){case"SIGNAL":case"PLANE":e=O2(o);break;case"MECHANICAL":case"PLANE":e=1;break;default:e=0;break}return{type:t.type,order:e}}var g8=class o{constructor(t){this.childs=new Array;this._bbox=null;this.parent=null;this.capacity=t}bbox(){return Ki.notnull(this._bbox)}itor(t,e){for(let r of this.childs)r instanceof o?r.itor(t+1,e):e(r,t)}debug(t){for(let e of this.childs)console.log(t,e.bbox(),e instanceof o?"+":"-"),e instanceof o&&e.debug(t+" |--")}insert(t){let e=this.childs,r=t.bbox();for(let i=0;i<e.length;i++){let n=e[i];if(n instanceof o&&r.isInside(n.bbox())){n.insert(t),this._bbox=ht.extend2(this._bbox,r);return}}t instanceof o&&(t.parent=this),e.length<=this.capacity?e.push(t):(e.push(t),this.splitNode()),this._bbox=ht.extend2(this._bbox,r)}remove(t){if(t instanceof o&&t.childs.length>0)throw new Error;let e=this.childs,r=t.bbox(),i=new Array;for(let n=0;n<e.length;n++){let s=e[n];if(s===t)return e.splice(n,1),e.length>1?(this.updateBBox(),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):e.length==1?this.parent!==null?(this.parent.childs.push(this.childs[0]),this.childs[0]instanceof o&&(this.childs[0].parent=this.parent),this.childs.length=0,this.parent.remove(this),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):this.updateBBox():this.parent!==null?(this.parent.remove(this),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):this._bbox=null,1;s instanceof o&&r.isInside(s.bbox())&&i.push(s)}if(t instanceof o)throw new Error;for(let n of i){let s=n.remove(t);if(s===1)return this.childs.length>0&&this.updateBBox(),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox(),1;if(s!==0)throw new Error}return 0}recycle(){this.childs.length=0}updateBBox(){let t=new _e;for(let e of this.childs)t.ext1(e.bbox());this._bbox=t.build1()}splitNode(){let t=this.childs,e=t.length,r=-1,i=-1,n=Number.NEGATIVE_INFINITY;for(let c=0;c<e;c++){let h=t[c];for(let u=c+1;u<e;u++){let d=t[u],p=ht.extend2(h.bbox(),d.bbox()).area();p>n&&(n=p,r=c,i=u)}}let s=this.asNode(t[r]),a=this.asNode(t[i]);for(let c=0;c<e;c++)if(c!==r&&c!==i){let h=t[c],u=h.bbox(),d=ht.extend2(s._bbox,u).area(),p=ht.extend2(a._bbox,u).area();d<p?s.insert(h):a.insert(h)}t.length=0;let l=this.parent;s.updateBBox(),a.updateBBox(),l!==null&&l.childs.length<this.capacity?(s.parent=l,a.parent=l,l.childs.push(s),l.childs.push(a),l.remove(this),l.updateBBox()):(s.parent=this,a.parent=this,t.push(s),t.push(a),this.updateBBox()),this.childs.length>0&&this.updateBBox()}asNode(t){if(t instanceof o)return t;{let e=new o(this.capacity);return e.insert(t),e}}},Lb=class{constructor(t){this.items=new Set;this.root=new g8(t)}itor(t){this.root.itor(0,t)}search(t){let e=[],r=[];if(this.items.size==0||this.root!=null&&t.isSeparated(this.root.bbox()))return e;r.push(this.root);let i=null;for(;i=r.shift(),i!==void 0;)for(let n of i.childs)t.isSeparated(n.bbox())||(n instanceof g8?n.bbox().isInside(t)?this.add2Result(n,e):r.push(n):e.push(n));return e}add2Result(t,e,r){let i=[t];for(;;){let n=i.shift();if(n!==void 0)for(let s of n.childs)s instanceof g8?i.push(s):(!r||r(s))&&e.push(s);else break}}conditionQuery(t,e){let r=[];if(this.items.size==0||this.root!=null&&t.isSeparated(this.root.bbox()))return!1;r.push(this.root);let i=null;for(;i=r.shift(),i!==void 0;)for(let n of i.childs)if(!t.isSeparated(n.bbox())){if(n instanceof g8)r.push(n);else if(e(n))return!0}return!1}insert(t){this.items.add(t),this.root.insert(t)}remove(t){return this.items.delete(t),this.root.remove(t)}bbox(){return this.root.bbox()}debug(){this.root.debug("")}recycle(){this.items.clear(),this.root.recycle()}};var wp=class extends Os{constructor(){super(...arguments);this.locked=!1}};var _ie=class o extends ia{constructor(t,e,r,i,n){super(t,e,r),this.outline=i,this.connect=n,this.__bbox=this.outline.bbox()}shape(t,e){return this.layer.equals(t)||this.layer.equals($r.MULTI)?this.outline:null}bbox(){return this.__bbox}multiply3(t){return new o(this.id,this.net,this.layer,this.outline.multiply3(t),this.connect)}};function CI(o){let t=new Array,e=Ze.getInstance();for(let r of o){let i=e.getLayer(r);t.push([i.layerId,i.type])}return t}function o3t(o,t){switch(o){case 1:return $r.TOP_COPPER;case 3:return $r.TOP_SILK;case 5:return $r.TOP_SOLDER_MASK;case 7:return $r.TOP_PASTE;case 2:return $r.BOT_COPPER;case 4:return $r.BOT_SILK;case 6:return $r.BOT_SOLDER_MASK;case 8:return $r.BOT_PASTE;case 11:return $r.OUTLINE;case 12:return $r.MULTI;case 13:return $r.DOCUMENT;default:if(Es(o))if(ns(t)){let e=O2(o);return new $r(5,e)}else{let e=O2(o);return new $r(6,e)}else return $r.OTHER}}function SI(o){let t=new Array;for(let[e,r]of o){let i=o3t(e,r);t.push(i)}return t}var dVe={},y8=class{constructor(t){this.pcbshape=null;this.pcblayer=null;this.item=null;t instanceof Ls?(this.item=t,t instanceof Ge&&(this.pcbshape=this.converToShape(this.item))):this.pcbshape=t,this._box=this.buildBbox()}get id(){return this.pcbshape!=null?this.pcbshape.id:this.item!=null?this.item.globalIndex:""}get layer(){return this.pcblayer!=null?this.pcblayer:this.pcbshape!=null?(this.pcblayer=this.pcbshape.layer,this.pcblayer):this.item instanceof Ue?(this.pcblayer=$r.MULTI,$r.MULTI):(this.pcblayer=this.getLayer(this.item.layerId),this.pcblayer)}get shape(){return this.pcbshape==null&&(this.pcbshape=this.converToShape(this.item)),this.pcbshape}converToShape(t){if(t instanceof Ue)return t.type==1?new yy(t.globalIndex,t.net,t.center,t.holeRadius*2,this.getLayer(t.startLayer),t.radius*2,t.radius*2,this.getLayer(t.endLayer),t.radius*2,!1,SI(CI(t.unusedInnerLayers))):new gl(t.globalIndex,t.net,t.center,t.holeRadius*2,t.radius*2,t.radius*2,t.radius*2,!1,SI(CI(t.unusedInnerLayers)));if(t instanceof Ir){let e=new wp(t.net,this.getLayer(t.layerId),t.start,t.end,t.width,t.globalIndex);return e.locked=t.locked,e}else if(t instanceof yi){let e=q.build2(t.center,t.startAngle/Math.PI*180,t.endAngle/Math.PI*180,t.radius,t.radius,t.sweep);return new Rm(t.net,this.getLayer(t.layerId),e,t.width,t.globalIndex)}else if(t instanceof lr||t instanceof Dp){let e=t.model.box;return new c1(this.getLayer(t.layerId),e.leftLow,e.leftUp,e.rightLow,e.rightUp,t.globalIndex)}else if(t instanceof He){if(!(ns(Ze.getInstance().getLayer(t.layerId).type)||12==t.layerId||11==t.layerId))return null;let e=t.getComponent();return this.getProfileShape(t.globalIndex,t.type,t.net,t.layerId,0,t.getMathGraphics(t.layerId,0),t.strokeWidth,e,e)}else if(t instanceof _i){if(ar(t.layerId)){let e=this.getShape(t.topType,t.topWidth,t.topHeight,t.topRatio,null),r=this.getShape(t.innerType,t.innerWidth,t.innerHeight,t.innerRatio,null),i=this.getShape(t.bottomType,t.bottomWidth,t.bottomHeight,t.bottomRatio,null),n=this.getHoleShape(t);return new Jp(t.globalIndex,t.net,this.getLayer(t.layerId),t.center,t.rotation/Math.PI*180,new mI(this.getLayer(t.layerId),e,r,i),n,t.pasteExpansion,t.topSolderExpansion,t.bottomSolderExpansion,"",t.plated,null,this.toPadRule(t.padRule),this.getUnuseLayers(t.unusedInnerLayers))}else if(ao(t.layerId)){let e=this.getShape(t.topType,t.topWidth,t.topHeight,t.topRatio,null),r=new qP(0,0,0,t.rotation/Math.PI*180,0,0);return new Jp(t.globalIndex,t.net,this.getLayer(t.layerId),t.center,t.rotation/Math.PI*180,new mI(this.getLayer(t.layerId),e,null,null),r,t.pasteExpansion,t.topSolderExpansion,t.bottomSolderExpansion,"",t.plated,null,this.toPadRule(t.padRule),this.getUnuseLayers(t.unusedInnerLayers))}else if(2==t.layerId){let e=this.getShape(t.bottomType,t.bottomWidth,t.bottomHeight,t.bottomRatio,null),r=new qP(0,0,0,t.rotation/Math.PI*180,0,0);return new Jp(t.globalIndex,t.net,this.getLayer(t.layerId),t.center,t.rotation/Math.PI*180,new mI(this.getLayer(t.layerId),null,null,e),r,t.pasteExpansion,t.topSolderExpansion,t.bottomSolderExpansion,"",t.plated,null,this.toPadRule(t.padRule),this.getUnuseLayers(t.unusedInnerLayers))}}else if(t instanceof sn){if(ar(t.layerId)){let e=this.getShape("POLYGON",0,0,0,t.primitives),r=this.getShape("POLYGON",0,0,0,t.primitives),i=this.getShape("POLYGON",0,0,0,t.primitives),n=this.getHoleShape(t);return new Jp(t.globalIndex,t.net,this.getLayer(t.layerId),t.center,t.rotation/Math.PI*180,new mI(this.getLayer(t.layerId),e,r,i),n,t.pasteExpansion,t.topSolderExpansion,t.bottomSolderExpansion,"",t.plated,null,this.toPadRule(t.padRule),this.getUnuseLayers(t.unusedInnerLayers))}else if(ao(t.layerId)){let e=this.getShape("POLYGON",0,0,0,t.primitives),r=new qP(0,0,0,t.rotation/Math.PI*180,0,0);return new Jp(t.globalIndex,t.net,this.getLayer(t.layerId),t.center,t.rotation/Math.PI*180,new mI(this.getLayer(t.layerId),e,null,null),r,t.pasteExpansion,t.topSolderExpansion,t.bottomSolderExpansion,"",t.plated,null,this.toPadRule(t.padRule),this.getUnuseLayers(t.unusedInnerLayers))}else if(2==t.layerId){let e=this.getShape("POLYGON",0,0,0,t.primitives),r=new qP(0,0,0,t.rotation/Math.PI*180,0,0);return new Jp(t.globalIndex,t.net,this.getLayer(t.layerId),t.center,t.rotation/Math.PI*180,new mI(this.getLayer(t.layerId),null,null,e),r,t.pasteExpansion,t.topSolderExpansion,t.bottomSolderExpansion,"",t.plated,null,this.toPadRule(t.padRule),this.getUnuseLayers(t.unusedInnerLayers))}}return null}getProfileShape(t,e,r,i,n,s,a,l,c){switch(e){case"Line":return i==11?new E0(t,n,s):new Q0(r,this.getLayer(i),n,a,s,t);case"Prohibited Region":return new Db(t,this.getLayer(i),n,c.copper,c.track,c.device,c.planzone,c.fill,s);case"Fill Region":return new $P(r,this.getLayer(i),n,s,t);case"Board Outline":return new E0(t,n,s);case"Slot Region":return new by(t,n,s);case"TearDrop":return new _ie(t,r,this.getLayer(i),s,l.connects)}}getShape(t,e,r,i,n){let s;switch(t){case"ELLIPSE":s=new Ab(0,e,r,i*100,null);break;case"OVAL":s=new Ab(3,e,r,i*100,null);break;case"RECT":s=new Ab(1,e,r,i*100,null);break;case"POLYGON":s=new Ab(4,e,r,0,ge.build2(n));break}return s}getHoleShape(t){return t.holeShape=="ROUND"?new qP(0,t.holeRadius*2,t.holeLength,t.holeRotation/Math.PI*180,t.holeOffset.x,t.holeOffset.y):new qP(2,t.holeRadius*2,t.holeLength,t.holeRotation/Math.PI*180,t.holeOffset.x,t.holeOffset.y)}toPadRule(t){if(t==null)return null;let e=t.toJSON();return new b4(e.connectMode,e.lineWidth,e.lineClearance,e.lineAngle)}getUnuseLayers(t){let e=new Array;for(let r of t){let i=this.getLayer(r);e.push(i)}return e}getLayer(t){let e=dVe[t];if(e!=null)return e;let r=Ze.getInstance().getLayer(t),i=0;switch(r==null?void 0:r.type){case"SIGNAL":case"PLANE":i=O2(t);break;case"MECHANICAL":case"PLANE":i=1;break;default:i=0;break}let n=new $r(P4(r==null?void 0:r.type),i);return dVe[t]=n,n}buildBbox(){if(this.pcbshape!=null)return this.pcbshape.bbox();if(this.item!=null)return this.item.buildBBox();throw new Error("Method not implemented.")}bbox(){return this._box}};function gCe(o){return new ji(10)}var T4=class o{static getMap(){return o.map==null&&(o.map=new yCe),o.map}static clear(){o.map!=null&&o.map.clear(),o.map=null}},yCe=class{constructor(){this.pcbLayerRTreeMap=new hd;this.multiLayerRTree=new Lb(10);this.layerRTreeMap=new hd;this.realTimeLayerRTreeMap=new hd;this.box2d=new _e;this.map={};this.shapes=this.getShapes(),this.addDocShapes2RTree()}getShapes(){let t=new Array;xe.addAll(t,Wr.getAllItem()),xe.addAll(t,pr.getAllItem()),xe.addAll(t,ri.getAllItem()),xe.addAll(t,Bn.getAllItem()),xe.addAll(t,Qt.getAllItem()),xe.addAll(t,Kt.getAllItem()),xe.addAll(t,pt.getAllItem()),xe.addAll(t,Xt.getAllItem());let e=new Array;for(let r of t)e.push(new y8(r));return e}getTrack(t){let e=this.map[t];if(e!=null&&e.shape!=null){let r=e.shape;if(r instanceof Os)return r}return null}getPcbLayers(){return this.pcbLayerRTreeMap.keys()}getLayerRTreePcbLayers(){return this.layerRTreeMap.keys()}getRealTimeLayerRTreePcbLayers(){return this.realTimeLayerRTreeMap.keys()}getMultiRtreeItems(t){let e=this.multiLayerRTree.search(t),r=new Array;for(let i of e)i.shape!=null&&r.push(i.shape);return r}addDocShapes2RTree(){for(let t of this.shapes)this.map[t.id]=t,this.addShape2RTree(t),this.box2d.ext1(t.bbox())}getMultiItems(t){let e=new Array,r=this.layerRTreeMap.get($r.MULTI);return r!=null&&r.search(t).forEach(s=>{s.shape!=null&&e.push(s.shape)}),this.multiLayerRTree.search(t).forEach(n=>{n.shape!=null&&e.push(n.shape)}),e}getShoveItems(t,e){let r=this.pcbLayerRTreeMap.get(t);if(r!=null){let i=r.search(e),n=new Array;for(let s of i)s.shape!=null&&n.push(s.shape);return n}else return new Array}getObstacleItems(t,e){let r=new Array,i=this.layerRTreeMap.get(t);i!=null&&i.search(e).forEach(a=>{a.shape!=null&&r.push(a.shape)});let n=this.realTimeLayerRTreeMap.get(t);return n!=null&&n.search(e).forEach(a=>{a.shape!=null&&r.push(a.shape)}),r}addShape2RTree(t){let e=this.map[t.id];e==null&&t instanceof ia&&(e=new y8(t),this.map[e.id]=e),t instanceof Os?t instanceof wp&&t.locked?this.addNode2RTree1(e):this.addNode2RTree(e):t instanceof y8&&t.item!=null&&t.item instanceof Ir&&!t.item.locked?this.addNode2RTree(e):this.addNode2RTree1(e)}removeShape4RTree(t){if(t.layer.type==0){let e=this.map[t.id];this.multiLayerRTree.remove(e)}else{let e=this.pcbLayerRTreeMap.get(t.layer);if(e!=null){let i=this.map[t.id];e.remove(i)}let r=this.layerRTreeMap.get(t.layer);if(r!=null){let i=this.map[t.id];r.remove(i)}}}addNode2RTree(t){switch(t.layer.type){case 4:case 7:case 5:this.pcbLayerRTreeMap.computeIfAbsent(t.layer,gCe).add(t);break;case 0:this.multiLayerRTree.insert(t);break;default:break}}addNode2RTree1(t){switch(t.layer.type){case 4:case 7:case 5:case 0:case 11:this.layerRTreeMap.computeIfAbsent(t.layer,gCe).add(t);break;default:break}}addRealTimeShape(t){switch(t.layer.type){case 4:case 7:case 5:case 0:case 11:this.realTimeLayerRTreeMap.computeIfAbsent(t.layer,gCe).add(t);break;default:break}}removeRealTimeShape(t){let e=this.realTimeLayerRTreeMap.get(t.layer);if(e!=null){let r=this.map[t.id];e.remove(r)}}clear(){this.clearArray(this.pcbLayerRTreeMap),this.multiLayerRTree.recycle(),this.clearArray(this.layerRTreeMap),this.clearArray(this.realTimeLayerRTreeMap),this.shapes.length=0}clearArray(t){let e=t.keys();for(;e.hasNext();){let r=e.next(),i=t.get(r);i instanceof Lb?i.recycle():i.clear()}}};var vie=class{constructor(){this.previewTrack=new Set;this.collideTracks=new Set;this.map=T4.getMap();this.adsorp=null}resetLastMap(t){if(t!=null)for(let e=1,r=t.sourceTrackChain.length;e<r;e++)this.remove4Rtree(t.sourceTrackChain[e]),this.add4Rtree([t.shovePathMap[e]])}resetMap(){this.add4Rtree(Array.from(this.collideTracks)),this.remove4Rtree(Array.from(this.previewTrack)),this.collideTracks.clear(),this.previewTrack.clear()}remove4Rtree(t){t.forEach(e=>{e instanceof yS?e.tracks.forEach(r=>{r instanceof wp?this.collideTracks.add(r):r instanceof t0&&this.previewTrack.delete(r),this.map.removeShape4RTree(r)}):(e instanceof wp?this.collideTracks.add(e):e instanceof t0&&this.previewTrack.delete(e),this.map.removeShape4RTree(e))})}add4Rtree(t){t.forEach(e=>{if(e instanceof yS)e.tracks.forEach(r=>{if(r instanceof t0){if(this.previewTrack.has(r))return;this.previewTrack.add(r)}else if(r instanceof wp){if(!this.collideTracks.has(r))return;this.collideTracks.delete(r)}this.map.addShape2RTree(r)});else{if(e instanceof t0){if(this.previewTrack.has(e))return;this.previewTrack.add(e)}else if(e instanceof wp){if(!this.collideTracks.has(e))return;this.collideTracks.delete(e)}this.map.addShape2RTree(e)}})}adsorpTrack(t,e,r,i){let n=new Array;if(this.adsorp!=null)if(this.adsorp instanceof Os)if(e!=null){let s=e.end,a=this.adsorp.end.sub(this.adsorp.start).normalize();if(Math.abs(i.dot(a))<=1e-8)n.push(t.start),n.push(r),n.push(r);else{let l=e.end.sub(e.start).normalize();if(Math.abs(l.dot(a))>1e-8){let c=1;if(a.x==0&&a.y!=0)c=(s.y-r.y)/a.y;else if(a.x!=0&&a.y==0)c=(s.x-r.x)/a.x;else{let p=(s.x-r.x)/a.x,m=(s.y-r.y)/a.y;Math.abs(p)>Math.abs(m)?c=m:c=p}let h=r.add(a.mul(c)),u=new Os(e.net,e.layer,r,h,e.width,e.id),d=this.checkAdsorp(u);t.end.equals1(t.start)?(n.push(t.start),n.push(d),n.push(d)):(n.push(t.start),n.push(r),n.push(d))}else n.push(t.start),n.push(r),n.push(r)}}else n.push(t.start),n.push(r),n.push(r);else n.push(t.start),n.push(r),n.push(r);else if(e!=null){let s=this.checkAdsorp(e);n.push(t.start),n.push(e.start),n.push(s)}else n.push(t.start),n.push(r),n.push(r);return n}getSolidObstacle(t){for(let e of t.tracks)if(this.adsorp=null,this.checkObstacle(e),this.adsorp!=null)return t.firstTouchTrack=e,this.adsorp;return null}getType(t){if(t instanceof Os)return 0;if(t instanceof Rm)return 0;if(t instanceof MO)return 6;if(t instanceof c1)return 10;if(t instanceof Q0)return 9;if(t instanceof Db)return 15;if(t instanceof by)return 8;if(t instanceof gl)return 5;if(t instanceof yy)return 5;if(t instanceof Jp)return t.layer.equals($r.MULTI)?2:1;if(t instanceof E0)return 11}getSafeClearance(t,e,r=0){let i=r,n=this.getType(e);if(e.net!=null){let h=re.getInstance().getBetweenNetRuleByNet(i,n,t,e.net);if(h!=null)return re.getInstance().getSafeSpacing(h.name).getClearance(n,i)}if(n==0){let h=re.getInstance().getNet(t);if(h!=null&&h.netDifferential!=null){let u=h.netDifferential;if(t!=e.net&&u.hasNet(t)&&u.hasNet(e.net))return re.getInstance().getDifferentialPhysics(u.differentialPhysics).getDifferentialPairSpacingMin()}}let s=re.getInstance().getSafeSpacingByNet(t,i),a=re.getInstance().getSafeSpacingByNet(e.net,i),l=[s,a],c=-1;for(let h of l){let u=h.getClearance(n,i);c=Math.max(c,u)}if(c!=-1)return c;for(let h of l){let u=h.getClearance(n,i);c=Math.max(c,u)}return c}checkOnlyVia(t){if(t instanceof gl)t=new Os(t.net,$r.TOP_COPPER,t.center,t.center,t.topPad);else if(t.start.distance2(t.end)==0)return t.end;let e=re.getInstance().getMaxSafe(),r=t.bbox().extendOfSize(e),i=this.map.getMultiRtreeItems(r),n=t.end,s=t.net,a=this.getPrimitive(t);for(let l of i){let c=this.getSafeClearance(s,l),u=Math.max(c,0);ne.eq(u,0)||(n=this.checkClearance1(a,t,u,l),a=this.getNewPrimitive(a,n))}return n}check(t){if(t instanceof gl)return this.checkShoveVia(t);if(t.start.distance2(t.end)==0)return t.end;let e=re.getInstance().getMaxSafe(),r=t.bbox().extendOfSize(e),i=this.map.getShoveItems(t.layer,r),n=t.end,s=t.net,a=this.getPrimitive(t);for(let l of i){let c=this.getSafeClearance(s,l),u=Math.max(c,0);ne.eq(u,0)||(n=this.checkClearance1(a,t,u,l),a=this.getNewPrimitive(a,n))}return n}checkShoveVia(t){let e=re.getInstance().getMaxSafe(),r=new _e().ext2(t.center).ext7(e+t.topPad/2).build1(),i=new Array,n=this.map.getPcbLayers(),s=new Array;for(;n.hasNext();){let h=n.next();this.map.getShoveItems(h,r).forEach(p=>{i.push(p)});let d=new Os(t.net,h,t.center,t.center,t.topPad);s.push(d)}let a=t.net,l=t.center,c=new M(t.center,t.center);for(let h of i){let u=this.getSafeClearance(a,h,5);if(!ne.eq(u,0))for(let d of s)l=this.checkClearance1(c,d,u,h),c=new M(c.start(),l)}return l}checkAdsorp(t){if(t instanceof gl)t=new Os(t.net,$r.TOP_COPPER,t.center,t.center,t.topPad);else if(t instanceof Os&&t.start.distance2(t.end)==0)return t.end;let e=re.getInstance().getMaxSafe(),r=t.bbox().extendOfSize(e),i=this.map.getShoveItems(t.layer,r);this.map.getObstacleItems(t.layer,r).forEach(c=>{i.push(c)}),this.addMultiObstacle(r,i),this.addOutlineObstacle(r,i);let s=t.net,a=this.getPrimitive(t),l=a.end();for(let c of i){let h=this.getSafeClearance(s,c),d=Math.max(h,0);ne.eq(d,0)||(l=this.checkClearance1(a,t,d,c),a=this.getNewPrimitive(a,l))}return l}addMultiObstacle(t,e){this.map.getObstacleItems($r.MULTI,t).forEach(i=>{e.push(i)})}addOutlineObstacle(t,e){this.map.getObstacleItems($r.OUTLINE,t).forEach(i=>{e.push(i)})}checkObstacle(t){if(t.start.distance2(t.end)==0)return t.end;let e=re.getInstance().getMaxSafe(),r=t.bbox().extendOfSize(e),i=this.map.getObstacleItems(t.layer,r);this.addMultiObstacle(r,i),this.addOutlineObstacle(r,i);let n=t.end,s=t.net,a=this.getPrimitive(t);for(let l of i){let c=this.getSafeClearance(s,l),u=Math.max(c,0);ne.eq(u,0)||(n=this.checkClearance1(a,t,u,l),a=this.getNewPrimitive(a,n))}return n}checkVia(t,e){let r=re.getInstance().getMaxSafe(),i=new _e().ext2(t.center).ext2(e).ext7(r+t.topPad/2).build1(),n=new Array,s=new Array,a=this.map.getLayerRTreePcbLayers();for(;a.hasNext();){let d=a.next();this.map.getObstacleItems(d,i).forEach(g=>{n.push(g)}),(d.equals($r.OUTLINE)||d.equals($r.MULTI))&&(d=$r.TOP_COPPER);let m=new Os(t.net,d,t.center,e,t.topPad);s.push(m)}let l=this.map.getRealTimeLayerRTreePcbLayers();for(;l.hasNext();){let d=l.next();this.map.getObstacleItems(d,i).forEach(g=>{n.push(g)}),(d.equals($r.OUTLINE)||d.equals($r.MULTI))&&(d=$r.TOP_COPPER);let m=new Os(t.net,d,t.center,e,t.topPad);s.push(m)}this.addMultiObstacle(i,n),this.addOutlineObstacle(i,n);let c=t.net,h=e,u=new M(t.center,e);for(let d of n){let p=this.getSafeClearance(c,d,5);if(!ne.eq(p,0))for(let m of s)h=this.checkClearance1(u,m,p,d),u=new M(u.start(),h)}return h}checkSolidVia(t,e){let r=re.getInstance().getMaxSafe(),i=t.bbox().extendOfSize(r),n=this.map.getObstacleItems(e,i);this.addMultiObstacle(i,n),this.addOutlineObstacle(i,n);let s=t.net,a=null,l=Number.MAX_VALUE,c=new M(t.center,t.center);for(let h of n){let u=this.getSafeClearance(s,h,5);if(ne.eq(u,0))continue;let d=h.shape(e,0),p=t.shape(e,u);if(d instanceof ge){d=d.asClose(),p=p.asClose();for(let m of p.primitives)for(let g of d.primitives)if(Pt(m,g)>0){let P=new er(c,g).getDistance();P<l&&(l=P,a=h);break}}}return a}checkClearance1(t,e,r,i){return i instanceof Os||i instanceof Rm?this.checkTrackTrack(t,e,i,r):i instanceof Jp?this.checkTrackPad(t,e,i,r):i instanceof gl?this.checkTrackVia(t,e,i,r):i instanceof c1?this.checkTrackBox(t,e,i,r):i instanceof MO?this.checkTrackProfile(t,e,i,r):i instanceof Q0?this.checkTrackLine(t,e,i,r):i instanceof Db?this.checkTrackProhibit(t,e,i,r):i instanceof by?this.checkTrackProfile(t,e,i,r):i instanceof E0?this.checkTrackBoard(t,e,i,r):t.end()}checkTrackTrack(t,e,r,i){if(this.isSameNet(e.net,r.net)||!e.layer.equals(r.layer))return t.end();let n=e.width,s=r.width,a=this.getPrimitive(r),c=new er(t,a).getDistance(),h=i+n/2+s/2,u=Math.pow(10,2);if(Math.round((c-h)*u)/u>=-1e-8)return t.end();{let p;return t instanceof M?a instanceof M?p=this.calcuLineLine(t,a,h):p=this.calcuLineArc(t,a,!0,h):a instanceof M?p=this.calcuLineArc(a,t,!1,h):p=this.calcuArcArc(t,a,h),this.adsorp=r,p}}checkTrackPad(t,e,r,i){if(e.net===r.net)return t.end();let n=ve(i+e.width/2,2),s=r.shape(e.layer,0),a=r.shape($r.MULTI,0),l=Number.MAX_VALUE,c=Number.MAX_VALUE;if(s!=null&&(s=s.asClose(),l=this.getMin(t,s)),a!=null&&(a=a.asClose(),c=this.getMin(t,a)),ne.lesseq(l,c)&&ne.less(l,n)){let h=this.getEnd(t,s,n);return this.adsorp=r,h}else if(ne.less(c,l)&&ne.less(c,n)){let h=this.getEnd(t,a,n);return this.adsorp=r,h}return t.end()}checkTrackVia(t,e,r,i){if(e.net===r.net||r instanceof yy&&r.shape(e.layer,0)==null)return t.end();let n=r.shape(e.layer,0),s=this.getMin(t,n),a=ve(i+e.width/2,2);if(ne.less(s,a)){let l=this.getEnd(t,n,a);return this.adsorp=r,l}return t.end()}checkTrackProhibit(t,e,r,i){if(!r.track)return t.end();let n=r.shape(e.layer,0);if(n!=null){n=n.asClose();let s=this.getMin(t,n),a=ve(i+e.width/2,2);if(ne.less(s,a)||s==a&&s==0){let l=this.getEnd(t,n,a);return this.adsorp=r,l}}return t.end()}checkTrackProfile(t,e,r,i){if(r instanceof MO&&this.isSameNet(e.net,r.net))return t.end();let n=r.shape(e.layer,0);if(n!=null){n=n.asClose();let s=this.getMin(t,n),a=ve(i+e.width/2,2);if(ne.less(s,a)||s==a&&s==0){let l=this.getEnd(t,n,a);return this.adsorp=r,l}}return t.end()}checkTrackLine(t,e,r,i){if(r instanceof Q0&&this.isSameNet(e.net,r.net))return t.end();let n=r.shape(e.layer,0),s=ve(e.width/2+r.width/2,2),a=t.bbox();for(let l of n.primitives){let c=l.bbox().extendOfSize(s+i);if(!a.isIntersect(c))continue;let h=l.stroke(s*2,wr.ROUND,ae.CCW).asClose(),u=this.getMin(t,h);if(ne.less(u,i)||u==i&&u==0){let d=this.getEnd(t,h,i);this.adsorp=r,t=this.getNewPrimitive(t,d)}}return t.end()}checkTrackBoard(t,e,r,i){let n=r.shape(e.layer,0),s=e.width/2,a=t.bbox();for(let l of n.primitives){let c=l.bbox().extendOfSize(s+i);if(!a.isIntersect(c))continue;let h=l.stroke(s*2,wr.ROUND,ae.CCW).asClose(),u=this.getMin(t,h);if(ne.less(u,ve(i,2))||u==ve(i,2)&&u==0){let d=this.getEnd(t,h,i);this.adsorp=r,t=this.getNewPrimitive(t,d)}}return t.end()}checkTrackBox(t,e,r,i){let n=r.shape(e.layer,0);if(n!=null){n=n.asClose();let s=this.getMin(t,n),a=ve(i+e.width/2,2);if(ne.less(s,a)){let l=this.getEnd(t,n,a);return this.adsorp=r,l}}return t.end()}getEnd(t,e,r){let i=t.end(),n=new Xl(ge.build2([t]),e,r);switch(n.relation){case 3:return n.distance>r?i:this.getInterEnd(t,e,r);case 0:return this.getInterEnd(t,e,r);case 1:case 2:return t.start()}}getInterEnd(t,e,r){let i=t.end();for(let n of e.primitives)n instanceof M?t instanceof M?(i=this.calcuLineLine(t,n,r),t=new M(t.start(),i)):(i=this.calcuLineArc(n,t,!1,r),t=q.build2(t.center,t.startAngle,i.angleD(t.center),t.rx,t.ry,t.sweep())):n instanceof q&&(t instanceof M?(i=this.calcuLineArc(t,n,!0,r),t=new M(t.start(),i)):(i=this.calcuArcArc(t,n,r),t=q.build2(t.center,t.startAngle,i.angleD(t.center),t.rx,t.ry,t.sweep())));return i}getNewPrimitive(t,e){return t instanceof M?new M(t.start(),e):q.build2(t.center,t.startAngle,e.angleD(t.center),t.rx,t.ry,t.sweep())}getPrimitive(t,e=!0){if(e){let r;return t instanceof Os?r=new M(t.start,t.end):r=q.build2(t.arc.center,t.arc.startAngle,t.arc.endAngle(),t.arc.rx,t.arc.rx,t.arc.sweep()),r}else{let r;if(t instanceof Os)r=new M(t.end,t.start);else{let i=t.arc.sweep()==ae.CCW?ae.CW:ae.CCW;r=q.build2(t.arc.center,t.arc.endAngle(),t.arc.startAngle,t.arc.rx,t.arc.rx,i)}return r}}isSameNet(t,e){return t===e}isSameLayer(t,e){return t===e}calcuLineLine(t,e,r){let i=t.start(),n=t.end(),s=e.stroke(r*2,wr.ROUND,ae.CCW).asClose();if(new Dc().pointInPolyline(i,s))return i;let l=new Set;for(let c of s.primitives){let h=Pt(t,c);if(h>0)for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);l.add(d)}}if(l.size>0){let c=n.distance1(i);l.forEach(h=>{let u=h.distance1(i);u<c&&(n=h,c=u)})}return n}calcuLineArc(t,e,r,i){if(r){let n=t.start(),s=t.end();if(i=i<.01?0:i,i==0)return t.start();let a=e.stroke(i*2,wr.ROUND,ae.CCW).asClose();if(new Dc().pointInPolyline(n,a))return n;let c=new Set;for(let h of a.primitives){let u=Pt(t,h);if(u>0)for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);c.add(p)}}if(c.size>0){let h=s.distance1(n);c.forEach(u=>{let d=u.distance1(n);d<h&&(s=u,h=d)})}return s}else{let n=e.start(),s=e.end(),a=(e.startAngle%360+360)%360,l=t.stroke(i*2,wr.ROUND,ae.CCW).asClose();if(new Dc().pointInPolyline(n,l))return n;let h=new Set;for(let u of l.primitives){let d=Pt(e,u);if(d>0)for(let p=0;p<d;p+=2){let m=new S(Ee[p],Ee[p+1]);h.add(m)}}if(h.size>0){let u=e.center,d=e.sweep(),p=e.sweepAngle;h.forEach(m=>{let g=(m.angleD(u)%360+360)%360;if(d==ae.CCW){let y=(g-a+360)%360;y<p&&(s=m,p=y)}else{let y=(g-a-360)%360;y>p&&(s=m,p=y)}})}return s}}calcuArcArc(t,e,r){let i=t.start(),n=t.end(),s=(t.startAngle%360+360)%360,a=e.stroke(r*2,wr.ROUND,ae.CCW).asClose();if(new Dc().pointInPolyline(i,a))return i;let c=new Set;for(let h of a.primitives){let u=Pt(t,h);if(u>0)for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);c.add(p)}}if(c.size>0){let h=t.center,u=t.sweep(),d=t.sweepAngle;c.forEach(p=>{let m=(p.angleD(h)%360+360)%360;if(u==ae.CCW){let g=(m-s+360)%360;g<d&&(n=p,d=g)}else{let g=(m-s-360)%360;g>d&&(n=p,d=g)}})}return n}getMin(t,e){let r=Number.MAX_VALUE;for(let i of e.primitives){let n=new er(t,i).getDistance();n<r&&(r=n)}return ve(r,2)}clear(){T4.clear()}};var O3=class{constructor(t){this.bheap=new Array;this.count=0;this.comp=t}size(){return this.count}add(t){this.count>0?this.siftUp(this.count,t):this.bheap[0]=t,this.count++}remove(t){let e=this.bheap.indexOf(t);e>-1&&(this.bheap.splice(e,1),this.count--),this.count<0&&(this.count=0)}poll(){for(;;)if(this.count>0){this.count--;let t=this.bheap[0];return this.count>0&&this.siftDown(0,this.bheap[this.count]),t}else return null}siftUp(t,e){for(;t>0;){let r=t-1>>>1,i=this.bheap[r];if(this.comp(e,i)>=0)break;this.bheap[t]=i,t=r}this.bheap[t]=e}siftDown(t,e){let r=this.count>>>1;for(;t<r;){let i=(t<<1)+1,n=this.bheap[i],s=i+1;if(s<this.count){let a=this.bheap[s];this.comp(n,a)>0&&(i=s,n=a)}if(this.comp(e,n)<=0)break;this.bheap[t]=n,t=i}this.bheap[t]=e}};var xie=class{constructor(t){this.points=new Array;this.line=t}addInters(t){!t.equals1(this.line.start())&&!t.equals1(this.line.end())&&this.points.push(t)}sort(){Er(this.points,(r,i)=>r.distance2(this.line.start())-i.distance2(this.line.start()),0,this.points.length),this.points.push(this.line.end());let t=new Array,e=this.line.start();t.push(e);for(let r of this.points)e.distance2(r)>1e-8&&(t.push(r),e=r);return t}};var Rie=class extends gl{constructor(){super(...arguments);this.locked=!1}};var b8=class{checkLock(t){return t instanceof wp||t instanceof Rie?t.locked:!1}pointInPolyline(t,e){if(!e.bbox().isContains(t))return!1;let i=[];return e.points(1,n=>{i.push(n)}),this.isSelect(t.x,t.y,i)}isSelect(t,e,r){let i=!1;for(let a=0,l=r.length-1;a<l;a++){let c=r[a],h=r[a+1];if(t==c.x&&e==c.y||t==h.x&&e==h.y)return!0;if(c.y<e&&h.y>=e||c.y>=e&&h.y<e){let u=c.x+(e-c.y)*(h.x-c.x)/(h.y-c.y);if(t==u)return!0;u>t&&(i=!i)}}let n=r[r.length-1],s=r[0];if(t==n.x&&e==n.y||t==s.x&&e==s.y)return!0;if(n.y<e&&s.y>=e||n.y>=e&&s.y<e){let a=n.x+(e-n.y)*(s.x-n.x)/(s.y-n.y);if(t==a)return!0;a>t&&(i=!i)}return i}checkIntersection(t,e){for(let r of t.primitives)for(let i of e.primitives)if(Pt(r,i)>0)return!0;return!1}checkAroundStartpoint(t,e,r){let i=e.path[0].sub(e.path[1]).normalize(),n=e.path[0].add(i.mul(r+e.tracks[0].width/2)),s=ge.build4(t);for(let a of s.primitives)if(a instanceof M){let l=a.end().sub(a.start()).normalize(),c=n.sub(a.start()).normalize(),h=l.cross(c),u=c.dot(i);if(ne.eq(h,0)&&ne.eq(u,0))return!0}return!1}};var Xn=class{constructor(){this._arcFirst=!1}get arcFirst(){return this._arcFirst}set arcFirst(t){this._arcFirst=t}degree45Model(t,e){let r=e.sub(t),i=Math.abs(r.x),n=Math.abs(r.y),s;if(i>n){let a=r.x/i*n;s=new S(a,r.y)}else if(i==n)s=r;else{let a=r.y/n*i;s=new S(r.x,a)}return[t.add(s),e.sub(s)]}degree90Model(t,e){let r=e.sub(t),i=new S(r.x,0);return[t.add(i),e.sub(i)]}degree45(t,e,r){let i=this.degree45Model(e,r),n=i[0].sub(e);if(ne.eq(n.x,0)&&ne.eq(n.y,0))return[e,i[1],r];let s=i[1].sub(e);if(ne.eq(s.x,0)&&ne.eq(s.y,0))return[e,i[0],r];n=n.normalize(),s=s.normalize();let a=Math.acos(t.dot(n)),l=Math.acos(t.dot(s));return a>l?[e,i[1],r]:[e,i[0],r]}degree90(t,e,r){let i=this.degree90Model(e,r),n=i[0].sub(e).normalize();if(ne.eq(n.x,0)&&ne.eq(n.y,0))return[e,i[1],r];let s=i[1].sub(e).normalize();if(ne.eq(s.x,0)&&ne.eq(s.y,0))return[e,i[0],r];let a=Math.acos(t.dot(n)),l=Math.acos(t.dot(s));return a>l?[e,i[1],r]:[e,i[0],r]}arc(t,e,r){return new Yn().tangentToArc(t,e,r)}arc90(t,e,r){let i=this.degree45(t,e,r),n=i[1].sub(i[0]);return Math.abs(n.x)<1e-5||Math.abs(n.y)<1e-5?this.arcFirst=!1:this.arcFirst=!0,i}arc45(t,e,r){let i=this.degree45(t,e,r),n=i[1].sub(i[0]).length(),s=i[2].sub(i[1]).length(),a,l=n-s;return ne.greater(l,0)?(this.arcFirst=!1,a=i[1].sub(i[0]).normalize().mul(l).add(i[0])):(this.arcFirst=!0,a=i[2].sub(i[1]).normalize().mul(l).add(i[2])),[e,a,r]}};var CCe=Math.PI/4;var tR=Math.sqrt(2)/2,yDi=Math.cos(CCe/2),bDi=Math.cos(CCe),bCe=new S(1,1).normalize(),PCe=new S(-1,1).normalize(),TCe=new S(-1,-1).normalize(),ICe=new S(1,-1).normalize(),Wa=class o{static OctagonalHull(t,e,r,i){let n=new Array;return n.push(new S(t.x-r,t.y-r+i)),n.push(new S(t.x-r+i,t.y-r)),n.push(new S(t.x+e.x+r+i,t.y-r)),n.push(new S(t.x+e.x+r,t.y-r+i)),n.push(new S(t.x+e.x+r,t.y+e.y+r-i)),n.push(new S(t.x+e.x+r-i,t.y+e.y+r)),n.push(new S(t.x-r+i,t.y+e.y+r)),n.push(new S(t.x-r,t.y+e.y+r-i)),ge.build4(n).asClose()}static OctagonalHull1(t,e){let r=new Array,i=CCe,n=S.getVector2(Math.PI/8),s=0;for(;s<8;){let a=t.add(n.mul(e));r.push(a),n=n.rotate(S.ORIGIN,i),s++}return ge.build4(r).asClose()}static segmentHull(t,e,r){let i=t.width/2+e,n=i/(.5+Math.sqrt(.5))/2,a=t.end.sub(t.start).normalize().angle(S.ORIGIN),l=Ae.rotateZ(a),c=new S(i,0).multiply4(l),h=new S(0,i).multiply4(l),u=new S(n,0).multiply4(l),d=new S(0,n).multiply4(l),p=t.start,m=t.end,g=p.sub(h).sub(u),y=p.sub(c).sub(d),b=p.sub(c).add(d),P=p.add(h).sub(u),T=m.add(h).add(u),I=m.add(c).add(d),C=m.add(c).sub(d),E=m.sub(h).add(u);return ge.build4([g,y,b,P,T,I,C,E,g])}static getLineHull(t,e){let r=t.start(),i=t.end(),s=i.sub(r).normalize().angle(S.ORIGIN),a=Ae.rotateZ(s),l=e/(.5+Math.sqrt(.5))/2,c=new S(e,0).multiply4(a),h=new S(0,e).multiply4(a),u=new S(l,0).multiply4(a),d=new S(0,l).multiply4(a),p=r.sub(h).sub(u),m=r.sub(c).sub(d),g=r.sub(c).add(d),y=r.add(h).sub(u),b=i.add(h).add(u),P=i.add(c).add(d),T=i.add(c).sub(d),I=i.sub(h).add(u);return ge.build4([p,I,T,P,b,y,g,m,p])}static convexHull1(t,e){let r=t.bbox().extendOfSize(e),i=new M(r.LL(),r.UL()),n=new M(r.LL(),r.LR()),s=new M(r.LR(),r.UR()),a=new M(r.UR(),r.UL()),l=Math.max(r.height(),r.width()),c=new S(l,l),h=new S(-l,l),u=new M(r.LL().sub(h),r.LL().add(h)),d=new M(r.LR().sub(c),r.LR().add(c)),p=new M(r.UR().sub(h),r.UR().add(h)),m=new M(r.UL().sub(c),r.UL().add(c)),g=(o.getMinDistance(u,t,r.LL(),e)-e)*tR,y=(o.getMinDistance(d,t,r.LR(),e)-e)*tR,b=(o.getMinDistance(p,t,r.UR(),e)-e)*tR,P=(o.getMinDistance(m,t,r.UL(),e)-e)*tR,T=new S(g,g),I=new S(-y,y),C=new S(-b,-b),E=new S(P,-P),O=new M(u.start().add(T),u.end().add(T)),_=new M(d.start().add(I),d.end().add(I)),x=new M(p.start().add(C),p.end().add(C)),v=new M(m.start().add(E),m.end().add(E));Pt(O,i);let D=new S(Ee[0],Ee[1]);Pt(O,n);let w=new S(Ee[0],Ee[1]);Pt(_,n);let F=new S(Ee[0],Ee[1]);Pt(_,s);let H=new S(Ee[0],Ee[1]);Pt(x,s);let z=new S(Ee[0],Ee[1]);Pt(x,a);let V=new S(Ee[0],Ee[1]);Pt(v,a);let W=new S(Ee[0],Ee[1]);Pt(v,i);let L=new S(Ee[0],Ee[1]);return ge.build4([D,w,F,H,z,V,W,L,D])}static convexHull(t,e){let r=null,i=null,n=null,s=null;function a(W){(r==null||W.sub(r).dot(PCe)>0)&&(r=W)}function l(W){(i==null||W.sub(i).dot(bCe)>0)&&(i=W)}function c(W){(n==null||W.sub(n).dot(TCe)>0)&&(n=W)}function h(W){(s==null||W.sub(s).dot(ICe)>0)&&(s=W)}function u(W){for(let L of W)a(L),l(L),c(L),h(L)}let d=null;for(let W of t.primitives)W instanceof M?u([W.start()]):W instanceof q&&u(o.getArcPoint(W)),d=W;d!=null&&u([d.end()]);let p=t.bbox().extendOfSize(e),m=new M(p.LL(),p.UL()),g=new M(p.LL(),p.LR()),y=new M(p.LR(),p.UR()),b=new M(p.UR(),p.UL()),P=Math.max(p.height(),p.width()),T=new S(P,P),I=new S(-P,P),C=new M(n.sub(I).add(TCe.mul(e)),n.add(I).add(TCe.mul(e))),E=new M(s.sub(T).add(ICe.mul(e)),s.add(T).add(ICe.mul(e))),O=new M(i.sub(I).add(bCe.mul(e)),i.add(I).add(bCe.mul(e))),_=new M(r.sub(T).add(PCe.mul(e)),r.add(T).add(PCe.mul(e)));Pt(C,m);let x=new S(Ee[0],Ee[1]);Pt(C,g);let v=new S(Ee[0],Ee[1]);Pt(E,g);let D=new S(Ee[0],Ee[1]);Pt(E,y);let w=new S(Ee[0],Ee[1]);Pt(O,y);let F=new S(Ee[0],Ee[1]);Pt(O,b);let H=new S(Ee[0],Ee[1]);Pt(_,b);let z=new S(Ee[0],Ee[1]);Pt(_,m);let V=new S(Ee[0],Ee[1]);return ge.build4([x,v,D,w,F,H,z,V,x])}static convexHullPoints(t,e){let r=t.bbox().extendOfSize(e),i=new M(r.LL(),r.UL()),n=new M(r.LL(),r.LR()),s=new M(r.LR(),r.UR()),a=new M(r.UR(),r.UL()),l=Math.max(r.height(),r.width()),c=new S(l,l),h=new S(-l,l),u=new M(r.LL().sub(h),r.LL().add(h)),d=new M(r.LR().sub(c),r.LR().add(c)),p=new M(r.UR().sub(h),r.UR().add(h)),m=new M(r.UL().sub(c),r.UL().add(c)),g=(o.getMinDistance(u,t,r.LL(),e)-e)*tR,y=(o.getMinDistance(d,t,r.LR(),e)-e)*tR,b=(o.getMinDistance(p,t,r.UR(),e)-e)*tR,P=(o.getMinDistance(m,t,r.UL(),e)-e)*tR,T=new S(g,g),I=new S(-y,y),C=new S(-b,-b),E=new S(P,-P),O=new M(u.start().add(T),u.end().add(T)),_=new M(d.start().add(I),d.end().add(I)),x=new M(p.start().add(C),p.end().add(C)),v=new M(m.start().add(E),m.end().add(E));Pt(O,i);let D=new S(Ee[0],Ee[1]);Pt(O,n);let w=new S(Ee[0],Ee[1]);Pt(_,n);let F=new S(Ee[0],Ee[1]);Pt(_,s);let H=new S(Ee[0],Ee[1]);Pt(x,s);let z=new S(Ee[0],Ee[1]);Pt(x,a);let V=new S(Ee[0],Ee[1]);Pt(v,a);let W=new S(Ee[0],Ee[1]);Pt(v,i);let L=new S(Ee[0],Ee[1]);return[D,w,F,H,z,V,W,L]}static getArcPoint(t){if(t.isCircle()){let c=new Array;c.push(t.start());for(let h=0;h<8;h++){let u=t.pointOn(h*45);c.push(u)}return c}let e=t.sweep()==ae.CW,r=e?t.endAngle():t.startAngle;r=(r+360)%360;let i=e?t.startAngle:t.endAngle();i=(i+360)%360;let n=r/45,s=i/45,a=new Array;if(n>s){for(let h=Math.ceil(n);h<8;h++)a.push(h);let c=Math.floor(s);for(let h=0;h<=c;h++)a.push(h)}else if(n<s){let c=Math.floor(s);for(let h=Math.ceil(n);h<=c;h++)a.push(h)}let l=new Array;l.push(t.start());for(let c of a){let h=t.pointOn(c*45);l.push(h)}return l}static getMinDistance(t,e,r,i){let n=Number.MAX_VALUE,s=null;for(let a of e.primitives)if(s=a.bbox().extendOfSize(i),s.isContainsX1(r.x)||s.isContainsY1(r.y)){let c=new er(t,a).getDistance();c<n&&(n=c)}return n}static getArcHull(t,e){return o.getArcStroke(t,e,"45")}static getArcRect(t,e){return o.getArcStroke(t,e,"90")}static getArcStroke(t,e,r){let i=t.rx+e,n=t.rx-e;n<=0&&(n=.001);let s=t.sweep()==ae.CCW,a=s?t.pointOn(t.endAngle()):t.pointOn(t.startAngle),l=s?t.pointOn(t.startAngle):t.pointOn(t.endAngle()),c=s?t.startAngle:t.startAngle+t.sweepAngle,h=s?t.sweepAngle:-t.sweepAngle,u=q.build3(t.center,c,h,i,i),d=u.pointOn(u.endAngle()).angleD(a),p=q.build3(a,d,180,e,e),m=q.build3(t.center,c+h,-h,n,n),g=m.pointOn(m.endAngle()).angleD(l),y=q.build3(l,g,180,e,e),b=o.points(u,.1),P=o.points(p,.1),T=m.points(.1),I=o.points(y,.1),C=b.concat(P).concat(T).concat(I),E=new Array,O=null,_=new Xn;for(let x of C){if(O!=null){let v=r=="45"?_.degree45Model(O,x):_.degree90Model(O,x),D=x.sub(O).normalize().cross(v[0].sub(O).normalize());ne.lesseq(D,0)?(o.add2Result(E,O,v[0]),o.add2Result(E,v[0],x)):(o.add2Result(E,O,v[1]),o.add2Result(E,v[1],x))}O=x}return E}static add2Result(t,e,r){e.equals1(r)||t.push(new M(e,r))}static points(t,e){let r=t.rx+e,i=t.rx/r,n=Math.ceil(Math.abs(t.sweepAngle/zt.toDegrees(Math.acos(i))/2)),s=t.sweepAngle/n,a=[],l=t.startAngle+s,c=zt.toRadians(s/2),h=Math.cos(c),u=Math.sin(c),d=(1-h)*t.rx;a.push(t.start());let p=a[0],m,g=new S(1,0),y=new S(0,1),b=new S(1,1).normalize();for(let P=1;P<=n;P++,l+=s){m=t.center.add(new S(t.rx*Math.cos(zt.toRadians(l)),t.rx*Math.sin(zt.toRadians(l))));let T=u*p.distance1(m),I=m.sub(p),C=new S(Math.abs(I.x),Math.abs(I.y));if(ne.less(Math.abs(C.cross(g)),T)||ne.less(Math.abs(C.cross(y)),T)||ne.less(Math.abs(C.cross(b)),T)){let E=l-s/2,_=t.center.add(new S(r*Math.cos(zt.toRadians(E)),r*Math.sin(zt.toRadians(E)))).sub(t.center).normalize().mul(d),x=m.sub(p).normalize().mul(d);a.push(p.add(_).add(x)),a.push(m.add(_).add(x.mul(-1)))}a.push(m),p=m}return a.pop(),a.push(t.end()),a}};var s3t=0;function Su(o){if(o.length>2){let t=o[0],e=new Array;e.push(t);for(let r=1,i=o.length;r<i;r++){let n=o[r],s=!1;if(r+1<i){let a=n.sub(t).normalize(),l=o[r+1].sub(t).normalize(),c=a.cross(l);Math.abs(c)<1e-8&&(s=!0)}s||(e.push(n),t=n)}return e}else return o}var P8=class{constructor(){this.check=new b8}filterRepeat(t){let e=new Array,r=null;for(let i of t)(r==null||r.distance2(i)>1e-8)&&(e.push(i),r=i);return e}aroundHull(t,e,r){if(!Array.isArray(e)||e.length<2)return e;e=this.filterRepeat(e);let i=this.convertPath(e),n=this.convertPolyline(t,r),s=this.getSides(i),a=this.getSides(n),l=this.intersection(s,a),c=this.getEndpoint(s),h=this.getEndpoint(a),u=new Array,d=null;l=this.filterInters(c,h,l);let p=l[l.length-1];for(let m of c)if(d==null)if(this.has(l,m)&&m.distance2(p)>1e-8){this.deletePoint(l,m),u.push(m);let g=!1;for(;;){let y=!1;for(let b of h){if(g)if(this.has(c,b)){u.push(b),d=b,y=!0;break}else u.push(b);b.distance2(m)<1e-8&&(g=!0)}if(y||!g)break}}else u.push(m);else m.distance2(d)<1e-8&&(d=null);return this.reducePoints(u)}convertPolyline(t,e){let r=nh(t);return e==ae.CW&&r||e==ae.CCW&&!r?t.reverse().primitives:t.primitives}convertPath(t){let e=new Array,r=t[0];for(let i=1,n=t.length;i<n;i++){let s=t[i],a=new M(r,s);e.push(a),r=s}return e}directError(t,e,r){let i=e.indexOf(t);return i>-1&&i+1<e.length&&!this.check.pointInPolyline(t.add(e[i+1]).mul(.5),r)}filterInters(t,e,r){let i=new Array,n=-1,s=new Array;for(let c=0,h=t.length;c<h;c++){let u=t[c];this.has(r,u)&&(c-n==1||s.length>0&&(i.push(s),s=new Array),s.push(u),n=c)}s.length>0&&i.push(s);let a=e.length,l=new Array;for(let c of i)if(c.length>1)for(let h=0,u=c.length;h<u;h++){let d=this.getIndex(e,c[h]);if(d>-1){let p=d+1;p>=a&&(p=0),h+1<u&&e[p].distance2(c[h+1])<1e-8||l.push(c[h])}else l.push(c[h])}else l.push(c[0]);return l}getIndex(t,e){let r=t.indexOf(e);if(r<0){for(let i=0,n=t.length;i<n;i++)if(t[i].distance2(e)<1e-8)return i}return r}intersection(t,e){let r=new Array;for(let i of t)for(let n of e)if(i.line.bbox().isIntersect(n.line.bbox())){let s=Pt(i.line,n.line);for(let a=0;a<s;a+=2){let l=new S(Ee[a],Ee[a+1]);i.addInters(l),n.addInters(l),r.push(l)}}return r}getSides(t){let e=new Array;for(let r of t){let i=new xie(r);e.push(i)}return e}getEndpoint(t){let e=new Array;e.push(t[0].line.start());for(let r of t){let i=r.sort();i.shift(),i.forEach(n=>{e.push(n)})}return e}getPolyline4Sweep(t,e){let r=nh(ge.build4(t));return e==ae.CW&&r||e==ae.CCW&&!r?t.reverse():t}has(t,e){for(let r of t)if(r.distance2(e)<1e-8)return!0;return!1}deletePoint(t,e){let r=0,i=t.length;for(;r<i&&!(t[r].distance2(e)<1e-8);r++);r<i&&t.splice(r,1)}filter(t){let e=new Array,r=t[0];e.push(r);for(let i=1,n=t.length;i<n;i++){let s=t[i],a=!1;if(i+1<n){let l=s.sub(r).normalize(),c=t[i+1].sub(r).normalize(),h=l.cross(c);Math.abs(h)<1e-8&&(a=!0)}if(!a){let l=t[i];l.distance2(r)>1e-8&&(e.push(l),r=l)}}return r.distance2(t[t.length-1])>1e-8&&e.push(t[t.length-1]),e=this.reducePoints(e),e}reducePoints(t){if(t.length>2){let e=t[0],r=new Array;r.push(e);for(let i=1,n=t.length;i<n;i++){let s=t[i],a=!1;if(i+1<n){let l=s.sub(e).normalize(),c=t[i+1].sub(e).normalize(),h=l.cross(c);Math.abs(h)<1e-8&&(a=!0)}a||(r.push(s),e=s)}return r}else return t}route(t,e,r){let i=t.tracks[0].layer,n=0,s=0;if(t.startVia!=null&&e.checkSolidVia(t.startVia,i)!=null)return 2;if(t.endVia!=null)return e.checkSolidVia(t.endVia,i)!=null?2:1;let a=0,l=this.copyChain(t),c=this.copyChain(t);for(;a<10;){if(n!=2&&(n=this.singleStep(l,e,ae.CW)),s!=2&&(s=this.singleStep(c,e,ae.CCW)),n==1&&s==1||n==2&&s==2){let u=l.length,d=c.length;u>d?this.replaceChain(t,c.path):this.replaceChain(t,l.path);break}else if(n==1){this.replaceChain(t,l.path);break}else if(s==1){this.replaceChain(t,c.path);break}a++}if(a==10){let u=l.length,d=c.length;u>d?this.replaceChain(t,c.path):this.replaceChain(t,l.path)}return s==1||n==1?1:2}copyChain(t){let e=new Lm(t.map);return e.tracks=Array.from(t.tracks),e.path=Array.from(t.path),e}singleStep(t,e,r){let i=e.getSolidObstacle(t);if(i!=null){let n=t.path[t.path.length-1],s=i.shape(t.tracks[0].layer,0);if(s instanceof ge){let a=Wa.convexHull(s.asClose(),1+t.tracks[0].width/2);if(this.check.pointInPolyline(n,a)){let c=e.check(t.firstTouchTrack),h=new Os(t.firstTouchTrack.net,t.firstTouchTrack.layer,t.firstTouchTrack.start,c,t.firstTouchTrack.width,t.firstTouchTrack.id);return t.tracks.pop(),t.path.pop(),t.tracks.push(h),t.path.push(c),1}let l=this.aroundHull(a,t.path,r);return this.replaceChain(t,l),0}}return 2}replaceChain(t,e){let r=t.tracks[0].width,i=t.tracks[0].net,n=t.tracks[0].layer,s=new Array,a=e[0];for(let l=1,c=e.length;l<c;l++){let h=e[l],u=new t0(i,n,a,h,r,"walk"+s3t++,-1);s.push(u),a=h}t.path.length=0,t.tracks.length=0,t.all.clear(),t.path.push(s[0].start);for(let l of s)t.tracks.push(l),t.all.add(l),t.path.push(l.end)}};var Die=class{constructor(t){this.walk=new P8;this.hulls=new Array;this.collide=t}onCollideSolid(t,e,r){let i=e.shape(t.tracks[0].layer,0);if(i instanceof ge&&!t.obstacles.has(e)){let n=this.getShapeHulls(e,i,r+t.tracks[0].width/2+.001),s=Array.from(t.path);for(let l of n)s=this.walk.aroundHull(l,s,ae.CCW);let a=Array.from(t.path);for(let l of n)a=this.walk.aroundHull(l,a,ae.CW);return[{sweep:ae.CCW,path:s},{sweep:ae.CW,path:a}]}return[]}getShapeHulls(t,e,r){let i=new Array;if(t instanceof E0)for(let n of e.primitives){let s=n.stroke(.001,wr.ROUND,ae.CW).asClose(),a=Wa.convexHull(s,r);i.push(a)}else if(t instanceof Q0)for(let n of e.primitives){let s=n.stroke(t.width,wr.ROUND,ae.CW).asClose(),a=Wa.convexHull(s,r);i.push(a)}else{let n=Wa.convexHull(e,r);i.push(n)}return i}onCollideRope(t,e,r){let i=t.tracks[0].width,n=ge.build4(t.path),s=new M(e.start,e.end),a=i/2+r+e.width/2,l=new Array;for(let h of n.primitives){let u=Pt(h,s);for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);l.push(p)}}Er(l,(h,u)=>h.distance2(e.start)-u.distance2(e.start),0,l.length);let c=s.end().sub(s.start()).normalize();if(l.length>0){let h=new gl(e.pcbVia.id,e.pcbVia.net,l[l.length-1].add(c.mul(a)),e.pcbVia.holeDiameter,e.pcbVia.topPad,e.pcbVia.innerPad,e.pcbVia.botPad,e.pcbVia.mask,e.pcbVia.unuseLayers);return this.onCollideVia(t,h,r)}else{let h=Number.MAX_VALUE;for(let u of n.primitives){let p=new er(u,s).getDistance();p<h&&(h=p)}if(h<a){let u=new gl(e.pcbVia.id,e.pcbVia.net,e.end,e.pcbVia.holeDiameter,e.pcbVia.topPad,e.pcbVia.innerPad,e.pcbVia.botPad,e.pcbVia.mask,e.pcbVia.unuseLayers);return this.onCollideVia(t,u,r)}else return this.onCollideVia(t,e.pcbVia,r)}}onCollideVia(t,e,r){let i=t.tracks[0].width,n=ge.build4(t.path),s=this.fixCenter(t,e),a=new M(s,s),l=Number.MAX_VALUE,c=null,h=i/2+r+e.topPad/2;for(let u of n.primitives){let d=new er(u,a),p=d.getDistance();if(p<l&&(l=p,c=d.getLine(),l==0)){let m=u.end().sub(u.start()).normalize(),g=new S(-m.y,m.x);return s.add(g.mul(h))}}if(l<h&&c!=null){let u=c.start().distance2(s),d=c.end().distance2(s),p=c.end().sub(c.start()).normalize();return u<d?c.end().sub(p.mul(h)):c.start().add(p.mul(h))}return e.center}fixCenter(t,e){let r=e.center;if(!(t.startVia!=null&&t.endVia!=null)){if(t.startVia!=null){let i=this.collide.getSafeClearance(t.startVia.net,e,5),n=t.startVia.center,s=r,a=t.startVia.topPad/2+i+e.topPad/2,l=s.sub(n);l.length()<a&&(r=n.add(l.normalize().mul(a)))}else if(t.endVia!=null){let i=this.collide.getSafeClearance(t.endVia.net,e,5),n=t.endVia.center,s=r,a=t.endVia.topPad/2+i+e.topPad/2,l=s.sub(n);l.length()<a&&(r=n.add(l.normalize().mul(a)))}}return r}onCollideTrack(t,e,r){let i=t,n=t.tracks[0].width,s=e.getPath();this.hulls.length=0;for(let l of s){let c=Wa.segmentHull(l,r+n/2,0);this.hulls.push(c)}let a=this.hulls;for(let l=0;l<4;l++){let c=l>1?ae.CW:ae.CCW,h=Array.from(i.path);for(let u of a)h=this.walk.aroundHull(u,h,c);if(a=a.reverse(),!this.walk.check.checkIntersection(ge.build4(h),ge.build4(e.path))&&!this.walk.check.checkAroundStartpoint(h,e,1+t.tracks[0].width/2))return{path:h,sweep:c}}return{path:[],sweep:0}}};var T8=class{constructor(t,e){this.map=t,this.result=e}getChain(t,e){if(t instanceof wp){let r=this.result.getSource(t);if(r!=null)return r;let i=t.start,n=e.center,s=new Lm(this.map);i.equals(n)?(s.path.push(n),i=t.end):s.path.push(n),s.path.push(i),s.tracks.push(t),s.all.add(t),s.startVia=e,s.getTracks(t.layer,i,e.topPad,e.net,!1);let a=this.result.addSource(s.tracks);s.sourceIndex=a;let l=s.build();return this.result.shovePathMap[a]=l,l}else if(t instanceof t0)return this.result.shovePathMap[t.sourceIndex];return null}modifyVia(t,e){let r=t.center,i=new ht(r.x,r.x,r.y,r.y),n=new Array,s=this.map.getPcbLayers();for(;s.hasNext();){let c=s.next();this.map.getShoveItems(c,i).forEach(u=>{n.push(u)})}let a=new Array,l=new Array;if(r.distance2(e)>2e-8){for(let c of n)if(c instanceof Os&&(c.start.distance2(r)<2e-8||c.end.distance2(r)<2e-8)&&t.net==c.net){let h=this.getChain(c,t),u=Su(h.path);if(u.length==1)continue;let d=new Array;r.equals1(u[0])?d=this.repairStart(u,e):d=this.repairEnd(u,e),a.push(h);let p=uVe(h,d,this.map);p.sweep=h.sweep;let m=new gl(t.id,t.net,e,t.holeDiameter,t.topPad,t.innerPad,t.botPad,t.mask,t.unuseLayers);h.startVia==t||h.startVia!=null&&h.startVia.id==t.id?p.startVia=m:h.endVia==t||h.endVia!=null&&h.endVia.id==t.id?p.endVia=m:h.path[0].equals1(r)?p.startVia=m:h.path[h.path.length-1].equals1(r)&&(p.endVia=m);let g=p.build();l.push(g),this.result.shovePathMap[g.sourceIndex]=g,g.modifyVias.push(m);for(let y of h.modifyVias)y.id!=m.id&&g.modifyVias.push(y)}}return{oldTracks:a,newTracks:l}}repairStart(t,e){let r=new Xn,i=t[1].sub(t[0]),n=null,s=new Array;if(ne.eq(i.x,0)||ne.eq(i.y,0)){let a=t[1];if(t[2]!=null){a=t[2],s.push(a);for(let c=3,h=t.length;c<h;c++)s.push(t[c])}else s.push(a);let l=r.degree45Model(e,a);ne.eq(e.x,l[0].x)||ne.eq(e.y,l[0].y)?n=l[0]:n=l[1]}else{for(let l=1,c=t.length;l<c;l++)s.push(t[l]);let a=r.degree45Model(e,t[1]);ne.eq(e.x,a[0].x)||ne.eq(e.y,a[0].y)?n=a[0]:n=a[1]}return e.distance2(n)<1e-8?s=Su([].concat([n],s)):s=Su([].concat([e],[n],s)),s.length<2&&(s=t),s}repairEnd(t,e){let r=new Xn,i=t.length,n=t[i-2].sub(t[i-1]),s=null,a=new Array;if(ne.eq(n.x,0)||ne.eq(n.y,0)){let l=t[i-2];if(t[i-3]!=null){l=t[i-3];for(let h=0;h<i-2;h++)a.push(t[h])}else a.push(l);let c=r.degree45Model(l,e);ne.eq(e.x,c[0].x)||ne.eq(e.y,c[0].y)?s=c[0]:s=c[1]}else{for(let c=0;c<i-1;c++)a.push(t[c]);let l=r.degree45Model(t[i-2],e);ne.eq(e.x,l[0].x)||ne.eq(e.y,l[0].y)?s=l[0]:s=l[1]}return e.distance2(s)<1e-8?a=Su([].concat(a,[s])):a=Su([].concat(a,[s,e])),a.length<2&&(a=t),a}clear(){T4.clear()}};var oj=class{constructor(){this.parent=null;this.shoveState=1;this.sourceTrackChain=new Array;this.shovePathMap={};this.ropes=new Array}addSource(t){let e=this.sourceTrackChain.length;return this.sourceTrackChain.push(t),e}getSource(t){for(let e=0,r=this.sourceTrackChain.length;e<r;e++)if(this.sourceTrackChain[e].indexOf(t)>-1)return this.shovePathMap[e];return null}clear(){for(let t in this.shovePathMap)this.shovePathMap[t].clear(),delete this.shovePathMap[t];for(let t of this.sourceTrackChain)t.length=0;this.sourceTrackChain.length=0,this.parent!=null&&(this.parent.clear(),this.parent=null)}};var I4=class extends S{constructor(e){super(e.x,e.y);this.isOrigin=!1}},wie=class{constructor(){this.needOptimization=!1;this.tool=new Xn}replacePath(t){let e=new Array;for(let r of t){let i=new I4(r);e.push(i),i.isOrigin=!0}return e}optimizationPolyline(t){let e=[];t.points(.1,s=>{e.push(s)});let r=this.optimization(e),i=this.reducePoints(r);return ge.build4(i)}optimization(t){this.needOptimization=!0;let e=this.replacePath(t),r=new Date().getTime();for(;this.needOptimization;)if(this.needOptimization=!1,e=this.reducePoints(e),e=this.degree45(e),!this.needOptimization||new Date().getTime()-r>100){e=this.reduceOrigin(e);break}return e}reduceOrigin(t){let e=0,r=null,i=new Array,n=new Array;for(let s of t)if(!s.isOrigin)n.push(s),e++;else{if(e>1&&r!=null){let a=this.tool.degree45Model(r,s);a[0].distance2(n[0])<a[1].distance2(n[0])?i.push(new I4(a[0])):i.push(new I4(a[1])),n.length=0,this.needOptimization=!0}else{for(let a of n)i.push(a);n.length=0}e=0,r=s,i.push(s)}return i[0].equals1(t[0])&&i[i.length-1].equals1(t[t.length-1])?i:t}degree45(t){let e=new Array,r=t[0];e.push(r);for(let i=1,n=t.length;i<n;i++){let s=t[i],a=i+1;if(a<n){let l=t[a],c=r.sub(s).normalize(),h=l.sub(s).normalize(),u=c.dot(h);if(ne.greatereq(u,0)){let d=this.tool.degree45Model(r,l);d[0].distance2(s)<d[1].distance2(s)?e.push(new I4(d[0])):e.push(new I4(d[1])),this.needOptimization=!0}else e.push(s)}else e.push(s);r=e[e.length-1]}return e[0].equals1(t[0])&&e[e.length-1].equals1(t[t.length-1])?e:t}reducePoints(t){if(t.length>2){let e=t[0],r=new Array;r.push(e);for(let i=1,n=t.length;i<n;i++){let s=t[i],a=!1;if(i+1<n){let l=s.sub(e).normalize(),c=t[i+1].sub(e).normalize(),h=l.cross(c);Math.abs(h)<1e-8&&(a=!0)}a||(r.push(s),e=s)}return r}else return t}};function mVe(o){return new Array}var C4=class{constructor(t,e,r,i,n){this.inters=new Array;this.shape=t,this.start=e,this.end=r,this.source=i,this.group=n,this._bbox=new _e().ext1(t.bbox()).ext2(e).ext2(r).build1(),this.inters.push(e),this.inters.push(r)}static rebuild(t,e,r){if(e.distance2(r)<1e-6||t instanceof M)return new M(e,r);if(t instanceof q){let i=t,n=e.angleD(i.center),s=r.angleD(i.center);return q.build2(i.center,n,s,i.rx,i.ry,i.sweep())}else throw new Error("not supported operation")}bbox(){return this._bbox}},l3t=1e-7,Lie=1e-14,sj=class{findPath4Sweep(t,e,r){let i=t[0].start(),n=t[t.length-1].end(),s=this.intersection(t,e,r),a=this.split(s),l=this.findConnect(a,i,n,r);for(let c of l)return c;return null}findPath4SweepEnd(t,e,r){let i=t[0].start(),n=t[t.length-1].end(),s=this.intersection(t,e,r),a=this.split(s),l=this.findConnectEnd(a,i,n,r);for(let c of l)return c;return null}intersection(t,e,r){let i=new ji(10),n=0;for(let l of e){let c=nh(l);if(r==ae.CCW&&!c||r==ae.CW&&c){let u=l.reverse().primitives;for(let d of u)d.start().distance2(d.end())<=Lie&&d instanceof M||i.add(new C4(d,d.start(),d.end(),!1,n))}else{let h=l.primitives;for(let u of h)u.start().distance2(u.end())<=Lie&&u instanceof M||i.add(new C4(u,u.start(),u.end(),!1,n))}n++}for(let l of t)l.start().distance2(l.end())<=Lie&&l instanceof M||i.add(new C4(l,l.start(),l.end(),!0,n));let s=new Set,a=i.itemList;for(let l of a){s.add(l);let c=l.bbox().extendOfSize(1e-5);for(let h of i.search(c))if(!s.has(h)&&l.group!=h.group){let u=Pt(l.shape,h.shape);for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);l.inters.push(p),h.inters.push(p)}}}return s.clear(),a}toArray(t){let e=new Array,r=t.iterator();for(;r.hasNext();){let i=r.next();e.push(i)}return e}split(t){let e=new Array;for(let r of t){let i=r.start,n=r.end,s=r.inters;an(s,r.shape);let a=null;for(let l of s)if(a==null)l.equals1(i)&&(a=l);else if(!l.equals1(a)){let c=C4.rebuild(r.shape,a,l);if(e.push(new C4(c,a,l,r.source,r.group)),l.equals1(n))break;a=l}}return e}findConnect(t,e,r,i){let n=new hd,s=new ji(10);for(let T of t)n.computeIfAbsent(T.start,mVe).push(T),s.add(T.start);let a={},l=new Array,c=new Array,h=new Ta,u=new Tn,d=new Ta,p=new Tn,m=new Tn,g=Number.MAX_VALUE,y=this.findNexts(e,n,d,s),b=this.findNext(a,y,i,u);if(b==null)return l;u.add(b),this.add(a,b);let P=b.end;for(b.source&&(h.add(P),p.add(b));u.size()>0;)if(this.isStart(r,P)){if(u.size()>0){let T=this.fillSideGroups(u,0);l.push(T)}break}else{let T=this.findNexts(P,n,d,s),I=this.findNext(a,T,i,u);if(I==null&&(P=this.findNeigber(P,d,s,.01),P!==null&&(T=this.findNexts(P,n,d,s),I=this.findNext(a,T,i,u))),I!=null){if(u.add(I),this.add(a,I),P=I.end,I.source)p.clear(),this.copyTo(u,p);else if(h.contains(P)){if(m.size()>0){let E=this.fillSideGroups(m,0);l.push(E)}else if(p.size()>0){let E=this.fillSideGroups(p,0);l.push(E)}break}h.add(P);let C=P.distance2(r);C<g&&(g=C,m.clear(),this.copyTo(u,m))}else if(P!=null?d.add(P):c.push(u.removeLast()),u.size()>0)P=u.getLast().end;else break}return l}findConnectEnd(t,e,r,i){let n=new hd,s=new ji(10);for(let g of t)n.computeIfAbsent(g.start,mVe).push(g),s.add(g.start);let a={},l=new Array,c=new Array,h=new Tn,u=new Ta,d=this.findNexts(e,n,u,s);if(d.length==0)return l;let p=this.findNext(a,d,i,h);h.add(p),this.add(a,p);let m=p.end;for(;h.size()>0;)if(this.isStart(r,m)){if(h.size()>0){let g=this.fillSideGroups(h,0);l.push(g)}break}else{let g=this.findNexts(m,n,u,s),y=this.findNext(a,g,i,h);if(y==null&&(m=this.findNeigber(m,u,s,.01),m!==null&&(g=this.findNexts(m,n,u,s),y=this.findNext(a,g,i,h))),y!=null)h.add(y),this.add(a,y),m=y.end;else if(m!=null?u.add(m):c.push(h.removeLast()),h.size()>0)m=h.getLast().end;else break}return l}add(t,e){if(e==null)return;let r=t[e.group];r==null&&(r=new Set,t[e.group]=r),r.add(e)}has(t,e){if(e==null)return!1;let r=t[e.group];return r==null?!1:r.has(e)}copyTo(t,e){let r=t.iterator();for(;r.hasNext();){let i=r.next();e.add(i)}}isStart(t,e){return t.distance2(e)<=1e-4}findNexts(t,e,r,i){let n=new Ta,s=i.search(t.bbox().extendOfSize(l3t));for(let c of s)r.contains(c)||t.distance2(c)<Lie&&n.add(c);let a=[],l=n.iterator();for(;l.hasNext();){let c=l.next(),h=e.get(c);xe.addAll(a,h)}return a}findNext(t,e,r,i){if(e!=null){let n=null,s=null;for(let a of e){let l=this.getDirect(a);if(!this.has(t,a))if(n==null&&s==null)n=a,s=l;else{let c=s.cross(l);if(r==ae.CCW&&ne.less(c,0))n=a,s=l;else if(r==ae.CW&&ne.greater(c,0))n=a,s=l;else if(ne.eq(c,0)&&i.size()>0){let h=i.getLast(),u=this.getDirect(h,!0),d=u.cross(l),p=u.cross(s);r==ae.CCW?d<p&&(n=a,s=l):d>p&&(n=a,s=l)}}}return n}return null}getDirect(t,e=!1){let r=t.shape;if(r instanceof M)return r.direct;if(r instanceof q){let n=(e?r.end():r.start()).sub(r.center).normalize();return r.sweep()==ae.CCW?new S(-n.y,n.x):new S(n.y,-n.x)}else return new S(1,0)}fillSideGroups(t,e){let r=[];return tI(t,(i,n)=>(r.push(n.shape),!0)),ge.build2(r)}findNeigber(t,e,r,i){let n=i*i,s=Number.MAX_VALUE,a=null;for(let l of r.search(t.bbox().extendOfSize(i)))if(!e.contains(l)){let c=t.distance2(l);c<s&&(s=c,a=l)}return s<n?a:null}},wwi=new sj;var SCe=class{constructor(t,e){this.oldPath=t,this.chain=e}get length(){let t=0,e=this.oldPath[0];for(let r=1,i=this.oldPath.length;r<i;r++){let n=this.oldPath[r];t+=e.distance1(n),e=n}return t}};function gVe(o,t){let e=o.length-t.length;return e==0?o.path.length-t.path.length:e}function c3t(o,t){let e=o.length-t.length;return e==0?gVe(o.chain,t.chain):e}var h3t=0,Mie=class{constructor(){this.lineStack=new Array;this.walk=new P8;this.collide=new vie;this.hulls=new Array;this.vias=new Set;this.ropes=new Array;this.helpLine=new Array;this.step=new Die(this.collide);this.viaConnectChains=new Array;this.previewTrack=new Set;this.collideTracks=new Set;this.tracks=new Set;this.route=new wie;this.result=new oj;this.time=0;this.place=!0;this.debug=!1;this.logger=new Di(1)}convertPath(t){let e=new Lm(this.collide.map);e.path.push(t[0].start);for(let i of t){let n=Oie(i);e.tracks.push(n),e.all.add(n),e.path.push(n.end)}return e.sourceIndex=0,e.build()}convertPathVia1(t){let e=new Array,r=null,i=null,n=[];for(let a of t)if(a instanceof Os)e.push(a);else if(a instanceof Ue){let l=new gl(a.globalIndex,a.net,a.center,a.holeRadius*2,a.radius*2,a.radius*2,a.radius*2,!1,SI(CI(a.unusedInnerLayers)));if(e.length==0)r=l;else{i=l;let c=new Lm(this.collide.map);c.path.push(e[0].start);for(let h of e)c.tracks.push(h),c.all.add(h),c.path.push(h.end);r!=null&&(c.startVia=r),i!=null&&(c.endVia=i),c.sourceIndex=0,n.push(c.build()),r=l,i=null,e.length=0}}let s=new Lm(this.collide.map);s.path.push(e[0].start);for(let a of e)s.tracks.push(a),s.all.add(a),s.path.push(a.end);return r!=null&&(s.startVia=r),i!=null&&(s.endVia=i),s.sourceIndex=0,n.push(s.build()),e.length=0,n}convertPathVia(t){let e=new Array,r=null,i=null,n=[];for(let a of t)if(a instanceof Id)e.push(a);else if(a instanceof Ue){let l=new gl(a.globalIndex,a.net,a.center,a.holeRadius*2,a.radius*2,a.radius*2,a.radius*2,!1,SI(CI(a.unusedInnerLayers)));if(e.length==0)r=l;else{i=l;let c=new Lm(this.collide.map);c.path.push(e[0].start);for(let h of e){let u=Oie(h);c.tracks.push(u),c.all.add(u),c.path.push(u.end)}r!=null&&(c.startVia=r),i!=null&&(c.endVia=i),c.sourceIndex=0,n.push(c.build()),r=l,i=null,e.length=0}}let s=new Lm(this.collide.map);s.path.push(e[0].start);for(let a of e){let l=Oie(a);s.tracks.push(l),s.all.add(l),s.path.push(l.end)}return r!=null&&(s.startVia=r),i!=null&&(s.endVia=i),s.sourceIndex=0,n.push(s.build()),e.length=0,n}resetLastMap(t){if(t!=null)for(let e=1,r=t.sourceTrackChain.length;e<r;e++)this.result.sourceTrackChain.push(t.sourceTrackChain[e]),this.result.shovePathMap[e]=t.shovePathMap[e],this.remove4Rtree(t.sourceTrackChain[e]),this.add4Rtree([t.shovePathMap[e]])}resetMap(){this.add4Rtree(Array.from(this.collideTracks)),this.remove4Rtree(Array.from(this.previewTrack)),this.remove4Rtree(Array.from(this.tracks))}init(t,e){this.time=new Date().getTime(),this.clear();let r=this.result;this.result=new oj,this.result.sourceTrackChain.splice(0,0,t.tracks),this.result.shovePathMap[0]=t,this.resetLastMap(e),this.remove4Rtree([t]),this.result.parent=r}shoveMain(t,e){let r=!0;this.init(t,e),t=this.walkObstacle(t),this.add4Rtree([t]),this.lineStack.push(t.sourceIndex);let i=0;do{if(this.shoveLineMain(),this.hasObstacle(this.result.shovePathMap[t.sourceIndex]))this.lineStack.push(t.sourceIndex);else break;if(!this.debug&&new Date().getTime()-this.time>200){this.result.shoveState=2,this.logger.debug1("1-time out!");break}if(this.result.shoveState==2)break;i++}while(i<100);if(this.result.shoveState==2){let n=this.result.parent;this.remove4Rtree(this.ropes),this.add4Rtree(Array.from(this.vias));let s=this.getVia4Ropes(n.ropes);this.remove4Rtree(Array.from(s)),this.add4Rtree(n.ropes),this.ropes.length=0;for(let a of n.ropes)a.previewVia(),this.ropes.push(a),this.result.ropes.push(a);this.result=n,r=!1}else this.previewVia();return this.resetMap(),this.viaConnectChains.length=0,this.lineStack.length=0,this.previewTrack.clear(),this.collideTracks.clear(),this.tracks.clear(),r}shove(t){let e=this.convertPath(t);this.shoveMain(e)}walkObstacle(t){let e=0,r=new O3(c3t),i=!0,n=t;for(;i&&e<100;){this.hulls.length=0;let s=this.getSolidObstacle(n);if(s!=null){if(!n.obstacles.has(s)){let l=this.collide.getSafeClearance(n.tracks[0].net,s),c=s.shape(n.tracks[0].layer,0);if(c instanceof ge){let u=this.getShapeHulls(s,c,l);if(this.pointInHulls(n.path[0],u)){if(!this.place){this.result.shoveState=2;break}let d=[n.path[0],n.path[0]];n=this.getNewChain(n,d),i=!1;break}if(this.pointInHulls(n.path[n.path.length-1],u)){if(!this.place){this.result.shoveState=2;break}let d=new Array;d.push(n.path[0]);for(let m=0,g=n.tracks.length;m<g;m++){let y=n.path[m+1],b=n.tracks[m];this.collide.adsorp=null;let P=this.collide.checkObstacle(b);if(this.collide.adsorp!=null){d.push(y,P);break}else d.push(y)}n=this.getNewChain(n,d),e++;continue}}let h=this.step.onCollideSolid(n,s,l);for(let u of h){let d=u.path;d=this.route.optimization(d);let p=this.getChainFactory(n,d);p.sweep=u.sweep;let m=p.build(),g=new SCe(u.path,m);r.add(g);for(let y of n.obstacles)m.obstacles.add(y);m.obstacles.add(s)}}let a=this.findMinNodePath1(r);a!=null&&(n=a.chain)}else break;e++}return this.hulls.length=0,this.result.shovePathMap[n.sourceIndex]=n,n}pointInHulls(t,e){for(let r of e)if(this.walk.check.pointInPolyline(t,r))return!0;return!1}getShapeHulls(t,e,r){let i=new Array;if(t instanceof E0)for(let n of e.primitives){let s=n.stroke(1e-5,wr.ROUND,ae.CW).asClose(),a=Wa.convexHull(s,r);i.push(a)}else if(t instanceof Q0)for(let n of e.primitives){let s=n.stroke(t.width,wr.ROUND,ae.CW).asClose(),a=Wa.convexHull(s,r);i.push(a)}else{let n=Wa.convexHull(e,r);i.push(n)}return i}findMinNodePath1(t){for(;;){let e=t.poll();return e===null?null:(t.remove(e),e)}}findMinNodePath(t){for(;;){let e=t.poll();return e===null?null:(t.remove(e),e)}}remove4Rtree(t){t.forEach(e=>{e instanceof yS?e.tracks.forEach(r=>{r instanceof wp?this.collideTracks.add(r):r instanceof t0?this.previewTrack.delete(r):r instanceof Os&&this.tracks.delete(r),this.collide.map.removeShape4RTree(r)}):(e instanceof wp?this.collideTracks.add(e):e instanceof t0?this.previewTrack.delete(e):e instanceof Os&&this.tracks.delete(e),this.collide.map.removeShape4RTree(e))})}add4Rtree(t){t.forEach(e=>{if(e instanceof yS)e.tracks.forEach(r=>{if(r instanceof t0){if(this.previewTrack.has(r))return;this.previewTrack.add(r)}else if(r instanceof wp){if(!this.collideTracks.has(r))return;this.collideTracks.delete(r)}else r instanceof Os&&this.tracks.add(r);this.collide.map.addShape2RTree(r)});else{if(e instanceof t0){if(this.previewTrack.has(e))return;this.previewTrack.add(e)}else if(e instanceof wp){if(!this.collideTracks.has(e))return;this.collideTracks.delete(e)}else e instanceof Os&&this.tracks.add(e);this.collide.map.addShape2RTree(e)}})}clear(){this.helpLine.forEach(t=>{t.remove()}),this.helpLine.length=0,this.ropes.forEach(t=>{t.removePreviewVia()}),this.vias.clear()}shoveLineMain(){let t=0;for(;this.lineStack.length>0;){this.hulls.length=0;let e=this.lineStack.shift(),r=this.result.shovePathMap[e];if(this.getSolidObstacle(r)!=null?this.onCollideSolid(r):(this.repair4Rope(r),r=this.result.shovePathMap[r.sourceIndex],this.deleteViaConnectChain(r.sourceIndex),this.onCollideVia(r),this.onCollideTrack(r)),t++,this.lineStack.length>300){this.result.shoveState=2;return}if(t>=100){this.result.shoveState=2;return}if(this.lineStack.length==0&&this.viaConnectChains.length>0){let n=this.viaConnectChains.shift();this.lineStack.push(n)}if(!this.debug&&new Date().getTime()-this.time>200&&(this.result.shoveState=2,this.logger.debug1("7-walk solid time out!")),this.result.shoveState==2)break}}previewVia(){for(let i of this.ropes)i.reset();let t=new Array,e=new Set,r=new Set;for(let i of this.ropes)this.vias.has(i.pcbVia)?t.push(i):(i.visibleVia(),r.add(i),e.add(i.pcbVia));this.remove4Rtree(Array.from(r)),this.add4Rtree(Array.from(e)),this.ropes.length=0;for(let i of t)i.previewVia(),this.ropes.push(i),this.result.ropes.push(i)}getRope(t,e=!0){for(let r of this.ropes)if(!e&&r.start.distance2(t.path[0])<1e-4||e&&r.start.distance2(t.path[t.path.length-1])<1e-4)return r;return null}repair4Rope(t){for(let e=0;e<2;e++){let r=e==0,i=this.getRope(t,r);if(i==null)return t;{let n=new T8(this.collide.map,this.result),s=i.end,a=i.getRopeStart();if(a.distance2(s)>1e-4){let l=new gl(i.id,i.net,a,i.pcbVia.holeDiameter,i.pcbVia.topPad,i.pcbVia.innerPad,i.pcbVia.botPad,i.pcbVia.mask,i.pcbVia.unuseLayers),c=n.modifyVia(l,s);this.remove4Rtree(c.oldTracks),this.add4Rtree(c.newTracks),this.updateViaConnectChain(c),this.vias.add(i.pcbVia),i.used()}}}}checkPointInHulls(t){for(let e of this.hulls)if(this.walk.check.pointInPolyline(t,e))return!0;return!1}onCollideTrack(t){let e=new Array,r=this.getObstacle(t);for(;r instanceof yS;){let i=this.lineStack.indexOf(r.sourceIndex);this.repair4Rope(r),r=this.result.shovePathMap[r.sourceIndex],this.hulls.length=0,this.deleteViaConnectChain(r.sourceIndex),this.addHull(r,t);let n=!1;if(this.checkPointInHulls(r.path[0])&&(n=!0),!n&&this.checkPointInHulls(r.path[r.path.length-1])&&(n=!0),!n){let s=this.collideTrack(r,t);if(s.length>0){this.add4Rtree(s);let a=e.indexOf(r.sourceIndex);a>-1&&e.splice(a,1);for(let l of s)l.updateModifyPath(this.result),i<0&&e.push(l.sourceIndex);this.remove4Rtree([r])}else{this.result.shoveState=2,this.logger.debug3("23-collide track around fail:track start in hulls:%s,%s,%s,%s,",t,r,this.hulls,this.result);break}}if(n){if(this.hulls.length=0,this.addHull(t,r),this.checkPointInHulls(t.path[0])){this.result.shoveState=2,this.logger.debug3("8-collide track around fail:track start in hulls:%s,%s,%s,%s,",t,r,this.hulls,this.result);break}if(this.checkPointInHulls(t.path[t.path.length-1])){this.result.shoveState=2,this.logger.debug3("9-collide track around fail:track end in hulls:%s,%s,%s,%s,",t,r,this.hulls,this.result);break}let s=this.collideSolidSweep(t,t.sweep,ge.build4(r.path));s.length>0?(this.add4Rtree(s),this.remove4Rtree([t]),t=s[0],t.updateModifyPath(this.result),this.result.shovePathMap[t.sourceIndex]=t,this.getSolidObstacle(t)!=null&&(this.logger.debug1("20-collide track around fail:track end in hulls"),this.result.shoveState=2)):(this.result.shoveState=2,this.logger.debug3("10-collide track around fail:not path %s , %s, %s",t,r,this.result))}if(r=this.getObstacle(t),!this.debug&&new Date().getTime()-this.time>200&&(this.result.shoveState=2,this.logger.debug1("10-collide track time out")),this.result.shoveState==2)break}for(let i of e)this.lineStack.push(i);this.logger.debug2(this.lineStack)}onCollideVia(t){let e=new Array,r=this.getViaObstacle(t);for(;r!=null;){if(r instanceof gl){let i=this.collide.getSafeClearance(t.tracks[0].net,r),n=this.step.onCollideVia(t,r,i);if(n.distance2(r.center)>1e-4){let a=new T8(this.collide.map,this.result).modifyVia(r,n);this.remove4Rtree(a.oldTracks),this.add4Rtree(a.newTracks),this.updateViaConnectChain(a),this.vias.add(r);let l=new II(r.net,r.layer,r.center,n,r.topPad,r.id);this.remove4Rtree([r]),e.push(l),l.pcbVia=r}else{this.remove4Rtree([r]);let s=new II(r.net,r.layer,r.center,n,r.topPad,r.id);e.push(s),s.pcbVia=r}}else if(r instanceof II){let i=this.collide.getSafeClearance(t.tracks[0].net,r.pcbVia),n=new gl(r.id,r.net,r.end,r.pcbVia.holeDiameter,r.pcbVia.topPad,r.pcbVia.innerPad,r.pcbVia.botPad,r.pcbVia.mask,r.pcbVia.unuseLayers),s=this.step.onCollideVia(t,n,i),a=new T8(this.collide.map,this.result),l=r.getRopeStart();if(l.distance2(s)>1e-4){this.deleteRope(r);let c=new gl(r.id,r.net,l,r.pcbVia.holeDiameter,r.pcbVia.topPad,r.pcbVia.innerPad,r.pcbVia.botPad,r.pcbVia.mask,r.pcbVia.unuseLayers),h=a.modifyVia(c,s);this.remove4Rtree(h.oldTracks),this.add4Rtree(h.newTracks),this.updateViaConnectChain(h);let u=new II(r.net,r.layer,r.start,s,r.width,r.id);this.remove4Rtree([r]),e.push(u),u.pcbVia=r.pcbVia,this.vias.add(r.pcbVia)}else this.remove4Rtree([r]),e.push(r),this.vias.add(r.pcbVia);this.deleteRope(r)}else this.result.shoveState=2,this.logger.debug3("%s %s %s","11-collide via fail",r,this.result);if(r=this.getViaObstacle(t),!this.debug&&new Date().getTime()-this.time>200&&(this.result.shoveState=2,this.logger.debug1("12-collide via fail:time out")),this.result.shoveState==2)break}this.add4Rtree(e),this.addRopes(e)}deleteRope(t){let e=this.ropes.indexOf(t);e>-1&&this.ropes.splice(e,1)}addRopes(t){for(let e of t)this.ropes.push(e)}updateViaConnectChain(t){for(let e=0,r=t.oldTracks.length;e<r;e++){let i=t.oldTracks[e],n=t.newTracks[e];if(n.updateModifyPath(this.result),n!=null){let s=-1;i!=null&&(s=this.getViaConnectIndex(i)),s<0&&this.viaConnectChains.push(n.sourceIndex)}}}getViaConnectIndex(t){for(let e=0,r=this.viaConnectChains.length;e<r;e++)if(this.viaConnectChains[e]==t.sourceIndex)return e;return-1}getViaObstacle(t){let e=t.tracks;t.modifyPath.length>0&&(e=t.modifyPath);for(let r of e)if(this.collide.adsorp=null,this.collide.checkOnlyVia(r),this.collide.adsorp!=null){if(this.collide.adsorp instanceof II)return this.collide.adsorp;if(this.collide.adsorp instanceof gl){for(let i of this.ropes)if(i.pcbVia==this.collide.adsorp)return i;return this.collide.adsorp}}for(let r of t.modifyVias)if(this.collide.adsorp=null,this.collide.checkOnlyVia(r),this.collide.adsorp!=null){if(this.collide.adsorp instanceof II)return this.collide.adsorp;if(this.collide.adsorp instanceof gl){for(let i of this.ropes)if(i.pcbVia==this.collide.adsorp)return i;return this.collide.adsorp}}return null}hasObstacle(t){let e=t.tracks;t.modifyPath.length>0&&(e=t.modifyPath);for(let r of e)if(this.collide.adsorp=null,this.collide.check(r),this.collide.adsorp!=null)return!0;for(let r of t.modifyVias)if(this.collide.adsorp=null,this.collide.check(r),this.collide.adsorp!=null)return!0;for(let r of e)if(this.collide.adsorp=null,this.collide.checkObstacle(r),this.collide.adsorp!=null)return!0;for(let r of t.modifyVias)if(this.collide.adsorp=null,this.collide.checkVia(r,r.center),this.collide.adsorp!=null)return!0;return!1}getObstacle(t){let e=t.tracks;t.modifyPath.length>0&&(e=t.modifyPath);for(let i of e)if(this.collide.adsorp=null,this.collide.check(i),this.collide.adsorp!=null){if(this.collide.adsorp instanceof wp){let n=this.result.getSource(this.collide.adsorp);if(n!=null)return n;let s=new Lm(this.collide.map).generateChain(this.collide.adsorp),a=this.result.addSource(s.tracks);s.sourceIndex=a;let l=s.build();return this.result.shovePathMap[a]=l,l}else if(this.collide.adsorp instanceof t0)return this.result.shovePathMap[this.collide.adsorp.sourceIndex]}let r=t.modifyVias;r.length==0&&(t.startVia!=null&&r.push(t.startVia),t.endVia!=null&&r.push(t.endVia));for(let i of r)if(this.collide.adsorp=null,this.collide.check(i),this.collide.adsorp!=null){if(this.collide.adsorp instanceof wp){let n=this.result.getSource(this.collide.adsorp);if(n!=null)return n;let s=new Lm(this.collide.map).generateChain(this.collide.adsorp),a=this.result.addSource(s.tracks);s.sourceIndex=a;let l=s.build();return this.result.shovePathMap[a]=l,l}else if(this.collide.adsorp instanceof t0)return this.result.shovePathMap[this.collide.adsorp.sourceIndex]}return null}getSolidObstacle(t){let e=t.tracks;t.sourceIndex>0&&t.modifyPath.length>0&&(e=t.modifyPath);for(let i of e)if(this.collide.adsorp=null,this.collide.checkObstacle(i),this.collide.adsorp!=null)return this.collide.adsorp;let r=t.modifyVias;r.length==0&&(t.startVia!=null&&r.push(t.startVia),t.endVia!=null&&r.push(t.endVia));for(let i of r)if(this.collide.adsorp=null,this.collide.checkVia(i,i.center),this.collide.adsorp!=null)return this.collide.adsorp;return null}needWalkAround(t){let e=t.path[t.path.length-1];for(let r of this.hulls)if(this.walk.check.pointInPolyline(t.path[0],r)||this.walk.check.pointInPolyline(e,r))return!0;return!1}getFirst(t,e){let r=e.tracks,i=0,n=r.length-1;for(let s=0;s<=n;s++){let a=r[s],l=new M(a.start,a.end);for(let c of t.tracks){let h=new M(c.start,c.end);if(Pt(l,h)>0)return i=s,i}}return 0}getLast(t,e){let r=e.tracks,i=r.length-1;for(let n=i;n>=0;n--){let s=r[n],a=new M(s.start,s.end);for(let l of t.tracks){let c=new M(l.start,l.end);if(Pt(a,c)>0)return i=n,i}}return i}addHull(t,e){let r=this.collide.getSafeClearance(t.tracks[0].net,e.tracks[0]),i=t.tracks[0].width,n=t.tracks[0].layer,s=e.tracks;for(let a of s){let l=Wa.segmentHull(a,r+i/2+1e-5,0);this.hulls.push(l)}if(e.startVia!=null){let a=this.collide.getSafeClearance(t.tracks[0].net,e.startVia,5),l=e.startVia.shape(n,a+i/2),c=Wa.convexHull(l,1e-5);e.path[e.path.length-1].distance2(e.startVia.center)<e.path[0].distance2(e.startVia.center)?this.hulls.push(c):this.hulls.splice(0,0,c)}if(e.endVia!=null){let a=this.collide.getSafeClearance(t.tracks[0].net,e.endVia,5),l=e.endVia.shape(n,a+i/2),c=Wa.convexHull(l,1e-5);e.path[e.path.length-1].distance2(e.endVia.center)<e.path[0].distance2(e.endVia.center)?this.hulls.push(c):this.hulls.splice(0,0,c)}}collideTrack(t,e){let{path:r,sweep:i}=this.processHullSet(t,e);if(r.length>2){let n=this.getChainFactory(t,r);n.sweep=i;let s=n.build();return this.result.shovePathMap[s.sourceIndex]=s,this.addWalkHulls(s,e),s.previousChain.push(e.sourceIndex),[s]}else return[]}addWalkHulls(t,e){if(e.modifyPath.length==0)for(let r of this.hulls)t.walkHulls.push(r);else{let r=new Array,i=this.collide.getSafeClearance(t.tracks[0].net,e.tracks[0]),n=t.tracks[0].layer,s=e.modifyPath;for(let a of s){let l=Wa.segmentHull(a,i,0);r.push(l)}if(e.startVia!=null){let a=this.collide.getSafeClearance(t.tracks[0].net,e.startVia,5),l=e.startVia.shape(n,a),c=Wa.convexHull(l,1e-5);e.path[e.path.length-1].distance2(e.startVia.center)<e.path[0].distance2(e.startVia.center)?r.push(c):r.splice(0,0,c)}if(e.endVia!=null){let a=this.collide.getSafeClearance(t.tracks[0].net,e.endVia,5),l=e.endVia.shape(n,a),c=Wa.convexHull(l,1e-5);e.path[e.path.length-1].distance2(e.endVia.center)<e.path[0].distance2(e.endVia.center)?r.push(c):r.splice(0,0,c)}for(let a of r)t.walkHulls.push(a)}}reducePoints(t){if(t.length>2){let e=t[0],r=new Array;r.push(e);for(let i=1,n=t.length;i<n;i++){let s=t[i],a=!1;if(i+1<n){let l=s.sub(e).normalize(),c=t[i+1].sub(e).normalize(),h=l.cross(c);Math.abs(h)<1e-4&&(a=!0)}a||(r.push(s),e=s)}return r}else return t}getNewChain(t,e){let r=this.getChainFactory(t,e);return r.sweep=t.sweep,r.build()}getChainFactory(t,e){let r=t.tracks[0].width,i=t.tracks[0].net,n=t.tracks[0].layer,s=new Array,a=e[0];for(let c=1,h=e.length;c<h;c++){let u=e[c],d=new t0(i,n,a,u,r,"shove"+h3t++,t.sourceIndex);s.push(d),a=u}let l=new Lm(this.collide.map);l.path.push(s[0].start);for(let c of s)l.tracks.push(c),l.all.add(c),l.path.push(c.end);return l.sourceIndex=t.sourceIndex,l.endVia=t.endVia,l.startVia=t.startVia,l}collideSolidSweep(t,e,r){let i=this.processHullSetSweep(t,e,r);return i.length>2?[this.getNewChain(t,i)]:[]}processHullSet(t,e){let r=this.collide.getSafeClearance(t.tracks[0].net,e.tracks[0]),i=t,n=this.hulls,s=new Array,a=new sj,l=ge.build4(i.path).primitives,c=a.findPath4SweepEnd(l,n,ae.CCW),h=a.findPath4SweepEnd(l,n,ae.CW);for(let u=0;u<2;u++){let d=u==0?ae.CCW:ae.CW,p=u==0?c:h;if(p==null)continue;let m=new Array;if(p.points(.1,b=>{m.push(b)}),this.checkIntersection(p,ge.build4(e.path))||t.sourceIndex!=0&&this.checkIntersection(p,ge.build4(this.result.shovePathMap[0].path))||t.sourceIndex!=0&&this.checkAroundStartpoint(m,e,r+t.tracks[0].width/2))continue;if(e.walkHulls.length>0){let b=!1,P=ge.build4(e.path);for(let T of e.walkHulls)if(this.checkIntersection(P,T)&&this.checkIntersection(p,T)){b=!0;break}if(b)continue}if(m[0]!=null&&!m[0].equals(i.path[0])||m[m.length-1]!=null&&!m[m.length-1].equals(i.path[i.path.length-1]))continue;let g=this.route.optimization(m),y=ge.build4(g);this.checkIntersection(y,ge.build4(e.path))?s.push({path:m,sweep:d}):s.push({path:g,sweep:d})}return s.length>0?(Er(s,(u,d)=>this.getLength(u.path)-this.getLength(d.path),0,s.length),s[0]):{path:[],sweep:0}}getLength(t){let e=0;for(let r=0,i=t.length;r<i-1;r++){let n=t[r],s=t[r+1];e+=n.distance1(s)}return e}getPreviousChain(t){let e=new Array;for(let r of t.previousChain){let i=this.result.shovePathMap[r],n=this.collide.getSafeClearance(t.tracks[0].net,i.tracks[0]),s=t.tracks[0].layer,a=i.tracks;for(let l of a){let c=Wa.segmentHull(l,n,0);e.push(c)}if(i.startVia!=null){let l=this.collide.getSafeClearance(t.tracks[0].net,i.startVia,5),c=i.startVia.shape(s,l),h=Wa.convexHull(c,1e-5);i.path[i.path.length-1].distance2(i.startVia.center)<i.path[0].distance2(i.startVia.center)?e.push(h):e.splice(0,0,h)}if(i.endVia!=null){let l=this.collide.getSafeClearance(t.tracks[0].net,i.endVia,5),c=i.endVia.shape(s,l),h=Wa.convexHull(c,1e-5);i.path[i.path.length-1].distance2(i.endVia.center)<i.path[0].distance2(i.endVia.center)?e.push(h):e.splice(0,0,h)}}return e}onCollideSolid(t){let e=this.getSolidObstacle(t),r=this.getPreviousChain(t),i=new O3(gVe),n=0,s=t,a=new Array;for(;e!=null;){a.push(s);let l=this.getSolidHull(e,s);if(!s.obstacles.has(e)&&l!=null){let h=this.collide.getSafeClearance(s.tracks[0].net,e);if(!this.pointInHulls(s.path[0],l)&&!this.pointInHulls(s.path[s.path.length-1],l)){let d=this.step.onCollideSolid(s,e,h);d=d.filter(p=>{let m=ge.build4(p.path);for(let g of r)if(this.checkIntersection(m,g))return!1;return!(p.path[0]!=null&&!p.path[0].equals(s.path[0])||p.path[p.path.length-1]!=null&&!p.path[p.path.length-1].equals(s.path[s.path.length-1]))});for(let p of d){let m=p.path;m=this.route.optimization(p.path);let g=this.getChainFactory(s,m);g.sweep=p.sweep;let y=g.build();y.updateModifyPath(this.result),i.add(y);for(let b of s.obstacles)y.obstacles.add(b);y.obstacles.add(e)}}}let c=this.findMinNodePath(i);if(c!=null)s=c;else{this.result.shoveState=2,this.logger.debug3("%s %s %s","4-walk solid fail:no path!",this.result,a);break}if(e=this.getSolidObstacle(s),n++,n>=1e3){this.result.shoveState=2,this.logger.debug3("%s %s","5-walk solid to long!",this.result);break}if(!this.debug&&new Date().getTime()-this.time>200&&(this.result.shoveState=2,this.logger.debug1("6-walk solid time out!")),this.result.shoveState==2)break}return this.result.shovePathMap[s.sourceIndex]=s,this.remove4Rtree([t]),this.add4Rtree([s]),s.updateModifyPath(this.result),this.lineStack.splice(0,0,s.sourceIndex),s}helpPolyline(t,e){let r=[];t.points(1,i=>{r.push(i)}),this.helpHull(r,e)}getSolidHull(t,e){let r=this.collide.getSafeClearance(e.tracks[0].net,t),i=t.shape(e.tracks[0].layer,0);if(i instanceof ge){let n=e.tracks[0].width;if(e.modifyVias.length>0)for(let s of e.modifyVias){n=Math.max(s.topPad,n);let a=this.collide.getSafeClearance(e.tracks[0].net,t,5);r=Math.max(r,a)}return this.getShapeHulls(t,i,r+n/2+1e-5)}return null}processHullSetSweep(t,e,r){let i=this.hulls,n=e,s=e==ae.CCW?ae.CW:ae.CCW;for(let a=0;a<4;a++){let l=a>1?s:n,c=Array.from(t.path);for(let d of i)c=this.walk.aroundHull(d,c,l);if(i=i.reverse(),this.checkIntersection(ge.build4(c),r)||c[0]!=null&&!c[0].equals(t.path[0])||c[c.length-1]!=null&&!c[c.length-1].equals(t.path[t.path.length-1]))continue;let h=this.getNewChain(t,c);if(this.getSolidObstacle(h)==null)return c}return[]}deleteViaConnectChain(t){let e=this.viaConnectChains.indexOf(t);e>-1&&this.viaConnectChains.splice(e,1)}checkIntersection(t,e){for(let r of t.primitives)for(let i of e.primitives)if(Pt(r,i)>0)return!0;return!1}checkAroundStartpoint(t,e,r){let i=e.path[0].sub(e.path[1]).normalize(),n=e.path[0].add(i.mul(r+e.tracks[0].width/2)),s=ge.build4(t);for(let a of s.primitives)if(a instanceof M){let l=a.end().sub(a.start()).normalize(),c=n.sub(a.start()).normalize(),h=l.cross(c),u=c.dot(i);if(ne.eq(h,0)&&ne.eq(u,0))return!0}return!1}helpHull(t,e=ee.BLUE){let r=t[0];for(let i=0,n=t.length;i<n;i++){let s=t[i],a=new cr(1002,r,s,!1,e);this.helpLine.push(a),r=s}}getVia4Ropes(t){let e=new Set;for(let r of t)r.pcbVia!=null&&e.add(r.pcbVia);return e}clearCache(){this.collide.clear(),this.result.clear()}};var rR=class{constructor(){this.shoveFun=new Mie;this.last=null;this._current=null;this.previewResult=null;this.lastShoveResults=new Array;this.path=new Array;this.lines=new Array}clearCache(){this.shoveFun.clearCache(),this.last!=null&&this.last.clear(),this._current!=null&&this._current.clear(),this.previewResult!=null&&this.previewResult.clear(),this.lastShoveResults.length=0,this.path.length=0,this.lines.length=0}getChain(t){let e=this.shoveFun.collide.map;this.shoveFun.place=!1;let r=e.getTrack(t.globalIndex);r==null&&(r=this.convert(t));let i=new Lm(e);return i.generateChain(r),i.sourceIndex=0,i.build()}getNewChainFactory(t,e){return this.shoveFun.getChainFactory(t,e)}get current(){return this._current}set current(t){t!=this._current&&(this.last=this._current),this._current=t}convert(t){if(t instanceof Ir){let{type:e,order:r}=Aie(t.layerId),i=new $r(P4(e),r);return new wp(t.net,i,t.start,t.end,t.width,t.gId)}else if(t instanceof yi){let{type:e,order:r}=Aie(t.layerId),i=new $r(P4(e),r),n=t.primitive;return new Rm(t.net,i,n,t.width,t.gId)}else return new gl(t.globalIndex,t.net,t.center,t.holeRadius*2,t.radius*2,t.radius*2,t.radius*2,!1,SI(CI(t.unusedInnerLayers)))}addPath(t){let e=this.convert(t);this.path.push(e),this.lastShoveResults.push(this.last)}getShoveResults(t){return this.lastShoveResults[t]}getShovePath(t){return this.path.slice(0,t)}backspace(t){this.current=this.lastShoveResults[t];let e=this.path.length,r=this.lastShoveResults.length,i=this.lastShoveResults[t];return this.path.splice(t,e-t),this.lastShoveResults.splice(t,r-t),i}shoveTrackInterrupt(){this.current!=null&&(this.visibleTracks(this.current),this.clear()),this.clearCache()}shoveTrackComplete(t){return this.shoveTrackGroupComplete(t.commands)}shoveTrackGroupComplete(t){let e=!1;if(this.current!=null){this.visibleTracks(this.current);for(let i in this.current.shovePathMap){let n=this.current.shovePathMap[i],a=this.current.sourceTrackChain[i][0],l=pr.getItem(a.id);for(let c of n.tracks){let h=pr.addTrack(l.layerId,c.start,c.end,c.width,!1,c.net);A.publish("hasModifyPcbItem",h),t.addCommand(Ce.dispatch(h,"add"))}}let r=this.current.sourceTrackChain.length;for(let i=0;i<r;i++){let n=this.current.sourceTrackChain[i];for(let s of n){let a=pr.getItem(s.id);a!=null&&!a.isEmpty&&(t.addCommand(Ce.dispatch(a,"delete")),A.publish("hasModifyPcbItem",a),a.remove(),A.publish("delete",a))}}e=!0}return this.clear(),e}clear(){this.lines.forEach(t=>{t.remove()}),this.lines.length=0}hiddenTracks(t){for(let e of t.sourceTrackChain)for(let r of e)this.hidden(r.id)}visibleTracks(t){for(let e of t.sourceTrackChain)for(let r of e)this.visible(r.id)}preview(t){if(this.clear(),this.previewResult!=null&&this.visibleTracks(this.previewResult),t!=null){let e=Object.values(t.shovePathMap);for(let r of e)this.display(r,t);e.length>0?this.hiddenTracks(t):this.visibleTracks(t)}this.previewResult=t}preview1(t){this.clear(),this.previewResult!=null&&this.visibleTracks(this.previewResult),this.previewResult=null;let e=t.pop();for(let r of t){let i=r.shovePathMap[0];this.display(i,r)}if(e!=null){let r=Object.values(e.shovePathMap);for(let i of r)this.display(i,e);this.hiddenTracks(e)}this.previewResult=e}getViaCenter(){if(this.previewResult!=null){let t=this.previewResult.shovePathMap[0];if(t.startVia!=null)return t.path[0];if(t.endVia!=null)return t.path[t.path.length-1]}return null}previewShove(t){if(this.clear(),this.previewResult!=null&&this.visibleTracks(this.previewResult),t!=null){for(let e in t.shovePathMap)e!=0&&this.display(t.shovePathMap[e],t);this.hiddenTracks(t)}this.previewResult=t}getNetDelta(t){let e=0;for(let r of this.lines)r instanceof Id&&r.net==t&&(e+=r.length);if(this.previewResult!=null){for(let r of this.previewResult.sourceTrackChain)for(let i of r)if(i!=null&&i.net==t){let n=pr.getItem(i.id);n!=null&&(e-=n.length)}}return e}hidden(t){let e=pr.getItem(t);e!=null&&!e.isEmpty&&e.hidden()}visible(t){let e=pr.getItem(t);e!=null&&!e.isEmpty&&e.visible()}display(t,e){let r=e.sourceTrackChain[t.sourceIndex];if(!Array.isArray(r))return;let i=r[0],n=pr.getItem(i.id);if(n!=null)for(let s of t.tracks){let a=Id.build(n.layerId,s.start,s.end,s.width,s.net);this.lines.push(a)}}displayVia(t){let e=new fA(Lh(),1002,t.center,t.topPad/2);this.lines.push(e)}};function yVe(o){let t=new qt,e=Zt.getInstance();t.add("CANCEL",!0);let r=new qt;return r.add("WIRING_MODE_PUSHAWAY",!1,e.mode=="WIRING_MODE_PUSHAWAY"),r.add("WIRING_MODE_SURROUND",!1,e.mode=="WIRING_MODE_SURROUND"),r.add("WIRING_MODE_IGNORE",!1,e.mode=="WIRING_MODE_IGNORE"),t.addExtend("WIRING_MODE",r),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t.result}var S4=class S4{constructor(){this.currTool=null;this.time=0;this.opening=!1;he.subscribe("rightClickMenuCMD",this.parse.bind(this)),he.subscribe("TempMaskRightClickMenu",this.mask50ms.bind(this))}static getInstance(){return S4.instance==null&&(S4.instance=new S4),S4.instance}mask50ms(){this.time=new Date().getTime()+200}updateInputInfo(t){var s;let{left:e,top:r}=((s=window.frameElement)==null?void 0:s.getBoundingClientRect())||{},i=this.getRatio(),n=fi.getInstance();n.mouseX=(t.mouseX-e)*i,n.mouseY=(t.mouseY-r)*i}getMenuStatus(){return this.opening}parse(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;t.mouseInfo&&this.updateInputInfo(t.mouseInfo);let e=this.currTool!=null;t.isClose&&e?(this.currTool.parse({cmdKey:":"}),this.currTool=null):e&&(this.currTool.parse(t),this.currTool=null),e&&he.publish("updateCross",""),this.opening=!1}menuData(t,e){if(new Date().getTime()<=this.time)return;let r=this.getRatio();t.left=t.left/r,t.top=t.top/r,he.publish("rightClickPcbMenu",t,Q()),this.currTool=e,he.publish("TempMaskDialog",""),this.opening=!0}getRatio(t=1){return R.getInstance().getRatio()}close(){if(!(!R.getInstance().isactive||23==R.getInstance().doctype))return this.opening&&he.publish("rightClickPcbMenu",{state:"hide"},Q()),this.currTool!=null}};S4.instance=null;var $t=S4;function u3t(o,t){let e=o.octagon(),r=t.octagon(),i=(e.minY+e.maxY)/2,n=(r.minY+r.maxY)/2;return i-n}function d3t(o,t){let e=o.octagon(),r=t.octagon(),i=(e.minX+e.maxX)/2,n=(r.minX+r.maxX)/2;return i-n}var f1=class o{constructor(t,e){this.childs=new Array;this._octagon=null;this.parent=null;if(this.capacity=t,typeof e<"u"&&Array.isArray(e))for(let r of e)this.insert(r)}octagon(){return Ki.notnull(this._octagon)}itor(t,e,r=!1){let i=ko.getDefaultColor();r&&ko.auto(this.octagon().outline(),i);for(let n of this.childs)n instanceof o?n.itor(t+1,e,r):(ko.auto(n.octagon().outline(),i),e(n,t))}debug(t){for(let e of this.childs)console.log(t,e.octagon(),e instanceof o?"+":"-"),e instanceof o&&e.debug(t+" |--")}insert(t){let e=this.childs,r=t.octagon();if(!(t instanceof o))for(let i=0;i<e.length;i++){let n=e[i];if(n instanceof o&&r.isInside(n.octagon())){n.insert(t),this.union(r);return}}t instanceof o&&(t.parent=this),e.length<=this.capacity?e.push(t):(e.push(t),this.splitNode()),this.union(r)}union(t){this._octagon==null?this._octagon=t:this._octagon=this._octagon.union(t)}remove(t){if(t instanceof o&&t.childs.length>0)throw new Error;let e=this.childs,r=t.octagon(),i=new Array;for(let n=0;n<e.length;n++){let s=e[n];if(s===t)return e.splice(n,1),e.length>1?(this.updateBBox(),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):e.length==1?this.parent!==null?(this.parent.childs.push(this.childs[0]),this.childs[0]instanceof o&&(this.childs[0].parent=this.parent),this.childs.length=0,this.parent.remove(this),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):this.updateBBox():this.parent!==null?(this.parent.remove(this),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox()):this._octagon=null,1;s instanceof o&&r.isInside(s.octagon())&&i.push(s)}if(t instanceof o)throw new Error;for(let n of i){let s=n.remove(t);if(s===1)return this.childs.length>0&&this.updateBBox(),this.parent!==null&&this.parent.childs.length>0&&this.parent.updateBBox(),1;if(s!==0)throw new Error}return 0}recycle(){this.childs.length=0}updateBBox(){let t=this.childs[0].octagon();for(let e of this.childs)t=t.union(e.octagon());this._octagon=t}splitNode(){let t=this.childs,e=t.length,r=-1,i=-1,n=Number.NEGATIVE_INFINITY;for(let c=0;c<e;c++){let h=t[c];for(let u=c+1;u<e;u++){let d=t[u],p=h.octagon().union(d.octagon()).area();p>n&&(n=p,r=c,i=u)}}let s=this.asNode(t[r]),a=this.asNode(t[i]);for(let c=0;c<e;c++)if(c!==r&&c!==i){let h=t[c],u=h.octagon(),d=s._octagon.union(u).area(),p=a._octagon.union(u).area();d<p?s.insert(h):a.insert(h)}t.length=0;let l=this.parent;l!==null&&l.childs.length<this.capacity?(s.parent=l,a.parent=l,l.childs.push(s),l.childs.push(a),l.remove(this),l.updateBBox()):(s.parent=this,a.parent=this,t.push(s),t.push(a),this.updateBBox()),this.childs.length>0&&this.updateBBox(),s.updateBBox(),a.updateBBox()}asNode(t){if(t instanceof o)return t;{let e=new o(this.capacity);return e.insert(t),e}}},bVe=.5,PVe=1e5,r0=class{constructor(t){this.items=new Set;this.changeList=new Set;this.deadList=new Set;this.capacity=t,this.capacity2=t*t,this.root=new f1(t)}itor(t,e=!1){this.root.itor(0,t,e)}size(){return this.items.size}search(t){let e=Lc.converBBox(t);this.flushWhenNeed();let r=[],i=[];for(i.push(this.root);;){let n=i.shift();if(n!==void 0)for(let s of n.childs)e.isIntersectOctagon(s.octagon())&&(s instanceof f1?s.octagon().isInside(e)?this.add2Result(s,r):i.push(s):r.push(s));else break}return r}add2Result(t,e,r){if(t!==void 0)for(let i of t.childs)i instanceof f1?this.add2Result(i,e,r):(!r||r(i))&&e.push(i)}search2Cb(t,e){let r=Lc.converBBox(t);this.flushWhenNeed();let i=[this.root];for(;;){let n=i.pop();if(n!==void 0)for(let s of n.childs)r.isIntersectOctagon(s.octagon())&&(s instanceof f1?s.octagon().isInside(r)?this.addResult2Cb(s,e):i.push(s):e(s));else break}}addResult2Cb(t,e,r){if(t!==void 0)for(let i of t.childs)i instanceof f1?this.addResult2Cb(i,e,r):(!r||r(i))&&e(i)}searchInside(t){let e=Lc.converBBox(t);this.flushWhenNeed();let r=[],i=[];for(i.push(this.root);;){let n=i.shift();if(n!==void 0)for(let s of n.childs){let a=s.octagon();e.isIntersectOctagon(a)&&(s instanceof f1?a.isInside(e)?this.add2Result(s,r):i.push(s):a.isInside(e)&&r.push(s))}else break}return r}conditionSearch(t,e){let r=Lc.converBBox(t);this.flushWhenNeed();let i=[],n=[];for(n.push(this.root);;){let s=n.shift();if(s!==void 0)for(let a of s.childs)r.isIntersectOctagon(a.octagon())&&(a instanceof f1?a.octagon().isInside(r)?this.add2Result(a,i,e):n.push(a):e(a)&&i.push(a));else break}return i}insert(t){this.items.add(t),this.changeList.add(t)}remove(t){this.items.delete(t),this.deadList.add(t)}bbox(){return this.flushWhenNeed(),this.root.octagon().bbox()}flushDeleteWhenNeed(){let t=this.deadList.size;if(t>0){let e=1;if(this.items.size>0&&(e=t/this.items.size),e>bVe||t>PVe)this.fullRefresh(),this.deadList.clear(),this.changeList.clear(),this.deadList=new Set,this.changeList=new Set;else{for(let i of this.deadList)this.root.remove(i);this.deadList.clear(),this.deadList=new Set}}}flushWhenNeed(){let t=this.changeList.size+this.deadList.size;if(t>0){let e=1;if(this.items.size>0&&(e=t/this.items.size),e>bVe||t>PVe)this.deadList.clear(),this.changeList.clear(),this.deadList=new Set,this.changeList=new Set,this.fullRefresh();else{for(let i of this.deadList)this.root.remove(i);this.deadList.clear(),this.deadList=new Set;for(let i of this.changeList)this.items.has(i)&&this.root.insert(i);this.changeList.clear(),this.changeList=new Set}}}debug(){this.root.debug("")}recycle(){this.items.clear(),this.changeList.clear(),this.deadList.clear(),this.deadList=new Set,this.changeList=new Set,this.root.recycle()}fullRefresh(){let t=new Array;for(let e of this.items)t.push(e);for(;;){let e=this.organize(t);if(e.length>1)t=e;else break}this.root.recycle(),this.root=new f1(this.capacity,t)}organize(t){Er(t,d3t,0,t.length);let e=t.length,r=[];for(let i=0;i<e;)if(i+this.capacity2<=e){let n=i+this.capacity2;Er(t,u3t,i,n);for(let s=i;s<n;s+=this.capacity){let a=new f1(this.capacity,t.slice(s,s+this.capacity));r.push(a)}i=i+this.capacity*this.capacity}else{let n=new f1(this.capacity,t.slice(i,i+this.capacity));r.push(n),i=i+this.capacity}return r}};var I8=class{constructor(t,e){this.map=new Map;this.groupTypes=new Set(["Track","ArcTrack","Pad","Via","Image","Picture","Length Dimension","Smart Dimension","Protractor Dimension","Radius Dimension","Polygon","Rect","Circle","Copper","Inner","Component","Line","Arc","Ratline","Text","DRCResult","Combination"]);this.init=!1;this.capacity=t,this.otherMap=new Map,this.ratlineMap=new Map,this.func=e}itorTree(t,e=!1){for(let[r,i]of this.map)for(let[n,s]of i)t(s,n,r);if(!e){for(let[,r]of this.ratlineMap)t(r,57,"Ratline");for(let[r,i]of this.otherMap)t(i,r)}}itor(t,e){this.itorTree((r,i,n)=>{(!e||e(i,n))&&r.itor(t)})}size(){let t=0;for(let[,e]of this.map)for(let[,r]of e)t+=r.size();for(let[,e]of this.otherMap)t+=e.size();for(let[,e]of this.ratlineMap)t+=e.size();return t}itoratorAllItems(t){for(let[,e]of this.map)for(let[,r]of e)r.items.forEach(i=>{t(i)});for(let[,e]of this.otherMap)e.items.forEach(r=>{t(r)});for(let[,e]of this.ratlineMap)e.items.forEach(r=>{t(r)})}getSearchResult(){return this.func()}search(t,e,r=!0){let i=this.getSearchResult();return this.itorTree((n,s,a)=>{if(e&&!e(s,a))return;let l=i.getResults(a);for(let c of n.search(t))c.item.isEmpty?(c instanceof Ir?n instanceof r0&&n.remove(c):n instanceof r0||n.remove(c),this.remove(c)):l.add(c.item)},r),i}searchInside(t,e,r=!0){let i=this.getSearchResult();return this.itorTree((n,s,a)=>{if(e&&!e(s,a))return;let l=i.getResults(a);for(let c of n.searchInside(t))c.item.isEmpty?(c instanceof Ir?n instanceof r0&&n.remove(c):n instanceof r0||n.remove(c),this.remove(c)):l.add(c.item)},r),i}searchIntersectByType(t,e,r){let i=this.getSearchResult();for(let n of e){let s=this.map.get(n);if(s!=null){let a=i.getResults(n);for(let[l,c]of s){if(r&&!r(l,n))continue;let h=c.searchIntersect(t);for(let u of h)u.item.isEmpty?(u instanceof Ir?c instanceof r0&&c.remove(u):c instanceof r0||c.remove(u),this.remove(u)):a.add(u.item)}}}return i}search4Types(t,e,r){let i=this.getSearchResult();for(let n of e){let s=this.map.get(n);if(s!=null){let a=i.getResults(n);for(let[l,c]of s){if(r&&!r(l,n))continue;let h=c.search(t);for(let u of h)u.item.isEmpty?(u instanceof Ir?c instanceof r0&&c.remove(u):c instanceof r0||c.remove(u),this.remove(u)):a.add(u.item)}}}return i}searchByType(t,e){return this.search(t,(r,i)=>i==e,!1)}searchByTypes(t,e){return this.search(t,(r,i)=>i==null?!1:e.includes(i),!e.includes("Ratline"))}searchByLayer(t,e){return this.search(t,r=>r==e,e!=57)}searchByLayers(t,e){return this.search(t,r=>r==null?!1:e.includes(r),!e.includes(57))}conditionSearch(t,e,r,i=!0){let n=this.getSearchResult();return this.itorTree((s,a,l)=>{if(r&&!r(a,l))return;let c=n.getResults(l),h=s.conditionSearch(t,e);for(let u of h)u.item.isEmpty?(u instanceof Ir?s instanceof r0&&s.remove(u):s instanceof r0||s.remove(u),this.remove(u)):c.add(u.item)},i),n}getNodeGroupType(t){let e=t.item.model.modelType;if(this.groupTypes.has(e))return e}getNodeGroup(t,e){let r=this.getNodeGroupType(t),i=e||t.item.model.layerId||t.item.layerId;if(r){if(r=="Ratline"){let l=t.item.model.net,c=this.ratlineMap.get(l);return c||(c=new $u(this.capacity),this.ratlineMap.set(l,c)),c}}else{let a=this.otherMap.get(i);return a||(a=new $u(this.capacity),this.otherMap.set(i,a)),a}let n=this.map.get(r),s=n&&n.get(i);return s||(t instanceof Ir?s=new r0(this.capacity):s=new $u(this.capacity),n||(n=new Map,this.map.set(r,n)),n.set(i,s)),s}insert(t){t.update(),t.bbox()&&this.getNodeGroup(t).insert(t)}initInsertItem(t){t.update(),this.getNodeGroup(t).insert(t)}remove(t,e){this.getNodeGroup(t,e).remove(t)}updateBBox(t){let e=new _e;return this.itorTree((r,i,n)=>{if(r.size()>0){if(n=="DRCResult"||t&&n=="Text")return;e.ext1(r.bbox())}}),e.valid()?e.build1():null}bbox(){return this.flushWhenNeed(),this.updateBBox(!1)}getIgnoreTextBBox(){return this.flushWhenNeed(),this.updateBBox(!0)}flushDeleteWhenNeed(){this.itorTree(t=>{t.flushDeleteWhenNeed()})}flushWhenNeed(){this.itorTree(t=>{t.flushWhenNeed()})}recycle(){this.itorTree(t=>{t.recycle()}),this.map.clear()}};var rT=class{constructor(t){this.items=new Set;this.root=new f1(t)}itor(t,e=!1){this.root.itor(0,t,e)}size(){return this.items.size}search(t){let e=Lc.converBBox(t),r=[],i=[];for(i.push(this.root);;){let n=i.shift();if(n!==void 0)for(let s of n.childs)e.isIntersectOctagon(s.octagon())&&(s instanceof f1?s.octagon().isInside(e)?this.add2Result(s,r):i.push(s):r.push(s));else break}return r}add2Result(t,e,r){if(t!==void 0)for(let i of t.childs)i instanceof f1?this.add2Result(i,e,r):(!r||r(i))&&e.push(i)}conditionSearch(t,e){let r=Lc.converBBox(t),i=[],n=[];for(n.push(this.root);;){let s=n.shift();if(s!==void 0)for(let a of s.childs)r.isIntersectOctagon(a.octagon())&&(a instanceof f1?a.octagon().isInside(r)?this.add2Result(a,i,e):n.push(a):e(a)&&i.push(a));else break}return i}insert(t){this.items.add(t),this.root.insert(t)}remove(t){this.items.delete(t),this.root.remove(t)}bbox(){return this.root.octagon().bbox()}debug(){this.root.debug("")}recycle(){this.items.clear(),this.root.recycle()}};var Nie=class{constructor(){this.items=new Set}getResults(t){return this.items}};var iR=class extends Nie{constructor(){super(...arguments);this.items=new Set;this.tracks=new Set;this.arcTracks=new Set;this.pads=new Set;this.vias=new Set;this.images=new Set;this.pictures=new Set;this.dimensions=new Set;this.smartDimensions=new Set;this.protractor=new Set;this.radius=new Set;this.polygons=new Set;this.rects=new Set;this.circles=new Set;this.coppers=new Set;this.planes=new Set;this.components=new Set;this.ratlines=new Set;this.texts=new Set;this.drcs=new Set;this.includeRatlines=!1;this.filters=new Array;this.actions=new Array;this.onces=new Array}getResults(e){switch(e){case"Track":return this.tracks;case"ArcTrack":return this.arcTracks;case"Pad":return this.pads;case"Via":return this.vias;case"Image":return this.images;case"Picture":return this.pictures;case"Length Dimension":return this.dimensions;case"Smart Dimension":return this.smartDimensions;case"Protractor Dimension":return this.protractor;case"Radius Dimension":return this.radius;case"Polygon":return this.polygons;case"Rect":return this.rects;case"Circle":return this.circles;case"Copper":return this.coppers;case"Inner":return this.planes;case"Component":return this.components;case"Ratline":return this.ratlines;case"Text":return this.texts;case"DRCResult":case"DrcComponentSpacing":case"DrcCreepage":case"DrcComponentOverlap":return this.drcs;default:return this.items}}getResult(e){let r=new Array;for(let i of e)xe.addAll(r,this.getResults(i));return r}getConnectNodes(){let e=new Array;return xe.addAll(e,this.tracks),xe.addAll(e,this.arcTracks),xe.addAll(e,this.pads),xe.addAll(e,this.vias),xe.addAll(e,this.polygons),xe.addAll(e,this.rects),xe.addAll(e,this.circles),xe.addAll(e,this.coppers),xe.addAll(e,this.planes),e}getProfiles(){let e=new Array;return xe.addAll(e,this.polygons),xe.addAll(e,this.rects),xe.addAll(e,this.circles),e}getAllItems(){let e=new Array;return xe.addAll(e,this.tracks),xe.addAll(e,this.arcTracks),xe.addAll(e,this.pads),xe.addAll(e,this.vias),xe.addAll(e,this.polygons),xe.addAll(e,this.rects),xe.addAll(e,this.circles),xe.addAll(e,this.coppers),xe.addAll(e,this.planes),xe.addAll(e,this.images),xe.addAll(e,this.pictures),xe.addAll(e,this.dimensions),xe.addAll(e,this.smartDimensions),xe.addAll(e,this.protractor),xe.addAll(e,this.radius),xe.addAll(e,this.texts),xe.addAll(e,this.components),this.includeRatlines&&xe.addAll(e,this.ratlines),e}getPadsAndVias(){let e=new Array;return xe.addAll(e,this.pads),xe.addAll(e,this.vias),e}getArcs(){let e=new Array;return xe.addAll(e,this.arcTracks),xe.addAll(e,this.circles),e}getTracks(){let e=new Array;return xe.addAll(e,this.arcTracks),xe.addAll(e,this.tracks),e}getTPV(){let e=new Array;return xe.addAll(e,this.arcTracks),xe.addAll(e,this.tracks),xe.addAll(e,this.pads),xe.addAll(e,this.vias),e}setFilter(e){return this.filters.push(e),this}setAction(e){return this.actions.push(e),this}setOnceAction(e){return this.onces.push(e),this}doAction(e){for(let r of e){let i=this.getResults(r);for(let n of i)this.filter(n)&&this.todo(n)}}once(e){for(let r of e){let i=this.getResults(r);for(let n of i)if(this.filter(n)){for(let s of this.onces)if(s.doAction(n))return n}}return null}clearFilter(){this.filters.length=0}clearAction(){this.actions.length=0}filter(e){for(let r of this.filters)if(!r.doAction(e))return!1;return!0}todo(e){for(let r of this.actions)r.doAction(e)}clear(){this.items.clear(),this.tracks.clear(),this.arcTracks.clear(),this.pads.clear(),this.vias.clear(),this.images.clear(),this.pictures.clear(),this.dimensions.clear(),this.smartDimensions.clear(),this.protractor.clear(),this.radius.clear(),this.polygons.clear(),this.rects.clear(),this.circles.clear(),this.coppers.clear(),this.planes.clear(),this.components.clear(),this.ratlines.clear(),this.texts.clear(),this.drcs.clear(),this.clearFilter(),this.clearAction()}};var Lp=class{constructor(t){this.model=t,this._bbox=this.buildBBox()}octagon(){return this._bbox}update(){this._bbox=this.buildBBox()}buildBBox(){return this.model.isEmpty?null:this.model instanceof zr?Lc.trackToOctagon(this.model.start,this.model.end,this.model.width):Lc.converBBox(this.model.buildBBox())}bbox(){return this._bbox}},nR=class nR{constructor(){this._RTREE=null;this.rtree=new rT(15);this.shoveTree=new rT(15);this.shoveTreeMap=new Map;this.treeMap=new Map}static getInstance(){return nR.manager==null&&(nR.manager=new nR),nR.manager}add(t){let e=new Lp(t);this.treeMap.set(t,e),this.rtree.insert(e)}clearShoveTree(){this.shoveTree.recycle(),this.shoveTreeMap.clear()}addShoveTree(t){if(t.isEmpty)return;let e=new Lp(t);this.shoveTreeMap.set(t,e),this.shoveTree.insert(e)}deleteShoveTree(t){let e=this.shoveTreeMap.get(t);e!=null&&this.shoveTree.remove(e),this.shoveTreeMap.delete(t)}deleteTree(t){let e=this.treeMap.get(t);e!=null&&this.rtree.remove(e),this.treeMap.delete(t)}updateTree(t){if(t instanceof gt){if(!t.globalIndex.startsWith("TRACK"))return}else if(t instanceof Ct){if(!t.globalIndex.startsWith("VIA"))return}else return;let e=this.treeMap.get(t);e!=null?(this.rtree.remove(e),e.update()):(e=new Lp(t),this.treeMap.set(t,e)),this.rtree.insert(e)}checkModels(t){for(let e of t)this.shoveTreeMap.get(e)==null&&this.addShoveTree(e)}get RTREE(){return this._RTREE==null&&(this._RTREE=p3t()),this._RTREE}update(){for(let[t,e]of this.treeMap)if(t instanceof Ct){let r=e.buildBBox();r!=null?r.equals(e.bbox())||(this.rtree.remove(e),e.update(),this.rtree.insert(e)):(this.rtree.remove(e),this.treeMap.delete(t))}}search(t){let e=this.rtree.search(t),r=new Array(e.length),i=0;for(let n of e)r[i]=n.model,i++;return r}clear(){this.treeMap.clear(),this.rtree.recycle(),this.shoveTree.recycle(),this._RTREE!=null&&this._RTREE.map.clear(),this._RTREE=null,this.shoveTreeMap.clear()}};nR.manager=null,nR.partition=null;var oi=nR;function p3t(){let o=new I8(50,()=>new iR);for(let[e,r]of kt.map)switch(e){case"Track":case"ArcTrack":case"Pad":case"Via":{o.map.set(e,r);break}case"Polygon":case"Rect":case"Circle":{for(let[i,n]of r)for(let s of n.items){let a=s.item.model;a.isEmpty||!t(a)||(o.insert(s),a.globalIndex==R.getInstance().partitionId&&(oi.partition=a))}break}case"Image":case"Text":{for(let[i,n]of r)for(let s of n.items){let a=s.item.model;a.isEmpty||!t(a)||o.insert(s)}break}}function t(e){if(e.modelType=="Track"||e.modelType=="ArcTrack")return!0;if(e.modelType=="Pad")return!0;if(e.modelType=="Via")return!0;if(e.modelType=="Image"||e.modelType=="Text"){let r=Ze.getInstance().getLayer(e.layerId);if(ns(r.type))return!0}else if(e.modelType=="Polygon"||e.modelType=="Rect"||e.modelType=="Circle"){let r=e;switch(r.type){case"Prohibited Region":return!!r.component.track;case"Board Outline":case"Constraint Region":case"Partition":case"Slot Region":return!0;case"Fill Region":case"TearDrop":case"Line":{let i=Ze.getInstance().getLayer(r.layerId);if(ns(i.type)||r.layerId==11)return!0}}}return!1}return o}var E4=class E4{constructor(){this.ids=new Set}static getInstance(){return E4.manager==null&&(E4.manager=new E4),E4.manager}add(t){this.ids.add(t)}delete(t){this.ids.delete(t)}has(t){return this.ids.has(t)}clear(){this.ids=new Set}};E4.manager=null;var $l=E4;var C8=class{constructor(){this.trackStatus=new Map;this.viaStatus=new Map;this.whiteTrackStatus=new Map;this.previewTrackStatus=new Map;this.previewViaStatus=new Map;this.updateTrackStatus=new Map;this.selectTrackStatus=new Set;this.hightStatus=new Map}getTrackStatus(t){return this.trackStatus.get(t)}getViaStatus(t){return this.viaStatus.get(t)}setViaHidden(t){$l.getInstance().add(t),this.viaStatus.set(t,!1)}setViaVisible(t){$l.getInstance().delete(t),this.viaStatus.set(t,!0)}setTrackHidden(t){$l.getInstance().add(t),this.trackStatus.set(t,!1)}setTrackVisible(t){$l.getInstance().delete(t),this.trackStatus.set(t,!0)}setTrackWhite(t){this.whiteTrackStatus.set(t,!0)}getTrackWhite(t){return this.whiteTrackStatus.get(t)}setTrackPreview(t){this.previewTrackStatus.set(t,!0)}getTrackPreview(t){return this.previewTrackStatus.get(t)}setTrackUpdate(t){this.updateTrackStatus.set(t,!0)}getTrackUpdate(t){return this.updateTrackStatus.get(t)}setTrackSelect(t){this.selectTrackStatus.add(t)}getTrackSelect(t){return this.selectTrackStatus.has(t)}setViaPreview(t){this.previewViaStatus.set(t,!0)}getViaPreview(t){return this.previewViaStatus.get(t)}clearPreview(){this.previewTrackStatus.clear(),this.previewViaStatus.clear()}flip(){for(let[t,e]of this.trackStatus)this.trackStatus.set(t,!e);for(let[t,e]of this.viaStatus)this.viaStatus.set(t,!e)}unHightAll(){for(let[t]of this.hightStatus)this.hightStatus.set(t,!1)}setHight(t){this.hightStatus.set(t,!0)}deleteHight(t){this.hightStatus.delete(t)}deleteTrack(t){this.trackStatus.delete(t),this.whiteTrackStatus.delete(t),this.previewTrackStatus.delete(t),this.selectTrackStatus.delete(t)}deleteVia(t){this.viaStatus.delete(t),this.previewViaStatus.delete(t)}};var O4=class O4{constructor(){this.status=new Array;this.current=new C8}static getInstance(){return O4.manager==null&&(O4.manager=new O4),O4.manager}getNext(){this.status.push(this.current),this.current=new C8}undo(){let t=this.status.pop();return t!=null&&t.flip(),t}clear(){this.status.length=0,this.current=new C8}};O4.manager=null;var Cr=O4;var kie=new Error("list is empty"),S8=class{constructor(t,e){this._prev=null;this._next=null;this.fanoutInfo=null;this.ignoreArcOptimization=!1;this.ignore=!1;this.parent=t,this._item=e}get item(){return this._item}get prev(){return this._prev}get next(){return this._next}insertAfter(t){t._next=this._next,this._next=t,t._prev=this,t._next!==null&&(t._next._prev=t)}insertBefore(t){t._prev=this._prev,this._prev=t,t._next=this,t._prev!==null&&(t._prev._next=t)}clear(){this._prev=null,this._next=null}remove(){this._prev!==null&&(this._prev._next=this._next),this.next!==null&&(this.next._prev=this._prev),this._prev=null,this._next=null}set(t){this._item=t}},ECe=class{constructor(t){this._next=t}hasNext(){return this._next!==null}next(){let t=this._next;if(t!==null)return this._next=t.next,t.item;throw new Error("iterator is null")}},OCe=class{constructor(t){this._next=t}hasNext(){return this._next!==null}next(){let t=this._next;if(t!==null)return this._next=t.next,t;throw new Error("iterator is null")}},E8=class{constructor(){this.prev=null;this.next=null}remove(){this.prev!==null&&(this.prev=null),this.next!==null&&(this.next=null)}},Fn=class{constructor(){this.viaNode=new E8;this.parentNode=new E8;this.otherNode=new E8;this.first=null;this.last=null;this.cnt=0;this.startType=0;this.endType=0}replace(t,e,r,i=!1){var h,u,d;let n=new E8;n.prev=this.first,n.next=this.last,n.target=t?t.parent:r;let s=t?t.parent:r,a=this.getRange(t,e),l=this.listIterator(),c=e;if(c){let p=this.getRange(this.first,this.last);for(let m of p)this.remove(m);for(let m of p)m.ignore=!1,oi.getInstance().updateTree(m.item),s.insertNodeAfter(c,m),Cr.getInstance().current.setTrackVisible((u=m.item)==null?void 0:u.globalIndex),c=m}else{let p=[];for(;l.hasNext();){let m=this.getFirstNode();if(!m)break;this.shift(),p.push(m),m.ignore=!1,m.parent=s,oi.getInstance().updateTree(m.item),Cr.getInstance().current.setTrackVisible((h=m.item)==null?void 0:h.globalIndex)}i?(p=p.reverse(),p.forEach(m=>{s.addFirstNode(m)})):p.forEach(m=>{s.addLastNode(m)})}this.clear();for(let p of a)p.parent.remove(p),this.addLastNode(p),p.ignore=!0,oi.getInstance().deleteTree(p.item),Cr.getInstance().current.setTrackHidden((d=p.item)==null?void 0:d.globalIndex);this.parentNode=n}getRange(t,e){let r=new Array,i=t;for(;i!=null&&(r.push(i),i!=e);)i=i.next;return r}insertNodeAfter(t,e){return e.parent=this,t.insertAfter(e),t===this.last&&(this.last=e),this.cnt++,e}getFirstNode(){return this.first}getLastNode(){return this.last}add(t){return this.addLast(t)}push(t){return this.addLast(t)}pop(){return this.removeLast()}shift(){return this.removeFirst()}removeFirst(){let t=this.first;if(t===null)throw kie;return this.remove(t),t.item}removeLast(){let t=this.last;if(t===null)throw kie;return this.remove(t),t.item}addLast(t){return this.first===null||this.last===null?(this.first=new S8(this,t),this.last=this.first,this.cnt=1,this.first):this.insertAfter(this.last,t)}addLastNode(t){return t.parent=this,this.first===null||this.last===null?(this.first=t,this.last=this.first,this.cnt=1,this.first):(this.last.insertAfter(t),this.last=t,this.cnt++,t)}addFirst(t){if(this.first===null||this.last===null){let e=new S8(this,t);return this.first=e,this.last=e,this.cnt++,e}else return this.insertBefore(this.first,t)}addFirstNode(t){return t.parent=this,this.first===null||this.last===null?(this.first=t,this.last=this.first,this.cnt=1,this.first):(this.first.insertBefore(t),this.first=t,this.cnt++,t)}getFirst(){if(this.first===null)throw kie;return this.first.item}getLast(){if(this.last===null)throw kie;return this.last.item}insertAfter(t,e){let r=new S8(this,e);return t.insertAfter(r),t===this.last&&(this.last=r),this.cnt++,r}insertBefore(t,e){let r=new S8(this,e);return t.insertBefore(r),t===this.first&&(this.first=r),this.cnt++,r}remove(t){t===this.first&&(this.first=t.next),t===this.last&&(this.last=t.prev),t.remove(),this.cnt--}size(){return this.cnt}clear(){this.first=null,this.last=null,this.cnt=0}iterator(){return new ECe(this.first)}listIterator(){return new OCe(this.first)}toArray(){let t=new Array(this.cnt),e=this.first,r=0;for(;e!=null;)t[r]=e.item,e=e.next,r++;return t}getAllItems(){return this.toArray()}};var as=class{constructor(t,e){this.connectTrack=new Map;this.collideOrder=-1;this.item=t,this.isSource=e}addConnectTrack(t,e){this.connectTrack.set(t,e)}deleteConnectTrack(t){this.connectTrack.delete(t)}replace(t){Cr.getInstance().current.setViaVisible(t.globalIndex),Cr.getInstance().current.setViaHidden(this.item.globalIndex),this.item=t}};var EI=class{constructor(t){this.starts=new Array;this.ends=new Array;this.via=t;let e=this.getTracks(t.buildBBox()),r=t.center;for(let i of e){let n=i.model;n instanceof gt&&t.isContains(n.layerId)&&t.net==n.net&&!$l.getInstance().has(n.globalIndex)&&(n.start.distance2(r)<n.end.distance2(r)?this.starts.push(n):this.ends.push(n))}this.viaNode=Si.getInstance().createNode(this.via,!0)}getTracks(t){return kt.searchByTypes(t,["Track","ArcTrack"]).getTracks()}generateList(t){for(let e of this.starts)At.getInstance().getNode(e)==null&&new su(e,t).generateList();for(let e of this.ends)At.getInstance().getNode(e)==null&&new su(e,t).generateList()}getConnectTracks(t){let e=new Set;for(let r of this.starts)if(!e.has(r)){let i=new su(r,t);xe.addAllSet(e,i.tracks)}for(let r of this.ends)if(!e.has(r)){let i=new su(r,t);xe.addAllSet(e,i.tracks)}return e}};var A4=class A4{constructor(){this.map=new Map;this.nodeMap=new Map;this._lastNode=void 0;this.replaceMap=new Map}static getInstance(){return A4.manager==null&&(A4.manager=new A4),A4.manager}getNode(t){let e=this.nodeMap.get(t);if(!e){for(let[r,i]of this.nodeMap)if(r.globalIndex===t.globalIndex){e=i;break}}return e}getViaNode(t,e){return this._lastNode=this.nodeMap.get(t),this._lastNode==null?(new EI(t).generateList(e),this._lastNode=this.nodeMap.get(t)):this._lastNode.isSource&&(new EI(t).generateList(e),this._lastNode=this.nodeMap.get(t)),this._lastNode}addModel(t){this.map.set(t.globalIndex,t),oi.getInstance().add(t)}createNode(t,e){return this._lastNode=this.nodeMap.get(t),this._lastNode!=null?this._lastNode:(this._lastNode=new as(t,e),this.nodeMap.set(t,this._lastNode),this._lastNode)}getMapViaId(t){let e=this.replaceMap.get(t);for(;e;){let r=this.replaceMap.get(e);if(r)e=r;else break}return e}replace(t,e){let r=this.nodeMap.get(t);return r.replace(e),this.nodeMap.delete(t),this.nodeMap.set(e,r),this.replaceMap.get(e.globalIndex)?this.replaceMap.delete(e.globalIndex):t.globalIndex!=e.globalIndex&&this.replaceMap.set(t.globalIndex,e.globalIndex),r}getItem(t){return this.map.get(t)}delete(t){this.map.delete(t.globalIndex)}addVia(t,e,r,i,n,s,a,l,c,h,u,d,p,m=new Array,g=!1){e==0&&g&&(e=2);let y=new hg(t,e,r,i,n,m,s,a,l,c,u,d,p,h,void 0);return this.addModel(y),y}clear(){for(let[,t]of this.map)t.remove();this.map.clear(),this.nodeMap.clear(),this.replaceMap.clear()}};A4.manager=null;var Si=A4;var Bie=class{constructor(t){this.connectTrack=new Map;this.item=t}addConnectTrack(t,e){this.connectTrack.set(t,e)}deleteConnectTrack(t){this.connectTrack.delete(t)}};var Fie=class{constructor(t){this.starts=new Array;this.ends=new Array;this.via=t;let e=this.getTracks(t.buildBBox()),r=t.center;for(let i of e){let n=i.model;n instanceof gt&&(t.layerId==n.layerId||t.layerId==12&&!t.isUnuseLayer(n.layerId))&&t.net==n.net&&(n.start.distance2(r)<n.end.distance2(r)?this.starts.push(n):this.ends.push(n))}}getTracks(t){return kt.searchByTypes(t,["Track","ArcTrack"]).getTracks()}generateList(t){for(let e of this.starts)At.getInstance().getNode(e)==null&&new su(e,t).generateList();for(let e of this.ends)At.getInstance().getNode(e)==null&&new su(e,t).generateList()}};var _4=class _4{constructor(){this.nodeMap=new Map;this._lastNode=null}static getInstance(){return _4.manager==null&&(_4.manager=new _4),_4.manager}getNode(t,e){return this._lastNode=this.nodeMap.get(t),this._lastNode==null&&(this._lastNode=this.createNode(t),new Fie(t).generateList(e),this._lastNode=this.nodeMap.get(t)),this._lastNode}createNode(t){return this._lastNode=this.nodeMap.get(t),this._lastNode!=null?this._lastNode:(this._lastNode=new Bie(t),this.nodeMap.set(t,this._lastNode),this._lastNode)}clear(){this.nodeMap.clear()}};_4.manager=null;var Kl=_4;var f3t=Math.PI/2,A4i=Math.PI/4,_4i=Math.PI/8;function fg(o,t){return Math.abs(o)<f3t?t*Math.tan(Math.abs(o)):Number.MAX_VALUE}function zs(o,t){if(t.length!=3)return[o,o];let e=t[1].sub(t[0]),r=t[2].sub(t[1]),i=Math.abs(e.x)<1e-8&&Math.abs(e.y)<1e-8,n=Math.abs(r.x)<1e-8&&Math.abs(r.y)<1e-8,s=e.normalize(),a=r.normalize();return i&&n?[o,o]:!i&&n?[s,s]:i&&!n?[a,a]:[s,a]}function mA(o,t,e){let r=t.sub(o);return e.cross(r)}function aj(o,t,e){let r=t.sub(o);return e.dot(r)}function lj(o,t){let e=t.x-o.x,r=t.y-o.y;return Math.abs(e)>Math.abs(r)?e>0?new S(1,0):new S(-1,0):r>0?new S(0,1):new S(0,-1)}function O8(o,t=!0){let e=o.center,r=o.end(),i=Math.PI/2,n=o.sweep();return t?i=n===ae.CCW?i:-i:(r=o.start(),i=n===ae.CCW?-i:i),r.sub(e).normalize().rotate(S.ORIGIN,i)}function ACe(o,t){return o.cross(t)>0?ae.CCW:ae.CW}function TVe(o){let t=Math.PI,e=t/2,r=e/2,i=o.angleX(),n=t*6/180,s=r+e,a=r+e*2,l=r+e*3;return i>=r-n&&i<=r+n?new S(1,1).normalize():i>=s-n&&i<=s+n?new S(-1,1).normalize():i>=a-n&&i<=a+n?new S(-1,-1).normalize():i>=l-n&&i<=l+n?new S(1,-1).normalize():i<r||i>e*3+r?new S(1,0):i<e+r?new S(0,1):i<t+r?new S(-1,0):new S(0,-1)}function Vie(o,t=40){for(let e=0;e<o.length;e++)for(let r=e+1;r<o.length;r++){let i=o[e],n=o[r];if(i.distance1(n)>t)return!1}return!0}function A8(o){switch(o){case"Single wiring":return"SINGLE_WIRE";case"Differential pair wiring":return"DIFF_WIRE";case"Multi-route wiring":return"MULTI_WIRE"}}function xs(o){return o.partition!=R.getInstance().partitionId}var su=class{constructor(t,e){this.all=new Set;this.reverseTrack=new Array;this.tracks=new Array;this.track=t,this.layerId=t.layerId,this.precision=e,this.generateChain(t)}generateChain(t){let e=t.start,r=t.end;return this.all.add(t),this.tracks.push(t),t.locked||xs(t)||t.getParent()!=null?this:(this.getTracks(e,t.net,t.width),this.reverse(),this.reverseTrack.push(!1),this.getTracks(r,t.net,t.width,!1),this)}reverse(){if(this.reverseTrack.length!=0){this.reverseTrack.reverse(),this.tracks.reverse();for(let t=0,e=this.reverseTrack.length;t<e;t++)this.reverseTrack[t]=!this.reverseTrack[t]}}searchTracks(t){return kt.search4Types(t,["Pad","Via","Track","ArcTrack"],this.keep.bind(this)).getTPV()}keep(t,e){return e=="Track"||e=="ArcTrack"?t==this.layerId:e=="Pad"?t==12||t==this.layerId:e=="Via"}reversePath(){this.reverse(),[this.startType,this.endType]=[this.endType,this.startType],[this.start,this.end]=[this.end,this.start]}getTracks(t,e,r,i=!0){for(;t;){let n=new ht(t.x,t.x,t.y,t.y),s=this.searchTracks(n),a=[];for(let b of s)Mt.checkIsCanEditByItem(b)&&a.push(b.model);let l=new Array;for(let b of a)b instanceof Ct?b.net==e&&this.posEqual(b.center,t)&&b.isContains(this.layerId)&&l.push(b):b instanceof et?b.net==e&&this.posEqual(b.center,t)&&(b.layerId==this.layerId||b.layerId==12)&&l.push(b):b instanceof gt&&b.net==e&&!this.all.has(b)&&b.layerId==this.layerId&&(this.posEqual(b.start,t)||this.posEqual(b.end,t))&&l.push(b);let c=new Array,h=new Array,u=new Array;if(i&&this.start==null||!i&&this.end==null)for(let b of l){let P=null;if((b instanceof et||b instanceof Ct)&&(P=b),P!=null&&P.net==e&&this.posEqual(P.center,t)){i?(this.start=P,b instanceof et?this.startType=1:this.startType=2):(b instanceof et?this.endType=1:this.endType=2,this.end=P);return}}if(l.length==0){xe.addAll(l,a);let b=new Array;if(i&&this.start==null||!i&&this.end==null)for(let E of l){let O=null;if(E instanceof et?E.net==e&&(E.layerId==this.layerId||E.layerId==12)&&(O=E,b.push(O)):E instanceof Ct&&E.net==e&&E.isContains(this.layerId)&&(O=E,b.push(O)),O!=null&&O.net==e&&this.posEqual2(O.center,t)){i?(this.start=O,E instanceof et?this.startType=1:this.startType=2):(E instanceof et?this.endType=1:this.endType=2,this.end=O);return}}let P=new wb(t,r/2,S.ORIGIN,{point:t,item:null,isStart:i}),T=new Array;T.push(P);for(let E of l)if(E instanceof gt&&this.itemIsWire(E)&&!this.all.has(E)&&E.net==e&&E.layerId==this.layerId&&E.length>1e-4){if(i&&!E.start.equals1(this.track.end)||!i&&!E.start.equals1(this.track.start)){let O=new wb(E.start,E.width/2,S.ORIGIN,{point:E.end,item:E,isStart:!0});T.push(O)}if(i&&!E.end.equals1(this.track.end)||!i&&!E.end.equals1(this.track.start)){let O=new wb(E.end,E.width/2,S.ORIGIN,{point:E.start,item:E,isStart:!1});T.push(O)}}new eR(T).classify();let C=P.getConnectNeighbors();for(let E of C){c.push(E.component.point);let O=E.component.item;E.component.isStart?h.push(!1):h.push(!0),this.all.add(O),u.push(O)}if(c.length==0){let E=Number.MAX_VALUE,O=null;for(let _ of b)if(_.inOutline(t)){let x=_.center.distance2(t);x<E&&(E=x,O=_)}if(O!=null){i?(this.start=O,O instanceof et?this.startType=1:this.startType=2):(O instanceof et?this.endType=1:this.endType=2,this.end=O);return}}}else for(let b of l)b instanceof gt&&this.itemIsWire(b)&&!this.all.has(b)&&b.net==e&&b.layerId==this.layerId&&b.length>1e-4&&(this.posEqual2(b.start,t)?(c.push(b.end),h.push(!1),this.all.add(b),u.push(b)):this.posEqual2(b.end,t)&&(c.push(b.start),h.push(!0),this.all.add(b),u.push(b)));let d=c.length,p=new Array,m=new Array,g=new Array;for(let b=0;b<d;b++){let P=c[b],T=h[b],I=u[b];p.push(P),m.push(T),g.push(I)}let y=At.getInstance();if(g.length==1&&!y.getNode(g[0])){let b=g[0];if(b.locked||xs(b)||b.getParent()!=null){i?this.startType=10:this.endType=10;for(let P of g)this.all.delete(P)}else{this.tracks.push(g[0]),this.reverseTrack.push(m[0]),t=p[0];continue}}else if(c.length==1){i?this.startType=12:this.endType=12;for(let b of u)this.all.delete(b)}else if(c.length>1){i?this.startType=11:this.endType=11;for(let b of u)this.all.delete(b)}else for(let b of u)this.all.delete(b);t=null}}posEqual(t,e){return this.precision==null?t.equals1(e):t.distance1(e)<this.precision}posEqual2(t,e){return this.precision==null?t.distance2(e)<1e-4:t.distance1(e)<this.precision}itemIsWire(t){return t instanceof gt}generateList(){let t=At.getInstance(),e=t.createList(),r=this.tracks.length;for(let i=0;i<r;i++){let n=this.tracks[i];if(this.reverseTrack[i]){if(n instanceof zr){let{start:a,end:l}=n;n.start=l,n.end=a}else if(n instanceof Ii){let{center:a,radius:l,startAngle:c,endAngle:h,sweep:u}=n;n.startAngle=h,n.endAngle=c,n.sweep=u==ae.CCW?ae.CW:ae.CCW}}t.createNode(n,e)}if(e.startType=this.startType,e.endType=this.endType,this.start!=null&&this.start instanceof Ct){let i=Si.getInstance(),n=i.getNode(this.start);n==null&&(n=i.createNode(this.start,!0)),n.addConnectTrack(e,!0),e.viaNode.prev=n}if(this.start!=null&&this.start instanceof et&&(Kl.getInstance().getNode(this.start,this.precision).addConnectTrack(e,!0),e.otherNode.prev=this.start),this.end!=null&&this.end instanceof Ct){let i=Si.getInstance(),n=i.getNode(this.end);n==null&&(n=i.createNode(this.end,!0)),n.addConnectTrack(e,!1),e.viaNode.next=n}this.end!=null&&this.end instanceof et&&(Kl.getInstance().getNode(this.end,this.precision).addConnectTrack(e,!1),e.otherNode.next=this.end)}};var v4=class v4{constructor(){this.map=new Map;this._lastList=null;this._lastNode=null}static getInstance(){return v4.manager==null&&(v4.manager=new v4),v4.manager}getNode(t){return this._lastNode=this.map.get(t.globalIndex),this._lastNode!=null&&this._lastNode.set(t),this._lastNode}getListNode(t){return this._lastNode=this.getNode(t),this._lastNode==null&&(new su(t).generateList(),this._lastNode=this.getNode(t)),this._lastNode}set(t,e){this.map.set(t.globalIndex,e)}delete(t){this.map.delete(t.globalIndex)}createList(){return this._lastList=new Fn,this._lastList}createNode(t,e){return this._lastNode=this.getNode(t),this._lastNode!=null?this._lastNode:(this._lastNode=e.add(t),this.set(t,this._lastNode),this._lastNode)}createFirstNode(t,e){return this._lastNode=this.getNode(t),this._lastNode!=null?this._lastNode:(this._lastNode=e.addFirst(t),this.set(t,this._lastNode),this._lastNode)}clear(){this.map.clear(),this._lastList=null,this._lastNode=null}};v4.manager=null;var At=v4;var Lr=class extends Kh{constructor(e=""){super();this.commands=new Array;this.description=e}upload(e){throw new Error("Method not implemented.")}updateData(){throw new Error("Method not implemented.")}undo(){let e=this.commands.length;if(e!=0)for(let r=e-1;r>=0;r--)this.commands[r].undo()}redo(){if(this.commands.length!=0)for(let r of this.commands)r.redo()}addCommand(e){this.commands.push(e)}get length(){return this.commands.length}};var gA=class{constructor(t,e,r){this.path=new Array;let i=new Array;for(let h of t){if(h instanceof M&&h.length()<1e-8)continue;let u=this.getPrimitive(h,e,r);if(u!=null){if(i.length>0&&u instanceof q){let d=u.start().sub(u.center).normalize(),p=u.sweep()==ae.CCW?new S(d.y,-d.x):new S(-d.y,d.x),m=this.addLine(u.start(),p,e,!0);m.length()>1e-8&&i.push(m)}if(i.push(u),u instanceof q){let d=u.end().sub(u.center).normalize(),p=u.sweep()==ae.CCW?new S(-d.y,d.x):new S(d.y,-d.x),m=this.addLine(u.end(),p,e,!1);m.length()>1e-8&&i.push(m)}}}for(let h=0,u=i.length;h<u;h++){let d=i[h],p=i[h+1];if(p!=null){let m=this.getPoint(d,p);if(m!=null){let g=this.modifyPrimitiveEnd(d,m),y=this.modifyPrimitiveStart(p,m);i.splice(h,2,g,y)}}}if(i.length==0)return;let n=ge.build2(i),s=new Array;for(let h=0,u=n.primitives.length;h<u;){let d=n.primitives[h],p=this.getInters(d,n.primitives,h+1);if(p>h+1){h=p;let m=this.getPoint(d,n.primitives[p]);if(m!=null){let g=this.modifyPrimitiveEnd(d,m),y=this.modifyPrimitiveStart(n.primitives[p],m);n.primitives.splice(h,1,g),n.primitives.splice(p,1,y),s.push(g)}}else s.push(d),h++}let a=this.getNearPoint(s[s.length-1],t[t.length-1].end()),l=this.modifyPrimitiveEnd(s[s.length-1],a);if(l!=null&&s.splice(s.length-1,1,l),s.length==0)return;let c=ge.build2(s);this.path=c.primitives}getNearPoint(t,e){let i=new er(t,new M(e,e)).getLine();return i.start().distance2(e)<i.end().distance2(e)?i.end():i.start()}isParaller(t,e){if(t instanceof M&&e instanceof M){let r=t.direct.cross(e.direct);if(ne.eq(r,0))return!0}return!1}getPoint(t,e){let r=Pt(t,e),i=null,n=Number.MAX_VALUE,s=this.isParaller(t,e),a=null;for(let l=0;l<r;l+=2){let c=new S(Ee[l],Ee[l+1]),h=c.distance2(t.start());h<n&&(i=c,n=h),a==null?a=c:a=a.add(c)}return s&&r>0&&a!=null?a.mul(2/r):i}modifyPrimitiveStart(t,e){if(t instanceof M)return new M(e,t.end());if(t instanceof q){if(t.start().equals1(e))return t;let r=e.angleD(t.center);return q.build2(t.center,r,t.endAngle(),t.rx,t.ry,t.sweep())}return null}modifyPrimitiveEnd(t,e){if(t instanceof M)return new M(t.start(),e);if(t instanceof q){if(t.end().equals1(e))return t;let r=e.angleD(t.center);return q.build2(t.center,t.startAngle,r,t.rx,t.ry,t.sweep())}return null}getInters(t,e,r){let i=-1;for(let n=r,s=e.length;n<s;n++){let a=e[n];Pt(t,a)>0&&(i=n)}return i}getPrimitive(t,e,r){if(t instanceof M){let i=t.end().sub(t.start()).normalize(),n=new S(-i.y,i.x).mul(e);r==ae.CW&&(n=n.mul(-1));let s=t.start().sub(i.mul(e)).add(n),a=t.end().add(i.mul(e)).add(n);return new M(s,a)}else if(t instanceof q){let i=t.rx;return t.sweep()==ae.CCW?r==ae.CCW?i=t.rx-e:i=t.rx+e:r==ae.CCW?i=t.rx+e:i=t.rx-e,i<=0?null:q.build2(t.center,t.startAngle,t.endAngle(),i,i,t.sweep())}return null}addLine(t,e,r,i){let n=t.add(e.mul(r));return i?new M(n,t):new M(t,n)}};function _Ce(o){let t=0;for(let e of o)e instanceof M?t+=e.length():e instanceof q&&(t+=Math.abs(zt.toRadians(e.sweepAngle)*e.rx));return t}function Et(o,t){o=Array.isArray(o)?o:[o];for(let e=o.length;e>=0;e--){let r=o[e];if(!(e>0&&m3t(r))){if(r instanceof M)return r.direct;if(r instanceof q){t=t||r.end();let i=t.sub(r.center).normalize();return r.sweep()==ae.CCW?new S(-i.y,i.x):new S(i.y,-i.x)}}}return null}function m3t(o){return o instanceof M?ne.eq(o.length(),0):o instanceof q?ne.eq(o.sweepAngle,0):!0}function IVe(o){let t=new Array(o.length);for(let e=0,r=o.length-1;r>=0;e++,r--){let i=pp(o[r]);t[e]=i}return t}function Gu(o,t){if(o instanceof q){if(Math.abs(o.sweepAngle)===360){let i=o.center.sub(t).mul(2).add(t),n=q.build4(i,t,o.center,o.rx,o.rx,o.sweep()),s=q.build4(t,i,o.center,o.rx,o.rx,o.sweep());return[n,s]}let e=q.build4(o.start(),t,o.center,o.rx,o.rx,o.sweep()),r=q.build4(t,o.end(),o.center,o.rx,o.rx,o.sweep());return e.start().equals1(e.end())&&(e=new M(o.start(),t)),r.start().equals1(r.end())&&(r=new M(t,o.end())),[e,r]}else return[new M(o.start(),t),new M(t,o.end())]}function oR(o,t){if(t.length==1)return Gu(o,t[0]);let e=new Array;if(o instanceof q){if(Math.abs(o.sweepAngle)===360){let n=t[0];for(let a=1,l=t.length;a<l;a++){let c=t[a],h=q.build4(n,c,o.center,o.rx,o.rx,o.sweep());h.start().equals1(h.end())&&(h=new M(n,c)),n=c,e.push(h)}let s=q.build4(n,t[0],o.center,o.rx,o.rx,o.sweep());return s.start().equals1(s.end())&&(s=new M(s.start(),s.end())),e.push(s),e}let r=o.start();for(let n of t){let s=q.build4(r,n,o.center,o.rx,o.rx,o.sweep());s.start().equals1(s.end())&&(s=new M(r,n)),r=n,e.push(s)}let i=q.build4(r,o.end(),o.center,o.rx,o.rx,o.sweep());return i.start().equals1(i.end())&&(i=new M(r,o.end())),e.push(i),e}else{let r=o.start();for(let n of t){let s=new M(r,n);r=n,e.push(s)}let i=new M(r,o.end());return e.push(i),e}}function mg(o,t,e=1e-8){return Math.abs(o.cross(t))<=e}function A3(o,t,e=1e-8){return Math.abs(o.dot(t))<=e}function cj(o,t,e=1e-8){let r=o.cross(t);return Math.abs(r)<=e?null:r>0?ae.CCW:ae.CW}function vCe(o,t,e=1e-8){return o.dot(t)>=1-e}function Dy(o,t){if(t instanceof M){let e=t.end().sub(t.start()).normalize(),r=o.sub(t.start()).normalize(),i=e.cross(r);return ne.greater(i,0)?ae.CCW:ne.less(i,0)?ae.CW:null}else if(t instanceof q){let e=t.center,r=t.rx,i=t.sweep(),n=o.distance1(e);return ne.greater(n,r)?i==ae.CCW?ae.CW:ae.CCW:ne.less(n,r)?i:null}}function iT(o,t,e){let r=t.cross(e),i=t.cross(o),n=e.cross(o);return r*i>0&&i*n<0}function Mm(o,t,e,r){let i=o.start(),n=o.end();if(o instanceof q){let s=t.sub(o.center).normalize(),a=i.sub(o.center).normalize(),l=n.sub(o.center).normalize();if(iT(s,a,l))return Dy(t,o);if(ne.eq(Math.abs(o.sweepAngle),180)){if(o.sweepAngle>0){if(ne.greater(a.cross(s),0))return Dy(t,o)}else if(ne.greater(l.cross(s),0))return Dy(t,o)}}if(t.distance2(i)<t.distance2(n))if(e!=null){let s=t.sub(i).normalize(),a=Et(e).mul(-1),l=Et(o,i),c=a.mul(-1).cross(l);return ne.eq(c,0)?Dy(t,o):iT(s,a,l)?ne.greater(c,0)?ae.CCW:ae.CW:mg(s,a)&&e.bbox().isContains(t)||mg(s,l)&&o.bbox().isContains(t)?null:ne.greater(c,0)?ae.CW:ae.CCW}else return Dy(t,o);else if(r!=null){let s=t.sub(n).normalize(),a=Et(o,n).mul(-1),l=Et(r,r.start()),c=a.mul(-1).cross(l);return ne.eq(c,0)?Dy(t,o):iT(s,a,l)?ne.greater(c,0)?ae.CCW:ae.CW:mg(s,a)&&o.bbox().isContains(t)||mg(s,l)&&r.bbox().isContains(t)?null:ne.greater(c,0)?ae.CW:ae.CCW}else return Dy(t,o)}var CVe=new Rc(1e-4);function sR(o,t){return!!(CVe.eq(o.direct.cross(t.sub(o.start())),0)&&o.bbox().extendOfSize(1e-4).isContains(t))}function aR(o,t){if(o.start().equals1(t)||o.end().equals1(t))return!0;let e=t.sub(o.center);if(CVe.eq(e.length(),o.rx)&&o.bbox().extendOfSize(1e-4).isContains(t)){e=e.normalize();let r=o.start().sub(o.center).normalize(),i=o.end().sub(o.center).normalize();return Math.abs(o.sweepAngle)<180?iT(e,r,i):!iT(e,r,i)}return!1}var Zl=class o{constructor(t,e,r,i,n,s){this.start=t,this.end=e,this.pts=r;let a=this.getNear(t,r,!0),l=this.isEndpoint(this.startPt,a),c=this.getNear(e,r,!1),h=this.isEndpoint(this.endPt,c),u=Dy(t,this.startPt)||ae.CW,d=r.indexOf(this.startPt),p=r.indexOf(this.endPt),m=o.getPoint(e,c);function g(y){if(n!=null&&y.length>0){let b=Pt(n,y[0]);if(b>0){let P=new Array;for(let T=0;T<b;T+=2)P.push(new S(Ee[T],Ee[T+1]));an(P,n),t=P[0]}}if(s!=null&&y.length>0){let b=Pt(s,y[y.length-1]);if(b>0){let P=new Array;for(let T=0;T<b;T+=2)P.push(new S(Ee[T],Ee[T+1]));an(P,s),e=P[P.length-1]}}}if(d<p){let y=r.slice(d,p);y.push(this.endPt);let b=i==null?a.getDistance():i>a.getDistance()?i:a.getDistance(),P=new gA(y,b,u);this.result=P.path,g(this.result);let T=o.modifyStart(t,this.result[0]);if(this.result.splice(0,1,T),this.result.length==0)return;let I=this.result.pop();for(;this.result.length>0&&I.length()<1e-8;)I=this.result.pop();let C=new M(m,m),E=new er(C,I),O=o.getPoint(m,E),_=o.modifyEnd(O,I);this.result.push(_)}else if(d===p){let y=[this.startPt],b=i==null?a.getDistance():i>a.getDistance()?i:a.getDistance();if(this.startPt instanceof q&&this.startPt.isCircle()){this.result=this.interceptCircle(this.startPt,t,e,u,b);return}let P=new gA(y,b,u);if(this.result=P.path,this.result.length==0)return;g(this.result);let T=this.result.pop();for(;this.result.length>0&&T.length()<1e-8;)T=this.result.pop();let I=new M(m,m),C=new er(I,T),E=o.getPoint(m,C),O=o.modifyStart(t,T),_=o.modifyEnd(E,O);this.result.push(_)}else{let y=r.slice(p,d);y.push(this.startPt);let b=i==null?a.getDistance():i>a.getDistance()?i:a.getDistance(),P=new gA(y,b,u);for(this.result=P.path,g(this.result);this.result.length>0;){let I=this.result.pop();if(I instanceof M){if(l||sR(I,t)){I=o.modifyEnd(t,I),this.result.push(I);break}}else if(I instanceof q&&(l||aR(I,t))){I=o.modifyEnd(t,I),this.result.push(I);break}}if(this.result.length==0)return;let T=this.result.shift();if(ne.eq(c.getDistance(),b)&&Dy(e,this.endPt)==u){let I=o.modifyStart(e,T);this.result.unshift(I)}else{let I=new M(m,m),C=new er(I,T),E=o.getPoint(m,C),O=o.modifyStart(E,T);this.result.unshift(O)}this.result=this.reverse(this.result)}}interceptCircle(t,e,r,i,n){let s=(e.angleD(t.center)+360)%360,a=(r.angleD(t.center)+360)%360,l=t.rx;if(t.sweep()==ae.CCW?i==ae.CCW?l=t.rx-n:l=t.rx+n:i==ae.CCW?l=t.rx+n:l=t.rx-n,l<=0)return null;{let c=a-s,h;return a>s?Math.abs(c)>180?h=ae.CW:h=ae.CCW:Math.abs(c)>180?h=ae.CCW:h=ae.CW,[q.build2(t.center,s,a,l,l,h)]}}isEndpoint(t,e){let r=e.getLine();return r.start().equals1(t.start())||r.start().equals1(t.end())||r.end().equals1(t.start())||r.end().equals1(t.end())}reverse(t){let e=new Array(t.length);for(let r=0,i=t.length-1;i>=0;r++,i--){let n=pp(t[i]);e[r]=n}return e}static getPoint(t,e){if(e.getDistance()==0)return t;let r=e.getLine(),i=t.distance2(r.start()),n=t.distance2(r.end());return i>n?r.start():r.end()}static modifyStart(t,e){if(e instanceof M)return new M(t,e.end());if(e instanceof q){if(e.end().equals1(t))return new M(e.end(),t);let r=e.sweep();V0(e,t)||(r=r==ae.CCW?ae.CW:ae.CCW);let i=t.angleD(e.center);return q.build2(e.center,i,e.endAngle(),e.rx,e.ry,r)}}static modifyEnd(t,e){if(e instanceof M)return new M(e.start(),t);if(e instanceof q){if(e.start().equals1(t))return new M(e.start(),t);let r=e.sweep();V0(e,t)||(r=r==ae.CCW?ae.CW:ae.CCW);let i=t.angleD(e.center);return q.build2(e.center,e.startAngle,i,e.rx,e.ry,r)}}get startpt(){return this.startPt}getNear(t,e,r){let i=new M(t,t),n=Number.MAX_VALUE,s=null,a=null;for(let l of e){let c=new er(i,l);if(c.getDistance()<n)s=c,n=c.getDistance(),a=c.getLine().direct,r?this.startPt=l:this.endPt=l;else if(Math.abs(c.getDistance()-n)<1e-8){let h=c.getLine(),u=r?this.startPt:this.endPt,d=this.getDot(a,u,t),p=this.getDot(h.direct,l,t);Math.abs(d)>Math.abs(p)&&(s=c,n=c.getDistance(),a=c.getLine().direct,r?this.startPt=l:this.endPt=l)}}return s}getDot(t,e,r){if(e instanceof M)return t.dot(e.direct);if(e instanceof q){let i=r.sub(e.center).normalize(),n=e.sweep()==ae.CCW?new S(-i.y,i.x):new S(i.y,-i.x);return t.dot(n)}return 1}},Gie=class{constructor(t,e,r,i){this.start=t,this.end=e,this.pts=r;let n=this.getNear(t,r,!0),s=this.getNear(e,r,!1),a=Dy(t,this.startPt)||ae.CW,l=r.indexOf(this.startPt),c=r.indexOf(this.endPt),h=Zl.getPoint(e,s);if(l<c){let u=r.slice(l,c);u.push(this.endPt);let d=i==null?n.getDistance():i>n.getDistance()?i:n.getDistance(),p=new gA(u,d,a);this.result=p.path;let m=Zl.modifyStart(t,this.result[0]);this.result.splice(0,1,m);let g=this.result.pop();for(;g.length()<1e-8;)g=this.result.pop();let y=new M(h,h),b=new er(y,g),P=Zl.getPoint(h,b),T=Zl.modifyEnd(P,g);this.result.push(T)}else if(l===c){let u=[this.startPt],d=i==null?n.getDistance():i>n.getDistance()?i:n.getDistance(),p=new gA(u,d,a);this.result=p.path;let m=this.result.pop();for(;m.length()<1e-8;)m=this.result.pop();let g=new M(h,h),y=new er(g,m),b=Zl.getPoint(h,y),P=Zl.modifyStart(t,m),T=Zl.modifyEnd(b,P);this.result.push(T)}else{let u=r.slice(c,l);u.push(this.startPt);let d=i==null?n.getDistance():i>n.getDistance()?i:n.getDistance(),p=new gA(u,d,a);this.result=p.path;let m=Zl.modifyEnd(t,this.result[this.result.length-1]);this.result.splice(this.result.length-1,1,m);let g=this.result.shift(),y=new M(h,h),b=new er(y,g),P=Zl.getPoint(h,b),T=Zl.modifyStart(P,g);this.result.splice(0,0,T),this.result=this.reverse(this.result)}}reverse(t){let e=new Array(t.length);for(let r=0,i=t.length-1;i>=0;r++,i--){let n=pp(t[i]);e[r]=n}return e}static getPoint(t,e){if(e.getDistance()==0)return t;let r=e.getLine(),i=t.distance2(r.start()),n=t.distance2(r.end());return i>n?r.start():r.end()}static modifyStart(t,e){if(e instanceof M)return new M(t,e.end());if(e instanceof q){let r=e.sweep();V0(e,t)||(r=r==ae.CCW?ae.CW:ae.CCW);let i=t.angleD(e.center);return q.build2(e.center,i,e.endAngle(),e.rx,e.ry,r)}}static modifyEnd(t,e){if(e instanceof M)return new M(e.start(),t);if(e instanceof q){let r=e.sweep();V0(e,t)||(r=r==ae.CCW?ae.CW:ae.CCW);let i=t.angleD(e.center);return q.build2(e.center,e.startAngle,i,e.rx,e.ry,r)}}getNear(t,e,r){let i=new M(t,t),n=Number.MAX_VALUE,s=null,a=null;if(r){let l=e[0];return this.startPt=l,new er(i,l)}else{let l=e[e.length-1];return this.endPt=l,new er(i,l)}}getDot(t,e,r){return e instanceof M?t.dot(e.direct):e instanceof q?t.dot(r.sub(e.center).normalize()):1}};var mi=class extends Kh{upload(t){}updateData(){}constructor(t,e=!1){super(),this.list=t,this.previous=t.parentNode.prev,this.next=t.parentNode.next,this.insertPre=e}redo(){this.list.replace(this.previous,this.next,this.list.parentNode.target,this.insertPre),this.previous=this.list.parentNode.prev,this.next=this.list.parentNode.next}undo(){this.list.replace(this.previous,this.next,this.list.parentNode.target,this.insertPre),this.previous=this.list.parentNode.prev,this.next=this.list.parentNode.next}};var x4=class x4{constructor(){this.id=0}static getInstance(){return x4.manager==null&&(x4.manager=new x4),x4.manager}getID(){return this.id++}};x4.manager=null;var rf=x4;var R4=class R4{constructor(){this.map=new Map;this._last=null}static getInstance(){return R4.manager==null&&(R4.manager=new R4),R4.manager}addModel(t){return this._last=t,this.map.set(t.globalIndex,this._last),oi.getInstance().add(t),this._last}getItem(t){return this.map.get(t)}delete(t){this.map.delete(t.globalIndex)}deleteAll(){for(let[,t]of this.map)t.remove();this.map.clear(),this._last=null}addTrack(t,e,r,i,n,s,a){return this._last=new zr(t,e,r,i,n,s,a,null),this.addModel(this._last),this._last}addArcTrack(t,e,r,i,n,s,a,l,c,h,u=1){return this._last=new Ii(t,e,r,i,l,n,s,a,c,h,u,null),this.addModel(this._last),this._last}};R4.manager=null;var Ml=R4;var lR=class extends Kh{upload(t){throw new Error("Method not implemented.")}updateData(){throw new Error("Method not implemented.")}constructor(t,e,r){super(),this.gId=t.globalIndex,this.list=e,this.node=r}redo(){let t=Ml.getInstance().getItem(this.gId);this.node.set(t),this.list.addLastNode(this.node),At.getInstance().set(t,this.node)}undo(){this.list.remove(this.node);let t=this.node.item;this.node.set(null),At.getInstance().delete(t)}};var yA=class extends ro{constructor(t,e){super(),this.track=t.clone();let r=t.getGroupID();r&&this.track.setGroupID(r),this.net=t.net,this.action=e}rebuild(){let t=Ml.getInstance().getItem(this.track.globalIndex),e=this.track.clone();e.net=this.net,t!=null&&At.getInstance().getNode(t).set(e);let r=this.track.getGroupID();return r&&e.setGroupID(r),Ml.getInstance().addModel(e),Cr.getInstance().current.setTrackVisible(e.globalIndex),e}getItem(){return"ignore"}remove(){let t=this.track.globalIndex,e=Ml.getInstance().getItem(t);e.remove(),oi.getInstance().deleteTree(e),Ml.getInstance().delete(e),Cr.getInstance().current.setTrackHidden(t)}modify(){let t=this.track.globalIndex,e=Ml.getInstance().getItem(t)||Sn.getInstance().getItem(t),r=e.clone(),i=e.getGroupID();i&&r.setGroupID(i);let n=e.net;e.layerId!=this.track.layerId&&(e.layerId=this.track.layerId),e.start.equals(this.track.start)||(e.start=this.track.start),e.end.equals(this.track.end)||(e.end=this.track.end),e.width!=this.track.width&&(e.width=this.track.width),e.locked!=this.track.locked&&(e.locked=this.track.locked),e.net!=this.net&&(e.net=this.net),this.track=r,this.net=n}updateData(){throw new Error("Method not implemented.")}upload(t){throw new Error("Method not implemented.")}};var ds=class o{constructor(t){this.changeFanOutMode=!1;this.userModifyWidth=!1;this.userModifyViaSize=!1;this._wireMode=t,this.fanOutMode=1}static getInstance(t){return o.instance||(o.instance=new o(t)),t&&(o.instance._wireMode=t),o.instance}set wireMode(t){this._wireMode=t}get wireMode(){return this._wireMode}get wireConfirmType(){return this._wireMode=="Single wiring"?le.pcbConfig.wireConfirm:"current"}get viaPosition(){return this._wireMode=="Single wiring"?le.pcbConfig.addViaMethodWhileRoute:"currentInflectionPoint"}get autoChangeLayerWhileRoutingVias(){return le.pcbConfig.autoChangeLayerWhileRoutingVias}get dblclickPlaceViasWhileRouting(){return le.pcbConfig.dblclickPlaceViasWhileRouting}get placeBlind(){return le.pcbConfig.placeBlind}get autoTerminateRouting(){return le.pcbConfig.autoTerminateRouting}get showNetLength(){return this._wireMode=="Multi-route wiring"?!1:le.pcbConfig.showNetLength}get showDiffLength(){return this._wireMode=="Multi-route wiring"?!1:le.pcbConfig.showDiffLength}get routeAutoFanoutEnd(){return le.pcbConfig.routeAutoFanoutEnd}get isAssignNetForFreeTrack(){return le.pcbConfig.isAssignNetForFreeTrack}get autoLoopUpMsgBox(){return le.pcbConfig.autoLoopUpMsgBox}set autoLoopUpMsgBox(t){le.pcbConfig.autoLoopUpMsgBox=t,A.windowBridge.rpcCall("setUsrPcbFootprintLoopSetting",t,Q())}get removeLoop(){return we.removeLoop}clear(){this.userModifyWidth=!1,this.userModifyViaSize=!1,this.doubleClickItem=null,this.changeFanOutMode=!1}reset(){this.width=null,this.innerRadius=null,this.radius=null,this.changeFanOutMode=!1}};var w4=class w4{constructor(){this.map=new Map}static getInstance(){return w4.manager==null&&(w4.manager=new w4),w4.manager}changeViaPosition(t,e){let r=this.map.get(t);r==null&&(r=new Tn,this.map.set(t,r)),r.add(e)}getFirstPosition(t){let e=this.map.get(t);return e==null?t.center:e.getFirst()}getLastPosition(t){let e=this.map.get(t);return e==null?t.center:e.getLast()}remove(t){this.map.delete(t)}clear(){this.map.clear()}};w4.manager=null;var ps=w4;var nT=class{constructor(t,e){this.style=null;this.direct=t,this.delta=e}reverse(){this.direct=this.direct.mul(this.delta).normalize().mul(-1),this.delta=-this.delta}},Uie=class{getEvent(t){let e=[];for(let r of t.tracks){let i=new Hie(r.start.point,r.start.direct,r.width,r.net);e.push(i)}return this.linked(e,t.gaps),new Wie(e,t.gaps,t.node.width)}getEndEvent(t){let e=[];for(let r of t.tracks){let i=new Hie(r.end.point,r.end.direct,r.width,r.net,r.drawing==0);e.push(i)}return this.linked(e,t.gaps),new Wie(e,t.gaps,t.node.width)}linked(t,e){for(let r=0;r<t.length;r++){let i=t[r],n=e[r];i.next=n,i.previous=e[r-1]}}},Hie=class o{constructor(t,e,r,i,n=!0){this.previous=null;this.next=null;this.change=null;this.hasChanged=!1;this.point=t,this.direct=e,this.width=r,this.net=i,this.fanout=n}reverse(){this.direct=this.direct.mul(-1)}getNext(t){let e=new o(t,this.direct,this.width,this.net);return e.previous=this.previous,e.next=this.next,e.change=this.hasChanged?null:this.change,e.parent=this,e}getSameDirect(t){let e=this.point.add(this.direct.mul(t));return this.getNext(e)}getChangeNode(){if(this.change==null)return this;if(this.change.delta>0){let t=this.point.add(this.change.direct.mul(this.change.delta)),e=this.getNext(t);return e.hasChanged=!0,this.clearParentChange(),e.getSameDirect(this.change.delta)}else{let t=this.point.add(this.change.direct.mul(this.change.delta)),e=this.getNext(t);return e.hasChanged=!0,this.clearParentChange(),e}}clearParentChange(){let t=this;for(;t.parent!=null;)t.parent.change=null,t=t.parent}connect(){let t=new Array;t.push(this);let e=this,r=this,i=this;for(;e.parent!=null;){e=e.parent;let n=r.point.sub(e.point);ne.eq(this.direct.cross(n),0)||(t.push(i),r=i),i=e}return i!=r&&t.push(i),t.reverse()}},Wie=class{constructor(t,e,r){this.nodes=t,this.gap=e,this.limit=r}getCenter(){let t=this.nodes.length,e=Math.floor(t/2),r;return t%2===0?r=this.nodes[e-1].point.add(this.nodes[e].point).mul(.5):r=this.nodes[e].point,r}getResultNodes(){let t=new Array;for(let e of this.nodes)t.push(e.connect());return t}reverseDirect(){for(let t of this.nodes)t.direct=t.direct.mul(-1)}},wy=Math.sqrt(2),xCe=class{constructor(){this.referNode=null;this.gap=0}init(){this.referNode=null,this.gap=0}update(t,e){this.referNode=t,this.gap=e}addGap(t){this.gap+=t}},RCe=class{constructor(){this.referNode=null;this.referStartPoint=null;this.referEndPoint=null;this.gap=0}init(){this.referNode=null,this.gap=0,this.referStartPoint=null,this.referEndPoint=null}update(t,e){this.referNode=t,this.gap=e,this.referStartPoint=this.referStartPoint||this.referNode.start.point,this.referEndPoint=this.referEndPoint||this.referNode.end.point}addGap(t){this.gap+=t}},zie=class{fanout_v2(t){this.fanoutDiffpair(t),this.align(t),this.fanout90(t)}fanoutDiffpair(t){let e=t.nodes.length,r=t.limit;for(let i=0;i<e;i++){let n=i+1;if(n<e){let s=t.nodes[i],a=t.nodes[n];if(!s.fanout||!a.fanout)continue;let l=re.getInstance().getNet(s.net);if(l!=null&&l.netDifferential!=null&&l.netDifferential.hasNet(a.net)){let h=a.point.sub(s.point).cross(s.direct),d=(Math.abs(h)-s.next.width-s.width/2-a.width/2)/2;if(ne.eq(d,.006)){i++;continue}let p,m,g=s.direct;h>0?(p=new S(-g.y,g.x),m=new S(g.y,-g.x)):(p=new S(g.y,-g.x),m=new S(-g.y,g.x));let[y,b]=this.getDiffpairProject(s.point,a.point,d,g,r),P=this.calculateNodeEnd(s,p,d,r,y),T=this.calculateNodeEnd(a,m,d,r,b);t.nodes[i]=P,t.nodes[n]=T,i++}}}}getDiffpairProject(t,e,r,i,n){let s=this.getDiffpairStyle(r,n),a=e.sub(t).dot(i),l=Math.abs(a);if(a>0)switch(s){case 0:{let c=wy*n/2;return[Math.min(l+c,r),c]}default:return[r,r]}else switch(s){case 0:{let c=wy*n/2;return[c,Math.min(l+c,r)]}default:return[r,r]}}getDiffpairStyle(t,e){return t>=e*(1+wy/2)?0:t>e*(wy/2)?1:t>=0?2:3}align(t){let e=null,r=Number.MIN_SAFE_INTEGER;for(let i of t.nodes){if(!i.fanout)continue;let n=i.point.dot(i.direct);n>=r&&(r=n,e=i)}for(let i=0,n=t.nodes.length;i<n;i++){let s=t.nodes[i];if(!s.fanout)continue;let l=e.point.sub(s.point).dot(s.direct);ne.greater(l,0)&&(t.nodes[i]=s.getSameDirect(l))}}fanout90(t){this.calculateFanoutParam(t),this.calculateFanoutRefer(t);for(let e=0;e<t.nodes.length;e++){let r=t.nodes[e];r.fanout&&(t.nodes[e]=r.getChangeNode())}this.align(t)}calculateFanoutParam(t){var n,s;let e=t.getCenter(),r=t.nodes.length,i=Math.floor(r/2);if(r%2==0){let a=t.nodes[i-1].next.width/2,l=a,c=t.nodes[i-1],h=c.point.sub(e).normalize(),u=c.direct,p=u.cross(h)>0?new S(u.y,-u.x):new S(-u.y,u.x),m=p.mul(-1);for(let g=i-1;g>=0;g--){let y=t.nodes[g];a=this.calculateSingleParam(y,a,e,p,y.previous)}for(let g=i;g<r;g++){let y=t.nodes[g];l=this.calculateSingleParam(y,l,e,m,y.next)}}else{let a=t.nodes[i],l=a.width/2+((n=a.previous)==null?void 0:n.width)||0,c=a.width/2+((s=a.next)==null?void 0:s.width)||0,h=t.nodes[i-1],u=h.point.sub(e).normalize(),d=h.direct,m=d.cross(u)>0?new S(d.y,-d.x):new S(-d.y,d.x),g=m.mul(-1);for(let y=i-1;y>=0;y--){let b=t.nodes[y];l=this.calculateSingleParam(b,l,e,m,b.previous)}for(let y=i+1;y<r;y++){let b=t.nodes[y];c=this.calculateSingleParam(b,c,e,g,b.next)}}}calculateSingleParam(t,e,r,i,n){if(e+=t.width/2,t.fanout){let a=Math.abs(t.point.sub(r).cross(t.direct))-e;ne.greater(a,0)&&(t.change=new nT(i,a),t.change.style=1)}return n!=null&&(e+=t.width/2+n.width),e}calculateFanoutRefer(t){var n,s,a,l,c,h,u,d;let e=t.nodes.length,r=Math.floor(e/2),i=new xCe;if(e%2==0){for(let p=r-1;p>=0;p--){let m=t.nodes[p];if(m.change!=null&&m.change.delta>0&&m.fanout){let g=((n=m.previous)==null?void 0:n.width)||0,y=this.fanoutIncrease(i,g,m);y!=null&&(t.nodes[p]=y)}else i.init()}i.init();for(let p=0;p<r;p++){let m=t.nodes[p];if(m.change!=null&&m.change.delta<0&&m.fanout){let g=((s=m.next)==null?void 0:s.width)||0,y=this.fanoutDecrease(i,g,m);y!=null&&(t.nodes[p]=y)}else i.init()}i.init();for(let p=r;p<e;p++){let m=t.nodes[p];if(m.change!=null&&m.change.delta>0&&m.fanout){let g=((a=m.next)==null?void 0:a.width)||0,y=this.fanoutIncrease(i,g,m);y!=null&&(t.nodes[p]=y)}else i.init()}i.init();for(let p=e-1;p>=r;p--){let m=t.nodes[p];if(m.change!=null&&m.change.delta<0&&m.fanout){let g=((l=m.previous)==null?void 0:l.width)||0,y=this.fanoutDecrease(i,g,m);y!=null&&(t.nodes[p]=y)}else i.init()}}else{for(let p=r-1;p>=0;p--){let m=t.nodes[p];if(m.change!=null&&m.change.delta>0&&m.fanout){let g=((c=m.previous)==null?void 0:c.width)||0,y=this.fanoutIncrease(i,g,m);y!=null&&(t.nodes[p]=y)}else i.init()}i.init();for(let p=0;p<r;p++){let m=t.nodes[p];if(m.change!=null&&m.change.delta<0&&m.fanout){let g=((h=m.next)==null?void 0:h.width)||0,y=this.fanoutDecrease(i,g,m);y!=null&&(t.nodes[p]=y)}else i.init()}i.init();for(let p=r+1;p<e;p++){let m=t.nodes[p];if(m.change!=null&&m.change.delta>0&&m.fanout){let g=((u=m.next)==null?void 0:u.width)||0,y=this.fanoutIncrease(i,g,m);y!=null&&(t.nodes[p]=y)}else i.init()}i.init();for(let p=e-1;p>r;p--){let m=t.nodes[p];if(m.change!=null&&m.change.delta<0&&m.fanout){let g=((d=m.previous)==null?void 0:d.width)||0,y=this.fanoutDecrease(i,g,m);y!=null&&(t.nodes[p]=y)}else i.init()}}}fanoutIncrease(t,e,r){if(t.referNode==null)return t.update(r,r.width/2+e),null;{t.addGap(r.width/2);let i=r.point.distance1(t.referNode.point);if(i>=wy*t.gap)return t.update(r,r.width/2+e),null;{let n=wy*t.gap-i;return t.addGap(r.width/2+e),r.getSameDirect(n)}}}fanoutDecrease(t,e,r){if(t.referNode==null)return t.update(r,r.width/2+e),r.getSameDirect(-r.change.delta);{t.addGap(r.width/2);let i=r.point.distance1(t.referNode.point);if(i>=wy*t.gap)return t.update(r,r.width/2+e),r.getSameDirect(-r.change.delta);{let n=wy*t.gap-i;return t.addGap(r.width/2+e),r.getSameDirect(n-r.change.delta)}}}calculateNodeEnd(t,e,r,i,n){let s=new nT(e,r);switch(s.style=this.getDiffpairStyle(r,i),s.style){case 0:{let a=r-n;if(a>1e-8){let c=t.point.add(e.mul(a));t=t.getNext(c)}t.change=s;let l=t.point.add(e.mul(n));return t=t.getNext(l),t=t.getSameDirect(n+i),t.change=null,t}case 1:{t.change=s;let a=t.point.add(e.mul(r));return t=t.getNext(a),t=t.getSameDirect(r+i),t.change=null,t}case 2:{t=t.getSameDirect(i),t.change=s;let a=t.point.add(e.mul(r));return t=t.getNext(a),t=t.getSameDirect(r+i),t.change=null,t}case 3:{t.change=s,t=t.getSameDirect(r);let a=t.point.add(e.mul(r));return t=t.getNext(a),t=t.getSameDirect(i),t.change=null,t}}}main(){}},L4=class L4{constructor(t,e=!1){this.ignoreEndLimit=!1;this.checkstart=!0;this.fanOutMode=ds.getInstance().fanOutMode,this.changeFanOutMode=ds.getInstance().changeFanOutMode,this.position=t,this.ignoreEndLimit=e,L4.changeFanOut=!1,this.fanoutCenter=ps.getInstance().fanoutCenter}fanout_v3(t,e=!0){e&&this.outShape(t),this.fanoutDiffpair(t),this.align(t),(this.checkstart||!t.canEndWire)&&this.fanout90(t)}fanout_v4(t,e,r){this.outShape(t),this.align(t),this.fanout90_v1(t,e,r)}fixFanoutTrackWidth(t,e){let r=!1;for(let i of t.tracks)if(i.drawing==0){let n=i.start;for(;n.parent;){if(n.change){r=!0;break}n=n.parent}if(r)break}for(let i=0;i<t.tracks.length;i++){let n=t.tracks[i],s=e.tracks[i].start.model;if(n.drawing==0){if(!r||n.width<=n.preWidth||s&&["Pad","Via"].includes(s.modelType))continue;let a=n.start;for(;a.parent;)a.width=n.preWidth,a=a.parent}}}getOutShapeLength(t){let e=0,r=t.tracks.length,i=t.limit;for(let n=0;n<r;n++){let s=t.tracks[n],a=this.checkstart?s.start:s.end;if(a.fix||!s.fanout)continue;if(this.isDiffpair(t.tracks,n)){n++;continue}let l=a.model;if(l!=null&&(l.modelType=="Pad"||l.modelType=="Via")){let c=l.bbox,h=Math.max(c.width(),c.height())/2+i;e=Math.max(e,h)}}return e}outShape(t){let e=t.tracks.length,r=t.limit;for(let i=0;i<e;i++){let n=t.tracks[i],s=this.checkstart?n.start:n.end;if(s.fix||!n.fanout)continue;if(this.isDiffpair(t.tracks,i)){i++;continue}let a=s.model;if(a!=null&&(a.modelType=="Pad"||a.modelType=="Via")){let l=a.bbox,c=Math.max(l.width(),l.height())/2+r;this.checkstart?n.start=s.getSameDirect(c):n.end=s.getSameDirect(c)}}}isDiffpair(t,e){let r=t.length,i=e+1;if(i<r){let n=t[e],s=t[i],a=re.getInstance().getNet(n.net);if(a!=null&&a.netDifferential!=null&&a.netDifferential.hasNet(s.net)&&s.net!=a.name)return!0}return!1}fanoutDiffpair(t){let e=t.tracks.length,r=t.realTimeLimit,i=new Set;for(let n=0;n<e;n++){let s=n+1;if(s<e){let a=t.tracks[n],l=t.tracks[s],c=this.checkstart?a.start:a.end,h=this.checkstart?l.start:l.end;if(!a.fanout||!l.fanout||c.fix||h.fix)continue;let u=re.getInstance().getNet(a.net);if(u!=null&&u.netDifferential!=null&&u.netDifferential.hasNet(l.net)&&l.net!=u.name){i.add(a),i.add(l);let p=h.point.sub(c.point).cross(c.direct),g=(Math.abs(p)-a.next.width-a.width/2-l.width/2)/2;if(ne.lesseq(g,.006)){n++;continue}this.checkstart&&this.fixDiffpairNearGap(a,l,g);let y,b,P=c.direct;p>0?(y=new S(P.y,-P.x),b=new S(-P.y,P.x)):(y=new S(-P.y,P.x),b=new S(P.y,-P.x));let[T,I]=this.getDiffpairOutShapeLength(a,l,c,h,P),C=this.getDiffpairStyle(c.point,h.point,g,P,r,this.position,T),[E,O]=this.getDiffpairProject(c.point,h.point,g,P,r,C);[1,2].includes(C)&&(E<I||O<I)&&!this.changeFanOutMode&&(C=2);let _=this.calculateNodeEnd(c,y,g,r,E,C,T),x=this.calculateNodeEnd(h,b,g,r,O,C,T);(ne.neq(E,0)||ne.neq(O,0))&&(L4.changeFanOut=!0),this.checkstart?(a.start=_,l.start=x):(a.end=_,l.end=x),n++}}}if(this.checkstart&&L4.changeFanOut){for(let n of t.tracks)if(i.has(n))for(let s of n.start.connect())s.markChangeForDiffpair()}}fixDiffpairNearGap(t,e,r){let i=t.previous,n=e.next;if(r>0&&(i&&i.preWidth===i.width&&(i.width+=Math.abs(r)),n&&n.preWidth===n.width&&(n.width+=Math.abs(r))),r<0){let s=new T3;if(i&&i.preWidth===i.width){let a=i.preWidth-Math.abs(r),l=s.getSafeClearance2(0,0,t.net,i.previous.net,[],t.layerId);a>=l?i.width=a:i.width=l}if(n&&n.preWidth===n.width){let a=n.preWidth-Math.abs(r),l=s.getSafeClearance2(0,0,e.net,n.next.net,[],t.layerId);a>=l?n.width=a:n.width=l}}}getDiffpairProject(t,e,r,i,n,s){let a=e.sub(t).dot(i),l=Math.abs(a);if(a>0)switch(s){case 0:{let c=wy*n/2;return[Math.min(l+c,r),c]}default:return[r,r]}else switch(s){case 0:{let c=wy*n/2;return[c,Math.min(l+c,r)]}default:return[r,r]}}getDiffpairOutShapeLength(t,e,r,i,n){let s=ne.eq(n.x,0)||ne.eq(n.y,0),a=1/0,l=1/0,c=!0;if([r,i].forEach(h=>{let u=h.model;if(u!=null&&(u.modelType=="Pad"||u.modelType=="Via")){let d=u.bbox;if(s){let p=ne.eq(n.x,0);a=p?Math.min(a,d.height()/2):Math.min(a,d.width()/2),l=p?Math.min(a,d.width()/2):Math.min(a,d.height()/2)}else a=Math.min(a,Math.min(d.width(),d.height())/2),l=Math.min(a,Math.min(d.width(),d.height())/2)}else a=0,l=0;u!=null&&u instanceof et&&u.getPad(u.layerId).type!=="ELLIPSE"&&(c=!1)}),c)l=0;else{let h=Math.max(t.width,e.width);l=l+h/2}return[a,l]}getDiffpairStyle(t,e,r,i,n,s,a){let l=t.add(e).mul(.5),c=Math.abs(i.dot(e.sub(t))),u=(Math.abs(i.dot(s.sub(l)))-c)/2>r?1:0;return r>=a+n*(1+wy/2)?u!==0?this.fanOutMode===1?1:2:0:r>a+n*(wy/2)?this.fanOutMode===1?1:2:r>=0?this.fanOutMode!==1?1:2:3}alignDirect(t){if(!this.checkstart||ds.getInstance().wireMode!=="Differential pair wiring")return;let e=t.tracks,r=t.limit;for(let i=0;i<e.length-1;i++){let n=e[i],s=e[i+1],a=n.start.model,l=s.start.model;if(!(a&&a instanceof gt)||!(l&&l instanceof gt))return;let c=Et(a.primitive,n.start.point),h=Et(l.primitive,s.start.point);if(c.equals1(h))return;let u=new S(c.x,0).normalize(),d=new S(0,c.y).normalize(),p=new S(h.x,0).normalize(),m=new S(0,h.y).normalize(),g=u.add(p),y=d.add(m);if(g.equals1(S.ORIGIN)&&!y.equals1(S.ORIGIN)){let b=n.start.point.add(d.mul(r));if(n.start=n.start.getNext(b),n.start.direct=d,i===e.length-2){let P=s.start.point.add(d.mul(r));s.start=s.start.getNext(P),s.start.direct=d}}else if(!g.equals1(S.ORIGIN)&&y.equals1(S.ORIGIN)){let b=n.start.point.add(u.mul(r));if(n.start=n.start.getNext(b),n.start.direct=u,i===e.length-2){let P=s.start.point.add(d.mul(r));s.start=s.start.getNext(P),s.start.direct=u}}}}align(t){let e=null,r=Number.MIN_SAFE_INTEGER;for(let i of t.tracks){if(!i.fanout)continue;let n=this.checkstart?i.start:i.end;if(n.fix)continue;let s=n.point.dot(n.direct);s>=r&&(r=s,e=n)}for(let i=0,n=t.tracks.length;i<n;i++){let s=t.tracks[i];if(!s.fanout)continue;let a=this.checkstart?s.start:s.end;if(a.fix)continue;let c=e.point.sub(a.point).dot(a.direct);ne.greater(c,0)&&(this.checkstart?s.start=a.getSameDirect(c):s.end=a.getSameDirect(c))}}fanout90(t){this.calculateFanoutParam(t),this.calculateFanoutRefer(t);for(let r=0;r<t.tracks.length;r++){let i=t.tracks[r];if(i.fanout)if(this.checkstart){if(i.start.fix)continue;i.start=i.start.getChangeNode()}else{if(i.end.fix)continue;i.end=i.end.getChangeNode()}}if(!(!this.checkstart&&this.fanoutCenter)){if(this.checkstart&&L4.changeFanOut)for(let r of t.tracks)for(let i of r.start.connect())i.restoreChangeForDiffpair();this.align(t)}}fanout90_v1(t,e,r){this.calculateFanoutParam(t,e);for(let i=0;i<t.tracks.length;i++){let n=t.tracks[i],s=0,a=e.tracks[i].width,l=r.tracks[i].width;if(s=a&&a>s?a:s,s=l&&l>s?l:s,n.fanout)if(this.checkstart){if(n.start.fix)continue;n.start=n.start.getFanoutNode(s)}else{if(n.end.fix)continue;n.end=n.end.getFanoutNode(s)}}this.align(t)}calculateFanoutParam(t,e){var s,a;let r=this.checkstart?t.startCenter:t.endCenter;r=r||(this.checkstart?t.getStartCenter(e):this.fanoutCenter?this.fanoutCenter:t.getEndCenter(e));let i=t.tracks.length,n=Math.floor(i/2);if(i%2==0){let l=t.tracks[n-1],c=t.tracks[n],h=l.next.width+l.width/2+c.width/2,u=h/2-l.width/2,d=h/2-c.width/2,p=this.checkstart?l.start:l.end,m=this.checkstart?c.start:c.end,g=p.point.sub(r).normalize(),y=m.point.sub(r).normalize(),b=p.direct,P=b.cross(g),T=m.direct,I=T.cross(y),C=P>0?new S(b.y,-b.x):new S(-b.y,b.x),E=I>0?new S(T.y,-T.x):new S(-T.y,T.x);for(let O=n-1;O>=0;O--){let _=t.tracks[O];u=this.calculateSingleParam(_,u,r,C,_.previous)}for(let O=n;O<i;O++){let _=t.tracks[O];d=this.calculateSingleParam(_,d,r,E,_.next)}}else{let l=t.tracks[n],c=l.width/2+((s=l.previous)==null?void 0:s.width)||0,h=l.width/2+((a=l.next)==null?void 0:a.width)||0,u=t.tracks[n-1],d=t.tracks[n+1],p=this.checkstart?u.start:u.end,m=this.checkstart?d.start:d.end,g=p.point.sub(r).normalize(),y=m.point.sub(r).normalize(),b=p.direct,P=b.cross(g),T=m.direct,I=T.cross(y),C=P>0?new S(b.y,-b.x):new S(-b.y,b.x),E=I>0?new S(T.y,-T.x):new S(-T.y,T.x);for(let O=n-1;O>=0;O--){let _=t.tracks[O];c=this.calculateSingleParam(_,c,r,C,_.previous)}for(let O=n+1;O<i;O++){let _=t.tracks[O];h=this.calculateSingleParam(_,h,r,E,_.next)}}}calculateSingleParam(t,e,r,i,n){if(e+=t.width/2,t.fanout){let s=this.checkstart?t.start:t.end;if(!s.fix){let l=Math.abs(s.point.sub(r).cross(s.direct))-e;ne.neq(l,0)&&(s.change=new nT(i,l),s.change.style=1)}}return n!=null&&(e+=t.width/2+n.width),e}calculateFanoutRefer(t){var n,s,a,l,c,h,u,d;if(this.checkstart&&t.node.preWidth>t.node.width){let p=t.node.preWidth;for(let g of t.tracks)g.preWidth>p&&(p=g.preWidth);let m=p;m=Math.max(m,t.limit);for(let g of t.tracks){let y=g.start;g.start=y.getSameDirect(m)}}let e=t.tracks.length,r=Math.floor(e/2),i=new RCe;if(e%2==0){for(let p=r-1;p>=0;p--){let m=t.tracks[p],g=this.checkstart?m.start:m.end;if(g.change!=null&&g.change.delta>0&&m.fanout){let y=((n=m.previous)==null?void 0:n.width)||0,b=this.fanoutIncrease(i,y,m);b!=null&&(this.checkstart?m.start=b:m.end=b)}else i.init()}i.init();for(let p=0;p<r;p++){let m=t.tracks[p],g=this.checkstart?m.start:m.end;if(g.change!=null&&g.change.delta<0&&m.fanout){let y=((s=m.next)==null?void 0:s.width)||0,b=this.fanoutDecrease(i,y,m);b!=null&&(this.checkstart?m.start=b:m.end=b)}else i.init()}i.init();for(let p=r;p<e;p++){let m=t.tracks[p],g=this.checkstart?m.start:m.end;if(g.change!=null&&g.change.delta>0&&m.fanout){let y=((a=m.next)==null?void 0:a.width)||0,b=this.fanoutIncrease(i,y,m);b!=null&&(this.checkstart?m.start=b:m.end=b)}else i.init()}i.init();for(let p=e-1;p>=r;p--){let m=t.tracks[p],g=this.checkstart?m.start:m.end;if(g.change!=null&&g.change.delta<0&&m.fanout){let y=((l=m.previous)==null?void 0:l.width)||0,b=this.fanoutDecrease(i,y,m);b!=null&&(this.checkstart?m.start=b:m.end=b)}else i.init()}}else{for(let p=r-1;p>=0;p--){let m=t.tracks[p],g=this.checkstart?m.start:m.end;if(g.change!=null&&g.change.delta>0&&m.fanout){let y=((c=m.previous)==null?void 0:c.width)||0,b=this.fanoutIncrease(i,y,m);b!=null&&(this.checkstart?m.start=b:m.end=b)}else i.init()}i.init();for(let p=0;p<r;p++){let m=t.tracks[p],g=this.checkstart?m.start:m.end;if(g.change!=null&&g.change.delta<0&&m.fanout){let y=((h=m.next)==null?void 0:h.width)||0,b=this.fanoutDecrease(i,y,m);b!=null&&(this.checkstart?m.start=b:m.end=b)}else i.init()}i.init();for(let p=r+1;p<e;p++){let m=t.tracks[p],g=this.checkstart?m.start:m.end;if(g.change!=null&&g.change.delta>0&&m.fanout){let y=((u=m.next)==null?void 0:u.width)||0,b=this.fanoutIncrease(i,y,m);b!=null&&(this.checkstart?m.start=b:m.end=b)}else i.init()}i.init();for(let p=e-1;p>r;p--){let m=t.tracks[p],g=this.checkstart?m.start:m.end;if(g.change!=null&&g.change.delta<0&&m.fanout){let y=((d=m.previous)==null?void 0:d.width)||0,b=this.fanoutDecrease(i,y,m);b!=null&&(this.checkstart?m.start=b:m.end=b)}else i.init()}}}fanoutIncrease(t,e,r){if(t.referNode==null)return t.update(r,r.width/2+e),null;{t.addGap(r.width/2);let i=this.checkstart?r.start:r.end,n=this.checkstart?t.referNode.start:t.referNode.end,s=i.point.distance1(n.point);if(s>=wy*t.gap)return t.update(r,r.width/2+e),null;{let a=wy*t.gap-s;return t.addGap(r.width/2+e),i.fix?null:i.getSameDirect(a)}}}fanoutDecrease(t,e,r){let i=this.checkstart?r.start:r.end;if(t.referNode==null)return t.update(r,r.width/2+e),i.fix?null:i.getSameDirect(-i.change.delta);{t.addGap(r.width/2);let n=this.checkstart?t.referNode.start:t.referNode.end,s=i.point.distance1(n.point),a=this.checkstart?t.referStartPoint:t.referEndPoint,l=i.point.distance1(a),c=fg(Math.PI/8,l);if(s>=wy*t.gap)return t.update(r,r.width/2+e),i.fix?null:i.getSameDirect(c-i.change.delta);{let h=wy*t.gap-s;return t.addGap(r.width/2+e),i.fix?null:(h=Math.max(c,h),i.getSameDirect(h-i.change.delta))}}}calculateNodeEnd(t,e,r,i,n,s,a){let l=new nT(e,r);switch(l.style=s,l.style){case 0:{let c=r-n;if(c>1e-8){let u=t.point.add(e.mul(c));t=t.getNext(u)}t.change=l;let h=t.point.add(e.mul(n));return t=t.getNext(h),t=t.getSameDirect(n+i),t.change=null,t}case 1:{t.change=l;let c=t.point.add(e.mul(r));return t=t.getNext(c),t=t.getSameDirect(r),this.ignoreEndLimit&&!this.checkstart||(t=t.getSameDirect(i)),t.change=null,t}case 2:{t=t.getSameDirect(a+i),t.change=l;let c=t.point.add(e.mul(r));return t=t.getNext(c),t=t.getSameDirect(r),this.ignoreEndLimit&&!this.checkstart||(t=t.getSameDirect(i)),t.change=null,t}case 3:{t=t.getSameDirect(Math.abs(r));let c=t.point.add(e.mul(r));return t.change=l,t=t.getNext(c),t=t.getSameDirect(i),t.change=null,t}}}};L4.changeFanOut=!1;var _3=L4;var DCe=class{constructor(t,e){this.leftClearance=0;this.rightClearance=0;this.leftGap=0;this.rightGap=0;this.checkRight=!0;this.width=t,this.radius=e}get clearance(){return this.checkRight?this.rightClearance:this.leftClearance}get gap(){return this.checkRight?this.rightGap:this.leftGap}};function EVe(o){return{id:"",net:o,layerId:12,shapeType:5}}var M4=class{fanout(t){let e=t.tracks.length,r=t.result.wireVia.get(t.node);if(r==null)return null;{let i=new Array(e),n=null;for(let s=0;s<e;s++){let a=t.tracks[s],l=r.item,c=Math.max(l.radius,l.holeRadius),h=new DCe(a.width,c);if(s+1<e){let d=t.tracks[s+1];h.rightClearance=this.getRuleClearance(a.net,d.net),h.rightGap=a.next.width}let u=re.getInstance().getNet(a.net);u!=null&&u.netDifferential!=null&&(h.netDifferential=u.netDifferential),n!=null&&(h.leftClearance=n.rightClearance,h.leftGap=n.rightGap),n=h,i[s]=h}return this.getResult(i,t)}}getResult(t,e){let r=t.length,i=Math.floor(r/2),n=new Array(r).fill(0),s=0,a=0,l=0;function c(h,u){s=h.radius,a+=h.gap+h.width/2,l+=h.clearance+s,a>l&&(l=a),n[u]=l-a,a+=h.width/2,l+=s}if(r%2==0){let h=t[i-1];h.checkRight=!0,s=h.radius,a=h.gap/2+h.width/2,l=h.clearance/2+s,a>l&&(l=a),n[i-1]=l-a,a+=h.width/2,l+=s;for(let u=i-2;u>=0;u--)h=t[u],h.checkRight=!0,c(h,u);h=t[i],h.checkRight=!1,s=h.radius,a=h.gap/2+h.width/2,l=h.clearance/2+s,a>l&&(l=a),n[i]=l-a,a+=h.width/2,l+=s;for(let u=i+1;u<r;u++)h=t[u],h.checkRight=!1,c(h,u);return this.fixEvenDiffPairResult(t,n,e)}else{let h=t[i];s=0,a=h.width/2,l=h.radius;for(let u=i-1;u>=0;u--)h=t[u],h.checkRight=!0,c(h,u);h=t[i],s=0,a=h.width/2,l=h.radius;for(let u=i+1;u<r;u++)h=t[u],h.checkRight=!1,c(h,u);return this.fixOddDiffPairResult(t,n)}}adjustDiffPairs(t,e){var r;for(let i=0;i<e.length-1;i++)if(t[i].netDifferential&&t[i].netDifferential===((r=t[i+1])==null?void 0:r.netDifferential)){let n=e[i],s=e[i+1],a=Math.abs(n)<1e-6,l=Math.abs(s)<1e-6;if(!(a&&!l||!a&&l))continue;let h=(n-s)/2,u=h,d=-h,p=e[i],m=e[i+1],g=[...e];g[i]=u,g[i+1]=d;let y=!1;if(i>0){let b=t[i].leftGap-t[i].radius-Math.abs(g[i-1]-g[i]),P=t[i].clearance;b<P&&(y=!0)}if(!y&&i<t.length-2){let b=t[i+1].rightGap-(t[i+1].radius+t[i+2].radius)-Math.abs(g[i+1]-g[i+2]),P=t[i+1].clearance;b<P&&(y=!1)}y&&(g[i]=p,g[i+1]=m),e[i]=g[i],e[i+1]=g[i+1]}}fixEvenDiffPairResult(t,e,r){var s,a,l,c;let i=t.length,n=Math.floor(i/2);return(n>=2&&(!t[n].netDifferential||t[n].netDifferential!==((s=t[n-1])==null?void 0:s.netDifferential))&&t[n-1].netDifferential===((a=t[n-2])==null?void 0:a.netDifferential)||t[n].netDifferential&&t[n].netDifferential===((l=t[n+1])==null?void 0:l.netDifferential)&&(!t[n-1].netDifferential||t[n].netDifferential!==((c=t[n-1])==null?void 0:c.netDifferential)))&&(ps.getInstance().fanoutCenter=r.tracks[n-1].end.point.add(r.tracks[n].end.point).mul(.5)),this.adjustDiffPairs(t,e),e}fixOddDiffPairResult(t,e){var n;let r=t.length,i=Math.floor(r/2);if(t[i].netDifferential&&t[i].netDifferential===((n=t[i+1])==null?void 0:n.netDifferential)){let s=(e[i]+e[i+1])/2;e[i]=-Math.abs(s),e[i+1]=s;for(let a=i-1;a>=0;a--)e[a]+=s;for(let a=i+2;a<r;a++)e[a]-=s}else if(i>0&&t[i-1].netDifferential&&t[i-1].netDifferential===t[i].netDifferential){let s=(e[i]+e[i-1])/2;e[i]=Math.abs(s),e[i-1]=s;for(let a=i-2;a>=0;a--)e[a]-=s;for(let a=i+1;a<r;a++)e[a]+=s}return this.adjustDiffPairs(t,e),e}getSafeRuleByCustom(t,e,r){let i=[];for(let l of r){let c=re.getInstance().getRule4Order(t,e,l,0);i=i.concat(c)}let n=re.getInstance().getAllOtherSpacing();for(let l of n)i=i.concat(l);if(i.length===0)return re.getInstance().getDefaultSafeSpacing();let s=i.map(l=>({rule:l,maxClearance:this.getRuleMaxClearance(l)}));return s.reduce((l,c)=>c.maxClearance>l.maxClearance?c:l,s[0]).rule||re.getInstance().getDefaultSafeSpacing()}getRuleMaxClearance(t){if(t instanceof aI){let e=[t.getItemMaxClearance(5,[5]),t.getItemMaxClearance(5,[12])];return Math.max(...e)}else if(t instanceof p2)return t.holeClearance}getRuleClearance(t,e){let r=EVe(t),i=EVe(e),n=["BetweenNetRule","NetRule"],s=this.getSafeRuleByCustom(r,i,n);return s?this.getRuleMaxClearance(s):0}};var Zr=class{constructor(){this.trackManager=Ml.getInstance();this.nodeManager=At.getInstance();this.viewManager=Cr.getInstance()}createList(){return this.nodeManager.createList()}drawWireTrack(t,e,r,i){let n=t[0],s=t[0],a=t.length;for(let l=1;l<a;l++)if(s=t[l],n.distance2(s)>1e-8){let c=this.createTrack(e.layerId,n,s,e.width,e.net,r);this.addList(c,i,r),n=s}}drawCornerNodeTrack(t,e,r,i){var l;let n=t[0],s=t[0],a=t.length;for(let c=1;c<a;c++)if(s=t[c],n.point.distance2(s.point)>1e-8){let h=(l=s.width)!=null?l:e.width,u=this.createTrack(e.layerId,n.point,s.point,h,e.net,r),d=this.addList(u,i,r);n.change==s.change&&(d.fanoutInfo=n.change),n=s}}drawCornerTrack(t,e,r,i){let n=t[0],s=t[0],a=t.length;for(let l=1;l<a;l++)if(s=t[l],n.distance2(s)>1e-8){let c=this.createTrack(e.layerId,n,s,e.width,e.net,r);this.addList(c,i,r),n=s}}drawInfoTrack(t,e,r,i,n){let s=t[0],a=t[0],l=t.length;n||(n=e.width);for(let c=1;c<l;c++)if(a=t[c],s.distance2(a)>1e-8){let h=this.createTrack(e.layerId,s,a,n,e.net,r);this.addList(h,i,r),s=a}}drawInfoArcTrack(t,e,r,i,n){n||(n=e.width);for(let s=0;s<t.length;s++){let a=t[s],l=this.createArcTrack(e.layerId,a.center,a.rx,zt.toRadians(a.startAngle),zt.toRadians(a.endAngle()),a.sweep(),n,e.net,r);this.addList(l,i,r)}}drawFanoutTrack(t,e,r,i){let n=t[0],s=t[0],a=t.length;for(let l=1;l<a;l++)if(s=t[l],n.point.distance2(s.point)>1e-8){let c=this.createTrack(e.layerId,n.point,s.point,e.width,e.net,r.command),h=this.addList(c,i,r.command);n.change==s.change&&(h.fanoutInfo=n.change),n=s}}drawFanoutTrackFirst(t,e,r,i){let n=t.length,s=t[n-1],a=t[n-1],l=new Array;for(let c=n-2;c>=0;c--)if(s=t[c],s.point.distance2(a.point)>1e-8){let h=this.createTrack(e.layerId,s.point,a.point,e.width,e.net,r.command),u=this.addFirst(h,i,r.command);l.unshift(u),s.change==a.change&&(u.fanoutInfo=s.change),a=s}return l}drawViaFanout(t){let r=new M4().fanout(t);if(r==null)return;let i=Math.floor(t.tracks.length/2);for(let n=0;n<t.tracks.length;n++){let s=t.tracks[n],a=t.result.wireMap.get(s),l=a.getAllItems(),c=l[l.length-1].end;if(n<i){let h=new S(-s.end.direct.y,s.end.direct.x),u=c.add(h.mul(r[n])),d=this.createTrack(s.layerId,c,u,s.width,s.net,t.result.command),p=this.addList(d,a,t.result.command);p.fanoutInfo=new nT(h,-r[n])}else{let h=new S(s.end.direct.y,-s.end.direct.x),u=c.add(h.mul(r[n])),d=this.createTrack(s.layerId,c,u,s.width,s.net,t.result.command),p=this.addList(d,a,t.result.command);p.fanoutInfo=new nT(h,-r[n])}}}createTrack4Pt(t,e,r){if(t instanceof M)return this.createTrack(e.layerId,t.start(),t.end(),e.width,e.showNet,r);if(t instanceof q)return this.createArcTrackByArc(e.layerId,t,e.width,e.showNet,r);throw new Error("not support")}createTrack(t,e,r,i,n,s,a=void 0){let l=this.trackManager.addTrack(`TRACK${rf.getInstance().getID()}`,t,e,r,i,!1,n);return this.viewManager.current.setTrackVisible(l.globalIndex),l.partition=R.getInstance().partitionId,l.setGroupID(a),s.addCommand(new yA(l,"add")),l}createArcTrackByArc(t,e,r,i,n,s=null){return this.createArcTrack(t,e.center,e.rx,zt.toRadians(e.startAngle),zt.toRadians(e.endAngle()),e.sweep(),r,i,n,void 0,s)}createArcTrack(t,e,r,i,n,s,a,l,c,h,u=void 0){let d=this.trackManager.addArcTrack(`TRACK${rf.getInstance().getID()}`,t,e,r,i,n,s,a,!1,l,h);return d.setGroupID(u),d.partition=R.getInstance().partitionId,this.viewManager.current.setTrackVisible(d.globalIndex),c.addCommand(new yA(d,"add")),d}addList(t,e,r){let i=this.nodeManager.createNode(t,e);return r.addCommand(new lR(t,e,i)),i}addFirst(t,e,r){let i=this.nodeManager.createFirstNode(t,e);return r.addCommand(new lR(t,e,i)),i}};var N4=class o{constructor(t=!1){this._notChange=!0;this._isSource=!0;this._pushDirect=null;this._lastPushDirect=null;this.isReversePush=!1;this.checkDRC=!1;this.collideOrder=-1;this.isVertex=!1;this.isInput=t}setPushDirect(t,e){this._lastPushDirect==null&&(this._lastPushDirect=t),this._lastPushDirect!=null&&e!=null&&(this.isReversePush=this._lastPushDirect!=e),this._pushDirect=e}get isInputFirstPushed(){return this.isInput&&this._lastPushDirect==null&&this._lastPushDirect!=this._pushDirect}sycnPushDirect(t){this.setPushDirect(t._lastPushDirect,t._pushDirect)}get pushDirect(){return this._pushDirect}get notChange(){return this._notChange}set notChange(t){this._notChange!=t&&(this.checkDRC=!1),this._notChange=t}get isSource(){return this._isSource}set isSource(t){this._isSource!=t&&(this.checkDRC=!1),this._isSource=t}clearPushDirect(){this._lastPushDirect=null,this._pushDirect=null}change(){this._notChange=!1,this._isSource=!1,this.checkDRC=!1}clone(){let t=new o;return t.isInput=this.isInput,t._isSource=this._isSource,t._notChange=this._notChange,t._pushDirect=this.pushDirect,t.isReversePush=this.isReversePush,t._lastPushDirect=this._lastPushDirect,t.collideOrder=this.collideOrder,t.checkDRC=this.checkDRC,t.isVertex=this.isVertex,t}mergeStatus(t){this._notChange=this._notChange||t._notChange,this._isSource=this._isSource||t._isSource,this.setPushDirect(this._lastPushDirect||t._lastPushDirect,this._pushDirect||t._pushDirect),this.isVertex=this.isVertex||t.isVertex}};var k4=class k4{constructor(){this.map=new Map;this._status=null}static getInstance(){return k4.manager==null&&(k4.manager=new k4),k4.manager}getStatus(t){return this._status=this.map.get(t),this._status==null&&(this._status=new N4,this.map.set(t,this._status)),this._status}setOrder(t,e){this._status=this.getStatus(t),this._status.collideOrder=e}addInputStatus(t){return this._status=this.map.get(t),this._status==null&&(this._status=new N4(!0),this.map.set(t,this._status)),this._status}setStatus(t,e){this.map.set(t,e)}clear(){this.map.clear()}};k4.manager=null;var Mr=k4;var ls="45";var uj=null;function dj(o){switch(o){case"WIRING_CORNER_LINE45":{ls="45";break}case"WIRING_CORNER_LINE90":{ls="90";break}case"WIRING_CORNER_ARC45":case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC":{ls="freeArc";break}case"WIRING_CORNER_FREEANGLE":{ls="free";break}}}function OVe(o){switch(o){case"line45":{ls="45";break}case"line90":{ls="90";break}case"arc90":{ls="freeArc";break}default:{ls="45";break}}}function gg(o){uj!=null&&yg(),uj=ls,ls=o}function yg(){uj!=null&&(ls=uj,uj=null)}var Yie=class{constructor(t,e){this.outline=e,this.hash=t}checkCollide(t,e=ls,r=!1){return this.outline.isCollide(t,e)}collide(t,e=ls){return this.outline.collide(t,e)}};function ll(o){let t=new Array,e=new M(o.LL(),o.LR()),r=new M(o.LR(),o.UR()),i=new M(o.UR(),o.UL()),n=new M(o.UL(),o.LL());return t.push(e),t.push(r),t.push(i),t.push(n),ge.build2(t)}var jie=class{constructor(){this.direct=null;this.point=null;this.dir0=null;this.dir1=null;this.dir2=null;this.mid=null;this.pro0=0;this.pro1=0;this.pro2=0}lineCollide(t,e){if(Math.abs(t.direct.cross(e.direct))<1e-4&&ME.area(t.start(),t.end(),e.start())<1e-4)return this.direct=t.direct,this.point=t.start(),this.dir0=t.end().sub(this.point),this.dir1=e.start().sub(this.point),this.dir2=e.end().sub(this.point),this.pro0=this.dir0.dot(this.direct),this.pro1=this.dir1.dot(this.direct),this.pro2=this.dir2.dot(this.direct),this.pro0>0?this.pro1>this.pro2?this.isSeparated(0,this.pro0,this.pro2,this.pro1):this.isSeparated(0,this.pro0,this.pro1,this.pro2):this.pro1>this.pro2?this.isSeparated(this.pro0,0,this.pro2,this.pro1):this.isSeparated(this.pro0,0,this.pro1,this.pro2);{this.mid=t.start().add(t.end()).mul(.5),this.direct=new S(-t.direct.y,t.direct.x),this.dir1=e.start().sub(this.mid),this.dir2=e.end().sub(this.mid),this.pro1=this.dir1.dot(this.direct),this.pro2=this.dir2.dot(this.direct);let r=Math.min(Math.abs(this.pro1),Math.abs(this.pro2));return this.pro1*this.pro2>0?{isSeparated:!0,min:r}:{isSeparated:!1,min:r}}}isSeparated(t,e,r,i){return r>e?{isSeparated:!0,min:r-e}:i<t?{isSeparated:!0,min:t-i}:{isSeparated:!1,min:0}}};var Mb=class{constructor(t,e){this.inters=new Array;this.symbols=new Array;this.pts=new Array;this.hasSort=!1;this.source=t,this.shape=e}addPoint(t,e){this.inters.push(t),this.pts.push(e)}addInnerPoint(t){this.inters.push(t),this.pts.push(null)}sort(){this.hasSort||(an(this.inters,this.source),this.hasSort=!0)}getEnd(){return this.inters.length>0?this.inters[0]:this.source.end()}};var bg=class{constructor(t=-1,e=!1,r=.006){this.ps=null;this.ps1=null;this._outline=null;this._hull=null;this._rect=null;this._free=null;this.subId=t,this.forceUseSource=e,this.kit=new Rc(r)}get outline(){return null}get hull(){return null}get rect(){return null}get free(){return null}pointInPolyline(t,e){return e instanceof Bt?new Dc().inPolygon(t,e.items):new Dc().inPolyline(t,e)}inLine(t,e){return!!(this.kit.eq(t.direct.cross(e.sub(t.start())),0)&&t.bbox().extendOfSize(.006).isContains(e))}inArc(t,e){let r=e.sub(t.center);if(this.kit.eq(r.length(),t.rx)&&t.bbox().extendOfSize(1e-4).isContains(e)){r=r.normalize();let i=t.start().sub(t.center).normalize(),n=t.end().sub(t.center).normalize();return Math.abs(t.sweepAngle)<=180?iT(r,i,n):!iT(r,i,n)}return!1}pointInHull(t,e){return e=="45"||e=="90"?this.inHull(t,e):this.inInside(t,this.getOutline(e))}inHull(t,e){let r;switch(e){case"45":{if(this.ps==null){let g=this.hull;this.ps=new Array;for(let y of g.primitives)this.ps.push(y.start())}if(!this.hull.bbox().isContains(t))return!1;r=this.ps;break}case"90":{if(this.ps1==null){let g=this.rect;this.ps1=new Array;for(let y of g.primitives)this.ps1.push(y.start())}if(!this.rect.bbox().isContains(t))return!1;r=this.ps1;break}default:return!1}let i=r[0],n=t.sub(i),s=1,a=r.length-1,l=r[s].sub(i).normalize(),c=r[a].sub(i).normalize(),h=n.normalize();if(this.kit.lesseq(l.cross(h),0)||this.kit.greatereq(c.cross(h),0))return!1;let d=r[0].sub(r[r.length-1]).normalize().cross(t.sub(r[r.length-1]));if(this.kit.lesseq(d,0))return!1;let p=s+a+1>>1,m=0;for(;s<a;){if(m=r[p].sub(i).cross(n),ne.greater(m,0))s=p;else if(ne.less(m,0))a=p;else{if(this.kit.lesseq(r[p+1].sub(r[p]).normalize().cross(t.sub(r[p])),0)||this.kit.lesseq(r[p].sub(r[p-1]).normalize().cross(t.sub(r[p-1])),0))return!1;s=p}if(a>s&&a-s==1)break;p=s+a+1>>1}return!this.kit.lesseq(r[a].sub(r[s]).normalize().cross(t.sub(r[s])),0)}inInside(t,e){return e.bbox().isContains(t)?e instanceof Bt?!jr.inEdge4Polyline(t,e,.006)&&jr.inPolygon(t,e.items):!jr.inEdge4Polyline(t,e,.006)&&jr.inPolyline(t,e):!1}inPolygon(t,e){return e.bbox().isContains(t)?e instanceof Bt?jr.inPolygon(t,e.items):jr.inPolyline(t,e):!1}getPointInOutline(t,e){let r=this.getOutline(e);if(r instanceof ge){if(this.inInside(t,r))return r}else if(this.inInside(t,r)){for(let i of r.items)if(this.inInside(t,i))return i}return null}getOutline(t){switch(t){case"45":return this.hull;case"90":return this.rect;case"free":return this.free||this.outline;case"freeArc":return this.outline;default:return this.outline}}isCollide(t,e){return!1}collide(t,e){return null}sortInters(t,e){let r=t.iterator(),i=new Array;for(;r.hasNext();){let n=r.next();i.push(n)}return an(i,e)}};var LCe=new jie,Nb=class extends bg{constructor(t,e,r=!1,i=-1){super(i,r),this.shape=t,this.width=e;let n=t.direct.angle(S.ORIGIN)%$ee;this.useFree=this.shape.length()>20&&!ne.eq(n,0)}get outline(){return this._outline==null&&(this._outline=this.shape.stroke(this.width,wr.ROUND,ae.CCW)),this._outline}get hull(){return this.forceUseSource?this.outline:this.useFree?this.free:(this._hull==null&&(this._hull=Wa.convexHull(ge.build2([this.shape]),this.width/2)),this._hull)}get rect(){if(this.forceUseSource)return this.outline;let t=this.shape.direct,e=S.X_UNIT_VECTOR;return Math.abs(t.dot(e))<1e-4||Math.abs(t.cross(e))<1e-4?(this._rect==null&&(this._rect=ll(this.shape.bbox().extendOfSize(this.width/2))),this._rect):this.free}get free(){return this.forceUseSource?this.outline:(this._free==null&&(this._free=Wa.getLineHull(this.shape,this.width/2)),this._free)}isCollide(t,e){let r=t.bbox().extendOfSize(this.width/2),i=this.shape.bbox();if(!r.intersection1(i))return!1;if(t instanceof M){let a=LCe.lineCollide(t,this.shape);if(a.isSeparated){if(this.kit.greatereq(a.min,this.width/2))return!1;{let l=LCe.lineCollide(this.shape,t);if(l.isSeparated&&this.kit.greatereq(l.min,this.width/2))return!1}}else{let l=LCe.lineCollide(this.shape,t);if(l.isSeparated){if(this.kit.greatereq(l.min,this.width/2))return!1}else return!0}}if(this.inHull(t.start(),e)||this.inHull(t.end(),e))return!0;let s=new er(t,this.shape).getDistance();return!(s!=0&&this.kit.greatereq(s,this.width/2))}collide(t,e){let r=new Mb(t,this),i=this.getOutline(e),n=t.start();if(e=="45"||e=="90"?this.inHull(n,e):this.inInside(n,i))return r.addInnerPoint(n),r;let a=t.bbox().extendOfSize(.1);for(let l of i.primitives){let c=l.bbox();if(!a.isIntersect(c))continue;let h=Pt(t,l);for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);r.addPoint(d,l)}h==0&&(l instanceof M?(this.inLine(l,t.start())&&r.addPoint(t.start(),l),this.inLine(l,t.end())&&r.addPoint(t.end(),l)):l instanceof q&&(this.inArc(l,t.start())&&r.addPoint(t.start(),l),this.inArc(l,t.end())&&r.addPoint(t.end(),l)))}return r}getPointInOutline(t,e){switch(e){case"45":case"90":return this.inHull(t,e)?this.getOutline(e):null;default:{let r=this.getOutline(e);if(r instanceof ge){if(this.inInside(t,r))return r}else if(this.inInside(t,r)){for(let i of r.items)if(this.inInside(t,i))return i}return null}}}};var m1=class extends bg{constructor(t,e,r=!1,i=-1){super(i,r),this.shape=t,this.width=e}get outline(){return this._outline==null&&(this._outline=this.shape.stroke(this.width,wr.ROUND,ae.CCW)),this._outline}get hull(){return this.forceUseSource?this.outline:(this._hull==null&&(this._hull=ge.build2(Wa.getArcHull(this.shape,this.width/2))),this._hull)}get rect(){return this.forceUseSource?this.outline:(this._rect==null&&(this._rect=ge.build2(Wa.getArcRect(this.shape,this.width/2))),this._rect)}isCollide(t,e){let r=t.bbox().extendOfSize(this.width/2),i=this.shape.bbox();if(!r.intersection1(i))return!1;let n=this.getOutline(e);if(this.inInside(t.start(),n)||this.inInside(t.end(),n))return!0;let a=new er(t,this.shape).getDistance();return!(a!=0&&this.kit.greatereq(a,this.width/2))}collide(t,e){let r=new Mb(t,this),i=this.getOutline(e),n=t.start();if(this.inInside(n,i))return r.addInnerPoint(n),r;let a=t.bbox().extendOfSize(.1);for(let l of i.primitives){let c=l.bbox();if(!a.isIntersect(c))continue;let h=Pt(t,l);for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);r.addPoint(d,l)}h==0&&(l instanceof M?(this.inLine(l,t.start())&&r.addPoint(t.start(),l),this.inLine(l,t.end())&&r.addPoint(t.end(),l)):l instanceof q&&(this.inArc(l,t.start())&&r.addPoint(t.start(),l),this.inArc(l,t.end())&&r.addPoint(t.end(),l)))}return r}};var cNi=Math.PI/4,OI=class extends bg{constructor(t,e,r=!1,i=-1){super(i),this.shape=t,this.width=e,this.graphics=new Array;let n=q.build2(t.center,0,180,t.rx,t.rx,ae.CCW),s=q.build2(t.center,180,360,t.rx,t.rx,ae.CCW);this.graphics.push(new m1(n,e,r,i)),this.graphics.push(new m1(s,e,r,i))}get outline(){if(this._outline==null){let t=new Array;for(let e of this.graphics)t.push(e.outline);this._outline=new Bt(t)}return this._outline}get hull(){if(this._hull==null){let t=new Array;for(let e of this.graphics){let r=e.hull;if(r instanceof ge)t.push(r);else for(let i of r.items)t.push(i)}this._hull=new Bt(t)}return this._hull}get rect(){if(this._rect==null){let t=new Array;for(let e of this.graphics){let r=e.rect;if(r instanceof ge)t.push(r);else for(let i of r.items)t.push(i)}this._rect=new Bt(t)}return this._rect}isCollide(t,e){let r=t.bbox().extendOfSize(this.width/2),i=this.shape.bbox();if(!r.intersection1(i))return!1;for(let n of this.graphics)if(n.isCollide(t,e))return!0;return!1}collide(t,e){let r=new Array;for(let i of this.graphics){if(!i.isCollide(t,e))continue;let n=i.collide(t,e);if(n.inters.length>0){n.sort();let s=n.getEnd();r.push({point:s,inter:n})}}return P0(r,t),r.length>0?r[0].inter:null}};var pj=class extends bg{constructor(t,e,r=!1){super(),this.shape=t,this.clearance=e,this.graphics=new Array;let i=0;for(let n of t.primitives)n instanceof M?this.graphics.push(new Nb(n,e*2,r,i++)):n instanceof q&&(n.isCircle()?this.graphics.push(new OI(n,e*2,r,i++)):this.graphics.push(new m1(n,e*2,r,i++)))}get outline(){if(this._outline==null)if(this.clearance==0)this._outline=this.shape;else{let t=new Array;for(let e of this.graphics)t.push(e.outline);this._outline=new Bt(t)}return this._outline}get hull(){if(this._hull==null)if(this.clearance==0)this._hull=Wa.convexHull(this.shape,this.clearance);else{let t=new Array;for(let e of this.graphics){let r=e.hull;if(r instanceof ge)t.push(r);else for(let i of r.items)t.push(i)}this._hull=new Bt(t)}return this._hull}get rect(){if(this._rect==null)if(this.clearance==0)this._rect=ll(this.shape.bbox());else{let t=new Array;for(let e of this.graphics){let r=e.rect;if(r instanceof ge)t.push(r);else for(let i of r.items)t.push(i)}this._rect=new Bt(t)}return this._rect}isCollide(t,e){let r=t.bbox().extendOfSize(this.clearance),i=this.shape.bbox();if(!r.intersection1(i))return!1;for(let n of this.graphics)if(n.isCollide(t,e))return!0;return!1}collide(t,e){let r=new Array;for(let i of this.graphics){if(!i.isCollide(t,e))continue;let n=i.collide(t,e);if(n.inters.length>0){n.sort();let s=n.getEnd();r.push({point:s,inter:n})}}return P0(r,t),r.length>0?r[0].inter:null}getPointInOutline(t,e){let r=this.getOutline(e);if(r instanceof ge){if(this.inInside(t,r))return r}else for(let i of r.items)if(this.inInside(t,i))return i;return null}};var _8=class extends bg{constructor(e,r,i=!1){super();this.graphics=new Array;this.shape=e,this.clearance=r;let n=0;for(let s of e.primitives)s instanceof M?this.graphics.push(new Nb(s,r*2,i,n++)):s instanceof q&&(s.isCircle()?this.graphics.push(new OI(s,r*2,i,n++)):this.graphics.push(new m1(s,r*2,i,n++)))}get outline(){if(this._outline==null)if(this.clearance==0)this._outline=this.shape;else{let e=new Array;for(let r of this.graphics)e.push(r.outline);this._outline=new Bt(e)}return this._outline}get hull(){if(this._hull==null)if(this.clearance==0)this._hull=Wa.convexHull(this.shape,this.clearance);else{let e=new Array;for(let r of this.graphics){let i=r.hull;if(i instanceof ge)e.push(i);else for(let n of i.items)e.push(n)}this._hull=new Bt(e)}return this._hull}get rect(){if(this._rect==null)if(this.clearance==0)this._rect=ll(this.shape.bbox());else{let e=new Array;for(let r of this.graphics){let i=r.rect;if(i instanceof ge)e.push(i);else for(let n of i.items)e.push(n)}this._rect=new Bt(e)}return this._rect}isCollide(e,r){let i=e.bbox().extendOfSize(this.clearance),n=this.shape.bbox();if(!i.intersection1(n))return!1;if(this.inInside(e.start(),this.shape)||this.inInside(e.end(),this.shape))return!0;for(let s of this.graphics)if(s.isCollide(e,r))return!0;return!1}collide(e,r){let i=e.start();if(this.inPolygon(i,this.shape)){let a=new Mb(e,this);return a.addInnerPoint(i),a}let s=new Array;for(let a of this.graphics){if(!a.isCollide(e,r))continue;let l=a.collide(e,r);if(l.inters.length>0){l.sort();let c=l.getEnd();s.push({point:c,inter:l})}}return P0(s,e),s.length>0?s[0].inter:null}getPointInOutline(e,r){if(this.inInside(e,this.shape))return this.shape;for(let i of this.graphics)if(i.getPointInOutline(e,r)!=null)return i.getOutline(r);return null}};var Xie=class extends bg{constructor(e,r){super();this.graphics=new Array;this.shape=e,this.clearance=r,this.graphics=new Array;let i=0;for(let n of e.primitives)n instanceof M?this.graphics.push(new Nb(n,r*2,!1,i++)):n instanceof q&&(n.isCircle()?this.graphics.push(new OI(n,r*2,!1,i++)):this.graphics.push(new m1(n,r*2,!1,i++)))}get outline(){if(this._outline==null)if(this.clearance==0)this._outline=this.shape;else{let e=new Array;for(let r of this.graphics)e.push(r.outline);this._outline=new Bt(e)}return this._outline}get hull(){if(this._hull==null){let e=new Array;for(let r of this.graphics){let i=r.hull;if(i instanceof ge)e.push(i);else for(let n of i.items)e.push(n)}this._hull=new Bt(e)}return this._hull}get rect(){if(this._rect==null)if(this.clearance==0)this._rect=ll(this.shape.bbox());else{let e=new Array;for(let r of this.graphics){let i=r.rect;if(i instanceof ge)e.push(i);else for(let n of i.items)e.push(n)}this._rect=new Bt(e)}return this._rect}isCollide(e,r){let i=e.bbox().extendOfSize(this.clearance),n=this.shape.bbox();if(!i.intersection1(n))return!1;if(this.inInside(e.start(),this.shape)||this.inInside(e.end(),this.shape))return!0;for(let s of this.graphics)if(s.isCollide(e,r))return!0;return!1}collide(e,r){let i=e.start();if(this.inPolygon(i,this.shape)){let a=new Mb(e,this);return a.addInnerPoint(i),a}let s=new Array;for(let a of this.graphics){if(!a.isCollide(e,r))continue;let l=a.collide(e,r);if(l.inters.length>0){l.sort();let c=l.getEnd();s.push({point:c,inter:l})}}return P0(s,e),s.length>0?s[0].inter:null}};var v3=class extends bg{constructor(t,e){super(null,!1,e<=2e-4?1e-8:.006),this.shape=t,this.clearance=e}get outline(){if(this._outline==null){let t=!1;if(this.clearance==0)this._outline=this.shape;else{let e=this.shape;this.shape instanceof ge&&this.shape.isClose()&&nh(this.shape)&&(e=e.reverse(),t=!0),this._outline=XP.zoomCorner(e,this.clearance)}(t||this._outline instanceof ge&&this._outline.isClose()&&!nh(this._outline))&&(this._outline=this._outline.reverse())}return this._outline}get hull(){return this._hull==null&&(this._hull=Wa.convexHull(this.shape,this.clearance)),this._hull}get rect(){return this._rect==null&&(this._rect=ll(this.shape.bbox().extendOfSize(this.clearance))),this._rect}isCollide(t,e){let r=t.bbox().extendOfSize(this.clearance),i=this.shape.bbox();if(!r.intersection1(i))return!1;if((e=="45"||e=="90"?this.inHull(t.start(),e):this.inInside(t.start(),this.shape))||(e=="45"||e=="90"?this.inHull(t.end(),e):this.inInside(t.end(),this.shape)))return!0;let a=t.bbox().extendOfSize(this.clearance);for(let l of this.shape.primitives){if(l instanceof M&&l.length()<1e-8)continue;let c=l.bbox();if(a.isIntersect(c)){let h=new er(t,l).getDistance();if(h==0||this.kit.less(h,this.clearance))return!0}}return!1}collide(t,e){let r=new Mb(t,this),i=this.getOutline(e),n=t.start();if(e=="45"||e=="90"?this.inHull(n,e):this.inInside(n,i))return r.addInnerPoint(n),r;let a=t.bbox().extendOfSize(.1);for(let l of i.primitives){let c=l.bbox();if(!a.isIntersect(c))continue;let h=Pt(t,l);for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);r.addPoint(d,l)}h==0&&(l instanceof M?(this.inLine(l,t.start())&&r.addPoint(t.start(),l),this.inLine(l,t.end())&&r.addPoint(t.end(),l)):l instanceof q&&(this.inArc(l,t.start())&&r.addPoint(t.start(),l),this.inArc(l,t.end())&&r.addPoint(t.end(),l)))}return r}getPointInOutline(t,e){switch(e){case"45":case"90":return this.inHull(t,e)?this.getOutline(e):null;default:{let r=this.getOutline(e);if(r instanceof ge){if(this.inInside(t,r))return r}else if(this.inInside(t,r)){for(let i of r.items)if(this.inInside(t,i))return i}return null}}}};var B4=class extends bg{constructor(t,e,r=!1,i=!1){super(),this.shape=t,this.clearance=e,this.isPartition=i,this.graphics=new Array;let n=0;for(let s of t.primitives)s instanceof M?this.graphics.push(new Nb(s,e*2,r,n++)):s instanceof q&&(s.isCircle()?this.graphics.push(new OI(s,e*2,r,n++)):this.graphics.push(new m1(s,e*2,r,n++)))}get outline(){if(this._outline==null)if(this.clearance==0)this._outline=this.shape;else{let t=new Array;for(let e of this.graphics){let r=e.outline;if(r instanceof Bt)for(let i of r.items)t.push(i);else t.push(r)}this._outline=new Bt(t)}return this._outline}get hull(){if(this._hull==null)if(this.clearance==0)this._hull=Wa.convexHull(this.shape,this.clearance);else{let t=new Array;for(let e of this.graphics){let r=e.hull;if(r instanceof ge)t.push(r);else for(let i of r.items)t.push(i)}this._hull=new Bt(t)}return this._hull}get rect(){if(this._rect==null)if(this.clearance==0)this._rect=ll(this.shape.bbox());else{let t=new Array;for(let e of this.graphics){let r=e.rect;if(r instanceof ge)t.push(r);else for(let i of r.items)t.push(i)}this._rect=new Bt(t)}return this._rect}isCollide(t,e){let r=t.bbox().extendOfSize(this.clearance),i=this.shape.bbox();if(r.isSeparated(i))return!!this.isPartition;let n=jr.inPolyline(t.start(),this.shape);if(this.checkByIsPartition(n))return!0;let s=jr.inPolyline(t.end(),this.shape);if(this.checkByIsPartition(s))return!0;for(let a of this.graphics)if(a.isCollide(t,e))return!0;return!1}checkByIsPartition(t){return this.isPartition?!t:t}collide(t,e){let r=new Mb(t,this),i=t.start(),n=jr.inPolyline(t.start(),this.shape);if(this.checkByIsPartition(n))return r.addInnerPoint(i),r;let s=new Array;for(let a of this.graphics){if(!a.isCollide(t,e))continue;let l=a.collide(t,e);if(l.inters.length>0){l.sort();let c=l.getEnd();s.push({point:c,inter:l})}}return P0(s,t),s.length>0?s[0].inter:null}getPointInOutline(t,e){if(this.inInside(t,this.shape))return this.isPartition?null:this.shape;for(let r of this.graphics){let i=r.getPointInOutline(t,e);if(i!=null&&!this.isPartition)return i}return null}};var F4=class F4{constructor(){this.map=new Map;this.change=new Set;this._lastHash=null;this._lastObstacle=null;this.count=0}static getInstance(){return F4.manager==null&&(F4.manager=new F4),F4.manager}clear(){this.map.clear(),this.change.clear(),this._lastHash=null,this._lastObstacle=null,this.count=0}getObstacle(t){return this.change.has(t)&&this.map.delete(this._lastHash),this._lastObstacle=this.map.get(this._lastHash),this._lastObstacle}getModelObstacle(t,e,r){if(this._lastHash=t.globalIndex+"_"+e+"_"+r,this._lastObstacle=this.getObstacle(t.globalIndex),this._lastObstacle==null){let i=this.dispatch(t,e,r);this._lastObstacle=new Yie(this._lastHash,i),this.map.set(this._lastObstacle.hash,this._lastObstacle)}return this._lastObstacle}dispatch(t,e,r){switch(t.modelType){case"Line":case"Track":return this.generateLineHull(t,e);case"Arc":case"ArcTrack":return this.generateArcHull(t,e,r);case"Via":case"Pad":return this.generatePadHull(t,e,r);case"Polygon":return this.generatePolygonHull(t,e,r);case"Rect":return this.generateRectHull(t,e,r);case"Circle":return this.generateCircleHull(t,e,r);case"Text":case"Image":return this.generateTextImageHull(t,e,r);default:return null}}generateLineHull(t,e){let r=t.primitive;return new Nb(r,t.width+e*2)}generateArcHull(t,e,r){let i=t.primitive;return new m1(i,t.width+e*2)}generatePadHull(t,e,r){if(t.modelType=="Pad"&&t.isPolygon()&&t.buildBBox().area()>50){let n=t.getMathGraphics(r);return new _8(n,e)}let i=t.getMathGraphics(r);return Math.abs(i.area())>50?new B4(i,e,!0):new v3(i,e)}generateRectHull(t,e,r){switch(t.type){case"Fill Region":case"TearDrop":case"Slot Region":case"Prohibited Region":{let s=t.getMathGraphics(r);return new v3(s,e)}case"Partition":{let s=t.getMathGraphics();return R.getInstance().partitionId==t.globalIndex?new B4(s,e,!0,!0):new v3(s,e)}case"Line":case"Board Outline":let i=t.layerId==11?0:t.strokeWidth,n=t.getMathGraphics(r);return new pj(n,i/2+e,t.layerId==11);default:break}}generateCircleHull(t,e,r){switch(t.type){case"Fill Region":case"TearDrop":case"Slot Region":case"Prohibited Region":{let s=t.getMathGraphics(r);return new v3(s,e)}case"Partition":{let s=t.getMathGraphics();return R.getInstance().partitionId==t.globalIndex?new B4(s,e,!0,!0):new v3(s,e)}case"Line":case"Board Outline":let i=t.layerId==11?0:t.strokeWidth,n=q.buildCircle(t.center,t.radius);return new OI(n,i+e*2,t.layerId==11);default:break}}generatePolygonHull(t,e,r){switch(t.type){case"TearDrop":{let s=t.getMathGraphics(r);return new v3(s,e)}case"Fill Region":case"Slot Region":case"Prohibited Region":{let s=t.getMathGraphics(r);return s instanceof ge?new _8(s,e,t.getParent()!=null):new Xie(s,e)}case"Partition":{let s=t.getMathGraphics();return R.getInstance().partitionId==t.globalIndex?new B4(s,e,!0,!0):new _8(s,e)}case"Line":case"Board Outline":let i=t.layerId==11?0:t.strokeWidth,n=t.getMathGraphics(r);return new pj(n,i/2+e,t.layerId==11);default:break}}generateTextImageHull(t,e,r){let i=t.getMathGraphics(r);return new v3(i,e)}};F4.manager=null;var fs=F4;var MCe=class{constructor(t){this.item=t,this.box=t.buildBBox()}bbox(){return this.box}},V4=class V4{constructor(){this.tree=null;this.hasConstraint=null}static getInstance(){return V4.manager==null&&(V4.manager=new V4),V4.manager}init(){this.tree==null&&(this.tree=new ji(10),this.add(Qi.getInstance().getAllItem(),this.tree),this.add(Fi.getInstance().getAllItem(),this.tree),this.add(vi.getInstance().getAllItem(),this.tree),this.hasConstraint=this.tree.size()>0)}clear(){var t;(t=this.tree)==null||t.clear(),this.tree=null,this.hasConstraint=null}search4Rtree(t){return kt.searchByTypes(t,Kp).getProfiles()}searchConstraint(t){let e=new Array;if(this.tree==null){let r=this.search4Rtree(t);for(let i of r){let n=i.model;n instanceof or&&n.type=="Constraint Region"&&e.push(n)}}else{let r=this.tree.search(t);for(let i of r)e.push(i.item)}return e}add(t,e){for(let r of t)r.type=="Constraint Region"&&e.add(new MCe(r))}};V4.manager=null;var Nl=V4;var Kd=class{constructor(){this.utils=new y3;this.map=new Map;this.isHole=t=>t instanceof et&&ar(t.layerId)||t instanceof Ct;this.utils.clear()}searchConstraintRegion(t){return Nl.getInstance().searchConstraint(t)}getConstraintRegion(t,e){var i;if(Nl.getInstance().hasConstraint==!1)return[];let r=(i=this.map.get(t))==null?void 0:i.filter(n=>!n.isEmpty);if(r==null&&Nl.getInstance().hasConstraint!=!1){e=t.buildBBox(),r=new Array,this.map.set(t,r);let n=this.searchConstraintRegion(e);if(!n)return[];for(let s of n)this.utils.isInConstraint(s,t)&&r.push(s);gI(r)}return r==null?[]:r}getTrackTouchConstraintRegion(t){let e=this.map.get(t);if(e==null&&Nl.getInstance().hasConstraint!=!1){e=new Array,this.map.set(t,e);let r=t.buildBBox(),i=this.searchConstraintRegion(r);for(let n of i)this.utils.isTrackTouchConstraint(n,t)&&e.push(n);gI(e)}return e==null?[]:e}isInConstraint(t,e){return this.utils.isInConstraint(e,t)}isTrackTouchConstraint(t,e){return this.utils.isTrackTouchConstraint(e,t)}filterConstraint4LayerId(t,e){let r=new Array;if(e==null)return t;for(let i of t)(i.layerId==e||i.layerId==12)&&r.push(i);return r}getClearance(t,e,r,i){let n=re.getInstance(),s=t.shapeType==12&&e.shapeType==12;for(let l of r){let c=n.getRegion(l.globalIndex);if(c.safeClearance!=null)return n.getSafeSpacing(c.safeClearance).getClearance(t.shapeType,e.shapeType,i);if(s&&c.otherClearance!=null)return n.getOtherSpacing(c.otherClearance).holeClearance}return s?n.getDefaultOtherSpacing().holeClearance:n.getSafeClearance(t,e,i)}getSafeRuleItems(t,e,r,i,n){let s=this.getClearance(t,e,r,n),a=this.getClearance(t,e,i,n);return Math.max(s,a)}getSafeClearance(t,e,r,i,n){let s=this.getConstraintRegionLayerId(t,e,i),a=this.isDiffPair(t,e),l=t.item!=null?this.filterConstraint4LayerId(this.getConstraintRegion(t.item,n),s):this.filterConstraint4LayerId(this.getConstraintRegion(r),s),c=e.item!=null?this.filterConstraint4LayerId(this.getConstraintRegion(e.item),s):[];return a?this.getDiffPairClearance(t,e,l,c,s):this.getSafeRuleItems(t,e,l,c,s)}isMultiItem(t){return t.shapeType==8||t.shapeType==11||t.shapeType==12}getConstraintRegionLayerId(t,e,r){let i=this.isMultiItem(t),n=this.isMultiItem(e);return!i&&!n?r:i&&n?r==12?null:r:r==12?t.layerId==12&&e.layerId==12?null:t.layerId!=12?t.layerId:e.layerId:r}getDiffClearance(t,e,r,i){let n=re.getInstance();for(let l of r){let c=n.getRegion(l.globalIndex);if(c.diff)return n.getDifferentialPhysics(c.diff).getDifferentialPairSpacingMin(i)}let s=re.getInstance().getDifferentialPhysicsByNet(t.net);return s?s.getDifferentialPairSpacingMin(i):n.getSafeClearance(t,e,i)}getDiffPairClearance(t,e,r,i,n){let s=this.getDiffClearance(t,e,r,n),a=this.getDiffClearance(t,e,i,n);return Math.max(s,a)}isValid4Model(t,e){if(t.modelType=="Via"){let r=ha(t),i=ha(t,!1);return this.isValid(r,e)||this.isValid(i,e)}else{let r=ha(t);return this.isValid(r,e)}}isValid(t,e){let r=re.getInstance(),i=r.getRegion(e.globalIndex),n=!1;if(t.shapeType===0){let s=r.getNet(t.net);if(s!=null&&s.netDifferential!=null&&(n=!0),n){if(i.diff!=null)return!0}else if(i.safeClearance!=null||i.track!=null)return!0}else if(t.shapeType===5){if(i.radius!=null)return!0}else if(t.shapeType===12&&i.otherClearance!=null)return!0;return!1}isDiffPair(t,e){var i;let r=!1;if(t.shapeType===0&&e.shapeType===0){let n=re.getInstance().getNet(t.net);n!=null&&n.netDifferentialName!=null&&((i=n.netDifferential)!=null&&i.hasNet(e.net))&&e.net!=n.name&&(r=!0)}return r}hasDiffPair(t){for(let e of t){let r=re.getInstance().getNet(e);if(r!=null&&r.netDifferentialName!=null){if(!r.netDifferential)continue;if(e==r.netDifferential.positiveNet.name){if(t.has(r.netDifferential.negativeNet.name))return!0}else if(t.has(r.netDifferential.positiveNet.name))return!0}}return!1}getMaxClearance(){return Math.max(re.getInstance().getMaxSafe(),re.getInstance().getItemMaxClearance(12))}getMaxTrackClearance(t){return re.getInstance().getMaxSafeTrack(t)}getTrackSafeClearance(t,e,r,i,n){let s=this.isDiffPair(t,e),a=this.getConstraintRegionLayerId(t,e,n),l=this.filterConstraint4LayerId(this.getConstraintRegion(r),a),c=this.filterConstraint4LayerId(this.getConstraintRegion(i),a);return s?this.getTrackDiffPairClearance(t,e,l,c,a):this.getTrackSafeRuleItems(t,e,l,c,a)}getTrackSafeRuleItems(t,e,r,i,n){let s=this.getClearance(t,e,r,n),a=this.getClearance(t,e,i,n);return Math.max(s,a)}getTrackDiffPairClearance(t,e,r,i,n){let s=this.getDiffClearance(t,e,r,n),a=this.getDiffClearance(t,e,i,n);return Math.max(s,a)}};var Qu=class{constructor(t){this.tracks=new Set;this.vias=new Set;this.pads=new Set;this.imageTexts=new Set;this.profiles=new Set;this.checkStart=new Set;this.checkEnd=new Set;for(let e of t)this.addModel(e)}addModel(t){if(t.modelType=="Track"||t.modelType=="ArcTrack"){let e=At.getInstance().getListNode(t);if(e!=null&&e.ignore)return;if(this.tracks.add(t),e!=null){let r=e.parent;e.prev==null&&r.otherNode.prev!=null&&this.checkStart.add(t),e.next==null&&r.otherNode.next!=null&&this.checkEnd.add(t)}}else if(t.modelType=="Pad")this.pads.add(t);else if(t.modelType=="Via")this.vias.add(t);else if(t.modelType=="Image"||t.modelType=="Text"){let e=Ze.getInstance().getLayer(t.layerId);ns(e.type)&&this.imageTexts.add(t)}else if(t.modelType=="Polygon"||t.modelType=="Rect"||t.modelType=="Circle"){let e=t;switch(e.type){case"Board Outline":case"Prohibited Region":case"Constraint Region":case"Partition":case"Slot Region":{this.profiles.add(t);break}case"TearDrop":case"Fill Region":case"Line":{let r=Ze.getInstance().getLayer(e.layerId);(ns(r.type)||e.layerId==11)&&this.profiles.add(t);break}}}}replaceVias(t){this.vias=t}replacePads(t){this.pads=t}replaceTracks(t){this.tracks=t}remove(t){for(let e of t)e.modelType=="Track"||e.modelType=="ArcTrack"?(this.tracks.delete(e),this.checkStart.delete(e),this.checkEnd.delete(e)):e.modelType=="Pad"?this.pads.delete(e):e.modelType=="Via"?this.vias.delete(e):e.modelType=="Image"||e.modelType=="Text"?this.imageTexts.delete(e):(e.modelType=="Polygon"||e.modelType=="Rect"||e.modelType=="Circle")&&this.profiles.delete(e)}clear(){this.tracks.clear(),this.vias.clear(),this.pads.clear(),this.imageTexts.clear(),this.profiles.clear()}getAll(){let t=new Set;return xe.addAllSet(t,this.tracks),xe.addAllSet(t,this.vias),xe.addAllSet(t,this.pads),xe.addAllSet(t,this.imageTexts),xe.addAllSet(t,this.profiles),t}getAllItem(){let t=new Array;return xe.addAll(t,this.tracks),xe.addAll(t,this.vias),xe.addAll(t,this.pads),xe.addAll(t,this.imageTexts),xe.addAll(t,this.profiles),t}};var v8=class{constructor(){this.exclusions=new Set}filter(t){return t}};var qie=class extends v8{constructor(){super(...arguments);this.obstacles=new Set;this.waitShoves=new Set;this.shovedPath=new Set;this.allowPushVia=!1;this.isShove=!1;this.net=null;this.arounds=null;this.layerId=null}isValid(e){return this.layerId!=null&&e.layerId!=this.layerId?!1:!e.locked&&!xs(e)&&e.getParent()==null?this.obstacles.has(e)||this.exclusions.has(e)?!0:this.waitShoves.has(e)?!1:this.net!=null&&e.net==this.net?!!(this.shovedPath.has(e)&&(this.arounds==null||this.arounds!=null&&this.arounds.has(e))):this.isShove?!!this.shovedPath.has(e):!0:!0}canShove(e){return e.locked||xs(e)||e.getParent()!=null||this.layerId!=null&&e.layerId!=this.layerId?!1:!this.shovedPath.has(e)}setMode(e){this.isShove=e}setNet(e,r){if(this.net=e,this.arounds=r,this.layerId=null,r!=null&&r.size>0)for(let i of r){this.layerId=i.layerId;break}}setNetAndLayerId(e,r){this.net=e,this.layerId=r}clear(){this.net=null}};var $ie=class extends v8{constructor(){super(...arguments);this.obstacles=new Set;this.waitShoves=new Set;this.shovedPath=new Set;this.isShove=!1;this.net=null}isValid(e){return this.waitShoves.has(e)||this.net!=null&&e.net==this.net?!1:e.locked||xs(e)||e.getParent()!=null||this.obstacles.has(e)||this.exclusions.has(e)?!0:this.isShove?!!(this.shovedPath.has(e)&&e.net!=this.net):!0}isValidPad(e){return!!(this.obstacles.has(e)||this.exclusions.has(e))}isSameNet(e){return this.net!=null&&e.net==this.net}canShove(e){return e.locked||xs(e)||e.getParent()!=null?!1:!this.shovedPath.has(e)}setMode(e){this.isShove=e}setNet(e){this.net=e}clear(){this.net=null}};var x8=class{constructor(){this.trackfilter=new qie;this.viaFilter=new $ie;this.filterMode=0;this.repeatList=new Set}isPushTrack(){return this.filterMode==3}isTrackShove(){return this.trackfilter.isShove}canShoveVia(){return this.viaFilter.isShove}clearExclusion(){this.trackfilter.exclusions.clear(),this.viaFilter.exclusions.clear()}setAroundMode(){this.trackfilter.setMode(!1),this.viaFilter.setMode(!1)}setNet(t,e){this.trackfilter.setNet(t,e),this.viaFilter.setNet(t)}setNetAndLayerId(t,e){this.trackfilter.setNetAndLayerId(t,e)}setFilterMode(t){this.filterMode=t}setSolidFilterMode(t=!0){this.trackfilter.setMode(t),this.viaFilter.setMode(!0)}setSolidViaFilterMode(t=!0){this.trackfilter.setMode(t),this.viaFilter.setMode(!1)}addObstacle(t){t instanceof gt?this.trackfilter.obstacles.add(t):t instanceof Ct&&this.viaFilter.obstacles.add(t)}hasObstacle(t){return t instanceof gt?this.trackfilter.obstacles.has(t):t instanceof Ct?this.viaFilter.obstacles.has(t):!1}removeObstacle(t){t instanceof gt?this.trackfilter.obstacles.delete(t):t instanceof Ct&&this.viaFilter.obstacles.delete(t)}isValidTrack(t){return this.filterMode==2?this.trackfilter.canShove(t):this.filterMode==3?this.trackfilter.isValid(t):this.trackfilter.isValid(t)}isValidVia(t){return this.filterMode==2?this.viaFilter.canShove(t):this.filterMode==3?this.viaFilter.isValid(t):this.trackfilter.layerId!=null&&!t.isContains(this.trackfilter.layerId)?!1:this.viaFilter.isValid(t)}isValidPad(t){return this.filterMode==2?!1:this.filterMode==3?this.viaFilter.isValidPad(t):!this.viaFilter.isSameNet(t)}isValidOther(t){return this.filterMode==2?!1:this.filterMode!=3}isValid(t){return t instanceof gt?this.isValidTrack(t):t instanceof Ct?this.isValidVia(t):t instanceof et?this.isValidPad(t):this.isValidOther(t)}addWaitList(t){if(t instanceof as)this.viaFilter.waitShoves.add(t.item);else{let e=t.iterator();for(;e.hasNext();)this.trackfilter.waitShoves.add(e.next());t.viaNode.prev!=null&&this.viaFilter.waitShoves.add(t.viaNode.prev.item),t.viaNode.next!=null&&this.viaFilter.waitShoves.add(t.viaNode.next.item)}}addWait(t){if(t instanceof as)this.viaFilter.waitShoves.add(t.item);else{let e=t.iterator();for(;e.hasNext();)this.trackfilter.waitShoves.add(e.next());t.viaNode.prev!=null&&this.viaFilter.waitShoves.add(t.viaNode.prev.item),t.viaNode.next!=null&&this.viaFilter.waitShoves.add(t.viaNode.next.item)}}addList2Filter(t){let e=t.iterator();for(;e.hasNext();){let r=e.next();this.trackfilter.shovedPath.add(r),this.trackfilter.waitShoves.delete(r)}t.viaNode.prev!=null&&(this.viaFilter.shovedPath.add(t.viaNode.prev.item),this.viaFilter.waitShoves.delete(t.viaNode.prev.item)),t.viaNode.next!=null&&(this.viaFilter.shovedPath.add(t.viaNode.next.item),this.viaFilter.waitShoves.delete(t.viaNode.next.item))}addListObstacles(t){t.viaNode.prev!=null&&(this.viaFilter.shovedPath.add(t.viaNode.prev.item),this.viaFilter.waitShoves.delete(t.viaNode.prev.item)),t.viaNode.next!=null&&(this.viaFilter.shovedPath.add(t.viaNode.next.item),this.viaFilter.waitShoves.delete(t.viaNode.next.item)),t.otherNode.prev!=null&&this.viaFilter.obstacles.add(t.otherNode.prev),t.otherNode.next!=null&&this.viaFilter.obstacles.add(t.otherNode.next)}addAroundList(t){if(t instanceof as){this.viaFilter.shovedPath.add(t.item),this.viaFilter.waitShoves.delete(t.item);return}this.addList2Filter(t);let e=new Set;if(t.otherNode.prev!=null)if(t.otherNode.prev instanceof et)this.viaFilter.obstacles.add(t.otherNode.prev);else if(t.otherNode.prev instanceof Fn){let r=t.otherNode.prev;r!=null&&!e.has(r)&&(e.add(r),this.addList2Filter(r))}else this.viaFilter.obstacles.add(t.otherNode.prev);if(t.otherNode.next!=null)if(t.otherNode.next instanceof et)this.viaFilter.obstacles.add(t.otherNode.next);else if(t.otherNode.next instanceof Fn){let r=t.otherNode.next;r!=null&&!e.has(r)&&(e.add(r),this.addList2Filter(r))}else this.viaFilter.obstacles.add(t.otherNode.next)}addAroundTracks(t){if(t!=null){if(t instanceof as){this.viaFilter.shovedPath.add(t.item),this.viaFilter.waitShoves.delete(t.item);return}for(let e of t)this.trackfilter.shovedPath.add(e),this.trackfilter.waitShoves.delete(e)}}addShoveComplete(t){if(t instanceof as){this.viaFilter.shovedPath.add(t.item),this.viaFilter.waitShoves.delete(t.item);return}if(this.addList2Filter(t),t.otherNode.prev!=null)if(t.otherNode.prev instanceof et)this.viaFilter.obstacles.add(t.otherNode.prev);else if(t.otherNode.prev instanceof Fn){let e=t.otherNode.prev;this.addList2Filter(e)}else this.viaFilter.obstacles.add(t.otherNode.prev);if(t.otherNode.next!=null)if(t.otherNode.next instanceof et)this.viaFilter.obstacles.add(t.otherNode.next);else if(t.otherNode.next instanceof Fn){let e=t.otherNode.next;this.addList2Filter(e)}else this.viaFilter.obstacles.add(t.otherNode.next)}deleteAroundTracks(t){if(t!=null){if(t instanceof as){this.viaFilter.shovedPath.delete(t.item),this.viaFilter.waitShoves.add(t.item);return}for(let e of t)this.trackfilter.shovedPath.delete(e),this.trackfilter.waitShoves.add(e)}}deleteList4Filter(t){let e=t.iterator();for(;e.hasNext();){let r=e.next();this.trackfilter.shovedPath.delete(r),this.trackfilter.waitShoves.add(r)}t.viaNode.prev!=null&&(this.viaFilter.shovedPath.delete(t.viaNode.prev.item),this.viaFilter.waitShoves.add(t.viaNode.prev.item)),t.viaNode.next!=null&&(this.viaFilter.shovedPath.delete(t.viaNode.next.item),this.viaFilter.waitShoves.add(t.viaNode.next.item)),t.otherNode.prev!=null&&this.viaFilter.obstacles.delete(t.otherNode.prev),t.otherNode.next!=null&&this.viaFilter.obstacles.delete(t.otherNode.next)}deleteAroundList(t){if(t instanceof as){this.viaFilter.shovedPath.delete(t.item),this.viaFilter.waitShoves.add(t.item);return}this.deleteList4Filter(t)}addRepeatAroundList(t){if(this.repeatList.add(t),t instanceof as){this.viaFilter.shovedPath.delete(t.item),this.viaFilter.waitShoves.add(t.item);return}this.deleteList4Filter(t)}clearRepeatAroundList(){for(let t of this.repeatList)this.addAroundList(t);this.repeatList.clear()}addObastacleList(t){if(t instanceof as)this.viaFilter.obstacles.add(t.item);else{this.addList2Obstacles(t);let e=new Set;if(t.otherNode.prev!=null)if(t.otherNode.prev instanceof et)this.viaFilter.obstacles.add(t.otherNode.prev);else if(t.otherNode.prev instanceof Fn){let r=t.otherNode.prev;r!=null&&!e.has(r)&&(e.add(r),this.addList2Obstacles(r))}else this.viaFilter.obstacles.add(t.otherNode.prev);if(t.otherNode.next!=null)if(t.otherNode.next instanceof et)this.viaFilter.obstacles.add(t.otherNode.next);else if(t.otherNode.next instanceof Fn){let r=t.otherNode.next;r!=null&&!e.has(r)&&(e.add(r),this.addList2Obstacles(r))}else this.viaFilter.obstacles.add(t.otherNode.next)}}addExclusionShape(t){t instanceof gt?this.viaFilter.exclusions.add(t):this.viaFilter.exclusions.add(t)}addExclusionList(t){if(t instanceof as)this.viaFilter.exclusions.add(t.item);else{this.addList2Exclusion(t);let e=new Set;if(t.otherNode.prev!=null)if(t.otherNode.prev instanceof et)this.viaFilter.exclusions.add(t.otherNode.prev);else if(t.otherNode.prev instanceof Fn){let r=t.otherNode.prev;r!=null&&!e.has(r)&&(e.add(r),this.addList2Exclusion(r))}else this.viaFilter.exclusions.add(t.otherNode.prev);if(t.otherNode.next!=null)if(t.otherNode.next instanceof et)this.viaFilter.exclusions.add(t.otherNode.next);else if(t.otherNode.next instanceof Fn){let r=t.otherNode.next;r!=null&&!e.has(r)&&(e.add(r),this.addList2Exclusion(r))}else this.viaFilter.exclusions.add(t.otherNode.next)}}addList2Obstacles(t){let e=t.iterator();for(;e.hasNext();)this.trackfilter.obstacles.add(e.next());t.viaNode.prev!=null&&this.viaFilter.obstacles.add(t.viaNode.prev.item),t.viaNode.next!=null&&this.viaFilter.obstacles.add(t.viaNode.next.item)}addList2Exclusion(t){let e=t.iterator();for(;e.hasNext();)this.trackfilter.exclusions.add(e.next());t.viaNode.prev!=null&&this.viaFilter.exclusions.add(t.viaNode.prev.item),t.viaNode.next!=null&&this.viaFilter.exclusions.add(t.viaNode.next.item)}clearObstacles(){this.trackfilter.obstacles.clear(),this.viaFilter.obstacles.clear()}};var AI=class{constructor(t){this.cb=t}doAction(t){this.cb(t)}};var NCe=class{constructor(){this.start=0;this.log="";this.map=new Map;this.countMap=new Map}startTime(t){}endTime(){}getSingleMax(){let t="",e=0;for(let[r,i]of this.map)for(let n of i)n>e&&(e=n,t=r);console.log(`${t} this max time:${e}ms`)}getCount(){let t=new Map;for(let[e,r]of this.countMap){let i=this.map.get(e),n=r/i.length;t.set(e,n)}for(let[e,r]of t)console.log(`${e} this same time:${r}ms`)}clear(){this.map.clear(),this.countMap.clear()}},AVe=new NCe,fj=class{constructor(){this.sameNetFilter=null;this.filter=null;this.manager=$l.getInstance();this.aroundFilter=null;this.useShoveTree=!1;this.ignores=new Set;this.hasPartition=null}get pushFilter(){if(this.filter==null)throw new Error("push filter use Error!!!");return this.filter}updateParition(){this.hasPartition=bo.getInstance().getAllItem().length>0}clearParition(){this.hasPartition=null}itemValid(t){return this.isValid(t.item.model)}need(t,e){return e=="Track"||e=="ArcTrack"?this.filter!=null&&this.filter.trackfilter.layerId!=null?this.filter.trackfilter.layerId==t:!0:e=="Pad"?this.filter!=null&&this.filter.trackfilter.layerId!=null&&t!=12?this.filter.trackfilter.layerId==t:!0:e=="Image"||e=="Text"?this.filter!=null&&this.filter.trackfilter.layerId!=null?this.filter.trackfilter.layerId==t:!0:(e=="Polygon"||e=="Rect"||e=="Circle")&&this.filter!=null&&this.filter.trackfilter.layerId!=null&&t!=11&&t!=12&&t!=1004?this.filter.trackfilter.layerId==t:!0}keepTPV(t,e){return e=="Track"||e=="ArcTrack"?this.filter!=null&&this.filter.trackfilter.layerId!=null?this.filter.trackfilter.layerId==t:!0:e=="Pad"?this.filter!=null&&this.filter.trackfilter.layerId!=null&&t!=12?this.filter.trackfilter.layerId==t:!0:e=="Via"}search4Rtree(t,e=!0,r){r==null&&(r=new Qu([]));let n=oi.getInstance().RTREE.conditionSearch(t,this.itemValid.bind(this),this.need.bind(this));return n.setAction(new AI(s=>{r.addModel(s.model)})),n.doAction(["Track","ArcTrack","Pad","Via","Polygon","Rect","Circle","Text","Image"]),oi.partition!=null&&r.addModel(oi.partition),e?r.getAllItem():[]}search4TPV(t,e=!0,r){r==null&&(r=new Qu([]));let n=oi.getInstance().RTREE.conditionSearch(t,this.itemValid.bind(this),this.keepTPV.bind(this));return n.setAction(new AI(s=>{r.addModel(s.model)})),n.doAction(["Track","ArcTrack","Pad","Via"]),oi.partition!=null&&r.addModel(oi.partition),e?r.getAllItem():[]}search4RtreePad(t,e=!0,r){r==null&&(r=new Qu([]));let s=oi.getInstance().RTREE.searchByType(t,"Pad").pads;if(s!=null)for(let a of s){let l=a.model;this.isValid(l)&&r.addModel(l)}return e?r.getAllItem():[]}search4RtreeVia(t,e=!0,r){r==null&&(r=new Qu([]));let s=oi.getInstance().RTREE.searchByType(t,"Via").vias;if(s!=null)for(let a of s){let l=a.model;this.isValid(l)&&r.addModel(l)}return e?r.getAllItem():[]}searhTracks(t,e){return e=="Track"?this.filter!=null&&this.filter.trackfilter.layerId!=null?this.filter.trackfilter.layerId==t:!0:e=="ArcTrack"?this.filter!=null&&this.filter.trackfilter.layerId!=null?this.filter.trackfilter.layerId==t:!0:!1}search4RtreeTrack(t,e=!0,r){r==null&&(r=new Qu([]));let s=oi.getInstance().RTREE.search(t,this.searhTracks.bind(this)).getTracks();if(s!=null){let a=s.length;for(let l=0;l<a;l++){let c=s[l].model;this.isValid(c)&&r.addModel(c)}}return e?r.getAllItem():[]}search4RtreeTrackAndVia(t,e=!0,r){let i=this.search4RtreeVia(t,e,r),n=this.search4RtreeTrack(t,e,r);return e?i.concat(n):[]}isValid(t){return this.ignores.has(t)?!1:t instanceof gt?!(t.isEmpty||this.manager.has(t.globalIndex)||this.filter!=null&&!this.filter.isValidTrack(t)):t instanceof et?!(this.filter!=null&&!this.filter.isValidPad(t)):t instanceof Ct?!(t.isEmpty||this.manager.has(t.globalIndex)||this.filter!=null&&!this.filter.isValidVia(t)):t instanceof or?!(this.filter!=null&&!this.filter.isValidOther(t)||t.layerId==1004&&R.getInstance().partitionId==""&&t.component.fileUuid==""):t instanceof Li?!(this.filter!=null&&!this.filter.isValidOther(t)):t instanceof Dl?!(this.filter!=null&&!this.filter.isValidOther(t)):!1}searchPadContidition(t,e){return e=="Pad"?this.filter!=null&&this.filter.trackfilter.layerId!=null&&t!=12?this.filter.trackfilter.layerId==t:!0:!1}search4ShoveRtree(t,e=!0,r){r==null&&(r=new Qu([]));let i=oi.getInstance().shoveTree.search(t),n=oi.getInstance().RTREE.map.get("Pad");if(n!=null){for(let[a,l]of n)if(this.searchPadContidition(a,"Pad")){let c=l.search(t),h=c.length;for(let u=0;u<h;u++){let d=c[u].item.model;this.isValid(d)&&r.addModel(d)}}}let s=i.length;for(let a=0;a<s;a++){let l=i[a].model;this.isValid(l)&&r.addModel(l)}return e?r.getAllItem():[]}search4WireTree(t,e=!0,r){r==null&&(r=new Qu([]));let i=oi.getInstance().rtree.search(t),n=i.length;for(let s=0;s<n;s++){let a=i[s].model;this.isValid(a)&&r.addModel(a)}return e?r.getAllItem():[]}search4All(t,e=!0,r){if(this.useShoveTree)return this.search4ShoveRtree(t,e,r);{let i=this.search4Rtree(t,e,r);return xe.addAll(i,this.search4WireTree(t,e,r)),i}}searchTPV(t,e=!0,r){if(this.useShoveTree)return this.search4ShoveRtree(t,e,r);{let i=this.search4TPV(t,e,r);return xe.addAll(i,this.search4WireTree(t,e,r)),i}}searchVia4All(t,e=!0,r){let i=this.search4RtreeVia(t,e,r);return xe.addAll(i,this.search4WireTree(t,e,r)),i}searchTrack4All(t,e=!0,r){if(this.useShoveTree)return this.search4ShoveRtree(t,e,r);{let i=this.search4RtreeTrack(t,e,r);return xe.addAll(i,this.search4WireTree(t,e,r)),i}}searchTrackAndVia4All(t,e=!0,r){if(this.useShoveTree)return this.search4ShoveRtree(t,e,r);{let i=this.search4RtreeTrackAndVia(t,e,r);return xe.addAll(i,this.search4WireTree(t,e,r)),i}}setPushFilter(){this.filter=new x8}search1(t){let e=new Qu([]);if(this.search4All(t,!1,e),this.aroundFilter!=null){let r=this.aroundFilter.filter(e.tracks);e.replaceTracks(r)}return e}searchConnect(t){let e=new Qu([]);if(this.searchTPV(t,!1,e),this.aroundFilter!=null){let r=this.aroundFilter.filter(e.tracks);e.replaceTracks(r)}return e}searchInput(t){let e=new Qu([]);if(this.search4WireTree(t,!1,e),this.aroundFilter!=null){let r=this.aroundFilter.filter(e.tracks);e.replaceTracks(r)}return e}searchVia(t,e){if(!e)return this.search1(t);let r=new Qu([]);if(this.searchVia4All(t,!1,r),this.aroundFilter!=null){let i=this.aroundFilter.filter(r.tracks);r.replaceTracks(i)}return r}searchTrack(t){let e=new Qu([]);if(this.searchTrack4All(t,!1,e),this.aroundFilter!=null){let r=this.aroundFilter.filter(e.tracks);e.replaceTracks(r)}return e}searchTrackAndVia(t){let e=new Qu([]);if(this.searchTrackAndVia4All(t,!1,e),this.aroundFilter!=null){let r=this.aroundFilter.filter(e.tracks);e.replaceTracks(r)}return e}searchPad(t){let e=this.search4Rtree(t),r=new Qu(e);return r.tracks.clear(),r.vias.clear(),r}searchOutline(t){let r=oi.getInstance().RTREE.searchByTypes(t,["Rect","Circle","Polygon"]),i=new Array;if(r!=null)return r.setAction(new AI(n=>{let s=n.model;s instanceof or&&(s.type=="Board Outline"||s.layerId==11||s.type=="Partition"&&R.getInstance().partitionId==s.globalIndex)&&i.push(s)})),r.doAction(["Rect","Circle","Polygon"]),i}searchPartition(t){let e=new Qu([]),i=oi.getInstance().RTREE.searchByTypes(t,["Rect","Circle","Polygon"]);if(i!=null)return i.setAction(new AI(n=>{let s=n.model;s instanceof or&&s.type=="Partition"&&e.addModel(s)})),i.doAction(["Rect","Circle","Polygon"]),e}},wt=new fj;var cR=class{constructor(){this.manager=fs.getInstance()}collide(t,e){let r=t.start();if(this.pointInPolyline(r,e))return r;let n=t.bbox(),s=new Ta;s.add(t.end());for(let l of e.primitives){let c=l.bbox();if(!n.isIntersect(c))continue;let h=Pt(t,l);for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);s.add(d)}}let a=this.sortInters(s,t);return a.length>0?a[0]:t.end()}checkCollide(t,e){if(t instanceof M&&!t.isPoint()){let i=t.end().sub(t.start()).normalize().angle(S.ORIGIN),n=Qe.rotate(i),s=t.multiply3(n),a=e.multiply3(n),l=s.bbox().extendOfSize(1e-6),c=a.bbox();return l.isIntersect(c)!=null}return!0}collideOutline(t,e,r){let i=new Array,n=t,s=n.bbox();for(let l of e.primitives){if(l instanceof M&&l.length()<1e-8)continue;let c=l.bbox().extendOfSize(r);if(!s.isIntersect(c))continue;let h=l.stroke(r*2,wr.ROUND,ae.CCW).closeEndpoint(),u=n.bbox(),d=h.bbox();if(!u.isIntersect(d))continue;let p=this.collide(n,h);i.push(p),n=this.getNewPrimitive(n,p)}let a=an(i,t);return a.length>0?a[0]:t.end()}sortInters(t,e){let r=t.iterator(),i=new Array;for(;r.hasNext();){let n=r.next();i.push(n)}return an(i,e)}getNewPrimitive(t,e){return t instanceof M?new M(t.start(),e):q.build2(t.center,t.startAngle,e.angleD(t.center),t.rx,t.ry,t.sweep())}pointInPolyline(t,e){return jr.inPolyline(t,e)}};var el=class{constructor(t,e,r,i,n=!1,s,a,l=null){this.info=null;this.block=null;this.source=t,this.point=e,this.obstacle=r,this.clearance=i,this.isSameNet=n,this.layer1=s,this.layer2=a,this.info=l}bbox(){return this.point.bbox()}};var g3t=.001,hR=class{constructor(){this.manager=fs.getInstance();this.kit=new Rc(g3t)}getEnd(t,e,r){if(!this.checkCollide(t,e,r))return t.end();let i=t.end(),n=new As(ge.build2([t]),e,r);switch(n.relation){case 3:return n.distance>r?i:this.getInterEnd(t,e,r);case 0:return this.getInterEnd(t,e,r);case 1:case 2:return t.start()}}checkCollide(t,e,r){if(t instanceof M&&!t.isPoint()){let n=t.end().sub(t.start()).normalize().angle(S.ORIGIN),s=Qe.rotate(n),a=t.multiply3(s),l=e.multiply3(s),c=a.bbox().extendOfSize(1e-6),h=l.bbox().extendOfSize(r);return c.isIntersect(h)!=null}return!0}getInterEnd(t,e,r){let i=t.end();for(let n of e.primitives)n instanceof M?t instanceof M?(i=this.calcuLineLine(t,n,r),t=new M(t.start(),i)):(i=this.calcuLineArc(n,t,!1,r),t=q.build2(t.center,t.startAngle,i.angleD(t.center),t.rx,t.ry,t.sweep())):n instanceof q&&(t instanceof M?(i=this.calcuLineArc(t,n,!0,r),t=new M(t.start(),i)):(i=this.calcuArcArc(t,n,r),t=q.build2(t.center,t.startAngle,i.angleD(t.center),t.rx,t.ry,t.sweep())));return i}getNewPrimitive(t,e){return t instanceof M?new M(t.start(),e):q.build2(t.center,t.startAngle,e.angleD(t.center),t.rx,t.ry,t.sweep())}isSameNet(t,e){return t===e}isSameLayer(t,e){return t===e}pointInPolyline(t,e){return e instanceof Bt?new Dc().inPolygon(t,e.items):new Dc().inPolyline(t,e)}calcuLineLine(t,e,r){let i=t.start(),n=t.end(),s=e.stroke(r*2,wr.ROUND,ae.CCW).asClose();if(this.pointInPolyline(i,s))return i;let l=new Set;for(let c of s.primitives){let h=Pt(t,c);if(h>0)for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);l.add(d)}}if(l.size>0){let c=n.distance1(i);l.forEach(h=>{let u=h.distance1(i);u<c&&(n=h,c=u)})}return n}calcuLineArc(t,e,r,i){if(r){let n=t.start(),s=t.end();if(i=i<1e-5?0:i,i==0)return t.start();let a=e.stroke(i*2,wr.ROUND,ae.CCW).asClose();if(new Dc().pointInPolyline(n,a))return n;let c=new Set;for(let h of a.primitives){let u=Pt(t,h);if(u>0)for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);c.add(p)}}if(c.size>0){let h=s.distance1(n);c.forEach(u=>{let d=u.distance1(n);d<h&&(s=u,h=d)})}return s}else{let n=e.start(),s=e.end(),a=(e.startAngle%360+360)%360,l=t.stroke(i*2,wr.ROUND,ae.CCW).asClose();if(new Dc().pointInPolyline(n,l))return n;let h=new Set;for(let u of l.primitives){let d=Pt(e,u);if(d>0)for(let p=0;p<d;p+=2){let m=new S(Ee[p],Ee[p+1]);h.add(m)}}if(h.size>0){let u=e.center,d=e.sweep(),p=e.sweepAngle;h.forEach(m=>{let g=(m.angleD(u)%360+360)%360;if(d==ae.CCW){let y=(g-a+360)%360;y<p&&(s=m,p=y)}else{let y=(g-a-360)%360;y>p&&(s=m,p=y)}})}return s}}calcuArcArc(t,e,r){let i=t.start(),n=t.end(),s=(t.startAngle%360+360)%360,a=e.stroke(r*2,wr.ROUND,ae.CCW).asClose();if(new Dc().pointInPolyline(i,a))return i;let c=new Set;for(let h of a.primitives){let u=Pt(t,h);if(u>0)for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);c.add(p)}}if(c.size>0){let h=t.center,u=t.sweep(),d=t.sweepAngle;c.forEach(p=>{let m=(p.angleD(h)%360+360)%360;if(u==ae.CCW){let g=(m-s+360)%360;g<d&&(n=p,d=g)}else{let g=(m-s-360)%360;g>d&&(n=p,d=g)}})}return n}isCollide(t,e,r,i=!0,n=!0){if(e==null)return!1;let s=t.bbox().extendOfSize(r);for(let a of e.primitives){if(a instanceof M&&a.length()<1e-8)continue;let l=a.bbox();if(s.isIntersect(l)){let c=new er(t,a).getDistance();if(this.kit.less(c,r))return!0}}return!!(i&&this.pointInPolyline(t.start(),e)||t instanceof q&&this.kit.eq(Math.abs(t.sweepAngle),360)&&e.primitives[0].start().distance1(t.center)<t.rx)}};var i0=class{constructor(t){this.collide=!1;this.obstalce=null;this.collideInfo=null;this.style=null;this.style=t}addObstacle(t){this.obstalce=t}check(t){return this.obstalce!=null&&(this.collide=this.obstalce.checkCollide(t,this.style)),this}inters(t){return this.obstalce!=null&&this.collideInfo==null&&(this.collideInfo=this.obstalce.collide(t,this.style)),this.collideInfo!=null?(this.collideInfo.sort(),this.collideInfo.getEnd()):t.end()}};var kCe=class extends hR{check(t,e,r,i,n,s){switch(i.modelType){case"Track":case"ArcTrack":return this.checkTrackTrack(t,e,r,i,n,s);case"Pad":return this.checkTrackPad(t,e,r,i,n,s);case"Via":return this.checkTrackVia(t,e,r,i,n,s);case"Polygon":case"Rect":case"Circle":{let a=i;switch(a.type){case"Fill Region":case"TearDrop":case"Slot Region":return this.checkTrackProfile(t,e,r,a,n,s);case"Line":return this.checkTrackLine(t,e,r,a,n,s);case"Board Outline":return this.checkTrackBoard(t,e,r,a,n,s);case"Prohibited Region":return this.checkTrackProhibit(t,e,r,a,n,s);case"Partition":return this.checkTrackPartition(t,e,r,a,n,s)}break}case"Text":case"Image":return this.checkTrackBox(t,e,r,i,n,s)}return new i0(s)}checkPoint(t,e,r,i,n,s){if(this.isSameNet(r.net,i.net)||e!==12&&e!==i.layerId)return!1;let a=s?i.start:i.end,l=new M(a,a),c=t.bbox(),h=l.bbox(),u=r.width,d=i.width,p=n+u/2+d/2;if(!c.extendOfSize(p).intersection1(h))return!1;let g=new er(t,l).getDistance();if(this.kit.greatereq(g,p)){let y=ge.build7([l]),b=Wa.convexHull(y,n);return!!(!new Dc().inEdge4Polyline(t.end(),b,.006)&&this.pointInPolyline(t.end(),b))}else return!0}checkTrackTrackEnd(t,e,r,i,n,s,a=!1){if(!a&&this.isSameNet(r.net,i.net)||e!==12&&e!==i.layerId)return!1;let l=r.width,c=i.width,h=n+l/2+c/2,u=s?i.start:i.end;if(!t.bbox().extendOfSize(h).isContains(u))return!1;let d;t instanceof M?d=new Nb(t,h*2):d=new m1(t,h*2);let p=d.getOutline(ls);return!!d.inInside(u,p)}checkTrackTrack(t,e,r,i,n,s){let a=new i0(s);if(this.isSameNet(r.net,i.net)||e!==12&&e!==i.layerId)return a;let l=r.width,c=n+l/2,h=this.manager.getModelObstacle(i,c,e);return a.addObstacle(h),a.check(t)}checkTrackPad(t,e,r,i,n,s){let a=new i0(s);if(r.net===i.net||e!==12&&i.layerId!==12&&e!==i.layerId)return a;let l=n+r.width/2;if(!i.isUnuseLayer(e)){let c=this.manager.getModelObstacle(i,l,e);return a.addObstacle(c),a.check(t)}return a}checkTrackVia(t,e,r,i,n,s){let a=new i0(s);if(r.net===i.net||i.type==1&&!i.isContains(r.layerId))return a;let l=n+r.width/2;if(!i.isUnuseLayer(e)){let c=this.manager.getModelObstacle(i,l,e);return a.addObstacle(c),a.check(t)}return a}checkTrackProfile(t,e,r,i,n,s){let a=new i0(s);if(i.type=="Fill Region"&&i.component instanceof Zi&&i.component.isBridgingCopper){let h=i.component.networkList;if(h.length==0&&this.isSameNet(r.net,"")||h.length==1&&this.isSameNet(r.net,h[0]))return a}else if((i.type=="Fill Region"||i.type=="TearDrop")&&this.isSameNet(r.net,i.net)||(i.type=="Fill Region"||i.type=="TearDrop")&&i.layerId!==e&&e!==12)return a;let l=n+r.width/2,c=this.manager.getModelObstacle(i,l,r.layerId);return a.addObstacle(c),a.check(t)}checkTrackLine(t,e,r,i,n,s){let a=new i0(s);if(i.layerId!==11&&this.isSameNet(r.net,i.net)||e!==12&&i.layerId!==e&&i.layerId!==11)return a;let l=r.width/2+n,c=this.manager.getModelObstacle(i,l,r.layerId);return a.addObstacle(c),a.check(t)}checkTrackBoard(t,e,r,i,n,s){let a=new i0(s),l=r.width/2+n,c=this.manager.getModelObstacle(i,l,r.layerId);return a.addObstacle(c),a.check(t)}checkTrackBox(t,e,r,i,n,s){let a=new i0(s);if(e!==12&&i.layerId!==r.layerId)return a;let l=n+r.width/2,c=this.manager.getModelObstacle(i,l,r.layerId);return a.addObstacle(c),a.check(t)}checkTrackProhibit(t,e,r,i,n,s){let a=new i0(s);if(e!==12&&i.layerId!==e&&i.layerId!==12||!i.component.track)return a;let c=n+r.width/2,h=this.manager.getModelObstacle(i,c,r.layerId);return a.addObstacle(h),a.check(t)}checkTrackPartition(t,e,r,i,n,s){let a=new i0(s);if(i.type=="Partition"&&!i.component.isPartitionSplitOut())return a;let l=n,c=this.manager.getModelObstacle(i,l,r.layerId);return a.addObstacle(c),a.check(t)}},uh=new kCe;function y3t(o,t,e,r){return!(o.net==t.net||o.isSeparated(t)||e==12&&r==12||e!=12&&r!=12&&e!=r||o.type==1&&t.type==1&&r!==12&&e!==12&&(!o.isContains(r)||!t.isContains(e))||o.isUnuseLayer(e)||t.isUnuseLayer(r))}var BCe=class extends hR{check(t,e,r,i,n,s){switch(r.modelType){case"Track":case"ArcTrack":return this.checkViaTrack(t,e,r,i,n);case"Pad":return this.checkViaPad(t,e,r,i,n,s);case"Via":return this.checkViaVia(t,e,r,i,n,s);case"Polygon":case"Rect":case"Circle":switch(r.type){case"Fill Region":case"TearDrop":case"Slot Region":return this.checkViaRegion(t,e,r,i,n);case"Line":return this.checkViaLine(t,e,r,i,n);case"Board Outline":return this.checkViaBoard(t,e,r,i,n);case"Partition":return this.checkViaPartition(t,e,r,i,n)}case"Text":case"Image":return this.checkViaBox(t,e,r,i,n)}return new i0}checkViaTrack(t,e,r,i,n){let s=new i0;if(e.net==r.net||n!=12&&n!=r.layerId||e.type==1&&!e.isContains(r.layerId))return s;let a=i;if(!e.isUnuseLayer(n)||n==12){let l=this.getViaRadius(e,n),c=this.manager.getModelObstacle(r,a+l,r.layerId);return s.addObstacle(c),s.check(t)}return s}checkViaVia(t,e,r,i,n,s){let a=new i0;if(!y3t(e,r,n,s))return a;let l=this.getViaRadius(e,n),c=this.manager.getModelObstacle(r,i+l,s);return a.addObstacle(c),a.check(t)}getViaRadius(t,e){return e==12?t.holeRadius:t.radius}checkViaPad(t,e,r,i,n,s){let a=new i0;if(e.net==r.net||n==12&&s==12)return a;if(r.layerId==12){if(n!=12&&s!=12&&n!=s)return a}else if(r.layerId!=s)return a;if(e.isUnuseLayer(n)||r.isUnuseLayer(s)||e.type==1&&r.layerId!=12&&!e.isContains(r.layerId))return a;if(e.type==0){let l=this.getViaRadius(e,n);if(s!==12){let c=this.manager.getModelObstacle(r,i+l,s);return a.addObstacle(c),a.check(t)}if(s==12){let c=this.manager.getModelObstacle(r,i+l,s);return a.addObstacle(c),a.check(t)}}else{let l=this.getViaRadius(e,n);if(e.isContains(s)&&s!==12){let c=this.manager.getModelObstacle(r,i+l,s);return a.addObstacle(c),a.check(t)}if(s==12){let c=this.manager.getModelObstacle(r,i+l,s);return a.addObstacle(c),a.check(t)}}return a}checkViaRegion(t,e,r,i,n){let s=new i0;if(e.isUnuseLayer(n)||n!=12&&r.layerId!=12&&n!=r.layerId)return s;if(r.type=="Fill Region"&&r.component instanceof Zi&&r.component.isBridgingCopper){let c=r.component.networkList;if(c.length==0&&this.isSameNet(e.net,"")||c.length==1&&this.isSameNet(e.net,c[0]))return s}else if((r.type=="Fill Region"||r.type=="TearDrop")&&this.isSameNet(e.net,r.net)||e.type==1&&(r.type=="Fill Region"||r.type=="TearDrop")&&!e.isContains(r.layerId))return s;let a=this.getViaRadius(e,n),l=this.manager.getModelObstacle(r,i+a,r.layerId);return s.addObstacle(l),s.check(t)}checkViaLine(t,e,r,i,n){let s=new i0;if(this.isSameNet(e.net,r.net)||n!=12&&r.layerId!=11&&n!=r.layerId||e.type==1&&!e.isContains(r.layerId)||e.isUnuseLayer(n))return s;let a=this.getViaRadius(e,n),l=this.manager.getModelObstacle(r,i+a,r.layerId);return s.addObstacle(l),s.check(t)}checkViaBoard(t,e,r,i,n){let s=new i0;if(e.isUnuseLayer(n))return s;let a=this.getViaRadius(e,n),l=this.manager.getModelObstacle(r,i+a,r.layerId);return s.addObstacle(l),s.check(t)}checkViaPartition(t,e,r,i,n){let s=new i0,a=this.manager.getModelObstacle(r,i,r.layerId);return s.addObstacle(a),s.check(t)}checkViaBox(t,e,r,i,n){let s=new i0;if(n!==12&&n!==r.layerId||e.type==1&&!e.isContains(r.layerId)&&n!==12||e.isUnuseLayer(n))return s;let a=this.getViaRadius(e,n),l=this.manager.getModelObstacle(r,i+a,r.layerId);return s.addObstacle(l),s.check(t)}},uR=new BCe;var mj=class o{constructor(t){this.map=new Map;this.shape=t}addRes(t,e){this.map.set(t,e)}hashCode(){return this.shape.hashCode()}equals(t){return!!(t instanceof o&&t.shape.equals(this.shape))}},G4=class G4{constructor(){this.map=new Map;this.map1=new Map;this._hashMap=null}static getInstance(){return G4.manager==null&&(G4.manager=new G4),G4.manager}addDrcError(t,e,r,i){this._hashMap=this.map.get(t),this._hashMap==null&&(this._hashMap=new hd,this.map.set(t,this._hashMap));let n=new mj(e),s=this._hashMap.get(n);s==null&&(s=n,this._hashMap.put(n,n)),s.addRes(r,i),this.addError(r,e,t,i)}addError(t,e,r,i){this._hashMap=this.map1.get(t),this._hashMap==null&&(this._hashMap=new hd,this.map1.set(t,this._hashMap));let n=new mj(e),s=this._hashMap.get(n);s==null&&(s=n,this._hashMap.put(n,n)),s.addRes(r,i)}change(t){if(this._hashMap=this.map1.get(t),this._hashMap!=null){let e=this._hashMap.keys();for(;e.hasNext();){let r=e.next();for(let[i]of r.map){let n=this.map.get(i);if(n!=null){let s=n.get(r);s!=null&&s.map.delete(t)}}}this.map1.delete(t)}}getErrors(t,e){let r=new Array,i=this.map.get(t);if(i!=null){let n=new mj(e),s=i.get(n);if(s!=null)for(let[,a]of s.map)r.push(a)}return r}clear(){this.map.clear(),this.map1.clear()}};G4.manager=null;var pa=G4;var Kie=class{constructor(t){this.item=void 0;this._shapeType=10;this.item=t}setItem(t){this.item=t}get id(){var t;return((t=this.item)==null?void 0:t.globalIndex)||""}get net(){return qIe(this.item)}get layerId(){var t;if(this.item==null)throw new Error("Rule Item data Error!!!");return(t=this.item)==null?void 0:t.layerId}get shapeType(){return this._shapeType}set shapeType(t){this._shapeType=t}get isBridgingCopper(){return this._shapeType===6&&this.item instanceof or&&this.item.component instanceof Zi?this.item.component.isBridgingCopper:!1}get nets(){return this.isBridgingCopper&&this.item instanceof or?this.item.component.networkList:[]}},kb=class{constructor(){this.rule1=new Kie;this.rule2=new Kie}sycnRule1(t,e=!1){return this.rule1.setItem(t),e?this.rule1.shapeType=12:this.rule1.shapeType=l1(t),this.rule1}sycnRule2(t,e=!1){return this.rule2.setItem(t),e?this.rule2.shapeType=12:this.rule2.shapeType=l1(t),this.rule2}sycnTrack1(t){return this.rule1.setItem(t),this.rule1.shapeType=0,this.rule1}};function R8(o,t){if(o.length==0)return o;if(t instanceof M){let e=t.start();Er(o,(r,i)=>{if(r.point.equals1(i.point)){if(r.isSameNet&&!i.isSameNet)return-1;if(!r.isSameNet&&i.isSameNet)return 1}return r.point.distance2(e)-i.point.distance2(e)},0,o.length)}else{let e=t.center,r=t.start().sub(e).normalize(),i=t.sweep();Er(o,(n,s)=>{if(n.point.equals1(s.point)){if(n.isSameNet&&!s.isSameNet)return-1;if(!n.isSameNet&&s.isSameNet)return 1}let a=n.point.sub(e).normalize(),l=s.point.sub(e).normalize(),c=ve(r.dot(a),8),h=ve(r.dot(l),8),u=r.cross(a),d=r.cross(l),p=Math.acos(c),m=Math.acos(h);return(i==ae.CCW&&ne.less(u,0)||i==ae.CW&&ne.greater(u,0))&&(p=kr-p),(i==ae.CCW&&ne.less(d,0)||i==ae.CW&&ne.greater(d,0))&&(m=kr-m),p-m},0,o.length)}return o}var b3t=new Rc(.006);function Zie(o,t){return!!(b3t.eq(o.direct.cross(t.sub(o.start())),0)&&o.bbox().extendOfSize(.006).isContains(t))}var ms=class extends cR{constructor(){super(...arguments);this.clearanceUtils=new Kd;this.pair1=new kb;this.pair2=new kb}block(e){return this.blockTrack(e)}check(e){switch(e.modelType){case"Track":case"ArcTrack":return this.drcBlockTrackPrimitive(e);case"Via":return this.drcBlockViaPrimitive(e)}return[]}search(e){return wt.search4Rtree(e)}searchAll(e){return wt.search4All(e)}blockTrack(e){let r=re.getInstance(),i=r.getMaxSafeTrack(e.layerId),n=this.getBBox(e,i),s=this.search(n),a=e.primitive,l=e.width,c=new Array;this.pair1.sycnTrack1(e);let h=[e.layerId],u=[e.layerId,12];for(let d of s){let p=this.clearanceUtils.isHole(d)?u:h;for(let m of p){this.pair2.sycnRule1(d,m==12);let g=r.getSafeClearance(this.pair1.rule1,this.pair2.rule1,e.layerId);if(d instanceof or&&(d.type=="Prohibited Region"||d.type=="Partition")&&(g=1e-4),ne.eq(g,0))continue;let y=uh.check(a,m,e,d,g);if(y.collide){let b=y.inters(a),P=new el(e,b,d,g,void 0,e.layerId,m,y.collideInfo);c.push(P)}}}return R8(c,a),c}blockTrack2(e,r=!1){let n=re.getInstance().getMaxSafeTrack(e.layerId),s=this.getBBox(e,n),a=this.searchAll(s);r&&(a=a.filter(m=>!(m instanceof gt)));let l=e.primitive,c=e.width,h=new Array,u=this.pair1.sycnRule1(e),d=[e.layerId],p=[e.layerId,12];for(let m of a){let g=this.clearanceUtils.isHole(m)?p:d;for(let y of g){let b=this.clearanceUtils.getTrackSafeClearance(u,this.pair2.sycnRule1(m),e,m,e.layerId);if(m instanceof or&&(m.type=="Prohibited Region"||m.type=="Partition")&&(b=1e-4),ne.eq(b,0))continue;let P=uh.check(l,y,e,m,b);if(P.collide){let T=P.inters(l),I=new el(e,T,m,b,void 0,e.layerId,y,P.collideInfo);h.push(I)}}}return h}blockEndpointPrimitive1(e,r){let i=this.clearanceUtils.getMaxTrackClearance(e.layerId),s=(r?e.start:e.end).bbox().extendOfSize(i+e.width/2),a=wt.searchTrack(s),l=new Set,c=this.pair1.sycnRule1(e),h=[e.layerId];for(let u of a.tracks)if(u.net!=e.net&&u!=e){let d=h;for(let p of d){let m=this.clearanceUtils.getSafeClearance(c,this.pair2.sycnTrack1(u),u,p);if(ne.eq(m,0))continue;uh.checkTrackTrackEnd(u.primitive,p,u,e,m,r,!0)&&l.add(u)}}return l}blockEndpointPrimitive(e){let r=this.clearanceUtils.getMaxTrackClearance(),i=new Set;for(let n of e){let s=this.pair1.sycnTrack1(n),a=this.getBBox(n,r),l=wt.searchTrack(a);for(let c of l.checkEnd){if(!a.extendOfSize(c.width/2).isContains(c.end)||n.layerId!=c.layerId)continue;let h=this.clearanceUtils.getSafeClearance(s,this.pair2.sycnTrack1(c),c,n.layerId);if(ne.eq(h,0))continue;if(uh.checkTrackTrackEnd(n.primitive,n.layerId,n,c,h,!1))i.add(c);else if(n.layerId==c.layerId){let p=At.getInstance().getListNode(c).parent;p.otherNode.next instanceof et&&uh.check(n.primitive,n.layerId,n,p.otherNode.next,h).collide&&i.add(c)}}for(let c of l.checkStart){if(!a.extendOfSize(c.width/2).isContains(c.start)||n.layerId!=c.layerId)continue;let h=this.clearanceUtils.getSafeClearance(s,this.pair2.sycnTrack1(c),c,n.layerId);if(ne.eq(h,0))continue;if(uh.checkTrackTrackEnd(n.primitive,n.layerId,n,c,h,!0))i.add(c);else if(n.layerId==c.layerId){let p=At.getInstance().getListNode(c).parent;p.otherNode.prev instanceof et&&uh.check(n.primitive,n.layerId,n,p.otherNode.prev,h).collide&&i.add(c)}}}return i}blockEndpoint(e,r){let i=this.clearanceUtils.getMaxTrackClearance(e.layerId),n=new Set,s=this.getBBox4Primitive(e,r,i),a=wt.searchTrack(s);for(let l of a.checkEnd){if(!s.extendOfSize(l.width/2).isContains(l.end))continue;let c=this.clearanceUtils.getSafeClearance(this.pair1.sycnRule1(e),this.pair2.sycnRule1(l),l,e.layerId);if(ne.eq(c,0))continue;if(uh.checkTrackTrackEnd(r,e.layerId,e,l,c,!1))n.add(l);else if(e.layerId==l.layerId){let d=At.getInstance().getListNode(l).parent;d.otherNode.next instanceof et&&uh.check(r,e.layerId,e,d.otherNode.next,c).collide&&n.add(l)}}for(let l of a.checkStart){if(!s.extendOfSize(l.width/2).isContains(l.start))continue;let c=this.clearanceUtils.getSafeClearance(this.pair1.sycnRule1(e),this.pair2.sycnRule1(l),l,e.layerId);if(ne.eq(c,0))continue;if(uh.checkTrackTrackEnd(r,e.layerId,e,l,c,!0))n.add(l);else if(e.layerId==l.layerId){let d=At.getInstance().getListNode(l).parent;d.otherNode.prev instanceof et&&uh.check(r,e.layerId,e,d.otherNode.prev,c).collide&&n.add(l)}}return n}blockPad(e,r){let i=this.clearanceUtils.getMaxTrackClearance(e.layerId),n=this.getBBox4Primitive(e,r,i),s=wt.searchPad(n);return this.blockTrack4Shapes(e,r,!1,s)}getBBox4Primitive(e,r,i){return r instanceof M?Lc.trackToOctagon(r.start(),r.end(),e.width+i*2):r.bbox().extendOfSize(i+e.width/2)}blockTrackPrimitive(e,r,i,n=!0){let s=this.clearanceUtils.getMaxTrackClearance(e.layerId),a=this.getBBox4Primitive(e,r,s),l=wt.search1(a);return this.blockTrack4Shapes(e,r,i,l,n)}blockTrackOnlyTrack(e,r,i,n=!1){let s=this.clearanceUtils.getMaxTrackClearance(e.layerId),a=this.getBBox4Primitive(e,r,s),l=wt.searchTrack(a);return this.blockTrack4Shapes(e,r,i,l,n)}getBBox(e,r){return e instanceof zr?Lc.trackToOctagon(e.start,e.end,e.width+r*2):e.buildBBox().extendOfSize(r)}blockTrackOther(e,r){let i=this.clearanceUtils.getMaxTrackClearance(e.layerId),n=this.getBBox(e,i),s=wt.searchConnect(n);return s.remove(r),this.blockTrack4Shapes(e,e.primitive,!0,s,!1)}blockTrackInput(e,r){let i=this.clearanceUtils.getMaxTrackClearance(e.layerId),n=this.getBBox(e,i),s=wt.searchInput(n);return s.remove(r),this.blockTrack4Shapes(e,e.primitive,!0,s,!1)}blockTrackOtherObstruct(e,r){let i=this.clearanceUtils.getMaxTrackClearance(e.layerId),n=this.getBBox(e,i),s=wt.search1(n);return s.remove(r),this.blockTrack4ShapesObstruct(e,e.primitive,!1,s,!1)}blockTrack4Shapes(e,r,i,n,s=!0){let a=new Array,l=this.pair1.sycnRule1(e),c=r.bbox().extendOfSize(e.width/2),h=[e.layerId],u=[e.layerId,12],d=new Map,p=pa.getInstance().getErrors(e.globalIndex,r);for(let y of p)d.set(y.obstacle,y);function m(y,b,P){if(ne.eq(b,0))return;let T=d.get(y);if(T!=null&&T.clearance==b&&T.layer2==P){if(T.block.collide){let C=new el(e,T.point,y,b,void 0,e.layerId,P,T.block.collideInfo);C.block=T.block,a.push(C)}return}if(y.buildBBox().extendOfSize(b+e.width/2).isSeparated(r.bbox()))return;let I=uh.check(r,P,e,y,b);if(I.collide){let C=I.inters(r),E=new el(e,C,y,b,void 0,e.layerId,P,I.collideInfo);E.block=I,a.push(E),i&&pa.getInstance().addDrcError(e.globalIndex,r,y.globalIndex,E)}else if(i){let C=new el(e,r.end(),y,b,void 0,e.layerId,P,null);C.block=I,pa.getInstance().addDrcError(e.globalIndex,r,y.globalIndex,C)}}let g=e.layerId;for(let y of n.tracks){if((!i||i&&y!=e)&&s&&y.net==e.net&&y.layerId==e.layerId){let P=new Array,T=y.primitive,I=Pt(r,T),C=!1,E=!1;for(let _=0;_<I;_+=2){let x=new S(Ee[_],Ee[_+1]),v=x.equals1(r.start());C?E=x.equals1(r.end())||x.equals1(T.end()):C=v,!(x.equals1(r.end())&&x.equals1(T.start()))&&(v||P.push(x))}if(C&&E)continue;P.length==0&&r instanceof M&&Zie(r,y.end)&&!y.end.equals1(r.start())&&P.push(y.end);let O=an(P,r);if(O.length>0){let _=O[0],x=new el(e,_,y,0,!0,e.layerId,e.layerId);a.push(x)}continue}if(y==e||y.layerId!=e.layerId)continue;let b=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(y),y,g,c);m(y,b,g)}for(let y of n.vias)if(!(y.net==e.net||!y.isContains(e.layerId)))for(let b of u){let P=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(y,b==12),y,b,c);m(y,P,b)}for(let y of n.pads){if(y.net==e.net||y.layerId!=12&&y.layerId!=e.layerId)continue;let b=this.clearanceUtils.isHole(y)?u:h;for(let P of b){let T=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(y,P==12),y,P,c);m(y,T,P)}}for(let y of n.imageTexts){if(y.layerId!=e.layerId)continue;let b=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(y),y,g,c);m(y,b,g)}for(let y of n.profiles){if(y.layerId!=12&&y.layerId!=1004&&y.layerId!=11&&y.layerId!=e.layerId)continue;let b=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(y),y,g,c);(y.type=="Prohibited Region"||y.type=="Partition")&&(b=1e-4),m(y,b,g)}return R8(a,r),a}blockTrack4ShapesObstruct(e,r,i,n,s=!0){let a=new Array,l=this.pair1.sycnRule1(e),c=[e.layerId],h=[e.layerId,12],u=new Map,d=pa.getInstance().getErrors(e.globalIndex,r);for(let g of d)u.set(g.obstacle,g);function p(g,y,b){if(ne.eq(y,0))return;let P=u.get(g);if(P!=null&&P.clearance==y&&P.layer2==b){if(P.block.collide){let I=new el(e,P.point,g,y,void 0,e.layerId,b,P.block.collideInfo);I.block=P.block,a.push(I)}return}if(g.buildBBox().extendOfSize(y+e.width/2).isSeparated(r.bbox()))return;let T=uh.check(r,b,e,g,y);if(T.collide){let I=T.inters(r),C=new el(e,I,g,y,void 0,e.layerId,b,T.collideInfo);C.block=T,a.push(C),i&&pa.getInstance().addDrcError(e.globalIndex,r,g.globalIndex,C)}else if(i){let I=new el(e,r.end(),g,y,void 0,e.layerId,b,null);I.block=T,pa.getInstance().addDrcError(e.globalIndex,r,g.globalIndex,I)}}let m=e.layerId;for(let g of n.tracks){if((!i||i&&g!=e)&&s&&g.net==e.net&&g.layerId==e.layerId){let b=new Array,P=g.primitive,T=Pt(r,P),I=!1,C=!1;for(let O=0;O<T;O+=2){let _=new S(Ee[O],Ee[O+1]),x=_.equals1(r.start());I?C=_.equals1(r.end())||_.equals1(P.end()):I=x,!(_.equals1(r.end())&&_.equals1(P.start()))&&(x||b.push(_))}if(I&&C)continue;b.length==0&&r instanceof M&&Zie(r,g.end)&&!g.end.equals1(r.start())&&b.push(g.end);let E=an(b,r);if(E.length>0){let O=E[0],_=new el(e,O,g,0,!0,e.layerId,e.layerId);a.push(_)}continue}if(g==e||g.layerId!=e.layerId)continue;let y=this.clearanceUtils.getTrackSafeClearance(l,this.pair2.sycnRule1(g),e,g,m);p(g,y,m)}for(let g of n.vias)if(!(g.net==e.net||!g.isContains(e.layerId)))for(let y of h){let b=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(g,y==12),g,y);p(g,b,y)}for(let g of n.pads){if(g.net==e.net||g.layerId!=12&&g.layerId!=e.layerId)continue;let y=this.clearanceUtils.isHole(g)?h:c;for(let b of y){let P=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(g,b==12),g,b);p(g,P,b)}}for(let g of n.imageTexts){if(g.layerId!=e.layerId)continue;let y=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(g),g,m);p(g,y,m)}for(let g of n.profiles){if(g.layerId!=12&&g.layerId!=1004&&g.layerId!=11&&g.layerId!=e.layerId)continue;let y=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(g),g,m);(g.type=="Prohibited Region"||g.type=="Partition")&&(y=1e-4),p(g,y,m)}return R8(a,r),a}blockOtherTrackOnlyTrack(e){let r=this.clearanceUtils.getMaxTrackClearance(e.layerId),i=this.getBBox(e,r),n=wt.searchTrack(i);return this.blockOtherTrack(e,n)}blockOtherTrack(e,r){let i=new Array,n=this.pair1.sycnRule1(e),s=null;function a(c,h,u){if(ne.eq(h,0))return;s=c.primitive;let d=uh.check(s,u,c,e,h);if(d.collide){let p=d.inters(s),m=new el(c,p,e,h,!1,c.layerId,u,d.collideInfo);m.block=d,i.push(m),pa.getInstance().addDrcError(c.globalIndex,s,e.globalIndex,m)}else{let p=new el(c,s.end(),e,h,!1,c.layerId,u,null);p.block=d,pa.getInstance().addDrcError(c.globalIndex,s,e.globalIndex,p)}}let l=e.layerId;for(let c of r.tracks){if(c==e||c.net==e.net||c.layerId!=e.layerId)continue;let h=this.clearanceUtils.getSafeClearance(n,this.pair2.sycnRule1(c),c,l);a(c,h,l)}return i}checkDRC(e,r){let i=this.clearanceUtils.getSafeClearance(this.pair1.sycnRule1(e),this.pair2.sycnRule1(r),r,e.layerId);return uh.check(e.primitive,e.layerId,e,r,i).collide}checkTrackDRC(e){let r=e.primitive,i=this.clearanceUtils.getMaxTrackClearance(e.layerId),n=this.getBBox(e,i),s=wt.search1(n);return this.checkTrackDRC4Primitive(e,s,r)}checkTrackDRC4Primitive(e,r,i){let n=this.pair1.sycnRule1(e),s=[e.layerId],a=[e.layerId,12],l=new Map,c=pa.getInstance().getErrors(e.globalIndex,i);for(let d of c)l.set(d.obstacle,d);function h(d,p,m){if(ne.eq(p,0))return!1;let g=l.get(d);return g!=null&&g.clearance==p&&g.layer2==m?g.block.collide:uh.check(i,m,e,d,p,"free").collide}let u=e.layerId;for(let d of r.tracks){if(d.net==e.net||d.layerId!=e.layerId)continue;let p=this.clearanceUtils.getSafeClearance(n,this.pair2.sycnRule1(d),d,u);if(h(d,p,u))return!0}for(let d of r.vias)if(!(d.net==e.net||!d.isContains(e.layerId)))for(let p of a){let m=this.clearanceUtils.getSafeClearance(n,this.pair2.sycnRule1(d,p==12),d,p);if(h(d,m,p))return!0}for(let d of r.pads){if(d.net==e.net||d.layerId!=12&&d.layerId!=e.layerId)continue;let p=this.clearanceUtils.isHole(d)?a:s;for(let m of p){let g=this.clearanceUtils.getSafeClearance(n,this.pair2.sycnRule1(d,m==12),d,m);if(h(d,g,m))return!0}}for(let d of r.imageTexts){if(d.layerId!=e.layerId)continue;let p=this.clearanceUtils.getSafeClearance(n,this.pair2.sycnRule1(d),d,u);if(h(d,p,u))return!0}for(let d of r.profiles){if(d.layerId!=12&&d.layerId!=11&&d.layerId!=1004&&d.layerId!=e.layerId)continue;let p=this.clearanceUtils.getSafeClearance(n,this.pair2.sycnRule1(d),d,u);if((d.type=="Prohibited Region"||d.type=="Partition")&&(p=1e-4),h(d,p,u))return!0}return!1}checkDRC4Primitive(e,r){let i=this.clearanceUtils.getMaxTrackClearance(e.layerId),n=this.getBBox4Primitive(e,r,i),s=wt.search1(n);return this.checkTrackDRC4Primitive(e,s,r)}blockTrackPoint(e,r){let i=this.clearanceUtils.getMaxTrackClearance(e.layerId),n=r?e.start:e.end,s=n.bbox().extendOfSize(i+e.width/2),a=wt.search1(s),l=new Array,c=this.pair1.sycnRule1(e),h=[e.layerId],u=[e.layerId,12],d=new M(n,n);function p(g,y,b){if(ne.eq(y,0))return;uh.check(d,b,e,g,y).collide&&l.push(g)}let m=e.layerId;for(let g of a.tracks){if(g.net==e.net||g.layerId!=e.layerId)continue;let y=this.clearanceUtils.getSafeClearance(c,this.pair2.sycnRule1(g),g,m);p(g,y,m)}if(l.length>0)return l;for(let g of a.vias)for(let y of u){let b=this.clearanceUtils.getSafeClearance(c,this.pair2.sycnRule1(g,y==12),g,y);if(p(g,b,y),l.length>0)return l}for(let g of a.pads){let y=this.clearanceUtils.isHole(g)?u:h;for(let b of y){let P=this.clearanceUtils.getSafeClearance(c,this.pair2.sycnRule1(g,b==12),g,b);if(p(g,P,b),l.length>0)return l}}for(let g of a.imageTexts){let y=this.clearanceUtils.getSafeClearance(c,this.pair2.sycnRule1(g),g,m);if(p(g,y,m),l.length>0)return l}for(let g of a.profiles){let y=this.clearanceUtils.getSafeClearance(c,this.pair2.sycnRule1(g),g,m);if((g.type=="Prohibited Region"||g.type=="Partition")&&(y=1e-4),p(g,y,m),l.length>0)return l}return l}blockTrackGraphics(e,r,i,n){let s=this.clearanceUtils.getMaxTrackClearance(e.layerId),a=this.getBBox4Primitive(e,r,s),l=wt.search1(a),c=new Array,h=this.pair1.sycnRule1(e),u=[e.layerId],d=[e.layerId,12],p=new Map,m=pa.getInstance().getErrors(e.globalIndex,r);for(let b of m)p.set(b.obstacle,b);function g(b,P,T){if(ne.eq(P,0))return;let I=!1,C=p.get(b);if(C!=null&&C.clearance==P&&C.layer2==T){if(I=!0,C.block.collide){let O=new el(e,C.point,b,P,void 0,e.layerId,T,C.block.collideInfo);O.block=C.block,c.push(O)}return}let E=uh.check(r,T,e,b,P);if(I&&C.block.collide!=E.collide){debugger;console.log(C)}if(E.collide){let O=E.inters(r),_=new el(e,O,b,P,void 0,e.layerId,T,E.collideInfo);_.block=E,c.push(_),i&&pa.getInstance().addDrcError(e.globalIndex,r,b.globalIndex,_)}else if(i){let O=new el(e,r.end(),b,P,void 0,e.layerId,T,null);O.block=E,pa.getInstance().addDrcError(e.globalIndex,r,b.globalIndex,O)}}let y=e.layerId;for(let b of l.tracks){if(n&&n.includes(b))continue;if((!i||i&&b!=e)&&b.net==e.net&&b.layerId==e.layerId){let T=new Array,I=b.primitive,C=Pt(r,I),E=!1,O=!1;for(let x=0;x<C;x+=2){let v=new S(Ee[x],Ee[x+1]),D=v.equals1(r.start());E?O=v.equals1(r.end())||v.equals1(I.end()):E=D,!(v.equals1(r.end())&&v.equals1(I.start()))&&(D||T.push(v))}if(E&&O)continue;let _=an(T,r);if(_.length>0){let x=_[0],v=new el(e,x,b,0,!0,e.layerId,e.layerId);c.push(v)}continue}if(b==e)continue;let P=this.clearanceUtils.getSafeClearance(h,this.pair2.sycnRule1(b),b,y);g(b,P,y)}for(let b of l.vias)for(let P of d){let T=this.clearanceUtils.getSafeClearance(h,this.pair2.sycnRule1(b,P==12),b,P);g(b,T,P)}for(let b of l.pads){let P=this.clearanceUtils.isHole(b)?d:u;for(let T of P){let I=this.clearanceUtils.getSafeClearance(h,this.pair2.sycnRule1(b,T==12),b,T);g(b,I,T)}}for(let b of l.imageTexts){let P=this.clearanceUtils.getSafeClearance(h,this.pair2.sycnRule1(b),b,y);g(b,P,y)}for(let b of l.profiles){let P=this.clearanceUtils.getSafeClearance(h,this.pair2.sycnRule1(b),b,y);(b.type=="Prohibited Region"||b.type=="Partition")&&(P=1e-4),g(b,P,y)}return R8(c,r),c}drcBlockTrackPrimitive(e){let r=this.clearanceUtils.getMaxTrackClearance(e.layerId),i=this.getBBox(e,r),n=wt.search4Rtree(i).filter(d=>!(d instanceof or&&d.type=="Partition")),s=e.primitive,a=e.width,l=new Array,c=this.pair1.sycnRule1(e),h=[e.layerId],u=[e.layerId,12];for(let d of n){let p=this.clearanceUtils.isHole(d)?u:h;for(let m of p){let g=this.clearanceUtils.getSafeClearance(c,this.pair2.sycnRule1(d,m==12),d,m);if(d instanceof or&&(d.type=="Prohibited Region"||d.type=="Partition")&&(g=1e-4),ne.eq(g,0))continue;let y=uh.check(s,m,e,d,g,"0");if(y.collide){let b=y.inters(s),P=new el(e,b,d,g,void 0,e.layerId,m,y.collideInfo);l.push(P)}}}return R8(l,s),l}checkViasCollides(e,r,i,n){if(e.net==r.net||e.type==1&&r.type==1&&!e.isContains(r.startLayer)&&!e.isContains(r.endLayer))return!1;let s=i.distance1(n),a=[e.startLayer,12],l=0;for(let c of a){let h=this.pair1.sycnRule1(e,c==12),u=c===12?e.holeRadius:e.radius;for(let d of a){let p=this.pair2.sycnRule1(r,d==12),m=this.clearanceUtils.getSafeClearance(h,p,r,d),g=this.clearanceUtils.getSafeClearance(h,p,e,c),y=Math.max(m,g),b=d===12?r.holeRadius:r.radius;l=Math.max(l,y+u+b)}}return s<=l}blockTrack1(e,r){let n=re.getInstance().getMaxSafeTrack(e.layerId),s=this.getBBox4Primitive(e,r,n),a=wt.search1(s),l=this.pair1.sycnRule1(e),c=a.getAll();for(let h of c){let u=this.clearanceUtils.getSafeClearance(l,this.pair2.sycnRule1(h),h,e.layerId);if(h instanceof or&&(h.type=="Prohibited Region"||h.type=="Partition")&&(u=1e-4),ne.eq(u,0))continue;if(uh.check(r,e.layerId,e,h,u).collide)return!0}for(let h of a.checkEnd){if(!s.extendOfSize(h.width/2).isContains(h.end))continue;let u=this.clearanceUtils.getSafeClearance(this.pair1.sycnRule1(e),this.pair2.sycnRule1(h),h,e.layerId);if(ne.eq(u,0))continue;if(uh.checkTrackTrackEnd(r,e.layerId,e,h,u,!1))return!0;if(e.layerId==h.layerId){let m=At.getInstance().getListNode(h).parent;if(m.otherNode.next instanceof et&&uh.check(r,e.layerId,e,m.otherNode.next,u).collide)return!0}}for(let h of a.checkStart){if(!s.extendOfSize(h.width/2).isContains(h.start))continue;let u=this.clearanceUtils.getSafeClearance(this.pair1.sycnRule1(e),this.pair2.sycnRule1(h),h,e.layerId);if(ne.eq(u,0))continue;if(uh.checkTrackTrackEnd(r,e.layerId,e,h,u,!0))return!0;if(e.layerId==h.layerId){let m=At.getInstance().getListNode(h).parent;if(m.otherNode.prev instanceof et&&uh.check(r,e.layerId,e,m.otherNode.prev,u).collide)return!0}}return!1}collideVia(e,r=!1){let n=re.getInstance().getMaxSafe(),s=e.buildBBox().extendOfSize(n),a=wt.searchVia(s,r),l=Ze.getInstance().getAllCopperLayerIds(),c=a.getAll();return this.checkViaCollides(e,c,l)}blockViaPoint(e){let i=re.getInstance().getMaxSafe(),n=e.buildBBox().extendOfSize(i),s=wt.search1(n);return this.blockViaPoint4Shapes(e,s)}blockViaPoint4Shapes(e,r){let i=Ze.getInstance().getAllCopperLayerIds(),n=r.getAll();return this.checkViaCollides(e,n,i)}blockViaPrimitive(e,r){let n=re.getInstance().getMaxSafe(),s=r.bbox().extendOfSize(Math.max(e.radius,e.holeRadius)+n),a=wt.search1(s);return this.blockVia4Shapes(e,r,a)}blockVia4Shapes(e,r,i){let n=new Array,s=this.pair1.sycnRule1(e),a=this.pair1.sycnRule2(e,!0),l=Ze.getInstance().getAllSignalLayerIds(),c=new Map,h=pa.getInstance().getErrors(e.globalIndex,r);for(let d of h)c.set(d.obstacle,d);function u(d,p,m,g){if(ne.eq(p,0))return;let y=c.get(d);if(y!=null&&y.clearance==p&&y.layer2==g){if(y.block.collide){let P=new el(e,y.point,d,p,void 0,m,g,y.block.collideInfo);P.block=y.block,n.push(P)}return}let b=uR.check(r,e,d,p,m,g);if(b.collide){let P=b.inters(r),T=new el(e,P,d,p,void 0,m,g,b.collideInfo);T.block=b,n.push(T),pa.getInstance().addDrcError(e.globalIndex,r,d.globalIndex,T)}else{let P=new el(e,r.end(),d,p,void 0,m,g,null);P.block=b,pa.getInstance().addDrcError(e.globalIndex,r,d.globalIndex,P)}}for(let d of i.tracks){if(d.net==e.net||!e.isContains(d.layerId))continue;let p=this.clearanceUtils.getSafeClearance(s,this.pair2.sycnRule1(d),d,d.layerId),m=this.clearanceUtils.getSafeClearance(a,this.pair2.sycnRule1(d),d,d.layerId);e.radius+p>=e.holeRadius+m?u(d,p,d.layerId,d.layerId):u(d,m,12,d.layerId)}for(let d of i.vias){if(d.net==e.net||e.isSeparated(d))continue;let p=this.pair2.sycnRule1(d),m=this.pair2.sycnRule2(d,!0);for(let g of l)if(e.isContains(g)&&d.isContains(g)){let y=this.clearanceUtils.getSafeClearance(s,p,d,g),b=this.clearanceUtils.getSafeClearance(s,m,d,g),P=this.clearanceUtils.getSafeClearance(a,p,d,g),T=e.radius+y+d.radius,I=e.radius+b+d.holeRadius,C=e.holeRadius+P+d.radius,E=Math.max(T,I,C);E===T?u(d,y,g,g):E===I?u(d,b,g,12):E===C&&u(d,P,12,g);break}}for(let d of i.pads)if(!(d.net==e.net||d.layerId!=12&&!e.isContains(d.layerId)))if(d.layerId==12){let p=this.pair2.sycnRule1(d),m=this.pair2.sycnRule1(d,!0);for(let g of l)if(e.isContains(g)){let y=this.clearanceUtils.getSafeClearance(s,p,d,g),b=this.clearanceUtils.getSafeClearance(a,p,d,g),P=e.radius+y,T=e.holeRadius+b;P>T?u(d,y,g,g):u(d,y,12,g);let I=this.clearanceUtils.getSafeClearance(s,m,d,g);u(d,I,g,12)}}else{let p=this.clearanceUtils.getSafeClearance(s,this.pair2.sycnRule1(d),d,d.layerId),m=this.clearanceUtils.getSafeClearance(a,this.pair2.sycnRule1(d),d,12);e.radius+p>=e.holeRadius+m?u(d,p,d.layerId,d.layerId):u(d,m,12,d.layerId)}for(let d of i.imageTexts){if(!e.isContains(d.layerId))continue;let p=this.clearanceUtils.getSafeClearance(s,this.pair2.sycnRule1(d),d,d.layerId),m=this.clearanceUtils.getSafeClearance(a,this.pair2.sycnRule1(d),d,12);e.radius+p>=e.holeRadius+m?u(d,p,d.layerId,d.layerId):u(d,m,12,d.layerId)}for(let d of i.profiles){if(d.layerId!=12&&d.layerId!=1004&&d.layerId!=11&&!e.isContains(d.layerId))continue;let p=this.clearanceUtils.getSafeClearance(s,this.pair2.sycnRule1(d),d,d.layerId),m=this.clearanceUtils.getSafeClearance(a,this.pair2.sycnRule1(d),d,12);(d.type=="Prohibited Region"||d.type=="Partition")&&(p=1e-4,m=1e-4);let g=Math.max(e.radius,e.holeRadius);g+p>=g+m?u(d,p,d.layerId,d.layerId):u(d,m,12,d.layerId)}return R8(n,r),n}collideViaTrack(e){let i=re.getInstance().getMaxSafe(),n=e.buildBBox().extendOfSize(i),s=wt.searchTrack(n);this.pair1.sycnRule1(e),this.pair1.sycnRule2(e,!0);let a=Ze.getInstance().getAllCopperLayerIds(),l=s.getAll();return this.checkViaCollides(e,l,a)}drcBlockViaPrimitive(e){let r=this.clearanceUtils.getMaxTrackClearance(),i=e.buildBBox().extendOfSize(r),n=this.getViaLayers(e),s=wt.search4Rtree(i).filter(a=>n.includes(a.layerId));return this.pair1.sycnRule1(e),this.pair1.sycnRule2(e,!0),this.checkViaCollides(e,s,n)}checkViaCollides(e,r,i){this.pair1.sycnRule1(e),this.pair1.sycnRule2(e,!0);let n=new Array,s=new M(e.center,e.center);e:for(let a of r){for(let l of i){if(!e.isContains(l))continue;this.pair2.sycnRule1(a);let c=this.clearanceUtils.getSafeClearance(this.pair1.rule1,this.pair2.rule1,a,l);if(a instanceof or&&a.type=="Partition"&&(c=1e-4),ne.eq(c,0))continue;let h=uR.check(s,e,a,c,l,l);if(h.collide){let u=new el(e,e.center,a,c,!1,l,l,h.collideInfo);u.block=h,n.push(u);continue e}}for(let l of i){if(!e.isContains(l))continue;this.pair2.sycnRule1(a);let c=this.clearanceUtils.getSafeClearance(this.pair1.rule2,this.pair2.rule1,a,l);if(a instanceof or&&a.type=="Partition"&&(c=1e-4),ne.eq(c,0))continue;let h=uR.check(s,e,a,c,12,l);if(h.collide){let u=new el(e,e.center,a,c,!1,12,l,h.collideInfo);u.block=h,n.push(u);continue e}}if(this.clearanceUtils.isHole(a))for(let l of i){if(!e.isContains(l))continue;this.pair2.sycnRule1(a,!0);let c=this.clearanceUtils.getSafeClearance(this.pair1.rule1,this.pair2.rule1,a,l);if(a instanceof or&&a.type=="Partition"&&(c=1e-4),ne.eq(c,0))continue;let h=uR.check(s,e,a,c,l,12);if(h.collide){let u=new el(e,e.center,a,c,!1,l,12,h.collideInfo);u.block=h,n.push(u);continue e}}}return n}drcBlockViaPrimitive2(e){let r=this.clearanceUtils.getMaxTrackClearance(),i=e.buildBBox().extendOfSize(r),n=this.getViaLayers(e),s=wt.search1(i).getAll();return this.checkViaCollides(e,s,n)}getViaLayers(e){if(e==null)return[];if(e instanceof Ct&&e.type==0){let r=new Array,i=Pe.getAllLayer();for(let n of i)n.config&&(n.type=="MULTI"||n.type=="TOP"||n.type=="OUTLINE"||n.type=="SIGNAL"||n.type=="BOTTOM")&&r.push(n.layerID);return r}else if(e instanceof Ct&&e.type==1){let r=[11,12],i=Pe.getAllLayer();for(let n of i)(e.isContains(n.layerID)&&n.layerID==12||n.isCopperLayer()||n.layerID==11||n.isInnerLayer())&&r.push(n.layerID);return r}else return[]}drcBlockViaPrimitiveValid(e){let r=this.clearanceUtils.getMaxTrackClearance(),i=e.buildBBox().extendOfSize(r),n=this.getViaLayers(e),s=wt.search4Rtree(i).filter(a=>n.includes(a.layerId));return this.checkViaValid(e,s,n)}checkViaValid(e,r,i){this.pair1.sycnRule1(e),this.pair1.sycnRule2(e,!0);let n=new M(e.center,e.center);for(let s of r){for(let a of i){if(!e.isContains(a))continue;this.pair2.sycnRule1(s);let l=this.clearanceUtils.getSafeClearance(this.pair1.rule1,this.pair2.rule1,s,a);if(s instanceof or&&s.type=="Partition"&&(l=1e-4),ne.eq(l,0))continue;let c=uR.check(n,e,s,l,a,a);if(c.collide){let h=new el(e,e.center,s,l,!1,a,a,c.collideInfo);return h.block=c,!1}}for(let a of i){if(!e.isContains(a))continue;this.pair2.sycnRule1(s);let l=this.clearanceUtils.getSafeClearance(this.pair1.rule2,this.pair2.rule1,s,a);if(s instanceof or&&s.type=="Partition"&&(l=1e-4),ne.eq(l,0))continue;let c=uR.check(n,e,s,l,12,a);if(c.collide){let h=new el(e,e.center,s,l,!1,12,a,c.collideInfo);return h.block=c,!1}}if(this.clearanceUtils.isHole(s))for(let a of i){if(!e.isContains(a))continue;this.pair2.sycnRule1(s,!0);let l=this.clearanceUtils.getSafeClearance(this.pair1.rule1,this.pair2.rule1,s,a);if(s instanceof or&&s.type=="Partition"&&(l=1e-4),ne.eq(l,0))continue;let c=uR.check(n,e,s,l,a,12);if(c.collide){let h=new el(e,e.center,s,l,!1,a,12,c.collideInfo);return h.block=c,!1}}}return!0}};var _Ve=Array();for(let o=-1;o<=1;o++)for(let t=-1;t<=1;t++)o==0&&t==0||_Ve.push(new S(o,t).normalize());var U4=class{constructor(t,e,r,i){this.valid=!0;this.pushItems=new Set;this._point=t,this.dir=e,this._dis=r,this.needContinue=i}get point(){return this._point}get dis(){return this._dis}set dis(t){this._dis=t}setNewPoint(t){this._dis+=this.point.distance1(t),this._point=t}setObstacle(t,e,r){this.needContinue=r,this.intersection(t,e)}intersection(t,e){if(e!=null){let r=new _e;r.ext2(this.point).ext1(e.bbox());let i=r.build1(),n=new M(this.point,this.point.add(this.dir.mul(i.width()+i.height()+10)));for(let s of e.primitives){let a=Pt(n,s);for(let l=0;l<a;l+=2){let c=new S(Ee[l],Ee[l+1]);t.contains(c)||(this._dis+=this.point.distance1(c),this._point=c,t.add(c))}}}}};function gj(o){let t=new Set;for(let e of _Ve){let r=new U4(o,e,0,!0);t.add(r)}return t}var D8=class{constructor(t,e,r){this.valid=new Set;this.minDistance=3;this.result=null;this.found=new Ta;this.timeout=0;this.find=e,this.findRes=r,this.start=new U4(t,S.ORIGIN,0,!0)}setFail(){this.result!=null&&(this.result.valid=!1,this.result=null)}init(){if(this.start.valid){let t=this.find(this.start.point);if(t==null)this.result=this.start;else{this.start.valid=!1;let e=gj(this.start.point);for(let r of e)r.intersection(this.found,t.pl),this.valid.add(r)}}else if(this.valid.size==0){let t=gj(this.start.point);for(let e of t)e.valid=!1,this.valid.add(e)}}getDistination(t=10){if(this.init(),this.result!=null){let r=this.find(this.result.point);if(r==null)return this.result.point;this.result.setObstacle(this.found,r.pl,r.continue),this.result=null}let e=new Array;for(let r of this.valid)r.valid&&e.push(r);for(this.timeout=performance.now()+t;performance.now()<this.timeout;){this.result!=null&&this.result.needContinue&&e.push(this.result),e=e.sort((r,i)=>r.dis-i.dis),e.length>0&&(this.minDistance=e[0].dis);for(let r of this.valid){if(r.valid)continue;let i=r.point.add(r.dir.mul(this.minDistance-r.dis+1)),n=this.findRes(i,r.point);n!=null?(r.setNewPoint(n),r.valid=!0,e.push(r)):r.setNewPoint(i)}for(let r=0;r<e.length;r++){let i=e[r],n=this.find(i.point);n!=null?i.setObstacle(this.found,n.pl,n.continue):i.needContinue&&(this.result=i,e.splice(r,e.length-r))}if(e.length==0)return this.result!=null?this.result.point:this.start.point}return this.start.point}};var H4=class H4{constructor(){this.startMap=new Map;this.endMap=new Map;this.centerMap=new Map;this.lastSearch=null}static getInstance(){return H4.manager==null&&(H4.manager=new H4),H4.manager}getStartPoint(t,e,r){return this.lastSearch=this.startMap.get(t.globalIndex),this.lastSearch==null&&(this.lastSearch=new D8(t.start,e,r),this.startMap.set(t.globalIndex,this.lastSearch)),this.lastSearch.find=e,this.lastSearch.findRes=r,this.lastSearch}getEndPoint(t,e,r){return this.lastSearch=this.endMap.get(t.globalIndex),this.lastSearch==null&&(this.lastSearch=new D8(t.end,e,r),this.endMap.set(t.globalIndex,this.lastSearch)),this.lastSearch.find=e,this.lastSearch.findRes=r,this.lastSearch}getCenterPoint(t,e,r,i){return this.lastSearch=this.centerMap.get(t.globalIndex),this.lastSearch==null&&(this.lastSearch=new D8(e,r,i),this.centerMap.set(t.globalIndex,this.lastSearch)),this.lastSearch.find=r,this.lastSearch.findRes=i,this.lastSearch}checkTrack(t,e){e?(this.lastSearch=this.startMap.get(t.globalIndex),this.lastSearch!=null&&this.lastSearch.result!=null&&this.lastSearch.result.point.equals1(t.start)&&this.startMap.delete(t.globalIndex)):(this.lastSearch=this.endMap.get(t.globalIndex),this.lastSearch!=null&&this.lastSearch.result!=null&&this.lastSearch.result.point.equals1(t.end)&&this.endMap.delete(t.globalIndex))}setFail(t){let e=t.getLast(),r=this.endMap.get(e.globalIndex);r!=null&&r.setFail()}clear(){this.startMap.clear(),this.endMap.clear(),this.centerMap.clear()}};H4.manager=null;var PS=H4;var Jie=class{constructor(t,e){this.manager=fs.getInstance();this.clearanceUtils=new Kd;this.block=new ms;this.track=t,this.command=e}offset(){let e=PS.getInstance().getEndPoint(this.track,this.find.bind(this),this.findRes.bind(this)).getDistination();if(!e.equals1(this.track.end)){let r=At.getInstance().getNode(this.track),i=new Zr,n=r.parent,s=this.track.primitive;if(s instanceof M&&Da(e,s.start(),s.end(),1e-4)){let a=i.createTrack(this.track.layerId,this.track.start,e,this.track.width,this.track.net,this.command,this.track.getGroupID()),l=i.createList(),c=i.addFirst(a,l,this.command),h=n.getLastNode(),u=Mr.getInstance().getStatus(h).clone();Mr.getInstance().setStatus(c,u),l.replace(h,h),this.command.addCommand(new mi(l))}else{let a=i.createTrack(this.track.layerId,this.track.end,e,this.track.width,this.track.net,this.command,this.track.getGroupID());i.addList(a,n,this.command)}}}offsetStart(){let e=PS.getInstance().getStartPoint(this.track,this.find.bind(this),this.findRes.bind(this)).getDistination();if(!e.equals1(this.track.start)){let r=new Zr,n=At.getInstance().getNode(this.track).parent,s=this.track.primitive;if(s instanceof M&&Da(e,s.start(),s.end(),1e-4)){let a=r.createTrack(this.track.layerId,e,this.track.end,this.track.width,this.track.net,this.command,this.track.getGroupID()),l=r.createList(),c=r.addFirst(a,l,this.command),h=n.getFirstNode(),u=Mr.getInstance().getStatus(h).clone();Mr.getInstance().setStatus(c,u),l.replace(h,h),this.command.addCommand(new mi(l))}else{let a=r.createTrack(this.track.layerId,e,this.track.start,this.track.width,this.track.net,this.command,this.track.getGroupID());r.addFirst(a,n,this.command)}}}find(t){let r=re.getInstance().getMaxSafe(),i=this.track.width/2,n=t.bbox().extendOfSize(i+r),s=wt.search1(n),a=ha(this.track),l=this.track.layerId;for(let c of s.tracks)if(c.layerId==l&&c.net!=this.track.net){let h=ha(c),u=this.clearanceUtils.getSafeClearance(a,h,c,c.layerId);if(ne.eq(u,0))continue;let p=this.manager.getModelObstacle(c,u+i,c.layerId).outline.getPointInOutline(t,ls);if(p!=null)return{pl:p,continue:!0}}for(let c of s.pads)if(c.net!=this.track.net&&(c.layerId==l||c.layerId==12)){let h=ha(c);if(!c.isUnuseLayer(l)){let u=this.clearanceUtils.getSafeClearance(a,h,c,this.track.layerId);if(ne.eq(u,0))continue;let p=this.manager.getModelObstacle(c,u+i,l).outline.getPointInOutline(t,ls);if(p!=null)return{pl:p,continue:!0}}if(c.layerId==12){h.shapeType=12;let u=this.clearanceUtils.getSafeClearance(a,h,c,this.track.layerId);if(ne.eq(u,0))continue;let p=this.manager.getModelObstacle(c,u+i,c.layerId).outline.getPointInOutline(t,ls);if(p!=null)return{pl:p,continue:!0}}}for(let c of s.vias)if(c.net!=this.track.net&&c.isContains(l)){let h=ha(c);if(!c.isUnuseLayer(l)){let u=this.clearanceUtils.getSafeClearance(a,h,c,this.track.layerId);if(ne.eq(u,0))continue;let p=this.manager.getModelObstacle(c,u+i,l).outline.getPointInOutline(t,ls);if(p!=null)return{pl:p,continue:!0}}if(c.layerId==12){h.shapeType=12;let u=this.clearanceUtils.getSafeClearance(a,h,c,this.track.layerId);if(ne.eq(u,0))continue;let p=this.manager.getModelObstacle(c,u+i,c.layerId).outline.getPointInOutline(t,ls);if(p!=null)return{pl:p,continue:!0}}}for(let c of s.profiles)switch(c.type){case"TearDrop":case"Fill Region":{let u=c.net!=this.track.net,d=c.component;if(d instanceof Zi&&d.isBridgingCopper){let p=d.networkList;p.length==0&&this.track.net==""||p.length==1&&this.track.net==p[0]?u=!1:u=!0}if(c.layerId==l&&u){let p=ha(c),m=this.clearanceUtils.getSafeClearance(a,p,c,this.track.layerId);if(ne.eq(m,0))continue;let y=this.manager.getModelObstacle(c,m+i,c.layerId).outline.getPointInOutline(t,ls);if(y!=null)return{pl:y,continue:!0}}break}case"Slot Region":{let u=ha(c),d=this.clearanceUtils.getSafeClearance(a,u,c,this.track.layerId);if(ne.eq(d,0))continue;let m=this.manager.getModelObstacle(c,d+i,c.layerId).outline.getPointInOutline(t,ls);if(m!=null)return{pl:m,continue:!0};break}case"Line":{if(c.layerId==l&&c.net!=this.track.net||c.layerId==11){let u=ha(c),d=this.clearanceUtils.getSafeClearance(a,u,c,this.track.layerId);if(ne.eq(d,0))continue;let m=this.manager.getModelObstacle(c,d+i,c.layerId).outline.getPointInOutline(t,ls);if(m!=null)return{pl:m,continue:c.layerId!=11}}break}case"Board Outline":{let u=ha(c),d=this.clearanceUtils.getSafeClearance(a,u,c,this.track.layerId);if(ne.eq(d,0))continue;let m=this.manager.getModelObstacle(c,d+i,c.layerId).outline.getPointInOutline(t,ls);if(m!=null)return{pl:m,continue:!1};break}case"Prohibited Region":{if(c.layerId==l||c.layerId==12){let u=c.component,d=1e-4;if(u.track){let m=this.manager.getModelObstacle(c,i+d,c.layerId).outline.getPointInOutline(t,ls);if(m!=null)return{pl:m,continue:!0}}}break}}for(let c of s.imageTexts)if(c.layerId==l){let h=ha(c),u=this.clearanceUtils.getSafeClearance(a,h,c,this.track.layerId);if(ne.eq(u,0))continue;let p=this.manager.getModelObstacle(c,u+i,c.layerId).outline.getPointInOutline(t,ls);if(p!=null)return{pl:p,continue:!0}}return null}findRes(t,e){let r=new M(t,e),i=this.block.blockTrackPrimitive(this.track,r,!1);return i.length>0?i[0].point:null}};function Qie(){return{minDistance:Number.POSITIVE_INFINITY,start:null,end:null}}var Eu=class o{static getMinDistanceWithoutCross(t,e){let r=Qie();return o.minLine(t,e,r),r.minDistance}static getMinDistance(t,e){return Pt(t,e)?0:this.getMinDistanceWithoutCross(t,e)}static getMinLineWithCross(t,e){let r=Qie();return o.minLine(t,e,r),new M(r.start,r.end)}static getMinLine(t,e){return o.intersection(t,e)||this.getMinLineWithCross(t,e)}static getMinDistanceFromPoint(t,e){let r=Qie();if(e instanceof M)this.point2LineMinLine(r,e,t);else if(e instanceof q)this.point2ArcMinDistance(t,e,r);else throw new Error("not support");return r.minDistance}constructor(t,e){if(this.pt1=t,this.pt2=e,this.minline=o.intersection(t,e),this.minline)this.minDistance=0;else{let r=Qie();o.minLine(t,e,r),this.minline=new M(r.start,r.end),this.minDistance=r.minDistance}}getDistance(){return this.minDistance}getLine(){return this.minline}static intersection(t,e){let r=Pt(t,e);if(r===0)return;let i=new Array;for(let n=0;n<r;n+=2){let s=new S(Ee[n],Ee[n+1]);i.push(s)}return i.length>1?new M(i[0],i[1]):new M(i[0],i[0])}static minLine(t,e,r){if(t instanceof M&&e instanceof M)return this.minDistanceForLines(t,e,r);if(t instanceof q&&e instanceof M)return this.minDistanceForLineAndArc(t,e,r);if(t instanceof M&&e instanceof q)return this.minDistanceForLineAndArc(e,t,r);if(t instanceof q&&e instanceof q)return this.minDistanceForArcs(t,e,r);throw new Error("not support")}static minDistanceForLines(t,e,r){[t.start(),t.end(),e.start(),e.end()].forEach((i,n)=>{n<2?this.point2LineMinLine(r,e,i):this.point2LineMinLine(r,t,i)})}static minDistanceForLineAndArc(t,e,r){this.point2LineMinLine(r,e,t.start()),this.point2LineMinLine(r,e,t.svgEnd);let i=o.foot(e,t.center);e.bbox().extendOfSize(1e-8).isContains(i)&&this.point2ArcMinLine(r,t,i),this.point2ArcMinLine(r,t,e.start()),this.point2ArcMinLine(r,t,e.end())}static minDistanceForArcs(t,e,r){this.concentricArc(t,e,r),this.point2ArcMinDistance(e.start(),t,r),this.point2ArcMinDistance(e.svgEnd,t,r),this.point2ArcMinDistance(t.start(),e,r),this.point2ArcMinDistance(t.svgEnd,e,r),($f(t,e.center)||$f(e,t.center))&&this.shortestLineForArcs(t,e,r)}static minLineForArcAndLine(t,e,r){let i=t.pointOn(r.angleD(t.center)),n=t.pointOn(t.center.angleD(r));this.arcShortestLine(t,e,r,i),this.arcShortestLine(t,e,r,n)}static arcInnerLineFootSegment(t,e,r){let i=r.distance1(t.center);if(i!==0){let n=t.rx*(r.y-t.center.y)/i+t.center.y,s=t.rx*(r.x-t.center.x)/i+t.center.x;i=t.rx-i,i<e.minDistance&&(e.minDistance=i,e.start=new S(s,n),e.end=r)}else i=t.rx-i,i<e.minDistance&&(e.minDistance=i,e.start=t.start(),e.end=r)}static shortestLineForArcs(t,e,r){let i=t.center.angleD(e.center),n=e.center.angleD(t.center),s=t.pointOn(i),a=t.pointOn(n),l=e.pointOn(i),c=e.pointOn(n);$f(t,s)&&(this.arcShortestLine(e,r,s,l),this.arcShortestLine(e,r,s,c)),$f(t,a)&&(this.arcShortestLine(e,r,a,l),this.arcShortestLine(e,r,a,c)),this.shortestLineForArcs1(t,e,r)}static shortestLineForArcs1(t,e,r){let i=e.start().sub(t.center).normalize(),n=e.end().sub(t.center).normalize(),s=t.start().sub(e.center).normalize(),a=t.end().sub(e.center).normalize(),l=t.center.add(i.mul(t.rx)),c=t.center.add(n.mul(t.rx)),h=e.center.add(s.mul(e.rx)),u=e.center.add(a.mul(e.rx));$f(t,l)&&ne.greater(e.start().distance2(t.center),0)&&this.arcShortestLine(t,r,e.start(),l),$f(t,c)&&ne.greater(e.end().distance2(t.center),0)&&this.arcShortestLine(t,r,e.end(),c),$f(e,h)&&ne.greater(t.start().distance2(e.center),0)&&this.arcShortestLine(e,r,t.start(),h),$f(e,u)&&ne.greater(t.end().distance2(e.center),0)&&this.arcShortestLine(e,r,t.end(),u)}static concentricArc(t,e,r){if(!(t.center.distance1(e.center)<1e-5&&t.rx===e.rx&&t.ry===e.ry))return;let i=t.start().distance1(e.svgEnd);i<r.minDistance&&(r.minDistance=i,r.start=t.start(),r.end=e.svgEnd),i=e.start().distance1(t.svgEnd),i<r.minDistance&&(r.minDistance=i,r.start=e.start(),r.end=t.svgEnd)}static point2ArcMinDistance(t,e,r){if($f(e,t)){let i=e.pointOn(t.angleD(e.center)),n=e.pointOn(e.center.angleD(t));this.arcShortestLine(e,r,t,i),this.arcShortestLine(e,r,t,n)}else this.minLineSegment(r,e.start(),t),this.minLineSegment(r,e.svgEnd,t)}static point2ArcMinLine(t,e,r){if($f(e,r)){let i=r.distance1(e.center);i>e.rx||i>e.ry?this.minLineForArcAndLine(e,t,r):this.arcInnerLineFootSegment(e,t,r)}}static point2LineMinLine(t,e,r){let i=o.foot(e,r);e.bbox().extendOfSize(1e-8).isContains(i)?this.minLineSegment(t,i,r):(this.minLineSegment(t,e.start(),r),this.minLineSegment(t,e.end(),r))}static minLineSegment(t,e,r){let i=e.distance1(r);i<t.minDistance&&(t.minDistance=i,t.start=e,t.end=r)}static arcShortestLine(t,e,r,i){if(!$f(t,i))return;let n=r.distance1(i);n<e.minDistance&&(e.minDistance=n,e.start=r,e.end=i)}static foot(t,e){if(t.isPoint())return t.start();if(!ne.eq(t.b,0)&&!ne.eq(t.a,0)){let r=(t.b*t.b*e.x-t.a*t.b*e.y-t.a*t.c)/(t.b*t.b+t.a*t.a),i=(-t.a*t.b*e.x+t.a*t.a*e.y-t.b*t.c)/(t.b*t.b+t.a*t.a);return new S(r,i)}else return ne.eq(t.b,0)&&!ne.eq(t.a,0)?new S(t.start().x,e.y):!ne.eq(t.b,0)&&ne.eq(t.a,0)?new S(e.x,t.start().y):e}};function $f(o,t){if(ne.eq(o.sweepAngle,360))return!0;let e=zt.regularD(t.angleD(o.center));return o.sweepAngle>0?(ne.less(e,o.startAngle)&&(e+=360),ne.greatereq(o.endAngle(),e)):(ne.greater(e,o.startAngle)&&(e-=360),ne.lesseq(o.endAngle(),e))}var ene=class{constructor(t,e){this.point=t,this.model=e}},w8=class extends j9{constructor(){super(...arguments);this.points=new Array}},tne=class extends Tn{addLast(t){return this.first===null||this.last===null?(this.first=new w8(this,t),this.last=this.first,this.cnt=1,this.first):this.insertAfter(this.last,t)}addFirst(t){if(this.first===null||this.last===null){let e=new w8(this,t);return this.first=e,this.last=e,this.cnt++,e}else return this.insertBefore(this.first,t)}insertAfter(t,e){let r=new w8(this,e);return t.insertAfter(r),t===this.last&&(this.last=r),this.cnt++,r}insertBefore(t,e){let r=new w8(this,e);return t.insertBefore(r),t===this.first&&(this.first=r),this.cnt++,r}};var W4=class W4{constructor(){this.map=new Map;this.ptMap=new Map}static getInstance(){return W4.manager==null&&(W4.manager=new W4),W4.manager}getList(t){let e=this.map.get(t);if(e==null){let r=t.getMathGraphics();e=new tne;for(let i of r.primitives){let n=e.add(i);this.ptMap.set(i,n)}this.map.set(t,e)}return e}getNode(t){return this.ptMap.get(t)}clear(){this.map.clear(),this.ptMap.clear()}};W4.manager=null;var n0=W4;var L8=class{};var Ly=class o{constructor(t,e,r,i,n,s=null){this.signalLayers=new Set;this.state=new L8;this.signalLayers=t,this.layerId=e,this.point=r,this.direct=i,this.allowModifyDirect=n,this.model=s}clone(){return new o(new Set(Array.from(this.signalLayers)),this.layerId,this.point,this.direct,this.allowModifyDirect,this.model)}};var rne=class o{constructor(t,e,r,i,n,s,a){this.previous=null;this.next=null;this.drawing=0;this.isReverse=!1;this.startAlignMap=new Map;this.alignMap=new Map;this.net=t,this.width=e,this.layerId=r,this.direct=i,this.start=n,this.end=s,this.isReverse=a}clone(){let t=this.start.clone(),e=this.end.clone(),r=new o(this.net,this.width,this.layerId,this.direct,t,e,this.isReverse);return r.drawing=this.drawing,r}get fanout(){return this.drawing==0}};var yj=class o{constructor(t,e,r=null){this.parent=null;this.change=null;this.hasChanged=!1;this.fix=!1;this.diffpairChangeCache=null;this.direct=t,this.point=e,this.model=r}reverse(){this.direct=this.direct.mul(-1)}getNext(t){let e=new o(this.direct,t);return e.change=this.hasChanged?null:this.change,e.parent=this,e}getSameDirect(t){let e=this.point.add(this.direct.mul(t));return this.getNext(e)}getChangeNode(){if(this.change==null)return this;if(this.change.delta>0){let t=this.point.add(this.change.direct.mul(this.change.delta)),e=this.getNext(t);return e.hasChanged=!0,this.clearParentChange(),e.getSameDirect(this.change.delta)}else{let t=this.point.add(this.change.direct.mul(this.change.delta)),e=this.getNext(t);return e.hasChanged=!0,this.clearParentChange(),e}}getFanoutNode(t=0){if(this.change==null)return this;let e=Math.abs(this.change.delta),r=this.change.delta/e,i=this.point.add(this.change.direct.mul(r*(e+t))),n=this.getNext(i);return n.hasChanged=!0,this.clearParentChange(),n}markChangeForDiffpair(){this.change&&(this.diffpairChangeCache=this.change,this.change=null)}restoreChangeForDiffpair(){this.diffpairChangeCache&&(this.change=this.diffpairChangeCache,this.diffpairChangeCache=null)}clearParentChange(){let t=this;for(;t.parent!=null;)t.parent.change=null,t=t.parent}connect(){let t=new Array;t.push(this);let e=this;for(;e.parent!=null;)e=e.parent,t.push(e);return t.reverse()}clone(){return new o(this.direct,this.point)}};var M8=class o{constructor(t,e){this.restrainViaSize=!1;this.config=t,this.viaPosition=(t==null?void 0:t.viaPosition)||"currentInflectionPoint",this.radius=(t==null?void 0:t.radius)||1.2,this.inner=(t==null?void 0:t.innerRadius)||.6,this.viaName=e||""}clone(){let t=new o(this.config,this.viaName);return!this.config.radius&&this.radius&&(t.radius=this.radius),!this.config.innerRadius&&this.inner&&(t.inner=this.inner),t.restrainViaSize=!!this.restrainViaSize,t}};var v0=class o{constructor(t,e,r,i,n,s=new M8){this.previous=null;this.next=null;this.start=null;this.end=null;this.drawing=0;this.isReverse=!1;this.startAlignMap=new Map;this.alignMap=new Map;this.net=t,this.width=e,this.layerId=r,this.direct=i,this.allowModifyNet=n,this.via=s,this.preWidth=e}clone(){let t=new o(this.net,this.width,this.layerId,this.direct,this.allowModifyNet,this.via.clone());return t.drawing=this.drawing,t}getCornerNode(){let t=new yj(this.start.direct,this.start.point,this.start.model),e=new yj(this.end.direct.mul(-1),this.end.point,this.end.model),r=new rne(this.net,this.width,this.layerId,this.direct,t,e,this.isReverse);return this.preWidth&&(r.preWidth=this.preWidth),r.drawing=this.drawing,r}};var My=class extends L8{constructor(t,e){super(),this.state=t,this.isStart=e}};var bj=new Xn,ine=class{constructor(t){this.res=new Array;this.node=t,this.fanout=t.fanoutInfo}optimize(t,e){let r=this.previous!=null,i=this.next!=null;r&&i?this.optimize1(t,e):r&&!i?this.optimize2(t,e):!r&&i&&this.optimize3(t,e)}optimize1(t,e){let r=Math.abs(this.previous.fanout.delta)+Math.abs(this.next.fanout.delta),i=this.node.item.length;if(r<i){let h=bj.degree45(this.previous.fanout.direct,this.previous.node.item.start,this.node.item.end);this.res.push(h[0],h[1]);let u=bj.degree45(this.node.item.direct,h[1],this.next.node.item.end);this.res.push(...u)}else{let h=bj.degree45(this.previous.fanout.direct,this.previous.node.item.start,this.next.node.item.end);this.res.push(...h)}let n=new Zr,s=this.res,a=s[0],l=s[0];i=s.length;let c=At.getInstance().createList();for(let h=1;h<i;h++)if(l=s[h],a.distance2(l)>1e-8){let u=n.createTrack(t.layerId,a,l,this.node.item.width,t.net,e);n.addList(u,c,e),a=l}c.size()>0&&(c.replace(this.previous.node,this.next.node),e.addCommand(new mi(c)))}optimize2(t,e){let r=bj.degree45(this.previous.fanout.direct,this.previous.node.item.start,this.node.item.end);this.res.push(...r);let i=new Zr,n=this.res,s=n[0],a=n[0];length=n.length;let l=At.getInstance().createList();for(let c=1;c<length;c++)if(a=n[c],s.distance2(a)>1e-8){let h=i.createTrack(t.layerId,s,a,this.node.item.width,t.net,e);i.addList(h,l,e),s=a}l.size()>0&&(l.replace(this.previous.node,this.node),e.addCommand(new mi(l)))}optimize3(t,e){let r=bj.degree45(this.node.item.direct,this.node.item.start,this.next.node.item.end);this.res.push(...r);let i=new Zr,n=this.res,s=n[0],a=n[0];length=n.length;let l=At.getInstance().createList();for(let c=1;c<length;c++)if(a=n[c],s.distance2(a)>1e-8){let h=i.createTrack(t.layerId,s,a,this.node.item.width,t.net,e);i.addList(h,l,e),s=a}l.size()>0&&(l.replace(this.node,this.next.node),e.addCommand(new mi(l)))}},x3=class{optimization(t,e,r){let i=t.listIterator(),n=new Array;for(;i.hasNext();){let l=i.next(),c=new ine(l);n.push(c)}let s=new Array,a=n.length;for(let l=0;l<a;l++){let c=n[l].fanout;c!=null?c.delta>0?l+1<a&&(n[l+1].previous=n[l]):c.delta==0?s.push(n[l]):l-1>=0&&(n[l-1].next=n[l]):s.push(n[l])}for(let l of s)l.optimize(e,r)}optimizaNodes(t,e,r){let i=new Array;for(let a of t){let l=new ine(a);i.push(l)}let n=new Array,s=i.length;for(let a=0;a<s;a++){let l=i[a].fanout;l!=null?l.delta>0?a+1<s&&(i[a+1].previous=i[a]):l.delta==0?n.push(i[a]):a-1>=0&&(i[a-1].next=i[a]):n.push(i[a])}for(let a of n)a.optimize(e,r)}};var bA=class o{constructor(t){this.stack=new Array;this.group=0;this.i=0;this.debug=!0;this.pause=!1;this.item=null;this.group=t}add(t){if(this.debug){if(this.item!=null){let e=this.stack.length;if(!t.equals(this.item.stack[e]))debugger}this.stack.push(t)}}play(){this.isEnd()&&(this.i=0),this.stack[this.i].display(),he.publish("updateFrame",""),this.i++}setCompateItem(t){this.item=t}isStart(){return this.i==0}isEnd(){return this.i==this.stack.length}init(){for(let t of this.stack)t.remove();this.i=0}clear(){for(let t of this.stack)t.remove();he.publish("updateFrame","")}equals(t){if(t instanceof o&&this.stack.length==t.stack.length){let e=this.stack.length;for(let r=0;r<e;r++)if(!this.stack[r].equals(t.stack[r]))return!1;return!0}return!1}};var dh=class{display(){}remove(){}};var Cd=class o extends dh{constructor(t){super(),this.line2=t}display(){for(let t of this.line2)t.display();he.publish("updateFrame","")}remove(){for(let t of this.line2)t.remove()}equals(t){if(t instanceof o){let e=t.line2.length;if(this.line2.length==e){for(let r=0;r<e;r++)if(!this.line2[r].equals(t.line2[r]))return!1;return!0}}return!1}};var N8=class{constructor(t,e=16){this.point=t,this.size=e}isSelect(t,e){let r=this.point,i=this.size;return new _e().ext6(r.x,r.y).ext7(i/2).build1().isIntersect(new ht(t,t,e,e))}isSelectScale(t,e,r){let i=this.point,n=this.size;return new _e().ext6(i.x,i.y).ext7(n/2/r).build1().extendOfSize(1/r).isIntersect(new ht(t,t,e,e))}};var Ui=class extends K9{constructor(e,r,i=!1,n=ee.build(.28,1.8,.3,1)){super();this._select=!1;this.viewGroupId="";this.globalIndex=Lh(),this._layerId=e,this._point=r,this._isTriangle=i,this._color=n,this._state="Only Main",this.shapeModified=!0,this.colorModified=!0,this.refreshRender()}get shapeModified(){return this.hasDataState(5)}set shapeModified(e){this.setDataState(5,e)}get color(){return this._color}set color(e){var r;(r=this._color)!=null&&r.equals(e)||(this._color=e,this.colorModified=!0,this.refreshRender())}get x(){return this._point.x}get y(){return this._point.y}get layerId(){return this._layerId}get position(){return this._point}get isTriangle(){return this._isTriangle}get highLightType(){return null}get highlightColor(){return ee.BLACK}get colorModified(){return this.hasDataState(7)}set colorModified(e){this.setDataState(7,e)}getType(){return 31}refreshRender(){Mo.attach(this,this.getType())}getViewState(){return this._state}getRenderData(){return this}get manualHighLight(){return R.getInstance().forceDeactive}remove(){this._state="Not Shown",this.shapeModified=!0,this.refreshRender()}hidden(){this._state="Not Shown",this.shapeModified=!0,this.refreshRender()}visible(){this._state="Only Main",this.shapeModified=!0,this.refreshRender()}click(){this._state="Main And Highlight",this.shapeModified=!0,this.refreshRender()}setPosition(e){var r;return(r=this._point)!=null&&r.equals(e)||(this._point=e,this.shapeModified=!0,this.refreshRender()),this}getPosition(){return this._point}status(){return this._select}setStatus(e){this._select=!1}transform(e){this.setPosition(this._point.multiply4(e))}isSelect(e,r){let i=Ai().getScale(),n=new N8(this._point);return this._select=n.isSelectScale(e,r,i)}isSelectWidth(e,r,i){let n=new S(e,r),s=Ai().getScale(),a=new N8(this._point);return this._select=this._point.distance2(n)<=i*i/4||a.isSelectScale(e,r,s)}getDistance(e,r){let i=new S(e,r);return this._point.distance2(i)}inTop(e,r){let i=Ai().getScale();return new N8(this._point).isSelectScale(e,r,i)}resetModelNotify(){this._dataState=0}};var gs=class o{constructor(t,e,r,i,n,s,a){this.globalIndex=Lh();this.state="Only Main";this._color=null;this.viewGroupId="";this._color=a,this._layerId=t,this._center=e,this._radius=r,this._startAngle=i,this._endAngle=n,this._sweep=s,this.refreshRender()}static build(t,e,r,i,n,s,a=ee.BLACK){return new o(t,e,r,i,n,s,a)}get layerId(){return this._layerId}set layerId(t){this._layerId=t,this.refreshRender()}get center(){return this._center}set center(t){this._center=t,this.refreshRender()}get radius(){return this._radius}set radius(t){this._radius=t,this.refreshRender()}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=t,this.refreshRender()}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=t,this.refreshRender()}get sweep(){return this._sweep}set sweep(t){this._sweep=t,this.refreshRender()}get isSolid(){return this._isSolid}set isSolid(t){this._isSolid!=t&&(this._isSolid=!0,this.refreshRender())}get color(){return this._color}set color(t){this._color=t,this.refreshRender()}get width(){return 0}set width(t){}get length(){return Math.abs(this.radius*(this.endAngle-this.startAngle)*Math.PI/Math.PI)}get isEmpty(){return!1}get start(){return this.center.add(new S(Math.cos(this.startAngle),Math.sin(this.startAngle)).mul(this.radius))}set start(t){this._startAngle=zM.fixStartAngle(t.angle(this.center),this.radius,this.endAngle,this.sweep),this.refreshRender()}get end(){return this.center.add(new S(Math.cos(this.endAngle),Math.sin(this.endAngle)).mul(this.radius))}set end(t){this._endAngle=zM.fixEndAngle(t.angle(this.center),this.radius,this.startAngle,this.sweep),this.refreshRender()}visible(){this.state="Only Main",this.refreshRender()}click(){this.state="Main And Highlight",this.refreshRender()}remove(){this.state="Not Shown",this.refreshRender()}getType(){return 33}refreshRender(){Mo.attach(this,this.getType())}getViewState(){return this.state}getRenderData(){var d,p;let t=(p=(d=le)==null?void 0:d.themeConfig)==null?void 0:p.canvasTheme,e=ee.BLACK;if(t){let m=t.hoverHighlightColor,g=t.hoverHighlightTransparency;e=ee.build(m.r,m.g,m.b,1-g)}let{layerId:r,center:i,radius:n,startAngle:s,endAngle:a,sweep:l,width:c,length:h,color:u}=this;return{layerId:r,center:i,radius:n,startAngle:s,endAngle:a,sweep:l,width:c,length:h,color:u,modelType:"Arc",layerModified:!0,shapeModified:!0,highLightByHover:!1,highLightBySelect:!1,isHighLight:!1,lineColor:u,lineSolid:!0,isPixel:!1,highLightType:null,highlightColor:e}}getMathGraphics(){return q.build2(this.center,this.startAngle,this.endAngle,this.radius,this.radius,this.sweep).stroke(this.width,wr.ROUND,ae.CW)}hidden(){this.state="Not Shown",this.refreshRender()}buildBBox(){return q.build2(this.center,this.startAngle,this.endAngle,this.radius,this.radius,this.sweep).bbox()}getAngle(){return this.sweep==ae.CCW?(this.endAngle-this.startAngle+Wd)%Wd:(this.startAngle-this.endAngle+Wd)%Wd}};var Gn=class o extends dh{constructor(e,r){super();this.color=null;this.layerId=1002;this.shapes=new Array;this.line=e,this.info=r,this.color=r.color,this.layerId=1002}display(){if(this.line instanceof q){let e=gs.build(this.layerId,this.line.center,this.line.rx,Xh(this.line.startAngle),Xh(this.line.endAngle()),this.line.sweep(),this.color||ee.BLACK),r=Et(this.line),i=this.line.end().sub(r.rotate(S.ORIGIN,zh/4).mul(1.5)),n=new cr(this.layerId,this.line.end(),i,!0,this.color||ee.BLACK);this.shapes.push(e,n);return}if(this.line.isPoint())this.shapes.push(new Ui(this.layerId,this.line.start(),null,this.color||ee.BLACK));else{let e=new cr(this.layerId,this.line.start(),this.line.end(),!1,this.color||ee.BLACK),r=this.line.end().sub(this.line.direct.rotate(S.ORIGIN,zh/4).mul(1.5)),i=new cr(this.layerId,this.line.end(),r,!0,this.color||ee.BLACK);this.shapes.push(e,i)}}remove(){for(let e of this.shapes)e.remove();this.shapes.length=0}equals(e){return e instanceof o?this.line.equals1(e.line):!1}};var dR=class o extends Ue{constructor(e,r){super(e);this.isBase=!0;super.color=r,this.sendDeleteMsg=!1}static build(e,r,i,n,s,a){let l=new hg(Lh(),0,"",1,2,[],"",r,e,i,2,n,s,!1);return new o(l,a)}get color(){return super.color}set color(e){super.color=e,this.refreshRender()}get net(){return this.model.net}set net(e){this.model.net!=e&&(this.model.net=e,this.refreshRender())}setBBoxModify(){}setLayerModify(e){}};var nne=class extends dh{constructor(e,r,i){super();this.color=null;this.layerId=1002;this.shapes=new Array;this.center=e,this.radius=r,this.info=i,this.color=i.color,this.layerId=1002}display(){this.shapes.push(dR.build(this.center,this.radius,this.radius/2,0,0,this.color||ee.BLACK))}remove(){for(let e of this.shapes)e.remove();this.shapes.length=0}};var PA=class extends dh{constructor(e,r){super();this.vias=new Array;this.line2=new Array;this.radius=e,this.info=r}addCenter(e){let r=new nne(e,this.radius,this.info);this.vias.push(r)}display(){let e=null;for(let r of this.vias){if(e!=null){let i=new Gn(new M(e.center,r.center),this.info);this.line2.push(i),i.display()}r.display(),e=r}he.publish("updateFrame","")}remove(){for(let e of this.vias)e.remove();for(let e of this.line2)e.remove()}};var FCe=class{constructor(){this.stack=new Array;this.cloneStack=new Array;this.compare=!1;this.debugs=new Array;this.debugs1=new Array;this.lines=[];this.action="print";this.timeout=0;this.i=0;this.position=null;this.replay=!1;this.debug=!0;this.pause=!1;this.single=!1;this.level="STRONG";this.resultIndex=0}setLevel(t){switch(t){case 0:{this.level="NONE";break}case 1:{this.level="WEAK";break}case 2:{this.level="STRONG";break}case 3:{this.level="SUPER";break}}}init(){this.clear(),this.stack.length=0,this.lines.length=0,this.action="print",this.timeout=0,this.i=0,this.resultIndex=0}setCompare(){this.compare=!0,this.cloneStack=this.stack,this.stack=[]}setPosition(t,e){this.position=new S(t,e)}input(t){if(this.debug){if(this.compare&&t instanceof bA){let e=this.stack.length;t.setCompateItem(this.cloneStack[e])}this.stack.push(t)}}inputDebugGraphics(t){if(this.debug){if(this.compare&&t instanceof Cd){let e=this.stack.length;if(!t.equals(this.cloneStack[e]))debugger}this.stack.push(t)}}inputGraphics(t,e){this.debug&&this.stack.push({primitive:t,net:e})}inputAction(t,e){this.debug&&this.stack.push({action:t,timeout:e})}inputClear(){if(this.debug){let t=this.stack[this.stack.length-1];if(t!=null&&t.action!=null&&t.action=="clear")return;this.inputAction("clear",100)}}compareDisplay(t){this.compare&&(this.display(t),this.displayClone(t))}play(){return;for(let i=0;i<t;i++){let n=this.stack[i];switch(n.action!=null&&(e=n.action,r=n.timeout),e){case"await":{this.await(r);break}case"clear":{this.clear();break}case"print":{n.primitive!=null&&this.displayPrimitive(n.primitive,n.net);break}}}}play4Next(){if(this.single)return;let t=this.stack[this.i];if(t instanceof bA){t.isStart()&&this.debugs.push(t),t.play(),t.isEnd()&&this.i++;return}switch(t.action!=null?(this.action=t.action,this.timeout=t.timeout):this.action="print",this.action){case"await":{this.await(this.timeout);break}case"clear":{this.clear();break}case"print":{t instanceof dh?(t.display(),this.debugs1.push(t)):t.primitive!=null&&this.displayPrimitive(t.primitive,t.net);break}}this.i++,this.i>=this.stack.length&&(this.i=0,this.clear()),he.publish("updateFrame","")}displayPrimitive(t,e){let r=Bb([t],2);for(let i of r)this.lines.push({l:i,net:e})}await(t){let e=performance.now()+t;for(;performance.now()<e;);}clearAction(){console.log("await clear")}clear(){for(let t of this.lines)t.l.remove();this.lines.length=0;for(let t of this.debugs)t.clear();this.debugs.length=0;for(let t of this.debugs1)t.remove();this.debugs1.length=0}singlePause(){this.pause=!0,this.single=!0}exitPause(){this.pause=!1,this.single=!1}display(t){let e=this.stack[t];if(e instanceof bA){e.isStart()&&this.debugs.push(e),e.play();return}switch(e.action!=null?(this.action=e.action,this.timeout=e.timeout):this.action="print",this.action){case"await":{this.await(this.timeout);break}case"clear":{this.clear();break}case"print":{e instanceof dh?(e.display(),this.debugs1.push(e)):e.primitive!=null&&this.displayPrimitive(e.primitive,e.net);break}}he.publish("updateFrame","")}displayClone(t){let e=this.cloneStack[t];if(e instanceof bA){e.isStart()&&this.debugs.push(e),e.play();return}switch(e.action!=null?(this.action=e.action,this.timeout=e.timeout):this.action="print",this.action){case"await":{this.await(this.timeout);break}case"clear":{this.clear();break}case"print":{e instanceof dh?(e.display(),this.debugs1.push(e)):e.primitive!=null&&this.displayPrimitive(e.primitive,e.net);break}}he.publish("updateFrame","")}displayRange(t,e,r=3){for(let i=t;i<=e;i+=r)this.display(i)}next(){for(;this.resultIndex<this.stack.length;this.resultIndex++){let t=this.stack[this.resultIndex];if(t instanceof Cd||t instanceof PA){this.display(this.resultIndex),this.resultIndex++;break}}this.resultIndex>=this.stack.length&&(this.resultIndex=0)}prev(){for(;this.resultIndex>0;this.resultIndex--){let t=this.stack[this.resultIndex];if(t instanceof Cd||t instanceof PA){this.display(this.resultIndex),this.resultIndex--;break}}this.resultIndex<0&&(this.resultIndex=0)}},Gr=new FCe;Window.ShoveDebug=Gr;var k8=class o extends dh{constructor(e,r,i){super();this.result=new Array;this.shapes=new Array;this.line1=e,this.line2=r,this.result=i}display(){this.line1.display();for(let e of this.line2)e.display();for(let e of this.result)this.shapes.push(new Ui(1002,e,!0))}remove(){this.line1.remove();for(let e of this.line2)e.remove();for(let e of this.shapes)e.remove();this.shapes.length=0}equals(e){if(e instanceof o&&this.line2.length==e.line2.length&&this.line1.equals(e.line1)){let r=this.line2.length;for(let i=0;i<r;i++)if(!this.line2[i].equals(e.line2[i]))return!1;return!0}return!1}};var one=class extends cR{constructor(){super(...arguments);this.manager1=n0.getInstance()}check(e,r,i,n){let s=e.primitive,a=this.manager1.getList(r),l=n;if(Gr.debug){let c=new Gn(s,{color:ee.BLUE}),h=new Array,u=a.iterator();for(;u.hasNext();){let d=u.next(),p=new Gn(new M(d.start(),d.end()),{color:ee.Gray});h.push(p)}if(this.debug1!=null){let d=new k8(c,h,[]);this.debug1.add(d)}}return this.collideConstraint(s,e,a,l)}collideConstraint(e,r,i,n){let s=e,a=s.bbox(),l=i.listIterator();for(;l.hasNext();){let c=l.next(),h=c.item;if(h instanceof M&&h.length()<1e-8)continue;let u=h.bbox().extendOfSize(n);if(!a.isIntersect(u))continue;let d=s.bbox(),p=h.bbox();d.isIntersect(p)&&this.collidePrimitve(s,c,r)}}collidePrimitve(e,r,i){let n=r.item,s=e.bbox(),a=n.bbox();if(!s.isIntersect(a))return;let l=Pt(e,n);for(let c=0;c<l;c+=2){let h=new S(Ee[c],Ee[c+1]),u=new ene(h,i);r.points.push(u)}}};var sne=class extends hR{constructor(){super(...arguments);this.manager1=n0.getInstance()}check(e,r,i,n,s=!1){if(i.layerId!=r.layerId&&s&&i.layerId!=12)return!1;let a=this.manager1.getList(i),l=r.width/2+n;return!!this.checkPrimitives(e,a.toArray(),l)}checkPrimitives(e,r,i){if(r==null)return!1;let n=e.bbox().extendOfSize(i);for(let s of r){if(s instanceof M&&s.length()<1e-8)continue;let a=s.bbox();if(n.isIntersect(a)){let l=new er(e,s).getDistance();if(this.kit.less(l,i))return!0}}return!1}};var ane=class{constructor(t){this.check=new sne;this.block=new one;this.utils=new Kd;this.debug=t}search1(t){let e=[],r=kt.search4Types(t,["Polygon","Rect","Circle"]);for(let i of r.getResult(Kp)){let n=i.model;n instanceof or&&n.type=="Constraint Region"&&e.push(n)}return e}blockTrack(t,e){this.block.debug1=this.debug;let r=e.bbox().extendOfSize(0),i=this.search1(r),n=new Set;for(let s of i){if(!this.utils.isValid4Model(t,s))continue;this.check.check(e,t,s,0,!0)&&(this.block.check(t,s,t.layerId,0),n.add(s))}return Array.from(n)}blockTrackProfile(t,e,r){this.block.debug1=this.debug,this.check.check(e,t,r,0)&&this.block.check(t,r,t.layerId,0)}};var _I=class o{constructor(t,e,r,i,n){this.lastDirect=t,this.start=e,this.end=r,this.width=i,this.nextDirect=n}static build(t,e){return new o(t.start.direct,t.start.point,e,t.width,t.direct)}static build1(t,e,r){return new o(t.direct,t.point,r,e.width,e.direct)}static build2(t,e){return new o(t.start.direct,t.start.point,e,t.width,t.direct)}modifyStart(t){return new o(this.lastDirect,t,this.end,this.width,this.nextDirect)}modifyEnd(t){return new o(this.lastDirect,this.start,t,this.width,this.nextDirect)}modifyNextDirect(t){return new o(this.lastDirect,this.start,this.end,this.width,t)}};function oT(o,t,e){let r=e.sub(t),n=o.cross(r)>0?ae.CCW:ae.CW,s=o.dot(r)>0,a=Math.abs(o.cross(r));return{sweep:n,isRight:s,dis:a}}function vI(o,t,e){let r=fg(e,t),i=o+r*2,n=t*2;return{delta:r,edgeLength:i,dis2:n,min:o,angle:e}}var TA=class o{constructor(t,e,r){this.node=e,this.edgeParam=r,this.directInfo=t}static build(t,e,r,i,n){let s=oT(t.start.direct,t.start.point,e),a=vI(n,i,r/2),l=_I.build(t,e);return new o(l,s,a)}static build1(t,e,r,i){let n=oT(t.lastDirect,t.start,t.end),s=vI(i,r,e/2);return new o(t,n,s)}modifyStart(t){this.directInfo=this.directInfo.modifyStart(t),this.node=oT(this.directInfo.lastDirect,this.directInfo.start,this.directInfo.end)}modifyEnd(t){this.directInfo=this.directInfo.modifyEnd(t),this.node=oT(this.directInfo.lastDirect,this.directInfo.start,t)}modifyMin(t){this.edgeParam=vI(t,this.edgeParam.dis2/2,this.edgeParam.angle)}modifyNextDirect(t){this.directInfo=this.directInfo.modifyNextDirect(t)}clone(t,e,r){let i=oT(this.directInfo.lastDirect,t,e),n=vI(this.edgeParam.min,r,this.edgeParam.angle),s=new _I(this.directInfo.lastDirect,t,e,this.directInfo.width,this.directInfo.nextDirect);return new o(s,i,n)}},Fb=class o{constructor(t,e,r){this.node=e,this.edgeParam=r,this.directInfo=t}static build1(t,e,r,i){let n=oT(t.start.direct,t.start.point,t.end.point),s=vI(i,r,e/2);return new o(t,n,s)}static build2(t,e,r,i){let n=oT(t.end.direct,t.end.point,t.start.point),s=vI(i,r,e/2);return new o(t,n,s)}};var x0=class o{constructor(){this.tool=new Xn}alignAngle(t,e,r,i=null,n=0,s){let a=n||Ys.getInstance().trackMinCorner*t.width||.01;switch(i){case 45:{let l=this.tool.degree45(t.nextDirect,t.start,t.end);return this.align(t,e,r,a,l,s)}case 90:{let l=this.tool.degree90(t.nextDirect,t.start,t.end);return this.align(t,e,r,a,l)}default:return this.align(t,e,r,a,[t.start,t.end])}}align(t,e,r,i,n,s){if(ne.eq(t.end.sub(t.start).cross(t.lastDirect),0)&&e===Math.PI/2){let O=t.end,_=[t.start,t.end],x=oT(t.lastDirect,O,t.end),v=vI(i,r,e/2),D=new _I(t.lastDirect,O,t.end,t.width,t.lastDirect),w=new TA(D,x,v);return{path:_,tool:w}}let a=t.lastDirect,l=t.nextDirect,c=zs(l,n),u=(a.angle(S.ORIGIN)+Math.PI*2)%(Math.PI*2)/e,d=Math.round(u)*e,p=S.getVector2(d);if(ne.greatereq(a.dot(p),1))return{path:[],tool:TA.build1(t,e,r,i)};let m=Math.floor(u)*e,g=Math.ceil(u)*e,y=S.getVector2(m),b=S.getVector2(g),P=Math.acos(c[0].dot(y)),T=Math.acos(c[0].dot(b)),I=y;P>T&&(I=b);let C=a.dot(I),E=Math.acos(C)/2;if(ne.eq(E,0))return{path:[],tool:TA.build1(t,e,r,i)};{if(s){let z=ACe(a,I);r=s(z)}let O=fg(E,r),_=t.start.add(a.mul(O)),x=_.add(I.mul(O+i)),v=[t.start,_,x],D=oT(I,x,t.end),w=vI(i,r,e/2),F=new _I(I,x,t.end,t.width,t.nextDirect),H=new TA(F,D,w);return{path:v,tool:H}}}alignAngle_v1(t,e,r,i,n=null,s){switch(n){case 45:{let a=this.tool.degree45(t.direct,t.start.point,t.end.point);return this.align_v1(t,e,r,i,a,s)}case 90:{let a=this.tool.degree90(t.direct,t.start.point,t.end.point);return this.align_v1(t,e,r,i,a)}default:return this.align_v1(t,e,r,i,[t.start.point,t.end.point])}}alignAngle_v2(t,e,r,i,n=null){switch(n){case 45:{let s=this.tool.degree45(t.direct,t.end.point,t.start.point);return this.align_v2(t,e,r,i,s)}case 90:{let s=this.tool.degree90(t.direct,t.end.point,t.start.point);return this.align_v2(t,e,r,i,s)}default:return this.align_v2(t,e,r,i,[t.start.point,t.end.point])}}align_v1(t,e,r,i,n,s){if(ne.eq(t.end.point.sub(t.start.point).cross(t.start.direct),0)&&e===Math.PI/2){let O=t.start.getNext(t.end.point);O.direct=t.start.direct,t.start=O;let _=oT(t.start.direct,t.end.point,t.end.point),x=vI(i,r,e/2);return new Fb(t,_,x)}let a=t.start.direct,l=t.direct,c=zs(l,n),u=(a.angle(S.ORIGIN)+Math.PI*2)%(Math.PI*2)/e,d=Math.round(u)*e,p=S.getVector2(d);if(ne.greatereq(a.dot(p),1)){if(t.end.point.equals1(t.start.point)){let O=t.start.getNext(t.end.point);O.direct=l,t.start=O}return Fb.build1(t,e,r,i)}let m=Math.floor(u)*e,g=Math.ceil(u)*e,y=S.getVector2(m),b=S.getVector2(g),P=Math.acos(c[0].dot(y)),T=Math.acos(c[0].dot(b)),I=y;P>T&&(I=b);let C=a.dot(I),E=Math.acos(C)/2;if(ne.eq(E,0))return Fb.build1(t,e,r,i);{if(s){let z=ACe(a,I);r=s(z)}let O=fg(E,r),_=t.start.point.add(a.mul(O)),x=_.add(I.mul(O+i)),D=t.start.getNext(_).getNext(x);D.direct=I,t.start=D;let w=oT(I,x,t.end.point),F=vI(i,r,e/2);return new Fb(t,w,F)}}align_v2(t,e,r,i,n){if(t.end.point.equals1(t.start.point)&&e===Math.PI/2)return Fb.build2(t,e,r,i);let s=t.end.direct,a=t.direct,l=zs(a,n),h=(s.angle(S.ORIGIN)+Math.PI*2)%(Math.PI*2)/e,u=Math.round(h)*e,d=S.getVector2(u);if(ne.greatereq(s.dot(d),1))return Fb.build2(t,e,r,i);let p=Math.floor(h)*e,m=Math.ceil(h)*e,g=S.getVector2(p),y=S.getVector2(m),b=Math.acos(l[0].dot(g)),P=Math.acos(l[0].dot(y)),T=g;b>P&&(T=y);let I=s.dot(T),C=Math.acos(I)/2;if(ne.eq(C,0))return Fb.build2(t,e,r,i);{let E=fg(C,r),O=t.end.point.add(s.mul(E)),_=O.add(T.mul(E+i)),v=t.end.getNext(O).getNext(_);v.direct=T,t.end=v;let D=oT(T,_,t.start.point),w=vI(i,r,e/2);return new Fb(t,D,w)}}static alignStart(t){let e=t.node,r=e.start.point,i=e.start.direct;i=new S(i.y,-i.x);let n=e.previous,s=e.next,a=e,l=e,c=0,h=0;for(;n!=null||s!=null;)n!=null&&(c=c-(a.width/2+n.width+n.previous.width/2),a=n.previous,n=a.previous,a.start.isEmpty||(a.start.point=r.add(i.mul(c)))),s!=null&&(h=h+(l.width/2+s.width+s.next.width/2),l=s.next,s=l.next,l.start.isEmpty||(l.start.point=r.add(i.mul(h))))}static fixEnd(t,e,r,i){let n=t.tracks.length,s=o.getDistance(t),a=o.getDistance(e),l=Math.floor(n/2),c=t.tracks.indexOf(t.node),h;return c>=l?h=new S(i.y,-i.x):h=new S(-i.y,i.x),r.add(h.mul(a-s))}static getDistance(t,e=t.node){let r=t.tracks.length,i=Math.floor(r/2),n=t.tracks.indexOf(e);if(r%2==0)if(n>=i){let s=t.tracks[i].previous.width/2+t.tracks[i].width;for(let a=i+1;a<=n;a++){let l=t.tracks[a];s+=l.previous.width,s+=l.width}return s-=e.width/2,s}else{let s=t.tracks[i-1].next.width/2+t.tracks[i-1].width;for(let a=i-2;a>=n;a--){let l=t.tracks[a];s+=l.next.width,s+=l.width}return s-=e.width/2,s}else if(n>=i){let s=t.tracks[i].width/2;for(let a=i+1;a<=n;a++){let l=t.tracks[a];s+=l.previous.width,s+=l.width}return s-=e.width/2,s}else{let s=t.tracks[i].width/2;for(let a=i-1;a>=n;a--){let l=t.tracks[a];s+=l.next.width,s+=l.width}return s-=e.width/2,s}}static alignEnd(t,e=!0){let r=t.node,i=e?r.end.point:r.start.point,n=e?r.end.direct:r.start.direct;n=new S(n.y,-n.x);let s=r.previous,a=r.next,l=r,c=r,h=0,u=0;for(;s!=null||a!=null;)s!=null&&(h=h-(l.width/2+s.width+s.previous.width/2),l=s.previous,s=l.previous,e?l.end.point=i.add(n.mul(h)):l.start.point=i.add(n.mul(h))),a!=null&&(u=u+(c.width/2+a.width+a.next.width/2),c=a.next,a=c.next,e?c.end.point=i.add(n.mul(u)):c.start.point=i.add(n.mul(u)))}static project4Direct(t){let e=t.tracks.length,r=Math.floor(e/2);if(e%2===0){let i=t.tracks[r-1].end.point.add(t.tracks[r].end.point).mul(.5),n=t.tracks[r-1].width/2+t.tracks[r-1].next.width/2,s=t.tracks[r-1].end.direct;t.tracks[r-1].end.isEmpty&&(t.tracks[r-1].end.point=i.add(new S(s.y,-s.x).mul(n))),t.node=t.tracks[r-1]}else t.node=t.tracks[r]}static isAlign(t,e=!1,r){let i;if(r)i=r;else{let s=Number.MIN_SAFE_INTEGER;for(let a of t){let l=e?a.start:a.end,c=l.point.dot(l.direct);c>=s&&(s=c,i=l.point)}}let n=0;for(let s=0;s<t.length;s++){let a=t[s],l=e?a.start:a.end,h=i.sub(l.point).dot(l.direct);ne.eq(h,0)&&n++}return r&&n++,n==t.length}static alignPoints(t,e=!1,r){let i;if(r)i=r;else{let n=Number.MIN_SAFE_INTEGER;for(let s of t){let a=e?s.start:s.end,l=a.point.dot(a.direct);l>=n&&(n=l,i=a.point)}}for(let n=0,s=t.length;n<s;n++){let a=t[n],l=e?a.start:a.end,h=i.sub(l.point).dot(l.direct);ne.greater(h,0)&&(l.point=l.point.add(l.direct.mul(h)))}}};var B8=class o extends dh{constructor(e,r,i){super();this.result=new Array;this.shapes=new Array;this.line1=e,this.line2=r;for(let n=0;n<i;n+=2)this.result.push(new S(Ee[n],Ee[n+1]))}display(){this.line1.display(),this.line2.display();for(let e of this.result)this.shapes.push(new Ui(1002,e))}remove(){this.line1.remove(),this.line2.remove();for(let e of this.shapes)e.remove();this.shapes.length=0}equals(e){return e instanceof o?this.line1.equals(e.line1)&&this.line2.equals(e.line2):!1}};var lne=class{constructor(t){this.selections=new Array;this.start=t,this.layerId=Ze.getInstance().activeLayer,this.createBox(this.layerId,t.x,t.y)}moveTo(t,e){this.layerId!==Ze.getInstance().activeLayer&&(this.clear(),this.layerId=Ze.getInstance().activeLayer,this.createBox(this.layerId,t,e)),this.selections[0].start=new S(this.start.x,this.start.y),this.selections[0].end=new S(t,this.start.y),this.selections[1].start=new S(t,this.start.y),this.selections[1].end=new S(t,e),this.selections[2].start=new S(t,e),this.selections[2].end=new S(this.start.x,e),this.selections[3].start=new S(this.start.x,e),this.selections[3].end=new S(this.start.x,this.start.y)}clear(){for(let t of this.selections)t.remove();this.selections.length=0}createBox(t,e,r){let i=new cr(t,new S(this.start.x,this.start.y),new S(e,this.start.y),!1),n=new cr(t,new S(e,this.start.y),new S(e,r),!1),s=new cr(t,new S(e,r),new S(this.start.x,r),!1),a=new cr(t,new S(this.start.x,r),new S(this.start.x,this.start.y),!1);this.selections.push(i),this.selections.push(n),this.selections.push(s),this.selections.push(a)}};var xI=class o{constructor(t){this.previous=null;this.next=null;this.width=t,this.preWidth=t}clone(){return new o(this.width)}};var IA=class{constructor(t){this.needComplete=(t,e)=>{let r=e.map(l=>l instanceof gt?l.end:l instanceof Ct||l instanceof et?l.center:null).filter(Boolean),i=r[0],s=r[1].sub(i).normalize(),a=.1;for(let l=2;l<r.length;l++){let h=r[l].sub(i);if(Math.abs(s.cross(h))>a)return!0}return!1};this.event=t}sortVectors(t){if(t.length<=1)return t;let e=(n,s)=>s.some(a=>a.equals(n)),r=[],i=t[0];r.push(i);for(let n=1;n<t.length;n++)e(t[n],r)||(r.push(t[n]),i=t[n]);return r}getRoutes(t){let e=Rn.getInstance();if(t.lastMode=="Single wiring"&&t.wire!=="Single wiring"){let r=[],i=e.current.tracks,n=this.alignEnd(e.current.node),s=this.sortVectors(e.getSingleEvents().flatMap(l=>[l.start,l.end])),a=ge.build4(s);for(let l=0;l<i.length;l++){let c=i[l];if(c!==e.current.node){let[h,u]=n.get(c),d=ge.build7(this.getPath(c.end.point,h,a.primitives,u));r.push(d)}else a&&r.push(a)}return r}}getStartRoutes(t,e,r){var a;let i=e.start.model,n=[i.primitive];if(!r){let l=Array.from((a=pr.getItem(i.globalIndex))==null?void 0:a.searchAllConnectNode1());l.length>0&&(n=l.flatMap(c=>$l.getInstance().has(c.globalIndex)?null:c.primitive).filter(Boolean))}let s=[];for(let l of t){let c=l.start.model,h;if(c instanceof gt?h=c.end:h=c.center,l!==e){let u;if(r){let d=c.primitive,p=er.foot(new M(d.start(),d.end()),n[0].start()),m=this.getPath(p,n[0].end(),n).flatMap(g=>g.points(.1));m.unshift(h,p),u=ge.build4(m)}else u=ge.build7(this.getPath(h,i.end,n));s.push(u)}else s.push(ge.build4([h,h]))}return s}getDiffStartRoutes(){let t=this.event.node,e=this.event.tracks.find(a=>a!==this.event.node),r=t.start.point,i=e.start.point,n=t.width+this.event.gaps[0].width,s=(a,l)=>{let c=[];if(a.length&&l.length)for(let h of this.event.tracks){if(h==t){c.push(ge.build7(a));continue}c.push(ge.build7(l))}return c};if(ne.greater(r.distance1(i),n)){let a=t.start.model,l=e.start.model;if(a instanceof zr&&l instanceof zr){let c=At.getInstance().getListNode(a).parent.getAllItems().map(g=>g.primitive),h=At.getInstance().getListNode(l).parent.getAllItems().map(g=>g.primitive);if(Math.abs(r.distance1(i)-n)<.001)return;let u=this.getPath(r,i,h,n),d=this.getPath(i,r,c,n),p=u.length,m=d.length;if(p>0&&m>0){let g=u[p-1].end(),y=d[m-1].end();if(g.distance2(i)>y.distance2(r)){let b=s(c,d),P=Et(d[d.length-1])||e.start.direct;return[b,P]}}}}}getPls(t,e,r=!1){let i=[],n=e.getPoints(1).length>0;for(let s of t.tracks){let a;if(s==t.node&&n){n&&i.push(e);continue}r?a=[s.start.point,s.start.point.add(s.start.direct.mul(1e-8))]:a=[s.end.point,s.end.point.add(t.node.direct.mul(1e-8))],a.length>0&&i.push(ge.build4(a))}return i}checkIsSingle(t){let e=t.result.wireMap;return e.size==1?!0:t.tracks.every(r=>r==t.node?!0:e.get(r).size()==0)}getPath(t,e,r,i){return r.length==0?[]:new Zl(t,e,r,i).result}getInnerDistance1(t,e,r){let i=r.sub(e.start).normalize(),s=e.lastDirect.cross(i)>0?ae.CCW:ae.CW;return this.calInnerDistance(t,s)}calInnerDistance(t,e){if(e==ae.CCW){let r=0,i=t.previous;for(;i!=null;)r+=i.width+t.width/2+i.previous.width/2,t=i.previous,i=t.previous;return r}else{let r=0,i=t.next;for(;i!=null;)r+=i.width+t.width/2+i.next.width/2,t=i.next,i=t.next;return r}}alignEnd(t,e=!0){let r=new Map,i=e?t.end.point:t.start.point,n=e?t.end.direct:t.start.direct;n=new S(n.y,-n.x);let s=t.previous,a=t.next,l=t,c=t,h=0,u=0;for(r.set(t,[t.end.point,0]);s!=null||a!=null;)s!=null&&(h=h-(l.width/2+s.width+s.previous.width/2),l=s.previous,s=l.previous,r.set(l,[i.add(n.mul(h)),h])),a!=null&&(u=u+(c.width/2+a.width+a.next.width/2),c=a.next,a=c.next,r.set(c,[i.add(n.mul(u)),u]));return r}};function cne(o){let t=Et(o[0].primitive);for(let e=0;e<o.length;e++){let r=o[e],i=Et(r.primitive);if(!t.equals1(i))return!1}return!0}function z4(o){if(!Array.isArray(o)||o.length===0)return;let t=new Map,e,r=0;return o.forEach(i=>{let n=t.get(i)||0;t.set(i,n+1),n+1>r&&(e=i,r=n+1)}),e}function vVe(o){if(!Array.isArray(o)||o.length===0)return;if(o.length==2){let i=o[0],n=o[1];if(Math.abs(i.dot(n))<1e-5)return i.add(n).normalize()}let t=new Map,e,r=0;return o.forEach(i=>{let n=t.get(i)||0;t.set(i,n+1),n+1>r&&(e=i,r=n+1)}),e}function VCe(o,t=!0){if(o){let e=[],r=[];o.forEach(s=>{var c;let l=new Jt().getItem((c=s.start.model)==null?void 0:c.globalIndex);r.push({info:s,item:l,project:0}),l&&e.push(l)}),r=sT.sort(r);let i=r.map(s=>s.info),n=[];for(let s=0;s<i.length-1;s++){let a=i[s],l=i[s+1],c=re.getInstance().getNet(a.net);if(c!=null&&c.netDifferential!=null&&re.getInstance().getNet(l.net).netDifferential==c.netDifferential){let y=Ts(a.start.point,a.layerId),b=Ts(l.start.point,a.layerId),P=Vb(y,a.net,l.net,a.layerId),T=Vb(b,a.net,l.net,a.layerId),I=Math.max(P,T,0);if(I)n.push(new xI(I));else{let C=re.getInstance().getDifferentialPhysicsByNet(a.net);n.push(new xI(C.getDifferentialPairSpacingDefault(a.layerId)))}continue}let h=a.start.point,u=a.start.direct,d=l.start.point,p=Math.abs(d.sub(h).cross(u)),m=(a.width+l.width)/2;n.push(new xI(p-m))}sT.linked(i,n),Rn.getInstance().current.modifySort(i,n,t)}}var Y4=class Y4{constructor(){this.startItems=new Array;this.startItemsConnects={};this.canBackSpace={};this.oldStartItems=new Array}static getInstance(){return Y4.manager==null&&(Y4.manager=new Y4),Y4.manager}setStartItems(t){this.startItems.length=0,xe.addAll(this.startItems,t),xe.addAll(this.oldStartItems,t),this.hight()}getStartItem(t){return this.startItems[t]}isStart(t){return this.startItems.includes(t)}getNodeList(t){let e=t.start.model,r=t.start.point;if(!e||!(e instanceof gt))return;let i=new su(e),n=i.tracks,s=n.findIndex(h=>h==e),a=i.reverseTrack[s],l=a?e.end:e.start,c=a?e.start:e.end;if(!(s==n.length-1&&c.equals(r)))if(s==0&&l.equals(r))i.reversePath();else{this.canBackSpace[e.globalIndex]=!1;return}this.canBackSpace[e.globalIndex]=!0,i.generateList()}backspace(t,e){e||(e=new S(fi.getInstance().sceneX,fi.getInstance().sceneY));let r=Rn.getInstance().current,i=r.tracks,n=[],s=!1,a=i;t&&(a=[r.node]);let l=[],c=a.map(u=>{let d=u,m=d.start.model;if(m&&m instanceof gt&&this.startItems.includes(m)&&this.canBackSpace[m.globalIndex]){let g=At.getInstance().getNode(m);g||(this.getNodeList(d),g=At.getInstance().getNode(m)),s=!0;let y=g.parent,b=y.getLastNode();Cr.getInstance().current.setTrackHidden(b.item.globalIndex);let P=b.prev,T=y.viaNode.prev||y.otherNode.prev;if(P){let C=y.pop(),O=new Jt().getItem(C.globalIndex);O&&l.push(O),this.changeTrackInfoByItem(b.item,d,P.item)}else{if(T instanceof Ct){let C=Si.getInstance().getNode(T);C&&C.deleteConnectTrack(y)}this.changeTrackInfoByItem(b.item,d,T)}let I=this.startItems.findIndex(C=>C==m);I!=-1&&(this.startItems[I]=d.start.model,this.canBackSpace[d.start.model.globalIndex]=!0)}return d});if(!s)return!1;c.forEach(u=>{if(u.startAlignMap.size>0){let d=u.startAlignMap.get(u).start();d&&(u.start.point=d),u.startAlignMap.clear()}}),this.hight();let h=[];if(c.forEach(u=>{var m;let p=new Jt().getItem((m=u.start.model)==null?void 0:m.globalIndex);h.push({info:u,item:p,project:0}),p&&n.push(p)}),c.length>1){this.align(h,r.node),h=sT.sort2(h,e,r.node).tracksInfo;let d=h.map(m=>m.info),p=sT.getGapsByTracks(d);sT.linked(d,p),r.modifySort(d,p),this.consoleTrackEvent(r)}return l}align(t,e){let r=this.startItems,i=r.some(a=>a instanceof gt),n=r.every(a=>a instanceof gt)&&cne(r),s=new IA;if(i)try{let a=t.filter(l=>l.item instanceof Ge).map(l=>l.item.model);if(a.length){let l=vVe(a.map(m=>Et(m.primitive))),c=a.map(m=>l.dot(m.end)),h=c.findIndex(m=>m==Math.max(...c));if(c.every(m=>m==c[0])&&e.start.model instanceof gt){let m=a.indexOf(e.start.model);m>=0&&(h=m)}let u=a[h],d=t.find(m=>m.item.model==u).info,p=s.getStartRoutes(t.map(m=>m.info),d,n);for(let m=0;m<t.length;m++){let g=t[m].info;if(g!==d){let y=p[m];g.end.point=y.end()||g.end.point,g.start.point=y.end()||g.start.point,g.end.direct=Et(y.primitives[y.primitives.length-1])||d.end.direct,g.start.direct=Et(y.primitives[y.primitives.length-1])||d.start.direct,g.startAlignMap.set(g,y)}}}}catch(a){console.error(a)}}consoleTrackEvent(t,e){t.tracks.forEach(i=>{this.consoleTrackInfo(i,e)})}consoleTrackInfo(t,e){var r;console.log("\u5BFC\u7EBF\u8D77\u70B9\u4FE1\u606F"),console.log(`start:(${t.start.point.x},${t.start.point.y}); layer:${t.layerId}; item:${e==null?void 0:e.globalIndex}, net:${t.net},width:${t.width}, direct:(${t.direct.x},${t.direct.y}),nextGap:${(r=t.next)==null?void 0:r.width},canModifyDirect:${t.start.allowModifyDirect},canModifyNet:${t.allowModifyNet},sortDirect:(${t.start.direct.x},${t.start.direct.y})`)}changeTrackInfoByItem(t,e,r){let i=t.layerId,n=t instanceof zr?t.direct:new S(1,0),s=!0;r instanceof zr&&(n=r.direct,s=!1);let a=no.getSignalLayerIds(r,i),l=new Ly(new Set(a),i,t.start,n,s,r),c=new Ly(new Set(a),i,t.end,n,s,null);e.start=l,e.end=c,e.startAlignMap.clear()}clear(){this.unHight(),this.startItems.length=0,this.startItemsConnects={},this.canBackSpace={},this.oldStartItems.length=0}hight(){let t=new Jt;this.startItems.forEach(e=>{if(!e)return;let r=t.getItem(e.globalIndex);r&&!r.isEmpty&&r.isVisible&&r.click()})}unHight(){let t=new Jt;this.startItems.forEach(e=>{if(!e)return;let r=t.getItem(e.globalIndex);r&&!r.isEmpty&&(r.updateFilterVisible=!0,r.visible())})}getBackspaceItems(){let t={};return this.startItems.forEach(e=>{if(e instanceof gt){if(!At.getInstance().getNode(e))return;let i=At.getInstance().getNode(e).parent;t[e.globalIndex]={pathList:i,endItem:i.otherNode.prev}}}),t}};Y4.manager=null;var R0=Y4;var hne=class o{constructor(t,e,r,i){this.limit=1;this.realTimeLimit=1;this.canEndWire=!1;this.tracks=t,this.gaps=e,this.node=r,this.canEndWire=i}toggleNext(){let t=this.tracks.indexOf(this.node),e=t+1>=this.tracks.length?0:t+1;this.node=this.tracks[e]}clone(){let t=new Array,e=new Array;for(let n of this.tracks){let s=n.clone();n.start!=null&&(s.start=n.start.clone()),n.end!=null&&(s.end=n.end.clone()),t.push(s)}for(let n of this.gaps){let s=n.clone();e.push(s)}this.linked(t,e);let r=this.tracks.indexOf(this.node),i=t[r];return new o(t,e,i,this.canEndWire)}linked(t,e){for(let r=0;r<t.length;r++){let i=t[r],n=e[r];i.next=n,i.previous=e[r-1]}}getStartCenter(t){let e=this.tracks.length,r=Math.floor(e/2),i;if(e%2===0){let n=this.tracks[r-1].start.point,s=this.tracks[r].start.point;if(i=n.add(s).mul(.5),t){let a=t.tracks[r-1].width,l=t.tracks[r].width,c=s.sub(n).normalize(),h=a-l;i=i.add(c.mul(h))}}else i=this.tracks[r].start.point;return i}getEndCenter(t){let e=this.tracks.length,r=Math.floor(e/2),i;if(e%2===0){let n=this.tracks[r-1].end.point,s=this.tracks[r].end.point;if(i=n.add(s).mul(.5),t){let a=t.tracks[r-1].width,l=t.tracks[r].width,c=s.sub(n).normalize(),h=a-l;i=i.add(c.mul(h))}}else i=this.tracks[r].end.point;return i}};var aT=class extends Kh{upload(t){throw new Error("Method not implemented.")}updateData(){throw new Error("Method not implemented.")}constructor(t,e,r,i){super(),this.node=t,this.trackId=e,this.isStart=r,this.connect=i}redo(){this.connect?(this.isStart?this.node instanceof as?this.trackId.viaNode.prev=this.node:this.trackId.otherNode.prev=this.node.item:this.node instanceof as?this.trackId.viaNode.next=this.node:this.trackId.otherNode.next=this.node.item,this.node.addConnectTrack(this.trackId,this.isStart)):(this.isStart?this.trackId.viaNode.prev=null:this.trackId.viaNode.next=null,this.node.deleteConnectTrack(this.trackId))}undo(){this.connect?(this.isStart?this.node instanceof as?this.trackId.viaNode.prev=null:this.trackId.otherNode.prev=null:this.node instanceof as?this.trackId.viaNode.next=null:this.trackId.otherNode.next=null,this.node.deleteConnectTrack(this.trackId)):(this.isStart?this.node instanceof as?this.trackId.viaNode.prev=this.node:this.trackId.otherNode.prev=this.node.item:this.node instanceof as?this.trackId.viaNode.next=this.node:this.trackId.otherNode.next=this.node.item,this.node.addConnectTrack(this.trackId,this.isStart))}};function F8(o){let t=o.listIterator(),e=new Array;for(;t.hasNext();){let s=t.next();P3t(s.item),e.push(s),o.remove(s)}for(let s=e.length-1;s>=0;s--)o.addLastNode(e[s]);if(o.viaNode.prev!=null){let s=o.viaNode.prev.connectTrack.get(o);o.viaNode.prev.addConnectTrack(o,!s)}if(o.viaNode.next!=null){let s=o.viaNode.next.connectTrack.get(o);o.viaNode.next.addConnectTrack(o,!s)}if(o.otherNode.prev!=null&&o.otherNode.prev instanceof et){let s=Kl.getInstance().getNode(o.otherNode.prev),a=s.connectTrack.get(o);s.addConnectTrack(o,!a)}if(o.otherNode.next!=null&&o.otherNode.next instanceof et){let s=Kl.getInstance().getNode(o.otherNode.next),a=s.connectTrack.get(o);s.addConnectTrack(o,!a)}let r=o.viaNode.prev;o.viaNode.prev=o.viaNode.next,o.viaNode.next=r;let i=o.otherNode.prev;o.otherNode.prev=o.otherNode.next,o.otherNode.next=i;let n=o.startType;o.startType=o.endType,o.endType=n}function P3t(o){if(o instanceof zr){let{start:t,end:e}=o;o.start=e,o.end=t}else if(o instanceof Ii){let{center:t,radius:e,startAngle:r,endAngle:i,sweep:n}=o;o.startAngle=i,o.endAngle=r,o.sweep=n==ae.CCW?ae.CW:ae.CCW}}function V8(o,t){let e=t.listIterator(),r=new Array(t.size()),i=0;for(;e.hasNext();)r[i++]=e.next();for(let n of r)t.remove(n),o.addLastNode(n)}function une(o,t){let e=new Array,r=o;for(;r!=null&&(e.push(r),r!=t);)r=r.next;return e}function j4(o,t){var e,r;t?(o.ignore=!1,oi.getInstance().updateTree(o.item),Cr.getInstance().current.setTrackVisible((e=o.item)==null?void 0:e.globalIndex)):(o.ignore=!0,oi.getInstance().deleteTree(o.item),Cr.getInstance().current.setTrackHidden((r=o.item)==null?void 0:r.globalIndex))}var dne=class extends Kh{upload(t){throw new Error("Method not implemented.")}updateData(){throw new Error("Method not implemented.")}constructor(t,e){super(),this.target=t,this.list=e,this.node=e.getFirstNode()}redo(){V8(this.target,this.list)}undo(){if(this.node!=null){let t=this.node,e=new Array;for(;t!=null;)e.push(t),t=t.next;for(let r=e.length-1;r>=0;r--)this.target.remove(e[r]),this.list.addFirstNode(e[r])}}};var pne=class extends Kh{upload(t){throw new Error("Method not implemented.")}updateData(){throw new Error("Method not implemented.")}constructor(t){super(),this.list=t}redo(){F8(this.list)}undo(){F8(this.list)}};var Tg=class{constructor(){this.nodeManager=At.getInstance();this.wireMap=new Map;this.wireVia=new Map;this.command=new Lr;this.level="STRONG";this.direct=new S(1,0)}creataList(t){let e=this.nodeManager.createList();return this.wireMap.set(t,e),e}initList(t){let e=this.wireMap.get(t);if(e!=null){if(e.size()>0){let r=e.getLast(),i=t.start.model;r!==i?(e=new Zr().createList(),this.wireMap.set(t,e)):(e.otherNode.next=null,e.viaNode.next=null)}else e.otherNode.next=null,e.viaNode.next=null;return e}if(t.start.model!=null){let r=t.start.model;if(r instanceof gt&&r.layerId==t.layerId){if(r.end.equals1(t.start.point)){let i=At.getInstance().getListNode(r);i.next==null&&(e=i.parent)}if(r.start.equals1(t.start.point)){let i=At.getInstance().getListNode(r);i.prev==null&&(F8(i.parent),e=i.parent)}}}return e==null&&(e=this.nodeManager.createList()),this.wireMap.set(t,e),e}updateEnd(t,e){let r=this.wireMap.get(t);if(r!=null&&t.end.model!=null){let i=t.end.model;if(i instanceof gt&&i.layerId==t.layerId){if(i.end.equals1(t.end.point)){let n=At.getInstance().getListNode(i);n.next==null&&(e.addCommand(new pne(n.parent)),F8(n.parent),this.mergeLists(r,n.parent,e))}if(i.start.equals1(t.end.point)){let n=At.getInstance().getListNode(i);n.prev==null&&this.mergeLists(r,n.parent,e)}}}}mergeLists(t,e,r=this.command){if(e.size()>0&&(r.addCommand(new dne(t,e)),V8(t,e)),this.changeViaNode(e.viaNode.prev,t,e,!0,r),this.changeViaNode(e.viaNode.next,t,e,!1,r),e.otherNode.prev!=null&&e.otherNode.prev instanceof et){let i=Kl.getInstance().getNode(e.otherNode.prev);this.changeViaNode(i,t,e,!0,r)}if(e.otherNode.next!=null&&e.otherNode.next instanceof et){let i=Kl.getInstance().getNode(e.otherNode.next);this.changeViaNode(i,t,e,!1,r)}}setInputStatus(t){let e=t.listIterator();for(;e.hasNext();){let r=e.next();Mr.getInstance().addInputStatus(r)}}changeViaNode(t,e,r,i,n){if(t!=null){let s=t.connectTrack.get(r);s!=null&&(t.deleteConnectTrack(r),n.addCommand(new aT(t,r,s,!1))),t.addConnectTrack(e,i),n.addCommand(new aT(t,e,i,!0))}}bind4Info(t){let e=this.wireMap.get(t);if(!(e==null||e.size()==0)){if(t.start.model!=null){let r=t.start.model,i=!1;r instanceof gt&&At.getInstance().getListNode(r).parent==e&&(i=!0),i||this.bind(e,t.layerId,r,!0,this.command)}if(t.end.model!=null){let r=t.end.model,i=!1;r instanceof gt&&At.getInstance().getListNode(r).parent==e&&(i=!0),i||this.bind(e,t.layerId,r,!1,this.command)}}}bind(t,e,r,i,n){if(r instanceof Ct&&!r.isEmpty){let s=Si.getInstance().getViaNode(r);i?t.viaNode.prev=s:t.viaNode.next=s,s.addConnectTrack(t,i),n.addCommand(new aT(s,t,i,!0))}else if(r instanceof gt){if(r.layerId!=e)return;let s=At.getInstance().getListNode(r);if(i&&t.viaNode.prev!=null&&t.viaNode.prev.connectTrack.get(s.parent)!=null||!i&&t.viaNode.next!=null&&t.viaNode.next.connectTrack.get(s.parent)!=null)return;i?t.otherNode.prev=s.parent:t.otherNode.next=s.parent}else if(r instanceof et){if(r.layerId!=12&&r.layerId!=e)return;let s=Kl.getInstance().getNode(r);i?t.otherNode.prev=r:t.otherNode.next=r,s.addConnectTrack(t,!0),n.addCommand(new aT(s,t,i,!0))}else{if(r.layerId!=12&&r.layerId!=e)return;i?t.otherNode.prev=r:t.otherNode.next=r}}initViaNode(t){let e=this.wireVia.get(t);if(e!=null&&t.start.model!=null){let r=t.start.model;if(r instanceof gt){let i=At.getInstance().getListNode(r);if(i.prev==null&&r.start.equals1(t.start.point)){let n=!0,s=i.parent;n?s.viaNode.prev=e:s.viaNode.next=e,e.addConnectTrack(s,n),this.command.addCommand(new aT(e,s,n,!0))}if(i.next==null&&r.end.equals1(t.start.point)){let n=!1,s=i.parent;n?s.viaNode.prev=e:s.viaNode.next=e,e.addConnectTrack(s,n),this.command.addCommand(new aT(e,s,n,!0))}}}}};function X4(){let o=re.getInstance().getRadiusPhysicsByNet(""),t=Zt.getInstance(),e=Ys.getInstance();return{trackWidthFollow:le.pcbConfig.startTrackWidth,viaSizeFollow:le.pcbConfig.startViaSize,lastTrackWidth:we.prevTrackWidth,lastInnerRadius:ut.defaultVia.innerRadius||o.defalutInner,lastRadius:ut.defaultVia.radius||o.defalutRadius,snap:we.adsorb,routingMode:t.mode,routingCorner:t.type,removeLoop:we.removeLoop,rotatingObject:le.pcbConfig.rotateWhole,trackFollow:le.pcbConfig.trackFollow,stretchTrackMinCorner:e.trackMinCorner,preferenceConfig:le.pcbConfig.layerPhyPerferenceConfig,realTimeUpdateUnusedLayers:le.pcbConfig.realTimeUpdateUnusedLayers,unusedPadRange:le.pcbConfig.unusedPadRange,pushVia:e.pushVia,pathOptimization4BePushed:e.pathOptimization4BePushed,currentPathOptimization:e.currentPathOptimization4BePushed,removeCircuitsContainingVias:e.removeCircuitsContainingVias,removeAntenna:e.removeAntenna}}function wi(){R.getInstance().compiler.uploadPreference(Sr.getInstance().encode("PREFERENCE",X4()))}var fne=class{constructor(t){this.wiringRouterParams=Ha.getInstance();this.afterPlacingTheViaSwitch2Layer=[this.wiringRouterParams.getAfterPlacingTheViaSwitch2Layer().activeLayerId,this.wiringRouterParams.getAfterPlacingTheViaSwitch2Layer().value],this.startTrackWidth=le.pcbConfig.startTrackWidth,this.startViaSize=le.pcbConfig.startViaSize,this.width=this.wiringRouterParams.getPanelTrackWidth(),this.wireMode=t}resetWirePanelData(){this.wiringRouterParams.setAfterPlacingTheViaSwitch2Layer(this.afterPlacingTheViaSwitch2Layer),le.pcbConfig.startTrackWidth=this.startTrackWidth,le.pcbConfig.startViaSize=this.startViaSize,we.widthFollowRule=le.pcbConfig.startTrackWidth=="rule",we.sizeFollowRule=le.pcbConfig.startViaSize=="rule",this.wiringRouterParams.setTrackWidth(this.width*10),wi()}};var RI=class o{constructor(t,e,r){this.result=new Tg;this.realTimeLimit=1;this.nextEvent=null;this.publish=!1;this.tracks=t,this.gaps=e,this.node=r}saveWirePanelInfo(t){this.wirePanelInfo=new fne(t)}modifySpacing(t){for(let e of this.gaps)e.width=t}isDiffGap(){let t=new T3,e=this.tracks,r=[];for(let i=0;i<e.length-1;i++)t.isDiffPair(e[i].net,e[i+1].net)&&(r.push(!0),i++),r.push(!1);return r}modifySpacing1(t){if(t.length==1){let e=this.isDiffGap();for(let r=0;r<this.gaps.length;r++){let i=this.gaps[r];e[r]||(i.width=t[0])}}else for(let e=0;e<this.gaps.length;e++){let r=this.gaps[e];r.width=t[e]}}modifyWidth(t){for(let e of this.tracks)e.width=t}updateSpacing(){let t=Ha.getInstance().getAsRuleMiniumSpacing(this),e=this.isDiffGap();for(let r=0;r<this.gaps.length;r++){let i=this.gaps[r];if(t[r]!=null){let n=t[r]/10;if(e[r]){i.width=n;continue}n>i.width&&(i.width=n)}}}toggleNext(){let t=this.tracks.indexOf(this.node),e=t+1>=this.tracks.length?0:t+1,r=this.tracks.length,i=0;for(;this.tracks[e].drawing==1&&(e=e+1>=this.tracks.length?0:e+1,i++,i!=r););this.node=this.tracks[e]}togglePre(){let t=this.tracks.indexOf(this.node),e=t-1<0?this.tracks.length-1:t-1,r=this.tracks.length,i=0;for(;this.tracks[e].drawing==1&&(e=e-1<0?this.tracks.length-1:e-1,i++,i!=r););this.node=this.tracks[e]}changeControlNodeByIndex(t){return this.node=this.tracks[t],!0}modifySort(t,e,r=!0){let i=this.tracks.indexOf(this.node);this.tracks.length=0,this.tracks.push(...t),this.gaps.length=0,this.gaps.push(...e),r&&(this.node=this.tracks[i])}reverse(){this.tracks.reverse(),this.gaps.reverse();for(let t of this.tracks)t.previous=null,t.next=null;for(let t of this.gaps)t.previous=null,t.next=null;this.linked(this.tracks,this.gaps)}clone(t=!1){let e=new Array,r=new Array;for(let s of this.tracks){let a=s.clone();if(s.startAlignMap.size>0&&!(s==this.node&&t)){let l=s.startAlignMap.get(s);a.startAlignMap.set(a,l)}s.start!=null&&(a.start=s.start.clone()),s.end!=null&&(a.end=s.end.clone()),e.push(a)}for(let s of this.gaps){let a=s.clone();r.push(a)}this.linked(e,r);let i=this.tracks.indexOf(this.node),n=e[i];return new o(e,r,n)}linked(t,e){for(let r=0;r<t.length;r++){let i=t[r],n=e[r];i.next=n,i.previous=e[r-1],n!=null&&(n.previous=i,n.next=t[r+1])}}getCornerEvent(){let t=new Array;for(let i of this.tracks){let n=i.getCornerNode();t.push(n)}let e=this.tracks.indexOf(this.node),r=new hne(t,this.gaps,t[e],this.isCanEndWire);return r.linked(t,this.gaps),r.realTimeLimit=this.realTimeLimit,r}resetInfo(){for(let t of this.tracks){t.isReverse&&(t.direct=t.direct.mul(-1)),t.isReverse=!1,t.end.model=null;let e=t.start.model;if(e!=null&&e instanceof gt&&e.isEmpty){let r=Ml.getInstance().getItem(e.globalIndex);t.start.model=r}}}};var au=class{constructor(t,e=!1){this.onlyTrack=!1;this.all=new Set;this.pts=new Array;this.tracks=new Array;this.onlyTrack=e,this.generateChain(t)}notConnectPadEndPoint(){return this.start!=null&&this.end==null?this.pts[this.pts.length-1].end():this.start==null&&this.end!=null?this.pts[0].start():null}generateChain(t){let e=t.start,r=t.end;return this.all.add(t),this.tracks.push(t),this.getTracks(e,t.net,t.width,t.layerId),this.reverse(),this.pts.push(t.primitive),this.tracks=this.tracks.reverse(),this.getTracks(r,t.net,t.width,t.layerId,!1),this}reverse(){if(this.pts.length!=0){this.pts.reverse();for(let t=0,e=this.pts.length;t<e;t++){let r=pp(this.pts[t]);this.pts.splice(t,1,r)}}}getTracks(t,e,r,i,n=!0){let s=new ht(t.x,t.x,t.y,t.y),a=this.searchTracks(s,i);a=a.filter(y=>Mt.checkIsCanEditByItem(y));let l=new Array;for(let y of a)y instanceof Ue||y instanceof Le?y.net==e&&y.center.equals1(t)&&l.push(y):y instanceof Ge&&y.net==y.net&&!this.all.has(y)&&y.width==y.width&&y.layerId==i&&(y.start.equals1(t)||y.end.equals1(t))&&l.push(y);l.length==0&&xe.addAll(l,a);let c=new Array,h=new Array,u=new Array;if(n&&this.start==null||!n&&this.end==null)for(let y of l){let b=null;if((y instanceof Le||y instanceof Ue)&&(b=y),b!=null&&b.net==e&&b.center.distance2(t)<1e-4){n?(this.start=b,y instanceof Le?this.startType=1:this.startType=2):(y instanceof Le?this.endType=1:this.endType=2,this.end=b);return}if(this.onlyTrack&&y instanceof yi&&y.net==e&&(y.start.distance2(t)<1e-4||y.end.distance2(t)<1e-4)){n?this.startType=3:this.endType=3;return}}let d=new wb(t,r/2,S.ORIGIN,{point:t,item:null,isStart:n}),p=new Array;p.push(d);for(let y of l)if(y instanceof Ge&&this.itemIsWire(y)&&!this.all.has(y)&&y.net==e&&y.layerId==i&&y.length>1e-4){let b=new wb(y.start,y.width/2,S.ORIGIN,{point:y.end,item:y,isStart:!0}),P=new wb(y.end,y.width/2,S.ORIGIN,{point:y.start,item:y,isStart:!1});p.push(b,P)}new eR(p).classify();let g=d.getConnectNeighbors();for(let y of g){c.push(y.component.point);let b=y.component.item;y.component.isStart?h.push(b.primitive):h.push(pp(b.primitive)),this.all.add(b),u.push(b)}if(c.length==1&&u[0].width==r)this.tracks.push(u[0]),this.pts.push(h[0]),this.getTracks(c[0],e,u[0].width,i,n);else if(c.length>1||u[0]&&u[0].width!=r){n?this.startType=11:this.endType=11;for(let y of u)this.all.delete(y)}else for(let y of u)this.all.delete(y)}searchTracks(t,e){return kt.search4Types(t,["Pad","Via","Track","ArcTrack"],(i,n)=>n=="Track"||n=="ArcTrack"?i==e:n=="Pad"?i==12||i==e:n=="Via").getTPV()}itemIsWire(t){return this.onlyTrack?t instanceof Ir:t instanceof Ge}notConnectPadTrack(){return this.start!=null&&this.end==null?this.tracks[this.tracks.length-1]:this.start==null&&this.end!=null?this.tracks[0]:null}reverseResult(){this.tracks.reverse(),this.reverse();let t=this.start;this.start=this.end,this.end=t,[this.startType,this.endType]=[this.endType,this.startType]}};var TS=class{constructor(t=!1,e){this.precision=1e-4;this.onlyCheckEndpoint=t,e!=null&&(this.precision=e)}setOnlyCheckEndpoint(t=!1){this.onlyCheckEndpoint=t}isConnect(t,e){if(t instanceof gt){if(e instanceof gt)return this.checkTracks(t,e);if(e instanceof et)return this.checkTrackPad(t,e);if(e instanceof Ct)return this.checkTrackVia(t,e)}else{if(t instanceof et&&e instanceof gt)return this.checkTrackPad(e,t);if(t instanceof Ct&&e instanceof gt)return this.checkTrackVia(e,t)}return!1}checkTracks(t,e){let r=this.onlyCheckEndpoint?this.precision:t.width*t.width/4;return t.start.distance2(e.start)<r||t.start.distance2(e.end)<r||t.end.distance2(e.start)<r||t.end.distance2(e.end)<r}checkTrackPad(t,e){let r=this.onlyCheckEndpoint?this.precision:t.width*t.width/4;return t.start.distance2(e.center)<r||t.end.distance2(e.center)<r}checkTrackVia(t,e){let r=this.onlyCheckEndpoint?this.precision:t.width*t.width/4;return t.start.distance2(e.center)<r||t.end.distance2(e.center)<r}},mne=class extends TS{checkTracks(t,e){return this.onlyCheckEndpoint?super.checkTracks(t,e):!!(t.inOutline(e.start)||t.inOutline(e.end))}checkTrackPad(t,e){return this.onlyCheckEndpoint?super.checkTrackPad(t,e):!!(e.inOutline(t.start)||e.inOutline(t.end))}checkTrackVia(t,e){return this.onlyCheckEndpoint?super.checkTrackVia(t,e):!!(e.inOutline(t.start)||e.inOutline(t.end))}};var G8=class{constructor(){this.filter=new gd;this.check=new TS(!0)}searchCycleNode(t){if(t==null||t.isEmpty)return[];let e=new Array;if(t instanceof Le){let r=this.searchTracks(t).getTracks(),i=new Array;for(let n of r)!n.isEmpty&&this.filter.needCheckIntersection(n.model,t.model)&&i.push(n);for(let n of i)(this.check.isConnect(n.model,t.model)||this.isEnd(n,n.start)&&t.model.inOutline(n.start)||this.isEnd(n,n.end)&&t.model.inOutline(n.end))&&e.push(n)}else if(t instanceof Ue){let r=this.searchTracks(t).getTracks(),i=new Array;for(let n of r)!n.isEmpty&&this.filter.needCheckIntersection(n.model,t.model)&&i.push(n);for(let n of i)(this.check.isConnect(n.model,t.model)||this.isEnd(n,n.start)&&t.model.inOutline(n.start)||this.isEnd(n,n.end)&&t.model.inOutline(n.end))&&e.push(n)}else if(t instanceof Ge){let r=this.searchTracks(t).getTPV(),i=new Array,n=new Array;for(let l of r)!l.isEmpty&&l!=t&&(l instanceof Ge&&this.filter.needCheckIntersection(l.model,t.model)?n.push(l):(l instanceof Ue&&this.filter.needCheckIntersection(l.model,t.model)||l instanceof Le&&this.filter.needCheckIntersection(l.model,t.model))&&i.push(l));let s=this.isEndpoint(i,n,t.start),a=this.isEndpoint(i,n,t.end);for(let l of i)(this.check.isConnect(t.model,l.model)||s&&l.model.inOutline(t.start)||a&&l.model.inOutline(t.end))&&e.push(l);for(let l of n)this.check.isConnect(l.model,t.model)&&e.push(l)}return e}getBBox(t){return t instanceof Ir?Lc.trackToOctagon(t.start,t.end,t.width):t.buildBBox()}searchTracks(t){if(t instanceof Le){let e=t.buildBBox(),r;return t.layerId==12?r=(i,n)=>n=="Track"||n=="ArcTrack":r=(i,n)=>(n=="Track"||n=="ArcTrack")&&i==t.layerId,kt.search(e,r)}else if(t instanceof Ue){let e=t.buildBBox(),r=(i,n)=>!!((n=="Track"||n=="ArcTrack")&&t.isContains(i));return kt.search(e,r)}else{let e=this.getBBox(t),r=(i,n)=>(n=="Track"||n=="ArcTrack")&&t.layerId==i||n=="Pad"&&(i==12||i==t.layerId)?!0:n=="Via";return kt.search(e,r)}}checkPadVia(t,e){let r=new As(t.getMathGraphics(),e.getMathGraphics(),0);return r.relation==1||r.relation==2}searchCycleNode2(t,e=!1,r=!1){if(t==null||t.isEmpty)return[];this.check.setOnlyCheckEndpoint(!r);let i=new Array;if(t instanceof Le){let n=this.searchPadAndViaCycleNode(t,r);for(let s of n.tracks)!s.isEmpty&&this.filter.needCheckIntersection(s.model,t.model)&&(this.check.isConnect(s.model,t.model)||this.isEnd(s,s.start)&&t.model.inOutline(s.start)||this.isEnd(s,s.end)&&t.model.inOutline(s.end))&&i.push(s);for(let s of n.pads)!s.isEmpty&&s!=t&&this.filter.needCheckIntersection(s.model,t.model)&&this.checkPadVia(s.model,t.model)&&(i.push(s),this.searchCycleNode2(s,void 0,!1).forEach(l=>{i.push(l)}));for(let s of n.vias)!s.isEmpty&&this.filter.needCheckIntersection(s.model,t.model)&&this.checkPadVia(s.model,t.model)&&(i.push(s),this.searchCycleNode2(s,void 0,!1).forEach(l=>{i.push(l)}))}else if(t instanceof Ue){let n=this.searchPadAndViaCycleNode(t,r);for(let s of n.tracks)!s.isEmpty&&this.filter.needCheckIntersection(s.model,t.model)&&(this.check.isConnect(s.model,t.model)||this.isEnd(s,s.start)&&t.model.inOutline(s.start)||this.isEnd(s,s.end)&&t.model.inOutline(s.end))&&i.push(s);for(let s of n.pads)!s.isEmpty&&this.filter.needCheckIntersection(s.model,t.model)&&this.checkPadVia(s.model,t.model)&&(i.push(s),this.searchCycleNode2(s,void 0,!1).forEach(l=>{i.push(l)}));for(let s of n.vias)!s.isEmpty&&s!=t&&this.filter.needCheckIntersection(s.model,t.model)&&this.checkPadVia(s.model,t.model)&&(i.push(s),this.searchCycleNode2(s,void 0,!1).forEach(l=>{i.push(l)}))}else if(t instanceof Ge){let n;t instanceof Ir?n=Lc.trackToOctagon(t.start,t.end,t.width):t instanceof yi&&(n=t.buildBBox());let s=e?this.searchAbstractTrackCycleTrack(n,t):this.searchAbstractTrackCycleNode(n,t),a=new Array,l=new Array;for(let u of s)!u.isEmpty&&u!=t&&u instanceof Ls&&u!=t&&(u instanceof Ge&&this.filter.needCheckIntersection(u.model,t.model)?l.push(u):(u instanceof Ue&&this.filter.needCheckIntersection(u.model,t.model)||u instanceof Le&&this.filter.needCheckIntersection(u.model,t.model))&&a.push(u));let c=this.isEndpoint(a,l,t.start),h=this.isEndpoint(a,l,t.end);for(let u of a)(this.check.isConnect(t.model,u.model)||c&&u.model.inOutline(t.start)||h&&u.model.inOutline(t.end))&&i.push(u);for(let u of l)this.check.isConnect(u.model,t.model)&&i.push(u)}return this.check.setOnlyCheckEndpoint(!0),i}searchPadAndViaCycleNode(t,e=!1){return kt.search4Types(t.buildBBox(),e?pY:UBe,(i,n)=>{switch(n){case"Track":case"ArcTrack":return t.layerId==12||i==t.layerId;case"Pad":case"Via":return e;default:return!1}})}searchAbstractTrackCycleNode(t,e){return kt.search4Types(t,pY,(r,i)=>{switch(i){case"Track":case"ArcTrack":return r==e.layerId;case"Via":return!0;case"Pad":return r==12||r==e.layerId}return!1}).getTPV()}searchAbstractTrackCycleTrack(t,e){return kt.search4Types(t,["Track","ArcTrack"],(r,i)=>{switch(i){case"Track":case"ArcTrack":return r==e.layerId}return!1}).getTracks()}isEnd(t,e){let r=this.searchAbstractTrackCycleNode(e.bbox().extendOfSize(.01),t),i=new Array,n=new Array;for(let s of r)!s.isEmpty&&s!=t&&(s instanceof Ge&&this.filter.needCheckIntersection(s.model,t.model)?n.push(s):(s instanceof Le&&this.filter.needCheckIntersection(s.model,t.model)||s instanceof Ue&&this.filter.needCheckIntersection(s.model,t.model))&&i.push(s));return this.isEndpoint(i,n,e)}isEndpoint(t,e,r){for(let i of t)if(r.distance1(i.center)<.01)return!1;for(let i of e)if(r.equals1(i.start)||r.equals1(i.end))return!1;return!0}};var U8=class{constructor(){this.searchCycleNode=new G8,this.searchCycleNode.check=new mne(!1)}getNearItem(t,e,r){let i=this.filterItems(e);if(t instanceof Le)return this.getPadNearNode(i,t,r);if(t instanceof Ue)return this.getViaNearNode(i,t,r);if(t instanceof Ge)return this.getTrackNearNode(i,t,r)}getNearItem1(t,e,r,i,n){let s=n instanceof Function?n(this.filterItems(e)):this.filterItems(e);if(s.length==0)return null;let a;if(t instanceof Le?a=this.getPadNearNodes(s,t,i):t instanceof Ue?a=this.getViaNearNodes(s,t,i):t instanceof Ge&&(a=this.getTrackNearNodes(s,t,i)),r!==12)for(let[c,h]of a){let u=h.filter(d=>{let p=!1;return d instanceof Ge?p=d.layerId===r:d instanceof Le?p=d.layerId==12||d.layerId===r:d instanceof Ue&&(p=d.isContains(r)),p});a.set(c,u)}let l;return l=this.setDistance2Items(a,i),this.findHighestScoreElement(l)}calculateScore(t,e){t=t*1e3;let r=e>0?e:1;return t*t/r}findHighestScoreElement(t){let e=-1/0,r=null,i=t.keys(),n=i.next().value;for(;n;){let a=t.get(n);for(let l of a){let c=this.calculateScore(n,l.keys().next().value);c>e&&(e=c,r=l)}n=i.next().value}return!r||Math.sqrt(r.keys().next().value)>400?null:r.values().next().value}groupItems(t,e){let r=new Array,i=new Array,n=new Array,s=new Array,a=new Array,l=new Array,c=ds.getInstance().wireMode==="Multi-route wiring";for(let h of t)if(h!==e)if(this.layerIsContains(h,e))if(h instanceof Le)r.push(h);else if(h instanceof Ue)i.push(h);else{if(c&&h.length<h.width)continue;n.push(h)}else if(h instanceof Le)s.push(h);else if(h instanceof Ue)a.push(h);else{if(c&&h.length<h.width)continue;l.push(h)}return{c_pads:r,c_via:i,c_track:n,pads:s,via:a,track:l}}layerIsContains(t,e){if(this.isMultiLayer(t))return!0;let r=e.layerId;if((e instanceof Ue||this.isMultiLayer(e))&&(r=this.getReferenceLayer(e)),t instanceof Ue){if(t.isContains(r))return!0}else if(t.layerId==r)return!0;return!1}getReferenceLayer(t){let e=Pe.getActiveLayerID(),r=Pe.getLayer(e);return ns(r.type)||(e=1),t instanceof Ue&&(t.isContains(e)||(e=t.startLayer)),e}isMultiLayer(t){return t instanceof Ue?t.type==0:ar(t.layerId)}getPadNearNode(t,e,r){let i=null,{c_pads:n,c_via:s,c_track:a,pads:l,via:c,track:h}=this.groupItems(t,e);if(i=this.getNearNode(n,e,r),i||(i=this.getNearNode(s,e,r),i)||(i=this.getNearNode(a,e,r),i)||(i=this.getNearNode(l,e,r),i)||(i=this.getNearNode(c,e,r),i)||(i=this.getNearNode(h,e,r),i))return i}getValidPadNodes(t,e,r){let i=null,{c_pads:n}=this.groupItems(t,e);return i=this.getNearNode2(n,r,10),i}getNearNode2(t,e,r){let i=Number.MAX_VALUE,n=[],s=[];r=Math.pow(r,2);for(let a of t){let c=this.fixPosition(a,e).distance2(e);c<i&&(i=c),s.push({dis:c,item:a})}for(let a of s)ne.lesseq(a.dis,i+r)&&n.push(a.item);return n}getTrackNearNode(t,e,r){let i=new Set;i.add(e);let n=this.getConnectPad([e],i);if(n){let p=this.getValidPadNodes(t,n,this.fixPosition(n,r));if(p.length){t=[];for(let m of p)xe.addAll(t,this.getConnectAllPad(m,p))}}let s=null,{c_pads:a,c_via:l,c_track:c,pads:h,via:u,track:d}=this.groupItems(t,e);if(s=this.getNearNode(c,e,r),s||(s=this.getNearNode(l,e,r),s)||(s=this.getNearNode(a,e,r),s)||(s=this.getNearNode(d,e,r),s)||(s=this.getNearNode(u,e,r),s)||(s=this.getNearNode(h,e,r),s))return s}getViaNearNode(t,e,r){let i=new Set;i.add(e);let n=this.getConnectPad([e],i);if(n){let p=this.getValidPadNodes(t,n,this.fixPosition(n,r));if(p.length){t=[];for(let m of p)xe.addAll(t,this.getConnectAllPad(m,p))}}let s=null,{c_pads:a,c_via:l,c_track:c,pads:h,via:u,track:d}=this.groupItems(t,e);if(s=this.getNearNode(l,e,r),s||(s=this.getNearNode(c,e,r),s)||(s=this.getNearNode(a,e,r),s)||(s=this.getNearNode(u,e,r),s)||(s=this.getNearNode(d,e,r),s)||(s=this.getNearNode(h,e,r),s))return s}weightedBasePriority(t,e){let r=new Map;for(let[i,n]of Object.entries(t)){if(n.length==0)continue;let s=e[i];r.has(s)||r.set(s,[]);let a=r.get(s).concat(n);r.set(s,a)}return r}refineGroupItems(t,e){let r=e==null?void 0:e.getParent();if(r instanceof ke){let i={component_c_pads:Array(),component_c_via:Array(),component_c_track:Array(),component_pads:Array(),component_via:Array(),component_track:Array()};for(let[,n]of Object.entries(t))for(let s=0;s<n.length;s++){let a=n[s],l=a==null?void 0:a.getParent();if(l instanceof ke&&l==r){let c=n.findIndex(h=>h==a);a instanceof Le?this.layerIsContains(a,e)?i.component_c_pads.push(a):i.component_pads.push(a):a instanceof Ue?this.layerIsContains(a,e)?i.component_c_via.push(a):i.component_via.push(a):a instanceof Ge&&(this.layerIsContains(a,e)?i.component_c_track.push(a):i.component_track.push(a)),n.splice(c,1),s--}}return{...t,...i}}return t}getPadNearNodes(t,e,r){let i=this.groupItems(t,e),n=this.refineGroupItems(i,e),s={c_pads:1,c_via:.85,c_track:.7,pads:.55,via:.4,track:.25},a={component_c_pads:2,component_c_via:1.85,component_c_track:1.7,component_pads:1.55,component_via:1.4,component_track:1.25},l=s;return i!==n&&(l={...s,...a}),this.weightedBasePriority(n,l)}getTrackNearNodes(t,e,r){new Set().add(e);let n=this.groupItems(t,e),s=this.refineGroupItems(n,e),a={c_track:1,c_via:.85,c_pads:.7,track:.55,via:.4,pads:.25},l={component_c_track:2,component_c_via:1.85,component_c_pads:1.7,component_track:1.55,component_via:1.4,component_pads:1.25},c=a;return n!==s&&(c={...a,...l}),this.weightedBasePriority(n,c)}getViaNearNodes(t,e,r){let i=new Set;i.add(e);let n=this.getConnectPad([e],i);if(n){let u=this.getPadNearNode(t,n,this.fixPosition(n,r));t=t.concat(this.getConnectAllPad(u))}let s=this.groupItems(t,e),a=this.refineGroupItems(s,e),l={c_via:1,c_track:.85,c_pads:.7,via:.55,track:.4,pads:.25},c={component_c_via:2,component_c_track:1.85,component_c_pads:1.7,component_via:1.55,component_track:1.4,component_pads:1.25},h=l;return s!==a&&(h={...l,...c}),this.weightedBasePriority(s,h)}getNearNode(t,e,r){let i=e.getParent();if(i!=null&&i instanceof ke){let n=t.filter(s=>s.getParent()==i);if(n.length>0)return this.getNearNode4Dis(n,e,r)}return this.getNearNode4Dis(t,e,r)}getNearNode4Dis(t,e,r){let i=Number.MAX_VALUE,n=null;for(let s of t){let a;if(e instanceof Ge&&s instanceof Ge)a=this.fixPosition(s,r).distance2(r)-(e.width+s.width)/2;else{let l=e.getMathGraphics(e.layerId),c=s.getMathGraphics(s.layerId);a=new As(l,c,0).distance}a<i&&(i=a,n=s)}return n}setDistance2Items(t,e){let r=new Map;return t.forEach((i,n)=>{i.forEach(s=>{let a=this.fixPosition(s,e);if(a){let l=a.distance2(e);r.has(n)||r.set(n,[]);let c=new Map;c.set(l,s);let h=r.get(n).concat([c]);r.set(n,h)}})}),r}getConnectAllPad(t,e){let r=new Set;r.add(t);let i=[t];for(;i.length>0;){let n=i.shift(),s=this.searchCycleNode.searchCycleNode(n),a=[];s.find(c=>{if(r.has(c))return!1;if(c instanceof Le&&!(e!=null&&e.includes(c)))return!0;a.push(c),r.add(c)})||i.push(...a)}return Array.from(r)}getConnectPad(t,e){if(t.length==0)return null;let r=t.shift(),i=this.searchCycleNode.searchCycleNode(r);for(let n of i)if(!e.has(n)){if(n instanceof Le)return n;t.push(n),e.add(n)}return this.getConnectPad(t,e)}filterItems(t){let e=Ye.getSameNetItems(t),r=new Array;for(let i of e)$l.getInstance().has(i.globalIndex)||(i instanceof Le||i instanceof Ue||i instanceof Ge)&&r.push(i);return r}fixPosition(t,e,r=!1){if(t instanceof Le||t instanceof Ue)return t.center;{let i=t.width,n=t.start.distance1(e),s=t.end.distance1(e);if(r){if(n<s)return t.start;if(s<n)return t.end}if(n<s&&n<=i)return t.start;if(s<n&&s<=i)return t.end;{let a=t.primitive,l=new M(e,e),h=new Eu(a,l).getLine();return h.start().distance2(e)<h.end().distance2(e)?h.end():h.start()}}}};var H8=class extends U8{constructor(t,e,r,i=!1){super(),this.fixToEnd=i,this.isSingle=r;let n=this.getNetDifferentail(t),s=this.fixPosition(t,e);if(n!=null)if(this.rule=re.getInstance().getDifferentialPhysics(n.differentialPhysics),this.net_P=n.positiveNet.name,this.net_N=n.negativeNet.name,t.net==this.net_P){if(this.positive=t,this.start_P=s,this.negative=this.getNearItem(this.positive,this.net_N,s),this.negative==null){this.success=!1;return}this.start_N=this.fixPosition(this.negative,s),this.success=!0}else{if(this.negative=t,this.start_N=s,this.positive=this.getNearItem(this.negative,this.net_P,s),this.positive==null){this.success=!1;return}this.start_P=this.fixPosition(this.positive,s),this.success=!0}else this.success=!1}filter(t,e){let r=t.filter(i=>i.layerId==e.layerId);if(r.length>0)for(let i of r){let n=i.searchNode();for(let s of n)if(s instanceof Ge)return i}else for(let i of t){let n=i.searchNode();for(let s of n)if(s instanceof Ge)return i}return t[0]}getNetDifferentail(t){let e=t.net;if(re.getInstance().getAllNetDifferentials().size>0){let i=re.getInstance().getNet(e);if(i!=null&&i.netDifferential!=null)return i.netDifferential}return null}fixPosition(t,e){var r;if(t instanceof Le||t instanceof Ue)return t.center;{if(!this.isSingle&&this.fixToEnd){let a=new au(t);if(a.start==null&&a.pts.length>0&&a.tracks[0]==t)return a.pts[0].start();if(a.end==null&&a.pts.length>0&&a.tracks[a.tracks.length-1]==t)return a.pts[a.pts.length-1].end()}let i=t.width+(((r=this.rule)==null?void 0:r.getDifferentialPairSpacingDefault(t.layerId))||0)+1e-5,n=t.start.distance1(e),s=t.end.distance1(e);if(n<s&&n<=i)return t.start;if(s<n&&s<=i)return t.end;{let a=t.primitive,l=new M(e,e),h=new er(a,l).getLine();return h.start().distance2(e)<h.end().distance2(e)?h.end():h.start()}}}};var bi=class{constructor(){this.id="";this.type="open";this.dialogType=""}command(t){return!1}};var gne=class extends bi{constructor(t){super(),this.data=t}open(t){return{action:"route-prohibit-violate-drc",data:{position:this.data.position}}}modify(){}close(t){if(!t)return;let{action:e}=t;return e=="confirm"?this.data.cb&&this.data.cb():this.data.cbCancel&&this.data.cbCancel(),!0}};function Kf(o,t=!1){let e=re.getInstance().getNet(o),r=R.getInstance().compiler;r.setTicket(),t||e==null?r.deleteNet(o):r.uploadNet(o,Sr.getInstance().encode("NET",e))}var z8=class{constructor(t,e,r,i,n=!0){this.trunk=new Array;this.leaves=new Array;this.data=t,this.start=r,this.end=i,this.cycle=new Set(e),this.all=new Set(e),n&&(xe.addAllSet(this.all,e[0].searchNodeLoopType()),xe.addAllSet(this.all,e[e.length-1].searchNodeLoopType()),this.getTrunk(e),e.forEach((s,a)=>{let l=this.getIntersection(s,e[a+1]);this.addAll(l),l.length>0&&l.forEach(c=>{let h=[c];this.leaves.push(h),this.DFS(c,h)})}))}getTrunk(t){let e=new Set,r=new Array;t.forEach((i,n)=>{let s=this.getIntersection(i,t[n+1]);i instanceof Le?r.length>0&&(this.trunk.push(r),r=new Array):r.push(i),s.length>0&&(r.length>0&&this.trunk.push(r),r=new Array),e=new Set(s)}),r.length>0&&this.trunk.push(r)}DFS(t,e){let r=this.getNodes(t);this.addAll(r),r.forEach(i=>{e.push(i),this.DFS(i,e)})}addAll(t){t.forEach(e=>{this.all.add(e)})}getNodes(t){let e=t.searchCycleNode2(),r=new Array;return e.forEach(i=>{!this.all.has(i)&&i!=t&&this.isNeed(i)&&!i.isSelect(this.start.x,this.start.y)&&!i.isSelect(this.end.x,this.end.y)&&r.push(i)}),this.specialOneTrackConPad(t,new Set(e),r),this.filterNodes(r)}getIntersection(t,e){let r=new Array;if(e==null)return r;let i=new Set(t.searchNodeLoopType()),n=new Set(e.searchNodeLoopType());for(let s of i)!this.all.has(s)&&s!=t&&this.isNeed(s)&&n.has(s)&&r.push(s);return this.filterNodes(r)}specialOneTrackConPad(t,e,r){if(r.length||!(t instanceof Ge))return;let i=t.searchNodeLoopType(),n=i.filter(c=>!e.has(c)&&!this.all.has(c)&&c instanceof Le);if(n.length==1){let c=n[0];c.searchNodeLoopType().length==1&&r.push(c)}let s=t.start,a=t.end,l=t.width;for(let c of i)if(c instanceof Ge&&c!=t&&!e.has(c)&&!this.all.has(c)&&!r.includes(c)&&!c.isSelect(this.start.x,this.start.y)&&!c.isSelect(this.end.x,this.end.y)){let h=s.distance2(c.start),u=s.distance2(c.end),d=a.distance2(c.start),p=a.distance2(c.end),m=(l+c.width)/2;Math.min(h,u,d,p)<m*m&&r.push(c)}}filterNodes(t){let e=new Array,r=new Array;if(t.forEach(i=>{i instanceof Le||i instanceof Ue?e.push(i):r.push(i)}),e.length==0)return r;{let i=Array.from(e);return r.forEach(n=>{for(let s of e)if(n.isSelect(s.center.x,s.center.y))return;i.push(n)}),i}}isNeed(t){return t instanceof Ge||t instanceof Le||t instanceof Ue}leavaHasPad(){for(let t of this.leaves)for(let e of t)if(e instanceof Le)return!0;return!1}cycleContainsPad(t,e){for(let r of this.cycle)if(!t.has(r)&&!e.has(r)&&r instanceof Le)return!0;return this.leavaHasPad()}reverse(){let t=new Array;for(let e=this.trunk.length-1;e>=0;e--)t.push(this.trunk[e]);this.trunk.length=0,t.forEach(e=>{this.trunk.push(e)})}};var yne=class{constructor(t){this.nexts=new Array;this.channel=new Array;this.source=t}addNexts(t){for(let e of t)this.nexts.indexOf(e)<0&&(this.nexts.push(e),this.channel.push(!0))}setNextChannel(t,e){let r=this.nexts.indexOf(t);r>=0&&(this.channel[r]=e)}queryChannel(t){let e=this.nexts.indexOf(t);return e>=0?this.channel[e]:!0}nextCanReach(){for(let t of this.channel)if(t)return!0;return!1}};var bne=class{constructor(t,e,r,i,n=!0){this.curr=new Array;this.cycles=new Array;this.process=new Set;this.cache={};this.startNodes=t,this.endNodes=e,this.start=r,this.end=i,this.needLeaves=n;for(let s of this.startNodes)this.DFS(s,[]);Er(this.cycles,(s,a)=>s.cycle.size-a.cycle.size,0,this.cycles.length),this.classifyCycle()}classifyCycle(){if(this.cycles.length>1&&this.cycleContainsPad()){console.log("need classify cycle");let t=this.updateEndpoint(this.startNodes,this.start),e=this.updateEndpoint(this.endNodes,this.end),r={nodes:this.startNodes,point:this.start,isMulti:!1},i={nodes:this.endNodes,point:this.end,isMulti:!1};if(t==null||t.length==0){if(!(e==null||e.length==0)){if(e.length==1)e[0].point.equals1(r.point)||(i=e[0]);else if(e.length==2){let n=new Array;for(let s of e)s.point.equals1(r.point)||n.push(s);n.length>0?i=n[0]:i=e[0]}}}else if(t.length==1&&!t[0].point.equals1(i.point)){if(e==null||e.length==0)r=t[0];else if(e.length==1)e[0].point.equals1(t[0].point)||(r=t[0],i=e[0]);else if(e.length==2){let n=new Array;for(let s of e)!s.point.equals1(r.point)&&!s.point.equals1(t[0].point)&&n.push(s);n.length>0?i=n[0]:i=e[0],r=t[0]}}else if(t.length==2){if(e==null||e.length==0){let n=new Array;for(let s of t)s.point.equals1(i.point)||n.push(s);n.length>0?r=n[0]:r=t[0]}else if(e.length==1){e[0].point.equals1(t[0].point)||(i=e[0]);let n=new Array;for(let s of t)s.point.equals1(i.point)||n.push(s);n.length>0?r=n[0]:r=t[0]}else if(e.length==2){let n=new Set,s=new Set,a=0;for(let l of t)for(let c of e)l.point.equals1(c.point)&&(n.add(l),s.add(c),a++);if(a==2)t.length==2?(r=t[0],i=t[1]):e.length==2&&(r=e[0],i=e[1]);else{for(let l of n){let c=t.indexOf(l);c>=0&&t.splice(c,1)}for(let l of s){let c=e.indexOf(l);c>=0&&e.splice(c,1)}t.length>0&&(r=t[0]),e.length>0&&(i=e[0])}}}this.startNodes=r.nodes,this.endNodes=i.nodes,this.start=r.point,this.end=i.point,this.cycles.length=0,this.curr.length=0,this.cache={};for(let n of this.startNodes)this.DFS(n,[]);Er(this.cycles,(n,s)=>n.cycle.size-s.cycle.size,0,this.cycles.length)}}updateEndpoint(t,e){let r=!0;for(let i of t)i instanceof Ge||(r=!1);if(r){if(t.size>2)return null;{let i=new Array;for(let n of t){let s=new Set(t);this.getTracks(n,s,i)}return Er(i,(n,s)=>n.isMulti||s.isMulti?-1:0,0,i.length),i}}else return null}getTracks(t,e,r){let i=t.start.bbox().extendOfSize(t.width/2),n=t.end.bbox().extendOfSize(t.width/2),s=this.getConnectItemsByBbox(i,{net:t.net,layer:t.layerId}).filter(l=>{let c=l;return c instanceof Ge?!!(!e.has(c)&&(c.start.equals1(t.start)||c.end.equals1(t.start))):c instanceof Le||c instanceof Ue?!!(!e.has(c)&&c.center.equals1(t.start)):!1}),a=this.getConnectItemsByBbox(n,{net:t.net,layer:t.layerId}).filter(l=>{let c=l;return c instanceof Ge?!!(!e.has(c)&&(c.start.equals1(t.end)||c.end.equals1(t.end))):c instanceof Le||c instanceof Ue?!!(!e.has(c)&&c.center.equals1(t.end)):!1});if(s.length>1){let l=new Set,c=null;for(let h of s){let u=h;u instanceof Le||u instanceof Ue?c={nodes:new Set([u]),point:t.start,isMulti:!1}:u instanceof Ge&&l.add(u)}c==null&&(l.add(t),c={nodes:l,point:t.start,isMulti:!0}),r.push(c),xe.addAllSet(e,c.nodes)}else if(s.length==1){let l=s[0];if(l instanceof Le||l instanceof Ue){let c={nodes:new Set([l]),point:t.start,isMulti:!1};r.push(c),xe.addAllSet(e,c.nodes)}else l instanceof Ge&&(e.add(l),this.getTracks(l,e,r))}if(a.length>1){let l=new Set,c=null;for(let h of a){let u=h;u instanceof Le||u instanceof Ue?c={nodes:new Set([u]),point:t.end,isMulti:!1}:u instanceof Ge&&l.add(u)}c==null&&(l.add(t),c={nodes:l,point:t.end,isMulti:!0}),r.push(c),xe.addAllSet(e,c.nodes)}else if(a.length==1){let l=a[0];if(l instanceof Le||l instanceof Ue){let c={nodes:new Set([l]),point:t.end,isMulti:!1};r.push(c),xe.addAllSet(e,c.nodes)}else l instanceof Ge&&(e.add(l),this.getTracks(l,e,r))}}getConnectItemsByBbox(t,e){return kt.conditionSearch(t,i=>{let n=i.item;return n.net!==e.net?!1:n instanceof Ge?n.length!=0:n instanceof Ue?!!n.isContains(e.layer):!0},(i,n)=>{switch(n){case"Track":case"ArcTrack":return i==e.layer;case"Via":return i==12||i==e.layer;case"Pad":return i==12||i==e.layer}return!1}).getResult(pY)}getNode(t){let e=t.globalIndex,r=this.cache[e];if(r!=null)return r;{let i=new yne(t);return this.cache[e]=i,i}}DFS(t,e){let r=this.getNode(t),i=!0;if(this.curr.push(t),this.isEnd(t)){let n=Array.from(this.curr);this.cycles.push(new z8(Array.from(this.curr),n,this.start,this.end,this.needLeaves))}else{let n=this.getNodes(t,new Set([].concat(this.curr,e)));n.forEach(s=>{this.process.add(s)}),r.addNexts(n),n.forEach(s=>{if(r.queryChannel(s)){let l=this.DFS(s,n);this.process.delete(s),r.setNextChannel(s,l)}}),n.length==0?i=!1:n.length==1?i=r.queryChannel(n[0]):i=r.nextCanReach()}return this.curr.pop(),i}getNodes(t,e){let r=t.searchCycleNode2(),i=new Array;return r.forEach(n=>{!e.has(n)&&!this.process.has(n)&&!this.startNodes.has(n)&&n!=t&&this.isNeed(n)&&i.push(n)}),this.filterNodes(i,t)}filterNodes(t,e){let r=new Array,i=new Array;if(t.forEach(n=>{n instanceof Le||n instanceof Ue?r.push(n):i.push(n)}),r.length==0)return i;{let n=Array.from(r);return i.forEach(s=>{for(let a of r)if(e.isSelect(a.center.x,a.center.y)&&s.isSelect(a.center.x,a.center.y))return;n.push(s)}),n}}isNeed(t){return t instanceof Ge||t instanceof Le||t instanceof Ue}isEnd(t){return this.endNodes.has(t)}cycleContainsPad(){for(let t of this.cycles)if(t.cycleContainsPad(this.startNodes,this.endNodes))return!0;return!1}};var Y8=class extends Qo{constructor(e,r){super();this.pt=e;this.model=r;this.net=this.model.net}get length(){return this.pt instanceof M||this.pt instanceof q?this.pt.length():0}get color(){throw new Error("Method not implemented.")}set color(e){throw new Error("Method not implemented.")}get locked(){throw new Error("Method not implemented.")}set locked(e){throw new Error("Method not implemented.")}get showNet(){var e;return(e=this.model.showNet)!=null?e:null}rotateFor(e,r){throw new Error("Method not implemented.")}transform(e){throw new Error("Method not implemented.")}isSelect(e,r,i){throw new Error("Method not implemented.")}buildBBox(){throw new Error("Method not implemented.")}},Pj=class extends bne{DFS(t,e){let r=this.getNode(t),i=!0;if(this.curr.push(t),this.isEnd(t)){let n=Array.from(this.curr);this.cycles.push(new z8(Array.from(this.curr),n,this.start,this.end,this.needLeaves))}else{let n=this.getNodes(t,new Set([].concat(this.curr,e)));n.forEach(s=>{this.process.add(s)}),r.addNexts(n),n.forEach(s=>{if(r.queryChannel(s)){let l=this.DFS(s,n);this.process.delete(s),r.setNextChannel(s,l)}}),n.length==0?i=!1:n.length==1?i=r.queryChannel(n[0]):i=r.nextCanReach()}if(this.curr.pop(),!i&&t instanceof Ge){let n=this.searchNearNode(t);if(n.length>0)for(let s of n){let a=s[0];this.curr.push(a),this.DFS(s[1],[s[1]])&&(i=!0),this.curr.pop()}}return i}searchNearNode(t){let e=new gd,r=kt.search4Types(t.buildBBox(),["Pad","Via"],(n,s)=>{switch(s){case"Pad":case"Via":return!0;default:return!1}}),i=new Array;for(let n of r.pads)if(!n.isEmpty&&n instanceof Le&&e.needCheckIntersection(n.model,t.model)&&!this.isEndpoint(n,t.start)&&!this.isEndpoint(n,t.end)&&this.canSplitTrack(n.center,t)){let s=this.spiltTrack(n.center,t);i.push([s,n])}for(let n of r.vias)if(!n.isEmpty&&n instanceof Ue&&e.needCheckIntersection(n.model,t.model)&&!this.isEndpoint(n,t.start)&&!this.isEndpoint(n,t.end)&&this.canSplitTrack(n.center,t)){let s=this.spiltTrack(n.center,t);i.push([s,n])}return i}getNodes(t,e){let r=t.searchCycleNode2(),i=new Array;return r.forEach(n=>{!e.has(n)&&!this.process.has(n)&&!this.startNodes.has(n)&&n!=t&&this.isNeed(n)&&i.push(n)}),this.filterNodes(i,t)}isEndpoint(t,e){return e.distance1(t.center)<.01}canSplitTrack(t,e){let r=e.primitive;return er.getMinDistanceFromPoint(t,r)<.02}spiltTrack(t,e){let r=new M(t,t),n=new er(r,e.primitive).getLine();if(n.start().equals(t)){let s=Gu(e.primitive,n.end());return new Y8(s[0],e.model)}else{let s=Gu(e.primitive,n.start());return new Y8(s[0],e.model)}}};function Tj(o){let{id:t,designator:e,number:r}=o;if(t!=null&&t!=""){let n=Qt.getItem(t);if(n!=null)return n;let s=Qt.getAllItem().find(a=>{let l=a.getParent();return l!=null?`${Tr}${l.number}${Tr}${a.number}`==t:`${Tr}${a.number}`==t});if(s!=null)return s}let i=Ar.getAllItem();for(let n of i)if(n.designator==e||`${Tr}${n.number}`==e){let s=n.getPads();for(let a of s)if(a.num==r)return a}return null}function xVe(o){let{id:t,designator:e,number:r}=o;if(t!=null&&t!=""){let s=Qt.getItem(t);if(s!=null)return[s];let a=Qt.getAllItem().find(l=>{let c=l.getParent();return c!=null?`${Tr}${c.number}${Tr}${l.number}`==t:`${Tr}${l.number}`==t});if(a!=null)return[a]}let i=Ar.getAllItem(),n=new Array;for(let s of i)if(s.designator==e||`${Tr}${s.number}`==e){let a=s.getPads();for(let l of a)l.num==r&&n.push(l)}return n}function GCe(o,t){let e={pad1:null,pad2:null,netMinLength:0},r=xVe(o),i=xVe(t);for(let n of r)for(let s of i){if(e.pad1=n,e.pad2=s,!e.pad1||!e.pad2||e.pad1.net!=e.pad2.net){e.netMinLength=0;continue}let a=new Set,l=new Set;a.add(e.pad1),l.add(e.pad2);let h=new Pj(a,l,e.pad1.center,e.pad2.center,!1).cycles,u=DVe(h).length;if(u>0)return e.netMinLength=u,e}return e}function RVe(o,t="-"){let e=o.split(t);if(e.length<=1||!e[0]||!e[1])throw new Error("\u710A\u76D8\u5BF9\u540D\u79F0\u4E0D\u5408\u6CD5.");return new Em(e[0],e[1])}function UCe(o){let t=[],e=[];for(let r=0;r<o.length;r++){let i=!1,n=o[r],s=Tj(n.pad1),a=Tj(n.pad2),l=n.pad1.id?n.pad1.id:n.pad1.designator+":"+n.pad1.number,c=n.pad2.id?n.pad2.id:n.pad2.designator+":"+n.pad2.number;if(s?t.push(s.globalIndex):(i=!0,e.push(l)),a?t.push(a.globalIndex):(i=!0,e.push(c)),i)continue;let h=new Set,u=new Set,d=new Pj((h.add(s),h),(u.add(a),u),s.center,a.center,!1);DVe(d.cycles).cycle.forEach(m=>{t.push(m.globalIndex)})}return{lostPads:e,globalIndexArr:t}}function DVe(o){let t={length:0,cycle:new Set};for(let e=0;e<o.length;e++){let i=o[e].cycle;if(i.size<=2)return t.cycle=i,t;let n=0;i.forEach(s=>{if(s instanceof Ge||s instanceof Y8)n+=s.length;else if(s instanceof Le){let a=$o.getInstance().getPadLenByModel(s.model);a!=null&&(n+=a)}}),e<=0&&(t.length=n,t.cycle=i),t.length>=n&&(t.length=n,t.cycle=i)}return t}function W8(o,t){o.forEach(a=>{let l=Ye.getItem(a)||Ye.getNoneNetsItem(a);re.getInstance().setSpecialColor(a,t);for(let h of l)if(h instanceof Ue||h instanceof Ge||h instanceof Le||h instanceof He){let u=Pe.getLayer(h.layerId);!h.color.equals(t)&&(h instanceof Ue||u&&!u.isPlaneLayer())&&(h.color=null),h.refreshRender()}Wo.getRatlineByNetName(a).forEach(h=>h.refreshRender()),Ti.getAllItem().forEach(h=>{h.net==a&&h.refreshRender()}),mS().forEach(h=>{h.type=="Copper Region"&&h.net==a&&h.refreshRender()}),Kf(a)}),A.publish("updateFrame","");let e={},r={},i={},n={};Ye.getAllNoneNets().forEach(a=>{e[a]=Ye.getSpecialColor(a).toString()}),Ye.getAllNets().forEach(a=>{e[a]=Ye.getSpecialColor(a).toString()});let s=g1.getDesignRulers();s.Net.forEach(a=>{if(a.type==="netClass"){let l=a.sub[0];a.sub.every(h=>e[l.name]==e[h.name])&&l!=null&&(r[a.name]=e[l.name])}}),s.NetDifferentails.forEach(a=>{if(a.type==="netDifferentail"){let l=a.sub[0];a.sub.every(h=>e[l.name]==e[h.name])&&l!=null&&(n[a.name]=e[l.name])}}),s.Net.forEach(a=>{if(a.type==="equalLengthGroup"){let l=a.sub[0];a.sub.every(h=>e[l.name]==e[h.name])&&l!=null&&(i[a.name]=e[l.name])}}),A.publish("updateNetColor",{[xl.Nets]:e,[xl.NetClasses]:r,[xl.Differentials]:n,[xl.EqualLengthGroups]:i},Q())}function wVe(o){let t={};return o.forEach(e=>{let r=Wo.getRatlineByNetName(e)||[],i=[];if(r&&r.length>0){i=r.map(a=>{let l=a.getEndsInfo();return{name:[l.start.type,": ",l.start.id," - ",l.end.type,": ",l.end.id],id:a.globalIndex,globalIndex:`${Tr}${a.number}`,startNode:a.startNode.globalIndex,endNode:a.endNode.globalIndex}});let s=re.getInstance().getNet(e).showRatline;t[e]={netName:e,ratlines:i,eyeState:s}}else t[e]=!1}),t}function Pne(o){let t=Ye.getItem(o.toUpperCase());return t?Array.from(t).map(e=>e.showNet).sort()[0]:null}function j8(){let o=[],t=new Set;for(let e of re.getInstance().getAllNets()){let r=Pne(e.name);r&&t.add(r)}return t.forEach(e=>{var n;let r=e,i=(n=Ye.getItem(r.toUpperCase()))==null?void 0:n.size;r&&i>0&&o.push({value:e,text:e,showOriginalText:!0})}),o}function X8(){let o=g1.getDesignRulers(),t=[];o.NetDifferentails.filter(n=>{if(n.type==="netDifferentail"&&n.name)return t.push(n.name),!0});let e=0,r=[],i=new RegExp("^DP[\\s_]*(\\d+)$","i");for(let n=0,s=t.length;n<s;n++)(e=t[n].match(i))&&(e=e[1]*1,r.indexOf(e)===-1&&r.push(e+""));return r=a2(r),r.length?"DP"+(+r[r.length-1]+1):"DP1"}function LVe(){let o=g1.getDesignRulers(),t=[];return o.NetDifferentails.filter(e=>{if(e.type==="netDifferentail")return t.push(e),!0}),t}function MVe(o){let t=[];return o?re.getInstance().getAllNetClass().forEach(e=>{t.push({value:e.name,text:e.name})}):re.getInstance().getAllEqualLengthGroups().forEach(e=>{t.push({value:e.name,text:e.name})}),t}var q8=new S(1,0),Ij=new S(1,1).normalize(),$8=new S(0,1),Cj=new S(-1,1).normalize(),sT=class o extends Oo{constructor(e,r){super();this.event=null;this.selectItems=[];this.fac=new hi().createGroup("selectMultiStart");this.wire=e,this.box=new Sj,this.config=ds.getInstance(e),this.tool=r}setSelectItems(e){this.selectItems=e}clearSelectItems(){this.selectItems=[]}onMouseLeftDown(e){let{sceneX:r,sceneY:i}=e,n;switch(this.wire){case"Single wiring":let a=this.config.doubleClickItem;a&&(r=a.center.x,i=a.center.y),n=a||no.clickHere(r,i);break;case"Differential pair wiring":n=no.diffClickHere(r,i);break;case"Multi-route wiring":n=this.selectItems;break}if(no.searchProhibitArea(r,i)&&this.wire!=="Multi-route wiring"){let a={...e,sceneX:r,sceneY:i};this.openViolateProhibitDialog(new S(r,i),{cb:()=>{this.confirm(a,n),this.tool.confirmResult()},cbCancel:()=>{}})}else this.confirm(e,n)}confirm(e,r){var s;let{sceneX:i,sceneY:n}=e;switch(this.wire){case"Single wiring":{if(r!=null&&no.checkDiffItem(r)){let{net:d}=no.getNet(r),p=re.getInstance().getNet(d);if(p!=null&&p.netDifferential!=null){if(this.event=this.getDiffPair(r,new S(i,n),!0,le.pcbConfig.startTrackWidth,we.prevTrackWidth,this.config.userModifyWidth),!this.event)return;this.generateConnectNode(),this.consoleTrackEvent(this.event,r),Pe.setActiveLayerId(this.event.node.layerId);break}}let a=no.getItemAndPoint(r,i,n,e.adsorb,!0);if(!a)return;let l;if(a.select instanceof Ue){let u=no.canRouteByLayer([a.select]);u!=!1?l=u:a.select=null}let c=this.getSingleInfo(a.point,a.select,le.pcbConfig.startTrackWidth,we.prevTrackWidth,this.config.userModifyWidth,l);this.event=new RI([c],[],c),this.getValidWidth(this.event.tracks,le.pcbConfig.startTrackWidth);let h=(s=a.select)==null?void 0:s.model;h instanceof gt||h instanceof et||h instanceof Ct?R0.getInstance().setStartItems([h]):R0.getInstance().setStartItems([null]),this.generateConnectNode(),this.consoleTrackInfo(c,r),Pe.setActiveLayerId(c.layerId);break}case"Differential pair wiring":{if(r!=null){let{net:a}=no.getNet(r),l=re.getInstance().getNet(a);if(l!=null&&l.netDifferential!=null){let c=this.getDiffPair(r,new S(i,n),!1,le.pcbConfig.startTrackWidth,we.prevTrackWidth,this.config.userModifyWidth);if(!c)return;this.event=c,this.getValidWidth(this.event.tracks,le.pcbConfig.startTrackWidth),this.generateConnectNode(),this.consoleTrackEvent(this.event,r),Pe.setActiveLayerId(this.event.node.layerId)}else this.prompt(a)}break}case"Multi-route wiring":{let a=r;a.length<=1?this.box.isBBox()?this.boxSelect(e):this.box.start(i,n):this.getMultiEventByItems(new S(i,n),a);break}}he.publish("flushSelectingInfo","")}getValidWidth(e,r){if(r==="rule")return;let i=e.map(h=>{var u;return(u=h.start.model)==null?void 0:u.net}).filter(Boolean),n,s,a=!0,l=!0,c=new Jt;e.forEach(h=>{let u;h.start.model&&(u=c.getItem(h.start.model.globalIndex));let d=h.start.point,p=h.start.layerId,m=no.getMinDifWidth(u,d,p,i),g=no.getMaxDifWidth(u,d,p,i);we.prevTrackWidth<m&&(a=!1),we.prevTrackWidth>g&&(l=!1),n=n?Math.max(n,m):m,s=s?Math.min(s,g):g}),a?l||(we.prevTrackWidth=s,e.forEach(h=>h.width=s)):(we.prevTrackWidth=n,e.forEach(h=>h.width=n))}generateConnectNode(){this.event.tracks.forEach(r=>{R0.getInstance().getNodeList(r)})}consoleTrackEvent(e,r){e.tracks.forEach(n=>{this.consoleTrackInfo(n,r)})}consoleTrackInfo(e,r){var i,n;console.log("\u5BFC\u7EBF\u8D77\u70B9\u4FE1\u606F"),console.log(`start:(${e.start.point.x},${e.start.point.y}); layer:${e.layerId}; item:${(i=e.start.model)==null?void 0:i.globalIndex}, net:${e.net},width:${e.width}, direct:(${e.direct.x},${e.direct.y}),nextGap:${(n=e.next)==null?void 0:n.width},canModifyDirect:${e.start.allowModifyDirect},canModifyNet:${e.allowModifyNet},lineDirect:(${e.start.direct.x},${e.start.direct.y})`)}getControlTrack(e){let{sceneX:r,sceneY:i}=e,n=new ht(r,r,i,i);return oi.getInstance().update(),new fj().search4WireTree(n).filter(l=>l instanceof gt&&l.inShape(r,i))}getControlTrackIndex(e,r){if(e){let n=At.getInstance().getNode(e).parent,s;if(r.result.wireMap.forEach((a,l)=>{n==a&&(s=l)}),s)return r.tracks.indexOf(s)}return-1}prompt(e){if(e==""||e==null)return;let r=new e0("No differential pair, do you want to create a differential pair?",()=>{he.publish("openDifferentailDialog",{name:X8(),positiveNet:e,negativeNet:"",netOptions:j8()},Q())});he.publish("openMsgbox",r)}getSingleInfo(e,r,i,n,s,a){let l=no.getLayerId(r,a),c=no.getNet(r),h=no.getWidth(r,i,n,s,e,l),u=no.getViaRadius(e,r,this.config.userModifyViaSize),d=no.getDirect(e,r),p=no.getSignalLayerIds(r,l),m=r&&!Mt.checkIsCanEditByItem(r)?null:r==null?void 0:r.model,g=new Ly(new Set(p),l,e,d.direct,d.allowModify,m),y=new Ly(new Set([l]),l,e,d.direct,d.allowModify,m),b=new M8(this.config);u&&u.radius&&u.innerRadius&&(b.radius=u.radius,b.inner=u.innerRadius);let P=new v0(c.net,h,l,new S(1,0),c.allowModify,b);return P.start=g,P.end=y,P}getDiffPair(e,r,i,n,s,a){let l=no.getItemAndPoint(e,r.x,r.y,!0);e=l.select,r=l.point;let c=new H8(e,r,i);if(!c.success)return null;let h=this.getSingleInfo(c.start_P,c.positive,n,s,a,void 0),u=this.getSingleInfo(c.start_N,c.negative,n,s,a,void 0);e instanceof Ge?c.positive==e?u.width=h.width:h.width=u.width:c.positive instanceof Ge?u.width=h.width:c.negative instanceof Ge&&(h.width=u.width);let d=Ts(c.start_P,h.layerId,!0),p=Ts(c.start_N,h.layerId,!0),m=d.concat(p);gI(m);let g=Vb(m,h.net,u.net,h.layerId);g==null&&(g=re.getInstance().getDifferentialPhysicsByNet(h.net).getDifferentialPairSpacingDefault(h.layerId));let y=new xI(g),b;e==c.positive?b=h:b=u;let{tracksInfo:P}=o.sort2(this.getSortItems([h,u],[c.positive,c.negative]),r,b),T=P.map(I=>I.info);return this.setStartItems(P),o.linked(T,[y]),new RI(T,[y],b)}setStartItems(e){let r=new Array;for(let i of e){let n=i==null?void 0:i.item.model;n instanceof gt||n instanceof et||n instanceof Ct?r.push(n):r.push(null)}R0.getInstance().setStartItems(r)}getSortItems(e,r){let i=new Array;for(let n=0,s=e.length;n<s;n++){let a=e[n],l=r[n];i.push({info:a,item:l,project:0})}return i}getMultiInfos(e,r,i,n,s,a,l){let c=[],h,u=no.getMultiInfoItemByRatline(e,i,r),d=no.canRouteByLayer(u.selects),p=u.selects.map(I=>I.model),m=p.some(I=>I instanceof gt),g=p.every(I=>I instanceof gt)&&cne(p),y=new IA;if(u.selects.forEach((I,C)=>{let E=this.getItemInfo(I,u.points[C],n,s,a,d,l);C==u.selectNum&&(h=E),R0.getInstance().getNodeList(E),c.push({info:E,item:I,project:0})}),m)try{let I=c.filter(x=>x.item instanceof Ge).map(x=>x.item.model),C=z4(I.map(x=>Et(x.primitive))),E=I.map(x=>C.dot(x.end)),O=E.findIndex(x=>x==Math.max(...E)),_=I[O];if(h=c.find(x=>x.item.model==_).info,y.needComplete(h,p)){let x=y.getStartRoutes(c.map(v=>v.info),h,g);for(let v=0;v<c.length;v++){let D=c[v].info;if(D!==h){let w=x[v];D.end.point=w.end()||D.end.point,D.start.point=w.end()||D.start.point,D.end.direct=Et(w.primitives[w.primitives.length-1])||h.end.direct,D.start.direct=Et(w.primitives[w.primitives.length-1])||h.start.direct,D.startAlignMap.set(D,w),D.direct=D.start.direct,D.end.direct=D.start.direct}}}}catch(I){console.error(I)}let{tracksInfo:b}=o.sort2(c,i,h),P=b.map(I=>I.info);this.setStartItems(b),this.getValidWidth(P,le.pcbConfig.startTrackWidth);let T=o.getGapsByTracks(P);return o.linked(P,T),new RI(P,T,h)}static modifyDirect1(e,r,i){let n=[],s=e.filter(y=>{if(!y.info.start.allowModifyDirect)return!0;n.push(y)}),{direct:a,center:l}=o.getDirectAndCenter(e),c=r.sub(l).normalize(),h=new S(-a.y,a.x);h.dot(c)<0&&(h=new S(a.y,-a.x));let u=h,d=i?e.find(y=>y.info==i):null,p=!1;if(ds.getInstance().wireMode==="Differential pair wiring"&&e.length===2){let[y,b]=e,P=y.info.start.direct,T=b.info.start.direct,I=E=>ne.eq(Math.abs(E.x),Math.abs(E.y)),C=ne.eq(Math.abs(P.dot(T)),0);I(P)&&I(T)&&C&&(u=P.add(T).normalize(),p=!0)}let m=!0;if(!p&&s.length!==0){Er(s,(b,P)=>b.info.start.point.distance2(r)-P.info.start.point.distance2(r));let y=i&&s.find(b=>b.info==i);if(s.length>0&&!y){let b={};s.forEach(I=>{let C=I.info.start.direct.toString();b[C]?b[C].push(I):b[C]=[I]});let P=0,T;for(let I in b){let C=b[I].length;if(P<C)T=b[I],P=C;else if(P==C){let E=T[0].info.start.direct,O=b[I][0].info.start.direct;E.dot(h)<O.dot(h)&&(T=b[I])}}d||(d=T[0]),u=T[0].info.start.direct}y&&(u=i.start.direct),m=!this.start4SameDirectTracks(e)}if(m){let y=Ij.normalize(),b=Cj.normalize(),P=[q8,q8.mul(-1),y,y.mul(-1),$8,$8.mul(-1),b,b.mul(-1)],T=null,I=null;P.forEach(C=>{let E=C.dot(u);T?ne.less(T,E)&&(T=E,I=C):(T=E,I=C)}),u=I}let g=a;return g.cross(u)<0&&(g=g.mul(-1)),m&&u&&e.forEach(y=>{y.info.start.direct=u.normalize(),y.info.direct=y.info.start.direct,y.info.end.direct=y.info.start.direct}),{sortDirect:g,center:l,lineDirect:u,control:d}}static start4SameDirectTracks(e){let r=null;for(let i of e)if(i.info.start.model instanceof gt){if(r==null)r=i.info.start.direct;else if(r.dot(i.info.start.direct)<.99)return!1}else return!1;return!0}getItemInfo(e,r,i,n,s,a,l){let c;if(e instanceof Le||e instanceof Ue)c=e.center;else{let d=new pR(e);if(d.endType==null&&d.startType==null){let p=r.distance2(e.start),m=r.distance2(e.end);if(p>m?c=e.end:c=e.start,l){let g=l.isContains(e.start),y=l.isContains(e.end);g&&!y?c=e.start:!g&&y&&(c=e.end)}}else d.endType==null?c=e.end:d.startType==null&&(c=e.start)}let h=!1,u=re.getInstance().getNet(e.net);return u!=null&&u.netDifferential!=null&&(h=!0),this.getSingleInfo(c,e,i,n,s,a)}static getDiffRule(e,r){let i;if(e){let n=re.getInstance().getRegion(e.globalIndex);n.diff?i=re.getInstance().getDifferentialPhysics(n.diff):i=re.getInstance().getDifferentialPhysicsByNet(r.net)}else i=re.getInstance().getDifferentialPhysicsByNet(r.net);return i}static getGapsByTracks(e){let r=[];for(let i=0;i<e.length-1;i++){let n=e[i],s=e[i+1],a=re.getInstance().getNet(n.net);if(a!=null&&a.netDifferential!=null&&re.getInstance().getNet(s.net).netDifferential==a.netDifferential){let m=Ts(n.end.point,n.layerId),g=Ts(s.end.point,s.layerId),y=Vb(m,n.net,s.net,n.layerId),b=Vb(g,n.net,s.net,s.layerId);y==null&&(y=re.getInstance().getDifferentialPhysicsByNet(n.net).getDifferentialPairSpacingDefault(n.layerId)),b==null&&(b=re.getInstance().getDifferentialPhysicsByNet(s.net).getDifferentialPairSpacingDefault(s.layerId));let P=Math.max(y,b);r.push(new xI(P));continue}let l=o.fixTrackDirect(n,s);l.equals1(n.start.direct)||(n.direct=l,s.direct=l);let c=n.start.point,h=s.start.point,u=Math.abs(h.sub(c).cross(l)),d=(n.width+s.width)/2;r.push(new xI(u-d))}return r}static fixTrackDirect(e,r){if(e.start.allowModifyDirect||r.start.allowModifyDirect)return e.start.direct;let i=e.start.direct,n=r.start.direct;if(i.equals1(n))return i;let s=new S(i.x,0).normalize(),a=new S(0,i.y).normalize(),l=new S(n.x,0).normalize(),c=new S(0,n.y).normalize(),h=s.add(l),u=a.add(c);return h.equals1(S.ORIGIN)&&!u.equals1(S.ORIGIN)?a:!h.equals1(S.ORIGIN)&&u.equals1(S.ORIGIN)?s:i}static getDirectAndCenter(e){let r=e.length;if(r==0)return;let i=e[0].info.start.point;for(let u=1;u<r;u++)i=i.add(e[u].info.start.point);i=i.mul(1/r);let n=0,s=0,a=0,l=0;for(let u of e){let d=u.info.start.point.sub(i).normalize();n+=Math.abs(q8.cross(d)),s+=Math.abs(Ij.cross(d)),a+=Math.abs($8.cross(d)),l+=Math.abs(Cj.cross(d))}let c=[{sum:n,dir:q8},{sum:s,dir:Ij},{sum:a,dir:$8},{sum:l,dir:Cj}];return c.sort((u,d)=>u.sum-d.sum),{direct:c[0].dir,center:i}}static sort2(e,r,i){let{sortDirect:n,center:s,lineDirect:a,control:l}=o.modifyDirect1(e,r,i),c=a;for(let h of e)h.project=h.info.start.point.sub(s).dot(n);return e.sort((h,u)=>{let d=h.project-u.project;if(Math.abs(d)<1e-4){let p=h.info.start.point.sub(s).dot(c),m=u.info.start.point.sub(s).dot(c);return p-m}else return h.project-u.project}),{tracksInfo:e,control:l}}static sort(e){let r=e.length;if(r==0)return;let i=e[0].info.start.point;for(let d=1;d<r;d++)i=i.add(e[d].info.start.point);i=i.mul(1/r);let n=0,s=0,a=0,l=0;for(let d of e){let p=d.info.start.point.sub(i);n+=Math.abs(q8.cross(p)),s+=Math.abs(Ij.cross(p)),a+=Math.abs($8.cross(p)),l+=Math.abs(Cj.cross(p))}let c=[{sum:n,dir:q8},{sum:s,dir:Ij},{sum:a,dir:$8},{sum:l,dir:Cj}];c.sort((d,p)=>d.sum-p.sum);let h=c[0].dir,u=new S(-h.y,h.x).normalize();for(let d of e)d.project=d.info.start.point.sub(i).dot(h);if(e.sort((d,p)=>{let m=d.project-p.project;if(Math.abs(m)<1e-4){let g=d.info.start.point.sub(i).dot(u),y=p.info.start.point.sub(i).dot(u);return g-y}else return d.project-p.project}),!e[0].info.start.allowModifyDirect)h.cross(e[0].info.start.direct)<0&&(e=e.reverse());else for(let d of e)d.info.start.direct=u,d.info.direct=d.info.start.direct,d.info.end.direct=d.info.start.direct;return e}static linked(e,r){for(let i=0;i<e.length;i++){let n=e[i],s=r[i];n.next=s,n.previous=r[i-1],s!=null&&(s.previous=n,s.next=e[i+1])}}onMouseMove(e){this.wire=="Multi-route wiring"&&Ut.update(e,"Please select the start point or make a choice before entering the wiring process"),this.box.update(e.sceneX,e.sceneY)}onMouseLeftUp(e){if(this.wire!=="Multi-route wiring")return;no.searchProhibitArea(e.sceneX,e.sceneY)?this.openViolateProhibitDialog(new S(e.sceneX,e.sceneY),{cb:()=>{this.boxSelect(e),this.tool.confirmResult()},cbCancel:()=>{this.box.interrupt()}}):this.boxSelect(e)}boxSelect(e){let r=this.box.success(e.sceneX,e.sceneY),i=r&&no.multiBoxSelect(r.extendOfSize(.1),new S(e.sceneX,e.sceneY));if(i!=null&&i.length>1&&(i=i.filter(n=>Mt.checkIsCanEditByItem(n)),i.length>1)){let n=new S(e.sceneX,e.sceneY);this.getMultiEventByItems(n,i,r)}}getMultiEventByItems(e,r,i){var l;Ut.cancel();let n,s;r.forEach((c,h)=>{if(c instanceof Ge&&c.length<=c.width){let u=Array.from(c.searchAllConnectNode1()).filter(p=>p instanceof Ge),d;for(let p of u)if(p.start.equals(c.end)){let m=Ce.dispatch(p,"modify");this.fac.addCommand(m),p.rotateFor(p.model.center,Math.PI),d=p}else p.end.equals(c.start)&&(d=p);if(d){let p=Ce.dispatch(c,"delete");this.fac.addCommand(p),p.remove(),r.splice(h,1,d)}}}),(l=this.fac.getCommand())!=null&&l.length&&he.publish("updateRtree","");let a=this.getMultiNodes(r);a.length==1&&(this.config.lastMode=this.wire,this.wire="Single wiring",this.tool.modifyWireMode(this.wire)),a.forEach(c=>{let h;if(c instanceof Le||c instanceof Ue)h=e.distance1(c.center);else{let u=new M(e,e),d=new M(c.start,c.end);h=new er(d,u).getLine().length()}(n==null||n>h)&&(s=c,n=h)}),this.event=this.getMultiInfos(a,s,e,le.pcbConfig.startTrackWidth,we.prevTrackWidth,this.config.userModifyWidth,i),Pe.setActiveLayerId(this.event.node.layerId),this.consoleTrackEvent(this.event,s)}isUnion(e,r,i){let{net:n}=e,{net:s}=r;if(n==s){let l=e.bbox(),c=r.bbox(),h=a(e),u=a(r);if(!l.isSeparated(c))return l.isContainsBBox(c)?!0:vk(h,u)}function a(l){if(l instanceof Ue)return ge.build2([q.build2(l.center,0,360,l.radius,l.radius,ae.CW)]);{let c=i===1?l.model.top:i===2?l.model.bottom:l.model.padStyle;return cg(l.model,c,0)}}return!1}getMultiNodes(e){let r=[],i=[];e.forEach(h=>{h instanceof Ue||h instanceof Le?i.push(h):r.push(h)});let n=no.canRouteByLayer(i),s=i.length,a=new HCe(s);for(let h=0;h<s;h++)for(let u=h+1;u<s;u++)this.isUnion(i[h],i[u],n)&&a.union(h,u);let l=new Map;for(let h=0;h<s;h++){let u=a.find(h);l.has(u)||l.set(u,[]),l.get(u).push(i[h])}Array.from(l.values()).map(h=>c(h));function c(h){let u=null,d=0;for(let p=0;p<h.length;p++){let m=h[p].bbox().area();m>d&&(u=h[p],d=m)}u&&r.push(u)}return r}openViolateProhibitDialog(e,r){let i=new gne({position:{x:e.x,y:e.y,error:0},cb:()=>{r.cb&&r.cb()},cbCancel:()=>{r.cbCancel&&r.cbCancel()}});he.publish("openDialog",i)}clearDelteCommands(e=!1){var i;let r=(i=this.fac)==null?void 0:i.getCommand();if(r!=null&&r.length&&e)this.fac.undo(!1),this.fac=new hi().createGroup("selectMultiStart");else return r}interrupt(){var e;(e=this.box)==null||e.interrupt(),Ut.cancel(),this.config.lastMode=null,he.publish("flushSelectingInfo","")}},pR=class{constructor(t){let e=t.start,r=t.end;this.track=t,this.getConnectType(e,t.net,t.width,t.layerId),this.getConnectType(r,t.net,t.width,t.layerId,!1)}getConnectType(t,e,r,i,n=!0){let s=new ht(t.x,t.x,t.y,t.y),l=this.searchTracks(s,i).filter(h=>h!=this.track).map(h=>h),c=new Array;for(let h of l)h instanceof Ue||h instanceof Le?h.net==e&&h.center.equals1(t)&&c.push(h):h instanceof Ge&&h.net==h.net&&h.width==h.width&&h.layerId==i&&(h.start.equals1(t)||h.end.equals1(t))&&c.push(h);for(let h of c){let u=null;if((h instanceof Le||h instanceof Ue)&&(u=h),u!=null&&u.net==e&&u.center.distance2(t)<1e-4){n?h instanceof Le?this.startType=1:this.startType=2:h instanceof Le?this.endType=1:this.endType=2;return}if(h instanceof yi&&h.net==e&&(h.start.distance2(t)<1e-4||h.end.distance2(t)<1e-4)){n?this.startType=3:this.endType=3;return}if(h instanceof Ir&&h.net==e&&(h.start.distance2(t)<1e-4||h.end.distance2(t)<1e-4)){n?this.startType=6:this.endType=5;return}}}searchTracks(t,e){return kt.search4Types(t,["Pad","Via","Track","ArcTrack"],(i,n)=>n=="Track"||n=="ArcTrack"?i==e:n=="Pad"?i==12||i==e:n=="Via").getTPV()}},Sj=class{constructor(){this.mouseLeftX=0;this.mouseLeftY=0;this.isFirstMove=!0;this.startTime=0;this.minMoveTime=200}start(t,e){var r;this.mouseLeftX=t,this.mouseLeftY=e,this.isFirstMove=!0,this.startTime=Date.now(),(r=this.selectBox)==null||r.clear(),this.selectBox=new lne(new S(t,e))}update(t,e){this.selectBox&&(this.selectBox.moveTo(t,e),Date.now()-this.startTime>this.minMoveTime&&(this.isFirstMove=!1))}getBBox(t,e){return this.selectBox?new _e().ext6(t,e).ext6(this.mouseLeftX,this.mouseLeftY).build1():null}isOtherBoxModel(t,e){return this.selectBox?ne.eq(Math.floor(t),Math.floor(this.mouseLeftX))&&ne.eq(Math.floor(e),Math.floor(this.mouseLeftY)):!1}success(t,e){if(this.selectBox){if(this.isFirstMove)return null;let r=new _e().ext6(t,e).ext6(this.mouseLeftX,this.mouseLeftY).build1();return ne.eq(r.width(),0)&&ne.eq(r.height(),0)?null:(this.selectBox.clear(),this.selectBox=null,r)}return null}isBBox(){return this.selectBox!=null}interrupt(){var t;(t=this.selectBox)==null||t.clear(),this.selectBox=null}},HCe=class{constructor(t){this.parent=Array(t).fill(0).map((e,r)=>r)}find(t){return this.parent[t]!==t&&(this.parent[t]=this.find(this.parent[t])),this.parent[t]}union(t,e){let r=this.find(t),i=this.find(e);r!==i&&(this.parent[i]=r)}};var I3t=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215];function Tne(o){return I3t[o]||0}var Nm=class Nm{static build(t,e,r){let i=this.getHash(t,e,r),n=this._colorCache[i];return n||(n=new Nm(t,e,r),this._colorCache[i]=n),n}static getHash(t,e,r){return 31*(31*t+e)+r}static of(t){return Nm.build(t>>16&255,t>>8&255,t&255)}constructor(t,e,r){this.R=t,this.G=e,this.B=r,this._hashed=Nm.getHash(t,e,r)}toString(){return ju.format("#%02X%02X%02X",this.R,this.G,this.B)}hashCode(){return this._hashed}equals(t){return t instanceof Nm?t.R===this.R&&t.G===this.G&&t.B===this.B:!1}};Nm._colorCache={},Nm.BLACK=Nm.of(0),Nm.WHITE=Nm.of(16777215),Nm.RED=Nm.of(16711680),Nm.GREEN=Nm.of(65280),Nm.BLUE=Nm.of(255),Nm.YELLOW=Nm.of(16776960);var fR=Nm;var WCe=class{constructor(t,e,r,i,n,s,a){this.id=t,this.name=e,this.color=r,this.visible=i,this.active=n,this.config=s,this.isSignal=!0,this.layer=a}},q4=class{constructor(t,e){this.idIndex={};this.layerIndex=new hd;this.define(1,"TopLayer",16711680,!0,!0,!0,4,0),this.define(2,"BottomLayer",255,!0,!1,!0,7,0),this.define(3,"TopSilkLayer",16763904,!0,!1,!0,1,0),this.define(4,"BottomSilkLayer",6736947,!0,!1,!0,10,0),this.define(5,"TopPasteMaskLayer",8421504,!0,!1,!0,3,0),this.define(6,"BottomPasteMaskLayer",8388608,!0,!1,!0,8,0),this.define(7,"TopSolderMaskLayer",8388736,!0,!1,!0,2,0),this.define(8,"BottomSolderMaskLayer",11141375,!0,!1,!0,9,0),this.define(9,"Ratlines",6579455,!0,!1,!0,14,0),this.define(10,"BoardOutline",16711935,!0,!1,!0,11,0),this.define(11,"Multi-Layer",12632256,!0,!1,!0,0,0),this.define(12,"Document",16777215,!0,!1,!0,12,0),this.define(13,"TopAssembly",3394713,!0,!1,!0,13,1),this.define(14,"BottomAssembly",5592575,!0,!1,!0,13,2),this.define(15,"Mechanical",15737584,!1,!1,!1,13,3),this.define(19,"3DModel",6737151,!1,!1,!1,15,0),this.define(21,"Inner1",10066278,!1,!1,!1,5,1),this.define(22,"Inner2",32768,!1,!1,!1,5,2),this.define(23,"Inner3",65280,!1,!1,!1,5,3),this.define(24,"Inner4",12357120,!1,!1,!1,5,4),this.define(25,"Inner5",7396346,!1,!1,!1,5,5),this.define(26,"Inner6",52326,!1,!1,!1,5,6),this.define(27,"Inner7",10053375,!1,!1,!1,5,7),this.define(28,"Inner8",8388736,!1,!1,!1,5,8),this.define(29,"Inner9",32896,!1,!1,!1,5,9),this.define(30,"Inner10",1413983,!1,!1,!1,5,10),this.define(31,"Inner11",128,!1,!1,!1,5,11),this.define(32,"Inner12",46080,!1,!1,!1,5,12),this.define(33,"Inner13",3032918,!1,!1,!1,5,13),this.define(34,"Inner14",10060847,!1,!1,!1,5,14),this.define(35,"Inner15",16777130,!1,!1,!1,5,15),this.define(36,"Inner16",10060847,!1,!1,!1,5,16),this.define(37,"Inner17",3032918,!1,!1,!1,5,17),this.define(38,"Inner18",3487231,!1,!1,!1,5,18),this.define(39,"Inner19",8388796,!1,!1,!1,5,19),this.define(40,"Inner20",4435551,!1,!1,!1,5,20),this.define(41,"Inner21",12840142,!1,!1,!1,5,21),this.define(42,"Inner22",7506296,!1,!1,!1,5,22),this.define(43,"Inner23",3756095,!1,!1,!1,5,23),this.define(44,"Inner24",815453,!1,!1,!1,5,24),this.define(45,"Inner25",5933696,!1,!1,!1,5,25),this.define(46,"Inner26",2855806,!1,!1,!1,5,26),this.define(47,"Inner27",2333085,!1,!1,!1,5,27),this.define(48,"Inner28",4568291,!1,!1,!1,5,28),this.define(49,"Inner29",2186657,!1,!1,!1,5,29),this.define(50,"Inner30",4547799,!1,!1,!1,5,30),this.define(51,"Inner31",6908393,!1,!1,!1,5,31),this.define(52,"Inner32",9464297,!1,!1,!1,5,32),this.define(99,"ComponentShapeLayer",52428,!1,!1,!1,17,0),this.define(100,"LeadShapeLayer",13408665,!1,!1,!1,18,0),this.define(101,"Component Marking Layer",6750156,!1,!1,!1,19,0),this.define(102,"Drill drawing Layer",6750156,!1,!1,!1,20,0),this.logger=t,this.reOrderLayers(e)}reOrderLayers(t){let e=20;if(t!==null&&t.length>0){for(let r of t)if(r.type===5||r.type===6){e++;let i=this.idIndex[e];i.isSignal=r.type===5,this.layerIndex.put(r,i),this.logger.debug3("alias %s to %s",r,i.layer)}}}info1(t){return this.idIndex[t]}info2(t){let e=this.layerIndex.get(t);if(e!==null)return e;switch(t.type){case 0:return this.idIndex[11];case 14:return this.idIndex[9];case 7:return this.idIndex[2];case 8:return this.idIndex[6];case 10:return this.idIndex[4];case 9:return this.idIndex[8];case 12:return this.idIndex[12];case 5:return this.info1(Math.min(20+t.order,52));case 6:{let r=this.info1(Math.min(20+t.order,52));return r.isSignal=!1,r}case 13:return this.idIndex[15];case 11:return this.idIndex[10];case 15:return this.idIndex[19];case 4:return this.idIndex[1];case 3:return this.idIndex[5];case 1:return this.idIndex[3];case 2:return this.idIndex[7];default:return this.logger.warning3("unsupported layer type %d, use Document instead",t.type),this.idIndex[12]}}encode(t){let e=this.idIndex[t];return e===null?(this.logger.warning3("unknown layer id %d, use Document layer instead",t),this.idIndex[12].layer):e.layer.type===5?e.isSignal?e.layer:new $r(6,e.layer.order):e.layer}define(t,e,r,i,n,s,a,l){let c=new $r(a,l),h=new WCe(t,e,fR.of(r),i,n,s,c);this.idIndex[t]=h,this.layerIndex.put(c,h)}iterator(){return this.layerIndex.values()}};var $4=null,Ine=null;function C3t(o){if(!$4){let t={5:7,7:5,6:8,8:6,9:null,10:11,11:12,12:13,13:9,14:10,15:14,19:null,99:48,102:56},e=-6;for(let r=21;r<=52;r++)t[r]=r+e;$4=t}return Y0($4,o)?$4[o]:o}function S3t(o){if(!Ine){C3t(1);let t={};for(let e in $4)$4[e]&&(t[$4[e]]=+e);Ine=t}return Y0(Ine,o)?Ine[o]:o}var NVe=(function(){let o=new q4(new Di(1),[]),t={},e=0;for(let r=1;r<=56;r++){e=S3t(r);let i=o.info1(e);i&&i.layer&&(t[r]=i.layer)}return t})();var Mc=class o{constructor(t,e,r){this.name=t;let i=NVe[1];this.pcb_layer=new $r(i.type,i.order),e&&r&&this.parseEntity(e,r),this.dxfItems=[]}multiply3(t){let e=this.entity;return e.ports&&(this.entity.ports=this.verticesMultiply(this.entity.ports,t)),e.vertices&&(this.entity.vertices=this.verticesMultiply(this.entity.vertices,t)),this}validVertices(t){return t=t||this.entity.vertices,t&&t.length>0}isEof(t){return t.value=="EOF"}verticesBBox(t){let e=new _e;return t&&t.forEach(r=>{e.ext1(r.bbox())}),e.valid()||e.ext6(0,0),e.build1()}verticesMultiply(t,e){if(!t||!t.length)return console.warn("vertices is null"),null;let r=[];return t.forEach(i=>{r.push(i.multiply3(e))}),r}vector2Multiply(t,e){return t?t.multiply3(e):null}numberMultiply(t,e){return isNaN(t)?null:t*e.iScale}xyMultiply(t,e,r){return new S(t,e).multiply3(r)}autoPorts(){let t=this.entity.vertices;if(t||console.warn("entity has no vertices prop:",this.entity.type),t.length>=2){let e=t[0],r=t[t.length-1];if(e.equals(r))return;this.entity.ports=[e,r]}}cloneEntity(){if(!this.entity)return null;let t={},e,r=Object.keys(this.entity);for(let i=0;i<r.length;i++){let n=r[i],s=this.entity[n];if(!s||typeof s!="object")e=s;else if(s instanceof $r)e=new $r(s.type,s.order);else if(s instanceof S)e=new S(s.x,s.y);else if(Array.isArray(s)){if(s[0]instanceof S){e=[];for(let a of s)e.push(new S(a.x,a.y))}else if(s[0]instanceof o){e=[];for(let a of s)e.push(a.cloneOne())}}else s instanceof q?e=q.build2(s.center,s.startAngle,s.endAngle(),s.rx,s.ry,s.sweep()):s instanceof eS?e=new eS(s.net,s.layer,s.location,s.rotation,s.text,s.font,s.mirror):s instanceof o?e=s.cloneOne():e=Ss(s);t[n]=e}return t}entityDxfItems(){if(!this.entity.handle)throw console.error("entity.handle is null");return this.dxfItems=[],this.autoItem(0,this.name),null}autoItem(t,e){e==null&&(e=""),this.dxfItems.push([t,e])}autoDefault(t,e){return t==null?e:t}getLineStroke(t){let e=[0,5,9,13,15,18,20,25,30,35,40,50,53,60,70,80,90,100,106,120,140,158,200,211];if(e.includes(t))return t;{e.push(t);let r=e.sort((n,s)=>n-s),i=r.indexOf(t);return r[Math.abs(i-1)]}}};var K4=class K4 extends Mc{constructor(t,e){super(K4.entityName,t,e)}cloneOne(){let t=new K4(null,null);return t.entity=this.cloneEntity(),t}isValid(){return!!this.entity.center}parseEntity(t,e){let r=this.initEntity();for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 10:r.center=$s(t);break;case 40:r.startWidth=e.value;break;case 41:r.endWidth=e.value;break;case 42:e.value!=0&&(r.bulge=e.value);break;case 70:r.curveFittingVertex=(e.value&1)!==0,r.curveFitTangent=(e.value&2)!==0,r.splineVertex=(e.value&8)!==0,r.splineControlPoint=(e.value&16)!==0,r.threeDPolylineVertex=(e.value&32)!==0,r.threeDPolylineMesh=(e.value&64)!==0,r.polyfaceMeshVertex=(e.value&128)!==0;break;case 50:break;case 71:r.faceA=e.value;break;case 72:r.faceB=e.value;break;case 73:r.faceC=e.value;break;case 74:r.faceD=e.value;break;default:Sd(r,e);break}e=t.next()}return this}initEntity(){return this.entity={type:K4.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,center:null,startWidth:null,endWidth:null,bulge:null,curveFittingVertex:null,curveFitTangent:null,splineVertex:null,splineControlPoint:null,threeDPolylineVertex:null,threeDPolylineMesh:null,polyfaceMeshVertex:null,faceA:null,faceB:null,faceC:null,faceD:null},this.entity}multiply3(t){return super.multiply3(t),this.entity.center=this.entity.center.multiply3(t),this.entity.startWidth=this.numberMultiply(this.entity.startWidth,t),this.entity.endWidth=this.numberMultiply(this.entity.endWidth,t),t.isMirrored()&&this.entity.bulge&&(this.entity.bulge=-this.entity.bulge),this}bbox(){let e=this.entity.center,r=e.x,i=e.y;return new ht(r-1,r+1,i-1,i+1)}entityDxfItems(){let t=this.entity;super.entityDxfItems();let e=K8(t,{curveFittingVertex:1,curveFitTangent:2,splineVertex:8,splineControlPoint:16,threeDPolylineVertex:32,threeDPolylineMesh:64,polyfaceMeshVertex:128},!0,0);this.autoItem(70,e);for(let r in t){let i=t[r];if(!o0(i))switch(r){case"center":ph(this.dxfItems,i,10);break;case"startWidth":this.autoItem(40,i);break;case"endWidth":this.autoItem(41,i);break;case"bulge":this.autoItem(42,i);break;case"faceA":this.autoItem(71,i);break;case"faceB":this.autoItem(72,i);break;case"faceC":this.autoItem(73,i);break;case"faceD":this.autoItem(74,i);break;default:Ed(this.dxfItems,t,r);break}}return this.dxfItems}static builderNull(){let t=new K4(null,null);return t.initEntity(),t}};K4.entityName="VERTEXT";var R3=K4;function $s(o){let t={x:null,y:null,z:null};o.rewind();let e=o.next(),r=e.code;if(t.x=e.value,r+=10,e=o.next(),e.code!=r)throw new Error("Expected code for point value to be "+r+" but got "+e.code+".");return t.y=e.value,r+=10,e=o.next(),e.code!=r?(o.rewind(),zCe(t)):(t.z=e.value,zCe(t))}function ph(o,t,e,r){!t||isNaN(t.x)||isNaN(t.y)||(Gb(o,e,t.x||0),Gb(o,e+10,t.y||0),r=r===void 0?t.z:r,Object.is(r,void 0)||Gb(o,e+20,r))}function Z8(o,t,e){t&&t.forEach(r=>{ph(o,r,e)})}function zCe(o){return new S(o.x,o.y)}function E3t(o){let t=[];return o.forEach(e=>{t.push(zCe(e))}),t}var YCe=(h=>(h[h.handle=5]="handle",h[h.lineType=6]="lineType",h[h.layer=8]="layer",h[h.lineTypeScale=48]="lineTypeScale",h[h.visible=60]="visible",h[h.inPaperSpace=67]="inPaperSpace",h[h.ownerHandle=330]="ownerHandle",h[h.materialObjectHandle=347]="materialObjectHandle",h[h.lineweight=370]="lineweight",h[h.color=420]="color",h))(YCe||{});function Sd(o,t){let e=YCe[t.code];if(e)return o[e]=t.value,!0;switch(t.code){case 62:o.colorIndex=t.value,o.color=Tne(Math.abs(t.value));break;case 1e3:o.extendedData=o.extendedData||{},o.extendedData.customStrings=o.extendedData.customStrings||[],o.extendedData.customStrings.push(t.value);break;case 1001:o.extendedData=o.extendedData||{},o.extendedData.applicationName=t.value;break;case 100:o.subclassTag||(o.subclassTag=[]),o.subclassTag.push(t.value);default:return!1}return!1}function Ed(o,t,e){let r=YCe[e];if(!isNaN(r))return Gb(o,r,t[e]),!0;switch(e){case"colorIndex":Gb(o,62,t[e]);break;case"subclassTag":let i=t[e];Array.isArray(i)||(i=[i]),i.forEach(n=>{Gb(o,100,n)});default:return!1}return!1}function Gb(o,t,e){o0(e)&&(e=""),e=Ej(t,e),!Object.is(e,NaN)&&o.push([t,e])}function Ej(o,t){return o<=9?t:o>=10&&o<=59?parseFloat(t):o>=60&&o<=99?parseInt(Object.is(t,!0)||Object.is(t,!1)?t?"1":"0":t):o>=100&&o<=109?t:o>=110&&o<=149?parseFloat(t):o>=160&&o<=179?parseInt(t):o>=210&&o<=239?parseFloat(t):o>=270&&o<=289?parseInt(t):o>=290&&o<=299?t==="1"?1:0:o>=300&&o<=369?t:o>=370&&o<=389?parseInt(t):o>=390&&o<=399?t:o>=400&&o<=409?parseInt(t):o>=410&&o<=419?t:o>=420&&o<=429?parseInt(t):o>=430&&o<=439?t:o>=440&&o<=459?parseInt(t):o>=460&&o<=469?parseFloat(t):o>=470&&o<=481||o===999||o>=1e3&&o<=1009?t:o>=1010&&o<=1059?parseFloat(t):o>=1060&&o<=1071?parseInt(t):(console.log("WARNING: Group code does not have a defined type: %j",{code:o,value:t}),t)}function o0(o){return o==null||o===""}function Cne(o,t){let e=[],r=!1,i=!1,n=4;for(let s=0;s<=n;s++){let a={x:null,y:null,z:null},l=!1;for(;t.value!=="EOF"&&!l&&!(t.code===0||i);){switch(t.code){case 10:case 11:case 12:case 13:if(r){i=!0;continue}a.x=t.value,r=!0;break;case 20:case 21:case 22:case 23:a.y=t.value;break;case 30:case 31:case 32:case 33:a.z=t.value;break;default:l=!0,o.rewind();break}t=o.next()}a.x!=null&&a.y!=null&&e.push(a),r=!1,i=!1}return o.rewind(),E3t(e)}function kVe(o){let t={unit:39.37,name:"mm"};if(o!==0)if(o===1)t.unit=1e3,t.name="inch";else if(o===2)t.unit=12e3,t.name="ft";else if(o===3)t.unit=6336e4,t.name="mile";else if(o===4)t.unit=39.37,t.name="mm";else if(o===5)t.unit=393.7,t.name="cm";else if(o===6)t.unit=39370,t.name="m";else if(o===7)t.unit=3937007874e-2,t.name="km";else if(o===8)t.unit=1e3*1e-5,t.name="inch";else if(o===10)t.unit=36e3,t.name="yard";else if(o===11)t.unit=394e-7*1,t.name="nm";else if(o===12)t.unit=394e-7,t.name="nm";else if(o===13)t.unit=.039,t.name="um";else if(o===14)t.unit=3937,t.name="dm";else if(o===15)t.unit=39370*10,t.name="m";else if(o===16)t.unit=39370*100,t.name="m";else return t;return t}function J8(o){return!o||o.length<2||o.push(o[0]),o}function BVe(o,t,e){let r=o[0].equals(t[0],e),i=o[1].equals(t[1],e),n=o[0].equals(t[1],e),s=o[1].equals(t[0],e);return r&&i||n&&s?[-1,-1]:r?[0,0]:i?[1,1]:n?[0,1]:s?[1,0]:null}function FVe(o,t,e){let r=t.x-o.x,i=t.y-o.y,n=Math.sqrt(r*r+i*i)/2,s=Math.abs(e),a,l=s>=1,c=e>0?ae.CCW:ae.CW,h=Math.tan(Math.PI/8);if(s===1)a=n;else if(Math.abs(s-h)<1e-9)a=n*Math.SQRT2;else{let u=2*Math.atan(s);a=n/Math.sin(u)}return{radius:a,largeArcFlag:l,sweepFlag:c}}function Sne(o,t){return o.forEach(e=>{e.multiply3(t)}),o}function VVe(o,t){let e=[],r=0;for(;t.value!=="EOF";){if(t.code===0){if(t.value==="VERTEX"){let i=new R3(o,t);e.push(i),t=o.lastReadGroup}else if(t.value==="SEQEND")break}if(++r>1e4)throw console.error("debug maxsize:",r)}return e}function K8(o,t,e,r){if(!o)return r;for(let i in t)if(Object.is(o[i],e))return t[i];return r}var mR=class{};var Mp=class extends mR{constructor(t,e,r=!1){super(),this.x=t,this.y=e,this.isClick=r}doAction(t){return t.isSelect(this.x,this.y,this.isClick)}};var ed=class extends mR{doAction(t){return t instanceof hy?!t.isEmpty&&pd.getActualVisibility(t):!t.isEmpty||t.isVisible||t.layerId&&!Pe.getLayer(t.layerId).visible}};var lT=class{constructor(){this.items=new Array}doAction(t){this.items.push(t)}};var Z4=class{constructor(){this.outlines=new Array;this.slots=new Array;this.pours=new Array;this.regions=new Array;this.prohibits=new Array;this.constraints=new Array;this.teardrop=new Array;this.line=new Array;this.annotations=new Array;this.partitions=new Array;this.fpc=new Array;this.d3outlines=new Array;this.d3SideSlotRegion=new Array;this.d3TBSlotRegion=new Array;this.d3TBEntity=new Array;this.d3SideEntity=new Array;this.d3Screw=new Array;this.d3SideSlotDatumLine=new Array}doAction(t){if(t instanceof He)switch(t.type){case"Board Outline":{this.outlines.push(t);break}case"Slot Region":{this.slots.push(t);break}case"Copper Region":{this.pours.push(t);break}case"Fill Region":{this.regions.push(t);break}case"Prohibited Region":{this.prohibits.push(t);break}case"Constraint Region":{this.constraints.push(t);break}case"TearDrop":{this.teardrop.push(t);break}case"Line":{this.line.push(t);break}case"Annotation":{this.annotations.push(t);break}case"Partition":{this.partitions.push(t);break}case"FPC Stiffener":{this.fpc.push(t);break}case"3D Shell - Outline":{this.d3outlines.push(t);break}case"3D Shell - Side Slot Region":{this.d3SideSlotRegion.push(t);break}case"3D Shell - Top Slot Region":{this.d3TBSlotRegion.push(t);break}case"3D Shell - Top/Bottom Entity":{this.d3TBEntity.push(t);break}case"3D Shell - Side Entity":{this.d3SideEntity.push(t);break}case"3D Shell - Screw Pillar":{this.d3Screw.push(t);break}case"3D Shell - Side Datum Line":{this.d3SideSlotDatumLine.push(t);break}default:break}}clear(){this.outlines.length=0,this.slots.length=0,this.pours.length=0,this.regions.length=0,this.prohibits.length=0,this.constraints.length=0,this.teardrop.length=0,this.line.length=0,this.annotations.length=0,this.partitions.length=0,this.fpc.length=0,this.d3outlines.length=0,this.d3SideSlotRegion.length=0,this.d3TBSlotRegion.length=0,this.d3TBEntity.length=0,this.d3SideEntity.length=0,this.d3Screw.length=0,this.d3SideSlotDatumLine.length=0}};var no=class o{static clickHere(t,e){let r=Vr.wirePointSelect(t,e).getResult(yte);return jt.filterWireElement(r,!1)}static getSingleItems(t,e){let r=new ht(t,t,e,e),i=kt.search4Types(r,qL),n=new lT;i.setFilter(new Mp(t,e)).setFilter(new ed).setAction(n),i.doAction(qL);let s=n.items;return jt.filterWireElement(s,!1)}static click4Items(t,e){let r=new ht(t,t,e,e),i=kt.search4Types(r,qL),n=new lT;i.setFilter(new Mp(t,e)).setFilter(new ed).setAction(n),i.doAction(qL);let s=n.items;return jt.filterWireElement(s,!0)}static click4ConnectNode(t,e,r){let i=new ht(t,t,e,e),n=kt.search4Types(i,r),s=new lT;n.setFilter(new Mp(t,e)).setFilter(new ed).setAction(s),n.doAction(r);let a=s.items;return jt.filterWireElement(a,!0)}static diffClickHere(t,e){let r=o.clickHere(t,e);return o.checkDiffItem(r)}static checkDiffItem(t){return t instanceof Ge||t instanceof Le||t instanceof Ue||t instanceof mn?t:null}static multiBoxSelect(t,e){let r=ll(t),i=Vr.rtreeSearchNotOutside(r,!0),n=jt.filterWireElement(i.getResult(GBe),!0),s=new Array,a=new Array,l=new Array,c=new Array;for(let g of n)g instanceof Ge?s.push(g):g instanceof Le?l.push(g):g instanceof Ue?a.push(g):g instanceof mn&&c.push(g);let h="",u=!1;if(s.length+a.length+l.length==0){let g=o.getMultiInfoItemByRatline(c,e).selects;if(o.canRouteByLayer(g)==!1)A.publish("ui/toastMsg",{type:"warn",msg:"Multiple Routing can only be performed on graphic elements that are on the same layer simultaneously."},Q());else{u=!0;for(let b of g)b instanceof Le?l.push(b):b instanceof Ge?s.push(b):b instanceof Ue&&a.push(b);s.length+a.length+l.length>0&&(h="Multiple routing lines are selected for flying wire, but are filtered by the right filter panel.")}}else{let g=new Array;if(s.length>0&&g.push("traces"),a.length>0&&g.push("vias"),l.length>0&&g.push("pads"),g.length>1){let y=g.pop();h=`Multiple routing lines are selected for ${g.join(",")} and ${y}, but are filtered by the right panel.`}else h=`Multiple routing lines are selected for ${g[0]}, but are filtered by the right panel.`}let d=new Array;xe.addAll(d,s),xe.addAll(d,l),xe.addAll(d,a);let p=d.length>0;return d=this.followFilter(d),p&&d.length==0&&A.publish("ui/toastMsg",{type:"warn",msg:h},Q()),u?d:o.multiSelectEleFilter(d,e,t)}static boxSelect3(t){let e=ll(t),r=Vr.rtreeSearchNotOutside(e,!0);return jt.filterWireElement(r.getResult(jd),!0).filter(i=>this.checkDiffItem(i))}static boxSelect(t,e){let r=ll(t),i=Vr.rtreeSearchNotOutside(r,!0),n=jt.filterWireElement(i.getResult(jd),!0),s=o.multiSelectRatlineFilter(n);return s=this.followFilter(s),s.every(l=>l instanceof mn)?o.multiSelectRatline(s,e):o.multiSelectEleFilter(s,e,t)}static followFilter(t){let e=jt.getPick(4),r=jt.getPick(6),i=jt.getPick(9);return t.filter(n=>n instanceof Ge?e:n instanceof Le?r:n instanceof Ue?i:!0)}static multiSelectEleFilter(t,e,r){let i=t.filter(d=>d instanceof Ge||d instanceof Le||d instanceof Ue),n={};i.forEach(d=>{let p=d.net||"";n[p]||(n[p]=[]),d instanceof Ge?n[p].unshift(d):n[p].push(d)});let s=[];for(let d in n){let p=n[d],m=[],g=0;for(;g<p.length;g++){let b=p[g];if(b instanceof Ge){let P=a(b,r);P&&m.unshift({item:b,points:P})}else break}let y=p.slice(g);for(;m.length;){let b=m.pop(),P=l(b,m,e,y);s.push(P.item),m=P.directConnWire,y=P.other}s.push(...y)}function a(d,p){let m=new pR(d),g=[];return m.startType==null&&(p?p.isContains(d.start)&&g.push(d.start):g.push(d.start)),m.endType==null&&(p?p.isContains(d.end)&&g.push(d.end):g.push(d.end)),g.length?g:null}function l(d,p,m,g){let y=T(d.points,m),b=d.item,P=h(b);return p=p.filter(I=>{let C=P.has(I.item);return C&&T(I.points,m)<y&&(d=I),!C}),g=g.filter(I=>!P.has(I)),{directConnWire:p,item:d.item,other:g};function T(I,C){let E=C.distance2(I[0]);for(let O=1;O<I.length;O++){let _=C.distance2(I[O]);_<E&&(E=_)}return E}}function c(d){return!d.searchCycleNode().filter(m=>m instanceof Ge).find(m=>{let g=new su(m.model);if(!g.startType||!g.endType)return!0})}function h(d){var y;let p=(y=Iu.getNode(d.net))==null?void 0:y.map.get(d.model),m=new Jt,g=new Set([d]);if(p!=null)for(let b of p.cluster()){let P=m.getItemByType(b.item.globalIndex,b.item.modelType);if(P!=null&&P!=d&&P instanceof Qo){let T=b.item.modelType;if(T=="Copper"||T=="Inner")break;(T=="Pad"||T=="Via"||T=="Track"||T=="ArcTrack")&&g.add(P)}}return g}return o.canRouteByLayer(s)==!1?(o.multiFailMsg(),[]):s}static multiFailMsg(){A.publish("ui/toastMsg",{type:"error",msg:"Multiple Routing can only be performed on graphic elements that are on the same layer simultaneously."},Q())}static canRouteByLayer(t){let e=[],r=[];t.forEach(c=>{c instanceof Ue?e.push(c):(c instanceof Ge||c instanceof Le&&c.layerId!=12)&&r.push(c)});let i;for(let c of r)if(i==null&&(i=c.layerId),c.layerId!=i)return!1;let n,s;for(let c of e)if(c.type==1){if(!n){let g=l(c.startLayer,c.endLayer);n=g.startLayer,s=g.endLayer;continue}let h=l(c.startLayer,c.endLayer),u=h.startLayer,d=h.endLayer,p=!1,m=!1;if(u2(u,1,n,s)&&(n=u,p=!0),u2(d,1,n,s)&&(s=d,m=!1),p||m||u2(n,1,u,d))continue;return!1}if(i!=null)return n!=null?u2(i,1,n,s)?i:!1:i;{let c=Pe.getActiveLayerID();return n!=null?u2(c,1,n,s)&&Pe.getLayer(c).isSignalLayer()?c:a(n,s):c}function a(c,h){let u=15;if(Pe.getAllCopperLayerIds().forEach(d=>{d>u&&(u=d)}),c==1)return c;for(let d=c;d<=u;d++)if(Pe.getLayer(d).isSignalLayer())return d;return h==2?h:!1}function l(c,h){return c==2||h==1?[c,h]=[h,c]:c==1||h==2||c>h&&([c,h]=[h,c]),{startLayer:c,endLayer:h}}}static multiSelectRatlineFilter(t){return t.filter(e=>{if(e instanceof mn)return o.multiSelectRatlineFilter([e.startNode,e.endNode]).length>0;if(e instanceof Ge){let r=new pR(e);return r.startType==null||r.endType==null}return e instanceof Ue||e instanceof Le})}static multiSelectRatline(t,e){let r=o.multiSelectRatlineFilter(t),i=o.getMultiInfoItemByRatline(r,e).selects;return o.canRouteByLayer(i)==!1?(o.multiFailMsg(),[]):r}static getMultiInfoItemByRatline(t,e,r){let i=[],n=new Set,s=0,a=[];t.forEach(c=>{let h=c,u=e;if(!n.has(c)){if(n.add(c),c instanceof mn){let d=e.distance2(c.start),p=e.distance2(c.end);d>p?l(c.endNode)?(h=c.endNode,u=c.end):(h=c.startNode,u=c.start):l(c.startNode)?(h=c.startNode,u=c.start):(h=c.endNode,u=c.end),e=u}l(h)&&(r==c&&(s=i.length),i.push(h),a.push(u))}});function l(c){if(c instanceof Le||c instanceof Ge||c instanceof Ue)return!0}return{selects:i,selectNum:s,points:a}}static boxSelect2(t,e){let r=ll(t),i=Vr.rtreeSearchNotOutside(r,!0),n=jt.filterWireElement(i.getResult(jd),!0);return o.multiSelectEleFilter2(n,e)}static multiSelectEleFilter2(t,e){return t.filter(r=>r instanceof mn?!1:r instanceof Ge?r.layerId==e.layerId&&r.net!=e.net:r instanceof Ue?r.model.isContains(e.layerId)&&!r.model.isUnuseLayer(e.layerId)&&r.net!=e.net:r instanceof Le?(r.layerId==12||r.layerId==e.layerId)&&r.net!=e.net:!1)}static getLayerId(t,e){let r=Pe.getActiveLayerID();if(e!=null){let n=Pe.getLayer(e);if(ns(n.type))return e}else if(t&&!t.model.isEmpty){let n=t.model.layerId,s=Pe.getLayer(n);if(ns(s.type))return n}let i=Pe.getLayer(r);return ns(i.type)?r:1}static searchProhibitArea(t,e){let r=Pe.getActiveLayerID(),i=new ht(t,t,e,e),n=kt.search(i,(a,l)=>l&&Kp.includes(l)&&a==r||a==12),s=new Z4;n.setFilter(new ed).setFilter(new Mp(t,e,!0)).setAction(s),n.doAction(Kp);for(let a of s.prohibits)if(a.getComponent().track)return!0;return!1}static searchConstraints(t,e,r=!1,i=!1){let n=ht.extend3(t,t),s=kt.search(n,(l,c)=>c==null?!1:Kp.includes(c)),a=[];return s.setAction(new AI(l=>{if(l instanceof He&&l.type=="Constraint Region"&&(i||l.layerId==e||r&&l.layerId==12))return a.push(l.model),!0})),s.doAction(Kp),gI(a)}static searchAllConstraints(t){let e=t.bbox(),r=kt.search(e,(n,s)=>s==null?!1:Kp.includes(s)),i=[];return r.setAction(new AI(n=>{n instanceof He&&n.type=="Constraint Region"&&i.push(n.model)})),r.doAction(Kp),gI(i)}static handleRatlineItem(t,e,r,i){if(i&&t instanceof mn&&i){let n=new S(e,r),s=n.distance2(t.start),a=n.distance2(t.end);s>a?t=t.endNode:t=t.startNode}return t}static fixEndPosition(t,e=!0){let r=fi.getInstance().adsorb,i=o.clickHere(t.x,t.y);return i instanceof mn?{select:null,point:t}:this.getItemAndPoint(i,t.x,t.y,r,e)}static getItemAndPoint(t,e,r,i,n=!1){let s=new S(e,r),a=t;if(!t)return a=null,{select:a,point:s};if(t&&!t.isSelect(e,r))return a=null,{select:a,point:s};if(!i&&!(t instanceof mn))return{select:a,point:s};if(t instanceof Ge)s=ai.adsorpTrack(s,t);else if(t instanceof Le&&(!n||le.adsorptionConfig.getConfig("Pad Center")))s=t.center;else if(t instanceof Ue)s=t.center;else if(t instanceof mn){let l=Mt.checkIsCanEditByItem(t.startNode),c=Mt.checkIsCanEditByItem(t.endNode);if(l&&c){let h=s.distance2(t.start),u=s.distance2(t.end);h>u?(s=t.end,a=t.endNode):(s=t.start,a=t.startNode)}else if(l)s=t.start,a=t.startNode;else if(c)s=t.end,a=t.endNode;else return{select:null,point:s}}return{select:a,point:s}}static getPoint(t,e,r,i){}static getNet(t){if(t==null)return{net:"",allowModify:o.canModifyNet(t)};{let e=this.getNetByItem(t);return{net:e,allowModify:o.canModifyNet(t,e)}}}static getNetByItem(t){let e=t.getParent();return e&&e instanceof He?e.showNet:Ao(t)}static canModifyNet(t,e){if(!t)return!0;if(t instanceof Le&&t.getParent()!=null||!o0(Ao(t))||!o0(e))return!1;if(t instanceof Ge||t instanceof Jr||t instanceof He&&t.type=="Copper Region"||t instanceof Ue){let r=mre(t);return Array.from(r).every(i=>!(i instanceof Le&&i.getParent()!=null))}return!0}static getWidth(t,e,r,i,n,s,a){if(i)return r;if(t!=null&&t instanceof Ge)return t.width;if(e=="rule"){let l=a||t&&Ao(t)||"",c=Ts(n,s,!0),h=Zf(c,l,s);if(h!=null)return h;{let u=re.getInstance().getNet(l);return u!=null&&(u==null?void 0:u.netDifferential)!=null?re.getInstance().getDifferentialPhysicsByNet(l).getStrokeWidthDefault(s):re.getInstance().getTrackPhysicsByNet(l).getDefaultWidth(s)}}return r}static getMinDifWidth(t,e,r,i){let n=t&&Ao(t)||"",s=re.getInstance().getNet(n),a=s&&s.netDifferential!=null,l=a&&i&&i.some(u=>!(s.netDifferential.positiveNet.hasNet(u)||s.netDifferential.negativeNet.hasNet(u)));a&&l&&(a=!1);let c=Ts(e,r,!0),h=Ene(c,n,r);return h!=null?h:a?re.getInstance().getDifferentialPhysicsByNet(n).getStrokeWidthMin(r):re.getInstance().getTrackPhysicsByNet(n).getMinWidth(r)}static getMaxDifWidth(t,e,r,i){let n=t&&Ao(t)||"",s=re.getInstance().getNet(n),a=s&&s.netDifferential!=null,l=a&&i&&i.some(u=>!s.netDifferential.positiveNet.hasNet(u)||!s.netDifferential.negativeNet.hasNet(u));a&&l&&(a=!1);let c=Ts(e,r,!0),h=One(c,n,r);return h!=null?h:a?re.getInstance().getDifferentialPhysicsByNet(n).getStrokeWidthMax(r):re.getInstance().getTrackPhysicsByNet(n).getMaxWidth(r)}static getViaRadius(t,e,r){let i={radius:ut.defaultVia.radius,innerRadius:ut.defaultVia.innerRadius};if(r)return i;if(le.pcbConfig.startViaSize=="rule"){let n;if(e){let s=Ts(t,o.getLayerId(e)),a=Q8(s);if(a!=null)return a;{let l=o.getNetByItem(e);return n=re.getInstance().getRadiusPhysicsByNet(l),i={radius:n.defalutRadius,innerRadius:n.defalutInner},i}}else return n=re.getInstance().getRadiusPhysicsByNet(""),i={radius:n.defalutRadius,innerRadius:n.defalutInner},i}else return i}static getDirect(t,e){if(e instanceof Ir){let r=new pR(e);if(r.startType==null&&t.equals(e.start))return{direct:e.direct.mirrorCenter(),allowModify:!1};if(r.endType==null&&t.equals(e.end))return{direct:e.direct,allowModify:!1}}else if(e instanceof yi){let r=new pR(e);if(r.startType==null&&t.equals(e.start))return{direct:O8(e.primitive,!1),allowModify:!1};if(r.endType==null&&t.equals(e.end))return{direct:O8(e.primitive),allowModify:!1}}return{direct:new S(1,0),allowModify:!0}}static getSignalLayerIds(t,e){if(t instanceof Le||t instanceof et)return ar(t.layerId)?Ze.getInstance().getAllSignalLayerIds():[e];if(t instanceof Ue||t instanceof Ct)if(t.type==1){let r=Ze.getInstance(),i=new Array;t.isContains(1)&&i.push(1);for(let n=15;n<=46;n++){if(!t.isContains(n))continue;let s=r.getLayer(n);s!=null&&s.config&&ns(s.type)&&i.push(n)}return t.isContains(2)&&i.push(2),i}else return Ze.getInstance().getAllSignalLayerIds();else return[e]}static autoEndItem(t,e,r,i,n){let s=kt.search(new ht(t.x,t.x,t.y,t.y),(u,d)=>d==null?!1:qL.includes(d)),a=new lT;s.setAction(a),s.doAction(qL);let l=a.items;n&&(n=n.filter(u=>u instanceof et),l=l.filter(u=>!n.includes(u.model))),Er(l,(u,d)=>h(u)-h(d),0,l.length);let c=[e];i&&(c=i);for(let u of l)if(u instanceof Ge){if(c.includes(u.layerId)&&u.net==r&&u.isVisible&&u.isSelect(t.x,t.y))return u}else if(u instanceof Le){if((ar(u.layerId)||c.includes(u.layerId))&&u.net==r&&u.isSelect(t.x,t.y))return u}else if(u instanceof Ue){let d=!1;for(let p of c)if(u.isContains(p)){d=!0;break}if(d&&u.net==r&&u.isVisible&&u.isSelect(t.x,t.y))return u}else if(u instanceof He){let d=u.type;if(d!="Partition"&&d!="Board Outline"&&d!="Prohibited Region"&&d!="Slot Region"&&d!="Copper Region"&&d!="Constraint Region"&&u.net==r&&c.includes(u.layerId)&&u.isVisible&&u.isSelect(t.x,t.y))return u}return null;function h(u){return u instanceof Ge?2:u instanceof Le?0:u instanceof Ue?1:u instanceof He?3:1e3}}};function Ts(o,t,e=!0,r=!1){let i=no.searchConstraints(o,t,e,r);return i=i.filter(n=>n.inShape(o.x,o.y)),i}function Zf(o,t,e){if(o.length>0){let r=re.getInstance().getNet(t),i=r!=null&&r.netDifferential!=null;for(let n of o){let s=re.getInstance().getRegion(n.globalIndex);if(i){if(s.diff)return re.getInstance().getDifferentialPhysics(s.diff).getStrokeWidthDefault(e)}else if(s.track)return re.getInstance().getTrackPhysics(s.track).getDefaultWidth(e)}return null}else return null}function Ene(o,t,e){if(o.length>0){let r=re.getInstance().getNet(t),i=r!=null&&r.netDifferential!=null;for(let n of o){let s=re.getInstance().getRegion(n.globalIndex);if(i){if(s.diff)return re.getInstance().getDifferentialPhysics(s.diff).getStrokeWidthMin(e)}else if(s.track)return re.getInstance().getTrackPhysics(s.track).getMinWidth(e)}return null}else return null}function One(o,t,e){if(o.length>0){let r=re.getInstance().getNet(t),i=r!=null&&r.netDifferential!=null;for(let n of o){let s=re.getInstance().getRegion(n.globalIndex);if(i){if(s.diff)return re.getInstance().getDifferentialPhysics(s.diff).getStrokeWidthMax(e)}else if(s.track)return re.getInstance().getTrackPhysics(s.track).getMaxWidth(e)}return null}else return null}function Q8(o){if(o.length>0){for(let t of o){let e=re.getInstance().getRegion(t.globalIndex);if(e.radius){let r=re.getInstance().getRadiusPhysics(e.radius);return{radius:r.defalutRadius,innerRadius:r.defalutInner}}}return null}else return null}function Vb(o,t,e,r){let i=re.getInstance().getNet(t),n=i!=null&&i.netDifferential;if(n!=null&&n.hasNet(e))for(let a of o){let l=re.getInstance().getRegion(a.globalIndex);if(l.diff)return re.getInstance().getDifferentialPhysics(l.diff).getDifferentialPairSpacingDefault(r)}else for(let a of o){let l=re.getInstance().getRegion(a.globalIndex);if(l.safeClearance)return re.getInstance().getSafeSpacing(l.safeClearance).getClearance(0,0,r)}return null}function D3(o,t){if(o instanceof zr)return o.direct;if(o instanceof Ii){let e=o.center,r=t.sub(e).normalize();return o.sweep==ae.CCW?new S(-r.y,r.x):new S(r.y,-r.x)}}var Ane=class{getConstraintListInfo(t,e,r,i,n){let s=this.getConstraintEvent(t,e,r,i,n);if(!s)return null;let a=t.tracks.length,l=Math.floor(a/2),c=new Zr,h=new Lr,u=new Array;for(let d=0;d<a;d++){let p=x0.getDistance(t,t.tracks[d]),g=x0.getDistance(s,s.tracks[d])-p,y=r[d];if(y.size()<=0){let H=c.createList();u.push(H);continue}let b=y.getAllItems(),P=b.map(H=>H.primitive),T=this.getDirect(b[0],b[0].start),I=this.getDirect(b[b.length-1],b[b.length-1].end),C,E;d>=l?(C=new S(T.y,-T.x),E=new S(I.y,-I.x)):(C=new S(-T.y,T.x),E=new S(-I.y,I.x));let O=b[0].start.add(C.mul(g)),_=b[b.length-1].end.add(E.mul(g));if(O.equals1(_)){u.push(c.createList());continue}let v=new Gie(O,_,P).result;this.debugPolyline(v,{color:ee.GREEN,msg:"panList",distance:g,net:t.tracks[d].net});let D=c.createList();for(let H of v)H instanceof q?c.drawInfoArcTrack([H],s.tracks[d],h,D):H instanceof M&&c.drawInfoTrack([H.start(),H.end()],s.tracks[d],h,D);let w=y.getFirstNode(),F=D.getFirstNode();for(;F&&w;)F.fanoutInfo=w.fanoutInfo||F.fanoutInfo,w=w.next,F=F.next;u.push(D)}return{increaseLists:u,command:h,event:s}}getDirect(t,e){if(t instanceof zr)return t.direct;if(t instanceof Ii){let r=t.center,i=e.sub(r).normalize();return t.sweep==ae.CCW?new S(-i.y,i.x):new S(i.y,-i.x)}}debugPolyline(t,e={color:ee.GREEN}){if(Gr.debug&&this.debug!=null){let r=[];for(let i of t){let n=new Gn(i,e);r.push(n)}this.debug.add(new Cd(r))}}sort(t){let e=t.listIterator(),r=[];for(;e.hasNext();){let i=e.next();P0(i.points,i.item),i.points.forEach(n=>{r.find(a=>a.point.equals1(n.point)&&a.model===n.model)||r.push(n)})}return r}add4Batch(t,e,r,i,n,s){let a=new Map;for(let c of t){let h=At.getInstance().getNode(c.model).parent,u=a.get(h);u==null&&(u=[],a.set(h,u)),u.push(c)}let l=new Array;for(let[c,h]of a){let u=c.toArray();h.sort((C,E)=>{let O=u.indexOf(C.model),_=u.indexOf(E.model);if(O==_){let x=P0([C,E],C.model.primitive);return x.indexOf(C)-x.indexOf(E)}else return O-_});let d=h,p=r.indexOf(c),m=i.tracks[p],g=s.get(m);if(g&&(d=h.filter(C=>!g.find(E=>C.point.equals(E.point)))),!d.length)continue;let b=d[0].model,P=b.start,T=jr.inPolyline(P,e);if(T&&d.some(C=>C.point.equals1(P))){let C=D3(b,P),E=Math.min(C.length(),b.length),O=P.add(C.mul(E)),_=n.inShape(O.x,O.y);T=T&&!_}d=d.splice(0,2);let I=null;for(let C of d){if(T){I=new J4(C),I.start=null,I.end=C,l.push(I),T=!1;break}I==null?(I=new J4(C),l.push(I)):(I.end=C,I=null)}}return l}isIncrease(t,e){return this.calculateIncrease(t,e)<0}changeTrackWidthByGroup(t,e,r,i,n){let s=r&&r.end!=null&&r.start==null,a=i&&i.end!=null&&i.start==null,l=r&&r.start,c=i&&i.start,h=t.width;if(l&&(h=Zf([n],t.net,t.layerId)),s){let d=Ts(r.end.point,t.layerId).splice(1);h=Zf(d,t.net,t.layerId)}let u=e.width;if(c&&(u=Zf([n],e.net,e.layerId)),a){let d=Ts(i.end.point,e.layerId).splice(1);u=Zf(d,e.net,e.layerId)}if(!h){let d=re.getInstance().getNet(t.net);d!=null&&(d==null?void 0:d.netDifferential)!=null?h=re.getInstance().getDifferentialPhysicsByNet(t.net).getStrokeWidthDefault(t.layerId):h=re.getInstance().getTrackPhysicsByNet(t.net).getDefaultWidth(t.layerId)}if(!u){let d=re.getInstance().getNet(e.net);d!=null&&(d==null?void 0:d.netDifferential)!=null?u=re.getInstance().getDifferentialPhysicsByNet(e.net).getStrokeWidthDefault(t.layerId):u=re.getInstance().getTrackPhysicsByNet(e.net).getDefaultWidth(t.layerId)}t.width=h,e.width=u}changeTrackSavespaceByGroup(t,e,r=!1,i,n,s){let a=i&&i.end!=null&&i.start==null,l=n&&n.end!=null&&n.start==null,c=i&&i.start,h=n&&n.start,u=t.next.width;if(a&&l){let d=Ts(i.end.point,t.layerId),p=Ts(n.end.point,e.layerId),m=gI(Array.from(d).concat(p).filter(g=>g!==s));u=Vb(m,t.net,e.net,t.layerId),u||(r?u=re.getInstance().getDifferentialPhysicsByNet(t.net).getDifferentialPairSpacingDefault(t.layerId):u=re.getInstance().getSafeClearance({id:"",net:t.net,layerId:t.layerId,shapeType:0},{id:"",net:e.net,layerId:e.layerId,shapeType:0},t.layerId))}return c&&h&&(u=Vb([s],t.net,e.net,t.layerId),u||(r?u=re.getInstance().getDifferentialPhysicsByNet(t.net).getDifferentialPairSpacingDefault(t.layerId):u=re.getInstance().getSafeClearance({id:"",net:t.net,layerId:t.layerId,shapeType:0},{id:"",net:e.net,layerId:e.layerId,shapeType:0},t.layerId))),t.end.model&&(u=t.next.width),t.next.width=u,u}getConstraintEvent(t,e,r,i,n){let s=t.clone(),a=s.tracks,l=t.node.layerId,c=n0.getInstance().getList(e),h=c.toArray(),u=this.sort(c);this.debugInters(u);let d=this.add4Batch(u,ge.build2(h),r,t,e,i);if(!d.length)return null;this.checkGroups(d,n,r,l,e),this.debugGroups(d);let p=le.pcbConfig.startTrackWidth=="rule";for(let m=0;m<a.length-1;m++){let g=a[m],y=a[m+1],b=r[m],P=r[m+1],T=d.find(O=>O.list===b),I=d.find(O=>O.list===P),C=re.getInstance().getNet(g.net),E=g.net&&C&&C.hasNet(y.net);this.changeTrackSavespaceByGroup(g,y,E,T,I,e),p&&this.changeTrackWidthByGroup(g,y,T,I,e)}return s}checkGroups(t,e,r,i,n){var s,a,l,c;for(let h=0;h<r.length;h++){let u=r[h],d=e.get(h),p=t.find(m=>m.list===u);if(p){let m=p.start,g=p.end;if(m){let y=m.point,b=d.findIndex(T=>T.point.equals1(y));if(Ts(y,i)[0].globalIndex!==n.globalIndex){let T=null;for(let I=b+1;I<d.length;I++)d[I].type===0&&((s=Ts(d[I].point,i)[1])==null?void 0:s.globalIndex)===n.globalIndex&&(T=d[I].point);T?m.point=T:p.start=null}}if(g){let y=g.point,b=d.findIndex(T=>T.point.equals1(y)),P=Ts(y,i);if(P[0].globalIndex!==n.globalIndex){let T=null;for(let I=b-1;I>=0;I--)d[I].type===1&&((a=Ts(d[I].point,i)[1])==null?void 0:a.globalIndex)===n.globalIndex&&(T=d[I].point);T?g.point=T:p.end=null}if(m){let T=m.point,I=Ts(T,i);P[1]&&((l=I[1])==null?void 0:l.globalIndex)!=((c=P[1])==null?void 0:c.globalIndex)&&(p.end=null)}}}}}debugInters(t){if(t.length>0&&Gr.debug&&this.debug!=null)for(let e of t){let r=new Gn(new M(e.point,e.point),{color:ee.GREEN}),i=new Gn(e.model.primitive,{color:ee.Golden,net:e.model.net}),n=new B8(r,i,0);this.debug.add(n)}}debugGroups(t){if(t.length>0&&Gr.debug&&this.debug!=null)for(let e of t)e.debug(this.debug)}getDistance(t,e){return new Eu(t.primitive,e.primitive).getDistance()}calculateIncrease(t,e){return this.getEventWidth(t)-this.getEventWidth(e)}getEventWidth(t){let e=0;for(let r of t.tracks)e+=r.width;for(let r of t.gaps)e+=r.width;return e}};var _ne=class{constructor(t){this.stack=new Array;this.group=0;this.i=0;this.debug=!0;this.pause=!1;this.group=t}add(t){this.debug&&this.stack.push(t)}play(){this.isEnd()&&(this.i=0),this.stack[this.i].display(),he.publish("updateFrame",""),this.i++}isStart(){return this.i==0}isEnd(){return this.i==this.stack.length}init(){for(let t of this.stack)t.remove();this.i=0}clear(){for(let t of this.stack)t.remove();he.publish("updateFrame","")}};var gR=class extends Ly{constructor(){super(...arguments);this.isEmpty=!1}},J4=class{constructor(t){this.end=null;this.parent=null;this.start=t,this.list=At.getInstance().getNode(t.model).parent,this.net=t.model.net}debug(t){if(Gr.debug&&t!=null){let e=[];if(this.start!=null){let i=new Gn(new M(this.start.point,this.start.point),{color:ee.BLUE,msg:"ConstraintTrackGroup"});e.push(i)}if(this.start!=null&&this.end!=null){let i=new Gn(new M(this.start.point,this.end.point),{color:ee.BLUE,msg:"ConstraintTrackGroup"});e.push(i)}if(this.end!=null){let i=new Gn(new M(this.end.point,this.end.point),{color:ee.BLUE,msg:"ConstraintTrackGroup"});e.push(i)}let r=new Cd(e);t.add(r)}}isSameList(t){return this.list==At.getInstance().getNode(t.model).parent}getStartDirect(){return this.start!=null?this.start.model.direct:this.list.getFirst().direct}getEndDirect(){return this.end!=null?this.end.model.direct.mul(-1):this.list.getLast().direct.mul(-1)}getTrackInfo(){if(this.start!=null&&this.end!=null){let t=this.start.model.layerId,e=this.start.model.direct,r=new v0(this.start.model.net,this.start.model.width,t,e,!1);return r.start=new gR(new Set([t]),t,this.start.point,e,!1),r.end=new gR(new Set([t]),t,this.end.point,this.end.model.direct,!1),r}else if(this.start!=null&&this.end==null){let t=this.start.model.layerId,e=this.start.model.direct,r=new v0(this.start.model.net,this.start.model.width,t,e,!1);r.start=new gR(new Set([t]),t,this.start.point,e,!1);let i=this.list.getLast();return r.end=new gR(new Set([t]),t,i.end,i.direct,!1),r.end.isEmpty=!0,r}else if(this.start==null&&this.end!=null){let t=this.end.model.layerId,e=this.list.getFirst(),r=e.direct,i=new v0(this.end.model.net,this.end.model.width,t,r,!1);return i.start=new gR(new Set([t]),t,e.start,r,!1),i.end=new gR(new Set([t]),t,this.end.point,this.end.model.direct,!1),i.start.isEmpty=!0,i}}syncTrackInfo(t){if(this.start!=null&&this.end!=null){let e=D3(this.start.model,this.start.point);t.width=this.start.model.width,t.direct=e,t.start.point=this.start.point,t.start.direct=e,t.start.state=new My(1,!0),t.end.direct=D3(this.end.model,this.end.point),t.end.point=this.end.point,t.end.state=new My(1,!1),t.start.model=this.start.model,t.end.model=this.end.model}else if(this.start!=null&&this.end==null){let e=D3(this.start.model,this.start.point);t.width=this.start.model.width,t.direct=e,t.start.point=this.start.point,t.start.direct=e,t.start.state=new My(1,!0);let r=this.list.getLast();t.end.point=r.end,t.end.direct=D3(r,r.end),t.end.state=new My(3,!1),t.start.model=this.start.model,t.end.model=null}else if(this.start==null&&this.end!=null){let e=this.list.getFirst(),r=D3(e,e.start);t.direct=r,t.start.direct=r,t.start.state=new My(3,!0),t.end.direct=D3(this.end.model,this.end.point),t.end.point=this.end.point,t.end.state=new My(1,!1),t.start.model=null,t.end.model=this.end.model}}},w3=class o{constructor(){this.profiles=new Set;this.orders=new Map;this.blockShape=new ane;this.points=new Map;this.startListMapPrimitives=new Map;this.endListMapPrimitives=new Map}run(t,e){this.initDebug(e);let r=t.clone();this.checkConstraint(e,r);let i=null;for(let n of this.profiles){this.points=new Map,r.position=t.position;let s=this.getConstraintEvents(n,e,r);if(s!=null){t.nextEvent=r;let a=new x3;for(let l=0;l<t.tracks.length;l++){let c=t.tracks[l],h=s.result[l];Zt.getInstance().type!=="WIRING_CORNER_ARC"&&a.optimization(h,c,s.command)}i!=null&&i.undo(),e=s.result,i=s.command}}return Gr.inputClear(),this.clearList(),i==null?null:(t.result.command.addCommand(i),{result:e,command:i})}compareOrder(t,e){var n,s;if(!t)return-1;if(!e)return 1;let r=((n=t.component.name.match(/\d+$/))==null?void 0:n[0])||0,i=((s=e.component.name.match(/\d+$/))==null?void 0:s[0])||0;return Number(i)-Number(r)}runSingle(t,e){if(!e||e.size()<=0)return;let r=[e],i=t.clone();this.checkConstraint(r,i);let n=i.node,s=null,a=this.orders.get(0),l=a.order.length;for(let u=1;u<l;u++){let d=a.order[u],p=a.current,m=p.type,g=d.type;if(m==0){let O=Ts(p.point,n.layerId)[1];p.type=1,p.profile=O}let y=this.compareOrder(d.profile,p.profile);if(y==0||y>0)a.current=d;else continue;let b=this.initPathLists(i.tracks.length),P=new Lr;this.checkConstraintProfile2(r);let T=this.splitEvent2(i,r,n);if(!T)continue;if(t.nextEvent=i,T.prev!=null){let E=this.interceptList(T.prev,r,!0,!1,n);this.addLists(b,E.result,P),E.command.undo()}let I=!1;g===0&&(I=!0);let C=this.interceptList(T.current,r,I,!1,n);if(this.addLists(b,C.result,P),C.command.undo(),n.width=T.current.node.width,T.next!=null){let E=!!T.prev;d.type==0&&Ts(a.current.point,t.node.layerId)[1]==a.order[0].profile&&(T.next.node.width=t.node.width);let O=this.interceptList(T.next,r,E,!1,n);this.addLists(b,O.result,P);let _=t.clone();_.node.width=T.next.node.width,t.nextEvent=_,n.width=T.next.node.width,O.command.undo()}s!=null&&s.undo(),r=b,s=P}if(this.clearList(),s==null)return null;t.result.command.addCommand(s);let c=t.tracks.indexOf(t.node);return r[c]}initDebug(t){if(Gr.debug){this.debug=new _ne(1),Gr.input(this.debug);for(let e of t){let r=e.iterator(),i=[];for(;r.hasNext();){let n=r.next(),s=new Gn(n.primitive,{color:ee.Golden,id:n.globalIndex,net:n.net,width:n.width});i.push(s)}this.debug.add(new Cd(i))}this.blockShape.debug=this.debug}}clearList(){for(let t of this.profiles){let e=n0.getInstance().getList(t);this.clear(e)}this.profiles.clear(),Gr.debug&&Gr.inputClear()}checkConstraint(t,e){this.clearList();for(let i of t){if(i.size()==0)continue;let n=i.getAllItems();for(let s of n){let a=this.blockShape.blockTrack(s,s.primitive);Er(a,(l,c)=>this.constraintDistance(s,l)-this.constraintDistance(s,c)),xe.addAllSet(this.profiles,a)}}let r=0;for(let i of t){if(i.size()===0)continue;let n=this.getBlockPointOrder(i,e);this.orders.set(r++,{current:n[0],order:n})}}getBlockPointOrder(t,e){let r=t.getAllItems(),i=new Set;for(let l of r){let c=this.blockShape.blockTrack(l,l.primitive);xe.addAllSet(i,c)}let n=[];for(let l of i){this.checkConstraintProfile([t],l);let c=n0.getInstance().getList(l),h=c.toArray(),u=this.sort(c);if(!u.length)continue;let d=this.add4Batch(u,ge.build2(h),[t],e,l),p=d[0].start,m=d[0].end;p&&n.push({type:1,point:p.point,profile:l}),m&&n.push({type:0,point:m.point,profile:l})}let s=t.getFirst().start,a=Ts(s,e.node.layerId)[0];return Er(n,(l,c)=>l.point.distance1(s)-c.point.distance1(s)),a?n.unshift({type:1,point:s,profile:a}):n.unshift({type:1,point:s,profile:null}),n}constraintDistance(t,e){let i=n0.getInstance().getList(e).toArray(),n=1/0;for(let s of i){let a=Pt(s,t.primitive);for(let l=0;l<a;l+=2){let h=new S(Ee[l],Ee[l+1]).sub(t.start).length();n>h&&(n=h)}}return n}checkConstraintProfile(t,e){let r=n0.getInstance().getList(e);this.clear(r);for(let i of t){let n=i.listIterator();for(;n.hasNext();){let a=n.next().item;this.blockShape.blockTrackProfile(a,a.primitive,e)}}}checkConstraintProfile2(t){for(let[e,r]of this.orders){let i=t[e],n=r.current.profile,s=n0.getInstance().getList(n);this.clear(s);let a=i.listIterator();for(;a.hasNext();){let c=a.next().item;this.blockShape.blockTrackProfile(c,c.primitive,n)}}}splitPath2(t,e){let r=[];return t.forEach((i,n)=>{let s=[],a=i.getFirstNode();for(;a;)s.push(a),a=a.next;let l=e[n],c=[];if(l){for(a=l.getFirstNode();a;)c.push(a),a=a.next;let h=c.length,d=s.length-h,p=s.splice(d);return r.push([s,p])}else{r.push([s,[]]);return}}),r}splitPath(t,e){let r=[];return t.forEach((i,n)=>{let s=[],a=e[n],l=i.getFirstNode();for(;l;)s.push(l),l=l.next;let c=s.indexOf(a);if(c<0)return r.push([s,[]]);{let h=s.splice(c+1);return r.push([s,h])}}),r}moveEndFanout(t,e,r,i){var s;let n=t[0];for(;n&&!n.fanoutInfo;)n=n.next;if(n&&n.fanoutInfo){let a=n.fanoutInfo,l=e[e.length-1],c=l.item.end,h=l.item.width+r+n.item.width;if(!(n.item.start.distance1(c)>=h)){let u=Math.cos(Math.PI/4),d=Math.abs(a.delta*u),p=h-d,m=(s=n.next)==null?void 0:s.item,g=m==null?void 0:m.direct;if(g){let y=new S(-g.y,g.x),b=c.add(y.mul(2)),P=c2(c,b,m.start,m.end),T=P.sub(c).length();if(T<p){let I=Math.sqrt(p*p-T*T),C=P.sub(m.start).length();I-=C,this.moveEndPath(n,t,I*u,i)}}}}}changeDiffEndFanout(t,e,r,i,n){let s=r.tracks,a=i.tracks,l=r.tracks.length,c=Math.floor(l/2),h=this.splitPath(t,e);for(let u=0;u<l-1;u++){let d=s[u],p=s[u+1],m=a[u],g=a[u+1],y=!1,b=re.getInstance().getNet(d.net);if(b&&b.netDifferential&&re.getInstance().getNet(p.net).netDifferential==b.netDifferential&&(y=!0),y){let P=d.next,T=m.next;if(P==null||T==null)return;let I=P.preWidth+d.width/2+p.width/2,C=T.width+m.width/2+g.width/2;if(I==C)return;if(I>C){let E=h[u][0],O=h[u][1],_=h[u+1][0],x=h[u+1][1];O&&O.length>0&&x&&x.length>0&&(this.moveEndFanout(O,_,T.width,n),this.moveEndFanout(x,E,T.width,n))}u+=1}}}moveFanout(t,e,r,i){let n=t[t.length-1];for(;n&&!n.fanoutInfo;)n=n.prev;if(n&&n.fanoutInfo){let s=n.fanoutInfo,a=e[0],l=a.item.start,c=a.item.width+r+n.item.width;if(!(n.item.start.distance1(l)>=c)){let h=Math.cos(Math.PI/4),u=Math.abs(s.delta*h),d=c-u,p=n.prev;if(p==null)return;let m=p.item.direct;if(p&&m){let g=new S(-m.y,m.x),y=l.add(g.mul(2)),b=c2(l,y,p.item.start,p.item.end);if(b==null)return;let P=b.sub(l).length();if(P<d){let T=Math.sqrt(d*d-P*P),I=b.sub(p.item.end).length();T-=I,this.movePath(n,t,T*h,i)}}}}}changeDiffFanout(t,e,r,i,n){let s=r.tracks,a=i.tracks,l=r.tracks.length,c=this.splitPath(t,e);for(let h=0;h<l-1;h++){let u=s[h],d=s[h+1],p=a[h],m=a[h+1],g=!1,y=re.getInstance().getNet(u.net);if(y&&y.netDifferential&&re.getInstance().getNet(d.net).netDifferential==y.netDifferential&&(g=!0),g){let b=u.next,P=p.next,T=b.preWidth+u.width/2+d.width/2,I=P.width+p.width/2+m.width/2;if(T==I)return;if(T<I){let C=c[h][0],E=c[h][1],O=c[h+1][0],_=c[h+1][1];E&&E.length>0&&_&&_.length>0&&(this.moveFanout(C,_,P.width,n),this.moveFanout(O,E,P.width,n))}h+=1}}}movePath(t,e,r,i){let n=e.indexOf(t),s=e[n-1],a=e[n+1];if(!s||!t)return;let c=s.item.direct.mul(-1),h=s.item.start,u=this.getDistByDirect(s.item.end,c,r),d=this.getDistByDirect(t.item.start,c,r),p=this.getDistByDirect(t.item.end,c,r),m=t.item.end,g=t;a&&(m=a.item.end,g=a);let y=new Zr,b=y.createList(),P=y.createTrack(s.item.layerId,h,u,s.item.width,s.item.showNet,i,s.item.getGroupID()),T=y.createTrack(t.item.layerId,d,p,t.item.width,t.item.showNet,i,t.item.getGroupID()),I=y.createTrack(g.item.layerId,p,m,g.item.width,g.item.showNet,i,g.item.getGroupID());y.addList(P,b,i),y.addList(T,b,i),y.addList(I,b,i);let C=b.getFirstNode().next;C.fanoutInfo=t.fanoutInfo,b.replace(s,g),i.addCommand(new mi(b))}moveEndPath(t,e,r,i){let n=e.indexOf(t),s=e[n+1],a=e[n-1];if(!s||!t)return;let l=s.item.direct,c=this.getDistByDirect(s.item.start,l,r),h=s.item.end;if(h.sub(c).dot(l)<0)return;let p=this.getDistByDirect(t.item.start,l,r),m=this.getDistByDirect(t.item.end,l,r),g=t.item.start,y=t;a&&(g=a.item.start,y=a);let b=new Zr,P=b.createList(),T=b.createTrack(y.item.layerId,g,p,y.item.width,y.item.showNet,i,y.item.getGroupID()),I=b.createTrack(t.item.layerId,p,m,t.item.width,t.item.net,i,t.item.getGroupID()),C=b.createTrack(s.item.layerId,c,h,s.item.width,s.item.showNet,i,s.item.getGroupID());b.addList(T,P,i),b.addList(I,P,i),b.addList(C,P,i);let E=P.getFirstNode().next;E.fanoutInfo=t.fanoutInfo,P.replace(y,s),i.addCommand(new mi(P))}getDistByDirect(t,e,r){return t.add(e.mul(r))}getPreEndNodes(t){let e=[];return t.forEach(r=>{let i=r.getLastNode();e.push(i)}),e}getOrderMap(t,e){let r=new Map,i=0;for(let n of t){let s=this.getBlockPointOrder(n,e);r.set(i++,s)}return r}getConstraintEvents(t,e,r){let i=this.getOrderMap(e,r);this.checkConstraintProfile(e,t);let n=new Ane,s=n.getConstraintListInfo(r,t,e,this.points,i);return s?n.isIncrease(r,s.event)?this.increaseFanout(r,e,s,t):this.decreaseFanout(r,e,s,t):null}increaseFanout(t,e,r,i){let n=r.increaseLists;this.checkConstraintProfile(n,i);let s=new Lr,a=this.splitEvent(t,n,i),l=e.length,c=this.initPathLists(l);if(a.prev!=null){this.syncChangeEvent(a.current,r.event,a.next?null:r.increaseLists);let h,u,d=this.alignPath(r.event,n,a.prev),p=this.fanout90(d.cornerEvent,e,t,r.event);this.addLists(c,d.startResult,s),this.addLists(c,p.result,s),this.addLists(c,d.endResult,s),d.command.undo(),p.command.undo(),u=this.getPreEndNodes(c);let m=this.interceptList(a.current,n,!1,!1);if(this.addLists(c,m.result,s),m.command.undo(),a.next!=null){h=this.getPreEndNodes(c);let g=this.alignPath(r.event,n,a.next),y=this.fanout90(g.cornerEvent,e,t,r.event);this.addLists(c,g.startResult,s),this.addLists(c,y.result,s),this.addLists(c,g.endResult,s),g.command.undo(),y.command.undo()}u&&this.changeDiffFanout(c,u,t,r.event,s),h&&this.changeDiffEndFanout(c,h,r.event,t,s),a.next==null&&this.syncCloneEvent(t,r.event,n);for(let g=0;g<l;g++)c[g].size()==0&&this.addList(c[g],e[g],s);return r.command.undo(),{result:c,command:s}}else{let h,u=this.alignPath(t,r.increaseLists,a.current),d=this.fanout90(u.cornerEvent,e,t,r.event);if(this.addLists(c,u.startResult,s),this.addLists(c,d.result,s),this.addLists(c,u.endResult,s),u.command.undo(),d.command.undo(),a.next!=null){this.syncChangeEvent(a.next,r.event,r.increaseLists),h=this.getPreEndNodes(c);let p=this.interceptList(a.next,e,!1,!1);this.addLists(c,p.result,s),p.command.undo(),h&&this.changeDiffFanout(c,h,t,r.event,s),this.syncCloneEvent(t,r.event,n)}for(let p=0;p<l;p++)c[p].size()==0&&this.addList(c[p],e[p],s);return r.command.undo(),{result:c,command:s}}}decreaseFanout(t,e,r,i){let n=e.length,s=this.initPathLists(n),a=new Lr,l=this.splitEvent(t,e,i);if(l.prev!=null){let c,h;this.syncChangeEvent(l.current,r.event,l.next?null:r.increaseLists);let u=this.interceptList(l.prev,e,!0);this.addLists(s,u.result,a),u.command.undo(),h=this.getPreEndNodes(s);let d=this.alignPath(t,e,l.current),p=this.fanout90(d.cornerEvent,r.increaseLists,t,r.event);if(this.addLists(s,d.startResult,a),this.addLists(s,p.result,a),this.addLists(s,d.endResult,a),d.command.undo(),p.command.undo(),l.next!=null){c=this.getPreEndNodes(s);let m=this.interceptList(l.next,e,!0,!1);this.addLists(s,m.result,a),m.command.undo()}h&&this.changeDiffEndFanout(s,h,t,r.event,a),c&&this.changeDiffFanout(s,c,r.event,t,a),l.next==null&&this.syncCloneEvent(t,r.event,r.increaseLists);for(let m=0;m<n;m++)s[m].size()==0&&this.addList(s[m],e[m],a);return r.command.undo(),{result:s,command:a}}else{let c,h=this.interceptList(l.current,e,!0);if(this.addLists(s,h.result,a),h.command.undo(),l.next!=null){this.syncChangeEvent(l.next,r.event,r.increaseLists),c=this.getPreEndNodes(s);let u=this.alignPath(t,e,l.next),d=this.fanout90(u.cornerEvent,r.increaseLists,t,r.event);this.addLists(s,u.startResult,a),this.addLists(s,d.result,a),this.addLists(s,u.endResult,a),u.command.undo(),d.command.undo(),c&&this.changeDiffEndFanout(s,c,t,r.event,a),this.syncCloneEvent(t,r.event,r.increaseLists)}for(let u=0;u<n;u++)s[u].size()==0&&this.addList(s[u],e[u],a);return r.command.undo(),{result:s,command:a}}}syncChangeEvent(t,e,r){e.gaps.forEach((i,n)=>{t.gaps[n].width=i.width}),e.tracks.forEach((i,n)=>{t.tracks[n].width=i.width}),r&&t.tracks.forEach((i,n)=>{r[n].size()&&(i.end.point=r[n].getLast().end)})}syncCloneEvent(t,e,r){t.gaps.forEach((i,n)=>{i.width=e.gaps[n].width}),t.tracks.forEach((i,n)=>{if(r[n].size()){let s=r[n].getLast();i.width=e.tracks[n].width,i.end.point=s.end}})}interceptList(t,e,r=!1,i=!0,n){var u,d;let s=t.tracks.length,a=t.getCornerEvent(),l=new Array(s),c=new Zr,h=new Lr;for(let p=0;p<s;p++){let m=t.tracks[p];if(n&&n.net!=m.net)continue;let g=a.tracks[p],y=m.start.state,b=m.end.state;if(y instanceof My&&y.state==1?g.start.fix=!1:g.start.fix=!0,b instanceof My&&b.state==1?g.end.fix=!1:g.end.fix=!0,!g.start.fix||!g.end.fix){let P=n?e[0]:e[p];if(P){let T=P.getAllItems(),I=T.map(x=>x.primitive),C=new Zl(g.start.point,g.end.point,I),E=C.result,O=new Map;if(r){let x=I.indexOf(C.startpt);E.forEach((v,D)=>{O.set(v,T[x+D])})}this.debugPolyline(E,{color:ee.GREEN,msg:"interceptList"});let _=c.createList();for(let x of E)x instanceof q?c.drawInfoArcTrack([x],t.tracks[p],h,_,(u=O.get(x))==null?void 0:u.width):x instanceof M&&c.drawInfoTrack([x.start(),x.end()],t.tracks[p],h,_,(d=O.get(x))==null?void 0:d.width);if(l[p]=_,i){let x=P.getFirstNode(),v=_.getFirstNode();for(;v&&x;){let D=x.fanoutInfo;D&&(v.fanoutInfo=D),x=x.next,v=v.next}}}}}return{result:l,command:h}}addLists(t,e,r){let i=t.length;for(let n=0;n<i;n++)this.addList(t[n],e[n],r)}getStartPrimitives(t){let e=this.startListMapPrimitives.get(t);return e==null&&(e=t.getAllItems().map(i=>i.primitive),this.startListMapPrimitives.set(t,e)),e}getEndPrimitives(t){let e=this.endListMapPrimitives.get(t);return e==null&&(e=this.getStartPrimitives(t),e=IVe(e),this.endListMapPrimitives.set(t,e)),e}initPathLists(t){let e=new Zr,r=new Array(t);for(let i=0;i<t;i++)r[i]=e.createList();return r}addList(t,e,r){if(e==null)return;let i=new Zr,n=e.listIterator();for(;n.hasNext();){let s=n.next(),a=s.item,l;a instanceof Ii?l=i.createArcTrack(a.layerId,a.center,a.radius,a.startAngle,a.endAngle,a.sweep,a.width,a.net,r,void 0,a.getGroupID()):l=i.createTrack(a.layerId,a.start,a.end,a.width,a.showNet,r,a.getGroupID());let c=i.addList(l,t,r);c.fanoutInfo=s.fanoutInfo}}splitEvent(t,e,r,i){let n=n0.getInstance().getList(r),s=n.toArray(),a=this.sort(n),l=t.node.layerId,c=this.add4Batch(a,ge.build2(s),e,t,r);if(!c.length||a.length<=0)return null;let h=this.getOrderMap(e,t);this.checkGroups(c,h,e,l,r);let u=-1;return i&&(u=t.tracks.indexOf(i)),this.splitSingleGroupEvent(t,e,c,r,i,u)}splitEvent2(t,e,r){var n,s;let i=[];for(let[a,l]of this.orders){let c=l.current.profile,h=l.current.type,u=e[a],d=n0.getInstance().getList(c),p=d.toArray(),m=this.sort(d),g=this.add4Batch(m,ge.build2(p),[u],t,c);if(!g.length||m.length<=0)return null;h===1?(l.current.point=(n=g[0].start)==null?void 0:n.point,g[0].end=null):(l.current.point=(s=g[0].end)==null?void 0:s.point,g[0].start=null),i.push(g[0]);let y=-1;return r&&(y=t.tracks.indexOf(r)),this.splitSingleGroupEvent(t,e,i,c,r,y)}}checkGroups(t,e,r,i,n){var s,a,l,c;for(let h=0;h<r.length;h++){let u=r[h],d=e.get(h),p=t.find(m=>m.list===u);if(p){let m=p.start,g=p.end;if(m){let y=m.point,b=d.findIndex(T=>T.point.equals1(y));if(Ts(y,i)[0].globalIndex!==n.globalIndex){let T=null;for(let I=b+1;I<d.length;I++)d[I].type===0&&((s=Ts(d[I].point,i)[1])==null?void 0:s.globalIndex)===n.globalIndex&&(T=d[I].point);T?m.point=T:p.start=null}}if(g){let y=g.point,b=d.findIndex(T=>T.point.equals1(y)),P=Ts(y,i);if(P[0].globalIndex!==n.globalIndex){let T=null;for(let I=b-1;I>=0;I--)d[I].type===1&&((a=Ts(d[I].point,i)[1])==null?void 0:a.globalIndex)===n.globalIndex&&(T=d[I].point);T?g.point=T:p.end=null}if(m){let T=m.point,I=Ts(T,i);P[1]&&((l=I[1])==null?void 0:l.globalIndex)!=((c=P[1])==null?void 0:c.globalIndex)&&(p.end=null)}}}}}splitSingleGroupEvent(t,e,r,i,n,s){let a=t.clone(),l=t.clone(),c=t.clone(),h=!1,u=!1,d=n0.getInstance().getList(i),p=this.sort(d),m=s>=0?l.tracks[s]:null;this.sortGroup(e,r,l,m);for(let y=0;y<a.tracks.length;y++){let b=a.tracks[y];if(n&&n.net!=b.net)continue;let P=l.tracks[y],T=P.start.state;T instanceof My&&T.state==1&&(b.end.point=P.start.point,b.end.direct=P.start.direct,b.end.state=T,h=!0)}h&&this.syncRule(l,i);for(let y=0;y<c.tracks.length;y++){let b=c.tracks[y];if(n&&n.net!=b.net)continue;let P=l.tracks[y],T=a.tracks[y],I=P.end.state;b.start.point=P.end.point,b.start.direct=P.end.direct,b.start.state=I,b.start.model=null,I instanceof My&&I.state==1&&(o.syncEventRule(b,i),u=!0)}h&&u&&a.tracks.forEach((y,b)=>{let T=l.tracks[b].start.state;T instanceof My&&T.state===1&&(c.tracks[b].width=y.width)});let g=u?c:l;return t.gaps.forEach((y,b)=>y.width=g.gaps[b].width),{prev:h?a:null,current:l,next:u?c:null}}alignPath(t,e,r){let i=new Zr,n=new Lr,s=r.getCornerEvent(),a=t.tracks.length;for(let m=0;m<a;m++){let g=r.tracks[m],y=s.tracks[m],b=g.start.state,P=g.end.state;b instanceof My&&b.state==1?y.start.fix=!1:y.start.fix=!0,P instanceof My&&P.state==1?y.end.fix=!1:y.end.fix=!0}let l=s.tracks.map(m=>m.start),c=s.tracks.map(m=>m.end),h=this.calculateReferDirect_v2(s,e);this.addDebugPoint(h,{color:ee.Golden,msg:"StartDirect"});let u=this.calculateReferDirect_v2(s,e,!1);this.addDebugPoint(h,{color:ee.Golden,msg:"endDirect"});let d=new Array(a);h!=null&&this.drawAlignEndPath(l,h,e,r,n,d,!1);let p=new Array(a);return u!=null&&this.drawAlignEndPath(c,u,e,r,n,p,!0),this.getReferCenterPoint(t,s,h,u,e),{startResult:d,endResult:p,command:n,cornerEvent:s}}getReferCenterPoint(t,e,r,i,n){let s=n.length,a=Math.floor(s/2);if(s%2==0){let l=n[a-1],c=n[a],h=e.tracks[a-1],u=e.tracks[a],d=t.tracks[a-1],p=t.tracks[a],m=l.getAllItems().map(w=>w.primitive),g=c.getAllItems().map(w=>w.primitive),y=r.direct,b=r.point,P=i.direct,T=i.point,I=this.totalWidth(t.tracks,t.gaps),C=this.totalWidth(e.tracks,e.gaps);I=C>I?C:I,t.tracks[0].width;let E=this.getCossPoint(b,y,m,I),O=this.getCossPoint(b,y,g,I),_=this.getCossPoint(T,P,m,I),x=this.getCossPoint(T,P,g,I),v,D;E&&O&&(v=E.add(O).mul(.5)),_&&x&&(D=_.add(x).mul(.5)),e.startCenter=v,e.endCenter=D}else{let l=n[a]}}getCossPoint(t,e,r,i=10){let n=null,s=new S(e.y,-e.x),a=t.add(s.mul(i)),l=t.add(s.mul(-1).mul(i)),c=new M(a,l);for(let h=0;h<r.length;h++){let u=r[h];if(u instanceof M){let d=zee(u.start(),u.end(),c.start(),c.end());if(d){n=d;break}}else if(u instanceof q){let d=Wee(u,c);if(d){let p;for(let m=0;m<d;m+=2)p=new S(Ee[m],Ee[m+1]);n=p;break}}}return n}totalWidth(t,e){let r=0;return t.forEach(i=>r+=i.width),e.forEach(i=>r+=i.width),r}addDebugPoint(t,e){if(Gr.debug&&this.debug!=null&&t!=null){let r=new M(t.point,t.point.add(t.direct)),i=new M(t.point,t.point),n=new Gn(r,e),s=new Gn(i,e);this.debug.add(new Cd([n,s]))}}drawAlignEndPath(t,e,r,i,n,s,a){let l=new Zr,c=t.length;for(let h=0;h<c;h++){let u=t[h];if(u!=e&&!u.fix){let d=this.align4Refer(e.point,u,r[h],a);this.debugPolyline(d,{color:ee.GREEN,msg:"drawAlignEndPath"}),u.direct=e.direct,a&&d.reverse();let p=this.getList4Index(s,h);this.debugPolyline(d,{color:ee.GREEN,msg:"drawAlignEndPath-2"});for(let m of d)m instanceof q?a?l.drawInfoArcTrack([m.reverse()],i.tracks[h],n,p):l.drawInfoArcTrack([m],i.tracks[h],n,p):a?l.drawInfoTrack([m.end(),m.start()],i.tracks[h],n,p):l.drawInfoTrack([m.start(),m.end()],i.tracks[h],n,p)}}}debugPolyline(t,e={color:ee.GREEN}){if(Gr.debug&&this.debug!=null){let r=[];for(let i of t){let n=new Gn(i,e);r.push(n)}this.debug.add(new Cd(r))}}getList4Index(t,e){let r=t[e];return r==null&&(r=new Zr().createList(),t[e]=r),r}align4Refer(t,e,r,i){let n=i?this.getEndPrimitives(r):this.getStartPrimitives(r),a=new Zl(e.point,t,n).result;return e.point=a[a.length-1].end(),a}getNearPoint(t,e){let r=new M(t,t),i=Number.MAX_VALUE,n=t;for(let s of e){let a=new Eu(r,s);if(ne.less(a.getDistance(),i)){i=a.getDistance();let l=a.getLine();l.start().equals1(t)?n=l.end():n=l.start()}else if(ne.eq(a.getDistance(),i)){let l=a.getLine();l.start().equals1(t)?n=l.end():n=l.start()}}return n}getMaxDistanceDirect(t,e){let r=0,i=t;for(let n of e)if(!n.fix&&n!=t){let a=n.point.sub(t.point).dot(t.direct);ne.greater(Math.abs(a),r)&&(r=a,i=n)}return i}fanout90(t,e,r,i){let n=t.tracks.length,s=new Lr,a=new _3(r.position);a.fanout_v4(t,r,i),a.checkstart=!1,a.fanout_v4(t,r,i);let l=new Array(n);for(let c=0;c<n;c++){let h=t.tracks[c],u=e[c],d=null;if(!h.start.fix){let p=null,m=[],g=h.start.connect(),y=g[0];m.push(y);for(let P=0;P<g.length;P++){let T=new M(y.point,g[P].point),I=u.listIterator(),C=new Array;for(;I.hasNext();){let _=I.next().item,x=_.primitive,v=Pt(T,x);for(let D=0;D<v;D+=2){let w=new S(Ee[D],Ee[D+1]);C.push({point:w,model:_})}}let E=P0(C,T);if(E.length>0){g[P].point=E[0].point,p=E[0].model,m.push(g[P]);break}m.push(g[P]),y=g[P]}let b=this.listReplace(m,h,u,p);u=b.list,d=b.command,this.debugPolyline(u.toArray().map(P=>P.primitive),{color:ee.BLUE,msg:"fanout90"})}if(!h.end.fix){let p=null,m=[],g=h.end.connect(),y=g[0];m.push(y);for(let P=0;P<g.length;P++){let T=new M(y.point,g[P].point),I=u.listIterator(),C=new Array;for(;I.hasNext();){let _=I.next().item,x=_.primitive,v=Pt(T,x);for(let D=0;D<v;D+=2){let w=new S(Ee[D],Ee[D+1]);C.push({point:w,model:_})}}let E=P0(C,T);if(E.length>0){g[P].point=E[0].point,p=E[0].model,m.push(g[P]);break}m.push(g[P]),y=g[P]}let b=this.listReplaceEnd(m,h,u,p);u=b.list,d!=null&&d.undo(),d=b.command,this.debugPolyline(u.toArray().map(P=>P.primitive),{color:ee.BLUE,msg:"fanout90"})}(!h.start.fix||!h.end.fix)&&(l[c]=u),d!=null&&s.addCommand(d)}return{result:l,command:s}}listReplace(t,e,r,i){let n=new Lr,s=new Zr,a=s.createList();s.drawCornerNodeTrack(t,e,n,a);let l=r.listIterator(),c=!1;for(;l.hasNext();){let h=l.next(),u=h.item;if(c){let d=u.start,p=u.end,m=u.width;if(d.distance2(p)>1e-8){if(u instanceof Ii){let g=s.createArcTrack(e.layerId,u.center,u.radius,u.startAngle,u.endAngle,u.sweep,m,e.net,n,void 0,u.getGroupID()),y=s.addList(g,a,n);y.fanoutInfo=h.fanoutInfo}else if(u instanceof zr){let g=s.createTrack(e.layerId,d,p,m,u.showNet,n,u.getGroupID()),y=s.addList(g,a,n);y.fanoutInfo=h.fanoutInfo}}}else if(u==i){c=!0;let d=t[t.length-1].point,p=i.end;if(d.distance2(p)>1e-8){let m=OL(u.center.x,u.center.y,d.x,d.y),g=OL(u.center.x,u.center.y,p.x,p.y);if(u instanceof Ii){let y=s.createArcTrack(e.layerId,u.center,u.radius,m,g,u.sweep,e.width,e.net,n,void 0,u.getGroupID()),b=s.addList(y,a,n);b.fanoutInfo=h.fanoutInfo}else if(u instanceof zr){let y=s.createTrack(e.layerId,d,p,e.width,e.net,n,u.getGroupID()),b=s.addList(y,a,n);b.fanoutInfo=h.fanoutInfo}}}}return{list:a,command:n}}listReplaceEnd(t,e,r,i){let n=new Lr,s=new Zr,a=s.createList(),l=r.listIterator();for(;l.hasNext();){let u=l.next(),d=u.item;if(d==i){let y=i.start,b=t[t.length-1].point;if(y.distance2(b)>1e-8){if(d instanceof Ii){let P=OL(d.center.x,d.center.y,y.x,y.y),T=OL(d.center.x,d.center.y,b.x,b.y),I=s.createArcTrack(e.layerId,d.center,d.radius,P,T,d.sweep,e.width,e.net,n,void 0,d.getGroupID()),C=s.addList(I,a,n);C.fanoutInfo=u.fanoutInfo}else if(d instanceof zr){let P=s.createTrack(e.layerId,y,b,e.width,e.net,n,d.getGroupID()),T=s.addList(P,a,n);T.fanoutInfo=u.fanoutInfo}}break}let p=d.start,m=d.end,g=d.width;if(p.distance2(m)>1e-8){if(d instanceof Ii){let y=s.createArcTrack(e.layerId,d.center,d.radius,d.startAngle,d.endAngle,d.sweep,g,e.net,n,void 0,d.getGroupID()),b=s.addList(y,a,n);b.fanoutInfo=u.fanoutInfo}else if(d instanceof zr){let y=s.createTrack(e.layerId,p,m,g,e.net,n,d.getGroupID()),b=s.addList(y,a,n);b.fanoutInfo=u.fanoutInfo}}}let c=t.reverse(),h=new Set;for(let u of c)u.reverse(),u.change!=null&&h.add(u.change);for(let u of h)u.reverse();return s.drawCornerNodeTrack(c,e,n,a),{list:a,command:n}}calculateReferDirect_v2(t,e,r=!0){let i=t.tracks,n=[];i.forEach((d,p)=>{let g=e[p].getAllItems(),y=d.start,b=d.end,P=[];if(r){for(let C=0;C<g.length;C++)if(!y.fix){let E=g[C],O=E.start,_=E.end,x;E instanceof zr?x=ge.build4([O,_]):E instanceof Ii&&(x=ge.build2([q.build2(E.center,E.startAngle*180/Math.PI,E.endAngle*180/Math.PI,E.radius,E.radius,E.sweep)]));let v=!1,D=x.primitives;for(let w=0;w<D.length;w++){let F=D[w];F instanceof q?v=new Dc().inPolyline(y.point,x):F instanceof M&&(v=Dv(y.point,x))}if(!v)P.push(x);else{x.primitives.forEach(w=>{if(w instanceof q){let F=OL(w.center.x,w.center.y,y.point.x,y.point.y);P.push(ge.build2([q.build2(w.center,w.startAngle,F*180/Math.PI,w.rx,w.ry,w.sweep())]))}else w instanceof M&&P.push(ge.build4([O,y.point]))});break}}}else for(let C=g.length-1;C>=0;C--)if(!b.fix){let E=g[C],O=E.end,_=E.start,x;E instanceof zr?x=ge.build4([O,_]):E instanceof Ii&&(x=ge.build2([q.build2(E.center,E.endAngle*180/Math.PI,E.startAngle*180/Math.PI,E.radius,E.radius,ae.CCW==E.sweep?ae.CW:ae.CCW)]));let v=!1,D=x.primitives;for(let w=0;w<D.length;w++){let F=D[w];F instanceof q?v=new Dc().inPolyline(b.point,x):F instanceof M&&(v=Dv(b.point,x))}if(!v)P.push(x);else{x.primitives.forEach(w=>{if(w instanceof q){let F=OL(w.center.x,w.center.y,b.point.x,b.point.y),H=q.build2(w.center,w.startAngle,F*180/Math.PI,w.rx,w.ry,w.sweep());P.push(ge.build2([H]))}else w instanceof M&&P.push(ge.build4([O,b.point]))});break}}let T=[];P.forEach(C=>{let E=C.primitives;T.push(...E)});let I=ge.build2(T);n[p]=I});let s=new Array,a=0;for(let d=0;d<n.length;d++)if(!(n[d].primitives.length<=0)){a=d;break}let l=n[a];for(let d=0;d<n.length;d++){s.push([]);let p=0;for(let m=n[d].primitives.length-1;m>=0;m--)s[d][m]=p,p+=n[d].primitives[m].length()}for(let d=a+1;d<n.length;d++){let p=c(n[d].end(),a),m=c(l.end(),d);if(m&&!p&&(a=d,l=n[d]),p&&m){let g=n[p.i].primitives[p.j],y=n[m.i].primitives[m.j];g instanceof M&&y instanceof M?h(p.i,p.j,p.point)<h(m.i,m.j,m.point)&&(a=d,l=n[d]):g instanceof q&&y instanceof q&&Math.abs(g.sweepAngle)<Math.abs(y.sweepAngle)&&(a=d,l=n[d])}}function c(d,p){if(!d)return 0;let m,g,y=1/0,b=new M(d,d),P=n[p].primitives;for(let T=P.length-1;T>=0;T--){let I=new Eu(b,P[T]).getLine();I.length()<y&&(m=T,g=I,y=I.length())}return g?{point:g.start().equals(d)?g.end():g.start(),i:p,j:m}:null}function h(d,p,m){let g=n[d].primitives[p];if(g instanceof M)return g.end().distance1(m)+s[d][p];if(g instanceof q){let y=g.startAngle,b=zt.regularD(m.angleD(g.center));return Math.abs(y-b)<1e-8?0:q.build2(g.center,y,b,g.rx,g.ry,g.sweep()).length()+s[d][p]}}let u=t.tracks[a];return r?u.start:u.end}clear(t){let e=t.listIterator();for(;e.hasNext();){let r=e.next();r.points.length=0}}sort(t){let e=t.listIterator(),r=[];for(;e.hasNext();){let i=e.next();P0(i.points,i.item),i.points.forEach(n=>{r.find(a=>a.point.equals1(n.point))||r.push(n)})}return r}add4Batch(t,e,r,i,n){let s=new Map;for(let l of t){let c=At.getInstance().getNode(l.model).parent,h=s.get(c);h==null&&(h=[],s.set(c,h)),h.push(l)}let a=[];for(let[l,c]of s){let h=l.toArray();c.sort((T,I)=>{let C=h.indexOf(T.model),E=h.indexOf(I.model);if(C==E){let O=P0([T,I],T.model.primitive);return O.indexOf(T)-O.indexOf(I)}else return C-E});let u=c,d=r.indexOf(l),p=i.tracks[d],g=u[0].model,y=g.start,b=jr.inPolyline(y,e);if(b&&u.some(T=>T.point.equals1(y))){let T=D3(g,y),I=Math.min(T.length(),g.length),C=y.add(T.mul(I)),E=n.inShape(C.x,C.y);b=b&&!E}u=u.splice(0,2);let P=null;for(let T of u){if(b){P=new J4(T),P.start=null,P.end=T,a.push(P),b=!1;break}P==null?(P=new J4(T),a.push(P)):(P.end=T,P=null)}}return a}sortGroup(t,e,r,i){for(let n of e){let s=t.indexOf(n.list);s<0||n.syncTrackInfo(i||r.tracks[s])}}syncRule(t,e){for(let r=0;r<t.tracks.length-1;r++){let i=t.tracks[r],n=t.tracks[r+1],s=i.start.point,a=i.start.direct,l=n.start.point,h=Math.abs(l.sub(s).cross(a))-(i.width+n.width)/2;if(le.pcbConfig.startTrackWidth=="rule"){let d=Zf([e],i.net,i.layerId),p=Zf([e],n.net,n.layerId);d&&(i.width=d),p&&(n.width=p)}let u=Vb([e],i.net,n.net,n.layerId);u&&(h=u),i.next.width=h}if(t.tracks.length==1){let r=t.tracks[0];if(le.pcbConfig.startTrackWidth=="rule"){let i=Zf([e],r.net,r.layerId);i&&(r.width=i)}}}static syncEventRule(t,e){if(le.pcbConfig.startTrackWidth=="rule"){let r=!e,i=this.filterProfiles(t,e),n=t.net,s=re.getInstance().getNet(n),a=s==null?void 0:s.netDifferential,l=Zf(i,n,t.layerId);l?t.width=l:r||(a?l=re.getInstance().getDifferentialPhysicsByNet(n).getStrokeWidthDefault(t.layerId):l=re.getInstance().getTrackPhysicsByNet(n).getDefaultWidth(t.layerId),t.width=l)}}static filterProfiles(t,e){let r=t.start,i=Ts(r.point,t.layerId,!0);if(e){let n=i.findIndex(s=>e===s);i.splice(n,1)}return i}changeViaPosition(t,e){let r=t.result.wireVia,i=t.tracks;if(r.size<=0)return;let n=[];i.forEach(a=>{let l=r.get(a);n.push(l)});let s=this.calcViaPosition(n,e.result);this.fixViaFanoutTracks(n,s,e)}calcViaPosition(t,e){let r=new Map,i=[];e.forEach(c=>{let h=c.getLast().end;i.push(h)});let n=i[i.length-1].sub(i[0]).normalize(),s=n.mul(-1),a=t.length,l=Math.floor(a/2);if(a%2==0){let c=i[l-1],h=i[l],u=c.add(h).mul(.5),d=e[l-1].getLast().layerId,p=e[l-1].getLast().layerId,m=this.getRules(c,t[l-1].item.layerId,d),g=this.getRules(h,t[l].item.layerId,p),y;!m.rawProfile&&!g.rawProfile?y=m:!m.rawProfile&&g.rawProfile||m.rawProfile&&!g.rawProfile?y=m.rawProfile?m:g:y=m.safeVia>g.safeVia?m:g,this.calcLeftViaPosition(y.safeVia,y.rawProfile,i,t,u,s,l-1,y.rule,r,Math.max(y.safeVia/2,y.holeClearance/2-(y.rule.defalutRadius-y.rule.defalutInner)),e[l-1].getLast().layerId,y.holeClearance),this.calcRightViaPosition(y.safeVia,y.rawProfile,i,t,u,n,l,y.rule,r,Math.max(y.safeVia/2,y.holeClearance/2-(y.rule.defalutRadius-y.rule.defalutInner)),e[l].getLast().layerId,y.holeClearance)}else{let c=t[l].item.center,h=e[l-1].getLast().layerId,{safeVia:u,rule:d,rawProfile:p,holeClearance:m}=this.getRules(c,t[l].item.layerId,h);r.set(t[l],null),t[l].item.viaBaseInfo=la.getViaBaseInfo(t[l].item.startLayer,t[l].item.endLayer,d.defalutRadius,d.defalutInner),this.calcLeftViaPosition(u,p,i,t,c,s,l-1,d,r,Math.max(u+d.defalutRadius,m+d.defalutInner-(d.defalutRadius-d.defalutInner)),e[l-1].getLast().layerId,m),this.calcRightViaPosition(u,p,i,t,c,n,l+1,d,r,Math.max(u+d.defalutRadius,m+d.defalutInner-(d.defalutRadius-d.defalutInner)),e[l+1].getLast().layerId,m)}return r}getViasCenter(t){let e=t.length,r=Math.floor(e/2),i;return e%2==0?i=t[r-1].item.center.add(t[r].item.center).mul(.5):i=t[r].item.center,i}fixViaFanoutTracks(t,e,r){let i=r.result,n=[];i.forEach((a,l)=>{n[l]||(n[l]=[]);let c=a.getFirstNode();for(;c;)n[l].push(c),c=c.next});let s=this.getViasCenter(t);t.forEach((a,l)=>{let c=r.result[l],h=e.get(a);if(!h)return;let u=s.sub(h.rawPosi).normalize(),d=h.direct,p=u.rotate(new S(0,0),Math.PI/2),m=p.cross(d),g=p.cross(u),y=m*g;if(y/=Math.abs(y),y>0)return;let b=r.command,P=new Zr,T=n[l],I=T.length-1,C=T[I],E=P.createList(),O=P.createTrack(C.item.layerId,C.item.start,C.item.end,C.item.width,C.item.net,b,C.item.getGroupID()),_=P.createTrack(C.item.layerId,C.item.end,h.posi,C.item.width,C.item.net,b,C.item.getGroupID());P.addList(O,E,b),P.addList(_,E,b),E.replace(C,C),b.addCommand(new mi(E));let x=new nT(_.direct,-1);c.getLastNode().fanoutInfo=x})}calcLeftViaPosition(t,e,r,i,n,s,a,l,c,h,u,d){let p=t,m=h,g=l,y=e;for(let b=a;b>=0;b--){let P=r[b],T=i[b],I=n.add(s.mul(m)),C=!0;if(y&&(C=y.inShape(I.x,I.y)),C){let E=I.add(s.mul(g.defalutRadius));if(y&&(C=y.inShape(E.x,E.y)),C){let O=P.sub(n).length(),_=E.sub(n).length();O>_?(T.item.viaBaseInfo=la.getViaBaseInfo(T.item.startLayer,T.item.endLayer,g.defalutRadius,g.defalutInner),T.item.center=P,c.set(T,null),m=O+T.item.radius+p):(m<d-(g.defalutRadius-g.defalutInner)*2?(m+=2*T.item.radius,m+=d-(g.defalutRadius-g.defalutInner)*2):(m+=2*T.item.radius,m+=p),T.item.viaBaseInfo=la.getViaBaseInfo(T.item.startLayer,T.item.endLayer,g.defalutRadius,g.defalutInner),T.item.center=E,this.addChangeViaRecord(T,{direct:E.sub(P).normalize(),posi:E,rawPosi:P},c))}else{let O=Ts(E,u,!0)[0],_,x;if(O){let D=re.getInstance().getRegion(O.globalIndex);_=re.getInstance().getRadiusPhysics(D.radius),x=re.getInstance().getSafeSpacing(D.safeClearance),y=O}else _=re.getInstance().getDefaultRadiusPhysics(),x=re.getInstance().getDefaultSafeSpacing(),y=null;let v=x.getClearance(5,5)||0;if(v>p+g.defalutRadius){let D=v-(p+g.defalutRadius);E=E.add(s.mul(D)),m+=D}this.addChangeViaRecord(T,{direct:E.sub(P).normalize(),posi:E,rawPosi:P},c),T.item.viaBaseInfo=la.getViaBaseInfo(T.item.startLayer,T.item.endLayer,_.defalutRadius,_.defalutInner),T.item.center=E,p=v,m+=_.defalutRadius,m+=p,g=_}}else{let E=Ts(I,u,!0)[0],O,_;if(E){let v=re.getInstance().getRegion(E.globalIndex);O=re.getInstance().getRadiusPhysics(v.radius),_=re.getInstance().getSafeSpacing(v.safeClearance),y=E}else O=re.getInstance().getDefaultRadiusPhysics(),_=re.getInstance().getDefaultSafeSpacing(),y=null;let x=_.getClearance(5,5)||0;if(x>p){let v=x-p;I=I.add(s.mul(v)),m+=v}I=I.add(s.mul(O.defalutRadius)),this.addChangeViaRecord(T,{direct:I.sub(P).normalize(),posi:I,rawPosi:P},c),T.item.viaBaseInfo=la.getViaBaseInfo(T.item.startLayer,T.item.endLayer,O.defalutRadius,O.defalutInner),T.item.center=I,p=x,m+=2*O.defalutRadius,m+=p,g=O}}}calcRightViaPosition(t,e,r,i,n,s,a,l,c,h,u,d){let p=t,m=h,g=l,y=e,b=i.length;for(let P=a;P<b;P++){let T=r[P],I=i[P],C=n.add(s.mul(m)),E=!0;if(y&&(E=y.inShape(C.x,C.y)),E){let O=C.add(s.mul(g.defalutRadius));if(y&&(E=y.inShape(O.x,O.y)),E){let _=T.sub(n).length(),x=O.sub(n).length();_>x?(I.item.viaBaseInfo=la.getViaBaseInfo(I.item.startLayer,I.item.endLayer,g.defalutRadius,g.defalutInner),I.item.center=T,c.set(I,null),m=_+I.item.radius+p):(p<d-(g.defalutRadius-g.defalutInner)*2?(m+=2*I.item.radius,m+=d-(g.defalutRadius-g.defalutInner)*2):(m+=2*I.item.radius,m+=p),I.item.viaBaseInfo=la.getViaBaseInfo(I.item.startLayer,I.item.endLayer,g.defalutRadius,g.defalutInner),I.item.center=O,this.addChangeViaRecord(I,{direct:O.sub(T).normalize(),posi:O,rawPosi:T},c))}else{let _=Ts(O,u,!0)[0],x,v;if(_){let w=re.getInstance().getRegion(_.globalIndex);x=re.getInstance().getRadiusPhysics(w.radius),v=re.getInstance().getSafeSpacing(w.safeClearance),y=_}else x=re.getInstance().getDefaultRadiusPhysics(),v=re.getInstance().getDefaultSafeSpacing(),y=null;let D=v.getClearance(5,5)||0;if(D>p+g.defalutRadius){let w=D-(p+g.defalutRadius);O=O.add(s.mul(w)),m+=w}this.addChangeViaRecord(I,{direct:O.sub(T).normalize(),posi:O,rawPosi:T},c),I.item.viaBaseInfo=la.getViaBaseInfo(I.item.startLayer,I.item.endLayer,x.defalutRadius,x.defalutInner),I.item.center=O,p=D,m+=x.defalutRadius,m+=p,g=x}}else{let O=Ts(C,u,!0)[0],_,x,v;if(O){let w=re.getInstance().getRegion(O.globalIndex);_=re.getInstance().getRadiusPhysics(w.radius),v=re.getInstance().getOtherSpacing(w.otherClearance).holeClearance,x=re.getInstance().getSafeSpacing(w.safeClearance),y=O}else _=re.getInstance().getDefaultRadiusPhysics(),x=re.getInstance().getDefaultSafeSpacing(),v=re.getInstance().getDefaultOtherSpacing().holeClearance,y=null;let D=x.getClearance(5,5)||0;if(D>p){let w=D-p;C=C.add(s.mul(w)),m+=w}C=C.add(s.mul(_.defalutRadius)),this.addChangeViaRecord(I,{direct:C.sub(T).normalize(),posi:C,rawPosi:T},c),I.item.viaBaseInfo=la.getViaBaseInfo(I.item.startLayer,I.item.endLayer,_.defalutRadius,_.defalutInner),I.item.center=C,p=D,m+=2*_.defalutRadius,m+=p,g=_,d=v}}}sameVec(t,e){let r=Math.abs(t.x-e.x),i=Math.abs(t.y-e.y);return r<1e-8&&i<1e-8}getRules(t,e,r){let i=Ts(t,e,!0,!0)[0],n,s,a,l;if(i){let c=re.getInstance().getRegion(i.globalIndex);n=re.getInstance().getSafeSpacing(c.safeClearance),l=re.getInstance().getOtherSpacing(c.otherClearance).holeClearance,s=n.getClearance(5,5,r)||0,a=re.getInstance().getRadiusPhysics(c.radius)}else n=re.getInstance().getDefaultSafeSpacing(),l=re.getInstance().getDefaultOtherSpacing().holeClearance,s=n.getClearance(5,5,r)||0,a=re.getInstance().getDefaultRadiusPhysics();return{safeSpacing:n,safeVia:s,rule:a,rawProfile:i,holeClearance:l}}addChangeViaRecord(t,e,r){let i=e.posi,n=e.rawPosi;if(this.sameVec(i,n))return r.set(t,null);r.set(t,e)}copyFanoutInfo(t,e){let r=t.length;for(let i=0;i<r;i++){let n=t[i],s=e[i];if(!n||!s)continue;let a=[],l=[],c=n&&n.getFirstNode();for(;c;)a.push(c),c=c.next;let h=s&&s.getFirstNode();for(;h;)l.push(h),h=h.next;for(let u=0;u<a.length;u++){let d=a[a.length-1-u],p=l[l.length-1-u];d.fanoutInfo||(d.fanoutInfo=p.fanoutInfo)}}}};var yR=class o extends yi{constructor(e,r){super(e);this.isBase=!0;super.color=r,this.sendDeleteMsg=!1}static build(e,r,i,n,s,a,l,c){let h=new Ii(Lh(),e,r,i,l,n,s,a,!1,c,1);return new o(h,null)}getAngle(){let e=this.midPoint.sub(this.center).normalize(),r=Math.atan2(e.x,-e.y);return r<-Go?r+=Math.PI:r>Go&&(r-=Math.PI),r}setBBoxModify(){}setLayerModify(e){}};var Ny=class extends ro{constructor(t,e){super(),this._via=t.clone(),this.net=t.net,this.action=e}rebuild(){this._via.net=this.net;let t=this._via.clone();return Si.getInstance().addModel(t),Cr.getInstance().current.setViaVisible(t.globalIndex),t}getItem(){return"ignore"}remove(){let t=this._via.globalIndex,e=Si.getInstance().getItem(t);e&&e.remove(),e&&Si.getInstance().delete(e),Cr.getInstance().current.setViaHidden(t)}modify(){let t=this._via.globalIndex,e=Si.getInstance().getItem(t),r=e.clone();e.type!=this._via.type&&(e.type=this._via.type),e.name!=this._via.name&&(e.name=this._via.name),e.net!=this._via.net&&(e.net=this._via.net),e.center.equals(this._via.center)||(e.center=this._via.center),e.viaBaseInfo=la.getViaBaseInfo(this._via.startLayer,this._via.endLayer,this._via.radius,this._via.holeRadius),e.locked!=this._via.locked&&(e.locked=this._via.locked),e.viaExpansion=qp.getViaExpansion(this._via.expansionType,this._via.topExpansion,this._via.bottomExpansion),e.unusedInnerLayers.toString()!=this._via.unusedInnerLayers.toString()&&(e.unusedInnerLayers=this._via.unusedInnerLayers),this._via=e}updateData(){throw new Error("Method not implemented.")}upload(t){throw new Error("Method not implemented.")}};var Q4=class Q4{constructor(){this.sourceMap=new Map;this.sourceViaMap=new Map;this.map=new Map;this.viaMap=new Map;this.hightMap=new Map}static getInstance(){return Q4.manager==null&&(Q4.manager=new Q4),Q4.manager}view4Status(t){let e=new Lr,r=new Array,i=new Array;for(let[a,l]of t.trackStatus)l?r.push(a):i.push(a);for(let[a,l]of t.updateTrackStatus)t.trackStatus.has(a)||(l?r.push(a):i.push(a));this.hiddenView(i,e),this.visibleTrack(r,t);for(let a of i)t.deleteTrack(a);let n=new Array,s=new Array;for(let[a,l]of t.viaStatus)l?n.push(a):s.push(a);this.hiddenVia(s,e),this.visibleVia(n,t);for(let a of s)t.deleteVia(a);return this.handleHight(t),t.updateTrackStatus.clear(),e}handleHight(t){let e=t.hightStatus,r=new Array,i=new Array;for(let[s,a]of e)a?i.push(s):r.push(s);let n=new Jt;r.forEach(s=>{let a=this.hightMap.get(s);a||(a=n.getItem(s)),t.deleteHight(s),this.hightMap.delete(s),a.visible()}),i.forEach(s=>{let a=this.hightMap.get(s);a||(a=n.getItem(s),this.hightMap.set(s,a)),a.click()})}setHightItem(t){this.hightMap.set(t.globalIndex,t)}get getMap(){return this.map}visibleTrack(t,e){for(let r of t){let i=this.getSourceView(r,!0);if(i!=null)i.visible();else{let n=this.map.get(r);if(n==null){let s=this.getTrackModel(r);if(!s||s.length<1e-8)continue;if(s!=null){let a;a=this.getHighlightColor(s.net,s.layerId),e.getTrackPreview(s.globalIndex)&&(a=this.getPreviewColor(s.net,s.layerId)),e.getTrackWhite(s.globalIndex)&&(a=this.getDarkModeHighlightColor(ee.WHITE));let h;s instanceof zr?h=new Id(s,a):h=new yR(s,a),h.isEmpty||(h.partition=R.getInstance().partitionId),e.getTrackSelect(s.globalIndex)?h.click():h.visible(),this.map.set(r,h)}}else e.getTrackPreview(n.globalIndex)?n.color=this.getPreviewColor(n.net,n.layerId):n.color=this.getHighlightColor(n.net,n.layerId),e.getTrackSelect(n.globalIndex)?n.click():n.visible()}}}restoreTrackColor(t){let{updateTracks:e,updateVias:r}=t,i=Ri.getInstance().getItem(4);for(let s of e){let a=this.map.get(s);if(a){if(!i.visible){a.hidden();continue}let l=a.net,c=a.layerId,h=!Ye.getSpecialColor(l).equals(ee.BLACK),u;h?u=Ye.getSpecialColor(l).mul(1):u=Ze.getInstance().getLayer(c).activeColor.mul(1),a.color=u,a.visible()}else if(!i.visible){let l=this.getSourceTrack(s);l==null||l.hidden()}}let n=Ri.getInstance().getItem(9);for(let s of r){let a=this.viaMap.get(s);if(a){if(!n.visible){a.updateFilterVisible,a.hidden();continue}}else if(!n.visible){let l=Wr.getItem(s);l==null||l.hidden()}}}hiddenView(t,e){for(let r of t){let i=this.getSourceView(r,!1);if(i!=null)i.hidden();else{$l.getInstance().delete(r);let n=this.map.get(r);n!=null&&(n.model.isEmpty||e.addCommand(new yA(n.model,"delete")),n.sendDeleteMsg=!1,n.remove(),oi.getInstance().deleteTree(n.model),this.map.delete(r))}}}getSourceView(t,e){let r=this.sourceMap.get(t);if(r==null){let i=this.getSourceTrack(t);i!=null&&(r={track:i,visible:e},this.sourceMap.set(t,r))}return r!=null&&(r.visible=e),r==null?void 0:r.track}visibleVia(t,e){for(let r of t){let i=this.getSourceViaView(r,!0);if(i!=null)i.visible();else{let n=this.viaMap.get(r);if(n==null){let s=this.getViakModel(r);if(s!=null){let a;Pe.getGrayIndex()==0?(a=this.getHighlightColor(s.net,s.layerId),e.getViaPreview(s.globalIndex)&&(a=this.getDarkModeHighlightColor(Ye.getSpecialColor(s.net)))):a=ee.BLACK;let c=new dR(s,a);this.viaMap.set(r,c)}}else e.getViaPreview(n.globalIndex)?n.color=this.getDarkModeHighlightColor(Ye.getSpecialColor(n.net)):n.color=this.getHighlightColor(n.net,12),n.visible()}}}getDarkModeHighlightColor(t){return R.getInstance().forceValue!=0&&(t=t.mul1(1/R.getInstance().forceValue)),t}hiddenVia(t,e){for(let r of t){let i=this.getSourceViaView(r,!1);if(i!=null)i.hidden();else{$l.getInstance().delete(r);let n=this.viaMap.get(r);n!=null&&(n.model.isEmpty||e.addCommand(new Ny(n.model,"delete")),n.sendDeleteMsg=!1,n.remove(),oi.getInstance().deleteTree(n.model),this.viaMap.delete(r))}}}getSourceViaView(t,e){let r=this.sourceViaMap.get(t);if(r==null){let i=Wr.getItem(t);i!=null&&(r={track:i,visible:e},this.sourceViaMap.set(t,r))}return r!=null&&(r.visible=e),r==null?void 0:r.track}getPreviewColor(t,e){let r=!Ye.getSpecialColor(t).equals(ee.BLACK),i;if(r)i=ee.of6(this.getDarkModeHighlightColor(Ye.getSpecialColor(t)),1-.1);else{let n=Ze.getInstance().getLayer(e);i=ee.of6(this.getDarkModeHighlightColor(n.activeColor),1-.1)}return i}getHighlightColor(t,e){let r=!Ye.getSpecialColor(t).equals(ee.BLACK),i;if(r)i=this.getDarkModeHighlightColor(Ye.getSpecialColor(t));else{let n=Ze.getInstance().getLayer(e);i=this.getDarkModeHighlightColor(n.activeColor)}return i}getTrackModel(t){return Ml.getInstance().getItem(t)}getViakModel(t){return Si.getInstance().getItem(t)}getSourceTrack(t){return pr.getItem(t)}clear(){for(let[,t]of this.map)t.sendDeleteMsg=!1,t.remove();for(let[,t]of this.viaMap)t.sendDeleteMsg=!1,t.remove();this.hightMap.forEach(t=>{t.visible()}),this.map.clear(),this.viaMap.clear(),this.sourceMap.clear(),this.sourceViaMap.clear(),this.hightMap.clear()}complete(t=new De("wire")){let e={};for(let[,s]of this.map){let a=s.model.clone(),l=a.globalIndex,c=s.model.getGroupID(),h=pr.addTrackByModel(a,!0);c&&(h.setGroupID(c),this.joinCombination([h],c)),h.partition=R.getInstance().partitionId,e[l]=h.globalIndex,h.updateFilterVisible=!0,h.visible(),t.addCommand(Ce.dispatch(h,"add")),he.publish("hasModifyPcbItem",h)}let r={},i=Si.getInstance(),n=new Set;for(let[,s]of this.sourceViaMap)if(!s.visible){let a=i.getMapViaId(s.track.globalIndex);this.viaMap.get(a)&&(r[s.track.globalIndex]=a,n.add(a))}for(let[s,a]of this.viaMap){if(n.has(s))continue;let l=a.model.clone(),c=l.globalIndex,h=Wr.addViaByModel(l,!0);h.partition=R.getInstance().partitionId,e[c]=h.globalIndex,h.updateFilterVisible=!0,h.visible(),t.addCommand(Ce.dispatch(h,"add")),he.publish("hasModifyPcbItem",h)}for(let[,s]of this.sourceMap)if(s.track.updateFilterVisible=!0,s.track.visible(),!s.visible){let a=s.track;t.addCommand(Ce.dispatch(a,"delete")),a.remove(),he.publish("delete",a),he.publish("hasModifyPcbItem",a)}for(let[s,a]of this.sourceViaMap)if(a.track.updateFilterVisible=!0,a.track.visible(),!a.visible){let l=a.track,c=r[s];if(c){let h=this.viaMap.get(c);t.addCommand(Ce.dispatch(l,"modify")),l.center=h.center,he.publish("hasModifyPcbItem",l)}else t.addCommand(Ce.dispatch(l,"delete")),l.remove(),he.publish("delete",l),he.publish("hasModifyPcbItem",l)}return{command:t,newIds:e}}joinCombination(t,e){Ht.getItem(e)!=null&&Ht.joinCombination(t,e)}checkTrackIsCanEdit(){let t=!0;for(let[,e]of this.map)if(!Mt.checkIsInCanEdit(e)){t=!1;break}for(let[,e]of this.viaMap)if(!Mt.checkIsInCanEdit(e)){t=!1;break}return t}};Q4.manager=null;var Mi=Q4;var e6=class e6{constructor(){this.events=new Array;this.current=null}static getInstance(){return e6.manager==null&&(e6.manager=new e6),e6.manager}getNext(){if(this.current!=null){this.events.push(this.current);let t=this.current,e=this.current.result.wireMap,r=this.current.result.wireVia;this.resetModel(t.node,e.get(t.node));let i=[],n=[];for(let c of this.current.tracks){let h=e.get(c),u=r.get(c),d=null,p=null;if(h&&h.size()>0){let m=h.getLastNode();p=Mr.getInstance().getStatus(m),d=m.item.width}p&&p.isInput?(i.push(d),n.push(h.getLast().end.clone())):u?n.push(u.item.center):c.start.point.equals1(c.end.point)?(i.push(null),n.push(null)):(i.push(null),n.push(c.end.point))}let s=this.current.nextEvent;s?this.current=s.clone():this.current=this.current.clone(!0);let a=n.every(c=>!c),l=Pe.getActiveLayerID();for(let c=0;c<this.current.tracks.length;c++){let h=this.current.tracks[c];h.allowModifyNet&&h.net&&(h.allowModifyNet=!1);let u=h.layerId,d=h.start.point,p=h.start;if(h.start=h.end.clone(),h.start.point=d,a&&(h.start.direct=p.direct),h.drawing!==2&&n[c]&&(h.start.point=n[c]),h.start.signalLayers.has(l)){h.end.layerId=l;let g=h.layerId;h.layerId=l,g!==l&&(w3.syncEventRule(h),i[c]=h.width)}let m=le.pcbConfig.startTrackWidth;if(h.end.signalLayers=new Set([h.layerId]),i[c]&&(h.width=i[c]),h.layerId!=u&&m==="rule"){this.changeStartTrackWidth(h.start.point,h.layerId,h);let g=h.width;we.prevTrackWidth=g}}this.checkEndpoint(t)}return this.current}changeStartTrackWidth(t,e,r){if(le.pcbConfig.startTrackWidth=="rule"){let i=Ts(t,e),n=r.net,s=Zf(i,n,r.layerId);if(s!=null)r.width=s;else{let a=no.getWidth(null,"rule",null,!1,r.start.point,e,r.net);a!=null&&(r.width=a)}return r.width}}restoreCurrentInitState(t){if(t!=null){let e=t,r=this.current.tracks.indexOf(this.current.node);this.current=t.clone();let i=Pe.getActiveLayerID();for(let n of this.current.tracks)n.start=n.end.clone(),n.start.signalLayers.has(i)&&(n.end.layerId=i,n.layerId=i),n.end.signalLayers=new Set([n.layerId]);this.checkEndpoint(e),this.current.changeControlNodeByIndex(r)}else if(this.current!=null){this.current=this.current.clone();for(let e of this.current.tracks)e.end.point=e.start.point.clone(),e.end.signalLayers=new Set([e.layerId])}return this.current}checkEndpoint(t){let e=t.tracks.length;for(let r=0;r<e;r++){let i=t.tracks[r];if(i.drawing==2)continue;let n=i.end,a=this.current.tracks[r].start;n.model==null?n.point.equals(a.point)||(a.allowModifyDirect=!1):(a.model=n.model,n.model.modelType=="Via"?a.allowModifyDirect=!0:a.allowModifyDirect=!1)}}setPreviousSeg(t){let e=[];if(this.current!=null&&t=="previous"){let r=this.current,i=r.result.wireMap,n=new Zr,s=Cr.getInstance().current;e=r.tracks.map(a=>{let l=r.result.wireVia.get(a),c=i.get(a);if((!l||a.via.viaPosition!="currentInflectionPoint")&&c&&c.size()>1){let h=c.getLastNode();if(!s.getTrackWhite(h.item.globalIndex))return;let u=h.prev.item,d=n.createList();d.replace(h,h);let p=h.item;return a.end.point=p.start.clone(),a.end.model=u,r.result.command.addCommand(new mi(d)),p.clone()}return null})}return e}getPreviousSeg(t=[],e=this.current){if(e&&t.length){let r=new Zr;e.tracks.forEach((n,s)=>{let a=t[s];if(!a)return;let l=e.result.creataList(n),c=r.createTrack(a.layerId,a.start,a.end,a.width,a.net,e.result.command,a.getGroupID());r.addList(c,l,e.result.command),Cr.getInstance().current.setTrackVisible(c.globalIndex),n.end.point=a.end.clone()}),e.position=e.node.end.point;let i=Mi.getInstance().view4Status(Cr.getInstance().current);e.result.command.addCommand(i)}}getLastEvent(){return this.events[this.events.length-1]}getSingleEvents(t=this.current.tracks.indexOf(this.current.node)){var r;let e=[];for(let i of this.events){let n=i.tracks[t],s=(r=i.result.wireMap.get(n))==null?void 0:r.getAllItems();s&&(e=e.concat(s))}return e}getSingleVias(t){var r;let e=[];for(let i of this.events){let n=t?i.tracks[t]:i.node;if(i.result.wireVia.size>0){let s=(r=i.result.wireVia.get(n))==null?void 0:r.item;s&&Si.getInstance().getNode(s)&&e.push(s)}}return e}hasTrack(t){let e=t.start.model;return!!Array.from(this.events).reverse().find(n=>{let s=n.tracks.find(l=>l.end.model==e?(e=l.start.model,!0):!1),a=n.result.wireMap.get(s);return!!(a&&a.size()>0)})}undo(){return this.current=this.events.pop(),this.current}clear(){this.events.length=0,this.current=null}resetModel(t,e){if(ds.getInstance().wireMode!=="Single wiring")return;let r=i=>!!(!i||(i instanceof Za||i instanceof yo||i instanceof ss)&&["Line","Fill Region"].includes(i.type));e.size()>0&&(t.end.model=r(t.end.model)?e.getLast():t.end.model,t.end.point=e.getLast().end,t.end.model instanceof gt&&(t.end.direct=Et(t.end.model.primitive)))}};e6.manager=null;var Rn=e6;var jCe=class{constructor(){this.lines=new Array;this._infos=new Array}add(t,e,r){let i=fs.getInstance().getModelObstacle(t,r,e);this._infos.push(i.outline.getOutline("default"))}displayCollideInfo(){for(let t of this.lines)t.remove();this.lines.length=0;for(let t of this._infos)this.displayPolyline(t)}displayPolyline(t){if(t!=null){let e=Bb(t.primitives,1002);for(let r of e)r.color=ee.WHITE,this.lines.push(r)}}getPolylines(t,e,r){let i=new Array;if(t instanceof zr||t instanceof Ii){let n=t.getMathGraphics(t.layerId,r).closeEndpoint();i.push(n)}else if(t instanceof et){if(12==t.layerId){if(!t.isUnuseLayer(e)){let n=t.getMathGraphics(e,r).closeEndpoint();i.push(n)}}else if(t.layerId==e){let n=t.getMathGraphics(e,r).closeEndpoint();i.push(n)}}else if(t instanceof Ct){if(e==12){let n=ge.build2([q.build3(t.center,0,-360,t.holeRadius+r,t.holeRadius+r)]).closeEndpoint();i.push(n)}else if(!t.isUnuseLayer(e)){let n=t.getMathGraphics(e,r).closeEndpoint();i.push(n)}}else if(t instanceof or&&["Fill Region","TearDrop","Slot Region","Board Outline"].includes(t.type)){let n=t.getMathGraphics(e,r).closeEndpoint();for(let s of n.primitives){let a=s.stroke(r,wr.ROUND,ae.CCW).closeEndpoint();i.push(a)}}else if(t instanceof or&&t.type=="Line"){let n=t.getMathGraphics(e,r);for(let s of n.primitives){let a=s.stroke(r*2+t.strokeWidth,wr.ROUND,ae.CCW).closeEndpoint();i.push(a)}}else if(t.box&&t.box instanceof bs){let n=t.box.getMathGraphics(t.layerId,r).closeEndpoint();i.push(n)}else if(t instanceof or&&t.type=="Prohibited Region"){let n=t.getMathGraphics(e,0).closeEndpoint();i.push(n)}return i.filter(n=>n)}clear(){this._infos.length=0;for(let t of this.lines)t.remove();this.lines.length=0}},y1=new jCe;function je(o,t=3,e=R.getInstance().unit,r=new dt){o=o*10,t==null&&(t=3);let i=r||new dt;e!="mil"&&(o=i.conversion("mil",e,o)),e=="mil"&&t==3&&(t=1);let n=Math.pow(10,t);return Math.round(o*n)/n}function L3(o){return new dt().conversion(R.getInstance().unit,"mil",o/10)}function eF(o){return new dt().conversion1("mil",R.getInstance().unit,o*10)}function GVe(o){try{return o&&JSON.parse(JSON.stringify(o))}catch(t){return console.log(t,o),o}}function _o(o){let t=Ai().get2dCameraMatrix(),e=new S(Ai().getWidth()/2,-Ai().getHeight()/2),r=o.multiply4(t).add(e),i=R.getInstance().getRatio();return new S(r.x/i,-r.y/i)}function nf(){return{width:Ai().getWidth(),height:Ai().getHeight()}}function Od(o,t){return o!=null&&t!=null?o.x===t.x&&o.y===t.y:!1}function XCe(o){let t=[];if(o.attr){let e=!1;for(let[r,i]of Object.entries(o.attr))t.push(`data-log-find-${r}="${i}"`),r==="path"&&(e=!0);e||t.push(`data-log-find-path="${R.getInstance().projectId}"`)}else if(o.call){t.push('data-log-find-call="true"');for(let e in o.call){let r=o.call[e];r=typeof r=="object"?JSON.stringify(r):r,t.push(`data-log-find-${e}='${r}'`)}}return`<span class="link" ${t.join(" ")}>${o.text}</span>`}var t6=class{constructor(){this.lastTime=-1;this.delay=0;this.func=null;this.animationFrameId=null;this.start=()=>{if(!this.func)return;performance.now()-this.lastTime>=this.delay?(this.func(),this.animationFrameId=null):this.animationFrameId=requestAnimationFrame(this.start)}}debounce(t,e=0){let r=this.func===t;this.func=t,this.delay=e,this.lastTime=performance.now(),!(r&&this.animationFrameId)&&(this.cancel(),this.start())}cancel(){this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}destroy(){this.cancel()}};var vne=class extends bi{constructor(t){super(),this.data=t}open(t){return{action:"route-via-violate-drc",data:{viaPosition:this.data.viaPosition}}}modify(){}close(t){if(!t)return;let{action:e}=t;return e=="confirm"?this.data.cb&&this.data.cb():this.data.cbCancel&&this.data.cbCancel(),!0}};function ii(o=!0){return{enforce:o,level:-9999}}var UVe={distanceSameComponentItem:{distanceSameComponentItem:ii()},prohibitRegionRule:{overlapWithOtherObject:ii()},trackRule:{minTrackWidth:ii(),maxTrackWidth:ii()},"Creepage Distance":{Creepage:ii()},netLength:{minLength:ii(),maxLength:ii()},netLengthTolerance:{tolerance:ii()},holeSize:{minViaSize:ii(),maxViaSize:ii()},connect:{sameNetNotConnect:ii(),checkFreeCopper:ii(),checkFreeTrack:ii(),checkFreeLine:ii(),checkFreeFillRegion:ii()},diff:{minWidth:ii(),maxWidth:ii(),minGap:ii(),maxLengthTolerance:ii()},distanceTrack:{track:ii(),SMDPad:ii(),THPad:ii(),SMDTestPoint:ii(),THTestPoint:ii(),via:ii(),fillRegion:ii(),slot:ii(),line:ii(),textAndImage:ii(),outline:ii(),hole:ii()},distanceSMDPad:{SMDPad:ii(),THPad:ii(),SMDTestPoint:ii(),THTestPoint:ii(),via:ii(),fillRegion:ii(),slot:ii(),line:ii(),textAndImage:ii(),outline:ii(),hole:ii()},distanceTHPad:{THPad:ii(),SMDTestPoint:ii(),THTestPoint:ii(),via:ii(),fillRegion:ii(),slot:ii(),line:ii(),textAndImage:ii(),outline:ii(),hole:ii()},distanceSMD_Test_Point:{SMDTestPoint:ii(),THTestPoint:ii(),via:ii(),fillRegion:ii(),slot:ii(),line:ii(),textAndImage:ii(),outline:ii(),hole:ii()},distanceTH_Test_Point:{THTestPoint:ii(),via:ii(),fillRegion:ii(),slot:ii(),line:ii(),textAndImage:ii(),outline:ii(),hole:ii()},distanceVia:{via:ii(),fillRegion:ii(),slot:ii(),line:ii(),textAndImage:ii(),outline:ii(),hole:ii()},distanceFillRegion:{fillRegion:ii(),slot:ii(),line:ii(),textAndImage:ii(),outline:ii(),hole:ii()},distanceSlot:{slot:ii(),line:ii(),textAndImage:ii(),outline:ii(),hole:ii()},distanceLine:{line:ii(),textAndImage:ii(),outline:ii(),hole:ii()},distanceTextImage:{textAndImage:ii(),outline:ii(),hole:ii()},distanceHole:{outline:ii(),hole:ii()},distanceComponent:{component:ii(),SMDPad:ii()},distancePlaneZone:{track:ii(),SMDPad:ii(),THPad:ii(),SMDTestPoint:ii(),THTestPoint:ii(),via:ii(),fillRegion:ii(),planeZone:ii(),slot:ii(),line:ii(),textAndImage:ii(),outline:ii(),hole:ii()},distanceCopper:{track:ii(),SMDPad:ii(),THPad:ii(),SMDTestPoint:ii(),THTestPoint:ii(),via:ii(),fillRegion:ii(),copper:ii(),slot:ii(),line:ii(),textAndImage:ii(),outline:ii(),hole:ii()},schematicNetlist:{netList:ii()}};var ka=class o{constructor(){this._isOpenDRCCustomCheck=!1;this.config=UVe}static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}get isOpenDRCCustomCheck(){return this._isOpenDRCCustomCheck}set isOpenDRCCustomCheck(t){this._isOpenDRCCustomCheck=!!t}updateConfig(t){t&&(this.config=Object.assign({},this.config,t))}isCheck(t){return!this.isOpenDRCCustomCheck||!t?!0:t.enforce}isCheckDistance(t,e){if(!this.isOpenDRCCustomCheck)return!0;let r=null;return this.isSameComponentChild(t,e)?r=this.distanceSameComponentItem.distanceSameComponentItem:ei.getShape2NetDiff(t,e)?r=this.diff.minGap:(r=this.matchDistanceConfig(t,e),r||(r=this.matchDistanceConfig(e,t))),this.isCheck(r)}isCheckHoleDistance(t,e,r){let i=null;return this.isSameComponentChild(t,e)?i=this.distanceSameComponentItem.distanceSameComponentItem:r==1?i=this.matchHoleDistanceConfig(t,e):r==0&&(i=this.matchHoleDistanceConfig(e,t)),this.isCheck(i)}isSameComponentChild(t,e){let r=t.getParent(),i=e.getParent();return r instanceof Bi&&i instanceof Bi&&r.globalIndex===i.globalIndex}matchDistanceConfig(t,e){let r=null;if(t instanceof or&&t.type=="Prohibited Region"||e instanceof or&&e.type=="Prohibited Region")return this.prohibitRegionRule.overlapWithOtherObject;if(t instanceof Bi)return e instanceof et?this.distanceComponent.SMDPad:this.distanceComponent.component;let i=null;if(t instanceof gt)i=this.distanceTrack;else if(t instanceof et){let n=ar(t.layerId);t.isTestPad?i=n?this.distanceTH_Test_Point:this.distanceSMD_Test_Point:i=n?this.distanceTHPad:this.distanceSMDPad}else t instanceof Ct?i=this.distanceVia:t instanceof or&&(t.type=="Fill Region"||t.type=="TearDrop")?i=this.distanceFillRegion:t instanceof or&&t.type=="Slot Region"?i=this.distanceSlot:t instanceof or&&t.type=="Line"?i=this.distanceLine:t instanceof Li||t instanceof Dl?i=this.distanceTextImage:t instanceof hn?i=this.distanceCopper:t instanceof yn&&(i=this.distancePlaneZone);if(i)if(e instanceof gt)r=i.track;else if(e instanceof et){let n=ar(e.layerId);e.isTestPad?r=n?i.THTestPoint:i.SMDTestPoint:r=n?i.THPad:i.SMDPad}else e instanceof Ct?r=i.via:e instanceof or&&(e.type=="Fill Region"||e.type=="TearDrop")?r=i.fillRegion:e instanceof or&&e.type=="Slot Region"?r=i.slot:e instanceof or&&e.type=="Line"?r=i.line:e instanceof Li||e instanceof Dl?r=i.textAndImage:e instanceof or&&e.type=="Board Outline"?r=i.outline:e instanceof hn?r=i.copper:e instanceof yn&&(r=i.planeZone);return r}matchHoleDistanceConfig(t,e){let r=null,i=null;if(t instanceof gt)i=this.distanceTrack;else if(t instanceof et){let n=ar(t.layerId);t.isTestPad?i=n?this.distanceTH_Test_Point:this.distanceSMD_Test_Point:i=n?this.distanceTHPad:this.distanceSMDPad}else t instanceof Ct?i=this.distanceVia:t instanceof or&&(t.type=="Fill Region"||t.type=="TearDrop")?i=this.distanceFillRegion:t instanceof or&&t.type=="Slot Region"?i=this.distanceSlot:t instanceof or&&t.type=="Line"?i=this.distanceLine:t instanceof Li||t instanceof Dl?i=this.distanceTextImage:t instanceof hn?i=this.distanceCopper:t instanceof yn&&(i=this.distancePlaneZone);return i&&ei.isHole(e)&&(r=i.hole),r}get distanceSameComponentItem(){return this.config.distanceSameComponentItem}get prohibitRegionRule(){return this.config.prohibitRegionRule}get trackRule(){return this.config.trackRule}get netLength(){return this.config.netLength}get netLengthTolerance(){return this.config.netLengthTolerance}get holeSize(){return this.config.holeSize}get connect(){return this.config.connect}get diff(){return this.config.diff}get distanceTrack(){return this.config.distanceTrack}get distanceSMD_Test_Point(){return this.config.distanceSMD_Test_Point}get distanceTH_Test_Point(){return this.config.distanceTH_Test_Point}get distanceSMDPad(){return this.config.distanceSMDPad}get distanceTHPad(){return this.config.distanceTHPad}get distanceVia(){return this.config.distanceVia}get distanceFillRegion(){return this.config.distanceFillRegion}get distanceSlot(){return this.config.distanceSlot}get distanceHole(){return this.config.distanceHole}get distanceLine(){return this.config.distanceLine}get distanceTextImage(){return this.config.distanceTextImage}get distanceComponent(){return this.config.distanceComponent}get distancePlaneZone(){return this.config.distancePlaneZone}get distanceCopper(){return this.config.distanceCopper}get schematicNetlist(){return this.config.schematicNetlist}get creepageDistance(){return this.config["Creepage Distance"]}};var tF=class extends iu{constructor(t,e,r,i,n,s){super(r,t,e),this._obj1=i,this._obj2=n,this.layerIds=s}get obj1(){return this._obj1}set obj1(t){this._obj1=t}get obj2(){return this._obj2}set obj2(t){this._obj2=t}get errorType(){return"Copper Zone"}toJSON(){return{...super.toJSON(),errorType:this.errorType,name:this.name,obj1:this.obj1,obj2:this.obj2}}};var r6=class{encode(t=ci.getInstance().getAllItem()){let e=[];for(let r of t){let i=this.getErrorType(r);e.push({type:i,data:r.toJSON()})}return e}decode(t){let e=[];for(let r of t){let{type:i,data:n}=r;switch(i){case"ClearanceError":{let{position:s,name:a,obj1:l,obj1Type:c,obj2:h,obj2Type:u,minDistance:d,clearance:p,layerIds:m,errorType:g,net:y,line:b}=n,P=b,T=P&&(()=>{let{_start:C,_end:E}=P;return new M(new S(C.x,C.y),new S(E.x,E.y))})(),I=ci.getInstance().addClearanceError(new S(s.x,s.y),a,l,c,h,u,d,p,m,g,y,T);e.push(I);break}case"InnerError":{let{position:s,name:a,obj1:l,obj1Type:c,obj2:h,obj2Type:u,minDistance:d,clearance:p,layerIds:m}=n,g=ci.getInstance().addInnerError(new S(s.x,s.y),a,l,c,h,u,d,p,m);e.push(g);break}case"ConnectError":break;case"DifferentPairGapError":{let{position:s,name:a,obj1:l,obj1Type:c,obj2:h,obj2Type:u,minDistance:d,clearance:p,layerIds:m}=n,g=ci.getInstance().addDiffPairTrackGapError(new S(s.x,s.y),a,l,c,h,u,d,p,m);e.push(g);break}case"DifferentPairLengthError":{let{position:s,name:a,net_P:l,net_N:c,toleranceScope:h,value_P:u,value_N:d}=n,p=ci.getInstance().addDiffPairTrackLengthError(new S(s.x,s.y),a,l,c,h,u,d);e.push(p);break}case"DifferentPairWidthError":{let{position:s,name:a,obj:l,width:c,minWidth:h,maxWidth:u,layerIds:d}=n,p=ci.getInstance().addDiffPairTrackWidthError(new S(s.x,s.y),a,l,c,h,u,d);e.push(p);break}case"NetLengthError":{let{position:s,name:a,net:l,netLength:c,minNetLength:h,maxNetLength:u}=n,d=ci.getInstance().addNetLengthError(new S(s.x,s.y),a,l,c,h,u);e.push(d);break}case"NetLengthToleranceError":{let{position:s,name:a,net:l,netLengthDiff:c,netLengthTolerance:h}=n,u=ci.getInstance().addNetLengthToleranceError(new S(s.x,s.y),a,l,c,h);e.push(u);break}case"RadiusError":{let{position:s,name:a,obj1:l,type:c,radius:h,minRadius:u,maxRadius:d,layerIds:p,isBlind:m}=n,g=ci.getInstance().addRadiusError(new S(s.x,s.y),a,l,c,h,u,d,p,m);e.push(g);break}case"TrackError":{let{position:s,name:a,obj1:l,width:c,minWidth:h,maxWidth:u,layerIds:d}=n,p=ci.getInstance().addTrackWidthError(new S(s.x,s.y),a,l,c,h,u,d);e.push(p);break}case"NetlistError":{e.push(n);break}case"CreepageError":{let{position:s,name:a,obj1:l,obj1Type:c,obj2:h,obj2Type:u,minDistance:d,clearance:p,layerIds:m,errorType:g,path:y}=n,b=y.map(T=>{if(T.type==="Line")return new M(new S(T._start.x,T._start.y),new S(T._end.x,T._end.y));if(T.type==="Arc"){let{rx:I,ry:C,center:E,startAngle:O,sweepAngle:_}=T;return q.build3(new S(E.x,E.y),O,_,I,C)}}),P=ci.getInstance().addCreepageError(new S(s.x,s.y),a,l,c,h,u,d,p,g,m,b);e.push(P);break}}}return e}getErrorType(t){if(t instanceof O0)return"ClearanceError";if(t instanceof yI)return"InnerError";if(t instanceof Py)return"ConnectError";if(t instanceof Ty)return"DifferentPairGapError";if(t instanceof Iy)return"DifferentPairLengthError";if(t instanceof Cy)return"DifferentPairWidthError";if(t instanceof Sy)return"NetLengthError";if(t instanceof KP)return"NetLengthToleranceError";if(t instanceof tF)return"ProhibitError";if(t instanceof Ey)return"RadiusError";if(t instanceof Oy)return"TrackError";if(t instanceof vb)return"CreepageError"}};var cen=re.getInstance(),hen=ka.getInstance(),Oj=$i.getInstance();function Ig(o){if(o instanceof gt)return"Track";if(o instanceof et)return o.isTestPad?ar(o.layerId)?"TH Test Point":"SMD Test Point":ar(o.layerId)?"TH Pad":"SMD Pad";if(o instanceof Ct)return"Via";if(o instanceof or)return o.layerId==11?"Board Outline":o.type;if(o instanceof Li)return"Text";if(o instanceof Dl)return"Image";if(o instanceof Bi)return"Device";if(o instanceof hn)return"Copper Region(Filled)";if(o instanceof yn)return"Plane Zone"}var qCe=class{constructor(){this._onlyCheck=!1}set onlyCheck(t){this._onlyCheck=t}get onlyCheck(){return this._onlyCheck}checkSpacing(t){let e=[],r=[];return t.copper.forEach(i=>{this.addError(i)?e.push(i):r.push(i)}),t.plane.forEach(i=>{this.addError(i)?e.push(i):r.push(i)}),t.safe.forEach(i=>{this.addError(i)?e.push(i):r.push(i)}),{success:e,fail:r}}addError(t){let{id1:e,id2:r,line:i,holeState:n,collideLayerIds:s}=t,a=t.distance,l=ch(e),c=ch(r),[h,u]=s,d=ay(h,u),{rule:p,ruleType:m,clearance:g,net:y}=Oj.ruleHelper.getShape2Clearance(l,c,void 0,n,d);if(!(g<0)){if(!ei.isProhibit(l)&&!ei.isProhibit(c)&&(a=ve(a,2)),!Oj.checkSameNet&&a==0||a<g){if(p instanceof d2){let b=this.getLineCenter(i);this.addDiffError(l,c,b,t.distance,g,p.name,s)}else if(p instanceof p2)if(ei.isProhibit(l)||ei.isProhibit(l)){let T=l.getMathGraphics(l.layerId,0).bbox().extendOfSize(1e-5).isContains(i.start())?i.start():i.end();this.addClearanceError(l,c,T,t.distance,g,p.name,m,s,n)}else{let b=this.getLineCenter(i);this.addClearanceError(l,c,b,t.distance,g,p.name,m,s,n,void 0,i)}else{let b=this.getLineCenter(i);this.addClearanceError(l,c,b,t.distance,g,p.name,m,s,n,y)}return!1}return!0}}addError_Worker(t){let{shape1:e,shape2:r,line:i,holeState:n,collideLayerIds:s,ruleInfos:a}=t,l=t.distance,{rule:c,ruleType:h,clearance:u,net:d}=a;if(!(u<0)){if(!ei.isProhibit(e)&&!ei.isProhibit(r)&&(l=ve(l,2)),!Oj.checkSameNet&&l==0||l<u){if(c instanceof d2){let p=this.getLineCenter(i);this.addDiffError(e,r,p,t.distance,u,c.name,s)}else if(c instanceof p2)if(ei.isProhibit(e)||ei.isProhibit(e)){let g=e.getMathGraphics(e.layerId,0).bbox().extendOfSize(1e-5).isContains(i.start())?i.start():i.end();this.addClearanceError(e,r,g,t.distance,u,c.name,h,s,n)}else{let p=this.getLineCenter(i);this.addClearanceError(e,r,p,t.distance,u,c.name,h,s,n,void 0,i)}else{let p=this.getLineCenter(i);this.addClearanceError(e,r,p,t.distance,u,c.name,h,s,n,d)}return!1}return!0}}getLineCenter(t){let e=t.start(),r=t.end();return e.add(r).mul(.5)}addClearanceError(t,e,r,i,n,s,a="Safe Spacing",l=[],c,h,u){if(this._onlyCheck)return;if(ci.getInstance().getClearanceError(t.globalIndex,e.globalIndex)==null||c!==void 0){let p=(m,g)=>{Oj.checkEnv==0?ci.getInstance().addClearanceError(r,s,t.globalIndex,m,e.globalIndex,g,i,n,Dz(l),a,h,u):ci.getInstance().errorRecordBuffer.add({type:"ClearanceError",data:{position:r,name:s,obj1:t.globalIndex,obj1Type:m,obj2:e.globalIndex,obj2Type:g,minDistance:i,clearance:n,layerIds:Dz(l),errorType:a,net:h,line:u}})};if(c!==void 0)switch(c){case 0:p("Hole",Ig(e));break;case 1:p(Ig(t),"Hole");break;case 2:p("Hole","Hole");break;case 3:p(Ig(t),Ig(e));break}else p(Ig(t),Ig(e))}}addDiffError(t,e,r,i,n,s,a){if(this._onlyCheck)return;ci.getInstance().getDiffPairGapError(t.globalIndex,e.globalIndex)==null&&(Oj.checkEnv==0?ci.getInstance().addDiffPairTrackGapError(r,s,t.globalIndex,Ig(t),e.globalIndex,Ig(e),i,n,Dz(a)):ci.getInstance().errorRecordBuffer.add({type:"DifferentPairGapError",data:{position:r,name:s,obj1:t.globalIndex,obj1Type:Ig(t),obj2:e.globalIndex,obj2Type:Ig(e),minDistance:i,clearance:n,layerIds:Dz(a)}}))}},D0=new qCe;var o6=class o6{constructor(){this.errors=new Array;this.id=0;this.pointInObstacle=!1;this.needRedraw2ShowObstaclePl=!1;this.obstacle=null;this.recordData=null}static getInstance(){return o6.manager==null&&(o6.manager=new o6),o6.manager}realTimeCheckRule(t=!1){this.needRedraw2ShowObstaclePl=!1,this.clear(!1);let e=Zt.getInstance().mode,r=Rn.getInstance();if(Uu.switch){let i=this.getDrcCheckRoute(r,t),n=new ms,s=wt.filter;for(let a of i)for(let l of a){wt.setPushFilter(),wt.pushFilter.setNetAndLayerId(l.net,l.modelType=="Via"?null:l.layerId);let c=n.check(l);for(let h of c){let{source:u,obstacle:d,point:p}=h,m=this.id++,g=new O0(m.toString(),p,"",u.globalIndex,Ig(u),d.globalIndex,Ig(d),0,0,"Safe Spacing",[l.layerId]),{globalIndex:y,name:b,position:P,errorType:T,layerIds:I}=g,C=i1.getInstance().addItem(y,b,P,T,le.pcbConfig.drcErrorZoom,I);C.contentModel=g,C.model.content=g,this.errors.push(C),jt.getVisible(35)?(C.visible(),C.isVisible=!0):(C.hidden(),C.isVisible=!1)}}wt.filter=s}["WIRING_MODE_PUSHAWAY","WIRING_MODE_SURROUND_AND_PUSHAWAY","WIRING_MODE_SURROUND","WIRING_MODE_OBSTRUCT"].includes(e)&&this.displayCollidePl(r,t)}getDrcCheckRoute(t,e){var i,n;let r=[];if(e){let s=t.current.node,a=t.current.result.wireMap.get(s).getAllItems();if(r.push(a),t.current.result.wireVia.size>0){let h=(i=t.current.result.wireVia.get(s))==null?void 0:i.item;h&&Si.getInstance().getNode(h)&&r[0].push(h)}let l=t.getSingleVias();l.length>0&&(r[0]=r[0].concat(l));let c=t.getSingleEvents();return c.length>0&&(r[0]=r[0].concat(c)),r}else{for(let s=0;s<t.current.tracks.length;s++){let a=t.current.tracks[s],l=t.current.result.wireMap.get(a).getAllItems();if(r[s]||(r[s]=l),t.current.result.wireVia.size>0){let u=(n=t.current.result.wireVia.get(a))==null?void 0:n.item;u&&Si.getInstance().getNode(u)&&r[s].push(u)}let c=t.getSingleVias(s);c.length>0&&(r[s]=r[s].concat(c));let h=t.getSingleEvents(s);h.length>0&&(r[s]=r[s].concat(h))}return r}}getActualErrorPosition(t){let e=1/0,r;for(let i of t.source.getMathGraphics().primitives)for(let n of t.obstacle.getMathGraphics().primitives){let s=er.getMinLine(i,n);s.length()<e&&(e=s.length(),r=s)}return r.start().add(r.end()).mul(.5)}recordEndPoints(t,e=!1){if(this.recordData={points:[],result:[]},t.tracks.length==1||e){this.recordData.points.push(t.position);let r=t.node,i=t.result.wireMap.get(r).getAllItems();i.length&&this.recordData.result.push(i)}else for(let r=0;r<t.tracks.length;r++){let i=t.tracks[r];this.recordData.points.push(i.end.clone().point);let n=t.result.wireMap.get(i).getAllItems();n.length&&this.recordData.result.push(n)}}isObstructMode(){return Zt.getInstance().mode=="WIRING_MODE_OBSTRUCT"}displayCollidePl(t,e){y1.clear();let r=new ms,i=(n,s)=>{if(this.recordData==null)return;let{points:a,result:l}=this.recordData;if(this.isObstructMode()&&this.pointInObstacle){if(this.originListMap&&this.originListMap.size>0){let c=this.originListMap.get(n);if(l.length&&c&&c.length){let h=c[0],u=wt.filter;wt.setPushFilter(),wt.pushFilter.setNetAndLayerId(h.net,h.layerId);let p=new ms().block(h);if(p.length>0){let m=fs.getInstance().getModelObstacle(p[0].obstacle,p[0].clearance,p[0].layer2).outline.outline;y1.displayPolyline(m);let g=c.flatMap(y=>y.primitive);for(let y of g)y1.displayPolyline(y.stroke(h.width,wr.ROUND,ae.CCW))}wt.filter=u}}return}if(a.length&&l.length){let c=l[s];if(c){let h=c[c.length-1],u=h.end,d=n.end.point,p=new M(d,u);if(!d.equals1(a[s])){let m=wt.filter;wt.setPushFilter(),wt.pushFilter.setNetAndLayerId(h.net,h.layerId);let g=r.blockTrackPrimitive(h,p,!0,!1);if(g&&g.length>0){let y=g[0],b=fs.getInstance().getModelObstacle(y.obstacle,y.clearance,y.layer2).outline.outline;y1.displayPolyline(b),this.pointInObstacle&&y1.displayPolyline(p.stroke(h.width,wr.ROUND,ae.CCW)),this.isObstructMode()&&(this.needRedraw2ShowObstaclePl=!0)}wt.filter=m}}}};if(e){let n=t.current.node;i(n,0)}else for(let n=0;n<t.current.tracks.length;n++){let s=t.current.tracks[n];i(s,n)}}checkViaDRC(t){let e=!1,r=Rn.getInstance().current,i=[];if(r.result.wireVia.size>0)for(let a of r.tracks){let l=r.result.wireVia.get(a).item;l&&Si.getInstance().getNode(l)&&i.push(l)}if(!i.length)return;let n=["WIRING_MODE_PUSHAWAY","WIRING_MODE_SURROUND_AND_PUSHAWAY","WIRING_MODE_SURROUND","WIRING_MODE_OBSTRUCT"],s=Zt.getInstance().mode;if(n.includes(s)){let a=new ms;wt.setPushFilter();for(let l of i){wt.pushFilter.setNetAndLayerId(l.net,null);let c=a.drcBlockViaPrimitive2(l);if(c.length){e=!0,this.clear();let h=0,u=.02;for(let P of c)h=Math.max(h,P.clearance),y1.add(P.obstacle,P.layer2,u);let d=Math.max(l.holeRadius-l.radius,0);y1.add(l,r.node.layerId,h+d/2),y1.displayCollideInfo();let p=_o(l.center),m=Math.max(l.holeRadius,l.radius)/2+h,g=l.center.add(new S(m,0)),y=_o(g),b=new vne({viaPosition:{x:p.x,y:p.y,error:0},cb:()=>{this.clear(),t.cb&&t.cb()},cbCancel:()=>{this.clear(),t.cbCancel&&t.cbCancel()}});A.publish("openDialog",b)}}e||t.cb&&t.cb()}}getConstraintObstacle(){return this.obstacle}setConstraintObstacle(t,e){this.obstacle=t,this.obstacleLayerId=e}showViaObstaclePl(t){let e=new Kd;if(["WIRING_MODE_SURROUND_AND_PUSHAWAY","WIRING_MODE_SURROUND","WIRING_MODE_OBSTRUCT"].includes(Zt.getInstance().mode)){this.clear();let i=this.getConstraintObstacle();if(i){let n=new kb,s=n.sycnRule1(t),a=n.sycnRule2(t,!0),c=new kb().sycnRule1(i),h=e.getSafeClearance(s,c,t,this.obstacleLayerId),u=e.getSafeClearance(a,c,t,this.obstacleLayerId),d=h+t.radius,p=u+t.holeRadius,m=d>p?h:u,g=Pe.getActiveLayer().layerID;y1.add(i,this.obstacleLayerId,m),y1.displayCollideInfo(),this.setConstraintObstacle(null,null)}}}clear(t=!0){t&&(this.clearCollidePl(),this.recordData=null);for(let e of this.errors)e.remove();this.errors.length=0}clearCollidePl(){y1.clear()}};o6.manager=null;var Nh=o6;var Aj=class Aj{constructor(){this.pointInObstacle=!1;this.blockShape=new ms;this.isWire=!1}run(t){}backFix(t,e,r=!0){if(!this.isWire)return!1;let n=this.getFirstInputStatus(t).item,l=new Jie(n,new Lr).find(r?n.start:n.end)!=null;return l&&(this.pointInObstacle=!0,Nh.getInstance().pointInObstacle=!0),l}getFirstInputStatus(t){let e=t.listIterator();for(;e.hasNext();){let r=e.next();if(Mr.getInstance().getStatus(r).isInput)return r}return t.getFirstNode()}getLastPoint(t){let e=new Array;for(;t!=null;){e.push(t);let r=t.item,i=this.blockShape.blockTrackPrimitive(r,r.primitive,!0);if(i.length>0&&!i[0].point.equals1(r.start)){for(let n of e){let s=Mr.getInstance().getStatus(n);s.isInput=!0}return!0}t=t.prev}return!1}publish(){if(!this.pointInObstacle)return;let t=Date.now();t-Aj.lastPublishTime>3e3&&(he.publish("ui/toastMsg",{type:"warn",msg:"Track DRC violation detected,track could not be generated,please check the white DRC border"},Q()),Aj.lastPublishTime=t)}isChangeTrack(t){let e=Mr.getInstance().getStatus(t);return e.isInput||!e.notChange}getChangeTracks(t){let e=t.getFirstNode(),r=t.getLastNode();for(;e!=null&&!(this.isChangeTrack(e)||(e=e.next,e==r)););for(;r!=null&&!(this.isChangeTrack(r)||(r=r.prev,e==r)););let i=e,n=[];for(;i!=null&&(n.push(i.item),i!=r);)i=i.next;return n}sycnStatus(t,e){if(t==e)return;let i=Mr.getInstance().getStatus(t).clone();i.change(),Mr.getInstance().setStatus(e,i)}};Aj.lastPublishTime=0;var wI=Aj;var xne=class{constructor(t){this.connectList=new Set;this.via=t;let e=this.getTracks(t.buildBBox());for(let r of e){let i=r.model;if(i instanceof gt&&i.layerId==t.layerId&&i.net==t.net){if(t.inOutline(i.start)){let n=At.getInstance().getListNode(i);n.prev==null&&this.connectList.add(n.parent)}if(t.inOutline(i.end)){let n=At.getInstance().getListNode(i);n.next==null&&this.connectList.add(n.parent)}}}}getTracks(t){return kt.searchByTypes(t,["Track","ArcTrack"]).getTracks()}};var Rne=class{constructor(t){this.pathCCW=new Set;this.pathCW=new Set;this.item=t}addCCW(t){this.pathCCW.add(t)}addCW(t){this.pathCW.add(t)}deleteCCW(t){this.pathCCW.delete(t)}deleteCW(t){this.pathCW.delete(t)}filter(t){let e=new Array,r=null,i=null,n=t[0];this.isDiffPair(n)&&(this.hasOtherDiffPair(n,this.pathCCW)&&(i=ae.CW),this.hasOtherDiffPair(n,this.pathCW)&&(i==null?i=ae.CCW:i=null));for(let s of t){if(r==null){let a=s.item;r=At.getInstance().getNode(a).parent}s.aroundType>=2&&(s.newDirection==0?(this.pathCCW.has(r)||i==ae.CCW)&&(s.cost+=s.weight,this.add2Obstacle(s)):(this.pathCW.has(r)||i==ae.CW)&&(s.cost+=s.weight,this.add2Obstacle(s))),e.push(s)}return e}isDiffPair(t){var e;return((e=re.getInstance().getNet(t.item.net))==null?void 0:e.netDifferential)!=null}hasOtherDiffPair(t,e){var r,i;if(e.size>0){let n=(r=re.getInstance().getNet(t.item.net))==null?void 0:r.netDifferential;for(let s of e)if(n.hasNet((i=s.getFirst())==null?void 0:i.net))return!0}return!1}add2Obstacle(t){if(this.item instanceof Ct){let e=Si.getInstance().getViaNode(this.item);if(e!=null)for(let[r]of e.connectTrack)wt.pushFilter.addExclusionList(r),t.cost+=this.getListLength(r)*2}else if(this.item instanceof et){let e=Kl.getInstance().getNode(this.item);if(e!=null)for(let[r]of e.connectTrack)wt.pushFilter.addExclusionList(r),t.cost+=this.getListLength(r)*2}else if(this.item instanceof gt){let e=At.getInstance().getNode(this.item);e.ignore||(wt.pushFilter.addExclusionList(e.parent),t.cost+=this.getListLength(e.parent)*2)}else if(this.item instanceof or&&(this.item.type=="Fill Region"||this.item.type=="TearDrop"||this.item.type=="Line")&&ns(Ze.getInstance().getLayer(this.item.layerId).type)){let e=new xne(this.item);for(let r of e.connectList)wt.pushFilter.addExclusionList(r),t.cost+=this.getListLength(r)*2}}getListLength(t){let e=t.iterator(),r=0;for(;e.hasNext();){let i=e.next();r+=i.length}return r}};var s6=class s6{constructor(){this.map=new Map;this.temp=new Map;this._last=null}static getInstance(){return s6.manager==null&&(s6.manager=new s6),s6.manager}getObstacleInfo(t){return this._last=this.temp.get(t),this._last==null&&(this._last=new Rne(t),this.temp.set(t,this._last)),this._last}asyn(){let t=new Map;for(let[e,r]of this.temp)t.set(e,r),this._last=this.map.get(e),this._last==null?this.map.set(e,r):(xe.addAllSet(this._last.pathCCW,r.pathCCW),xe.addAllSet(this._last.pathCW,r.pathCW));return this.temp.clear(),t}undo(){this.temp.clear()}filter(t){if(t==null||t.length==0)return t;let e=t[0].obstacle,r=this.map.get(e);return r!=null&&(t=r.filter(t)),t}clear(){this.map.clear(),this.temp.clear()}};s6.manager=null;var Ou=s6;var rF=class extends Kh{constructor(e){super();this.map=new Map;this.map=e}upload(e){}updateData(){}redo(){}undo(){let e=Ou.getInstance();for(let[r,i]of this.map){let n=e.map.get(r);if(n!=null){for(let s of i.pathCCW)n.pathCCW.delete(s);for(let s of i.pathCW)n.pathCW.delete(s)}}}};var $Ce=class{constructor(){this.clearanceUtils=new Kd;this.manager=fs.getInstance();this.pair1=new kb;this.pair2=new kb;this.lockedMap=new Map;this.obstacles=new Set}setFilter(t,e){this.obstacles=t,this.directFilter=e}isObstacle(t,e){return e.shape instanceof gt?this.isObstacle4Track(t,e):this.isObstacle4Via(t,e)}isObstacle4Track(t,e){if(t instanceof gt){let r=At.getInstance().getNode(t);if(this.obstacles.has(r.parent))return!0;if(this.directFilter.canShove(t)&&!t.locked&&!xs(t)&&t.getParent()==null){let i=this.getListNodePushDirect(r);if(i==null||e.pushItems.has(t))return e.pushItems.add(t),!1;{let n=Et(t.primitive),s=i==ae.CCW?new S(-n.y,n.x):new S(n.y,-n.x);return e.direct.dot(s)>0?(e.pushItems.add(t),!1):!0}}}else if(this.directFilter.canShoveViaModel(t))return e.pushItems.add(t),!1;return!0}isObstacle4Via(t,e){var r,i,n,s,a,l,c,h;if(t instanceof gt){let u=At.getInstance().getNode(t);if(this.obstacles.has(u.parent))return!0;if(this.directFilter.canShove(t)&&!t.locked&&!xs(t)&&t.getParent()==null){let d=this.getListNodePushDirect(u);if(d==null||e.pushItems.has(t))return e.pushItems.add(t),!1;{let p=ps.getInstance().getFirstPosition(e.shape),m=Mm(t.primitive,p,(i=(r=u.prev)==null?void 0:r.item)==null?void 0:i.primitive,(s=(n=u.next)==null?void 0:n.item)==null?void 0:s.primitive),g=Mm(t.primitive,e.point,(l=(a=u.prev)==null?void 0:a.item)==null?void 0:l.primitive,(h=(c=u.next)==null?void 0:c.item)==null?void 0:h.primitive);if(m!=g)return!1;if(g!=null&&g==d)return!0;let y=Et(t.primitive),b=d==ae.CCW?new S(-y.y,y.x):new S(y.y,-y.x);return e.direct.dot(b)>0?(e.pushItems.add(t),!1):!0}}}else if(this.directFilter.canShoveViaModel(t)&&!t.locked&&!xs(t)&&t.getParent()==null){let u=ps.getInstance().getFirstPosition(t),d=ps.getInstance().getFirstPosition(e.shape);if(t.center.equals1(u))return e.pushItems.add(t),!1;let p=t.center.sub(u).normalize(),m=e.direct;if(p.dot(m)>.99){let y=u.sub(d);return m.dot(y)>0?(e.pushItems.add(t),!1):!0}}return!0}getListNodePushDirect(t){return Mr.getInstance().getStatus(t).pushDirect}exsitSpaceConstraint(t,e){let r=new _e,i=e?t[t.length-1].end:t[0].start,n=e?t[0].start:t[t.length-1].end;r.ext2(i).ext2(n);let s=r.build(),a=wt.searchOutline(s);for(let l of a){let c=l.getMathGraphics();if(!c.isClose(.01))continue;let h=c.asClose(),u=jr.pointInPolyline(n,h),d=jr.pointInPolyline(i,h);if(u!=d)return!0}return!1}checkViaCollide(t,e){let r=t.shape;if(r instanceof gt){if(e.net!=r.net&&e.isContains(r.layerId)){let i=en.pair1.sycnRule1(r),n=en.pair2.sycnRule1(e);if(!e.isUnuseLayer(r.layerId)){let a=this.update4Track(t,r,e,i,n,r.layerId);if(a!=null)return a}let s=en.pair2.sycnRule2(e,!0);return this.update4Track(t,r,e,i,s,12)}}else if(e.net!=r.net&&!r.isSeparated(e)){let i=Ze.getInstance().getAllSignalLayerIds(),n=en.pair1.sycnRule1(r),s=en.pair1.sycnRule2(r,!0),a=en.pair2.sycnRule1(e),l=en.pair2.sycnRule2(e,!0),c=[];for(let h of i)if(r.isContains(h)){let u=this.getClearance(n,a,e,h),d=this.getClearance(n,l,e,h),p=this.getClearance(s,a,e,h),m=r.radius+u+e.radius,g=r.radius+d+e.holeRadius,y=r.holeRadius+p+e.radius;m>Math.max(g,y)?c.push({distance:m,layerId:h,type:"dis1"}):g>Math.max(m,y)?c.push({distance:g,layerId:h,type:"dis2"}):y>Math.max(m,g)&&c.push({distance:y,layerId:h,type:"dis3"})}if(c.length>0){let h=c.reduce((u,d)=>d.distance>u.distance?d:u);switch(h.type){case"dis1":return this.getPointInHull(t,e,h.distance-e.radius,h.layerId);case"dis2":return this.getPointInHull(t,e,h.distance-e.holeRadius,12);case"dis3":return this.getPointInHull(t,e,h.distance-e.radius,h.layerId)}}}return null}getClearance(t,e,r,i){return this.clearanceUtils.getSafeClearance(t,e,r,i)}update4Track(t,e,r,i,n,s){let a=this.getClearance(i,n,r,s);if(!ne.eq(a,0))return this.getPointInHull(t,r,a+e.width/2,s)}getPointInHull(t,e,r,i){return this.manager.getModelObstacle(e,r,i).outline.getPointInOutline(t.point,ls)}clear(){this.lockedMap.clear()}},en=new $Ce;var a6=class extends Kh{upload(t){}updateData(){}constructor(t,e,r){super(),this.list=t,this.isSource=t.isSource,this.old=e.globalIndex,this.via=r.globalIndex}redo(){let t=this.getVia(this.old);if(t!=null){Si.getInstance().replace(this.list.item,t);let r=this.list.isSource;this.list.isSource=this.isSource,this.isSource=r}let e=this.via;this.via=this.old,this.old=e}undo(){let t=this.getVia(this.old);if(t!=null){Si.getInstance().replace(this.list.item,t);let r=this.list.isSource;this.list.isSource=this.isSource,this.isSource=r}let e=this.via;this.via=this.old,this.old=e}getVia(t){let e=bn.getInstance().getItem(t);return e==null&&(e=Si.getInstance().getItem(t)),e}};var iF=class extends Kh{upload(t){throw new Error("Method not implemented.")}updateData(){throw new Error("Method not implemented.")}constructor(t,e,r="add"){if(super(),this.gId=t.globalIndex,this.node=e,this.action=r,r=="delete"){let i=this.node.connectTrack;for(let[n,s]of i)s?n.viaNode.prev=null:n.viaNode.next=null}}redo(){let t=Si.getInstance().getItem(this.gId);if(t==null||t.isEmpty)throw new Error("via data error!!!");this.node.item=t,Si.getInstance().nodeMap.set(t,this.node)}undo(){if(this.action==="delete"){let t=Si.getInstance().getItem(this.gId);if(t==null||t.isEmpty)throw new Error("via data error!!!");this.node.item=t,Si.getInstance().nodeMap.set(t,this.node);let e=this.node.connectTrack;for(let[r,i]of e)i?r.viaNode.prev=this.node:r.viaNode.next=this.node}else{let t=Si.getInstance().getItem(this.gId);if(t==null||t.isEmpty)throw new Error("via data error!!!");Si.getInstance().nodeMap.delete(t)}}};var IS=class{constructor(){this.viaManager=Si.getInstance();this.viewManager=Cr.getInstance()}cloneVia(t,e){let r=t.clone();r.globalIndex=`VIA${rf.getInstance().getID()}`,this.viaManager.addModel(r),r.partition=R.getInstance().partitionId;let i=new Ny(r,"add");return this.viewManager.current.setViaVisible(r.globalIndex),e.addCommand(i),r}addVia(t,e,r,i,n){let s=this.viaManager.addVia(`VIA${rf.getInstance().getID()}`,0,"",1,2,i,e,t,r,!1,1,-100,-100);s.partition=R.getInstance().partitionId;let a=new Ny(s,"add");return this.viewManager.current.setViaVisible(s.globalIndex),n.addCommand(a),s}addBlind(t,e,r,i,n,s,a,l){let c=this.viaManager.addVia(`VIA${rf.getInstance().getID()}`,1,e,r,i,a,n,t,s,!1,1,-100,-100);c.partition=R.getInstance().partitionId;let h=new Ny(c,"add");return this.viewManager.current.setViaVisible(c.globalIndex),l.addCommand(h),c}deleteVia(t,e){this.viewManager.current.setViaHidden(t.globalIndex);let r=new Ny(t,"delete");e.addCommand(r)}createNode(t,e){let r=this.viaManager.createNode(t,!1),i=new iF(t,r);return e.addCommand(i),r}};var Dne=class{constructor(t){this.offset=S.ORIGIN;this.change=!1;this.via=t,this.oldCenter=t.center,this.center=t.center}setCenter(t){t.equals1(this.oldCenter)||(this.center=t,this.offset=t.sub(this.oldCenter),this.change=!0)}replace(){if(this.change){if(Gr.debug){let t=new PA(this.via.radius,{color:ee.GREEN,net:this.via.net});Gr.inputDebugGraphics(t),t.addCenter(this.via.center),t.addCenter(this.center)}ps.getInstance().changeViaPosition(this.via,this.via.center),this.via.center=this.center,Cr.getInstance().current.setViaVisible(this.via.globalIndex),ps.getInstance().changeViaPosition(this.via,this.via.center),fs.getInstance().change.add(this.via.globalIndex),pa.getInstance().change(this.via.globalIndex),oi.getInstance().updateTree(this.via),this.change=!1}}};function nF(o,t,e,r){let i=new Dne(o);if(i.setCenter(t),i.change){let n=new IS,s=Si.getInstance().getViaNode(i.via);if(s.isSource){let a=n.cloneVia(i.via,e),l=new a6(s,s.item,a);Si.getInstance().replace(i.via,a),e.addCommand(l),i.via=a,s.isSource=!1}for(let[a,l]of s.connectTrack){if(a.size()==0)continue;let c=l?a.getFirst():a.getLast();KCe(c,l,t,r,e)}e.addCommand(new Ny(i.via,"modify")),i.replace()}}function KCe(o,t,e,r,i){let s=At.getInstance().getNode(o).parent;if(t){let h=s.getFirstNode(),u=h.next==null?h:h.next,d=h.item,p=u.item,m=d==r[0],g=d.primitive,y=p.primitive,b=Et(g,g.start()),P=Et(y),T;if(b.equals1(P))T=new Xn().degree45(b,e,p.end);else{let C=a(b);T=l(e,p.end,C)}let I=c(T,d,h,u,t);if(m){let C=0;for(let E of I)r[C++]=E}}else{let h=s.getLastNode(),u=h.prev==null?h:h.prev,d=s.getLast(),p=u.item,m=d==r[r.length-1],g=d.primitive,y=p.primitive,b=Et(g),P=Et(y),T=p.width,I=d.width,C;if(T===I){if(b.equals1(P))C=new Xn().degree45(b,p.start,e);else{let O=!a(b);C=l(p.start,e,O)}let E=c(C,d,u,h,t);if(m)if(r.length>1){let O=r.length-1;E.reverse();for(let _ of E)r[O--]=_}else{r.length=0;for(let O of E)r.push(O)}}}function a(h){return Math.abs(h.cross(new S(0,1)))<dl||Math.abs(h.cross(new S(1,0)))<dl}function l(h,u,d){let m=new Xn().degree45Model(h,u),g=m[0];return d&&(g=m[1]),[h,g,u]}function c(h,u,d,p,m){let g=new Zr,y=g.createList(),b=new Array;for(let P=1;P<h.length;P++){let T=h[P-1],I=h[P],C=P==1?d.item.width:p.item.width,E=g.createTrack(u.layerId,T,I,C,u.showNet,i,u.getGroupID());b.push(E);let O=g.addList(E,y,i),_=P==1?d:p;WVe(_,O)}return y.replace(d,p),i.addCommand(new mi(y)),b}}function HVe(o,t,e,r,i){let n=At.getInstance().getNode(o);if(t){let c=n,h=c.next==null?c:c.next,u=c.item,d=h.item,p=u==r[0],m=u.primitive,g=d.primitive,y=Et(m,m.start()),b=Et(g),P;if(y.equals1(b))P=new Xn().degree45(y,e,d.end);else{let I=s(y);P=a(e,d.end,I)}let T=l(P,u,c,h,t);if(p){let I=0;for(let C of T)r[I++]=C}}else{let c=n.prev==null?n:n.prev,h=o,u=c.item,d=h==r[r.length-1],p=h.primitive,m=u.primitive,g=Et(p),y=Et(m),b=u.width,P=h.width,T;if(b===P){if(g.equals1(y))T=new Xn().degree45(g,u.start,e);else{let C=!s(g);T=a(u.start,e,C)}let I=l(T,h,c,n,t);if(d)if(r.length>1){let C=r.length-1;I.reverse();for(let E of I)r[C--]=E}else{r.length=0;for(let C of I)r.push(C)}}}function s(c){return Math.abs(c.cross(new S(0,1)))<dl||Math.abs(c.cross(new S(1,0)))<dl}function a(c,h,u){let p=new Xn().degree45Model(c,h),m=p[0];return u&&(m=p[1]),[c,m,h]}function l(c,h,u,d,p){let m=new Zr,g=m.createList(),y=new Array;for(let b=1;b<c.length;b++){let P=c[b-1],T=c[b],I=b==1?u.item.width:d.item.width,C=m.createTrack(h.layerId,P,T,I,h.showNet,i,h.getGroupID());y.push(C);let E=m.addList(C,g,i),O=b==1?u:d;WVe(O,E)}return g.replace(u,d),i.addCommand(new mi(g)),y}}function WVe(o,t){if(o==t)return;let r=Mr.getInstance().getStatus(o).clone();r.change(),r.clearPushDirect(),r.isReversePush=!1,Mr.getInstance().setStatus(t,r)}var Cg=class{constructor(t,e,r,i){this._lastPushDirect=null;this.parentMap=new Map;this.isReversePush=!1;this.valid=!0;this.pushItems=new Set;this.shape=t,this._point=e,this.direct=r,this.needContinue=i,this.debug=new PA(.5,{msg:"Constraint"})}get point(){return this._point}set point(t){this._point=t,this.debug.addCenter(t)}setParent(t,e){this.parentMap.set(t,e)}setDirect(t){this._lastPushDirect==null&&!this.direct.equals(S.ORIGIN)&&(this._lastPushDirect=this.direct),this._lastPushDirect!=null&&t!=null&&(this.isReversePush=ne.lesseq(this._lastPushDirect.dot(t),0)),this.direct=t}getStart(t){var e;if(t==11||t==12||t==1004){for(let[,r]of this.parentMap)return r.point;return null}else return(e=this.parentMap.get(t))==null?void 0:e.point}setConstraintObstacle(t,e){e||(e=t.layerId),Nh.getInstance().setConstraintObstacle(t,e)}};var ZCe=class{constructor(t){this.shape=t}bbox(){return this.shape.bbox()}},A3t=Math.sqrt(2),ky=class{constructor(t,e,r=!1){this.tree=new Lb(20);this.min=Number.MAX_VALUE;this.pt=null;this.pointInLine=!1;this.pts=t,this.isClose=r;for(let i of t)this.tree.insert(new ZCe(i));this.point=e}calculateDirect(t=this.point){this.point=t,this.pointInLine=!1;let e=this.tree.bbox(),i=new _e().ext1(e).ext2(this.point).build(),n=Math.max(i.width(),i.height()),s=1;for(;;){let a=this.point.bbox().extendOfSize(s),l=this.getDirect(a,s);if(s>=n){if(l!=null)return l;break}if(l!=null)return l;s*=2}return null}getDirect(t,e){let r=this.tree.search(t),i=new M(this.point,this.point);this.min=e*A3t,this.pt=null;let n=null;if(r.length>0)for(let s of r){let a=new er(i,s.shape);a.getDistance()<this.min&&(this.min=a.getDistance(),this.pt=s.shape,n=s.shape)}if(n!=null){let s=this.pts.indexOf(n),a=s>0?this.pts[s-1]:null;this.isClose&&s==0&&(a=this.pts[this.pts.length-1]);let l=s<this.pts.length-1?this.pts[s+1]:null;this.isClose&&s==this.pts.length-1&&(l=this.pts[0]);let c=Mm(n,this.point,a,l);return c==null?(this.pointInLine=!0,ae.CCW):c}return null}get index(){return this.pt!=null?this.pts.indexOf(this.pt):-1}};var M3=class{constructor(t){this.manager=fs.getInstance();this.clearanceUtils=new Kd;this.hasConstraint=!1;this.shape=t}constraint(t){return!1}getNearPoint(t,e){let i=new er(t,new M(e,e)).getLine();return i.start().equals1(e)?i.end():i.end().equals1(e)?i.start():e}getDirect(t,e,r){let i=Et(t,e);return r==ae.CCW?new S(-i.y,i.x):new S(i.y,-i.x)}calculatePolylineNearPoint(t,e,r){let i=new M(e,r),n=new Array;for(let s of t.primitives){if(s.bbox().isSeparated(i.bbox()))continue;let a=Pt(i,s);for(let l=0;l<a;l+=2){let c=new S(Ee[l],Ee[l+1]);n.push({pt:s,point:c})}}if(n.length>0){P0(n,i);let s=n[0];return this.getNearPoint(s.pt,r)}else return r}calculatePolylineSameDistancePoint(t,e){return t.calculateDirect(e),this.getNearPoint(t.pt,e)}getClearance(t,e,r,i){return this.clearanceUtils.getSafeClearance(t,e,r,i)}getConnectTrack(t,e){let r=Si.getInstance().getViaNode(t),i=0,n=null;for(let[s,a]of r.connectTrack){if(s.size()==0)continue;let l=a?s.getFirst():s.getLast();l.layerId==e&&l.width>i&&(i=l.width,n=l)}return n}getTrack(t){let e=Si.getInstance().getViaNode(t),r=0,i=null;for(let[n,s]of e.connectTrack){if(n.size()==0)continue;let a=s?n.getFirst():n.getLast();a.width>r&&(r=a.width,i=a)}return i}getPointInHull(t,e,r,i){return this.manager.getModelObstacle(e,r,i).outline.getPointInOutline(t.point,ls)}update4Polyline(t,e,r){if(t!=null){if(e.obstacleLayerId=r,e.isReversePush&&e.getStart(r)!=null){let l=this.calculatePolylineNearPoint(t,e.getStart(r),e.point);if(!e.point.equals1(l)){e.point=l,this.hasConstraint=!0;return}}if(e.direct.equals1(S.ORIGIN))return this.update4Near(t,e);let i=new _e;i.ext2(e.point).ext1(t.bbox());let n=i.build1(),s=new M(e.point,e.point.add(e.direct.mul(n.width()+n.height()+10))),a=new Array;for(let l of t.primitives){let c=Pt(s,l);for(let h=0;h<c;h+=2){let u=new S(Ee[h],Ee[h+1]);u.equals1(e.point)||a.push(u)}}if(a.length>0){an(a,s);let l=new ky(t.primitives,e.point,t.isClose(.01)),c=this.calculatePolylineSameDistancePoint(l,e.point);if(!c.equals1(e.point)&&ne.less(c.distance2(e.point),a[0].distance2(e.point))){let h=c.sub(e.point).normalize();if(ne.greatereq(h.dot(e.direct),0))e.setDirect(h),a[0]=c;else{let u=e.direct.cross(c.sub(e.point));u>0?(h=new S(-e.direct.y,e.direct.x),e.setDirect(h),a[0]=e.point.add(h.mul(Math.abs(u)))):(h=new S(e.direct.y,-e.direct.x),e.setDirect(h),a[0]=e.point.add(h.mul(Math.abs(u))))}}e.point=a[0],e.needContinue=!0,this.hasConstraint=!0}}}update4Near(t,e){let r=new ky(t.primitives,e.point,t.isClose(.01)),i=this.calculatePolylineSameDistancePoint(r,e.point);if(!i.equals1(e.point)){let n=i.sub(e.point).normalize();e.setDirect(n),e.point=i,this.hasConstraint=!0}}update4Track(t,e,r,i,n){let s=this.getClearance(r,i,this.shape,n);if(ne.eq(s,0))return;let a=this.getPointInHull(t,this.shape,s+e.width/2,n);a!=null&&this.update4Polyline(a,t,n)}update4Via(t,e,r,i){if(ne.eq(r,0))return;let n=this.getPointInHull(t,this.shape,r+e,i);n!=null&&this.update4Polyline(n,t,i)}};var wne=class extends M3{constructor(t,e){super(t),this.pointOnlyNoneDrc=e}constraint(t){let e=!1,r=0;do this.hasConstraint=!1,this.drcConstraint(t),this.spaceConstraint(t),this.hasConstraint&&(e=!0),r++;while(this.hasConstraint&&r<20);return e&&t.setConstraintObstacle(this.shape,t.obstacleLayerId),e}drcConstraint(t){let e=t.shape,r=Ze.getInstance().getAllSignalLayerIds();if(e instanceof gt)switch(this.shape.type){case"Board Outline":case"Line":{if(this.shape.net!=e.net&&this.shape.layerId==e.layerId||this.shape.layerId==11){let i=en.pair1.sycnRule1(e),n=en.pair2.sycnRule1(this.shape);this.update4Track(t,e,i,n,this.shape.layerId)}break}case"Partition":{let i=this.getPointInHull(t,this.shape,1e-4,this.shape.layerId);i!=null&&this.update4Polyline(i,t,this.shape.layerId);break}}else switch(this.shape.type){case"Board Outline":if(this.shape.layerId==11){let i=en.pair1.sycnRule1(e),n=en.pair1.sycnRule2(e,!0),s=en.pair2.sycnRule1(this.shape),a=this.getClearance(n,s,e,this.shape.layerId),l=e.holeRadius+a,c=[];for(let u of r){let d=this.getClearance(i,s,e,u),p=e.radius+d;c.push({distance:p,layerId:u,type:"dis1"})}c.push({distance:l,layerId:this.shape.layerId,type:"dis2"});let h=this.getTrack(e);if(h!=null){let u=en.pair1.sycnRule1(h),d=this.getClearance(u,s,e,h.layerId),p=h.width/2+d;c.push({distance:p,layerId:h.layerId,type:"dis3"})}if(c.length>0){let u=c.reduce((d,p)=>p.distance>d.distance?p:d);switch(u.type){case"dis1":this.update4Via(t,e.radius,this.getClearance(i,s,e,u.layerId),u.layerId);break;case"dis2":this.update4Via(t,e.holeRadius,a,u.layerId);break;case"dis3":let d=this.getPointInHull(t,this.shape,u.distance,u.layerId);d!=null&&this.update4Polyline(d,t,u.layerId);break}}}break;case"Line":{if(this.shape.net!=e.net&&e.isContains(this.shape.layerId)){let i=en.pair1.sycnRule1(e),n=en.pair1.sycnRule2(e,!0),s=en.pair2.sycnRule1(this.shape),a=this.getClearance(i,s,e,this.shape.layerId),l=this.getClearance(n,s,e,this.shape.layerId),c=this.shape.layerId==11?this.getTrack(e):this.getConnectTrack(e,this.shape.layerId),h=e.radius+a,u=e.holeRadius+l,d=0;if(c!=null){let p=en.pair1.sycnRule1(c),m=this.getClearance(p,s,e,c.layerId);d=c.width/2+m}if(d>Math.max(h,u)){let p=this.getPointInHull(t,this.shape,d,this.shape.layerId);p!=null&&this.update4Polyline(p,t,this.shape.layerId)}else e.radius+a>=e.holeRadius+l?this.update4Via(t,e.radius,a,this.shape.layerId):this.update4Via(t,e.holeRadius,l,this.shape.layerId)}break}case"Partition":{let i=this.getPointInHull(t,this.shape,1e-4,this.shape.layerId);i!=null&&this.update4Polyline(i,t,this.shape.layerId);break}}}spaceConstraint(t){let e=t.shape;switch(this.shape.type){case"Board Outline":case"Line":{if(this.shape.net!=e.net&&(e instanceof gt&&this.shape.layerId==e.layerId||e instanceof Ct&&e.isContains(this.shape.layerId))||this.shape.layerId==11){let r=this.shape.getMathGraphics();if(!r.isClose(.01))return;let i=t.getStart(this.shape.layerId);i==null&&(i=t.point);let n=t.point,s=r.asClose(),a=jr.pointInPolyline(i,s),l=jr.pointInPolyline(n,s);if(!this.pointOnlyNoneDrc&&a!=l){let c=this.calculatePolylineNearPoint(r,i,n);if(!c.equals1(n)){let h=c.sub(n).normalize();t.setDirect(h),t.point=c,t.isReversePush=!0,this.hasConstraint=!0}}}break}case"Partition":{let r=this.shape.getMathGraphics(),i=r.asClose(),n=jr.pointInPolyline(t.point,i);if(this.shape.globalIndex==e.partition&&n)return;if(this.shape.globalIndex!=e.partition&&!n)return;let s=t.getStart(this.shape.layerId);s==null&&(s=t.point),this.shape.partition==e.globalIndex&&(jr.pointInPolyline(s,r)||(s=r.bbox().center()));let a=this.calculatePolylineNearPoint(r,s,t.point);if(!a.equals1(t.point)){let l=a.sub(t.point).normalize();t.setDirect(l),t.isReversePush=!0,t.point=a,this.hasConstraint=!0}break}}}};var oF=class extends M3{constraint(t){let e=!1,r=0;do this.hasConstraint=!1,this.drcConstraint(t),this.hasConstraint&&(e=!0),r++;while(this.hasConstraint&&r<20);return e&&t.setConstraintObstacle(this.shape,t.obstacleLayerId),e}drcConstraint(t){let e=t.shape,r=Ze.getInstance().getAllSignalLayerIds();if(this.shape instanceof et){if(e instanceof gt){if(this.shape.net!=e.net&&(this.shape.layerId==e.layerId||this.shape.layerId==12)){let i=en.pair1.sycnRule1(e),n=en.pair2.sycnRule1(this.shape);if(this.shape.isUnuseLayer(e.layerId)||this.update4Track(t,e,i,n,e.layerId),this.shape.layerId==12){let s=en.pair2.sycnRule2(this.shape,!0);this.update4Track(t,e,i,s,12)}}}else if(this.shape.net!=e.net&&(e.isContains(this.shape.layerId)||this.shape.layerId==12))if(this.shape.layerId==12){let i=en.pair1.sycnRule1(e),n=en.pair1.sycnRule2(e,!0),s=en.pair2.sycnRule1(this.shape),a=en.pair2.sycnRule1(this.shape,!0);for(let l of r)if(e.isContains(l)){let c=this.getClearance(i,s,this.shape,l),h=this.getClearance(n,s,this.shape,l),u=e.radius+c,d=e.holeRadius+h,p=0,m=this.getConnectTrack(e,l);if(m!=null){let y=en.pair1.sycnRule1(m),b=this.getClearance(y,s,e,l);p=m.width/2+b}if(p>Math.max(u,d)){let y=this.getPointInHull(t,this.shape,p,l);y!=null&&this.update4Polyline(y,t,l)}else u>d?this.update4Via(t,e.radius,c,l):this.update4Via(t,e.holeRadius,h,l);let g=this.getClearance(i,a,this.shape,l);this.update4Via(t,e.radius,g,12)}}else{let i=en.pair1.sycnRule1(e),n=en.pair1.sycnRule2(e,!0),s=en.pair2.sycnRule1(this.shape),a=this.getClearance(i,s,e,this.shape.layerId),l=this.getClearance(n,s,e,this.shape.layerId),c=e.radius+a,h=e.holeRadius+l,u=0,d=this.getConnectTrack(e,this.shape.layerId);if(d!=null){let p=en.pair1.sycnRule1(d),m=this.getClearance(p,s,e,this.shape.layerId);u=d.width/2+m}if(u>Math.max(c,h)){let p=this.getPointInHull(t,this.shape,u,this.shape.layerId);p!=null&&this.update4Polyline(p,t,this.shape.layerId)}else c>=h?this.update4Via(t,e.radius,a,this.shape.layerId):this.update4Via(t,e.holeRadius,l,this.shape.layerId)}}else if(this.shape instanceof Li||this.shape instanceof Dl){if(e instanceof gt){if(this.shape.layerId==e.layerId){let i=en.pair1.sycnRule1(e),n=en.pair2.sycnRule1(this.shape);this.update4Track(t,e,i,n,this.shape.layerId)}}else if(e.isContains(this.shape.layerId)){let i=en.pair1.sycnRule1(e),n=en.pair1.sycnRule2(e,!0),s=en.pair2.sycnRule1(this.shape),a=this.getClearance(i,s,e,this.shape.layerId),l=this.getClearance(n,s,e,this.shape.layerId),c=e.radius+a,h=e.holeRadius+l,u=0,d=this.getConnectTrack(e,this.shape.layerId);if(d!=null){let p=en.pair1.sycnRule1(d),m=this.getClearance(p,s,e,this.shape.layerId);u=d.width/2+m}if(u>Math.max(c,h)){let p=this.getPointInHull(t,this.shape,u,this.shape.layerId);p!=null&&this.update4Polyline(p,t,this.shape.layerId)}else e.radius+a>=e.holeRadius+l?this.update4Via(t,e.radius,a,this.shape.layerId):this.update4Via(t,e.holeRadius,l,this.shape.layerId)}}else if(e instanceof gt)switch(this.shape.type){case"TearDrop":case"Fill Region":{if(this.shape.layerId==e.layerId&&this.shape.net!=e.net){let n=en.pair1.sycnRule1(e),s=en.pair2.sycnRule1(this.shape);this.update4Track(t,e,n,s,this.shape.layerId)}break}case"Slot Region":{let n=en.pair1.sycnRule1(e),s=en.pair2.sycnRule1(this.shape);this.update4Track(t,e,n,s,this.shape.layerId);break}case"Prohibited Region":{if(this.shape.layerId==e.layerId||this.shape.layerId==12){let n=this.shape.component,s=1e-4;if(n.track){let a=this.getPointInHull(t,this.shape,s+e.width/2,this.shape.layerId);a!=null&&this.update4Polyline(a,t,this.shape.layerId)}}break}}else switch(this.shape.type){case"TearDrop":case"Fill Region":{let n=this.shape.net!=e.net,s=this.shape.component;if(s instanceof Zi&&s.isBridgingCopper){let a=s.networkList;a.length==0&&e.net==""||a.length==1&&e.net==a[0]?n=!1:n=!0}if(e.isContains(this.shape.layerId)&&n){let a=en.pair1.sycnRule1(e),l=en.pair1.sycnRule2(e,!0),c=en.pair2.sycnRule1(this.shape),h=this.getClearance(a,c,e,this.shape.layerId),u=this.getClearance(l,c,e,this.shape.layerId),d=e.radius+h,p=e.holeRadius+u,m=0,g=this.getConnectTrack(e,this.shape.layerId);if(g!=null){let y=en.pair1.sycnRule1(g),b=this.getClearance(y,c,e,this.shape.layerId);m=g.width/2+b}if(m>Math.max(d,p)){let y=this.getPointInHull(t,this.shape,m,this.shape.layerId);y!=null&&this.update4Polyline(y,t,this.shape.layerId)}else e.radius+h>=e.holeRadius+u?this.update4Via(t,e.radius,h,this.shape.layerId):this.update4Via(t,e.holeRadius,u,this.shape.layerId)}break}case"Slot Region":{let n=en.pair1.sycnRule1(e),s=en.pair1.sycnRule2(e,!0),a=en.pair2.sycnRule1(this.shape),l=this.getClearance(s,a,e,this.shape.layerId),c=e.holeRadius+l,h=[];for(let u of r)if(e.isContains(u)){let d=this.getClearance(n,a,e,u),p=e.radius+d;h.push({distance:p,layerId:u,type:"dis1"});let m=this.getConnectTrack(e,u);if(m!=null){let g=en.pair1.sycnRule1(m),y=this.getClearance(g,a,e,u),b=m.width/2+y;b>0&&h.push({distance:b,layerId:u,type:"dis3"})}}if(h.push({distance:c,layerId:this.shape.layerId,type:"dis2"}),h.length>0){let u=h.reduce((d,p)=>p.distance>d.distance?p:d);switch(u.type){case"dis1":this.update4Via(t,e.radius,this.getClearance(n,a,e,u.layerId),u.layerId);break;case"dis2":this.update4Via(t,e.holeRadius,l,u.layerId);break;case"dis3":let d=this.getPointInHull(t,this.shape,u.distance,u.layerId);d&&this.update4Polyline(d,t,u.layerId);break}}break}}}};var LI=class extends M3{constructor(e,r){super(e);this.map=new Map;this.onlyDrc=r}constraint(e){let r=!1,i=0;do this.hasConstraint=!1,this.drcConstraint(e),this.onlyDrc||this.spaceConstraint(e),this.hasConstraint&&(r=!0),i++;while(this.hasConstraint&&i<20);return r&&e.setConstraintObstacle(this.shape),r}drcConstraint(e,r=this.shape){let i=this.getHull(e,r);this.calculate4Hull(i,r,e)}getHull(e,r){let i=e.shape;if(i instanceof gt){if(i.net!=r.net&&i.layerId==r.layerId){let n=en.pair1.sycnRule1(i),s=en.pair2.sycnRule1(r),a=this.getClearance(n,s,r,this.shape.layerId);return ne.eq(a,0)?null:this.getPointInHull(e,r,a+i.width/2,r.layerId)}}else if(i.net!=r.net&&i.isContains(r.layerId)){let n=en.pair1.sycnRule1(i),s=en.pair1.sycnRule2(i,!0),a=en.pair2.sycnRule1(r),l=this.getClearance(n,a,i,r.layerId),c=this.getClearance(s,a,i,r.layerId),h,u=this.getConnectTrack(i,r.layerId),d=i.radius+l,p=i.holeRadius+c,m=0;if(u!=null){let g=en.pair1.sycnRule1(u),y=this.getClearance(g,a,i,r.layerId);m=u.width/2+y}if(m>Math.max(d,p))h=this.getPointInHull(e,r,m,r.layerId);else if(d>=p){if(ne.eq(l,0))return null;h=this.getPointInHull(e,r,d,r.layerId)}else{if(ne.eq(c,0))return null;h=this.getPointInHull(e,r,p,r.layerId)}return h}return null}calculate4Hull(e,r,i){if(e!=null){let n=At.getInstance().getListNode(r),a=Mr.getInstance().getStatus(n).pushDirect;if(a!=null){let l=this.getListPrimitives(n.parent),c=new ky(l,i.point),h=c.calculateDirect(i.point),u=this.getNearPoint(c.pt,i.point),d=this.getDirect(c.pt,u,a),p=i.shape,m=!1;if(p instanceof gt){let y=At.getInstance().getListNode(p);m=Mr.getInstance().getStatus(y).isSource==!0}let g=c.calculateDirect(i.parentMap.get(r.layerId).point||i.point);g!=h&&g!=a||m&&g==h&&g!=a?i.setDirect(d.mul(-1)):i.setDirect(d)}this.update4Polyline(e,i,this.shape.layerId)}}spaceConstraint(e){let r=e.shape;if(r.net!=this.shape.net&&r instanceof gt&&r.layerId==this.shape.layerId||r instanceof Ct&&r.isContains(this.shape.layerId)&&e.parentMap.get(this.shape.layerId)!=null){let i=At.getInstance().getListNode(this.shape),n=this.getListPrimitives(i.parent),s=new ky(n,e.point),a=s.calculateDirect(e.parentMap.get(this.shape.layerId).point),l=s.pointInLine,c=s.calculateDirect(e.point),h=s.pointInLine;if((l||h)&&(c=a),a!=c){let u;e.isReversePush?u=this.calculatePolylineNearPoint(ge.build7(n),e.parentMap.get(this.shape.layerId).point,e.point):u=this.calculatePolylineSameDistancePoint(s,e.point);let d=s.index;if(n.length>1&&d==0&&u.equals1(n[0].start())||n.length>1&&d==n.length-1&&u.equals1(n[n.length-1].end()))return;if(!u.equals1(e.point)){let p=Et(s.pt,u),m=a==ae.CCW?new S(-p.y,p.x):new S(p.y,-p.x);e.setDirect(m),e.point=u;let g=this.map.get(s.index);if(g!=null){g==this.shape&&(e.isReversePush=!1);let y=this.getHull(e,g);this.update4Polyline(y,e,this.shape.layerId)}this.hasConstraint=!0}}}}getListPrimitives(e){let r=new Array(e.size()),i=e.iterator(),n=0,s;for(;i.hasNext();)s=i.next(),r[n]=s.primitive,this.map.set(n,s),n++;return r}};var Lne=class extends M3{constructor(t){super(t)}constraint(t){let e=!1,r=0;do this.hasConstraint=!1,this.drcConstraint(t),this.hasConstraint&&(e=!0),r++;while(this.hasConstraint&&r<20);return e&&t.setConstraintObstacle(this.shape,t.obstacleLayerId),e}drcConstraint(t){let e=t.shape;if(e instanceof gt){if(this.shape.net!=e.net&&this.shape.isContains(e.layerId)){let r=en.pair1.sycnRule1(e),i=en.pair2.sycnRule1(this.shape);this.shape.isUnuseLayer(e.layerId)||this.update4Track(t,e,r,i,e.layerId);let n=en.pair2.sycnRule2(this.shape,!0);this.update4Track(t,e,r,n,12)}}else if(this.shape.net!=e.net&&!e.isSeparated(this.shape)){let r=Ze.getInstance().getAllSignalLayerIds(),i=en.pair1.sycnRule1(e),n=en.pair1.sycnRule2(e,!0),s=en.pair2.sycnRule1(this.shape),a=en.pair2.sycnRule2(this.shape,!0),l=[];for(let c of r)if(e.isContains(c)){let h=this.getClearance(i,s,this.shape,c),u=this.getClearance(i,a,this.shape,c),d=this.getClearance(n,s,this.shape,c),p=e.radius+h+this.shape.radius,m=e.radius+u+this.shape.holeRadius,g=e.holeRadius+d+this.shape.radius;l.push({distance:p,layerId:c,type:"dis1"}),l.push({distance:m,layerId:c,type:"dis2"}),l.push({distance:g,layerId:c,type:"dis3"});let y=this.getConnectTrack(e,c);if(y!=null){let b=en.pair1.sycnRule1(y),P=this.getClearance(b,s,e,c),T=y.width/2+P;T>0&&l.push({distance:T,layerId:c,type:"dis5"})}}if(l.length>0){let c=l.reduce((h,u)=>u.distance>h.distance?u:h);switch(c.type){case"dis5":let h=this.getPointInHull(t,this.shape,c.distance,c.layerId);h!=null&&this.update4Polyline(h,t,c.layerId);break;case"dis1":this.update4Via(t,e.radius,c.distance-e.radius-this.shape.radius,c.layerId);break;case"dis2":this.update4Via(t,e.radius,c.distance-e.radius-this.shape.holeRadius,c.layerId);break;case"dis3":this.update4Via(t,e.holeRadius,c.distance-e.holeRadius-this.shape.radius,c.layerId);break}}}}};var sF=class{constructor(t,e,r,i=new Set){this.block=new ms;this.endtime=0;this.success=!0;this.obstacles=new Set;this.used=new Set;this.endtime=t,this.isWire=e,this.obstacles=i,this.directFilter=r,en.setFilter(this.obstacles,this.directFilter)}isInput(t){let e=At.getInstance().getListNode(t);return Mr.getInstance().getStatus(e).isInput}getConstraintPoint(t,e,r,i){let n=new Cg(t,e,S.ORIGIN,!0),s=new Cg(t,r,S.ORIGIN,!0);return s.setParent(i,n),s}addObstacle(t){this.obstacles.add(t);let e=t.otherNode.prev;e!=null&&e instanceof Fn&&this.obstacles.add(e);let r=t.otherNode.next;r!=null&&r instanceof Fn&&this.obstacles.add(r)}searchItems(){this.constraintPoint.needContinue=!1;let t=this.constraintPoint.point,r=re.getInstance().getMaxSafe(),i=this.getSize(),n=t.bbox().extendOfSize(i+r),s=wt.search1(n),a=new _e().ext2(t);for(let[,h]of this.constraintPoint.parentMap)a.ext2(h.point);a.ext7(i+r);let l=a.build(),c=wt.searchOutline(l);for(let h of c)s.addModel(h);return s}search(){let t=this.searchItems();for(let e of t.tracks){let r=new LI(e,this.onlyDrc(e));if(!(e.net==this.net||r.getHull(this.constraintPoint,e)==null||!en.isObstacle(e,this.constraintPoint))&&r.constraint(this.constraintPoint)){let i=At.getInstance().getListNode(e).parent;return this.addObstacle(i),!0}}for(let e of t.pads)if(new oF(e).constraint(this.constraintPoint))return!0;for(let e of t.vias){if(e.net==this.net||en.checkViaCollide(this.constraintPoint,e)==null||!en.isObstacle(e,this.constraintPoint))continue;if(new Lne(e).constraint(this.constraintPoint))return!0}for(let e of t.profiles)switch(e.type){case"Prohibited Region":case"Slot Region":case"TearDrop":case"Fill Region":{if(new oF(e).constraint(this.constraintPoint))return!0;break}case"Board Outline":case"Partition":case"Line":{if(new wne(e,this.closeShapeOnlyDrc(e)).constraint(this.constraintPoint))return!0;break}}for(let e of t.imageTexts)if(new oF(e).constraint(this.constraintPoint))return!0;return!1}offset(){this.init();let t=0;do{if(!this.search())break;t++}while(t<25&&performance.now()<this.endtime);Gr.debug&&Gr.inputDebugGraphics(this.constraintPoint.debug)}sycnShoveInfo(){if(this.success)for(let t of this.constraintPoint.pushItems)t instanceof gt?this.directFilter.awaitShove.add(t):this.directFilter.awaitShove.add(Si.getInstance().getNode(t))}sycnStatus(t,e){if(t==e)return;let i=Mr.getInstance().getStatus(t).clone();i.change(),Mr.getInstance().setStatus(e,i)}};var MI=class extends sF{constructor(t,e,r,i,n,s,a=new Set){super(i,n,s,a),this.tracks=t,this.findNewEnd=r,this.command=e,r?(this.track=t[t.length-1],this.constraintPoint=this.getConstraintPoint(this.track,this.tracks[0].start,this.track.end,this.track.layerId)):(this.track=t[0],this.constraintPoint=this.getConstraintPoint(this.track,this.tracks[this.tracks.length-1].end,this.track.start,this.track.layerId)),this.pointCollideTrack=this.getFirstCollideTrack(),en.setFilter(this.obstacles,this.directFilter);let c=At.getInstance().getListNode(this.track).parent;if(this.isWire)this.fix=!1;else{let h=en.lockedMap.get(c);h!=null?this.fix=r?!h:h:this.fix=!1}}getFirstCollideTrack(){if(this.findNewEnd)for(let t=this.tracks.length-1;t>=0;t--){let e=this.tracks[t],r=this.block.blockTrackOnlyTrack(e,this.findNewEnd?e.primitive.reverse():e.primitive,!0);for(let i of r){let n=i.obstacle;if(!i.isSameNet&&n instanceof gt)return n}}else for(let t=0;t<this.tracks.length;t++){let e=this.tracks[t],r=this.block.blockTrackOnlyTrack(e,this.findNewEnd?e.primitive.reverse():e.primitive,!0);for(let i of r){let n=i.obstacle;if(!i.isSameNet&&n instanceof gt)return n}}return null}get net(){return this.track.net}closeShapeOnlyDrc(t){return t.layerId!=12&&t.layerId!=11&&t.layerId!=1004&&this.track.layerId!=t.layerId?!0:this.isWire?!this.findNewEnd:this.fix}constraintCheck(t){let e=this.block.blockTrackOnlyTrack(t,this.findNewEnd?t.primitive:t.primitive.reverse(),!0);if(e.length>0)for(let r of e){let i=r.obstacle;if(!r.isSameNet&&i instanceof gt){let s=At.getInstance().getListNode(i).parent;if(this.used.has(s))continue;this.used.add(s);let a=this.isWire?this.isInput(i):!1;if(new LI(i,a).constraint(this.constraintPoint))return this.addObstacle(s),!0;if(this.pointCollideTrack!=null&&At.getInstance().getListNode(this.pointCollideTrack).parent==s)return this.addObstacle(s),!0}}return!1}getConstraintPoint(t,e,r,i){let n=new Cg(t,e,S.ORIGIN,!0),s=new Cg(t,r,S.ORIGIN,!0);return s.setParent(i,n),s}getSize(){return this.track.width/2}onlyDrc(t){return t.layerId!=this.track.layerId||t.locked||xs(t)||t.getParent()!=null||this.isWire&&this.isInput(t)}init(){if(this.findNewEnd)for(let t=0;t<this.tracks.length&&!this.constraintCheck(this.tracks[t]);t++);else for(let t=this.tracks.length-1;t>=0&&!this.constraintCheck(this.tracks[t]);t--);}getResult(){this.sycnShoveInfo(),KCe(this.track,!this.findNewEnd,this.constraintPoint.point,this.tracks,this.command)}};var CS=class extends MI{constructor(e,r,i,n,s,a,l,c=new Set){super(e,i,n,s,a,l,c);this.layerMap=new Map;this.via=r,n?this.constraintPoint=this.getConstraintPoint(this.via,this.tracks[0].start,this.tracks[this.tracks.length-1].end,this.track.layerId):this.constraintPoint=this.getConstraintPoint(this.via,this.tracks[this.tracks.length-1].end,this.tracks[0].start,this.track.layerId);let h=Si.getInstance().getViaNode(this.via);this.directFilter=l,this.directFilter.awaitShove.has(h)&&(this.directFilter.awaitShove.delete(h),this.directFilter.awaitingVias.add(h))}onlyDrc(e){return this.layerMap.get(e.layerId)?this.isWire?this.isInput(e):!1:!0}closeShapeOnlyDrc(e){return e.layerId!=12&&e.layerId!=11&&e.layerId!=1004&&!this.layerMap.get(e.layerId)?!0:this.isWire?!this.findNewEnd:this.fix}trackCheck(e,r,i,n){let s=this.block.blockTrackOnlyTrack(e,r?e.primitive.reverse():e.primitive,!0);if(s.length>0)for(let a of s){let l=a.obstacle;if(!a.isSameNet&&l instanceof gt){let h=At.getInstance().getListNode(l).parent;if(this.obstacles.has(h))continue;this.addObstacle(h);let u=this.constraintPoint.parentMap.get(e.layerId);return u==null?(u=new Cg(this.via,a.point,S.ORIGIN,!0),this.constraintPoint.setParent(e.layerId,u)):u.point=a.point,i.set(n,a),!0}}else{let a=this.constraintPoint.parentMap.get(e.layerId);if(a==null){let l=ps.getInstance().getFirstPosition(this.via);a=new Cg(this.via,l,S.ORIGIN,!0),this.constraintPoint.setParent(e.layerId,a)}}return!1}init(){let e=0,r=Si.getInstance().getViaNode(this.via),i=new Map;for(let[c,h]of r.connectTrack)if(h){let u=c.getLastNode();for(;u!=null;){let d=u.item;if(this.trackCheck(d,h,i,c))break;u=u.prev}}else{let u=c.getFirstNode();for(;u!=null;){let d=u.item;if(this.trackCheck(d,h,i,c))break;u=u.next}}let n=Ze.getInstance().getAllCopperLayerIds(),s=ps.getInstance().getFirstPosition(this.via);for(let c of n)if(this.constraintPoint.parentMap.get(c)==null){this.layerMap.set(c,!1);let h=new Cg(this.via,s,S.ORIGIN,!0);this.constraintPoint.setParent(c,h)}else this.layerMap.set(c,!0);let a=!1,l=new Ta;do{a=!1;for(let[c]of r.connectTrack){let h=i.get(c);if(h!=null){let u=h.obstacle;new LI(u,this.onlyDrc(u)).constraint(this.constraintPoint)&&!l.contains(this.constraintPoint.point)&&(a=!0,l.add(this.constraintPoint.point),this.constraintPoint.setConstraintObstacle(u))}}e++}while(a&&e<20)}getSize(){return Math.max(this.via.radius,this.via.holeRadius)}getResult(){this.sycnShoveInfo(),nF(this.via,this.constraintPoint.point,this.command,this.tracks)}};var N3=class{constructor(){this.obstacles=new Set;this.canShovePath=new Set;this.canShoveVia=new Set;this.awaitShove=new Set;this.awaitingVias=new Set;this.completes=new Set;this.max=-1}canShove(t){if(this.obstacles.has(t))return!1;let e=this.getPath(t);return this.canShovePath.has(e)}canShoveViaModel(t){if(this.obstacles.has(t))return!1;let e=Si.getInstance().getViaNode(t);return this.canShoveVia.has(e)}getPath(t){let e=At.getInstance().getNode(t);return e!=null?e.parent:null}};var aF=class{constructor(t,e){this.block=new ms;this.used=new Set;if(this.tracks=t,this.findNewEnd=e,e){this.track=t[t.length-1];for(let r of t){let i=this.block.blockTrackOnlyTrack(r,r.primitive,!0);if(this.classify(i))break}}else{this.track=t[0];for(let r=this.tracks.length-1;r>=0;r--){let i=this.tracks[r],n=this.block.blockTrackOnlyTrack(i,i.primitive.reverse(),!0);if(this.classify(n))break}}}classify(t){for(let e of t){let r=e.obstacle;if(!e.isSameNet&&r instanceof gt&&e.source instanceof gt&&this.calculateSameListObstacles(r,e.point,this.findNewEnd))return!0}return!1}calculateSameListObstacles(t,e,r){let n=this.getListNode(t).parent;if(!this.used.has(n))if(r){let a=n.toArray().map(u=>u.primitive),l=new ky(a,e),c=l.calculateDirect(e),h=l.calculateDirect(this.track.end);return c==h?!0:(this.used.add(n),!1)}else{let a=n.toArray().map(u=>u.primitive),l=new ky(a,e),c=l.calculateDirect(e),h=l.calculateDirect(this.track.start);return c==h?!0:(this.used.add(n),!1)}}getListNode(t){return At.getInstance().getListNode(t)}};var Mne=class{constructor(){this.F=0;this.G=0;this.H=0;this.P=0;this.parent=null;this.modCount=0;this.weight=0}calcF(){this.F=this.G+this.H}sycn(t){t.F=this.F,t.G=this.G,t.H=this.H,t.P=this.P,t.parent=this.parent,t.modCount=this.modCount}},_j=class{constructor(t){this.node=t,this.modCount=t.modCount}notChanged(){return this.modCount===this.node.modCount}};function _3t(o,t){return o.node.F-t.node.F}var Nne=class{constructor(t,e,r,i){this.queue=new O3(_3t);this.openSet=new hd;this.closeSet=new Ta;this.currentNode=null;this.success=!0;this.timeout=performance.now()+t,this.findNeighborNodes=i,this.endNode=this._findPath(e,r)}_findPath(t,e){var r=null;let i=Number.MAX_VALUE;for(this.openSet.put(t,t),this.queue.add(new _j(t));;){let n=this.findMinFNodeInOpneList();if(this.currentNode=n,n!==null&&performance.now()<this.timeout){this.openSet.remove(n),n.modCount++;let s=this.findNeighborNodes(n,this.closeHas.bind(this),this.addCloseSet.bind(this));if(n.sycn(this.currentNode),n.findCount>1&&this.currentNode!=n){let l=n;l.newParent!=null&&this.notFoundPoint(l.newParent,e,n),l.findCount--}if(n=this.currentNode,n.end.equals1(e.end))return n;let a=n.end.distance2(e.end);n!=null&&!n.equals(t)&&a<=i&&(i=a,r=n);for(let l of s){let c=this.openSet.get(l);if(c!==null){if(l=c,l.direction!=l.newDirection){l.findCount++;continue}this.foundPoint(n,c,e)}else l=this.notFoundPoint(n,e,l)}}else return this.success=!1,r}}closeHas(t){return this.closeSet.contains(t)}addCloseSet(t){return this.currentNode=t,this.closeSet.add(t)}calcG(t,e){return t.source?t.G+e.P:t.G+t.cost+e.P}calcH(t,e){return e.source?0:Math.min(e.start.distance1(t.end),e.end.distance1(t.end))}findMinFNodeInOpneList(){for(;;){let t=this.queue.poll();if(t===null)return null;if(t.notChanged())return t.node}}notFoundPoint(t,e,r){return r.parent=t,r.direction=r.newDirection,r.G=this.calcG(t,r),r.H=this.calcH(e,r),r.P=0,r.calcF(),r.modCount++,this.openSet.put(r,r),this.queue.add(new _j(r)),r}foundPoint(t,e,r){let i=this.calcG(t,e);ne.less(i,e.G)&&(e.parent=t,e.direction=e.newDirection,e.G=i,e.P=0,e.calcF(),e.modCount++,this.queue.add(new _j(e)))}};var Zd=class o extends Mne{constructor(e,r){super();this.parent=null;this.node=null;this.source=!0;this.direction=0;this.newDirection=0;this.newParent=null;this.findCount=1;this.status=new N4;this.aroundType=0;this.startSource=null;this.startSourceNode=null;this.obstacle=null;this.obstacles=new Set;this.pushPath=new Set;this.pathError=!1;this.item=e,this.pt=r,this.cost=r.length()}get next(){var e,r;return(r=(e=this.node)==null?void 0:e.next)==null?void 0:r.item}get prev(){var e,r;return(r=(e=this.node)==null?void 0:e.prev)==null?void 0:r.item}replace(e){this.pt=e,this.cost=e.length()}getPathPrimitive(){return this.direction==0?this.pt:this.pt.reverse()}get start(){return this.getPathPrimitive().start()}get end(){return this.getPathPrimitive().end()}getNeihbor(){return this.direction==0?this.next:this.prev}hashCode(){return this.pt.hashCode()}sycnDirect(e){this.source=e.source,this.direction=e.direction,this.aroundType=e.aroundType,this.obstacle=e.obstacle,this.cloneStatus(e),this.weight=e.weight,this.source?(this.startSource=this.item,this.startSourceNode=this):(this.addAllObstacle(e.obstacles),xe.addAllSet(this.pushPath,e.pushPath),this.startSource=e.startSource,this.startSourceNode=e.startSourceNode)}checkSelfObstacle(){if(!this.source&&this.parent!=null){for(let e of this.parent.pushPath)this.obstacles.has(e)||this.pushPath.add(e);this.parent.source?(this.startSource=this.parent.item,this.startSourceNode=this.parent):(this.startSource=this.parent.startSource,this.startSourceNode=this.parent.startSourceNode),this.status.sycnPushDirect(this.parent.status),this.status.setPushDirect(this.parent.status.pushDirect,this.getChangeDirect())}this.source&&(this.startSource=this.item,this.startSourceNode=this)}getChangeDirect(){return this.direction}addPushPath(e){this.pushPath.add(e)}equals(e){if(e instanceof o){let r=e.pt;return e.aroundType==this.aroundType&&e.source==this.source&&r instanceof M&&this.pt instanceof M?this.pt.equals(r):e.aroundType==this.aroundType&&e.source==this.source&&r instanceof q&&this.pt instanceof q?this.pt.equals(r):!1}else return!1}addObstacles(e){this.obstacles.add(e)}addAllObstacle(e){for(let r of e)this.obstacles.add(r)}inPushPath(e){return this.pushPath.has(e)}cloneStatus(e){this.status=e.status.clone()}};var kne=class o extends dh{constructor(t){super(),this.line2=t}add(t){this.line2.push(t)}playResult(){var t,e;(t=this.line2[0])==null||t.display(),(e=this.line2[this.line2.length-1])==null||e.display(),he.publish("updateFrame","")}display(){for(let t of this.line2)t.display();he.publish("updateFrame","")}remove(){for(let t of this.line2)t.remove()}equals(t){if(t instanceof o){let e=t.line2.length;if(this.line2.length==e){for(let r=0;r<e;r++)if(!this.line2[r].equals(t.line2[r]))return!1;return!0}}return!1}};var NI=class{constructor(t){this.debug=null;this.kit=new Rc(.006);this.endtime=t}merge(t){if(t.length==0)return t;this.addDebug(t,ee.BLUE);let e=new Array,r=t[0].getPathPrimitive().start(),i=t[0].getPathPrimitive().end(),n=t[0],s=n.item,a=Et(n.getPathPrimitive()),l=1,c=new Array;for(let h=1;h<t.length;h++){let u=t[h];c.push(u),u.source?s=u.item:u.item=s;let d=u.getPathPrimitive();if(d.length()<1e-8)continue;if(a.dot(Et(d))>.99&&u.item.width==n.item.width&&d instanceof M&&n.pt instanceof M&&!u.item.locked&&!xs(u.item)&&u.item.getParent()==null)i=d.end(),l++;else{if(n.pt instanceof M&&(n.direction==0?n.pt=new M(r,i):n.pt=new M(i,r)),l==1)e.push(n);else{let m=new Zd(n.item,n.pt);m.direction=n.direction,m.newDirection=n.newDirection,m.cloneStatus(n),c.pop();for(let g of c)m.status.mergeStatus(g.status);e.push(m)}r=d.start(),i=d.end(),a=Et(d),n=u,l=1,c.length=0,c.push(n)}}if(n.pt instanceof M&&(n.direction==0?n.pt=new M(r,i):n.pt=new M(i,r)),l==1)e.push(n);else{let h=new Zd(n.item,n.pt);h.direction=n.direction,h.newDirection=n.newDirection,h.cloneStatus(n);for(let u of c)h.status.mergeStatus(u.status);e.push(h)}return this.addDebug(e,ee.GREEN),e}addDebug(t,e){if(Gr.debug){this.debug==null&&(this.debug=new kne([]),Gr.inputDebugGraphics(this.debug),Gr.inputClear());let r=[];for(let n of t){let s=n.getPathPrimitive(),a=new Gn(s,{color:e});r.push(a)}let i=new Cd(r);this.debug.add(i)}}};var Bne=class extends NI{constructor(e,r,i){super(e);this.tool=new Xn;this.change=!1;this.nodes=r,this.blockShape=i}optimize1(){if(this.nodes.length==0)return this.nodes;let e=this.nodes;for(;this.endtime>performance.now()&&(this.change=!1,e=this.optimizeShort(e),e=this.merge(e),!!this.change););return e}replaceNodes(e,r,i,n,s=!1){return(n.length()>1e-8||s)&&(i.direction==0?i.pt=new M(n.start(),n.end()):i.pt=new M(n.end(),n.start()),e.insertBefore(r,i)),i}cloneOrderNode(e){let r=new Zd(e.item,e.pt);return r.direction=e.direction,r.newDirection=e.newDirection,r.status=e.status.clone(),r}isCollide(e,r){if(r.length()<1e-8)return!1;let i=e instanceof Zd?e.item:e.item.item;return this.blockShape.checkDRC4Primitive(i,r)}optimizeShort(e){if(e.length==0)return e;this.addDebug(e,ee.BLUE);let r=new Tn;for(let a of e)r.add(a);let n=r.listIterator().next();e:for(;n!=null;){if(!this.notChange(n)){let a=n.item.getPathPrimitive(),l=Et(a),c=a.start(),h=a.end(),u=new Array,d=n.next,p=a.length();for(;d!=null&&!this.notChange(d);){let m=d.item.getPathPrimitive();h=m.end(),p+=m.length();let g=this.getDistance(c,h),y=this.tool.degree45(l,c,h),b=new M(y[0],y[1]),P=new M(y[1],y[2]);if(this.kit.less(g,p)&&!this.isCollide(n,b)&&!this.isCollide(d,P)){let T=n.item.status.isReversePush!=d.item.status.isReversePush;if(u.push(d),p=g,d=d.next,T)break}else break}if(u.length==1&&this.isLongVertical(n,u[0])){let m=u[u.length-1],g=m.item.getPathPrimitive();h=g.end();let y=Et(g),b=g.start().sub(l.mul((n.item.item.width+m.item.item.width)*2)),P=this.tool.degree45(l,b,h),T=new M(P[0],P[1]),I=new M(P[1],P[2]);m.item.status.isSource&&mg(T.direct,y,1e-4)&&(P=this.tool.degree45(I.direct,c,h),T=new M(P[0],P[1]),I=new M(P[1],P[2]));let C=null;n.item.status.isReversePush&&(C=n.item.status.pushDirect);for(let v of u)v.item.status.isReversePush&&(C=v.item.status.pushDirect);let E=this.cloneOrderNode(n.item);if(T.direct.dot(l)<.99){if(C!=null)E.status.setPushDirect(null,C);else if(E.status.isSource){let v=cj(l,T.direct);E.status.setPushDirect(null,v)}E.status.isSource=!1}let O=this.cloneOrderNode(m.item);if(I.direct.dot(y)<.99){if(C!=null)O.status.setPushDirect(null,C);else if(O.status.isSource){let v=cj(y,I.direct);O.status.setPushDirect(null,v)}O.status.isSource=!1}let _=this.cloneOrderNode(n.item),x=new M(c,b);this.replaceNodes(r,n,_,x,n.prev==null),this.replaceNodes(r,n,E,T),this.replaceNodes(r,n,O,I),this.change=!0,r.remove(n);for(let v of u)r.remove(v);n=d==null?void 0:d.prev;continue e}else if(u.length>0){let m=u[u.length-1],g=m.item.getPathPrimitive();h=g.end();let y=Et(g),b=this.tool.degree45(l,c,h),P=new M(b[0],b[1]),T=new M(b[1],b[2]);m.item.status.isSource&&mg(P.direct,y,1e-4)&&(b=this.tool.degree45(T.direct,c,h),P=new M(b[0],b[1]),T=new M(b[1],b[2]));let I=null;n.item.status.isReversePush&&(I=n.item.status.pushDirect);for(let O of u)O.item.status.isReversePush&&(I=O.item.status.pushDirect);let C=this.cloneOrderNode(n.item);if(P.direct.dot(l)<.99){if(I!=null)C.status.setPushDirect(null,I);else if(C.status.isSource){let O=cj(l,P.direct);C.status.setPushDirect(null,O)}C.status.isSource=!1}let E=this.cloneOrderNode(m.item);if(T.direct.dot(y)<.99){if(I!=null)E.status.setPushDirect(null,I);else if(E.status.isSource){let O=cj(y,T.direct);E.status.setPushDirect(null,O)}E.status.isSource=!1}this.replaceNodes(r,n,C,P,n.prev==null),this.replaceNodes(r,n,E,T),this.change=!0,r.remove(n);for(let O of u)r.remove(O);n=d==null?void 0:d.prev;continue e}}n=n.next}let s=r.toArray();return this.addDebug(s,ee.GREEN),s}isLongVertical(e,r){let i=e.item.getPathPrimitive(),n=r.item.getPathPrimitive();if(ud(i)>5*e.item.item.width&&ud(n)>5*e.item.item.width){let s=Et(i),a=Et(n);return A3(s,a)}return!1}getDistance(e,r){let i=r.sub(e),n=Math.abs(i.x),s=Math.abs(i.y);return n<s?n*Math.sqrt(2)+s-n:s*Math.sqrt(2)+n-s}notChange(e){return e.item.status.notChange}};var Fne=class extends NI{constructor(e,r,i){super(e);this.tool=new Xn;this.change=!1;this.direct=new S(1,0);this.nodes=r,this.blockShape=i}optimize1(){if(this.nodes.length==0)return this.nodes;let e=this.nodes;for(;this.endtime>performance.now()&&(this.change=!1,e=this.merge(e),e=this.optimizeCorner(e),!!this.change););return e}replaceNodes(e,r,i,n){return n.length()>1e-8&&(i.direction==0?i.pt=new M(n.start(),n.end()):i.pt=new M(n.end(),n.start()),e.insertBefore(r,i)),i}cloneOrderNode(e){let r=new Zd(e.item,e.pt);return r.direction=e.direction,r.newDirection=e.newDirection,r.status=e.status.clone(),r}isCollide(e,r){if(r.length()<1e-8)return!1;let i=e instanceof Zd?e.item:e.item.item;return this.blockShape.checkDRC4Primitive(i,r)}optimizeShort(e){this.addDebug(e,ee.BLUE);let r=new Tn;for(let a of e)r.add(a);let n=r.listIterator().next();e:for(;n!=null;){if(!this.notChange(n)){let a=n.item.getPathPrimitive(),l=Et(a),c=a.start(),h=a.end(),u=new Array,d=n.next,p=a.length();for(;d!=null&&!this.notChange(d);){let m=d.item.getPathPrimitive();h=m.end(),p+=m.length();let g=this.getDistance(c,h),y=this.tool.degree45(l,c,h),b=new M(y[0],y[1]),P=new M(y[1],y[2]);if(this.kit.less(g,p)&&!this.isCollide(n,b)&&!this.isCollide(d,P))u.push(d),p=g,d=d.next;else break}if(u.length>0){let m=u[u.length-1],g=m.item.getPathPrimitive();h=g.end();let y=Et(g),b=this.tool.degree45(l,c,h),P=new M(b[0],b[1]),T=new M(b[1],b[2]),I=this.cloneOrderNode(n.item);P.direct.dot(l)<.99&&(I.status.isSource=!1);let C=this.cloneOrderNode(m.item);T.direct.dot(y)<.99&&(C.status.isSource=!1),this.replaceNodes(r,n,I,P),this.replaceNodes(r,n,C,T),this.change=!0,r.remove(n);for(let E of u)r.remove(E);n=d==null?void 0:d.prev;continue e}}n=n.next}let s=r.toArray();return this.addDebug(s,ee.GREEN),s}optimizeCorner(e){if(e.length==0)return e;this.addDebug(e,ee.BLUE);let r=new Tn;for(let a of e)r.add(a);let n=r.listIterator().next();e:for(;n!=null;){if(!this.notChange(n)||!this.isAcuteAngle(n,n.next)){let a=this.isCorner(n);if(a>0){let l=n.prev.item.getPathPrimitive(),c=n.next.item.getPathPrimitive(),h=Et(l),u=l.start(),d=c.end(),p=this.tool.degree45(h,u,d),m=new M(p[0],p[1]),g=new M(p[1],p[2]);if(a==1&&(p=this.tool.degree45(g.direct,u,d),m=new M(p[0],p[1]),g=new M(p[1],p[2])),!this.isCollide(n.prev,m)&&!this.isCollide(n.next,g)){let y=Et(l),b=Et(c),P=this.cloneOrderNode(n.prev.item),T=this.cloneOrderNode(n.next.item);P.status.change(),T.status.change(),(this.isSource(n.prev)&&m.direct.dot(y)>.99||g.length()<1e-9&&this.isSource(n.next)&&m.direct.dot(b)>.99)&&(P.status.isSource=!0),this.isSource(n.next)&&g.direct.dot(b)>.99&&(T.status.isSource=!0),this.addDebug([n.prev.item,n.item,n.next.item],ee.BLUE),this.replaceNodes(r,n.prev,P,m),this.replaceNodes(r,n.prev,T,g),this.addDebug([P,T],ee.GREEN),this.change=!0;let I=n.next.next;r.remove(n.prev),r.remove(n),r.remove(n.next),n=I==null?void 0:I.prev;continue e}else a=0}if(a==0){let l=n.item.getPathPrimitive(),c=Et(l),h=l.start(),u=l.end(),d=new Array,p=n.next,m=l.length();for(;p!=null&&(!this.notChange(p)||!this.isSource(n)&&!this.isAcuteAngle(n,p));){let g=p.item.getPathPrimitive();u=g.end(),m+=g.length();let y=this.getDistance(h,u),b=this.tool.degree45(c,h,u),P=new M(b[0],b[1]),T=new M(b[1],b[2]);if(this.kit.less(y,m)&&!this.isCollide(n,P)&&!this.isCollide(p,T)){let I=n.item.status.isReversePush!=p.item.status.isReversePush||p.item.status.isSource;if(d.push(p),m=y,p=p.next,I)break}else break}if(d.length==0&&p!=null&&p.item.getPathPrimitive().length()<p.item.item.width)for(p=p.next;p!=null&&(!this.notChange(p)||!this.isSource(n)&&!this.isAcuteAngle(n,p));){let g=p.item.getPathPrimitive();u=g.end(),m+=g.length();let y=this.getDistance(h,u),b=this.tool.degree45(c,h,u),P=new M(b[0],b[1]),T=new M(b[1],b[2]);if(this.kit.less(y,m)&&!this.isCollide(n,P)&&!this.isCollide(p,T)){let I=n.item.status.isReversePush!=p.item.status.isReversePush||p.item.status.isSource;if(d.length==0&&d.push(n.next),d.push(p),m=y,p=p.next,I)break}else break}if(d.length>0){let g=d[d.length-1],y=g.item.getPathPrimitive();u=y.end();let b=Et(y),P=c.cross(b);if(ne.eq(P,0)&&mg(u.sub(h.normalize()),b)){let T=new M(h,u),I;T.direct.dot(b)>.99?I=this.cloneOrderNode(g.item):I=this.cloneOrderNode(n.item),this.replaceNodes(r,n,I,T)}else{let T=this.tool.degree45(c,h,u),I=new M(T[0],T[1]),C=new M(T[1],T[2]),E=C.length()<1e-9&&I.direct.dot(b)>.99,O=E?this.cloneOrderNode(g.item):this.cloneOrderNode(n.item);I.direct.dot(c)<.99&&!E&&(O.status.isSource=!1);let _=this.cloneOrderNode(g.item);C.direct.dot(b)<.99&&(_.status.isSource=!1),this.addDebug([n.item,...d.map(x=>x.item)],ee.BLUE),this.replaceNodes(r,n,O,I),this.replaceNodes(r,n,_,C),this.addDebug([O,_],ee.GREEN)}this.change=!0,r.remove(n);for(let T of d)r.remove(T);n=p==null?void 0:p.prev;continue e}else if(n.next!=null&&n.next.next==null&&!this.isAcuteAngle(n,p)&&(!this.isInputNotChange(n)||!this.isInputNotChange(p))){let g=this.getLines(n,n.next);if(g!=null){let y=g[0],b=g[1],P=g[2],T=n.next.item.getPathPrimitive(),I=Et(T),C=this.cloneOrderNode(n.item);y.direct.dot(c)<.99&&(C.status.isSource=!1);let E=this.cloneOrderNode(n.next.item);b.direct.dot(I)<.99&&(E.status.isSource=!1);let O=this.cloneOrderNode(n.next.item);P.direct.dot(I)<.99&&(O.status.isSource=!1),this.addDebug([n.item,...d.map(_=>_.item)],ee.BLUE),this.replaceNodes(r,n,C,y),this.replaceNodes(r,n,E,b),this.replaceNodes(r,n,O,P),this.addDebug([C,E,O],ee.GREEN),d.push(n,n.next),this.change=!0;for(let _ of d)r.remove(_);n=p==null?void 0:p.prev;continue e}}}}else if(this.isShort(n.next)&&n.next.next!=null&&(!this.isInputNotChange(n.next)||!this.isInputNotChange(n.next.next))){let a=n.item.getPathPrimitive(),l=Et(a),c=new Array,h=n.next.next,u=this.getLines(n,h);if(u!=null){let d=u[0],p=u[1],m=u[2],g=n.next.item.getPathPrimitive(),y=Et(g),b=this.cloneOrderNode(n.item);d.direct.dot(l)<.99&&(b.status.isSource=!1);let P=this.cloneOrderNode(n.next.item);p.direct.dot(y)<.99&&(P.status.isSource=!1);let T=this.cloneOrderNode(n.next.item);m.direct.dot(y)<.99&&(T.status.isSource=!1),this.addDebug([n.item,...c.map(I=>I.item)],ee.BLUE),this.replaceNodes(r,n,b,d),this.replaceNodes(r,n,P,p),this.replaceNodes(r,n,T,m),this.addDebug([b,P,T],ee.GREEN),c.push(n,n.next,h),this.change=!0;for(let I of c)r.remove(I);n=h==null?void 0:h.prev;continue e}}n=n.next}let s=r.toArray();return this.addDebug(s,ee.GREEN),s}isInputNotChange(e){return e.item.status.isInput&&e.item.status.notChange}getLines(e,r){let i=e.item.getPathPrimitive(),n=r.item.getPathPrimitive(),s=i.length(),a=n.length(),l=s+a,c=Et(i),h=s>a,u=h?i.midPoint:i.start(),d=h?n.end():n.midPoint,p=h?this.getDistance(u,d)+s/2:this.getDistance(u,d)+a/2,m=this.tool.degree45(c,u,d);h?m.unshift(i.start()):m.push(n.end());let g=new M(m[0],m[1]),y=new M(m[1],m[2]),b=new M(m[2],m[3]);if(this.kit.less(p,l)&&!this.isCollide(e,g)&&!this.isCollide(r,y)&&!this.isCollide(r,b))return[g,y,b];{let P=h?i.start():i.midPoint,T=h?n.midPoint:n.end(),I=h?this.getDistance(P,T)+a/2:this.getDistance(P,T)+s/2,C=this.tool.degree45(c,P,T);h?C.push(n.end()):C.unshift(i.start());let E=new M(C[0],C[1]),O=new M(C[1],C[2]),_=new M(C[2],C[3]);if(this.kit.less(I,l)&&!this.isCollide(e,E)&&!this.isCollide(r,O)&&!this.isCollide(r,_))return[E,O,_]}return null}isCorner(e){let r=e.item.getPathPrimitive(),i=Et(r),n=e.prev!=null&&e.next!=null;if(this.isInput(e.item,i)&&n&&this.isAcuteAngle(e.prev,e.next))return 0;if(n&&(!this.notChange(e.prev)||this.needOptimize(e.prev,e))&&(!this.notChange(e.next)||this.needOptimize(e.next,e))){if(this.isSource(e.prev)&&!this.isSource(e.next)){let s=e.next.next;if(this.isParallel(e.next,s)&&this.isSource(s))return 0;let a=e.prev,l=a.item.getPathPrimitive(),c=Et(l);if(this.isInput(a.item,c))return 0;let h=c.cross(this.direct);if(Math.abs(h)<.1){let d=e.next.item.getPathPrimitive(),p=Et(d);return A3(c,p,.01)?2:0}else{let u=h>0?ae.CCW:ae.CW;if(e.next.item.status.pushDirect!=null&&e.next.item.status.pushDirect!=u)return 0;{let d=Et(e.item.getPathPrimitive()),m=e.next.item.getPathPrimitive(),g=Et(m),y=A3(d,this.direct),b=A3(g,this.direct);if(y&&!b)return 0;if(!y&&b)return 1}}return 1}else if(!this.isSource(e.prev)&&this.isSource(e.next)){let s=e.prev.prev;if(this.isParallel(s,e.prev)&&this.isSource(s))return 0;let a=e.next,l=a.item.getPathPrimitive(),c=Et(l);if(this.isInputEnd(e.next)){let d=e.prev.item.getPathPrimitive(),p=d.start(),m=Et(d),g=this.tool.degree45(m,p,l.end()),y=g[2].sub(g[1]);if(!mg(y,c))return 0}if(this.isInput(a.item,c))return 0;let h=c.cross(this.direct);if(Math.abs(h)<.1){let d=e.prev.item.getPathPrimitive(),p=Et(d);return A3(p,c,.01)?2:0}else{let u=h>0?ae.CCW:ae.CW;if(e.prev.item.status.pushDirect!=null&&e.prev.item.status.pushDirect!=u)return 0;{let p=e.prev.item.getPathPrimitive(),m=Et(p),g=A3(c,this.direct),y=A3(m,this.direct);if(g&&!y)return 0;if(!g&&y)return 2}}return 2}else if(!this.isSource(e.prev)&&!this.isSource(e.next)){let s=e.prev,a=s.item.getPathPrimitive(),l=e.next.item.getPathPrimitive(),c=Et(a);if(this.isInput(s.item,c))return 0;let h=s.item.status.pushDirect;if(h!=null){let u=h==ae.CCW?new S(-c.y,c.x):new S(c.y,-c.x),d=l.end().sub(a.start());return u.dot(d)>0?1:2}else if(e.next.item.status.pushDirect!=null){let u=Et(l);if(this.isInput(e.next.item,u))return 0;let p=e.next.item.status.pushDirect==ae.CCW?new S(-u.y,u.x):new S(u.y,-u.x),m=l.end().sub(a.start());return p.dot(m)>0?1:2}}}return 0}isParallel(e,r){if(e==null||r==null)return!1;let i=Et(e.item.getPathPrimitive()),n=r.item.getPathPrimitive(),s=Et(n,n.start());return mg(i,s)}isInput(e,r){return!!(e.status.isInput&&A3(r,this.direct))}isInputEnd(e){return e.item.status.isInput&&e.next==null}getDistance(e,r){let i=r.sub(e),n=Math.abs(i.x),s=Math.abs(i.y);return n<s?n*Math.sqrt(2)+s-n:s*Math.sqrt(2)+n-s}needOptimize(e,r){if(e!=null&&this.notChange(e)&&!e.item.item.locked&&!xs(e.item.item)&&e.item.item.getParent()==null&&!this.notChange(r)){let i=e.item.getPathPrimitive(),n=Et(i),s=Et(r.item.getPathPrimitive());return n.dot(s)<.01}return!1}isAcuteAngle(e,r){if(e==null||r==null)return!0;let i=e.item.getPathPrimitive(),n=Et(i),s=Et(r.item.getPathPrimitive());return n.dot(s)>.01}isShort(e){return e==null?!1:e.item.getPathPrimitive().length()<e.item.item.width}notChange(e){return e.item.status.notChange}isSource(e){return e.item.status.isSource}};var Vne=class extends NI{constructor(e,r,i,n){super(e);this.tool=new Xn;this.change=!1;this.nodes=r,this.blockShape=i,this.isWire=n}optimize1(){if(this.nodes.length==0)return this.nodes;let e=this.nodes;for(;this.endtime>performance.now()&&(this.change=!1,e=this.optimizeShort(e),e=this.merge(e),!!this.change););return e}replaceNodes(e,r,i,n){return n.length()>1e-8&&(i.direction==0?i.pt=new M(n.start(),n.end()):i.pt=new M(n.end(),n.start()),e.insertBefore(r,i)),i}cloneOrderNode(e){let r=new Zd(e.item,e.pt);return r.direction=e.direction,r.newDirection=e.newDirection,r.status=e.status.clone(),r}isCollide(e,r){if(r.length()<1e-8)return!1;let i=e instanceof Zd?e.item:e.item.item;return this.blockShape.checkDRC4Primitive(i,r)}optimizeShort(e){if(e.length==0)return e;if(!this.isWire&&e[0].status.isInput)return this.optimizeInputShort(e);this.addDebug(e,ee.BLUE);let r=new Tn;for(let a of e)r.add(a);let n=r.listIterator().next();e:for(;n!=null;){let a=n.item.getPathPrimitive(),l=Et(a),c=a.start(),h=a.end(),u=new Array,d=r.getLastNode(),p=a.length();for(;d!=null&&d!=n&&d.item.item.width==n.item.item.width;){let m=d.item.getPathPrimitive();h=m.end();let g=this.getDistance(c,h),y=this.tool.degree45(l,c,h),b=new M(y[0],y[1]),P=new M(y[1],y[2]);if(this.notChange(d)&&!d.item.item.locked&&!xs(d.item.item)&&d.item.item.getParent()==null){let T=Et(m);y=this.tool.degree45(T.mul(-1),h,c),b=new M(y[2],y[1]),P=new M(y[1],y[0])}if((n.next!=d||this.kit.less(g,p+m.length()))&&!this.isCollide(n,b)&&!this.isCollide(d,P)){let T=n,I=new Array;for(;T!=d;){if(T.item.item.locked||xs(T.item.item)||T.item.item.getParent()!=null){I.length=0;break}I.push(T),T=T.next}for(let C of I)u.push(C);u.push(d);break}else d=d.prev}if(u.length>0){let m=u[u.length-1],g=m.item.getPathPrimitive();h=g.end();let y=Et(g),b=this.tool.degree45(l,c,h),P=new M(b[0],b[1]),T=new M(b[1],b[2]);if(this.notChange(m)){let O=Et(g);b=this.tool.degree45(O.mul(-1),h,c),P=new M(b[2],b[1]),T=new M(b[1],b[0])}let I=this.cloneOrderNode(n.item);I.status.notChange=!1,P.direct.dot(l)<.99&&(I.status.isSource=!1);let C=this.cloneOrderNode(m.item);C.status.notChange=!1,T.direct.dot(y)<.99&&(C.status.isSource=!1);let E=n==null?void 0:n.prev;this.replaceNodes(r,n,I,P),this.replaceNodes(r,n,C,T),this.change=!0;for(let O of u)r.remove(O);n=E;continue e}else{if(n.next!=null&&n.next.next==null&&!this.isAcuteAngle(n,n.next)){let m=n.next,g=n.next.item.getPathPrimitive(),y=g.midPoint;p+=g.length()/2;let b=Et(g),P=this.getDistance(c,y),T=this.tool.degree45(l,c,y),I=new M(T[0],T[1]),C=new M(T[1],T[2]),E=new M(T[2],g.end());if(this.kit.less(P,p)&&!this.isCollide(n,I)&&!this.isCollide(m,C)&&!this.isCollide(m,E)){let O=this.cloneOrderNode(n.item);I.direct.dot(l)<.99&&(O.status.isSource=!1);let _=this.cloneOrderNode(n.next.item);C.direct.dot(b)<.99&&(_.status.isSource=!1);let x=this.cloneOrderNode(n.next.item);E.direct.dot(b)<.99&&(x.status.isSource=!1),this.addDebug([n.item,...u.map(v=>v.item)],ee.BLUE),this.replaceNodes(r,n,O,I),this.replaceNodes(r,n,_,C),this.replaceNodes(r,n,x,E),this.addDebug([O,_,x],ee.GREEN),u.push(n,n.next),this.change=!0;for(let v of u)r.remove(v);n=m==null?void 0:m.prev;continue e}}if(n.next!=null&&this.isShort(n.next)&&n.next.next!=null&&(!this.isInputNotChange(n.next)||!this.isInputNotChange(n.next.next))){let m=n.next.next,g=m.item.getPathPrimitive(),y=g.midPoint;p+=g.length()/2;let b=Et(g),P=this.getDistance(c,y),T=this.tool.degree45(l,c,y),I=new M(T[0],T[1]),C=new M(T[1],T[2]),E=new M(T[2],g.end());if(this.kit.less(P,p)&&!this.isCollide(n,I)&&!this.isCollide(m,C)&&!this.isCollide(m,E)){let O=this.cloneOrderNode(n.item);I.direct.dot(l)<.99&&(O.status.isSource=!1);let _=this.cloneOrderNode(m.item);C.direct.dot(b)<.99&&(_.status.isSource=!1);let x=this.cloneOrderNode(m.item);E.direct.dot(b)<.99&&(x.status.isSource=!1),this.addDebug([n.item,...u.map(v=>v.item)],ee.BLUE),this.replaceNodes(r,n,O,I),this.replaceNodes(r,n,_,C),this.replaceNodes(r,n,x,E),this.addDebug([O,_,x],ee.GREEN),u.push(n,n.next,m),this.change=!0;for(let v of u)r.remove(v);n=m==null?void 0:m.prev;continue e}}}n=n==null?void 0:n.next}let s=r.toArray();return this.addDebug(s,ee.GREEN),s}isShort(e){return e==null?!1:e.item.getPathPrimitive().length()<e.item.item.width}isAcuteAngle(e,r){if(e==null||r==null)return!0;let i=e.item.getPathPrimitive(),n=Et(i),s=Et(r.item.getPathPrimitive());return n.dot(s)>.01}optimizeInputShort(e){if(e.length==0)return e;this.addDebug(e,ee.BLUE);let r=new Tn;for(let a of e)r.add(a);let n=r.listIterator().next();e:for(;n!=null;){let a=n.item.getPathPrimitive(),l=Et(a),c=a.start(),h=a.end(),u=new Array,d=r.getLastNode(),p=a.length();for(;!this.notChange(n)&&d!=null&&d!=n&&d.item.item.width==n.item.item.width;){let m=d.item.getPathPrimitive();h=m.end();let g=this.getDistance(c,h),y=this.tool.degree45(l,c,h),b=new M(y[0],y[1]),P=new M(y[1],y[2]);if(!this.isSource(n)&&this.notChange(d)&&!d.item.item.locked&&!xs(d.item.item)&&d.item.item.getParent()==null){let T=Et(m);y=this.tool.degree45(T.mul(-1),h,c),b=new M(y[2],y[1]),P=new M(y[1],y[0])}if((n.next!=d||this.kit.less(g,p+m.length()))&&!this.isCollide(n,b)&&!this.isCollide(d,P)){let T=n,I=new Array;for(;T!=d;){if(T.item.item.locked||xs(T.item.item)||T.item.item.getParent()!=null){I.length=0;break}I.push(T),T=T.next}for(let C of I)u.push(C);u.push(d);break}else d=d.prev}if(u.length>0){let m=u[u.length-1],g=m.item.getPathPrimitive();h=g.end();let y=Et(g),b=this.tool.degree45(l,c,h),P=new M(b[0],b[1]),T=new M(b[1],b[2]);if(this.notChange(m)){let O=Et(g);b=this.tool.degree45(O.mul(-1),h,c),P=new M(b[2],b[1]),T=new M(b[1],b[0])}let I=this.cloneOrderNode(n.item);I.status.notChange=!1,P.direct.dot(l)<.99&&(I.status.isSource=!1);let C=this.cloneOrderNode(m.item);C.status.notChange=!1,T.direct.dot(y)<.99&&(C.status.isSource=!1);let E=n==null?void 0:n.prev;this.replaceNodes(r,n,I,P),this.replaceNodes(r,n,C,T),this.change=!0;for(let O of u)r.remove(O);n=E;continue e}else{if(n.next!=null&&n.next.next==null&&!this.isAcuteAngle(n,n.next)&&(!this.isInputNotChange(n)||!this.isInputNotChange(d))){let m=n.next,g=n.next.item.getPathPrimitive(),y=g.midPoint;p+=g.length()/2;let b=Et(g),P=this.getDistance(c,y),T=this.tool.degree45(l,c,y),I=new M(T[0],T[1]),C=new M(T[1],T[2]),E=new M(T[2],g.end());if(this.kit.less(P,p)&&!this.isCollide(n,I)&&!this.isCollide(m,C)&&!this.isCollide(m,E)){let O=this.cloneOrderNode(n.item);I.direct.dot(l)<.99&&(O.status.isSource=!1);let _=this.cloneOrderNode(n.next.item);C.direct.dot(b)<.99&&(_.status.isSource=!1);let x=this.cloneOrderNode(n.next.item);E.direct.dot(b)<.99&&(x.status.isSource=!1),this.addDebug([n.item,...u.map(v=>v.item)],ee.BLUE),this.replaceNodes(r,n,O,I),this.replaceNodes(r,n,_,C),this.replaceNodes(r,n,x,E),this.addDebug([O,_,x],ee.GREEN),u.push(n,n.next),this.change=!0;for(let v of u)r.remove(v);n=m==null?void 0:m.prev;continue e}}if(n.next!=null&&this.isShort(n.next)&&n.next.next!=null&&(!this.isInputNotChange(n.next)||!this.isInputNotChange(n.next.next))){let m=n.next.next,g=m.item.getPathPrimitive(),y=g.midPoint;p+=g.length()/2;let b=Et(g),P=this.getDistance(c,y),T=this.tool.degree45(l,c,y),I=new M(T[0],T[1]),C=new M(T[1],T[2]),E=new M(T[2],g.end());if(this.kit.less(P,p)&&!this.isCollide(n,I)&&!this.isCollide(m,C)&&!this.isCollide(m,E)){let O=this.cloneOrderNode(n.item);I.direct.dot(l)<.99&&(O.status.isSource=!1);let _=this.cloneOrderNode(m.item);C.direct.dot(b)<.99&&(_.status.isSource=!1);let x=this.cloneOrderNode(m.item);E.direct.dot(b)<.99&&(x.status.isSource=!1),this.addDebug([n.item,...u.map(v=>v.item)],ee.BLUE),this.replaceNodes(r,n,O,I),this.replaceNodes(r,n,_,C),this.replaceNodes(r,n,x,E),this.addDebug([O,_,x],ee.GREEN),u.push(n,n.next,m),this.change=!0;for(let v of u)r.remove(v);n=m==null?void 0:m.prev;continue e}}}n=n==null?void 0:n.next}let s=r.toArray();return this.addDebug(s,ee.GREEN),s}isInputNotChange(e){return e.item.status.isInput&&e.item.status.notChange}getDistance(e,r){let i=r.sub(e),n=Math.abs(i.x),s=Math.abs(i.y);return n<s?n*Math.sqrt(2)+s-n:s*Math.sqrt(2)+n-s}notChange(e){return e.item.status.notChange}isSource(e){return e.item.status.isSource}};var v3t=Math.sqrt(2)-1,vj=class{constructor(t,e,r,i,n,s){this.tool=new Xn;this.change=!1;this.nodes=e,this.blockShape=r,this.direct=n,this.mergeOptimiza=new NI(t),this.onlyChange=new Bne(t,e,r),this.fullChange=new Fne(t,e,r),this.fullChange.direct=this.direct,this.allChange=new Vne(t,e,r,s),this.level=i,ls!="45"&&(this.level="NONE")}optimization(){switch(this.level){case"NONE":return this.mergeOptimiza.merge(this.nodes);case"WEAK":return this.onlyChange.optimize1();case"STRONG":return this.fullChange.optimize1();default:{let t=wt.filter;wt.setPushFilter(),wt.pushFilter.setAroundMode();let e=this.allChange.optimize1();return wt.filter=t,e}}}optimize2(){if(this.nodes.length==0)return this.nodes;let t=this.nodes;for(;this.change=!1,t=this.optimizaAngle(t),t=this.merge(t),!!this.change;);return t}optimize3(){if(this.nodes.length==0)return this.nodes;let t=this.nodes;for(;this.change=!1,t=this.source2Source2(t),t=this.source2Source3(t),t=this.source2None1(t),t=this.none2Source1(t),t=this.source2Source1(t),t=this.none2None1(t),t=this.merge(t),!!this.change;);return t}optimize1(){if(this.nodes.length==0)return this.nodes;let t=this.nodes;for(;this.change=!1,t=this.source2None1(t),t=this.none2Source1(t),t=this.source2Source1(t),t=this.none2None1(t),t=this.merge(t),!!this.change;);return t}addDebug(t,e){if(Gr.debug){let r=[];for(let n of t){let s=n.getPathPrimitive(),a=new Gn(s,{color:e});r.push(a)}let i=new Cd(r);Gr.inputDebugGraphics(i),Gr.inputClear()}}optimizaAngle(t){this.addDebug(t,ee.BLUE);let e=new Tn;for(let s of t)e.add(s);let i=e.listIterator().next(),n=new Array;for(;i!=null;){let s=this.findNextNode(i),a=s[s.length-1];if(s.length==0?a=i.next:a.next!=null&&(a=a.next,s.push(a)),s.length==0)n.push(i.item),i=a;else{let l=this.getLines(n,i,s);l==null?(n.push(i.item),i=i.next):i=l.next}}return this.addDebug(n,ee.GREEN),n}optimizaAngle1(t){this.addDebug(t,ee.BLUE);let e=new Tn;for(let l of t)e.add(l);let i=e.listIterator().next(),n=new Array,s=i.item.getPathPrimitive(),a=Et(s);for(;i!=null;){let l=i.next;if(l==null){n.push(i.item);break}let c=l.item.getPathPrimitive(),h=Et(c);if(a.dot(h)>.01||i.item.status.notChange)n.push(i.item),i=l;else{let d=s.start(),p=c.end(),m=this.tool.degree45(a,d,p),g=new M(m[0],m[1]),y=new M(m[1],m[2]),b=!1;l.next==null&&zs(a,m)[1].dot(h)<.99&&(b=!0),!b&&!this.isCollide(i,g)&&!this.isCollide(i,y)?(this.modifyNode(n,this.cloneOrderNode(i.item),g),this.modifyNode(n,this.cloneOrderNode(l.item),y),this.change=!0,i=l.next):(n.push(i.item),i=l)}i!=null&&(s=i.item.getPathPrimitive(),a=Et(s))}return this.addDebug(n,ee.GREEN),n}getLines(t,e,r){let i=e.item.getPathPrimitive(),n=i.start(),s=Et(i);r.reverse();for(let a of r){let l=a.item.getPathPrimitive(),c=l.end(),h=this.tool.degree45(s,n,c),u=new M(h[0],h[1]),d=new M(h[1],h[2]),p=!1;if(a.next==null&&zs(s,h)[1].dot(Et(l))<.99&&(p=!0),!p&&!this.isCollide(e,u)&&!this.isCollide(e,d))return this.modifyNode(t,this.cloneOrderNode(e.item),u),this.modifyNode(t,this.cloneOrderNode(a.item),d),this.change=!0,a}return null}getLines1(t,e,r){let i=e.item.getPathPrimitive(),n=i.start(),s=Et(i);r.reverse();for(let a of r){let l=a[0];if(a[1]){let h=l.item.getPathPrimitive(),u=h.end(),d=this.tool.degree45(s,n,u),p=new M(d[0],d[1]),m=new M(d[1],d[2]),g=!1;if(l.next==null&&zs(s,d)[1].dot(Et(h))<.99&&(g=!0),!g&&!this.isCollide(e,p)&&!this.isCollide(e,m))return this.modifyNode(t,this.cloneOrderNode(e.item),p),this.modifyNode(t,this.cloneOrderNode(l.item),m),this.change=!0,l.next}}return t.push(e.item),e.next}getLines2(t,e,r){let i=e.item.getPathPrimitive(),n=i.start(),s=Et(i);r.reverse();for(let a of r){let l=a.item.getPathPrimitive(),c=l.end(),h=this.tool.degree45(s,n,c),u=new M(h[0],h[1]),d=new M(h[1],h[2]),p=!1;if(a.next==null&&zs(s,h)[1].dot(Et(l))<.99&&(p=!0),!p&&!this.isCollide(e,u)&&!this.isCollide(e,d))return this.modifyNode(t,this.cloneOrderNode(e.item),u),this.modifyNode(t,this.cloneOrderNode(a.item),d),this.change=!0,a}return null}merge(t){this.addDebug(t,ee.BLUE);let e=new Tn;for(let d of t)e.add(d);let i=e.listIterator().next(),n=i.item.getPathPrimitive(),s=n.start(),a=n.end(),l=Et(n),c=i.item.item,h=new Array,u=i;for(;u!=null&&u.next!=null;){u=u.next;let d=u.item;d.source?c=d.item:d.item=c;let p=d.getPathPrimitive();if(p.length()<1e-8){this.change=!0;continue}let m=l.dot(Et(p)),g=i.item;m>.99&&d.item.width==g.item.width?a=p.end():(i.next==u?h.push(i.item):(this.change=!0,this.modifyNode(h,this.cloneOrderNode(i.item),new M(s,a))),s=p.start(),a=p.end(),l=Et(p),i=u)}return i.next==null?h.push(u.item):(this.change=!0,this.modifyNode(h,this.cloneOrderNode(u.item),new M(s,a))),this.addDebug(h,ee.GREEN),h}removeAcute(t){this.addDebug(t,ee.BLUE);let e=new Tn;for(let s of t)e.add(s);let i=e.listIterator().next(),n=new Array;for(;i!=null;){let s=i.next;if(s==null){n.push(i.item);break}let a=i.item.getPathPrimitive(),l=s.item.getPathPrimitive(),c=Et(a),h=Et(l);if(c.dot(h)<-.01){if(this.change=!0,a.length()>l.length()){let u=Math.abs(c.dot(l.end().sub(l.start()))),d=a.end().sub(c.mul(u));this.modifyNode(n,this.cloneOrderNode(i.item),new M(a.start(),d)),this.modifyNode(n,this.cloneOrderNode(s.item),new M(d,l.end()))}else{let u=Math.abs(h.dot(a.end().sub(a.start()))),d=l.start().add(h.mul(u));this.modifyNode(n,this.cloneOrderNode(i.item),new M(a.start(),d)),this.modifyNode(n,this.cloneOrderNode(s.item),new M(d,l.end()))}i=s.next}else n.push(i.item),i=s}return this.addDebug(n,ee.GREEN),n}modifyNode(t,e,r){return r.length()>.1&&(e.direction==0?e.pt=new M(r.start(),r.end()):e.pt=new M(r.end(),r.start()),t.push(e)),e}replaceNodes(t,e,r,i){return i.length()>1e-8&&(r.direction==0?r.pt=new M(i.start(),i.end()):r.pt=new M(i.end(),i.start()),t.insertBefore(e,r)),r}removeMid(t){this.addDebug(t,ee.BLUE);let e=t.length,r=new Array;for(let i=0;i<e;i++){let n=t[i],s=n.getPathPrimitive(),a=s.start(),l=Et(s);if(i+2<e){let c=t[i+2],h=c.getPathPrimitive(),u=t[i+1].pt.length();if(u<s.length()&&u<h.length()){let d=h.end(),p=this.tool.degree45(l,a,d),m=new M(p[0],p[1]),g=new M(p[1],p[2]);if(!this.isCollide(n,m)&&!this.isCollide(n,g)){this.modifyNode(r,this.cloneOrderNode(n),m),this.modifyNode(r,this.cloneOrderNode(c),g),this.change=!0,i=i+2;continue}}}r.push(n)}return this.addDebug(r,ee.GREEN),r}removeShort(t){this.addDebug(t,ee.BLUE);let e=new Tn;for(let s of t)e.add(s);let i=e.listIterator().next(),n=new Array;for(;i!=null;){let s=this.findNextNode2(i),a=s[s.length-1];if(s.length==0?a=i.next:a.next!=null&&(a=a.next,s.push(a)),s.shift(),s.length==0)n.push(i.item),i=a;else{let l=this.getLines(n,i,s);l==null?(n.push(i.item),i=i.next):i=l.next}}return this.addDebug(n,ee.GREEN),n}mergeSameDirect(t){this.addDebug(t,ee.BLUE);let e=t.length,r=new Array;for(let i=0;i<e;i++){let n=t[i],s=n.getPathPrimitive(),a=s.start(),l=Et(s),c=n.item.width*3;if(i+2<e){let h=t[i+2],u=h.getPathPrimitive(),d=t[i+1].getPathPrimitive();if(Et(s).dot(Et(u))>.99){let p=u.end(),m=this.tool.degree45(l,a,p),g=new M(m[0],m[1]),y=new M(m[1],m[2]);if(!this.isCollide(n,g)&&!this.isCollide(n,y)){this.modifyNode(r,this.cloneOrderNode(n),g),this.modifyNode(r,this.cloneOrderNode(h),y),this.change=!0,i=i+2;continue}}}r.push(n)}return this.addDebug(r,ee.GREEN),r}remove4Distance(t){this.addDebug(t,ee.BLUE);let e=new Tn;for(let s of t)e.add(s);let i=e.listIterator().next(),n=new Array;for(;i!=null;){let s=this.findNextDistanceNode(i);i=this.getLines1(n,i,s)}return this.addDebug(n,ee.GREEN),n}cloneOrderNode(t){let e=new Zd(t.item,t.pt);return e.direction=t.direction,e.newDirection=t.newDirection,e.status=t.status.clone(),e}isCollide(t,e){if(e.length()<1e-8)return!1;let r=t instanceof Zd?t.item:t.item.item;return this.blockShape.checkDRC4Primitive(r,e)}findNextNode(t){let e=t.item.getPathPrimitive(),r=new Array,i=Et(e),n=t.next,s=-2,a=null;for(;n!=null;){let l=n.item.getPathPrimitive(),c=Et(l),h=i.dot(c);if(ne.greatereq(h,s)&&(s=h,a=n),h<.01){return r.push(n),r;n=n.next}else{if(r.includes(a)){let u=r.indexOf(a);u>=0&&r.splice(u+1,r.length-u-1)}return r}}if(r.includes(a)){let l=r.indexOf(a);l>=0&&r.splice(l+1,r.length-l-1)}return r}findNextNode1(t){let e=t.item.getPathPrimitive(),r=new Array,i=Et(e),n=t.next,s=-2,a=null,l=t.item.item.width*3;for(;n!=null;){let c=n.item.getPathPrimitive(),h=Et(c),u=i.dot(h),d=c.length();if(ne.greatereq(u,s)&&d>l&&(s=u,a=n),u<.01||d<l)r.push(n),n=n.next;else{if(r.includes(a)){let p=r.indexOf(a);p>=0&&r.splice(p+1,r.length-p-1)}return r}}if(r.includes(a)){let c=r.indexOf(a);c>=0&&r.splice(c+1,r.length-c-1)}return r}findNextNode2(t){let e=t.item.getPathPrimitive(),r=new Array,i=e.end(),n=Et(e),s=t.next,a=t.item.item.width*2;for(;s!=null;){let c=s.item.getPathPrimitive().end().sub(i),h=Math.abs(n.cross(c));if(ne.less(h,a))r.push(s),s=s.next;else return r}return r}findNextDistanceNode(t){let e=t.item.getPathPrimitive(),r=new Array,i=t.next,n=e.length(),s=0,a=e.start(),l=0,c=!1;for(;i!=null;){let h=i.item.getPathPrimitive();n+=h.length();let u=this.getDistance(a,h.end()),d=n-u;if(ne.greater(d,s)?(l=0,s=d,c=!0):(ne.eq(d,s),l++),r.push([i,c]),i=i.next,l>=2||i!=null&&i.item.status.notChange)break}return r}findNextDistanceNode1(t){let e=t.item.getPathPrimitive(),r=new Array,i=t.next,n=e.length(),s=0,a=e.start(),l=0,c=!1;for(;i!=null&&!(i!=null&&c&&i.item.status.isSource);){let h=i.item.getPathPrimitive();n+=h.length();let u=this.getDistance(a,h.end()),d=n-u;if(ne.greater(d,s)?(l=0,s=d,c=!0):(ne.eq(d,s),l++),r.push([i,c]),i=i.next,l>=2)break}return r}getDistance(t,e){let r=e.sub(t),i=Math.max(Math.abs(r.x),Math.abs(r.y)),n=Math.min(Math.abs(r.x),Math.abs(r.y));return i+n*v3t}source2None(t){this.addDebug(t,ee.BLUE);let e=new Tn;for(let s of t)e.add(s);let i=e.listIterator().next(),n=new Array;for(;i!=null;){let s=i.next;if(s!=null&&i.item.status.isSource&&!s.item.status.isSource){let a=i.item.getPathPrimitive(),l=Et(a),c=s.item.getPathPrimitive(),h=Et(c);if(l.dot(h)<.01){let d=a.start(),p=c.end(),m=this.tool.degree45(l,d,p),g=!1;s.next==null&&zs(l,m)[1].dot(h)<.99&&(g=!0);let y=new M(m[0],m[1]),b=new M(m[1],m[2]);if(!g&&!this.isCollide(i,y)&&!this.isCollide(i,b)){this.modifyNode(n,this.cloneOrderNode(i.item),y),this.modifyNode(n,this.cloneOrderNode(s.item),b),this.change=!0,i=s.next;continue}}}n.push(i.item),i=s}return this.addDebug(n,ee.GREEN),n}source2None1(t){this.addDebug(t,ee.BLUE);let e=new Tn;for(let s of t)e.add(s);let i=e.listIterator().next();e:for(;i!=null;){if(i.item.status.isSource){let s=i.item.getPathPrimitive(),a=Et(s),l=s.start(),c=this.findNext2(i),h=!0;for(;c.length>0;){let u=c.pop();!h&&c.length>0&&(u=c[0],c.length=0);let d=u.item.getPathPrimitive(),p=Et(d),m=d.end(),g=this.tool.degree45(a,l,m),y=new M(g[0],g[1]),b=new M(g[1],g[2]),P=!1;if(i.next==null&&zs(a,g)[1].dot(a)<.99&&(P=!0),!P&&!this.isCollide(i,y)&&!this.isCollide(i,b)){let T=this.cloneOrderNode(i.item);y.direct.dot(a)<.99&&(T.status.isSource=!1),this.replaceNodes(e,i,T,y),this.replaceNodes(e,i,this.cloneOrderNode(u.item),b),this.change=!0;let I=i.next;e.remove(u);for(let C of c)e.remove(C);e.remove(i),i=I;continue e}h=!1}}i=i.next}let n=e.toArray();return this.addDebug(n,ee.GREEN),n}source2Source2(t){this.addDebug(t,ee.BLUE);let e=new Tn;for(let s of t)e.add(s);let i=e.listIterator().next();e:for(;i!=null;){if(i.item.status.isSource){let s=this.findNodes(i);if(s.length>0){let a=s[0],l=a.item.getPathPrimitive(),c=Et(l),h=l.start(),u=s[s.length-1],d=u.item.getPathPrimitive(),p=Et(d),m=d.end(),g=this.tool.degree45(c,h,m),y=new M(g[0],g[1]),b=new M(g[1],g[2]),P=!1;if(i.next==null&&zs(c,g)[1].dot(c)<.99&&(P=!0),!P&&!this.isCollide(a,y)&&!this.isCollide(u,b)){this.replaceNodes(e,a,this.cloneOrderNode(a.item),y),this.replaceNodes(e,a,this.cloneOrderNode(u.item),b),this.change=!0;let T=u.next;for(let I of s)e.remove(I);i=T;continue e}}}i=i.next}let n=e.toArray();return this.addDebug(n,ee.GREEN),n}source2Source3(t){this.addDebug(t,ee.BLUE);let e=new Tn;for(let s of t)e.add(s);let i=e.listIterator().next();e:for(;i!=null;){let s=this.find4Short(i);if(s.length>0){let a=s[0],l=a.item.getPathPrimitive(),c=Et(l),h=l.start(),u=s[s.length-1],d=u.item.getPathPrimitive(),p=Et(d),m=d.end(),g=this.tool.degree45(c,h,m),y=new M(g[0],g[1]),b=new M(g[1],g[2]),P=!1;if(i.next==null&&zs(c,g)[1].dot(c)<.99&&(P=!0),!P&&!this.isCollide(a,y)&&!this.isCollide(u,b)){this.replaceNodes(e,a,this.cloneOrderNode(a.item),y),this.replaceNodes(e,a,this.cloneOrderNode(u.item),b),this.change=!0;let T=u.next;for(let I of s)e.remove(I);i=T;continue e}}i=i.next}let n=e.toArray();return this.addDebug(n,ee.GREEN),n}none2None(t){this.addDebug(t,ee.BLUE);let e=new Tn;for(let s of t)e.add(s);let i=e.listIterator().next(),n=new Array;for(;i!=null;)if(i.item.status.isSource)n.push(i.item),i=i.next;else{let s=this.findNextDistanceNode1(i);i=this.getLines1(n,i,s)}return this.addDebug(n,ee.GREEN),n}none2None1(t){this.addDebug(t,ee.BLUE);let e=new Tn;for(let s of t)e.add(s);let i=e.listIterator().next();e:for(;i!=null;){if(!i.item.status.isSource){let s=i.item.getPathPrimitive(),a=Et(s),l=s.start(),c=this.findNext2(i),h=!0;for(;c.length>0;){let u=c.pop();!h&&c.length>0&&(u=c[0],c.length=0);let d=u.item.getPathPrimitive(),p=Et(d),m=d.end(),g=this.tool.degree45(a,l,m),y=new M(g[0],g[1]),b=new M(g[1],g[2]),P=!1;if(i.next==null&&zs(a,g)[1].dot(a)<.99&&(P=!0),!P&&!this.isCollide(i,y)&&!this.isCollide(i,b)){this.replaceNodes(e,i,this.cloneOrderNode(i.item),y),this.replaceNodes(e,i,this.cloneOrderNode(u.item),b),this.change=!0;let T=u.next;e.remove(u);for(let I of c)e.remove(I);e.remove(i),i=T;continue e}h=!1}}i=i.next}let n=e.toArray();return this.addDebug(n,ee.GREEN),n}none2Source(t){this.addDebug(t,ee.BLUE);let e=new Tn;for(let s of t)e.add(s);let i=e.listIterator().next(),n=new Array;for(;i!=null;){let s=this.findNext1(i);if(s!=null&&!i.item.status.isSource&&s.item.status.isSource){let a=i.item.getPathPrimitive(),l=Et(a),c=s.item.getPathPrimitive(),h=Et(c);if(l.dot(h)<.01){let d=a.start(),p=c.end(),m=this.tool.degree45(l,d,p),g=new M(m[0],m[1]),y=new M(m[1],m[2]),b=!1;if(s.next==null&&zs(l,m)[1].dot(h)<.99&&(b=!0),!b&&!this.isCollide(i,g)&&!this.isCollide(i,y)){this.modifyNode(n,this.cloneOrderNode(i.item),g),this.modifyNode(n,this.cloneOrderNode(s.item),y),this.change=!0,i=s.next;continue}}}n.push(i.item),i=i.next}return this.addDebug(n,ee.GREEN),n}none2Source1(t){this.addDebug(t,ee.BLUE);let e=new Tn;for(let s of t)e.add(s);let i=e.listIterator().next();e:for(;i!=null;){if(i.item.status.isSource){let s=i.item.getPathPrimitive(),a=Et(s),l=s.end(),c=this.findPrev(i),h=!0;for(;c.length>0;){let u=c.pop();!h&&c.length>0&&(u=c[0],c.length=0);let d=u.item.getPathPrimitive(),p=Et(d),m=d.start(),g=this.tool.degree45(p,m,l),y=new M(g[0],g[1]),b=new M(g[1],g[2]),P=!1;if(i.next==null||h){let T=zs(p,g);if(i.next==null&&T[1].dot(a)<.99&&(P=!0),i.next!=null){let I=Et(i.next.item.getPathPrimitive());T[1].dot(I)<.01&&(P=!0)}}if(!P&&!this.isCollide(i,y)&&!this.isCollide(i,b)){this.replaceNodes(e,u,this.cloneOrderNode(u.item),y);let T=this.cloneOrderNode(i.item);b.direct.dot(a)<.99&&(T.status.isSource=!1),this.replaceNodes(e,u,T,b),this.change=!0,e.remove(u);for(let C of c)e.remove(C);let I=i.next;e.remove(i),i=I;continue e}h=!1}}i=i.next}let n=e.toArray();return this.addDebug(n,ee.GREEN),n}source2Source(t){this.addDebug(t,ee.BLUE);let e=new Tn;for(let s of t)e.add(s);let i=e.listIterator().next(),n=new Array;for(;i!=null;){let s=i.next;if(s!=null&&i.item.status.isSource&&s.item.status.isSource&&!i.item.status.notChange&&!s.item.status.notChange){let a=i.item.getPathPrimitive(),l=Et(a),c=s.item.getPathPrimitive(),h=Et(c);if(l.dot(h)<.01){let d=a.start(),p=c.end(),m=this.tool.degree45(l,d,p),g=new M(m[0],m[1]),y=new M(m[1],m[2]),b=!1;if(s.next==null&&zs(l,m)[1].dot(h)<.99&&(b=!0),!b&&!this.isCollide(i,g)&&!this.isCollide(i,y)){this.modifyNode(n,this.cloneOrderNode(i.item),g),this.modifyNode(n,this.cloneOrderNode(s.item),y),this.change=!0,i=s.next;continue}}}n.push(i.item),i=s}return this.addDebug(n,ee.GREEN),n}source2Source1(t){this.addDebug(t,ee.BLUE);let e=new Tn;for(let s of t)e.add(s);let i=e.listIterator().next(),n=new Array;for(;i!=null;){let s=i.next;if(s!=null&&i.item.status.isSource&&s.item.status.isSource){let a=i.item.getPathPrimitive(),l=Et(a),c=s.item.getPathPrimitive(),h=Et(c);if(l.dot(h)<.01){let d=a.start(),p=!1,m=c.end(),g=this.tool.degree45(l,d,m);if(s.next==null&&zs(l,g)[1].dot(h)>.99&&(p=!0),!p){let T=a.length()/2,I=c.length()/2,C=Math.min(T/2,I/2,3);m=c.start().add(h.mul(C)),g=this.tool.degree45(l,d,m)}let y=new M(g[0],g[1]),b=new M(g[1],g[2]);if(!!1&&!this.isCollide(i,y)&&!this.isCollide(i,b)){this.modifyNode(n,this.cloneOrderNode(i.item),y),this.modifyNode(n,this.cloneOrderNode(s.item),b),p||this.modifyNode(n,this.cloneOrderNode(s.item),new M(m,c.end())),this.change=!0,i=s.next;continue}}}n.push(i.item),i=s}return this.addDebug(n,ee.GREEN),n}findNext(t,e){for(;t.next!=null;)if(t=t.next,t.item.status.isSource==e)return t;return null}findNext1(t){for(;t.next!=null;)if(t=t.next,t.item.status.isSource)return t;return null}findNodes(t){let e=this.findNext2(t);if(e.length>0){let r=this.findPrev(t);if(r.length>0){let i=new Array;for(let n=r.length-1;n>=0;n--)i.push(r[n]);return i.push(t),xe.addAll(i,e),i}}return[]}find4Short(t){let e=t.item.getPathPrimitive();if(t.prev!=null&&t.next!=null&&e.length()<t.item.item.width*2){let r=t.prev,i=t.next;return[r,t,i]}return[]}findNext2(t){let e=t.item.getPathPrimitive(),r=Et(e),i=!1,n=new Array;for(;t.next!=null;){let s=t.next,a=s.item.getPathPrimitive(),l=Et(a),c=r.dot(l);if(c<.01&&!s.item.status.isSource&&(i=!0),!i)return n;if(c>.01&&!s.item.status.isSource)return n.push(s),n;if(s.item.status.isSource)return n;n.push(s),t=s}return n}findPrev(t){let e=t.item.getPathPrimitive(),r=Et(e),i=!1,n=new Array;for(;t.prev!=null;){let s=t.prev,a=s.item.getPathPrimitive(),l=Et(a),c=r.dot(l);if(c<.01&&!s.item.status.isSource&&(i=!0),!i)return n;if(c>.01&&!s.item.status.isSource)return n.push(s),n;if(s.item.status.isSource)return n;n.push(s),t=s}return n}findNext3(t){let e=t.item.getPathPrimitive(),r=Et(e),i=new Array;for(;t.next!=null;){let n=t.next,s=n.item.getPathPrimitive(),a=Et(s);if(r.dot(a)>.01&&!n.item.status.isSource)return i.push(n),i;if(n.item.status.isSource)return i;i.push(n),t=n}return i}findPrev1(t){let e=t.item.getPathPrimitive(),r=Et(e),i=new Array;for(;t.prev!=null;){let n=t.prev,s=n.item.getPathPrimitive(),a=Et(s);if(r.dot(a)>.01&&!n.item.status.isSource)return i.push(n),i;if(n.item.status.isSource)return i;i.push(n),t=n}return i}};var bR=class{constructor(t){this.clearanceUtils=new Kd;this.sweep=null;this.end=null;this.endNode=null;this.point=null;this.startIndex=-1;this.endIndex=-1;this.rtree=new rT(15);this.tracks=new Array;if(t!=null){let e=t.iterator();for(;e.hasNext();){let r=e.next();this.tracks.push(r),this.rtree.insert(new Lp(r))}t.viaNode.prev!=null&&this.rtree.insert(new Lp(t.viaNode.prev.item)),t.otherNode.prev!=null&&t.otherNode.prev instanceof et&&this.rtree.insert(new Lp(t.otherNode.prev)),t.viaNode.next!=null&&this.rtree.insert(new Lp(t.viaNode.next.item)),t.otherNode.next!=null&&t.otherNode.next instanceof et&&this.rtree.insert(new Lp(t.otherNode.next))}}getBBox4Primitive(t,e,r){return e instanceof M?Lc.trackToOctagon(e.start(),e.end(),t.width+r*2):e.bbox().extendOfSize(r+t.width/2)}calculateStartCollide(t){let e=t.length,r=this.clearanceUtils.getMaxClearance();for(let i=0;i<e;i++){let n=t[i];if(n==null)continue;let s=ha(n),a=n.primitive,l=this.getBBox4Primitive(n,a,r),c=n.layerId,h=new Array,u=this.rtree.search(l);for(let p of u){let m=p.model;if(m instanceof gt){let g=this.clearanceUtils.getSafeClearance(s,ha(m,!1),m,n.layerId);if(ne.eq(g,0))continue;let y=uh.check(a,c,n,m,g);if(y.collide){let b=y.inters(a),P=new el(n,b,m,g,void 0,n.layerId,c,y.collideInfo);h.push(P)}}else if(m instanceof Ct||m instanceof et){let g=this.collideViaPad(n,m,!1);g!=null&&xe.addAll(h,g)}}let d=a.start();if(Er(h,(p,m)=>p.point.distance2(d)-m.point.distance2(d),0,h.length),h.length>0)return h[0]}return null}calculateEndCollide(t){let e=t.length,r=this.clearanceUtils.getMaxClearance();for(let i=e-1;i>=0;i--){let n=t[i];if(n==null)continue;let s=ha(n),a=n.primitive.reverse(),l=this.getBBox4Primitive(n,a,r),c=n.layerId,h=new Array,u=this.rtree.search(l);for(let p of u){let m=p.model;if(m instanceof gt){let g=this.clearanceUtils.getSafeClearance(s,ha(m,!1),m,n.layerId);if(ne.eq(g,0))continue;let y=uh.check(a,c,n,m,g);if(y.collide){let b=y.inters(a),P=new el(n,b,m,g,void 0,n.layerId,c,y.collideInfo);h.push(P)}}else if(m instanceof Ct||m instanceof et){let g=this.collideViaPad(n,m,!0);g!=null&&xe.addAll(h,g)}}let d=a.start();if(Er(h,(p,m)=>p.point.distance2(d)-m.point.distance2(d),0,h.length),h.length>0)for(let p of h){let m=p.obstacle;if(m instanceof Ct||m instanceof et){this.endNode=m,this.point=p.point;return}if(p.obstacle.primitive.length()>1e-8){this.sweep=this.getSweep(p.obstacle,p.point),this.end=p.obstacle,this.point=p.point;return}}}}checkEndpoint(t,e,r,i=!0){if(r){if(e.viaNode.prev!=null){let n=this.collideViaPad(t,e.viaNode.prev.item,i);if(n)return n}if(e.otherNode.prev!=null&&e.otherNode.prev instanceof et){let n=this.collideViaPad(t,e.otherNode.prev,i);if(n)return n}}else{if(e.viaNode.next!=null){let n=this.collideViaPad(t,e.viaNode.next.item);if(n)return n}if(e.otherNode.next!=null&&e.otherNode.next instanceof et){let n=this.collideViaPad(t,e.otherNode.next);if(n)return n}}return null}collideViaPad(t,e,r=!0){let i=ha(t),n=this.clearanceUtils.getSafeClearance(i,ha(e,!1),e,t.layerId);if(t.buildBBox().extendOfSize(n).isSeparated(e.buildBBox()))return null;let s=r?t.primitive.reverse():t.primitive,a=t.layerId,l=new Array;if(ne.eq(n,0))return null;let c=uh.check(s,a,t,e,n);if(c.collide){let h=c.inters(s),u=new el(t,h,e,n,void 0,t.layerId,a,c.collideInfo);l.push(u)}return l.length>0?l:null}getSweep(t,e){var n,s,a,l;let r=At.getInstance().getListNode(t),i=Mm(t.primitive,e,(s=(n=r.prev)==null?void 0:n.item)==null?void 0:s.primitive,(l=(a=r.next)==null?void 0:a.item)==null?void 0:l.primitive);return i==null?ae.CCW:i}getListNode(t){return At.getInstance().getListNode(t)}increase(t){if(this.point==null)return!0;let e=this.getNearPoint(t,this.end.primitive),r=this.getNearPoint(this.point,this.end.primitive);if(e.equals1(r)){let n=Et(this.end.primitive,e),s=t.sub(e),a=this.point.sub(e),l=s.dot(n),c=a.dot(n);return l<c}return!!an([e,r],this.end.primitive)[0].equals1(e)}getNearPoint(t,e){let r=new M(t,t),n=new er(r,e).getLine();return n.start().equals1(t)?n.end():n.start()}getObstacles4Same(t){if(this.end!=null){let e=t.parent.toArray();if(this.endIndex=e.indexOf(this.end),this.startIndex=e.indexOf(t.item),this.endIndex>this.startIndex){let r=new Array;for(let i=this.startIndex;i<=this.endIndex;i++)r.push(e[i]);return r}else{let r=new Array;for(let i=this.endIndex;i<=this.startIndex;i++)r.push(e[i]);return r}}return[t.item]}getObstacles4Other(t,e){if(this.end!=null){let r=t.parent.toArray();if(this.endIndex=r.indexOf(this.end),this.startIndex=r.indexOf(t.item),this.endIndex>this.startIndex){let i=new Array;if(e){for(let n=this.startIndex;n<r.length;n++)i.push(r[n]);t.parent.viaNode.next!=null&&i.push(t.parent.viaNode.next),t.parent.otherNode.next!=null&&!(t.parent.otherNode.next instanceof Fn)&&i.push(t.parent.otherNode.next)}else{for(let n=0;n<=this.endIndex;n++)i.push(r[n]);t.parent.viaNode.prev!=null&&i.push(t.parent.viaNode.prev),t.parent.otherNode.prev!=null&&i.push(t.parent.otherNode.prev)}return i}else{let i=new Array;if(e){for(let n=this.endIndex;n<r.length;n++)i.push(r[n]);t.parent.viaNode.next!=null&&i.push(t.parent.viaNode.next),t.parent.otherNode.next!=null&&!(t.parent.otherNode.next instanceof Fn)&&i.push(t.parent.otherNode.next)}else{for(let n=0;n<=this.startIndex;n++)i.push(r[n]);t.parent.viaNode.prev!=null&&i.push(t.parent.viaNode.prev),t.parent.otherNode.prev!=null&&i.push(t.parent.otherNode.prev)}return i}}return[t.item]}getObstaclesIndex(t){if(this.end!=null){let e=t.parent.toArray();this.endIndex=e.indexOf(this.end),this.startIndex=e.indexOf(t.item)}}getMin(t,e,r,i=!0){let n=new Map,s=i?r.size():-1,a=null,l=-1;for(let h of t){l++;let u=new Array;n.set(l,u);let d=ha(e),p=r.getFirst(),m=this.clearanceUtils.getSafeClearance(d,ha(p,!1),p,e.layerId);if(ne.eq(m,0))continue;let g=e.layerId,y=r.listIterator(),b=0;for(;y.hasNext();){let I=y.next().item,C=uh.check(h,g,e,I,m);if(C.collide){let E=C.inters(h),O=new el(e,E,I,m,void 0,e.layerId,g,C.collideInfo);u.push(O),i?b<s&&(s=b,a=I):b>s&&(s=b,a=I)}b++}let P=h.start();Er(u,(T,I)=>T.point.distance2(P)-I.point.distance2(P),0,u.length)}let c=new Array;for(let[h,u]of n){let d=!1;for(let p of u)if(p.obstacle==a){d=!0;break}c.push(d)}return c}};var Gne=class{constructor(t,e){this.sourceIndexMaps=new Map;this.node=null;this.sourceIndexMaps=t,this.directFilter=e}setNode(t){this.node=t}filter(t,e=this.node){if(e==null)return t;let r=e.item,i=new Set;for(let n of t){if(n.net==r.net&&n.layerId==r.layerId){if(e.startSource!=null&&this.sourceIndexMaps.get(e.startSource)>this.sourceIndexMaps.get(n))continue;i.add(n);continue}let s=n;if(s instanceof gt&&r.net!=s.net&&this.directFilter.canShove(s)){let a=At.getInstance().getNode(s);if(e.inPushPath(a.parent)||e.inPushPath(s))continue}i.add(n)}return i}};var Une=class{constructor(t){this.cwObstaclesMap=new Map;this.ccwObstaclesMap=new Map;this.cwPushMap=new Map;this.ccwPushMap=new Map;this.sameDirect=new Map;this.block=new ms;this.used=new Set;this.exclusions=new Set;this.recommendDirect=new Map;this.source=t,this.exclusions=new Set(t);for(let e of t){let r=this.block.blockTrackOther(e,this.exclusions);this.classify(r)}}classify(t){this.groupSort(t);for(let e of t)this.classifyResult(e)}groupSort(t){let e=null,r=[],i=new Array,n=new Map,s=0;for(let l of t)l.obstacle instanceof gt?e==null?(e=l.point,r.push(l),n.set(l,s)):e.distance1(l.point)<1e-4?(r.push(l),n.set(l,s)):(i.push(r),r=[],s++,r.push(l),n.set(l,s)):n.set(l,s++);i.push(r);let a=!1;for(let l of i)if(l.length>1){let c=new Map;for(let h of l){let u=h.obstacle;if(u instanceof gt){let d=this.getListNode(u),p=c.get(d.parent);p==null&&(p=[],c.set(d.parent,p)),p.push(h)}}for(let[h,u]of c)if(u.length>1){a=!0;for(let d of u){let p=d.obstacle.primitive,g=new er(p,new M(d.point,d.point)).getLine(),y;g.start().equals1(d.point)?y=Et(p,g.end()):y=Et(p,g.start());let b=Math.abs(y.dot(g.direct)),P=n.get(d)+b;n.set(d,P)}}}a&&t.sort((l,c)=>n.get(l)-n.get(c))}classifyResult(t){let e=t.obstacle;!t.isSameNet&&e instanceof gt&&t.source instanceof gt?this.calculateSameListObstacles(e,t.source,t.point):!t.isSameNet&&e instanceof Ct&&t.source instanceof gt?this.calculateEndpoints(this.getNode(e),t.source,t.point,t):!t.isSameNet&&e instanceof et&&t.source instanceof gt&&this.calculateEndpoints(this.getNode(e),t.source,t.point,t)}calculateSameListObstacles(t,e,r){var h;let i=this.getListNode(t);if(this.used.has(i.parent))return;let n=i.parent;this.used.add(n),this.add2Exclusions(n);let s=new bR(n);if(s.calculateEndCollide(this.source),s.endNode!=null){let u=s.endNode,d;u instanceof Ct?((h=n.viaNode.prev)==null?void 0:h.item)==u?d=!0:d=!1:n.otherNode.prev==u?d=!0:d=!1,this.addCache(u,d,!1,s.point,t,r);return}let a=s.getSweep(t,r),l=ae.CCW,c;if(s.getObstaclesIndex(i),s.startIndex<s.endIndex?c=a:s.startIndex==s.endIndex?s.increase(r)?c=a:c=a==ae.CCW?ae.CW:ae.CCW:c=a==ae.CCW?ae.CW:ae.CCW,s.sweep==a){this.sameDirect.set(n,!0);let u=s.getObstacles4Same(i),d=new Set(n.toArray());for(let p of u)d.delete(p);l==c?(this.recommendDirect.set(n,ae.CW),this.cwObstaclesMap.set(n,new Set(u)),this.cwPushMap.set(n,new Set(d)),this.ccwObstaclesMap.set(n,new Set([n]))):(this.recommendDirect.set(n,ae.CCW),this.cwObstaclesMap.set(n,new Set([n])),this.ccwObstaclesMap.set(n,new Set(u)),this.ccwPushMap.set(n,new Set(d)))}else{this.sameDirect.set(n,!1);let u=Dy(r,t.primitive),d=l==u,p=s.getObstacles4Other(i,d),m=s.getObstacles4Other(i,!d);this.cwObstaclesMap.set(n,new Set(p)),this.ccwObstaclesMap.set(n,new Set(m))}}add2Exclusions(t){let e=t.iterator();for(;e.hasNext();)this.exclusions.add(e.next())}getCache(t,e,r,i,n){let s=Et(i.primitive,n),a=n.sub(i.start).normalize(),l=s.cross(a)>0?ae.CCW:ae.CW,c=At.getInstance().getListNode(i).parent,h=this.getObstacles(t,e,i);return e?r?l==ae.CCW?{cw:new Set(h),ccw:new Set([c])}:{cw:new Set([c]),ccw:new Set(h)}:l==ae.CCW?{cw:new Set([c]),ccw:new Set(h)}:{cw:new Set(h),ccw:new Set([c])}:r?l==ae.CCW?{cw:new Set([c]),ccw:new Set(h)}:{cw:new Set(h),ccw:new Set([c])}:l==ae.CCW?{cw:new Set(h),ccw:new Set([c])}:{cw:new Set([c]),ccw:new Set(h)}}addCache(t,e,r,i,n,s){var m,g,y,b,P,T,I,C;let a=At.getInstance().getListNode(n),l=Mm(n.primitive,s,(g=(m=a.prev)==null?void 0:m.item)==null?void 0:g.primitive,(b=(y=a.next)==null?void 0:y.item)==null?void 0:b.primitive),c;e?c=a.parent.getFirstNode():c=a.parent.getLastNode();let h=Mm(c.item.primitive,i,(T=(P=c.prev)==null?void 0:P.item)==null?void 0:T.primitive,(C=(I=c.next)==null?void 0:I.item)==null?void 0:C.primitive),u=a.parent;this.sameDirect.set(u,l==h);let d=this.getObstacles(t,e,n),p=l==h?new Set([u]):this.getAll(u);e?r?(this.recommendDirect.set(u,l==ae.CCW?ae.CW:ae.CCW),l==ae.CCW?(this.cwObstaclesMap.set(u,new Set(d)),this.ccwObstaclesMap.set(u,p)):(this.cwObstaclesMap.set(u,p),this.ccwObstaclesMap.set(u,new Set(d)))):(this.recommendDirect.set(u,l),l==ae.CCW?(this.cwObstaclesMap.set(u,p),this.ccwObstaclesMap.set(u,new Set(d))):(this.cwObstaclesMap.set(u,new Set(d)),this.ccwObstaclesMap.set(u,p))):r?(this.recommendDirect.set(u,l),l==ae.CCW?(this.cwObstaclesMap.set(u,p),this.ccwObstaclesMap.set(u,new Set(d))):(this.cwObstaclesMap.set(u,new Set(d)),this.ccwObstaclesMap.set(u,p))):(this.recommendDirect.set(u,l==ae.CCW?ae.CW:ae.CCW),l==ae.CCW?(this.cwObstaclesMap.set(u,new Set(d)),this.ccwObstaclesMap.set(u,p)):(this.cwObstaclesMap.set(u,p),this.ccwObstaclesMap.set(u,new Set(d))))}getAll(t){let e=new Set,r=t.iterator();for(;r.hasNext();)e.add(r.next());return t.otherNode.prev!=null&&e.add(t.otherNode.prev),t.otherNode.next!=null&&e.add(t.otherNode.next),t.viaNode.prev!=null&&e.add(t.viaNode.prev.item),t.viaNode.next!=null&&e.add(t.viaNode.next.item),e}getObstacles(t,e,r){let i=At.getInstance().getListNode(r),n=new Array;if(n.push(t),e)for(;i!=null;)n.push(i.item),i=i.prev;else for(;i!=null;)n.push(i.item),i=i.next;return n}getNode(t){return t instanceof Ct?Si.getInstance().getViaNode(t):Kl.getInstance().getNode(t)}calculateEndpoints(t,e,r,i){for(let[n,s]of t.connectTrack){if(n.size()==0||n.getFirst().layerId!=e.layerId||this.used.has(n))continue;let a=new bR(n);a.calculateEndCollide(this.source);let l=a.calculateStartCollide(this.source);if(l!=null&&l.obstacle instanceof gt)return this.calculateSameListObstacles(l.obstacle,l.source,l.point);if(this.used.add(n),this.add2Exclusions(n),a.endNode!=null)if(this.sameDirect.set(n,!1),a.endNode==t.item)this.collideInCCW(i,e,r,a.point,n)?(this.cwObstaclesMap.set(n,new Set([t.item])),this.ccwObstaclesMap.set(n,new Set([n]))):(this.cwObstaclesMap.set(n,new Set([n])),this.ccwObstaclesMap.set(n,new Set([t.item])));else{let c=this.getAll(n);this.cwObstaclesMap.set(n,c),this.ccwObstaclesMap.set(n,c)}else a.end!=null&&this.addCache(t.item,s,!0,r,a.end,a.point)}}getListNode(t){return At.getInstance().getListNode(t)}splitPolyline(t,e,r){let i=new M(e,e),n=new M(r,r),s=null,a=null;for(let p of t.primitives){let m=new er(p,i),g=new er(p,n);(s==null||m.getDistance()<s.getDistance())&&(s=m),(a==null||g.getDistance()<a.getDistance())&&(a=g)}function l(p,m){return p.pt1==m?t.primitives.indexOf(p.pt2):t.primitives.indexOf(p.pt1)}let c=l(s,i),h=l(a,n),u=new Array;function d(p,m){if(m==c){let g=Gu(p,e);u.push(g[g.length-1])}else if(m==h){let g=Gu(p,r);u.push(g[0])}else u.push(p)}if(c<h)for(let p=c;p<=h;p++){let m=t.primitives[p];d(m,p)}else if(c==h){let p=[e,r];an(p,t.primitives[c]);let m=t.primitives[c];if(p[0]==e){let g=Gu(m,e),y=Gu(g[g.length-1],r);u.push(y[0])}else{for(let g=c;g<t.primitives.length;g++){let y=t.primitives[g];d(y,g)}for(let g=0;g<=h;g++){let y=t.primitives[g];d(y,g)}}}else{for(let p=c;p<t.primitives.length;p++){let m=t.primitives[p];d(m,p)}for(let p=0;p<=h;p++){let m=t.primitives[p];d(m,p)}}return u}collideInCCW(t,e,r,i,n){let s=this.getRtree(n),a=t.info.shape.getOutline(ls),l=this.splitPolyline(a,r,i),c=e.width/2+t.clearance;for(let h of l){let u=h.bbox().extendOfSize(c),d=s.search(u);for(let p of d){let m=p.model;if(m instanceof gt&&Pt(h,m.primitive)>0)return!0}}return!1}getRtree(t){let e=new rT(15),r=t.iterator();for(;r.hasNext();){let i=r.next();e.insert(new Lp(i))}return e}};var lF=class extends Kh{upload(t){throw new Error("Method not implemented.")}updateData(){throw new Error("Method not implemented.")}constructor(t,e){super(),this.node=t,this.valid=e}redo(){j4(this.node,!this.valid),this.valid=!this.valid}undo(){j4(this.node,!this.valid),this.valid=!this.valid}};var cF=class extends Kh{upload(t){throw new Error("Method not implemented.")}updateData(){throw new Error("Method not implemented.")}constructor(t,e,r){super(),this.src=e,this.list=t,this.node=r}redo(){this.list.remove(this.node);let t=this.node.item;this.node.set(null),At.getInstance().delete(t)}undo(){this.src!=null?this.list.insertNodeAfter(this.src,this.node):this.list.addFirstNode(this.node)}};var SS=class{constructor(t=1e13){this.obstacleMaps=new Map;this.sourceMaps=new Map;this.sourceIndexMaps=new Map;this.blockShape=new ms;this.debug=null;this.level="NONE";this.isWire=!1;this.direct=new S(1,0);this.trackList=null;this.collidedCloseShape=!1;this.success=!0;this.group=null;this.inputEndpointCanModify=!1;this.lastPushDirect=null;this.timeout=t}initDebug(){Gr.debug&&(Gr.inputClear(),this.debug=new bA(1),this.debug.init(),Gr.input(this.debug)),this.debug!=null&&(this.debug.debug=Gr.debug)}find(t,e,r){if(this.lastPushDirect=null,this.inputEndpointCanModify=!1,this.success=!0,t.length==0)return;wt.pushFilter.clearExclusion(),this.directFilter=r,this.initDebug(),this.trackList=new Tn,this.obstacleMaps.clear(),this.sourceMaps.clear();let i=new Set,n=0;for(let g of t){this.directFilter.awaitShove.delete(g);let y=this.add(this.trackList,g,g.primitive);this.sourceMaps.set(g,[y]),this.sourceIndexMaps.set(g,n),i.add(y),this.debugTrack(g,g.primitive,ee.Golden),n++}if(this.group=new Une(t),wt.aroundFilter=new Gne(this.sourceIndexMaps,r),this.inputEndpointCanModify=this.endpointCanModify(t[t.length-1]),!this.inputEndpointCanModify)for(let[g,y]of this.group.sameDirect)!y&&!r.canShovePath.has(g)&&this.endpointIsFix(g)&&wt.pushFilter.addExclusionList(g);if(!this.isWire){let g=this.blockShape.blockTrackPoint(t[0],!0),y=new Set(this.blockShape.blockTrackPoint(t[0],!1));for(let b of g)if(b instanceof gt&&y.has(b)){let P=At.getInstance().getNode(b).parent;wt.pushFilter.addWaitList(P)}}let s=new Nne(this.timeout,this.trackList.getFirst(),this.trackList.getLast(),this.findNeighborNodes.bind(this));wt.aroundFilter=null,this.success=s.success;let a=At.getInstance().getNode(t[0]).parent,l=this.connect(s.endNode,a);this.addPolylineDebug(l);for(let g of l)i.has(g)?g.source=!0:g.source=!1;let c=new Array,h=new Zr,u=At.getInstance(),d=null,p=null,m=null;for(let g of l)if(g.source){c.push(g.item);let y=u.getNode(g.item);d!=null&&(y!=null&&y.prev!=null&&(m=y.prev),d.replace(p,m),e.addCommand(new mi(d))),p=y.next,d=null,m=null}else{let y=g.item,b=g.getPathPrimitive();if(p==null&&(p=u.getNode(y)),m=u.getNode(y),b.length()<1e-8&&l.length>1)continue;let P;b instanceof M?P=h.createTrack(y.layerId,b.start(),b.end(),y.width,y.showNet,e,y.getGroupID()):P=h.createArcTrackByArc(y.layerId,b,y.width,y.showNet,e,y.getGroupID()),d==null&&(d=u.createList());let T=h.addList(P,d,e);if(Mr.getInstance().setStatus(T,g.status.clone()),!g.status.isVertex){let C=g.obstacle;if(C!=null&&C instanceof gt){let E=this.getListNode(C);Mr.getInstance().getStatus(E).isVertex&&this.isSameShoveDirect(T,E)&&(g.status.isVertex=!0)}}let I=this.blockShape.blockOtherTrackOnlyTrack(P);for(let C of I){let E=C.source;E instanceof gt&&this.directFilter.canShove(E)&&this.directFilter.awaitShove.add(E)}c.push(P)}if(d!=null){let g=u.getNode(t[t.length-1]);g!=null&&(m=g),d.replace(p,m),e.addCommand(new mi(d))}else if(p!=null){let g=u.getNode(t[t.length-1]);if(g!=null&&g.next!=p){m=g;let y=une(p,m),b=p.parent;for(let P of y)e.addCommand(new lF(P,!1)),e.addCommand(new cF(b,P.prev,P)),j4(P,!1),b.remove(P)}}return wt.pushFilter.clearExclusion(),d=null,p=null,m=null,c}optimize(t,e){if(this.success=!0,t.length==0)return;this.initDebug(),this.trackList=new Tn,this.obstacleMaps.clear(),this.sourceMaps.clear();let r=new Set,i=0;for(let p of t){let m=this.add(this.trackList,p,p.primitive);this.sourceMaps.set(p,[m]),this.sourceIndexMaps.set(p,i),r.add(m),this.debugTrack(p,p.primitive,ee.Golden),i++}let s=new vj(performance.now()+this.timeout,this.trackList.toArray(),this.blockShape,this.level,this.direct,this.isWire).optimization();this.addPolylineDebug(s);for(let p of s)r.has(p)?p.source=!0:p.source=!1;let a=new Array,l=new Zr,c=At.getInstance(),h=null,u=null,d=null;for(let p of s)if(p.source){a.push(p.item);let m=c.getNode(p.item);h!=null&&(m!=null&&m.prev!=null&&(d=m.prev),h.replace(u,d),e.addCommand(new mi(h))),u=m.next,h=null,d=null}else{let m=p.item,g=p.getPathPrimitive();u==null&&(u=c.getNode(m)),d=c.getNode(m);let y;g instanceof M?y=l.createTrack(m.layerId,g.start(),g.end(),m.width,m.showNet,e,m.getGroupID()):y=l.createArcTrackByArc(m.layerId,g,m.width,m.showNet,e,m.getGroupID()),h==null&&(h=c.createList());let b=l.addList(y,h,e);if(Mr.getInstance().setStatus(b,p.status.clone()),!p.status.isVertex){let P=p.obstacle;if(P!=null&&P instanceof gt){let T=this.getListNode(P);Mr.getInstance().getStatus(T).isVertex!=null&&this.isSameShoveDirect(b,T)&&(p.status.isVertex=!0)}}a.push(y)}if(h!=null){let p=c.getNode(t[t.length-1]);p!=null&&(d=p),h.replace(u,d),e.addCommand(new mi(h))}return h=null,u=null,d=null,a}isSameShoveDirect(t,e){let r=Et(t.item.primitive),i=Et(e.item.primitive),n=Mr.getInstance().getStatus(t).pushDirect,s=Mr.getInstance().getStatus(e).pushDirect;return this.isSameShoveDirect1(r,i,n,s)}isSameShoveDirect1(t,e,r,i){let n=r==ae.CCW?new S(-t.y,t.x):new S(t.y,-t.x),s=i==ae.CCW?new S(-e.y,e.x):new S(e.y,-e.x);return!!ne.greater(n.dot(s),0)}addPolylineDebug(t){if(Gr.debug){let e=new Array;for(let i of t){let n=new Gn(i.getPathPrimitive(),{color:ee.Golden,net:i.item.net});e.push(n)}let r=new Cd(e);Gr.inputDebugGraphics(r),Gr.inputClear()}}connect(t,e){let r=new Array;if(t==null)return r;for(r.push(t);t.parent!=null;)t=t.parent,r.push(t);let i=r.reverse();this.filterFailResult(i);for(let n of i)if(n.aroundType>=2&&n.obstacle!=null){let s=Ou.getInstance().getObstacleInfo(n.obstacle);n.direction==0?s.addCCW(e):s.addCW(e)}return this.calculateVertex(i),this.success&&(i=new vj(performance.now()+this.timeout,i,this.blockShape,this.level,this.direct,this.isWire).optimization()),i}filterFailResult(t){if(this.success||!this.inputEndpointCanModify)return t;{let e=t.length-1;for(;e>=0&&!t[e].source;e--);return t.splice(e+1,t.length-e-1),t}}calculateVertex(t){let e=null,r=!1,i=null;for(let n of t)if(!n.status.isVertex){if(n.obstacle!=null&&n.obstacle instanceof gt&&e!=n.obstacle){e=n.obstacle,r=!1;let s=this.getListNode(n.obstacle);if(i=Mr.getInstance().getStatus(s),i.isVertex){let a=Et(s.item.primitive),l=Et(n.getPathPrimitive());this.isSameShoveDirect1(a,l,this.getListNodePushDirect(s),n.status.pushDirect)&&(r=!0)}}n.source&&(r=!1,i=null,e=null),r&&(n.status.isVertex=r)}}getListNodePushDirect(t){return Mr.getInstance().getStatus(t).pushDirect}getNodeNeihbor(t,e,r){var n;if((n=this.debug)!=null&&n.debug){let s=t.getPathPrimitive();this.debugTrack(t.item,s,ee.GREEN)}r(t);let i=t.getNeihbor();return i!=null&&!e(i)?(i.newDirection=t.direction,i.newParent=t,i.addAllObstacle(t.obstacles),[i]):[]}filterNeighborNodes(t,e,r,i){this.debugTrack(t.item,t.getPathPrimitive(),ee.GREEN),r(t);let n=e.filter(s=>s!=null&&!i(s));for(let s of n)s.newParent=t,s.addAllObstacle(t.obstacles);return n}findNeighborNodes(t,e,r){var l,c,h,u;let i=t.item;if(t.source&&(i.locked||xs(i)||i.getParent()!=null))return this.getNodeNeihbor(t,e,r);let n=t.getPathPrimitive();t.checkSelfObstacle(),this.debugTrack(t.item,n,ee.BLUE),wt.aroundFilter.setNode(t);let s=this.search(i,n,t.source),a=Array.from(s);if(s=this.filterObstacle(s,t),s.length==0)return this.getNodeNeihbor(t,e,r);{let d=!0;for(let p of s){let m=p.obstacle;if(m instanceof gt&&m.net==i.net&&m.layerId==i.layerId){let g=this.sourceMaps.get(m);if(g!=null){if(t.startSource!=null&&this.sourceIndexMaps.get(t.startSource)>this.sourceIndexMaps.get(m))continue;let y=0;if(t.item==p.obstacle){let P=g.indexOf(t.startSourceNode);P>=0&&(y=P+1)}let b=g.length-1;for(;y<=b;y++){let P=g[y],T=this._findNeighborNodesAtTrack(t,P,p,y<b,a);if(T!=null){let I=T.currentNode.obstacle;if(I instanceof gt){let C=this.getListNode(I);this.lastPushDirect=Mm(I.primitive,T.currentNode.pt.end(),(c=(l=C.prev)==null?void 0:l.item)==null?void 0:c.primitive,(u=(h=C.next)==null?void 0:h.item)==null?void 0:u.primitive)}return this.filterNeighborNodes(T.currentNode,T.neighborNodes,r,e)}}}}else{d=!1;let g=this.getObstacleList(p,i,t);if(g===t.node.parent)continue;if(p.point.equals1(n.end()))return this.getNodeNeihbor(t,e,r);try{let{currentNode:y,neighborNodes:b}=this._findNeighborNodesAtPolygon(t,g,p);return ne.eq(y.pt.length(),0)&&r(t),this.inputEndpointCanModify&&!this.inObstacleCloseShape(m,p.point)&&(b.length=0),this.filterNeighborNodes(y,b,r,e)}catch(y){return this.debugCollide(g,t,p.point),console.log(y),[]}}}return d?this.getNodeNeihbor(t,e,r):[]}}filterObstacle(t,e){let r=e.item,i=[],n=new Set,s=!1;for(let a of t){if(a.isSameNet){let c=a.obstacle;if(c instanceof gt&&c.net==r.net&&c.layerId==r.layerId&&this.sourceMaps.get(c)==null||a.obstacle instanceof gt&&(e.startSource!=null&&this.sourceIndexMaps.get(e.startSource)>this.sourceIndexMaps.get(a.obstacle)||!this.isValid4SameTrack(e,a.obstacle,a.point)||!this.isValidSameNet(e,a.obstacle.primitive,a.point)))continue;i.push(a),s=!0;continue}if(s&&!a.isSameNet)break;let l=a.obstacle;if(l instanceof gt&&r.net!=l.net&&this.directFilter.canShove(l)){let c=At.getInstance().getNode(l);if(e.inPushPath(c.parent))continue}if(e.aroundType>=2&&l instanceof gt&&r.net!=l.net&&this.directFilter.canShove(l)&&!l.locked&&!xs(l)&&l.getParent()==null){let c=At.getInstance().getNode(l);if(e.inPushPath(c.parent))continue;let h=n.has(c.parent)||this.isObstacle(e,l,a.point);if(!n.has(c.parent)&&h&&!this.inObstacles(e,c)){let u=this.getListNodePushDirect(c);if(u==null)h=!1;else if(u==ae.CCW){let d=Et(l.primitive),p=this.getDirect(l.start,a.point),m=d.cross(p);ne.lesseq(m,0)?h=!1:h=!0}else{let d=Et(l.primitive),p=this.getDirect(l.start,a.point),m=d.cross(p);ne.greatereq(m,0)?h=!1:h=!0}}h?(n.add(c.parent),i.push(a)):e.addPushPath(c.parent)}else if(l instanceof Ct&&r.net!=l.net&&this.directFilter.canShoveViaModel(l)){if(this.directFilter.awaitShove.has(this.getSolidNode(l)))continue;i.push(a)}else{if(e.aroundType==1&&l instanceof gt&&r.net!=l.net&&this.directFilter.canShove(l)&&e.obstacle instanceof gt&&!l.locked&&!xs(l)&&l.getParent()==null){let c=At.getInstance().getNode(e.obstacle),h=At.getInstance().getNode(l);n.has(h.parent)||this.isObstacle(e,l,a.point)?(n.add(h.parent),i.push(a)):h.parent==c.parent?e.addPushPath(l):e.addPushPath(h.parent);continue}else if(l instanceof gt&&r.net!=l.net&&this.directFilter.canShove(l)&&e.aroundType==0&&!l.locked&&!xs(l)&&l.getParent()==null&&this.directFilter.awaitShove.has(l))continue;i.push(a)}}return i}endpointIsFix(t){return!this.canOffset(t,!0)&&!this.canOffset(t)}canOffset(t,e=!1){var r,i;if(t.size()>0){if(e){if(t.otherNode.prev==null&&(t.viaNode.prev==null||t.viaNode.prev!=null&&(!t.viaNode.prev.isSource||(r=wt.filter)!=null&&r.canShoveVia())))return!0}else if(t.otherNode.next==null&&(t.viaNode.next==null||t.viaNode.next!=null&&(!t.viaNode.next.isSource||(i=wt.filter)!=null&&i.canShoveVia())))return!0}return!1}isObstacle4CollidePoint(t,e){let r=this.getListNode(e),i=!0,n=this.getListNodePushDirect(r);if(n==null)i=!1;else if(n==ae.CCW){let s=Et(e.primitive),a=this.getDirect(e.start,t),l=s.cross(a);ne.lesseq(l,0)?i=!1:i=!0}else{let s=Et(e.primitive),a=this.getDirect(e.start,t),l=s.cross(a);ne.greatereq(l,0)?i=!1:i=!0}return i}isObstacle(t,e,r){if(t.inPushPath(e))return!1;if(t.aroundType>=2){let i=At.getInstance().getNode(t.item),n=At.getInstance().getNode(e);if(t.inPushPath(n.parent))return!1;if(this.inObstacles(t,n))return!0;if(this.group!=null&&!this.inputEndpointCanModify)if(t.direction==0){let d=this.group.ccwObstaclesMap.get(n.parent);if(d!=null&&!this.group.sameDirect.get(n.parent)&&(d.has(e)||d.has(n.parent)))return!0}else{let d=this.group.cwObstaclesMap.get(n.parent);if(d!=null&&!this.group.sameDirect.get(n.parent)&&(d.has(e)||d.has(n.parent)))return!0}let s=Mr.getInstance().getStatus(i),a=Mr.getInstance().getStatus(n),l=this.getListNodePushDirect(i),c=this.getListNodePushDirect(n),h=l!=null&&this.notSpace(s),u=c!=null&&this.notSpace(a);if(u&&h&&l==c)return!1;if(u){let d=Et(t.getPathPrimitive()),p=Et(e.primitive),m=t.direction==1?new S(-d.y,d.x):new S(d.y,-d.x),g=c==ae.CCW?new S(-p.y,p.x):new S(p.y,-p.x);return ne.greater(m.dot(g),0)?!1:this.isObstacle4CollidePoint(r,e)}else return!1}else if(t.aroundType==1&&t.obstacle instanceof gt&&this.directFilter.canShove(t.obstacle)){let i=At.getInstance().getNode(t.obstacle),n=At.getInstance().getNode(e);if(t.inPushPath(n.parent))return!1;if(this.inObstacles(t,n))return!0;if(this.group!=null&&!this.inputEndpointCanModify)if(t.direction==0){let m=this.group.ccwObstaclesMap.get(n.parent);if(m!=null&&!this.group.sameDirect.get(n.parent)&&(m.has(e)||m.has(n.parent)))return!0}else{let m=this.group.cwObstaclesMap.get(n.parent);if(m!=null&&!this.group.sameDirect.get(n.parent)&&(m.has(e)||m.has(n.parent)))return!0}let s=this.isReverse(i),a=this.isReverse(n);if(s&&!a)return!1;if(!s&&a)return!0;let l=Mr.getInstance().getStatus(i),c=Mr.getInstance().getStatus(n),h=this.getListNodePushDirect(i),u=this.getListNodePushDirect(n),d=h!=null&&this.notSpace(l),p=u!=null&&this.notSpace(c);if(d&&!p)return!1;if(d&&p){let m=Et(t.obstacle.primitive),g=Et(e.primitive);return this.isSameShoveDirect1(m,g,h,u)?!1:this.isObstacle4CollidePoint(r,e)}else{if(!d&&p)return Dy(r,e.primitive)==u;if(u!=null){let g=Et(t.obstacle.primitive),y=Et(e.primitive);return this.isSameShoveDirect1(g,y,h,u)?!1:this.isObstacle4CollidePoint(r,e)}else return!1}}return!0}inObstacles(t,e){return t.obstacles.has(e.item)||t.obstacles.has(e.parent)}getCross(t,e){let r=Et(t.primitive),i=this.getDirect(t.start,e);return r.cross(i)}getDirect(t,e){let r=e.sub(t);return Math.abs(r.x)<1e-8&&Math.abs(r.y)<1e-8?S.ORIGIN:r.normalize()}getHull(t,e){if(t.info!=null)return t.info.shape.getOutline(ls);let r=t.clearance;return Wa.convexHull(t.obstacle.getMathGraphics(t.layer2),r+e.width/2)}getObstacleList(t,e,r){var s;let{obstacle:i}=t;i instanceof or&&(i.layerId==11||i.type=="Partition")&&(this.collidedCloseShape=!0);let n=this.obstacleMaps.get(t.info.shape);if(n==null){n=new Tn;let a=!0;i instanceof gt&&this.directFilter.canShove(i)&&!i.locked&&!xs(i)&&i.getParent()==null&&(a=!1),this.obstacleMaps.set(t.info.shape,n);let l=t.info.shape.getOutline(ls),c=a?2:1,h=i.locked||xs(i)||i.getParent()!=null||i instanceof Ct||i instanceof et||this.directFilter.obstacles.has(i),u=_Ce(l.primitives);if((s=wt.filter)!=null&&s.isPushTrack()){if(i instanceof et){for(let g of l.primitives){let y=this.blockShape.blockPad(e,g);for(let b of y)wt.pushFilter.addExclusionShape(b.obstacle)}let m=Kl.getInstance().getNode(i);for(let[g]of m.connectTrack)wt.pushFilter.addExclusionList(g)}else if(i instanceof Ct){let m=Si.getInstance().getViaNode(i);for(let[g]of m.connectTrack)wt.pushFilter.addExclusionList(g)}}for(let m of l.primitives){let g=this.add(n,e,m);g.cloneStatus(r),g.status.change(),g.status.clearPushDirect(),g.source=!1,g.aroundType=c,g.obstacle=i,g.weight=u,g.status.isVertex=h}let d=n.getFirst(),p=n.getLast();d.node.prev=p.node,p.node.next=d.node}return n}inObstacleCloseShape(t,e){if(t instanceof or&&t.type!="Slot Region"&&t.type!="Prohibited Region"){let r=t.getMathGraphics();if(r instanceof Fo){let l=this.trackList.getLast().item.end,c=r.items,h=jr.inPolygon(e,c),u=jr.inPolygon(l,c);return h&&u||!h&&!u}else if(r instanceof ge&&!r.isClose(.01))return!0;let i=this.trackList.getLast().item.end,n=r.asClose(),s=jr.pointInPolyline(e,n),a=jr.pointInPolyline(i,n);return s&&a||!s&&!a}return!0}getListNode(t){return At.getInstance().getListNode(t)}getConnectList(t){let e=t.toArray(),r=e.map(c=>c.pt),i=e[0],n=i.item,s=i.obstacle,a=null;s instanceof et?a=Kl.getInstance().getNode(s):s instanceof Ct&&(a=Si.getInstance().getViaNode(s));let l=new bR;if(a!=null)for(let[c,h]of a.connectTrack){if(c.size()==0)continue;wt.filter.addExclusionList(c);let u=l.getMin(r,n,c,h);for(let d=0;d<u.length;d++){let p=u[d],m=e[d];p&&m.addObstacles(c)}}}debugCollide(t,e,r){var i;if((i=this.debug)!=null&&i.debug){let{globalIndex:n,net:s,layerId:a,width:l}=e.item,c=new Gn(e.getPathPrimitive(),{globalIndex:n,net:s,layerId:a,width:l,color:ee.Gray}),h=t.toArray(),u=[];for(let d of h){let p=new Gn(d.getPathPrimitive(),{globalIndex:n,net:s,layerId:a,width:l,color:ee.Golden});u.push(p)}this.debug.add(new k8(c,u,[r]))}}debugTrack(t,e,r){var i;if((i=this.debug)!=null&&i.debug){let{globalIndex:n,net:s,layerId:a,width:l}=t;this.debug.add(new Gn(e,{globalIndex:n,net:s,layerId:a,width:l,color:r}))}}add(t,e,r){let i=new Zd(e,r),n=At.getInstance().getNode(e);i.status=Mr.getInstance().getStatus(n).clone();let s=t.add(i);return i.node=s,i}insertAfter(t,e,r){let i=new Zd(e,r),n=t.node.parent;if(t.node.prev==null&&t.node.next==null&&n.getFirst()!=t){let s=new j9(n,i);t.node.insertAfter(s),i.node=s}else{let s=n.insertAfter(t.node,i);i.node=s}return i}_findNeighborNodesAtPolygon(t,e,r){let i=r.point,n,s,a=this.trackList.getLast()==t,l=this.getBlockPointInfo(t,e,i);if(l==null){let y=this.getInters(t,e),b=e.getFirst(),[P,T]=this.replaceSource(t,y);return t.direction==1?(n=T,s=[P],P.P+=b.weight):(n=P,s=[T],T.P+=b.weight),{currentNode:n,neighborNodes:s}}let{isVertex:c}=l,h=l.location,[u,d]=this.replaceSource(t,i);if(t.direction==1?n=d:n=u,!c){let[y,b]=this.replaceSource(h,i);h=y}if(h.newDirection=1,h.next.newDirection=0,h.obstacle instanceof gt&&!h.obstacle.locked&&!xs(h.obstacle)&&h.obstacle.getParent()==null)if(t.obstacle instanceof gt){let y=this.getListNode(h.obstacle),b=this.getListNode(t.obstacle);y.parent==b.parent||this.calculateSameListObstacles(h,t,a)}else this.calculateSameListObstacles(h,t,a);else if(h.obstacle instanceof et||h.obstacle instanceof Ct){let y=this.getSolidNode(h.obstacle);this.calculateSolidObstacles(y,h,h.next)}let p=At.getInstance().getNode(t.item),m=Mr.getInstance().getStatus(p),g=this.getListNodePushDirect(p);if(g!=null&&!this.hasConnectTrack(h)&&this.notSpace(m)&&(t.source||!t.source&&m.isVertex))g==ae.CCW?h.next.P+=h.next.weight:h.P+=h.weight;else if(t.source){if(r.obstacle instanceof gt){let y=this.getListNode(r.obstacle);if(!this.group.sameDirect.get(y.parent)){let b=this.group.recommendDirect.get(y.parent);b==ae.CCW?h.P+=h.weight:b==ae.CW?h.next.P+=h.next.weight:this.directFilter.completes.has(y.parent)&&(g==ae.CCW?h.P+=h.weight:g==ae.CW&&(h.next.P+=h.next.weight))}}else if(r.obstacle instanceof et||r.obstacle instanceof Ct){let y=this.getSolidNode(r.obstacle),b=null,P=!0;for(let[T]of y.connectTrack){let I=this.group.recommendDirect.get(T);if(I!=null){if(b==null)b=I;else if(b!=I){P=!1;break}}}P&&b!=null&&(b==ae.CCW?h.P+=h.weight:b==ae.CW&&(h.next.P+=h.next.weight))}}return t.source?s=Ou.getInstance().filter(this.filterPathError(h,h.next)):s=t.direction==h.newDirection?this.getNext(h):this.getNext(h.next),{currentNode:n,neighborNodes:s}}getNext(t){return t.pathError?[]:[t]}filterPathError(t,e){let r=new Array;return t.pathError||r.push(t),e.pathError||r.push(e),r}getSolidNode(t){return t instanceof et?Kl.getInstance().getNode(t):Si.getInstance().getViaNode(t)}hasConnectTrack(t){let e=t.obstacle;if(e!=null){let r=t.item.layerId;if(e instanceof et||e instanceof Ct){let i=this.getSolidNode(e);for(let[n]of i.connectTrack)if(n.getFirst().layerId==r)return!0}}return!1}hasOtherConnectTrack(t){var r;let e=t.obstacle;if(e!=null&&((r=wt.filter)!=null&&r.isPushTrack())){let i=t.item.layerId;if(e instanceof et||e instanceof Ct){let n=this.getSolidNode(e);for(let[s]of n.connectTrack)if(s.getFirst().layerId==i&&!this.directFilter.canShovePath.has(s))return!0}}return!1}notSpace(t){return t!=null&&t.isVertex}isReverse(t){return Mr.getInstance().getStatus(t).isReversePush}getListLength(t){let e=t.iterator(),r=0;for(;e.hasNext();)r+=e.next().length;return r}calculateSameListObstacles(t,e,r){var u,d,p,m,g;if(!(t.obstacle instanceof gt))return;let i=this.getListNode(t.obstacle);if(e.obstacles.has(i.parent))return;let n=i.parent;if(wt.pushFilter.addExclusionList(n),this.group!=null){let y=this.group.cwObstaclesMap.get(n),b=this.group.ccwObstaclesMap.get(n);if(y!=null&&b!=null){t.addAllObstacle(y),t.next.addAllObstacle(b);let P=this.endpointIsFix(n);r&&this.lastPushDirect!=null&&Mm(t.obstacle.primitive,t.pt.end(),(d=(u=i.prev)==null?void 0:u.item)==null?void 0:d.primitive,(m=(p=i.next)==null?void 0:p.item)==null?void 0:m.primitive)!=this.lastPushDirect&&(y.clear(),b.clear());let T=this.getListLength(n);if(y.has(n)&&(P&&T>200?t.pathError=!0:t.P=T),b.has(n)&&(P&&T>200?t.next.pathError=!0:t.next.P=T),this.isWire&&Mr.getInstance().getStatus(i).isInput&&!t.pathError&&!t.next.pathError){let E=n.getLast(),O=y.has(E),_=b.has(E);O!=_&&(O&&(t.next.P=this.getListLength(n)),_&&(t.P=this.getListLength(n)))}let I=this.group.cwPushMap.get(n),C=this.group.ccwPushMap.get(n);if(I!=null)for(let E of I)t.addPushPath(E);if(C!=null)for(let E of C)t.next.addPushPath(E);return}}let s=new bR(n);s.calculateEndCollide(this.trackList.toArray().map(y=>y.item));let a=t.pt.end(),l=s.getSweep(t.obstacle,a);if(s.endNode!=null){let y=s.endNode,b;y instanceof Ct?((g=n.viaNode.prev)==null?void 0:g.item)==y?b=!0:b=!1:n.otherNode.prev==y?b=!0:b=!1;let P=this.group.getCache(y,b,!1,t.obstacle,a);t.addAllObstacle(P.cw),t.next.addAllObstacle(P.ccw);return}else if(s.end==null){let b=this.trackList.getLast().end,P=new ky(n.toArray().map(C=>C.primitive),b),T=P.calculateDirect();s.sweep=T;let I=P.index;I>=0&&(s.end=s.tracks[I],s.point=b)}let c=ae.CCW,h;if(s.getObstaclesIndex(i),s.startIndex<s.endIndex?h=l:s.startIndex==s.endIndex?s.increase(a)?h=l:h=l==ae.CCW?ae.CW:ae.CCW:h=l==ae.CCW?ae.CW:ae.CCW,s.sweep==l){let y=s.getObstacles4Same(i),b=new Set(n.toArray());for(let T of y)b.delete(T);let P=this.endpointIsFix(n);if(c==h){t.addAllObstacle(y);for(let T of b)t.addPushPath(T);t.next.addObstacles(n),P?t.next.pathError=!0:t.next.P=this.getListLength(n)}else{t.next.addAllObstacle(y);for(let T of b)t.next.addPushPath(T);t.addObstacles(n),P?t.pathError=!0:t.P=this.getListLength(n)}}else{let y=Dy(a,t.obstacle.primitive),b=c==y,P=s.getObstacles4Other(i,b),T=s.getObstacles4Other(i,!b);t.addAllObstacle(P),t.next.addAllObstacle(T)}}calculateSolidObstacles(t,e,r){if(this.group!=null)for(let[i]of t.connectTrack){if(i.size()==0)continue;let n=this.group.cwObstaclesMap.get(i),s=this.group.ccwObstaclesMap.get(i);if(n!=null&&s!=null){let a=this.endpointIsFix(i),l=this.getListLength(i);n.has(i)&&(a&&l>200?e.pathError=!0:e.P=l),s.has(i)&&(a&&l>200?r.pathError=!0:r.P=l),e.addAllObstacle(n),r.addAllObstacle(s);let c=this.group.cwPushMap.get(i),h=this.group.ccwPushMap.get(i);if(c!=null)for(let u of c)e.addPushPath(u);if(h!=null)for(let u of h)r.addPushPath(u)}else i.getFirst().layerId==e.item.layerId&&!this.inputEndpointCanModify&&this.endpointIsFix(i)&&(e.addObstacles(i),r.addObstacles(i),wt.pushFilter.addExclusionList(i))}}getInters(t,e){let r=t.getPathPrimitive(),i=e.getFirst(),n=i,s=new Array;do{let a=i.pt;if(r.bbox().intersection1(a.bbox())!=null){let l=Pt(r,a);this.addInterdebug(r,a,l);for(let c=0;c<l;c+=2){let h=new S(Ee[c],Ee[c+1]);!h.equals1(r.start())&&!h.equals1(r.end())&&s.push(h)}}i=i.next}while(i!=null&&i!=n);return an(s,r),s.length==0?r.end():s[0]}getBlockPointInfo(t,e,r){let i=t.getPathPrimitive(),n=i.bbox().extendOfSize(.1),s=e.getFirst(),a=s,l=r.bbox().extendOfSize(.1);do{let h=s.pt;if(n.intersection1(h.bbox())!=null&&l.intersection1(h.bbox())!=null){let u=Pt(i,h);this.addInterdebug(i,h,u);for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);if(p.equals1(r)&&!p.equals1(h.start())){let m={location:s,isVertex:void 0};return p.equals1(h.end())?m.isVertex=!0:m.isVertex=!1,s==a&&r.equals1(h.start())&&(m.location=s.prev,m.isVertex=!0),m}}}s=s.next}while(s!=null&&s!=a);if(r.equals1(i.start())){let h=new M(r,r);s=e.getFirst(),a=s;do{let u=s.pt;if(n.intersection1(u.bbox())!=null&&l.intersection1(u.bbox())!=null&&new er(h,u).getDistance()<=.01){let p={location:s,isVertex:void 0};return r.equals1(u.end())?p.isVertex=!0:p.isVertex=!1,s==a&&r.equals1(u.start())&&(p.location=s.prev,p.isVertex=!0),p}s=s.next}while(s!=null&&s!=a)}return null}_findNeighborNodesAtTrack(t,e,r,i,n){let s=t.getPathPrimitive(),a=e.getPathPrimitive(),c=r.point.bbox().extendOfSize(.1);if(ne.eq(a.length(),0)||!s.bbox().extendOfSize(.01).isIntersect(a.bbox().extendOfSize(.01))||c.intersection1(a.bbox())==null)return null;let h=Pt(s,a);this.addInterdebug(s,a,h);let u=null;if(h>0)if(s instanceof M&&a instanceof M&&s.isParallel(a)||s instanceof q&&a instanceof q&&s.center.equals1(a.center)&&s.rx===a.rx){let m=[];for(let g=0;g<h;g+=2){let y=new S(Ee[g],Ee[g+1]);s.start().equals1(y)||m.push(y)}an(m,s),u=m[0]}else{let m=[];for(let g=0;g<h;g+=2){let y=new S(Ee[g],Ee[g+1]);!y.equals1(s.start())&&y.equals1(r.point)&&m.push(y)}for(let g of m){let y=Et(s,g),b=Et(a,g);if((g.equals1(this.trackList.getLast().end)||!a.end().equals1(g)||!i)&&(t.direction===0&&(t.source||!t.source&&y.cross(b)<0)||t.direction===1&&(t.source||!t.source&&y.cross(b)>0)||t.source||!t.source&&(s instanceof q||a instanceof q))&&(u=g),u!=null)break}}else s instanceof M&&Zie(s,a.end())&&(u=a.end());let d=!1,p=t.weight;if(u!=null){let m=t.item;for(let g of n){let y=g.obstacle;if(y instanceof gt&&y.net!=m.net&&y.layerId==m.layerId){let b=this.getHull(g,m);if(!jr.inEdge4Polyline(u,b,.006)&&jr.pointInPolyline(u,b)){if(d=!0,p+=_Ce(b.primitives),t.obstacle!=null&&t.obstacle instanceof gt){let P=this.getListNode(t.obstacle),T=this.getListNode(y);P.parent==T.parent&&(u=null)}break}}}}if(u!=null){let m,g;if(u.equals1(t.pt.start())||u.equals1(t.pt.end())){if(t.direction==0){if(m=t,g=t.next,g==null){let[b,P]=this.replaceSource(t,u);m=b,g=P}}else if(m=t.prev,g=t,m==null){let[b,P]=this.replaceSource(t,u);m=b,g=P}m.newDirection=t.direction,g.newDirection=t.direction}else{let[b,P]=this.replaceSource(t,u);b.newDirection=t.direction,P.newDirection=t.direction,m=b,g=P}let y;if(e.pt.start().equals1(u))y=e;else{let b=null;if(e.pt.end().equals1(u)&&(b=e.next),b==null){let[P,T]=this.replaceSource(e,u);y=T}else y=b}if(y!=null&&(y.newDirection=e.direction),t.direction==1){let b=e.direction==0?y.pt:y.pt.reverse(),P=m.newDirection==0?m.pt:m.pt.reverse(),T=y.pt instanceof q||m.pt instanceof q;d&&(y.P+=p,m.P+=p/2);let I=Et(b),C=Et(P);return!m.source&&C.cross(I)<-.01&&!T?{currentNode:g,neighborNodes:[m]}:{currentNode:g,neighborNodes:[y]}}else{let b=e.direction==0?y.pt:y.pt.reverse(),P=g.newDirection==0?g.pt:g.pt.reverse(),T=y.pt instanceof q||g.pt instanceof q;d&&(y.P+=p,g.P+=p/2);let I=Et(b),C=Et(P);return!g.source&&C.cross(I)>.01&&!T?{currentNode:m,neighborNodes:[g]}:{currentNode:m,neighborNodes:[y]}}}else return null}isValid4SameTrack(t,e,r){if(t.startSource==e){let n=[t.startSourceNode.end,r];return an(n,e.primitive),n[0]!=r}return!0}isValidSameNet(t,e,r){let i=t.getPathPrimitive();if(i instanceof M&&e instanceof M&&i.isParallel(e)||i instanceof q&&e instanceof q&&i.center.equals1(e.center)&&i.rx===e.rx)return!0;{let n=Et(i,r),s=Et(e,r);if(t.direction===0&&(t.source||!t.source&&n.cross(s)<0))return!0;if(t.direction===1&&(t.source||!t.source&&n.cross(s)>0))return!0;if(t.source||!t.source&&(i instanceof q||e instanceof q))return!0}return!1}replaceSource(t,e){let r=t.item,i=this.splitPt(t.pt,e),n=this.insertAfter(t,r,i[0]),s=this.insertAfter(n,r,i[1]),a=t.node,l=a.parent;if(l.remove(a),n.pt.length()<1e-8&&l.remove(n.node),s.pt.length()<1e-8&&l.remove(s.node),a.prev=null,a.next=null,n.sycnDirect(t),s.sycnDirect(t),n.status.notChange=!1,s.status.notChange=!1,t.source){let c=this.sourceMaps.get(r);if(c!=null){let h=c.indexOf(t);h>=0&&c.splice(h,1,n,s)}}return[n,s]}addInterdebug(t,e,r){var i;if((i=this.debug)!=null&&i.debug){let n=new B8(new Gn(t,{color:ee.WHITE}),new Gn(e,{color:ee.WHITE}),r);this.debug.add(n)}}endpointCanModify(t){let e=this.getListNode(t),r=e.parent;if(e.next==null){if(r.otherNode.next==null&&(r.viaNode.next==null||r.viaNode.next!=null&&!r.viaNode.next.isSource))return!0;if(this.isWire&&Mr.getInstance().getStatus(e).isInput)return!0}return!this.isWire&&r.getFirst()==this.trackList.getFirst().item&&r.otherNode.prev==null&&(r.viaNode.prev==null||r.viaNode.prev!=null&&!r.viaNode.prev.isSource)}splitPt(t,e){if(t instanceof q){if(Math.abs(t.sweepAngle)===360){let n=t.center.sub(e).mul(2).add(e),s=q.build4(n,e,t.center,t.rx,t.rx,t.sweep()),a=q.build4(e,n,t.center,t.rx,t.rx,t.sweep());return[s,a]}let r=q.build4(t.start(),e,t.center,t.rx,t.rx,t.sweep()),i=q.build4(e,t.end(),t.center,t.rx,t.rx,t.sweep());return r.start().equals1(r.end())&&(r=new M(t.start(),e)),i.start().equals1(i.end())&&(i=new M(e,t.end())),[r,i]}else return[new M(t.start(),e),new M(e,t.end())]}search(t,e,r){return this.blockShape.blockTrackPrimitive(t,e,r)}};var kI=class{constructor(t,e,r,i,n=null){this.lists=[];this.level=e,this.direct=r;for(let s of t)this.lists.push(s);this.endTime=i,this.layerIds=n}optimize(t=!1){wt.setPushFilter(),wt.pushFilter.setAroundMode();let e=new Lr("super optimize"),r=!1;for(;;){r=!1;let i=new SS(this.endTime-performance.now());i.level=this.level,i.isWire=t;for(let n of this.lists){oi.getInstance().update();let s=new Lr,a=this.getChangeTracks(n);a.length&&(wt.pushFilter.setNet(a[0].net,new Set(a)),this.layerIds!=null?this.layerIds.has(a[0].layerId)?i.direct=this.direct:i.direct=S.ORIGIN:i.direct=this.direct,i.optimize(a,s)),s.length>0&&(e.addCommand(s),r=!0),wt.pushFilter.setNet(null,null)}if(r)this.lists.reverse();else break}return e}isChangeTrack(t){let e=Mr.getInstance().getStatus(t);return e.isInput||!e.notChange}getChangeTracks(t){let e=t.getFirstNode(),r=t.getLastNode();for(;e!=null;){if(this.isChangeTrack(e)){e.prev!=null&&!Mr.getInstance().getStatus(e).notChange&&(e=e.prev);break}if(e=e.next,e==r)break}for(;r!=null;){if(this.isChangeTrack(r)){r.next!=null&&!Mr.getInstance().getStatus(r).notChange&&(r=r.next);break}if(r=r.prev,e==r)break}let i=e,n=[];for(;i!=null&&(n.push(i.item),i!=r);)i=i.next;return n}};var ES=class{constructor(t){this.rtree=new r0(10);this.map=new Map;this.blockShape=new ms;let e=0;for(let r of t)this.rtree.insert(new Lp(r)),this.map.set(r,e++)}getShoveTracks(t,e){if(t==null||t.length==0)return;let r=new Set;for(let l of t){let c=this.search(l);for(let h of c)h.source instanceof gt&&r.add(h.source)}let i=Number.MAX_VALUE,n=-1,s=null,a=null;for(let l of r){let c=this.map.get(l);c<i&&(s=l,i=c),c>n&&(a=l,n=c)}if(s!=null&&a!=null){let l=At.getInstance().getListNode(s);for(;l!=null&&(e.awaitShove.add(l.item),l.item!=a);)l=l.next}}getViaShoveTracks(t,e){let r=new Set,i=this.search4Via(t);for(let c of i)c.obstacle instanceof gt&&r.add(c.obstacle);let n=Number.MAX_VALUE,s=-1,a=null,l=null;for(let c of r){let h=this.map.get(c);h<n&&(a=c,n=h),h>s&&(l=c,s=h)}if(a!=null&&l!=null){let c=At.getInstance().getListNode(a);for(;c!=null&&(e.add(c.item),c.item!=l);)c=c.next}}getShoveTracks4Order(t,e,r){if(t==null||t.length==0)return;let i=new Set;for(let c of t){let h=this.search(c);for(let u of h)u.source instanceof gt&&i.add(u.source)}let n=Number.MAX_VALUE,s=-1,a=null,l=null;for(let c of i){let h=this.map.get(c);h<n&&(a=c,n=h),h>s&&(l=c,s=h)}if(a!=null&&l!=null&&this.has(e,a,l)){let c=At.getInstance().getListNode(a);for(;c!=null&&(r.add(c.item),Mr.getInstance().setOrder(c,e),c.item!=l);)c=c.next}}getViaShoveTracks4Order(t,e,r){let i=new Set,n=this.search4Via(t);for(let h of n)h.obstacle instanceof gt&&i.add(h.obstacle);let s=Number.MAX_VALUE,a=-1,l=null,c=null;for(let h of i){let u=this.map.get(h);u<s&&(l=h,s=u),u>a&&(c=h,a=u)}if(l!=null&&c!=null&&this.has(e,l,c)){let h=At.getInstance().getListNode(l);for(;h!=null&&(r.add(h.item),Mr.getInstance().setOrder(h,e),h.item!=c);)h=h.next}}has(t,e,r){let i=At.getInstance().getListNode(e);if(i.prev!=null&&Mr.getInstance().getStatus(i.prev).collideOrder==t)return!0;let n=!1;for(;i!=null;){if(Mr.getInstance().getStatus(i).collideOrder==t){n=!0;break}if(i.item==r)break;i=i.next}return!n&&i.next!=null&&Mr.getInstance().getStatus(i.next).collideOrder==t?!0:n}search(t){let e=this.blockShape.clearanceUtils.getMaxTrackClearance(),r=t.buildBBox().extendOfSize(e),i=this.rtree.search(r),n=[];for(let a of i)n.push(a.model);let s=new Qu(n);return this.blockShape.blockOtherTrack(t,s)}search4Via(t){let e=this.blockShape.clearanceUtils.getMaxTrackClearance(),r=t.buildBBox().extendOfSize(e),i=this.rtree.search(r),n=[];for(let a of i)n.push(a.model);let s=new Qu(n);return this.blockShape.blockViaPoint4Shapes(t,s)}checkViaCollide4Tracks(t,e,r){this.blockShape.pair1.sycnRule1(t.item),this.blockShape.pair1.sycnRule2(t.item,!0);for(let i of e){let n=this.blockShape.pair2.sycnRule1(i),s=this.blockShape.clearanceUtils.getSafeClearance(this.blockShape.pair1.rule1,n,i,i.layerId);if(ne.eq(s,0))continue;if(uh.check(i.primitive,i.layerId,i,t.item,s).collide){r.add(t);return}}}};var Hne=class{constructor(t,e,r,i){this.clearanceUtils=new Kd;this.manager=fs.getInstance();this.rulePair1=new kb;this.rulePair2=new kb;this.fix=!1;this.shape=t,this.source=e,this.point=r,this.pointOnlyNoneDrc=i,this.rulePair1.sycnRule1(t),t instanceof Ct&&this.rulePair1.sycnRule2(t,!0)}getShapeSize(){return this.shape instanceof Ct?Math.max(this.shape.radius,this.shape.holeRadius):this.shape.width/2}getRes(){return this.inOutline(this.source,this.point)}checkOut(){let e=re.getInstance().getMaxSafe(),r=this.getShapeSize(),i=new _e;i.ext2(this.source).ext2(this.point);let n=i.ext7(r+e).build(),s=wt.searchOutline(n);for(let a of s)if(this.needFix1(a,this.source,this.point))return!0;return!1}inOutline(t,e){let i=re.getInstance().getMaxSafe(),n=this.getShapeSize(),s=0;do{this.fix=!1;let a=new _e;a.ext2(t).ext2(e);let l=a.ext7(n+i).build(),c=wt.searchOutline(l);for(let h of c)e=this.needFix(h,t,e);s++}while(this.fix&&s<20);return e}needFix1(t,e,r){if(!this.needCheck(t))return!1;let i=t.getMathGraphics();if(!i.isClose(.01))return!1;switch(t.type){case"Line":{if(this.shape instanceof Ct){this.rulePair2.sycnRule1(t);let l=this.inHull(r,this.rulePair1.rule1,this.rulePair2.rule1,t,t.layerId,this.shape.radius);if(l!=null||(l=this.inHull(r,this.rulePair1.rule2,this.rulePair2.rule1,t,t.layerId,this.shape.holeRadius),l!=null))return!0}else if(this.rulePair2.sycnRule1(t),this.inHull(r,this.rulePair1.rule1,this.rulePair2.rule1,t,t.layerId,this.shape.width/2)!=null)return!0;break}case"Partition":{let l=e,c=this.manager.getModelObstacle(t,1e-4,t.layerId);if(t.type=="Partition"&&this.shape.partition==t.globalIndex&&(jr.pointInPolyline(l,i)||(l=i.bbox().center())),c.outline.getPointInOutline(r,ls)!=null)return!0;break}}let n=i.asClose(),s=jr.pointInPolyline(e,n),a=jr.pointInPolyline(r,n);return t.type=="Partition"&&this.shape.partition==t.globalIndex&&a?!1:!this.pointOnlyNoneDrc&&s!=a}needFix(t,e,r){if(!this.needCheck(t))return r;let i=t.getMathGraphics();if(!i.isClose(.01))return r;switch(t.type){case"Line":{if(this.shape instanceof Ct){this.rulePair2.sycnRule1(t);let n=this.inHull(r,this.rulePair1.rule1,this.rulePair2.rule1,t,t.layerId,this.shape.radius);n!=null&&(r=this.getResult(n,e,r)),n=this.inHull(r,this.rulePair1.rule2,this.rulePair2.rule1,t,t.layerId,this.shape.holeRadius),n!=null&&(r=this.getResult(n,e,r))}else{this.rulePair2.sycnRule1(t);let n=this.inHull(r,this.rulePair1.rule1,this.rulePair2.rule1,t,t.layerId,this.shape.width/2);n!=null&&(r=this.getResult(n,e,r))}break}case"Partition":{let n=e,s=this.manager.getModelObstacle(t,1e-4,t.layerId);t.type=="Partition"&&this.shape.partition==t.globalIndex&&(jr.pointInPolyline(n,i)||(n=i.bbox().center()));let a=s.outline.getPointInOutline(r,ls);a!=null&&(r=this.getResult(a,n,r));break}}if(!this.fix){let n=i.asClose(),s=jr.pointInPolyline(e,n),a=jr.pointInPolyline(r,n);if(t.type=="Partition"&&this.shape.partition==t.globalIndex&&a)return r;if(!this.pointOnlyNoneDrc&&s!=a)return this.getResult(i,e,r)}return r}needCheck(t){switch(t.type){case"Line":return this.shape instanceof gt?(t.layerId==this.shape.layerId||t.layerId==11)&&t.net!=this.shape.net:(this.shape.isContains(t.layerId)||t.layerId==11)&&t.net!=this.shape.net;case"Partition":return!0}}inHull(t,e,r,i,n,s){let a=this.clearanceUtils.getSafeClearance(e,r,i,n);return ne.eq(a,0)?null:this.manager.getModelObstacle(i,a+s,n).outline.getPointInOutline(t,ls)}getResult(t,e,r){let i=new M(e,r),n=new Array;for(let s of t.primitives){if(s.bbox().isSeparated(i.bbox()))continue;let a=Pt(i,s);for(let l=0;l<a;l+=2){let c=new S(Ee[l],Ee[l+1]);n.push({pt:s,point:c})}}if(n.length>0){P0(n,i);let s=n[0],l=new er(s.pt,new M(r,r)).getLine();return this.fix=!0,l.start().equals1(r)?l.end():l.end().equals1(r)?l.start():r}else return r}};var x3t=Array();for(let o=-1;o<=1;o++)for(let t=-1;t<=1;t++)o==0&&t==0||x3t.push(new S(o,t).normalize());var SA=class{constructor(t,e,r,i,n=new Set){this.manager=fs.getInstance();this.clearanceUtils=new Kd;this.block=new ms;this.points=new Array;this.found=new Map;this.obstacles=new Set;this.success=!0;this.timeout=i,this.via=t.item,this.command=e,this.obstacles=n,this.directFilter=r,this.directFilter.awaitShove.has(t)&&(this.directFilter.awaitShove.delete(t),this.directFilter.awaitingVias.add(t))}init(t,e){let r=gj(t);for(let i of r)e!=null&&i.intersection(this.found.get(i.dir),e),this.points.push(i)}getDistination(t){let e=new Array;for(let i of this.points)i.valid&&(e.push(i),this.found.set(i.dir,new Ta));let r=null;for(;performance.now()<this.timeout;){r!=null&&e.push(r),e=e.sort((n,s)=>n.dis-s.dis);let i=new Array;for(let n=0;n<e.length;n++){let s=e[n];if(this.search(s),!s.needContinue&&s.valid){r=s;break}else s.valid&&i.push(s)}if(e=i,e.length==0)return r!=null?(this.success=!0,r):(this.success=!1,t)}return this.success=!1,t}offset4Points(t,e,r){let i=this.get4Points(t,e);this.change(i,r)}offset(){let t=this.getOffset();this.change(t,[])}get4Points(t,e){for(let i of e)this.points.push(i);let r=this.getDistination(t);return this.sycnShoveInfo(r),r.point}sycnShoveInfo(t){if(this.success&&t!=null)for(let e of t.pushItems)e instanceof gt?this.directFilter.awaitShove.add(e):this.directFilter.awaitShove.add(Si.getInstance().getNode(e))}getOffset(){let t=ps.getInstance().getFirstPosition(this.via),e=this.inOutline(t,this.via.center),r=new U4(e,S.ORIGIN,0,!0);if(this.search(r),!r.needContinue)return this.success=!0,r.point;this.init(r.point);let i=this.getDistination(r);return this.sycnShoveInfo(i),i.point}checkShove(t){let e=this.block.blockViaPoint(t);for(let r of e){let i=r.obstacle;i instanceof Ct&&this.directFilter.canShoveViaModel(i)&&this.directFilter.awaitShove.add(Si.getInstance().getViaNode(i))}}change(t,e){nF(this.via,t,this.command,e)}inHull(t,e,r,i,n,s){let a=this.clearanceUtils.getSafeClearance(e,r,i,n);if(ne.eq(a,0))return!1;let l=s?this.via.holeRadius:this.via.radius,h=this.manager.getModelObstacle(i,a+l,n).outline.getPointInOutline(t.point,ls);return h!=null?(t.setObstacle(this.found.get(t.dir),h,!0),!0):!1}inShoveHull(t,e,r,i,n,s){let a=this.clearanceUtils.getSafeClearance(e,r,i,n);if(ne.eq(a,0))return!1;let l=s?this.via.holeRadius:this.via.radius,h=this.manager.getModelObstacle(i,a+l,n).outline.getPointInOutline(t.point,ls);return h!=null&&this.isObstacle(i,t)?(t.setObstacle(this.found.get(t.dir),h,!0),!0):!1}search(t){t.needContinue=!1;let e=t.point,i=re.getInstance().getMaxSafe(),n=Math.max(this.via.radius,this.via.holeRadius),s=e.bbox().extendOfSize(n+i),a=wt.search1(s),l=ha(this.via),c=ha(this.via);c.shapeType=12;for(let h of a.tracks)if(this.via.isContains(h.layerId)&&h.net!=this.via.net){let u=ha(h);if(this.inShoveHull(t,l,u,h,h.layerId,!1)||this.inShoveHull(t,c,u,h,h.layerId,!0))return}for(let h of a.pads)if(h.net!=this.via.net&&(this.via.isContains(h.layerId)||h.layerId==12)){let u=ha(h),d=ha(h);d.shapeType=12;let p=h.layerId==12,m=p?Ze.getInstance().getAllCopperLayerIds():[h.layerId];for(let g of m)if(!h.isUnuseLayer(g)&&this.via.isContains(g)&&(this.inHull(t,l,u,h,g,!1)||p&&this.inHull(t,l,d,h,12,!1)))return;if(p){for(let g of m)if(!h.isUnuseLayer(g)&&this.via.isContains(g)&&this.inHull(t,c,u,h,g,!0))return}}for(let h of a.vias){let u=ha(h),d=ha(h);if(d.shapeType=12,h.net!=this.via.net&&!h.isSeparated(this.via)&&(!h.isUnuseLayer(this.via.startLayer)&&(this.inShoveHull(t,l,u,h,this.via.startLayer,!1)||this.inShoveHull(t,l,d,h,12,!1))||h.layerId==12&&this.inShoveHull(t,c,u,h,12,!0)))return}for(let h of a.profiles)switch(h.type){case"TearDrop":case"Fill Region":{let d=h.net!=this.via.net,p=h.component;if(p instanceof Zi&&p.isBridgingCopper){let m=p.networkList;m.length==0&&this.via.net==""||m.length==1&&this.via.net==m[0]?d=!1:d=!0}if(this.via.isContains(h.layerId)&&d){let m=ha(h);if(this.inHull(t,l,m,h,h.layerId,!1)||this.inHull(t,c,m,h,h.layerId,!0))return}break}case"Slot Region":{let d=ha(h);if(this.inHull(t,l,d,h,h.layerId,!1)||this.inHull(t,l,d,h,h.layerId,!0))return;break}case"Line":{if((this.via.isContains(h.layerId)||h.layerId==11)&&h.net!=this.via.net){let d=ha(h);if(this.inHull(t,l,d,h,h.layerId,!1)||this.inHull(t,l,d,h,h.layerId,!0))return}break}case"Board Outline":{let d=ha(h);if(this.inHull(t,l,d,h,h.layerId,!1)){let p=ps.getInstance().getFirstPosition(this.via),m=this.inOutline(p,t.point);t.point.equals1(m)||(t.valid=!1);return}if(this.inHull(t,l,d,h,h.layerId,!0)){let p=ps.getInstance().getFirstPosition(this.via),m=this.inOutline(p,t.point);t.point.equals1(m)||(t.valid=!1);return}break}case"Prohibited Region":{if(this.via.isContains(h.layerId)||h.layerId==12){let d=h.component,p=1e-4;if(d.track){let g=this.manager.getModelObstacle(h,n+p,h.layerId).outline.getPointInOutline(e,ls);if(g!=null){t.setObstacle(this.found.get(t.dir),g,!0);return}}}break}case"Partition":{let p=this.manager.getModelObstacle(h,1e-4,h.layerId).outline.getPointInOutline(t.point,ls);if(p!=null){t.setObstacle(this.found.get(t.dir),p,!0);let m=ps.getInstance().getFirstPosition(this.via),g=this.inOutline(m,t.point);t.point.equals1(g)||(t.valid=!1);return}break}}for(let h of a.imageTexts)if(this.via.isContains(h.layerId)){let u=ha(h);if(this.inHull(t,l,u,h,h.layerId,!1)||this.inHull(t,l,u,h,h.layerId,!0))return}return null}isObstacle(t,e){var r,i,n,s;if(t instanceof gt){let a=At.getInstance().getNode(t);if(this.obstacles.has(a.parent))return!0;if(this.directFilter.canShove(t)&&!t.locked&&!xs(t)&&t.getParent()==null){let l=this.getListNodePushDirect(a);if(l==null||e.pushItems.has(t))return e.pushItems.add(t),!1;{let c=Mm(t.primitive,e.point,(i=(r=a.prev)==null?void 0:r.item)==null?void 0:i.primitive,(s=(n=a.next)==null?void 0:n.item)==null?void 0:s.primitive);if(c!=null&&c==l)return!0;let h=Et(t.primitive),u=l==ae.CCW?new S(-h.y,h.x):new S(h.y,-h.x);return e.dir.dot(u)>0?(e.pushItems.add(t),!1):!0}}}else if(this.directFilter.canShoveViaModel(t)){let a=ps.getInstance().getFirstPosition(t),l=ps.getInstance().getFirstPosition(this.via),c=t.center.sub(a).normalize(),h=e.dir;if(c.dot(h)>.99){let d=a.sub(l);return h.dot(d)>0?(e.pushItems.add(t),!1):!0}}return!0}getListNodePushDirect(t){return Mr.getInstance().getStatus(t).pushDirect}inOutline(t,e){return new Hne(this.via,t,e,!1).getRes()}};var xj=class{constructor(t,e){this.blockShape=new ms;this.cnt=0;this.inputLevel="WEAK";this.isWire=!1;this.interrupt=!1;this.lists=t,this.command=new Lr("shove"),this.timeout=e,this.endTime=performance.now()+this.timeout}initShoveEnvironment(){Ou.getInstance().clear(),oi.getInstance().update(),PS.getInstance().clear()}shoveMain(){if(this.initShoveEnvironment(),this.shoveIterators(this.lists),!(performance.now()>this.endTime||this.interrupt)){if(this.inputLevel=="SUPER"||this.inputLevel=="STRONG"){if(this.isWire&&this.inputLevel=="SUPER"&&this.hasDiffPairAndNotChange())return;let t=new Array;for(let i of this.lists)i instanceof Fn&&t.push(i);let r=new kI(t,this.inputLevel,this.direct,this.endTime).optimize();this.add2Commands(this.command,r)}}}hasDiffPairAndNotChange(){let t=new Set;for(let e of this.lists)if(e instanceof Fn){let r=e.listIterator();for(;r.hasNext();){let n=r.next(),s=Mr.getInstance().getStatus(n);if(s.isInput&&!s.notChange)return!1}let i=e.getFirst();t.add(i.net)}return this.blockShape.clearanceUtils.hasDiffPair(t)}shoveIterators(t){let e=this.aroundSolid(t);this.add2Commands(this.command,e)}isChangeViaNode(t){return!t.isSource}aroundSolid(t){let e=new Lr("aroundSolid"),r=0,i=Array.from(t),n=this.getAwaitShoveTracks(t);wt.useShoveTree=!1;do{let s=new Lr;this.setFilter4Solid(i);let a=this.initAroundPath(i);xe.addAllSet(a.awaitShove,n),n.clear();let{success:l,command:c}=this.aroundObstacles(i,a);if(l||r>=2?(this.add2Commands(s,c),this.addAroundCommand(s)):(c.undo(),Ou.getInstance().undo()),wt.pushFilter.setNet(null,null),oi.getInstance().update(),this.add2Commands(e,s),r++,this.filterAwaitShoveItem(a.awaitShove),a.awaitShove.size==0&&l||r>=8)break;xe.addAllSet(n,a.awaitShove),i=i.reverse()}while(this.endTime>performance.now()&&!this.interrupt);return e}getAwaitShoveTracks(t){let e=new Set;for(let r of t)if(r instanceof Fn){let i=this.getChangeTracks(r);xe.addAllSet(e,i),r.viaNode.prev!=null&&this.isChangeViaNode(r.viaNode.prev)&&e.add(r.viaNode.prev),r.viaNode.next!=null&&this.isChangeViaNode(r.viaNode.next)&&e.add(r.viaNode.next)}else e.add(r);return e}getChangeTracks(t){let e=t.getFirstNode(),r=t.getLastNode();for(;e!=null&&!this.isChangeNode(e);)e=e.next;if(e==null)return[];for(;r!=null&&!(this.isChangeNode(r)||(r=r.prev,e==r)););let i=e,n=[];for(;i!=null&&(n.push(i.item),i!=r);)i=i.next;return n}isChangeNode(t){let e=Mr.getInstance().getStatus(t);return!e.checkDRC&&(e.isInput||!e.notChange)}filterAwaitShoveItem(t){let e=Array.from(t);for(let r of e)if(r instanceof gt){let i=At.getInstance().getNode(r);i!=null&&i.ignore&&t.delete(r)}}setFilter4Solid(t){wt.setPushFilter(),wt.pushFilter.setAroundMode();for(let e of t)wt.pushFilter.addWaitList(e)}getNode(t){let e=At.getInstance().getNode(t);return e!=null&&e.ignore||e==null&&(new su(t).generateList(),e=At.getInstance().getNode(t)),e}aroundObstacles(t,e){oi.getInstance().update();let r=new SS(this.endTime-performance.now());r.direct=this.direct;let i=new Lr("aroundObstacles"),n=!0,s=Array.from(t);for(e.completes.clear();s.length>0&&!this.interrupt&&this.endTime>performance.now();){e.awaitingVias.clear();let a=s.shift(),l=new Lr;if(oi.getInstance().update(),wt.pushFilter.addAroundList(a),a instanceof Fn){e.completes.add(a);let c=this.getAroundTracks(a,e,l);wt.pushFilter.setNet(a.getFirst().net,new Set(c));let h;try{h=this.around(c,a,r,l,e)}catch(u){console.log(u),r.success=!1}if(wt.pushFilter.setNet(null,null),!r.inputEndpointCanModify&&!r.success){if(l.undo(),Ou.getInstance().undo(),this.isWire&&this.lists.includes(a)){let u=a.getLastNode(),d=Mr.getInstance().getStatus(u);d.checkDRC=!1}this.add2AwaitShove(c,e),l=new Lr}else{if(r.inputEndpointCanModify&&!r.success&&a.viaNode.next!=null&&h.length>0){this.add2AwaitShove([h[h.length-1]],e);for(let d of e.awaitingVias)e.awaitShove.add(d)}this.addAroundCommand(l);let u=0;for(;u<s.length&&h!=null&&h.length>0;){let d=s[u];if(d instanceof Fn){new ES(d.toArray()).getShoveTracks(h,e);break}u++}}wt.pushFilter.addAroundList(a)}else if(e.awaitShove.has(a)){let c=!1;for(let[h,u]of a.connectTrack)this.getViaCollideTracks(h,u,e,l).length>0&&(c=!0);if(!c){let h=a.item,u=new SA(a,l,e,this.endTime,e.completes);u.offset(),wt.pushFilter.addAroundTracks(a),u.success?(oi.getInstance().deleteShoveTree(h),oi.getInstance().addShoveTree(a.item),u.checkShove(a.item),this.updateNextOrder(a,s,e)):(l.undo(),l=new Lr,e.awaitShove.add(a))}}this.add2Commands(i,l),Gr.inputClear()}return{success:n,command:i}}add2AwaitShove(t,e,r=null){for(let i of t)!i.isEmpty&&!this.getNode(i).ignore?(e.awaitShove.add(i),r!=null&&r.add(i)):oi.getInstance().deleteShoveTree(i);for(let i of e.awaitingVias)e.awaitShove.add(i)}updateNextOrder(t,e,r){try{if(e.length>0){let i=0;for(;i<e.length&&t!=null;){let n=e[i];if(n instanceof Fn){let s=new ES(n.toArray());t instanceof as?s.getViaShoveTracks(t.item,r.awaitShove):t.length>0&&s.getShoveTracks(t,r);break}i++}}}catch(i){this.interrupt=!0,console.log(i)}}getViaCollideTracks(t,e,r,i){let n=new Array;if(e){let a=t.getFirstNode();for(;a!=null;){if(r.awaitShove.has(a.item))n.push(a);else{let l=a.item;if(this.blockShape.blockTrackOnlyTrack(l,l.primitive,!0).length>0)n.push(a);else break}a=a.next}}else{let a=t.getLastNode();for(;a!=null;){if(r.awaitShove.has(a.item))n.unshift(a);else{let l=a.item;if(this.blockShape.blockTrackOnlyTrack(l,l.primitive,!0).length>0)n.unshift(a);else break}a=a.prev}}let s=new Array;if(n.length>0){for(let l of n)Mr.getInstance().getStatus(l).change(),s.push(l.item);let a=new CS(s,e?t.viaNode.prev.item:t.viaNode.next.item,i,!e,this.endTime,this.isWire,r);a.offset(),a.getResult()}return s}addAroundCommand(t){let e=Ou.getInstance().asyn();e.size>0&&t.addCommand(new rF(e))}add2Commands(t,e){e.length>0&&t.addCommand(e)}getOptimizeLevel(t){switch(this.inputLevel){case"SUPER":case"STRONG":case"WEAK":return"WEAK";default:return this.inputLevel}}around(t,e,r,i,n){if(t.length==0)return[];if(wt.pushFilter.addAroundTracks(t),t.length>0){let s=this.getIgnoreTracks(e,t);wt.pushFilter.deleteAroundTracks(s)}return r.level=this.getOptimizeLevel(e),r.isWire=this.isWire,r.find(t,i,n)}getAroundTracks(t,e,r){let i=t.getFirstNode(),n=t.getLastNode();for(;i!=null&&!(this.isChangeNode(i)||e.awaitShove.has(i.item)||(i=i.next,i==n)););for(;n!=null&&!(this.isChangeNode(n)||e.awaitShove.has(n.item)||(n=n.prev,i==n)););let s=i,a=[],l=!1;for(;s!=null&&(e.awaitShove.has(s.item)&&(l=!0),a.push(s.item),s!=n);)s=s.next;if(l){i.prev==null&&this.checkPath(t,a,e,r,!0);let c=!1;return this.getNode(a[a.length-1]).next==null&&(c=this.checkPath(t,a,e,r,!1)),c||this.checkReversePush(t,a,e,r,!1),a}else return[]}getIgnoreTracks(t,e){let r=new Set(e),i=new Array,n=t.listIterator();for(;n.hasNext();){let s=n.next();r.has(s.item)||i.push(s.item)}return i}initAroundPath(t){let e=new N3;for(let r of t)r instanceof as?e.canShoveVia.add(r):(e.canShovePath.add(r),r.viaNode.prev!=null&&e.canShoveVia.add(r.viaNode.prev),r.viaNode.next!=null&&e.canShoveVia.add(r.viaNode.next));return e}checkPath(t,e,r,i,n){let s=n?t.viaNode.prev:t.viaNode.next,a=en.exsitSpaceConstraint(e,!n);if(this.viaOffset(s,e,r,i,n,a))return!0;let c=(n?t.getFirstNode():t.getLastNode()).item,h=this.blockShape.blockTrackPoint(c,n);if(h.length>0||a){if(this.canOffset(t,n)){let u=new MI(e,i,!n,this.endTime,this.isWire,r);u.offset(),u.getResult()}else this.removePointRepearLine(h,e,r,n);return!0}else return!1}checkReversePush(t,e,r,i,n){let s=n?t.getFirstNode():t.getLastNode();if(Mr.getInstance().getStatus(s).isInput&&this.isWire&&this.lists.length>1){let l=n?e[e.length-1]:e[0],c=this.blockShape.blockTrackInput(l,new Set);for(let h of c){let u=h.obstacle;if(u instanceof gt&&Mr.getInstance().getStatus(this.getNode(u)).isReversePush){if(this.canOffset(t,n)){this.get2End(e,!n);let p=new MI(e,i,!n,this.endTime,this.isWire,r);p.offset(),p.getResult()}break}}}}get2End(t,e){if(e){let r=this.getNode(t[t.length-1]);for(r=r.next;r!=null;)t.push(r.item),r=r.next}else{let r=this.getNode(t[0]);for(r=r.prev;r!=null;)t.unshift(r.item),r=r.prev}}viaOffset(t,e,r,i,n,s){if(this.canOffsetEndVia(t,r)){let l=this.blockShape.collideVia(t.item).length>0;if(!l){let c=n?e[0]:e[e.length-1];l=this.blockShape.blockTrackPoint(c,n).length>0,l||(l=n?!c.start.equals1(t.item.center):!c.end.equals1(t.item.center))}if(l||s){let c=new CS(e,t.item,i,!n,this.endTime,this.isWire,r);c.offset(),c.getResult()}else r.awaitShove.has(t)&&(r.awaitShove.delete(t),r.awaitingVias.add(t));return!0}return!1}canOffsetEndVia(t,e){return t!=null&&(this.canOffsetVia(t)||e.awaitShove.has(t))}canOffsetVia(t){return t!=null&&!t.item.locked&&!xs(t.item)&&t.item.getParent()==null&&this.isChangeViaNode(t)}canOffset(t,e=!1){if(t.size()>0){if(e){if(t.otherNode.prev==null&&(t.viaNode.prev==null||t.viaNode.prev!=null&&this.isChangeViaNode(t.viaNode.prev)))return!0}else if((t.otherNode.next==null||this.isWire&&this.lists.includes(t))&&(t.viaNode.next==null||t.viaNode.next!=null&&this.isChangeViaNode(t.viaNode.next)))return!0}return!1}removePointRepearLine(t,e,r,i){for(let s of t)if(s instanceof gt){let a=this.getNode(s);if(a.ignore||!r.canShovePath.has(a.parent))continue;wt.pushFilter.deleteAroundList(a.parent),r.awaitShove.add(s)}let n=new aF(e,!i);for(let s of n.used){if(!r.canShovePath.has(s))continue;wt.pushFilter.deleteAroundList(s);let a=this.getChangeTracks(s);for(let l of a)this.getNode(l).ignore||r.awaitShove.add(l)}}};var By=class extends wI{constructor(e=300){super();this.hasToggleStyle=!1;this.level="NONE";this.isWire=!1;this.timeout=e}run(e){Ou.getInstance().clear(),oi.getInstance().update();let r=this.getLists2(e,e.command),i=new xj(r,this.timeout);i.inputLevel=this.level,i.isWire=this.isWire,i.direct=e.direct,i.shoveMain(),i.command.length>0&&e.command.addCommand(i.command),wt.clearParition(),this.hasToggleStyle&&(yg(),this.hasToggleStyle=!1)}run1(e,r,i){this.level="STRONG",Ou.getInstance().clear(),oi.getInstance().update();let n=e,s=new xj(n,this.timeout);s.inputLevel=this.level,s.isWire=this.isWire,s.direct=i,s.shoveMain(),s.command.length>0&&r.addCommand(s.command),wt.clearParition(),this.hasToggleStyle&&(yg(),this.hasToggleStyle=!1)}getLists2(e,r){let i=[],n=wt.filter;wt.setPushFilter(),wt.pushFilter.setAroundMode();for(let[s,a]of e.wireMap){if(s.drawing==0&&a.size()>0){let l=this.pointInObstacle,c=this.backFix(a,r);if(c&&!this.hasToggleStyle&&(gg("freeArc"),c=this.backFix(a,r),this.pointInObstacle=l||c,this.hasToggleStyle=!0),c){let h=this.getFirstInputStatus(a).item,u=new Zr,d=u.createList(),p=u.createTrack(h.layerId,h.start,h.start,h.width,h.net,e.command,h.getGroupID());u.addList(p,d,e.command),d.replace(this.getFirstInputStatus(a),a.getLastNode()),e.command.addCommand(new mi(d));continue}i.push(a)}if(a.size()==0&&a.viaNode.prev!=null){let l=!1;if(a.viaNode.prev.connectTrack.size>0)for(let[c]of a.viaNode.prev.connectTrack)c.size()>0&&(i.push(c),l=!0);l||i.push(a.viaNode.prev)}}return wt.filter=n,i}};var JCe=class{constructor(t){this.clearanceUtils=new Kd;this.manager=fs.getInstance();this.map=new Map;this.ccw=new Array;this.cw=new Array;this.inner=new Array;this.rtree=new rT(15);this.path=t;let e=t.iterator();for(;e.hasNext();)this.rtree.insert(new Lp(e.next()))}addResult(t){var c,h,u,d;let e=t.source,r=t.obstacle,i=r.start,n=r.end,s=t.point,a=At.getInstance().getListNode(r);if(this.inSameListHull(t,e,r,s)){this.addInner(t);return}let l=Mm(r.primitive,s,(h=(c=a.prev)==null?void 0:c.item)==null?void 0:h.primitive,(d=(u=a.next)==null?void 0:u.item)==null?void 0:d.primitive);if(l==ae.CCW)this.ccw.push(t);else if(l==ae.CW)this.cw.push(t);else{let p=t.clearance,m=e.width/2+r.width/2,g=p+m,y=s.distance2(i)<s.distance2(n)?i:n,b=this.pointHull(y,g);jr.inPolyline(s,b)&&(this.ccw.push(t),this.cw.push(t))}}pointHull(t,e){return Wa.OctagonalHull1(t,e)}addInner(t){this.inner.push(t)}addHullMap(t,e){this.map.set(t,e)}inSameListHull(t,e,r,i,n){let s=this.clearanceUtils.getMaxTrackClearance(),a=i.bbox().extendOfSize(s+e.width/2),l=this.rtree.search(a),c=!1;for(let h of l){let u=h.model;if(u.net==r.net&&u!=r){if(ne.eq(n,0))continue;if(this.getHull(t,e,u).pointInHull(i,ls)){c=!0;break}}}return c}getHull(t,e,r){let i=this.map.get(r);if(i==null){let n=t.clearance+e.width/2;i=this.manager.getModelObstacle(r,n,r.layerId).outline,this.addHullMap(r,i)}return i}sort(t,e){t.length>0&&Er(t,(r,i)=>e.get(r)-e.get(i))}getNext(t){let e=this.ccw.indexOf(t),r=this.getNext4Index(this.ccw,e);return r!=null||(e=this.cw.indexOf(t),r=this.getNext4Index(this.cw,e),r!=null)||(e=this.inner.indexOf(t),r=this.getNext4Index(this.inner,e),r!=null)?r:null}getGroup(t){return this.ccw.includes(t)?this.ccw:this.cw.includes(t)?this.cw:this.inner.includes(t)?this.inner:null}getNext4Index(t,e){if(e>=0){let r=e+1;if(r<t.length)return t[r]}return null}},hF=class extends cR{constructor(){super(...arguments);this.map=new Map;this.clearanceUtils=new Kd;this.block=new ms;this.inters=new Set}blockTracks(e,r=!1){if(e==null||e.length==0)return[];wt.pushFilter.setNetAndLayerId(e[0].net,e[0].layerId);let i=this.clearanceUtils.getMaxTrackClearance(),n=new Array,a=At.getInstance().getListNode(e[0]).parent,l=new Set;e=r?e.reverse():e;for(let g of e){let y=r?g.primitive.reverse():g.primitive,b=this.getBBox4Primitive(g,y,i),P=this.search(b);for(let v of l)P.vias.delete(v);let T=new Array,I=this.block.blockTrack4Shapes(g,y,!0,P);for(let v of I){let D=v.obstacle,w=v.block,F=v.clearance;if(D instanceof gt)if(v.isSameNet)At.getInstance().getListNode(D).parent!=a&&!D.start.equals(g.start)&&!D.start.equals(g.end)&&!D.end.equals(g.start)&&!D.end.equals(g.end)&&T.push(v);else{this.inters.add(D);let H=this.getRes(D),z=v.block.collideInfo,V=z.shape.getOutline(ls);H.addHullMap(D,w.obstalce.outline);let W=!1,L=y.end();if(w.obstalce.outline.pointInHull(y.start(),ls)){let N=new el(g,y.start(),D,F,!1,v.layer1,v.layer2,z);T.push(N),H.addInner(N);let U=y.bbox().extendOfSize(.1),B=new Ta;for(let Y of V.primitives){let X=Y.bbox();if(!U.isIntersect(X))continue;let K=Pt(y,Y);for(let J=0;J<K;J+=2){let se=new S(Ee[J],Ee[J+1]);B.add(se)}}let G=this.sortInters(B,y);if(G.length>0)for(let Y of G){let X=new el(g,Y,D,F,!1,v.layer1,v.layer2,z);T.push(X),H.addResult(X)}}else for(let N of z.inters)if(!W&&N.equals1(L)&&(W=!0),z.shape.pointInHull(N,ls)){let U=new el(g,N,D,F,!1,v.layer1,v.layer2,z);T.push(U),H.addInner(U)}else{let U=new el(g,N,D,F,!1,v.layer1,v.layer2,z);T.push(U),H.addResult(U)}if(L){if(jr.inEdge4Polyline(L,V,.006)){let N=new el(g,L,D,F,!1,v.layer1,v.layer2,z);T.push(N),H.addResult(N)}else if(w.obstalce.outline.pointInHull(L,ls)){let N=new el(g,L,D,F,!1,v.layer1,v.layer2,z);T.push(N),H.addInner(N)}}}else D instanceof Ct&&(T.push(v),l.add(D))}let C=y.start();Er(T,(v,D)=>{if(v.point.equals1(D.point)){if(v.isSameNet&&!D.isSameNet)return-1;if(!v.isSameNet&&D.isSameNet)return 1}return v.point.distance2(C)-D.point.distance2(C)},0,T.length);let E=new Map,O=new Map,_=0,x=0;for(let v of T){let D=v.obstacle;E.get(D)==null&&E.set(D,_++),O.set(v,x),x++}Er(T,(v,D)=>{let w=E.get(v.obstacle)-E.get(D.obstacle);return w==0?O.get(v)-O.get(D):w},0,T.length),xe.addAll(n,T)}let c=new Map;for(let g=0;g<n.length;g++)c.set(n[g],g);for(let[,g]of this.map)g.sort(g.ccw,c),g.sort(g.cw,c),g.sort(g.inner,c);let h=new Set,u=new Ta,d=new Set;for(let g of n){if(d.has(g)||h.has(g))continue;let y=g.obstacle;if(!(y instanceof gt)){h.add(g);continue}let b=this.getRes(y),P=b.getGroup(g),T=P==b.inner;if(P==null)h.add(g);else if(T){let I=c.get(g);h.add(g);let C=null;for(let E=I+1;E<n.length;E++){let O=n[E],_=O.obstacle;if(_ instanceof gt&&this.getRes(_)==b&&!P.includes(O)){C=O;break}}if(C!=null){let E=b.getGroup(C);for(let O of b.inner)d.add(O);if(E==b.ccw)for(let O of b.ccw)d.add(O);else for(let O of b.cw)d.add(O)}}else{let I=P.indexOf(g),C=new Set;for(;I<P.length;I++){let _=P[I];C.add(_.obstacle);let x=P[I+1];if(x!=null){h.add(_),h.add(x);let v=c.get(_),D=c.get(x);for(let w=v+1;w<D;w++){let F=n[w],H=F.obstacle;H instanceof gt&&this.getRes(H)==b&&d.add(F)}}}if(!T)for(let _ of b.inner)d.add(_),C.add(_.obstacle);let E=P[P.length-1];h.add(E);let O=c.get(E);for(let _=O+1;_<n.length;_++){let x=n[_],v=x.obstacle;v instanceof gt&&this.getRes(v)==b&&C.has(v)&&d.add(x)}}}let p=new Array,m=new Lb(5);e:for(let g of n)if(h.has(g)){let y=m.search(g.point.bbox().extendOfSize(1e-6));for(let b of y)if(b.point.equals1(g.point))continue e;this.inters.delete(g.obstacle),p.push(g),m.insert(g)}return wt.pushFilter.setNet(null,null),p}getBBox4Primitive(e,r,i){return r instanceof M?Lc.trackToOctagon(r.start(),r.end(),e.width+i*2):r.bbox().extendOfSize(i+e.width/2)}search(e){return wt.searchTrackAndVia(e)}getRes(e){let i=At.getInstance().getListNode(e).parent,n=this.map.get(i);return n==null&&(n=new JCe(i),this.map.set(i,n)),n}};var Rj=class extends hF{constructor(t,e){super(),this.rtree=t,this.filter=e}search(t){let e=this.rtree.search(t),r=new Qu([]);for(let i of e)this.filter!=null?this.filter.isValid(i.model)&&r.addModel(i.model):r.addModel(i.model);return r}};var Wne=class extends SS{constructor(){super(...arguments);this.rtree=new r0(10)}init(e){for(let r of e)this.rtree.insert(new Lp(r));return this}removeSelf(e,r,i){if(e.length!=0)return this.init(e),this.find(e,r,i)}search(e,r,i){let n=this.blockShape.clearanceUtils.getMaxTrackClearance(),s=r.bbox().extendOfSize(n+e.width/2),a=this.rtree.search(s),l=[];for(let h of a)l.push(h.model);let c=new Qu(l);return this.blockShape.blockTrack4Shapes(e,r,i,c)}};var QCe=class{constructor(t){this.collideIndexs=new Array;this.id=t}},zne=class{constructor(t){this.collideIndexs=new Array;this.listIndex=-1;this.groupId=-1;this.track=t}},eSe=class{constructor(){this.start=null;this.end=null;this.group=0}isIntersection(t){let e=Math.min(this.start,this.end),r=Math.max(this.start,this.end),i=Math.min(t.start,t.end),n=Math.max(t.start,t.end),s=Math.max(e,i),a=Math.min(r,n);return s<=a+1}merge(t){let e=Math.min(this.start,this.end,t.start,t.end),r=Math.max(this.start,this.end,t.start,t.end);this.start=e,this.end=r,t.start=e,t.end=r}},PR=class{constructor(){this.tracks=new Array;this.list=null;this.node=new eSe}isIntersection(t){return!!(t.list==this.list&&this.node.isIntersection(t.node))}merge(t){this.node.merge(t.node)}resetOrder(t,e){let r=this.list.listIterator(),i=0;for(;r.hasNext();){let n=r.next();i>=this.node.start&&i<=this.node.end&&(e.add(n.item),Mr.getInstance().setOrder(n,t)),i++}}has(t){let e=this.list.listIterator(),r=0,i=!1;for(;e.hasNext();){let n=e.next();if(r>=this.node.start&&r<=this.node.end&&(i=Mr.getInstance().getStatus(n).collideOrder==t),i)break;r++}return i}},l6=class{constructor(){this.map=new Map;this.symbolsMap=new Map;this.collides=new Array;this.groups=new Array;this.indexs=new Array;this.symbols=new Array;this.trackSortMap=new Map;this.listSortMap=new Map;this.resetOrder=!0;this.cnt=0}addTrack(t,e){let i=this.getNode(t).parent,n=this.map.get(i),s=this.symbolsMap.get(i);n==null&&(n=this.cnt++,this.map.set(i,n)),s==null?s=1:s*=-1,this.symbolsMap.set(i,s);let a=this.groups.length;return this.collides.push(t),this.groups.push(n),this.indexs.push(a),this.symbols.push(s),!0}addVia(t,e){this.symbolsMap.set(t,0);let r=this.groups.length;return this.collides.push(t),this.groups.push(-1),this.indexs.push(r),this.symbols.push(0),!0}getNode(t){return At.getInstance().getListNode(t)}getResult(t=0){this.sortTrack();let e=this.group(),r=new Map,i=new Set;for(let n of e){let s=new Array,a=new Array;for(let d of n.collideIndexs){if(i.has(d))continue;let p=this.collides[d];if(p instanceof gt){let m=this.trackSortMap.get(p);s.push(m),xe.addAllSet(i,m.collideIndexs)}else{let m=Si.getInstance().getViaNode(p);i.add(d),a.push(m)}}if(s.length==0){for(let d of a)r.set(t,d),t++;continue}Er(s,(d,p)=>d.listIndex-p.listIndex);let l=s[0].track,c=s[s.length-1].track,h=this.getNode(l);r.set(t,h.parent);let u=!1;for(;h!=null&&(Mr.getInstance().getStatus(h).collideOrder==-1&&(h.item.locked||xs(h.item)||h.item.getParent()!=null?u&&(t++,r.set(t,h.parent),u=!1):(Mr.getInstance().setOrder(h,t),u=!0)),h.item!=c);)h=h.next;u?t++:r.delete(t);for(let d of a)r.set(t,d),t++}return r}getResult1(t=0){this.sortTrack();let e=this.group(),r=new Map,i=new Set;for(let n of e){let s=new Array,a=new Array;for(let p of n.collideIndexs){if(i.has(p))continue;let m=this.collides[p];if(m instanceof gt){let g=this.trackSortMap.get(m);s.push(g),xe.addAllSet(i,g.collideIndexs)}else{let g=Si.getInstance().getViaNode(m);i.add(p),a.push(g)}}if(s.length==0){for(let p of a)r.set(t,p),t++;continue}Er(s,(p,m)=>p.listIndex-m.listIndex);let l=s[0].track,c=s[s.length-1].track,h=this.getNode(l),u=new PR;u.node.start=s[0].listIndex,u.node.end=s[s.length-1].listIndex,u.list=h.parent,r.set(t,u);let d=!1;for(;h!=null&&(Mr.getInstance().getStatus(h).collideOrder==-1&&(h.item.locked||xs(h.item)||h.item.getParent()!=null?d?(u.node.end=this.trackSortMap.get(u.tracks[u.tracks.length-1]).listIndex,t++,d=!1,u=new PR,u.node.start=this.trackSortMap.get(h.item).listIndex,u.node.end=s[s.length-1].listIndex,u.list=h.parent,r.set(t,u)):u.node.start=this.trackSortMap.get(h.item).listIndex:(d||(u.node.start=this.trackSortMap.get(h.item).listIndex),u.tracks.push(h.item),d=!0)),h.item!=c);)h=h.next;d?t++:r.delete(t);for(let p of a)r.set(t,p),t++}return r}group(){let t=new Array,e=0,r=new Array,i=Array.from(this.indexs);for(;i.length>0;){let s=i.shift(),a=this.groups[s],l=this.symbols[s],c=new QCe(a);if(c.collideIndexs.push(s),r.push(c),e+=l,e==0){let h=new Map;for(let d of r){let p=h.get(d.id);p==null?h.set(d.id,d):xe.addAll(p.collideIndexs,d.collideIndexs)}let u=new Array;for(let[,d]of h)u.push(d);u=this.mergePath(u),this.removeMidCollides(u,i),t.push(u),r=new Array}}r.length>0&&(r=this.mergePath(r),t.push(r));let n=new Array;for(let s of t)for(let a of s)n.push(a);return n=this.mergePath(n),n}sortTrack(){let t=this.indexs.length;for(let e=0;e<t;e++){let r=this.indexs[e],i=this.collides[r];if(i instanceof gt){let n=this.trackSortMap.get(i);n==null&&(n=new zne(i),this.trackSortMap.set(i,n)),n.collideIndexs.push(r)}}for(let[e,r]of this.map){let i=e.listIterator(),n=0;for(;i.hasNext();){let s=i.next();this.resetOrder&&Mr.getInstance().setOrder(s,-1);let a=this.trackSortMap.get(s.item);a!=null?(a.listIndex=n,a.groupId=r):(a=new zne(s.item),this.trackSortMap.set(s.item,a),a.listIndex=n,a.groupId=r),n++}}for(let[,e]of this.trackSortMap){let r=e.groupId,i=this.listSortMap.get(r);i==null&&(i=[],this.listSortMap.set(r,i)),i.push(e)}}removeMidCollides(t,e){for(let r of t)if(r.collideIndexs.length>1){let n=this.getTrackIndex4Order(r.collideIndexs),s=this.getTrackIndex4Order(r.collideIndexs,!0);if(n==-1||s==-1)continue;let a=this.listSortMap.get(r.id),l;n>s?l=this.getSegment(s,n,a):l=this.getSegment(n,s,a);for(let c of l)for(let h of c.collideIndexs){let u=e.indexOf(h);u>=0&&e.splice(u,1)}}}mergePath(t){let e=new Set;this.filterEndpoint(t,e);let r=!0;for(;r;){r=!1;let i=new Array,n=null,s=0;for(let a of t){if(s>0){i.push(a);continue}if(n!=null){let l=e.has(a);!l&&a.id==n.id?(xe.addAll(n.collideIndexs,a.collideIndexs),e.add(n),r=!0):l?i.push(a):(r&&s++,n=a,i.push(n))}else n=a,i.push(n)}t=i}return t}filterEndpoint(t,e){let r=new Map;for(let i of t){let n=r.get(i.id);n==null&&(n=[],r.set(i.id,n)),n.push(i)}for(let[i,n]of r)if(n.length==1){let s=n[0];if(s.collideIndexs.length==1){let a=this.collides[s.collideIndexs[0]];if(a instanceof gt){let l=At.getInstance().getListNode(a),c=l.parent;(l.next==null&&c.otherNode.next==null&&(c.viaNode.next==null||!c.viaNode.next.isSource||this.collides.includes(c.viaNode.next.item))||this.isConnectVia(l))&&e.add(s)}else e.add(s)}}}isConnectVia(t){let e=t.parent;return e.viaNode.next!=null&&this.collides.includes(e.viaNode.next.item)&&e.viaNode.next.item.inOutline(t.item.end)?!0:!!(e.viaNode.prev!=null&&this.collides.includes(e.viaNode.prev.item)&&e.viaNode.prev.item.inOutline(t.item.start))}getTrackIndex(t){let e=this.collides[t];return e instanceof gt?this.trackSortMap.get(e).listIndex:-1}getTrackIndex4Order(t,e=!1){if(e)for(let r=t.length-1;r>=0;r--){let i=this.getTrackIndex(t[r]);if(i>=0)return i}else for(let r=0;r<t.length;r++){let i=this.getTrackIndex(t[r]);if(i>=0)return i}return-1}getSegment(t,e,r){let i=new Array;for(let n of r)n.listIndex>t&&n.listIndex<e&&i.push(n);return i}};var Yne=class extends MI{constructor(t,e,r,i,n,s,a,l=new Set){super(t,r,i,n,s,a,l),this.next=e,i?this.constraintPoint=this.getConstraintPoint(this.next[0],this.tracks[0].start,this.tracks[this.tracks.length-1].end,this.track.layerId):this.constraintPoint=this.getConstraintPoint(this.next[0],this.tracks[this.tracks.length-1].end,this.tracks[0].start,this.track.layerId)}onlyDrc(t){return this.isWire?this.isInput(t):!1}closeShapeOnlyDrc(t){return t.layerId!=12&&t.layerId!=11&&t.layerId!=1004?!0:this.isWire?!this.findNewEnd:this.fix}trackCheck(t,e,r,i){let n=this.block.blockTrackOnlyTrack(t,e?t.primitive.reverse():t.primitive,!0);if(n.length>0)for(let s of n){let a=s.obstacle;if(!s.isSameNet&&a instanceof gt){let c=At.getInstance().getListNode(a).parent;if(this.obstacles.has(c))continue;this.addObstacle(c);let h=this.constraintPoint.parentMap.get(t.layerId);return h==null?(h=new Cg(this.next[0],s.point,S.ORIGIN,!0),this.constraintPoint.setParent(t.layerId,h)):h.point=s.point,r.set(i,s),!0}}return!1}init(){let t=0,e=new Map,r=[[this.tracks,!1],[this.next,!0]];for(let[s,a]of r)if(a)for(let l=s.length-1;l>=0;l--){let c=s[l];if(this.trackCheck(c,a,e,s))break}else for(let l of s)if(this.trackCheck(l,a,e,s))break;let i=!1,n=new Ta;do{i=!1;for(let[s]of r){let a=e.get(s);if(a!=null){let l=a.obstacle;new LI(l,this.onlyDrc(l)).constraint(this.constraintPoint)&&!n.contains(this.constraintPoint.point)&&(i=!0,n.add(this.constraintPoint.point),this.constraintPoint.setConstraintObstacle(l))}}t++}while(i&&t<20)}getSize(){return Math.max(this.tracks[this.tracks.length-1].width/2,this.next[0].width/2)}getResult(){this.sycnShoveInfo();let t=[[this.tracks,!1],[this.next,!0]];for(let[e,r]of t){if(e.length==0)continue;let i=r?e[0]:e[e.length-1];HVe(i,r,this.constraintPoint.point,e,this.command)}for(let e of this.next)this.tracks.push(e)}};var Dj=class{constructor(t,e,r,i=!1){this.blockShape=new ms;this.queue=new Array;this.queue1=new Array;this.allItems=new Set;this.all=new Set;this.allPushList=new Set;this.pushQueue=new Array;this.cnt=0;this.inputLevel="WEAK";this.level="NONE";this.isWire=!1;this.canPushViaLevel=2;this.interrupt=!1;this.isPositive=!0;this.obstacles=new Set;this.direct=r,this.hugPrefered=i,this.isShove=!i,this.lists=t,this.command=new Lr("shove"),this.itorsCommand=new Lr,this.timeout=e,this.endTime=performance.now()+this.timeout}initShoveEnvironment(){Ou.getInstance().clear(),oi.getInstance().update(),PS.getInstance().clear();for(let t of this.lists)t instanceof Fn&&this.all.add(t)}shoveMain(){this.initShoveEnvironment(),this.queue.push(this.lists);let t=0;for(;this.queue.length>0||this.queue1.length>0;){let e;if(this.queue.length>0)e=this.queue.shift(),this.isPositive=!0;else{if(e=this.queue1.shift().reverse(),e.length>1){e.sort((n,s)=>n instanceof Fn&&s instanceof Fn?this.pushQueue.indexOf(s)-this.pushQueue.indexOf(n):0);let r=null,i=[];for(;e.length>0;){let n=e.shift();if(n instanceof Fn){let s=this.pushQueue.indexOf(n);if(r!=null&&r-s!=1){e.unshift(n);break}i.push(n),r=s}else{e.length==0?i.push(n):e.unshift(n);break}}this.queue1.push(e),e=i}this.isPositive=!1}if(this.shoveIterators(e),t>100||performance.now()>this.endTime||this.interrupt)break;t++}if(!(t>100||performance.now()>this.endTime||this.interrupt||this.queue.length>0||this.queue1.length>0))if(this.level==this.inputLevel){if(this.level=="SUPER"||this.level=="STRONG"){let r=new kI(this.pushQueue,this.level,this.direct,this.endTime,this.getLayerIds()).optimize();this.add2Commands(this.command,r)}}else{if(this.level=="SUPER"||this.level=="STRONG"){for(let i of this.lists)if(i instanceof Fn){let n=this.pushQueue.indexOf(i);n>=0&&this.pushQueue.splice(n,1)}let r=new kI(this.pushQueue,this.level,this.direct,this.endTime,this.getLayerIds()).optimize();this.add2Commands(this.command,r)}if(this.inputLevel=="SUPER"||this.inputLevel=="STRONG"){if(this.isWire&&this.inputLevel=="SUPER"&&this.hasDiffPairAndNotChange())return;let e=new Array;for(let n of this.lists)n instanceof Fn&&e.push(n);let i=new kI(e,this.inputLevel,this.direct,this.endTime).optimize();this.add2Commands(this.command,i)}}}getLayerIds(){let t=new Set;for(let e of this.lists)if(e instanceof Fn&&e.size()>0){let r=e.getFirst();t.add(r.layerId)}return t.size==0?null:t}hasDiffPairAndNotChange(){let t=new Set;for(let e of this.lists)if(e instanceof Fn){let r=e.listIterator();for(;r.hasNext();){let n=r.next(),s=Mr.getInstance().getStatus(n);if(s.isInput&&!s.notChange)return!1}let i=e.getFirst();t.add(i.net)}return this.blockShape.clearanceUtils.hasDiffPair(t)}shoveIterators(t){this.itorsCommand=new Lr;for(let i of t)i instanceof Fn&&(this.clearCollideInfo(i),this.allPushList.has(i)||(this.allPushList.add(i),this.pushQueue.push(i))),this.allItems.add(i);let e=this.aroundSolid(t);this.add2Commands(this.itorsCommand,e);let r=this.aroundTracks(t);if(this.interrupt){this.add2Commands(this.command,this.itorsCommand);return}if(this.hasCollides(t,!0)&&(this.itorsCommand.length==0&&(this.interrupt=!0),this.queue.unshift(t)),this.hasCollides(t,!1))if(this.queue1.length>0){let i=this.queue1[0];for(let n of t)i.includes(n)||i.push(n)}else this.queue1.unshift(t);if(r.length>0)if(this.isPositive)this.queue.push(r);else if(this.queue1.length>0){let i=this.queue1[0];for(let n of r)i.includes(n)||i.push(n)}else this.queue1.push(r);this.add2Commands(this.command,this.itorsCommand)}toggleSearchTree(t){wt.useShoveTree=!0,oi.getInstance().clearShoveTree(),this.add2ShoveTree(t)}canOffset(t,e=!1){if(t.size()>0){if(e){if(t.otherNode.prev==null&&(t.viaNode.prev==null||t.viaNode.prev!=null&&(this.isChangeViaNode(t.viaNode.prev)||this.canPushViaLevel>0)))return!0}else if((t.otherNode.next==null||this.isWire&&this.lists.includes(t))&&(t.viaNode.next==null||t.viaNode.next!=null&&(this.isChangeViaNode(t.viaNode.next)||this.canPushViaLevel>0)))return!0}return!1}canOffsetVia(t){return t!=null&&!t.item.locked&&!xs(t.item)&&t.item.getParent()==null&&this.isChangeViaNode(t)&&this.canPushViaLevel>0}isChangeViaNode(t){if(t.isSource)return!1;if(t.isSource){for(let[e,r]of t.connectTrack)if(r){if(this.isChangeNode(e.getFirstNode()))return!0}else if(this.isChangeNode(e.getLastNode()))return!0;return!1}else return!0}aroundSolid(t){let e=new Lr("aroundSolid"),r=0,i=Array.from(t),n=this.getAwaitShoveTracks(t);wt.useShoveTree=!1;do{let s=new Lr;this.setFilter4Solid(i);let a=this.initAroundPath(i);xe.addAllSet(a.awaitShove,n),n.clear();let{success:l,command:c}=this.aroundObstacles(i,a);if(l||r>=2?(this.add2Commands(s,c),this.addAroundCommand(s)):(c.undo(),Ou.getInstance().undo()),wt.pushFilter.setNet(null,null),oi.getInstance().update(),this.add2Commands(e,s),r++,this.filterAwaitShoveItem(a.awaitShove),a.awaitShove.size==0&&l||r>=8)break;xe.addAllSet(n,a.awaitShove),i=i.reverse()}while(this.endTime>performance.now()&&!this.interrupt);return e}getAwaitShoveTracks(t){let e=new Set;for(let r of t)if(r instanceof Fn){let i=this.getChangeTracks(r);xe.addAllSet(e,i),r.viaNode.prev!=null&&this.isChangeViaNode(r.viaNode.prev)&&e.add(r.viaNode.prev),r.viaNode.next!=null&&this.isChangeViaNode(r.viaNode.next)&&e.add(r.viaNode.next)}else e.add(r);return e}getListsCollideResult(t,e){let r=new Set,i=[],n=0,s=0,a=new Array,l=new Set;for(let T of t)if(T instanceof Fn){let I=this.getChangeTracks(T),C=new l6,E=!1;(T.viaNode.prev!=null&&this.isChangeViaNode(T.viaNode.prev)&&(T.viaNode.next==null||!this.isChangeViaNode(T.viaNode.next))||T.viaNode.prev==null&&I.length>0&&this.getNode(I[0]).prev==null&&this.getNode(I[I.length-1]).next!=null)&&(E=!0),T.viaNode.prev!=null&&this.isChangeViaNode(T.viaNode.prev)&&!E&&this.collide4Via(T.viaNode.prev,C,l);let O=new hF;if(I.length>0){let x=O.blockTracks(I,E);for(let v of x){let D=v.obstacle;D instanceof gt?(this.getNode(D),C.addTrack(D,v.point)):D instanceof Ct&&!l.has(D)&&((this.canPushViaLevel>0||!Si.getInstance().getNode(D).isSource)&&C.addVia(D,v.point),l.add(D))}}if(T.viaNode.prev!=null&&this.isChangeViaNode(T.viaNode.prev)&&E&&this.collide4Via(T.viaNode.prev,C,l),T.viaNode.next!=null&&this.isChangeViaNode(T.viaNode.next)&&this.collide4Via(T.viaNode.next,C,l),C.groups.length==0)continue;let _=C.getResult1(n);i.push(_);for(let[,x]of _)x instanceof PR&&(x.node.group=s);for(let x of O.inters){let v=C.trackSortMap.get(x);if(v!=null){let D=new PR;D.node.start=v.listIndex,D.node.end=v.listIndex,D.list=this.getNode(x).parent,D.tracks.push(x),a.push(D)}}n+=_.size,s++}else if(this.isChangeViaNode(T)){let I=new l6;this.collide4Via(T,I,l);let C=I.getResult1(n);i.push(C);for(let[,E]of C)E instanceof PR&&(E.node.group=s);n+=C.size,s++}let c=new Array;for(let T of i)for(let[,I]of T)c.push(I);let h=new Map;for(let T of c){if(T instanceof as)continue;let I=h.get(T.list);I==null&&(I=[],h.set(T.list,I)),I.push(T)}for(let[,T]of h)T.sort((I,C)=>I.node.start-C.node.start);let u=new Map,d=c.concat(a),p=d.length;for(let T=0;T<p;T++){let I=d[T];if(I instanceof as)continue;let C=I.node,E=u.get(C);E==null&&(E=new Set,u.set(C,E),E.add(C.group));for(let O=T+1;O<p;O++){let _=d[O];_ instanceof as||I.node!=_.node&&I.isIntersection(_)&&(E.add(_.node.group),I.merge(_),_.node=C)}}for(let[,T]of h){let I=T[0],C=I.node,E=T.length,O=u.get(C);for(let _=1;_<E;_++){let x=T[_],v=!1;if(x.node!=C){{let D=u.get(x.node),w=new Set;xe.addAllSet(w,O),xe.addAllSet(w,D),w.size!=D.size+O.size?v=!1:v=!0}v||C.isIntersection(x.node)?(O.add(x.node.group),I.merge(x),x.node=C):(I=x,C=I.node,O.clear(),O.add(I.node.group))}}}let m=new Map;for(let T of i){let I=null;for(let[,C]of T)C instanceof as||(I!=null&&m.get(I).push(C),c.push(C),I=C.node,m.has(I)||m.set(I,[]))}let g=new Array,y=new Set;function b(T,I){if(y.add(T),m.has(T))for(let C of m.get(T))y.has(C.node)||b(C.node,C);g.unshift(I)}for(let T of c){if(T instanceof as){g.push(T);continue}y.has(T.node)||b(T.node,T)}let P=0;for(let T of g)T instanceof as?(r.add(T),e.set(P,T)):(T.resetOrder(P,r),e.set(P,T.list)),P++;return r}collide4Via(t,e,r){if(this.isChangeViaNode(t)){let i=this.blockShape.blockViaPoint(t.item);for(let n of i){let s=n.obstacle;s instanceof gt?(this.getNode(s),e.addTrack(s,n.point)):s instanceof Ct&&!r.has(s)&&((this.canPushViaLevel>0||!Si.getInstance().getNode(s).isSource)&&e.addVia(s,n.point),r.add(s))}}}getChangeTracks(t){let e=t.getFirstNode(),r=t.getLastNode();for(;e!=null&&!this.isChangeTrack(e);)e=e.next;if(e==null)return[];for(;r!=null&&!(this.isChangeTrack(r)||(r=r.prev,e==r)););let i=e,n=[];for(;i!=null&&(n.push(i.item),i!=r);)i=i.next;return n}isChangeTrack(t){let e=Mr.getInstance().getStatus(t);return!!((e.isInput||!e.notChange)&&!e.checkDRC&&(this.isPositive&&!e.isReversePush||!this.isPositive&&e.isReversePush||e.isInputFirstPushed))}isChangeNode(t){let e=Mr.getInstance().getStatus(t);return!e.checkDRC&&(e.isInput||!e.notChange)}getListCollideResult1(t,e,r,i,n){let s=new l6;s.resetOrder=!1;let l=new Rj(n,i).blockTracks(t);for(let h of l){let u=h.obstacle;$l.getInstance().has(u.globalIndex)||(u instanceof gt?(this.getNode(u),s.addTrack(u,h.point)):u instanceof Ct&&(this.canPushViaLevel>0||!Si.getInstance().getNode(u).isSource)&&s.addVia(u,h.point))}let c=s.getResult(r+1);for(let[h,u]of c)e.set(h,u)}getListCollideResult2(t,e,r,i,n){let s=new l6;s.resetOrder=!1;let a=new Rj(n,i),l=this.blockShape.clearanceUtils.getMaxTrackClearance(),c=t.item.buildBBox().extendOfSize(l),h=a.search(c),u=this.blockShape.blockViaPoint4Shapes(t.item,h);for(let p of u){let m=p.obstacle;$l.getInstance().has(m.globalIndex)||(m instanceof gt?(this.getNode(m),s.addTrack(m,p.point)):m instanceof Ct&&(this.canPushViaLevel>0||!Si.getInstance().getNode(m).isSource)&&s.addVia(m,p.point))}let d=s.getResult(r+1);for(let[p,m]of d)e.set(p,m)}clearCollideInfo(t){let e=t.listIterator();for(;e.hasNext();){let r=e.next();this.setOrder(r,-1)}}setCollideInfo(t,e){if(t!=null)for(let r of t){let i=this.getNode(r),n=Mr.getInstance().getStatus(i);n.notChange||(n.collideOrder=e)}}aroundTracks(t){let e=Array.from(t);for(let l of e)l instanceof Fn&&this.clearCollideInfo(l);let r=new Lr("aroundTracks"),i=new Array;wt.pushFilter.setFilterMode(2);let n=new Map,s=this.getListsCollideResult(e,n);wt.pushFilter.setFilterMode(0);let a=this.around4OrderQueue(t,n,i,s);this.add2Commands(r,a);for(let[,l]of n)if(l instanceof Fn){if(l.viaNode.prev!=null&&this.isChangeViaNode(l.viaNode.prev))for(let[c]of l.viaNode.prev.connectTrack)!i.includes(c)&&c.size()>0&&i.push(c);if(l.viaNode.next!=null&&this.isChangeViaNode(l.viaNode.next))for(let[c]of l.viaNode.next.connectTrack)!i.includes(c)&&c.size()>0&&i.push(c)}else{for(let[c]of l.connectTrack)!i.includes(c)&&c.size()>0&&i.push(c);l.connectTrack.size==0&&i.push(l)}return this.add2Commands(this.itorsCommand,r),this.cnt++,this.sortResult(i)}sortResult(t){let e=new Array,r=new Array;for(let i of t)i instanceof Fn&&this.pushQueue.includes(i)?r.push(i):e.push(i);return r.sort((i,n)=>this.pushQueue.indexOf(i)-this.pushQueue.indexOf(n)),this.isPositive&&r.reverse(),e.concat(r)}add2ShoveTree(t){for(let e of t)this.addItem2ShoveTree(e)}addItem2ShoveTree(t){if(t instanceof Fn){let e=oi.getInstance(),r=t.iterator();for(;r.hasNext();){let i=r.next();e.addShoveTree(i)}if(t.viaNode.prev!=null){e.addShoveTree(t.viaNode.prev.item);for(let[i]of t.viaNode.prev.connectTrack){if(i==t||i.size()==0)continue;let n=i.iterator();for(;n.hasNext();){let s=n.next();e.addShoveTree(s)}}}if(t.viaNode.next!=null){e.addShoveTree(t.viaNode.next.item);for(let[i]of t.viaNode.next.connectTrack){if(i==t||i.size()==0)continue;let n=i.iterator();for(;n.hasNext();){let s=n.next();e.addShoveTree(s)}}}if(t.otherNode.prev!=null){let i=t.otherNode.prev;if(i instanceof et){e.addShoveTree(i);let n=Kl.getInstance().getNode(i);for(let[s]of n.connectTrack){if(s==t||s.size()==0)continue;let a=s.iterator();for(;a.hasNext();){let l=a.next();e.addShoveTree(l)}}}else if(i instanceof Fn){let n=i.iterator();for(;n.hasNext();){let s=n.next();e.addShoveTree(s)}}}if(t.otherNode.next!=null){let i=t.otherNode.next;if(t.otherNode.next instanceof et){e.addShoveTree(i);let n=Kl.getInstance().getNode(t.otherNode.next);for(let[s]of n.connectTrack){if(s==t||s.size()==0)continue;let a=s.iterator();for(;a.hasNext();){let l=a.next();e.addShoveTree(l)}}}else if(i instanceof Fn){let n=i.iterator();for(;n.hasNext();){let s=n.next();e.addShoveTree(s)}}}}else{let e=oi.getInstance();e.addShoveTree(t.item);for(let[r]of t.connectTrack){if(r.size()==0)continue;let i=r.iterator();for(;i.hasNext();){let n=i.next();e.addShoveTree(n)}if(r.otherNode.prev!=null){let n=r.otherNode.prev;if(n instanceof et){e.addShoveTree(n);let s=Kl.getInstance().getNode(n);for(let[a]of s.connectTrack){if(a==r||a.size()==0)continue;let l=a.iterator();for(;l.hasNext();){let c=l.next();e.addShoveTree(c)}}}else if(n instanceof Fn){let s=n.iterator();for(;s.hasNext();){let a=s.next();e.addShoveTree(a)}}}if(r.otherNode.next!=null){let n=r.otherNode.next;if(r.otherNode.next instanceof et){e.addShoveTree(n);let s=Kl.getInstance().getNode(r.otherNode.next);for(let[a]of s.connectTrack){if(a==r||a.size()==0)continue;let l=a.iterator();for(;l.hasNext();){let c=l.next();e.addShoveTree(c)}}}else if(n instanceof Fn){let s=n.iterator();for(;s.hasNext();){let a=s.next();e.addShoveTree(a)}}}}}}around4OrderQueue(t,e,r,i){let n=wt.filter,s=0;for(let[,p]of e)if(!r.includes(p))if(p instanceof as){let m=!1;for(let[g]of p.connectTrack)!r.includes(g)&&g.size()>0&&(r.push(g),m=!0);m||r.push(p)}else r.push(p);let a=new Array,l=new Array;for(let[p,m]of e)a.push(m),l.push(p);let c=l[l.length-1],h=new Set,u=new Lr("around4OrderQueue"),d=Array.from(t);do{this.toggleSearchTree(d),wt.filter=this.setShoveTrackFilter(d);let p=new Lr("around4OrderQueue-itors"),m=this.initAroundPath(a);xe.addAllSet(m.awaitShove,i),xe.addAllSet(m.obstacles,h),i.clear(),h.clear(),m.completes.clear();for(let b of d)b instanceof Fn?(m.canShovePath.add(b),m.completes.add(b),this.checkListOtherConnect(b,m)):b instanceof as&&m.canShoveVia.add(b);m.max=c,wt.pushFilter.setFilterMode(3);let g=this.aroundPath(a,l,m,h);this.add2Commands(p,g),this.filterAwaitShoveItem(m.awaitShove);let y=this.continuousCollide(a,l,m,h);this.add2Commands(p,y),c=m.max,wt.pushFilter.setFilterMode(0),this.addAroundCommand(p),this.add2Commands(u,p),wt.pushFilter.setNet(null,null),this.filterAwaitShoveItem(m.awaitShove);for(let b of a)if(!r.includes(b)&&!d.includes(b))if(b instanceof as){let P=!1;for(let[T]of b.connectTrack)!r.includes(T)&&T.size()>0&&(r.push(T),P=!0);P||r.push(b)}else r.push(b);if(m.awaitShove.size==0)break;{xe.addAllSet(i,m.awaitShove),a=a.reverse(),l=l.reverse();let b=new Array;for(let P of d)(P instanceof as||!a.includes(P))&&b.push(P);d=b}if(s++,s>=8)break}while(!this.interrupt);return wt.filter=n,wt.useShoveTree=!1,u}checkListOtherConnect(t,e){if(t.otherNode.prev!=null){let r=t.otherNode.prev;if(r instanceof et){let i=Kl.getInstance().getNode(r);for(let[n]of i.connectTrack)n==t||n.size()==0||e.canShovePath.add(n)}else r instanceof Fn&&e.canShovePath.add(r)}if(t.otherNode.next!=null){let r=t.otherNode.next;if(r instanceof et){let i=Kl.getInstance().getNode(r);for(let[n]of i.connectTrack)n==t||n.size()==0||e.canShovePath.add(t)}else r instanceof Fn&&e.canShovePath.add(r)}}checkCollide(t,e,r,i,n){let s=new Map;if(n.size()>0){if(t.setFilterMode(3),e instanceof Fn){let a=this.getCollideOrderTracks(e,r);this.getListCollideResult1(a,s,i,t,n)}else this.getListCollideResult2(e,s,i,t,n);t.setFilterMode(0)}return s}filterAwaitShoveItem(t){let e=Array.from(t);for(let r of e)if(r instanceof gt){let i=At.getInstance().getNode(r);i!=null&&i.ignore&&t.delete(r)}}setShoveTrackFilter(t){let e=new x8;this.canPushViaLevel==0?e.setSolidViaFilterMode():e.setSolidFilterMode();for(let r of t)this.lists.includes(r)?e.addObastacleList(r):e.addAroundList(r);return e}hasCollides(t,e){wt.setPushFilter();for(let r of t)if(r instanceof as){if(this.blockShape.collideVia(r.item).length>0)return!0}else{wt.pushFilter.setNet(r.getFirst().net,new Set([r.getFirst()]));let i=r.listIterator();for(;i.hasNext();){let n=i.next(),s=n.item,a=Mr.getInstance().getStatus(n);if(this.isChangeNode(n)&&(e&&!a.isReversePush||!e&&a.isReversePush)){let l=this.blockShape.checkTrackDRC(s);if(a.checkDRC=!l,l)return!0}}}return!1}setFilter4Solid(t){wt.setPushFilter(),this.canPushViaLevel==0?wt.pushFilter.setSolidViaFilterMode(!this.hugPrefered):wt.pushFilter.setSolidFilterMode(!this.hugPrefered);for(let e of t)wt.pushFilter.addWaitList(e);for(let e of this.obstacles)wt.pushFilter.addListObstacles(e)}getNode(t){let e=At.getInstance().getNode(t);return e!=null&&e.ignore||(e==null&&(new su(t).generateList(),e=At.getInstance().getNode(t)),this.all.has(e.parent)||(this.clearCollideInfo(e.parent),this.all.add(e.parent))),e}aroundObstacles(t,e){oi.getInstance().update();let r=new SS(this.endTime-performance.now());r.direct=this.direct;let i=new Lr("aroundObstacles"),n=!0,s=Array.from(t);for(e.completes.clear();s.length>0&&!this.interrupt&&this.endTime>performance.now();){e.awaitingVias.clear();let a=s.shift(),l=new Lr;if(oi.getInstance().update(),wt.pushFilter.addAroundList(a),a instanceof Fn){if(a.size()==0)continue;e.completes.add(a);let c=this.getAroundTracks(a,e,l);wt.pushFilter.setNet(a.getFirst().net,new Set(c));let h;try{h=this.around(c,a,r,l,e)}catch(u){console.log(u),r.success=!1}if(wt.pushFilter.setNet(null,null),wt.pushFilter.clearRepeatAroundList(),(!(this.lists.includes(a)&&r.inputEndpointCanModify)||this.lists.includes(a)&&this.hugPrefered&&!this.isShove)&&!r.success){if(this.hugPrefered&&(this.hugPrefered=!1),l.undo(),Ou.getInstance().undo(),this.isWire&&this.lists.includes(a)){let u=a.getLastNode(),d=Mr.getInstance().getStatus(u);d.checkDRC=!1}this.add2AwaitShove(c,e),l=new Lr}else{if(this.isWire&&r.inputEndpointCanModify&&!r.success&&a.viaNode.next!=null&&h.length>0){this.add2AwaitShove([h[h.length-1]],e);for(let d of e.awaitingVias)e.awaitShove.add(d)}this.addAroundCommand(l);let u=0;for(;u<s.length&&h!=null&&h.length>0;){let d=s[u];if(d instanceof Fn){new ES(d.toArray()).getShoveTracks(h,e);break}u++}}wt.pushFilter.addAroundList(a)}else if(e.awaitShove.has(a)){let c=!1;for(let[h,u]of a.connectTrack)this.getViaCollideNextTracks(h,u,e,l).length>0&&(c=!0);if(!c){let h=a.item,u=new SA(a,l,e,this.endTime,e.completes);u.offset(),wt.pushFilter.addAroundTracks(a),u.success?(oi.getInstance().deleteShoveTree(h),oi.getInstance().addShoveTree(a.item),u.checkShove(a.item),this.updateNext(a,s,e)):(l.undo(),l=new Lr,e.awaitShove.add(a))}}this.add2Commands(i,l),Gr.inputClear()}return{success:n,command:i}}getViaCollideNextTracks(t,e,r,i){let n=new Array,s=!1;if(e){let l=t.getFirstNode();for(;l!=null;){if(r.awaitShove.has(l.item))s=!0,n.push(l);else{let c=l.item;if(this.blockShape.blockTrackOnlyTrack(c,c.primitive,!0).length>0)s=!0,n.push(l);else break}l=l.next}}else{let l=t.getLastNode();for(;l!=null;){if(r.awaitShove.has(l.item))s=!0,n.unshift(l);else{let c=l.item;if(this.blockShape.blockTrackOnlyTrack(c,c.primitive,!0).length>0)s=!0,n.unshift(l);else break}l=l.prev}}let a=new Array;if(s){for(let c of n)Mr.getInstance().getStatus(c).change(),a.push(c.item);let l=new CS(a,e?t.viaNode.prev.item:t.viaNode.next.item,i,!e,this.endTime,this.isWire,r);l.offset(),l.getResult()}return a}updateNext(t,e,r){try{if(e.length>0){let i=0;for(;i<e.length&&t!=null;){let n=e[i];if(n instanceof Fn){let s=new ES(n.toArray());t instanceof as?s.getViaShoveTracks(t.item,r.awaitShove):t.length>0&&s.getShoveTracks(t,r);break}i++}}}catch(i){this.interrupt=!0,console.log(i)}}addAroundCommand(t){let e=Ou.getInstance().asyn();e.size>0&&t.addCommand(new rF(e))}add2Commands(t,e){e.length>0&&t.addCommand(e)}getOptimizeLevel(t){if(this.lists.includes(t))switch(this.inputLevel){case"SUPER":case"STRONG":case"WEAK":return"WEAK";default:return this.inputLevel}switch(this.level){case"SUPER":case"STRONG":case"WEAK":return"WEAK";default:return this.level}}aroundPath(t,e,r,i){let n=new SS(this.endTime-performance.now());n.direct=this.direct;let s=new Lr("aroundPath"),a=Array.from(t),l=Array.from(e);for(;a.length>0&&!this.interrupt;){r.awaitingVias.clear();let c=a.shift(),h=l.shift();this.addItem2ShoveTree(c);let u=new Lr;if(c instanceof Fn){if(c.size()==0)continue;r.completes.add(c);let d;try{d=this.getCollideTracks(c,h,r,u)}catch(m){this.interrupt=!0,console.log(m),u.undo();break}wt.pushFilter.setNet(c.getFirst().net,new Set(d)),oi.getInstance().checkModels(d);let p=this.around(d,c,n,u,r);if(wt.pushFilter.setNet(null,null),wt.pushFilter.clearRepeatAroundList(),n.success)this.updateShoveRtree(d,p),this.addAroundCommand(u),this.updateNextOrder(p,a,l,r);else{u.undo(),u=new Lr,Ou.getInstance().undo(),p.length=0,this.add2AwaitShove(d,r,i);break}this.setCollideInfo(p,h)}else if(r.awaitShove.has(c)){let d=!1;for(let[p,m]of c.connectTrack)this.getViaCollideTracks(p,h,m,r,u).length>0&&(d=!0);if(!d){let p=c.item,m=new SA(c,u,r,this.endTime,r.completes);m.offset(),wt.pushFilter.addAroundTracks(c),m.success?(oi.getInstance().deleteShoveTree(p),oi.getInstance().addShoveTree(c.item),m.checkShove(c.item),this.updateNextOrder(c,a,l,r)):(u.undo(),u=new Lr,r.awaitShove.add(c))}}wt.pushFilter.addShoveComplete(c),Gr.inputClear(),this.add2Commands(s,u)}return s}updateShoveRtree(t,e){let r=new Set(t);for(let i of e)r.has(i)?r.delete(i):oi.getInstance().addShoveTree(i);for(let i of r)oi.getInstance().deleteShoveTree(i)}around(t,e,r,i,n){if(t.length==0)return[];if(wt.pushFilter.addAroundTracks(t),t.length>0){let s=this.getIgnoreTracks(e,t);wt.pushFilter.deleteAroundTracks(s)}return r.level=this.getOptimizeLevel(e),r.isWire=this.isWire,r.find(t,i,n)}add2AwaitShove(t,e,r=null){for(let i of t)!i.isEmpty&&!this.getNode(i).ignore?(e.awaitShove.add(i),r!=null&&r.add(i)):oi.getInstance().deleteShoveTree(i);for(let i of e.awaitingVias)e.awaitShove.add(i)}getViaCollideTracks(t,e,r,i,n){let s=new Array,a=!1;if(r){let c=t.getFirstNode();for(;c!=null&&this.inOrderRange(c,e);)s.push(c),c=c.next;for(;s.length>0;){let h=s.pop();if(i.awaitShove.has(h.item)){a=!0,s.push(h);break}else{let u=h.item;if(this.blockShape.blockTrackOnlyTrack(u,u.primitive,!0).length>0){a=!0,s.push(h);break}}}}else{let c=t.getLastNode();for(;c!=null&&this.inOrderRange(c,e);)s.unshift(c),c=c.prev;for(;s.length>0;){let h=s.shift();if(i.awaitShove.has(h.item)){a=!0,s.unshift(h);break}else{let u=h.item;if(this.blockShape.blockTrackOnlyTrack(u,u.primitive,!0).length>0){a=!0,s.unshift(h);break}}}}let l=new Array;if(a){this.addItem2ShoveTree(t);let c=t.toArray();for(let u of s)Mr.getInstance().getStatus(u).change(),l.push(u.item);let h=new CS(l,r?t.viaNode.prev.item:t.viaNode.next.item,n,!r,this.endTime,this.isWire,i);h.offset(),h.getResult(),this.updateShoveRtree(c,t.toArray())}return l}updateNextOrder(t,e,r,i){try{if(e.length>0){let n=0;for(;n<e.length&&t!=null;){let s=e[n];if(s instanceof Fn){let a=new ES(this.getCollideRange(s,r[n]));t instanceof as?a.getViaShoveTracks4Order(t.item,r[n],i.awaitShove):t.length>0&&(a.getShoveTracks4Order(t,r[n],i.awaitShove),!i.awaitShove.has(s.viaNode.prev)&&this.canPush(s.viaNode.prev)&&a.checkViaCollide4Tracks(s.viaNode.prev,t,i.awaitShove),!i.awaitShove.has(s.viaNode.next)&&this.canPush(s.viaNode.next)&&a.checkViaCollide4Tracks(s.viaNode.next,t,i.awaitShove));break}n++}}}catch(n){this.interrupt=!0,console.log(n)}}canPush(t){return t==null?!1:!t.isSource||this.canPushViaLevel>0}continuousCollide(t,e,r,i){let n=new Lr("continuousCollide"),s=wt.filter,a=new r0(10),l=this.setShoveTrackFilter([]),c=new Set;for(let g of r.awaitShove){if(g instanceof as){l.addObstacle(g.item),a.insert(new Lp(g.item)),c.add(g);continue}let y=this.getNode(g);if(!y.ignore&&this.equalsOrder(y,-1)){if(y.prev!=null&&!this.equalsOrder(y.prev,-1)||y.next!=null&&!this.equalsOrder(y.next,-1))continue;l.addObstacle(g),a.insert(new Lp(g)),c.add(g)}}if(this.interrupt)return n;let h=t.length,u=new Array(h),d=new Array(h),p=new Map;for(let g=0;g<h;g++){let y=t[g];y instanceof as&&p.set(y,e[g]),u[g]=y,d[g]=e[g]}let m=new Map;for(;u.length>0&&!this.interrupt&&performance.now()<this.endTime;){let g=u.pop(),y=d.pop();if(m.get(y)==g)continue;m.set(y,g);let b=new Lr("removeSelfInters and next collide");if(g instanceof Fn){let T=this.removeSelfInters(g,y,r);this.add2Commands(b,T)}let P=this.checkCollide(l,g,y,r.max,a);if(!this.interrupt&&P.size>0){let T=new Array,I=new Array;for(let[E,O]of P)O instanceof as&&p.has(O)||(t.push(O),e.push(E),T.push(O),I.push(E));r.max=Math.max(r.max,...I),wt.filter=s,wt.pushFilter.setFilterMode(3);let C=this.aroundPath(T,I,r,i);this.add2Commands(b,C),wt.pushFilter.setFilterMode(0),u=Array.from(t),d=Array.from(e);for(let E of r.awaitShove){if(E instanceof as){if(c.has(E))continue;l.addObstacle(E.item),a.insert(new Lp(E.item));continue}let O=this.getNode(E);if(!O.ignore&&this.equalsOrder(O,-1)){if(O.prev!=null&&!this.equalsOrder(O.prev,-1)||O.next!=null&&!this.equalsOrder(O.next,-1)||l.hasObstacle(E)||c.has(E))continue;l.addObstacle(E),a.insert(new Lp(E))}}}this.add2Commands(n,b)}return n}removeSelfIntersection(t,e,r){if(t==null)return;let i=new Lr,n=new Wne(this.endTime-performance.now()),s=!1;for(let l of t)if(e.awaitShove.has(l)){s=!0;break}let a=n.removeSelf(t,i,e);if(n.success?this.addAroundCommand(i):(i.undo(),i=new Lr,Ou.getInstance().undo(),a.length=0),this.add2Commands(r,i),s)for(let l of a){let c=this.getNode(l);c.ignore||Mr.getInstance().getStatus(c).notChange||e.awaitShove.add(l)}return a}removeSelfInters(t,e,r){let i=new Lr("removeSelfInters"),n;try{n=this.getCollideTracks1(t,e)}catch(s){this.interrupt=!0,console.log(s)}if(this.interrupt)return i;if(n.length>0){let s=this.removeSelfIntersection(n,r,i);this.setCollideInfo(s,e)}return i}getCollideOrderTracks(t,e){let r=t.listIterator(),i=new Array;for(;r.hasNext();){let n=r.next();this.equalsOrder(n,e)&&i.push(n.item)}return i}getCollideRange(t,e){let r=t.listIterator(),i=new Array;for(;r.hasNext();){let l=r.next();this.equalsOrder(l,e)&&i.push(l)}let n=i[0];for(;n.prev!=null&&(n=n.prev,!!this.inOrderRange(n,e));)i.unshift(n);let s=i[i.length-1];for(;s.next!=null&&(s=s.next,!!this.inOrderRange(s,e));)i.push(s);let a=new Array;for(let l of i)a.push(l.item);return a}getAroundTracks(t,e,r){let i=t.getFirstNode(),n=t.getLastNode();for(;i!=null&&!(this.isChangeTrack(i)||e.awaitShove.has(i.item)||(i=i.next,i==n)););for(;n!=null&&!(this.isChangeTrack(n)||e.awaitShove.has(n.item)||(n=n.prev,i==n)););let s=!1;for(;i!=null&&i.prev!=null;)if(this.isChangeNode(i.prev))i=i.prev;else{let c=i.item;if(this.blockShape.blockTrackPrimitive(c,c.primitive,!0,!1).length>0)s=!0,i=i.prev;else break}for(;n!=null&&n.next!=null;)if(this.isChangeNode(n.next))n=n.next;else{let c=n.item;if(this.blockShape.blockTrackPrimitive(c,c.primitive,!0,!1).length>0)s=!0,n=n.next;else break}let a=i,l=[];for(;a!=null&&(e.awaitShove.has(a.item)&&(s=!0),l.push(a.item),a!=n);)a=a.next;if(s){i.prev==null&&this.checkPath(t,l,e,r,!0),wt.pushFilter.setNetAndLayerId(i.item.net,i.item.layerId);let c=!1;return this.getNode(l[l.length-1]).next==null&&(c=this.checkPath(t,l,e,r,!1)),c||this.checkReversePush(t,l,e,r,!1),wt.pushFilter.setNetAndLayerId(null,null),l}else return wt.pushFilter.setNetAndLayerId(null,null),[]}getCollideTracks(t,e,r,i){let n=new Array,s=t.getFirst();wt.pushFilter.setNetAndLayerId(s.net,s.layerId);let a=!1,l=t.listIterator();for(;l.hasNext();){let p=l.next();this.equalsOrder(p,e)&&(n.push(p),!a&&r.awaitShove.has(p.item)&&(a=!0))}let c=n[0];for(;c.prev!=null&&(c=c.prev,!!this.inOrderRange(c,e));){if(r.awaitShove.has(c.item)){a=!0,n.unshift(c);continue}let p=c.item;if(this.blockShape.blockTrackOnlyTrack(p,p.primitive,!0).length>0)a=!0,n.unshift(c);else break}let h=n[n.length-1],u=h.item.width;for(;h.next!=null&&(h=h.next,!!this.inOrderRange(h,e));){if(r.awaitShove.has(h.item)){a=!0,n.push(h);continue}let p=h.item,m=p.width;m>u&&(u=m),p.width=u;let g=this.blockShape.blockTrackOnlyTrack(p,p.primitive,!0);if(p.width=m,g.length>0)a=!0,n.push(h);else break}let d=new Array;if(a){let p=null,m=new Array,g=new Array;for(let b of n)p!=null&&b.item.width!=p&&g.length>0&&(m.push(g),g=new Array),p=b.item.width,g.push(b.item);if(g.length>0&&(m.push(g),g=new Array),m.length>1){d=m[0];for(let b=1,P=m.length;b<P;b++){let T=new Yne(d,m[b],i,!0,this.endTime,this.isWire,r);T.offset(),T.getResult()}}else d=m[0];n[0].prev==null&&this.checkPath(t,d,r,i,!0);let y=!1;this.getNode(d[d.length-1]).next==null&&(y=this.checkPath(t,d,r,i,!1)),y||this.checkReversePush(t,d,r,i,!1)}return wt.pushFilter.setNetAndLayerId(null,null),d}equalsOrder(t,e){return t!=null?Mr.getInstance().getStatus(t).collideOrder==e:!1}setOrder(t,e){t!=null&&Mr.getInstance().setOrder(t,e)}inOrderRange(t,e){let r=Mr.getInstance().getStatus(t);return!(r.collideOrder!=-1&&r.collideOrder!=e)}getCollideTracks1(t,e){let r=t.listIterator(),i=new Array;for(;r.hasNext();){let u=r.next();Mr.getInstance().getStatus(u).collideOrder==e&&i.push(u)}let n=new Array,s=i[0];for(;s.prev!=null&&(s=s.prev,!(!this.inOrderRange(s,e)||s.item.locked||xs(s.item)||s.item.getParent()!=null));)n.unshift(s);let a=new Array,l=i[i.length-1];for(;l.next!=null&&(l=l.next,!(!this.inOrderRange(l,e)||l.item.locked||xs(l.item)||l.item.getParent()!=null));)a.push(l);let c=!1;e:for(;n.length>0;){let u=n.shift(),d=u.item.primitive;for(let p of i){if(u.next==p)continue;let m=p.item.primitive;if(d.bbox().intersection1(m.bbox())&&Pt(d,m)>0){n.unshift(u),c=!0;break e}}}e:for(;a.length>0;){let u=a.pop(),d=u.item.primitive;for(let p of i){if(u.prev==p)continue;let m=p.item.primitive;if(d.bbox().intersection1(m.bbox())&&Pt(d,m)>0){a.push(u),c=!0;break e}}}let h=new Array;if(c){for(let u of n)h.push(u.item);for(let u of i)h.push(u.item);for(let u of a)h.push(u.item)}return h}canOffsetEndVia(t,e){return t!=null&&(this.canOffsetVia(t)||e.awaitShove.has(t))}checkPath(t,e,r,i,n){let s=n?t.viaNode.prev:t.viaNode.next,a=en.exsitSpaceConstraint(e,!n);if(this.viaOffset(s,e,r,i,n,a))return!0;let c=(n?t.getFirstNode():t.getLastNode()).item,h=this.hugPrefered?[]:this.blockShape.blockTrackPoint(c,n);if(h.length>0||a){if(this.canOffset(t,n)){let u=new MI(e,i,!n,this.endTime,this.isWire,r);u.offset(),u.getResult()}else this.removePointRepeatLine(h,e,r,n);return!0}else return!1}checkReversePush(t,e,r,i,n){let s=n?t.getFirstNode():t.getLastNode();if(Mr.getInstance().getStatus(s).isInput&&this.isWire){let l=n?e[e.length-1]:e[0],c=this.blockShape.blockTrackOther(l,new Set);for(let h of c){let u=h.obstacle;if(u instanceof gt&&Mr.getInstance().getStatus(this.getNode(u)).isReversePush){if(this.canOffset(t,n)){this.get2End(e,!n);let p=new MI(e,i,!n,this.endTime,this.isWire,r);p.offset(),p.getResult()}break}}}}get2End(t,e){if(e){let r=this.getNode(t[t.length-1]);for(r=r.next;r!=null;)t.push(r.item),r=r.next}else{let r=this.getNode(t[0]);for(r=r.prev;r!=null;)t.unshift(r.item),r=r.prev}}viaOffset(t,e,r,i,n,s){if(this.canOffsetEndVia(t,r)){let a=t.item,c=this.blockShape.collideVia(t.item).length>0;if(!c){let h=n?e[0]:e[e.length-1];c=this.blockShape.blockTrackPoint(h,n).length>0,c||(c=n?!h.start.equals1(t.item.center):!h.end.equals1(t.item.center))}if(c||s){let h=new CS(e,t.item,i,!n,this.endTime,this.isWire,r);h.offset(),h.getResult()}else r.awaitShove.has(t)&&(r.awaitShove.delete(t),r.awaitingVias.add(t));return oi.getInstance().deleteShoveTree(a),oi.getInstance().addShoveTree(t.item),!0}return!1}removePointRepeatLine(t,e,r,i){for(let l of t)if(l instanceof gt){let c=this.getNode(l);if(c.ignore||!r.canShovePath.has(c.parent))continue;wt.pushFilter.deleteAroundList(c.parent),r.awaitShove.add(l)}let n=i?e[e.length-1]:e[0],s=this.getNode(n);if(i?s.next==null:s.prev==null){let l=i?s.parent.viaNode.next:s.parent.viaNode.prev;if(l!=null&&this.canOffsetEndVia(l,r))return;if(l==null&&this.canOffset(s.parent,!i))return}let a=new aF(e,!i);for(let l of a.used){if(!r.canShovePath.has(l))continue;wt.pushFilter.deleteAroundList(l);let c=this.getChangeTracks(l);for(let h of c)this.getNode(h).ignore||r.awaitShove.add(h)}}getIgnoreTracks(t,e){let r=new Set(e),i=new Array,n=t.listIterator();for(;n.hasNext();){let s=n.next();r.has(s.item)||i.push(s.item)}return i}initAroundPath(t){let e=new N3;for(let r of t)r instanceof as?e.canShoveVia.add(r):(e.canShovePath.add(r),r.viaNode.prev!=null&&e.canShoveVia.add(r.viaNode.prev),r.viaNode.next!=null&&e.canShoveVia.add(r.viaNode.next),this.checkListOtherConnect(r,e));return e}};var km=class extends wI{constructor(e=!1,r=200){super();this.canPushViaLevel=2;this.inputLevel="WEAK";this.level="NONE";this.hugPrefered=e,this.timeout=r,wt.clearParition(),wt.updateParition()}run(e){Ou.getInstance().clear(),oi.getInstance().update();let i=this.getLists(e,e.command),n=new Dj(i,this.timeout,e.direct,this.hugPrefered);n.level=this.level,n.inputLevel=this.inputLevel,n.isWire=this.isWire,n.canPushViaLevel=this.canPushViaLevel,n.shoveMain(),n.command.length>0&&e.command.addCommand(n.command),wt.clearParition()}run1(e,r,i){Ou.getInstance().clear(),oi.getInstance().update();let s=this.getLists1(e),a=new Dj(s,this.timeout,i,this.hugPrefered);a.inputLevel=this.inputLevel,a.canPushViaLevel=this.canPushViaLevel,a.isWire=this.isWire,a.shoveMain(),a.command.length>0&&r.addCommand(a.command),wt.clearParition()}getLists(e,r){let i=[],n=wt.filter;wt.setPushFilter();for(let[s,a]of e.wireMap){if(s.drawing==0&&a.size()>0){wt.pushFilter.setSolidFilterMode();let l=this.backFix(a,r);if(wt.pushFilter.setAroundMode(),l){let c=this.getFirstInputStatus(a).item,h=new Zr,u=h.createList(),d=h.createTrack(c.layerId,c.start,c.start,c.width,c.net,e.command,c.getGroupID());h.addList(d,u,e.command),u.replace(this.getFirstInputStatus(a),a.getLastNode()),e.command.addCommand(new mi(u));continue}i.push(a)}if(a.size()==0&&a.viaNode.prev!=null){let l=!1;if(a.viaNode.prev.connectTrack.size>0)for(let[c]of a.viaNode.prev.connectTrack)c.size()>0&&(i.push(c),l=!0);l||i.push(a.viaNode.prev)}}return wt.filter=n,i}getLists1(e){let r=[];for(let i of e)i instanceof as?(r.push(i),Mr.getInstance().addInputStatus(i)):i.size()>0&&r.push(i);return r}};var wj=class wj{constructor(t){this.kit=new Rc(1e-4);this.direct=new S(1,0);this.event=t,this.command=new Lr;let e=new _e,r=t.trackNode.parent,i=r.getAllItems();for(let n of i)e.ext1(n.buildBBox());this.bbox=e.build1(),this.pathList=this.event.trackNode.parent,this.startPoint=r.getFirst().start,this.endPoint=r.getLast().end,wj.needclearWireCache=!0}get command(){return this._command}set command(t){this._command=t}getStartPoint(){return this.startPoint}getEndPoint(){return this.endPoint}complete(){this.command=null}interrupt(){var t;Cr.getInstance().clear(),(t=this.command)==null||t.undo(),this.command=null,Mi.getInstance().view4Status(Cr.getInstance().current)}rotate(t){}lock(){return!1}getLengthIncrement(){let t=this.event.trackNode.parent,e=this.getPathList(),r=0;t.getAllItems().forEach(a=>{r+=a.length});let i=this.event.trackNode.item.net,n=Mi.getInstance().getMap,s=0;for(let[a,l]of n)l.net==i&&l.isVisible&&(s+=l.length);return s-r}getIntersection(t,e){return Pt(t,e)>0?new S(Ee[0],Ee[1]):null}moveInit(){Gr.init(),wj.needclearWireCache&&this.initClear(),wt.ignores.clear(),this.command.undo(),this.command=new Lr,this.pathList.getAllItems().forEach(r=>{let i=Ml.getInstance().getItem(r.globalIndex);i||(i=pr.getItem(r.globalIndex).model),At.getInstance().getNode(i)});let e=this.event.trackNode=At.getInstance().getNode(this.event.trackNode.item);return oi.getInstance().update(),e}initClear(){Cr.getInstance().clear(),pa.getInstance().clear(),fs.getInstance().clear(),Mr.getInstance().clear()}moveEnd(){let t=this.block(),e=Mi.getInstance().view4Status(Cr.getInstance().current);return this.command.addCommand(e),oi.getInstance().update(),t}block(){return null}isBlock(){return this.event.isBlock()}isPush(){return this.event.isPush()}getWireResult(){this.wireResult=new Tg}around(){this.wireResult||this.getWireResult();let t=this.wireResult;this.shoveHandle(this.command);let e=this.pathList,r=this.generateTrackInfoByItem(e.getFirst(),e.getLast());t.wireMap.set(r,e),t.command=this.command,dj(Zt.getInstance().type);let i=new By;switch(Ys.getInstance().currentPathOptimization4BePushed){case"OPTIMIZA_STRONG":{i.level="SUPER";break}case"OPTIMIZA_WEAK":{i.level="STRONG";break}case"OPTIMIZA_NONE":{i.level="WEAK";break}default:{i.level="NONE";break}}t.direct=this.direct;try{i.run(t)}catch(s){throw new Error(s)}return this.wireResult=null,t}getPathList(){return this.pathList}shove(){this.wireResult||this.getWireResult();let t=this.wireResult;this.shoveHandle(this.command);let e=this.getPathList(),r=this.generateTrackInfoByItem(e.getFirst(),e.getLast());t.wireMap.set(r,e),t.command=this.command,dj(Zt.getInstance().type);let i=new km(Zt.getInstance().mode=="WIRING_MODE_SURROUND_AND_PUSHAWAY");t.direct=this.direct;let n=Ys.getInstance();switch(n.pushVia){case"OPTIMIZA_OPEN":{i.canPushViaLevel=2;break}case"OPTIMIZA_NONE":{i.canPushViaLevel=0;break}}switch(n.pathOptimization4BePushed){case 1:{i.level="SUPER";break}case 0:{i.level="STRONG";break}case 2:{i.level="WEAK";break}}switch(n.currentPathOptimization4BePushed){case"OPTIMIZA_STRONG":{i.inputLevel="SUPER";break}case"OPTIMIZA_WEAK":{i.inputLevel="STRONG";break}case"OPTIMIZA_NONE":{i.inputLevel="WEAK";break}default:{i.inputLevel="NONE";break}}try{i.run(t)}catch(s){throw new Error(s)}return this.wireResult=null,t}shoveHandle(t){let e=this.getInputTracks(),r=this.blockCheck(e);e.length>0&&this.collideClassify(r,e,t)}getInputTracks(){let e=this.getPathList().listIterator(),r=Mr.getInstance(),i=new Array;for(;e.hasNext();){let n=e.next();r.getStatus(n).isInput&&i.push(n.item)}return i}blockCheck(t){let e=new Map;for(let r of t){let i=this.repairBlock.checkOutLineBlock(r);e.set(r,i)}return e}collideClassify(t,e,r){let i=e[0].start,n=e[e.length-1].end;for(let[s,a]of t)for(let l of a){let c=this.repairBlock.checkOutLineAndModel(l.obstacle,i),h=this.repairBlock.checkOutLineAndModel(l.obstacle,n);if(c!=h&&this.sceneClassify(l.obstacle,l.point,s,r))return}}sceneClassify(t,e,r,i){if(t.layerId==11){if(this.canSplit())return this.splitPath(r,e,i),!0;wt.ignores.add(t)}else if(t.type=="Partition")return this.splitPath(r,e,i),!0;return!1}canSplit(){let t=this.getPathList();return t.otherNode.next==null&&(t.viaNode.next==null||t.viaNode.next!=null&&!t.viaNode.next.isSource)||t.otherNode.prev==null&&(t.viaNode.prev==null||t.viaNode.prev!=null&&!t.viaNode.prev.isSource)}splitPath(t,e,r){let i=new Zr,n=i.createList(),s=i.createTrack(t.layerId,t.start,e,t.width,t.showNet,r,t.getGroupID()),a=i.createTrack(t.layerId,e,t.end,t.width,t.showNet,r,t.getGroupID());i.addList(s,n,r),i.addList(a,n,r),this.wireResult.setInputStatus(n);let c=At.getInstance().getNode(t);n.replace(c,c),r.addCommand(new mi(n));let h=At.getInstance().getNode(a),u=h.parent.getLastNode();for(;h!=null;){let d=Mr.getInstance().getStatus(h);if(d.isInput=!1,d.isSource=!0,d.notChange=!0,h==u)break;h=h.next}}generateTrackInfoByItem(t,e){let r=t.layerId,i=t.end.sub(t.start).normalize(),n=!0,s=no.getSignalLayerIds(null,r),a=new Ly(new Set(s),r,t.start,i,n,null),l=new Ly(new Set(s),r,e.end,i,n,null),c=new v0(t.net,t.width,t.layerId,i,!1);return c.start=a,c.end=l,c}};wj.needclearWireCache=!0;var Np=wj;var jne=class{constructor(){this.adsorp=null;this.blockShape=new ms;wt.setPushFilter()}checkTrackIntersection(t){return t?!(this.blockTrack(t).distance1(t.end)>1e-8):!0}blockTrack(t,e=!0){if(t.length==0)return e?t.end:t.start;let r=t.primitive;e||(r=pp(r));let i=this.blockShape.blockTrackPrimitive(t,r,!0,!1)[0];return i?(this.adsorp=i,i.point):r.end()}getEnd4Block(t){let e=this.adsorp.info.shape.outline,r=t.angle(S.ORIGIN),i=Ae.rotateZ(-r),n=e.multiply3(i.toMatrix3()).bbox();return[n.UL().multiply3(Qe.rotate(r)),n.LL().multiply3(Qe.rotate(r)),n.LR().multiply3(Qe.rotate(r)),n.UR().multiply3(Qe.rotate(r))]}};var k3=class{constructor(t){this.repairLineBlockMax=100;this.blockPrev=!0;this.blockCurr=!0;this.blockNext=!0;this.blockAdsorb=new jne;this.event=t}updateBlock(){return null}block(){return null}setPre(t){this.previous=t}setNext(t){this.next=t}setCurr(t){this.current=t}isBlock(){return!this.blockPrev||!this.blockNext}blockBaseTrack(t,e,r,i,n=!0){if(!t)return;let s=this.blockAdsorb.blockTrack(t,n),a=n?t.end:t.start;if(s.distance2(a)>1e-8&&e){let l=this.blockAdsorb.getEnd4Block(r);xe.addAll(i,l),i.push(s)}}sortEnds(t,e){let r=e.map(i=>{let s=er.foot(t,i).distance2(i);return{point:i,dis:s}});return Er(r,(i,n)=>i.dis-n.dis,0,r.length),r.map(i=>i.point)}getEnd(t,e){let r=Number.MAX_VALUE,i=e[0];for(let n of e){let a=er.foot(t,n).distance2(n);ne.less(a,r)&&(r=a,i=n)}return i}checkOutLineBlock(t,e=!0){let r=new ms,i=r.clearanceUtils.getMaxClearance(),n=t.primitive.bbox().extendOfSize(i+t.width/2),s=wt.searchOutline(n).filter(h=>h.layerId==11&&h instanceof or?h.getMathGraphics().isClose():!1),a=new Qu(s),l=t.primitive;return e||(l=pp(l)),r.blockTrack4Shapes(t,l,!0,a)}checkOutLineAndModel(t,e){let r=t.getMathGraphics();return jr.inPolygon(e,r instanceof Bt?r.items:[r.asClose()])}getBlockPoint(t,e,r){let i=r?t.start:t.end,n,s=Number.MAX_VALUE;return e.forEach(a=>{let l=a.point,c=l.distance2(i);c<s&&(n=l,s=c)}),n}};var Xne=class extends k3{constructor(e){super(e);this.blockNum=-1;this.moveStart=!0;let r=e.trackNode;this.setCurr(r.item),this.updateBlock()}setMoveStart(e){this.moveStart=e}updateBlock(){this.blockNext=this.blockAdsorb.checkTrackIntersection(this.next),this.blockCurr=this.blockAdsorb.checkTrackIntersection(this.current)}block(){if(this.blockNum>this.repairLineBlockMax)return this.blockNum=-1,null;let e;this.blockAdsorb.adsorp=null;let r=!this.moveStart;if(this.current){let i=this.blockAdsorb.blockTrack(this.current,r),n=this.current.end;r||(n=this.current.start),i&&i.distance2(n)>1e-8&&this.blockCurr&&(e=i)}if(this.next&&!e){let i=this.blockAdsorb.blockTrack(this.next,r),n=this.next.end;r||(n=this.next.start),i&&i.distance2(n)>1e-8&&(e=i)}return e?this.blockNum++:this.blockNum=-1,e}};var qne=class extends Np{constructor(e){super(e);this.moveStart=!0;this.next=new M(this.event.oldStart,this.event.oldStart),this.repairBlock=new Xne(e)}movePointOffset(e,r){let i;r?i=this.event.oldStart.add(e):i=this.event.oldEnd.add(e),this.modifyPoint(i,r)}moveOffset(){}moveByIntercept(e,r,i,n){if(this.moveStart=n,e.some(s=>s.length()>1e-8)){this.moveInit();let s=this.event.trackNode,a=s.item.primitive,l=er.foot(new M(a.start(),a.end()),e[0].start()),c=new Zl(l,r,e).result;if(c.length){let h=c[0].end(),u=n?this.event.oldEnd:this.event.oldStart,d=h.sub(u);if(i.dot(d)>-1e-8&&Math.abs(i.cross(d))<1e-8){let p=[u];for(let m of c)p.push(m.end());return p=p.length>3?p.slice(0,4):p,n&&p.reverse(),this.repairBlock.setMoveStart(this.moveStart),this.changePath(p,s.item),!0}}this.moveEnd()}return!1}move(e,r){}modifyPoint(e,r){this.moveInit();let i=this.event.trackNode.item;this.moveStart=r,this.event.oldStart.equals(i.start)||(this.moveStart=!r),this.repairBlock.setMoveStart(this.moveStart),e=this.event.adsorb(e,i.width,i.layerId),this.moveStart?this.modifyStart(e):this.modifyEnd(e)}block(){let e,r=this.event.adsorpTrackSetting;if(this.event.adsorpTrackSetting=!1,this.isBlock())e=this.repairBlock.block();else if(this.isPush()){this.shove();let i=this.getPathList();this.moveStart?this.event.start=i.getFirst().start:this.event.end=i.getLast().end}return this.event.adsorpTrackSetting=r,e}modifyStart(e){let r=this.event.trackNode.item,i=r.end,n=this.event.start.sub(this.event.end).normalize(),s=this.draw(i,e,n).reverse();this.event.start=s[1],this.changePath(s,r)}modifyEnd(e){let r=this.event.trackNode.item,i=this.event.end.sub(this.event.start).normalize(),n=this.draw(r.start,e,i);this.event.end=n[1],this.changePath(n,r)}changePath(e,r){let i=new Zr,n=i.createList();for(let h=1;h<e.length;h++){let u=e[h-1],d=e[h],p=i.createTrack(r.layerId,u,d,r.width,r.showNet,this.command,r.getGroupID());i.addList(p,n,this.command)}let s,a=Array.from(e);this.moveStart?(s=n.getLast().globalIndex,a.reverse(),this.repairBlock.setCurr(n.getLast()),this.repairBlock.setNext(n.getFirst()),this.event.start=e[1]):(this.repairBlock.setCurr(n.getFirst()),this.repairBlock.setNext(n.getLast()),s=n.getFirst().globalIndex,this.event.end=e[1]);let l=a[1];this.next=new M(l,l),a.length>2&&(this.next=new M(l,a[a.length-1])),this.getWireResult(),this.wireResult.setInputStatus(n),n.replace(this.event.trackNode,this.event.trackNode),this.command.addCommand(new mi(n)),Cr.getInstance().current.setTrackSelect(s);let c=this.moveEnd();c&&this.modifyPoint(c,this.moveStart)}draw(e,r,i){let s=new Xn().degree45(i,e,r);return this.next=new M(s[1],s[2]),s}complete(){let e,r=this.getPathList();this.moveStart?e=r.getFirst().globalIndex:e=r.getLast().globalIndex,super.complete(),this.event.resultId=e}};var $ne=class extends k3{constructor(e,r,i,n,s){super(e);this.blockNum=-1;this.rangeStart=s,this.angleType=n,this.setPre(r),this.setNext(i),this.updateBlock()}setDirect(e){this.endDirect1=e}setNext2(e){this.next2=e}updateBlock(){this.blockPrev=this.blockAdsorb.checkTrackIntersection(this.previous),this.blockNext=this.blockAdsorb.checkTrackIntersection(this.next),this.blockCurr=this.blockAdsorb.checkTrackIntersection(this.current)}block(){if(this.blockNum>this.repairLineBlockMax)return this.blockNum=-1,null;let e;if(this.blockAdsorb.adsorp=null,(!this.blockPrev||!this.blockNext||!this.blockCurr)&&this.updateBlock(),this.angleType==2){if(this.previous){let r=this.blockAdsorb.blockTrack(this.previous),i=this.previous.end;r.distance2(i)>1e-8&&this.blockPrev&&(e=r)}if(this.next&&!e){let r=this.blockAdsorb.blockTrack(this.next),i=this.next.end;r.distance2(i)>1e-8&&this.blockNext&&(e=r)}if(this.current&&this.next2&&!e){let r=this.blockAdsorb.blockTrack(this.current),i=this.blockAdsorb.blockTrack(this.next2,!1),n=r.distance2(this.current.end)>1e-8,s=i.distance2(this.next2.start)>1e-8;if(n&&s){let a=r.sub(this.current.start),l=this.rangeStart.sub(this.current.start),c=i.sub(this.next2.end),h=this.rangeStart.sub(this.next2.end);Math.abs(a.cross(l))>Math.abs(c.cross(h))?e=r:e=i}else n&&!s?e=r:!n&&s&&(e=i)}}else{let r=new Array;if(this.blockBaseTrack(this.previous,this.blockPrev,this.endDirect1,r),this.blockBaseTrack(this.next,this.blockNext,this.endDirect1,r),this.blockBaseTrack(this.current,this.blockCurr,this.endDirect1,r),r.length>0){let i=new M(this.rangeStart,this.rangeStart.add(this.endDirect1));e=this.getEnd(i,r)}}return e?this.blockNum++:this.blockNum=-1,e}};var Kne=class extends Np{constructor(e,r,i){super(e);this.adsorb=!0;this.angleType=r;let n=this.event.trackNode.item,s=i;this.event.oldStart.equals(n.start)||(s=!s),this.moveStart=s;let a=this.track1Node=s?this.event.trackNode.prev:this.event.trackNode,l=this.track2Node=s?this.event.trackNode:this.event.trackNode.next,c=a.item,h=l.item,u=new _e;u.ext1(c.buildBBox()).ext1(h.buildBBox()),this.bbox=u.build1();let d=c.primitive,p=h.primitive;this.direct1=d.direct,this.direct2=p.direct,this.endDirect1=p.direct,this.endDirect2=d.direct;let m=d.direct.cross(p.direct);switch(r){case 0:{if(Math.abs(this.direct1.x)<1e-8||Math.abs(this.direct2.x)<1e-8)this.endDirect1=new S(1,0);else if(Math.abs(this.direct1.y)<1e-8||Math.abs(this.direct2.y)<1e-8)this.endDirect1=new S(0,1);else if(s){let y=new S(-this.direct2.y,this.direct2.x);this.endDirect1=y.mul(this.direct1.dot(y)).normalize()}else{let y=new S(-this.direct1.y,this.direct1.x);this.endDirect1=y.mul(this.direct2.dot(y)).normalize()}let g=d.direct.cross(this.endDirect1);m*g<0&&(this.endDirect1=this.endDirect1.mul(-1));break}case 1:{this.endDirect1=d.direct.add(p.direct);break}case 2:default:break}if(this.rangeEnd1=d.start(),this.rangeStart=d.end(),this.rangeEnd2=p.end(),this.repairBlock=new $ne(e,c,h,r,this.rangeStart),this.angleType==0||this.angleType==1){let g=this.generateLine(d,this.bbox),y=this.generateLine(p,this.bbox),b=this.bbox.width()+this.bbox.height()+1e4,P=this.getLine2(this.rangeEnd1,this.endDirect1,b),T=this.getLine2(this.rangeEnd2,this.endDirect1,b),I=this.getIntersection(g,T),C=this.getIntersection(y,P);I!=null&&this.inRange(I,c.start,c.end)?this.rangeEnd1=I:this.rangeEnd2=C}this.repairBlock.setDirect(this.endDirect1)}getLine2(e,r,i=1e4){let n=r.normalize().mul(i+r.length());return new M(e.sub(n),e.add(n))}generateLine(e,r){let i=r.width()+r.height()+1e3,n=e.direct.mul(i),s=e.start().sub(n),a=e.end().add(n);return new M(s,a)}inRange(e,r,i){return!!(this.sameDirect(e,r,i)&&this.sameDirect(e,i,r))}sameDirect(e,r,i){let n=e.sub(r).normalize(),s=i.sub(r).normalize();return n.dot(s)>=0}move(e){if(Gr.replay?e=Gr.position||e:Gr.position=e,Gr.pause){Gr.play4Next();return}this.moveInit(),this.track1Node=this.moveStart?this.event.trackNode.prev:this.event.trackNode,this.track2Node=this.moveStart?this.event.trackNode:this.event.trackNode.next;let r=this.event.trackNode.item;this.adsorb&&(e=this.event.adsorb(e,Math.max(r.width/2,.1),r.layerId));let i=!1;this.angleType==1&&(i=!0),i&&this.fixRightAngleLine();let n=new _e().ext1(this.bbox).ext2(e).build1(),s=n.width()+n.height()+1e4,a=this.generateLine(this.track1Node.item.primitive,n),l=this.generateLine(this.track2Node.item.primitive,n),c=this.getLine2(e,this.endDirect1,s),h=null;this.angleType==2?h=this.getLine2(e,this.endDirect2,s):(this.angleType==1||this.angleType==0)&&(h=c);let u=this.getIntersection(c,a),d=this.getIntersection(h,l);if(u!=null||d!=null){let p=this.inRange(u,this.rangeEnd1,this.rangeStart),m=this.inRange(d,this.rangeStart,this.rangeEnd2),g=this.rangeStart.sub(u).normalize(),y=d.sub(this.rangeStart).normalize(),b=g.dot(this.direct1),P=y.dot(this.direct2);p&&!m?P>0?((this.angleType==1||this.angleType==0)&&(u=this.rangeEnd1),d=this.rangeEnd2):(u=this.rangeStart,d=this.rangeStart):!p&&m?b>0?((this.angleType==1||this.angleType==0)&&(d=this.rangeEnd2),u=this.rangeEnd1):(u=this.rangeStart,d=this.rangeStart):!p&&!m&&(b>0&&P>0?(u=this.rangeEnd1,d=this.rangeEnd2):(u=this.rangeStart,d=this.rangeStart));let T=[];if(T.push(this.track1Node.item.start),this.angleType==2){c=this.getLine2(u,this.endDirect1,s),h=this.getLine2(d,this.endDirect2,s);let I=this.getIntersection(c,h);T.push(u,I,d)}else T.push(u,d);T.push(this.track2Node.item.end),this.createByPoint(T)}}block(){let e,r=this.event.adsorpTrackSetting;return this.event.adsorpTrackSetting=!1,this.isBlock()?e=this.repairBlock.block():this.isPush()&&this.shove(),this.event.adsorpTrackSetting=r,e}moveOffset(e){}createByPoint(e){let r=new Zr,i=r.createList(),n=this.track1Node.item,s=n;for(let h=1;h<e.length;h++){h>2&&(s=this.track2Node.item);let u=e[h-1],d=e[h],p=r.createTrack(n.layerId,u,d,n.width,n.showNet,this.command,s.getGroupID());r.addList(p,i,this.command)}let a;this.moveStart?a=i.getLast():a=i.getFirst();let l=i.getFirstNode().next;this.repairBlock.setCurr(l.item),i.size()==4&&this.repairBlock.setNext2(l.next.item),this.getWireResult(),this.wireResult.setInputStatus(i),i.replace(this.track1Node,this.track2Node),this.command.addCommand(new mi(i)),this.event.start=a.start,this.event.end=a.end,Cr.getInstance().current.setTrackSelect(a.globalIndex);let c=this.moveEnd();c&&this.move(c)}fixRightAngleLine(){let e=this.direct1,r=this.direct2,i=Math.sqrt(2)/2,n=new S(1,0),s=new S(i,i),a=new S(0,1),l=new S(-i,i),c=[n,s,a,l],h=[e,r],u=e,d=!0,p=!0;for(let O=0;O<2;O++){let _=h[O];for(let x of c){let v=x.cross(_);if(this.kit.lesseq(Math.abs(v),dl)){u=x,d=!1,O==0?p=!0:p=!1;break}}if(!d)break}let m=this.bbox.width()+this.bbox.height()+1e4,g=new S(-u.y,u.x),y=this.track1Node,b=this.track2Node,P=y.item.primitive,T=b.item.primitive,I=this.getLine2(P.start(),p?u:g,m),C=this.getLine2(T.end(),p?g:u,m),E=this.getIntersection(I,C);if(E!=null){let O=[P.start(),E,T.end()],_=new Zr,x=_.createList(),v=this.event.trackNode.item;for(let F=1;F<O.length;F++){let H=O[F-1],z=O[F],V=_.createTrack(v.layerId,H,z,v.width,v.showNet,this.command,v.getGroupID());_.addList(V,x,this.command)}this.track1Node=x.getFirstNode(),this.track2Node=x.getLastNode(),this.getWireResult(),this.wireResult.setInputStatus(x),x.replace(y,b),this.command.addCommand(new mi(x));let D=this.track1Node.item.primitive,w=this.track2Node.item.primitive;this.rangeStart=E,this.endDirect1=D.direct.add(w.direct),this.repairBlock.setDirect(this.endDirect1)}}};var TR=class extends dh{constructor(e,r){super();this.oldTrackIds=[];this.path=[];this.oldPoints=[];this.oldTrackIds=e,this.oldPoints=r}addLine(e){this.path.push(e)}displayPath(e){var r;(r=this.path[e])==null||r.display(),A.publish("updateFrame","")}display(){for(let e of this.path)e.display()}remove(){for(let e of this.path)e.remove()}};var Zne=class extends k3{constructor(e,r,i){var s,a;super(e);this.blockNum=-1;let n=e.trackNode;this.hasPrev=n.prev?!0:r,this.hasNext=n.next?!0:i,this.setPre((s=n.prev)==null?void 0:s.item),this.setNext((a=n.next)==null?void 0:a.item),this.setCurr(n.item),this.updateBlock()}updateBlock(){this.blockPrev=this.oldPreviousWire?this.blockAdsorb.checkTrackIntersection(this.oldPreviousWire):!0,this.blockNext=this.oldNextWire?this.blockAdsorb.checkTrackIntersection(this.oldNextWire):!0}setNeedUpdatePre(e){this.oldPreviousWire=e}setNeedUpdateNext(e){this.oldNextWire=e}setOldPre(e,r){e&&r?this.oldPre=new M(e,r):this.oldPre=null}setOldNext(e,r){e&&r?this.oldNext=new M(e,r):this.oldNext=null}block(){if(this.blockNum>this.repairLineBlockMax)return this.blockNum=-1,null;let e;this.blockAdsorb.adsorp=null;let r=new Array;if(this.hasPrev&&this.hasNext){let i=new Array,n=new Array;if(this.blockBaseTrack(this.previous,this.blockPrev,this.event.direct,i),this.blockBaseTrack(this.next,this.blockNext,this.event.direct,n,!1),this.blockBaseTrack(this.current,this.blockCurr,this.event.direct,r),r.length>0||i.length>0||n.length>0){let s=[];if(i.length>0&&this.oldPre){let l=this.getEnd(new M(this.oldPre.start(),this.oldPre.end()),i),c=this.getVerticalLen(l,this.previous.start,this.previous.end);s.push(this.event.start.add(c))}else s.push(...i);if(n.length>0&&this.oldNext){let l=this.getEnd(new M(this.oldNext.start(),this.oldNext.end()),n),c=this.getVerticalLen(l,this.next.start,this.next.end);s.push(this.event.start.add(c))}else s.push(...n);if(r.length>0){let l=this.getEnd(new M(this.event.oldStart,this.event.oldEnd),r);s.push(l)}e=this.getEnd(new M(this.event.oldStart,this.event.oldEnd),s).sub(this.event.oldStart)}}else if(this.hasPrev||this.hasNext){this.blockCurr||(this.blockCurr=this.blockAdsorb.checkTrackIntersection(this.current));let i=this.getCheckEnd();if(this.current){let c=this.blockAdsorb.blockTrack(this.current,i),h=i?this.current.end:this.current.start;c.distance2(h)>1e-8&&this.blockCurr&&(i?(this.current.end=c,this.event.end=c):(this.current.start=c,this.event.start=c))}let n,s,a=!1,l;if(this.previous?(this.blockPrev||(this.blockPrev=this.blockAdsorb.checkTrackIntersection(this.previous)),n=this.previous.end,l=this.previous.start,s=this.blockAdsorb.blockTrack(this.previous),a=this.blockPrev):this.next&&(this.blockNext||(this.blockNext=this.blockAdsorb.checkTrackIntersection(this.next)),n=this.next.start,l=this.next.end,s=this.blockAdsorb.blockTrack(this.next,!1),a=this.blockNext),a&&s.distance2(n)>1e-8){let c=this.blockAdsorb.getEnd4Block(this.event.direct);s=this.getInRangePoint(l,s,c,this.event.direct),e=s.sub(i?this.event.oldEnd:this.event.oldStart)}}return e?this.blockNum++:this.blockNum=-1,e}getVerticalLen(e,r,i){let n=e.sub(r),s=i.sub(r).normalize(),a=n.dot(s);return n.sub(s.mul(a))}getInRangePoint(e,r,i,n){let s=r,a=new M(e,r);for(let l of i){let c=this.getPoint4Line(l,a,n);c!=null&&s.distance2(e)>c.distance2(e)&&(s=c)}return s}getCheckEnd(){return!!this.hasPrev}getPoint4Line(e,r,i){let n=new _e().ext1(r.bbox()).ext2(e).ext7(100).build1(),s=n.width()+n.height(),a=this.getLine(e,e.add(i),s),l=this.getLine(r.start(),r.end(),s);return this.getIntersection(a,l)}getLine(e,r,i=1e3){let n=r.sub(e),s=n.normalize().mul(i+n.length());return new M(e.sub(s),e.add(s))}getIntersection(e,r){return Pt(e,r)>0?new S(Ee[0],Ee[1]):null}};var OS=class extends Np{constructor(t){super(t),this.lastMouseOffset=this.event.lastRealMousePosition.sub(this.event.start),this.updateNode();let{startType:e,endType:r}=this.updatePointType();this.startIsOther=this.isConnectOther(e),this.endIsOther=this.isConnectOther(r),this.handleAddSnapFlag(this.event.trackNode,e,r),this.repairBlock=new Zne(t,this.startIsOther,this.endIsOther)}updatePointType(){let t=this.start==this.pathList.getFirstNode()?this.pathList.startType:8,e=this.end==this.pathList.getLastNode()?this.pathList.endType:7;return{startType:t,endType:e}}updateNode(){let t=this.event;this.start=t.trackNode,this.end=t.trackNode;let e=t.trackNode,r=t.track.width;for(;e;){let i=e;e=e.prev;let n=e==null?void 0:e.item;if(n==null){this.start=i;break}(n instanceof Ii||Math.abs(n.width-r)>.01)&&(e=null,this.start=i)}for(e=t.trackNode;e;){let i=e;e=e.next;let n=e==null?void 0:e.item;if(n==null){this.end=i;break}(n instanceof Ii||Math.abs(n.width-r)>.01)&&(e=null,this.end=i)}}block(){let t,e=this.event.adsorpTrackSetting;return this.event.adsorpTrackSetting=!1,this.isBlock()?(this.repairBlock.updateBlock(),this.repairBlock.isBlock()?this.around().wireMap.forEach(i=>{this.updatePointByPathList(i)}):t=this.repairBlock.block()):this.isPush()&&this.shove().wireMap.forEach(i=>{this.updatePointByPathList(i)}),this.event.adsorpTrackSetting=e,t}updatePointByPathList(t){let e=Number.MAX_VALUE,r=this.event.start,i=t.getAllItems();i.find(a=>{let l=new M(this.event.start,this.event.start),h=new er(a.primitive,l).getDistance();return ne.eq(h,0)?(r=this.event.start,!0):(ne.lesseq(h,e)&&(r=a.start,e=h),!1)});let n=Number.MAX_VALUE,s=this.event.end;i.reverse().find(a=>{let l=new M(this.event.end,this.event.end),h=new er(a.primitive,l).getDistance();return ne.eq(h,0)?(s=this.event.end,!0):(ne.lesseq(h,n)&&(s=a.end,n=h),!1)}),this.event.start=r,this.event.end=s}move(t,e){if(this.lock())return;if(Gr.replay?t=Gr.position||t:Gr.position=t,Gr.pause){Gr.play4Next();return}let r=this.getOffset(e,this.lastMouseOffset)||t;this.moveOffset(r)}calculateStretch(t,e){var V,W,L,k,N,U;let{startNode:r,endNode:i}=this.addGuideLineForConnectOther(t,e);Mi.getInstance().view4Status(Cr.getInstance().current);let n=t.item,s=n.direct,a=this.getNormalOffset(s,e).normalize();this.direct=a;let l=this,c=t.parent,h=this.startIsOther,u=this.endIsOther,d=this,{resPre:p,resNext:m}=this.calculateMoveRange({offset:e,pathNode:t}),g=H(p.i,!0),y=H(m.i,!1),b=this.getLimit4Offset(this.bbox,e),P=w(g,p.cursor,p.record),T=F(y,m.cursor,m.record);if(g!=p.i||y!=m.i){if(p.endPointCursor<m.endPointCursor){let B=w(g,p.endPointCursor),G=F(y,p.endPointCursor),Y=G.midPoint.sub(B.midPoint),X=Y.length()*z(Y,s),K=G.midPoint;for(let ce=G.index;ce!=null;ce=this.getNextNode(ce)){if(ce==t)continue;let te=ce.item.primitive;if(this.isCollinear(te,n.primitive)&&K.equals(te.start())){let oe=z(te.direct,s);X+=te.length()*oe,K=te.end(),T.index=ce}if(ce==m.i)break}let J=B.midPoint;for(let ce=B.index;ce!=null;ce=this.getPreNode(ce)){if(ce==t)continue;let te=ce.item.primitive;if(this.isCollinear(te,n.primitive)&&J.equals(te.end())){let oe=z(te.direct,s);X+=te.length()*oe,J=te.start(),P.index=ce}if(ce==this.start)break}let se=T.start.sub(s.mul(X));P={...P,start:se,midPoint:se,end:se}}else if(p.endPointCursor>m.endPointCursor){let B=w(g,m.endPointCursor),G=F(y,m.endPointCursor),Y=G.midPoint.sub(B.midPoint),X=Y.length()*z(Y,s),K=B.midPoint;for(let ce=B.index;ce!=null;ce=this.getPreNode(ce)){if(ce==t)continue;let te=ce.item.primitive;if(this.isCollinear(te,n.primitive)&&K.equals(te.end())){let oe=z(te.direct,s);X+=te.length()*oe,K=te.start(),P.index=ce}if(ce==P.index)break}let J=G.midPoint;for(let ce=G.index;ce!=null;ce=this.getNextNode(ce)){if(ce==t)continue;let te=ce.item.primitive;if(this.isCollinear(te,n.primitive)&&J.equals(te.start())){let oe=z(te.direct,s);X+=te.length()*oe,J=te.end(),T.index=ce}if(ce==this.end)break}let se=P.end.add(s.mul(X));T={...T,end:se,midPoint:se,start:se}}}else D();this.repairBlock.setNeedUpdatePre((V=P.index)==null?void 0:V.item),this.repairBlock.setNeedUpdateNext((W=T.index)==null?void 0:W.item),h&&P.index==r&&(P.start=P.index.item.end,this.repairBlock.setNeedUpdatePre(null)),u&&T.index==i&&(T.end=T.index.item.start,this.repairBlock.setNeedUpdateNext(null));let I=O([P.start,P.midPoint,P.end]),C=O([T.start,T.midPoint,T.end]),E=[].concat(I,C);this.event.start=P.end,this.event.end=T.start;function O(B){let G;return B=B.filter(Y=>G&&Y.equals(G)?!1:(G=Y,!0)),B}let _=new Zr,x=_.createList();E.length==1&&E.push(E[0]);let v=null;for(let B=1;B<E.length;B++){let G=E[B-1],Y=E[B],X=_.createTrack(n.layerId,G,Y,n.width,n.showNet,this.command),K=_.addList(X,x,this.command);if(G.equals(this.event.start)&&Y.equals(this.event.end)){v=K,X.setGroupID(n.getGroupID());continue}if(v){let J=(L=T.index)==null?void 0:L.item.getGroupID();J&&X.setGroupID(J)}else{let J=(k=P.index)==null?void 0:k.item.getGroupID();J&&X.setGroupID(J)}}if(this.getWireResult(),this.wireResult.setInputStatus(x),h&&P.index!=r){let B=_.createList();B.replace(r,r),this.command.addCommand(new mi(B))}if(u&&T.index!=i){let B=_.createList();B.replace(i,i),this.command.addCommand(new mi(B))}return this.replaceLine(x,P,T),this.repairBlock.setPre((N=v==null?void 0:v.prev)==null?void 0:N.item),this.repairBlock.setNext((U=v==null?void 0:v.next)==null?void 0:U.item),this.repairBlock.setCurr(v==null?void 0:v.item),c;function D(){let B=new M(P.midPoint,P.end),G=new M(T.midPoint,T.start),Y=l.getIntersection(B,G);if(Y)P.end=Y,T.start=Y;else{let X=T.index,K=l.checkIntersection(B,X.item.primitive,b,!0);if(K){P.end=K,T.start=K,T.midPoint=K;return}let J=P.index,se=l.checkIntersection(G,J.item.primitive,b,!1);se&&(T.start=se,P.end=se,P.midPoint=se)}}function w(B,G,Y=S.ORIGIN){let X=l.getCurrent(a.mul(G),n.primitive,b),K=l.calculatePreviousIntersection(t,B,X,b),se=K.index.item.start,ce=K.point,te=ce.add(Y);return{index:K.index,start:se,midPoint:ce,end:te}}function F(B,G,Y=S.ORIGIN){let X=l.getCurrent(a.mul(G),n.primitive,b),K=l.calculateNextIntersection(t,B,X,b),se=K.index.item.end,ce=K.point,te=ce.add(Y);return{index:K.index,end:se,midPoint:ce,start:te}}function H(B,G){return B==null?G?d.start:d.end:B}function z(B,G){return B.dot(G)>0?1:-1}}replaceLine(t,e,r){t.replace(e.index,r.index),this.command.addCommand(new mi(t))}calculatePreviousIntersection(t,e,r,i){for(let n=this.getPreNode(t);n!=null;n=this.getPreNode(n)){let s=this.checkIntersection(r,n.item.primitive,i,!1);if(s!=null)return{index:n,point:s};if(n==e)break}return{index:e,point:e.item.start}}calculateNextIntersection(t,e,r,i){for(let n=this.getNextNode(t);n!=null;n=this.getNextNode(n)){let s=this.checkIntersection(r,n.item.primitive,i,!0);if(s!=null)return{index:n,point:s};if(n==e)break}return{index:e,point:e.item.end}}checkIntersection(t,e,r,i){if(e instanceof M){let n=t.direct,s=e.direct,a=n.cross(s);if(Math.abs(a)>1e-4){let l=this.getLine(e.start(),e.end(),r),c=this.getIntersection(t,l);if(c!=null){let h=e.start(),u=e.end();if(i?(h=c,this.kit.eq(c.distance1(u),0)&&(h=u)):(u=c,this.kit.eq(c.distance1(h),0)&&(u=h)),u.sub(h).normalize().dot(s)>=0)return c}}}return null}getCurrent(t,e,r){let i=e.direct,n=this.getNormalOffset(i,t),s=e.start().add(n),a=e.end().add(n);return this.getLine(s,a,r)}calculateMoveRange(t){let e=this,{offset:r,pathNode:i,noOverNormalLength:n}=t,s=this.bbox,a=this.getLimit4Offset(s,r),l={i:this.getPreNode(i),cursor:0,record:S.ORIGIN,endPointCursor:0},c={i:this.getNextNode(i),cursor:0,record:S.ORIGIN,endPointCursor:0},h={resPre:l,resNext:c},u=i.item,d=u.direct,p=this.getNormalOffset(d,r),m=p.length(),g=p.normalize();if(this.kit.eq(m,0))return h;let y=u.start,b=u.start,P=m,T=m,I=!1,C=!1,E=W.call(this,i,!0),O=W.call(this,i,!1),_=!0,x=!0,v=null,D=null,w=0;for(;(l.cursor<P||c.cursor<T)&&!(v==l.i&&D==c.i);){v=l.i,D=c.i;let L=l.i,k=c.i,N=this.getEndpointInfo(L,k,a),U=N.filter(oe=>oe.type=="PREVIOUS")[0],B=N.filter(oe=>oe.type=="NEXT")[0],G=N.filter(oe=>oe.type=="INTERSECTION")[0];U&&this.calculateEndpointProject([U],y,d,g),B&&this.calculateEndpointProject([B],b,d,g);let Y=!1,X=!1;if((x||_)&&(Y=this.minCornerDealCanMove(L,E,i,m,g,U,l,!0),X=this.minCornerDealCanMove(k,O,i,m,g,B,c,!1)),_){let oe=V.call(this,L,E,i,P,U,l,!0);l=oe.res,P=oe.vLength,I=oe.springBack}if(x){let oe=V.call(this,k,O,i,T,B,c,!1);c=oe.res,T=oe.vLength,C=oe.springBack}U&&U.projectSameDirect&&(U.projection+=l.cursor),B&&B.projectSameDirect&&(B.projection+=c.cursor);let K=l.i,J=c.i,se=N.filter(oe=>!(c.cursor>=T&&oe.type=="NEXT"));l.cursor=this.getCursor(se,P),this.kit.eq(l.cursor,P)&&(l.cursor=P),Y&&(w=l.cursor),y=u.start.add(g.mul(l.cursor)),l.i!=null&&(l.endPointCursor=l.cursor),!I&&U&&U.projectSameDirect&&this.kit.lesseq(U.projection,l.cursor)&&(l.i=this.getNi(l.i,!0));let ce=N.filter(oe=>!(l.cursor>=P&&oe.type=="PREVIOUS"));c.cursor=this.getCursor(ce,T),this.kit.eq(c.cursor,T)&&(c.cursor=T),X&&(w=c.cursor),b=u.start.add(g.mul(c.cursor)),c.i!=null&&(c.endPointCursor=c.cursor),!C&&B&&B.projectSameDirect&&this.kit.lesseq(B.projection,c.cursor)&&(c.i=this.getNi(c.i,!1)),_=K!=l.i,x=J!=c.i;let te=!1;if(L&&k&&G){let oe=G.point,$=this.calculateProjectionLength(L.item.end,u.start,d,g),fe=this.calculateProjectionLength(k.item.start,u.start,d,g),Oe=Math.max($,fe),Te=u.start.add(g.mul(Oe));this.calculateEndpointProject([G],Te,d,g);let ue=this.calculateProjectionLength(oe,u.start,d,g);if(G.projectSameDirect){let be=!1;(!I&&this.kit.greatereq(l.cursor,ue)||this.kit.greatereq(z(l),ue))&&(be=!0),(!C&&this.kit.greatereq(c.cursor,ue)||this.kit.greatereq(z(c),ue))&&(be=!0),be&&(l.cursor=ue,c.cursor=ue,l.endPointCursor=ue,c.endPointCursor=ue,l.record=S.ORIGIN,c.record=S.ORIGIN,te=!0)}}if(te=this.fixBreak(c,l,te),te)break}let F=z(l),H=z(c);if(!n&&!this.kit.eq(F,H)){let L=Math.min(F,H),k=Math.max(L,w);return t.offset=g.mul(k),this.calculateMoveRange({...t,noOverNormalLength:!0})}return l.record.equals(S.ORIGIN)?this.repairBlock.setOldPre(void 0,void 0):E&&E.item&&this.repairBlock.setOldPre(E.item.start,E.item.end),c.record.equals(S.ORIGIN)?this.repairBlock.setOldNext(void 0,void 0):O&&O.item&&this.repairBlock.setOldNext(O.item.start,O.item.end),{resPre:l,resNext:c};function z(L){return L.cursor-Math.abs(L.record.dot(g))}function V(L,k,N,U,B,{i:G,cursor:Y,record:X,endPointCursor:K},J){if(!L&&!k)return{springBack:!1,vLength:U,res:{i:G,cursor:Y,record:X,endPointCursor:K}};let se=this.getNi(G,J),ce=k==null?void 0:k.item.primitive,te=L==null?void 0:L.item.primitive,oe=L==null?void 0:L.item,$=N.item.primitive;if(ce instanceof M&&te instanceof M&&this.kit.greater(te.length(),0)){if(B.projectSameDirect&&this.isCollinear(te,ce)){let fe=oe.direct.mul(X.length()),Oe=oe.start,Te=oe.end,ue=new M(Oe,Te.add(fe)),be=this.getTrackMinCorner(ue,$,N.item.width),j=Math.min(be,ue.length()),Z=te.direct;Z.dot(g)>0&&(Z=Z.mul(-1));let ie=B.point.add(Z.mul(j)),de=this.calculateProjectionLength(ie,$.start(),$.direct,g);this.kit.less(de,U)&&(X=Z.mul(j),U=m+Math.abs(X.dot(g)))}if(se==null||!B.projectSameDirect||this.isCollinear(te,$)){let fe=this.getEndPointCursor(te,$,g);if(this.kit.greatereq(m,fe))U=m,X=S.ORIGIN;else if(this.kit.greatereq(U,fe)){if(U=fe,n){let Oe=Math.abs(X.dot(g)),Te=fe-Oe,ue=Math.max(Te,m);Oe&&(X=X.mul((fe-ue)/Oe))}return{springBack:!0,vLength:U,res:{i:G,cursor:Y,record:X,endPointCursor:K}}}}}return{springBack:!1,vLength:U,res:{i:G,cursor:Y,record:X,endPointCursor:K}}}function W(L,k){let N=0,U=L.parent.size(),B=-Math.sqrt(2)/2,G=L.item.primitive,Y=G.direct;for(let X=this.getNi(L,k);X!=null&&N<U;X=this.getNi(X,k)){let K=X.item.primitive,J=k?Y.dot(K.direct.mul(-1)):Y.mul(-1).dot(K.direct);if(!this.isCollinear(K,G)&&J<0&&this.kit.eq(J,B))return X;N++}return null}}fixBreak(t,e,r){return r}minCornerDealCanMove(t,e,r,i,n,s,{i:a},l){if(!t&&!e)return!1;let c=this.getNi(a,l),h=e==null?void 0:e.item.primitive,u=t==null?void 0:t.item.primitive,d=r.item.primitive;if(h instanceof M&&u instanceof M&&this.kit.greater(u.length(),0)&&(c==null&&s.projectSameDirect||this.isCollinear(u,d)||l&&c==this.start&&this.startIsOther&&c||!l&&c==this.end&&this.endIsOther&&c)){let p=this.getEndPointCursor(u,d,n);if(new Rc(.01).greatereq(i,p))return!0}return!1}getNi(t,e){return t?e?this.getPreNode(t):this.getNextNode(t):null}getPreNode(t){return this.getPathPrev(t)}getNextNode(t){return this.getPathNext(t)}getCursor(t,e){let r=new Array;r.push(e);for(let n of t)n.projectSameDirect&&r.push(n.projection);return Math.min(...r)}getPathPrev(t){return t==this.start?null:t==null?void 0:t.prev}getPathNext(t){return t==this.end?null:t==null?void 0:t.next}getEndPointCursor(t,e,r){let i=this.calculateProjectionLength(t.end(),e.start(),e.direct,r),n=this.calculateProjectionLength(t.start(),e.start(),e.direct,r);return Math.max(i,n)}getTrackMinCorner(t,e,r){let n=Ha.getInstance().getTrackMinCorner()*r,s=e.direct,a=new S(-s.y,s.x),l=t.end().sub(t.start()),c=Math.abs(l.dot(s)),h=Math.abs(l.dot(a)),u=Math.max(c,h);if(u>0){let d=n/u;return t.length()*d}return 0}isCollinear(t,e){let r=t instanceof S?t:t.direct,i=e instanceof S?e:e.direct;return this.kit.eq(r.cross(i),0)}calculateEndpointProject(t,e,r,i){for(let n of t){let s=this.calculateProjectionLength(n.point,e,r,i);n.projection=s,n.type=="INTERSECTION"?n.projectSameDirect=this.kit.greater(s,0):n.projectSameDirect=this.kit.greatereq(s,-.001),this.kit.lesseq(s,0)&&(n.projection=0)}}calculateProjectionLength(t,e,r,i){let n=t.sub(e);return this.getNormalOffset(r,n).dot(i)}getEndpointInfo(t,e,r){let i=new Array;if(t!=null&&i.push({point:t.item.start,type:"PREVIOUS",projection:0,projectSameDirect:!1}),e!=null&&i.push({point:e.item.end,type:"NEXT",projection:0,projectSameDirect:!1}),t!=null&&e!=null){let n=this.getLine(t.item.start,t.item.end,r),s=this.getLine(e.item.start,e.item.end,r),a=this.getIntersection(n,s);a!=null&&i.push({point:a,type:"INTERSECTION",projection:0,projectSameDirect:!1})}return i}getLine(t,e,r=1e3){let i=e.sub(t),n=i.normalize().mul(r+i.length());return new M(t.sub(n),t.add(n))}getLimit4Offset(t,e){let r=t.extendOfSize(e.length());return r.width()+r.height()}addGuideLineForConnectOther(t,e){let r=this.startIsOther,i=this.endIsOther,n=t.item,s=n.direct,a=new Zr,l,c;if(r){let h=this.start.item,u=this.calculateAddLine(s,e,h.start,!0),d=a.createTrack(n.layerId,u[0],u[1],n.width,n.showNet,this.command,n.getGroupID());l=this.addFirst(d)}if(i){let h=this.end.item,u=this.calculateAddLine(s.mul(-1),e,h.end,!1),d=a.createTrack(n.layerId,u[0],u[1],n.width,n.showNet,this.command,n.getGroupID());c=this.addList(d)}return{startNode:l,endNode:c}}addFirst(t){let e=this.event.trackNode.parent,r=e.insertBefore(this.start,t);return this.start=r,At.getInstance().set(t,r),this.command.addCommand(new lR(t,e,r)),r}addList(t){let e=this.event.trackNode.parent,r=e.insertAfter(this.end,t);return this.end=r,At.getInstance().set(t,r),this.command.addCommand(new lR(t,e,r)),r}calculateAddLine(t,e,r,i){let n=this.getNormalOffset(t,e),s=n.length(),a=r.add(n).add(t.mul(s)),l=r.sub(a),c=r.add(l.normalize());return i&&([r,c]=[c,r]),[r,c]}getNormalOffset(t,e){let r=new S(-t.y,t.x);return r.mul(e.dot(r))}isConnectOther(t){return t==null?!1:![5,6,0].includes(t)}handleAddSnapFlag(t,e,r){let i=[],n=t.item.primitive,s=n.end().sub(n.start()).angle(S.ORIGIN),a=[0,1,2,11];a.includes(e)&&t.prev&&i.push({center:t.prev.item.start,rotation:s}),a.includes(r)&&t.next&&i.push({center:t.next.item.end,rotation:s});let c=this.getItems().filter(h=>h==t.item?!1:this.isCollinear(n,h.primitive));for(let h of c)i.push({center:h.start,rotation:s});ai.handleAddSnapFlagData(void 0,void 0,i)}getItems(){let t=[],e=this.start;for(;e&&(t.push(e.item),e!=this.end);)e=e.next;return t}getOffset(t,e){if(!t)return null;let r,i=ai.snapToSnapFlag(t,!0);if(i)Gr.replay&&(i=Gr.position),r=i.sub(this.event.oldStart);else{let n=new S(t.sceneX,t.sceneY);Gr.replay&&(n=Gr.position),r=n.sub(this.event.oldStart).sub(e)}return r}moveOffset(t){if(Gr.pause)return;this.moveInit();let e=this.event.trackNode.parent.getAllItems(),r=e.map(a=>a.globalIndex),i=e.map(a=>a.start.toString()+","+a.end.toString());this.debug?(Gr.debug&&Gr.inputDebugGraphics(this.debug),this.debug=new TR(r,i)):this.debug=new TR(r,i);let n=this.event.trackNode.parent;if(this.debug){let a=this.event.trackNode.parent.getAllItems();for(let l of a){let c=new M(l.start,l.end);this.debug.addLine(new Gn(c,{color:fR.GREEN,id:l.globalIndex}))}}this.updateNode(),this.calculateStretch(this.event.trackNode,t);let s=this.moveEnd();s&&this.moveOffset(s)}};var Jne=class extends Np{constructor(e,r,i,n,s){super(e);this.orthogonalFirst=!1;this.moveStart=s;let a=this.event.direct;this.orthogonalFirst=Math.abs(a.cross(new S(0,1)))<dl||Math.abs(a.cross(new S(1,0)))<dl,this.startNode=At.getInstance().getNode(r[0]),r.length>1?this.endNode=At.getInstance().getNode(r[r.length-1]):this.endNode=this.startNode,this.dragPoint=i,this.fixedPoint=n}move(e,r){}moveOffset(){}repairTrack(e){if(this.lock())return;this.moveInit(),this.dragPoint=this.dragPoint.multiply4(e);let i=new Xn().degree45Model(this.dragPoint,this.fixedPoint),n=i[0];this.orthogonalFirst&&(n=i[1]);let s=[this.dragPoint,n,this.fixedPoint];this.changePath(s,this.event.trackNode.item)}changePath(e,r){this.moveStart||(e=e.reverse());let i=new Zr,n=i.createList(),s=[this.startNode.item,this.endNode.item];for(let a=1;a<e.length;a++){let l=s[a-1]||r,c=e[a-1],h=e[a],u=i.createTrack(r.layerId,c,h,r.width,r.showNet,this.command,l.getGroupID());i.addList(u,n,this.command)}this.getWireResult(),this.wireResult.setInputStatus(n),n.replace(this.startNode,this.endNode),this.command.addCommand(new mi(n)),this.moveEnd()}getAssociationTrack(){return null}};function zVe(o,t,e,r,i){var b,P,T,I;let n=e[1].sub(e[0]),s=Math.abs(n.cross(new S(0,1)))<dl||Math.abs(n.cross(new S(1,0)))<dl,a=t,l=e[e.length-1],h=new Xn().degree45Model(a,l),u=[a],d=h[0];s&&(d=h[1]),u.push(d),u.push(l),r||(o.reverse(),u.reverse());let p=[],m=o[0];p.push(m),i.addCommand(Ce.dispatch(m,"modify")),m.start=u[0],m.end=u[1];let g=o[1];if(g)i.addCommand(Ce.dispatch(g,"modify")),g.start=u[1],g.end=u[2],p.push(g);else{let C=m.model.clone();C.start=u[1],C.end=u[2];let E;C instanceof zr?E=pr.addTrackByModel(C,!0):E=pr.addTrackByModel(C,!0),E.partition=R.getInstance().partitionId,i.addCommand(Ce.dispatch(E,"add")),p.push(E)}let y=At.getInstance().getNode(m.model);if(y){let C=y.parent;y.parent.getAllItems().forEach(E=>{At.getInstance().delete(E)}),At.getInstance().getListNode(m.model),(P=(b=C.viaNode)==null?void 0:b.prev)==null||P.deleteConnectTrack(C),(I=(T=C.viaNode)==null?void 0:T.next)==null||I.deleteConnectTrack(C)}return p}var Qne=class extends Np{constructor(t){super(t)}move(t){if(this.lock())return;if(Gr.replay?t=Gr.position||t:Gr.position=t,Gr.pause){Gr.play4Next();return}let e=t.sub(this.event.lastMousePosition);this.moveOffset(e)}moveOffset(t){this.moveInit();let e;this.event.adsorbtion?(e=this.event.oldStart.add(t),e=ai.adsorpGrid(e),t=e.sub(this.event.oldStart)):e=this.event.oldStart.add(t);let r=this.event.trackNode,i=r.item,n=this.event.adsorb(e,i.width,i.layerId).sub(e),s=this.event.oldEnd.add(t),a=this.event.adsorb(s,i.width,i.layerId).sub(s),l=n.length(),c=a.length();l!=0&&c!=0?l<c?t=t.add(n):t=t.add(a):l==0&&c!=0?t=t.add(a):l!=0&&c==0&&(t=t.add(n));let h=this.event.oldStart.add(t),u=this.event.oldEnd.add(t),d=new Zr,p=d.createList(),m=d.createTrack(i.layerId,h,u,i.width,i.showNet,this.command,i.getGroupID());d.addList(m,p,this.command),p.replace(r,r),this.command.addCommand(new mi(p)),this.event.start=h,this.event.end=u,Cr.getInstance().current.setTrackSelect(m.globalIndex),this.moveEnd()}rotate(t){Cr.getInstance().clear(),this.command.undo(),this.command=new Lr;let e=this.event.trackNode.item;e.start=this.event.start,e.end=this.event.end;let r=new _e;if(r.ext1(e.buildBBox()),r.valid()){let l=r.build1().center();e.rotateFor(l,t)}this.event.oldStart=this.event.start=e.start,this.event.oldEnd=this.event.end=e.end;let i=fi.getInstance(),n=i.realSceneX,s=i.realSceneY;this.event.lastMousePosition=new S(i.sceneX,i.sceneY),this.event.lastRealMousePosition=new S(n,s),Cr.getInstance().current.setTrackSelect(e.globalIndex),Mi.getInstance().view4Status(Cr.getInstance().current)}};var tSe=class extends k3{constructor(t){super(t)}},eoe=class extends Np{constructor(t){super(t),this.updateNode();let e=this.start==this.pathList.getFirstNode()?this.pathList.startType:8,r=this.end==this.pathList.getLastNode()?this.pathList.endType:7;this.lastMouseOffset=this.event.lastRealMousePosition.sub(this.event.start),this.handleAddSnapFlag(this.event.trackNode,e,r),this.startIsOther=!0,this.endIsOther=!0;let i=t.connectTracks,n=t.trackNode.parent,s=n.getFirstNode(),a=n.getLastNode();for(this.repairBlock=new tSe(t);s;){if(i.includes(s.item)){this.startTrackNode=s;break}s=s.next}for(;a;){if(i.includes(a.item)){this.endTrackNode=a;break}a=a.prev}}updateNode(){let t=this.event;this.start=t.trackNode,this.end=t.trackNode;let e=t.trackNode;for(;e;){let r=e;e=e.prev;let i=e==null?void 0:e.item;if(i==null){this.start=r;break}i instanceof Ii&&(e=null,this.start=r)}for(e=t.trackNode;e;){let r=e;e=e.next;let i=e==null?void 0:e.item;if(i==null){this.end=r;break}i instanceof Ii&&(e=null,this.end=r)}}move(t,e){if(this.lock())return;if(Gr.replay?t=Gr.position||t:Gr.position=t,Gr.pause){Gr.play4Next();return}let r=this.getOffset(e,this.lastMouseOffset,t);this.moveOffset(r)}moveOffset(t){if(Gr.pause)return;this.moveInit();let e=this.event.trackNode.parent.getAllItems(),r=e.map(n=>n.globalIndex),i=e.map(n=>n.start.toString()+","+n.end.toString());this.debug?(Gr.debug&&Gr.inputDebugGraphics(this.debug),this.debug=new TR(r,i)):this.debug=new TR(r,i),this.calculateStretch(this.startTrackNode,this.endTrackNode,t)}calculateStretch(t,e,r){let i=!1,n=t.parent,s=this.startIsOther,a=this.endIsOther;!s&&!a&&n.getFirstNode().item.start.equals(n.getLastNode().item.end)&&(i=!0);let l=new Zr,c=l.createList();this.getItems().forEach(u=>{let d=l.createTrack(u.layerId,u.start,u.end,u.width,u.net,this.command,u.getGroupID()),p=l.addList(d,c,this.command);return u==t.item&&(t=p),u==e.item&&(e=p),Cr.getInstance().current.setTrackHidden(u.globalIndex),p}),this.movePathList=c,this.calculateMoveRange(t,e,r),this.moveEnd()}getPathList(){return this.movePathList}calculateMoveRange(t,e,r){var u,d;let i=r,n=this.getLimit4Offset(this.bbox,r),s,a,l,c=!1;for(;!ne.lesseq(i.length(),0)&&(a=this.addPreAssist(t,i)||a,l=this.addNextAssist(e,i)||l,!(s&&s.equals(i)));){s=i;let p=this.getEndpointInfo(t.prev,t,e.next,e,n);this.generateEndInfoDirect(p,i);let m=p.find(_=>_.type=="PREVIOUS");if(a&&m.track==a&&m.projectSameDirect){i=this.stopMoveDirect(i,m.direct),this.generateEndInfoDirect(p,i);break}let g=p.find(_=>_.type=="NEXT");if(l&&g.track==l&&g.projectSameDirect){i=this.stopMoveDirect(i,g.direct),this.generateEndInfoDirect(p,i);break}let y=this.getMoveInfo(p,i),b=i,P=t.parent,T=!1,I,C,E,O;if(y){switch(y.type){case"PREVIOUS":{if(!y.minCorner){let x=y.track.next;y.track.prev==null?y.track.item.end=y.track.item.start:(Cr.getInstance().current.setTrackHidden(y.track.item.globalIndex),P.remove(y.track)),y.track=t.prev,x!=t&&(E=x)}break}case"PREVIOUSEND":{if(!y.minCorner){let x=t;t==e?(T=!0,t=t.prev,e=e.next):t=t.next,Cr.getInstance().current.setTrackHidden(x.item.globalIndex),P.remove(x)}break}case"NEXT":{if(!y.minCorner){let x=y.track.prev;y.track.next==null?y.track.item.start=y.track.item.end:(Cr.getInstance().current.setTrackHidden(y.track.item.globalIndex),P.remove(y.track)),y.track=e.next,x!=e&&(O=x)}break}case"NEXTEND":{if(!y.minCorner){let x=e;t==e?(T=!0,t=t.prev,e=e.next):e=e.prev,Cr.getInstance().current.setTrackHidden(x.item.globalIndex),P.remove(x)}break}case"INTER":{T=!0;let x=t;t=t.prev,e=e.next,Cr.getInstance().current.setTrackHidden(x.item.globalIndex),P.remove(x);break}}if(b=b.normalize().mul(y.moveDis),y.minCorner){let x=y.type,v=i.sub(b),D=y.direct.dot(v),w;if(c&&(w=i),x=="NEXTEND"||x=="PREVIOUSEND")D!=0&&(i=i.sub(y.direct.mul(D)));else if(x=="PREVIOUS"){let F=y.track.prev;i=F.item.start.sub(F.item.end).normalize().mul(D).add(b),c=!0}else if(x=="NEXT"){let F=y.track.next;i=F.item.end.sub(F.item.start).normalize().mul(D).add(b),c=!0}w&&!ne.lesseq(Math.abs(this.autoNum(w).cross(this.autoNum(i))),0)&&(i=b)}}if(i=this.autoNum(i.sub(b)),T){if(t&&e){this.getInter(t,e,n);break}}else{let _=E||((u=m==null?void 0:m.track)==null?void 0:u.next)||t,x=O||((d=g==null?void 0:g.track)==null?void 0:d.prev)||e,v=this.getConnectTracks(_,x),D=Qe.translate1(b).toMatrix4();if(v.forEach(w=>{w.item.transform(D)}),I=_.prev,_){this.getInter(I,_,n,!0,a,l),I=_.prev,I&&this.deleteInValidTrack(I)&&(I=_.prev,this.getInter(I,_,n,!0,a,l));let w=t.prev;t&&this.deleteInValidTrack(t)&&(t==e?(T=!0,t=w,e=w.next):t=_==t?I.next:_.next,I=t.prev,this.getInter(I,t,n,!0,a,l))}if(C=x.next,x){this.getInter(x,C,n,!1,a,l),C&&this.deleteInValidTrack(C)&&(C=x.next,this.getInter(x,C,n,!1,a,l));let w=e.next;e&&this.deleteInValidTrack(e)&&(t==e?(T=!0,t=w.prev,e=w):e=x==e?C.prev:x.prev,C=e.next,this.getInter(e,C,n,!1,a,l))}if(T){this.getInter(t,e,n);break}}if(t==e)break;if(this.debug){let _=P.getAllItems();for(let x of _){let v=new M(x.start,x.end);this.debug.addLine(new Gn(v,{color:fR.GREEN,id:x.globalIndex}))}}}this.deletePreAssist(a),this.deleteNextAssist(l),this.getWireResult();let h=t;for(h||(h=this.getPathList().getFirstNode()),h.prev&&(Mr.getInstance().addInputStatus(h.prev),oi.getInstance().updateTree(h.prev.item)),e!=null&&e.next&&(Mr.getInstance().addInputStatus(e.next),oi.getInstance().updateTree(e.next.item));h&&(Mr.getInstance().addInputStatus(h),Cr.getInstance().current.setTrackSelect(h.item.globalIndex),oi.getInstance().updateTree(h.item),h!=e);)h=h.next}block(){let t,e=this.event.adsorpTrackSetting;return this.event.adsorpTrackSetting=!1,this.isBlock()?this.around():this.isPush()&&this.shove(),this.event.adsorpTrackSetting=e,t}deleteInValidTrack(t){if(Cr.getInstance().current.getTrackStatus(t.item.globalIndex)!=!1&&this.autoNum(t.item.start).equals1(t.item.end)){let e=t.parent;if(Cr.getInstance().current.setTrackHidden(t.item.globalIndex),e.remove(t),e.size()==0)debugger;return!0}return!1}addPreAssist(t,e){if(this.startIsOther){if(t.prev==null&&t){let r=t.parent,i=new Zr,n=t.item.direct,s=e.normalize(),a=n.rotateD(S.ORIGIN,135),l=n.rotateD(S.ORIGIN,-135),c=a;s.dot(a)>s.dot(l)&&(c=l);let h=t.item,u=h.start,d=i.createTrack(h.layerId,u.add(c),u,h.width,h.net,this.command);return i.addFirst(d,r,this.command)}return null}}addPreAssist1(t){if(this.startIsOther){if(t.prev==null&&t.next){let e=t.parent,r=new Zr,i=t.next.item.direct,n=t.item,s=n.start,a=r.createTrack(n.layerId,s.sub(i),s,n.width,n.net,this.command);return r.addFirst(a,e,this.command)}return null}}addNextAssist(t,e){if(this.endIsOther){if(t.next==null&&t){let r=t.parent,i=new Zr,n=t.item,s=n.direct.mul(-1),a=e.normalize(),l=s.rotateD(S.ORIGIN,135),c=s.rotateD(S.ORIGIN,-135),h=l;a.dot(l)>a.dot(c)&&(h=c);let u=n.end,d=i.createTrack(n.layerId,u,u.add(h),n.width,n.net,this.command);return i.addList(d,r,this.command)}return null}}addNextAssist1(t){if(this.endIsOther){if(t.next==null&&t.prev){let e=t.parent,r=new Zr,i=t.prev.item.direct,n=t.item,s=n.end,a=r.createTrack(n.layerId,s,s.add(i),n.width,n.net,this.command);return r.addList(a,e,this.command)}return null}}deletePreAssist(t){if(t&&Cr.getInstance().current.getTrackStatus(t.item.globalIndex)){let e=t.item.start;t.item.start=this.autoNum(t.item.start.add(t.item.direct))}}deleteNextAssist(t){t&&Cr.getInstance().current.getTrackStatus(t.item.globalIndex)&&(t.item.end=t.item.end.sub(t.item.direct))}stopMoveDirect(t,e){let r=t,i=e.dot(r);return i!=0&&(r=r.sub(e.mul(i))),r}getTrackMinCorner(t){return Ha.getInstance().getTrackMinCorner()*t}getInter(t,e,r,i=!0,n,s){if(!(t&&e))return null;if(ne.lesseq(Math.abs(this.autoNum(t.item.direct).cross(this.autoNum(e.item.direct))),0)){let h=e.parent;if(i){if(n==t&&this.deletePreAssist(n),e.item.start=t.item.start.clone(),Cr.getInstance().current.setTrackHidden(t.item.globalIndex),h.remove(t),h.size()==0)debugger}else if(s==e&&this.deleteNextAssist(s),t.item.end=e.item.end.clone(),Cr.getInstance().current.setTrackHidden(e.item.globalIndex),h.remove(e),h.size()==0)debugger;return}let a=this.getLine(t.item.start,t.item.end,r),l=this.getLine(e.item.start,e.item.end,r),c=this.getIntersection(a,l);return c&&(t.item.end=c,e.item.start=c),null}getLine(t,e,r=1e3){let i=e.sub(t),n=i.normalize().mul(r+i.length());return new M(t.sub(n),t.add(n))}getLimit4Offset(t,e){let r=t.extendOfSize(e.length());return r.width()+r.height()}getConnectTracks(t,e){let r=t,i=new Array;for(;r!=e&&r;)i.push(r),r=r.next;return r&&i.push(r),i}getMoveInfo(t,e){let r=Number.MAX_VALUE,i,n=e.normalize(),s=e.length();for(let a of t)if(a.projectSameDirect){let l=Math.max(a.projection-a.minCorner,0),c=a.direct.dot(n),h=l/c;s>=h&&r>h&&(i=a,r=h,i.moveDis=h)}return i}generateEndInfoDirect(t,e){t.forEach(r=>{r.direct.dot(e)>0?r.projectSameDirect=!0:r.projectSameDirect=!1})}getEndpointInfo(t,e,r,i,n){let s=new Array,a=this.getTrackMinCorner((t||r).item.width);if(t!=null){let l=t.item,c=e.item,h=this.getVertical(l.start,l.end,c.end),u=a,d=e.next;(!d||ne.eq(this.autoNum(d.item.direct).cross(this.autoNum(t.item.direct)),0))&&(u=0),s.push({direct:h.normalize(),type:"PREVIOUSEND",projection:h.length(),projectSameDirect:!1,minCorner:u});let p=0;if(t.prev&&this.isValidLine(l.start,l.end,c.end)&&!ne.eq(this.autoNum(t.prev.item.direct).cross(this.autoNum(e.item.direct)),0)){let g=t.prev;if(!g||this.isValidLine(g.item.start,l.start,l.end)){let y=this.getVertical(c.end,l.end,l.start).mul(-1);ne.lesseq(y.length(),u)?(c=t.item,t=t.prev,l=t.item):p=u}}let m=this.getVertical(c.end,l.end,l.start).mul(-1);s.push({direct:m.normalize(),type:"PREVIOUS",projection:m.length(),projectSameDirect:!1,minCorner:p,track:t})}if(r!=null){let l=r.item,c=i.item,h=this.getVertical(l.end,l.start,c.start),u=a,d=i.prev;(!d||ne.eq(this.autoNum(r.item.direct).cross(this.autoNum(d.item.direct)),0))&&(u=0),s.push({direct:h.normalize(),type:"NEXTEND",projection:h.length(),projectSameDirect:!1,minCorner:u});let p=0;if(r.next&&this.isValidLine(l.end,l.start,c.start)&&!ne.eq(this.autoNum(r.next.item.direct).cross(this.autoNum(i.item.direct)),0)){let g=r.next;if(!g||this.isValidLine(l.start,l.end,g.item.end)){let y=this.getVertical(c.start,l.start,l.end).mul(-1);ne.lesseq(y.length(),u)?(c=r.item,r=r.next,l=r.item):p=u}}let m=this.getVertical(c.start,l.start,l.end).mul(-1);s.push({direct:m.normalize(),type:"NEXT",projection:m.length(),projectSameDirect:!1,minCorner:p,track:r})}if(e==i&&t&&r){let l=this.getLine(t.item.start,t.item.end,n),c=this.getLine(r.item.start,r.item.end,n),h=this.getIntersection(l,c);if(h){let u=this.getVertical(e.item.start,e.item.end,h).mul(-1);s.push({direct:u.normalize(),type:"INTER",projection:gn(u.length(),4),projectSameDirect:!1,minCorner:0})}}return s}isValidLine(t,e,r){let i=-Math.sqrt(2)/2,n=t.sub(e).normalize(),s=r.sub(e).normalize(),a=n.dot(s);return!!this.kit.eq(a,i)}getVertical(t,e,r){let i=t.sub(e).normalize(),n=r.sub(e),s=i.dot(n),a=i.mul(s).sub(n);return this.autoNum(a)}autoNum(t){return new S(gn(t.x,4),gn(t.y,4))}getNormalOffset(t,e){let r=new S(-t.y,t.x);return r.mul(e.dot(r))}getOffset(t,e,r){if(!t)return r.sub(this.event.oldStart).sub(e);let i,n=ai.snapToSnapFlag(t,!1);return n?i=n.sub(this.event.oldStart):i=new S(t.sceneX,t.sceneY).sub(this.event.oldStart).sub(e),i}handleAddSnapFlag(t,e,r){let i=[],n=t.item.primitive,s=n.end().sub(n.start()).angle(S.ORIGIN),a=[0,1,2,11];a.includes(e)&&i.push({center:this.start.item.start,rotation:s}),a.includes(r)&&i.push({center:this.end.item.end,rotation:s});let c=this.getItems().filter(h=>h==t.item?!1:this.isCollinear(n,h.primitive));for(let h of c)i.push({center:h.start,rotation:s});ai.handleAddSnapFlagData(void 0,void 0,i)}getItems(){let t=[],e=this.start;for(;e&&(t.push(e.item),e!=this.end);)e=e.next;return t}isCollinear(t,e){let r=t instanceof S?t:t.direct,i=e instanceof S?e:e.direct;return this.kit.eq(r.cross(i),0)}interrupt(){var t;Cr.getInstance().clear(),(t=this.command)==null||t.undo(),this.command=null,this.pathList.getAllItems().forEach(e=>{Cr.getInstance().current.setTrackVisible(e.globalIndex)}),Mi.getInstance().view4Status(Cr.getInstance().current)}};var c6=class c6{constructor(){this.undoCommand=new Array;this.redoCommand=new Array;this.stack=null}static getInstance(){return c6.manager==null&&(c6.manager=new c6),c6.manager}executeCommand(t){this.stack!=null&&(this.undoCommand.push(this.stack),this.stack=null),this.stack=t,this.redoCommand.length>0&&(this.redoCommand.length=0)}redo(){if(this.stack!=null&&(this.undoCommand.push(this.stack),this.stack=null),this.redoCommand.length>0){let t=this.redoCommand.pop();t!=null&&(t.redo(),this.undoCommand.push(t))}}undo(){if(this.stack!=null)this.stack.undo(),this.redoCommand.push(this.stack),this.stack=null;else if(this.undoCommand.length>0){let t=this.undoCommand.pop();t!=null&&(t.undo(),this.redoCommand.push(t))}}undoAll(){for(this.undo();this.undoCommand.length>0;)this.undo()}clear(){this.undoCommand.length=0,this.redoCommand.length=0,this.stack=null}};c6.manager=null;var Jf=c6;var b1=class{constructor(){this.tracks=new Set;this.pads=new Set;this.vias=new Set;this.images=new Set;this.pictures=new Set;this.dimensions=new Set;this.smartDimensions=new Set;this.protractors=new Set;this.radius=new Set;this.polygons=new Set;this.rects=new Set;this.circles=new Set;this.coppers=new Set;this.planezones=new Set;this.components=new Set;this.texts=new Set;this.attrs=new Set;this.lines=new Set;this.arcs=new Set;this.ratlines=new Set;this.drcs=new Set;this.others=new Set}doAction(t){let e=t.model;if(!(e instanceof xi))return;switch(e.modelType){case"Track":case"ArcTrack":{this.tracks.add(t);break}case"Pad":{this.pads.add(t);break}case"Via":{this.vias.add(t);break}case"Image":{this.images.add(t);break}case"Picture":{this.pictures.add(t);break}case"Length Dimension":{this.dimensions.add(t);break}case"Smart Dimension":{this.smartDimensions.add(t);break}case"Protractor Dimension":{this.protractors.add(t);break}case"Radius Dimension":{this.radius.add(t);break}case"Polygon":{this.polygons.add(t);break}case"Rect":{this.rects.add(t);break}case"Circle":{this.circles.add(t);break}case"Copper":{this.coppers.add(t);break}case"Inner":{this.planezones.add(t);break}case"Component":{this.components.add(t);break}case"Text":{this.texts.add(t);break}case"Ratline":{this.ratlines.add(t);break}case"Line":{this.lines.add(t);break}case"Arc":{this.arcs.add(t);break}case"DRCResult":case"DrcComponentSpacing":case"DrcCreepage":case"DrcComponentOverlap":{this.drcs.add(t);break}default:{this.others.add(t);break}}}getProfiles(){let t=new Set;return xe.addAllSet(t,this.polygons),xe.addAllSet(t,this.rects),xe.addAllSet(t,this.circles),t}getResult(t){let e=new Set;for(let r of t)xe.addAllSet(e,this.getResults(r));return e}getResults(t){switch(t){case"Track":case"ArcTrack":return this.tracks;case"Pad":return this.pads;case"Via":return this.vias;case"Image":return this.images;case"Picture":return this.pictures;case"Length Dimension":return this.dimensions;case"Smart Dimension":return this.smartDimensions;case"Protractor Dimension":return this.protractors;case"Radius Dimension":return this.radius;case"Polygon":return this.polygons;case"Rect":return this.rects;case"Circle":return this.circles;case"Copper":return this.coppers;case"Inner":return this.planezones;case"Component":return this.components;case"Ratline":return this.ratlines;case"Text":return this.texts;case"Line":return this.lines;case"Arc":return this.arcs;case"DRCResult":return this.drcs;default:return this.others}}};var Fy=class o{constructor(){this.tools=[]}static getInstance(){return o.instance||(o.instance=new o),o.instance}addTool(t){let r=t.event.track;ze.highlight.isItemHighlighted(r.globalIndex)&&this.tools.push(t)}complete(t){let e=ze.highlight,r=new Jt;this.tools.forEach(i=>{i.getPathList().getAllItems().forEach(s=>{let a=s.globalIndex,l=r.getItem(t[a]);l&&e.addHightItem(l)})})}clear(){this.tools.length=0}};var uF=class{constructor(t){this.trackNode=null;this.identify=null;this.commands=null;this.wireCommands=null;this.isMultiRepair=!1;this.point=null;this.adsorbtion=!1;this.isCoSelect=!1;this.direct=null;this.startRatline=[];this.endRatline=[];this.track=t,this.identify=new ou(t),this.updatePoint(t),this.commands=null,this.lastMousePosition=t.start,Nl.getInstance().init(),ps.getInstance().clear()}updatePoint(t){this._start=this.oldStart=t.start,this._end=this.oldEnd=t.end,this.direct=this.optimizationDirect(this.oldEnd.sub(this.oldStart).normalize())}get start(){return this._start}set start(t){this._start=t;for(let e of this.startRatline)e.start=t}get end(){return this._end}set end(t){this._end=t;for(let e of this.endRatline)e.end=t}getPathList(t){this.wireCommands=new Lr,this.commands=new De("wire"),At.getInstance().getNode(t.model)||new su(t.model).generateList(),this.trackNode=At.getInstance().getNode(t.model);let e=this.wireCommands;this.getRatline();let r=Mi.getInstance().view4Status(Cr.getInstance().current);return e.addCommand(r),oi.getInstance().update(),this.trackNode.parent}clearRatline(){this.startRatline.forEach(t=>{t.remove()}),this.endRatline.forEach(t=>{t.remove()})}getRatline(){let t=this.track,e=Hu.getNet(t.net);if(!t.net||!e.showRatline)return;let r=t.net,i=Ye.getSpecialColor(r);for(let n of t.startRatline){n.hidden();let s=t.start,a;n.startNode!==t?a=n.start:a=n.end,this.startRatline.push(new cr(57,s,a,!0,i))}for(let n of t.endRatline){n.hidden();let s=t.end,a;n.startNode!==t?a=n.start:a=n.end,this.endRatline.push(new cr(57,a,s,!0,i))}}setMultiRepair(t){this.isMultiRepair=t}adsorb(t,e,r,i=!1){this.clearAdsorpPoint();let n=new _e().ext2(t).ext7(e).build1(),s=this.track.net,a=kt.search(n,(h,u)=>u=="Pad"&&(h==12||h==r)||u=="Via"||(u=="Track"||u=="ArcTrack")&&h==r),l=new Array,c=new b1;a.setFilter(new ed).setFilter(new Mp(t.x,t.y)).setAction(c),a.doAction(["Pad","Via","Track","ArcTrack"]);for(let h of c.pads)if(!h.isEmpty&&h.net==s)return this.showAdsorpPoint(h.center),h.center;for(let h of c.vias)if(!h.isEmpty&&h.net==s)return this.showAdsorpPoint(h.center),h.center;for(let h of c.tracks)h.isEmpty||l.push(h);return l.length>0?ai.adsorpTrack(t,l[0],i):i?null:t}clearAdsorpPoint(){this.point!=null&&(this.point.remove(),this.point=null)}showAdsorpPoint(t){this.point=new Ui(1002,t),setTimeout(()=>{this.point!=null&&(this.point.remove(),this.point=null)},2e3)}optimizationDirect(t){let e;Math.abs(t.x)<1e-8?e=0:e=t.x;let r;return Math.abs(t.y)<1e-8?r=0:r=t.y,new S(e,r)}isPush(){if(this.isMultiRepair)return!1;let t=Zt.getInstance();return t.mode=="WIRING_MODE_SURROUND_AND_PUSHAWAY"||t.mode=="WIRING_MODE_PUSHAWAY"}isBlock(){if(this.isMultiRepair)return!1;let t=Zt.getInstance();return t.mode=="WIRING_MODE_SURROUND"||t.mode=="WIRING_MODE_OBSTRUCT"}complete(t){this.commands&&(this.clearRatline(),this.wireCommands=null,this.commands.commands.forEach(e=>{t.addCommand(e)}),this.commands=null)}interrupt(){var t,e;Fy.getInstance().clear(),(t=this.commands)==null||t.undo(),(e=this.wireCommands)==null||e.undo(),this.wireCommands=null,this.commands=null,this.clearRatline()}static complete2(t){let{newIds:e}=Mi.getInstance().complete(t);return Fy.getInstance().complete(e),e}static clear(){Fy.getInstance().clear(),Mi.getInstance().clear(),Ml.getInstance().deleteAll(),Jf.getInstance().clear(),Si.getInstance().clear(),oi.getInstance().clear(),At.getInstance().clear(),fs.getInstance().clear(),Cr.getInstance().clear(),$l.getInstance().clear(),pa.getInstance().clear(),ps.getInstance().clear(),Kl.getInstance().clear(),Mr.getInstance().clear(),Nl.getInstance().clear()}};var toe=class extends OS{constructor(){super(...arguments);this.closedSpilt=!1}updateNode(){let e=this.event;this.start=e.trackNode,this.end=e.trackNode;let r=e.trackNode,i=e.track.width;for(;r;){let n=r;r=r.prev,r==null&&(r=e.trackNode.parent.getLastNode());let s=r==null?void 0:r.item;if(r==e.trackNode)break;(s instanceof Ii||Math.abs(s.width-i)>.01)&&(this.closedSpilt=!0,r=null,this.start=n)}if(this.closedSpilt)for(r=e.trackNode;r;){let n=r;r=r.next,r==null&&(r=e.trackNode.parent.getFirstNode());let s=r==null?void 0:r.item;if(r==e.trackNode)break;(s instanceof Ii||Math.abs(s.width-i)>.01)&&(r=null,this.end=n)}else this.start=e.trackNode.parent.getFirstNode(),this.end=e.trackNode.parent.getLastNode()}updatePointType(){let e,r;return this.closedSpilt&&(e=8,r=7),{startType:e,endType:r}}getPreNode(e){let r=this.getPathPrev(e);if(!r){if(this.closedSpilt&&e==this.start)return null;r=e.parent.getLastNode()}return r}getNextNode(e){let r=this.getPathNext(e);if(!r){if(this.closedSpilt&&e==this.end)return null;r=e.parent.getFirstNode()}return r}replaceLine(e,r,i){let n=this.event.trackNode.parent.getFirstNode(),s=this.event.trackNode.parent.getLastNode(),a=new Zr,l=this.event.trackNode,c=!1;for(;l&&l!=r.index;){if(l==n){c=!0;break}l=l.prev}if(c){e.replace(r.index,s),this.command.addCommand(new mi(e));let h=a.createList();h.replace(n,i.index),this.command.addCommand(new mi(h))}else{let h=!1;for(l=this.event.trackNode;l&&l!=i.index;){if(l==s){h=!0;break}l=l.next}if(h){e.replace(n,i.index),this.command.addCommand(new mi(e));let u=a.createList();u.replace(r.index,s),this.command.addCommand(new mi(u))}else e.replace(r.index,i.index),this.command.addCommand(new mi(e))}}getItems(){let e=[],r=this.start;for(;r&&(e.push(r.item),r!=this.end);)r=r.next,r==null&&(r=this.start.parent.getFirstNode());return e}fixBreak(e,r,i){return(this.getPathPrev(e.i)==this.getPathNext(r.i)||this.getPathPrev(e.i)==r.i)&&(r.i=this.getNi(r.i,!1),e.i=this.getNi(e.i,!0),i=!0),i}};var kh=class extends uF{constructor(e){super(e);this.adsorpTrackSetting=!0;this.isClickPoint=!1;this.numberOfIterator=0;this.connectTracks=[]}setConnectTrack(e){this.connectTracks=e}getTool(){this.getPathList(this.track);let e=this.identify.startType,r=this.identify.endType;if((e==0||e==4)&&(r==0||r==4))return new Qne(this);let i=this.trackNode.parent,n;return!this.isConnectOther(i.startType)&&!this.isConnectOther(i.endType)&&i.getFirst().start.equals(i.getLast().end)?n=new toe(this):n=new OS(this),Fy.getInstance().addTool(n),n}isConnectOther(e){return e==null?!1:![5,6,0].includes(e)}getMultiTool(){this.getPathList(this.track);let e=new eoe(this);return Fy.getInstance().addTool(e),e}getRepairEndTool(){this.getPathList(this.track);let e=new qne(this);return Fy.getInstance().addTool(e),e}getLineTool(e,r){this.getPathList(this.track);let i=new Kne(this,e,r);return Fy.getInstance().addTool(i),i}getRepairConnectLineTool(e,r,i){let n=this.getConnectPathList(this.track,e,r);if(n){n.tracks.forEach(a=>{r.add(a.globalIndex),i.add(a.globalIndex)});let s=new Jne(this,n.tracks,n.start,n.end,n.moveStart);return Fy.getInstance().addTool(s),s}return null}needModifyRepair1(e,r){let i=!1;return[3,8,7,12,5,6].includes(e)&&(Mt.checkIsCanEditByItem(r)||(i=!0)),i}adsorb(e,r,i,n=!1){return!fi.getInstance().adsorb||!this.adsorpTrackSetting?e:super.adsorb(e,r,i,n)}getConnectPathList(e,r,i){if(i.has(e.globalIndex))return null;this.wireCommands=new Lr,this.commands=new De("wire");let n=At.getInstance().getListNode(e.model);this.trackNode=n;let s=r.equals(e.start),a=[e.model],l,c;if(s){l=e.start;let h=n.next;h&&!h.item.locked&&!xs(h.item)&&h.item.getParent()==null&&!i.has(h.item.globalIndex)&&h.item instanceof zr?(a.push(h.item),c=h.item.end):c=e.end}else{l=e.end;let h=n.prev;h&&!h.item.locked&&!xs(h.item)&&h.item.getParent()==null&&!i.has(h.item.globalIndex)&&h.item instanceof zr?(a.unshift(h.item),c=h.item.start):c=e.start}return this.getRatline(),oi.getInstance().update(),{tracks:a,start:l,end:c,moveStart:s}}};var IR=class{constructor(t){this.event=t,this.command=new Lr,this.pathList=t.trackNode.parent}getPathList(){return this.pathList}getLengthIncrement(){let t=0;return this.pathList.getAllItems().forEach(r=>{t+=r.length}),t}moveInit(){return Cr.getInstance().clear(),this.command.undo(),this.command=new Lr,this.pathList.getAllItems().forEach(r=>{let i=Ml.getInstance().getItem(r.globalIndex);i||(i=pr.getItem(r.globalIndex).model),At.getInstance().getNode(i)}),this.event.trackNode=At.getInstance().getNode(this.event.trackNode.item)}moveEnd(){this.block();let t=Mi.getInstance().view4Status(Cr.getInstance().current);this.command.addCommand(t),oi.getInstance().update()}block(){return null}complete(){this.command=null}interrupt(){var t;Cr.getInstance().clear(),(t=this.command)==null||t.undo(),this.command=null,Mi.getInstance().view4Status(Cr.getInstance().current)}getNormalOffset(t,e){let r=new S(-t.y,t.x);return r.mul(e.dot(r))}lock(){return!1}rotate(){}addArc(t,e,r){let i=this.event.trackNode.item,n=i.angle,s=new Yn,{center:a,radius:l,startAngle:c,endAngle:h,sweep:u}=s.pointToAngle(t,e,n),d=new Zr,p=d.createArcTrack(i.layerId,a,l,c,h,u,i.width,i.net,this.command,i.arcType,i.getGroupID());return d.addList(p,r,this.command)}addArc2(t,e,r,i,n,s){let a=this.event.trackNode.item,l=new Zr,c=l.createArcTrack(a.layerId,t,e,r,i,n,a.width,a.net,this.command,a.arcType,a.getGroupID());return l.addList(c,s,this.command)}};var roe=class extends IR{constructor(t,e){super(t),this.moveType=e}move(t){if(this.lock())return;this.moveInit();let e;switch(this.moveType){case 0:e=this.moveStartPoint(t);break;case 2:e=this.moveEndPoint(t);break;case 1:e=this.moveMidPoint(t);break}let r=e.item;this.event.start=r.start,this.event.midPoint=r.midPoint,this.event.end=r.end,this.moveEnd()}moveOffset(t){}moveStartPoint(t){let e=this.event.trackNode,r=e.item,i=r.arcType,s=new Zr().createList(),a,l=e;if(i===2){let c=t.angle(r.center),h=r.clone();if(h.startAngle=c,a=this.addArc2(h.center,h.radius,h.startAngle,h.endAngle,h.sweep,s),e.prev){let u=e.prev.item;this.addTrack(u.start,a.item.start,s,u,!0),l=e.prev}}else{if(e.prev){let g=e.prev.item;this.addTrack(g.start,t,s,g),l=e.prev}let c=this.getTangent(r.end).mul(-1),h=this.moveEndpoint(c,r.end,t,!1);a=this.addArc2(h.center,h.radius,h.startAngle,h.endAngle,h.sweep,s);let u=a.item,{startAngle:d,endAngle:p,sweep:m}=u;u.startAngle=p,u.endAngle=d,u.sweep=m==ae.CCW?ae.CW:ae.CCW}return s.replace(l,e),this.command.addCommand(new mi(s)),Cr.getInstance().current.setTrackSelect(a.item.globalIndex),a}addTrack(t,e,r,i,n=!1){let s=new Zr,a;if(i instanceof zr)a=s.createTrack(i.layerId,t,e,i.width,i.showNet,this.command,i.getGroupID());else{let l=i.clone();l.start=t,l.end=e,a=s.createArcTrack(i.layerId,l.center,l.radius,l.startAngle,l.endAngle,l.sweep,l.width,i.showNet,this.command,l.arcType,i.getGroupID())}n?s.addFirst(a,r,this.command):s.addList(a,r,this.command)}moveEndPoint(t){let e=this.event.trackNode,r=e.item,i=r.arcType,s=new Zr().createList(),a,l=e;if(i===2){let c=t.angle(r.center),h=r.clone();if(h.endAngle=c,a=this.addArc2(h.center,h.radius,h.startAngle,h.endAngle,h.sweep,s),e.next){let u=e.next.item;this.addTrack(a.item.end,u.end,s,u),l=e.next}}else{let c=this.getTangent(r.start),h=this.moveEndpoint(c,r.start,t);if(a=this.addArc2(h.center,h.radius,h.startAngle,h.endAngle,h.sweep,s),e.next){let u=e.next.item;this.addTrack(t,u.end,s,u),l=e.next}}return s.replace(e,l),this.command.addCommand(new mi(s)),Cr.getInstance().current.setTrackSelect(a.item.globalIndex),a}moveMidPoint(t){let e=this.event.trackNode,r=e.item,n=new Zr().createList(),a=new Yn().point2Angle(r.start,r.end,t),l;return l=this.addArc2(a.center,a.radius,a.startAngle,a.endAngle,a.sweep,n),n.replace(e,e),this.command.addCommand(new mi(n)),Cr.getInstance().current.setTrackSelect(l.item.globalIndex),l}moveEndpoint(t,e,r,i=!0){return new Yn().tangentToArc(t,e,r,i)}getTangent(t){let r=this.event.trackNode.item,i=t.sub(r.center).normalize();return this.getDirect(i)}getDirect(t){return this.event.trackNode.item.sweep==ae.CCW?new S(-t.y,t.x):new S(t.y,-t.x)}};var ioe=class extends IR{constructor(t){super(t),this.startTangent=this.event.startTangent,this.endTangent=this.event.endTangent;let r=t.trackNode.parent.getAllItems(),i=new _e;for(let s of r)i.ext1(s.buildBBox());this.bbox=i.build1();let n=this.event.trackNode.item;if(this.getPre(this.event.trackNode.prev)){let s=this.event.trackNode.prev;this.prevDirect=s.item.direct}else{let s=n.start.sub(n.center).normalize();n.sweep==ae.CW?this.prevDirect=new S(s.y,-s.x):this.prevDirect=new S(-s.y,s.x)}if(this.getNext(this.event.trackNode.next)){let s=this.event.trackNode.next;this.nextDirect=s.item.direct.mul(-1)}else{let s=n.end.sub(n.center).normalize();n.sweep==ae.CW?this.nextDirect=new S(-s.y,s.x):this.nextDirect=new S(s.y,-s.x)}}getPre(t){return this.startTangent&&t.prev?t.prev:null}getNext(t){return this.endTangent&&t.next?t.next:null}getLimit4Offset(t,e){let r=t.extendOfSize(e.length());return r.width()+r.height()}move(t){if(this.lock())return;let e=t.sub(this.event.lastMousePosition);this.moveOffset(e)}moveOffset(t){let e=this.moveInit(),r=this.getLimit4Offset(this.bbox,t),i=this.getPre(e)?this.getPre(e).item.start:e.item.start.add(this.prevDirect),n=this.getLine(e.item.start,i,r),s=this.getNext(e)?this.getNext(e).item.end:e.item.end.add(this.nextDirect),a=this.getLine(e.item.end,s,r),l=this.getNormalOffset(this.event.direct,t),c=e.item.start.add(l),h=this.event.direct.mul(e.item.length),u=this.getLine(c,c.add(h),r),d=this.getIntersection(u,n),p=this.getIntersection(u,a);if(d!=null&&p!=null){if(this.event.optimizationDirect(p.sub(d).normalize()).dot(this.event.direct)<=0){let g=this.getIntersection(n,a);d=g,p=g}if(d!=null&&p!=null){let g=this.getPre(e)?this.getPre(e).item.start:e.item.start;if(this.event.optimizationDirect(d.sub(g).normalize()).dot(this.prevDirect)<=0){let T=g,I=this.getLine(T,T.add(h),r);d=T,p=this.getIntersection(I,a)}let b=this.getNext(e)?this.getNext(e).item.end:e.item.end;if(this.event.optimizationDirect(p.sub(b).normalize()).dot(this.nextDirect)<=0){let T=b,I=this.getLine(T,T.add(h),r);d=this.getIntersection(I,n),p=T}if(d!=null&&p!=null){let I=new Zr().createList(),C=(this.getPre(e)||e).item;if(g.equals(d)||this.addTrack(g,d,I,C),d.equals(p))this.event.start=this.event.midPoint=this.event.end=p;else{let E=this.addArc(d,p,I).item;this.event.start=E.start,this.event.midPoint=E.midPoint,this.event.end=E.end,Cr.getInstance().current.setTrackSelect(E.globalIndex)}C=(this.getNext(e)||e).item,p.equals(b)||this.addTrack(p,b,I,C),I.replace(this.getPre(e)||e,this.getNext(e)||e),this.command.addCommand(new mi(I)),this.moveEnd()}}}}addTrack(t,e,r,i,n=!1){let s=new Zr,a=s.createTrack(i.layerId,t,e,i.width,i.net,this.command,i.getGroupID());n?s.addFirst(a,r,this.command):s.addList(a,r,this.command)}getLine(t,e,r){let n=e.sub(t).normalize().mul(r);return new M(t.sub(n),t.add(n))}getIntersection(t,e){return Pt(t,e)>0?new S(Ee[0],Ee[1]):null}};var noe=class extends IR{constructor(t){super(t)}move(t){if(this.lock())return;let e=this.moveInit().item;t=this.event.adsorpTrack(t,e.width,e.layerId);let r=t.sub(this.event.lastMousePosition);this.moveOffset(r)}moveOffset(t){let e=Ae.translate(t.x,t.y,0),r=this.event.trackNode,i=this.event.trackNode.item.clone();i.transform(e),this.event.start=i.start,this.event.midPoint=i.midPoint,this.event.end=i.end;let n=new Zr,s=n.createList(),a=n.createArcTrack(i.layerId,i.center,i.radius,i.startAngle,i.endAngle,i.sweep,i.width,i.net,this.command,i.arcType,i.getGroupID());n.addList(a,s,this.command),s.replace(r,r),this.command.addCommand(new mi(s)),this.curr=a,Cr.getInstance().current.setTrackUpdate(a.globalIndex),Cr.getInstance().current.setTrackSelect(a.globalIndex),this.moveEnd()}rotate(t=le.pcbConfig.rotate){Cr.getInstance().clear();let e=this.curr,r=this.event.trackNode.item;r.center=e.center,r.radius=e.radius,r.startAngle=e.startAngle,r.endAngle=e.endAngle,r.sweep=e.sweep,this.command.undo(),this.command=new Lr;let i=new _e;if(i.ext1(r.buildBBox()),i.valid()){let a=i.build1().center();r.rotateFor(a,t)}this.event.oldStart=this.event.start=r.start,this.event.oldEnd=this.event.end=r.end,this.event.oldMidPoint=this.event.midPoint=r.midPoint;let n=fi.getInstance();this.event.lastMousePosition=new S(n.sceneX,n.sceneY),Cr.getInstance().current.setTrackUpdate(r.globalIndex),Cr.getInstance().current.setTrackSelect(r.globalIndex),Mi.getInstance().view4Status(Cr.getInstance().current)}getLengthIncrement(){return 0}};var BI=class extends uF{constructor(e){super(e);this.startTangent=!1;this.endTangent=!1;this.oldMidPoint=this.midPoint=e.midPoint,this.startTangent=this.identify.startTangent,this.endTangent=this.identify.endTangent,this.resultId=e.globalIndex}get coSelect(){return this.isCoSelect}set coSelect(e){this.isCoSelect=e}getTool(){if(this.getPathList(this.track),this.startTangent||this.endTangent){let e=new ioe(this);return Fy.getInstance().addTool(e),e}else{let e=new noe(this);return Fy.getInstance().addTool(e),e}}getEndTool(e){this.getPathList(this.track);let r=new roe(this,e);return Fy.getInstance().addTool(r),r}adsorpTrack(e,r,i){let n=new _e().ext2(e).ext7(r).build1(),s=kt.search(n,(l,c)=>l==i&&(c=="Track"||c=="ArcTrack")),a=new Array;return s.setFilter(new ed).setFilter(new Mp(e.x,e.y)).setAction(new AI(l=>{l.isEmpty||a.push(l)})),s.doAction(["Track","ArcTrack"]),a.length>0?ai.adsorpTrack(e,a[0]):e}};var Jd=class{static updateNetLengthMsg(t,e,r){let i=ds.getInstance(),n=[];e=="Single wiring"?n.push(t.node.net):n=t.tracks.map(m=>m.net),n=n.filter(m=>!o0(m));let s=Array.from(new Set(n)).sort((m,g)=>g==(r==null?void 0:r.net)?1:-1);if(s.length==0&&Ut.cancel(),e=="Multi-route wiring"){let m=s.reduce((g,y)=>(g[y]=Ye.getNetLength(y)+this.getNetLengthDelta(y),g),{});A.publish("updateNets",{updateNetLength:m,unit:R.getInstance().unit},Q()),Ut.cancel();return}let a=t.node.net,l,c,h,u,d,p=re.getInstance().getNet(a);if(i.showDiffLength&&p!=null&&p.netDifferential!=null||r&&r.showDiffLength){let m=p.netDifferential.positiveNet.name,g=p.netDifferential.negativeNet.name,y=Ye.getNetLength(m),b=Ye.getNetLength(g),P=this.getNetLengthDelta(m),T=this.getNetLengthDelta(g),I=P==0?y:P,C=T==0?b:T;l={len_P:I,len_N:C},A.publish("updateNets",{updateNetLength:{[m]:I,[g]:C},unit:R.getInstance().unit},Q())}(i.showNetLength&&p!=null||r&&r.showNetLength)&&(s.length==1||a==(r==null?void 0:r.net)?c=this.getNetLengthDelta(a):h=this.getNetLengthDelta(a)),r&&r.restrictLength&&c!=null&&(u=r.additionalLength,d=c-r.netLengthAtBeginning),(c!=null||l!=null||u!=null)&&Ut.updateNetLengthMsg2(fi.getInstance(),{net:a,netLength:c,netLength2:h,diffPairLength:l,additionalLength:u,hasIncreased:d})}static getNetLengthDelta(t){t=t==null?void 0:t.toUpperCase();let e=Ye.getSameNetItems(t),r=0;e.forEach(s=>{if(s instanceof Ge&&s.isVisible){let a=s.length;r+=a}else if(s instanceof Le){let a=$o.getInstance().getPadLenByModel(s.model);a!=null&&(r+=a)}});let i=Mi.getInstance().getMap,n=0;for(let[s,a]of i)a.net==t&&a.isVisible&&(n+=a.length);return n+r}static updateNetLengthMsg2(t,e,r){if(e=="Multi-route wiring"){Ut.cancel();return}let i=ds.getInstance(),n=[];e=="Single wiring"?n.push(t.node.net):n=t.tracks.map(a=>a.net),n=n.filter(a=>!o0(a));let s=Array.from(new Set(n)).sort((a,l)=>l==(r==null?void 0:r.net)?-1:1);s.length==0&&Ut.cancel();for(let a of s){let l,c,h,u,d=re.getInstance().getNet(a);if(i.showDiffLength&&d!=null&&d.netDifferential!=null||r&&r.showDiffLength){let p=d.netDifferential.positiveNet.name,m=d.netDifferential.negativeNet.name,g=Ye.getNetLength(p),y=Ye.getNetLength(m),b=this.getNetLengthDelta(p),P=this.getNetLengthDelta(m),T=b==0?g:b,I=P==0?y:P;l={len_P:T,len_N:I}}if(i.showNetLength&&d!=null&&(s.length==1||a==(r==null?void 0:r.net))||r&&r.showNetLength){let p=Ye.getNetLength(a);c=this.getNetLengthDelta(a)}r&&r.restrictLength&&c!=null&&(h=r.additionalLength,u=c-r.netLengthAtBeginning),(c!=null||l!=null||h!=null)&&Ut.updateNetLengthMsg2(fi.getInstance(),{net:a,netLength:c,diffPairLength:l,additionalLength:h,hasIncreased:u})}}static getNetLengthDelta2(t){t=t==null?void 0:t.toUpperCase();let e=Ye.getSameNetItems(t),r=0;e.forEach(l=>{if(l instanceof Ge&&l.isVisible){let c=l.length;r+=c}else if(l instanceof Le){let c=$o.getInstance().getPadLenByModel(l.model);c!=null&&(r+=c)}});let i=Ml.getInstance().map,s=Cr.getInstance().current.trackStatus,a=0;for(let[l,c]of i)s.get(l)&&c.net==t&&(a+=c.length)}};var B3=class extends ni{constructor(){super();this.event=null;this.tool=null;this.source=!1;this.option="OPTIONLEFTUP"}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":if(!this.drawing){this.drawing=!0,A.publish("rightClickPcbMenu",{state:"hide"},Q());return}this.cancel();break}A.publish("updateFrame","")}addTrack(e,r,i){e.click(),this.event=new kh(e),this.event.lastRealMousePosition=new S(r,i),this.tool=this.event.getTool(),this.start()}addArcTracK(e){e.click(),this.event=new BI(e),this.tool=this.event.getTool(),this.start()}onMouseMove(e){if(this.event!=null&&this.drawing){let r=new S(e.sceneX,e.sceneY);this.tool.move(r,e),Ut.updateNetLengthMsg2(e,{diffPairLength:this.realTimeDiffPairLengthErr(),netLength:this.realTimeNetLength(),net:this.event.track.net})}}onMouseLeftUp(e){if(this.event!=null){this.tool.complete();let r=new De("repair line");this.event.complete(r),this.tool&&(this.event instanceof kh?kh.complete2(r):BI.complete2(r),kh.clear()),r.length>0&&qe.executeCommand(r),A.publish("flushService",""),this.event=null,this.tool=null,this.source&&A.publish("tool","dropdrag"),Ut.cancel(),this.end()}else{let r=e.realSceneX,i=e.realSceneY,n=this.select(r,i);n!=null&&(n instanceof Ir?this.addTrack(n,r,i):n instanceof yi&&this.addArcTracK(n)),this.event!=null&&(this.event.lastMousePosition=new S(r,i))}}select(e,r){let i=Vr.pointSelectBeforeFilter(e,r).tracks;return jt.pointFilter(e,r,i)[0]}interrupt(){this.event!=null&&(this.tool.interrupt(),this.event.interrupt(),this.tool&&kh.clear(),this.event=null,this.tool=null,this.source&&A.publish("tool","dropdrag"),Ut.cancel(),A.publish("flushService","")),this.end()}cancel(){this.event!=null?this.interrupt():A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:yVe(e.adsorb)};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"WIRING_MODE":{Zt.getInstance().mode=="WIRING_MODE_PUSHAWAY"&&this.tool!=null&&this.tool instanceof OS&&(this.tool.interrupt(),this.event.commands.undo(),this.event.track.isEmpty||this.event.track.visible(),this.addTrack(this.event.track,this.event.lastRealMousePosition.x,this.event.lastRealMousePosition.y)),Zt.getInstance().mode=i[1],we.synchronize(),A.publish("flushSelectingInfo",""),this.onMouseMove(fi.getInstance());break}}A.publish("updateFrame","")}realTimeDiffPairLengthErr(){let e=this.event.track.net,r=re.getInstance().getNet(e);if(r!=null&&r.netDifferential!=null){let i=r.netDifferential,n=i.positiveNet.name,s=i.negativeNet.name;Ye.modifyNet(n),Ye.modifyNet(s);let a=Ye.getNetLength(n),l=Ye.getNetLength(s),c=this.getIncrement(this.tool,n,s);return Zt.getInstance().mode=="WIRING_MODE_PUSHAWAY"?(a=a+c[0],l=l+c[1]):this.event.track.net==n?a=a+c[2]:l=l+c[2],{len_P:a,len_N:l}}return null}realTimeNetLength(){let e=this.event.track.net,r=re.getInstance().getNet(e);return r!=null&&r.netLengthPhysics!=null?(Ye.modifyNet(e),Jd.getNetLengthDelta(e)):0}getIncrement(e,r,i){if(e!=null){let n=0,s=0,a=e.getLengthIncrement();return[n,s,a]}return[0,0,0]}};var rSe=class{constructor(){this.drawingLines=[];this.snapFlags=[];this.filterItems=new Set}adsorpGrid(t){if(!It.getInstance().currentCoord)return this.adsorpPolar(t);let e=It.getInstance().getSnapX(),r=It.getInstance().getSnapY(),i=R.getInstance().origin;if(gr.hasAlt){let n=R.getInstance().altGridSize.GridX,s=R.getInstance().altGridSize.GridY;e=n.number/10,r=s.number/10;let a=dt.ins;R.getInstance().unit=="mil"?n.unit!=R.getInstance().unit&&(e=a.conversion(n.unit,R.getInstance().unit,e),r=a.conversion(s.unit,R.getInstance().unit,r)):n.unit==R.getInstance().unit&&(e=a.conversion(n.unit,"mil",e),r=a.conversion(s.unit,"mil",r))}return e=e||1,r=r||1,R.getInstance().unit=="mm"&&(e=this.fix4Unit(e),r=this.fix4Unit(r)),new S(this.getValue(t.x-i.x,e)+i.x,this.getValue(t.y-i.y,r)+i.y)}getValue(t,e){if(e==0)return t;let r=t/e,i=Math.floor(r),n=Math.ceil(r),s;return Math.abs(i-r)>Math.abs(n-r)?s=n:s=i,s*e}fix4Unit(t){let e=dt.ins;return ve(e.mil2mm(t),4)*39.37007874015748}pointInPolar(t){let e=R.getInstance().origin,r=It.getInstance().startAngle,i=It.getInstance().endAngle,n=It.getInstance().sweepAngle,s=It.getInstance().minRadius,a=It.getInstance().maxRadius,l=t.sub(e),c=l.length();if(c<s||c>a)return!1;let h=new S(Math.cos(r),Math.sin(r)),u=new S(Math.cos(i),Math.sin(i)),d=l.normalize(),p=h.cross(d),m=u.cross(d);return!!(n<Math.PI&&ne.greatereq(p,0)&&ne.lesseq(m,0)||n>=Math.PI&&(ne.greatereq(p,0)||ne.lesseq(m,0)))}adsorpPolar(t){let e=R.getInstance().origin,r=It.getInstance().startAngle,i=t.sub(e),n=i.normalize();if(this.pointInPolar(t)){let s=It.getInstance().minRadius,a=n.angle(S.ORIGIN);a=a>=0?a:a+kr;let l=i.length(),c=It.getInstance().radius,h=Math.round((l-s)/c)*c+s,u=It.getInstance().angleDelta,d=0;a>r?d=a-r:d=a-r+kr;let p=Math.round(d/u)*u+r,m=Math.cos(p),g=Math.sin(p);return isNaN(m)||isNaN(g)||isNaN(h)?t:new S(m,g).mul(h).add(e)}else return t}adsorpTrack(t,e,r=!1){let i=e.primitive,s=new er(i,new M(t,t)).getLine(),a,l=le.adsorptionConfig.getSnapDistanceValue(),c=s.start().distance1(t),h=s.end().distance1(t);c<h&&h<l?a=s.end():h<c&&c<l?a=s.start():a=t;let u=a.distance1(e.start),d=a.distance1(e.end);return u>d&&d<l?new S(e.end.x,e.end.y):u<d&&u<l?new S(e.start.x,e.start.y):r?null:a}filterNodes(t,e,r=!1,i=[]){let s=new _e().ext2(t).ext7(1).build1(),a=kt.search(s),l=new lT;a.setAction(l),a.doAction(["ArcTrack","Track","Pad","Via","Text","Image","Polygon","Rect","Circle","Line","Arc","Component"]);let c=l.items,h=this.getAdsorptionPcbItemClass(e),u=new Array,d=new Array;for(let p of c)if(this.checkFilterNode(p,h,t,e,r,i))if(p instanceof lt)if(p.type!="Line"){d.push(p);for(let m of p.getAllChildrens())u.push(m)}else for(let m of p.getAllChildrens())u.push(m);else u.push(p);return{nonPolygonNodes:u,polygonNodes:d}}getAdsorptionPcbItemClass(t){let e=t instanceof vo||t instanceof B3||t instanceof B3||t instanceof vo;return le.adsorptionConfig.getNeedObjTypes(e)}checkFilterNode(t,e,r,i,n=!1,s=[]){if(!t.isVisible)return!1;let a=this.getLayerId(t),l=Pe.getLayer(a);if(a&&l&&!l.visible)return!1;if(i instanceof vo||i instanceof vo){if(!this.isActiveLayerPcbItem(t))return!1;let h=i;if(!this.isContainWire(t,h))return!1}else if(this.snapOnlyCurrentLayer()&&!this.isActiveLayerPcbItem(t))return!1;return!(this.isDrawingItem(t,i)||n&&Array.from(s).find(h=>t.globalIndex==h.globalIndex||t.getParent()&&t.getParent().globalIndex==h.globalIndex)||e.filter(h=>t instanceof h).length===0||!(t instanceof He?t.isInProfile(r.x,r.y):t.isSelect(r.x,r.y)))}snapOnlyCurrentLayer(){return le.adsorptionConfig.getConfig("Snapping")=="currentLayer"}isActiveLayerPcbItem(t){let e=this.getLayerId(t),r=Pe.getActiveLayerID();return t instanceof Ue?!!t.isContains(r):!(e&&e!==12&&e!==r)}isContainWire(t,e){let r=this.getNet(t),i=e.getWires();if(r&&i.length>0){let n=!1;for(let s of i)r.toUpperCase()===s.toUpperCase()&&(n=!0);return n}return!0}getLayerId(t){if(t instanceof Ir)return t.layerId;if(t instanceof _i)return t.layerId;if(t instanceof yi)return t.layerId;if(t instanceof He)return t.layerId;if(t instanceof mt)return t.layerId;if(t instanceof _t)return t.layerId;if(t instanceof lr)return t.layerId;if(t instanceof Ga)return t.layerId;if(t instanceof qs)return t.layerId;if(t instanceof da)return t.layerId;if(t instanceof ke)return t.layerId;if(t instanceof sn)return t.layerId;if(t instanceof Gi)return t.layerId}getNet(t){if(t instanceof Qo)return t.net}isDrawingItem(t,e){if(e instanceof Oo){if(t instanceof mt||t instanceof _t){let r=t.getParent();if(r!=null&&(e.filterItems.has(r)||this.filterItems.has(r)))return!0}return e.filterItems.has(t)||this.filterItems.has(t)}return!1}getDrawingLinePointInfo(t,e){let r,i=Number.MAX_VALUE,n=[],s=le.adsorptionConfig.getSnapDistanceValue();for(let l of e){let c=!["Line Center"].includes(l),h=a.bind(this,l,s)();for(let u of h){let d=t.distance1(u.point);d<i&&d<u.width?(i=d,r=u.point,n=[{angle:u.rotation,adsorptionObj:c?u.primitive:null}]):Od(u.point,r)&&n.push({angle:u.rotation,adsorptionObj:c?u.primitive:null})}}return{point:r,distance:i,crossObjs:n};function a(l,c){let h=[];for(let u of this.drawingLines){let{primitive:d}=u;switch(l){case"Endpoint":{let T=d instanceof M?d.end().sub(d.start()).angle(S.ORIGIN):null;h.push({point:d.start(),rotation:T,width:c,primitive:d},{point:d.end(),rotation:T,width:c,primitive:d});break}case"Midpoint":{let T=d instanceof M?d.end().sub(d.start()).angle(S.ORIGIN):null,I=d instanceof M?d.end().add(d.start()).mul(.5):d.midPoint;h.push({point:I,rotation:T,width:c,primitive:d});break}case"Arc/Circle Center Point":{d instanceof q&&h.push({point:d.center,width:c,primitive:d});break}case"Tangent Point":{d instanceof q&&h.push({point:d.center.add(new S(-d.rx,0)),width:c,primitive:d},{point:d.center.add(new S(d.rx,0)),width:c,primitive:d},{point:d.center.add(new S(0,-d.rx)),width:c,primitive:d},{point:d.center.add(new S(0,d.rx)),width:c,primitive:d});break}case"Intersection":case"Perpendicular Foot":case"Region Center":return[];case"Line Center":let p=d instanceof M?d.end().sub(d.start()).angle(S.ORIGIN):null,m=new er(d,new M(t,t)),g=m.getLine(),y;g.start().distance1(t)<g.end().distance1(t)?y=g.end():y=g.start(),m.getDistance()==0&&(y=t);let b=y.distance1(d.start()),P=y.distance1(d.end());b>P&&P<c?h.push({point:new S(d.end().x,d.end().y),rotation:p,width:c,primitive:d}):b<P&&b<c?h.push({point:new S(d.start().x,d.start().y),rotation:p,width:c,primitive:d}):h.push({point:y,rotation:p,width:c,primitive:d});break}}return h}}getNearestOutlineObjPointInfo(t,e,r){let i,n,s=[],a=!1,l=le.adsorptionConfig.getSnapDistanceValue();for(let h of r){let u=c(e,h,t);if(u.length)for(let d of u){let p=t.distance1(d.point);if(n==null||p<n){if(["Midpoint","Endpoint","Intersection","Perpendicular Foot","Tangent Point"].includes(h)&&p<l&&(a=!0),h=="Line Center"&&a)continue;n=p,i=d.point,s=[{angle:d.rotation,adsorptionType:h}]}else Od(d.point,i)&&s.push({angle:d.rotation,adsorptionType:h})}}return{point:i,distance:n,crossObjs:s};function c(h,u,d){switch(u){case"Endpoint":return ai.getEndPointInfo(h);case"Midpoint":return ai.getMidPointInfo(h);case"Arc/Circle Center Point":return ai.getArcCircleCenterPoint(h).map(p=>({point:p}));case"Tangent Point":return ai.getTangentPoint(h).map(p=>({point:p}));case"Intersection":case"Perpendicular Foot":case"Region Center":return[];case"Line Center":return ai.getLineCenterInfo(h,d)}}}getEndPointInfo(t){let e=[],r;return t instanceof mt?(r=t.end.sub(t.start).angle(S.ORIGIN),e.push({point:t.start,rotation:r},{point:t.end,rotation:r})):t instanceof rr?(r=t.rotation,e=e.concat(t.getEndPoints().map(i=>({point:i,rotation:r})))):t instanceof _t&&e.push({point:t.start},{point:t.end}),e}getMidPointInfo(t){let e=[],r;return t instanceof mt?(r=t.end.sub(t.start).angle(S.ORIGIN),e.push({point:t.midPoint,rotation:r})):t instanceof _t?e.push({point:t.midPoint}):t instanceof rr&&(r=t.rotation,e=e.concat(t.getMidPoints().map(i=>({point:i,rotation:r})))),e}getLineCenterInfo(t,e){let r=[],i=le.adsorptionConfig.getSnapDistanceValue();if(t instanceof mt||t instanceof _t){let n=t.end.sub(t.start).angle(S.ORIGIN);return this.handleLineCenter(t.start,t.end,t.primitive,e,i,n)}else if(t instanceof rr){let n=t.rotation;t.getPolyline().primitives.forEach(a=>{r=r.concat(this.handleLineCenter(a.start(),a.end(),a,e,i,n))})}else if(t instanceof Pr){let[n,s]=YVe(t,e),a=s.sub(n).angle(S.ORIGIN);return this.handleLineCenter(n,s,q.build1(n,s,t.radius,t.radius,!1,ae.CW),e,i,a)}return r}handleLineCenter(t,e,r,i,n,s){let a=[],l=new er(r,new M(i,i)),c=l.getLine(),h;return c.start().distance1(i)<c.end().distance1(i)?h=c.end():h=c.start(),l.getDistance()==0&&(h=i),a.push({point:h,rotation:s}),a}getIntersectPoint(...t){let e={},r=[].concat(t,this.drawingLines);if(r.length>1){class n{constructor(c){this.line=c,this._bbox=c.primitive.bbox().extendOfSize(c.width/2)}get width(){return this.line.width}get primitive(){return this.line.primitive}bbox(){return this._bbox}}let s=new ji(7);for(let l of r)l instanceof Pr||l instanceof rr?s.add(l):s.add(new n(l));let a=new Set;for(let l of s.itemList){a.add(l);let c=l instanceof n?l.line:l,h=s.search(l.bbox());for(let u of h){if(l==u||a.has(u))continue;let d=u instanceof n?u.line:u,p=l instanceof Pr||l instanceof rr?l.getMathGraphics():ge.build2([l.primitive]),m=u instanceof Pr||u instanceof rr?u.getMathGraphics():ge.build2([u.primitive]);for(let g of p.primitives)for(let y of m.primitives){if(g.bbox().isSeparated(y.bbox()))continue;let b=Pt(g,y);for(let P=0;P<b;P+=2){let T=new S(Ee[P],Ee[P+1]),I=i(T);I?(I.items.add(c),I.items.add(d)):e[T.hashed]={point:T,items:new Set([c,d])}}}}}}return Object.values(e);function i(n){return e[n.hashed]}}getArcCircleCenterPoint(t){let e=[];return t instanceof Pr||t instanceof _t?e.push(t.center):t instanceof rr&&(e=e.concat(t.getArcCenterPoints())),e}getTangentPoint(t){let e=[];return(t instanceof Pr||t instanceof _t)&&e.push(...r(t)),e;function r(i){let n=[i.center.add(new S(-i.radius,0)),i.center.add(new S(i.radius,0)),i.center.add(new S(0,-i.radius)),i.center.add(new S(0,i.radius))];return i instanceof _t?n.filter(s=>i.isSelect(s.x,s.y)):n}}getNearestCrossPointInfo(t,e){let i=le.adsorptionConfig.getSnapDistanceValue(),n=e.position,s=n.distance1(t),a=le.adsorptionConfig,l,c,h;if(s<i)l=n,c=s;else{if(a.getConfig("Extended Line"))for(let u of[new M(n,n.add(new S(0,1))),new M(n,n.add(new S(1,0))),new M(n,e.getLines()[0].end.rotate(n,e.rotation||0))]){let d=new M(u.start(),u.end()),p=er.foot(d,t),m=p.distance1(t);(c==null||m<c)&&m<i&&(c=m,l=p,h=d)}if(a.getConfig("Perpendicular Foot")&&e.rotation!=null)for(let u of e.getLines().slice(1)){let d=new M(u.start.rotate(n,e.rotation||0),u.end.rotate(n,e.rotation||0)),p=er.foot(d,t),m=p.distance1(t);(c==null||m<c)&&m<i&&(c=m,l=p,h=d)}}return{point:l,distance:c,angle:e.rotation,line:h}}getNearestFlagPointInfo(t,e,r=!1){let n=le.adsorptionConfig.getSnapDistanceValue(),s=e.center,a=s.distance1(t),l=le.adsorptionConfig,c,h,u;if(a<n)c=s,h=a;else if(l.getConfig("Extended Line")){let d=[e.lines[0],e.lines[1]];if(r){let p=[new M(e.center,e.center.add(new S(0,1))),new M(e.center,e.center.add(new S(1,0)))];d.push(...p)}for(let p of d){let m=p,g=er.foot(m,t),y=g.distance1(t);(h==null||y<h)&&y<n&&(h=y,c=g,u=m)}}return{point:c,distance:h,line:u}}getExtendedLinePointInfo(t,e,r,i,n,s=!1){let l=le.adsorptionConfig.getSnapDistanceValue(),c,h,u;for(let d of[new M(e,e.add(new S(0,1))),new M(e,e.add(new S(1,0))),new M(e,e.add(new S(1,0)).rotate(e,i))]){let p=new M(d.start(),d.end()),m=er.foot(p,t),g=_L([e,r||m],[d.start(),d.end()]),y=m.distance1(t);(h==null||y<h)&&y<l&&g&&(h=y,c=m,u=p)}if(s){let d,p,m=new S(n.realSceneX,n.realSceneY),g;le.adsorptionConfig.getConfig("Grid Point")&&(g=ai.adsorpGrid(m),d=m.distance1(g));let y=new S(n.sceneX,n.sceneY);c?(p=m.distance1(c),g&&d<p?(n.sceneY=g.y,n.sceneX=g.x):Rv(c.x,e.x)?n.sceneX=c.x:(Rv(c.y,e.y)||(n.sceneX=c.x),n.sceneY=c.y)):(n.sceneY=y.y,n.sceneX=y.x)}else if(c!=null)if(c.equals1(e))n.sceneX=c.x,n.sceneY=c.y;else if(Rv(c.x,e.x))n.sceneX=c.x;else if(Rv(c.y,e.y))n.sceneY=c.y;else{let d=new S(n.sceneX,n.sceneY),p=new S(n.sceneX,c.y),m=new S(c.x,n.sceneY),g=0,y;[p,m].forEach(b=>{let P=c2(e,c,d,b);P&&(g?P.distance1(c)<g&&(g=P.distance1(c),y=P):(g=P.distance1(c),y=P))}),y&&(n.sceneX=y.x,n.sceneY=y.y)}return{point:c,distance:h,angle:i,line:u}}getCrossLineIntersectPointsInfo(t,e){let r=[],i=[],n=le.adsorptionConfig;for(let a of t){let l=a.getLines(),{position:c,rotation:h}=a;if(n.getConfig("Extended Line")&&r.push({line:new M(c.sub(new S(1,0).mul(e)),c.add(new S(1,0).mul(e))),cross:a},{line:new M(c.sub(new S(0,1).mul(e)),c.add(new S(0,1).mul(e))),cross:a},{line:new M(c.sub(a.getLines()[0].end.rotate(c,a.rotation||0).sub(c).normalize().mul(e)),c.add(a.getLines()[0].end.rotate(c,a.rotation||0).sub(c).normalize().mul(e))),cross:a}),n.getConfig("Perpendicular Foot")){let u=l[1].start.rotate(c,h||0),p=l[1].end.rotate(c,h||0).sub(u).normalize();r.push({line:new M(c.sub(p.mul(e)),c.add(p.mul(e))),cross:a})}}if(r.length>1)for(let a=0;a<r.length;a++)for(let l=a+1;l<r.length;l++){let c=Pt(r[a].line,r[l].line);for(let h=0;h<c;h+=2){let u=new S(Ee[h],Ee[h+1]),d=s(u);d?(d.lines[a]=r[a],d.lines[l]=r[l]):i.push({point:u,lines:{[a]:r[a],[l]:r[l]}})}}return i.map(a=>{let l=Object.values(a.lines);return{...a,lines:l}});function s(a){for(let l of i)if(l.point.x===a.x&&l.point.y===a.y)return l;return null}}getCrossAndLineCenterIntersectPointsInfo(t,e,r){let i=[],n=[],s=[],a=le.adsorptionConfig,{prePosition:l,preRotation:c}=e,h=new S(1,0).mul(r),u=new S(0,1).mul(r);for(let p of t){let m=p.getLines(),{position:g,rotation:y}=p;if(a.getConfig("Extended Line")&&(i.push({line:new M(g.sub(h),g.add(h))},{line:new M(g.sub(u),g.add(u))}),y&&i.push({line:new M(g.sub(m[0].end.rotate(g,y).sub(g).normalize().mul(r)),g.add(m[0].end.rotate(g,y).sub(g).normalize().mul(r)))})),a.getConfig("Perpendicular Foot")&&y){let b=m[1].start.rotate(g,y),T=m[1].end.rotate(g,y).sub(b).normalize();i.push({line:new M(g.sub(T.mul(r)),g.add(T.mul(r)))})}}if(n.push({line:new M(l.sub(h),l.add(h))},{line:new M(l.sub(u),l.add(u))}),c&&n.push({line:new M(l.sub(h.rotate(l,c).sub(l).normalize().mul(r)),l.add(h.rotate(l,c).sub(l).normalize().mul(r)))}),i.length>1)for(let p=0;p<i.length;p++)for(let m=0;m<n.length;m++){let g=Pt(i[p].line,n[m].line);for(let y=0;y<g;y+=2){let b=new S(Ee[y],Ee[y+1]);d(b)||s.push(b)}}return s;function d(p){for(let m of s)if(m.x===p.x&&m.y===p.y)return m;return null}}addSnapFlag(t,e){let r=new S(1,0),i=new S(0,1),n=new M(S.ORIGIN.add(r),S.ORIGIN.add(r.mul(-1))),s=new M(S.ORIGIN.add(i),S.ORIGIN.add(i.mul(-1))),a=Qe.rotate(e).translate(t.x,t.y),l={center:t,lines:[n.multiply3(a),s.multiply3(a)],rotation:e};this.snapFlags.findIndex(h=>h.center.similarEquals(t))<0&&this.snapFlags.push(l)}clearSnapFlag(){this.snapFlags=[]}handelAddSnapFlagPoint(t,e=!0){let r=(n,s)=>{let a=new S(1,0),l=new S(0,1),c=new M(S.ORIGIN.add(a),S.ORIGIN.add(a.mul(-1))),h=new M(S.ORIGIN.add(l),S.ORIGIN.add(l.mul(-1))),u=Qe.rotate(s).translate(n.x,n.y),d={center:n,lines:[c.multiply3(u),h.multiply3(u)],rotation:s};this.snapFlags.findIndex(m=>m.center.similarEquals(n)&&ne.eq(s,m.rotation))<0&&this.snapFlags.push(d)};fi.getInstance().adsorb&&le.adsorptionConfig.getConfig("Extended Line")&&(r(t,0),r(t,Math.PI/4))}handleAddSnapFlagData(t,e,r){if(this.snapOnlyCurrentLayer()&&!this.isActiveLayerPcbItem(e))return;let i,n;if(r&&r.length){for(let s of r)i=s.center,n=s.rotation||0,this.addSnapFlag(i,n);return}if(t&&t instanceof mt){let s=t.getParent(),a=null;s instanceof lt&&(a=s.getConnect(t,!0)),n=a?a.end.sub(a.start).angle(S.ORIGIN):0,i=t.start,this.addSnapFlag(i,n)}if(e&&e instanceof mt){let s=e.getParent(),a=null;s instanceof lt&&(a=s.getConnect(e,!1)),n=a?a.end.sub(a.start).angle(S.ORIGIN):0,i=e.end,this.addSnapFlag(i,n)}}snapToSnapFlag(t,e=!0,r=!1){if(!t.adsorb)return;let i=new S(t.realSceneX,t.realSceneY),n,s=le.adsorptionConfig.getSnapDistanceValue(),a=s,l=[];if(!this.snapFlags.length)return;for(let d of this.snapFlags){let{point:p,distance:m,line:g}=this.getNearestFlagPointInfo(i,d,r);m<a?([a,n]=[m,p],g&&l.push({line:g,flag:d})):g&&l&&p.x===n.x&&p.y===n.y&&l.push({line:g,flag:d})}let c,h,u=new S(t.sceneX,t.sceneY);if(n==null||t.getCrossFlags().find(d=>d.position.equals1(u))?c=u:(c=new S(n.x,n.y),h=l.length?l.map(d=>d.line):null),h){if(h instanceof Array&&h.length==2){let d=c2(h[0].start(),h[0].end(),h[1].start(),h[1].end());d&&d.distance1(c)<s&&(c=d)}e&&t.addExtensionCord(h),t.sceneDeltaX=c.x-t.sceneX,t.sceneDeltaY=c.y-t.sceneY,t.sceneX=c.x,t.sceneY=c.y}return t.getShowPoint()&&t.getShowPoint().setPosition(new S(t.sceneX,t.sceneY)),c}snapToOtherComponent(t,e,r,i){let{layerId:n,globalIndex:s}=t,a=t.getLines(),l;t instanceof ke?l=Ar.getAllItem().filter(b=>([n,b.layerId].includes(12)||b.layerId==n)&&b.globalIndex!==s):l=Qt.getAllItem().filter(b=>([n,b.layerId].includes(12)||b.layerId==n)&&b.globalIndex!==s);let h=le.adsorptionConfig.getSnapDistanceValue(),u=[],d,p,m=Qe.translate(e.x,e.y),g=t.getParent(),y=t.getGroupID();for(let b of l){let P=b.getGroupID();if(b instanceof Le){let I=b.getParent(),C=I==null?void 0:I.getGroupID(),E=g==null?void 0:g.getGroupID();if(I&&g&&(I.globalIndex==g.globalIndex||C&&E&&C==E))continue}if(P&&y&&P==y)continue;let T=b.getLines();for(let I=0;I<a.length;I++){let C=a[I];C=C.multiply3(m);let{point:E,distance:O,line:_,offset:x,isMidLine:v}=this.getNearestComponentPointInfo(C,T,I);O<=h&&([h,d]=[O,E],_&&u.every(D=>!D.line.equals1(_))&&u.push({line:_,offset:x,distance:O,isMidLine:v}))}}if(u.length){u=u.sort((E,O)=>O.distance-E.distance);let b,P,T=!0,I=!0;for(let E of u){let O=E.line;O.direct.x==0&&T?(b=E,E.isMidLine&&(T=!1)):O.direct.y==0&&I&&(P=E,E.isMidLine&&(I=!1))}(b||P)&&(u=[]),b&&u.push(b),P&&u.push(P);let C=u[u.length-1].offset;u.length>=2&&(C=new S(b.offset.x,P.offset.y)),m=Qe.translate(C.x,C.y),p=r.multiply3(m),i.addExtensionCord(u.map(E=>E.line),!0)}return p}getNearestComponentPointInfo(t,e,r){let n=le.adsorptionConfig.getSnapDistanceValue(),s=le.adsorptionConfig,a,l,c,h,u=!1,d=t.start(),p=t.end(),m=d.add(p).mul(.5);for(let g=0;g<e.length;g++){let y=e[g],b=er.foot(y,d),P=b.distance1(d),T=AL(d.x,d.y,y.start().x,y.start().y,y.end().x,y.end().y),I=AL(p.x,p.y,y.start().x,y.start().y,y.end().x,y.end().y),C=Math.min(T,I),E=()=>{let O=!1;return(t.direct.x==0&&y.direct.x==0||t.direct.y==0&&y.direct.y==0)&&(O=!0),O};if((l==null||P<l)&&P<n&&C<=100&&E()){l=P,a=b,h=b.sub(d);let O=y.start().add(y.end()).mul(.5);y=new M(O,m.add(h)),c=y,(g==4||g==5)&&(u=!0)}}return{point:a,distance:l,line:c,offset:h,isMidLine:u}}},ai=new rSe;var Qf=class{constructor(t){this.shoveEvent=new rR;this._chain=null;this.bases=new Array;this.kit=new Rc(1e-4);this.hiddens=new Array;this.event=t,t.numberOfIterator=0}get chain(){return this._chain==null&&(this._chain=this.shoveEvent.getChain(this.event.track),this.shoveEvent.shoveFun.result.sourceTrackChain.push(this._chain.tracks),this.shoveEvent.shoveFun.result.shovePathMap[0]=this._chain),this._chain}blockBaseTrack(t,e,r,i,n,s,a=!0){let l=this.blockRepairTrack(e,t,a),c=a?e.end:e.start;if(l.distance2(c)>1e-8&&r){let h=t.getEnd4Block(i,n.layerId,n.width,n.net);e==n?xe.addAll(s,h):s.push(l)}}blockRepairTrack(t,e,r){return t instanceof Id?e.blockBaseTrack(t,r):e.blockTrack(t,r)}getLengthIncrement(){let t=0;for(let e of this.bases)e!=null&&!e.isEmpty&&(t+=e.length);for(let e of this.hiddens)t-=e.length;return t}changeBaseTrack(t,e=t.start,r=t.end){t.isEmpty||(t.start=e,t.end=r)}recycleBaseTrack(){for(let t of this.bases)t.remove();this.bases.length=0}mapBase2Track(t=!1){for(let e of this.bases)if(e.length>.01){let r=this.createTrack(e.start,e.end,this.event.track);this.event.commands.addCommand(Ce.dispatch(r,"add")),A.publish("hasModifyPcbItem",r),t&&(this.event.resultTrack=r)}}getLines(t){let e=new Array;for(let r of t)if(r instanceof M)e.push(r);else break;return e}getCurrent(t,e,r){let i=e.direct,n=this.getNormalOffset(i,t),s=e.start().add(n),a=e.end().add(n);return this.getLine(s,a,r)}checkIntersection(t,e,r,i){if(e instanceof M){let n=t.direct,s=e.direct,a=n.cross(s);if(Math.abs(a)>1e-4){let l=this.getLine(e.start(),e.end(),r),c=this.getIntersection(t,l);if(c!=null){let h=e.start(),u=e.end();if(i?(h=c,this.kit.eq(c.distance1(u),0)&&(h=u)):(u=c,this.kit.eq(c.distance1(h),0)&&(u=h)),u.sub(h).normalize().dot(s)>=0)return c}}}return null}calculateNextIntersection(t,e,r,i,n){for(let s=t+1;s<=e;s++){let a=this.checkIntersection(r,i[s],n,!0);if(a!=null)return{index:s,point:a}}return{index:e,point:i[e].end()}}calculatePreviousIntersection(t,e,r,i,n){for(let s=t-1;s>=e;s--){let a=this.checkIntersection(r,i[s],n,!1);if(a!=null)return{index:s,point:a}}return{index:e,point:i[e].start()}}calculateProjectionLength(t,e,r,i){let n=t.sub(e);return this.getNormalOffset(r,n).dot(i)}getEndpointInfo(t,e,r){let i=new Array;if(t!=null&&i.push({point:t.start(),type:"PREVIOUS",projection:0,projectSameDirect:!1}),e!=null&&i.push({point:e.end(),type:"NEXT",projection:0,projectSameDirect:!1}),t!=null&&e!=null){let n=this.getLine(t.start(),t.end(),r),s=this.getLine(e.start(),e.end(),r),a=this.getIntersection(n,s);a!=null&&i.push({point:a,type:"INTERSECTION",projection:0,projectSameDirect:!1})}return i}realTimeAddCornerPath(t){if(this.isPush()||we.stretchTrackMinCorner<=0)return null;let{path:e,offset:r,isClosed:i,trackWidth:n,leftIsOther:s,rightIsOther:a,bbox:l,realtimeTracks:c}=t,[[h,u],[d,p],[m,g]]=c,y=e[d],b=e[h],P=e[m],T=y.direct,I=this.getNormalOffset(T,r).normalize(),C=0,E=0;if(u&&h==d-1&&this.isSameDir(b,I)){let O;s&&h==0&&(O=0);let _=O!==void 0?O:this.getTrackMinCorner(b,y,n),x=u.length;if(this.kit.less(b.length(),_)&&this.kit.greater(x,b.length())){let D=Math.min(x,_)-b.length(),w=Math.abs(I.dot(b.direct.mul(D)));E=Math.max(E,w),C--}}if(g&&m==this.getNextIndex(d,e,i)&&!this.isSameDir(P,I)){let O;a&&m==e.length-1&&(O=0);let _=O!==void 0?O:this.getTrackMinCorner(P,y,n),x=g.length;if(this.kit.less(P.length(),_)&&this.kit.greater(x,P.length())){let D=Math.min(x,_)-P.length(),w=Math.abs(I.dot(P.direct.mul(D)));E=Math.max(E,w),C++}}if(this.kit.greater(E,0)){let O=I.mul(E),{resultPre:_,resultNext:x}=this.calculateStretch({index:d,offset:O,path:e,bbox:l,isClosed:i,leftIsOther:s,rightIsOther:a,trackWidth:n});if(this.kit.eq(I.dot(y.start().sub(_.end)),0)){let F=null;if(C==1?F=_.index:C==-1&&(F=x.index),F!=null){let H=this.getEndPointCursor(e[F],y,I),z=this.calculateProjectionLength(p.start,y.start(),T,I);if(this.kit.greatereq(z,H)){O=I.mul(H);let V=this.calculateStretch({index:d,offset:O,path:e,bbox:l,isClosed:i,leftIsOther:s,rightIsOther:a,trackWidth:n});_=V.resultPre,x=V.resultNext}}}let v=_.index,D=x.index;if(this.kit.eq(_.end.distance1(x.start),0))return null;let w=Array.from(e);for(let F=v+1;F<d;F++)F==d-1?w[F]=new M(_.midPoint,_.end):w[F]=new M(_.midPoint,_.midPoint);for(let F=this.getNextIndex(d,e,i);F!=D;F=this.getNextIndex(F,e,i))F==this.getNextIndex(d,e,i)?w[F]=new M(x.start,x.midPoint):w[F]=new M(x.midPoint,x.midPoint);return w[v]=new M(_.start,_.midPoint),w[d]=new M(_.end,x.start),w[D]=new M(x.midPoint,x.end),w}return null}calculateStretch(t){let{index:e,offset:r,path:i,bbox:n,isClosed:s,leftIsOther:a,rightIsOther:l,trackWidth:c}=t,h=a&&e-1==0,u=l&&e+1==i.length-1,{startIndex:d,endIndex:p,index:m,newPath:g}=this.addGuideLineForConnectOther(i,e,r,a,l),y=this.getLimit4Offset(n,r),b=g[m],P=b.direct,T=this.getNormalOffset(b.direct,r).normalize(),I=this,{resPre:C,resNext:E}=this.calculateMoveRange({preIsConnectPadOrVia:h,nextIsConnectPadOrVia:u,offset:r,path:g,index:m,bbox:n,trackWidth:c,isClosed:s}),O=D(C.i,g),_=D(E.i,g),x=w(O,C.cursor,g,m,C.record),v=F(_,E.cursor,g,m,E.record);if(O!=C.i||_!=E.i){if(C.endPointCursor<E.endPointCursor){let V=w(O,C.endPointCursor,g,m),W=F(_,C.endPointCursor,g,m),L=W.midPoint.sub(V.midPoint),k=L.length()*H(L,P);for(let U=W.index+1;U<=v.index;U++){let B=g[U];if(this.isCollinear(B,b)){let G=H(B.direct,P);k+=B.length()*G}}for(let U=V.index-1;U>=0;U--){let B=g[U];if(this.isCollinear(B,b)){let G=H(B.direct,P);k+=B.length()*G}else break}let N=v.start.sub(P.mul(k));x={...x,start:N,midPoint:N,end:N}}else if(C.endPointCursor>E.endPointCursor){let V=w(O,E.endPointCursor,g,m),W=F(_,E.endPointCursor,g,m),L=W.midPoint.sub(V.midPoint),k=L.length()*H(L,P);for(let U=V.index-1;U>=x.index;U--){let B=g[U];if(this.isCollinear(B,b)){let G=H(B.direct,P);k+=B.length()*G}}for(let U=W.index+1;U<g.length;U++){let B=g[U];if(this.isCollinear(B,b)){let G=H(B.direct,P);k+=B.length()*G}else break}let N=x.end.add(P.mul(k));v={...v,end:N,midPoint:N,start:N}}}else z();return l&&E.i==g.length-1&&(v.index=E.i-1,v.end=i[i.length-1].end()),a&&(m--,x.index=D(x.index-1,i),v.index=D(v.index-1,i),C.i==0&&(x.start=i[0].start())),this.kit.eq(x.start.distance1(x.midPoint),0)&&(x.midPoint=x.end),this.kit.eq(v.end.distance1(v.midPoint),0)&&(v.midPoint=v.start),{resultPre:x,resultNext:v};function D(V,W){return V<0?0:V>=W.length?W.length-1:V}function w(V,W,L,k,N=S.ORIGIN){let U=I.getCurrent(T.mul(W),b,y),B=I.calculatePreviousIntersection(k,V,U,L,y),Y=L[B.index].start(),X=B.point,K=X.add(N);return{index:B.index,start:Y,midPoint:X,end:K}}function F(V,W,L,k,N=S.ORIGIN){let U=I.getCurrent(T.mul(W),b,y);k=s?-1:k;let B=I.calculateNextIntersection(k,V,U,L,y),Y=L[B.index].end(),X=B.point,K=X.add(N);return{index:B.index,end:Y,midPoint:X,start:K}}function H(V,W){return V.dot(W)>0?1:-1}function z(){let V=new M(x.midPoint,x.end),W=new M(v.midPoint,v.start),L=I.getIntersection(V,W);if(L)x.end=L,v.start=L;else{let k=g[v.index],N=I.checkIntersection(V,k,y,!0);if(N){x.end=N,v.start=N,v.midPoint=N;return}let U=g[x.index],B=I.checkIntersection(W,U,y,!1);B&&(v.start=B,x.end=B,x.midPoint=B)}}}calculateMoveRange(t){let{offset:e,path:r,index:i,bbox:n,trackWidth:s,isClosed:a,noOverNormalLength:l,preIsConnectPadOrVia:c,nextIsConnectPadOrVia:h}=t,u=this.getLimit4Offset(n,e),d=r[i],p={i:N(i-1),cursor:0,record:S.ORIGIN,endPointCursor:0},m={i:N(i+1),cursor:0,record:S.ORIGIN,endPointCursor:0},g={resPre:p,resNext:m};if(!(d instanceof M))return g;let y=this.getNormalOffset(d.direct,e),b=y.length(),P=y.normalize();if(this.kit.eq(b,0))return g;let T=d.start(),I=d.start(),C=b,E=b,O=!1,_=!1,x=V.call(this,i,!0),v=V.call(this,i,!1),D=!0,w=!0;for(;p.cursor<C||m.cursor<E;){let U=r[p.i],B=r[m.i],G=this.getEndpointInfo(U,B,u),Y=G.filter($=>$.type=="PREVIOUS")[0],X=G.filter($=>$.type=="NEXT")[0],K=G.filter($=>$.type=="INTERSECTION")[0];if(Y&&this.calculateEndpointProject([Y],T,d.direct,P),X&&this.calculateEndpointProject([X],I,d.direct,P),D){let $=z.call(this,U,x,d,C,Y,p,!0);p=$.res,C=$.vLength,O=$.springBack}if(w){let $=z.call(this,B,v,d,E,X,m,!1);m=$.res,E=$.vLength,_=$.springBack}Y&&Y.projectSameDirect&&(Y.projection+=p.cursor),X&&X.projectSameDirect&&(X.projection+=m.cursor);let J=p.i,se=m.i,ce=G.filter($=>!(m.cursor>=E&&$.type=="NEXT"));p.cursor=this.getCursor(ce,C,p.cursor),this.kit.eq(p.cursor,C)&&(p.cursor=C),T=d.start().add(P.mul(p.cursor)),L(p.i)&&(p.endPointCursor=p.cursor),!O&&Y&&Y.projectSameDirect&&this.kit.lesseq(Y.projection,p.cursor)&&(p.i=N(p.i-1));let te=G.filter($=>!(p.cursor>=C&&$.type=="PREVIOUS"));m.cursor=this.getCursor(te,E,m.cursor),this.kit.eq(m.cursor,E)&&(m.cursor=E),I=d.start().add(P.mul(m.cursor)),L(m.i)&&(m.endPointCursor=m.cursor),!_&&X&&X.projectSameDirect&&this.kit.lesseq(X.projection,m.cursor)&&(m.i=N(m.i+1)),D=J!=p.i,w=se!=m.i;let oe=!1;if(U&&B&&K){let $=K.point,fe=this.calculateProjectionLength(U.end(),d.start(),d.direct,P),Oe=this.calculateProjectionLength(B.start(),d.start(),d.direct,P),Te=Math.max(fe,Oe),ue=d.start().add(P.mul(Te));this.calculateEndpointProject([K],ue,d.direct,P);let be=this.calculateProjectionLength($,d.start(),d.direct,P);if(K.projectSameDirect){let j=!1;(!O&&this.kit.greatereq(p.cursor,be)||this.kit.greatereq(W(p),be))&&(j=!0),(!_&&this.kit.greatereq(m.cursor,be)||this.kit.greatereq(W(m),be))&&(j=!0),j&&(p.cursor=be,m.cursor=be,p.endPointCursor=be,m.endPointCursor=be,p.record=S.ORIGIN,m.record=S.ORIGIN,oe=!0)}}if(a&&p.i<m.i&&(p.i=N(p.i+1),m.i=N(m.i-1),oe=!0),oe)break}let F=W(p),H=W(m);if(!l&&!this.kit.eq(F,H)){let U=Math.min(F,H);return t.offset=P.mul(U),this.calculateMoveRange({...t,noOverNormalLength:!0})}return{resPre:p,resNext:m};function z(U,B,G,Y,X,{i:K,cursor:J,record:se,endPointCursor:ce},te){let oe=k(K,te);if(B instanceof M&&U instanceof M&&this.kit.greater(U.length(),0)){if(X.projectSameDirect&&this.isCollinear(U,B)){let $=U.direct.mul(se.length()),fe=new M(U.start(),U.end().add($)),Oe;te&&c&&(Oe=0),!te&&h&&(Oe=0);let Te=Oe!==void 0?Oe:this.getTrackMinCorner(fe,G,s),ue=Math.min(Te,fe.length()),be=U.direct;be.dot(P)>0&&(be=be.mul(-1));let j=X.point.add(be.mul(ue)),Z=this.calculateProjectionLength(j,G.start(),G.direct,P);this.kit.less(Z,Y)&&(se=be.mul(ue),Y=b+Math.abs(se.dot(P)))}if(!L(oe)||!X.projectSameDirect||this.isCollinear(U,G)){let $=this.getEndPointCursor(U,G,P);if(this.kit.greatereq(b,$))Y=b,se=S.ORIGIN;else if(this.kit.greatereq(Y,$)){if(Y=$,l){let fe=Math.abs(se.dot(P)),Oe=$-fe,Te=Math.max(Oe,b);se=se.mul(($-Te)/fe)}return{springBack:!0,vLength:Y,res:{i:K,cursor:J,record:se,endPointCursor:ce}}}}}return{springBack:!1,vLength:Y,res:{i:K,cursor:J,record:se,endPointCursor:ce}}}function V(U,B){let G=0,Y=r.length,X=-Math.sqrt(2)/2,K=d.direct;for(let J=k(U,B);L(J)&&G<Y;J=k(J,B)){let se=r[J],ce=B?K.dot(se.direct.mul(-1)):K.mul(-1).dot(se.direct);if(!this.isCollinear(se,d)&&ce<0&&this.kit.eq(ce,X))return se;G++}return null}function W(U){return U.cursor-Math.abs(U.record.dot(P))}function L(U,B=r.length){return U>=0&&U<B}function k(U,B){return N(B?U-1:U+1)}function N(U,B=r.length,G=t.isClosed){return G?(U+B)%B:U}}getTrackMinCorner(t,e,r){let i=we.stretchTrackMinCorner*r,n=e.direct,s=new S(-n.y,n.x),a=t.end().sub(t.start()),l=Math.abs(a.dot(n)),c=Math.abs(a.dot(s)),h=Math.max(l,c);if(h>0){let u=i/h;return t.length()*u}return 0}getEndPointCursor(t,e,r){let i=this.calculateProjectionLength(t.end(),e.start(),e.direct,r),n=this.calculateProjectionLength(t.start(),e.start(),e.direct,r);return Math.max(i,n)}isCollinear(t,e){let r=t instanceof S?t:t.direct,i=e instanceof S?e:e.direct;return this.kit.eq(r.cross(i),0)}isSameDir(t,e){let r=t instanceof S?t:t.direct,i=e instanceof S?e:e.direct;return r.dot(i)>0}handleAddSnapFlag(t,e){let{startType:r,endType:i,tracks:n,pts:s}=e,a=[],l=s[t],c=l.end().sub(l.start()).angle(S.ORIGIN),h=[0,1,2,11];h.includes(r)&&a.push({center:s[0].start(),rotation:c}),h.includes(i)&&a.push({center:s[s.length-1].end(),rotation:c});let d=s.filter((p,m)=>m!==t).filter(p=>this.isCollinear(l,p));for(let p of d)a.push({center:p.start(),rotation:c});ai.handleAddSnapFlagData(void 0,void 0,a)}getPreIndex(t,e,r=!1){let i=e.length;return r?(t-1+i)%i:t-1}getNextIndex(t,e,r=!1){let i=e.length;return r?(t+1+i)%i:t+1}isConnectOther(t){return[11,2,1].includes(t)}addGuideLineForConnectOther(t,e,r,i,n){let s=Array.from(t),a=0,l=t.length-1,c=t[e];if(i){let h=this.calculateAddLine(c.direct,r,t[0].start(),!0);s.unshift(h),e++,a=1}if(n){let h=this.calculateAddLine(c.direct.mul(-1),r,t[t.length-1].end(),!1);s.push(h),l=s.length-2}return{startIndex:a,endIndex:l,index:e,newPath:s}}calculateAddLine(t,e,r,i){let n=this.getNormalOffset(t,e),s=n.length(),a=r.add(n).add(t.mul(s)),l=r.sub(a),c=r.add(l.normalize());return i&&([r,c]=[c,r]),new M(r,c)}calculateEndpointProject(t,e,r,i){for(let n of t){let s=this.calculateProjectionLength(n.point,e,r,i);n.projection=s,n.type=="INTERSECTION"?n.projectSameDirect=this.kit.greater(s,0):n.projectSameDirect=this.kit.greatereq(s,-.1),this.kit.lesseq(s,0)&&(n.projection=0)}}getCursor(t,e,r){let i=new Array;i.push(e);for(let n of t)n.projectSameDirect&&i.push(n.projection);return r=Math.min(...i),r}getLimit4Offset(t,e){let r=t.extendOfSize(e.length());return r.width()+r.height()}getLine4Index(t,e,r,i,n,s){if(t<0&&s){let a=r.add(e.direct).normalize();return new M(e.start(),e.start().add(a.mul(i)))}else if(t>=n.length&&s){let a=r.sub(e.direct).normalize();return new M(e.end().add(a.mul(i)),e.end())}else return n[t]}visible(){for(let t of this.bases)t.visible();for(let t of this.hiddens)t.visible();this.hiddens.length=0}recordHistory(t){if(this.event.addHistory){this.event.commands=new De("repair line");for(let e of t)this.event.commands.addCommand(Ce.dispatch(e,"modify")),A.publish("hasModifyPcbItem",e);this.event.addHistory=!1}}cancelHiddenTrack(){this.hiddens.forEach(t=>{t.visible()})}getNormalOffset(t,e){let r=new S(-t.y,t.x);return r.mul(e.dot(r))}createBaseTrack(t,e,r){let i=Id.build(r.layerId,t,e,r.width,r.net);return this.bases.push(i),i}realTimePath(){return[]}shove(){let t=this.realTimePath(),e=this.shoveEvent.getNewChainFactory(this.chain,t).build();this.shoveEvent.shoveFun.remove4Rtree([this.chain]),this.shoveEvent.shoveFun.shoveMain(e),this.shoveEvent.shoveFun.add4Rtree([this.chain]);let r=this.shoveEvent.shoveFun.result;r.sourceTrackChain[0]=this.chain.tracks,this.shoveEvent.current=r,this.shoveEvent.preview(r)}shoveInterrupt(){this.shoveEvent.shoveTrackInterrupt()}getLine(t,e,r=1e3){let i=e.sub(t),n=i.normalize().mul(r+i.length());return new M(t.sub(n),t.add(n))}getIntersection(t,e){return Pt(t,e)>0?new S(Ee[0],Ee[1]):null}getPoint4Line(t,e,r){let i=new _e().ext1(e.bbox()).ext2(t).ext7(100).build1(),n=i.width()+i.height(),s=this.getLine(t,t.add(r),n),a=this.getLine(e.start(),e.end(),n);return this.getIntersection(s,a)}getInRangePoint(t,e,r,i){let n=e,s=new M(t,e);for(let a of r){let l=this.getPoint4Line(a,s,i);l!=null&&n.distance2(t)>l.distance2(t)&&(n=l)}return n}getNewTrackEnd(t,e,r,i){i||(e=e.mul(-1));let n=r.sub(t),s=this.getNormalOffset(e,n);return t.add(s.add(e.mul(s.length())))}createTrack(t,e,r){return pr.addTrack(r.layerId,t,e,r.width,!1,r.net)}syncTracks(t,e){for(let r=0;r<e.length;r++)t[r].start=e[r].start(),t[r].end=e[r].end()}lock(){return!1}isBlock(){return this.event.isBlock()}isPush(){return this.event.isPush()}};var dF=class extends Qf{constructor(t){super(t),this.event.commands=new De("repair line - drag single track"),this.start=this.event.oldStart,this.end=this.event.oldEnd}move(t){if(this.lock())return;let e=t.sub(this.event.lastMousePosition);this.moveOffset(e)}moveOffset(t){this.recordHistory([this.event.track]);let e;this.event.adsorbtion?(this.start=this.event.oldStart.add(t),e=ai.adsorpGrid(this.start),t=e.sub(this.event.oldStart)):e=this.event.oldStart.add(t);let r=this.event.adsorb(e,this.event.track.width,this.event.track.layerId).sub(e),i=this.event.oldEnd.add(t),n=this.event.adsorb(i,this.event.track.width,this.event.track.layerId).sub(i),s=r.length(),a=n.length();s!=0&&a!=0?s<a?t=t.add(r):t=t.add(n):s==0&&a!=0?t=t.add(n):s!=0&&a==0&&(t=t.add(r)),this.event.track.start=this.event.oldStart.add(t),this.event.track.end=this.event.oldEnd.add(t)}complete(){this.event.commands!=null&&this.event.commands.length>0&&A.publish("hasModifyPcbItem",this.event.track),this.shoveEvent.clearCache()}interrupt(){}};var R3t=1e-5,w0=class{constructor(){this.kit=new Rc(R3t);this.clearance=0;this.adsorp=null}getSafeClearance(t,e,r=!0){let i=0;r||(i=5);let n=Ao(e);if(n!=null){let u=re.getInstance().getBetweenNetRuleByNet(i,l1(e.model),t,n,e.layerId);if(u!=null){let d=re.getInstance().getSafeSpacing(u.name),p=l1(e.model),m=d.getClearance(p,i,e.layerId);return ve(m,2)}}if(e instanceof Ge){let u=re.getInstance().getNet(t);if(u!=null&&u.netDifferential!=null){let d=u.netDifferential;if(t!=e.net&&d.hasNet(t)&&d.hasNet(e.net))return re.getInstance().getDifferentialPhysics(d.differentialPhysics).getDifferentialPairSpacingMin(e.layerId)}}let s=re.getInstance().getSafeSpacingByNet(t,0),a=re.getInstance().getSafeSpacingByNet(n,l1(e.model)),l=l1(e.model),c=[s,a],h=-1;for(let u of c){let d=u.getClearance(l,i);h=Math.max(h,d)}if(h!=-1)return ve(h,2);for(let u of c){let d=u.getClearance(l,i);h=Math.max(h,d)}return ve(h,2)}checkIntersection(t){return!(this.blockTrack(t).distance1(t.end)>1e-8)}checkBaseIntersection(t){return!(this.blockBaseTrack(t).distance1(t.end)>1e-8)}checkSegment2(t,e,r,i,n,s){let a=new M(t,e);for(let l of s){let c=this.getSafeClearance(n,l),u=Math.max(c,0);ne.eq(u,0)||(e=this.checkClearance1(a,r,i,n,u,l),a=this.getNewPrimitive(a,e))}return e}getEnd4Block(t,e,r,i){this.adsorp instanceof He&&this.adsorp.layerId==11&&(e=11);let n=this.adsorp.getMathGraphics(e),s=t.angle(S.ORIGIN),a=Ae.rotateZ(-s),l=this.getSafeClearance(i,this.adsorp),c=n.multiply3(a.toMatrix3()).bbox().extendOfSize(r/2+l);return[c.UL().multiply3(Qe.rotate(s)),c.LL().multiply3(Qe.rotate(s))]}blockTrack(t,e=!0){if(t.length==0)return e?t.end:t.start;let r=t.buildBBox(),i=kt.search(r.extendOfSize(10)),n=new lT;i.setAction(n),i.doAction(["ArcTrack","Track","Pad","Via","Text","Image","Polygon","Rect","Circle"]);let s=n.items,a=t.end;e?a=t.end:a=t.start;let l=t.layerId,c=t.width,h=t.net,u=this.getPrimitive(t,e);for(let d of s){let p=this.getSafeClearance(h,d),g=Math.max(p,0);ne.eq(g,0)||(a=this.checkClearance1(u,l,c,h,g,d),u=this.getNewPrimitive(u,a))}return a}blockBaseTrack(t,e=!0){if(t.length==0)return e?t.end:t.start;let r=t.buildBBox(),i=kt.search(r.extendOfSize(10)),n=new lT;i.setAction(n),i.doAction(["ArcTrack","Track","Pad","Via","Text","Image","Polygon","Rect","Circle"]);let s=n.items,a=t.end;e?a=t.end:a=t.start;let l=t.layerId,c=t.width,h=t.net,u=t.primitive;e||(u=pp(u));for(let d of s){let p=this.getSafeClearance(h,d),g=Math.max(p,0);if(!ne.eq(g,0)&&(a=this.checkClearance1(u,l,c,h,g,d),u=this.getNewPrimitive(u,a),u.start().equals1(u.end())))break}return a}blockSegment(t,e,r,i,n=!0){let s=new _e().ext2(t.start).ext2(t.end).ext7(r).build1(),a=kt.search(s.extendOfSize(10)),l=new lT;a.setAction(l),a.doAction(["ArcTrack","Track","Pad","Via","Text","Image","Polygon","Rect","Circle"]);let c=l.items,h=t.end;n?h=t.end:h=t.start;let u=t.primitive;n||(u=new M(t.end,t.start));for(let d of c){let p=this.getSafeClearance(i,d),g=Math.max(p,0);ne.eq(g,0)||(h=this.checkClearance1(u,e,r,i,g,d),u=this.getNewPrimitive(u,h))}return h}checkClearance1(t,e,r,i,n,s){return s.isEmpty?t.end():s instanceof Ir||s instanceof yi?this.checkTrackTrack(t,e,r,i,s,n):s instanceof Le?this.checkTrackPad(t,e,r,i,s,n):s instanceof Ue?this.checkTrackVia(t,e,r,i,s,n):s instanceof lr?this.checkTrackText(t,e,r,i,s,n):s instanceof Mn?this.checkTrackImage(t,e,r,i,s,n):s instanceof lt?this.checkTrackProfile(t,e,r,i,s,n):s instanceof rr?this.checkTrackProfile(t,e,r,i,s,n):s instanceof Pr?this.checkTrackProfile(t,e,r,i,s,n):t.end()}checkTrackTrack(t,e,r,i,n,s){if(!this.isSameLayer(e,n.layerId)||this.isSameNet(i,n.net))return t.end();let a=r,l=n.width,c=this.getPrimitive(n),u=new er(t,c).getDistance();u=ve(u,2);let d=ve(s+a/2+l/2,2);if(this.kit.greatereq(ve(u),ve(d)))return t.end();{let p;return t instanceof M?c instanceof M?p=this.calcuLineLine(t,c,d):p=this.calcuLineArc(t,c,!0,d):c instanceof M?p=this.calcuLineArc(c,t,!1,d):p=this.calcuArcArc(t,c,d),this.adsorp=n,p}}checkTrackPad(t,e,r,i,n,s){let a=ar(n.layerId);if(i===n.net||!a&&n.layerId!==e)return t.end();let l=s+r/2,c=n.getMathGraphics(e,0),h=n.getMathGraphics(12,0),u=Number.MAX_VALUE,d=Number.MAX_VALUE;if(c!=null&&(u=this.getMin(t,c)),h!=null&&(d=this.getMin(t,h)),this.kit.lesseq(ve(u,2),ve(d,2))&&this.kit.less(ve(u,2),ve(l,2))){let p=this.getEnd(t,c,l);return this.adsorp=n,p}else if(this.kit.less(ve(d,2),ve(u,2))&&this.kit.less(ve(d,2),ve(l,2))){let p=this.getEnd(t,h,l);return this.adsorp=n,p}return t.end()}checkTrackVia(t,e,r,i,n,s){if(i===n.net)return t.end();if(n.type==1&&e!==n.startLayer&&e!==n.endLayer){if(ao(n.startLayer)){if(e<n.endLayer)return t.end()}else if(2==n.startLayer){if(e<n.startLayer)return t.end()}else if(e>n.startLayer||e<n.endLayer)return t.end()}let a=q.build2(n.center,0,360,n.radius,n.radius,ae.CCW),l=new er(t,a).getDistance(),c=s+r/2;if(this.kit.less(ve(l,2),ve(c,2))){let h=this.getEnd(t,ge.build2([a]),c);return this.adsorp=n,h}return t.end()}checkTrackProfile(t,e,r,i,n,s){switch(n.type){case"Board Outline":break;case"Fill Region":if(n.net===i||n.layerId!=e)return t.end();break;case"Prohibited Region":if(!ar(n.layerId)&&n.layerId!=e)return t.end();if(n.getComponent().track)s=.01;else return t.end();break;case"Copper Region":return t.end();case"Line":if(n.layerId==11)break;if(n.layerId!=e||n.net===i)return t.end();break;case"Slot Region":break}let l=this.getProfilePolyline(n),c=this.getMin(t,l),h=s+r/2;if(this.kit.less(ve(c,2),ve(h,2))||ve(c,2)==ve(h,2)&&ve(c,2)==0){let u=this.getEnd(t,l,h);return this.adsorp=n,u}return t.end()}checkTrackImage(t,e,r,i,n,s){if(e!=n.layerId)return t.end();let a=n.getMathGraphics(n.layerId,0),l=this.getMin(t,a),c=s+r/2;if(this.kit.less(ve(l,2),ve(c,2))){let h=this.getEnd(t,a,c);return this.adsorp=n,h}return t.end()}checkTrackText(t,e,r,i,n,s){if(e!=n.layerId)return t.end();let a=n.getMathGraphics(n.layerId,0),l=this.getMin(t,a),c=s+r/2;if(this.kit.less(ve(l,2),ve(c,2))){let h=this.getEnd(t,a,c);return this.adsorp=n,h}return t.end()}getEnd(t,e,r){let i=t.end();for(let n of e.primitives)n instanceof M?t instanceof M?(i=this.calcuLineLine(t,n,r),t=new M(t.start(),i)):(i=this.calcuLineArc(n,t,!1,r),t=q.build2(t.center,t.startAngle,i.angleD(t.center),t.rx,t.ry,t.sweep())):n instanceof q&&(t instanceof M?(i=this.calcuLineArc(t,n,!0,r),t=new M(t.start(),i)):(i=this.calcuArcArc(t,n,r),t=q.build2(t.center,t.startAngle,i.angleD(t.center),t.rx,t.ry,t.sweep())));return i}getNewPrimitive(t,e){return t instanceof M?new M(t.start(),e):q.build2(t.center,t.startAngle,e.angleD(t.center),t.rx,t.ry,t.sweep())}getPrimitive(t,e=!0){if(e){let r;return t instanceof Ir?r=new M(t.start,t.end):r=q.build2(t.center,t.startAngle/Math.PI*180,t.endAngle/Math.PI*180,t.radius,t.radius,t.sweep),r}else{let r;if(t instanceof Ir)r=new M(t.end,t.start);else{let i=t.sweep==ae.CCW?ae.CW:ae.CCW;r=q.build2(t.center,t.endAngle/Math.PI*180,t.startAngle/Math.PI*180,t.radius,t.radius,i)}return r}}isSameNet(t,e){return t===e}isSameLayer(t,e){return t===e}getProfilePolyline(t){let e=new Array;return t instanceof lt?e=t.primitives:t instanceof rr?t.getAllLinesInOrder().forEach(r=>e.push(r)):e.push(q.build2(t.center,0,360,t.radius,t.radius,ae.CCW)),ge.build2(e)}calcuLineLine(t,e,r){let i=t.start(),n=t.end();r+=this.clearance;let s=e.stroke(r*2,wr.ROUND,ae.CCW).asClose();if(new Dc().pointInPolyline(i,s))return i;let l=new Set;for(let c of s.primitives){let h=Pt(t,c);if(h>0)for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);l.add(d)}}if(l.size>0){let c=n.distance1(i);l.forEach(h=>{let u=h.distance1(i);u<c&&(n=h,c=u)})}return n}calcuLineArc(t,e,r,i){if(i+=this.clearance,r){let n=t.start(),s=t.end();if(i=i<.01?0:i,i==0)return t.start();let a=e.stroke(i*2,wr.ROUND,ae.CCW).asClose();if(new Dc().pointInPolyline(n,a))return n;let c=new Set;for(let h of a.primitives){let u=Pt(t,h);if(u>0)for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);c.add(p)}}if(c.size>0){let h=s.distance1(n);c.forEach(u=>{let d=u.distance1(n);d<h&&(s=u,h=d)})}return s}else{let n=e.start(),s=e.end(),a=(e.startAngle%360+360)%360,l=t.stroke(i*2,wr.ROUND,ae.CCW).asClose();if(new Dc().pointInPolyline(n,l))return n;let h=new Set;for(let u of l.primitives){let d=Pt(e,u);if(d>0)for(let p=0;p<d;p+=2){let m=new S(Ee[p],Ee[p+1]);h.add(m)}}if(h.size>0){let u=e.center,d=e.sweep(),p=e.sweepAngle;h.forEach(m=>{let g=(m.angleD(u)%360+360)%360;if(d==ae.CCW){let y=(g-a+360)%360;y<p&&(s=m,p=y)}else{let y=(g-a-360)%360;y>p&&(s=m,p=y)}})}return s}}calcuArcArc(t,e,r){let i=t.start(),n=t.end(),s=(t.startAngle%360+360)%360,a=e.stroke(r*2,wr.ROUND,ae.CCW).asClose();if(new Dc().pointInPolyline(i,a))return i;let c=new Set;for(let h of a.primitives){let u=Pt(t,h);if(u>0)for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);c.add(p)}}if(c.size>0){let h=t.center,u=t.sweep(),d=t.sweepAngle;c.forEach(p=>{let m=(p.angleD(h)%360+360)%360;if(u==ae.CCW){let g=(m-s+360)%360;g<d&&(n=p,d=g)}else{let g=(m-s-360)%360;g>d&&(n=p,d=g)}})}return n}getMin(t,e){let r=Number.MAX_VALUE;for(let i of e.primitives){let n=new er(t,i).getDistance();n<r&&(r=n)}return r}modifyTrackEnd(t,e){if(t instanceof Ir)t.end=e;else{let r=e.angle(t.center);t.endAngle=r}}};var h6=class extends Qf{constructor(e,r){super(e);this.block=new w0;this.length=e.track.length,this.center=r,this.event.commands=new De("repair line - single connnect pad"),this.event.blockTrack=this.block.checkIntersection(this.event.track),this.previous=this.createBaseTrack(this.center,this.center,this.event.track),this.center.equals1(this.event.oldStart)?this.direct=this.event.track.direct:this.direct=this.event.track.direct.mul(-1)}move(e){if(this.lock())return;let r=e.sub(this.event.lastMousePosition);this.moveOffset(r)}moveOffset(e){this.recordHistory([this.event.track]);let r=this.draw(this.center,this.event.oldStart.add(e),this.direct);this.changeBaseTrack(this.previous,r[0],r[1]),this.changeBaseTrack(this.event.track,r[1],r[2]),this.blockTrack()}draw(e,r,i){let n=r.sub(e),s=this.getNormalOffset(i,n),a=s.length(),l=e.add(s).add(i.mul(a)),c=l.add(i.mul(this.length));return[e,l,c]}realTimePath(){let e=new Array;return e.push(this.center,this.event.track.start,this.event.track.end),e}blockTrack(){let e=this.event.adsorpTrackSetting;if(this.event.adsorpTrackSetting=!1,this.event.numberOfIterator++,this.event.numberOfIterator>100){this.event.numberOfIterator=0;return}if(this.isBlock()){let r=this.block.blockTrack(this.event.track,this.getCheckEnd()),i=this.getCheckEnd()?this.event.track.end:this.event.track.start;if(r.distance2(i)>1e-8&&this.event.blockTrack&&(this.event.identify.startType==0||this.event.identify.startType==4?this.event.track.start=r:(this.event.identify.endType==0||this.event.identify.endType==4)&&(this.event.track.end=r)),this.previous!=null){let n=this.previous.length,s=this.block.blockSegment(this.previous,this.event.track.layerId,this.event.track.width,this.event.track.net);if(Math.abs(s.distance1(this.center)-n)>1e-8){let a=s.sub(this.event.oldStart);this.moveOffset(a),this.blockTrack()}}}else this.isPush()&&(this.shove(),this.event.track.hidden(),this.previous!=null&&this.previous.hidden());this.event.adsorpTrackSetting=e}getCheckEnd(){return this.event.identify.startType==0||this.event.identify.startType==4?!1:(this.event.identify.endType==0||this.event.identify.endType==4,!0)}complete(){this.previous!=null&&(this.shoveEvent.shoveTrackComplete(this.event)||(this.mapBase2Track(),A.publish("hasModifyPcbItem",this.event.track))),this.recycleBaseTrack(),this.previous=null,this.shoveEvent.clearCache()}interrupt(){this.recycleBaseTrack(),this.previous=null,this.shoveInterrupt()}};var pF=class extends Qf{constructor(e){super(e);this.block=new w0;this.nextIndex=1;this.lastMouseOffset=this.event.lastRealMousePosition.sub(this.event.track.start),this.event.commands=new De("repair line - single connnect Track"),this.event.blockTrack=this.block.checkIntersection(this.event.track),this.findTrack=new au(this.event.track,!0);let r=this.findTrack.tracks.indexOf(this.event.track),i=this.findTrack.pts;r!=0&&this.findTrack.reverseResult();let n=new _e;for(let s of this.findTrack.tracks)n.ext1(s.buildBBox());this.bbox=n.build1(),this.current=this.createBaseTrack(i[0].start(),i[0].end(),this.event.track),this.next=this.createBaseTrack(i[1].start(),i[1].end(),this.findTrack.tracks[1]),this.nextMid=this.createBaseTrack(i[1].start(),i[1].start(),this.findTrack.tracks[1]),this.path=Array.from(this.getLines(i)),this.handleAddSnapFlag(r,this.findTrack),this.blockNext=this.block.checkBaseIntersection(this.next)}move(e,r){if(this.lock())return;if(r){let n=ai.snapToSnapFlag(r,!1);n&&(e=n)}let i=this.getOffset(r);this.moveOffset(i),this.blockTrack(),this.optRealTimeAddCorner(i)}getOffset(e){let r,i=ai.snapToSnapFlag(e,!1);return i?r=i.sub(this.event.oldStart):r=new S(e.sceneX,e.sceneY).sub(this.event.oldStart).sub(this.lastMouseOffset),r}moveOffset(e){this.visible(),this.recordHistory(this.findTrack.tracks),this.syncTracks(this.findTrack.tracks,this.path);let{resultNext:r,resultPre:i}=this.draw(e,this.path,this.bbox),{index:n,start:s,midPoint:a,end:l}=r;if(n!=0){this.hiddens.length=0;for(let c=0,h=this.findTrack.tracks.length;c<h;c++){let u=this.findTrack.tracks[c];c>n?u.visible():(u.hidden(),this.hiddens.push(u))}this.changeBaseTrack(this.current,i.end,s),this.changeBaseTrack(this.event.track,i.end,s),this.changeBaseTrack(this.nextMid,s,a),this.changeBaseTrack(this.next,a,l),this.next.width=this.findTrack.tracks[n].width,this.nextMid.width=this.findTrack.tracks[n].width,this.nextIndex=n}}draw(e,r,i){if(r.length<=0)throw new Error("path length is zero,input error");let n=!1,s=!1,a=this.isConnectOther(this.findTrack.endType),l=this.findTrack.tracks[0].width;return this.calculateStretch({index:0,offset:e,path:r,bbox:i,isClosed:n,leftIsOther:s,rightIsOther:a,trackWidth:l})}blockTrack(){let e=this.event.adsorpTrackSetting;if(this.event.adsorpTrackSetting=!1,this.event.numberOfIterator++,this.event.numberOfIterator>100){this.event.numberOfIterator=0;return}if(this.isBlock()){(!this.blockNext||!this.event.blockTrack)&&(this.blockNext=this.block.checkBaseIntersection(this.next),this.event.blockTrack=this.block.checkBaseIntersection(this.current));let r=this.block.blockBaseTrack(this.current,!1),i=this.current.start;r.distance2(i)>1e-8&&this.event.blockTrack&&(this.changeBaseTrack(this.current,r),this.changeBaseTrack(this.event.track,r));let n=this.block.blockBaseTrack(this.next,!1);if(n.distance2(this.next.start)>1e-8&&this.blockNext){let s=this.block.getEnd4Block(this.event.direct,this.current.layerId,this.current.width,this.current.net);n=this.getInRangePoint(this.next.end,n,s,this.event.direct);let a=n.sub(this.path[0].start());this.moveOffset(a),this.blockTrack()}}else this.isPush()&&(this.shove(),this.current.hidden(),this.nextMid.hidden(),this.next.hidden());this.event.adsorpTrackSetting=e}realTimePath(){let e=new Array;e.push(this.current.start),e.push(this.current.end),e.push(this.nextMid.end),e.push(this.next.end);let r=this.getLines(this.path);for(let i=this.nextIndex+1,n=r.length;i<n;i++){let s=r[i];e.push(s.end())}return e}complete(){if(this.event.commands!=null&&this.event.commands.length>0&&!this.shoveEvent.shoveTrackComplete(this.event)){for(let r=0,i=this.findTrack.tracks.length;r<i&&r<=this.nextIndex;r++){let n=this.findTrack.tracks[r];this.event.commands.addCommand(Ce.dispatch(n,"delete")),A.publish("hasModifyPcbItem",n),n.remove(),A.publish("delete",n)}for(let r=this.nextIndex+1,i=this.findTrack.tracks.length;r<i;r++)this.findTrack.tracks[r].visible();this.mapBase2Track()}this.recycleBaseTrack(),this.current=null,this.next=null,this.shoveEvent.clearCache()}interrupt(){this.recycleBaseTrack(),this.cancelHiddenTrack(),this.current=null,this.next=null,this.shoveInterrupt()}getIntersection(e,r){return Pt(e,r)>0?new S(Ee[0],Ee[1]):null}optRealTimeAddCorner(e){let{path:r,bbox:i}=this,{current:n,nextIndex:s,next:a}=this,l=0,c=[[-1,null],[l,n],[s,a]],h=!1,u=this.isConnectOther(this.findTrack.endType),d=this.findTrack.tracks[0].width,p=this.realTimeAddCornerPath({offset:e,path:r,realtimeTracks:c,leftIsOther:h,rightIsOther:u,trackWidth:d,bbox:i});p&&(this.path=p,this.event.oldStart=p[l].start())}};var Lj=class extends Qf{constructor(e){super(e);this.block=new w0;this.lastMouseOffset=this.event.lastRealMousePosition.sub(this.event.track.start),this.event.commands=new De("repair line - Multi connnect"),this.event.blockTrack=this.block.checkIntersection(this.event.track),this.next=this.createBaseTrack(this.event.oldEnd,this.event.oldEnd,this.event.track),this.previous=this.createBaseTrack(this.event.oldStart,this.event.oldStart,this.event.track);let r=new au(this.event.track,!0),i=r.tracks.indexOf(this.event.track);this.handleAddSnapFlag(i,r)}move(e,r){if(this.lock())return;let i=this.getOffset(r);this.moveOffset(i)}getOffset(e){let r,i=ai.snapToSnapFlag(e,!1);return i?r=i.sub(this.event.oldStart):r=new S(e.sceneX,e.sceneY).sub(this.event.oldStart).sub(this.lastMouseOffset),r}moveOffset(e){this.visible(),this.recordHistory([this.event.track]);let r=this.getNormalOffset(this.event.direct,e),i=this.event.oldStart.add(r),n=this.getNewTrackEnd(this.event.oldStart,this.event.direct,i,!0),s=this.getNewTrackEnd(this.event.oldEnd,this.event.direct,i,!1);if(this.event.optimizationDirect(s.sub(n).normalize()).dot(this.event.direct)<=0){let l=this.getLine(this.event.oldStart,n),c=this.getLine(this.event.oldEnd,s),h=this.getIntersection(l,c);h!=null&&(n=h,s=h)}this.changeBaseTrack(this.previous,this.event.oldStart,n),this.changeBaseTrack(this.event.track,n,s),this.changeBaseTrack(this.next,s,this.event.oldEnd),this.blockTrack()}realTimePath(){return[this.previous.start,this.previous.end,this.next.start,this.next.end]}blockTrack(){let e=this.event.adsorpTrackSetting;if(this.event.adsorpTrackSetting=!1,this.event.numberOfIterator++,this.event.numberOfIterator>100){this.event.numberOfIterator=0;return}if(this.isBlock()){this.event.blockTrack||(this.event.blockTrack=this.block.checkIntersection(this.event.track)),this.block.adsorp=null;let r=new Array,i=this.event.line;if(this.blockBaseTrack(this.block,this.previous,!0,i.direct,this.event.track,r),this.blockBaseTrack(this.block,this.next,!0,i.direct,this.event.track,r,!1),this.blockBaseTrack(this.block,this.event.track,this.event.blockTrack,i.direct,this.event.track,r),r.length>0){let s=this.event.getEnd(i,r).sub(i.start());this.moveOffset(s)}}else this.isPush()&&(this.shove(),this.event.track.hidden(),this.previous.hidden(),this.next.hidden());this.event.adsorpTrackSetting=e}complete(){this.event.commands!=null&&this.event.commands.length>0&&(this.shoveEvent.shoveTrackComplete(this.event)||(this.mapBase2Track(),A.publish("hasModifyPcbItem",this.event.track)),this.recycleBaseTrack(),this.previous=null,this.next=null),this.shoveEvent.clearCache()}interrupt(){this.recycleBaseTrack(),this.cancelHiddenTrack(),this.previous=null,this.next=null,this.shoveInterrupt()}};var Mj=class extends Qf{constructor(e,r){super(e);this.block=new w0;this.lastMouseOffset=this.event.lastRealMousePosition.sub(this.event.track.start),this.center=r,this.findTrack=new au(this.event.track,!0),this.findTrack.tracks.indexOf(this.event.track)!=0&&this.findTrack.reverseResult(),this.index=this.findTrack.tracks.indexOf(this.event.track),this.nextIndex=this.index+1;let n=new _e;for(let s of this.findTrack.tracks)n.ext1(s.buildBBox());this.bbox=n.build1(),this.previous=this.createBaseTrack(this.center,this.center,this.event.track),this.current=this.createBaseTrack(this.findTrack.pts[0].start(),this.findTrack.pts[0].end(),this.event.track),this.next=this.createBaseTrack(this.findTrack.pts[1].start(),this.findTrack.pts[1].end(),this.findTrack.tracks[1]),this.nextMid=this.createBaseTrack(this.findTrack.pts[1].start(),this.findTrack.pts[1].start(),this.findTrack.tracks[1]),this.center=r,this.event.commands=new De("repair line - connnect Track and other"),this.blockNext=this.block.checkBaseIntersection(this.next),this.event.blockTrack=this.block.checkIntersection(this.event.track),this.handleAddSnapFlag(this.index,this.findTrack)}move(e,r){if(this.lock())return;let i=this.getOffset(r);this.moveOffset(i)}getOffset(e){let r,i=ai.snapToSnapFlag(e,!1);return i?r=i.sub(this.event.oldStart):r=new S(e.sceneX,e.sceneY).sub(this.event.oldStart).sub(this.lastMouseOffset),r}moveOffset(e){this.visible(),this.recordHistory([this.event.track]);let{resultPre:r,resultNext:i}=this.draw(e,this.getLines(this.findTrack.pts),this.bbox);for(let n=0,s=this.findTrack.tracks.length;n<s;n++){let a=this.findTrack.tracks[n];n>i.index?a.visible():(a.hidden(),this.hiddens.push(a))}this.changeBaseTrack(this.previous,r.start,r.end),this.changeBaseTrack(this.current,r.end,i.start),this.changeBaseTrack(this.event.track,r.end,i.start),this.changeBaseTrack(this.nextMid,i.start,i.midPoint),this.changeBaseTrack(this.next,i.midPoint,i.end),this.next.width=this.findTrack.tracks[i.index].width,this.nextMid.width=this.findTrack.tracks[i.index].width,this.nextIndex=i.index,this.blockTrack()}draw(e,r,i){if(r.length<=0)throw new Error("path length is zero,input error");let n=!1,s=!0,a=this.isConnectOther(this.findTrack.endType),l=this.findTrack.tracks[0].width,c=this.index;return this.calculateStretch({index:c,offset:e,path:r,bbox:i,isClosed:n,leftIsOther:s,rightIsOther:a,trackWidth:l})}realTimePath(){let e=new Array,r=!1,i=this.getLines(this.findTrack.pts);for(let n=0,s=i.length;n<s;n++){let a=i[n];n>this.nextIndex?e.push(a.end()):r||(e.push(this.previous.start,this.current.start,this.current.end,this.nextMid.end,this.next.end),r=!0)}return e}blockTrack(){let e=this.event.adsorpTrackSetting;if(this.event.adsorpTrackSetting=!1,this.event.numberOfIterator++,this.event.numberOfIterator>100){this.event.numberOfIterator=0;return}if(this.isBlock()){(!this.blockNext||!this.event.blockTrack)&&(this.blockNext=this.block.checkBaseIntersection(this.next),this.event.blockTrack=this.block.checkBaseIntersection(this.current)),this.block.adsorp=null;let r=new Array,i=this.findTrack.pts[this.index];if(this.blockBaseTrack(this.block,this.previous,!0,i.direct,this.current,r),this.blockBaseTrack(this.block,this.next,this.blockNext,i.direct,this.current,r,!1),this.blockNext&&r.length==0&&this.blockBaseTrack(this.block,this.current,this.event.blockTrack,i.direct,this.current,r),r.length>0){let s=this.event.getEnd(i,r).sub(i.start());this.moveOffset(s)}}else this.isPush()&&(this.shove(),this.previous.hidden(),this.current.hidden(),this.next.hidden(),this.nextMid.hidden());this.event.adsorpTrackSetting=e}complete(){if(this.event.commands!=null&&!this.shoveEvent.shoveTrackComplete(this.event)){for(let r=0,i=this.findTrack.tracks.length;r<i;r++){let n=this.findTrack.tracks[r];r>this.nextIndex?n.visible():n.isEmpty||(this.event.commands.addCommand(Ce.dispatch(n,"delete")),A.publish("hasModifyPcbItem",n),n.remove(),A.publish("delete",n))}this.mapBase2Track()}this.recycleBaseTrack(),this.previous=null,this.current=null,this.next=null,this.shoveEvent.clearCache()}interrupt(){this.recycleBaseTrack(),this.cancelHiddenTrack(),this.previous=null,this.current=null,this.next=null,this.shoveInterrupt()}};var Nj=class extends Qf{constructor(e){super(e);this.block=new w0;this.lastMouseOffset=this.event.lastRealMousePosition.sub(this.event.track.start),this.findTrack=new au(this.event.track,!0);let r=this.findTrack.tracks.indexOf(this.event.track),i=this.isConnectOther(this.findTrack.startType),n=this.isConnectOther(this.findTrack.endType),s=this.findTrack.pts;this.isClosed=!1,!i&&!n&&s[0].start().equals(s[s.length-1].end())&&(this.isClosed=!0),this.index=r,this.previousIndex=this.getPreIndex(r,s,this.isClosed),this.nextIndex=this.getNextIndex(r,s,this.isClosed);let a=new _e;for(let d of this.findTrack.tracks)a.ext1(d.buildBBox());this.bbox=a.build1();let l=this.findTrack.pts[this.previousIndex],c=this.findTrack.tracks[this.previousIndex];this.previous=this.createBaseTrack(l.start(),l.end(),c),this.previousMid=this.createBaseTrack(l.end(),l.end(),c),this.current=this.createBaseTrack(this.findTrack.pts[r].start(),this.findTrack.pts[r].end(),this.event.track);let h=this.findTrack.pts[this.nextIndex],u=this.findTrack.tracks[this.nextIndex];this.nextMid=this.createBaseTrack(h.start(),h.start(),u),this.next=this.createBaseTrack(h.start(),h.end(),u),this.path=Array.from(this.getLines(this.findTrack.pts)),this.blockPrev=this.block.checkBaseIntersection(this.previous),this.blockNext=this.block.checkBaseIntersection(this.next),this.event.blockTrack=this.block.checkBaseIntersection(this.current),this.event.commands=new De("repair line - connect Track"),this.handleAddSnapFlag(this.index,this.findTrack)}move(e,r){if(this.lock())return;let i=this.getOffset(r);this.moveOffset(i),this.blockTrack(),this.optRealTimeAddCorner(i)}getOffset(e){let r,i=ai.snapToSnapFlag(e,!1);return i?r=i.sub(this.event.oldStart):r=new S(e.sceneX,e.sceneY).sub(this.event.oldStart).sub(this.lastMouseOffset),r}moveOffset(e){this.visible(),this.recordHistory(this.findTrack.tracks),this.syncTracks(this.findTrack.tracks,this.path);let{resultPre:r,resultNext:i}=this.draw(e,this.path,this.bbox);for(let a=0,l=this.findTrack.tracks.length;a<l;a++){let c=this.findTrack.tracks[a];this.isClosed&&a<r.index&&a>i.index||!this.isClosed&&(a<r.index||a>i.index)?c.visible():(c.hidden(),this.hiddens.push(c))}this.changeBaseTrack(this.previous,r.start,r.midPoint),this.changeBaseTrack(this.previousMid,r.midPoint,r.end),this.changeBaseTrack(this.current,r.end,i.start),this.changeBaseTrack(this.event.track,r.end,i.start),this.changeBaseTrack(this.nextMid,i.start,i.midPoint),this.changeBaseTrack(this.next,i.midPoint,i.end);let n=this.findTrack.tracks[r.index].width;this.previous.width=n,this.previousMid.width=n;let s=this.findTrack.tracks[i.index].width;this.next.width=s,this.nextMid.width=s,this.previousIndex=r.index,this.nextIndex=i.index}draw(e,r,i){let{isClosed:n}=this,s=this.isConnectOther(this.findTrack.startType),a=this.isConnectOther(this.findTrack.endType),l=this.findTrack.tracks[0].width,c=this.index;return this.calculateStretch({index:c,offset:e,path:r,bbox:i,isClosed:n,leftIsOther:s,rightIsOther:a,trackWidth:l})}blockTrack(){let e=this.event.adsorpTrackSetting;if(this.event.adsorpTrackSetting=!1,this.event.numberOfIterator++,this.event.numberOfIterator>100){this.event.numberOfIterator=0;return}if(this.isBlock()){(!this.blockPrev||!this.blockNext||!this.event.blockTrack)&&(this.blockPrev=this.block.checkBaseIntersection(this.previous),this.blockNext=this.block.checkBaseIntersection(this.next),this.event.blockTrack=this.block.checkBaseIntersection(this.current)),this.block.adsorp=null;let r=new Array,n=this.path[this.index];if(this.blockBaseTrack(this.block,this.previous,this.blockPrev,n.direct,this.current,r),this.blockBaseTrack(this.block,this.next,this.blockNext,n.direct,this.current,r,!1),this.blockPrev&&this.blockNext&&r.length==0&&this.blockBaseTrack(this.block,this.current,this.event.blockTrack,n.direct,this.current,r),r.length>0){let a=this.event.getEnd(n,r).sub(n.start());this.moveOffset(a),this.blockTrack()}}else this.isPush()&&(this.shove(),this.previous.hidden(),this.previousMid.hidden(),this.current.hidden(),this.next.hidden(),this.nextMid.hidden());this.event.adsorpTrackSetting=e}shove(){let e=this.realTimePath(),r=this.shoveEvent.getNewChainFactory(this.chain,e).build();this.shoveEvent.shoveFun.remove4Rtree([this.chain]),this.shoveEvent.shoveFun.shoveMain(r),this.shoveEvent.shoveFun.add4Rtree([this.chain]);let i=this.shoveEvent.shoveFun.result;i.sourceTrackChain[0]=this.chain.tracks,this.shoveEvent.current=i,this.shoveEvent.preview(i)}realTimePath(){let e=new Array,r=!1,i=this.getLines(this.path);for(let n=0,s=i.length;n<s;n++){let a=i[n];n<this.previousIndex?e.push(a.start()):n>this.nextIndex?e.push(a.end()):r||(e.push(this.previous.start,this.previousMid.start,this.current.start,this.current.end,this.nextMid.end,this.next.end),r=!0)}return e}complete(){if(this.event.commands!=null&&this.event.commands.length>0&&!this.shoveEvent.shoveTrackComplete(this.event)){for(let r=0,i=this.findTrack.tracks.length;r<i;r++){let n=this.findTrack.tracks[r];this.isClosed&&r<this.previousIndex&&r>this.nextIndex||!this.isClosed&&(r<this.previousIndex||r>this.nextIndex)?n.visible():n.isEmpty||(this.event.commands.addCommand(Ce.dispatch(n,"delete")),A.publish("hasModifyPcbItem",n),n.remove(),A.publish("delete",n))}this.mapBase2Track()}this.recycleBaseTrack(),this.previous=null,this.current=null,this.next=null,this.shoveEvent.clearCache()}interrupt(){this.recycleBaseTrack(),this.cancelHiddenTrack(),this.previous=null,this.current=null,this.next=null,this.shoveInterrupt()}optRealTimeAddCorner(e){let{path:r,isClosed:i,bbox:n}=this,{previousIndex:s,previous:a,index:l,current:c,nextIndex:h,next:u}=this,d=[[s,a],[l,c],[h,u]],p=this.isConnectOther(this.findTrack.startType),m=this.isConnectOther(this.findTrack.endType),g=this.findTrack.tracks[0].width,y=this.realTimeAddCornerPath({offset:e,path:r,realtimeTracks:d,leftIsOther:p,rightIsOther:m,isClosed:i,trackWidth:g,bbox:n});y&&(this.path=y,this.event.oldStart=y[l].start())}};var CR=class{constructor(t){this.adsorpTrackSetting=!0;this.commands=null;this.addHistory=!0;this.identify=null;this.track=null;this.direct=null;this.adsorbtion=!1;this.point=null;this.blockTrack=!0;this.resultTrack=null;this.isCoSelect=!1;this.isMultiRepair=!1;this.isClickPoint=!1;this.numberOfIterator=0;this.track=t,this.oldStart=t.start,this.oldEnd=t.end,this.direct=this.optimizationDirect(this.oldEnd.sub(this.oldStart).normalize()),this.identify=new ou(t),this.line=this.track.primitive,this.isCoSelect=this.isCoSelect,this.lastMousePosition=t.start,Ut.getToleranceTargetNet(this.track.net)}get coSelect(){return this.isCoSelect}set coSelect(t){this.isCoSelect=t}getTool(){let t=new au(this.track,!0),e=t.tracks.indexOf(this.track),r=t.tracks[e-1]!=null,i=t.tracks[e+1]!=null;if(r&&i)return new Nj(this);let n=this.identify.startType,s=this.identify.endType;if(n==0||n==4){if(s==0||s==4)return r||i?new pF(this):new dF(this);if(s==5||s==6){let a=this.identify.endNodes[0],l=this.optimizationDirect(a.end.sub(a.start).normalize());return Math.abs(this.direct.cross(l))<dl?new h6(this,this.oldEnd):new pF(this)}else return new h6(this,this.oldEnd)}else if(n==5||n==6){let a=this.identify.startNodes[0],l=this.optimizationDirect(a.end.sub(a.start).normalize()),c=Math.abs(this.direct.cross(l));return s==0||s==4?c<dl?new h6(this,this.oldStart):new pF(this):s==5||s==6?new Nj(this):new Mj(this,this.oldEnd)}else{if(s==0||s==4)return new h6(this,this.oldStart);if(s==5||s==6){let a=this.identify.endNodes[0],l=this.optimizationDirect(a.end.sub(a.start).normalize());return Math.abs(this.direct.cross(l))<dl?new Lj(this):new Mj(this,this.oldStart)}else return new Lj(this)}}setMultiRepair(t){this.isMultiRepair=t}isBlock(){if(this.isMultiRepair)return!1;let t=Zt.getInstance();return t.mode=="WIRING_MODE_SURROUND_AND_PUSHAWAY"||t.mode=="WIRING_MODE_SURROUND"}isPush(){return this.isMultiRepair?!1:Zt.getInstance().mode=="WIRING_MODE_PUSHAWAY"}optimizationDirect(t){let e;Math.abs(t.x)<1e-8?e=0:e=t.x;let r;return Math.abs(t.y)<1e-8?r=0:r=t.y,new S(e,r)}adsorb(t,e,r){if(!fi.getInstance().adsorb||!this.adsorpTrackSetting)return t;this.clearAdsorpPoint();let i=new _e().ext2(t).ext7(e).build1(),n=kt.search(i,(l,c)=>(c=="ArcTrack"||c=="Track")&&l==r||c=="Pad"&&(l==12||l==r)||c=="Via");n.setFilter(new Mp(t.x,t.y)).setFilter(new ed);let s=new b1;n.setAction(s),n.doAction(["Track","ArcTrack","Pad","Via"]);let a=new Array;for(let l of s.pads)if(l.net==this.track.net)return this.showAdsorpPoint(l.center),l.center;for(let l of s.vias)if(l.net==this.track.net)return this.showAdsorpPoint(l.center),l.center;for(let l of s.tracks)l!=this.track&&a.push(l);return a.length>0?ai.adsorpTrack(t,a[0]):t}showAdsorpPoint(t){this.point=new Ui(1002,t),setTimeout(()=>{this.point!=null&&(this.point.remove(),this.point=null)},2e3)}clearAdsorpPoint(){this.point!=null&&(this.point.remove(),this.point=null)}adsorpTrack(t,e,r,i){if(!this.adsorpTrackSetting)return t;let n=new _e().ext2(t).ext7(e).build1(),s=kt.search(n,(l,c)=>l==r&&(c=="Track"||c=="ArcTrack")),a=new Array;for(let l of s.getTracks())!i.has(l)&&l.isSelect(t.x,t.y)&&l.isVisible&&l.layerId==r&&l.net==this.track.net&&a.push(l);return a.length>0?ai.adsorpTrack(t,a[0]):t}getEnd(t,e){let r=Number.MAX_VALUE,i=e[0];for(let n of e){let a=er.foot(t,n).distance2(n);a<r&&(r=a,i=n)}return i}};var ooe=class extends Qf{constructor(e,r,i){super(e);this.orthogonalFirst=!1;this.degreeTool=new Xn;this.setUpConnectTrack(r);let n=this.event.direct;this.orthogonalFirst=Math.abs(n.cross(new S(0,1)))<dl||Math.abs(n.cross(new S(1,0)))<dl,this.event.commands=new De(i)}repairTrack(e){if(this.lock())return;this.dragPoint=this.dragPoint.multiply4(e),this.visible(),this.recordHistory();let r=this.degreeTool.degree45Model(this.dragPoint,this.fixedPoint),i=r[0];this.orthogonalFirst&&(i=r[1]),this.changeBaseTrack(this.current,this.dragPoint,i),this.changeBaseTrack(this.next,i,this.fixedPoint)}move(e){}moveOffset(e){}complete(){this.event.commands!=null&&this.event.commands.length>0&&(this.shoveEvent.shoveTrackComplete(this.event)||(A.publish("hasModifyPcbItem",this.current),this.isTrack(this.next)&&A.publish("hasModifyPcbItem",this.next),this.mapBase2Track())),this.recycleBaseTrack(),this.current=null,this.next=null,this.shoveEvent.clearCache()}recordHistory(){let e=[this.current];this.isTrack(this.next)&&e.push(this.next),super.recordHistory(e)}getAssociationTrack(){return this.isTrack(this.next)?this.next:null}lock(){return this.current.locked}isTrack(e){return e instanceof Ir&&!(e instanceof Id)}setUpConnectTrack(e){this.findTrack=new au(this.event.track,!0);let{tracks:r,pts:i}=this.findTrack,n=r.indexOf(this.event.track),s=new ou(r[n]);if(e){let a=r.indexOf(s.endNodes[0]);a>0?n>a&&this.findTrack.reverseResult():r[n].start.equals1(i[n].start())||this.findTrack.reverseResult()}else{let a=r.indexOf(s.startNodes[0]);a>0?n>a&&this.findTrack.reverseResult():r[n].end.equals1(i[n].start())||this.findTrack.reverseResult()}i=this.findTrack.pts,n=r.indexOf(this.event.track),this.current=r[n],this.current.start=i[n].start(),this.current.end=i[n].end(),r[n+1]&&!r[n+1].locked?(this.next=r[n+1],this.next.start=i[n].end(),this.next.end=i[n+1].end()):this.next=this.createBaseTrack(i[n].end(),i[n].end(),this.event.track),this.dragPoint=this.current.start,this.fixedPoint=this.next.end}interrupt(){this.recycleBaseTrack(),this.current=null,this.next=null,this.shoveInterrupt()}};var Bm=xT();function D3t(){var o,t;return Bm.innerWidth||((t=(o=Bm.document)==null?void 0:o.documentElement)==null?void 0:t.clientWidth)||0}function w3t(){var o,t;return Bm.innerHeight||((t=(o=Bm.document)==null?void 0:o.documentElement)==null?void 0:t.clientHeight)||0}var Hbn={winWidth:D3t(),winHeight:w3t()};function Ub(o){return navigator.userAgent.indexOf(o)}var A2=Ub("Mac OS")>0,XVe=Ub("chromeframe")>0||Ub("x-clock")>0,soe=(Ub("MSIE")>0||Ub("Trident")>=0)&&!XVe,L3t=soe&&Ub("MSIE 9.0")>0,iSe=Ub("Edge/")>0,kj=Ub("Opera/")===0,SR=Ub("Firefox/")>0,M3t=SR&&navigator.userAgent.match(/Firefox\/(\d+(\.\d+)?)/)[1],N3t=Ub("AppleWebKit")>0,AS=Ub("Chrome/")>0&&!soe&&!iSe&&!kj&&!SR,k3t=AS&&navigator.userAgent.match(/Chrome\/(\d+(\.\d+)?)/)[1],B3t=Ub("Safari/")>-1&&!soe&&!iSe&&!kj&&!SR&&!AS,F3t=Ub("Electron/")>0,jVe,V3t=(jVe=Bm.document)==null?void 0:jVe.createDocumentFragment();Bm.isMacOS=A2;Bm.gClipboard=V3t;Bm.isChromeFrame=XVe;Bm.isIE=soe;Bm.isIE9=L3t;Bm.isEdge=iSe;Bm.isOpera=kj;Bm.isFirefox=SR;Bm.firefoxVersion=M3t;Bm.isWebkit=N3t;Bm.isChrome=AS;Bm.chromeVersion=k3t;Bm.isSafari=B3t;Bm.isElectron=F3t;var Vy=(Lt=>(Lt[Lt.A=65]="A",Lt[Lt.B=66]="B",Lt[Lt.C=67]="C",Lt[Lt.D=68]="D",Lt[Lt.E=69]="E",Lt[Lt.F=70]="F",Lt[Lt.G=71]="G",Lt[Lt.H=72]="H",Lt[Lt.I=73]="I",Lt[Lt.J=74]="J",Lt[Lt.K=75]="K",Lt[Lt.L=76]="L",Lt[Lt.M=77]="M",Lt[Lt.N=78]="N",Lt[Lt.O=79]="O",Lt[Lt.P=80]="P",Lt[Lt.Q=81]="Q",Lt[Lt.R=82]="R",Lt[Lt.S=83]="S",Lt[Lt.T=84]="T",Lt[Lt.U=85]="U",Lt[Lt.V=86]="V",Lt[Lt.W=87]="W",Lt[Lt.X=88]="X",Lt[Lt.Y=89]="Y",Lt[Lt.Z=90]="Z",Lt[Lt.NUM0=48]="NUM0",Lt[Lt.NUM1=49]="NUM1",Lt[Lt.NUM2=50]="NUM2",Lt[Lt.NUM3=51]="NUM3",Lt[Lt.NUM4=52]="NUM4",Lt[Lt.NUM5=53]="NUM5",Lt[Lt.NUM6=54]="NUM6",Lt[Lt.NUM7=55]="NUM7",Lt[Lt.NUM8=56]="NUM8",Lt[Lt.NUM9=57]="NUM9",Lt[Lt.KEY0=96]="KEY0",Lt[Lt.KEY1=97]="KEY1",Lt[Lt.KEY2=98]="KEY2",Lt[Lt.KEY3=99]="KEY3",Lt[Lt.KEY4=100]="KEY4",Lt[Lt.KEY5=101]="KEY5",Lt[Lt.KEY6=102]="KEY6",Lt[Lt.KEY7=103]="KEY7",Lt[Lt.KEY8=104]="KEY8",Lt[Lt.KEY9=105]="KEY9",Lt[Lt.MUL=106]="MUL",Lt[Lt.ADD=107]="ADD",Lt[Lt.Enter=108]="Enter",Lt[Lt.SUB=109]="SUB",Lt[Lt.DOT=110]="DOT",Lt[Lt.DIVISION=111]="DIVISION",Lt[Lt.F1=112]="F1",Lt[Lt.F2=113]="F2",Lt[Lt.F3=114]="F3",Lt[Lt.F4=115]="F4",Lt[Lt.F5=116]="F5",Lt[Lt.F6=117]="F6",Lt[Lt.F7=118]="F7",Lt[Lt.F8=119]="F8",Lt[Lt.F9=120]="F9",Lt[Lt.F10=121]="F10",Lt[Lt.F11=122]="F11",Lt[Lt.F12=123]="F12",Lt[Lt.BackSpace=8]="BackSpace",Lt[Lt.Esc=27]="Esc",Lt[Lt.RightArrow=39]="RightArrow",Lt[Lt.LeftArrow=37]="LeftArrow",Lt[Lt.DownArrow=40]="DownArrow",Lt[Lt.UpArrow=38]="UpArrow",Lt[Lt.sub=SR?173:189]="sub",Lt[Lt.dot=190]="dot",Lt[Lt.Spacebar=32]="Spacebar",Lt[Lt.Tab=9]="Tab",Lt[Lt.PageUp=33]="PageUp",Lt[Lt.PageDown=34]="PageDown",Lt[Lt.KeyEnter=13]="KeyEnter",Lt[Lt.Insert=45]="Insert",Lt[Lt.SEMICOLON=SR?59:186]="SEMICOLON",Lt[Lt.Delete=46]="Delete",Lt[Lt.BackQuote=192]="BackQuote",Lt[Lt.SLASH=191]="SLASH",Lt[Lt.NumLock=144]="NumLock",Lt[Lt.Control=17]="Control",Lt[Lt.Home=36]="Home",Lt[Lt.End=35]="End",Lt[Lt.Shift=16]="Shift",Lt[Lt.LBRACKET=219]="LBRACKET",Lt[Lt.RBRACKET=221]="RBRACKET",Lt[Lt.VECLINE=220]="VECLINE",Lt[Lt.EQUAL=SR?61:187]="EQUAL",Lt[Lt.LESS=188]="LESS",Lt[Lt.QUOTE=222]="QUOTE",Lt[Lt.CapeLock=20]="CapeLock",Lt[Lt.Alt=18]="Alt",Lt[Lt.Meta=91]="Meta",Lt))(Vy||{});var Sg=class o{static set(t){t||(t={ctrlKey:!1,altKey:!1,shiftKey:!1});let e=o.getMouseKeyStatus(t);o.status=e}static getMouseKeyStatus(t){let{ctrlKey:e,altKey:r,shiftKey:i}=t;if([17,16,18].includes(t.keyCode)){if(!e&&!i&&!r)return 0;if(e&&!i&&!r)return 1;if(!e&&i&&!r)return 2;if(!e&&!i&&r)return 3;if(e&&i&&!r)return 4;if(e&&!i&&r)return 5;if(!e&&i&&r)return 6;if(e&&i&&r)return 7}else return 0}static getTrackFollowComponentStatus(){let t=le.pcbConfig.trackFollow==="moveKeep";return o.status===5?!t:t}static getTrackFollowViaStatus(){let t=le.pcbConfig.trackFollowVia==="moveKeep";return o.status===5?!t:t}};var Bj=class{constructor(t,e=!0){this.item=t,this.isStart=e,t instanceof Ge?this.point=e?t.start:t.end:this.point=t.center,this.box=this.point.bbox().extendOfSize(.02)}bbox(){return this.box}},Fj=class{constructor(t){this.items=new Set;this.all=new Set;this.tracks=new Map;this._ready=!1;this.items=new Set(t)}get ready(){return this._ready}set ready(t){this._ready=t}modifyTrackPosition(t){let e=Sg.getTrackFollowComponentStatus(),r=Sg.getTrackFollowViaStatus(),i=[],n=new Set;for(let c of this.items)if(c instanceof ke){let h=c.getPads(),u=c.getVias();h.forEach(d=>{e&&i.push(d),n.add(d)}),u.forEach(d=>{r&&i.push(d),n.add(d)})}else c instanceof Le?(e&&i.push(c),n.add(c)):(c instanceof Ue&&r&&i.push(c),n.add(c));let s=new gd,a=[];i.forEach(c=>{if(!c.isEmpty&&(c instanceof Le||c instanceof Ue)){let h=[],u=[],d=this.searchConnectTrack(c);for(let y of d)y instanceof Ge&&y.getParent()==null&&s.needCheckIntersection(y.model,c.model)&&(c.isSelect(y.start.x,y.start.y)||c.isSelect(y.end.x,y.end.y))&&(y.start.distance2(c.center)<1e-4||y.end.distance2(c.center)<1e-4?h.push(y):n.has(y)||u.push(y));let p=new Set(h);h.forEach(y=>{this.excludeTracks(y,p,u)}),n.forEach(y=>(y instanceof Ge&&p.add(y),!0));let m=c.center;u.sort((y,b)=>{let P=Math.min(m.distance2(y.start),m.distance2(y.end)),T=Math.min(m.distance2(b.start),m.distance2(b.end));return P-T}).forEach(y=>{if(p.has(y)||y.locked)return;let b=new au(y,!0);this.handleFindTrack(b,y,u,c,p).forEach(T=>{a.push(...zVe(T.tracks,c.center,T.pts,T.sameOri,t))})})}}),a.filter(c=>{var h,u,d,p;if(c.length==0){let m=At.getInstance().getNode(c.model);if(m){let g=m.parent;m.parent.getAllItems().forEach(y=>{At.getInstance().delete(y)}),(u=(h=g.viaNode)==null?void 0:h.prev)==null||u.deleteConnectTrack(g),(p=(d=g.viaNode)==null?void 0:d.next)==null||p.deleteConnectTrack(g)}return t.addCommand(Ce.dispatch(c,"delete")),c.remove(),A.publish("delete",c),!1}return!0}).forEach(c=>{let h=At.getInstance().getListNode(c.model);Mr.getInstance().addInputStatus(h)})}searchConnectTrack(t){return kt.search4Types(t.buildBBox(),["Track","ArcTrack"],(e,r)=>r=="Track"||"ArcTrack"?t instanceof Ue?t.isContains(e):t.layerId==12?!0:t.layerId==e:!1).getTracks()}handleFindTrack(t,e,r,i,n){let s=t.tracks,a=t.pts,l=s[0],c=s.length-1,h=s[c];if(r.includes(l)){let p=a[0].start();if(i.isSelect(p.x,p.y)){let m=u(l,a[0],s[1],a[1]);return this.excludeTracks(l,n,r,p),s.forEach(g=>{n.add(g)}),m}}if(r.includes(h)){let p=a[c].end();if(i.isSelect(p.x,p.y)){let m=d(h,a[c],s[c-1],a[c-1]);return this.excludeTracks(h,n,r,p),s.forEach(g=>{n.add(g)}),m}}for(let p=0;p<s.length;p++){let m=s[p],g=a[p];if(e.globalIndex==m.globalIndex){let y=[],b=g.start(),P=g.end(),T,I,C;if(b.distance2(i.center)<P.distance2(i.center)?(C=b,I=p,r.includes(s[p-1])&&!n.has(s[p-1])&&(T=p-1)):(C=P,T=p,r.includes(s[p+1])&&!n.has(s[p+1])&&(I=p+1)),I!=null){let E=s[I],O=a[I];u(E,O,s[I+1],a[I+1]).forEach(_=>{y.push(_)}),this.excludeTracks(E,n,r,C)}if(T!=null){let E=s[T],O=a[T];d(E,O,s[T-1],a[T-1]).forEach(_=>{y.push(_)}),this.excludeTracks(E,n,r,C)}return s.forEach(E=>{n.add(E)}),y}}function u(p,m,g,y){let b=m.start(),P=m.end(),T=p.start.equals1(b);return g&&n.has(g)&&(g=null),g?[{tracks:[p,g],pts:[b,P,y.end()],sameOri:T}]:[{tracks:[p],pts:[b,P],sameOri:T}]}function d(p,m,g,y){let b=m.start(),P=m.end();g&&n.has(g)&&(g=null);let T=p.start.equals1(P);return g?[{tracks:[p,g],pts:[P,b,y.start()],sameOri:T}]:[{tracks:[p],pts:[P,b],sameOri:T}]}return[]}excludeTracks(t,e,r,i){let n=[t];for(;n.length>0;){let s=[];n.forEach(a=>{let l=a.searchCycleNode().filter(c=>{if(c instanceof Ge&&!e.has(c)&&r.includes(c)){let h=!1;if(i&&(h=c.start.distance2(i)<1e-4||c.end.distance2(i)<1e-4),!h)return e.add(c),!0}return!1});s.push(...l)}),i&&(i=null),n=s}}setUpConnectTrack(){if(this._ready)return;let t=Sg.getTrackFollowComponentStatus(),e=Sg.getTrackFollowViaStatus();this._ready=!0;let r=[],i=new Set;for(let n of this.items)if(n instanceof ke){let s=n.getPads(),a=n.getVias();s.forEach(l=>{l.isEmpty||(t&&r.push(l),i.add(l))}),a.forEach(l=>{l.isEmpty||(e&&r.push(l),i.add(l))})}else n instanceof Le?n.isEmpty||(t&&r.push(n),i.add(n)):n instanceof Ue?n.isEmpty||(e&&r.push(n),i.add(n)):n.isEmpty||i.add(n);this.items=i,this.bfs1(r,t,e)}bfs1(t,e=!0,r=!0){let i=new Map;for(let s of t)if(s instanceof Le){if(e){let a=i.get(s.net);a==null&&(a=new Array,i.set(s.net,a)),a.push(s)}}else if(r){let a=i.get(s.net);a==null&&(a=new Array,i.set(s.net,a)),a.push(s)}let n=new gd;for(let[s,a]of i){let l=s==""?Ye.getAllNoneNetsItems():Ye.getSameNetItems(s),c=new ji(10);for(let d of l)d instanceof Ge?(c.add(new Bj(d)),c.add(new Bj(d,!1))):(d instanceof Le||d instanceof Ue)&&c.add(new Bj(d));let h=new Set;for(let d of a){let p=c.search(d.buildBBox());for(let m of p){let g=m.item;g instanceof Ge&&g.getParent()==null&&n.needCheckIntersection(d.model,g.model)&&(m.point.distance2(d.center)<1e-4||this.items.has(g)&&d.isSelect(m.point.x,m.point.y))&&h.add(m)}}let u=new Set;for(xe.addAllSet(u,h);h.size>0;){let d=new Set;for(let p of h){let m=p.item;if(!this.items.has(p.item))this.tracks.set(m.globalIndex,{track:m,moveStart:p.isStart,movePoint:p.isStart?m.start:m.end});else{let g=p.isStart?m.end.bbox():m.start.bbox(),y=p.isStart?m.end:m.start,b=c.search(g),P=!1,T=new Set;for(let I of b){if(u.has(I))continue;let C=I.item;if(n.needCheckIntersection(m.model,C.model)&&I.point.distance2(y)<1e-4)if(C instanceof Ge)this.items.has(C)?T.add(I):this.tracks.set(m.globalIndex,{track:m,moveStart:p.isStart,movePoint:p.isStart?m.start:m.end});else{this.items.has(C)||this.tracks.set(m.globalIndex,{track:m,moveStart:p.isStart,movePoint:p.isStart?m.start:m.end}),P=!0;break}}P||xe.addAllSet(d,T)}}h=d,xe.addAllSet(u,h)}}}};var nSe=class{constructor(t){this.item=t}bbox(){return this.item.buildBBox()}},Ya=class{constructor(t,e,r=!1){this.items=new Set;this.tracks=new Set;this.moveTools={};this.status={};this.events=new Set;this.moveWholeTracks=new Set;this.groupSet=new Set;this.command=new De("connect wire");this.preprocessing=!1;this.addHistory=!0;this.needUndoCommand=!0;this.needFollow=!0;this.maxItemNum=400;this.ratlines=null;let i=[];for(let n of t)if(Mt.checkIsCanEditByItem(n)&&(i.push(n),n instanceof Le||n instanceof Ue)){let s=n.getParent();s!=null&&this.items.add(s)}for(let n of i)this.addItem(this.items,n);this.items.size>this.maxItemNum&&(this.needFollow=!1),!r&&Sg.getTrackFollowComponentStatus()&&this.needFollow&&this.filterConnectTracks(),this.itemConnectTrack=new Fj(this.items),this.needFollow?(this.itemConnectTrack.setUpConnectTrack(),this.addTearDrop(this.itemConnectTrack)):this.teardropFollowItems(),e&&(this.needUndoCommand=!1,this.command=e)}addTearDrop(t){let e=new Set,r=new Set;for(let i of this.items)if(i instanceof ke){let n=i.getPads(),s=i.getVias();for(let a of n)r.add(a.globalIndex);for(let a of s)r.add(a.globalIndex)}else r.add(i.globalIndex);for(let[i,n]of t.tracks)r.delete(n.track.globalIndex);for(let i of this.items){let n=pt.getTears(i.globalIndex);if(n!=null){for(let s of n)if(!e.has(s)){let a=s.getComponent().connects,l=!0;for(let c of a)if(!r.has(c)){l=!1;break}l&&e.add(s)}}}xe.addAllSet(this.items,e)}teardropFollowItems(){let t=new Set,e=new Set;for(let r of this.items)if(r instanceof ke){let i=r.getPads(),n=r.getVias();for(let s of i)e.add(s.globalIndex);for(let s of n)e.add(s.globalIndex)}else e.add(r.globalIndex);for(let r of e){let i=pt.getTears(r);if(i!=null){for(let n of i)if(!t.has(n)){let s=n.getComponent().connects,a=!0;for(let l of s)if(!e.has(l)){a=!1;break}a&&t.add(n)}}}xe.addAllSet(this.items,t)}addItem(t,e){if(e instanceof Qp)return;let r=e.getGroupID();if(r==null){if(e instanceof lr&&e.key!=""){if(!e.isEmpty){let s=e.getParent();s!=null&&t.has(s)||t.add(e)}return}let i=e;if(e instanceof mt||e instanceof _t){let s=e.getParent();s!=null&&(i=s)}let n=i.getParent();n!=null?this.add(n,t):this.add(i,t)}else this.addItemForCombination(r,t)}addItemForCombination(t,e){t!=null&&!this.groupSet.has(t)&&(this.groupSet.add(t),Ht.getItem(t).getItems().forEach(i=>{Mt.checkIsCanEditByItem(i)&&e.add(i)}))}add(t,e){if(!t.isEmpty){let r=t.getGroupID();this.addItemForCombination(r,e),e.add(t)}}addMap(t,e){let r=e.get(t.net);r==null&&(r=new Set,e.set(t.net,r)),r.add(t)}filterConnectTracks(){let t=new Set,e=new Map;this.items.forEach(n=>{n instanceof Le?this.addMap(n,e):n instanceof Ue?this.addMap(n,e):n instanceof Ge?this.addMap(n,e):n instanceof ke&&n.getPads().forEach(a=>{this.addMap(a,e)})});let r=new gd,i=new TS(!0);for(let[n,s]of e){let a=Ye.getSameNetItems(n).filter(h=>h instanceof Ge&&!this.items.has(h)),l=new ji(10);for(let h of a)l.add(new nSe(h));let c=new Map;for(let h of s){let u=l.search(h.buildBBox());for(let d of u){let p=d.item;if(r.needCheckIntersection(h.model,p.model)&&i.isConnect(h.model,p.model)){let m=c.get(p);m==null&&(m=[new Set,new Set],c.set(p,m));let[g,y]=m;if(h instanceof Ge){let b=p.start.distance2(h.start),P=p.start.distance2(h.end),T=p.end.distance2(h.start),I=p.end.distance2(h.end),C=Math.min(b,P),E=Math.min(T,I);C<E?g.add(h):y.add(h)}else{let b=p.start.distance2(h.center),P=p.end.distance2(h.center);b<P?g.add(h):y.add(h)}}}}e:for(let[h,u]of c){let[d,p]=u;if(d.size>0&&p.size>0){let m=l.search(h.buildBBox());for(let g of m){let y=g.item;if(y!=h&&r.needCheckIntersection(y.model,h.model)&&i.isConnect(y.model,h.model))continue e}this.items.add(h)}}}}getAllItem(){let t=new Set;this.items.forEach(e=>{e.isEmpty||t.add(e)});for(let e of this.getAllRepairTracks())t.add(e);return t}hasConnectTrack(){return this.moveInit(),this.itemConnectTrack.tracks.size>0}getAllRepairTracks(){let t=new Set;for(let[e,r]of this.itemConnectTrack.tracks)!r.track.isEmpty&&!$l.getInstance().has(r.track.globalIndex)&&t.add(r.track);for(let e of Object.keys(this.moveTools)){let r=this.moveTools[e],i=r==null?void 0:r.getAssociationTrack();i&&t.add(i)}return t}setUpConnectTrack(){if(!this.itemConnectTrack.ready&&this.needFollow)if(le.changeRepairLineTool)this.itemConnectTrack.setUpConnectTrack();else{this.itemConnectTrack.setUpConnectTrack();for(let[t,{track:e,moveStart:r}]of this.itemConnectTrack.tracks)if(e instanceof Ir){let i=new CR(e),n="repair line - pad/via connect Track";this.moveTools[t]=new ooe(i,r,n),this.tracks.add(t),this.events.add(i)}}}moveInit(){if(this.preprocessing||!this.needFollow)return;this.preprocessing=!0,this.itemConnectTrack=new Fj(this.items),this.itemConnectTrack.modifyTrackPosition(this.command),he.publish("updateRtree",""),this.itemConnectTrack.setUpConnectTrack();let t=new Set,e=new Map;for(let[r,{track:i,movePoint:n}]of this.itemConnectTrack.tracks)if(le.changeRepairLineTool){if(i.locked)continue;if(t.has(r)){e.forEach((c,h)=>{c.has(r)&&(this.moveTools[h]=void 0,this.tracks.delete(h),this.moveWholeTracks.add(h),this.moveWholeTracks.add(r))});continue}let s=new kh(i),a=new Set,l=s.getRepairConnectLineTool(n,t,a);e.set(r,a),l&&(this.moveTools[r]=l,this.tracks.add(r),this.events.add(s));continue}}getRepairToolCommand(){let t;for(let[e,{track:r,moveStart:i}]of this.itemConnectTrack.tracks)if(r instanceof Ir){let n=this.moveTools[e];n&&(t?t.addCommand(n==null?void 0:n.command):t=n==null?void 0:n.command)}return t}setRepairToolCommand(t){for(let[e,{track:r,moveStart:i}]of this.itemConnectTrack.tracks)if(r instanceof Ir){let n=this.moveTools[e];n&&(n.command=t)}}moveConnectTrack(t){this.moveInit();for(let[e,{track:r,moveStart:i}]of this.itemConnectTrack.tracks)if(r instanceof Ir){let n=this.moveTools[e];n==null||n.repairTrack(t),this.moveWholeTracks.has(e)&&r.transform(t)}else{this.addHistory&&this.command.addCommand(Ce.dispatch(r,"modify"));let n=i?r.start.multiply4(t):r.end.multiply4(t);i?r.start=n:r.end=n}this.addHistory&&(this.addHistory=!1)}complete(t){Object.values({...this.moveTools}).forEach(e=>{e!=null&&e.complete()}),this.needUndoCommand&&this.command.commands.forEach(e=>{t.addCommand(e)}),le.changeRepairLineTool?(this.events.forEach(e=>{e.complete(t)}),kh.complete2(t),kh.clear()):this.events.forEach(e=>{e.commands.commands.forEach(r=>{t.addCommand(r)})}),this.command=new De("connect wire"),this.needUndoCommand=!0,this.events.clear(),this.moveWholeTracks.clear(),this.moveTools={},this.status={}}interrupt(){Object.values({...this.moveTools}).forEach(t=>{t!=null&&t.interrupt()}),le.changeRepairLineTool?(this.events.forEach(t=>{t.interrupt()}),kh.clear()):this.events.forEach(t=>{t.commands.undo()}),this.needUndoCommand&&this.command.undo(),this.command=new De("connect wire"),this.needUndoCommand=!0,this.events.clear(),this.moveWholeTracks.clear(),this.moveTools={},this.status={}}findAllAssociationRatlines(){if(this.items==null||this.items.size==0)return[];let t=this.items,e=Array.from(t).filter(n=>n instanceof ke),r=[];e.forEach(n=>{r=[].concat(r,n.getPads())});let i=[];return r.forEach(n=>{n.iteratorRatlines(s=>{i.push(s)})}),i}setAllAssociationRatlinesVisible(){var e;this.ratlines==null&&(this.ratlines=this.findAllAssociationRatlines()),(e=Pe.getLayer(57))!=null&&e.visible&&this.ratlines.forEach(r=>{r.click()})}getMoveTools(){return this.moveTools}};var u6=class u6{constructor(){this.deleteNoticeSelected=!1}static getInstance(){return u6.instance==null&&(u6.instance=new u6),u6.instance}init(t,e,r){this.items=t||[],this.action=r,this.commandFactory=e;let i=!1;this.notComponentItem=this.items.filter(n=>n instanceof ke?(i=!0,!1):!0),i?this.deleteNoticeSelected?this.execute(this.defAction):A.publish("openMainDialog",{cmd:42,data:{}}):this.action(this.items,this.commandFactory)}execute(t){switch(t){case"deleteAll":this.action(this.items,this.commandFactory);break;case"remainComponent":A.publish("onlySelect",this.notComponentItem),this.notComponentItem.length>0?this.action(this.notComponentItem,this.commandFactory):A.publish("tool","dropdrag");break}this.interrupt()}changeDefSelect(t,e){this.deleteNoticeSelected=t,this.defAction=e}interrupt(){this.action=null,this.items=[],this.notComponentItem=[],this.commandFactory=new hi().createGroup("check delete")}};u6.instance=null;var fF=u6;var d6=class d6{constructor(){this.lockedItems=new Set;this.freeItems=new Set;this.defaultOptions={isDelete:!1,moveWholeComponent:!0};this.options={};this.actionType="skipLocked"}static getInstance(){return d6.instance==null&&(d6.instance=new d6),d6.instance}init(t,e="check locked",r,i){if(R.getInstance().isReadOnlyMode){he.publish("onlySelect",t);return}this.options={...this.defaultOptions,...i},this.items=Array.from(t).filter(n=>n&&!n.isEmpty&&!(n instanceof mn)),Mt.isChildPcb()&&e=="delete select item"&&(this.items=this.items.filter(n=>!(n instanceof ke)),he.publish("onlySelect",this.items)),this.action=r,this.commandFactory=typeof e=="string"?new hi().createGroup(e):e,this.checkLocked(this.items)?he.publish("openMainDialog",{cmd:38,data:{option:{status:this.actionType}}}):this.deleteDialog(this.items,this.commandFactory,[])}deleteDialog(t,e,r){this.options.isDelete?fF.getInstance().init(t,e,this.action):this.action(t,e,r)}checkLocked(t=this.items){this.lockedItems.clear(),this.freeItems.clear();let e=new Array;for(let i of t)this.options.isDelete&&i instanceof Le?i.locked?this.lockedItems.add(i):this.freeItems.add(i):e.push(i);let r=new Ya(e,null,!0);for(let i of r.items)i.locked?this.lockedItems.add(i):this.freeItems.add(i);return this.lockedItems.size>0}execute(t){if(this.actionType=t,!!this.action){switch(this.actionType){case"skipLocked":{he.publish("onlySelect",this.freeItems),this.freeItems.size>0?this.deleteDialog(Array.from(this.freeItems),this.commandFactory,Array.from(this.lockedItems)):he.publish("tool","dropdrag");break}case"remainLocked":{this.deleteDialog(this.items,this.commandFactory,[]);break}case"unLockLocked":{this.lockedItems.forEach(e=>{this.commandFactory.addCommand4Item(e,"modify"),e.locked=!1}),this.deleteDialog(this.items,this.commandFactory,[]);break}}this.interrupt()}}interrupt(){this.action=null,this.items=[],this.lockedItems.clear(),this.freeItems.clear(),this.commandFactory=new hi().createGroup("check locked")}};d6.instance=null;var Is=d6;var aoe=new Rl;[nie.instance(),oie.instance(),sie.instance(),aie.instance(),lie.instance(),cie.instance(),hie.instance(),uie.instance(),die.instance(),pie.instance(),fie.instance(),mie.instance(),gie.instance(),yie.instance(),Pie.instance(),bie.instance(),Tie.instance()].forEach(o=>{aoe.put(o.modelName,o)});function qVe(o){let t=o.packageName,e=aoe.get(t);if(!e){console.warn(`\u6682\u672A\u652F\u6301 ${t} \u7684\u5C01\u88C5\u751F\u6210\u5668`);return}try{let r=Kc();Is.getInstance().init(r,"delete select item",(i,n)=>{var c;A.messageBus.publish("refreshDrawStatus",""),e.resetShape(),loe.clearAll((c=e.historyGroup)==null?void 0:c.getCommand(),h=>h instanceof lr&&!!h.key||i.indexOf(h)<0,!1,!1),e.generate(o);let a=!R.getInstance().origin.equals(e._origin)?R.getInstance().origin.sub(e._origin):null,l=a?Ae.translate(a.x,a.y,0):null;e.shapes.forEach(h=>{l&&(h instanceof He?(h.transform(l),h.fill()):h.transform(l)),e.historyGroup.addCommand4Item(h,"add")}),oa&&A.publish("checkDimension",{on:!0}),A.publish("updateFrame",""),A.publish("adaptAll",""),e.historyGroup.execute(),e.historyGroup=null},{isDelete:!0})}catch(r){let i=r.message||r.toString();A.windowBridge.rpcCall("i18n",[i],Q()).then(n=>{A.windowBridge.publish("ui/toastMsg",{type:"error",msg:{value:"Failure, please check the relevant parameters:{msg}",options:{msg:n.message}},timer:2},Q())})}}function $Ve(o){let t=o.packageName,e=aoe.get(t);if(!e)return console.warn(`\u6682\u672A\u652F\u6301 ${t} \u7684\u5C01\u88C5\u751F\u6210\u5668`),null;e.resetShape(),e.generate(o);let r=e._origin;return e.shapes.forEach(i=>{e.historyGroup.addCommand4Item(i,"add")}),e.historyGroup.undo(),e.historyGroup=null,r.mul(-1)}function KVe(o){let t=o.packageName,e=aoe.get(t);e.refixOptions(o,!1),e.currentOptions.Type=o.packageName,o.packageName==="Cylindrical"?e.currentOptions.Type="Radial":o.packageName==="DFN_4"?e.currentOptions.Type="DFN-4":o.packageName==="HEADER_H"?e.currentOptions.Type="Header-H":o.packageName==="HEADER_V"?e.currentOptions.Type="Header-V":o.packageName==="E_Cap"?e.currentOptions.Type="E-Cap":o.packageName==="TO_DPAK"&&(e.currentOptions.Type="TO-DPAK");let r=["footprintOrigin","firstPinAt","pins","rowsPins","columnsPins"];for(let i in e.currentOptions){let n=e.currentOptions[i];e.currentOptions[i]instanceof ho?e.currentOptions[i]=na(e.currentOptions[i].average*10,"mil","mm"):typeof n=="number"&&r.indexOf(i)<0&&(e.currentOptions[i]=na(n*10,"mil","mm"))}return e.currentOptions}var mF=class extends S0{getData(t,e){switch(t){case"path":return this.getShapeInfo(e)}}};var Qd=class extends $x{constructor(){super(...arguments);this.silkOpts=new qB;this.preference=new gF;this.board=new mF}getEncode(e){switch(e){case"CANVAS":return this.canvas;case"LAYER":return this.layer;case"LAYER_PHYS":return this.layerPhys;case"ACTIVE_LAYER":return this.activeLayer;case"NET":return this.net;case"PRIMITIVE":return this.primitive;case"GROUP":return this.group;case"VIA":return this.via;case"PAD":return this.pad;case"LINE":return this.line;case"ARC":return this.arc;case"POLY":return this.poly;case"FILL":return this.fill;case"FPC_FILL":return this.fpcFill;case"REGION":return this.region;case"PARTITION":return this.partition;case"POUR":return this.pour;case"POURED":return this.copper;case"IMAGE":return this.image;case"OBJ":return this.obj;case"TEARDROP":return this.tear;case"FONT":return this.font;case"STRING":return this.str;case"ATTR":return this.attr;case"DIMENSION":return this.dimension;case"COMPONENT":return this.component;case"PAD_NET":return this.padNet;case"RULE_TEMPLATE":return this.ruleTemplateName;case"RULE":return this.rule;case"RULE_SELECTOR":return this.ruleSelect;case"EQLEN_GRP":return this.padsPairGroup;case"EQLEN":return this.padsPairGroupDetail;case"SHELL_ENTITY":return this.shellEntity;case"SHELL":return this.shell;case"CREASE":return this.crease;case"BOSS":return this.boss;case"PANELIZE":return this.panelize;case"SILK_OPTS":return this.silkOpts;case"PREFERENCE":return this.preference;case"INNER":return this.inner;case"BOARD":return this.board}}get ignorePartitionId(){return this.doctype!=3}saveCommonData(){this.feed("CANVAS"),Ze.getInstance().getAllItem().forEach(w=>{w.type=="CUSTOM"?w.config&&this.feed("LAYER",w):this.feed("LAYER",w)}),Ze.getInstance().getLayerPhys().forEach(w=>{this.feed("LAYER_PHYS",w)}),this.feed("ACTIVE_LAYER");let i=re.getInstance(),n=i.getAllSafeSpacing(),s=i.getAllOtherSpacing(),a=i.getAllCreepageSpacing(),l=i.getAllTrackPhysics(),c=i.getAllNetLengthPhysics(),h=i.getAllNetLengthTolerancePhysics(),u=i.getAllDifferentialPhysics(),d=i.getAllBlindPhysics(),p=i.getAllRadiusPhysics(),m=i.getAllInnerPlane(),g=i.getAllCopperPlane(),y=i.getAllPasteExpansion(),b=i.getAllSolderExpansion(),P=i.getAllAutoRouterRules(),T=i.getAllNetClass(),I=i.getAllNets(),C=i.getAllNetDifferentials(),E=i.getAllEqualLengthGroups(),O=i.getAllPadsPairGroups(),_=i.getAllRegions();I.forEach(w=>{this.feed("NET",w)}),this.feed("RULE_TEMPLATE"),n.forEach(w=>{this.feed("RULE",w)}),s.forEach(w=>{this.feed("RULE",w)}),a.forEach(w=>{this.feed("RULE",w)}),l.forEach(w=>{this.feed("RULE",w)}),c.forEach(w=>{this.feed("RULE",w)}),h.forEach(w=>{this.feed("RULE",w)}),u.forEach(w=>{this.feed("RULE",w)}),d.forEach(w=>{this.feed("RULE",w)}),p.forEach(w=>{this.feed("RULE",w)}),m.forEach(w=>{this.feed("RULE",w)}),g.forEach(w=>{this.feed("RULE",w)}),y.forEach(w=>{this.feed("RULE",w)}),b.forEach(w=>{this.feed("RULE",w)}),P.forEach(w=>{this.feed("RULE",w)}),O.forEach(w=>{this.feed("EQLEN_GRP",w)});let x=[];O.forEach(w=>{w.details.forEach(F=>{x.push(F)})}),x.forEach(w=>{this.feed("EQLEN",w)}),T.forEach(w=>{this.feed("RULE_SELECTOR",w)}),I.forEach(w=>{this.feed("RULE_SELECTOR",w)}),C.forEach(w=>{this.feed("RULE_SELECTOR",w)}),E.forEach(w=>{this.feed("RULE_SELECTOR",w)}),i.betweenNetRule.rule.forEach(w=>{this.feed("RULE_SELECTOR",w)}),_.forEach(w=>{this.feed("RULE_SELECTOR",w)}),this.getPrimitives().forEach(w=>{this.feed("PRIMITIVE",w)}),this.feed("SILK_OPTS",Ze.getInstance().getLayer(3)),this.feed("SILK_OPTS",Ze.getInstance().getLayer(4))}saveSelected(e){let{pcbName:r,ownerInfo:i}=e,n=ze.getSelects(),s=new Array,a=new Array,l=new Array,c=new Array,h=new Array,u=new Set,d=new Set;for(let T of n)T instanceof ke?(s.push(T.model),d.add(T.deviceUUID),u.add(T.footprintUUID),l.push(...T.getTexts())):T instanceof ua?a.push(T.model):T instanceof mn||(h.push(T.model),T instanceof lr?l.push(T):T instanceof lt&&T.type=="TearDrop"&&c.push(T.model));this.saveCommonData();let p=Xd.getInstance().getAllItem().filter(T=>T.getItems().every(I=>ze.getSelectsById(I.globalIndex)));this.feedItems(p),this.feedItems(h),this.feedItems(Ma.getInstance().getAllItem()),this.feedItems(sl.getInstance().getAllItem()),this.feedItems(Na.getInstance().getAllItem()),this.feedComponent2(s);let m=R.getInstance().compiler.consistencyManager.getMaxTicket(),g=Ss(R.getInstance().compiler.getDocDetail());g.board=Tm(),g.title=r,g.creator=i,g.modifier=i;let y=new $4e().meta(m,g),b=new z4e,P=[];return P.push(b.head({doc:g.board,client:"",updateTime:new Date().getTime()})),P.push(b.meta(1,{title:"Board1",zIndex:1})),P.push(this.getFile(!0)),P.push(y),{dataStr:P.join(s4e),footprints:Array.from(u),devices:Array.from(d)}}save(e){let r="pcbDataStrEncode-time";Cn(r),e=e||{},this.saveCommonData(),this.feed("PREFERENCE",X4()),R.getInstance().doctype!=4&&(this.feedPanelize(),this.feedItems(Xd.getInstance().getAllItem())),py.getInstance().getAllItem().forEach(s=>{this.feed("FONT",s)}),this.feedItems(bn.getInstance().getAllItem()),this.feedItems(jn.getInstance().getAllItem()),this.feedItems(Sn.getInstance().getAllItem()),this.feedItems(Fi.getInstance().getAllItem().filter(s=>s.type!=="Partition")),this.feedItems(Qi.getInstance().getAllItem().filter(s=>s.type!=="Annotation"&&s.type!=="Partition")),this.feedItems(vi.getInstance().getAllItem().filter(s=>s.type!=="Partition")),this.feedInner(Xo.getInstance().getAllItem()),this.feedItems(Hs.getInstance().getAllItem()),this.feedItems(_p.getInstance().getAllItem()),this.feedItems(io.getInstance().getAllItem()),this.feedItems(Ma.getInstance().getAllItem()),this.feedItems(sl.getInstance().getAllItem()),this.feedItems(Na.getInstance().getAllItem());let n=Ms.getInstance().getAllItem();return this.feedComponent2(n),this.feedCopper(qo.getInstance().getAllItem()),us.getInstance().board&&this.feed("BOARD",us.getInstance().board.model),Xi(r),this.getFile()}uploadInitData(){this.saveCommonData(),this.feed("PREFERENCE",X4()),this.feedPanelize()}getFile(e){return this.encoder.getDataStr(e)}onlyOutline(){return this.feed("CANVAS"),Ze.getInstance().getAllItem().forEach(i=>{this.feed("LAYER",i)}),Ze.getInstance().getLayerPhys().forEach(i=>{this.feed("LAYER_PHYS",i)}),this.feed("ACTIVE_LAYER"),[Au(),yF()].forEach(i=>{i.forEach(n=>{let s=this.getFileType(n);this.feed(s,n)})}),this.feedPanelize(),this.getFile()}getItems(e){return this.feedItems(e),this.getFile()}feed(e,r){let i=this.getItemFormat(e),n=this.getEncode(e),s={};for(let a of i)this.ignorePartitionId&&a=="partitionId"||(s[a]=this.getData(a,n,r));return this.upload2Compiler(e,s,r),this.uploadSource(e,s,r),s}feedFromGerber(e,r){let i=this.getItemFormat(e),n=this.getEncode(e),s={};for(let a of i)this.ignorePartitionId&&a=="partitionId"||(s[a]=this.getData(a,n,r));this.uploadSource(e,s,r)}feedItem(e){let r=this.getFileType(e);this.feed(r,e)}feedComponent2(e){for(let r of e){this.feed("COMPONENT",r);let i=r.attributes,n=!0;for(let l of i)l.key=="Device"&&(n=!1),$d(l,r)&&this.feed("ATTR",l);if(n)throw new Error("The device is missing device attributes, saving will lead to data loss, please contact the official customer service in time!");r.getPads().forEach(l=>{this.feed("PAD_NET",l)}),r.getItems().filter(l=>l instanceof Ct).forEach(l=>{this.feed("PAD_NET",l)})}}feed4Type(e){switch(e){case"CANVAS":return this.feed(e);case"ACTIVE_LAYER":return this.feed(e);default:break}}feedItems(e){e.forEach(r=>{if(r instanceof Ls&&(r=r.model),r.getParent()==null){let i=this.getFileType(r);this.feed(i,r)}})}};var coe=class extends ro{constructor(t,e){super(),this.data=t.toJSON(),this.source=e=="delete"?ZVe(t):null,this.action=e}rebuild(){throw new Error("PanelizeComponent can only be modified!")}remove(){throw new Error("PanelizeComponent cannot be deleted!!")}getItem(){return"ignore"}modify(){let t=Pi.toJSON();new L0().applyPanelize(this.data),si.getInstance().setDefaultPanelize(this.data),this.data=t,this.updateData()}upload(t=!1){if(!this.isDelete(t)){if(this.updateData(),this.source!=null){let{panelizeData:r,panelizeHStampData:i,panelizeVStampData:n,panelizeHSideData:s,panelizeVSideData:a}=this.source;R.getInstance().compiler.uploadPanelize(r)}}this.source=null}updateData(){this.source==null&&Pi!=null&&(this.source=ZVe(Pi))}};function ZVe(o){if(!o)return;let t=JSON.parse(JSON.stringify(o));return{panelizeData:Sr.getInstance().encode("PANELIZE",t)}}var bF=class extends ro{constructor(){super(),this.origin=R.getInstance().origin,this.action="modify"}getItem(){return"ignore"}rebuild(){let t=R.getInstance().origin;R.getInstance().origin=this.origin,this.origin=t}remove(){let t=R.getInstance().origin;R.getInstance().origin=this.origin,this.origin=t}modify(){let t=R.getInstance().origin;R.getInstance().origin=this.origin,this.origin=t,this.updateData()}upload(t=!1){if(!this.isDelete(t)){if(this.source==null&&this.updateData(),this.source!=null){let r=R.getInstance().compiler;r.setTicket(),r.uploadCanvas(this.source)}}this.source=null}updateData(){this.source==null&&(this.source=Sr.getInstance().encode("CANVAS"))}};var hoe=class{};var oSe=class extends hoe{constructor(){super(...arguments);this.lines=new Array}displayPolylines(e,r){this.clear();for(let i of e)this.displayPolyline(i,r)}displayPolyline(e,r){r=r||1002;let i=Bb(e.primitives,r);xe.addAll(this.lines,i)}clear(){for(let e of this.lines)e.remove();this.lines.length=0}},JVe=new oSe;var uoe=class{constructor(){this.viewGroupId="";this.model=si.getInstance()}get globalIndex(){return""}get items(){return this.model.items}get outlines(){return this.model.outlines}get marks(){return this.model.marks}getType(){return 28}getSourceData(){let t=this.getViewState(),e=new Array,r=new Array,i=new Array,n=new Array,s=new Array,a=new Array;return[].concat(this.model.items,this.model.outlines).forEach(c=>{c instanceof hs?e.push(c):c instanceof Va?r.push(c):c instanceof yo?c.layerId==11?i.push(c):n.push(c):c instanceof et?s.push(c):c instanceof Li&&a.push(c)}),{state:t,lines:e,arcs:r,pads:s,circles:i,holes:n,texts:a}}getRenderData(){let t=this.getViewState(),e=new Array,r=new Array,i=new Array,n=new Array,s=new Array,a=new Array,l=new Array,c=new Array;return[].concat(this.model.items,this.model.outlines,this.model.slots).forEach(u=>{u instanceof hs?e.push(u):u instanceof Va?r.push(u):u instanceof yo?u.layerId==11?i.push(u):n.push(u):u instanceof et?s.push(u):u instanceof Li?a.push(u):u instanceof Za?l.push(u):u instanceof ss&&c.push(u)}),{state:t,lines:e.map(u=>{let{layerId:d,start:p,end:m,width:g}=u;return{layerId:d,start:p,end:m,width:g,state:t}}),arcs:r.map(u=>{let{layerId:d,center:p,radius:m,width:g,startAngle:y,endAngle:b,sweep:P}=u;return{layerId:d,center:p,radius:m,width:g,startAngle:y,endAngle:b,sweep:P}}),pads:s.map(u=>{let{layerId:d,center:p,top:m,bottom:g,topSolderExpansion:y,bottomSolderExpansion:b}=u,P=d==1,T;if(P?T=m:T=g,T==null)throw new Error("Pad data Error!!!");return{layerId:d,center:p,width:T.width,height:T.height,solderExpansion:P?y:b}}),circles:i.map(u=>{let{layerId:d,center:p,strokeWidth:m,radius:g}=u;return{layerId:d,center:p,strokeWidth:m,radius:g}}),holes:n.map(u=>{let{layerId:d,center:p,radius:m}=u;return{layerId:d,center:p,radius:m}}),texts:a.map(u=>{let{layerId:d,width:p,height:m,strokeWidth:g,matrix:y,outline:b}=u;return{layerId:d,width:p,height:m,state:t,strokeWidth:g,matrix:y,path:b}}),rects:l.map(u=>{let{layerId:d,start:p,radius:m,rotation:g,width:y,height:b,strokeWidth:P}=u;return{layerId:d,start:p,radius:m,rotation:g,width:y,height:b,state:t,strokeWidth:P}}),polygons:c.map(u=>{let{layerId:d,strokeWidth:p,outline:m}=u;return{layerId:d,state:t,strokeWidth:p,outline:m}})}}refreshRender(){Mo.attach(this,this.getType())}getViewState(){return"Only Main"}copyOutline(t,e,r,i){return this.model.copyOutline(t,e,r,i)}copySlot(t,e,r,i){return this.model.copySlot(t,e,r,i)}addLine(t,e,r=11,i=!1){return this.model.addLine(t,e,r,i)}addArc(t,e,r,i,n=ae.CCW,s=11){return this.model.addArc(t,e,r,i,n,s)}addMark(t,e,r){return this.model.addMark(t,e,r)}addText(t,e,r,i,n=0){return this.model.addText(t,e,r,i,n)}addHalfArrow(t,e){return this.model.addHalfArrow(t,e)}addVCutLine(t,e,r){return this.model.addVCutLine(t,e,r)}addVCutIndicator(t,e){return this.model.addVCutIndicator(t,e)}addStampHole(t,e){return this.model.addStampHole(t,e)}addStampHoleGroup(t,e){return this.model.addStampHoleGroup(t,e)}addPositionHole(t,e){return this.model.addPositionHole(t,e)}addClosure(t){this.model.closures.push(t)}remove(){this.marks.length=0,this.model.remove(),this.refreshRender()}getBBox(){return this.model.bbox}toJSON(){return JSON.parse(JSON.stringify(this.model.getDefaultPanelize()))}getOthers(){return new Array().concat(this.model.marks,this.model.vCutShapes,this.model.holes)}getProfileGroup(t){return this.model.getProfileGroup(t)}getPadGroup(t){return this.model.getPadGroup(t)}getText(t){return this.model.getText(t)}get bBox(){return this.model.singleBBox}set bBox(t){this.model.singleBBox=t}get outerBBox(){return this.model.outerBBox}set outerBBox(t){this.model.outerBBox=t}get offset(){return this.model.offset}set offset(t){this.model.offset=t}get oldOrigin(){return this.model.oldOrigin}set oldOrigin(t){this.model.oldOrigin=t}get borderClosures(){return this.model.borderClosures}get borderClosures_outerMost(){return this.model.borderClosures_outerMost}set borderClosures_outerMost(t){this.model.borderClosures_outerMost=t}getClosures(){return this.model.getClosures()}toFix(t){return na(t*10,"mil",this.model.outputUnit)}createVCutLineGivenFixedPosition(t,e,r,i){let n=i.minX+(t.borderAtLeftRight?t.borderHeight:0),s=i.maxX-(t.borderAtLeftRight?t.borderHeight:0),a=i.maxY-(t.borderAtTopBottom?t.borderHeight:0),l=i.minY+(t.borderAtTopBottom?t.borderHeight:0),c,h;return r?(c=new S(n,e),h=new S(s,e)):(c=new S(e,a),h=new S(e,l)),[c,h]}getDataForDFM(){let t=this.model.getDefaultPanelize(),e=new Array,r={},i=new S(na(11.02,"mm","mil")/10,na(8.56,"mm","mil")/10),n=t.flipX&&t.column>1?[[0,0],[0,1]]:t.flipY&&t.row>1?[[0,0],[1,0]]:[[0,0]];for(let c of n){let[h,u]=c,d="pcs"+(t.row*h+u+1),p=(t.flipX||t.flipY)&&(t.flipOrigin?1:0)+(t.flipX?u:h)%2==1,m=i;p&&(m=i.rotate(this.bBox.center(),Math.PI));let g={x:gn(m.x+(t.borderAtLeftRight?t.borderHeight+(t.stampColumn?t.columnSpacing:0):0)+this.offset.x*u),y:gn(m.y+(t.borderAtTopBottom?t.borderHeight+(t.stampRow?t.rowSpacing:0):0)+this.offset.y*h)};e.push({key:d,x:g.x,y:g.y,rotate:p?180:0,mirror:!1,repeat_x:Math.ceil(t.column/(t.flipX&&t.column>1?2:1))-(u?t.column%2:0),repeat_y:Math.ceil(t.row/(t.flipY&&t.row>1?2:1))-(h?t.row%2:0),dis_x:this.toFix(this.offset.x*(t.flipX&&t.column>1?2:1)),dis_y:this.toFix(this.offset.y*(t.flipY&&t.row>1?2:1))}),r[d]={outline:{vertexs:this.convertToVertexs(this.model.originOutline,h,u)},holes:[],datum:g,direct_arrow:[],name:d}}let s;if(t.borderAtTopBottom&&t.borderAtLeftRight){let c=PF([...this.borderClosures[0],...this.borderClosures[1]],!0);s={vertexs:[this.convertPrimitivesToVertexs(this.borderClosures_outerMost)],vertexs_holes:[{index:0,vertexs:this.convertPrimitivesToVertexs(c)}]}}else s={vertexs:this.borderClosures.map(c=>this.convertPrimitivesToVertexs(c))};let a=this.model.closures.map(c=>this.convertPrimitivesToVertexs(PF(c,!1)));return{version:"0.1",date:new Date().toISOString().replace("T"," ").replace(/\..*/g,""),unit:this.model.outputUnit,ui_params_sum:t,pcs:r,set:{margins:s,tool_holes:this.model.positionHoles.map(c=>({dia:this.toFix(c.radius*2),x:this.toFix(c.center.x),y:this.toFix(c.center.y)})),marks:this.model.marks.filter(c=>c.top).map(c=>({dia:this.toFix(c.top.width),x:this.toFix(c.center.x),y:this.toFix(c.center.y)})),null_region:{vertexs:a},vcut:{lines:this.getVCut(t)},repeat:e,stamp_holes:this.model.stampGroups.map(c=>({holes:c.map(h=>({dia:this.toFix(h.radius*2),x:this.toFix(h.center.x),y:this.toFix(h.center.y)}))}))}}}convertToVertexs(t,e,r){let i=new Array;for(let n=0;n<t.length;n++){let s=t[n];for(let a of s)if(a instanceof yo)i.push([{x:a.center.x+a.radius,y:a.center.y},{x:a.center.x-a.radius,y:a.center.y,xc:a.center.x,yc:a.center.y,ccw:!0},{x:a.center.x+a.radius,y:a.center.y,xc:a.center.x,yc:a.center.y,ccw:!0}]);else{let l=a instanceof q||a instanceof M?a.start():a.start,c=a instanceof q||a instanceof M?a.end():a.end,h=[{x:l.x,y:l.y}];if(a instanceof hs||a instanceof M)h.push({x:c.x,y:c.y});else if(a instanceof Va||a instanceof q){let u=a instanceof q?a.sweep():a.sweep;h.push({x:c.x,y:c.y,xc:a.center.x,yc:a.center.y,ccw:u==ae.CCW})}i.push(h)}}return this.addOffsetToVertex(i,e,r)}addOffsetToVertex(t,e,r){let i={x:this.offset.x*r,y:this.offset.y*e};return t.map(n=>n.map(s=>"xc"in s?{x:this.toFix(s.x+i.x),y:this.toFix(s.y+i.y),xc:this.toFix(s.xc+i.x),yc:this.toFix(s.yc+i.y),ccw:s.ccw}:{x:this.toFix(s.x+i.x),y:this.toFix(s.y+i.y)}))}convertPrimitivesToVertexs(t){let e=Array();for(let r=0;r<t.length;r++){let i=t[r];r==0&&e.push({x:this.toFix(i.start().x),y:this.toFix(i.start().y)}),i instanceof M?e.push({x:this.toFix(i.end().x),y:this.toFix(i.end().y)}):i instanceof q&&e.push({x:this.toFix(i.end().x),y:this.toFix(i.end().y),xc:this.toFix(i.center.x),yc:this.toFix(i.center.y),ccw:i.isCCW})}return e}getVCut(t){let e=[],r=[],i=[];for(let n=1;n<t.row;n++){let s=this.bBox.minY+this.offset.y*n,a=s-t.rowSpacing;r.push(s,a)}!t.stampRow&&t.borderAtTopBottom&&r.push(this.bBox.minY,this.bBox.minY+this.offset.y*t.row),e.push(...r.map(n=>this.createVCutLineGivenFixedPosition(t,n,!0,this.outerBBox)));for(let n=1;n<t.column;n++){let s=this.bBox.minX+this.offset.x*n,a=s-t.columnSpacing;i.push(s,a)}return!t.stampColumn&&t.borderAtLeftRight&&i.push(this.bBox.minX,this.bBox.minX+this.offset.x*t.column),e.push(...i.map(n=>this.createVCutLineGivenFixedPosition(t,n,!1,this.outerBBox))),e.map(n=>[this.toFix(n[0].x),this.toFix(n[0].y),this.toFix(n[1].x),this.toFix(n[1].y)])}};function PF(o,t){if(!o.length)return[];let e=[o[0]],r=new Set([o[0]]);for(let s=0;s<o.length-1;s++){let a=e[0].start(),l=e.at(-1).end();for(let c of o)if(!r.has(c))if(c.start().equals1(l)){e.push(c),r.add(c);break}else if(c.end().equals1(l)){e.push(c.reverse()),r.add(c);break}else c.end().equals1(a)?(e.unshift(c),r.add(c)):c.start().equals1(a)&&(e.unshift(c.reverse()),r.add(c))}let i=ge.build2(e);return(nh(i)==t?i:i.reverse()).primitives}var EA={x:"width",y:"height"},doe={x:"row",y:"column"},_S={x:"rowSpacing",y:"columnSpacing"},L0=class o{constructor(){}static getOutlineBbox(){return o.getBoardBBox(si.getInstance().getDefaultPanelize(),Au())}static getBoardBBox(t,e){let r=new _e;for(let n of e){let s=n.getMathGraphics();r.ext1(s.bbox())}let i=r.build1();return Pi.bBox=i,o.bBoxWithOffset(i,t)}static getBoardBBox2(t,e){let r=new _e;e.forEach(n=>r.ext1(n.bbox()));let i=r.build1();return Pi.bBox=i,o.bBoxWithOffset(i,t)}static bBoxWithOffset(t,e){let r=t.maxX-t.minX,i=t.maxY-t.minY;return{x:t.minX,y:t.minY,width:r,height:i,maxX:t.maxX,maxY:t.maxY,offset:{x:e.columnSpacing+r,y:e.rowSpacing+i}}}calcBBox(t,e){let r=o.getBoardBBox2(t,e);Pi.offset=new S(r.offset.x,r.offset.y),R.getInstance().panelizeParam={success:t.success,on:t.on,row:t.row,column:t.column,offset:Pi.offset,onlyOutline:t.onlyOutline};let i,n={x:r.x,y:r.y,width:r.offset.x*t.column-t.columnSpacing,height:r.offset.y*t.row-t.rowSpacing};return i={x:n.x-(t.borderAtLeftRight?t.borderHeight+(t.stampColumn?t.columnSpacing:0):0),y:n.y-(t.borderAtTopBottom?t.borderHeight+(t.stampRow?t.rowSpacing:0):0),width:n.width+(t.borderAtLeftRight?t.borderHeight+(t.stampColumn?t.columnSpacing:0):0)*2,height:n.height+(t.borderAtTopBottom?t.borderHeight+(t.stampRow?t.rowSpacing:0):0)*2},i.center=new S(n.x+n.width/2,n.y+n.height/2),Pi.outerBBox=new ht(i.x,i.x+i.width,i.y,i.y+i.height),{bBox:r,innerBBox:n,outerBBox:i}}createOutLineCopies(t,e){let r=Au(),i=yF();for(let n=0;n<t.row;n++)for(let s=0;s<t.column;s++){let a=!n&&!s,l=!a||(t.flipX||t.flipY)&&t.flipOrigin,c;t.flipX&&!(s%2)==t.flipOrigin||t.flipY&&!(n%2)==t.flipOrigin?c=Ae.rotateZForPoint(Pi.bBox.center(),Math.PI).translate1(e.offset.x*s,e.offset.y*n,0):c=Ae.translate(e.offset.x*s,e.offset.y*n,0),r.forEach(h=>{Pi.copyOutline(h,c,a,l)}),i.forEach(h=>{Pi.copySlot(h,c,a,l)})}"META-PANELIZE-ENV"in window&&window["META-PANELIZE-ENV"]&&QVe().forEach(n=>{(t.flipX||t.flipY)&&t.flipOrigin?n.hidden():n.visible()})}createVCutLineGivenFixedPosition(t,e,r,i){let n=i.x+(t.borderAtLeftRight?t.borderHeight:0),s=i.x+i.width-(t.borderAtLeftRight?t.borderHeight:0),a=i.y+i.height-(t.borderAtTopBottom?t.borderHeight:0),l=i.y+(t.borderAtTopBottom?t.borderHeight:0),c,h;return r?(c=new S(n,e),h=new S(s,e)):(c=new S(e,a),h=new S(e,l)),Pi.addVCutLine(c,h,r),[c,h]}isIntersect(t,e,r){let[i,n]=[t,e].map(s=>s.map(a=>a instanceof Array?new ht(Math.min(a[0].x,a[1].x),Math.max(a[0].x,a[1].x),Math.min(a[0].y,a[1].y),Math.max(a[0].y,a[1].y)):new ht(a.x,a.x,a.y,a.y)));return n.map(s=>s.transform(r)).some(s=>i.some(a=>s.isIntersect(a)))}createVCutLines(t,e,r,i,n){if(!r.stampRow)for(let s=0;s<=r.row;s++){if(!r.borderAtTopBottom&&(s==0||s==r.row))continue;let a=s==r.row?i.y+i.height:i.y+e.offset.y*s;Pi.addVCutIndicator(new S(i.x+i.width,a),!0),r.rowSpacing&&!(s==0||s==r.row)&&Pi.addVCutIndicator(new S(i.x+i.width,a-r.rowSpacing),!0)}if(!r.stampColumn)for(let s=0;s<=r.column;s++){if(!r.borderAtLeftRight&&(s==0||s==r.column))continue;let a=s==r.column?i.x+i.width:i.x+e.offset.x*s;Pi.addVCutIndicator(new S(a,i.y),!1),r.columnSpacing&&!(s==0||s==r.column)&&Pi.addVCutIndicator(new S(a-r.columnSpacing,i.y),!1)}if(!r.stampRow&&!(r.borderAtLeftRight&&r.columnSpacing==0))if(r.rowSpacing==0){let s=this.getIntersects(n,new M(new S(e.x,e.maxY),new S(e.x+e.width,e.maxY))),a=this.getIntersects(n,new M(new S(e.x,e.y),new S(e.x+e.width,e.y)));if(!this.isIntersect(s,a,Qe.translate(0,e.height))){let l={pair:null,value:Number.MAX_SAFE_INTEGER};for(let u of s)for(let d of a){let p=Math.abs(u.x-d.x);p<l.value&&(l={pair:[u,d],value:p})}let c=l.pair[0],h=l.pair[1].add(new S(0,e.height));for(let u=0;u<r.column;u++)for(let d=0;d<r.row-1;d++){let p=new S(e.offset.x*u,e.offset.y*d);Pi.addVCutLine(c.add(p),h.add(p),!0)}}}else for(let s=1;s<r.row;s++){let a=e.y+e.offset.y*s,l=a-r.rowSpacing,c=[a,l].map(u=>this.createVCutLineGivenFixedPosition(r,u,!0,t)),h=ge.build4([c[0][1],c[0][0],c[1][0],c[1][1]]).asClose();Pi.addClosure(h.primitives)}if(!r.stampColumn&&!(r.borderAtTopBottom&&r.rowSpacing==0))if(r.columnSpacing==0){let s=this.getIntersects(n,new M(new S(e.x,e.y),new S(e.x,e.maxY))),a=this.getIntersects(n,new M(new S(e.maxX,e.y),new S(e.maxX,e.maxY)));if(!this.isIntersect(a,s,Qe.translate(e.width,0))){let l={pair:null,value:Number.MAX_SAFE_INTEGER};for(let u of s)for(let d of a){let p=Math.abs(u.y-d.y);p<l.value&&(l={pair:[u,d],value:p})}let c=l.pair[0].add(new S(e.width,0)),h=l.pair[1];for(let u=0;u<r.column-1;u++)for(let d=0;d<r.row;d++){let p=new S(e.offset.x*u,e.offset.y*d);Pi.addVCutLine(c.add(p),h.add(p),!1)}}}else for(let s=1;s<r.column;s++){let a=e.x+e.offset.x*s,l=a-r.columnSpacing,c=[a,l].map(u=>this.createVCutLineGivenFixedPosition(r,u,!1,t)),h=ge.build4([c[0][1],c[0][0],c[1][0],c[1][1]]).asClose();Pi.addClosure(h.primitives)}if(r.borderAtTopBottom&&!r.stampRow){let s=r.borderAtLeftRight?r.borderHeight:0;Pi.borderClosures[0].push(new M(new S(t.x+s,i.y),new S(t.x+t.width-s,i.y))),Pi.borderClosures[1].push(new M(new S(t.x+s,i.y+i.height),new S(t.x+t.width-s,i.y+i.height)))}if(r.borderAtLeftRight&&!r.stampColumn){let s=r.borderAtTopBottom?r.borderHeight:0;Pi.borderClosures[0].push(new M(new S(i.x,t.y+s),new S(i.x,t.y+t.height-s))),Pi.borderClosures[1].push(new M(new S(i.x+i.width,t.y+s),new S(i.x+i.width,t.y+t.height-s)))}r.borderAtTopBottom&&!r.stampRow&&r.borderAtLeftRight&&!r.stampColumn?([e.x+.001,e.maxX-.001].forEach((s,a)=>{let l=new M(new S(s,i.y),new S(s,i.y+i.height)),c=this.getInterSections(n,l,"y");if(c.up&&c.down){let h=c.down,u=c.up.add1(0,e.offset.y*(r.row-1));a==1&&(h=h.add1(i.width-e.width,0),u=u.add1(i.width-e.width,0)),Pi.addVCutLine(u,h,!1)}}),[e.y+.001,e.maxY-.001].forEach((s,a)=>{let l=new M(new S(i.x,s),new S(i.x+i.width,s)),c=this.getInterSections(n,l,"x");if(c.up&&c.down){let h=c.down,u=c.up.add1(e.offset.x*(r.column-1),0);a==1&&(h=h.add1(0,i.height-e.height),u=u.add1(0,i.height-e.height)),Pi.addVCutLine(h,u,!0)}})):r.borderAtTopBottom&&!r.stampRow?(this.createVCutLineGivenFixedPosition(r,i.y,!0,t),this.createVCutLineGivenFixedPosition(r,i.y+i.height,!0,t)):r.borderAtLeftRight&&!r.stampColumn&&(this.createVCutLineGivenFixedPosition(r,i.x,!1,t),this.createVCutLineGivenFixedPosition(r,i.x+i.width,!1,t))}createBorder(t,e){let i=new dt().conversion("mm","mil",5)/10,n=t.borderHeight/2,s,a,l,c,h=t.borderHeight-n;t.borderAtTopBottom&&t.borderAtLeftRight?(l=new S(e.x+i+t.borderHeight,e.y+e.height-h),c=l.add1(i,0)):t.borderAtTopBottom?(l=new S(e.x+i,e.y+e.height-h),c=l.add1(i,0)):(l=new S(e.x+h,e.y+i),c=l.add1(0,i)),s=l,a=t.createPositionHole?c:l,t.createPositionHole&&this.getAllMarkHolePosFromTopLeft(s,t,i,e).forEach(d=>Pi.addPositionHole(new S(d.x,d.y),t.positionHoleDiameter)),t.createMark&&this.getAllMarkHolePosFromTopLeft(a,t,i,e).forEach(d=>Pi.addMark(new S(d.x,d.y),t.markDiameter,t.markExpansion))}getAllMarkHolePosFromTopLeft(t,e,r,i){if(e.borderAtTopBottom){let n=t.add1(r,0);return[t,t.mirrorY(i.center),n.mirrorX(i.center),n.mirrorCenter(i.center)]}if(e.borderAtLeftRight){let n=t.add1(0,r);return[t,n.mirrorY(i.center),t.mirrorX(i.center),n.mirrorCenter(i.center)]}}createStampBorderLines(t,e,r,i,n,s){let a=t==="x"?"y":"x",l=[r[a],r[a]+r[EA[a]]];(e.stampRow&&e.borderAtTopBottom&&t=="x"||e.stampColumn&&e.borderAtLeftRight&&t=="y")&&(l[0]-=e[_S[t]],l[1]+=e[_S[t]]),n[a].forEach(c=>{for(let h=0;h<e[doe[t]];h++)l.push(c[0][a]+i.offset[a]*h)}),l.sort((c,h)=>c-h);for(let c=1;c<l.length;c+=2){let h=l[c],u=l[c-1],d=[{x:null,y:null},{x:null,y:null}];d[0][t]=r[t]-e[_S[a]],d[0][a]=h,d[1][t]=r[t]-e[_S[a]],d[1][a]=u;let p=new S(d[0].x,d[0].y),m=new S(d[1].x,d[1].y);Pi.addLine(p,m),Pi.borderClosures[0].push(new M(p,m));let g=[{x:null,y:null},{x:null,y:null}];g[0][t]=r[t]+(r[EA[t]]+e[_S[a]]),g[0][a]=h,g[1][t]=r[t]+(r[EA[t]]+e[_S[a]]),g[1][a]=u;let y=new S(g[0].x,g[0].y),b=new S(g[1].x,g[1].y);Pi.addLine(y,b),Pi.borderClosures[1].push(new M(y,b))}}arrayCopyStampLineAndHole(t,e,r,i,n,s,a,l,c){for(let h=0;h<e.row;h++)for(let u=0;u<e.column;u++)if(t==="x"?h<e.row-1:u<e.column-1){let d=new S(r.offset.x*u,r.offset.y*h),p=Qe.translate1(d),m=i,g=n,y=s;(e.flipX||e.flipY)&&(t=="x"&&e.flipX||t=="y"&&e.flipY?((e.flipOrigin?1:0)+(e.flipX?u:h))%2===1&&(m=a,g=l,y=c):((e.flipOrigin?1:0)+(e.flipX?u:h))%2===0?(m={[t]:i[t].map((P,T)=>[a[t][T][0],i[t][T][1]])},g={[t]:[l[t][1],n[t][0]]},y={[t]:[c[t][0],s[t][1]]}):(m={[t]:i[t].map((P,T)=>[i[t][T][0],a[t][T][1]])},g={[t]:[n[t][1],l[t][0]]},y={[t]:[s[t][0],c[t][1]]}));for(let P=0;P<i[t].length;P+=2){[m[t][P],m[t][P+1]].forEach(O=>{Pi.addLine(new S(O[0].x,O[0].y).add(d),new S(O[1].x,O[1].y).add(d))});let T=y[t][0][P/2].map(O=>O.multiply3(p)),I=y[t][1][P/2].map(O=>O.multiply3(p)),C=new M(T[0].start(),I[I.length-1].end()),E=new M(I[0].start(),T[T.length-1].end());Pi.addClosure([].concat(T,[C],I,[E]))}let b=g[t].map(P=>P.map(T=>new S(T.x,T.y).add(d))).flat(1);Pi.addStampHoleGroup(b,e.stampHoleDiameter)}}calcStampPos(t,e,r){let i=t.stampHoleSpacing,n=t.stampHoleDiameter,s={x:t.stampPerRow,y:t.stampPerColumn},a={x:[],y:[]},l={x:[[],[]],y:[[],[]]},c={x:[],y:[]};return["x","y"].forEach(h=>{let u=h==="x"?"y":"x",d=[];for(let g=0;g<s[h];g++){let y=e[h]+(g+1)/(s[h]+1)*e[EA[h]];d.push(y)}let p=Math.floor((d.length>1?Math.abs(d[1]-d[0]):e[EA[h]])/i-1),m=Math.min(t.stampHolePerGroup,p);for(let g=0;g<s[h];g++){let y=d[g];[-1,1].forEach(b=>{let P={type:"stampLine"};P[h]=y+(i*(m/2-.3)+n/2)*b,a[h].push(P)});for(let b=0;b<m;b++){let P={type:"stampHole"};P[h]=y+i*(b-(m-1)/2),a[h].push(P)}}for(let g=0;g<s[h];g++){let y=[],b=[[],[]],P=!0;for(let T=0;T<m+2;T++){let I=a[h][g*(m+2)+T],C=h==="x"?new M(new S(I.x,e.y),new S(I.x,e.maxY)):new M(new S(e.x,I.y),new S(+e.x+e.width,I.y)),E=this.getInterSections2(r,C,u);if(!E.down||!E.up){P=!1;break}E.up.position[u]+=I.type==="stampHole"?n/6:0,E.down.position[u]-=I.type==="stampHole"?n/6:0,u=="y"?E.down.position.y+=e.offset.y:E.down.position.x+=e.offset.x;let O=[E.up,E.down];I.type==="stampLine"?y.push(O.reverse()):I.type==="stampHole"&&O.forEach((_,x)=>b[x].push(_))}P&&(c[h].push(...y),b.forEach((T,I)=>l[h][I].push(...T)))}}),{stampHolePos:l,stampLinePos:c}}calcPolyBelowStamp(t){let e={x:[],y:[]};return["x","y"].forEach(r=>{[0,1].forEach(i=>{for(let n=0;n<t[r].length;n+=2){if(e[r][i]||(e[r][i]=[]),!t[r][n]||!t[r][n+1]){e[r][i].push([]);continue}let s=[],a=t[r][n][i],l=t[r][n+1][i],[c,h]=r=="x"==(i==0)?[l,a]:[a,l];if(c.polyline==h.polyline){let u=c.polyIndex,d=h.polyIndex,p=Qe.translate1(r=="x"?new S(0,Pi.offset.y):new S(Pi.offset.x,0)),m=i==0?c.polyline.primitives.map(y=>y.multiply3(p)):c.polyline.primitives,g=Zl.modifyStart(c.position,m[u]);if(u==d)s.push(Zl.modifyEnd(h.position,g));else{s.push(g);for(let b=u+1,P=m.length;b<d+(u<d?0:P);b++)s.push(m[b%P]);let y=Zl.modifyEnd(h.position,m[d]);s.push(y)}}else s.push(new M(c.position,h.position));e[r][i].push(s)}})}),e}createStampHoleLines(t,e,r,i){let{stampHolePos:n,stampLinePos:s}=this.calcStampPos(t,e,i),a=this.calcPolyBelowStamp(s);s={x:s.x.map(u=>u.map(d=>d.position)),y:s.y.map(u=>u.map(d=>d.position))},n={x:n.x.map(u=>u.map(d=>d.position)),y:n.y.map(u=>u.map(d=>d.position))};let l,c,h;if(t.flipX||t.flipY){let u=Ae.rotateZForPoint(Pi.bBox.center(),Math.PI),d=i.map(m=>m.clone().multiply3(u.toMatrix3())),p=this.calcStampPos(t,e,d);c=p.stampHolePos,l=p.stampLinePos,h=this.calcPolyBelowStamp(l),l={x:l.x.map(m=>m.map(g=>g.position)),y:l.y.map(m=>m.map(g=>g.position))},c={x:c.x.map(m=>m.map(g=>g.position)),y:c.y.map(m=>m.map(g=>g.position))}}t.stampRow&&t.borderAtTopBottom&&(this.createStampBorderLines("y",t,r,e,s,l),this.createStampHoleLineAlongBorder("y",t,e,r,s,n,a,l,c,h)),t.stampColumn&&t.borderAtLeftRight&&(this.createStampBorderLines("x",t,r,e,s,l),this.createStampHoleLineAlongBorder("x",t,e,r,s,n,a,l,c,h)),t.stampRow&&this.arrayCopyStampLineAndHole("x",t,e,s,n,a,l,c,h),t.stampColumn&&this.arrayCopyStampLineAndHole("y",t,e,s,n,a,l,c,h)}createStampHoleLineAlongBorder(t,e,r,i,n,s,a,l,c,h){let u=e.stampHoleDiameter,d=t==="x"?"y":"x";[0,1].forEach(p=>{for(let m=0;m<e[doe[t]];m++){let g=n,y=s,b=a;(e.flipX||e.flipY)&&(t=="y"&&e.flipX||t=="x"&&e.flipY?((e.flipOrigin?1:0)+m)%2&&(g=l,y=c,b=h):((p?0:e[doe[t]]-1)+(e.flipOrigin?1:0))%2==1&&(g=l,y=c,b=h));let P=y[d][p].map(T=>{let I={x:null,y:null};return I[t]=T[t]+r.offset[t]*(e[doe[d]]*(p?0:1)-1),I[d]=T[d]+r.offset[d]*m,new S(I.x,I.y)});Pi.addStampHoleGroup(P,u),g[d].forEach(T=>{let I=[{x:null,y:null},{x:null,y:null}];p?(I[0][t]=T[0][t]-r.offset[t],I[0][d]=T[0][d]+r.offset[d]*m,I[1][t]=i[t]-e[_S[d]],I[1][d]=T[1][d]+r.offset[d]*m):(I[0][t]=i[t]+(i[EA[t]]+e[_S[d]]),I[0][d]=T[0][d]+r.offset[d]*m,I[1][t]=T[1][t]+(i[EA[t]]-r.offset[t]+e[_S[d]]),I[1][d]=T[1][d]+r.offset[d]*m);let C=new S(I[0].x,I[0].y),E=new S(I[1].x,I[1].y);Pi.addLine(C,E),Pi.borderClosures[p?0:1].push(new M(C,E));let O=t=="x"?new S((i[EA[t]]+e[_S[d]])*(p?0:1)-r.offset[t],r.offset[d]*m):new S(r.offset[d]*m,(i[EA[t]]+e[_S[d]])*(p?0:1)-r.offset[t]);Pi.borderClosures[p?0:1].push(...this.flatten(b[d][p?0:1]).map(_=>_.multiply3(Qe.translate1(O))))})}})}flatten(t){return t.reduce((e,r)=>(e.push(...r),e),[])}reRender(){this.applyPanelize({},!1)}static getBoardOutlines(t){let e=Au();if(!e.length)return[];if("META-PANELIZE-ENV"in window&&window["META-PANELIZE-ENV"])return e.map(l=>{let c=l.getMathGraphics();return nh(c)?c.reverse():c});let r=o.getBoardBBox(t,e),i=[];e.forEach(l=>xe.addAll(i,l.getMathGraphics().primitives));let s=new $c(new ht(r.x,r.maxX,r.y,r.maxY),2,.02,new Di(4),i).detect();if(s&&s.bbox().area()<=r.height*r.width)return s.items.filter(c=>c.bbox().width()>.1&&c.bbox().height()>.1&&c.bbox().area()>1);let a=e.map(l=>l.getMathGraphics()).flat(2).filter(l=>l!=null).map(l=>l.primitives).flat(2);return[ge.build2(a)]}recordHistory(){let t=new De("panelize");t.addCommand(new coe(Pi,"modify"));let e=new bF;return t.addCommand(e),t}applyPanelize(t={},e=!0,r=null){let n={...JSON.parse(JSON.stringify(si.getInstance().getDefaultPanelize())),...t};"META-PANELIZE-ENV"in window&&window["META-PANELIZE-ENV"]&&(!n.borderAtTopBottom&&!n.stampColumn&&(n.columnSpacing=0),!n.borderAtLeftRight&&!n.stampRow&&(n.rowSpacing=0),!n.borderAtTopBottom&&n.row==1&&(n.columnSpacing=0),!n.borderAtLeftRight&&n.column==1&&(n.rowSpacing=0)),si.getInstance().setDefaultPanelize(n);let s=r==null?R.getInstance().doctype!=3:r;if(Pi.remove(),R.getInstance().needRenderPanelize=!(!n.on||n.onlyOutline),s&&(It.getInstance().visible=Ug.ONLYAXIS,It.getInstance().setMultiStyle(NC.None)),!n.on){e&&A.publish("adaptAll",""),A.publish("updateFrame",""),n.success=!1,si.getInstance().setDefaultPanelize(n);return}if(si.getInstance().useSetJsonFirst){si.getInstance().useSetJsonFirst=!1;let m=new _e,g=new _e;pt.getAllItem().forEach(T=>{T.locked&&m.ext1(T.getMathGraphics().bbox()),g.ext1(T.getMathGraphics().bbox())});let y=m.build1(),b=g.build1(),P={width:b.width(),height:b.height(),innerWidth:y.width(),innerHeight:y.height()};A.globalMessageBus.rpcCall("panelizeOuterBBox2",P);return}else if(si.getInstance().setJsonParamCache){Qt.getAllItem().forEach(y=>{y.remove()}),Kt.getAllItem().forEach(y=>{y.remove()});let m=new _e;pt.getAllItem().forEach(y=>{y.locked&&m.ext1(y.buildBBox())});let g=m.build1().center();pt.getAllItem().forEach(y=>{y.locked?si.getInstance().setJsonParamCache.flipOrigin&&y.rotateFor(g,Math.PI):y.remove()}),si.getInstance().setJsonParamCache=null}this.handleCustomRect(n);let a=o.getBoardOutlines(n);if(!a.length){A.publish("updateFrame",""),n.success=!1,si.getInstance().setDefaultPanelize(n);return}let l=o.getBoardBBox2(n,a);if(l.height===0&&l.width===0){n.success=!1,si.getInstance().setDefaultPanelize(n);return}let c="panelizeApply-time";Cn(c),n.success=!0,si.getInstance().setDefaultPanelize(n);let{innerBBox:h,outerBBox:u}=this.calcBBox(n,a);s&&(Pe.setActiveLayer(Pe.getOutlineLayer()),Pi.oldOrigin==null&&(Pi.oldOrigin=R.getInstance().origin));let d;if(n.resetCanvasOrigin?d=new S(u.x,u.y):s&&Pi.oldOrigin&&(d=Pi.oldOrigin),d){R.getInstance().origin=d;let m=this.calcBBox(n,a);l=m.bBox,h=m.innerBBox,u=m.outerBBox}let p={width:u.width,height:u.height,innerWidth:h.width,innerHeight:h.height};if(A.windowBridge.rpcCall("panelizeOuterBBox",p,Q()),A.globalMessageBus.rpcCall("panelizeOuterBBox2",p),n.onlyOutline&&this.createOutLineCopies(n,l),(!n.stampRow||!n.stampColumn)&&this.createVCutLines(u,l,n,h,a),(n.stampRow||n.stampColumn)&&this.createStampHoleLines(n,l,h,a),(n.borderAtTopBottom||n.borderAtLeftRight)&&this.createBorder(n,u),"META-PANELIZE-ENV"in window&&window["META-PANELIZE-ENV"]&&(n.flipX||n.flipY))for(let m=0;m<n.row;m++)for(let g=0;g<n.column;g++){let y=((n.flipOrigin?1:0)+(n.flipX?g:m))%2==1,b=Pi.bBox.center().add1(l.offset.x*g,l.offset.y*m);Pi.addHalfArrow(b,y)}this.createOuterMostLine(n,a,l,h,u),e&&setTimeout(()=>{A.publish("adaptAll","")},10),A.publish("updateFrame",""),Xi(c)}addBorderByPoints(t,e,r,i){for(let n=0;n<t.length;n++){let s=t[n],a,l,c,h;s instanceof S?(Pi.addArc(s,e,Math.PI,Math.PI*1.5),a=q.build3(s,180,180*.5,e,e),Pi.addArc(s.mirrorX(r),e,Math.PI*.5,Math.PI),l=q.build3(s.mirrorX(r),180*.5,180*.5,e,e),Pi.addArc(s.mirrorY(r),e,Math.PI*1.5,Math.PI*2),c=q.build3(s.mirrorY(r),180*1.5,180*.5,e,e),Pi.addArc(s.mirrorCenter(r),e,0,Math.PI*.5),h=q.build3(s.mirrorCenter(r),0,180*.5,e,e)):(Pi.addLine(s[0],s[1]),a=new M(s[0],s[1]),Pi.addLine(s[0].mirrorX(r),s[1].mirrorX(r)),l=new M(s[0].mirrorX(r),s[1].mirrorX(r)),Pi.addLine(s[0].mirrorY(r),s[1].mirrorY(r)),c=new M(s[0].mirrorY(r),s[1].mirrorY(r)),Pi.addLine(s[0].mirrorCenter(r),s[1].mirrorCenter(r)),h=new M(s[0].mirrorCenter(r),s[1].mirrorCenter(r))),i.borderAtTopBottom&&i.borderAtLeftRight?Pi.borderClosures_outerMost.push(a,l,h,c):i.borderAtTopBottom?(Pi.borderClosures[0].push(c,a),Pi.borderClosures[1].push(h,l)):i.borderAtLeftRight&&(Pi.borderClosures[0].push(a,l),Pi.borderClosures[1].push(h,c))}i.borderAtTopBottom&&i.borderAtLeftRight?Pi.borderClosures_outerMost=PF(Pi.borderClosures_outerMost,!1):(i.borderAtTopBottom||i.borderAtLeftRight)&&(Pi.borderClosures[0]=PF(Pi.borderClosures[0],!1),Pi.borderClosures[1]=PF(Pi.borderClosures[1],!1))}createOuterMostLine(t,e,r,i,n){!t.stampRow&&t.rowSpacing>0&&[r.x+.1,r.maxX-.1].forEach((a,l)=>{let c=new M(new S(a,n.y),new S(a,n.y+n.height)),h=this.getInterSections(e,c,"y");if(h.up&&h.down){let u=h.up,d=h.down.add1(0,r.offset.y*(t.row-1));l==1&&(u=u.add1(i.width-r.width,0),d=d.add1(i.width-r.width,0)),Pi.addLine(u,d)}}),!t.stampColumn&&t.columnSpacing>0&&[r.y+.1,r.maxY-.1].forEach((a,l)=>{let c=new M(new S(n.x,a),new S(n.x+n.width,a)),h=this.getInterSections(e,c,"x");if(h.up&&h.down){let u=h.up,d=h.down.add1(r.offset.x*(t.column-1),0);l==1&&(u=u.add1(0,i.height-r.height),d=d.add1(0,i.height-r.height)),Pi.addLine(u,d)}});let s=!1;if(t.borderAtTopBottom&&!t.borderAtLeftRight){if(!t.stampRow&&t.rowSpacing>0){let a=new S(n.x,n.y),l=a.add1(t.borderRadius,t.borderRadius),c=a.add1(0,t.borderRadius),h=a.add1(0,t.borderHeight),u=a.add1(t.borderRadius,0),d=a.add1(n.width/2,0);this.addBorderByPoints([[h,c],l,[u,d]],t.borderRadius,n.center,t),s=!0}}else if(t.borderAtLeftRight&&!t.borderAtTopBottom&&!t.stampColumn&&t.columnSpacing>0){let a=new S(n.x,n.y),l=a.add1(t.borderRadius,0),c=a.add1(t.borderRadius,t.borderRadius),h=a.add1(t.borderHeight,0),u=a.add1(0,t.borderRadius),d=new S(n.x,n.y+n.height/2);this.addBorderByPoints([[h,l],c,[u,d]],t.borderRadius,n.center,t),s=!0}if(!s&&(t.borderAtLeftRight||t.borderAtTopBottom)){let a=new S(n.x,n.y),l=a.add1(t.borderRadius,t.borderRadius),c=a.add1(0,t.borderRadius),h=a.add1(0,t.borderAtLeftRight?n.height/2:t.borderHeight),u=a.add1(t.borderRadius,0),d=a.add1(t.borderAtTopBottom?n.width/2:t.borderHeight,0);this.addBorderByPoints([[h,c],l,[u,d]],t.borderRadius,n.center,t)}}getIntersects(t,e){let r=[];return t.forEach(i=>{for(let n of i.primitives)if(n instanceof M||n instanceof q){let s=[],a=Pt(e,n),l=n instanceof M&&n.direct&&ne.eq(e.direct.cross(n.direct),0);for(let c=0;c<a;c+=2){let h=new S(Ee[c],Ee[c+1]);s.push(h)}l&&s.length>1?r.push(s):s.length>0&&(r=r.concat(s))}}),r}getInterSections2(t,e,r){let i=new Array;for(let s of t){let a=new Array;for(let l=0;l<s.primitives.length;l++){let c=s.primitives[l],h=Pt(e,c);for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);a.push({polyline:s,polyIndex:l,position:d})}}a.length>0&&(i=i.concat(a))}let n={};return i.forEach(s=>{(!n.up||+s.position[r]>+n.up.position[r])&&(n.up=s),(!n.down||+s.position[r]<+n.down.position[r])&&(n.down=s)}),n}getInterSections(t,e,r){let i=[];t.forEach(s=>{let a=[];for(let l of s.primitives){let c=Pt(e,l);for(let h=0;h<c;h+=2){let u=new S(Ee[h],Ee[h+1]);a.push(u)}}a.length>0&&(i=i.concat(a))});let n={};return i.forEach(s=>{s&&((!n.up||+s[r]>+n.up[r])&&(n.up=s),(!n.down||+s[r]<+n.down[r])&&(n.down=s))}),ne.eq(n.down.x,n.up.x)&&ne.eq(n.down.y,n.up.y)?{}:n}handleCustomRect(t){if(t.useCustomSize==null||t.customWidth<=0||t.customHeight<=0)return;let e="customRectForPanelize",r=Xt.getItem(e);if(t.useCustomSize)if(r&&!r.isEmpty)r.width=t.customWidth,r.height=t.customHeight;else{let i=new hi;i.createGroup("Use custom size for panelize");let n=qe.stack!=null;[].concat(Xt.getAllItem(),Kt.getAllItem(),pt.getAllItem()).forEach(a=>{a.isEmpty||(!n&&i.addCommand4Item(a,"delete"),a.remove(),A.publish("delete",a))});let s=Xt.addRect("Board Outline",11,new S(0,0),t.customWidth,t.customHeight,"",!1,1,0,0,void 0,e);n||(i.addCommand4Item(s,"add"),i.execute())}else r&&qe.undo()}helpCircle(t,e=.5){let r=q.buildCircle(t,e);JVe.displayPolyline(ge.build2([r]),4)}};var sSe=class{get deactiveAlpha(){return Ze.getInstance().deactiveAlpha}set deactiveAlpha(t){Ze.getInstance().deactiveAlpha=t;let e=Pe.getAllLayer();for(let r of e)r.refreshRender()}},ER=new sSe;var TF=class{buildLayers(t=Ze.getInstance().getAllItem()){let e=Ze.getInstance(),r=new Set([1001,1002]),i;for(let a of t){let l=a.layerId;if(r.has(l))return;Pe.addPcbLayerByModel(a,e.activeLayer==l),i=a.deactiveColor.alpha}i!=null&&(ER.deactiveAlpha=i);let n=Pe.getLayer(47),s=Pe.getLayer(12);n&&s&&(n.visible=s.visible)}buildLayerPhys(){}};var IF=class extends bx{constructor(){super(...arguments);this.manager=re.getInstance()}buildRule(e=this.manager.getAllNets()){for(let r of e)Hu.addNetByModel(r);this.ruleInitAndCheck(),this.correctEmptyNet()}};var CF=class{buildGroup(t=Xd.getInstance().getAllItem()){for(let e of t)Ht.rebuildByModel(e)}};var eGe=Ze.getInstance(),tGe=new RegExp(/(_([0-9]+))$/),OR=class{constructor(){this.planeLayerIds=new Set(eGe.getAllPlaneLayerIds());this.singleLayerIds=new Set(eGe.getAllSignalLayerIds())}addGroup(t){let e=t.model.getGroupID();if(e!=null){let r=Ht.getItem(e);if(r==null)r=Ht.rebuild(e,[t]);else if(r.addItem(t),t instanceof ke&&t.attrsMap["Reuse Block"]==null){let i=r.name;i!=null&&tGe.test(i)&&(t.reuseBlock=i.replace(tGe,""),t.combinationID==""&&(t.combinationID=i.replace(t.reuseBlock+"_","")))}}}};var AR=class extends OR{buildImages(t=Hs.getInstance().getAllItem()){return this.buildPcbItems(t,Bn,Bn.addImageByModel)}buildColorfulPictures(t=_p.getInstance().getAllItem()){return this.buildPcbItems(t,So,So.addImageByModel)}buildPads(t=jn.getInstance().getAllItem()){var r,i,n;let e=[];for(let s of t)if(((r=s.top)==null?void 0:r.pl)==null&&((i=s.bottom)==null?void 0:i.pl)==null&&((n=s.inner)==null?void 0:n.pl)==null){let a=Qt.addPadByModel(s);this.addGroup(a),e.push(a)}else{let a=Qt.addPolygonPadByModel(s);this.addGroup(a),e.push(a)}return e}buildLines(t=Sn.getInstance().getAllItem()){let e=new Array,r=Ze.getInstance();for(let n of t){let s=n.layerId;s!=1&&s!=2&&mu(r.getLayer(s).type)?(n.remove(),Sn.getInstance().delete(n,n.globalIndex)):e.push(n)}return this.buildPcbItems(e,pr,pr.addTrackByModel)}buildDimension(t=Ma.getInstance().getAllItem()){return this.buildPcbItems(t,Yo,Yo.addDimensionByModel)}buildRadiusMark(t=sl.getInstance().getAllItem()){return this.buildPcbItems(t,jo,jo.addRadiusMarkByModel)}buildProtractor(t=Na.getInstance().getAllItem()){return this.buildPcbItems(t,os,os.addProtractorByModel)}buildVia(t=bn.getInstance().getAllItem()){return this.buildPcbItems(t,Wr,Wr.addViaByModel)}buildText(t=io.getInstance().getAllItem()){return this.buildPcbItems(t,ri,ri.addtextByModel)}buildPlaneZone(t=Xo.getInstance().getAllItem()){let e=[];for(let i=0;i<t.length;i++){let n=t[i];this.planeLayerIds.has(n.layerId)?e.push(n):Xo.getInstance().delete(n,n.globalIndex)}return this.buildPcbItems(e,zn,zn.addPlaneZoneByModel)}buildPcbItems(t,e,r){let i=[];for(let n of t){let s=r.call(e,n);this.addGroup(s),i.push(s)}return i}buildComponent(t=Ms.getInstance().getAllItem()){let e=new Array;for(let r of t){let i=Xc(r);this.addGroup(i),e.push(i);for(let n in i.attrsMap)i.modifyATTRMap(n,i.attrsMap[n])}return e}};var aSe=class{constructor(){this.default={material:"Polyimide",fpcModel:"3M9077"}}getOneStiffener(){let t=Xt.getAllItem();for(let e of t)if(e.type==="FPC Stiffener")return e;t=pt.getAllItem();for(let e of t)if(e.type==="FPC Stiffener")return e;t=Kt.getAllItem();for(let e of t)if(e.type==="FPC Stiffener")return e;return null}correctAllProps(t){let{material:e,fpcModel:r,thickness:i}=t;this.correctMaterial(e,t),this.correctModel(r,t),this.correctThickness(i,t)}correctMaterial(t,e){let r=e.material;return h8e.includes(t)?e.material=t:e.material="Polyimide",r!==e.material}correctModel(t,e){let r=e.fpcModel;return e.material==="Tape"?u8e.includes(t)?e.fpcModel=t:e.fpcModel="TESA8854":e.fpcModel=null,r!==e.fpcModel}correctThickness(t,e){let r=e.thickness,{values:i,defaultValue:n}=this.getThicknessValues(e);return i.some(s=>s===t)?e.thickness=t:e.thickness=n,r!==e.thickness}getThicknessValues(t){if(t.material==="Polyimide")return{values:[.1,.15,.2,.225,.25],defaultValue:.2};if(t.material==="FR4")return{values:[.1,.2,.4,.6,.8,1,1.2,1.6],defaultValue:.2};if(t.material==="Tape"){if(t.fpcModel==="3M468"){let e=[.13];return{values:e,defaultValue:e[0]}}else if(t.fpcModel==="3M9077"){let e=[.05];return{values:e,defaultValue:e[0]}}else if(t.fpcModel==="TESA8854"){let e=[.1];return{values:e,defaultValue:e[0]}}}else if(t.material==="EMI Shielding Film"){let e=[.018];return{values:e,defaultValue:e[0]}}else if(t.material==="Stainless Steel")return{values:[.1,.2,.3],defaultValue:.2};return{values:[0],defaultValue:0}}getMaterialOptions(){return[{value:"Polyimide",text:"Polyimide"},{value:"FR4",text:"FR4"},{value:"Stainless Steel",text:"Stainless Steel"},{value:"Tape",text:"Tape"},{value:"EMI Shielding Film",text:"EMI Shielding Film"}]}getModelOptions(){return[{value:"3M468",text:"3M468"},{value:"3M9077",text:"3M9077"},{value:"TESA8854",text:"TESA8854"}]}getThicknessOptions(t){let{values:e}=this.getThicknessValues(t);return e.map(r=>({value:r,text:`${r}mm`}))}getMixThicknessOptions(){let{values:t}=this.getThicknessValues({material:"Polyimide",fpcModel:"3M468"}),{values:e}=this.getThicknessValues({material:"FR4",fpcModel:"3M468"}),{values:r}=this.getThicknessValues({material:"Tape",fpcModel:"3M468"}),{values:i}=this.getThicknessValues({material:"Tape",fpcModel:"3M9077"}),{values:n}=this.getThicknessValues({material:"Tape",fpcModel:"TESA8854"}),{values:s}=this.getThicknessValues({material:"Stainless Steel",fpcModel:"3M468"}),{values:a}=this.getThicknessValues({material:"EMI Shielding Film",fpcModel:"3M468"}),l=Array.from(new Set([].concat(t,e,r,i,n,s,a)));return l.sort((c,h)=>c-h),l.map(c=>({value:c,text:`${c}mm`}))}},td=new aSe;var _R=class extends OR{constructor(){super(...arguments);this.boards=[];this.slots=[];this.pours=[];this.fills=[];this.tearDrops=[];this.prohibits=[];this.constraints=[];this.partitions=[];this.lines=[];this.fpcStiffeners=[];this.d3shellOutlines=[];this.d3shellSlots=[];this.d3shellEntitys=[];this.d3shellSideLines=[];this.d3shellScrews=[];this.result=new Tn}buildRect(e=Qi.getInstance().getAllItem(),r){for(let i of e){if(!this.check(i)){Qi.getInstance().delete(i,i.globalIndex);continue}let n=Xt.addRectByModel(i);i.type=="Partition"&&bo.getInstance().addItem(n),this.getProfile(n),this.result.push(n),r&&r.push(n)}}buildCircle(e=Fi.getInstance().getAllItem(),r){for(let i of e){if(!this.check(i)){Fi.getInstance().delete(i);continue}let n=Kt.addCircleByModel(i);i.type=="Partition"&&bo.getInstance().addItem(n),this.getProfile(n),this.result.push(n),r&&r.push(n)}}buildPolygon(e=vi.getInstance().getAllItem(),r){for(let i of e){if(!this.check(i)){vi.getInstance().delete(i,i.globalIndex);continue}let n=new Array(i.childrens.length);if(!i.isSimplify){let a=0;for(let l of i.childrens){let c=new Array(l.length),h=0;for(let u of l)u instanceof hs?c[h++]=Cu.addByModel(u):c[h++]=Yc.addArcByModel(u);n[a++]=c}}let s=pt.addPolygonByModel(i,n);i.type=="Partition"&&bo.getInstance().addItem(s),this.getProfile(s),this.result.push(s),r&&r.push(s)}}getResult(){return this.result}buildProfiles(){return this.buildRect(),this.buildCircle(),this.buildPolygon(),this.updateAllProfile(),this.result.toArray()}check(e){var r,i;switch(e.type){case"Copper Region":{if(!this.singleLayerIds.has(e.layerId))return!1;break}case"Fill Region":{let n=(r=Ze.getInstance().getLayer(e.layerId))==null?void 0:r.type;if(ns(n)&&!this.singleLayerIds.has(e.layerId))return!1;break}case"TearDrop":{let n=(i=Ze.getInstance().getLayer(e.layerId))==null?void 0:i.type;if(ns(n)&&!this.singleLayerIds.has(e.layerId))return!1;break}}return!0}updateAllProfile(){this.updateOutline(),this.updateSlot(),this.updatePour(),this.updateFillRegion(),this.updateProhibitedRegion(),this.updateConstraintRegion(),this.updatePartitionRegion(),this.updateLine(),this.updateTearDrop(),this.updateFPCStiffener(),this.updateD3ShellOutline(),this.updateD3ShellOutline(),this.updateD3ShellSlotRegion(),this.updateD3ShellEntity(),this.updateD3ShellScrew(),this.updateD3ShellSideDatumLine()}getProfile(e){switch(e.type){case"Board Outline":this.boards.push(e);break;case"Slot Region":this.slots.push(e);break;case"Copper Region":this.pours.push(e);break;case"Fill Region":this.fills.push(e);break;case"TearDrop":this.tearDrops.push(e);break;case"Prohibited Region":this.prohibits.push(e);break;case"Constraint Region":this.constraints.push(e);break;case"Partition":this.partitions.push(e);break;case"Line":this.lines.push(e);break;case"FPC Stiffener":this.fpcStiffeners.push(e);break;case"3D Shell - Outline":this.d3shellOutlines.push(e);break;case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":this.d3shellSlots.push(e);break;case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":this.d3shellEntitys.push(e);break;case"3D Shell - Screw Pillar":this.d3shellScrews.push(e);break;case"3D Shell - Side Datum Line":this.d3shellSideLines.push(e);break}}updateOutline(){let e=this.boards;for(let r of e)this.addGroup(r)}updateSlot(){let e=this.slots;for(let r of e)this.addGroup(r)}updatePour(){let e=this.pours,r=Ti.nameManager;for(let i of e){let n=i.model.component;n.name?r.has(n.name)&&(n.name=r.getNum(n.name)):n.name=r.getNum("pour1"),r.add(n.name),this.addGroup(i)}}updateFillRegion(){let e=this.fills;for(let r of e)this.addGroup(r)}updateProhibitedRegion(){let e=this.prohibits;for(let r of e)this.addGroup(r)}updateTearDrop(){let e=this.tearDrops;for(let r of e)this.addGroup(r),new bl(JSON.stringify({connects:r.getComponent().connects}),"TearDrop").modifyComponent(r)}updateConstraintRegion(){let e=this.constraints,r=Z0.getInstance();for(let i of e){let n=i.model.component;n.name?r.hasName(n.name)&&(n.name=r.getName(n.name)):n.name=r.getName(),r.addName(n.name),this.addGroup(i)}}updatePartitionRegion(){let e=this.partitions,r=bo.getInstance();for(let i of e){let n=i.model.component;n.name||(n.name=r.getName()),r.addName(n.name),this.addGroup(i)}}updateLine(){let e=this.lines;for(let r of e)this.addGroup(r)}updateFPCStiffener(){let e=this.fpcStiffeners;for(let r of e){let i=r.getComponent();td.correctAllProps(i),this.addGroup(r)}}updateD3ShellOutline(){let e=this.d3shellOutlines;for(let r of e)this.addGroup(r)}updateD3ShellSlotRegion(){let e=this.d3shellSlots;for(let r of e)this.addGroup(r)}updateD3ShellEntity(){let e=this.d3shellEntitys;for(let r of e)this.addGroup(r)}updateD3ShellScrew(){let e=this.d3shellScrews;for(let r of e)this.addGroup(r)}updateD3ShellSideDatumLine(){let e=this.d3shellSideLines;for(let r of e)this.addGroup(r)}};var poe=class extends OR{constructor(){super(...arguments);this.result=new Tn}build(e=qo.getInstance().getAllItem()){for(let r of e){let i,n=r.getParent();if(!n)continue;let s=n.globalIndex;switch(n.modelType){case"Rect":i=Xt.getItem(s);break;case"Circle":i=Kt.getItem(s);break;case"Polygon":i=pt.getItem(s);break}if(!i)continue;let l=Ti.addCopperByModel(r);l.fill(),i.addCopperResult(l),l.setParent(i),this.result.push(l)}return this.result.toArray()}};var _2=class extends cS{constructor(e){super(e);this.items=new Array;this.decode=new vy}async init(e,r){this.compiler!=null&&(await super.init(e,r),await this.parseObj())}build(e){let{unRebuildRatline:r}=e||{};Bke();let i="pcbDataStrDecode-time";Cn(i),this.buildDataModels(),ITe(),va.modelIsBuilt=!0,Xi(i);let n="buildController-time";return Cn(n),this.buildController(),ITe(),va.controllerIsBuilt=!0,Xi(n),(R.getInstance().doctype===3||R.getInstance().id=="panelizePreview")&&new L0().applyPanelize({},!1),R.getInstance().doctype===3?setTimeout(()=>{he.publish("HistoryFlushService",{openPcb:!0,unRebuildRatline:r})},0):he.publish("updateFrame",""),va.engineHighlightReady=!0,!0}initItems(e){for(let r of e)r.initVisible();jP.initModify(e)}initEnd(){Ye.finishInit(),jP.initModifyEnd()}buildController(){let e=new TF,r=new IF,i=new CF;e.buildLayers(),i.buildGroup(),r.buildRule();let n=new AR,a=new _R().buildProfiles(),c=new poe().build(),h=n.buildImages(),u=n.buildColorfulPictures(),d=n.buildLines(),p=n.buildDimension(),m=n.buildRadiusMark(),g=n.buildProtractor(),y=n.buildVia(),b=n.buildText(),P=n.buildPlaneZone(),T=n.buildPads(),I=n.buildComponent();va.engineHighlightReady=!1,this.initItems(a),this.initItems(c),this.initItems(h),this.initItems(u),this.initItems(T),this.initItems(d),this.initItems(p),this.initItems(m),this.initItems(g),this.initItems(y),this.initItems(b),this.initItems(P),this.initItems(I),this.initEnd();let C={components:{desc:"\u5143\u4EF6",amount:I.length},pads:{desc:"\u710A\u76D8",amount:T.length},via:{desc:"\u8FC7\u5B54",amount:y.length},track:{desc:"\u5BFC\u7EBF",amount:d.length},profiles:{desc:"2D\u8F6E\u5ED3\u7EBF",amount:a.length},text:{desc:"\u6587\u672C",amount:b.length},coppers:{desc:"\u94FA\u94DC",amount:c.length},images:{desc:"\u56FE\u7247",amount:h.length},colorfulPictures:{desc:"\u5F69\u8272\u56FE\u7247",amount:u.length},dimension:{desc:"\u5C3A\u5BF8\u5DE5\u5177",amount:p.length},radiusMark:{desc:"\u534A\u5F84\u5C3A\u5BF8",amount:m.length},protractor:{desc:"\u91CF\u89D2\u5668",amount:g.length},planeZones:{desc:"\u5185\u7535\u5C42",amount:P.length}};for(let E in C)C[E].ratio=+(C[E].amount/this.items.length).toFixed(2);og("ShapeAmountCount",{color:"#ffff00"},this.items.length),console.table(C)}buildDataModels(){this.decode.preAdjust(),this.batchBuildItems(),this.buildItems(this.decode.canvas),this.buildItems(this.decode.primitive),this.buildItems(this.decode.panelize),this.buildItems(this.decode.panelizeStamp),this.buildItems(this.decode.panelizeSide),this.buildItems(this.decode.preference),this.buildItems(this.decode.silkOpts),this.buildItems(this.decode.activeLayer),this.buildItems(this.decode.board?[this.decode.board]:[])}getDecode(){return this.decode}};var F3=class extends pbe{constructor(t){super(),this.compiler=t}onLine(t,e,r,i,n,s,a,l,c,h){let u=r?JSON.parse(r):null;this.compiler.onParseLine(t,i,u,n,e)}onDocHead(){}onEnd(){}};var SF=class{constructor(t){this.commandFactory=t;let e=new Qd("2.0",R.getInstance().doctype).save();this.parseSourceByCompiler(e),this.decode=this.modelDecode.getDecodeTool()}parseSourceByCompiler(t){if(t==null)return!1;let e=R.getInstance().compiler;this.modelDecode=new _2(e);let r=e.getHandle(),i=new s1(this.modelDecode);e.setHandle(i,!0),new F3(e).parseFull(t),e.setHandle(r,!0)}getDecode(t,e){this.decode.preAdjust(),e&&e();for(let r of this.decode.attr)r.check();return this.diffDecode=this.getDifferentDecode(t,!1),this.delete(this.diffDecode),this.delete(this.getDifferentDecode(t,!0)),this.diffDecode}delete(t){if(this.deleteItem(Wr,t.via),this.deleteItem(ri,t.str),this.deleteItem(Xt,t.poly),this.deleteItem(Xt,t.fill),this.deleteItem(Xt,t.fpcFill),this.deleteItem(Xt,t.region),this.deleteItem(Xt,t.pour),this.deleteItem(Xt,t.shells),this.deleteItem(Xt,t.shellCuts),this.deleteItem(Xt,t.shellEntity),this.deleteItem(Kt,t.poly),this.deleteItem(Kt,t.fill),this.deleteItem(Kt,t.fpcFill),this.deleteItem(Kt,t.region),this.deleteItem(Kt,t.pour),this.deleteItem(Kt,t.shells),this.deleteItem(Kt,t.shellCuts),this.deleteItem(Kt,t.shellEntity),this.deleteItem(Kt,t.bosses),this.deleteItem(pt,t.poly),this.deleteItem(pt,t.fill),this.deleteItem(pt,t.fpcFill),this.deleteItem(pt,t.region),this.deleteItem(pt,t.pour),this.deleteItem(pt,t.shells),this.deleteItem(pt,t.shellCuts),this.deleteItem(pt,t.shellEntity),this.deleteItem(pt,t.creases),this.deleteItem(pr,t.line),this.deleteItem(pr,t.arc),this.deleteItem(pt,t.tearDrop),this.deleteItem(zn,t.fill),this.deleteItem(Qt,t.pad),this.deleteItem(Bn,t.image),this.deleteItem(Bn,t.objs),t.board){let e=us.getInstance().board;e&&(this.commandFactory&&this.commandFactory.addCommand4Item(e,"delete"),e.remove(),A.publish("delete",e))}for(let e of t.dimension){let r=e.type,i;switch(r){case"LENGTH":i=Yo.getItem(e.index);break;case"ANGLE":i=os.getItem(e.index);break;case"RADIUS":i=jo.getItem(e.index);break}i&&(this.commandFactory&&this.commandFactory.addCommand4Item(i,"delete"),i.remove(),A.publish("delete",i))}this.deleteItem(Ar,t.component);for(let e of t.group){let r=Ht.getGroupByName(e.name);r&&(this.commandFactory&&this.commandFactory.addCommand4Item(r,"delete"),r.remove(),A.publish("delete",r))}this.deleteItem(Ht,t.group);for(let e of t.copper)this.deleteItem(Ti,e.coppers)}deleteItem(t,e){let r;for(let i of e)r=t.getItem(i.index),r&&(this.commandFactory&&this.commandFactory.addCommand4Item(r,"delete"),r.remove(),A.publish("delete",r))}getDifferentDecode(t,e=!1){let r=this.decode;e&&(r=t,t=this.decode);let i=new vy;return xe.addAll(i.canvas,this.pushItem(r.canvas,t.canvas)),xe.addAll(i.layer,this.pushItem(r.layer,t.layer)),xe.addAll(i.layerPhys,this.pushItem(r.layerPhys,t.layerPhys)),xe.addAll(i.activeLayer,this.pushItem(r.activeLayer,t.activeLayer)),xe.addAll(i.net,this.pushItem(r.net,t.net)),xe.addAll(i.rule,this.pushItem(r.rule,t.rule)),xe.addAll(i.ruleSelect,this.pushItem(r.ruleSelect,t.ruleSelect)),xe.addAll(i.primitive,this.pushItem(r.primitive,t.primitive)),xe.addAll(i.group,this.pushItem(r.group,t.group)),xe.addAll(i.via,this.pushItem(r.via,t.via)),xe.addAll(i.pad,this.pushItem(r.pad,t.pad)),xe.addAll(i.line,this.pushItem(r.line,t.line)),xe.addAll(i.arc,this.pushItem(r.arc,t.arc)),xe.addAll(i.poly,this.pushItem(r.poly,t.poly)),xe.addAll(i.fill,this.pushItem(r.fill,t.fill)),xe.addAll(i.fpcFill,this.pushItem(r.fpcFill,t.fpcFill)),xe.addAll(i.region,this.pushItem(r.region,t.region)),xe.addAll(i.partition,this.pushItem(r.partition,t.partition)),xe.addAll(i.pour,this.pushItem(r.pour,t.pour)),xe.addAll(i.image,this.pushItem(r.image,t.image)),xe.addAll(i.objs,this.pushItem(r.objs,t.objs)),xe.addAll(i.tearDrop,this.pushItem(r.tearDrop,t.tearDrop)),xe.addAll(i.font,this.pushItem(r.font,t.font)),xe.addAll(i.str,this.pushItem(r.str,t.str)),xe.addAll(i.attr,this.pushItem(r.attr,t.attr)),xe.addAll(i.dimension,this.pushItem(r.dimension,t.dimension)),xe.addAll(i.component,this.pushItem(r.component,t.component)),xe.addAll(i.padNet,this.pushItem(r.padNet,t.padNet)),xe.addAll(i.shells,this.pushItem(r.shells,t.shells)),xe.addAll(i.shellCuts,this.pushItem(r.shellCuts,t.shellCuts)),xe.addAll(i.creases,this.pushItem(r.creases,t.creases)),xe.addAll(i.bosses,this.pushItem(r.bosses,t.bosses)),xe.addAll(i.panelize,this.pushItem(r.panelize,t.panelize)),xe.addAll(i.panelizeStamp,this.pushItem(r.panelizeStamp,t.panelizeStamp)),xe.addAll(i.panelizeSide,this.pushItem(r.panelizeSide,t.panelizeSide)),xe.addAll(i.silkOpts,this.pushItem(r.silkOpts,t.silkOpts)),i.board=this.pushItem(r.board?[r.board]:[],t.board?[t.board]:[])[0],i}pushItem(t,e){let r=!0;if(t.length>0&&(r=t[0].hashkey==null),r&&e.length>0&&(r=e[0].hashkey==null),r){let i=e;for(let n of t)for(let s of e)this.deepEqual(n,s)&&(i=i.filter(a=>a!=s));return i}else{let i=new Array,n=new Map;for(let s of t)n.set(s.hashkey,s);for(let s of e){let a=n.get(s.hashkey);(!a||!this.deepEqual(a,s))&&i.push(s)}return i}}deepEqual(t,e){if(t===e)return!0;if(typeof t=="object"&&t!==null&&typeof e=="object"&&e!==null){if(Object.keys(t).length!=Object.keys(e).length)return!1;for(let r in t)if(e.hasOwnProperty(r)){if(!this.deepEqual(t[r],e[r]))return!1}else return!1;return!0}else return!1}};var foe=class{constructor(t){this._index=new Array;this._indexSet=new Set;this.repeatIndexIDComp=new Array;this.tool=t}applyCheck(){return!this.check()||(this.getIndex(),!xe.isSingle(this._index))?!1:(this.filterTearDrop(),this.filterDimension(),!0)}filterTearDrop(){let t=[],e=this.tool.tearDrop;for(let r of e)r.getConnect().length<2||!r.getConnect()[0]||!r.getConnect()[1]||t.push(r);this.tool.tearDrop.length=0,xe.addAll(this.tool.tearDrop,t)}filterDimension(){let t=[],e=this.tool.dimension;for(let r of e)r.getAttrLength()>=2||t.push(r);this.tool.dimension.length=0,xe.addAll(this.tool.dimension,t)}check(){return!(!this.checkItems(this.tool.line)||!this.checkItems(this.tool.canvas)||!this.checkItems(this.tool.layer)||!this.checkItems(this.tool.layerPhys)||!this.checkItems(this.tool.activeLayer)||!this.checkItems(this.tool.net)||!this.checkItems(this.tool.rule)||!this.checkItems(this.tool.ruleSelect)||!this.checkItems(this.tool.group)||!this.checkItems(this.tool.font)||!this.checkItems(this.tool.via)||!this.checkItems(this.tool.pad)||!this.checkItems(this.tool.arc)||!this.checkItems(this.tool.poly)||!this.checkItems(this.tool.fill)||!this.checkItems(this.tool.fpcFill)||!this.checkItems(this.tool.region)||!this.checkItems(this.tool.pour)||!this.checkItems(this.tool.image)||!this.checkItems(this.tool.objs)||!this.checkItems(this.tool.tearDrop)||!this.checkItems(this.tool.str)||!this.checkItems(this.tool.attr)||!this.checkItems(this.tool.dimension)||!this.checkItems(this.tool.component)||!this.checkItems(this.tool.shells)||!this.checkItems(this.tool.shellCuts)||!this.checkItems(this.tool.shellEntity)||!this.checkItems(this.tool.creases)||!this.checkItems(this.tool.bosses))}checkItems(t){try{for(let e of t)if(!e.check())return!1}catch{return!1}return!0}getIndex(){this._index.length=0,this._indexSet.clear(),this.repeatIndexIDComp.length=0,this.getIndexItem(this.tool.via),this.getIndexItem(this.tool.pad),this.getIndexItem(this.tool.line),this.getIndexItem(this.tool.arc),this.getIndexItem(this.tool.poly),this.getIndexItem(this.tool.fill),this.getIndexItem(this.tool.fpcFill),this.getIndexItem(this.tool.region),this.getIndexItem(this.tool.pour),this.getIndexItem(this.tool.image),this.getIndexItem(this.tool.tearDrop),this.getIndexItem(this.tool.str),this.getIndexItem(this.tool.dimension),this.getIndexItem(this.tool.component),this.getIndexItem(this.tool.attr),this.getIndexItem(this.tool.shells),this.getIndexItem(this.tool.shellCuts),this.getIndexItem(this.tool.shellEntity),this.getIndexItem(this.tool.creases),this.getIndexItem(this.tool.bosses)}getIndexItem(t){for(let e of t){for(let i=0;i<this.tool.dimensionAttr.length;i++)if(this.tool.dimensionAttr[i]===e)return;this._indexSet.has(e.index)&&this.repeatIndexIDComp.push(e),(e.index==null||e.index=="")&&this.repeatIndexIDComp.push(e),this._index.push(e.index),this._indexSet.add(e.index)}}setNoRepeatIndexID(){}};var moe=class extends foe{check(){return!this.checkItems(this.tool.silkOpts)||!this.checkItems(this.tool.primitive)||!this.checkItems(this.tool.panelize)||!this.checkItems(this.tool.panelizeStamp)||!this.checkItems(this.tool.panelizeSide)?!1:super.check()}};var EF=class extends _2{constructor(){super(...arguments);this.commandFactory=null;this.models=new Tn;this.layerModels=new Tn;this.ruleModels=new Tn;this.ruleSelectorModels=new Tn}async parseSourceByCompiler(e,r){if(e==null)return!1;let i=new s1(this),n=this.compiler.getHandle();this.compiler.setHandle(i,!0),r&&(e=yW("",e,[],[],[],[])),new F3(this.compiler).parseFull(e),this.compiler instanceof gp&&await this.parseFootAndDevice(),this.compiler.setHandle(n,!0)}build(e){let{noNeedSave:r}=e||{};this.decode.preAdjust(),this.handlePartitionIds();let i=new moe(this.decode);if(!r&&!i.applyCheck())return!1;r||(this.commandFactory=new hi,this.commandFactory.createGroup("modify by file source"));let n=new SF(this.commandFactory);if(this.decode=n.getDecode(this.decode),this.batchBuildItems(),this.buildItems(this.decode.canvas),this.buildItems(this.decode.primitive),this.buildItems(this.decode.panelize),this.buildItems(this.decode.panelizeStamp),this.buildItems(this.decode.panelizeSide),this.buildItems(this.decode.preference),this.buildItems(this.decode.silkOpts),this.buildAllItems(),this.buildItems(this.decode.activeLayer),this.decode.board){let a=this.decode.board.finish();a&&this.commandFactory&&this.commandFactory.addCommand4Item(a,"add")}this.docType==4&&lc.getTemplate().checkMustAttr();for(let a of this.items){let l=a;this.commandFactory&&this.commandFactory.addCommand4Item(l,"add"),l instanceof ke&&l.visible(),he.publish("hasModifyPcbItem",l)}this.commandFactory&&this.commandFactory.execute();let s=vR().length>0;return he.publish("autoFill",""),R.getInstance().doctype===3?(new L0().applyPanelize({},!1),r?(he.publish("rebuildCopper",""),s||he.publish("flushService","")):he.publish("HistoryFlushService","")):(he.publish("updateRtree",""),he.publish("updateFrame","")),!0}buildItems(e){for(let r of e)try{let i=r.finish();i instanceof fb?this.models.addLast(i):i instanceof mb?this.ruleSelectorModels.addLast(i):i instanceof r1?this.ruleModels.addLast(i):i instanceof UO&&this.layerModels.addLast(i)}catch(i){console.log(i)}}buildAllItems(){let e=new TF,r=new IF,i=new CF;e.buildLayers(this.layerModels.toArray()),i.buildGroup();let n=new Set;for(let C of this.ruleSelectorModels.toArray())C instanceof zd&&n.add(C);r.buildRule(n);let s=new Map;for(let C of this.models.toArray())if(C instanceof xi){let E=C.modelType,O=s.get(E);O==null&&(O=[],s.set(E,O)),O.push(C)}let a=new AR,l=new _R;l.buildRect(s.get("Rect")||[]),l.buildCircle(s.get("Circle")||[]),l.buildPolygon(s.get("Polygon")||[]),l.updateAllProfile();let c=a.buildImages(s.get("Image")||[]),h=a.buildColorfulPictures(s.get("Picture")||[]),u=a.buildLines(s.get("Track")||[]),d=a.buildLines(s.get("ArcTrack")||[]),p=a.buildDimension(s.get("Length Dimension")||[]),m=a.buildRadiusMark(s.get("Radius Dimension")||[]),g=a.buildProtractor(s.get("Protractor Dimension")||[]),y=a.buildVia(s.get("Via")||[]),b=a.buildText(s.get("Text")||[]),P=a.buildPlaneZone(s.get("Inner")||[]),T=a.buildPads(s.get("Pad")||[]),I=a.buildComponent(s.get("Component")||[]);xe.addAll(this.items,l.getResult().toArray()),xe.addAll(this.items,c),xe.addAll(this.items,h),xe.addAll(this.items,T),xe.addAll(this.items,u),xe.addAll(this.items,d),xe.addAll(this.items,p),xe.addAll(this.items,m),xe.addAll(this.items,g),xe.addAll(this.items,y),xe.addAll(this.items,b),xe.addAll(this.items,P),xe.addAll(this.items,I)}handlePartitionIds(){if(!this.partitionId)return;let e={},r=`_partition_${this.partitionId}`;this.replaceGlobalIndex(this.decode.via,r,e),this.replaceGlobalIndex(this.decode.pad,r,e),this.replaceGlobalIndex(this.decode.line,r,e),this.replaceGlobalIndex(this.decode.arc,r,e),this.replaceGlobalIndex(this.decode.poly,r,e),this.replaceGlobalIndex(this.decode.fill,r,e),this.replaceGlobalIndex(this.decode.fpcFill,r,e),this.replaceGlobalIndex(this.decode.region,r,e),this.replaceGlobalIndex(this.decode.pour,r,e);for(let i of this.decode.copper)this.replaceGlobalIndex(i.coppers,r,e);this.replaceGlobalIndex(this.decode.image,r,e),this.replaceGlobalIndex(this.decode.objs,r,e),this.replaceGlobalIndex(this.decode.tearDrop,r,e),this.replaceGlobalIndex(this.decode.str,r,e),this.replaceGlobalIndex(this.decode.attr,r,e),this.replaceGlobalIndex(this.decode.dimension,r,e),this.replaceGlobalIndex(this.decode.shells,r,e),this.replaceGlobalIndex(this.decode.shellCuts,r,e),this.replaceGlobalIndex(this.decode.shellEntity,r,e),this.replaceGlobalIndex(this.decode.creases,r,e),this.replaceGlobalIndex(this.decode.bosses,r,e)}replaceGlobalIndex(e,r,i){for(let n of e)if(n.index.endsWith(r)){let s=nr();i[n.index]=s,n.index=s}}};function po(o){let t=new qt;return t.add("CANCEL"),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t.result}var goe=class{buildItems(t,e){try{t.forEach(r=>{r.index=nr();let i=r.finish();i instanceof xi&&(e.push(i),i.setGroupID(void 0))})}catch(r){console.log(r)}}buildAllItems(t,e=[]){let r=new AR,i=new _R;return t.forEach(n=>{let s=[];n instanceof ss?i.buildPolygon([n],s):n instanceof yo?i.buildCircle([n],s):n instanceof Za?i.buildRect([n],s):n instanceof Dl?s=r.buildImages([n]):n instanceof Ff?s=r.buildColorfulPictures([n]):n instanceof gt?s=r.buildLines([n]):n instanceof Am?s=r.buildDimension([n]):n instanceof _m?s=r.buildRadiusMark([n]):n instanceof Ap?s=r.buildProtractor([n]):n instanceof yn?s=r.buildPlaneZone([n]):n instanceof Li?s=r.buildText([n]):n instanceof et?s=r.buildPads([n]):n instanceof Ct?s=r.buildVia([n]):n instanceof Bi?s=r.buildComponent([n]):console.warn("Unsupported type!"),xe.addAll(e,s)}),e}getAllItems(t){let e=new Array,r=S.ORIGIN;t.canvas.forEach(n=>{r=n.origin}),this.buildItems(t.font,e),this.buildItems(t.via,e),this.buildItems(t.pad,e),this.buildItems(t.line,e),this.buildItems(t.arc,e),this.buildItems(t.poly,e),this.buildItems(t.fill,e),this.buildItems(t.fpcFill,e),this.buildItems(t.region,e),this.buildItems(t.pour,e),this.buildItems(t.image,e),this.buildItems(t.tearDrop,e),this.buildItems(t.str,e),this.buildItems(t.dimension,e);let i=Ae.translate(-r.x,-r.y,0);return e.forEach(n=>{n.transform(i)}),this.buildAllItems(e)}};var Ad=class{constructor(t){this.stateMap=new Map;this.selections=new Array;this.matrix=Ae.ORIGIN;this.currAngle=0;this.group=t}isMoveBox(){return this.group.length>400}recordStyle(){if(this.group.length>400&&this.stateMap.size==0){let t=new _e;for(let r of this.group)t.ext1(r.buildBBox());let e=t.build();this.updateSelectBox(e);for(let r of this.group)this.stateMap.set(r,r.isVisible?r.isHighLight?2:1:0),r.hidden()}}updateSelectBox(t){let e=le.themeConfig.canvasTheme,r=e.isSolidLine(e.selectBoxLineStyle),i=e.selectBoxColor,n=t.LL(),s=t.LR(),a=t.UR(),l=t.UL(),c=new cr(1002,n,s,r,i),h=new cr(1002,s,a,r,i),u=new cr(1002,a,l,r,i),d=new cr(1002,l,n,r,i);c.manualHighLight=!0,h.manualHighLight=!0,u.manualHighLight=!0,d.manualHighLight=!0,this.selections.push(c),this.selections.push(h),this.selections.push(u),this.selections.push(d)}rotateFor(t,e){let r=Ae.translate(-t.x,-t.y,0).rotateZ(e).translate1(t.x,t.y,0);this.transform(r)}rotateForAngle(t,e){let r=e-this.currAngle;this.currAngle=e;let i=Ae.translate(-t.x,-t.y,0).rotateZ(r).translate1(t.x,t.y,0);this.transform(i)}transform(t){if(this.selections.length>0){for(let e of this.selections)e.transform(t);this.matrix=this.matrix.multiply4(t)}else for(let e of this.group)e instanceof qc||e.transform(t)}sycn(){for(let t of this.group)t instanceof qc||t.transform(this.matrix);this.matrix=Ae.ORIGIN}removeBox(){for(let t of this.selections)t.remove();this.selections.length=0;for(let t of this.group){let e=this.stateMap.get(t);e!=null&&(e==0?t.hidden():e==1?t.visible():e==2&&(t.visible(),t.click()))}this.stateMap.clear(),this.matrix=Ae.ORIGIN}complete(){if(this.selections.length>0){for(let t of this.group)t instanceof qc||t.transform(this.matrix);this.removeBox()}}cancel(){this.removeBox()}};var Vj=class Vj extends ni{constructor(){super(...arguments);this.mouseLeftX=0;this.mouseLeftY=0}static getInstance(){let e=Vj;return e.instance==null&&(e.instance=new Vj),e.instance}set group(e){if(this.filterItems.clear(),e!=null)for(let r of e)this.filterItems.add(r),r instanceof ke&&r.getItems().forEach(i=>this.filterItems.add(i));this.tool!=null&&this.tool.cancel(),this.tool=new Ad(e),this.tool.recordStyle()}get group(){var e;return((e=this.tool)==null?void 0:e.group)||[]}getBBox(){if(this.group.length>0){let e=new _e;return this.group.forEach(i=>{e.ext1(i.buildBBox())}),e.valid()||e.ext6(0,0),e.build1()}else return new ht(0,0,0,0)}onKeyDown(e){switch(tr.getAction(2,e)){case"Cancel":this.cancel();break;case"Rotate Left":if(this.group.length>0){let i=new S(this.mouseLeftX,this.mouseLeftY),n=le.pcbConfig.rotate;for(let s of this.group)s instanceof qc||s.rotateFor(i,n)}break;case"rotate_right":if(this.group.length>0){let i=new S(this.mouseLeftX,this.mouseLeftY),n=-le.pcbConfig.rotate;for(let s of this.group)s instanceof qc||s.rotateFor(i,n)}break;case"Show Attribute Dialog When Placing Object":A.publish("openMainDialog",{cmd:23,data:{option:{unit:R.getInstance().unit}}});break}A.publish("updateFrame","")}onKeyUp(e){if(this.group.length>0){let r=new Dt(e.sceneX-this.mouseLeftX,e.sceneY-this.mouseLeftY,0),i=Ae.translate1(r);this.tool.transform(i),this.mouseLeftX=e.sceneX,this.mouseLeftY=e.sceneY}}onMouseLeftUp(e){if(A.publish("clearSelect",""),this.group.length>0){if(!Mt.checkIsCanEditByBBox(this.getBBox())){let n="beyond drawing range";Mt.showMassageTip(n,n);return}this.tool.complete();let r=new De("import dxf");for(let n of this.group){A.publish("hasModifyPcbItem",n);let s=Ce.dispatch(n,"add");r.addCommand(s)}qe.executeCommand(r);let i=new Set;for(let n of this.group)n.visible(),n instanceof He&&n.type=="Copper Region"&&i.add(n.globalIndex);A.publish("select",[]),this.group.length=0,A.publish("flushService",""),A.publish("rebuildSingleCopper",{ids:Array.from(i),isLast:!0}),this.end()}A.publish("tool","dropdrag")}onMouseMove(e){if(this.group.length>0){let r=new Dt(e.sceneX-this.mouseLeftX,e.sceneY-this.mouseLeftY,0),i=Ae.translate1(r);this.tool.transform(i),this.mouseLeftX=e.sceneX,this.mouseLeftY=e.sceneY}}interrupt(){A.publish("select",new Array),this.tool.cancel();for(let e of this.group)e.remove(),A.publish("delete",e);this.group.length=0,this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this)}parse(e){switch(e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break}A.publish("updateFrame","")}async partDxf(e){this.start();let{dataStr:r,userBBoxCenter:i,isOldDataString:n}=e,s=R.getInstance(),a=s.doctype,l=s.id,c=s.projectId,h=null,u=R.getInstance().compilerChannel;a==4?h=new HC(l,c,u):a==3?h=new gp(l,c,u):h=new gp(l,c,u);let d=new _2(h);if(r?await d.parseSourceByCompiler(r,n):await d.init(),this.option="OPTIONLEFTUP",this.drawing=!0,this.group=new goe().getAllItems(d.getDecode()),i){let p=this.getBBox().center();this.mouseLeftX=p.x,this.mouseLeftY=p.y}else this.mouseLeftX=0,this.mouseLeftY=0}};Vj.instance=null;var xR=Vj;var Ve="<...>",rGe="Group";var kl=class{constructor(){this.count=0;this.idList=new Array;this.attrlist=null;this.hasNonSignalLayerItem=!1;this.poolCache={},this.unitConversion=new dt}getAttrList(){return this.attrlist}getExtra(){return{}}getResult(t){return{attrlist:{[t]:this.attrlist},idListOfPrimitive:{[t]:Array.from(this.idList)},selectNumberForId:this.count,selectCount:this.count,hasNonSignalLayerItem:this.hasNonSignalLayerItem,extra:{...this.getExtra()}}}getCompareValue(t,e){if(this.attrlist!=null){let r=this.attrlist[t];if(r!=null&&r.value!=e)return Ve}return e}getCompareDisabledValue(t,e){if(this.attrlist!=null){let r=this.attrlist[t];if(r!=null&&(r.disable||e))return!0}return e}clearCache(){this.attrlist=null,this.hasNonSignalLayerItem=!1,this.idList.length=0,this.idList=[],this.count=0}getValue(t){return isNaN(t)||t==null?0:t}modifyCombination(t,e){t=t.trim();let r=new Array,i=e.getGroupID();if(i!=null){let s=Ht.getItem(i);if(s&&s.name==t)return r;if(s!=null){let a=Ce.dispatch(s,"modify");if(r.push(a),s.deleteItem(e),e.setGroupID(void 0),s.size==0){let l=Ce.dispatch(s,"delete");Ht.delete(s),r.push(l)}}}let n=Ht.getGroupByName(t);if(n!=null){let s=Ce.dispatch(n,"modify");r.push(s),Ht.joinCombination([e],n.globalIndex)}else if(t){let s=Ht.combination([e],t),a=Ce.dispatch(s,"add");r.push(a)}return r}getSilkColor(t,e){var r;if(t instanceof ke||t instanceof He||t instanceof Mn||t instanceof ua||t instanceof lr){let i=(r=t.silkColor)==null?void 0:r.toString(),n;3==t.layerId?n=we.topSilkscreenColor:4==t.layerId?n=we.bottomSilkscreenColor:t instanceof ke&&(1==t.layerId?n=we.topSilkscreenColor:2==t.layerId&&(n=we.bottomSilkscreenColor)),(e["attr-silk-color"]==null||e["attr-silk-color"].value!=Ve)&&n&&(e["attr-silk-color"]={title:"Silk Screen",value:this.getCompareValue("attr-silk-color",i),defaultValue:n,followDefault:!i})}}};var lu={getSheetFrameLayer(){return[{text:Pe.getOutlineLayer().name,value:11}]},isFootprintLayerInPCB(o){return[48,49,50,51,52].includes(o)&&R.getInstance().doctype===3},getRegionLayer(o){let t=new Array,e=Pe.getAllLayer();for(let r of e)if(!(r.layerID==56&&o=="Fill Region")&&!ar(r.layerID)&&!ub(r.layerID)&&!ic(r.layerID)&&r.config&&!r.isPlaneLayer()&&![47,52].includes(r.layerID)&&!ra(r.layerID)&&!(r.layerID===49&&!lu.isFootprintLayerInPCB(r.layerID))&&57!=r.layerID){let i={text:r.name,value:r.layerID};t.push(i)}return t},getRegionLayer2(o){let t=new Array,e=Pe.getAllLayer();for(let r of e)if(!(r.layerID==56&&o.type=="Fill Region")&&!ar(r.layerID)&&!ub(r.layerID)&&!ic(r.layerID)&&r.config&&!r.isPlaneLayer()&&![47,52].includes(r.layerID)&&!ra(r.layerID)&&!(r.layerID===49&&!(o instanceof Pr))&&57!=r.layerID&&!lu.isFootprintLayerInPCB(r.layerID)){let i={text:r.name,value:r.layerID};t.push(i)}return t},getSlotLayer(){return[{text:Pe.getMultLayer().name,value:12}]},getStiffenerLayer(){return[58,59].map(o=>{let t=Pe.getLayer(o);return{value:t.layerID,text:t.name}})},getProhibitLayer(){let o=new Array,t=Pe.getAllLayer();for(let e of t)if(ar(e.layerID)||e.config&&e.isSignalLayer()||e.config&&e.isPlaneLayer()){let r={text:e.name,value:e.layerID};o.push(r)}return o},getConstraintLayer(){let o=new Array,t=Pe.getAllLayer();for(let e of t)if(ar(e.layerID)||e.config&&e.isSignalLayer()||e.config&&e.isPlaneLayer()){let r={text:e.name,value:e.layerID};o.push(r)}return o},getPourLayer(){let o=new Array,t=Pe.getAllLayer();for(let e of t)if(e.config&&e.isSignalLayer()){let r={text:e.name,value:e.layerID};o.push(r)}return o},getPlaneLayer(){let o=new Array,t=Pe.getAllPlaneLayer();for(let e of t)if(e.config){let r={text:e.name,value:e.layerID};o.push(r)}return o},getLineLayer(){let o=new Array,t=Pe.getAllLayer();for(let e of t)if(!ar(e.layerID)&&!ic(e.layerID)&&e.config&&![47,52].includes(e.layerID)&&!ra(e.layerID)&&57!=e.layerID&&!LO(e.layerID)){let r={text:e.name,value:e.layerID};o.push(r)}return o},getLayerIdOptions(o){let t=Ze.getInstance().getLayer(54),e=Ze.getInstance().getLayer(55),r=Ze.getInstance().getLayer(53);switch(o){case"3D Shell - Outline":case"3D Shell - Side Datum Line":return[{text:r.name,value:r.layerId}];case"3D Shell - Screw Pillar":case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Top/Bottom Entity":return[{text:t.name,value:t.layerId},{text:e.name,value:e.layerId}];default:return[]}}},Un=class o{static getLayerListByType(t){let e=[];for(let n=0;n<t.length;n++){let s=t[n],a=[];if(s instanceof Ge)a=o.abstractTrack();else if(s instanceof ke)a=o.component();else if(s instanceof mt||s instanceof _t||s instanceof He)a=o.createLayerOptionsByLineloop(s);else if(s instanceof Mn)a=o.image();else if(s instanceof Ps)a=o.trueColorImage();else if(s instanceof Le)a=o.abstractPad();else if(s instanceof lr)a=o.pcbText();else if(s instanceof Ue)a=o.via();else if(s instanceof ua)a=o.abstractDimension();else{console.log("\u4E0D\u80FD\u5207\u5C42");continue}e.push(a)}return r(e);function r(n){if(n.length<=1)return n[0]||[];let s=new Set(i(n[0]));for(let a=0;a<n[0].length;a++)for(let l=1;l<n.length;l++)new Set(i(n[l])).has(n[0][a].value)||s.delete(n[0][a].value);return Array.from(s).map(a=>({text:Ze.getInstance().getLayer(a).name,value:a}))}function i(n){let s=[];for(let a=0;a<n.length;a++)s.push(n[a].value);return s}}static abstractTrack(){let t=new Array,e=Ze.getInstance().getAllItem();for(let r of e)r.config&&ns(r.type)&&t.push({text:r.name,value:r.layerId});return t}static component(){return[{text:Ze.getInstance().getLayer(1).name,value:1},{text:Ze.getInstance().getLayer(2).name,value:2}]}static createLayerOptionsByLineloop(t,e){let r=t.type||t.getParent().type,i=[];if(r!=null)switch(r){case"Board Outline":i=lu.getSheetFrameLayer();break;case"Fill Region":i=lu.getRegionLayer2(t);break;case"FPC Stiffener":i=lu.getStiffenerLayer();break;case"Slot Region":i=lu.getSlotLayer();break;case"Prohibited Region":i=lu.getProhibitLayer();break;case"Constraint Region":i=lu.getConstraintLayer();break;case"Copper Region":case"TearDrop":i=lu.getPourLayer();break;case"Line":i=lu.getLineLayer();break;default:i=lu.getLayerIdOptions(r)}if(e==null||e.length==0)return i;{let n=new Set(e.map(a=>a.value)),s=Array.from(e);for(let a of i)n.has(a.value)||s.push(a);return s}}static createLayerOptionsByType(t){let e=[];if(t!=null)switch(t){case"Board Outline":e=lu.getSheetFrameLayer();break;case"Fill Region":e=lu.getRegionLayer(t);break;case"FPC Stiffener":e=lu.getStiffenerLayer();break;case"Slot Region":e=lu.getSlotLayer();break;case"Prohibited Region":e=lu.getProhibitLayer();break;case"Constraint Region":e=lu.getConstraintLayer();break;case"Copper Region":case"TearDrop":e=lu.getPourLayer();break;case"Line":e=lu.getLineLayer();break;default:e=lu.getLayerIdOptions(t)}return e}static fixLayerOptions(t,e){let r=Array.from(e),i=!1,n=-1;for(let a=0;a<r.length;a++)if(+r[a].value>t&&n<=-1&&(n=a),r[a].value===t){i=!0;break}if(i)return r;let s=null;for(let a=0;a<oy.length;a++)if(oy[a].layerId===t){s={...oy[a]};break}return n>=0&&s&&r.splice(n,0,{value:t,text:s.name}),r}static image(){let t=new Array,e=Ze.getInstance().getAllItem();for(let r of e)12!=r.layerId&&11!=r.layerId&&7!=r.layerId&&8!=r.layerId&&57!=r.layerId&&47!=r.layerId&&r.config&&!mu(r.type)&&!W9(r.layerId)&&![52].includes(r.layerId)&&!ra(r.layerId)&&!ic(r.layerId)&&t.push({text:r.name,value:r.layerId});return t}static trueColorImage(){let t=Ze.getInstance(),e=t.getLayer(3),r=t.getLayer(4),i=t.getLayer(13);return[{text:e.name,value:e.layerId},{text:r.name,value:r.layerId},{text:i.name,value:i.layerId}]}static abstractPad(){let t=new Array,e=Ze.getInstance(),r={text:e.getLayer(12).name,value:12},i={text:e.getLayer(1).name,value:1},n={text:e.getLayer(2).name,value:2};return t.push(r),t.push(i),t.push(n),t}static pcbText(){let t=new Array,e=Ze.getInstance().getAllItem();for(let r of e)if(!ar(r.layerId)&&!ub(r.layerId)&&7!=r.layerId&&8!=r.layerId&&57!=r.layerId&&47!=r.layerId&&!ra(r.layerId)&&!ic(r.layerId)&&!Dee(r.layerId)&&r.config&&!mu(r.type)){let i={text:r.name,value:r.layerId};t.push(i)}return t}static via(){let t=new Array,e=Ze.getInstance().getAllItem();for(let r of e)r.config&&(ns(r.type)||mu(r.type))&&t.push({text:r.name,value:r.layerId});return t}static abstractDimension(){let t=[{text:"Top Silkscreen Layer",value:3},{text:"Bottom Silkscreen Layer",value:4},{text:"Document Layer",value:13}],e=Ze.getInstance(),r=e.getAllItem();for(let i of r)if((e.isCustomLayer(i.layerId)||wee(i.layerId))&&i.config){let n={text:i.name,value:i.layerId};t.push(n)}return t}static canChangeLayer(t,e){return G3t(t).includes(e)}};function G3t(o){return o instanceof Ge?Un.abstractTrack().map(t=>t.value):o instanceof Le?Un.abstractPad().map(t=>t.value):o instanceof lr?Un.pcbText().map(t=>t.value):o instanceof ke?Un.component().map(t=>t.value):o instanceof He?U3t(o):o instanceof Jr?lu.getPourLayer().map(t=>t.value):o instanceof Gi?lu.getPlaneLayer().map(t=>t.value):o instanceof Mn?Un.image().map(t=>t.value):o instanceof Ps?Un.trueColorImage().map(t=>t.value):o instanceof ua?Un.abstractDimension().map(t=>t.value):[]}function U3t(o){let t=o.type;switch(t){case"Board Outline":return lu.getSheetFrameLayer().map(e=>e.value);case"Slot Region":return lu.getSlotLayer().map(e=>e.value);case"Copper Region":case"TearDrop":return lu.getPourLayer().map(e=>e.value);case"Fill Region":return lu.getRegionLayer(t).map(e=>e.value);case"FPC Stiffener":return lu.getStiffenerLayer().map(e=>e.value);case"Prohibited Region":case"Constraint Region":return lu.getProhibitLayer().map(e=>e.value);case"Line":return lu.getLineLayer().map(e=>e.value);case"3D Shell - Outline":case"3D Shell - Side Datum Line":case"3D Shell - Screw Pillar":case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Top/Bottom Entity":return lu.getLayerIdOptions(t).map(e=>e.value);default:return[]}}var OF=class{constructor(t){this.group=t}restoreAttr(t,e){let r=ts.getItem(e.deviceUUID),i=Hi.getItem(e.footprintUUID),n=e.attrKeyText[t];if(t=="Device"){n!=null&&r.restoreAttr(n.model,{componentPosition:e.position,angle:e.rotation,footprintId:i.uuid,componentLayerId:e.layerId});let s=r.name;e.modifyATTRMap(t,s.toString())}else if(t=="Footprint")this.restoreFootprint(e);else if(t=="3D Model Title"){n&&(n.positionIsNull=!0,e.removeAttribute(n));let s=e.attrKeyText["3D Model"];s&&(s.positionIsNull=!0,e.removeAttribute(s));let a=e.attrKeyText["3D Model Transform"];a&&(a.positionIsNull=!0,e.removeAttribute(a));let l=r.attrMap["3D Model"],c=r.attrMap["3D Model Title"],h=r.attrMap["3D Model Transform"];if(!l){let u=Hi.getItem(e.footprintUUID);u&&(l=u.getValue("3D Model"),c=u.getValue("3D Model Title"),h=u.getValue("3D Model Transform"))}e.modifyATTRMap("3D Model",l||void 0),e.modifyATTRMap("3D Model Title",c||void 0),e.modifyATTRMap("3D Model Transform",h||void 0)}else if(i.has(t)){n!=null&&(n.positionIsNull=!0,r.restoreAttr(n.model,{componentPosition:e.position,angle:e.rotation,footprintId:i.uuid,componentLayerId:e.layerId}));let s=r.attrs[t];s==null&&(s=i.getValue(t)),e.modifyATTRMap(t,s.toString())}else n!=null&&(n.positionIsNull=!0,e.removeAttribute(n)),r.has(t)?e.modifyATTRMap(t,r.attrMap[t]):e.deleteATTRMap(t)}restoreFootprint(t){this.group!=null&&this.group.addCommand(Ce.dispatch(t,"delete"));let e=ts.getItem(t.deviceUUID),r=new d1("2.0"),i;if(e.footprintUUID==null||e.footprintUUID==""){let a=Hi.getItem(t.footprintUUID);a instanceof Sc&&(a=Hi.getItem(a.source)),e.restoreAttr(t.idShape.model,{componentPosition:t.position,angle:t.rotation,footprintId:a.uuid,componentLayerId:t.layerId}),i=r.replace(t.model,"Footprint",a.uuid)}else i=r.restore(t.model);A.publish("clearSelect",""),t.remove(),A.publish("delete",t);let n=new p1(i);n.build();let s=n.items[0];A.publish("hasModifyPcbItem",s),this.group!=null&&this.group.addCommand(Ce.dispatch(s,"add"))}};var nGe=6.75,Gj=class extends kl{constructor(){super(...arguments);this.group=null;this.component=null;this.unionAttribute=null;this.interAttribute=null;this.attrIdMap={}}set(e){return this.component=e,this}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=R.getInstance().unit,i=R.getInstance().origin;this.attrlist==null&&(this.attrlist={});let n=this.attrlist;this.getSilkColor(e,n),(n["attr-x"]==null||n["attr-x"].value!=Ve)&&(n["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",je(e.position.x-i.x,void 0,void 0,this.unitConversion))}),(n["attr-y"]==null||n["attr-y"].value!=Ve)&&(n["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",je(e.position.y-i.y,void 0,void 0,this.unitConversion))}),(n["attr-rotation"]==null||n["attr-rotation"].value!=Ve)&&(n["attr-rotation"]={title:"Rotation",value:this.getCompareValue("attr-rotation",Yl(ve(e.rotation/Math.PI*180,3)))}),(n["attr-locked"]==null||n["attr-locked"].value!=Ve)&&(n["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",e.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),(n["attr-layerid"]==null||n["attr-layerid"].value!=Ve)&&(n["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:Un.component()}),(n["attr-combination"]==null||n["attr-combination"].value!=Ve)&&(n["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",Ht.getGroupNameByGroupId(e.getGroupID())||""),options:this.poolCache.combinationOptions,hasParent:e.getParent()!=null}),(n["attr-id"]==null||n["attr-id"].value!=Ve)&&(n["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${Tr}${e.number}`),sourceId:e.globalIndex});let s=e.attrKeyValue,a=e.attrKeyText,l=ts.getItem(e.deviceUUID),c=Hi.getItem(e.footprintUUID),h=new Array;for(let u in s){if(u=="Standardization Check"||u=="IPC/DAC-2552")continue;let d={key:u,showKey:!1,value:s[u],showValue:!1,update:!1,recover:!1};if(l.checkKeyValue(u,s[u],c.uuid)?d.update=!1:d.update=!0,a[u]!=null&&(d.showKey=a[u].showKey,u!=="Name"&&(d.value=a[u].value),d.showValue=a[u].showValue,!d.update)){let p=e.layerId==2?sg(a[u].layerId):a[u].layerId,m=Hi.getItem(e.footprintUUID),g=l.needSave(a[u].model,XO(e.position,e.rotation,a[u].position),a[u].rotation-e.rotation,p,m.uuid);d.update=g}d.key=="Footprint"&&(d.recover=!0),h.push(d)}return c!=null&&h.push({key:"FootprintId",showKey:!1,value:c.uuid,showValue:!1,update:!1,recover:!0}),this.unionAttribute=this.getUnionAttrs(this.unionAttribute,h,e.globalIndex),this.interAttribute=this.getIntersectionAttrs(this.interAttribute,h),(n["attr-array"]==null||n["attr-array"].value!=Ve)&&(n["attr-array"]={title:"Attribute",value:Array.from(this.interAttribute.values())}),(n["attr-reuse-block"]==null||n["attr-reuse-block"].value!=Ve)&&(n["attr-reuse-block"]={title:"Reuse Block",value:this.getCompareValue("attr-reuse-block",e.reuseBlock)}),(n["attr-group-id"]==null||n["attr-group-id"].value!=Ve)&&(n["attr-group-id"]={title:"Group ID",value:this.getCompareValue("attr-group-id",e.combinationID)}),(n["attr-channel-id"]==null||n["attr-channel-id"].value!=Ve)&&(n["attr-channel-id"]={title:"Channel ID",value:this.getCompareValue("attr-channel-id",e.channelID)}),this}updateAttrlist4OnlyComponents(){this.attrlist["attr-array"]={title:"Attribute",value:Array.from(this.unionAttribute.values())}}getExtra(){return{attrIdMap:this.attrIdMap}}hastrue(e,r){return e||r}getIntersectionAttrs(e,r){if(e==null){e=new Map;for(let i of r)e.set(i.key,i);return e}else{let i=new Set(e.keys());for(let n of r){let s=e.get(n.key);s!=null&&(n.value!=s.value&&(s.value=Ve),this.hastrue(n.showKey,s.showKey)&&(s.showKey=!0),this.hastrue(n.showValue,s.showValue)&&(s.showValue=!0),this.hastrue(n.update,s.update)&&(s.update=!0),this.hastrue(n.recover,s.recover)&&(s.recover=!0)),i.delete(n.key)}for(let n of i)e.delete(n);return e}}getUnionAttrs(e,r,i){e==null&&(e=new Map);for(let n of r){let s=e.get(n.key);this.attrIdMap[n.key]==null&&(this.attrIdMap[n.key]=[]),this.attrIdMap[n.key].push(i),s!=null?(n.value!=s.value&&(s.value=Ve),this.hastrue(n.showKey,s.showKey)&&(s.showKey=!0),this.hastrue(n.showValue,s.showValue)&&(s.showValue=!0),this.hastrue(n.update,s.update)&&(s.update=!0),this.hastrue(n.recover,s.recover)&&(s.recover=!0)):e.set(n.key,n)}return e}clearCache(){var e,r;super.clearCache(),(e=this.unionAttribute)==null||e.clear(),(r=this.interAttribute)==null||r.clear(),this.unionAttribute=null,this.interAttribute=null,this.attrIdMap={}}modifyBy(e,r,i){this.group=r,this.update(this.component,e,i)}update(e,r,i){let n=R.getInstance().origin,s=new dt;if(r["attr-layerid"]!=null){if(e.locked)return;e.layerId=parseInt(r["attr-layerid"])}if(r["attr-combination"]!=null){if(e.locked)return;this.modifyCombination(r["attr-combination"],e).forEach(l=>{this.group.addCommand(l)})}if(r["attr-x"]!=null){if(e.locked)return;let a=parseFloat(r["attr-x"])/10;R.getInstance().unit!="mil"&&(a=s.conversion(R.getInstance().unit,"mil",a)),e.position=new S(a+n.x,e.position.y)}if(r["attr-y"]!=null){if(e.locked)return;let a=parseFloat(r["attr-y"])/10;R.getInstance().unit!="mil"&&(a=s.conversion(R.getInstance().unit,"mil",a)),e.position=new S(e.position.x,a+n.y)}if(r["attr-rotation"]!=null){if(e.locked)return;let a=Yl(parseFloat(r["attr-rotation"]));e.rotation=a/180*Math.PI}if(r["attr-locked"]!=null&&(e.locked=r["attr-locked"]=="yes"),r["attr-array"]!=null){let a=r["attr-array"];for(let l of a){let c=e.attrKeyValue[l.key];if(c!=null)l.update==null||l.update?this.updateAttr(l,e):new OF(this.group).restoreAttr(l.key,e);else{if(typeof c>"u"&&l.value===Ve)continue;if(i){let h="";l.value!=null&&(h=l.value.toString()),e.modifyATTRMap(l.key,h),this.createATTR(e,l.key,h)}}}e.refreshNameValue()}if(r["attr-silk-color"]!=null&&(r["attr-silk-color"]===""||r["attr-silk-color"]==="none"?e.silkColor=null:e.silkColor=ee.of3(r["attr-silk-color"])),r["attr-reuse-block"]!=null&&(e.reuseBlock=r["attr-reuse-block"].trim()),r["attr-group-id"]!=null){if(e.locked)return;e.combinationID=r["attr-group-id"].trim()}if(r["attr-channel-id"]!=null){if(e.locked)return;e.channelID=r["attr-channel-id"].trim()}}createATTR(e,r,i){let n=3;e.layerId==2&&(n=4);let s=le.getDefaultFontSetting(),a=e.generateValidId(),l=ri.rebuild(a,n,r,!1,i,!1,s.defaultComponentFontTypeface,s.defaultComponentFontHeight,e.rotation,!1,S.ORIGIN,3,s.defaultComponentFontStrokeWidth,!1,0,!1,!0);return e.addAttribute(l),l}updateAttr(e,r){e.value!=null&&e.value!==Ve&&r.modifyATTRMap(e.key,e.value);let i=r.attrKeyText[e.key],n=!1,s=ts.getItem(r.deviceUUID);if(i==null){let a=r.attrKeyValue[e.key];(a==null||a===Ve)&&(a=""),i=this.createATTR(r,e.key,a),s.has(e.key)&&(n=!0)}e.showKey!=null&&(i.showKey=e.showKey),e.value!=null&&e.value!==Ve&&(i.value=e.value.toString()),e.showValue!=null&&(i.showValue=e.showValue),r.resetAttr(i),n&&s.addAttr(e.key,s.getAttrData(r.model,i.model))}};var V3=class{getHtmlData(){lc.getTemplate().checkMustAttr();let t={};t.category={title:"Category",value:lc.getTemplate().category},t.describe={title:"Describe",value:lc.getTemplate().describe};let e=new Array,r=Uj(),i=new Set,n=new Set;for(let s in r){i.add(s);let a={key:s,showKey:!1,value:r[s].value,showValue:!1,update:!1,recover:!1};a.showKey=r[s].showKey,a.value=r[s].value,a.showValue=r[s].showValue,n.add(s),e.push(a)}for(let s in lc.getTemplate().deviceAttrsMap){if(i.has(s))continue;let a={key:s,showKey:!1,value:lc.getTemplate().deviceAttrsMap[s],showValue:!1,update:!1,recover:!1};n.add(s),e.push(a)}return n.has("3D Model")||e.push({key:"3D Model",showKey:!1,value:"",showValue:!1,update:!1,recover:!1}),t["attr-array"]={value:this.genD3ModelAttr(e)},t}getPadList(){let t=new Set(ze.getSelects()),e=Qt.getAllItem(),r={};e.forEach(a=>{if(a!=ut.placingPad){let l=r[a.num];l==null&&(l=new Array,r[a.num]=l),l.push(a)}});let i=Object.keys(r);i!=null&&i.length>0&&i.sort((a,l)=>a.length<=l.length?a<l?-1:a>l?1:0:1);let n=new Array,s=R.getInstance().origin;for(let a of i){let l=r[a];for(let c of l){let h={};h.id=c.globalIndex,h.number=a,h.layerId=c.layerId,h.centerX=je(c.center.x-s.x),h.centerY=je(c.center.y-s.y),h.angle=ve(c.rotation/Math.PI*180,3),h.padLen=je(c.padLen),t.has(c)?h.select=!0:h.select=!1,n.push(h)}}return n}modifyBy(t,e){this.update(t)}getLayer(){return[{text:Ze.getInstance().getLayer(1).name,value:1},{text:Ze.getInstance().getLayer(2).name,value:2}]}update(t){console.warn(we.footprintIsConnectDevice);let e=!1,r=new De("modify ATTR by footprint property");t.category!=null&&(e=!0,lc.getTemplate().category=t.category,A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q())),t.describe!=null&&(e=!0,lc.getTemplate().describe=t.describe,A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()));let i=Uj();if(t["attr-array"]!=null){let n=this.parseD3ModelAttr(t["attr-array"]||[]);for(let s of n){let a=s.key,l=i[s.key];if(typeof l>"u"&&(a=vke(a),l=i[a]),l==null&&!s.showKey&&!s.showValue&&we.footprintIsConnectDevice,l!=null){if(s.update){let c=this.updateAttr(s,r);s.notHistory||(r.addCommand(Ce.dispatch(c,"modify")),e=!0)}else{let c=this.restoreAttr(s,r);e=!0}l.visible()}else{let c=this.createATTR(s.key,s.value.toString());s.update&&(c.showKey=s.showKey,c.showValue=s.showValue,e=!0),this.resetText(c),s.notHistory||(r.addCommand(Ce.dispatch(c,"add")),e=!0),c.visible()}}}e&&(A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),lc.getTemplate().hasModified=!0),qe.executeCommand(r),A.publish("updateRtree","")}parseD3ModelAttr(t){let e=Hv(t,"key","3D Model");if(e.index<=-1)return[...t];let r=e.data.value?JSON.parse(e.data.value):{},i=r.id,n=r.title,s=r.transf;return t.splice(e.index,1),t.push({...e.data,key:"3D Model",value:i,showKey:!1,showValue:!1}),t.push({...e.data,key:"3D Model Title",value:n}),t.push({...e.data,key:"3D Model Transform",value:s,showKey:!1,showValue:!1}),[...t]}genD3ModelAttr(t){let e=Hv(t,"key","3D Model");e.index>=0&&t.splice(e.index,1);let r=Hv(t,"key","3D Model Title");r.index>=0&&t.splice(r.index,1);let i=Hv(t,"key","3D Model Transform");return i.index>=0&&t.splice(i.index,1),t.push({...e.data,key:"3D Model",value:JSON.stringify({id:e.data&&e.data.value||"",title:r.data&&r.data.value||"",transf:i.data&&i.data.value||""}),showKey:r.data?r.data.showKey:!1,showValue:r.data?r.data.showValue:!1}),t}createATTR(t,e){let r=le.getDefaultFontSetting();return ri.addText(3,t,!1,e,!1,r.defaultComponentFontTypeface,r.defaultComponentFontHeight,0,!1,S.ORIGIN,3,r.defaultComponentFontStrokeWidth,!1,0,!1,!0)}updateAttr(t,e){let r=Uj()[t.key];if(R.getInstance().doctype==pi.FOOTPRINT&&t.key=="Designator"&&!/\?$/gi.test(t.value)&&(t.value+="?"),r!=null){let i=typeof t.value<"u"?t.value.toString():r.value;this.resetText(r,!0),t.notHistory||e.addCommand(Ce.dispatch(r,"modify")),typeof t.showKey<"u"&&(r.showKey=t.showKey),typeof t.showValue<"u"&&(r.showValue=t.showValue),r.value=i,t.key=="Footprint"&&(lc.getTemplate().footprintId=i,R.getInstance().name=i)}return r}resetText(t,e=!1){t&&t.key!=""&&(t.showValue||t.showKey||e)&&t.positionIsNull&&(t.origin!=3&&(t.origin=3),t.key!="Footprint"&&(t.position=W3t()),t.positionIsNull=!1)}restoreAttr(t,e){let r=Uj()[t.key];return r!=null&&(t.notHistory||e.addCommand(Ce.dispatch(r,"delete")),r.positionIsNull=!0,r.remove(),A.publish("delete",r),lc.getTemplate().removeAttribute(r)),r}};function Uj(){let o=ri.getAllItem(),t={};for(let e of o)e.key!=""&&(t[e.key]=e);return t}function W3t(){let o=Kc(),t=new _e,e=nGe+.5,r=.001;o.forEach(n=>{n instanceof lr&&n.key!=null||t.ext1(n.buildBBox())});let i=lc.getTemplate();if(t.valid()){let n=t.build1(),s=n.LL(),a=n.LL().sub(n.LL()).normalize(),l=i.textOffset.length(),c=new S(s.x,0),h=Uj(),u=c.add(i.textOffset),d=Object.keys(h).length;for(let p=1;p<d+1;p++){let m=new S(s.x,s.y-p*e),g=!0;for(let y in h){let b=h[y],P=m.add(a.mul(e-r)),T=m.sub(a.mul(e-r)),I=new _e;I.ext2(T).ext2(P);let C=I.build1();if(!b.positionIsNull&&C.isContains(b.position)){g=!1;break}}if(g){u=m;break}}return ne.greater(u.y,c.add(i.textOffset).y)&&(l-=e),i.textOffset=new S(i.textOffset.x,-l-e),u}return i.textOffset=i.textOffset.add(new S(0,-e)),i.textOffset}var yoe=class{constructor(){this.logger=new Di(1);lc.getTemplate(),Sr.getInstance().setIgnorePartitionId(!0),A.messageBus.rpcService("openSaveFootprintDialog",()=>new Promise(t=>{let e={uuid:lc.getTemplate().UUID,name:lc.getTemplate().footprintId,category:lc.getTemplate().category,describe:lc.getTemplate().describe,source:R.getInstance().source||""};t(e)})),A.messageBus.rpcService("getFootprintMetaData",()=>new Promise(t=>{let e={hasModified:lc.getTemplate().hasModified,uuid:lc.getTemplate().UUID,name:lc.getTemplate().footprintId,category:lc.getTemplate().category,describe:lc.getTemplate().describe,source:R.getInstance().source||""};t(e)})),A.messageBus.subscribe("changeDeviceHasModify",t=>{lc.getTemplate().hasModified=t}),A.subscribe("updateDeviceAttr",t=>{lc.getTemplate().deviceAttrsMap=t,Object.keys(t).length==0?we.footprintIsConnectDevice=!1:we.footprintIsConnectDevice=!0;let e=ri.getAllItem();for(let r of e)r.refreshRender()}),A.subscribe("saveFootprintDataSuccess",t=>{t.id!==R.getInstance().tabId||R.getInstance().doctype!==4||(lc.getTemplate().UUID=t.id,lc.getTemplate().footprintId=t.name,R.getInstance().name=t.name,lc.getTemplate().category=t.category,lc.getTemplate().describe=t.describe,R.getInstance().isactive&&(A.publish("updateFrame",""),A.publish("flushAttrPlane","")))},Q()),A.subscribe("change3DInfo",t=>{var l;if(R.getInstance().doctype!==4)return;let r=(l=new V3().getHtmlData()["attr-array"])==null?void 0:l.value,i=r==null?void 0:r.find(c=>c.key==="3D Model");if(!i)return;let{id:n,title:s,transf:a}=JSON.parse(i.value);if(n===`${t.uuid}|${t.path}`){let c={id:n,title:t.display_title||t.title,transf:a};A.publish("attrUpdate",{body:{FOOTPRINT:{"attr-array":[{key:"3D Model",update:!0,value:JSON.stringify(c)}]}},head:{action:"modifyFootprintDataByPanel",primitive:["FOOTPRINT"]}})}},Q()),A.subscribe("pcb/partSourseStr2Canvas",async t=>{if(!(!R.getInstance().isactive||R.getInstance().doctype!==4))try{await xR.getInstance().partDxf(t),A.publish("toggle",{command:"importDxf"})}catch(e){this.logger.error2(e)}}),A.subscribe("refreshElementFilter",()=>{A.publish("refreshHighLigth",""),jt.refreshHidden()}),A.subscribe("placeOrigin",t=>{if(!(!R.getInstance().isactive||R.getInstance().doctype!==4)){if(t=="center"){let e=Qt.getAllItem(),r=new _e;if(e.forEach(i=>{r.ext1(i.buildBBox())}),e.length>0){let i=r.build1();G3(i.center())}}else if(t="pad1"){let e=Qt.getAllItem(),r={};e.forEach(n=>{r[n.num]=n});let i=Object.keys(r);if(i!=null&&i.length>0){i.sort();let s=r[i[0]].center;G3(s)}else if(e.length>0){let s=Object.values(r)[0].center;G3(s)}}A.publish("updateFrame","")}}),A.subscribe("deleteElementDialog",()=>{!R.getInstance().isactive||R.getInstance().doctype!==4||A.publish("openMainDialog",{cmd:4})}),A.subscribe("toggleElementFilter",this.toggleElementFilter.bind(this)),A.subscribe("insertImage",this.insertImage.bind(this)),A.subscribe("buttomCommand",this.buttomCommand.bind(this),Q()),A.subscribe("panelSelectPad",this.select.bind(this)),A.subscribe("panelModifyPad",this.modify.bind(this)),A.subscribe("openRenumberPadsDialog",()=>{let t=Qt.getAllItem().length,e=0;ze.getSelects().forEach(i=>{i instanceof Le&&e++}),A.publish("openMainDialog",{cmd:16,data:{selectPadsNum:e,allPadsNum:t}})}),A.messageBus.rpcService("pcb/decode",async t=>{if(t!==null){let e=R.getInstance(),r=new EF(e.compiler);return await r.parseSourceByCompiler(t),r.build()}return!1}),A.messageBus.rpcService("checkOrigin",()=>({originInGraphics:this.OriginCheck(),name:lc.getTemplate().footprintId})),A.messageBus.rpcService("isPadNumDuplicated",()=>{let t=!1,e={},r=Qt.getAllItem();i(e,r);function i(n,s){for(let a=0;a<s.length;a++){let l=s[a].num;l&&(n[l]&&n[l].length>0?(t=!0,n[l].push(s[a].globalIndex)):n[l]=[s[a].globalIndex])}}return{isPadNumDuplicated:t,padNums:e}}),A.messageBus.rpcService("pcb/generateFootprint",t=>{!R.getInstance().isactive||R.getInstance().doctype!=4||(og("pcb/generateFootprint",void 0,t),qVe(t))}),A.messageBus.rpcService("pcb/getFootprintOrigin",t=>{if(!(!R.getInstance().isactive||R.getInstance().doctype!=4))return $Ve(t)}),A.messageBus.rpcService("pcb/generate3DModel",t=>A.globalMessageBus.rpcCall("/model/gnr",KVe(t))),A.messageBus.rpcService("footprint3DModel",()=>{var s;let t=null,e="",r="",n=(s=new V3().getHtmlData()["attr-array"])==null?void 0:s.value;if(n){let a=n.find(l=>l.key==="3D Model");if(a){let l=JSON.parse(a.value);t=l.id,e=l.transf,r=l.title}}return{d3modelItemId:t,d3modelItemTransform:e,d3modelItemTitle:r}})}OriginCheck(){let t=Kc(),e=new _e;return t.forEach(r=>{r instanceof lr&&r.key!=null||e.ext1(r.buildBBox())}),!(e.valid()&&!e.build1().isContains(R.getInstance().origin))}buttomCommand(t){if(!(!R.getInstance().isactive||R.getInstance().doctype!==4)&&t.action=="editPadShape"){let e=ze.getSelects();e.length==1&&e[0]instanceof sn&&A.publish("tool","editPadShape")}}toggleElementFilter(t){if(!R.getInstance().isactive||R.getInstance().doctype!==4)return;let e=t.primitive;e.value=="all"?jt.setElement(0,e.isChecked,e.isVisible,e.group):jt.setElement(parseInt(e.value),e.isChecked,e.isVisible),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q())}insertImage(t){!R.getInstance().isactive||R.getInstance().doctype!==4||A.publish("openMainDialog",{cmd:14,data:{data:t}})}select(t){if(!R.getInstance().isactive||R.getInstance().doctype!==4)return;A.publish("clearSelect","");let e=new Jt,r=new Array,i=new _e;t.forEach(n=>{let s=e.getItem(n);s!=null&&(s.click(),r.push(s),i.ext1(s.buildBBox()))}),A.publish("adaptBBox_OnlyMove",i.build1()),t.length==1&&(ql.show(r[0].buildBBox().center()),ql.click(),clearTimeout(this.timer),this.timer=setTimeout(()=>{ql.remove(),A.publish("updateFrame","")},1e3)),A.publish("select",r),gr.model=1,A.publish("updateFrame","")}modify(t){if(!R.getInstance().isactive||R.getInstance().doctype!==4)return;let e=t.id;if(e==null)return;let r=t.key,i=t.value,s=new Jt().getItem(e),a=R.getInstance().origin,l=new dt;if(s!=null&&s instanceof Le){let c=new De("Panel modify pad"),h=!1;switch(c.addCommand(Ce.dispatch(s,"modify")),r){case"layerId":{s.layerId=parseInt(i),h=!0;break}case"number":{s.num=i,h=!0;break}case"centerX":{i=l.conversion(R.getInstance().unit,"mil",parseFloat(i));let u=i/10+a.x,d=new S(u,s.center.y);s.center=d,h=!0;break}case"centerY":{i=l.conversion(R.getInstance().unit,"mil",parseFloat(i));let u=i/10+a.y,d=new S(s.center.x,u);s.center=d,h=!0;break}case"angle":{let u=parseFloat(i)/180*Math.PI;s.rotation=u,h=!0;break}case"padLen":{i=l.conversion(R.getInstance().unit,"mil",parseFloat(i))/10,s.padLen=i,h=!0;break}}h&&A.publish("clearDimension",""),qe.executeCommand(c),A.publish("hasModifyPcbItem",s),A.publish("flushService",""),A.publish("flushSelectingInfo","")}}};var boe=class{constructor(){A.subscribe("exportCoordinateFile",this.export.bind(this)),A.messageBus.rpcService("exportCoordinateFileRPC",t=>this.export.call(this,t.formData))}export(t){if(!R.getInstance().isactive||R.getInstance().doctype!==3)return;let e="exportPickAndPlaceFile-time";Cn(e);let{fileName:r,fileType:i,unit:n,btmLayerCoordinateType:s,isContainPanelized:a,isContainPanelMarkCoord:l,attrHeads:c,mirrorBottomRotation:h,separator:u,exportNoUnit:d}=t,p=new Array,m=c.map(b=>b.title),g=Ar.getAllItem(),y=si.getInstance().getDefaultPanelize();if(a&&y.success){let b=Pi.offset,P=si.getInstance().getDefaultPanelize().row,T=si.getInstance().getDefaultPanelize().column;for(let I=0;I<P;I++)for(let C=0;C<T;C++)g.forEach(E=>{let O=new S(0,0);b&&(O=new S(b.x*C,b.y*I));let _=this.getBody(E,c,n,s,O,h,d);p.push(_)})}else g.forEach(b=>{let P=new S(0,0),T=this.getBody(b,c,n,s,P,h,d);p.push(T)});if(l){let b=this.getPanelMarkBodyList(c,n,s,d);p.push(...b)}if(r||(r=new Date().toLocaleDateString()),Xi(e),t.isOnlyCreateData)return{...t,head:m,result:p,fileName:r,fileType:i,separator:u};A.publish("pcbcoordinateFileData",{...t,head:m,result:p,fileName:r,fileType:i,separator:u},Q())}getBody(t,e,r,i,n,s,a){let l=this.getStaticValues(t,r,i,n,s,a),c=new Set(Object.keys(l)),h=JSON.parse(JSON.stringify(t.attrKeyValue||{})),u=[];for(let d of e){let p=d.key;c.has(p)?u.push(l[p]):p==="Name"?u.push(this.getNameContent(t)):p==="Comment"?u.push(this.getCommentContent(t)):u.push(h[p])}return u=u.map(d=>d!=null?d:""),u}getPanelMarkBodyList(t,e,r,i){return Pi.marks.map((n,s)=>{let a=[],l=this.getPanelMarkValues(s+1,n,e,r,i),c=new Set(Object.keys(l));for(let h of t){let u=h.key;c.has(u)?a.push(l[u]):a.push("")}return a})}getNameContent(t){let e=t.getFormulaName(),r=JSON.parse(JSON.stringify(t.attrKeyValue||{}));return e||(r.Value?r.Value:r["Manufacturer Part"]?r["Manufacturer Part"]:r.Device?r.Device:"")}getCommentContent(t){let e=t.getFormulaName(),r=JSON.parse(JSON.stringify(t.attrKeyValue||{}));return e||(r.Value?r.Value:r["Manufacturer Part"]?r["Manufacturer Part"]:r.Device?r.Device:"")}getStaticValues(t,e,r,i,n,s){let a=Ze.getInstance().getLayer(t.layerId),l=R.getInstance().origin,c=t.getPads(),h=r==="mirrorCoordinateX"&&2==t.layerId?-1:1,u=r==="mirrorCoordinateY"&&2==t.layerId?-1:1,d;if(c.length>0){let D=new _e;c.forEach(F=>{D.ext2(F.center)}),d=D.build1().center().sub(l)}else d=t.position.sub(l);let p=this.toFixJoin((d.x+i.x)*h,e,s),m=this.toFixJoin((d.y+i.y)*u,e,s),g=t.position.sub(l),y=this.toFixJoin((g.x+i.x)*h,e,s),b=this.toFixJoin((g.y+i.y)*u,e,s),P;if(c.length>0){let D={};c.forEach(F=>D[F.num]=F);let w=D[1];if(w==null){let F=Object.keys(D);F.sort(),w=D[F[0]]}w&&(P=w.center.sub(l))}P||(P=t.position.sub(l));let T=this.toFixJoin((P.x+i.x)*h,e,s),I=this.toFixJoin((P.y+i.y)*u,e,s),C=a.name[0],E=ve(t.rotation/Math.PI*180,3);n&&vv(t.layerId)&&(E=(180-E)%360),E=E>=0?E:360+E;let _=!c.some(D=>ar(D.layerId))?"Yes":"No",x=c.length;return{"Mid X":p,"Mid Y":m,"Ref X":y,"Ref Y":b,"Pad X":T,"Pad Y":I,Layer:C,Rotation:E,SMD:_,Pins:x}}getPanelMarkValues(t,e,r,i,n){let s=Ze.getInstance().getLayer(e.layerId),a=R.getInstance().origin,l=i==="mirrorCoordinateX"&&2==s.layerId?-1:1,c=i==="mirrorCoordinateY"&&2==s.layerId?-1:1,h=e.center.sub(a),u=this.toFixJoin(h.x*l,r,n),d=this.toFixJoin(h.y*c,r,n),p=`Mark${t}`,m="Fiducial Marks",g=s.name[0];return{Designator:p,Device:m,Footprint:m,Name:m,"Mid X":u,"Mid Y":d,"Ref X":u,"Ref Y":d,"Pad X":u,"Pad Y":d,Pins:1,Layer:g,Rotation:0,SMD:"Yes"}}toFixJoin(t,e,r=!1){let i=R.getInstance().unit;return e==="mil"?i="mil":e==="mm"&&(i="mm"),je(t,null,i)+(r?"":i)}};var Wu=class{constructor(t,e){this.value=t,this.isBold=e}toJSON(){return{value:this.value,isBold:this.isBold}}},v2=class{constructor(t,e){this.title=t,this.content=e}toJSON(){return{title:this.title.toJSON(),content:this.content.toJSON()}}},RR=class{constructor(){this.result=new Array;this.info={};this.result.push(this.getBoardInfo()),this.result.push(this.getPCBInfo()),this.result.push(this.getOtherInfo())}getBoardInfo(){let t=0,e=0,r=Au();if(r.length>0){let c=new _e;if(r.forEach(h=>{let u=h.getMathGraphics();c.ext1(u.bbox())}),c.valid()){let h=c.build1();t=h.width(),e=h.height()}}let i=`${je(t)}${R.getInstance().unit} x ${je(e)}${R.getInstance().unit}`,n=Ze.getInstance().getAllItem(),s=0,a=0;n.forEach(c=>{c.config&&12!=c.layerId&&47!=c.layerId&&(s++,(ns(c.type)||mu(c.type))&&a++)});let l=new Array;return l.push(new v2(new Wu("Borard Size",!1),new Wu(i,!1))),l.push(new v2(new Wu("Layers",!1),new Wu(`Total ${s}, Copper ${a}`,!1))),this.info.BoardSize=i,this.info.TotalLayers=s,this.info.TotalCoppers=a,l}getPCBInfo(){let t=new Array,e=new Set,r=new Set,i=Ar.getAllItem(),n=i.length,s=0,a=0;i.forEach(v=>{ao(v.layerId)?s++:a++,e.add(v.device),r.add(v.footprintId)});let l=Qt.getAllItem(),c=l.length,h=0,u=0,d=0,p=0;l.forEach(v=>{ar(v.layerId)?v.plated?d++:p++:ao(v.layerId)?h++:vv(v.layerId)&&u++});let g=Ye.getAllNets().length,b=Wo.getAllNets().length;t.push(new v2(new Wu("Devices",!1),new Wu(`${e.size}`,!1))),t.push(new v2(new Wu("Footprints",!1),new Wu(`${r.size}`,!1))),t.push(new v2(new Wu("Components",!1),new Wu(`Total ${n},top ${s},Bottom ${a}`,!1))),t.push(new v2(new Wu("Pads",!1),new Wu(`Total ${c}, TopSurface ${h},BotSurface ${u},Plated Through-hole ${d}, Nono Plated Through-role ${p}`,!1))),t.push(new v2(new Wu("Nets",!1),new Wu(`Total ${g}, Unrouted ${b}`,!1))),this.info.Devices=e.size,this.info.Footprints=r.size,this.info.TotalComponents=n,this.info.TopComponents=s,this.info.BottomComponents=a,this.info.TotalPads=c,this.info.TopSurface=h,this.info.BotSurface=u,this.info.Plated=d,this.info.nonoPlated=p,this.info.netTotal=g,this.info.unrouted=b;let P=Qt.getAllTestPad(),T=0,I=0,C=P.length,E=0,O=0,_=[],x=new Set;return P.forEach(v=>{let{net:D,layerId:w}=v;D&&x.add(D),w==1?E++:w==2?O++:_.push(v)}),E+=_.length,O+=_.length,T=x.size,I=g?Math.round(T/g*1e4)/100:0,t.push(new v2(new Wu("Test Point",!1),new Wu(`All Nets ${g},Has Testpoint Nets ${T},Testpoint Coverage ${I}%`,!1))),t.push(new v2(new Wu("",!1),new Wu(`Total ${C},Top Side Testpoints ${E},Bottom Side Testpoints ${O}`,!1))),this.info.hasNet=T,this.info.testPointCoverage=I,this.info.total=C,this.info.topPoint=E,this.info.bottomPoint=O,t}getOtherInfo(){let t=pt.getAllItem(),e=Xt.getAllItem(),r=Kt.getAllItem(),i=0,n=0;t.forEach(p=>{p.type=="Slot Region"?i++:p.type=="Copper Region"&&n++}),e.forEach(p=>{p.type=="Slot Region"?i++:p.type=="Copper Region"&&n++}),r.forEach(p=>{p.type=="Slot Region"?i++:p.type=="Copper Region"&&n++});let s=Wr.getAllItem(),a=s.length,l=0,c=0;s.forEach(p=>{p.type==1?c++:l++});let h=pr.getAllItem(),u=0;h.forEach(p=>{u+=p.length});let d=new Array;return d.push(new v2(new Wu("Slot Region",!1),new Wu(`${i}`,!1))),d.push(new v2(new Wu("Vias",!1),new Wu(`Total ${a}, Through Vias ${l}, Blind Or Buried Vais ${c}`,!1))),d.push(new v2(new Wu("CopperAreas",!1),new Wu(`${n}`,!1))),d.push(new v2(new Wu("Length of Tracks",!1),new Wu(`${je(u)}${R.getInstance().unit}`,!1))),this.info.slot=i,this.info.totalVias=a,this.info.ThroughVias=l,this.info.blindTotal=c,this.info.copper=n,this.info.TrackLength=`${je(u)}${R.getInstance().unit}`,d}toJSON(){return{lists:this.result,info:this.info}}};var f6=class f6{constructor(){this.outlineWarn=null;this.slotWarn=null}static getInstance(){return f6.dialog==null&&(f6.dialog=new f6),f6.dialog}addOutlineWarn(t){this.outlineWarn==null&&(this.outlineWarn=t)}addSlotWarn(t){this.slotWarn==null&&(this.slotWarn=t)}open(){this.outlineWarn!=null&&(A.publish("openMsgbox",this.outlineWarn),this.outlineWarn=null),this.slotWarn!=null&&(A.publish("openMsgbox",this.slotWarn),this.slotWarn=null)}};f6.dialog=null;var Poe=f6;var Toe=class{constructor(t){this.shape=new Array;this.info=t,this.color=this.getColor(t.num),this.getShape()}getColor(t){let e=ee.WHITE;switch(t){case 0:e=ee.WHITE;break;case 1:e=ee.BLACK;break;case 2:e=ee.RED;break;case 3:e=ee.GREEN;break;case 4:e=ee.BLUE;break;case 5:e=ee.Gray;break}return e}getShape(){if(this.info.type=="Line"){let t=this.info.path,e=new cr(1002,new S(t[0],t[1]),new S(t[2],t[3]),!0,this.color);this.shape.push(e)}else if(this.info.type=="Arc"){let t=this.info.path,e=gs.build(1002,new S(t[0],t[1]),t[2],t[3],t[4],t[5],this.color);this.shape.push(e)}else(this.info.path[0]instanceof Array?Jh(this.info.path):[m2(this.info.path)]).forEach(e=>this.printPolygline(e,this.color))}printPolygline(t,e){let r=kBe(t);for(let i=0,n=r.length;i<n-1;i++){let s=r[i],a=r[i+1],l=new cr(1002,s,a,!0,e);this.shape.push(l)}}hidden(){for(let t of this.shape)t.hidden()}show(){for(let t of this.shape)t.visible()}};var Ioe=class extends nj{constructor(){super();this.shapes=new Array;this.getVias(this.shapes),this.getTracks(this.shapes),this.getTexts(this.shapes),this.getImages(this.shapes),this.getPads(this.shapes),this.getProfiles(this.shapes),this.getCopper(this.shapes),this.getPlane(this.shapes)}getPlane(e){zn.getAllItem().forEach(i=>{let n={PlaneResult:{id:i.globalIndex,net:i.net,layer:this.getLayer(i.layerId),outlines:i.copperPath}};e.push(n)})}getCopper(e){Ti.getAllItem().forEach(i=>{let n={PcbCopper:{id:i.globalIndex,net:i.net,layer:this.getLayer(i.layerId),method:this.getMethod4Copper(i),outlines:i.copperPath}};e.push(n)})}getLayer(e){let r=Pe.getLayer(e),i=0;switch(r.type){case"SIGNAL":case"PLANE":i=O2(e);break;case"MECHANICAL":case"PLANE":i=1;break;default:i=0;break}return new Cie(r.type,i)}getVias(e){Wr.getAllItem().forEach(i=>{let n=i.getParent()!=null;if(i.type==1){let s={PcbBlindVia:{id:i.globalIndex,net:i.net,center:i.center,holeDiameter:i.holeRadius*2,startLayer:this.getLayer(i.startLayer),startLayerPad:i.radius*2,innerPad:i.radius*2,endLayer:this.getLayer(i.endLayer),endLayerPad:i.radius*2,mask:!1,locked:i.locked||n,unuseLayers:this.getUnuseLayers(i.unusedInnerLayers)}};e.push(s)}else{let s={PcbVia:{id:i.globalIndex,net:i.net,center:i.center,holeDiameter:i.holeRadius*2,topPad:i.radius*2,innerPad:i.radius*2,botPad:i.radius*2,mask:!1,locked:i.locked||n,unuseLayers:this.getUnuseLayers(i.unusedInnerLayers)}};e.push(s)}})}getTracks(e){pr.getAllItem().forEach(i=>{if(i instanceof yi){let n=q.build2(i.center,i.startAngle/Math.PI*180,i.endAngle/Math.PI*180,i.radius,i.radius,i.sweep),s={PcbarcTrack:{net:i.net,layer:this.getLayer(i.layerId),arc:n,width:i.width,id:i.globalIndex,locked:i.locked}};e.push(s)}else{let n={PcbTrack:{net:i.net,layer:this.getLayer(i.layerId),start:i.start,end:i.end,width:i.width,id:i.globalIndex,locked:i.locked}};e.push(n)}})}checkLayer(e){let r=Pe.getLayer(e);return!!(ar(e)||r.isSignalLayer()||r.isPlaneLayer()||e==11)}getTexts(e){ri.getAllItem().forEach(i=>{let n=i.model.box;if(!this.checkLayer(i.layerId)||!n||n.height==0||n.width==0)return;let s={PcbboxShape:{layer:this.getLayer(i.layerId),leftLow:n.leftLow,leftUp:n.leftUp,rightLow:n.rightLow,rightUp:n.rightUp,id:i.globalIndex}};e.push(s)})}getImages(e){Bn.getAllItem().forEach(i=>{if(!this.checkLayer(i.layerId))return;let n=i.model.box,s={PcbboxShape:{layer:this.getLayer(i.layerId),leftLow:n.leftLow,leftUp:n.leftUp,rightLow:n.rightLow,rightUp:n.rightUp,id:i.globalIndex}};e.push(s)})}getPads(e){Qt.getAllItem().forEach(i=>{if(i instanceof _i){if(ar(i.layerId)){let n=this.getShape(i.topType,i.topWidth,i.topHeight,i.topRatio,null),s=this.getShape(i.innerType,i.innerWidth,i.innerHeight,i.innerRatio,null),a=this.getShape(i.bottomType,i.bottomWidth,i.bottomHeight,i.bottomRatio,null),l=this.getHoleShape(i),c={PcbPad:{id:i.globalIndex,net:i.net,layer:this.getLayer(i.layerId),center:i.center,rotation:i.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.getLayer(i.layerId),top:n,inner:s,bot:a}},hole:l,pasteMaskEx:i.pasteExpansion,topSolderMaskEx:i.topSolderExpansion,bottomSolderMaskEx:i.bottomSolderExpansion,designator:"",plated:i.plated,padRule:i.toPadRuleJson(),unuseLayers:this.getUnuseLayers(i.unusedInnerLayers)}};e.push(c)}else if(ao(i.layerId)){let n=this.getShape(i.topType,i.topWidth,i.topHeight,i.topRatio,null),s={PadHole:{type:0,size:0,length:0,rotation:i.rotation/Math.PI*180,offsetX:0,offsetY:0}},a={PcbPad:{id:i.globalIndex,net:i.net,layer:this.getLayer(i.layerId),center:i.center,rotation:i.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.getLayer(i.layerId),top:n,inner:null,bot:null}},hole:s,pasteMaskEx:i.pasteExpansion,topSolderMaskEx:i.topSolderExpansion,bottomSolderMaskEx:i.bottomSolderExpansion,designator:"",plated:i.plated,padRule:i.toPadRuleJson(),unuseLayers:this.getUnuseLayers(i.unusedInnerLayers)}};e.push(a)}else if(2==i.layerId){let n=this.getShape(i.bottomType,i.bottomWidth,i.bottomHeight,i.bottomRatio,null),s={PadHole:{type:0,size:0,length:0,rotation:i.rotation/Math.PI*180,offsetX:0,offsetY:0}},a={PcbPad:{id:i.globalIndex,net:i.net,layer:this.getLayer(i.layerId),center:i.center,rotation:i.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.getLayer(i.layerId),top:null,inner:null,bot:n}},hole:s,pasteMaskEx:i.pasteExpansion,topSolderMaskEx:i.topSolderExpansion,bottomSolderMaskEx:i.bottomSolderExpansion,designator:"",plated:i.plated,padRule:i.toPadRuleJson(),unuseLayers:this.getUnuseLayers(i.unusedInnerLayers)}};e.push(a)}}else if(i instanceof sn){if(ar(i.layerId)){let n=this.getShape("POLYGON",0,0,0,i.primitives),s=this.getShape("POLYGON",0,0,0,i.primitives),a=this.getShape("POLYGON",0,0,0,i.primitives),l=this.getHoleShape(i),c={PcbPad:{id:i.globalIndex,net:i.net,layer:this.getLayer(i.layerId),center:i.center,rotation:i.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.getLayer(i.layerId),top:n,inner:s,bot:a}},hole:l,pasteMaskEx:i.pasteExpansion,topSolderMaskEx:i.topSolderExpansion,bottomSolderMaskEx:i.bottomSolderExpansion,designator:"",plated:i.plated,padRule:i.toPadRuleJson(),unuseLayers:this.getUnuseLayers(i.unusedInnerLayers)}};e.push(c)}else if(ao(i.layerId)){let n=this.getShape("POLYGON",0,0,0,i.primitives),s={PadHole:{type:0,size:0,length:0,rotation:i.rotation/Math.PI*180,offsetX:0,offsetY:0}},a={PcbPad:{id:i.globalIndex,net:i.net,layer:this.getLayer(i.layerId),center:i.center,rotation:i.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.getLayer(i.layerId),top:n,inner:null,bot:null}},hole:s,pasteMaskEx:i.pasteExpansion,topSolderMaskEx:i.topSolderExpansion,bottomSolderMaskEx:i.bottomSolderExpansion,designator:"",plated:i.plated,padRule:i.toPadRuleJson(),unuseLayers:this.getUnuseLayers(i.unusedInnerLayers)}};e.push(a)}else if(2==i.layerId){let n=this.getShape("POLYGON",0,0,0,i.primitives),s={PadHole:{type:0,size:0,length:0,rotation:i.rotation/Math.PI*180,offsetX:0,offsetY:0}},a={PcbPad:{id:i.globalIndex,net:i.net,layer:this.getLayer(i.layerId),center:i.center,rotation:i.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.getLayer(i.layerId),top:null,inner:null,bot:n}},hole:s,pasteMaskEx:i.pasteExpansion,topSolderMaskEx:i.topSolderExpansion,bottomSolderMaskEx:i.bottomSolderExpansion,designator:"",plated:i.plated,padRule:i.toPadRuleJson(),unuseLayers:this.getUnuseLayers(i.unusedInnerLayers)}};e.push(a)}}})}getUnuseLayers(e){let r=new Array;for(let i of e){let n=this.getLayer(i);r.push(n)}return r}getProfiles(e){Kt.getAllItem().forEach(s=>{if(!this.checkLayer(s.layerId))return;let a=s.getComponent(),l=this.getProfileShape(s.globalIndex,s.type,s.net,s.layerId,0,s.getMathGraphics(s.layerId,0),s.strokeWidth,a,a);e.push(l)}),Xt.getAllItem().forEach(s=>{if(!this.checkLayer(s.layerId))return;let a=s.getComponent(),l=this.getProfileShape(s.globalIndex,s.type,s.net,s.layerId,1,s.getMathGraphics(s.layerId,0),s.strokeWidth,a,a);e.push(l)}),pt.getAllItem().forEach(s=>{if(!this.checkLayer(s.layerId))return;let a=s.getComponent(),l=this.getProfileShape(s.globalIndex,s.type,s.net,s.layerId,2,s.getMathGraphics(s.layerId,0),s.strokeWidth,a,a,a);e.push(l)})}getOutline(){let e=new Array;return Kt.getAllItem().forEach(s=>{s.type=="Board Outline"&&e.push(s)}),Xt.getAllItem().forEach(s=>{s.type=="Board Outline"&&e.push(s)}),pt.getAllItem().forEach(s=>{s.type=="Board Outline"&&e.push(s)}),e}getPlaneZone(e,r){let i=new Array;e?i=Pe.getAllPlaneLayer():r.forEach(s=>{let a=Pe.getLayer(s);i.push(a)});let n=this.getOutline();i.forEach(s=>{let a=zn.layerMapSet[s.layerID];a!=null&&a.size>0?a.forEach(l=>{let c=re.getInstance().getInnerPlaneByNet(l.net),h=l.getOutline();Er(h,(d,p)=>p.bbox().area()-d.bbox().area(),0,h.length);let u={PcbPlaneZone:{net:l.net,layer:this.getLayer(l.layerId),thermal:c.getMultiConnectMode(l.layerId)!=1,outline:lh(h[0]),coppered:[]}};this.shapes.push(u)}):n.forEach(l=>{let c="GND",h=re.getInstance().getInnerPlaneByNet(c),u={PcbPlaneZone:{net:c,layer:this.getLayer(s.layerID),thermal:h.getMultiConnectMode(s.layerID)!=1,outline:lh(l.getMathGraphics(12,0)),coppered:[]}};this.shapes.push(u)})})}getShape(e,r,i,n,s){let a;switch(e){case"ELLIPSE":a={PadShape:{type:0,xSize:r,ySize:i,cornerRadius:n*100,outline:null}};break;case"OVAL":a={PadShape:{type:3,xSize:r,ySize:i,cornerRadius:n*100,outline:null}};break;case"RECT":a={PadShape:{type:1,xSize:r,ySize:i,cornerRadius:n*100,outline:null}};break;case"POLYGON":a={PadShape:{type:4,xSize:r,ySize:i,cornerRadius:0,outline:I0([ge.build2(s)])}}}return a}getHoleShape(e){return e.holeShape=="ROUND"?{PadHole:{type:0,size:e.holeRadius*2,length:e.holeLength,rotation:e.holeRotation/Math.PI*180,offsetX:e.holeOffset.x,offsetY:e.holeOffset.y}}:{PadHole:{type:2,size:e.holeRadius*2,length:e.holeLength,rotation:e.holeRotation/Math.PI*180,offsetX:e.holeOffset.x,offsetY:e.holeOffset.y}}}getProfileShape(e,r,i,n,s,a,l,c,h,u){switch(r){case"Line":return n==11?{PcbBoardOutline:{id:e,type:s,outlines:lh(a)}}:{PcbLine:{id:e,net:i,layer:this.getLayer(n),type:s,width:l,outlines:lh(a)}};case"Copper Region":let d=re.getInstance().getCopperPlaneByNet(i),p=re.getInstance().getRegion(e);p!=null?d=re.getInstance().getCopperPlane(p.copperPlane):d==null&&(d=re.getInstance().getDefaultCopperPlane());let m=un.getOrder(e);return{PcbPolygonPour:{id:e,net:i,layer:this.getLayer(n),method:this.getMethod(c),thermal:d.getSingleConnectMode(n)!=1,keepIsland:c.keepIsland,pourIndex:m,needCopper:!0,outlines:lh(a),coppered:[],name:c.name}};case"Prohibited Region":return{PcbProhibit:{id:e,layer:this.getLayer(n),type:s,copper:h.copper,track:h.track,device:h.device,plane:h.planzone,region:h.fill,outlines:lh(a)}};case"Fill Region":return{PcbRegion:{id:e,net:i,layer:this.getLayer(n),type:s,outlines:lh(a)}};case"Board Outline":return{PcbBoardOutline:{id:e,type:s,outlines:lh(a)}};case"Slot Region":return{PcbSlot:{id:e,type:s,outlines:lh(a)}};case"TearDrop":return{PcbTearDrop:{id:e,net:i,layer:this.getLayer(n),outline:lh(a),connect:u.connects}}}}getMethod(e){switch(e.style){case"90grid":return{HatchedPourMethod:{gridWidth:e.gridLineWidth,gridClearance:e.clearance,angle:90}};case"45grid":return{HatchedPourMethod:{gridWidth:e.gridLineWidth,gridClearance:e.clearance,angle:45}};case"solid":return e.optimization?{SolidPourMethod:{neckThickness:.8}}:{SolidPourMethod:{neckThickness:0}};default:return{SolidPourMethod:{neckThickness:0}}}}getMethod4Copper(e){switch(e.style){case"90grid":return{HatchedPourMethod:{gridWidth:e.gridLineWidth,gridClearance:e.clearance,angle:90}};case"45grid":return{HatchedPourMethod:{gridWidth:e.gridLineWidth,gridClearance:e.clearance,angle:45}};case"solid":return e.optimization?{SolidPourMethod:{neckThickness:.8}}:{SolidPourMethod:{neckThickness:0}};default:return{SolidPourMethod:{neckThickness:0}}}}};var U3=ka.getInstance(),Hj=$i.getInstance(),P1=class{constructor(t=!1){this.checkSameNet=t}isSameComponentChild(t,e){let r=t.getParent(),i=e.getParent();return r instanceof Bi&&i instanceof Bi&&r.globalIndex===i.globalIndex}getClearance(t,e,r=3){let i=ay(t.layerId,e.layerId);if(i!==12||r==2)return Hj.ruleHelper.getShape2Clearance(t,e,void 0,r,i).clearance;{let n=h=>h.getItemMaxClearance(s.shapeType,[a.shapeType]),s=Hj.ruleHelper.getRuleItem(t,r==0),a=Hj.ruleHelper.getRuleItem(e,r==1),l=Hj.ruleHelper.generateConstraints("safe",s,a,void 0,void 0,n);return Hj.ruleHelper.getSafeRuleInfos(s,a,l,void 0,n).clearance}}commonCheck(t,e,r){if(r==3||e===t||this.isSameComponentChild(t,e))return!1;let i=(s,a)=>{if(s instanceof Bi)return a instanceof et,!0};if(i(t,e)||i(e,t)||!this.dispatchCheck(t,e,r))return!1;if((ei.isBoardOutline(t)||ei.isBoardOutline(e))&&t.bbox.intersection1(e.bbox))return!0;let n=this.getClearance(t,e,r);return!(n<0||!t.bbox.extendOfSize(n).intersection1(e.bbox))}isOpenDRCCustomCheck(){return U3.isOpenDRCCustomCheck}checkHole(t,e,r){if(!U3.isOpenDRCCustomCheck||!this.commonCheck(t,e,r))return!1;if(r==2&&U3.isCheck(U3.distanceHole.hole))return!0;if(r==0&&ei.isBoardOutline(e)){if(U3.isCheck(U3.distanceHole.outline))return!0}else if(r==1&&ei.isBoardOutline(t)){if(U3.isCheck(U3.distanceHole.outline))return!0}else if(r!==2&&U3.isCheckHoleDistance(t,e,r))return!0;return!1}check(t,e,r){return e===t?!1:r?!0:!(!U3.isCheckDistance(t,e)||!this.dispatchCheck(t,e))}dispatchCheck(t,e,r){if(t instanceof Bi||e instanceof Bi)return e instanceof Bi&&([e,t]=[t,e]),this.checkComponentXXX(t,e);if(ei.isProhibit(t)||ei.isProhibit(e))return ei.isProhibit(e)&&([e,t]=[t,e]),this.checkProhibitXXX(t,e);if(ei.isBoardOutline(t)||ei.isBoardOutline(e))return ei.isBoardOutline(e)&&([e,t]=[t,e]),this.checkOutlineXXX(t,e);let i=ei.isBridgingCopper(t),n=ei.isBridgingCopper(e);return i||n?(n&&([e,t]=[t,e]),this.checkBridgingCopperXXX(t,e,i==n)):ei.isSingleLayerShape(t)&&ei.isSingleLayerShape(e)?this.checkSingleSingle(t,e):!ei.isSingleLayerShape(t)&&!ei.isSingleLayerShape(e)?this.checkMultiMulti(t,e,r):(ei.isSingleLayerShape(e)&&([e,t]=[t,e]),this.checkSingleMulti(t,e))}checkComponentXXX(t,e){if(e instanceof Bi)return!0;if(ei.isProhibit(e)&&e.getParent()!==t)return this.checkProhibitXXX(e,t);if(e instanceof et){let r=ei.isSmdComponent(t),i=e.getParent();return i instanceof Bi?r&&sg(i.layerId)===t.layerId:r&&ar(e.layerId)}return!1}checkOutlineXXX(t,e){return!this.isPlaneSingle(e)}checkBridgingCopperXXX(t,e,r){var s,a;let i=((s=t.component)==null?void 0:s.networkList)||[],n=r?((a=e.component)==null?void 0:a.networkList)||[]:ei.hasNet(e)?e.net:null;return r?i.length===0&&n.length===0?!1:i.length===1&&n.length===1?i[0]!==n[0]:!0:n==null?!0:i.length<=1?i.length===0?n!=="":i[0]!==n:!ei.hasIntersectionNet(i,n,this.checkSameNet)}checkProhibitXXX(t,e){let r=t.component;return!!((t.layerId===e.layerId||t.layerId===12)&&(r.track&&e instanceof gt||r.fill&&ei.isFill(e)||r.device&&e instanceof Bi||r.copper&&e instanceof hn||r.planzone&&e instanceof yn))}checkSingleSingle(t,e){return this.isPlaneSingle(t)||this.isPlaneSingle(e)||t.layerId!==e.layerId?!1:this.checkSameNet?!0:!this.isSameNet(t,e)}checkSingleMulti(t,e){return this.isPlaneSingle(t)?!1:this.checkSameNet?!0:!this.isSameNet(t,e)}checkMultiMulti(t,e,r){return t instanceof Ct&&e instanceof Ct&&t.type==1&&e.type==1&&!t.isContains(e.startLayer)&&!t.isContains(e.endLayer)&&!e.isContains(t.startLayer)&&!e.isContains(t.endLayer)?!1:r!==void 0&&r==2||this.checkSameNet?!0:!this.isSameNet(t,e)}isSameNet(t,e){return ei.hasNet(t)&&ei.hasNet(e)?t.net===e.net:!1}isPlaneSingle(t){return t instanceof jl?!1:ei.isUnuseLayer(t.layerId)||ei.isSingleLayerShape(t)&&ei.isPlaneLayer(t.layerId)}};var Coe=class{constructor(t){this.tool=new Jt;this.count=0;this.errs=new Set;this.filter=new P1;let e=t.copper,r=t.plane,i=t.safe;e.forEach(n=>{this.parseCopper(n.id1,n.id2,n.pl1,n.pl2,n.relation,n.distance,n.line,n.pt1,n.pt2)}),r.forEach(n=>{this.parsePlane(n.id1,n.id2,n.pl1,n.pl2,n.relation,n.distance,n.line,n.pt1,n.pt2)}),i.forEach(n=>{this.parseSafe(n.id1,n.id2,n.pl1,n.pl2,n.relation,n.distance,n.line,n.pt1,n.pt2)})}parseSafe(t,e,r,i,n,s,a,l,c){let h=this.tool.getItem(t),u=this.tool.getItem(e),d=h.model,p=u.model;if(DR.isCheck(DR.diff.minGap)&&this.isCheckDiffPair(h,u,s,a)||!DR.isCheckDistance(h.model,u.model)||!(d instanceof xi&&p instanceof xi))return;let g=ha(d),y=ha(p),b=re.getInstance().getSafeRule(g,y),P=ve(b.getClearance(g.shapeType,y.shapeType),2);if(!ne.eq(P,0)&&(this.isProhibit(h)||this.isProhibit(u)?P=0:s=ve(s,2),s==0||s<P)){let I=m2(a).primitives[0],C=I.start().add(I.end()).mul(.5);this.createError(h,u,C,s,P,b.name)}}isCheckDiffPair(t,e,r,i){let n=t.model,s=e.model;if(!(n instanceof xi&&s instanceof xi))return;let a=ha(n),l=ha(s);return re.getInstance().getRule4Order(a,l,"BetweenNetRule",0).length>0,!1}parseCopper(t,e,r,i,n,s,a,l,c){}parsePlane(t,e,r,i,n,s,a,l,c){}isProhibit(t){return t instanceof He&&t.type=="Prohibited Region"}createError(t,e,r,i,n,s){this.count++,i=i>0?i:0,Bo.getClearanceError(t.globalIndex,e.globalIndex)}createDiffError(t,e,r,i,n,s){this.count++,i=i>0?i:0,Bo.getDiffPairGapError(t.globalIndex,e.globalIndex)}};var AF=class extends c8{parse(t,e){if(e==null||e=="")return;let r=e.split(`
`);JSON.parse(r.find(n=>{if(JSON.parse(n)[0]==="DOCTYPE")return!0}))[2]>"1.0"?this.addCopperResults(r):this.addCopperResult(t,r)}addCopperResults(t){let e={};for(let r of t){let i=r?JSON.parse(r):[];if(i[0]=="POURED"){let n=i[2];e[n]||(e[n]=[]),i.splice(2,1);let s=JSON.stringify(i);e[n].push(s)}}for(let r in e)this.addCopperResult(r,e[r])}};var z3t=1024*1024*10,_F=class extends AF{getAllPourResult(){let t="getPourResultData-time";Cn(t);let e=[],r=[];return pt.getAllItem().forEach(i=>r.push(i)),Xt.getAllItem().forEach(i=>r.push(i)),Kt.getAllItem().forEach(i=>r.push(i)),this.addResult(r,e),Xi(t),e}getCombinationPourResult(t){let e=[],r=[];for(let i of t)i instanceof He&&r.push(i);return this.addResult(r,e),e}addResult(t,e){let r='["DOCTYPE", "POURED", "1.1"]';t.forEach(i=>{if(i.type=="Copper Region"){let n=this.getPourResult(i);if(n!=null&&n.length>0&&(r&&(r+=`
`),r+=n,r.length>z3t))return e.push(r),r='["DOCTYPE", "POURED", "1.1"]',!0}}),r.length>0&&e.push(r)}getPourResult(t){let e=t.getComponent(),r="";if(e!=null&&e instanceof xn&&t.hasCopperRes()){let i=t.getCopperResult(),n=i.size,s=0;for(let a of i)r+=JSON.stringify(this.save(a,t.globalIndex)),s!=n&&(r+=`
`),s++}return r}save(t,e){let r=new Array;return r.push("POURED"),r.push(t.globalIndex),r.push(e),t.style=="90grid"||t.style=="45grid"?(r.push(t.gridLineWidth),r.push(!1)):(r.push(0),r.push(!0)),r.push(t.copperPath),r}addCopperResult(t,e){let r=this.getProfile(t);if(r==null||r.type!="Copper Region")return;let n=r.getComponent();if(n instanceof xn){let s=n.style,a=n.clearance,l=n.gridLineWidth,c=n.optimization,h=n.optimizationValue;e.forEach(u=>{let d=JSON.parse(u);if(d[0]=="POURED"){let p=s;if(p=="solid"&&d[2]!=0&&(p="90grid"),(p=="90grid"||p=="45grid")&&d[2]!=0&&(l=d[2]),n.copperResult.push(d[4]),Ti.getItem(d[1])!=null)return;let m=Ti.rebuildCopper(d[1],r.layerId,r.net,p,l,a,c,d[4],h);m.fill(),r.addCopperResult(m),r.model.addCopper(m.globalIndex),m.setParent(r),A.publish("hasModifyPcbItem",m)}})}}getProfile(t){let e=pt.getItem(t);if(e!=null)return e;let r=Xt.getItem(t);if(r!=null)return r;let i=Kt.getItem(t);return i!=null?i:null}};function oGe(){let o=pt.getAllItem(),t=Xt.getAllItem(),e=Kt.getAllItem(),r=0,i=0,n=0;function s(a){switch(a){case"3D Shell - Top Slot Region":case"3D Shell - Side Slot Region":{r++;break}case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":{i++;break}case"3D Shell - Screw Pillar":{n++;break}}}for(let a of o)s(a.type);for(let a of t)s(a.type);for(let a of e)s(a.type);return{d3SlotNum:r,d3EntityNum:i,d3DcrewNum:n}}function wR(o,t,e){if(o&&o.type=="Fill Region"&&e){let r=o.getComponent();if(!(r instanceof Zi)||!r.isBridgingCopper)return;if(r.networkList.includes(t)){A.windowBridge.publish("ui/toastMsg",{type:"error",msg:{value:"{net} net has been selected, please select another bridge net",options:{net:t}}},Q());return}r.networkList[e]?r.networkList[e]=t:r.networkList.push(t),A.publish("hasModifyPcbItem",o)}}function OA(o){if(o.length===0)return!1;let t=[];for(let r of o){if(!(r instanceof He)||r.type!=="Fill Region"||!r.getComponent().isBridgingCopper)return!1;t.push(r)}let e=t[0].getComponent().networkList;for(let r of t){let i=r.getComponent();if(!yee(e,i.networkList,!0))return!1}return!0}var Gy=class o{constructor(t,e,r,i){this.pts1=t,this.pts2=e,this.plgrp1=r,this.plgrp2=i}static build2(t,e){let r=new Array,i=new Array;for(let a of t.primitives)r.push(a);for(let a of e.primitives)i.push(a);let n=new Bt([t]),s=new Bt([e]);return new o(r,i,n,s)}static build3(t,e){let r=new Array,i=new Array;t.forEach(a=>{for(let l of a.primitives)r.push(l)}),e.forEach(a=>{for(let l of a.primitives)i.push(l)});let n=new Bt(t),s=new Bt(e);return new o(r,i,n,s)}intersection(){return n3.isIntersect(this.plgrp1,this.plgrp2)}inInner(){if(n3.isIntersect(this.plgrp1,this.plgrp2)&&(this.isClose(this.pts1)||this.isClose(this.pts2))){for(let e of this.pts1)for(let r of this.pts2)if(Pt(e,r)>0)return!1;return!0}else return!1}isClose(t){return!!(t.length>0&&t[0].start().equals1(t[t.length-1].end()))}hasInterEdge(){for(let t of this.pts1)for(let e of this.pts2)if(Pt(t,e)>0)return!0;return!1}};var Wj=Ru(r2());var Y3t=typeof window>"u"||window["META-PANELIZE-ENV"]?!1:/\bpcbBoolDebug\b/.test(Q().location.search),lSe;Y3t&&(typeof window<"u"?lSe=window._MSG_BUS_=window._MSG_BUS_||new Wj.MessageBus:lSe=new Wj.WorkerMessageBridge(new Wj.MessageBus,self));var Ec=class{getUnionForSingle(t,e=[]){let r=t.map(i=>new Bt(i));return r.length<=1?r:this.runBoolean(Cl.UNION,t,e)}getUnion(t,e=0){return t.length<=0?[new Bt(t)]:this.normalizeData(t,e).toPolylineGroups()}getSubtraction(t,e,r=[0,0]){return this.runBoolean(Cl.DIFF,[t,e],r)}getSubtraction2(t,e,r=[[],[]]){return this.runBoolean2(Cl.DIFF,t,e,r)}getSubtractionForSingle(t,e=[]){return this.runBoolean(Cl.DIFF,t,e)}getIntersection(t,e,r=[0,0]){return this.runBoolean(Cl.INTERSECT,[t,e],r)}getIntersection2(t,e,r=[[],[]]){return this.runBoolean2(Cl.INTERSECT,t,e,r)}getIntersectionForSingle(t,e=[]){return this.runBoolean(Cl.INTERSECT,t,e)}getMutuallyExclusive(t,e,r=[0,0]){return this.runBoolean(Cl.XOR,[t,e],r)}getMutuallyExclusive2(t,e,r=[[],[]]){return this.runBoolean2(Cl.XOR,t,e,r)}getMutuallyExclusiveForSingle(t,e=[]){return this.runBoolean(Cl.XOR,t,e)}run(t){let e=kE(),r=hP(t,lSe);return Y2.runBoolean+=wT(e),r}runBoolean(t,e,r){let i=[t];return e.forEach((n,s)=>{var l;let a=this.normalizeData(n,(l=r[s])!=null?l:0);a&&i.push(a)}),this.run(i).toPolylineGroups()}runBoolean2(t,e,r,i){let n=[Cl.UNION],s=[Cl.UNION];e.forEach((l,c)=>{var u;let h=this.normalizeData(l,(u=i[0][c])!=null?u:0);h&&n.push(h)}),r.forEach((l,c)=>{var u;let h=this.normalizeData(l,(u=i[1][c])!=null?u:0);h&&s.push(h)});let a=[t,n,s];return this.run(a).toPolylineGroups()}normalizeData(t,e){if(!t.length)return null;if(e===2){let r=[bf(t[0])];if(!r[0])return null;r[0].area(.1)>0&&(r[0]=r[0].reverse());for(let i=1;i<t.length;i++){let n=bf(t[i]);n&&r.push(n.area(.1)>0?n:n.reverse())}return new Fo([new Zo(r)])}else if(e===1){let n=function(c,h,u){let d=r[c];for(let p=c+1,m=r.length;p<m;p++){let g=r[p];if(!g.isVisited){if(d.bbox().maxX<g.bbox().minX)break;if(l(d,g)){r[p].isVisited=!0;let y;u?(h.push(g),y=[]):y=[g],n(p,y,!u),y&&y.length&&i.push(y)}}}},l=function(c,h){if(!c.bbox().extendOfSize(.001).isContainsBBox(h.bbox()))return!1;let d=h.primitives[0].start();return!!c.getWindingNum(d)},r=t.sort((c,h)=>c.bbox().minX-h.bbox().minX),i=[];r.forEach((c,h)=>{if(c.isVisited)return;r[h].isVisited=!0;let u=[c];n(h,u,!0),u&&u.length&&i.push(u)});let s=[];i.forEach(c=>{let h=[bf(c[0])];if(h[0]){h[0].area(.1)>0&&(h[0]=h[0].reverse());for(let u=1;u<c.length;u++){let d=bf(c[u]);d&&(d.area(.1)<0&&(d=d.reverse()),h.push(d))}s.push(new Zo(h))}});let a=[Cl.UNION];return s.forEach(c=>a.push(c)),this.run(a)}else return e===3?this.run(this.gnrBooleanRules(t)):this.union(t)}union(t){let e=new MP(!1),r=new iI(Mz.rule,new Di(1),e);for(let n of t)r.addPolyline(n.asClose());r.simplify();let i=[];return e.plGrps.forEach(n=>{let s=[bf(n.items[0])];if(s[0]){for(let a=1;a<n.items.length;a++){let l=bf(n.items[a]);l&&s.push(l)}i.push(new Zo(s))}}),new Fo(i)}gnrBooleanRules(t){let e=[Cl.UNION],r=[Cl.UNION];for(let i of t){let n=C_(i),s=e.length,a=r.length;for(let l of n){if(l.primitives.length===0){console.error("ply.primitives.length === 0");continue}l.area(.1)>0?r.push(l.reverse()):e.push(l)}s!==e.length&&a!==r.length&&e.push([Cl.DIFF,[Cl.UNION,...e.splice(s)],[Cl.UNION,...r.splice(a)]])}return e.length===1?(console.warn("unionPls.length === 1"),e):r.length===1?e:[Cl.DIFF,e,r]}toOuterLine(t){return t.area(.1)>0?t.reverse():t}toInnerLine(t){return t.area(.1)<0?t.reverse():t}gnrBooleanDataList(t,e){let r=[];return t.forEach(i=>r.push(e)),r}};var j3t=.001,zj=class{constructor(){this.kit=new Rc(j3t);this.adsorp=null}getEnd(t,e,r){if(!this.checkCollide(t,e,r))return t.end();let i=t.end(),n=new As(ge.build2([t]),e,r);switch(n.relation){case 3:return n.distance>r?i:this.getInterEnd(t,e,r);case 0:return this.getInterEnd(t,e,r);case 1:case 2:return t.start()}}checkCollide(t,e,r){if(t instanceof M&&!t.isPoint()){let n=t.end().sub(t.start()).normalize().angle(S.ORIGIN),s=Qe.rotate(n),a=t.multiply3(s),l=e.multiply3(s),c=a.bbox().extendOfSize(1e-6),h=l.bbox().extendOfSize(r);return c.isIntersect(h)!=null}return!0}getInterEnd(t,e,r){let i=t.end();for(let n of e.primitives)n instanceof M?t instanceof M?(i=this.calcuLineLine(t,n,r),t=new M(t.start(),i)):(i=this.calcuLineArc(n,t,!1,r),t=q.build2(t.center,t.startAngle,i.angleD(t.center),t.rx,t.ry,t.sweep())):n instanceof q&&(t instanceof M?(i=this.calcuLineArc(t,n,!0,r),t=new M(t.start(),i)):(i=this.calcuArcArc(t,n,r),t=q.build2(t.center,t.startAngle,i.angleD(t.center),t.rx,t.ry,t.sweep())));return i}getNewPrimitive(t,e){return t instanceof M?new M(t.start(),e):q.build2(t.center,t.startAngle,e.angleD(t.center),t.rx,t.ry,t.sweep())}getPrimitive(t,e=!0){if(e){let r;return t instanceof Os?r=new M(t.start,t.end):r=q.build2(t.arc.center,t.arc.startAngle,t.arc.endAngle(),t.arc.rx,t.arc.rx,t.arc.sweep()),r}else{let r;if(t instanceof Os)r=new M(t.end,t.start);else{let i=t.arc.sweep()==ae.CCW?ae.CW:ae.CCW;r=q.build2(t.arc.center,t.arc.endAngle(),t.arc.startAngle,t.arc.rx,t.arc.rx,i)}return r}}isSameNet(t,e){return t===e}isSameLayer(t,e){return t===e}pointInPolyline(t,e){return e instanceof Bt?new Dc().inPolygon(t,e.items):new Dc().inPolyline(t,e)}calcuLineLine(t,e,r){let i=t.start(),n=t.end(),s=e.stroke(r*2,wr.ROUND,ae.CCW).asClose();if(this.pointInPolyline(i,s))return i;let l=new Set;for(let c of s.primitives){let h=Pt(t,c);if(h>0)for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);l.add(d)}}if(l.size>0){let c=n.distance1(i);l.forEach(h=>{let u=h.distance1(i);u<c&&(n=h,c=u)})}return n}calcuLineArc(t,e,r,i){if(r){let n=t.start(),s=t.end();if(i=i<1e-5?0:i,i==0)return t.start();let a=e.stroke(i*2,wr.ROUND,ae.CCW).asClose();if(new Dc().pointInPolyline(n,a))return n;let c=new Set;for(let h of a.primitives){let u=Pt(t,h);if(u>0)for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);c.add(p)}}if(c.size>0){let h=s.distance1(n);c.forEach(u=>{let d=u.distance1(n);d<h&&(s=u,h=d)})}return s}else{let n=e.start(),s=e.end(),a=(e.startAngle%360+360)%360,l=t.stroke(i*2,wr.ROUND,ae.CCW).asClose();if(new Dc().pointInPolyline(n,l))return n;let h=new Set;for(let u of l.primitives){let d=Pt(e,u);if(d>0)for(let p=0;p<d;p+=2){let m=new S(Ee[p],Ee[p+1]);h.add(m)}}if(h.size>0){let u=e.center,d=e.sweep(),p=e.sweepAngle;h.forEach(m=>{let g=(m.angleD(u)%360+360)%360;if(d==ae.CCW){let y=(g-a+360)%360;y<p&&(s=m,p=y)}else{let y=(g-a-360)%360;y>p&&(s=m,p=y)}})}return s}}calcuArcArc(t,e,r){let i=t.start(),n=t.end(),s=(t.startAngle%360+360)%360,a=e.stroke(r*2,wr.ROUND,ae.CCW).asClose();if(new Dc().pointInPolyline(i,a))return i;let c=new Set;for(let h of a.primitives){let u=Pt(t,h);if(u>0)for(let d=0;d<u;d+=2){let p=new S(Ee[d],Ee[d+1]);c.add(p)}}if(c.size>0){let h=t.center,u=t.sweep(),d=t.sweepAngle;c.forEach(p=>{let m=(p.angleD(h)%360+360)%360;if(u==ae.CCW){let g=(m-s+360)%360;g<d&&(n=p,d=g)}else{let g=(m-s-360)%360;g>d&&(n=p,d=g)}})}return n}isCollide(t,e,r,i=!0){if(e==null)return!1;let n=t.bbox().extendOfSize(r);for(let s of e.primitives){if(s instanceof M&&s.length()<1e-8)continue;let a=s.bbox();if(n.isIntersect(a)){let l=new er(t,s).getDistance();if(this.kit.less(l,r))return!0}}return!!(i&&this.pointInPolyline(t.start(),e)||t instanceof q&&this.kit.eq(Math.abs(t.sweepAngle),360)&&e.primitives[0].start().distance1(t.center)<t.rx)}isCollidePoly(t,e,r,i=!0){return t.primitives.some(n=>n instanceof M||n instanceof q?this.isCollide(n,e,r,i):n instanceof Uge?this.isCollidePoly(ge.build6(n.bbox()),e,r,i):n instanceof Dr?this.isCollidePoly(ge.build4(n.points(1)),e,r,i):!1)}};var sGe=!1;try{/\bhideAutoLayoutProgress\b/.test(Q().location.search)&&(sGe=!0)}catch{}var Soe=class{constructor(t){this.state=2;this.matrixRes=null;this.historyGroup=null;this.componentPosition={};this.hasMoved=new Set;this.hasBoardOutline=!1;this.bboxLines={};this.showBBox=!1;this.workerManager=t,A.subscribe("pcb/autoLayout",this.autoLayouting2.bind(this)),A.subscribe("/jerboa/progress",this.layoutResult.bind(this)),A.subscribe("pcb/layoutInterrupt",this.layoutInterrupt.bind(this),Q())}loadWorker(t){On.getInstance().allowPull=!1,this.workerManager.addWorker(`editor?entry=jerboa-service.js${Q().location.search.replace(/\?/,"&")}`).publish("/jerboa/execute",t)}async autoLayouting2(t=!1){if(!R.getInstance().isactive||![pi.PCB,pi.PCBMODULE].includes(R.getInstance().doctype))return;let e=await this.createAutoLayoutInput2(t);if(e)return t||(this.loadWorker(JSON.stringify(e)),this.toggleAutoLayoutState(0)),e}async importLayoutResult2(t){this.toggleAutoLayoutState(0);try{let e=JSON.parse(t);e.boardOutline&&(this.hasBoardOutline=!0);let r=10,i=39.37,n=nn.convert(1,r,i);this.matrixRes=Qe.scale(1/n),this.componentPosition={},Ar.getAllItem().forEach(s=>{this.componentPosition[s.globalIndex]=s.position}),this.updateCanvas(e),this.toggleAutoLayoutState(2)}catch(e){g0({type:"error",message:["Automatic layouting interrupt: ",e.toString()],shortMsg:"Automatic layouting interrupt!"}),this.toggleAutoLayoutState(3)}}layoutResult(t){if(this.state!==1){console.error("Auto Layouting is stoped!",this.state);return}try{this.workName=t.workerName;let r=JSON.parse(t.str);og("AutoLayoutResJson",void 0,r),e(r.subCircuitData_test),this.updateCanvas(r);let i=r.finish?1:Math.min(Math.max(r.progress,0),.99);this.updateProgress(i)}catch(r){g0({type:"error",message:["Automatic layouting interrupt: ",r.toString()],shortMsg:"Automatic layouting interrupt!"}),this.layoutInterrupt()}function e(r){if(!r)return;let i={Root:ee.WHITE,Page:ee.BLUE,Zone:ee.RED,ModuleAndGroup:ee.Golden,Component:ee.GREEN},n=r,s=new ko(A);n.forEach(a=>{var h;let l=(h=i[a.hierarchy])!=null?h:ee.Gray,c=a.bbox;s.initColor(l).addPly(ge.build4(new ht(c[0],c[1],c[2],c[3]).points().map(u=>u.scale(3.937))))}),s.draw()}}updateCanvas(t){this.hasBoardOutline||this.addBoardOutline(t.boardOutline),this.updateComponent(t.components,t.finish),A.publish("updateFrame","")}async createAutoLayoutInput2(t=!1){if(!Ar.getAllItem().length)return;this.historyGroup||(this.historyGroup=new hi,this.historyGroup.createGroup("autoLayouting"));let e=10,r=39.37,i=Au(),n=nn.convert(1,e,r),s=Qe.scale(n);this.matrixRes=Qe.scale(1/n),this.clearBBoxLines(),this.showBBox=parent.location.href.includes("layout=showbbox");let a=[],l=[],c=[],h=null;if(i.length>0){let Y=new _e,X=[];i.forEach(ce=>{Y.ext1(ce.buildBBox()),X.push(...ce.getMathGraphics().primitives)});let K=Y.build1(),se=new $c(K,2,1.2,new Di(2),X).detect();if(se&&se.bbox().area()<=K.area()){if(se.items.length===1)h=se.items[0];else if(se.items.length>1){let te={area:0,poly:null};se.items.forEach(oe=>{let $=oe.bbox().area();$>te.area&&(te={area:$,poly:oe})}),te.poly&&(h=te.poly,se.items.forEach(oe=>{if(oe!=te.poly&&Gy.build2(te.poly,oe).inInner()){a.push({path:this.autoJerboaPoints(oe,s),layer:11});let fe=Ze.getInstance().getAllCopperLayerIds();l.push({path:this.autoJerboaPoints(oe,s),layers:fe}),c.push(oe.area)}}))}}}let u=re.getInstance().getDefaultOtherSpacing(),d=re.getInstance().getDefaultSafeSpacing(),p=d.getItemMaxClearance(11,[1,2]),m=d.getItemMaxClearance(6,[1,2]),g=d.getItemMaxClearance(15,[1,2]),y=d.getItemMaxClearance(8,[1,2]),b={componentToBoardOutline:ve(this.autoJerboaNum(p,s),3),componentToComponent:ve(Math.max(this.autoJerboaNum(u.deviceClearance,s),.5),3),componentToFillRegion:ve(this.autoJerboaNum(m,s),3),componentToProhibitedRegion:ve(this.autoJerboaNum(Math.max(y,g),s),3)},P=[],T=[],I={},C=Ar.getAllItem().map(Y=>Y.footprintUUID),E=Array.from(new Set(C));E&&E.forEach(Y=>{T.push(Hi.getItem(Y))}),T&&T.forEach(Y=>{let X=Y.id,K=Y.uuid,J=Y.getBBox(),se=this.extractPrefix(X);if(!J)return;let ce=this.autoJerboaBBox2(J,s),te=!1,oe=Y.getPads();oe.forEach(Oe=>{ar(Oe.layerId)&&(te=!0)});let $={};oe.length>0&&oe.forEach(Oe=>{let Te=Oe.globalIndex,ue=Oe.layerId,be=Oe.center,j=this.autoJerboaPoint(be,s),Z=Oe.getMathGraphics(ue),ie=this.autoJerboaPoints(Z,s),de=null;Oe.padStyle.type=="ELLIPSE"&&(de=ve(nn.convert(Oe.padStyle.height*10,1,39.37),3));let me=[];if(me.push(ue),ue==12){me=Ze.getInstance().getAllSignalLayerIds();let Je=Oe.top,Ke=Oe.bottom,Gt=Oe.inner,Nr=[];if(Je&&Je.type==="ELLIPSE"&&Nr.push(Je.height),Ke&&Ke.type==="ELLIPSE"&&Nr.push(Ke.height),Gt&&Gt.type==="ELLIPSE"&&Nr.push(Gt.height),Nr.length>0){let Fe=de=Nr.length>1?Math.max(...Nr):Nr[0];de=ve(nn.convert(Fe*10,1,39.37),3)}let xr=Oe.getMathGraphics(1),vr=xr instanceof Bt?xr:new Bt([xr]),_r=Oe.getMathGraphics(2),Ne=_r instanceof Bt?_r:new Bt([_r]),Ft=new Ec().getUnionForSingle([vr.items,Ne.items]),ir=null;if(Ft.length>0)ir=Ft[0].items[0];else{let Fe=vr.items[0].area(),tt=Ne.items[0].area();ir=Fe>tt?vr.items[0]:Ne.items[0]}ie=this.autoJerboaPoints(ir,s)}let Se={number:Oe.num,layers:me,location:j,path:ie,diameter:de};$[Te]=Se});let fe={pads:$,footprintType:se,assemblyType:te?"tht":"smd",bbox:ce};I[X]?(I[X+"_"+K]=fe,P.push(K)):I[X]=fe});let O=Ar.getAllItem(),_={},x={},v={};O.forEach(Y=>{let X=Y.globalIndex,K=Y.designator;K in v?v[K].push(X):v[K]=[X];let J=Y.attrKeyValue["Unique ID"];J&&(_[Y.globalIndex]=J,x[J]=Y.globalIndex)});let D=[],w=[];for(let Y in v){let X=v[Y];X.length>1&&(D.push(...Array(X.length).fill(Y)),w.push(...X))}if(D.length>0){let Y="Auto component placement failed, has duplicated designator, please modify",X=[Y+":"];w.forEach((K,J)=>{X.push(J==0?" ":", "),X.push({attr:{id:K,pcbid:R.getInstance().tabId},text:D[J]})}),g0({type:"error",message:X,shortMsg:Y});return}let F=(await A.windowBridge.rpcCall("getAutoLayoutSymbolInfoByUniqueId",{uniqueID:Object.values(_),pcbUuid:R.getInstance().tabId},Q())).message||{},H={},z={},V={};Object.keys(F).forEach(Y=>{V[Y]=F[Y].map(X=>({...X,bbox:new ht(X.bbox.minX,X.bbox.maxX,X.bbox.minY,X.bbox.maxY)}))});let W=this.getBiggestBoxes(V);Object.keys(F).forEach(Y=>{this.getSchInfo2(W,V,Y,x,z)});let L=[],k=[];O.forEach(Y=>{let X=this.getComponentExtendBbox2(Y),K=Y.layerId;K===1?L.push(Y.bbox().area()):k.push(Y.bbox().area()),this.showBBox&&(this.bboxLines[Y.globalIndex]=X.map((fe,Oe)=>Vi.build(1002,fe,X[(Oe+1)%4],.1)));let J={};Y.getPads().forEach(fe=>{let Oe=fe.globalIndex,Te=fe.net;Oe.includes(Y.globalIndex)&&(Oe=Oe.replace(Y.globalIndex,"")),J[Oe]=Te});let ce=P.includes(Y.footprintUUID)?Y.footprintId+"_"+Y.footprintUUID:Y.footprintId,te=Y.name,oe={};Y.reuseBlock.length<1&&Y.combinationID.length<1&&Y.channelID.length<1||(oe.moduleName=Y.reuseBlock,oe.groupID=Y.combinationID,oe.channelID=Y.channelID);let $={name:Y.device,footprint:ce,height:Y.attrKeyValue.Height?this.transformComponentHeight(Y.attrKeyValue.Height):null,value:Y.attrKeyValue.Value?Y.attrKeyValue.Value:null,reuseModule:oe,rotation:ve(zt.toDegrees(Y.rotation),4),nets:J,location:this.autoJerboaPoint(Y.position,s),layer:K,lock:Y.locked};H[te]=$});let N=[],U=["Prohibited Region","Slot Region","Fill Region","Partition"];[].concat(Xt.getAllItem(),Kt.getAllItem(),pt.getAllItem()).forEach(Y=>{let{type:X,layerId:K,strokeWidth:J}=Y;if(!(K!=1004&&!Pe.getLayer(K).isSignalLayer()&&!ar(K))&&U.includes(X)){let se=Y.getComponent();if(X==="Prohibited Region"&&se instanceof Fu&&!se.device)return;let ce=Y.getMathGraphics(void 0,J/2);if(!ce)return;let te=new Array;ce.asClose().primitives.forEach($=>{$ instanceof q?te.push(...this.arc2octagon($)):te.push($)});let oe=[];ar(K)?oe=Ze.getInstance().getAllSignalLayerIds():oe.push(K),(X=="Prohibited Region"||X=="Slot Region")&&(Y.getParent()||this.autoPushProhibitedRegionPath(l,te,s,oe,h,c)),(X=="Fill Region"||X=="Partition")&&(Y.getParent()||this.autoPushFillRegionPath(N,te,s,K,h))}});let B;if(h){if(this.hasBoardOutline=!0,B={bbox:this.autoJerboaBBox2(h.bbox(),s),path:this.autoJerboaPoints(h,s)},!t){let Y=h.area(),X=Math.abs(Y)-c.reduce((se,ce)=>se+Math.abs(ce),0),K=X/L.reduce((se,ce)=>se+Math.abs(ce),0),J=X/k.reduce((se,ce)=>se+Math.abs(ce),0);if((K<1.2||J<1.2)&&!(await A.windowBridge.rpcCall("getAutoLayoutClickInfo",void 0,Q())).message){g0({type:"info",message:"Auto layout canceled\uFF01",shortMsg:"Auto layout canceled\uFF01",timeout:3e3});return}}}else B={bbox:this.autoJerboaBBox2(of(),s)};let G={boardOutline:B,clearance:b,components:H,schematicInfo:z,footprints:I,fillRegions:N,prohibitedRegions:l};return og("AutoLayoutJson2",void 0,G),G}getBiggestBoxes(t){let e=Object.entries(t).map(i=>{let[n,s]=i,a=s.reduce((l,c)=>l+c.bbox.area(),0);return{uniqueId:n,info:s,bboxAreaSum:a}}).sort((i,n)=>n.bboxAreaSum-i.bboxAreaSum).slice(0,10).map(i=>({uniqueId:i.uniqueId,info:i.info.map(n=>({...n,bboxDouble:n.bbox.extendOfSize(n.bbox.width(),n.bbox.height())}))})),r=new Set;for(let i=0;i<e.length;i++){let n=e[i];for(let s=i+1;s<e.length;s++){let a=e[s];for(let l=0;l<n.info.length;l++)for(let c=0;c<a.info.length;c++)if(n.info[l].page==a.info[c].page&&a.info[c].bbox.isIntersect(n.info[l].bboxDouble)){r.add(s);break}}}return e.filter((i,n)=>!r.has(n))}getSchInfo(t,e,r,i){let n=r.attrKeyValue["Unique ID"];if(!e[n])return{page:null,location:null};for(let s=0;s<t.length;s++){let a=t[s];for(let l=0;l<a.info.length;l++)for(let c=0;c<e[n].length;c++){let h=e[n][c];if(h.page==a.info[l].page&&h.bbox.isIntersect(a.info[l].bboxDouble))return{page:h.page,location:h.location,group:i[a.uniqueId]}}}return{page:e[n][0].page,location:e[n][0].location}}getSchInfo2(t,e,r,i,n){if(!e[r])return;for(let l=0;l<t.length;l++){let c=t[l];for(let h=0;h<c.info.length;h++)for(let u=0;u<e[r].length;u++){let d=e[r][u];if(d.page==c.info[h].page&&d.bbox.isIntersect(c.info[h].bboxDouble)){let p=d.designator,m={page:d.page,location:d.location,group:i[c.uniqueId],connectWith:d.connectWith,zone:d.zone};n[p]=m;return}}}let s=e[r][0].designator,a={page:e[r][0].page,location:e[r][0].location,connectWith:e[r][0].connectWith,zone:e[r][0].zone};n[s]=a}getComponentExtendBbox(t){let e=t.rotation;t.rotation=0;let r=new _e;r.ext1(t.buildBBox()),t.getPads().forEach(l=>{let h=re.getInstance().getSafeSpacingByNet(l.net,l.layerId==12?2:1).getClearance(0,0),u=l.buildBBox().extendOfSize(h);r.ext1(u)});let i=r.build1(),s=i.center().rotate(t.position,e);return this.componentPosition[t.globalIndex]=s,t.rotation=e,{componentBbox:[i.LL(),i.LR(),i.UR(),i.UL()].map(l=>l.rotate(t.position,t.rotation)),componentBboxCenter:s}}getComponentExtendBbox2(t){let e=new _e;e.ext1(t.buildBBox()),t.getPads().forEach(n=>{let a=re.getInstance().getSafeSpacingByNet(n.net,n.layerId==12?2:1).getClearance(0,0),l=n.buildBBox().extendOfSize(a);e.ext1(l)});let r=e.build1();return this.componentPosition[t.globalIndex]=t.position,[r.LL(),r.LR(),r.UR(),r.UL()].map(n=>n.rotate(t.position,t.rotation))}arc2octagon(t){let e=[t.start()],r=t.sweep()==ae.CCW?1:-1,i=360/8;for(let n=0;n<t.sweepAngle*r/i;n++){let s=zt.toRadians(t.startAngle+n*i*r);e.push(new S(t.rx*Math.cos(s),t.rx*Math.sin(s)).add(t.center))}return e.push(t.end()),ge.build4(e).primitives}autoJerboaPoint(t,e){return e&&(t=t.multiply3(e)),[ve(t.x,4),ve(t.y,4)]}autoJerboaBBox(t,e){return[t.LL(),t.LR(),t.UR(),t.UL()].map(r=>this.autoJerboaPoint(r,e))}autoJerboaBBox2(t,e){return t=t.transform(e),[ve(t.minX,4),ve(t.maxX,4),ve(t.minY,4),ve(t.maxY,4)]}autoJerboaPoints(t,e){t=this.makeClockWise(t);let r=[],i="";return t.points(.1,n=>{let s=this.autoJerboaPoint(n,e),a=s.join("_");i!==a&&(i=a,r.push(s))}),r}autoJerboaPointsByBBox(t,e){return this.autoJerboaPoints(ge.build6(t),e)}autoJerboaPointsByPoints(t,e){return this.autoJerboaPoints(ge.build4(t),e)}autoJerboaResPoint(t,e){return new S(t[0],t[1]).multiply3(e)}autoJerboaNum(t,e){return e&&(t=t*e.iScale),t}toggleAutoLayoutState(t,e=!1,r=1){let i=this.state;if(t===0){if(i!=2)return;this.autoLayoutReady()}else{if(t===1)return;if(t===2){if(i!=1){this.state=t;return}this.autoLayoutEnd(e,r)}else if(t===3){if(i!=1){this.state=2;return}this.layoutInterrupt()}}}autoLayoutReady(){this.startTime=new Date,this.state=1,this.updateProgress(0,{messageTopic:"pcb/layoutInterrupt",messageTopicData:{manual:!0}}),this.historyGroup||(this.historyGroup=new hi,this.historyGroup.createGroup("autoLayouting")),this.ratlineLayerIsVisible=Pe.getRatlineLayer().visible,this.ratlineLayerIsVisible&&(Pe.getRatlineLayer().visible=!1)}autoLayoutEnd(t=!1,e=1){this.workName!=null&&(this.workerManager.deleteWorker(this.workName),this.workName=null),this.ratlineLayerIsVisible&&(Pe.getRatlineLayer().visible=!0),this.outline&&this.historyGroup.addCommand4Item(this.outline,"add"),this.hasMoved.forEach(r=>{let i=Ar.getItem(r);A.publish("hasModifyPcbItem",i)}),this.putLogs(t),this.hasMoved.clear(),this.historyGroup&&this.historyGroup.execute(),this.historyGroup=null,this.outline=null,A.publish("flushService",""),this.state=2,this.updateProgress(e),On.getInstance().allowPull=!0}layoutInterrupt(t){let e="";typeof t=="string"?e=t:t&&(e=t.message),e&&g0({type:"error",message:e,shortMsg:e}),this.autoLayoutEnd(!0,1)}addBoardOutline(t){if(!t||!(t instanceof Array)||t.length<3)return;this.outline&&(this.outline.remove(),A.publish("delete",this.outline));let e=new Array,r=new Po;for(let i=0;i<t.length;i++){let n=this.autoJerboaResPoint(t[i],this.matrixRes),s=this.autoJerboaResPoint(t[i==t.length-1?0:i+1],this.matrixRes);e.push(r.addLine(n,s,11))}this.outline=pt.addPolygon("Line",11,[e],1,"",!1)}getBoardBox(t){let e=new _e;return t.forEach(r=>{if(!r.isEmpty){if(r instanceof He){let i=r.getMathGraphics();i!=null&&e.ext1(i.bbox())}else if(r instanceof _t||r instanceof mt){let i=r.getMathGraphics();i!=null&&e.ext1(i.bbox())}}}),e.build1()}updateComponent(t,e){if(!(t instanceof Object))return;let r=Ar.getAllItem();for(let i in t)if(t.hasOwnProperty(i)){let n=t[i],s=r.filter(u=>u.designator==i)[0];if(!this.hasMoved.has(s.globalIndex)){this.hasMoved.add(s.globalIndex);let u=Ce.dispatch(s,"modify");this.historyGroup.addCommand(u)}let a=this.componentPosition[s.globalIndex],l=this.autoJerboaResPoint(n.location,this.matrixRes);this.componentPosition[s.globalIndex]=l;let c=l.sub(a),h=Ae.translate(c.x,c.y,0);s.rotation=zt.toRadians(n.rotation),s.transform(h),this.showBBox&&this.bboxLines[s.globalIndex].forEach(u=>u.transform(h))}}clearBBoxLines(){Object.values(this.bboxLines).forEach(t=>{t.forEach(e=>e.remove())}),this.bboxLines={}}updateProgress(t,e){isNaN(t)&&(t=1,console.error("There has undesired number of progress: ",t)),sGe||A.publish("progressUpdate",[t,"Auto Layout",void 0,e],Q()),t>=1&&this.toggleAutoLayoutState(2)}putLogs(t=!1){t||g0({type:"info",message:"Auto layout completed! Has moved components: {0}, use time: {1}s.",shortMsg:"Auto layout completed!",replace:{0:this.hasMoved.size.toString(),1:((new Date().getTime()-this.startTime.getTime())/1e3).toFixed(2).toString()},timeout:3e3})}extractPrefix(t){let e=t.indexOf("_");if(e!==-1)return t.substring(0,e);{let r=t.indexOf("-");if(r!==-1)return t.substring(0,r);{let i=t.search(/\d/);return i!==-1?t.substring(0,i):t}}}transformComponentHeight(t){let e=t.match(/^(\d+(\.\d+)?)/);return e?parseFloat(e[0]):0}autoPushProhibitedRegionPath(t,e,r,i,n,s){let a=new zj,l=ge.build2(e);a.isCollidePoly(l,n,0)&&(t.push({path:this.autoJerboaPoints(l,r),layers:i}),s.push(l.area()))}autoPushFillRegionPath(t,e,r,i,n){new zj().isCollidePoly(ge.build2(e),n,0)&&t.push({path:this.autoJerboaPoints(ge.build2(e),r),layer:i})}getMatrix(){let t=10,e=39.37,r=Au(),i;r.length>0?i=this.getBoardBox(r).LL():i=of().LL();let n=nn.convert(1,t,e);return Qe.translate(-i.x*n,-i.y*n).scale(n)}makeClockWise(t){return t.area()>0?t.reverse1():t}};var lGe=Ru(gY());var aGe=/^(\D*)(\d+|\?|\？)$/,X3t=/^(\D*)$/;var hSe=/^(.*?)(\d+|\?|\？)$/,q3t=/^([A-Z]+)(\d+|\?|\？)$/,cSe=o=>o==="?"||o==="\uFF1F",$3t=o=>/^\d+$/.test(o);function Aoe(o){return`${Tr}${o.number}`||o.globalIndex}function _oe(o){return`$${o.layerId}_${o.globalIndex}`}function voe(o,t){if(o.length<=1)return o;let e=Math.floor(o.length/2),r=o.slice(0,e),i=o.slice(e);return K3t(voe(r,t),voe(i,t),t)}function K3t(o,t,e){let r=[],i=0,n=0;for(;i<o.length&&n<t.length;)e(o[i],t[n])<=0?(r.push(o[i]),i++):(r.push(t[n]),n++);return r.concat(o.slice(i)).concat(t.slice(n))}function uSe(o,t){let e=Ar.getAllItem();e=e.filter(i=>i.partition==R.getInstance().partitionId);let r={1:[],2:[],allSelectedPath:[],sortedComponents:[]};if(o==="selected_component"?(e=ze.getComponents(),Hn(e,(i,n)=>{let s=n.layerId,a=_oe(n);r[s].push(n),r.allSelectedPath.push(a)})):Hn(e,(i,n)=>{let s=n.layerId,a=_oe(n);switch(o){case"all_components":r[s].push(n),r.allSelectedPath.push(a);break;case"topLayer-components":s==1&&(r[s].push(n),r.allSelectedPath.push(a));break;case"bottomLayer-components":s===2&&(r[s].push(n),r.allSelectedPath.push(a));break}}),t)switch(t){case"horizontal_vertical_reverse":r.sortedComponents.push(...Ooe(r[1])),r.sortedComponents.push(...Ooe(r[2]));break;case"vertical_horizontal_reverse":r.sortedComponents.push(...Eoe(r[1])),r.sortedComponents.push(...Eoe(r[2]));break;case"horizontal_vertical":r.sortedComponents.push(...Ooe(r[1],!0)),r.sortedComponents.push(...Ooe(r[2],!0));break;case"vertical_horizontal":r.sortedComponents.push(...Eoe(r[1],!0)),r.sortedComponents.push(...Eoe(r[2],!0));break}return r}function Eoe(o,t=!1){return voe(o,(e,r)=>Math.abs(e.position.x-r.position.x)>0?e.position.x>r.position.x?1:-1:t?r.position.y-e.position.y:e.position.y-r.position.y)}function Ooe(o,t=!1){return voe(o,(e,r)=>Math.abs(e.position.y-r.position.y)>0?t?r.position.y-e.position.y:e.position.y-r.position.y:e.position.x-r.position.x)}function cGe(o,t,e,r){let i="refDesignator-time";Cn(i);let n=uSe("all_components",t).sortedComponents,s=uSe(o,t),a=s.allSelectedPath,l={},c={},h=1e7,u=new De("refDesignator"),d={};(e==="keep_designator"||e==="re_designator")&&(Hn(n,(g,y)=>{let b=y.attrKeyValue.Designator||"U?",P=_oe(y),T=aGe.exec(b);if(T){let I=T[1],C=T[2];cSe(C)||(a.includes(P)?e==="keep_designator"&&l2(d,b).push(P):l2(c,b).push(P))}else l2(c,b).push(P)}),Hn(d,(g,y)=>{c[g]&&delete d[g]}));let p=[];Hn(s.sortedComponents,(g,y)=>{var I,C,E,O;let b=y.attrKeyValue.Designator,P=_oe(y),T=aGe.exec(b);if(T){let _=T[2],x=T[1];cSe(_)||P!==(((I=d[b])==null?void 0:I[0])||((C=c[b])==null?void 0:C[0]))?(m(y,_,x),q3t.test(b)||p.push(XCe({text:`${b}(${Aoe(y)})`,attr:{id:y.globalIndex,pcbid:R.getInstance().tabId}}))):console.error(b)}else if(b=="")m(y,1,"U");else if(X3t.test(b))m(y,1,b);else{let _=hSe.exec(b),x=_==null?void 0:_[1],v=_==null?void 0:_[2];cSe(v)||P!==(((E=d[b])==null?void 0:E[0])||((O=c[b])==null?void 0:O[0]))?m(y,1,x):_||m(y,1,b),p.push(XCe({text:`${b}(${Aoe(y)})`,attr:{id:y.globalIndex,pcbid:R.getInstance().tabId}}))}}),p.length>0&&A.windowBridge.publish("ui/toastMsg",{type:"warn",msg:{value:"Found that some designators does not conform to the rules",options:{title:p.join(";")}},bottomBarMsg:{type:"warn",msg:['<span class="i18n">Found that some designators does not conform to the rules:</span> ',p.join(";")]},timer:3},Q()),u.length>0&&qe.executeCommand(u),A.publish("flushService",""),A.publish("flushSelectingInfo",""),A.windowBridge.rpcCall("save",{tabId:R.getInstance().tabId},Q()),A.windowBridge.publish("ui/toastMsg",{type:"info",msg:"Finish Annotating Designator.",timer:3},Q()),Xi(i);function m(g,y,b){for(let P=l[b]+1||r;P<h;P++){let T=b+P;if(!Object.keys(Object.assign({},c,d)).includes(T)){l[b]=P;let I=Ce.dispatch(g,"modify");u.addCommand(I),g.modifyATTRMap("Designator",T);let C=g.attrKeyText;C.Designator&&(C.Designator.value=T);break}}}}function hGe(o){let t=uSe(o),e=new De("clear-Designator");Hn(t[1].concat(t[2]),(r,i)=>{let n=i.attrKeyValue.Designator||"U?",s;if($3t(n.trim()))s="?";else{let c=n.match(new RegExp("\\b(\\d*(\\p{L}+))","u")),h=c?c[1]:n.replace(hSe,"$1?");!hSe.test(h)&&n!==h?s=h+"?":s=h}let a=Ce.dispatch(i,"modify");e.addCommand(a),i.modifyATTRMap("Designator",s);let l=i.attrKeyText;l.Designator&&(l.Designator.value=s)}),e.length>0&&qe.executeCommand(e),A.publish("flushService",""),A.publish("flushSelectingInfo",""),A.windowBridge.rpcCall("save",{tabId:R.getInstance().tabId},Q()),A.windowBridge.publish("ui/toastMsg",{type:"info",msg:"Finish Clear Designator.",timer:3},Q())}function uGe(){let o=Ar.getAllItem();o=o.filter(n=>n.partition==R.getInstance().partitionId);let t="UNIQUE",e=[],r=new De("resetUniquId"),i=(n,s,a)=>{let l=n+(s?(0,lGe.default)(s).substring(0,6):a).toLocaleUpperCase();return e.includes(l)&&(l=n+a.toLocaleUpperCase()),l};Hn(o,(n,s)=>{let a=s.attrKeyValue.Designator;if(r.addCommand(Ce.dispatch(s,"modify")),a&&Lke.test(a)){let l=t+a.toLocaleUpperCase();e.includes(l)?l=i(t,a,Aoe(s)):e.push(l),e.push(l),s.modifyATTRMap("Unique ID",l);let c=s.attrKeyText;c["Unique ID"]&&(c["Unique ID"].value=l)}else{let l=i(t,a,Aoe(s));e.push(l),s.modifyATTRMap("Unique ID",l);let c=s.attrKeyText;c["Unique ID"]&&(c["Unique ID"].value=l)}}),r.length>0&&qe.executeCommand(r),A.publish("flushService",""),A.windowBridge.rpcCall("save",{tabId:R.getInstance().tabId},Q()),A.publish("flushSelectingInfo",""),A.windowBridge.publish("ui/toastMsg",{type:"info",msg:"Reset component unique ID successfully",timer:3},Q())}var xoe=class extends AF{addCopperResult(t,e){let r=this.getProfile(t);if(r==null||r.type!="Copper Region")return;let n=r.component;if(n instanceof xn){let s=n.style,a=n.clearance,l=n.gridLineWidth,c=n.optimization,h=n.optimizationValue,u=qo.getInstance();e.forEach(d=>{let p=JSON.parse(d);if(p[0]=="POURED"){let m=s;if(m=="solid"&&p[2]!=0&&(m="90grid"),(m=="90grid"||m=="45grid")&&p[2]!=0&&(l=p[2]),n.copperResult.push(p[4]),u.getItem(p[1])!=null)return;let g=qo.getInstance().addCopper(p[1],r.layerId,r.net,m,l,a,c,p[4],!1,h);r.addCopper(g.globalIndex),g.setParent(r)}})}}getProfile(t){let e=vi.getInstance().getItem(t);if(e!=null)return e;let r=Qi.getInstance().getItem(t);if(r!=null)return r;let i=Fi.getInstance().getItem(t);return i!=null?i:null}};var LR={x:"width",y:"height"},dSe={x:"row",y:"column"},vS={x:"rowSpacing",y:"columnSpacing"},Roe=class{constructor(){this._model=si.getInstance()}applyPanelize(t={}){let r={...JSON.parse(JSON.stringify(this._model.getDefaultPanelize())),...t};if(this._model.setDefaultPanelize(r),this._model.remove(),!r.on)return;this.handleCustomRect(r);let i=this.getBoardOutlines(r);if(!i.length)return;let n=this.getBoardBBox2(r,i);if(n.height===0&&n.width===0)return;let{innerBBox:s,outerBBox:a}=this.calcBBox(r,i),l;if(r.resetCanvasOrigin&&(l=new S(a.x,a.y)),l){R.getInstance().origin=l;let c=this.calcBBox(r,i);n=c.bBox,s=c.innerBBox,a=c.outerBBox}r.onlyOutline&&this.createOutLineCopies(r,n,this.getAllBoard()),(!r.stampRow||!r.stampColumn)&&this.createVCutLines(a,n,r,s,i),(r.stampRow||r.stampColumn)&&this.createStampHoleLines(r,n,s,i),(r.borderAtTopBottom||r.borderAtLeftRight)&&this.createBorder(r,a),this.createOuterMostLine(r,i,n,s,a)}handleCustomRect(t){if(t.useCustomSize==null||t.customWidth<=0||t.customHeight<=0)return;let e="customRectForPanelize",r=Qi.getInstance(),i=r.getItem(e);t.useCustomSize&&(i?(i.width=t.customWidth,i.height=t.customHeight):(r.recycle(),Fi.getInstance().recycle(),vi.getInstance().recycle(),r.addRect(e,"Board Outline",11,new S(0,0),t.customWidth,t.customHeight,"",!1,1,0,0)))}getBoardOutlines(t){let e=this.getAllBoard();if(!e.length)return[];let r=this.getBoardBBox(t,e),i=[];e.forEach(l=>xe.addAll(i,l.getMathGraphics().primitives));let s=new $c(new ht(r.x,r.x+r.width,r.y,r.y+r.height),2,.01,new Di(4),i).detect();if(s&&s.bbox().area()<=r.height*r.width)return s.items;let a=e.map(l=>l.getMathGraphics()).flat(2).filter(l=>l!=null).map(l=>l.primitives).flat(2);return[ge.build2(a)]}getBoardBBox(t,e){let r=new _e;e.forEach(n=>{n.isEmpty||r.ext1(n.buildBBox())});let i=r.build1();return this._model.singleBBox=i,this.bBoxWithOffset(i,t)}getBoardBBox2(t,e){let r=new _e;e.forEach(n=>r.ext1(n.bbox()));let i=r.build1();return this._model.singleBBox=i,this.bBoxWithOffset(i,t)}bBoxWithOffset(t,e){let r=t.maxX-t.minX,i=t.maxY-t.minY;return{x:t.minX,y:t.minY,width:r,height:i,offset:{x:e.columnSpacing+r,y:e.rowSpacing+i}}}getAllBoard(){let t=new Array;return vi.getInstance().iterator(r=>e(r)),Qi.getInstance().iterator(r=>e(r)),Fi.getInstance().iterator(r=>e(r)),t;function e(r){(r.type=="Board Outline"||r.type=="Line"&&r.layerId==11)&&t.push(r)}}createOutLineCopies(t,e,r){for(let i=0;i<t.row;i++)for(let n=0;n<t.column;n++){let s=!i&&!n,a=!s||(t.flipX||t.flipY)&&t.flipOrigin,l=Ae.translate(e.offset.x*n,e.offset.y*i,0);r.forEach(c=>this._model.copyOutline(c,l,s,a))}}createVCutLines(t,e,r,i,n){if(!r.stampRow)if(r.rowSpacing==0||r.borderAtLeftRight&&r.columnSpacing==0){let s=this.getIntersects(n,new M(new S(e.x,e.y+e.height),new S(e.x+e.width,e.y+e.height))),a=this.getIntersects(n,new M(new S(e.x,e.y),new S(e.x+e.width,e.y)));if(!this.isIntersect(s,a,Qe.translate(0,e.height))){let l=[s,a].map(u=>u.reduce((d,p)=>d.concat(p),[]).sort((d,p)=>p.x-d.x)[0]),c=l[0],h=l[1].add(new S(0,e.height));for(let u=0;u<r.column;u++)for(let d=0;d<r.row-1;d++){let p=new S(e.offset.x*u,e.offset.y*d);this._model.addLine(c.add(p),h.add(p))}}}else for(let s=1;s<r.row;s++){let a=e.y+e.offset.y*s,l=a-r.rowSpacing,c=[a,l].map(u=>this.createVCutLineGivenFixedPosition(r,u,!0,t)),h=ge.build4([c[0][1],c[0][0],c[1][0],c[1][1]]).asClose();this._model.closures.push(h.primitives)}if(!r.stampColumn)if(r.columnSpacing==0||r.borderAtTopBottom&&r.rowSpacing==0){let s=this.getIntersects(n,new M(new S(e.x,e.y),new S(e.x,e.y+e.height))),a=this.getIntersects(n,new M(new S(e.x+e.width,e.y),new S(e.x+e.width,e.y+e.height)));if(!this.isIntersect(a,s,Qe.translate(e.width,0))){let l=[a,s].map(u=>u.reduce((d,p)=>d.concat(p),[]).sort((d,p)=>p.x-d.x)[0]),c=l[0],h=l[1].add(new S(e.width,0));for(let u=0;u<r.column-1;u++)for(let d=0;d<r.row;d++){let p=new S(e.offset.x*u,e.offset.y*d);this._model.addLine(c.add(p),h.add(p))}}}else for(let s=1;s<r.column;s++){let a=e.x+e.offset.x*s,l=a-r.columnSpacing,c=[a,l].map(u=>this.createVCutLineGivenFixedPosition(r,u,!1,t)),h=ge.build4([c[0][1],c[0][0],c[1][0],c[1][1]]).asClose();this._model.closures.push(h.primitives)}r.borderAtTopBottom&&(this._model.borderClosures[0].push(new M(new S(i.x,i.y),new S(i.x+i.width,i.y))),this._model.borderClosures[1].push(new M(new S(i.x,i.y+i.height),new S(i.x+i.width,i.y+i.height)))),r.borderAtLeftRight&&(this._model.borderClosures[0].push(new M(new S(i.x,i.y),new S(i.x,i.y+i.height))),this._model.borderClosures[1].push(new M(new S(i.x+i.width,i.y),new S(i.x+i.width,i.y+i.height)))),r.borderAtTopBottom&&!r.stampRow&&r.borderAtLeftRight&&!r.stampColumn?([e.x,e.x+e.width].forEach((s,a)=>{let l=new M(new S(s,i.y),new S(s,i.y+i.height)),c=this.getInterSections(n,l,"y");if(c.up&&c.down){let h=c.down,u=c.up.add1(0,e.offset.y*(r.row-1));a==1&&(h=h.add1(i.width-e.width,0),u=u.add1(i.width-e.width,0)),this._model.addVCutLine(u,h,!1)}}),[e.y,e.y+e.height].forEach((s,a)=>{let l=new M(new S(i.x,s),new S(i.x+i.width,s)),c=this.getInterSections(n,l,"x");if(c.up&&c.down){let h=c.down,u=c.up.add1(e.offset.x*(r.column-1),0);a==1&&(h=h.add1(0,i.height-e.height),u=u.add1(0,i.height-e.height)),this._model.addVCutLine(h,u,!0)}})):r.borderAtTopBottom&&!r.stampRow?(this.createVCutLineGivenFixedPosition(r,i.y,!0,t),this.createVCutLineGivenFixedPosition(r,i.y+i.height,!0,t)):r.borderAtLeftRight&&!r.stampColumn&&(this.createVCutLineGivenFixedPosition(r,i.x,!1,t),this.createVCutLineGivenFixedPosition(r,i.x+i.width,!1,t))}calcBBox(t,e){let r=this.getBoardBBox2(t,e);this._model.offset=new S(r.offset.x,r.offset.y),R.getInstance().panelizeParam={success:t.success,on:t.on,row:t.row,column:t.column,offset:this._model.offset,onlyOutline:t.onlyOutline};let i={x:r.x,y:r.y,width:r.offset.x*t.column-t.columnSpacing,height:r.offset.y*t.row-t.rowSpacing},n={x:i.x-(t.borderAtLeftRight?t.borderHeight+(t.stampColumn?t.columnSpacing:0):0),y:i.y-(t.borderAtTopBottom?t.borderHeight+(t.stampRow?t.rowSpacing:0):0),width:i.width+(t.borderAtLeftRight?t.borderHeight+(t.stampColumn?t.columnSpacing:0):0)*2,height:i.height+(t.borderAtTopBottom?t.borderHeight+(t.stampRow?t.rowSpacing:0):0)*2,center:{x:i.x+i.width/2,y:i.y+i.height/2}};return this._model.outerBBox=new ht(n.x,n.x+n.width,n.y,n.y+n.height),{bBox:r,innerBBox:i,outerBBox:n}}createVCutLineGivenFixedPosition(t,e,r,i){let n=i.x+(t.borderAtLeftRight?t.borderHeight:0),s=i.x+i.width-(t.borderAtLeftRight?t.borderHeight:0),a=i.y+i.height-(t.borderAtTopBottom?t.borderHeight:0),l=i.y+(t.borderAtTopBottom?t.borderHeight:0),c,h;return r?(c=new S(n,e),h=new S(s,e)):(c=new S(e,a),h=new S(e,l)),this._model.addVCutLine(c,h,r),[c,h]}isIntersect(t,e,r){let[i,n]=[t,e].map(s=>s.map(a=>a instanceof Array?new ht(Math.min(a[0].x,a[1].x),Math.max(a[0].x,a[1].x),Math.min(a[0].y,a[1].y),Math.max(a[0].y,a[1].y)):new ht(a.x,a.x,a.y,a.y)));return n.map(s=>s.transform(r)).some(s=>i.some(a=>s.isIntersect(a)))}createBorder(t,e){let i=new dt().conversion("mm","mil",5)/10,n=t.borderHeight/2,s,a,l,c,h=t.borderHeight-n;t.borderAtTopBottom&&t.borderAtLeftRight?(l=new S(e.x+i+t.borderHeight,e.y+e.height-h),c=l.add1(i,0)):t.borderAtTopBottom?(l=new S(e.x+i,e.y+e.height-h),c=l.add1(i,0)):(l=new S(e.x+h,e.y+i),c=l.add1(0,i)),s=l,a=t.createPositionHole?c:l,t.createPositionHole&&this.getAllMarkHolePosFromTopLeft(s,t,i,e).forEach(d=>this._model.addPositionHole(new S(d.x,d.y),t.positionHoleDiameter)),t.createMark&&this.getAllMarkHolePosFromTopLeft(a,t,i,e).forEach(d=>this._model.addMark(new S(d.x,d.y),t.markDiameter,t.markExpansion))}getAllMarkHolePosFromTopLeft(t,e,r,i){if(e.borderAtTopBottom){let n=t.add1(r,0);return[t,t.mirrorY(i.center),n.mirrorX(i.center),n.mirrorCenter(i.center)]}if(e.borderAtLeftRight){let n=t.add1(0,r);return[t,n.mirrorY(i.center),t.mirrorX(i.center),n.mirrorCenter(i.center)]}}createStampBorderLines(t,e,r,i,n){let s=n==="x"?"y":"x",a=[e[s],e[s]+e[LR[s]]];(t.stampRow&&t.borderAtTopBottom&&n=="x"||t.stampColumn&&t.borderAtLeftRight&&n=="y")&&(a[0]-=t[vS[n]],a[1]+=t[vS[n]]),r[s].forEach(l=>{for(let c=0;c<t[dSe[n]];c++)a.push(l[0][s]+i.offset[s]*c)}),a.sort((l,c)=>l-c);for(let l=1;l<a.length;l+=2){let c=a[l],h=a[l-1],u=[{x:null,y:null},{x:null,y:null}];u[0][n]=e[n]-t[vS[s]],u[0][s]=c,u[1][n]=e[n]-t[vS[s]],u[1][s]=h;let d=new S(u[0].x,u[0].y),p=new S(u[1].x,u[1].y);this._model.addLine(d,p),this._model.borderClosures[0].push(new M(d,p));let m=[{x:null,y:null},{x:null,y:null}];m[0][n]=e[n]+(e[LR[n]]+t[vS[s]]),m[0][s]=c,m[1][n]=e[n]+(e[LR[n]]+t[vS[s]]),m[1][s]=h;let g=new S(m[0].x,m[0].y),y=new S(m[1].x,m[1].y);this._model.addLine(g,y),this._model.borderClosures[1].push(new M(g,y))}}arrayCopyStampLineAndHole(t,e,r,i,n,s){for(let a=0;a<t.row;a++)for(let l=0;l<t.column;l++)if(s==="x"?a<t.row-1:l<t.column-1){let c=new S(e.offset.x*l,e.offset.y*a),h=Qe.translate1(c);for(let d=0;d<r[s].length;d+=2){[r[s][d],r[s][d+1]].forEach(b=>{this._model.addLine(new S(b[0].x,b[0].y).add(c),new S(b[1].x,b[1].y).add(c))});let p=n[s][0][d/2].map(b=>b.multiply3(h)),m=n[s][1][d/2].map(b=>b.multiply3(h)),g=new M(p[0].start(),m[m.length-1].end()),y=new M(m[0].start(),p[p.length-1].end());this._model.closures.push([].concat(p,[g],m,[y]))}let u=i[s].map(d=>d.map(p=>new S(p.x,p.y).add(c))).flat(1);this._model.addStampHoleGroup(u,t.stampHoleDiameter)}}createStampHoleLines(t,e,r,i){let n=t.stampHoleSpacing,s=t.stampHoleDiameter,a={x:t.stampPerRow,y:t.stampPerColumn},l={x:[],y:[]},c={x:[[],[]],y:[[],[]]},h={x:[],y:[]},u=t.stampHolePerGroup;if(["x","y"].forEach(p=>{let m=p==="x"?"y":"x";for(let g=0;g<a[p];g++){let y=e[p]+(g+1)/(a[p]+1)*e[LR[p]];[-1,1].forEach(b=>{let P={type:"stampLine"};P[p]=y+(n*(u/2-.3)+s/2)*b,l[p].push(P)});for(let b=0;b<u;b++){let P={type:"stampHole"};P[p]=y+n*(b-(u-1)/2),l[p].push(P)}}l[p].forEach(g=>{let y=p==="x"?new M(new S(g.x,e.y),new S(g.x,+e.y+e.height)):new M(new S(e.x,g.y),new S(+e.x+e.width,g.y)),b=this.getInterSections2(i,y,m);if(b.up&&(b.up.position[m]+=g.type==="stampHole"?s/6:0),b.down&&(b.down.position[m]-=g.type==="stampHole"?s/6:0,m=="y"?b.down.position.y+=e.offset.y:b.down.position.x+=e.offset.x),b.down&&b.up){let P=[b.up,b.down];g.type==="stampLine"?h[p].push(P.reverse()):g.type==="stampHole"&&P.forEach((T,I)=>c[p][I].push(T))}})}),h.x.length<2||h.y.length<2)return;let d={x:[],y:[]};["x","y"].forEach(p=>{[0,1].forEach(m=>{for(let g=0;g<h[p].length;g+=2){let y=[],b=h[p][g][m],P=h[p][g+1][m],[T,I]=p=="x"==(m==0)?[P,b]:[b,P];if(T.polyline==I.polyline){let C=T.polyIndex,E=I.polyIndex,O=Qe.translate1(p=="x"?new S(0,this._model.offset.y):new S(this._model.offset.x,0)),_=m==0?T.polyline.primitives.map(v=>v.multiply3(O)):T.polyline.primitives,x=Zl.modifyStart(T.position,_[C]);if(C==E)y.push(Zl.modifyEnd(I.position,x));else{y.push(x);for(let D=C+1,w=_.length;D<E+(C<E?0:w);D++)y.push(_[D%w]);let v=Zl.modifyEnd(I.position,_[E]);y.push(v)}}else y.push(new M(T.position,I.position));d[p][m]||(d[p][m]=[]),d[p][m].push(y)}})}),h={x:h.x.map(p=>p.map(m=>m.position)),y:h.y.map(p=>p.map(m=>m.position))},c={x:c.x.map(p=>p.map(m=>m.position)),y:c.y.map(p=>p.map(m=>m.position))},t.stampRow&&t.borderAtTopBottom&&(this.createStampBorderLines(t,r,h,e,"y"),this.createStampHoleLineAlongBorder(t,e,c,h,d,r,"y")),t.stampColumn&&t.borderAtLeftRight&&(this.createStampBorderLines(t,r,h,e,"x"),this.createStampHoleLineAlongBorder(t,e,c,h,d,r,"x")),t.stampRow&&this.arrayCopyStampLineAndHole(t,e,h,c,d,"x"),t.stampColumn&&this.arrayCopyStampLineAndHole(t,e,h,c,d,"y")}createStampHoleLineAlongBorder(t,e,r,i,n,s,a){let l=t.stampHoleDiameter,c=a==="x"?"y":"x";for(let h=0;h<t[dSe[a]];h++)r[c][0].forEach(u=>{let d={x:null,y:null};d[a]=u[a]+e.offset[a]*(t[dSe[c]]-1),d[c]=u[c]+e.offset[c]*h,this._model.addStampHole(new S(d.x,d.y),l)}),r[c][1].forEach(u=>{let d={x:null,y:null};d[a]=u[a]-e.offset[a],d[c]=u[c]+e.offset[c]*h,this._model.addStampHole(new S(d.x,d.y),l)}),i[c].forEach(u=>{let d=[{x:null,y:null},{x:null,y:null}];d[0][a]=u[0][a]-e.offset[a],d[0][c]=u[0][c]+e.offset[c]*h,d[1][a]=s[a]-t[vS[c]],d[1][c]=u[1][c]+e.offset[c]*h;let p=new S(d[0].x,d[0].y),m=new S(d[1].x,d[1].y);this._model.addLine(p,m),this._model.borderClosures[0].push(new M(p,m));let g=a=="x"?new S(-e.offset[a],e.offset[c]*h):new S(e.offset[c]*h,-e.offset[a]);this._model.borderClosures[0].push(...this.flatten(n[c][0]).map(I=>I.multiply3(Qe.translate1(g))));let y=[{x:null,y:null},{x:null,y:null}];y[0][a]=s[a]+(s[LR[a]]+t[vS[c]]),y[0][c]=u[0][c]+e.offset[c]*h,y[1][a]=u[1][a]+(s[LR[a]]-e.offset[a]+t[vS[c]]),y[1][c]=u[1][c]+e.offset[c]*h;let b=new S(y[0].x,y[0].y),P=new S(y[1].x,y[1].y);this._model.addLine(b,P),this._model.borderClosures[1].push(new M(b,P));let T=a=="x"?new S(s[LR[a]]-e.offset[a]+t[vS[c]],e.offset[c]*h):new S(e.offset[c]*h,s[LR[a]]-e.offset[a]+t[vS[c]]);this._model.borderClosures[1].push(...this.flatten(n[c][1]).map(I=>I.multiply3(Qe.translate1(T))))})}flatten(t){return t.reduce((e,r)=>(e.push(...r),e),[])}addBorderByPoints(t,e,r,i){for(let n=0;n<t.length;n++){let s=t[n],a,l,c,h;s instanceof S?(this._model.addArc(s,e,Math.PI,Math.PI*1.5),a=q.build3(s,180,180*.5,e,e),this._model.addArc(s.mirrorX(r),e,Math.PI*.5,Math.PI),l=q.build3(s.mirrorX(r),180*.5,180*.5,e,e),this._model.addArc(s.mirrorY(r),e,Math.PI*1.5,Math.PI*2),c=q.build3(s.mirrorY(r),180*1.5,180*.5,e,e),this._model.addArc(s.mirrorCenter(r),e,0,Math.PI*.5),h=q.build3(s.mirrorCenter(r),0,180*.5,e,e)):(this._model.addLine(s[0],s[1]),a=new M(s[0],s[1]),this._model.addLine(s[0].mirrorX(r),s[1].mirrorX(r)),l=new M(s[0].mirrorX(r),s[1].mirrorX(r)),this._model.addLine(s[0].mirrorY(r),s[1].mirrorY(r)),c=new M(s[0].mirrorY(r),s[1].mirrorY(r)),this._model.addLine(s[0].mirrorCenter(r),s[1].mirrorCenter(r)),h=new M(s[0].mirrorCenter(r),s[1].mirrorCenter(r))),i.borderAtTopBottom&&i.borderAtLeftRight?this._model.borderClosures_outerMost.push(a,c,l,h):i.borderAtTopBottom?(this._model.borderClosures[0].push(a,c),this._model.borderClosures[1].push(l,h)):i.borderAtLeftRight&&(this._model.borderClosures[0].push(a,l),this._model.borderClosures[1].push(c,h))}}createOuterMostLine(t,e,r,i,n){!t.stampRow&&t.rowSpacing>0&&[r.x,r.x+r.width].forEach((a,l)=>{let c=new M(new S(a,n.y),new S(a,n.y+n.height)),h=this.getInterSections(e,c,"y");if(h.up&&h.down){let u=h.up,d=h.down.add1(0,r.offset.y*(t.row-1));l==1&&(u=u.add1(i.width-r.width,0),d=d.add1(i.width-r.width,0)),this._model.addLine(u,d)}}),!t.stampColumn&&t.columnSpacing>0&&[r.y,r.y+r.height].forEach((a,l)=>{let c=new M(new S(n.x,a),new S(n.x+n.width,a)),h=this.getInterSections(e,c,"x");if(h.up&&h.down){let u=h.up,d=h.down.add1(r.offset.x*(t.column-1),0);l==1&&(u=u.add1(0,i.height-r.height),d=d.add1(0,i.height-r.height)),this._model.addLine(u,d)}});let s=!1;if(t.borderAtTopBottom&&!t.borderAtLeftRight){if(!t.stampRow&&t.rowSpacing>0){let a=new S(n.x,n.y),l=a.add1(t.borderRadius,t.borderRadius),c=a.add1(0,t.borderRadius),h=a.add1(0,t.borderHeight),u=a.add1(t.borderRadius,0),d=a.add1(n.width/2,0);this.addBorderByPoints([[h,c],l,[u,d]],t.borderRadius,n.center,t),s=!0}}else if(t.borderAtLeftRight&&!t.borderAtTopBottom&&!t.stampColumn&&t.columnSpacing>0){let a=new S(n.x,n.y),l=a.add1(t.borderRadius,0),c=a.add1(t.borderRadius,t.borderRadius),h=a.add1(t.borderHeight,0),u=a.add1(0,t.borderRadius),d=new S(n.x,n.y+n.height/2);this.addBorderByPoints([[h,l],c,[u,d]],t.borderRadius,n.center,t),s=!0}if(!s&&(t.borderAtLeftRight||t.borderAtTopBottom)){let a=new S(n.x,n.y),l=a.add1(t.borderRadius,t.borderRadius),c=a.add1(0,t.borderRadius),h=a.add1(0,t.borderAtLeftRight?n.height/2:t.borderHeight),u=a.add1(t.borderRadius,0),d=a.add1(t.borderAtTopBottom?n.width/2:t.borderHeight,0);this.addBorderByPoints([[h,c],l,[u,d]],t.borderRadius,n.center,t)}}getIntersects(t,e){let r=[];return t.forEach(i=>{for(let n of i.primitives)if(n instanceof M||n instanceof q){let s=[],a=Pt(e,n),l=n instanceof M&&n.direct&&ne.eq(e.direct.cross(n.direct),0);for(let c=0;c<a;c+=2){let h=new S(Ee[c],Ee[c+1]);s.push(h)}l&&s.length>1?r.push(s):s.length>0&&(r=r.concat(s))}}),r}getInterSections2(t,e,r){let i=new Array;for(let s of t){let a=new Array;for(let l=0;l<s.primitives.length;l++){let c=s.primitives[l],h=Pt(e,c);for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);a.push({polyline:s,polyIndex:l,position:d})}}a.length>0&&(i=i.concat(a))}let n={};return i.forEach(s=>{(!n.up||+s.position[r]>+n.up.position[r])&&(n.up=s),(!n.down||+s.position[r]<+n.down.position[r])&&(n.down=s)}),n}getInterSections(t,e,r){let i=[];t.forEach(s=>{let a=[];for(let l of s.primitives){let c=Pt(e,l);for(let h=0;h<c;h+=2){let u=new S(Ee[h],Ee[h+1]);a.push(u)}}a.length>0&&(i=i.concat(a))});let n={};return i.forEach(s=>{s&&((!n.up||+s[r]>+n.up[r])&&(n.up=s),(!n.down||+s[r]<+n.down[r])&&(n.down=s))}),n}};var Doe=class extends vm{};var woe=class extends cS{constructor(t){super(t),this.decode=new Doe}getDecodeTool(){return this.decode}};var Loe=class extends woe{constructor(t,e){super(t),this._world=e}async onlyCompiler(t=!0,e=!0){t&&await this.init(),e&&await this.destroy()}async buildModel(t=!0,e=!0,r=!0){var n;let i="pcbDataStrDecode-time";Cn(i),t&&await this.init(),e&&await this.destroy(),this.buildDataModels(),this.syncTextFontPath(),r&&this.applyPanelize(),this.updateExpansionByRule(),this.updateDrcRuleConfig((n=this._world.options)==null?void 0:n.ruleCustomConfig),Xi(i)}async destroy(){this.compiler!=null&&await this.compiler.destroy()}buildDataModels(){this.decode.preAdjust(),this.batchBuildItems()}buildCopperData(t){if(!t)return;let e=new xoe;for(let r in t){let i=t[r];e.parse(r,i)}}applyPanelize(){new Roe().applyPanelize()}syncTextFontPath(){io.getInstance().iterator(t=>{if(t.outline&&t.outline.length>0)return;let e=t.getText();if(e==""||e==null){t.outline=[],t.updateBox4(0,0);return}let r=YO(t.globalIndex,t.fontFamily,e,t.fontSize,t.reverse,t.reverseExpansion,t.strokeWidth);r&&r.path&&(t.outline=r.path,t.updateBox4(r.width,r.height));let i=t.fontFamily,n=i==""||i=="default";n&&!cy.everyCharHasDefaultFontPath(e)&&(t.fontFamily="\u9ED1\u4F53",n=!1),n?t.type=0:t.type=1})}ruleInitAndCheck(){new bx().ruleInitAndCheck()}updateExpansionByRule(){bn.getInstance().iterator(t=>{$p(t)}),jn.getInstance().iterator(t=>{$p(t)})}updateDrcRuleConfig(t){if(!t)return;let e=ka.getInstance(),{config:r,isOpenDRCCustomCheck:i}=t;e.isOpenDRCCustomCheck=i,e.updateConfig(r)}};var dGe=Ru(r2());function pGe(o){let{uuid:t,docType:e,projectId:r,env:i}=o,n=i==null?void 0:i.windowTabId;if(n){let s=Q();s&&(s._TAB_ID_=n)}return new gp(t,r,R.getInstance().compilerChannel,n)}var AA=class{constructor(){this.channelIdMapComponentDecode=new Map;this.isMatch=!0;this.items=new Array}async decode(t){let e=pGe(t),r=new Loe(e,t);await r.onlyCompiler(),this.decodeTool=r.getDecodeTool()}hasComponents(){return this.decodeTool.component.length>0}async parseTemplate(t){if(!t)return;await this.decode(t);let e=this.decodeTool;await e.iterator(r=>{r.partition&&(r.partition="")}),e.preAdjust();for(let r of e.component){let i=r.getReuseBlock();if(i!=null){let n=i.getTemplateMapObjectChannelId();KO(this.channelIdMapComponentDecode,n,r)}else{let n=r.attrsMap["Channel ID"];n!=null&&n!=""&&KO(this.channelIdMapComponentDecode,n,r)}}}reuse(t,e,r){let i=this.decodeTool;if(!i)return;this.keepDisabledLayerItem=r;let n=new Map;for(let p of t)if(p.model.modelType==="Component"){let m=p.channelID;m!=null&&KO(n,m,p)}let s=new Map,a=new Map,l=!1;for(let[p,m]of this.channelIdMapComponentDecode){let g=n.get(p);if(g==null)continue;let y=Op(P=>P.getFootprintUUID(),m),b=Op(P=>P.footprintUUID,g);for(let[P,T]of y){let I=b.get(P);if(I!=null)for(let C=0,E=T.length;C<E;C++){let O=T[C],_=I[C];_!=null&&(l=!0,this.syncComponent(_,s,a,O),this.items.push(_))}}}if(!l)return null;this.isMatch=i.component.length==this.items.length,this.copyItems(i.via,s,a),this.copyItems(i.pad,s,a),this.copyItems(i.line,s,a),this.copyItems(i.arc,s,a),this.copyItems(i.poly,s,a),this.copyItems(i.fill,s,a),this.copyItems(i.fpcFill,s,a),this.copyItems(i.region,s,a),this.copyItems(i.pour,s,a),this.copyItems(i.image,s,a),this.copyItems(i.objs,s,a),this.copyItems(i.tearDrop,s,a),this.copyItems(i.str,s,a),this.copyItems(i.dimension,s,a),this.copyItems(i.shells,s,a),this.copyItems(i.shellCuts,s,a),this.copyItems(i.shellEntity,s,a),this.copyItems(i.creases,s,a),this.copyItems(i.bosses,s,a);for(let p of this.items)if(p instanceof lt&&p.type=="TearDrop"){let m=new Array;for(let g of p.getComponent().connects){let y=a[g];y!=null&&m.push(y)}pt.modifyConnect(p,m)}else if(p instanceof He&&p.type=="Copper Region"){let m=p.getComponent();if(m instanceof xn){let g=Ti.nameManager.getNum(m.name);m.name=g,Ti.nameManager.add(g)}}let c=new T0,h=Ht.getAllItem().map(p=>p.name);for(let p of h)c.add(p);let u=e+"_1";return Ht.combination(this.items,c.getUniqueName(u))}syncComponent(t,e,r,i){let n=new Array;xe.addAll(n,t.getPads()),xe.addAll(n,t.getVias());let s=t.globalIndex,a=Op(p=>p instanceof Le?p.num:p.globalIndex.replace(s,""),n),l=Op(p=>p.num,i.padNets),c=new Set,h=new Set;for(let[p,m]of l){let g=a.get(p);if(g!=null){if(m.length==1&&g.length==1)(e.get(m[0].net)==null||g[0]instanceof Le)&&e.set(m[0].net,g[0].net),r.get(i.index+m[0].id)==null&&(r[i.index+m[0].id]=g[0].globalIndex),c.add(g[0]),h.add(m[0]);else for(let y of m)if(!h.has(y)){for(let b of g)if(!c.has(b)&&s+y.id==b.globalIndex){e.set(y.net,b.net),r.set(i.index+y.id,b.globalIndex),c.add(b),h.add(y);break}}}}let u=Op(p=>s+p.id,i.padNets);for(let p of n){if(!c.has(p)){for(let m of i.padNets)if(!h.has(m)&&p.globalIndex==s+m.id){e.set(m.net,p.net),r.set(i.index+m.id,p.globalIndex),c.add(p),h.add(m);break}}if(p instanceof Le&&u.get(p.globalIndex)){let m=u.get(p.globalIndex)[0];m.padLen!=null&&$o.getInstance().setPadLenByModel(p.model,m.padLen)}}for(let p of n)if(!c.has(p)){for(let m of i.padNets)if(!h.has(m)){e.get(m.net)==null&&e.set(m.net,p.net),r.set(i.index+m.id,p.globalIndex),c.add(p),h.add(m);break}}t.layerId=i.layerId,t.position=i.position,t.rotation=i.rotation;let d=Op(p=>p.key,i.attrs);for(let[p,m]of d){let g=m[0],y=t.attrKeyText[p];if(y!=null)y.model.layerId=g.layerId,g.x!=null&&g.y!=null?y.model.position=new S(g.x,g.y):y.model.positionIsNull=!0,y.model.rotation=g.angle,y.model.fontSize=g.fontSize,y.model.strokeWidth=g.strokeWidth,y.model.reverse=g.reverse,y.model.reverseExpansion=g.reverseExpansion,y.model.showKey=g.showKey,y.model.showValue=g.showValue,y.model.origin=g.origin,y.model.mirror=g.mirror,y.fontFamily=g.fontFamily,ep.addText(y);else{g.index=t.generateValidId();let b=t.attrKeyValue[p];b!=null&&(g.value=b);let P=g.finish(),T=ri.addtextByModel(P);t.addAttribute(T)}}}hasItems(){let t=this.decodeTool;if(t)return t.component.length>0||t.via.length>0||t.pad.length>0||t.line.length>0||t.arc.length>0||t.poly.length>0||t.fill.length>0||t.fpcFill.length>0||t.region.length>0||t.pour.length>0||t.image.length>0||t.objs.length>0||t.tearDrop.length>0||t.str.length>0||t.dimension.length>0||t.shells.length>0||t.shellCuts.length>0||t.shellEntity.length>0||t.creases.length>0||t.bosses.length>0}copy(t,e){let r=this.decodeTool;if(!r)return;this.keepDisabledLayerItem=e;let i=new Map,n=new Map;this.copyItems(r.component,i,n),this.copyItems(r.via,i,n),this.copyItems(r.pad,i,n),this.copyItems(r.line,i,n),this.copyItems(r.arc,i,n),this.copyItems(r.poly,i,n),this.copyItems(r.fill,i,n),this.copyItems(r.fpcFill,i,n),this.copyItems(r.region,i,n),this.copyItems(r.pour,i,n),this.copyItems(r.image,i,n),this.copyItems(r.objs,i,n),this.copyItems(r.tearDrop,i,n),this.copyItems(r.str,i,n),this.copyItems(r.dimension,i,n),this.copyItems(r.shells,i,n),this.copyItems(r.shellCuts,i,n),this.copyItems(r.shellEntity,i,n),this.copyItems(r.creases,i,n),this.copyItems(r.bosses,i,n);for(let h of this.items)if(h instanceof lt&&h.type=="TearDrop"){let u=new Array;for(let d of h.getComponent().connects){let p=n[d];p!=null&&u.push(p)}pt.modifyConnect(h,u)}else if(h instanceof He&&h.type=="Copper Region"){let u=h.getComponent();if(u instanceof xn){let d=Ti.nameManager.getNum(u.name);u.name=d,Ti.nameManager.add(d)}}let s=new T0,a=Ht.getAllItem().map(h=>h.name);for(let h of a)s.add(h);let l=t+"_1",c=Ht.combination(this.items,s.getUniqueName(l));for(let h of this.items)h instanceof ke&&(h.reuseBlock=t,h.combinationID==""&&(h.combinationID=c.globalIndex));return c}copyItems(t,e,r){try{let i=this.keepDisabledLayerItem;t=t.sort((a,l)=>a.order-l.order);let n=un.getOrders(),s=new Map;for(let a in n){let l=n[a],c=l[l.length-1].getComponent().order;s.set(+a,c)}t.forEach(a=>{if(a.layerId!=null){let u=Pe.getLayer(a.layerId);if(u==null||!i&&!u.config)return}let l=a.keepDisabledLayerItem;i&&(a.keepDisabledLayerItem=!0),a.clearGroupId(),a.changeNet4Map(e);let c=nr();r.set(a.index,c),a.index=c;let h=Xc(a.finish());h!=null&&h instanceof Ls&&(h instanceof He&&h.type==="Copper Region"&&(h.getComponent().order=(s.get(h.layerId)||0)+1,s.set(h.layerId,h.getComponent().order)),this.items.push(h)),i&&(a.keepDisabledLayerItem=l)})}catch(i){console.log(i)}}getItems(){return this.items}getBasicLayerTable(t){let e={},r=this.decodeTool.layer,i=t.size,n=0;return sc(r,s=>{let a=s.layerId;if(t.has(a)){let l=s.getType(),c=s.getName(),h={layerId:a,layerType:l,layerName:c};e[a]=h,n++}return n==i}),e}};var Moe=class extends Qd{constructor(t="2.0"){super(t,3)}saveCombination(t){this.saveCommonData();let e=new Array,r=new Array,i=new Set,n=new Set;for(let s of t){if(s instanceof Jr){i.add(s.model);continue}if(s.model.modelType=="Inner"){n.add(s.model);continue}if(s instanceof ke?r.push(s):e.push(s.model),s instanceof He&&s.type=="Copper Region")for(let a of s.copperResultMap||[])i.add(a.model)}return this.feedItems(e),this.feedCopper(Array.from(i)),this.feedInner(Array.from(n)),r.forEach(s=>{this.feed("COMPONENT",s.model),s.attributes.forEach(h=>{$d(h.model,s.model)&&this.feed("ATTR",h.model)}),s.getPads().forEach(h=>{this.feed("PAD_NET",h.model)}),s.getItems().filter(h=>h instanceof Ue).forEach(h=>{this.feed("PAD_NET",h.model)})}),this.getFile()}};function fGe(o){let t=new Moe().saveCombination(o),e=new _F().getCombinationPourResult(o),r=new Set,i=new Set,n=new Array,s=new Set;for(let l of o)if(l instanceof ke){let c=ts.getItem(l.deviceUUID);if(r.add(c),c.footprintUUID!=null){let u=Hi.getItem(l.footprintUUID);i.add(u)}let h=Hi.getItem(l.footprintUUID);if(h instanceof Sc){n.push(h);let u=Hi.getItem(h.source);i.add(u)}else i.add(h)}else l instanceof Ps&&s.add(l.hashId);let a=new Array;for(let l of r){let c=l.attrs;c.uuid=l.uuid,c.utime=l.utime.toString(),c.Footprint=l.footprintUUID,a.push(["DEVICE",l.name,c])}for(let l of i)a.push(["FOOTPRINT",l.footprintId,l.uuid,l.updateTime,l.getSource()]);for(let l of n)a.push(["CUSTOMFOOTPRINT",l.footprintId,l.source,l.uuid,l.getSource()]);return{dataStr:t,copper:e,template:a,blob:s}}function mGe(){let o=Ar.getAllItem(),t=new Map,e=new Map;for(let r of o)if(r.reuseBlock!=""){let i=e.get(r.reuseBlock);i==null&&(i=new Map,e.set(r.reuseBlock,i));let n=i.get(r.combinationID);n==null&&(n=new Array,i.set(r.combinationID,n)),n.push(r)}for(let[r,i]of e)for(let[n,s]of i){let a=r+"_"+n,l=new Set;for(let c of s)if(l.add(c),c.getGroupID()!=null){let h=Ht.getItem(c.getGroupID());if(h!=null){let u=h.getItems();for(let d of u)l.add(d)}}l.size>0&&t.set(a,{items:l,title:r})}return t}var Noe=class extends bi{open(t,e){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let r={};r.action="reuse-template-dialog";let i=mGe(),n={},s=new Set,a=R.getInstance().tabId;for(let[l,c]of i){let h=fGe(c.items),u=c.title;s.add(u),h.title=c.title,h.tabId=a,n[l]=h,h.isSelected=!0}return r.CBB=n,r.CBBTitle=Array.from(s),r}modify(t){}async close(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;if(t.action=="confirm"){let r=t.selects,i=t.pcbModule,n=new Set,s=new hi;s.createGroup("Reuse Template for PCB Template");let a={},l=new Map,c=new Map,h=Ar.getAllItem();for(let u of h){u.reuseBlock==""&&u.combinationID!=null&&u.combinationID!=""&&KO(l,u.combinationID,u);let d=c.get(u.reuseBlock);d==null&&(d=new Map,c.set(u.reuseBlock,d));let p=d.get(u.combinationID);p==null&&(p=[],d.set(u.combinationID,p)),p.push(u)}for(let u of r){let d=u.title,p=i[d];if(p==null)continue;let m=u.key.replace(d+"_",""),g=this.getComponents(c,d,m),y=l[m];if(y!=null)for(let E of y)g.push(E);let{bbox:b,pourMaxOrder:P}=this.preprocessComponents(g,s),T=new AA;await T.parseTemplate(p);let I=d+"_"+m,C={title:d,groupId:m,decoder:T,components:g,bbox:b,pourMaxOrder:P};a[I]=C}for(let u in a){let{title:d,components:p,decoder:m,bbox:g,pourMaxOrder:y}=a[u],b=m.reuse(p,d);if(b!=null){m.isMatch||n.add(b.name);let P=b.buildBBox(),T=Ae.translate(g.minX-P.minX,g.maxY-P.maxY,0),I=b.getItems(),C=[];for(let E of I)if(E.transform(T),!(E instanceof ke)){if(E instanceof He&&E.type=="Copper Region"){let O=C[E.layerId];O==null&&(O=new Array,C[E.layerId]=O),O.push(E);continue}s.addCommand4Item(E,"add")}for(let E in C){let O=y[E];O!=null&&un.insertAfter(C[E],O,s.getCommand());for(let _ of C[E])s.addCommand4Item(_,"add")}s.addCommand4Item(b,"add")}}if(n.size>0){let u=R.getInstance().tabId,d=[];for(let p of n){let g={attr:{id:Ht.getGroupByName(p).globalIndex,pcbid:u},text:p};d.push(g)}A.publish("ui/toastMsg",{type:"warn",msg:["The number of components in the following group templates is inconsistent with the reuse group, and the missing components are automatically ignored:",...n],bottomBarMsg:{type:"warn",msg:['<span class="i18n">The number of components in the following group templates is inconsistent with the reuse group, and the missing components are automatically ignored:</span>',...d]}},Q())}s.execute(),A.publish("autoFill","")}return!0}getComponents(t,e,r){let i=t.get(e);return i==null?null:i.get(r)}preprocessComponents(t,e){let r=null,i=null,n=new _e,s={};for(let a of t)e.addCommand4Item(a,"modify"),n.ext1(a.buildBBox()),r=a.getGroupID(),r!=null&&(i=Ht.getItem(r),i!=null&&(n.ext1(i.buildBBox()),this.preprocessCombination(i,e,s)));return n.valid()?{bbox:n.build1(),pourMaxOrder:s}:{bbox:null,pourMaxOrder:s}}recodeCopperOrder(t,e){if(t.type=="Copper Region"){let r=un.getOrder(t.globalIndex);if(r!=null){let i=t.layerId,n=e[i];if(n==null){e[i]=t;return}n.getComponent().order>r&&(e[i]=t)}}}preprocessCombination(t,e,r){e.addCommand4Item(t,"delete");let i=Array.from(t.getItems());t.dissolution(),A.publish("delete",t);for(let n of i)n instanceof ke||(n instanceof He&&this.recodeCopperOrder(n,r),e.addCommand4Item(n,"delete"),n.remove(),A.publish("delete",n))}};var pSe=class{updateAllSubstrateHeight(t){if(!oh(t))return;let e=this.getAllOutline();for(let r of e){let i=r.getComponent();i.substrateHeight=t}}getOneOutline(){let t=Xt.getAllItem();for(let e of t)if(e.type==="3D Shell - Outline")return e;t=pt.getAllItem();for(let e of t)if(e.type==="3D Shell - Outline")return e;t=Kt.getAllItem();for(let e of t)if(e.type==="3D Shell - Outline")return e;return null}getAllOutline(){let t=Xt.getAllItem(),e=Kt.getAllItem(),r=pt.getAllItem();return this.filterOutline(t,e,r)}filterOutline(...t){let e=[];for(let r of t)for(let i of r)i instanceof He&&i.type=="3D Shell - Outline"&&e.push(i);return e}correctPushCoverWidthAndHeight(t,e){let r=!1;if(t.type!=="DRAWER")return r;let n=new dt().conversion("mm","mil",5/10),s=n,a=n,{width:l,height:c}=e;return Hb()?(s=c>l?s:l/c*a,a=c>l?c/l*s:a,(l<s||c<a)&&(e.height=a,e.width=s,r=!0)):(l<s&&(e.width=s,r=!0),c<a&&(e.height=a,r=!0)),r}},m6=new pSe;var koe=class{constructor(){this.timeout=null;he.subscribe("CopperOrderUndo",()=>{this.debounce(this.sendCopperOrderUndoSuccess)}),he.subscribe("CopperOrderRedo",()=>{this.debounce(this.sendCopperOrderRedoSuccess)})}debounce(t){this.timeout!=null&&clearTimeout(this.timeout),this.timeout=setTimeout(()=>{t(),this.timeout=null},10)}sendCopperOrderUndoSuccess(){he.publish("ui/toastMsg",{type:"info",msg:"Undo successful, the copper priority has been modified in this operation"},Q())}sendCopperOrderRedoSuccess(){he.publish("ui/toastMsg",{type:"info",msg:"Redo successful, the copper priority has been modified in this operation"},Q())}};var fSe=class{constructor(){this.path=[]}getPath(){return Array.from(this.path)}clear(){this.path.forEach(t=>t.remove()),this.path.length=0}dis(t,e=3,r={}){r=typeof r=="number"?{width:r}:r;let i={width:.1,showPointAsFork:!0,arrowLayerIdOrColor:ee.Silver,arrowAngle:30,...r};i.arrowLength=i.arrowLength?i.arrowLength:Math.min(i.width*6,.6),t=Array.isArray(t)?t:[t];let n=this.getPts(t),s=[];n=n.filter(h=>{if(h.length()>=1e-8)return!0;s.push(h)});let a=i.arrow?this.getArrowPts(n,i.arrowAngle,i.arrowLength):[],l=this.getColor(e),c=this.getColor(i.arrowLayerIdOrColor);this.displayPrimitives(n,i.width,l),this.displayPrimitives(a,i.width,c),i.showPointAsFork&&this.disP(s)}disP(t,e=ee.GREEN,r=.7){t=Array.isArray(t)?t:[t];let i=this.getPts(t),n=this.getColor(e),s=i.flatMap(c=>[c.start(),c.end()]),a=r/2,l=s.flatMap(c=>{let u=new _e().ext2(c).ext7(a).build1(),d=new M(u.UL(),u.LR()),p=new M(u.LL(),u.UR());return this.displayPrimitives([d,p],.05,n)});this.path.push(...l)}disA(t,e=ee.Silver,r){this.dis(t,3,{width:.15,arrow:!0,arrowLayerIdOrColor:e,arrowLength:r})}disFromMath(t,e,r){var s;let i=t;if(i instanceof mn)return;let n=(s=i.model)==null?void 0:s.getMathGraphics(e||(i==null?void 0:i.layerId));n&&this.dis(n,r)}getColor(t){return typeof t=="number"?Ze.getInstance().getLayer(t).activeColor:t}getArrowPts(t,e,r){return t.flatMap(i=>{let n=S.ORIGIN;if(i instanceof M)n=i.direct;else if(i instanceof q){let d=i.end().sub(i.center);n=new S(d.y,-d.x).normalize(),(d.cross(n)<0&&i.sweep()===ae.CCW||d.cross(n)>0&&i.sweep()===ae.CW)&&(n=n.mul(-1))}let s=i.end(),a=e/180*Math.PI,l=n.rotate(S.ORIGIN,a),c=n.rotate(S.ORIGIN,-a),h=new M(s.sub(l.mul(r)),s),u=new M(s.sub(c.mul(r)),s);return[h,u]})}getPts(t){let e=[];return t.forEach((r,i)=>{if(r instanceof S)e.push(new M(r,r));else if(r instanceof ht){let n=[r.UL(),r.UR(),r.LR(),r.LL(),r.UL()],s=[];for(let a=0;a<n.length-1;a++)s.push(new M(n[a],n[a+1]));e.push(...s)}else r instanceof ge?e.push(...r.primitives):r instanceof M||r instanceof q?e.push(r):(r instanceof Ir||r instanceof Id||r instanceof yi)&&e.push(r.primitive)}),e}displayPrimitives(t,e,r=ee.BLACK){let i=[];for(let n of t)if(n instanceof M)i.push(Vi.build(1002,n.start(),n.end(),e,r));else if(n instanceof q){let s=n.sweep(),a=n.startAngle%360,l=n.endAngle()%360;a<0&&(a=360+a),l<0&&(l=360+l);let c=Xh(a),h=Xh(l);ne.eq(a,l)&&(a>l&&(h=a-1e-8),a<l&&(h=a+1e-8)),i.push(es.build(1002,n.center,n.rx,e,c,h,s,r))}return i.forEach(n=>n.refreshRender()),this.path.push(...i),i}log(t){let e=this.getPts(t);console.log(),console.log("------------------- ShowPl -------------------"),console.log("\u81EA\u76F8\u4EA4 ",Eo(ge.build2(e))?"Yes":"No");let r=(()=>{let a=[];for(let l=0;l<e.length;l++){let c=e[l-1],h=e[l];if(l===0)a.push([0]);else{if((c instanceof M||c instanceof q)&&(h instanceof M||h instanceof q)&&c.end().distance1(h.start())<1e-8){a[a.length-1].push(l);continue}a.push([l])}}return a})();console.log("\u6309\u662F\u5426\u8FDE\u7EED\u5206\u7EC4(\u8BEF\u5DEE1e-8) ",r);let i=e.length>1&&r.length==1&&e[0].start().distance1(e[e.length-1].end())<1e-8;console.log("\u662F\u5426\u95ED\u5408\u591A\u8FB9\u5F62 ",i);let n=a=>`${a.x}, ${a.y}`,s=e.map(a=>{if(a instanceof M)return{Type:"L",Start:n(a.start()),End:n(a.end()),Len:a.length()};if(a instanceof q){let l={radius:a.rx,startAngle:a.startAngle,endAngle:a.endAngle(),sweep:a.sweep()===ae.CCW?"\u9006":"\u987A"};return{Type:"Arc",Start:n(a.start()),End:n(a.end()),Len:a.length(),Data:JSON.stringify(l)}}return{Type:"\u7A7A"}});console.table(s,["Type","Start","End","Len","Data"]),console.log(e),console.log("------------------- ShowPl -------------------"),console.log()}},g6=new fSe;function gGe(o,t=1){let e=new Array;return o.forEach(r=>{let i=new Array,n=r.primitives,s=!1;for(let a of n)if(a instanceof M)i.push(a.start().x*t),i.push(a.start().y*t),s||(i.push("L"),s=!0);else if(a instanceof q)s=!1,i.push(a.start().x*t),i.push(a.start().y*t),i.push("ARC"),i.push(a.sweepAngle);else if(a instanceof Dr){s=!1,i.push(a.start().x*t),i.push(a.start().y*t),i.push("C");for(let l=1,c=a.controls.length;l<c-1;l++){let h=a.controls[l];i.push(h.x*t),i.push(h.y*t)}}i.length>2&&(i.push(n[n.length-1].end().x*t),i.push(n[n.length-1].end().y*t),e.push(i))}),e}var yGe=re.getInstance(),r4n=ka.getInstance(),Boe=class{constructor(){this.drcMap=$i.getInstance().drcMap;this.toBeCheckMap={};this.filter=new P1;this.maxClearances={}}updates(t,e={}){var i;let r=0;for(let n of t)this.update(n,e),(i=e.callback)==null||i.call(e,++r/t.length);return this.getMap()}update(t,e){let{checkSameNet:r,forceCheckPair:i,excludeCheckPair:n}=e,s=this.drcMap;this.filter.checkSameNet=r;let a=this.getShapeMaxClearance(t,ei.isHole(t)),l=t.buildBBox().extendOfSize(a),c=t.layerId,h=d=>c==11||c==12||d==11||d==12?!0:d==c,u=s.search(l,h);for(let d of u)this.hasInMap(t,d)||!(i&&i([t,d]))&&(n&&!n([t,d])||!this.filter.check(t,d))||this.add2BeCheckMap(t,d,3);for(let d of u){let p=ei.getModelPairHoleStatus(t,d);if(p==3)continue;let m=g=>{let y=this.filter.isOpenDRCCustomCheck(),b=this.filter.checkHole(t,d,g);if(this.hasInMap(t,d,g))return;if(!(i?i([t,d]):!1)){if(n&&!n([t,d]))return;y||g!==3&&this.filter.commonCheck(t,d,g)&&this.add2BeCheckMap(t,d,g),y&&b&&this.add2BeCheckMap(t,d,g)}};p==2?(m(0),m(1),m(2)):m(p)}}getModelPairStatus(t,e){return/hole_/.test(t)&&/hole_/.test(e)?2:/hole_/.test(t)&&!/hole_/.test(e)?0:!/hole_/.test(t)&&/hole_/.test(e)?1:3}getMap(){let t=[];for(let e in this.toBeCheckMap){let r=this.toBeCheckMap[e];for(let i in r){let n=r[i];t.push([].concat(n,[this.getModelPairStatus(e,i)]))}}return t}getShapeMaxClearance(t,e){let r=l1(t);if(this.maxClearances[r]==null&&(this.maxClearances[r]=yGe.getItemMaxClearance(r)),e){let i={};i[12]=yGe.getItemMaxClearance(12),this.maxClearances[r]<i[12]&&(this.maxClearances[r]=i[12])}return this.maxClearances[r]}hasInMap(t,e,r){let[i,n]=this.getMapIds(t,e,r);return this.toBeCheckMap[i]&&this.toBeCheckMap[i][n]}add2BeCheckMap(t,e,r){let{globalIndex:i}=t,{globalIndex:n}=e;switch(r){case 0:i="hole_"+i;break;case 1:n="hole_"+n;break;case 2:i="hole_"+i,n="hole_"+n;break}let s=this.compareIds(i,n)>0;if(s){let a=i;i=n,n=a}this.toBeCheckMap[i]==null&&(this.toBeCheckMap[i]={}),this.toBeCheckMap[i][n]=s?[e,t]:[t,e]}compareIds(t,e){let r=/([a-zA-Z]+|\d+)/g,i=t.match(r),n=e.match(r);for(let s=0;s<Math.min(i.length,n.length);s++){let a=i[s],l=n[s],c=!isNaN(Number(a)),h=!isNaN(Number(l));if(c&&h){let u=parseInt(a,10),d=parseInt(l,10);if(u!==d)return u-d}else{if(c)return-1;if(h)return 1;if(a!==l)return a.localeCompare(l)}}return i.length-n.length}getMapIds(t,e,r){let{globalIndex:i}=t,{globalIndex:n}=e;switch(r){case 0:i="hole_"+i;break;case 1:n="hole_"+n;break;case 2:i="hole_"+i,n="hole_"+n;break}return[i,n].sort(this.compareIds)}};var _u=class{constructor(t,e,r=null,i){this.relate=t,this.distance=e,this.line=r,this._holeState=i}syncCollideLayerIds(t){t&&t.length>0&&(t=t.filter(e=>e!==11),this.collideLayerIds=t)}};var FI=class extends Wk{checkCache(t,e,r){let i=[];if(t instanceof md){if(e instanceof md){let n=(t.width+e.width)/2,s=this.check(t.shape,e.shape,n+r);s=this.getResSubWidth(s,n),i.push(s)}else if(e instanceof Yd){let n=(t.width+e.width)/2,s=e.getShapes(t.shape,n+r);for(let a of s){let l=this.check(t.shape,a,n+r);l=this.getResSubWidth(l,n),i.push(l)}}else if(e instanceof ku){let n=t.width/2,s=this.check(t.shape,e.shape,n+r);s=this.getResSubWidth(s,n),i.push(s)}else if(e instanceof qu){let n=(t.width+e.width)/2,s=this.check(t.shape,e.shape,n+r);s=this.getResSubWidth(s,n),i.push(s)}}else if(t instanceof Yd){if(e instanceof md){let n=(t.width+e.width)/2,s=t.getShapes(e.shape,n+r);for(let a of s){let l=this.check(e.shape,a,n+r);l=this.getResSubWidth(l,n),i.push(l)}}else if(e instanceof Yd){let n=t.shape,s=(t.width+e.width)/2;for(let a of n){let l=e.getShapes(a,s+r);for(let c of l){let h=this.check(c,a,s+r);h=this.getResSubWidth(h,s),i.push(h)}}}else if(e instanceof ku){let n=t.width/2,s=t.getShapes(e.shape,n+r);for(let a of s){let l=this.check(e.shape,a,n+r);l=this.getResSubWidth(l,n),i.push(l)}}else if(e instanceof qu){let n=(t.width+e.width)/2,s=t.getShapes(e.shape,n+r);for(let a of s){let l=this.check(e.shape,a,n+r);l=this.getResSubWidth(l,n),i.push(l)}}}else if(t instanceof ku){if(e instanceof md){let n=e.width/2,s=this.check(t.shape,e.shape,n+r);s=this.getResSubWidth(s,n),i.push(s)}else if(e instanceof Yd){let n=e.width/2,s=e.getShapes(t.shape,n+r);for(let a of s){let l=this.check(t.shape,a,n+r);l=this.getResSubWidth(l,n),i.push(l)}}else if(e instanceof ku){let n=this.check(t.shape,e.shape,r);i.push(n)}else if(e instanceof qu){let n=e.width/2,s=this.check(t.shape,e.shape,n+r);s=this.getResSubWidth(s,n),i.push(s)}}else if(t instanceof qu){if(e instanceof md){let n=(t.width+e.width)/2,s=this.check(t.shape,e.shape,n+r);s=this.getResSubWidth(s,n),i.push(s)}else if(e instanceof Yd){let n=(t.width+e.width)/2,s=e.getShapes(t.shape,n+r);for(let a of s){let l=this.check(t.shape,a,n+r);l=this.getResSubWidth(l,n),i.push(l)}}else if(e instanceof ku){let n=t.width/2,s=this.check(t.shape,e.shape,n+r);s=this.getResSubWidth(s,n),i.push(s)}else if(e instanceof qu){let n=(t.width+e.width)/2,s=this.check(t.shape,e.shape,n+r);s=this.getResSubWidth(s,n),i.push(s)}}return Er(i,(n,s)=>n.distance-s.distance),i[0]}getResSubWidth(t,e){return t===null?null:new _u(t.relate,Math.max(t.distance-e,0),t.line)}adjustCollisionLine(t,e,r){if(t===null)return null;if(ne.eq(t.length(),0))return t;let i=this.determinePointOwner(t.start(),e,r),n=this.determinePointOwner(t.end(),e,r);if(i===n)return t;let s=this.getHalfWidth(e),a=this.getHalfWidth(r),l=t.end().sub(t.start()).normalize(),c,h;i===1?(c=t.start().add(l.mul(s)),h=t.end().sub(l.mul(a))):(c=t.end().sub(l.mul(s)),h=t.start().add(l.mul(a)));let u=c.add(h).mul(.5);return new M(u,u)}determinePointOwner(t,e,r){let i=this.getDistanceToCacheMidline(t,e),n=this.getDistanceToCacheMidline(t,r);return i<=n?1:2}getDistanceToCacheMidline(t,e){if(e instanceof md){let r=e.shape;return er.getMinDistanceFromPoint(t,r)}else{if(e instanceof ku)return this.getMinDistanceFromPrimitives(t,e.shape.primitives);if(e instanceof qu){let r=[];for(let i of e.shape.items)r.push(...i.primitives);if(r.length>7){let i=this.getPrimitiveRTree(r),n=t.bbox().extendOfSize(1e-6),s=i.search(n);if(s.length===0){let a=this.getMaxBBox(r),l=t.bbox().extendOfSize(Math.max(a.width(),a.height())),c=i.search(l);return this.getMinDistanceFromPrimitives(t,c)}return this.getMinDistanceFromPrimitives(t,s)}return this.getMinDistanceFromPrimitives(t,r)}}return Number.MAX_VALUE}getHalfWidth(t){return t instanceof md||t instanceof qu?t.width/2:0}getMinDistanceFromPrimitives(t,e){let r=Number.MAX_VALUE;for(let i of e){let n=er.getMinDistanceFromPoint(t,i);n<r&&(r=n)}return r}getMaxBBox(t){let e=null;for(let r of t){let i=r.bbox();e===null?e=i:e=ht.extend2(e,i)}return e||new ht(0,0,0,0)}getPrimitiveRTree(t){let e=new ji(7);for(let r of t)e.add(r);return e}check(t,e,r){if(!t.bbox().isIntersect(e.bbox().extendOfSize(r)))return new _u(3,Number.MAX_VALUE);if(t instanceof rl){if(e instanceof rl)return this.checkPts(t,e,r);if(e instanceof ge)return this.checkPt2Pl(t,e,r);if(e instanceof Bt)return this.checkPt2PlGrp(t,e,r)}else if(t instanceof ge){if(e instanceof rl)return this.checkPt2Pl(e,t,r);if(e instanceof ge)return this.checkPls(t,e,r);if(e instanceof Bt)return this.checkPl2PlGrp(t,e,r)}else if(t instanceof Bt){if(e instanceof rl)return this.checkPt2PlGrp(e,t,r);if(e instanceof ge)return this.checkPl2PlGrp(e,t,r);if(e instanceof Bt)return this.checkPlGrps(t,e,r)}}checkPts(t,e,r){let i=new er(t,e),n=i.getDistance(),s=ne.lesseq(n,r)?0:3;return new _u(s,i.getDistance(),i.getLine())}checkPt2Pl(t,e,r){let i=!0,n=jr.inPolyline(t.start(),e);if(n||(n=jr.inPolyline(t.end(),e),i=!1),n){let s=i?t.start():t.end();return new _u(0,0,new M(s,s))}else{let s=3,a=Number.MAX_VALUE,l=null,c=t.bbox().extendOfSize(r);for(let h of e.primitives){if(this.isPoints(h)||!c.isIntersect(h.bbox()))continue;let u=new er(h,t),d=u.getDistance(),p=u.getLine();if(ne.less(d,a)&&(a=d,l=p),ne.lesseq(a,r)&&(s=0),ne.eq(a,0))break}return new _u(s,a,l)}}checkPt2PlGrp(t,e,r){let i=jr.inPolygon(t.start(),e.items);if(i||(i=jr.inPolygon(t.end(),e.items)),i){let n=t.start().add(t.end()).mul(.5);return new _u(0,0,new M(n,n))}else{let n=3,s=Number.MAX_VALUE,a=null,l=t.bbox().extendOfSize(r),h=this.getRtree(e).search(l);for(let u of h){if(this.isPoints(u)||!l.isIntersect(u.bbox()))continue;let d=new er(u,t),p=d.getDistance(),m=d.getLine();if(ne.less(p,s)&&(s=p,a=m),ne.lesseq(s,r)&&(n=0),ne.eq(s,0))break}return new _u(n,s,a)}}checkPls(t,e,r){let i=jr.inPolyline(t.start(),e);if(i||(i=jr.inPolyline(e.end(),t)),i)return new _u(0,0,new M(t.start(),t.start()));{let n=3,s=Number.MAX_VALUE,a=null;for(let l of t.primitives){if(this.isPoints(l))continue;let c=l.bbox().extendOfSize(r);if(c.isIntersect(e.bbox())){for(let h of e.primitives){if(this.isPoints(h)||!c.isIntersect(h.bbox()))continue;let u=new er(l,h),d=u.getDistance(),p=u.getLine();if(ne.less(d,s)&&(s=d,a=p),ne.lesseq(s,r)&&(n=0),ne.eq(s,0))break}if(ne.eq(s,0))break}}return new _u(n,s,a)}}checkPl2PlGrp(t,e,r){let i=jr.inPolygon(t.start(),e.items);if(i||(i=jr.inPolyline(e.items[0].start(),t)),i)return new _u(0,0,new M(t.start(),t.start()));{let n=3,s=Number.MAX_VALUE,a=null,l=this.getRtree(e);for(let c of t.primitives){if(this.isPoints(c))continue;let h=c.bbox().extendOfSize(r),u=l.search(h);for(let d of u){if(this.isPoints(d)||!h.isIntersect(d.bbox()))continue;let p=new er(d,c),m=p.getDistance(),g=p.getLine();if(ne.less(m,s)&&(s=m,a=g),ne.lesseq(s,r)&&(n=0),ne.eq(s,0))break}if(ne.eq(s,0))break}return new _u(n,s,a)}}checkPlGrps(t,e,r){let i=jr.inPolygon(t.items[0].start(),e.items),n=new M(t.items[0].start(),t.items[0].start());if(i||(i=jr.inPolygon(e.items[0].start(),t.items),n=new M(e.items[0].start(),e.items[0].start())),i)return new _u(0,0,n);{let s=3,a=Number.MAX_VALUE,l=null;if(t.bbox().area()>e.bbox().area()){let c=this.getRtree(t);for(let h of e.items)for(let u of h.primitives){if(this.isPoints(u))continue;let d=u.bbox().extendOfSize(r),p=c.search(d);for(let m of p){if(this.isPoints(m)||!d.isIntersect(m.bbox()))continue;let g=new er(m,u),y=g.getDistance(),b=g.getLine();if(ne.less(y,a)&&(a=y,l=b),ne.lesseq(a,r)&&(s=0),ne.eq(a,0))break}}}else{let c=this.getRtree(e);for(let h of t.items)for(let u of h.primitives){if(this.isPoints(u))continue;let d=u.bbox().extendOfSize(r),p=c.search(d);for(let m of p){if(this.isPoints(m)||!d.isIntersect(m.bbox()))continue;let g=new er(m,u),y=g.getDistance(),b=g.getLine();if(ne.less(y,a)&&(a=y,l=b),ne.lesseq(a,r)&&(s=0),ne.eq(a,0))break}}}return new _u(s,a,l)}}};var Foe=class{constructor(t,e,r){this.id1=t,this.id2=e,this.relation=r}getResult(){let{id1:t,id2:e,relation:r}=this,{relation:i,distance:n,line:s,holeState:a,collideLayerIds:l}=r;return{id1:t,id2:e,relation:i,distance:n,line:s,collideLayerIds:l,...a!==void 0&&{holeState:a}}}};var H3=class{constructor(){this.collisionAl=new FI;this.copperLayerIds=Ze.getInstance().getAllCopperLayerId4Order();this.drcEnv=$i.getInstance();this.drcEnv.checkEnv==0&&(this.result=new Array)}initCheckFunc(t,e){let r=this.curryCommonCheck(t,e);return(i,n)=>{let s=r(i,n);return this.check2Result(t,e,s)}}getRuleInfos(t,e,r,i){let n=ay(r,i);return this.drcEnv.ruleHelper.getShape2Clearance(t,e,void 0,this._holeStatus,n)}commonCheck(t,e,r=t.layerId,i=e.layerId){let n=this.getRuleInfos(t,e,r,i),s=ei.isProhibit(t)||ei.isProhibit(e),a=Math.max(ve(n.clearance,2),0);if(!s&&!this.drcEnv.checkSameNet&&a===0)return;let l=jc.getCache(t,r),c=jc.getCache(e,i),h=this.collisionAl.checkCache(l,c,a);return h&&(h.ruleInfos=n),h}curryCommonCheck(t,e){return(r,i)=>{let n=this.commonCheck(t,e,r,i);return n!=null&&(this._holeStatus!==void 0&&(n._holeState=this._holeStatus),n.syncCollideLayerIds([r,i])),n}}check2Result(t,e,r){return r&&this.checkIsDRCError(t,e,r)?(this.drcEnv.checkEnv==0?((t.modelType=="Copper"||t.modelType=="Inner")&&this.drcEnv.filterCopper(t),(e.modelType=="Copper"||e.modelType=="Inner")&&this.drcEnv.filterCopper(e),this.result.push(new Foe(t.globalIndex,e.globalIndex,{distance:r.distance,line:r.line,relation:r.relate,holeState:r._holeState,collideLayerIds:r.collideLayerIds}))):D0.addError_Worker({shape1:t,shape2:e,distance:r.distance,line:r.line,relation:r.relate,collideLayerIds:r.collideLayerIds,...r._holeState!==void 0&&{holeState:r._holeState},ruleInfos:r.ruleInfos}),!0):!1}checkIsDRCError(t,e,r){if(!r)return!1;let i=ve(r.distance,2);if(ei.isProhibit(t)||ei.isProhibit(e))return i===0;let n=ve(r.ruleInfos.clearance,2);return n<0?!1:this.drcEnv.checkSameNet?i<=n:i<n}swapHoleStatus(){this._holeStatus==0?this._holeStatus=1:this._holeStatus==1&&(this._holeStatus=0)}};var Voe=class extends H3{checkShapeRelation(t,e,r){let i=this.initCheckFunc(t,e);if(r!==void 0&&(r==0&&(r=1),this._holeStatus=r),!(e instanceof or&&ei.isProhibit(e)&&!e.component.copper))if(e instanceof et){if((this._holeStatus===void 0||this._holeStatus==3)&&!e.isUnuseLayer(t.layerId)&&i(t.layerId,t.layerId)||e.layerId==12&&this._holeStatus==1&&i(t.layerId,12))return}else return e instanceof Ct?(!e.isContains(t.layerId)||(this._holeStatus===void 0||this._holeStatus==3)&&!e.isUnuseLayer(t.layerId)&&i(t.layerId,t.layerId)||this._holeStatus==1&&i(t.layerId,12),void 0):i(t.layerId,t.layerId)}};var Goe=class extends H3{checkShapeRelation(t,e,r){let i=this.initCheckFunc(t,e);if(r!==void 0&&(r==0&&(r=1),this._holeStatus=r),!(e instanceof or&&ei.isProhibit(e)&&!e.component.planzone)){if(e instanceof yn)return i(t.layerId,e.layerId);if(e instanceof et){if((this._holeStatus===void 0||this._holeStatus==3)&&!e.isUnuseLayer(t.layerId)&&i(t.layerId,t.layerId)||e.layerId==12&&this._holeStatus==1&&i(t.layerId,12))return}else return e instanceof Ct?(!e.isContains(t.layerId)||(this._holeStatus===void 0||this._holeStatus==3)&&!e.isUnuseLayer(t.layerId)&&i(t.layerId,t.layerId)||this._holeStatus==1&&i(t.layerId,12),void 0):i(t.layerId,e.layerId)}}};var Uoe=class extends H3{checkShapeRelation(t,e,r){r!==void 0&&(this._holeStatus=r),this.checkError2Result=this.initCheckFunc(t,e),!this.checkProhibit(t,e)&&(this.dispatchOutline(t,e)||(ei.isSingleLayerShape(t)&&ei.isSingleLayerShape(e)?this.checkSingleSingle(t,e):!ei.isSingleLayerShape(t)&&!ei.isSingleLayerShape(e)?this.dispatchMultiMulti(t,e):ei.isSingleLayerShape(t)?this.checkSingleMulti(t,e):(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.checkSingleMulti(e,t))))}checkProhibit(t,e){if(ei.isProhibit(t)||ei.isProhibit(e)){let r=this.commonCheck(t,e);return r&&r.syncCollideLayerIds([t.layerId,e.layerId]),this.check2Result(t,e,r)}return!1}dispatchOutline(t,e){return ei.isBoardOutline(t)?(ei.isSingleLayerShape(e)?this.checkOutlineSingle(t,e):this.dispatchOutlineMulti(t,e),!0):ei.isBoardOutline(e)?(ei.isSingleLayerShape(t)?this.checkOutlineSingle(e,t):(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.dispatchOutlineMulti(e,t)),!0):!1}checkOutlineSingle(t,e){let r=this.commonCheck(t,e);return r&&r.syncCollideLayerIds([e.layerId]),this.check2Result(t,e,r)}dispatchOutlineMulti(t,e){e instanceof et?this.checkOutlinePad(t,e):e instanceof Ct?this.checkOutlineVia(t,e):ei.isSlot(e)&&this.checkOutlineSlot(t,e)}checkOutlinePad(t,e){if(!(this._holeStatus==1&&this.checkError2Result(t.layerId,12))&&(this._holeStatus===void 0||this._holeStatus===3)){for(let r of this.copperLayerIds)if(!e.isUnuseLayer(r)&&this.checkError2Result(t.layerId,r))return}}checkOutlineVia(t,e){if(this._holeStatus===void 0||this._holeStatus===3){for(let r of this.copperLayerIds)if(!e.isUnuseLayer(r))return this.checkError2Result(t.layerId,r)}this._holeStatus===1&&this.checkError2Result(t.layerId,12)}checkOutlineSlot(t,e){let r=this.commonCheck(t,e);return r&&r.syncCollideLayerIds([t.layerId,e.layerId]),this.check2Result(t,e,r)}checkSingleSingle(t,e){let r=this.commonCheck(t,e,t.layerId,t.layerId);return r&&r.syncCollideLayerIds([t.layerId,e.layerId]),this.check2Result(t,e,r)}checkSingleMulti(t,e){if(!(e instanceof Ct&&!e.isContains(t.layerId))){if(this._holeStatus===void 0||this._holeStatus==3){if(e instanceof et){if(!e.isUnuseLayer(t.layerId))return this.checkError2Result(t.layerId,t.layerId)}else if(e instanceof Ct&&e.isContains(t.layerId)&&!e.isUnuseLayer(t.layerId))return this.checkError2Result(t.layerId,t.layerId)}(this._holeStatus==1||e instanceof or)&&this.checkError2Result(t.layerId,12)}}dispatchMultiMulti(t,e){t instanceof et?this.dispatchPad(t,e):t instanceof Ct?this.dispatchVia(t,e):this.dispatchMulti(t,e)}dispatchPad(t,e){e instanceof et?this.checkPadPad(t,e):e instanceof Ct?this.checkPadVia(t,e):this.checkPadMulti(t,e)}dispatchVia(t,e){e instanceof et?(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.checkPadVia(e,t)):e instanceof Ct?this.checkViaVia(t,e):this.checkViaMulti(t,e)}dispatchMulti(t,e){e instanceof et?(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.checkPadMulti(e,t)):e instanceof Ct?(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.checkViaMulti(e,t)):this.checkMultiMulti(t,e)}checkPadPad(t,e){let r=this._holeStatus===0,i=this._holeStatus===1,n=this._holeStatus===2,s=this._holeStatus===void 0||this._holeStatus===3;for(let a of this.copperLayerIds){if([1,2].includes(a)){if(r&&this.checkError2Result(12,a)||i&&this.checkError2Result(a,12))break}else if(r&&!e.isUnuseLayer(a)&&this.checkError2Result(12,a)||i&&!t.isUnuseLayer(a)&&this.checkError2Result(a,12))break;if(s&&!t.isUnuseLayer(a)&&!e.isUnuseLayer(a)&&this.checkError2Result(a,a))break}n&&this.checkError2Result(12,12)}checkPadVia(t,e){let r=this._holeStatus===0,i=this._holeStatus===1,n=this._holeStatus===2,s=this._holeStatus===void 0||this._holeStatus===3;for(let a of this.copperLayerIds){if([1,2].includes(a)){if(r&&this.checkError2Result(12,a)||i&&this.checkError2Result(a,12))break}else if(r&&!e.isUnuseLayer(a)&&this.checkError2Result(12,a)||i&&!t.isUnuseLayer(a)&&this.checkError2Result(a,12))break;if(s&&!t.isUnuseLayer(a)&&!e.isUnuseLayer(a)&&this.checkError2Result(a,a))break}n&&this.checkError2Result(12,12)}checkPadMulti(t,e){if(this._holeStatus===void 0||this._holeStatus==3){for(let r of this.copperLayerIds)if(this.checkError2Result(r,e.layerId))break}this._holeStatus==0&&this.checkError2Result(12,12)}checkViaVia(t,e){let r=this._holeStatus===0,i=this._holeStatus===1,n=this._holeStatus===2,s=this._holeStatus===void 0||this._holeStatus===3;for(let a of this.copperLayerIds)if(r&&!e.isUnuseLayer(a)&&this.checkError2Result(12,a)||i&&!t.isUnuseLayer(a)&&this.checkError2Result(a,12)||s&&!t.isUnuseLayer(a)&&!e.isUnuseLayer(a)&&this.checkError2Result(a,a))break;n&&this.checkError2Result(12,12)}checkViaMulti(t,e){if(this._holeStatus===void 0||this._holeStatus==3){for(let r of this.copperLayerIds)if(!t.isUnuseLayer(r)){this.checkError2Result(r,12);break}}this._holeStatus!==void 0&&this._holeStatus!==3&&this.checkError2Result(12,12)}checkMultiMulti(t,e){let r=this.commonCheck(t,e);return r&&r.syncCollideLayerIds([t.layerId,e.layerId]),this.check2Result(t,e,r)}};var vF=class{constructor(){this.progressCb=()=>{};this.copperCheck=new Voe,this.planeCheck=new Goe,this.safeCheck=new Uoe}check(t){let e=0,r=$i.getInstance();for(let i of t){let[n,s,a]=i;r.needCheck(n,s)&&(n instanceof hn||s instanceof hn?n instanceof hn?this.copperCheck.checkShapeRelation(n,s,a):this.copperCheck.checkShapeRelation(s,n,a):n instanceof yn||s instanceof yn?n instanceof yn?this.planeCheck.checkShapeRelation(n,s,a):this.planeCheck.checkShapeRelation(s,n,a):this.safeCheck.checkShapeRelation(n,s,a),e+=1/t.length,this.progressCb(e))}return this.getResult()}getResult(){let t={},e=new Array;for(let n of this.copperCheck.result)e.push(n.getResult());t.copper=e;let r=new Array;for(let n of this.planeCheck.result)r.push(n.getResult());t.plane=r;let i=new Array;for(let n of this.safeCheck.result)i.push(n.getResult());return t.safe=i,t}clearResult(){this.copperCheck.result.length=0,this.planeCheck.result.length=0,this.safeCheck.result.length=0}onProgress(t){this.progressCb=t}};var b6n=re.getInstance(),Z3t=$i.getInstance(),mSe=class{checkBindVia(t){if(t.type!==1)return!0;let e=Z3t.ruleHelper.getRuleForBlind(t),r=t.name,i=e.name,n=e.getBlindVia(r);return n!=null?n.startLayer==t.startLayer&&n.endLayer==t.endLayer?!0:(ci.getInstance().addBlindError(t.center,i,t.globalIndex,t.startLayer,t.endLayer,ei.getMultiShapeEffectLayers(t)),!1):!1}},MR=new mSe;var xF=ka.getInstance(),Yj=re.getInstance(),gSe=$i.getInstance(),ySe=class{init(){this.isCheckMin=xF.isCheck(xF.diff.minWidth),this.isCheckMax=xF.isCheck(xF.diff.maxWidth),this.isCheckMaxLengthTolerance=xF.isCheck(xF.diff.maxLengthTolerance)}checkDiffWidth(t){let e=gSe.ruleHelper.getRuleForDiffWidth(t),r=t.width,i=t.layerId;(this.isCheckMin&&ve(r,2)<ve(e.getStrokeWidthMin(i),2)||this.isCheckMax&&ve(r,2)>ve(e.getStrokeWidthMax(i),2))&&(gSe.checkEnv==0?ci.getInstance().addDiffPairTrackWidthError(t.midPoint,e.name,t.globalIndex,t.width,e.getStrokeWidthMin(i),e.getStrokeWidthMax(i),[i]):ci.getInstance().errorRecordBuffer.add({type:"DifferentPairWidthError",data:{position:t.midPoint,name:e.name,obj:t.globalIndex,width:t.width,minWidth:e.getStrokeWidthMin(i),maxWidth:e.getStrokeWidthMax(i),layerIds:[i]}}))}checkNetLength(t){let e=this.getNetDifferentials(t),r=this.createSameNetMap(t);for(let i of e)this.checkLength(i,r,t)}getNetDifferentials(t){let e=new Set,r=new Set;for(let i of t){let n=i.net;if(r.has(n))continue;let s=Yj.getNet(n);s!=null&&s.netDifferential!=null&&e.add(s.netDifferential),r.add(n)}return e}createSameNetMap(t){let e=new Map;return t.forEach(r=>{let i="",n=0;if(r instanceof gt)i=r.net,n=r.length;else if(r instanceof et){let s=$o.getInstance().getPadLenByModel(r);s!==null&&(i=r.net,n=s)}if(i){let s=e.get(i)||0;e.set(i,s+n)}}),Object.fromEntries(e)}checkLength(t,e,r){if(!this.isCheckMaxLengthTolerance)return;let i=Yj.getDifferentialPhysics(t.differentialPhysics),n=t.positiveNet.name,s=t.negativeNet.name,a=e[n],l=e[s],c=i.differentialPairLenTolerMax,h=Math.abs(a-l);if(!(a==null||l==null)&&ve(h,2)>ve(c,2)&&!ci.getInstance().hasDiffLengthError(n)){let u=this.getErrorBox(n,s,r);gSe.checkEnv==0?ci.getInstance().addDiffPairTrackLengthError(u.center(),i.name,n,s,c,a,l):ci.getInstance().errorRecordBuffer.add({type:"DifferentPairLengthError",data:{position:u.center(),name:i.name,net_P:n,net_N:s,toleranceScope:c,value_P:a,value_N:l}})}}getErrorBox(t,e,r){let i=new _e,n,s;return Yj.getAllNets().forEach(a=>{a.name==Yj.getNet(t).name&&(n=r.filter(l=>l.net==t)),a.name==Yj.getNet(e).name&&(s=r.filter(l=>l.net==e))}),n.forEach(a=>{i.ext1(a.bbox)}),s.forEach(a=>{i.ext1(a.bbox)}),i.valid()?i.build1():null}},NR=new ySe;var Hoe=ka.getInstance(),Woe=re.getInstance(),bSe=class{getNetDifferentials(t){let e=new Set,r=new Set;for(let i of t){let n=i.net;if(r.has(n))continue;let s=Woe.getNet(n);s!=null&&s.netLengthPhysics!=null?e.add(Woe.getNetLengthPhysicsByNet(s.name)):e.add(Woe.getDefaultNetLengthPhysics()),r.add(n)}return e}createSameNetMap(t){let e=new Map;return t.forEach(r=>{let i="",n=0;if(r instanceof gt)i=r.net,n=r.length;else if(r instanceof et){let s=$o.getInstance().getPadLenByModel(r);s!==null&&(i=r.net,n=s)}if(i){let s=e.get(i)||0;e.set(i,s+n)}}),e}checkNetLength(t,e){let r=this.getNetDifferentials(t),i=e||this.createSameNetMap(t);for(let[n,s]of i){let a;for(let l of r)l.name==Woe.getNetLengthPhysicsByNet(n).name&&(a=l);this.checkLength(a,n,i.get(n))}}checkLength(t,e,r){let{netLengthMax:i,netLengthMin:n}=t;if(i==0&&n==0)return!0;let s=Hoe.isCheck(Hoe.netLength.minLength);return Hoe.isCheck(Hoe.netLength.maxLength)&&ve(r,2)>i||s&&ve(r,2)<n?($i.getInstance().checkEnv==0?ci.getInstance().addNetLengthError(this.allTrackCenter(e),t.name,e,r,n,i):ci.getInstance().errorRecordBuffer.add({type:"NetLengthError",data:{position:this.allTrackCenter(e),name:t.name,net:e,netLength:r,minNetLength:n,maxNetLength:i}}),!1):!0}allTrackCenter(t){let e=new _e;return Sn.getInstance().getAllItem().forEach(i=>{i.net==t&&e.ext1(i.bbox)}),e.valid()?e.build1().center():new S(0,0)}},RF=new bSe;var bGe=ka.getInstance(),zoe=re.getInstance(),PSe=class{init(){this.isCheckTolerance=bGe.isCheck(bGe.netLengthTolerance.tolerance)}getNetDifferentials(t){let e=new Set,r=new Set;for(let i of t){let n=i.net;if(r.has(n))continue;let s=zoe.getNet(n);s!=null&&s.netLengthTolerancePhysics!=null?e.add(zoe.getNetLengthTolerancePhysicsByNet(s.name)):e.add(zoe.getDefaultNetLengthTolerancePhysics()),r.add(n)}return e}createSameNetMap(t){let e={};return t.forEach(r=>{let i="",n=0;if(r instanceof gt)i=r.net,n=r.length;else if(r instanceof et){let s=$o.getInstance().getPadLenByModel(r);s!==null&&(i=r.net,n=s)}i&&(e[i]=(e[i]||0)+n)}),e}checkNetLengthTolerance(t,e){let r=this.getNetDifferentials(t),i=e||this.createSameNetMap(t);for(let n in i){let s=zoe.getNetLengthTolerancePhysicsByNet(n);if(s!=null){let a;r.forEach(l=>{l.name==s.name&&(a=l)}),this.checkLengthTolerance(a,n,i)}}}checkLengthTolerance(t,e,r){if(!t||t.netLengthTolerance==null||!this.isCheckTolerance)return!0;let i=re.getInstance().getNet(e);if(i.equalLengthGroup==null)return!0;let n=r[e],s=i.equalLengthGroup.targetNet,a;if(s)a=r[s];else{let h=i.equalLengthGroup.getAllNetIds().map(u=>r[u]);a=Math.max.apply(null,h)}let l=n-a;return l>t.netLengthTolerance||l<-t.netLengthTolerance?($i.getInstance().checkEnv==0?ci.getInstance().addNetLengthToleranceError(this.allTrackCenter(e),t.name,e,l,t.netLengthTolerance):ci.getInstance().errorRecordBuffer.add({type:"NetLengthToleranceError",data:{position:this.allTrackCenter(e),name:t.name,net:e,netLengthDiff:l,netLengthTolerance:t.netLengthTolerance}}),!1):!0}allTrackCenter(t){let e=new _e;return Sn.getInstance().getAllItem().forEach(i=>{i.net==t&&e.ext1(i.bbox)}),e.valid()?e.build1().center().add1(.1,.1):new S(.1,.1)}},y6=new PSe;var Yoe=ka.getInstance(),h5n=re.getInstance(),TSe=$i.getInstance(),ISe=class{init(){this.isCheckMin=Yoe.isCheck(Yoe.holeSize.minViaSize),this.isCheckMax=Yoe.isCheck(Yoe.holeSize.maxViaSize)}checkVia(t){let e=TSe.ruleHelper.getRuleForViaRadius(t),r=t.center,i=t.globalIndex,n=e.name,s=ve(t.radius*2,2),a=ve(t.holeRadius*2,2);return this.isCheckMax&&s>ve(e.maxRadius*2,2)||this.isCheckMin&&s<ve(e.minRadius*2,2)?(TSe.checkEnv==0?ci.getInstance().addRadiusError(r,n,i,!0,t.radius,e.minRadius,e.maxRadius,ei.getMultiShapeEffectLayers(t),t.type==1):ci.getInstance().errorRecordBuffer.add({type:"RadiusError",data:{position:r,name:n,obj1:i,type:!0,radius:t.radius,minRadius:e.minRadius,maxRadius:e.maxRadius,layerIds:ei.getMultiShapeEffectLayers(t),isBlind:t.type==1}}),!1):this.isCheckMax&&a>ve(e.maxInner*2,2)||this.isCheckMin&&a<ve(e.minInner*2,2)?(TSe.checkEnv==0?ci.getInstance().addRadiusError(r,n,i,!1,t.holeRadius,e.minInner,e.maxInner,ei.getMultiShapeEffectLayers(t),t.type==1):ci.getInstance().errorRecordBuffer.add({type:"RadiusError",data:{position:r,name:n,obj1:i,type:!1,radius:t.holeRadius,minRadius:e.minInner,maxRadius:e.maxInner,layerIds:ei.getMultiShapeEffectLayers(t),isBlind:t.type==1}}),!1):!0}inValidRadius(t,e){return typeof e!="number"||isNaN(e)?-1:(e=ve(e*2,2),e>ve(t.maxRadius*2,2)?1:e<ve(t.minRadius*2,2)?-1:0)}inValidInnerRadius(t,e){return typeof e!="number"||isNaN(e)?-1:(e=ve(e*2,2),e>ve(t.maxInner*2,2)?1:e<ve(t.minInner*2,2)?-1:0)}},sf=new ISe;var joe=ka.getInstance(),I5n=re.getInstance(),CSe=$i.getInstance(),SSe=class{init(){this.isCheckMin=joe.isCheck(joe.trackRule.minTrackWidth),this.isCheckMax=joe.isCheck(joe.trackRule.maxTrackWidth)}checkTrackWidth(t){let e=t.layerId,r=CSe.ruleHelper.getRuleForTrackWidth(t),i=ve(t.width,2);return this.isCheckMax&&i>ve(r.getMaxWidth(e),2)||this.isCheckMin&&i<ve(r.getMinWidth(e),2)?(t instanceof zr?CSe.checkEnv==0?ci.getInstance().addTrackWidthError(t.start.add(t.end).mul(.5),r.name,t.globalIndex,t.width,r.getMinWidth(e),r.getMaxWidth(e),[e]):ci.getInstance().errorRecordBuffer.add({type:"TrackError",data:{position:t.start.add(t.end).mul(.5),name:r.name,obj1:t.globalIndex,width:t.width,minWidth:r.getMinWidth(e),maxWidth:r.getMaxWidth(e),layerIds:[e]}}):t instanceof Ii&&(CSe.checkEnv==0?ci.getInstance().addTrackWidthError(t.midPoint,r.name,t.globalIndex,t.width,r.getMinWidth(e),r.getMaxWidth(e),[e]):ci.getInstance().errorRecordBuffer.add({type:"TrackError",data:{position:t.midPoint,name:r.name,obj1:t.globalIndex,width:t.width,minWidth:r.getMinWidth(e),maxWidth:r.getMaxWidth(e),layerIds:[e]}})),!1):!0}inValidTrackWidth(t,e){if(typeof e!="number"||isNaN(e))return!1;if(e=ve(e,2),t instanceof d2){if(e>ve(t.getStrokeWidthMax(),2))return 1;if(e<ve(t.getStrokeWidthMin(),2))return-1}else{if(e>ve(t.getMaxWidth(),2))return 1;if(e<ve(t.getMinWidth(),2))return-1}return 0}},xS=new SSe;var W3=class{constructor(){this._progress=0;this.progressCb=null}get progress(){return this._progress}set progress(t){this._progress=t}onProgress(t){this.progressCb=t}updateProgress(t){var r;t<0&&(t=0),(t>=1||ne.greatereq(t,1))&&(t=1);let e=Math.pow(10,2);return t=Math.floor(t*e)/e,t=ve(t,2),this.progress>=t?!1:(this.progress=t,(r=this.progressCb)==null||r.call(this,this.progress),!0)}reset(){this.progress=0,this.progressCb=null}};var ESe=class{constructor(){this.progress=new W3}checkError(t,e={}){this.checkDispatch(t),NR.checkNetLength(t),RF.checkNetLength(t),y6.checkNetLengthTolerance(t),this.checkSpacingError(t,e)}checkDispatch(t){for(let e of t)e instanceof gt?xS.checkTrackWidth(e):e instanceof Ct&&(MR.checkBindVia(e),sf.checkVia(e))}checkSpacingError(t,e={}){this.progress.reset(),this.progress.onProgress(c=>{var h;(h=e.onProgress)==null||h.call(e,c),!e.disableProgressFromWorker&&this.handleUpdateProgressFromWorker(c,e.maxProgressFromWorker)});let r=new Boe,i={checkSameNet:e.spacingCheckSameNet,excludeCheckPair:e.excludeCheckPair,callback:c=>{this.progress.updateProgress(c*.25)}},n=r.updates(t,i),s=new vF;s.onProgress(c=>this.progress.updateProgress(.25+.76*c));let a=s.check(n);this.progress.updateProgress(1);let l=D0.checkSpacing(a);return{...a,...l}}handleUpdateProgressFromWorker(t,e){self.workerBus!=null&&(e=e||1,t=t*e,self.workerBus.publish("progressUpdate",{ratio:t,descripte:"Design rule check"}))}},kR=new ESe;var Xoe=class{constructor(t,e,r,i=!0,n=0){if(t>e){let s=(t-e)/2,a=e/2*n,l=(e/2-a)*Math.sqrt(2)+a+r+.01;i||(l=e/2+r+.01),this.center1=new S(-s,0),this.center2=new S(s,0);let c=new S(-1,1).normalize().mul(l),h=new S(-1,-1).normalize().mul(l),u=new S(1,1).normalize().mul(l),d=new S(1,-1).normalize().mul(l);this.leftUp=new M(this.center1,this.center1.add(c)),this.leftLow=new M(this.center1,this.center1.add(h)),this.rightUp=new M(this.center2,this.center2.add(u)),this.rightLow=new M(this.center2,this.center2.add(d))}else{let s=(e-t)/2,a=t/2*n,l=(t/2-a)*Math.sqrt(2)+a+r+.01;i||(l=t/2+r+.01),this.center1=new S(0,s),this.center2=new S(0,-s);let c=new S(-1,1).normalize().mul(l),h=new S(-1,-1).normalize().mul(l),u=new S(1,1).normalize().mul(l),d=new S(1,-1).normalize().mul(l);this.leftUp=new M(this.center1,this.center1.add(c)),this.leftLow=new M(this.center2,this.center2.add(h)),this.rightUp=new M(this.center1,this.center1.add(u)),this.rightLow=new M(this.center2,this.center2.add(d))}}};var qoe=1e-6,DF=class{constructor(t){this.thermalSet=new Set;this.padLines=new Set;this.constraintRtree=new ji(10);this.padPolyMap=new Map;this.padPolyMap2=new Map;this.commonPadMap=new Map;this.max=100;this.drcMap=t,this.filter=new ZB,this.updateConstraintTree(),$i.getInstance().initialEnv(this.drcMap),$i.getInstance().addFilter(this.filter),Zh.getInstance().setMask(!0)}isTheraml(t){return this.thermalSet.has(t)}getResult(){return Array.from(this.padLines)}updateConstraintTree(){this.constraintRtree.clear();let t=yM("Constraint Region");for(let e of t){let r=new qM(e);this.constraintRtree.add(r)}}searchConstraints(t,e){let r=[];for(let i of this.constraintRtree.search(t))(i.item.layerId===e||i.item.layerId===12)&&r.push(i.item);return r}addThermal2Tree(t){this.drcMap.insert(new qM(t))}getPads(t){let e=this.searchPads(t),r=new Set;return e.forEach(i=>{i instanceof et&&i.net==t.net&&(i.layerId==12&&!i.isUnuseLayer(t.layerId)||i.layerId==t.layerId)&&r.add(i)}),r}getThermalModel(t,e,r,i,n,s){if(Math.abs(s-$9)>1e-5&&!e){let a=this.getPadWidth(t,n,e),l=this.getPadHeight(t,n,e),c=this.getPadType(t,n,e)=="RECT",h=this.getPadRatio(t,n,e),u=Ae.rotateZ(t.rotation).translate1(t.center.x,t.center.y,0).toMatrix3(),d=new Xoe(a,l,r,c,h),p=Math.min(a,l);i=i<=0?p/2+.02:i;let m=d.leftUp.multiply3(u),g=d.leftLow.multiply3(u),y=d.rightUp.multiply3(u),b=d.rightLow.multiply3(u),P=this.getThermalCopper(m,n,t,e,i,!0),T=this.getThermalCopper(g,n,t,e,i,!0),I=this.getThermalCopper(y,n,t,e,i,!0),C=this.getThermalCopper(b,n,t,e,i,!0);return[P,T,I,C]}else{let a=this.getPadWidth(t,n,e)/2+.02,l=this.getPadHeight(t,n,e)/2+.02,c,h,u,d,p,m=!1;if(e){if(Math.abs(s-$9)<1e-5)s=0;else{let w=Math.max(a,l);a=w,l=w}let x=Math.cos(s),v=Math.sin(s);Math.abs(x)>1e-5&&(a=a/x),Math.abs(v)>1e-5&&(l=l/v);let D=t.bbox.center();(D.x.toString()!=t.center.x.toString()||D.y.toString()!=t.center.y.toString())&&(m=!0),c=Ae.rotateZForPoint(t.center,t.rotation+s)}else c=Ae.rotateZForPoint(t.center,t.rotation);if(m){let x=new S((a-.02)*2+(r+.01)*2+.02,0),v=new S(0,(l-.02)*2+(r+.01)*2+.02);h=t.center.sub(x).multiply4(c),u=t.center.add(x).multiply4(c),d=t.center.add(v).multiply4(c),p=t.center.sub(v).multiply4(c);let D=this.getPolygonPadThermal(t,r+.01,new M(h,u),new M(d,p),n);h=D.left||h,u=D.right||u,d=D.top||d,p=D.bottom||p}else{let x=new S(a-.01+r,0),v=new S(0,l-.01+r);h=t.center.sub(x).multiply4(c),u=t.center.add(x).multiply4(c),d=t.center.add(v).multiply4(c),p=t.center.sub(v).multiply4(c)}let g=i<=0?a:i,y=i<=0?l:i,b=new M(t.center,h),P=new M(t.center,u),T=new M(t.center,d),I=new M(t.center,p),C=this.getThermalCopper(b,n,t,e,y,!1,!1),E=this.getThermalCopper(P,n,t,e,y,!1,!1),O=this.getThermalCopper(T,n,t,e,g,!1,!0),_=this.getThermalCopper(I,n,t,e,g,!1,!0);return[C,E,O,_]}}getPolygonPadThermal(t,e,r,i,n){let s=this.getPolygonPadBox(t,n,e),a=[],l=[];for(let m of s){if(Pt(m,r)>0){let b=new S(Ee[0],Ee[1]);a.push(b)}if(Pt(m,i)>0){let b=new S(Ee[0],Ee[1]);l.push(b)}}let[c,h]=p(a),[u,d]=p(l);function p(m){let g=m[0],y=m[1];if(m.length>2)for(let b=1;b<m.length;b++){let P=m[b];if(!(ne.eq(P.x,g.x)&&ne.eq(P.y,g.y))){y=P;break}}return[g,y]}return{left:c,right:h,top:u,bottom:d}}getPadPl(t,e,r,i){let n=null;return 12==t.layerId?n=t.getMathGraphics(e,-i):n=t.getMathGraphics(t.layerId,-i),n}getLine2(t,e){if(e.isPolygonPad&&(t.primitives.length>10||!this.isConvexPolygon(t)))return null;let r=e.width/2,i=e.line.direct,n=e.line,s=new S(-i.y,i.x).mul(r),a=new M(n.start().add(s),n.end().add(s)),l=h(a)[0],c;if(l&&(c=l.sub(s)),c==null)return null;{let u=new S(i.y,-i.x).mul(r),d=new M(n.start().add(u),n.end().add(u)),p=h(d)[0];if(p){let m=p.sub(u);ne.less(m.distance2(n.start()),c.distance2(n.start()))&&(c=m)}else return null}if(c)return new M(c,n.end());return null;function h(u){let d=t.primitives,p=new Array,m=u.start();for(let g of d){let y=Pt(u,g);if(y>0){let b=new S(Ee[0],Ee[1]),P;for(let T=2;T<y;T+=2){P||(P=b.distance2(m));let I=new S(Ee[T],Ee[T+1]),C=I.distance2(m);P<C&&(P=C,b=I)}p.push(b)}}return an(p,u)}}isConvexPolygon(t){let e=[];t.points1(.1,n=>{e.push(n)}),e.pop();let r=e.length;if(r<3)return!1;let i=0;for(let n=0;n<r;n++){let s=e[n],a=s.x,l=s.y,c=e[(n+1)%r],h=c.x,u=c.y,d=e[(n+2)%r],p=d.x,m=d.y,g=(h-a)*(m-l)-(u-l)*(p-a);if(g!==0){if(g*i<0)return!1;i=g}}return!0}getLine(t,e){if(t==null)return null;let r=new As(t,ge.build2([e]),0);if(r.relation==0){let n=r.line.start(),s=e.end().sub(n).normalize(),a=new S(-s.x,-s.y).mul(.01),l=n.add(a);return new M(l,e.end())}return e}pIsInCopper(t,e,r,i){let n=e.x-r,s=e.x+r,a=e.y-r,l=e.y+r;for(let c of t.pls){let h=c.bbox();if(!(h.minX>s||h.maxX<n||h.minY>l||h.maxY<a))for(let u of c.primitives){let d=u.bbox();if(!(d.minX>s||d.maxX<n||d.minY>l||d.maxY<a)&&er.getMinDistanceFromPoint(e,u)<r)return!0}}return i?t.inShape(e.x,e.y):!1}checkCopperClearance(t,e,r=!0){D0.onlyCheck=!0;let i=new Set,n,s=[];kR.checkSpacingError(Object.values(t).map(l=>l.copper)).fail.forEach(l=>{let c=t[l.id1]||t[l.id2];i.has(c)||(i.add(c),this.changeCopper(c)?s.push(c):(e(c),delete t[l.id1],delete t[l.id2]),n=c.copper,Zh.getInstance().delete(n.globalIndex,n.layerId))}),kR.checkSpacingError(s.map(l=>l.copper)).fail.forEach(l=>{let c=t[l.id1];if(c)e(c),delete t[l.id1];else{let h=t[l.id2];h&&(e(h),delete t[l.id2])}}),D0.onlyCheck=!1,r&&(this.padPolyMap.clear(),this.padPolyMap2.clear(),this.commonPadMap.clear())}changeCopper(t,e=this.padPolyMap,r=this.max){let i,n;return t.isPolygonPad?(e.has(t.pad.globalIndex)?i=e.get(t.pad.globalIndex):(i=this.getPadPl(t.pad,t.copper.layerId,t.line,0),e.set(t.pad.globalIndex,i)),this.padPolyMap2.get(t.pad.globalIndex)==null&&(n=this.getLine2(i,t)),n==null&&(n=this.polygonPadHandle(i,t))):n=this.generatePadLine(t),n==null?!1:(t.copper.pls=this.getCopperByLine(n,t.width),t.line=n,this.filter.removeThermalCopper(t.copper),!0)}generatePadLine(t){let e=t.pad,r=this.commonPadMap.get(e.globalIndex),i=t.line;if(r!=null)if(Array.isArray(r)){let l=null;if(t.isVertical?l=r[1]:l=r[0],l!=null)return l==0?null:new M(i.start().add(i.direct.mul(l)),i.end())}else return r==0?null:new M(i.start().add(i.direct.mul(r)),i.end());let n=t.copper.layerId,s;if(n==1?s=e.top:n==2?s=e.bottom:s=e.inner,!s)return null;let a=s.type;if(a=="ELLIPSE"||a=="OVAL"&&ne.eq(s.width,s.height)){if(ne.lesseq(s.width,t.width))return this.commonPadMap.set(e.globalIndex,0),null;{let l=Math.sqrt(Math.pow(s.width/2,2)-Math.pow(t.width/2,2));return this.commonPadMap.set(e.globalIndex,l),new M(i.start().add(i.direct.mul(l)),i.end())}}if(t.is45){let[l,c]=[s.width,s.height],h=Math.sqrt(2),u=Math.min(l,c)/2,d=0;a=="RECT"?d=s.ratio:a=="OVAL"&&(d=1);let p=u*d,m=u-p,g=m*h+p,y=t.width;if(ne.less(g*2,y))return null;let b=h*p,P=0;if(ne.lesseq(y,b)){let T=y/2;P=m*h+Math.sqrt(p*p-T*T)}else if(ne.less((m*2+p)*h,y))P=Math.sqrt(p*p-Math.pow(p-(g-y/2),2));else{let T=u*2*h/2,I=y/2;P=T-I}return this.commonPadMap.set(e.globalIndex,P),P==0?null:new M(i.start().add(i.direct.mul(P)),i.end())}else{let[l,c]=t.isVertical?[s.height/2,s.width/2]:[s.width/2,s.height/2],h=t.width/2,u=this.commonPadMap.get(e.globalIndex);if(u||(u=[],this.commonPadMap.set(e.globalIndex,u)),ne.less(c,h))return t.isVertical?u[1]=0:u[0]=0,null;let d=Math.min(l,c),p=0;a=="RECT"?p=s.ratio:a=="OVAL"&&(p=1);let m=d*p,g=c-m,y=0;if(ne.lesseq(h,g))y=l;else{let b=h-g;y=Math.min(l,c)-m+Math.sqrt(Math.pow(m,2)-Math.pow(b,2)),ne.less(c,l)&&(y=l-c+y)}return t.isVertical?u[1]=y:u[0]=y,y==0?null:new M(i.start().add(i.direct.mul(y)),i.end())}}polygonPadHandle(t,e,r=this.padPolyMap2,i=this.max){let n=t;if(r.has(e.pad.globalIndex))n=r.get(e.pad.globalIndex);else{if(e.isPolygonPad){if(i==0)return null;n.primitives.length>10&&i--}n=this.getPadPl(e.pad,e.copper.layerId,e.line,e.width/2),r.set(e.pad.globalIndex,n)}return this.getLine(n,e.line)}complete(){$i.getInstance().clear(),Zh.getInstance().setMask(!1),Zh.getInstance().clear(),this.drcMap=null}getPadType(t,e,r){return r?"POLYGON":1==e?t.top.type:2==e?t.bottom.type:Es(e)?t.inner.type:"POLYGON"}getPadRatio(t,e,r){return r?0:1==e?t.top.ratio:2==e?t.bottom.ratio:Es(e)?t.inner.ratio:0}isPolygonPad(t){var e,r,i;return!(((e=t.top)==null?void 0:e.pl)==null&&((r=t.bottom)==null?void 0:r.pl)==null&&((i=t.inner)==null?void 0:i.pl)==null)}getPadWidth(t,e,r){let i;if(r){if(t.isUnuseLayer(e))return t.hole.holeLength;let s=this.getPolygonPadPl(t,e);s!=null?i=s.bbox().width():i=t.buildBBox().width()}else 1==e?i=t.top.width:2==e?i=t.bottom.width:Es(e)&&(t.isUnuseLayer(e)?i=this.getPadHoleLen(t).width:i=t.inner.width);let n=this.getPadHoleLen(t).width;return i>n?i:n}getPadHoleLen(t){if(t.hole){let e=t.hole.getHolebbox(t.center,0);return{width:e.width(),height:e.height()}}return{width:0,height:0}}getPolygonPadPl(t,e){let r=null;12==t.layerId?r=t.getMathGraphics(e,0):r=t.getMathGraphics(t.layerId,0);let i=Ae.rotateZForPoint(t.center,-t.rotation);return r?r.multiply3(i.toMatrix3()):null}getPadHeight(t,e,r){let i;if(r){if(t.isUnuseLayer(e))return t.hole.holeRadius*2;let s=this.getPolygonPadPl(t,e);s!=null?i=s.bbox().height():i=t.buildBBox().height()}else 1==e?i=t.top.height:2==e?i=t.bottom.height:Es(e)&&(t.isUnuseLayer(e)?i=this.getPadHoleLen(t).height:i=t.inner.height);let n=this.getPadHoleLen(t).height;return i>n?i:n}getPolygonPadBox(t,e,r=0){let i=this.getPolygonPadPl(t,e),n;i!=null?n=i.bbox():n=t.buildBBox(),n=n.extendOfSize(r);let s=Ae.rotateZForPoint(t.center,t.rotation).toMatrix3();return[new M(n.UL(),n.UR()).multiply3(s),new M(n.LL(),n.LR()).multiply3(s),new M(n.UL(),n.LL()).multiply3(s),new M(n.LR(),n.UR()).multiply3(s)]}island(t){let e=this.searchItems(t);for(let r of e)if(r!=t&&this.needCheckConnect(r,t)&&nx(r,t))return!1;return!0}searchItems(t){let e=t.layerId,r=(i,n)=>i==e||i==12;return this.drcMap.search4Types(t.buildBBox(),jd,r)}searchPads(t){let e=t.layerId,r=(i,n)=>i==e||i==12?n!=null?n=="Pad":!0:!1;return this.drcMap.search4Types(t.buildBBox(),["Pad"],r)}};var b6=re.getInstance(),$oe=qo.getInstance(),wF=class extends DF{generateThermal(t){let e=this.getPourProfile(t);if(!e||Ki.nullOrEmpty(e.net))return;let r=b6.getCopperPlaneByNet(e.net),i=b6.getRegion(e.globalIndex),n=b6.getSafeSpacingByNet(e.net,13);if(i&&i.copperPlane&&(r=b6.getCopperPlane(i.copperPlane)),i&&(i.safeCopperPlane||i.safeClearance)&&(n=b6.getSafeSpacing(i.safeCopperPlane||i.safeClearance)),r){let s=!1;n&&n.getClearance(11,7,e.layerId)==0&&(s=!0);let a=this.getPads(e);this.getLines(a,r,e,s)}}removeIsland(t){let e={};t.filter(n=>{let s=this.getPourProfile(n);if(!s||s.component.keepIsland)return;let a=e[s.net];a||(e[s.net]=a=[]),a.push(s)});let r=[];Object.values(e).forEach(n=>{this.getIslandsByCoppers(n).forEach(s=>r.push(s))});let i=[];for(let n of r){let s=n.globalIndex,a=n.getParent(),l=a.component,c=l.copperResult.indexOf(n.copperPath);c>=0&&l.copperResult.splice(c,1),a.deleteCopper(s),i.push(s)}return i}needCheckConnect(t,e){return t instanceof or||t instanceof et||t instanceof Ct||t instanceof gt||t instanceof hn&&t.net===e.net&&this.thermalSet.has(t)}getIslandsByCoppers(t){let e=new Map,r=[];for(let a of t){let l=[],c=new _e;if(a.iteratorCopper(y=>{let b=$oe.getItem(y);this.thermalSet.has(b)||(l.push(b),c.ext1(b.buildBBox()))}),l.length===0)continue;l.sort((y,b)=>y.buildBBox().minX-b.buildBBox().minX);for(let y of l)this.island(y)&&e.set(y,[y]);r.push({coppers:l,bbox:c.build1()});let h=a.component,u=h.style==="solid",d=u?h.optimization?h.optimizationValue:0:h.gridLineWidth;if(d===0)continue;let p;if(u)p=y=>y.pls;else{let y=new Map;p=b=>{let P=y.get(b);if(!P){for(let T=1;T<b.pls.length;T++){let I=b.pls[T];if(I.primitives.length===1&&I.primitives[0]instanceof M){P=b.pls.slice(0,T);break}}P||(P=b.pls),y.set(b,P)}return P}}let m=(y,b)=>{let P=p(y),T=p(b),I=y.buildBBox().intersection1(b.buildBBox()),C=[],E=[];P.forEach(O=>{O.bbox().isIntersect(I)&&O.primitives.forEach(_=>{_.bbox().isIntersect(I)&&C.push(_)})}),T.forEach(O=>{O.bbox().isIntersect(I)&&O.primitives.forEach(_=>{_.bbox().isIntersect(I)&&E.push(_)})});for(let O of C)for(let _ of E)if(er.getMinDistanceWithoutCross(O,_)<d)return!0;return!1},g=new Tn;for(let y of l){let b=y.buildBBox();for(let P of PGe(g.listIterator())){let T=P.item,I=T.buildBBox();if(I.maxX<b.minX){g.remove(P);continue}I.minY>b.maxY||b.minY>I.maxY||s(y,T,m)}g.add(y)}}let i=new Tn;for(let a of r.sort((l,c)=>l.bbox.minX-c.bbox.minX)){let l=a.bbox;for(let c of PGe(i.listIterator())){let h=c.item,u=h.bbox;if(u.maxX<l.minX){i.remove(c);continue}if(u.minY>l.maxY||l.minY>u.maxY)continue;let d=a.coppers,p=h.coppers,m=d.length,g=p.length,y=0,b=0;for(;y<m&&b<g;)if(d[y].buildBBox().minX<p[b].buildBBox().minX){let P=d[y],T=P.buildBBox();for(let I=b;I<g;I++){let C=p[I],E=C.buildBBox();if(E.minX>T.maxX)break;(T.minY<E.minY?E.minY:T.minY)<(T.maxY<E.maxY?T.maxY:E.maxY)&&s(P,C)}y++}else{let P=p[b],T=P.buildBBox();for(let I=y;I<m;I++){let C=d[I],E=C.buildBBox();if(E.minX>T.maxX)break;(E.minY<T.minY?T.minY:E.minY)<(E.maxY<T.maxY?E.maxY:T.maxY)&&s(C,P)}b++}}i.add(a)}let n=new Array;for(let a of e.keys())n.push(a);return n;function s(a,l,c=nx){let h=e.get(a),u=e.get(l);h===u||!c(a,l)||(h&&u?h.length>u.length?u.forEach(d=>{h.push(d),e.set(d,h)}):h.forEach(d=>{u.push(d),e.set(d,u)}):h?h.forEach(d=>e.delete(d)):u.forEach(d=>e.delete(d)))}}getLines(t,e,r,i=!1){let n=r.component,s=(n.style==="solid"?n.optimization?n.optimizationValue:0:n.gridLineWidth)/2+qoe,a=new Array;r.iteratorCopper(u=>{a.push($oe.getItem(u))});let l=r.layerId,c={};t.forEach(u=>{let d,p,m;if(u.padRule){if(u.padRule.connectMode!=0)return;d=u.padRule.lineClearance,p=u.padRule.lineWidth,m=u.padRule.lineAngle}else{let b=this.searchConstraints(u.bbox,r.layerId),P=!1;if(b.forEach(T=>{if(new y3().isInConstraint(T,u)){let I=b6.getRegion(T.globalIndex);if(I!=null&&I.copperPlane!=null){let C=b6.getCopperPlane(I.copperPlane);if(u.layerId==12){if(C.getMultiConnectMode(l)!=0)return;d=C.getMultiLineClearance(l),p=C.getMultiLineWidth(l),m=C.getMultiLineAngle(l)}else{if(C.getSingleConnectMode(l)!=0)return;d=C.getSingleLineClearance(l),p=C.getSingleLineWidth(l),m=C.getSingleLineAngle(l)}P=!0}}}),!P)if(u.layerId==12){if(e.getMultiConnectMode(l)!=0)return;d=e.getMultiLineClearance(l),p=e.getMultiLineWidth(l),m=e.getMultiLineAngle(l)}else{if(e.getSingleConnectMode(l)!=0)return;d=e.getSingleLineClearance(l),p=e.getSingleLineWidth(l),m=e.getSingleLineAngle(l)}}if(ne.eq(d,0))return;let g=this.isPolygonPad(u);this.getThermalModel(u,g,d,p,r.layerId,m).forEach(b=>{b.copper.setParent(r),c[b.copper.globalIndex]=b})});let h=u=>{u.copper.remove(),$oe.delete(u.copper,u.copper.globalIndex)};this.checkCopperClearance(c,h,!1),Object.values(c).forEach(u=>{this.saveThermal(u,a,s,i)?(r.addCopper(u.copper.globalIndex),n.copperResult.push(u.copper.copperPath),this.thermalSet.add(u.copper),this.padLines.add(u.copper),this.addThermal2Tree(u.copper)):h(u)}),this.padPolyMap.clear(),this.padPolyMap2.clear(),this.commonPadMap.clear()}saveThermal(t,e,r,i=!1){let n=t.copper.getParent();if(n!=null&&n instanceof or&&n.type=="Copper Region"){let s=n.getMathGraphics(),a=t.copper.getRealOutline()[0];if(a!=null&&new As(s,a,0).relation==0)if(this.changeCopper(t)){if(a=t.copper.getRealOutline()[0],new As(s,a,0).relation==0)return!1}else return!1}for(let s of e)if(this.pIsInCopper(s,t.line.end(),r,t.isPolygonPad)){if(i){let a=s.pls[0],l=t.copper.getMathGraphics().items[0];if(l!=null&&new As(a,l,0).relation==0){let c=t.line.end().add(t.line.direct.mul(t.width));if(!s.inShape(c.x,c.y))return!1}}return!0}return!1}getThermalCopper(t,e,r,i,n,s=!1,a=!1){let l=gGe(this.getCopperByLine(t)),c=nr(),h=$oe.addCopper(c,e,r.net,"90grid",n,0,!1,l,!1);return this.filter.addThermalCopper(h),{copper:h,line:t,pad:r,isPolygonPad:i,width:n,is45:s,isVertical:a}}getCopperByLine(t,e){return[ge.build2([t])]}getPourProfile(t){let e=UY(t);return e&&e.component instanceof xn?e:null}};function PGe(o){return{next(){return o.hasNext()?{value:o.next()}:{done:!0,value:void 0}},[Symbol.iterator](){return this}}}var TGe=Xo.getInstance(),IGe=re.getInstance(),Koe=class extends DF{generateThermal(t){let e=this.getPourProfile(t);if(!e||Ki.nullOrEmpty(e.net))return;let r=re.getInstance().getInnerPlaneByNet(e.net),i=re.getInstance().getRegion(e.globalIndex);if(i&&i.innerPlane&&(r=re.getInstance().getInnerPlane(i.innerPlane)),r){let n=this.getPads(e);this.getLines(n,r,e)}}getLines(t,e,r){let i={},n=r.layerId;t.forEach(l=>{let c,h,u;if(l.padRule){if(l.padRule.connectMode!=0)return;c=l.padRule.lineClearance,h=l.padRule.lineWidth,u=l.padRule.lineAngle}else{let m=this.searchConstraints(l.bbox,r.layerId),g=!1;for(let y of m)if(new y3().isInConstraint(y,l)){let b=IGe.getRegion(y.globalIndex);if(b!=null&&b.innerPlane!=null){let P=IGe.getInnerPlane(b.innerPlane);if(l.layerId==12){if(P.getMultiConnectMode(n)!=0)return;c=P.getMultiLineClearance(n),h=P.getMultiLineWidth(n),u=P.getMultiLineAngle(n)}else return;g=!0}}if(!g)if(l.layerId==12){if(e.getMultiConnectMode(n)!=0)return;c=e.getMultiLineClearance(n),h=e.getMultiLineWidth(n),u=e.getMultiLineAngle(n)}else return}if(ne.eq(c,0))return;let d=this.isPolygonPad(l);this.getThermalModel(l,d,c,h,r.layerId,u).forEach(m=>i[m.copper.globalIndex]=m)});let s=!1,a=l=>{l.copper.remove(),TGe.delete(l.copper,l.copper.globalIndex),s=!0};this.checkCopperClearance(i,a),Object.values(i).forEach(l=>{this.checkThermal(r,l)?(this.padLines.add(l.copper),this.thermalSet.add(l.copper),this.addThermal2Tree(l.copper)):a(l)}),s&&Zh.getInstance().delete(r.globalIndex,r.layerId)}checkThermal(t,e){let r=this.pIsInCopper(t,e.line.end(),qoe+.02,e.isPolygonPad);if(r){let i=t.getMathGraphics().items[0],n=e.copper.getMathGraphics().items[0];if(n!=null&&new As(i,n,0).relation==0){let s=e.line.end().add(e.line.direct.mul(e.width));r=t.inShape(s.x,s.y)}}return r}getThermalCopper(t,e,r,i,n,s=!1,a=!1){let l=I0(this.getCopperByLine(t,n)),c=nr(),h=TGe.add(c,e,r.net,!0,l);return this.filter.addThermalCopper(h),{copper:h,line:t,width:n,pad:r,isPolygonPad:i,is45:s,isVertical:a}}getCopperByLine(t,e){return[t.stroke(e,wr.ROUND,ae.CW).asClose()]}getPourProfile(t){return Xo.getInstance().getItem(t)}needCheckConnect(t,e){return t instanceof et||t instanceof Ct||t instanceof yn&&this.thermalSet.has(t)}getIslandsByCoppers(t){return t.filter(e=>this.island(e))}};var CGe=Xo.getInstance();function SGe(o){o.forEach(t=>{CGe.delete(t,t.globalIndex);let e=nr();t.globalIndex=e,CGe.addModel(t),zn.addPlaneZoneByModel(t)})}function EGe(o){return o!=null&&(o.remove(),A.publish("delete",o)),!0}async function Zoe(o){let{uuid:t,dataStr:e,source:r,title:i,docType:n}=o;if(n!==4)return;let[s,a]=r.split("|"),l=Ji.getInstance(),c=l.getItem(s);if(c!=null){let h=i||c.footprintId;return await l.addCustomFootprint(t,R.getInstance().compilerChannel),!0}return!1}var z3=class{getSource(t,e,r){new Rb(t,"modify"),Ce.dispatch(t,"delete"),A.publish("hasModifyPcbItem",t),A.publish("delete",t);let i=new d1("2.0"),n;return e instanceof Array?e.forEach(s=>{n=i.replace(t.model,s[0],s[1])}):n=i.replace(t.model,e,r),t.remove(),n}parseSource(t){let e=new p1(t);return e.build(),e.items.length>0?e.items[0]:null}async addFootprint(t){return!t||!t.uuid||R.getInstance().doctype!=3?void 0:t.uuid.indexOf("_")>-1?Zoe(t):await Hi.add(t.uuid,R.getInstance().compilerChannel)}sycnName(t){for(let e in t){let r=Hi.getItem(e),i=Hi.getItem(t[e]);if(r!=null&&i!=null){let n=r.getChilds();for(let s of n)if(s instanceof Sc)for(let a of s.getComponents()){let l=Ar.getItem(a.globalIndex);l.idShape.value=i.footprintId,l.footprintId=i.footprintId}}}}};var Joe=class extends z3{constructor(){super();this.uuids=new Array;this.map={};A.subscribe("pcbEditDevice",this.editDevice.bind(this)),A.messageBus.rpcService("editDeviceResult",this.editResult.bind(this))}editDevice(e){if(e.component!=null){let r=new Set;for(let i of e.component){let n=ts.getItem(i.deviceUUID);r.add(n.uuid);let s=this.map[n.uuid];s==null&&(s=new Array,this.map[n.uuid]=s),s.push(i.globalIndex)}this.uuids=Array.from(r)}A.publish("editDevice",{type:e.type,uuids:this.uuids},Q())}async editResult(e){var n;let r=e.type;if(r==null||R.getInstance().doctype!=pi.PCB||!this.check(r))return;e.data instanceof Array||(e.data=[e.data]);let i=new hi().createGroup("Replace Device");for(let s of e.data){let a=s.modify,l=(n=s.option)==null?void 0:n.compareParam,c=this.getUpdateComponent(r,s,a);s.toBeReplaced&&c.forEach(y=>{i.addCommand4Item(y,"delete")});let h=new Array,u=s.device;for(let y of u)await this.addDevice(y);let d=c.map(y=>JSON.parse(JSON.stringify(y.attrKeyValue)));if(c.forEach(y=>{let b=ts.getItem(y.deviceUUID),P=[["Device",a[b.uuid]]];if(l){let I=ts.getItem(a[b.uuid]);P.push(["Footprint",l.keepFootprint||!I.footprintUUID?y.footprintUUID:I.footprintUUID]);for(let C in y.attrKeyText){let E=y.attrKeyText[C];if(!["Device","Footprint"].includes(C)){let O=this.replaceAttr(l,C,E.value,I.attrs[C]);O==null?y.removeAttribute(E):O!=E.value&&P.push([C,O])}}}let T=this.getSource(y,P);h.push(T)}),r==2&&!s.toBeReplaced){for(let y of u)this.removeDevice(y);for(let y of u)await this.addDevice(y)}let p=s.footprint;for(let y of p)await this.addFootprint(y);if(c.length==0)return;this.sycnName(a);let m=R.getInstance().isactive;R.getInstance().isactive=!0,A.publish("clearSelect","");let g=[];h.forEach(y=>{let b=this.parseSource(y),P=ts.getItem(b.deviceUUID);for(let T in P.attrs)["Device","Designator"].includes(T)||this.modifyAttr(b,T,P.attrs[T]);g.push(b)}),this.replaceAttrs(l,d,g),s.toBeReplaced&&g.forEach(y=>{i.addCommand4Item(y,"add")}),R.getInstance().isactive=m}e.data[0].toBeReplaced?i.execute():(qe.clear(),A.windowBridge.rpcCall("save",{tabId:R.getInstance().tabId},Q())),A.publish("flushService",""),this.clear()}getUpdateComponent(e,r,i){let n=new Array;switch(e){case 0:for(let s in i){let a=this.map[s];a!=null&&(a.forEach(l=>{let c=Ar.getItem(l);n.push(c)}),delete this.map[s])}break;case 1:case 2:for(let s in i){let a=ts.getItem(s);a!=null&&(a.getComponents().forEach(c=>{let h=Ar.getItem(c.globalIndex);n.push(h)}),delete this.map[s])}break}return r.toBeReplaced&&(n=n.filter(s=>r.toBeReplaced.includes(s.globalIndex))),n}async addDevice(e){return await ts.add(e.uuid,R.getInstance().compilerChannel)}removeDevice(e){let r=ts.getItem(e.uuid);return ts.delete(r),r}check(e){return!(e!=2&&Object.keys(this.map).length==0)}clear(){this.uuids.length=0}isNull(e){return e===""||e==null}modifyAttr(e,r,i){r=="Device"?e.device=i:r=="Designator"?e.name=i:e.modifyATTRMap(r,i)}replaceAttr(e,r,i,n){if(i==n)return i;if(r=="Device")return n;if(r==="Designator"||r==="Unique ID")return e.keepDesignator&&!this.isNull(i)||this.isNull(n)?i:n;if(r==="Footprint")return e.keepFootprint&&!this.isNull(i)||this.isNull(n)?i:n;if(["3D Model","3D Model Title","3D Model Transform"].includes(r))return e.keep3DModel&&!this.isNull(i)||this.isNull(n)?i:n;if(!(e.type==="targetBase"&&n==null)){if(e.noneNull){if(this.isNull(i)&&!this.isNull(n))return n;if(!this.isNull(i)&&this.isNull(n))return i}return e.type=="currentFirst"?i:n||""}}replaceAttrs(e,r,i){if(e)for(let n=0;n<i.length;n++){let s=i[n],a=r[n],c=ts.getItem(s.deviceUUID).attrs,h=Array.from(new Set([].concat(Object.keys(a),Object.keys(c)))).filter(u=>!["Device","Footprint","Symbol","Convert to PCB","Sim Model","Sim Model Title","Sim Model Path","NGSpice Model","NGSpice Model Title","NGspice Model Path"].includes(u));for(let u of h){let d=this.replaceAttr(e,u,a[u],c[u]),p=s.attrKeyValue[u];d!=null&&d!=p&&this.modifyAttr(s,u,d),d==null&&p!=null&&s.deleteATTRMap(u)}}}};var ese=class extends z3{constructor(){super();this.uuids=new Array;this.map={};A.subscribe("pcbUpdateDevice",this.editUpdate.bind(this))}editUpdate(e){if(e.component!=null){let r=new Set;for(let i of e.component){let n=ts.getItem(i.deviceUUID);r.add(n.uuid);let s=this.map[n.uuid];s==null&&(s=new Array,this.map[n.uuid]=s),s.push(i.globalIndex)}this.uuids=Array.from(r)}A.publish("updateComponent",{type:2,uuids:this.uuids},Q())}};var tse=class extends z3{constructor(){super(),he.subscribe("updateComponent",this.editUpdate.bind(this))}editUpdate(t){let e=new Array;if(t.component!=null)for(let r of t.component){let i={device:r.deviceUUID,footprint:r.footprintUUID};e.push(i)}he.publish("updateComponent",{type:2,uuids:e},Q())}};function _A(o,t,e=!0,r){e&&A.publish("updateRtree","");let i=kt.search(o.buildBBox(),(n,s)=>s=="Via");for(let n of i.vias){let l=function(c){let h=o.getMathGraphics(c),u=n.getMathGraphics();if(!h||!u)return;if(Gy.build2(h,u).inInner()){let p=Ce.dispatch(n,"modify");t.addCommand(p),A.publish("hasModifyPcbItem",n),n.net=Object.is(r,void 0)?o.net:r,A.publish("hasModifyPcbItem",n)}},[s,a]=[n.startLayer,n.endLayer];l(s),l(a)}}function OGe(o){let t=[];t.push(o);let e=new Set([]),r=new Set([]);for(;t.length>0;){let n=t.shift();if(!e.has(n)){if(n===o||!(n instanceof _i&&!n.isTestPad)){let s=n.searchNode(),a=[],l=!0;for(let c=0;c<s.length;c++)if(s[c]!==o){if(n instanceof Ge&&s[c]instanceof _i&&!s[c].isTestPad){l=!1;break}if(s[c]instanceof Ge||s[c]instanceof Ue||s[c]instanceof _i&&s[c].isTestPad){if(e.has(s[c]))continue;let h=n.getParent(),u=s[c].getParent();if(h&&u&&h===u)continue;a.push(s[c])}}l&&(i(r,a),t=t.concat(a))}e.add(n)}}return Array.from(r);function i(n,s){for(let a=0;a<s.length;a++)n.add(s[a])}}var BR=class{constructor(t){this.setOptions(t)}setOptions(t){let e=t.config;this.isNull(e.maxSpace)&&(e.maxSpace=e.autoSpace),this.isNull(e.minSpace)&&(e.minSpace=e.autoSpace),this.options=t}isNull(t){return Object.is(t,void 0)||Object.is(t,null)}getLayouts(){let t=this.options,e=new Rl;t.sourcePositionMap.forEach(n=>{e.put(n.uniqueId,n)});let r=new Rl;if(t.targets.forEach(n=>{if(!(n instanceof ke))return;let s=n.attrsMap["Unique ID"],a=s&&e.get(s),l=n.buildBBox();if(!a||!l){!l&&console.warn("LayoutTransmission data error!");return}let c=new S(a.x,a.y),h=n.position,u=l.transform(Qe.translate1(c.sub(h)));r.put(s,{component:n,position:c,bbox:u})}),e.clear(),e=null,r.size()<2)return Object.values(r.origin());let i=Object.values(r.origin()).sort((n,s)=>{let a=n.bbox.minX-s.bbox.minX;return a===0?s.bbox.maxY-n.bbox.maxY:a});return r.clear(),this.placeOneByOne(i,!0),i=i.sort((n,s)=>{let a=s.bbox.maxY-n.bbox.maxY;return a===0?n.bbox.minX-s.bbox.minX:a}),this.placeOneByOne(i,!1),i}fixPosition(t,e){let r=!e,i=this.options.config,n=i.maxSpace,s=i.minSpace,a=i.autoSpace,l=t[0],c=Qe.scale(1),h=null;t.forEach((u,d)=>{if(!l||l===u){l=u;return}u.position=u.position.multiply3(c),u.bbox=u.bbox.transform(c);let p=u.bbox;h=ht.extend2(h,l.bbox);let m=!1,g=!1,y=null;t.some((E,O)=>O===d?!0:(e&&E.bbox.maxY+s<=p.minY||r&&E.bbox.minX+s>=p.maxX||(y=ht.extend2(y,E.bbox)),!1)),y||(y=h),y.intersection1(p)&&(m=e,g=r);let P=p.minX-y.maxX;!m&&e&&P>0&&!(s<=P&&P<=n)&&(m=!0);let T=y.minY-p.maxY;!g&&r&&T>0&&!(s<=T&&T<=n)&&(g=!0);let I=0,C=0;if(e&&m&&(I=y.maxX-p.minX+a),r&&g&&(C=y.minY-p.maxY-a),I||C){let E=Qe.translate(I,C);u.position=u.position.multiply3(E),u.bbox=p.transform(E),c=c.multiply3(E)}l=u})}placeOneByOne(t,e,r=Qe.scale(1),i=1){for(;i>=0&&i<t.length;){let n=t[i];this.updateItemPosition(n,r);let s=Qe.scale(1),a=!0,l=i-1;for(;l>=0;){let c=t[l],h=this.getBBoxPositionInfo(c.bbox,n.bbox),u=!1;h.interset?u=!0:u=e&&a&&!this.isMatchSpace(h.dx_right)||!e&&a&&!this.isMatchSpace(h.dy_bottom),u&&(s=this.autoPlacedByAutoSpace(c,n,e,h.interset,h,s).totalMatrix),a=!1,l--}i++,r=r.multiply3(s)}}autoPlacedByAutoSpace(t,e,r,i,n,s){n=n||this.getBBoxPositionInfo(t.bbox,e.bbox);let a=this.options.config.autoSpace,l=0,c=0;if(l=-(n.dx_right-a),!n.interset&&this.isMatchSpace(n.dx_right)&&(l=0),c=n.dy_bottom-a,!n.interset&&this.isMatchSpace(n.dy_bottom)&&(c=0),i?Math.abs(l)<=Math.abs(c)?c=0:l=0:r?c=0:l=0,s){let h=Qe.translate(l,c);this.updateItemPosition(e,h),(r&&l!=0||!r&&c!=0)&&(s=s.multiply3(h))}return{dx:l,dy:c,totalMatrix:s}}updateItemPosition(t,e){return t.position=t.position.multiply3(e),t.bbox=t.bbox.transform(e),t}isMatchSpace(t){if(t<0)return!0;let e=this.options.config,r=e.maxSpace,i=e.minSpace;return t>=i&&t<=r}getBBoxPositionInfo(t,e){let r=e.maxY>t.maxY,i=e.maxX>t.maxX,n=e.minY<t.minY,s=e.minX<t.minX,a=t.isIntersect(e),l=t.minX-e.maxX,c=e.minX-t.maxX,h=e.minY-t.maxY,u=t.minY-e.maxY;return{up:r,right:i,down:n,left:s,interset:a,dx_left:l,dx_right:c,dy_top:h,dy_bottom:u}}};function AGe(o,t="."){return o.join(t)}function OSe(o,t="."){return o.split(t)}function ASe(o,t,e="."){let r=OSe(t,e),i={levelKeys:r,queryState:!1,levelValue:null};if(!o||typeof o!="object")return i;let n=r.length,s=!1,a=0,l=o;for(;!s&&a<n;){let c=r[a];l&&typeof l=="object"&&Object.hasOwn(l,c)?(l=l[c],a++):s=!0}return s||(i.queryState=!0,i.levelValue=l),i}async function _Se(o){let t=Pe.detectDisabledLayerTables(o),{hasDisabledLayer:e,layerIdReplacementTableMapping:r,mergedDisabledLayerTable:i}=Q3t(t);if(!e)return{layerIdReplacementTableMapping:r};let n=!0,s={mergedDisabledLayerTable:i,skipLayerEnable:n},a=(await he.windowBridge.rpcCall("openUnableLayerObjDialog",s,Q())).message,l=a==null?void 0:a.action,c=a==null?void 0:a.layerIdReplacementTableByName,h=null;if(l=="confirm"&&n){let d=Pe.enableLayers(i,!1);d&&(c=d.layerIdReplacementTableByName,h=d.repeatedNameLayers),wm.getInstance().updateLayerInfo(),Hre()}return eEt(r,c,t),my(h)||he.windowBridge.publish("pro-ui/showRepeatedNameLayers",h,Q()),{layerIdReplacementTableMapping:r,detectedResMapping:t,dialogResponse:a}}function Q3t(o){let t=!1,e={},r={};return kf(o,(i,n)=>{let{disabledLayerTable:s,layerIdReplacementTable:a}=i;t||(t=!my(s)),e[n]=a,kf(s,l=>{let{layerId:c,layerName:h,layerType:u}=l,d=u=="CUSTOM"?h:c;(!n||!qO(r,d))&&(r[d]=l)})}),{hasDisabledLayer:t,layerIdReplacementTableMapping:e,mergedDisabledLayerTable:r}}function eEt(o,t,e){return o||(o={}),my(t)||kf(e,(r,i)=>{let{disabledLayerTable:n}=r,s;kf(n,a=>{let{layerId:l,layerName:c}=a,h=t[c];h&&(s||(s=Cb(o,i,{},!0)),$O(s,l,h))})}),o}async function rse(o,t){if(!o)return o;let e="",r,i=!1;Array.isArray(o)?(r=new Map,Ix(r,e,o),i=!0):r=o;let n=new Map,s=new Map,a={};JO(r,(p,m)=>{let g=new Set;if(sc(p,y=>{if(y instanceof ke){let b=y.footprintUUID;if(ug(n,b,[],!0).push(y),!qO(a,b)){let T=y.getBasicLayerTable();$O(a,b,T)}}else{let b=y.layerId;ug(s,m,[],!0).push(y),g.add(b)}}),g.size>0){let y=t(g,m);my(y)||$O(a,m,y)}});let l=await _Se(a);if(!l)return i?ug(r,e):r;let{layerIdReplacementTableMapping:c,detectedResMapping:h,dialogResponse:u}=l;return(u==null?void 0:u.action)=="cancel"&&s.size>0&&JO(s,(p,m)=>{let g=Cb(h,m),y=g==null?void 0:g.disabledLayerTable;if(my(y))return;let P=ug(r,m).filter(T=>{let I=T.layerId,C=I&&qO(y,I);return C&&T.remove(),!C});Ix(r,m,P)}),my(c)||JO(r,(p,m)=>{let g=Cb(c,m);sc(p,y=>{if(y instanceof ke){let b=y.footprintUUID,P=Cb(c,b);y.setLayerIdReplacementTable(P,!0)}else if(g){let b=y.layerId,P=Cb(g,b);P&&(y.layerId=P)}})}),i?ug(r,e):r}var ise=class{constructor(){this.historyGroup=null;this.deleteComponentMap={};this.footprintName2PositionMap={};this.uniqueId2RemoveComponentId=new Rl;this.oldComponentId2NewComponentIdMap=new Rl;this.sourcePositionMap=new Rl;this.addComponentMap=[];this.addUniqueId2ComponentIdMap=new Rl;this.reuseData=new Array;this.hasCheckedOpenStiffenerLayer=!1;this.ignoreAttr=new Set(["Footprint","Device","Symbol","Convert to PCB","3D Model","3D Model Transform","3D Model Title","FootprintName","DeviceName","SymbolName","CBB Title","CBB ID","Sim Model","Sim Model Title","Sim Model Path","NGSpice Model","NGSpice Model Title","NGspice Model Path"]);this.footprints=new Set;A.messageBus.rpcService("pcb/editor/updateForNetList",this.apply.bind(this)),A.messageBus.rpcService("pcb/editor/modifyPartitionFlag",this.modifyPartitionFlag.bind(this))}async apply(t){if(!t||!R.getInstance().isactive||R.getInstance().doctype!=3)return;let e=this.init(),r=Ar.isEmpty(),i;i=this.dataClassify(t,r),t=null,setTimeout(async()=>{A.publish("showLoading","",Q());let{addMap:s,updateMap:a,delMap:l,commonCompared:c,env:h,pcbModule:u}=i;i=null,this.delComponents(l);let d;{let p=this.initPosition();d=await this.addComponents(s,u),this.layoutTransmission(p),this.sourcePositionMap.clear()}{let p=this.getComponentNetMap(s,[],[]);s.length=0,s=null,this.addUniqueId2ComponentIdMap.clear(),this.updateConnectNet(p,!1,!0),p=null}this.updateComponents(a),a.length=0,a=null,this.updatePadConnectNet();{let p=this.updateCommonCompared(c);c=null,p&&Object.keys(p).length>0&&A.publish("ui/commonComparedResApplyRes",{commonComparedResApplyRes:p,env:h},Q())}A.publish("hideLoading","",Q()),await this.checkShapesEnableLayer(),this.historyGroup.length>0&&(qe.executeCommand(this.historyGroup),this.historyGroup=null),d.length>0&&A.publish("rebuildSingleCopper",{ids:d,isLast:!0}),A.publish("autoFill",""),A.publish("flushService",""),e&&A.publish("toggleLayerSelected",{layerid:e}),this.reset(),n()},50);function n(){A.publish("ui/toastMsg",{type:"info",msg:"Import finished"},Q())}}init(){let t=Ze.getInstance().activeLayer;return t==1?t=null:A.publish("toggleLayerSelected",{layerid:1}),this.historyGroup=new De("import change for Net list"),A.publish("clearSelect",""),this.usedReuseTemplateDecoders=[],t}dataClassify(t,e){var m,g;let{componentCompared:r,commonCompared:i,options:n,env:s}=t,{updateConnectNet:a,customAttr:l,pcbModule:c}=n;this.customAttr=l||{};let h=[],u=[],d=[];for(let y in r){let b=r[y];b.delComponent&&h.push(b.delComponent),b.addComponent&&(u.push(b.addComponent),b.delComponent&&(b.addComponent.extra||(b.addComponent.extra={}),b.addComponent.extra.source||(b.addComponent.extra.source={}),b.addComponent.extra.source.componentId=(g=(m=b.delComponent.extra)==null?void 0:m.source)==null?void 0:g.componentId)),b.updateComponent&&d.push(b.updateComponent)}let p=this.getComponentNetMap([],h,d,r);return!e&&this.updateConnectNet(p,a),t.componentCompared={},{addMap:u,updateMap:d,delMap:h,commonCompared:i,env:s,pcbModule:c}}delComponents(t){t.forEach(e=>{this.deleteComponent(e)})}initPosition(){let t=of(),e=t&&t.minX,r=t&&t.minY,i=S.ORIGIN;return this.isNull(e)||this.isNull(r)?i=R.getInstance().origin:i=new S(e,r),this.nextPosition=new S(i.x,i.y-10),i}async addComponents(t,e){let r=new WeakSet,i=[];e&&Object.keys(e).length>0&&(r=await this.reuseTemplate(t,e,i));for(let n of t)r.has(n)||await this.addComponent(n);return r=null,i}updateComponents(t){t.forEach(e=>{this.updateComponent(e)})}updateCommonCompared(t){var T,I,C,E,O,_,x,v,D,w,F,H,z,V,W;if(!t)return;let{designRuleCompared:e,netClassCompared:r,equalLengthNetGroupCompared:i,differentialPairCompared:n}=t,s=re.getInstance(),a={},l=R.getInstance(),c=l.compiler,h=Sr.getInstance(),u=!1,d=new Set;if(e){s.setRuleTemplateName("Custom Config");let{trackPhysics:L,netRule:k}=e,N=new Set,U=new Set,B="common";(T=L==null?void 0:L.less)==null||T.forEach(G=>{let Y=G==null?void 0:G.name;Y&&(s.deleteTrackPhysics(Y),c.deleteRule(Nf("3"),Y),u=!0)}),(I=L==null?void 0:L.more)==null||I.forEach(G=>{if(!G)return;let{name:Y,isDefault:X,strokeValue:K,unit:J}=G,se=rH(J),ce=this.valueDomain2RuleFactory(K,se);if(!ce)return;let te=s.addTrackPhysics(Y,X,1,ce);te&&(te.unit=J,N.add(te))}),(C=L==null?void 0:L.changed)==null||C.forEach(G=>{if(!G)return;let{oldItem:Y,newItem:X,changedKeys:K}=G;if(!Y||!X||K.length==0)return;let J=s.getTrackPhysics(Y.name);if(!J)return;let se=rH(X.unit);K.forEach(ce=>{if(ce=="isDefault")J.isDefault=!!X.isDefault;else if(ce=="unit")J.unit=X.unit;else if(ce.indexOf("strokeValue")==0){let te=OSe(ce),oe=+te[1],$=te[2];if(!$)return;te[1]=B;let fe=AGe(te),Oe=ASe(X,ce);Oe.queryState||(Oe=ASe(X,fe));let Te=+Oe.levelValue;if(!Oe.queryState||!Te)return;let ue=tb(Te,se);(oe?[oe]:J.getAllLayerCodes()).forEach(j=>{$=="min"?J.setMinWidth(ue,j):$=="max"?J.setMaxWidth(ue,j):$=="default"&&J.setDefaultWidth(ue,j)})}N.add(J)})}),(E=k==null?void 0:k.changed)==null||E.forEach(G=>{if(!G)return;let{oldItem:Y,newItem:X,changedKeys:K}=G;if(!Y||!X||K.length==0)return;let J=X.ruleMap;if(!J)return;let se=Y.net,ce=s.getNet(se);if(!(!ce||!b([se],{},"","changed",G,"OldNetworkNotExist",()=>p().netRule))){for(let oe in J){let $=this.validRuleName(J[oe]);oe=="TrackPhysics"&&s.getTrackPhysics($)&&(ce.trackPhysics=$,U.add(ce))}d.add(se)}}),U.size>0&&(u=!0,U.forEach(G=>{c.uploadRuleSelector(h.encode("RULE_SELECTOR",G)),d.add(G.name)})),N.size>0&&(u=!0,N.forEach(G=>{c.uploadRule(h.encode("RULE",G))}))}if(r){let L=new Set;(O=r==null?void 0:r.less)==null||O.forEach(N=>{let U=N==null?void 0:N.name,B=U&&s.getNetClass(U);B&&(B.getNets().forEach(G=>{d.add(G)}),s.deleteNetClass(U),c.deleteRuleSelector(["NET_CLASS",U]),u=!0)}),(_=r==null?void 0:r.changed)==null||_.forEach(N=>{if(!N)return;let{oldItem:U,newItem:B,changedKeys:G}=N;if(!U||!B||G.length==0)return;let Y=s.getNetClass(B.name);Y&&G.includes("nets")&&PL(U.nets,B.nets).more.forEach(X=>{Y.removeNetwork(X),d.add(X),L.add(Y)})});let k={};s.getAllNetClass().forEach(N=>{let U=N.name;N.getNets().forEach(B=>{k[B]=U})}),(x=r==null?void 0:r.more)==null||x.forEach(N=>{if(!N)return;let{name:U,nets:B,netRule:G}=N,Y=s.addNetClass(U);L.add(Y),B.forEach(X=>{if(!b([X],k,U,"more",N,"NewNetworkNotExist",m))return;let J=s.getNet(X);J&&(Y.addNetwork(J),k[X]=U,d.add(X))})}),(v=r==null?void 0:r.changed)==null||v.forEach(N=>{if(!N)return;let{oldItem:U,newItem:B,changedKeys:G}=N;if(!U||!B||G.length==0)return;let Y=s.getNetClass(B.name);if(Y&&G.includes("nets")){Y.remove();let X=B.name,K=!1;B.nets.forEach(J=>{if(!b([J],k,X,"changed",N,"NewNetworkNotExist",m))return;let ce=s.getNet(J);ce&&(Y.addNetwork(ce),d.add(J),K=!0)}),K&&L.add(Y)}}),L.size>0&&(u=!0,L.forEach(N=>{c.uploadRuleSelector(h.encode("RULE_SELECTOR",N))}),A.publish("forceRenderTree",xl.NetClasses,Q()))}if(i){let L=new Set;(D=i==null?void 0:i.less)==null||D.forEach(N=>{let U=N==null?void 0:N.name,B=U&&s.getEqualLengthGroup(U);B&&(B.getNets().forEach(G=>{d.add(G)}),s.deleteEqualLengthGroup(U),c.deleteRuleSelector(["EQ_LEN_GRP",U]),u=!0)}),(w=i==null?void 0:i.changed)==null||w.forEach(N=>{if(!N)return;let{oldItem:U,newItem:B,changedKeys:G}=N;if(!U||!B||G.length==0)return;let Y=s.getEqualLengthGroup(B.name);Y&&G.forEach(X=>{X=="nets"&&PL(U.nets,B.nets).more.forEach(K=>{Y.deleteNet(K),d.add(K),L.add(Y)})})});let k={};s.getAllEqualLengthGroups().forEach(N=>{let U=N.name;N.getNets().forEach(B=>{k[B]=U})}),(F=i==null?void 0:i.more)==null||F.forEach(N=>{if(!N)return;let{name:U,nets:B,useRuleName:G}=N,Y=s.addEqualLengthGroup(U);L.add(Y),B.forEach(X=>{if(!b([X],k,U,"more",N,"NewNetworkNotExist",g))return;let J=s.getNet(X);J&&(Y.addNetwork(J),k[X]=U,d.add(X))}),Y.netLengthPhysics=this.validRuleName(G)}),(H=i==null?void 0:i.changed)==null||H.forEach(N=>{if(!N)return;let{oldItem:U,newItem:B,changedKeys:G}=N;if(!U||!B||G.length==0)return;let Y=s.getEqualLengthGroup(B.name);if(!Y)return;let X=!1;G.forEach(K=>{if(K=="nets"){Y.remove();let J=B.name;B.nets.forEach(se=>{if(!b([se],k,J,"changed",N,"NewNetworkNotExist",g))return;let te=s.getNet(se);te&&(Y.addNetwork(te),d.add(se),X=!0)})}else K=="useRuleName"&&(Y.netLengthPhysics=this.validRuleName(B.useRuleName),X=!0)}),X&&L.add(Y)}),L.size>0&&(u=!0,L.forEach(N=>{c.uploadRuleSelector(h.encode("RULE_SELECTOR",N))}),A.publish("forceRenderTree",xl.EqualLengthGroups,Q()))}if(n){let L=new Set;(z=n==null?void 0:n.less)==null||z.forEach(N=>{let U=N==null?void 0:N.name,B=U&&s.getNetDifferential(U);B&&(B.getNets().forEach(G=>{d.add(G)}),s.deleteNetDifferential([U]),c.deleteRuleSelector(["DIFF_PAIR",U]))});let k={};s.getAllNetDifferentials().forEach(N=>{let U=N.name;[N.negativeNet.name,N.positiveNet.name].forEach(B=>{k[B]=U})}),(V=n==null?void 0:n.more)==null||V.forEach(N=>{if(!N)return;let{name:U,positiveNet:B,negativeNet:G,useRuleName:Y}=N;if(!b([B,G],k,U,"more",N,"NewNetworkNotExist",y))return;let K=s.addNetDifferential(U,B,G,this.validRuleName(Y));k[B]=U,k[G]=U,L.add(K),d.add(B),d.add(G)}),(W=n==null?void 0:n.changed)==null||W.forEach(N=>{if(!N)return;let{oldItem:U,newItem:B,changedKeys:G}=N;if(!U||!B||G.length==0)return;let Y=s.getNetDifferential(B.name);if(!Y||!b([B.positiveNet,B.negativeNet],k,B.name,"changed",N,"NewNetworkNotExist",y))return;let K=!1;G.forEach(J=>{K=!0,J=="positiveNet"?(Y.positiveNet=s.getNet(B.positiveNet),d.add(B.positiveNet)):J=="negativeNet"?(Y.negativeNet=s.getNet(B.negativeNet),d.add(B.negativeNet)):J=="useRuleName"&&(Y.differentialPhysics=this.validRuleName(B.useRuleName))}),K&&L.add(Y)}),L.size>0&&(u=!0,L.forEach(N=>{c.uploadRuleSelector(h.encode("RULE_SELECTOR",N))}),A.publish("forceRenderTree",xl.Differentials,Q()))}return d.size>0&&(u=!0,d.forEach(L=>{Kf(L)}),A.publish("forceRenderTree",xl.Nets,Q())),u&&A.publish("setPcbTabUnSaved",[l.tabId,!0],Q()),a;function p(){return a.designRuleCompared||(a.designRuleCompared={trackPhysics:{},netRule:{}}),a.designRuleCompared}function m(){return a.netClassCompared||(a.netClassCompared={}),a.netClassCompared}function g(){return a.equalLengthNetGroupCompared||(a.equalLengthNetGroupCompared={}),a.equalLengthNetGroupCompared}function y(){return a.differentialPairCompared||(a.differentialPairCompared={}),a.differentialPairCompared}function b(L,k,N,U,B,G,Y){let X=[],K={};L.forEach(se=>{if(!se)return;s.getNet(se)||X.push(se);let ce=k[se];ce&&ce!=N&&(K[se]=ce)});let J=!0;if(X.length>0){let se=Y();P(se,U,B,G,{notExistNets:X}),J=!1}if(Object.keys(K).length>0){let se=Y();P(se,U,B,"NetworkConflict",{netConflictMap:K}),J=!1}return J}function P(L,k,N,U,B){if(!L)return;let G=L[k];G||(G=L[k]=[]);let Y={applyRes:U,commonComparedItem:N};B&&Object.assign(Y,B),G.push(Y)}}valueDomain2RuleData(t,e){if(!t)return null;let{default:r,min:i,max:n}=t;return isNaN(r)?null:(isNaN(i)&&(i=r),isNaN(n)&&(n=r),{defaultValue:tb(r,e),minValue:tb(i,e),maxValue:tb(n,e)})}valueDomain2RuleFactory(t,e){if(!t)return null;let r=new Map;for(let i in t){let n=+i;n||(n=1);let s=this.valueDomain2RuleData(t[i],e);s&&r.set(n,s)}return new wa(r)}validRuleName(t){return t||"default"}modifyPartitionFlag(t){var r,i,n,s;let e=[];for(let a in t){let l=t[a];if(l.delComponent){let c=(i=(r=l.delComponent.extra)==null?void 0:r.source)==null?void 0:i.componentId,h=c&&this.getComponent(c),u=h.partition!="";u||(u=!Mt.checkIsInCanEdit(h)),l.delComponent.extra.source.isPartition=u}if(l.updateComponent){let c=(s=(n=l.updateComponent.baseComponent.extra)==null?void 0:n.source)==null?void 0:s.componentId,h=c&&this.getComponent(c);l.updateComponent.baseComponent.extra.source.isPartition=h.partition!="",e.push(l.updateComponent)}}return e.forEach(a=>{var y,b,P,T;let{baseComponent:l,nets:c}=a;if(((b=(y=l.extra)==null?void 0:y.source)==null?void 0:b.isPartition)==!0)return;let h=(T=(P=l.extra)==null?void 0:P.source)==null?void 0:T.componentId,u=h&&this.getComponent(h),d=l.uniqueId;if(!u||!d||Mt.checkIsInCanEdit(u))return;l.extra.source.isPartition=!0;let m={};c.forEach(I=>{m[I.key]=I});let g=u.getPads();for(let I of g){let C=m[I.num];if(C!=null){let E=u.partition!="";C.isPartition=E}}}),t}reset(){this.deleteComponentMap={},this.footprintName2PositionMap={},this.uniqueId2RemoveComponentId.clear(),this.oldComponentId2NewComponentIdMap.clear(),this.addComponentMap.length=0,this.addUniqueId2ComponentIdMap.clear(),this.sourcePositionMap.clear(),this.reuseData.length=0,this.hasCheckedOpenStiffenerLayer=!1,delete this.historyGroup,delete this.customAttr,delete this.nextPosition,delete this.connectionGroups,delete this.visitedComponentPads,delete this.usedReuseTemplateDecoders}isNull(t){return Object.is(t,void 0)||Object.is(t,null)}getComponentNetMap(t,e,r,i){let n=this,s={};t.forEach(l=>{let c=l.uniqueId;if(!c)return;let h=l.nets,u=s[c];if(!u){let d=this.addUniqueId2ComponentIdMap.get(c);if(!d)return;u={net:{},componentId:d},s[c]=u}for(let d in h)u.net[d]=h[d];l.uniqueId=null,l.props=null,l.nets=null,l.extra=null}),e.forEach(l=>{var c;if(i){let h=l.uniqueId,u=(c=i[h])==null?void 0:c.addComponent;if(u){let d=l.nets||{},p=u.nets||{},m=[];for(let g in p)m.push({type:Object.hasOwn(d,"num")?"update":"add",key:g});a(l,u,m);return}}a(l)}),r.forEach(l=>{a(l.baseComponent,l.importComponent,l.nets)});function a(l,c,h){var g,y,b,P;let u=(y=(g=l.extra)==null?void 0:g.source)==null?void 0:y.componentId,d=u&&n.getComponent(u),p=l.uniqueId;if(!d||!p)return;let m=s[p];if(m||(m={net:{},componentId:u,isPartition:(P=(b=l.extra)==null?void 0:b.source)==null?void 0:P.isPartition},s[p]=m),h&&c){h.forEach(T=>{let I=T.key,C=c.nets[I];m.net[I]=C});return}if(c)Object.assign(m.net,c.nets);else{let T=d.getPads();for(let I of T)m.net[I.num]=I.net}}return s}async reuseTemplate(t,e,r){let i=new Map;for(let l of t){let c=l.props["Reuse Block"];c!=null&&c!=""&&KO(i,c,l)}let n=new WeakSet,s=new Set,a=new Set;for(let[l,c]of i){let h=e[l];if(h==null)continue;let u=new Rl;for(let b of c)await this.addComponent(b,u),n.add(b);if(a.has(l)){u.clear();continue}let d=u.getKeys(),p=/R(\d+)/,m=d.sort((b,P)=>{let T=b.match(p),I=P.match(p);if(T&&I){let C=T[0],E=+T[1],O=b.split(C)[0],_=I[0],x=+I[1],v=P.split(_)[0];if(O==v)return E-x}return 0}),g=[];m.forEach(b=>{let P=u.get(b);P&&P.length>0&&g.push(P)}),A.publish("maskUpdateFrame","");let y=this.usedReuseTemplateDecoders;for(let b of g){let P=new AA;if(await P.parseTemplate(h),!P.hasComponents()){a.add(l);break}for(let I of b)this.historyGroup.addCommand(Ce.dispatch(I,"modify")),A.publish("hasModifyPcbItem",I);let T=P.reuse(b,l,!0);if(T!=null){P.isMatch||s.add(T.name),this.reuseData.push(T);let I=T.getItems();for(let C of I)C instanceof ke||(C instanceof He&&C.type==="Copper Region"&&r.push(C.globalIndex),this.historyGroup.addCommand(Ce.dispatch(C,"add")),A.publish("hasModifyPcbItem",C));this.historyGroup.addCommand(Ce.dispatch(T,"add")),y.push(P)}}u.clear()}if(s.size>0){let l=R.getInstance().tabId,c=[];for(let h of s){let d={attr:{id:Ht.getGroupByName(h).globalIndex,pcbid:l},text:h};c.push(d)}A.publish("ui/toastMsg",{type:"warn",msg:["The number of components in the following group templates is inconsistent with the reuse group, and the missing components are automatically ignored:",...s],bottomBarMsg:{type:"warn",msg:['<span class="i18n">The number of components in the following group templates is inconsistent with the reuse group, and the missing components are automatically ignored:</span>',...c]}},Q())}return i.clear(),s.clear(),i=null,s=null,n}updateConnectNet(t,e=!1,r=!1){A.publish("updateRtree","");for(let i in t){let n=t[i],a=this.getComponent(n.componentId).getPads();for(let l of a){let c=n.net[l.num];if(c!=null){if(l.net===c){r&&_A(l,this.historyGroup,!1,c);continue}e&&this.collectionPadConnectNodes(l),_A(l,this.historyGroup,!1,c),this.historyGroup.addCommand(Ce.dispatch(l,"modify")),A.publish("hasModifyPcbItem",l),l.net=c,A.publish("hasModifyPcbItem",l)}}}}collectionPadConnectNodes(t){let e=this.connectionGroups;e||(e=this.connectionGroups=[]);let r=this.visitedComponentPads;r||(r=this.visitedComponentPads=new Set);let i={componentPads:new Set,connectNodes:new Set},n=[t],s=new Set;for(;n.length>0;){let c=n.shift();if(l(c))continue;c.searchNode(!1).forEach(u=>{l(u)||n.push(u)}),a(i,c),s.add(c)}e.push(i);function a(c,h){let{componentPads:u,connectNodes:d}=c;if(h instanceof Ge||h instanceof Ue||h instanceof Le||h instanceof He&&["Fill Region","Line"].includes(h.type)||h instanceof Jr){if(h instanceof Le&&h.getParent())u.add(h),r.add(h);else if(d.add(h),h instanceof Jr){let m=h.getParent();d.add(m),m instanceof He&&m.iteratorCopper(g=>{d.add(g)})}}}function l(c){return r.has(c)||s.has(c)}}updatePadConnectNet(){let t=this.connectionGroups;if(!t)return;let e=this.historyGroup,r=!1;return t.forEach(i=>{let{componentPads:n,connectNodes:s}=i,a=new Set;if(n.forEach(c=>{a.add(c.net)}),a.size!=1)return;let l=a.values().next().value||"";l&&s.forEach(c=>{r=this.changeItemNet(c,l,e)||r})}),r}changeItemNet(t,e,r){if(t.net==e)return!1;let i=Ce.dispatch(t,"modify");return A.publish("hasModifyPcbItem",t),r.addCommand(i),t.net=e,A.publish("hasModifyPcbItem",t),!0}async addComponent(t,e){var v,D,w,F;let{uniqueId:r,props:i,nets:n,extra:s}=t,a=s==null?void 0:s.bindingLibs;if(!a)return;let l=(v=a.device)==null?void 0:v.libDetail,c=(D=a.footprint)==null?void 0:D.libDetail;if(!l||!c)return;let h=l.display_title,u=c.display_title,d=l.uuid,p=R.getInstance().compilerChannel,m=await ts.add(d,p),g=await Hi.add(c.uuid,p);if(!g)return;!this.hasCheckedOpenStiffenerLayer&&!this.footprints.has(g.id)&&(this.footprints.add(c.uuid),g.iterator(H=>ic(H.layerId)?(this.checkOpenStiffenerLayer(),!1):!0));let y=new E2,b=nr(),P=y.build(m.createComponent(b,g.uuid),S.ORIGIN),T=((w=this.deleteComponentMap[r])==null?void 0:w.location)||this.getPartPosition(u,P);P.position=new S(T.x,T.y),P.visible(),this.syncComponentConfig(P);let I=i.Designator;I&&P.name!=I&&(P.name=I,this.updateAttrShow(P,"Designator",I)),u&&(P.footprintId=u,this.updateAttrShow(P,"Footprint",u)),h&&P.deviceShape!=null&&(P.device=h,this.updateAttrShow(P,"Device",h));let C=new Set;for(let H in i){let z=i[H];if(this.isSpecialAttr(H))continue;if(H=="PCB Layer"){z=="BottomLayer"&&(P.layerId=2);continue}C.add(H),this.updateDeviceAttr(P,H,z);let V=le.attributeConfig.getAttribute("Designator");V!=null&&H==="Designator"&&(P.numShape.showValue=V.showValue)}if(C.size>0)for(let H in P.attrsMap)this.isSpecialAttr(H)||C.has(H)||this.updateDeviceAttr(P,H,"",!0);let E=this.deleteComponentMap[r];if(E){P.position=E.location,P.layerId=E.layerId,P.rotation=E.rotation;let H=E.groupId;if(H){let V=Ht.getItem(H);V?V.addItem(P):Ht.combination([P],H)}let z=E.num_location;z&&P.numShape&&(P.numShape.position=z,P.numShape.positionIsNull=E.num_positionIsNull,P.numShape.showKey=E.num_showKey,P.numShape.showValue=E.num_showVal,P.numShape.rotation=E.num_rotation)}this.updateNets(n,P,!1,!0),this.historyGroup.addCommand(Ce.dispatch(P,"add")),A.publish("hasModifyPcbItem",P);let O=s.layout,_=(F=s.source)==null?void 0:F.pageId;O&&_&&l2(this.sourcePositionMap.origin(),_).push({x:O.x,y:O.y,uniqueId:r}),!E&&this.addComponentMap.push(P),this.addUniqueId2ComponentIdMap.put(r,P.globalIndex),E==null&&P.combinationID!=null&&P.combinationID!=""&&e!=null&&e.computeIfAbsent(P.combinationID,()=>new Array).push(P);let x=this.uniqueId2RemoveComponentId.get(r);x&&this.oldComponentId2NewComponentIdMap.put(x,P.globalIndex)}syncComponentConfig(t){t.attributes.forEach(e=>{let r=le.attributeConfig.getAttribute(e.key);r!=null&&(e.showKey=r.showKey,e.showValue=r.showValue)})}checkOpenStiffenerLayer(t){if(this.hasCheckedOpenStiffenerLayer)return;let e=!t;if(t){for(let r of t.getItems())if(r instanceof He&&ic(r.layerId)){e=!0;break}}e&&(A.publish("checkOpenStiffenerLayer",""),this.hasCheckedOpenStiffenerLayer=!0)}layoutTransmission(t){if(this.sourcePositionMap.size()==0||this.addComponentMap.length==0)return;let e=10,r={autoSpace:tb(.5,39.37,e)},i=[],n=this.addComponentMap.filter(u=>u.getGroupID()==null);this.sourcePositionMap.iterator((u,d)=>{let p=new BR({sourcePositionMap:d,targets:n,config:r}).getLayouts();if(p.length==0)return!0;let m=null;return p.forEach(g=>{m=ht.extend2(m,g.bbox)}),i.push({bbox:m,items:p}),!0}),n.length=0;let s=tb(5,39.37,e),a=s,l=5;i.length>1&&(i=i.sort((u,d)=>{let p=u.bbox.area(),m=d.bbox.area();return p<m?-1:p>m?1:u.bbox.height()-d.bbox.height()}));let c=0,h=null;t=t.add1(0,-a),this.reuseData=this.reuseData.sort((u,d)=>{let p=u.buildBBox(),m=d.buildBBox(),g=p.area(),y=m.area();return g<y?-1:g>y?1:p.height()-m.height()});for(let u of this.reuseData){let d=u.buildBBox(),p=d.UL(),g=(h?h.UR().add1(s,0):t).sub(p),y=u.getItems(),b=Ae.translate(g.x,g.y,0);for(let T of y)this.historyGroup.addCommand(Ce.dispatch(T,"modify")),T.transform(b),A.publish("hasModifyPcbItem",T);let P=d.transform(Qe.translate1(g));h=ht.extend2(h,P),++c===l&&(c=0,t=h.LL().add1(0,-a),h=null)}for(let u of i){let{bbox:d,items:p}=u,m=u.bbox.UL(),y=(h?h.UR().add1(s,0):t).sub(m);p.forEach(b=>{let P=b.component;this.historyGroup.addCommand(Ce.dispatch(P,"modify"));let T=b.position.sub(P.position).add(y);return P.transform(Ae.translate(T.x,T.y,0)),A.publish("hasModifyPcbItem",P),!0}),d=d.transform(Qe.translate1(y)),h=ht.extend2(h,d),++c===l&&(c=0,t=h.LL().add1(0,-a),h=null),p.length=0}i.length=0}updateNets(t,e,r=!1,i=!1){t!=null&&e.getPads().forEach(n=>{Y0(t,n.num)?(r&&this.historyGroup.addCommand(Ce.dispatch(n,"modify")),n.net=t[n.num]||""):i&&(n.net="")})}isSpecialAttr(t){return this.ignoreAttr.has(t)}deleteComponent(t){var s,a;let e=(a=(s=t.extra)==null?void 0:s.source)==null?void 0:a.componentId,r=t.uniqueId,i=e&&this.getComponent(e);if(!i)return;this.deleteComponentMap[r]={location:i.position,layerId:i.layerId,rotation:i.rotation,num_positionIsNull:i.numShape?i.numShape.positionIsNull:!1,num_location:i.numShape?i.numShape.position:null,num_showKey:i.numShape?i.numShape.showKey:!1,num_showVal:i.numShape?i.numShape.showValue:!1,num_rotation:i.numShape?i.numShape.rotation:0,groupId:i.getGroupID()};let n=i.getGroupID();if(this.historyGroup.addCommand(Ce.dispatch(i,"delete")),i.remove(),A.publish("delete",i),A.publish("hasModifyPcbItem",i),n!=null){let l=Ht.getItem(n);l.getItems().length==0&&(this.historyGroup.addCommand(Ce.dispatch(l,"delete")),l.dissolution(),A.publish("delete",l))}this.uniqueId2RemoveComponentId.put(r,i.globalIndex)}updateComponent(t){var u,d,p,m;let{baseComponent:e,importComponent:r,props:i,nets:n}=t;if(((d=(u=e.extra)==null?void 0:u.source)==null?void 0:d.isPartition)==!0)return;let s=(m=(p=e.extra)==null?void 0:p.source)==null?void 0:m.componentId,a=s&&this.getComponent(s);if(!a)return;let l=r.props,c=r.nets;A.publish("hasModifyPcbItem",a),this.historyGroup.addCommand(Ce.dispatch(a,"modify")),i.forEach(g=>{if(this.isSpecialAttr(g.key))return;let y=g.type==="delete";this.updateDeviceAttr(a,g.key,l[g.key],y)});let h={};n.forEach(g=>{h[g.key]=c[g.key]}),this.updateNets(h,a,!0,!1),this.checkOpenStiffenerLayer(a),A.publish("hasModifyPcbItem",a)}getComponent(t){let e=Ar.getItem(this.oldComponentId2NewComponentIdMap.getOrDefault(t,t));if(e!=null)return e;console.warn("The device was not found!")}updateDeviceAttr(t,e,r,i=!1){if(i){if(e=="Device"){console.warn("Attributes that are not allowed to be deleted:",e);return}let n=t.attrKeyText[e];n&&(n.positionIsNull=!0,t.removeAttribute(n)),t.deleteATTRMap(e);return}if(e=="Group ID")t.combinationID=r;else if(e=="Channel ID")t.channelID=r;else if(e=="Reuse Block")t.reuseBlock=r;else if(e=="PCB Layer")t.layerId=r=="TopLayer"?1:2;else{t.model.addATTRMap(e,r);let n=t.attrKeyText;this.updateAttrShow(t,e,r),(r||r=="")&&n[e]&&(n[e].value=r),t.refreshNameValue()}}updateAttrShow(t,e,r){let i=this.getCustomeAttrByKey(e);if(!i)return;let s=t.attrKeyText[e];if(s)s.showKey=i.nameShow,s.showValue=i.valueShow;else if(i.nameShow||i.valueShow){let a=this.createATTR(t,e,r,i.nameShow,i.valueShow),l=ts.getItem(t.deviceUUID);l.has(a.key)&&l.addAttr(a.key,l.getAttrData(t.model,a.model))}t.resetAttr(s)}createATTR(t,e,r,i,n){let s=3;t.layerId==2&&(s=4);let a=le.getDefaultFontSetting(),l=ri.addText(s,e,i,r,n,a.defaultComponentFontTypeface,a.defaultComponentFontHeight,t.rotation,!1,t.getNewTextPosition(),2,a.defaultComponentFontStrokeWidth,!1,0,!1,!0);return t.addAttribute(l),l}getCustomeAttrByKey(t){let e=this.customAttr;return e&&e[t]?e[t].on_PCB:null}getPartPosition(t,e){let i=this.footprintName2PositionMap[t],n=S.ORIGIN,s=this.getDeviceBBox(e),a=e.position,l=new S((s.minX+s.maxX)/2,(s.minY+s.maxY)/2),c=l.x-a.x,h=-(l.y-a.y);return i||(i=new S(this.nextPosition.x,this.nextPosition.y),this.nextPosition=new S(this.nextPosition.x+s.width()+10,this.nextPosition.y),i=new S(i.x+s.width()/2-c,i.y-s.height()/2-h)),n=new S(i.x,i.y-s.height()-10),this.footprintName2PositionMap[t]=n,i}getDeviceBBox(t){let e=new _e,r=t.buildBBox();return e.ext1(r),t.numShape&&e.ext1(t.numShape.buildBBox()),t.idShape&&e.ext1(t.idShape.buildBBox()),t.deviceShape&&e.ext1(t.deviceShape.buildBBox()),r=e.build(),r}async checkShapesEnableLayer(){let t=this.addComponentMap,e=this.usedReuseTemplateDecoders,r=new Map;sc(t,i=>{let n=i.footprintUUID;ug(r,n,[],!0).push(i)}),sc(e,(i,n)=>{let s=i.getItems();if(s.length==0)return;let a=n.toString();Ix(r,a,s)}),await rse(r,(i,n)=>{let s=parseInt(n),a=e[s];return a==null?void 0:a.getBasicLayerTable(i)})}};var RHe=Ru(pHe());var Tse=class{constructor(){this.fileData=[]}addTextFile(t,e,r){let n=new TextEncoder().encode(e);this.fileData.push({name:t,array:n,type:"file",size:n.length,dataType:"array",opts:r})}addFileArrayBuffer(t,e,r){let i=new Uint8Array(e);this.fileData.push({name:t,array:i,type:"file",size:i.length,dataType:"array",opts:r})}addFile(t,e,r){this.fileData.push({name:t,file:e,size:e.size,type:"file",dataType:"file",opts:r})}addFolder(t,e){this.fileData.push({name:t,type:"directory",size:0,dataType:"none",opts:e})}_createBuffer(){let t=0;for(let r=0;r<this.fileData.length;r++){let i=this.fileData[r].size;t+=512+512*Math.trunc(i/512),i%512&&(t+=512)}let e=10240*Math.trunc(t/10240);t%10240&&(e+=10240),this.buffer=new ArrayBuffer(e)}write(){return new Promise((t,e)=>{this._createBuffer();let r=0,i=0,n=()=>{if(i++,i===this.fileData.length){let s=new Uint8Array(this.buffer);t(s)}};for(let s=0;s<this.fileData.length;s++){let a=this.fileData[s];this._writeFileName(a.name,r),this._writeFileType(a.type,r),this._writeFileSize(a.size,r),this._fillHeader(r,a.opts,a.type),this._writeChecksum(r);let l=new Uint8Array(this.buffer,r+512,a.size);if(a.dataType==="array"){for(let c=0;c<a.size;c++)l[c]=a.array[c];n()}else if(a.dataType==="file"){let c=new FileReader;c.onload=(function(h){let u=h;return function(d){let p=d.target.result,m=new Uint8Array(p);for(let g=0;g<m.length;g++)u[g]=m[g];n()}})(l),c.readAsArrayBuffer(a.file)}else a.type==="directory"&&n();r+=512+512*Math.trunc(a.size/512),a.size%512&&(r+=512)}})}_writeString(t,e,r){let i=new Uint8Array(this.buffer,e,r),n=new TextEncoder;if(n.encodeInto){let s=n.encodeInto(t,i).written;for(let a=s;a<r;a++)i[a]=0}else{let s=n.encode(t);for(let a=0;a<r;a++)i[a]=a<s.length?s[a]:0}}_writeFileName(t,e){this._writeString(t,e,100)}_writeFileType(t,e){let r="0";t==="file"?r="0":t==="directory"&&(r="5");let i=new Uint8Array(this.buffer,e+156,1);i[0]=r.charCodeAt(0)}_writeFileSize(t,e){let r=t.toString(8);r=this._leftPad(r,11),this._writeString(r,e+124,12)}_leftPad(t,e){let r=t+"";for(;r.length<e;)r="0"+r;return r}_writeFileMode(t,e){this._writeString(this._leftPad(t,7),e+100,8)}_writeFileUid(t,e){this._writeString(this._leftPad(t,7),e+108,8)}_writeFileGid(t,e){this._writeString(this._leftPad(t,7),e+116,8)}_writeFileMtime(t,e){this._writeString(this._leftPad(t,11),e+136,12)}_writeFileUser(t,e){this._writeString(t,e+265,32)}_writeFileGroup(t,e){this._writeString(t,e+297,32)}_writeChecksum(t){this._writeString("        ",t+148,8);let e=new Uint8Array(this.buffer,t,512),r=0;for(let i=0;i<512;i++)r+=e[i];this._writeString(r.toString(8),t+148,8)}_getOpt(t,e,r){return t!=null&&t[e]!=null?t[e]:r}_fillHeader(t,e,r){let i=this._getOpt(e,"uid",1e3),n=this._getOpt(e,"gid",1e3),s=this._getOpt(e,"mode",r==="file"?"664":"775"),a=this._getOpt(e,"mtime",Date.now()),l=this._getOpt(e,"user","tarballjs"),c=this._getOpt(e,"group","tarballjs");this._writeFileMode(s,t),this._writeFileUid(i.toString(8),t),this._writeFileGid(n.toString(8),t),this._writeFileMtime(Math.trunc(a/1e3).toString(8),t),this._writeString("ustar",t+257,6),this._writeString("00",t+263,2),this._writeFileUser(l,t),this._writeFileGroup(c,t)}};var _6=class{};_6.svgPath=[{rect:"M12.5,3.5v9h-9v-9z M13.5,2.5h-11v11h11V2.5z"},{circle:"M8,3c2.757,0,5,2.243,5,5s-2.243,5-5,5s-5-2.243-5-5S5.243,3,8,3 M8,2C4.686,2,2,4.686,2,8s2.686,6,6,6s6-2.686,6-6S11.314,2,8,2L8,2z"},{triangle:"M12.268,3.804L8,11.196L3.732,3.804z M14,2.804L2,2.804L8,13.196z"},{sixPointStar:"M 8 3.729 L 9.067 6.151 L 11.698 5.865 L 10.136 8 L 11.699 10.136 L 9.068 9.85 L 8 12.271 L 6.932 9.85 L 4.301 10.136 L 5.864 8 L 4.301 5.864 L 6.932 6.15 Z M 8 1.25 L 6.313 5.077 L 2.154 4.625 L 4.625 8 L 2.154 11.375 L 6.312 10.923 L 8 14.75 L 9.688 10.923 L 13.846 11.375 L 11.375 8 L 13.846 4.625 L 9.688 5.077 Z"},{fourPointStar:`M11.964,4.036l-1.63,3.546L10.142,8l0.192,0.418l1.63,3.546l-3.546-1.63L8,10.142l-0.418,0.192l-3.546,1.63l1.63-3.546
			L5.858,8L5.666,7.582l-1.63-3.546l3.546,1.63L8,5.858l0.418-0.192L11.964,4.036 M14,2L8,4.757L2,2l2.757,6L2,14l6-2.757L14,14
			l-2.757-6L14,2L14,2z`},{plus:`M9.727,3v2.273v1h1H13v3.455h-2.273h-1v1V13H6.273v-2.273v-1h-1H3V6.273h2.273h1v-1V3H9.727 M10.727,2H5.273v3.273H2v5.455
			h3.273V14h5.455v-3.273H14V5.273h-3.273V2L10.727,2z`},{x:`M12.5,3.5v2.382l-2.447,1.224L8.264,8l1.789,0.894l2.447,1.224V12.5h-2.382l-1.223-2.447L8,8.264l-0.895,1.789L5.882,12.5
			H3.5v-2.382l2.447-1.224L7.736,8L5.947,7.106L3.5,5.882V3.5h2.382l1.223,2.447L8,7.736l0.895-1.789L10.118,3.5H12.5 M13.5,2.5h-4
			L8,5.5l-1.5-3h-4v4l3,1.5l-3,1.5v4h4l1.5-3l1.5,3h4v-4l-3-1.5l3-1.5V2.5L13.5,2.5z`},{diamond:"M8,2.914L13.086,8L8,13.086L2.914,8L8,2.914 M8,1.5L1.5,8L8,14.5L14.5,8L8,1.5L8,1.5z"},{doubleRect:"M12.5,3.5v9h-9v-9H12.5 M13.5,2.5h-11v11h11V2.5L13.5,2.5z M10.5,5.5v5h-5v-5H10.5 M11.5,4.5h-7v7h7V4.5L11.5,4.5z"}];function fHe(o){return o===32||o===9||o===13||o===10}var WF=class{constructor(){this._line=1;this._col=0}line(){return this._line}col(){return this._col}_feed(t){return t===10?(this._col=0,this._line++):this._col++,this.feed(t)}parse(t){let e=t.length;for(let r=0;r<e;r++){let i=t.charCodeAt(r);if(!this._feed(i))return this}return this.finish(),this}};var l9e=500,mHe=String.fromCharCode,zF=class{constructor(){this.buffer=new Array}size(){return this.buffer.length}isEOF(){return!1}write(t){return this.buffer.push(t),1}writen1(t){return this.writen2(t,0,t.length)}writen2(t,e,r){let i=this.buffer;for(let n=0,s=e;n<r;n++,s++)i.push(t[s]);return r}writeAsync(t,e){e(this.write(t))}writenAsync1(t,e){e(this.writen1(t))}writenAsync2(t,e,r,i){i(this.writen2(t,e,r))}writeStr(t){let e=t.length,r=new Array(e);for(let i=0;i<e;i++)r[i]=t.charCodeAt(i);return this.writen1(r)}clear(){this.buffer.length=0}toString(){let t=this.buffer,e=t.length;if(e<=l9e)return mHe.apply(null,t);{let r=new Array;for(let i=0;i<t.length;i+=l9e){let n=Math.min(e-i,l9e),s=mHe.apply(null,t.slice(i,i+n));r.push(s)}return r.join("")}}};var gHe=(n=>(n[n.UNKNOW=0]="UNKNOW",n[n.NUMBER_INTEGER=1]="NUMBER_INTEGER",n[n.NUMBER_DECIMAL=2]="NUMBER_DECIMAL",n[n.NUMBER_E=3]="NUMBER_E",n[n.NUMBER_E_SIGNED=4]="NUMBER_E_SIGNED",n))(gHe||{}),yHe=(w=>(w[w.UNKNOW=0]="UNKNOW",w[w.MOVE_X=1]="MOVE_X",w[w.MOVE_Y=2]="MOVE_Y",w[w.LINE_X=3]="LINE_X",w[w.LINE_Y=4]="LINE_Y",w[w.HORIZONTAL_X=5]="HORIZONTAL_X",w[w.VERTICAL_Y=6]="VERTICAL_Y",w[w.CUBIC_BEZIER_X1=7]="CUBIC_BEZIER_X1",w[w.CUBIC_BEZIER_Y1=8]="CUBIC_BEZIER_Y1",w[w.CUBIC_BEZIER_X2=9]="CUBIC_BEZIER_X2",w[w.CUBIC_BEZIER_Y2=10]="CUBIC_BEZIER_Y2",w[w.CUBIC_BEZIER_X=11]="CUBIC_BEZIER_X",w[w.CUBIC_BEZIER_Y=12]="CUBIC_BEZIER_Y",w[w.ARC_RX=13]="ARC_RX",w[w.ARC_RY=14]="ARC_RY",w[w.ARC_ROTATION=15]="ARC_ROTATION",w[w.ARC_LARGE=16]="ARC_LARGE",w[w.ARC_SWEEP=17]="ARC_SWEEP",w[w.ARC_X=18]="ARC_X",w[w.ARC_Y=19]="ARC_Y",w[w.SMOOTH_CUBIC_BEZIER_X2=20]="SMOOTH_CUBIC_BEZIER_X2",w[w.SMOOTH_CUBIC_BEZIER_Y2=21]="SMOOTH_CUBIC_BEZIER_Y2",w[w.SMOOTH_CUBIC_BEZIER_X=22]="SMOOTH_CUBIC_BEZIER_X",w[w.SMOOTH_CUBIC_BEZIER_Y=23]="SMOOTH_CUBIC_BEZIER_Y",w[w.QUADRATIC_BEZIER_X1=24]="QUADRATIC_BEZIER_X1",w[w.QUADRATIC_BEZIER_Y1=25]="QUADRATIC_BEZIER_Y1",w[w.QUADRATIC_BEZIER_X=26]="QUADRATIC_BEZIER_X",w[w.QUADRATIC_BEZIER_Y=27]="QUADRATIC_BEZIER_Y",w))(yHe||{});function qOt(o){return 97<=o&&o<=122||65<=o&&o<=90}function em(o){let t=parseFloat(o);if(isFinite(t))return t;throw new Error("expect number")}var Ise=class extends WF{constructor(e,r=!0,i=Di.DUMMY){super();this.buffer=new zF;this.group=new Array;this.subPartStart=S.ORIGIN;this.curPoint=S.ORIGIN;this.lexState=0;this.parseState=0;this.isAbsolute=!1;this.isLargeArc=!1;this.x1=Number.NaN;this.y1=Number.NaN;this.x2=Number.NaN;this.y2=Number.NaN;this.x=Number.NaN;this.y=Number.NaN;this.rx=Number.NaN;this.ry=Number.NaN;this.rotation=Number.NaN;this.sweep=ae.CCW;this.prevBezierCtrl2=null;this.logger=i,this.cb=e,this.yAxis=r?-1:1}on(e){return this.cb(e)}feed(e){switch(this.logger.include(0)&&this.logger.debug3("L: %c(%s)|%s",e,String.fromCharCode(e),gHe[this.lexState]),this.lexState){case 0:return fHe(e)?!0:48<=e&&e<=57||e===45||e===43?(this.pushBuffer(e),this.lexState=1,!0):e===46?(this.pushBuffer(e),this.lexState=2,!0):qOt(e)?this.feedS(String.fromCharCode(e)):(this.logger.warning3("unknow letter %c",e),!0);case 1:return 48<=e&&e<=57?(this.pushBuffer(e),!0):e===46?(this.pushBuffer(e),this.lexState=2,!0):e===101||e===69?(this.pushBuffer(e),this.lexState=3,!0):this.feedS(this.getCleanBuffer())?(this.lexState=0,this.feed(e)):!1;case 2:return 48<=e&&e<=57?(this.pushBuffer(e),!0):e===101||e===69?(this.pushBuffer(e),this.lexState=3,!0):this.feedS(this.getCleanBuffer())?(this.lexState=0,this.feed(e)):!1;case 3:return 48<=e&&e<=57?(this.pushBuffer(e),!0):e===45||e===43?(this.pushBuffer(e),this.lexState=4,!0):this.feedS(this.getCleanBuffer())?(this.lexState=0,this.feed(e)):!1;case 4:return 48<=e&&e<=57?(this.pushBuffer(e),!0):this.feedS(this.getCleanBuffer())?(this.lexState=0,this.feed(e)):!1;default:return!0}}finish(){this.feed(32),this.tryNotify()}feedS(e){switch(this.logger.include(0)&&this.logger.debug3("P: %s|%s|%s|%s",e,yHe[this.parseState],this.curPoint,this.subPartStart),this.parseState){case 0:switch(e){case"M":this.isAbsolute=!0,this.parseState=1;break;case"m":this.isAbsolute=!1,this.parseState=1;break;case"L":this.isAbsolute=!0,this.parseState=3;break;case"l":this.isAbsolute=!1,this.parseState=3;break;case"H":this.isAbsolute=!0,this.parseState=5;break;case"h":this.isAbsolute=!1,this.parseState=5;break;case"V":this.isAbsolute=!0,this.parseState=6;break;case"v":this.isAbsolute=!1,this.parseState=6;break;case"z":case"Z":{this.group.push(new M(this.curPoint,this.subPartStart));let n=this.tryNotify();return this.curPoint=this.subPartStart,n}case"C":this.isAbsolute=!0,this.parseState=7;break;case"c":this.isAbsolute=!1,this.parseState=7;break;case"S":this.isAbsolute=!0,this.parseState=20;break;case"s":this.isAbsolute=!1,this.parseState=20;break;case"A":this.isAbsolute=!0,this.parseState=13;break;case"a":this.isAbsolute=!1,this.parseState=13;break;case"Q":this.isAbsolute=!0,this.parseState=24;break;case"q":this.isAbsolute=!1,this.parseState=24;break;default:this.logger.warning3("unknow %s",e)}return!0;case 1:let r=this.tryNotify();return this.x=em(e),this.parseState=2,r;case 2:{this.y=this.yAxis*em(e);let n;return this.isAbsolute?n=new S(this.x,this.y):n=this.curPoint.add1(this.x,this.y),this.curPoint=n,this.subPartStart=n,this.parseState=3,!0}case 3:return this.x=parseFloat(e),isFinite(this.x)?(this.parseState=4,!0):(this.parseState=0,this.feedS(e));case 4:{this.y=this.yAxis*em(e);let n;return this.isAbsolute?n=new S(this.x,this.y):n=this.curPoint.add1(this.x,this.y),this.group.push(new M(this.curPoint,n)),this.curPoint=n,this.parseState=3,!0}case 5:if(this.x=parseFloat(e),isFinite(this.x)){let n;return this.isAbsolute?n=new S(this.x,this.curPoint.y):n=this.curPoint.add1(this.x,0),this.group.push(new M(this.curPoint,n)),this.curPoint=n,!0}else return this.parseState=0,this.feedS(e);case 6:if(this.y=parseFloat(e),isFinite(this.y)){this.y=this.yAxis*this.y;let n;return this.isAbsolute?n=new S(this.curPoint.x,this.y):n=this.curPoint.add1(0,this.y),this.group.push(new M(this.curPoint,n)),this.curPoint=n,!0}else return this.parseState=0,this.feedS(e);case 7:let i=parseFloat(e);return isFinite(i)?(this.x1=i,this.parseState=8,!0):(e!=="s"&&e!=="S"&&(this.prevBezierCtrl2=null),this.parseState=0,this.feedS(e));case 8:return this.y1=this.yAxis*em(e),this.parseState=9,!0;case 9:return this.x2=em(e),this.parseState=10,!0;case 10:return this.y2=this.yAxis*em(e),this.parseState=11,!0;case 11:return this.x=em(e),this.parseState=12,!0;case 12:{this.y=this.yAxis*em(e);let n,s,a;return this.isAbsolute?(n=new S(this.x1,this.y1),s=new S(this.x2,this.y2),a=new S(this.x,this.y)):(n=this.curPoint.add1(this.x1,this.y1),s=this.curPoint.add1(this.x2,this.y2),a=this.curPoint.add1(this.x,this.y)),this.prevBezierCtrl2=s,this.group.push(new Dr([this.curPoint,n,s,a])),this.curPoint=a,this.parseState=7,!0}case 13:return this.rx=parseFloat(e),isFinite(this.rx)?(this.parseState=14,!0):(this.parseState=0,this.feedS(e));case 14:return this.ry=em(e),this.parseState=15,!0;case 15:return this.rotation=em(e),this.parseState=16,!0;case 16:return this.isLargeArc=em(e)===1,this.parseState=17,!0;case 17:return this.sweep=em(e)===1?ae.CW:ae.CCW,this.parseState=18,!0;case 18:return this.x=em(e),this.parseState=19,!0;case 19:{this.y=this.yAxis*em(e);let n;return this.isAbsolute?n=new S(this.x,this.y):n=this.curPoint.add1(this.x,this.y),this.group.push(q.build1(this.curPoint,n,this.rx,this.ry,this.isLargeArc,this.sweep)),this.curPoint=n,this.parseState=13,!0}case 20:return this.x2=parseFloat(e),isFinite(this.x2)?(this.parseState=21,!0):(e!=="s"&&e!=="S"&&(this.prevBezierCtrl2=null),this.parseState=0,this.feedS(e));case 21:return this.y2=this.yAxis*em(e),this.parseState=22,!0;case 22:return this.x=em(e),this.parseState=23,!0;case 23:{this.y=this.yAxis*em(e);let n,s;this.isAbsolute?(n=new S(this.x2,this.y2),s=new S(this.x,this.y)):(n=this.curPoint.add1(this.x2,this.y2),s=this.curPoint.add1(this.x,this.y));let a;return this.prevBezierCtrl2?a=this.curPoint.add(this.curPoint.sub(this.prevBezierCtrl2)):a=this.curPoint,this.prevBezierCtrl2=n,this.group.push(new Dr([this.curPoint,a,n,s])),this.curPoint=s,this.parseState=20,!0}case 24:return this.x1=parseFloat(e),isFinite(this.x1)?(this.parseState=25,!0):(e!=="s"&&e!=="S"&&(this.prevBezierCtrl2=null),this.parseState=0,this.feedS(e));case 25:return this.y1=this.yAxis*em(e),this.parseState=26,!0;case 26:return this.x=em(e),this.parseState=27,!0;case 27:{this.y=this.yAxis*em(e);let n,s;return this.isAbsolute?(n=new S(this.x1,this.y1),s=new S(this.x,this.y)):(n=this.curPoint.add1(this.x1,this.y1),s=this.curPoint.add1(this.x,this.y)),this.prevBezierCtrl2=n,this.group.push(new Dr([this.curPoint,n,s])),this.curPoint=s,this.parseState=24,!0}default:return this.logger.warning3("unsupported parse state %s",this.parseState),!0}}pushBuffer(e){this.buffer.write(e)}getCleanBuffer(){let e=this.buffer.toString();return this.buffer.clear(),e}tryNotify(){if(this.group.length===0)return!0;{let e=ge.build1(Nee(this.group));return this.group.length=0,this.on(e)}}onException(e){throw e}};var Nc=ju.fmtNumber,wS=class{constructor(){this.state=0;this.prev=null;this.buffer=new Array}encPl(t){for(let e of t.primitives)this.encPt(e)}encPt(t){if(t instanceof M)this.encLine1(t);else if(t instanceof q)this.encArc(t);else if(t instanceof Dr){let e=t.points(.1),r=ge.build4(e);for(let i of r.primitives)this.encLine1(i)}else throw new Error("")}encBezier(t){let e=t.end(),r=t.controls.length;if(this.state===0){let i="";r==4?i+="M %s %s C ":r==3&&(i+="M %s %s Q ");for(let s=1;s<r;s++)i+="%s %s ";let n=new Array;for(let s of t.controls)n.push(Nc(s.x)),n.push(Nc(s.y));this.out(i,...n)}else if(t.start().equals(this.prev)){let i="";r==3?i+="S ":r==2&&(i+="T ");for(let s=1;s<r;s++)i+="%s %s ";let n=new Array;for(let s of t.controls)n.push(Nc(s.x)),n.push(Nc(s.y))}else{let i="";r==4?i+="M %s %s C ":r==3&&(i+="M %s %s Q ");for(let s=1;s<r;s++)i+="%s %s ";let n=new Array;for(let s of t.controls)n.push(Nc(s.x)),n.push(Nc(s.y));this.out(i,...n)}this.prev=e,this.state=3}encArc(t){let e=t.svgEnd;this.state===0?this.out("M %s %s A %s %s %s %d %d %s %s ",Nc(t.start().x),Nc(-t.start().y),Nc(t.rx),Nc(t.ry),0,t.isLarge()?1:0,t.sweep()===ae.CCW?0:1,Nc(e.x),Nc(-e.y)):t.start().equals(this.prev)?this.state!==2?this.out("A %s %s %s %d %d %s %s ",Nc(t.rx),Nc(t.ry),0,t.isLarge()?1:0,t.sweep()===ae.CCW?0:1,Nc(e.x),Nc(-e.y)):this.out("%s %s %s %d %d %s %s ",Nc(t.rx),Nc(t.ry),0,t.isLarge()?1:0,t.sweep()===ae.CCW?0:1,Nc(e.x),Nc(-e.y)):this.out("L %s %s A %s %s %s %d %d %s %s ",Nc(t.start().x),Nc(-t.start().y),t.rx,t.ry,0,t.isLarge()?1:0,t.sweep()===ae.CCW?0:1,Nc(e.x),Nc(-e.y)),this.prev=e,this.state=2}encLine1(t){this.encLine2(t.start(),t.end())}encLine2(t,e){this.state===0?this.out("M %s %s L %s %s ",Nc(t.x),Nc(-t.y),Nc(e.x),Nc(-e.y)):(this.state!==1&&this.out("L "),t.equals(this.prev)?this.out("%s %s ",Nc(e.x),Nc(-e.y)):this.out("%s %s %s %s ",Nc(t.x),Nc(-t.y),Nc(e.x),Nc(-e.y))),this.prev=e,this.state=1}close(t){this.state!==0&&(t&&this.out("Z "),this.state=0,this.prev=null)}toString(){return this.buffer.join("")}out(t,...e){e.length===0?this.buffer.push(t):this.buffer.push(ju.format(t,...e))}};function K3(o){let t=new Array;return new Ise(e=>(t.push(e),!0)).parse(o),t}function zb(o){let t=Array();return o.forEach(e=>{let r=new wS;r.encPl(e);let i=r.toString();t.push(i)}),t}function Cse(o){let t=new qt;return t.add("CANCEL",!0),t.add("TABLE_SETTING",!0),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t}var HI=class extends kl{constructor(){super();this.existingInDevice=!1;this.unionAttribute=null;this.interAttribute=null;this.attrIdMap={};this._netLengthMap=new Map,this.pad=null}set(e){return this.pad=e,this}getExtra(){return{existingInDevice:this.existingInDevice}}getHtmlData(e){var b;this.idList.push(e.globalIndex),this.count++;let r=R.getInstance().unit,i=R.getInstance().origin;this.attrlist==null&&(this.attrlist={});let n=this.attrlist,s=this.getPadShapeOption();if(e.getParent()!=null){let P=e.getParent();P instanceof ke&&((n["attr-footprint-id"]==null||n["attr-footprint-id"].value!=Ve)&&(n["attr-footprint-id"]={title:"Footprint ID",value:this.getCompareValue("attr-footprint-id",P.footprintId)}),this.existingInDevice=!0)}else(n["attr-footprint-id"]==null||n["attr-footprint-id"].value!=Ve)&&(n["attr-footprint-id"]={title:"Footprint ID",value:this.getCompareValue("attr-footprint-id","")});(n["attr-select-net"]==null||n["attr-select-net"].value!=Ve)&&(n["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",e.showNet),options:this.poolCache.allNetOptions||Ye.getNet()}),e.getParent()==null&&(n["attr-combination"]==null||n["attr-combination"].value!=Ve)&&(n["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",Ht.getGroupNameByGroupId(e.getGroupID())||""),options:this.poolCache.combinationOptions,hasParent:e.getParent()!=null}),(n["attr-layerid"]==null||n["attr-layerid"].value!=Ve)&&(n["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:Un.abstractPad()}),(n["attr-number"]==null||n["attr-number"].value!=Ve)&&(n["attr-number"]={title:"Number",value:this.getCompareValue("attr-number",e.num)}),(n["attr-id"]==null||n["attr-id"].value!=Ve)&&(n["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",e.getParent()?`${Tr}${e.getParent().number}${Tr}${e.number}`:`${Tr}${e.number}`),sourceId:e.globalIndex}),(n["attr-pad-shape-showtype"]==null||n["attr-pad-shape-showtype"].value!=Ve)&&(n["attr-pad-shape-showtype"]={title:"Type",value:this.getCompareValue("attr-pad-shape-showtype",e.type)}),(n["attr-pad-general-shape"]==null||n["attr-pad-general-shape"].value!=Ve)&&(n["attr-pad-general-shape"]={title:"Shape",value:this.getCompareValue("attr-pad-general-shape",this.getGeneralShape(e)),options:s}),(n["attr-pad-general-width"]==null||n["attr-pad-general-width"].value!=Ve)&&(n["attr-pad-general-width"]={title:"Width",value:this.getCompareValue("attr-pad-general-width",je(this.getGeneralWidth(e),void 0,r,this.unitConversion))}),(n["attr-pad-general-height"]==null||n["attr-pad-general-height"].value!=Ve)&&(n["attr-pad-general-height"]={title:"Height",value:this.getCompareValue("attr-pad-general-height",je(this.getGeneralHeight(e),void 0,r,this.unitConversion))}),(n["attr-pad-toplayer-shape"]==null||n["attr-pad-toplayer-shape"].value!=Ve)&&(n["attr-pad-toplayer-shape"]={title:"Shape",value:this.getCompareValue("attr-pad-toplayer-shape",e.topType),options:s}),e.topWidth!=null&&(n["attr-pad-toplayer-width"]==null||n["attr-pad-toplayer-width"].value!=Ve)&&(n["attr-pad-toplayer-width"]={title:"Width",value:this.getCompareValue("attr-pad-toplayer-width",je(e.topWidth,void 0,r,this.unitConversion))}),e.topHeight!=null&&(n["attr-pad-toplayer-height"]==null||n["attr-pad-toplayer-height"].value!=Ve)&&(n["attr-pad-toplayer-height"]={title:"Height",value:this.getCompareValue("attr-pad-toplayer-height",je(e.topHeight,void 0,r,this.unitConversion))}),(n["attr-pad-innerlayer-shape"]==null||n["attr-pad-innerlayer-shape"].value!=Ve)&&(n["attr-pad-innerlayer-shape"]={title:"Shape",value:this.getCompareValue("attr-pad-innerlayer-shape",e.innerType),options:s}),e.innerWidth!=null&&(n["attr-pad-innerlayer-width"]==null||n["attr-pad-innerlayer-width"].value!=Ve)&&(n["attr-pad-innerlayer-width"]={title:"Width",value:this.getCompareValue("attr-pad-innerlayer-width",je(e.innerWidth,void 0,r,this.unitConversion))}),e.innerHeight!=null&&(n["attr-pad-innerlayer-height"]==null||n["attr-pad-innerlayer-height"].value!=Ve)&&(n["attr-pad-innerlayer-height"]={title:"Height",value:this.getCompareValue("attr-pad-innerlayer-height",je(e.innerHeight,void 0,r,this.unitConversion))}),(n["attr-pad-bottomlayer-shape"]==null||n["attr-pad-bottomlayer-shape"].value!=Ve)&&(n["attr-pad-bottomlayer-shape"]={title:"Shape",value:this.getCompareValue("attr-pad-bottomlayer-shape",e.bottomType),options:s}),e.bottomWidth!=null&&(n["attr-pad-bottomlayer-width"]==null||n["attr-pad-bottomlayer-width"].value!=Ve)&&(n["attr-pad-bottomlayer-width"]={title:"Width",value:this.getCompareValue("attr-pad-bottomlayer-width",je(e.bottomWidth,void 0,r,this.unitConversion))}),e.bottomHeight!=null&&(n["attr-pad-bottomlayer-height"]==null||n["attr-pad-bottomlayer-height"].value!=Ve)&&(n["attr-pad-bottomlayer-height"]={title:"Height",value:this.getCompareValue("attr-pad-bottomlayer-height",je(e.bottomHeight,void 0,r,this.unitConversion))}),(n["attr-x"]==null||n["attr-x"].value!=Ve)&&(n["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",je(e.center.x-i.x))}),(n["attr-y"]==null||n["attr-y"].value!=Ve)&&(n["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",je(e.center.y-i.y,void 0,r,this.unitConversion))}),(n["attr-rotation"]==null||n["attr-rotation"].value!=Ve)&&(n["attr-rotation"]={title:"Rotation",value:this.getCompareValue("attr-rotation",Yl(ve(e.rotation/Math.PI*180,3)))});let a=e.locked,l=e.getParent();l!=null&&l instanceof ke&&l.locked&&(a=l.locked),(n["attr-locked"]==null||n["attr-locked"].value!=Ve)&&(n["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",a?"yes":"no"),options:this.poolCache.lockSettingOptions}),(n["attr-pad-hole-shape"]==null||n["attr-pad-hole-shape"].value!=Ve)&&(n["attr-pad-hole-shape"]={title:"Shape",value:this.getCompareValue("attr-pad-hole-shape",e.holeShape),options:this.getHoleShapeOption()}),e.holeRadius!=null&&(n["attr-pad-hole-diameter"]==null||n["attr-pad-hole-diameter"].value!=Ve)&&(n["attr-pad-hole-diameter"]={title:"Hole Diameter",value:this.getCompareValue("attr-pad-hole-diameter",je(e.holeRadius*2,void 0,r,this.unitConversion))}),e.holeLength!=null&&(n["attr-pad-hole-length"]==null||n["attr-pad-hole-length"].value!=Ve)&&(n["attr-pad-hole-length"]={title:"Hole Length",value:this.getCompareValue("attr-pad-hole-length",je(e.holeLength,void 0,r,this.unitConversion))}),e.holeRadius!=null&&(n["attr-pad-hole-width"]==null||n["attr-pad-hole-width"].value!=Ve)&&(n["attr-pad-hole-width"]={title:"Hole Width",value:this.getCompareValue("attr-pad-hole-width",je(e.holeRadius*2,void 0,r,this.unitConversion))}),e.holeRotation!=null&&!Number.isNaN(e.holeRotation)&&(n["attr-pad-hole-rotation"]==null||n["attr-pad-hole-rotation"].value!=Ve)&&(n["attr-pad-hole-rotation"]={title:"Hole Rotation",value:this.getCompareValue("attr-pad-hole-rotation",ve(e.holeRotation/Math.PI*180,3))}),(n["attr-pad-offset-x"]==null||n["attr-pad-offset-x"].value!=Ve)&&(n["attr-pad-offset-x"]={title:"Offset X",value:this.getCompareValue("attr-pad-offset-x",je(e.holeOffset.x,void 0,r,this.unitConversion))}),(n["attr-pad-offset-y"]==null||n["attr-pad-offset-y"].value!=Ve)&&(n["attr-pad-offset-y"]={title:"Offset Y",value:this.getCompareValue("attr-pad-offset-y",je(e.holeOffset.y,void 0,r,this.unitConversion))}),(n["attr-pad-plated"]==null||n["attr-pad-plated"].value!=Ve)&&(n["attr-pad-plated"]={title:"Plated",value:this.getCompareValue("attr-pad-plated",e.plated?"yes":"no")}),(n["attr-soldermask-showtype"]==null||n["attr-soldermask-showtype"].value!=Ve)&&(n["attr-soldermask-showtype"]={title:"Type",value:this.getCompareValue("attr-soldermask-showtype",e.expansionType)}),(n["attr-pastemask"]==null||n["attr-pastemask"].value!=Ve)&&(n["attr-pastemask"]={title:"Paste Mask Expansion",value:this.getCompareValue("attr-pastemask",je(e.pasteExpansion,void 0,r,this.unitConversion))});let c=je(e.topSolderExpansion,void 0,r,this.unitConversion),h=je(e.bottomSolderExpansion,void 0,r,this.unitConversion),u=c;e.layerId==2&&(u=h),(n["attr-soldermask"]==null||n["attr-soldermask"].value!=Ve)&&(n["attr-soldermask"]={title:"Solder Mask Expansion",value:this.getCompareValue("attr-soldermask",u)}),(n["attr-soldermask-toplayer"]==null||n["attr-soldermask-toplayer"].value!=Ve)&&(n["attr-soldermask-toplayer"]={title:"Top Solder",value:this.getCompareValue("attr-soldermask-toplayer",e.expansionType===1?"Follow Rule":c)}),(n["attr-soldermask-bottomlayer"]==null||n["attr-soldermask-bottomlayer"].value!=Ve)&&(n["attr-soldermask-bottomlayer"]={title:"Bottom Soler",value:this.getCompareValue("attr-soldermask-bottomlayer",e.expansionType===1?"Follow Rule":h)});let d=e.net,p=0;this._netLengthMap.has(d)?p=this._netLengthMap.get(d):(p=Ye.getNetLength(d),this._netLengthMap.set(d,p)),(n["attr-net-length"]==null||n["attr-net-length"].value!=Ve)&&(n["attr-net-length"]={title:"Net Length",value:this.getCompareValue("attr-net-length",je(p,void 0,r,this.unitConversion))}),e.topRatio!=null&&(n["attr-corner-radius-toplayer"]==null||n["attr-corner-radius-toplayer"].value!=Ve)&&(n["attr-corner-radius-toplayer"]={title:"Corner Radius Ratio",value:this.getCompareValue("attr-corner-radius-toplayer",Pa(e.topRatio*100,2))}),e.innerRatio!=null&&(n["attr-corner-radius-innerlayer"]==null||n["attr-corner-radius-innerlayer"].value!=Ve)&&(n["attr-corner-radius-innerlayer"]={title:"Corner Radius Ratio",value:this.getCompareValue("attr-corner-radius-innerlayer",Pa(e.innerRatio*100,2))}),e.bottomRatio!=null&&(n["attr-corner-radius-bottomlayer"]==null||n["attr-corner-radius-bottomlayer"].value!=Ve)&&(n["attr-corner-radius-bottomlayer"]={title:"Corner Radius Ratio",value:this.getCompareValue("attr-corner-radius-bottomlayer",Pa(e.bottomRatio*100,2))}),(n["attr-corner-radius-general"]==null||n["attr-corner-radius-general"].value!=Ve)&&(n["attr-corner-radius-general"]={title:"Corner Radius Ratio",value:this.getCompareValue("attr-corner-radius-general",Pa(this.getGeneralRatio(e)*100,2))});let m=e.padRule;if(m?((n["attr-pad-thermal-type"]==null||n["attr-pad-thermal-type"].value!=Ve)&&(n["attr-pad-thermal-type"]={title:"Thermal Type",value:this.getCompareValue("attr-pad-thermal-type",2)}),(n["attr-pad-connection"]==null||n["attr-pad-connection"].value!=Ve)&&(n["attr-pad-connection"]={title:"Pad Connection",value:this.getCompareValue("attr-pad-connection",m.connectMode)}),(n["attr-spoke-angles"]==null||n["attr-spoke-angles"].value!=Ve)&&(n["attr-spoke-angles"]={title:"Spoke Angles",value:this.getCompareValue("attr-spoke-angles",ve(m.lineAngle/Math.PI*180,3))}),(n["attr-spoke-width"]==null||n["attr-spoke-width"].value!=Ve)&&(n["attr-spoke-width"]={title:"Spoke Width",value:this.getCompareValue("attr-spoke-width",je(m.lineWidth,void 0,r,this.unitConversion))}),(n["attr-spoke-spacing"]==null||n["attr-spoke-spacing"].value!=Ve)&&(n["attr-spoke-spacing"]={title:"Spoke Spacing",value:this.getCompareValue("attr-spoke-spacing",je(m.lineClearance,void 0,r,this.unitConversion))})):((n["attr-pad-thermal-type"]==null||n["attr-pad-thermal-type"].value!=Ve)&&(n["attr-pad-thermal-type"]={title:"Thermal Type",value:this.getCompareValue("attr-pad-thermal-type",1)}),(n["attr-pad-connection"]==null||n["attr-pad-connection"].value!=Ve)&&(n["attr-pad-connection"]={title:"Pad Connection",value:this.getCompareValue("attr-pad-connection",3)})),l!=null&&l instanceof ke){let P=$o.getInstance().getPadLenByModel(e.model);(n["attr-pad-len"]==null||n["attr-pad-len"].value!=Ve)&&(n["attr-pad-len"]={title:"Pin length",value:this.getCompareValue("attr-pad-len",je(P,void 0,r,this.unitConversion))})}else if(R.getInstance().doctype==pi.FOOTPRINT){let P=e.padLen;(n["attr-pad-len"]==null||n["attr-pad-len"].value!=Ve)&&(n["attr-pad-len"]={title:"Pin length",value:this.getCompareValue("attr-pad-len",je(P,void 0,r,this.unitConversion))})}let g=e.attrsMap,y=new Array;for(let P in g){let T=g[P],I={key:P,value:T,update:!1};!I.update&&l!=null&&l instanceof ke&&((b=Hi.getItem(l.footprintUUID).getModelBy(e.model.modelType,e.globalIndex.replace(l.globalIndex,"")).attrsMap)==null?void 0:b[P])==T?I.update=!1:I.update=!0,y.push(I)}return this.unionAttribute=this.getUnionAttrs(this.unionAttribute,y,e.globalIndex),this.interAttribute=this.getIntersectionAttrs(this.interAttribute,y),(n["attr-array"]==null||n["attr-array"].value!=Ve)&&(n["attr-array"]={title:"Attribute",value:Array.from(this.interAttribute.values())}),this}clearCache(){var e,r;super.clearCache(),this._netLengthMap.clear(),this.existingInDevice=!1,(e=this.unionAttribute)==null||e.clear(),(r=this.interAttribute)==null||r.clear(),this.unionAttribute=null,this.interAttribute=null,this.attrIdMap={}}modifyBy(e,r){let i=new dt,n=R.getInstance().origin,s=e["attr-layerid"];s!=null&&(this.pad.layerId=parseInt(s));let a=Object.keys(e).sort((c,h)=>{let u=["attr-pad-general-shape","attr-pad-toplayer-shape","attr-pad-bottomlayer-shape","attr-pad-innerlayer-shape"];return u.includes(c)?-1:u.includes(h)?1:-1}),l=this.pad.getParent();for(let c of a)if(!(l instanceof ke&&["attr-layerid","attr-number","attr-net-length"].indexOf(c)>=0)){if(c=="attr-layerid"){if(this.pad.locked)continue;this.pad.layerId=parseInt(e[c])}else if(c=="attr-combination")this.modifyCombination(e[c],this.pad).forEach(u=>{r.addCommand(u)});else if(c=="attr-select-net"||c==="attr-select-net")this.pad.net=e[c],_A(this.pad,r),ut.setDefaultPad(this.pad);else if(c=="attr-number")this.pad.num=e[c];else if(c=="attr-pad-shape-showtype")this.pad.type=+e[c]===1?1:2;else if(c=="attr-corner-radius-general"){let h=Pa(e[c]/100,2);ao(this.pad.layerId)?this.pad.topRatio=h:2==this.pad.layerId?this.pad.bottomRatio=h:ar(this.pad.layerId)&&(this.pad.topRatio=h,this.pad.innerRatio=h,this.pad.bottomRatio=h)}else if(c=="attr-pad-general-shape")ao(this.pad.layerId)?this.pad.topType=e[c]:2==this.pad.layerId?this.pad.bottomType=e[c]:ar(this.pad.layerId)&&(this.pad.topType=e[c],this.pad.innerType=e[c],this.pad.bottomType=e[c]);else if(c=="attr-pad-general-width"){let h=parseFloat(e[c])/10;R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),ao(this.pad.layerId)?this.pad.topWidth=h:2==this.pad.layerId?this.pad.bottomWidth=h:ar(this.pad.layerId)&&(this.pad.topWidth=h,this.pad.innerWidth=h,this.pad.bottomWidth=h)}else if(c=="attr-pad-general-height"){let h=parseFloat(e[c])/10;R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),ao(this.pad.layerId)?this.pad.topHeight=h:2==this.pad.layerId?this.pad.bottomHeight=h:ar(this.pad.layerId)&&(this.pad.topHeight=h,this.pad.innerHeight=h,this.pad.bottomHeight=h)}else if(c=="attr-pad-toplayer-shape")this.pad.topType=e[c];else if(c=="attr-corner-radius-toplayer"){let h=Pa(e[c]/100,2);this.pad.topRatio=h}else if(c=="attr-pad-toplayer-width"){let h=parseFloat(e[c])/10;R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),this.pad.topWidth=h}else if(c=="attr-pad-toplayer-height"){let h=parseFloat(e[c])/10;R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),this.pad.topHeight=h}else if(c=="attr-pad-innerlayer-shape")this.pad.innerType=e[c];else if(c=="attr-corner-radius-innerlayer"){let h=Pa(e[c]/100,2);this.pad.innerRatio=h}else if(c=="attr-pad-innerlayer-width"){let h=parseFloat(e[c])/10;R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),this.pad.innerWidth=h}else if(c=="attr-pad-innerlayer-height"){let h=parseFloat(e[c])/10;R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),this.pad.innerHeight=h}else if(c=="attr-pad-bottomlayer-shape")this.pad.bottomType=e[c];else if(c=="attr-corner-radius-bottomlayer"){let h=Pa(e[c]/100,2);this.pad.bottomRatio=h}else if(c=="attr-pad-bottomlayer-width"){let h=parseFloat(e[c])/10;R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),this.pad.bottomWidth=h}else if(c=="attr-pad-bottomlayer-height"){let h=parseFloat(e[c])/10;R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),this.pad.bottomHeight=h}else if(c=="attr-x"||c=="attr-y"){if(this.pad.locked)continue;let h=parseFloat(e[c])/10;R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h));let u;c=="attr-x"?u=new S(h+n.x,this.pad.center.y):u=new S(this.pad.center.x,h+n.y);let d=this.pad.getParent();if(_d.moveWhole&&d instanceof ke){r.addCommand(Ce.dispatch(d,"modify"));let p=Ae.translate(u.x-this.pad.center.x,u.y-this.pad.center.y,0);this.pad.getParent().transform(p),A.publish("flushSelectingInfo","")}else this.pad.center=u}else if(c=="attr-rotation"){if(this.pad.locked)continue;let h=Yl(parseFloat(e[c]))/180*Math.PI;this.pad.rotation=h}else if(c=="attr-locked"){let h=e[c]=="yes",u=this.pad.getParent();u!=null&&u instanceof ke?(r.addCommand(Ce.dispatch(u,"modify")),u.locked=h,this.pad.locked=h):this.pad.locked=h}else if(c=="attr-pad-hole-shape"){if(this.pad.holeShape=e[c],e[c]==="SLOT"){let h=this.getGeneralWidth(this.pad),u=this.getGeneralHeight(this.pad);if(h>=u){let d=0*Math.PI;this.pad.holeRotation=d}else{let d=.5*Math.PI;this.pad.holeRotation=d}}}else if(c=="attr-pad-hole-diameter"){let h=parseFloat(e[c])/10;R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),this.pad.holeRadius=h/2}else if(c=="attr-pad-hole-length"){let h=parseFloat(e[c])/10;R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),this.pad.holeLength=h}else if(c=="attr-pad-hole-width"){let h=parseFloat(e[c])/20;R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),this.pad.holeRadius=h}else if(c=="attr-pad-hole-rotation"){let h=Yl(parseFloat(e[c]))/180*Math.PI;this.pad.holeRotation=h}else if(c=="attr-pad-offset-x"){let h=parseFloat(e[c])/10;R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),this.pad.holeOffset=new S(h,this.pad.holeOffset.y)}else if(c=="attr-pad-offset-y"){let h=parseFloat(e[c])/10;R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),this.pad.holeOffset=new S(this.pad.holeOffset.x,h)}else if(c=="attr-pad-plated"){let h=e[c]=="yes";this.pad.plated=h}else if(c=="attr-soldermask-showtype")this.pad.expansionType=parseInt(e[c]);else if(c=="attr-pastemask"){let h=parseFloat(e[c])/10;isNaN(h)||(R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),this.pad.pasteExpansion=h)}else if(c=="attr-soldermask"){let h=parseFloat(e[c])/10;isNaN(h)||(R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),this.pad.layerId==1?this.pad.topSolderExpansion=h:this.pad.layerId==2&&(this.pad.bottomSolderExpansion=h))}else if(c=="attr-soldermask-toplayer"){let h=parseFloat(e[c])/10;isNaN(h)||(R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),this.pad.topSolderExpansion=h)}else if(c=="attr-soldermask-bottomlayer"){let h=parseFloat(e[c])/10;isNaN(h)||(R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),this.pad.bottomSolderExpansion=h)}else if(c=="attr-pad-thermal-type"){let h=parseInt(e[c]);this.pad.padRuleType=h}else if(c=="attr-pad-connection")if(+e[c]===0){let h=re.getInstance().getRuleByNet(this.pad.net,10),u=this.pad.layerId!==12,d=this.pad.layerId;this.pad.padRule=qh.getPadRule(+e[c],u?h.getSingleLineClearance(d):h.getMultiLineClearance(),u?h.getSingleLineWidth(d):h.getMultiLineWidth(),u?h.getSingleLineAngle(d):h.getMultiLineAngle())}else this.pad.padRule=qh.getPadRuleByconnectMode(+e[c],this.pad.padRule);else if(c=="attr-spoke-width"){let h=parseFloat(e[c])/10;isNaN(h)||(R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),this.pad.padRule=qh.getPadRuleBylineWidth(h,this.pad.padRule))}else if(c=="attr-spoke-angles")this.pad.padRule=qh.getPadRuleBylineAngle(parseFloat(e[c])*Math.PI/180,this.pad.padRule);else if(c=="attr-spoke-spacing"){let h=parseFloat(e[c])/10;isNaN(h)||(R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),this.pad.padRule=qh.getPadRuleBylineClearance(h,this.pad.padRule))}else if(c=="attr-pad-len"){let h=parseFloat(e[c])/10;isNaN(h)||(R.getInstance().unit!="mil"&&(h=i.conversion(R.getInstance().unit,"mil",h)),R.getInstance().doctype==pi.FOOTPRINT?this.pad.padLen=h:$o.getInstance().setPadLenByModel(this.pad.model,h))}else if(c=="attr-array"){let h=e[c];for(let u of h)u.update==null||u.update?u.isAdd?this.updateAttr(u,this.pad):this.pad.attrsMap[u.key]!==void 0&&this.updateAttr(u,this.pad):this.restoreAttr(u,this.pad)}}this.pad!=null&&this.isShapeChange(e,!0)&&(this.pad.isTestPad?ut.setDefaultTestPad(this.pad):ut.setDefaultPad(this.pad))}updateAttr(e,r){e.value!==Ve&&r.modifyATTRMap(e.key,e.value||"")}restoreAttr(e,r){var n;let i=r.getParent();if(i&&i instanceof ke){let l=(n=Hi.getItem(i.footprintUUID).getModelBy(r.model.modelType,r.globalIndex.replace(i.globalIndex,"")).attrsMap)==null?void 0:n[e.key];l?r.modifyATTRMap(e.key,l.toString()):r.deleteATTRMap(e.key)}else r.deleteATTRMap(e.key)}isShapeChange(e,r){let i=["attr-layerid","attr-pad-shape-showtype","attr-corner-radius-general","attr-pad-general-shape","attr-pad-general-width","attr-pad-general-height","attr-pad-toplayer-shape","attr-corner-radius-toplayer","attr-pad-toplayer-width","attr-pad-toplayer-height","attr-pad-innerlayer-shape","attr-corner-radius-innerlayer","attr-pad-innerlayer-width","attr-pad-innerlayer-height","attr-pad-bottomlayer-shape","attr-corner-radius-bottomlayer","attr-pad-bottomlayer-width","attr-pad-bottomlayer-height","attr-rotation","attr-pad-hole-shape","attr-pad-hole-diameter","attr-pad-hole-length","attr-pad-hole-width","attr-pad-hole-rotation","attr-pad-offset-x","attr-pad-offset-y","attr-pad-plated","attr-soldermask-showtype","attr-pastemask","attr-soldermask","attr-soldermask-toplayer","attr-soldermask-bottomlayer","attr-pad-thermal-type","attr-pad-connection","attr-spoke-angles","attr-spoke-spacing","attr-spoke-width"];r||i.push("attr-x","attr-y");for(let n in e)if(i.indexOf(n)>=0)return!0;return!1}getPadShapeOption(){return[{value:"ELLIPSE",text:"Round"},{value:"RECT",text:"Rectangle"},{value:"OVAL",text:"Oval"}]}getHoleShapeOption(){return[{value:"SLOT",text:"Slot"},{value:"ROUND",text:"Round"}]}getGeneralShape(e){return e.layerId===2?e.bottomType:e.topType}getGeneralWidth(e){return e.layerId===2?e.bottomWidth:e.topWidth}getGeneralHeight(e){return e.layerId===2?e.bottomHeight:e.topHeight}getGeneralRatio(e){return e.layerId===2?e.bottomRatio:e.topRatio}getUnionAttrs(e,r,i){e==null&&(e=new Map);for(let n of r){let s=e.get(n.key);this.attrIdMap[n.key]==null&&(this.attrIdMap[n.key]=[]),this.attrIdMap[n.key].push(i),s!=null?(n.value!=s.value&&(s.value=Ve),this.hasTrue(n.update,s.update)&&(s.update=!0)):e.set(n.key,n)}return e}getIntersectionAttrs(e,r){if(e==null||!e.size){e=new Map;for(let i of r)e.set(i.key,i);return e}else{let i=new Set(e.keys());for(let n of r){let s=e.get(n.key);s!=null&&(n.value!=s.value&&(s.value=Ve),this.hasTrue(n.update,s.update)&&(s.update=!0)),i.delete(n.key)}for(let n of i)e.delete(n);return e}}hasTrue(e,r){return e||r}updateAttrlist4OnlyPads(){this.attrlist["attr-array"]={title:"Attribute",value:Array.from(this.unionAttribute.values())}}};var wA=class extends ro{constructor(e,r){super();this.commands=new Array;this.commands=[],e.items.forEach(i=>{this.commands.push(Ce.dispatch(i,r))}),e.combination instanceof qc&&this.commands.push(Ce.dispatch(e.combination,"add")),this.data=void 0,this.action=r}getItem(){return"ignore"}rebuild(){this.commands.forEach(e=>{e.rebuild()})}remove(){this.commands.forEach(e=>{e.remove()})}modify(){this.commands.forEach(e=>{e.modify()})}getStackTableIsCanEdit(){for(let e of this.commands){let r=Ce.getManager(e),i=r&&r.getItem(e.gId);if(i&&!Mt.checkIsInCanEdit(i))return!1}return!0}upload(e){this.commands.forEach(r=>{r.upload(e)})}updateData(){this.commands.forEach(e=>{e.updateData()})}};var bHe=(o,t,e=0)=>o.reduce((r,i,n)=>n<=t?r+i:r,e),KOt=o=>o.flat(1/0),YF=class{constructor(t,e=13){this.awaitShake=null;this.locked=!1;this.layerId=13;this.rowBlank=10;this.columnBlank=50;this.rowHeight=0;this.distance2leftOff=10;this.columnNum=0;this.rowNum=0;this.font={origin:2,rotation:ut.defaultText.rotation,fontSize:ut.defaultTable.fontSize,imageSize:ut.defaultTable.fontSize/.7,fontFamily:ut.defaultTextFamily[0],strokeWidth:ut.defaultText.strokeWidth};this.everyModels=[];this.textItems=[];this.images=[];this.texts=[];this.stackConfig=t,this.rowBlank=this.font.imageSize/2,this.columnBlank=this.font.imageSize,this.distance2leftOff=this.font.imageSize,this.rowHeight=this.rowBlank*2+this.font.imageSize,this.columnNum=t.length,this.rowNum=t[0].length+1,this.layerId=e,this.textReceivedLen=0}get origin(){return this._origin}set origin(t){this._origin=new S(t.x,t.y)}createStackTable(t){let e=this,r=this.stackConfig[0],i=this.stackConfig.slice(1);this.origin=t;let n=[r].concat(i);n.forEach((s,a)=>{let l=[],c=[];if(s.forEach(h=>{if(typeof h=="string"){let u=e.createTextModel(h,t);c.push([u]),l.push(u)}else{let u=[],d;h.image&&(d=e.createImageModel(h.image,t,a),e.images.push(d),u.push(h.image));let p=e.createTextModel(h.alpha||"",t);l.push(p),u.push(p),c.push(u)}}),e.everyModels.push(c),e.textItems.push(l),a===n.length-1)return!1}),this.render()}getStackTableModel(t){return this.createStackTable(t),{polygonModels:this.pls,textModels:this.texts,imageModels:this.images}}awaitTextComplete(){return setTimeout(()=>{jP.asyncText>0?(this.awaitShake!=null&&clearTimeout(this.awaitShake),this.awaitShake=this.awaitTextComplete()):this.render()},50)}render(){let t=this;t.allTextNum=t.textItems.length;let e=[];t.everyModels.forEach(a=>{let l=t.getColumnWidth(a);e.push(l)});let r=t.collectColumnOff(e);t.columnOffArr=r;let i=t.createPolygonModel(),n=KOt(t.updateTextPosition(t.textItems)),s=[];if(n.forEach(a=>{a instanceof Li&&s.push(a)}),n=s,Number.isFinite(t.distance2leftOff)){let a=Ae.translate(t.distance2leftOff,0,0);n.forEach(l=>{l instanceof Li&&l.transform(a)})}t.pls=i,t.texts=n}updateTextPosition(t){let e=s=>this.columnBlank*s+bHe(this.columnOffArr,s-1),r=s=>this.rowHeight*s,i=this,n=this.origin.add1(0,-this.rowHeight/2);return t.forEach((s,a)=>{s.forEach((l,c)=>{if(!l)return;let h=0;a>0&&(h=r(a));let u=e(c),d=n.add1(u,-h);l.position=d,i.textReceivedLen++})}),t}getColumnWidth(t){let e=[];return t.forEach(r=>{let i=0;r.forEach(n=>{let s=0;if(n instanceof Dl)s=n.width;else if(n instanceof Li){let a=n.buildBBox();if(a==null)throw new Error("text was removed!!!");s=Math.round(a.width()*100)/100}s===0?s+=this.columnBlank*4:s+=this.columnBlank*2,i<s&&(i=s)}),e.push(i)}),e}createImageModel(t,e,r){let i=Ae.translate(e.x+this.distance2leftOff,e.y-r*this.rowHeight-this.rowBlank,0);return t.transform(i),t}createPolygonModel(){let t=this.columnNum,e=this.rowNum,r=this.getTableWidth(),i=this.getTableHeight(),n=this._origin.x+r,s=[];for(;t>=0;){let u=this._origin.y-this.rowHeight*t,d=new S(this._origin.x,u),p=new S(n,u),m=new wc(nr(),d,p,{layerId:this.layerId,strokeWidth:ut.defaultTable.lineWidth,locked:!1}),g=new Ep(nr(),"Line",this.layerId,[[m]],ut.defaultTable.lineWidth,"",!1,null,null,null);s.push(g),t--}let a=this._origin.x,l=0,c=this.columnOffArr.slice();c.unshift(0);let h=this._origin.y;for(;l<e;){let u=c[l]+(l?this.columnBlank:0);a+=u;let d=new S(a,h),p=new S(a,h-i+ut.defaultTable.lineWidth),m=new wc(nr(),d,p,{layerId:this.layerId,strokeWidth:ut.defaultTable.lineWidth,locked:!1}),g=new Ep(nr(),"Line",this.layerId,[[m]],ut.defaultTable.lineWidth,"",!1,null,null,null);s.push(g),l++}return s}createTextModel(t,e){if(t=="")return null;let{fontSize:r,fontFamily:i,strokeWidth:n,origin:s}=this.font,a=lX(t),l=0,c=0,h=new _e;if(a.forEach(d=>{h.ext1(d.bbox())}),h.valid()){let d=h.build1();l=d.width(),c=d.height()}return new Ku(nr(),this.layerId,0,"",!1,t,!0,i,r,0,e,s,n,!1,0,!1,!1,lX(t),l,c,!1,ee.of7(tH),null)}getTableWidth(){return this.columnBlank*this.columnOffArr.length+bHe(this.columnOffArr,this.columnOffArr.length)}getTableHeight(){let t=this.stackConfig.length;return this.rowHeight*t}collectColumnOff(t){var e={};for(let n=0,s=t.length;n<s;n++)for(let a=0,l=t[0].length;a<l;a++)e[a]?e[a].push(t[n][a]):e[a]=[t[n][a]];let r=Object.values(e),i=new Array(r.length);for(let n=0,s=r.length;n<s;n++)i[n]=Math.max(...r[n]);return i}};var c9e,CVn=new Di(1);function jF(o){let t=[],e=[],r=[],i=R.getInstance().tabId;if(!o.length)return o;return o.forEach(s=>{let a=s.getGroupID(),l=s.getParent();if(a){let h=Ht.getItem(a);t.push({item:{attr:{id:s.globalIndex,pcbid:i},text:`${Tr}${s.number}`},parent:{attr:{id:a,pcbid:i},text:`${h.name} (${a})`}})}l instanceof ke&&e.push({item:{attr:{id:s.globalIndex,pcbid:i},text:`${Tr}${s.number}`},parent:{attr:{id:l.globalIndex,pcbid:i},text:`${l.name} (${l.globalIndex})`}});let c=s.model.modelType;a==null&&!(l instanceof ke||c=="Ratline")&&r.push(s)}),t.forEach(s=>n("group",s)),e.forEach(s=>n("component",s)),r;function n(s,a){c9e.size&&c9e.has(a.item.attr.id)||(A.publish("logPublishProxy",{type:"warn",msg:['<span class="i18n">Object</span> ',a.item,` <span class="i18n">already exists in ${s}</span> `,a.parent,' <span class="i18n">cannot be grouped</span>']},Q()),c9e.add(a.item.attr.id))}}var v6=class extends YF{constructor(e,r=13,i="\u5C42\u5806\u53E0"){super(e,r);this.pcbPolygons=[];this.pcbImages=[];this.pcbTexts=[];this.ready=!1;this.removed=!1;this.groupPrefix=i}addStackTable(e){this.createStackTable(e);for(let r of this.texts){io.getInstance().addModel(r);let i=ri.addtextByModel(r);this.pcbTexts.push(i)}for(let r of this.images){Hs.getInstance().addModel(r);let i=Bn.addImageByModel(r);this.pcbImages.push(i)}for(let r of this.pls){let i=r.childrens.map(s=>s.map(a=>Cu.addByModel(a)));vi.getInstance().addModel(r);let n=pt.addPolygonByModel(r,i);this.pcbPolygons.push(n)}this.items=[].concat(this.pcbPolygons,this.pcbTexts,this.pcbImages),this.ready=!0}isUpdate(){return this.font.fontSize!==ut.defaultTable.fontSize||this.font.strokeWidth!==ut.defaultText.strokeWidth}getNextTableName(){let e=`${this.groupPrefix}_1`,r=new RegExp(`^${this.groupPrefix}\\_(\\d+)$`),i=[],n=Math.max;return Ht.getAllItem().map(a=>a.name).forEach(a=>{let l=a.match(r);l&&l[1]&&i.push(l[1])}),i.length?this.groupPrefix+`_${n(...i)+1}`:e}joinCombination(){if(!this.ready)return;let e=this.items,r=jF(e);if(r.length){let i=this.getNextTableName(),n=Ht.combination(r,i);return this.combination=n,n}else A.publish("ui/toastMsg",{type:"warn",msg:"None of the selected objects meets the conditions for joining the group"},Q())}remove(){var e;(e=this.items)==null||e.forEach(r=>{r.remove()}),this.removed=!0}transform(e){this.items&&(this.items.forEach(r=>{r&&r.transform(e)}),this.origin=this.origin.multiply4(e))}};var ZOt=.4,XF=new dt().conversion("mm","px(100)",ZOt),h9e=6.5;function THe(o="pdf"){let t=[];return t.push(...JOt()),t.push(...QOt()),t.push(...Sse()),r(t),e(t),i(t);function e(a){for(let l=0;l<a.length;l++)a[l].unshift(s(l))}function r(a){a.sort((l,c)=>l[l.length-1]-c[c.length-1]),a.sort((l,c)=>l[l.length-4]-c[c.length-4]),a.sort((l,c)=>l[l.length-5]-c[c.length-5]),a.sort((l,c)=>l[l.length-6]-c[c.length-6]),a.sort((l,c)=>l[l.length-7]-c[c.length-7])}function i(a){switch(o){case"gerber":case"pdf":{let l=[];for(let c=0;c<a.length;c++)for(let h=0;h<a[c][1].length;h++){let u=a[c][1][h],d=u.center;if(u instanceof et){let p=u.holeOffset.multiply3(Qe.rotate(u.rotation));d=u.center.add(p)}l.push({position:d,image:a[c][0].image,text:a[c][0].alpha})}return l}}}function n(a){let l=Object.values(_6.svgPath[a])[0],c=K3(l),h=new _e;if(c.forEach(u=>{h.ext1(u.bbox())}),o==="pdf"||o==="gerber")return c}function s(a){if(a=a%269,a<9)return{image:n(a)};if(a<35){let l=String.fromCharCode(65+a-9);return{alpha:o==="pdf"?PHe(l):l}}else{let l=String.fromCharCode(65+(a-35)%26);return{image:n(Math.floor((a-35)/26)),alpha:o==="pdf"?PHe(l):l}}}}function JOt(){let o=bn.getInstance().getAllItem(),t=new dt,e={};for(let i=0;i<o.length;i++){let n=o[i].holeRadius,s=`${(n*2*10).toFixed(1)}mil(${t.mil2mm(n*2*10).toFixed(3)}mm)`,a="PTH",l="Round",c=o[i].startLayer,h=o[i].endLayer,u=c+"-"+h,d="Via",p="";e[s+a+l+u]?(e[s+a+l+u].count++,e[s+a+l+u].objs.push(o[i])):e[s+a+l+u]={count:1,holeRadius:n,size:s,viaOrPad:d,plated:a,shape:l,padShape:p,startLayer:c,endLayer:h,layerPair:u,objs:[o[i]]}}let r=[];return Hn(e,(i,n,s)=>{r.push([n.objs,n.count+"",n.size,n.plated,n.shape,n.viaOrPad,n.padShape,n.layerPair])}),r}function QOt(){let o=jn.getInstance().getAllItem(),t=new dt,e={};for(let i=0;i<o.length;i++)if(ar(o[i].layerId)){let n=o[i].holeRadius,s=o[i].holeLength,a=`${(n*2*10).toFixed(1)}x${(s*10).toFixed(1)}mil(${t.mil2mm(n*2*10).toFixed(3)}x${t.mil2mm(s*10).toFixed(3)}mm)`,l=o[i].plated?"PTH":"NPTH",c=eAt(o[i].holeShape),h=null,u="Top Layer-Bottom Layer",d="Pad";e[a+l+c+u]?(e[a+l+c+u].count++,e[a+l+c+u].objs.push(o[i])):e[a+l+c+u]={count:1,holeRadius:n,holeLength:s,size:a,viaOrPad:d,plated:l,shape:c,padShape:h,layerPair:u,objs:[o[i]]}}let r=[];return Hn(e,(i,n,s)=>{r.push([n.objs,n.count+"",n.size,n.plated,n.shape,n.viaOrPad,n.padShape,n.layerPair])}),r}function Sse(o=!1){let t=new dt,e=h9e/10,r=Fi.getInstance().getAllItem().filter(s=>{let a=s.radius*2;return s.type=="Slot Region"&&t.conversion1("mil","mm",a)<=e}),i={};for(let s=0;s<r.length;s++){let a=r[s].radius,l=`${(a*2*10).toFixed(1)}mil(${t.mil2mm(a*2*10).toFixed(3)}mm)`,c="NPTH",h="Round",u="Top Layer-Bottom Layer",d="Via",p="";i[l+c+h+u]?(i[l+c+h+u].count++,i[l+c+h+u].objs.push(r[s])):i[l+c+h+u]={count:1,radius:a,size:l,viaOrPad:d,plated:c,shape:h,padShape:p,layerPair:u,objs:[r[s]]}}let n=[];return Hn(i,(s,a,l)=>{let c=[a.objs,a.count+"",a.size,a.plated,a.shape,a.viaOrPad,a.padShape,a.layerPair];o&&c.unshift("mark"),n.push(c)}),n}function eAt(o){let[t,...e]=o;return t.toUpperCase()+e.join("").toLocaleLowerCase()}function PHe(o=""){return fd(o,8,.1).path}var Ese=class extends ni{constructor(){super();this.commands=new De("draw drill table");this.stackTable=null;this.groupName="Drill Table";this.nameReceived=!1;this.option="OPTIONLEFTUP",A.windowBridge.rpcCall("i18n",[this.groupName],Q()).then(r=>{this.groupName=r.message,this.nameReceived=!0})}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":this.cancel();break}}onMouseLeftUp(e){this.stackTable!==null&&this.placeStackTable(e)}onMouseMove(e){let r=new S(e.sceneX,e.sceneY);if(this.drawing)if(this.stackTable!==null&&!this.stackTable.isUpdate()){let i=r.sub(this.stackTable.origin),n=Ae.translate(i.x,i.y,0);this.stackTable.transform(n)}else this.stackTable!==null&&(this.stackTable.remove(),A.publish("delete",this.stackTable),this.stackTable=null),this.newTable(r)}placeStackTable(e){let r=new S(e.sceneX,e.sceneY),i=!0;for(let s of this.stackTable.items)if(i&&!Mt.checkIsInCanEdit(s)){let a="beyond drawing range";Mt.showMassageTip(a,a),i=!1}if(!i){for(let s of this.stackTable.items)s.partition="";return}if(!this.stackTable.joinCombination())return;let n=this.stackTable.items;A.publish("onlySelect",n);for(let s of n)A.publish("hasModifyPcbItem",s);this.commands.addCommand(new wA(this.stackTable,"add")),qe.executeCommand(this.commands),A.publish("flushService",""),this.commands=new De("draw stacktable"),this.drawing=!0,this.stackTable=null,this.newTable(r)}newTable(e){if(!this.nameReceived)return;this.start();let r=cX(),i=new v6(r,56,this.groupName);i.addStackTable(e),this.stackTable=i}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:Cse(e.adsorb).result};$t.getInstance().menuData(r,this),this.drawing=!1}cancel(){this.interrupt(),A.publish("tool","dropdrag")}interrupt(){this.stackTable!==null&&(this.stackTable.remove(),this.drawing=!1,this.stackTable=null,A.publish("updateRtree","")),this.end()}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"TABLE_SETTING":A.windowBridge.publish("openTableSetting",{cmd:"place_part(drill_table)"},Q());break}}};function cX(o="table"){let t=[];return t.push(...tAt()),t.push(...rAt()),t.push(...Sse()),r(t),e(t),i(t);function e(a){for(let l=0;l<a.length;l++)a[l].unshift(s(l))}function r(a){a.sort((l,c)=>l[l.length-1]-c[c.length-1]),a.sort((l,c)=>l[l.length-4]-c[c.length-4]),a.sort((l,c)=>l[l.length-5]-c[c.length-5]),a.sort((l,c)=>l[l.length-6]-c[c.length-6]),a.sort((l,c)=>l[l.length-7]-c[c.length-7])}function i(a){switch(o){case"table":{for(let l=0;l<a.length;l++)a[l].splice(1,1);return a.unshift(["Mark","Count","Size","Plated","Shape","Via/Pad","Pad Shape","Layer Pair"]),a}case"gerber":case"pdf":{let l=[];for(let c=0;c<a.length;c++)for(let h=0;h<a[c][1].length;h++){let u=a[c][1][h],d=u.center;if(u instanceof Le){let p=u.holeOffset.multiply3(Qe.rotate(u.rotation));d=u.center.add(p)}l.push({position:d,image:a[c][0].image,imageIndex:a[c][0].imageIndex,textIndex:a[c][0].textIndex,text:a[c][0].alpha})}return l}}}function n(a){let l=Object.values(_6.svgPath[a])[0],c=K3(l),h=new _e;if(c.forEach(m=>{h.ext1(m.bbox())}),o==="pdf"||o==="gerber")return c;let u=h.build1(),d=ut.defaultTable.fontSize/8;return new fx(nr(),56,new S(0,0),u.width()*d,u.height()*d,ut.defaultImage.rotation,!1,!1,c)}function s(a){if(a=a%269,a<9)return{image:n(a),imageIndex:a};if(a<35){let l=String.fromCharCode(65+a-9);return{alpha:o==="pdf"?lX(l):l,textIndex:a}}else{let l=(a-35)%26+9,c=String.fromCharCode(65+(a-35)%26),h=Math.floor((a-35)/26);return{image:n(h),imageIndex:h,alpha:o==="pdf"?lX(c):c,textIndex:l}}}}function tAt(){let o=Wr.getAllItem(),t=new dt,e={};for(let i=0;i<o.length;i++){let n=o[i].holeRadius,s=`${(n*2*10).toFixed(1)}mil(${t.mil2mm(n*2*10).toFixed(3)}mm)`,a="PTH",l="Round",c=Pe.getLayerName(o[i].startLayer),h=Pe.getLayerName(o[i].endLayer),u=c+"-"+h,d="Via",p="";e[s+a+l+u]?(e[s+a+l+u].count++,e[s+a+l+u].objs.push(o[i])):e[s+a+l+u]={count:1,holeRadius:n,size:s,viaOrPad:d,plated:a,shape:l,padShape:p,startLayer:c,endLayer:h,layerPair:u,objs:[o[i]]}}let r=[];return Hn(e,(i,n,s)=>{r.push([n.objs,n.count+"",n.size,n.plated,n.shape,n.viaOrPad,n.padShape,n.layerPair])}),r}function rAt(){let o=Qt.getAllItem(),t=new dt,e={},i=new HI().getPadShapeOption(),n={};i.forEach(a=>{n[a.value]=a.text});for(let a=0;a<o.length;a++){let l=o[a];if(ar(l.layerId)){let c=l.holeRadius,h=l.holeLength,u=`${(c*2*10).toFixed(1)}x${(h*10).toFixed(1)}mil(${t.mil2mm(c*2*10).toFixed(3)}x${t.mil2mm(h*10).toFixed(3)}mm)`,d=l.plated?"PTH":"NPTH",p=CHe(l.holeShape),m=l instanceof _i&&l.topType==l.bottomType?n[l.topType]:"Polygon",g="Top Layer-Bottom Layer",y="Pad";e[u+d+p+g]?(e[u+d+p+g].count++,e[u+d+p+g].objs.push(o[a]),e[u+d+p+g].padShape!==m&&(e[u+d+p+g].padShape="(Mixed)")):e[u+d+p+g]={count:1,holeRadius:c,holeLength:h,size:u,viaOrPad:y,plated:d,shape:p,padShape:m,layerPair:g,objs:[o[a]]}}}let s=[];return Hn(e,(a,l,c)=>{s.push([l.objs,l.count+"",l.size,l.plated,l.shape,l.viaOrPad,l.padShape,l.layerPair])}),s}function IHe(){let o=iAt().concat(nAt()).concat(Sse(!0));return r(o),e(o),n(o);function e(s){for(let a=0;a<s.length;a++)s[a][0]=a}function r(s){s.sort((a,l)=>a[a.length-1]-l[l.length-1]),s.sort((a,l)=>a[a.length-4]-l[l.length-4]),s.sort((a,l)=>a[a.length-5]-l[l.length-5]),s.sort((a,l)=>a[a.length-6]-l[l.length-6]),s.sort((a,l)=>a[a.length-7]-l[l.length-7])}function i(s,a){return s.x-a.x||s.y-a.y}function n(s){let a=[];for(let l of s){let[c,h]=l,u=h.map(d=>{let p=d.center;if(d instanceof Le){let m=d.holeOffset.multiply3(Qe.rotate(d.rotation));p=d.center.add(m)}return p});u.sort(i),a.push({positions:u,markIndex:c})}return a}}function iAt(){let o=Wr.getAllItem(),t=new dt,e={};for(let i=0;i<o.length;i++){let n=o[i].holeRadius,s=`${(n*2*10).toFixed(1)}mil(${t.mil2mm(n*2*10).toFixed(3)}mm)`,a="PTH",l="Round",c=Pe.getLayerName(o[i].startLayer),h=Pe.getLayerName(o[i].endLayer),u=c+"-"+h,d="Via",p="";e[s+a+l+u]?(e[s+a+l+u].count++,e[s+a+l+u].objs.push(o[i])):e[s+a+l+u]={count:1,holeRadius:n,size:s,viaOrPad:d,plated:a,shape:l,padShape:p,startLayer:c,endLayer:h,layerPair:u,objs:[o[i]]}}let r=[];return Hn(e,(i,n,s)=>{r.push(["mark",n.objs,n.count+"",n.size,n.plated,n.shape,n.viaOrPad,n.padShape,n.layerPair])}),r}function nAt(){let o=Qt.getAllItem(),t=new dt,e={},i=new HI().getPadShapeOption(),n={};i.forEach(a=>{n[a.value]=a.text});let s=[];for(let a of o){let{layerId:l,holeRadius:c,holeLength:h,plated:u,holeShape:d}=a,p,m;if(a instanceof _i?(p=a.topType,m=a.bottomType):(p="Polygon",m="Polygon"),!ar(l)||!c&&!h)continue;let g=`${(c*2*10).toFixed(1)}x${(h*10).toFixed(1)}mil(${t.mil2mm(c*2*10).toFixed(3)}x${t.mil2mm(h*10).toFixed(3)}mm)`,y=u?"PTH":"NPTH",b=CHe(d),P=p==m?n[p]:"Polygon",T="Top Layer-Bottom Layer",I="Pad",C=g+y+b+T;e[C]?(e[C][2]++,e[C][1].push(a),e[C][7]!==P&&(e[C][7]="(Mixed)")):(e[C]=["mark",[a],1,g,y,b,I,P,T],s.push(e[C]))}return s}function CHe(o){let[t,...e]=o;return t.toUpperCase()+e.join("").toLocaleLowerCase()}function lX(o=""){return fd(o,ut.defaultTable.fontSize,.1).path}var SHe=`XSIZE  0.302000
YSIZE  0.302000
OFFSET 0.000000


CHAR !
LINE 0.000000 0.000000 0.000000 0.200000 P R 0.012000
LINE 0.000000 -0.100000 0.000000 -0.100000 P R 0.012000
ECHAR

CHAR "
LINE -0.050000 0.100000 -0.050000 0.200000 P R 0.012000
LINE 0.050000 0.100000 0.050000 0.200000 P R 0.012000
ECHAR

CHAR #
LINE -0.050000 -0.100000 -0.050000 0.200000 P R 0.012000
LINE 0.050000 -0.100000 0.050000 0.200000 P R 0.012000
LINE -0.100000 0.000000 0.100000 0.000000 P R 0.012000
LINE -0.100000 0.100000 0.100000 0.100000 P R 0.012000
ECHAR

CHAR $
LINE 0.000000 -0.100000 0.000000 0.200000 P R 0.012000
LINE -0.100000 -0.050000 0.050000 -0.050000 P R 0.012000
LINE 0.050000 -0.050000 0.100000 0.000000 P R 0.012000
LINE 0.100000 0.000000 0.050000 0.050000 P R 0.012000
LINE 0.050000 0.050000 -0.050000 0.050000 P R 0.012000
LINE -0.050000 0.050000 -0.100000 0.100000 P R 0.012000
LINE -0.100000 0.100000 -0.050000 0.150000 P R 0.012000
LINE -0.050000 0.150000 0.100000 0.150000 P R 0.012000
ECHAR

CHAR %
LINE -0.100000 -0.100000 0.100000 0.200000 P R 0.012000
LINE -0.075000 0.175000 -0.075000 0.175000 P R 0.012000
LINE 0.075000 -0.075000 0.075000 -0.075000 P R 0.012000
ECHAR

CHAR &
LINE 0.100000 -0.100000 -0.100000 0.100000 P R 0.012000
LINE -0.100000 0.100000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.000000 0.150000 P R 0.012000
LINE 0.000000 0.150000 0.000000 0.100000 P R 0.012000
LINE 0.000000 0.100000 -0.100000 0.000000 P R 0.012000
LINE -0.100000 0.000000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.000000 -0.100000 P R 0.012000
LINE 0.000000 -0.100000 0.100000 0.000000 P R 0.012000
ECHAR

CHAR '
LINE 0.000000 0.050000 0.050000 0.150000 P R 0.012000
LINE 0.025000 0.175000 0.025000 0.175000 P R 0.012000
ECHAR

CHAR (
LINE 0.050000 -0.100000 -0.050000 0.000000 P R 0.012000
LINE -0.050000 0.000000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 0.050000 0.200000 P R 0.012000
ECHAR

CHAR )
LINE -0.050000 -0.100000 0.050000 0.000000 P R 0.012000
LINE 0.050000 0.000000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 -0.050000 0.200000 P R 0.012000
ECHAR

CHAR *
LINE -0.100000 -0.050000 0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 0.100000 -0.050000 P R 0.012000
LINE 0.000000 -0.100000 0.000000 0.200000 P R 0.012000
ECHAR

CHAR +
LINE -0.100000 0.050000 0.100000 0.050000 P R 0.012000
LINE 0.000000 -0.050000 0.000000 0.150000 P R 0.012000
ECHAR

CHAR ,
LINE 0.000000 -0.100000 0.050000 0.000000 P R 0.012000
LINE 0.025000 0.025000 0.025000 0.025000 P R 0.012000
ECHAR

CHAR -
LINE -0.100000 0.050000 0.100000 0.050000 P R 0.012000
ECHAR

CHAR .
LINE 0.025000 -0.075000 0.025000 -0.075000 P R 0.012000
ECHAR

CHAR /
LINE -0.100000 -0.050000 0.100000 0.150000 P R 0.012000
ECHAR

CHAR 0
LINE -0.100000 -0.050000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 0.100000 0.150000 P R 0.012000
ECHAR

CHAR 1
LINE -0.050000 0.150000 0.000000 0.200000 P R 0.012000
LINE 0.000000 0.200000 0.000000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.050000 -0.100000 P R 0.012000
ECHAR

CHAR 2
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.100000 0.100000 P R 0.012000
LINE 0.100000 0.100000 0.050000 0.050000 P R 0.012000
LINE 0.050000 0.050000 0.000000 0.050000 P R 0.012000
LINE 0.000000 0.050000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 -0.100000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR 3
LINE -0.100000 0.200000 0.100000 0.200000 P R 0.012000
LINE 0.100000 0.200000 0.100000 0.100000 P R 0.012000
LINE 0.100000 0.100000 0.050000 0.050000 P R 0.012000
LINE 0.050000 0.050000 0.000000 0.050000 P R 0.012000
LINE 0.050000 0.050000 0.100000 0.000000 P R 0.012000
LINE 0.100000 0.000000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
ECHAR

CHAR 4
LINE 0.050000 -0.100000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 -0.100000 0.000000 P R 0.012000
LINE -0.100000 0.000000 0.100000 0.000000 P R 0.012000
ECHAR

CHAR 5
LINE 0.100000 0.200000 -0.100000 0.200000 P R 0.012000
LINE -0.100000 0.200000 -0.100000 0.100000 P R 0.012000
LINE -0.100000 0.100000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
ECHAR

CHAR 6
LINE 0.100000 0.200000 0.000000 0.200000 P R 0.012000
LINE 0.000000 0.200000 -0.100000 0.100000 P R 0.012000
LINE -0.100000 0.100000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.100000 0.000000 P R 0.012000
LINE 0.100000 0.000000 0.050000 0.050000 P R 0.012000
LINE 0.050000 0.050000 -0.100000 0.050000 P R 0.012000
ECHAR

CHAR 7
LINE -0.100000 0.200000 0.100000 0.200000 P R 0.012000
LINE 0.100000 0.200000 -0.050000 -0.100000 P R 0.012000
ECHAR

CHAR 8
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE -0.050000 0.050000 0.050000 0.050000 P R 0.012000
LINE -0.050000 -0.100000 0.050000 -0.100000 P R 0.012000
LINE -0.100000 0.150000 -0.100000 0.100000 P R 0.012000
LINE 0.100000 0.150000 0.100000 0.100000 P R 0.012000
LINE -0.100000 0.000000 -0.100000 -0.050000 P R 0.012000
LINE 0.100000 0.000000 0.100000 -0.050000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE -0.050000 0.200000 -0.100000 0.150000 P R 0.012000
LINE 0.050000 0.050000 0.100000 0.100000 P R 0.012000
LINE -0.050000 0.050000 -0.100000 0.100000 P R 0.012000
LINE 0.050000 0.050000 0.100000 0.000000 P R 0.012000
LINE -0.050000 0.050000 -0.100000 0.000000 P R 0.012000
LINE 0.050000 -0.100000 0.100000 -0.050000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
ECHAR

CHAR 9
LINE -0.100000 -0.100000 0.000000 -0.100000 P R 0.012000
LINE 0.000000 -0.100000 0.100000 0.000000 P R 0.012000
LINE 0.100000 0.000000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.100000 0.100000 P R 0.012000
LINE -0.100000 0.100000 -0.050000 0.050000 P R 0.012000
LINE -0.050000 0.050000 0.100000 0.050000 P R 0.012000
ECHAR

CHAR :
LINE 0.000000 0.012000 0.000000 0.012000 P R 0.012000
LINE 0.000000 -0.025000 0.000000 -0.025000 P R 0.012000
ECHAR

CHAR ;
LINE 0.000000 0.025000 -0.050000 -0.100000 P R 0.012000
LINE 0.000000 0.025000 0.000000 0.025000 P R 0.012000
LINE 0.000000 0.175000 0.000000 0.175000 P R 0.012000
ECHAR

CHAR <
LINE 0.100000 0.200000 -0.050000 0.050000 P R 0.012000
LINE -0.050000 0.050000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR =
LINE -0.100000 0.100000 0.100000 0.100000 P R 0.012000
LINE -0.100000 0.000000 0.100000 0.000000 P R 0.012000
ECHAR

CHAR >
LINE -0.100000 0.200000 0.050000 0.050000 P R 0.012000
LINE 0.050000 0.050000 -0.100000 -0.100000 P R 0.012000
ECHAR

CHAR ?
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.000000 0.050000 P R 0.012000
LINE 0.000000 0.050000 0.000000 0.000000 P R 0.012000
LINE 0.000000 -0.100000 0.000000 -0.100000 P R 0.012000
ECHAR

CHAR @
LINE 0.050000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.100000 0.000000 P R 0.012000
LINE 0.100000 0.000000 0.000000 0.000000 P R 0.012000
LINE 0.000000 0.000000 0.000000 0.100000 P R 0.012000
LINE 0.000000 0.100000 0.100000 0.100000 P R 0.012000
ECHAR

CHAR A
LINE -0.100000 -0.100000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.100000 -0.100000 P R 0.012000
LINE -0.100000 0.050000 0.100000 0.050000 P R 0.012000
ECHAR

CHAR B
LINE -0.100000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.100000 0.100000 P R 0.012000
LINE 0.100000 0.100000 0.050000 0.050000 P R 0.012000
LINE 0.050000 0.050000 0.100000 0.000000 P R 0.012000
LINE 0.100000 0.000000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 -0.100000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.050000 0.050000 0.050000 P R 0.012000
ECHAR

CHAR C
LINE 0.100000 -0.050000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
ECHAR

CHAR D
LINE -0.100000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 -0.100000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.050000 0.200000 P R 0.012000
ECHAR

CHAR E
LINE -0.100000 0.200000 0.100000 0.200000 P R 0.012000
LINE -0.100000 -0.100000 0.100000 -0.100000 P R 0.012000
LINE -0.100000 0.050000 0.050000 0.050000 P R 0.012000
LINE -0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
ECHAR

CHAR F
LINE -0.100000 0.200000 0.100000 0.200000 P R 0.012000
LINE -0.100000 0.050000 0.050000 0.050000 P R 0.012000
LINE -0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
ECHAR

CHAR G
LINE -0.050000 0.200000 0.100000 0.200000 P R 0.012000
LINE -0.050000 0.200000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.100000 -0.100000 P R 0.012000
LINE 0.100000 -0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.050000 0.050000 P R 0.012000
ECHAR

CHAR H
LINE -0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
LINE 0.100000 0.200000 0.100000 -0.100000 P R 0.012000
LINE -0.100000 0.050000 0.100000 0.050000 P R 0.012000
ECHAR

CHAR I
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE -0.050000 -0.100000 0.050000 -0.100000 P R 0.012000
LINE 0.000000 0.200000 0.000000 -0.100000 P R 0.012000
ECHAR

CHAR J
LINE 0.100000 0.200000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
ECHAR

CHAR K
LINE -0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
LINE 0.100000 0.200000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR L
LINE -0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 -0.100000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR M
LINE -0.100000 -0.100000 -0.100000 0.200000 P R 0.012000
LINE -0.100000 0.200000 0.000000 0.050000 P R 0.012000
LINE 0.000000 0.050000 0.100000 0.200000 P R 0.012000
LINE 0.100000 0.200000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR N
LINE -0.100000 -0.100000 -0.100000 0.200000 P R 0.012000
LINE -0.100000 0.200000 0.100000 -0.100000 P R 0.012000
LINE 0.100000 -0.100000 0.100000 0.200000 P R 0.012000
ECHAR

CHAR O
LINE -0.100000 -0.050000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
ECHAR

CHAR P
LINE -0.100000 -0.100000 -0.100000 0.200000 P R 0.012000
LINE -0.100000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.100000 0.100000 P R 0.012000
LINE 0.100000 0.100000 0.050000 0.050000 P R 0.012000
LINE 0.050000 0.050000 -0.100000 0.050000 P R 0.012000
ECHAR

CHAR Q
LINE -0.100000 -0.050000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.100000 0.000000 P R 0.012000
LINE 0.100000 0.000000 0.000000 -0.100000 P R 0.012000
LINE 0.000000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
LINE 0.000000 0.000000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR R
LINE -0.100000 -0.100000 -0.100000 0.200000 P R 0.012000
LINE -0.100000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE 0.100000 0.150000 0.100000 0.100000 P R 0.012000
LINE 0.100000 0.100000 0.050000 0.050000 P R 0.012000
LINE 0.050000 0.050000 -0.100000 0.050000 P R 0.012000
LINE -0.050000 0.050000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR S
LINE -0.100000 -0.050000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.100000 0.000000 P R 0.012000
LINE 0.100000 0.000000 0.050000 0.050000 P R 0.012000
LINE 0.050000 0.050000 -0.050000 0.050000 P R 0.012000
LINE -0.050000 0.050000 -0.100000 0.100000 P R 0.012000
LINE -0.100000 0.100000 -0.100000 0.150000 P R 0.012000
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
ECHAR

CHAR T
LINE -0.100000 0.200000 0.100000 0.200000 P R 0.012000
LINE 0.000000 0.200000 0.000000 -0.100000 P R 0.012000
ECHAR

CHAR U
LINE -0.100000 0.200000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.100000 0.200000 P R 0.012000
ECHAR

CHAR V
LINE -0.100000 0.200000 0.000000 -0.100000 P R 0.012000
LINE 0.000000 -0.100000 0.100000 0.200000 P R 0.012000
ECHAR

CHAR W
LINE -0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 -0.100000 0.000000 0.050000 P R 0.012000
LINE 0.000000 0.050000 0.100000 -0.100000 P R 0.012000
LINE 0.100000 -0.100000 0.100000 0.200000 P R 0.012000
ECHAR

CHAR X
LINE -0.100000 0.200000 0.100000 -0.100000 P R 0.012000
LINE -0.100000 -0.100000 0.100000 0.200000 P R 0.012000
ECHAR

CHAR Y
LINE -0.100000 0.200000 0.000000 0.050000 P R 0.012000
LINE 0.000000 0.050000 0.100000 0.200000 P R 0.012000
LINE 0.000000 0.050000 0.000000 -0.100000 P R 0.012000
ECHAR

CHAR Z
LINE -0.100000 0.200000 0.100000 0.200000 P R 0.012000
LINE 0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 -0.100000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR [
LINE 0.050000 0.200000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.050000 -0.100000 P R 0.012000
ECHAR

CHAR \\
LINE -0.100000 0.200000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR ]
LINE -0.050000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 -0.050000 -0.100000 P R 0.012000
ECHAR

CHAR ^
LINE -0.100000 0.100000 0.000000 0.200000 P R 0.012000
LINE 0.000000 0.200000 0.100000 0.100000 P R 0.012000
ECHAR

CHAR _
LINE -0.100000 -0.100000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR \`
LINE -0.050000 0.200000 0.000000 0.050000 P R 0.012000
ECHAR

CHAR a
LINE -0.050000 0.100000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.100000 -0.100000 P R 0.012000
LINE 0.100000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.050000 0.000000 P R 0.012000
LINE -0.050000 0.000000 0.100000 0.000000 P R 0.012000
ECHAR

CHAR b
LINE -0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 -0.100000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.000000 0.100000 P R 0.012000
LINE 0.000000 0.100000 -0.100000 0.050000 P R 0.012000
ECHAR

CHAR c
LINE 0.100000 0.100000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR d
LINE 0.100000 0.200000 0.100000 -0.100000 P R 0.012000
LINE 0.100000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 0.000000 0.100000 P R 0.012000
LINE 0.000000 0.100000 0.100000 0.050000 P R 0.012000
ECHAR

CHAR e
LINE 0.050000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.050000 0.000000 P R 0.012000
LINE 0.050000 0.000000 -0.100000 0.000000 P R 0.012000
ECHAR

CHAR f
LINE -0.050000 -0.100000 -0.050000 0.150000 P R 0.012000
LINE -0.050000 0.150000 0.000000 0.200000 P R 0.012000
LINE 0.000000 0.200000 0.050000 0.200000 P R 0.012000
LINE 0.050000 0.200000 0.100000 0.150000 P R 0.012000
LINE -0.100000 0.050000 0.000000 0.050000 P R 0.012000
ECHAR

CHAR g
LINE -0.050000 -0.150000 0.050000 -0.150000 P R 0.012000
LINE 0.050000 -0.150000 0.100000 -0.100000 P R 0.012000
LINE 0.100000 -0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.100000 0.000000 P R 0.012000
LINE -0.100000 0.000000 -0.050000 -0.050000 P R 0.012000
LINE -0.050000 -0.050000 0.100000 -0.050000 P R 0.012000
ECHAR

CHAR h
LINE -0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 0.050000 0.000000 0.100000 P R 0.012000
LINE 0.000000 0.100000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR i
LINE 0.000000 0.100000 0.000000 -0.050000 P R 0.012000
LINE 0.000000 -0.050000 0.050000 -0.100000 P R 0.012000
LINE 0.000000 0.200000 0.000000 0.200000 P R 0.012000
ECHAR

CHAR j
LINE 0.050000 0.100000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 0.000000 -0.150000 P R 0.012000
LINE 0.000000 -0.150000 -0.050000 -0.150000 P R 0.012000
LINE -0.050000 -0.150000 -0.100000 -0.100000 P R 0.012000
LINE 0.050000 0.200000 0.050000 0.200000 P R 0.012000
ECHAR

CHAR k
LINE -0.100000 0.200000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 0.000000 0.000000 0.000000 P R 0.012000
LINE 0.000000 0.000000 0.100000 -0.100000 P R 0.012000
LINE -0.050000 0.000000 0.050000 0.100000 P R 0.012000
ECHAR

CHAR l
LINE -0.050000 0.200000 0.000000 0.200000 P R 0.012000
LINE 0.000000 0.200000 0.000000 -0.050000 P R 0.012000
LINE 0.000000 -0.050000 0.050000 -0.100000 P R 0.012000
ECHAR

CHAR m
LINE -0.100000 -0.100000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 0.000000 0.050000 P R 0.012000
LINE 0.000000 0.050000 0.000000 0.000000 P R 0.012000
LINE 0.000000 0.050000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR n
LINE -0.100000 0.100000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 0.000000 0.000000 0.100000 P R 0.012000
LINE 0.000000 0.100000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR o
LINE -0.100000 -0.050000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 -0.100000 -0.050000 P R 0.012000
ECHAR

CHAR p
LINE -0.100000 -0.150000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.100000 0.000000 P R 0.012000
LINE 0.100000 0.000000 0.050000 -0.050000 P R 0.012000
LINE 0.050000 -0.050000 -0.100000 -0.050000 P R 0.012000
ECHAR

CHAR q
LINE 0.100000 -0.150000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.100000 0.000000 P R 0.012000
LINE -0.100000 0.000000 -0.050000 -0.050000 P R 0.012000
LINE -0.050000 -0.050000 0.100000 -0.050000 P R 0.012000
ECHAR

CHAR r
LINE -0.100000 0.100000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 0.000000 0.000000 0.100000 P R 0.012000
LINE 0.000000 0.100000 0.050000 0.050000 P R 0.012000
ECHAR

CHAR s
LINE -0.100000 -0.100000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 -0.050000 0.050000 0.000000 P R 0.012000
LINE 0.050000 0.000000 -0.050000 0.000000 P R 0.012000
LINE -0.050000 0.000000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 0.100000 0.100000 P R 0.012000
ECHAR

CHAR t
LINE -0.050000 0.200000 -0.050000 -0.050000 P R 0.012000
LINE -0.050000 -0.050000 0.000000 -0.100000 P R 0.012000
LINE 0.000000 -0.100000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 0.100000 -0.050000 P R 0.012000
LINE -0.100000 0.100000 0.050000 0.100000 P R 0.012000
ECHAR

CHAR u
LINE -0.100000 0.100000 -0.100000 -0.050000 P R 0.012000
LINE -0.100000 -0.050000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.000000 -0.100000 P R 0.012000
LINE 0.000000 -0.100000 0.100000 0.000000 P R 0.012000
LINE 0.100000 -0.100000 0.100000 0.100000 P R 0.012000
ECHAR

CHAR v
LINE -0.100000 0.100000 0.000000 -0.100000 P R 0.012000
LINE 0.000000 -0.100000 0.100000 0.100000 P R 0.012000
ECHAR

CHAR w
LINE -0.100000 0.100000 -0.050000 -0.100000 P R 0.012000
LINE -0.050000 -0.100000 0.000000 0.000000 P R 0.012000
LINE 0.000000 0.000000 0.050000 -0.100000 P R 0.012000
LINE 0.050000 -0.100000 0.100000 0.100000 P R 0.012000
ECHAR

CHAR x
LINE -0.100000 0.100000 0.100000 -0.100000 P R 0.012000
LINE -0.100000 -0.100000 0.100000 0.100000 P R 0.012000
ECHAR

CHAR y
LINE -0.100000 0.100000 -0.100000 0.000000 P R 0.012000
LINE -0.100000 0.000000 -0.050000 -0.050000 P R 0.012000
LINE -0.050000 -0.050000 0.100000 -0.050000 P R 0.012000
LINE 0.100000 0.100000 0.100000 -0.100000 P R 0.012000
LINE 0.100000 -0.100000 0.050000 -0.150000 P R 0.012000
LINE 0.050000 -0.150000 -0.050000 -0.150000 P R 0.012000
ECHAR

CHAR z
LINE -0.100000 0.100000 0.100000 0.100000 P R 0.012000
LINE 0.100000 0.100000 -0.100000 -0.100000 P R 0.012000
LINE -0.100000 -0.100000 0.100000 -0.100000 P R 0.012000
ECHAR

CHAR {
LINE 0.050000 0.200000 0.000000 0.200000 P R 0.012000
LINE 0.000000 0.200000 -0.050000 0.150000 P R 0.012000
LINE -0.050000 0.150000 -0.050000 0.100000 P R 0.012000
LINE -0.050000 0.100000 -0.100000 0.050000 P R 0.012000
LINE -0.100000 0.050000 -0.050000 0.000000 P R 0.012000
LINE -0.050000 0.000000 -0.050000 -0.050000 P R 0.012000
LINE -0.050000 -0.050000 0.000000 -0.100000 P R 0.012000
LINE 0.000000 -0.100000 0.050000 -0.100000 P R 0.012000
ECHAR

CHAR |
LINE 0.000000 0.200000 0.000000 -0.100000 P R 0.012000
ECHAR

CHAR }
LINE -0.050000 0.200000 0.000000 0.200000 P R 0.012000
LINE 0.000000 0.200000 0.050000 0.150000 P R 0.012000
LINE 0.050000 0.150000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.050000 P R 0.012000
LINE 0.100000 0.050000 0.050000 0.000000 P R 0.012000
LINE 0.050000 0.000000 0.050000 -0.050000 P R 0.012000
LINE 0.050000 -0.050000 0.000000 -0.100000 P R 0.012000
LINE 0.000000 -0.100000 -0.050000 -0.100000 P R 0.012000
ECHAR

CHAR ~
LINE -0.100000 0.150000 -0.050000 0.200000 P R 0.012000
LINE -0.050000 0.200000 0.050000 0.100000 P R 0.012000
LINE 0.050000 0.100000 0.100000 0.150000 P R 0.012000
ECHAR

`;var EHe=.59055;var LA=11,x6=class{};var Bc=`
`,kc=class o extends x6{constructor(t){if(super(),this.num=t,!t)throw new Error("Invalid XYNumber parameters")}get xy(){return this.num}format(t){return t.formatPointXY(this.num)}static create(t,e){return new o({x:t,y:e})}},Vm=class o extends x6{constructor(t){if(super(),this.num=t,isNaN(t))throw new Error("Invalid UnitFormateNumber parameters")}get number(){return this.num}format(t){return[t.formatDecimalNumber(this.num)]}static create(t){return new o(t)}},hX=class extends x6{constructor(t){if(super(),this.num=t,isNaN(t))throw new Error("Invalid FormatNumber parameters")}get number(){return this.num}format(t){return[t.formatPureDecimalNumber(this.num)]}},Z3=class extends x6{constructor(t){if(super(),this.num=t,isNaN(t))throw new Error("Invalid SymbolNameNumber parameters")}get number(){return this.num}format(t){return[t.formatSymbolNameDecimalNumber(this.num)]}},R6=class o extends x6{constructor(){super(...arguments);this.modifiers=[]}format(e){let r=[];for(let i of this.modifiers)typeof i=="number"?r.push(i.toString()):typeof i=="string"?r.push(i):r.push(...i.format(e));return[r.join("")]}static create(e){let r=new o;return r.modifiers=e||[],r}};var zR=class o{constructor(){this.rightLength=9;this._unit="INCH";this.toUnit=o.toUnitIN}get unit(){return this._unit}set unit(t){this._unit=t,this.toUnit=t=="INCH"?o.toUnitIN:o.toUnitMM}set decimal(t){this.rightLength=t}static toUnitIN(t){return t/100}static toUnitMM(t){return t*.254}static toNoExponentialString(t){let e=t.toString();if(/[eE]/.test(e)){let r=e.split(/[eE]/),[i,n]=r,s=i[0]=="-"?"-":"";i=s?i.slice(1):i;let a=i,l="";a.includes(".")&&([a,l]=a.split("."));let c=Number(n);c>0?(l=l.padEnd(c,"0"),a+=l.slice(0,c),l=l.slice(c)):c<0&&(a=a.padStart(-c,"0"),l=a.slice(c)+l,a=a.slice(0,a.length+c)),a=a||"0",e=s+a+(l?"."+l:"")}return e}formatPureDecimalNumber(t,e=13){let r=o.toNoExponentialString(t),i=+("1e"+e);return r.includes(".")&&r.split(".")[1].length>e&&(r=o.toNoExponentialString(Math.round(t*i)/i)),r.includes(".")?r:r+".0"}formatDecimalNumber(t){return t=this.toUnit(t),this.formatPureDecimalNumber(t,this.rightLength)}formatSymbolNameDecimalNumber(t){return t=this.toUnit(t)*1e3,this.formatPureDecimalNumber(t,this.rightLength)}formatPointXY(t){let e=this.formatDecimalNumber(t.x),r=this.formatDecimalNumber(t.y);return[e,r]}};var Ose=class{constructor(t){this._name=this.checkName(t)}get name(){return this._name}checkName(t){return t?t.toLowerCase().replace(/[^a-z0-9\.\+\-]/g,"_"):this.autoName()}autoName(){return new Date().getTime().toString()}},WI=class o extends Ose{constructor(e){super(e);this.folderMap=new Rl;this.fileMap=new Rl;this.childFolders=[];this.childFiles=[];this.hasZipFile=!1}addChildFolder(e){let r=e.name;return this.folderMap.getOrDefault(r,null)==null?(this.folderMap.put(r,this.folderMap.size()),this.childFolders.push(e),e.parent=this,e):null}addChildFile(e){let r=e.name;return this.fileMap.getOrDefault(r,null)==null?(this.fileMap.put(r,this.fileMap.size()),this.childFiles.push(e),e.parent=this,e):null}deleteFolder(e){let r=this.folderMap.get(e);r!=null&&(this.childFolders.splice(r,1),this.folderMap.clear(),this.childFolders.forEach((i,n)=>{this.folderMap.put(i.name,n)}))}getChildFolder(e){let r=this.folderMap.get(e);return r!=null?this.childFolders[r]:null}getChildFile(e){let r=this.fileMap.get(e);return r!=null?this.childFiles[r]:null}getAllChildFolder(){return this.childFolders}getAllChidFiles(){return this.childFiles}generateChildFolder(e){let r=e;for(e||(r=this.autoName());this.folderMap.getOrDefault(r,null)!=null;)r=this.autoName();let i=new o(r);return this.addChildFolder(i)}clone(){return new o(this.name)}set parent(e){this._parent=e}get parent(){return this._parent}},lf=class extends Ose{constructor(){super(...arguments);this.hasZipFile=!1}addUnit2Doc(e){return`UNITS=${e.unit}`+Bc}set parent(e){this._parent=e}get parent(){return this._parent}},Ase=class extends lf{constructor(t,e){super(t),this.content=e}exportText(){return this.content}};var sAt="tools",_se=class{constructor(){this.num=1;this.tools=[];this.toolMap={}}getNum(t,e,r,i){if(this.toolMap[t]!=null)return this.toolMap[t];let n=this.num;return this.tools.push({NUM:n,SHAPE:i,TYPE:e,MIN_TOL:0,MAX_TOL:0,BIT:"",FINISH_SIZE:r,DRILL_SIZE:r,ORIG_SIZE:-1,SLOT_LENGTH:0,FREEZE:"NO"}),this.toolMap[t]=n,this.addNum(),n}addNum(){this.num++}getTool(t){return this.tools[t-1]}},vse=class extends lf{constructor(e,r){super(sAt);this._thickness=0;this._userParams="";this.toolNums=new Set;this.format=new zR;this.tool=e,this.format=r}exportText(){let e=this.addUnit2Doc(this.format);return e+=this.getThicknessText(),e+=this.getuserParamsText(),this.toolNums.forEach(r=>{let i=this.tool.getTool(r);i&&(e+=this.exportObj("TOOLS",i)+Bc)}),e}exportObj(e,r){let i="";i=`${e} {${Bc}${n(r)}}${Bc}`;function n(s){let a="";for(let l in s)a+=`    ${l}=${s[l]}${Bc}`;return a}return i}addTool(e,r,i=!0){let n=this.format.formatSymbolNameDecimalNumber(e),s=this.getType(r,i),a=this.getShape(r),l=s+n+a,c=this.tool.getNum(l,s,n,a);return this.toolNums.add(c),c}getShape(e){return e==2?"SLOT":"HOLE"}getType(e,r=!0){switch(e){case 0:return r?" PLATED":"NON_PLATED";case 1:return"VIA";case 2:return"NON_PLATED"}}getThicknessText(){return`THICKNESS=${this._thickness}${Bc}`}getuserParamsText(){return`USER_PARAMS=${this._userParams}${Bc}`}set thickness(e){this._thickness=e}set userParams(e){this._userParams=e}};var uX=class{constructor(){}exportText(t){return""}},qF=class extends uX{constructor(e){super();this.code="#";this.content=e}exportText(){return this.code+this.content}};var AHe=500,Yb=class{constructor(){this.currContent=[];this.content=[],this.currContent=[]}clearBlock(){this.content=[],this.currContent=[]}addComment(t){this.currContent.length>=AHe&&(this.content.push(this.currContent),this.currContent=[]),this.currContent.push(new qF(t))}addDataBlock(t){this.currContent.length>=AHe&&(this.content.push(this.currContent),this.currContent=[]),this.currContent.push(t)}exportText(t){this.content.push(this.currContent);let e=[],r="",i=0;for(let n of this.content){for(let s of n)r+=s.exportText(t)+Bc;n.length=0,i++,i>=100&&(e.push(r),r="",i=0)}return i>0&&e.push(r),e}};var ma=class o extends uX{constructor(){super();this.code="";this.attr=null;this.modifiers=[]}exportText(e){let r=[];this.code&&r.push(this.code);for(let i of this.modifiers)if(typeof i=="number")r.push(i.toString());else if(typeof i=="string")r.push(i);else try{r.push(...i.format(e))}catch{console.log(this.modifiers)}if(this.attr&&Object.keys(this.attr).length>0){let i=";",n=!0;for(let s in this.attr)n||(i+=","),i+=s,this.attr[s]!=null&&(i+=`=${this.attr[s]}`),n=!1;r.push(i)}return r.join(" ")}addAttr(e,r){this.attr||(this.attr={}),this.attr[e]=r}static create(e,r){let i=new o;return i.code=e,i.modifiers=r||[],i}};var dX=Math.PI;var $F="x",aAt="xr";var xse=zt.toDegrees(3*dX/2),zI=class extends lf{constructor(e){super(e);this.symbolNameMap={};this.attrTableMap={};this._decode=0;this.symbolNameNumber=0;this.attrTableNumber=0;this.featureListNum=0;this.symbolNameBlock=new Yb,this.symbolNameBlock.addComment("Feature symbol names"),this.attrTableBlock=new Yb,this.attrTableBlock.addComment("Feature attribute names"),this.featureListBlock=new Yb,this.featureListBlock.addComment("Layer features")}polygonLine(e,r=!0){let i=[],n=this.checkIsAntiClockWise(e);r==!0?n&&(e=e.reverse()):n||(e=e.reverse()),e=e.asClose();let s=e.primitives,a;for(let l of s){a||(a={x:e.start().x,y:e.start().y},i.push(ma.create("OB",[new kc(a),this.getPolyType(r)])));let c={x:l.end().x,y:l.end().y};if(l instanceof M)i.push(ma.create("OS",[new kc(c)]));else if(l instanceof q){let h=l.length();if(nn.convert(h,10,1)<.1){i.push(ma.create("OS",[new kc(c)]));continue}let u=l.start().distance1(l.end()),d=l.sweepAngle,p=l.center;if(nn.convert(u,10,1)<1&&(d>xse||d<-xse)){let m=l.center,g=m.add(m.sub(l.start()));i.push(ma.create("OC",[new kc({x:g.x,y:g.y}),new kc(m),this.getCw(l.sweep())])),i.push(ma.create("OC",[new kc(c),new kc(m),this.getCw(l.sweep())]));continue}i.push(ma.create("OC",[new kc(c),new kc(p),this.getCw(l.sweep())]))}}return i.push(ma.create("OE",[])),i}checkArc(e){return this.checkArcLen(e.length())}checkArcLen(e){return!(e<.05)}checkIsAntiClockWise(e){return e.area(.1)>=0}polygonsConvert(e,r=!0){let i=[];if(e.forEach(({line:n,fill:s})=>{let a=this.polygonLine(n,s);for(let l of a)i.push(l)}),i.length!=0){this.addListBlock(ma.create("S",[this.getPolarity(r),this.getDecode()]));for(let n of i)this.featureListBlock.addDataBlock(n);this.featureListBlock.addDataBlock(ma.create("SE",[]))}}getApertureCircle(e,r=LA){if(e<=0)return null;let i="r"+Pa(e,r);if(this.symbolNameMap[i]!=null)return this.symbolNameMap[i];this.symbolNameMap[i]=this.symbolNameNumber;let n="$"+this.symbolNameNumber,s=this.symbolNameNumber;return this.addSymbolNameNumber(),this.symbolNameBlock.addDataBlock(ma.create(n,[R6.create(["r",new Z3(e)])])),s}getApertureOval(e,r,i=LA){let n="oval"+Pa(e,i)+$F+Pa(r,i);if(this.symbolNameMap[n]!=null)return this.symbolNameMap[n];this.symbolNameMap[n]=this.symbolNameNumber;let s="$"+this.symbolNameNumber,a=this.symbolNameNumber;return this.addSymbolNameNumber(),this.symbolNameBlock.addDataBlock(ma.create(s,[R6.create(["oval",new Z3(e),$F,new Z3(r)])])),a}getApertureSquare(e,r=LA){let i="s"+Pa(e,r);if(this.symbolNameMap[i]!=null)return this.symbolNameMap[i];this.symbolNameMap[i]=this.symbolNameNumber;let n="$"+this.symbolNameNumber,s=this.symbolNameNumber;return this.addSymbolNameNumber(),this.symbolNameBlock.addDataBlock(ma.create(n,[R6.create(["s",new Z3(e)])])),s}getApertureRect(e,r,i,n=LA){let s="rect"+Pa(e,n)+$F+Pa(r,n)+$F+Pa(i,n);if(this.symbolNameMap[s]!=null)return this.symbolNameMap[s];this.symbolNameMap[s]=this.symbolNameNumber;let a="$"+this.symbolNameNumber,l=this.symbolNameNumber;this.addSymbolNameNumber();let c=["rect",new Z3(e),$F,new Z3(r)];return i!=0&&c.push(aAt,new Z3(i),$F,"1234"),this.symbolNameBlock.addDataBlock(ma.create(a,[R6.create(c)])),l}getSymbolNameByDoc(e){let r="$"+this.symbolNameNumber,i=this.symbolNameNumber;return this.addSymbolNameNumber(),this.symbolNameBlock.addDataBlock(ma.create(r,[e.name])),i}primitiveConvert(e,r,i=!0){e instanceof M?this.lineConvert(e.start(),e.end(),r,i):e instanceof q&&this.ArcConvert(e.start(),e.end(),e.center,r,e.sweep(),e.length(),e.sweepAngle)}lineConvert(e,r,i,n=!0,s){let a=ma.create("L",[new kc({x:e.x,y:e.y}),new kc({x:r.x,y:r.y}),i,this.getPolarity(n),this.getDecode()]);return s&&this.getFeatureRecord(),this.addListBlock(a),a}ArcConvert(e,r,i,n,s,a,l,c=!0){if(nn.convert(a,10,1)<.1)return[this.lineConvert(e,r,n)];let h=e.distance1(r);if(nn.convert(h,10,1)<1&&(l>xse||l<-xse)){let d=e.distance1(i),p=new S(i.x-d,i.y),m=new S(i.x+d,i.y),g=[];return g.push(...this.ArcConvert(p,m,i,n,ae.CCW,dX*d,dX)),g.push(...this.ArcConvert(m,p,i,n,ae.CCW,dX*d,dX)),g}let u=ma.create("A",[new kc({x:e.x,y:e.y}),new kc({x:r.x,y:r.y}),new kc({x:i.x,y:i.y}),n,this.getPolarity(c),this.getDecode(),this.getCw(s)]);return this.addListBlock(u),[u]}PadConvert(e,r,i,n=!1,s=!0){let a=[new kc({x:e.x,y:e.y}),r,this.getPolarity(s),this.getDecode(),...this.getOrient(i)],l=ma.create("P",a);return n&&l.addAttr(this.getSmdAttr()),this.addListBlock(l),l}addDrillParameter(e,r,i){let n=this.getDrillAttr(),s;switch(r){case 0:s=i?0:1;break;case 1:s=2;break;case 2:s=1}e.addAttr(n,s)}addPadUsageParameter(e,r){let i=this.addAttr(".pad_usage"),n;n=r?0:1,e.addAttr(i,n)}getOrient(e,r=!1){switch(e=zt.regularD(-e),e){case 0:return r?[4]:[0];case 90:return r?[5]:[1];case 180:return r?[6]:[2];case 270:return r?[7]:[3];default:return r?[9,e]:[8,e]}}getDrillAttr(){return this.addAttr(".drill")}getSmdAttr(){return this.addAttr(".smd")}addAttr(e){if(this.attrTableMap[e]!=null)return this.attrTableMap[e];this.attrTableMap[e]=this.attrTableNumber;let r="@"+this.attrTableNumber;return this.attrTableBlock.addDataBlock(ma.create(r,[e])),this.addAttrTableNumber(),this.attrTableMap[e]}addAttrTableNumber(){this.attrTableNumber++}addSymbolNameNumber(){this.symbolNameNumber++}getCw(e){return e==ae.CW?"Y":"N"}getDecode(){return this._decode.toString()}set dcode(e){this._decode=e}getPolarity(e){return e?"P":"N"}getPolyType(e){return e?"I":"H"}addListBlock(e){if(Array.isArray(e))for(let r of e)this.featureListBlock.addDataBlock(r),this.needAddFeature(r)&&this.addFeatureRecode();else e&&(this.featureListBlock.addDataBlock(e),this.needAddFeature(e)&&this.addFeatureRecode())}needAddFeature(e){switch(e.code){case"S":case"A":case"L":case"T":case"P":return!0;default:return!1}}addFeatureRecode(){this.featureListNum++}getFeatureRecord(){return this.featureListNum}deleteBlock(){this.symbolNameBlock.clearBlock(),this.attrTableBlock.clearBlock(),this.featureListBlock.clearBlock()}exportText(e){let r=[];return xe.addAll(r,[this.addUnit2Doc(e)]),xe.addAll(r,this.symbolNameBlock.exportText(e)),xe.addAll(r,this.attrTableBlock.exportText(e)),xe.addAll(r,this.featureListBlock.exportText(e)),r}};var Rse=class extends WI{constructor(t){super(t),this.addChildFile(new zI("features"))}getLayerDocument(){return this.getChildFile("features")}getToolDocument(t,e){let r=this.getChildFile("tools");return r||(r=this.addChildFile(new vse(t,e))),r}},J3=class o extends Rse{constructor(t){super(t)}clone(){return new o(this.name)}},MA=class o extends Rse{constructor(t){super(t)}get startLayerName(){return this._startLayerName}set startLayerName(t){this._startLayerName=t}get endLayerName(){return this._endLayerName}set endLayerName(t){this._endLayerName=t}set plated(t){this.isPlated=t}get plated(){return this.isPlated}clone(){let t=new o(this.name);return t.startLayerName=this._startLayerName,t.endLayerName=this._endLayerName,t}};var _He=.001,lAt=.1,ZF=class{constructor(t){this.documentManage=t}static getDefaultPanelize(){let t=si.getInstance().getDefaultPanelize();return{on:t.on,success:t.success,row:t.row,column:t.column,rowSpacing:t.rowSpacing,columnSpacing:t.columnSpacing,outerBBox:si.getInstance().outerBBox,onlyOutline:t.onlyOutline,singleBBox:si.getInstance().singleBBox}}getEnvironmentOrigin(){return R.getInstance().origin}generateOutLine(t){let e=this.outLine;return e?this.parseOutline(e,t):null}polyGonNeedConvertDrill(t){return t instanceof yo&&this.outLine&&t.globalIndex!=this.outLine.globalIndex?t.bbox.isInside(this.outLine.bbox):!1}parseOutline(t,e){if(t.layerId==11){let r=this.getOutline1(t,e),i=[];return i.push({line:r,fill:!0}),i}return null}getOutline1(t,e){let r;return t instanceof Za?r=ge.build4([t.leftLow,t.leftUp,t.rightUp,t.rightLow]).asClose():t instanceof yo?r=this.circleModelToLine(t):r=t.pl,r.multiply3(Qe.translate1(e))}getOutline(t,e){let r;return t instanceof Za?r=ge.build4([t.leftLow,t.leftUp,t.rightUp,t.rightLow]).asClose():t instanceof yo?r=this.circleModelToLine(t):r=t.getMathGraphics(),r.multiply3(Qe.translate1(e))}circleModelToLine(t){let e=t.center,r=t.radius;return this.documentManage.circleToLine(e,r)}generateCopper(t,e){let r=this.documentManage,i=e||qo.getInstance().getAllItem(),n={},s={},a={};for(let c=0;c<i.length;c++){let h=i[c],u=h.layerId;if(!r.getLayerDocument(u))continue;let m=h.getParent().globalIndex;h.style=="solid"?(s[m]||(s[m]=[]),h.optimization&&(a[m]||(a[m]=[]),a[m].push(h)),s[m].push(h)):(a[m]||(a[m]=[]),a[m].push(h))}let l=Qe.translate1(t);for(let c in s){let h=s[c];if(h.length<=0)continue;let u,d=[];h.forEach(m=>{u=m.layerId,m.pls.sort((y,b)=>b.bbox().area()-y.bbox().area()).forEach((y,b)=>{let P=y.multiply3(l),T=b==0;d.push({line:P,fill:T})})});let p=r.getDcode();n[c]=p,r.addPolygonsToDoc(u,d,c)}for(let c in a){let h=a[c];if(h.length<=0)continue;let u;n[c]?u=n[c]:u=r.addDcode();for(let d of h){let p=d.pls.map(y=>y.multiply3(l)),m=d.style=="solid"?d.optimizationWidth:d.gridLineWidth,g=d.layerId;r.addPolyLineToDoc(g,m,p,u,c)}}}generatePlaneZone(t,e){let r=this.documentManage,i=e||Xo.getInstance().getAllItem(),n=Qe.translate1(t);for(let s of i){let a=s.layerId;if(!r.getLayerDocument(a)||!s.style)continue;let h=s.getOutline().sort((d,p)=>p.bbox().area()-d.bbox().area()),u=[];h.forEach((d,p)=>{let m=d.multiply3(n),g=p==0;u.push({line:m,fill:g})}),r.addDcode(),r.addPolygonsToDoc(a,u,s.globalIndex)}}generateImage(t,e){let r=this.documentManage,i=e||Hs.getInstance().getAllItem();for(let n of i){let s=n.layerId,a=n.getParent();if(s!=56){if(a){if(r.isSilkLayer(s)){if(!r.objectConfigs.includes("ComponentSilkscreen"))continue}else if(!r.objectConfigs.includes("Image"))continue}else if(!r.objectConfigs.includes("Image"))continue}if(!r.getLayerDocument(s))continue;let c=n.getPath(),h=[];for(let u of c)u.pl=u.pl.multiply3(Qe.translate1(t)),h.push(u);r.parseGroupLine(s,h)}}generateText(t,e){let r=this.documentManage,i=e||io.getInstance().getAllItem(),n=Qe.translate1(t);for(let s of i){let a=s.layerId,l=r.getLayerDocument(a);if(!l)continue;let c=s.getParent(),h=!!s.key;if(a!=56){if(c&&c instanceof Bi){if(h){if(!r.objectConfigs.includes("ComponentProperty"))continue}else if(r.isSilkLayer(a)&&!r.objectConfigs.includes("ComponentSilkscreen"))continue}else if(!r.objectConfigs.includes("Text"))continue}let{strokeWidth:u,fontFamily:d,showKey:p,showValue:m}=s;if(!p&&!m)continue;if(d=="default"||d==""){l.dcode=r.addDcode();let P=s.getRealOutline().map(T=>T.multiply3(n));r.addPolyLineToDoc(a,u,P);continue}let g=s.getRealOutline(),y=[];if(g[0]&&g[0]instanceof Cp)g.forEach((b,P)=>{let T=b.pl.multiply3(n);y.push({line:T,fill:b.flag})}),r.addDcode(),r.addPolygonsToDoc(a,y);else{let b=g.map(P=>P.multiply3(n));l.dcode=r.addDcode(),r.addPolyLineToDoc(a,u,b)}}}generatePolygonModel(t,e){let r=this.documentManage,i=r.filterObject(),n=e||vi.getInstance().getAllItem();for(let s of n){let a=s.layerId;if(s.getParent()){if(r.isSilkLayer(a)){if(!r.objectConfigs.includes("ComponentSilkscreen"))continue}else if(i&&!i.includes(s.type))continue}else if(i&&!i.includes(s.type))continue;KF(Ze.getInstance().getLayer(a).type)||a!=11&&this.parseProfile(s,t)}}parseProfile(t,e,r=!1){let i=this.documentManage,n=Qe.translate1(e),s=t.layerId,{type:a,strokeWidth:l}=t,c=i.getLayerDocument(s);if(a=="FPC Stiffener"){let h=t.component;c=i.getFPCDocument(s,h.material,h.thickness,h.fpcModel)}switch(a){case"Board Outline":case"Line":{if(!c)return;let h;if(t instanceof yo?h=this.circleModelToLine(t):h=t.getMathGraphics(s,0),!h)return;let u=h.multiply3(n);if(c.parent instanceof J3){let d=u.isClose(_He);if(!d){let p=u.primitives;this.addDrillPrimitives(p,t.strokeWidth);return}if(d&&t instanceof yo&&this.polyGonNeedConvertDrill(t)){let p=t.center.multiply3(n);return i.addDrillCircle(t.globalIndex,1,2,t.radius,p,2,!1)}}i.addPolyLineToDocByDoc(c,l,[u],i.addDcode());return}case"FPC Stiffener":case"Fill Region":{if(!c)return;let h;if(t instanceof yo?h=this.circleModelToLine(t):h=t.getMathGraphics(s,0),!h)return;let u=h.multiply3(n);i.addDcode(),u instanceof Bt?i.parsePolyGroup(c,u):i.addPolygonsToDocByDoc(c,[{line:u,fill:!0}]);return}case"Slot Region":{this.handleSlot(t,e,r);break}}}addDrillPrimitives(t,e){let r=this.documentManage;for(let i of t)i instanceof M?r.addDrillLine("",1,2,e/2,i.start(),i.end(),2,!1):i instanceof q&&r.addDrillArc("",1,2,e/2,i.start(),i.end(),i.center,i.sweep(),i.length(),i.sweepAngle,2,!1)}handleSlot(t,e,r=!1){let i=this.documentManage,n;if(t instanceof yo){let{center:a,radius:l}=t;if(a=a.multiply3(Qe.translate1(e)),r){i.addDrillCircle2Route(t.globalIndex,l,a,2,!1);return}n=i.circleToLine(a,l)}else n=this.getOutline(t,e);i.addDcode();let s=n.primitives;this.addDrillPrimitives(s,EHe)}handleLineAndArcModel(t,e,r=!1){let i=this.documentManage,n=Qe.translate1(e);for(let s of t){let a=s.layerId,l=i.getLayerDocument(a);if(!l)continue;let c=s.width,h=r&&l.parent instanceof J3,u=s.start.multiply3(n),d=s.end.multiply3(n);s.modelType==="Line"?h?i.addDrillLine("",1,2,s.width,u,d,2,!1):i.addLineConvert(l,c,"",u,d):h?i.addDrillArc("",1,2,s.width,s.start,s.end,s.center,s.sweep,s.length,s.sweepAngle,2,!1):i.addArcConvert(l,c,"",s.start.multiply3(n),s.end.multiply3(n),s.center.multiply3(n),s.sweep,s.length,s.sweepAngle)}}generateRect(t,e){let i=this.documentManage.filterObject(),n=e||Qi.getInstance().getAllItem();for(let s of n){if(i&&!i.includes(s.type))continue;let a=s.layerId;KF(Ze.getInstance().getLayer(a).type)||this.parseProfile(s,t)}}generateCircle(t,e,r=!1){let n=this.documentManage.filterObject(),s=e||Fi.getInstance().getAllItem();for(let a of s){if(n&&!n.includes(a.type))continue;let l=a.layerId;KF(Ze.getInstance().getLayer(l).type)||this.parseProfile(a,t,r)}}generateDimension(t){let e=this.documentManage,r=Ma.getInstance().getAllItem(),i=Na.getInstance().getAllItem(),n=sl.getInstance().getAllItem(),s=Qe.translate1(t),a=l=>{for(let c of l){let h=c.layerId,u=e.getLayerDocument(h);if(!u)continue;let d=c.getBaseGraphics();e.addDcode();for(let p of d)for(let m of p)e.addPrimitivesToDoc(h,m.multiply3(s),c.strokeWidth);if(c instanceof Ap){let p=c.getDegree(),{center:m,radius:g,width:y}=p;m=m.multiply3(s);let b=e.circleToLine(m,g);e.addPolyLineToDocByDoc(u,y,[b])}}};a(r),a(i),a(n)}generateTear(t){let e=this.documentManage,r=vi.getInstance().getAllItem();for(let i of r)if(i.type=="TearDrop"){let n=i.layerId,s=e.getLayerDocument(n);if(!s)continue;let a=i.getMathGraphics(n,0);if(!a)continue;let l=a.multiply3(Qe.translate1(t));e.addDcode(),e.addPolygonsToDocByDoc(s,[{line:l}])}}generatePad(t,e,r=!1){let i=this.documentManage,n=e||jn.getInstance().getAllItem();for(let s of n){let a=s.layerId,l=ar(a);if(!ar&&!i.getLayerDocument(a))return;if((l||ao(a))&&(this.handlePad(s,1,t,!l),this.handlePad(s,5,t,!l),l||this.handlePad(s,7,t,!l)),(l||2==a)&&(this.handlePad(s,2,t,!l),this.handlePad(s,6,t,!l),l||this.handlePad(s,8,t,!l)),l){for(let b=15;b<=46;b++)s.unusedInnerLayers.includes(b)||this.handlePad(s,b,t,!l);let{plated:c,center:h,rotation:u,holeShape:d,holeLength:p,holeOffset:m,holeRadius:g,holeRotation:y}=s;if(h=h.multiply3(Qe.translate1(t)),g>0){d!=="SLOT"&&(m=m.multiply3(Qe.rotate(u)));let b=h.add(m),P=s.globalIndex;switch(d){case"SLOT":let T=p/2-g,I=b.add1(T,0).rotate(b,y),C=b.add1(-T,0).rotate(b,y);I=I.rotate(h,u),C=C.rotate(h,u),i.addDrillLine(P,1,2,g,I,C,0,c);break;case"ROUND":i.addDrillCircle(P,1,2,g,b,0,c);break;case"RECT":i.useCircleInsteadOfSquareDrill&&i.addDrillCircle(P,1,2,g,b,0,c);break;default:break}}}}}handlePad(t,e,r,i=!1){let n=this.documentManage,s=n.getLayerDocument(e);if(!s)return;let a=this.addPadShapeToDoc(t,s,e);if(a==null)return;let{symbolNum:l,isPolygonModel:c}=a;if(l==null)return;let{center:h}=t;n.addDcode(),h=h.multiply3(Qe.translate1(r)),n.addPadToDocByDoc(s,t.globalIndex,h,l,c,t.rotation,i)}addPadShapeToDoc(t,e,r){var P;let i=this.documentManage,n=this.getPadStyle(t,r);if(!n)return null;let{pasteExpansion:s,topSolderExpansion:a,bottomSolderExpansion:l}=t,c=n.type,h=n.width,u=n.height;if(c=="POLYGON"){let T=(P=t.getMathGraphics(r))==null?void 0:P.multiply3(Qe.translate1(t.center.mul(-1)));return T?{symbolNum:i.addSymbolDoc(T,e),isPolygonModel:!0}:null}let d=7,p=8,m=5,g=6,y=0;switch(r){case d:case p:y=s;break;case m:y=a;break;case g:y=l;break;default:break}let b;switch(c){case"ELLIPSE":{if(h+=y*2,h<=0)break;b=e.getApertureCircle(h);break}case"OVAL":{if(h+=y*2,u+=y*2,h<=0||u<=0)break;if(Rv(h,u)){b=e.getApertureCircle(h);break}b=e.getApertureOval(h,u);break}case"RECT":{if(h+=y*2,u+=y*2,h<=0||u<=0)break;let T=0;T=this.getExpansionRadius(n,y),Rv(h,u)&&T==0?b=e.getApertureSquare(h):b=e.getApertureRect(h,u,T);break}default:break}return{symbolNum:b,isPolygonModel:!1}}getExpansionRadius(t,e){let{width:r,height:i,ratio:n}=t;return Math.min(r,i)/2*n+e}getPadStyle(t,e){if(e==1){if(t.top!=null)return t.top}else if(e==2){if(t.bottom!=null)return t.bottom}else if(6==e){if(t.bottom!=null)return t.bottom}else if(8==e){if(t.bottom!=null)return t.bottom}else if(5==e){if(t.top!=null)return t.top}else if(7==e){if(t.top!=null)return t.top}else if(t.inner!=null)return t.inner;return null}generateVia(t){let e=this.documentManage,r=bn.getInstance().getAllItem(),i=1,n=2,s=5,a=6,l=15,c=46;for(let h of r){let{startLayer:u,endLayer:d}=h,{center:p,radius:m,holeRadius:g,topExpansion:y,bottomExpansion:b}=h;p=p.multiply3(Qe.translate1(t));let P=!0,T=!0,I,C;P=ao(u)||ao(d),T=2==u||2==d;let E=h.globalIndex;P&&T?e.objectConfigs.includes("Via")&&(u=i,d=n,I=l,C=c):P?(I=l,C=Es(u)?u:d):T?(I=Es(u)?u:d,C=c):(I=u<d?u:d,C=u>d?u:d),P&&(e.addViaShapeToDoc(E,i,p,m),e.addViaShapeToDoc(E,s,p,m+y)),T&&(e.addViaShapeToDoc(E,n,p,m),e.addViaShapeToDoc(E,a,p,m+b));for(let O=I;O<=C;O++)h.unusedInnerLayers.includes(O)||e.addViaShapeToDoc(E,O,p,m);P&&T?e.objectConfigs.includes("Via")&&e.addDrillCircle(E,1,2,g,p,1,void 0,!0):e.addDrillCircle(E,u,d,g,p,1,void 0,!0)}}generateTrack(t){let e=this.documentManage,r=Sn.getInstance().getAllItem(),i=Qe.translate1(t);for(let n of r){let s=e.getLayerDocument(n.layerId);if(s){if(e.addDcode(),n instanceof zr){let a=n.start.multiply3(i),l=n.end.multiply3(i);e.addLineConvert(s,n.width,n.globalIndex,a,l)}else if(n instanceof Ii){let a=n.start.multiply3(i),l=n.end.multiply3(i),c=n.center.multiply3(i);e.addArcConvert(s,n.width,n.globalIndex,a,l,c,n.sweep,n.length,n.sweepAngle)}}}}getTrackNetData(){let t=[],e=Sn.getInstance().getAllItem();for(let r of e)t.push({globalIndex:r.globalIndex,net:r.net});return t}getPlaneData(){let t=[],e=Xo.getInstance().getAllItem();for(let r of e)t.push({globalIndex:r.globalIndex,net:r.net,fillType:"solid"});return t}getCopperData(){let t=[],e=Qi.getInstance().getAllItem();e=e.concat(Fi.getInstance().getAllItem()),e=e.concat(vi.getInstance().getAllItem());for(let r of e){let i=r.component;i instanceof xn&&t.push({globalIndex:r.globalIndex,net:r.net,fillType:i.style})}return t}getViaData(){let t=bn.getInstance().getAllItem(),e=[];for(let r of t){let i=r.bbox;e.push({globalIndex:r.globalIndex,net:r.net,center:r.center,bbox:i,holeRadius:r.holeRadius,layerId:r.layerId})}return e}getCompData(){let t=Ms.getInstance().getAllItem(),e=[],r=new Map;for(let i of t){let n=[];if(i.getPads().forEach(l=>{n.push(this.getPadInfo(l))}),!r.get(i.footprintUUID)){let l=[],c=Ji.getInstance().getItem(i.footprintUUID),h=c.getOrigin(),u=Qe.translate(-h.x,-h.y);c.getPads().forEach(d=>{l.push(this.getPadInfo(d,u))}),r.set(i.footprintUUID,{pads:l,bbox:c.getBBox()})}let s={},a=i.getAttr();for(let l in a)s[l]={value:a[l].value};e.push({globalIndex:i.globalIndex,rotation:i.rotation,position:i.position,bbox:i.bbox,layerId:i.layerId,designator:i.designator,footprintId:i.footprintId,footprintUUID:i.footprintUUID,pads:n,attrs:s,attrMap:i.attrKeyValue||{}})}return{map:e,footMap:r}}getPadInfo(t,e){let r=t.center,i=t.bbox,n=t.getMathGraphics();return e&&(r=r.multiply3(e),i=i==null?void 0:i.transform(e),n=n==null?void 0:n.multiply3(e)),{net:t.net,rotation:t.rotation,num:t.num,layerId:t.layerId,holeRadius:t.holeRadius,center:r,bbox:i,isTestPad:t.isTestPad,top:t.top?{type:t.top.type,width:t.top.width}:null,bottom:t.bottom?{type:t.bottom.type,width:t.bottom.width}:null,polyline:n,globalIndex:t.globalIndex}}getPcbTextOutline(t=""){return fd(t,.2,.1).path}getLayerType(t){return Ze.getInstance().getLayer(t).type}createPanelize(t,e){let r=si.getInstance().items,i=si.getInstance().outlines;for(let n of r){if(n instanceof Li){this.generateText(t,[n]);continue}if(n instanceof Za){this.generateRect(t,[n]);continue}if(n instanceof yo){this.generateCircle(t,[n],!0);continue}if(n instanceof et){this.generatePad(t,[n],!0);continue}if(n instanceof hs||n instanceof Va){this.handleLineAndArcModel([n],t);continue}}if(i.length>0){let n=this.documentManage,s=si.getInstance().getDefaultPanelize(),a=L0.bBoxWithOffset(si.getInstance().singleBBox,s);if(!this.outLine)return;let c=[this.outLine];e&&yF().forEach(h=>{c.push(h)});for(let h=0;h<s.row;h++)for(let u=0;u<s.column;u++){if(h===0&&u===0)continue;let d=new S(a.offset.x*u,a.offset.y*h).add(t);for(let p of c)p instanceof Za?this.generateRect(d,[p]):p instanceof yo?this.generateCircle(d,[p]):p instanceof ss?this.generatePolygonModel(d,[p]):n.parseOutLinePolyLine([p],d)}}}outLineHandle(){function t(l){return l.layerId==11}let e=Fi.getInstance().getAllItem().filter(l=>t(l)),r=Qi.getInstance().getAllItem().filter(l=>t(l)),i=this.connectPolygonOutLine(r,e),n=[].concat(r,i.closePls,e),s,a;return n.forEach(l=>{a?a.area()<l.bbox.area()&&(a=l.bbox,s=l):(a=l.bbox,s=l)}),this.outLine=s,{lines:i.polys.concat(i.closePls),boardLines:i.outline}}connectPolygonOutLine(t,e){var m;let r=[],i=[],n=vi.getInstance().getAllItem(),s=[],a=new _e,l;function c(g){(l==null||l>g.strokeWidth)&&(l=g.strokeWidth),s.push(g)}n.forEach(g=>{g.layerId==11&&c(g)}),t.forEach(g=>{c(g)}),e.forEach(g=>{c(g)});let h=[],u=s,d=l;u.forEach(g=>{a.ext1(g.bbox);let y=g.getMathGraphics();h.push(...y.primitives)});let p=[];if(h.length>0){let g=a.build1().extendOfSize(2),y=new $c(g,2,lAt,new Di(1),h),b=g.extendOfSize(g.width()),P=y.detect().items.filter(I=>I.bbox().width()<b.width());for(let I of P)I.isClose(_He)&&hI(I).forEach(E=>{let O={pl:E.asClose(),strokeWidth:d,bbox:E.bbox(),layerId:11};i.push(O)});let T={};n.forEach(I=>{if(I.layerId==11){let C=I.strokeWidth.toFixed(2).toString();T[C]||(T[C]=[]),T[C].push(I)}});for(let I in T){let C=T[I],E=(m=C[0])==null?void 0:m.strokeWidth,O=[];C.forEach(_=>{let x=_.strokeWidth,v=_.getMathGraphics().primitives,D=this.filterPrimitives(P,v,x),w=v.filter(F=>!D.has(F));for(let F of w){let H=ge.build2([F]),z={pl:H,strokeWidth:x,bbox:H.bbox(),layerId:11};r.push(z)}for(let F of D)O.push(F)}),O.length>0&&p.push({pl:O,strokeWidth:E,layerId:11})}}return{polys:r,closePls:i,outline:p}}filterPrimitives(t,e,r){if(t.length==0)return new Set(e);let i=new ji(10);e.forEach(s=>{i.add(s)});let n=new Set;return t.forEach(s=>{s.primitives.forEach(a=>{let l=i.search(a.bbox().extendOfSize(r));a instanceof q?l.filter(h=>h instanceof q).forEach(h=>{(this.inArcShape(a.start(),r,h)&&this.inArcShape(a.end(),r,h)||this.inArcShape(h.start(),r,a)&&this.inArcShape(h.end(),r,a))&&n.add(h)}):a instanceof M&&l.filter(h=>h instanceof M).forEach(h=>{(this.inLineShape(a.start(),r,h.start(),h.end())&&this.inLineShape(a.end(),r,h.start(),h.end())||this.inLineShape(h.start(),r,a.start(),a.end())&&this.inLineShape(h.end(),r,a.start(),a.end()))&&n.add(h)})})}),n}inArcShape(t,e,r){let i=t.x,n=t.y,s=r.sweep(),a=r.rx,l=r.center,c=s==ae.CW,h=c?r.endAngle():r.startAngle,u=c?r.startAngle:r.endAngle();h%=kr,h<0&&(h+=kr),u%=kr,u<0&&(u+=kr);let d=a-e/2,p=a+e/2,m=i-l.x,g=n-l.y,y=Math.atan2(g,m);if(y<0&&(y+=kr),h<=u&&y>=h&&y<=u||h>u&&(y>=h&&y<=kr||y>=0&&y<=u)||h==u){var b=Math.sqrt(m*m+g*g);return b<=p&&b>=d}else{var P=r.start(),T=r.end();return P.distance2(t)<=e*e?!0:T.distance2(t)<=e*e}}inLineShape(t,e,r,i){let n=t.x,s=t.y,a=n-r.x,l=s-r.y,c=n-i.x,h=s-i.y,u=i.x-r.x,d=i.y-r.y,p=new S(-d,u).normalize(),m=u+p.x*e/2,g=d+p.y*e/2,y=m*m+g*g,b=a*a+l*l,P=c*c+h*h,T=Math.abs(a*d-l*u)/2,C=Math.sqrt(u*u+d*d)*e/4;if(T<=C&&b<=y&&P<=y)return!0;{let E=e/2;return b<=E*E?!0:P<=E*E}}getStackupInfo(){let t=[],r=Ze.getInstance().getLayerPhys();for(let i of r)t.push({layerId:i.layerId,material:i.material,permittivity:i.permittivity,loss:i.lossTangent,type:i.layerType,thickness:i.thickness});return t}},pX=class{static getDocName(){return R.getInstance().name}static getLayer(t){return Ze.getInstance().getLayer(t)}};function u9e(o){return o==="SIGNAL"||o==="TOP"?!0:o==="BOTTOM"}function KF(o){return o==="PLANE"}var Dse=class extends lf{constructor(e,r){super(e);this.attrTableMap={};this.compNum=0;this.pinNum=0;this.allName=[];this.noNumPad=0;this.netDoc=r,this.attrTableBlock=new Yb,this.attrTableBlock.addComment("Component attribute names"),this.compListBlock=new Yb,this.compNum=0}addComp(e,r,i,n,s,a){this.noNumPad=0,this.compListBlock.addComment(` CMP ${this.compNum}`);let l=ma.create("CMP",[e,new kc({x:r.x,y:r.y}),new hX(i),this.isMirror(n),this.getCompName(s),this.getPartName(a)]);return this.compListBlock.addDataBlock(l),this.addCompNum(),this.clearPinNum(),l}addProperty(e,r){this.compListBlock.addDataBlock(ma.create("PRP",[this.getCompName(e),this.getStrName(r)]))}getPartName(e){if(!e)return"''";if(e=e.replaceAll(" ","_"),this.allName.includes(e)){let r=1,i=e;do e=`${i}_${r}`,r++;while(this.allName.includes(e))}return this.allName.push(e),e}addPad(e,r,i,n,s,a){let l=e.net,c=!1,h=e.num;(h==null||h=="")&&(this.noNumPad++,h=`un_${this.noNumPad}`);let u=e.layerId,d=e.holeRadius||0,p=e.center.multiply3(Qe.translate1(n)),m=a.multiply3(Qe.translate1(n)),g=e.bbox.width(),y=e.bbox.height();this.netDoc.addPad(l,d,p,u,g,y,!0,e.isTestPad),this.compListBlock.addDataBlock(ma.create("TOP",[this.getPinNum(),new kc({x:m.x,y:m.y}),new hX(s),this.isMirror(c),r,i,h]))}isMirror(e){return e?"M":"N"}getStrName(e){return e==null?"''":`'${e}'`}addCompNum(){this.compNum++}getNextCompNum(){return this.compNum}getNextPinNum(){return this.pinNum}clearPinNum(){this.pinNum=0}getPinNum(){return this.pinNum++}getCompName(e){return e?e.replaceAll(" ","_"):"''"}exportText(e){let r=[];return xe.addAll(r,[this.addUnit2Doc(e)]),xe.addAll(r,this.attrTableBlock.exportText(e)),xe.addAll(r,this.compListBlock.exportText(e)),r}};var JF=class o extends WI{constructor(t){super(t),this.addChildFile(new zI("features"))}addComponentFile(t){this.addChildFile(new Dse("components",t))}getComponentFile(){return this.getChildFile("components")}clone(){return new o(this.name)}};var wse=class extends lf{constructor(e){super(e);this.content={}}addAttr(e){Object.assign(this.content,e)}exportText(e){let r=this.addUnit2Doc(e);for(let i in this.content){let n,s=this.content[i];s instanceof Vm?n=s.format(e)[0]:n=s,r+=`${i} = ${n}`+Bc}return r}};var NA=class o extends WI{constructor(e,r){super(e);this.attrs={};this._layerType=r,this.addChildFile(new zI("features"))}get layerType(){return this._layerType}getFeatureDoc(){return this.getChildFile("features")}clone(){return new o(this.name,this.layerType)}addLayerStackup(e,r,i,n){let s=this.isInner(this._layerType);this.addAttr({".eda_layers":e||"",".layer_dielectric":s?0:new Vm(r||0),".copper_weight":s?new Vm(r||0):0,".dielectric_constant":i||0,".loss_tangent":n||0})}addAttr2Layer(e,r){this.attrs[e]=r}getAttrFromLayer(e){return this.attrs[e]}isInner(e){switch(e){case"TOP":case"BOTTOM":case"SIGNAL":case"PLANE":return!0;default:return!1}}addAttr(e){let r=this.getChildFile("attrlist");r||(r=this.addChildFile(new wse("attrlist"))),r.addAttr(e)}};var Lse=class extends lf{constructor(e){super(e);this.step=[];this.stepNumber=1;this.layerNumber=1;this.layer=[];this.physInfo=null}addSortPhy(e){this.physInfo=e}setStep(e){for(let r of e)this.step.push({COL:this.stepNumber,NAME:r.name}),this.stepNumber++}getStepNames(){let e=[];return this.step.forEach(r=>{e.push(r.NAME)}),e}setLayer(e,r,i,n,s){let a=this.sortLayer(e,r,i,n,s);for(let l of a){let c="",h="";l instanceof MA&&(c=l.startLayerName,h=l.endLayerName);let u={ROW:this.layerNumber,CONTEXT:this.getContext(l),TYPE:this.getType(l),NAME:l.name,POLARITY:"POSITIVE",START_NAME:c,END_NAME:h,OLD_NAME:""};this.physInfo&&l instanceof NA&&l.layerType=="SUBSTRATE"&&(u.DIELECTRIC_TYPE=this.getSubstrateType(l.getAttrFromLayer("DIELECTRIC_TYPE")),u.DIELECTRIC_NAME=l.getAttrFromLayer("DIELECTRIC_NAME")||""),this.layer.push(u),this.layerNumber++}}getSubstrateType(e){return"CORE"}exportText(){let e="";for(let r of this.step)e+=this.exportObj("STEP",r)+Bc;for(let r of this.layer)e+=this.exportObj("LAYER",r)+Bc;return e}getLayerNames(){let e=[];for(let r of this.layer)e.push(r.NAME);return e}exportObj(e,r){let i="";i=`${e} {${Bc}${n(r)}}${Bc}`;function n(s){let a="";for(let l in s)a+=`    ${l}=${s[l]}${Bc}`;return a}return i}getContext(e){if(e instanceof NA){let r=this.getLayerType(e);if(u9e(r)||KF(r))return"BOARD";switch(r){case"TOP_SILK":case"BOT_SILK":case"TOP_SOLDER_MASK":case"BOT_SOLDER_MASK":case"TOP_PASTE_MASK":case"BOT_PASTE_MASK":case"TOP_STIFFENER":case"BOTTOM_STIFFENER":case"SUBSTRATE":return"BOARD";default:return"MISC"}}else return"BOARD"}sortLayer(e,r,i,n,s){let a=[];n!=null&&n["comp_+_top"]&&a.push(n["comp_+_top"]);let l=Object.assign({},e);if(s)for(let h in s)s[h].layerType=="TOP_STIFFENER"&&a.push(s[h]);if(this.physInfo){let h=this.physInfo;for(let u of h){let d=c(u.layerId);d&&(d.addLayerStackup(d.name,u.thickness,u.permittivity,u.loss),d.addAttr2Layer("DIELECTRIC_TYPE",u.type),d.addAttr2Layer("DIELECTRIC_NAME",u.material))}}else{c(3),c(7),c(5),c(1);for(let h=15;h<=46;h++)c(h);c(2),c(6),c(8),c(4)}if(s)for(let h in s)s[h].layerType=="BOTTOM_STIFFENER"&&a.push(s[h]);for(let h in r)a.push(r[h]);i&&a.push(i),n!=null&&n["comp_+_bot"]&&a.push(n["comp_+_bot"]),c(9),c(10),c(11),c(58),c(59),c(13),c(14);for(let h=71;h<=270;h++)c(h);for(let h in l)c(Number(h));function c(h){let u=l[h];return e[h]&&(a.push(e[h]),delete l[h]),u}return a}getLayerType(e){return e.layerType}getType(e){if(e instanceof MA)return"DRILL";if(e instanceof J3)return"ROUT";if(e instanceof JF)return"COMPONENT";let r=this.getLayerType(e);if(u9e(r))return"SIGNAL";if(KF(r))return"POWER_GROUND";switch(r){case"TOP_SILK":case"BOT_SILK":return"SILK_SCREEN";case"TOP_SOLDER_MASK":case"BOT_SOLDER_MASK":return"SOLDER_MASK";case"TOP_PASTE_MASK":case"BOT_PASTE_MASK":return"SOLDER_PASTE";case"TOP_STIFFENER":case"BOTTOM_STIFFENER":return"MASK";case"SUBSTRATE":return"DIELECTRIC";default:return"DOCUMENT"}}};var uAt="data";var Mse=class extends lf{constructor(){super(uAt);this.layerMap={};this.layerNames=[];this.nets=[];this.pkgNum=-1;this.pkgMap={};this.pkgBlock=new Yb;this.allName=[]}setLayer(e,r){this.sortLayer(e,r)}getNetNumByName(e){e||(e="$NONE$");let r=this.netListDoc.getNetNumByNet(e);return this.nets[r]==null&&(this.nets[r]=[[new qF(` NET ${r}`),ma.create("NET",[e])]]),r}addVia(e,r){if(!e)return;let i=this.getNetNumByName(r),n=[];n.push(ma.create("SNT",["VIA"])),n=n.concat(this.getFid(e)),this.nets[i].push(n)}addTrack(e,r){if(!e)return;let i=this.getNetNumByName(r),n=[];n.push(ma.create("SNT",["TRC"])),n=n.concat(this.getFid(e)),this.nets[i].push(n)}addPlane(e,r){if(!e)return;let i=this.getNetNumByName(r),n=[];n.push(ma.create("SNT",["PLN","S","C",0])),n=n.concat(this.getFid(e)),this.nets[i].push(n)}getFillType(e){switch(e){case"solid":return"S";case"90grid":case"45grid":return"H";case"none":return"O";default:return"S"}}addPad(e,r,i,n,s){if(!e)return null;let a=this.getNetNumByName(r),l=[];l.push(ma.create("SNT",["TOP",this.getSide(i),n,s])),l=l.concat(this.getFid(e)),this.nets[a].push(l);let c=this.nets[a].length-2;return{netNum:a,subNetNum:c}}addPkg(e,r,i,n){let s=this.addPkgNum();return this.pkgMap[n]=s,this.pkgBlock.addComment(` PKG ${s}`),this.pkgBlock.addDataBlock(ma.create("PKG",[this.getCompName(e),Vm.create(r),kc.create(i.LL().x,i.LL().y),kc.create(i.UR().x,i.UR().y)])),this.addRect(i),s}getCompName(e){if(!e)return"''";if(e=e.replaceAll(" ","_"),this.allName.includes(e)){let r=1,i=e;do e=`${i}_${r}`,r++;while(this.allName.includes(e))}return this.allName.push(e),e}getPkg(e){return this.pkgMap[e]}addPin(e,r,i){this.pkgBlock.addDataBlock(ma.create("PIN",[e,this.getPinType(r),kc.create(i.x,i.y),0,"U","U"]))}addPinRect(e,r,i){let n=ht.extend4(e,r,i);this.addRect(n)}addPinCircle(e,r){this.pkgBlock.addDataBlock(ma.create("CR",[kc.create(e.x,e.y),Vm.create(r)]))}addPinPolygon(e){this.pkgBlock.addDataBlock(ma.create("CT",[])),this.polygonLine(e),this.pkgBlock.addDataBlock(ma.create("CE",[]))}polygonLine(e,r=!0){e=e.asClose();let i=e.primitives,n;for(let s of i){n||(n={x:e.start().x,y:e.start().y},this.pkgBlock.addDataBlock(ma.create("OB",[new kc(n),this.getPolyType(r)])));let a={x:s.end().x,y:s.end().y};if(s instanceof M)this.pkgBlock.addDataBlock(ma.create("OS",[new kc(a)]));else if(s instanceof q){let l={x:s.center.x,y:s.center.y};this.pkgBlock.addDataBlock(ma.create("OC",[new kc(a),new kc(l),this.getCw(s.sweep())]))}}this.pkgBlock.addDataBlock(ma.create("OE",[]))}getCw(e){return e==ae.CW?"Y":"N"}getPolyType(e){return e?"I":"H"}getPinType(e){return e==12?"T":"S"}addRect(e){let r=e.LL();this.pkgBlock.addDataBlock(ma.create("RC",[kc.create(r.x,r.y),kc.create(e.width(),e.height())]))}addPkgNum(){return this.pkgNum++,this.pkgNum}getSide(e){if(1==e)return"T";if(2==e)return"B"}getFid(e){let r=[];return e.forEach(({layerName:i,record:n})=>{let{type:s,index:a}=this.layerMap[i];r.push(ma.create("FID",[s,a,n]))}),r}sortLayer(e,r){let i=[];n(3),n(7),n(5),n(1);for(let s=15;s<=46;s++)n(s);n(2),n(6),n(8),n(4);for(let s in r)i.push(r[s]);n(9),n(10),n(11),n(58),n(59),n(13),n(14);for(let s=71;s<=270;s++)n(s);function n(s){e[s]&&i.push(e[s])}return i.forEach((s,a)=>{this.layerMap[s.name]={index:a,type:this.getType(s)},this.layerNames.push(s.name)}),i}getType(e){if(e instanceof MA)return"H";switch(e.layerType){case"TOP":case"BOTTOM":case"SIGNAL":case"PLANE":return"C";case"TOP_SOLDER_MASK":case"BOT_SOLDER_MASK":case"TOP_PASTE_MASK":case"BOT_PASTE_MASK":return"L"}}setNetList(e){this.netListDoc=e}exportText(e){let r=[];xe.addAll(r,[this.addUnit2Doc(e)]);let i=`HDR Designed by EasyEDA Pro${Bc}`;i+=`LYR ${this.layerNames.join(" ")}${Bc}`;for(let n of this.nets)for(let s of n)for(let a of s)i+=a.exportText(e)+Bc;return r.push(i),xe.addAll(r,this.pkgBlock.exportText(e)),r}};var dAt="EasyEDA Pro",d9e=class extends lf{exportText(){let t="";t+=this.addDate("JOB_NAME",this.checkName(this._jobName));let e=this._odbVersion.split(".");t+=this.addDate("ODB_VERSION_MAJOR",e[0]),t+=this.addDate("ODB_VERSION_MINOR",e[1]),t+=this.addDate("ODB_SOURCE",`${dAt} v${this._version}`);let r=pAt(new Date);return t+=this.addDate("CREATION_DATE",r),t+=this.addDate("SAVE_DATE",r),t+=this.addDate("SAVE_APP",""),t+=this.addDate("SAVE_USER",this._saveUser||""),t}addDate(t,e){return`${t}=${e}\r
`}set jobName(t){this._jobName=t}set version(t){this._version=t}set user(t){this._saveUser=t}set odbVersion(t){this._odbVersion=t}},Nse=class extends WI{constructor(){super("misc"),this.addChildFile(new d9e("info"))}getInfoFile(){return this.getChildFile("info")}};function pAt(o){function t(c){return c>=10?c:"0"+c}let e=new Date(o),r=e.getFullYear(),i=t(e.getMonth()+1),n=t(e.getDate()),s=t(e.getHours()),a=t(e.getMinutes()),l=t(e.getSeconds());return`${r}${i}${n}.${s}${a}${l}`}var fAt="v",mAt="t",kse=class extends lf{constructor(e){super(e);this.attrTableMap={};this.netListArr=[];this.attrTableBlock=new Yb,this.netListBlock=new Yb,this.netNum=0}getNetNumByNet(e){if(e||(e="$NONE$"),this.attrTableMap[e]!=null)return this.attrTableMap[e];let r=this.addNetNum();return this.attrTableMap[e]=r,this.attrTableBlock.addDataBlock(ma.create("$"+r,[e])),r}addNetNum(){return this.netNum++}addPad(e,r,i,n,s,a,l,c){let h=this.getNetNumByNet(e);this.netListArr[h]==null&&(this.netListArr[h]=[]);let u=[Vm.create(r),kc.create(i.x,i.y),this.getLayer(n)];r==0&&u.push(Vm.create(s),Vm.create(a)),u.push(this.getEpoint(l),this.getExp(),...this.getStaggerred()),l||u.push(fAt),c&&u.push(mAt);let d=ma.create(h.toString(),u);return this.netListArr[h].push(d),d}getLayer(e){switch(e){case 1:return"T";case 2:return"D";case 12:return"B";default:console.warn("layerId is error")}}getEpoint(e){return e?"e":"m"}getExp(){return"e"}getStaggerred(){return["staggered",0,0,0]}exportText(e){let r=[];xe.addAll(r,[this.addUnit2Doc(e)]);for(let i of this.netListArr)if(i)for(let n of i)this.netListBlock.addDataBlock(n);return xe.addAll(r,["H optimize N staggered N"+Bc]),xe.addAll(r,this.attrTableBlock.exportText(e)),xe.addAll(r,this.netListBlock.exportText(e)),r}};var gAt=`X_DATUM=0
Y_DATUM=0

TOP_ACTIVE=0
BOTTOM_ACTIVE=0
RIGHT_ACTIVE=0
LEFT_ACTIVE=0
ONLINE_DRC_NAME=
ONLINE_DRC_MODE=DISABLED
ONLINE_DRC_STAT=RED
ONLINE_DRC_TIME=0
ONLINE_DRC_BEEP_VOL=2
ONLINE_DRC_BEEP_TONE=500
ONLINE_NET_MODE=DISABLED
ONLINE_NET_STAT=RED
ONLINE_NET_TIME=0
ONLINE_NET_BEEP_VOL=2
ONLINE_NET_BEEP_TONE=1000`;var Bse=class extends lf{constructor(){super(...arguments);this.repeats=[]}addRepeats(e,r,i,n,s,a,l){let c=l.width()+i,h=l.height()+n,u=new S(0,0);for(let d=0;d<s;d++){let p=r.y+u.y+d*h;for(let m=0;m<a;m++){let g=r.x+u.x+m*c;this.repeats.push({NAME:e,X:Vm.create(g),Y:Vm.create(p),DX:Vm.create(c),DY:Vm.create(h),NX:1,NY:1,ANGLE:0,FLIP:"NO",MIRROR:"NO"})}}}exportText(e){let r=gAt.split(Bc),i=this.addUnit2Doc(e);for(let n=0;n<2;n++)i+=r[n]+Bc;for(let n of this.repeats)i+=this.exportObj("STEP-REPEAT",n,e);for(let n=2;n<r.length;n++)i+=r[n]+Bc;return i}exportObj(e,r,i){let n="";n=`${e} {${Bc}${s(r)}}${Bc}`;function s(a){let l="";for(let c in a){let h=a[c];typeof a[c]=="object"&&a[c].format&&(h=a[c].format(i)),l+=`    ${c}=${h}${Bc}`}return l}return n}};function p9e(o){var i;if(!o)return"";let t=(i=o.name)==null?void 0:i.replace(/ /g,"");switch(o.type){case"SIGNAL":case"PLANE":for(var e=15,r=1;e<=46;e++,r++)(o.layerID==e||o.layerId==e)&&(t="InnerLayer"+r);break;case"CUSTOM":for(var e=71,r=1;e<=270;e++,r++)(o.layerID==e||o.layerId==e)&&(t="CustomLayer"+r);break}return t}var yAt=(()=>{let o={};return oy.forEach(t=>{o[t.layerId]=t}),o})();function Fse(o){let t=yAt[o],e=p9e(t),r=new RegExp(/[A-Z]/,"g"),i,n="",s=0;for(;(i=r.exec(e))!=null;){let l=i.index;n+=e.slice(s,l);let c=e[l].toLowerCase();l!=0&&(n+="_"),n+=c,s=l+1}if(e[s]&&(n+=e.slice(s)),!n)throw new Error("Invalid layerId "+o);let a=`${n}`;return a=a.trim().replace(/\s+/g,"_"),a}function vHe(o){return`dielectric_${o-361+1}`}function w6(o,t,e=!0,r=!1,i=!1){let n=e?"pth":"npth",s=r&&i?"_via":"";if(o==1&&t==2||t==1&&o==2)return`drill_${n}_through${s}`;let a=pX.getLayer(o),l=pX.getLayer(t),c=p9e(a).replace("Layer","").toLowerCase(),h=p9e(l).replace("Layer","").toLowerCase(),u=c+"_to_"+h;return`drill_${n}_${u}`}function fX(o,t,e,r){let i="",n=o==58,s={Polyimide:"pi","Stainless Steel":"gp",Tape:"ps","EMI Shielding Film":n?"csa":"ssa"},a={"3M468":"3m468","3M9077":"3m9077",TESA8854:"tesa8854"};return n?i="top_stiffener_layer_"+s[t]+(t=="EMI Shielding Film"?"":"t")+"_"+(a[r]||e):i="bottom_stiffener_layer_"+s[t]+(t=="EMI Shielding Film"?"":"b")+"_"+(a[r]||e),i}var PAt=.001;var Vse=class{constructor(t){this.odbDocumentManage=new f9e(t)}async exportText(t,e,r,i,n,s){await this.odbDocumentManage.exportText(t,e,r,i,n,s)}get formate(){return this.odbDocumentManage.formate}set formate(t){this.odbDocumentManage.formate=t}get zip(){return this.odbDocumentManage.zip}set zip(t){this.odbDocumentManage.zip=t}get tarWriter(){return this.odbDocumentManage.tarWriter}set tarWriter(t){this.odbDocumentManage.tarWriter=t}get decimalPlaces(){return this.odbDocumentManage.decimalPlaces}set decimalPlaces(t){this.odbDocumentManage.decimalPlaces=t}get fileUuid(){return this.odbDocumentManage.fileUuid}set fileUuid(t){this.odbDocumentManage.fileUuid=t}get job(){return this.odbDocumentManage.job}get userUuid(){return this.odbDocumentManage.userUuid}set userUuid(t){this.odbDocumentManage.userUuid=t}set odbVersion(t){this.odbDocumentManage.exportVerSion=t}getMatrixLayerNames(){return this.odbDocumentManage.getMatrixLayerNames()}getStepNames(){return this.odbDocumentManage.getStepNames()}isTest(){this.odbDocumentManage.setSplitVia(!0)}},f9e=class{constructor(t){this.splitVia=!1;this._decimalPlaces=LA;this.fileUuid="";this.userUuid="";this.comps=new Rl;this.featureRecode={};this.dcode=0;this.symbolNum=0;this._formate=new zR;this.stackUpMap=new Set;this.useCircleInsteadOfSquareDrill=!0;this.modelHandle=new ZF(this),this.documentMap=new Rl,this.drillDocumentMap=new Rl,this.fpcDocumentMap=new Rl,this.job=new WI(t||"job");let e=this.job.generateChildFolder("fonts");this.job.generateChildFolder("input"),this.matrix=this.job.generateChildFolder("matrix"),this.steps=this.job.generateChildFolder("steps"),this.symbols=this.job.generateChildFolder("symbols"),this.job.generateChildFolder("user"),e.addChildFile(new Ase("standard",SHe)),this.addStep("pcb")}get formate(){return this._formate}set formate(t){this._formate=t}get zip(){return this._zip}set zip(t){this._zip=t}get tarWriter(){return this._tarWriter}set tarWriter(t){this._tarWriter=t}get decimalPlaces(){return this._decimalPlaces}set decimalPlaces(t){this._decimalPlaces=t}get exportVerSion(){return this._exportVerSion}set exportVerSion(t){switch(this._exportVerSion=t,t){case"8.1":this.isV8=!0;break;default:this.isV8=!1}}setSplitVia(t){return this.splitVia=t}addStep(t){let e=this.steps.generateChildFolder(t);this.step=e,this.layers=e.generateChildFolder("layers"),this.addLayers(this.documentMap),this.addLayers(this.drillDocumentMap),this.addLayers(this.fpcDocumentMap),this.addLayers(this.comps),this.rout&&this.layers.addChildFolder(this.rout),this.outline=new zI("profile"),e.addChildFile(this.outline),e.addChildFile(new Bse("stephdr")),this.drillTool=new _se}addLayers(t){t.iterator((e,r)=>(this.layers.addChildFolder(r),!0))}clearStep(){var t;this.documentMap=this.clone(this.documentMap),this.drillDocumentMap=this.clone(this.drillDocumentMap),this.fpcDocumentMap=this.clone(this.fpcDocumentMap),this.comps=this.clone(this.comps),this.rout=(t=this.rout)==null?void 0:t.clone()}clone(t){let e=new Rl;return t.iterator((r,i)=>(e.put(r,i.clone()),!0)),e}async exportText(t,e,r,i,n,s){this.mainVersion=i,this.objectConfigs=r,this.defaultParam=n;let a=!this.defaultParam.onlyOutline&&this.defaultParam.success;this.createDocumentMap(e),await this.progressUpdate(.25);let l=new S(0,0).sub(this.modelHandle.getEnvironmentOrigin()),c=this.modelHandle.outLineHandle();if(this.createPanelize(l,this.defaultParam.onlyOutline),await this.progressUpdate(.3),a){this.step.getChildFile("stephdr").addRepeats("edit",l,this.defaultParam.columnSpacing,this.defaultParam.rowSpacing,this.defaultParam.row,this.defaultParam.column,this.defaultParam.singleBBox);let m=this.defaultParam.outerBBox.transform(Qe.translate1(l));this.setOutline(m),this.clearStep(),this.addStep("edit")}this.parseOutLinePolyLine(c.lines,l,c.boardLines),await this.generateElement(l),this.updateZip(this.job),await this.progressUpdate(.6),this.setNetListFolder(),this.setEdaDateFolder(),this.recordTrackAndViaNet(l),this.recordFootprint(l),this.addLayers(this.comps),await this.progressUpdate(.8);let h=t&&t.includes("PTH"),u=t&&t.includes("NPTH");(!h||!u)&&this.drillDocumentMap.iterator((p,m)=>{let g=m.plated;return!h&&g&&(m.parent.deleteFolder(m.name),this.drillDocumentMap.del(p)),!u&&!g&&(m.parent.deleteFolder(m.name),this.drillDocumentMap.del(p)),!0});let d=this.modelHandle.getStackupInfo();return this.createStackup(d),this.createMatrix(d),this.addMiscInfo(s),this.updateZip(this.job),await this.progressUpdate(.9),!0}updateOtherZip(){let t=this.step.getChildFolder("netlists"),e=this.step.getChildFolder("eda"),r=this.job.getChildFolder("matrix"),i=this.job.getChildFolder("misc"),n=[t,e];for(let s of this.stackUpMap){let a=this.layers.getChildFolder(s);n.push(a)}this.comps.iterator((s,a)=>(n.push(a),!0)),n.push(r,i);for(let s of n)this.updateZip(s)}updateZip(t){var r;let e=[t];for(;e.length>0;){let i=e.shift(),n=this.getZipFileName(i),s=n;i.hasZipFile||((r=this._zip)==null||r.folder(s),i.hasZipFile=!0);let a=i.getAllChidFiles();for(let c of a){let h=n+`/${c.name}`;if(!c.hasZipFile){let u=c.exportText(this.formate);if(this._tarWriter){let d="";Array.isArray(u)?d=u.join(Bc):d=u,this._tarWriter.addTextFile(h,d)}else Array.isArray(u)?this._zip.file(h,new Blob(u,{type:"text/plain;charset=utf-8"})):this._zip.file(h,u);c instanceof zI&&c.deleteBlock(),c.hasZipFile=!0}}let l=i.getAllChildFolder();for(let c of l)e.push(c)}}getZipFileName(t){let e=[t],r=[];for(;e.length;){let i=e.shift();i.parent&&e.push(i.parent),r.unshift(i.name)}return r.join("/")}createStackup(t){if(!this.isV8)return;let e="SUBSTRATE";for(let r of t){let i=r.layerId;if(i>=361){let n=vHe(i),s=new NA(n,e);this.documentMap.put(i,s),this.layers.addChildFolder(s),this.stackUpMap.add(n)}}}addMiscInfo(t){let e=new Nse,r=e.getInfoFile();r.jobName=t,r.version=this.mainVersion,r.user="",r.odbVersion=this._exportVerSion,this.job.addChildFolder(e)}async progressUpdate(t){he.publish("progressUpdate",[t,"Export ODB++..."],Q()),await new Promise(e=>{setTimeout(e,30)})}createPanelize(t,e){this.modelHandle.createPanelize(t,e)}setOutline(t){let e=ge.build4([t.LL(),t.LR(),t.UR(),t.UL()]);this.outline.dcode=0,this.outline.polygonsConvert([{line:e}])}parseOutLinePolyLine(t,e,r){let i=this.getLayerDocument(11);if(i){let n=Qe.translate1(e);if(t.forEach(s=>{let l=s.pl.multiply3(n);if(i.parent instanceof J3&&!l.isClose(PAt)){let h=l.primitives;this.modelHandle.addDrillPrimitives(h,s.strokeWidth);return}this.addPolyLineToDocByDoc(i,s.strokeWidth,[l],this.addDcode())}),r){let s=this.addDcode();r.forEach(a=>{a.pl.forEach(l=>{let c=l.multiply3(n);this.addPrimitivesToDocByDoc(i,c,a.strokeWidth,s)})})}}}async generateElement(t){this.generateOutLine(t),this.generateCopper(t),this.generatePlaneZone(t),this.generateImage(t),this.generateDrillImage(t),await this.progressUpdate(.4),this.generateText(t),this.generatePolygonModel(t),this.generateRect(t),this.generateCircle(t),this.generateDimension(t),this.generateTear(t),this.generatePad(t),await this.progressUpdate(.5),this.generateVia(t),this.generateTrack(t)}generateCopper(t){this.objectConfigs.includes("CopperFilled")&&this.modelHandle.generateCopper(t)}addPolygonsToDoc(t,e,r){let i=this.getLayerDocument(t);i&&(i.dcode=this.getDcode(),r&&this.setFeatureRecode(r,i),i.polygonsConvert(e))}addPolyLineToDoc(t,e,r,i,n){let s=this.getLayerDocument(t);if(s){let a=s.getApertureCircle(e);s.dcode=i==null?this.getDcode():i,this.polylineConvert(s,r,a,void 0,n)}}addPrimitivesToDoc(t,e,r){let i=this.getLayerDocument(t);if(i){i.dcode=this.getDcode();let n=i.getApertureCircle(r);i.primitiveConvert(e,n)}}addPrimitivesToDocByDoc(t,e,r,i){t.dcode=i==null?this.getDcode():i;let n=t.getApertureCircle(r);t.primitiveConvert(e,n)}addPolyLineToDocByDoc(t,e,r,i){let n=t.getApertureCircle(e);t.dcode=i==null?this.getDcode():i,this.polylineConvert(t,r,n)}addPolygonsToDocByDoc(t,e){t.dcode=this.getDcode(),t.polygonsConvert(e)}addPadToDocByDoc(t,e,r,i,n,s,a=!1){t.dcode=this.getDcode(),this.setFeatureRecode(e,t);let l=t.PadConvert(r,i,n?0:this.toDegrees(s),a);t.addPadUsageParameter(l,!0)}addLineConvert(t,e,r,i,n){t.dcode=this.getDcode();let s=t.getApertureCircle(e);this.setFeatureRecode(r,t),t.lineConvert(i,n,s)}addArcConvert(t,e,r,i,n,s,a,l,c){t.dcode=this.getDcode();let h=t.getApertureCircle(e);this.setFeatureRecode(r,t),t.ArcConvert(i,n,s,h,a,l,c)}addSymbolDoc(t,e){let r="symbol"+this.addSymbolName(),i=new zI("features"),n=this.symbols.generateChildFolder(r);return i.polygonsConvert([{line:t}]),n.addChildFile(i),e.getSymbolNameByDoc(n)}generatePlaneZone(t){this.objectConfigs.includes("PlaneZone")&&this.modelHandle.generatePlaneZone(t)}generateImage(t){this.modelHandle.generateImage(t)}parseGroupLine(t,e){let r=this.getLayerDocument(t);if(!r)return;this.splitPolylineArr(e).forEach(n=>{let s=[];this.checkGerberPolyline(n),n.forEach((a,l)=>{let c=a.pl;s.push({line:c,fill:a.flag})}),r.dcode=this.addDcode(),r.polygonsConvert(s)})}parsePolyGroup(t,e){let r=[];e=e.getOutMostPolyline().area()>0?new Bt(e.items.map(n=>n.reverse())):e,e.items.forEach(n=>{r.push({line:n,fill:n.area(.1)<0})}),t.dcode=this.addDcode(),t.polygonsConvert(r)}splitPolylineArr(t){let e=[],r=[];for(let i of t)i.order==0?(r=[i],e.push(r)):i.order>0&&r.push(i);return e}checkGerberPolyline(t){for(let e of t){let r=[],i=e.pl.primitives;for(let n of i){if(n instanceof q||n instanceof M)r.push(n);else{let s=n.points(.1);r.push(...ge.build4(s).primitives)}e.pl=ge.build2(r)}}}isSilkLayer(t){return!![3,4].includes(t)}generateDrillImage(t){let e=56,r=.1;this.getDrillDrawingLayerSymbol().forEach(i=>{let n=this.getLayerDocument(e);if(!n)return;n.dcode=this.addDcode();let s=this.getPath(i),a=[];for(let l of s)l.pl=l.pl.multiply3(Qe.translate1(t)),a.push(l);if(i.text!=null){let l=n.getApertureCircle(r);for(let c of a){let h=c.pl;h instanceof ge&&this.polylineConvert(n,[h],l)}return}this.parseGroupLine(e,a)})}polylineConvert(t,e,r,i=!0,n){e.forEach(s=>{s.primitives.forEach(l=>{n&&this.setFeatureRecode(n,t),t.primitiveConvert(l,r,i)})})}getPath(t){let e,r;return t.image&&(e=new wf("",0,t.image),r=e.pls,r.forEach(i=>{i.pl=i.pl.multiply3(t.matrixImage)})),t.text&&(e=new wf("",0,t.text),r=e.pls,r.forEach(i=>{i.pl=i.pl.multiply3(t.matrixText)})),r}getDrillDrawingLayerSymbol(){let t=cX("gerber");if(t==null)return[];let e=1.57;return t.reduce((r,i)=>{let{position:n,text:s,image:a}=i;if(a!=null){let l=new _e;a.forEach(d=>{l.ext1(d.bbox())});let c=l.build1(),h=c.center(),u=Qe.translate(-h.x,-h.y).scale(e/c.width()).translate1(n);r.push({matrixImage:u,image:a})}if(s!=null){let l=this.modelHandle.getPcbTextOutline(s),{center:c,width:h,height:u}=this.getPolyLinesCenterAndWH(...l),d=Qe.translate(-c.x,-c.y).scale(e/Math.max(h,u)/1.8).translate1(n);r.push({matrixText:d,text:l,content:s})}return r},[])}getPolyLinesCenterAndWH(...t){console.time("calculate polyline center");let[e,r,i,n]=[1/0,1/0,-1/0,-1/0];for(let c of t)for(let h of c.primitives){let[u,d,p,m]=[h.start().x,h.end().x,h.start().y,h.end().y];e=Math.min(u,d,e),i=Math.max(u,d,i),r=Math.min(p,m,r),n=Math.max(p,m,n)}let s=new S((e+i)/2||0,(r+n)/2||0),a=Math.abs(i-e),l=Math.abs(n-r);return console.timeEnd("calculate polyline center"),{center:s,width:a,height:l}}generateText(t){this.modelHandle.generateText(t)}generatePolygonModel(t){this.modelHandle.generatePolygonModel(t)}filterObject(){let t=[];return(this.objectConfigs||[]).forEach(e=>{e==="BoardOutline"?t.push("Board Outline"):e==="BoardCutout"?t.push("Slot Region"):e==="CopperOutline"||e==="CopperFilled"?t.push("Copper Region"):e==="SolidRegion"?t.push("Fill Region"):e==="ProhibitedRegion"?t.push("Prohibited Region"):e==="Line"?t.push("Line"):e==="FPCStiffener"&&t.push("FPC Stiffener")}),this.objectConfigs||(t=null),t}generateRect(t){this.modelHandle.generateRect(t)}generateCircle(t){this.modelHandle.generateCircle(t)}getFPCDocument(t,e,r,i){let n=fX(t,e,r,i),s=this.fpcDocumentMap.get(n);if(!s){let a=this.modelHandle.getLayerType(t);s=new NA(n,a),this.fpcDocumentMap.put(n,s),this.layers.addChildFolder(s)}return s==null?void 0:s.getFeatureDoc()}generateDimension(t){this.objectConfigs.includes("Dimension")&&this.modelHandle.generateDimension(t)}generateTear(t){this.objectConfigs.includes("TearDrop")&&this.modelHandle.generateTear(t)}generatePad(t){this.objectConfigs.includes("Pad")&&this.modelHandle.generatePad(t)}addDrillArc(t,e,r,i,n,s,a,l,c,h,u,d){let p=i*2,m=this.getDrillFolder(e,r,d);if(!m)return;let g=m.getLayerDocument(),b=m.getToolDocument(this.drillTool,this.formate).addTool(p,u,d);g.dcode=b;let P=g.getApertureCircle(p);this.setFeatureRecode(t,g),g.ArcConvert(n,s,a,P,l,c,h).forEach(I=>{g.addDrillParameter(I,u,d)})}addDrillCircle(t,e,r,i,n,s,a,l=!1){let c=i*2,h=this.getDrillFolder(e,r,a,l);if(!h)return;let u=h.getLayerDocument(),p=h.getToolDocument(this.drillTool,this.formate).addTool(c,s,a);u.dcode=p;let m=u.getApertureCircle(c);this.setFeatureRecode(t,u);let g=u.PadConvert(n,m,0);u.addDrillParameter(g,s,a)}addDrillLine(t,e,r,i,n,s,a,l){let c=i*2,h=this.getDrillFolder(e,r,l);if(!h)return;let u=h.getLayerDocument(),p=h.getToolDocument(this.drillTool,this.formate).addTool(c,a,l);u.dcode=p;let m=u.getApertureCircle(c);this.setFeatureRecode(t,u);let g=u.lineConvert(n,s,m);u.addDrillParameter(g,a,l)}addDrillLine2Route(t,e,r,i,n,s){let a=e*2,l=this.rout;if(!l)return;let c=l.getLayerDocument(),u=l.getToolDocument(this.drillTool,this.formate).addTool(a,n,s);c.dcode=u;let d=c.getApertureCircle(a);this.setFeatureRecode(t,c);let p=c.lineConvert(r,i,d);c.addDrillParameter(p,n,s)}addDrillCircle2Route(t,e,r,i,n){let s=e*2,a=this.rout;if(!a)return;let l=a.getLayerDocument(),h=a.getToolDocument(this.drillTool,this.formate).addTool(s,i,n);l.dcode=h;let u=l.getApertureCircle(s);this.setFeatureRecode(t,l);let d=l.PadConvert(r,u,0);l.addDrillParameter(d,i,n)}toDegrees(t){return zt.regularD(zt.toDegrees(t))}generateVia(t){this.objectConfigs.includes("Via")&&this.modelHandle.generateVia(t)}generateTrack(t){this.objectConfigs.includes("Track")&&this.modelHandle.generateTrack(t)}addViaShapeToDoc(t,e,r,i){let n=this.getLayerDocument(e);if(!n)return;let s=n.getApertureCircle(i*2);if(s==null)return;n.dcode=this.addDcode(),this.setFeatureRecode(t,n);let a=n.PadConvert(r,s,0);n.addPadUsageParameter(a,!1)}addDcode(){return this.dcode++,this.dcode}addSymbolName(){return this.symbolNum++}getDcode(){return this.dcode}getLayerDocument(t){var e,r;return t==11?(e=this.rout)==null?void 0:e.getLayerDocument():(r=this.documentMap.get(t))==null?void 0:r.getFeatureDoc()}generateOutLine(t){if(!this.objectConfigs.includes("BoardOutline"))return;let e=this.modelHandle.generateOutLine(t);e&&(this.outline.dcode=0,this.outline.polygonsConvert(e))}circleToLine(t,e){let r=new S(t.x-e,t.y),i=new S(t.x+e,t.y),n=q.build4(r,i,t,e,e,ae.CCW),s=q.build4(i,r,t,e,e,ae.CCW);return ge.build2([n,s]).asClose()}createDocumentMap(t){for(let{layerId:e,isMirror:r}of t){if(e==58||e==59)continue;let i=this.modelHandle.getLayerType(e),n=Fse(e);if(e==11){this.rout=new J3(n),this.layers.addChildFolder(this.rout);continue}let s=new NA(n,i);this.documentMap.put(e,s),this.layers.addChildFolder(s)}}createMatrix(t){let e=Object.assign({},this.documentMap.origin()),r=Object.assign({},this.fpcDocumentMap.origin()),i=Object.assign({},this.drillDocumentMap.origin()),n=Object.assign({},this.comps.origin()),s=new Lse("matrix");this.matrix.addChildFile(s),s.setStep(this.steps.getAllChildFolder()),this.isV8&&s.addSortPhy(t),s.setLayer(e,i,this.rout,n,r)}getMatrixLayerNames(){return this.matrix.getChildFile("matrix").getLayerNames()}getStepNames(){return this.matrix.getChildFile("matrix").getStepNames()}getDrillFolder(t,e,r=!0,i=!1){var a,l;let n=(a=this.documentMap.get(t))==null?void 0:a.name,s=(l=this.documentMap.get(e))==null?void 0:l.name;if(n&&s){let c=this.getDrillMapName(t,e,r,i),h=this.drillDocumentMap.get(c);return h||(h=this.drillDocumentMap.get(this.getDrillMapName(e,t,r,i))),h||(h=this.generateDrillFolder(t,e,r,i)),h}return null}getDrillMapName(t,e,r=!0,i=!1){var c,h;let n=r?"pth":"npth",s=i&&this.splitVia?"-via":"",a=(c=this.documentMap.get(t))==null?void 0:c.name,l=(h=this.documentMap.get(e))==null?void 0:h.name;return a&&l?`${n}-${a}-${l}${s}`:null}generateDrillFolder(t,e,r=!0,i=!1){var a,l;let n=(a=this.documentMap.get(t))==null?void 0:a.name,s=(l=this.documentMap.get(e))==null?void 0:l.name;if(n&&s){let c=this.getDrillMapName(t,e,r,i),h=w6(t,e,r,i,this.splitVia),u=new MA(h);return u.startLayerName=n,u.endLayerName=s,u.plated=r,this.drillDocumentMap.put(c,u),this.layers.addChildFolder(u),u}return null}recordTrackAndViaNet(t){let e=this.modelHandle.getTrackNetData();for(let s of e)this.edaData.addTrack(this.getFeatureRecode(s.globalIndex),s.net);let r=this.modelHandle.getViaData();for(let s of r){let a=s.center.multiply3(Qe.translate1(t)),l=s.bbox;this.cadnet.addPad(s.net,s.holeRadius,a,s.layerId,l.width(),l.height(),!1,!1),this.edaData.addVia(this.getFeatureRecode(s.globalIndex),s.net)}let i=this.modelHandle.getCopperData();for(let s of i){let a=this.getFeatureRecode(s.globalIndex);a&&this.edaData.addPlane(a,s.net)}let n=this.modelHandle.getPlaneData();for(let s of n){let a=this.getFeatureRecode(s.globalIndex);a&&this.edaData.addPlane(a,s.net)}}setNetListFolder(){let r=this.step.generateChildFolder("netlists").generateChildFolder("cadnet");this.cadnet=r.addChildFile(new kse("netlist"))}setEdaDateFolder(){let e=this.step.generateChildFolder("eda");this.edaData=e.addChildFile(new Mse);let r=Object.assign({},this.documentMap.origin()),i=Object.assign({},this.drillDocumentMap.origin());this.edaData.setLayer(r,i),this.edaData.setNetList(this.cadnet)}recordFootprint(t){var n,s,a;let{map:e,footMap:r}=this.modelHandle.getCompData(),i=Qe.translate1(t);for(let l of e){let c=l.layerId,h=l.pads,u=this.getComponent(c),d=zt.regularD(zt.toDegrees(l.rotation));c==2&&(d=zt.transformD(d,Qe.MIRROR_X)),d=zt.regularD(360-d);let p=l.designator,m=((s=(n=l.attrs)==null?void 0:n.Device)==null?void 0:s.value)||l.footprintId,g=u.getNextCompNum(),y=l.footprintUUID,b=this.addFootprint(r.get(y),l.footprintId,l.footprintUUID),P=l.attrMap;u.addComp(b,l.position.multiply3(i),d,!1,p,m);let T=l.attrs;for(let E in T){if(E=="Value"||E=="Comment")continue;let O=T[E];u.addProperty(E,O.value)}P.FootprintId=l.footprintUUID;let I=(a=P.Name)==null?void 0:a.slice(2,-1),C=P[I];u.addProperty("Comment",C),u.addProperty("Value",P.Value);for(let E of h){let O=u.getNextPinNum(),_=this.edaData.addPad(this.getFeatureRecode(E.globalIndex),E.net,c,g,O);if(_){let{netNum:x,subNetNum:v}=_,D=E.center;u.addPad(E,x,v,t,d,D)}}}}addFootprint(t,e,r){if(this.edaData.getPkg(r)!=null)return this.edaData.getPkg(r);let i=null,n=S.ORIGIN;t.pads.forEach(l=>{let c=n.distance1(l.center);(i==null||i>c)&&(i=c)}),i==null&&(i=0);let s=t.bbox,a=this.edaData.addPkg(e,i,s,r);return t.pads.forEach(l=>{let{center:c}=l,h=c;if(l.layerId==12){this.edaData.addPin(l.num,l.layerId,h);let{holeRadius:u}=l;this.edaData.addPinCircle(h,u)}else{let u;switch(l.layerId==1?u=l.top:u=l.bottom,u.type){case"ELLIPSE":{this.edaData.addPin(l.num,l.layerId,h);let d=u.width/2;this.edaData.addPinCircle(h,d);break}default:{let d=l.center;this.edaData.addPin(l.num,l.layerId,d);let m=l.polyline;this.edaData.addPinPolygon(m);break}}}}),a}getComponent(t){let e="";switch(t){case 1:e="comp_+_top";break;case 2:e="comp_+_bot";break}if(this.comps.get(e)==null){let r=new JF(e);this.comps.put(e,r),r.addComponentFile(this.cadnet),this.layers.addChildFolder(r)}return this.comps.get(e).getComponentFile()}setFeatureRecode(t,e){let r=e.getFeatureRecord(),i=e.parent.name;this.featureRecode[t]==null&&(this.featureRecode[t]=[]),this.featureRecode[t].push({layerName:i,record:r})}getFeatureRecode(t){return this.featureRecode[t]}};var Gse=class{constructor(){this.layersName=[]}setLayersName(t){this.layersName=t}setSteps(t){this.steps=t}exportText(){let t={IsOdb:!0,isGerber:!1,ODBLayers:this.layersName.join(","),CompareOdbStepNames:this.steps};return JSON.stringify(t,void 0,4)}};var DHe=Ru(YR());function g9e(o){return new Promise(async(t,e)=>{Cn("generateOdb-time"),o=await TAt(o);let{title:i,fileUuid:n,userUuid:s,language:a,fileName:l,unit:c,format:h,silk:u,drillMap:d,drillTable:p,layerConfigs:m,objectConfigs:g,mainVersion:y,isTestExport:b,odbVersion:P,isZip:T}=o,I=new Vse;if(I.fileUuid=n,I.userUuid=s,I.decimalPlaces=h?h.Decimals:LA,I.odbVersion=P,p)m.some(_=>_.layerId==56)||m.push({layerId:56});else if(m){let _=m.findIndex(x=>x.layerId==56);_>-1&&m.splice(_,1)}let C=ZF.getDefaultPanelize();if(T){let _=new DHe.default;I.zip=_}else I.tarWriter=new Tse;let E=new zR;E.unit=c=="MM"?"MM":"INCH",E.decimal=I.decimalPlaces,I.formate=E,await I.exportText(d,m,g,y,C,i).catch(_=>{throw e(_),_});let O=I.tarWriter?await new Use().downLoad(I.tarWriter):await new Use().downLoadZip(I.zip);if(b&&o.exportConfig){let _=new Gse;_.setLayersName(I.getMatrixLayerNames()),_.setSteps(I.getStepNames());let x=_.exportText();t({fileName:l,jsonFile:x,blob:O.blob});return}t({fileName:l,blob:O.blob})})}async function TAt(o){var p;o||(o={});let{title:t,fileUuid:e,userUuid:r,fileName:i,unit:n,drillMap:s,drillTable:a,layerConfigs:l,objectConfigs:c,mainVersion:h,isTestExport:u,format:d}=o;if(t||(o.title=`odb++_pcb_${L6(new Date,"yyyy_MM_dd")}.tgz`),i||(o.fileName=`odb++_pcb_${L6(new Date,"yyyy_MM_dd")}.tgz`),!l){o.layerConfigs=[];let m=(await he.messageBus.rpcCall("gerberLayerConfig")).message;for(let g of m){let{layerId:y,status:b}=g;b!==0&&o.layerConfigs.push({layerId:y})}}if(s||(o.drillMap=["PTH","NPTH"]),a==null&&(o.drillTable=!0),!c){o.objectConfigs=[];for(let m of y9e)o.objectConfigs.push(m.value)}return h||(o.mainVersion=((p=document.querySelector('meta[name="editorMainVersion"]'))==null?void 0:p.getAttribute("content"))||""),n||(o.unit="IN"),u==null&&(o.isTestExport=!1),u?(d||(o.format={Integer:2,Decimals:6}),await ep.loadTextSuccess()):o.format={Integer:3,Decimals:9},o.odbVersion||(o.odbVersion="8.1"),o}var y9e=[{name:"Pad",value:"Pad"},{name:"Via",value:"Via"},{name:"Track",value:"Track"},{name:"Text",value:"Text"},{name:"Image",value:"Image"},{name:"Dimension",value:"Dimension"},{name:"Board Outline",value:"BoardOutline"},{name:"Slot Region",value:"BoardCutout"},{name:"Copper Region(Filled)",value:"CopperFilled"},{name:"Fill Region",value:"SolidRegion"},{name:"FPC Stiffener",value:"FPCStiffener"},{name:"Line",value:"Line"},{name:"Plane Zone",value:"PlaneZone"},{name:"Component Property",value:"ComponentProperty"},{name:"Component Silkscreen",value:"ComponentSilkscreen"},{name:"TearDrop",value:"TearDrop"}],Use=class{downLoad(t){return new Promise(e=>{t.write().then(r=>{let i=RHe.default.gzip(r),n=new Blob([i],{type:"application/x-gzip"});e({blob:n})})})}downLoadZip(t){return new Promise(e=>{t.generateAsync({type:"blob"}).then(function(r){Xi("generateOdb-time"),e({blob:r})})})}};function L6(o,t){if(!o||Object.prototype.toString.call(o)!="[object Date]")return;function e(i,n){let s=-Math.round(i.getTimezoneOffset()/15)*15,a=~~(s/60),l=~~s%60,c="+";return s<0&&(c="-"),c+("00"+a).slice(-2)+n+("00"+l).slice(-2)}let r={"M+":o.getMonth()+1,"d+":o.getDate(),"h+":o.getHours(),"m+":o.getMinutes(),"s+":o.getSeconds(),S:o.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(/y+/,i=>(o.getFullYear()+"").slice(i.length==2?-2:0))),/(Z+)/.test(t)&&(t=t.replace(/Z+/,i=>e(o,i.length==1?":":"")));for(let i of Object.keys(r)){let n=new RegExp(i);n.test(t)&&(t=t.replace(n,s=>s.length==1?r[i]:("00"+r[i]).slice(-2)))}return t}var mX=class{constructor(){this.fanoutItems=new Set;this.all=new Set}getHasFanoutIds(t){let e=[],r=this.getAllPad(t);for(let i of r){let n=i.searchNode();this.hasTrackOrVia(n)&&e.push(i)}return e.map(i=>i.globalIndex)}fanoutRemove(t){let e=this.getAllPad(t);for(let i of e)this.all.add(i);for(let i of e)this.findFanout(i);let r=new hi;r.addGroup(new De("fanout remove"));for(let i of this.fanoutItems)r.addCommand4Item(i,"delete"),he.publish("delete",i),he.publish("hasModifyPcbItem",i),i.remove();r.execute()}findFanout(t){let e=t.searchNode();if(!this.hasTrackOrVia(e))return;let r=this.filterItems(e);for(r.forEach(i=>this.all.add(i));r.length;){let i=r.shift(),n=i.searchNode();this.filterItems(n).forEach(s=>{this.all.has(s)||r.push(s),this.all.add(s)}),this.hasTrackOrVia([i])&&this.fanoutItems.add(i)}}hasTrackOrVia(t){return!!t.some(e=>e instanceof Ge||e instanceof Ue)}filterItems(t){let e=[];for(let r of t)if(!this.all.has(r)){if(r instanceof Le)return[];(r instanceof Ge||r instanceof Ue||r instanceof He&&(r.type==="Fill Region"||r.type==="Line"))&&e.push(r)}return e}getAllPad(t){let e=new Set,r=new Set;for(let i of t)i instanceof Le?r.add(i):i instanceof ke&&i.getPads().forEach(n=>r.add(n)),e.add(i);return r}};var sYn={Component:"icon-eda-symbol",Group:"icon-eda-group","Copper Region":"icon-eda-region-copper",Track:"icon-eda-wire","Board Outline":"icon-eda-board-outline","Slot Region":"icon-eda-region-slot","Fill Region":"icon-eda-region-fill","Prohibited Region":"icon-eda-region-prohibited","Constraint Region":"icon-eda-region-constraint",Line:"icon-eda-line",Text:"icon-eda-text","3D Shell - Outline":"icon-eda-3dshell-outline","3D Shell - Screw Pillar":"icon-eda-3dshell-screw-pillar","3D Shell - Side Datum Line":"icon-eda-3dshell-datum-line","3D Shell - Side Slot Region":"icon-eda-3dshell-side-region-slot","3D Shell - Top/Bottom Slot Region":"icon-eda-3dshell-top-region-slot","3D Shell - Side Entity":"icon-eda-3dshell-side-entity","3D Shell - Top/Bottom Entity":"icon-eda-3dshell-top-entity",Image:"icon-eda-image","Colorful Image":"icon-eda-image",Dimension:"icon-eda-dimension",Pad:"icon-eda-pad","Test Point":"icon-eda-point-test","FPC Stiffener":"icon-eda-fpc-stiffener",Via:"icon-eda-via",NetClass:"icon-eda-class-track",Differential:"icon-eda-routing-differential",EqualLengthGroup:"icon-eda-routing-tuning",Designator:"icon-eda-symbol",Device:"icon-eda-device",Footprint:"icon-eda-footprint",Teardrop:"icon-eda-teardrop",ColorBox:"tree-node-color-box"};var kYn=["Component","Group","Copper Region","Pad","Via","Test Point","Track","Board Outline","Slot Region","Fill Region","Prohibited Region","Constraint Region","Line","FPC Stiffener","3D Shell - Outline","3D Shell - Screw Pillar","3D Shell - Side Datum Line","3D Shell - Side Slot Region","3D Shell - Top/Bottom Slot Region","3D Shell - Side Entity","3D Shell - Top/Bottom Entity","Text","Image","Colorful Image","Dimension","Teardrop"];function b9e(o){return o instanceof ke?"Component":o instanceof qc?"Group":o instanceof Ge&&!o.key&&!o.getParent()?"Track":o instanceof Mn?"Image":o instanceof lr?o.key&&o.getParent()?"Component Property":"Text":o instanceof qs||o instanceof Ga||o instanceof da?"Dimension":o.type=="Line"&&!(o.getParent()&&o.getParent()instanceof ke)?"Line":o.type=="Prohibited Region"?"Prohibited Region":o.type=="Board Outline"?"Board Outline":o.type=="Copper Region"?"Copper Region":o.type=="Slot Region"?"Slot Region":o.type=="Fill Region"&&!(o.getParent()&&o.getParent()instanceof ke)?"Fill Region":o instanceof Le?o.isTestPad?ar(o.layerId)?"TH Test Point":"SMD Test Point":ar(o.layerId)?"TH Pad":"SMD Pad":o instanceof Ue?"Via":""}var Q3=ka.getInstance(),P9e=class{checkConnect(){let t=Q3.isCheck(Q3.connect.checkFreeCopper),e=Q3.isCheck(Q3.connect.checkFreeTrack),r=Q3.isCheck(Q3.connect.checkFreeFillRegion),i=Q3.isCheck(Q3.connect.checkFreeLine),n=Q3.isCheck(Q3.connect.sameNetNotConnect),s=Ti.getAllItem(),a=zn.getAllItem();if(t){let c=new Set;s.forEach(h=>{c.add(h.net)}),a.forEach(h=>{c.add(h.net)});for(let h of c){let u=uS(h);for(let d of u){let p=!1,m=[],g=[];for(let y of d)Ti.getItem(y)!=null?m.push(Ti.getItem(y)):zn.getItem(y)!=null&&g.push(zn.getItem(y));if(m.length===d.size)for(let y of m){let b=y.buildBBox();Bo.addConnectError(b.center(),"Common",y.globalIndex,"Copper Region(Filled)",y.net,!0,[y.layerId])}else if(g.length===d.size)for(let y of g){let b=y.buildBBox();Bo.addConnectError(b.center(),"Common",y.globalIndex,"Plane Zone",y.net,!0,[y.layerId])}}}}let l=new Set;Ye.getAllNets().forEach(c=>{let h=Wo.getRatlineByNetName(c)||[];if(h.forEach(u=>{!u.startNode.isEmpty&&!u.endNode.isEmpty&&(l.add(u.startNode),l.add(u.endNode))}),h.length==0){let u=Ye.getSameNetItems(c);if(this.isFreeItems(u)){let d=[],p=[],m=[];u.forEach(g=>{if(g instanceof Ge)e&&d.push(g);else if(g instanceof He)switch(g.type){case"Fill Region":r&&!g.getComponent().isBridgingCopper&&m.push(g);break;case"Line":i&&p.push(g);break}}),this.addFreeItemError(d,c),this.addFreeItemError(p,c),this.addFreeItemError(m,c)}}}),this.checkBridgingCopperConnects(),n&&l.forEach(c=>{if(c instanceof Ls){let h=c.buildBBox(),u=c instanceof Ue?ei.getMultiShapeEffectLayers(c.model):[c.layerId];Bo.addConnectError(h.center(),"Common",c.globalIndex,b9e(c),Ao(c)||"",!1,u)}})}checkBridgingCopperConnects(){var i,n;let t=mS().filter(s=>s.type==="Fill Region"&&s.component instanceof Zi&&s.component.isBridgingCopper),e=new FI,r=[];for(let s of t){let a=(i=s.component)==null?void 0:i.networkList;if(!a||a.length===0)continue;let l=s.buildBBox(),c=jc.getCache(s.model,s.layerId);for(let h of a){let u=Ye.getSameNetItems(h).filter(m=>!ei.isBridgingCopper(m.model));if(!u||u.length==0)continue;if(u.every(m=>{let g=m.buildBBox();return l.isSeparated(g)})){let m=Bo.addConnectError(l.center(),"No Contact",s.globalIndex,"Bridging Copper",h,!1,[s.layerId]);r.push(m);continue}let p=!1;for(let m of u){if(m instanceof hn||m instanceof yn)continue;let g=m.buildBBox();if(l.isIntersect(g)){if(m instanceof He&&m.type==="Copper Region")if(((n=m.copperResultMap)==null?void 0:n.size)>0)for(let y of m.copperResultMap){let b=jc.getCache(y.model,m.layerId);if(e.checkCache(c,b,0).relate===0){p=!0;break}}else e.check(s.getMathGraphics(s.layerId),m.getMathGraphics(),0).relate===0&&(p=!0);else{let y=jc.getCache(m.model,m.layerId);e.checkCache(c,y,0).relate===0&&(p=!0)}if(p)break}}if(!p){let m=Bo.addConnectError(l.center(),"Common",s.globalIndex,"Bridging Copper",h,!1,[s.layerId]);r.push(m)}}}}isFreeItems(t){for(let e of t)if(e instanceof Le||e instanceof Ue||e instanceof He&&!(e.type=="Line"||e.type=="Fill Region"||e.type=="Copper Region"))return!1;return!0}addFreeItemError(t,e){if(t.length>0){let r=ys(t).build1(),i=t[0];Bo.addConnectError(r.center(),"Common",i.globalIndex,b9e(i),e,!0,[i.layerId])}}},Hse=new P9e;var{IS_CLIENT:D2,IS_LCEDA:wHe,IS_EASYEDA:LHe,IS_ONLINE:IAt,IS_OFFLINE:ajn,IS_HALF_OFFLINE:ljn,IS_PRIVATE:LS,HAS_SCH:Uy,IS_ENTERPRISE_CLIENT:T9e}=MPe,MHe=D2&&!IAt;function M6(o){return o instanceof gt||o instanceof et||o instanceof Ct||o instanceof or||o instanceof jl||o instanceof ix?o.net:null}var N6=class{constructor(t){this.changed=!1;this.root=new h2,this.capacity=t,this.capacity2=t*t,this.itemList=[]}size(){return this.itemList.length}items(){return this.flushWhenNeed(),this.itemList}add(t){this.itemList.push(t),this.changed=!0}remove(t){xe.remove(this.itemList,t),this.changed=!0}clear(){this.changed=!1,this.root=new h2,this.itemList.length=0}flushWhenNeed(){if(this.changed){let t=new Array;for(let e of this.itemList)t.push(new h2(e));for(;;){let e=this.organize(t);if(e.length>1)t=e;else break}this.root=new h2(t),this.changed=!1}}organize(t){Er(t,MTe,0,t.length);let e=t.length,r=[];for(let i=0;i<e;)if(i+this.capacity2<=e){let n=i+this.capacity2;Er(t,LTe,i,n);for(let s=i;s<n;s+=this.capacity){let a=new h2(t.slice(s,s+this.capacity));r.push(a)}i=i+this.capacity*this.capacity-1}else{let n=new h2(t.slice(i,i+this.capacity));r.push(n),i=i+this.capacity-1}return r}search2(t){this.flushWhenNeed();let e=[],r=[];if(this.itemList.length==0||this.root!=null&&t.isSeparated(this.root.bbox()))return e;r.push(this.root);let i,n,s;for(;i=r.shift(),typeof i<"u";)if(n=i.items(),Array.isArray(n))for(let a of n)t.isSeparated(a.bbox())||(s=a.items(),Array.isArray(s)?a.bbox().isInside(t)?this.add2Result(a,e):r.push(a):e.push(s));else t.isSeparated(i.bbox())||e.push(n);return e}add2Result(t,e){let r=[t],i,n;for(;n=r.shift(),n!==void 0;)if(i=n.items(),Array.isArray(i))for(let s of i)r.push(s);else e.push(i)}search1(t){this.flushWhenNeed();let e=[],r=[];for(r.push(this.root);;){let i=r.shift();if(typeof i<"u"){let n=i.items();if(n instanceof Array)for(let s of n){let a=s.items();a instanceof Array?t.isSeparated(s.bbox())||r.push(s):e.push(a)}else e.push(n)}else break}return e}search(t){this.flushWhenNeed();let e=t.center(),r=[],i=[];i.push(this.root);let n=this.root.bbox().center().distance1(e),s=null,a,l,c,h;for(;;){let u=i.shift();if(typeof u<"u"){if(a=u.items(),Array.isArray(a))for(let d of a)l=d.items(),c=d.bbox(),Array.isArray(l)?t.isSeparated(c)?(h=c.center().distance1(e),h<n&&(n=h,s=d)):i.push(d):r.push(l);else c=a.bbox(),h=c.center().distance1(e),h<=n&&r.push(a);s!=null&&(this.getNearest(s,e,r),s=null)}else break}return r}getNearest(t,e,r){do{let i=t.items(),n=t.bbox().center().distance1(e);if(t=null,Array.isArray(i))for(let s of i){let a=s.items();if(Array.isArray(a)){let c=s.bbox().center().distance1(e);c<n&&(n=c,t=s)}else a.bbox().center().distance1(e)<=n&&r.push(a)}else i.bbox().center().distance1(e)<=n&&r.push(i)}while(t!=null)}walker(t){this.flushWhenNeed(),this._walker(this.root,0,t)}_walker(t,e,r){this.flushWhenNeed();let i=t.items();if(i instanceof Array)for(let n of i)this._walker(n,e+1,r);else r(i,e)}bbox(){return this.flushWhenNeed(),this.root.bbox()}};var Wse=class{constructor(t,e,r,i){this.id=t,this.net=e,this.models=r,this.junctions=i;let n=new _e;for(let s of r)n.ext1(s.bbox);this.bbox=n.build()}getModelsByLayer(t){let e=[];for(let r of this.models)this.isModelOnLayer(r,t)&&e.push(r);return e}isModelOnLayer(t,e){return t instanceof et&&ar(t.layerId)?!t.isUnuseLayer(e):t.layerId===e}};var zse=class{extract(t){let e=[];for(let r of t)if(r instanceof et||r instanceof Ct){let i=new Ja(r.center);i.id=r.globalIndex,e.push(i)}else if(r instanceof gt){let i=new Ja(r.start);i.id=r.globalIndex;let n=new Ja(r.end);n.id=r.globalIndex,e.push(i),e.push(n)}else if(r instanceof yo){let i=new S(r.center.x-r.radius,r.center.y),n=new Ja(i);n.id=r.globalIndex,e.push(n)}else if(r instanceof Za){let i=new Ja(r.start);i.id=r.globalIndex,e.push(i)}else if(r instanceof ss){let i=new Ja(r.start);if(i.id=r.globalIndex,e.push(i),r.type=="Line"&&!r.isClose()){let n=new Ja(r.end);n.id=r.globalIndex,e.push(n)}}else if(r instanceof jl){let i=new Ja(r.start);i.id=r.globalIndex,e.push(i)}return e}};var Yse=class{aggregate(t){let e=this.preprocessModels(t),r=this.groupByNet(e),i=[],n=0;for(let[s,a]of r){let l=this.findConnectedComponents(a);for(let c of l){let u=new zse().extract(c);i.push(new Wse(n++,s,c,u))}}return i}preprocessModels(t){let e=[],r=new Set,i=Ze.getInstance().getAllCopperLayerIds();for(let n of t)if(n instanceof et&&ar(n.layerId)&&!n.plated)for(let s=0,a=i.length;s<a;s++){let l=i[s];n.isUnuseLayer(l)||(l===1&&n.top!=null?r.add(n.cloneLayer(l,n.top.clone(),void 0,void 0,void 0)):l===2&&n.bottom!=null?r.add(n.cloneLayer(l,void 0,n.bottom.clone(),void 0,void 0)):Es(l)&&n.inner!=null&&r.add(n.cloneLayer(l,void 0,void 0,n.inner.clone(),void 0)))}else e.push(n);for(let n of r)e.push(n);return e}findConnectedComponents(t){let e=new Map,r=new N6(10);for(let a of t){let l=new Tb(a);e.set(a,l),r.add(l)}let i=new Map;for(let[a,l]of e){let c=a.bbox.extendOfSize(1e-8),h=r.search2(c);for(let u of h){if(u===l)continue;let d=this.getEdgeKey(a,u.item);if(i.has(d)){i.get(d)&&(l.addNear(u),u.addNear(l));continue}let p=this.checkConnection(a,u.item);i.set(d,p),p&&(l.addNear(u),u.addNear(l))}}let n=new Set,s=[];for(let[,a]of e){if(n.has(a))continue;let l=new Set,c=a.cluster();for(let h of c)n.add(h),l.add(h.item);s.push(l)}return s}getEdgeKey(t,e){let r=t.globalIndex,i=e.globalIndex;return r<i?`${r}:${i}`:`${i}:${r}`}checkConnection(t,e){return jk(t,e)?new uy().checkIntersection(t,e):!1}groupByNet(t){let e=new Map;for(let r of t){let i=this.getNet(r),n=e.get(i)||[];n.push(r),e.set(i,n)}return e}getNet(t){return M6(t)}};var I9e=class{constructor(t){this.coord=t;this._points=[];this._bbox=null;this._minX=1/0;this._minY=1/0;this._maxX=-1/0;this._maxY=-1/0}get points(){return this._points}get pointCount(){return this._points.length}addPoint(t,e,r){this._points.push({point:t,cluster:e,endpoint:r}),this._updateBBox(t)}getBBox(){return this._bbox?this._bbox:new ht(0,0,0,0)}_updateBBox(t){this._minX=Math.min(this._minX,t.x),this._minY=Math.min(this._minY,t.y),this._maxX=Math.max(this._maxX,t.x),this._maxY=Math.max(this._maxY,t.y),this._bbox=new ht(this._minX,this._maxX,this._minY,this._maxY)}},jse=class{constructor(t,e,r){this.grid=new Map;this.totalPoints=0;this.maxPointsPerGrid=0;this.config={gridSizeCoefficient:1,denseGridThreshold:1e3,...r},this.denseGridThreshold=this.config.denseGridThreshold,this.gridSize=e*this.config.gridSizeCoefficient;let i=this.gridSize*2;this.gridBBox=new ht(t.minX-i,t.maxX+i,t.minY-i,t.maxY+i)}insert(t,e,r){let i=this._pointToGridCoord(t),n=this._gridCoordToKey(i),s=this.grid.get(n);s||(s=new I9e(i),this.grid.set(n,s)),s.addPoint(t,e,r),this.totalPoints++;let a=s.points.length;a>this.maxPointsPerGrid&&(this.maxPointsPerGrid=a)}getNeighbors(t){let e=[];for(let r=-1;r<=1;r++)for(let i=-1;i<=1;i++){let n={x:t.x+i,y:t.y+r},s=this._gridCoordToKey(n),a=this.grid.get(s);a&&e.push(a)}return e}nonEmptyCells(){return Array.from(this.grid.values())}getCell(t){let e=this._gridCoordToKey(t);return this.grid.get(e)}getAllPoints(){let t=[];for(let e of this.grid.values())t.push(...e.points);return t}getMetrics(){let t=this.grid.size,e=t>0?this.totalPoints/t:0;return{gridSize:this.gridSize,totalPoints:this.totalPoints,totalClusters:this._countClusters(),nonEmptyGridCount:t,avgPointsPerGrid:e,maxPointsPerGrid:this.maxPointsPerGrid,clusterPairCount:0,executionTime:0}}hasDenseGrids(){return this.maxPointsPerGrid>=this.denseGridThreshold}_pointToGridCoord(t){let e=Math.floor((t.x-this.gridBBox.minX)/this.gridSize),r=Math.floor((t.y-this.gridBBox.minY)/this.gridSize);return{x:e,y:r}}_gridCoordToKey(t){return`${t.x},${t.y}`}_countClusters(){let t=new Set;for(let e of this.grid.values())for(let r of e.points)t.add(r.cluster.id);return t.size}};var QF=class{constructor(t,e,r,i){this.actualDistance=1/0;this.checkResult=null;this.cluster1=t,this.cluster2=e,this.estimatedDistance=r,this.nearestEndpoints=i}getPairKey(){return this.cluster1.id<this.cluster2.id?`${this.cluster1.id}|${this.cluster2.id}`:`${this.cluster2.id}|${this.cluster1.id}`}};var Xse=class{constructor(){this.pairs=new Map}updateDistance(t,e,r,i,n){let s=this._getPairKey(t.id,e.id),a=this.pairs.get(s);(!a||a.distance2>r)&&this.pairs.set(s,{cluster1:t,cluster2:e,distance2:r,endpoint1:i,endpoint2:n})}getAllPairs(){return Array.from(this.pairs.values())}convertToCreepageClusterPairs(){return this.getAllPairs().map(t=>{let e=Math.sqrt(t.distance2);return new QF(t.cluster1,t.cluster2,e,[t.endpoint1,t.endpoint2])})}get size(){return this.pairs.size}_getPairKey(t,e){return t<e?`${t}|${e}`:`${e}|${t}`}};var CAt=[{x:0,y:-1},{x:1,y:-1},{x:1,y:0},{x:1,y:1}],qse=class{constructor(){this.ruleModelManager=re.getInstance();this.ruleCache=new Map}setConfig(t){this.config=t}getMetrics(){return this.metrics}_getRuleCacheKey(t,e){return t<e?`${t}|${e}`:`${e}|${t}`}buildCandidateEdges(t,e){let r=performance.now();if(t.length<2)return[];let i=this._calculateBoardBBox(t),n=e||1e3,s=new jse(i,n,this.config);for(let d of t)for(let p of d.junctions)s.insert(p.point.clone(),d,p);let a=new Xse,l=s.nonEmptyCells(),c=new Set;for(let d of l){this._calculateInternalGridDistances(d,a);for(let p of CAt){let m={x:d.coord.x+p.x,y:d.coord.y+p.y},g=s.getCell(m);if(!g)continue;let y=this._getGridPairKey(d.coord,g.coord);c.has(y)||(c.add(y),this._calculateGridPairDistances(d,g,a))}}let h=performance.now(),u=s.getMetrics();return u.clusterPairCount=a.size,u.executionTime=h-r,this.metrics=u,s.hasDenseGrids()&&console.warn(`[CreepageMSTBuilder] Dense grid detected: ${u.maxPointsPerGrid} points in a single grid`),a.convertToCreepageClusterPairs()}computeMSTFromActualDistances(t,e){if(t.length===0)return[];let r=t.filter(s=>s.actualDistance<1/0).sort((s,a)=>s.actualDistance-a.actualDistance);if(r.length===0)return[];let i=NB(e),n=[];for(let s of r)if(i.union(s.cluster1.id,s.cluster2.id)&&(n.push(s),n.length===e-1))break;return n}_calculateInternalGridDistances(t,e){let r=t.points,i=r.length;for(let n=0;n<i;n++){let s=r[n];for(let a=n+1;a<i;a++){let l=r[a];if(s.cluster.id===l.cluster.id||s.cluster.net===l.cluster.net||!this._checkCreepageRule(s.cluster.net,l.cluster.net))continue;let c=s.point.x-l.point.x,h=s.point.y-l.point.y,u=c*c+h*h;e.updateDistance(s.cluster,l.cluster,u,s.endpoint,l.endpoint)}}}_calculateGridPairDistances(t,e,r){for(let i of t.points)for(let n of e.points){if(i.cluster.id===n.cluster.id||i.cluster.net===n.cluster.net||!this._checkCreepageRule(i.cluster.net,n.cluster.net))continue;let s=i.point.x-n.point.x,a=i.point.y-n.point.y,l=s*s+a*a;r.updateDistance(i.cluster,n.cluster,l,i.endpoint,n.endpoint)}}_checkCreepageRule(t,e){if(!t||!e)return!1;let r=this._getRuleCacheKey(t,e),i=this.ruleCache.get(r);if(i!==void 0)return i;let n={net:t,shapeType:0,id:"",layerId:1},s={net:e,shapeType:0,id:"",layerId:1},a=["BetweenNetRule","NetRule"],l=!1;for(let c of a){let h=this.ruleModelManager.getRule4Order(n,s,c,2);if(h.length>0){for(let u of h)if(u.creepageDistance>0){l=!0;break}}if(l)break}if(!l){let c=this.ruleModelManager.getDefaultCreepageSpacing();c&&c.creepageDistance>0&&(l=!0)}return this.ruleCache.set(r,l),l}_calculateBoardBBox(t){let e=1/0,r=1/0,i=-1/0,n=-1/0;for(let s of t)for(let a of s.junctions){let l=a.point;e=Math.min(e,l.x),r=Math.min(r,l.y),i=Math.max(i,l.x),n=Math.max(n,l.y)}return new ht(e,i,r,n)}_getGridPairKey(t,e){return t.x<e.x||t.x===e.x&&t.y<e.y?`${t.x},${t.y}|${e.x},${e.y}`:`${e.x},${e.y}|${t.x},${t.y}`}};var eV=class{constructor(t,e,r,i,n,s=!1){this.source=t;this.project=e;this.obstacles=r;this.clearance=i;this.calculateMinDistance=s;this.result=new Array;this.points=new Array;this.tree=new Lb(7);this.used=new Set;let a=new ji(7);for(let c of e)n.isSeparated(c.bbox())||a.add(c);for(let c of t.primitives)n.isSeparated(c.bbox())||this.project4WithTree(c,a,n);this.result=this.isValidLines(this.result,n);let l=[];for(let c of this.result)l.push(c.start());this.removeRepeat(l)}removeRepeat(t){let e=new ji(7);for(let i of t)e.add(i);let r=new Set;for(let i of t){if(r.has(i))continue;let n=e.search(i.bbox().extendOfSize(1e-6));for(let s of n)r.add(s);this.points.push(i)}}project4WithTree(t,e,r){let i=t.bbox().extendOfSize(this.clearance).intersect(r);this.used.clear();for(let n of e.search(i))xe.addAll(this.result,this.projectPts(t,n))}projectPts(t,e){if(t instanceof M)return this.project4Direct(t,e);if(t instanceof q)return this.project4Arc(t,e);throw new Error("not support!!!")}project4Direct(t,e){let r=t.start(),i=t.direct,n=new Array;if(e instanceof M)this.add2Result(t,e.start(),n),this.add2Result(t,e.end(),n);else if(e instanceof q){let s=i.mul(e.rx),a=e.center.sub(s),l=e.center.add(s);this.isOn(e,a)&&this.add2Result(t,a,n),this.isOn(e,l)&&this.add2Result(t,l,n);let c=this.getTangencyPoint(r,e);for(let u of c){let d=new M(r,u);this.isValidProject(d)&&n.push(d)}let h=this.getTangencyPoint(t.end(),e);for(let u of h){let d=new M(t.end(),u);this.isValidProject(d)&&n.push(d)}this.add2Result(t,e.start(),n),this.add2Result(t,e.end(),n),this.calculateMinDis(t,e)}else throw new Error("not support!!!");return n}calculateMinDis(t,e){if(this.calculateMinDistance){let r=new Eu(t,e),i=r.getDistance();if(ne.greater(i,0)&&ne.less(i,this.clearance)){let n=r.getLine();t instanceof M?sR(t,n.start())?this.result.push(n):this.result.push(n.reverse()):t instanceof q&&(aR(t,n.start())?this.result.push(n):this.result.push(n.reverse()))}}}add2Result(t,e,r){if(this.used.has(e))return;this.used.add(e);let i=t.start(),n=t.direct,s=e.sub(i),a=n.dot(s),l=this.getStart4Line(a,t),c=new M(l,e);this.isValidProject(c)&&r.push(c)}isUsed(t){return this.tree.search(t.bbox().extendOfSize(1e-6)).length>0}isOn(t,e){return t.isCircle()?!0:$f(t,e)}getStart4Line(t,e){return ne.lesseq(t,0)?e.start():ne.greatereq(t,e.length())?e.end():e.start().add(e.direct.mul(t))}isValidProject(t){return!ne.greatereq(t.length(),this.clearance)}isValidLines(t,e){let r=new Array,i=new Array;for(let n of this.obstacles){let s=n.search(e);xe.addAll(i,s)}e:for(let n of t){let s=n.start();if(!this.isUsed(s)){for(let a of i){let l=Pt(n,a);for(let c=0;c<l;c+=2){let h=new S(Ee[c],Ee[c+1]);if(!h.equals1(n.start())&&!h.equals1(n.end()))continue e}}this.tree.insert(s),r.push(n)}}return r}project4Arc(t,e){this.calculateMinDis(t,e);let r=new Array;if(e instanceof M)return this.getLine4Arc(t,e.start(),r),this.getLine4Arc(t,e.end(),r),r.filter(i=>this.isValidProject(i));if(e instanceof q){let i=this.getTangencyPoint(t.center,e);i.push(e.start()),i.push(e.end());let n=e.center.sub(t.center).normalize();if(!n.equals1(S.ORIGIN)){n=new S(-n.y,n.x);let s=n.mul(e.rx),a=e.center.sub(s),l=e.center.add(s);this.isOn(e,a)&&i.push(a),this.isOn(e,l)&&i.push(l)}for(let s of i)this.getLine4Arc(t,s,r);return r.filter(s=>this.isValidProject(s))}else throw new Error("not support!!!")}getLine4Arc(t,e,r){let i=t.center;if(this.isOn(t,e)&&!e.equals1(i)){let n=e.sub(i).normalize().mul(t.rx);if(this.used.has(e))return;this.used.add(e),r.push(new M(i.add(n),e))}else for(let n of[t.start(),t.end()]){let s=new M(n,e);r.push(s)}}getTangencyPoint(t,e){let r=new Array,i=t.sub(e.center),n=i.length();if(ne.greatereq(e.rx,n))return r;let s=e.rx/n,a=Math.acos(s),l=i.normalize(),c=l.rotate(S.ORIGIN,a),h=l.rotate(S.ORIGIN,-a),u=e.center.add(c.mul(e.rx)),d=e.center.add(h.mul(e.rx));return this.isOn(e,u)&&r.push(u),this.isOn(e,d)&&r.push(d),r}};var $se=class{constructor(){this.limit=Number.MAX_SAFE_INTEGER;this.newMapOld=new Map;this.direct=new S(0,1)}simplify(t){this.newMapOld.clear();let e=Array.from(t.primitives),r=!0,i=0;for(;r&&i<this.limit;){r=!1;for(let u=0,d=e.length;u<d;u++){let p=(u+1)%d,m=e[u],g=e[p];if(this.isConvex(m,g)){if(m instanceof q&&m.sweep()==ae.CCW){r=!0,e.splice(u,1,new M(m.start(),m.end()));break}}else{let y=this.simplifyLines(m,g);r=!0,p==0?(e.shift(),e.pop(),e.push(...y)):e.splice(u,2,...y);break}}i++}let n=new Map,s=new Array;for(let u of e){let d=u.start();n.set(d,u),s.push(d)}s.sort((u,d)=>{let p=u.x-d.x;return ne.eq(p,0)?u.y-d.y:p});let a=new Array;for(let u of s){for(;a.length>=2&&ne.less(a[a.length-1].sub(a[a.length-2]).cross(u.sub(a[a.length-2])),0);)a.pop();a.push(u)}let l=new Array;s=s.reverse();for(let u of s){for(;l.length>=2&&ne.less(l[l.length-1].sub(l[l.length-2]).cross(u.sub(l[l.length-2])),0);)l.pop();l.push(u)}l[l.length-1].equals1(a[0])&&a.shift(),l[0].equals1(a[a.length-1])&&a.pop();let c=[...l,...a].reverse(),h=new Array;for(let u of c){let d=n.get(u);if(h.length>0){let p=h[h.length-1];p.end().equals1(u)||(h.pop(),h.push(new M(p.start(),u)))}h.push(d)}return h}simplifyOnePolygon(t){this.newMapOld.clear();let e=new Array,r=t.primitives;for(let n of r)this.newMapOld.set(n,n),this.calculate([n],e);let i=!0;for(;i;){i=!1;let n=e.shift();i=this.calculate([n],e)}return e}calculate(t,e){let r=!1;e:for(;t.length>0;){let i=t.shift();for(;e.length>=1&&(!this.isConvex1(e[e.length-1],i)||this.notIsConvex(i.start(),Et(e[e.length-1]),Et(i,i.start()),e));){let n=this.simplifyLines1(e[e.length-1],i);t.unshift(...n),e.pop(),r=!0;continue e}e.push(i)}return r}notIsConvex(t,e,r,i){let n=0;for(let s of i)t.equals1(s.start())||t.equals1(s.end())||(n+=this.windingNumber(t,s.start(),s.end()));if(n==0)return!1;if(n<0){let s=this.direct.dot(e),a=this.direct.dot(r);return!(s>=0&&s*a>=0)}else{let s=this.direct.dot(e),a=this.direct.dot(r);return!(s<=0&&s*a>=0)}return n>1&&n%2==1}windingNumber(t,e,r){if(e.y<=t.y&&t.y<r.y){if(r.sub(e).cross(t.sub(e))>0)return 1}else if(r.y<=t.y&&t.y<e.y&&r.sub(e).cross(t.sub(e))<0)return-1;return 0}replaceMap(t,e){let r=this.newMapOld.get(t);if(r!=null){this.newMapOld.delete(t);for(let i of e)this.newMapOld.set(i,r)}}simplifyLines1(t,e){if(t instanceof M&&e instanceof M)return[new M(t.start(),e.end())];if(t instanceof M&&e instanceof q){if(e.sweep()==ae.CCW)return[t,new M(e.start(),e.end())];{let r=this.getTangencyPoint(t.start(),e);if(r.length>0){an(r,e);let i=r[0],n=Gu(e,i);return this.replaceMap(e,n),n.shift(),[new M(t.start(),i),...n]}else return[new M(t.start(),e.end())]}}else if(t instanceof q&&e instanceof M){if(t.sweep()==ae.CCW)return[new M(t.start(),t.end()),e];{let r=this.getTangencyPoint(e.end(),t);if(r.length>0){an(r,t);let i=r[r.length-1],n=Gu(t,i);return this.replaceMap(t,n),n.pop(),[...n,new M(i,e.end())]}else return[new M(t.start(),e.end())]}}else if(t instanceof q&&e instanceof q){if(t.sweep()==ae.CCW)return[new M(t.start(),t.end()),e];if(e.sweep()==ae.CCW)return[t,new M(e.start(),e.end())];if(t.sweep()==ae.CW){let i;t.rx>e.rx?i=this.getArcsTangencyPoint(e,t).arc2Tangency:i=this.getArcsTangencyPoint(t,e).arc1Tangency,an(i,t);for(let n of i){let s=n.sub(t.start()).normalize(),a=this.getTangencyPoint(n,e);an(a,e);for(let l of a){let c=l.sub(n);if(this.isCW(s,c)&&this.isValid(n,l,[t,e])){let h=Gu(t,n);this.replaceMap(t,h);let u=h.shift(),d=Gu(e,l);this.replaceMap(e,d);let p=d.pop();return[u,new M(n,l),p]}}}}let r=this.getTangencyPoint(t.start(),e);an(r,e);for(let i of r){let n=i.sub(t.start()).normalize(),s=e.end().sub(i);if(this.isCW(n,s)&&this.isValid(t.start(),i,[t,e])){let a=Gu(e,i);this.replaceMap(e,a);let l=a.pop();return[new M(t.start(),i),l]}}return[new M(t.start(),e.end())]}}simplifyLines(t,e){if(t instanceof M&&e instanceof M)return[new M(t.start(),e.end())];if(t instanceof M&&e instanceof q){let r=this.getTangencyPoint(t.start(),e);if(r.length>0){an(r,e);let i=r[0],n=Gu(e,i);return n.shift(),[new M(t.start(),i),...n]}else return[new M(t.start(),e.end())]}else if(t instanceof q&&e instanceof M){let r=this.getTangencyPoint(e.end(),t);if(r.length>0){an(r,t);let i=r[r.length-1],n=Gu(t,i);return n.pop(),[...n,new M(i,e.end())]}else return[new M(t.start(),e.end())]}else if(t instanceof q&&e instanceof q){if(t.sweep()==ae.CW){let i;t.rx>e.rx?i=this.getArcsTangencyPoint(e,t).arc2Tangency:i=this.getArcsTangencyPoint(t,e).arc1Tangency,an(i,t);for(let n of i){let s=n.sub(t.start()).normalize(),a=this.getTangencyPoint(n,e);an(a,e);for(let l of a){let c=l.sub(n);if(this.isCW(s,c)&&this.isValid(n,l,[t,e])){let u=Gu(t,n).shift(),p=Gu(e,l).pop();return[u,new M(n,l),p]}}}}let r=this.getTangencyPoint(t.start(),e);an(r,e);for(let i of r){let n=i.sub(t.start()).normalize(),s=e.end().sub(i);if(this.isCW(n,s)&&this.isValid(t.start(),i,[t,e])){let l=Gu(e,i).pop();return[new M(t.start(),i),l]}}return[new M(t.start(),e.end())]}}isValid(t,e,r){let i=new M(t,e);for(let n of r){let s=Pt(i,n);for(let a=0;a<s;a+=2){let l=new S(Ee[a],Ee[a+1]);if(!l.equals1(t)&&!l.equals1(e))return!1}}return!0}isConvex1(t,e){if(t instanceof M&&e instanceof M)return this.isCW(t.direct,e.end().sub(t.start()).normalize());if(t instanceof M&&e instanceof q){if(e.sweep()==ae.CCW)return!1;{let r=this.getTangencyPoint(t.start(),e);for(let i of r)if(!this.isCW(t.direct,i.sub(t.start())))return!1;return this.isCW(t.direct,Et(e,e.start()))}}else if(t instanceof q&&e instanceof M){if(t.sweep()==ae.CCW)return!1;{let r=this.getTangencyPoint(e.end(),t);for(let i of r)if(!this.isCW(e.end().sub(i).normalize(),e.direct))return!1;return this.isCW(Et(t),e.direct)}}else if(t instanceof q&&e instanceof q)return t.sweep()==ae.CW&&e.sweep()==ae.CW&&this.isCW(Et(t),Et(e,e.start()))}isConvex(t,e){if(t instanceof M&&e instanceof M)return this.isCW(t.direct,e.direct)&&this.isCW(t.direct,e.end().sub(t.start()).normalize());if(t instanceof M&&e instanceof q)return this.isCW(t.direct,Et(e,e.start()));if(t instanceof q&&e instanceof M)return this.isCW(Et(t),e.direct);if(t instanceof q&&e instanceof q)return this.isCW(Et(t),Et(e,e.start()))}isCW(t,e){return ne.lesseq(t.cross(e),0)}getTangencyPoint(t,e){let r=new Array,i=t.sub(e.center),n=i.length();if(ne.greatereq(e.rx,n))return r;let s=e.rx/n,a=Math.acos(s),l=i.normalize(),c=l.rotate(S.ORIGIN,a),h=l.rotate(S.ORIGIN,-a),u=e.center.add(c.mul(e.rx)),d=e.center.add(h.mul(e.rx));return Wn(e,u)&&!e.start().equals1(u)&&!e.end().equals1(u)&&r.push(u),Wn(e,d)&&!e.start().equals1(d)&&!e.end().equals1(d)&&r.push(d),r}getArcsTangencyPoint(t,e){let r=new Array,i=new Array,n=t.rx,s=e.rx,a=t.center.distance1(e.center);if(ne.eq(a,0))return{arc1Tangency:r,arc2Tangency:i};if(ne.eq(n,s)){let d=t.center.sub(e.center).normalize(),p=d.rotate(S.ORIGIN,Math.PI/2),m=d.rotate(S.ORIGIN,-Math.PI/2),g=t.center.add(p.mul(n)),y=t.center.add(m.mul(n)),b=e.center.add(p.mul(s)),P=e.center.add(m.mul(s));if(Wn(t,g)&&r.push(g),Wn(t,y)&&r.push(y),Wn(e,b)&&i.push(b),Wn(e,P)&&i.push(P),ne.greater(a,n+s)){let T=Math.acos(2*n/a),I=d.rotate(S.ORIGIN,T),C=d.rotate(S.ORIGIN,-T),E=t.center.add(I.mul(n)),O=t.center.add(C.mul(n)),_=e.center.add(I.mul(-s)),x=e.center.add(C.mul(-s));Wn(t,E)&&r.push(E),Wn(t,O)&&r.push(O),Wn(e,_)&&i.push(_),Wn(e,x)&&i.push(x)}return{arc1Tangency:r,arc2Tangency:i}}let l=a/(s/n-1);if(ne.greatereq(n,l))return{arc1Tangency:r,arc2Tangency:i};let c=n/l,h=Math.acos(c),u=t.center.sub(e.center).normalize();if(this.calculateArcTangencys(u,h,t,r),this.calculateArcTangencys(u,h,e,i),a>n+s){let d=a/(s/n+1),p=n/d,m=Math.acos(p);this.calculateArcTangencys(u.mul(-1),m,t,r),this.calculateArcTangencys(u,m,e,i)}return{arc1Tangency:r,arc2Tangency:i}}calculateArcTangencys(t,e,r,i){let n=t.rotate(S.ORIGIN,e),s=t.rotate(S.ORIGIN,-e),a=r.center.add(n.mul(r.rx)),l=r.center.add(s.mul(r.rx));Wn(r,a)&&i.push(a),Wn(r,l)&&i.push(l)}};var Kse=class{getTangency(t,e){switch(new Xl(t,e,0).relation){case 1:return[];case 2:return[];case 0:{let i=this.calTangency(t,e,0),n=this.calTangency(t,e,1);return[i,n]}case 3:{let i=this.calTangency(t,e,0),n=this.calTangency(t,e,1),s=this.calTangency(t,e,2),a=this.calTangency(t,e,3);return[i,n,s,a]}}}getTangency1(t,e){switch(new Xl(t,e,0).relation){case 1:return null;case 2:return null;case 0:{let i=this.calTangency(t,e,0),n=this.calTangency(t,e,1);return[new M(i.start,i.end),new M(n.start,n.end)]}case 3:{let i=this.calTangency(t,e,0),n=this.calTangency(t,e,1),s=this.calTangency(t,e,2),a=this.calTangency(t,e,3);return[new M(i.start,i.end),new M(n.start,n.end),new M(s.start,s.end),new M(a.start,a.end)]}}}calTangency(t,e,r){let i=t.bbox(),n=e.bbox(),s=i.width()+i.height()+n.width()+n.height(),a=n.center().sub(i.center()).normalize().mul(s),l=new M(i.center().sub(a),n.center().add(a)),[c,h]=this.getStartPoint(t,l,r,!0),[u,d]=this.getStartPoint(e,l,r,!1),p=t.primitives.length,m=e.primitives.length,g=!0,y=p+m,b=0,P=new Set,T=new Set,I=h,C=d;for(;g||b<y;){g=!1;let E=t.primitives[h],O=e.primitives[d],_=this.getPrimitivesEdge(E,O,c,u,r);if(_.leftPoint!=c&&(g=!0,I=h),_.rightPoint!=u&&(g=!0,C=d),c=_.leftPoint,u=_.rightPoint,c.equals1(E.end())&&(h=(h+1)%p,P.add(h)),u.equals1(O.end())&&(d=(d+1)%m,T.add(d)),!g){let x=(h+1)%p;if(!P.has(x))h=x,P.add(h);else{let v=(d+1)%m;T.has(v)||(d=v,T.add(d))}}b++}return{start:c,leftIndex:I,end:u,rightIndex:C}}calTangency4Category(t,e,r,i,n,s,a){let l=t.primitives.length,c=i.primitives.length,h=!0;for(;h;){h=!1;let u=t.primitives[r],d=i.primitives[a],p=this.getPrimitivesEdge(u,d,e,s,n);(p.leftPoint!=e||p.rightPoint!=s)&&(h=!0),e=p.leftPoint,s=p.rightPoint,e.equals1(u.end())&&(r=(r+1)%l),s.equals1(d.end())&&(a=(a+1)%c)}return{start:e,leftIndex:r,end:s,rightIndex:a}}getStartPoint(t,e,r,i){switch(r){case 0:return this.getLeftPoint(t,e);case 1:return this.getRightPoint(t,e);case 2:return i?this.getLeftPoint(t,e):this.getRightPoint(t,e);case 3:return i?this.getRightPoint(t,e):this.getLeftPoint(t,e);default:return null}}getLeftPoint(t,e){let r=new Array,i=new Map,n=e.bbox();for(let l=0;l<t.primitives.length;l++){let c=t.primitives[l];if(c.bbox().isSeparated(n))continue;let h=Pt(c,e);for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);r.push(d),i.set(d,l)}}an(r,e);let s=r[0],a=i.get(s);return[s,a]}getRightPoint(t,e){let r=new Array,i=new Map,n=e.bbox();for(let l=0;l<t.primitives.length;l++){let c=t.primitives[l];if(c.bbox().isSeparated(n))continue;let h=Pt(c,e);for(let u=0;u<h;u+=2){let d=new S(Ee[u],Ee[u+1]);r.push(d),i.set(d,l)}}an(r,e);let s=r[r.length-1],a=i.get(s);return[s,a]}getTangencyPoint(t,e){let r=new Array,i=t.sub(e.center),n=i.length();if(ne.greatereq(e.rx,n))return r;let s=e.rx/n,a=Math.acos(s),l=i.normalize(),c=l.rotate(S.ORIGIN,a),h=l.rotate(S.ORIGIN,-a),u=e.center.add(c.mul(e.rx)),d=e.center.add(h.mul(e.rx));return Wn(e,u)&&r.push(u),Wn(e,d)&&r.push(d),r}getPrimitivesEdge(t,e,r,i,n){let s=t instanceof M,a=e instanceof M;if(s&&a)for(let l of[t.end()])for(let c of[e.end()]){let h=this.category(n,r,i,l,c);r=h.left,i=h.right}else if(s&&!a)for(let l of[t.end()]){let c=this.getTangencyPoint(l,e);c.push(e.end());for(let h of c){let u=this.category(n,r,i,l,h);r=u.left,i=u.right}}else if(!s&&a)for(let l of[e.end()]){let c=this.getTangencyPoint(l,t);c.push(t.end());for(let h of c){let u=this.category(n,r,i,h,l);r=u.left,i=u.right}}else{let l=t,c=e,h,u;if(l.rx>c.rx){let d=this.getArcsTangencyPoint(c,l);h=d.arc2Tangency,u=d.arc1Tangency}else{let d=this.getArcsTangencyPoint(l,c);h=d.arc1Tangency,u=d.arc2Tangency}h.push(t.end()),u.push(e.end());for(let d of h){let m=[...this.getTangencyPoint(d,c),...u];for(let g of m){let y=this.category(n,r,i,d,g);r=y.left,i=y.right}}}return{leftPoint:r,rightPoint:i}}filterPrimitivePoints(t,e,r){e.push(t),an(e,r);let i=new Array,n=e.indexOf(t),s=t;i.push(t);for(let a=n+1;a<e.length;a++){let l=e[a];l.equals1(s)||(i.push(l),s=l)}return i}category(t,e,r,i,n){let s=!0;for(;s;)switch(s=!1,t){case 0:{ne.greater(this.getCross(e,r,n),0)&&(r=n,s=!0),ne.less(this.getCross(r,e,i),0)&&(e=i,s=!0);break}case 1:{ne.less(this.getCross(e,r,n),0)&&(r=n,s=!0),ne.greater(this.getCross(r,e,i),0)&&(e=i,s=!0);break}case 2:{ne.less(this.getCross(e,r,n),0)&&(r=n,s=!0),ne.less(this.getCross(r,e,i),0)&&(e=i,s=!0);break}case 3:{ne.greater(this.getCross(e,r,n),0)&&(r=n,s=!0),ne.greater(this.getCross(r,e,i),0)&&(e=i,s=!0);break}default:return{left:e,right:r}}return{left:e,right:r}}getCross(t,e,r){return e.sub(t).cross(r.sub(t))}getArcsTangencyPoint(t,e){let r=new Array,i=new Array,n=t.rx,s=e.rx,a=t.center.distance1(e.center);if(ne.eq(a,0))return{arc1Tangency:r,arc2Tangency:i};if(ne.eq(n,s)){let d=t.center.sub(e.center).normalize(),p=d.rotate(S.ORIGIN,Math.PI/2),m=d.rotate(S.ORIGIN,-Math.PI/2),g=t.center.add(p.mul(n)),y=t.center.add(m.mul(n)),b=e.center.add(p.mul(s)),P=e.center.add(m.mul(s));if(Wn(t,g)&&r.push(g),Wn(t,y)&&r.push(y),Wn(e,b)&&i.push(b),Wn(e,P)&&i.push(P),ne.greater(a,n+s)){let T=Math.acos(2*n/a),I=d.rotate(S.ORIGIN,T),C=d.rotate(S.ORIGIN,-T),E=t.center.add(I.mul(n)),O=t.center.add(C.mul(n)),_=e.center.add(I.mul(-s)),x=e.center.add(C.mul(-s));Wn(t,E)&&r.push(E),Wn(t,O)&&r.push(O),Wn(e,_)&&i.push(_),Wn(e,x)&&i.push(x)}return{arc1Tangency:r,arc2Tangency:i}}let l=a/(s/n-1);if(ne.greatereq(n,l))return{arc1Tangency:r,arc2Tangency:i};let c=n/l,h=Math.acos(c),u=t.center.sub(e.center).normalize();if(this.calculateArcTangencys(u,h,t,r),this.calculateArcTangencys(u,h,e,i),a>n+s){let d=a/(s/n+1),p=n/d,m=Math.acos(p);this.calculateArcTangencys(u.mul(-1),m,t,r),this.calculateArcTangencys(u,m,e,i)}return{arc1Tangency:r,arc2Tangency:i}}calculateArcTangencys(t,e,r,i){let n=t.rotate(S.ORIGIN,e),s=t.rotate(S.ORIGIN,-e),a=r.center.add(n.mul(r.rx)),l=r.center.add(s.mul(r.rx));Wn(r,a)&&i.push(a),Wn(r,l)&&i.push(l)}};var Zse=class{constructor(t){this.preprocessor=t;this.tangencyMap=new Map}calculateTangency(t,e,r,i){this.tangencyMap.clear();let n=new Array,s=this.preprocessor.getPointsInBBox(r);for(let[l,c]of t)for(let h of s){let u=h.point,d=c?new M(l,u):new M(u,l);d.length()<e&&this.isTangencyPts(l,u,h.prevPrimitive,h.nextPrimitive)&&this.preprocessor.canMove(d)&&n.push(d)}for(let[l,c]of t)for(let h of i){let u=this.getTangencyPoint(l,h);for(let d of u){let p=c?new M(l,d):new M(d,l);r.isContains(d)&&p.length()<e&&this.preprocessor.canMove(p)&&(n.push(p),this.tangencyMap.set(d,[h]))}}let a=this.preprocessor.getLinesInBBox(r);for(let l of a)n.push(new M(l.startPoint,l.endPoint)),n.push(new M(l.endPoint,l.startPoint));return n}isTangencyPts(t,e,r,i){let n=e.sub(t).normalize(),s=this.getNextPoint(r,!1).sub(t).normalize(),a=this.getNextPoint(i,!0).sub(t).normalize(),l=n.cross(s),c=n.cross(a);return ne.greatereq(l*c,0)}getNextPoint(t,e){if(t instanceof M)return e?t.end():t.start();if(t instanceof q)if(e){let r=t.start(),i=Et(t,r);return r.add(i)}else{let r=t.end(),i=Et(t).mul(-1);return r.add(i)}return new S(0,0)}getTangencyPoint(t,e){let r=new Array,i=t.sub(e.center),n=i.length();if(ne.greatereq(e.rx,n))return r;let s=e.rx/n,a=Math.acos(s),l=i.normalize(),c=l.rotate(S.ORIGIN,a),h=l.rotate(S.ORIGIN,-a),u=e.center.add(c.mul(e.rx)),d=e.center.add(h.mul(e.rx));return Wn(e,u)&&r.push(u),Wn(e,d)&&r.push(d),r}};var Jse=class{constructor(t,e){this.pls=t;this.isSolids=e;this.tangencyPoints=[];this.lineCache=new Map;this.arcTangencyPointsMap=new Map;this.ccwArcs=[];this.pointToArcLineKeys=new Map;this.pointTree=new ji(7),this.primitiveTree=new ji(7)}getAllPolyline(){return this.pls}getOutline(){let t=this.isSolids.indexOf(!1);return this.pls[t]}preprocess(){this.normalizeToClockwise(),this.extractTangencyPoints(),this.collectCCWArcs(),this.collectArcTangencyPoints(),this.collectArcToArcTangencyPoints(),this.splitArcsByTangencyPoints(),this.tangencyPoints=[],this.extractTangencyPoints(),this.cacheArcTangencyLines(),this.pointTree=new ji(7),this.buildPointTree(),this.primitiveTree=new ji(7),this.buildPrimitiveTree()}normalizeToClockwise(){for(let t=0;t<this.pls.length;t++){let e=this.pls[t];e.area()>0&&(this.pls[t]=e.reverse())}}buildPrimitiveTree(){for(let t=0;t<this.pls.length;t++){let e=this.pls[t];for(let r of e.primitives)this.primitiveTree.add(r)}}findTangencyPoint(t){let e=this.pointTree.search(t.bbox().extendOfSize(1e-6));for(let r of e)if(r.point.equals1(t))return r;return null}getTangencyPointIndex(t){let e=this.findTangencyPoint(t);if(e===null)return-1;for(let r=0;r<this.tangencyPoints.length;r++)if(this.tangencyPoints[r]===e)return r;return-1}getPointsInBBox(t){return this.pointTree.search(t).filter(r=>t.isContains(r.point))}getTangencyPoints(){return this.tangencyPoints}getLinesInBBox(t,e){let r=[],n=this.pointTree.search(t).filter(a=>t.isContains(a.point));for(let a=0;a<n.length;a++)for(let l=a+1;l<n.length;l++){let c=n[a],h=n[l],u=c.point.distance1(h.point);if(e!==void 0&&u>=e)continue;let d=this.getOrComputeLinePair(c,h,u);r.push(...d)}let s=this.getArcTangencyLinesFromCache(t,e);return r.push(...s),r}getOrComputeLinePair(t,e,r){let i=[];if(this.isValidTangencyLineForDirection(t,e.point)){let n=this.getLineKey(t.point,e.point),s=this.lineCache.get(n);if(s===void 0){let a=new M(t.point,e.point);this.canMove(a)?s={startIndex:this.getTangencyPointIndex(t.point),endIndex:this.getTangencyPointIndex(e.point),length:r,startPoint:t.point,endPoint:e.point,bbox:()=>a.bbox()}:s=null,this.lineCache.set(n,s)}s!==null&&i.push(s)}if(this.isValidTangencyLineForDirection(e,t.point)){let n=this.getLineKey(e.point,t.point),s=this.lineCache.get(n);if(s===void 0){let a=new M(t.point,e.point);this.canMove(a)?s={startIndex:this.getTangencyPointIndex(e.point),endIndex:this.getTangencyPointIndex(t.point),length:r,startPoint:e.point,endPoint:t.point,bbox:()=>a.bbox()}:s=null,this.lineCache.set(n,s)}s!==null&&i.push(s)}return i}getArcTangencyLinesFromCache(t,e){let r=[],n=this.pointTree.search(t).filter(s=>t.isContains(s.point));for(let s of n){let a=this.getTangencyPointIndex(s.point);if(a===-1)continue;let l=this.pointToArcLineKeys.get(a)||[];for(let c of l){let h=this.lineCache.get(c);if(h!=null){if(!t.isContains(h.endPoint)||e!==void 0&&h.length>=e)continue;r.push(h)}}}return r}getLineKey(t,e){return`${t.x},${t.y}-${e.x},${e.y}`}getPrimitiveTree(){return this.primitiveTree}getObstacles(){return this.pls}getIsSolids(){return this.isSolids}extractTangencyPoints(){for(let t=0;t<this.pls.length;t++){let e=this.pls[t],r=this.isSolids[t],i=e.primitives.length;for(let n=0;n<i;n++){let s=e.primitives[(n-1+i)%i],a=e.primitives[n],l=a.start();if(this.isConvexPoint(s,a,r)){let h={point:l,obstacleIndex:t,primitiveIndex:n,prevPrimitive:s,nextPrimitive:a,type:r?1:0,bbox:()=>l.bbox().extendOfSize(1e-6)};this.tangencyPoints.push(h)}}}}buildPointTree(){for(let t of this.tangencyPoints)this.pointTree.add(t)}isValidTangencyLineForDirection(t,e){let r=e.sub(t.point).normalize(),i=this.getNextPoint(t.prevPrimitive,!1).sub(t.point).normalize(),n=this.getNextPoint(t.nextPrimitive,!0).sub(t.point).normalize(),s=r.cross(i),a=r.cross(n);return ne.greatereq(s*a,0)}isConvexPoint(t,e,r){let i=this.getOutDirect(t),n=this.getOutDirect(e),s=i.cross(n);return r?ne.lesseq(s,0):ne.greatereq(s,0)}getOutDirect(t){return t instanceof M?t.direct:t instanceof q?Et(t):new S(0,0)}getNextPoint(t,e){if(t instanceof M)return e?t.end():t.start();if(t instanceof q)if(e){let r=t.start(),i=Et(t,r);return r.add(i)}else{let r=t.end(),i=Et(t).mul(-1);return r.add(i)}return new S(0,0)}canMove(t){let e=t.bbox(),r=t.midPoint;for(let n=0,s=this.pls.length;n<s;n++){let a=this.pls[n];if(!a.bbox().isSeparated(e)&&this.isSolids[n]&&jr.inPolyline(r,a))return!1}let i=this.primitiveTree.search(e);for(let n of i){let s=Pt(t,n);for(let a=0;a<s;a+=2){let l=new S(Ee[a],Ee[a+1]);if(!l.equals1(t.start())&&!l.equals1(t.end()))return!1}}return!0}collectCCWArcs(){for(let t=0;t<this.pls.length;t++){let e=this.pls[t],r=this.isSolids[t];for(let i of e.primitives)i instanceof q&&(r?!i.isCCW:i.isCCW)&&this.ccwArcs.push({arc:i,obstacleIndex:t})}}collectArcTangencyPoints(){for(let t=0;t<this.tangencyPoints.length;t++){let e=this.tangencyPoints[t];for(let{arc:r,obstacleIndex:i}of this.ccwArcs){if(e.obstacleIndex===i)continue;let n=this.computeArcTangency(e.point,r);for(let s of n){let a=new M(e.point,s);if(!this.canMove(a)||!this.isValidTangencyLineForDirection(e,s))continue;let l=this.arcTangencyPointsMap.get(r)||[];l.push(s),this.arcTangencyPointsMap.set(r,l)}}}}cacheArcTangencyLines(){for(let t=0;t<this.tangencyPoints.length;t++){let e=this.tangencyPoints[t];for(let{arc:r,obstacleIndex:i}of this.ccwArcs){if(e.obstacleIndex===i)continue;let n=this.computeArcTangency(e.point,r);for(let s of n){let a=new M(e.point,s);if(!this.canMove(a)||!this.isValidTangencyLineForDirection(e,s))continue;let l=this.getTangencyPointIndexSlow(s);if(l===-1)continue;let c=this.getLineKey(e.point,s),h=e.point.distance1(s);this.lineCache.set(c,{startIndex:t,endIndex:l,length:h,startPoint:e.point,endPoint:s,bbox:()=>a.bbox()});let u=this.pointToArcLineKeys.get(t)||[];u.push(c),this.pointToArcLineKeys.set(t,u)}}}}getTangencyPointIndexSlow(t){for(let e=0;e<this.tangencyPoints.length;e++)if(this.tangencyPoints[e].point.equals1(t))return e;return-1}splitArcsByTangencyPoints(){for(let t=0;t<this.pls.length;t++){let e=this.pls[t],r=[];for(let i of e.primitives)if(i instanceof q){let n=this.arcTangencyPointsMap.get(i);if(n&&n.length>0){an(n,i);let s=this.removeDuplicatePoints(n),a=oR(i,s);r.push(...a)}else r.push(i)}else r.push(i);this.pls[t]=ge.build2(r)}}removeDuplicatePoints(t){if(t.length<=1)return t;let e=[],r=t[0];e.push(r);for(let i=1;i<t.length;i++){let n=t[i];n.equals1(r)||(e.push(n),r=n)}return e}computeArcTangency(t,e){let r=[],i=t.sub(e.center),n=i.length();if(ne.greatereq(e.rx,n))return r;let s=e.rx/n,a=Math.acos(s),l=i.normalize(),c=l.rotate(S.ORIGIN,a),h=l.rotate(S.ORIGIN,-a),u=e.center.add(c.mul(e.rx)),d=e.center.add(h.mul(e.rx));return Wn(e,u)&&r.push(u),Wn(e,d)&&r.push(d),r}addArcTangencyPoint(t,e){let r=this.arcTangencyPointsMap.get(t)||[];for(let i of r)if(i.equals1(e))return;r.push(e),this.arcTangencyPointsMap.set(t,r)}calculateArcsTangencyPoints(t,e){if(t.rx>e.rx){let d=this.calculateArcsTangencyPoints(e,t);return{arc1Tangency:d.arc2Tangency,arc2Tangency:d.arc1Tangency}}let r=new Array,i=new Array,n=t.rx,s=e.rx,a=t.center.distance1(e.center);if(ne.eq(a,0))return{arc1Tangency:r,arc2Tangency:i};if(ne.eq(n,s)){let d=t.center.sub(e.center).normalize(),p=d.rotate(S.ORIGIN,Math.PI/2),m=d.rotate(S.ORIGIN,-Math.PI/2),g=t.center.add(p.mul(n)),y=t.center.add(m.mul(n)),b=e.center.add(p.mul(s)),P=e.center.add(m.mul(s));if(Wn(t,g)&&r.push(g),Wn(t,y)&&r.push(y),Wn(e,b)&&i.push(b),Wn(e,P)&&i.push(P),ne.greater(a,n+s)){let T=Math.acos(2*n/a),I=d.rotate(S.ORIGIN,T),C=d.rotate(S.ORIGIN,-T),E=t.center.add(I.mul(n)),O=t.center.add(C.mul(n)),_=e.center.add(I.mul(-s)),x=e.center.add(C.mul(-s));Wn(t,E)&&r.push(E),Wn(t,O)&&r.push(O),Wn(e,_)&&i.push(_),Wn(e,x)&&i.push(x)}return{arc1Tangency:r,arc2Tangency:i}}let l=a/(s/n-1);if(ne.greatereq(n,l))return{arc1Tangency:r,arc2Tangency:i};let c=n/l,h=Math.acos(c),u=t.center.sub(e.center).normalize();if(this.calculateArcTangencys(u,h,t,r),this.calculateArcTangencys(u,h,e,i),a>n+s){let d=a/(s/n+1),p=n/d,m=Math.acos(p);this.calculateArcTangencys(u.mul(-1),m,t,r),this.calculateArcTangencys(u,m,e,i)}return{arc1Tangency:r,arc2Tangency:i}}calculateArcTangencys(t,e,r,i){let n=t.rotate(S.ORIGIN,e),s=t.rotate(S.ORIGIN,-e),a=r.center.add(n.mul(r.rx)),l=r.center.add(s.mul(r.rx));Wn(r,a)&&i.push(a),Wn(r,l)&&i.push(l)}collectArcToArcTangencyPoints(){for(let t=0;t<this.ccwArcs.length;t++){let r=this.ccwArcs[t].arc;for(let i=t+1;i<this.ccwArcs.length;i++){let s=this.ccwArcs[i].arc,a=this.calculateArcsTangencyPoints(r,s),l=new Set;for(let c=0;c<a.arc1Tangency.length;c++){let h=a.arc1Tangency[c];for(let u=0;u<a.arc2Tangency.length;u++){let d=a.arc2Tangency[u],p=new M(h,d);this.canMove(p)&&(l.has(h)||(this.addArcTangencyPoint(r,h),l.add(h)),l.has(d)||(this.addArcTangencyPoint(s,d),l.add(d)))}}}}}};var NHe={1:"PREPROCESS",2:"PROJECT_STARTEND",4:"PROJECT_OBSTACLES",8:"SIMPLIFY",16:"TANGENCY",32:"GRAPH_BUILD",64:"DIJKSTRA"},kHe={enabled:!1,stages:127,logEnabled:!0,visualEnabled:!0,timingEnabled:!0,validationEnabled:!0,throwOnValidationError:!1,skippedEdgeEnabled:!0},gX=class extends Error{constructor(e){super(`Graph validation failed with ${e.length} error(s)`);this.validationErrors=e;this.name="GraphValidationError"}};var Qse=class{validate(t,e,r,i,n,s){let a=[],l=[],c=new Map,h=0;for(let d of t){let p=this.nodeKey(d.x,d.y);c.set(p,{inCount:0,outCount:d.edges.length}),h+=d.edges.length}this.checkEdgeIntegrity(t,i,a,c),this.checkBidirectionality(t,a),this.checkIndexConsistency(e,r,a),this.checkNonNegativeWeights(t,a),this.checkIsolatedNodes(c,n,s,l),this.checkGeometryConsistency(t,l);let u=0;return c.forEach(d=>{d.inCount===0&&d.outCount===0&&u++}),{valid:a.length===0,errors:a,warnings:l,stats:{nodeCount:t.length,edgeCount:h,isolatedNodes:u}}}nodeKey(t,e){return`${t.toFixed(6)},${e.toFixed(6)}`}checkEdgeIntegrity(t,e,r,i){for(let s of t)for(let a of s.edges){let l=a.end,c=this.nodeKey(l.x,l.y),h=new ht(l.x-1e-4,l.x+1e-4,l.y-1e-4,l.y+1e-4);if(!e.search(h).some(d=>Math.abs(d.x-l.x)<1e-4&&Math.abs(d.y-l.y)<1e-4))r.push({type:"EDGE_MISSING_END",message:"\u8FB9\u7EC8\u70B9\u8282\u70B9\u4E0D\u5B58\u5728",location:{point:{x:l.x,y:l.y},edge:{start:{x:s.x,y:s.y},end:{x:l.x,y:l.y},len:a.len}}});else{let d=i.get(c);d&&d.inCount++}}}checkBidirectionality(t,e){let i=new Map;for(let n of t)i.set(this.nodeKey(n.x,n.y),n);for(let n of t)for(let s of n.edges){let a=s.end,l=this.nodeKey(a.x,a.y),c=!1,h=i.get(l);if(h){for(let u of h.edges)if(Math.abs(u.end.x-n.x)<1e-4&&Math.abs(u.end.y-n.y)<1e-4){c=!0;break}}if(!c){let u={endNodeExists:h!==void 0,endNodeEdgeCount:h==null?void 0:h.edges.length,endNodeOutgoingEdges:h==null?void 0:h.edges.slice(0,5).map(d=>({to:{x:d.end.x,y:d.end.y},len:d.len}))};e.push({type:"EDGE_MISSING_REVERSE",message:"\u65E0\u5411\u56FE\u7F3A\u5C11\u53CD\u5411\u8FB9",location:{edge:{start:{x:n.x,y:n.y},end:{x:a.x,y:a.y},len:s.len}},diagnosis:u})}}}checkIndexConsistency(t,e,r){e.forEach((n,s)=>{let a=new ht(s.x-1e-4,s.x+1e-4,s.y-1e-4,s.y+1e-4);t.search(a).some(c=>c.equals(s,5))||r.push({type:"INDEX_INCONSISTENT",message:"pointMap \u4E2D\u7684\u70B9\u4E0D\u5728 pointTree \u4E2D",location:{point:{x:s.x,y:s.y}}})})}checkNonNegativeWeights(t,e){for(let r of t)for(let i of r.edges)i.len<-1e-6&&e.push({type:"NEGATIVE_WEIGHT",message:`\u8FB9\u6743\u91CD\u4E3A\u8D1F: ${i.len}`,location:{edge:{start:{x:r.x,y:r.y},end:{x:i.end.x,y:i.end.y},len:i.len}}})}checkIsolatedNodes(t,e,r,i){let n=new Set;for(let s of e)n.add(this.nodeKey(s.x,s.y));for(let s of r)n.add(this.nodeKey(s.x,s.y));t.forEach((s,a)=>{if(!n.has(a)&&s.inCount===0&&s.outCount===0){let[l,c]=a.split(",").map(parseFloat);i.push({type:"ISOLATED_NODE",message:"\u53D1\u73B0\u5B64\u7ACB\u8282\u70B9",location:{point:{x:l,y:c}}})}})}checkGeometryConsistency(t,e){for(let r of t)for(let i of r.edges){if(!(i.pt instanceof M))continue;let n=i.end.x-r.x,s=i.end.y-r.y,a=Math.sqrt(n*n+s*s),l=Math.abs(a-i.len),c=Math.max(i.len*.01,1e-4);l>c&&e.push({type:"GEOMETRY_MISMATCH",message:"\u8FB9\u51E0\u4F55\u957F\u5EA6\u4E0D\u4E00\u81F4",location:{point:{x:r.x,y:r.y}}})}}};var C9e=class{send(t){var i;let e=(i=NHe[t.stage])!=null?i:"UNKNOWN",r=(t.timestamp/1e3).toFixed(3);switch(t.type){case"validation":this.logValidation(t.payload,e,r);break;case"stats":console.log(`[${r}][${e}] Stats:`,t.payload);break;case"skipped_edge":this.logSkippedEdge(t.payload,e,r);break;case"visual":break;default:console.log(`[${r}][${e}]`,t.payload)}}logValidation(t,e,r){console.group(`[${r}][${e}] \u{1F50D} Creepage \u56FE\u9A8C\u8BC1`),t.valid?console.log("\u2705 \u9A8C\u8BC1\u901A\u8FC7",t.stats):(console.error("\u274C \u9A8C\u8BC1\u5931\u8D25"),this.logErrorsWithDiagnosis(t.errors),t.warnings.length>0&&(console.warn("\u26A0\uFE0F \u8B66\u544A"),console.table(t.warnings))),console.groupEnd()}logErrorsWithDiagnosis(t){var e,r;for(let i of t){if(console.group(`${this.getErrorIcon(i.type)} ${i.type}: ${i.message}`),(e=i.location)!=null&&e.edge){let n=i.location.edge;console.log(`\u4F4D\u7F6E: (${n.start.x.toFixed(2)}, ${n.start.y.toFixed(2)}) \u2192 (${n.end.x.toFixed(2)}, ${n.end.y.toFixed(2)}), len=${n.len.toFixed(2)}`)}if(i.diagnosis&&(console.log("\u8BCA\u65AD\u4FE1\u606F:"),console.log(`  \u7EC8\u70B9\u8282\u70B9\u5B58\u5728: ${i.diagnosis.endNodeExists?"\u2713":"\u2717"}`),i.diagnosis.endNodeExists&&(console.log(`  \u7EC8\u70B9\u8282\u70B9\u8FB9\u6570: ${i.diagnosis.endNodeEdgeCount}`),(r=i.diagnosis.endNodeOutgoingEdges)!=null&&r.length))){console.log("  \u7EC8\u70B9\u8282\u70B9\u51FA\u8FB9:");for(let n of i.diagnosis.endNodeOutgoingEdges)console.log(`    \u2192 (${n.to.x.toFixed(2)}, ${n.to.y.toFixed(2)}), len=${n.len.toFixed(2)}`)}console.groupEnd()}}getErrorIcon(t){switch(t){case"EDGE_MISSING_END":return"\u{1F517}";case"EDGE_MISSING_REVERSE":return"\u2194\uFE0F";case"INDEX_INCONSISTENT":return"\u{1F5C3}\uFE0F";case"NEGATIVE_WEIGHT":return"\u2696\uFE0F";default:return"\u274C"}}logSkippedEdge(t,e,r){console.warn(`[${r}][${e}] \u26A0\uFE0F \u8FB9\u88AB\u8DF3\u8FC7: ${t.reason}`);let i=t.primitive;console.log(`  \u56FE\u5143: (${i.start.x.toFixed(2)}, ${i.start.y.toFixed(2)}) \u2192 (${i.end.x.toFixed(2)}, ${i.end.y.toFixed(2)}), len=${i.len.toFixed(2)}`),t.startNode&&console.log(`  \u8D77\u70B9: (${t.startNode.x.toFixed(2)}, ${t.startNode.y.toFixed(2)})`),t.endNode&&console.log(`  \u7EC8\u70B9: (${t.endNode.x.toFixed(2)}, ${t.endNode.y.toFixed(2)})`)}};var yX=class{send(t){}},jR=class jR{constructor(t){this.stageTimers=new Map;this.bridgeExplicitlySet=!1;this.config={...kHe},this.messageBridge=t!=null?t:new yX,this.validator=new Qse}static getInstance(){return jR.instance||(jR.instance=new jR),jR.instance}static setInstance(t){jR.instance=t}configure(t){this.config={...this.config,...t},this.config.enabled?!this.bridgeExplicitlySet&&this.messageBridge instanceof yX&&(this.messageBridge=new C9e):this.messageBridge=new yX}setMessageBridge(t){this.messageBridge=t,this.bridgeExplicitlySet=!0}getConfig(){return this.config}isEnabled(){return this.config.enabled}isStageEnabled(t){return this.config.enabled&&(this.config.stages&t)!==0}isSkippedEdgeEnabled(){return this.config.enabled&&this.config.skippedEdgeEnabled}logSkippedEdge(t,e,r,i){if(!this.config.enabled||!this.config.skippedEdgeEnabled||!this.isStageEnabled(t))return;let n=e.start(),s=e.end();this.send("skipped_edge",t,{reason:r,primitive:{start:{x:n.x,y:n.y},end:{x:s.x,y:s.y},len:n.distance1(s)},...i})}startTimer(t,e){!this.config.enabled||!this.config.timingEnabled||this.isStageEnabled(t)&&(this.stageTimers.set(t,performance.now()),this.log(t,`\u5F00\u59CB${e!=null?e:""}`))}endTimer(t,e){if(!this.config.enabled||!this.config.timingEnabled||!this.isStageEnabled(t))return 0;let r=this.stageTimers.get(t);if(r!==void 0){let i=performance.now()-r;return this.logStats(t,{[`${e!=null?e:"duration"}(ms)`]:i.toFixed(2)}),this.stageTimers.delete(t),i}return 0}log(t,e){!this.config.enabled||!this.config.logEnabled||this.isStageEnabled(t)&&this.send("log",t,e)}logStats(t,e){!this.config.enabled||!this.config.logEnabled||this.isStageEnabled(t)&&this.send("stats",t,e)}validateGraphFromMap(t,e,r,i,n,s){if(!this.config.enabled||!this.config.validationEnabled)return{valid:!0,errors:[],warnings:[],stats:{nodeCount:0,edgeCount:0,isolatedNodes:0}};let a=[],l=t.entries();for(;l.hasNext();){let c=l.next();a.push({x:c.key.x,y:c.key.y,edges:c.value})}return this.validateGraph(a,e,r,i,n,s)}validateGraph(t,e,r,i,n,s){if(!this.config.enabled||!this.config.validationEnabled)return{valid:!0,errors:[],warnings:[],stats:{nodeCount:0,edgeCount:0,isolatedNodes:0}};let a=this.validator.validate(t,e,r,i,n,s);if(this.isStageEnabled(32)&&(this.send("stats",32,{nodes:a.stats.nodeCount,edges:a.stats.edgeCount,isolatedNodes:a.stats.isolatedNodes}),this.send("validation",32,a)),!a.valid&&this.config.throwOnValidationError)throw new gX(a.errors);return a}logValidation(t){if(this.config.enabled&&(this.send("validation",32,t),!t.valid&&this.config.throwOnValidationError))throw new gX(t.errors)}visualPoints(t,e,r){if(!this.config.enabled||!this.config.visualEnabled||!this.isStageEnabled(t))return;let i={tag:e,points:r.map(n=>[n.x,n.y])};this.send("visual",t,i)}visualLines(t,e,r){if(!this.config.enabled||!this.config.visualEnabled||!this.isStageEnabled(t))return;let i={tag:e,lines:r.map(n=>({x1:n.start().x,y1:n.start().y,x2:n.end().x,y2:n.end().y}))};this.send("visual",t,i)}visualArcs(t,e,r){if(!this.config.enabled||!this.config.visualEnabled||!this.isStageEnabled(t))return;let i={tag:e,arcs:r.map(n=>({cx:n.center.x,cy:n.center.y,r:n.rx,startAngle:n.startAngle,endAngle:n.startAngle+n.sweepAngle}))};this.send("visual",t,i)}visualPrimitives(t,e,r){if(!this.config.enabled||!this.config.visualEnabled||!this.isStageEnabled(t))return;let i=[],n=[];for(let a of r)a instanceof M?i.push({x1:a.start().x,y1:a.start().y,x2:a.end().x,y2:a.end().y}):a instanceof q&&n.push({cx:a.center.x,cy:a.center.y,r:a.rx,startAngle:a.startAngle,endAngle:a.startAngle+a.sweepAngle});let s={tag:e,lines:i,arcs:n};this.send("visual",t,s)}visualPolyline(t,e,r){this.visualPrimitives(t,e,r.primitives)}visualBBox(t,e,r){if(!this.config.enabled||!this.config.visualEnabled||!this.isStageEnabled(t))return;let i={tag:e,bboxes:[{minX:r.minX,minY:r.minY,maxX:r.maxX,maxY:r.maxY}]};this.send("visual",t,i)}visualPath(t,e,r){this.visualPrimitives(t,e,r)}stageStart(t,e){this.startTimer(t,e)}stageEnd(t,e){this.endTimer(t,e)}clear(){this.stageTimers.clear()}send(t,e,r){let i={type:t,stage:e,payload:r,timestamp:performance.now()};this.messageBridge.send(i)}};jR.instance=null;var S9e=jR,cu=S9e.getInstance();var bX=class extends S{constructor(t){super(t.x,t.y),this.point=t}bbox(){return super.bbox().extendOfSize(1e-4)}},eae=class o{constructor(t,e,r,i=!1){this.cost=0;this.mark=!1;this.start=t,this.end=e,this.pt=r,this.len=r.length(),this.isReverse=i}reverse(){return new o(this.end,this.start,this.pt,!this.isReverse)}},BHe=(o,t)=>o.cost-t.cost,tae=class{constructor(t){this.obstacleTree=new ji(7);this.edgeMapSource=new Map;this.simplifyMap=new Map;this.solidMap=new Map;this.newMapOld=new Map;this.simplifyMapnewEdge=new Map;this.changedOldPrimitives=new Set;this.originMapSplit=new Map;this.obstaclesTangencys=new Map;this.pointTree=new Lb(5);this.pointMap=new Map;this.queue=new O3(BHe);this.nodeMap=new ji(5);this.graph=new hd;let e=t.items,r=t.getOutMostPolyline(),i=e.map(n=>n!=r);this.preprocessor=new Jse(e,i),this.preprocessor.preprocess(),r=this.preprocessor.getOutline();for(let n of this.preprocessor.getAllPolyline()){for(let s of n.primitives)this.obstacleTree.add(s),this.edgeMapSource.set(s,n);n==r?this.solidMap.set(n,!1):this.solidMap.set(n,!0)}}getPrimitiveTree(t){let e=new ji(7);for(let r of t)for(let i of r.primitives)e.add(i);return e}creepageDistance(t,e,r){cu.stageStart(1,"creepageDistance"),t.area()>0&&(t=t.reverse()),e.area()>0&&(e=e.reverse()),this.pointTree=new Lb(5),this.pointMap=new Map,this.queue=new O3(BHe),this.nodeMap=new ji(5),this.graph=new hd,cu.visualPolyline(1,"start_polyline",t),cu.visualPolyline(1,"end_polyline",e),cu.logStats(1,{clearance:r});let i=t.bbox().extendOfSize(r).intersect(e.bbox().extendOfSize(r));if(i==null)return cu.log(1,"interBBox \u4E3A\u7A7A\uFF0C\u63D0\u524D\u8FD4\u56DE"),null;cu.visualBBox(1,"interBBox",i),cu.stageEnd(1);let{obstaclesEdges:n,obstacles:s,isSolid:a}=this.search(i);cu.logStats(1,{obstaclesEdges:n.length,obstacles:s.length});let l=[this.getPrimitiveTree([t,e]),this.obstacleTree];cu.stageStart(2);let c=this.projectStartEnd(t,e,l,r,i);c!=null&&(this.addMap(c),cu.visualLines(2,"minLine",[c]),r=c.length(),i=t.bbox().extendOfSize(r).intersect(e.bbox().extendOfSize(r)),n=this.search(i).obstaclesEdges),cu.stageEnd(2),cu.stageStart(4);let h=this.project(t,n,l,r,i),u=this.project(e,n,l,r,i);c!=null&&(u.push(c.end()),h.push(c.start())),h=this.removeRepeat(h),u=this.removeRepeat(u),cu.visualPoints(4,"project_starts",h),cu.visualPoints(4,"project_ends",u),cu.logStats(4,{startPoints:h.length,endPoints:u.length}),cu.stageEnd(4),cu.stageStart(8),s.map(y=>this.getSimplify(y)),cu.stageEnd(8),cu.stageStart(16);let d=s.filter(y=>this.solidMap.get(y));for(let y=0,b=d.length;y<b;y++){for(let T=y+1;T<b;T++){let I=this.getSimplifysTangency(d[y],d[T]);for(let C of I)i.isContainsBBox(C.bbox())&&(this.addMap(C),this.addMap(C.reverse()))}let P=this.simplifyMapnewEdge.get(this.simplifyMap.get(d[y]));if(P!=null)for(let T of P)i.isContainsBBox(T.bbox())&&this.addMap(T)}cu.stageEnd(16);let p=this.splitOld(s),m=new Map;for(let y of h)m.set(y,!0);for(let y of u)m.set(y,!1);m.size>0&&this.checkPoint(m,p,a,r,i,l);for(let y of p)for(let b of y.primitives)i.isContainsBBox(b.bbox())&&this.addMap(b);cu.stageStart(32);for(let[y]of this.pointMap)this.nodeMap.add(new bX(y));for(let y of h)this.nodeMap.add(new bX(y));for(let y of u)this.nodeMap.add(new bX(y));for(let[y,b]of this.pointMap){let P=this.getNode(y);if(P!=null)for(let T of b){let I=T.end(),C=this.getNode(I);if(C==null){cu.logSkippedEdge(32,T,"END_NODE_NOT_FOUND",{startNode:y,endNode:I});continue}let E=new eae(P,C,T),O=new eae(C,P,T,!0);this.graph.computeIfAbsent(P,_=>new Array).push(E),this.graph.computeIfAbsent(C,_=>new Array).push(O)}}cu.validateGraphFromMap(this.graph,this.pointTree,this.pointMap,this.nodeMap,h,u),cu.stageEnd(32),cu.stageStart(64);let g=this.find(h,u,r);return cu.stageEnd(64),g}getAll(){let t=new Array;for(let[e,r]of this.pointMap)for(let i of r)t.push(i);return t}find(t,e,r){let i=new Array;for(let a of t){let l=this.graph.get(this.getNode(a));l!=null&&xe.addAll(i,l)}let n=new Set;for(let a of i)a.cost=a.len,this.queue.add(a),n.add(a);let s=0;for(;this.queue.size()>0;){let a=this.queue.poll();if(a.mark=!0,s++,this.isEnd(a.end,e)){let c=this.connect(a);return cu.visualPath(64,"result_path",c),cu.logStats(64,{iterations:s,pathLength:a.cost,pathSegments:c.length,found:"true"}),a}let l=this.findNeighbor(a);for(let c of l){let h=a.cost+c.len;(c.cost==0||h<c.cost)&&(c.cost=h,c.prev=a),n.has(c)&&this.queue.remove(c),ne.lesseq(c.cost,r)&&this.queue.add(c),n.add(c)}}return cu.logStats(64,{iterations:s,found:"false"}),null}isEnd(t,e){for(let r of e)if(r.equals1(t))return!0;return!1}connect(t){let e=new Array;for(;t!=null;)t.isReverse?e.push(t.pt.reverse()):e.push(t.pt),t=t.prev;return e.reverse()}getNode(t){let e=this.nodeMap.search(t.bbox().extendOfSize(1e-4));for(let r of e)if(r.equals(t,5))return r;return null}search(t){let e=new Array,r=new Set;if(t==null)return{obstaclesEdges:e,obstacles:[],isSolid:[]};let i=this.obstacleTree.search(t);for(let a of i)e.push(a),r.add(this.edgeMapSource.get(a));let n=Array.from(r),s=n.map(a=>this.solidMap.get(a));return{obstaclesEdges:e,obstacles:n,isSolid:s}}project(t,e,r,i,n){return new eV(t,e,r,i,n).points}projectStartEnd(t,e,r,i,n){let s=new eV(t,e.primitives,r,i,n,!0),a=this.filterTangency(s.result),l=Number.MAX_SAFE_INTEGER,c;for(let d of a){let p=d.length();p<l&&(l=p,c=d)}i>l&&(i=l);let h=new eV(e,t.primitives,r,i,n,!0),u=this.filterTangency(h.result);for(let d of u){let p=d.length();p<l&&(l=p,c=d.reverse())}return c}getSimplify(t){let e=this.simplifyMap.get(t);if(e==null){let r=new $se,i=r.simplifyOnePolygon(t);for(let[a,l]of r.newMapOld)this.newMapOld.set(a,l),this.changedOldPrimitives.add(l);let n=new Array;for(let a of i)r.newMapOld.has(a)||n.push(a);e=ge.build2(i),this.simplifyMap.set(t,e);let s=this.filterTangency(n);this.simplifyMapnewEdge.set(e,s)}return e}getCacheSimplifysTangency(t,e){let r=this.obstaclesTangencys.get(t);if(r!=null)return r.get(e);{let i=this.obstaclesTangencys.get(e);return i!=null?i.get(t):null}}setCacheSimplifysTangency(t,e,r){let i=this.obstaclesTangencys.get(t);i==null&&(i=new Map,this.obstaclesTangencys.set(t,i)),i.set(e,r)}getSimplifysTangency(t,e){let r=this.getCacheSimplifysTangency(t,e);if(r!=null)return r;let i=this.getSimplify(t),n=this.getSimplify(e),a=new Kse().getTangency(i,n),l=this.dealTangency(a,i,n);this.simplifyMap.set(t,l.left),this.simplifyMap.set(e,l.right);let c=this.simplifyMapnewEdge.get(i),h=this.simplifyMapnewEdge.get(n);this.simplifyMapnewEdge.set(l.left,c),this.simplifyMapnewEdge.set(l.right,h);let u=this.filterTangency(this.getLine(a));return this.setCacheSimplifysTangency(t,e,u),u}filterTangency(t,e=r=>this.obstacleTree.search(r)){let r=new Array;e:for(let i of t){let n=i.bbox(),s=e(n);for(let a of s){let l=Pt(i,a);for(let c=0;c<l;c+=2){let h=new S(Ee[c],Ee[c+1]);if(!h.equals1(i.start())&&!h.equals1(i.end()))continue e}}r.push(i)}return r}getLine(t){let e=[];for(let r of t)e.push(new M(r.start,r.end));return e}dealTangency(t,e,r){let i=new Map,n=new Map;for(let s of t)this.add2Map(s.leftIndex,s.start,i),this.add2Map(s.rightIndex,s.end,n);return e=this.splitPolyline(i,e),r=this.splitPolyline(n,r),{left:e,right:r}}splitPolyline(t,e){let r=new Map;for(let[n,s]of t){let a=e.primitives[n];an(s,a);let l=oR(a,s);this.replaceMap(a,l),r.set(n,l)}let i=new Array;for(let n=0,s=e.primitives.length;n<s;n++){let a=r.get(n);a!=null?i.push(...a):i.push(e.primitives[n])}return ge.build2(i)}replaceMap(t,e){let r=this.newMapOld.get(t);if(r!=null){this.newMapOld.delete(t),this.changedOldPrimitives.add(r);for(let i of e)this.newMapOld.set(i,r)}}add2Map(t,e,r){let i=r.get(t);i==null&&(i=[],r.set(t,i)),i.push(e)}isCollide(t,e){let r=t.bbox(),i=e.search(r);for(let n of i)if(Pt(t,n)>0)return!0;return!1}splitOld(t){if(this.changedOldPrimitives.size===0){let i=[],n=!0;for(let s of t){let a=this.originMapSplit.get(s);if(a!=null)i.push(a);else{n=!1;break}}if(n)return i}let e=new Map;for(let[i,n]of this.newMapOld){let s=i.start(),a=i.end();for(let l of[s,a])if(!l.equals1(n.start())&&!l.equals1(n.end())){let c=e.get(n);c==null&&(c=[],e.set(n,c)),c.push(l)}}let r=new Array;for(let i of t){let n=new Array;for(let a of i.primitives){let l=e.get(a);if(l==null)n.push(a);else{an(l,a),l=this.removeRepeat(l);let c=oR(a,l);n.push(...c)}}let s=ge.build2(n);this.originMapSplit.set(i,s),r.push(s)}return this.changedOldPrimitives.clear(),r}removeRepeat(t){let e=new Array,r=new ji(7);for(let n of t)r.add(n);let i=new Set;for(let n of t){if(i.has(n))continue;let s=r.search(n.bbox().extendOfSize(1e-6));for(let a of s)i.add(a);e.push(n)}return e}getConvexArcs(t,e,r){let i=new Array;for(let n=0;n<t.length;n++){let s=t[n],a=e[n];for(let l of s.primitives)l instanceof q&&(a?!l.isCCW:l.isCCW)&&!r.isSeparated(l.bbox())&&i.push(l)}return i}checkPoint(t,e,r,i,n,s){let a=new Zse(this.preprocessor),l=a.calculateTangency(t,i,n,this.getConvexArcs(e,r,n));l=this.filterTangency(l,h=>{let u=new Array;for(let d of s)xe.addAll(u,d.search(h));return u});let c=new Map;for(let h of l)if(n.isContainsBBox(h.bbox())){this.addMap(h);let u=h.start(),d=h.end(),p=[];t.has(u)||p.push(u),t.has(d)||p.push(d);for(let m of p){let g=a.tangencyMap.get(m);if(g!=null){for(let y of g)if(!y.start().equals1(m)&&!y.end().equals1(m)){let b=c.get(y);b==null&&(b=[],c.set(y,b)),b.push(m)}}}}if(c.size>0)for(let h=0,u=e.length;h<u;h++){let d=e[h],p=new Array;for(let g of d.primitives){let y=c.get(g);if(y==null)p.push(g);else{an(y,g);let b=oR(g,y);p.push(...b)}}let m=ge.build2(p);e[h]=m}}addMap(t){let e=this.getPoint(t.start());e==null&&(e=t.start(),this.pointTree.insert(e));let r=this.pointMap.get(e);r==null&&(r=new Array,this.pointMap.set(e,r));for(let i of r)if(i instanceof M&&t instanceof M){if(i.equals2(t))return}else if(i instanceof q&&t instanceof q&&i.equals1(t))return;r.push(t)}getPoint(t){let e=this.pointTree.search(t.bbox().extendOfSize(1e-4));for(let r of e)if(r.equals(t,5))return r;return null}findNeighbor(t){let e=this.graph.get(t.end),r=new Array;if(e!=null)for(let i of e)i.mark||t.pt==i.pt||r.push(i);return r}};var rae=class{constructor(t,e,r,i,n,s,a){this.path=t;this.model1=e;this.layerId1=r;this.model2=i;this.layerId2=n;this.rule=s;this.dis=a}getErrorInfo(){let t=this.path[0].start().add(this.path[this.path.length-1].end()).mul(.5);return{shape1:this.model1,shape2:this.model2,position:t,realDistance:this.dis,ruleDistance:this.rule.clearance,ruleName:this.rule.rule.name,ruleType:"Creepage Distance",layers:[this.model1.layerId,this.model2.layerId],path:this.path}}};var PX=class{constructor(){this.minDistance=1/0;this.bestPoints=null;this.currentClearance=1/0;this.currentInterBBox=null;this.originalStart=null;this.originalEnd=null;this.obstaclesEdges=new i2(7)}calculateReflectionPath(t,e,r,i){if(this.minDistance=1/0,this.bestPoints=null,this.currentClearance=i,this.originalStart=e,this.originalEnd=r,this.obstaclesEdges=new i2(7),this.currentInterBBox=e.bbox().extendOfSize(i).intersect(r.bbox().extendOfSize(i)),this.currentInterBBox==null)return this.bestPoints;let{obstaclesEdges:n}=t.search(this.currentInterBBox);this.obstaclesEdges=this.getPrimitiveTree(n);for(let s of e.primitives)if((s instanceof M||s instanceof q)&&!(this.currentInterBBox&&this.currentInterBBox.isSeparated(s.bbox()))){for(let a of r.primitives)if(!(!(a instanceof M||a instanceof q)||this.currentInterBBox&&this.currentInterBBox.isSeparated(a.bbox())||this.estimateMinDistance(s,a)>this.currentClearance))for(let c of n)(c instanceof M||c instanceof q)&&(this.currentInterBBox&&!this.currentInterBBox.isIntersect(c.bbox())||this.processEdgeCombination(s,a,c))}return this.bestPoints}getPrimitiveTree(t){let e=new i2(7);for(let r of t)e.add(r);return e}estimateMinDistance(t,e){return new er(t,e).getDistance()}processEdgeCombination(t,e,r){r instanceof M?this.processWithLineMirror(t,e,r):this.processWithArcMirror(t,e,r)}processWithLineMirror(t,e,r){let i=this.mirrorEdgeAboutLine(t,r),{point1:n,point2:s,distance:a}=this.findClosestPointsBetweenEdges(i,e);if(a>this.currentClearance)return;let l=this.findReflectionPointOnLine(r,i,n,s,e);if(!l||this.currentInterBBox&&!this.currentInterBBox.isContains(l))return;let c=this.findClosestPointOnEdge(i,l),h=this.findClosestPointOnEdge(e,l),u=this.reflectPointAboutLine(c,r);if(!this.validateLineIntersectsEdge(new M(u,l),r))return;let d=u.distance1(l)+l.distance1(h);d>this.currentClearance||this.updateBestResult(d,u,h,l)}isValid(t){for(let e of t){let r=e.bbox(),i=this.obstaclesEdges.search(r);for(let n of i){let s=Pt(e,n);for(let a=0;a<s;a+=2){let l=new S(Ee[a],Ee[a+1]);if(!l.equals1(e.start())&&!l.equals1(e.end()))return!1}}}return!0}findReflectionPointOnLine(t,e,r,i,n){let s=this.findDirectIntersection(t,r,i);return s||this.ternarySearchOnLine(t,e,n)}findDirectIntersection(t,e,r){if(Y9(new M(e,r),t)>0){let n=new S(Ee[0],Ee[1]);if(LP(t,n)>0)return n}return null}processWithArcMirror(t,e,r){if(this.estimateMinDistance(t,e)>this.currentClearance)return;let n=this.ternarySearchOnArc(r,t,e);if(n){if(this.currentInterBBox&&!this.currentInterBBox.isContains(n.reflectionPoint)||n.distance>this.currentClearance)return;this.updateBestResult(n.distance,n.pointA,n.pointB,n.reflectionPoint)}}ternarySearchOnLine(t,e,r){let i=t.start(),n=t.length();if(n<1e-8)return t.start();let s=t.direct,a=1e-6,l=c=>{let h=i.add(s.mul(c)),u=this.findClosestPointOnEdge(e,h),d=this.findClosestPointOnEdge(r,h);return u.distance1(h)+h.distance1(d)};return this.executeTernarySearch1D(0,n,l,a,i,s)}ternarySearchOnArc(t,e,r){let[i,n]=this.getArcSearchRange(t),s=1e-5,a=l=>{let c=t.pointOn(l),h=this.findClosestPointOnEdge(e,c),u=this.findClosestPointOnEdge(r,c);return{distance:h.distance1(c)+c.distance1(u),pointA:h,pointB:u,reflectionPoint:c}};return this.executeTernarySearchOnArc(i,n,a,s)}getArcSearchRange(t){let e=t.startAngle,r=t.endAngle();return t.sweep()===ae.CW&&([e,r]=[r,e]),r<e&&(r+=2*Math.PI),[e,r]}executeTernarySearch1D(t,e,r,i,n,s){let a=0,l=r(0),c=r(e);for(c<l&&(a=e,l=c);e-t>i;){let h=(e-t)/3,u=t+h,d=e-h,p=r(u),m=r(d);p<m?(e=d,p<l&&(a=u,l=p)):(t=u,m<l&&(a=d,l=m))}return n.add(s.mul(a))}executeTernarySearchOnArc(t,e,r,i){let n=r(t),s=r(e);for(s.distance<n.distance&&(n=s);e-t>i;){let a=(e-t)/3,l=t+a,c=e-a,h=r(l),u=r(c);h.distance<u.distance?(e=c,h.distance<n.distance&&(n=h)):(t=l,u.distance<n.distance&&(n=u))}return n}reflectPointAboutLine(t,e){let r=e.start(),n=e.end().sub(r),s=new S(-n.y,n.x).normalize(),l=t.sub(r).dot(s);return t.sub(s.mul(2*l))}mirrorEdgeAboutLine(t,e){if(t instanceof M)return new M(this.reflectPointAboutLine(t.start(),e),this.reflectPointAboutLine(t.end(),e));{let r=this.reflectPointAboutLine(t.center,e);if(t.isCircle())return q.build2(r,0,360,t.rx,t.ry,t.sweep());let i=this.reflectPointAboutLine(t.start(),e),n=this.reflectPointAboutLine(t.end(),e),s=t.isCCW?ae.CW:ae.CCW;return q.build4(i,n,r,t.rx,t.ry,s)}}findClosestPointOnEdge(t,e){if(t instanceof M){let r=t.start(),i=t.direct,n=t.length(),s=r.add(i.mul(e.sub(r).dot(i))),a=e.sub(r).dot(i);return a<0?r:a>n?t.end():s}else{let r=t.center.add(e.sub(t.center).normalize().mul(t.rx));if($f(t,r))return r;let i=e.distance1(t.start()),n=e.distance1(t.end());return i<n?t.start():t.end()}}findClosestPointsBetweenEdges(t,e){let r=new er(t,e),i=r.getLine();return{point1:i.start(),point2:i.end(),distance:r.getDistance()}}validateLineIntersectsEdge(t,e){if(e instanceof M){if(Y9(t,e)>0){let i=new S(Ee[0],Ee[1]);return LP(e,i)>0}return!1}else{let r=Pt(t,e);for(let i=0;i<r;i+=2){let n=new S(Ee[i],Ee[i+1]);if($f(e,n))return!0}return!1}}updateBestResult(t,e,r,i){let n=[new M(e,i),new M(i,r)];t<this.minDistance&&this.isValid(n)&&(this.minDistance=t,this.bestPoints={distance:t,pointA:e,pointB:r,reflectionPoint:i},t<this.currentClearance&&(this.currentClearance=t,this.originalStart&&this.originalEnd&&(this.currentInterBBox=this.originalStart.bbox().extendOfSize(t).intersect(this.originalEnd.bbox().extendOfSize(t)))))}};var tV=class{getRuleInfos(t,e){let r=$i.getInstance(),i=r.ruleHelper.getRuleItem(t),n=r.ruleHelper.getRuleItem(e),s=r.ruleHelper.generateConstraints("creepage",i,n);return s instanceof cI?r.ruleHelper.getCreepageRuleInfos(i,n,s):r.ruleHelper.getCreepageRuleInfos(i,n)}};var iae=class{constructor(t,e,r){this._rtree=null;this.model=t,this.layerId=e,this.outline=r,this._bbox=t.bbox}bbox(){return this._bbox}getRTree(){if(this.outline instanceof ge)return null;if(this._rtree===null){this._rtree=new ji(7);for(let t of this.outline.items)this._rtree.add(t)}return this._rtree}searchRTree(t,e=0){let r=this.getRTree();return r?r.search(t.extendOfSize(e)):this.outline instanceof ge&&!t.extendOfSize(e).isSeparated(this.outline.bbox())?[this.outline]:[]}},TX=class{constructor(t){this.layerIds=Ze.getInstance().getAllCopperLayerId4Order();this.outlineCache=new Map;this.typeInfoCache=new Map;this.strokeRTreeCache=new Map;this.layerThicknessCache=new Map;this.sortedPhysLayers=null;this.layerIdToIndex=new Map;this.currentLayerThickness=0;this.context=void 0;this.ruleHelper=new tV;this.debugCb=void 0;this.creepageAl=new tae(t)}setDebugCb(t){this.debugCb=t}display(){if(this.debugCb!=null){let t=this.creepageAl.getAll();this.debugCb(t)}}initPhysLayersCache(){if(this.sortedPhysLayers!==null)return;let t=Ze.getInstance();this.sortedPhysLayers=t.getLayerPhys(),this.layerIdToIndex.clear();for(let e=0;e<this.sortedPhysLayers.length;e++)this.layerIdToIndex.set(this.sortedPhysLayers[e].layerId,e)}getLayerThickness(t,e){if(t===e)return 0;let r=t<e?`${t}_${e}`:`${e}_${t}`,i=this.layerThicknessCache.get(r);if(i!==void 0)return i;let n=this.calculateLayerThickness(t,e);return this.layerThicknessCache.set(r,n),n}calculateLayerThickness(t,e){this.initPhysLayersCache();let r=this.layerIdToIndex.get(t),i=this.layerIdToIndex.get(e);if(r===void 0||i===void 0)return 0;let n=Math.min(r,i),s=Math.max(r,i),a=0;for(let l=n+1;l<s;l++)a+=this.sortedPhysLayers[l].thickness;return a}clearLayerThicknessCache(){this.layerThicknessCache.clear(),this.sortedPhysLayers=null,this.layerIdToIndex.clear()}calculate(t,e){if(t.cluster1.bbox.extendOfSize(e).isSeparated(t.cluster2.bbox))return null;let i={minConstraint:e,bestResult:null,bestRuleInfo:null,bestResultType:null},n=this.buildLayerData(t.cluster1.models,t.nearestEndpoints[0].id),s=this.buildLayerData(t.cluster2.models,t.nearestEndpoints[1].id);this.calculateFromNearestEndpoints(n,s,i),this.currentLayerThickness=0;for(let a of this.layerIds){let l=n.layerMap.get(a),c=s.layerMap.get(a);!l||!c||l.length===0||c.length===0||this.calculateBetweenLayers(l,c,!0,i)}for(let a of this.layerIds){let l=n.layerMap.get(a);if(!(!l||l.length===0))for(let c of this.layerIds){if(a===c)continue;let h=s.layerMap.get(c);!h||h.length===0||(this.currentLayerThickness=this.getLayerThickness(a,c),this.calculateBetweenLayers(l,h,!1,i))}}if(i.bestResult&&i.bestRuleInfo){if(t.actualDistance=i.bestResult.distance,ne.less(i.bestResult.distance,i.bestRuleInfo.clearance)){let a=new rae(i.bestResult.path,i.bestResult.model1,i.bestResult.layerId1,i.bestResult.model2,i.bestResult.layerId2,i.bestRuleInfo,i.bestResult.distance);return t.checkResult=a,a}return null}else return null}measure(t,e,r){let i={minConstraint:r,bestResult:null,bestRuleInfo:null,bestResultType:null},n=this.buildLayerData(new Set([t]),t.globalIndex),s=this.buildLayerData(new Set([e]),e.globalIndex);if(this.calculateFromNearestEndpoints(n,s,i),i.bestResult==null){let a=Math.min(t.bbox.center().distance1(e.bbox.center()),this.getMaxDistance());for(;a<=r&&(i.minConstraint=a,this.calculateFromNearestEndpoints(n,s,i,!0),!(a==r||i.bestResult!=null));)a=Math.min(a*2+1,r)}return i}getMaxDistance(){let t=0;for(let e of re.getInstance().getAllCreepageSpacing())e.creepageDistance>t&&(t=e.creepageDistance);return t}calculateFromNearestEndpoints(t,e,r,i=!1){for(let[n,s]of t.layerToItem)for(let[a,l]of e.layerToItem){let c=n===a;this.currentLayerThickness=this.getLayerThickness(n,a);let h=this.calculatePair(s,l,r.minConstraint,c,r,i);h&&(r.bestResult===null||h.distance<r.bestResult.distance)&&(r.bestResult=h,r.bestRuleInfo=h.ruleInfo,r.minConstraint=h.distance,r.bestResultType=h.pathType)}}calculateBetweenLayers(t,e,r,i){let n=this.buildRTree(e);for(let s of t){let a=s.model.bbox.extendOfSize(i.minConstraint),l=n.search(a),c=i.minConstraint,h=a;for(let u of l){if(i.bestResult&&c!==i.bestResult.distance&&!h.isIntersect(u.bbox()))continue;let d=this.calculatePair(s,u,i.minConstraint,r,i);d&&(i.bestResult===null||d.distance<i.bestResult.distance)&&(i.bestResult=d,i.bestRuleInfo=d.ruleInfo,i.minConstraint=d.distance,i.bestResultType=d.pathType,h=s.model.bbox.extendOfSize(i.minConstraint))}}}buildLayerData(t,e){let r=new Map,i=new Map;for(let n of t)if(ar(n.layerId))for(let s of this.layerIds){let a=this.getOutline(n,s);if(!a)continue;let l=new iae(n,s,a),c=r.get(s)||[];c.push(l),r.set(s,c),n.globalIndex==e&&!i.has(s)&&i.set(s,l)}else{let s=this.getOutline(n,n.layerId);if(!s)continue;let a=new iae(n,n.layerId,s),l=r.get(n.layerId)||[];l.push(a),r.set(n.layerId,l),n.globalIndex==e&&i.set(n.layerId,a)}return{layerMap:r,layerToItem:i}}buildRTree(t){let e=new $u(10);for(let r of t)e.insert(r);return e}calculatePair(t,e,r,i,n,s=!1){this.context=n;let a=this.getShapeTypeInfo(t.model,t.layerId),l=this.getShapeTypeInfo(e.model,e.layerId),c=this.ruleHelper.getRuleInfos(t.model,e.model);if(!s&&!c||!s&&c.clearance<=0||!s&&c.rule instanceof cI&&c.rule.ignoreLayer&&(Es(t.layerId)||Es(e.layerId)))return null;if(i){let u=jc.getCache(t.model,t.layerId),d=jc.getCache(e.model,e.layerId);if(u&&d){let p=new FI,m=p.checkCache(u,d,0);if(m&&m.relate!==3){let g=p.adjustCollisionLine(m.line,u,d);return{distance:0,path:g?[g]:[],model1:t.model,layerId1:t.layerId,model2:e.model,layerId2:e.layerId,ruleInfo:c,pathType:"creepage"}}}}if(r=s?r:Math.min(r,c.clearance),a.isTrack){if(l.isTrack)return this.simpleCreepage(t,e,r,i,c);if(l.isPad)return this.simpleCreepage(t,e,r,i,c);if(l.isVia)return this.simpleCreepage(t,e,r,i,c);if(l.isProfile)return this.calculateToProfile(t,e,r,i,c);if(l.isFill)return this.calculateToPlane(t,e,r,i,c)}if(a.isPad){if(l.isTrack)return this.simpleCreepage(t,e,r,i,c);if(l.isPad)return this.simpleCreepage(t,e,r,i,c);if(l.isVia)return this.simpleCreepage(t,e,r,i,c);if(l.isProfile)return this.calculateToProfile(t,e,r,i,c);if(l.isFill)return this.calculateToPlane(t,e,r,i,c)}if(a.isVia){if(l.isTrack)return this.simpleCreepage(t,e,r,i,c);if(l.isPad)return this.simpleCreepage(t,e,r,i,c);if(l.isVia)return this.simpleCreepage(t,e,r,i,c);if(l.isProfile)return this.calculateToProfile(t,e,r,i,c);if(l.isFill)return this.calculateToPlane(t,e,r,i,c)}if(a.isProfile){if(l.isTrack)return this.calculateToProfile(e,t,r,i,c);if(l.isPad)return this.calculateToProfile(e,t,r,i,c);if(l.isVia)return this.calculateToProfile(e,t,r,i,c);if(l.isProfile)return this.calculateProfiles(t,e,r,i,c);if(l.isFill)return this.calculateProfilePlane(t,e,r,i,c)}if(a.isFill){if(l.isTrack)return this.calculateToPlane(e,t,r,i,c);if(l.isPad)return this.calculateToPlane(e,t,r,i,c);if(l.isVia)return this.calculateToPlane(e,t,r,i,c);if(l.isProfile)return this.calculateProfilePlane(e,t,r,i,c);if(l.isFill)return this.calculatePlanes(t,e,r,i,c)}let h=this.creepage(t.outline,e.outline,r,i);return h?{distance:h.dis,path:h.path,model1:t.model,layerId1:t.layerId,model2:e.model,layerId2:e.layerId,ruleInfo:c,pathType:h.type}:null}getOutline(t,e){let r=`${t.globalIndex}_${e}`,i=this.outlineCache.get(r);if(i)return i;let n=t.getMathGraphics(e);return n&&this.outlineCache.set(r,n),n}getShapeTypeInfo(t,e){let r=`${t.globalIndex}_${e}`,i=this.typeInfoCache.get(r);if(i)return i;let n={isTrack:t instanceof gt,isVia:t instanceof Ct,isPad:t instanceof et,padShapeType:null,isProfile:t instanceof or,profileType:null,isCircleProfile:!1,isFill:t instanceof jl};if(n.isPad){let s=this.getPadStyleByLayer(t,e);s&&(n.padShapeType=s.type)}if(n.isProfile){let s=t;n.profileType=s.type,n.isCircleProfile=s.modelType==="Circle"}return this.typeInfoCache.set(r,n),n}getPadStyleByLayer(t,e){var r;return t.isUnuseLayer&&t.isUnuseLayer(e)?null:(r=t.getPad(e))!=null?r:null}isCircleProfile(t){return t instanceof or&&t.modelType==="Circle"}getOvalParamsFromStyle(t,e){let{width:r,height:i}=t;if(Math.abs(r-i)<1e-8)return{line:null,center:e,radius:r/2};if(r>i){let n=(r-i)/2,s=e.add(new S(-n,0)),a=e.add(new S(n,0));return{line:new M(s,a),center:e,radius:i/2}}else{let n=(i-r)/2,s=e.add(new S(0,-n)),a=e.add(new S(0,n));return{line:new M(s,a),center:e,radius:r/2}}}calculateCircleToCircle(t,e,r,i){let n=t.distance1(r);if(n<1e-8)return null;let s=Math.max(0,n-e-i),a=r.sub(t).normalize(),l=t.add(a.mul(e)),c=r.sub(a.mul(i));return{distance:s,line:new M(l,c)}}calculateOvalToCircle(t,e,r){let{line:i,center:n,radius:s}=t;if(i==null)return this.calculateCircleToCircle(n,s,e,r);let a=Eu.foot(i,e),l=e.distance1(a),c=s+r;if(i.bbox().extendOfSize(1e-8).isContains(a)){let p=Math.max(0,l-c),m=e.sub(a).normalize(),g=a.add(m.mul(s)),y=e.sub(m.mul(r));return{distance:p,line:new M(g,y)}}let u=e.distance1(i.start()),d=e.distance1(i.end());if(u<d){let p=Math.max(0,u-c),m=e.sub(i.start()).normalize(),g=i.start().add(m.mul(s)),y=e.sub(m.mul(r));return{distance:p,line:new M(g,y)}}else{let p=Math.max(0,d-c),m=e.sub(i.end()).normalize(),g=i.end().add(m.mul(s)),y=e.sub(m.mul(r));return{distance:p,line:new M(g,y)}}}calculateOvalToOval(t,e){let{line:r,center:i,radius:n}=t,{line:s,center:a,radius:l}=e;if(r==null&&s==null)return this.calculateCircleToCircle(i,n,a,l);if(r==null)return this.calculateOvalToCircle(e,i,n);if(s==null)return this.calculateOvalToCircle(t,a,l);let c=new Eu(r,s),h=c.getDistance(),u=n+l,d=Math.max(0,h-u),p=c.getLine(),m=p.end().sub(p.start()).normalize(),g=p.start().add(m.mul(n)),y=p.end().sub(m.mul(l));return{distance:d,line:new M(g,y)}}calculateTrackToOval(t,e,r){let{line:i,center:n,radius:s}=r;if(i==null){let h=new M(n,n),u=new Eu(t,h),d=u.getDistance();return{distance:Math.max(0,d-e/2-s),line:u.getLine()}}let a=new Eu(t,i),l=a.getDistance();return{distance:Math.max(0,l-e/2-s),line:a.getLine()}}calculateToProfile(t,e,r,i,n){let s=e.model;return s.type==="Fill Region"?this.calculateToRegion(t,e,r,i,n):s.type==="Line"?this.calculateToLine(t,e,r,i,n):null}calculateToRegion(t,e,r,i,n){if(e.outline instanceof Bt){let s=this.creepageIterateGroup(e.outline,t.outline,r,i);return this.createResult(s,t,e,n)}else return this.simpleCreepage(t,e,r,i,n)}calculateToLine(t,e,r,i,n){let s=e.model,a=this.creepageIterateStroke(e,s.strokeWidth,t.outline,r,i);return this.createResult(a,t,e,n)}calculateToPlane(t,e,r,i,n){let s=t.outline,a=e.model;if(a instanceof hn&&a.style=="solid"){let l=this.handleSolidCopperRelation(s,a,r,i);if(!l)return null;if(!i&&l.relation!=3)return this.creepageWithRTree(s,e.getRTree(),r,i,t,e,n);if(l.optimi>0){let h=l.optimi*2,u=this.getStrokeRTree(l.outline,h);return this.creepageWithRTree(s,u,r,i,t,e,n)}let c=this.creepage(s,l.outline,l.limit,i);return c&&ne.less(c.dis,l.limit)?{distance:c.dis-l.optimi,path:c.path,model1:t.model,layerId1:t.layerId,model2:e.model,layerId2:e.layerId,ruleInfo:n,pathType:c.type}:null}else return this.creepageWithRTree(s,e.getRTree(),r,i,t,e,n)}calculateProfiles(t,e,r,i,n){let s=t.model,a=e.model,l=s.type==="Fill Region",c=s.type==="Line",h=a.type==="Fill Region",u=a.type==="Line";return l&&h?this.calculateRegions(t,e,r,i,n):l&&u?this.calculateRegionLine(t,e,r,i,n):c&&h?this.calculateRegionLine(e,t,r,i,n):c&&u?this.calculateLines(t,e,r,i,n):null}calculateRegions(t,e,r,i,n){let s=t.outline instanceof ge,a=e.outline instanceof ge;if(s&&a)return this.simpleCreepage(t,e,r,i,n);if(!s&&a){let l=this.creepageIterateGroup(t.outline,e.outline,r,i);return this.createResult(l,t,e,n)}else if(s&&!a){let l=this.creepageIterateGroup(e.outline,t.outline,r,i);return this.createResult(l,t,e,n)}else{let l=this.creepageIterateGroupPair(t.outline,e.outline,r,i);return this.createResult(l,t,e,n)}}calculateRegionLine(t,e,r,i,n){let s=e.model;if(t.outline instanceof ge){let l=this.creepageIterateStroke(e,s.strokeWidth,t.outline,r,i);return this.createResult(l,t,e,n)}else{let l=this.creepageStrokeToGroup(e,s.strokeWidth,t.outline,r,i);return this.createResult(l,t,e,n)}}calculateLines(t,e,r,i,n){let s=t.model,a=e.model,l=null;for(let c of t.outline.primitives){let h=c.stroke(s.strokeWidth,wr.ROUND,ae.CW);for(let u of e.outline.primitives){let d=this.creepage(h,u.stroke(a.strokeWidth,wr.ROUND,ae.CW),r,i);d&&(l==null||d.dis<l.distance)&&(l={distance:d.dis,path:d.path,pathType:d.type})}}return this.createResult(l,t,e,n)}calculateProfilePlane(t,e,r,i,n){let s=t.model,a=s.type==="Fill Region",l=s.type==="Line";return a?this.calculateRegionPlane(t,e,r,i,n):l?this.calculateLinePlane(t,e,r,i,n):null}calculateRegionPlane(t,e,r,i,n){let s=e.model;if(t.outline instanceof ge){let l=t.outline;if(s instanceof hn&&s.style=="solid"){let c=this.handleSolidCopperRelation(l,s,r,i);if(!c)return null;if(!i&&c.relation!=3)return this.creepageWithRTree(l,e.getRTree(),r,i,t,e,n);if(c.optimi>0){let u=c.optimi*2,d=this.getStrokeRTree(c.outline,u);return this.creepageWithRTree(l,d,r,i,t,e,n)}let h=this.creepage(l,c.outline,c.limit,i);return h&&ne.less(h.dis,c.limit)?{distance:h.dis-c.optimi,path:h.path,model1:t.model,layerId1:t.layerId,model2:e.model,layerId2:e.layerId,ruleInfo:n,pathType:h.type}:null}else return this.creepageWithRTree(l,e.getRTree(),r,i,t,e,n)}else{let l=t.outline;if(s instanceof hn&&s.style=="solid"){let c=this.creepageGroupToSolidCopper(l,s,r,i,t,e,n);return c?{distance:c.distance,path:c.path,model1:t.model,layerId1:t.layerId,model2:e.model,layerId2:e.layerId,ruleInfo:n,pathType:c.pathType}:null}else return this.creepageGroupToFillWithRTree(l,e,r,i,t,n)}}calculateLinePlane(t,e,r,i,n){let s=t.model,a=e.model;if(a instanceof hn&&a.style=="solid"){let l=new Xl(t.outline,new Bt(a.pls),r);if(i&&l.relation!==3)return null;let c=a.optimization?a.optimizationWidth/2:0,h=l.pt2Parent;if(c>0){let p=c*2,m=this.getStrokeRTree(h,p);return this.creepageStrokePrimitivesToRTree(t.outline.primitives,s.strokeWidth,m,r,i,t,e,n)}let u=r+c,d=null;for(let p of t.outline.primitives){let m=p.stroke(s.strokeWidth,wr.ROUND,ae.CW),g=this.creepage(m,h,u,i);g&&(d==null||g.dis<d.distance)&&(d={distance:g.dis,path:g.path,pathType:g.type})}return d?{distance:d.distance-c,path:d.path,model1:t.model,layerId1:t.layerId,model2:e.model,layerId2:e.layerId,ruleInfo:n,pathType:d.pathType}:null}else return this.creepageStrokePrimitivesToRTree(t.outline.primitives,s.strokeWidth,e.getRTree(),r,i,t,e,n)}calculatePlanes(t,e,r,i,n){let s=t.model,a=e.model;return s instanceof hn&&a instanceof hn?this.calculateCopperToCopper(s,a,t,e,r,i,n):s instanceof hn&&a instanceof yn?this.calculateCopperToPlaneZone(s,a,t,e,r,i,n):s instanceof yn&&a instanceof hn?this.calculateCopperToPlaneZone(a,s,e,t,r,i,n):s instanceof yn&&a instanceof yn?this.calculatePlaneZoneToPlaneZone(s,a,t,e,r,i,n):null}calculateCopperToCopper(t,e,r,i,n,s,a){return t.style==="solid"&&e.style==="solid"?this.calculateSolidCopperToSolidCopper(t,e,r,i,n,s,a):t.style==="solid"&&e.style!=="solid"?this.calculateSolidCopperToGridFill(t,e,r,i,n,s,a):t.style!=="solid"&&e.style==="solid"?this.calculateSolidCopperToGridFill(e,t,i,r,n,s,a):this.calculateGridFillToGridFill(t,e,r,i,n,s,a)}calculateSolidCopperToSolidCopper(t,e,r,i,n,s,a){let l=null;if(!i.getRTree())return null;let h=r.outline,u=new Xl(r.outline,i.outline,n);if(u.relation!=3&&s)return{distance:0,path:[u.line],model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:"creepage"};let d=u.pt1Parent,p=u.pt2Parent,m=t.optimization?t.optimizationWidth/2:0,g=e.optimization?e.optimizationWidth/2:0;if(m>0&&g>0){let y=m*2,b=this.getStrokeRTree(d,y),P=g*2,T=this.getStrokeRTree(p,P),I=b.bbox().extendOfSize(n).intersect(T.bbox()),C=null;if(I==null)return C;let E=n;for(let O of b.search(I)){let _=O.bbox(),x=T.search(_.extendOfSize(E));for(let v of x){if(C&&!v.bbox().isIntersect(_.extendOfSize(E)))continue;let D=this.creepage(O,v,E,s);D&&(C===null||C.distance>D.dis)&&(C=this.createResultFromCreepage(D,r,i,a),E=D.dis)}}return C}else if(m>0&&g<=0){let y=m*2,b=this.getStrokeRTree(d,y);return this.creepageWithRTree(p,b,n,s,r,i,a)}else if(m<=0&&g>0){let y=g*2,b=this.getStrokeRTree(p,y);return this.creepageWithRTree(d,b,n,s,r,i,a)}else{let y=this.creepage(d,p,n,s);return y&&(l==null||l.distance>y.dis)&&(l={distance:y.dis,path:y.path,model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:y.type}),l}}calculateSolidCopperToGridFill(t,e,r,i,n,s,a){let l=null,c=n,h=i.getRTree();if(!h)return null;for(let u of t.pls){let d=u.bbox(),p=h.search(d.extendOfSize(c));for(let m of p){if(l&&!m.bbox().isIntersect(d.extendOfSize(c)))continue;let g=new Xl(u,m,n);switch(g.relation){case 3:{let y=t.optimization?t.optimizationWidth/2:0,b=g.pt2Parent,P=n+y,T=this.creepage(u,b,P,s);T&&ne.less(T.dis,P)&&(l==null||l.distance>T.dis-y)&&(l={distance:T.dis-y,path:T.path,model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:T.type},c=T.dis-y);break}default:{if(s)return{distance:0,path:[],model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:"creepage"};let y=t.optimization?t.optimizationWidth/2:0,b=g.pt2Parent,P=n+y,T=this.creepage(u,b,P,s);T&&ne.less(T.dis,P)&&(l==null||l.distance>T.dis-y)&&(l={distance:T.dis-y,path:T.path,model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:T.type},c=T.dis-y)}break}}}return l}calculateGridFillToGridFill(t,e,r,i,n,s,a){let l=null,c=n,h=i.getRTree();if(!h)return null;let u=r.outline instanceof Bt?r.outline:t.getMathGraphics();for(let d of u.items){let p=d.bbox(),m=h.search(p.extendOfSize(c));for(let g of m){if(l&&!g.bbox().isIntersect(p.extendOfSize(c)))continue;if(new Xl(d,g,n).relation!==3&&s)return{distance:0,path:[],model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:"creepage"};let b=this.creepage(d,g,n,s);b&&(l==null||l.distance>b.dis)&&(l={distance:b.dis,path:b.path,model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:b.type},c=b.dis)}}return l}calculateCopperToPlaneZone(t,e,r,i,n,s,a){let l=null,c=i.getRTree();if(!c)return null;if(t.style==="solid")for(let h of t.pls){let u=n,d=h.bbox(),p=c.search(d.extendOfSize(u));for(let m of p){if(l&&!m.bbox().isIntersect(d.extendOfSize(u)))continue;let g=new Xl(h,m,n);if(g.relation!==3&&s)return{distance:0,path:[],model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:"creepage"};let y=t.optimization?t.optimizationWidth/2:0,b=g.pt2Parent,P=u+y,T=this.creepage(h,b,P,s);if(T&&ne.less(T.dis,P)){let I=T.dis-y;(l==null||l.distance>I)&&(l={distance:I,path:T.path,model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:T.type},u=I)}}}else{if(!r.getRTree())return null;let u=r.outline instanceof Bt?r.outline:t.getMathGraphics();for(let d of u.items){let p=n,m=d.bbox(),g=c.search(m.extendOfSize(p));for(let y of g){if(l&&!y.bbox().isIntersect(m.extendOfSize(p)))continue;if(new Xl(d,y,n).relation!==3&&s)return{distance:0,path:[],model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:"creepage"};let P=this.creepage(d,y,p,s);P&&(l==null||l.distance>P.dis)&&(l={distance:P.dis,path:P.path,model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:P.type},p=P.dis)}}}return l}calculatePlaneZoneToPlaneZone(t,e,r,i,n,s,a){let l=null,c=i.getRTree();if(!c)return null;let h=r.outline instanceof Bt?r.outline:t.getMathGraphics();for(let u of h.items){let d=n,p=u.bbox(),m=c.search(p.extendOfSize(d));for(let g of m){if(l&&!g.bbox().isIntersect(p.extendOfSize(d)))continue;if(new Xl(u,g,n).relation!==3&&s)return{distance:0,path:[],model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:"creepage"};let b=this.creepage(u,g,d,s);b&&(l==null||l.distance>b.dis)&&(l={distance:b.dis,path:b.path,model1:r.model,layerId1:r.layerId,model2:i.model,layerId2:i.layerId,ruleInfo:a,pathType:b.type},d=b.dis)}}return l}creepage(t,e,r,i){let n=this.creepageAl.creepageDistance(t,e,r);if(n!=null){let s=this.creepageAl.connect(n),a=n.cost+this.currentLayerThickness;if(ne.less(a,r)){if(i)return{dis:a,path:s,type:"creepage"};if(s.length===1){let c=new PX().calculateReflectionPath(this.creepageAl,t,e,r);if(c!=null)return{dis:c.distance+this.currentLayerThickness,path:[new M(c.pointA,c.reflectionPoint),new M(c.reflectionPoint,c.pointB)],type:"reflection"}}else return{dis:a,path:s,type:"creepage"}}}else{if(this.context!=null&&this.context.bestResult!=null&&this.context.bestResultType=="creepage")return null;if(!i){let a=new PX().calculateReflectionPath(this.creepageAl,t,e,r);if(a!=null)return{dis:a.distance+this.currentLayerThickness,path:[new M(a.pointA,a.reflectionPoint),new M(a.reflectionPoint,a.pointB)],type:"reflection"}}}return null}createResult(t,e,r,i){return t?{distance:t.distance,path:t.path,model1:e.model,layerId1:e.layerId,model2:r.model,layerId2:r.layerId,ruleInfo:i,pathType:t.pathType}:null}createResultFromCreepage(t,e,r,i){return t?{distance:t.dis,path:t.path,model1:e.model,layerId1:e.layerId,model2:r.model,layerId2:r.layerId,ruleInfo:i,pathType:t.type}:null}simpleCreepage(t,e,r,i,n){let s=this.creepage(t.outline,e.outline,r,i);return this.createResultFromCreepage(s,t,e,n)}creepageIterateGroup(t,e,r,i){let n=r,s=null,a=null;for(let l of t.items){let c=this.creepage(e,l,n,i);c&&c.dis<=n&&(n=c.dis,s=c.path,a=c.type)}return s?{distance:n,path:s,pathType:a}:null}creepageIterateGroupPair(t,e,r,i){let n=r,s=null,a=null;for(let l of t.items)for(let c of e.items){let h=this.creepage(l,c,n,i);h&&h.dis<=n&&(n=h.dis,s=h.path,a=h.type)}return s?{distance:n,path:s,pathType:a}:null}creepageIterateStroke(t,e,r,i,n){let s=i,a=null,l=null;for(let c of t.outline.primitives){let h=c.stroke(e,wr.ROUND,ae.CW),u=this.creepage(h,r,s,n);u&&u.dis<=s&&(s=u.dis,a=u.path,l=u.type)}return a?{distance:s,path:a,pathType:l}:null}creepageStrokeToGroup(t,e,r,i,n){let s=i,a=null,l=null;for(let c of t.outline.primitives){let h=c.stroke(e,wr.ROUND,ae.CW);for(let u of r.items){let d=this.creepage(h,u,s,n);d&&d.dis<=s&&(s=d.dis,a=d.path,l=d.type)}}return a?{distance:s,path:a,pathType:l}:null}handleSolidCopperRelation(t,e,r,i){let n=new Xl(t,new Bt(e.pls),r);switch(n.relation){case 3:{let c=e.optimization?e.optimizationWidth/2:0,h=n.pt2Parent,u=r+c;return{optimi:c,outline:h,limit:u,relation:n.relation}}default:if(i)return null;let s=e.optimization?e.optimizationWidth/2:0,a=n.pt2Parent,l=r+s;return{optimi:s,outline:a,limit:l,relation:n.relation}}}creepageWithRTree(t,e,r,i,n,s,a){if(!e)return null;let l=null,c=r,h=t.bbox(),u=e.search(h.extendOfSize(c));for(let d of u){if(l&&!d.bbox().isIntersect(h.extendOfSize(c)))continue;let p=this.creepage(t,d,c,i);p&&(l===null||l.distance>p.dis)&&(l=this.createResultFromCreepage(p,n,s,a),c=p.dis)}return l}creepageGroupToSolidCopper(t,e,r,i,n,s,a){let l=null;for(let c of t.items){let h=this.handleSolidCopperRelation(c,e,r,i);if(!h)continue;if(!i&&h.relation!=3){let d=this.creepageWithRTree(c,s.getRTree(),r,i,n,s,a);d&&(!l||d.distance<l.distance)&&(l={distance:d.distance,path:d.path,pathType:d.pathType});continue}if(h.optimi>0){let d=h.optimi*2,p=this.getStrokeRTree(h.outline,d),m=this.creepageWithRTree(c,p,r,i,n,s,a);m&&(!l||m.distance<l.distance)&&(l={distance:m.distance,path:m.path,pathType:m.pathType});continue}let u=this.creepage(c,h.outline,h.limit,i);if(u&&ne.less(u.dis,h.limit)){let d=u.dis-h.optimi;(!l||d<l.distance)&&(l={distance:d,path:u.path,pathType:u.type})}}return l}creepageGroupToFillWithRTree(t,e,r,i,n,s){let a=e.getRTree();if(!a)return null;let l=null,c=r;for(let h of t.items){let u=h.bbox(),d=a.search(u.extendOfSize(c));for(let p of d){if(l&&!p.bbox().isIntersect(u.extendOfSize(c)))continue;let m=this.creepage(h,p,c,i);m&&(l===null||l.distance>m.dis)&&(l=this.createResultFromCreepage(m,n,e,s),c=m.dis)}}return l}creepageStrokePrimitivesToRTree(t,e,r,i,n,s,a,l){if(!r)return null;let c=null,h=i;for(let u of t){let d=u.stroke(e,wr.ROUND,ae.CW),p=d.bbox(),m=r.search(p.extendOfSize(h));for(let g of m){if(c&&!g.bbox().isIntersect(p.extendOfSize(h)))continue;let y=this.creepage(d,g,h,n);y&&(c===null||c.distance>y.dis)&&(c=this.createResultFromCreepage(y,s,a,l),h=y.dis)}}return c}getStrokeRTree(t,e){let r=this.strokeRTreeCache.get(t);if(r===void 0){r=new ji(7);for(let i of t.primitives){let n=i.stroke(e,wr.ROUND,ae.CW);r.add(n)}this.strokeRTreeCache.set(t,r)}return r}clearCache(){this.outlineCache.clear(),this.typeInfoCache.clear(),this.strokeRTreeCache.clear(),this.clearLayerThicknessCache()}};var IX=class{constructor(){this.ruleHelper=new tV;this.mstBuilder=new qse;this.results=[]}analyze(t,e,r){this.results=[];let n=new Yse().aggregate(t);if(n.length<2)return this.results;let s=this.mstBuilder.buildCandidateEdges(n,r);if(re.getInstance().betweenNetRule.rule.some(c=>c.creepageRule!=null)&&this.addNetworkToNetworkEdges(s,n,r),s.length===0)return this.results;let a=new TX(e);for(let c of s)a.calculate(c,r);let l=this.mstBuilder.computeMSTFromActualDistances(s,n.length);for(let c of l)c.checkResult&&this.results.push(c.checkResult);return this.results}measure(t,e,r,i){let n=new TX(r),s=n.measure(t,e,(r.bbox().width()+r.bbox().height())*2);return n.setDebugCb(i),n.display(),s.bestResult!=null?{realDistance:s.bestResult.distance,path:s.bestResult.path}:null}getRuleForClusterPair(t){let e=t.cluster1.models.values().next().value,r=t.cluster2.models.values().next().value;if(!(!e||!r))return this.ruleHelper.getRuleInfos(e,r)}addNetworkToNetworkEdges(t,e,r){if(!re.getInstance().betweenNetRule.rule.some(l=>l.creepageRule!=null))return;let n=re.getInstance().betweenNetRule.rule.filter(l=>l.creepageRule!=null);if(n.length===0)return;let s=new Set;for(let l of t)s.add(l.getPairKey());let a=new Map;for(let l of e){let c=l.net;a.has(c)||a.set(c,[]),a.get(c).push(l)}for(let l of n){let c=l.net1,h=l.net2;if(!c||!h)continue;let u=l.getNets(c),d=l.getNets(h),p=[];for(let g of u){let y=a.get(g);y&&p.push(...y)}let m=[];for(let g of d){let y=a.get(g);y&&m.push(...y)}for(let g of p){let y=g.bbox.extendOfSize(r);for(let b of m){if(g.id===b.id||g.net===b.net||y.isSeparated(b.bbox))continue;let P=g.id<b.id?`${g.id}|${b.id}`:`${b.id}|${g.id}`;if(s.has(P))continue;let T=this.getEstimatedDistance(g,b),I=g.bbox.center(),C=b.bbox.center(),E=new Ja(I),O=new Ja(C),_=new QF(g,b,T,[E,O]);t.push(_),s.add(P)}}}}getEstimatedDistance(t,e){let r=t.bbox.center(),i=e.bbox.center(),n=r.distance1(i),s=Math.max(t.bbox.width(),t.bbox.height())/2,a=Math.max(e.bbox.width(),e.bbox.height())/2;return Math.max(0,n-s-a)}};var rV=class{constructor(){this.result=new Array}test(){let t=this.calculateBoard(),e=this.calculateSlot(t),r=this.getMaxDistance(),i=$i.getInstance();i.initialEnv_Worker();let n=i.drcMap;this.getModelPair(n,r,e)}checkCreepage(){if(this.isOpenDRCCustomCheck())return null;let t=this.calculateBoard(),e=this.calculateSlot(t),r=this.getMaxDistance();if(r==0)return null;let n=$i.getInstance().drcMap;this.getModelPair(n,r,e);for(let s of this.result)this.addCreepageError(s)}isOpenDRCCustomCheck(){var e;let t=ka.getInstance();return t.isOpenDRCCustomCheck?!((e=t.creepageDistance.Creepage)!=null&&e.enforce):!1}calculateBoard(){let t=new ji(7),e=iFe();if(e.length>0){let r=new Array,i=new Map,n=new _e;for(let s of e){n.ext1(s.bbox);let a=s.getMathGraphics(s.layerId,0),l=s.strokeWidth;for(let c of a.primitives)r.push(c),i.set(c,l)}if(n.valid()){n.ext7(20);let s=n.build1(),l=new $c(s,2,.1,new Di(1),r).detect3(i).items;for(let c of l)t.add(c)}}return t}calculateSlot(t){let e=nFe(),r=new Map;for(let s of e){let a=s.getMathGraphics(s.layerId,0),l=t.search(a.bbox());for(let c of l){let h=r.get(c);h==null&&(h=new Set,r.set(c,h)),a instanceof ge?h.add(a):xe.addAllSet(h,a.items)}}let i=new ji(7),n=new Ec;for(let s of t.itemList){let a=r.get(s);if(a==null)i.add(s.toPolylineGroup());else{let l=n.getSubtraction(Array.from(s.items),Array.from(a));for(let c of l)i.add(c)}}return i}getMaxDistance(){let t=0;for(let e of re.getInstance().getAllCreepageSpacing())e.creepageDistance>t&&(t=e.creepageDistance);return t}getModelPair(t,e,r){let i=new Set([0,1,2,3,4,5,6,7,9,13,14]);for(let n of r.itemList){let s=n.bbox(),a=t.searchItems(3,s,(d,p)=>i.has(p)),l=new ji(7);for(let d of n.items)for(let p of d.primitives)l.add(p);let c=[];for(let d of a){if(M6(d)==null)continue;let m=this.getModelReferPoint(d);if(m!=null&&jr.inPolygon(m,n.items)){c.push(d);continue}let g=d.getMathGraphics(),y=!1;for(let b of g.primitives){let P=l.search(b.bbox());for(let T of P)if(Pt(b,T)>0){y=!0;break}if(y)break}y&&c.push(d)}let u=new IX().analyze(c,n,e);this.result.push(...u)}}measure(t,e,r,i){let n=this.calculateBoard(),s=this.calculateSlot(n),a=new IX,l=ht.extend2(t.bbox,e.bbox),c=s.search(l),h=new ji(7);for(let d of s.items())for(let p of d.primitives)h.add(p);let u;for(let d of c){let p=[];for(let m of[t,e]){let g=this.getModelReferPoint(m);if(g!=null&&jr.inPolygon(g,d.items)){p.push(m);continue}let y=m.getMathGraphics(),b=!1;for(let P of y.primitives){let T=h.search(P.bbox());for(let I of T)if(Pt(P,I)>0){b=!0;break}if(b)break}b&&p.push(m)}if(p.length==2){u=d;break}}return u!=null?a.measure(t,e,u,r):(i(t,e),null)}getModelReferPoint(t){return t instanceof gt?t.start:t instanceof et||t instanceof Ct?t.center:t instanceof ss||t instanceof Za?t.start:t instanceof yo?t.center.add1(t.radius,0):t instanceof jl?t.start:null}addCreepageError(t){let e=t.getErrorInfo(),r=$i.getInstance();ci.getInstance().getCreepageError(e.shape1.globalIndex,e.shape2.globalIndex)==null&&(r.checkEnv==0?ci.getInstance().addCreepageError(e.position,e.ruleName,e.shape1.globalIndex,Ig(e.shape1),e.shape2.globalIndex,Ig(e.shape2),e.realDistance,e.ruleDistance,e.ruleType,e.layers,e.path):ci.getInstance().errorRecordBuffer.add({type:"CreepageError",data:{position:e.position,name:e.ruleName,obj1:e.shape1.globalIndex,obj1Type:Ig(e.shape1),obj2:e.shape2.globalIndex,obj2Type:Ig(e.shape2),minDistance:e.realDistance,clearance:e.ruleDistance,errorType:e.ruleType,layerIds:e.layers,path:e.path.map(n=>{if(n instanceof M)return{...n,type:"Line"};if(n instanceof q)return{...n,type:"Arc"}})}}))}};var nae=class extends FI{checkCache(t,e,r){let i=null;function n(s){s!==null&&(i===null||s.distance<i.distance)&&(i=s)}if(t instanceof md){if(e instanceof md){let s=(t.width+e.width)/2;n(this.getResSubWidth(this.check(t.shape,e.shape,s+r),s))}else if(e instanceof Yd){let s=(t.width+e.width)/2;for(let a=0,l=e.shape.length;a<l;a++)n(this.getResSubWidth(this.check(t.shape,e.shape[a],s+r),s))}else if(e instanceof ku){let s=t.width/2;n(this.getResSubWidth(this.check(t.shape,e.shape,s+r),s))}else if(e instanceof qu){let s=(t.width+e.width)/2;n(this.getResSubWidth(this.check(t.shape,e.shape,s+r),s))}}else if(t instanceof Yd){let s=t.shape;if(e instanceof md){let a=(t.width+e.width)/2;for(let l=0,c=s.length;l<c;l++)n(this.getResSubWidth(this.check(e.shape,s[l],a+r),a))}else if(e instanceof Yd){let a=(t.width+e.width)/2,l=a+r;this.checkPolylines(t,e,a,l,n)}else if(e instanceof ku){let a=t.width/2;for(let l=0,c=s.length;l<c;l++)n(this.getResSubWidth(this.check(e.shape,s[l],a+r),a))}else if(e instanceof qu){let a=(t.width+e.width)/2;for(let l=0,c=s.length;l<c;l++)n(this.getResSubWidth(this.check(e.shape,s[l],a+r),a))}}else if(t instanceof ku){if(e instanceof md){let s=e.width/2;n(this.getResSubWidth(this.check(t.shape,e.shape,s+r),s))}else if(e instanceof Yd){let s=e.width/2;for(let a=0,l=e.shape.length;a<l;a++)n(this.getResSubWidth(this.check(t.shape,e.shape[a],s+r),s))}else if(e instanceof ku)n(this.check(t.shape,e.shape,r));else if(e instanceof qu){let s=e.width/2;n(this.getResSubWidth(this.check(t.shape,e.shape,s+r),s))}}else if(t instanceof qu){if(e instanceof md){let s=(t.width+e.width)/2;n(this.getResSubWidth(this.check(t.shape,e.shape,s+r),s))}else if(e instanceof Yd){let s=(t.width+e.width)/2;for(let a=0,l=e.shape.length;a<l;a++)n(this.getResSubWidth(this.check(t.shape,e.shape[a],s+r),s))}else if(e instanceof ku){let s=t.width/2;n(this.getResSubWidth(this.check(t.shape,e.shape,s+r),s))}else if(e instanceof qu){let s=(t.width+e.width)/2;n(this.getResSubWidth(this.check(t.shape,e.shape,s+r),s))}}return i}check(t,e,r){let i=t.bbox(),n=e.bbox();if(i.minX===0&&i.maxX===0&&i.minY===0&&i.maxY===0||n.minX===0&&n.maxX===0&&n.minY===0&&n.maxY===0)return null;if(!t.bbox().isIntersect(e.bbox().extendOfSize(r)))return new _u(3,Number.MAX_VALUE);if(t instanceof rl){if(e instanceof rl)return this.checkPts(t,e,r);if(e instanceof ge)return this.checkPt2Pl(t,e,r);if(e instanceof Bt)return this.checkPt2PlGrp(t,e,r)}else if(t instanceof ge){if(e instanceof rl)return this.checkPt2Pl(e,t,r);if(e instanceof ge)return this.checkPls(t,e,r);if(e instanceof Bt)return this.checkPl2PlGrp(t,e,r)}else if(t instanceof Bt){if(e instanceof rl)return this.checkPt2PlGrp(e,t,r);if(e instanceof ge)return this.checkPl2PlGrp(e,t,r);if(e instanceof Bt)return this.checkPlGrps(t,e,r)}}checkPts(t,e,r){let i=new er(t,e),n=i.getDistance(),s=ne.lesseq(n,r)?0:3;return new _u(s,i.getDistance(),i.getLine())}checkPt2Pl(t,e,r){let i=!0,n=nu.Position.pip(t.start(),e);if(n||(n=nu.Position.pip(t.end(),e),i=!1),n){let s=i?t.start():t.end();return new _u(0,0,new M(s,s))}else{let s=3,a=Number.MAX_VALUE,l=null,c=t.bbox().extendOfSize(r);for(let h of e.primitives){if(this.isPoints(h)||!c.isIntersect(h.bbox()))continue;let u=new er(h,t),d=u.getDistance(),p=u.getLine();if(ne.less(d,a)&&(a=d,l=p),ne.lesseq(a,r)&&(s=0),ne.eq(a,0))break}return new _u(s,a,l)}}checkPt2PlGrp(t,e,r){let i=nu.Position.pips(t.start(),e.items);if(i||(i=nu.Position.pips(t.end(),e.items)),i){let n=t.start().add(t.end()).mul(.5);return new _u(0,0,new M(n,n))}else{let n=3,s=Number.MAX_VALUE,a=null,l=t.bbox().extendOfSize(r),h=this.getRtree(e).search(l);for(let u of h){if(this.isPoints(u)||!l.isIntersect(u.bbox()))continue;let d=new er(u,t),p=d.getDistance(),m=d.getLine();if(ne.less(p,s)&&(s=p,a=m),ne.lesseq(s,r)&&(n=0),ne.eq(s,0))break}return new _u(n,s,a)}}checkPls(t,e,r){let i=nu.Position.pip(t.start(),e);if(i||(i=nu.Position.pip(e.end(),t)),i)return new _u(0,0,new M(t.start(),t.start()));{let n=3,s=Number.MAX_VALUE,a=null;for(let l of t.primitives){if(this.isPoints(l))continue;let c=l.bbox().extendOfSize(r);if(c.isIntersect(e.bbox())){for(let h of e.primitives){if(this.isPoints(h)||!c.isIntersect(h.bbox()))continue;let u=new er(l,h),d=u.getDistance(),p=u.getLine();if(ne.less(d,s)&&(s=d,a=p),ne.lesseq(s,r)&&(n=0),ne.eq(s,0))break}if(ne.eq(s,0))break}}return new _u(n,s,a)}}checkPl2PlGrp(t,e,r){let i=nu.Position.pips(t.start(),e.items);if(i||(i=nu.Position.pip(e.items[0].start(),t)),i)return new _u(0,0,new M(t.start(),t.start()));{let n=3,s=Number.MAX_VALUE,a=null,l=this.getRtree(e);for(let c of t.primitives){if(this.isPoints(c))continue;let h=c.bbox().extendOfSize(r),u=l.search(h);for(let d of u){if(this.isPoints(d)||!h.isIntersect(d.bbox()))continue;let p=new er(d,c),m=p.getDistance(),g=p.getLine();if(ne.less(m,s)&&(s=m,a=g),ne.lesseq(s,r)&&(n=0),ne.eq(s,0))break}if(ne.eq(s,0))break}return new _u(n,s,a)}}checkPlGrps(t,e,r){let i=nu.Position.pips(t.items[0].start(),e.items),n=new M(t.items[0].start(),t.items[0].start());if(i||(i=nu.Position.pips(e.items[0].start(),t.items),n=new M(e.items[0].start(),e.items[0].start())),i)return new _u(0,0,n);{let s=3,a=Number.MAX_VALUE,l=null;if(t.bbox().area()>e.bbox().area()){let c=this.getRtree(t);for(let h of e.items)for(let u of h.primitives){if(this.isPoints(u))continue;let d=u.bbox().extendOfSize(r),p=c.search(d);for(let m of p){if(this.isPoints(m)||!d.isIntersect(m.bbox()))continue;let g=new er(m,u),y=g.getDistance(),b=g.getLine();if(ne.less(y,a)&&(a=y,l=b),ne.lesseq(a,r)&&(s=0),ne.eq(a,0))break}}}else{let c=this.getRtree(e);for(let h of t.items)for(let u of h.primitives){if(this.isPoints(u))continue;let d=u.bbox().extendOfSize(r),p=c.search(d);for(let m of p){if(this.isPoints(m)||!d.isIntersect(m.bbox()))continue;let g=new er(m,u),y=g.getDistance(),b=g.getLine();if(ne.less(y,a)&&(a=y,l=b),ne.lesseq(a,r)&&(s=0),ne.eq(a,0))break}}}return new _u(s,a,l)}}checkPolylines(t,e,r,i,n){let s=t.shape,a=e.shape,l=s.length,c=a.length;if(t.rtree&&e.rtree)l<=c?this.checkWithRtree(s,e.rtree,i,(h,u)=>this.check(h,u,i),n,r):this.checkWithRtree(a,t.rtree,i,(h,u)=>this.check(u,h,i),n,r);else if(e.rtree)this.checkWithRtree(s,e.rtree,i,(h,u)=>this.check(h,u,i),n,r);else if(t.rtree)this.checkWithRtree(a,t.rtree,i,(h,u)=>this.check(u,h,i),n,r);else for(let h=0;h<l;h++)for(let u=0;u<c;u++)n(this.getResSubWidth(this.check(a[u],s[h],i),r))}checkWithRtree(t,e,r,i,n,s){for(let a of t){let l=a.bbox().extendOfSize(r),c=e.search(l);for(let h of c)this.isPoints(h)||n(this.getResSubWidth(i(h,a),s))}}};var XR=class extends H3{constructor(){super(...arguments);this.collisionAl=new nae}commonCheck(e,r,i=e.layerId,n=r.layerId){let s=this.getRuleInfos(e,r,i,n),a=ei.isProhibit(e)||ei.isProhibit(r),l=Math.max(ve(s.clearance,2),0);if(!a&&l===0)return;let c=jc.getCache(e,i),h=jc.getCache(r,n),[u,d]=this.getSmallerCacheFirst(c,h),p=this.collisionAl.checkCache(u,d,l);return p&&(p.ruleInfos=s),p}singlesCheck(e,r,i=e.layerId){let n=this.drcEnv.ruleHelper.getShape2Clearance(e,r,void 0,this._holeStatus,i),s=ei.isProhibit(e)||ei.isProhibit(r),a=Math.max(ve(n.clearance,2),0);if(!s&&a===0)return;let l=jc.getCache(e,i),c=jc.getCache(r,i),h=this.collisionAl.checkCache(l,c,a);return h&&(h.ruleInfos=n),h}getSmallerCacheFirst(e,r){if(e instanceof ku&&r instanceof ku){let i=e.shape.bbox().area(),n=r.shape.bbox().area();if(i>n)return[r,e]}return[e,r]}curryCommonCheck(e,r){return(i,n)=>{let s=this.commonCheck(e,r,i,n);return s!=null&&(this._holeStatus!==void 0&&(s._holeState=this._holeStatus),s.syncCollideLayerIds([i,n])),s}}};var oae=class extends XR{checkShapeRelation(t,e,r){let i=this.initCheckFunc(t,e);if(r!==void 0&&(r==0&&(r=1),this._holeStatus=r),!(e instanceof or&&ei.isProhibit(e)&&!e.component.copper))if(e instanceof et){if((this._holeStatus===void 0||this._holeStatus==3)&&!e.isUnuseLayer(t.layerId)&&i(t.layerId,t.layerId)||e.layerId==12&&this._holeStatus==1&&i(t.layerId,12))return}else return e instanceof Ct?(!e.isContains(t.layerId)||(this._holeStatus===void 0||this._holeStatus==3)&&!e.isUnuseLayer(t.layerId)&&i(t.layerId,t.layerId)||this._holeStatus==1&&i(t.layerId,12),void 0):i(t.layerId,t.layerId)}};var sae=class extends XR{checkShapeRelation(t,e,r){let i=this.initCheckFunc(t,e);if(r!==void 0&&(r==0&&(r=1),this._holeStatus=r),!(e instanceof or&&ei.isProhibit(e)&&!e.component.planzone)){if(e instanceof yn)return i(t.layerId,e.layerId);if(e instanceof et){if((this._holeStatus===void 0||this._holeStatus==3)&&!e.isUnuseLayer(t.layerId)&&i(t.layerId,t.layerId)||e.layerId==12&&this._holeStatus==1&&i(t.layerId,12))return}else return e instanceof Ct?(!e.isContains(t.layerId)||(this._holeStatus===void 0||this._holeStatus==3)&&!e.isUnuseLayer(t.layerId)&&i(t.layerId,t.layerId)||this._holeStatus==1&&i(t.layerId,12),void 0):i(t.layerId,e.layerId)}}};var aae=class extends XR{checkShapeRelation(t,e,r){if(r!==void 0&&(this._holeStatus=r),this.checkError2Result=this.initCheckFunc(t,e),this._checkProhibit(t,e)||this.dispatchOutline(t,e))return;let i=ei.isSingleLayerShape(t),n=ei.isSingleLayerShape(e);i&&n?this.checkSingleSingle(t,e):!i&&!n?this.dispatchMultiMulti(t,e):i?this.checkSingleMulti(t,e):(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.checkSingleMulti(e,t))}_checkProhibit(t,e){if(ei.isProhibit(t)||ei.isProhibit(e)){let r=this.commonCheck(t,e);return r&&r.syncCollideLayerIds([t.layerId,e.layerId]),this.check2Result(t,e,r)}return!1}dispatchOutline(t,e){return ei.isBoardOutline(t)?(ei.isSingleLayerShape(e)?this.checkOutlineSingle(t,e):this.dispatchOutlineMulti(t,e),!0):ei.isBoardOutline(e)?(ei.isSingleLayerShape(t)?this.checkOutlineSingle(e,t):(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.dispatchOutlineMulti(e,t)),!0):!1}checkOutlineSingle(t,e){let r=this.commonCheck(t,e);return r&&r.syncCollideLayerIds([e.layerId]),this.check2Result(t,e,r)}dispatchOutlineMulti(t,e){e instanceof et?this.checkOutlinePad(t,e):e instanceof Ct?this.checkOutlineVia(t,e):ei.isSlot(e)&&this.checkOutlineSlot(t,e)}checkOutlinePad(t,e){if(!(this._holeStatus==1&&this.checkError2Result(t.layerId,12))&&(this._holeStatus===void 0||this._holeStatus===3)){for(let r of this.copperLayerIds)if(!e.isUnuseLayer(r)&&this.checkError2Result(t.layerId,r))return}}checkOutlineVia(t,e){if(this._holeStatus===void 0||this._holeStatus===3){for(let r of this.copperLayerIds)if(!e.isUnuseLayer(r))return this.checkError2Result(t.layerId,r)}this._holeStatus===1&&this.checkError2Result(t.layerId,12)}checkOutlineSlot(t,e){let r=this.commonCheck(t,e);return r&&r.syncCollideLayerIds([t.layerId,e.layerId]),this.check2Result(t,e,r)}checkSingleSingle(t,e){let r=this.singlesCheck(t,e,t.layerId);return r&&r.syncCollideLayerIds([t.layerId,e.layerId]),this.check2Result(t,e,r)}checkSingleMulti(t,e){if(!(e instanceof Ct&&!e.isContains(t.layerId))){if(this._holeStatus===void 0||this._holeStatus==3){if(e instanceof et){if(e.isUnuseLayer(t.layerId))return;if(t instanceof Bi){let r=e.getParent();if(r instanceof Bi){let i=sg(r.layerId);return i===t.layerId?this.checkError2Result(i,i):void 0}}return this.checkError2Result(t.layerId,t.layerId)}else if(e instanceof Ct&&e.isContains(t.layerId)&&!e.isUnuseLayer(t.layerId))return this.checkError2Result(t.layerId,t.layerId)}(this._holeStatus==1||e instanceof or)&&this.checkError2Result(t.layerId,12)}}dispatchMultiMulti(t,e){t instanceof et?this.dispatchPad(t,e):t instanceof Ct?this.dispatchVia(t,e):this.dispatchMulti(t,e)}dispatchPad(t,e){e instanceof et?this.checkPadPad(t,e):e instanceof Ct?this.checkPadVia(t,e):this.checkPadMulti(t,e)}dispatchVia(t,e){e instanceof et?(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.checkPadVia(e,t)):e instanceof Ct?this.checkViaVia(t,e):this.checkViaMulti(t,e)}dispatchMulti(t,e){e instanceof et?(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.checkPadMulti(e,t)):e instanceof Ct?(this.checkError2Result=this.initCheckFunc(e,t),this.swapHoleStatus(),this.checkViaMulti(e,t)):this.checkMultiMulti(t,e)}checkPadPad(t,e){let r=this._holeStatus===0,i=this._holeStatus===1,n=this._holeStatus===2,s=this._holeStatus===void 0||this._holeStatus===3;for(let a of this.copperLayerIds){if([1,2].includes(a)){if(r&&this.checkError2Result(12,a)||i&&this.checkError2Result(a,12))break}else if(r&&!e.isUnuseLayer(a)&&this.checkError2Result(12,a)||i&&!t.isUnuseLayer(a)&&this.checkError2Result(a,12))break;if(s&&!t.isUnuseLayer(a)&&!e.isUnuseLayer(a)&&this.checkError2Result(a,a))break}n&&this.checkError2Result(12,12)}checkPadVia(t,e){let r=this._holeStatus===0,i=this._holeStatus===1,n=this._holeStatus===2,s=this._holeStatus===void 0||this._holeStatus===3;for(let a of this.copperLayerIds){if([1,2].includes(a)){if(r&&this.checkError2Result(12,a)||i&&this.checkError2Result(a,12))break}else if(r&&!e.isUnuseLayer(a)&&this.checkError2Result(12,a)||i&&!t.isUnuseLayer(a)&&this.checkError2Result(a,12))break;if(s&&!t.isUnuseLayer(a)&&!e.isUnuseLayer(a)&&this.checkError2Result(a,a))break}n&&this.checkError2Result(12,12)}checkPadMulti(t,e){if(this._holeStatus===void 0||this._holeStatus==3){for(let r of this.copperLayerIds)if(this.checkError2Result(r,e.layerId))break}this._holeStatus==0&&this.checkError2Result(12,12)}checkViaVia(t,e){let r=this._holeStatus===0,i=this._holeStatus===1,n=this._holeStatus===2,s=this._holeStatus===void 0||this._holeStatus===3;for(let a of this.copperLayerIds)if(r&&!e.isUnuseLayer(a)&&this.checkError2Result(12,a)||i&&!t.isUnuseLayer(a)&&this.checkError2Result(a,12)||s&&!t.isUnuseLayer(a)&&!e.isUnuseLayer(a)&&this.checkError2Result(a,a))break;n&&this.checkError2Result(12,12)}checkViaMulti(t,e){if(this._holeStatus===void 0||this._holeStatus==3){for(let r of this.copperLayerIds)if(!t.isUnuseLayer(r)&&this.checkError2Result(r,12))break}this._holeStatus!==void 0&&this._holeStatus!==3&&this.checkError2Result(12,12)}checkMultiMulti(t,e){let r=this.commonCheck(t,e);return r&&r.syncCollideLayerIds([t.layerId,e.layerId]),this.check2Result(t,e,r)}};var iV=class{constructor(){this.copperCheck=new oae;this.planeCheck=new sae;this.safeCheck=new aae}check(t){let[e,r,i]=t;return e instanceof hn?this.copperCheck.checkShapeRelation(e,r,i):r instanceof hn?this.copperCheck.checkShapeRelation(r,e,i):e instanceof yn?this.planeCheck.checkShapeRelation(e,r,i):r instanceof yn?this.planeCheck.checkShapeRelation(r,e,i):this.safeCheck.checkShapeRelation(e,r,i),this}check1(t,e,r){return t instanceof hn?this.copperCheck.checkShapeRelation(t,e,r):e instanceof hn?this.copperCheck.checkShapeRelation(e,t,r):t instanceof yn?this.planeCheck.checkShapeRelation(t,e,r):e instanceof yn?this.planeCheck.checkShapeRelation(e,t,r):this.safeCheck.checkShapeRelation(t,e,r),this}getResult(){function t(e){return e.result.map(r=>r.getResult())}return{copper:t(this.copperCheck),plane:t(this.planeCheck),safe:t(this.safeCheck),other:void 0}}};function FHe(o,t){let e=!1,r=0;class i{check(m){e?m.globalIndex<this.shape.globalIndex&&t(this.shape,m):t(this.shape,m)}}let n=new i,s=[{type:16,field:"device"},{type:6,field:"fill"},{type:0,field:"track"},{type:13,field:"copper"},{type:14,field:"planzone"}];function a(){let p=o.singleLayerMap.get(15);if(p){for(let[g,y]of p)if(y.items.size!=0){for(let b of y.items){n.shape=b.item;let P=n.shape.component,T=n.shape.buildBBox();for(let{type:I,field:C}of s)if(P[C]){let E=o.getTree(1,I,g);if(E==null)continue;E.search(T,n.check.bind(n))}}y.recycle()}o.singleLayerMap.delete(15)}let m=o.multiLayerMap.get(15);if(m){for(let[,g]of m)if(g.items.size!=0){for(let y of g.items){n.shape=y.item;let b=n.shape.component,P=n.shape.buildBBox();for(let{type:T,field:I}of s)if(b[I]){let C=o.singleLayerMap.get(T);if(C==null)continue;for(let[,E]of C)E&&E.search(P,n.check.bind(n))}}g.recycle()}o.multiLayerMap.delete(15)}}a();function l(){var p;for(let m of[1,2]){let g=(p=o.singleLayerMap.get(16))==null?void 0:p.get(m);if(g!=null){let y=new Map,b=new Set([16,2]);for(let P of b){if(e=P==16,r=lA.getShapePairMaxClearance(16,P,e?m:12),r==0){b.delete(P);continue}y.set(P,r)}if(b.size==0)continue;for(let P of b){e=P==16;let T=o.getTree(e?1:2,P,e?m:12);if(T!=null)for(let I of g.items){n.shape=I.item;let C=n.shape.buildBBox();r=y.get(P),T.search(C.extendOfSize(r),n.check.bind(n))}}g.recycle()}}o.singleLayerMap.delete(16)}l();function c(){let p=new Set(o.singleLayerMap.keys());for(let[m,g]of o.singleLayerMap){let y=new Set(p);for(let[b,P]of g){let T=new Map;for(let I of y){if(r=lA.getShapePairMaxClearance(m,I,b),r==0){y.delete(I);continue}T.set(I,r)}if(y.size!=0)for(let I of y){e=I==m,r=T.get(I);let C=o.getTree(1,I,b);if(C!=null)for(let E of P.items){n.shape=E.item;let O=n.shape.buildBBox().extendOfSize(r);C.search(O,n.check.bind(n))}}}p.delete(m)}}c();function h(){let p=o.getTree(2,11,11);if(p==null)return;let m=new Map,g=new Set(o.multiLayerMap.keys());for(let y of g)r=lA.getShapePairMaxClearance(11,y),m.set(y,r);for(let y of p.items){let b=y.item,P=[b.buildBBox()];b.bbox.area()>500&&(b instanceof Za?P=b.getAllLinesInOrder().map(I=>I.bbox()):b instanceof ss&&(P=b.outline.primitives.map(I=>I.bbox())));let T=new Set;for(let[I,C]of o.singleLayerMap)for(let[E,O]of C)I!=16&&O!=null&&(r=lA.getShapePairMaxClearance(11,I,E),r!=0&&P.forEach(_=>O.search(_.extendOfSize(r),x=>{let v=x.globalIndex;T.has(v)||(t(b,x),T.add(v))})));T.clear();for(let I of g){e=I==11;let C;e?C=E=>{if(E.globalIndex<b.globalIndex){let O=E.globalIndex;T.has(O)||(t(b,E),T.add(O))}}:C=E=>{let O=E.globalIndex;T.has(O)||(t(b,E),T.add(O))},r=m.get(I),P.forEach(E=>o.searchByType(3,E.extendOfSize(r),I,C))}T.clear()}p.recycle(),o.multiLayerMap.delete(11)}function u(){let p=new Set(o.multiLayerMap.keys());for(let[m,g]of o.multiLayerMap){for(let[,y]of g)for(let[b,P]of o.singleLayerMap)for(let[T,I]of P)if(I!=null)for(let C of y.items){let E=C.item;r=lA.getShapePairMaxClearance(m,b,T),r!=0&&I.search(E.buildBBox().extendOfSize(r),O=>{t(E,O)})}p.delete(m)}}function d(){let p=new Set(o.multiLayerMap.keys());for(let[m,g]of o.multiLayerMap){for(let[,y]of g){let b=new Map;for(let P of p)r=lA.getShapePairMaxClearance(m,P),b.set(P,r);for(let P of p){e=P==m;for(let T of y.items)n.shape=T.item,r=b.get(P),o.searchByType(2,n.shape.buildBBox().extendOfSize(r),P,n.check.bind(n))}}p.delete(m)}}h(),u(),d()}var lae=class{constructor(t){this.filter=new P1;this.isOpenDRCCustomCheck=t}run(t){return this.filter.checkSameNet=t.spacingCheckSameNet,this.excludeCheckPair=t.excludeCheckPair,this}updates(t){let e=new iV,r=$i.getInstance().drcMap,i=0,n=null,s=r.size;FHe(r,(a,l)=>{n!==a&&(i++,n=a),this.getModelPair(a,l).forEach(c=>e.check(c)),t(i/s)})}getModelPair(t,e){let r=[];if(this.excludeCheckPair&&!this.excludeCheckPair([t,e]))return r;this.filter.check(t,e)&&r.push([t,e,3]);let i=ei.getModelPairHoleStatus(t,e);if(i!==3){let n=s=>{(this.isOpenDRCCustomCheck?this.filter.checkHole(t,e,s):this.filter.commonCheck(t,e,s))&&r.push([t,e,s])};n(i),i===2&&(n(1),n(0))}return r}};var E9e=class{constructor(){this.progress=new W3}flush(){return this.shapes=new ZP().shapes,this}initConfig(){xS.init(),NR.init(),sf.init(),y6.init()}checkSpecifications(t=this.shapes){return this.initConfig(),this.checkSpecs(),NR.checkNetLength(t),RF.checkNetLength(t),y6.checkNetLengthTolerance(t),LS&&new rV().checkCreepage(),this.shapes.length=0,this}spacingError(t={},e=ka.getInstance().isOpenDRCCustomCheck){this.progress.reset(),this.progress.onProgress(r=>{var i;(i=t.onProgress)==null||i.call(t,r),!t.disableProgressFromWorker&&this.handleUpdateProgressFromWorker(r,t.maxProgressFromWorker)}),new lae(e).run(t).updates(r=>this.progress.updateProgress(r))}handleUpdateProgressFromWorker(t,e){self.workerBus!=null&&(e=e||1,t=t*e,self.workerBus.publish("progressUpdate",{ratio:t,descripte:"Design rule check"}))}checkSpecs(){let t=$i.getInstance().drcMap,e=t.singleLayerMap.get(0),r=t.multiLayerMap.get(5);if(e)for(let[,i]of e)for(let n of i.items){let s=n.item;if(ei.getShapeNetDiff(s)!=null){NR.checkDiffWidth(s);continue}xS.checkTrackWidth(s)}if(r)for(let[,i]of r)for(let n of i.items)MR.checkBindVia(n.item),sf.checkVia(n.item)}},VHe=new E9e;function EAt(o){let t=[],e=ka.getInstance(),r=$i.getInstance().ruleHelper.getRuleForViaRadius(o),i=e.isCheck(e.holeSize.minViaSize),n=e.isCheck(e.holeSize.maxViaSize),s=o.center,a=o.globalIndex,l=r.name,c=ve(o.radius*2,2),h=ve(o.holeRadius*2,2);return n&&c>ve(r.maxRadius*2,2)||i&&c<ve(r.minRadius*2,2)?t.push({position:s,name:l,obj1:a,type:!0,radius:o.radius,minRadius:r.minRadius,maxRadius:r.maxRadius,layerIds:ei.getMultiShapeEffectLayers(o)}):(n&&h>ve(r.maxInner*2,2)||i&&h<ve(r.minInner*2,2))&&t.push({position:s,name:l,obj1:a,type:!1,radius:o.holeRadius,minRadius:r.minInner,maxRadius:r.maxInner,layerIds:ei.getMultiShapeEffectLayers(o)}),t}function GHe(o){let t=[];for(let e=0;e<o.length;e++)EAt(o[e]).forEach(r=>{t.push(r)});return t}function OAt(o){let t=[],e=$i.getInstance().ruleHelper.getRuleForBlind(o);if(o.type!==1)return t;let r=o.name,i=e.name,n=e.getBlindVia(r);return n!=null&&(n.startLayer==o.startLayer&&n.endLayer==o.endLayer||t.push({position:o.center,name:i,obj:o.globalIndex,startLayer:o.startLayer,endLayer:o.endLayer,layerIds:ei.getMultiShapeEffectLayers(o)})),t}function UHe(o){let t=[];for(let e=0;e<o.length;e++)OAt(o[e]).forEach(r=>{t.push(r)});return t}var cae=(e=>(e[e.new=1]="new",e[e.log=!window["META-PANELIZE-ENV"]&&/\bRealTimeDRCLog\b/.test(Q().location.search)?1:0]="log",e))(cae||{});function O9e(o){o=o instanceof Set?Array.from(o):o;let t=new Set;for(let e of o)if(!e.model.isEmpty)if(e instanceof qc){let r=e.getItems();for(let i of r)t.add(i);O9e(r)}else if(e instanceof ke){t.add(e);let r=e.getItems();for(let i of r)t.add(i)}else if(e instanceof mt){let r=e.getParent();r instanceof lt&&t.add(r)}else if(e instanceof _t){let r=e.getParent();r instanceof lt&&t.add(r)}else t.add(e);return Array.from(t)}var jb=class{static runWithStrategy(t,e){if(!le.pcbConfig.displayComponentSpacing)return;let r=this.activeContext;this.activeContext=t;try{e()}finally{this.activeContext=r}}static getCurrentStrategy(){return this.activeContext||YI.createDefault()}};jb.activeContext=null;var YI=class{static createSingleComponentStrategy(){return{checkSpecifications:!1,preFilter:(t,e)=>!!(e&&e=="Component")}}static createMultiItemStrategy(t){return{checkSpecifications:!1,preFilter:(e,r)=>!!(r&&r=="Component"),postFilter:e=>t.selectedItems.has(e)}}static createDefault(){return{checkSpecifications:!0}}};function hae(o){let t=AAt(o);return xAt(t)}function AAt(o){let t=new Map,{preFilter:e,postFilter:r}=jb.getCurrentStrategy();return o.forEach(i=>{let n=i.model,s=kt.search(n.buildBBox().extendOfSize(_re.getShapeMaxClearance(n)),(a,l)=>(e?e(a,l):!0)&&A9e(a,l)&&_At(n.layerId,a),!0).getAllItems();for(let a of s)if(a.globalIndex!==i.globalIndex){if(r&&r(a))continue;t.has(i)?t.get(i).shape.add(a):t.set(i,{shape:new Set().add(a)}),a.model instanceof or&&a.model.type==="Constraint Region"&&(!t.get(i).constraint||n.globalIndex<t.get(i).constraint.globalIndex)&&(t.get(i).constraint=a)}}),t}function A9e(o,t){return!!(t&&t!="Ratline"&&vAt(o))}function _At(o,t){return o===12||o===11?!0:t==o||t==12||t==11}function vAt(o){return Ud(o)||o==11}function xAt(o){let t=new Map,e=[];return o.forEach((r,i)=>{let{shape:n,constraint:s}=r;t.set(i,n),s&&s.model instanceof or&&e.push({constraint:s.model,shape:i.model})}),$i.getInstance().realeTime(e),t}function uae(o){let t=new Map;return o.forEach((e,r)=>{let i=HHe(r);t.has(i)||t.set(i,new Set),e.forEach(n=>t.get(i).add(HHe(n)))}),t}function HHe(o){return o.model}function WHe(o,t){return o?o.filter(t?e=>e&&!(e instanceof hn):e=>e).filter(e=>{let r=Pe.getLayer(e.layerId);return!(e.layerId!=null&&e.layerId!=12&&e.layerId!=11&&r&&!r.isCopperLayer())}).filter(e=>{if(e instanceof He){switch(e.type){case"Line":case"Prohibited Region":case"Fill Region":case"Board Outline":case"Slot Region":case"TearDrop":return!0}return!1}return!0}):[]}function nV(o,t,e){let r=[];o.check(t,e)&&r.push(3);let i=ei.getModelPairHoleStatus(t,e);if(i!==3){let n=s=>{(ka.getInstance().isOpenDRCCustomCheck?o.checkHole(t,e,s):o.commonCheck(t,e,s))&&r.push(s)};n(i),i===2&&(n(1),n(0))}return r}function zHe(o){this.isOpenDRCCustomCheck=ka.getInstance().isOpenDRCCustomCheck,ka.getInstance().isOpenDRCCustomCheck=!1;let t=[],e=new P1;return o.forEach((r,i)=>{r.forEach(n=>{nV(e,i,n).forEach(s=>{t.push([i,n,s])})})}),ka.getInstance().isOpenDRCCustomCheck=this.isOpenDRCCustomCheck,t}function k6(o){let t=new iV;return o.forEach(e=>t.check(e)),t.getResult()}var RAt="realtime_drc",YHe="=================="+RAt+"==================";function _9e(o,t,e=cae.log){if(o instanceof Set&&(o=Array.from(o)),!o.length||R.getInstance().doctype!=3)return!0;e&&(console.log(YHe),console.log("cin:",o),console.time("time")),Bo.deleteByPcbItem(o),o=o.filter(c=>A9e(c.layerId,c.model.modelType)),o=O9e(o),o=WHe(o,t);let r=hae(o),i=uae(r),n=zHe(i),s=k6(n),a=D0.checkSpacing(s),l=DAt(o);return Bo.syncFromContentModel(),Bo.deleteCopperClearanceError(),$i.getInstance().clear(),e&&(console.timeEnd("time"),console.log("error",{...s,...a,...l}),console.log(YHe)),!o.find(c=>ci.getInstance().hasSafeErrorIgnoreCopper(c.globalIndex))}function DAt(o){let t=n(),e=s(),r=GHe(t),i=UHe(t);return r.forEach(a=>{ci.getInstance().addRadiusError(a.position,a.name,a.obj1,a.type,a.radius,a.minRadius,a.maxRadius,a.layerIds,!1)}),i.forEach(a=>{ci.getInstance().addBlindError(a.position,a.name,a.obj,a.startLayer,a.endLayer,a.layerIds)}),e.forEach(a=>{xS.checkTrackWidth(a)}),{viaSize:r,blindVia:i};function n(){let a=[];return o.forEach(l=>{l.model instanceof Ct&&a.push(l.model)}),a}function s(){let a=[];return o.forEach(l=>{l.model instanceof gt&&a.push(l.model)}),a}}var oV=class{constructor(t){this._switch=!1;this.initPCB=!1;t&&(this.initPCB=!0)}get switch(){return this._switch}set switch(t){this._switch=t}realtimeCheckItems(t){return this._switch?(he.publish("updateRtree",""),_9e(t,this.initPCB?(this.initPCB=!1,!0):!1)):!0}realtimeCheckItemsIgnoreSwitch(t){return _9e(t,this.initPCB?(this.initPCB=!1,!0):!1)}checkItems(t){if(R.getInstance().doctype!=3)return!0;let e=new Set;if(t.forEach(s=>{this.getCheckItems(s,e)}),Bo.deleteByPcbItem(e),e=this.filterItems4Layer(e),e.size==0)return!0;let r=new ef(xb()),i=[];this.initPCB?(e.forEach(s=>{let a=s.model;a instanceof xi&&a&&!(a instanceof hn)&&i.push(a)}),this.initPCB=!1):e.forEach(s=>{let a=s.model;a instanceof xi&&a&&i.push(a)}),$i.getInstance().initialEnv(r),this.checkDispatch(e),VHe.flush().spacingError({},!1);let n=!0;for(let s of e)if(ci.getInstance().hasSafeErrorIgnoreCopper(s.globalIndex)){n=!1;break}return Bo.syncFromContentModel(),Bo.deleteCopperClearanceError(),$i.getInstance().clear(),n}checkDispatch(t){for(let e of t)e instanceof Ge?xS.checkTrackWidth(e.model):e instanceof Ue&&(sf.checkVia(e.model),MR.checkBindVia(e.model))}checkNetLength(t){let e=this.getModels(t),r=new Map;for(let i of t){let n=i.model,s=n?n.modelType:void 0;if(n&&(s==="ArcTrack"||s==="Track"||s=="Pad"&&i.getParent()!=null)){let a=i.net;if(a!=""&&r.get(a)===void 0){let c=Ye.getNetLength(a);r.set(a,c)}}}RF.checkNetLength(e,r)}checkNetLengthTolerance(t){let e=this.getModels(t),r={};for(let i of t)if(i instanceof Ge){let n=i.net;if(n!=""&&r[n]===void 0){let a=Ye.getNetLength(n);r[n]=a}}y6.checkNetLengthTolerance(e,r)}checkDifferentPairLength(t){let e=this.getModels(t);NR.checkNetLength(e)}checkConnect(){Hse.checkConnect()}getCheckItems(t,e){if(!t.isEmpty)if(t instanceof qc)t.getItems().forEach(i=>{this.getCheckItems(i,e)});else if(t instanceof ke)e.add(t),t.getItems().forEach(i=>{e.add(i)});else if(t instanceof mt){let r=t.getParent();r instanceof lt&&e.add(r)}else if(t instanceof _t){let r=t.getParent();r instanceof lt&&e.add(r)}else e.add(t)}filterItems4Layer(t){let e=new Set;for(let r of t){let i=Pe.getLayer(r.layerId);r.layerId!=null&&r.layerId!=12&&r.layerId!=11&&i&&!i.isCopperLayer()||e.add(r)}return e}getModels(t){let e=Array.isArray(t)?t.length:t.size,r=new Array(e),i=-1;for(let n of t)i++,r[i]=n.model;return r}checkClearanceFast(t,e=!1){if(t.isEmpty||!(t.model instanceof xi))return!0;let r=l1(t.model),i=re.getInstance().getItemMaxClearance(r),n=t.buildBBox().extendOfSize(i),s=kt.search4Types(n,VBe).getAllItems(),a=[];s.forEach(p=>{let m=p.model;p.isEmpty||p==t||!(m instanceof xi)||a.push(m)});let l=this.getConstrToShapeMap(a);$i.getInstance().ruleHelper.constraintMap.updateMap(l);let h=new vF,u=new P1(e),d=!0;for(let p of a){let m=[t.model,p];if(!u.check(m[0],m[1]))continue;let g=h.check([m]),{fail:y}=D0.checkSpacing(g);if(y.length){d=!1;break}h.clearResult()}return $i.getInstance().clear(),d}getConstrToShapeMap(t){let e=new Set(t),r={};for(let i of e)i instanceof or&&i.type==="Constraint Region"&&(r[i.globalIndex]=[],e.delete(i));for(let i of Object.keys(r))r[i]=e;return r}};var qHe=Ru(r2());var wAt=Date.now()-performance.now(),XHe=new ArrayBuffer(10),LAt=new Float64Array(XHe,0,1),v9e=new Uint8Array(XHe),jHe=-1,x9e=0;function MAt(){let o=wAt+performance.now();return LAt[0]=o,o===jHe?x9e++:(x9e=0,jHe=o),v9e[8]=Math.random()*1e3,v9e[9]=x9e,btoa(String.fromCharCode(...v9e))}var dae=class{constructor(t,e=MAt()){this.rpcTicket=0;this.callBack=new Map;this.service=new Map;this.busy=!1;this.push=new Array;this.worker=t,this.uuid=e,this.worker.onmessage=r=>{let{topic:i,message:n,replyTopic:s}=r.data,a=this.service.get(i);if(a==null){let l=this.callBack.get(s);l!=null&&l(n),this.callBack.delete(s),this.busy=!1,this.next()}else{let l=null;try{l={success:!0,result:a(n)}}catch(c){l={success:!1,err:c}}this.worker.postMessage({topic:i,message:l,replyTopic:s})}},this.worker.onerror=r=>{throw new Error(r.message)}}next(){if(this.push.length>0){let t=this.push.shift();this.busy=!0,this.worker.postMessage(t)}}rpcService(t,e){e==null?this.service.delete(t):this.service.set(t,e)}rpcCall(t,e){return new Promise((i,n)=>{let s=`ThreadTool-${this.uuid}-${t}-${this.rpcTicket++}`;this.callBack.set(s,a=>{a.success?i(a.result):n(new Error(a.err))}),this.busy?this.push.push({topic:t,message:e,replyTopic:s}):(this.busy=!0,this.worker.postMessage({topic:t,message:e,replyTopic:s}))})}};var qR=class qR extends Ei{constructor(){super(...arguments);this.busMap={};this.ratlineWorker=new Map;this.workerBus=new Map;this.i=0;this.id=0;this._workerStateMap={}}static getInstance(){return qR.manager==null&&(qR.manager=new qR,qR.manager.initPool()),qR.manager}initPool(){}createWorker(e,r=void 0){let n=`&channel=${R.getInstance().channel}&cll=${self.PRO_LOG_LEVEL}`,s=e+n,a=new Worker(s,{name:r});return this.map.set(this.id,a),this.workerBus.set(this.i,new dae(a)),this.ratlineWorker.set(this.i++,a),a}addWorker(e,r=!1,i=void 0){let n=r?"":`&cll=${self.PRO_LOG_LEVEL}`,s=e+n,a=new Worker(s,{name:i});this.map.set(this.id,a);let l=new qHe.WorkerMessageBridge(A.messageBus,a);return l.publish("workerName",this.id),this.busMap[this.id]=l,this.id++,l}deleteWorker(e){let r=this.map.get(e);r&&(r.terminate(),this.map.delete(e),delete this.busMap[e],this.clearWorkerState(e))}getLastWorkerId(){return this.id-1}hasWorker(e){return this.map.has(e)}getWorkerState(e,r){let i=this._workerStateMap[e];return i&&i[r]}setWorkerState(e,r,i){if(!this.hasWorker(e))return;let n=this._workerStateMap[e];n||(n=this._workerStateMap[e]={}),n[r]=i}clearWorkerState(e){delete this._workerStateMap[e]}};qR.manager=null;var tm=qR;var jI=class{encode(){var r;let t=R.getInstance(),e={uuid:t.id,docType:t.doctype,projectId:t.projectId,env:{tabId:t.tabId,windowTabId:(r=Q())==null?void 0:r._TAB_ID_}};return this.initDrcRuleCustomConfig(e),e}initDrcRuleCustomConfig(t){if(t.options||(t.options={}),!t.options.ruleCustomConfig){let{config:e,isOpenDRCCustomCheck:r}=ka.getInstance();t.options.ruleCustomConfig={config:e,isOpenDRCCustomCheck:r}}}};var R9e=class{filterD3Shell(t){let e=[];for(let r of t)if(r instanceof He)switch(r.type){case"3D Shell - Outline":case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":case"3D Shell - Screw Pillar":case"3D Shell - Side Datum Line":e.push(r);break}return e}getAllItems(){let t=Xt.getAllItem(),e=pt.getAllItem(),r=Kt.getAllItem();return new Set([].concat(t,e,r))}},B6=new R9e;var F6=class F6{constructor(){this.openPcb=!1;this.init=!1}static getInstance(){return F6.manager==null&&(F6.manager=new F6),F6.manager}get bus(){return this._bus}set bus(t){this._bus=t}startPcb(t=!0){this.openPcb||(this.openPcb=!0,this.toggle(le.pcbConfig.isRebuildCopperAuto,t))}modifyDynamicCopper(t){let e=!0;qo.getInstance().getAllItem().length>0?e=!1:e=!0,this.toggle(t,e)}async toggle(t,e=!0){!this.openPcb||R.getInstance().isReadOnlyMode||(t===!0?await this.openDynamicCopper(e):this.closeDynamicCopper())}handleDynamicCopperResult(t){this.time?(clearTimeout(this.time),this.time=null):A.publish("progressUpdate",[1,"copper build"],Q()),t.hasRebuildCopper&&A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q())}handleDynamicCopperCalTime(){this.time=setTimeout(()=>{this.time=null,this.copperMask()},3e3)}copperMask(){A.publish("progressUpdate",[.5,"copper build"],Q())}async openDynamicCopper(t=!0){this.workerName==null&&await this.addWorker(t)}closeDynamicCopper(){this.workerName!=null&&this.deleteWorker()}async addWorker(t=!0){var c;let e=R.getInstance(),r=e.id,i=e.projectId,n={uuid:r,docType:e.doctype,projectId:i,env:{tabId:e.tabId,windowTabId:(c=Q())==null?void 0:c._TAB_ID_},options:{data:{rebuildCopper:t,currClient:e.compiler.consistencyManager.getClient()}}},s=tm.getInstance(),a=s.addWorker(`editor?entry=pcb-worker.js${Q().location.search.replace(/\?/,"&")}`);this.bus=a;let l="dynamicCopperInWorker";this.workerName=s.getLastWorkerId(),await a.rpcCall(l,{world:n})}deleteWorker(){tm.getInstance().deleteWorker(this.workerName),this.workerName=null}async saveCopper(){return this.workerName?(await this._bus.rpcCall("dynamicCopperSaveInWorker",{})).message:{success:!0}}};F6.manager=null;var XI=F6;function D9e(o,t=0){setTimeout(()=>{if(va.modelIsBuilt){let e;typeof o=="string"?e=JSON.parse(o):e=o,o=null,NAt(e)}else D9e(o,50)},t)}function NAt(o){console.log("dealRatlineResultFromWorker","======================>","start",new Date().getTime());let t="ratlineResultFromWorker-time";Cn(t);let{workerName:e,ratlineRes:r}=o,i=tm.getInstance(),n=i.getWorkerState(e,"mainThreadRunEnd"),s=i.getWorkerState(e,"delayCopper");i.deleteWorker(e);let a=r.map(u=>u.net);Iu.input(r);let l=Hu,c=new Array;for(let u of a){let d=l.getNet(u);d!=null&&(c.push(d.name),d.showRatline=d.showRatline)}c.length&&A.publish("updateRatlineNet",wVe(c),Q()),On.getInstance().allowPull=!0,va.rebuildingRatlineInWorker=!1,va.needFlushService&&A.publish("flushService",""),console.log("\u98DE\u7EBF\u7ED3\u679C\u5904\u7406\u5B8C\u6BD5"),s&&A.publish("DelayCopper",""),n&&A.publish("hideLoading","",Q()),XI.getInstance().startPcb(!!s),Xi(t);let h="createPcbEditorToRendered-time";mte(h)&&(Xi(h),gte())}var BAt=Sn.getInstance(),FAt=bn.getInstance(),w9e=(()=>{let o=Math.PI/4,t=o*3,e=o*5,r=o*7;return{ANGLE45:o,ANGLE135:t,ANGLE225:e,ANGLE315:r}})(),vd={UP:new S(0,1),LOW:new S(0,-1),LEFT:new S(-1,0),RIGHT:new S(1,0),LEFT_UP:new S(-1,1).normalize(),LEFT_LOW:new S(-1,-1).normalize(),RIGHT_UP:new S(1,1).normalize(),RIGHT_LOW:new S(1,-1).normalize()},CX=class{static createId(){return"DRCWorkerBatchFanout"+this.id++}};CX.id=0;var SX=class{constructor(t,e,r){this.tracks=[];this.padId=t,this.tracks.push(...e),this.via=r}getAll(){return[].concat(this.tracks,[this.via])}getLastTrack(){return this.tracks[this.tracks.length-1]}getEnd(){return this.tracks[this.tracks.length-1]}getFanoutDirect(){return this.getLastTrack().direct}getViaMaxRadius(){return Math.max(this.via.radius,this.via.holeRadius)}},pae=class{constructor(t){this.env=t}fanoutGenerate(t,e,r){if(!this.validBeforeFanout(t))return null;let i=this.getFanoutPath(t,e,r);if(i.length){let n=[],s=this.getTrackLayerId(t),a=this.getTrackWidth(t);for(let u of i){let d=BAt.addTrack(CX.createId(),s,u.start(),u.end(),a,!1,t.net);n.push(d)}let l=this.createVia(t),c=i[i.length-1].end();return l.center=c,this.modifyViaSize(l,s),new SX(t.globalIndex,n,l)}return null}modifyViaSize(t,e){let{config:r}=this.env;if(r.via.sizeType==="FollowRule"){let i=t.startLayer,n=t.endLayer,s=Nl.getInstance();s.init();let a=s.searchConstraint(t.center.bbox());if(i!==1||n!==2){let c=i===1,h=n===2,u=Ze.getInstance().getAllCopperLayer().map(g=>g.layerId);u.sort((g,y)=>g==1||y==1?g==1?-1:1:g==2||y==2?g==2?1:-1:g-y);let d=u.indexOf(i),p=u.indexOf(n),m=u.slice(d,p+1);c||(m=m.filter(g=>g!=1)),h||(m=m.filter(g=>g!=2)),a=a.filter(g=>{let y=g.layerId;return m.indexOf(y)>=0||y==12})}let l=Q8(a);l&&(t.radius=l.radius,t.holeRadius=l.innerRadius),s.clear()}}validBeforeFanout(t,e=!0){let r=this.env.needFanoutSet,i=this.env.config,n=i.via;if(!r.has(t)||!i.includeNoNet&&!t.net)return!1;let s=null;if(n.type==="Blind"&&(s=this.getBlindViaRule(t),s==null))return!1;if(e){let a=this.getTrackLayerId(t);if(t.layerId!==12&&a!==t.layerId||s&&!u2(a,1,s.startLayer,s.endLayer))return!1}else if(t.layerId!==12&&s&&!u2(t.layerId,1,s.startLayer,s.endLayer))return!1;return!0}getFanoutPath(t,e,r){let i=[],n=t.bbox,s=t.center,a=Math.max(n.width(),n.height());if(this.isOrthoDirect(e)){let l=new M(s,s.add(e.mul(a))),c=this.getInters(t,l);Er(c,(d,p)=>p.distance2(s)-d.distance2(s));let u=c[0].add(e.mul(r));l=new M(s,u),i.push(l)}else{let l=e.angleX(),c;ne.eq(l,w9e.ANGLE45)?c=n.UR():ne.eq(l,w9e.ANGLE135)?c=n.UL():ne.eq(l,w9e.ANGLE225)?c=n.LL():c=n.LR();let h=new Xn,u=h.degree45(e,s,c),d=h.degree45(u[2].sub(u[1]).normalize(),s,c),p=new M(d[0],d[1]),m=new M(d[1],d[2]);ne.eq(p.direct.cross(m.direct),0)?i.push(new M(p.start(),m.end())):ne.eq(m.length(),0)?i.push(p):i.push(p,m);let g=i[i.length-1],y=this.getInters(t,g);Er(y,(T,I)=>I.distance2(s)-T.distance2(s));let b=y[0];b==null&&(b=m.start());let P=b.add(e.mul(r));g=new M(g.start(),P),i[i.length-1]=g}return i.filter(l=>ne.greater(l.length(),0))}getInters(t,e){let r=[];if(t.layerId===12){let n=[1,t.getOneInnerInUse(),2].filter(Boolean);for(let s of n){let a=jc.getPadCache(t,s);r.push(a)}}else{let n=jc.getPadCache(t,t.layerId);r.push(n)}let i=[];for(let n of r){let s=n.shape.primitives;for(let a=0;a<s.length;a++){let l=Pt(e,s[a]);Om(l,i)}}return i}isOrthoDirect(t){return ne.eq(t.x,0)||ne.eq(t.y,0)}createVia(t){let i=this.env.config.via.type==="Blind"?1:0,n=t.net,s="",a=1,l=2;if(i===1){let m=this.getBlindViaRule(t);s=m.name,a=m.startLayer,l=m.endLayer}let c=t.center,{radius:h,holeRadius:u}=this.getViaSize(t),d=re.getInstance().getSolderExpansionByNet(n);return FAt.addVia(CX.createId(),i,s,a,l,n,h,c,u,!1,1,d.viaTopExpansion,d.viaBottomExpansion)}getTrackLayerId(t){if(t.layerId!==12)return t.layerId;let e=Ze.getInstance(),r=e.activeLayer;return ns(e.getLayer(r).type)?r:1}getBlindViaRule(t){let{config:e,ruleHelper:r}=this.env,i={net:t.net},n=r.getRuleForBlind(i);return n.isDefault?n.getBlindVia(e.via.blindName):null}getTrackWidth(t){let{config:e,ruleHelper:r}=this.env,i=1;if(e.track.widthRuleType==="Custom")i=e.track.width;else{let n={id:t.globalIndex,net:t.net,shapeType:t.layerId==12?2:1,layerId:this.getTrackLayerId(t)};ei.getShapeNetDiff(n)?i=r.getRuleForDiffWidth(n).getStrokeWidthDefault(this.getTrackLayerId(t)):i=r.getRuleForTrackWidth(n).getDefaultWidth(this.getTrackLayerId(t))}return i}getViaSize(t){let{config:e,ruleHelper:r}=this.env,i=1,n=1;if(e.via.sizeType==="Custom")i=e.via.outsideDiameter,n=e.via.insideDiameter;else{let s={id:t.globalIndex,net:t.net,shapeType:t.layerId==12?2:1,layerId:null},a=r.getRuleForViaRadius(s);i=a.defalutRadius*2,n=a.defalutInner*2}return{radius:i/2,holeRadius:n/2}}};var fae=class{constructor(t){this.env=t,this.tool=new pae(t)}bgaFanout(t){let e=this.tool,r=this.env.config,i=r.bgaFanoutDirect==="45";t=this.filterDiffSizePads(t);let n=this.getMeanSize(t),s=this.getGroupBBox(t),a,l;i?(a=this.getOrthoSubregion(t,s),l={leftUp:vd.LEFT_UP,rightUp:vd.RIGHT_UP,leftLow:vd.LEFT_LOW,rightLow:vd.RIGHT_LOW}):(a=this.getObliqueSubregion(t,s),l={up:vd.UP,low:vd.LOW,left:vd.LEFT,right:vd.RIGHT});let c=new Set;r.fanoutOuter2Rows||(c=this.getOuterRowPadSet(2,t,s,n,!i));let h=p=>{let m=i?this.getOrthoRegionKey(a,p):this.getObliqueRegionKey(a,p);return l[m]},u=this.calcViaPadSpacing(t,h),d={};for(let p of Object.keys(a))for(let m of a[p]){if(c.has(m))continue;let g=l[p],y=e.fanoutGenerate(m,g,u);y&&(d[m.globalIndex]=y)}return d}getOrthoRegionKey(t,e){return t.leftUp.has(e)?"leftUp":t.rightUp.has(e)?"rightUp":t.leftLow.has(e)?"leftLow":"rightLow"}getObliqueRegionKey(t,e){return t.up.has(e)?"up":t.low.has(e)?"low":t.left.has(e)?"left":"right"}getOrthoSubregion(t,e){let r=new _e;t.forEach(u=>r.ext1(u.bbox));let i=e.center(),n=(u,d)=>new _e().ext2(u).ext2(d).build1(),s=n(i,e.UL()),a=n(i,e.LL()),l=n(i,e.UR()),c=n(i,e.LR()),h={leftUp:new Set,leftLow:new Set,rightUp:new Set,rightLow:new Set};for(let u of t){let d=u.bbox;s.intersection1(d)?h.leftUp.add(u):l.intersection1(d)?h.rightUp.add(u):a.intersection1(d)?h.leftLow.add(u):c.intersection1(d)&&h.rightLow.add(u)}return h}getGroupBBox(t){let e=new _e;return t.forEach(r=>e.ext1(r.bbox)),e.build1()}filterDiffSizePads(t){let e=1/0,r=t.map(s=>{let a=this.getPadSize(s);return e=Math.min(e,a),{pad:s,size:a}});Er(r,(s,a)=>s.size-a.size);let i=[[r[0]]];for(let s=1;s<r.length;s++){let a=i[i.length-1];Math.abs(a[0].size-r[s].size)<=e?a.push(r[s]):i.push([r[s]])}return Er(i,(s,a)=>a.length-s.length),i[0].map(s=>s.pad)}getMeanSize(t){let e=0;return t.forEach(i=>{e+=this.getPadSize(i)}),e/t.length}getPadSize(t){return Math.max(t.bbox.width(),t.bbox.height())}getOuterRowPadSet(t,e,r,i,n=!1){let s=(C,E)=>{let O=new S(E.direct.y,-E.direct.x).normalize(),_=E.start().sub(C);return Math.abs(O.dot(_))},a=new M(r.UR(),r.UL()),l=new M(r.LL(),r.LR()),c=new M(r.UL(),r.LL()),h=new M(r.LR(),r.UR());if(n){let C=a.center().add(new S(0,1).mul(a.length()/2)),E=l.center().add(new S(0,-1).mul(l.length()/2)),O=c.center().add(new S(-1,0).mul(c.length()/2)),_=h.center().add(new S(1,0).mul(h.length()/2));a=new M(C,_),l=new M(E,O),c=new M(O,C),h=new M(_,E)}let u=1/0,d=new Array(t).fill(u),p=new Array(t).fill(u),m=new Array(t).fill(u),g=new Array(t).fill(u);for(let C=0;C<t;C++)for(let E of e){let O=E.center,_=s(O,a),x=s(O,l),v=s(O,c),D=s(O,h);(C===0||_>d[C-1]+i)&&(d[C]=Math.min(d[C],_)),(C===0||x>p[C-1]+i)&&(p[C]=Math.min(p[C],x)),(C===0||v>m[C-1]+i)&&(m[C]=Math.min(m[C],v)),(C===0||D>g[C-1]+i)&&(g[C]=Math.min(g[C],D))}for(let C=t-1;C>=1;C--)isFinite(d[d.length-1])||d.pop(),isFinite(p[p.length-1])||p.pop(),isFinite(m[m.length-1])||m.pop(),isFinite(g[g.length-1])||g.pop();let y=d[d.length-1]+i/2,b=p[p.length-1]+i/2,P=m[m.length-1]+i/2,T=g[g.length-1]+i/2,I=new Set;for(let C of e){let E=C.center,O=s(E,a),_=s(E,l),x=s(E,c),v=s(E,h);(ne.greatereq(y,O)||ne.greatereq(b,_)||ne.greatereq(P,x)||ne.greatereq(T,v))&&I.add(C)}return I}viaInPadFanout(t){let e=this.tool;t=this.filterDiffSizePads(t);let r={};for(let i of t)if(e.validBeforeFanout(i,!1)){let n=e.createVia(i);n!=null&&(r[i.globalIndex]=new SX(i.globalIndex,[],n))}return r}commonFanout(t){let e=this.tool;t=this.filterDiffSizePads(t);let r=this.getCommonFanoutDirect(),i=this.calcViaPadSpacing(t,r),n={};for(let s of t){let a=e.fanoutGenerate(s,r,i);a&&(n[s.globalIndex]=a)}return n}getCommonFanoutDirect(){switch(this.env.config.fanoutType){case"Top":return vd.UP;case"Bottom":return vd.LOW;case"Left":return vd.LEFT;case"Right":return vd.RIGHT;case"UpperLeft":return vd.LEFT_UP;case"UpperRight":return vd.RIGHT_UP;case"LowerLeft":return vd.LEFT_LOW;case"LowerRight":return vd.RIGHT_LOW}return vd.UP}inOutFanout(t){let e=this.tool,r=this.env.config;t=this.filterDiffSizePads(t);let i=this.getMeanSize(t),n=this.getGroupBBox(t),s=this.getInOutSubregion(t,n,i),a=this.env.config.viaPadSpacing,l={up:vd.UP,low:vd.LOW,left:vd.LEFT,right:vd.RIGHT};r.fanoutType==="Inward"&&(l={up:vd.UP.mul(-1),low:vd.LOW.mul(-1),left:vd.LEFT.mul(-1),right:vd.RIGHT.mul(-1)});let c={};for(let h of Object.keys(s)){let u=0;for(let d of s[h]){let p=l[h];r.fanoutType==="OutOrIn"&&u%2!=0&&(p=p.mul(-1));let m=e.fanoutGenerate(d,p,a);m&&(c[d.globalIndex]=m,u++)}}return this.applyInOutMinChannelSpace(c,s),c}applyInOutMinChannelSpace(t,e){let r=this.env.config.minChannelSpace;for(let i of Object.keys(e)){let n=e[i].filter(s=>t[s.globalIndex]!=null);for(let s=1;s<n.length;s++){let a=n[s-1],l=n[s],c=t[a.globalIndex],h=t[l.globalIndex],u=c.via,d=h.via,p=c.getViaMaxRadius(),m=h.getViaMaxRadius(),g=u.center.distance1(d.center);if(ne.less(g-(p+m),r)){let y=r+(p+m),b=Math.sqrt(y*y-g*g),P=h.getLastTrack(),T=h.getFanoutDirect(),I=d.center.add(T.mul(b));d.center=I,P.end=I}}}}getInOutSubregion(t,e,r){let i=new Set(t),n=this.getPadHorizontalMatrix(i),s=this.getPadVerticalMatrix(i),a={up:[],low:[],left:[],right:[]},l=(()=>{var b,P,T,I;let d=n.length,p=s.length,m=(b=n[0][0])==null?void 0:b.center,g=(P=n[0][1])==null?void 0:P.center,y=(I=(T=n[1])==null?void 0:T[0])==null?void 0:I.center;return!(p==1&&d>2||p==2&&(d>2||d==2&&m&&g&&y&&ne.less(m.distance2(y),m.distance2(g))||d==1))})(),c=new Set,h=()=>{n[0].forEach(d=>{c.has(d)||(a.up.push(d),c.add(d))}),n[n.length-1].forEach(d=>{c.has(d)||(a.low.push(d),c.add(d))})},u=()=>{s[0].forEach(d=>{c.has(d)||(a.left.push(d),c.add(d))}),s[s.length-1].forEach(d=>{c.has(d)||(a.right.push(d),c.add(d))})};return l?(h(),u()):(u(),h()),a}getPadHorizontalMatrix(t){let e=this.env.fanoutMap,r=e.bbox(),i=[],n=new Set;for(let s of t){if(n.has(s))continue;let a=s.center,l=s.bbox.height()/4,c=new S(r.minX,a.y),h=new S(r.maxX,a.y);c=c.add(new S(0,1).mul(l)),h=h.add(new S(0,1).mul(-l));let d=new _e().ext2(c).ext2(h).build1(),p=e.searchByLayer(d),m=[s];n.add(s);for(let g of p)t.has(g)&&!n.has(g)&&m.push(g),n.add(g);this.sortPads(m,new S(1,0),g=>g),i.push(m)}return this.sortPads(i,new S(0,-1),s=>s[0]),i}getPadVerticalMatrix(t){let e=this.env.fanoutMap,r=e.bbox(),i=[],n=new Set;for(let s of t){if(n.has(s))continue;let a=s.center,l=s.bbox.width()/4,c=new S(a.x,r.minY),h=new S(a.x,r.maxY);c=c.add(new S(1,0).mul(l)),h=h.add(new S(1,0).mul(-l));let d=new _e().ext2(c).ext2(h).build1(),p=e.searchByLayer(d),m=[s];n.add(s);for(let g of p)t.has(g)&&!n.has(g)&&m.push(g),n.add(g);this.sortPads(m,new S(0,-1),g=>g),i.push(m)}return this.sortPads(i,new S(1,0),s=>s[0]),i}sortPads(t,e,r){let i=r(t[0]).center;return e=e.normalize(),Er(t,(n,s)=>{let a=r(n).center.sub(i),l=r(s).center.sub(i);return a.dot(e)-l.dot(e)}),t}getObliqueSubregion(t,e){let r=(d,p)=>{let m=new S(p.direct.y,-p.direct.x).normalize(),g=p.start().sub(d);return Math.abs(m.dot(g))},i=new M(e.UR(),e.UL()),n=new M(e.LL(),e.LR()),s=new M(e.UL(),e.LL()),a=new M(e.LR(),e.UR()),l=e.width(),h=e.height()/l,u={up:new Set,low:new Set,left:new Set,right:new Set};for(let d of t){let p=d.center,m=r(p,i),g=r(p,n),y=r(p,s),b=r(p,a),P=ne.lesseq(m,g),T=ne.lesseq(y,b),I=(P?m:g)/(T?y:b);ne.greatereq(h,I)?P?u.up.add(d):u.low.add(d):T?u.left.add(d):u.right.add(d)}return u}calcViaPadSpacing(t,e){if(!this.isPadCenter())return this.env.config.viaPadSpacing;let r=1,i=this.tool,{fanoutMap:n}=this.env,s=n.bbox(),a=Math.max(s.width(),s.height()),l=1/0,c=(u,d,p)=>{let m=p.start(),g=i.getInters(d,p);Er(g,(b,P)=>b.distance2(m)-P.distance2(m));let y=g[0];if(y){let b=m.distance1(y);if(ne.greater(b,0))return b}return 1/0};for(let u of t){let d=e instanceof S?e:e(u),p=i.getFanoutPath(u,d,0);if(!p.length)continue;let m=p[p.length-1].end(),g=new M(m,m.add(d.mul(a))),y=Math.max(u.bbox.width(),u.bbox.height())/2;if(i.isOrthoDirect(d)){let P=new _e().ext2(g.start()).ext2(g.end()).build1(),T=this.searchSameLayerPads(P,u);for(let I of T){let C=c(u,I,g);l=Math.min(l,C)}}else{let b=Math.min(y*2,3),P=Math.min(10,Math.ceil(g.length()/b)),T=g.length()/P,I=m;for(let C=0;C<P;C++){let E=I.add(d.mul(T)),_=new _e().ext2(I).ext2(E).build1(),x=this.searchSameLayerPads(_,u);for(let v of x){let D=c(u,v,g);l=Math.min(l,D)}if(isFinite(l))break;I=E}}}let h=l/2;return isFinite(h)?h:r}searchSameLayerPads(t,e){let r=e.layerId,i=this.env.fanoutMap,n=[];return r!==12?n=i.searchByLayer(t,r):n=i.searchByLayer(t),n=n.filter(s=>e!==s),n}isPadCenter(){let t=this.env.config;return["Inward","Outward","OutOrIn"].includes(t.fanoutType)?!1:t.viaPadSpacingType==="PadCenter"}};var GAt=jn.getInstance(),vto=re.getInstance(),mae=class{constructor(t){this.needFanoutSet=new Set;this.config=t}get fanoutMap(){return this._fanoutMap}set fanoutMap(t){this._fanoutMap=t}get ruleHelper(){return this._ruleHelper}set ruleHelper(t){this._ruleHelper=t}initialEnv(t,e){jc.clear();let r=GAt.getAllItem();this.fanoutMap=new ef(xb(r)),this.ruleHelper=new pS,this.updateConstraintMap(t),this.needFanoutSet=e}updateConstraintMap(t){let e=new Set,r=yM("Constraint Region"),i=new ef(xb(r));for(let n of t){let s=new _e;n.forEach(l=>s.ext1(l.bbox)),i.searchByLayer(s.build1()).forEach(l=>e.add(l))}this.ruleHelper.constraintMap.updateByDRCMap(this.fanoutMap,Array.from(e))}};var oro=jn.getInstance(),sro=re.getInstance(),L9e=class{constructor(t){this.progress=new W3;this.env=new mae(t)}fanout(t,e){this.initialProgress();let r=this.env.config,i=this.getPadGroups(t),n=this.getNeedFanoutSet(t,e);this.env.initialEnv(i,n),this.progress.updateProgress(.2);let s=this.fanoutGroups(i);r.ignoreDRC||this.deleteViolateDRCResult(s);let a=this.getFanoutModels(s);return this.progress.updateProgress(1),a}fanoutGroups(t){let e=new fae(this.env),r=this.env.config,i={},n=t.map(a=>a.length).reduce((a,l)=>a+l),s=0;for(let a of t){let l;switch(r.fanoutType){case"BGA":l=e.bgaFanout(a);break;case"ViaInPad":l=e.viaInPadFanout(a);break;case"Top":case"Bottom":case"Left":case"Right":case"UpperLeft":case"UpperRight":case"LowerLeft":case"LowerRight":l=e.commonFanout(a);break;case"Outward":case"Inward":case"OutOrIn":l=e.inOutFanout(a);break;default:l=e.bgaFanout(a)}for(let c of Object.keys(l))i[c]=l[c];s+=a.length,this.progress.updateProgress(.2+.55*(s/n))}return i}getNeedFanoutSet(t,e){let r=new Set(e),i=new Set;for(let n of t)n instanceof et?r.has(n.globalIndex)||i.add(n):n instanceof Bi&&n.getPads().forEach(s=>{r.has(s.globalIndex)||i.add(s)});return i}getPadGroups(t){let e=new Set,r=new Map;for(let i of t){if(i instanceof et){let n=i.getParent();n instanceof Bi&&(i=n)}if(!e.has(i)){if(i instanceof et){let n=r.get("")||[];r.set("",n),n.push(i)}else if(i instanceof Bi){let n=r.get(i.globalIndex)||[];r.set(i.globalIndex,n),n.push(...i.getPads())}e.add(i)}}return Array.from(r.values())}getFanoutModels(t){let e=[];for(let r of Object.keys(t)){let i=t[r].getAll();e.push(...i)}return e}deleteViolateDRCResult(t){let{config:e}=this.env,r=new ef(xb());$i.getInstance().initialEnv(r),ci.getInstance().deleteAllError();let i=this.getFanoutModels(t),n=c=>this.progress.updateProgress(.75+.25*c);for(let c of i)c instanceof gt?e.track.widthRuleType==="FollowRule"&&xS.checkTrackWidth(c):c instanceof Ct&&(MR.checkBindVia(c),e.via.sizeType==="FollowRule"&&sf.checkVia(c));let s=c=>c[0]instanceof hn||c[1]instanceof hn?!1:!(c[0]instanceof yn||c[1]instanceof yn);kR.checkSpacingError(i,{disableProgressFromWorker:!0,excludeCheckPair:s,onProgress:n}),$i.getInstance().clear();let a=new Set,l=ci.getInstance().getAllItem();for(let c of l)c instanceof O0||c instanceof yI?(a.add(c.obj1),a.add(c.obj2)):c instanceof Oy?a.add(c.obj1):c instanceof Cy?a.add(c.obj):c instanceof Ty?(a.add(c.obj1),a.add(c.obj2)):c instanceof _b?a.add(c.obj):c instanceof Ey&&a.add(c.obj1);for(let c of Object.keys(t)){let h=t[c];h.getAll().some(d=>a.has(d.globalIndex))&&(h.tracks.forEach(d=>{Sn.getInstance().delete(d,d.globalIndex)}),bn.getInstance().delete(h.via,h.via.globalIndex),delete t[c])}ci.getInstance().deleteAllError()}initialProgress(){let t=this.progress;t.reset(),t.onProgress(e=>{self.workerBus!=null&&self.workerBus.publish("progressUpdate",{ratio:e,descripte:"batchFanout"})})}};function $He(o,t,e){return new L9e(t).fanout(o,e)}var gae=class extends h1{constructor(e,r,i,n,s,a){super(e,r,i,s,a);this._octagon=null;this._mortonCode=null;this.width=n}get mortonCode(){return this._mortonCode===null&&(this._mortonCode=P3((this._startPoint.x+this._endPoint.x)/2,(this._startPoint.y+this._endPoint.y)/2)),this._mortonCode}get octagon(){if(this._octagon===null){let e=this.width/2,r=this._startPoint.x-this._endPoint.x,i,n;r<0?(i=this._startPoint,n=this._endPoint):(i=this._endPoint,n=this._startPoint);let s=i.x,a=i.y,l=n.x,c=n.y,h=a-c,u=s-e,d=l+e,p=e,m=-e;if(h<0?(m+=a,p+=c):(m+=c,p+=a),r===0||h===0)return new bI(u,d,m,p,m+u,d-m,u-p,p+d);{let g,y,b,P,T,I,C,E,O;return h<0?(g=1,y=1,C=Math.sqrt(e*e*(g*g+y*y)),E=g*s+y*a,O=g*l+y*c,b=Math.min(C+E,-C+E),P=Math.max(C+O,-C+O),g=-1,y=1,C=Math.sqrt(e*e*(g*g+y*y)),E=g*s+y*a,O=g*l+y*c,(c-a)/(l-s)>1?(T=Math.min(-C-O,C-O),I=Math.max(-C-E,C-E)):(T=Math.min(-C-E,C-E),I=Math.max(-C-O,C-O))):(g=-1,y=1,C=Math.sqrt(e*e*(g*g+y*y)),E=g*s+y*a,O=g*l+y*c,T=Math.min(-C-E,C-E),I=Math.max(-C-O,C-O),g=1,y=1,C=Math.sqrt(e*e*(g*g+y*y)),E=g*s+y*a,O=g*l+y*c,(c-a)/(l-s)>-1?(b=Math.min(C+E,-C+E),P=Math.max(C+O,-C+O)):(b=Math.min(C+O,-C+O),P=Math.max(C+E,-C+E))),new bI(u,d,m,p,b,I,T,P)}}return this._octagon}};var I1=class{static shore(t,e=new S(0,0)){return new ht(-t+e.x,t+e.x,-t+e.y,t+e.y)}static num(t,e,r,i){let n=[];for(;r--;)n.push(i?Math.floor(Math.random()*(e-t)+t):Math.random()*(e-t)+t);return n}static point(t,e){let r=this.num(t.minX,t.maxX,e),i=this.num(t.minY,t.maxY,e),n=[];for(let s=0;s<e;s++)n.push(new S(r[s],i[s]));return n}static line(t,e){let r=this.point(t,2*e),i=[];for(let n=0;n<e*2;n+=2)i.push(new M(r[n],r[n+1]));return i}static foTrack(t,e,r,i){let n=this.line(r,i),s=this.num(t,e,i),a=[];for(let l=0;l<i;l++)a.push(new gae(null,null,null,s[l],new Rp(n[l].start().x,n[l].start().y),new Rp(n[l].end().x,n[l].end().y)));return a}static bbox(t,e,r,i){let n=this.point(t,i),s=this.num(e,r,i),a=[];for(let l=0;l<i;l++)a.push(this.shore(s[l],n[l]));return a}};var yae=class{constructor(t){this.capacity=t}},bae=class{constructor(){this.items=new Set;this.addItems=new Set;this.removeItems=new Set}insert(t){return this.items.has(t)?this:(this.addItems.add(t),this)}remove(t){return this.items.has(t)?(this.removeItems.add(t),this):this}bbox(){return this.flush(),this.root.bbox()}search(t){return this.flush(),this.root.search(t)}recycle(){this.items.clear(),this.addItems.clear(),this.removeItems.clear(),this.root.recycle()}flush(){this.chang&&(this.removeItems.forEach(e=>this.items.delete(e)),this.addItems.forEach(e=>this.items.add(e)),this.root=this.buildRoot(),this.removeItems.clear(),this.addItems.clear())}get chang(){return this.removeItems.size+this.addItems.size===0?0:(this.removeItems.forEach(t=>{this.addItems.has(t)&&(this.addItems.delete(t),this.removeItems.delete(t))}),this.removeItems.size+this.addItems.size)}};var Pae=class extends yae{constructor(e,r){super(e);this._octagon=null;Array.isArray(r)?this.nodes=r:this.item=r}get octagon(){if(this._octagon===null)if(this.item===void 0){let e=this.nodes[0].octagon;for(let r=1;r<this.nodes.length;r++)e=e.union(this.nodes[r].octagon);this._octagon=e}else this._octagon=this.item.octagon;return this._octagon}search(e){let r=e instanceof ht?Lc.converBBox(e):e;if(this.item===void 0){let i=[];return this.nodes.forEach(n=>{n.octagon.isIntersectOctagon(r)&&n.search(r).forEach(s=>i.push(s))}),i}else if(this.item.octagon.isIntersectOctagon(r))return[this.item]}recycle(){this._octagon=null,this.item=void 0,this.nodes=void 0}remove(e){throw new Error("Method not implemented.")}insert(e){throw new Error("Method not implemented.")}bbox(){throw new Error("Method not implemented.")}},EX=class extends bae{constructor(t){super(),this.capacity=t}buildRoot(){let t=Array.from(this.items).sort((e,r)=>e.mortonCode-r.mortonCode).map(e=>new Pae(this.capacity,e));for(;t.length!==1;){let e=[];for(let r=0;r<t.length;r+=this.capacity){let i=[],n=this.capacity+r>=t.length?t.length:r+this.capacity;for(let s=r;s<n;s++)i.push(t[s]);e.push(new Pae(this.capacity,i))}t=e}return this.root=t[0],t[0]}};var Tae=class{getAllPCBItem(){return new ZP().shapes}getAllTrack(){return this.getAllPCBItem().filter(t=>t.modelType==="Track")}};function KHe(o,t=!0){if(t){console.log("throw new Error"+o?o:"");return}throw new Error(o||"")}var Iae=class{constructor(t){this._octagon=null;this.item=null;t instanceof zr?this.item=t:KHe()}octagon(){return this._octagon===null&&(this._octagon=Lc.trackToOctagon(this.item.start,this.item.end,this.item.width)),this._octagon}},M9e=class extends Tae{main(){}mordonCode(){ko.init(A);let e=[];for(let r=0;r<1e3;r++)for(let i=0;i<1e3;i++)e.push(new S(r,i));e.sort((r,i)=>P3(r.x,r.y)-P3(i.x,i.y));for(let r=0;r<999;r++)ko.auto(new M(e[r],e[r+1]),ee.GREEN)}dynamicOctagonRtree(){let t=new rT(10),e=this.getAllTrack();e.forEach(r=>{t.insert(new Iae(r))}),console.log(e),ko.init(A),t.items.forEach(r=>{let i=r.octagon().outline();ko.auto(i)}),t.itor(r=>{},!0)}aa(){ko.init(A);let t=I1.point(I1.shore(200,new S(0,0)),50);ko.auto(t,ee.GREEN),t.sort((l,c)=>P3(l.x,l.y)-P3(c.x,c.y));let e=new _e;t.forEach(l=>{e.ext2(l)}),ko.auto(e.build());let r=e.build(),i=r.UR(),n=r.LL(),s=t[0],a=t[0];t.forEach(l=>{l.distance1(i)<s.distance1(i)&&(s=l),l.distance1(n)<a.distance1(n)&&(a=l)}),ko.auto(t[0],ee.BLUE),ko.auto(t[t.length-1],ee.RED),ko,a==t[0]&&console.log("ll: true"),s==t[t.length-1]&&console.log("lr: true")}a(){ko.init(A),ko.clear();let t=(()=>{let e=[];return kt.map.forEach(r=>{r.forEach(i=>{i instanceof r0&&e.push(i)})}),e})().forEach(e=>{e.itor((r,i)=>{},!0)})}main1(){let t=new r0(10),e=this.getAllTrack();e.forEach(r=>{t.insert(new Iae(r))}),console.log(e),ko.init(A),t.items.forEach(r=>{let i=r.octagon().outline();ko.auto(i)}),t.itor(r=>{})}bvhSPilt(){ko.init(ks.getBus());let t=I1.foTrack(3,6,I1.shore(1e3),10),e=new EX(3);t.forEach(r=>{ko.auto(r.conver(),ee.WHITE),r.octagon.get().forEach(i=>{ko.auto(i.conver(),ee.WHITE)}),e.insert(r)}),e.flush(),this.drawOct(e.root.octagon,ee.GREEN),e.root.nodes.forEach(r=>{r.nodes.forEach(i=>{this.drawOct(i.octagon,ee.RED)})})}drawOct(t,e){t.get().forEach(r=>{ko.auto(r.conver(),e)})}bvhSearch(){ko.init(ks.getBus());let t=I1.foTrack(3,6,I1.shore(500),10),e=new EX(3);t.forEach(i=>{ko.auto(i.conver(),ee.WHITE),i.octagon.get().forEach(n=>{ko.auto(n.conver(),ee.WHITE)}),e.insert(i)});let r=I1.bbox(I1.shore(500),60,100,1)[0];ko.auto(r,ee.GREEN),e.search(r).forEach(i=>{ko.auto(i.conver(),ee.RED),i.octagon.get().forEach(n=>{ko.auto(n.conver(),ee.RED)})})}converBBox(){ko.init(ks.getBus());let t=I1.bbox(I1.shore(500),60,100,1)[0];ko.auto(t,ee.GREEN),ko.clear(),Lc.converBBox(t).get().forEach(e=>{ko.auto(e.conver(),ee.BLUE)})}union(){ko.init(ks.getBus());let t=I1.foTrack(3,6,I1.shore(100),2);ko.auto(t[0].conver(),ee.GREEN),ko.auto(t[1].conver(),ee.BLUE),t[0].octagon.get().forEach(e=>{ko.auto(e.conver(),ee.WHITE)}),t[1].octagon.get().forEach(e=>{ko.auto(e.conver(),ee.WHITE)}),t[0].octagon.union(t[1].octagon).get().forEach(e=>{ko.auto(e.conver(),ee.RED)})}intersectionTest(){ko.init(ks.getBus());let t=I1.foTrack(3,6,I1.shore(100),2);ko.auto(t[0].conver(),ee.GREEN),ko.auto(t[1].conver(),ee.BLUE);let e=t[0].octagon.isIntersectOctagon(t[1].octagon)?ee.RED:ee.WHITE;t[0].octagon.get().forEach(r=>{ko.auto(r.conver(),e)}),t[1].octagon.get().forEach(r=>{ko.auto(r.conver(),e)})}},ZHe=new M9e;var UWe=Ru(r2());function N9e(o=!1){let t=new Array,e=new Array,r=new Array,i=new Array,n=Ms.getInstance().getAllItem();for(let T of n){let I=T.attributes;for(let C of I)(3==C.layerId||4==C.layerId)&&C.getText()!=""&&t.push(C)}let s=Qi.getInstance().getAllItem(),a=vi.getInstance().getAllItem(),l=Fi.getInstance().getAllItem(),c=sl.getInstance().getAllItem(),h=Na.getInstance().getAllItem(),u=Ma.getInstance().getAllItem(),d=io.getInstance().getAllItem(),p=Hs.getInstance().getAllItem(),m=new Map,g=[].concat(s,a,l,c,h,u,d,p);for(let T of g)if((3==T.layerId||4==T.layerId)&&T.getParent()==null){if(T instanceof Li)if(m.has(T.value)){let I=m.get(T.value);if(I.some(E=>!!d.find(_=>_.globalIndex==E).equals(T)))continue;I.push(T.globalIndex)}else m.set(T.value,[T.globalIndex]);r.push(T)}for(let T of n){let I=T.getItems();for(let C of I)(3==C.layerId||4==C.layerId)&&e.push(C)}let y=_p.getInstance().getAllItem();for(let T of y)(3==T.layerId||4==T.layerId)&&i.push(T);let b=(T,I)=>{let C=T.getParent(),E=I.getParent();return C!=null&&E!=null?C.globalIndex.length>E.globalIndex.length?1:C.globalIndex.length<E.globalIndex.length?-1:C.zIndex-E.zIndex:C!=null&&E==null?C.globalIndex.length>I.globalIndex.length?1:C.globalIndex.length<I.globalIndex.length?-1:C.zIndex-I.zIndex:C==null&&E!=null?T.globalIndex.length>E.globalIndex.length?1:T.globalIndex.length<E.globalIndex.length?-1:T.zIndex-E.zIndex:T.globalIndex.length>I.globalIndex.length?1:T.globalIndex.length<I.globalIndex.length?-1:T.zIndex-I.zIndex};t.sort(b),e.sort(b),r.sort(b),i.sort(b);let P=new Array;return xe.addAll(P,i),xe.addAll(P,r),xe.addAll(P,e),xe.addAll(P,t),o?P:P.reverse()}var OX=Ru(r2());function JHe(o,t=.05){if(o.length<3)return o.slice();let e=o[0],r=[e];for(let l=1;l<o.length;l++){let c=o[l];e.equals1(c)||r.push(c),e=c}if(e!==r[r.length-1]&&(r.length!==1&&r.pop(),r.push(e)),t<0)return r;let i=r[1],n=i.sub(r[0]).normalize(),s=0,a=[r[0]];for(let l=2;l<r.length;l++){let c=r[l],h=c.sub(i).normalize();s+=Math.acos(Math.min(1,Math.max(-1,n.dot(h)))),s>t&&(a.push(i),s=0),i=c,n=h}return a.push(i),a}function UAt(o,t,e=.01){let r=[],i=[];for(let u of o)if(u instanceof M)r.length===0&&r.push(u.start()),r.push(u.end());else{let d=JHe(r,e);r.length=0;let p=d[0];for(let m=1;m<d.length;m++){let g=d[m];i.push(new M(p,g)),p=g}i.push(u)}let n=JHe(r,e),s=n[0];for(let u=1;u<n.length;u++){let d=n[u];i.push(new M(s,d)),s=d}let a=[],l,c=[];for(let u of i){if(!(u instanceof M)){h(),c.push(u);continue}if(a.length===0){a.push(u.start(),u.end());continue}if(!u.start().equals1(a[a.length-1])){h(),a.push(u.start(),u.end());continue}a.push(u.end());let d=a[a.length-3],p=a[a.length-2],m=a[a.length-1],g=d.distance2(p)/m.distance2(p);if(g>4||g<.25){h(),a.push(u.start(),u.end());continue}let y=d.sub(p).normalize(),b=m.sub(p).normalize(),P=y.dot(b);if(ne.eq(P,-1)||P>-.95){h(),a.push(u.start(),u.end());continue}let T=y.cross(b);if(l&&l.sweepAngle*T>0){h(),a.push(u.start(),u.end());continue}let I=a[0];if(I.equals1(m)){l?(l=q.build3(l.center,0,-360,l.rx,l.rx),h()):(h(),a.push(u.start(),u.end()));continue}let C=I.add(m).scale(.5),E=I.sub(m),O=-E.y,_=E.x,x=0,v=0,D=0,w=0;for(let N of a)x+=N.x,v+=N.y,D+=N.x**2,w+=N.y**2;x/=a.length,v/=a.length,D/=a.length,w/=a.length;let F=I.x,H=I.y,z=2*O*(x-F)+2*_*(v-H);if(ne.eq(z,0)){h(),a.push(u.start(),u.end());continue}let V=(D-F**2-2*C.x*(x-F)+w-H**2-2*C.y*(v-H))/z,W=new S(C.x+V*O,C.y+V*_),L=I.distance1(W),k;for(let N of a){let U=Math.abs(N.distance1(W)-L),B=k?Math.abs(N.add(k).scale(.5).distance1(W)-L):0;if(U>t||B>t){h(),a.push(u.start(),u.end());break}k=N}a.length!==2&&(l=q.build2(W,I.angleD(W),a[a.length-1].angleD(W),L,L,T>0?ae.CW:ae.CCW))}return h(),c;function h(){l?(c.push(l),l=null,a.length=0):a.length!==0&&(c.push(new M(a[0],a[1])),a.length=0)}}var HAt=typeof window>"u"||window["META-PANELIZE-ENV"]?!1:/\bpcbBoolDebug\b/.test(Q().location.search),k9e;HAt&&(typeof window<"u"?k9e=window._MSG_BUS_=window._MSG_BUS_||new OX.MessageBus:k9e=new OX.WorkerMessageBridge(new OX.MessageBus,self));var AX=class{constructor(){this.union1=[]}addPolyline(t){this.union([t]).forEach(e=>this.union1.push(e))}addPolylineGroup(t){this.union(t.items).forEach(e=>this.union1.push(e))}transform(t){for(let e=0;e<this.union1.length;e++)this.union1[e]=this.union1[e].multiply3(t)}getUnion(){if(this.union1.length===0)return[];if(this.union1.length===1)return this.union1[0].toPolylineGroup();let t=[Cl.UNION];return this.union1.forEach(r=>{t.push(r)}),this.run(t).toPolylineGroups()}union(t){let e=new MP(!1),r=new iI(Mz.rule,new Di(1),e);for(let n of t)r.addPolyline(n.asClose());r.simplify();let i=[];return e.plGrps.forEach(n=>{let s=[bf(n.items[0])];if(s[0]){for(let a=1;a<n.items.length;a++){let l=bf(n.items[a]);l&&s.push(l)}i.push(new Zo(s))}}),i.length?i:this.unionByNormalizePts(t)}unionByNormalizePts(t,e=.01,r=.01){let i=new MP(!1),n=new iI(Mz.rule,new Di(1),i);for(let a of t)n.addPolyline(ge.build7(UAt(a.asClose().primitives,e,r)));n.simplify();let s=[];return i.plGrps.forEach(a=>{let l=[bf(a.items[0])];if(l[0]){for(let c=1;c<a.items.length;c++){let h=bf(a.items[c]);h&&l.push(h)}s.push(new Zo(l))}}),s}gnrBooleanRules(t){let e=[Cl.UNION],r=[Cl.UNION];for(let i of t){let n=C_(i),s=e.length,a=r.length;for(let l of n){if(l.primitives.length===0){console.error("ply.primitives.length === 0");continue}l.area(.1)>0?r.push(l.reverse()):e.push(l)}s!==e.length&&a!==r.length&&e.push([Cl.DIFF,[Cl.UNION,...e.splice(s)],[Cl.UNION,...r.splice(a)]])}return e.length===1?(console.warn("unionPls.length === 1"),null):this.run(r.length===1?e:[Cl.DIFF,e,r]).items}run(t){let e=kE(),r=hP(t,k9e);return Y2.runBoolean+=wT(e),r}};var _X=class{constructor(){this.conversion=new dt;this.outlines=new Array;this.topSolder=new Array;this.bottomSolder=new Array;this.topSolderBool=new AX;this.bottomSolderBool=new AX;this.topSilkSVG=new Array;this.bottomSilkSVG=new Array;this.boardOutlineSVG=new Array;this.matrix=Qe.translate1(R.getInstance().origin.mul(-1));this.allItemBBox=of();this.allItemOutline=ge.build4([this.allItemBBox.LL(),this.allItemBBox.UL(),this.allItemBBox.UR(),this.allItemBBox.LR(),this.allItemBBox.LL()]);this.bbox=this.allItemBBox.transform(this.matrix);this.pl=ge.build4([this.bbox.LL(),this.bbox.UL(),this.bbox.UR(),this.bbox.LR(),this.bbox.LL()]);this.expansion=this.conversion.conversion("mm","mil",.02)}generate(t,e){let r=N9e(!0);this.generateUniversal(),this.collectCircularOutlines(),this.getOutline();for(let a of r)a instanceof or?(this.getProfilePolyline(a,5,this.topSolderBool,this.expansion),this.getProfilePolyline(a,6,this.bottomSolderBool,this.expansion),this.getProfileSVG(a,3,this.topSilkSVG),this.getProfileSVG(a,4,this.bottomSilkSVG)):a instanceof et?(this.getPadPolyline(a,5,this.topSolderBool,this.expansion),this.getPadPolyline(a,6,this.bottomSolderBool,this.expansion)):a instanceof Li?(this.getTextPolyline(a,5,this.topSolder,this.topSolderBool,0),this.getTextPolyline(a,6,this.bottomSolder,this.bottomSolderBool,0),this.getTextSVG(a,3,this.topSilkSVG,!1),this.getTextSVG(a,4,this.bottomSilkSVG,!1)):a instanceof Dl?(this.getImagePolyline(a,5,this.topSolder,this.topSolderBool,0),this.getImagePolyline(a,6,this.bottomSolder,this.bottomSolderBool,0),this.getImageSVG(a,3,this.topSilkSVG,!1),this.getImageSVG(a,4,this.bottomSilkSVG,!1)):a instanceof gy?(this.getDimensionSVG(a,3,this.topSilkSVG),this.getDimensionSVG(a,4,this.bottomSilkSVG)):a instanceof Ct?(this.getViaPolyline(a,5,this.topSolderBool,this.expansion),this.getViaPolyline(a,6,this.bottomSolderBool,this.expansion)):a instanceof Ff&&(this.getPictureSVG(a,3,this.topSilkSVG),this.getPictureSVG(a,4,this.bottomSilkSVG));let i=this.generateSVG(this.topSolder,this.topSolderBool,this.topSilkSVG,t,e),n=this.generateSVG(this.bottomSolder,this.bottomSolderBool,this.bottomSilkSVG,t,e,!0),s=this.generateBoardOutlineSVG();return{TOPSILK:i,BOTTOMSILK:n,BOARDOUTLINE:s}}generateSVG(t,e,r,i,n,s=!1){var P;for(let T=0;T<t.length;T++){let I=t[T];for(let C=0;C<I.length;C++)I[C]=I[C].multiply3(this.matrix)}e.transform(this.matrix);let a=n?n.map(T=>[T.x,T.y].join(" ")).join(" "):"",l=new dt,c=i!=null&&i.success&&!(i!=null&&i.onlyOutline)?si.getInstance().outerBBox.transform(this.matrix):((P=sV())==null?void 0:P.transform(this.matrix))||this.bbox,h=l.conversion1("mil","mm",c.width()*10),u=l.conversion1("mil","mm",c.height()*10),d=`<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg
        width="${h}mm"
        height="${u}mm"
		boardBox="${c.minX} ${-c.maxY} ${c.width()} ${c.height()}"
        viewBox="${c.minX} ${-c.maxY} ${c.width()} ${c.height()}"
        version="1.1"
		eda-version="2.3(2026-04-10)"
		mark-points="${a}"
        xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
        xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
        xmlns:xlink="http://www.w3.org/1999/xlink"
        xmlns="http://www.w3.org/2000/svg"
        xmlns:svg="http://www.w3.org/2000/svg">`,{clipPath:p,name:m}=this.genarateClipPath(t,e);d+=p;let g=i==null?void 0:i.success,y=si.getInstance().getDefaultPanelize(),b=y.onlyOutline;if(g&&!b){let T=y.row,I=y.column,C=si.getInstance().offset,E=sV().transform(this.matrix),O=E.width(),_="";for(let D=0;D<T;D++)for(let w=0;w<I;w++)_+=`<use xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#multiSilk" x="${c.minX+1*w*C.x}" y="${-c.maxY-D*C.y}" width="${c.width()}" height="${c.height()}" />`;d+=`<defs><symbol id="multiSilk" viewBox="${c.minX} ${-c.maxY} ${c.width()} ${c.height()}"><g clip-path='url(#${m})' transform="scale(${s?-1:1} 1) translate(${s?-(E.minX*2+O):0} 0)">`;let x=s?we.bottomBoardColor:we.topBoardColor,v=this.getPolylineSVG(this.pl,x,"none","background",0);d+=v;for(let D of r)d+=D;return d+=`</g></symbol></defs>${_}</svg>`,d}else{d+=`<g clip-path='url(#${m})' transform="scale(${s?-1:1} 1) translate(${s?-(c.minX*2+c.width()):0} 0)">`;let T=s?we.bottomBoardColor:we.topBoardColor,I=this.getPolylineSVG(this.pl,T,"none","background",0);d+=I;for(let C of r)d+=C;return d+="</g></svg>",d}}generateBoardOutlineSVG(){let{outlines:t,bbox:e}=this.getRawOutline(),r=new dt,i=e.width(),n=e.height(),s=r.conversion1("px(100)","mm",i),a=r.conversion1("px(100)","mm",n),l=`<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg
        width="${s}mm"
        height="${a}mm"
        viewBox="${e.minX} ${-e.maxY} ${i} ${n}"
        version="1.1"
        xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
        xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
        xmlns:xlink="http://www.w3.org/1999/xlink"
        xmlns="http://www.w3.org/2000/svg"
        xmlns:svg="http://www.w3.org/2000/svg">`;return t.forEach(c=>{let h=this.getPolylineSVG(c,"none","green","boardOutline",2);l+=h}),l+="</svg>",l}genarateClipPath(t,e){let r="",i=new Array,n=0,s=`clipPath${n}`,a=s;for(let g of this.outlines)if(g.length>0){let y=`<defs><clipPath id='${s}'>`,b=zb(g);n==0?y+=`<path d="${b.join(" ")}" id="outline${n}" stroke="none"  style="fill-opacity:1;fill-rule:nonzero;fill:block;"/>`:y+=`<path d="${b.join(" ")}" id="outline${n}" stroke="none"  style="fill-opacity:1;fill-rule:nonzero;fill:block;" clip-path='url(#${a})'/>`,y+="</clipPath></defs>",r+=y,n++,a=s,s=`clipPath${n}`}for(let g of t)if(Array.isArray(g)){let y=`<defs><clipPath id='${s}'>`,b=zb(g);n==0?y+=`<path d="${b.join(" ")}" id="solder${n}" stroke="none"  style="fill-opacity:1;fill-rule:nonzero;fill:block;"/>`:y+=`<path d="${b.join(" ")}" id="solder${n}" stroke="none"  style="fill-opacity:1;fill-rule:nonzero;fill:block;" clip-path='url(#${a})'/>`,y+="</clipPath></defs>",r+=y,n++,a=s,s=`clipPath${n}`}let l=e.getUnion(),c=new Array;if(l instanceof Bt)c.push(l.items);else for(let g of l)c.push(g.items);let u=new Ec().getSubtraction2([[this.pl]],c,[[2],c.map(g=>2)]);t.length==0&&a==s?r+=`<defs><clipPath id='${s}'>`:r+=`<defs><clipPath id='${s}' clip-path='url(#${a})'>`;let d=new Array;for(let g of u)xe.addAll(d,g.items);let m=`<path d="${zb(d).join(" ")}" id="solder${n}" stroke="none"  style="fill-opacity:1;fill-rule:nonzero;fill:block"/>`;return r+=m,r+="</clipPath></defs>",{clipPath:r,name:s}}mergeNoneZero(t){let e=new Ec,r=25,i=new Array;for(let s=0;s<t.length;s+=r){let a=s+r;t.length<a&&(a=t.length);let l=e.getUnion(t.slice(s,a));for(let c of l)xe.addAll(i,c.items)}let n=new Array;if(i.length==1)xe.addAll(n,i);else{let s=e.getUnion(i);for(let a of s)xe.addAll(n,a.items)}return n}generateUniversal(){let t=vi.getInstance().getAllItem(),e=Qi.getInstance().getAllItem(),r=Fi.getInstance().getAllItem(),i=jn.getInstance().getAllItem(),n=io.getInstance().getAllItem(),s=Hs.getInstance().getAllItem(),a=bn.getInstance().getAllItem(),l=[].concat(t,e,r);for(let c of l)this.getProfilePolyline(c,5,this.topSolderBool,this.expansion),this.getProfilePolyline(c,6,this.bottomSolderBool,this.expansion);for(let c of i)this.getPadPolyline(c,5,this.topSolderBool,this.expansion),this.getPadPolyline(c,6,this.bottomSolderBool,this.expansion),this.getPadPolyline(c,47,this.topSolderBool,this.expansion),this.getPadPolyline(c,47,this.bottomSolderBool,this.expansion);for(let c of n)this.getTextPolyline(c,5,this.topSolder,this.topSolderBool,0),this.getTextPolyline(c,6,this.bottomSolder,this.bottomSolderBool,0);for(let c of s)this.getImagePolyline(c,5,this.topSolder,this.topSolderBool,0),this.getImagePolyline(c,6,this.bottomSolder,this.bottomSolderBool,0);for(let c of a)this.getViaPolyline(c,5,this.topSolderBool,this.expansion),this.getViaPolyline(c,6,this.bottomSolderBool,this.expansion)}collectCircularOutlines(){let t=Au(),e=6.5;for(let r of t)if(r instanceof yo){let i=r.radius;if(gn(tb(i*2,10,39.37),3)<=e){let s=r.getMathGraphics();s instanceof ge&&(this.topSolderBool.addPolyline(s),this.bottomSolderBool.addPolyline(s))}}}getRawOutline(){let t=Au(),e=[],r=new _e;for(let i of t){let n=i.getMathGraphics();n instanceof ge?e.push(n):e.push(...n.items),r.ext1(n.bbox())}return{outlines:e,bbox:r.build1()}}getOutline(){let t=Au(),e=new Array;for(let h of t){let u=h.getMathGraphics();xe.addAll(e,u.primitives)}let i=new $c(this.allItemBBox.extendOfSize(10),2,.1,new Di(4),e).detect(),n=new Array,s=1e4,a=!1,l=0;i.items.some(h=>(l+=h.primitives.length,l>s?(a=!0,!0):!1));let c=tb(-.2,39.37,10);for(let h of i.items)nh(h)&&(h=h.reverse()),h=h.multiply3(this.matrix),a?n.push(h):V1.getExtendPolyLine(h,c).forEach(u=>n.push(u));this.outlines.push(n)}getProfilePolyline(t,e,r,i=0){if(t.layerId==e||t.layerId==12)switch(t.type){case"Line":{let n=t.getMathGraphics(),s=t.strokeWidth;for(let a of n.primitives)r.addPolyline(a.stroke(s+i*2,wr.ROUND,ae.CW));break}case"Slot Region":{let n=t.getMathGraphics(),s=n instanceof Bt?n.items:[n],a=new Array;s.forEach(c=>{if(a.push(c),i>0)for(let h of c.primitives)a.push(h.stroke(i*2,wr.ROUND,ae.CW))});let l=this.mergeNoneZero(a);for(let c of l)r.addPolyline(c);break}case"Fill Region":{let n=t.getMathGraphics();if(n instanceof Bt){let s=n.getOutMostPolyline();if(nh(s)){let l=new Array;for(let c of n.items)l.push(c.reverse());r.addPolylineGroup(new Bt(l))}else r.addPolylineGroup(n)}else nh(n)&&(n=n.reverse()),r.addPolyline(n);break}}}getTextPolyline(t,e,r,i,n=0){if(t.layerId==e){let s=t.getRealOutline();if(t.type==1){let a=new Array,l=new Array,c=!1;for(let h of s)if(h.order==0){nh(h.pl)?c=!1:c=!0;break}for(let h of s)h.order==0&&l.push(h.pl.asClose()),c?a.push(h.pl.reverse()):a.push(h.pl);if(a.length>0&&(a.push(this.allItemOutline),r.push(a)),n>0)for(let h of s)for(let u of h.pl.primitives)i.addPolyline(u.stroke(n*2,wr.ROUND,ae.CW))}else{let a=t.strokeWidth;for(let l of s)for(let c of l.primitives)i.addPolyline(c.stroke(a+n*2,wr.ROUND,ae.CW))}}}getImagePolyline(t,e,r,i,n=0){if(t.layerId==e){let s=t.getPath(),a=new Array,l=new Array,c=!1;for(let h of s)if(h.order==0){nh(h.pl)?c=!1:c=!0;break}for(let h of s)h.order==0&&a.push(h.pl.asClose()),c?l.push(h.pl.reverse()):l.push(h.pl);if(l.length>0&&(l.push(this.allItemOutline),r.push(l)),n>0)for(let h of s)for(let u of h.pl.primitives)i.addPolyline(u.stroke(n*2,wr.ROUND,ae.CW))}}getPadPolyline(t,e,r,i=0){let n=t.getMathGraphics(e,i);n!=null&&r.addPolyline(n)}getViaPolyline(t,e,r,i=0){let n=t.getMathGraphics(e,i);n!=null&&r.addPolyline(n)}getProfileSVG(t,e,r,i=0){let n=this.getColor(t,e);if(t.layerId==e)switch(t.type){case"Line":{let s=t.getMathGraphics().multiply3(this.matrix),a=t.strokeWidth;for(let l of s.primitives)if(l instanceof M){let c=this.getLineSVG(l,"none",n,t.globalIndex,i+a);r.push(c)}else if(l instanceof q){let c=this.getArcSVG(l,"none",n,t.globalIndex,i+a);r.push(c)}else if(l instanceof Dr){let c=this.getBezierSVG(l,"none",n,t.globalIndex,i+a);r.push(c)}break}case"Fill Region":{let s=t.getMathGraphics().multiply3(this.matrix),a=s instanceof Bt?s.items:[s],c=`<path d="${zb(a).join(" ")}" id="${t.globalIndex}" stroke="none" layerid="${t.layerId}" style="fill-opacity:1;fill-rule:nonzero;fill:${n}"/>`;r.push(c),a.forEach(h=>{if(i>0){for(let u of h.primitives)if(u instanceof M){let d=this.getLineSVG(u,"none",n,t.globalIndex,i);r.push(d)}else if(u instanceof q){let d=this.getArcSVG(u,"none",n,t.globalIndex,i);r.push(d)}else if(u instanceof Dr){let d=this.getBezierSVG(u,"none",n,t.globalIndex,i);r.push(d)}}});break}}}getPadSVG(t,e,r,i=0){let n=t.getMathGraphics(e,i);if(n!=null){let s=this.getPolylineSVG(n,"block","none",t.globalIndex,0);r.push(s);let{type:a}=t.getPad(e);if(i>0&&a=="POLYGON"){for(let l of n.primitives)if(l instanceof M){let c=this.getLineSVG(l,"none","block",t.globalIndex,i);r.push(c)}else if(l instanceof q){let c=this.getArcSVG(l,"none","block",t.globalIndex,i);r.push(c)}else if(l instanceof Dr){let c=this.getBezierSVG(l,"none","block",t.globalIndex,i);r.push(c)}}}}getTextSVG(t,e,r,i,n=0){if(t.layerId==e){let s=i?"block":this.getColor(t,e),a=t.getTextOutline().map(l=>l.multiply3(this.matrix));if(t.type==1){let c=`<path xmlns="http://www.w3.org/2000/svg" d="${zb(a).join()}" id="${t.globalIndex}" stroke="none" layerid="${t.layerId}" style="fill-opacity:1;fill-rule:nonzero;fill:${s}"/>`;if(r.push(c),n>0){for(let h of a)for(let u of h.primitives)if(u instanceof M){let d=this.getLineSVG(u,"none",s,t.globalIndex,n);r.push(d)}else if(u instanceof q){let d=this.getArcSVG(u,"none",s,t.globalIndex,n);r.push(d)}else if(u instanceof Dr){let d=this.getBezierSVG(u,"none",s,t.globalIndex,n);r.push(d)}}}else for(let l of a)for(let c of l.primitives)if(c instanceof M){let h=this.getLineSVG(c,"none",s,t.globalIndex,t.strokeWidth);r.push(h)}else if(c instanceof q){let h=this.getArcSVG(c,"none",s,t.globalIndex,t.strokeWidth);r.push(h)}else if(c instanceof Dr){let h=this.getBezierSVG(c,"none",s,t.globalIndex,t.strokeWidth);r.push(h)}}}getImageSVG(t,e,r,i,n=0){if(t.layerId==e){let s=i?"block":this.getColor(t,e),a=t.getRealPath().map(h=>h.multiply3(this.matrix)),c=`<path d="${zb(a).join(" ")}" id="${t.globalIndex}" stroke="none" layerid="${t.layerId}" style="fill-opacity:1;fill-rule:nonzero;fill:${s}"/>`;if(r.push(c),n>0){for(let h of a)for(let u of h.primitives)if(u instanceof M){let d=this.getLineSVG(u,"block",s,t.globalIndex,n);r.push(d)}else if(u instanceof q){let d=this.getArcSVG(u,"block",s,t.globalIndex,n);r.push(d)}else if(u instanceof Dr){let d=this.getBezierSVG(u,"block",s,t.globalIndex,n);r.push(d)}}}}getViaSVG(t,e,r,i=0){let n=t.getMathGraphics(e,i);if(n!=null){let s=this.getPolylineSVG(n,"block","none",t.globalIndex,0);r.push(s)}}getPictureSVG(t,e,r,i=0){if(t.layerId==e){let n=qd.getItem(t.hashId),s=n.source.src,a=t.start.sub(R.getInstance().origin),l=n.source.width,c=n.source.height,h=t.width/l,u=t.height/c,d;t.needMirror()?d=Ae.scale(-h,u,1).rotateZ(t.rotation).translate1(a.x,-a.y,0).toMatrix3():d=Ae.scale(h,u,1).rotateZ(-t.rotation).translate1(a.x,-a.y,0).toMatrix3();let p=`<image width = "${l}" height ="${c}" preserveAspectRatio="none" xlink:href="${s}" transform="matrix(${d.data[0]} ${d.data[1]} ${d.data[3]} ${d.data[4]} ${d.data[6]} ${d.data[7]})"/>`;r.push(p)}}getDimensionSVG(t,e,r,i=0){if(t.layerId==e){let n=t.getBaseGraphics();for(let s of n)for(let a of s)if(a instanceof M){a=a.multiply3(this.matrix);let l=`<line
                        x1 = "${a.start().x}"
                        x2 ="${a.end().x}"
                        y1 = "${-a.start().y}"
                        y2 = "${-a.end().y}"
                        fill = "none"
                        stroke="${this.getColor(t,e)}"
                        stroke-width="${t.strokeWidth}"
                        stroke-linecap="round"
                        id ="${t.globalIndex}" />`;r.push(l)}else if(a instanceof q){let l=q.build2(a.center,a.startAngle/Math.PI*180,a.endAngle()/Math.PI*180,a.rx,a.ry,a.sweep()).multiply3(this.matrix),c=new wS;c.encPt(l);let u=`<path d="${c.toString()}" stroke="${this.getColor(t,e)}" fill = "none"  stroke-width="${t.strokeWidth}" stroke-linecap="round" id ="${t.globalIndex}" />`;r.push(u)}}}getColor(t,e){if(t.silkColor!=null)return t.silkColor.toString();{let r=t.getParent();return r!=null&&"silkColor"in r&&r.silkColor!=null?r.silkColor.toString():e==3?we.topSilkscreenColor:we.bottomSilkscreenColor}}getPolylineSVG(t,e,r,i,n){return`<path d="${zb([t])}" fill="${e}" stroke="${r}" stroke-width="${n.toString()}" id ="${i}" />`}getLineSVG(t,e,r,i,n){return`<line
        x1 = "${t.start().x}"
        x2 ="${t.end().x}"
        y1 = "${-t.start().y}"
        y2 = "${-t.end().y}"
        fill="${e}"
        stroke="${r}"
        stroke-linecap = "round"
        stroke-width="${n.toString()}"
        id ="${i}" />`}getArcSVG(t,e,r,i,n){let s=new wS;return s.encPt(t),`<path d="${s.toString()}" fill="${e}" stroke="${r}" stroke-width="${n.toString()}" stroke-linecap="round" id ="${i}" />`}getBezierSVG(t,e,r,i,n){let s=new wS;return s.encPt(t),`<path d="${s.toString()}" fill="${e}" stroke="${r}" stroke-width="${n.toString()}" stroke-linecap="round" id ="${i}" />`}};var WAt=`-----BEGIN PUBLIC KEY-----
 MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzPtuUqJecaR/wWtctGT8
 QuVslmDH3Ut3s8c1Ls4A+M9rwpeLjgDUqfcrSrTHBrl5k/dOeJEWMeNF7STWS5jo
 WZE0H60cvf2bhormC9S6CRwq4Lw0ua0YQMo66R/qCtLVa5w6WkaPCz4b0xaHWtej
 JH49C0T67rU2DkepXuMPpwNCflMU+WgEQioZEldUTD6gYpu2U5GrW4AE0AQiIo+j
 e7tgN8PlBMbMaEfu0LokZyth1ugfuLAgyogWnedAegQmPZzAUe36Sni94AsDlhxm
 mjFl+WQZzD3MclbEY6KQB5XL8zCR/J6pCUUwfHantLxY/gQi0XJG5hWWtDyH/fR2
 lwIDAQAB
 -----END PUBLIC KEY-----
 `;var Cae=class{constructor(){if(!crypto||!crypto.subtle)throw new Error("\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301crypto api");this.tool=crypto.subtle}str2buffer(t,e=0){let r,i;switch(e){case 0:r=new ArrayBuffer(t.length),i=new Uint8Array(r);break;case 1:r=new ArrayBuffer(t.length*2),i=new Uint16Array(r);break;default:console.warn("bufType\u53C2\u6570\u9519\u8BEF\uFF0C\u4F7F\u7528\u9ED8\u8BA4uint8"),r=new ArrayBuffer(t.length),i=new Uint8Array(r);break}for(let n=0,s=t.length;n<s;n++)i[n]=t.charCodeAt(n);return r}buffer2str(t,e=0){let r;switch(e){case 0:r=new Uint8Array(t);break;case 1:r=new Uint16Array(t);break;default:console.warn("bufType\u53C2\u6570\u9519\u8BEF\uFF0C\u4F7F\u7528\u9ED8\u8BA4uint8"),r=new Uint8Array(t);break}return String.fromCharCode.apply(null,r)}},B9e=class extends Cae{constructor(){super();this.CONTENT_SPLIT_LENGTH=190;this.DECRYPT_SPLIT_LENGTH=256}async init(e){return this.key=await this.setPublicKey(e.publicKey),e.privateKey!=null&&(this.privateKey=await this.setPrivateKey(e.privateKey)),console.log("RSACryptoHelper\u521D\u59CB\u5316\u5B8C\u6BD5\uFF01"),this}setPublicKey(e){let r=["-----BEGIN PUBLIC KEY-----","-----END PUBLIC KEY-----","\\s"],i=new RegExp(r.join("|"),"ig"),n=e.replace(i,""),s=atob(n),a=this.str2buffer(s,0);return this.tool.importKey("spki",a,{name:"RSA-OAEP",hash:"SHA-256"},!0,["encrypt"])}setPrivateKey(e){let r=["-----BEGIN PRIVATE KEY-----","-----END PRIVATE KEY-----","\\s"],i=new RegExp(r.join("|"),"ig"),n=e.replace(i,""),s=atob(n),a=this.str2buffer(s,0);return this.tool.importKey("pkcs8",a,{name:"RSA-OAEP",hash:"SHA-256"},!0,["decrypt"])}async decrypt(e){if(this.privateKey==null)throw new Error("\u6CA1\u6709\u79C1\u94A5\u6570\u636E\uFF0C\u4E2D\u6B62\u89E3\u5BC6\u64CD\u4F5C");let r=e instanceof ArrayBuffer?e:this.str2buffer(e),i=[];for(let a=0,l=r.byteLength;a<l;a+=this.DECRYPT_SPLIT_LENGTH){let c=a,h=Math.min(a+this.DECRYPT_SPLIT_LENGTH,l);i.push(r.slice(c,h))}let n=[];for(let a of i)n.push(this.tool.decrypt({name:"RSA-OAEP"},this.privateKey,a));let s=await Promise.all(n);return Sae(s)}async encrypt(e,r){let i=e instanceof ArrayBuffer?e:this.str2buffer(e),n=[];for(let a=0,l=i.byteLength;a<l;a+=this.CONTENT_SPLIT_LENGTH){let c=a,h=Math.min(a+this.CONTENT_SPLIT_LENGTH,l);n.push(this.tool.encrypt({name:"RSA-OAEP"},this.key,i.slice(c,h)).then(u=>(r&&r(h/l),u),u=>{throw console.error("encrypt error",u),u}))}let s=await Promise.all(n);return r&&r(1),Sae(s)}},F9e=class extends Cae{constructor(){super()}async init(t){return this.keyBuffer=typeof t.key=="string"?this.str2buffer(t.key,0):t.key,this.key=await this.setKey(this.keyBuffer),this.iv=await this.setIV(t.iv),console.log("AESCryptoHelper\u521D\u59CB\u5316\u5B8C\u6BD5\uFF01"),this}setKey(t){let e=typeof t=="string"?this.str2buffer(t,0):t;return this.tool.importKey("raw",e,"AES-GCM",!0,["encrypt","decrypt"])}setIV(t){return typeof t=="string"?this.str2buffer(t,0):t}encrypt(t){let e=t instanceof ArrayBuffer?t:this.str2buffer(t);return this.tool.encrypt({name:"AES-GCM",iv:this.iv},this.key,e)}decrypt(t){let e=t instanceof ArrayBuffer?t:this.str2buffer(t);return this.tool.decrypt({name:"AES-GCM",iv:this.iv},this.key,e)}getKey(){return this.keyBuffer}getIV(){return this.iv}};function Sae(o){let t=o.reduce((i,n)=>i+n.byteLength,0),e=new Uint8Array(t),r=0;for(let i of o)e.set(new Uint8Array(i),r),r+=i.byteLength;return e.buffer}async function V9e(o,t){switch(o){case 0:return t=t||{key:crypto.getRandomValues(new Uint8Array(16)).buffer,iv:crypto.getRandomValues(new Uint8Array(16)).buffer},await new F9e().init(t);case 1:return t=t||{publicKey:WAt},await new B9e().init(t)}}var vX=class vX extends Worker{constructor(t,e){t.startsWith("//")&&(t=self.location.protocol+t);let r=t;if(/^[\w-]+:/.test(t)&&self.location.origin!=new URL(t).origin&&(r=vX.proxyMap[t],!r)){let i=`importScripts('${t}');`;r=URL.createObjectURL(new Blob([i],{type:"application/javascript"})),vX.proxyMap[t]=r}super(r,e)}};vX.proxyMap={};var Eae=vX;var xX=class{constructor(){this.integer=2;this.decimals=6;this.layersInfo=[]}addLayersId(t,e,r,i){if(e!=null)r=Fse(e);else if(r==null){console.warn("error add");return}this.layersInfo.push({fileName:t,layerId:e,gerberLayerName:r,isDrill:i})}setUnit(t){this.unit=t}setFormate(t,e){this.integer=t,this.decimals=e}exportText(){let t=[];for(let r of this.layersInfo)t.push({FileName:r.fileName,LayerName:r.gerberLayerName,Format:r.isDrill?"excellon2":"gerber274x",NumberFormat:`${this.integer}:${this.decimals}`,Units:this.unit=="IN"?"inch":"mm",ZeroesOmitted:"none",Decimal:"no",Coordinates:"absolute"});return JSON.stringify({IsOdb:!1,isGerber:!0,GerberFiles:t},void 0,4)}};var MS=class{constructor(){}exportText(t){return""}};var rm=class extends MS{constructor(){super()}};rm.endSign="*";var Oae={column:1,row:1,stepX:0,stepY:0};var lV=class{};function Aae(o,t){return{x:o.x+t.x,y:o.y+t.y}}var s0=class extends lV{constructor(e){super();this.num=0;this.hasUnit=!0;this.num=e}format(e){return e.formatDecimalNumber(this.num)}},cV=class extends lV{constructor(e){super();this.num=0;this.hasUnit=!1;this.num=e}format(e){return e.formatPureDecimalNumber(this.num)}};var kA=class o extends lV{constructor(e){super();this.hasUnit=!0;if(this.num=e,!e)throw new Error("Invalid XYNumber parameters")}get xy(){return this.num}applyOffset(e){this.num=Aae(this.num,e)}offsetClone(e){return new o(Aae(this.num,e))}format(e){return e.formatPointXY(this.num)}},NS=class o extends lV{constructor(e,r){super();this.hasUnit=!0;if(this.numXY=e,this.numIJ=r,!e||!r)throw new Error("Invalid ArcData parameters")}get xy(){return this.numXY}applyOffset(e){this.numXY=Aae(this.numXY,e)}offsetClone(e){return new o(Aae(this.numXY,e),this.numIJ)}format(e){return e.formatPointXY(this.numXY)+e.formatPointIJ(this.numIJ)}};var BA=class BA extends MS{constructor(){super();this.code="";this.modifiers=[]}exportText(e){let r=BA.delimiter+this.code,i=r.length;for(let n of this.modifiers){let s;typeof n=="string"?s=n:typeof n.format=="function"?s=n.format(e):s=String(n),i+s.length<=BA.maxLength?(r+=s,i+=s.length):(r+=`
`,r+=s,i=s.length)}return r+=BA.endSign,r}static create(e,r){let i=new BA;return i.code=e,i.modifiers=r?r.slice():[],i}};BA.maxLength=4096,BA.delimiter="%",BA.endSign="*%";var w2=BA;var $R=class $R extends w2{constructor(){super()}static createLayer(t){if(/[*]|[^\t\x20-\x7e]/.test(t))throw new Error("Invalid Layer Name");if(t.length>100)throw new Error("Layer Name is too long");let r=new $R;return r.code="LN",r.modifiers[0]=t,r}static createPolarity(t){let e=new $R;return e.code="LP",e.modifiers[0]=t,e}};$R.PolarityClear=$R.createPolarity("C"),$R.PolarityDark=$R.createPolarity("D");var tp=$R;var N0=class N0 extends rm{constructor(e=1){super();this._number=1;if(!this.isValidNumber(e))throw new Error("D-code number is out of range");this._number=e}get name(){return"D"+String(this._number).padStart(2,"0")}get number(){return this._number}set number(e){if(!this.isValidNumber(e))throw new Error("D-code number is out of range");this._number=e}isValidNumber(e){return e===N0.numberExposureOn||e===N0.numberExposureOff||e===N0.numberExposureFlash||e>=N0.customNumberMin&&e<=N0.customNumberMax}next(){if(this._number<N0.customNumberMin)throw new Error("This method is not available for built-in D codes");if(this._number>N0.customNumberMax)throw new Error("D-code number is out of range");return new N0(this._number+1)}exportText(){return this.name+rm.endSign}static isDCode(e){return e instanceof N0||e===N0.ExposureOn||e===N0.ExposureOff||e===N0.ExposureFlash}};N0.customNumberMin=10,N0.customNumberMax=8191,N0.numberExposureOn=1,N0.numberExposureOff=2,N0.numberExposureFlash=3,N0.ExposureOn="D01",N0.ExposureOff="D02",N0.ExposureFlash="D03";var C1=N0;var ga=class ga extends rm{constructor(e,...r){super();this.modifiers=[];this.code=e,r.length&&this.addModifier(...r)}addModifier(...e){this.modifiers.push(...e)}isSimpleLinear(){return this.code=="G01"&&this.modifiers.length===2&&this.modifiers[0]instanceof kA&&C1.isDCode(this.modifiers[1])}isSimpleArc(){return(this.code=="G02"||this.code=="G03")&&this.modifiers.length<=2&&this.modifiers[0]&&this.modifiers[0]instanceof NS&&(!this.modifiers[1]||C1.isDCode(this.modifiers[1]))}isSimpleLinearOrArc(){return this.isSimpleLinear()||this.isSimpleArc()}isComment(){return this.code=="G04"}applyOffset(e){for(let r of this.modifiers)(r instanceof kA||r instanceof NS)&&r.applyOffset(e)}offsetClone(e){if(["G04","G36","G37","G54"].includes(this.code))return new ga(this.code,...this.modifiers);let r=this.modifiers.map(i=>i instanceof kA||i instanceof NS?i.offsetClone(e):i);return new ga(this.code,...r)}hasDCodeOfExposureOn(){let e=this.modifiers;if(!e.length)return!1;let r=e[e.length-1];return r=="D01"||r instanceof C1&&r.name=="D01"}formatXY(e){if(this.isSimpleLinearOrArc()){let r=this.modifiers[0];if(r instanceof kA||r instanceof NS)return e.formatPointXY(r.xy)}return""}exportText(e,r){let i;if(r instanceof ga&&this.isSimpleLinearOrArc()&&r.isSimpleLinearOrArc()){let n=r.modifiers[0];(n instanceof kA||n instanceof NS)&&(i=n.xy)}return this.code+this.modifiers.map((n,s,a)=>{if(typeof n=="string")return i=null,n==rm.endSign?s===0||s===a.length-1?"":n+`
`:n;if(typeof n.format=="function")if(i){e.lastXY=i;let l=n.format(e);return e.lastXY=null,i=null,l}else return n.format(e);else return i=null,String(n)}).join("")+rm.endSign}static flashAt(e){return ga.linearTo(e,"D03")}static linearTo(e,r){let i=new ga("G01",new kA(e));return r&&i.addModifier(r),i}static line(e,r){return[ga.linearTo(e,"D02"),ga.linearTo(r,"D01")]}static circleLine(e,r){let i={x:e.x-r,y:e.y},n={x:e.x+r,y:e.y},s={x:r,y:0},a={x:-r,y:0};return[ga.linearTo(i,"D02"),ga.counterclockwiseArcTo(n,s,"D01"),ga.counterclockwiseArcTo(i,a,"D01")]}static circleFill(e,r){return[].concat([ga.TurnOnPolygonFill],ga.circleLine(e,r),ga.TurnOffPolygonFill)}static KitsuneLine(e,r,i){if(!e||!e.length)return null;let n=[],s=!0,a;for(let l of e){let c=l.start().multiply3(r),h=l.end().multiply3(r);if((!a||!a.equals(c))&&(s=!0),s&&(s=!1,n.push(ga.linearTo(c,"D02"))),l instanceof M)n.push(ga.linearTo(h,"D01"));else if(l instanceof q){let u=l.center.multiply3(r).sub(c),p=(i?!l.isCCW:l.isCCW)?"G03":"G02";n.push(new ga(p,new NS(h,u),"D01"))}a=h}return n}static primitivesToPoints(e,r=.02){if(!e||!e.length)return null;let i=[];for(let n of e){let s=n.start(),a=n.end();i.length===0&&i.push(s);let l=i[i.length-1],c=s.equals2(l,1e-5),h=a.equals(l);if(!c)throw new Error("Not continuous primitive line");if(n instanceof M)h||i.push(a);else if(n instanceof q)if(e.length>1&&l.distance1(a)<.1)i.push(a);else{let d=n.points1(r);d[0]&&d[0].equals(l)&&d.shift(),d[d.length-1]&&!d[d.length-1].equals(a)&&d.push(a),i=i.concat(d)}else if(n instanceof Dr){let u=n.points(.1);u[0]&&u[0].equals(l)&&u.shift(),u[u.length-1]&&!u[u.length-1].equals(a)&&u.push(a),i=i.concat(u)}else throw new Error("Unexpected line");l=a}return i}static primitivesLine(e){if(!e||!e.length)return null;let r=[],i=!0,n;for(let s of e){let a=s.start(),l=s.end();if(i&&(i=!1,r.push(ga.linearTo(a,"D02")),n=a),s instanceof M)r.push(ga.linearTo(l,"D01"));else if(s instanceof q)if(Math.abs(s.sweepAngle)<.5||e.length>1&&n.distance1(l)<.1&&(s.bbox().width()<.1||s.bbox().height()<.1))r.push(ga.linearTo(l,"D01"));else{let h=s.center.sub(a);r.push(new ga(s.isCCW?"G03":"G02",new NS(l,h),"D01"))}else if(s instanceof Dr){let c=s.points(.1);for(let h of c)r.push(ga.linearTo(h,"D01"))}else throw new Error("Unexpected line");n=l}return r}static polygonLine(e){return ga.primitivesLine(e==null?void 0:e.primitives)}static polygonFill(e){let r=e==null?void 0:e.primitives;if(!r||!r.length)return null;let i=ga.primitivesLine(r);if(!i||!i.length)return null;let n=new ga("G36"),s=new ga("G37");return[].concat([n],i,[s])}static polygonFillWithHoles(e){let r,i=0,n=0;for(let l of e){let c=l.bbox(),h=c.width(),u=c.height();h>i&&u>n&&(i=h,n=u,r=l)}if(!r)return null;let s=ga.polygonFill(r);if(!s)return null;let a=[];for(let l of e)if(l!==r){let c=ga.polygonFill(l);a=a.concat(c)}return a.length&&(a.unshift(tp.PolarityClear),a.push(tp.PolarityDark)),s.concat(a)}static rawPolygonFill(e){if(!e||!e.length||e.length<3)return null;let r=e.map((s,a)=>ga.linearTo(s,a===0?"D02":"D01")),i=new ga("G36"),n=new ga("G37");return[].concat([i],r,[n])}static arcTo(e,r,i,n){let s=new ga(e?"G02":"G03");return s.addModifier(new NS(r,i)),n&&s.addModifier(n),s}static clockwiseArcTo(e,r,i){return ga.arcTo(!0,e,r,i)}static counterclockwiseArcTo(e,r,i){return ga.arcTo(!1,e,r,i)}static useAperture(e){let r=new ga("G54");return r.addModifier(e),r}static enable360Circular(){return ga.TurnOn360Circular}};ga.TurnOn360Circular=new ga("G75"),ga.TurnOff360Circular=new ga("G74"),ga.TurnOnPolygonFill=new ga("G36"),ga.TurnOffPolygonFill=new ga("G37");var ui=ga;function QHe(){let o=R.getInstance().clientOnlineService.match(/"https:\/\/(\S*)\"\//),t=o&&o[1]?o[1]:"",e=D2?t:location.host;return!["pro.lceda.cn","pro.easyeda.com"].includes(e)}function RX(o){if(!o)return"";let t=(o.name||o.layerName||"").replace(/ /g,"");switch(o.type||o.layerType){case"SIGNAL":case"PLANE":for(var e=15,r=1;e<=46;e++,r++)(o.layerID==e||o.layerId==e)&&(t="InnerLayer"+r);break;case"CUSTOM":for(var e=71,r=1;e<=270;e++,r++)(o.layerID==e||o.layerId==e)&&(t="CustomLayer"+r);break}return t}function V6(o,t,e){return`Drill_${o}_${t||(e?"Through_Via":"Through")}.DRL`}function G9e(o){let t=eWe(),e=o.includes("TopStiffenerLayer")?58:59,r=`Gerber_${o}.${t[e]}`;return r=r.trim().replace(/\s+/g,"_"),r}function U9e(){return"Fabrication_ColorfulBoardOutlineMark.FCBM"}var YAt=(()=>{let o={};return oy.forEach(t=>{o[t.layerId]=t}),mBe.forEach(t=>{o[t.layerId]=t}),o})();function eWe(){let o={11:"GKO",1:"GTL",2:"GBL",3:"GTO",4:"GBO",5:"GTS",6:"GBS",7:"GTP",8:"GBP",58:"GTSL",59:"GBSL",14:"GME",9:"GTA",10:"GBA",56:"GDD",13:"GDL"};for(var t=15,e=1;t<=46;t++,e++)o[t]="G"+e;for(var t=71,e=1;t<=270;t++,e++)o[t]="GCL";return o}function H9e(o){let t=YAt[o],e=RX(t);if(!e)throw new Error("Invalid layerId "+o);let r=eWe();if(!r.hasOwnProperty(o))throw new Error("invalid layerId "+o);let i=`Gerber_${e}.${r[o]}`;return i=i.trim().replace(/\s+/g,"_"),i}function DX(o,t){for(let e of o)e instanceof ui&&e.applyOffset(t)}function tWe(o,t){if(!o.length)return"";let e=`
`;return o.map(i=>i.exportText(t)).join(e)+e}function kS(o){let t=new Array;for(let e of o){let r=im(e);r!=null&&t.push(r)}return t}function im(o){if(o==null)return null;let t=new Array,e=o,r=e.length;for(let i=0;i<r;i+=6)switch(e[i]){case 0:{let n=new M(new S(e[i+1],e[i+2]),new S(e[i+3],e[i+4]));t.push(n);break}case 1:{let n=q.build3(new S(e[i+1],e[i+2]),e[i+3],e[i+4],e[i+5],e[i+5]);t.push(n);break}case 2:{let n=q.build3(new S(e[i+1],e[i+2]),e[i+3],e[i+4],e[i+5],e[i+5]);t.push(n);break}case 3:{let n=e[i+1],s=Math.ceil(n/2);if(n<2||e.length<i+s*6)throw new Error("invalid data");let a=[];for(let c=0;c<s;c++){let h=c*6+i;if(c>0&&e[h+1]!==0||e[h]!==3)throw new Error("invalid data");a.push(new S(e[h+2],e[h+3])),a.push(new S(e[h+4],e[h+5]))}if(i+=(s-1)*6,a.length>n&&(a=a.slice(0,n)),a.length!==n)throw new Error("invalid data");let l=new Dr(a);t.push(l);break}}return t.length>0?ge.build2(t):null}function G6(o){return o.map(hT)}function hT(o){let t=[];function e(r){t.push(...r)}for(let r of o.primitives)if(r instanceof M){let i=r.start(),n=r.end();e([0,i.x,i.y,n.x,n.y,0])}else if(r instanceof m9){let{rx:i,center:n,startAngle:s,sweepAngle:a}=r;e([1,n.x,n.y,s,a,i])}else if(r instanceof q){let{rx:i,center:n,startAngle:s,sweepAngle:a}=r;e([2,n.x,n.y,s,a,i])}else if(r instanceof Dr){let{controls:i}=r,n=[3,i.length];for(let s of i)n.length%6===0&&n.push(3,0),n.push(s.x,s.y);for(;n.length%6;)n.push(0);e(n)}return t}var W9e=class{getConfig(t){let e={fpcStiffeners:this.getStiffenerConfig(t)},r="jlcpcb.json";return e.fpcStiffeners.length?{fileName:r,config:JSON.stringify(e,null,2)}:null}getStiffenerConfig(t){let e=[],{stiffeners:r}=t,i=si.getInstance().getDefaultPanelize(),n=R.getInstance().origin;if(!i.success||i.onlyOutline){let s=S.ORIGIN.sub(n);r.forEach(a=>{let l=this.getStiffenerData(a,"",s);e.push(l)})}else{let s=Pi.offset||new S(0,0),a=i.row,l=i.column,c=0;for(let h=0;h<a;h++)for(let u=0;u<l;u++){let d=new S(s.x*u,s.y*h);d=d.sub(n),r.forEach(p=>{let m=c?`_${c}`:"",g=this.getStiffenerData(p,m,d);e.push(g)}),c++}}return e}getStiffenerData(t,e="",r=S.ORIGIN){let i=58===t.layerId,n={Polyimide:"pi",FR4:"fr4","Stainless Steel":"steel",Tape:"tape","EMI Shielding Film":"EMI Shielding Film"},s={"3M468":"3m468","3M9077":"3m9077",TESA8854:"tesa8854"},a=t.getComponent();return{id:`${Tr}${t.number}`+e,gerber:this.getGerberFPCGroupName(t),layer:t.layerId===58?"top":"bottom",material:n[a.material],model:s[a.fpcModel],thickness:`${a.thickness}`,path:[this.getShapeInfo(t,r)]}}getShapeInfo(t,e){let r=Ae.translate(e.x,e.y,0);if(t instanceof Pr){let i=t.center.multiply4(r);return P2(0,{center:i,radius:t.radius})}else if(t instanceof rr){let i=t.start.multiply4(r),{width:n,height:s,rotation:a,cornerRadius:l}=t,c={start:i,width:n,height:s,rotation:a,radius:l};return P2(1,c)}else if(t instanceof lt){let i=t.getMathGraphics(t.layerId,0);return i=i.multiply3(r.toMatrix3()),P2(2,{pl:i})}}getGerberFPCGroupName(t){let e=t.getComponent(),r=t.layerId===58,i=r?"TopStiffenerLayer":"BottomStiffenerLayer",n={Polyimide:"pi",FR4:"fr4","Stainless Steel":"gp",Tape:"ps","EMI Shielding Film":r?"csa":"ssa"},s={"3M468":"3m468","3M9077":"3m9077",TESA8854:"tesa8854"},a=r?"t":"b",l=n[e.material],c=s[e.fpcModel]?s[e.fpcModel]:"",h=e.thickness,u="";e.material==="Tape"?u=`${l}${a}_${c}`:e.material==="EMI Shielding Film"?u=`${l}_${h}`:u=`${l}${a}_${h}`;let d=`G${a.toUpperCase()}SL`;return`Gerber_${i}_${u}.${d}`}},rWe=new W9e;var _ae=class extends Qd{encodeRule(){let t=re.getInstance(),e=t.getAllPasteExpansion(),r=t.getAllSolderExpansion(),i=[];return e.forEach(n=>{i.push(Sr.getInstance().encode("RULE",n))}),r.forEach(n=>{i.push(Sr.getInstance().encode("RULE",n))}),i}encodePads(t){return t.map(r=>{let i=Sr.getInstance().encode("PAD",r);return i.id=r.globalIndex,i.number=r.number,i})}};var wX=class{constructor(t){this.filterTypes=null;this.planeLayerIds=[];this.options=t,this.filterTypes=this.filterObject();for(let e of t.layerConfigs)e.layerType==="PLANE"&&this.planeLayerIds.push(e.layerId)}include(t){return this.options.objectConfigs.includes(t)}getLayerInfo(t){return this.options.layerConfigs.find(r=>r.layerId==t)}isPlaneLayer(t){return this.planeLayerIds.includes(t)}filterObject(){let t=[];return this.options.objectConfigs?(this.options.objectConfigs.forEach(e=>{e==="BoardOutline"?t.push("Board Outline"):e==="BoardCutout"?t.push("Slot Region"):e==="CopperOutline"||e==="CopperFilled"?t.push("Copper Region"):e==="SolidRegion"?t.push("Fill Region"):e==="ProhibitedRegion"?t.push("Prohibited Region"):e==="Line"?t.push("Line"):e==="FPCStiffener"&&t.push("FPC Stiffener")}),t):null}filterTypesInclude(t){return!this.filterTypes||this.filterTypes.includes(t)}isUsedLayerId(t){return this.options.layerConfigs.some(e=>e.layerId==t)}isSilkLayer(t){return t==3||t==4}getFPCInfo(t){let{material:e,thickness:r,fpcModel:i}=t;return{material:e,thickness:r,fpcModel:i}}getPanelize(){let t=[],e=si.getInstance(),r=e.items.concat(e.outlines);for(let i of r){let n;n=i.layerId;let s=ar(n);if(i instanceof hs){if(!s&&!this.isUsedLayerId(n))continue;let a=i.primitive;t.push({type:"line",layerId:n,start:a.start(),end:a.end()})}else if(i instanceof Li){if(!s&&!this.isUsedLayerId(n))continue;let{strokeWidth:a,fontFamily:l,key:c,value:h,showKey:u,showValue:d}=i;if(!u&&!d)continue;let p=[],m=[],g=[],y=[],b=[],P=[],T=!1,I=!1,C=i.getRealOutline();for(let E of C)E instanceof Cp?(T=!E.flag,b.push(E.pl),m.push(E.flag),g.push(E.order),y.push(E.group)):P.push(E);if(!b.length&&!P.length)continue;i.type==1?(p=G6(b),I=!1):(p=P.map(hT),I=!0),t.push({type:"text",layerId:n,strokeWidth:a,fontFamily:l,key:c,value:h,isOutlineFont:I,hasHole:T,outlinesData:p,outlinesFlag:m,outlinesOrder:g,outlinesGroup:y})}else if(i instanceof et){let{center:a,pasteExpansion:l,topSolderExpansion:c,bottomSolderExpansion:h}=i,u={layerId:n,center:a,pasteExpansion:l,topSolderExpansion:c,bottomSolderExpansion:h};if(s||ao(n)){let d=i.top;d.type=="ELLIPSE"&&t.push({type:"pad",side:"top",width:d.width,...u})}if(s||vv(n)){let d=i.bottom;d.type=="ELLIPSE"&&t.push({type:"pad",side:"bottom",width:d.width,...u})}}else if(i instanceof yo){let a=i.type=="Slot Region",{center:l,radius:c,strokeWidth:h}=i;if(!a&&!this.isUsedLayerId(n))continue;t.push({type:"circle",layerId:n,isSlot:a,center:l,radius:c,strokeWidth:h})}else if(i instanceof Va){if(!s&&!this.isUsedLayerId(n))continue;let a=i.length>1e-8&&i.end.distance1(i.start)<.1&&i.getAngle()>Math.PI,{center:l,startAngle:c,sweepAngle:h,rx:u,ry:d}=i.primitive;t.push({type:"arc",layerId:n,needSplit:a,width:i.width,center:l,startAngle:c,sweepAngle:h,rx:u,ry:d})}}return t}getColorSilkBoard(){}getCopper(){let t=[];if(!this.include("CopperFilled"))return t;let r=qo.getInstance().getAllItem();for(let i of r){let{layerId:n,isSolid:s,optimization:a,optimizationWidth:l,gridLineWidth:c}=i;if(!this.isUsedLayerId(n))continue;let h=i.getOutline();if(!(h!=null&&h.length))continue;let u=G6(h),d=i.number,p={layerId:n,isSolid:s,optimization:a,optimizationWidth:l,gridLineWidth:c,outline:u,order:d};t.push(p)}return t}getPlaneZone(){let t=[];if(!this.include("PlaneZone"))return t;let e=Xo.getInstance().getAllItem();e=e.sort((r,i)=>i.bbox.width()-r.bbox.width()||i.bbox.height()-r.bbox.height());for(let r of e){let{layerId:i,style:n}=r;if(!r.style||!this.isUsedLayerId(i))continue;let s=r.getOutline();if(!(s!=null&&s.length))continue;let a=G6(s),l={layerId:i,style:n,outline:a};t.push(l)}return t}getImage(t=Hs.getInstance().getAllItem()){let e=[];if(!this.include("ComponentSilkscreen")&&!this.include("Image"))return e;let r=t;Er(r,(i,n)=>n.buildBBox().area()-i.buildBBox().area(),0,r.length);for(let i of r){let{layerId:n}=i;if(!this.isUsedLayerId(n))continue;let s=!!i.getParent();if(n!=56){if(s){if(this.isSilkLayer(n)){if(!this.include("ComponentSilkscreen"))continue}else if(!this.include("Image"))continue}else if(!this.include("Image"))continue}let a=G6(i.template);if(!(a!=null&&a.length))continue;let l=i.getViewMatrix().toMatrix3(),c={layerId:n,template:a,matrix:l,hasParent:s};e.push(c)}return e}getDrillDrawing(){return IHe()}getDrillTable(t){let e=[];t.textModels&&t.textModels.length&&(e=this.getText(t.textModels));let r=[];t.imageModels&&t.imageModels.length&&(r=this.getImage(t.imageModels));let i=[];return t.polygonModels&&t.polygonModels.length&&(i=this.getPolygon(t.polygonModels)),{dataTextArr:e,dataImageArr:r,dataPolyArr:i}}getText(t=io.getInstance().getAllItem()){let e=[],r=t;if(!r.length)return e;for(let i of r){let{layerId:n,strokeWidth:s,fontFamily:a,key:l,value:c,showKey:h,showValue:u}=i,d=i.getParent(),p=!!l;if(n!=56){if(d&&d instanceof Bi){if(p){if(!this.include("ComponentProperty"))continue}else if(this.isSilkLayer(n)&&!this.include("ComponentSilkscreen"))continue}else if(!this.include("Text"))continue}if(!this.isUsedLayerId(n)||!h&&!u)continue;let m=[],g=[],y=[],b=[],P=[],T=[],I=!1,C=!1,E=i.getRealOutline();for(let O of E)O instanceof Cp?(I||(I=!O.flag),P.push(O.pl),g.push(O.flag),y.push(O.order),b.push(O.group)):T.push(O);!P.length&&!T.length||(i.type==1?(m=G6(P),C=!0):(m=T.map(hT),C=!1),e.push({layerId:n,strokeWidth:s,fontFamily:a,key:l,value:c,isOutlineFont:C,hasHole:I,outlinesData:m,outlinesFlag:g,outlinesOrder:y,outlinesGroup:b}))}return e}getPolygon(t=vi.getInstance().getAllItem()){let e=[],r=t;if(!r.length)return e;r=(n=>{let s=[],a=[];return n.forEach(l=>{l.outline instanceof Bt?s.push(l):a.push(l)}),s.concat(a)})(r);for(let n of r){let{layerId:s,type:a,strokeWidth:l}=n;if(n.getParent()){if(this.isSilkLayer(s)){if(!this.include("ComponentSilkscreen"))continue}else if(!this.filterTypesInclude(n.type))continue}else if(!this.filterTypesInclude(n.type))continue;if(!ar(s)&&!this.isUsedLayerId(s)||this.isPlaneLayer(s))continue;let u;switch(a=="FPC Stiffener"&&(u=this.getFPCInfo(n.component)),a){case"Board Outline":case"Line":{let d=n.getMathGraphics(s,0);if(!d)continue;let p=hT(d);e.push({layerId:s,type:a,strokeWidth:l,polylineData:p});break}case"FPC Stiffener":case"Fill Region":{let d=n.getMathGraphics(s,0);if(!d)continue;let p;if(d instanceof ge){let m=hT(d);e.push({layerId:s,type:a,strokeWidth:l,polylineData:m,fpc:u})}else{p=[];let m=d.items.map(hT);e.push({layerId:s,type:a,strokeWidth:l,polylineGroupData:m,fpc:u})}break}case"Slot Region":{let d=n.getMathGraphics(s,0);if(!d)continue;let p=hT(d);e.push({layerId:s,type:a,strokeWidth:l,polylineData:p});break}case"Prohibited Region":case"Copper Region":break;default:break}}return e}getRect(){let t=[],e=Qi.getInstance().getAllItem();for(let r of e){let{layerId:i,type:n,strokeWidth:s}=r,a=r.getParent(),l=!!a;if(a){if(this.isSilkLayer(i)){if(!this.include("ComponentSilkscreen"))continue}else if(!this.filterTypesInclude(n))continue}else if(!this.filterTypesInclude(n))continue;if(!ar(i)&&!this.isUsedLayerId(i)||this.isPlaneLayer(i))continue;let h;switch(n=="FPC Stiffener"&&(h=this.getFPCInfo(r.component)),n){case"Board Outline":case"Line":case"FPC Stiffener":case"Fill Region":case"Slot Region":{let u=r.getMathGraphics(i);if(!u)continue;let d=hT(u),p={layerId:i,type:n,strokeWidth:s,hasParent:l,polylineData:d,fpc:h};t.push(p);break}case"Prohibited Region":case"Copper Region":continue;default:continue}}return t}getCircle(){let t=[],e=Fi.getInstance().getAllItem();for(let r of e){let{layerId:i,type:n,center:s,radius:a,strokeWidth:l}=r,c=r.getParent(),h=!!c;if(c){if(this.isSilkLayer(i)){if(!this.include("ComponentSilkscreen"))continue}else if(!this.filterTypesInclude(n))continue}else if(!this.filterTypesInclude(n))continue;if(!ar(i)&&!this.isUsedLayerId(i)||this.isPlaneLayer(i))continue;let d;switch(n=="FPC Stiffener"&&(d=this.getFPCInfo(r.component)),n){case"Board Outline":case"Line":case"FPC Stiffener":case"Fill Region":case"Slot Region":{let p={layerId:i,type:n,strokeWidth:l,hasParent:h,center:s,radius:a,fpc:d};t.push(p);break}case"Prohibited Region":case"Copper Region":break;default:break}}return t}getDimension(){let t=[];if(!this.include("Dimension"))return t;let e=Ma.getInstance().getAllItem(),r=Na.getInstance().getAllItem(),i=sl.getInstance().getAllItem(),n=s=>{for(let a of s){let{layerId:l,strokeWidth:c}=a;if(!this.isUsedLayerId(l))continue;let h=a.getBaseGraphics(),u=G6(h.map(ge.build7)),d=a instanceof Ap?a.getDegree():null,p={layerId:l,strokeWidth:c,linesData:u,degreeObject:d};t.push(p)}};return n(e),n(r),n(i),t}getTearDrop(){let t=[],e=vi.getInstance().getAllItem();for(let r of e){let{layerId:i,type:n}=r;if(n=="TearDrop"){if(!this.include("TearDrop")||!this.isUsedLayerId(i))continue;let s=r.getMathGraphics(i,0);if(!s)continue;let a=hT(s),l={layerId:i,type:n,polylineData:a};t.push(l)}}return t}getPad(){let t=[];return this.include("Pad")&&jn.getInstance().iterator(e=>{let r=e.layerId,i=ar(r),{pasteExpansion:n,topSolderExpansion:s,bottomSolderExpansion:a,plated:l,center:c,rotation:h,holeShape:u,holeLength:d,holeOffset:p,holeRadius:m,holeRotation:g,unusedInnerLayers:y}=e,b;if(e.isPolygon()){let C=e.polygonPl;if(!C)return;b=hT(C)}let P,T,I;(i||1==r)&&(P=this.getPadStyle(e,1,s,!i&&n)),(i||2==r)&&(I=this.getPadStyle(e,2,a,!i&&n)),i&&(T=this.getPadStyle(e,15)),t.push({layerId:r,pasteExpansion:n,topSolderExpansion:s,bottomSolderExpansion:a,plated:l,center:c,rotation:h,holeShape:u,holeLength:d,holeOffset:p,holeRadius:m,holeRotation:g,top:P,inner:T,bottom:I,polylineData:b,unusedInnerLayers:y})}),t}getPadStyle(t,e,r,i){let n,s=t.getPad(e);if(s){let a=t.isPolygon(),l=this.getExpansionLayer(e),c=a&&l&&t.getMathGraphics(l[0]),h=a&&l&&t.getMathGraphics(l[1]),{type:u,width:d,height:p,ratio:m}=s;n={type:u,width:d,height:p,ratio:m,solderExpansionRatio:r!=null&&t.getExpansionRatio(m,d,p,r),pasteExpansionRatio:i!=null&&t.getExpansionRatio(m,d,p,i),solderPolyData:r!=null&&c&&hT(c),pastePolyData:i!=null&&h&&hT(h)}}return n}getExpansionLayer(t){switch(t){case 1:return[5,7];case 2:return[6,8]}}getVia(){let t=[];return this.include("Via")&&bn.getInstance().iterator(e=>{let{center:r,radius:i,holeRadius:n,topExpansion:s,bottomExpansion:a}=e,{startLayer:l,endLayer:c,type:h,unusedInnerLayers:u}=e;t.push({startLayer:l,endLayer:c,type:h,center:r,radius:i,holeRadius:n,topExpansion:s,bottomExpansion:a,unusedInnerLayers:u})}),t}getTrack(){let t=[];if(!this.include("Track"))return t;let e=R.getInstance().origin;return Sn.getInstance().iterator(r=>{let{layerId:i,width:n,start:s,end:a}=r;if(!this.isUsedLayerId(i))return;let l=!1;if(r instanceof Ii){l=!0;let{sweepAngle:c,center:h,isCCW:u,radius:d}=r,p=Math.abs(c),m=h.sub(e);if(p>0&&p<$ee&&(1-Math.cos(p/2))/p<.01||Math.abs(m.x)>1e4||Math.abs(m.y)>1e4){let y=q.build4(s,a,h,d,d,u?ae.CCW:ae.CW).points(.01);for(let b=1,P=y.length;b<P;b++){let T=y[b];t.push({layerId:i,width:n,start:s,end:T,isArc:!1}),s=T}}else t.push({layerId:i,width:n,start:s,end:a,isArc:l,sweepAngle:c,center:h,isCCW:u,radius:d})}else t.push({layerId:i,width:n,start:s,end:a,isArc:l})}),t}};var z9e="FlyingProbeTesting.json";function iWe(o){let t=new Date,e=t.getFullYear(),r=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getDate().toString().padStart(2,"0"),n=`${e}-${r}-${i}`;return`FlyingProbeTesting_${(o||"PCB").replace(/[^\w\u0082-\ufffc]+/g," ").replace(/[\s_]+/g," ").trim().replace(/\s/g,"_")}_${n}.json`}function jAt(o){return o=="GND"?"GND":""}function XAt(o){switch(o){case"RECT":return"R";case"ELLIPSE":return"C";case"OVAL":return"O";case"POLYGON":return"P";default:return""}}function qAt(o,t){let{width:e,height:r}=o;switch(o.type){case"RECT":return[e,r];case"ELLIPSE":return[e,e];case"OVAL":return[e,r];case"POLYGON":let i=cg(t,o,0).bbox();return[i.width(),i.height()];default:return[0,0]}}function $At(o){return+o.toFixed(3)}function LX(o){console.time("exportFlyingProbeJSON time");let t=V=>+(V*10).toFixed(4),e=V=>$At(zt.regularD(zt.toDegrees(V))),r=R.getInstance().origin,i=Ar.getAllItem(),n=0,s={},a=0,l=0,c=1,h=(V,W,L,k,N)=>{u.push([u.length+1,V,W,t(L),t(k),e(N)])},u=i.map((V,W)=>{let{globalIndex:L,designator:k,layerId:N,position:U,rotation:B}=V;if(U=U.sub(r),k=k.replace(/[:;<>\/\\#*?"|]/g,"_").replace(/__+/g,"_"),k=k||"PRENULL"+ ++n,s[L]=k,!V.getPads().length){a++;return}return[W+1,k,N==Hd.TOPLAYER?"T":"B",t(U.x),t(U.y),e(B),W]});a>0&&(u=u.filter(V=>V)),u=a2(u,c+""),u.forEach((V,W)=>V[l]=W+1);let d=!1,p=!1,m="TPJLC",g="TPJLC2",y={[m]:1,[g]:1};u.forEach((V,W)=>{let L=V[c];y[L]?y[L]++:y[L]=1});let b=[],P=0,T={},I=0,C=/^NET[_:;<>\/\\#*?"|]+(\d+)$/i,E=jn.getInstance().getAllItem().filter(V=>{var L;T[V.net]=!0;let W=(L=V.net.match(C))==null?void 0:L[1];return W&&+W>I&&(I=+W),!(V.getParent()instanceof ke)&&!!V.net}),O={},_=(V,W,L)=>{let{holeShape:k,holeRadius:N,holeLength:U,net:B}=V;if(B&&O[B])B=O[B];else{let fe=B.replace(/[:;<>\/\\#*?"|]/g,"_").replace(/__+/g,"_"),Oe=!fe||fe.length>10||/[^\x20-\x7f]/.test(fe);Oe=Oe||fe!=B&&!!T[fe];let Te=fe;Oe&&(Te="NET_"+ ++I),B&&B!=Te&&(O[B]=Te),T[Te]=!0,B=Te}let G=!L&&V.padType==1,Y=!L&&V.padType!=1,X=V.num;X||(X="999");let K=L?W+"_"+X:"",J=0,se=0;(k=="ROUND"||k=="SLOT")&&(J=N*2||0,se=U||0);let ce=G?"TP":J>0?"DIP":"SMD",te=[],{top:oe,bottom:$}=V;if(oe&&te.push(oe),$&&te.push($),!!te.length){if(G){let fe=V.center.sub(r);oe&&!d&&(d=!0,h(m,"T",fe.x,fe.y,0)),$&&!p&&(p=!0,h(g,"B",fe.x,fe.y,0))}te.forEach(fe=>{let[Oe,Te]=qAt(fe,V),ue=V.center.sub(r),be=fe==oe?"T":"B";if(G)be=="T"?K=m+"_"+X:K=g+"_"+X;else if(Y){let j=V.center.sub(r);h(W,be,j.x,j.y,0),K=W+"_"+X}b.push([++P,K,t(ue.x),t(ue.y),be,ce,B,jAt(B),XAt(fe.type),t(Oe),t(Te),t(J),t(se),e(V.rotation)])})}},x=(V,W)=>{let L=/^\d+$/,k=L.test(V.num+""),N=L.test(W.num+"");return k&&N?+V.num-+W.num:k?-1:N?1:V.num==W.num?0:V.num<W.num?-1:1};if(u.forEach((V,W)=>{let L=V.pop(),U=i[L].getPads().map(G=>G.model),B=V[c];U.sort(x);for(let G of U)_(G,B,!0)}),E.length){let V=E,W=V.filter(N=>N.padType!=1),L=V.filter(N=>N.padType==1),k=0;for(let N of W){let U="";for(;;)if(U="PAD"+ ++k,!y[U]){y[U]=1;break}_(N,U,!1)}for(let N of L)_(N,"",!1)}function v(V,W,L){let k=W<L.length-1?",":"";return`
		[${V[0]}, "${V[1]}", "${V[2]}", ${V[3]}, ${V[4]}, ${V[5]}]${k}`}function D(V,W,L){let k=W<L.length-1?",":"";return`
		[${V[0]}, "${V[1]}", ${V[2]}, ${V[3]}, "${V[4]}", "${V[5]}", "${V[6]}", "${V[7]}", "${V[8]}", ${V[9]}, ${V[10]}, ${V[11]}, ${V[12]}, ${V[13]}]${k}`}let w=u.map(v).join(""),F=b.map(D).join(""),z=`{
"lengthUnit": "mil",
"remark": ${UP.getInstance().itemsCount==0?"[]":'["fly_line"]'},
"components": {
	"fields": ["COMPONENT_NO", "COMPONENT_NAME", "LAYER", "X_COORDINATE", "Y_COORDINATE", "ANGLE"],
	"rows": [${w}
	]
},
"pins": {
	"fields": ["PIN_NO", "PIN_NAME", "PIN_X", "PIN_Y", "LAYER", "PIN_TYPE", "NET_NAME", "NET_TYPE", "PAD_SHAPE", "PAD_SIZEX", "PAD_SIZEY", "HOLE_SIZE", "HOLE_LEN", "PAD_ANGLE"],
	"rows": [${F}
	]
}
}`;return console.timeEnd("exportFlyingProbeJSON time"),{fileContent:z}}var vae=null,X9e=new ArrayBuffer(8),Y9e=new Float64Array(X9e),j9e=new Uint32Array(X9e),nWe=new Uint16Array(X9e),KAt=self[["e","v","a","l"].join("")],xd=class o{static repeat(t,e){let r=new Array(e);for(;e-- >0;)r[e]=t;return r.join("")}static lpad(t,e,r){let i=r-t.length;return i>0?this.repeat(e,i)+t:t}static rpad(t,e,r){let i=r-t.length;return i>0?t+this.repeat(e,i):t}static strHashcode(t){if(t.length>0){let e=0;for(let r=0;r<t.length;r++)e=31*e+t.charCodeAt(r)|0;return e}else return 0}static arraycopy(t,e,r,i,n){if(t.length>=e+n&&r.length>=i+n)for(;n-- >0;)r[i++]=t[e++];else throw new Error("arraycopy out of range")}static undefAsNull(t){return null}static reverse(t,e){for(let r=0,i=t.length-1;i>=0;r++,i--)e[r]=t[i];return e}static sortAsc(t,e){return t-e}static xmlDecode(t){let e=t.length,r=new Array,i=-1;for(let n=0;n<e;n++){let s=t.charAt(n);if(i>=0){if(s===";"){let a=t.substring(i+1,n);switch(a){case"lt":r.push("<");break;case"gt":r.push(">");break;case"quot":r.push('"');break;case"apos":r.push("'");break;case"amp":r.push("&");break;default:if(a.charAt(0)==="#"){let l=parseInt(a.substring(1));r.push(String.fromCharCode(l))}else r.push("&"+a+";")}i=-1}}else s==="&"?i=n:r.push(s)}return i>=0&&r.push(t.substring(i)),r.join("")}static addAll(t,e){for(let r of e)t.push(r)}static equals(t,e){if(t.length==e.length){for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}else return!1}static remove(t,e){let r=0,i=t.length;for(let n=0;n<i;n++)t[n]===e&&(t.splice(n,1),n--,i--,r++);return r}static getUrlVars(){for(var t={},e=location.href.slice(location.href.indexOf("?")+1).split("&"),r=0;r<e.length;r++){var i=e[r].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}static prefix(){if(!vae){let t=this.getUrlVars().version;t?vae="/analyzer/v"+t:vae="/analyzer"}return vae}static add2objS(t,e,r){if(e in t)return t[e];{let i=r(e);return t[e]=i,i}}static downloadFile(t,e){let r=document.createElement("a"),i=URL.createObjectURL(e);r.download=t,r.href=i,r.click(),URL.revokeObjectURL(i)}static downloadFileASCII(t,e,r=""){r||(r=o.getFileExt(t));let i=o.textToBlob(e,o.extToType(r));o.downloadFile(t,i)}static getFileExt(t){let e=t.split(".");return e.length>1?e[e.length-1]:""}static textToBlob(t,e){return new Blob([t],{type:e,endings:"native"})}static extToType(t){let e=";charset=utf-8";switch(t==null?void 0:t.toLocaleLowerCase()){case"json":return"application/json"+e;case"svg":return"image/svg+xml"+e;case"xml":return"text/xml"+e;case"txt":return"text/plain"+e;case"html":return"text/html"+e;case"htm":return"text/html"+e;default:return}}static uuid(){let t=new Array;Y9e[0]=new Date().getTime(),t.push(j9e[1].toString(16)),Y9e[0]=Math.random(),t.push(nWe[3].toString(16));let e=nWe[2].toString(16);t.push("4"+e.substr(0,3)),Y9e[0]=performance.now();let r=j9e[0].toString(16)+j9e[1].toString(16);return t.push("0"+r.substr(0,3)),t.push(r.substr(3)),t.join("-")}static funcCopy(t){return KAt("("+t.toString()+")")}static NVL(...t){for(let e of t)if(e!==null)return e;return null}static stringToUint8Array(t){let e=new Uint8Array(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}};var Bs=new dt;var oWe={},ZAt=(function(o,t,e,r,i){var n=new Worker(oWe[t]||(oWe[t]=URL.createObjectURL(new Blob([o+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return n.onmessage=function(s){var a=s.data,l=a.$e$;if(l){var c=new Error(l[0]);c.code=l[1],c.stack=l[2],i(c,null)}else i(null,a)},n.postMessage(e,r),n}),Bl=Uint8Array,L2=Uint16Array,kX=Int32Array,gV=new Bl([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),yV=new Bl([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),MX=new Bl([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),cWe=function(o,t){for(var e=new L2(31),r=0;r<31;++r)e[r]=t+=1<<o[r-1];for(var i=new kX(e[30]),r=1;r<30;++r)for(var n=e[r];n<e[r+1];++n)i[n]=n-e[r]<<5|r;return{b:e,r:i}},hWe=cWe(gV,2),t3e=hWe.b,Lae=hWe.r;t3e[28]=258,Lae[258]=28;var uWe=cWe(yV,0),dWe=uWe.b,$9e=uWe.r,NX=new L2(32768);for(Bh=0;Bh<32768;++Bh)FA=(Bh&43690)>>1|(Bh&21845)<<1,FA=(FA&52428)>>2|(FA&13107)<<2,FA=(FA&61680)>>4|(FA&3855)<<4,NX[Bh]=((FA&65280)>>8|(FA&255)<<8)>>1;var FA,Bh,$I=(function(o,t,e){for(var r=o.length,i=0,n=new L2(t);i<r;++i)o[i]&&++n[o[i]-1];var s=new L2(t);for(i=1;i<t;++i)s[i]=s[i-1]+n[i-1]<<1;var a;if(e){a=new L2(1<<t);var l=15-t;for(i=0;i<r;++i)if(o[i])for(var c=i<<4|o[i],h=t-o[i],u=s[o[i]-1]++<<h,d=u|(1<<h)-1;u<=d;++u)a[NX[u]>>l]=c}else for(a=new L2(r),i=0;i<r;++i)o[i]&&(a[i]=NX[s[o[i]-1]++]>>15-o[i]);return a}),GA=new Bl(288);for(Bh=0;Bh<144;++Bh)GA[Bh]=8;var Bh;for(Bh=144;Bh<256;++Bh)GA[Bh]=9;var Bh;for(Bh=256;Bh<280;++Bh)GA[Bh]=7;var Bh;for(Bh=280;Bh<288;++Bh)GA[Bh]=8;var Bh,mV=new Bl(32);for(Bh=0;Bh<32;++Bh)mV[Bh]=5;var Bh,pWe=$I(GA,9,0),fWe=$I(GA,9,1),mWe=$I(mV,5,0),gWe=$I(mV,5,1),Rae=function(o){for(var t=o[0],e=1;e<o.length;++e)o[e]>t&&(t=o[e]);return t},qI=function(o,t,e){var r=t/8|0;return(o[r]|o[r+1]<<8)>>(t&7)&e},Dae=function(o,t){var e=t/8|0;return(o[e]|o[e+1]<<8|o[e+2]<<16)>>(t&7)},bV=function(o){return(o+7)/8|0},tE=function(o,t,e){return(t==null||t<0)&&(t=0),(e==null||e>o.length)&&(e=o.length),new Bl(o.subarray(t,e))};var yWe=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ba=function(o,t,e){var r=new Error(t||yWe[o]);if(r.code=o,Error.captureStackTrace&&Error.captureStackTrace(r,Ba),!e)throw r;return r},r3e=function(o,t,e,r){var i=o.length,n=r?r.length:0;if(!i||t.f&&!t.l)return e||new Bl(0);var s=!e,a=s||t.i!=2,l=t.i;s&&(e=new Bl(i*3));var c=function(oe){var $=e.length;if(oe>$){var fe=new Bl(Math.max($*2,oe));fe.set(e),e=fe}},h=t.f||0,u=t.p||0,d=t.b||0,p=t.l,m=t.d,g=t.m,y=t.n,b=i*8;do{if(!p){h=qI(o,u,1);var P=qI(o,u+1,3);if(u+=3,P)if(P==1)p=fWe,m=gWe,g=9,y=5;else if(P==2){var E=qI(o,u,31)+257,O=qI(o,u+10,15)+4,_=E+qI(o,u+5,31)+1;u+=14;for(var x=new Bl(_),v=new Bl(19),D=0;D<O;++D)v[MX[D]]=qI(o,u+D*3,7);u+=O*3;for(var w=Rae(v),F=(1<<w)-1,H=$I(v,w,1),D=0;D<_;){var z=H[qI(o,u,F)];u+=z&15;var T=z>>4;if(T<16)x[D++]=T;else{var V=0,W=0;for(T==16?(W=3+qI(o,u,3),u+=2,V=x[D-1]):T==17?(W=3+qI(o,u,7),u+=3):T==18&&(W=11+qI(o,u,127),u+=7);W--;)x[D++]=V}}var L=x.subarray(0,E),k=x.subarray(E);g=Rae(L),y=Rae(k),p=$I(L,g,1),m=$I(k,y,1)}else Ba(1);else{var T=bV(u)+4,I=o[T-4]|o[T-3]<<8,C=T+I;if(C>i){l&&Ba(0);break}a&&c(d+I),e.set(o.subarray(T,C),d),t.b=d+=I,t.p=u=C*8,t.f=h;continue}if(u>b){l&&Ba(0);break}}a&&c(d+131072);for(var N=(1<<g)-1,U=(1<<y)-1,B=u;;B=u){var V=p[Dae(o,u)&N],G=V>>4;if(u+=V&15,u>b){l&&Ba(0);break}if(V||Ba(2),G<256)e[d++]=G;else if(G==256){B=u,p=null;break}else{var Y=G-254;if(G>264){var D=G-257,X=gV[D];Y=qI(o,u,(1<<X)-1)+t3e[D],u+=X}var K=m[Dae(o,u)&U],J=K>>4;K||Ba(3),u+=K&15;var k=dWe[J];if(J>3){var X=yV[J];k+=Dae(o,u)&(1<<X)-1,u+=X}if(u>b){l&&Ba(0);break}a&&c(d+131072);var se=d+Y;if(d<k){var ce=n-k,te=Math.min(k,se);for(ce+d<0&&Ba(3);d<te;++d)e[d]=r[ce+d]}for(;d<se;++d)e[d]=e[d-k]}}t.l=p,t.p=B,t.b=d,t.f=h,p&&(h=1,t.m=g,t.d=m,t.n=y)}while(!h);return d!=e.length&&s?tE(e,0,d):e.subarray(0,d)},eE=function(o,t,e){e<<=t&7;var r=t/8|0;o[r]|=e,o[r+1]|=e>>8},hV=function(o,t,e){e<<=t&7;var r=t/8|0;o[r]|=e,o[r+1]|=e>>8,o[r+2]|=e>>16},wae=function(o,t){for(var e=[],r=0;r<o.length;++r)o[r]&&e.push({s:r,f:o[r]});var i=e.length,n=e.slice();if(!i)return{t:KR,l:0};if(i==1){var s=new Bl(e[0].s+1);return s[e[0].s]=1,{t:s,l:1}}e.sort(function(C,E){return C.f-E.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],c=0,h=1,u=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=i-1;)a=e[e[c].f<e[u].f?c++:u++],l=e[c!=h&&e[c].f<e[u].f?c++:u++],e[h++]={s:-1,f:a.f+l.f,l:a,r:l};for(var d=n[0].s,r=1;r<i;++r)n[r].s>d&&(d=n[r].s);var p=new L2(d+1),m=Mae(e[h-1],p,0);if(m>t){var r=0,g=0,y=m-t,b=1<<y;for(n.sort(function(E,O){return p[O.s]-p[E.s]||E.f-O.f});r<i;++r){var P=n[r].s;if(p[P]>t)g+=b-(1<<m-p[P]),p[P]=t;else break}for(g>>=y;g>0;){var T=n[r].s;p[T]<t?g-=1<<t-p[T]++-1:++r}for(;r>=0&&g;--r){var I=n[r].s;p[I]==t&&(--p[I],++g)}m=t}return{t:new Bl(p),l:m}},Mae=function(o,t,e){return o.s==-1?Math.max(Mae(o.l,t,e+1),Mae(o.r,t,e+1)):t[o.s]=e},K9e=function(o){for(var t=o.length;t&&!o[--t];);for(var e=new L2(++t),r=0,i=o[0],n=1,s=function(l){e[r++]=l},a=1;a<=t;++a)if(o[a]==i&&a!=t)++n;else{if(!i&&n>2){for(;n>138;n-=138)s(32754);n>2&&(s(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(s(i),--n;n>6;n-=6)s(8304);n>2&&(s(n-3<<5|8208),n=0)}for(;n--;)s(i);n=1,i=o[a]}return{c:e.subarray(0,r),n:t}},uV=function(o,t){for(var e=0,r=0;r<t.length;++r)e+=o[r]*t[r];return e},i3e=function(o,t,e){var r=e.length,i=bV(t+2);o[i]=r&255,o[i+1]=r>>8,o[i+2]=o[i]^255,o[i+3]=o[i+1]^255;for(var n=0;n<r;++n)o[i+n+4]=e[n];return(i+4+r)*8},Z9e=function(o,t,e,r,i,n,s,a,l,c,h){eE(t,h++,e),++i[256];for(var u=wae(i,15),d=u.t,p=u.l,m=wae(n,15),g=m.t,y=m.l,b=K9e(d),P=b.c,T=b.n,I=K9e(g),C=I.c,E=I.n,O=new L2(19),_=0;_<P.length;++_)++O[P[_]&31];for(var _=0;_<C.length;++_)++O[C[_]&31];for(var x=wae(O,7),v=x.t,D=x.l,w=19;w>4&&!v[MX[w-1]];--w);var F=c+5<<3,H=uV(i,GA)+uV(n,mV)+s,z=uV(i,d)+uV(n,g)+s+14+3*w+uV(O,v)+2*O[16]+3*O[17]+7*O[18];if(l>=0&&F<=H&&F<=z)return i3e(t,h,o.subarray(l,l+c));var V,W,L,k;if(eE(t,h,1+(z<H)),h+=2,z<H){V=$I(d,p,0),W=d,L=$I(g,y,0),k=g;var N=$I(v,D,0);eE(t,h,T-257),eE(t,h+5,E-1),eE(t,h+10,w-4),h+=14;for(var _=0;_<w;++_)eE(t,h+3*_,v[MX[_]]);h+=3*w;for(var U=[P,C],B=0;B<2;++B)for(var G=U[B],_=0;_<G.length;++_){var Y=G[_]&31;eE(t,h,N[Y]),h+=v[Y],Y>15&&(eE(t,h,G[_]>>5&127),h+=G[_]>>12)}}else V=pWe,W=GA,L=mWe,k=mV;for(var _=0;_<a;++_){var X=r[_];if(X>255){var Y=X>>18&31;hV(t,h,V[Y+257]),h+=W[Y+257],Y>7&&(eE(t,h,X>>23&31),h+=gV[Y]);var K=X&31;hV(t,h,L[K]),h+=k[K],K>3&&(hV(t,h,X>>5&8191),h+=yV[K])}else hV(t,h,V[X]),h+=W[X]}return hV(t,h,V[256]),h+W[256]},bWe=new kX([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),KR=new Bl(0),PWe=function(o,t,e,r,i,n){var s=n.z||o.length,a=new Bl(r+s+5*(1+Math.ceil(s/7e3))+i),l=a.subarray(r,a.length-i),c=n.l,h=(n.r||0)&7;if(t){h&&(l[0]=n.r>>3);for(var u=bWe[t-1],d=u>>13,p=u&8191,m=(1<<e)-1,g=n.p||new L2(32768),y=n.h||new L2(m+1),b=Math.ceil(e/3),P=2*b,T=function(Oe){return(o[Oe]^o[Oe+1]<<b^o[Oe+2]<<P)&m},I=new kX(25e3),C=new L2(288),E=new L2(32),O=0,_=0,x=n.i||0,v=0,D=n.w||0,w=0;x+2<s;++x){var F=T(x),H=x&32767,z=y[F];if(g[H]=z,y[F]=H,D<=x){var V=s-x;if((O>7e3||v>24576)&&(V>423||!c)){h=Z9e(o,l,0,I,C,E,_,v,w,x-w,h),v=O=_=0,w=x;for(var W=0;W<286;++W)C[W]=0;for(var W=0;W<30;++W)E[W]=0}var L=2,k=0,N=p,U=H-z&32767;if(V>2&&F==T(x-U))for(var B=Math.min(d,V)-1,G=Math.min(32767,x),Y=Math.min(258,V);U<=G&&--N&&H!=z;){if(o[x+L]==o[x+L-U]){for(var X=0;X<Y&&o[x+X]==o[x+X-U];++X);if(X>L){if(L=X,k=U,X>B)break;for(var K=Math.min(U,X-2),J=0,W=0;W<K;++W){var se=x-U+W&32767,ce=g[se],te=se-ce&32767;te>J&&(J=te,z=se)}}}H=z,z=g[H],U+=H-z&32767}if(k){I[v++]=268435456|Lae[L]<<18|$9e[k];var oe=Lae[L]&31,$=$9e[k]&31;_+=gV[oe]+yV[$],++C[257+oe],++E[$],D=x+L,++O}else I[v++]=o[x],++C[o[x]]}}for(x=Math.max(x,D);x<s;++x)I[v++]=o[x],++C[o[x]];h=Z9e(o,l,c,I,C,E,_,v,w,x-w,h),c||(n.r=h&7|l[h/8|0]<<3,h-=7,n.h=y,n.p=g,n.i=x,n.w=D)}else{for(var x=n.w||0;x<s+c;x+=65535){var fe=x+65535;fe>=s&&(l[h/8|0]=c,fe=s),h=i3e(l,h+1,o.subarray(x,fe))}n.i=s}return tE(a,0,r+bV(h)+i)},JAt=(function(){for(var o=new Int32Array(256),t=0;t<256;++t){for(var e=t,r=9;--r;)e=(e&1&&-306674912)^e>>>1;o[t]=e}return o})(),n3e=function(){var o=-1;return{p:function(t){for(var e=o,r=0;r<t.length;++r)e=JAt[e&255^t[r]]^e>>>8;o=e},d:function(){return~o}}},TWe=function(){var o=1,t=0;return{p:function(e){for(var r=o,i=t,n=e.length|0,s=0;s!=n;){for(var a=Math.min(s+2655,n);s<a;++s)i+=r+=e[s];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}o=r,t=i},d:function(){return o%=65521,t%=65521,(o&255)<<24|(o&65280)<<8|(t&255)<<8|t>>8}}},BX=function(o,t,e,r,i){if(!i&&(i={l:1},t.dictionary)){var n=t.dictionary.subarray(-32768),s=new Bl(n.length+o.length);s.set(n),s.set(o,n.length),o=s,i.w=n.length}return PWe(o,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(o.length)))*1.5):20:12+t.mem,e,r,i)},Bae=function(o,t){var e={};for(var r in o)e[r]=o[r];for(var r in t)e[r]=t[r];return e},sWe=function(o,t,e){for(var r=o(),i=o.toString(),n=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/\s+/g,"").split(","),s=0;s<r.length;++s){var a=r[s],l=n[s];if(typeof a=="function"){t+=";"+l+"=";var c=a.toString();if(a.prototype)if(c.indexOf("[native code]")!=-1){var h=c.indexOf(" ",8)+1;t+=c.slice(h,c.indexOf("(",h))}else{t+=c;for(var u in a.prototype)t+=";"+l+".prototype."+u+"="+a.prototype[u].toString()}else t+=c}else e[l]=a}return t},xae=[],QAt=function(o){var t=[];for(var e in o)o[e].buffer&&t.push((o[e]=new o[e].constructor(o[e])).buffer);return t},e_t=function(o,t,e,r){if(!xae[e]){for(var i="",n={},s=o.length-1,a=0;a<s;++a)i=sWe(o[a],i,n);xae[e]={c:sWe(o[s],i,n),e:n}}var l=Bae({},xae[e].e);return ZAt(xae[e].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",e,l,QAt(l),r)},o3e=function(){return[Bl,L2,kX,gV,yV,MX,t3e,dWe,fWe,gWe,NX,yWe,$I,Rae,qI,Dae,bV,tE,Ba,r3e,h_t,IWe,n_t]},t_t=function(){return[Bl,L2,kX,gV,yV,MX,Lae,$9e,pWe,GA,mWe,mV,NX,bWe,KR,$I,eE,hV,wae,Mae,K9e,uV,i3e,Z9e,bV,tE,PWe,BX,EWe,IWe]};var r_t=function(){return[CWe,s_t]};var i_t=function(){return[SWe]},IWe=function(o){return postMessage(o,[o.buffer])},n_t=function(o){return o&&{out:o.size&&new Bl(o.size),dictionary:o.dictionary}};var ZR=function(o){return o.ondata=function(t,e){return postMessage([t,e],[t.buffer])},function(t){t.data.length?(o.push(t.data[0],t.data[1]),postMessage([t.data[0].length])):o.flush()}},Fae=function(o,t,e,r,i,n,s){var a,l=e_t(o,r,i,function(c,h){c?(l.terminate(),t.ondata.call(t,c)):Array.isArray(h)?h.length==1?(t.queuedSize-=h[0],t.ondrain&&t.ondrain(h[0])):(h[1]&&l.terminate(),t.ondata.call(t,c,h[0],h[1])):s(h)});l.postMessage(e),t.queuedSize=0,t.push=function(c,h){t.ondata||Ba(5),a&&t.ondata(Ba(4,0,1),null,!!h),t.queuedSize+=c.length,l.postMessage([c,a=h],[c.buffer])},t.terminate=function(){l.terminate()},n&&(t.flush=function(){l.postMessage([])})},dV=function(o,t){return o[t]|o[t+1]<<8},pV=function(o,t){return(o[t]|o[t+1]<<8|o[t+2]<<16|o[t+3]<<24)>>>0},q9e=function(o,t){return pV(o,t)+pV(o,t+4)*4294967296},Rd=function(o,t,e){for(;e;++t)o[t]=e,e>>>=8},o_t=function(o,t){var e=t.filename;if(o[0]=31,o[1]=139,o[2]=8,o[8]=t.level<2?4:t.level==9?2:0,o[9]=3,t.mtime!=0&&Rd(o,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),e){o[3]=8;for(var r=0;r<=e.length;++r)o[r+10]=e.charCodeAt(r)}},CWe=function(o){(o[0]!=31||o[1]!=139||o[2]!=8)&&Ba(6,"invalid gzip data");var t=o[3],e=10;t&4&&(e+=(o[10]|o[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!o[e++]);return e+(t&2)},s_t=function(o){var t=o.length;return(o[t-4]|o[t-3]<<8|o[t-2]<<16|o[t-1]<<24)>>>0},a_t=function(o){return 10+(o.filename?o.filename.length+1:0)},l_t=function(o,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(o[0]=120,o[1]=r<<6|(t.dictionary&&32),o[1]|=31-(o[0]<<8|o[1])%31,t.dictionary){var i=TWe();i.p(t.dictionary),Rd(o,2,i.d())}},SWe=function(o,t){return((o[0]&15)!=8||o[0]>>4>7||(o[0]<<8|o[1])%31)&&Ba(6,"invalid zlib data"),(o[1]>>5&1)==+!t&&Ba(6,"invalid zlib data: "+(o[1]&32?"need":"unexpected")+" dictionary"),(o[1]>>3&4)+2};function FX(o,t){return typeof o=="function"&&(t=o,o={}),this.ondata=t,o}var VA=(function(){function o(t,e){if(typeof t=="function"&&(e=t,t={}),this.ondata=e,this.o=t||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new Bl(98304),this.o.dictionary){var r=this.o.dictionary.subarray(-32768);this.b.set(r,32768-r.length),this.s.i=32768-r.length}}return o.prototype.p=function(t,e){this.ondata(BX(t,this.o,0,0,this.s),e)},o.prototype.push=function(t,e){this.ondata||Ba(5),this.s.l&&Ba(4);var r=t.length+this.s.z;if(r>this.b.length){if(r>2*this.b.length-32768){var i=new Bl(r&-32768);i.set(this.b.subarray(0,this.s.z)),this.b=i}var n=this.b.length-this.s.z;this.b.set(t.subarray(0,n),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(t.subarray(n),32768),this.s.z=t.length-n+32768,this.s.i=32766,this.s.w=32768}else this.b.set(t,this.s.z),this.s.z+=t.length;this.s.l=e&1,(this.s.z>this.s.w+8191||e)&&(this.p(this.b,e||!1),this.s.w=this.s.i,this.s.i-=2)},o.prototype.flush=function(){this.ondata||Ba(5),this.s.l&&Ba(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},o})();var c_t=(function(){function o(t,e){Fae([t_t,function(){return[ZR,VA]}],this,FX.call(this,t,e),function(r){var i=new VA(r.data);onmessage=ZR(i)},6,1)}return o})();function EWe(o,t){return BX(o,t||{},0,0)}var uT=(function(){function o(t,e){typeof t=="function"&&(e=t,t={}),this.ondata=e;var r=t&&t.dictionary&&t.dictionary.subarray(-32768);this.s={i:0,b:r?r.length:0},this.o=new Bl(32768),this.p=new Bl(0),r&&this.o.set(r)}return o.prototype.e=function(t){if(this.ondata||Ba(5),this.d&&Ba(4),!this.p.length)this.p=t;else if(t.length){var e=new Bl(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length),this.p=e}},o.prototype.c=function(t){this.s.i=+(this.d=t||!1);var e=this.s.b,r=r3e(this.p,this.s,this.o);this.ondata(tE(r,e,this.s.b),this.d),this.o=tE(r,this.s.b-32768),this.s.b=this.o.length,this.p=tE(this.p,this.s.p/8|0),this.s.p&=7},o.prototype.push=function(t,e){this.e(t),this.c(e)},o})();var OWe=(function(){function o(t,e){Fae([o3e,function(){return[ZR,uT]}],this,FX.call(this,t,e),function(r){var i=new uT(r.data);onmessage=ZR(i)},7,0)}return o})();function h_t(o,t){return r3e(o,{i:2},t&&t.out,t&&t.dictionary)}var gso=(function(){function o(t,e){this.c=n3e(),this.l=0,this.v=1,VA.call(this,t,e)}return o.prototype.push=function(t,e){this.c.p(t),this.l+=t.length,VA.prototype.push.call(this,t,e)},o.prototype.p=function(t,e){var r=BX(t,this.o,this.v&&a_t(this.o),e&&8,this.s);this.v&&(o_t(r,this.o),this.v=0),e&&(Rd(r,r.length-8,this.c.d()),Rd(r,r.length-4,this.l)),this.ondata(r,e)},o.prototype.flush=function(){VA.prototype.flush.call(this)},o})();var J9e=(function(){function o(t,e){this.v=1,this.r=0,uT.call(this,t,e)}return o.prototype.push=function(t,e){if(uT.prototype.e.call(this,t),this.r+=t.length,this.v){var r=this.p.subarray(this.v-1),i=r.length>3?CWe(r):4;if(i>r.length){if(!e)return}else this.v>1&&this.onmember&&this.onmember(this.r-r.length);this.p=r.subarray(i),this.v=0}uT.prototype.c.call(this,e),this.s.f&&!this.s.l&&!e&&(this.v=bV(this.s.p)+9,this.s={i:0},this.o=new Bl(0),this.push(new Bl(0),e))},o})();var u_t=(function(){function o(t,e){var r=this;Fae([o3e,r_t,function(){return[ZR,uT,J9e]}],this,FX.call(this,t,e),function(i){var n=new J9e(i.data);n.onmember=function(s){return postMessage(s)},onmessage=ZR(n)},9,0,function(i){return r.onmember&&r.onmember(i)})}return o})();var yso=(function(){function o(t,e){this.c=TWe(),this.v=1,VA.call(this,t,e)}return o.prototype.push=function(t,e){this.c.p(t),VA.prototype.push.call(this,t,e)},o.prototype.p=function(t,e){var r=BX(t,this.o,this.v&&(this.o.dictionary?6:2),e&&4,this.s);this.v&&(l_t(r,this.o),this.v=0),e&&Rd(r,r.length-4,this.c.d()),this.ondata(r,e)},o.prototype.flush=function(){VA.prototype.flush.call(this)},o})();var Q9e=(function(){function o(t,e){uT.call(this,t,e),this.v=t&&t.dictionary?2:1}return o.prototype.push=function(t,e){if(uT.prototype.e.call(this,t),this.v){if(this.p.length<6&&!e)return;this.p=this.p.subarray(SWe(this.p,this.v-1)),this.v=0}e&&(this.p.length<4&&Ba(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),uT.prototype.c.call(this,e)},o})();var d_t=(function(){function o(t,e){Fae([o3e,i_t,function(){return[ZR,uT,Q9e]}],this,FX.call(this,t,e),function(r){var i=new Q9e(r.data);onmessage=ZR(i)},11,0)}return o})();var aWe=(function(){function o(t,e){this.o=FX.call(this,t,e)||{},this.G=J9e,this.I=uT,this.Z=Q9e}return o.prototype.i=function(){var t=this;this.s.ondata=function(e,r){t.ondata(e,r)}},o.prototype.push=function(t,e){if(this.ondata||Ba(5),this.s)this.s.push(t,e);else{if(this.p&&this.p.length){var r=new Bl(this.p.length+t.length);r.set(this.p),r.set(t,this.p.length)}else this.p=t;this.p.length>2&&(this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(this.o):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,e),this.p=null)}},o})();var bso=(function(){function o(t,e){aWe.call(this,t,e),this.queuedSize=0,this.G=u_t,this.I=OWe,this.Z=d_t}return o.prototype.i=function(){var t=this;this.s.ondata=function(e,r,i){t.ondata(e,r,i)},this.s.ondrain=function(e){t.queuedSize-=e,t.ondrain&&t.ondrain(e)}},o.prototype.push=function(t,e){this.queuedSize+=t.length,aWe.prototype.push.call(this,t,e)},o})();var AWe=function(o,t,e,r){for(var i in o){var n=o[i],s=t+i,a=r;Array.isArray(n)&&(a=Bae(r,n[1]),n=n[0]),n instanceof Bl?e[s]=[n,a]:(e[s+="/"]=[new Bl(0),a],AWe(n,s,e,r))}},lWe=typeof TextEncoder<"u"&&new TextEncoder,e3e=typeof TextDecoder<"u"&&new TextDecoder,_We=0;try{e3e.decode(KR,{stream:!0}),_We=1}catch{}var vWe=function(o){for(var t="",e=0;;){var r=o[e++],i=(r>127)+(r>223)+(r>239);if(e+i>o.length)return{s:t,r:tE(o,e-1)};i?i==3?(r=((r&15)<<18|(o[e++]&63)<<12|(o[e++]&63)<<6|o[e++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|o[e++]&63):t+=String.fromCharCode((r&15)<<12|(o[e++]&63)<<6|o[e++]&63):t+=String.fromCharCode(r)}},Pso=(function(){function o(t){this.ondata=t,_We?this.t=new TextDecoder:this.p=KR}return o.prototype.push=function(t,e){if(this.ondata||Ba(5),e=!!e,this.t){this.ondata(this.t.decode(t,{stream:!0}),e),e&&(this.t.decode().length&&Ba(8),this.t=null);return}this.p||Ba(4);var r=new Bl(this.p.length+t.length);r.set(this.p),r.set(t,this.p.length);var i=vWe(r),n=i.s,s=i.r;e?(s.length&&Ba(8),this.p=null):this.p=s,this.ondata(n,e)},o})();var Tso=(function(){function o(t){this.ondata=t}return o.prototype.push=function(t,e){this.ondata||Ba(5),this.d&&Ba(4),this.ondata(Hy(t),this.d=e||!1)},o})();function Hy(o,t){if(t){for(var e=new Bl(o.length),r=0;r<o.length;++r)e[r]=o.charCodeAt(r);return e}if(lWe)return lWe.encode(o);for(var i=o.length,n=new Bl(o.length+(o.length>>1)),s=0,a=function(h){n[s++]=h},r=0;r<i;++r){if(s+5>n.length){var l=new Bl(s+8+(i-r<<1));l.set(n),n=l}var c=o.charCodeAt(r);c<128||t?a(c):c<2048?(a(192|c>>6),a(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|o.charCodeAt(++r)&1023,a(240|c>>18),a(128|c>>12&63),a(128|c>>6&63),a(128|c&63)):(a(224|c>>12),a(128|c>>6&63),a(128|c&63))}return tE(n,0,s)}function p_t(o,t){if(t){for(var e="",r=0;r<o.length;r+=16384)e+=String.fromCharCode.apply(null,o.subarray(r,r+16384));return e}else{if(e3e)return e3e.decode(o);var i=vWe(o),n=i.s,e=i.r;return e.length&&Ba(8),n}}var xWe=function(o){return o==1?3:o<6?2:o==9?1:0};var f_t=function(o,t){for(;dV(o,t)!=1;t+=4+dV(o,t+2));return[q9e(o,t+12),q9e(o,t+4),q9e(o,t+20)]},fV=function(o){var t=0;if(o)for(var e in o){var r=o[e].length;r>65535&&Ba(9),t+=r+4}return t},Nae=function(o,t,e,r,i,n,s,a){var l=r.length,c=e.extra,h=a&&a.length,u=fV(c);Rd(o,t,s!=null?33639248:67324752),t+=4,s!=null&&(o[t++]=20,o[t++]=e.os),o[t]=20,t+=2,o[t++]=e.flag<<1|(n<0&&8),o[t++]=i&&8,o[t++]=e.compression&255,o[t++]=e.compression>>8;var d=new Date(e.mtime==null?Date.now():e.mtime),p=d.getFullYear()-1980;if((p<0||p>119)&&Ba(10),Rd(o,t,p<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>1),t+=4,n!=-1&&(Rd(o,t,e.crc),Rd(o,t+4,n<0?-n-2:n),Rd(o,t+8,e.size)),Rd(o,t+12,l),Rd(o,t+14,u),t+=16,s!=null&&(Rd(o,t,h),Rd(o,t+6,e.attrs),Rd(o,t+10,s),t+=14),o.set(r,t),t+=l,u)for(var m in c){var g=c[m],y=g.length;Rd(o,t,+m),Rd(o,t+2,y),o.set(g,t+4),t+=4+y}return h&&(o.set(a,t),t+=h),t},RWe=function(o,t,e,r,i){Rd(o,t,101010256),Rd(o,t+8,e),Rd(o,t+10,e),Rd(o,t+12,r),Rd(o,t+16,i)},kae=(function(){function o(t){this.filename=t,this.c=n3e(),this.size=0,this.compression=0}return o.prototype.process=function(t,e){this.ondata(null,t,e)},o.prototype.push=function(t,e){this.ondata||Ba(5),this.c.p(t),this.size+=t.length,e&&(this.crc=this.c.d()),this.process(t,e||!1)},o})();var Iso=(function(){function o(t,e){var r=this;e||(e={}),kae.call(this,t),this.d=new VA(e,function(i,n){r.ondata(null,i,n)}),this.compression=8,this.flag=xWe(e.level)}return o.prototype.process=function(t,e){try{this.d.push(t,e)}catch(r){this.ondata(r,null,e)}},o.prototype.push=function(t,e){kae.prototype.push.call(this,t,e)},o})();var DWe=(function(){function o(t,e){var r=this;e||(e={}),kae.call(this,t),this.d=new c_t(e,function(i,n,s){r.ondata(i,n,s)}),this.compression=8,this.flag=xWe(e.level),this.terminate=this.d.terminate}return o.prototype.process=function(t,e){this.d.push(t,e)},o.prototype.push=function(t,e){kae.prototype.push.call(this,t,e)},o})();var wWe=(function(){function o(t){this.ondata=t,this.u=[],this.d=1}return o.prototype.add=function(t){var e=this;if(this.ondata||Ba(5),this.d&2)this.ondata(Ba(4+(this.d&1)*8,0,1),null,!1);else{var r=Hy(t.filename),i=r.length,n=t.comment,s=n&&Hy(n),a=i!=t.filename.length||s&&n.length!=s.length,l=i+fV(t.extra)+30;i>65535&&this.ondata(Ba(11,0,1),null,!1);var c=new Bl(l);Nae(c,0,t,r,a,-1);var h=[c],u=function(){for(var y=0,b=h;y<b.length;y++){var P=b[y];e.ondata(null,P,!1)}h=[]},d=this.d;this.d=0;var p=this.u.length,m=Bae(t,{f:r,u:a,o:s,t:function(){t.terminate&&t.terminate()},r:function(){if(u(),d){var y=e.u[p+1];y?y.r():e.d=1}d=1}}),g=0;t.ondata=function(y,b,P){if(y)e.ondata(y,b,P),e.terminate();else if(g+=b.length,h.push(b),P){var T=new Bl(16);Rd(T,0,134695760),Rd(T,4,t.crc),Rd(T,8,g),Rd(T,12,t.size),h.push(T),m.c=g,m.b=l+g+16,m.crc=t.crc,m.size=t.size,d&&m.r(),d=1}else d&&u()},this.u.push(m)}},o.prototype.end=function(){var t=this;if(this.d&2){this.ondata(Ba(4+(this.d&1)*8,0,1),null,!0);return}this.d?this.e():this.u.push({r:function(){t.d&1&&(t.u.splice(-1,1),t.e())},t:function(){}}),this.d=3},o.prototype.e=function(){for(var t=0,e=0,r=0,i=0,n=this.u;i<n.length;i++){var s=n[i];r+=46+s.f.length+fV(s.extra)+(s.o?s.o.length:0)}for(var a=new Bl(r+22),l=0,c=this.u;l<c.length;l++){var s=c[l];Nae(a,t,s,s.f,s.u,-s.c-2,e,s.o),t+=46+s.f.length+fV(s.extra)+(s.o?s.o.length:0),e+=s.b}RWe(a,t,this.u.length,r,e),this.ondata(null,a,!0),this.d=2},o.prototype.terminate=function(){for(var t=0,e=this.u;t<e.length;t++){var r=e[t];r.t()}this.d=2},o})();function VX(o,t){t||(t={});var e={},r=[];AWe(o,"",e,t);var i=0,n=0;for(var s in e){var a=e[s],l=a[0],c=a[1],h=c.level==0?0:8,u=Hy(s),d=u.length,p=c.comment,m=p&&Hy(p),g=m&&m.length,y=fV(c.extra);d>65535&&Ba(11);var b=h?EWe(l,c):l,P=b.length,T=n3e();T.p(l),r.push(Bae(c,{size:l.length,crc:T.d(),c:b,f:u,m,u:d!=s.length||m&&p.length!=g,o:i,compression:h})),i+=30+d+y+P,n+=76+2*(d+y)+(g||0)+P}for(var I=new Bl(n+22),C=i,E=n-i,O=0;O<r.length;++O){var u=r[O];Nae(I,u.o,u,u.f,u.u,u.c.length);var _=30+u.f.length+fV(u.extra);I.set(u.c,u.o+_),Nae(I,i,u,u.f,u.u,u.c.length,u.o,u.m),i+=16+_+(u.m?u.m.length:0)}return RWe(I,i,r.length,E,C),I}var m_t=(function(){function o(){}return o.prototype.push=function(t,e){this.ondata(null,t,e)},o.compression=0,o})();var Cso=(function(){function o(){var t=this;this.i=new uT(function(e,r){t.ondata(null,e,r)})}return o.prototype.push=function(t,e){try{this.i.push(t,e)}catch(r){this.ondata(r,null,e)}},o.compression=8,o})();var Sso=(function(){function o(t,e){var r=this;e<32e4?this.i=new uT(function(i,n){r.ondata(null,i,n)}):(this.i=new OWe(function(i,n,s){r.ondata(i,n,s)}),this.terminate=this.i.terminate)}return o.prototype.push=function(t,e){this.i.terminate&&(t=tE(t,0)),this.i.push(t,e)},o.compression=8,o})();var Eso=(function(){function o(t){this.onfile=t,this.k=[],this.o={0:m_t},this.p=KR}return o.prototype.push=function(t,e){var r=this;if(this.onfile||Ba(5),this.p||Ba(4),this.c>0){var i=Math.min(this.c,t.length),n=t.subarray(0,i);if(this.c-=i,this.d?this.d.push(n,!this.c):this.k[0].push(n),t=t.subarray(i),t.length)return this.push(t,e)}else{var s=0,a=0,l=void 0,c=void 0;this.p.length?t.length?(c=new Bl(this.p.length+t.length),c.set(this.p),c.set(t,this.p.length)):c=this.p:c=t;for(var h=c.length,u=this.c,d=u&&this.d,p=function(){var b,P=pV(c,a);if(P==67324752){s=1,l=a,m.d=null,m.c=0;var T=dV(c,a+6),I=dV(c,a+8),C=T&2048,E=T&8,O=dV(c,a+26),_=dV(c,a+28);if(h>a+30+O+_){var x=[];m.k.unshift(x),s=2;var v=pV(c,a+18),D=pV(c,a+22),w=p_t(c.subarray(a+30,a+=30+O),!C);v==4294967295?(b=E?[-2]:f_t(c,a),v=b[0],D=b[1]):E&&(v=-1),a+=_,m.c=v;var F,H={name:w,compression:I,start:function(){if(H.ondata||Ba(5),!v)H.ondata(null,KR,!0);else{var z=r.o[I];z||H.ondata(Ba(14,"unknown compression type "+I,1),null,!1),F=v<0?new z(w):new z(w,v,D),F.ondata=function(k,N,U){H.ondata(k,N,U)};for(var V=0,W=x;V<W.length;V++){var L=W[V];F.push(L,!1)}r.k[0]==x&&r.c?r.d=F:F.push(KR,!0)}},terminate:function(){F&&F.terminate&&F.terminate()}};v>=0&&(H.size=v,H.originalSize=D),m.onfile(H)}return"break"}else if(u){if(P==134695760)return l=a+=12+(u==-2&&8),s=3,m.c=0,"break";if(P==33639248)return l=a-=4,s=3,m.c=0,"break"}},m=this;a<h-4;++a){var g=p();if(g==="break")break}if(this.p=KR,u<0){var y=s?c.subarray(0,l-12-(u==-2&&8)-(pV(c,l-16)==134695760&&4)):c.subarray(0,a);d?d.push(y,!!s):this.k[+(s==2)].push(y)}if(s&2)return this.push(c.subarray(a),e);this.p=c.subarray(a)}e&&(this.c&&Ba(13),this.p=null)},o.prototype.register=function(t){this.o[t.compression]=t},o})();var Xb=class extends w2{constructor(){super()}};Xb.AS="AS",Xb.FS="FS",Xb.MI="MI",Xb.MO="MO",Xb.OF="OF",Xb.SF="SF";var GX=class extends Xb{constructor(){super();this.code="FS";this.maxIntegerLength=4;this.maxDecimalLength=4;this.omitLeading=!0;this.absolute=!0;this.modifiers[0]="LAX4Y4"}setCoordinateFormat(e,r,i=!0,n=!0){this.maxIntegerLength=e,this.maxDecimalLength=r,this.omitLeading=i,this.absolute=n,this.updateModifiers()}updateModifiers(){this.modifiers.length=1,this.modifiers[0]=this.getOmitFlag()+this.getAbsoluteFlag()+`X${this.maxIntegerLength}${this.maxDecimalLength}Y${this.maxIntegerLength}${this.maxDecimalLength}`}getAbsoluteFlag(){return this.absolute?"A":"I"}getOmitFlag(){return this.omitLeading?"L":"T"}};GX.ZeroOmission={Leading:"L",Trailing:"T"};var PV=class extends Xb{constructor(){super();this.code="MO";this.useInch=!0;this.modifiers[0]="IN"}setUnitAsInch(){this.useInch=!0,this.updateModifiers()}setUnitAsMillimeter(){this.useInch=!1,this.updateModifiers()}updateModifiers(){this.modifiers.length=1,this.modifiers[0]=this.getUnitFlag()}getUnitFlag(){return this.useInch?"IN":"MM"}};var BS=class extends w2{constructor(){super()}};BS.AD="AD",BS.AM="AM";var Gm=class Gm extends BS{constructor(e,r,i=0){super();this.code=BS.AM;this.name="";this.modifierGroups=[];this.paramsCount=0;this.name=e,typeof r=="string"?this.modifierGroups=[[r]]:this.modifierGroups=r,this.paramsCount=i}exportText(e){let r=w2.delimiter+Gm.code+this.name,i=r.length,n=s=>typeof s=="string"?s:typeof s.format=="function"?s.format(e):String(s);if(this.modifierGroups.length>0)for(let s of this.modifierGroups){let a="*"+s.map(n).join(",");i+a.length>w2.maxLength&&(r+=`
`,i=0),r+=a,i+=a.length}return r+=w2.endSign,r}static createOvalMacro(e="Oval"){return new Gm(e,Gm.OvalPrimitiveStr,5)}static createRectMacro(e="Rect"){return new Gm(e,Gm.RectPrimitiveStr,3)}static createRoundRectMacro(e="RoundRect"){return new Gm(e,Gm.RoundRectPrimitiveStr,5)}static createRegularPolygonMacro(e="RegularPolygon"){return new Gm(e,Gm.RegularPolygonPrimitiveStr,3)}static createOutlinePolygonMacro(e,r){if(r.length<3)throw new Error("polygon macro cannot have less than 3 points");let i=r[0],n=r[r.length-1];(n.x!=i.x||n.y!=i.y)&&r.push(i);let s=r.length-1,a=Gm.MaxOutlinePolygonPoints;if(s>a)throw new Error(`polygon macro cannot have more than ${a} points`);let l=r.flatMap(h=>[new s0(h.x),new s0(h.y)]);l.unshift("4","1",String(s)),l.push("0");let c=[l];return new Gm(e,c,0)}};Gm.code=BS.AM,Gm.MaxOutlinePolygonPoints=50,Gm.OvalPrimitiveStr=["1,1,$1,$2,$3","1,1,$1,$4,$5","20,1,$1,$2,$3,$4,$5,0"].join("*"),Gm.RectPrimitiveStr="21,1,$1,$2,0,0,$3",Gm.RoundRectPrimitiveStr=["1,1,$1,$2,$3","1,1,$1,$4,$5","1,1,$1,0-$2,0-$3","1,1,$1,0-$4,0-$5","20,1,$1,$2,$3,$4,$5,0","20,1,$1,$4,$5,0-$2,0-$3,0","20,1,$1,0-$2,0-$3,0-$4,0-$5,0","20,1,$1,0-$4,0-$5,$2,$3,0","4,1,4,$2,$3,$4,$5,0-$2,0-$3,0-$4,0-$5,$2,$3,0"].join("*"),Gm.RegularPolygonPrimitiveStr="5,1,$1,0,0,$2,$3";var dT=Gm;var UX=class o{constructor(){this.leftLength=5;this.rightLength=5;this.minNum=+("1e-"+(this.rightLength+1));this.omitLeadingZeroes=!0;this._unit="IN";this.toUnit=o.toUnitIN}get unit(){return this._unit}set unit(t){this._unit=t,this.toUnit=t=="IN"?o.toUnitIN:o.toUnitMM}static toUnitIN(t){return t/100}static toUnitMM(t){return t*.254}static toNoExponentialString(t){let e=t.toString();if(/[eE]/.test(e)){let r=e.split(/[eE]/),[i,n]=r,s=i[0]=="-"?"-":"";i=s?i.slice(1):i;let a=i,l="";a.includes(".")&&([a,l]=a.split("."));let c=Number(n);c>0?(l=l.padEnd(c,"0"),a+=l.slice(0,c),l=l.slice(c)):c<0&&(a=a.padStart(-c,"0"),l=a.slice(c)+l,a=a.slice(0,a.length+c)),a=a||"0",e=s+a+(l?"."+l:"")}return e}formatPureDecimalNumber(t,e=6){let r=o.toNoExponentialString(t),i=+("1e"+e);return r.includes(".")&&r.split(".")[1].length>e&&(r=o.toNoExponentialString(Math.round(t*i)/i)),r.includes(".")?r:r+".0"}formatDecimalNumber(t){return t=this.toUnit(t),this.formatPureDecimalNumber(t,this.rightLength)}formatDecimalXY(t){let e=this.formatDecimalNumber(t.x),r=this.formatDecimalNumber(t.y);return`X${e}Y${r}`}formatNumber(t){return this.formatNumberNew(t)}formatNumberNew(t){if(t=this.toUnit(t),t!=0){let h=this.rightLength+1,u=Number(t.toFixed(h));u>=-this.minNum&&u<=this.minNum?t=0:t=t+1e-12}if(t==0&&this.omitLeadingZeroes)return"0";let e=t<0,r=e?"-":"",i=(e?-t:t).toString(),n="",s="",a=!0,l=this.rightLength,c=i.length;for(let h=0;h<c;h++){let u=i[h];if(u=="."){a=!1;continue}if(a)n+=u;else if(l--,l==0||h==c-1){if(+i[h+1]>=5){let p=+u+1;p==10?(s=Math.round(+(s+u+"."+i[h+1])).toString(),s.length>this.rightLength?(n=(+n+1).toString(),s=s.slice(1)):l==0&&s.length<this.rightLength&&((n==""||n=="0")&&this.omitLeadingZeroes||(s=s.padStart(this.rightLength,"0")))):s+=p}else s+=u;break}else s+=u}return this.omitLeadingZeroes?n=n=="0"?"":n:n=n.padStart(this.leftLength,"0"),l>0&&(s=s.padEnd(this.rightLength,"0")),!n&&this.omitLeadingZeroes&&s[0]=="0"&&(s=(+s).toString()),r+n+s}formatPointXY(t){let e=this.formatNumber(t.x),r=t.x==t.y?e:this.formatNumber(t.y);if(this.lastXY){let i=this.lastXY.x==t.x?e:this.formatNumber(this.lastXY.x);if(e===i)return this.lastXY=null,`Y${r}`;let n=this.lastXY.y==t.y?r:this.formatNumber(this.lastXY.y);if(r===n)return this.lastXY=null,`X${e}`;this.lastXY=null}return`X${e}Y${r}`}formatPointIJ(t){let e=this.formatNumber(t.x),r=t.x==t.y?e:this.formatNumber(t.y);return`I${e}J${r}`}};function TV(o,t){return{x:o.x+t.x,y:o.y+t.y}}var s3e=class{constructor(t,e){this._repeatTimes=t,this._offset=e}exportText(t){let{x:e,y:r}=this._offset,i=t.formatDecimalNumber(e),n=t.formatDecimalNumber(r);return e&&r?`R${this._repeatTimes}X${i}Y${n}`:e?`R${this._repeatTimes}X${i}`:`R${this._repeatTimes}Y${n}`}},Vae=class{constructor(){}exportText(t){return""}},HX=class o extends Vae{constructor(t,e,r=!1){super(),this._diameter=t,this._center=e,this._isNPTHSmallCircleSlot=r}get diameter(){return this._diameter}get center(){return this._center}get isNPTHSmallCircleSlot(){return this._isNPTHSmallCircleSlot}applyOffset(t){this._center=TV(this._center,t)}offsetClone(t){return new o(this._diameter,TV(this._center,t))}exportText(t){return t.formatDecimalXY(this.center)}},Gae=class o extends Vae{constructor(t,e,r){super(),this._diameter=t,this._start=e,this._end=r}get diameter(){return this._diameter}get start(){return this._start}get end(){return this._end}applyOffset(t){this._start=TV(this._start,t),this._end=TV(this._end,t)}offsetClone(t){let e=TV(this._start,t),r=TV(this._end,t);return new o(this._diameter,e,r)}exportText(t){let e=t.formatDecimalXY(this.start),r=t.formatDecimalXY(this.end);return e+UA.Slot+r}},Dd=class Dd{constructor(){this.headerComments=[];this.diameters=[];this.holes=[];this.bodyBlocks=[];this.currentDiameter=0;this._unit="MM";this._isThroughVia=!1;this.use42=!1;this._integerPlaces=4;this._decimalPlaces=2;this._panelizeFrom=1/0;this.panelizeParam=null;this.isMirror=!1}get unit(){return this._unit}set unit(t){this._unit=t}get holesCount(){return this.holes.length}get isThroughVia(){return this._isThroughVia}get panelizeFrom(){return this._panelizeFrom}setPanelizeFlag(){this._panelizeFrom=this.holes.length}addDiameterSize(t){t>0&&!this.diameters.includes(t)&&this.diameters.push(t)}addBodyHole(t,e){let{diameter:r}=t,i=this.diameters.indexOf(r);if(i>=0){if(r!==this.currentDiameter){let n=Dd.ToolSelection.replace("#",(i+1+"").padStart(2,"0"));this.addBody(n),this.currentDiameter=r}this.addBody(t.exportText(e))}}addBodyRepeat(t,e,r){let i=new s3e(t,e);this.addBody(i.exportText(r))}addCircle(t,e,r=!1,i=!1){this.addDiameterSize(t),this.holes.push(new HX(t,e,i)),this._isThroughVia=r}addSlot(t,e,r){this.addDiameterSize(t),this.holes.push(new Gae(t,e,r))}addHeaderComment(t){this.headerComments.push(";"+t)}addBodyComment(t){this.addBody(";"+t)}addBody(t){this.bodyBlocks.push(t)}parseUnit(){if(this.unit=="IN")this._integerPlaces=2,this._decimalPlaces=4;else if(this.unit=="MM"){let t=999.999,e=-t,r=s=>s>t||s<e,i=s=>r(s.x)||r(s.y),n=!1;for(let s of this.holes)if(s instanceof HX){if(i(s.center)){n=!0;break}}else if(s instanceof Gae){if(i(s.start)||i(s.end)){n=!0;break}}else throw new Error("unknown hole type");this._integerPlaces=n?4:3,this._decimalPlaces=n?2:3}else throw new Error("unknown unit")}getUnitBlock(){let t="";for(let r=1;r<=this._integerPlaces;r++)t=t+"0";t=t+".";for(let r=1;r<=this._decimalPlaces;r++)t=t+"0";return[this.unit=="IN"?Dd.UnitIN:Dd.UnitMM,Dd.LeadingZero,t].join(",")}getCommentBlock(t){return";"+t}exportText(t){let e=`
`,r=[].concat(this.headerComments);if(r.push(Dd.HeaderBegin),this._integerPlaces=t.leftLength,this._decimalPlaces=t.rightLength,this.unit=t.unit,this.unit=="IN"){if(this._integerPlaces<2)throw new Error("integerPlaces is too small");if(this._decimalPlaces<2)throw new Error("decimalPlaces is too small")}r.push(this.getUnitBlock()),t.omitLeadingZeroes=!1;let i=y=>(y/100+1e-10).toFixed(t.rightLength),n=y=>(y*.254+1e-10).toFixed(t.rightLength),s=this.unit=="IN"?i:n;this.diameters.sort((y,b)=>y-b);let a=this._panelizeFrom<this.holes.length,l=(y,b)=>this.panelizeParam&&(!this.panelizeParam.onlyOutline||b)&&a&&y>=this._panelizeFrom,c=this.holes.map((y,b)=>[y,l(b,y instanceof HX&&y.isNPTHSmallCircleSlot)]);c.sort((y,b)=>y[0].diameter-b[0].diameter);let h=this.unit=="IN"?Dd.UnitIN:Dd.UnitMM,u=0,d=s(0),p=0;for(let y of this.diameters){if(s(y)!=d){p=y;break}u++}u>0&&this.diameters.splice(0,u);let m=0;for(let y of this.diameters){m++;let b=s(y),P=this.getCommentBlock(`Hole size ${m} = ${b} ${h}`),T=Dd.ToolSelection.replace("#",String(m).padStart(2,"0"))+Dd.ToolDiameter.replace("#",b);r.push(P,T)}r.push(Dd.HeaderEnd),this.bodyBlocks.length=0,this.addBody(Dd.ModeDrill),this.addBody(Dd.ModeAbsolute);for(let y of c){let[b,P]=y;if(!(b.diameter<p))if(P){let{offset:T,row:I,column:C}=this.panelizeParam,E=T.x,O=T.y;this.isMirror&&(E=-E);for(let _=0;_<C;_++)for(let x=0;x<I;x++){let v=b.offsetClone({x:E*_,y:O*x});this.addBodyHole(v,t)}}else this.addBodyHole(b,t)}return r.concat(this.bodyBlocks,Dd.ProgramEnd).join(e)}};Dd.HeaderBegin="M48",Dd.HeaderEnd="%",Dd.UnitIN="INCH",Dd.UnitMM="METRIC",Dd.LeadingZero="LZ",Dd.ModeDrill="G05",Dd.ModeAbsolute="G90",Dd.Slot="G85",Dd.ProgramEnd="M30",Dd.ToolSelection="T#",Dd.ToolDiameter="C#";var UA=Dd;var HA=class HA extends BS{constructor(e,r){super();this.code=BS.AD;this.number=e,this.apertureType=r}get apertureName(){return"D"+this.dCodeNumber}get number(){return this.dCodeNumber}set number(e){if(e<HA.numberMin||e>HA.numberMax)throw new Error("D-code number is out of range");this.dCodeNumber=e}exportText(e){let r=w2.delimiter+this.code+this.apertureName+this.apertureType,i=n=>typeof n=="string"?n:typeof n.format=="function"?n.format(e):String(n);if(this.modifiers.length>0){r+=",";let n=HA.modifierDelimiter;r+=this.modifiers.map(i).join(n)}return r+=w2.endSign,r}appendModifier(e){this.modifiers.push(e)}clearModifiers(){this.modifiers.length=0}setHole(e,r){typeof e=="number"&&(this.modifiers.push(new s0(e)),typeof r=="number"&&this.modifiers.push(new s0(r)))}setCircleAperture(e,r,i){this.clearModifiers(),this.apertureType="C",this.modifiers.push(new s0(e)),this.setHole(r,i)}setRectangleAperture(e,r,i,n){this.apertureType="R",this.modifiers.push(new s0(e),new s0(r)),this.setHole(i,n)}setOvalAperture(e,r,i,n){this.apertureType="O",this.modifiers.push(new s0(e),new s0(r)),this.setHole(i,n)}setPolygonAperture(e,r,i,n,s){this.apertureType="P",this.modifiers.push(new s0(e),String(r)),typeof i=="number"&&(this.modifiers.push(new s0(i)),this.setHole(n,s))}setRectMacroAperture(e,r){this.apertureType=e,this.modifiers=[new s0(r[0]),new s0(r[1]),new cV(r[2])]}setRoundRectMacroAperture(e,r){this.apertureType=e,this.modifiers=r.map(i=>new s0(i))}setOvalMacroAperture(e,r){this.apertureType=e,this.modifiers=r.map(i=>new s0(i))}setOutlinePolygonMacroAperture(e){this.apertureType=e,this.modifiers=[]}setRegularPolygonMacroAperture(e,r){this.apertureType=e,this.modifiers=[new cV(r[0]),new s0(r[1]),new cV(r[2])]}};HA.numberMin=10,HA.numberMax=8191,HA.code="AD",HA.modifierDelimiter="X";var Eg=HA;var IV=class IV extends rm{constructor(e){super();this.content="";this.code="G04";this.content=e}exportText(){let e=this.content.replace(/\\/g,"\\\\").replace(/\*/g,"\\x2a");return e.includes(`
`)?IV.code+" "+e.replace(/\n/g,rm.endSign+`
`+IV.code+" ")+rm.endSign:IV.code+" "+e+rm.endSign}};IV.code="G04";var WX=IV;var JR=class JR extends rm{constructor(t){super(),this.code=t}exportText(){return this.code+rm.endSign}};JR.ProgramStop=new JR("M00"),JR.OptionalStop=new JR("M01"),JR.ProgramEnd=new JR("M02");var QR=JR;var WA=class{constructor(t){this.dataBlocks=[];this.headerBlocks=[];this.macroBlocks=[];this.apertureBlocks=[];this.bodyStartBlocks=[];this.bodyBlocks=[];this.docEndBlocks=[];this.targetOfAdd=null;this.defaultFormatter=null;this.bodyTextCache=[];this.apertureMap={};this.apertureMacroMap={};this.apertureNumber=10;this.polygonMacroNumber=1;this.currentAperture="";this.patternStart=-1;this.patternEnd=-1;this.stepRepeatConfig=Oae;this.stepRepeatParameterOpened=!1;this.enableOptimizeXY=!0;this._layerId=t,this.targetOfAdd=this.dataBlocks,this.addBodyStartBlock([ui.enable360Circular(),new MS]),this.addDocEndBlock([new MS,QR.ProgramEnd])}get layerId(){return this._layerId}getApertureNumber(){return this.apertureNumber}getNewApertureNumber(){return this.apertureNumber++}newPolygonMacroName(){return"PolygonMacro"+this.polygonMacroNumber++}getApertureCircle(t,e=4){if(t<=0)return null;let r="C"+Pa(t,e);if(this.apertureMap.hasOwnProperty(r))return this.apertureMap[r];let i=new Eg(this.apertureNumber++,"C");return i.setCircleAperture(t),this.addApertureBlock(i,r),i.apertureName}getApertureRect(t,e,r=0,i=0,n=4){if(t=+Pa(t,n),e=+Pa(e,n),r=+Pa(r,2),i=+Pa(i,n+1),t<=0||e<=0)return null;r<0&&(r=(r%360+360)%360),r%=180,i===0&&r==90&&(r=0,[t,e]=[e,t]);let s="R"+[t,e,r,i].map(l=>Pa(l,n)).join("x");if(this.apertureMap.hasOwnProperty(s))return this.apertureMap[s];let a=new Eg(this.apertureNumber++,"");if(i>0){if(Math.min(t,e)<=i*2)return this.apertureNumber--,t==e?this.getApertureCircle(t):this.getApertureOval(t,e,r);let c="RoundRect";if(!this.hasMacro(c)){let b=dT.createRoundRectMacro();this.addMacroBlock(b)}let h=[-t/2+i,e/2-i],u=[t/2-i,e/2-i],d=new S(0,0),p=new S(h[0],h[1]),m=new S(u[0],u[1]),g=r?p.rotateD(d,r):p,y=r?m.rotateD(d,r):m;a.setRoundRectMacroAperture(c,[i*2,g.x,g.y,y.x,y.y])}else if(r%90){let l="Rect";if(!this.hasMacro(l)){let c=dT.createRectMacro();this.addMacroBlock(c)}a.setRectMacroAperture(l,[t,e,r])}else r%180?a.setRectangleAperture(e,t):a.setRectangleAperture(t,e);return this.addApertureBlock(a,s),a.apertureName}getApertureOval(t,e,r=0,i=4){if(t<=0||e<=0)return null;r<0&&(r=(r%360+360)%360),r%=180,r%180==0&&(r=0),r%180!==0&&r%90===0&&([e,t]=[t,e],r=0);let n="O"+[t,e,r].map(a=>Pa(a,i)).join("x");if(this.apertureMap.hasOwnProperty(n))return this.apertureMap[n];let s=new Eg(this.apertureNumber++,"");if(r==0)s.setOvalAperture(t,e);else{let a="Oval";if(!this.hasMacro(a)){let d=dT.createOvalMacro();this.addMacroBlock(d)}let l=Math.min(t,e),c=(t-e)/2,h,u;t>e?(h=new S(-c,0),u=new S(c,0)):(h=new S(0,-c),u=new S(0,c)),h=h.rotateD(new S(0,0),r),u=u.rotateD(new S(0,0),r),s.setOvalMacroAperture(a,[l,h.x,h.y,u.x,u.y])}return this.addApertureBlock(s,n),s.apertureName}getAperturePolygon(t,e=4){let r="P"+t.map(s=>Pa(s.x,e)+"x"+Pa(s.y,e)).join("x");if(this.apertureMap.hasOwnProperty(r))return this.apertureMap[r];let i=this.newPolygonMacroName();if(!this.hasMacro(i)){let s=dT.createOutlinePolygonMacro(i,t);this.addMacroBlock(s)}let n=new Eg(this.apertureNumber++,i);return this.addApertureBlock(n,r),n.apertureName}useAperture(t){if(t&&t!=this.currentAperture){this.currentAperture=t;let e=ui.useAperture(t);this.addBodyBlock(e)}}existApertureDefinition(t){return this.apertureMap.hasOwnProperty(t)}setFormatter(t){this.defaultFormatter=t}setTargetAsHeader(){this.targetOfAdd=this.headerBlocks}setTargetAsMacro(){this.targetOfAdd=this.macroBlocks}setTargetAsAperture(){this.targetOfAdd=this.apertureBlocks}setTargetAsBody(){this.targetOfAdd=this.bodyBlocks}getTargetByBlock(t){return t instanceof QR?this.docEndBlocks:t instanceof rm?this.bodyBlocks:t instanceof Eg?this.apertureBlocks:t instanceof dT?this.macroBlocks:t instanceof Xb?this.headerBlocks:this.bodyBlocks}setTargetByBlock(t){this.targetOfAdd=this.getTargetByBlock(t)}addBlock(t,e){if(e=e||this.targetOfAdd,Array.isArray(t)){e||(e=this.getTargetByBlock(t[0]));let r=e.length;e.length=r+t.length;for(let i of t)e[r++]=i}else t&&(e||(e=this.getTargetByBlock(t)),e.length++,e[e.length-1]=t);this.bodyBlocks.length>1e3&&this.flushBodyBlocks()}addBlockWithOffsets(t,e,r){if(e.length<=1){this.addBlock(t,r);return}if(r=r||this.bodyBlocks,Array.isArray(t))for(let i of e){let n=r.length;r.length+=t.length;for(let s of t)s instanceof ui?r[n++]=s.offsetClone(i):r[n++]=s}else if(t)if(t instanceof ui){let i=r.length;r.length+=e.length;for(let n of e)r[i++]=t.offsetClone(n)}else{let i=r.length;r.length=i+1,r[i]=t}}addHeaderBlock(t){this.addBlock(t,this.headerBlocks)}addMacroBlock(t){this.hasMacro(t.name)||(this.apertureMacroMap[t.name]=t,this.addBlock(t,this.macroBlocks))}addApertureBlock(t,e){e||(e=t.exportText(this.defaultFormatter)),!(e&&this.apertureMap.hasOwnProperty(e))&&(e&&(this.apertureMap[e]=t.apertureName),this.addBlock(t,this.apertureBlocks))}addBodyStartBlock(t){this.addBlock(t,this.bodyStartBlocks)}addBodyBlock(t){this.addBlock(t,this.bodyBlocks)}addDocEndBlock(t){this.addBlock(t,this.docEndBlocks)}addParameter(t,e){this.addBlock(t,e)}addComment(t,e){this.addBlock(new WX(t),e)}addEmptyLine(t){this.addBlock(new MS,t)}initDataPatternStart(){this.patternStart<0&&(this.patternStart=this.dataBlocks.length)}initDataPatternEnd(){this.patternStart>=0&&this.patternEnd<0&&(this.patternEnd=this.dataBlocks.length)}initDataPattern(){if(this.patternStart>=0)return!0;let t=this.dataBlocks,e=t.findIndex(i=>i instanceof ui&&!i.isComment());if(e<-1)return!1;let r=t.length-1;for(;r>0&&t[r]instanceof QR;)r--;return this.patternStart=e,this.patternEnd=r,!0}repeatDataPattern(t){if(this.patternStart<0)return!1;let e=this.dataBlocks,r=e.length-1,i=[];for(;r>0&&e[r]instanceof QR;)r--,i.unshift(e.pop());let n=this.dataBlocks.slice(this.patternStart,this.patternEnd+1);for(let s of n)s instanceof ui?this.addBlock(s.offsetClone(t)):this.addBlock(s);return i.length&&this.addBlock(i),!0}hasAperture(){return!!this.currentAperture}hasMacro(t){return!!this.apertureMacroMap[t]}getBlocksText(t){return tWe(t,this.defaultFormatter)}getBodyBlocks(){return this.bodyBlocks.slice()}setBodyBlocks(t){throw this.bodyBlocks=t.slice(),new Error("do not call this function")}offsetBodyBlocks(t){DX(this.bodyBlocks,t)}flushBodyBlocks(){if(!this.bodyBlocks.length)return;let t=this.getBlocksText(this.bodyBlocks);this.bodyBlocks.length=0,this.bodyTextCache.push(t)}exportTextV2(t){if(t&&this.setFormatter(t),!this.hasAperture()){let s=this.getApertureCircle(1);this.useAperture(s)}if(this.flushBodyBlocks(),!this.macroBlocks.length){let s=Object.keys(this.apertureMacroMap).map(a=>this.apertureMacroMap[a]);this.macroBlocks=s}let e=`
`,r=[this.headerBlocks,this.macroBlocks,this.apertureBlocks,this.bodyStartBlocks].map(s=>this.getBlocksText(s)),i=this.getBlocksText(this.docEndBlocks),n=r.join("")+this.bodyTextCache.join("")+i+e;return this.bodyTextCache.length=0,n}exportText(t){return this.exportTextV2(t)}updateCopperComment(t){for(let e=0;e<this.headerBlocks.length;e++){let r=this.headerBlocks[e];if(r instanceof WX&&r.content.startsWith("Copper Areas:")){r.content=t;break}}}};function a3e(o){let t=o.length;if(t<3)return 0;let e=o[0].x*(o[t-1].y-o[1].y);for(let r=1;r<t-1;r++)e+=o[r].x*(o[r-1].y-o[r+1].y);return e+=o[t-1].x*(o[t-2].y-o[0].y),Math.abs(e/2)}function g_t(o){let t=o[0].x,e=o[0].y,r=0,i=0;for(let n=1;n<o.length;n++){let s=o[n];s.x<t&&(t=s.x,r=n),s.y<e&&(e=s.y,i=n)}return{minX:t,minY:e,minXI:r,minYI:i}}function y_t(o,t,e){let r=null,i=n=>{r?n.point.x>r.point.x&&(r=n):r=n};for(let n=0;n<t.length;n++){let s=t[n],a=t[(n+1)%t.length];if(s.x===a.x&&s.y===a.y)continue;if(s.y==o.y&&s.x<=o.x){i({vertex:[n],point:s});continue}if(a.y==o.y||s.x>o.x&&a.x>o.x||s.y>o.y&&a.y>o.y||s.y<o.y&&a.y<o.y)continue;if(s.x===a.x){let c={edge:[n,(n+1)%t.length],point:new S(s.x,o.y)};i(c);continue}let l=s.x+(a.x-s.x)*(o.y-s.y)/(a.y-s.y);if(e&&(l=Math.round(l)),l<=o.x){let c={edge:[n,(n+1)%t.length],point:new S(l,o.y)};i(c);continue}}return r}function b_t(o,t){let e=[],{outer:r,holes:i}=o;if(!i.length)return r;let n=i.map(g_t),s=new Array(i.length).fill(0).map((a,l)=>l);s.sort((a,l)=>{let c=n[a],h=n[l],u=c.minX-h.minX,d=c.minY-h.minY;return u===0?d:u}),e=e.concat(r);for(let a of s){let l=i[a],c=n[a].minXI,h=l[c],u=l.slice(0,c+1),d=l.slice(c),p=y_t(h,e,t);if(!p){let m=Number.MAX_VALUE,g=[];for(let y=0;y<e.length;y++){let b=e[y];h.distance1(b)<m&&(g=[y,b])}p={vertex:[g[0]],point:g[1]}}if("vertex"in p){let{vertex:m,point:g}=p;d.concat(u,g).forEach((b,P)=>{e.splice(m[0]+1+P,0,b)})}else{let{edge:m,point:g}=p;[g].concat(d,u,g).forEach((b,P)=>{e.splice(m[0]+1+P,0,b)})}}return e}function KI(o,t=[],e=!1){return P_t(o,t,e)}function MWe(o){return ui.primitivesToPoints(o.primitives)}function P_t(o,t=[],e=!1){let r=new Ec,n=(e&&o.length==1?r.normalizeData(o[0],t[0]).toPolylineGroups():r.getUnionForSingle(o,t)).map(c=>({outer:MWe(c.items[0]),holes:c.items.slice(1).map(MWe)})),s=.01,a=!1;return n.forEach(c=>{let{outer:h,holes:u}=c,d=a3e(h);if(Math.abs(d)<s){c.outer=null,a=!0;return}if(!u.length)return;let p=!1;for(let m of u){let g=a3e(m);Math.abs(g)<s&&(m.length=0,p=!0)}p&&(c.holes=u.filter(m=>m.length>0))}),a&&(n=n.filter(c=>c.outer!=null)),n.map((c,h)=>b_t(c,!1))}var GWe=Ru(gY());var eD=class extends tp{constructor(t){if(super(),this.code="SR",t){let[e,r,i,n]=t;this.modifiers.push("X"+e,"Y"+r,"I",new s0(i),"J",new s0(n))}}};var Uae=[{char:"A",path:"M -1.831 -2.796 L -2.298 -2.618 L -0.227 2.796 L 0.24 2.796 L 2.298 -2.618 L 1.831 -2.796 L 1.146 -0.993 L -1.142 -0.993 Z M -0.95 -0.493 L 0.955 -0.493 L 0.005 2.007 Z"},{char:"B",path:"M -1.967 -2.841 L -1.967 2.841 L 0.503 2.841 L 1.321 2.587 L 1.671 2.276 L 1.967 1.712 L 1.965 0.997 L 1.715 0.507 L 1.421 0.192 L 1.297 0.126 L 1.421 0.058 L 1.715 -0.257 L 1.965 -0.747 L 1.967 -1.712 L 1.671 -2.276 L 1.321 -2.589 L 0.503 -2.841 Z M -1.467 -2.341 L 0.463 -2.341 L 1.108 -2.13 L 1.288 -1.952 L 1.493 -1.542 L 1.493 -0.921 L 1.288 -0.518 L 1.108 -0.339 L 0.463 -0.13 L -1.467 -0.13 Z M -1.467 0.37 L 0.462 0.37 L 1.108 0.589 L 1.288 0.769 L 1.493 1.171 L 1.493 1.54 L 1.288 1.952 L 1.108 2.13 L 0.463 2.341 L -1.467 2.341 Z"},{char:"C",path:"M -0.413 -2.841 L -1.079 -2.526 L -1.626 -1.96 L -1.88 -1.44 L -2.142 -0.62 L -2.142 0.62 L -1.866 1.47 L -1.579 2.026 L -1.013 2.575 L -0.413 2.841 L 0.578 2.841 L 1.246 2.526 L 1.792 1.96 L 2.142 1.245 L 1.693 1.026 L 1.363 1.702 L 0.921 2.144 L 0.521 2.341 L -0.354 2.341 L -0.755 2.144 L -1.196 1.702 L -1.411 1.265 L -1.642 0.579 L -1.642 -0.579 L -1.411 -1.265 L -1.196 -1.702 L -0.755 -2.143 L -0.354 -2.341 L 0.521 -2.341 L 0.921 -2.143 L 1.363 -1.702 L 1.693 -1.026 L 2.142 -1.245 L 1.792 -1.96 L 1.246 -2.526 L 0.578 -2.841 Z"},{char:"D",path:"M -1.98 -2.841 L -1.98 2.841 L -0.001 2.841 L 0.818 2.587 L 1.452 1.964 L 1.716 1.441 L 1.98 0.62 L 1.98 -0.62 L 1.702 -1.474 L 1.409 -2.024 L 0.818 -2.589 L -0.001 -2.841 Z M -1.48 -2.341 L -0.04 -2.341 L 0.605 -2.132 L 1.025 -1.702 L 1.249 -1.263 L 1.48 -0.579 L 1.48 0.579 L 1.249 1.263 L 1.025 1.702 L 0.605 2.132 L -0.04 2.341 L -1.48 2.341 Z"},{char:"E",path:"M -1.855 -2.841 L -1.855 2.841 L 1.855 2.841 L 1.855 2.341 L -1.355 2.341 L -1.355 0.37 L 0.624 0.37 L 0.624 -0.13 L -1.355 -0.13 L -1.355 -2.341 L 1.855 -2.341 L 1.855 -2.841 Z"},{char:"F",path:"M -1.855 -2.841 L -1.855 2.841 L -1.355 2.841 L 1.855 2.841 L 1.855 2.341 L -1.355 2.341 L -1.355 0.37 L 0.624 0.37 L 0.624 -0.13 L -1.355 -0.13 L -1.355 -2.841 Z"},{char:"G",path:"M -0.419 -2.841 L -1.085 -2.526 L -1.632 -1.96 L -1.886 -1.44 L -2.136 -0.7 L -2.136 0.7 L -1.872 1.47 L -1.585 2.026 L -1.019 2.575 L -0.419 2.841 L 0.572 2.841 L 1.24 2.526 L 1.786 1.96 L 2.136 1.245 L 1.687 1.026 L 1.357 1.702 L 0.915 2.144 L 0.515 2.341 L -0.36 2.341 L -0.761 2.144 L -1.202 1.702 L -1.417 1.265 L -1.647 0.579 L -1.647 -0.579 L -1.417 -1.265 L -1.202 -1.702 L -0.761 -2.143 L -0.36 -2.341 L 0.515 -2.341 L 0.915 -2.143 L 1.357 -1.702 L 1.552 -1.302 L 1.552 -0.87 L 0.322 -0.87 L 0.322 -0.37 L 2.052 -0.37 L 2.052 -1.36 L 1.74 -2.026 L 1.171 -2.575 L 0.572 -2.841 Z"},{char:"H",path:"M -1.98 -2.841 L -1.98 2.841 L -1.48 2.841 L -1.48 0.37 L 1.48 0.37 L 1.48 2.841 L 1.98 2.841 L 1.98 -2.841 L 1.48 -2.841 L 1.48 -0.13 L -1.48 -0.13 L -1.48 -2.841 Z"},{char:"I",path:"M -0.3 -2.841 L -0.3 2.841 L 0.3 2.841 L 0.3 -2.841 Z"},{char:"J",path:"M -0.246 -2.841 L -0.854 -2.575 L -1.166 -2.272 L -1.485 -1.36 L -1.485 -0.61 L -0.985 -0.61 L -0.985 -1.319 L -0.766 -1.968 L -0.596 -2.143 L -0.187 -2.341 L 0.188 -2.341 L 0.596 -2.143 L 0.766 -1.968 L 0.985 -1.319 L 0.985 2.841 L 1.485 2.841 L 1.485 -1.36 L 1.166 -2.272 L 0.854 -2.575 L 0.244 -2.841 Z"},{char:"K",path:"M 1.629 -2.942 L -0.578 -0.015 L -1.531 -0.966 L -1.531 -2.843 L -2.031 -2.843 L -2.031 2.839 L -1.531 2.839 L -1.531 -0.259 L 1.678 2.942 L 2.031 2.587 L -0.219 0.343 L 2.027 -2.642 Z"},{char:"L",path:"M -1.73 -2.841 L -1.73 2.841 L -1.23 2.841 L -1.23 -2.341 L 1.73 -2.341 L 1.73 -2.841 Z"},{char:"M",path:"M -2.225 -2.791 L -2.225 2.641 L -1.777 2.791 L 0.004 0.463 L 1.776 2.791 L 2.225 2.641 L 2.225 -2.791 L 1.725 -2.791 L 1.725 1.899 L 0.204 -0.101 L -0.193 -0.101 L -1.725 1.901 L -1.725 -2.791 Z"},{char:"N",path:"M -1.98 -2.841 L -1.98 2.591 L -1.523 2.73 L 1.48 -1.765 L 1.48 2.841 L 1.98 2.841 L 1.98 -2.591 L 1.523 -2.729 L -1.48 1.763 L -1.48 -2.841 Z"},{char:"O",path:"M -0.495 -2.828 L -1.095 -2.562 L -1.661 -2.013 L -1.948 -1.457 L -2.212 -0.687 L -2.212 0.713 L -1.962 1.454 L -1.708 1.973 L -1.161 2.539 L -0.604 2.827 L 0.607 2.827 L 1.164 2.539 L 1.664 2.039 L 1.951 1.483 L 2.212 0.713 L 2.212 -0.687 L 1.951 -1.457 L 1.664 -2.013 L 1.095 -2.562 L 0.496 -2.828 Z M -0.436 -2.328 L 0.439 -2.328 L 0.839 -2.13 L 1.281 -1.689 L 1.494 -1.252 L 1.726 -0.566 L 1.726 0.592 L 1.494 1.278 L 1.281 1.715 L 0.839 2.157 L 0.439 2.354 L -0.434 2.354 L -0.837 2.157 L -1.278 1.715 L -1.493 1.278 L -1.723 0.592 L -1.723 -0.566 L -1.493 -1.252 L -1.278 -1.689 L -0.837 -2.13 Z"},{char:"P",path:"M -1.98 -2.841 L -1.98 2.841 L 0.49 2.841 L 1.308 2.587 L 1.704 2.212 L 1.98 1.601 L 1.98 0.86 L 1.658 0.192 L 1.308 -0.118 L 0.49 -0.37 L -1.48 -0.37 L -1.48 -2.841 Z M -1.48 0.13 L 0.45 0.13 L 1.095 0.339 L 1.275 0.519 L 1.48 0.921 L 1.48 1.54 L 1.275 1.952 L 1.095 2.13 L 0.45 2.341 L -1.48 2.341 Z"},{char:"Q",path:"M 1.748 -2.891 L 1.213 -2.424 L 1.094 -2.524 L 0.495 -2.79 L -0.496 -2.79 L -1.096 -2.524 L -1.709 -1.909 L -1.963 -1.389 L -2.225 -0.569 L -2.225 0.671 L -1.949 1.521 L -1.662 2.077 L -1.096 2.626 L -0.496 2.892 L 0.495 2.892 L 1.163 2.577 L 1.709 2.011 L 1.961 1.492 L 2.225 0.671 L 2.225 -0.569 L 1.961 -1.389 L 1.709 -1.909 L 1.567 -2.071 L 2.079 -2.514 Z M -0.437 -2.29 L 0.438 -2.29 L 0.834 -2.094 L -0.107 -1.274 L 0.221 -0.897 L 1.19 -1.741 L 1.493 -1.214 L 1.725 -0.528 L 1.725 0.63 L 1.493 1.316 L 1.28 1.753 L 0.838 2.195 L 0.438 2.392 L -0.435 2.392 L -0.838 2.195 L -1.279 1.753 L -1.494 1.316 L -1.725 0.63 L -1.725 -0.528 L -1.494 -1.214 L -1.279 -1.651 L -0.838 -2.092 Z"},{char:"R",path:"M 1.606 -2.888 L -0.185 -0.083 L -1.527 -0.083 L -1.527 -2.795 L -2.027 -2.795 L -2.027 2.888 L 0.442 2.888 L 1.26 2.633 L 1.656 2.258 L 1.932 1.647 L 1.932 1.157 L 1.654 0.553 L 1.262 0.18 L 0.408 -0.083 L 2.027 -2.62 Z M -1.527 0.417 L 0.401 0.417 L 1.047 0.635 L 1.227 0.816 L 1.432 1.218 L 1.432 1.587 L 1.227 1.998 L 1.047 2.176 L 0.402 2.388 L -1.527 2.388 Z"},{char:"S",path:"M -0.501 -2.841 L -1.317 -2.589 L -2.083 -1.847 L -1.727 -1.497 L -1.104 -2.132 L -0.46 -2.341 L 0.45 -2.341 L 1.095 -2.13 L 1.48 -1.747 L 1.48 -1.171 L 1.275 -0.768 L 1.081 -0.575 L 0.644 -0.35 L -0.819 0.132 L -1.417 0.442 L -1.704 0.749 L -1.979 1.36 L -1.979 1.851 L -1.909 2.025 L -1.317 2.587 L -0.501 2.841 L 0.49 2.841 L 1.408 2.526 L 2.083 1.851 L 1.73 1.497 L 1.095 2.13 L 0.45 2.341 L -0.46 2.341 L -1.104 2.132 L -1.479 1.747 L -1.479 1.419 L -1.274 1.009 L -1.093 0.825 L -0.645 0.601 L 0.818 0.118 L 1.343 -0.147 L 1.658 -0.442 L 1.98 -1.11 L 1.98 -1.85 L 1.908 -2.026 L 1.308 -2.589 L 0.49 -2.841 Z"},{char:"T",path:"M -0.251 -2.841 L -0.251 2.341 L -1.98 2.341 L -1.98 2.841 L 1.98 2.841 L 1.98 2.341 L 0.249 2.341 L 0.249 -2.841 Z"},{char:"U",path:"M -0.327 -2.834 L -1.169 -2.531 L -1.718 -1.938 L -1.98 -1.117 L -1.98 2.834 L -1.48 2.834 L -1.48 -1.076 L -1.261 -1.723 L -0.855 -2.139 L -0.21 -2.348 L 0.21 -2.348 L 0.855 -2.139 L 1.261 -1.723 L 1.48 -1.076 L 1.48 2.834 L 1.98 2.834 L 1.98 -1.117 L 1.716 -1.938 L 1.169 -2.531 L 0.327 -2.834 Z"},{char:"V",path:"M -0.227,-2.796 L -2.298,2.617 L -1.831,2.796 L 0.005,-2.007 L 1.831,2.796 L 2.298,2.618 L 0.24,-2.796 Z"},{char:"W",path:"M -1.002 -2.78 L -1.483 -2.758 L -2.772 2.663 L -2.283 2.78 L -1.2 -1.79 L -0.237 1.097 L 0.238 1.097 L 1.193 -1.788 L 2.285 2.78 L 2.772 2.663 L 1.472 -2.758 L 0.992 -2.78 L 0 0.226 Z"},{char:"X",path:"M -1.661,-2.936 L -2.077,-2.659 L -0.301,-0.002 L -2.077,2.659 L -1.661,2.937 L 0.001,0.45 L 1.661,2.937 L 2.077,2.659 L 0.302,-0.002 L 2.077,-2.659 L 1.661,-2.936 L 0.001,-0.45 Z"},{char:"Y",path:"M -0.247 -2.891 L -0.247 -0.018 L -2.326 2.578 L -1.938 2.891 L 0.003 0.471 L 1.935 2.891 L 2.326 2.58 L 0.253 -0.018 L 0.253 -2.891 Z"},{char:"Z",path:"M -1.73 -2.841 L -1.939 -2.452 L 1.263 2.341 L -1.98 2.341 L -1.98 2.841 L 1.73 2.841 L 1.939 2.45 L -1.263 -2.341 L 1.98 -2.341 L 1.98 -2.841 Z"}];var Hae=[{char:"A",path:"M -0.873 -1.52 L -1.248 -1.371 L -0.185 1.52 L 0.188 1.52 L 1.248 -1.371 L 0.875 -1.52 L 0.524 -0.558 L -0.521 -0.558 Z M -0.367 -0.142 L 0.37 -0.142 L 0 0.864 Z"},{char:"B",path:"M -1.054 -1.495 L -1.054 1.495 L 0.257 1.495 L 0.689 1.367 L 0.89 1.189 L 1.054 0.893 L 1.052 0.462 L 0.923 0.216 L 0.786 0.064 L 0.923 -0.091 L 1.052 -0.334 L 1.054 -0.891 L 0.89 -1.188 L 0.689 -1.364 L 0.257 -1.495 Z M -0.653 -1.094 L 0.224 -1.094 L 0.517 -0.998 L 0.677 -0.75 L 0.677 -0.479 L 0.517 -0.233 L 0.224 -0.139 L -0.653 -0.139 Z M -0.653 0.26 L 0.224 0.26 L 0.515 0.359 L 0.677 0.605 L 0.677 0.752 L 0.517 1.002 L 0.224 1.095 L -0.653 1.095 Z"},{char:"C",path:"M -0.219 -1.495 L -0.611 -1.315 L -0.898 -1.012 L -1.029 -0.741 L -1.158 -0.309 L -1.158 0.31 L -1.019 0.768 L -0.861 1.067 L -0.555 1.357 L -0.219 1.495 L 0.272 1.495 L 0.662 1.317 L 0.951 1.013 L 1.158 0.589 L 0.799 0.413 L 0.606 0.808 L 0.404 1.01 L 0.225 1.095 L -0.174 1.095 L -0.352 1.01 L -0.555 0.808 L -0.652 0.605 L -0.76 0.279 L -0.76 -0.278 L -0.652 -0.604 L -0.555 -0.807 L -0.352 -1.008 L -0.174 -1.094 L 0.225 -1.094 L 0.404 -1.008 L 0.606 -0.807 L 0.799 -0.411 L 1.158 -0.588 L 0.951 -1.012 L 0.607 -1.354 L 0.272 -1.495 Z"},{char:"D",path:"M -1.065 -1.495 L -1.065 1.495 L -0.006 1.495 L 0.057 1.486 L 0.428 1.367 L 0.506 1.317 L 0.755 1.067 L 0.795 1.013 L 0.915 0.768 L 0.925 0.748 L 1.055 0.377 L 1.065 0.31 L 1.065 -0.309 L 1.055 -0.375 L 0.925 -0.745 L 0.915 -0.766 L 0.795 -1.012 L 0.755 -1.065 L 0.506 -1.315 L 0.428 -1.364 L 0.057 -1.485 L -0.006 -1.495 Z M -0.664 -1.094 L -0.037 -1.094 L 0.258 -0.998 L 0.449 -0.807 L 0.551 -0.603 L 0.666 -0.276 L 0.666 0.276 L 0.551 0.603 L 0.449 0.808 L 0.258 1.002 L -0.037 1.095 L -0.664 1.095 Z"},{char:"E",path:"M -1 -1.495 L -1 1.495 L 1 1.495 L 1 1.095 L -0.6 1.095 L -0.6 0.26 L 0.39 0.26 L 0.39 -0.139 L -0.6 -0.139 L -0.6 -1.094 L 1 -1.094 L 1 -1.495 Z"},{char:"F",path:"M -1.005 -1.495 L -1.005 1.495 L 1.005 1.495 L 1.005 1.095 L -0.605 1.095 L -0.605 0.26 L 0.385 0.26 L 0.385 -0.139 L -0.605 -0.139 L -0.605 -1.495 Z"},{char:"G",path:"M -0.22 -1.495 L -0.61 -1.315 L -0.9 -1.012 L -1.03 -0.741 L -1.16 -0.309 L -1.16 0.31 L -1.02 0.768 L -0.86 1.067 L -0.56 1.357 L -0.22 1.495 L 0.27 1.495 L 0.61 1.357 L 0.95 1.013 L 1.16 0.589 L 0.8 0.413 L 0.61 0.808 L 0.4 1.01 L 0.22 1.095 L -0.17 1.095 L -0.35 1.01 L -0.55 0.808 L -0.65 0.605 L -0.76 0.279 L -0.76 -0.278 L -0.65 -0.604 L -0.55 -0.807 L -0.35 -1.008 L -0.17 -1.094 L 0.22 -1.094 L 0.4 -1.008 L 0.61 -0.807 L 0.69 -0.633 L 0.69 -0.508 L 0.07 -0.508 L 0.07 -0.111 L 1.09 -0.111 L 1.09 -0.679 L 1.07 -0.766 L 0.91 -1.065 L 0.61 -1.354 L 0.27 -1.495 Z"},{char:"H",path:"M -1.065 -1.495 L -1.065 1.495 L -0.665 1.495 L -0.665 0.26 L 0.665 0.26 L 0.665 1.495 L 1.065 1.495 L 1.065 -1.495 L 0.665 -1.495 L 0.665 -0.139 L -0.665 -0.139 L -0.665 -1.495 Z"},{char:"I",path:"M -0.2 -1.495 L -0.2 1.495 L 0.2 1.495 L 0.2 -1.495 Z"},{char:"J",path:"M -0.125 -1.495 L -0.215 -1.475 L -0.465 -1.354 L -0.525 -1.313 L -0.635 -1.188 L -0.685 -1.11 L -0.805 -0.741 L -0.815 -0.679 L -0.815 -0.229 L -0.415 -0.229 L -0.415 -0.647 L -0.315 -0.944 L -0.255 -1.01 L -0.075 -1.094 L 0.075 -1.094 L 0.255 -1.01 L 0.315 -0.944 L 0.415 -0.647 L 0.415 1.495 L 0.815 1.495 L 0.815 -0.679 L 0.805 -0.741 L 0.685 -1.11 L 0.645 -1.188 L 0.515 -1.313 L 0.465 -1.354 L 0.215 -1.475 L 0.125 -1.495 Z"},{char:"K",path:"M 0.785 -1.555 L -0.305 -0.117 L -0.705 -0.505 L -0.705 -1.491 L -1.105 -1.491 L -1.105 1.497 L -0.705 1.497 L -0.705 0.049 L 0.825 1.555 L 1.105 1.275 L -0.025 0.165 L 1.105 -1.318 Z"},{char:"L",path:"M -0.94 -1.495 L -0.94 1.495 L -0.54 1.495 L -0.54 -1.094 L 0.94 -1.094 L 0.94 -1.495 Z"},{char:"M",path:"M -1.19 -1.515 L -1.19 1.388 L -0.83 1.515 L 0 0.385 L 0.83 1.515 L 1.19 1.388 L 1.19 -1.515 L 0.79 -1.515 L 0.79 0.774 L 0.16 -0.085 L -0.16 -0.085 L -0.79 0.774 L -0.79 -1.515 Z"},{char:"N",path:"M -1.065 -1.496 L -1.065 1.416 L -0.695 1.539 L 0.665 -0.696 L 0.665 1.492 L 1.065 1.492 L 1.065 -1.416 L 0.695 -1.539 L -0.665 0.694 L -0.665 -1.496 Z"},{char:"O",path:"M -0.245 -1.495 L -0.585 -1.354 L -0.885 -1.065 L -1.045 -0.766 L -1.175 -0.371 L -1.175 0.373 L -1.045 0.768 L -0.885 1.067 L -0.585 1.357 L -0.245 1.495 L 0.245 1.495 L 0.585 1.357 L 0.885 1.067 L 1.045 0.768 L 1.175 0.373 L 1.175 -0.371 L 1.045 -0.766 L 0.885 -1.065 L 0.585 -1.354 L 0.245 -1.495 Z M -0.205 -1.094 L 0.205 -1.094 L 0.375 -1.008 L 0.575 -0.807 L 0.675 -0.604 L 0.785 -0.278 L 0.785 0.279 L 0.675 0.605 L 0.575 0.808 L 0.375 1.01 L 0.205 1.095 L -0.205 1.095 L -0.375 1.01 L -0.575 0.808 L -0.675 0.605 L -0.785 0.279 L -0.785 -0.278 L -0.675 -0.604 L -0.575 -0.807 L -0.375 -1.008 Z"},{char:"P",path:"M -1.065 -1.495 L -1.065 1.495 L 0.245 1.495 L 0.305 1.486 L 0.675 1.367 L 0.755 1.319 L 0.885 1.195 L 0.925 1.138 L 1.045 0.888 L 1.065 0.8 L 1.065 0.431 L 1.045 0.343 L 0.925 0.097 L 0.885 0.042 L 0.755 -0.083 L 0.675 -0.129 L 0.305 -0.248 L 0.245 -0.258 L -0.665 -0.258 L -0.665 -1.495 Z M -0.665 0.139 L 0.215 0.139 L 0.515 0.238 L 0.585 0.306 L 0.665 0.478 L 0.665 0.755 L 0.585 0.931 L 0.515 1 L 0.215 1.095 L -0.665 1.095 Z"},{char:"Q",path:"M 0.88 -1.536 L 0.6 -1.293 L 0.25 -1.454 L -0.25 -1.454 L -0.58 -1.311 L -0.88 -1.024 L -1.04 -0.726 L -1.18 -0.334 L -1.18 0.417 L -1.04 0.809 L -0.88 1.108 L -0.58 1.395 L -0.25 1.536 L 0.25 1.536 L 0.58 1.395 L 0.88 1.108 L 1.04 0.809 L 1.18 0.417 L 1.18 -0.334 L 1.04 -0.726 L 0.89 -1.014 L 1.14 -1.234 Z M -0.2 -1.053 L 0.2 -1.053 L 0.28 -1.014 L -0.16 -0.627 L 0.1 -0.328 L 0.59 -0.748 L 0.79 -0.236 L 0.79 0.317 L 0.67 0.643 L 0.58 0.849 L 0.37 1.051 L 0.2 1.135 L -0.2 1.135 L -0.37 1.051 L -0.58 0.849 L -0.67 0.643 L -0.79 0.317 L -0.79 -0.236 L -0.58 -0.766 L -0.37 -0.97 Z"},{char:"R",path:"M 0.765 -1.533 L -0.155 -0.101 L -0.705 -0.101 L -0.705 -1.457 L -1.105 -1.457 L -1.105 1.534 L 0.205 1.534 L 0.265 1.524 L 0.635 1.405 L 0.715 1.352 L 0.835 1.227 L 0.875 1.182 L 1.005 0.932 L 1.025 0.838 L 1.025 0.594 L 1.005 0.5 L 0.875 0.254 L 0.835 0.211 L 0.715 0.086 L 0.635 0.034 L 0.305 -0.078 L 1.105 -1.316 Z M -0.705 0.299 L 0.175 0.299 L 0.465 0.397 L 0.535 0.467 L 0.625 0.643 L 0.625 0.79 L 0.525 0.971 L 0.465 1.04 L 0.175 1.133 L -0.705 1.133 Z"},{char:"S",path:"M -0.255 -1.495 L -0.725 -1.344 L -1.145 -0.918 L -0.855 -0.641 L -0.515 -0.998 L -0.225 -1.094 L 0.215 -1.094 L 0.505 -0.998 L 0.665 -0.84 L 0.665 -0.604 L 0.495 -0.349 L 0.285 -0.245 L -0.435 -0.004 L -0.715 0.131 L -0.885 0.288 L -0.995 0.486 L -1.065 0.681 L -1.065 0.925 L -1.005 1.064 L -0.685 1.367 L -0.255 1.495 L 0.245 1.495 L 0.755 1.317 L 1.145 0.925 L 0.865 0.643 L 0.505 1.002 L 0.215 1.095 L -0.225 1.095 L -0.515 1.002 L -0.665 0.845 L -0.665 0.726 L -0.585 0.548 L -0.505 0.476 L -0.295 0.371 L 0.425 0.13 L 0.705 -0.004 L 0.875 -0.171 L 1.065 -0.554 L 1.065 -0.924 L 1.005 -1.065 L 0.675 -1.364 L 0.245 -1.495 Z"},{char:"T",path:"M -0.205 -1.495 L -0.205 1.095 L -1.065 1.095 L -1.065 1.495 L 1.065 1.495 L 1.065 1.095 L 0.195 1.095 L 0.195 -1.495 Z"},{char:"U",path:"M -0.125 -1.495 L -0.185 -1.485 L -0.555 -1.364 L -0.635 -1.315 L -0.885 -1.065 L -0.935 -0.985 L -1.055 -0.616 L -1.065 -0.554 L -1.065 1.495 L -0.665 1.495 L -0.665 -0.522 L -0.565 -0.817 L -0.385 -0.998 L -0.095 -1.094 L 0.095 -1.094 L 0.385 -0.998 L 0.565 -0.817 L 0.665 -0.52 L 0.665 1.495 L 1.065 1.495 L 1.065 -0.554 L 1.055 -0.62 L 0.925 -0.991 L 0.875 -1.063 L 0.635 -1.313 L 0.555 -1.364 L 0.185 -1.485 L 0.125 -1.495 Z"},{char:"V",path:"M -0.185 -1.527 L -1.245 1.378 L -0.875 1.527 L 0.005 -0.865 L 0.865 1.527 L 1.245 1.378 L 0.195 -1.527 Z"},{char:"W",path:"M -0.425 -1.52 L -0.805 -1.501 L -1.475 1.423 L -1.085 1.52 L -0.585 -0.689 L -0.185 0.566 L 0.195 0.566 L 0.585 -0.681 L 1.085 1.52 L 1.475 1.423 L 0.805 -1.501 L 0.425 -1.518 L 0.005 -0.169 Z"},{char:"X",path:"M -0.805 -1.573 L -1.145 -1.352 L -0.245 0 L -1.145 1.349 L -0.805 1.572 L 0.005 0.361 L 0.805 1.572 L 1.145 1.349 L 0.245 0 L 1.145 -1.352 L 0.805 -1.573 L 0.005 -0.362 Z"},{char:"Y",path:"M -0.2 -1.536 L -0.2 -0.049 L -1.27 1.286 L -0.96 1.536 L 0 0.339 L 0.96 1.536 L 1.27 1.286 L 0.2 -0.049 L 0.2 -1.536 Z"},{char:"Z",path:"M -0.865 -1.495 L -1.035 -1.182 L 0.495 1.095 L -1.065 1.095 L -1.065 1.495 L 0.865 1.495 L 1.035 1.185 L -0.495 -1.094 L 1.065 -1.094 L 1.065 -1.495 Z"}];var NWe=13.2,kWe=11.2,l3e=[{name:"Rect",path:"M 6 -6 L -6 -6 L -6 6 L 6 6 Z M 5 -5 L 5 5 L -5 5 L -5 -5 Z",hole:1},{name:"Circle",path:"M 0 -5.5 C 3.033 -5.5 5.5 -3.033 5.5 0 C 5.5 3.036 3.033 5.5 0 5.5 C -3.033 5.5 -5.5 3.036 -5.5 0 C -5.5 -3.033 -3.033 -5.5 0 -5.5 M 0 -6.6 C -3.645 -6.6 -6.6 -3.645 -6.6 0 C -6.6 3.641 -3.645 6.6 0 6.6 C 3.645 6.6 6.6 3.641 6.6 0 C 6.6 -3.645 3.645 -6.6 0 -6.6 Z",hole:1},{name:"Triangle",path:"M -7.277 5.153 L 7.277 5.153 L 0 -8.118 Z M -5.693 4.158 L 0 -5.859 L 5.705 4.158 Z",hole:1},{name:"Star6",path:"M 2.586 4.476 L 6.397 3.701 L 5.171 0 L 6.397 -3.687 L 2.586 -4.462 L 0 -7.373 L -2.573 -4.462 L -6.398 -3.687 L -5.158 0 L -6.398 3.687 L -2.573 4.476 L 0 7.373 Z M -0.01 5.86 L -1.93 3.68 L -5.09 2.93 L -4.15 -0.16 L -5.09 -2.94 L -1.93 -3.68 L -0.01 -5.87 L 1.93 -3.68 L 5.09 -2.94 L 4.16 0.15 L 5.09 2.94 L 1.93 3.67 Z",hole:1},{name:"Star4",path:"M -6.68 6.68 L 0 4.34 L 6.68 6.68 L 4.34 0 L 6.68 -6.68 L 0 -4.34 L -6.523 -6.68 L -4.34 0 Z M 5 -5 L 3.24 0 L 5 5 L 0 3.24 L -5 5 L -3.24 0 L -5 -5 L 0 -3.24 Z",hole:1},{name:"Plus",path:"M 3.72 -6 L -3.72 -6 L -3.72 -3.72 L -6 -3.72 L -6 3.72 L -3.72 3.72 L -3.72 6 L 3.72 6 L 3.72 3.72 L 6 3.72 L 6 -3.72 L 3.72 -3.72 Z M 2.72 -5 L 2.72 -2.72 L 5 -2.72 L 5 2.72 L 2.72 2.72 L 2.72 5 L -2.72 5 L -2.72 2.72 L -5 2.72 L -5 -2.72 L -2.72 -2.72 L -2.72 -5 Z",hole:1},{name:"X",path:"M 6 -6 L 1.636 -6 L 0 -4.364 L -1.636 -6 L -6 -6 L -6 -1.636 L -4.364 0 L -6 1.636 L -6 6 L -1.636 6 L 0 4.364 L 1.636 6 L 6 6 L 6 1.636 L 4.364 0 L 6 -1.636 Z M 5.004 -4.992 L 5.004 -2.054 L 2.938 0.002 L 5.004 2.054 L 5.004 4.995 L 2.054 4.995 L 0 2.938 L -2.054 4.995 L -5.004 4.995 L -5.004 2.054 L -2.938 0.002 L -5.004 -2.054 L -5.004 -4.992 L -2.054 -4.992 L 0 -2.938 L 2.054 -4.992 Z",hole:1},{name:"Diamond",path:"M 0 -7.8 L -7.8 0 L 0 7.8 L 7.8 0 Z M 0 -6.103 L 6.103 0 L 0 6.108 L -6.103 0 Z",hole:1},{name:"Rect2",path:"M 6 -6 L -6 -6 L -6 6 L -5.004 4.995 L -5 -5 L 5.004 -5 Z M 6 -6 L 5.004 -5 L 5.004 4.995 L -5.004 4.995 L -6 6 L 6 6 Z M 4.004 -4 L -4 -4 L -4 4.004 L -3 3.004 L -3 -3 L 3.004 -3 Z M 4.004 -4 L 3.004 -3 L 3.004 3.004 L -3 3.004 L -4 4.004 L 4.004 4.004 Z",hole:0}];function BWe(o,t,e){let{iconIndex:r,charIndex:i,char:n,hasIcon:s,hasChar:a,smallChar:l}=C_t(t),c=[];if(s){let{apertureKey:h}=f3e(r);if(!o.existApertureDefinition(h)){let u=o.getNewApertureNumber(),d="D"+u,{apertureDefinition:p,apertureMacro:m}=T_t(r,e,void 0,u);m&&o.addMacroBlock(m),o.addApertureBlock(p,h),c.push(d)}}if(a){let{apertureKey:h}=m3e(i,l);if(!o.existApertureDefinition(h)){let u=o.getNewApertureNumber(),d="D"+u,{apertureDefinition:p,apertureMacro:m}=I_t(i,l,e,void 0,u);m&&o.addMacroBlock(m),o.addApertureBlock(p,h),c.push(d)}}return c}function T_t(o,t="mm",e=6,r){let{apertureType:i,macroName:n}=f3e(o),s=S_t(o,t,e),a=new Eg(r,i),l;return n?l=new dT(n,s):a.appendModifier(s),{apertureDefinition:a,apertureMacro:l}}function I_t(o,t,e="mm",r=6,i){let{apertureType:n,macroName:s}=m3e(o,t),a=E_t(o,t,e,r),l=new Eg(i,n),c=new dT(s,a);return{apertureDefinition:l,apertureMacro:c}}function C_t(o){if(typeof o!="number"||o<0)throw new Error("markIndex is invalid");o=o%269;let t=l3e.length,e=Uae.length,r=Hae.length,i,n,s=!1,a=!1,l=!1,c="";if(o<t)i=o,s=!0;else if(o<t+e)n=o-t,a=!0,c=Uae[n].char;else{let h=o-t-e;n=h%r,i=Math.floor(h/r),s=!0,a=!0,l=!0,c=Hae[n].char}return{iconIndex:i,charIndex:n,char:c,hasIcon:s,hasChar:a,smallChar:l}}function FWe(o="mm"){return(o.toLowerCase()=="mm"?.4:.01575)/12}function f3e(o){let{name:t,path:e,hole:r}=l3e[o]||{};if(!t)throw new Error("icon not exists");let i="Icon"+t,n=t=="Circle"?"":"Icon"+t,s=t=="Circle"?"C":n;return{name:t,path:e,hole:r,apertureType:s,apertureKey:i,macroName:n}}function m3e(o,t){let{char:e,path:r}=(t?Hae:Uae)[o]||{};if(!e)throw new Error("char not exists");let i="Char"+e+(t?"s":"");return{char:e,name:i,path:r,apertureType:i,apertureKey:i,macroName:i}}function S_t(o,t="mm",e=6){let{name:r,path:i,hole:n}=f3e(o),s=FWe(t)*1.4;if(r=="Circle")return u3e(d3e([NWe,kWe],s),e).join("X");if(n){let a=p3e(i),l={outline:a[0],holes:a.length?a.slice(1):void 0};return VWe([l],s,e)}else{let a=p3e(i),l=u=>u3e(d3e(u,s),e);return a.map(h3e).map(l).map(u=>c3e(u,1)).join("*")}}function E_t(o,t,e="mm",r=6){let{path:i}=m3e(o,t),n=FWe(e)*2*1.4*2,s=p3e(i),a={outline:s[0],holes:s.length?s.slice(1):void 0};return VWe([a],n,r)}function O_t(o){return o.map(({outline:t,holes:e})=>({outline:h3e(t),holes:e?e.map(h3e):void 0}))}function VWe(o,t=1,e=2){let r=O_t(o);return A_t(r,t,e)}function A_t(o,t=1,e=2){let r=[];for(let n of o)if(r.push(...n.outline),n.holes)for(let s of n.holes)r.push(...s);r=d3e(r,t),r=u3e(r,e);let i=[];for(let n of o){let s=r.splice(0,n.outline.length),a=c3e(s,1);if(i.push(a),n.holes)for(let l of n.holes){let c=r.splice(0,l.length),h=c3e(c,0);i.push(h)}}return i.join("*")}function c3e(o,t=1){let e=o.length;(o[0]!=o[e-2]||o[1]!=o[e-1])&&(o=o.concat(o[0],o[1]));let r=o.length/2-1;return`4,${t?1:0},${r},${o.join(",")},0`}function h3e(o){if(/[a-yHVA]/.test(o))throw new Error("not support this path");return[...o.match(/-?\d+(?:\.\d+)?/g)].map(Number)}function __t(o,t=6){return+o.toFixed(t)}function u3e(o,t=6){return o.map(e=>__t(e,t))}function d3e(o,t=1){return o.map(e=>e*t)}function p3e(o){return o.slice(1).split("M").map(t=>"M "+t.trim())}var zX=class zX{constructor(){this.documentMap={};this.elementUsedLayerMap={};this.commentStartLayerMap={};this.fpcDocumentMap={};this.colorSilkMarkDocumentMap={};this.drillMap=[];this.generateElementOffsets=[];this.drillLayerMap={};this.fpcLayerNameMap={};this._unit="MM";this._integerPlaces=4;this._decimalPlaces=2;this.saveUUID=!1;this.useCircleInsteadOfSquareDrill=!0;this.released=!1;this.fileUuid="";this.userUuid="";this.ignoreHash=!1;this.isImportedPCBDoc=!1;this.layerIds=null;this.layerConfigs=null;this.objectConfigs=null;this.stepRepeatConfig=Oae;this.stepRepeatParameterOpened=!1;this.useOldBool=!1;this.origin=S.ORIGIN;this.colorSilkMark=[];this.colorSilkBoard={};this.polygonDataArrForColorSilkBoard=[];this.rectsDataArrForColorSilkBoard=[];this.circlesDataArrForColorSilkBoard=[];this.quickPanelizeEnabled=!0;this.uniquePadsTable=[];this.originOffset=new S(0,0);this.drillDocumentMap={PTH:new UA,NPTH:new UA,PTH_Via:new UA}}get unitName(){return this._unit=="IN"?"inches":"millimeters"}get unit(){return this._unit}set unit(t){this._unit=t}get integerPlaces(){return this._integerPlaces}set integerPlaces(t){this._integerPlaces=t}get decimalPlaces(){return this._decimalPlaces}set decimalPlaces(t){this._decimalPlaces=t}createDocumentMap(){let t=this.layerIds;this.docLayerIds=t.slice();let e=new UX;e.leftLength=this.integerPlaces,e.rightLength=this.decimalPlaces,e.unit=this.unit,this.formatter=e;for(let r of t)r==58||r==59||(this.documentMap[r]=new WA(r),this.documentMap[r].setFormatter(e),this.generateHeader(r));this.addColorSilkDocument()}createPanelize(){let t=this.originOffset,e=si.getInstance(),r=e.items.concat(e.outlines),i=(s,a)=>{this.autoCommentStart("Panelize",s,a)},n=this.getMatrix(11,t);for(let s of r){let a;a=s.layerId;let l=ar(a);if(s instanceof hs){if(!l&&!this.isUsedLayerId(a))continue;let c=this.getRealDoc(a);if(!c)continue;a==11&&(this.colorSilkBoard.panelizeLine||(this.colorSilkBoard.panelizeLine=[]),this.colorSilkBoard.panelizeLine.push(s));let h=s.primitive,u=ge.build2([h]);if(!u)continue;let d=u.multiply3(n);i(a,c);let p=c.getApertureCircle(1);c.useAperture(p);let m=ui.polygonLine(d);c.addBlock(m)}if(s instanceof Li){if(!l&&!this.isUsedLayerId(a))continue;let c=this.getRealDoc(a);if(!c)continue;let{strokeWidth:h,fontFamily:u,key:d,value:p,showKey:m,showValue:g}=s;if(!m&&!g)continue;let y,b=[];y=s.getRealOutline();for(let P of y)P instanceof Cp?P.pl=P.pl.multiply3(n):P=P.multiply3(n),b.push(P);if(!(b!=null&&b.length))continue;if(i(a,c),u=="default"||u==""){let P=c.getApertureCircle(h);c.useAperture(P);for(let T of b)if(T instanceof ge){let I=ui.polygonLine(T);c.addBlock(I)}}else{if(b.some(_=>_ instanceof Cp&&!_.flag)){let _=new Map,x=[];for(let w of b)_.has(w.order)?_.get(w.order).push(w.pl):(_.set(w.order,[w.pl]),x.push(1));let v=Array.from(_.values()),D=KI(v,x);for(let w of D){let F=ui.rawPolygonFill(w);c.addBlock(F)}continue}let T=()=>c.addBlock(tp.PolarityDark),I=()=>c.addBlock(tp.PolarityClear),C=!0,O=!!1;for(let _ of b)if(_ instanceof Cp){let x=_.flag===O;C!==x&&(C=x,x?T():I());let v=ui.polygonFill(_.pl);c.addBlock(v)}C||T()}}if(s instanceof et){let c=(h,u)=>{this.autoCommentStart("Panelize",u);let d=this.getRealDoc(u);if(!d)return;let{center:p,pasteExpansion:m,topSolderExpansion:g,bottomSolderExpansion:y}=h,b=d.layerId,P=7,T=8,I=5,C=6,{top:E,bottom:O}=h,_=0,x=[1,5,7].includes(u)?E:O;switch(b){case P:case T:_=m;break;case I:_=g;break;case C:_=y;break}switch(x.type){case"ELLIPSE":{let v=x.width+_*2;if(v<=0)break;let D=d.getApertureCircle(v);d.useAperture(D),p=p.multiply3(n);let w=ui.flashAt(p);d.addBlock(w);break}}};if(!l&&!this.isUsedLayerId(a))continue;(l||ao(a))&&(c(s,1),c(s,5),l||c(s,7)),(l||2==a)&&(c(s,2),c(s,6),l||c(s,8))}if(s instanceof yo)if(s.type=="Slot Region"){let c=!1,h=s.radius*2,u=s.center;if(h<=0)continue;this.autoCommentStart("Panelize",a);let d=new WA(a),p=d.getApertureCircle(h);d.useAperture(p),u=u.multiply3(n);let m=ui.flashAt(u);d.addBlock(m),this.addDrillCircle(c,h,u)}else{if(!this.isUsedLayerId(a))continue;let c=this.getRealDoc(a,s.type);if(!c)continue;a==11&&(this.colorSilkBoard.panelizeCircle||(this.colorSilkBoard.panelizeCircle=[]),this.colorSilkBoard.panelizeCircle.push(s));let{center:h,radius:u,strokeWidth:d}=s;i(a,c);let p=c.getApertureCircle(d);c.useAperture(p),h=h.multiply3(n);let m=ui.circleLine(h,u);c.addBlock(m)}if(s instanceof Va){if(!l&&!this.isUsedLayerId(a))continue;let c=this.getRealDoc(a);if(!c)continue;this.colorSilkBoard.panelizeArc||(this.colorSilkBoard.panelizeArc=[]),this.colorSilkBoard.panelizeArc.push(s);let h=s.primitive,u=new Array;if(s.length>1e-8&&s.end.distance1(s.start)<.1&&s.getAngle()>Math.PI){let y=h.sweepAngle/2,b=h.startAngle+y,P=q.build3(h.center,h.startAngle,y,h.rx,h.ry),T=q.build3(h.center,b,y,h.rx,h.ry);u.push(P),u.push(T)}else u.push(h);let d=ge.build2(u);if(!d)continue;let p=d.multiply3(n);i(a,c);let m=c.getApertureCircle(s.width);c.useAperture(m);let g=ui.polygonLine(p);c.addBlock(g)}}if(this.autoCommentEndAllLayer("Panelize"),this.createColorSilkMarkPanelize(),this.stepRepeatParameterOpened=!1,!this.defaultParam.onlyOutline&&this.defaultParam.success){let s=this.defaultParam.offset||new S(0,0),a=this.defaultParam.row,l=this.defaultParam.column;if(this.stepRepeatConfig={column:l,row:a,stepX:s.x,stepY:s.y},this.quickPanelizeEnabled){for(let p of["PTH","NPTH","PTH_Via"]){let m=this.drillDocumentMap[p];m&&m.setPanelizeFlag()}let c=this.docLayerIds,h=new eD([l,a,s.x,s.y]);this.stepRepeatParameterOpened=!0;let u=p=>{p&&(p.addEmptyLine(),p.addParameter(h),p.stepRepeatParameterOpened=!0,p.stepRepeatConfig=this.stepRepeatConfig)};for(let p of c){let m=this.getRealDoc(p);u(m)}let d=this.colorSilkMarkDocumentMap.CSM;d&&u(d)}}}createColorSilkMarkPanelize(){if(!this.colorSilkMark.length)return;let t=this.originOffset,e=this.colorSilkMarkDocumentMap.CSM;e.setFormatter(this.formatter),e.setTargetAsBody();let r=this.getMatrix(11,t);e.addComment("colorScreenSilk_board Start");for(let i in this.colorSilkBoard){let n=this.colorSilkBoard[i];if(i=="panelizeLine"){e.addComment("panelizeLine Start");for(let s of n){let a=s.primitive,l=ge.build2([a]);if(!l)continue;let c=l.multiply3(r),h=e.getApertureCircle(1);e.useAperture(h);let u=ui.polygonLine(c);e.addBlock(u)}e.addComment("panelizeLine End")}if(i=="panelizeCircle"){e.addComment("panelizeCircle Start");for(let s of n){let a=e.getApertureCircle(s.strokeWidth);e.useAperture(a);let l=s.center.multiply3(r),c=ui.circleLine(l,s.radius);e.addBlock(c)}e.addComment("panelizeCircle End")}if(i=="panelizeArc"){e.addComment("panelizeArc Start");for(let s of n){let a=s.primitive,l=new Array;if(s.length>1e-8&&s.end.distance1(s.start)<.1&&s.getAngle()>Math.PI){let p=a.sweepAngle/2,m=a.startAngle+p,g=q.build3(a.center,a.startAngle,p,a.rx,a.ry),y=q.build3(a.center,m,p,a.rx,a.ry);l.push(g),l.push(y)}else l.push(a);let c=ge.build2(l);if(!c)continue;let h=c.multiply3(r),u=e.getApertureCircle(s.width);e.useAperture(u);let d=ui.polygonLine(h);e.addBlock(d)}e.addComment("panelizeArc End")}}}createPanelizeFast(t){let e=this.originOffset,r=this.getMatrix(11,e),i={panelizeLine:[],panelizeCircle:[],panelizeArc:[]},n=(h,u)=>{this.autoCommentStart("Panelize",h,u)},s=h=>h.addBlock(tp.PolarityDark),a=h=>h.addBlock(tp.PolarityClear),l=(h,u)=>{if(!this.isUsedLayerId(u))return;let{width:d,center:p,pasteExpansion:m,topSolderExpansion:g,bottomSolderExpansion:y}=h;this.autoCommentStart("Panelize",u);let b=this.getRealDoc(u);if(!b)return;this.elementUsedLayerMap[u]=!0;let P=b.layerId,T=0;switch(P){case 7:case 8:T=m;break;case 5:T=g;break;case 6:T=y;break}let I=d+T*2;if(I>0){let C=b.getApertureCircle(I);b.useAperture(C);let E=c(p);E=E.multiply3(r);let O=ui.flashAt(E);b.addBlock(O)}},c=h=>new S(h.x,h.y);for(let h of t){let{type:u,layerId:d}=h,p=ar(d);if(u=="line"){if(!p&&!this.isUsedLayerId(d))continue;let m=this.getRealDoc(d);if(!m)continue;this.elementUsedLayerMap[d]=!0,d==11&&i.panelizeLine.push(h);let{start:g,end:y}=h,b=c(g).multiply3(r),P=c(y).multiply3(r);n(d,m);let T=m.getApertureCircle(1);m.useAperture(T);let I=ui.line(b,P);m.addBlock(I)}if(u=="text"){if(!p&&!this.isUsedLayerId(d))continue;let m=this.getRealDoc(d);if(!m)continue;this.elementUsedLayerMap[d]=!0;let g=h,{strokeWidth:y,isOutlineFont:b,hasHole:P,outlinesData:T,outlinesFlag:I,outlinesOrder:C,outlinesGroup:E}=g;if(!T.length)continue;if(n(d,m),b){let D=m.getApertureCircle(y);m.useAperture(D);for(let w of T){let F=im(w),H=ui.polygonLine(F.multiply3(r));m.addBlock(H)}continue}if(P){let D=kS(T),w=new Map,F=[];for(let V=0;V<D.length;V++){let W=D[V].multiply3(r),L=I[V],k=W.area(.1)>0;L==k&&(D[V]=W.reverse()),w.has(E[V])?w.get(E[V]).push(W):(w.set(E[V],[W]),F.push(1))}let H=Array.from(w.values()),z=KI(H,F);for(let V of z){let W=ui.rawPolygonFill(V);m.addBlock(W)}continue}let O=!0,x=!!1,v=-1;for(let D of T){v++;let w=I[v],F=im(D),H=w===x;O!==H&&(O=H,H?s(m):a(m));let z=ui.polygonFill(F);m.addBlock(z)}O||s(m)}if(u=="pad"){let{side:m}=h,g=h;m=="top"?(l(g,1),l(g,5),p||l(g,7)):m=="bottom"&&(l(g,2),l(g,6),p||l(g,8))}if(u=="circle"){let m=h,{layerId:g,isSlot:y,center:b,radius:P,strokeWidth:T}=m;if(!p&&!this.isUsedLayerId(g))continue;if(y){let I=!1,C=P*2,E=c(b);if(C<=0)continue;this.autoCommentStart("Panelize",g);let O=new WA(g);this.elementUsedLayerMap[g]=!0;let _=O.getApertureCircle(C);O.useAperture(_),E=E.multiply3(r);let x=ui.flashAt(E);O.addBlock(x),this.addDrillCircle(I,C,E)}else{if(!p&&!this.isUsedLayerId(g))continue;let I=this.getRealDoc(g);if(!I)continue;this.elementUsedLayerMap[g]=!0,g==11&&i.panelizeCircle.push(h),n(g,I);let C=I.getApertureCircle(T);I.useAperture(C);let E=c(b);E=E.multiply3(r);let O=ui.circleLine(E,P);I.addBlock(O)}}if(u=="arc"){if(!p&&!this.isUsedLayerId(d))continue;let m=this.getRealDoc(d);if(!m)continue;this.elementUsedLayerMap[d]=!0,d==11&&i.panelizeArc.push(h);let g=h,{needSplit:y,width:b,center:P,startAngle:T,sweepAngle:I,rx:C,ry:E}=g,O=c(P),_=new Array;if(y){let F=I/2,H=T+F,z=q.build3(O,T,F,C,E),V=q.build3(O,H,F,C,E);_.push(z,V)}else{let F=q.build3(O,T,I,C,E);_.push(F)}let x=ge.build2(_);if(!x)continue;let v=x.multiply3(r);n(d,m);let D=m.getApertureCircle(b);m.useAperture(D);let w=ui.polygonLine(v);m.addBlock(w)}}this.autoCommentEndAllLayer("Panelize"),this.createColorSilkMarkPanelizeFast(i),this.initStepRepeatConfig(),this.handleSRFlag()}initStepRepeatConfig(){let t=this.defaultParam.offset||new S(0,0),e=this.defaultParam.row,r=this.defaultParam.column;this.stepRepeatConfig={column:r,row:e,stepX:t.x,stepY:t.y}}handleSRFlag(){if(this.stepRepeatParameterOpened=!1,!this.defaultParam.onlyOutline&&this.defaultParam.success&&this.quickPanelizeEnabled){for(let i of["PTH","NPTH","PTH_Via"]){let n=this.drillDocumentMap[i];n&&n.setPanelizeFlag()}let t=this.docLayerIds;this.stepRepeatParameterOpened=!0;let e=(i,n)=>{i&&(i.addEmptyLine(),i.addParameter(n),i.stepRepeatParameterOpened=!0,i.stepRepeatConfig=this.stepRepeatConfig)};for(let i of t){let n=this.getStepRepeat(i),s=this.getGerberLayerDocument(i);e(s,n)}let r=this.colorSilkMarkDocumentMap.CSM;if(r){let i=this.getStepRepeat(11);e(r,i)}}}getStepRepeat(t){let{column:e,row:r,stepX:i,stepY:n}=this.stepRepeatConfig;return this.getLayerIsMirror(t)&&(i=-i),new eD([e,r,i,n])}setOnlyOutLineSlotSR(t){if(this.defaultParam.success&&this.defaultParam.onlyOutline&&this.quickPanelizeEnabled){this.stepRepeatParameterOpened=!1;let e=this.getStepRepeat(t.layerId);this.stepRepeatParameterOpened=!0,t&&(t.addEmptyLine(),t.addParameter(e),t.stepRepeatParameterOpened=!0,t.stepRepeatConfig=this.stepRepeatConfig)}}closeOnlyOutLineSlotSR(t){if(this.defaultParam.success&&this.stepRepeatParameterOpened&&this.defaultParam.onlyOutline){let e=new eD;t&&t.stepRepeatParameterOpened&&(t.addParameter(e),t.stepRepeatParameterOpened=!1)}}setOnlyOutLineCircleSlotSR(t){this.defaultParam.success&&this.defaultParam.onlyOutline&&this.quickPanelizeEnabled&&t&&t.panelizeFrom==1/0&&t.setPanelizeFlag()}getRealDoc(t,e,r){let i=this.getGerberLayerDocument(t);if(e=="FPC Stiffener"){let{material:n,thickness:s,fpcModel:a}=r;i=this.addFPCDocument(t,n,s,a),this.handleFpcPanelize(i)}else e=="Slot Region"&&(i=this.getGerberLayerDocument(11));return i}isNPTHSlot(t,e){return t=="Slot Region"?new dt().conversion1("mil","mm",e)<=.65:!1}createColorSilkMarkPanelizeFast(t){if(!this.colorSilkMark.length)return;let e=this.originOffset,r=this.colorSilkMarkDocumentMap.CSM;r.setFormatter(this.formatter),r.setTargetAsBody();let i=this.getMatrix(11,e),n=a=>new S(a.x,a.y);if(Object.values(t).some(a=>a==null?void 0:a.length)){r.addComment("colorScreenSilk_board Start");for(let a in t){let l=t[a];if(a=="panelizeLine"){r.addComment("panelizeLine Start");for(let c of l){let{start:h,end:u}=c,d=n(h).multiply3(i),p=n(u).multiply3(i),m=r.getApertureCircle(1);r.useAperture(m);let g=ui.line(d,p);r.addBlock(g)}l&&r.addComment("panelizeLine End")}if(a=="panelizeCircle"){r.addComment("panelizeCircle Start");for(let c of l){let{center:h,radius:u,strokeWidth:d}=c,p=r.getApertureCircle(d);r.useAperture(p);let m=n(h).multiply3(i),g=ui.circleLine(m,u);r.addBlock(g)}r.addComment("panelizeCircle End")}if(a=="panelizeArc"){r.addComment("panelizeArc Start");for(let c of l){let{needSplit:h,width:u,center:d,startAngle:p,sweepAngle:m,rx:g,ry:y}=c,b=n(d),P=new Array;if(h){let O=m/2,_=p+O,x=q.build3(b,p,O,g,y),v=q.build3(b,_,O,g,y);P.push(x,v)}else{let O=q.build3(b,p,m,g,y);P.push(O)}let T=ge.build2(P);if(!T)continue;let I=T.multiply3(i),C=r.getApertureCircle(u);r.useAperture(C);let E=ui.polygonLine(I);r.addBlock(E)}r.addComment("panelizeArc End")}}}}getGerberLayerDocument(t){return this.documentMap[t]}getAllLayerIds(){return Object.keys(this.documentMap).map(Number)}getLayerInfo(t){return this.layerConfigs.find(r=>r.layerId==t)}isPlaneLayer(t){let e=this.getLayerInfo(t);return e&&mu(e.layerType)}getUsedInnerLayerIds(){return this.docLayerIds.filter(t=>Es(t))}isUsedLayerId(t){return this.docLayerIds.includes(t)}autoCommentStart(t,e,r){if(r=r||this.getGerberLayerDocument(e),!r)return;let i=this.commentStartLayerMap[e];i||(i={},this.commentStartLayerMap[e]=i),i[t]||(i[t]=!0,r.addEmptyLine(),r.addComment(`${t} Start`))}autoCommentEnd(t,e,r){if(r=r||this.getGerberLayerDocument(e),!r)return;let i=this.commentStartLayerMap[e];i!=null&&i[t]&&(r.addComment(`${t} End`),i[t]=!1)}autoCommentEndAllLayer(t){for(let e of this.docLayerIds)this.autoCommentEnd(t,e)}setTargetAsBodyAllLayer(){for(let t of this.docLayerIds){let e=this.getGerberLayerDocument(t);e&&e.setTargetAsBody()}}generateHeader(t,e){let r=this.getGerberLayerDocument(t);(t==58||t==59)&&(r=e);let i=RX(this.getLayerInfo(t));this.generateHeaderComment(r,i)}generateHeaderComment(t,e){let{fileUuid:r="",userUuid:i="",saveUUID:n}=this,{unitName:s,integerPlaces:a,decimalPlaces:l}=this;if(t.setTargetAsHeader(),t.addComment("Layer: "+e),t.addComment(`EasyEDA Pro v${this.mainVersion}, ${fee(new Date)}`),(r||i)&&n&&t.addComment(`UUID: ${r}, ${i}`),t.addComment("Gerber Generator version "+zX.version),t.addComment("Scale: 100 percent, Rotated: No, Reflected: No"),t.addComment("Dimensions in "+s),t.addComment(`Leading zeros omitted, absolute positions, ${a} integers and ${l} decimals`),this.defaultParam.outerBBox){let c=this.panelizeComment();t.addComment(c)}t.addComment(this.isOneClick?"Generated by one-click":"Generated by\xA0custom\xA0config"),t.addComment(`Object Configs: ${this.objectConfigs.join(",")}`),t.addComment(`Layer Configs: ${this.docLayerIds.join(",")}`),t.addComment("Copper Areas: 0"),t.addParameter(this.generateFormatParameters())}generateColorSilkMarkHeader(){let t=this.colorSilkMarkDocumentMap.CSM;this.generateHeaderComment(t,"Fabrication_ColorfulBoardOutlineMark")}flushAllBodyBlocks(){for(let t of this.docLayerIds){let e=this.getGerberLayerDocument(t);e&&e.flushBodyBlocks()}}updateCopperComment(){var t;for(let e of this.layerIds){let r=this.getGerberLayerDocument(e);if(!r)continue;let n=`Copper Areas: ${(t=this.copperInfoMap[e])!=null?t:0}`;r.updateCopperComment(n)}}panelizeComment(){let t=this.defaultParam.outerBBox,e=this.defaultParam.singleBBox,r=this.defaultParam.onlyOutline?"Only Board Outline":"All Objects",i=this.defaultParam.column,n=this.defaultParam.row,s;this.defaultParam.stampRow&&this.defaultParam.stampColumn?s="Stamp Hole":!this.defaultParam.stampRow&&!this.defaultParam.stampColumn?s="V-CUT":s="V-CUT + Stamp Hole";let a=this.getPanelizeBox(t,"outerBox"),l=this.getPanelizeBox(e,"bBox");return`Panelize: ${s}, Column: ${i}, Row: ${n}, ${l}, ${a}, Panelized Method: ${r}`}generateColorSilkLocationHole(t){if(!this.colorSilkMark.length)return;let e=this.colorSilkMarkDocumentMap.CSM,r=this.getMatrix(11,t);for(let s in this.colorSilkBoard){let a=this.colorSilkBoard[s];if(s=="polygon"||s=="rect"){let l=s=="polygon"?"PolygonModel":"Rect";e.addComment(`${l} Start`);for(let c of a){let h=c.layerId,u=c.getMathGraphics(h,0);if(!u)continue;let d=u.multiply3(r),p=e.getApertureCircle(c.strokeWidth);e.useAperture(p);let m=ui.polygonLine(d);e.addBlock(m)}e.addComment(`${l} End`)}if(s=="circle"){e.addComment("Circle Start");for(let l of a){let c=e.getApertureCircle(l.strokeWidth);e.useAperture(c);let h=l.center.multiply3(r),u=ui.circleLine(h,l.radius);e.addBlock(u)}e.addComment("Circle End")}}e.addComment("colorScreenSilk_board End"),e.addEmptyLine(),e.addComment("colorScreenSilk_Mark Start"),e.addComment("Pad Start");let i=0,n=2;for(let s of this.colorSilkMark){s=new S(s.x,s.y);let a=n+i*2;if(a<=0)break;let l=e.getApertureCircle(a);e.useAperture(l),s=s.multiply3(r);let c=ui.flashAt(s);e.addBlock(c)}e.addComment("Pad End"),e.addComment("colorScreenSilk_Mark End"),e.addEmptyLine()}generateColorSilkLocationHoleFast(){if(!this.colorSilkMark.length){this.closeStepRepeatParameter();return}let t=this.polygonDataArrForColorSilkBoard,e=this.rectsDataArrForColorSilkBoard,r=this.circlesDataArrForColorSilkBoard;if(!t.length&&!e.length&&!r.length)return;let i=c=>new S(c.x,c.y),n=this.colorSilkMarkDocumentMap.CSM;n.setFormatter(this.formatter),n.setTargetAsBody();let s=this.generateElementOffsets;n.addComment("colorScreenSilk_board Start");for(let c of s){t.length&&n.addComment("PolygonModel Start");for(let h of t){let{layerId:u,strokeWidth:d,polylineData:p,polylineGroupData:m}=h,g=this.getMatrix(u,c),y=n.getApertureCircle(d);if(n.useAperture(y),p){let b=im(p).multiply3(g),P=ui.polygonLine(b);n.addBlock(P)}if(m){let b=kS(m);for(let P of b){let T=P.multiply3(g),I=ui.polygonLine(T);n.addBlock(I)}}n.flushBodyBlocks()}t.length&&n.addComment("PolygonModel End"),e.length&&n.addComment("Rect Start");for(let h of e){let{layerId:u,strokeWidth:d,polylineData:p}=h,m=this.getMatrix(u,c),g=n.getApertureCircle(d);n.useAperture(g);let y=im(p).multiply3(m),b=ui.polygonLine(y);n.addBlock(b)}e.length&&n.addComment("Rect End"),r.length&&n.addComment("Circle Start");for(let h of r){let{layerId:u,strokeWidth:d,center:p,radius:m}=h,g=this.getMatrix(u,c),y=n.getApertureCircle(d);n.useAperture(y);let b=i(p);b=b.multiply3(g);let P=ui.circleLine(b,m);n.addBlock(P)}r.length&&n.addComment("Circle End"),n.flushBodyBlocks()}n.addComment("colorScreenSilk_board End"),n.addEmptyLine(),this.closeStepRepeatParameter(),n.addComment("colorScreenSilk_Mark Start");let a=0,l=2;for(let c of this.colorSilkMark){c=new S(c.x,c.y);let h=l+a*2;if(h<=0)break;let u=n.getApertureCircle(h);n.useAperture(u);let d=ui.flashAt(c);n.addBlock(d)}n.addComment("colorScreenSilk_Mark End"),n.addEmptyLine()}getPanelizeBox(t,e){let r=Pa((Math.abs(t.minX)+Math.abs(t.maxX))*10,1),i=Pa((Math.abs(t.minY)+Math.abs(t.maxY))*10,1),n="inch";return this._unit=="MM"&&(r=Pa(nn.convert(r,1,39.37),3),i=Pa(nn.convert(i,1,39.37),3),n="mm"),`${e=="outerBox"?"Panelized Board Size:":"Board Size:"} ${r}${n} x ${i}${n}`}generateFormatParameters(){let t=new GX;t.setCoordinateFormat(this.integerPlaces,this.decimalPlaces);let e=new PV;return this.unit=="IN"?e.setUnitAsInch():e.setUnitAsMillimeter(),[t,e]}addPadToDoc(t,e,r){let{center:i,rotation:n,pasteExpansion:s,topSolderExpansion:a,bottomSolderExpansion:l}=t,c=new S(i.x,i.y),h=e.layerId,u=7,d=8,p=5,m=6,g=this.getMatrix(h,r),y=Math.round(n/Math.PI*180*100)/100,b=0,{type:P,width:T,height:I,ratio:C}=this.getPad(t,h);switch(this.autoCommentStart("Pad",h,e),h){case u:case d:b=s;break;case p:b=a;break;case m:b=l;break;default:break}switch(P){case"ELLIPSE":{if(T+=b*2,T<=0)break;let E=e.getApertureCircle(T);e.useAperture(E),c=c.multiply3(g);let O=ui.flashAt(c);e.addBodyBlock(O);break}case"OVAL":{if(T+=b*2,I+=b*2,T<=0||I<=0)break;if(T==I){let _=e.getApertureCircle(T);e.useAperture(_),c=c.multiply3(g);let x=ui.flashAt(c);e.addBodyBlock(x);break}y%90===0&&y%180&&([I,T]=[T,I],y=0),y!==0&&this.getLayerIsMirror(h)&&(y=(Math.PI-n)%(Math.PI*2)*180/Math.PI);let E=e.getApertureOval(T,I,y,this.decimalPlaces);e.useAperture(E),c=c.multiply3(g);let O=ui.flashAt(c);e.addBodyBlock(O);break}case"RECT":{if(T+=b*2,I+=b*2,T<=0||I<=0)break;h==p?C=t.top.solderExpansionRatio:h==m?C=t.bottom.solderExpansionRatio:h==u?C=t.top.pasteExpansionRatio:h==d&&(C=t.bottom.pasteExpansionRatio);let E=Math.min(T,I)/2*C;this.getLayerIsMirror(h)&&(y=(Math.PI-n)%(Math.PI*2)*180/Math.PI);let O=e.getApertureRect(T,I,y,E,this.decimalPlaces);e.useAperture(O),c=c.multiply3(g);let _=ui.flashAt(c);e.addBodyBlock(_);break}case"POLYGON":{let E=this.getPolygonPadPl(h,t);if(E){if(E.primitives.every(x=>x instanceof M)&&E.primitives.length<3)return;let O=Eo(E),_=[E];if(O){if(_=hI(E),!_.length){console.log("[GerberDocument] \u591A\u8FB9\u5F62\u710A\u76D8\u53BB\u81EA\u76F8\u4EA4\u540E\u88AB\u5220\u9664",{layerId:h,\u53BB\u81EA\u76F8\u4EA4\u524D:E.primitives,\u53BB\u81EA\u76F8\u4EA4\u540E:_});return}let x=new Ec().getUnion(_);_=[];for(let v of x){let D=KI([v.items],[1]);for(let w of D)_.push(ge.build4(w))}}for(let x of _){let v=x.multiply3(g);if(v.primitives.some(W=>W instanceof q)){let W=ui.polygonFill(v);e.addBodyBlock(W);continue}let F=v.bbox().center(),H=v.multiply3(Qe.translate1(F.mul(-1))),z=.1,V=H.primitives.flatMap(W=>W.points(z).slice(1));if(V.length<=dT.MaxOutlinePolygonPoints){let W=e.getAperturePolygon(V,this.decimalPlaces);e.useAperture(W);let L=ui.flashAt(F);e.addBodyBlock(L)}else{let W=ui.polygonFill(v);e.addBodyBlock(W)}}}break}default:break}}getPolygonPadPl(t,e){var i,n,s,a;let r;switch(t){case 5:r=im((i=e.top)==null?void 0:i.solderPolyData);break;case 7:r=im((n=e.top)==null?void 0:n.pastePolyData);break;case 6:r=im((s=e.bottom)==null?void 0:s.solderPolyData);break;case 8:r=im((a=e.bottom)==null?void 0:a.pastePolyData);break;default:r=im(e.polylineData);break}return r}getPad(t,e){let r=[1,7,5],i=[2,8,6];return r.includes(e)?t.top:i.includes(e)?t.bottom:t.inner}generatePad(t){let e=(n,s)=>{this.getRealDoc(s)&&(this.elementUsedLayerMap[s]=!0)};if(!this.objectConfigs.includes("Pad"))return;let r=jn.getInstance();r.itemsCount&&(this.flushAllBodyBlocks(),r.iterator(n=>{let s=n.layerId,a=ar(s);if(!(!a&&!this.isUsedLayerId(s))&&((a||ao(s))&&(e(n,1),e(n,5),a||e(n,7)),(a||2==s)&&(e(n,2),e(n,6),a||e(n,8)),a)){let l=this.getUsedInnerLayerIds().filter(T=>!n.unusedInnerLayers.includes(T));for(let T of l)e(n,T);let{plated:c,center:h,rotation:u,holeShape:d,holeLength:p,holeOffset:m,holeRadius:g,holeRotation:y}=n,b=this.getMatrix(11,t);h=h.multiply3(b);let P=g*2;if(g>0){d!=="SLOT"&&(m=m.multiply3(Qe.rotate(u)));let T=h.add(m);switch(d){case"SLOT":let I=p/2-g,C=T.add1(I,0).rotate(T,y),E=T.add1(-I,0).rotate(T,y);C=C.rotate(h,u),E=E.rotate(h,u),this.addDrillSlot(c,P,C,E);break;case"ROUND":this.addDrillCircle(c,P,T);break;case"RECT":this.useCircleInsteadOfSquareDrill&&this.addDrillCircle(c,P,T);break;default:break}}}}),this.autoCommentEndAllLayer("Pad"),this.flushAllBodyBlocks())}generatePadFast(t){if(!t.length||!this.objectConfigs.includes("Pad"))return;let e,r=(n,s)=>{if(!this.isUsedLayerId(s))return;let a=this.getRealDoc(s);a&&(this.addPadToDoc(n,a,e),this.elementUsedLayerMap[s]=!0)};this.flushAllBodyBlocks();let i=this.generateElementOffsets;for(e of i){for(let n of t){let s=n.layerId,a=ar(s);if((a||ao(s))&&(r(n,1),r(n,5),a||r(n,7)),(a||2==s)&&(r(n,2),r(n,6),a||r(n,8)),a){let l=this.getUsedInnerLayerIds().filter(C=>!n.unusedInnerLayers.includes(C));for(let C of l)r(n,C);let{plated:c,center:h,rotation:u,holeShape:d,holeLength:p,holeOffset:m,holeRadius:g,holeRotation:y}=n,b=new S(h.x,h.y),P=new S(m.x,m.y),T=this.getMatrix(11,e);b=b.multiply3(T);let I=g*2;if(g>0){d!=="SLOT"&&(P=P.multiply3(Qe.rotate(u)));let C=b.add(P);switch(d){case"SLOT":let E=p/2-g,O=C.add1(E,0).rotate(C,y),_=C.add1(-E,0).rotate(C,y);O=O.rotate(b,u),_=_.rotate(b,u),this.addDrillSlot(c,I,O,_);break;case"ROUND":this.addDrillCircle(c,I,C);break;case"RECT":this.useCircleInsteadOfSquareDrill&&this.addDrillCircle(c,I,C);break;default:break}}}}this.flushAllBodyBlocks()}}generateVia(t){let e=1,r=2,i=5,n=6,s=15,a=46,l=(h,u,d)=>{if(d<=0)return;this.elementUsedLayerMap[h]=!0;let p=this.getMatrix(h,t);u=u.multiply3(p);let m=this.getRealDoc(h);if(!m)return;let g=m.getApertureCircle(d*2);this.autoCommentStart("Via",h,m),m.useAperture(g);let y=ui.flashAt(u);m.addBlock(y)};bn.getInstance().itemsCount&&(this.flushAllBodyBlocks(),bn.getInstance().iterator(h=>{let{startLayer:u,endLayer:d}=h,p=h.type,{center:m,radius:g,holeRadius:y,topExpansion:b,bottomExpansion:P}=h,T=y*2,I=!0,C=!0,E,O;if(I=ao(u)||ao(d),C=2==u||2==d,u==d)throw new Error("Invalid via data");if(I&&C&&p==1||!(I&&C)&&p!==1)throw new Error("Invalid via data");I&&C?this.objectConfigs.includes("Via")&&(u=e,d=r,E=s,O=a):I?(E=s,O=Es(u)?u:d):C?(E=Es(u)?u:d,O=a):(E=u<d?u:d,O=u>d?u:d),I&&(l(e,m,g),l(i,m,g+b)),C&&(l(r,m,g),l(n,m,g+P));let _=this.getUsedInnerLayerIds().filter(v=>!h.unusedInnerLayers.includes(v));for(let v of _)v>=E&&v<=O&&l(v,m,g);let x=this.getMatrix(11,t);m=m.multiply3(x),I&&C?this.objectConfigs.includes("Via")&&(this.addDrillCircle(!0,T,m,!0),this.addDrillCircle(!0,T,m)):I?this.addBlindDrillCircle(e,O,m,T):C?this.addBlindDrillCircle(E,r,m,T):this.addBlindDrillCircle(E,O,m,T)}),this.autoCommentEndAllLayer("Via"),this.flushAllBodyBlocks())}generateViaFast(t){if(!t.length)return;let e=1,r=2,i=5,n=6,s=15,a=46,l=(h,u,d,p)=>{if(p<=0||!this.isUsedLayerId(h))return;this.elementUsedLayerMap[h]=!0;let m=this.getRealDoc(h);if(!m)return;let g=m.getApertureCircle(p*2);this.autoCommentStart("Via",h,m),m.useAperture(g);let y=this.getMatrix(h,u);d=d.multiply3(y);let b=ui.flashAt(d);m.addBodyBlock(b)},c=this.generateElementOffsets;for(let h of c){for(let u of t){let{startLayer:d,endLayer:p,type:m,center:g,radius:y,holeRadius:b,topExpansion:P,bottomExpansion:T,unusedInnerLayers:I}=u,C=b*2,E,O,_=ao(d)||ao(p),x=2==d||2==p;if(d==p)throw new Error("Invalid via data");if(_&&x&&m==1||!(_&&x)&&m!==1)throw new Error("Invalid via data");_&&x?this.objectConfigs.includes("Via")&&(d=e,p=r,E=s,O=a):_?(E=s,O=Es(d)?d:p):x?(E=Es(d)?d:p,O=a):(E=d<p?d:p,O=d>p?d:p);let v=new S(g.x,g.y);_&&(l(e,h,v,y),l(i,h,v,y+P)),x&&(l(r,h,v,y),l(n,h,v,y+T));let D=this.getUsedInnerLayerIds().filter(H=>!I.includes(H));for(let H of D)H>=E&&H<=O&&l(H,h,v,y);let w=this.getMatrix(11,h),F=v.multiply3(w);_&&x?this.objectConfigs.includes("Via")&&(this.addDrillCircle(!0,C,F,!0),this.addDrillCircle(!0,C,F)):_?this.addBlindDrillCircle(e,O,F,C):x?this.addBlindDrillCircle(E,r,F,C):this.addBlindDrillCircle(E,O,F,C)}this.flushAllBodyBlocks()}}generateText(t){let e=io.getInstance().getAllItem();if(!e.length)return;let r=new Map;for(let i=0;i<e.length;i++){let n=e[i],s=n.layerId,a=n.getParent(),l=!!n.key;if(s!=56){if(a&&a instanceof Bi){if(l){if(!this.objectConfigs.includes("ComponentProperty"))continue}else if(this.isSilkLayer(s)&&!this.objectConfigs.includes("ComponentSilkscreen"))continue}else if(!this.objectConfigs.includes("Text"))continue}if(!this.isUsedLayerId(s))continue;this.elementUsedLayerMap[s]=!0;let{strokeWidth:c,fontFamily:h,key:u,value:d,showKey:p,showValue:m}=n;if(!p&&!m)continue;if(r.has(d)){let T=r.get(d);if(T.some(C=>e[C].equals(n)))continue;T.push(i)}else r.set(d,[i]);let g=this.getRealDoc(s);if(!g)continue;let y,b=[],P=this.getMatrix(s,t);y=n.getRealOutline();for(let T of y)T instanceof Cp?T.pl=T.pl.multiply3(P):T=T.multiply3(P),b.push(T);if(b!=null&&b.length)if(this.autoCommentStart("Text",s,g),h=="default"||h==""){let T=g.getApertureCircle(c);g.useAperture(T);for(let I of b)if(I instanceof ge){let C=ui.polygonLine(I);g.addBlock(C)}}else{if(b.some(x=>x instanceof Cp&&!x.flag)){let x=[];this.outlineToCWAndHoleToCCW(b,H=>x.push(H));let v=new Map,D=[];for(let H of b)v.has(H.order)?v.get(H.order).push(H.pl):(v.set(H.order,[H.pl]),D.push(1));let w=Array.from(v.values()),F=KI(w,D);for(let H of F){let z=ui.rawPolygonFill(H);g.addBlock(z)}continue}let I=()=>g.addBlock(tp.PolarityDark),C=()=>g.addBlock(tp.PolarityClear),E=!0,_=!!1;for(let x of b)if(x instanceof Cp){let v=x.flag===_;E!==v&&(E=v,v?I():C());let D=ui.polygonFill(x.pl);g.addBlock(D)}E||I()}}this.autoCommentEndAllLayer("Text")}generateTextFast(t){if(!t.length)return;let e=[],r=l=>l.addBlock(tp.PolarityDark),i=l=>l.addBlock(tp.PolarityClear),n=l=>{for(let c of e){let[h,u]=c;if(s(h,l))return u}return null},s=(l,c)=>{let h=l.outlinesData,u=c.outlinesData;if(h.length!=u.length)return!1;for(let d=0;d<h.length;d++){let p=h[d],m=u[d];for(let g=0;g<p.length;g++)if(p[g]!=m[g])return!1}return!0},a=this.generateElementOffsets;for(let l of a)for(let c of t){let{layerId:h,strokeWidth:u,isOutlineFont:d,hasHole:p,outlinesData:m,outlinesFlag:g,outlinesOrder:y,outlinesGroup:b}=c;if(!this.isUsedLayerId(h))continue;this.elementUsedLayerMap[h]=!0;let P=this.getRealDoc(h);if(!P)continue;let T=this.getMatrix(h,l);if(this.autoCommentStart("Text",h,P),!d){let _=P.getApertureCircle(u);P.useAperture(_);for(let x of m){let v=im(x),D=ui.polygonLine(v.multiply3(T));P.addBlock(D)}continue}if(p){let _,x=n(c);if(x)_=x;else{let v=kS(m),D=new Map,w=[];for(let H=0;H<v.length;H++){let z=v[H].multiply3(T),V=g[H],W=z.area(.1)>0;V==W&&(v[H]=z.reverse()),D.has(b[H])?D.get(b[H]).push(z):(D.set(b[H],[z]),w.push(1))}let F=Array.from(D.values());_=KI(F,w),e.push([c,_])}for(let v of _){let D=ui.rawPolygonFill(v);P.addBlock(D)}continue}let I=!0,E=!!1,O=-1;for(let _ of m){O++;let x=g[O],v=im(_),D=x===E;I!==D&&(I=D,D?r(P):i(P));let w=ui.polygonFill(v.multiply3(T));P.addBlock(w)}I||r(P)}e=null}generateDimension(t){let e=Ma.getInstance().getAllItem(),r=Na.getInstance().getAllItem(),i=sl.getInstance().getAllItem(),n=s=>{for(let a of s){let l=a.layerId,c=this.getMatrix(l,t),h=this.getLayerIsMirror(l);if(!this.isUsedLayerId(l))continue;this.elementUsedLayerMap[l]=!0;let u=this.getRealDoc(l);if(!u)continue;this.autoCommentStart("Dimension",l,u);let d=a.getBaseGraphics(),p=u.getApertureCircle(a.strokeWidth);u.useAperture(p);for(let m of d){let g=ui.KitsuneLine(m,c,h);u.addBlock(g)}if(a instanceof Ap){let m=a.getDegree(),{center:g,radius:y,width:b}=m,P=u.getApertureCircle(b);u.useAperture(P),g=g.multiply3(c);let T=ui.circleLine(g,y);u.addBlock(T)}}};n(e),n(r),n(i),this.autoCommentEndAllLayer("Dimension")}generateDimensionFast(t){if(!t.length)return;let e=this.generateElementOffsets;for(let r of e)for(let i of t){let{layerId:n,strokeWidth:s,linesData:a,degreeObject:l}=i,c=this.getMatrix(n,r),h=this.getLayerIsMirror(n);if(!this.isUsedLayerId(n))continue;this.elementUsedLayerMap[n]=!0;let u=this.getRealDoc(n);if(!u)continue;this.autoCommentStart("Dimension",n,u);let d=u.getApertureCircle(s);u.useAperture(d);let p=kS(a);for(let m of p){let g=m.primitives.filter(b=>b instanceof q||b instanceof M),y=ui.KitsuneLine(g,c,h);u.addBlock(y)}if(l){let{center:m,radius:g,width:y}=l,b=u.getApertureCircle(y);u.useAperture(b);let P=new S(m.x,m.y).multiply3(c),T=ui.circleLine(P,g);u.addBlock(T)}}}generatePolygonModel(t){let e=this.filterObject(),r=vi.getInstance().getAllItem();if(!r.length)return;r=(n=>{let s=[],a=[];return n.forEach(l=>{l.outline instanceof Bt?s.push(l):a.push(l)}),s.concat(a)})(r);for(let n of r){let s=n.layerId,a=this.getMatrix(s,t);if(n.getParent()){if(this.isSilkLayer(s)){if(!this.objectConfigs.includes("ComponentSilkscreen"))continue}else if(e&&!e.includes(n.type))continue}else if(e&&!e.includes(n.type))continue;if(!ar(s)&&!this.isUsedLayerId(s)||this.isPlaneLayer(s))continue;let h=this.getGerberLayerDocument(s);if(!h)continue;if(s==11&&(this.colorSilkBoard.polygon||(this.colorSilkBoard.polygon=[]),this.colorSilkBoard.polygon.push(n)),n.type=="FPC Stiffener"){let m=n.component;h=this.addFPCDocument(s,m.material,m.thickness,m.fpcModel),this.handleFpcPanelize(h)}let u=(m,g)=>{this.autoCommentStart("PolygonModel",m,g)},{type:d,strokeWidth:p}=n;switch(d){case"Board Outline":case"Line":{let m=n.getMathGraphics(s,0);if(!m)continue;this.elementUsedLayerMap[s]=!0;let g=m.multiply3(a);u(s,h);let y=h.getApertureCircle(p);h.useAperture(y);let b=ui.polygonLine(g);h.addBlock(b);break}case"FPC Stiffener":case"Fill Region":{let m=n.getMathGraphics(s,0);if(!m)continue;this.elementUsedLayerMap[s]=!0;let g;if(m instanceof ge?g=m.multiply3(a):(g=[],m.items.forEach(y=>{g.push(y.multiply3(a))})),u(s,h),m instanceof Bt){let y=KI([g],[1]);for(let b of y){let P=ui.rawPolygonFill(b);h.addBlock(P)}}else{let y=ui.polygonFill(g);h.addBlock(y)}break}case"Slot Region":{let m=n.getMathGraphics(s,0);if(!m)continue;this.elementUsedLayerMap[s]=!0;let g=this.getMatrix(11,t),y=m.multiply3(g),b=this.getGerberLayerDocument(11);if(!b)continue;u(11,b);let P=b.getApertureCircle(p);b.useAperture(P);let T=ui.polygonLine(y);b.addBlock(T);break}case"Prohibited Region":case"Copper Region":break;default:break}}this.autoCommentEndAllLayer("PolygonModel")}generatePolygonFast(t){if(!t.length)return;let e=(i,n)=>{this.autoCommentStart("PolygonModel",i,n)},r=this.generateElementOffsets;for(let i of r)for(let n of t){let{layerId:s,type:a,strokeWidth:l,polylineData:c,polylineGroupData:h,fpc:u}=n,d=this.getMatrix(s,i),p=this.getRealDoc(s,a,a=="FPC Stiffener"?u:void 0);if(p)switch(s==11&&this.polygonDataArrForColorSilkBoard.push(n),a){case"Board Outline":case"Line":{this.elementUsedLayerMap[s]=!0,e(s,p);let m=p.getApertureCircle(l);p.useAperture(m);let g=im(c).multiply3(d),y=ui.polygonLine(g);p.addBlock(y),p.flushBodyBlocks();break}case"FPC Stiffener":case"Fill Region":{if(this.elementUsedLayerMap[s]=!0,e(s,p),c){let m=im(c).multiply3(d),g=ui.polygonFill(m);p.addBlock(g)}else if(h){let m=[],g=kS(h);for(let b of g)m.push(b.multiply3(d));let y=KI([m],[0],!0);for(let b of y){let P=ui.rawPolygonFill(b);p.addBlock(P)}}p.flushBodyBlocks();break}case"Slot Region":{if(!this.isUsedLayerId(11))continue;this.elementUsedLayerMap[11]=!0,e(11,p),this.setOnlyOutLineSlotSR(p);let m=p.getApertureCircle(l);p.useAperture(m);let g=this.getMatrix(11,i),y=im(c).multiply3(g),b=ui.polygonLine(y);p.addBlock(b),p.flushBodyBlocks(),this.closeOnlyOutLineSlotSR(p);break}case"Prohibited Region":case"Copper Region":break;default:break}}}generateImage(t){let e=Hs.getInstance().getAllItem();if(!e.length)return;let r=[],i=(l,c)=>{let h=l.template,u=c.template;if(h.length!=u.length)return!1;for(let d=0;d<h.length;d++){let p=h[d],m=u[d];if(!p.equals(m))return!1}return!0},n=l=>{for(let c of r){let[h,u]=c;if(i(h,l))return u}return null},s=l=>{let c=l.template.map(d=>d.clone());return new wf("",0,c).pls},a=l=>{let c=n(l);return c||(c=s(l),r.push([l,c])),l.getPathByTemplatePath(c)};for(let l of e){let c=l.layerId,h=l.getParent();if(c!=56){if(h){if(this.isSilkLayer(c)){if(!this.objectConfigs.includes("ComponentSilkscreen"))continue}else if(!this.objectConfigs.includes("Image"))continue}else if(!this.objectConfigs.includes("Image"))continue}if(!this.isUsedLayerId(c))continue;this.elementUsedLayerMap[c]=!0;let u=a(l),d=[],p=this.getMatrix(c,t),m=u.some(I=>!I.flag),g=new Set,y=[],b=[];for(let I of u)I.pl=I.pl.multiply3(p),d.push(I),m&&(I.order==0?(b=[I.pl],y.push(1),g.add(b)):I.order>0&&b.push(I.pl));let P=this.getRealDoc(c);if(!P)continue;if(this.autoCommentStart("Image",c,P),m){this.outlineToCWAndHoleToCCW(d);let I=KI(Array.from(g),y);for(let C of I){let E=ui.rawPolygonFill(C);P.addBlock(E)}continue}let T=!0;for(let I of d){T!==I.flag&&(T=I.flag,T?P.addBlock(tp.PolarityDark):P.addBlock(tp.PolarityClear));let C=ui.polygonFill(I.pl);P.addBlock(C)}T||P.addBlock(tp.PolarityDark)}this.autoCommentEndAllLayer("Image")}generateImageFast(t){if(!t.length)return;let e=new Map,r=new Map,i=[],n=(h,u)=>{let d=h.template,p=u.template;if(d.length!=p.length)return!1;for(let m=0;m<d.length;m++){let g=d[m],y=p[m];for(let b=0;b<g.length;b++)if(g[b]!=y[b])return!1}return!0},s=h=>{for(let u of i){let[d,p]=u;if(n(d,h))return p}return null},a=h=>{if(r.has(h))return r.get(h);let d=e.get(h).map(g=>g.clone()),m=new wf("",0,d).pls;return r.set(h,m),m},l=(h,u)=>{let d=s(h);d||(d=a(h),i.push([h,d]));let p=d;return p=p.map(m=>m.clone()),p.forEach(m=>{u=new Qe(u.data),m.pl=m.pl.multiply3(u)}),p},c=this.generateElementOffsets;for(let h of c)for(let u of t){let d=u.layerId;if(!this.isUsedLayerId(d))continue;if(d!=56){if(u.hasParent){if(this.isSilkLayer(d)){if(!this.objectConfigs.includes("ComponentSilkscreen"))continue}else if(!this.objectConfigs.includes("Image"))continue}else if(!this.objectConfigs.includes("Image"))continue}this.elementUsedLayerMap[d]=!0,e.set(u,kS(u.template));let p=l(u,u.matrix),m=[],g=this.getMatrix(d,h),y=p.some(E=>!E.flag),b=new Set,P=[],T=[];for(let E of p)E.pl=E.pl.multiply3(g),m.push(E),y&&(E.order==0?(T=[E.pl],P.push(0),b.add(T)):E.order>0&&T.push(E.pl));let I=this.getRealDoc(d);if(!I)continue;if(this.autoCommentStart("Image",d,I),y){this.outlineToCWAndHoleToCCW(m);let E=[];for(let O of b){let _=KI([O],[0],!0);for(let x of _)E.push(x)}for(let O of E){let _=ui.rawPolygonFill(O);I.addBlock(_)}continue}let C=!0;for(let E of m){C!==E.flag&&(C=E.flag,C?I.addBlock(tp.PolarityDark):I.addBlock(tp.PolarityClear));let O=ui.polygonFill(E.pl);I.addBlock(O)}C||I.addBlock(tp.PolarityDark),I.flushBodyBlocks()}e.clear(),r.clear(),i=null,t=null}generateDrillImage(t){let e=56;if(!this.isUsedLayerId(e))return;let r=this.drillDrawingLayerSymbol;if(!r||!r.length)return;let i=this.getRealDoc(e);if(!i)return;this.autoCommentStart("Drill Drawing",e,i),i.flushBodyBlocks();let n=.1,s=this.getMatrix(e,t);this.elementUsedLayerMap[e]=r&&r.length>0,r.forEach(a=>{let{positions:l}=a;l!=null&&l.length&&!(l[0]instanceof S)&&(a.positions=l.map(c=>new S(c.x,c.y)))}),r.forEach(a=>{let{positions:l,image:c,text:h}=a,u=c&&kS(c);if(!u)return;let d=this.convertPolylinesToGerberPolylines(u);for(let y of d)y.pl=y.pl.multiply3(s);let p=[];if(d.some(y=>!y.flag)){let y=new Map,b=[];for(let I of d)y.has(I.order)?y.get(I.order).push(I.pl):(y.set(I.order,[I.pl]),b.push(1));let P=Array.from(y.values()),T=KI(P,b);for(let I of T){let C=ui.rawPolygonFill(I);p.push(...C)}}else{let y=!0;for(let b of d){y!==b.flag&&(y=b.flag,y?p.push(tp.PolarityDark):p.push(tp.PolarityClear));let P=ui.polygonFill(b.pl);p.push(...P)}y||p.push(tp.PolarityDark)}let g=S.ORIGIN;for(let y of l){let b=y.multiply3(s);DX(p,b.sub(g)),i.addBlock(p),i.flushBodyBlocks(),g=b}}),r.forEach(a=>{let{positions:l,image:c,text:h}=a,u=h&&kS(h);if(!u)return;u=u.map(g=>g.multiply3(s));let d=[],p=i.getApertureCircle(n);i.useAperture(p);for(let g of u){let y=ui.polygonLine(g);d.push(...y)}let m=S.ORIGIN;for(let g of l)DX(d,g.sub(m)),i.addBlock(d),i.flushBodyBlocks(),m=g}),this.autoCommentEnd("Drill Drawing",e,i),i.flushBodyBlocks()}generateDrillImageFast(t){let e=56;if(!this.isUsedLayerId(e)||!(t!=null&&t.length))return;this.elementUsedLayerMap[e]=!0;let r=this.getRealDoc(e);if(!r)return;r.flushBodyBlocks(),this.autoCommentStart("Drill Drawing",e,r);let i=this.generateElementOffsets;for(let n of i){let s=this.getMatrix(e,n);for(let a of t){let{positions:l,markIndex:c}=a,h=BWe(r,c,this.unit),u=l.map(d=>new S(d.x,d.y).multiply3(s));for(let d of h){r.useAperture(d);for(let p of u){let m=ui.flashAt(p);r.addBodyBlock(m)}}r.flushBodyBlocks()}}}generateRect(t){let e=this.filterObject(),r=Qi.getInstance().getAllItem();for(let i of r){let n=i.layerId,s=this.getMatrix(n,t);if(i.getParent()){if(this.isSilkLayer(n)){if(!this.objectConfigs.includes("ComponentSilkscreen"))continue}else if(e&&!e.includes(i.type))continue}else if(e&&!e.includes(i.type))continue;if(!ar(n)&&!this.isUsedLayerId(n)||this.isPlaneLayer(n))continue;let c=this.getGerberLayerDocument(n);if(!c)continue;if(n==11&&(this.colorSilkBoard.rect||(this.colorSilkBoard.rect=[]),this.colorSilkBoard.rect.push(i)),i.type=="FPC Stiffener"){let p=i.component;c=this.addFPCDocument(n,p.material,p.thickness,p.fpcModel),this.handleFpcPanelize(c)}let h=(p,m)=>{this.autoCommentStart("Rect",p,m)},{type:u,strokeWidth:d}=i;switch(u){case"Board Outline":case"Line":{let p=i.getMathGraphics(n);if(!p)continue;this.elementUsedLayerMap[n]=!0;let m=p.multiply3(s);h(n,c);let g=c.getApertureCircle(d);c.useAperture(g);let y=ui.polygonLine(m);c.addBlock(y);break}case"FPC Stiffener":case"Fill Region":{let p=i.getMathGraphics(n);if(!p)continue;this.elementUsedLayerMap[n]=!0;let m=p.multiply3(s);h(n,c);let g=ui.polygonFill(m);c.addBlock(g);break}case"Slot Region":{let p=i.getMathGraphics(n);if(!p)continue;this.elementUsedLayerMap[n]=!0;let m=this.getMatrix(11,t),g=p.multiply3(m),y=this.getGerberLayerDocument(11);if(!y)continue;h(11,y);let b=y.getApertureCircle(d);y.useAperture(b);let P=ui.polygonLine(g);y.addBlock(P);break}case"Prohibited Region":case"Copper Region":break;default:break}}this.autoCommentEndAllLayer("Rect")}generateRectFast(t){if(!t.length)return;let e=(i,n)=>{this.autoCommentStart("Rect",i,n)},r=this.generateElementOffsets;for(let i of r)for(let n of t){let{layerId:s,type:a,strokeWidth:l,hasParent:c,polylineData:h,fpc:u}=n,d=this.getMatrix(s,i),p=this.getRealDoc(s,a,a=="FPC Stiffener"?u:void 0);if(p)switch(s==11&&this.rectsDataArrForColorSilkBoard.push(n),a){case"Board Outline":case"Line":{this.elementUsedLayerMap[s]=!0,e(s,p);let m=p.getApertureCircle(l);p.useAperture(m);let g=im(h).multiply3(d),y=ui.polygonLine(g);p.addBlock(y),p.flushBodyBlocks();break}case"FPC Stiffener":case"Fill Region":{this.elementUsedLayerMap[s]=!0,e(s,p);let m=im(h).multiply3(d),g=ui.polygonFill(m);p.addBlock(g),p.flushBodyBlocks();break}case"Slot Region":{if(!this.isUsedLayerId(11))continue;this.elementUsedLayerMap[11]=!0,e(11,p),this.setOnlyOutLineSlotSR(p);let m=p.getApertureCircle(l);p.useAperture(m);let g=this.getMatrix(11,i),y=im(h).multiply3(g),b=ui.polygonLine(y);p.addBlock(b),p.flushBodyBlocks(),this.closeOnlyOutLineSlotSR(p);break}case"Prohibited Region":case"Copper Region":break;default:break}}}generateCircle(t){let e=this.filterObject(),r=Fi.getInstance().getAllItem();for(let i of r){let n=i.layerId,s=this.getMatrix(n,t);if(i.getParent()){if(this.isSilkLayer(n)){if(!this.objectConfigs.includes("ComponentSilkscreen"))continue}else if(e&&!e.includes(i.type))continue}else if(e&&!e.includes(i.type))continue;if(!ar(n)&&!this.isUsedLayerId(n)||this.isPlaneLayer(n))continue;let c=this.getGerberLayerDocument(n);if(!c)continue;if(n==11&&(this.colorSilkBoard.circle||(this.colorSilkBoard.circle=[]),this.colorSilkBoard.circle.push(i)),i.type=="FPC Stiffener"){let g=i.component;c=this.addFPCDocument(n,g.material,g.thickness,g.fpcModel),this.handleFpcPanelize(c)}let h=(g,y)=>{this.autoCommentStart("Circle",g,y)},{type:u,center:d,radius:p,strokeWidth:m}=i;switch(u){case"Board Outline":case"Line":{this.elementUsedLayerMap[n]=!0,h(n,c);let g=c.getApertureCircle(m);c.useAperture(g),d=d.multiply3(s);let y=ui.circleLine(d,p);c.addBlock(y);break}case"FPC Stiffener":case"Fill Region":{this.elementUsedLayerMap[n]=!0,h(n,c);let g=c.getApertureCircle(p*2+m);c.useAperture(g),d=d.multiply3(s);let y=ui.flashAt(d);c.addBlock(y);break}case"Slot Region":{let g=p*2;if(new dt().conversion1("mil","mm",g)<=.65){this.elementUsedLayerMap[n]=!0;let y=!1,b=new WA(n);h(n,b);let P=b.getApertureCircle(g);b.useAperture(P),d=d.multiply3(s);let T=ui.flashAt(d);b.addBlock(T),this.addDrillCircle(y,g,d)}else{this.elementUsedLayerMap[n]=!0;let y=this.getGerberLayerDocument(11);if(!y)continue;let b=this.getMatrix(11,t);h(11,y);let P=y.getApertureCircle(m);y.useAperture(P),d=d.multiply3(b);let T=ui.circleLine(d,p);y.addBlock(T)}break}case"Prohibited Region":case"Copper Region":break;default:break}}this.autoCommentEndAllLayer("Circle")}generateCircleFast(t){if(!t.length)return;let e=(i,n)=>{this.autoCommentStart("Circle",i,n)},r=this.generateElementOffsets;for(let i of r)for(let n of t){let{layerId:s,type:a,strokeWidth:l,hasParent:c,center:h,radius:u,fpc:d}=n,p=this.getMatrix(s,i),m=this.getRealDoc(s,a,a=="FPC Stiffener"?d:void 0),g=this.isNPTHSlot(a,u*2);if(!m&&!g)continue;let y=new S(h.x,h.y);switch(s==11&&this.circlesDataArrForColorSilkBoard.push(n),a){case"Board Outline":case"Line":{this.elementUsedLayerMap[s]=!0,e(s,m);let b=m.getApertureCircle(l);m.useAperture(b),y=y.multiply3(p);let P=ui.circleLine(y,u);m.addBlock(P);break}case"FPC Stiffener":case"Fill Region":{this.elementUsedLayerMap[s]=!0,e(s,m);let b=m.getApertureCircle(u*2+l);m.useAperture(b),y=y.multiply3(p);let P=ui.flashAt(y);m.addBlock(P);break}case"Slot Region":{let b=u*2;if(g){this.elementUsedLayerMap[s]=!0;let P=!1;y=y.multiply3(p),this.addDrillCircle(P,b,y,void 0,!0)}else{if(!this.isUsedLayerId(11))continue;this.elementUsedLayerMap[11]=!0;let P=this.getMatrix(11,i);e(11,m),this.setOnlyOutLineSlotSR(m);let T=m.getApertureCircle(l);m.useAperture(T),y=y.multiply3(P);let I=ui.circleLine(y,u);m.addBlock(I),this.closeOnlyOutLineSlotSR(m)}break}case"Prohibited Region":case"Copper Region":break;default:break}}}generateTear(t){let e=vi.getInstance().getAllItem();for(let r of e)if(r.type=="TearDrop"){let i=r.layerId,n=this.getMatrix(i,t);if(!this.objectConfigs.includes("TearDrop")||!this.isUsedLayerId(i))continue;this.elementUsedLayerMap[i]=!0;let s=this.getRealDoc(i);if(!s)continue;this.autoCommentStart("TearDrop",i,s);let a=r.getMathGraphics(i,0);if(!a)continue;let l=a.multiply3(n),c=ui.polygonFill(l);s.addBlock(c)}this.autoCommentEndAllLayer("TearDrop")}generateTearDropFast(t){if(!t.length)return;let e=this.generateElementOffsets;for(let r of e)for(let i of t){let{layerId:n,type:s,polylineData:a}=i;if(s=="TearDrop"){let l=this.getMatrix(n,r);this.elementUsedLayerMap[n]=!0;let c=this.getRealDoc(n);if(!c)continue;this.autoCommentStart("TearDrop",n,c);let h=im(a).multiply3(l),u=ui.polygonFill(h);c.addBlock(u),c.flushBodyBlocks()}}}generateTrack(t){let e={},r=a=>e[a],i=(a,l)=>e[a]=l;if(!this.objectConfigs.includes("Track"))return;let n=a=>{let l=a.layerId;if(!this.isUsedLayerId(l))return;this.elementUsedLayerMap[l]=!0;let c=this.getRealDoc(l);if(!c)return;this.autoCommentStart("Track",l,c);let h=c.getApertureCircle(a.width);c.useAperture(h);let u=this.getMatrix(l,t),d=a.start.multiply3(u),p=a.end.multiply3(u),m,g=r(l);if((!g||g.x!==d.x||g.y!==d.y)&&(m=ui.linearTo(d,C1.ExposureOff),c.addBlock(m)),a instanceof Ii)if(Math.abs(a.sweepAngle)<.5)m=ui.linearTo(p,C1.ExposureOn);else{let{center:y,isCCW:b}=a;y=y.multiply3(u);let P={x:y.x-d.x,y:y.y-d.y};this.getLayerIsMirror(l)&&(b=!b),b?m=ui.counterclockwiseArcTo(p,P,C1.ExposureOn):m=ui.clockwiseArcTo(p,P,C1.ExposureOn)}else m=ui.linearTo(p,C1.ExposureOn);i(l,p),c.addBlock(m)};Sn.getInstance().itemsCount&&(Sn.getInstance().iterator(n),this.autoCommentEndAllLayer("Track"))}generateTrackFast(t){if(!t.length||!this.objectConfigs.includes("Track"))return;let e={},r=(s,a)=>{let l=e[s];if(!l)return null;let[c,h]=l;return h==a?c:null},i=(s,a,l)=>{e[s]=[a,l]},n=this.generateElementOffsets;for(let s of n)for(let a of t){let{layerId:l,width:c,start:h,end:u,isArc:d,sweepAngle:p,center:m,isCCW:g,radius:y}=a,b=this.getMatrix(l,s),P=this.getRealDoc(l);if(!P)continue;this.elementUsedLayerMap[l]=!0,this.autoCommentStart("Track",l,P);let T=new S(h.x,h.y).multiply3(b),I=new S(u.x,u.y).multiply3(b),C=P.getApertureCircle(c);P.useAperture(C);let E,O=r(l,c);if((!O||O.x!==T.x||O.y!==T.y)&&(E=ui.linearTo(T,C1.ExposureOff),P.addBlock(E)),d)if(Math.abs(p)<Math.acos((y-.1)/y))E=ui.linearTo(I,C1.ExposureOn);else{let _=new S(m.x,m.y).multiply3(b),x={x:_.x-T.x,y:_.y-T.y};this.getLayerIsMirror(l)&&(g=!g),g?E=ui.counterclockwiseArcTo(I,x,C1.ExposureOn):E=ui.clockwiseArcTo(I,x,C1.ExposureOn)}else E=ui.linearTo(I,C1.ExposureOn);i(l,I,c),P.addBlock(E),P.flushBodyBlocks()}}recordDrillTableData(t){this.drillTableData=t}generateDrillTable(t=this.drillTableData){var e,r,i;for(let n of t)(e=n.dataTextArr)!=null&&e.length&&this.generateTextFast(n.dataTextArr),(r=n.dataImageArr)!=null&&r.length&&this.generateImageFast(n.dataImageArr),(i=n.dataPolyArr)!=null&&i.length&&this.generatePolygonFast(n.dataPolyArr)}generatePlaneZone(t){let e=Xo.getInstance().getAllItem();e=e.sort((r,i)=>i.bbox.width()-r.bbox.width()&&i.bbox.height()-r.bbox.height());for(let r of e){if(!this.objectConfigs.includes("PlaneZone"))continue;let i=r.layerId,n=this.getMatrix(i,t);if(!this.isUsedLayerId(i)||!r.style)continue;this.elementUsedLayerMap[i]=!0;let s=r.getOutline(),a=[];for(let h of s)a.push(h.multiply3(n));let l=this.getRealDoc(i);if(!l)continue;this.autoCommentStart("PlaneZone",i,l);let c=ui.polygonFillWithHoles(a);l.addBlock(c)}this.autoCommentEndAllLayer("PlaneZone")}generatePlaneZoneFast(t){if(!this.objectConfigs.includes("PlaneZone"))return;let e=this.generateElementOffsets;for(let r of e)for(let i of t){let n=i.layerId,s=this.getMatrix(n,r);if(!this.isUsedLayerId(n)||!i.style)continue;this.elementUsedLayerMap[n]=!0;let a=kS(i.outline),l=[];for(let u of a)l.push(u.multiply3(s));let c=this.getRealDoc(n);if(!c)continue;this.autoCommentStart("PlaneZone",n,c);let h=ui.polygonFillWithHoles(l);c.addBlock(h),c.flushBodyBlocks()}}generateCopper(t){var l;if(!this.objectConfigs.includes("CopperFilled"))return;let e=qo.getInstance(),r=e.getAllItem(),i={},n=[],s=[],a=c=>{let h=new _e;return c.forEach(d=>{h.ext1(d.bbox())}),h.build1().minX};this.objectConfigs.includes("CopperFilled")&&(this.copperInfoMap||(this.copperInfoMap={}));for(let c=0;c<r.length;c++){let h=r[c],u=h.layerId,d=this.getMatrix(u,t);if(this.objectConfigs.includes("CopperFilled")&&(this.copperInfoMap[u]=((l=this.copperInfoMap[u])!=null?l:0)+1),!this.isUsedLayerId(u))continue;let p=h.getOutline(),m=[];for(let g of p)m.push(g.multiply3(d));if(!(!m||!m.length))if(this.elementUsedLayerMap[u]=!0,n[c]=m,h.isSolid){i[u]||(i[u]=[]);let g=a(m);i[u].push({i:c,left:g})}else s.push(c)}if(this.objectConfigs.includes("CopperFilled")){let c=Object.keys(i).map(Number),h=(d,p)=>d.left-p.left,u=new Set;for(let d of c){let p=i[d];p.sort(h);let m=[],g=[],y=this.getRealDoc(d);if(y){u.add(y),p.length&&(this.elementUsedLayerMap[d]=!0);for(let b of p){let{i:P}=b;this.autoCommentStart("Copper",d,y);let T=n[P],I=ui.polygonFillWithHoles(T);y.addBlock(I),r[P].optimization&&(m.push(T),g.push(P))}m.length>0&&m.forEach((b,P)=>{let T=r[g[P]];if(T.isSolid&&T.optimization&&T.optimizationWidth>0){let I=y.getApertureCircle(T.optimizationWidth);y.useAperture(I);for(let C of b){let E=ui.polygonLine(C);y.addBlock(E)}}})}}for(let d of s){let p=r[d],m=n[d],g=p.gridLineWidth,y=this.getRealDoc(p.layerId);if(!y)continue;let b=y.getApertureCircle(g);y.useAperture(b),u.add(y),this.autoCommentStart("Copper",p.layerId,y),this.elementUsedLayerMap[p.layerId]=!0;for(let P of m){let T=ui.polygonLine(P);y.addBlock(T)}}this.autoCommentEndAllLayer("Copper");for(let d of u)d.flushBodyBlocks();u.clear()}for(let c of r)e.delete(c,c.globalIndex);r=null,i=null,n=null,s=null,e.recycle(),e=null}generateCopperFast(t){var s;if(!this.objectConfigs.includes("CopperFilled"))return;let e={},r=[],i=[],n=this.generateElementOffsets;this.objectConfigs.includes("CopperFilled")&&(this.copperInfoMap||(this.copperInfoMap={}));for(let a of n){for(let c=0;c<t.length;c++){let h=t[c],u=h.layerId,d=this.getMatrix(u,a);if(this.objectConfigs.includes("CopperFilled")&&(this.copperInfoMap[u]=((s=this.copperInfoMap[u])!=null?s:0)+1),!this.isUsedLayerId(u))continue;let p=kS(h.outline),m=[];for(let g of p)m.push(g.multiply3(d));!m||!m.length||(this.elementUsedLayerMap[u]=!0,r[c]=m,h.isSolid?(e[u]||(e[u]=[]),e[u].push(c)):i.push(c))}let l=Object.keys(e).map(Number);for(let c of l){let h=e[c],u=[],d=[],p=this.getRealDoc(c);if(p){h.length&&(this.elementUsedLayerMap[c]=!0);for(let m of h){this.autoCommentStart("Copper",c,p);let g=r[m],y=KI([g],[1]);for(let b of y){let P=ui.rawPolygonFill(b);p.addBlock(P)}t[m].optimization&&(u.push(g),d.push(m))}u.length>0&&u.forEach((m,g)=>{let y=t[d[g]];if(y.isSolid&&y.optimization&&y.optimizationWidth>0){let b=p.getApertureCircle(y.optimizationWidth);p.useAperture(b);for(let P of m){let T=ui.polygonLine(P);p.addBlock(T)}}}),p.flushBodyBlocks()}}for(let c of i){let h=t[c],u=r[c],d=h.gridLineWidth,p=this.getRealDoc(h.layerId);if(!p)continue;let m=p.getApertureCircle(d);p.useAperture(m),this.autoCommentStart("Copper",h.layerId,p),this.elementUsedLayerMap[h.layerId]=!0;for(let g of u){let y=ui.polygonLine(g);p.addBlock(y)}p.flushBodyBlocks()}}t=null,e=null,r=null,i=null}generateElement(t){this.setTargetAsBodyAllLayer(),this.generateCopper(t),this.generatePlaneZone(t),this.generateImage(t),this.generateDrillImage(t),this.generateText(t),this.generatePolygonModel(t),this.generateRect(t),this.generateCircle(t),this.generateDimension(t),this.generateTear(t),this.generatePad(t),this.generateVia(t),this.generateTrack(t),this.generateColorSilkLocationHole(t)}generateElementAll(){let t=this.generateElementOffsets;for(let e of t)this.generateElement(e)}prepareGerberDocuments(){this.createDocumentMap(),this.setTargetAsBodyAllLayer()}closeStepRepeatParameter(){if(!this.stepRepeatParameterOpened)return;let t=new eD,e=i=>{i&&i.stepRepeatParameterOpened&&(i.addParameter(t),i.stepRepeatParameterOpened=!1)},r=this.docLayerIds;for(let i of r){let n=this.getGerberLayerDocument(i);e(n)}Hn(this.fpcDocumentMap,(i,n)=>{e(n)}),Hn(this.colorSilkMarkDocumentMap,(i,n)=>{e(n)})}handleFpcPanelize(t){if(!this.defaultParam.onlyOutline&&this.defaultParam.success){let e=this.defaultParam.offset||new S(0,0),r=this.defaultParam.row,i=this.defaultParam.column,n=new eD([i,r,e.x,e.y]);t&&(t.addEmptyLine(),t.addParameter(n))}}async progressUpdate(t){self.workerBus.publish("progressUpdate",{ratio:t,descripte:"Export Gerber..."}),await new Promise(e=>{setTimeout(e,30)})}filterObject(){let t=[];return(this.objectConfigs||[]).forEach(e=>{e==="BoardOutline"?t.push("Board Outline"):e==="BoardCutout"?t.push("Slot Region"):e==="CopperOutline"||e==="CopperFilled"?t.push("Copper Region"):e==="SolidRegion"?t.push("Fill Region"):e==="ProhibitedRegion"?t.push("Prohibited Region"):e==="Line"?t.push("Line"):e==="FPCStiffener"&&t.push("FPC Stiffener")}),this.objectConfigs||(t=null),t}isSilkLayer(t){return!![3,4].includes(t)}getLayerIsMirror(t){if(this.layerConfigs){let e=this.layerConfigs.findIndex(r=>r.layerId==t);return e>=0?this.layerConfigs[e].isMirror:!1}else return!1}getMatrix(t,e){let r;return this.getLayerIsMirror(t)&&(r=Qe.MIRROR_X),r=r?r.translate1(e):Qe.translate1(e),r}convertPolylinesToGerberPolylines(t){return new wf("",0,t).pls}outlineToCWAndHoleToCCW(t,e){for(let r of t)if(r instanceof Cp){let i=r.pl.area(.1)>0;r.flag?i&&(r.pl=r.pl.reverse()):i||(r.pl=r.pl.reverse()),e&&e(r)}}createDrillHeaderComments(t,e,r,i=!1){let{fileUuid:n="",userUuid:s="",saveUUID:a}=this,l=e?"PTH":"NPTH";if(t.addHeaderComment("TYPE="+(e?"PLATED":"NON_PLATED")),r)t.addHeaderComment("Layer: "+l+"_"+r);else{let h=i?"Layer: "+l+"_Through_Via":"Layer: "+l+"_Through";t.addHeaderComment(h)}let c=`EasyEDA Pro v${this.mainVersion}, ${fee(new Date)}`;MHe&&(c=`EasyEDA Pro Client v${this.mainVersion}, ${fee(new Date)}`),t.addHeaderComment(c),(n||s)&&a&&t.addHeaderComment(`UUID: ${n}, ${s}`),t.addHeaderComment("Gerber Generator version "+zX.version)}addBlindDrillCircle(t,e,r,i){let n=this.getLayerInfo(t),s=this.getLayerInfo(e),a=RX(n).replace("Layer",""),l=RX(s).replace("Layer",""),c=a+"_to_"+l,h=this.drillDocumentMap[c];h||(h=new UA,this.drillDocumentMap[c]=h,this.drillLayerMap[c]=[t,e],this.defaultParam.success&&!this.defaultParam.onlyOutline&&h.setPanelizeFlag()),h.addCircle(i,r)}addDrillCircle(t,e,r,i=!1,n=!1){let s=t?"PTH":"NPTH";i&&(s="PTH_Via");let a=this.drillDocumentMap[s];a||(a=new UA,this.drillDocumentMap[s]=a),n&&this.setOnlyOutLineCircleSlotSR(a),a.addCircle(e,r,i,n)}addColorSilkDocument(){if(!this.colorSilkMark.length)return;let t="CSM",e=this.colorSilkMarkDocumentMap[t];e||(e=new WA(11),this.colorSilkMarkDocumentMap[t]=e),this.generateColorSilkMarkHeader()}addDrillSlot(t,e,r,i){let n=t?this.drillDocumentMap.PTH:this.drillDocumentMap.NPTH;n&&n.addSlot(e,r,i)}isMustExportLayer(t){let e=1,r=2,i=5,n=6,s=11,a=3,l=4;return[s,e,r,a,l,i,n].includes(t)}addHashApertureToGerber(t){if(this.ignoreHash===!0||t.length>3e7)return t;let e=t.split(`
`),r=/^%ADD(\d{2,4})\D.*/m,i=/^%AD|^%AM/,n=[],s=[],a=!1;e.some((m,g)=>{if(g>200&&!i.test(m)||g>200+Eg.numberMax*2)return!0;let y=m.match(r);return y&&(n.push(m),s.push(+y[1]),a=!0),y?!1:a}),e=null;let l=Math.min(5+Math.random()*5|0,s.length-1);s.length<=5&&(l=s.length);let c=n[l],h=s[l];c||(s.length<=0?h=10:s.length<=5&&(h=s[s.length-1]+1,h>=Eg.numberMax&&(s.length>=2?h=s[s.length-2]+1:h=10)));let u=t.replace(/^(%ADD|G54D)(\d{2,4})(?=\D)/gm,(m,g,y)=>+y<h||+y==Eg.numberMax?m:g+(+y+1));(!c||!/,([\d.]+)/.test(c))&&(c=`%ADD${h}C,${Math.random().toFixed(4)}*%`);let d=c.replace(/,([\d.]+)/,(m,g)=>{let y=(0,GWe.default)((this.isImportedPCBDoc?"494d":"")+u),P=(parseInt(y.slice(-2),16)%100+100+"").slice(-2),T=(+g).toFixed(2)+P;return+T==0&&(T="0.0100"),","+T}),p=u;if(u.match(new RegExp("^%ADD"+(h+1)+"(?=\\D)","m")))p=u.replace(new RegExp("^%ADD"+(h+1)+"(?=\\D)","m"),m=>d+`
`+m);else{let m=u.split(`
`);for(let g=0,y=0,b=0;g<m.length;g++){let P=m[g];if(!b)P.match(/^%MO/)&&(b=g);else if(P.match(/^%LP|^G/)){for(y=g;y>0&&!m[y-1];)y--;m.splice(y,0,d),p=m.join(`
`);break}}}return p}addFPCDocument(t,e,r,i){let n=this.getFpcDocumentNamePair(t,e,r,i),s=this.fpcDocumentMap[n];return s||(s=new WA(t),this.generateHeader(t,s),this.fpcDocumentMap[n]=s,this.fpcDocumentMap[n].setFormatter(this.formatter),this.fpcLayerNameMap[n]={layerId:t,material:e,thickness:r,model:i},s.setTargetAsBody()),s}getFpcDocumentNamePair(t,e,r,i){let n="",s=t==58,a={Polyimide:"pi",FR4:"fr4","Stainless Steel":"gp",Tape:"ps","EMI Shielding Film":s?"csa":"ssa"},l={"3M468":"3m468","3M9077":"3m9077",TESA8854:"tesa8854"};return s?n="TopStiffenerLayer_"+a[e]+(e=="EMI Shielding Film"?"":"t")+"_"+(l[i]||r):n="BottomStiffenerLayer_"+a[e]+(e=="EMI Shielding Film"?"":"b")+"_"+(l[i]||r),n}init(t){let{data:e,defaultParam:r,drillDrawingLayerSymbol:i,colorSilkMark:n,isImportedPCBDoc:s}=t,{fileUuid:a,userUuid:l,ignoreHash:c,unit:h,format:u,drillMap:d,layerConfigs:p,objectConfigs:m,mainVersion:g,useOldBool:y,origin:b,type:P}=e;this.isImportedPCBDoc=s,this.released=!0,this.mainVersion=g,this.drillDrawingLayerSymbol=i,this.colorSilkMark=n,this.fileUuid=a,this.userUuid=l,this.ignoreHash=c||!1,this.drillMap=d,this.isOneClick=P,h&&(this.unit=h),u&&(this.integerPlaces=+u.Integer,this.decimalPlaces=+u.Decimals);let T;p&&(T=p.map(C=>C.layerId),this.layerConfigs=p,this.layerIds=T),this.objectConfigs=m,this.defaultParam=r,this.useOldBool=y,this.origin=b;let I=new S(0,0).sub(this.origin);if(this.originOffset=I,this.generateElementOffsets=[I],!r.onlyOutline&&r.success){let{column:C,row:E,offset:O}=r;if(O=O||new S(0,0),this.stepRepeatConfig={column:C,row:E,stepX:O.x,stepY:O.y},!this.quickPanelizeEnabled){let _=[];for(let x=0;x<E;x++)for(let v=0;v<C;v++){let D=new S(O.x*v,O.y*x);D=D.add(I),_.push(D)}this.generateElementOffsets=_}}}createDocumentTextMap(){let t={},e=new UX;e.leftLength=this.integerPlaces,e.rightLength=this.decimalPlaces,e.unit=this.unit,this.copperInfoMap&&this.updateCopperComment();for(let a of this.layerIds){let l=this.getGerberLayerDocument(a);if(l&&(this.elementUsedLayerMap[a]||this.isMustExportLayer(a))){let c=l.exportText(e);a!=56&&(c=this.addHashApertureToGerber(c)),t[a]=c}}let r=Object.keys(this.fpcDocumentMap);for(let a of r){let l=this.fpcDocumentMap[a];if(l){let c=l.exportText(e);c=this.addHashApertureToGerber(c),t[a]=c}}let i=Object.keys(this.colorSilkMarkDocumentMap);for(let a of i){let l=this.colorSilkMarkDocumentMap[a];if(l){let c=l.exportText(e);c=this.addHashApertureToGerber(c),t[a]=c}}let n=Object.keys(this.drillDocumentMap),s=this.drillMap;for(let a of n){let l=this.drillDocumentMap[a];if(!l||(l.unit=this.unit,l.holesCount<1))continue;if(this.defaultParam.success&&this.quickPanelizeEnabled){let m=this.defaultParam.offset||new S(0,0),g=this.defaultParam.row,y=this.defaultParam.column,b=this.defaultParam.onlyOutline;l.panelizeParam={offset:m,row:g,column:y,onlyOutline:b}}l.isMirror=this.getLayerIsMirror(1)&&this.getLayerIsMirror(2);let c,h,u=s&&s.includes("PTH"),d=s&&s.includes("NPTH"),p=l.isThroughVia;c=a!="NPTH",h=a=="NPTH"||a=="PTH"||a=="PTH_Via"?"":a,s&&(!u||!d)?u?a!="NPTH"&&(this.createDrillHeaderComments(l,c,h,p),t[a]=l.exportText(e)):d&&a=="NPTH"&&(this.createDrillHeaderComments(l,c,h,p),t[a]=l.exportText(e)):(this.createDrillHeaderComments(l,c,h,p),t[a]=l.exportText(e))}return t}async exportTextFast(){return this.generateColorSilkLocationHoleFast(),this.drillTableData&&this.generateDrillTable(this.drillTableData),this.createDocumentTextMap()}async exportText(t){return this.init(t),this.prepareGerberDocuments(),this.progressUpdate(.25),await gz(50),this.createPanelize(),this.generateElementAll(),this.closeStepRepeatParameter(),this.progressUpdate(.75),await gz(50),this.createDocumentTextMap()}};zX.version="0.3";var Wae=zX;var HWe=wHe?"https://prodocs.lceda.cn/cn/pcb/order-order-pcb/index.html":"https://prodocs.easyeda.com/en/pcb/order-order-pcb/index.html",x_t={name:"How-to-order-PCB.txt",content:`How to Order PCB

Please refer to:
${HWe}`},R_t={name:"PCB\u4E0B\u5355\u5FC5\u8BFB.txt",content:`\u5982\u4F55\u8FDB\u884CPCB\u4E0B\u5355

\u8BF7\u67E5\u770B\uFF1A
${HWe}`};function zae(o){return hb(o)?"Fabrication_ColorfulTopSilkscreen.FCTS":"Fabrication_ColorfulBottomSilkscreen.FCBS"}function WWe(o){let t=new Date,e=t.getFullYear(),r=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getDate().toString().padStart(2,"0"),n=`${e}-${r}-${i}`;return`Gerber_${(o||"PCB").replace(/[^\w\u0082-\ufffc]+/g," ").replace(/\s\s+/g," ").trim().replace(/\s/g,"_")}_${n}.zip`}function zWe(){return ZWe()}async function YWe(o){let t=await V9e(1),e=await V9e(0),r=await t.encrypt(e.getKey()),i=await t.encrypt(e.getIV()),n=await e.encrypt(o);return Sae([r,i,n])}var Yae=class{constructor(){this.files={};this.transfer=[]}get workerURL(){return`editor?entry=pcb-zip-worker.js${Q().location.search.replace(/\?/,"&")}`}generateAsync(t,e){return new Promise((r,i)=>{let n=a=>{let l=typeof a=="string"?a:(a==null?void 0:a.message)||"Failed to generate zip file.";he.messageBus.publish("message",{type:"error",message:l}),i(l)},s=new Eae(this.workerURL,{name:"pcb-zip-worker"});s.onmessage=a=>{s.terminate();let{err:l,blob:c}=a.data||{};c?r(c):n(l)},s.onerror=()=>{s.terminate(),n()},s.postMessage({zippable:t,level:e},this.transfer)})}};function jWe(...[o]){return CV(o).then(t=>{if(!t)return;let e=t.fileName;return D2?JI(t.blob,e,"zip"):xd.downloadFile(e,t.blob),t},t=>{debugger;throw t})}async function XWe(o){let t="generateGerber-time";Cn(t),o=await KWe(o);let{title:e,language:r,fileName:i,silk:n,unUseWorkerZip:s}=o,l=o.isTestExport&&o.exportConfig?new xX:null,c={...si.getInstance().getDefaultPanelize(),outerBBox:si.getInstance().outerBBox,singleBBox:si.getInstance().singleBBox,offset:si.getInstance().offset},h=n?zWe():[],u=$We(),d={data:o,defaultParam:c,colorSilkMark:h,isImportedPCBDoc:u},p=new Wae;p.init(d),p.prepareGerberDocuments();let m=N=>o.objectConfigs.includes(N),g=new wX(o),y,b,P,T,I,C,E,O,_,x,v,D,w,F,H=!0;y||(y=g.getPanelize()),(y.length||H&&c.success)&&(p.createPanelizeFast(y),p.autoCommentEndAllLayer("Panelize")),b||(b=g.getCopper()),b.length&&(p.generateCopperFast(b),p.autoCommentEndAllLayer("Copper")),P||(P=g.getPlaneZone()),P.length&&(p.generatePlaneZoneFast(P),p.autoCommentEndAllLayer("PlaneZone")),T||(T=g.getImage()),T.length&&(p.generateImageFast(T),p.autoCommentEndAllLayer("Image")),C||(C=g.getText()),C.length&&(p.generateTextFast(C),p.autoCommentEndAllLayer("Text")),E||(E=g.getPolygon()),E.length&&(p.generatePolygonFast(E),p.autoCommentEndAllLayer("Polygon")),O||(O=g.getRect()),O.length&&(p.generateRectFast(O),p.autoCommentEndAllLayer("Rect")),_||(_=g.getCircle()),_.length&&(p.generateCircleFast(_),p.autoCommentEndAllLayer("Circle")),x||(x=g.getDimension()),x.length&&(p.generateDimensionFast(x),p.autoCommentEndAllLayer("Dimension")),v||(v=g.getTearDrop()),v.length&&(p.generateTearDropFast(v),p.autoCommentEndAllLayer("TearDrop")),D||(D=g.getPad()),D.length&&(p.generatePadFast(D),p.autoCommentEndAllLayer("Pad")),w||(w=g.getVia()),w.length&&(p.generateViaFast(w),p.autoCommentEndAllLayer("Via")),F||(F=g.getTrack()),F.length&&(p.generateTrackFast(F),p.autoCommentEndAllLayer("Track")),I||(I=g.getDrillDrawing()),I.length&&(p.generateDrillImageFast(I),p.autoCommentEndAllLayer("Drill Drawing"));let z=await p.exportTextFast();if(!z)throw new Error("export gerber failed");let{drillLayerMap:V,fpcLayerNameMap:W}=p,L={};for(let N in z)if(Object.prototype.hasOwnProperty.call(z,N)){let U=z[N],B,G=+N,Y,X=!1;if(N=="PTH"||N=="NPTH")B=V6(N),X=!0,Y=w6(1,2,N==="PTH",!0,!1);else if(N=="PTH_Via")B=V6("PTH",void 0,!0);else if(N=="CSM")B=U9e(),Y=B;else if(isNaN(G)&&!N.includes("StiffenerLayer")){B=V6("PTH",N);let K=V[N];X=!0,K&&(Y=w6(K[0],K[1],!0,!0,!0))}else if(isNaN(G)&&N.includes("StiffenerLayer")){B=G9e(N);let K=W[N];K&&(Y=fX(K.layerId,K.material,K.thickness,K.model))}else B=H9e(G),Y=B;l&&Y&&l.addLayersId(B,isNaN(G)?void 0:G,Y,X),L[B]=typeof U=="string"?Hy(U):U}if(o.flyingProbe!=!1){let N=z9e,{fileContent:U}=await LX();L[N]=Hy(U)}if(n){let N="generateColorSilkFiles-time";Cn(N);let B=new _X().generate(c,h);for(let G in B){let Y=G;if(Object.prototype.hasOwnProperty.call(B,G)){let X=B[Y],K;if(G=="TOPSILK"?K=zae(3):G=="BOTTOMSILK"?K=zae(4):G=="BOARDOUTLINE"&&(K="Fabrication_ColorfulBoardOutlineLayer.FCBO"),Ra.generateGerberUnEncryption){K=K.replace(/\.(.+)$/,".svg"),L[K]=Hy(X);continue}let J=await YWe(X);L[K]=new Uint8Array(J)}}Xi(N)}l&&(l.setUnit(o.unit),l.setFormate(o.format.Integer,o.format.Decimals),xd.downloadFileASCII(i.replace(".zip",".json"),l.exportText()));let k;try{if(s){let B=VX(L,{level:6});k=new Blob([B],{type:"application/zip"})}else k=await new Yae().generateAsync(L,6);i&&!i.toLowerCase().endsWith(".zip")&&(i="");let U=i||WWe(e);console.log(`zip file is generated: ${U} [${k.size} bytes]`),o.fileName=U}catch{return}return Xi(t),k?{...o,blob:k}:null}function qWe(...[o]){let{needDownLoad:t}=o;return CV(o).then(async e=>{if(!e)return;let{fileName:r,blob:i}=e,n=r;QHe()&&t&&(D2?JI(i,n,"zip"):xd.downloadFile(n,i));let s=await ZI(i);return{fileInfo:o,data:s.data,error:null}},e=>{debugger;throw e})}function D_t(o){let t;o?t=new Worker(o):t=new Worker(`editor?entry=pcb-decode-worker.js${Q().location.search.replace(/\?/,"&")}`,{name:"pcb-decode-worker"});let e=new UWe.WorkerMessageBridge(he.messageBus,t);return{worker:t,messageBus:e}}function $We(){let o=/^ie\d+$/,t=0;return Ar.iteratorBreakable(e=>{if(o.test(e.globalIndex)&&(t++,t>=1))return!1}),t>=1}async function CV(o){var w,F;let t="generateGerber-time";Cn(t),o=await KWe(o);let{title:e,language:r,fileName:i,silk:n,workerJsUrl:s,unUseWorkerZip:a,drillTable:l}=o,c;if(l&&!JWe()){let H=YX();if(H){let z=H.UR(),V=Bs.conversion("mm","mil",20)/10,W=z.add(new S(V,0)),L=cX();c=new YF(L,56).getStackTableModel(W)}}let u=o.isTestExport&&o.exportConfig?new xX:null,d={...si.getInstance().getDefaultPanelize(),outerBBox:si.getInstance().outerBBox,singleBBox:si.getInstance().singleBBox,offset:si.getInstance().offset},p=n?zWe():[],m=$We(),g={data:o,defaultParam:d,colorSilkMark:p,isImportedPCBDoc:m},{worker:y,messageBus:b}=D_t(s);he.messageBus.subscribe("cancelExportGerber",()=>{y.terminate()});let P;try{let H=12e5,z=await b.rpcCall("pcb/worker/exportGerber/init",{...g},H);if(g=null,!z||!z.message||z.message.error)throw((w=z==null?void 0:z.message)==null?void 0:w.error)||"init fail";let V=Se=>o.objectConfigs.includes(Se),W=new wX(o),L=R.getInstance(),k=new _ae("2.0",L.doctype),N,U,B,G,Y,X,K,J,se,ce,te,oe,$,fe,Oe,Te=0,ue=!1,be=1e4,j=(Se,Re=be)=>Se.splice(0,Re),Z=!0,ie=new W3;w_t(ie);let de=.25;for(;!ue;){if(Te++>5e4)throw new Error("endless callback when export gerber");let Se=!1,Re=[];if(!Se&&(N||(N=W.getPanelize()),N.length||Z&&d.success)){Se=!0,Z=!1;let Je=j(N),Ke=!N.length;Re.push({label:"Panelize",type:"Panelize",dataArr:Je,end:Ke})}if(!Se&&(U||(U=W.getCopper()),U.length)){Se=!0;let Je=j(U),Ke=!U.length;Re.push({label:"Copper",type:"Copper",dataArr:Je,end:Ke})}if(!Se&&(B||(B=W.getPlaneZone()),B.length)){Se=!0;let Je=j(B),Ke=!B.length;Re.push({label:"PlaneZone",type:"PlaneZone",dataArr:Je,end:Ke})}if(!Se&&(G||(G=W.getImage()),G.length)){Se=!0;let Je=j(G,100),Ke=!G.length;Re.push({label:"Image",type:"Image",dataArr:Je,end:Ke})}if(!Se&&(K||(K=W.getText()),K.length)){Se=!0;let Je=j(K),Ke=!K.length;Re.push({label:"Text",type:"Text",dataArr:Je,end:Ke})}if(!Se&&(J||(J=W.getPolygon()),J.length)){Se=!0;let Je=j(J),Ke=!J.length;Re.push({label:"Polygon",type:"Polygon",dataArr:Je,end:Ke})}if(!Se&&(se||(se=W.getRect()),se.length)){Se=!0;let Je=j(se),Ke=!se.length;Re.push({label:"Rect",type:"Rect",dataArr:Je,end:Ke})}if(!Se&&(ce||(ce=W.getCircle()),ce.length)){Se=!0;let Je=j(ce),Ke=!ce.length;Re.push({label:"Circle",type:"Circle",dataArr:Je,end:Ke})}if(!Se&&(te||(te=W.getDimension()),te.length)){Se=!0;let Je=j(te),Ke=!te.length;Re.push({label:"Dimension",type:"Length Dimension",dataArr:Je,end:Ke})}if(!Se&&(oe||(oe=W.getTearDrop()),oe.length)){Se=!0;let Je=j(oe),Ke=!oe.length;Re.push({label:"TearDrop",type:"TearDrop",dataArr:Je,end:Ke})}if(!Se&&($||($=W.getPad()),$.length)){Se=!0;let Je=j($),Ke=!$.length;Re.push({label:"Pad",type:"Pad",dataArr:Je,end:Ke})}if(!Se&&(fe||(fe=W.getVia()),fe.length)){Se=!0;let Je=j(fe),Ke=!fe.length;Re.push({label:"Via",type:"Via",dataArr:Je,end:Ke})}if(!Se&&(Oe||(Oe=W.getTrack()),Oe.length)){Se=!0;let Je=j(Oe),Ke=!Oe.length;Re.push({label:"Track",type:"Track",dataArr:Je,end:Ke})}if(!Se&&(Y||(Y=W.getDrillDrawing()),Y.length)){Se=!0;let Je=j(Y),Ke=!Y.length;Re.push({label:"Drill Drawing",type:"DrillDrawing",dataArr:Je,end:Ke})}if(!Se&&(X||c&&(X=[W.getDrillTable(c)]),X!=null&&X.length)){Se=!0;let Je=j(X),Ke=!X.length;Re.push({label:"Drill Table",type:"DrillTable",dataArr:Je,end:Ke})}if(Se&&Re.length){let Je={tasks:Re},Ke=await b.rpcCall("pcb/worker/exportGerber/addTask",Je,H);if(!((F=Ke==null?void 0:Ke.message)!=null&&F.success))throw new Error("export gerber failed");ie.updateProgress(de+=.05),console.log("## taskItemsCounter #"+Te)}else{ue=!0;break}}let me=await b.rpcCall("pcb/worker/exportGerber/getFullText",null,H);if(!me||!me.message)throw new Error("export gerber failed");P=me.message}catch(H){debugger;throw H}finally{y.terminate()}let{gerberTextData:T}=P;if(!T)throw new Error("export gerber failed");let{textMap:I,drillLayerMap:C,fpcLayerNameMap:E}=T,O={};for(let H in I)if(Object.prototype.hasOwnProperty.call(I,H)){let z=I[H],V,W=+H,L,k=!1;if(H=="PTH"||H=="NPTH")V=V6(H),k=!0,L=w6(1,2,H==="PTH",!0,!1);else if(H=="PTH_Via")V=V6("PTH",void 0,!0);else if(H=="CSM")V=U9e(),L=V;else if(isNaN(W)&&!H.includes("StiffenerLayer")){V=V6("PTH",H);let N=C[H];k=!0,N&&(L=w6(N[0],N[1],!0,!0,!0))}else if(isNaN(W)&&H.includes("StiffenerLayer")){V=G9e(H);let N=E[H];N&&(L=fX(N.layerId,N.material,N.thickness,N.model))}else V=H9e(W),L=V;u&&L&&u.addLayersId(V,isNaN(W)?void 0:W,L,k),O[V]=typeof z=="string"?Hy(z):z}if(o.flyingProbe!=!1){let H=z9e,{fileContent:z}=await LX();O[H]=Hy(z)}if(n){let H="generateColorSilkFiles-time";Cn(H);let V=new _X().generate(d,p);for(let W in V){let L=W;if(Object.prototype.hasOwnProperty.call(V,W)){let k=V[L],N;if(W=="TOPSILK"?N=zae(3):W=="BOTTOMSILK"?N=zae(4):W=="BOARDOUTLINE"&&(N="Fabrication_ColorfulBoardOutlineLayer.FCBO"),Ra.generateGerberUnEncryption){N=N.replace(/\.(.+)$/,".svg"),O[N]=Hy(k);continue}let U=await YWe(k);O[N]=new Uint8Array(U)}}Xi(H)}let x=(r||"zh-cn").match(/^zh-/)?R_t:x_t;O[x.name]=Hy(x.content);let v=L_t(o);v&&(O[v.fileName]=Hy(v.config)),u&&(u.setUnit(o.unit),u.setFormate(o.format.Integer,o.format.Decimals),xd.downloadFileASCII(i.replace(".zip",".json"),u.exportText()));let D;try{if(a){let V=VX(O,{level:6});D=new Blob([V],{type:"application/zip"})}else D=await new Yae().generateAsync(O,6);i&&!i.toLowerCase().endsWith(".zip")&&(i="");let z=i||WWe(e);console.log(`zip file is generated: ${z} [${D.size} bytes]`),o.fileName=z}catch{return}return Xi(t),D?{...o,blob:D}:null}function w_t(o){o.reset(),o.onProgress(t=>{he.publish("progressUpdate",[t,"Export Gerber..."],Q())})}async function KWe(o){var b;o||(o={});let{title:t,fileUuid:e,userUuid:r,language:i,fileName:n,unit:s,format:a,silk:l,drillMap:c,drillTable:h,flyingProbe:u,layerConfigs:d,objectConfigs:p,mainVersion:m,isTestExport:g}=o;if(!t){let P=R.getInstance().name;o.title=`Gerber_${P}_${L6(new Date,"yyyy-MM-dd")}.zip`}if(!n){let P=R.getInstance().name;o.fileName=`Gerber_${P}_${L6(new Date,"yyyy-MM-dd")}.zip`}a||(o.format={Integer:2,Decimals:6}),l==null&&(o.silk=!1);let y=(await he.messageBus.rpcCall("gerberLayerConfig")).message;if(h!==!1){let P=Pe.getLayer(56);if(P)y.push({layerId:P.layerID,layerName:P.name,layerType:P.type,status:P.layerStatus});else{console.warn("generateGerber: cannot get drillLayer");debugger}}if(u!==!1&&(u=!0),d)for(let P of d){if(P.layerId==56){let I=Pe.getLayer(56);y.push({layerId:I.layerID,layerName:I.name,layerType:I.type,status:I.layerStatus})}let T=y.find(I=>I.layerId==P.layerId);if(T){let{layerName:I,layerType:C}=T;Object.assign(P,{layerName:I,layerType:C})}else throw new Error("unknown layerId: "+P.layerId)}else{o.layerConfigs=[];for(let P of y){let{layerId:T,layerName:I,layerType:C,status:E}=P;E!==0&&o.layerConfigs.push({layerId:T,layerName:I,layerType:C,isMirror:!1})}}if(o.layerConfigs=o.layerConfigs.filter(P=>{var T;return(T=Ze.getInstance().getLayer(P.layerId))==null?void 0:T.config}),c||(o.drillMap=["PTH","NPTH"]),h==null&&(o.drillTable=!0),!p){o.objectConfigs=[];for(let P of y9e)o.objectConfigs.push(P.value)}return m||(o.mainVersion=((b=document.querySelector('meta[name="editorMainVersion"]'))==null?void 0:b.getAttribute("content"))||""),s||(o.unit="MM"),g==null&&(o.isTestExport=!1),g&&await ep.loadTextSuccess(),o.origin=R.getInstance().origin,o}async function ZI(o){return new Promise((t,e)=>{let r=new FileReader;r.onload=i=>{t({data:r.result,error:null})},r.onerror=i=>{t({data:null,error:i})},r.readAsArrayBuffer(o)})}function L_t(o){let t=M_t(o);return rWe.getConfig({stiffeners:t})}function M_t(o){let{layerConfigs:t,objectConfigs:e}=o,r=[];return o.type==="oneKeyExport"?r=[58,59]:e.includes("FPCStiffener")&&(r=t.filter(n=>ic(n.layerId)).map(n=>n.layerId)),mS().filter(n=>n.type==="FPC Stiffener"&&r.includes(n.layerId))}var jX=null,jae;function eze(o,t){if(jae){jae[o]=String(t);return}try{localStorage.setItem(o,t)}catch{jae={},jae[o]=String(t)}}function g3e(){return So.getAllItem().length}function tze(){let o=g3e(),t=we.topSilkscreenColor!=="#000000"||we.bottomSilkscreenColor!=="#000000"||we.topBoardColor!=="#FFFFFF"||we.bottomBoardColor!=="#FFFFFF",e=Qi.getInstance().getAllItem(),r=vi.getInstance().getAllItem(),i=Fi.getInstance().getAllItem(),n=sl.getInstance().getAllItem(),s=Na.getInstance().getAllItem(),a=Ma.getInstance().getAllItem(),l=io.getInstance().getAllItem(),c=Hs.getInstance().getAllItem(),h=Ms.getInstance().getAllItem(),u=[].concat(e,r,i,n,s,a,l,c),d=ee.of3("#000000"),p=u.some(g=>(3==g.layerId||4==g.layerId)&&g.getParent()==null&&g.silkColor!=null&&g.silkColor!=d),m=h.some(g=>g.silkColor!=null&&g.silkColor!=d);return o||t||p||m}function rze(){return le.pcbConfig.checkNetBeforeGerber?(eze("checkRatlineNotShowAgain",""),Wo.getAllItem().length>0):!1}function ize(){let o=Xt.getAllItem(),t=Kt.getAllItem(),e=pt.getAllItem();return[].concat(o,t,e).some(i=>ub(i.layerId))}function nze(){let o=le.pcbConfig.checkDrcBeforeGerber;return o&&eze("checkDrcNotShowAgain",""),o}function oze(o){let{allItemBbox:t,outOfBoardBBoxItems:e}=aze(),r={isQualified:!1,outOfArr:[],format:{Integer:"3",Decimals:"3"}},i=JSON.parse(JSON.stringify(t)),n=new S(0,0).sub(R.getInstance().origin);if(t!=null){if(o.type=="oneKeyExport"){let s=Math.max(Math.abs(t.maxX*.254),Math.abs(t.minX*.254)),a=Math.max(Math.abs(t.maxY*.254),Math.abs(t.minY*.254));Math.max(s,a)>1e3?(r.format={Decimals:"2",Integer:"4"},o.format=r.format):r.format=o.format}else r.format=o.format;if(e!=null&&e.length){jX={};for(let s of e)r.outOfArr.push(s.globalIndex),jX[s.globalIndex]=s}else jX=null;for(let s in i){switch(s){case"maxX":case"minX":i[s]=i[s]+n.x;break;case"maxY":case"minY":i[s]=i[s]+n.y;break}if(o.unit=="IN"){if(r.isQualified=QWe(i[s]/100,o.format),(o.format.Integer<2||o.format.Decimals<2)&&(r.isQualified=!1),!r.isQualified)return r}else if(o.unit=="MM"&&(r.isQualified=QWe(i[s]*.254,o.format),o.format.Integer<=2&&(r.isQualified=!1),!r.isQualified))return r}}else o.format&&Object.assign(r.format,o.format),r.isQualified=!0;return r}function sze(o){let e=YX().LR(),r=new De("Gerber Out Of Item Translate"),i=new S(0,0);for(let n of o){let s=jX[n];i=e.sub(s.buildBBox().UL());let a=Ae.translate(i.x,i.y,0);r.addCommand(Ce.dispatch(s,"modify")),jX[n].transform(a),he.publish("hasModifyPcbItem",s)}r.length>0&&(qe.executeCommand(r),he.publish("flushService",""))}function QWe(o,t){let e=+("1e-"+(t.Decimals+1));o>-e&&o<e&&(o=0);let r=(o+1e-12).toFixed(t.Decimals);if(!1&&r.length<=t.Integer+t.Decimals)return r.startsWith("0.")?r=r.slice(1):r.startsWith("-0.")&&(r="-"+r.slice(2)),!0;let[n="",s=""]=r.split(".");return n=(n.startsWith("-")?"-":"")?n.slice(1):n,!(n.length>t.Integer)}var $X=Ru(r2());function y3e(o,t){if(o instanceof q){let r=o.center,i=o.start().sub(r).normalize(),n=o.isCCW;t.sort((s,a)=>{let l=s.point.sub(r),c=a.point.sub(r);return e(i,l,n)-e(i,c,n)<=0?-1:1})}else if(o instanceof M){let r=o.start(),i=o.end(),n=new S(i.x+(r.x-i.x)*2,i.y+(r.y-i.y)*2);t.sort((s,a)=>s.point.distance2(n)-a.point.distance2(n)<=0?-1:1)}else if(o instanceof Dr)t.sort((r,i)=>o.getPercent(r.point)-o.getPercent(i.point)<=0?-1:1);else throw Error("not support the primitive type");function e(r,i,n){let s=r.cross(i)>0,a=Math.acos(Math.min(1,Math.max(-1,r.dot(i)/i.length())));return(n?!s:s)&&(a=Qke-a),a}}function b3e(o){if(!o.length)return 0;let t=o[0].length;for(let e=1;e<o.length;e++){let r=o[e].length;r>t&&(t=r)}return t}function XX(o,t){let e=[],r=[];return o.getBezierPoints(t,i=>{if(!e.length){e.push(i);return}let n=e.pop();r.push(new M(n,i)),e.push(i)}),e.length=0,r}function cc(o,t){if(o instanceof M)return o.direct.normalize();if(o instanceof q){let e=t.angle(o.center);return o.isCCW?e+=RTe:e-=RTe,new S(Math.cos(e),Math.sin(e)).normalize()}else throw new Error("not support")}function zA(o,t){return new S((o.x+t.x)/2,(o.y+t.y)/2)}function Sa(o,t,e=0){if(t.x===0&&t.y===0)throw Error("getEndOfExtendLine(line: Line, distance: number)");let r={x:t.normalize().x*e,y:t.normalize().y*e};return new S(o.x+r.x,o.y+r.y)}function hze(o,t,e){if(o instanceof M||t.equals1(e))return new M(t,e);if(o instanceof q)return q.build2(o.center,t.angleD(o.center),e.angleD(o.center),o.rx,o.ry,o.isCCW?ae.CCW:ae.CW);if(o instanceof Dr){let r=o.getPercent(t),i=o.getPercent(e);return o.clip(r)[1].clip((i-r)/(1-r))[0]}else throw new Error("not supported operation")}function uze(o,t){if(o.layerId!==t.layerId)return;let e=o.primitive,r=t.primitive,i=e.length(),n=r.length(),s=o.width,a=t.width;if(wTe(e,r)&&i>n&&n>a&&s>n&&s>a)return!0;let c=o.getMathGraphics(o.layerId);if(!cf(t.start,o)||p(t.start,c)<t.width/2||cf(t.end,o))return!1;return p(t.end,c)>=t.width/2;function p(m,g){return g.primitives.reduce((y,b)=>{if(b instanceof M){let P=er.foot(b,m);if(b.start().sub(P).dot(b.end().sub(P))>0)return;let T=b.distance(m);return T<y?T:y}else if(b instanceof q){let P=b.start(),T=b.end(),I=b.center;if(P.sub(I).cross(m.sub(I))*T.sub(I).cross(m.sub(I))>0)return;let C=Math.abs(b.rx-m.distance1(b.center));return C<y?C:y}else throw new Error("not support")},1/0)}}function cf(o,t){let e=t.primitive;if(e.distance(o)>t.width/2)return!1;let i=er.foot(e,o);return e.start().sub(i).dot(e.end().sub(i))<=0?!0:Math.min(o.distance1(e.start()),o.distance1(e.end()))<=t.width/2}function U6(o,t){return!!t.getWindingNum(o)}function dze(o,t){let e=o.layerId,r=o.getMathGraphics(e),i=t.getMathGraphics(e),n=r.bbox(),s=i.bbox();if(n.isContainsBBox(s)||s.isContainsBBox(n))return!0;let a=cc(o.primitive,o.start).dot(cc(t.primitive,t.start));return a>0?!(o.end.equals1(t.start)||t.end.equals1(o.start)):ne.eq(a,0)?!(o.start.equals1(t.start)||o.start.equals1(t.end)||o.end.equals1(t.start)||o.end.equals1(t.end)):!(o.start.equals1(t.start)||o.end.equals1(t.end))}function lze(o,t){let r=o.dot(t)/(o.length()*t.length());return Math.acos(r)}function P3e(o,t,e){let r=e?t.start:t.end,i=t.width/2;return ne.lesseq(o.start.distance1(r),i)?-1:ne.lesseq(o.end.distance1(r),i)?1:0}function T3e(o,t,e){let r=t.angleD(o.center),i=e.angleD(o.center);if(r===i)return e;o.sweep()===ae.CCW?i<=r&&(i+=360):i>=r&&(r+=360);let n=i-r,s;if(ne.eq(n,180)){let a=t.sub(o.center);s=o.isCCW?new S(-a.y,a.x):new S(a.y,-a.x)}else if(n>180){let a=zA(t,e);s=o.center.sub(a)}else s=zA(t,e).sub(o.center);return Sa(o.center,s,o.rx)}function I3e(o,t){return ne.eq(o.x,t.x)&&ne.eq(o.y,t.y)}function Xae(o){return ne.eq(o,1)?1:ne.eq(o,-1)?-1:ne.eq(o,0)?0:o}function C3e(o){return o.length>=o.width}function S3e(o,t,e=ae.CW){let{point:r,refPt:i}=o,{point:n,refPt:s}=t,a;if(s instanceof M)a=s.distance(r);else if(s instanceof q)a=new M(s.center,n).distance(r);else throw new Error("not support");if(ne.eq(a,0))return new M(r,n);let l;if(i instanceof M)l=i.distance(n);else if(i instanceof q)l=new M(i.center,r).distance(n);else throw new Error("not support");if(ne.eq(l,0))return new M(r,n);let c=zA(r,n);if(a>l){let h=n.sub(r),u=cc(i,r),d=new S(-u.y,u.x);d.dot(h)<0&&(d=new S(-d.x,-d.y));let p=lze(h,d);if(ne.eq(p,Math.PI/2))return new M(r,n);let m=r.distance1(c)/Math.cos(p);return q.build1(r,n,m,m,!1,e)}else{let h=r.sub(n),u=cc(s,n),d=new S(u.y,-u.x);d.dot(h)<0&&(d=new S(-d.x,-d.y));let p=lze(h,d);if(ne.eq(p,Math.PI/2))return new M(r,n);let m=n.distance1(c)/Math.cos(p);return q.build1(r,n,m,m,!1,e)}}function qX(o,t){let e=o.primitive;return cze(e.distance(t.start),0,.1)&&cze(e.distance(t.end),0,.1)}function cze(o,t,e=ne.eps){return Math.abs(o-t)<=e}function qae(o,t){let e=t.start();return o.reduce((i,n)=>{let s=n.distance2(e);return s<i.nearDis?{nearPoint:n,nearDis:s}:i},{nearPoint:null,nearDis:1/0}).nearPoint}function SV(o,t){return o.length===1?o[0]:o.reduce((e,r)=>{let i=r.distance2(t);return i<e.nearDis?{nearPoint:r,nearDis:i}:e},{nearPoint:null,nearDis:1/0}).nearPoint}function pze(o,t){let e=o.center.distance1(t),r=Math.sqrt(e**2-o.rx2),i=Math.asin(o.rx/e),n=o.center.rotate(t,i).sub(t),s=o.center.rotate(t,-i).sub(t);return[Sa(t,n,r),Sa(t,s,r)]}function qb(o,t,e){let r=o.getMathGraphics(t,e);if(!r)return null;let i=r.primitives.filter(s=>!n(s));return ge.build7(i);function n(s){if(s instanceof M)return s.direct.x===0&&s.direct.y===0||s.start().equals1(s.end());if(s instanceof q)return s.sweepAngle===0;if(s instanceof Dr){let a=new Set(s.controls.map(c=>c.x)),l=new Set(s.controls.map(c=>c.y));return a.size===1&&l.size===1}else throw new Error("not support")}}function E3e(o){let t=new _e;o.forEach(i=>{t.ext1(i.bbox())});let e=t.build();return Math.max(e.width(),e.height())}var $b;/\btearDebug\b/.test(location.search)&&(typeof window<"u"?$b=window._MSG_BUS_=window._MSG_BUS_||new $X.MessageBus:$b=new $X.WorkerMessageBridge(new $X.MessageBus,self));var O3e="-",fze=.001,$ae=class{constructor(t){this._Switch=!1;this.hideProgress=!1;this.ratio=0;this.delta=0;this.ttConnectIds={};this.tStartAndEndIds=new Map;this.padViaIds={};this.isInvalidTracks={};$b&&(this.drawDebug=new ko($b)),this.Switch=!0,this.operationType=t.operationType,this.applyScope=t.applyScope,this.tearShape=t.tearShape,this.ignoreDRC=t.ignoreDRC,this.hideProgress=t.hideProgress,this.circlePadViaChecked=t.circlePadViaChecked,this.roundWidth=t.roundWidth,this.roundeHeight=t.roundeHeight,this.specialShapedPadChecked=t.specialShapedPadChecked,this.otherWidth=t.otherWidth,this.otherHeight=t.otherHeight,this.routingChecked=t.routingChecked,this.routingWidth=t.routingWidth,this.routingHeight=t.routingHeight,this.TConnectionChecked=t.TConnectionChecked,this.TConnectionWidth=t.TConnectionWidth,this.TConnectionHeight=t.TConnectionHeight,this.ids=t.ids,this.subscribe()}get Switch(){return this._Switch}set Switch(t){this._Switch=t}subscribe(){}addTearDrop(){this.updateProgress2(1),this.updateProgress2(0);let t="addTearDrop-time";Cn(t),this.delta=1/this.ids.length;let e=[];for(let r=0,i=this.ids.length,n=Math.ceil(i/10);r<i;r++){let s=ch(this.ids[r]);if(s instanceof Ii){if(!this.circlePadViaChecked&&!this.specialShapedPadChecked)continue;let a=s.buildBBox(),l=s.layerId,c=(u,d)=>{if(d=="Pad"||d=="Via")return l==12||u==12?!0:u==l};this.map.search(a,c).filter(u=>!(u instanceof Ct||u instanceof et)||u instanceof Ct&&!u.isContains(l)?!1:u.net===s.net).forEach(u=>{this.isInvalidTrack(s)||this.isExistPadVia(u.globalIndex,s.globalIndex)||!qb(u,s.layerId,0)||(this.recordId(s,u),this.pushTearArrToContainer(u,s,e))})}else if(s instanceof zr){if(!this.routingChecked&&!this.TConnectionChecked||this.isInvalidTrack(s))continue;if(!C3e(s)){this.setTrackIsInvalid(s);continue}if(this.isExistTrack2End(s.globalIndex,!0)&&this.isExistTrack2End(s.globalIndex,!1))continue;let a=s,l=a.buildBBox(),c=a.layerId,h=(d,p)=>{if(p=="Pad"||p=="Track"||p=="ArcTrack"||p=="Via")return d==12?!0:d==c},u=this.map.search(l,h).filter(d=>d instanceof Ct?d.isContains(c):d instanceof gt?C3e(d):!0);u&&u.length&&this.getNode(a,u).forEach(p=>{this.recordId(a,p),this.pushTearArrToContainer(p,a,e)})}else if(s instanceof Ct||s instanceof et){if(!this.circlePadViaChecked&&!this.specialShapedPadChecked)continue;let a=s.buildBBox(),l=s.layerId,c=(u,d)=>{if(d=="Track"||d=="ArcTrack")return l==12||u==12?!0:u==l};this.map.search(a,c).filter(u=>!(u instanceof zr||u instanceof Ii)||s instanceof Ct&&!s.isContains(u.layerId)?!1:ne.less(u.width,u.length)).forEach(u=>{if(this.isInvalidTrack(u)||s.net!==u.net||this.isExistPadVia(s.globalIndex,u.globalIndex))return;let d=qb(s,u.layerId,0);if(!d)return;let p=U6(u.start,d),m=U6(u.end,d);if(p&&m){this.setTrackIsInvalid(u);return}this.recordId(u,s);let g=e.length;this.pushTearArrToContainer(s,u,e),e.length>g&&(p?this.recordTEnd(u.globalIndex,!0):m&&this.recordTEnd(u.globalIndex,!1))})}(r+1)%n===0&&this.updateProgress2((r+1)/i)}return this.drawDebug&&this.drawDebug.draw(),this.complete2(),Xi(t),e}pushTearArrToContainer(t,e,r){let i=this.getWHT(t,e);if(!i)return;let{type:n,width:s,height:a,shape:l,routingConnect:c,tConnection:h,standardT:u}=i;if(l){let p=e.primitive;if(!(l instanceof ge)){if($b)throw new Error("!(shape instanceof Polyline)");return}if(l=l.asClose(),!l.primitives.find(m=>{if(G0(m,p))return!0}))return}let d=this.getTears(e,s,a,n,l,c,h,u);if(d){let p=this.getGlobalIndex(e,t);if(!p)return null;d.forEach(m=>{r.push({tear:lh(m),net:e.net,layer:e.layerId,globalIndex:p})})}}getGlobalIndex(t,e){let r=[];if(e instanceof et||e instanceof Ct)r=[t.globalIndex,e.globalIndex];else{let{type:i}=e;if(i==="T_CONNECTION"){let n=new Set,{cpList:s}=e;s.forEach(a=>{n.add(a[0].tItem.globalIndex)}),r=Array.from(n)}else if(i==="ROUTING"){let{track2:n}=e;r=[t.globalIndex,n.globalIndex]}else if(i==="STANDARD_T"){let{verticalTrack:n,parallels:s}=e;r.push(n.tItem.globalIndex),s.length===2&&s[0].tItem.globalIndex===s[1].tItem.globalIndex?r.push(s[0].tItem.globalIndex):s.forEach(a=>r.push(a.tItem.globalIndex))}else throw new Error("TrackShapeType not support")}if($b&&r.length!==new Set(Array.from(r)).size)throw new Error("getGlobalIndex\u6CA1\u53BB\u91CD!!!");return r}recordId(t,e){let{type:r}=e;if(e instanceof et||e instanceof Ct)this.padViaIds[e.globalIndex]=this.padViaIds[e.globalIndex]||[e.globalIndex],this.padViaIds[e.globalIndex].push(t.globalIndex);else{let i=e,n=this.tStartAndEndIds.get(t.globalIndex);if(n?n[i.isStart?"start":"end"]=!0:this.tStartAndEndIds.set(t.globalIndex,{start:i.isStart,end:!i.isStart}),r==="ROUTING"){let{track2:s}=e;this.recordTTConnectIds(t.globalIndex,s.globalIndex)}else if(r==="T_CONNECTION"){let{cpList:s}=e;s.forEach(a=>{this.recordTTConnectIds(a[0].tItem.globalIndex,a[1].tItem.globalIndex)})}else if(r==="STANDARD_T"){let{verticalTrack:s,parallels:a}=e;a.forEach(l=>{this.recordTTConnectIds(l.tItem.globalIndex,s.tItem.globalIndex)}),a.length===2&&a[0].tItem.globalIndex!==a[1].tItem.globalIndex&&this.recordTTConnectIds(a[0].tItem.globalIndex,a[1].tItem.globalIndex)}}}getNode(t,e){var l,c;let r,i=[],n=this.isExistTrack2End(t.globalIndex,!0)?null:[],s=this.isExistTrack2End(t.globalIndex,!1)?null:[],a=h=>{let u=qb(h,t.layerId,0);u&&(h instanceof et||h instanceof Ct?U6(t.start,u)?n&&n.push(h):U6(t.end,u)?s&&s.push(h):i.push(h):h instanceof zr&&(cf(t.start,h)?n&&n.push(h):cf(t.end,h)&&s&&s.push(h)))};for(let h=0;h<e.length;h++){let u=e[h];if(!(t.globalIndex===u.globalIndex||t.net!==u.net)){if(u instanceof et||u instanceof Ct){if(this.isExistPadVia(u.globalIndex,t.globalIndex))continue;let d=qb(u,t.layerId,0);if(!d)continue;if(U6(t.start,d)&&U6(t.end,d))return this.setTrackIsInvalid(t),[];a(u)}else if(u instanceof zr){if(this.isInvalidTrack(u)||this.isExistTTConnect(t.globalIndex,u.globalIndex)||cf(u.start,t)&&cf(u.end,t))continue;if(cf(t.start,u)&&cf(t.end,u)){if(uze(u,t))return this.setTrackIsInvalid(t),[];continue}if(this.isIntersectAndParallel(u,t)&&dze(t,u)){if(r)return[];r=u;continue}a(u)}}}if(r){if(n&&cf(t.start,r)){if(n.findIndex(u=>{if(u instanceof zr&&this.isIntersectAndParallel(r,u))return!0})!==-1)return[];n.push(r)}else if(s&&cf(t.end,r)){if(s.findIndex(u=>{if(u instanceof zr&&this.isIntersectAndParallel(r,u))return!0})!==-1)return[];s.push(r)}}return n&&((l=this.analysisGroup(t,n,!0))==null||l.forEach(h=>i.push(h))),s&&((c=this.analysisGroup(t,s,!1))==null||c.forEach(h=>i.push(h))),i}setTrackIsInvalid(t){this.isInvalidTracks[t.globalIndex]=t}analysisGroup(t,e,r){if(e.length){if(e.length===1)return this.node1v1(t,e[0],r);if(e.length>1)return this.node1vMore(t,e,r)}else return[]}node1v1(t,e,r){let i=[];if(e instanceof et||e instanceof Ct)i.push(e);else if(e instanceof zr){let n=P3e(e,t,r);if(n)ne.greater(Math.abs(e.width-t.width),fze)&&(i.push({track2:e,type:"ROUTING",isStart:r}),this.recordTEnd(e.globalIndex,n===-1));else{let s=this.splitTrack(e,t);if(!s.length||!this.TConnectionChecked)return;let a=[];s.forEach(l=>{a.push({tItem:l,isStart:!0})}),i.push({parallels:a,type:"STANDARD_T",verticalTrack:{tItem:t,isStart:r}})}}return i}node1vMore(t,e,r){let i=[],n=this.getTrackRelation(t,e,r);if(!n)return;let{nodes:s,containerTrack:a}=n,{maxNode:l,maxBBoxHeigth:c}=this.getMaxNode(t,s);if(a.length===1){let h=a[0],u=Math.max(h.tItem.width,t.width);if(!c||u>c){if(!this.routingChecked)return;ne.greater(Math.abs(t.width-h.tItem.width),fze)?i.push({type:"ROUTING",track2:h.tItem,isStart:r}):i.push({type:"STANDARD_T",parallels:a,verticalTrack:{tItem:t,isStart:r}}),this.recordTEnd(h.tItem.globalIndex,h.isStart)}else c&&u<c&&i.push(l)}else if(a.length>1){let h=[],u=0;if(a.forEach(d=>{d.tItem.width>u&&(u=d.tItem.width),(!c||d.tItem.width>c)&&h.push(d)}),c&&l&&u<c&&i.push(l),h.length){if(!this.TConnectionChecked)return;let d;if(h.length===2){let p=h[0].tItem,m=h[1].tItem,g,y,b;qX(p,m)?qX(t,p)||(y=h[0],b=h[1],g={tItem:t,isStart:r}):qX(t,p)?(y=h[0],b={tItem:t,isStart:r},g=h[1]):qX(t,m)&&(y=h[1],b={tItem:t,isStart:r},g=h[0]),y&&y.tItem.width===b.tItem.width&&(d=!0,i.push({type:"STANDARD_T",parallels:[y,b],verticalTrack:g}),h.forEach(P=>{this.recordTEnd(P.tItem.globalIndex,P.isStart)}))}if(!d){let p=[],m=this.sortT(h,t,r);for(let g=0,y=m.length;g<y;g++){let b=m[g],P=m[(g+1)%y];p.push([b,P])}p.length&&(i.push({cpList:p,type:"T_CONNECTION",isStart:r}),h.forEach(g=>{this.recordTEnd(g.tItem.globalIndex,g.isStart)}))}}}else l&&i.push(l);return i}sortT(t,e,r){var p,m;let i=r?e.start:e.end,n=r?e.end.sub(e.start).normalize():e.start.sub(e.end).normalize(),s=new S(-n.y,n.x).normalize(),a=new Array,l=new Array;t.forEach(g=>{let y,b,P=g.tItem;if(g.isStart!==void 0?g.isStart?y=P.end.sub(P.start).normalize():(y=P.start.sub(P.end).normalize(),b=!0):P.start.distance1(i)<P.end.distance1(i)?y=P.end.sub(P.start).normalize():P.start.distance1(i)>P.end.distance1(i)&&(y=P.start.sub(P.end).normalize(),b=!0),y){let T=zt.toDegrees(Math.acos(Xae(y.dot(s))));T<90?l.push({direct:y,trackInfo:g}):T>90?a.push({direct:y,trackInfo:g}):n.cross((b?P.start:P.end).sub(r?e.start:e.end))>0?l.push({direct:y,trackInfo:g}):a.push({direct:y,trackInfo:g})}});let c=(p=d(l,!0))==null?void 0:p.map(g=>g.trackInfo),h=(m=d(a,!1))==null?void 0:m.map(g=>g.trackInfo),u=[{tItem:e,isStart:r}];return c==null||c.forEach(g=>u.push(g)),h==null||h.forEach(g=>u.push(g)),u;function d(g,y){if(g.length)return g.length===1?g:g.sort((b,P)=>{let{direct:T}=b,{direct:I}=P,C=zt.toDegrees(Math.acos(Xae(n.dot(T)))),E=zt.toDegrees(Math.acos(Xae(n.dot(I))));if(Math.abs(C-E)<=.1){let V=function(W,L){let k,N=y?-1/0:1/0,U=B();for(let G of L.primitives){let Y=G0(W,G);for(let X=0;X<Y;X+=2){let K=new S($e[0],$e[1]),J=K.distance1(W.start());U(J,N)&&(k=K,N=J)}}function B(){return y?(G,Y)=>G>Y:(G,Y)=>G<Y}return k},O=(r?e.primitive:e.primitive.reverse()).panDistance(e.width/2),_=O.start(),x=new M(_,Sa(O.end(),O.direct,O.length())),v=b.trackInfo.tItem,D=P.trackInfo.tItem,w=qb(v,e.layerId,0),F=qb(D,e.layerId,0),H=V(x,w),z=V(x,F);if(H&&z)return y?z.distance1(_)-H.distance1(_):H.distance1(_)-z.distance1(_);if(H)return y?-1:1;if(z)return y?1:-1;{let W=Sa(b.trackInfo.isStart?v.start:v.end,new S(T.y,-T.x),v.width/2),L=Sa(P.trackInfo.isStart?D.start:D.end,new S(I.y,-I.x),D.width/2);return y?W.distance1(_)-L.distance1(_):L.distance1(_)-W.distance1(_)}}return y?C-E:E-C})}}getTrackRelation(t,e,r){let i=new Array,n=[],s=[];for(let l=0;l<e.length;l++){let c=e[l];if(c instanceof Ct||c instanceof et)i.push(c);else if(c instanceof zr){let p=function(m,g){let y=[],b=!0;for(let P of m){let T=P instanceof zr?P:P.tItem;if(b&&cf(g.start,T)&&cf(g.end,T))return{isAllContainerPoint:!0};if(cf(T.start,g)&&cf(T.end,g)){b=!1;continue}y.push(P)}return y},h=p(n,c);if(h.isAllContainerPoint)continue;h.length!==n.length&&(n=h);let u=p(s,c);if(u.isAllContainerPoint)continue;u.length!==s.length&&(s=u);let d=P3e(c,t,r);if(d){let m=d===-1;n.push({tItem:c,isStart:m})}else s.push(c)}}s.forEach(l=>{let c=this.splitTrack(l,t),h=[];c.forEach(u=>{u!==null&&(a(l,u)||h.push({tItem:u,isStart:!0,notIsOriginTrack:!0}))}),h.forEach(u=>n.push(u))});function a(l,c){for(let h of n){let u=h instanceof zr?h:h.tItem;if(cf(c.start,u)&&cf(c.end,u))return!0}return s.findIndex(h=>{if(h!==l&&cf(c.start,h)&&cf(c.end,h))return!0})!==-1}return n.length===1&&n[0].tItem.width===t.width&&!n[0].notIsOriginTrack&&(n.length=0),{nodes:i,containerTrack:n}}distanceLessHalfWidth(t,e){let r=this.getTrackIntersPoint(t,e);if(!r)return null;let{start:i,end:n}=t,s=r.distance1(i),a=r.distance1(n),l=t.width/2;return s<=l||a<=l}splitTrack(t,e){let r=this.getTrackIntersPoint(t,e);if(!r)return[];let i=this.getLine(t),n=er.foot(i,r);if(i.start().sub(n).dot(i.end().sub(n))>=0)return[];let{net:s,layerId:a,start:l,end:c,width:h,globalIndex:u,locked:d}=t,p=n.distance1(l),m=n.distance1(c),g=t.width/2;return p<g&&m<g?[]:p<g?[new zr(u,a,n,c,h,d,s)]:m<g?[new zr(u,a,n,l,h,d,s)]:[new zr(u,a,n,l,h,d,s),new zr(u,a,n,c,h,d,s)]}getMaxNode2(t,e){let i=t.end.sub(t.start).normalize().angle(S.ORIGIN),n=Ae.rotateZForPoint(t.start,-i),s,a;if(e.length){a=e[0],s=a.multiply3(n).bbox().height();for(let c=1;c<e.length;c++){let h=e[c],d=h.multiply3(n).bbox().height();s<d&&(a=h,s=d)}}return{maxNode:a,maxBBoxHeigth:s}}getMaxNode(t,e){let r=t.end.sub(t.start).normalize(),i,n;if(e.length){i=-1/0;for(let s=0;s<e.length;s++){let a=e[s],l=qb(a,t.layerId),c=l.primitives.length===1&&l.primitives[0]instanceof q?l.bbox().height():l.getMaxBBoxHeightByVec(r);c>i&&(n=a,i=c)}}return{maxNode:n,maxBBoxHeigth:i}}recordTTConnectIds(t,e){let r=[t,e].sort().join(O3e);this.ttConnectIds[r]=!0}recordTEnd(t,e){let r=this.tStartAndEndIds.get(t);r?r[e?"start":"end"]=!0:this.tStartAndEndIds.set(t,{start:e,end:!e})}removeTEnd(t,e){let r=this.tStartAndEndIds.get(t);r&&(r[e?"start":"end"]=!1)}isExistTTConnect(t,e){let r=[t,e].sort().join(O3e);return this.ttConnectIds[r]}removeTTConnect(t,e){let r=[t,e].sort().join(O3e);this.ttConnectIds[r]=!1}isExistTrack2End(t,e){let r=this.tStartAndEndIds.get(t);return r?e?r.start:r.end:!1}isExistPadVia(t,e){var r;return(r=this.padViaIds[t])==null?void 0:r.includes(e)}isInvalidTrack(t){return!!this.isInvalidTracks[t.globalIndex]}getWHT(t,e){let r,i,n;if(t instanceof et){let s=e.layerId===1?t.top:e.layerId===2?t.bottom:t.inner;if(n=qb(t,e.layerId,0),!n)return null;let a=s.type;if(a=="ELLIPSE"){if(!this.circlePadViaChecked)return null;r=s.width*this.roundWidth,i=s.width*this.roundeHeight}else{if(!this.specialShapedPadChecked)return null;r=e.width*this.otherWidth,i=e.width*this.otherHeight}return{type:a,width:r,height:i,shape:n}}else if(t instanceof Ct){if(n=qb(t,e.layerId,0),!n)return null;let s="ELLIPSE";if(!this.circlePadViaChecked)return null;let a=t.radius*2;return r=a*this.roundWidth,i=a*this.roundeHeight,{type:s,width:r,height:i,shape:n}}else if(t.type==="ROUTING"){if(!this.routingChecked)return null;let{track2:s}=t,a=Math.max(e.width,s.width);return r=a*this.routingWidth,i=a*this.routingHeight,{type:t.type,width:r,height:i,routingConnect:{...t}}}else if(t.type==="T_CONNECTION"){if(!this.TConnectionChecked)return null;let{cpList:s}=t,a=[];return s.forEach(l=>{let c=Math.max(l[0].tItem.width,l[1].tItem.width);r=c*this.TConnectionWidth,i=c*this.TConnectionHeight,a.push({width:r,height:i,tracks:l})}),{type:t.type,tConnection:{tCPList:a,isStart:t.isStart}}}else if(t.type==="STANDARD_T"){if(!this.TConnectionChecked)return null;let{parallels:s,verticalTrack:a}=t,l=Math.max(...s.map(c=>c.tItem.width),a.tItem.width);return l===a.tItem.width&&this.TConnectionWidth<=1?null:(r=l*this.TConnectionWidth,i=l*this.TConnectionHeight,{type:t.type,width:r,height:i,standardT:t})}}getAngle(t,e){let r,i,n=Math.max(t.width,e.width);if(t.start.distance1(e.start)<n?(r=t.end.sub(t.start).normalize(),i=e.end.sub(e.start).normalize()):t.start.distance1(e.end)<n?(r=t.end.sub(t.start).normalize(),i=e.start.sub(e.end).normalize()):t.end.distance1(e.start)<n?(r=t.start.sub(t.end).normalize(),i=e.end.sub(e.start).normalize()):t.end.distance1(e.end)<n&&(r=t.start.sub(t.end).normalize(),i=e.start.sub(e.end).normalize()),r&&i)return zt.toDegrees(Math.acos(r.dot(i)))}isIntersectAndParallel(t,e){let r=t.end.sub(t.start),i=e.end.sub(e.start);return this.isParallel(r,i)}getTears(t,e,r,i,n,s,a,l){if(i==="ROUTING"){let c=this.dispatchRouting(t,s,e,r);if(c)return[c]}else if(i==="T_CONNECTION"){let c=this.dispatchTConnection(t,a);if(c)return[c]}else if(i==="STANDARD_T"){let c=this.dispatchStandardT(l,e,r);if(c)return[c]}else return i!="ELLIPSE"?this.dispatch(n,t,e,r,i):this.dispatchArc(n,t,e,r)}dispatchStandardT(t,e,r){let i=[],{parallels:n,verticalTrack:s}=t,a=s.tItem,l=s.isStart?a.primitive:a.primitive.reverse(),c=l.direct,h=(e-a.width)/2,u,d,p;if(n.forEach(b=>{let P=b.isStart?b.tItem.primitive:b.tItem.primitive.reverse();u=u?zA(u,P.start()):P.start();let T=P.direct,I=c.cross(T),C,E,O;I<0?(E=l.panDistance(-a.width/2),C=P.panDistance(b.tItem.width/2),O=!1):(E=l.panDistance(a.width/2),C=P.panDistance(-b.tItem.width/2),O=!0);let _=G0(C,E),x,v;if(_===0){if(x=r>E.length()?E.end():Sa(E.start(),c,r),v=h>C.length()?C.end():Sa(C.start(),T,h),O){if(T.cross(x.sub(C.start()))>0||c.cross(v.sub(E.start()))<0)return}else if(T.cross(x.sub(C.start()))<0||c.cross(v.sub(E.start()))>0)return}else if(_===2){let D=new S($e[0],$e[1]),w=D.distance1(E.end()),F=D.distance1(C.end());x=r>w?E.end():Sa(D,c,r),v=h>F?C.end():Sa(D,T,h)}else throw new Error("dispatchStandardT_intersection");d?(g(d,u),g(u,v),this.tearShape==="line"?g(v,x):y({point:v,refPt:C},{point:x,refPt:E},O?ae.CCW:ae.CW),d=x):(this.tearShape==="line"?g(x,v):y({point:x,refPt:E},{point:v,refPt:C},O?ae.CW:ae.CCW),p=x,d=v)}),!i.length)return null;i.length===1?(g(d,u),g(u,p)):g(d,p);let m=ge.build2(i);if($b&&m&&Eo(m))throw this.drawDebug.initColor(ee.RED).addPly(m),this.drawDebug.draw(),new Error("selfIntersectionCheck(pl)");function g(b,P){I3e(b,P)||i.push(new M(b,P))}function y(b,P,T){i.push(S3e(b,P,T))}return m}dispatchTConnection(t,e){let r=[],{tCPList:i,isStart:n}=e,s,a,l;if(i.forEach((h,u)=>{let{tracks:[d,p],height:m}=h,g=d.tItem,y=p.tItem,b=d.isStart?g.primitive:g.primitive.reverse(),P=p.isStart?y.primitive:y.primitive.reverse(),T=b.panDistance(g.width/2),I=P.panDistance(-y.width/2),C,E,O=T,_=I,x=G0(T,I),v;if(x===0){let w=function(F,H,z,V){if(V)return;let W,L,k,N=qb(F,F.layerId,0).primitives.filter(J=>J instanceof q);for(let J of N){let se,ce=G0(H,J);if(ce===2)se={point:new S($e[0],$e[1]),refPt:J};else if(ce===4){let te=new S($e[0],$e[1]),oe=new S($e[2],$e[3]);se={point:H.start().distance1(te)>H.start().distance1(oe)?te:oe,refPt:J}}se&&(!k||H.start().distance1(k.point)<H.start().distance1(se.point))&&(k=se)}if(!k)return;let{point:U,refPt:B}=k,G,Y=cc(B,U),X=H.direct.cross(Y);if(ne.eq(X,0)&&H.direct.dot(Y)>0?B=B.reverse():z?X>0&&(B=B.reverse()):X<0&&(B=B.reverse()),G=B.end(),m>=B.rx)W=T3e(B,U,T3e(B,U,B.end()));else{let J=U.sub(B.center),se=Math.sqrt(B.rx2-m**2),ce=Sa(B.center,J,se),te=new S(J.y,-J.x),oe=Sa(ce,te,m);z?W=G.sub(B.center).cross(oe.sub(B.center))<0?G:oe:W=G.sub(B.center).cross(oe.sub(B.center))>0?G:oe}let K=U.distance1(H.end());return L=m>K?H.end():Sa(U,H.direct,m),{points:[W,L],arcPt:B}};ne.neq(g.width,y.width)&&(this.removeTTConnect(g.globalIndex,y.globalIndex),g!==t&&!d.notIsOriginTrack&&this.removeTEnd(g.globalIndex,d.isStart),y!==t&&!p.notIsOriginTrack&&this.removeTEnd(y.globalIndex,p.isStart)),v=!0;let D=w.call(this,y,T,!1,cf(T.end(),y));if(D)[E,C]=D.points,_=D.arcPt;else{let F=w.call(this,g,I,!0,cf(I.end(),g));if(F)[C,E]=F.points,O=F.arcPt;else{if(u<i.length-1||!l){let H=zA(b.start(),P.start());s&&c(s,H),s=H,a||(a=H),l=!0}return}}}else{let D;if(x===2)D=new S($e[0],$e[1]);else if(x===4)D=zA(new S($e[0],$e[1]),new S($e[2],$e[3]));else throw new Error("dispatchTConnection2!!!");if(ne.eq(T.direct.cross(I.direct),0))C=D,E=D;else{let w=D.distance1(T.end()),F=D.distance1(I.end());C=m>w?T.end():Sa(D,T.direct,m),E=m>F?I.end():Sa(D,I.direct,m)}}C&&E&&(a||(a=C),s&&c(s,C),s=E,this.tearShape==="line"||v?c(C,E):r.push(S3e({point:C,refPt:O},{point:E,refPt:_})))}),r.length<2)return null;if(c(s,a),r.length){let h=ge.build2(r);if($b&&h&&Eo(h))throw this.drawDebug.initColor(ee.RED).addPly(h),this.drawDebug.draw(),new Error("selfIntersectionCheck");return h}function c(h,u){I3e(h,u)||r.push(new M(h,u))}}dispatchRouting(t,e,r,i){let n,{track2:s}=e,a,l;t.width>s.width?(a=qb(t,s.layerId,0),l=s):(a=qb(s,t.layerId,0),l=t,t.width===s.width&&(l.width=l.width-1));let c=a.area(.1)>0,h=this.calculate4PointsForPadAndVia(a,c,l,r,i,e.type);return h==null||h.forEach(u=>{let{topLeft:d,topRight:p,bottomLeft:m,bottomRight:g}=u;if(this.tearShape==="line"){let y=ge.build4([d.point,m.point,g.point,p.point]).asClose();if($b&&y&&Eo(y))throw this.drawDebug.initColor(ee.RED).addPly(y),this.drawDebug.draw(),new Error("selfIntersectionCheck(pl)");n=y}else{let y=this.jointPointByArc(a,u,t.width,e.type);y&&(n=y)}}),n}translationLine(t,e,r){if(t instanceof M){let i=r.mul(e);return new M(t.start().add(i),t.end().add(i))}else{let i=t.rx;return i<=e?null:q.build2(t.center,t.startAngle,t.endAngle(),i-e,i-e,t.sweep())}}getTrackIntersPoint(t,e){let r=this.getLine(t),i=this.getLine(e),n=this.getInters(r,i),s;if(n.length===1)s=n[0];else return this.getShapePoint(t,e);return s}getShapePoint(t,e){let r=this.getLine(e),i,n=this.getPoints(qb(t,e.layerId,0),r);if(n.length===1)i=n[0].point;else if(n.length===2&&n[0].point.equals(n[1].point))i=n[0].point;else return;return i}dispatch(t,e,r,i,n){if(t!=null){let s=[];return t.primitives[0]instanceof q&&ne.eq(Math.abs(t.primitives[0].sweepAngle),360)?s=this.calculateCirclePadAndVia(t.primitives[0],e,r,i):s=this.calculatePadAndViaToTrack(t,e,r,i,n),s.length?s:null}return null}calculatePadAndViaToTrack(t,e,r,i,n){let s=E3e([t,e.getMathGraphics()]),a=t.area(.1)>0,l=this.calculate4PointsForPadAndVia(t,a,e,r,i,n),c=[];return l==null||l.forEach(h=>{let{topLeft:u,topRight:d,bottomLeft:p,bottomRight:m,trackInterInfo:g}=h;if(u!=null&&d!=null&&p!=null&&m!=null)if(this.tearShape==="line"){let y=ge.build4([u.point,p.point,m.point,d.point]).asClose();if($b&&y&&Eo(y))throw this.drawDebug.initColor(ee.RED).addPly(y),this.drawDebug.draw(),new Error("selfIntersectionCheck(pl)");c.push(y)}else{let y;if(n&&n==="OVAL"?y=this.jointPointByBezier(a,h,e.width,n,s,void 0):y=this.jointPointByArc(t,h,e.width,n),$b&&y&&Eo(y))throw this.drawDebug.initColor(ee.RED).addPly(y),this.drawDebug.draw(),new Error("selfIntersectionCheck(pl)");y&&c.push(y)}else return null}),c}calculate4PointsForPadAndVia(t,e,r,i,n,s){let a=this.getLine(r),l=this.getPointsAndRefPt(t,a);if(!l.length)return[];let c=(a instanceof M?a.panDistance:a.panDistance1).bind(a),h=c(r.width/2),u=c(-r.width/2),d=this.getPointsAndRefPt(t,h),p=this.getPointsAndRefPt(t,u);if(!d.length&&!p.length)return[];let m=b3e([l,d,p]),g=[];for(let P=0;P<m;P++){let T=l[P],I=d[P],C=p[P];if(!I&&!C)break;if(!T){if(T=l[P-1],!T)return;T.refPt.length<2&&(g.pop(),(I&&I.refPt.length<2||C&&C.refPt.length<2)&&(I||(I=d[P-1]),C||(C=p[P-1])))}let E,O,_;if(T.refPt.length===1){let x=T.refPt[0];E={point:T.point,refPt:x},I&&(O={point:I.point,refPt:I.refPt.length===1?I.refPt[0]:x}),C&&(_={point:C.point,refPt:C.refPt.length===1?C.refPt[0]:x})}else if(T.refPt.length===2){let x;if(I){if(I.refPt.length!==1)throw new Error("leftInter.refPt.length !== 1");x=I.refPt[0],O={point:I.point,refPt:x}}if(C){if(C.refPt.length!==1)throw new Error("leftInter.refPt.length !== 1");x=C.refPt[0],_={point:C.point,refPt:x}}E={point:T.point,refPt:x}}else throw new Error("midInter.refPt.size!!!");g.push({left:O,mid:E,right:_})}let y=[],b=i/2;return g.forEach(P=>{let{mid:T,left:I,right:C}=P,E=cc(T.refPt,T.point).cross(cc(a,T.point));if(E===0){if(s!=="POLYGON"&&I&&C)throw new Error("leftInterInfo && rightInterInfo");E=I?cc(I.refPt,I.point).cross(cc(h,I.point)):cc(C.refPt,C.point).cross(cc(u,C.point))}let O=e?E<0:E>0,_=a,x=h,v=u,D,w,F,H,z,V;if(!O){let B=I;I=C,C=B;let G=x.reverse();x=v.reverse(),v=G,_=a.reverse()}if(I&&C){if(ne.eq(I.point.distance1(C.point),T.refPt.start().distance1(T.refPt.end())))return;if(I.refPt===C.refPt){let B=T.refPt,G=T.point,Y=C.point.sub(I.point).normalize(),X=Y.dot(cc(B,G))>0,K,J;if(X?(K=B.start(),J=B.end()):(K=B.end(),J=B.start()),B instanceof M){let se=I.point;b<G.distance1(se)?D=se.distance1(K)>b?Sa(se,Y,-b):K:D=G.distance1(K)>b?Sa(G,Y,-b):K;let ce=C.point;b<G.distance1(ce)?w=ce.distance1(J)>b?Sa(ce,Y,b):J:w=G.distance1(J)>b?Sa(G,Y,b):J}else if(B instanceof q){let se=G.sub(B.center).normalize(),ce=new S(se.y,-se.x);if(B.rx<b)D=Sa(B.center,ce,-B.rx),w=Sa(B.center,ce,B.rx);else{let te=Math.sqrt(B.rx2-b**2),oe=Sa(B.center,se,te);D=Sa(oe,ce,-b),w=Sa(oe,ce,b),K.sub(B.center).normalize().cross(D.sub(B.center).normalize())>0&&(D=K),J.sub(B.center).normalize().cross(w.sub(B.center).normalize())<0&&(w=J)}}else throw new Error("not support")}else{let B=i/2-r.width/2;D=U(I,!0,B,T.point),w=U(C,!1,B,T.point)}z={point:D,refPt:I.refPt},V={point:w,refPt:C.refPt}}else if(I)D=U(I,!0,i/2-r.width/2,T.point),w=U(T,!1,i/2,I.point),z={point:D,refPt:I.refPt},V={point:w,refPt:T.refPt};else if(C)D=U(T,!0,i/2,C.point),w=U(C,!1,i/2-r.width/2,T.point),z={point:D,refPt:T.refPt},V={point:w,refPt:C.refPt};else throw new Error("!leftInterInfo && !rightInterInfo");let W,L;if(x instanceof q){let B=D.distance2(x.center);W=x.isCCW?B>=x.rx2:B<=x.rx2}else x instanceof M&&(W=x.direct.cross(D.sub(x.start()))<=0);if(v instanceof q){let B=w.distance2(v.center);L=v.isCCW?B<=v.rx2:B>=v.rx2}else x instanceof M&&(L=v.direct.cross(w.sub(v.start()))>=0);if(W&&L)return;let k=new M(D,w),N=this.getTearTop2Point(_,x,v,D,w,T.point,n,r.width,t);if(!N||([F,H]=N,k.direct.cross(F.sub(k.start()))<=0||k.direct.cross(H.sub(k.start()))<=0))return;y.push({topLeft:{point:F,refPt:x},topRight:{point:H,refPt:v},bottomLeft:z,bottomRight:V,middleLine:_,trackInterInfo:{left:I,right:C}});function U(B,G,Y,X){let K=B.refPt,J=B.point,se,ce=cc(K,J),te=J.sub(X).dot(ce)>0,oe=te?K.end():K.start();if(K instanceof q){let $=J.sub(K.center);if(K.rx<Y)return oe;let fe=Math.sqrt(K.rx2-Y**2),Oe=Sa(K.center,$,fe),Te=G?new S(-$.y,$.x):new S($.y,-$.x);se=Sa(Oe,Te,Y),G?oe.sub(K.center).normalize().cross(se.sub(K.center).normalize())>0&&(se=oe):oe.sub(K.center).normalize().cross(se.sub(K.center).normalize())<0&&(se=oe)}else if(K instanceof M){let $=G?x:v,fe=te?ce:new S(-ce.x,-ce.y),Oe=cc($,J),ue=Oe.dot(ce)>0?ce:new S(-ce.x,-ce.y),be=Math.acos(ue.dot(Oe)/(ue.length()*Oe.length())),j=ne.eq(Math.sin(be),0)?0:Y/Math.sin(be);J.distance1(oe)>j?se=Sa(J,fe,j):se=oe}else throw new Error("not support");return se}}),y}jointPointByBezier(t,e,r,i,n,s=.01){let{topLeft:a,topRight:l,bottomLeft:c,bottomRight:h,trackInterInfo:u}=e,d=cc(l.refPt.reverse(),l.point),p=cc(a.refPt.reverse(),a.point),m=cc(t?c.refPt.reverse():c.refPt,c.point),g=cc(t?h.refPt:h.refPt.reverse(),h.point),y=this.getTop2PointLink(a,l,p,d,r),b=this.getLimit(l.point,d,h.point,g,n,!0),P=[l.point,l.point.add(d.mul(b[0])),h.point.add(g.mul(b[1])),h.point],T=this.getBezier(P),I=this.getBot2PointLink(h,c,g,m,u,i),C=this.getLimit(a.point,p,c.point,m,n,!0),E=[c.point,c.point.add(m.mul(C[1])),a.point.add(p.mul(C[0])),a.point],O=this.getBezier(E),_=XX(T,s),x=XX(O,s),v=ge.build2([].concat(y,_,I,x));if($b&&v&&Eo(v))throw this.drawDebug.initColor(ee.RED).addPly(v),this.drawDebug.draw(),new Error("selfIntersectionCheck(pl)");return v}jointPointByArc(t,e,r,i){let{topLeft:n,topRight:s,bottomLeft:a,bottomRight:l,trackInterInfo:c}=e,h=cc(s.refPt.reverse(),s.point),u=cc(n.refPt.reverse(),n.point),d=cc(a.refPt,a.point),p=cc(l.refPt,l.point),m=s.point.sub(n.point);d.dot(m)<0&&(d=new S(-d.x,-d.y)),p.dot(m)>0&&(p=new S(-p.x,-p.y));let g=this.getTop2PointLink(n,s,u,h,r),y=I(s.point,l,!0,!1,h,p),b=this.getBot2PointLink(l,a,p,d,c,i),P=I(n.point,a,!1,!0,u,d),T=ge.build2([].concat(g,y,b,P)).asClose();if($b&&T&&Eo(T))throw this.drawDebug.initColor(ee.RED).addPly(T),this.drawDebug.draw(),new Error("selfIntersectionCheck(pl)");return T;function I(C,E,O,_,x,v){let D=[],w=E.point,F=zA(C,w),H=!!t.getWindingNum(F),z=_?[ae.CW,ae.CCW]:[ae.CCW,ae.CW],V=O?z[0]:z[1];if(H){let Y=hze(cc(E.refPt,w).dot(C.sub(E.point))>=0?E.refPt:E.refPt.reverse(),w,F);w=Y.end(),Y=O?Y.reverse():Y,D.push(Y),F=zA(C,w)}let[W,L]=O?[C,w]:[w,C],k=new M(C,C.add(x)),N=k.distance2(w);if(ne.eq(N,0))return[new M(W,L)];if(new M(w,w.add(v)).distance2(C)>N){let Y=w.sub(C),X=new S(x.y,-x.x);X.dot(Y)<0&&(X=new S(-X.x,-X.y));let K=G(Y,X);if(ne.eq(K,Math.PI/2))return D.push(new M(W,L)),D;let J=C.distance1(F)/Math.cos(K);D.push(q.build1(W,L,J,J,!1,V))}else{let Y=C.sub(w),X=new S(v.y,-v.x);X.dot(Y)<0&&(X=new S(-X.x,-X.y));let K=G(Y,X);if(ne.eq(K,Math.PI/2))return D.push(new M(W,L)),D;let J=w.distance1(F)/Math.cos(K);D.push(q.build1(W,L,J,J,!1,V))}return O?D.reverse():D;function G(Y,X){let J=Y.dot(X)/(Y.length()*X.length());return Math.acos(J)}}}getBot2PointLink(t,e,r,i,n,s){let{point:a,refPt:l}=t,{point:c,refPt:h}=e,{left:u,right:d}=n;if(s!=="POLYGON")return[new M(a,c)];let p,m=a;if(d)if(m=d.point,l instanceof M)p=new M(a,m);else if(l instanceof q)p=q.build1(a,m,l.rx,l.ry,l.isLarge(),ae.CCW);else throw new Error("not support");let g,y=c;if(u)if(y=u.point,h instanceof M)g=new M(y,c);else if(h instanceof q)g=q.build1(y,c,h.rx,h.ry,h.isLarge(),ae.CCW);else throw new Error("not support");return[p,new M(m,y),g].filter(b=>b)}dispatchArc(t,e,r,i){if(t!=null&&t.primitives[0]instanceof q){let n=this.calculateCirclePadAndVia(t.primitives[0],e,r,i);return n.length?n:null}return null}calculateCirclePadAndVia(t,e,r,i){let n=this.getLine(e),s=P(t,n);if(!s.length)return[];let a=(n instanceof M?n.panDistance:n.panDistance1).bind(n),l=a(e.width/2),c=a(-e.width/2),h=P(t,l),u=P(t,c),d=t.isCCW;if(!h.length&&!u.length)return[];let p=b3e([s,h,u]),m=[];for(let T=0;T<p;T++){let I=s[T],C=h[T],E=u[T];if(!C&&!E)break;I||(I=s[T-1]);let O,_,x;O=I.point,C&&(_=C.point),E&&(x=E.point),m.push({left:_,mid:O,right:x})}let g=[],y=r/2,b=E3e([ge.build7([t]),e.getMathGraphics()]);m.forEach(T=>{let{mid:I,left:C,right:E}=T,O=cc(t,I).cross(cc(n,I));if(O===0){if(C&&E)throw new Error("leftInterPoint && rightInterPoint");O=C?cc(t,C).cross(cc(l,C)):cc(t,E).cross(cc(c,E))}let _=d?O<0:O>0,x=n,v=l,D=c,w,F,H,z;if(!_){let N=C;C=E,E=N;let U=v.reverse();v=D.reverse(),D=U,x=n.reverse()}if(C&&E){if(ne.eq(C.distance1(E),t.rx*2))return;let U=I.sub(t.center).normalize(),B=t.rx>=y?Math.sqrt(t.rx2-y**2):t.rx;if(y<=e.width/2)w=k(t,C,!0,B,I,this.drawDebug),F=k(t,E,!1,B,I,this.drawDebug),i+=w.distance1(F)-r;else{let Y=new M(C,E).distance(t.center);(B>=Y||B===0)&&(B=Y/2,y=Math.sqrt(t.rx2-B**2));let X=Sa(t.center,U,B),K=new S(U.y,-U.x);w=Sa(X,K,-y),F=Sa(X,K,y)}}else if(C)w=k(t,C,!0,Math.abs(r/2-e.width/2),I,this.drawDebug),F=k(t,I,!1,r/2,C,this.drawDebug);else if(E)w=k(t,I,!0,r/2,E,this.drawDebug),F=k(t,E,!1,Math.abs(r/2-e.width/2),I,this.drawDebug);else throw new Error("!leftInterInfo && !rightInterInfo");let V=new M(w,F),W=this.getTearTop2Point(x,v,D,w,F,I,i,e.width,ge.build2([t]));if(!W||([H,z]=W,V.direct.cross(H.sub(V.start()))<=0||V.direct.cross(z.sub(V.start()))<=0))return;let L=this.getTearByFourPoint(H,z,F,w,t,v,D,e.width,b);L&&g.push(L);function k(N,U,B,G,Y,X){let K=U,J=Y.sub(N.center),se=B?new S(-J.y,J.x):new S(J.y,-J.x),ce=Sa(N.center,se,N.rx),te,oe=K.sub(N.center);if(N.rx<G)return ce;let $=Math.sqrt(N.rx2-G**2),fe=Sa(N.center,oe,$),Oe=B?new S(-oe.y,oe.x):new S(oe.y,-oe.x);return te=Sa(fe,Oe,G),B?ce.sub(N.center).normalize().cross(te.sub(N.center).normalize())>0&&(te=ce):ce.sub(N.center).normalize().cross(te.sub(N.center).normalize())<0&&(te=ce),te}});function P(T,I){let C=[],E=G0(T,I);for(let O=0;O<E;O+=2)C.push({point:new S($e[O],$e[O+1])});return y3e(I,C),C}return g}getTearTop2Point(t,e,r,i,n,s,a,l,c){let h,u,d=new M(i,n);if(t instanceof M){let p=function(m,g,y){let b=er.foot(m,g);if(m.direct.dot(b.sub(m.start()))<0){if(b.distance1(m.start())>y)return m.start();if(b.distance1(m.end())<y)return m.end()}else{if(m.direct.dot(b.sub(m.end()))>0)return null;if(b.distance1(m.end())<y)return m.end()}return Sa(b,m.direct,y)};if(h=p(e,i,a),!h||(u=p(r,n,a),!u))return}else if(t instanceof q){let b=function(P,T){return T=zt.regularD(T),P.sweepAngle>0?(T<P.startAngle&&(T+=360),P.endAngle()>T):(T>P.startAngle&&(T-=360),P.endAngle()<T)},p=cc(t,s),m=new S(p.y,-p.x),g=new M(Sa(s,m,-d.length()),Sa(s,m,d.length())).panDistance(a),y=this.getInters(t,g);if(y.length===0){let P=this.getInters(e,g);if(P.length===0){let T=this.getInters(r,g);if(T.length===0)h=e.end(),u=r.end();else{u=qae(T,g);let I=cc(r,u),C=new S(-I.y,I.x);h=Sa(u,C,l)}}else{h=qae(P,g);let T=cc(e,h),I=new S(T.y,-T.x);u=Sa(h,I,l)}}else{let P=qae(y,g),T=this.getInters(g,e),I=this.getInters(g,r);if(T.length&&I.length)return[SV(T,i),SV(I,n)];let C=d.length()+t.length()*2,E=new M(Sa(P,d.direct,-C),Sa(P,d.direct,C)),O=e.rx>r.rx,[_,x]=O?[e,r]:[r,e],v=this.getInters(E,_);if(!v.length){console.warn("\u5BFC\u7EBF\u5916\u4FA7\u8F6E\u5ED3\u6CA1\u6709\u627E\u5230\u4EA4\u70B9\uFF01\uFF01\uFF01");return}let D=SV(v,O?i:n),F=pze(x,D).filter(z=>!c.getWindingNum(z)&&b(x,z.angleD(x.center))),H;if(F.length)H=SV(F,O?i:n);else{let z=this.getInters(E,x);if(z.length)H=SV(z,O?n:i);else{let V=cc(t,P),W=O?new S(V.y,-V.x):new S(-V.y,V.x);H=Sa(P,W,l/2)}}[h,u]=O?[D,H]:[H,D]}e instanceof q&&(e.end().equals1(h)||b(e,h.angleD(e.center))||(h=e.end())),r instanceof q&&(r.end().equals1(u)||b(r,u.angleD(r.center))||(u=r.end()))}else throw new Error("not support");return[h,u]}getTearByFourPoint(t,e,r,i,n,s,a,l,c,h=.01){if(this.tearShape==="line")return ge.build4([t,e,r,i]).asClose();{let u=cc(s.reverse(),t),d=cc(a.reverse(),e),p=n.center.sub(r),m=n.center.sub(i),g=new S(p.y,-p.x).normalize(),y=new S(-m.y,m.x).normalize(),b=this.getTop2PointLink({point:t,refPt:s},{point:e,refPt:a},u,d,l),P=this.getLimit(e,d,r,g,c,!0),T=[e,e.add(d.mul(P[0])),r.add(g.mul(P[1])),r],I=this.getBezier(T),C=new M(r,i),E=this.getLimit(t,u,i,y,c,!0),O=[i,i.add(y.mul(E[1])),t.add(u.mul(E[0])),t],_=this.getBezier(O),x=XX(I,h),v=XX(_,h),D=ge.build2([].concat(b,x,[C],v));if($b&&D&&Eo(D))throw this.drawDebug.initColor(ee.RED).addPly(D),this.drawDebug.draw(),new Error("selfIntersectionCheck(pl)");return D}}getTop2PointLink(t,e,r,i,n){let{point:s,refPt:a}=t,{point:l,refPt:c}=e,h=[new M(s,l)];if(a instanceof q&&c instanceof q){let u=a.rx<c.rx?a:c;if(G0(h[0],u)>2)if(a.rx<c.rx){let p=new S(r.y,-r.x),m=p.dot(s.sub(a.center))>0,g=Sa(s,m?p:p.scale(-1),n);h=[new M(s,g),new M(g,l)]}else{let p=new S(i.y,-i.x),m=p.dot(l.sub(c.center))>0,g=Sa(l,m?p:p.scale(-1),n);h=[new M(s,g),new M(g,l)]}}return h}getLimit(t,e,r,i,n,s=!1){let a=t.distance1(r),l=a*.5,c=new M(t,t.add(e.scale(n))),h=new M(r,r.add(i.scale(n))),u=this.getInters(c,h);if(u.length>0){let d=u[0],p=t.distance1(d),m=r.distance1(d),g=Math.min(l,p*.5),y=Math.min(l,m*.5);return[g,y]}else if(s){let d=er.foot(c,r),p=t.distance1(d);return[Math.min(l,p*.4),a*.2]}else{let d=a*.3;return[d,d]}}getBezier(t){return new Dr(t)}getArc(t,e,r,i=!0){let n=new Yn,{center:s,radius:a,startAngle:l,endAngle:c,sweep:h}=n.tangentToArc(t,e,r,i);return q.build2(s,zt.toDegrees(l),zt.toDegrees(c),a,a,h)}isStart(t,e){let r=t.start;return jr.inPolyline(r,e)}isEnd(t,e){let r=t.end;return jr.inPolyline(r,e)}getLine(t){return t.primitive}getPoints(t,e){let r=new Array;return e&&t.primitives.forEach(i=>{this.getInters(i,e).forEach(s=>{r.push({point:s,refPt:i})})}),r}getInters(t,e){let r=new Array,i={},n=G0(t,e);if(n>0)for(let s=0;s<n;s+=2){let a=$e[s],l=$e[s+1];if(i[String(a)+String(l)])continue;i[String(a)+String(l)]=!0;let c=new S(a,l);r.push(c)}return r}getPointsAndRefPt(t,e){let r=[];return t.primitives.forEach(i=>{this.getInters(i,e).forEach(s=>{let a=r.find(l=>s.equals(l.point));if(a){if(a.refPt.find(l=>l===i||this.getInters(l,i).length>=2||l.start().equals(i.end())||l.end().equals(i.start())))return;a.refPt.push(i)}else r.push({point:s,refPt:[i]})})}),y3e(e,r),r}getLeft(t,e,r){if(e=e/2,t instanceof M){let i=t.direct,n;return r?n=new S(i.y,-i.x).mul(e):n=new S(-i.y,i.x).mul(e),new M(t.start().add(n),t.end().add(n))}else{let{start:i,direct:n}=this.getArcRightDirect(t,r),s=i.sub(n.mul(e)),a=t.center.distance1(s);return a?q.build2(t.center,t.startAngle,t.endAngle(),a,a,t.sweep()):null}}getRight(t,e,r){if(e=e/2,t instanceof M){let i=t.end().sub(t.start()).normalize(),n;return r?n=new S(-i.y,i.x).mul(e):n=new S(i.y,-i.x).mul(e),new M(t.start().add(n),t.end().add(n))}else{let{start:i,direct:n}=this.getArcRightDirect(t,r),s=i.add(n.mul(e)),a=t.center.distance1(s);return a?q.build2(t.center,t.startAngle,t.endAngle(),a,a,t.sweep()):null}}getArcRightDirect(t,e){let r,i,n;return e?(r=t.start(),n=t.sweep()):(r=t.end(),n=t.sweep()===ae.CCW?ae.CW:ae.CCW),n===ae.CW?(i=t.center.sub(r).normalize(),i=new S(-i.x,-i.y)):i=t.center.sub(r).normalize(),{start:r,direct:i}}getPoint4Distance(t,e,r,i){if(t instanceof M){let n=t.end().sub(t.start()).normalize();return i?e.distance1(t.end())>r?e.add(n.mul(r)):t.end():e.distance1(t.start())>r?e.add(n.mul(-r)):t.start()}else{let n=Math.abs(r/t.rx),s=e.sub(t.center).normalize(),a=Math.atan2(s.y,s.x),l;i?t.sweep()==ae.CCW?l=a+n:l=a-n:t.sweep()==ae.CCW?l=a-n:l=a+n,l=(l%kr+kr)%kr/Math.PI*180;let c=t.pointOn(l);return Wn(t,c)?c:i?t.end():t.start()}}intersBBox(t,e,r,i,n){let s=this.getLimitPoints(t,r,i,n);return s.length==0&&(s=this.interPoints(t,e,e/2,r,i,0,n)),s}getLimitPoints(t,e,r,i){let n=new Array;t.primitives.forEach(a=>{this.getInters(a,r).length>0&&(n.push(a.start()),n.push(a.end()))});let s=null;if(e){if(r instanceof M){let a=0,l=r.end().sub(r.start()).normalize(),c;i?c=new S(l.y,-l.x):c=new S(-l.y,l.x),n.forEach(h=>{let u=er.foot(r,h),d=h.sub(u);!this.isParallel(l,d)&&c.dot(d)>0&&d.length()>a&&(s=h,a=d.length())})}else if(r instanceof q){let{direct:a,start:l}=this.getArcRightDirect(r,i),c;n.forEach(h=>{let u=h.sub(l).normalize(),d=h.sub(r.center).length();u.dot(a)<0&&(!c||d<c)&&(s=h,c=d)})}}else if(r instanceof M){let a=0,l=r.end().sub(r.start()).normalize(),c;i?c=new S(-l.y,l.x):c=new S(l.y,-l.x),n.forEach(h=>{let u=er.foot(r,h),d=h.sub(u);!this.isParallel(l,d)&&c.dot(d)>0&&d.length()>a&&(s=h,a=d.length())})}else if(r instanceof q){let{direct:a,start:l}=this.getArcRightDirect(r,i),c;n.forEach(h=>{let u=h.sub(l).normalize(),d=h.sub(r.center).length();u.dot(a)>0&&(!c||d<c)&&(s=h,c=d)})}return s==null?[]:[s]}isParallel(t,e){return ne.eq(Math.abs(t.cross(e)),0)}interPoints(t,e,r,i,n,s,a){let l;i?l=this.getLeft(n,e,a):l=this.getRight(n,e,a);let c=this.getPoints(t,l);if(s<6)if(c.length==0)c=this.interPoints(t,e/2,r/2,i,n,s+1,a);else{let h=this.interPoints(t,e+r,r/2,i,n,s+1,a);h.length>0&&(c=h)}return c}updateProgress2(t){throw new Error("not implemented updateProgress2")}complete2(){this.Switch=!1,this.updateProgress2(1)}interrupt(){this.Switch=!1}};var Kae=class extends $ae{constructor(t){if(super(t),!t.mapData)throw new Error("!data.mapData not exit ---> TearDropWorker.v4");this.map=new ef(xb(t.mapData))}updateProgress2(t){this.hideProgress||A.publish("progressUpdate",[t,"add tear drop"],Q())}};var gze=Ru(YR());var A3e=class extends Iz{getScrewPillarSizeInIframe(t){return this.getScrewPillarSize(t)}getTopStiffDistance(t){let{stiffenerProps:e,height:r}=t;if(e){let i=r-e.height;return Math.max(i,0)}return 0}getDefaultScrewHeight(t){let e=m6.getOneOutline();if(e!=null){let r=wo*2,i=e.getComponent(),n=0;switch(i.type){case"T&B":{t===55?n=i.botShellHeight-r:n=i.shellHeight-i.botShellHeight;break}case"DRAWER":{t===55?n=i.shellHeight*2/3-r:n=i.shellHeight;break}}return Math.max(n,cb)}return CL/2}correctAllProps(t){let{height:e,holeDiameter:r,thickness:i,stiffenerProps:n,counterboreProps:s}=t;if(this.correctHeight(e,t),this.correctHoleDiameter(r,t),this.correctThickness(i,t),s){let{height:a,diameter:l}=s;this.correctCounterboreHeight(a,t),this.correctCounterboreDiameter(l,t)}if(n){let{topWidth:a,bottomWidth:l,height:c,stiffThickness:h}=n;this.correctStiffenerTopWidth(a,t),this.correctStiffenerBottomWidth(l,t),this.correctStiffenerHeight(c,t),this.correctStiffenerThickness(h,t)}}correctHeight(t,e){let r=e.height,i=cb,n=this.checkValueRange(t,i);return!n.check&&this.checkValueRange(r,i).check?e.height=r:e.height=n.value,r!==e.height}correctHoleDiameter(t,e){let r=e.holeDiameter,i=this.checkHoleDiameterRange(t,e);return!i.check&&this.checkHoleDiameterRange(r,e).check?e.holeDiameter=r:e.holeDiameter=i.value,r!==e.holeDiameter}correctThickness(t,e){let r=e.thickness,i=this.checkThicknessRange(t,e);return!i.check&&this.checkThicknessRange(r,e).check?e.thickness=r:e.thickness=i.value,r!==e.thickness}correctCounterboreHeight(t,e){var s;let{counterboreProps:r}=e;if(!r)return!1;let i=r.height,n=this.checkCounterboreHeightRange(t,e);return!n.check&&this.checkCounterboreHeightRange(i,e).check?e.updateCounterboreProps({height:i}):e.updateCounterboreProps({height:n.value}),i!==((s=e.counterboreProps)==null?void 0:s.height)}correctCounterboreDiameter(t,e){var s;let{counterboreProps:r}=e;if(!r)return!1;let i=r.diameter,n=this.checkCounterboreDiameterRange(t,e);return!n.check&&this.checkCounterboreDiameterRange(i,e).check?e.updateCounterboreProps({diameter:i}):e.updateCounterboreProps({diameter:n.value}),i!==((s=e.counterboreProps)==null?void 0:s.diameter)}correctStiffenerTopWidth(t,e){var s;let{stiffenerProps:r}=e;if(!r)return!1;let i=r.topWidth,n=this.checkStiffenerTopWidthRange(t,e);return!n.check&&this.checkStiffenerTopWidthRange(i,e).check?e.updateStiffenerProps({topWidth:i}):e.updateStiffenerProps({topWidth:n.value}),i!==((s=e.stiffenerProps)==null?void 0:s.topWidth)}correctStiffenerBottomWidth(t,e){var s;let{stiffenerProps:r}=e;if(!r)return!1;let i=r.bottomWidth,n=this.checkStiffenerBottomWidthRange(t,e);return!n.check&&this.checkStiffenerBottomWidthRange(i,e).check?e.updateStiffenerProps({bottomWidth:i}):e.updateStiffenerProps({bottomWidth:n.value}),i!==((s=e.stiffenerProps)==null?void 0:s.bottomWidth)}correctStiffenerHeight(t,e){var s;let{stiffenerProps:r}=e;if(!r)return!1;let i=r.height,n=this.checkStiffenerHeightRange(t,e);return!n.check&&this.checkStiffenerHeightRange(i,e).check?e.updateStiffenerProps({height:i}):e.updateStiffenerProps({height:n.value}),i!==((s=e.stiffenerProps)==null?void 0:s.height)}correctStiffenerThickness(t,e){var s;let{stiffenerProps:r}=e;if(!r)return!1;let i=r.stiffThickness,n=this.checkStiffenerThicknessRange(t,e);return!n.check&&this.checkStiffenerThicknessRange(i,e).check?e.updateStiffenerProps({stiffThickness:i}):e.updateStiffenerProps({stiffThickness:n.value}),i!==((s=e.stiffenerProps)==null?void 0:s.stiffThickness)}checkHoleDiameterRange(t,e){return this.checkValueRange(t,.01,39.37)}checkThicknessRange(t,e){let r=wo,i=wo*3;return this.checkValueRange(t,r,i)}checkCounterboreHeightRange(t,e){let{height:r,thickness:i}=e,n=0,s=Math.max(this.toFixValues(r,-i),n);return this.checkValueRange(t,n,s)}checkCounterboreDiameterRange(t,e){let{holeDiameter:r}=e,i=r+wo,n=Math.max(r+wo*20,i);return this.checkValueRange(t,i,n)}checkStiffenerTopWidthRange(t,e){let r=wo,i=wo*1e3;return this.checkValueRange(t,r,i)}checkStiffenerBottomWidthRange(t,e){let r=wo,i=wo*1e3;return this.checkValueRange(t,r,i)}checkStiffenerHeightRange(t,e){let{height:r}=e,i=cb,n=Math.max(r,i);return this.checkValueRange(t,i,n)}checkStiffenerThicknessRange(t,e){let r=wo,i=wo*3;return this.checkValueRange(t,r,i)}checkValueRange(t,e,r){let i=oh(e)?je(e):-Number.MAX_VALUE,n=oh(r)?je(r):Number.MAX_VALUE,s=je(t);if(i>n)throw new Error("checkValueRange error params");if(oh(e)){if(s<i)return{check:!1,value:e};t=Math.max(t,e)}if(oh(r)){if(s>n)return{check:!1,value:r};t=Math.min(t,r)}return{check:!0,value:t}}toFixValues(...t){let e=0;return t.forEach(r=>{e+=je(r)}),e=parseFloat(e.toString())/10,R.getInstance().unit!="mil"&&(e=new dt().conversion(R.getInstance().unit,"mil",e)),e}},S1=new A3e;function Zae(o,t,e=!0){let r=[],i=e?R.getInstance().origin.mul(-1):S.ORIGIN,n=Qe.translate1(i),s=new dt;return t&&(a(["DOCTYPE","PREVIEW","1.0"]),a(["HEAD",{scale:new nn(10,o).ratio}]),Hn(Ze.getInstance().getfilterPhyLayers(),(y,b)=>l(y,b))),pt.getAllItem().forEach(y=>g(y,0)),Xt.getAllItem().forEach(y=>p(y,0)),Kt.getAllItem().forEach(y=>m(y,0)),r.join(`
`);function a(y){r.push(JSON.stringify(y))}function l(y,b){b.type!=="3D_SHELL_BOTTOM"&&b.type!=="3D_SHELL_OUTLINE"&&b.type!=="3D_SHELL_TOP"||a(["LAYER",parseInt(y),b.type,b.name,3,b.activeColor.toString(),b.activeColor.alpha,b.activeColor.toString(),b.activeColor.alpha])}function c(y){return y=je(y),y=s.conversion(R.getInstance().unit,"px(100)",y),y}function h(y,b){let P=y.getComponent(),T={};if(P.type==="T&B"?(T.BottomHeight=c(P.botShellHeight),T.TopInnerHeight=c(P.topInnerHeight),T.BottomInnerHeight=c(P.bottomInnerHeight)):P.type==="DRAWER"&&(P.pushCoverDir===1?T.Direction=[1,0]:P.pushCoverDir===2?T.Direction=[-1,0]:P.pushCoverDir===4?T.Direction=[0,1]:P.pushCoverDir===8&&(T.Direction=[0,-1])),y instanceof rr){let I=y.getUL().add(i);a(["SHELL",y.globalIndex,b,P.type,c(P.shellHeight),P.substrateHeight,c(y.strokeWidth),[["R",I.x,I.y,y.width,y.height,zt.toDegrees(y.rotation),1,y.cornerRadius*2/Math.min(y.width,y.height)]],T,0])}else a(["SHELL",y.globalIndex,b,P.type,c(P.shellHeight),P.substrateHeight,c(y.strokeWidth),[EV(y.getMathGraphics(),n)],T,0])}function u(y,b){let P=y.getComponent();P.type==="Side"&&!P.lineId||(a(["SHELL_ENTITY",y.globalIndex,b,y.layerId,0,P.slotOption.reduce((T,I)=>T+I,0),P.slotDepth,y.strokeWidth,[EV(y.getMathGraphics(),n)],0]),P.type==="Side"&&a(["CONNECT",P.lineId,[y.globalIndex]]))}function d(y,b){let P=y.getComponent();P.type==="side"&&!P.lineId||(a(["SHELL_ENTITY",y.globalIndex,b,y.layerId,1,P.belong,P.stretchLength,y.strokeWidth,[EV(y.getMathGraphics(),n)],0]),P.type==="side"&&a(["CONNECT",P.lineId,[y.globalIndex]]))}function p(y,b){let{type:P}=y;switch(P){case"3D Shell - Outline":h(y,b);break;case"3D Shell - Top Slot Region":case"3D Shell - Side Slot Region":u(y,b);break;case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":d(y,b);break}}function m(y,b){let{type:P,layerId:T,radius:I}=y;if(!(isNaN(I)||!y.getMathGraphics(T)))switch(P){case"3D Shell - Outline":h(y,b);break;case"3D Shell - Top Slot Region":case"3D Shell - Side Slot Region":u(y,b);break;case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":d(y,b);break;case"3D Shell - Screw Pillar":let E=y.getComponent(),O=y.center.add(i),{counterboreProps:_,stiffenerProps:x}=E;a(["BOSS",y.globalIndex,b,y.layerId,O.x,O.y,E.height,E.thickness,E.holeDiameter,_?[_.height,_.diameter]:null,x?[x.topWidth,x.bottomWidth,S1.getTopStiffDistance(E),x.stiffThickness]:null,0]);break}}function g(y,b){switch(y.type){case"3D Shell - Outline":h(y,b);break;case"3D Shell - Side Datum Line":let P=y.getMathGraphics().primitives[0].multiply3(n);a(["CREASE",y.globalIndex,b,y.layerId,P.start().x,P.start().y,P.end().x,P.end().y,Tee,0]);break;case"3D Shell - Top Slot Region":case"3D Shell - Side Slot Region":u(y,b);break;case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":d(y,b);break}}}var KX=class{constructor(t,e){this.index=t,this.x=(e.minX+e.maxX)/2,this.y=(e.minY+e.maxY)/2,this._bbox=e}bbox(){return this._bbox}},Jae=class{constructor(t){this.m_listTask=[];this.m_listDigHole=[];this.m_dictExtend={};this.m_dictHoleExtent={};this.outFpcFill=[];this.m_funEncFPCPolygon=t,this.m_treeHole=new $u(10),this.m_treeTopHole=new $u(10),this.m_treeBotHole=new $u(10)}addTask(t,e){this.m_listTask.push([t,e])}addDigHolePly(t,e=0){for(let r of t){this.m_listDigHole.push(r);let i=this.m_listDigHole.length-1;this.m_treeHole.insert(new KX(i,r.bbox())),this.m_dictHoleExtent[i]=e}}addPad(t,e,r=0){let i=t?this.m_treeTopHole:this.m_treeBotHole;if(r===0)for(let n of e){this.m_listDigHole.push(n);let s=this.m_listDigHole.length-1;i.insert(new KX(s,n.bbox()))}else for(let n of e){this.m_listDigHole.push(n);let s=this.m_listDigHole.length-1;i.insert(new KX(s,n.bbox())),this.m_dictExtend[s]=r}}runTask(){for(let t of this.m_listTask){let I=function(C){return C.material==="Tape"?C.fpcModel:C.material},e=t[0],r=t[1],{type:i,strokeWidth:n,layerId:s}=e,a=s===58?this.m_treeTopHole:this.m_treeBotHole,l=e.getMathGraphics(s);if(!l)continue;let c,h=[];l instanceof Bt?l.items.reduce((C,E)=>{let O=E.bbox().area();if(O>C)return c&&h.push(c.reverse()),c=E,O;h.push(E.reverse())},0):c=l;let u=1,d=c.bbox(),p=d.width(),m=d.height(),g=new ht(d.minX-p/2*u,d.maxX+p/2*u,d.minY-m/2*u,d.maxY+m/2*u),y=this.m_treeHole.search(g);for(let C of y){let E=this.m_listDigHole[C.index];if(!E)continue;E=E.area(.1)<0?E:E.reverse();let O=this.m_dictHoleExtent[C.index];if(O){let _=X0(E,O);if(!_||_.length<=0)continue;for(let x of _)x.items.forEach((v,D)=>{D>0&&(v=v.reverse()),h.push(v)})}else h.push(E)}let b=a.search(g);for(let C of b){let E=this.m_listDigHole[C.index];if(!E)continue;E=E.area(.1)<0?E:E.reverse();let O=this.m_dictExtend[C.index];if(O){let _=X0(E,O);if(!_||_.length<=0)continue;for(let x of _)x.items.forEach((v,D)=>{D>0&&(v=v.reverse()),h.push(v)})}else h.push(E)}let P=[],T=e.getComponent();if(h.length<=0){this.m_funEncFPCPolygon(s,e.globalIndex,[c],r,I(T),T.thickness);continue}if(P=this.boolOperate([c],h),!(!P||P.length<=0))for(let C of P){let E=[];for(let O of C.items)E.push(O);this.m_funEncFPCPolygon(s,e.globalIndex,E,r,I(T),T.thickness)}}}boolOperate(t,e){let r=new Di(2),i=new MP(!1),n=new iI(Xee.rule,r,i);for(let s of t){let a=Xee.weight(0);n.addPolyline(s,a)}for(let s of e){let a=Xee.weight(1);n.addPolyline(s,a)}if(n.simplify(),i.plGrps.length>0)return i.plGrps;console.error("\u5E03\u5C14\u5931\u8D25")}};Jae.FPC_EXPANSION=0;var OV=class o extends ia{constructor(t,e,r,i,n=""){super(n,t,e),this.type=r,this.outlines=i,this.__bbox=this._bbox()}multiply3(t){return new o(this.net,this.layer,this.type,this.outlines.multiply3(t),this.id)}bbox(){return this.__bbox}_bbox(){return this.outlines.bbox()}shape(t,e){return this.layer.equals(t)||this.layer.equals($r.MULTI)?this.outlines:null}};var H6=class{constructor(){this.triangle=new Array;this.item=null;this.width=0}addItem(t,e){this.item=t,this.width=e}addTriangle(t,e,r){this.triangle.push(t),this.triangle.push(e),this.triangle.push(r)}bbox(){if(this.item!=null){let t=new _e;return t.ext1(this.item.bbox()).ext7(this.width/2),t.build1()}else{let t=new _e;return this.triangle.forEach(e=>{t.ext2(e)}),t.build1()}}};var Qae=class o extends ia{constructor(e,r,i,n,s){super(e,r,i);this.rtree=new ji(50);this.shapeRtree=new ji(50);this.pointInLine=0;this.directs=new Set;if(this.method=n,this.outlines=s,this.method instanceof pA){this.addTriangleItems();let a=new Array;for(let l of s){a.push(l);for(let c of l.primitives)if(this.rtree.add(c),this.method.neckThickness>0){if(c instanceof M||c instanceof q){let u=new H6;u.addItem(c,this.method.neckThickness),this.shapeRtree.add(u)}let h=c.stroke(this.method.neckThickness,wr.ROUND,ae.CW).asClose();a.push(h),h.primitives.forEach(u=>{this.rtree.add(u)})}}this.shapes=new Bt(a)}else if(this.method instanceof Qx){let a=new Array;for(let l of this.outlines)for(let c of l.primitives){if(c instanceof M||c instanceof q){let u=new H6;u.addItem(c,this.method.gridWidth),this.shapeRtree.add(u)}let h=c.stroke(this.method.gridWidth,wr.ROUND,ae.CW).asClose();h.primitives.forEach(u=>{this.rtree.add(u)}),a.push(h)}this.shapes=new Bt(a)}this.__bbox=this.calcBBox()}addTriangleItems(){for(let e of this.outlines){let r=new Array;e.points(.05,a=>{r.push(a)});let i=new Array,n=null;for(let a=0;a<r.length-2;a+=2){let l=r[a],c=r[a+1],h=r[a+2],u=new H6;u.addTriangle(l,c,h),this.shapeRtree.add(u),i.push(l),n=h}r.indexOf(n)==r.length-2&&i.push(n);for(let a=0;a<i.length-2;a+=2){let l=i[a],c=i[a+1],h=i[a+2],u=new H6;u.addTriangle(l,c,h),this.shapeRtree.add(u),i.push(l)}}}calcBBox(){let e=new _e;for(let r=0;r<this.outlines.length;r++)e.ext1(this.outlines[r].bbox());return e.build1()}inPolygons(e){this.pointInLine=0,this.directs.clear();let r=!1,i=this.shapeRtree.search(e.bbox().extendOfSize(1e-8));for(let n of i){if(n.item!=null){let s=n.item;if(s instanceof M&&s.inArea(e,n.width,wr.ROUND))return!0;if(s instanceof q&&s.inArea(e,n.width))return!0}n.triangle.length>0&&(r=this.getSelect(e,n.triangle[0],n.triangle[1],n.triangle[2],r))}return this.pointInLine/2%2>0&&(r=!r),this.pointInLine=0,r}shape(e,r){return e.equals(this.layer)?this.shapes:null}bbox(){return this.__bbox}multiply3(e){let r=new Array(this.outlines.length);for(let i=0;i<r.length;i++)r[i]=this.outlines[i].multiply3(e);return new o(this.id,this.net,this.layer,this.method,r)}getSelect(e,r,i,n,s){return this.checkEndpoint(e,r,i,n)||this.pointInTriangle(e,r,i,n)&&(s=!s),s}pointInTriangle(e,r,i,n){let s=this.inInner(e,r,i,n),a=this.inInner(e,i,n,r),l=this.inInner(e,n,r,i);if(s>=0&&a>=0&&l>=0&&!(s==0&&a==0&&l==0)){if(s==0||a==0||l==0){let c=null;s==0&&(c=this.getNormal(r,i,n)),a==0&&(c=this.getNormal(i,n,r)),l==0&&(c=this.getNormal(n,r,i));let h=!0;this.directs.forEach(u=>{u.equals(c)&&(h=!1,c=u)}),h?(this.directs.add(c),this.pointInLine++):(this.directs.delete(c),this.pointInLine--)}return!0}return!1}inInner(e,r,i,n){let s=i.sub(r).normalize(),a=n.sub(r).normalize(),l=e.sub(r).normalize(),c=s.cross(l),h=s.cross(a);return c*h}checkEndpoint(e,r,i,n){if(e.y==r.y){if(i.y>e.y&&n.y>e.y||i.y<e.y&&n.y<e.y)return!0}else if(e.y==i.y){if(r.y>e.y&&n.y>e.y||r.y<e.y&&n.y<e.y)return!0}else if(e.y==n.y){if(r.y>e.y&&i.y>e.y||r.y<e.y&&i.y<e.y)return!0}else{if(Math.abs(i.sub(r).cross(n.sub(i)))<1e-8)return!0;if(r.y>e.y&&i.y>e.y&&n.y>e.y)return!0;if(r.y<e.y&&i.y<e.y&&n.y<e.y)return!0}return!1}getNormal(e,r,i){let n=r.sub(e).normalize(),s=i.sub(e),a=new S(-n.y,n.x);return a.mul(s.dot(a)).normalize()}};var AV=class o extends ia{constructor(t,e,r,i){super(t||"","",e),this.type=r,this.outlines=i,this.__bbox=this._bbox()}multiply3(t){return new o(this.id,this.layer,this.type,this.outlines.multiply3(t))}bbox(){return this.__bbox}_bbox(){return this.outlines.bbox()}shape(t,e){return this.layer.equals(t)||this.layer.equals($r.MULTI)?this.outlines:null}};var ele=class o extends ia{constructor(t,e,r){super("",t,o.checkPlane(e)),this.outline=r}static checkPlane(t){if(t.type===6)return t;throw new Error("plane zone must in plane layer")}multiply3(t){return new o(this.net,this.layer,this.outline.multiply3(t))}bbox(){return this.outline.bbox()}shape(t,e){return this.layer.equals(t)?this.outline:this.layer.equals($r.MULTI)?this.outline:null}};var FS=class{constructor(t,e,r,i){this._keepCollide=!0;this._sourceIndex=-1;this._sourceIndexs=[];this._isObstacle=!1;this.viaName="";this.regionId=null;this.id=t,this.layerId=e,this.shape=r,this.locked=i,this.type=this.getShapeType(r)}get isObstacle(){return this._isObstacle||this.locked}set isObstacle(t){this._isObstacle=t}set sourceIndex(t){this._sourceIndex=t,t>=0&&this._sourceIndexs.indexOf(t)<0&&this._sourceIndexs.push(t)}get sourceIndex(){return this._sourceIndex}getAllSource(){return Array.from(this._sourceIndexs)}set keepCollide(t){(this.type=="Track"||this.type=="ArcTrack"||this.type=="Via"||this.type=="BlindVia")&&(this._keepCollide=t)}get keepCollide(){return this._keepCollide}allowPush(){if(this.locked||this.primitive&&!Mt.checkIsInCanEdit([this.primitive]))return!1;switch(this.type){case"Track":return!0;case"ArcTrack":return!1;default:return!1}}getShapeType(t){return t instanceof Os?"Track":t instanceof Rm?"ArcTrack":t instanceof yy?"BlindVia":t instanceof E0?"Outline":t instanceof c1?"BoxShape":t instanceof Qae?"Copper":t instanceof Q0?"Line":t instanceof Jp?"Pad":t instanceof ele?"PlaneZone":t instanceof y4?"Pour":t instanceof Db?"Prohibit":t instanceof $P?"Region":t instanceof OV?"Constraint":t instanceof by?"Slot":t instanceof gl?"Via":t instanceof AV?"Partition":"Shape"}bbox(){return this.shape.bbox()}get primitive(){switch(this.type){case"Track":{let t=this.shape;return new M(t.start,t.end)}case"ArcTrack":return this.shape.arc;default:return null}}};var _3e=class{converts(t,e,r){for(let i of t){let n=this.convert(i);n!=null&&(e.push(n),i instanceof He&&i.type==="Constraint Region"&&r&&r.push(i.model))}}convert(t){return t instanceof Ir?this.convertTrack(t):t instanceof yi?this.convertArcTrack(t):t instanceof Ue?this.convertVia(t):t instanceof Le?this.convertPad(t):t instanceof He?this.convertProfile(t):t instanceof lr?this.convertText(t):t instanceof Mn?this.convertImage(t):null}convertTrack(t){let e=new Os(t.net,this.getLayer(t.layerId),t.start,t.end,t.width,t.gId);return new FS(t.globalIndex,t.layerId,e,t.locked||t.getParent()!=null)}convertArcTrack(t){let e=new Rm(t.net,this.getLayer(t.layerId),t.primitive,t.width,t.gId);return new FS(t.globalIndex,t.layerId,e,t.locked||t.getParent()!=null)}convertVia(t){if(t.type!==1){let e=new gl(t.globalIndex,t.net,t.center,t.holeRadius*2,t.radius*2,t.radius*2,t.radius*2,!1,SI(CI(t.unusedInnerLayers)));return new FS(t.globalIndex,12,e,t.locked||t.getParent()!=null)}else{let e=new yy(t.globalIndex,t.net,t.center,t.holeRadius*2,this.getLayer(t.startLayer),t.radius*2,t.radius*2,this.getLayer(t.endLayer),t.radius*2,!1,SI(CI(t.unusedInnerLayers))),r=new FS(t.globalIndex,12,e,t.locked||t.getParent()!=null);return r.viaName=t.name,r}}convertPad(t){let e=null,r=null,i=null,n=null;t instanceof sn?ar(t.layerId)?(e=this.getShape("POLYGON",0,0,0,t.primitives),r=this.getShape("POLYGON",0,0,0,t.primitives),i=this.getShape("POLYGON",0,0,0,t.primitives),n=this.getHoleShape(t)):ao(t.layerId)?e=this.getShape("POLYGON",0,0,0,t.primitives):i=this.getShape("POLYGON",0,0,0,t.primitives):t instanceof _i&&(ar(t.layerId)?(e=this.getShape(t.topType,t.topWidth,t.topHeight,t.topRatio,null),r=this.getShape(t.innerType,t.innerWidth,t.innerHeight,t.innerRatio,null),i=this.getShape(t.bottomType,t.bottomWidth,t.bottomHeight,t.bottomRatio,null),n=this.getHoleShape(t)):ao(t.layerId)?e=this.getShape(t.topType,t.topWidth,t.topHeight,t.topRatio,null):i=this.getShape(t.bottomType,t.bottomWidth,t.bottomHeight,t.bottomRatio,null));let s=new mI(this.getLayer(t.layerId),e,r,i),a=new Jp(t.globalIndex,t.net,this.getLayer(t.layerId),t.center,pb(t.rotation),s,n,t.pasteExpansion,t.topSolderExpansion,t.bottomSolderExpansion,"",t.plated,null,this.toPadRule(t.padRule),SI(CI(t.unusedInnerLayers)));return new FS(t.globalIndex,t.layerId,a,t.locked||t.getParent()!=null)}toPadRule(t){if(t==null)return null;let e=t.toJSON();return new b4(e.connectMode,e.lineWidth,e.lineClearance,e.lineAngle)}getShape(t,e,r,i,n){i=i*100;let s;switch(t){case"ELLIPSE":s=new Ab(0,e,r,i,null);break;case"OVAL":s=new Ab(3,e,r,i,null);break;case"RECT":s=new Ab(1,e,r,i,null);break;case"POLYGON":s=new Ab(4,e,r,i,ge.build2(n));break}return s}getHoleShape(t){return t.holeShape=="ROUND"?new qP(0,t.holeRadius*2,t.holeLength,pb(t.holeRotation),t.holeOffset.x,t.holeOffset.y):new qP(2,t.holeRadius*2,t.holeLength,pb(t.holeRotation),t.holeOffset.x,t.holeOffset.y)}getType(t){return t instanceof lt?2:t instanceof rr?1:0}getMethod(t){switch(t.style){case"90grid":return new Qx(t.gridLineWidth,t.clearance,90);case"45grid":return new Qx(t.gridLineWidth,t.clearance,45);case"solid":return t.optimization?new pA(.8):new pA(0);default:return new pA(0)}}convertProfile(t){let e=t.type,r=null;switch(e){case"Line":t.layerId==11?r=new E0(t.globalIndex,this.getType(t),t.getMathGraphics(t.layerId,0)):r=new Q0(t.net,this.getLayer(t.layerId),this.getType(t),t.strokeWidth,t.getMathGraphics(t.layerId,0),t.globalIndex);break;case"Copper Region":{let i=re.getInstance().getCopperPlaneByNet(t.net),n=re.getInstance().getSafeSpacingByNet(t.net,13),s=t.layerId,a=t.getComponent(),l=a.order;r=new y4(t.globalIndex,t.net,this.getLayer(t.layerId),this.getMethod(a),n.getClearance(13,11,s),this.getClearanceMap(13,s,n),i.getSingleConnectMode(s)!=1,a.keepIsland,l,!1,t.getMathGraphics(t.layerId,0).primitives,[],a.name);break}case"Prohibited Region":{let i=t.getComponent();r=new Db(t.globalIndex,this.getLayer(t.layerId),this.getType(t),i.copper,i.track,i.device,i.planzone,i.fill,t.getMathGraphics(t.layerId,0));break}case"Partition":{r=new AV(t.globalIndex,this.getLayer(t.layerId),this.getType(t),t.getMathGraphics(t.layerId,0));break}case"Fill Region":{r=new $P(t.net,this.getLayer(t.layerId),this.getType(t),t.getMathGraphics(t.layerId,0));break}case"Constraint Region":{r=new OV(t.net,this.getLayer(t.layerId),this.getType(t),t.getMathGraphics(t.layerId,0));break}case"TearDrop":{r=new $P(t.net,this.getLayer(t.layerId),2,t.getMathGraphics(t.layerId,0));break}case"Board Outline":{r=new E0(t.globalIndex,this.getType(t),t.getMathGraphics(t.layerId,0));break}case"Slot Region":{r=new by(t.globalIndex,this.getType(t),t.getMathGraphics(t.layerId,0));break}}return r!=null?new FS(t.globalIndex,t.layerId,r,t.locked||t.getParent()!=null):null}getClearanceMap(t,e,r){let i=[10,7,15,6,11,8,1,3,2,4,0,5],n={};return i.forEach(s=>{n[s]=r.getClearance(t,s,e)}),n}convertText(t){let e=t.model.box,r=new c1(this.getLayer(t.layerId),e.leftLow,e.leftUp,e.rightLow,e.rightUp,t.globalIndex);return new FS(t.globalIndex,t.layerId,r,t.locked||t.getParent()!=null)}convertImage(t){let e=t.model.box,r=new c1(this.getLayer(t.layerId),e.leftLow,e.leftUp,e.rightLow,e.rightUp,t.globalIndex);return new FS(t.globalIndex,t.layerId,r,t.locked||t.getParent()!=null)}getLayer(t){switch(t){case 1:return $r.TOP_COPPER;case 3:return $r.TOP_SILK;case 5:return $r.TOP_SOLDER_MASK;case 7:return $r.TOP_PASTE;case 2:return $r.BOT_COPPER;case 4:return $r.BOT_SILK;case 6:return $r.BOT_SOLDER_MASK;case 8:return $r.BOT_PASTE;case 11:return $r.OUTLINE;case 12:return $r.MULTI;case 13:return $r.DOCUMENT;default:if(Es(t)){let e=Ze.getInstance().getLayer(t);if(ns(e.type)){let r=O2(t);return new $r(5,r)}else{let r=O2(t);return new $r(6,r)}}else return $r.OTHER}}},N_t=new _3e;var mze,g0o=/\b3DStreamDebug\b/.test((mze=Q())==null?void 0:mze.location.search);var y0o=new Di(0),v3e=class{};v3e.LogExport=!1;function EV(o,t){let e=0;return o.multiply3(t).primitives.reduce((r,i)=>(i instanceof M||i instanceof q&&i.rx===i.ry?r.push(i):i.points(.1).reduce((n,s)=>(s.equals(n)||r.push(new M(n,s)),s)),r),[]).reduce((r,i)=>{if(i instanceof M){switch(e){case 0:r.push(i.start().x,i.start().y,"L",i.end().x,i.end().y);break;case 1:r.push(i.end().x,i.end().y);break;default:r.push("L",i.end().x,i.end().y)}e=1}else if(i instanceof q){if(o.primitives.length>1||Math.abs(i.sweepAngle)<360)switch(e){case 0:r.push(i.start().x,i.start().y,"ARC",i.sweepAngle,i.end().x,i.end().y);break;case 2:r.push(i.sweepAngle,i.end().x,i.end().y);break;default:r.push("ARC",i.sweepAngle,i.end().x,i.end().y)}else r.push("CIRCLE",i.center.x,i.center.y,i.rx);e=2}return r},[])}async function ZX(o,t,e=!0,r=!1,i,n){let s=1,a=9,l=10,c=[];if(t){P(["DOCTYPE","PREVIEW","1.0"]),P(["HEAD",{scale:new nn(10,o).ratio}]);for(let T of[a,l]){let I=Ze.getInstance().getLayer(T);P(["LAYER",T,I.type,I.name,3,I.activeColor.toString(),I.activeColor.alpha,I.activeColor.toString(),I.activeColor.alpha])}}let h=await JX();console.debug("components 2 model",h);let u=e?R.getInstance().origin.mul(-1):S.ORIGIN,d=[],p=[],m=[],g=n?Object.entries(n):null,y=T=>g?g.some(([I,C])=>{let E=T.attrKeyValue[I];return E?E.indexOf(C)!==-1:!1}):!1;Ar.getAllItem().forEach(T=>{var F;if(y(T))return;let C=T.attrKeyValue["3D Model Title"]?T.attrKeyValue["3D Model"]:"",E=T.attrKeyValue["3D Model Transform"];console.debug("handling 3d model",T.globalIndex,"compoent",C,"with",E);let{uuid:O,path:_}=_V(C),x=C?h[`${O}|${_}`]:"",v=((F=Hi.getItem(T.footprintUUID))==null?void 0:F.getBBox())||T.model.bbox,D=T.attrKeyValue.Height,w=0;if(!Number.isNaN(parseFloat(D))){let H=D.replace(/MIL|MM/gi,W=>W.toLowerCase()),z=/(\d+(\.\d+)?)(\s*)(mm|mil)/.exec(H);z||(z=/\b\d+(\.\d+)?\b/.exec(H));let V=z[0];w=+V||na(V,"mil")||0}if(w=isNaN(w)?0:w/10,x||i&&w>0){x?d.push(T.globalIndex):m.push(T.globalIndex);let H,z;if(w){let k=k_t(T);k&&(z=[[EV(k,Qe.ORIGIN)]])}if(E&&E.trim().startsWith("v2:")){let k=JSON.parse(E.trim().slice(3)),U=new Ae([k[0],k[1],k[2],0,k[3],k[4],k[5],0,k[6],k[7],k[8],0,k[9],k[10],k[11],1]).scale(1/10).data;H={uuid:x||"default_model",dx:v.width(),dy:v.height(),dz:w,transformV2:JSON.stringify([U[0],U[1],U[2],U[4],U[5],U[6],U[8],U[9],U[10],U[12],U[13],U[14]]),outline:z,path:_}}else{let k=E?E.split(",").map(B=>parseFloat(B)):new Array(9).fill(0),N=Hi.getItem(T.footprintUUID).getOrigin(),U=x&&(k[0]||k[1]||k[2]);H={uuid:x||"default_model",dx:U?k[0]/10:v.width(),dy:U?k[1]/10:v.height(),dz:U?k[2]/10:w,rz:k[3],rx:k[4],ry:k[5],x:k[6]/10-N.x,y:k[7]/10-N.y,z:k[8]/10,outline:z,height:w,path:_}}(!x||!E)&&Object.assign(H,{rz:0,rx:0,ry:0,x:0,y:0,z:0}),H.Footprint=T.attrKeyValue.Footprint,H.Designator=T.attrKeyValue.Designator,H.Device=T.attrKeyValue.Device,H["3D Model Title"]=T.attrKeyValue["3D Model Title"];let W=T.layerId===s?a:l,L=T.position.add(u);P(["COMPONENT",T.globalIndex,0,W,L.x,L.y,zt.toDegrees(T.layerId===s?T.rotation:(3*Math.PI-T.rotation)%(2*Math.PI)),H,0])}else p.push(T.globalIndex)});let b=c.join(`
`);if(console.debug("export components",b),r)return{dataStr:b,normalComponentIndexs:d,generatedComponentIndexs:m,unboundComponentIndexs:p};return b;function P(T){c.push(JSON.stringify(T))}}async function JX(){let o=new Set;Ar.getAllItem().forEach(e=>{e.attrKeyValue["3D Model Title"]&&e.attrKeyValue["3D Model"]&&o.add(e.attrKeyValue["3D Model"])});let t={};for(let e of o){let{uuid:r,path:i}=_V(e),n=(await A.windowBridge.rpcCall("ui/getD3ModelItem",{d3modelPath:i,d3modelUuid:r},Q())).message;if(n&&n.dataStr){let s=n.dataStr;t[`${r}|${i}`]=JSON.parse(s).model}else/^[^|]+\.ste?p\|[^|]+$/i.test(e)?t[`${r}|${i}`]=e:t[`${r}|${i}`]=r}return t}function _V(o){let[t,e]=(o==null?void 0:o.split("|"))||[];return{uuid:t,path:e||"0819f05c4eef4c71ace90d822a990e87"}}function k_t(o){let t=new Array,e=[],r=o.layerId==2;r&&(o.layerId=1);for(let s of o.getSilkLines())s instanceof rr||s instanceof Pr?t.push(s.getMathGraphics()):s instanceof lt&&(s.isClose()?t.push(s.getMathGraphics()):e.push(s));if(e.length){let s=B_t(e);s&&t.push(s)}let i,n=0;for(let s of t){let a=s.bbox().area();a>n&&(i=s,n=a)}if(i&&o.getPads().every(l=>{let c=l.getMathGraphics();return new As(c,i,0).relation==2})){let l=Qe.translate1(o.position.mul(-1)).rotate(-o.rotation);return r&&(o.layerId=2),i.multiply3(l)}return r&&(o.layerId=2),null}function B_t(o){let t=new _e;for(let s of o)t.ext1(s.buildBBox());let e=t.build(),r=[];o.forEach(s=>xe.addAll(r,s.getMathGraphics().primitives));let n=new $c(e,2,.1,new Di(4),r).detect();if(n&&n.bbox().area()<=e.area())return n.items[0]}var tle=class{constructor(){this.endFlag="END";this.IDFVersion="3.0";this.originFlag="EasyEDA Pro ";this.editorVersion="";this.content=[];this.tempFile="";this.lineItems=[];this.groupsItems=[];this.pcbName="";this.SPACE="  ";this.NEWLINE=`
`;this.zip=new gze.default;this.projectName="";this.fileName="";this.unit="THOU";this.precision=1;this.libData=new Map;this.offsetArr=[];this.init()}init(){this.editorVersion=R.getInstance().editorVersion,this.pcbName=R.getInstance().name,this.projectName=R.getInstance().projectTitle;let t=this.getCurrentTimeFormatted("-"),e=`IDF-3.0_${this.pcbName}_${this.projectName}_${t}`;this.fileName=e,this.unit=R.getInstance().unit=="mil"?"THOU":"MM",this.precision=this.unit=="THOU"?1:3,this.matrix=Qe.translate1(S.ORIGIN.sub(R.getInstance().origin)),this.panelizeDefaultParam=this.getDefaultPanelize(),this.panelizeDefaultParam.on&&this.panelizeDefaultParam.success&&(this.offsetArr=this.getOffsetArr())}getDefaultPanelize(){let t=si.getInstance().getDefaultPanelize();return{on:t.on,success:t.success,row:t.row,column:t.column,rowSpacing:t.rowSpacing,columnSpacing:t.columnSpacing,onlyOutline:t.onlyOutline,singleBBox:si.getInstance().singleBBox,outerBBox:si.getInstance().outerBBox,offset:si.getInstance().offset}}getOffsetArr(){let t=[];if(this.panelizeDefaultParam.on&&this.panelizeDefaultParam.success){let{row:e,column:r,offset:i}=this.panelizeDefaultParam;for(let n=0;n<e;n++)for(let s=0;s<r;s++){if(n===0&&s===0)continue;let a=new S(i.x*s,i.y*n),l=Bs.conversion("mil",R.getInstance().unit,a.x*10).toFixed(this.precision),c=Bs.conversion("mil",R.getInstance().unit,a.y*10).toFixed(this.precision),h=new S(+l,+c);t.push(h)}}return t}panelizeCraft(t,e,r){let i=si.getInstance().getClosures();for(let h of i)for(let u of h)this.addDataItem(t),this.addDataItem("UNOWNED",!0),this.addDataItem(e,!0,10),u=u.multiply3(this.matrix),this.handlePolygonItem(u,0),this.addDataItem(r,!0),this.groupsToContent();let n=si.getInstance().positionHoles;this.addDataItem(".DRILLED_HOLES",!0);let a=si.getInstance().stampGroups,l=n.concat(...a);for(let h of l)this.padOrViaData(h.radius,h.center,"NPTH",null,"Other");let c=`.${this.endFlag}_DRILLED_HOLES`;this.addDataItem(c,!0),this.groupsToContent()}panelizeData(t,e,r,i){let n=1;for(let s of this.offsetArr){for(let a of t)a.forEach((l,c)=>{if(this.getConditionByType(e,a.length-1,c))l=l.map((h,u)=>(e=="PLACEMENT"&&c%2!==0&&c!==a.length-1&&u==l.length-1&&(h=h+`_${n}`),h)),this.addData(l);else{let u=new S(l[r],l[i]).multiply3(Qe.translate1(s)),d=[];l.forEach((p,m)=>{m==r?d.push(u.x.toFixed(this.precision)):m==i?d.push(u.y.toFixed(this.precision)):(e=="DRILLED_HOLES"&&m==7&&p!=="BOARD"&&(p=p+`_${n}`),d.push(p))}),this.addData(d)}});n++}}getConditionByType(t,e,r){switch(t){case"BOARD_OUTLINE":case"ROUTE_KEEPOUT":return[0,1,e].includes(r);case"DRILLED_HOLES":return[0,e].includes(r);case"PLACEMENT":return[0,e].includes(r)||r%2!==0;default:return[0,e].includes(r)}}addData(t){this.content.push(t)}addGroupData(t){this.groupsItems.push(t)}addDataItem(t,e=!1,r=0){r&&this.lineItems.push("".padStart(r,this.SPACE));let i=t;this.lineItems.push(i),e&&(this.addGroupData(this.lineItems),this.lineItems=[])}groupsToContent(){for(let t of this.groupsItems)this.addData(t);this.groupsItems=[]}generateHeader(t){this.addDataItem(".HEADER",!0);let r=t,i=this.getCurrentTimeFormatted(":"),n="1";this.addDataItem(r),this.addDataItem(this.IDFVersion,!1,10);let s=`"${this.originFlag}${this.editorVersion}"`;this.addDataItem(s),this.addDataItem(i),this.addDataItem(n,!0),t=="BOARD_FILE"&&(this.addDataItem(this.formatName(this.pcbName)),this.addDataItem(this.unit,!0));let a=`.${this.endFlag}_HEADER`;this.addDataItem(a,!0),this.groupsToContent()}generateOutlineProfile(){let t=".BOARD_OUTLINE",r=Pe.getLayerPhys().reduce((a,l)=>(a+=l.thickness*10,a),0);r=this.toFixedByUnit(r);let i=`.${this.endFlag}_BOARD_OUTLINE`,n=this.outlineGrouping(),s=this.generateOutlineDataByList(n,t,r,i);this.panelizeDefaultParam.on&&this.panelizeDefaultParam.success&&(this.panelizeCraft(t,r,i),this.offsetArr.length&&this.panelizeData(s,"BOARD_OUTLINE",2,4))}generateOutlineDataByList(t,e,r,i){let n=[];for(let s of t){this.addDataItem(e),this.addDataItem("UNOWNED",!0),this.addDataItem(r,!0,10);let a=s[0],l=s.slice(1),c=1;this.handleItemOutline(a,0);for(let h of l)this.handleItemOutline(h,c),c++;this.addDataItem(i,!0),n.push([...this.groupsItems]),this.groupsToContent()}return n}outlineGrouping(){let t=[],e=this.getSlotRegion(),r=Au();r=r.sort((n,s)=>s.bbox.area()-n.bbox.area());let i=n=>{let a=n.splice(0,1)[0];if(!a)return t;let l=[a],c=[];n.forEach(h=>{h.bbox.isSeparated(a.bbox)?c.push(h):l.push(h)});for(let h=0;h<e.length;h++){let u=e[h];u.bbox.isSeparated(a.bbox)||(l.push(u),e.splice(h,1),h--)}t.push(l),c.length&&i(c)};return i(r),t}getSlotRegion(){let t=vi.getInstance().getAllItem().filter(n=>n.type=="Slot Region"&&!n.isEmpty),e=Qi.getInstance().getAllItem().filter(n=>n.type=="Slot Region"&&!n.isEmpty),r=Fi.getInstance().getAllItem().filter(n=>n.type=="Slot Region"&&!n.isEmpty),i=[];return xe.addAll(i,t),xe.addAll(i,e),xe.addAll(i,r),i}handleItemOutline(t,e){if(t instanceof yo){let r=t.center,i=t.radius,n=r.add1(i,0),s=[r,n];e==null&&(e=t.getMathGraphics().area(.1)>0?0:1);for(let a=0;a<s.length;a++){let l=s[a].multiply3(this.matrix);this.handleAddDataItem(e,l.x,l.y,a>0?360:0)}}else if(t instanceof ss||t instanceof Za){let r=t.getMathGraphics();if(r instanceof ge)e==null&&(e=r.area(.1)>0?0:1),r=r.multiply3(this.matrix),this.handlePolygonItem(r,e);else for(let i of r.items)e==null&&(e=i.area(.1)>0?0:1),i=i.multiply3(this.matrix),this.handlePolygonItem(i,e)}}handlePolygonItem(t,e){let r=t.area(.1)>0;!!e==r&&(t=t.reverse()),this.handlePolygonData(t,e)}handlePolygonData(t,e){for(let r=0;r<t.primitives.length;r++){let i=t.primitives[r],n=i.end();if(i instanceof M)this.handleAddDataItem(e,n.x,n.y,0),r==t.primitives.length-1&&this.asClose(t,e);else if(i instanceof q){if(t.primitives.length==1&&i.start().equals1(i.end())&&i.rx>0){let a=[i.center,n];for(let l=0;l<a.length;l++){let c=a[l];this.handleAddDataItem(e,c.x,c.y,l>0?360:0)}continue}this.handleAddDataItem(e,n.x,n.y,i.sweepAngle),r==t.primitives.length-1&&this.asClose(t,e)}}}asClose(t,e){let r=t.primitives[0],i=r.end(),n=0;r instanceof M?n=0:r instanceof q&&(n=r.sweepAngle),this.handleAddDataItem(e,i.x,i.y,n)}handleAddDataItem(t,e,r,i){this.addDataItem(t),this.addDataItem(this.toFixedByUnit(e*10),!1,10),this.addDataItem(this.toFixedByUnit(r*10),!1,10),this.addDataItem(this.toFixedByUnit(i,3,"mil"),!0,10)}generateRouteKeepOutProfile(){let t=this.getProhibitArea(),e=[];for(let[r,i]of t){if(r=="track")for(let n of i){this.addDataItem(".ROUTE_KEEPOUT"),this.addDataItem("ECAD",!0);let a=this.getLayer(n.layerId,r);this.addDataItem(a,!0),this.handleItemOutline(n);let l=`.${this.endFlag}_ROUTE_KEEPOUT`;this.addDataItem(l,!0),e.push([...this.groupsItems]),this.groupsToContent()}if(r=="device")for(let n of i){if(Es(n.layerId))continue;this.addDataItem(".PLACE_KEEPOUT"),this.addDataItem("ECAD",!0);let a=this.getLayer(n.layerId,r);this.addDataItem(a),this.addDataItem("0.0",!0,10),this.handleItemOutline(n);let l=`.${this.endFlag}_PLACE_KEEPOUT`;this.addDataItem(l,!0),e.push([...this.groupsItems]),this.groupsToContent()}}!this.panelizeDefaultParam.onlyOutline&&this.offsetArr.length&&this.panelizeData(e,"ROUTE_KEEPOUT",2,4)}getProhibitArea(){let t=vi.getInstance().getAllItem().filter(l=>l.type=="Prohibited Region"&&!l.isEmpty),e=Qi.getInstance().getAllItem().filter(l=>l.type=="Prohibited Region"&&!l.isEmpty),r=Fi.getInstance().getAllItem().filter(l=>l.type=="Prohibited Region"&&!l.isEmpty),i=[];xe.addAll(i,t),xe.addAll(i,e),xe.addAll(i,r);let n=new Map,s=[],a=[];for(let l of i){let c=l.component;c.device&&a.push(l),c.track&&s.push(l)}return s.length&&n.set("track",s),a.length&&n.set("device",a),n}getLayer(t,e){let r="";switch(t==1?r="TOP":t==2&&(r="BOTTOM"),e){case"track":t==12?r="ALL":Es(t)&&(r="INNER");break;case"device":t==12&&(r="BOTH");break}return r}generateDrillHolesArea(){let t=[];this.addDataItem(".DRILLED_HOLES",!0),this.handleViaData(),this.handlePadData();let r=`.${this.endFlag}_DRILLED_HOLES`;this.addDataItem(r,!0),t.push([...this.groupsItems]),this.groupsToContent(),!this.panelizeDefaultParam.onlyOutline&&this.offsetArr.length&&this.panelizeData(t,"DRILLED_HOLES",3,5)}handleViaData(){bn.getInstance().iterator(t=>{let r=t.getParent();this.padOrViaData(t.holeRadius,t.center,"PTH",r,"VIA")})}handlePadData(){jn.getInstance().iterator(t=>{if(t.layerId==12){let e=t.plated?"PTH":"NPTH",r=t.getParent(),i=r&&r instanceof Bi?"PIN":"Other";this.padOrViaData(t.holeRadius,t.center,e,r,i)}})}padOrViaData(t,e,r,i,n){let s=t*2;e=e.multiply3(this.matrix);let a=i&&i instanceof Bi?i.designator:"BOARD",l="ECAD";this.addDataItem(this.toFixedByUnit(s*10),!1,10),this.addDataItem(this.toFixedByUnit(e.x*10),!1,10),this.addDataItem(this.toFixedByUnit(e.y*10),!1,10),this.addDataItem(r),this.addDataItem(a),this.addDataItem(n),this.addDataItem(l,!0)}async generatePlacementArea(){let t=[];this.addDataItem(".PLACEMENT",!0),await this.handleComponentData();let r=`.${this.endFlag}_PLACEMENT`;this.addDataItem(r,!0),t.push([...this.groupsItems]),this.groupsToContent(),!this.panelizeDefaultParam.onlyOutline&&this.offsetArr.length&&this.panelizeData(t,"PLACEMENT",1,3)}async handleComponentData(){let t=await JX(),e=Ms.getInstance().getAllItem(),r=new Map;for(let i of e){let n=i.attrKeyValue.Footprint,s=i.attrKeyValue.Device,a=i.attrKeyValue.Designator,l=i.position.multiply3(this.matrix),c=i.attrKeyValue.Height;c=c?this.extractNumberAndUnit(c):await this.getFootprintHeightBy3D(i,t);let u=i.getComponentShapes().map(P=>P.getMathGraphics()),p=Hi.getItem(i.footprintUUID).getSource(),m=r.get(n);m?(m.dataStr!=p||m.deviceName!=i.attrKeyValue.Device)&&(n=`${a}_${n}`):r.set(n,{dataStr:p,deviceName:i.attrKeyValue.Device});let g={footprintName:n,deviceName:s,center:l,height:c,bbox:i.box.getMathGraphics(),polys:u,rotation:i.rotation};this.libData.set(n,g),this.addDataItem(this.formatName(n)),this.addDataItem(this.formatName(s)),this.addDataItem(this.formatName(a),!0),this.addDataItem(this.toFixedByUnit(l.x*10),!1,10),this.addDataItem(this.toFixedByUnit(l.y*10),!1,10),this.addDataItem(this.toFixedByUnit(0),!1,10);let y=i.rotation*(180/Math.PI);this.addDataItem(this.toFixedByUnit(y,3,"mil"),!1,10);let b=i.layerId==1?"TOP":"BOTTOM";this.addDataItem(b),this.addDataItem("PLACED",!0)}}formatName(t){return t.includes(" ")?`"${t}"`:t}async getFootprintHeightBy3D(t,e){let i=t.attrKeyValue["3D Model Title"]?t.attrKeyValue["3D Model"]:"",n=t.attrKeyValue["3D Model Transform"];console.debug("handling 3d model",t.globalIndex,"compoent",i,"with",n);let{uuid:s,path:a}=_V(i),l=e[`${s}|${a}`]||i||"",c=Hi.getItem(t.footprintUUID).getBBox(),h=t.attrKeyValue.Height,u=0;Number.isNaN(parseFloat(h))||(u=+h||h&&na(h,"mil")||0);let d=n&&n.trim().startsWith("v2:"),p;if(d){let g=JSON.parse(n.trim().slice(3)),b=new Ae([g[0],g[1],g[2],0,g[3],g[4],g[5],0,g[6],g[7],g[8],0,g[9],g[10],g[11],1]).scale(1/10).data;p={uuid:l||"default_model",dx:c.width(),dy:c.height(),dz:u,transformV2:JSON.stringify([b[0],b[1],b[2],b[4],b[5],b[6],b[8],b[9],b[10],b[12],b[13],b[14]])}}else{let g=n?n.split(",").map(P=>parseFloat(P)):new Array(9).fill(0),y=l&&(g[0]||g[1]||g[2]),b=Hi.getItem(t.footprintUUID).getOrigin();p={uuid:l||"default_model",dx:y?g[0]/10:c.width(),dy:y?g[1]/10:c.height(),dz:y?g[2]/10:u,rz:g[3],rx:g[4],ry:g[5],x:g[6]/10-b.x,y:g[7]/10-b.y,z:g[8]/10}}return(await(await A.windowBridge.rpcCall("/engine/getComponentInfo/height3D",p,Q())).message/10).toString()}generateLibData(){let t=".ELECTRICAL",e=`.${this.endFlag}_ELECTRICAL`;for(let[r,i]of this.libData.entries()){this.addDataItem(t,!0);let{footprintName:n,deviceName:s,height:a,bbox:l,center:c,polys:h,rotation:u}=i;this.addDataItem(this.formatName(n)),this.addDataItem(this.formatName(s)),this.addDataItem(this.unit),this.addDataItem(this.toFixedByUnit(+a*10),!0,10);let d=this.matrix.translate(-c.x,-c.y).rotate(-u);if(h&&h.length)for(let p of h)if(p instanceof ge)p=p.multiply3(d),this.handleLibPolygonItem(p);else for(let m of p.items)m=m.multiply3(d),this.handleLibPolygonItem(m);else{let p=l.multiply3(d);this.handleLibPolygonItem(p)}this.addDataItem(e,!0),this.groupsToContent()}}handleLibPolygonItem(t){let r=t.area(.1)>0?0:1;this.handlePolygonData(t,r)}async exportIDFFile(){await this.generateBoardFile(),this.generateLibFile(),await this.downLoadFile()}async generateBoardFile(){this.generateHeader("BOARD_FILE"),this.generateOutlineProfile(),this.generateRouteKeepOutProfile(),this.generateDrillHolesArea(),await this.generatePlacementArea(),this.exportData(),this.saveIDFFile("BOARD_FILE")}generateLibFile(){this.generateHeader("LIBRARY_FILE"),this.generateLibData(),this.exportData(),this.saveIDFFile("LIBRARY_FILE")}exportData(){for(let t=0;t<this.content.length;t++){let e=this.content[t];this.content[t]=[e.join(this.SPACE)]}this.tempFile=this.content.join(this.NEWLINE),this.content=[]}saveIDFFile(t){let e;t=="BOARD_FILE"?e=this.fileName+".emn":t=="LIBRARY_FILE"&&(e=this.fileName+".emp"),this.zip.file(e,this.tempFile),this.tempFile=""}async downLoadFile(){let t=this.fileName;await this.zip.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:6}}).then(function(e){let r=t+".zip";D2?JI(e,r,"zip"):xd.downloadFile(r,e)})}getCurrentTimeFormatted(t){let e=new Date,r=e.getFullYear(),i=("0"+(e.getMonth()+1)).slice(-2),n=("0"+e.getDate()).slice(-2),s=("0"+e.getHours()).slice(-2),a=("0"+e.getMinutes()).slice(-2),l=("0"+e.getSeconds()).slice(-2);return t==":"?`${r}/${i}/${n}.${s}:${a}:${l}`:`${r}-${i}-${n}`}toFixedByUnit(t,e,r=R.getInstance().unit,i=new dt){e||(e=this.precision);let n=i||new dt;return r!="mil"&&(t=n.conversion("mil",r,t)),t.toFixed(e)}extractNumberAndUnit(t){let r=/(\d+(\.\d+)?)\s+([a-zA-Z]+)/i.exec(t);if(r){let i=r[1],n=r[3];return n.toLocaleLowerCase()!==R.getInstance().unit&&(i=(new dt().conversion(this.exchange(n),R.getInstance().unit,Number(i))/10).toString()),i}else return null}exchange(t){let e;switch(t){case"MM":e="mm";break;case"THOU":case"MILS":case"MIL":e="mil";break}return e}};var rle=class{exportText(t,e=6){return""}getMaxNumber(){return 0}},QX=class extends rle{constructor(t){super(),this.oldUnit=t,this.newUnit=1e3}exportText(t,e=6){t=Math.abs(t);let r=nn.convert(t,this.oldUnit,this.newUnit);r=r*1e4;let i=r.toFixed(0),n="";if(i.length<e){let a=e-i.length;for(let l=0;l<a;l++)n+="0"}return n+i}getMaxNumber(){return nn.convert(99.9999,this.newUnit,this.oldUnit)}},eq=class extends rle{constructor(t){super(),this.oldUnit=t,this.newUnit=39.37}exportText(t,e=6){t=Math.abs(t);let r=nn.convert(t,this.oldUnit,this.newUnit);r=r*1e3;let i=r.toFixed(0),n="";if(i.length<e){let a=e-i.length;for(let l=0;l<a;l++)n+="0"}return n+i}getMaxNumber(){return nn.convert(999.999,this.newUnit,this.oldUnit)}};var ile=class{constructor(t){this.unit=t}flagData(t){return rd(t,3)}solderData(t){let e=t.toString();return"S"+rd(e,1)}layerData(t){let e="L";return e+=x3e(t,2),e}infoData(t,e,r){return t=t||"",e=e||"",r=r||"",t+r+e}netData(t){return t=t||"N/C",rd(t,14)}emptyData(t=3){return rd("",t)}compIdentity(t,e,r){let i="",n="";return t?n=rd("VIA",6):n=rd(r||"",6),i+=n,i+=rd("-",1),i+=rd(e||"",4),i+=" ",i}holeIdentity(t,e){let r=this.unit,i="";return t==null?i+=rd("",5):(i+="D",i+=r.exportText(t,4)),e==null?i+=rd("",1):e?i+="P":i+="U",i}testPointAccess(t){let e="A";return e+=x3e(t,2),e}testPoint(t){let e=this.unit,r="X";return t.x<0?r+="-":r+=" ",r+=e.exportText(t.x),r+="Y",t.y<0?r+="-":r+=" ",r+=e.exportText(t.y),r}shapeData(t,e,r){let i=this.unit;t!=null&&e==null&&(r=null);let n="";return t!=null?(n+="X",n+=i.exportText(t,4)):n+=rd(" ",5),n+="Y",e!=null?n+=i.exportText(e,4):n+=rd(" ",4),r!=null?(n+="R",n+=x3e(zt.regularD(r))):n+=rd(" ",4),n+=rd("",1),n}xNumber(t){let e=this.unit,r="X";return t<0&&(r+="-"),r+=e.exportText(t,-1),r}yNumber(t){let e=this.unit,r="Y";return t<0&&(r+="-"),r+=e.exportText(t,-1),r}};function rd(o,t,e=!0){let r=o.length;if(r<t){let i=t-r;for(let n=0;n<i;n++)o+=" "}else e&&r>t&&(o=o.slice(0,t));return o}function x3e(o,t=3){let e=o.toFixed(0),r="",i=e.length;if(i<t){let n=t-i;for(let s=0;s<n;s++)r+="0"}return r+e}var rp=class o{constructor(t){this.data=[];this.data=t}exportText(){let t="";return this.data.forEach(e=>{t+=e}),t}static create(t){return new o(t)}};var nle=class{constructor(t){this.c_columnData=[];this.p_columnData=[];this.columnData=[];this.nameNum=0;this.desNum=0;this.padNum=0;this.layerNum={};this.netNameMap=new Rl;this.desNameMap=new Rl;this.padNameMap=new Rl;this.convert=new ile(t),this._unit=t}checkValidBbox(t,e){this.matrix=e,t=t.transform(e);let r=this._unit.getMaxNumber();if(!(Math.abs(t.minX)<r&&Math.abs(t.minY)<r&&Math.abs(t.maxX)<r&&Math.abs(t.maxY)<r)){let i;return t.width()<r&&t.height()<r?i=t.LL():i=t.center(),this.matrix=this.matrix.translate1(i.mul(-1)),!1}return!0}getNewNetData(t){let e=this.convert.flagData("P");this.nameNum++;let r=rd("NNAME"+this.nameNum,10);return this.addPRow(rp.create([e,this.convert.infoData(r,t,this.convert.emptyData(1))])),this.convert.netData(r)}getNewDesData(t){let e=this.convert.flagData("C");this.desNum++;let r="UT"+this.desNum;return this.addCRow(rp.create([e,this.convert.infoData(r,t,this.convert.emptyData(1)+"replaces"+this.convert.emptyData(1))])),r}getNewPadData(t){let e=this.convert.flagData("C");this.padNum++;let r="T"+this.padNum;return this.addCRow(rp.create([e,this.convert.infoData(r,t,this.convert.emptyData(1)+"replaces"+this.convert.emptyData(1))])),r}set pcbName(t){this._pcbName=t}set projectName(t){this._projectName=t}getFileName(){let t=this._pcbName,e=this._projectName;return`IPC_${t}_${e}_${L6(new Date,"yyyy-MM-dd")}.356a`}addPcbComment(t){let e=this.convert.flagData("C");for(let r in t){let i=this.convert.infoData(r,t[r],":");this.addCRow(rp.create([e,i]))}}addEnd(){let t=this.convert.flagData("C");this.addCRow(rp.create([t,this.convert.infoData("--------------------------------------------------")])),this.addRow(rp.create([this.convert.flagData("999")]))}addCRow(t){this.c_columnData.push(t)}addPRow(t){this.p_columnData.push(t)}addRow(t){this.columnData.push(t)}addPcbLayerComment(t){let e=this.convert.flagData("C"),r=this.convert.infoData("--------------- Layer Stackup --------------------");this.addCRow(rp.create([e,r])),this.layerNum={12:0};let i=1;for(let n of t)r=this.convert.infoData(n.layerName,"",""),this.layerNum[n.layerId]=i,this.addCRow(rp.create([e,r])),i++;r=this.convert.infoData("------------- Replace The Group ------------------"),this.addCRow(rp.create([e,r]))}addHeader(t){let e=this._unit.newUnit,r=this.convert.flagData("P"),i=this.convert.emptyData(2);this.addPRow(rp.create([r,this.convert.infoData(rd("JOB",4,!1))])),this.addPRow(rp.create([r,this.convert.infoData(rd("CODE",4,!1),"UTF-8",i)])),this.addPRow(rp.create([r,this.convert.infoData(rd("UNITS",4,!1),e==1e3?"CUST 0":"CUST 1",i)])),this.addPRow(rp.create([r,this.convert.infoData(rd("TITLE",4,!1),t,i)])),this.addPRow(rp.create([r,this.convert.infoData(rd("NUM",4,!1),"1.0",i)])),this.addPRow(rp.create([r,this.convert.infoData(rd("REV",4,!1),"A",i)])),this.addPRow(rp.create([r,this.convert.infoData(rd("VER",4,!1),"IPC-D-356A",i)]))}addPad(t){let{flag:e,net:r,des:i,padNum:n,hole:s,layerId:a,loc:l,xSize:c,ySize:h,rotate:u,topSolder:d,botSolder:p,isPlated:m}=t,g=this.layerNum[a],y=0;d==null&&(y+=1),p==null&&(y+=2);let b=[this.convert.flagData(e),this.getNetData(r),this.convert.emptyData(),this.convert.compIdentity(!1,this.getPadData(n),this.getDesData(i)),this.convert.holeIdentity(s,m),this.convert.testPointAccess(g),this.convert.testPoint(l.multiply3(this.matrix)),this.convert.shapeData(c,h,u),this.convert.solderData(y)],P=rp.create(b);this.addRow(P)}addPadHole(t){let{flag:e,net:r,hole:i,layerId:n,loc:s,isPlated:a}=t,l=this.layerNum[n],c=[this.convert.flagData(e),this.getNetData(r),this.convert.emptyData(),this.convert.compIdentity(!1,null,null),this.convert.holeIdentity(i,a),this.convert.testPointAccess(l),this.convert.testPoint(s.multiply3(this.matrix))],h=rp.create(c);this.addRow(h)}addBoard(t,e){let r=[this.convert.flagData("389"),rd("BOARD_EDGE",14),rd("",5),this.convert.xNumber(e),this.convert.yNumber(e),rd("",1)],i=this.addVector2(t,r,74);for(let n of i)this.addRow(n)}addVector2(t,e,r,i="089"){let n=[],s=0;for(let c of e)s+=c.length;let a,l;for(let c of t){c=c.multiply3(this.matrix);let h=[];a!=null?(ne.eq(a,c.x)||h.push(this.convert.xNumber(c.x)),ne.eq(l,c.y)||h.push(this.convert.yNumber(c.y))):(h.push(this.convert.xNumber(c.x)),h.push(this.convert.yNumber(c.y)));let u=0;for(let d of h)u+=d.length;if(s+u>r){n.push(rp.create(e));let d=this.convert.flagData(i);e=[d,this.convert.emptyData(1)],s=d.length+1}s+=u,xe.addAll(e,h),a=c.x,l=c.y,e.push(this.convert.emptyData(1)),s+=1}return e.pop(),n.push(rp.create(e)),n}addVia(t){let{flag:e,net:r,hole:i,loc:n,topSolder:s,botSolder:a,isPlated:l,startLayer:c,endLayer:h,layerId:u,xSize:d}=t,p=this.layerNum[u||c],m=0;s==null&&(m+=1),a==null&&(m+=2);let g=e=="307"?null:d,y=[this.convert.flagData(e),this.getNetData(r),this.convert.emptyData(),this.convert.compIdentity(!0),this.convert.holeIdentity(i,l),this.convert.testPointAccess(p),this.convert.testPoint(n.multiply3(this.matrix)),this.convert.shapeData(g,null,null),this.convert.solderData(m)];e=="307"&&(y.push(this.convert.layerData(this.layerNum[c])),y.push(this.convert.layerData(this.layerNum[h])));let b=rp.create(y);if(this.addRow(b),e=="307"){let P=[this.convert.flagData("027"),rd("",14),this.convert.emptyData(),this.convert.compIdentity(!0),this.convert.holeIdentity(null,null),this.convert.testPointAccess(p),this.convert.testPoint(n.multiply3(this.matrix)),this.convert.shapeData(d,null,null)],T=rp.create(P);this.addRow(T)}}addTracks(t){let{layerId:e,width:r,vectors:i,net:n}=t,s="378",a=[this.convert.flagData(s),this.getNetData(n),this.convert.emptyData(1),this.convert.layerData(this.layerNum[e]),this.convert.emptyData(1),this.convert.xNumber(r),this.convert.emptyData(1)],l=this.addVector2(i,a,74,"078");for(let c of l)this.addRow(c)}addVector(t){let e=[],r,i;for(let n of t)n=n.multiply3(this.matrix),r!=null?(ne.eq(r,n.x)||e.push(this.convert.xNumber(n.x)),ne.eq(i,n.y)||e.push(this.convert.yNumber(n.y))):(e.push(this.convert.xNumber(n.x)),e.push(this.convert.yNumber(n.y))),r=n.x,i=n.y,e.push(this.convert.emptyData(1));return e.pop(),e}getNetData(t){let e=this.netNameMap.get(t);return e||(t=t||"",t.length>14?e=this.getNewNetData(t):e=this.convert.netData(t),this.netNameMap.put(t,e)),e}getDesData(t){let e=this.desNameMap.get(t);return e||(t=t||"",t.length>6?e=this.getNewDesData(t):e=t,this.desNameMap.put(t,e)),e}getPadData(t){let e=this.padNameMap.get(t);return e||(t=t||"",t.length>4?e=this.getNewPadData(t):e=t,this.desNameMap.put(t,e)),e}exportText(){let t="";return this.c_columnData.forEach(e=>{t+=e.exportText()+`
`}),this.p_columnData.forEach(e=>{t+=e.exportText()+`
`}),this.columnData.forEach(e=>{t+=e.exportText()+`
`}),t}};var ole=class{constructor(t){this.document=t}getCommentInfo(){let t={name:R.getInstance().name},e=[],r=Ze.getInstance().getLayerPhys(),i=["TOP","BOTTOM","SIGNAL","PLANE"];for(let n of r)i.includes(n.layerType)&&e.push({layerName:n.layerName,layerId:n.layerId});return{pcbInfo:t,stackupLayer:e}}checkBBox(){let t=new _e,e=jn.getInstance().getAllItem();for(let a of e)t.ext2(a.center);let r=bn.getInstance().getAllItem();for(let a of r)t.ext2(a.center);this.getPolyItemBBox(vi.getInstance().getAllItem(),t),this.getPolyItemBBox(Qi.getInstance().getAllItem(),t),this.getPolyItemBBox(Fi.getInstance().getAllItem(),t);let i=Sn.getInstance().getAllItem();for(let a of i)t.ext1(a.bbox);let n=t.build1(),s=R.getInstance().origin;return this.document.checkValidBbox(n,Qe.translate1(s.mul(-1)))}getPolyItemBBox(t,e){for(let r of t)this.filterOutline(r)&&e.ext1(r.bbox)}generatePad(){let t=jn.getInstance().getAllItem(),e=Ze.getInstance();for(let r of t)e.getLayer(r.layerId).type=="MULTI"?r.type==1?this.parseMultiCommonPad(r):this.parseCustomPad(r):this.parseSinglePad(r)}generateVia(){let t=bn.getInstance().getAllItem();for(let e of t){let r=e.radius*2,i,n,s,a,l=e.topExpansion+e.radius,c=e.bottomExpansion+e.radius;ne.lesseq(l,0)&&(l=null),ne.lesseq(c,0)&&(c=null),e.type==1?(i="307",s=e.startLayer,a=e.endLayer,s!==1&&(l=null),a!==2&&(c=null),n=1,a==2&&(n=2)):(i="317",n=e.layerId),this.document.addVia({flag:i,net:this.hasConnect(e)?e.net:"",hole:e.holeRadius*2,loc:e.center,startLayer:s,endLayer:a,layerId:n,topSolder:l,botSolder:c,isPlated:!0,xSize:r})}}hasConnect(t){let e=!1;vp.useWireClusterCache=!0;let r=t.net,i=uS(r);for(let n of i)if(n.has(t.globalIndex)){e=n.size>1;break}return vp.useWireClusterCache=!1,e}generateBoard(){let t=vi.getInstance().getAllItem();xe.addAll(t,Qi.getInstance().getAllItem()),xe.addAll(t,Fi.getInstance().getAllItem());let e=[];for(let r of t)this.filterOutline(r)&&e.push(r);for(let r of e){let i=r.getMathGraphics();i.area()<0&&(i=i.reverse());let s=i.primitives,a=[];for(let l of s)xe.addAll(a,l.points(.1));this.document.addBoard(a,r.strokeWidth)}}filterOutline(t){return t.layerId==11}parseCustomPad(t){let e;t.plated?e="317":e="367";let r=t.topSolderExpansion+Math.min(t.top.width,t.top.height)/2,i=t.bottomSolderExpansion+Math.min(t.bottom.width,t.bottom.height)/2;ne.lesseq(r,0)&&(r=null),ne.lesseq(i,0)&&(i=null);let n=this.hasConnect(t)?t.net:"";this.parseSinglePadShape(t,1,e,r,i,n),this.parseSinglePadShape(t,t.layerId,"017",r,i,n),this.parseSinglePadShape(t,2,"017",r,i,n)}parseCustomPadHole(t,e){let r=this.getHole(t),s=Ze.getInstance().getLayer(t.layerId).type=="TOP"?t.top:t.bottom,a,l;s.type=="OVAL"||s.type=="ELLIPSE"?(a=Math.min(s.width,s.height),l=null):(a=s.width,l=s.height);let c=t.getParent()==null?"":t.net,h=t.center;this.document.addPadHole({flag:e,net:c,hole:r,layerId:t.layerId,loc:h,isPlated:t.plated})}parseSinglePadShape(t,e,r,i,n,s){let a=this.getHole(t),c=Ze.getInstance().getLayer(e),h,u;if(c.type=="MULTI")h=0,u=null;else{let b=c.type=="TOP"?t.top:t.bottom,P=this.getPadSize(b,t,e);h=P.xSize,u=P.ySize}let d="",p=t.getParent();p&&(d=p.designator);let m=t.num,g=t.center,y=zt.toDegrees(t.rotation);this.document.addPad({flag:r,net:s,des:d,padNum:m,hole:a,layerId:e,loc:g,xSize:h,ySize:u,rotate:y,topSolder:i,botSolder:n,isPlated:t.plated})}getPadMinDis(t,e){let r=t.primitives,i=null;for(let n of r){let a=new er(n,new M(e,e)).getDistance();(!i||i>a)&&(i=a)}return i||0}parseSinglePad(t){let e=Ze.getInstance(),r="327",i=e.getLayer(t.layerId),n=null,s,a,l=i.type=="TOP"?t.top:t.bottom,c=this.getPadSize(l,t,t.layerId);s=c.xSize,a=c.ySize;let h=Math.min(l.width,l.height),u=t.topSolderExpansion,d=t.bottomSolderExpansion;i.type=="TOP"?(u=u+h/2,d=null,ne.lesseq(u,0)&&(u=null)):(u=null,d=d+h/2,ne.lesseq(d,0)&&(d=null));let p=this.hasConnect(t)?t.net:"",m="",g=t.getParent();g&&(m=g.designator);let y=t.num,b=i.layerId,P=t.center,T=zt.toDegrees(t.rotation);this.document.addPad({flag:r,net:p,des:m,padNum:y,hole:n,layerId:b,loc:P,xSize:s,ySize:a,rotate:T,topSolder:u,botSolder:d,isPlated:!0})}getPadSize(t,e,r){let i=t.type,n=null,s=null;switch(i){case"ELLIPSE":n=Math.min(t.width,t.height),s=null;break;case"OVAL":{let c=Math.min(t.width,t.height);n=c,t.width>c*2&&(n=t.width-c,s=c),t.height>c*2&&(s=t.height-c)}break;case"POLYGON":let a=e.getMathGraphics(r);n=this.getPadMinDis(a,e.center)*2,s=null;break;default:n=t.width,s=t.height;break}return{xSize:n,ySize:s}}parseMultiCommonPad(t){let e=Ze.getInstance(),r,i,n=e.getLayer(t.layerId),s,a,l=!0,c=zt.toDegrees(t.rotation),h=t.topSolderExpansion,u=t.bottomSolderExpansion;t.plated?r="317":(r="367",l=!1),i=this.getHole(t);let d=this.getPadSize(t.top,t,1);s=d.xSize,a=d.ySize;let p=Math.min(t.top.width,t.top.height);h=h+p/2,u=u+p/2,ne.lesseq(h,0)&&(h=null),ne.lesseq(u,0)&&(u=null);let m=this.hasConnect(t)?t.net:"",g="",y=t.getParent();y&&(g=y.designator);let b=t.num,P=n.layerId,T=t.center;this.document.addPad({flag:r,net:m,des:g,padNum:b,hole:i,layerId:P,loc:T,xSize:s,ySize:a,rotate:c,topSolder:h,botSolder:u,isPlated:l})}generateTrack(){let t=Sn.getInstance().getAllItem(),e={};for(let r of t)if(r instanceof gt){if(e[r.globalIndex])continue;let i=this.findTracks(r,e),n=[];for(let s of i)xe.addAll(n,s.points(.1));t.forEach(()=>{}),this.document.addTracks({layerId:r.layerId,width:r.width,vectors:n,net:r.net})}}findTracks(t,e){let r=[t],i=t instanceof Ii?[q.build3(t.center,zt.toDegrees(t.startAngle),zt.toDegrees(t.sweepAngle),t.radius,t.radius)]:[new M(t.start,t.end)],n=t.end,s=Iu.getNode(t.net);for(;r.length>0;){let a=r.pop();e[a.globalIndex]=!0;let l=this.getConnect(a,n,s,e),c=l.nextItem;if(c){r.push(c),n=l.nextPoint;let h=c instanceof Ii?q.build3(c.center,zt.toDegrees(c.startAngle),zt.toDegrees(c.sweepAngle),c.radius,c.radius):new M(c.start,c.end);l.isStart?i.push(h):i.push(h.reverse())}}for(r.push(t),n=t.start;r.length>0;){let a=r.pop();e[a.globalIndex]=!0;let l=this.getConnect(a,n,s,e),c=l.nextItem;if(c){r.push(c),n=l.nextPoint;let h=c instanceof Ii?q.build3(c.center,zt.toDegrees(c.startAngle),zt.toDegrees(c.sweepAngle),c.radius,c.radius):new M(c.start,c.end);l.isStart?i.unshift(h.reverse()):i.unshift(h)}}return i}getConnect(t,e,r,i){let s,a,l=r.map.get(t);if(l){let h=Array.from(l.near).find(u=>{let d=u.item;if(d instanceof gt&&!i[d.globalIndex]&&ne.eq(t.width,d.width)){if(d.start.distance2(e)<1e-4)return s=d.end,a=!0,!0;if(d.end.distance2(e)<1e-4)return s=d.start,a=!1,!0}return!1});return{nextItem:h==null?void 0:h.item,nextPoint:s,isStart:a}}return{nextItem:null,nextPoint:s,isStart:a}}getHole(t){return t.hole.holeShape=="ROUND"?t.hole.holeLength:Math.min(t.holeLength,t.holeRadius*2)}};var tq=class{constructor(t){this.checked=!1;this.document=new nle(t),this.modelHandle=new ole(this.document)}checkBBox(){return this.checked=!0,this.modelHandle.checkBBox()}buildData(t){this.checked||this.modelHandle.checkBBox(),this.document.pcbName=R.getInstance().name,this.document.projectName=t.projectName,this.generateComment(t.projectName,t.boardName),this.document.addHeader(t.title),this.modelHandle.generatePad(),this.modelHandle.generateVia(),this.modelHandle.generateTrack(),this.modelHandle.generateBoard(),this.document.addEnd()}generateComment(t,e){let{pcbInfo:r,stackupLayer:i}=this.modelHandle.getCommentInfo(),n=new Date,s={"Project Name":t,"Board Name":e,"PCB Name":r.name,Date:gTe(n,"yyyy/MM/dd"),Time:gTe(n,"hh:mm:ss")};this.document.addPcbComment(s),this.document.addPcbLayerComment(i)}getCommentInfo(){let t={name:R.getInstance().name},e=[],r=Ze.getInstance().getLayerPhys(),i=["TOP","BOTTOM","SIGNAL","PLANE"];for(let n of r)i.includes(n.layerType)&&e.push(n.layerName);return{pcbInfo:t,stackupLayer:e}}exportText(){this.document.exportText()}};function yze(o){let t=R.getInstance().unit=="mm"?new eq(10):new QX(10),e=new tq(t);if(e.checkBBox())r();else{let i=new e0("Found board is far away from the origin. Will it be output in relative origin coordinates?",()=>{r()});A.publish("openMsgbox",i)}function r(){e.buildData({projectName:o.projectTitle,boardName:o.boardTitle,title:o.title}),xd.downloadFileASCII(e.document.getFileName(),e.document.exportText(),".txt")}return!0}function bze(o){let t=R.getInstance().unit=="mm"?new eq(10):new QX(10),e=new tq(t);return e.buildData({projectName:o.projectTitle,boardName:o.boardTitle,title:o.title}),{fileName:e.document.getFileName(),text:e.document.exportText()}}var sle=class{constructor(){this._highlightItems=new Set;let t=new Jt;A.subscribe("pcb/tempHightLightItems",e=>{let{ids:r=[],highlight:i=!0,cancelLastHighLight:n=!0}=e||{};n&&this.clearHighLight();let s=!1;r.forEach(a=>{let l=t.getItem(a);!l||l.isEmpty||!l.isVisible||(s=!0,i?l.isHighLight||(this._highlightItems.add(l),l.highLight(!0)):(this._highlightItems.delete(l),l.visible()))}),s&&A.publish("updateFrame","")},Q())}clearHighLight(){let t=!1;this._highlightItems.forEach(e=>{!e.isEmpty&&e.isVisible&&(e.visible(),t=!0)}),this._highlightItems.clear(),t&&A.publish("updateFrame","")}};function Pze(o){let{projectTitle:t,boardTitle:e,title:r}=o,i="OEM",n="oem",s=R.getInstance().name,a={},l=Ar.getAllItem();for(let u of l)[...Object.keys(u.attrsMap)].forEach(p=>{!a[p]&&(p.indexOf(i)>=0||p.indexOf(n)>=0)&&(a[p]={text:p,value:p})});let c=Object.values(a),h=V_t();return{data:{projectTitle:t,pcbName:s,boardTitle:e,title:r,oem:c,isEmptyDesignator:h}}}function V_t(){let o=Ar.getAllItem();for(let t of o)if(!t.designator)return!0;return!1}var W6=class W6{constructor(){this.map=new Map;this.repeatMap=new Map;this.enptyNum=0;this._auto=!1}static getInstance(){return W6.instance===null&&(W6.instance=new W6),W6.instance}set auto(t){this._auto=t}init(t=!1){this.auto=t}clear(){this.map.clear(),this.repeatMap.clear(),this.enptyNum=0,this.auto=!1}get(t){let e=t.globalIndex,r=this.map.get(e);if(!r){r=t.designator,!r&&this._auto&&(r="NONE"+this.enptyNum++);let i=this.repeatMap.get(r);i?(this.repeatMap.set(r,i+1),r=r+"-repeat"+i,this.map.set(e,r)):(this.map.set(e,r),this.repeatMap.set(r,1))}return r}};W6.instance=null;var pT=W6;function G_t(){let t=[];for(let e=0;e<10;e++)t[e]="  ".repeat(e);return t}var U_t={FunctionMode:()=>`    <FunctionMode mode="USERDEF" />
`,StepRef:o=>'    <StepRef name="'+o+`" />
`,BomRef:()=>`    <BomRef name="BOM" />
`,DictionaryColor:o=>{let t=(r,{r:i,g:n,b:s})=>'      <EntryColor id="'+r+`">
        <Color r="`+i+'" g="'+n+'" b="'+s+`"/>
      </EntryColor>
`;return`    <DictionaryColor>
`+o.map(r=>t(r.layerName,{r:r.color.r,g:r.color.g,b:r.color.b})).join("")+`    </DictionaryColor>
`},LayerRef:o=>'    <LayerRef name="'+o+`"/>
`,EntryColor:(o,t)=>'      <EntryColor id="LAYER_COLOR_'+o+`">
        <Color r="`+t.r+'" g="'+t.g+'" b="'+t.b+`"/>
      </EntryColor>
`},H_t={LogisticHeader:()=>`  <LogisticHeader>
    <Role id="Owner" roleFunction="ENGINEER"/>
    <Enterprise id="Enterprise" code="UNKNOWN"/>
    <Person name="Unknown" enterpriseRef="Enterprise" roleRef="Owner"/>
  </LogisticHeader>
`},W_t={HistoryRecord:(o,t,e,r,i,n)=>'  <HistoryRecord number="'+o+'" origination="'+t+'" software="'+e+'" lastChange="'+r+`">
    <FileRevision fileRevisionId="NONE" comment="NONE">
      <SoftwarePackage name="`+i+'" revision="A" vendor="JLC" model="'+n+`">
        <Certification certificationStatus="CERTIFIED" certificationCategory="OTHER"/>
      </SoftwarePackage>
    </FileRevision>
  </HistoryRecord>
`},D3e={BomHeader:o=>`    <BomHeader assembly="Assembly" revision="Revision">
      <StepRef name="`+o+`"/>
    </BomHeader>
`,BomItem:o=>{let t=[];o.forEach((s,a)=>{(typeof s=="string"||typeof s=="number")&&t.push(` ${a}="${s}"`)});let r=o.get("RefDes").map(s=>D3e.RefDes(s.RefDes)).join(""),i=o.get("Characteristics"),n=D3e.Characteristics(i);return"    <BomItem"+t.join("")+`>
`+n+r+`    </BomItem>
`},RefDes:o=>{let{name:t,packageRef:e,layerRef:r}=o;return'      <RefDes name="'+t+'" packageRef="'+e+'" layerRef="'+r+`"/>
`},Characteristics:o=>{let{category:t}=o;return'      <Characteristics category="'+t+`"/>
`}},Ize={CadHeader:(o,t)=>{let e=t.map(r=>Ize.Spec(r)).join("");return'    <CadHeader units="'+o.toUpperCase()+`">
`+e+`    </CadHeader>
`},Spec:o=>{let t=o.get("name"),r=o.get("General").Property;return r?'      <Spec name="'+t+`">
        <General type="MATERIAL">
          <Property text="`+r.text+`"/>
        </General>
      </Spec>
`:'      <Spec name="'+t+`">
        <General type="MATERIAL"/>
      </Spec>
`},Layer:o=>{let{name:t,layerFunction:e,side:r,polarity:i}=o;return'      <Layer name="'+t+'" layerFunction="'+e+'" side="'+r+'" polarity="'+i+`" />
`},StackupLayer:o=>{let t=o.get("layerOrGroupRef"),e=o.get("thickness"),r=o.get("tolPlus"),i=o.get("tolMinus"),n=o.get("sequence");return'          <StackupLayer layerOrGroupRef="'+t+'" thickness="'+e+'" tolPlus="'+r+'" tolMinus="'+i+'" sequence="'+n+`">
            <SpecRef id="`+t+`" />
          </StackupLayer>
`},Datum:({x:o,y:t})=>'        <Datum x="'+o+'" y="'+t+`"/>
`,StepRepeat:o=>{let{stepRef:t,x:e,y:r,nx:i,ny:n,dx:s,dy:a,angle:l,mirror:c}=o;return'        <StepRepeat stepRef="'+t+'" x="'+e+'" y="'+r+'" nx="'+i+'" ny="'+n+'" dx="'+s+'" dy="'+a+'" angle="'+l+'" mirror="'+c+`" />
`}},mh={Content:U_t,LogistHeader:H_t,HistoryRecord:W_t,Bom:D3e,Ecad:Ize,indent:G_t()};var rq=1,ale=-1,Cze=new TextEncoder,lle=new TextDecoder,js=class o{constructor(t,e){this.name=t,this.attributes=new Map,this.children=[],e&&e.appendChild(this)}delete(t,e){let r=this.search(t,e);r&&this.deleteNode(r)}deleteNode(t){let e=this.children.indexOf(t);e>-1&&this.children.splice(e,1)}getName(){return this.name}getChildren(){return this.children}appendChild(t){this.children.push(t)}clear(){this.children.length=0,this.attributes.clear(),this.xmlStr=null}setAttribute(t,e){if(typeof t=="string")this.attributes.set(t,e);else for(let r in t)this.attributes.set(r,t[r])}get xmlStr(){return this._xmlStr}set xmlStr(t){this._xmlStr=this.toBuffer(t),this.attributes.clear(),this.children=[],this.name=null}formatTextValue(t){return typeof t=="string"?function(r){return r.replace(/[\x00-\x1F\x7F]/g,(i,n)=>i.charCodeAt(0))}(t):t}search(t,e){return this.children.find(r=>{if(r.name===t)if(e){for(let i in e){let n=r.attributes.get(i);if(!n||n!==e[i])return!1}return!0}else return r.attributes.size===0})}filter(t){return this.children.filter(e=>e.name===t)}getAttribute(t){return this.attributes.get(t)}parseXmlStr(t=0){let e=[];this.toString(e,t);let r=e.map(i=>lle.decode(i));return this.xmlStr=r.join(""),this.xmlStr}toString(t,e=0){let r=[];for(r.push({node:this,state:rq});r.length>0;){let{node:i,state:n}=r.pop(),s=i.children,a=s&&s.length>0;if(Object.getPrototypeOf(i)!==o.prototype){i.toString(t,e);continue}if(n===rq){let l=i.toXml(e,n,!a);t.push(l),a&&(e++,r.push({node:i,state:ale}));for(let c=s.length-1;c>=0;c--)r.push({node:s[c],state:rq})}else{e--;let l=i.toXml(e,ale);t.push(l)}this.children.length=0,this.attributes.clear()}return t}toXml(t=0,e=rq,r=!1){if(this.xmlStr){let a=this.xmlStr;return this.clear(),a}let i=mh.indent[t],n=[];for(let[a,l]of this.attributes)n.push(` ${a}="${this.formatTextValue(l)}"`);let s;return e===rq?s=`${i}<${this.name}${n.join("")}${r?"/":""}>
`:e===ale&&(s=`${i}</${this.name}>
`),(e===ale||r)&&this.clear(),this.toBuffer(s)}toBuffer(t){return Cze.encode(t)}mergeSource(t){let e=t.map(r=>lle.decode(r));return Cze.encode(e.join(""))}};var cle=class extends js{constructor(e){super("Content",e);this.map=new Map;this.standard=new Map}init(e,r){this.unit=e,this.handel=r}addLayer(e,r={isSpan:!0}){this.map.set(e,r)}deleteLayer(e){this.map.delete(e)}getAllLayers(){let e=[];for(let[r,i]of this.map){let n=i.model;n&&e.push(n)}return e}addStandard(e,r){this.standard.set(e,r)}findStandard(e){return!!this.standard.has(e)}needPanelize(){let e=Pi.toJSON();return e!=null&&e.success?!e.onlyOutline:!1}toString(e){let r=[],i=[];r.push(`  <Content roleRef="Owner">
`);let n=mh.Content.FunctionMode();r.push(n);let s=mh.Content.StepRef(R.getInstance().name);if(r.push(s),this.needPanelize()){let l=mh.Content.StepRef("Panels");r.push(l)}let a=mh.Content.BomRef();r.push(a),i.push(`    <DictionaryColor>
`);for(let[l,c]of this.map){let h=mh.Content.LayerRef(l);if(!c.isSpan){let u=mh.Content.EntryColor(l,c);i.push(u)}r.push(h)}return i.push(`    </DictionaryColor>
`),r.push(i.join("")),e.push(this.toBuffer(r.join(""))),this.getStandard(e),e.push(this.toBuffer(`  </Content>
`)),this.clear(),e}clear(){super.clear(),this.map.clear(),this.standard.clear()}getStandard(e){let r=this.unit,i=3;r=="mm"&&(r="millimeter"),e.push(this.toBuffer('    <DictionaryStandard units="'+r.toUpperCase()+`">
`));for(let[n,s]of this.standard){let a=[];this.handel.encode.feed("EntryStandard",s).toString(a,i),e.push(this.mergeSource(a))}e.push(this.toBuffer(`    </DictionaryStandard>
`))}};var hle=class extends js{constructor(e){super("SupportNode",e);this.params=null}async init(){this.params=await this.historyRecordParams()}clear(){super.clear()}toString(e){let r=mh.LogistHeader.LogisticHeader(),i=this.getHistoryRecord(),n=r+i;return e.push(this.toBuffer(n)),this.clear(),e}async historyRecordParams(){let e=R.getInstance().id,r=(await A.windowBridge.rpcCall("getIPCOrigination",e,Q())).message,i=new Date().getTime(),n=1;r&&(i=r.origination,n=r.number+1),await A.windowBridge.rpcCall("setIPCOrigination",{key:e,value:{origination:i,number:n}},Q());let s=new Date().getTime(),a="yyyy-MM-ddThh:mm:ss",{version:l,packageName:c,packageVersion:h}=(await A.windowBridge.rpcCall("getIPCVersion",e,Q())).message;return{number:n,origination:i,currentTime:s,format:a,version:l,packageName:c,packageVersion:h}}getHistoryRecord(){let{number:e,origination:r,currentTime:i,format:n,version:s,packageName:a,packageVersion:l}=this.params;return mh.HistoryRecord.HistoryRecord(e,this.dateFormat(new Date(r),n),s,this.dateFormat(new Date(i),n),a,l)}dateFormat(e,r){if(e==null||e==null)return"";var i={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),S:e.getMilliseconds()};/(y+)/.test(r)&&(r=r.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));for(var n in i)new RegExp("("+n+")").test(r)&&(r=r.replace(RegExp.$1,RegExp.$1.length==1?i[n]:("00"+i[n]).substr((""+i[n]).length)));return r}};var ule=class extends js{constructor(t,e,r){super("Bom",r),this.oem=t,this.handel=e}generate(t){let e=Ar.getAllItem();this.getBomList(e).forEach(i=>{let n=this.handel.encode.feed2Attr("BomItem",{item:i,number:this.oem});t.push(this.toBuffer(this.bomTemplate(n)))})}getBomList(t){let e=new Map;return t.forEach(r=>{let i=r.model,n=i.attrsMap,s={device:i.device,oem:n[this.oem],value:n.value,supplier:n["Supplier Part"]},a=e.get(JSON.stringify(s));a||e.set(JSON.stringify(s),a=new Array),a.push(r)}),e}bomTemplate(t){return mh.Bom.BomItem(t)}toString(t){let e=`  <BOM name="BOM">
`,r=`  </BOM>
`,i=e+mh.Bom.BomHeader(R.getInstance().name);return t.push(this.toBuffer(i)),this.generate(t),t.push(this.toBuffer(r)),this.clear(),t}};var dle=class extends js{constructor(e){super("Ecad",e);this._cadHeader=null;this._cadData=null;this._padStack=null;this._layers=null}get cadHeader(){return this._cadHeader}set cadHeader(e){this._cadHeader=e}get layerNode(){return this._layers}set layerNode(e){this._layers=e}get padStack(){return this._padStack}set padStack(e){this._padStack=e}get cadData(){return this._cadData}set cadData(e){this._cadData=e}toString(e,r){let i=`  <Ecad name="output PCB cad-data">
`,n=`  </Ecad>
`;return e.push(this.toBuffer(i)),this.children.map(s=>s.toString(e,r+1)),e.push(this.toBuffer(n)),e}};var ple=class{getContent(){return this.Content}getBom(){return this.Bom}getEcad(){return this.Ecad}constructor(){let t=new js("IPC-2581");t.setAttribute("revision","C"),t.setAttribute("xmlns","http://webstds.ipc.org/2581"),t.setAttribute("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance"),t.setAttribute("xmlns:xsd","http://www.w3.org/2001/XMLSchema"),this.root=t}createContent(){this.Content=new cle(this.root)}async createSupportInfo(){await new hle(this.root).init()}createBom(t,e){this.Bom=new ule(t,e,this.root)}initEcad(){this.Ecad=new dle(this.root)}export(){let t=[];return t.push(new TextEncoder().encode(`<?xml version="1.0" encoding="UTF-8"?>
`)),this.root.toString(t),t}clear(){this.root=null,this.Content=null,this.Bom=null,this.Ecad=null}};var fle=class{getConfig(){return{VIA:this.getVIA(),PAD:this.getPAD(),HOLE:this.getHOLE(),SLOT:this.getSLOT(),PROFILE:this.getPROFILE(),PACKAGE:this.getPACKAGE(),COMPONENT:this.getCOMPONENT(),TRACK:this.getTRACK(),TEXT:this.getTEXT(),FONT:this.getTEXT(),LINE:this.getTRACK(),TEARDROP:this.getTEARDROP(),REGION:this.getREGION(),IMAGE:this.getIMAGE(),COPPER:this.getCOPPER(),SIZE:this.getSIZE(),BomItem:this.getBomItem(),LayerRef:this.getLayerRef(),EntryStandard:this.getEntryStandard(),Spec:this.getLayerSpec(),Layer:this.getLayer(),Stackup:this.getStackup(),StackupGroup:this.getStackupGroup(),StackupLayer:this.getStackupLayer(),LayerFeature:this.getLayerFeature(),LayerColor:this.getLayerColor(),LogicalNet:this.getLogicalNet(),PadStackDef:this.getPadStackDef()}}getVIA(){return[]}getLayerFeature(){return["layerRef","Set"]}getLayerColor(){return["id","Color"]}getPAD(){return["padstackDefRef","Xform","Location","StandardPrimitiveRef","PinRef"]}getHOLE(){return["name","diameter","platingStatus","plusTol","minusTol","x","y"]}getSLOT(){return["name","minusTol","Outline","platingStatus","plusTol"]}getPROFILE(){return["Polygon","Cutout"]}getPACKAGE(){return["name","height","Outline","Pin","pinOneOrientation","type"]}getCOMPONENT(){return["Location","packageRef","part","refDes","Xform","layerRef"]}getTRACK(){return["Polyline"]}getTEXT(){return["UserSpecial","Contour","Xform"]}getTEARDROP(){return["Contour"]}getREGION(){return["Contour"]}getCOPPER(){return["Contour"]}getIMAGE(){return["Contour"]}getSIZE(){return["UserSpecial"]}getBomItem(){return["category","Characteristics","description","internalPartNumber","OEMDesignNumberRef","pinCount","quantity","RefDes"]}getLayerRef(){return["name"]}getEntryStandard(){return["id","Circle","Contour","RectCenter","RectRound"]}getLayerSpec(){return["name","General"]}getLayer(){return["name","layerFunction","side","polarity"]}getStackup(){return["name","overallThickness","tolPlus","tolMinus","whereMeasured"]}getStackupGroup(){return["name","thickness","tolMinus","tolPlus"]}getStackupLayer(){return["layerOrGroupRef","thickness","tolPlus","tolMinus","sequence","SpecRef"]}getPadStackDef(){return["name","PadstackHoleDef","PadstackPadDef"]}getLogicalNet(){return["name","netClass","PinRef"]}};var Ko=class{constructor(t){this.unit=t}convertUnit(t){return Math.round(na(t*10,"mil",this.unit)*1e8)/1e8}toFix(t,e=8){let r=Number(t.toFixed(e))%360;return r<0&&(r+=360),r}startPoint(t){return{PolyBegin:{x:this.convertUnit(t.x),y:this.convertUnit(t.y)}}}lineto(t){return{PolyStepSegment:{x:this.convertUnit(t.x),y:this.convertUnit(t.y)}}}arcto(t,e,r=!0){return{PolyStepCurve:{x:this.convertUnit(t.x),y:this.convertUnit(t.y),centerX:this.convertUnit(e.x),centerY:this.convertUnit(e.y),clockwise:r}}}lineDesc(t,e="ROUND",r="SOLID"){return{lineEnd:e,lineWidth:t,lineProperty:r}}formatTextValue(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}};var gle=class extends Ko{constructor(t){super(t)}getData(t,e){var r;switch(t){case"name":if(e instanceof et){let s=e.hole;return Y6(e.globalIndex,(r=e.getParent())==null?void 0:r.designator,e.num)}return"Hole_Via_"+e.globalIndex;case"diameter":if(e instanceof et){let s=e.hole.holeLength;return this.convertUnit(s)}let i=e.holeRadius||e.radius;return this.convertUnit(i*2);case"platingStatus":let n="PLATED";return e instanceof et?n=e.plated?"PLATED":"NONPLATED":e instanceof Ct&&e.type===1&&(n="VIA"),n;case"minusTol":return 0;case"plusTol":return 0;case"x":return this.convertUnit(e.center.x);case"y":return this.convertUnit(e.center.y)}}},yle=class extends Ko{constructor(t){super(t)}getData(t,e){var r;switch(t){case"name":if(e instanceof et){let T=e.hole;return Y6(e.globalIndex,(r=e.getParent())==null?void 0:r.designator,e.num)}return"Hole_Via_"+e.globalIndex;case"platingStatus":return"VIA";case"minusTol":return 0;case"plusTol":return 0;case"Outline":let i=e.hole,n=e.rotation,s=e.center,{holeOffset:a,holeRotation:l,holeLength:c,holeRadius:h,holeShape:u}=i;u==="ROUND"&&(c=h*2);let d=c/2-h,p=s.add(new S(1,0).mul(-1*d).rotate(S.ORIGIN,l+n)),m=s.add(new S(1,0).mul(d).rotate(S.ORIGIN,l+n)),g=[p.add(new S(0,h).rotate(S.ORIGIN,l+n)),p.add(new S(0,-1*h).rotate(S.ORIGIN,l+n))],y=[m.add(new S(0,h).rotate(S.ORIGIN,l+n)),m.add(new S(0,-1*h).rotate(S.ORIGIN,l+n))],b=a.rotate(S.ORIGIN,n),P=[];return P.push(this.startPoint(g[0].add(b))),P.push(this.lineto(y[0].add(b))),P.push(this.arcto(y[1].add(b),m.add(b))),P.push(this.lineto(g[1].add(b))),P.push(this.arcto(g[0].add(b),p.add(b))),{Polygon:{polylines:P}}}}};var L3e=[{name:"Top Layer",name_zn:"\u9876\u5C42",layerFunction:"SIGNAL",side:"TOP",polarity:"POSITIVE"},{name:"Bottom Layer",name_zn:"\u5E95\u5C42",layerFunction:"SIGNAL",side:"BOTTOM",polarity:"POSITIVE"},{name:"Top Silkscreen Layer",name_zn:"\u9876\u5C42\u4E1D\u5370\u5C42",layerFunction:"SILKSCREEN",side:"TOP",polarity:"POSITIVE"},{name:"Bottom Silkscreen Layer",name_zn:"\u5E95\u5C42\u4E1D\u5370\u5C42",layerFunction:"SILKSCREEN",side:"BOTTOM",polarity:"POSITIVE"},{name:"Top Solder Mask Layer",name_zn:"\u9876\u5C42\u963B\u710A\u5C42",layerFunction:"SOLDERMASK",side:"TOP",polarity:"POSITIVE"},{name:"Bottom Solder Mask Layer",name_zn:"\u5E95\u5C42\u963B\u710A\u5C42\u200B",layerFunction:"SOLDERMASK",side:"BOTTOM",polarity:"POSITIVE"},{name:"Top Paste Mask Layer",name_zn:"\u9876\u5C42\u9521\u818F\u5C42",layerFunction:"PASTEMASK",side:"TOP",polarity:"POSITIVE"},{name:"Bottom Paste Mask Layer",name_zn:"\u5E95\u5C42\u9521\u818F\u5C42",layerFunction:"PASTEMASK",side:"BOTTOM",polarity:"POSITIVE"},{name:"Top Assembly Layer",name_zn:"\u9876\u5C42\u88C5\u914D\u5C42",layerFunction:"DOCUMENT",side:"TOP",polarity:"POSITIVE"},{name:"Bottom Assembly Layer",name_zn:"\u5E95\u5C42\u88C5\u914D\u5C42",layerFunction:"DOCUMENT",side:"BOTTOM",polarity:"POSITIVE"},{name:"Board Outline Layer",name_zn:"\u677F\u6846\u5C42",layerFunction:"DOCUMENT",side:"INTERNAL",polarity:"POSITIVE"},{name:"Document Layer",name_zn:"\u6587\u6863\u5C42",layerFunction:"DOCUMENT",side:"NONE",polarity:"POSITIVE"},{name:"Mechanical Layer",name_zn:"\u673A\u68B0\u5C42",layerFunction:"DOCUMENT",side:"INTERNAL",polarity:"POSITIVE"},{name:"Component Shape Layer",name_zn:"\u5143\u4EF6\u5916\u5F62\u5C42",layerFunction:"DOCUMENT",side:"NONE",polarity:"POSITIVE"},{name:"Drill Drawing Layer",name_zn:"\u94BB\u5B54\u56FE\u5C42",layerFunction:"DOCUMENT",side:"INTERNAL",polarity:"POSITIVE"}];function ovt(o){return{name:o,name_zn:"\u5185\u5C42",layerFunction:"SIGNAL",side:"INTERNAL",polarity:"POSITIVE"}}function svt(o){return{name:o,name_zn:"\u4ECB\u8D28",layerFunction:"DIELCORE",side:"NONE",polarity:"POSITIVE"}}function avt(o){return{name:o,name_zn:"\u81EA\u5B9A\u4E49",layerFunction:"DOCUMENT",side:"NONE",polarity:"POSITIVE"}}function lvt(o){return{name:o,name_zn:"\u591A\u5C42",layerFunction:"DRILL",side:"ALL",polarity:"POSITIVE"}}function xze(o,t){let e=L3e.find(r=>r.name===o);if(!e)switch(t){case"SIGNAL":case"PLANE":return ovt(o);case"SUBSTRATE":return svt(o);case"MULTI":return lvt(o);default:return avt(o)}return e}var ble=class extends Ko{constructor(t){super(t),this.layerMap=L3e}getData(t,e){let r=xze(e.name,e.type);switch(t){case"name":return r.name;case"layerFunction":return r.layerFunction;case"side":return r.side;case"polarity":return r.polarity}}};var Ple=class extends Ko{constructor(t){super(t)}getData(t,e){switch(t){case"layerId":return e.layerName}}};var Tle=class extends Ko{constructor(t){super(t)}getData(t,e){switch(t){case"name":return e.layerName}}};var Ile=class extends Ko{constructor(t){super(t)}getData(t,e){var s;let r=pT.getInstance(),{pad:i,layer:n}=e;switch(t){case"padstackDefRef":return i instanceof Ct?"Via_"+i.globalIndex:tD(i.globalIndex,(s=i.getParent())==null?void 0:s.designator,i.num);case"Location":let a=i.center;return{x:this.convertUnit(a.x),y:this.convertUnit(a.y)};case"StandardPrimitiveRef":{let h=i,u=0;i instanceof et?(n===5?u=i.topSolderExpansion:n===6?u=i.bottomSolderExpansion:(n===7||n===8)&&(u=i.pasteExpansion),h=YA(i,n)):n===5?u=i.topExpansion:n===6&&(u=i.bottomExpansion);let d=E1(h,u);return{id:d}}case"PinRef":let l=i.getParent();return l&&i instanceof et?{pin:i.num,componentRef:r.get(l)}:null;case"Xform":let c=null;return i instanceof et&&YA(i,n).type!=="POLYGON"&&(c={rotation:this.toFix(i.rotation*180/Math.PI)}),c}}};var Cle=class extends Ko{constructor(t){super(t)}getData(t,e){let r=["TOP","BOTTOM","SIGNAL"],i=["TOP_SOLDER_MASK","BOT_SOLDER_MASK"],n="SUBSTRATE";switch(t){case"name":return e.name;case"General":let s="";e.type===n?s="FR-4":i.indexOf(e.type)>=0?s="Solder Resist":r.indexOf(e.type)>=0&&(s="copper");let a={type:"MATERIAL"};return s&&(a.Property={text:s}),a;case"material":return e.type===n?"FR-4":i.indexOf(e.type)>=0?"Solder Resist":r.indexOf(e.type)>=0?"copper":null;case"other":case"electrical":case"thermal":case"instruction":case"standard":case"configuration":return null}}};var Sle=class extends Ko{constructor(e){super(e);this.stackupName="Stackup"}getData(e,r){let i=Ze.getInstance().getLayerPhys(),n=0;switch(i.forEach(s=>n+=s.thickness),e){case"name":return this.stackupName;case"tolPlus":return 0;case"tolMinus":return 0;case"overallThickness":return this.convertUnit(n);case"whereMeasured":return"OTHER"}}};var Ele=class extends Ko{constructor(t){super(t)}getData(t,e){let r=Ze.getInstance().getLayerPhys(),i=0;switch(r.forEach(n=>i+=n.thickness),t){case"name":return e;case"thickness":return this.convertUnit(i);case"tolPlus":return 0;case"tolMinus":return 0}}};var Ole=class extends Ko{constructor(t){super(t)}getData(t,e){switch(t){case"layerOrGroupRef":return e.name;case"sequence":return 1;case"thickness":let i=Ze.getInstance().getLayerPhys(),n=0,s=i.find(a=>a.layerId===e.layerId);return s&&(n=s.thickness||0),this.convertUnit(n);case"tolMinus":return 0;case"tolPlus":return 0;case"SpecRef":return{id:e.name}}}};var Ale=class extends Ko{constructor(t){super(t)}getData(t,e){}};var _le=class extends Ko{constructor(e){super(e);this.viaPrefix="Via_"}getData(e,r){var s,a;let{item:i,layers:n}=r;switch(e){case"name":return i instanceof et?tD(i.globalIndex,(s=i.getParent())==null?void 0:s.designator,i.num):this.viaPrefix+i.globalIndex;case"PadstackHoleDef":if(i.layerId!==12)return null;if(i instanceof et){let c=i.hole;return{name:Y6(i.globalIndex,(a=i.getParent())==null?void 0:a.designator,i.num),diameter:this.convertUnit(c.holeRadius*2),platingStatus:"PLATED",plusTol:0,minusTol:0,x:this.convertUnit(i.center.x),y:this.convertUnit(i.center.y)}}else return{name:`Hole_Via_${i.globalIndex}`,diameter:this.convertUnit(i.holeRadius*2),platingStatus:"VIA",plusTol:0,minusTol:0,x:this.convertUnit(i.center.x),y:this.convertUnit(i.center.y)};case"PadstackPadDef":let l=Ze.getInstance();if(i instanceof et){let c=[];for(let h of n){let u=0,d=h.layerId;d==5?u=i.topSolderExpansion:d==6?u=i.bottomSolderExpansion:(d==8||d==7)&&(u=i.pasteExpansion);let p=YA(i,d),m=[{Location:{x:0,y:0},StandardPrimitiveRef:{id:E1(p,u)}}],g={layerRef:h.name,padUse:"REGULAR",shapes:m};c.push({PadstackPadDef:g})}return c}else{let c=[];if(i.type===1){let u=l.getLayer(i.startLayer),d=l.getLayer(i.endLayer),p=u.name+" to "+d.name;c.push({PadstackPadDef:{layerRef:p,padUse:"REGULAR",Location:{x:0,y:0},StandardPrimitiveRef:{id:E1(i)}}})}for(let u of n){let d=0;u.layerId==5?d=i.topExpansion:u.layerId==6&&(d=i.bottomExpansion);let p={layerRef:u.name,padUse:"REGULAR",shapes:[{Location:{x:0,y:0},StandardPrimitiveRef:{id:E1(i,d)}}]};c.push({PadstackPadDef:p})}return c}}}};var vle=class extends Ko{constructor(t){super(t)}getData(t,e){let r=e.profiles,i=e.cutouts;switch(t){case"Polygon":return r?this.getPolygon(r):null;case"Cutout":return this.getCutout(i)}}getPolygon(t){return this.parseShape(t)}getCutout(t){let e=[];return t.forEach(r=>e.push({Cutout:this.parseShape(r)})),e}parseShape(t){let e=[],r={polygons:e},i=t.primitives;i[0]&&e.push(this.startPoint(i[0].start()));for(let n=0;n<i.length;n++){let s=i[n];s instanceof M?e.push(this.lineto(s.end())):s instanceof q&&e.push(this.arcto(s.end(),s.center,!s.isCCW))}return r}};var xle=class extends Ko{constructor(t){super(t)}getData(t,e){switch(t){case"name":return e.id+"_"+e.uuid;case"type":return e.id.split("_")[0];case"pinOneOrientation":return"LOWER_LEFT";case"height":return 0;case"Outline":return this.getOutline(e);case"Pin":return this.getPins(e)}}getOutline(t){let e=t.getBBox();if(!e){let l=[];t.iterator(h=>(l.push(h),!0));let c=new _e;l.forEach(h=>{h.isEmpty||c.ext1(h.buildBBox())}),e=c.build1()}let r=e.LL(),i=e.UL(),n=e.UR(),s=e.LR(),a=[this.startPoint(r),this.lineto(i),this.lineto(n),this.lineto(s),this.lineto(r)];return{outline:[{Polygon:{polygons:a}},{LineDesc:{lineEnd:"ROUND",lineWidth:"0",lineProperty:"SOLID"}}]}}getPins(t){let e=[],r=t.getOrigin(),i=new S(-r.x,-r.y);t.iterator(s=>(s instanceof et&&e.push(s),!0));let n=[];return e.forEach((s,a)=>n.push(this.getPin(s,i))),n}getPin(t,e){let r="THRU",i="THROUGH_HOLE_PIN",n=t.center.add(e),s="ELECTRICAL",a=t.layerId,l=null;a===2?l=t.bottom:l=t.top;let c=E1(l);t.layerId!==12&&(r="SURFACE",i="SURFACE_MOUNT_PIN");let h={Pin:{number:t.num,name:t.num,type:r,electricalType:s,mountType:i,Location:{x:this.convertUnit(n.x),y:this.convertUnit(n.y)},StandardPrimitiveRef:{id:c}}};return t.rotation&&l.type!=="POLYGON"&&(h.Pin.Xform={rotation:this.toFix(t.rotation*180/Math.PI)}),h}};var Rle=class extends Ko{constructor(t){super(t)}getData(t,e){let r=pT.getInstance();switch(t){case"refDes":return r.get(e);case"packageRef":return e.footprintId+"_"+e.footprintUUID;case"part":return e.footprintId+"_"+e.footprintUUID;case"mountType":return"OTHER";case"layerRef":return Ze.getInstance().getLayer(e.layerId).name;case"weight":return e.bbox.width();case"height":return e.bbox.height();case"standoff":return 0;case"Location":return{x:this.convertUnit(e.position.x),y:this.convertUnit(e.position.y)};case"Xform":let i={},n=e.layerId;return e.rotation&&(i.rotation=this.toFix(e.rotation*180/Math.PI)),n===2&&(i.rotation=this.toFix(i.rotation?-(i.rotation+180):-180),i.mirror=!0),i.rotation||i.mirror?i:null}}};var Dle=class extends Ko{constructor(t){super(t)}getData(t,e){switch(t){case"layerRef":return e.name;case"Set":return{ColorRef:{id:"LAYER_COLOR_"+e.name}}}}};var wle=class extends Ko{constructor(t){super(t)}getData(t,e){switch(t){case"Polyline":return{lines:this.getLine(e)}}}getLine(t){let e=[],{connect:r,track:i}=t,n=r[0].start();return e.push(this.startPoint(n)),r.forEach(s=>{s instanceof M?e.push(this.lineto(s.end())):s instanceof q&&e.push(this.arcto(s.end(),s.center,!s.isCCW))}),e.push({LineDesc:this.lineDesc(this.convertUnit(i.width))}),e}};var Lle=class extends Ko{constructor(t){super(t)}getData(t,e){switch(t){case"UserSpecial":{let n=e.strokeWidth,s=[],a=e.outline;return e instanceof Li&&(a=e.getRealOutline()),a.forEach(l=>{l.primitives.forEach(h=>{s.push(this.getLine(h,n))})}),{lines:s}}case"Xform":let r=e.rotation,i=null;return r&&(i={rotation:this.toFix(r*180/Math.PI)}),i}return null}getLine(t,e){if(t instanceof M){let r=t.start(),i=t.end();return{Line:{startX:this.convertUnit(r.x),startY:this.convertUnit(r.y),endX:this.convertUnit(i.x),endY:this.convertUnit(i.y),LineDesc:this.lineDesc(this.convertUnit(e))}}}else if(t instanceof q){let r=t.start(),i=t.end(),n=t.center,s=t.isCCW;return{Arc:{startX:this.convertUnit(r.x),startY:this.convertUnit(r.y),endX:this.convertUnit(i.x),endY:this.convertUnit(i.y),centerX:this.convertUnit(n.x),centerY:this.convertUnit(n.y),clockwise:!s,LineDesc:this.lineDesc(this.convertUnit(e))}}}}},Mle=class extends Ko{constructor(t){super(t)}getData(t,e){switch(t){case"Contour":{let n=e.group;return this.getOutLine(n)}case"Xform":let r=e.text.rotation,i=null;return r&&(i={rotation:this.toFix(r*180/Math.PI)}),i}return null}getOutLine(t){let e=[];return t.forEach(r=>{let i=r.pl.primitives,n=r.flag,s=[],a=i[0].start();s.push(this.startPoint(a)),i.forEach(l=>{l instanceof M?s.push(this.lineto(l.end())):l instanceof q&&s.push(this.arcto(l.end(),l.center,!l.isCCW))}),n?e.push({Polygon:{polygon:s}}):e.push({Cutout:{polygon:s}})}),{Counter:e}}};var Nle=class extends Ko{constructor(t){super(t)}getData(t,e){let{item:r,expansion:i,model:n}=e,s=r.type,a=E1(r,i);if(i<0&&(i=0),t=="id")return a;if(r instanceof nI)switch(t){case"Circle":return s!=="ELLIPSE"?null:{diameter:this.convertUnit(Math.max(r.width+2*i,0))};case"RectCenter":return s==="RECT"&&r.ratio==0&&i<=0?{width:this.convertUnit(Math.max(r.width+2*i,0)),height:this.convertUnit(Math.max(r.height+2*i,0))}:null;case"RectRound":let l=this.convertUnit(Math.max(r.width+2*i,0)),c=this.convertUnit(Math.max(r.height+2*i,0)),h={upperRight:"true",upperLeft:"true",lowerLeft:"true",lowerRight:"true"};return s==="OVAL"?{width:l,height:c,radius:Math.min(l,c)/2,...h}:s==="RECT"&&r.ratio!==0?{width:l,height:c,radius:Math.min(l,c)*r.ratio/2,...h}:s==="RECT"&&r.ratio==0&&i>0?{width:l,height:c,radius:this.convertUnit(i),...h}:null;case"Contour":if(s!=="POLYGON")return null;let u=n.center,d=cg(n,r,i),p=(d==null?void 0:d.primitives)||r.pl.primitives,m=[],g=p[0].start();m.push(this.startPoint(g.add(u.mul(-1))));for(let y=0;y<p.length;y++){let b=p[y];b instanceof M?m.push(this.lineto(b.end().add(u.mul(-1)))):b instanceof q&&m.push(this.arcto(b.end().add(u.mul(-1)),b.center.add(u.mul(-1)),!b.isCCW))}return{Polygon:{polygons:m}}}else return t==="Circle"?{diameter:this.convertUnit(Math.max((r.radius+i)*2,0))}:null}};var kle=class extends Ko{constructor(t){super(t)}getData(t,e){let r=e.item,i=pT.getInstance(),n=r[0],s=e.number;switch(t){case"OEMDesignNumberRef":let a=this.getAttrs(r,s);return a.length?this.formatTextValue(a.join(",")):":";case"category":return"ELECTRICAL";case"description":let l=this.getAttrs(r,"value");return l.length?this.formatTextValue(l.join(",")):":";case"internalPartNumber":let c=this.getAttrs(r,"Supplier Part");return c.length?this.formatTextValue(c.join(",")):":";case"pinCount":return n.getPads().length;case"quantity":return r.length;case"Characteristics":return{category:"ELECTRICAL"};case"RefDes":return r.map(u=>({RefDes:{name:i.get(u.model),packageRef:u.footprintId+"_"+u.footprintUUID,layerRef:Ze.getInstance().getLayer(u.layerId).name}}))}}getAttrs(t,e){let r=new Set;return t.forEach(i=>{let s=i.model.attrsMap[e];s&&r.add(s)}),Array.from(r)}};var Ble=class extends Ko{constructor(t){super(t)}getData(t,e){switch(t){case"Polyline":return{lines:this.getPolyline(e)}}}getPolyline(t){let e=[],r=t.getMathGraphics().primitives,i=r[0].start();return e.push(this.startPoint(i)),r.forEach(n=>{if(n instanceof M)e.push(this.lineto(n.end()));else if(n instanceof q){let{center:s,rx:a,ry:l,isCCW:c}=n;if(t instanceof yo){let h=s.add(new S(-1,0).mul(a)),u=s.add(new S(1,0).mul(a));e.push(this.arcto(h,s)),e.push(this.arcto(u,s))}else e.push(this.arcto(n.end(),s,!c))}}),e.push({LineDesc:this.lineDesc(this.convertUnit(t.strokeWidth))}),e}};var Fle=class extends Ko{constructor(t){super(t)}getData(t,e){switch(t){case"Contour":return this.region(e);default:return null}}region(t){if(t instanceof ge)return{Polygon:{lines:this.getLines(t)}};if(t instanceof Bt){let e=t.items,r,i=[];return e.forEach((n,s)=>{s==0?r={lines:this.getLines(n)}:i.push({Cutout:{polygons:this.getLines(n)}})}),{Polygon:r,Cutouts:i}}}getLines(t){let e=t.primitives,r=[],i=e[0].start();return r.push(this.startPoint(i)),e.forEach(n=>{n instanceof M?r.push(this.lineto(n.end())):n instanceof q&&r.push(this.arcto(n.end(),n.center,!n.isCCW))}),r}};var Vle=class extends Ko{constructor(t){super(t)}getData(t,e){switch(t){case"Contour":return this.getOutLine(e);case"Xform":return null}return null}getOutLine(t){let e=[];return t.forEach(r=>{let i=r.pl.primitives,n=r.flag,s=i.length,a=[],l=i[0].start();a.push(this.startPoint(l)),i.forEach((c,h)=>{c instanceof M?a.push(this.lineto(c.end())):c instanceof q?a.push(this.arcto(c.end(),c.center,!c.isCCW)):c instanceof Dr&&c.points(.1).forEach(d=>{a.push(this.lineto(d))}),s===h+1&&(c.end().equals1(l)||a.push(this.lineto(l)))}),n?e.push({Polygon:{polygon:a}}):e.push({Cutout:{polygon:a}})}),{Counter:e}}};var Gle=class extends Ko{constructor(t){super(t)}getData(t,e){switch(t){case"Contour":return this.getCopperRegion(e)}}getCopperRegion(t){let e=[];return t.forEach((r,i)=>{let n=r.primitives,s=[],a=n[0].start();s.push(this.startPoint(a)),n.forEach(l=>{l instanceof M?s.push(this.lineto(l.end())):l instanceof q&&s.push(this.arcto(l.end(),l.center,!l.isCCW))}),i==0?e.push({Polygon:{polygon:s}}):e.push({Cutout:{polygon:s}})}),{Counter:e}}};var Ule=class extends Ko{constructor(t){super(t)}getData(t,e){switch(t){case"UserSpecial":return this.getPolygon(e)}return null}getPolygon(t){let e=[],r=t.getBaseGraphics();for(let i of r)for(let n of i)if(n instanceof M){let s=n.start(),a=n.end(),l={Line:{startX:this.convertUnit(s.x),startY:this.convertUnit(s.y),endX:this.convertUnit(a.x),endY:this.convertUnit(a.y),LineDesc:this.lineDesc(this.convertUnit(t.strokeWidth))}};e.push(l)}else if(n instanceof q){let s=n.start(),a=n.end(),l=n.center,c=n.isCCW,h={Arc:{startX:this.convertUnit(s.x),startY:this.convertUnit(s.y),endX:this.convertUnit(a.x),endY:this.convertUnit(a.y),centerX:this.convertUnit(l.x),centerY:this.convertUnit(l.y),clockwise:!c,LineDesc:this.lineDesc(this.convertUnit(t.strokeWidth))}};e.push(h)}return{polygons:e}}};var Hle=class extends Ko{constructor(t){super(t)}getData(t,e){switch(t){case"id":return e.layerName;case"Color":let{r,g:i,b:n}=e.color;return{r,g:i,b:n}}}};var Wle=class extends Ko{constructor(t){super(t)}getData(t,e){let r=e[0],i=e[1];switch(t){case"name":return r||"NoNet";case"netClass":return this.netRule(r);case"PinRef":return this.pinRefs(i)}}netRule(t){let e="UNUSED";if(!t)return e;let i=MVe(!0).find(n=>n.value===t);return i?i.text:e}pinRefs(t){let e=[];for(let[r,i]of t)i.forEach(n=>{e.push({PinRef:{pin:n,componentRef:r}})});return e}};var zle=class{constructor(t){this.format=new fle().getConfig(),this.pad=new Ile(t),this.via=new Ale(t),this.layerPhys=new Ple(t),this.hole=new gle(t),this.slot=new yle(t),this.profile=new vle(t),this.package=new xle(t),this.component=new Rle(t),this.track=new wle(t),this.line=new Ble(t),this.text=new Lle(t),this.font=new Mle(t),this.region=new Fle(t),this.bom=new kle(t),this.image=new Vle(t),this.copper=new Gle(t),this.size=new Ule(t),this.layer=new ble(t),this.entryStandard=new Nle(t),this.layerRef=new Tle(t),this.spec=new Cle(t),this.stackup=new Sle(t),this.stackupGroup=new Ele(t),this.stackupLayer=new Ole(t),this.padStack=new _le(t),this.layerFeature=new Dle(t),this.layerColor=new Hle(t),this.logicalNet=new Wle(t)}feedItems(t,e,r){let i=[];return e.forEach(n=>{n instanceof Ls&&(n=n.model),n.getParent()==null&&(!t&&(t=this.getFileType(n)),i.push(this.feed(t,n,r)))}),i}feedItems2Attr(t,e){let r=[];return e.forEach(i=>{i instanceof Ls&&(i=i.model),i.getParent()==null&&(!t&&(t=this.getFileType(i)),r.push(this.feed2Attr(t,i)))}),r}feedLayerItems(t,e,r){let i=[];return e.forEach(n=>{i.push(this.feed(t,n,r))}),i}feedLayerItems2Attr(t,e){let r=[];return e.forEach(i=>{r.push(this.feed2Attr(t,i))}),r}getFileType(t){if(t instanceof et)return"PAD";if(t instanceof Ct)return"VIA";if(t instanceof UO)return"Layer"}getItemFormat(t){return this.format[t]}getData(t,e,r){return e.getData(t,r)}getEncode(t){switch(t){case"VIA":return this.hole;case"PAD":return this.pad;case"HOLE":return this.hole;case"SLOT":return this.slot;case"PROFILE":return this.profile;case"PACKAGE":return this.package;case"COMPONENT":return this.component;case"TRACK":return this.track;case"FONT":return this.font;case"TEXT":return this.text;case"LINE":return this.line;case"REGION":return this.region;case"IMAGE":return this.image;case"COPPER":return this.copper;case"SIZE":return this.size;case"BomItem":return this.bom;case"EntryStandard":return this.entryStandard;case"LayerColor":return this.layerColor;case"LayerRef":return this.layerRef;case"Spec":return this.spec;case"Layer":return this.layer;case"Stackup":return this.stackup;case"StackupGroup":return this.stackupGroup;case"StackupLayer":return this.stackupLayer;case"PadStackDef":return this.padStack;case"LayerFeature":return this.layerFeature;case"LogicalNet":return this.logicalNet}}getTag(t){switch(t){case"PAD":return"Pad";case"VIA":return"Hole";case"Stackup":return"Stackup";case"StackupGroup":return"StackupGroup";case"Layer":return"Layer";case"LayerColor":return"EntryColor";case"HOLE":return"Hole";case"SLOT":return"SlotCavity";case"PadStackDef":return"PadStackDef";case"PROFILE":return"Profile";case"PACKAGE":return"Package";case"COMPONENT":return"Component";case"LogicalNet":return"LogicalNet";case"LayerFeature":return"LayerFeature";case"EntryStandard":return"EntryStandard";case"BomItem":return"BomItem";case"StackupLayer":return"StackupLayer";case"Spec":return"Spec";case"FONT":case"TEXT":case"TRACK":case"LINE":case"REGION":case"COPPER":case"IMAGE":case"SIZE":return"Features"}}feed(t,e,r){let i=this.getItemFormat(t),n=this.getEncode(t),s=new Map;for(let l of i){let c=this.getData(l,n,e);c!==null&&s.set(l,c)}let a=new js(this.getTag(t),r);return this.addAttribute(a,s),a}feed2Attr(t,e){let r=this.getItemFormat(t),i=this.getEncode(t),n=new Map;for(let s of r){let a=this.getData(s,i,e);a!==null&&n.set(s,a)}return n}addAttribute(t,e){if(e instanceof Map)for(let[r,i]of e)if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")t.setAttribute(r,i.toString());else if(i instanceof Array)i.forEach(n=>{for(let s in n){let a=new js(s,t);this.addAttribute(a,n[s])}});else{let n=new js(r,t);this.addAttribute(n,i)}else for(let r in e){let i=e[r];if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")t.setAttribute(r,i.toString());else if(i instanceof Array)i.forEach(n=>{for(let s in n){let a=new js(s,t);this.addAttribute(a,n[s])}});else{let n=new js(r,t);this.addAttribute(n,i)}}}};function E1(o,t=0){if(t<0&&(t=0),o instanceof nI){let e=o.type;if(e=="RECT"&&o.ratio===0&&t<=0){let r=vV(Math.max(o.width+2*t,0)),i=vV(Math.max(o.height+2*t,0));return"RECTANGLE_"+r+"X"+i}else{if(e==="ELLIPSE")return"CIRCLE_"+vV(Math.max(o.width+2*t,0));if(e==="POLYGON"){let r=o.pl.primitives,i=r[0].start();return"POLYGON_"+i.x+"X"+i.y+"_"+r.length+"_"+t}else if(e==="OVAL"||e==="RECT"&&o.ratio!==0||e==="RECT"&&t>0){let r=vV(Math.max(o.width+2*t,0)),i=vV(Math.max(o.height+2*t,0)),n=0;return e==="OVAL"?n=Math.min(r,i)/2:o.ratio?n=Math.min(r,i)*o.ratio/2:t>0&&(n=t),"RECTROUND_"+r+"X"+i+"X"+n}}}else if(o instanceof Ct)return"CIRCLE_"+vV(Math.max((o.radius+t)*2,0));return""}function vV(o){return Math.round(o*1e9)/1e8}function tD(o,t="NONE",e="NONE"){return t+"_"+e+"_"+o}function Y6(o,t="NONE",e="NONE"){return`Hole_${t}_${e}_${o}`}function YA(o,t){return t===1||t==5||t===7?o.top:t===2||t==6||t===8?o.bottom:o.inner||o.padStyle}var Yle=class extends js{constructor(e,r,i){super("CadHeader",i);this.layers=new Array;this.layers=e,this.unit=r}add(e,r="MATERIAL",i){let n={type:r};i&&(n.Property={text:i});let s=new Map;s.set("name",e),s.set("General",n),this.layers.push(s)}delete(e){let r=this.layers.findIndex(i=>i.get("name")===e);r>=0&&this.layers.splice(r,1)}clear(){super.clear(),this.layers.length=0}toString(e){let r=mh.Ecad.CadHeader(this.unit,this.layers);return e.push(this.toBuffer(r)),this.clear(),e}};var jle=class extends js{constructor(e,r){super("Footprint",r);this.components=[];this.packages=[];this.handel=e,this.logicalNet=new Map}init(){let r=Ji.getInstance().getAllItem();for(;r.length>0;)this.parse(r.splice(0,10))}parse(e){for(let r=0;r<e.length;r++){let i=e[r];this.parsePackage(i);for(let n of i.components)this.parseComponent(n),this.addLogicalNet(n);this.parsePads(i)}}parsePackage(e){let r=3,n=this.handel.encode.feed("PACKAGE",e),s=[];n.toString(s,r),this.packages.push(this.mergeSource(s))}parseComponent(e){let r=3,n=this.handel.encode.feed("COMPONENT",e),s=[];n.toString(s,r),this.components.push(this.mergeSource(s))}parsePads(e){let r=e.getPads();this.handel.createPinStandard(r)}parseLogicalNet(){let e=3,r=this.handel.encode,i=[];for(let n of this.logicalNet){let s=[];r.feed("LogicalNet",n).toString(s,e),i.push(this.mergeSource(s))}return i}addLogicalNet(e){let i=pT.getInstance().get(e),n=e.getPads();for(let s of n){let a=s.net,l=s.num,c=this.logicalNet.get(a);c||this.logicalNet.set(a,c=new Map);let h=c.get(i);h||c.set(i,h=new Set),h.add(l)}}clear(){super.clear(),this.logicalNet.clear(),this.components.length=0,this.packages.length=0}toString(e){let r=this.parseLogicalNet();return e.push(...this.packages),e.push(...this.components),e.push(...r),this.logicalNet.clear(),this.packages.length=0,this.components.length=0,this.clear(),e}};var Xle=class extends js{constructor(e,r){super("PadStackDef",e);this.padStacks=new Array;this.handel=null;this.handel=r}add(e){this.padStacks.push(this.getTemplate(e))}clear(){super.clear(),this.padStacks.length=0}toString(e,r){for(;this.padStacks.length>0;){let n=this.padStacks.shift();e.push(n)}return this.clear(),e}getTemplate(e){var u,d;let{item:r,layers:i}=e,n=[],a=`        <PadStackDef name="${r instanceof et?tD(r.globalIndex,(u=r.getParent())==null?void 0:u.designator,r.num):"Via_"+r.globalIndex}">
`,l=`        </PadStackDef>
`;n.push(a);let c=null;if(r.layerId===12){let p=r.hole;c=r instanceof et?{name:Y6(r.globalIndex,(d=r.getParent())==null?void 0:d.designator,r.num),diameter:this.convertUnit(p.holeRadius*2),platingStatus:"PLATED",plusTol:0,minusTol:0,x:this.convertUnit(r.center.x),y:this.convertUnit(r.center.y)}:{name:`Hole_Via_${r.globalIndex}`,diameter:this.convertUnit(r.holeRadius*2),platingStatus:"VIA",plusTol:0,minusTol:0,x:this.convertUnit(r.center.x),y:this.convertUnit(r.center.y)}}if(c){let{diameter:p,minusTol:m,name:g,platingStatus:y,plusTol:b,x:P,y:T}=c;n.push(`          <PadstackHoleDef name="${g}" diameter="${p}" platingStatus="${y}" plusTol="${b}" minusTol="${m}" x="${P}" y="${T}"/>
`)}return this.getPadDefs(e).forEach(p=>{let{layerRef:m,padUse:g}=p,y=p.shapes,b=y.Location,P=y.StandardPrimitiveRef;n.push(`          <PadstackPadDef layerRef="${m}" padUse="${g}">
	          <Location x="${b.x}" y="${b.y}"/>
	          <StandardPrimitiveRef id="${P.id}"/>
	        </PadstackPadDef>
`)}),n.push(l),this.toBuffer(n.join(""))}getPadDefs(e){let{item:r,layers:i}=e,n=Ze.getInstance();if(r instanceof et){let s=[];for(let a of i){let l=0,c=a.layerId;c==5?l=r.topSolderExpansion:c==6?l=r.bottomSolderExpansion:(c==8||c==7)&&(l=r.pasteExpansion);let h=YA(r,c),u={Location:{x:0,y:0},StandardPrimitiveRef:{id:E1(h,l)}},d={layerRef:a.name,padUse:"REGULAR",shapes:u};s.push(d)}return s}else{let s=[];if(r.type===1){let l=n.getLayer(r.startLayer),c=n.getLayer(r.endLayer),h=l.name+" to "+c.name;s.push({layerRef:h,padUse:"REGULAR",shapes:{Location:{x:0,y:0},StandardPrimitiveRef:{id:E1(r)}}})}for(let l of i){let c=0;l.layerId==5?c=r.topExpansion:l.layerId==6&&(c=r.bottomExpansion);let h={layerRef:l.name,padUse:"REGULAR",shapes:{Location:{x:0,y:0},StandardPrimitiveRef:{id:E1(r,c)}}};s.push(h)}return s}}convertUnit(e){return Math.round(na(e*10,"mil",this.handel.unit)*1e8)/1e8}};var qle=class extends js{constructor(e,r){super("Layers",e);this.layers=new Array;this.panelize=!1;this.handel=null;this.handel=r}init(e,r=!1){this.panelize=r;for(let i=0;i<e.length;i++){let n=e[i],s=n.name,a={item:n,layerRefName:s};n.layerId===12&&(a={isSpan:!0,layerRefName:s,from:"Top Layer",to:"Bottom Layer",startLayer:1,endLayer:2}),this.add(a)}}add(e){let r=e.layerRefName;r?this.layers.find(n=>n.layerRefName===r)||this.layers.push(e):this.layers.push(e)}deleteLayer(e){let r=this.layers.findIndex(i=>i.layerRefName===e);r>=0&&this.layers.splice(r,1)}clear(){super.clear(),this.layers.length=0}toString(e,r){let i=[],n=[];for(let s=1;s<=this.layers.length;s++){let a=this.layers[s-1],{item:l,isSpan:c,layerRefName:h,stiffener:u}=a;if(l){i.push(this.handel.encode.feed("Layer",l).parseXmlStr(3));let d=this.handel.encode.feed("StackupLayer",l);d.setAttribute("sequence",s.toString());let p=d.parseXmlStr(4);n.push(p)}else if(c){i.push(this.parseSpanLayer(a));let d=new js("StackupLayer"),p={layerOrGroupRef:h,thickness:"0",tolMinus:"0",tolPlus:"0",sequence:s.toString()};d.setAttribute(p),new js("SpecRef",d).setAttribute("id",h);let g=d.parseXmlStr(4);n.push(g)}else if(u){let{name:d,layerFunction:p,side:m,polarity:g,thickness:y}=u,b=`      <Layer name="${d}" layerFunction="${p}" side="${m}" polarity="${g}"/>
`;i.push(this.toBuffer(b));let P=new js("StackupLayer"),T={layerOrGroupRef:d,thickness:y||0,tolMinus:"0",tolPlus:"0",sequence:s.toString()};P.setAttribute(T),new js("SpecRef",P).setAttribute("id",d);let C=P.parseXmlStr(4);n.push(C)}}return e.push(this.mergeSource(i)),e.push(this.createStackUp(n)),this.clear(),e}createStackUp(e){let i=this.handel.encode.feed2Attr("Stackup",this.layers).get("overallThickness"),s=e.map(h=>new TextDecoder().decode(h)).join(""),a=`      <Stackup name="Stackup" overallThickness="${i}" tolPlus="0" tolMinus="0" whereMeasured="OTHER">
`,l=`      </Stackup>
`,c=[a];return c.push(this.createGroup(R.getInstance().name,s,i)),this.panelize&&c.push(this.createGroup("Panels",s,i)),c.push(l),this.toBuffer(c.join(""))}createGroup(e,r,i){return'        <StackupGroup name="'+e+'_AllStackupLayers" thickness="'+i+`" tolMinus="0" tolPlus="0">
`+r+`        </StackupGroup>
`}parseSpanLayer(e){let{item:r,isSpan:i,from:n,to:s,startLayer:a,endLayer:l,layerRefName:c}=e,h="NONE";a==1&&l==2?h="ALL":a==1?h="TOP":l==2?h="BOTTOM":h="INTERNAL";let u={name:c,layerFunction:"DRILL",side:h,polarity:"POSITIVE"},d={fromLayer:n,toLayer:s},p=new js("Layer"),m=new js("Span",p);return p.setAttribute(u),m.setAttribute(d),p.parseXmlStr(3)}};var M2=class extends js{constructor(t,e){super("polygon",e),this.unit=t}parse(t,e,r=0){let{header:i,lineDesc:n}=e,s=[],a=i.pop();for(let c=0;c<i.length;c++){let h=i[c],{tag:u,children:d}=h,p=[];for(let m in h){if(m==="tag")continue;let g=h[m];(typeof g=="string"||typeof g=="number")&&p.push(` ${m}="${g}"`)}if(s.push(`${mh.indent[r+c]}<${u}${p.join("")}>
`),(d==null?void 0:d.length)>0)for(let m of d){let g=m.parseXmlStr(r+c+2);s.push(lle.decode(g))}}t.forEach((c,h)=>{h==0?(s.push(`${mh.indent[r+i.length]}<${a.tag}>
`),s.push(this.getPolygon(c,r+i.length+1)),n&&s.push(this.lineDescTemplate(n,r+i.length+1)),s.push(`${mh.indent[r+i.length]}</${a.tag}>
`)):(s.push(`${mh.indent[r+i.length]}<Cutout>
`),s.push(this.getPolygon(c,r+i.length+1)),n&&s.push(this.lineDescTemplate(n,r+i.length+1)),s.push(`${mh.indent[r+i.length]}</Cutout>
`))});for(let c=i.length-1;c>=0;c--)s.push(`${mh.indent[r+c]}</${i[c].tag}>
`);let l=s.join("");this.xmlStr=l}getPolygon(t,e){let r=[],i=t[0].start();return r.push(this.startPoint(i,e)),t.forEach(n=>{if(n instanceof M)r.push(this.lineto(n.end(),e));else if(n instanceof q)if(ne.greatereq(Math.abs(n.sweepAngle),360)){let s=n.center.sub(n.start());r.push(this.arcto(n.start().add(s.mul(2)),n.center,!n.isCCW,e)),r.push(this.arcto(n.end(),n.center,!n.isCCW,e))}else r.push(this.arcto(n.end(),n.center,!n.isCCW,e));else n instanceof Dr&&n.points(.1).forEach(a=>{r.push(this.lineto(a,e))})}),r.join("")}clear(){super.clear()}toString(t,e){return t.push(this.xmlStr),this.clear(),t}startPoint(t,e){let r=this.convertUnit(t.x),i=this.convertUnit(t.y);return`${mh.indent[e]}<PolyBegin x="${r}" y="${i}"/>
`}lineto(t,e){let r=this.convertUnit(t.x),i=this.convertUnit(t.y);return`${mh.indent[e]}<PolyStepSegment x="${r}" y="${i}"/>
`}arcto(t,e,r,i){let n=this.convertUnit(t.x),s=this.convertUnit(t.y),a=this.convertUnit(e.x),l=this.convertUnit(e.y);return`${mh.indent[i]}<PolyStepCurve x="${n}" y="${s}" centerX="${a}" centerY="${l}" clockwise="${r}"/>
`}lineDescTemplate(t,e){return`${mh.indent[e]}<LineDesc lineEnd="ROUND" lineWidth="${this.convertUnit(t)}" lineProperty="SOLID"/>
`}convertUnit(t){return Math.round(na(t*10,"mil",this.unit)*1e8)/1e8}};var N3e="millimeter",$le=class{constructor(t,e,r){this.NoNet="NoNet";this.tip=.07;this.progress=0,this.document=t,this.unit=e,this.OEMNumber=r,this.IPCEncode=new zle(this.unit),this.pcbName=R.getInstance().name,this.isPanelize()}get encode(){return this.IPCEncode}isPanelize(){if(Pi.offset){let e=Pi.bBox,r=Pi.outerBBox,i=e.LL(),n=r.LL(),s=Pi.toJSON();if(s!=null&&s.success){let a={x:this.convertUnit(n.x),y:this.convertUnit(n.y),pcbX:this.convertUnit(i.x),pcbY:this.convertUnit(i.y),nx:s.column,ny:s.row,dx:this.convertUnit(e.width()+s.columnSpacing),dy:this.convertUnit(e.height()+s.rowSpacing),angle:0,mirror:!1,name:"Panels",onlyOutline:s.onlyOutline};this.panelizeMsg=a}}}generateContent(){let t=this.document.getContent();t.init(this.unit,this),this.getLayers().forEach(r=>{let i=r.activeColor,n={r:Math.round(i.r*255),g:Math.round(i.g*255),b:Math.round(i.b*255),model:r};t.addLayer(r.name,n)})}getLayers(){let t=["3D_MODEL","3D_SHELL_BOTTOM","3D_SHELL_OUTLINE","3D_SHELL_TOP","OTHER"],e=Ze.getInstance(),r=e.getUseLayer().filter(a=>{if(t.indexOf(a.type)<0)return!0}),n=e.getLayerPhys().filter(a=>a.layerType==="SUBSTRATE").map(a=>e.getLayer(a.layerId));return r.concat(n)}generateEcad(){this.parseCadHeader();let t=this.initCadData();this.generatePcbStep(t),this.needPanelize()&&this.generatePanelStep(t)}parseCadHeader(){let t=this.document.getEcad(),e=this.document.getContent().getAllLayers(),r=this.IPCEncode.feedLayerItems2Attr("Spec",e),i=this.unit;i=="mm"&&(i=N3e);let n=i.toUpperCase(),s=new Yle(r,n,t);this.document.getEcad().cadHeader=s}initCadData(){let t=this.document.getEcad(),e=new js("CadData",t);return t.cadData=e,this.parseLayerStackup(e),e}parseLayerStackup(t){let e=this.document.getContent().getAllLayers(),r=this.sortLayers(e),i=this.needPanelize(),n=new qle(t,this);this.document.getEcad().layerNode=n,n.init(r,i)}sortLayers(t){let e=Ze.getInstance(),i=e.getLayerPhys().map(n=>e.getLayer(n.layerId));return t.forEach(n=>{i.indexOf(n)<0&&i.push(n)}),i}generatePcbStep(t){let e=this.document.getEcad(),r=new js("Step",t);this.IPCEncode.addAttribute(r,{name:this.pcbName});let i=new Xle(r,this);e.padStack=i;let n=new js("Datum",r);n.xmlStr=mh.Ecad.Datum(this.getDatum()),this.parseProfile(r),this.parseFeature(r),this.parseFootprints(r)}getAllProfile(t=!1){let e=new Array;Qi.getInstance().iterator(s=>n(s)),Fi.getInstance().iterator(s=>n(s));let{closePls:r,polys:i}=this.connectPolygonOutLine();return r.forEach(s=>e.push(s.pl)),t||i.forEach(s=>e.push(s.pl)),e;function n(s){(s.type=="Board Outline"||s.type=="Line"&&s.layerId==11)&&e.push(s.getMathGraphics())}}connectPolygonOutLine(){var l;let r=[],i=[],n=vi.getInstance().getAllItem(),s={},a=new _e;n.forEach(c=>{if(c.layerId==11){let h=c.strokeWidth.toFixed(2).toString();s[h]||(s[h]=[]),s[h].push(c)}});for(let c in s){let h=[],u=s[c],d=(l=u[0])==null?void 0:l.strokeWidth;if(u.forEach(P=>{a.ext1(P.bbox);let T=P.outline;if(P.isClose()){i.push({pl:T,strokeWidth:P.strokeWidth,bbox:P.bbox,layerId:11});return}h.push(...T.primitives)}),h.length<=0)continue;let p=a.build1().extendOfSize(2),m=new $c(p,2,.1,new Di(1),h),g=p.extendOfSize(p.width()),y=m.detect().items.filter(P=>P.bbox().width()<g.width());for(let P of y)P.isClose(.001)&&hI(P).forEach(I=>{let C={pl:I.asClose(),strokeWidth:d,bbox:I.bbox(),layerId:11};i.push(C)});let b=this.filterPrimitives(y,h,d);for(let P of b){let T=ge.build2([P]),I={pl:T,strokeWidth:d,bbox:T.bbox(),layerId:11};r.push(I)}}return{polys:r,closePls:i}}filterPrimitives(t,e,r){if(t.length==0)return e;let i=new ji(10);e.forEach(s=>{i.add(s)});let n=new Set;return t.forEach(s=>{s.primitives.forEach(a=>{let l=i.search(a.bbox().extendOfSize(r));a instanceof q?l.filter(h=>h instanceof q).forEach(h=>{this.inArcShape(a.start(),r,h)&&this.inArcShape(a.end(),r,h)&&n.add(h)}):a instanceof M&&l.filter(h=>h instanceof M).forEach(h=>{this.inLineShape(a.start(),r,h.start(),h.end())&&this.inLineShape(a.end(),r,h.start(),h.end())&&n.add(h)})})}),e.filter(s=>!n.has(s))}inArcShape(t,e,r){let i=t.x,n=t.y,s=r.sweep(),a=r.rx,l=r.center,c=s==ae.CW,h=c?r.endAngle():r.startAngle,u=c?r.startAngle:r.endAngle();h%=kr,h<0&&(h+=kr),u%=kr,u<0&&(u+=kr);let d=a-e/2,p=a+e/2,m=i-l.x,g=n-l.y,y=Math.atan2(g,m);if(y<0&&(y+=kr),h<=u&&y>=h&&y<=u||h>u&&(y>=h&&y<=kr||y>=0&&y<=u)||h==u){var b=Math.sqrt(m*m+g*g);return b<=p&&b>=d}else{var b=(p+d)/2,P=new S(l.x+Math.cos(h)*b,l.y+Math.sin(h)*b),T=new S(l.x+Math.cos(u)*b,l.y+Math.sin(u)*b),I=i-P.x,C=n-P.y,E=i-T.x,O=n-T.y;return I*I+C*C<=e*e/4?!0:E*E+O*O<=e*e/4}}inLineShape(t,e,r,i){let n=t.x,s=t.y,a=n-r.x,l=s-r.y,c=n-i.x,h=s-i.y,u=i.x-r.x,d=i.y-r.y,p=new S(-d,u).normalize(),m=u+p.x*e/2,g=d+p.y*e/2,y=m*m+g*g,b=a*a+l*l,P=c*c+h*h,T=Math.abs(a*d-l*u)/2,C=Math.sqrt(u*u+d*d)*e/4;if(T<=C&&b<=y&&P<=y)return!0;{let E=e/2;return b<=E*E?!0:P<=E*E}}getBoardBBox(){let t=this.getAllProfile(),e=new _e;return t.forEach(i=>{e.ext1(i.bbox())}),e.build1()}getSlotRegion(){let t=vi.getInstance().getAllItem().filter(n=>n.type=="Slot Region"&&!n.isEmpty),e=Qi.getInstance().getAllItem().filter(n=>n.type=="Slot Region"&&!n.isEmpty),r=Fi.getInstance().getAllItem().filter(n=>n.type=="Slot Region"&&!n.isEmpty),i=[];return xe.addAll(i,t),xe.addAll(i,e),xe.addAll(i,r),i}getDatum(){let t=null;if(this.panelizeMsg)t={x:this.panelizeMsg.x,y:this.panelizeMsg.pcbY};else{let e=this.getBoardBBox().LL();t={x:this.convertUnit(e.x),y:this.convertUnit(e.y)}}return t}parseProfile(t){var n;let e=this.getAllProfile(!0),r=this.getSlotRegion();if((n=this.panelizeMsg)!=null&&n.onlyOutline)this.panelBorder(t);else{let s=-1,a=null,l=0;for(let c=0;c<e.length;c++){let h=e[c].bbox().area();h>=l&&(l=h,s=c,a=e[c])}this.IPCEncode.feed("PROFILE",{profiles:a,cutouts:r.map(c=>c.getMathGraphics())},t)}this.document.getContent().getAllLayers().forEach(s=>{this.IPCEncode.feed("LayerFeature",s,t)});for(let s=0;s<e.length;s++){let a=e[s],l=this.getLayerFeature(t,Ze.getInstance().getLayer(11).name),c=[{tag:"Set"},{tag:"Features"},{tag:"Contour"},{tag:"Polygon"}];new M2(this.unit,l).parse(this.getRegionPrimitive(a),{header:c},5)}}parseFootprints(t){new jle(this,t).init()}parseFeature(t){this.parsePadData(t),this.parseVias(t),this.parseTracks(t),this.parseText(t),this.parseLines(t),this.parseTearDrops(t),this.parseFillRegion(t),this.parseStiffener(t),this.parseImage(t),this.parseCopper(t),this.parseSize(t),this.parsePlaneZone(t),this.panelizeMsg&&this.parsePanelsData(Pi.getSourceData(),t)}parsePadData(t){let e=jn.getInstance().getAllItem(),r=500;for(;e.length>0;){let i=e.splice(0,r);this.parsePads(i,t)}}createPadForLayer(t,e,r){let i={name:"PADSTACK_USAGE",value:e.layerId===2||e.layerId===1?"Smd":"Through",type:"STRING"};this.createPad(t,e,r,i)}createPad(t,e,r,i){let n=this.createSet(t,e);i&&this.nonstandardAttribute(i,n),this.IPCEncode.feed("PAD",{pad:e,layer:r},n),n.parseXmlStr(5)}parseHole(t,e){let r=t.hole.holeOffset;t.hole.holeShape==="SLOT"||!r.equals(S.ORIGIN)?this.IPCEncode.feed("SLOT",t,e).parseXmlStr(5):t.hole.holeShape==="ROUND"&&this.IPCEncode.feed("HOLE",t,e).parseXmlStr(5)}createLayerSpan(t,e,r){let i=new js("Span",t),n={fromLayer:e,toLayer:r};return i.setAttribute(n),i}getHoleSet(t,e){let r={},i=e.net||this.NoNet;if(e instanceof et){let s=e.getParent();if(r={net:i,testPoint:e.isTestPad,geometry:tD(e.globalIndex,s==null?void 0:s.designator,e.num)},s){let a={componentRef:s==null?void 0:s.designator};Object.assign(r,a)}else{let a=e.layerId,l={plate:e.plated,padUsage:a!==1&&a!==2?"VIA":"NONE"};Object.assign(r,l)}}else e instanceof Ct&&(r={net:i,testPoint:"false",plate:"true",padUsage:"VIA",geometry:"Via_"+e.globalIndex});let n=new js("Set",t);return n.setAttribute(r),n}createSet(t,e){let r=this.getSetAttr(e),i=new js("Set",t);return i.setAttribute(r),i}getSetAttr(t){let e={},r=(t==null?void 0:t.net)||this.NoNet;if(t instanceof et){if(e={net:r,testPoint:t.isTestPad},!t.getParent()){let i=t.layerId,n={plate:t.plated,padUsage:i!==1&&i!==2?"VIA":"NONE"};Object.assign(e,n)}}else t instanceof Ct?e={net:r,testPoint:"false",plate:"true",padUsage:"VIA"}:t instanceof hn||t instanceof yn?e={net:r}:t instanceof Li?e={geometryUsage:"TEXT"}:t instanceof gt?e={net:r}:(t==null?void 0:t.type)==="Line"?e={net:r}:(t==null?void 0:t.type)==="TearDrop"?e={net:r,geometryUsage:"TEARDROP"}:(t==null?void 0:t.type)==="Fill Region"&&(e={net:r});return e}nonstandardAttribute(t,e){let r=new js("NonstandardAttribute",e);return r.xmlStr=`            <NonstandardAttribute name="PADSTACK_USAGE" value="${t.value}" type="STRING"/>
`,r}parseVias(t){let e=bn.getInstance().getAllItem(),r=Ze.getInstance(),i=n=>{for(let s=0;s<n.length;s++){let a=n[s],l=this.getCrossLayer();if(a.type===1){let h=r.getLayer(a.startLayer),u=r.getLayer(a.endLayer),d=this.getBlindLayers(a),p=h.name+" to "+u.name;this.document.getContent().addLayer(p,{isSpan:!0});let m={isSpan:!0,layerRefName:p,from:h.name,to:u.name,startLayer:h.layerId,endLayer:u.layerId};this.document.getEcad().layerNode.add(m);let g=this.getLayerFeature(t,p),y=this.getFeatureSet(g,"net",a.net);this.IPCEncode.feed("HOLE",a,y).parseXmlStr(5),l=d}else{let h=this.getLayerFeature(t,"Multi-Layer"),u=this.getHoleSet(h,a);this.IPCEncode.feed("HOLE",a,u),u.parseXmlStr(5)}l=l.filter(h=>this.filterUnuseLayer(h.layerId,a.unusedInnerLayers));for(let h of l){let u=this.getLayerFeature(t,h.name);this.createPad(u,a,h.layerId),this.addStandard(a,h.layerId)}this.document.getEcad().padStack.add({item:a,layers:l})}};for(;e.length>0;){let n=e.splice(0,500);i(n)}this.updateProgress()}filterUnuseLayer(t,e=[]){return t!==7&&t!==8&&e.indexOf(t)<0}getBlindLayers(t){let e=Ze.getInstance(),r=t.startLayer,i=t.endLayer,n=e.getAllCopperLayerId4Order(),s=n.findIndex(c=>c==r),a=n.findIndex(c=>c==i);s>a&&([s,a]=[a,s]);let l=n.slice(s,a+1);return(r===1||i===1)&&(l=l.concat(5,7)),(i===2||r===2)&&(l=l.concat(6,8)),l.map(c=>e.getLayer(c))}formatTextValue(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}parseText(t){let e=io.getInstance().getAllItem();for(let r of e){let i={name:"TEXT",value:this.formatTextValue(r.value),type:"STRING",font:r.fontFamily},n=Ze.getInstance().getLayer(r.layerId).name,s=this.getLayerFeature(t,n),a=this.createSet(s,r),l=this.nonstandardAttribute(i,a);if(r.type===0)this.IPCEncode.feed("TEXT",r,a);else if(r.type===1){let c=r.getRealOutline(),h=[];c.forEach(u=>{let d=u.group,p=h[d];p||(p=h[d]=[]),p.push(u)}),h.forEach(u=>{let d=new M2(this.unit,a),p={tag:"Features"};if(r.rotation){let g=this.toFix(r.rotation*180/Math.PI),y=new js("Xform");y.setAttribute({rotation:g}),p.children=[y]}let m=[p,{tag:"Contour"},{tag:"Polygon"}];d.parse(u.map(g=>g.pl.primitives),{header:m},6)})}}this.updateProgress()}parseTracks(t){let e=this.generateTrack();for(let[r,i]of e)this.parseTrack(r,i,t);this.updateProgress()}parseTrack(t,e,r){let{layerId:i}=t,n=Ze.getInstance().getLayer(i).name,s=this.getLayerFeature(r,n),a=new M2(this.unit,s),l=[{tag:"Set",net:t.net||this.NoNet},{tag:"Features"},{tag:"Polyline"}];a.parse([e],{header:l,lineDesc:t.width},5)}generateTrack(){let t=Sn.getInstance().getAllItem(),e={},r=new Map;for(let i of t)if(i instanceof gt){if(e[i.globalIndex])continue;let n=this.findTracks(i,e),s=[];for(let a of n)xe.addAll(s,a.points(.1));r.set(i,n)}return r}findTracks(t,e){let r=[t],i=t instanceof Ii?[q.build3(t.center,zt.toDegrees(t.startAngle),zt.toDegrees(t.sweepAngle),t.radius,t.radius)]:[new M(t.start,t.end)],n=t.end,s=Iu.getNode(t.net);for(;r.length>0;){let a=r.pop();e[a.globalIndex]=!0;let l=this.getConnect(a,n,s,e),c=l.nextItem;if(c){r.push(c),n=l.nextPoint;let h=c instanceof Ii?q.build3(c.center,zt.toDegrees(c.startAngle),zt.toDegrees(c.sweepAngle),c.radius,c.radius):new M(c.start,c.end);l.isStart?i.push(h):i.push(h.reverse())}}for(r.push(t),n=t.start;r.length>0;){let a=r.pop();e[a.globalIndex]=!0;let l=this.getConnect(a,n,s,e),c=l.nextItem;if(c){r.push(c),n=l.nextPoint;let h=c instanceof Ii?q.build3(c.center,zt.toDegrees(c.startAngle),zt.toDegrees(c.sweepAngle),c.radius,c.radius):new M(c.start,c.end);l.isStart?i.unshift(h.reverse()):i.unshift(h)}}return i}getConnect(t,e,r,i){let s,a,l=r.map.get(t);if(l){let h=Array.from(l.near).find(u=>{let d=u.item;if(d instanceof gt&&!i[d.globalIndex]&&ne.eq(t.width,d.width)){if(d.start.distance2(e)<1e-4)return s=d.end,a=!0,!0;if(d.end.distance2(e)<1e-4)return s=d.start,a=!1,!0}return!1});return{nextItem:h==null?void 0:h.item,nextPoint:s,isStart:a}}return{nextItem:null,nextPoint:s,isStart:a}}parseLines(t){let e=[];vi.getInstance().iterator(n=>i(n)),Qi.getInstance().iterator(n=>i(n)),Fi.getInstance().iterator(n=>i(n));let r={name:"FILLET",value:"true",type:"STRING"};function i(n){n.type==="Line"&&e.push(n)}for(let n of e){let{layerId:s}=n;if(n.type=="Line"){let a=Ze.getInstance().getLayer(s).name,l=this.getLayerFeature(t,a),c=this.nonstandardAttribute(r),h=n.getMathGraphics().primitives,u=new M2(this.unit,l),d=[{tag:"Set",net:this.NoNet,children:[c]},{tag:"Features"},{tag:"Polyline"}];u.parse([h],{header:d,lineDesc:n.strokeWidth},5)}}this.updateProgress()}parseTearDrops(t){let e=vi.getInstance().getAllItem(),r={name:"FILLET",value:"true",type:"STRING"};e.forEach(i=>{if(i.type=="TearDrop"){let{layerId:n}=i,s=Ze.getInstance().getLayer(n).name,a=this.getLayerFeature(t,s),l=[{tag:"Set",net:i.net||this.NoNet,geometryUsage:"TEARDROP"},{tag:"Features"},{tag:"Contour"},{tag:"Polygon"}];new M2(this.unit,a).parse(this.getRegionPrimitive(i.getMathGraphics()),{header:l},5)}}),this.updateProgress()}parseFillRegion(t){let e=[];vi.getInstance().iterator(n=>i(n)),Qi.getInstance().iterator(n=>i(n)),Fi.getInstance().iterator(n=>i(n));let r={name:"FILLET",value:"true",type:"STRING"};e.forEach(n=>{let{layerId:s}=n,a=Ze.getInstance().getLayer(s).name,l=this.getLayerFeature(t,a),c=this.nonstandardAttribute(r),h=[{tag:"Set",net:n.net||this.NoNet,children:[c]},{tag:"Features"},{tag:"Contour"},{tag:"Polygon"}];new M2(this.unit,l).parse(this.getRegionPrimitive(n.getMathGraphics()),{header:h},5)});function i(n){n.type=="Fill Region"&&e.push(n)}this.updateProgress()}parseImage(t){let e=Hs.getInstance().getAllItem();for(let i of e){let{layerId:n}=i,s=Ze.getInstance().getLayer(n).name,a=this.getLayerFeature(t,s),l=this.createSet(a),c=i.getPath(),h=r(c);for(let u of h){let d=[{tag:"Features"},{tag:"Contour"},{tag:"Polygon"}],p=new M2(this.unit,l),m=u.map(g=>g.pl.primitives);p.parse(m,{header:d},6)}}function r(i){let n=[],s=[],a=[];for(let l of i){let c=l.group;a[c]||(a[c]=[]),a[c].push(l)}for(let l of a)if(l&&l.length){for(let c of l)c.flag?(s.length>0&&n.push(s),s=[c]):s.push(c);s.length>0&&n.push(s)}return n}this.updateProgress()}parseCopper(t){let e=qo.getInstance().getAllItem();for(let r of e){let{layerId:i}=r,n=Ze.getInstance().getLayer(i).name,s=this.getLayerFeature(t,n),a=r.getOutline(),l=r.style;if(l=="45grid"||l==="90grid"){let c=r.gridLineWidth;a.forEach(h=>{let u=h.primitives;u&&u.forEach(d=>{let p=d.stroke(c,wr.ROUND,ae.CW);new M2(this.unit,s).parse([p.primitives],{header:[{tag:"Set",net:r.net||this.NoNet},{tag:"Features"},{tag:"Contour"},{tag:"Polygon"}]},5)})})}else new M2(this.unit,s).parse(a.map(h=>h.primitives),{header:[{tag:"Set",net:r.net||this.NoNet},{tag:"Features"},{tag:"Contour"},{tag:"Polygon"}]},5),r.optimization&&r.optimizationWidth!==0&&r.getMathGraphics().items.slice(a.length).forEach(u=>{new M2(this.unit,s).parse([u.primitives],{header:[{tag:"Set",net:r.net||this.NoNet},{tag:"Features"},{tag:"Contour"},{tag:"Polygon"}]},5)})}this.updateProgress()}parseSize(t){let e=Ma.getInstance().getAllItem(),r=sl.getInstance().getAllItem(),i=Na.getInstance().getAllItem();[...e,...r,...i].forEach(n=>{let{text:s,layerId:a}=n,l=Ze.getInstance().getLayer(a).name,c=this.getLayerFeature(t,l),h=this.createSet(c,s);this.IPCEncode.feed("SIZE",n,h)}),this.updateProgress()}parsePlaneZone(t){Xo.getInstance().getAllItem().forEach(r=>{let{layerId:i}=r,n=Ze.getInstance().getLayer(i).name,s=this.getLayerFeature(t,n),a=r.getOutline(),l=[{tag:"Set",net:r.net||this.NoNet},{tag:"Features"},{tag:"Contour"},{tag:"Polygon"}];new M2(this.unit,s).parse(a.map(h=>h.primitives),{header:l},5)}),this.updateProgress()}parseStiffener(t){let e=new Map,r=new Map;vi.getInstance().iterator(a=>s(a)),Qi.getInstance().iterator(a=>s(a)),Fi.getInstance().iterator(a=>s(a));let i=this.unit;i=="mm"&&(i=N3e);let n=a=>{let l=a===e;for(let[c,h]of a)for(let[u,d]of h){let p=this.convertUnit(u),m=`${l?"Top":"Bottom"}StiffenerLayer_${c}_${p}`;this.document.getContent().addLayer(m),this.document.getEcad().cadHeader.add(m,"MATERIAL",c);let g={stiffener:{name:m,layerFunction:"STIFFENER",side:l?"TOP":"BOTTOM",polarity:"POSITIVE",thickness:p}};this.document.getEcad().layerNode.add(g);let y={name:"FILLET",value:"true",type:"STRING"};d.forEach(b=>{let P=this.getLayerFeature(t,m),T=this.nonstandardAttribute(y),I=[{tag:"Set",net:b.net||this.NoNet,children:[T]},{tag:"Features"},{tag:"Contour"},{tag:"Polygon"}];new M2(this.unit,P).parse(this.getRegionPrimitive(b.getMathGraphics()),{header:I},5)})}};function s(a){if(a.type=="FPC Stiffener"){let l=a.layerId,{material:c,thickness:h}=a.component,u=e;l===59&&(u=r);let d=u.get(c);d||u.set(c,d=new Map);let p=d.get(h);p||d.set(h,p=new Set),p.add(a)}}n(e),n(r),this.updateProgress()}getLayerFeature(t,e){let r="layerRef".toString(),i=t.search("LayerFeature",{[r]:e});return i||(i=new js("LayerFeature",t),i.setAttribute(r,e)),i}getFeatureSet(t,e,r){let i=t.search("Set",r?{[e]:r}:null);return i||(i=new js("Set",t),r&&this.IPCEncode.addAttribute(i,{[e]:r})),i}addStandard(t,e){if(t instanceof et){let r=0;e==5?r=t.topSolderExpansion:e==6?r=t.bottomSolderExpansion:(e==8||e==7)&&(r=t.pasteExpansion);let i=YA(t,e),n=E1(i,r);this.document.getContent().findStandard(n)||this.document.getContent().addStandard(n,{item:i,expansion:r,model:t})}else if(t instanceof Ct){let r=0;e==5?r=t.topExpansion:e==6&&(r=t.bottomExpansion);let i=E1(t,r);this.document.getContent().findStandard(i)||this.document.getContent().addStandard(i,{item:t,expansion:r,model:null})}}generatePanelStep(t){let r=Pi.getSourceData(),i=new js("Step",t);this.IPCEncode.addAttribute(i,{name:this.panelizeMsg.name});let n=new js("Datum",i);n.xmlStr=mh.Ecad.Datum({x:this.panelizeMsg.x,y:this.panelizeMsg.y});let s=new js("StepRepeat",i),a={stepRef:this.pcbName,x:this.panelizeMsg.x,y:this.panelizeMsg.y,nx:this.panelizeMsg.nx,ny:this.panelizeMsg.ny,dx:this.panelizeMsg.dx,dy:this.panelizeMsg.dy,angle:this.panelizeMsg.angle,mirror:this.panelizeMsg.mirror};s.xmlStr=mh.Ecad.StepRepeat(a),this.panelBorder(i),this.parsePanelsData(r,i)}parsePanelsData(t,e){let r=t.holes;this.parseHoles(r,e);let i=t.pads;this.parsePads(i,e);let n=t.texts;this.parsePanelText(n,e);let s=Pi.getProfileGroup(13);this.parseArrow(s,e)}parseHoles(t,e){t.forEach(r=>{let i=this.getLayerFeature(e,"Multi-Layer"),n=this.getFeatureSet(i,"net");this.IPCEncode.feed("HOLE",r,n).parseXmlStr(5)})}parsePads(t,e){t.forEach(r=>{let i=this.getCrossLayer(this.getLayerSide(r.layerId));if(r.layerId===12){let n=this.getLayerFeature(e,"Multi-Layer"),s=this.getHoleSet(n,r);this.parseHole(r,s),i=i.filter(a=>this.filterUnuseLayer(a.layerId,r.unusedInnerLayers))}for(let n of i){let s=n.layerId,a=this.getLayerFeature(e,n.name);this.createPadForLayer(a,r,s),this.addStandard(r,s)}this.document.getEcad().padStack.add({item:r,layers:i})})}parsePanelText(t,e){for(let r of t){let i={name:"TEXT",value:r.value,type:"STRING",font:r.fontFamily},n=Ze.getInstance().getLayer(r.layerId).name,s=this.getLayerFeature(e,n),a=this.createSet(s,r);this.nonstandardAttribute(i,a),this.IPCEncode.feed("TEXT",r,a)}}parseArrow(t,e){for(let r of t){let{primitives:i,strokeWidth:n}=r,s=Ze.getInstance().getLayer(13).name,a=this.getLayerFeature(e,s),l=this.createSet(a,r);this.IPCEncode.feed("TEXT",{outline:[{primitives:i}],strokeWidth:n},l)}}convertUnit(t){return Math.round(na(t*10,"mil",this.unit)*1e8)/1e8}panelBorder(t){let e=Pi.toJSON(),{column:r,row:i,columnSpacing:n,rowSpacing:s}=e,a=Pi.bBox;n+=a.width(),s+=a.height();let c=Pi.getClosures(),h=this.getAllProfile(),u=this.getSlotRegion(),{borders:d,cutouts:p}=this.panelizeRegion(h,u,i,r,n,s),g=this.panelizeOutline(d,c,t)[0].items,y=g.splice(0,1)[0];p.push(...g),this.IPCEncode.feed("PROFILE",{profiles:y,cutouts:this.needPanelize()?g:p},t),d.push(y);let b=this.getLayerFeature(t,"Board Outline Layer");d.forEach(P=>{let T=this.createSet(b);this.IPCEncode.feed("REGION",P,T)})}panelizeRegion(t,e,r,i,n,s){let a=[],l=[];for(let u=0;u<i;u++){let d=new Qe().translate(n*u,0);t.forEach(p=>{l.push(p.clone().multiply3(d))}),e.forEach(p=>{a.push(p.getMathGraphics().clone().multiply3(d))})}let c=[],h=[];for(let u=0;u<r;u++){let d=new Qe().translate(0,s*u);l.forEach(p=>{c.push(p.clone().multiply3(d))}),a.forEach(p=>{h.push(p.clone().multiply3(d))})}return{borders:c,cutouts:h}}panelizeOutline(t,e,r){let i=new Ec,n=[];return t.forEach(a=>{n.push([a])}),e.forEach(a=>{let l=a[0];l&&X0(ge.build2(l.primitives),.1).forEach(h=>{h.items.forEach(u=>{n.push([u])})})}),i.getUnionForSingle(n)}sortLayersequence(t){let e=t.getChildren();for(let r=1;r<=e.length;r++)e[r-1].setAttribute("sequence",r.toString())}onlyColorRef(t){let e=t.length;if(!e)return!0;let r=t[0];return e==1&&r.getName()==="Set"}needPanelize(){return this.panelizeMsg&&!this.panelizeMsg.onlyOutline}getLayerSide(t){if(t===1)return 1;if(t===2)return-1;if(t===12)return 0}getCrossLayer(t=0){let e=Ze.getInstance(),r=[];if(t===1)r=[e.getLayer(7),e.getLayer(5),e.getLayer(1)];else if(t===-1)r=[e.getLayer(8),e.getLayer(6),e.getLayer(2)];else if(t===0){let i=[e.getLayer(7),e.getLayer(5)],n=[e.getLayer(6),e.getLayer(8)],s=e.getAllCopperLayerId4Order().map(a=>Ze.getInstance().getLayer(a));r=i.concat(s).concat(n)}return r}createPinStandard(t){for(let e of t){let r=this.getCrossLayer(this.getLayerSide(e.layerId));for(let i of r)this.addStandard(e,i.layerId)}}filterEmptyLayer(){let t=["TOP","BOTTOM","SIGNAL","PLANE","SUBSTRATE","TOP_SILK","BOT_SILK","TOP_SOLDER_MASK","BOT_SOLDER_MASK","TOP_PASTE_MASK","BOT_PASTE_MASK"];this.panelizeMsg&&t.push("DOCUMENT","OUTLINE");let e=this.document.getContent().getAllLayers(),r=[],i=this.document.getEcad(),n=i.cadData,s=this.unit;s=="mm"&&(s=N3e);let a=i.cadHeader,l=n.search("Step",{name:this.pcbName});l.getChildren().forEach(u=>{let d=u.getChildren();if(u.getName()==="LayerFeature"&&this.onlyColorRef(d)){let p=u.getAttribute("layerRef"),m=e.find(g=>g.name===p);m&&t.indexOf(m.type)<0&&r.push(u)}});let h=this.document.getContent();r.forEach(u=>{let d=u.getAttribute("layerRef");h.deleteLayer(d),i.cadHeader.delete(d),i.layerNode.deleteLayer(d),l.deleteNode(u)})}toFix(t,e=8){let r=Number(t.toFixed(e))%360;return r<0&&(r+=360),r}getRegionPrimitive(t){if(t instanceof ge)return[t.primitives];{let e=t.items,r=[];return e.forEach(i=>{r.push(i.primitives)}),r}}updateProgress(){this.progress+=this.tip,A.publish("progressUpdate",[this.progress,"ipc2581c"],Q())}};var Kle=class{constructor(t,e,r){this.ext=".xml";A.publish("progressUpdate",[0,"ipc2581c"],Q()),this.unit=t,this.OEMNumber=e,this.document=new ple,this.modelHandel=new $le(this.document,t,e),pT.getInstance().init(r)}async buildData(){this.document.createContent(),this.modelHandel.generateContent(),await this.document.createSupportInfo(),this.document.createBom(this.OEMNumber,this.modelHandel),this.document.initEcad(),this.modelHandel.generateEcad(),this.modelHandel.filterEmptyLayer(),pT.getInstance().clear()}async export(t){A.publish("progressUpdate",[.95,"ipc2581c"],Q());let e=await this.getSource();xd.downloadFile(t+this.ext,e),A.publish("progressUpdate",[1,"ipc2581c"],Q())}async getSource(){let t=this.document.export();return this.clear(),this.getSourceStream(t)}clear(){this.document.clear(),this.document=null,this.modelHandel=null}async getSourceStream(t){let e=new ReadableStream({start(s){n(t,s)}}),i=await new Response(e).blob();function n(s,a){for(let l=0;l<s.length;l++)a.enqueue(s[l]);a.close()}return i}};async function Rze(o){let t=o.fileName,e=o.selectOption,r=o.selectValue,i=o.auto,n=new Kle(e,r,i);await n.buildData(),await n.export(t)}var Zle=class extends z3{constructor(){super(),A.subscribe("PcbEditFootprint",this.editUpdate.bind(this))}editUpdate(t){let e=new Set,r=new Array;if(t.component!=null){let i=new Set;for(let n of t.component){let s=Hi.getItem(n.footprintUUID),a=t.type==2?s.uuid.includes("_")?s.source:s.uuid:s.uuid.length<=32?R.getInstance().id+"_"+n.globalIndex:s.uuid;i.add(a),e.add(s.uuid.includes("_")?s.source:s.uuid)}r=Array.from(i)}A.publish("editFootprint",{type:t.type,uuids:r,sources:Array.from(e)},Q())}};var xV=class{constructor(){this.needEncodeLayers=new Set;this.allLayerMap=new Map;this.map=new Map;this.rules={};this.shapes=new Array;this.body=new Map;this.layerMaxClearance=new Map}encode(){return this.encodeLayers(),this.encodeRules(),this.encodeShapes(),this.encodeDoc()}encodeHead(){let t=kt.bbox(),e=Array.from(this.allLayerMap.values());return JSON.stringify({bbox:[t.minX,t.minY,t.maxX,t.maxY],layerStack:e,rules:this.rules,shapes:this.shapes})}encodeBody(){let t=[];for(let[e,r]of this.body)t.push([e,this.layerMaxClearance.get(e),JSON.stringify(r)]);return t}encodeDoc(){let t=this.encodeHead(),e=this.encodeBody();return this.clear(),{head:t,body:e}}clear(){this.needEncodeLayers.clear(),this.allLayerMap.clear(),this.map.clear(),this.rules=null,this.shapes.length=0,this.body.clear(),this.body=null}getSafeSpaceing(t,e){let r=e==null?null:re.getInstance().getSafeSpacing(e);return r==null&&(r=re.getInstance().getSafeSpacing(t)),r==null&&(r=re.getInstance().getDefaultSafeSpacing()),r}encodeLayers(){for(let t of Pe.getAllLayer()){if(!t.config)continue;let e=t.layerID,r=0;switch(t.type){case"SIGNAL":r=O2(e);break;case"MECHANICAL":r=1;break;case"PLANE":r=O2(e);break;default:r=0;break}this.needEncodeLayers.has(e)&&this.map.set(e,`${t.type}_${r}`),this.allLayerMap.set(e,{type:t.type,order:r})}}encodeRules(){for(let[t,e]of this.map)this.rules[e]=[],this.layerMaxClearance.set(e,0);this.getNetRule(),this.getBetweenNetworkRule(),this.getRegionRule()}updateMaxClearance(t,e){let r=this.layerMaxClearance.get(e);r=Math.max(r,t),this.layerMaxClearance.set(e,r)}getClearanceMap(t,e,r){let i=[0,1,2,3,4,5,6,7,8,8,9,10,11,12],n={},s=this.map.get(e),a=this.layerMaxClearance.get(s);return i.forEach(l=>{let c=r.getClearance(t,l,e);n[l]=c,a=Math.max(a,c)}),this.layerMaxClearance.set(s,a),n}encodeShapes(){this.getVias(),this.getPads(),this.getProfiles(),this.getTracks(),this.getTexts(),this.getImages(),this.getPlaneZone()}add2Body(t,e){let r=this.map.get(t),i=this.body.get(r);i==null&&(i=[],this.body.set(r,i)),i.push(e)}getVias(){Wr.getAllItem().forEach(e=>{let r=e.getParent()!=null;if(e.type==1){let i={PcbBlindVia:{id:e.globalIndex,net:e.net,center:e.center,holeDiameter:e.holeRadius*2,startLayer:this.allLayerMap.get(e.startLayer),startLayerPad:e.radius*2,innerPad:e.radius*2,endLayer:this.allLayerMap.get(e.endLayer),endLayerPad:e.radius*2,mask:!1,locked:e.locked||r,unuseLayers:this.getUnuseLayers(e.unusedInnerLayers)}};this.shapes.push(i)}else{let i={PcbVia:{id:e.globalIndex,net:e.net,center:e.center,holeDiameter:e.holeRadius*2,topPad:e.radius*2,innerPad:e.radius*2,botPad:e.radius*2,mask:!1,locked:e.locked||r,unuseLayers:this.getUnuseLayers(e.unusedInnerLayers)}};this.shapes.push(i)}})}getUnuseLayers(t){let e=new Array;for(let r of t){let i=this.allLayerMap.get(r);i&&e.push(i)}return e}getTracks(){pr.getAllItem().forEach(e=>{if(this.needEncodeLayers.has(e.layerId))if(e instanceof yi){let r=q.build2(e.center,e.startAngle/Math.PI*180,e.endAngle/Math.PI*180,e.radius,e.radius,e.sweep),i={PcbarcTrack:{net:e.net,layer:this.allLayerMap.get(e.layerId),arc:r,width:e.width,id:e.globalIndex,locked:e.locked}};this.add2Body(e.layerId,i)}else{let r={PcbTrack:{net:e.net,layer:this.allLayerMap.get(e.layerId),start:e.start,end:e.end,width:e.width,id:e.globalIndex,locked:e.locked}};this.add2Body(e.layerId,r)}})}getTexts(){ri.getAllItem().forEach(e=>{if(!this.needEncodeLayers.has(e.layerId))return;let r=e.model.box;if(!r||r.height==0||r.width==0)return;let i={PcbboxShape:{layer:this.allLayerMap.get(e.layerId),leftLow:r.leftLow,leftUp:r.leftUp,rightLow:r.rightLow,rightUp:r.rightUp,id:e.globalIndex}};this.add2Body(e.layerId,i)})}getImages(){Bn.getAllItem().forEach(e=>{if(!this.needEncodeLayers.has(e.layerId))return;let r=e.model.box,i={PcbboxShape:{layer:this.allLayerMap.get(e.layerId),leftLow:r.leftLow,leftUp:r.leftUp,rightLow:r.rightLow,rightUp:r.rightUp,id:e.globalIndex}};this.add2Body(e.layerId,i)})}getPads(){Qt.getAllItem().forEach(e=>{if(e instanceof _i){if(ar(e.layerId)){let r=this.getShape(e.topType,e.topWidth,e.topHeight,e.topRatio,null),i=this.getShape(e.innerType,e.innerWidth,e.innerHeight,e.innerRatio,null),n=this.getShape(e.bottomType,e.bottomWidth,e.bottomHeight,e.bottomRatio,null),s=this.getHoleShape(e),a={PcbPad:{id:e.globalIndex,net:e.net,layer:this.allLayerMap.get(e.layerId),center:e.center,rotation:e.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.allLayerMap.get(e.layerId),top:r,inner:i,bot:n}},hole:s,pasteMaskEx:e.pasteExpansion,topSolderMaskEx:e.topSolderExpansion,bottomSolderMaskEx:e.bottomSolderExpansion,type:e.model.padType,designator:"",plated:e.plated,padRule:e.toPadRuleJson(),unuseLayers:this.getUnuseLayers(e.unusedInnerLayers)}};this.shapes.push(a)}else if(ao(e.layerId)){if(!this.needEncodeLayers.has(e.layerId))return;let r=this.getShape(e.topType,e.topWidth,e.topHeight,e.topRatio,null),i={PadHole:{type:0,size:0,length:0,rotation:e.rotation/Math.PI*180,offsetX:0,offsetY:0}},n={PcbPad:{id:e.globalIndex,net:e.net,layer:this.allLayerMap.get(e.layerId),center:e.center,rotation:e.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.allLayerMap.get(e.layerId),top:r,inner:null,bot:null}},hole:i,pasteMaskEx:e.pasteExpansion,topSolderMaskEx:e.topSolderExpansion,bottomSolderMaskEx:e.bottomSolderExpansion,type:e.model.padType,designator:"",plated:e.plated,padRule:e.toPadRuleJson(),unuseLayers:this.getUnuseLayers(e.unusedInnerLayers)}};this.add2Body(e.layerId,n)}else if(2==e.layerId){if(!this.needEncodeLayers.has(e.layerId))return;let r=this.getShape(e.bottomType,e.bottomWidth,e.bottomHeight,e.bottomRatio,null),i={PadHole:{type:0,size:0,length:0,rotation:e.rotation/Math.PI*180,offsetX:0,offsetY:0}},n={PcbPad:{id:e.globalIndex,net:e.net,layer:this.allLayerMap.get(e.layerId),center:e.center,rotation:e.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.allLayerMap.get(e.layerId),top:null,inner:null,bot:r}},hole:i,pasteMaskEx:e.pasteExpansion,topSolderMaskEx:e.topSolderExpansion,bottomSolderMaskEx:e.bottomSolderExpansion,designator:"",plated:e.plated,padRule:e.toPadRuleJson(),unuseLayers:this.getUnuseLayers(e.unusedInnerLayers),type:e.model.padType}};this.add2Body(e.layerId,n)}}else if(e instanceof sn){if(ar(e.layerId)){let r=this.getShape("POLYGON",0,0,0,e.primitives),i=this.getShape("POLYGON",0,0,0,e.primitives),n=this.getShape("POLYGON",0,0,0,e.primitives),s=this.getHoleShape(e),a={PcbPad:{id:e.globalIndex,net:e.net,layer:this.allLayerMap.get(e.layerId),center:e.center,rotation:e.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.allLayerMap.get(e.layerId),top:r,inner:i,bot:n}},hole:s,pasteMaskEx:e.pasteExpansion,topSolderMaskEx:e.topSolderExpansion,bottomSolderMaskEx:e.bottomSolderExpansion,designator:"",plated:e.plated,padRule:e.toPadRuleJson(),unuseLayers:this.getUnuseLayers(e.unusedInnerLayers)}};this.shapes.push(a)}else if(ao(e.layerId)){if(!this.needEncodeLayers.has(e.layerId))return;let r=this.getShape("POLYGON",0,0,0,e.primitives),i={PadHole:{type:0,size:0,length:0,rotation:e.rotation/Math.PI*180,offsetX:0,offsetY:0}},n={PcbPad:{id:e.globalIndex,net:e.net,layer:this.allLayerMap.get(e.layerId),center:e.center,rotation:e.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.allLayerMap.get(e.layerId),top:r,inner:null,bot:null}},hole:i,pasteMaskEx:e.pasteExpansion,topSolderMaskEx:e.topSolderExpansion,bottomSolderMaskEx:e.bottomSolderExpansion,designator:"",plated:e.plated,padRule:e.toPadRuleJson(),unuseLayers:this.getUnuseLayers(e.unusedInnerLayers)}};this.add2Body(e.layerId,n)}else if(2==e.layerId){if(!this.needEncodeLayers.has(e.layerId))return;let r=this.getShape("POLYGON",0,0,0,e.primitives),i={PadHole:{type:0,size:0,length:0,rotation:e.rotation/Math.PI*180,offsetX:0,offsetY:0}},n={PcbPad:{id:e.globalIndex,net:e.net,layer:this.allLayerMap.get(e.layerId),center:e.center,rotation:e.rotation/Math.PI*180,shapes:{PadShapes:{layer:this.allLayerMap.get(e.layerId),top:null,inner:null,bot:r}},hole:i,pasteMaskEx:e.pasteExpansion,topSolderMaskEx:e.topSolderExpansion,bottomSolderMaskEx:e.bottomSolderExpansion,designator:"",plated:e.plated,padRule:e.toPadRuleJson(),unuseLayers:this.getUnuseLayers(e.unusedInnerLayers)}};this.add2Body(e.layerId,n)}}})}getProfiles(){Kt.getAllItem().forEach(i=>{let n=i.getComponent();if(!(this.needEncodeLayers.has(i.layerId)||12==i.layerId||11==i.layerId))return;let s=this.getProfileShape(i.globalIndex,i.type,i.net,i.layerId,0,i.getMathGraphics(i.layerId,0),i.strokeWidth,n,n);i.layerId==12||i.layerId==11?this.shapes.push(s):this.add2Body(i.layerId,s)}),Xt.getAllItem().forEach(i=>{let n=i.getComponent();if(!(this.needEncodeLayers.has(i.layerId)||12==i.layerId||11==i.layerId))return;let s=this.getProfileShape(i.globalIndex,i.type,i.net,i.layerId,1,i.getMathGraphics(i.layerId,0),i.strokeWidth,n,n);i.layerId==12||i.layerId==11?this.shapes.push(s):this.add2Body(i.layerId,s)}),pt.getAllItem().forEach(i=>{if(!(this.needEncodeLayers.has(i.layerId)||12==i.layerId||11==i.layerId))return;let n=i.getComponent(),s=this.getProfileShape(i.globalIndex,i.type,i.net,i.layerId,2,i.getMathGraphics(i.layerId,0),i.strokeWidth,n,n,n);i.layerId==12||i.layerId==11?this.shapes.push(s):this.add2Body(i.layerId,s)})}getShape(t,e,r,i,n){let s;switch(t){case"ELLIPSE":s={PadShape:{type:0,xSize:e,ySize:r,cornerRadius:i*100,outline:null}};break;case"OVAL":s={PadShape:{type:3,xSize:e,ySize:r,cornerRadius:i*100,outline:null}};break;case"RECT":s={PadShape:{type:1,xSize:e,ySize:r,cornerRadius:i*100,outline:null}};break;case"POLYGON":s={PadShape:{type:4,xSize:e,ySize:r,cornerRadius:0,outline:I0([ge.build2(n)])}}}return s}getHoleShape(t){return t.holeShape=="ROUND"?{PadHole:{type:0,size:t.holeRadius*2,length:t.holeLength,rotation:t.holeRotation/Math.PI*180,offsetX:t.holeOffset.x,offsetY:t.holeOffset.y}}:{PadHole:{type:2,size:t.holeRadius*2,length:t.holeLength,rotation:t.holeRotation/Math.PI*180,offsetX:t.holeOffset.x,offsetY:t.holeOffset.y}}}getProfileShape(t,e,r,i,n,s,a,l,c,h){switch(e){case"Line":return i==11?{PcbBoardOutline:{id:t,type:n,outlines:lh(s)}}:{PcbLine:{id:t,net:r,layer:this.allLayerMap.get(i),type:n,width:a,outlines:lh(s)}};case"Copper Region":let u=re.getInstance().getCopperPlaneByNet(r),d=re.getInstance().getSafeSpacingByNet(r,13),p=re.getInstance().getRegion(t);p!=null?(p.copperPlane&&(u=re.getInstance().getCopperPlane(p.copperPlane)),d=re.getInstance().getSafeSpacing(p.safeCopperPlane||p.safeClearance)):u==null&&(u=re.getInstance().getDefaultCopperPlane()),d==null&&(d=re.getInstance().getDefaultSafeSpacing());let m=un.getOrder(t),g=this.needCopper(t),y=this.allLayerMap.get(i);return{PcbPolygonPour:{id:t,net:r,layer:y,method:this.getMethod(l),outlineClearance:d.getClearance(13,11,i),clearance:this.getClearanceMap(13,i,d),thermal:u.getSingleConnectMode(i)!=1,multiLayerThermal:u.getMultiConnectMode(i)!=1,keepIsland:l.keepIsland,pourIndex:m,needCopper:g,outlines:lh(s),coppered:[],name:l.name}};case"Prohibited Region":return{PcbProhibit:{id:t,layer:this.allLayerMap.get(i),type:n,copper:c.copper,track:c.track,device:c.device,plane:c.planzone,region:c.fill,outlines:lh(s)}};case"Fill Region":return l instanceof Zi?{BridgingCopper:{id:t,net:r,layer:this.allLayerMap.get(i),type:n,outlines:lh(s),networkList:l.networkList}}:{PcbRegion:{id:t,net:r,layer:this.allLayerMap.get(i),type:n,outlines:lh(s)}};case"Constraint Region":return{PcbConstraint:{id:t,net:r,layer:this.allLayerMap.get(i),type:n,outlines:lh(s)}};case"Board Outline":return{PcbBoardOutline:{id:t,type:n,outlines:lh(s)}};case"Slot Region":return{PcbSlot:{id:t,type:n,outlines:lh(s)}};case"TearDrop":return{PcbTearDrop:{id:t,net:r,layer:this.allLayerMap.get(i),outline:lh(s),connect:h.connects}}}}getMethod(t){switch(t.style){case"90grid":return ne.eq(t.clearance,0)?{SolidPourMethod:{neckThickness:t.gridLineWidth}}:{HatchedPourMethod:{gridWidth:t.gridLineWidth,gridClearance:t.clearance,angle:90}};case"45grid":return ne.eq(t.clearance,0)?{SolidPourMethod:{neckThickness:t.gridLineWidth}}:{HatchedPourMethod:{gridWidth:t.gridLineWidth,gridClearance:t.clearance,angle:45}};case"solid":return t.optimization?{SolidPourMethod:{neckThickness:t.optimizationValue}}:{SolidPourMethod:{neckThickness:0}};default:return{SolidPourMethod:{neckThickness:0}}}}getPlaneZone(){}};var iq=class extends xV{constructor(t,e){super(),e?this.needEncodeLayers=new Set(Pe.getAllPlaneLayerIds()):this.needEncodeLayers=new Set(t)}needCopper(t){return!1}getNetRule(){re.getInstance().getAllNets().forEach(i=>{let n=re.getInstance().getInnerPlane(i.innerPlane),s=this.getSafeSpaceing(i.safeSpacing,i.safeInnerPlane);for(let[a,l]of this.map){let c=this.rules[l],h=this.getClearanceMap(7,a,s);if(!n.isDefault||!s.isDefault){let u=n.getMultiConnectMode(a),d={PlaneRule:{Selector:{NetSelector:i.name},clearance:h,boardClearance:h[11],multiLayerThermal:n.getMultiConnectMode(a)!=1,multiLayerSpokeWidth:n.getMultiLineWidth(a),multiLayerSpokeSpace:n.getMultiLineClearance(a),multiLayerMode:u}};this.updateMaxClearance(n.getMultiLineClearance(a),l),c.push(d)}}});let e=re.getInstance().getDefaultInnerPlane(),r=re.getInstance().getDefaultSafeSpacing();for(let[i,n]of this.map){let s=this.rules[n],a=this.getClearanceMap(7,i,r),l=e.getMultiConnectMode(i),c={PlaneRule:{Selector:{AllSelector:{}},clearance:a,boardClearance:a[11],multiLayerThermal:l!=1,multiLayerSpokeWidth:e.getMultiLineWidth(i),multiLayerSpokeSpace:e.getMultiLineClearance(i),multiLayerMode:l}};this.updateMaxClearance(e.getMultiLineClearance(i),n),s.push(c)}}getBetweenNetworkRule(){re.getInstance().betweenNetRule.rule.forEach(e=>{if(!(!e.ruleName&&!e.safeCopperPlane&&!e.safeInnerPlane))for(let[r,i]of this.map){let n=this.rules[i],s=this.getSafeSpaceing(e.ruleName,e.safeInnerPlane),a=e.getNets(e.net1),l=e.getNets(e.net2),c=this.getClearanceMap(7,r,s);for(let h of a)for(let u of l){let d={PlaneRule:{Selector:{OrSelector:[h,u]},clearance:c,boardClearance:c[11]}};n.push(d)}}})}getRegionRule(){re.getInstance().getAllRegions().forEach(e=>{let r=u1(e.name);if(!r)return;let i=r.layerId,n=new Map;if(i==12?n=this.map:this.map.has(i)&&n.set(i,this.map.get(i)),n.size==0)return;if(e.innerPlane!=null){let a=re.getInstance().getInnerPlane(e.innerPlane);for(let[l,c]of n){let h=this.rules[c],u={PlaneRule:{Selector:{IdSelector:e.name,type:2},multiLayerThermal:a.getMultiConnectMode(l)!=1,multiLayerSpokeWidth:a.getMultiLineWidth(l),multiLayerSpokeSpace:a.getMultiLineClearance(l)}};this.updateMaxClearance(a.getMultiLineClearance(l),c),h.push(u)}}let s=this.getSafeSpaceing(e.safeClearance,e.safeInnerPlane);s!=null&&this.getClearanceRule(s,n,e.name,1)})}getClearanceRule(t,e,r,i){for(let[n,s]of e){let a=this.rules[s],l=this.getClearanceMap(7,n,t),c={PlaneRule:{Selector:{IdSelector:r,type:i},clearance:l,boardClearance:l[11]}};a.push(c)}}getOutline(){let t=new Array;if(Kt.getAllItem().forEach(n=>{(n.type=="Board Outline"||n.layerId==11)&&t.push(n)}),Xt.getAllItem().forEach(n=>{(n.type=="Board Outline"||n.layerId==11)&&t.push(n)}),pt.getAllItem().forEach(n=>{(n.type=="Board Outline"||n.layerId==11)&&t.push(n)}),t.length>0){let n=new _e,s=new Array;for(let c of t){let h=c.getMathGraphics();xe.addAll(s,h.primitives),n.ext1(c.buildBBox())}let a=n.build();return new $c(n.build(),2,.1,new Di(4),s).detect().items.filter(c=>!c.bbox().isContainsBBox(a))}else return[]}getPlaneZone(){let t=this.getOutline();t.length!=0&&this.map.forEach((e,r)=>{let i=this.allLayerMap.get(r),n=zn.layerMapSet[r];if(n!=null&&n.size>0)n.forEach(s=>{let a=re.getInstance().getInnerPlaneByNet(s.net),l=re.getInstance().getSafeSpacingByNet(s.net,14),c=re.getInstance().getRegion(s.globalIndex);c!=null&&(c.innerPlane&&(a=re.getInstance().getInnerPlane(c.innerPlane)),l=this.getSafeSpaceing(c.safeClearance,c.safeInnerPlane));let h=s.getOutline();Er(h,(p,m)=>m.bbox().area()-p.bbox().area(),0,h.length);let u=this.getClearanceMap(14,s.layerId,l),d={PcbPlaneZone:{id:s.globalIndex,net:s.net,layer:i,outlineClearance:u[11],clearance:u,thermal:a.getMultiConnectMode(s.layerId)!=1,outline:lh(h[0]),coppered:s.copperPath}};this.add2Body(r,d)});else{t.forEach(l=>{let c=re.getInstance().getNet("GND"),h,u="GND",d;c!=null?(h=re.getInstance().getInnerPlane(c.innerPlane),d=this.getSafeSpaceing(c.safeSpacing,c.safeInnerPlane)):(u="",h=re.getInstance().getDefaultInnerPlane(),d=re.getInstance().getDefaultSafeSpacing());let p=this.getClearanceMap(14,r,d),m={PcbPlaneZone:{net:u,layer:i,outlineClearance:p[11],clearance:p,thermal:h.getMultiConnectMode(r)!=1,outline:lh(l),coppered:[lh(l)]}};this.add2Body(r,m)});let s=this.map.get(r),a=this.body.get(s);a==null&&(a=[],this.body.set(s,a))}})}};var j6=class extends xV{constructor(e,r){super();this.coppers=new Map;let i;if(r)i=vR();else{i=[];for(let n of e){let s=u1(n);s!=null&&i.push(s)}}for(let n of i)this.coppers.set(n.globalIndex,n),this.needEncodeLayers.add(n.layerId)}needCopper(e){return this.coppers.has(e)}getNetRule(){re.getInstance().getAllNets().forEach(n=>{let s=this.getThermalRule(n.copperPlane),a=this.getSafeSpaceing(n.safeSpacing,n.safeCopperPlane);for(let[l,c]of this.map){let h=this.getClearanceMap(7,l,a),u=this.rules[c];if(!s.isDefault||!a.isDefault){let d=s.getMultiConnectMode(l),p=s.getSingleConnectMode(l),m={CopperRule:{Selector:{NetSelector:n.name},clearance:h,boardClearance:h[11],thermal:p!=1,spokeWidth:s.getSingleLineWidth(l),spokeSpace:s.getSingleLineClearance(l),multiLayerThermal:d!=1,multiLayerSpokeWidth:s.getMultiLineWidth(l),multiLayerSpokeSpace:s.getMultiLineClearance(l),trackConnect:s.getTrackConnect(l).toString(),singleLayerMode:p,multiLayerMode:d}};this.updateMaxClearance(s.getSingleLineClearance(l),c),this.updateMaxClearance(s.getMultiLineClearance(l),c),u.push(m)}}});let r=re.getInstance().getDefaultCopperPlane(),i=re.getInstance().getDefaultSafeSpacing();for(let[n,s]of this.map){let a=this.rules[s],l=this.getClearanceMap(7,n,i),c=r.getMultiConnectMode(n),h=r.getSingleConnectMode(n),u={CopperRule:{Selector:{AllSelector:{}},clearance:l,boardClearance:l[11],thermal:h!=1,spokeWidth:r.getSingleLineWidth(n),spokeSpace:r.getSingleLineClearance(n),multiLayerThermal:c!=1,multiLayerSpokeWidth:r.getMultiLineWidth(n),multiLayerSpokeSpace:r.getMultiLineClearance(n),trackConnect:r.getTrackConnect(n).toString(),singleLayerMode:h,multiLayerMode:c}};this.updateMaxClearance(r.getSingleLineClearance(n),s),this.updateMaxClearance(r.getMultiLineClearance(n),s),a.push(u)}}getBetweenNetworkRule(){re.getInstance().betweenNetRule.rule.forEach(r=>{if(!(!r.ruleName&&!r.safeCopperPlane&&!r.safeInnerPlane))for(let[i,n]of this.map){let s=this.rules[n],a=this.getSafeSpaceing(r.ruleName,r.safeCopperPlane),l=r.getNets(r.net1),c=r.getNets(r.net2),h=this.getClearanceMap(7,i,a);for(let u of l)for(let d of c){let p={CopperRule:{Selector:{OrSelector:[u,d]},clearance:h,boardClearance:h[11]}};s.push(p)}}})}getRegionRule(){re.getInstance().getAllRegions().forEach(r=>{let i=u1(r.name);if(!i)return;let n=i.layerId,s=new Map;if(n==12?s=this.map:this.map.has(n)&&s.set(n,this.map.get(n)),s.size!=0){if(r.copperPlane!=null){let a=this.getThermalRule(r.copperPlane);for(let[l,c]of s){let h=this.rules[c],u={CopperRule:{Selector:{IdSelector:r.name,type:2},thermal:a.getSingleConnectMode(l)!=1,spokeWidth:a.getSingleLineWidth(l),spokeSpace:a.getSingleLineClearance(l),multiLayerThermal:a.getMultiConnectMode(l)!=1,multiLayerSpokeWidth:a.getMultiLineWidth(l),multiLayerSpokeSpace:a.getMultiLineClearance(l),trackConnect:a.getTrackConnect(l).toString()}};this.updateMaxClearance(a.getSingleLineClearance(l),c),this.updateMaxClearance(a.getMultiLineClearance(l),c),h.push(u)}}if(r.safeClearance!=null){let a=this.getSafeSpaceing(r.safeClearance,r.safeCopperPlane);a!=null&&this.getClearanceRule(a,s,r.name,1)}}})}getThermalRule(e){return re.getInstance().getCopperPlane(e)}getClearanceRule(e,r,i,n){for(let[s,a]of r){let l=this.rules[a],c=this.getClearanceMap(7,s,e),h={CopperRule:{Selector:{IdSelector:i,type:n},clearance:c,boardClearance:c[11]}};l.push(h)}}};var X6=class{constructor(){this.tree=new JB(10)}bbox(){let t=kt.bbox();if(this.tree.size()>0){let e=this.tree.bbox();return new _e().ext1(e).ext1(t).build()}return t}search(t,e,r){let i=this.tree.search(t,e),n=kt.search(t,e);for(let s of n.getAllItems())i.push(s.model);return i}searchInside(t,e,r){let i=this.tree.searchInside(t,e),n=kt.searchInside(t,e);for(let s of n.getAllItems())i.push(s.model);return i}search4Types(t,e,r){let i=this.tree.search4Types(t,e,r),n=kt.search4Types(t,e,r);for(let s of n.getAllItems())i.push(s.model);return i}searchByType(t,e){let r=this.tree.searchByType(t,e),i=kt.searchByType(t,e);for(let n of i.getAllItems())r.push(n.model);return r}searchByTypes(t,e){let r=this.tree.searchByTypes(t,e),i=kt.searchByTypes(t,e);for(let n of i.getAllItems())r.push(n.model);return r}searchByLayer(t,e){let r=this.tree.searchByLayer(t,e),i=kt.searchByLayer(t,e);for(let n of i.getAllItems())r.push(n.model);return r}searchByLayers(t,e){let r=this.tree.searchByLayers(t,e),i=kt.searchByLayers(t,e);for(let n of i.getAllItems())r.push(n.model);return r}insert(t){this.tree.insert(t)}remove(t,e){this.tree.remove(t)}flushDeleteWhenNeed(){this.tree.flushDeleteWhenNeed()}flushWhenNeed(){this.tree.flushWhenNeed()}recycle(){this.tree.recycle()}};function Dze(o){R.getInstance().isactive&&23!=R.getInstance().doctype&&A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q());let t=R.getInstance().compiler;o.forEach(e=>{if(t.setTicket(),Ze.getInstance().getLayer(e).type=="PLANE"){let r=Sr.getInstance().encode("INNER",Array.from(Xo.getInstance().layerMapSet[e]));t.uploadLayerFill(e,r)}else t.deleteLayerFill(e)})}function Jle(o){R.getInstance().isactive&&23!=R.getInstance().doctype&&A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q());let t=R.getInstance().compiler;o.forEach(e=>{if(t.setTicket(),e){let r=Sr.getInstance().encode("POURED",Array.from(e.copperResultMap||[]));t.uploadPoured(e.globalIndex,r)}else t.deletePoured(e.globalIndex)})}function jA(o,t,e){if(!o)return null;var r=arguments.length,i,n,s,a;if(o.tagName){if(typeof t=="string")return r===2?o.getAttribute(t):(t.indexOf(":")>0?(n=t.substr(0,t.indexOf(":")),n in kO&&(s=t.substr(n.length+1),AS?o.setAttributeNS(kO[n],t,e):o.setAttributeNS(kO[n],s,e))):(o.setAttribute(t,e),(e===""||e===null||e===void 0)&&(t==="transform"&&o.setAttribute(t,""),o.removeAttribute(t))),o);for(i in t)Y0(t,i)&&(i.indexOf(":")>0?(n=i.substr(0,i.indexOf(":")),n in kO&&(s=i.substr(n.length+1),t[i]===""?o.hasAttributeNS(kO[n],s)&&o.removeAttributeNS(kO[n],s):AS?o.setAttributeNS(kO[n],i,t[i]):o.setAttributeNS(kO[n],s,t[i]))):t[i]===""?o.hasAttribute(i)&&(i==="transform"&&o.setAttribute(i,""),o.removeAttribute(i)):o.setAttribute(i,t[i]));return o}if(Array.isArray(o)||o instanceof NodeList||o instanceof HTMLCollection||kj&&typeof o.length=="number"){if(typeof t=="string"&&r==2)return o[0]?jA(o[0],t):null;if(r==2)for(a=0;a<o.length;a++)jA(o[a],t);else if(r>=3)for(a=0;a<o.length;a++)jA(o[a],t,e);return o}}function wze(o){if(window.frameElement)return wO.windowBridge.publish("showMessager",[o],Q());wO.messageBus.publish("showMessager",[o])}function dvt(o){return o?o.replace(/\.\w+$/,"")||o:""}function DV(o,t="UTF-8"){return new Promise((e,r)=>{var i=new FileReader,n=o.name,s=dvt(n);i.onload=function(a){e({name:n,title:s,content:a.target.result})},i.onerror=function(){r(`Failed to read file ${mTe(n)}`)},i.readAsText(o,t)})}var k3e=class o{static instance(){let t=o._instance;if(!t){o._instance=t=new o,t.options={};let e=document.createElement("input");t._input=e,jA(e,"type","file"),jA(e,"multiple",""),e.addEventListener("change",function(){if(t.options.onSelectFiles){var r=t._input.files;if(r.length)if(t.options.fileFilter){var i=[].slice.call(r,0).filter(function(n){return t.options.fileFilter(n)!==!1});t.options.onValidate&&t.options.onValidate(i.length>0),i.length?t.options.onSelectFiles(i):console.log("Files cannot pass fileFilter")}else t.options.onSelectFiles(r)}})}return t}config(t){return $Te(this.options,t),"multiple"in t&&(this._input.multiple=t.multiple),"accept"in t&&(this._input.accept=t.accept),this}openSelect(){return this._input.value="",this._input.click(),this}},RV=class{constructor(t,e,r=!1){let i=t.split(",");i=i.map(s=>s.trim().replace(".",""));let n={multiple:r,accept:t,fileFilter:function(s){return!t||t.indexOf(".")<0?!0:new RegExp(".("+i.join("|")+")$","i").test(s.name)},onValidate:function(s){s||wze({type:"warn",message:"Please select a "+i.join(", ")+" file."})},onSelectFiles:e};this.fs=k3e.instance().config(n),this.run()}run(){this.fs.openSelect()}};var nq=class extends WF{constructor(e="_self"){super();this.headFlag="";this._currentSegment=[{json:{},buff:""}];this._segmentBuff=new zF;this._startFlagNums=0;this.headFlag=e}feed(e){switch(e){case 40:this.on(0);break;case 41:this.on(2);break;default:this._segmentBuff.write(e);break}return!0}on(e){switch(e){case 0:this.startNewSegment();break;case 2:this.endSegment();break;default:break}return!0}startNewSegment(){let e=(this._segmentBuff.toString()||"").trim();e&&(this.getArrayLast(this._currentSegment).buff+=e),this._segmentBuff.clear(),this._currentSegment.push({json:{},buff:""}),this._startFlagNums++}getArrayLast(e){return e[e.length-1]}endSegment(){if(--this._startFlagNums<0)return this.parseError();let e=this._currentSegment.pop(),r=(e.buff+" "+this._segmentBuff.toString()||"").trim();this._segmentBuff.clear();let i=r.split(/\s+/);if(!i[0])return this.parseError();let n=e.json,s=i.shift();n[this.headFlag]=i;let a=this.getArrayLast(this._currentSegment).json;if(!a)return this.parseError();l2(a,s).push(n)}initState(){this._currentSegment.length=0,this._currentSegment.push({json:{},buff:""}),this._segmentBuff.clear(),this._startFlagNums=0}finish(){if(this._startFlagNums!=0)return this.initState(),this.parseError();this.data=this._currentSegment.shift().json,this.initState()}parseError(e){throw new Error(e||this._segmentBuff.toString())}};var Lze,pvt=(Lze=document.querySelector('meta[name="editorMainVersion"]'))==null?void 0:Lze.getAttribute("content"),fT="  ",Fh="    ",wn=`
`,O1="      ",B3e="        ";var Mze=0;var fr=class fr{static getAllTexts(){let t=ri.getAllItem(),e=[];return t.forEach(r=>{r.getParent()==null&&r.isVisible&&r.value&&(r.layerId==1||r.layerId==2)&&e.push(r)}),e}static async initData(){fr.padStackCache=[],fr.padStackMap={},fr.layers=fr.config.layers.length?fr.config.layers:[1],fr.layers=fr.layers.filter(n=>{if(n!=12)return n}),fr.PCBOutline=fr.getBoardBBox(),await Qle(.2),fr.skipNetArr=fr.config.skipNets.split(" ")||[],fr.pads=rD();var t=[];if(fr.pads.forEach(function(n){n instanceof _i&&(ar(n.layerId)?(!n.topWidth||!n.topHeight||!n.bottomWidth||!n.bottomHeight||!n.innerWidth||!n.innerHeight)&&t.push(n):ao(n.layerId)?(!n.topWidth||!n.topHeight)&&t.push(n):vv(n.layerId)&&(!n.bottomWidth||!n.bottomHeight)&&t.push(n))}),t.length>0){var e="";let n=[];return t.forEach(function(a){e+='<p><b class="i18n">ID:</b>'+a.globalIndex+' <b class="i18n">Net:</b>'+a.net+' <b class="i18n">Location:</b>('+gn(a.model.center.x,2)+","+gn(a.model.center.y,2)+")</p>",n.push({text:a.globalIndex,attr:{id:a.globalIndex,pcbid:R.getInstance().tabId}}),n.push(", ")}),n.pop(),A.windowBridge.publish("ui/toastMsg",{type:"error",msg:"Export DSN failed! Found abnormal pad(s) data, please modify the pad width and height to fix, the pads(s) please refer at the log.",bottomBarMsg:{type:"error",msg:["<span class='i18n'>Export DSN failed! Found abnormal pad(s) data, please modify the pad width and height to fix:</span>",...n]},timer:3},Q()),!1}await Qle(.4),fr.vias=Wr.getAllItem(),fr.tracks=pr.getAllItem(),fr.pads.push(...fr.getAllTexts()),fr.vias.forEach(function(n){fr.pads&&(!n.net||!n.type)&&fr.pads.push(n)}),await Qle(.6);let r=fr.PCBOutline?new ht(fr.PCBOutline.minX,fr.PCBOutline.maxX,fr.PCBOutline.minY,fr.PCBOutline.maxY):null,i=["Prohibited Region","Slot Region","Fill Region","Line"];return new Array().concat(Xt.getAllItem(),Kt.getAllItem(),pt.getAllItem()).forEach(n=>{var h;let{type:s,layerId:a,strokeWidth:l}=n,c=n.buildBBox();if(!(!((h=Pe.getLayer(a))!=null&&h.isSignalLayer())&&!ar(a)||c&&r&&!c.isIntersect(r))&&i.includes(s)){let u=n.getComponent();if(s==="Prohibited Region"&&u instanceof Fu&&!u.track||!n.getMathGraphics(void 0,l/2))return;fr.pads&&fr.pads.push(n)}}),!0}static jointPoints(t,e){var r=0,i=0,n=[];for(e||(e={x:0,y:0}),r=0,i=t.length;r<i;r++)n.push(Xu((t[r].x-e.x)*fr.scale)),n.push(Xu((t[r].y-e.y)*fr.scale));return n.join(" ")}static jointPoints1(t,e){var r=0,i=0,n=[];for(e||(e={x:0,y:0}),r=0,i=t.length;r<i;r++)n.push(Xu((t[r][0]-e.x)*fr.scale)),n.push(Xu((t[r][1]-e.y)*fr.scale));return n.join(" ")}static initRouterConfig(t){fr.config=t||{},fr.config.layers=Pe.getAllSignalLayerIds(),console.log(re.getInstance().getDefaultRadiusPhysics()),fr.config.clearance=re.getInstance().getDefaultSafeSpacing().getItemsMaxClearance([0,1,2,3,4,5],[0,1,2,3,4,5]),fr.config.smdClearance=fr.config.clearance,fr.config.viaDiameter=re.getInstance().getViaDiameter(),fr.config.viaHoleD=re.getInstance().getViaHoleD(),fr.config.width=re.getInstance().getTrackWidth(),fr.config.netClass=re.getInstance().getSpecctraNetClass(),fr.config.skipNets=""}static async exportDSN(t,e){try{return await fr.exportDSN1(t,e)}catch(r){console.error(r);let i="Error";g0({type:"error",message:i,shortMsg:i})}}static async exportDSN1(t,e){let r="exportDSN-time";if(Cn(r),fr.initRouterConfig(t),!await fr.initData())return Xi(r),!1;var n=function(d){return Xu((d+fr.adjustment)*fr.scale)},s=n(fr.config.width),a=n(fr.config.clearance),l=n(fr.config.smdClearance),c=fr.createLibrary(),h=fr.createStructure(a,s,l);if(!h||!fr.pads.length)return A.windowBridge.publish("message",{type:"error",message:"Board outlines are not closed."},Q()),Xi(r),!1;await Qle(.8);let u=`(PCB "${e}"`+wn+fT+"(parser"+wn+Fh+'(host_cad "EasyEDA Pro")'+wn+Fh+`(host_version "${pvt}")`+wn+fT+")"+wn+fT+"(resolution mil "+fr.resolution+")"+wn+h+wn+fr.createPlace()+wn+c+wn+fr.createNetwork()+wn+fr.createWiring()+")"+wn;return fr.net2Pads={},fr.pads=[],Xi(r),u}static async saveFile(t){let e=(await A.windowBridge.rpcCall("getTabTitle",void 0,Q())).message,r=new Date,i=r.getFullYear()+"-"+(r.getMonth()+1)+"-"+r.getDate();xd.downloadFileASCII("Autorouter_"+e+"_"+i+".dsn",t)}static createPlace(){var t=fT+"(placement"+wn;return t+=fr.createComponent(),t+=fT+")",t}static createComponent(){var t=Fh+"(component u1"+wn;return t+=O1+"(place u1 0 0 front 0"+wn,t+=O1+")"+wn,t+=Fh+")"+wn,t}static createLibrary(){var t=fr.createAllPadStack(),e=fT+"(library"+wn;return e+=fr.createImage()+wn,e+=fr.createViaStack()+wn,e+=t+wn,e+=fT+")",e}static createImage(){var t=Fh+"(image u1"+wn;let e=fr.PCBOutline;return fr.pads.forEach(function(r){if(r.layerId==12||fr.layers.indexOf(+r.layerId)!=-1){var i=fr.remove_e(r.globalIndex);let a;r instanceof Le||r instanceof Ue?a=r.center:r instanceof lr?a=r.model.box.center:(r instanceof rr||r instanceof Pr||r instanceof lt)&&(a=r.buildBBox().center());var n=" "+Xu((a.x-e.x)*fr.scale)+" "+Xu((a.y-e.y)*fr.scale),s=fr.padStackMap[i];s&&(t+=O1+"(pin p"+s+" "+i+n+")"+wn)}}),t+=Fh+")"+wn,t}static createAllPadStack(){var t=[];return fr.pads.forEach(function(e){if(e.layerId==12||fr.layers.indexOf(+e.layerId)!=-1){var r=fr.createPadStack(e);r&&t.push(r)}}),t.join(wn)}static createPadStack(t){var e=fr.grap*fr.scale;e=Xu(e);var r=fr.remove_e(t.globalIndex),i=Fh+"(padstack p"+r+wn,n="",s=" 0 0";if(t instanceof _i?t.layerId==12?fr.layers.forEach(function(u){l(t,u)}):l(t,t.layerId):t instanceof sn?t.layerId==12?fr.layers.forEach(function(u){h(t.getMathGraphics(u).primitives,t.center,u)}):h(t.getMathGraphics(t.layerId).primitives,t.center,t.layerId):t instanceof lr?h(t.getMathGraphics(t.layerId).primitives,t.model.box.center,t.layerId):t instanceof Ue?fr.layers.forEach(function(u){c(t.radius*2,u)}):(t instanceof rr||t instanceof Pr||t instanceof lt)&&(t.layerId==12?fr.layers.forEach(function(u){t instanceof Pr?c(t.radius*2,u):h(t.getMathGraphics(u).primitives,t.buildBBox().center(),u)}):t instanceof Pr?c(t.radius*2,t.layerId):h(t.getMathGraphics(t.layerId).primitives,t.buildBBox().center(),t.layerId)),!n)return"";var a=fr.padStackCache[n];if(a)return fr.padStackMap[r]=a,"";return fr.padStackCache[n]=r,fr.padStackMap[r]=r,i+n+Fh+")";function l(u,d){d==1?p(u,u.topType,d):d==2?p(u,u.bottomType,d):15<=d&&d<=46&&p(u,u.innerType,d);function p(m,g,y){let b=m.getMathGraphics(y);if(g=="ELLIPSE"){let P=b.bbox().maxX-b.bbox().minX;c(P,y)}else["OVAL","RECT"].includes(g)&&h(m.getMathGraphics(y).primitives,m.center,y)}}function c(u,d){n+=O1+"(shape(circle "+Bz[d]+" "+Xu(u*fr.scale)+s+"))"+wn}function h(u,d,p){let m=[];for(let y=0;y<u.length;y++)u[y]instanceof q?m.push(...u[y].points(.01)):u[y]instanceof M&&m.push(...u[y].points(2));if(m.length<=2)return;let g=fr.jointPoints(m,d);n+=O1+"(shape(polygon "+Bz[p]+" "+e+" "+g+"))"+wn}}static netClass(){var t="";return typeof fr.config.netClass=="object"&&fr.config.netClass.forEach(function(e){var r=e.width,i=e.clearance;r=Xu(r*fr.scale),i=Xu(i*fr.scale);var n=fr.viaNetMap&&fr.viaNetMap[e.net],s=wn+B3e+"(use_via "+n+")",a=n?O1+"(circuit "+s+wn+O1+")"+wn:"";t+=Fh+"(class "+e.net+` '${e.net}'`+wn+a+O1+"(rule "+wn+B3e+"(width "+r+")"+wn+B3e+"(clearance "+i+")"+wn+O1+")"+wn+Fh+")"+wn}),t}static netSpecialCharReplace(t){if(!t)return t;for(let r in fr.specailCharEscapeMap)t.indexOf(r)>=0&&(t=t.replace(r,fr.specailCharEscapeMap[r]));let e=new RegExp("[^\0-\x7F]","g");return e.test(t)&&(t=t.replace(e,function(r){return"%U"+r.codePointAt(0).toString(16)+"%"})),t}static createNetwork(){var t=Ye.getAllNets(),e="",r=[],i,n,s=fr.skipNetArr;let a=fr.pads.length;for(let l=0;l<a;l++){let c=fr.pads[l];if(!("net"in c))continue;let h=c.net;fr.net2Pads[h]?fr.net2Pads[h].push(c):fr.net2Pads[h]=[c]}for(let l=0;l<t.length;l++){let c=t[l];c&&(n=fr.netSpecialCharReplace(c),i=fr.connectPins(c),i&&(e=Fh+"(net "+n+wn,e+=O1+"(pins "+i+")"+wn,s.indexOf(c)!=-1&&(e+=O1+"(type protect)"+wn),e+=Fh+")"),r.push(e))}return fT+"(network"+wn+r.join(wn)+wn+fr.netClass()+fT+")"+wn}static connectPins(t){var e=[];let r=fr.net2Pads[t];if(r)for(let i=0;i<r.length;i++){let n=r[i];n.net==t&&(n.layerId==12||fr.layers.indexOf(+n.layerId)!=-1)&&e.push("u1-"+fr.remove_e(n.globalIndex))}return e.join(" ")}static createWiring(){function t(i){var n=Fh+"(wire(path "+i.layerId+" "+Xu(fr.scale*i.width)+" "+fr.jointPoints([i.start,i.end],fr.PCBOutline)+" )"+wn;return n+=O1+"(net "+i.net+")"+wn,n+=O1+"(type protect)"+wn,n+=Fh+")"+wn,n}function e(i){var n="via"+fr.viaStack[Xu(i.radius*2)],s=Fh+"(via "+n+" "+fr.jointPoints([i.center],fr.PCBOutline)+wn+O1+"(net "+i.net+")"+wn+O1+"(type protect)"+wn+Fh+")"+wn;return s}var r=fT+"(wiring"+wn;return fr.tracks.forEach(function(i){i.length>=1&&fr.layers.indexOf(+i.layerId)!=-1&&(r+=t(i))}),fr.vias.forEach(function(i){i.net&&!i.locked&&(r+=e(i))}),r+=fT+")"+wn,r}static remove_e(t){return(t||"").replace("e","")}static createViaStack(){var t=fr.config.viaDiameter;t=Xu(t);var e="",r=0;fr.viaStack[t]=r,r++;for(var i=0,n=fr.vias.length;i<n;i++)typeof fr.viaStack[Xu(fr.vias[i].radius*2)]>"u"&&(fr.viaStack[Xu(fr.vias[i].radius*2)]=r++);fr.viaNetMap={},(function(l){for(var c=fr.viaNetMap,h=0;h<l.netClass.length;h++){var u=l.netClass[h],d=Xu(u.viaHoleDiameter);if(Y0(fr.viaStack,d)){c[u.net]="via"+fr.viaStack[d];continue}c[u.net]="via"+r,fr.viaStack[d]=r++}return c})(fr.config);function s(l){var c="";return fr.layers.forEach(function(h){c+=O1+"(shape(circle "+Bz[h]+" "+Xu(fr.scale*l)+"))"+wn}),c}r=0,fr.padStackVia=[];for(var a in fr.viaStack)Y0(fr.viaStack,a)&&(fr.padStackVia.push("via"+fr.viaStack[a]),e+=Fh+"(padstack via"+fr.viaStack[a]+wn+s(a)+Fh+")"+wn);return e}static getBoardBBox(){let t=Au();if(t.length<1)return{minX:0,minY:0,maxX:0,maxY:0,x:0,y:0};let e={};for(let r=0;r<t.length;r++){let i=t[r].getMathGraphics().bbox();Object.keys(e).length<1?e={minX:i.minX,minY:i.minY,maxX:i.maxX,maxY:i.maxY}:(e.minX=Math.min(e.minX,i.minX),e.minY=Math.min(e.minY,i.minY),e.maxX=Math.max(e.maxX,i.maxX),e.maxY=Math.max(e.maxY,i.maxY))}return{...e,x:e.minX,y:e.minY}}static _getBoardOutlinePointStr(){let t=Au(),e=null;if(!t||t.length===0){let c="Please draw a board outline first!";g0({type:"error",message:c,shortMsg:c});return}else if(t.length>1){let c=new _e,h=[];t.forEach(d=>{c.ext1(d.buildBBox()),h.push(...d.getMathGraphics().primitives)});let u=new $c(c.build1(),2,1.2,new Di(2),h).detect();if(u.items.length===1)e=u.items[0];else{let d="Found multiple board outlines, please change the extra board outlines as solt regions or delete them. All board outlines",p=[d+":"];t.forEach((m,g)=>{p.push(g==0?" ":", "),p.push({attr:{id:m.globalIndex,pcbid:R.getInstance().tabId},text:m.globalIndex})}),g0({type:"error",message:p,shortMsg:d});return}}let r=10,i=39.37,n=S.ORIGIN,s=nn.convert(1,r,r),a=Qe.translate(-n.x*s,-n.y*s).scale(s),l=Kb.autoPangolinPoints(e||t[0].getMathGraphics(),a);return fr.jointPoints1(l,fr.PCBOutline)}static createStructure(t,e,r){var i=fr._getBoardOutlinePointStr();if(!i)return console.error("no broad outline in Specctra"),!1;var n=Fh+"(boundary(path signal 0 "+i+" )"+wn+Fh+")"+wn;console.log(Kb.getConfig());function s(){var c="";return fr.layers.forEach(function(h){c+=Fh+"(layer "+Bz[h]+wn+O1+"(type signal)"+wn+Fh+")"+wn}),c}var a=fr.grid;a=nn.convert(a,1,10);var l=fT+"(structure"+wn+n+Fh+"(via "+(fr.padStackVia||["via0"]).join(" ")+wn+Fh+")"+wn+Fh+"(grid via   "+a+")"+wn+Fh+"(grid wire   "+a+")"+wn+Fh+"(grid place   "+a+")"+wn+Fh+"(rule(clear "+t+"))"+wn+Fh+"(rule(clear "+r+" (type default_smd)))"+wn+Fh+"(rule(clear "+r+" (type smd_smd)))"+wn+Fh+"(rule(width "+e+"))"+wn+s()+fT+")"+wn;return l}static isOKPCBForAutorouter(){var t=fr.PCBOutline;if(Math.abs(t.minX-t.maxX)<1||Math.abs(t.minY-t.maxY)<1)return!1;function e(n){return n.x>t.minX&&n.x<t.maxX&&n.y>t.minY&&n.y<t.maxY}for(var r=rD(),i=0;i<r.length;i++)if(!e(r[i].center))return!1;return!0}static exportPins(){var t=Ye.getAllNets(),e=[],r=fr.skipNetArr;for(let i=0;i<t.length;i++){let n=t[i];r.indexOf(n)==-1&&fr.pads.forEach(function(s){"net"in s&&s.net==n&&(s.layerId==12||fr.layers.indexOf(+s.layerId)!=-1)&&e.push(fr.remove_e(s.globalIndex))})}return e}};fr.resolution=1e3,fr.scale=10,fr.grap=.01,fr.grid=2.5,fr.adjustment=.005,fr.specailCharEscapeMap={"&":"&AMP;","(":"&LP;",")":"&GP;","{":"&LOT;","}":"&ROT;","'":"&APS;","`":"&DOT;",'"':"&DBQ;","|":"&ORO;"},fr.specailCharReverseEscapeMap={},fr.layers=[],fr.skipNetArr=[],fr.net2Pads={},fr.viaStack={},fr.padStackCache={},fr.padStackMap={},fr.viaNetMap={},fr.importSession=(function(){var t=!1,e=0,r=0,i=[],n=[],s=[],a=null;function l(m,g,y,b){e=0,r=setTimeout(function(){c(m,g,y,b)},0)}function c(m,g,y,b){if(r=0,g||g===0){var P=[];for(var T in m)m[T].vias&&(P=P.concat(m[T].vias));var I=fr.exportPins().length,C=I-g,E=I===0?"":" ( "+(C/I*100).toFixed(2)+"% )",O=C+E}t=!1,a=null}function h(m,g,y,b){e=setTimeout(function(){l(m,g,y,b)},0)}function u(m){var g;for(var y in m);}function d(m){a&&u(a);var g={},y=(function(H){var z={};z.viaRadius=Xu(H.viaDiameter/2),z.viaHoleRadius=Xu(H.viaHoleD/2),z.trackWidth=Xu(H.width),z.netTrackWidth={};for(var V=0;V<H.netClass.length;V++){var W=H.netClass[V];z.netTrackWidth[W.net]=Xu(W.width),W.net&&(g[W.net]={viaRadius:Xu(W.viaHoleDiameter/2),viaHoleRadius:Xu(W.viaHoleD/2)})}return z})(fr.config),b=function(H){return H&&y.netTrackWidth[H]||y.trackWidth},P={},T=new RegExp("%U[0-9a-f]{1,5}%","g");let I=new hi;I.createGroup("Auto Router");var C=fr.PCBOutline;for(var E in m)if(Y0(m,E)){var O=m[E].net,_=m[E].wires||{},x=m[E].vias||{};if(!O||fr.skipNetArr.indexOf(O)!=-1)continue;for(var v in fr.specailCharReverseEscapeMap)O.indexOf(v)!==-1&&(O=O.replace(v,fr.specailCharReverseEscapeMap[v]));T.test(O)&&(O=O.replace(T,function(H){var z,V=H.replace("%","").replace("U","");try{z=String.fromCodePoint(parseInt(V,16))}catch{z=""}return z}));for(var D in _)if(Y0(_,D)){let H=_[D];for(let z=3;z<H.points.length;z=z+2){let V=pr.addTrack(H.layerid,new S(H.points[z-3]+C.x,H.points[z-2]+C.y),new S(H.points[z-1]+C.x,H.points[z]+C.y),b(O),!1,O);I.addCommand4Item(V,"add")}}for(D in x)if(Y0(x,D)){console.log(x[D]);var w=x[D],F=g[O]||g[""];if(!F)continue;let H=ut.getDefaultVia(new S(w.x+C.x,w.y+C.y),F.viaRadius,F.viaHoleRadius);H.net=O,I.addCommand4Item(H,"add")}}I.execute(),a=m}function p(m,g,y,b,P,T){if(t){if(g=="start"){A.windowBridge.publish("message",{type:"error",message:"Cannot start again before previous activity is stopped"},Q());return}}else{if(g!="start")return;t=!0,a=null}s.length=0,fr.initRouterConfig(),fr.PCBOutline=fr.getBoardBBox();var I=typeof m=="string"&&m!==""?JSON.parse(m):m;I&&(d(I),h(m,b,P,T)),g=="end"&&h(m,b,P,T)}return p})();var VS=fr;(function(){var o=VS.specailCharEscapeMap,t="";for(var e in o){if(e=="&"){t=o[e];continue}VS.specailCharReverseEscapeMap[o[e]]=e}VS.specailCharReverseEscapeMap[t]="&"})();function Nze(){new RV(".ses",function(o){let t=o[0];DV(t).then(e=>{let r=e.name||e.title||"";var i="_self",n=new nq(i).parse(e.content),s=n.data||{},a=P(s,"session"),l=P(a,"routes");if(!l){A.windowBridge.publish("message",{type:"error",message:"Invalid file format"},Q());return}var c=P(l,"resolution"),h=c&&c[i]&&c[i][0];Gz(h)||(h=1);var u=parseFloat(c&&c[i]&&c[i][1])||1,p=new dt().conversion(h,"mil",1)*u*10,m=P(l,"network_out"),g=m&&m.net||[],y={a:"routingResult",data:{},complete:1,inCompleteNetNum:0};let b=new q4(new Di(1),[]);g.forEach(function(I,C){var E=(I[i]||[]).join("");if(!E){console.warn("network was empty!",I);return}E.startsWith('"')&&E[E.length-1]=='"'&&(E=E.slice(1,E.length-1));var O={net:E,vias:[],wires:[]},_=I.via||[];_.forEach(function(v){v=v[i]||[],!(v.length<3)&&O.vias.push({x:T(v[1],p),y:T(v[2],p)})});var x=I.wire||[];x.forEach(function(v){var D=(P(v,"path")||{})[i];if(!(!D||D.length<6)){var w={layerid:1,width:10,points:[]};D.forEach(function(F,H){H==0?w.layerid=+Bze(F.toString().replace(/"/g,""),b)||1:H==1?w.width=T(F,p):w.points.push(T(F,p))}),O.wires.push(w)}}),y.data[C]=O}),VS.importSession(y.data,"start","","",Mze);function P(I,C,E){return I&&I[C]&&I[C][E||0]}function T(I,C){return Xu(parseFloat(I)/C)}},function(e){A.messageBus.publish("message",{type:"error",message:e})})})}function kze(o){return new Promise((t,e)=>{DV(o).then(r=>{let i=r.name||r.title||"";var n="_self",s=new nq(n).parse(r.content),a=s.data||{},l=T(a,"session"),c=T(l,"routes");if(!c){A.windowBridge.publish("message",{type:"error",message:"Invalid file format"},Q()),t(!1);return}var h=T(c,"resolution"),u=h&&h[n]&&h[n][0];Gz(u)||(u=1);var d=parseFloat(h&&h[n]&&h[n][1])||1,m=new dt().conversion(u,"mil",1)*d*10,g=T(c,"network_out"),y=g&&g.net||[],b={a:"routingResult",data:{},complete:1,inCompleteNetNum:0};let P=new q4(new Di(1),[]);y.forEach(function(C,E){var O=(C[n]||[]).join("");if(!O){console.warn("network was empty!",C);return}O.startsWith('"')&&O[O.length-1]=='"'&&(O=O.slice(1,O.length-1));var _={net:O,vias:[],wires:[]},x=C.via||[];x.forEach(function(D){D=D[n]||[],!(D.length<3)&&_.vias.push({x:I(D[1],m),y:I(D[2],m)})});var v=C.wire||[];v.forEach(function(D){var w=(T(D,"path")||{})[n];if(!(!w||w.length<6)){var F={layerid:1,width:10,points:[]};w.forEach(function(H,z){z==0?F.layerid=+Bze(H.toString().replace(/"/g,""),P)||1:z==1?F.width=I(H,m):F.points.push(I(H,m))}),_.wires.push(F)}}),b.data[E]=_}),VS.importSession(b.data,"start","","",Mze),t(!0);function T(C,E,O){return C&&C[E]&&C[E][O||0]}function I(C,E){return Xu(parseFloat(C)/E)}},function(r){A.messageBus.publish("message",{type:"error",message:r})})})}function Qle(o){return new Promise(t=>{A.publish("progressUpdate",[o,"exportAutoRouterDSN"],Q()),setTimeout(()=>{t(!0)},20)})}function Bze(o,t){let e=t.iterator();for(;e.hasNext();){let r=e.next();if(r.name===o)return r.id}return o}var Fze=o=>{let t=ze.getSelects();switch(o){case"boolIntersection":case"boolAggregate":{yvt(t,o);break}case"boolSubtraction":{bvt(t);break}case"boolExclusive":{Pvt(t);break}case"boolSplit":{let{newPolygons:e,groupCommand:r}=wV(t);r.length>0&&(he.publish("autoFill",""),he.publish("updateRtree",""),qe.executeCommand(r),he.publish("onlySelect",e));break}}};function wV(o,t){let e=[];t=t||new De("Execute Bool Split");let r=o.filter(s=>s instanceof lt&&["Fill Region","FPC Stiffener"].includes(s.type)&&s.isComplexPolygon()),i=new Po,n=OA(r);for(let s=0;s<r.length;s++){let a=r[s],l=a instanceof Le?0:a.strokeWidth;ece(a).items.slice(1).map(d=>(d=nh(d)?d.reverse():d,i.plToShapes(d,a.layerId,l))).forEach((d,p)=>{let m=pt.addPolygon(a.type,a.layerId,[d],a.strokeWidth,a.net,!1);if(a.type=="FPC Stiffener"||a.type=="Fill Region"&&n){let y=JSON.stringify(a.getComponent());new bl(y,m.type).rebuildComponent(m)}let g=Ce.dispatch(m,"add");t.addCommand(g),e.push(m),m.click()});let u=Ce.dispatch(a,"modify");t.addCommand(u),a.keepOutline(),he.publish("hasModifyPcbItem",a),a.click(),e.push(a)}return{newPolygons:e,groupCommand:t}}function fvt(o){let t={Pad:{items:new Array,is:e=>e instanceof Le},"Board Outline":{items:new Array,is:e=>e instanceof He&&e.type=="Board Outline"},"Copper Region":{items:new Array,is:e=>e instanceof He&&e.type=="Copper Region"},"Fill Region":{items:new Array,is:e=>e instanceof He&&e.type=="Fill Region"},"Slot Region":{items:new Array,is:e=>e instanceof He&&e.type=="Slot Region"},"Prohibited Region":{items:new Array,is:e=>e instanceof He&&e.type=="Prohibited Region"},"FPC Stiffener":{items:new Array,is:e=>e instanceof He&&e.type=="FPC Stiffener"},"Constraint Region":{items:new Array,is:e=>e instanceof He&&e.type=="Constraint Region"}};return Gze(o,t)}function Vze(o){let t={"Fill Region":{items:[],is:e=>e instanceof He&&e.type=="Fill Region"},"FPC Stiffener":{items:[],is:e=>e instanceof He&&e.type=="FPC Stiffener"}};return Gze(o,t)}function Gze(o,t){for(let r of o)if(!(r.getParent()&&r.getParent()instanceof ke))for(let i in t)t[i].is(r)&&t[i].items.push(r);let e=new Array;for(let r in t){let i=t[r].items;if(i.length>=2){let n={};for(let s of i)n[s.layerId]||(n[s.layerId]=[]),n[s.layerId].push(s);e.push(...Object.values(n).filter(s=>s.length>=2))}}return e}function mvt(o){let t=o[0];for(let e=1;e<o.length;e++)t.bbox().area()<o[e].bbox().area()&&(t=o[e]);for(let e=0;e<o.length;e++){if(o[e]==t)continue;let{relation:r}=new Xl(t,o[e],0);if(r!=1)return null}return t}function gvt(o){let t=o.map(i=>{let n=ece(i);return n instanceof Bt?n:new Bt([nh(n)?n.reverse():n])}),e=mvt(t);if(e==null){let i=0,n=o[0];for(let s=1;s<o.length;s++){let a=o[s],l=ze.selectionOrder.get(a.globalIndex),c=ze.selectionOrder.get(n.globalIndex);(l<c||l==c&&a.zIndex<n.zIndex)&&(i=s,n=a)}e=t[i]}let r=e.getOutMostPolyline();return[[r],t.map(i=>i.items).flat(1).filter(i=>i!=r)]}function F3e(o){if(!o.length)return;let t=o.map(r=>r.buildBBox().area()),e=t.reduce((r,i,n)=>i>t[r]?n:r,0);return o[e]}function yvt(o,t){let e=[],r=new De("Execute Boolean Operation"),i=new Ec,n=fvt(o),s=[];for(let a of n){let l=F3e(a),c=OA(a),h=a.map(d=>{let p=ece(d);return p instanceof Bt?p:new Bt([nh(p)?p.reverse():p])}),u;t=="boolIntersection"?u=i.getIntersectionForSingle(h.map(d=>d.items)):(u=i.getUnionForSingle(h.map(d=>d.items)),["Fill Region","FPC Stiffener"].includes(a[0].type)||(u=u.map(d=>d.items.length>1?new Bt([d.getOutMostPolyline()]):d))),u.forEach(d=>{let p;if(l instanceof Le){let g=d.items[0],y=new Wf(g.primitives);p=Qt.addPolygonPad(l.layerId,l.num,y.center,0,g,l.net,!1,l.expansionType,l.pasteExpansion,l.topSolderExpansion,l.bottomSolderExpansion,l.unusedInnerLayers,l.plated,y.high*.6,y.high*.3,"ROUND",0,ut.defalutPad.holeOffset,l.padRule)}else if(p=new Mh().create4PlGrp(l.type,l.layerId,d,l.strokeWidth,l.net,!1),l.type=="FPC Stiffener"||l.type=="Fill Region"&&c){let y=JSON.stringify(l.getComponent());new bl(y,p.type).rebuildComponent(p)}else if(l.type=="Copper Region"&&re.getInstance().getRegion(a[0].globalIndex)){let b=re.getInstance().addRegionSelector(p.globalIndex),P=re.getInstance().getSafeSpacingByNet(a[0].net,13);b.safeClearance=P.name,sy.getInstance().set("Main"),Pp.getInstance().publish("modify",P)}p instanceof He&&p.type=="Copper Region"&&s.push(p.globalIndex),un.addOrder(p,r),e.push(p);let m=Ce.dispatch(p,"add");r.addCommand(m)}),a.forEach(d=>{r.addCommand(Ce.dispatch(d,"delete")),he.publish("hasModifyPcbItem",d),d.remove(),he.publish("delete",d)})}he.publish("rebuildConnectCopper",s),he.publish("autoFill",""),he.publish("updateRtree",""),he.publish("updateFrame",""),r.length>0&&(qe.executeCommand(r),he.publish("onlySelect",e))}function bvt(o){let t=[],e=new De("Execute Boolean Operation"),r=new Ec,i=Vze(o);for(let n of i){let s=r.getSubtraction(...gvt(n)),a=OA(n),l=F3e(n),c=new Mh;s.forEach(h=>{let u=c.create4PlGrp(l.type,l.layerId,h,l.strokeWidth,l.net,!1);if(l.type=="FPC Stiffener"||l.type=="Fill Region"&&a){let p=JSON.stringify(l.getComponent());new bl(p,u.type).rebuildComponent(u)}let d=Ce.dispatch(u,"add");e.addCommand(d),t.push(u),u.click()}),n.forEach(h=>{e.addCommand(Ce.dispatch(h,"delete")),he.publish("hasModifyPcbItem",h),h.remove(),he.publish("delete",h)})}he.publish("autoFill",""),he.publish("updateRtree",""),he.publish("updateFrame",""),e.length>0&&(qe.executeCommand(e),he.publish("onlySelect",t))}function Pvt(o){let t=[],e=new De("Execute Boolean Operation"),r=new Ec,i=Vze(o);for(let n of i){let s=F3e(n),a=OA(n),l=n.map(u=>{let d=ece(u);return d instanceof Bt?d:new Bt([nh(d)?d.reverse():d])}),c=r.getMutuallyExclusiveForSingle(l.map(u=>u.items)),h=new Mh;c.forEach(u=>{let d=h.create4PlGrp(s.type,s.layerId,u,s.strokeWidth,s.net,!1);if(s.type=="FPC Stiffener"||s.type=="Fill Region"&&a){let m=JSON.stringify(s.getComponent());new bl(m,d.type).rebuildComponent(d)}let p=Ce.dispatch(d,"add");e.addCommand(p),t.push(d),d.click()}),n.forEach(u=>{e.addCommand(Ce.dispatch(u,"delete")),he.publish("hasModifyPcbItem",u),u.remove(),he.publish("delete",u)})}he.publish("autoFill",""),he.publish("updateRtree",""),he.publish("updateFrame",""),e.length>0&&(qe.executeCommand(e),he.publish("onlySelect",t))}function ece(o){return o instanceof Le&&o.layerId==12?o.getMathGraphics(1):o.getMathGraphics()}var tce=class{constructor(t){this.direct=null;this.shape=t,this.oldStart=t.start,this.oldEnd=t.end,this.direct=hf(t.end.sub(t.start).normalize())}};function hf(o){let t;Math.abs(o.x)<1e-8?t=0:t=o.x;let e;return Math.abs(o.y)<1e-8?e=0:e=o.y,new S(t,e)}function nm(o){return o.filter(t=>t.length>1e-8?!0:(t.remove(),!1))}function iD(o){if(o instanceof lt){let e=o.getChildrens().map(r=>A1(r));o.getChildrens().length=0,o.setChildrens(e),Pe.getLayer(o.layerId).isSignalLayer()&&(o.color=null)}else if(o instanceof sn){let t=o.createPreviewChildrens(),r=A1(t).map(i=>{let n=i.primitive;return i.remove(),n});o.setChildrens(ge.build2(r))}}function A1(o){let t=[];o=nm(o);for(let n=0;n<o.length;n++){let s=o[n];if(s instanceof mt){let a=s.end,l=s.end.sub(s.start),c=hf(l.normalize());for(;n<o.length-1&&o[n+1]instanceof mt;){let h=o[n],u=o[n+1],d=u.end.sub(u.start),p=hf(d.normalize()),m=h.end.distance1(u.start)<1e-8,g=V3e(c,p);if(u instanceof mt&&m&&g)a=u.end;else break;n++}s.end=a,t.push(s)}else t.push(s)}let e=t[0],r=t[t.length-1];if(t.length>=2&&e instanceof mt&&r instanceof mt){let n=e.direct,s=r.direct;if(Math.abs(n.cross(s))<1e-8&&n.dot(s)>=0){let{start:l,end:c}=r,{start:h,end:u}=e;n.dot(h.sub(l))>=0&&n.dot(u.sub(c))>=0&&n.dot(c.sub(h))>=0&&(r.end=e.end,t.shift())}}let i=new Set(t);return o.forEach(n=>{n&&!i.has(n)&&n.remove()}),t}function V3e(o,t){return!!ne.less(Math.abs(o.cross(t)),dl)}var LV=class{constructor(){this.type=null;this.shapes=new Array;this.width=.02;this.minSpace=.5;this.net="";this.locked=!1;this.isMergeCoincide=!1}setType(t){return this.type=t,this}setLayerId(t){return this.layerId=t,this}get length(){return this.shapes.length}addChilds(t){return this.shapes=[].concat(this.shapes,t),this}addChild(t){return this.shapes.push(t),this}setWidth(t){return this.width=t,this}setMinSpace(t){return this.minSpace=t,this}setNet(t){return this.net=t,this}setLocked(t){return this.locked=t,this}check(){return!(this.type==null||this.layerId==null||this.shapes.length==0||this.width==null||this.net==null||this.locked==null)}get start(){return this.shapes.length>0?this.shapes[0].start:null}get end(){return this.shapes.length>0?this.shapes[this.shapes.length-1].end:null}getShapes(){return this.shapes}insertHead(t,e){if(t.length==0)return this;if(this.shapes.length==0)this.shapes=Array.from(t);else if(e==0){let r=new Array;for(let i=t.length-1;i>=0;i--){let n=this.reverseModel(t[i]);r.push(n)}r[r.length-1].end=this.shapes[0].start,this.shapes=[].concat(r,this.shapes)}else e==1&&(t[t.length-1].end=this.shapes[0].start,this.shapes=[].concat(t,this.shapes));return this}insertHead1(t,e){if(t.length==0)return this;if(this.shapes.length==0)this.shapes=Array.from(t);else if(e==4){let r=new Array;for(let i=t.length-1;i>=0;i--){let n=this.reverseModel(t[i]);r.push(n);let s=r.findIndex(a=>a.globalIndex==n.globalIndex);s-1>=0&&!r[s].start.equals2(r[s-1].end,this.minSpace)&&(r[s].start=r[s-1].end)}!r[r.length-1].end.equals(this.shapes[0].start,this.minSpace)&&(r[r.length-1].end=this.shapes[0].start),this.shapes=[].concat(r,this.shapes),this.isMergeCoincide=!0}else e==3&&(!t[t.length-1].end.equals(this.shapes[0].start,this.minSpace)&&(t[t.length-1].end=this.shapes[0].start),this.shapes=[].concat(t,this.shapes),this.isMergeCoincide=!0);return this}insertHead2(t,e){if(t.length==0)return this;if(this.shapes.length==0)this.shapes=Array.from(t);else if(e.connect==0){let r=new Array;t=t.slice(0),this.shapes[0].start=t[e.startIndex].end,t.splice(0,e.startIndex+1);for(let i=t.length-1;i>=0;i--){let n=this.reverseModel(t[i]);r.push(n)}this.shapes=[].concat(r,this.shapes),this.isMergeCoincide=!0}else e.connect==1&&(t=t.slice(0),this.shapes[0].start=t[e.startIndex].start,t.splice(e.startIndex,t.length-e.startIndex),this.shapes=[].concat(t,this.shapes),this.isMergeCoincide=!0);return this}insertEnd(t,e){if(t.length==0)return this;if(this.shapes.length==0)this.shapes=Array.from(t);else if(e==2)this.shapes[this.shapes.length-1].end=t[0].start,this.shapes=[].concat(this.shapes,t);else if(e==3){let r=new Array;for(let i=t.length-1;i>=0;i--){let n=this.reverseModel(t[i]);r.push(n)}this.shapes[this.shapes.length-1].end=r[0].start,this.shapes=[].concat(this.shapes,r)}return this}insertEnd1(t,e){if(t.length==0)return this;if(this.shapes.length==0)this.shapes=Array.from(t);else if(e==2)!this.shapes[this.shapes.length-1].end.equals(t[0].start,this.minSpace)&&(this.shapes[this.shapes.length-1].end=t[0].start),this.shapes=[].concat(this.shapes,t),this.isMergeCoincide=!0;else if(e==5){let r=new Array;for(let i=t.length-1;i>=0;i--){let n=this.reverseModel(t[i]);r.push(n);let s=r.findIndex(a=>a.globalIndex==n.globalIndex);s-1>=0&&!r[s].start.equals(r[s-1].end,this.minSpace)&&(r[s].start=r[s-1].end)}!this.shapes[this.shapes.length-1].end.equals(r[0].start,this.minSpace)&&(this.shapes[this.shapes.length-1].end=r[0].start),this.shapes=[].concat(this.shapes,r),this.isMergeCoincide=!0}return this}insertEnd2(t,e){if(t.length==0)return this;if(this.shapes.length==0)this.shapes=Array.from(t);else if(e.connect==2)t=t.slice(0),this.shapes[this.shapes.length-1].end=t[0].end,t.splice(0,e.endIndex+1),this.shapes=[].concat(this.shapes,t),this.isMergeCoincide=!0;else if(e.connect==3){let r=new Array;t=t.slice(0),this.shapes[this.shapes.length-1].end=t[e.endIndex].start,t.splice(e.endIndex,t.length-e.endIndex);for(let i=t.length-1;i>=0;i--){let n=this.reverseModel(t[i]);r.push(n)}this.shapes=[].concat(this.shapes,r),this.isMergeCoincide=!0}return this}insertLoop(t,e){if(t.length==0)return this;if(this.shapes.length==0)this.shapes=Array.from(t);else if(e==4){let r=new Array;for(let i=t.length-1;i>=0;i--){let n=this.reverseModel(t[i]);r.push(n)}r[r.length-1].end=this.shapes[0].start,r[0].start=this.shapes[this.shapes.length-1].end,this.shapes=[].concat(this.shapes,r)}else e==5&&(t[t.length-1].end=this.shapes[0].start,t[0].start=this.shapes[this.shapes.length-1].end,this.shapes=[].concat(this.shapes,t));return this}updateShape(t,e){return t.length==0?this:(this.shapes.length==0?this.shapes=Array.from(t):e.connect==4&&(this.shapes.length<t.length&&(this.shapes=Array.from(t)),this.isMergeCoincide=!0),this)}insertShape(t,e){if(t.length==0)return this;if(this.shapes.length==0)this.shapes=Array.from(t);else if(e)this.start.equals(t[t.length-1].end)?(t=t.slice(0),this.shapes=[].concat(t,this.shapes),this.isMergeCoincide=!0):this.end.equals(t[0].start)&&(this.shapes=[].concat(this.shapes,t),this.isMergeCoincide=!0);else{let r=new Array;for(let i=t.length-1;i>=0;i--){let n=this.reverseModel(t[i]);r.push(n)}this.start.equals(r[r.length-1].end)?(r=r.slice(0),this.shapes=[].concat(r,this.shapes),this.isMergeCoincide=!0):this.end.equals(r[0].start)&&(this.shapes=[].concat(this.shapes,r),this.isMergeCoincide=!0)}return this}updateModelShape(t,e,r,i){return e=="nextItemStartInPlItem"?r?this.shapes[i].end=t.end:this.shapes[i].start=t.end:r?this.shapes[i].start=t.start:this.shapes[i].end=t.start,this.isMergeCoincide=!0,this}overlappingUpdateModelShape(t){return t.length==0?this:(this.shapes.length==0?this.shapes=Array.from(t):this.shapes=Array.from(t),this)}selfIntersectionPoints(){let t=[];for(let e=0;e<this.shapes.length;e++){let r=this.shapes[e];for(let i=e+1;i<this.shapes.length;i++){let n=this.shapes[i];if(r.buildBBox().isSeparated(n.buildBBox()))continue;let s=new S(je(r.start.x),je(r.start.y)),a=new S(je(r.end.x),je(r.end.y)),l=new S(je(n.start.x),je(n.start.y)),c=new S(je(n.end.x),je(n.end.y)),h=zee(s,a,l,c);h&&!t.includes(h)&&t.push(h)}}return t}selfIntersectionPoints2(){let t=new Set,e=!1;for(let r=0;r<this.shapes.length;r++){let i=this.shapes[r];t.add(i);for(let n=r+1;n<this.shapes.length;n++){let s=this.shapes[n];if(t.add(s),(s.end.equals(i.start)||s.end.equals(i.end))&&this.shapes[n+1]&&s.end.equals(this.shapes[n+1].start)){e=!0;let a=Array.from(t).findIndex(c=>c.start.equals(s.end));return Array.from(t).slice(a,n+1)}}}if(!e)return[]}splitSelfIntersectionPolyline(){let t=[],e=this.selfIntersectionPoints();if(e.length){let r=new Po;e.forEach(i=>{for(let s=0;s<this.shapes.length;s++){let a=this.shapes[s];if(Lz(i,a.start,a.end,a.width/Ai().getScale())&&!i.equals(a.start)&&!i.equals(a.end)){let l=r.clone4(a.model),c=r.clone4(a.model);l.start=i,c.end=i,this.shapes.splice(s,1,l),this.shapes.splice(s,0,c),l.hidden(),c.hidden()}}let n=[];for(let s=0;s<this.shapes.length;s++){let a=this.shapes[s];if(!n.some(l=>l&&l.lineIsEqual(a))&&(n.push(a),a.end.equals(i))){for(let l=s+1;l<this.shapes.length;l++){let c=!1,h=this.shapes[l];h.start.equals(a.end)&&!_L([a.start,a.end],[h.start,h.end])&&(n.push(h),c=!0),c&&(n.some(u=>u&&u.lineIsEqual(h))||n.push(h)),l==this.shapes.length-1&&(t.push(...n),n=[])}break}}})}else{let r=new Po,i=this.selfIntersectionPoints2();i.length&&(i=i.map(n=>r.clone4(n.model)),t.push(...i))}return t.length&&t.forEach(r=>{let i=this.shapes.findIndex(n=>n.lineIsEqual(r));i!==-1&&this.shapes.splice(i,1)}),t}reverseModel(t){if(t instanceof mt){let e=t.start,r=t.end;return t.start=r,t.end=e,t}else{let e=t.sweep;e==ae.CCW?e=ae.CW:e=ae.CCW;let r=t.startAngle,i=t.endAngle;return t.sweep=e,t.setStartAngleAndEndAngle(i,r),t}}isClose(){if(this.shapes.length>1){let t=this.shapes[0],e=this.shapes[this.shapes.length-1];if(t.start.distance2(e.end)<this.width/Ai().getScale())return!0}return!1}correctPoint(){if(this.shapes.length>1){let t=this.shapes[0],e=this.shapes[this.shapes.length-1];t.start.equals1(e.end)||(t.start=e.end)}}build(){if(Bu(this.type)&&!Qh(this.shapes.map(r=>r.primitive)))return null;let t=new Array,e=new Po;return this.shapes.forEach(r=>{let i=e.clone4(r.model);t.push(i)}),t=nm(t),pt.addPolygon(this.type,this.layerId,[t],this.width,this.net,this.locked)}build1(t){return Bu(this.type)&&!Qh(t.map(e=>e.primitive))||(t=nm(t),!t.length)?null:pt.addPolygon(this.type,this.layerId,[t],this.width,this.net,this.locked)}};var G3e=class{constructor(t){this.shape=t;this._bbox=t.buildBBox()}bbox(){return this._bbox}},XA=class o{constructor(t,e){this.minSpaceRoughly=.5;this.result=[];this.mergedModels=[];this.addModels=[];t!=null&&(this.minSpacePrecise=t),e!=null&&(this.minSpaceRoughly=e),this.result.length=0,this.mergedModels.length=0,this.addModels.length=0}build(t,e){let r=new o(this.minSpacePrecise,this.minSpaceRoughly),i=r.getGroupPolygon(t),n=!1,s=[],a=[];for(let c=0,h=i.length;c<h;c++){let u=i[c];if(u){n=r.filterMultiPolygon(u).isMultiConnect;let p=r.merge1(u);p.mergedModels&&(s=s.concat(p.mergedModels)),p.addModels&&(a=a.concat(p.addModels))}}let l=[];return t.forEach(c=>{s.indexOf(c)===-1&&l.push(c)}),this.result=l.concat(a),s.length&&(this.mergedModels=s),a.length&&(this.addModels=a),e&&e(s,a,n),{mergedModels:s,addModels:a,isMultiConnect:n}}filterMultiPolygon(t){let e=this.getModelsPoint(t),r=[],i=[],n=!1;for(let s=0,a=e.length;s<a;s++){let l=e[s],c=0,h=0,u=0,d=null;if(!Uze(l,t[s])){for(let p=0;p<e.length;p++){let m=e[p];if(s==p||Uze(m,t[p]))continue;let g=this.checkIsSmallestAffairs(this.getPortsConnectInfo(l,m,this.minSpaceRoughly),l,m);d=this.checkCoincidence(l,m,t[s],t[p]),g==0||g==1?c++:g==2||g==3?h++:(g==5||g==4)&&(c++,h++),d.connect&&u++}u!=1&&c<=1&&h<=1&&r.push(t[s]),(c>=2||h>=2||u>1)&&(n=!0),u<=1&&i.push({model:t[s],coincidenceInfo:d})}}return{singleConnectModels:r,isMultiConnect:n,singleCoinConnectModels:i}}flatten(t){return t.reduce((e,r)=>(e.push(...r),e),[])}merge1(t){let e=new Set,r=new Set,i=[],n={},s=new De("merge polygon");t.forEach(h=>{if(h instanceof lt){let u=Ce.dispatch(h,"delete");n[h.globalIndex]=u}});let a=this.sortModels(t,r,n,s);t=a.models;let{flattenTree:l,rtree:c}=a;for(let h=0,u=t.length;h<u;h++){let d=t[h];if(d.isEmpty)continue;let p=new LV;p.setMinSpace(this.minSpacePrecise).setType(d.type).setLayerId(d.layerId).setWidth(d.strokeWidth).setNet(d.net).addChilds(l.get(d).itemList.map(g=>g.shape));let m=!1;do m=this.add2Factory3(d,e,p,c,r,l);while(m);if(p.isMergeCoincide){let g=p.splitSelfIntersectionPolyline();if(g.length){let b=p.build1(g);b&&s.addCommand(Ce.dispatch(b,"add"))}let y=p.build();y!=null&&r.size&&(r.forEach(b=>{n[b.globalIndex]&&(s.addCommand(n[b.globalIndex]),delete n[b.globalIndex]),A.publish("delete",b),b.remove()}),i.push(y),s.addCommand(Ce.dispatch(y,"add")),A.publish("hasModifyPcbItem",y))}}return s.length&&qe.executeCommand(s),{mergedModels:Array.from(r),addModels:i}}add2Factory3(t,e,r,i,n,s){let a=!1,l=[t];for(;l.length;){let c=l.pop();if(!c.isEmpty)for(let h of i.search(c.buildBBox())){let u=[c.globalIndex,h.globalIndex].sort().join("|");if(e.has(u))continue;e.add(u);let d=h&&h||h;if(d.isEmpty||d&&c.equals1(d))continue;let p=r.getShapes(),m=s.get(d);for(let g=0;g<p.length;g++){let y=p[g],b=y.start,P=y.end,T=P.sub(b);for(let I of m.search(y.buildBBox())){let E=I.shape,O=E.start,_=E.end,x=_.sub(O),v=T.dot(x)>=0,D=_L([b,P],[O,_])&&y instanceof mt&&E instanceof mt;this.isInside(E,y)?(n.add(c),n.add(h),l.push(h),r.isMergeCoincide=!0,m.remove(I),a=!0):this.isInside(y,E)?(v?p[g]=E:p[g]=r.reverseModel(E),n.add(c),n.add(h),l.push(h),r.isMergeCoincide=!0,m.remove(I),a=!0):this.pointsInLineOrArc(O,y)?D?(v?p[g].end=_:p[g].start=_,n.add(c),n.add(h),l.push(h),m.remove(I),r.isMergeCoincide=!0,a=!0):(this.equals2(O,P,y.width)||this.equals2(O,b,y.width)||(n.delete(c),n.delete(h),r.isMergeCoincide=!1),a=!1):this.pointsInLineOrArc(_,y)&&(D?(v?p[g].start=O:p[g].end=O,n.add(c),n.add(h),l.push(h),m.remove(I),r.isMergeCoincide=!0,a=!0):(this.equals2(_,b,y.width)||this.equals2(_,P,y.width)||(n.delete(c),n.delete(h),r.isMergeCoincide=!1),a=!1))}}if(m.size()){let g=m.itemList.map(b=>b.shape),y=this.checkIsEndToEnd1(r,g[0].start,g[g.length-1].end);if(y)switch(y){case 2:r.insertEnd1(g,2),n.add(c),n.add(h),l.push(h),a=!0;break;case 3:r.insertHead1(g,3),n.add(c),n.add(h),l.push(h),a=!0;break;case 4:r.insertHead1(g,4),n.add(c),n.add(h),l.push(h),a=!0;break;case 5:r.insertEnd1(g,5),n.add(c),n.add(h),l.push(h),a=!0;break}}if(r.isClose())return r.correctPoint(),!1}}return a}checkIsEndToEnd1(t,e,r){var a;let i=(a=this.minSpacePrecise)!=null?a:t.width/Ai().getScale(),n=Number.POSITIVE_INFINITY,s=!1;if(this.equals2(t.end,e,i)){let l=t.end.distance1(e);l<n&&(n=l,s=2)}if(this.equals2(t.start,r,i)){let l=t.start.distance1(r);l<n&&(n=l,s=3)}if(this.equals2(t.start,e,i)){let l=t.start.distance1(e);l<n&&(n=l,s=4)}if(this.equals2(t.end,r,i)){let l=t.end.distance1(r);l<n&&(n=l,s=5)}return s}sortModels(t,e,r,i){let n=new Set,s=new Set,a=new ji(10),l=new Map,c=new Map;for(let p of t){a.add(p),n.add(p);let m=this.flatten(p.getChildrens()),g=new ji(10);for(let y of m)g.add(new G3e(y));l.set(p,g),c.set(p,m.every(y=>y instanceof mt))}let h=new Set,u=new Set;function d(p){A.publish("delete",p),p.remove(),h.add(p),u.add(p)}for(let p=0;p<t.length;p++){let m=t[p];if(!h.has(m)){h.add(m);for(let g of a.search(m.buildBBox())){if(h.has(g))continue;let y=_L([m.start,m.end],[g.start,g.end])&&c.get(m)&&c.get(g),b=new Set;if(y){let P=l.get(g);for(let T of l.get(m).items())for(let I of P.search(T.bbox())){this.isInside(I,T)&&b.add(I.shape);break}}if(b.size&&b.size==l.get(g).size())e.add(g),s.add(m),r[g.globalIndex]&&(i.addCommand(r[g.globalIndex]),delete r[g.globalIndex]),d(g);else{if(b=new Set,y){let P=l.get(m);for(let T of l.get(g).items())for(let I of P.search(T.bbox())){this.isInside(I,T)&&b.add(I.shape);break}}b.size&&b.size==l.get(m).size()&&(e.add(m),s.add(g),r[m.globalIndex]&&(i.addCommand(r[m.globalIndex]),delete r[m.globalIndex]),d(m))}}}}for(let p of e)n.delete(p),l.delete(p),a.remove(p);for(let p of u)n.delete(p),l.delete(p),a.remove(p);return Array.from(s).forEach(p=>e.add(p)),{models:Array.from(n),flattenTree:l,rtree:a}}getGroupPolygon(t){let e={},r,i=[];return t.forEach(n=>{if(n instanceof mt||n instanceof _t){let s,a=n.getParent();a!=null&&a instanceof He&&(s=a.type),i=[s,n.layerId,gn(n.width,2),"",n.locked],r=i.join("@"),fz(e,r,()=>[n],(l,c)=>l[c].concat([n]))}else n instanceof lt&&this.flatten(n.getChildrens()).length&&(i=[n.type,n.layerId,gn(n.strokeWidth,2),n.net,n.locked],r=i.join("@"),fz(e,r,()=>[n],(a,l)=>a[l].concat([n])))}),Object.values(e)}getModelsPoint(t){let e=[];for(let r=0,i=t.length;r<i;r++){let n=t[r],s=Hze(n);s&&e.push(s)}return e}getPortsConnectInfo(t,e,r){let i=this.equals2(t[0],e[0],r),n=this.equals2(t[1],e[1],r),s=this.equals2(t[0],e[1],r),a=this.equals2(t[1],e[0],r);if(i&&n)return 4;if(s&&a)return 5;if(i)return 0;if(n)return 3;if(s)return 1;if(a)return 2}equals2(t,e,r){return t instanceof S&&e instanceof S?Math.abs(t.x-e.x)<=r&&Math.abs(t.y-e.y)<=r:!1}isInside(t,e){if(!(t instanceof mt&&e instanceof mt||t instanceof _t&&e instanceof _t))return!1;let r=t.start,i=t.end,n=this.pointsInLineOrArc(r,e)&&this.pointsInLineOrArc(i,e);if(t instanceof mt&&e instanceof mt)return n;if(t instanceof _t&&e instanceof _t){let h=function(){let d=Math.max(a,c)-Math.min(s,l);return Math.abs(d-2*Math.PI)<Number.EPSILON};if(!n||!t.center.equals1(e.center)||!db(t.radius,e.radius,.001))return!1;let s=t.startAngle%(2*Math.PI),a=t.endAngle%(2*Math.PI);a<s&&(a+=2*Math.PI);let l=e.startAngle%(2*Math.PI),c=e.endAngle%(2*Math.PI);return c<l&&(c+=2*Math.PI),!(h()||!(s>=l&&a<=c))}return!1}pointsInLineOrArc(t,e){var r;return e instanceof mt?Lz(t,e.start,e.end,(r=this.minSpacePrecise)!=null?r:e.width/Ai().getScale()):TFe(t,e)}checkIsSmallestAffairs(t,e,r){function i(n,s,a){return Math.abs(n.x-s.x)<=a&&Math.abs(n.y-s.y)<=a}if(t!==null&&e[0].distance1(e[1])<=this.minSpaceRoughly){let s=e[0].distance2(r[0]),a=e[0].distance2(r[1]),l=e[1].distance2(r[0]),c=e[1].distance2(r[1]),h=i(e[0],r[0],this.minSpaceRoughly),u=i(e[0],r[1],this.minSpaceRoughly),d=i(e[1],r[0],this.minSpaceRoughly),p=i(e[1],r[1],this.minSpaceRoughly);u&&h&&(s<a?t=0:t=1),d&&p&&(l<c?t=2:t=3),u&&p&&(a<c?t=1:t=3),d&&h&&(s<l?t=0:t=2)}return t}checkCoincidence(t,e,r,i){let[n,s]=t,[a,l]=e,c={start:!1,end:!1,startIndex:void 0,endIndex:void 0,startItem:null,endItem:null},h={start:!1,end:!1,startIndex:void 0,endIndex:void 0,startItem:null,endItem:null},u=this.flatten(r.getChildrens()),d=this.flatten(i.getChildrens());for(let p=0;p<d.length;p++){let m=d[p];m.pointIsContain(n)&&(c.start=!0,c.startItem=m,c.startIndex=p),m.pointIsContain(s)&&(c.end=!0,c.endItem=m,c.endIndex=p)}for(let p=0;p<u.length;p++){let m=u[p];if(m instanceof Array){for(let g=0;g<m.length;g++)m[g].pointIsContain(a)&&(h.start=!0,h.startItem=m[g],h.startIndex=p),m[g].pointIsContain(l)&&(h.end=!0,h.endItem=m[g],h.endIndex=p);continue}m.pointIsContain(a)&&(h.start=!0,h.startItem=m,h.startIndex=p),m.pointIsContain(l)&&(h.end=!0,h.endItem=m,h.endIndex=p)}return c.start&&!c.end&&h.start&&!h.end?this.isSSCoincidence(c,h,d)&&(c.connect=0):!c.start&&c.end&&h.start&&!h.end?this.isESCoincidence(c,h,u,d)&&(c.connect=2):c.start&&!c.end&&!h.start&&h.end?this.isSECoincidence(c,h,d)&&(c.connect=1):!c.start&&c.end&&!h.start&&h.end?this.isEECoincidence(c,h,u,d)&&(c.connect=3):c.start&&c.end&&!h.start&&!h.end?this.isSSEECoincidence(c,u)&&!i.isClose()&&(c.connect=4):!c.start&&!c.end&&h.start&&h.end?this.isSSEECoincidence(h,d)&&!i.isClose()&&(c.connect=4):c.start&&c.end&&h.start&&h.end&&u.length===d.length&&this.isSSEECoincidence(c,u)&&!i.isClose()&&(c.connect=4),c}getPrevious(t){return t.getParent().getConnect(t,!0)}getNext(t){return t.getParent().getConnect(t,!1)}isSSCoincidence(t,e,r){let i=!0;if(t.startIndex===e.startIndex){let n=e.startItem,s=r[0];do{if(!this.getPrevious(s)){if(!(s.end.equals1(n.start)||Math.abs(s.direct.cross(n.direct))<dl&&(s.pointIsContain(n.start)||n.pointIsContain(s.end)))){i=!1;break}n=this.getPrevious(n),s=this.getNext(s);continue}if(!this.getPrevious(n)){if(!(s.start.equals1(n.end)||Math.abs(s.direct.cross(n.direct))<dl&&(s.pointIsContain(n.end)||n.pointIsContain(s.start)))){i=!1;break}n=this.getPrevious(n),s=this.getNext(s);continue}if(!n.lineIsEqual(s)){i=!1;break}n=this.getPrevious(n),s=this.getNext(s)}while(n&&s)}else i=!1;return i}isESCoincidence(t,e,r,i){let n=!0;if(r.length-t.endIndex===e.startIndex+1){let s=e.startItem,a=i[0];do{if(!this.getPrevious(a)){if(!(a.end.equals1(s.end)||Math.abs(a.direct.cross(s.direct))<dl&&(a.pointIsContain(s.end)||s.pointIsContain(a.end)))){n=!1;break}s=this.getNext(s),a=this.getNext(a);continue}if(!this.getNext(s)){if(!(a.start.equals1(s.start)||Math.abs(a.direct.cross(s.direct))<dl&&(a.pointIsContain(s.start)||s.pointIsContain(a.start)))){n=!1;break}s=this.getNext(s),a=this.getNext(a);continue}if(!s.lineIsEqual(a)){n=!1;break}s=this.getNext(s),a=this.getNext(a)}while(s&&a)}else n=!1;return n}isSECoincidence(t,e,r){let i=!0;if(t.startIndex+1===r.length-e.endIndex){let n=e.endItem,s=r[r.length-1];do{if(!this.getNext(s)){if(!(s.start.equals1(n.start)||Math.abs(s.direct.cross(n.direct))<dl&&(s.pointIsContain(n.start)||n.pointIsContain(s.start)))){i=!1;break}n=this.getPrevious(n),s=this.getPrevious(s);continue}if(!this.getPrevious(n)){if(!(s.end.equals1(n.end)||Math.abs(s.direct.cross(n.direct))<dl&&(s.pointIsContain(n.end)||n.pointIsContain(s.end)))){i=!1;break}n=this.getPrevious(n),s=this.getPrevious(s);continue}if(!n.lineIsEqual(s)){i=!1;break}n=this.getPrevious(n),s=this.getPrevious(s)}while(n&&s)}else i=!1;return i}isEECoincidence(t,e,r,i){let n=!0;if(r.length-t.endIndex===i.length-e.endIndex){let s=e.endItem,a=i[i.length-1];do{if(!this.getNext(a)){if(!(a.start.equals1(s.end)||Math.abs(a.direct.cross(s.direct))<dl&&(a.pointIsContain(s.end)||s.pointIsContain(a.start)))){n=!1;break}s=this.getNext(s),a=this.getPrevious(a);continue}if(!this.getNext(s)){if(!(a.start.equals1(s.end)||Math.abs(a.direct.cross(s.direct))<dl&&(a.pointIsContain(s.end)||s.pointIsContain(a.start)))){n=!1;break}s=this.getNext(s),a=this.getPrevious(a);continue}if(!s.lineIsEqual(a)){n=!1;break}s=this.getNext(s),a=this.getPrevious(a)}while(s&&a)}else n=!1;return n}isSSEECoincidence(t,e){let r=!0,i=new Set;if(e.length===Math.abs(t.endIndex-t.startIndex)+1){let n=t.startItem,s=e[0];if(i.add(n),i.add(s),t.endIndex-t.startIndex>=0)do{if(!this.getPrevious(s)){if(!(s.end.equals1(n.end)||Math.abs(s.direct.cross(n.direct))<dl&&(s.pointIsContain(n.end)||n.pointIsContain(s.end)))){r=!1;break}if(n=this.getNext(n),s=this.getNext(s),i.has(n)||i.has(s))break;i.add(n),i.add(s);continue}if(!this.getNext(s)){if(!(s.start.equals1(n.start)||Math.abs(s.direct.cross(n.direct))<dl&&(s.pointIsContain(n.start)||n.pointIsContain(s.start)))){r=!1;break}if(n=this.getNext(n),s=this.getNext(s),i.has(n)||i.has(s))break;i.add(n),i.add(s);continue}if(!n.lineIsEqual(s)){r=!1;break}if(n=this.getNext(n),s=this.getNext(s),i.has(n)||i.has(s))break;i.add(n),i.add(s)}while(n&&s);else{s=e[e.length-1],i.add(s);do{if(!this.getNext(s)){if(!(s.end.equals1(n.start)||Math.abs(s.direct.cross(n.direct))<dl&&(s.pointIsContain(n.start)||n.pointIsContain(s.end)))){r=!1;break}if(n=this.getPrevious(n),s=this.getPrevious(s),i.has(n)||i.has(s))break;i.add(n),i.add(s);continue}if(!this.getNext(s)){if(!(s.start.equals1(n.end)||Math.abs(s.direct.cross(n.direct))<dl&&(s.pointIsContain(n.end)||n.pointIsContain(s.start)))){r=!1;break}if(n=this.getPrevious(n),s=this.getNext(s),i.has(n)||i.has(s))break;i.add(n),i.add(s);continue}if(n.lineIsEqual(s)){r=!1;break}if(n=this.getPrevious(n),s=this.getNext(s),i.has(n)||i.has(s))break;i.add(n),i.add(s)}while(n&&s)}}else r=!1;return r}};function oq(o){if(o instanceof _t||o instanceof mt){let t=o.getParent();if(t!=null&&t instanceof He&&t.type==="Line")return!1}else if(o instanceof lt&&!o.isClose())return!1;return!0}function Uze(o,t){if(t instanceof lt){if(t.getChildrens().every((s,a)=>t.isClose(a)))return!1;let[i,n]=o;if(i.x===n.x&&i.y===n.y)return!0}return!1}var rce=class{constructor(t){this.shape=t;this._bbox=t.buildBBox()}bbox(){return this._bbox}},U3e=class{convertProfile(t,e,r,i=!0){let n=[];r=r||new De("convert profile type");for(let p of t)A.publish("hasModifyPcbItem",p);let s=new Array,a=new XA,{mergedModels:l,addModels:c}=a.build(t.filter(p=>!(p instanceof lt&&p.isClose())));t.forEach(p=>{p instanceof lt&&l.includes(p)||s.push(p)}),c.forEach(p=>{s.push(p)});let h=this.groupIntersectionPls(s);for(let{layerId:p,pls:m,items:g}of h){let y=Array.from(g)[0],b=this.createPolygonsByMergePls(m,e,p,Ao(y)||void 0,y.strokeWidth);for(let P of b)un.addOrder(P,r),r.addCommand(Ce.dispatch(P,"add")),n.push(P);for(let P of g)P.isEmpty||(r.addCommand(Ce.dispatch(P,"delete")),A.publish("delete",P),P.remove())}let u=new Set;for(let{items:p}of h)p.forEach(m=>u.add(m.globalIndex));let d=[];for(let p of s)u.has(p.globalIndex)||d.push(p);if(d.length&&Hn(d,(p,m)=>{if(m instanceof lt)if(m.isClose())r.addCommand(Ce.dispatch(m,"modify")),m.type=e,un.addOrder(m,r),m.fill(),A.publish("hasModifyPcbItem",m),n.push(m);else{let g=m.getEdgePolylines(),y=this.createPolygonsByMergePls(g,e,m.layerId,m.net,m.strokeWidth)[0];un.addOrder(y,r),r.addCommand(Ce.dispatch(y,"add")),r.addCommand(Ce.dispatch(m,"delete")),A.publish("delete",m),m.remove(),n.push(y)}else(m instanceof rr||m instanceof Pr)&&(r.addCommand(Ce.dispatch(m,"modify")),m.type=e,un.addOrder(m,r),m.fill(),A.publish("hasModifyPcbItem",m),n.push(m))}),e=="Copper Region"&&A.publish("rebuildConnectCopper",n.map(p=>p.globalIndex)),r.length&&i){let p=new hi;p.addGroup(r),p.checkOutlines(n),A.publish("flushSelectingInfo","")}return n}convertCopperResult2FillRegion(t,e=!1,r){if(t.length<=0)return[];let i=r||new De("convert to fill region"),n=[],s=new Ec;for(let a=0;a<t.length;a++){let l=t[a],c=l.getParent(),h=c.layerId,u=c.net,d=c.locked,p=Pu(-1,"Fill Region"),m=[];if(l.style==="solid"){let g=new Bt(l.getOutline()),y=g.getOutMostPolyline(),b=g.items.filter(_=>_!=y),P=l.getRealOutline().filter(_=>!g.items.includes(_)).map(_=>[_]),T=[[y,...b],...P],I=s.getUnionForSingle(T,T.map(_=>2)),C=new Array;for(let _ of I)for(let x of _.items)x.isClose()&&C.push(x);let O=new Mh().create4Pls("Fill Region",h,C,p,u,d);O.fill(),i.addCommand(Ce.dispatch(O,"add")),n.push(O)}else if(l.style==="45grid"||l.style==="90grid"){let g=l.getRealOutline(),y=new Mh;g.forEach(b=>{let P=y.create4Pl("Fill Region",h,b,p,u,d);P.fill(),i.addCommand(Ce.dispatch(P,"add")),n.push(P)})}!e&&!le.pcbConfig.isRebuildCopperAuto&&(i.addCommand(Ce.dispatch(l,"delete")),A.publish("delete",l),l.remove())}return i.length&&!r&&(qe.executeCommand(i),A.publish("flushService",""),A.publish("flushSelectingInfo","")),n}filterHasInsideBoundaryInCopperResults(t){let e=[];for(let r=0;r<t.length;r++){let i=t[r];i.getRealOutline().length>=2&&i.style==="solid"||e.push(i)}return e}createPolygonsByMergePls(t,e,r,i="",n=1){let s=[],a=TI(t),l=new Array;for(let h of a)(!Bu(e)||h.isClose())&&l.push(h);let c=new Mh;for(let h of l){let u=c.create4Pl(e,r,h,n,i,!1);u.fill(),s.push(u)}return s}isNeedSegmentLine(t){return!(t==="Line"||t==="Board Outline"||t==="Slot Region"||t==="3D Shell - Outline"||t==="3D Shell - Side Slot Region"||t==="3D Shell - Top Slot Region")}groupIntersectionPls(t){let e=[],i={};for(let a of t){let l=a.layerId,c=i[l];if(c||(c=new i2(10),i[l]=c),a instanceof lt&&!a.isClose()){let h=a.getChildrens();for(let u of h)for(let d of u)c.add(new rce(d))}else c.add(new rce(a))}let n=new Map;function s(a,l){let c=n.get(a);c==null&&(c=new Set,n.set(a,c)),c.add(l)}for(let a of Object.keys(i)){let l=new Map,c=i[a];for(let h of c.itemList){let u=h.shape;if(l.has(u))continue;let d=[h],p={layerId:+a,pls:[],items:new Set};l.set(u,p);let m=n.get(h);for(;d.length>0;){let g=d.shift();m=n.get(h),u=g.shape;let y=this.getMathGraphics(u);p.items.add(this.getAssociationItem(u)),y instanceof Bt?p.pls.push(...y.items):p.pls.push(y);for(let b of c.search(h.bbox())){if(m!=null&&m.has(b))continue;let P=b.shape;if(l.has(P))continue;let T=this.getMathGraphics(P),{relation:I}=y.primitives.length<T.primitives.length?new Xl(y,T,0):new Xl(T,y,0);I==0?(d.push(b),l.set(P,p)):(s(g,b),s(b,g))}}}e.push(...new Set(l.values()))}return e.filter(a=>a.items.size>1)}getAssociationItem(t){return t instanceof mt||t instanceof _t?t.getParent():t}getMathGraphics(t){if(t instanceof Le)if(ar(t.layerId)){if(t instanceof _i)return t.getMathGraphics(1);if(t instanceof sn)return t.getMathGraphics()}else return t.getMathGraphics();else return t.getMathGraphics()}},qA=new U3e;function ice(o,t,e){let{cmd:r,isOnlyProfile:i=!1}=typeof o=="string"?{cmd:o}:o,n=US(t.slice());switch(i&&(n=n.filter(a=>a instanceof He)),n=n.map((a,l)=>[a.buildBBox().center(),l]).sort((a,l)=>a[0].x!=l[0].x?a[0].x-l[0].x:a[0].y-l[0].y).map(a=>n[a[1]]),r){case"CONVERT_TO_TRACK":{e=e||new De("conver2Track lines length is"+n.length),A.publish("clearSelect","");let a=[];for(let l of n){let c=l,h=ns(Pe.getLayer(l.layerId).type)?l.layerId:1;if(c.type=="Line"){let u=c.getMathGraphics().primitives;e.addCommand(Ce.dispatch(c,"delete")),A.publish("hasModifyPcbItem",c),c.remove(),A.publish("delete",c);for(let d of u){let p;if(d instanceof M)p=pr.addTrack(h,d.start(),d.end(),c.strokeWidth,!1,c.net);else if(d instanceof q){let m=zt.toRadians(d.startAngle),g=zt.toRadians(d.endAngle());p=pr.addArcTrack(h,d.center,d.rx,m,g,d.sweep(),c.strokeWidth,!1,c.net)}a.push(p),e.addCommand(Ce.dispatch(p,"add")),A.publish("hasModifyPcbItem",p)}}}A.publish("onlySelect",a),e.length&&(qe.executeCommand(e),A.publish("flushService",""));break}case"CONVERT_TO_PAD":{e=e||new De("conver2pad lines length is"+n.length);let a={num:0};A.publish("clearSelect","");let l=n[0],c=xp.getNumberManager().getMaxNum();if(n.length===1&&n[0]instanceof lt&&!l.isClose()){let h=l.getEdgePolylines(),d=TI(h)[0],p=0,m=!0,g=new Wf(d.primitives),y=Pe.getLayer(l.layerId).type,b=l.layerId;y!="TOP"&&y!="BOTTOM"&&y!="MULTI"&&(b=1);let P=Qt.addPolygonPad(b,(c++).toString(),g.center,p,d,l.net||"",!1,1,.4,.4,.4,[],m,g.high*.6,g.high*.3,"ROUND",0,ut.defalutPad.holeOffset);A.publish("onlySelect",P),e.addCommand(Ce.dispatch(P,"add")),e.addCommand(Ce.dispatch(l,"delete")),A.publish("hasModifyPcbItem",l),l.remove(),A.publish("delete",l),a.num=1}else Ivt(n,e,a,c);e.length&&(qe.executeCommand(e),A.publish("showPcbSlideMsg",["{0} pad convert completed",[a.num]],Q()),A.publish("flushService",""));break}case"CONVERT_TO_2D_LINE":{n.every(l=>l instanceof Ge)?Tvt(n,e):GS(n,"Line",e);break}case"CONVERT_TO_BOARD_OUTLINE":{GS(n,"Board Outline",e);break}case"CONVERT_TO_CONSTRAINT_REGION":{GS(n,"Constraint Region",e);break}case"CONVERT_TO_COPPER_REGION":{GS(n,"Copper Region",e);break}case"CONVERT_TO_SLOT_REGION":{GS(n,"Slot Region",e);break}case"CONVERT_TO_FILL_REGION":{GS(n,"Fill Region",e);break}case"CONVERT_TO_PROHIBITED_REGION":{GS(n,"Prohibited Region",e);break}case"CONVERT_TO_D3_SHELL_OUTLINE":{GS(n,"3D Shell - Outline",e),A.windowBridge.publish("/ui/promptToOpen3DViewWindow",[R.getInstance().tabId],Q());break}case"CONVERT_TO_D3_SHELL_SLOT_REGION":{GS(n,"3D Shell - Top Slot Region",e),A.windowBridge.publish("/ui/promptToOpen3DViewWindow",[R.getInstance().tabId],Q());break}case"CONVERT_TO_D3_SHELL_ENTITY":{GS(n,"3D Shell - Top/Bottom Entity",e),A.windowBridge.publish("/ui/promptToOpen3DViewWindow",[R.getInstance().tabId],Q());break}case"CONVERT_TO_FPC_STIFFENER":{A.publish("checkOpenStiffenerLayer",""),GS(n,"FPC Stiffener",e);break}default:}}function Tvt(o,t){t=t||new De("converTrack2Profile"+o.length);let e=new Set,r=new Set;A.publish("clearSelect","");for(let n of o)r.add(n.globalIndex);let i=[];for(let n of o){if(e.has(n.globalIndex))continue;let s=At.getInstance().getListNode(n.model),a=[s.item],l=s,c=s.item.width;for(;l&&(l.prev&&r.has(l.prev.item.globalIndex)&&ne.eq(c,l.prev.item.width));)l=l.prev,a.unshift(l.item);let h=s;for(;h&&(h.next&&r.has(h.next.item.globalIndex)&&ne.eq(c,h.next.item.width));)h=h.next,a.push(h.item);let u=[];for(let m of a)e.add(m.globalIndex),u.push(m.primitive);let p=new Mh().create4Pts("Line",s.item.layerId,u,s.item.width,s.item.net,!1);t.addCommand(Ce.dispatch(p,"add")),A.publish("hasModifyPcbItem",n),i.push(p)}i.length>0&&A.publish("onlySelect",i);for(let n of o)t.addCommand(Ce.dispatch(n,"delete")),A.publish("hasModifyPcbItem",n),n.remove(),A.publish("delete",n);t.length&&(qe.executeCommand(t),A.publish("flushService",""))}function GS(o,t,e){let r=[],i=[],n=[];o.forEach(a=>{a instanceof Jr?i.push(a):r.push(a)});let s=qA.convertProfile(r,t,e);if(t==="Fill Region"){let a=qA.convertCopperResult2FillRegion(i);s.push(...a)}return s.length&&A.publish("onlySelect",s),s}function Ivt(o,t,e,r){let i={};o.forEach(u=>{h(i,u.layerId,u)});let n=[];for(let[u,d]of Object.entries(i)){u=Number(u);let p=new XA;p.build(d,()=>{let m=new Map;for(let y of p.result)m.set(y,y.getMathGraphics());let g=new Array;for(let y=0;y<p.result.length;y++){let b=p.result[y];for(let P=y+1;P<p.result.length;P++){let T=p.result[P];if(g.some(C=>C.has(b)&&C.has(T)))continue;if(new As(m.get(b),m.get(T),0).relation==0){let C=g.find(E=>E.has(b)||E.has(T));C?(C.add(b),C.add(T)):g.push(new Set([b,T]))}}}p.result.forEach(y=>{g.some(b=>b.has(y))||s(y)}),g.forEach(y=>a([...y],m));for(let y of p.result)if(!(!(y instanceof lt)||y.isEmpty)&&!y.isClose()){let b=y.getEdgePolylines(),T=TI(b)[0],I=0,C=!0,E=new Wf(T.primitives),O=Pe.getLayer(y.layerId).type,_=y.layerId;O!="TOP"&&O!="BOTTOM"&&O!="MULTI"&&(_=1);let x=Qt.addPolygonPad(_,(r++).toString(),E.center,I,T,"",!1,1,.4,.4,.4,[],C,E.high*.6,E.high*.3,"ROUND",0,ut.defalutPad.holeOffset);t.addCommand(Ce.dispatch(x,"add")),t.addCommand(Ce.dispatch(y,"delete")),y.remove(),A.publish("delete",y),e.num++,n.push(x)}}),n.forEach(m=>{m.click()}),A.publish("select",n),A.publish("flushSelectingInfo","")}function s(u){let d=Pe.getLayer(u.layerId).type,p=u.layerId;if(d!="TOP"&&d!="BOTTOM"&&d!="MULTI"&&(p=1),u instanceof rr){let m=u.getUL().add(u.getLR()).mul(.5),g=u.rotation,y=!0,b=u.realCornerRadius/Math.min(u.width,u.height)*2,P=Qt.addPad(p,1,(r++).toString(),m,"RECT",u.width,u.height,b,"RECT",u.width,u.height,b,"RECT",u.width,u.height,b,g,!1,u.net,1,ut.defalutPad.pasteExpansion,ut.defalutPad.topSolderExpansion,ut.defalutPad.bottomSolderExpansion,[],y,Math.min(u.width,u.height)*.6,Math.min(u.width,u.height)*.3,ut.defalutPad.holeShape,ut.defalutPad.holeRotation,ut.defalutPad.holeOffset);l(t,u,P),u.remove(),e.num++,n.push(P)}else if(u instanceof Pr){let y=Qt.addPad(p,1,(r++).toString(),u.center,"ELLIPSE",u.radius*2,u.radius*2,0,"ELLIPSE",u.radius*2,u.radius*2,0,"ELLIPSE",u.radius*2,u.radius*2,0,0,!1,u.net,1,ut.defalutPad.pasteExpansion,ut.defalutPad.topSolderExpansion,ut.defalutPad.bottomSolderExpansion,[],!0,u.radius*1.2,u.radius*.6,ut.defalutPad.holeShape,ut.defalutPad.holeRotation,ut.defalutPad.holeOffset);l(t,u,y),u.remove(),e.num++,n.push(y)}else if(u instanceof lt&&u.isClose()){let m;if(c(u)){let g=ys([u]),y,b;g.valid()&&(b=g.build1(),y=b.center()),m=Qt.addPad(u.layerId,1,(r++).toString(),y,"OVAL",b.width(),b.height(),0,"OVAL",b.width(),b.height(),0,"OVAL",b.width(),b.height(),0,0,!1,u.net,1,ut.defalutPad.pasteExpansion,ut.defalutPad.topSolderExpansion,ut.defalutPad.bottomSolderExpansion,[],!0,Math.min(b.width(),b.height())*.6,Math.min(b.width(),b.height())*.3,ut.defalutPad.holeShape,ut.defalutPad.holeRotation,ut.defalutPad.holeOffset)}else{let g=u.primitives,y=0,b=!0,P=new Wf(g);m=Qt.addPolygonPad(u.layerId,(r++).toString(),P.center,y,ge.build2(g),u.net,!1,1,.4,.4,.4,[],b,P.high*.6,P.high*.3,"ROUND",0,ut.defalutPad.holeOffset)}l(t,u,m),u.remove(),e.num++,n.push(m)}}function a(u,d){u=u.filter(T=>!(T instanceof lt&&!T.isClose()));let p=Pe.getLayer(u[0].layerId).type,m=u[0].layerId;p!="TOP"&&p!="BOTTOM"&&p!="MULTI"&&(m=1);let g=u.map(T=>d.get(T)),y=TI(g),b=new Array;for(let T of y)T.isClose()&&b.push(T);e.num+=b.length,b=b.map((T,I)=>[new _e().ext1(T.bbox()).build1().center(),I]).sort((T,I)=>T[0].x!=I[0].x?T[0].x-I[0].x:T[0].y-I[0].y).map(T=>b[T[1]]),b.forEach(T=>{let I=0,C=!0,E=new Wf(T.primitives),O=Qt.addPolygonPad(m,(r++).toString(),E.center,I,T,u[0].net,!1,1,.4,.4,.4,[],C,E.high*.6,E.high*.3,"ROUND",0,ut.defalutPad.holeOffset);t.addCommand(Ce.dispatch(O,"add")),n.push(O)}),u.forEach(T=>{t.addCommand(Ce.dispatch(T,"delete")),T.remove(),A.publish("delete",T)})}function l(u,d,p){u.addCommand(Ce.dispatch(d,"delete")),A.publish("delete",d),A.publish("hasModifyPcbItem",d),u.addCommand(Ce.dispatch(p,"add"))}function c(u){let d=new XA,p=[],m=[],g=[];function y(P){p.forEach(T=>{T.remove(),pt.delete(T)})}if(u.getAllChildrens().forEach(P=>{if(P instanceof _t&&(m.push(Math.floor(P.radius)),g.push(P)),P instanceof mt&&P.length>1e-8){let T=pt.addPolygon(u.type,P.layerId,[[P]],P.width,"",P.locked);p.push(T)}}),m=Array.from(new Set(m)),m.length!==1)return y(p),!1;let b=!1;return d.build(p,(P,T)=>{if(T.length===2&&P.length===p.length){let I=T[0].getChildrens()[0].start,C=T[0].getChildrens()[T[0].getChildrens().length-1].end,E=T[1].getChildrens()[0].start,O=T[1].getChildrens()[T[1].getChildrens().length-1].end;if(T.forEach(x=>x.remove()),Vee(I,C,E,O))return y(p),!1;let{d:_}=eBe(I,E,O);_===m[0]*2&&(b=!0)}}),y(p),b}function h(u,d,p){fz(u,d,()=>[p],(m,g,y)=>(y.push(p),y))}}var q6,Yze=nn.convert(.1,39.37,10);function nce(o){let{type:t,targetIds:e,expansion:r,clearCache:i,checkingFPCNeedAvoid:n}=o||{},s=oh(r),a=!n;if(i){q6=null;return}if(s&&q6){Wze(q6,r),q6=null;return}q6=null;let l=[];e&&e.length>0?e.forEach(p=>{let m=u1(p);l.push(m)}):n?l=mS():l=ze.getSelects();let c=W3e(l,n);if(c.some(p=>p.locked)&&!n){a&&Ovt();return}let u=Cvt(c,t,n);if(!u||u.size==0){a&&jze();return}let d=Array.from(u.keys());return n?(q6=u,d):(s?Wze(u,r):(q6=u,Evt(o)),d)}function Wze(o,t){let e=!1,r=new Ec,i=new De("Cutout to avoid"),n=new Mh,s=[];if(o.forEach((a,l)=>{let c=u1(l);if(!c)return;let h=c.getMathGraphics(),u=c.getGroupID(),d=zze(h),p=null,m=a.length;if(a.some((g,y)=>{if(d.length==0)return!0;let b=zze(g);if(t!=0){let T=[];b.forEach(I=>{let C=XP.zoomPolygon(I,t);C&&T.push(C)}),b=T}if(b.length==0)return!0;let P=r.getSubtraction(d,b);return y==m-1?p=P:(d=[],P.forEach(T=>{d=d.concat(T.items)})),!1}),!!p){if(i.addCommand(Ce.dispatch(c,"delete")),c.remove(),he.publish("delete",c),p.length>0){let g=c.type,y=c.layerId,b=c.net,P=c.strokeWidth,T=OA([c]);p.forEach((I,C)=>{let E=n.create4PlGrp(g,y,I,P,b,!1);if(u&&(Ht.joinCombination([E],u),E.setGroupID(u)),g=="FPC Stiffener"||g=="Fill Region"&&T){let O=JSON.stringify(c.getComponent());new bl(O,g).rebuildComponent(E)}i.addCommand(Ce.dispatch(E,"add")),E.click(),s.push(E)})}e=!0}}),e)s.length>0&&he.publish("onlySelect",s),he.publish("autoFill",""),he.publish("updateRtree",""),i.length>0&&qe.executeCommand(i);else return jze();return Yze=t,Avt()}function W3e(o,t){return o.filter(e=>{if(e instanceof He){let r=e.type;return t?r=="FPC Stiffener":r=="FPC Stiffener"||r=="Fill Region"}return!1})}function H3e(o){let t=12;return hb(o)?t=1:is(o)?t=2:Es(o)&&(t=15),t}function Cvt(o,t,e=!1){if(!o||o.length==0)return null;let r=new Set;o.forEach(s=>{let a=s.layerId,l=H3e(a);r.add(l)});let i=Svt(t,r,e),n=new Map;return i.size>0&&o.forEach(s=>{let a=s.layerId,l=H3e(a),c=i.get(l)||[],h=l!=12?i.get(12)||[]:[],u=c.concat(h);if(u.length>0){let d=s.globalIndex,p=s.getMathGraphics(),m=0,g=new zk,y;u.forEach(b=>{g.check(p,b,m)&&(y||(y=[],n.set(d,y)),y.push(b))})}}),n}function Svt(o,t,e=!1){let r=new Map;if(o=="avoidSlots"||e){let i=mS(),n=[],s=[];i.forEach(u=>{let d=u.layerId;if(u.type=="Slot Region"){let m=u.getMathGraphics();sq(m,n)}else d==11&&s.push(u)});let a=new _e,l=[],c=[];if(s.forEach(u=>{a.ext1(u.buildBBox());let d=u.getMathGraphics();if(d.isClose())l.push(d);else{let p=u.strokeWidth;d.primitives.forEach(g=>{c.push(g.stroke(p,wr.ROUND,ae.CCW))})}}),l.length>1){let u=l.sort((d,p)=>d.bbox().area()-p.bbox().area());u.pop(),u.forEach(d=>{n.push(d)})}c.forEach(u=>{n.push(u)}),rD().forEach(u=>{if(u.layerId==12){let p=u.getMathGraphics(47);sq(p,n)}}),n.length>0&&r.set(12,n)}if(o=="avoidPads"||e){let i=rD();t.forEach(a=>{r.set(a,[])});let n=t.has(1),s=t.has(2);i.forEach(a=>{let l=a.layerId,c=H3e(l),h=r.get(c);if(l==1&&n){let u=a.getMathGraphics(l);sq(u,h)}else if(l==2&&s){let u=a.getMathGraphics(l);sq(u,h)}else l==12&&t.forEach(u=>{let d=a.getMathGraphics(u),p=r.get(u);sq(d,p)})}),r.forEach((a,l)=>{a.length==0&&r.delete(l)})}return r}function Evt(o){let t=R.getInstance(),e={expansion:Yze,canvasUnitName:t.unit,...o};he.publish("openMainDialog",{cmd:50,data:e})}function Ovt(){he.publish("ui/toastMsg",{type:"error",msg:"Locked objects found, please try again after unlock"},Q())}function jze(){he.publish("ui/toastMsg",{type:"error",msg:"Cutout failed. Please check and try again."},Q())}function Avt(){he.publish("ui/toastMsg",{type:"success",msg:"Cutout operation complete. Please inspect the resulting geometry."},Q())}function sq(o,t){return o&&(t||(t=[]),t.push(o)),t}function zze(o,t){return o&&(t||(t=[]),o instanceof ge?t.push(o):o.items.forEach(e=>{t.push(e)})),t}var oce=class{constructor(){this.autoSave=!1;this.debugInfo=new Array;this.workerManager=tm.getInstance();this.logger=new Di(1);this.buildingCopperMap=new Set;this.tearDropWorker=null;new koe,new Joe,new Zle,new tse,new ese,new ise,new sle,A.subscribe("dynamicCopperResultFromWorker",i=>{XI.getInstance().handleDynamicCopperResult(i)}),A.subscribe("dynamicCopperCalTimeFromWorker",i=>{XI.getInstance().handleDynamicCopperCalTime()}),A.subscribe("openReuseTemplateDialog",()=>{let i=new Noe;A.publish("openDialog",i)}),A.subscribe("getPcbInfo",()=>{if(!R.getInstance().isactive||R.getInstance().doctype!==3)return;let i=new RR;A.publish("openPCBInfomationDlg",JSON.stringify(i),Q())}),A.messageBus.rpcService("sensorsGetPcbInfo",i=>{if(!R.getInstance().isactive||R.getInstance().doctype!==3)return;if(i==="3DInfo")return oGe();let n=new RR,s=!!Pi.offset;return{...n,is_panelize:s}}),A.messageBus.rpcService("pcbOrderGetPcbInfo",()=>new Promise((i,n)=>{if(!R.getInstance().isactive||R.getInstance().doctype!==3)return;let s=new RR,a=Pi.outerBBox,l,c;if(a)l=(a.maxX-a.minX)*10,c=(a.maxY-a.minY)*10,l=Pa(nn.convert(l,1,39.37),3),c=Pa(nn.convert(c,1,39.37),3);else{let[u,d]=JSON.parse(JSON.stringify(s)).info.BoardSize.split("x");l=parseFloat(u),c=parseFloat(d),R.getInstance().unit=="mil"&&(l=Pa(nn.convert(l,1,39.37),3),c=Pa(nn.convert(c,1,39.37),3))}i({...s,...{outerBBoxW:l,outerBBoxH:c}})})),A.messageBus.rpcService("placeDevice",i=>new Promise(async n=>{if(!R.getInstance().isactive||R.getInstance().doctype!==3)return;let s=R.getInstance().compilerChannel,a=await Hi.add(i.footprint.uuid,s);if(a.isEmpty()){A.publish("ui/toastMsg",{type:"error",msg:{value:"Footprint {package_name} has no content",options:{package_name:a.id}}},Q()),n({success:!1});return}let l=await this.parseDevice(i.device.uuid);A.publish("toggle",{command:"placeComponent",device:l,source:i.device.source}),n({deviceItemId:l.uuid,success:!0})})),A.subscribe("toggleRealTimeDRC",()=>{!R.getInstance().isactive||23==R.getInstance().doctype||sce(!Uu.switch)}),A.subscribe("DesignRuler",this.openDesignRuleDialog.bind(this)),A.subscribe("pcbBatchFanout",this.openBatchFanoutDialog.bind(this)),A.subscribe("EditPadsPairGroupDialog",this.openEditPadsPairGroupDialog.bind(this)),A.subscribe("insertImage",this.insertImage.bind(this)),A.subscribe("autoPlaceTestPad",this.openAutoPlaceTestPadDialog.bind(this)),A.subscribe("deleteDevice",i=>{let n=ts.getItem(i);n!=null&&ts.delete(n)},Q()),A.subscribe("copperAreaManagerDialog",this.openCopperDialog.bind(this)),A.subscribe("padLenManageDialog",this.openPadLenDialog.bind(this)),A.subscribe("buttomCommand",this.buttonCommand.bind(this),Q()),A.subscribe("viaFenceManageDialog",()=>{!R.getInstance().isactive||R.getInstance().doctype!==3||A.publish("openMainDialog",{cmd:12,data:{}})}),A.subscribe("rebuildCopperRegionDialog",i=>{le.pcbConfig.isRebuildCopperAuto&&!i.isManual||A.publish("rebuildCopperRegionDialog",i.msg,Q())}),A.subscribe("rebuildPlanezone",this.rebuildPlanezone.bind(this)),A.subscribe("rebuildCopper",this.rebuildCopper.bind(this)),A.subscribe("rebuildSingleCopper",this.rebuildSingleCopper.bind(this)),A.subscribe("RebuildCopperResult",this.RebuildCopperResult.bind(this)),A.subscribe("copperResult",this.buildCopper.bind(this)),A.subscribe("rebuildPlane",i=>{if(le.pcbConfig.isRebuildCopperAuto&&!(i!=null&&i.isManual)||!R.getInstance().isactive||R.getInstance().doctype!=3||Pe.getAllPlaneLayer().length==0)return;On.getInstance().allowPull=!1,this.rebuildPlaneLayerObserver=null;let n=new iq([],!0),s=this.workerManager.addWorker(`editor?entry=pcb-worker.js${Q().location.search.replace(/\?/,"&")}`),a=JSON.stringify(n.encode());function l(c,h){s.rpcCall("planeDocument",c).then(u=>{h.buildPlaneCopper(u.message,!le.pcbConfig.isRebuildCopperAuto),On.getInstance().allowPull=!0})}l(a,this)});let t=new Soe(this.workerManager);A.subscribe("rebuildSinglePlane",i=>{let n,s=!1;if(i instanceof Array?n=i:(s=i.isManual,n=i.message),!(le.pcbConfig.isRebuildCopperAuto&&!s)&&!(!R.getInstance().isactive||R.getInstance().doctype!=3||Pe.getAllPlaneLayer().length==0)&&(this.rebuildPlaneLayerObserver=new Set(n),On.getInstance().allowPull=!1,n.length>0)){let h=function(u,d){l.rpcCall("planeDocument",u).then(p=>{d.buildPlaneCopper(p.message,!le.pcbConfig.isRebuildCopperAuto),On.getInstance().allowPull=!0})},a=new iq(n,!1),l=this.workerManager.addWorker(`editor?entry=pcb-worker.js${Q().location.search.replace(/\?/,"&")}`),c=JSON.stringify(a.encode());h(c,this),c=null}}),A.subscribe("clearSinglePlane",i=>{!R.getInstance().isactive||R.getInstance().doctype!=3||i.forEach(n=>{zn.layerMapSet[n].forEach(a=>{a.remove(),A.publish("delete",a)}),R.getInstance().compiler.setTicket(),R.getInstance().compiler.deleteLayerFill(n)})}),A.subscribe("docNeedUpdate",this.docNeedUpdate.bind(this)),A.subscribe("clearAllRoute",i=>ace(i)),A.subscribe("openTearDrop",this.tearDropDialog.bind(this)),A.subscribe("toggleElementFilter",this.toggleElementFilter.bind(this)),A.messageBus.rpcService("pcb/getNetList",async i=>Ar.generateNetList(i==null?void 0:i.uniqueIdKey,i==null?void 0:i.autoUniqueId)),A.subscribe("pcb/partSourseStr2Canvas",async i=>{if(!(!R.getInstance().isactive||R.getInstance().doctype!==3))try{await xR.getInstance().partDxf(i),A.publish("toggle",{command:"importDxf"})}catch(n){this.logger.error2(n)}}),A.subscribe("deleteElementDialog",()=>{!R.getInstance().isactive||R.getInstance().doctype!==3||A.publish("openMainDialog",{cmd:4})}),A.subscribe("open2DlineWornDialog",()=>{!R.getInstance().isactive||R.getInstance().doctype!==3||Poe.getInstance().open()}),A.subscribe("needUpdateFootprint",this.needUpdateFootprint.bind(this),Q()),new boe,A.messageBus.rpcService("checkFormatBeforeGerber",oze),A.messageBus.rpcService("checkTrueColorPicture",g3e),A.messageBus.rpcService("checkTrueColor",tze),A.messageBus.rpcService("checkRatlineBeforeGerber",rze),A.messageBus.rpcService("checkDrcBeforeGerber",nze),A.messageBus.rpcService("checkBorderBeforeGerber",ize),A.messageBus.rpcService("checkFpcNeedToAvoid",i=>(i=Object.assign({checkingFPCNeedAvoid:!0},i||{}),nce(i))),A.messageBus.rpcService("setCoordToOriginLowerRightCorner",sze),A.messageBus.rpcService("exportGerber",async i=>await jWe(i).catch(n=>({error:(n==null?void 0:n.message)||n}))),A.messageBus.rpcService("getExportGeberAttachmentData",i=>CV(i).then(async n=>{if(!n)return;let s=await ZI(n.blob);return delete n.blob,{fileInfo:n,...s}}).catch(n=>({error:(n==null?void 0:n.message)||n}))),A.messageBus.rpcService("getNewAutoRouteJson",i=>Kb.autoRouting(i,!0)),A.messageBus.rpcService("getNewAutoRouteJsonForJR",i=>Kb.autoRoutingForJR(i)),A.messageBus.rpcService("importNewAutoLayoutJson",async i=>t.importLayoutResult2(i)),A.messageBus.rpcService("getNewAutoLayoutJson",async()=>await t.autoLayouting2(!0)),A.messageBus.rpcService("exportOdb",async i=>await g9e(i).then(n=>{if(!n)return;let s=n.fileName,a=n.blob;if(a){let c=s.match(/\.([^.]+)$/),h="";c&&(h=c[1]),i.isZip?h!="zip"&&(s=s+".zip"):h!="tgz"&&(s=s+".tgz"),xd.downloadFile(s,a)}let l=n.jsonFile;return l&&xd.downloadFileASCII(s.replace(/\.([^.]+)$/,".json"),l),n}).catch(n=>({error:(n==null?void 0:n.message)||n}))),A.messageBus.rpcService("exportOdbData",async i=>await g9e(i).then(async n=>{if(!n)return;let s=n.fileName,a=n.blob;if(a){let l=await ZI(a);return{fileInfo:i,data:l.data,error:null}}return n}).catch(n=>({error:(n==null?void 0:n.message)||n}))),A.messageBus.rpcService("pcb_IPC-D-356A",async i=>yze(i)),A.messageBus.subscribe("pcb/set-project-permission",async i=>{let{disable:n}=i;R.getInstance().isReadOnlyMode=n,wm.getInstance().refreshLayerPanel(),rE(!1),we.synchronize(),A.publish("flushSelectingInfo","")}),A.messageBus.subscribe("pcb/adaptAll",i=>{A.publish("adaptAll",i)}),A.messageBus.subscribe("createAnnotation",i=>{To.getInstance().getAuthority()&&To.getInstance().getNeedAnnotation()&&(To.getInstance().hasConnectItem()?To.getInstance().createAnnotationByItems():A.messageBus.publish("tool","draw(annotation)"))}),A.messageBus.subscribe("changeShowCanvasAnnotation",i=>{jt.setVisible(38,i.show),A.publish("updateFrame","")}),A.messageBus.rpcService("exportGerberData",async i=>await qWe(i).catch(n=>({error:(n==null?void 0:n.message)||n}))),A.messageBus.rpcService("gerberLayerConfig",()=>new Promise((i,n)=>{let s=[],a=Pe.getAllLayer(),l=[12,47,52,48,49,50,51,53,54,55,56,57],c=[],h=[];for(let d=15;d<=46;d++)c.push(d);for(let d of a)if(!l.includes(d.layerID)){let p={layerId:d.layerID,layerType:d.type,layerName:d.name,status:d.layerStatus};c.includes(d.layerID)?h.push(p):s.push(p)}let u=s.findIndex(d=>d.layerId==2);s.splice(u,0,...h),i(s)})),A.subscribe("Find",i=>{A.publish("showFindItemInBottomBar",{selectFirstRow:!1,doNotShowTable:!0,data:lce.objMatched("Component",[],[{attrName:"Designator",mode:"equal",attrValue:i[1]}])},Q())}),A.messageBus.rpcService("getAllDeviceKey",this.getAllDeviceKey.bind(this)),A.messageBus.rpcService("getBomInfo",this.getBomInfo.bind(this)),A.subscribe("printPaths",i=>{for(let n of i){let s=new Toe(n);this.debugInfo.push(s)}}),A.subscribe("hiddenDebug",this.hiddenDebug.bind(this)),A.subscribe("showDebug",this.showDebug.bind(this)),A.subscribe("rebuildDRC",i=>{if(!R.getInstance().isactive||R.getInstance().doctype!=3)return;On.getInstance().allowPull=!1;let n=new Ioe().shapes,s=re.getInstance().getMaxSafe();this.workerManager.addWorker(`editor?entry=pcb-worker.js${Q().location.search.replace(/\?/,"&")}`).publish("DRCDocument",JSON.stringify({shapes:n,ids:i,maxClearance:s}))}),A.subscribe("/worker/teardrop/progress/onclose",()=>{this.tearDropWorker&&(this.tearDropWorker.discard(),this.tearDropWorker=null)},Q()),A.subscribe("addTearDrop",async i=>{if(!(!R.getInstance().isactive||R.getInstance().doctype!=3))if(i.useWorker){On.getInstance().allowPull=!1;let n=new jI().encode();this.tearDropWorker=this.workerManager.addWorker(`editor?entry=pcb-worker.js${Q().location.search.replace(/\?/,"&")}`),i.world=n,this.tearDropWorker.publish("addTearInWorker",i)}else{i.mapData=uFe();let n=new Kae(i),s=await new Promise(l=>l(null)).then(()=>n.addTearDrop()),a=i;a.tears=s,A.publish("tearDropResult",a)}}),A.subscribe("tearDropResult",i=>{var c;console.log(1111111111111,"tearDropResult",i),this.workerManager.deleteWorker(i.workerName),On.getInstance().allowPull=!0,this.tearDropWorker=null;let n=new De("add tear drop"+i.applyScope),s=i.addTeardropAutomatically,a=(c=i.tears)==null?void 0:c.map(h=>{let u=m2(h.tear);if(!Qh(u.primitives)||!Mt.checkIsInCanEdit(u.primitives))return;let d=pt.addPolygon("TearDrop",h.layer,[],.001,h.net,!1,u);if(d.fill(),new bl(JSON.stringify({connects:h.globalIndex}),d.type).modifyComponent(d),d)return d}).filter(Boolean),l;if(!i.ignoreDRC){new oV().realtimeCheckItemsIgnoreSwitch(a);let u=ci.getInstance();l=u.hasSafeErrorIgnoreCopper.bind(u)}for(let h of a)if(l&&l(h.globalIndex))h.remove(),A.publish("delete",h);else{let u=Ce.dispatch(h,"add");s&&qe.stack!==null?qe.stack.addCommand(u):n.addCommand(u),A.publish("hasModifyPcbItem",h)}A.publish("flushService",""),n.length&&qe.executeCommand(n)}),A.messageBus.rpcService("batchFanout",async({items:i,config:n})=>{if(n.operationType==="Remove")return new mX().fanoutRemove(i),!0;let s=!1,a=[];if(i.forEach(d=>{(d instanceof Le||d instanceof ke&&d.getPads().length)&&(s=!0,a.push(d.model))}),!s)return!1;let l="batchFanout-time";Cn(l),A.publish("progressUpdate",[.05,"batchFanout"],Q());let c=new mX().getHasFanoutIds(i),h=$He(a,n,c),u=new hi;return u.addGroup(new De("batch fanout")),h.forEach(d=>{if(d.modelType=="Track"){let p=pr.addTrackByModel(d,!0);p.partition=R.getInstance().partitionId,u.addCommand4Item(p,"add")}else if(d.modelType=="Via"){let p=Wr.addViaByModel(d,!0);p.partition=R.getInstance().partitionId,u.addCommand4Item(p,"add")}else console.warn("That are not supported:",d.modelType)}),u.execute(),A.publish("progressUpdate",[1,"batchFanout"],Q()),Xi(l),!0}),A.messageBus.rpcService("drc",async i=>{console.time("drc_check"),On.getInstance().allowPull=!1,jt.setVisible(35,!0);let{items:n,option:s={}}=i;Bo.deleteByPcbItem(n),Bo.deleteAllNetLengthError(),Bo.deleteAllNetLengthToleranceError(),Bo.deleteNetlistError();let a=this.workerManager.addWorker(`editor?entry=pcb-drc-worker.js${Q().location.search.replace(/\?/,"&")}`,!0),l=new jI().encode(),c=ka.getInstance(),h=new P1().isOpenDRCCustomCheck(),u=!0;if(h&&!c.schematicNetlist.netList.enforce&&(u=!1),u){let g=R.getInstance().id,{message:y}=await A.windowBridge.rpcCall("getSchematicIdByPcbId",g,Q());if(y){let b=y;b&&(await A.windowBridge.rpcCall("compareNetList",{pcbId:g,schematicId:b},Q())).message||(u=!1)}else u=!1}let{message:d}=await a.rpcCall("DRC",{world:l,option:s}),{workerName:p}=d;if(this.workerManager.deleteWorker(p),On.getInstance().allowPull=!0,u){let g=ci.getInstance().addNetlistError(),y=new r6().decode([{type:"NetlistError",data:g}]);Bo.syncFromContentModel(y)}A.publish("progressUpdate",[1,"Design rule check"],Q()),jt.flush(),A.publish("flushSelectingInfo",""),console.timeEnd("drc_check")}),A.messageBus.rpcService("unusedLayer",async i=>{On.getInstance().allowPull=!1;let n=this.workerManager.addWorker(`editor?entry=pcb-drc-worker.js${Q().location.search.replace(/\?/,"&")}`,!0),s=new jI().encode(),{message:a}=await n.rpcCall("UnusedLayer",{world:s,netAndIds:i}),{unusedInnerLayerMap:l,workerName:c}=a;return this.workerManager.deleteWorker(c),On.getInstance().allowPull=!0,l}),A.subscribe("debug_clear_Pl",i=>{let{clearAll:n}=i;n&&g6.clear()}),A.subscribe("debug_showPl_dis",i=>{let{pls:n,layerIdOrColor:s,option:a={}}=i;a.clearAll&&g6.clear();let l=n.flatMap(c=>m2(c).primitives);g6.dis(l,s,a),g6.log(l)}),A.subscribe("creepage_debug",i=>{var h,u;let{type:n,stage:s,payload:a,timestamp:l}=i,c=(h={1:"PREPROCESS",2:"PROJECT_STARTEND",4:"PROJECT_OBSTACLES",8:"SIMPLIFY",16:"TANGENCY",32:"GRAPH_BUILD",64:"DIJKSTRA"}[s])!=null?h:"UNKNOWN";switch(n){case"validation":console.group("\u{1F50D} Creepage \u56FE\u9A8C\u8BC1"),a.valid?console.log("\u2705 \u9A8C\u8BC1\u901A\u8FC7",a.stats):(console.error("\u274C \u9A8C\u8BC1\u5931\u8D25"),console.table(a.errors),((u=a.warnings)==null?void 0:u.length)>0&&(console.warn("\u26A0\uFE0F \u8B66\u544A"),console.table(a.warnings))),console.groupEnd();break;case"visual":if(a.lines){let d=a.lines.map(p=>new M(new S(p.x1,p.y1),new S(p.x2,p.y2)));g6.dis(d)}if(a.points){let d=a.points.map(p=>new S(p[0],p[1]));g6.dis(d)}break;case"stats":console.log(`[${c}] Stats:`,a);break;case"log":console.log(`[${c}]`,a);break}}),A.subscribe("DRCResult",i=>{let n=i.workerName,s=new Coe(i.drc);this.workerManager.deleteWorker(n),On.getInstance().allowPull=!0}),A.subscribe("ratlineResultFromWorker",i=>{D9e(i)}),A.messageBus.rpcService("sutureViaDrc",async i=>{On.getInstance().allowPull=!1;let n=i.maxProgress||1,s=i.vias;for(let C of s)Bo.deleteClearanceError(C.globalIndex),Bo.deleteBlindError(C.globalIndex),Bo.deleteRadiusError(C.globalIndex);let a=i.checkSameNet,l=i.profile,c=i.layerId,u=new Qd("2.0",3).getItems(s),d=s.map(C=>C.globalIndex),p=new jI().encode(),g=await this.workerManager.addWorker(`editor?entry=pcb-drc-worker.js${Q().location.search.replace(/\?/,"&")}`,!0).rpcCall("sutureViaDRC",{world:p,ids:d,vias:u,checkSameNet:a,profile:l,layerId:c,mode:i.mode,maxProgress:n}),{errorData:y,excludeIds:b,workerName:P,hasSameNetCoppers:T}=g.message,I=new r6().decode(y);return Bo.syncFromContentModel(I),this.workerManager.deleteWorker(P),On.getInstance().allowPull=!0,A.publish("progressUpdate",[n,"Design rule check"],Q()),{filterIds:b,hasSameNetCoppers:T}}),A.messageBus.rpcService("checkHasBoardBeforeExport3DShell",this.checkHasBoardBeforeExport3DShell.bind(this)),A.messageBus.rpcService("checkHas3DPrimitiveBeforeExport3DShell",this.checkHas3DPrimitiveBeforeExport3DShell.bind(this)),A.messageBus.rpcService("Component3DData",this.get3DMangerData.bind(this)),A.subscribe("Component3DDataResult",this.modifyComponentData.bind(this)),A.messageBus.rpcService("CopperSource",()=>new _F().getAllPourResult()),A.subscribe("refreshElementFilter",()=>{A.publish("refreshHighLigth",""),jt.refreshHidden()}),A.subscribe("dealMultLayer",i=>{let n=Qt.getAllItem(),s=Wr.getAllItem();for(let l of n)ar(l.layerId)&&a(l);for(let l of s)a(l);function a(l){l.resetReadRender(),l.refreshRender()}}),A.messageBus.rpcService("pcb/decode",async i=>{if(i!==null){let n=R.getInstance(),s=new EF(n.compiler);return await s.parseSourceByCompiler(i),s.build()}return!1}),A.messageBus.rpcService("pcbRefDesignator",async({range:i,operation:n,order:s,initialRefdes:a})=>cGe(i,s,n,a)),A.messageBus.rpcService("pcbClearDesignator",async({range:i})=>hGe(i)),A.messageBus.rpcService("pcbResetUniqueId",()=>{uGe()}),A.messageBus.rpcService("pcb/getPanelizeConfig",i=>si.getInstance().getDefaultPanelize()),A.messageBus.rpcService("pcb/exportFlyingProbeFile",async({pcbTitle:i})=>{let{fileContent:n}=await LX(),s=iWe(i),a=VX({[s]:Hy(n)},{level:6}),l=new Blob([a],{type:"application/zip"});return s=s.replace(/\.json$/,".zip"),{fileContent:l,fileName:s}});let e={},r=null;A.subscribe("clearSupplierPart",i=>{e[i.id]=i,r!=null&&clearTimeout(r),r=setTimeout(()=>{let n=R.getInstance().tabId,s=[],a=[];for(let l in e){let c=e[l],h=`${c.designator}(${c["Supplier Part"]})`;s.push(h);let u={attr:{id:c.id,pcbid:n},text:h};a.push(u)}A.publish("ui/toastMsg",{type:"info",msg:['Component have been modified the property "Value", the property "Supplier Part" was cleared by automatically:',...s],bottomBarMsg:{type:"info",msg:['<span class="i18n">Component have been modified the property "Value", the property "Supplier Part" was cleared by automatically:</span>',...a]}},Q()),e={},r=null},0)}),A.messageBus.rpcService("pro-pcb/pcbEncodeForWorld",i=>{let{tabId:n}=i||{},s=R.getInstance();if(!([23].includes(s.doctype)||(n?s.tabId!=n:!s.isactive)))return new jI().encode()}),A.subscribe("exportIDF",()=>{!R.getInstance().isactive||23==R.getInstance().doctype||new tle().exportIDFFile()}),A.messageBus.subscribe("pcb/updateTitle",i=>{R.getInstance().name=i}),A.messageBus.rpcService("pcb_IPC2851C",async i=>Pze(i)),A.messageBus.rpcService("exportIpc2581c",async i=>{Rze(i)}),A.messageBus.rpcService("pcb_getComponentAttr",async()=>{let i=new Set,n=Ar.getAllItem();for(let s of n){let a=Object.keys(s.attrKeyValue);for(let l of a)i.add(l)}return Array.from(i)}),A.subscribe("importAutoRouteRes",()=>{!R.getInstance().isactive||23==R.getInstance().doctype||new RV(".json",function(i){let n=i[0];DV(n).then(s=>{try{let a=JSON.parse(s.content);if(a.board||a.json){let l=a.json||a;Kb.previewJsonInCanvas(l)}else{let l=a;l.finish=!0,Kb.routerReady(),Kb.routerResult(l)}}catch(a){A.messageBus.publish("message",{type:"error",message:a})}},function(s){A.messageBus.publish("message",{type:"error",message:s})})})}),A.messageBus.rpcService("pcb/importAutoRouteFile",async i=>{let n=await DV(i);try{let s=JSON.parse(n.content);if(s.board||s.json){let a=s.json||s;Kb.previewJsonInCanvas(a)}else{let a=s;a.finish=!0,Kb.routerReady(),Kb.routerResult(a)}}catch{return!1}return!0}),A.messageBus.rpcService("pcb/importAutoRouteSesFile",async i=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return!1;try{return await kze(i)}catch(n){return console.error("\u5BFC\u5165\u5931\u8D25",n),!1}}),A.messageBus.rpcService("pcb/autoRouterRules",i=>new Promise((n,s)=>{var a;n((a=re.getInstance().getDefaultAutoRouter())==null?void 0:a.config)})),A.subscribe("pcb/updateAutoRouterRule",i=>{!R.getInstance().isactive||23==R.getInstance().doctype||!i||!i.config||(!i.name||i.isDefault?re.getInstance().getDefaultAutoRouter().updateConfig(i.config):re.getInstance().addAutoRouter(i.name,i.config))},Q()),A.subscribe("exportSpecctraFile",async()=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;A.publish("progressUpdate",[.1,"exportAutoRouterDSN"],Q());let i=await new Promise(n=>{setTimeout(async()=>{let s=await VS.exportDSN(Kb.getConfig(),R.getInstance().name);n(s)},20)});if(A.publish("progressUpdate",[.9,"exportAutoRouterDSN"],Q()),!i){A.publish("progressUpdate",[1,"exportAutoRouterDSN"],Q());return}await VS.saveFile(i),A.publish("progressUpdate",[1,"exportAutoRouterDSN"],Q())}),A.messageBus.rpcService("exportSpecctraFileRPC",async()=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return null;A.publish("progressUpdate",[.1,"exportAutoRouterDSN"],Q());let i=await new Promise(n=>{setTimeout(async()=>{let s=await VS.exportDSN(Kb.getConfig(),R.getInstance().name);n(s)},20)});return A.publish("progressUpdate",[.9,"exportAutoRouterDSN"],Q()),i?(A.publish("progressUpdate",[1,"exportAutoRouterDSN"],Q()),{dataStr:i}):(A.publish("progressUpdate",[1,"exportAutoRouterDSN"],Q()),null)}),A.subscribe("importSpecctraSession",()=>{!R.getInstance().isactive||23==R.getInstance().doctype||Nze()})}modifyComponentData(t){this.logger.debug1("=============PCB \u63A5\u6536\u52303D\u7BA1\u7406\u5668\u8FD4\u56DE\u6570\u636E==============="),this.logger.debug2(t);let e=t.selectedDeviceList,r=new De("update component 3d model data");if(e!=null&&Array.isArray(e))for(let i of e){let n=i.id,s=Ar.getItem(n);if(s!=null){r.addCommand(Ce.dispatch(s,"modify")),s.modifyATTRMap("3D Model",i.i3DModelId||""),s.modifyATTRMap("3D Model Title",i.i3DModelName||""),s.modifyATTRMap("3D Model Transform",i.transform||"");let a=s.attrKeyText["3D Model"];a!=null&&(a.value=s.attrKeyValue["3D Model"]);let l=s.attrKeyText["3D Model Title"];l!=null&&(l.value=s.attrKeyValue["3D Model Title"]);let c=s.attrKeyText["3D Model Transform"];c!=null&&(c.value=s.attrKeyValue["3D Model Transform"])}}r.length>0&&qe.executeCommand(r),A.publish("flushSelectingInfo","")}get3DMangerData(){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let t=Ar.getAllItem(),e=ze.getComponents(),r=new Array,i=R.getInstance().isReadOnlyMode;for(let n of t){let s=n.globalIndex,a=n.name,l=n.device,c=n.deviceUUID,h=n.footprintId,u=n.footprintUUID,d=n.attrKeyValue["3D Model Title"],p=n.attrKeyValue["3D Model"],m=n.attrKeyValue["3D Model Transform"],g=!1;e.indexOf(n)>-1&&(g=!0);let y=n.partition,b=Hi.getItem(n.footprintUUID),P=b.getSource(),T=b.getOrigin(),I=n.attrKeyValue,C={id:s,designator:a,deviceName:l,deviceId:c,footprintName:h,footprintId:u,i3DModelName:d,i3DModelId:p,transform:m,isSelected:g,dataStr:P,canvasOrigin:T,attrs:I,disabledRow:i||y!==""};r.push(C)}return r}checkHasBoardBeforeExport3DShell(){return m6.getOneOutline()!=null}checkHas3DPrimitiveBeforeExport3DShell(){return!!B6.filterD3Shell(Array.from(B6.getAllItems())).length}getAllDeviceKey(){let t=Ar.getAllItem(),e=new Set;return t.forEach(r=>{let i=r.attrKeyValue;for(let n in i)e.add(n)}),Array.from(e)}getBomInfo(){let t=Ar.getAllItem(),e=new Array;return t.forEach(r=>{let i=Ss(r.attrKeyValue);i.Name=r.getFormulaName(),i.Layer=r.layerId===1?"T":"B",i.Device=r.deviceUUID,i["Mounting Style"]="SMT";let n=r.getPads(),s=new Array;n.forEach(l=>{let c={num:l.num};l.model.layerId===12&&(i["Mounting Style"]="DIP"),s.push(c)});let a={attrs:i,displayDevice:r.device,displayFootPrint:r.footprintId,displaySymbolName:"",partId:null,pins:s};e.push([a])}),e}toggleElementFilter(t){if(!R.getInstance().isactive||R.getInstance().doctype!==3)return;let e=t.primitive;e.value=="all"?jt.setElement(0,e.isChecked,e.isVisible,e.group):jt.setElement(parseInt(e.value),e.isChecked,e.isVisible)}tearDropDialog(){!R.getInstance().isactive||R.getInstance().doctype!==3||A.publish("openMainDialog",{cmd:24})}docNeedUpdate(t){we.docNeedUpdate=t}hiddenDebug(t){this.debugInfo.forEach(e=>{e.info.num==t&&e.hidden()})}showDebug(t){this.debugInfo.forEach(e=>{e.info.num==t&&e.show()})}rebuildCopper(t){if(le.pcbConfig.isRebuildCopperAuto&&!(t!=null&&t.isManual)||(ZHe.main(),!R.getInstance().isactive||R.getInstance().doctype!=3))return;let e="rebuildAllCopper-time";Cn(e);let r=t==null?void 0:t.autoSave;if(r!=null&&(this.autoSave=r),this.buildingCopperMap.has("all"))return;if(vR().length==0){Xi(e);return}On.getInstance().allowPull=!1,A.windowBridge.publish("pcbUpdateProgress",{ratio:0,descripte:"copper"},Q());let n=new j6([],!0);this.buildingCopperMap.add("all");let s=this.workerManager.addWorker(`editor?entry=pcb-worker.js${Q().location.search.replace(/\?/,"&")}`),a=JSON.stringify(n.encode());function l(c,h){s.rpcCall("pourDocument",c).then(u=>{h.buildCopper(u.message,void 0,!le.pcbConfig.isRebuildCopperAuto),h.buildingCopperMap.delete("all"),On.getInstance().allowPull=!0,Xi(e)})}l(a,this),a=null}RebuildCopperResult(t){if(!R.getInstance().isactive||R.getInstance().doctype!=3||Array.isArray(t)&&t.length==0||le.pcbConfig.isRebuildCopperAuto&&!t.isManual)return;let e="rebuildSelectedCopper-time";Cn(e);let r=new Set,i=[];t.id.map(a=>Ti.getItem(a)).filter(a=>!!a).forEach(a=>{if(a instanceof Jr){let l=a.getParent();if(!l){i.push(a);return}r.has(l.globalIndex)||(r.add(l.globalIndex),i.push(l));return}i.push(a)}),i.forEach(a=>{a.click()}),A.publish("select",i),!this.rebuildSingleCopper({ids:Array.from(r),isLast:!1,isManual:t.isManual})&&Xi(e)}rebuildSingleCopper(t){if(le.pcbConfig.isRebuildCopperAuto&&!t.isManual)return;if(!R.getInstance().isactive||R.getInstance().doctype!=3)return!1;let{ids:e,isLast:r}=t;if(Array.isArray(e)&&e.length==0)return!1;for(let l of this.buildingCopperMap)if(l!="all"){let c=!0;if(l.isLast==t.isLast&&t.ids.length==l.ids.length){for(let h=0;h<l.ids.length;h++)if(t.ids[h]!=l.ids[h]){c=!1;break}}else c=!1;if(c)return!1}On.getInstance().allowPull=!1;let i="rebuildSelectedCopper-time";Cn(i,!0),A.windowBridge.publish("pcbUpdateProgress",{ratio:0,descripte:"copper"},Q());let n=new j6(e,!1);this.buildingCopperMap.add(t);let s=this.workerManager.addWorker(`editor?entry=pcb-worker.js${Q().location.search.replace(/\?/,"&")}`),a=JSON.stringify(n.encode());return s.rpcCall("pourDocument",a).then(l=>{this.buildCopper(l.message,r,!le.pcbConfig.isRebuildCopperAuto),this.buildingCopperMap.delete(t),On.getInstance().allowPull=!0,Xi(i)}),a=null,!0}buildCopper(t,e=!1,r=!0){if(!R.getInstance().isactive||R.getInstance().doctype!=3)return;let i=JSON.parse(t),n=i.workerName;this.workerManager.deleteWorker(n),On.getInstance().allowPull=!0;let s=i.pours,a=new Jt,l=r?e&&qe.stack?qe.stack:new De("rebuild copper"):null,c=new Array;for(let P in s){let T=s[P];if(!T.needCopper)continue;let I=a.getItem(P);if(!(I instanceof He))continue;let C=I.getComponent();C instanceof xn&&(C.copperResult=T.paths,l&&Ce.dispatchCoppers(I,"delete",l),I.fillCopper(),c.push(I),A.publish("hasModifyPcbItem",I),I.refreshRender())}console.time("generate thermal");let h=new wF(new ef(new X6)),u=Object.keys(s);u.forEach(P=>h.generateThermal(P)),h.removeIsland(u).forEach(P=>{let T=Ti.getItem(P),I=a.getItem(T.getParent().globalIndex);T.remove(),I.deleteCopperById(P),A.publish("delete",T)});let p=h.getResult(),m=qo.getInstance();if(h.complete(),p.forEach(P=>{let T=P.getParent();T.deleteCopper(P.globalIndex),m.delete(P,P.globalIndex);let I=nr();P.globalIndex=I,T.addCopper(I),m.addModel(P),a.getItem(P.getParent().globalIndex).addNewCopperModel(P)}),console.timeEnd("generate thermal"),l)for(let P of c)Ce.dispatchCoppers(P,"add",l);r?!e&&l.length>0&&(l.setCheckFilter(!1),qe.executeCommand(l)):Jle(c),jt.getVisible(21)||A.publish("showPcbSlideMsg",['Copper pour completed! Please set the "Copper Region(Filled)" to visible in the "Right Hand Panel - Filter - Display".'],Q());let y=ze.getItems().filter(P=>!P.isEmpty);A.publish("select",y),this.autoSave||A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),A.publish("flushService","");let b=Ti.getAllItem();this.autoSave&&(b.length>0&&A.windowBridge.rpcCall("save",{tabId:R.getInstance().tabId},Q()),this.autoSave=!1),console.timeEnd()}buildPlaneCopper(t,e=!0){if(!R.getInstance().isactive||R.getInstance().doctype!=3)return;sy.getInstance().set("Main");let r=JSON.parse(t),i=r.workerName;i!=null&&this.workerManager.deleteWorker(i);let n=r.pours,s=r.ids,a=r.layers,l=r.nets,c=r.styles,h=e?new De("rebuild plane zone"):null,u=zn.getAllItem(),d={},p=new Set,m=new Map;u.forEach(E=>{if(!this.rebuildPlaneLayerObserver||this.rebuildPlaneLayerObserver.has(E.layerId)){let O=re.getInstance().getRegion(E.globalIndex);O&&O.innerPlane&&(d[E.globalIndex]=O.innerPlane);let _=m.get(E.layerId);_||(_=[],m.set(E.layerId,_)),_.push(E)}});for(let[E,O]of m){h?Ce.dispatchPlanezones(O,"delete",h):p.add(E);for(let _ of O)_.remove(),A.publish("delete",_)}for(let E=0,O=n.length;E<O;E++){let _=zn.addCopper(a[E],l[E],!0,n[E]);A.publish("hasModifyPcbItem",_);let x=d[s[E]];if(x!=null){let v=re.getInstance().addRegionSelector(_.globalIndex);v.innerPlane=x,Pp.getInstance().publish("modify",v)}}let g=zn.getAllItem();g=g.filter(E=>!a.length||a.indexOf(E.layerId)>=0);let y=new Koe(new ef(new X6));g.forEach(E=>{a.indexOf(E.layerId)>=0&&y.generateThermal(E.globalIndex)});let b=y.getResult();SGe(b);let P={};g.forEach(E=>{let O=String(E.layerId);P[O]||(P[O]=[]),P[O].push(E)});let T=[];Object.keys(P).forEach(E=>{let O=[],_=!0,x=[];P[E].forEach(D=>{y.isTheraml(D.model)||x.push(D.model)});let v=y.getIslandsByCoppers(x);if(v.length!=x.length&&(_=!1),v.forEach(D=>{O.push(zn.getItem(D.globalIndex))}),_){P[E].shift(),T=[].concat(T,P[E]);return}T=[].concat(T,O)}),y.complete(),T.forEach(E=>{let O=Pd.fetchProfileItem(E.layerId);(!O||!O.keepIsland)&&EGe(E)});let I=zn.getAllItem();for(let E in zn.layerMapSet){let O=parseInt(E);if(a.indexOf(O)>=0){let _=Array.from(zn.layerMapSet[E]||[]);h?Ce.dispatchPlanezones(_,"add",h):p.add(O);for(let x of _)A.publish("hasModifyPcbItem",x)}}let C=ze.getItems();if(C.length>0){let E=C.filter(O=>!O.isEmpty);A.publish("select",E)}h?qe.executeCommand(h):Dze(p),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),A.publish("flushService",""),A.publish("flushSelectingInfo","")}async parseDevice(t){return await ts.add(t,R.getInstance().compilerChannel)}rebuildPlanezone(t){if(le.pcbConfig.isRebuildCopperAuto&&!t.isManual)return;let e="rebuildAllPlaneZone-time";Cn(e);let r=t.data.id;if(Array.isArray(r)){let i=new Set;r.forEach(n=>{let s=zn.getItem(n);s!=null&&i.add(s.layerId)}),A.publish("rebuildSinglePlane",{message:Array.from(i),isManual:t.isManual})}else{let i=zn.getItem(r);i!=null&&A.publish("rebuildSinglePlane",{message:[i.layerId],isManual:t.isManual})}Xi(e)}buttonCommand(t){var e;if(!(!R.getInstance().isactive||R.getInstance().doctype!==3)){if(t.action=="rebuildCopperArea"){let r=t.data.id;Array.isArray(r)?A.publish("rebuildSingleCopper",{ids:r,isLast:!1,isManual:!0}):A.publish("rebuildSingleCopper",{ids:[r],isLast:!1,isManual:!0})}else if(t.action=="rebuildCopperAreaByResult"){let r=t.data.id;Array.isArray(r)?A.publish("RebuildCopperResult",{id:r,isManual:!0}):A.publish("RebuildCopperResult",{id:[r],isManual:!0})}else if(t.action=="autoPlaceSutureVias"){let r=t.data.ids,i=re.getInstance().getDefaultRadiusPhysics(),n=i.defalutRadius,s=i.defalutInner,a=ut.defaultSutureVia.lineSpacing,l=ut.defaultSutureVia.columnSpacing;A.publish("openMainDialog",{cmd:40,data:{option:{ids:r,radius:n,innerRadius:s,lineSpacing:a,columnSpacing:l}}})}else if(t.action=="rebuildPlanezone")t.isManual=!0,this.rebuildPlanezone(t);else if(t.action=="callFootprintDialog"){let r=t.data.attrId,n=new Jt().getItem(r);if(n!=null&&n instanceof _i){let s=n.getParent();s!=null&&s instanceof ke&&(n=s)}n!=null&&n instanceof ke&&A.publish("openMainDialog",{cmd:10,data:{device:n}})}else if(t.action=="netSelect")A.publish("toggle",{command:"netSelect",pcbBridgingCopperIndex:(e=t.data)==null?void 0:e.pcbBridgingCopperIndex});else if(t.action=="differentailNetSelect")A.publish("toggle",{command:"differentailNetSelect",formData:t.formData,type:t.type});else if(t.action=="PadsPairPadSelect")A.publish("toggle",{command:"PadsPairPadSelect",formData:t.formData});else if(t.action=="selectDatumLine"){let r=t.data.id;Array.isArray(r)||(r=[r]);let i=new hi;i.createGroup("modify DaTumLine of 3D REGION"),Fc.toggleTool(),Fc.setGroup(i.getCommand()),Fc.setOnceCallback(()=>{A.publish("tool","dropdrag")});for(let n of r){let s=Xt.getItem(n)||Kt.getItem(n)||pt.getItem(n);s!=null&&(Fc.addItem(n),i.addCommand4Item(s,"modify"))}}else if(t.action=="editPadShape"){let r=ze.getSelects();r.length==1&&r[0]instanceof sn&&A.publish("tool","editPadShape")}else if(t.action=="recoverFootprint"){let r=new De("recover footprint"),i=t.data.id,n=new Jt;if(Array.isArray(i))for(let s of i){let a=n.getItem(s);a instanceof ke&&aq(a,r)}else{let s=n.getItem(i);s instanceof ke&&aq(s,r)}r.length>0&&qe.executeCommand(r),A.publish("flushService","")}else if(t.action=="convertToFillRegion"){let r=[],i=[pt,Ti,Xt,Kt];for(let n of t.data.ids)for(let s of i){let a=s.getItem(n);if(a){r.push(a);break}}ice("CONVERT_TO_FILL_REGION",r)}else if(t.action=="addSolderMaskRegion")ze.addSolderMaskRegionByTeardrop();else if(t.action=="parentSelect"){let{data:r}=t;if(!r||!r.ids||!r.ids.length)return;ze.selectParentOfCopperResult(r.ids)}}}openCopperDialog(){!R.getInstance().isactive||R.getInstance().doctype!==3||A.publish("openMainDialog",{cmd:2})}openPadLenDialog(){!R.getInstance().isactive||R.getInstance().doctype!==3||A.publish("openMainDialog",{cmd:46})}openDesignRuleDialog(t){this.logger.debug3("%s %s","===========================>>>",t),!(!R.getInstance().isactive||R.getInstance().doctype!==3)&&A.publish("openMainDialog",{cmd:5,data:{option:t}})}openBatchFanoutDialog(t){!R.getInstance().isactive||R.getInstance().doctype!==3||(A.publish("tool","dropdrag"),A.publish("openMainDialog",{cmd:6,data:{option:t}}))}openEditPadsPairGroupDialog(t){this.logger.debug3("%s %s","===========================>>>",t),!(!R.getInstance().isactive||R.getInstance().doctype!==3)&&A.publish("openMainDialog",{cmd:41,data:{option:t}})}openAutoPlaceTestPadDialog(){!R.getInstance().isactive||R.getInstance().doctype!==3||A.publish("openMainDialog",{cmd:47})}insertImage(t){!R.getInstance().isactive||R.getInstance().doctype!==3||A.publish("openMainDialog",{cmd:14,data:{data:t}})}needUpdateFootprint(t){t.forEach(e=>{let r=Hi.getItem(e);le.showUpdateBox&&r!=null&&r.components.forEach(i=>{let n=Ar.getItem(i.globalIndex);n.updateView=!0,n.refreshRender()})}),A.publish("updateFrame","")}};function Xze(){he.messageBus.rpcService("getFootprintPng",async o=>(await he.messageBus.rpcCall("loadFootprint",o),Mo.modify(),om.scene.getCaptureImageData1(o.width,o.height,()=>he.publish("adaptAll",""),()=>he.publish("adaptAll",""))))}function cce(o,t){let e=vvt(o,t);return e?(A.windowBridge.rpcCall("createSubPcb",e,Q()),!0):!1}function vvt(o,t,e,r){let i=bo.getInstance().getItemById(o);if(!Rvt(i))return i.remove(),A.publish("delete",i),!1;let n=i.buildBBox(),s=i.getMathGraphics(i.layerId),a=kt.search4Types(n,dY),l=new Array,c=a.getAllItems().filter(d=>{let p=d.getParent();return d!=i&&(p==null||d instanceof Le)});for(let d of c)if(!d.isEmpty&&d.buildBBox().relation(n)!=1){let p=d instanceof Ge?ge.build2([d.primitive]):d.getMathGraphics(d.layerId),m=new Xl(s,p,0);m.relation==1?l.push(d):m.relation==0&&d instanceof Ge&&xvt(d,i,t,l)}let h=[];return l.forEach(d=>{t.addCommand(Ce.dispatch(d,"modify")),d.partition=i.globalIndex,h.push(d),A.publish("hasModifyPcbItem",d)}),r=r||Tm(),t.addCommand(Ce.dispatch(i,"modify")),i.model.component.fileUuid=r,A.windowBridge.rpcCall("save",{tabId:R.getInstance().tabId},Q()),A.subscribe("refreshPcbItemView",()=>{let d=bo.getInstance().getAllItem(),p=h.length?h.concat(...d):d;z3e(p)},Q()),bo.getInstance().syncPartitionStatus(),{mainPcbUuid:R.getInstance().id,newSubPcbUuid:r,oldSubPcbUuid:e,id:o,title:i.model.component.name}}function z3e(o=[]){if(!(o!=null&&o.length)){let t=Kc();o.push(...t)}o.forEach(t=>{t instanceof He&&t.iteratorCopper(e=>{e.refreshRender()}),t.refreshRender()}),A.publish("updateFrame","")}function xvt(o,t,e,r){let i=t.getMathGraphics(t.layerId),n=o.primitive,s=[];for(let d of i.primitives){let p=Pt(n,d);for(let m=0;m<p;m+=2){let g=new S(Ee[m],Ee[m+1]);s.push(g)}}if(!s.length)return;s=an(s,n);let a=[].concat([n.start()],s,[n.end()]),l=[a[0]];for(let d=1;d<a.length;d++){let p=a[d-1],m=a[d];p.equals1(m)||l.push(m)}let c=new Array;for(let d=1;d<l.length;d++){let p=l[d-1],m=l[d],g;if(n instanceof M)g=pr.addTrack(o.layerId,p,m,o.width,o.locked,o.net);else{let y=p.angle(n.center),b=m.angle(n.center);g=pr.addArcTrack(o.layerId,o.center,o.radius,y,b,n.sweep(),o.width,o.locked,o.net,o.arcType)}t.model.isInside(g.midPoint)&&r.push(g),c.push(g),e.addCommand(Ce.dispatch(g,"add"))}let h=pt.getTears(o.globalIndex),u=new Map;if(h instanceof Set){for(let d of h)if(d){let p=Dvt(n,d.getMathGraphics());p&&u.set(p,d)}}if(u.size){let d=an([].concat(l,Array.from(u.keys())),n);for(let p=1;p<l.length;p++){let m=d.indexOf(l[p-1]),g=d.indexOf(l[p]);for(let y=m;y<=g-m;y++){let b=u.get(d[y]);if(b){e.addCommand(Ce.dispatch(b,"modify"));let P=b.component.connects,T=P.indexOf(o.globalIndex);T>=0&&P.splice(T,1,c[p-1].globalIndex)}}}}e.addCommand(Ce.dispatch(o,"delete")),o.remove(),A.publish("delete",o)}function Rvt(o){let t=bo.getInstance().getAllItem().filter(i=>i!=o),e=o.getMathGraphics(o.layerId),r=!1;for(let i of t){let n=i.getMathGraphics(i.layerId);if(n.bbox().isSeparated(e.bbox()))continue;if(new As(e,n,0).relation!=3){r=!0;break}}if(r){let i={value:"It is detected that the {name} partition overlaps with other partitions, and the sub-picture cannot be separated",options:{name:o.model.component.name}};return A.publish("ui/toastMsg",{type:"warn",msg:i,bottomBarMsg:{type:"warn",msg:[mz(i.value,{params:i.options})]}},Q()),!1}return!0}function Dvt(o,t){for(let e of t.primitives)if(e instanceof M&&Pt(o,e)>=2)return new S(Ee[0],Ee[1])}var Y3e=["Polygon","Rect","Circle"],wvt=["Length Dimension","Radius Dimension","Protractor Dimension"],Lvt=["Component","Image","Length Dimension","Radius Dimension","Protractor Dimension","Text","Rect","Polygon","Circle"],MV=class{constructor(){this.attrs=new Set;this.padNet=new Set;this.componentMap=new Map;this.dimensionMap=new Map;this.imageMap=new Map;this.tearMap=new Map;this.strMap=new Map;this.attrMap=new Map;this.polyAndFillMap=new Map;this.reuseBlocks=new Map;this.pouredMap=new Map;this.proxy=null;this.attrUtils=null}setProxy(t){this.proxy=t}setAttrUtils(t){this.attrUtils=t}onNumber(t,e,r){let i=this.getModelBy(t,e);return i!=null?(i.number=r,!0):!1}getProfile(t){for(let e of Y3e){let r=this.getModelBy(e,t);if(r!=null)return r}return null}getDimension(t){for(let e of wvt){let r=this.getModelBy(e,t);if(r!=null)return r}return null}getSilkItem(t){for(let e of Lvt){let r=this.getModelBy(e,t);if(r!=null)return r}return null}getModelBy(t,e){return this.proxy!=null?this.proxy.getModelBy(t,e):eA(t,e)}getLayer(t){return this.proxy!=null?this.proxy.getLayer(t):Ze.getInstance().getLayer(t)}getLayerPhy(t){return this.proxy!=null?this.proxy.getLayerPhy(t):Ze.getInstance().getLayerPhy(t)}getNetModel(t){return this.proxy!=null?this.proxy.getNetModel(t):re.getInstance().getNet(t)}getCombination(t){return this.proxy!=null?this.proxy.getCombination(t):Xd.getInstance().getItem(t)}setLayerDecode(t){let e=this.getLayer(t.layerId);return e!=null?(t.model=e,t.load()):e=t.finish(),this.proxy!=null&&this.proxy.addLayer(e,t),e}setLAYER_PHYS(t){let e=this.getLayerPhy(t.layerId);return e!=null?(t.model=e,t.load()):e=t.finish(),this.proxy!=null&&this.proxy.addLayerPhy(e,t),e}setNet(t){let e=this.getNetModel(t.name);return e!=null?(t.model=e,t.load()):e=t.finish(),this.proxy!=null&&e!=null&&this.proxy.addNet(e),e}setPrimitive(t){}setGroup(t){let e=this.getCombination(t.id);return e!=null?(t.model=e,t.load()):e=t.finish(),this.proxy!=null&&this.proxy.addCombination(e),e}addModel(t,e){this.proxy!=null&&t!=null&&this.proxy.addModel(t,e)}loadModel(t,e){let r=this.getModelBy(t,e.index);return r!=null?(e.model=r,e.netModifyInter=this.proxy,e.load()):r=e.finish(),this.addModel(r,e),r}setVia(t){return this.loadModel("Via",t)}setPad(t){return this.loadModel("Pad",t)}setLine(t){return this.loadModel("Track",t)}setArc(t){return this.loadModel("ArcTrack",t)}loadProfile(t){let e=this.getProfile(t.index);return e!=null?(t.model=e,t.netModifyInter=this.proxy,t.load()):e=t.finish(),this.addModel(e,t),e}setFill(t){return this.loadProfile(t)}setFPCFill(t){return this.loadProfile(t)}setPoly(t){return this.loadProfile(t)}setRegion(t){return this.loadProfile(t)}setPartition(t){return this.loadProfile(t)}setPour(t){let e=this.loadProfile(t),r=this.pouredMap.get(t.index);return r&&(this.loadPoured(r,e),this.pouredMap.delete(t.index)),e}setPoured(t){if(t.index!=null){let e=this.getProfile(t.index);e?this.loadPoured(t,e):this.pouredMap.set(t.index,t)}}setInner(t){if(!t.resultNeedToBeCached)return;let e=new Set,r=t.coppers;for(let n of r)e.add(n.index);let i=Xo.getInstance().layerMapSet[t.layerId]||[];for(let n of i)e.has(n.globalIndex)||this.deleteModel("Inner",n.globalIndex);for(let n of r)this.loadModel("Inner",n)}deleteInner(t){let e=Xo.getInstance().layerMapSet[t];for(let r of e)this.deleteModel("Inner",r.globalIndex)}loadPoured(t,e){t.finish1(e);let r=new Set,i=t.coppers;for(let n of i)r.add(n.index);e.iteratorCopper(n=>{r.has(n)||this.deleteModel("Copper",n)});for(let n of i)this.loadModel("Copper",n)}setImage(t){return this.loadModel("Image",t)}loadObj(t,e){let r=this.getModelBy(t,e.index);return r!=null?(e.model=r,e.netModifyInter=this.proxy,e.load()):r=e.finish(),this.addModel(r,e),r}async loadBlob(t){await t.finish()}async setObj(t){return this.loadObj("Picture",t)}async setBlob(t){return await this.loadBlob(t)}setBoard(t){this.proxy.modifyBoard(t)}deleteBoard(){this.proxy.deleteBoard()}setTeardrop(t){return this.loadProfile(t)}setFont(t){t.finish()}setString(t){return this.loadModel("Text",t)}setReuseBlock(t){let e=this.getModelBy("Component",t.shapeIndex);e!=null?(e.combinationID=t.groupId,e.channelID=t.channelId):this.reuseBlocks.set(t.shapeIndex,t)}async deleteAttr(t){if(this.attrUtils==null)return this.deleteModel("Text",t);let e=this.getModelBy("Text",t);if(e){let r=e.getParent(),i=this.getModelBy("Component",r.globalIndex);if(i instanceof Bi){this.attrUtils.deleteAttr(e,i);return}}return this.deleteModel("Text",t)}async setAttr(t){var e;if(this.attrUtils==null)return this.loadAttr("Text",t);if(t.key=="Device"){let r=this.getModelBy("Component",t.parentIndex);if(r==null)return this.attrUtils&&await this.parseFootAndDeviceByAttr(t),this.addAttr(t);if(r.deviceUUID==t.value)return this.loadAttr("Text",t,r);await this.replaceAttr(r,t)}else if(t.key=="Footprint"){let r=this.getModelBy("Component",t.parentIndex);if(r==null)return this.attrUtils&&await this.parseFootAndDeviceByAttr(t),this.addAttr(t);if(r.footprintUUID==t.value)return this.loadAttr("Text",t,r);await this.replaceAttr(r,t)}else{let r=this.getModelBy("Component",t.parentIndex);if(r==null)return this.addAttr(t);{let i=this.loadAttr("Text",t,r);return r.addAttribute(i),(e=this.proxy)==null||e.bindParent(i,r),i}}}setAttrSync(t){var r;if(this.attrUtils==null)return this.loadAttr("Text",t);let e=this.getModelBy("Component",t.parentIndex);if(t.key=="Device"){if(e&&e.deviceUUID==t.value)return this.loadAttr("Text",t,e)}else if(t.key=="Footprint"){if(e&&e.footprintUUID==t.value)return this.loadAttr("Text",t,e)}else{if(e==null)return this.addAttr(t);{let i=this.loadAttr("Text",t,e);return e.addAttribute(i),(r=this.proxy)==null||r.bindParent(i,e),i}}return null}loadAttr(t,e,r){let i=this.getModelBy(t,e.index);return i!=null?(e.model=i,e.netModifyInter=this.proxy,e.load(),this.attrUtils&&r!=null&&this.attrUtils.loadAttr(e,r)):i=e.finish(),this.addModel(i,e),i}async parseFootAndDeviceByAttr(t){this.attrUtils!=null&&await this.attrUtils.parseFootAndDeviceByAttr(t)}async replaceAttr(t,e){this.attrUtils!=null&&await this.attrUtils.replaceAttr(t,e)}addAttr(t){let e=this.componentMap.get(t.parentIndex);if(e!=null){if(e.addAttribute(t),e.canBuild()){let r=e.finish();if(r!=null)return this.componentMap.delete(t.parentIndex),this.addModel(r,t),r}}else this.attrs.add(t)}addDimension(t){let e=t.finish();return this.addModel(e,t),e}setDimension(t){let e=this.getDimension(t.index);if(e!=null)t.model=e,t.load();else return this.addDimension(t);return this.addModel(e,t),e}addComponent(t){let e=new Set;for(let i of this.attrs)i.parentIndex==t.index&&(t.addAttribute(i),e.add(i));for(let i of e)this.attrs.delete(i);let r=new Set;for(let i of this.padNet)i.parentIndex==t.index&&(t.addPadNet(i),r.add(i));for(let i of r)this.padNet.delete(i);if(t.canBuild()){let i=t.finish();if(i!=null)return this.addModel(i,t),i}return this.componentMap.set(t.index,t),null}setComponent(t){let e=this.getModelBy("Component",t.index);if(e!=null)t.model=e,t.load();else return this.addComponent(t);return this.addModel(e,t),e}addPadNet(t){let e=this.componentMap.get(t.parentIndex);if(e!=null){if(e.addPadNet(t),e.canBuild()){let r=e.finish();if(r!=null)return this.addModel(r,t),this.componentMap.delete(e.index),r}}else this.padNet.add(t);return null}setPadNet(t){let e=this.getModelBy("Component",t.parentIndex);if(e!=null){let r=this.getModelBy("Pad",t.getPadId())||this.getModelBy("Via",t.getPadId());return t.parentModel=e,t.model=r,t.netModifyInter=this.proxy,t.load(),this.addModel(r,t),r}else return this.addPadNet(t)}setSHell(t){return this.loadProfile(t)}setSHellCut(t){return this.loadProfile(t)}setShellEntity(t){return this.loadProfile(t)}setCrease(t){return this.loadProfile(t)}setBoss(t){return this.loadProfile(t)}setRuleTemplate(t){t.load()}setRule(t){if(!t.resultNeedToBeCached)return;let e=t.finish();this.proxy!=null&&e!=null&&this.proxy.addRule(e)}getRuleSelector(t){return this.proxy!=null?this.proxy.getRuleSelector(t.select):GY(t.select)}setRuleSelector(t){if(!t.resultNeedToBeCached)return;let e=this.getRuleSelector(t);return e!=null?(t.model=e,t.load()):e=t.finish(),this.proxy!=null&&e!=null&&this.proxy.addRuleSelector(e),e}setEqlenGrp(t){if(!t.resultNeedToBeCached)return;let e=re.getInstance().getPadsPairGroupItemByGroupName(t.groupName);return e!=null?(t.model=e,t.load()):e=t.finish(),this.proxy!=null&&e!=null&&this.proxy.addRuleSelector(e),e}addPanelize(t,e){this.proxy!=null&&t!=null&&this.proxy.addPanelize(t,e)}setPanelize(t){if(!t.resultNeedToBeCached)return;let e=si.getInstance();if(e)return t.model=e,t.load(),this.addPanelize(e,t),e}setPanelizeStamp(t){if(!t.resultNeedToBeCached)return;let e=si.getInstance();if(e)return t.model=e,t.load(),this.addPanelize(e,t),e}setPanelizeSide(t){if(!t.resultNeedToBeCached)return;let e=si.getInstance();if(e)return t.model=e,t.load(),this.addPanelize(e,t),e}setSilkOpt(t){t.resultNeedToBeCached&&t.load()}setPreference(t){t.resultNeedToBeCached&&t.load()}setCanvas(t){let e;return this.proxy!=null?e=this.proxy.getCanvas():e=R.getInstance(),e!=null&&(t.model=e,t.load()),this.proxy!=null&&this.proxy.updateOrigin(),e}deleteCombination(t){let e=this.getCombination(t);return this.proxy!=null&&e!=null&&this.proxy.deleteCombination(e),e!=null}deleteCopper(t){let e;for(let r of Y3e)if(e=this.getModelBy(r,t),e){e.iteratorCopper(i=>{this.deleteModel("Copper",i)});break}}deleteModel(t,e){let r=this.getModelBy(t,e);return this.proxy!=null&&r!=null&&this.proxy.deleteModel(r),r!=null}deleteProfileModel(t){for(let e of Y3e)if(this.deleteModel(e,t))return!0;return!1}deleteLayer(t){return this.proxy!=null&&this.proxy.deleteLayer(t),!0}deleteLayerPhys(t){return this.proxy!=null&&this.proxy.deleteLayerPhys(t),!0}deleteNet(t){return this.proxy!=null&&this.proxy.deleteNet(t),!0}deleteEQLenGrp(t){return this.proxy!=null&&this.proxy.deleteEQLenGrp(t),!0}deleteRule(t,e){return this.proxy!=null&&this.proxy.deleteRule(hx(t),e),!0}deleteRuleSelector(t){return this.proxy!=null&&this.proxy.deleteRuleSelector(t),!0}deletePadNet(t,e,r){return this.proxy!=null&&this.proxy.deletePadNet(t,e,r),!0}};var nD=class extends Px{constructor(e=new vm){super();this.clientTool=new MV;this.blobTask=new Array;this.resultNeedToBeCached=!0;this.types=["Rect","Circle","Polygon"];this.tool=e}setProxy(e,r=!0){this.clientTool.setProxy(e),this.resultNeedToBeCached=r}destory(){this.tool=null,this.clientTool=null,this.blobTask,length=0}getDecode(e,r,i,n,s){let a=this.tool.clientParse(e,r,i,n,s);return a&&(a.resultNeedToBeCached=this.resultNeedToBeCached),a}needOnNumber(e,r,i){if(Array.isArray(e)){for(let n of e)if(this.clientTool.onNumber(n,r,i))break}else this.clientTool.onNumber(e,r,i)}onLayerFill(e,r,i,n,s){}onDelLayerFill(e,r,i,n){}onBlob(e,r,i,n,s){if(this.needOn(r,i))return;let a=this.getDecode("BLOB",n,i,e),l=this.clientTool.setBlob(a);this.blobTask.push(l)}onDelBlob(e,r,i,n){this.needOn(r,i)}onFont(e,r,i,n){if(this.needOn(e,r))return;let s=this.getDecode("FONT",i,r);this.clientTool.setFont(s)}onDelFont(e,r,i,n){this.needOn(r,i)}async awaitBlobPromise(){await Promise.all(this.blobTask),this.blobTask.length=0}needParse(e){return e&&!R.getInstance().isHistoryMode}onString(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("STRING",s,n,e,r),c=this.clientTool.setString(l)}onDelString(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("Text",e)}async onAttr(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("ATTR",s,n,e,r),c=await this.clientTool.setAttr(l)}onDelAttr(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("Text",e)}onPanelize(e,r,i,n){if(this.needParse(n)||this.needOn(e,r))return;let s=this.getDecode("PANELIZE",i,r),a=this.clientTool.setPanelize(s)}onDelPanelize(e,r,i){this.needParse(i)||this.needOn(e,r)||console.warn("[FootprintClient] Method not implemented.")}onRuleSelector(e,r,i,n){if(this.needParse(n)||this.needOn(e,r))return;let s=this.getDecode("RULE_SELECTOR",i,r),a=this.clientTool.setRuleSelector(s)}onDelRuleSelector(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteRuleSelector(e)}onRule(e,r,i,n){if(this.needParse(n)||this.needOn(e,r))return;let s=this.getDecode("RULE",i,r),a=this.clientTool.setRule(s)}onDelRule(e,r,i,n,s){this.needParse(s)||this.needOn(i,n)||this.clientTool.deleteRule(e,r)}onRuleTemplate(e,r,i,n){if(this.needParse(n)||this.needOn(e,r))return;let s=this.getDecode("RULE_TEMPLATE",i,r),a=this.clientTool.setRuleTemplate(s)}onDimension(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("DIMENSION",s,n,e,r),c=this.clientTool.setDimension(l)}onDelDimension(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("Length Dimension",e)}onBoss(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("BOSS",s,n,e,r),c=this.clientTool.setBoss(l)}onDelBoss(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("Circle",e)}onShellEntity(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("SHELL_ENTITY",s,n,e,r),c=this.clientTool.setShellEntity(l)}onDelShellEntity(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onShellCut(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("SHELLCUT",s,n,e,r),c=this.clientTool.setSHellCut(l)}onDelShellCut(e,r,i,n){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onCrease(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("CREASE",s,n,e,r),c=this.clientTool.setCrease(l)}onDelCrease(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onShell(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("SHELL",s,n,e,r),c=this.clientTool.setSHell(l)}onDelShell(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onFpcFill(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("FPC_FILL",s,n,e,r),c=this.clientTool.setFPCFill(l)}onDelFpcFill(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onTeardrop(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("TEARDROP",s,n,e,r),c=this.clientTool.setTeardrop(l)}onDelTeardrop(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onImage(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("IMAGE",s,n,e,r),c=this.clientTool.setImage(l)}onDelImage(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("Image",e)}onPoured(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("POURED",s,n,e,r),c=this.clientTool.setPoured(l)}onDelPoured(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onPour(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("POUR",s,n,e,r),c=this.clientTool.setPour(l)}onDelPour(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onRegion(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("REGION",s,n,e,r),c=this.clientTool.setRegion(l)}onDelRegion(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onFill(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("FILL",s,n,e,r),c=this.clientTool.setFill(l)}onDelFill(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)||this.clientTool.deleteModel("Inner",e)}onPoly(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("POLY",s,n,e,r),c=this.clientTool.setPoly(l)}onDelPoly(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onEQLenGrp(e,r,i,n,s){if(this.needParse(s)||this.needOn(r,i))return;let a=this.getDecode("EQLEN_GRP",n,i,e),l=this.clientTool.setEqlenGrp(a)}onDelEQLenGrp(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteEQLenGrp(e)}async onObj(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;this.blobTask.length>0&&await this.awaitBlobPromise();let l=this.getDecode("OBJ",s,n,e,r),c=this.clientTool.setObj(l)}onDelObj(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("Picture",e)}onArc(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("ARC",s,n,e,r),c=this.clientTool.setArc(l)}onDelArc(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("ArcTrack",e)}onLine(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("LINE",s,n,e,r),c=this.clientTool.setLine(l)}onDelLine(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("Track",e)}onPad(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("PAD",s,n,e,r),c=this.clientTool.setPad(l)}onDelPad(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("Pad",e)}onVia(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("VIA",s,n,e,r),c=this.clientTool.setVia(l)}onDelVia(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteModel("Via",e)}onPreference(e,r,i,n){if(this.needParse(n)||this.needOn(e,r))return;let s=this.getDecode("PREFERENCE",i,r),a=this.clientTool.setPreference(s)}onSilkOpts(e,r,i,n,s){if(this.needParse(s)||this.needOn(r,i))return;n.layerId=e;let a=this.getDecode("SILK_OPTS",n,i),l=this.clientTool.setSilkOpt(a)}onDelSilkOpts(e,r,i,n){this.needParse(n)||this.needOn(r,i)||console.warn("[FootprintClient] Method not implemented.")}onGroup(e,r,i,n,s){if(this.needParse(s)||this.needOn(r,i))return;let a=this.getDecode("GROUP",n,i,e),l=this.clientTool.setGroup(a)}onDelGroup(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteCombination(e)}onPrimitive(e,r,i,n,s){this.needParse(s)||this.needOn(r,i)}onDelPrimitive(e,r,i,n){this.needParse(n)||this.needOn(r,i)||console.warn("[FootprintClient] Method not implemented.")}onNet(e,r,i,n,s){if(this.needParse(s)||this.needOn(r,i))return;n.netName=e;let a=this.getDecode("NET",n,i),l=this.clientTool.setNet(a)}onDelNet(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteNet(e)}onPartition(e,r,i,n,s,a){if(this.needParse(a)||this.needOn(i,n))return;let l=this.getDecode("PARTITION",s,n,e,r),c=this.clientTool.setPartition(l)}onDelPartition(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onActiveLayer(e,r,i,n){this.needParse(n)||this.needOn(e,r)}onLayerPhys(e,r,i,n,s){if(this.needParse(s)||this.needOn(r,i))return;n.layerId=e;let a=this.getDecode("LAYER_PHYS",n,i),l=this.clientTool.setLAYER_PHYS(a)}onDelLayerPhys(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteLayerPhys(e)}onLayer(e,r,i,n,s){if(this.needParse(s)||this.needOn(r,i))return;n.layerId=e;let a=this.getDecode("LAYER",n,i),l=this.clientTool.setLayerDecode(a)}onDelLayer(e,r,i,n){this.needParse(n)||this.needOn(r,i)||this.clientTool.deleteLayer(e)}onCanvas(e,r,i,n){if(this.needParse(n)||this.needOn(e,r))return;let s=this.getDecode("CANVAS",i,r),a=this.clientTool.setCanvas(s)}onDocDetail(e,r,i){}onDimensionNum(e,r){this.needOnNumber("Length Dimension",e,r)}onBossNum(e,r){this.needOnNumber("Circle",e,r)}onShellEntityNum(e,r){this.needOnNumber(this.types,e,r)}onCreaseNum(e,r){this.needOnNumber("Polygon",e,r)}onShellNum(e,r){this.needOnNumber(this.types,e,r)}onFpcFillNum(e,r){this.needOnNumber(this.types,e,r)}onTeardropNum(e,r){this.needOnNumber("Polygon",e,r)}onImageNum(e,r){this.needOnNumber("Image",e,r)}onPouredNum(e,r){this.needOnNumber(this.types,e,r)}onPourNum(e,r){this.needOnNumber(this.types,e,r)}onRegionNum(e,r){this.needOnNumber(this.types,e,r)}onFillNum(e,r){this.needOnNumber(this.types,e,r)}onPolyNum(e,r){this.needOnNumber(this.types,e,r)}onObjNum(e,r){this.needOnNumber("Image",e,r)}onArcNum(e,r){this.needOnNumber("ArcTrack",e,r)}onCArcNum(e,r){console.warn("Method not implemented.")}onLineNum(e,r){this.needOnNumber("Track",e,r)}onPadNum(e,r){this.needOnNumber("Pad",e,r)}onViaNum(e,r){this.needOnNumber("Via",e,r)}onPartitionNum(e,r){this.needOnNumber(this.types,e,r)}onComponentNum(e,r){this.needOnNumber("Component",e,r)}onStringNum(e,r){this.needOnNumber("Text",e,r)}};var j3e=1.6,lq=.035,X3e=.01,hce=3.3,cq=4.5,uce=.02,hq=0,$ze=[3,7,5,1,361,2,6,8,4],pce=[{"Layer Id":3,Layer:"Top Silkscreen Layer",Type:"Silk Layer",Material:null,Thickness:null,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:1},{"Layer Id":7,Layer:"Top Paste Mask Layer",Type:"PasteMask Layer",Material:null,Thickness:null,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:2},{"Layer Id":5,Layer:"Top Solder Mask Layer",Type:"SolderMask Layer",Material:"",Thickness:.03937007,Permittivity:hce,"Loss Tangent":uce,IsKeepIsLand:1,zIndex:3},{"Layer Id":1,Layer:"Top Layer",Type:"Copper",Material:null,Thickness:.137895245,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:1e3},{"Layer Id":361,Layer:"\u4ECB\u75351",Type:"Substrate",Material:"FR4",Thickness:5.94488057,Permittivity:cq,"Loss Tangent":hq,IsKeepIsLand:1,zIndex:1001},{"Layer Id":2,Layer:"Bottom Layer",Type:"Copper",Material:null,Thickness:.137795245,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:9e3},{"Layer Id":6,Layer:"Bottom Solder Mask Layer",Type:"SolderMask Layer",Material:"",Thickness:.03937007,Permittivity:hce,"Loss Tangent":uce,IsKeepIsLand:1,zIndex:1e4},{"Layer Id":8,Layer:"Bottom Paste Mask Layer",Type:"PasteMask Layer",Material:null,Thickness:null,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:10001},{"Layer Id":4,Layer:"Bottom Silkscreen Layer",Type:"Silk Layer",Material:null,Thickness:null,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:10002}],nvo=[{"Layer Id":3,Layer:"Top Silkscreen Layer",Type:"Silk Layer",Material:null,Thickness:null,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:1},{"Layer Id":7,Layer:"Top Paste Mask Layer",Type:"PasteMask Layer",Material:null,Thickness:null,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:2},{"Layer Id":5,Layer:"Top Solder Mask Layer",Type:"SolderMask Layer",Material:"",Thickness:.10629927,Permittivity:hce,"Loss Tangent":uce,IsKeepIsLand:1,zIndex:3},{"Layer Id":1,Layer:"Top Layer",Type:"Copper",Material:null,Thickness:.04724412,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:1e3},{"Layer Id":361,Layer:"\u4ECB\u75351",Type:"Substrate",Material:"FR4",Thickness:.09842525,Permittivity:cq,"Loss Tangent":hq,IsKeepIsLand:1,zIndex:1001},{"Layer Id":2,Layer:"Bottom Layer",Type:"Copper",Material:null,Thickness:.04724412,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:9e3},{"Layer Id":6,Layer:"Bottom Solder Mask Layer",Type:"SolderMask Layer",Material:"",Thickness:.10629927,Permittivity:hce,"Loss Tangent":uce,IsKeepIsLand:1,zIndex:1e4},{"Layer Id":8,Layer:"Bottom Paste Mask Layer",Type:"PasteMask Layer",Material:null,Thickness:null,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:10001},{"Layer Id":4,Layer:"Bottom Silkscreen Layer",Type:"Silk Layer",Material:null,Thickness:null,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:10002}];var oD=class{constructor(){this.models=new Set;this.layers=new Map;this.nets=new Set;this.combination=new Set;this.map=new Map;this.netModifyMap=new Map;this.panelizes=new Map}addModel(t,e){this.models.add(t),this.map.set(t,e);let r=sy.getInstance().get();sy.getInstance().set("Client"),this.build(),sy.getInstance().set(r)}getModelBy(t,e){return eA(t,e)}deleteModel(t){this.models.delete(t),this.map.delete(t)}addLayer(t,e){this.layers.set(t,e),this.build()}deleteLayer(t){for(let[e]of this.layers)e.layerId==t&&this.layers.delete(e)}addLayerPhy(t,e){}deleteLayerPhys(t){}getLayerPhy(t){return Ze.getInstance().getLayerPhy(t)}addNet(t){this.nets.add(t),this.build()}getNetModel(t){return re.getInstance().getNet(t)}addNetModify(t,e){this.netModifyMap.set(e,t)}deleteNet(t){for(let e of this.nets)e.name==t&&this.nets.delete(e)}deleteCombination(t){this.combination.delete(t)}addCombination(t){this.combination.add(t),this.build()}getCombination(t){return Xd.getInstance().getItem(t)}addPanelize(t,e){let r=this.panelizes.get(t);r?(r.add(e),this.panelizes.set(t,r)):(r=new Set().add(e),this.panelizes.set(t,r)),this.build()}modifyBoard(t){}deleteBoard(){}clear(){this.layers.clear(),this.nets.clear(),this.models.clear(),this.combination.clear(),this.map.clear(),this.netModifyMap.clear(),this.panelizes.clear()}getCanvas(){return R.getInstance()}updateOrigin(){}bindParent(t,e){}deleteEQLenGrp(t){}addRule(t){}deleteRule(t,e){}getRuleSelector(t){}addRuleSelector(t){}deleteRuleSelector(t){}deletePadNet(t,e,r){}replaceFootprint(t,e){}};function iE(o,t=o.globalIndex){switch(o.modelType){case"Track":case"ArcTrack":{Wy(pr,t);break}case"Pad":{Wy(Qt,t);break}case"Via":{Wy(Wr,t);break}case"Image":{Wy(Bn,t);break}case"Picture":{Wy(So,t);break}case"Length Dimension":{Wy(Yo,t);break}case"Protractor Dimension":{Wy(os,t);break}case"Radius Dimension":{Wy(jo,t);break}case"Polygon":{Wy(pt,t);break}case"Rect":{Wy(Xt,t);break}case"Circle":{Wy(Kt,t);break}case"Copper":{Wy(Ti,t);break}case"Inner":{Wy(zn,t);break}case"Combination":{Wy(Ht,t);break}case"Component":{Wy(Ar,t);break}case"Text":{Wy(ri,t);break}default:break}}function Wy(o,t){let e=o.getItem(t);if(e!=null){let r=e.getParent();r!=null&&r instanceof ke&&r.deleteItem(e),A.publish("hasModifyPcbItem",e),e.remove(),A.publish("delete",e)}}var q3e=class{constructor(){this.debounceInstance=new t6;this.ruleDebounceInstance=new t6;this.refreshLeftTreeTypes=new Set;this._changeSelect=!1;this.hasUpdateExpansion=!1;this.flushService1=()=>{he.publish("flushService","")};this.refreshRuleService=()=>{re.getInstance().getMaxSafe(),this.hasUpdateExpansion&&(he.publish("updateExpansion",""),this.hasUpdateExpansion=!1);for(let t of this.refreshLeftTreeTypes)this.forceRenderTree(t)};this.historyFlushService1=()=>{he.publish("flushTearDrop",""),he.publish("HistoryFlushService",{openPcb:!0,isOtherUser:!0,delayRatline:!0}),this._changeSelect&&(he.publish("flushSelectingInfo",{}),this._changeSelect=!1),this.updateLayerInfo()}}set changeSelect(t){this._changeSelect=this._changeSelect||t}flushService(){this.debounceInstance.debounce(this.flushService1,100)}historyFlushService(){this.debounceInstance.debounce(this.historyFlushService1,100)}refreshRule(t,e=""){this.hasUpdateExpansion=this.hasUpdateExpansion||t,e!=""&&this.refreshLeftTreeTypes.add(e),this.ruleDebounceInstance.debounce(this.refreshRuleService,100)}updateLayerInfo(){let t=Pe.configInnerLayers.size;wm.getInstance().updateLayerInfo(),ea.getInstance().viaShowPair&&t!=Pe.configInnerLayers.size&&Wr.iterator(e=>e.refreshRender())}forceRenderTree(t){he.publish("forceRenderTree",t,Q())}},Og=new q3e;function NV(o,t=!1){if(o!=null)if(t&&!o.isHighLight&&f2.getInstance().updateSelect(o),o instanceof lt){let e=o.getChildrens(),r=new Map;for(let n of e)for(let s of n)r.set(s.globalIndex,s);let i=new Array;for(let n of o.model.childrens){let s=new Array,a;for(let l of n)if(a=r.get(l.globalIndex),a)r.delete(l.globalIndex),s.push(a);else{let c=Xc(l);s.push(c)}i.push(s)}o.setChildrens(i);for(let[n,s]of r)s.remove(),iE(s.model);o.model.childrens.length>0&&(o.model.update4Childs(),t&&f2.getInstance().updateSelect(o)),o.type=="TearDrop"&&new bl(JSON.stringify({connects:o.getComponent().connects}),"TearDrop").modifyComponent(o)}else if(o instanceof lr){let e=o.model;e instanceof LB&&(e.outlineModified=e.model.outlineModified),o.refreshFamily(o.fontFamily),o.hasHelpLine&&o.updateHelpLine()}else o instanceof Jr&&o.getParent().refreshRender()}var Kze=new RegExp(/(_([0-9]+))$/),sD=class extends oD{build(){for(let r of this.nets)Hu.addNetByModel(r);for(let[r]of this.layers){let i=Pe.getLayer(r.layerId);i==null&&(i=Pe.addPcbLayerByModel(r)),i.refreshRender()}let t=ze.getItems(),e=!1;for(let r of this.models){let i=Xc(r),n=this.netModifyMap.get(r);n!=null&&(Ye.delete(i,n),Ye.addItem(i),he.publish("hasModifyNet",n)),Bo.deleteByPcbItem(i),NV(i,!0),jt.updateElementFilterVisible(i),this.addGroup(i),i.refreshRender(),he.publish("hasModifyPcbItem",i),!e&&t.includes(i)&&(e=!0)}this.panelizes.size&&new L0().applyPanelize(void 0,!1,!1),this.clear(),Og.changeSelect=e,Og.historyFlushService()}addGroup(t){let e=t.model.getGroupID();if(e!=null){let r=Ht.getItem(e);if(r==null)r=Ht.rebuild(e,[t]);else if(r.hasItem(t.globalIndex)||r.addItem(t),t instanceof ke&&t.attrsMap["Reuse Block"]==null){let i=r.name;i!=null&&Kze.test(i)&&(t.reuseBlock=i.replace(Kze,""),t.combinationID==""&&(t.combinationID=i.replace(t.reuseBlock+"_","")))}}}getLayer(t){return Ze.getInstance().getLayer(t)}deleteModel(t){super.deleteModel(t),iE(t),Og.historyFlushService()}modifyBoard(t){t.load(),Og.historyFlushService()}deleteBoard(){let t=us.getInstance().board;t&&(t.remove(),us.getInstance().deleteBoard(t)),Og.historyFlushService()}deleteCombination(t){super.deleteCombination(t);let e=Ht.getItem(t.globalIndex);e&&(he.publish("hasModifyPcbItem",e),e.remove(),he.publish("delete",e)),Og.historyFlushService()}deleteLayer(t){super.deleteLayer(t);let e=Pe.getLayer(t);if(e.config){let{active:r,layerStatus:i}=this.isDefault(t);Pe.modifyLayer(e.layerID,e.type,e.name,e.order,e.activeColor,e.deactiveColor,r,i)}}isDefault(t){return gBe.includes(t)?{active:!1,layerStatus:1}:{active:!1,layerStatus:0}}deleteLayerPhys(t){Pe.getLayerPhy(t)&&!$ze.includes(t)&&Pe.modelManager.deleteLayerPhy(t)}deleteNet(t){re.getInstance().getNet(t)&&re.getInstance().deleteNet(t)}addRule(t){t instanceof Wv?Og.refreshRule(!0):Og.refreshRule(!1)}deleteRule(t,e){pFe(t,e)&&fFe(t,e)}getRuleSelector(t){return GY(t)}addRuleSelector(t){let e="";t instanceof $h?e=xl.NetClasses:t instanceof bb?e=xl.Differentials:t instanceof dd?e=xl.EqualLengthGroups:t instanceof lI&&(e=xl.PadsPairGroups),Og.refreshRule(!1,e)}deleteRuleSelector(t){let e=GY(t);if(e){let r="";e instanceof $h?r=xl.NetClasses:e instanceof bb?r=xl.Differentials:e instanceof dd?r=xl.EqualLengthGroups:e instanceof lI&&(r=xl.PadsPairGroups),dFe(t),Og.refreshRule(!1,r)}}deletePadNet(t,e,r){let i=Ar.getItem(t);if(i){let n=i.getPads();if(n.length){let a=t+r,l=n.find(c=>c.globalIndex==a)||n.find(c=>c.num==e);l&&i.model.isCachePadNet()&&i.deleteNet(l.num,l.globalIndex)}let s=i.getVias();if(s.length){let a=s.find(l=>l.globalIndex==e);a&&i.model.isCachePadNet()&&i.deleteNet(a.globalIndex,a.globalIndex)}}}bindParent(t,e){let r=Xc(t),i=QP("Component",e.globalIndex);i!=null&&(r.getParent()==null&&(r instanceof lr&&r.key!=""?i.addAttribute(r):(r instanceof Le&&e.isCachePadNet()&&(r.net=e.getNet(r.num,r.globalIndex)),i.addCompositionItem(r))),r instanceof lr&&r.key=="Name"&&i.refreshNameValue())}};var kV=class extends Px{constructor(){super(...arguments);this.clientTool=new MV;this.debug=new URLSearchParams(Q().location.search).get("cll")=="debug";this.componentTask=new Array;this.blobTask=new Array;this.types=["Rect","Circle","Polygon"]}setProxy(e){this.clientTool.setProxy(e)}setTool(e){this.tool=e}setAttrUtils(e){this.clientTool.setAttrUtils(e)}destory(){this.tool=null,this.clientTool=null,this.componentTask.length=0,this.blobTask.length=0}getDecode(e,r,i,n,s){let a=this.tool.clientParse(e,r,i,n,s);return this.debug&&console.log({fileType:e,data:r,id:n,number:s}),a}needOnNumber(e,r,i){if(Array.isArray(e)){for(let n of e)if(this.clientTool.onNumber(n,r,i))break}else this.clientTool.onNumber(e,r,i)}onLayerFill(e,r,i,n,s){if(this.needOn(r,i))return;let a=this.getDecode("INNER",n,i,e),l=this.clientTool.setInner(a)}onDelLayerFill(e,r,i,n){this.needOn(r,i)||this.clientTool.deleteInner(e)}onBoard(e,r,i,n){if(R.getInstance().isHistoryMode){let s=this.getDecode("BOARD",e,i);this.clientTool.setBoard(s)}}onDelBoard(e,r,i){R.getInstance().isHistoryMode&&this.clientTool.deleteBoard()}onBlob(e,r,i,n,s){if(this.needOn(r,i))return;let a=this.getDecode("BLOB",n,i,e),l=this.clientTool.setBlob(a);this.blobTask.push(l)}onDelBlob(e,r,i,n){this.needOn(r,i)}onFont(e,r,i,n){if(this.needOn(e,r))return;let s=this.getDecode("FONT",i,r);this.clientTool.setFont(s)}onDelFont(e,r,i,n){this.needOn(r,i)}onString(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("STRING",s,n,e,r),l=this.clientTool.setString(a)}onDelString(e,r,i){this.needOn(r,i)||this.clientTool.deleteModel("Text",e)}async onAttr(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("ATTR",s,n,e,r);if(!this.clientTool.setAttrSync(a)){let c=this.clientTool.setAttr(a);this.componentTask.push(c),c.then(()=>{let h=this.componentTask.indexOf(c);h>=0&&this.componentTask.splice(h,1)})}}async onDelAttr(e,r,i){this.needOn(r,i)||(this.componentTask.length>0&&await this.awaitPromise(),this.clientTool.deleteAttr(e))}async onPadNet(e,r,i){if(this.needOn(e,r))return;this.componentTask.length>0&&await this.awaitPromise();let n=this.getDecode("PAD_NET",i,r),s=this.clientTool.setPadNet(n)}async onDelPadNet(e,r,i,n,s){this.needOn(n,s)||(this.componentTask.length>0&&await this.awaitPromise(),this.clientTool.deletePadNet(e,r,i))}async awaitPromise(){await Promise.all(this.componentTask),this.componentTask.length=0}async awaitBlobPromise(){await Promise.all(this.blobTask),this.blobTask.length=0}async onComponent(e,r,i,n,s){this.componentTask.length>0&&await this.awaitPromise();let a=this.getDecode("COMPONENT",s,n,e,r);this.clientTool.setComponent(a)}async onDelComponent(e,r,i){this.needOn(r,i)||(this.componentTask.length>0&&await this.awaitPromise(),this.clientTool.deleteModel("Component",e))}onPanelize(e,r,i){let n=this.getDecode("PANELIZE",i,r),s=this.clientTool.setPanelize(n)}onDelPanelize(e,r){console.warn("Method not implemented.")}onRuleSelector(e,r,i){if(this.needOn(e,r))return;let n=this.getDecode("RULE_SELECTOR",i,r),s=this.clientTool.setRuleSelector(n)}onDelRuleSelector(e,r,i){this.needOn(r,i)||this.clientTool.deleteRuleSelector(e)}onRule(e,r,i){if(this.needOn(e,r))return;let n=this.getDecode("RULE",i,r),s=this.clientTool.setRule(n)}onDelRule(e,r,i,n){this.needOn(i,n)||this.clientTool.deleteRule(e,r)}onRuleTemplate(e,r,i){if(this.needOn(e,r))return;let n=this.getDecode("RULE_TEMPLATE",i,r),s=this.clientTool.setRuleTemplate(n)}onDimension(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("DIMENSION",s,n,e,r),l=this.clientTool.setDimension(a)}onDelDimension(e,r,i){this.needOn(r,i)||this.clientTool.deleteModel("Length Dimension",e)}onBoss(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("BOSS",s,n,e,r),l=this.clientTool.setBoss(a)}onDelBoss(e,r,i){this.needOn(r,i)||this.clientTool.deleteModel("Circle",e)}onShellEntity(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("SHELL_ENTITY",s,n,e,r),l=this.clientTool.setShellEntity(a)}onDelShellEntity(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onShellCut(e,r,i,n,s){}onDelShellCut(e,r,i){}onCrease(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("CREASE",s,n,e,r),l=this.clientTool.setCrease(a)}onDelCrease(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onShell(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("SHELL",s,n,e,r),l=this.clientTool.setSHell(a)}onDelShell(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onFpcFill(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("FPC_FILL",s,n,e,r),l=this.clientTool.setFPCFill(a)}onDelFpcFill(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onTeardrop(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("TEARDROP",s,n,e,r),l=this.clientTool.setTeardrop(a)}onDelTeardrop(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onImage(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("IMAGE",s,n,e,r),l=this.clientTool.setImage(a)}onDelImage(e,r,i){this.needOn(r,i)||this.clientTool.deleteModel("Image",e)}onPoured(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("POURED",s,n,e,r),l=this.clientTool.setPoured(a)}onDelPoured(e,r,i){this.needOn(r,i)||this.clientTool.deleteCopper(e)}onPour(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("POUR",s,n,e,r),l=this.clientTool.setPour(a)}onDelPour(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onRegion(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("REGION",s,n,e,r),l=this.clientTool.setRegion(a)}onDelRegion(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onFill(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("FILL",s,n,e,r),l=this.clientTool.setFill(a)}onDelFill(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)||this.clientTool.deleteModel("Inner",e)}onPoly(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("POLY",s,n,e,r),l=this.clientTool.setPoly(a)}onDelPoly(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onEQLenGrp(e,r,i,n){if(this.needOn(r,i))return;let s=this.getDecode("EQLEN_GRP",n,i,e),a=this.clientTool.setEqlenGrp(s)}onDelEQLenGrp(e,r,i){this.needOn(r,i)||this.clientTool.deleteEQLenGrp(e)}async onObj(e,r,i,n,s){if(this.needOn(i,n))return;this.blobTask.length>0&&await this.awaitBlobPromise();let a=this.getDecode("OBJ",s,n,e,r),l=this.clientTool.setObj(a)}onDelObj(e,r,i){this.needOn(r,i)||this.clientTool.deleteModel("Picture",e)}onArc(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("ARC",s,n,e,r),l=this.clientTool.setArc(a)}onDelArc(e,r,i){this.needOn(r,i)||this.clientTool.deleteModel("ArcTrack",e)}onLine(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("LINE",s,n,e,r),l=this.clientTool.setLine(a)}onDelLine(e,r,i){this.needOn(r,i)||this.clientTool.deleteModel("Track",e)}onPad(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("PAD",s,n,e,r),l=this.clientTool.setPad(a)}onDelPad(e,r,i){this.needOn(r,i)||this.clientTool.deleteModel("Pad",e)}onVia(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("VIA",s,n,e,r),l=this.clientTool.setVia(a)}onDelVia(e,r,i){this.needOn(r,i)||this.clientTool.deleteModel("Via",e)}onPreference(e,r,i){if(this.needOn(e,r))return;let n=this.getDecode("PREFERENCE",i,r),s=this.clientTool.setPreference(n)}onSilkOpts(e,r,i,n){if(this.needOn(r,i))return;n.layerId=e;let s=this.getDecode("SILK_OPTS",n,i),a=this.clientTool.setSilkOpt(s)}onDelSilkOpts(e,r,i){console.warn("Method not implemented.")}onGroup(e,r,i,n){if(this.needOn(r,i))return;n.id=e;let s=this.getDecode("GROUP",n,i),a=this.clientTool.setGroup(s)}onDelGroup(e,r,i){this.needOn(r,i)||this.clientTool.deleteCombination(e)}onPrimitive(e,r,i,n){}onDelPrimitive(e,r,i){console.warn("Method not implemented.")}onNet(e,r,i,n){if(this.needOn(r,i))return;n.netName=e;let s=this.getDecode("NET",n,i),a=this.clientTool.setNet(s)}onDelNet(e,r,i){this.needOn(r,i)||this.clientTool.deleteNet(e)}onPartition(e,r,i,n,s){if(this.needOn(i,n))return;let a=this.getDecode("PARTITION",s,n,e,r),l=this.clientTool.setPartition(a)}onDelPartition(e,r,i){this.needOn(r,i)||this.clientTool.deleteProfileModel(e)}onActiveLayer(e,r,i){}onLayerPhys(e,r,i,n){if(this.needOn(r,i))return;n.layerId=e;let s=this.getDecode("LAYER_PHYS",n,i),a=this.clientTool.setLAYER_PHYS(s)}onDelLayerPhys(e,r,i){this.needOn(r,i)||this.clientTool.deleteLayerPhys(e)}onLayer(e,r,i,n){if(this.needOn(r,i))return;n.layerId=e;let s=this.getDecode("LAYER",n,i),a=this.clientTool.setLayerDecode(s)}onDelLayer(e,r,i){this.needOn(r,i)||this.clientTool.deleteLayer(e)}onCanvas(e,r,i){if(this.needOn(e,r))return;let n=this.getDecode("CANVAS",i,r),s=this.clientTool.setCanvas(n)}onDimensionNum(e,r){this.needOnNumber("Length Dimension",e,r)}onBossNum(e,r){this.needOnNumber("Circle",e,r)}onShellEntityNum(e,r){this.needOnNumber(this.types,e,r)}onCreaseNum(e,r){this.needOnNumber("Polygon",e,r)}onShellNum(e,r){this.needOnNumber(this.types,e,r)}onFpcFillNum(e,r){this.needOnNumber(this.types,e,r)}onTeardropNum(e,r){this.needOnNumber("Polygon",e,r)}onImageNum(e,r){this.needOnNumber("Image",e,r)}onPouredNum(e,r){this.needOnNumber(this.types,e,r)}onPourNum(e,r){this.needOnNumber(this.types,e,r)}onRegionNum(e,r){this.needOnNumber(this.types,e,r)}onFillNum(e,r){this.needOnNumber(this.types,e,r)}onPolyNum(e,r){this.needOnNumber(this.types,e,r)}onObjNum(e,r){this.needOnNumber("Picture",e,r)}onArcNum(e,r){this.needOnNumber("ArcTrack",e,r)}onCArcNum(e,r){console.warn("Method not implemented.")}onLineNum(e,r){this.needOnNumber("Track",e,r)}onPadNum(e,r){this.needOnNumber("Pad",e,r)}onViaNum(e,r){this.needOnNumber("Via",e,r)}onPartitionNum(e,r){this.needOnNumber(this.types,e,r)}onComponentNum(e,r){this.needOnNumber("Component",e,r)}onStringNum(e,r){this.needOnNumber("Text",e,r)}onDocDetail(e,r,i){}};var fce=class{constructor(){this.deviceTask=new Map;this.footprintTask=new Map}async replaceAttr(t,e){this.preAdjust(t);let i=new d1("2.0").save(t);this.remove(t),await this.build(i,e)}async parseFootAndDeviceByAttr(t){let e=t.key,r=t.value,i=R.getInstance().compilerChannel;if(e=="Device"){let n=Tu.getInstance().getItem(r);if(n||(this.deviceTask.get(r)||this.deviceTask.set(r,Tu.getInstance().add(r,i)),n=await this.deviceTask.get(r),this.deviceTask.delete(r)),n){let s=n.footprintUUID;s!=null&&await this.addFootprint(s,i)}}else e=="Footprint"&&await this.addFootprint(r,i)}async addFootprint(t,e){if(!Ji.getInstance().getItem(t)){if(!this.footprintTask.get(t)){let i;t.indexOf("_")>-1?i=Ji.getInstance().addCustomFootprint(t,e):i=Ji.getInstance().add(t,e),this.footprintTask.set(t,i)}await this.footprintTask.get(t),this.footprintTask.delete(t)}}loadAttr(t,e){let r=e.attrKeyValue[t.key],i=t.getNameValueById(t.key,t.value);r!=null?this.updateAttr(t,t.key,i,t.showKey,t.showValue,e):typeof r>"u"&&t.model.value===Ve||(i!=null&&(i=i.toString()),e.modifyATTRMap(t.key,i),this.createATTR(e,t))}updateAttr(t,e,r,i,n,s){let a=t.model,l=!1,c=Tu.getInstance().getItem(s.deviceUUID);if(a==null){let h=s.attrKeyValue[e];(h==null||h===Ve)&&(h=""),a=this.createATTR(s,t),c.has(e)&&(l=!0)}a&&(a.value!=null&&a.value!==Ve&&a.value!==r&&s.modifyATTRMap(e,r),a.showKey!=i&&(a.showKey=i),r!=null&&r!==Ve&&a.value!=r&&(a.value=r.toString()),a.showValue!=n&&(a.showValue=n),s.resetAttr(a),l&&c.addAttr(e,c.getAttrData(s,a)),(!a.outline||!a.outline.length)&&a.showValue&&this.syncTextPath(a))}createATTR(t,e){var i;let r=io.getInstance().addText(e.index,e.layerId,e.key,e.showKey,e.value,e.showValue,e.fontFamily,e.fontSize,e.angle,e.locked,e.getPosition(),e.origin,e.strokeWidth,e.reverse,e.reverseExpansion,e.mirror,e.positionIsNull,null,(i=e.props)==null?void 0:i.color);return t.addAttribute(r),r}syncTextPath(t){if(t.outline&&t.outline.length>0)return;let e=t.getText();if(e==""||e==null){t.outline=[],t.updateBox4(0,0);return}let r=YO(t.globalIndex,t.fontFamily,e,t.fontSize,t.reverse,t.reverseExpansion,t.strokeWidth);r&&r.path&&(t.outline=r.path,t.updateBox4(r.width,r.height));let i=t.fontFamily,n=i==""||["","default","default2","Serif","Sans Serif"].includes(i);n&&!cy.everyCharHasDefaultFontPath(e)&&(t.fontFamily="\u9ED1\u4F53",n=!1),n?t.type=0:t.type=1}};var BV=class extends fce{preAdjust(t){let e=Ar.getItem(t.globalIndex);new Rb(e,"modify"),Ce.dispatch(e,"delete"),A.publish("hasModifyPcbItem",e)}deleteAttr(t,e){let r=Ar.getItem(e.globalIndex);new OF().restoreAttr(t.key,r)}remove(t){let e=Ar.getItem(t.globalIndex);A.publish("delete",e),e.remove()}async build(t,e){await new p1(t).replaceDecode(e)}};var mce=class{constructor(){It.getInstance().visible=Ug.NOTSHOW,It.getInstance().setMultiStyle(NC.None),A.messageBus.rpcService("loadFootprint",this.loadFootprint.bind(this)),A.messageBus.rpcService("loadPCB",this.loadPCB.bind(this)),A.subscribe("AdaptPrimitive",this.adaptPrimitive.bind(this)),A.subscribe("delayAdaptAll",()=>{if(jP.asyncText==0){A.publish("adaptAll","");return}this.antiShake==null&&(this.antiShake=this.adaptAll())}),A.subscribe("updateSilkScreenColor",t=>{let{layer:e,color:r}=t;e==3?we.topSilkscreenColor=r:we.bottomSilkscreenColor=r}),A.messageBus.rpcService("generateGerberResult",t=>XWe(t).then(async e=>{if(!e)return;let r=await ZI(e.blob);return delete e.blob,{fileInfo:e,...r}}).catch(e=>({error:(e==null?void 0:e.message)||e}))),A.messageBus.rpcService("gerberLayerConfig",()=>new Promise((t,e)=>{let r=[],i=Pe.getAllLayer(),n=[12,47,52,48,49,50,51,53,54,55,56,57],s=[],a=[];for(let c=15;c<=46;c++)s.push(c);for(let c of i)if(!n.includes(c.layerID)){let h={layerId:c.layerID,layerType:c.type,layerName:c.name,status:c.layerStatus};s.includes(c.layerID)?a.push(h):r.push(h)}let l=r.findIndex(c=>c.layerId==2);r.splice(l,0,...a),t(r)})),A.subscribe("pro-pcb/layerConfigurationReplacement",this.layerConfigurationReplacement.bind(this)),Xze()}async loadPCB(t){if(t&&t!=null){A.publish("clearAll",""),t.isPartitionDlg&&Mt.setIsChildPcb(t.pcbLevelType=="CHILD"),A.publish("updateModify",""),A.publish("previewClearAll",""),await loe.deleteTemplate(),await R.getInstance().resetCompiler(),R.getInstance().id=t.tabId.split("@")[0],R.getInstance().tabId=t.tabId,R.getInstance().doctype=t.docType,R.getInstance().isPreview=!0,R.getInstance().envFlag=t.envFlag;let e=R.getInstance().compiler,r=new _2(e);t.dataStr!=null?await r.parseSourceByCompiler(t.dataStr||""):await r.init(),r.build();let i=new kV;i.setProxy(new sD),i.setTool(new vy),i.setAttrUtils(new BV),e.setHandle(i);let n=Pe.getAllLayer(),s=HO.concat(wL);for(let a of n)a.config&&(s.indexOf(a.layerID)>=0?a.visible=!1:a.visible=!0);if(Pe.setActiveLayerId(Ze.getInstance().activeLayer),t.isPartitionDlg){let l=bo.getInstance().getAllItem().find(c=>c.model instanceof or&&c.model.component instanceof ac&&c.model.component.fileUuid==R.getInstance().id);if(l){let c=new _e;if(c.ext1(l.buildBBox()),c.valid()){let h=c.build1();A.publish("adaptBBox",h)}return}}A.publish("delayAdaptAll","")}}async loadFootprint(t){if(!t){A.publish("clearAll","");return}let{tabId:e,docType:r,dataStr:i,isOldDataString:n}=t;if(!e)return;let s=e.split("@"),a=s[0],l=s[1];if((!a||!l)&&!i){console.error("Package preview parameter error: tabId is invalid!",t);return}let c=R.getInstance();c.id=a,c.tabId=e,c.doctype=r,c.isPreview=!0,c.currOpenProjectId=t.currOpenProjectId,A.publish("updateModify",""),A.publish("previewClearAll",""),Pe.checkDefault(),await c.resetCompiler();let h=new _2(c.compiler);i?n?await h.parseSourceByCompiler(i,n):await h.parseSourceByCompiler(i):await h.init(),h.build();let u=new nD(new vy);u.setProxy(new sD),c.compiler.setHandle(u);let d=R.getInstance().envFlag==="cnc-preview",p=Pe.getAllLayer(),m=d?HO:HO.concat(wL);for(let g of p)g.config&&(m.indexOf(g.layerID)>=0?g.visible=!1:g.visible=!0);jt.setVisible(2,!0),jt.setVisible(2,!1),A.publish("delayAdaptAll",""),t.hideDxfLoading&&A.publish("toggleDxfLoadingState",!1,Q()),Pe.setActiveLayerId(Ze.getInstance().activeLayer)}adaptAll(){return setTimeout(()=>{jP.asyncText>0?(this.antiShake!=null&&clearTimeout(this.antiShake),this.antiShake=this.adaptAll()):(A.publish("adaptAll",""),this.antiShake=null)},10)}adaptPrimitive(t){let{primitiveId:e,fileUuid:r,pcbLevelType:i}=t.message,s=bo.getInstance().getAllItem().find(a=>a.model instanceof or&&a.model.component instanceof ac&&a.model.component.fileUuid==r);if(s){let a=new _e;if(a.ext1(s.buildBBox()),a.valid()){let l=a.build1();A.publish("adaptBBox",l)}}else A.publish("adaptAll","");R.getInstance().id=r,Mt.setIsChildPcb(i=="CHILD"),z3e()}layerConfigurationReplacement(t){let{defaultStroke:e,layerExchangeMap:r}=t,i=!1;if(e&&!isNaN(e)&&(Xt.iterator(n=>{n.width=e}),Kt.iterator(n=>{n.strokeWidth=e}),pt.iterator(n=>{n.strokeWidth=e}),i=!0),r){for(let n in r){let{layerCode:s,toLayerCode:a,visible:l}=r[n],c=s&&Pe.getLayer(s);if(!c)continue;let h=a&&Pe.getLayer(a);h&&(c.activeColor=h.activeColor),c.visible=l}i=!0}i&&(A.publish("updateModify",""),A.publish("adaptAll",""))}};function Jze(o,t,e,r){if(R.getInstance().doctype===0){R.getInstance().doctype=o,R.getInstance().isPreview=e,R.getInstance().envFlag=r;let i=r=="cnc-preview",n=r=="silk-preview";e||i||n?new mce:o===4?new yoe:o===3&&new oce,DL.getInstance().attach(uo.getInstance())}R.getInstance().tabId===""&&(R.getInstance().tabId=t,R.getInstance().id=t.split("@")[0])}function Qze(o,t,e,r){r||(r=R.getInstance().doctype),le.updateSystemConfig(o,e),r===3&&DR.updateConfig(t)}function eYe(o){o&&R.getInstance().doctype===3&&A.publish("INIT_PCB_CONFIG",o)}function sce(o,t=!1){Uu.switch=o,we.realTimeDRC=o,A.publish("TOGGLE_REALTIME_DRC",o,Q()),o?o&&!t&&A.publish("showCheckDRCDlg","",Q()):Bo.deleteAll()}function QI(o,t=!0,e=!0){R.getInstance().isactive=o,o&&23!=R.getInstance().doctype&&(wm.getInstance().updateLayerInfo(),rE(e),we.synchronize(),A.publish("flushSelectingInfo",""),t&&A.publish("reInitDesignTree",R.getInstance().tabId,Q())),23==R.getInstance().doctype&&(R.getInstance().isactive=!0)}async function rE(o=!0){let t=await jt.updateGetConfig(o),e=jt.getElementFilters();A.publish("renderElementPanel",{data:e,config:t},Q())}async function tYe(){LS&&A.windowBridge.rpcCall("getAnnotationAuthority",{},Q()).then(async o=>{let t=o.message;if(To.getInstance().setAuthority(t),t){let e=(await A.windowBridge.rpcCall("getShowAnnotation",{},Q())).message||!1;jt.setVisible(38,e),setTimeout(()=>{A.windowBridge.rpcCall("getAllAnnotationBlock",{path:R.getInstance().id},Q()).then(r=>{console.time("create annotation");let i=r.message;if(!Array.isArray(i))return;let n={uuid:R.getInstance().id,nameMap:{}},s=!1;for(let a of i){let c=To.getInstance().update(a).getComponent();c.type==1&&(n.nameMap=Object.assign(n.nameMap,To.getInstance().getConnectsName({objects:c.connects})),s=!0)}To.getInstance().hasCreateAll=!0,To.getInstance().openSelect(),s&&A.windowBridge.publish("updateAnnotationBlockName",n,Q()),console.timeEnd("create annotation")})})}})}var To=class o{constructor(){this.needAnnotation=!1;this.connectAnnotation=new Map;this.hasCreateAll=!1;A.subscribe("cancelCreateAnnotation",this.cancel.bind(this)),A.subscribe("confirmAnnotation",this.success.bind(this)),A.subscribe("deleteAnnotation",this.deleteItem.bind(this)),A.subscribe("selectAnnotation",this.selectPcbAnnotation.bind(this)),A.subscribe("doubleSelectAnnotation",this.doubleSelectAnnotation.bind(this)),A.subscribe("updatePcbAnnotation",this.update.bind(this)),A.subscribe("getShowTitleInAnnotation",this.getConnectsName.bind(this)),A.subscribe("highlightAnnotation",this.highlightAnnotation.bind(this)),A.subscribe("unHighlightAnnotation",this.unHighlightAnnotation.bind(this)),A.subscribe("addAnnotation",this.update.bind(this))}get canDrawing(){return this.annotationId==null}static getInstance(){return o.instance||(o.instance=new o),o.instance}openSelect(){this.openSelectAnn&&this.doubleSelectAnnotation(this.openSelectAnn),this.openSelectAnn=void 0}waitData(t){this.cancel();let e=Xt.getItem(t);if(e==null)return;e.click();let r=e.getUL(),i=e.getLR();setTimeout(()=>{A.windowBridge.publish("addAnnotationBlock",{path:R.getInstance().id,customArea:{minX:r.x,maxX:i.x,minY:i.y,maxY:r.y}},Q()),this.annotationId=t},100)}cancel(){this.annotationId&&this.deleteItem(this.annotationId),this.annotationId=void 0,A.publish("updateFrame","")}success(t){let e;if(t.path==R.getInstance().id)return t.objects&&t.objects.length>0?e=this.createAnnotationByConnect(t.objects,t.uuid):(e=this.createAreaAnnotation(t.customArea,t.uuid),this.deleteItem(this.annotationId)),this.selectPcbAnnotation2(e.globalIndex,!0,!1),this.annotationId=void 0,A.publish("updateFrame",""),e}update(t){if(t.path==R.getInstance().id){let e;t.objects&&t.objects.length>0?e=this.createAnnotationByConnect(t.objects,t.uuid):e=this.createAreaAnnotation(t.customArea,t.uuid);let r=e.getComponent();return r.type==1&&this.updateTitle(r.connects),e.initVisible(),A.publish("updateFrame",""),e}}interrupt(t){this.deleteItem(t),A.publish("updateFrame","")}deleteItem(t){if(t){let e=Xt.getItem(t);if(e){let r=e.getComponent();if(r.connects)for(let i of r.connects)this.connectAnnotation.get(i).delete(e.globalIndex);e.remove(),A.publish("delete",e)}}}static isAnnotation(t){return t instanceof rr&&t.type=="Annotation"}setAuthority(t){this.needAnnotation=t}getAuthority(){return this.needAnnotation}getNeedAnnotation(){return this.needAnnotation&&LS&&R.getInstance().doctype==3}hasConnectItem(){return this.getConnectItem(ze.getSelects()).length>0}getConnectItem(t){return t.filter(e=>this.needAnnotationItem(e))}createAnnotationByItems(){let e=this.getConnectItem(ze.getSelects()).map(r=>r.globalIndex);A.windowBridge.publish("addAnnotationBlock",{path:R.getInstance().id,objects:e},Q()),this.updateTitle(e)}createAreaAnnotation(t,e){let{minX:r,maxX:i,minY:n,maxY:s}=t,a=Xt.getItem(e);return a||(a=Xt.addRect("Annotation",1,new S(r,s),i-r,s-n,"",!1,1,void 0,void 0,void 0,e)),a}createAnnotationByArea(t){return this.createAreaAnnotation(t)}createAnnotationByConnect(t,e){let r=this.getConnectBBox(t),i=Xt.getItem(e);if(!i){i=Xt.addRect("Annotation",1,r.UL(),r.width(),r.height(),"",!1,1,void 0,void 0,void 0,e);let n=i.getComponent();n.connects=t,t.forEach(s=>{let a=this.connectAnnotation.get(s);a||(a=new Set,this.connectAnnotation.set(s,a)),a.add(i.globalIndex)})}return i}changeElements(t){if(t.size==0||this.connectAnnotation.size==0)return;let e="annotationModify-time";Cn(e);let r=[],i=[];for(let n of t){let s=n.globalIndex,a=this.connectAnnotation.get(s);if(a){for(let l of a){let c=Xt.getItem(l);c&&i.push(c)}r.push(s)}}for(let n=0;n<i.length;n++)this.updateRectBBox(i[n]);r.length>0&&this.updateTitle(r),Xi(e,.01)}updateTitle(t){let e={uuid:R.getInstance().id,nameMap:{}};e.nameMap=Object.assign(e.nameMap,o.getInstance().getConnectsName({objects:t})),A.windowBridge.publish("updateAnnotationBlockName",e,Q())}updateRectBBox(t){if(!t.isEmpty&&o.isAnnotation(t)&&t.getComponent().type==1){let i=this.getRectBBox(t);t.width=i.width(),t.height=i.height();let n=i.UL().sub(t.getUL()),s=Ae.translate(n.x,n.y,0);t.transform(s),t.updateFilterVisible=!0,t.visible()}return null}selectAnnotationBlock(t){A.windowBridge.publish("selectAnnotationBlock",{uuid:t.globalIndex},Q())}doubleSelectAnnotation(t){this.hasCreateAll||(this.openSelectAnn=t),this.selectPcbAnnotation2(t,!0)}selectPcbAnnotation(t){this.selectPcbAnnotation2(t)}selectPcbAnnotation2(t,e=!1,r=!0){let i=Xt.getItem(t);if(i&&i.type=="Annotation"){let n=i.getComponent(),s=n.connects;if(n.type==1&&!s.find(c=>{let u=new Jt().getItem(c);return!!(u&&!u.isEmpty)}))return;A.publish("clearSelect",{});let a=[i];s.forEach(l=>{let h=new Jt().getItem(l);if(h&&!h.isEmpty){let d=h.model.layerId,p=Pe.getLayer(d);p.visible||(p.visible=!0),jt.setVisibleByItem(h,!0),a.push(h)}}),wm.getInstance().updateLayerInfo(),rE(!1),a.forEach(l=>{l.click()}),A.publish("select",a),r&&A.publish("AdaptBBox2",{box:i.buildBBox(),onlyMove:!e}),A.publish("updateFrame","")}}highlightAnnotation(t){let e=Xt.getItem(t);if(e&&e.type=="Annotation"){let r=e.getComponent(),i=r.connects;if(r.type==1&&!i.find(a=>{let c=new Jt().getItem(a);return!!(c&&!c.isEmpty)}))return;let n=[e];i.forEach(s=>{let l=new Jt().getItem(s);l&&!l.isEmpty&&n.push(l)}),n.forEach(s=>{s.click()}),A.publish("updateFrame","")}}unHighlightAnnotation(t){let e=Xt.getItem(t);if(e&&e.type=="Annotation"){let r=e.getComponent(),i=r.connects;if(r.type==1&&!i.find(h=>{let d=new Jt().getItem(h);return!!(d&&!d.isEmpty)}))return;let n=[e],s=[],a=ze.getItems(),l=ze.getAnnotationItems();s=s.concat(a).concat(l),i.forEach(c=>{let u=new Jt().getItem(c);u&&!u.isEmpty&&!a.includes(u)&&n.push(u)}),n.forEach(c=>{c.updateFilterVisible=!0,c.visible()}),s.forEach(c=>{c.click()}),A.publish("updateFrame","")}}getConnectsName(t){let{objects:e}=t,r={},i=new Jt;for(let n of e){let s=i.getItem(n);!s||s.isEmpty?r[n]=null:r[n]=this.getName(s)}return r}getName(t){if(t instanceof ke)return t.name;if(t instanceof He)return t.type=="Copper Region"?t.getComponent().name||this.getGlobalIndexName(t):this.getGlobalIndexName(t);if(t instanceof Ge)return`${t.net||"None"}_${this.getGlobalIndexName(t)}`;if(t instanceof Le){let e=t.getParent();return e instanceof ke?`${e.name}:${t.num}`:this.getGlobalIndexName(t)}return this.getGlobalIndexName(t)}getConnectBBox(t){let e=new _e;return t.forEach(i=>{let n=ch(i);n&&!n.isEmpty&&e.ext1(n.bbox)}),e.ext7(1),e.build1()}getGlobalIndexName(t){return`${Tr}${t.number}`}getRectBBox(t){let r=t.getComponent().connects;return this.getConnectBBox(r)}needAnnotationItem(t){return t instanceof ke||t instanceof lr&&t.key==""||t instanceof Le||t instanceof Ue||t instanceof He&&t.type!=="Annotation"||t instanceof Qp||t instanceof Dp||t instanceof ua||t instanceof Ge}};function US(o){let t=new Array,e=new Set,r=new Set;o.forEach(s=>{s instanceof lt?(e.add(s),t.push(s)):s instanceof mt||s instanceof _t?r.add(s):t.push(s)});let i=new Set,n=e.size+r.size;return r.forEach(s=>{let a=s.getParent();a!=null&&a instanceof lt&&!e.has(a)&&!i.has(a)&&(n>0||a.onlyOneChilds()!=null?t.push(a):t.push(s),i.add(a))}),t}function rYe(o){let t=new Array,e=new Set,r=new Set;for(let a of o)a instanceof lt?(e.add(a),t.push(a)):a instanceof mt||a instanceof _t?r.add(a):t.push(a);let i=new Set,n=new Set,s=e.size+r.size;for(let a of r){let l=a.getParent();l!=null&&l instanceof lt&&i.has(l)&&(l.getChildrens().forEach(u=>{u.forEach(d=>{n.delete(d)})}),t.indexOf(l)<0&&t.push(l)),l!=null&&l instanceof lt&&!e.has(l)&&!i.has(l)&&(l.onlyOneChilds()==null?n.add(a):t.push(a),i.add(l))}for(let a of n)t.push(a);return t}var $6=class{constructor(t,e,r=!1){this.isBBox=!1;this.result=new b1;this.copperParent={};this.copperFills={};this.insideCopperParent={};this.range=t,this.pl=e,this.isBBox=r,this.bbox=e.bbox()}setResult(t){this.result=t}getResult(){return this.result}doAction(t){if(t.isEmpty)return;let e=t.getParent(),r=t.model;if(r instanceof xi)if(e==null){let i=r.modelType;if(this.isBBox&&t.buildBBox().isInside(this.bbox)){switch(i){case"Polygon":case"Rect":case"Circle":if(t.type=="Copper Region"&&t.getViewState()=="Not Shown")return}return this.result.doAction(t)}switch(i){case"Track":case"ArcTrack":case"Image":case"Picture":case"Length Dimension":case"Smart Dimension":case"Protractor Dimension":case"Radius Dimension":case"Component":case"Text":{let n=t.getMathGraphics(t.layerId,0);return this.checkRange(n)?this.result.doAction(t):void 0}case"Pad":{if(ar(t.layerId)){let n=t.getMathGraphics(1,0);if(this.checkRange(n))return this.result.doAction(t);let s=t.getMathGraphics(2,0);if(this.checkRange(s))return this.result.doAction(t);let a=t.getOneInnerInUse();if(a){let l=t.getMathGraphics(a,0);if(this.checkRange(l))return this.result.doAction(t)}}else{let n=t.getMathGraphics(t.layerId,0);if(this.checkRange(n))return this.result.doAction(t)}return}case"Via":{let n=t.getMathGraphics(t.startLayer,0);return this.checkRange(n)?this.result.doAction(t):void 0}case"Polygon":case"Rect":case"Circle":{let n=t,s=n.getMathGraphics(n.layerId,0);if(n.type=="Line"||n.type=="Board Outline"||n.type=="3D Shell - Outline"||n.type=="Copper Region"||n.type=="Annotation"){if(n.type=="Copper Region"&&n.getViewState()=="Not Shown")return;let a=new Array;for(let l of s.primitives){let c=l.stroke(n.strokeWidth,wr.ROUND,ae.CCW);a.push(c)}if(this.checkRange1(a))return this.result.doAction(n)}else{let a=s instanceof Bt?s.items:[s];if(this.checkRange1(a))return this.result.doAction(n)}return}case"Copper":return;case"Inner":{let n=t.model.getOutline();return this.checkRange1(n)?this.result.doAction(t):void 0}case"Ratline":{let n=t;if(this.range=="Inside"){if(this.bbox.isContains(n.start)&&this.bbox.isContains(n.end))return this.result.doAction(t)}else{if(this.bbox.isContains(n.start)||this.bbox.isContains(n.end))return this.result.doAction(t);{let s=new M(n.start,n.end);for(let a of this.pl.primitives)if(Pt(a,s)>0)return this.result.doAction(t)}}return}default:return}}else{if(t instanceof Jr){if(!t.isVisible)return;if(this.range==="Inside"){let n=this.copperFills[e.globalIndex];n||(n=this.copperFills[e.globalIndex]=new Set,this.insideCopperParent[e.globalIndex]=e),n.add(t.globalIndex);return}else if(this.isBBox){if(this.copperParent[e.globalIndex])return;if(t.buildBBox().isInside(this.bbox))return this.copperParent[e.globalIndex]=!0,this.result.doAction(e);let n=t.model.getOutline();this.checkRange1(n)&&(this.result.doAction(e),this.copperParent[e.globalIndex]=!0);return}}let i=!1;if(this.isBBox&&e!=null&&e.buildBBox().isInside(this.bbox)&&(i=!0),e instanceof lt){if(e.getViewState()=="Not Shown")return;if(e.getParent()==null){if(i)return this.result.doAction(e);let s=t.getMathGraphics(t.layerId,0),a=s instanceof Bt?s.items:[s];if(this.checkRange1(a))return this.result.doAction(t)}}else if(t instanceof lr){let n=!1;if(this.isBBox&&t.buildBBox().isInside(this.bbox))n=!0;else{let s=t.getMathGraphics(t.layerId,0);n=this.checkRange(s)}if(n)return e instanceof ke&&!t.key?void 0:this.result.doAction(t)}else if(t instanceof Le){if(i)return this.result.doAction(t);if(this.isBBox&&t.buildBBox().isInside(this.bbox))return this.result.doAction(t);if(ar(t.layerId)){let n=t.getMathGraphics(1,0);if(this.checkRange(n))return this.result.doAction(t);let s=t.getMathGraphics(2,0);if(this.checkRange(s))return this.result.doAction(t);let a=t.getOneInnerInUse();if(a){let l=t.getMathGraphics(a,0);if(this.checkRange(l))return this.result.doAction(t)}}else{let n=t.getMathGraphics(t.layerId,0);if(this.checkRange(n))return this.result.doAction(t)}}else if(t instanceof Ue){if(i)return this.result.doAction(t);if(this.isBBox&&t.buildBBox().isInside(this.bbox))return this.result.doAction(t);let n=t.getMathGraphics(t.startLayer);if(this.checkRange(n))return this.result.doAction(t)}}}doCopperAction(){for(let t in this.copperFills){let e=this.insideCopperParent[t].getCopperResult();(e?e.size:0)===this.copperFills[t].size&&this.result.doAction(this.insideCopperParent[t])}}checkRange(t){return this.range=="NotOutSide"?this.intersection(t):this.inner(t)}checkRange1(t){return this.range=="NotOutSide"?this.intersection1(t):this.inner1(t)}intersection(t){return Gy.build2(this.pl,t).intersection()}intersection1(t){return Gy.build3([this.pl],t).intersection()}inner(t){return Gy.build2(this.pl,t).inInner()}inner1(t){return new Xl(this.pl,new Bt(t),0).relation==1}};var Mvt=["Track","ArcTrack","Pad","Via","Polygon","Circle","Rect","Copper","Inner"],Vr=class o{static getSelectInside(t,e={}){let{boxChoose:r=!0,isBBox:i=!1,model:n=Df}=e;if(t==null)return[];let a=o.rtreeSearchInside(t,i,r).getResult(o.validType||n);return a=o.filterComponentVisible(a,t,"inside"),jt.filterElement(a,{boxChoose:!0})}static filterComponentVisible(t,e,r){let i=new Set,n={};t.forEach(l=>{let c=l,h=l.getParent();if(h!==null&&h instanceof ke&&(c=h),c instanceof ke){let u=ll(c.buildBBox()),d=new As(u,e,0);d.relation==2?i.add(c):d.relation!=3&&(n[c.globalIndex]||(n[c.globalIndex]=c))}l instanceof ke||i.add(l)});let s=Object.values(n),a={};s.forEach(l=>{a[l.footprintUUID]?a[l.footprintUUID].push(l):a[l.footprintUUID]=[l]});for(let l in a){let c=a[l];for(let h of c)h.isBoxSelect(e,r)&&i.add(h)}return i}static rtreeSearchInside(t,e=!1,r=!0){let i=t.bbox(),n=r?$L:dY,s=kt.searchInside(i,(h,u)=>n.includes(u),!1),a=new $6("Inside",t,e);s.setAction(a),s.doAction(n),a.doCopperAction();let{lines:l,arcs:c}=this.rtreeSearchNotOutsideChildren(i);return l.forEach(h=>{a.getResult().lines.add(h)}),c.forEach(h=>{a.getResult().arcs.add(h)}),a.getResult()}static rtreeSearchNotOutsideChildren(t,e=!1,r=!0){let i=kt.searchIntersectByType(t,["Polygon"]),n=[],s=[],a=l=>{l.model.bbox.isInside(t)&&(l instanceof mt?n.push(l):s.push(l))};for(let l of i.polygons)if(l.getViewState()!=="Not Shown")for(let c of l.childrens)if(Array.isArray(c))for(let h of c)a(h);else a(c);return{lines:n,arcs:s}}static rtreeSearchNotOutside(t,e=!1,r=!0){let i=t.bbox(),n=r?$L:dY,s=kt.search(i,(l,c)=>c&&n.includes(c),!1),a=new $6("NotOutSide",t,e);return s.setAction(a),s.doAction(n),a.getResult()}static rtreeSearchNotOutsideForComponent(t,e,r=!1){let i=e.bbox(),n=kt.search(i,(a,l)=>a===t&&l==="Component",!1),s=new $6("NotOutSide",e,r);return n.setAction(s),n.doAction(["Component"]),s.getResult().components}static getSelectContect(t,e={}){let{boxChoose:r=!0,isBBox:i=!1}=e;if(t==null)return new Set;let s=o.rtreeSearchNotOutside(t,i,r).getResult(o.validType||Df);return s=o.filterComponentVisible(s,t,"contact"),s}static pointSelectBeforeFilter(t,e){let r=Ai().getScale(),i=1;isNaN(r)||(i=1/r,i=i<1?1:i),r>10&&(i=.1);let n=new ht(t,t,e,e),s=n.extendOfSize(i),a=kt.search(s,void 0,!1),l=new b1,c=new $6("NotOutSide",ll(n),!0);return c.setResult(l),a.setFilter(new ed).setFilter(new Mp(t,e,!0)).setAction(l),a.doAction(o.validType||Df),a.clearFilter(),a.clearAction(),a.setAction(c),a.doAction(Kp),l}static wirePointSelect(t,e){let r=Ai().getScale(),i=1;isNaN(r)||(i=1/r,i=i<1?1:i);let n=new ht(t,t,e,e).extendOfSize(i);r>10&&(n=new ht(t,t,e,e).extendOfSize(.1));let s=kt.search(n,(l,c)=>c&&yte.includes(c),!1),a=new b1;return s.setFilter(new ed).setFilter(new Mp(t,e,!0)).setAction(a),s.doAction($L),a}static handleClickPourOutline(t,e){if(t)for(let r of t){let i=r.getParent()?r.getParent():r;i instanceof lt&&i.type=="Copper Region"&&(i.isSelectPolygon=e)}}static handleClickPour(t,e){if(t.length!==1)return t;let r=t[0];if(!(r instanceof Jr))return t;let i=!1,n=new Set,s=r.getParent().globalIndex;e.forEach(l=>{var c;if(l.globalIndex==s){i=!0;return}l instanceof Jr&&((c=l.getParent())==null?void 0:c.globalIndex)==s&&n.add(l)});let a=n.size;return i?a==0?[r]:n.has(r)?[r.getParent()]:[r]:a==0?[r.getParent()]:n.has(r)?[r.getParent()]:[r]}static handleCtrlClickPour(t,e){if(t.length!==1)return t;let r=t[0];if(!(r instanceof Jr))return t;if(e.length===0)return[r.getParent()];{let i=!1,n=!1;for(let s of e){if(s instanceof Jr){i=!0;break}if(s instanceof He&&s.type=="Copper Region"){n=!0;break}}return i&&n?[r.getParent()]:i?t:[r.getParent()]}}static pointSelect(t,e,r,i){let n=o.pointSelectBeforeFilter(t,e),s=new Set;if(jt.getVisible(35)&&jt.getPick(35)&&(s=n.drcs),s.size&&(typeof r>"u"||r===!1))return Array.from(s);let a=Array.from(n.getResult($L));R.getInstance().envFlag==="cnc-preview"&&(a=a.filter(m=>{let g=!1;if(m instanceof lt?g=m.isClose():m instanceof Pr&&(g=!0),g){let y=m instanceof lt||m instanceof Pr?m:m.getParent();if(y instanceof lt||y instanceof Pr){let b=y.getComponent();return!(b&&b instanceof ml)}return!0}return!1}));let c=new Array,h=new Array;for(let m of a)m.isSelect(t,e)?c.push(m):h.push(m);let u;c.length>0?(u=jt.pointFilter(t,e,c,r,i),u.length==0&&(u=jt.pointFilter(t,e,h,r,i))):u=jt.pointFilter(t,e,h,r,i);let d=[].concat(r===!0?Array.from(s):[],u),p=new Set;if(r)d.forEach(m=>{if(m instanceof Jr){let g=m.getParent();g&&p.add(g)}p.add(m)});else return d;return Array.from(p)}static getDrcAssoicItems(t){let e=new Set,r=new Jt;for(let i of t){if(!(i instanceof Tp))continue;let n=i.contentModel;if(n instanceof Py){let d=n.obj1,p=r.getItem(d);p&&e.add(p);continue}if(n instanceof Iy){let d=r.getItemsByNet([n.net_P]),p=r.getItemsByNet([n.net_N]);for(let m of d)e.add(m);for(let m of p)e.add(m);continue}if(n instanceof Sy){let d=r.getItemsByNet([n.net]);for(let p of d)e.add(p);continue}if(n instanceof KP){let d=r.getItemsByNet([n.net]);for(let p of d)e.add(p);continue}let s=n.obj,a=r.getItem(s);a&&e.add(a);let l=n.obj1,c=n.obj2,h=r.getItem(l);h&&e.add(h);let u=r.getItem(c);u&&e.add(u)}return Array.from(e)}static filterPartiton(t){let e=[];for(let r=0;r<t.length;r++){let i=t[r];if((i instanceof rr||i instanceof Pr||i instanceof lt)&&i.type==="Partition")continue;let n=i.getParent();n&&(n instanceof rr||n instanceof Pr||n instanceof lt)&&n.type==="Partition"||e.push(t[r])}return e}static selectNet(t,e){let r=new Array,i=Ai().getScale(),n=1;isNaN(i)||(n=1/i,n=n<1?1:n),i>10&&(n=.1);let s=new ht(t,t,e,e).extendOfSize(n),a=kt.search(s,void 0,!1),l=new b1;return a.setFilter(new ed).setFilter(new Mp(t,e)).setAction(l),a.doAction(Df),jt.selectNetFilter(t,e,l.getResult(Df))}static selectPad(t,e){let r=new Array,i=Ai().getScale(),n=1;isNaN(i)||(n=1/i,n=n<1?1:n);let s=new ht(t,t,e,e).extendOfSize(n),a=kt.search(s,(l,c)=>c=="Pad",!1);for(let l of a.pads)l.isEmpty||!l.isVisible||l.isSelect(t,e)&&r.push(l);return r}static selectPadCenter(t,e){let r,i=Ai().getScale(),n=1;isNaN(i)||(n=1/i,n=n<1?1:n);let s=new ht(t,t,e,e).extendOfSize(n),a=kt.search(s,(c,h)=>h=="Pad",!1),l=0;for(let c of a.pads){if(c.isEmpty||!c.isVisible||!c.isSelect(t,e))continue;let h=c.center.distance1(new S(t,e));(!l||h<l)&&(l=h,r=c)}return r}static checkIntersection(t,e){let r=new Set;return e.forEach(i=>{nx(t.model,i.model,!1)&&r.add(i)}),r}static getTouchItems(t){Zh.getInstance().clear();let e=new Set;t=[jt.filterActiveLayer(t)];let r=new Array,i=new Map,n=Pe.getActiveLayerID(),s=new Map;function a(l){if(!e.has(l)){let c=s.get(l.net);c==null&&(c=Iu.getConnect(l.net),s.set(l.net,c));let h=l instanceof Le&&!l.plated;for(let u of c)if(u.set.has(l.globalIndex)){let d=new Jt,p=!0;for(let[m,g]of u.padMap){let y=i.get(m);if(y==null){if(h){g.has(n)?i.set(m,g):p=!1;continue}i.set(m,g)}else{if(h){g.has(n)?xe.addAllSet(y,g):p=!1;continue}xe.addAllSet(y,g)}}if(!p)continue;for(let m of u.set){let g=d.getConnectNode(m);g instanceof Qo&&!e.has(g)&&(e.add(g),r.push(g))}}}}for(let l of t){let c=Pe.getLayer(l.layerId);(l instanceof Ge||l instanceof Ue||l instanceof Le||l instanceof He&&c&&c.isSignalLayer())&&(e.has(l)||a(l),e.add(l),r.push(l))}for(;r.length>0;){let c=function(g,y){if(l instanceof Ge)return g==l.layerId||g==12;if(l instanceof Le){if(!l.plated){let b=i.get(l.globalIndex);if(b!=null)return g==12||b.has(g)}return l.layerId==12||l.layerId==g}else return l instanceof Ue?l.isContains(g)||g==12:l instanceof He?g==l.layerId||g==12:l instanceof Qp?g==l.layerId||g==12:!1},d=function(g,y,b=!0){let P=new gd;return P.whetherCheckNet=b,P.needCheckIntersection(g,y)?new uy().checkIntersection(g,y):!1},p=function(g,y){let b=new Set;return y.forEach(P=>{d(g.model,P.model,!1)&&b.add(P)}),b},l=r.shift();l.net!=""&&l.net!=null&&!e.has(l)&&a(l),e.add(l);let h=kt.search4Types(l.buildBBox(),Mvt,c),u=new Array;for(let g of h.getResult(jd))g instanceof Qo&&!e.has(g)&&u.push(g);let m=p(l,u);for(let g of m)g instanceof Qo&&!e.has(g)&&r.push(g)}return e}};function gce(o,t,e=!1,r){let i=new Set;ze.getSelects().forEach(a=>{i.add(a)}),Vr.handleClickPourOutline(r,!0);let n=Array.from(Vr.pointSelect(o,t));r&&(n=Vr.handleCtrlClickPour(n,r)),Vr.handleClickPourOutline(r,!1),n=n.filter(a=>!To.isAnnotation(a));let s=!0;for(let a of n){if(a instanceof mt||a instanceof _t){let l=a.getParent();if(i.has(l))continue}else if(a instanceof lt){let l=a.selectChild(o,t);if(i.has(l))continue}if(!i.has(a)){s=!1;break}}if(s){for(let a of n){if(a.visible(),a instanceof mt||a instanceof _t){let l=a.getParent();l!=null&&i.has(l)&&(l.visible(),i.delete(l))}else if(a instanceof lt){let l=a.selectChild(o,t);i.has(l)&&(l.visible(),i.delete(l))}i.delete(a)}i.forEach(a=>{a.click()}),A.publish("select",i),gr.model=1}else{for(let l of n)i.add(l);let a=jt.filterParent(new Set(US(i)));e&&(a=i),a.forEach(l=>{l.click()}),A.publish("select",a),gr.model=1}}var yce=class{constructor(t){this.id=t}};function aD(){return A.windowBridge.rpcCall("getLanguage","",f0())}function ip(o,t,e){let i=new Jt().getItem(o),n=e!=null?e:i.net?`(${i.net})`:"",s;if(i instanceof Jr?s=`${Tr}${i.getParent().number}${Tr}${i.number}`:s=`${Tr}${i.number}`,i instanceof _i){let a=i.getParent();a instanceof ke?s=`${a.name}_${i.num}`:i.isTestPad&&(s=`${Tr}${i.number}`)}else i instanceof ke&&(s=i.name);return{typeName:t,suffix:`${n}: ${s}`}}function iYe(o,t){let e=i(o),r=i(t);return e&&r&&e==r;function i(n){let a=new Jt().getItem(n);if(a){let l=a.getParent();if(l){if(l instanceof ke)return l;let c=l.getParent();if(c&&c instanceof ke)return c}}return!1}}function FV(o){let t=o.contentModel,e=iYe(t.obj1,t.obj2),r=aa(t.minDistance,R.getInstance().unit),i=">= "+aa(t instanceof O0?t.clearance:t.distance,R.getInstance().unit),n;if(t.obj1Type=="Prohibited Region"||t.obj2Type=="Prohibited Region"){let l=typeof t.obj1<"u"?ip(t.obj1,t.obj1Type).suffix:"",c=typeof t.obj2<"u"?ip(t.obj2,t.obj2Type).suffix:"";return n={str:"{obj1} and {obj2} overlap",param:{obj1:"Object 1",obj2:"object 2"},errData:{...t.toJSON(),obj1Suffix:l,obj2Suffix:c}},n}let s=typeof t.obj1<"u"?ip(t.obj1,t.obj1Type).suffix:"",a=typeof t.obj2<"u"?ip(t.obj2,t.obj2Type).suffix:"";return n={str:e?"{obj1} to {obj2} in the same footprint distance is {minDistance}, should be {shouldBe}":"{obj1} to {obj2} distance is {minDistance}, should be {shouldBe}",param:{minDistance:r,shouldBe:i,obj1:"Object 1",obj2:"object 2",type:"ClearanceError"},errData:{...t.toJSON(),obj1Suffix:s,obj2Suffix:a}},n}function Nvt(o){let t=o.contentModel,e=aa(t.minDistance,R.getInstance().unit),r=">= "+aa(t.clearance,R.getInstance().unit),i=typeof t.obj1<"u"?ip(t.obj1,t.obj1Type).suffix:"",n=typeof t.obj2<"u"?ip(t.obj2,t.obj2Type).suffix:"";return{str:"{obj1} to {obj2} creepage is {minDistance}, should be {shouldBe}",param:{minDistance:e,shouldBe:r,obj1:"Object 1",obj2:"object 2",type:"CreepageError"},errData:{...t.toJSON(),obj1Suffix:i,obj2Suffix:n}}}function kvt(o){let t=o.contentModel,e=">= "+aa(t.clearance,R.getInstance().unit),r=aa(t.minDistance,R.getInstance().unit),i=typeof t.obj1<"u"?ip(t.obj1,t.obj1Type).suffix:"",n=typeof t.obj2<"u"?ip(t.obj2,t.obj2Type).suffix:"";return{str:"{obj1} to {obj2} distance is {minDistance}, should be {shouldBe}",param:{minDistance:r,shouldBe:e,obj1:"Object 1",obj2:"object 2",type:"ClearanceError"},errData:{...t.toJSON(),obj1Suffix:i,obj2Suffix:n}}}function $3e(o){let t=o.contentModel,e=aa(t.width,R.getInstance().unit),r=aa(t.minWidth,R.getInstance().unit),i=aa(t.maxWidth,R.getInstance().unit),n=`${r} ~ ${i}`;return{str:"{obj1} stroke width is {width}, should be {shouldBe}",param:{width:e,shouldBe:n,obj1:"Object 1",type:"TrackError"},errData:{...t.toJSON()}}}function K3e(o){let t=o.contentModel,e=aa(t.width,R.getInstance().unit),r=aa(t.minWidth,R.getInstance().unit),i=aa(t.maxWidth,R.getInstance().unit),n=`${r} ~ ${i}`;return{str:"{obj1} stroke width is {width}, should be {shouldBe}",param:{width:e,shouldBe:n,obj1:"Object 1",type:"DifferentPairWidthError"},errData:{...t.toJSON()}}}function Z3e(o){let t=o.contentModel,e=Math.abs(t.value_P-t.value_N),r=aa(e,R.getInstance().unit),n=`<=${aa(t.toleranceScope,R.getInstance().unit)}`;return{str:"{obj1} to {obj2} length tolerance is {width}, should be {shouldBe}",param:{width:r,shouldBe:n,obj1:"Object 1",obj2:"object 2",type:"DifferentPairLengthError"},errData:{...t.toJSON()}}}function J3e(o){let t=o.contentModel;return{str:"{obj1} layer pair is {startLayer} - {endLayer}, which is not allowed by the rule",param:{startLayer:Pe.getLayer(t.startLayer).name,endLayer:Pe.getLayer(t.endLayer).name,obj1:"Object 1",type:"BlindError"},errData:{...t.toJSON()}}}function Q3e(o){let t=o.contentModel,e=aa(t.maxRadius*2,R.getInstance().unit),r=aa(t.minRadius*2,R.getInstance().unit),i=aa(t.radius*2,R.getInstance().unit),n=t.type?"outer":"inner",s=`${r} ~ ${e}`;return{str:t.type?"The outer diameter of the via hole of {obj1} is {diameter}, which should be {shouldBe}":"The inner diameter of the via hole of {obj1} is {diameter}, which should be {shouldBe}",param:{outerOrInner:n,diameter:i,shouldBe:s,obj1:"object 1",type:"RadiusError"},errData:{...t.toJSON()}}}function eEe(o){let t=o.contentModel,e=aa(t.minNetLength,R.getInstance().unit),r=aa(t.maxNetLength,R.getInstance().unit),i=aa(t.netLength,R.getInstance().unit),n=`${e} ~ ${r}`;return{str:"{obj1} net length is {netLength}, should be {shouldBe}",param:{netLength:i,shouldBe:n,obj1:"Object 1",type:"NetLengthError"},errData:{...t.toJSON()}}}function tEe(o){let t=o.contentModel,e=typeof t.obj1<"u"?ip(t.obj1,t.obj1Type).suffix:"";return{str:t.errInfo,param:{obj1:"Object 1",type:"ConnectError"},errData:{...t.toJSON(),obj1Suffix:e}}}function Bvt(o){let t=o.contentModel,e=typeof t.obj1<"u"?ip(t.obj1,t.obj1Type).suffix:"";return{str:"{obj1} is copper bridge, but has no connected to {net} net",param:{obj1:"Object 1",type:"ConnectError",net:t.net},errData:{...t.toJSON(),obj1Suffix:e}}}function nYe(o){let t=o.contentModel;return{str:"PCB Netlist and schematic netlist does not match",param:{},errData:{...t.toJSON()}}}function Fvt(o,t){let e=t.getItem(o.obj1).model,r=t.getItem(o.obj2).model,i=ei.isBridgingCopper(e),n=ei.isBridgingCopper(r),s=ip(o.obj1,o.obj1Type),a=ip(o.obj2,o.obj2Type);if(i&&n){let l=e.component.networkList,c=r.component.networkList,h=o.net,u=(d,p)=>{s=ip(o.obj1,o.obj1Type,d),a=ip(o.obj2,o.obj2Type,p)};l.includes(h)&&!c.includes(h)?u(h,c[0]):!l.includes(h)&&c.includes(h)?u(l[0],h):l.includes(h)&&c.includes(h)&&u(h,c.find(d=>d!==h))}else if(i||n){let l=o.net;i?s=ip(o.obj1,o.obj1Type,l):a=ip(o.obj2,o.obj2Type,l)}return{obj1:s,obj2:a}}function oYe(o){return new Promise(async(t,e)=>{let r="$$ getAllDrcErrors-time";Cn(r);let{isOpenDRCCustomCheck:i}=o||{};DR.isOpenDRCCustomCheck=i;let n=new Set;kt.itoratorAllItems(D=>{n.add(D.item)}),pd.reset(),$i.getInstance().language=(await aD()).message||"zh-cn",A.publish("progressUpdate",[0,"Design rule check"],Q()),await A.messageBus.rpcCall("drc",{items:n,option:{maxProgressFromWorker:.9}}),Bo.deleteAllConnectError(),Hse.checkConnect();let s=[];for(let D of ci.getInstance().idMapConnect.values())s.push(D);Bo.syncFromContentModel(s),A.publish("progressUpdate",[1,"Design rule check"],Q());let a=Bo.getAllErrors(),l={},c={},h=[],u={},d=D=>{let w=D.layerIds.length==1?D.layerIds[0]:ay(D.layerIds[0],D.layerIds[1]);return Pe.getLayerName(w)},p=new Jt;a.clearance.forEach(D=>{let w=D.contentModel,F=iYe(w.obj1,w.obj2),H=F?c:l,z=[w.obj1Type,w.obj2Type].sort().join(" to ");H[z]||(H[z]={name:z,list:[]});let V=FV(D),{obj1:W,obj2:L}=Fvt(w,p);H[z].list.push({visible:D.isVisible,errorType:F?"Clearance Error in the same footprint":"Clearance Error",errorObjType:z,ruleName:w.name,ruleTypeName:w.errorType,obj1:W,obj2:L,layer:d(w),explanation:V,objs:[w.obj1,w.obj2],globalIndex:w.globalIndex,pos:w.position})}),a.creepage.forEach(D=>{let w=D.contentModel,F=[w.obj1Type,w.obj2Type].sort().join(" to ");u[F]||(u[F]={name:F,list:[]});let H=Nvt(D);u[F].list.push({visible:D.isVisible,errorType:"Creepage Error",errorObjType:F,ruleName:w.name,ruleTypeName:w.errorType,obj1:ip(w.obj1,w.obj1Type),obj2:ip(w.obj2,w.obj2Type),layer:d(w),explanation:H,objs:[w.obj1,w.obj2],globalIndex:w.globalIndex,pos:w.position})}),a.diff.forEach(D=>{let w=D.contentModel,F=[w.obj1Type,w.obj2Type].sort().join(" to ");h.push({visible:D.isVisible,errorType:"Differential Pair Error",errorObjType:F,ruleName:w.name,ruleTypeName:"Differential Pair",obj1:ip(w.obj1,w.obj1Type),obj2:ip(w.obj2,w.obj2Type),layer:d(w),explanation:kvt(D),objs:[w.obj1,w.obj2],globalIndex:w.globalIndex,pos:w.position})});let m=a.track.map(D=>{let w=D.contentModel;return{visible:D.isVisible,errorType:"Physical Error",errorObjType:"Track",ruleName:w.name,obj1:ip(w.obj1,"Track"),layer:d(w),explanation:$3e(D),objs:[w.obj1],globalIndex:w.globalIndex,pos:w.position}}),g=a.diffPairTrack.map(D=>{let w=D.contentModel;return{visible:D.isVisible,errorType:w.errorType,errorObjType:"Track",ruleName:w.name,ruleTypeName:"Differential Pair",obj1:ip(w.obj,"Track"),layer:d(w),explanation:K3e(D),objs:[w.obj],globalIndex:w.globalIndex,pos:w.position}}),y=new Set;a.diffPairLength.map(D=>{let w=D.contentModel;y.has(w)||(y.add(w),h.push({visible:D.isVisible,errorType:w.errorType,errorObjType:"Track to Track",ruleName:w.name,ruleTypeName:"Differential Pair",obj1:{suffix:`(${w.net_P})`,typeName:"Track"},obj2:{suffix:`(${w.net_N})`,typeName:"Track"},explanation:Z3e(D),objs:[w.net_P,w.net_N],globalIndex:w.globalIndex,globalIndexIsNet:!0,pos:w.position}))});let b=a.blind.map(D=>{let w=D.contentModel;return{visible:D.isVisible,errorType:"Physical Error",errorObjType:"Blind",ruleName:w.name,obj1:ip(w.obj,"Via"),explanation:J3e(D),objs:[w.obj],globalIndex:w.globalIndex,pos:w.position}}),P=a.radius.map(D=>{let w=D.contentModel;return{visible:D.isVisible,errorType:"Physical Error",errorObjType:"Via Size",ruleName:w.name,obj1:ip(w.obj1,"Via"),explanation:Q3e(D),objs:[w.obj1],globalIndex:w.globalIndex,pos:w.position}}),T=a.netLength.map(D=>{let w=D.contentModel;return{visible:D.isVisible,errorType:"Physical Error",errorObjType:"Net Length Range",ruleName:w.name,obj1:{typeName:"Net",suffix:`: ${w.net}`},explanation:eEe(D),objs:[w.net],globalIndex:w.globalIndex,globalIndexIsNet:!0,pos:w.position}}),I=a.netLengthTolerance.map(D=>{let w=D.contentModel,F=aa(w.netLengthDiff,R.getInstance().unit),H=aa(w.netLengthTolerance,R.getInstance().unit),z=`\xB1${H}`;return{visible:D.isVisible,errorType:"Physical Error",errorObjType:"Net Length Tolerance",ruleName:w.name,obj1:{typeName:"Net",suffix:`: ${w.net}`},explanation:{str:"{obj1} net length tolerance is {netLengthDiff}, should be {shouldBe}",param:{obj1:"Object 1",netLengthDiff:F,shouldBe:z}},objs:[w.net],globalIndex:w.globalIndex,globalIndexIsNet:!0,pos:w.position}}),C={};a.connect.forEach(D=>{let w=D.contentModel;if(C[w.net]||(C[w.net]={name:w.net,list:[],doNotTranslate:!0}),w.obj1Type=="Bridging Copper"){C[w.net].list.push({visible:!0,errorType:"Connection Error",errorObjType:"Fill Region",ruleName:"Common",obj1:{suffix:`(${w.net})`,typeName:"Fill Region"},obj2:{suffix:`(${w.net})`,typeName:"Net"},layer:d(w),isFree:!0,net:w.net,explanation:Bvt(D),objs:[w.obj1],globalIndex:w.globalIndex,pos:w.position});return}let F={};w.obj1==""?F={suffix:`(${w.net})`,typeName:w.obj1Type}:F=ip(w.obj1,w.obj1Type),C[w.net].list.push({visible:!0,errorType:"Connection Error",errorObjType:w.obj1Type,ruleName:"Common",obj1:F,isFree:w.isFree,net:w.net,explanation:tEe(D),objs:[w.obj1],globalIndex:w.globalIndex,pos:w.position})});let E=[{name:"Track",list:m},{name:"Net Length Range",list:T},{name:"Net Length Tolerance",list:I},{name:"Blind/Buried Via",list:b},{name:"Via Diameter",list:P}].filter(D=>D.list.length>0),O=[{name:"Track",list:g},{name:"Track to Track",list:h}].filter(D=>D.list.length>0);A.publish("updateFrame","");let _=[],x=a.netlist[0];x&&_.push({name:"Netlist Error",list:[{visible:x.isVisible,errorType:"Netlist Error",errorObjType:"Netlist Error",ruleName:"Import Changes",ruleTypeName:"Import Changes",obj1:{typeName:"Schematic Netlist",suffix:""},obj2:{typeName:"PCB Netlist",suffix:""},objs:[x.globalIndex],explanation:{str:'PCB and schematic netlist does not match. You can click on the rule name "Import Changes" to view the difference.',param:{}},globalIndex:x.globalIndex}]});let v=[{name:"Clearance Error",list:Object.values(l),visible:!0},{name:"Clearance Error in the same footprint",list:Object.values(c),visible:!0},{name:"Physical Error",list:E,visible:!0},{name:"Differential Pair Error",list:O,visible:!0},{name:"Connection Error",list:Object.values(C),visible:!0},{name:"Netlist Error",list:Object.values(_),visible:!0},{name:"Creepage Error",list:Object.values(u),visible:!0}];t(v),Xi(r)})}var bce=class extends yce{constructor(){super(...arguments);this._openTimeOut=null;this._closeTimeOut=null;this.openFlag=!1}open(e,r,i){this.openFlag=!0;let n=_o(new S(e,r));A.windowBridge.publish("openDialogWithTest",{data:i,position:n},Q()),clearTimeout(this._closeTimeOut),this._closeTimeOut=setTimeout(()=>{this.destroy()},5e3)}interrupt(){this.openFlag&&(A.windowBridge.publish("closeDialogWithTest","",Q()),clearTimeout(this._closeTimeOut),clearTimeout(this._openTimeOut),this.openFlag=!1)}destroy(){this.interrupt()}rerender(e,r){this.openFlag=!0;let i=this;clearTimeout(this._openTimeOut),this._openTimeOut=setTimeout(()=>{if(!le.pcbConfig.displayProperty)return;let n=this.getData(e,r);n.length>0&&this.open(e,r,n)},500)}getData(e,r){let i=new Array,n=Vr.pointSelect(e,r,void 0,!0);if(n.length<=0)return i;if(n[0]instanceof Tp){let s=n[0],a=s.contentModel,l={str:"",param:{}};a instanceof O0?l=FV(s):a instanceof Py?l=tEe(s):a instanceof Ty?l=FV(s):a instanceof Iy?l=Z3e(s):a instanceof Cy?l=K3e(s):a instanceof yI?l=FV(s):a instanceof Sy?l=eEe(s):a instanceof tF?l=FV(s):a instanceof Ey?l=Q3e(s):a instanceof Oy?l=$3e(s):a instanceof _b?l=J3e(s):a instanceof b3&&(l=nYe(s)),i.push({title:"DRC",hiddenTitle:!0,id:"",content:[{module:"DRC",label:"DRC",value:"",sourceData:l,needTranslate:!0}]})}else{let s=null;for(let c=0;c<n.length;c++)if(n[c].net!==void 0){s=n[c].net;break}let a=[7,8,12],l=n[0].getGroupID();for(let c of a)if(jt.getPick(c)){let h=this.getContent4Element(c,s,l);h.length>0&&i.push({title:this.getTitle4Element(c),id:"",content:h})}if(i.length==0)for(let c of n){let h=this.getContent4PcbItem(c);h.length>0&&i.push({title:this.getTitle4PcbItem(c),id:c.globalIndex,content:h})}}return i}getContent4Element(e,r,i){let n=new Array;switch(e){case 7:{if(r){let s=this.getContent("Net",r);n.push(s)}return n}case 8:{let s=Ye.getNetLength(r),a=this.getContent("Net",r),l=this.getContent("Net Length",je(s)+R.getInstance().unit);return n.push(a),n.push(l),n}case 12:{if(i!=null){let s=this.getContent("Group Name",Ht.getGroupNameByGroupId(i));n.push(s)}return n}default:return[]}}getTitle4Element(e){switch(e){case 7:return"Pad Pair";case 8:return"Net";case 12:return"Combination";default:return""}}getTitle4PcbItem(e){if(e instanceof Ge)return"Track";if(e instanceof Ue)return"Via";if(e instanceof Le)return e.isTestPad?"Test Point":"Pad";if(e instanceof ke)return"Component";if(e instanceof He)return this.getProfiltTitle(e);if(e instanceof mt||e instanceof _t){let r=e.getParent();return r!=null&&r instanceof He?this.getProfiltTitle(r):""}else{if(e instanceof lr)return"Text";if(e instanceof ua)return"Dimension";if(e instanceof Mn)return"Image";if(e instanceof Ps)return"Colorful Image";if(e instanceof Gi)return"Plane Zone";if(e instanceof Jr)return"Copper Fills"}}getContent4PcbItem(e){if(e instanceof Ge)return this.getTrackContent(e);if(e instanceof Ue)return this.getViaContent(e);if(e instanceof Le)return this.getPadContent(e);if(e instanceof ke)return this.getComponentContent(e);if(e instanceof He)return this.getProfileContent(e);if(e instanceof mt||e instanceof _t){let r=e.getParent();return r!=null&&r instanceof He?this.getProfileContent(r):[]}else{if(e instanceof lr)return this.getTextContent(e);if(e instanceof ua)return this.getDimensionContent(e);if(e instanceof Mn)return this.getImageContent(e);if(e instanceof Ps)return this.getImageContent(e);if(e instanceof Gi)return this.getPlaneZoneContent(e);if(e instanceof Jr)return this.getCopperResultContent(e)}return[]}is2DLine(e){return e=="Board Outline"||e=="Slot Region"||e=="Copper Region"||e=="Fill Region"||e=="Prohibited Region"||e=="Line"}getProfiltTitle(e){let r=e.type;return this.is2DLine(r)?"Outline Object":r=="3D Shell - Outline"?"3D Shell - Outline":r=="3D Shell - Screw Pillar"?"3D Shell - Screw Pillar":r=="3D Shell - Side Datum Line"?"3D Shell - Side Datum Line":r=="3D Shell - Top Slot Region"||r=="3D Shell - Side Slot Region"?"3D Shell - Slot Region":r=="3D Shell - Top/Bottom Entity"||r=="3D Shell - Side Entity"?"3D Shell - Entity":r=="FPC Stiffener"?"FPC Stiffener":r=="TearDrop"?"Teardrop":""}getContent(e,r){return{label:e,value:r,module:"COMMON"}}getTrackContent(e){let r=Ye.getNetLength(e.net),i=this.getContent("Width",je(e.width)+R.getInstance().unit),n=this.getContent("Net",e.net),s=this.getContent("Layer",Pe.getLayerName(e.layerId)),a=this.getContent("Net Length",je(r)+R.getInstance().unit);return[i,n,s,a]}getViaContent(e){let r=this.getContent("Outside Diameter",je(e.radius*2)+R.getInstance().unit),i=this.getContent("Inside Diameter",je(e.holeRadius*2)+R.getInstance().unit),n=this.getContent("Layer Pair",Pe.getLayerName(e.startLayer)+" to "+Pe.getLayerName(e.endLayer));return[r,i,n]}getPadContent(e){let r=this.getContent("Number",e.num);if(R.getInstance().doctype==3){let i=this.getContent("Net",e.net);return[r,i]}return[r]}getComponentContent(e){let r=this.getContent("Designator",e.designator),i=this.getContent("Footprint",e.footprintId),n=this.getContent("Device",e.device);return[r,i,n]}getProfileContent(e){var i;let r=e.type;if(this.is2DLine(r))return[this.getContent("Type",r)];if(r=="3D Shell - Outline"){let n=e.getComponent(),s=n.type;s=="T&B"?s="Upper and lower shell":s=="DRAWER"&&(s="Push cover");let a=this.getContent("Type",s),l=this.getContent("Overall height of shell",je(n.shellHeight)+R.getInstance().unit);return[a,l]}else if(r=="3D Shell - Screw Pillar"){let n=e.getComponent(),s=this.getContent("Screw specifications",n.specification),a=this.getContent("Layer",Pe.getLayerName(e.layerId));return[s,a]}else{if(r=="3D Shell - Side Datum Line")return[this.getContent("Layer",Pe.getLayerName(e.layerId))];if(r=="3D Shell - Top Slot Region")return[this.getContent("Type",e.type)];if(r=="3D Shell - Side Slot Region")return[this.getContent("Type",e.type)];if(r=="3D Shell - Top/Bottom Entity"||r=="3D Shell - Side Entity")return[this.getContent("Type",e.type)];if(r==="FPC Stiffener"){let n=e.getComponent(),a=(i=td.getMaterialOptions().filter(l=>l.value===n.material)[0])==null?void 0:i.text;return[this.getContent("FPCMaterial",a)]}else if(r=="TearDrop")return this.getTearDropContent(e)}return[]}getTextContent(e){return[this.getContent("Layer",Pe.getLayerName(e.layerId))]}getDimensionContent(e){let r=this.getContent("Dimension Type",e.type),i=this.getContent("Layer",Pe.getLayerName(e.layerId));return[r,i]}getImageContent(e){return[this.getContent("Layer",Pe.getLayerName(e.layerId))]}getPlaneZoneContent(e){return[this.getContent("Net",e.net)]}getTearDropContent(e){return[this.getContent("Net",e.net)]}getCopperResultContent(e){return[this.getContent("Net",e.net)]}};var Pce=class{constructor(){this.mouseX=0;this.mouseY=0;this.deltaX=0;this.deltaY=0;this.sceneDeltaX=0;this.sceneDeltay=0;this.keyCode=0;this.shiftKey=!1;this.ctrlKey=!1;this.altKey=!1;this.metaKey=!1}};var K6=class K6 extends Pce{constructor(e,r){super();this.realSceneX=0;this.realSceneY=0;this.realSceneDeltaX=0;this.realSceneDeltay=0;this.sceneX=0;this.sceneY=0;this.sceneDeltaX=0;this.sceneDeltaY=0;this.lastSceneX=0;this.lastSceneY=0;this.adsorb=!0;this.adsorbGrid=!0;this.leftDown=!1;this.leftClick=!1;this.rightDown=!1;this.middleDown=!1;this.downTime=0;this.openMenu=!1;this.autoCutSilk=!0;this.boxSelection=!1;this.point=null;this.extensionCord=[];this.crossFlagMax=8;this.crossFlags=[];this.tool=new bce("");this._hovering=!1;this._mouseInFrame=!0;this.canvasWidth=e||0,this.canvasHeight=r||0}static getInstance(){return K6.instance==null&&(K6.instance=new K6(1,1)),K6.instance}get mouseInFrame(){return this._mouseInFrame}set mouseInFrame(e){this._mouseInFrame=e,this.tool.destroy()}get triggerSource(){return this._triggerSource}set triggerSource(e){this._triggerSource=e}get hovering(){return this._hovering}set hovering(e){this._hovering=e,this.tool.destroy()}getShowPoint(){return this.point}showPoint(){this.point!=null?(this.point.visible(),this.point.setPosition(new S(this.sceneX,this.sceneY))):this.point=new Ui(1002,new S(this.sceneX,this.sceneY),!1,ee.WHITE)}hidePoint(){this.point!=null&&this.point.hidden()}removePoint(){this.point!=null&&(this.point.remove(),this.point=null)}addCrossFlag(e,r){if(this.hasRepeatCrossFlag(e,r))return;let i=new t8(e,1002,r);this.crossFlags.push(i),this.crossFlags.length>this.crossFlagMax&&(this.crossFlags[0].remove(),this.crossFlags.shift())}clearCrossFlag(){for(let e of this.crossFlags)e.remove();this.crossFlags=[]}hasRepeatCrossFlag(e,r){for(let i of this.crossFlags)if(i.isRepeat(e,r))return!0;return!1}getCrossFlags(){return this.crossFlags}addExtensionCord(e,r=!1){if(this.extensionCord){for(let i of this.extensionCord)i.remove();this.extensionCord=[]}for(let i of[].concat(e))this.extensionCord.push(new Bre(i.start(),i.end(),1002,r))}removeExtensionCord(){for(let e of this.extensionCord)e.remove();this.extensionCord=[]}getExtensionCord(){return this.extensionCord}setIsBoxSelection(e=!1){this.boxSelection=!!e}getIsBoxSelection(){return this.boxSelection}hover(){this._mouseInFrame&&this._hovering&&!this.leftDown&&!this.rightDown?this.tool.rerender(this.realSceneX,this.realSceneY):this.tool.destroy()}};K6.instance=null;var fi=K6;var rEe=Math.sqrt(2)/2,sYe=Math.sqrt(4+2*Math.sqrt(2)),Vvt=1/sYe,zy=Math.PI/2,mT=Math.PI/4,Tce=Math.PI/8;var Ice=class{constructor(){this.tool=new Xn}octagonCenter(t,e,r,i){let n=i==ae.CCW?Tce*5:-Tce*5,s=e.rotate(S.ORIGIN,n);return t.add(s.mul(r))}octagonRadius(t){let e=Math.sin(Tce);return t/2/e}octagonDelta(t){let e=Math.cos(Tce);return t/e}getNormalOffset(t,e){let r=new S(-t.y,t.x);return r.mul(e.dot(r))}isLimit45(t,e,r,i=0){let n=e.sub(t);if(ne.less(n.length(),sYe*i)){let c=e.sub(t).normalize().dot(r);return!!ne.greatereq(c,Vvt)}let a=e.sub(t).normalize().dot(r);return!!ne.greatereq(a,rEe)}isLimit90(t,e,r,i=0){let n=e.sub(t);if(ne.less(n.length(),rEe*i)){let c=e.sub(t).normalize().dot(r);return!!ne.greatereq(c,rEe)}let a=e.sub(t).normalize().dot(r);return!!ne.greatereq(a,0)}rectCenter(t,e,r,i){let n=this.rectRadius(r),s=i==ae.CCW?zy+mT:-(zy+mT),a=e.rotate(S.ORIGIN,s);return t.add(a.mul(n))}rectRadius(t){let e=Math.sin(mT);return t/2/e}getSweep(t,e){return t.cross(e)>0?ae.CCW:ae.CW}degree45_v1(t){this.fixEnd(t);let{lastDirect:e,start:r,end:i}=t.directInfo;if(t.node.isRight||r.equals1(i)){let d=t.edgeParam.edgeLength*Math.cos(t.edgeParam.angle*2);if(ne.lesseq(t.node.dis,d))return t.directInfo.lastDirect.dot(t.directInfo.nextDirect)>.99?[r,r]:[r,r.add(e.mul(t.edgeParam.delta))]}let n=new Array;n.push(r),r=r.add(e.mul(t.edgeParam.delta)),n.push(r);let s=this.octagonRadius(t.edgeParam.edgeLength),a=this.octagonCenter(r,e,s,t.node.sweep),l=r,c=t.node.sweep==ae.CCW?mT:-mT,h=0,u=t.edgeParam.min;for(;!this.isLimit45(l,i,e,u)&&h<8;){let d=l.sub(a).normalize();d=d.rotate(S.ORIGIN,c),e=e.rotate(S.ORIGIN,c),l=a.add(d.mul(s)),n.push(l),h++}return n}degree45_v2(t,e){let{lastDirect:r,start:i}=t.directInfo,n=e.directInfo.start,s=e.directInfo.lastDirect,a=new Array;a.push(i),i=i.add(r.mul(t.edgeParam.delta)),a.push(i);let l=new Array;l.push(n),n=n.add(s.mul(e.edgeParam.delta)),l.push(n);let c=this.octagonRadius(t.edgeParam.edgeLength),h=this.octagonCenter(i,r,c,t.node.sweep),u=this.octagonRadius(e.edgeParam.edgeLength),d=this.octagonCenter(n,s,u,e.node.sweep),p=i,m=n,g=t.node.sweep==ae.CCW?mT:-mT,y=e.node.sweep==ae.CCW?mT:-mT,b=0,P=this.needRotate(p,m,r),T=this.needRotate(m,p,s);for(;P||T;){if(P){let I=p.sub(h).normalize();I=I.rotate(S.ORIGIN,g),r=r.rotate(S.ORIGIN,g),p=h.add(I.mul(c)),a.push(p),b++}if(T=this.needRotate(m,p,s),T){let I=m.sub(d).normalize();I=I.rotate(S.ORIGIN,y),s=s.rotate(S.ORIGIN,y),m=d.add(I.mul(u)),l.push(m),b++}if(P=this.needRotate(p,m,r),b>16)break}return[a,l]}getDirection(t,e,r){let i=this.tool.degree45(t,e,r);return zs(t,i)[0]}degree45_v3(t,e,r,i){let n=t.direct,s;i?(n=this.getDirection(t.direct,t.start.point,t.end.point),s=lj(t.end.point,t.start.point)):s=t.direct.mul(-1);let a=!t.start.fix&&this.needRotate(t.start.point,t.end.point,t.start.direct)&&!this.isAcuteAngle(t.start.direct,n);(a||t.start.direct.dot(n)<.99&&!t.start.fix)&&(t.start=t.start.getSameDirect(e.edgeParam.delta)),a=!t.start.fix&&this.needRotate(t.start.point,t.end.point,t.start.direct)&&!this.isAcuteAngle(t.start.direct,n);let l=!t.end.fix&&this.needRotate(t.end.point,t.start.point,t.end.direct)&&!this.isAcuteAngle(t.end.direct,s);if(l)t.end=t.end.getSameDirect(r.edgeParam.delta);else{let y;i?y=this.tool.degree45(t.direct,t.start.point,t.end.point):y=this.tool.degree45(t.end.direct,t.end.point,t.start.point);let b=zs(t.end.direct,y),P=i?b[1].mul(-1):b[0];t.end.direct.dot(P)<.99&&!t.end.fix&&(t.end=t.end.getSameDirect(r.edgeParam.delta))}l=!t.end.fix&&this.needRotate(t.end.point,t.start.point,t.end.direct);let c=this.octagonRadius(e.edgeParam.edgeLength),h=this.octagonCenter(t.start.point,t.start.direct,c,e.node.sweep),u=this.octagonRadius(r.edgeParam.edgeLength),d=this.octagonCenter(t.end.point,t.end.direct,u,r.node.sweep),p=e.node.sweep==ae.CCW?mT:-mT,m=r.node.sweep==ae.CCW?mT:-mT,g=0;for(;a||l;){if(a=!t.start.fix&&this.needRotate(t.start.point,t.end.point,t.start.direct)&&!this.isAcuteAngle(t.start.direct,n),a){let y=t.start.point.sub(h).normalize();y=y.rotate(S.ORIGIN,p);let b=t.start.direct.rotate(S.ORIGIN,p);t.start=t.start.getNext(h.add(y.mul(c))),t.start.direct=b,g++}if(l=!t.end.fix&&this.needRotate(t.end.point,t.start.point,t.end.direct)&&(i&&g==0||!this.isAcuteAngle(t.end.direct,s)),l){let y=t.end.point.sub(d).normalize();y=y.rotate(S.ORIGIN,m);let b=t.end.direct.rotate(S.ORIGIN,m);t.end=t.end.getNext(d.add(y.mul(u))),t.end.direct=b,g++}if(g>16)break}}needRotate90(t,e,r){let i=this.tool.degree90Model(t,e),n=i[0].sub(t),s=i[1].sub(t),a=Math.abs(n.x)<1e-4&&Math.abs(n.y)<1e-4,l=Math.abs(s.x)<1e-4&&Math.abs(s.y)<1e-4,c=n.normalize(),h=s.normalize();return a&&l?!1:(!a&&l?h=c:a&&!l&&(c=h),this.isObtuseAngle(r,c)||this.isObtuseAngle(r,h))}isObtuseAngle(t,e){return t.dot(e)<-.01}needRotate(t,e,r){let i=this.tool.degree45Model(t,e),n=i[0].sub(t),s=i[1].sub(t),a=Math.abs(n.x)<1e-4&&Math.abs(n.y)<1e-4,l=Math.abs(s.x)<1e-4&&Math.abs(s.y)<1e-4,c=n.normalize(),h=s.normalize();if(a&&l)return!1;!a&&l?h=c:a&&!l&&(c=h);let u=this.isAcuteAngle(r,c),d=this.isAcuteAngle(r,h);return!(u&&d)}isAcuteAngle(t,e){return t.dot(e)>.01}fixEnd(t){if(ne.eq(t.node.dis,0))return;let{lastDirect:e,end:r}=t.directInfo;if(t.node.isRight){let i=this.getPoints(t);this.inInner(i,r,t.node.sweep)&&this.fixRightEndpoint(t)}else{let i=1+Math.cos(t.edgeParam.angle*2)*2,n=t.edgeParam.dis2+t.edgeParam.min*i,s=t.edgeParam.dis2+t.directInfo.width;if(ne.less(t.node.dis,n)&&ne.greatereq(t.node.dis,s))t.modifyMin((t.node.dis-t.edgeParam.dis2)/i);else if(ne.less(t.node.dis,s)){t.modifyMin(t.directInfo.width/i);let a=t.node.sweep==ae.CCW?new S(-e.y,e.x):new S(e.y,-e.x);t.modifyEnd(r.add(a.mul(s-t.node.dis)))}}}getPoints(t){let e=new Array,r=t.directInfo.start,i=t.directInfo.lastDirect,n=t.edgeParam.delta,s=t.edgeParam.min,a=t.node.sweep;e.push(r);let l=a==ae.CCW?t.edgeParam.angle*2:-t.edgeParam.angle*2,c=0,h=s+n*2;r=r.add(i.mul(n)),i=i.rotate(S.ORIGIN,l),e.push(r);do r=r.add(i.mul(h)),i=i.rotate(S.ORIGIN,l),e.push(r),c++;while(c<3);return r=r.add(i.mul(n)),e.push(r),e}inInner(t,e,r){let i=t.length,n=!0;for(let s=0;s<i-1;s++){let a=t[s],c=t[s+1].sub(a),h=e.sub(a);if(n&&(n=r==ae.CCW?ne.greatereq(c.cross(h),0):ne.lesseq(c.cross(h),0)),!n)break}if(n){let s=t[0],a=t[i-1],l=s.sub(a),c=e.sub(a);n=r==ae.CCW?ne.greatereq(l.cross(c),0):ne.lesseq(l.cross(c),0)}return n}fixRightEndpoint(t){let{start:e,lastDirect:r,end:i}=t.directInfo,{sweep:n}=t.node,{delta:s,min:a}=t.edgeParam,l=n==ae.CCW?t.edgeParam.angle*2:-t.edgeParam.angle*2,c=n==ae.CCW?-zy:zy,h=0,u=a+s*2,d=new Array,[p,m]=this.getProject(e,r,i),g=i.add(r.rotate(S.ORIGIN,c).mul(p)),y=r;e=e.add(r.mul(s)),r=r.rotate(S.ORIGIN,l);do{let[b,P]=this.getProject(e,r,i);b<p&&ne.greater(P,s)&&ne.greater(P,u)&&(g=i.add(r.rotate(S.ORIGIN,c).mul(b)),p=b,y=r),d.push([b,P]),e=e.add(r.mul(u)),r=r.rotate(S.ORIGIN,l),h++}while(h<4);t.modifyEnd(g),t.modifyNextDirect(y)}getProject(t,e,r){let i=r.sub(t),n=Math.abs(e.cross(i)),s=e.dot(i);return[n,s]}degree90_v1(t){this.fixEnd(t);let{lastDirect:e,start:r,end:i}=t.directInfo;if(r.equals1(i))return[r,r];if(t.node.isRight){let d=t.edgeParam.edgeLength*Math.cos(t.edgeParam.angle*2);if(ne.lesseq(t.node.dis,d))return t.directInfo.lastDirect.dot(t.directInfo.nextDirect)>.99?[r,r]:[r,r.add(e.mul(t.edgeParam.delta))]}let n=new Array;n.push(r),r=r.add(e.mul(t.edgeParam.delta)),n.push(r);let s=this.rectRadius(t.edgeParam.edgeLength),a=this.rectCenter(r,e,t.edgeParam.edgeLength,t.node.sweep),l=r,c=t.node.sweep==ae.CCW?zy:-zy,h=0,u=t.edgeParam.min;for(;!this.isLimit90(l,i,e,u)&&h<4;){let d=l.sub(a).normalize();d=d.rotate(S.ORIGIN,c),e=e.rotate(S.ORIGIN,c),l=a.add(d.mul(s)),n.push(l),h++}return n}degree90_v3(t,e,r){if(t.start.point.equals1(t.end.point))return;let i=t.direct,n=t.direct.mul(-1),s=!t.start.fix&&this.needRotate(t.start.point,t.end.point,t.start.direct)&&!this.isAcuteAngle(t.start.direct,i);(s||t.start.direct.dot(t.direct)<.99&&!t.start.fix)&&(t.start=t.start.getSameDirect(e.edgeParam.delta)),s=!t.start.fix&&this.needRotate(t.start.point,t.end.point,t.start.direct)&&!this.isAcuteAngle(t.start.direct,i);let a=!t.end.fix&&this.needRotate(t.end.point,t.start.point,t.end.direct)&&!this.isAcuteAngle(t.end.direct,n);if(a)t.end=t.end.getSameDirect(r.edgeParam.delta);else{let g=this.tool.degree90(t.direct,t.start.point,t.end.point),y=zs(t.end.direct,g),b=Math.abs(t.end.point.sub(t.start.point).dot(t.end.direct));t.end.direct.dot(y[1].mul(-1))<.99&&!t.end.fix&&b>r.edgeParam.delta&&(t.end=t.end.getSameDirect(r.edgeParam.delta))}a=!t.end.fix&&this.needRotate(t.end.point,t.start.point,t.end.direct)&&!this.isAcuteAngle(t.end.direct,n);let l=this.rectRadius(e.edgeParam.edgeLength),c=this.rectCenter(t.start.point,t.start.direct,e.edgeParam.edgeLength,e.node.sweep),h=this.rectRadius(r.edgeParam.edgeLength),u=this.rectCenter(t.end.point,t.end.direct,r.edgeParam.edgeLength,r.node.sweep),d=e.node.sweep==ae.CCW?zy:-zy,p=r.node.sweep==ae.CCW?zy:-zy,m=0;for(;s;){if(s=!t.start.fix&&this.needRotate90(t.start.point,t.end.point,t.start.direct)&&!this.isAcuteAngle(t.start.direct,i),s){let g=t.start.point.sub(c).normalize();g=g.rotate(S.ORIGIN,d);let y=t.start.direct.rotate(S.ORIGIN,d);t.start=t.start.getNext(c.add(g.mul(l))),t.start.direct=y,m++}if(m>4)break}for(m=0;a;){if(a=!t.end.fix&&this.needRotate90(t.end.point,t.start.point,t.end.direct)&&!this.isAcuteAngle(t.end.direct,n),a){let g=t.end.point.sub(u).normalize();g=g.rotate(S.ORIGIN,p);let y=t.end.direct.rotate(S.ORIGIN,p);t.end=t.end.getNext(u.add(g.mul(h))),t.end.direct=y,m++}if(m>4)break}}degree90ByDirect(t,e,r){if(e.equals1(r))return[e,r,r];let n=r.sub(e).dot(t),s=e.add(t.mul(n));return[e,s,r]}getCornerFreeDirect(t,e,r,i){let n=t.start.point,s=r.sub(n).normalize();if(e!==t&&!s.equals1(t.start.direct)){let a=e.start.point,l=r.sub(a),c=l.length();if(ne.lesseq(c,i)){let C=a.sub(n).normalize(),E=r.sub(n).dot(C);return ne.greater(E,i)?C:s}let h=Math.sqrt(c**2-i**2),u=Math.asin(i/c),d=l.normalize().mul(-1),p=d.rotate(S.ORIGIN,u),m=d.rotate(S.ORIGIN,-u),g=p.mul(h).add(r),y=m.mul(h).add(r),b=g,P=t.start.direct,T=g.sub(n).normalize().dot(P),I=y.sub(n).normalize().dot(P);(T<=0&&I>=0||T<0&&I<0&&Math.abs(T)>Math.abs(I)||T>0&&I>0&&T<I)&&(b=y),s=r.sub(b).normalize()}return s}degree90CornerFree(t,e,r){let i=t.direct,n=t.direct.mul(-1),s=!t.start.fix&&this.isObtuseAngle(t.start.direct,i);(s||t.start.direct.dot(t.direct)<.99&&!t.start.fix)&&(t.start=t.start.getSameDirect(e.edgeParam.delta)),s=!t.start.fix&&this.isObtuseAngle(t.start.direct,i);let a=!t.end.fix&&this.isObtuseAngle(t.end.direct,n);if(a)t.end=t.end.getSameDirect(r.edgeParam.delta);else{let g=this.degree90ByDirect(t.start.direct,t.start.point,t.end.point),y=zs(t.end.direct,g);t.end.direct.dot(y[1].mul(-1))<.99&&!t.end.fix&&(t.end=t.end.getSameDirect(r.edgeParam.delta))}a=!t.end.fix&&this.isObtuseAngle(t.end.direct,n);let l=this.rectRadius(e.edgeParam.edgeLength),c=this.rectCenter(t.start.point,t.start.direct,e.edgeParam.edgeLength,e.node.sweep),h=this.rectRadius(r.edgeParam.edgeLength),u=this.rectCenter(t.end.point,t.end.direct,r.edgeParam.edgeLength,r.node.sweep),d=e.node.sweep==ae.CCW?zy:-zy,p=r.node.sweep==ae.CCW?zy:-zy,m=0;for(;s;){if(s=!t.start.fix&&this.isObtuseAngle(t.start.direct,i),s){let g=t.start.point.sub(c).normalize();g=g.rotate(S.ORIGIN,d);let y=t.start.direct.rotate(S.ORIGIN,d);t.start=t.start.getNext(c.add(g.mul(l))),t.start.direct=y,m++}if(m>4)break}for(m=0;a;){if(a=!t.end.fix&&this.isObtuseAngle(t.end.direct,n),a){let g=t.end.point.sub(u).normalize();g=g.rotate(S.ORIGIN,p);let y=t.end.direct.rotate(S.ORIGIN,p);t.end=t.end.getNext(u.add(g.mul(h))),t.end.direct=y,m++}if(m>4)break}}getFreeArcDirect(t,e){let r=new Yn,{center:i,radius:n,startAngle:s,endAngle:a,sweep:l}=r.tangentToArc(t.start.direct,t.start.point,e);if(n>0){let c=e.sub(i).normalize(),h=l===ae.CCW?zy:-zy;return c.rotate(S.ORIGIN,h)}return t.start.direct}getFreeArc(t,e,r){let i=new Yn,{center:n,radius:s,startAngle:a,endAngle:l,sweep:c}=i.tangentToArc(t,e,r);if(s>0)return q.build2(n,zt.toDegrees(a),zt.toDegrees(l),s,s,c)}arcPoints(t,e){let r=new Array(e+1),i=t.sweepAngle/e,n=t.startAngle;for(let s=0;s<=e;s++)r[s]=t.pointOn(n),n+=i;return r}};var Cce=class extends dh{constructor(e){super();this.ps=new Array;this.lines=new Array;this.info=e}addPoint(e){this.ps.push(e)}display(){let e=this.ps.length;for(let r=1;r<e;r++){let i=new M(this.ps[r-1],this.ps[r]),n=new Gn(i,this.info);n.display(),this.lines.push(n)}}remove(){for(let e of this.lines)e.remove();this.lines.length=0}};var Sce=class extends dh{constructor(e){super();this.ps=new Array;this.lines=new Array;this.info=e}addPoint(e){this.ps.push(e)}display(){let e=this.ps.length;for(let r of this.ps){let i=new M(r,r),n=new Gn(i,this.info);n.display(),this.lines.push(n)}for(let r=1;r<e;r++){let i=new M(this.ps[r-1],this.ps[r]),n=new Gn(i,this.info);n.display(),this.lines.push(n)}}remove(){for(let e of this.lines)e.remove();this.lines.length=0}};var Z6=class Z6{constructor(){this.canEndWire=!1;this.redraw=!1;this.needOptimization=!1;this.startPoints=new Map}static getInstance(){return Z6.tool==null&&(Z6.tool=new Z6),Z6.tool}setStatus(t,e){this.canEndWire=t,this.wireTool=e}clear(){this.canEndWire=!1,this.wireTool=null,this.needOptimization=!1,this.redraw=!1,this.startPoints.clear()}checkEndWireSpace(t){if(!this.canEndWire){this.clear();return}if(this.wireTool.wire!=="Differential pair wiring"||Zt.getInstance().mode==="WIRING_MODE_IGNORE"){this.clear();return}let e=Zt.getInstance().type;if(!["WIRING_CORNER_LINE45","WIRING_CORNER_ARC45"].includes(e)){this.clear();return}if(this.canEndWire&&this.needOptimization){this.redraw=!1;return}if(this.checkDRC()){this.needOptimization=!0,this.redraw=!0;let i=Rn.getInstance().current;for(let n=0;n<t.tracks.length;n++){let s=t.tracks[n],a=i.tracks[n];this.startPoints.set(a,s.start.point)}return}this.clear()}checkDRC(){let t=Rn.getInstance(),e=Nh.getInstance().getDrcCheckRoute(t,!1),r=new ms;for(let i of e)for(let n of i)if(r.check(n).length>0)return!0;return!1}optimization(){if(!this.needOptimization)return;oi.getInstance().update();let e=Rn.getInstance().current.result,r=e.command,i=new Zr,n=new Xn,s=new ms,a=Cr.getInstance().current;for(let[l,c]of e.wireMap){if(c.size()<=2)continue;let h=this.startPoints.get(l),u=c.getLast().end,d=c.getLastNode(),p=d.prev,m=c.listIterator(),g,y=!1;for(;m.hasNext();){g=m.next();let b=Mr.getInstance().getStatus(g),P=g.item;if(!b.isInput){(P.start.equals1(h)||LP(P.primitive,h))&&(y=!0);continue}if(g===p)break;if(P.start.equals1(h)&&(y=!0),!y||P.width!==p.item.width)continue;let T=P.start,I=Et(P.primitive,T),C=n.degree45(I,T,u),E=this.getRangeModels(g,d),O=new M(C[0],C[1]);if(s.blockTrackGraphics(P,O,!0,E).length>0)continue;let x=new M(C[1],C[2]);if(s.blockTrackGraphics(P,x,!0,E).length>0)continue;let D=i.createTrack(P.layerId,C[0],C[1],P.width,P.net,r,P.getGroupID()),w=i.createTrack(P.layerId,C[1],C[2],P.width,P.net,r,P.getGroupID()),F=At.getInstance().createList();e.setInputStatus(F),i.addList(D,F,r),i.addList(w,F,r),F.replace(g,d),r.addCommand(new mi(F)),oi.getInstance().update();break}}this.clear()}getRangeModels(t,e){let r=new Array,i=t;for(;i!=null&&(r.push(i.item),i!=e);)i=i.next;return r}};Z6.tool=null;var $A=Z6;var Ece=class{constructor(){this.degreeTool=new Xn}getStartFanoutPoints(t,e,r){return this.degreeTool.degree45(t,e,r)}setLastFanoutInfo(t){this.lastFanoutInfo=t}needFanoutStyle(t,e){var r,i,n,s;if(t instanceof et){let a=t.pads,l=["RECT","OVAL"];if(a.length===1)return l.includes((r=a[0])==null?void 0:r.type);if(e==1)return l.includes((i=a[0])==null?void 0:i.type);if(e==2)return l.includes((n=a[1])==null?void 0:n.type);if(e>15&&e<46)return l.includes((s=a[2])==null?void 0:s.type)}}getFanoutEnd(t,e,r){let[i,n]=this.getCornerPositionOfFirstpin(t.bbox,e);return i.add(n.normalize().mul(r*1.414))}singleWireIsNeedFanout(t,e,r){let i=Zt.getInstance().mode;if(!r&&!we.adsorb)return!1;if(i!="WIRING_MODE_OBSTRUCT"){if(!ds.getInstance().routeAutoFanoutEnd||i=="WIRING_MODE_IGNORE")return!1}if(e.length){let[n,s]=e;if(n===s)return!1;let a=Rn.getInstance().current,l=a.node.width;if(r&&n&&n instanceof et&&!s){let c=this.getFanoutEnd(n,a.position,l),h=a.position.distance1(c),u=a.position.distance1(n.center);return 4*l>=h||h>u?!1:this.needFanoutStyle(n,t)}else if(!r&&n instanceof et&&s instanceof et){let c=n.center.distance1(s.center),h=this.getFanoutEnd(n,s.center,l),u=this.getFanoutEnd(s,n.center,l),d=n.center.distance1(h),p=s.center.distance1(u);return d+p+2*1.414*l>=c?!1:this.isParrelAndVerticalDirect(n,s)?!0:this.needFanoutStyle(s,t)}else if(!r&&s instanceof et){let c=n?this.getPoint(n):a.position,h=this.getFanoutEnd(s,c,l),u=c.distance1(h),d=c.distance1(s.center);return 4*l>=u||u>d?!1:this.needFanoutStyle(s,t)}}return!1}getFanoutResults(t,e,r,i,n){var h;let[s,a]=this.fanoutCalculate(t,e,r,i,n),l=((h=i.node.start.model)==null?void 0:h.globalIndex)==e.globalIndex,c=(u,d,p)=>{let m=this.degreeTool.degree45(u,d,p),g=zs(u,m);return this.degreeTool.degree45(g[1],d,p)};return l?this.startPoints=c(s,t,a):this.endPoints=c(s,t,a).reverse(),[s,a]}fanoutCalculate(t,e,r,i,n){var a,l;if(Zt.getInstance().mode!=="WIRING_MODE_IGNORE"){let P=function(z,V){return e.layerId==12?V=="Track"||V=="ArcTrack"?!0:V=="Via"||V=="Pad":(V=="Track"||V=="ArcTrack")&&z==e.layerId?!0:(z==12||z==e.layerId)&&(V=="Via"||V=="Pad")},c=(a=i.node.end)==null?void 0:a.model,h=i.node.width,u=(l=i.node.start)==null?void 0:l.model,d=(u==null?void 0:u.globalIndex)!==e.globalIndex,p=e.buildBBox(),[m,g]=this.getCornerPositionOfFirstpin(p,r),y=lj(t,r);if(!d&&((z=!1)=>{var V;if(d&&(c=i.node.start.model),z||n){if(c instanceof et)return this.isParrelAndVerticalDirect(e,c);if(c instanceof zr){let W=(V=Math.abs(c.direct.dot(e.center.sub(i.node.start.point))))!=null?V:0,L=e.bbox.width()/2;return W<L}}})())return this.lastFanoutInfo;let T=()=>{let z=[[],[]],V,W=m.add(g.normalize().mul(h*1.414)),k=this.interHalfLineToBBox(t,y,p).distance1(t),N=t.add(y.mul(k+h)),U=[W,N],B=0;for(let Y of U){let X=this.degreeTool.degree45(y,t,Y);for(let K=0;K<X.length&&K+1!=X.length;K++){let J=new M(X[K],X[K+1]),se=Lc.trackToOctagon(X[K],X[K+1],h),te=kt.search(se,P).getTPV().map($=>$.model).filter($=>p.isContainsBBox($.bbox)?!1:$ instanceof zr?!$.start.equals(e.center)&&!$.end.equals(e.center)&&$.net!==e.net&&$.layerId==e.layerId:$ instanceof et?(ar($.layerId)||$.layerId==e.layerId)&&!$.center.equals(e.center)&&$.net!==e.net:$ instanceof Ct?$.isContains(e.layerId)&&!$.center.equals(e.center)&&$.net!==e.net:!1);if(te.filter($=>$.globalIndex!==e.globalIndex).length==0)continue;let oe=fs.getInstance();for(let $ of te){let fe={id:"",net:e.net,layerId:e.layerId,shapeType:0},Oe=ha($),Te=re.getInstance().getSafeClearance(fe,Oe),ue=oe.getModelObstacle($,Te+h/2,$.layerId);ue.checkCollide(J),ue.checkCollide(J)&&z[B].push($)}}B++}let G=y;if(V=N,z[0].length==0&&z[1].length==0){let Y=g.normalize(),X,K;d?(X=this.getDrawDirect(i.node.direct,r,U[0],d).mul(-1),K=this.getDrawDirect(i.node.direct,r,U[1],d).mul(-1)):(X=this.getDrawDirect(i.node.direct,U[0],r,d),K=this.getDrawDirect(i.node.direct,U[1],r,d));let J=this.degreeTool.degree45(X,U[0],r),se=this.degreeTool.degree45(K,U[1],r),ce=zs(X,J),te=zs(K,se),oe=Y.dot(ce[0]),$=y.dot(te[0]);ne.less(oe,.99)&&ne.less($,.99)?(d?G=this.getDrawDirect(i.node.direct,r,t,d).mul(-1):G=this.getDrawDirect(i.node.direct,t,r,d),V=t):Y.dot(ce[0])>y.dot(te[0])?(G=Y,V=U[0]):(G=y,V=U[1])}else z[0].length<z[1].length&&(G=g.normalize(),V=U[0]);return[G,V,z]},[I,C,E]=T();if(E[0].length==0||E[1].length==0)return[I,C];y=this.getPerpendicularDirection(g,y);let[O,_,x]=T(),v=Math.min(...E.map(z=>z.length)),w=Math.min(...x.map(z=>z.length))<v;return[w?O:I,w?_:C]}}getDrawDirect(t,e,r,i){let n=this.degreeTool.degree45(t,e,r),s=zs(t,n);return i?s[1]:s[0]}isParrelAndVerticalDirect(t,e){if(t&&e){let r=e.center.sub(t.center).normalize(),i=Math.abs(e.center.x-t.center.x)>Math.abs(e.center.y-t.center.y),n=i?new S(0,1):new S(1,0),s=i?new S(0,1):new S(1,0),a=Math.abs(n.dot(r))<.01,l=Math.abs(s.dot(r))<.01;return a&&l}}getPoint(t){return t instanceof et||t instanceof Ct?t.center:t instanceof gt?t.end:t.buildBBox().center()}isLessThanFanoutProjection(t,e,r,i,n,s){let a=this.getPoint(t),l=this.getPoint(e);if(!a||!l)return;let c=t instanceof gt?n:lj(a,l),h=l.sub(a),u=s.sub(i?a:l),d=this.getNormalOffset(c,h).length(),p=this.getNormalOffset(c,u).length();return d<p}getBBoxCenter(t){let e=t.bbox.UL().add(t.bbox.LL()).mul(.5),r=t.bbox.LR().add(t.bbox.UR()).mul(.5),i=t.bbox.UL().add(t.bbox.UR()).mul(.5),n=t.bbox.LL().add(t.bbox.LR()).mul(.5);return[e,r,i,n]}getPerpendicularDirection(t,e){return t.cross(e)>0?new S(e.y,-e.x):new S(-e.y,e.x)}getCornerPositionOfFirstpin(t,e){let r={UL:t.UL(),UR:t.UR(),LL:t.LL(),LR:t.LR()},i=t.center(),n=e.sub(i).normalize(),s=null,a=null,l=1/0,c=null;for(let h in r){let u=r[h].sub(i).normalize(),d=n.dot(u);d>1?d=1:d<-1&&(d=-1);let p=Math.acos(d);p<l&&(l=p,c=h)}switch(c){case"UL":s=t.UL(),a=new S(-1,1);break;case"UR":s=t.UR(),a=new S(1,1);break;case"LL":s=t.LL(),a=new S(-1,-1);break;case"LR":s=t.LR(),a=new S(1,-1);break}return[s,a]}interHalfLineToBBox(t,e,r){let i=Math.max(r.width(),r.height())*2,n=[r.UL(),r.UR(),r.LR(),r.LL(),r.UL()],s=new M(t,t.add(e.mul(i)));for(let a=1;a<n.length;a++){let l=new M(n[a-1],n[a]),c=Pt(s,l);if(c==2)return Om(c,[])[0]}return null}getNormalOffset(t,e){let r=new S(-t.y,t.x);return r.mul(e.dot(r))}};var Oce=class{constructor(){this.interrupt=!1;this.degreeTool=new Xn;this.fac=new Zr;this.maxIterations=30;this.success=!1}optimizePath(t){let e=z_e(t).slice(),r,i=0;do{r=!1;for(let n=e.length-2;n>0;n--){let s=e[n+1].sub(e[n]).normalize(),a=e[n-1].sub(e[n]).normalize();if(s.dot(a)>=-.01&&s.dot(a)<=.01){let l=n-1;for(;l>=1&&ne.eq(e[l-1].sub(e[l]).dot(e[l+1].sub(e[l])),0);)l--;let c=n+1,h=this.create45DegreeSegment(e,l,c,l===n);for(;c<e.length-1;){let u=e[c+1].sub(h[h.length-1]).normalize(),d=h[h.length-2].sub(h[h.length-1]).normalize();if(u.dot(d)>0)c++,h=this.create45DegreeSegment(e,l,c,l===n);else break}e.splice(l,c-l+1,...h),r=!0,this.success=!0;break}}i++}while(r&&!this.interrupt&&i<this.maxIterations);return e}create45DegreeSegment(t,e,r,i){let n=t[e],s=t[r],a;return e==0?a=t[e+1].sub(n).normalize():a=n.sub(t[e-1]).normalize(),this.degreeTool.degree45(a,n,s)}calcListLength(t){let e=0;for(let r=1;r<t.length;r++)e+=t[r-1].distance1(t[r]);return e}isCurvePath(t,e,r=1.25){let i=t.getFirstNode().item,n=t.getLastNode().item,s=this.degreeTool.degree45(e,i.start,n.end),a=this.calcListLength(s);return this.calcListLength(t.getAllItems().flatMap(c=>[c.start,c.end]))>a*r}changePath(t,e,r,i){let n=this.fac.createList();for(let s=1;s<e.length;s++){let a=e[s-1],l=e[s],c=this.fac.createTrack(r.layerId,a,l,r.width,r.net,i);this.fac.addList(c,n,i)}n.replace(t.getFirstNode(),t.getLastNode()),i.addCommand(new mi(n))}};var Ace=class{constructor(){this.tool=new Ice;this.degreeTool=new Xn;this.factory=new Zr;this.alignTool=new x0;this.map=new Map;this.freeArcIsAcuteAngle=!1;this.viaFanoutIgnoreLimit=!1;this.viaFanoutOutShape=!0;this.needOptimizePath=!0}redraw(t,e){let r=At.getInstance().createList(),i=t.result.wireVia.get(t.node);i!=null&&(t.node.via.viaPosition==="lastInflectionPoint"?r.viaNode.prev=i:r.viaNode.next=i);let n=t.node;if(n.startAlignMap.size>0){let s=n.startAlignMap.get(n);this.drawArcAlignPath(s,n,t.result.command,r)}return this.drawCorner(r,t,e),r}redrawMulti(t,e){t.modifySpacing(2);let r=t.result.command;for(let u of t.tracks){let d=t.result.creataList(u),p=t.result.wireVia.get(u);p!=null&&(d.viaNode.next=p)}this.map.clear(),this.fixFanoutDirect(t,e);let i=Zt.getInstance().type,s=new Uie().getEvent(t);new zie().fanout_v2(s);let l=s.getResultNodes(),c=new Zr;for(let u=0;u<l.length;u++){let d=t.tracks[u],p=s.nodes[u],m=t.result.wireMap.get(d);c.drawFanoutTrack(l[u],t.tracks[u],t.result,m);let g=_I.build1(p,d,e);this.map.set(d,g)}switch(i){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_ARC45":{let u=t.node,d=t.result.wireMap.get(u),p=this.getInnerDistance(u,e),{path:m,tool:g}=new x0().alignAngle(this.map.get(u),Math.PI/4,p,45),y=this.tool.degree45_v1(g),b=this.degreeTool.degree45(g.directInfo.nextDirect,y[y.length-1],g.directInfo.end),P=zs(g.directInfo.nextDirect,b),T=mA(b[1],b[2],P[0]),I=this.getSweep(b[1].sub(b[0]),b[2].sub(b[1])),C=this.calInnerDistance(u,I),E=(u.width+fg(g.edgeParam.angle,C))*Math.sqrt(2)/2;if(E=this.getLimit(t,I,g,E),u.direct=P[0],u.end.direct=P[1],g.modifyNextDirect(P[0]),Math.abs(T)<E){u.end.direct=P[0],this.verifyProjection(u,g,b,y,P);let O=this.tool.degree45_v1(g),_=this.degreeTool.degree45(g.directInfo.nextDirect,O[O.length-1],g.directInfo.end);this.factory.drawWireTrack(m,u,r,d),this.factory.drawWireTrack(Su(O.concat(_)),u,r,d),this.drawMulti45(t,g,new S(P[0].y,-P[0].x))}else{let O=this.tool.degree45_v1(g),_=this.degreeTool.degree45(g.directInfo.nextDirect,O[O.length-1],g.directInfo.end);this.factory.drawWireTrack(m,u,r,d),this.factory.drawWireTrack(Su(O.concat(_)),u,r,d),this.drawMulti45(t,g,new S(P[1].y,-P[1].x))}break}case"WIRING_CORNER_LINE90":case"WIRING_CORNER_ARC90":{let u=t.node,d=t.result.wireMap.get(u),p=this.getInnerDistance(u,e),{path:m,tool:g}=new x0().alignAngle(this.map.get(u),Math.PI/2,p,90),y=this.tool.degree90_v1(g),b=this.degreeTool.degree90(u.direct,y[y.length-1],g.directInfo.end),P=zs(u.direct,b),T=mA(b[1],b[2],P[0]),I=this.getSweep(b[1].sub(b[0]),b[2].sub(b[1])),C=this.calInnerDistance(u,this.getSweep(b[1].sub(b[0]),b[2].sub(b[1]))),E=u.width+fg(g.edgeParam.angle,C);if(E=this.getLimit(t,I,g,E),u.direct=P[0],u.end.direct=P[1],g.modifyNextDirect(P[0]),Math.abs(T)<E){u.end.direct=P[0],this.verifyProjection(u,g,b,y,P);let O=this.tool.degree90_v1(g),_=this.degreeTool.degree90(g.directInfo.nextDirect,O[O.length-1],g.directInfo.end);this.factory.drawWireTrack(m,u,r,d),this.factory.drawWireTrack(Su(O.concat(_)),u,r,d),this.drawMulti90(t,g,new S(P[0].y,-P[0].x))}else{let O=this.tool.degree90_v1(g),_=this.degreeTool.degree90(g.directInfo.nextDirect,O[O.length-1],g.directInfo.end);this.factory.drawWireTrack(m,u,r,d),this.factory.drawWireTrack(Su(O.concat(_)),u,r,d),this.drawMulti90(t,g,new S(P[1].y,-P[1].x))}break}case"WIRING_CORNER_ARC":case"WIRING_CORNER_FREEANGLE":}c.drawViaFanout(t);let h=new x3;for(let u=0;u<t.tracks.length;u++){let d=t.tracks[u],p=t.result.wireMap.get(d);h.optimization(p,d,r)}for(let u of t.tracks){let p=t.result.wireMap.get(u).getAllItems(),m=p[p.length-1].end,g=t.result.wireVia.get(u);g!=null&&(g.item.center=m)}}getMinCornerLimit(t,e,r){let i=Ys.getInstance().trackMinCorner*t.node.width;if(ds.getInstance().wireMode!=="Differential pair wiring")return i;let n=t.node;if(n.isReverse)return i;let a=e.node.start.point,l=n.start.direct,c=r.sub(a),h=l.cross(c);if(ne.greater(c.dot(l),0)||ne.eq(h,0))return i;let d=Ha.getInstance().getTrackWidth(10).value;switch(isNaN(d)||(d=n.width),Zt.getInstance().type){case"WIRING_CORNER_ARC45":case"WIRING_CORNER_LINE45":{i=Math.max(d,i);break}case"WIRING_CORNER_LINE90":case"WIRING_CORNER_ARC":case"WIRING_CORNER_FREEANGLE":case"WIRING_CORNER_ARC90":{i=Math.max(d*2,i);break}}return i}fixEnd(t,e){let r=new Sce({net:t.node.net,color:ee.RED});this.map.clear(),r.addPoint(e);let i=Zt.getInstance().type,n=t.getCornerEvent();new _3(t.position).fanout_v3(n),this.addFonoutDebug(n.node);let a=Math.PI/4;["WIRING_CORNER_LINE90","WIRING_CORNER_ARC90"].includes(i)&&(a=Math.PI/2),e=this.fixEndpoint(t,n.node.start.point,n.node.start.direct,e,a),r.addPoint(e);for(let c=0;c<n.tracks.length;c++){let h=t.tracks[c],u=n.tracks[c],d=_I.build2(u,e);this.map.set(h,d)}let l=this.getMinCornerLimit(t,n,e);switch(i){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_ARC45":{let c=t.node,h=c.isReverse?0:this.getInnerDistance(c,e),{path:u,tool:d}=new x0().alignAngle(this.map.get(c),Math.PI/4,h,45,l,c.isReverse?0:this.calInnerDistance.bind(this,c)),p=this.tool.degree45_v1(d),m=this.degreeTool.degree45(d.directInfo.nextDirect,c.isReverse?d.directInfo.start:p[p.length-1],d.directInfo.end),g=zs(d.directInfo.nextDirect,m),y=mA(m[1],m[2],g[0]),b=this.getSweep(m[1].sub(m[0]),m[2].sub(m[1])),P=c.isReverse?0:this.calInnerDistance(c,b),T=(Ys.getInstance().trackMinCorner*c.width+fg(d.edgeParam.angle,P))*Math.sqrt(2)/2;if(T=this.getLimit(t,b,d,T),c.isReverse&&(g[0]=c.start.direct.mul(-1),g[1]=c.start.direct.mul(-1)),c.direct=g[0],c.end.direct=g[1],d.modifyNextDirect(g[0]),Math.abs(y)<T){c.end.direct=g[0],this.verifyProjection(c,d,m,p,g),c.end.point=d.directInfo.end,c.direct=d.directInfo.nextDirect;let I=c.isReverse?new S(-g[0].y,g[0].x):new S(g[0].y,-g[0].x);this.alignEnd_v1(t,I)}else{c.end.point=d.directInfo.end,c.direct=d.directInfo.nextDirect;let I=c.isReverse?new S(-g[1].y,g[1].x):new S(g[1].y,-g[1].x);this.alignEnd_v1(t,I)}t.realTimeLimit=d.edgeParam.min;break}case"WIRING_CORNER_LINE90":case"WIRING_CORNER_ARC90":{let c=t.node,h=c.start.direct,u=c.isReverse?0:this.getInner90Distance(c,e),{path:d,tool:p}=new x0().alignAngle(this.map.get(c),Math.PI/2,u,90,l);h=this.getDirect(d,h),r.addPoint(p.directInfo.end);let m=this.tool.degree90_v1(p);h=this.getDirect(m,h),r.addPoint(p.directInfo.end);let g=this.degreeTool.degree90(c.direct,c.isReverse?p.directInfo.start:m[m.length-1],p.directInfo.end);r.addPoint(p.directInfo.end),this.addResultPath(d.concat(m).concat(g),{net:c.net,color:ee.BLUE});let y=zs(c.direct,g),b=mA(g[1],g[2],y[0]),P=this.getSweep(g[1].sub(g[0]),g[2].sub(g[1])),T=c.isReverse?0:this.calInnerDistance(c,this.getSweep(g[1].sub(g[0]),g[2].sub(g[1]))),I=y[0];ne.eq(h.cross(y[0]),0)&&(I=y[1]);let C=c.isReverse?0:this.calInnerDistance(c,this.getSweep(h,I)),E=fg(p.edgeParam.angle,C),O=fg(p.edgeParam.angle,T),_=Ys.getInstance().trackMinCorner*c.width+O;_=this.getLimit(t,P,p,_),c.direct=y[0],c.end.direct=y[1],p.modifyNextDirect(y[0]),r.addPoint(p.directInfo.end),g[0].distance1(g[1])<E||Math.abs(b)<_?(c.end.direct=y[0],this.verifyProjection(c,p,g,m,y),r.addPoint(p.directInfo.end),c.end.point=p.directInfo.end,c.direct=p.directInfo.nextDirect,this.alignEnd_v1(t,c.isReverse?new S(-y[0].y,y[0].x):new S(y[0].y,-y[0].x)),r.addPoint(c.end.point)):(c.end.point=p.directInfo.end,c.direct=p.directInfo.nextDirect,this.alignEnd_v1(t,c.isReverse?new S(-y[1].y,y[1].x):new S(y[1].y,-y[1].x)),r.addPoint(c.end.point)),t.realTimeLimit=p.edgeParam.min,Gr.debug&&Gr.inputDebugGraphics(r);break}case"WIRING_CORNER_ARC":{let c=t.node;c.end.point=e;let h=n.node;if(e.equals1(c.start.point)){for(let P of t.tracks){let T=P.end.signalLayers;P.end=P.start.clone(),P.end.signalLayers=T}break}let u=h.start.point,d=c.start.direct,p=e.sub(u),m=d.cross(p),g=m>0?ae.CCW:ae.CW,y=this.calInnerDistance(c,g);if(ne.greater(p.dot(c.start.direct),0)){if(this.freeArcIsAcuteAngle=!0,y>0){let I=this.getInnerCornerNode(c,e,n).start.point;if(e.distance1(I)<y){let E=e.sub(I).normalize();e=I.add(E.mul(y)),c.end.point=e}}let P=this.tool.getFreeArcDirect(h,e);c.direct=P,c.end.direct=P,this.alignEnd_v1(t,new S(P.y,-P.x))}else if(this.freeArcIsAcuteAngle=!1,ne.eq(m,0)){let P;P=e.sub(u).normalize(),c.isReverse&&(P=d.mul(-1)),c.direct=P,c.end.direct=P,this.alignEnd_v1(t,c.isReverse?new S(-P.y,P.x):new S(P.y,-P.x))}else{if(y>0){let E=c.start.direct,O=g==ae.CCW?new S(-E.y,E.x):new S(E.y,-E.x),_=Math.abs(p.dot(O));if(_<2*y){let x=y;_>y&&(x=2*y-_),e=e.add(O.mul(x)),c.end.point=e,p=e.sub(u)}}let P=d.cross(p),T=d.rotate(S.ORIGIN,Math.PI/2),I=u.add(T.mul(P)),C=e.sub(I).normalize();c.isReverse&&(C=d.mul(-1)),e.similarEquals(I,1e-7)&&(C=this.tool.getFreeArcDirect(h,e),c.end.point=I),c.direct=C,c.end.direct=C,this.alignEnd_v1(t,c.isReverse?new S(-C.y,C.x):new S(C.y,-C.x))}break}case"WIRING_CORNER_FREEANGLE":{let c=t.node;c.end.point=e;let h=n.node,u=this.getInnerCornerNode(c,e,n),d=c.isReverse?0:this.getInnerDistance(c,e),p=this.tool.getCornerFreeDirect(h,u,e,d);if(ne.greater(p.dot(c.start.direct),0))c.direct=p,c.end.direct=p,this.alignEnd_v1(t,new S(p.y,-p.x));else{let g=c.isReverse?0:this.getInnerDistance(c,e),y=this.map.get(c),b=TA.build1(y,Math.PI/2,g,l),P=this.tool.degree90_v1(b),T=P[P.length-1],I=P[P.length-2],C=T.sub(I).normalize();T.equals1(I)&&(C=T.sub(c.start.point));let E=this.tool.degree90ByDirect(C,c.isReverse?b.directInfo.start:T,b.directInfo.end),O=zs(c.direct,E),_=mA(E[1],E[2],O[0]),x=this.getSweep(E[1].sub(E[0]),E[2].sub(E[1])),v=c.isReverse?0:this.calInnerDistance(c,this.getSweep(E[1].sub(E[0]),E[2].sub(E[1]))),D=c.width+fg(b.edgeParam.angle,v);D=this.getLimit(t,x,b,D),c.isReverse&&(O[0]=c.start.direct.mul(-1),O[1]=c.start.direct.mul(-1)),c.direct=O[0],c.end.direct=O[1],b.modifyNextDirect(O[0]),Math.abs(_)<D?(c.end.direct=O[0],this.verifyProjection(c,b,E,P,O),c.end.point=b.directInfo.end,c.direct=b.directInfo.nextDirect,this.alignEnd_v1(t,c.isReverse?new S(-O[0].y,O[0].x):new S(O[0].y,-O[0].x))):(c.end.point=b.directInfo.end,c.direct=b.directInfo.nextDirect,this.alignEnd_v1(t,c.isReverse?new S(-O[1].y,O[1].x):new S(O[1].y,-O[1].x))),t.realTimeLimit=b.edgeParam.min}break}}this.viaFanout(t,e)}viaFanout(t,e){var I,C,E,O;this.viaFanoutIgnoreLimit=!1,this.viaFanoutOutShape=!0;let i=new M4().fanout(t);if(i==null)return;let n=null,s=0,a=this.getCornerEvent(t,!1),l=t.node,c=l.isReverse?l.end.direct.mul(-1):l.end.direct,{map:h,command:u}=this.redrawMulti3(a,t,!1);for(let[_,x]of h){if(x.size()<=0)continue;s=Math.max(s,x.size());let v=x.getLastNode(),D=0;for(;;){let w=v.item;if(w instanceof Ii){n=0;break}if(w.length<.001&&v.prev){v=v.prev;continue}if(!Et(w.primitive).similarEquals(c,1e-5)){v===x.getLastNode()&&(n=0);break}if(D+=w.length,v.prev&&v.prev.item)v=v.prev;else break}D>0&&(n=n===null?D:Math.min(n,D))}u.undo();let d=Math.floor(t.tracks.length/2);for(let _=0;_<t.tracks.length;_++){let x=t.tracks[_],v=x.end;if(_<d){let D=l.isReverse?new S(v.direct.y,-v.direct.x):new S(-v.direct.y,v.direct.x);v.point=v.point.add(D.mul(i[_])),v.model=(I=t.result.wireVia.get(x))==null?void 0:I.item}else{let D=l.isReverse?new S(-v.direct.y,v.direct.x):new S(v.direct.y,-v.direct.x);v.point=v.point.add(D.mul(i[_])),v.model=(C=t.result.wireVia.get(x))==null?void 0:C.item}}let p=this.getCornerEvent(t,!1),m=null;if(ds.getInstance().wireMode=="Differential pair wiring"&&s<=1){for(let _ of t.tracks){let x=_.start.model;x instanceof zr&&x.direct.similarEquals(c,1e-5)&&(m=m===null?x.length:Math.min(m,x.length))}m=+m+n}this.viaFanoutIgnoreLimit=ne.greater(m,0);let y=new _3(e,this.viaFanoutIgnoreLimit);if(y.checkstart=!1,i.every(_=>_<=0)){let _=y.getOutShapeLength(p);this.viaFanoutOutShape=ne.less(m,_)}y.fanout_v3(p,this.viaFanoutOutShape);let b=p.node,P=b.end.connect().reverse().map(_=>_.point),T=b.end.direct.mul(-1);if(n===null){let _=l.start.point;n=Math.abs(_.sub(e).dot(T))}if(P.length>=2){let _=P[0],x=P[P.length-1],v=Math.abs(_.sub(x).dot(T));if(l.isReverse){l.isReverse=!1;let D=l.end.direct.mul(-1);l.end.direct=D,l.direct=D;let F=l.start.point.add(D.mul(v));l.end.point=F;let H=new S(D.y,-D.x);this.alignEnd_v1(t,H);for(let z=0;z<t.tracks.length;z++){let V=t.tracks[z],W=V.end;if(z<d){let L=l.isReverse?new S(W.direct.y,-W.direct.x):new S(-W.direct.y,W.direct.x);W.point=W.point.add(L.mul(i[z])),W.model=(E=t.result.wireVia.get(V))==null?void 0:E.item}else{let L=l.isReverse?new S(-W.direct.y,W.direct.x):new S(W.direct.y,-W.direct.x);W.point=W.point.add(L.mul(i[z])),W.model=(O=t.result.wireVia.get(V))==null?void 0:O.item}}}else if(ne.less(n,v)){let D=v-n;for(let w=0;w<t.tracks.length;w++){let F=t.tracks[w].end;F.point=F.point.add(F.direct.mul(D))}}}}getDirect(t,e){if(t.length>0){let r=t[t.length-1];for(let i=t.length-2;i>=0;i--){let n=t[i],s=r.sub(n);if(Math.abs(s.x)<1e-8&&Math.abs(s.y)<1e-8)r=n;else return s.normalize()}}return e}addFonoutDebug(t){if(Gr.debug){let e=t.start.connect(),r=new Cce({net:t.net,color:ee.GREEN});for(let i of e)r.addPoint(i.point);Gr.inputDebugGraphics(r)}}addResultPath(t,e){if(Gr.debug){let r=t.length,i=[];for(let s=1;s<r;s++){let a=new M(t[s-1],t[s]),l=new Gn(a,e);i.push(l)}let n=new Cd(i);Gr.inputDebugGraphics(n)}}fixEndpoint(t,e,r,i,n){let s=t.node,a=i.sub(e),l=a.normalize(),c=r.cross(l)>0?ae.CCW:ae.CW,h=this.calInnerDistance(s,c),u=a.cross(r),d=Ys.getInstance().trackMinCorner*(1+Math.cos(n)*2)/2*s.width;if(Math.abs(u)-h<d){let p=a.dot(r);return p>.01?(s.direct=r,e.add(r.mul(p))):this.isLineStyle()?(s.isReverse=!0,s.direct=r.mul(-1),e.add(r.mul(p))):e}return i}isLineStyle(){switch(Zt.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":case"WIRING_CORNER_FREEANGLE":return!0;default:return!1}}calcSweepResult(t){let e=new Array;for(let r of t.tracks)if(r.drawing==0){let i=this.getSweep4Node(r.end,r.start),n=this.getSweep4Node(r.start,r.end);e.push([i,n])}return e}redrawMulti3(t,e,r){let i=new Map,n=new Lr,s=new Zr;for(let y=0;y<t.tracks.length;y++){let b=t.tracks[y],P=s.createList();if(i.set(b,P),b.startAlignMap.size>0){let T=e.tracks[y],I=b.startAlignMap.get(T);this.drawArcAlignPath(I,T,n,P)}if(b.alignMap.size>0){let T=e.tracks[y],I=b.alignMap.get(T);this.drawArcAlignPath(I,T,n,P)}}let a=Zt.getInstance().type,l=this.viaFanoutIgnoreLimit&&!r,c=new _3(e.position,l);c.fanout_v3(t),c.fixFanoutTrackWidth(t,e),c.checkstart=!1;let h=r||this.viaFanoutOutShape;if(!$A.getInstance().needOptimization&&c.fanout_v3(t,h),this.checkFanoutLoop(t)){t=this.getCornerEvent(e,r),i.clear();for(let y of t.tracks){let b=s.createList();i.set(y,b)}}let d=this.calcSweepResult(t);switch(a){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_ARC45":{for(let y of t.tracks)if(y.drawing==0){let b=y.isReverse?0:this.getInnerDistance2(y,t,!0,d),P=new x0().alignAngle_v1(y,Math.PI/4,b,t.realTimeLimit,45,this.calInnerDistance2.bind(this,y,t)),T=this.getInnerDistance2(y,t,!1,d),I=new x0().alignAngle_v2(y,Math.PI/4,T,t.realTimeLimit,45);P.node.sweep=this.getSweep1(y.start.direct,y.start.point,y.end.point),I.node.sweep=this.getSweep1(y.end.direct,y.end.point,y.start.point),y.isReverse||this.tool.degree45_v3(y,P,I,r);let C=this.degreeTool.degree45(y.direct,y.start.point,y.end.point),E=zs(y.direct,C);y.direct=E[0],s.drawCornerNodeTrack(y.start.connect(),y,n,i.get(y)),s.drawCornerTrack(C,y,n,i.get(y))}break}case"WIRING_CORNER_LINE90":case"WIRING_CORNER_ARC90":{for(let y of t.tracks)if(y.drawing==0){let b=y.isReverse?0:this.getInner90Distance2(y,t,!0),P=new x0().alignAngle_v1(y,Math.PI/2,b,t.realTimeLimit,90),T=y.isReverse?0:this.getInner90Distance2(y,t,!1),I=new x0().alignAngle_v2(y,Math.PI/2,T,t.realTimeLimit,90);P.node.sweep=this.getSweep1(y.start.direct,y.start.point,y.end.point),I.node.sweep=this.getSweep1(y.end.direct,y.end.point,y.start.point),y.isReverse||this.tool.degree90_v3(y,P,I);let C=this.degreeTool.degree90(y.direct,y.start.point,y.end.point),E=zs(y.direct,C);y.direct=E[0],y.end.direct=E[1],s.drawCornerNodeTrack(y.start.connect(),y,n,i.get(y)),s.drawCornerTrack(C,y,n,i.get(y))}break}case"WIRING_CORNER_ARC":{if(this.freeArcIsAcuteAngle)for(let y=0;y<t.tracks.length;y++){let b=t.tracks[y],P=e.tracks[y];if(P.freeArcInfo=null,b.drawing==0){s.drawCornerNodeTrack(b.start.connect(),b,n,i.get(b));let T=b.end.point,I=b.start.point;if(I.equals1(T))continue;let C=this.tool.getFreeArc(b.start.direct,I,T),E=[I,T];if(C&&Math.abs(C.sweepAngle)>=1){let O=s.createArcTrackByArc(b.layerId,C,b.width,b.net,n);s.addList(O,i.get(b),n)}else s.drawCornerTrack(E,b,n,i.get(b))}}else for(let y=0;y<t.tracks.length;y++){let b=t.tracks[y],P=e.tracks[y];if(P.freeArcInfo=null,b.drawing!=0)continue;s.drawCornerNodeTrack(b.start.connect(),b,n,i.get(b));let T=b.start.point,I=b.end.point;if(T.equals1(I))continue;let C=I.sub(T),E=b.start.direct,O=E.cross(C);if(ne.eq(O,0)){let _=[b.start.point,I];s.drawCornerTrack(_,b,n,i.get(b))}else{let _=E.rotate(S.ORIGIN,Math.PI/2),x=T.add(_.mul(O)),v=this.tool.getFreeArc(b.start.direct,T,x),D=[T,x];if(v&&Math.abs(v.sweepAngle)>=1){let w=s.createArcTrackByArc(b.layerId,v,b.width,b.net,n);s.addList(w,i.get(b),n)}else s.drawCornerTrack(D,b,n,i.get(b));I.similarEquals(x,1e-7)||s.drawCornerTrack([x,I],b,n,i.get(b))}}break}case"WIRING_CORNER_FREEANGLE":{let y=t.node;if(ne.greater(y.direct.dot(y.start.direct),0)){for(let P of t.tracks)if(P.drawing==0){s.drawCornerNodeTrack(P.start.connect(),P,n,i.get(P));let T=P.end.point,I=P.start.point,C=[I,T];if(ne.eq(P.end.direct.cross(P.start.direct),0))C=[I,T];else{let E=c2(I,I.add(P.start.direct),T,T.add(P.end.direct));if(!E){s.drawCornerTrack(C,P,n,i.get(P));continue}(I.equals1(E)||ne.greater(E.sub(I).dot(P.start.direct),0))&&(C=[I,E,T])}s.drawCornerTrack(C,P,n,i.get(P))}}else for(let P of t.tracks)if(P.drawing==0){let T=P.isReverse?0:this.getInnerDistance2(P,t,!0,d),I=Fb.build1(P,Math.PI/2,T,length),C=P.isReverse?0:this.getInnerDistance2(P,t,!1,d),E=Fb.build2(P,Math.PI/2,C,length);I.node.sweep=this.getSweep1(P.start.direct,P.start.point,P.end.point),E.node.sweep=this.getSweep1(P.end.direct,P.end.point,P.start.point),this.tool.degree90CornerFree(P,I,E);let O=this.tool.degree90ByDirect(P.direct,P.start.point,P.end.point),_=zs(P.direct,O);P.isReverse&&(_[0]=P.start.direct.mul(-1),_[1]=P.start.direct.mul(-1)),P.direct=_[0],P.end.direct=_[1],s.drawCornerNodeTrack(P.start.connect(),P,n,i.get(P)),s.drawCornerTrack(O,P,n,i.get(P))}break}}for(let y of t.tracks){let b=y.end.connect().reverse().map(I=>I.point),P=y.end.connect().reverse(),T=new Set;for(let I of P)I.reverse(),I.change!=null&&T.add(I.change);for(let I of T)I.reverse();s.drawCornerNodeTrack(P,y,n,i.get(y))}let p=new x3,m=new Map,g=new Oce;for(let y=0;y<t.tracks.length;y++){let b=t.tracks[y],P=e.tracks[y],T=i.get(b);if(T.size()==0)continue;p.optimization(T,b,n);let I=Su(T.getAllItems().flatMap(E=>[E.start,E.end])),C=this.isMoreThanRightAngleLimit(I);if(r&&this.isNeedOptimizePath(P)){let E=P.end.model instanceof zr?P.end.model:void 0;if(E){let O=At.getInstance().getListNode(E);if(O&&O.parent){let x=O.parent.getAllItems().flatMap(v=>[v.start,v.end]);if(I.length){let v=I[I.length-1],D=x[0];if(v.equals(D))xe.addAll(I,x);else for(let w=x.length-1;w>=0;w--)I.push(x[w])}}}if(C){let O=g.optimizePath(I);if(g.success&&g.changePath(T,O,P,n),g.isCurvePath(T,P.direct)){let x=this.degreeTool.degree45(P.direct,P.start.point,P.end.point);g.changePath(T,x,P,n)}}}m.set(T,P)}return{event:t,map:i,command:n}}isNeedOptimizePath(t){return!(!this.needOptimizePath||ds.getInstance().wireMode=="Differential pair wiring")}isMoreThanRightAngleLimit(t,e=2){let r=0;for(let i=0;i<t.length-2;i++){let n=t[i].sub(t[i+1]).normalize(),s=t[i+2].sub(t[i+1]).normalize();if(n.dot(s)>=-.01&&(r++,r>=e))return!0}return!1}getCornerEvent(t,e){let r=t.getCornerEvent();if(e)for(let i of r.tracks)i.end.model==null&&(i.end.fix=!0);for(let i=0;i<t.tracks.length;i++){let n=t.tracks[i];n.startAlignMap.size>0&&(r.tracks[i].startAlignMap=n.startAlignMap),n.alignMap.size>0&&(r.tracks[i].alignMap=n.alignMap)}return r}checkFanoutLoop(t){for(let e of t.tracks){let r=e.start.connect().map(l=>l.point),i=e.end.connect().reverse().map(l=>l.point),n=ge.build4(r),s=ge.build4(i);if(vk(n,s))return!0}return!1}fixFanoutDirect(t,e){if(t.node.start.allowModifyDirect){let r=e.sub(t.node.start.point).normalize();if(t.node.start.direct.dot(r)<0){let n=t.node.start.direct.mul(-1);for(let s of t.tracks)s.start.direct=n;t.reverse()}}}getLimit(t,e,r,i){let s=new M4().fanout(t);if(s==null)return i;if(e==ae.CCW){let a=t.tracks[0],l=0,c=a.next,h=1,u=s[0];for(;c!=null;){l+=c.width+a.width/2+c.next.width/2;let d=fg(r.edgeParam.angle,l);d<s[h]&&(u=Math.max(u,s[h]-d)),a=c.next,c=a.next,h++}return u*Math.sin(r.edgeParam.angle*2)+i}else{let a=0,l=t.tracks[t.tracks.length-1],c=l.previous,h=t.tracks.length-2,u=s[t.tracks.length-1];for(;c!=null;){a+=c.width+l.width/2+c.previous.width/2;let d=fg(r.edgeParam.angle,a);d<s[h]&&(u=Math.max(u,s[h]-d)),l=c.previous,c=l.previous}return u*Math.sin(r.edgeParam.angle*2)+i}}modifyWireDirection(t,e,r){let i=zs(e,r);!t.start.point.equals1(r[0])&&i[1].equals1(e)?(t.direct=i[1],e=i[1],t.end.direct=i[0]):(t.direct=i[0],e=i[0],t.end.direct=i[1])}drawCorner(t,e,r){var a,l;let i=e.result.command;this.map.clear(),this.map.set(e.node,_I.build(e.node,r));let n=(a=no.autoEndItem(r,e.node.layerId,e.node.net))==null?void 0:a.model;e.node.end.model=n&&Mt.checkIsCanEditByItem(n)?n:null;let s=new Ece;switch((l=this.lastFanoutInfo)!=null&&l.length&&s.setLastFanoutInfo(this.lastFanoutInfo),Zt.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_ARC45":{let c=e.node,h=c.start,u=!1,d=!0;if(h.allowModifyDirect){let p=h.model;u=s.singleWireIsNeedFanout(c.layerId,[p,n],!1);let m=[];if(s.singleWireIsNeedFanout(c.layerId,[p,void 0],!0)){let g=h.point,y=h.model;if(y.inOutline(e.position))return;let b=P=>{let[T,I]=s.getFanoutResults(g,y,P||e.position,e,u);if(this.lastFanoutInfo=[T,I],u){let E=n,[,O]=s.getFanoutResults(E.center,E,I,e);r=O}h.direct=T,m=m.concat(s.startPoints);let C=this.getBlockPoints(c.direct,I,r,c);d=!1,this.modifyWireDirection(c,h.direct,C),m=Su(m.concat(C)),u&&(m=Su(m.concat(s.endPoints)))};b(),s.endPoints&&s.endPoints.length>0&&this.isMoreThanRightAngleLimit(m,1)&&(m=[],b(s.endPoints[0]))}else if(u){let g=n,[,y]=s.getFanoutResults(g.center,g,h.point,e);m=this.getBlockPoints(c.direct,h.point,y,c),d=!1,this.modifyWireDirection(c,h.direct,m),m=m.concat(s.endPoints)}else m=this.getBlockPoints(c.direct,h.point,r,c),this.lastFanoutInfo=[c.direct,m[1]];d&&this.modifyWireDirection(c,h.direct,m),this.factory.drawWireTrack(m,c,i,t)}else{this.fixEndpoint(e,c.start.point,c.start.direct,r,Math.PI/4);let{path:p,tool:m}=this.alignTool.alignAngle(this.map.get(c),Math.PI/4,0,45);c.isReverse&&(m.edgeParam.edgeLength=0),this.factory.drawWireTrack(p,c,i,t);let g=this.tool.degree45_v1(m),y=this.getBlockPoints(m.directInfo.nextDirect,g[g.length-1],m.directInfo.end,c),b=zs(m.directInfo.nextDirect,y);c.isReverse&&(b[0]=c.start.direct.mul(-1),b[1]=c.start.direct.mul(-1));let P=mA(y[1],y[2],b[0]),I=Ys.getInstance().trackMinCorner*c.width*Math.sqrt(2)/2;Math.abs(P)<I&&!e.node.end.model&&m.modifyEnd(y[1].add(b[0].mul(Math.abs(aj(y[1],y[2],b[0]))))),c.direct=b[0],c.end.direct=b[1],m.modifyNextDirect(b[0]),this.draw1(m,c,e,t,s)}break}case"WIRING_CORNER_LINE90":case"WIRING_CORNER_ARC90":{let c=e.node,h=c.start;if(h.allowModifyDirect){let u=this.degreeTool.degree90(c.direct,h.point,r),d=zs(h.direct,u);c.direct=d[0],h.direct=d[0],c.end.direct=d[1],this.factory.drawWireTrack(u,c,i,t)}else{let u=c.width,{path:d,tool:p}=this.alignTool.alignAngle(this.map.get(c),Math.PI/2,0,90);this.factory.drawWireTrack(d,c,i,t);let m=this.tool.degree90_v1(p),g=this.degreeTool.degree90(p.directInfo.nextDirect,m[m.length-1],p.directInfo.end),y=zs(p.directInfo.nextDirect,g),b=mA(g[1],g[2],y[0]),P=u/2;Math.abs(b)<P&&!e.node.end.model&&p.modifyEnd(g[1].add(y[0].mul(Math.abs(aj(g[1],g[2],y[0]))))),c.direct=y[0],c.end.direct=y[1],p.modifyNextDirect(y[0]),this.draw90_v1(p,c,i,t)}break}case"WIRING_CORNER_ARC":{let c=e.node,h=c.start.point,u=r.sub(h).normalize();c.start.allowModifyDirect&&c.start.direct.dot(u)<=Math.sqrt(2)/2&&(c.start.direct=TVe(u));let d=c.start.direct,p=ne.greater(u.dot(d),0);if(c.freeArcInfo=null,p){let m=c.start.point,g=this.tool.getFreeArc(d,m,r),y=r.sub(m).normalize();if(g&&Math.abs(g.sweepAngle)>=1){y=O8(g);let b=this.factory.createArcTrackByArc(c.layerId,g,c.width,c.net,i);this.factory.addList(b,t,i)}else{let b=[m,r];this.factory.drawWireTrack(b,c,i,t)}c.end.direct=y}else{let m=c.start.point,g=r.sub(m),y=c.start.direct,b=y.cross(g),P=r.sub(m).normalize();if(ne.eq(b,0)){let T=[c.start.point,r];this.factory.drawWireTrack(T,c,i,t)}else{let T=y.rotate(S.ORIGIN,Math.PI/2),I=m.add(T.mul(b)),C=this.tool.getFreeArc(c.start.direct,m,I),E=[m,I];if(C&&Math.abs(C.sweepAngle)>=1){let O=this.factory.createArcTrackByArc(c.layerId,C,c.width,c.net,i);this.factory.addList(O,t,i),P=O8(C)}else this.factory.drawWireTrack(E,c,i,t),P=I.sub(m).normalize();r.similarEquals(I,1e-7)||(this.factory.drawWireTrack([I,r],c,i,t),P=r.sub(I).normalize())}c.end.direct=P}break}case"WIRING_CORNER_FREEANGLE":{let c=e.node,h=c.start.point,u=[h,r];c.end.direct=r.sub(h).normalize(),this.factory.drawWireTrack(u,c,i,t);break}}}getBlockPoints(t,e,r,i){let n=this.degreeTool.degree45(t,e,r);if(Zt.getInstance().mode=="WIRING_MODE_OBSTRUCT"){let s=new ms,a=new zr("",i.layerId,n[0],n[1],i.width,!1,i.net),l=wt.filter;wt.setPushFilter(),wt.pushFilter.trackfilter.setMode(!0),wt.pushFilter.setNetAndLayerId(i.net,i.layerId);let c=s.blockTrackPrimitive(a,a.primitive,!0,!1);if(a.remove(),c.length!=0){let h=zs(t,n),u=this.degreeTool.degree45(h[1],e,r),d=new zr("",i.layerId,u[0],u[1],i.width,!1,i.net);s.blockTrackPrimitive(d,d.primitive,!0,!1).length==0&&(n=u)}wt.filter=l}return n}alignEnd_v1(t,e){let r=t.node,i=r.end.point,n=r.direct,s=r.previous,a=r.next,l=r,c=r,h=0,u=0,d=r.end.direct;for(;s!=null||a!=null;)s!=null&&(h=h-(l.width/2+s.width+s.previous.width/2),l=s.previous,s=l.previous,l.direct=n,l.end.direct=d,l.end.point=this.alignEnd(i,e,h),l.isReverse=r.isReverse),a!=null&&(u=u+(c.width/2+a.width+a.next.width/2),c=a.next,a=c.next,c.direct=n,c.end.direct=d,c.end.point=this.alignEnd(i,e,u),c.isReverse=r.isReverse)}drawMulti45(t,e,r){let i=t.result.command,n=t.node,s=n.previous,a=n.next,l=n,c=n,h=0,u=0,d=e.directInfo.end,p=e.directInfo.end,m=e.directInfo.nextDirect,g=n.end.direct;for(;s!=null||a!=null;){if(s!=null){h=h-(l.width/2+s.width+s.previous.width/2),l=s.previous,s=l.previous,l.direct=m,l.end.direct=g,d=this.alignEnd(e.directInfo.end,r,h);let y=this.getInnerDistance(l,d),b=this.map.get(l).modifyEnd(d),{path:P,tool:T}=new x0().alignAngle(b,Math.PI/4,y,45);T.modifyNextDirect(m);let I=this.tool.degree45_v1(T),C=this.degreeTool.degree45(T.directInfo.nextDirect,I[I.length-1],T.directInfo.end),E=t.result.wireMap.get(l);this.factory.drawWireTrack(P,l,i,E),this.factory.drawWireTrack(I.concat(C),l,i,E)}if(a!=null){u=u+(c.width/2+a.width+a.next.width/2),c=a.next,a=c.next,c.direct=m,c.end.direct=g,p=this.alignEnd(e.directInfo.end,r,u);let y=this.getInnerDistance(c,p),b=this.map.get(c).modifyEnd(p),{path:P,tool:T}=new x0().alignAngle(b,Math.PI/4,y,45);T.modifyNextDirect(m);let I=this.tool.degree45_v1(T),C=this.degreeTool.degree45(T.directInfo.nextDirect,I[I.length-1],T.directInfo.end),E=t.result.wireMap.get(c);this.factory.drawWireTrack(P,c,i,E),this.factory.drawWireTrack(I.concat(C),c,i,E)}}}drawMulti90(t,e,r){let i=t.result.command,n=t.node,s=n.previous,a=n.next,l=n,c=n,h=0,u=0,d=e.directInfo.end,p=e.directInfo.end,m=e.directInfo.nextDirect,g=n.end.direct;for(;s!=null||a!=null;){if(s!=null){h=h-(l.width/2+s.width+s.previous.width/2),l=s.previous,s=l.previous,l.direct=m,l.end.direct=g,d=this.alignEnd(e.directInfo.end,r,h);let y=this.getInnerDistance(l,d),b=this.map.get(l).modifyEnd(d),{path:P,tool:T}=new x0().alignAngle(b,Math.PI/2,y,90);T.modifyNextDirect(m);let I=this.tool.degree90_v1(T),C=this.degreeTool.degree90(T.directInfo.nextDirect,I[I.length-1],T.directInfo.end),E=t.result.wireMap.get(l);this.factory.drawWireTrack(P,l,i,E),this.factory.drawWireTrack(I.concat(C),l,i,E)}if(a!=null){u=u+(c.width/2+a.width+a.next.width/2),c=a.next,a=c.next,c.direct=m,c.end.direct=g,p=this.alignEnd(e.directInfo.end,r,u);let y=this.getInnerDistance(c,p),b=this.map.get(c).modifyEnd(p),{path:P,tool:T}=new x0().alignAngle(b,Math.PI/2,y,90);T.modifyNextDirect(m);let I=this.tool.degree90_v1(T),C=this.degreeTool.degree90(T.directInfo.nextDirect,I[I.length-1],T.directInfo.end),E=t.result.wireMap.get(c);this.factory.drawWireTrack(P,c,i,E),this.factory.drawWireTrack(I.concat(C),c,i,E)}}}alignEnd(t,e,r){return t.add(e.mul(r))}calInnerDistance2(t,e,r){let i=e.tracks.indexOf(t);if(r==ae.CCW){let n=0,s=t.previous;for(;s!=null;)n+=s.width+t.width/2+s.previous.width/2,t=e.tracks[i-1],s=t.previous,i--;return n}else{let n=0,s=t.next;for(;s!=null;)n+=s.width+t.width/2+s.next.width/2,t=e.tracks[i+1],s=t.next,i++;return n}}calInnerDistance3(t,e,r){let i=e.tracks.indexOf(t);if(r==ae.CCW){let n=0,s=t.next;for(;s!=null;)n+=s.width+t.width/2+s.next.width/2,t=e.tracks[i+1],s=t.next,i++;return n}else{let n=0,s=t.previous;for(;s!=null;)n+=s.width+t.width/2+s.previous.width/2,t=e.tracks[i-1],s=t.previous,i--;return n}}calInnerDistance(t,e){if(e==ae.CCW){let r=0,i=t.previous;for(;i!=null;)r+=i.width+t.width/2+i.previous.width/2,t=i.previous,i=t.previous;return r}else{let r=0,i=t.next;for(;i!=null;)r+=i.width+t.width/2+i.next.width/2,t=i.next,i=t.next;return r}}getSweep(t,e){return t.cross(e)>0?ae.CCW:ae.CW}getSweep1(t,e,r){return t.cross(r.sub(e).normalize())>0?ae.CCW:ae.CW}verifyProjection(t,e,r,i,n){let s=r[1].add(n[0].mul(Math.abs(aj(r[1],r[2],n[0]))));if(s.distance1(r[0])<e.edgeParam.delta){let l=t.start.direct,c=t.start.point;if(i.length>1){c=i[i.length-1];let u=c.sub(i[i.length-2]);Math.abs(u.x)<1e-8&&Math.abs(u.y)<1e-8?l=e.directInfo.lastDirect:l=u.normalize()}let h=r[2].sub(c).dot(l);s=c.add(l.mul(h)),t.direct=l,t.end.direct=l,e.modifyNextDirect(l),n[0]=l}e.modifyEnd(s)}getInnerDistance2(t,e,r,i){let n;return r?(n=this.getFinalSweep(t.end,t.start,!0,i),this.calInnerDistance2(t,e,n)):(n=this.getFinalSweep(t.start,t.end,!1,i),this.calInnerDistance3(t,e,n))}getSweep4Node(t,e){let r=t.point.sub(e.point).normalize();return e.direct.cross(r)>0?ae.CCW:ae.CW}getFinalSweep(t,e,r,i){let n=t.point.sub(e.point).normalize(),s=e.direct,a,l=s.cross(n);return-DTe<=l&&l<=DTe?r?a=z4(i.flatMap(c=>c[0])):a=z4(i.flatMap(c=>c[1])):a=l>0?ae.CCW:ae.CW,a}getInner90Distance2(t,e,r){let i;if(r)return i=this.getSweep4Node90(t.direct,t.start,t.end),this.calInnerDistance2(t,e,i);{let n=this.degreeTool.degree90(t.direct,t.end.point,t.start.point),s=zs(t.direct,n);return i=this.getSweep4Node90(s[1],t.end,t.start),this.calInnerDistance3(t,e,i)}}getSweep4Node90(t,e,r){let i=e.direct,n=r.point.sub(e.point).normalize(),s=new S(i.x,0).normalize(),a=new S(0,i.y).normalize(),l;if(ne.eq(i.cross(new S(1,0)),0)||ne.eq(i.cross(new S(0,1)),0)){let c=s.cross(n),h=s.cross(a),u=a.cross(n),d;c*h>0&&c*u<0?(d=i.cross(t),ne.eq(d,0)&&(d=i.cross(n))):d=i.cross(n),l=ne.greater(d,0)?ae.CCW:ae.CW}else{let c=new S(n.x,0).normalize(),h=new S(0,n.y).normalize();i.x*i.y>0?n.x*n.y<=0?l=ne.greater(i.cross(n),0)?ae.CCW:ae.CW:l=ne.greater(i.cross(t),0)?ae.CCW:ae.CW:n.x*n.y>=0?l=ne.greater(i.cross(n),0)?ae.CCW:ae.CW:l=ne.greater(i.cross(t),0)?ae.CCW:ae.CW}return l}getInnerDistance(t,e){let r=this.map.get(t),i=e.sub(r.start).normalize(),n=r.lastDirect,s=ne.greater(n.cross(i),0)?ae.CCW:ae.CW;return this.calInnerDistance(t,s)}getInner90Distance(t,e){let r=this.map.get(t),i=t.direct,n=r.lastDirect,s=e.sub(r.start).normalize(),a=new S(n.x,0).normalize(),l=new S(0,n.y).normalize(),c;if(ne.eq(n.cross(new S(1,0)),0)||ne.eq(n.cross(new S(0,1)),0)){let h=a.cross(s),u=a.cross(l),d=l.cross(s),p;h*u>0&&h*d<0?(p=n.cross(i),ne.eq(p,0)&&(p=n.cross(s))):p=n.cross(s),c=ne.greater(p,0)?ae.CCW:ae.CW}else n.x*n.y>0?s.x*s.y<=0?c=ne.greater(n.cross(s),0)?ae.CCW:ae.CW:c=ne.greater(n.cross(i),0)?ae.CCW:ae.CW:s.x*s.y>=0?c=ne.greater(n.cross(s),0)?ae.CCW:ae.CW:c=ne.greater(n.cross(i),0)?ae.CCW:ae.CW;return this.calInnerDistance(t,c)}getInnerDistance1(t,e,r){let i=r.sub(e.start).normalize(),s=e.lastDirect.cross(i)>0?ae.CCW:ae.CW;return this.calInnerDistance(t,s)}getInnerCornerNode(t,e,r){let i=this.map.get(t),n=e.sub(i.start).normalize();return(i.lastDirect.cross(n)>0?ae.CCW:ae.CW)==ae.CCW?r.tracks[0]:r.tracks[r.tracks.length-1]}testMulti(t,e){let r=t.node,i=r.start;if(i.allowModifyDirect){let n=this.degreeTool.degree45(i.direct,i.point,e),s=zs(i.direct,n);r.direct=s[0],i.direct=s[0],r.end.direct=s[1]}else{let{path:n,tool:s}=new x0().alignAngle(this.map.get(r),Math.PI/4,2,45),a=this.tool.degree45_v1(s),l=this.degreeTool.degree45(s.directInfo.nextDirect,a[a.length-1],s.directInfo.end),c=zs(s.directInfo.nextDirect,l),h=mA(l[1],l[2],c[0]),d=(r.width+fg(s.edgeParam.angle,2))*Math.sqrt(2)/2,p,m;Math.abs(h)<d?(s.modifyEnd(l[1].add(c[0].mul(Math.abs(aj(l[1],l[2],c[0]))))),p=s.directInfo.end.add(new S(-c[0].y,c[0].x).mul(2)),m=s.directInfo.end.add(new S(c[0].y,-c[0].x).mul(2))):(p=s.directInfo.end.add(new S(-c[1].y,c[1].x).mul(2)),m=s.directInfo.end.add(new S(c[1].y,-c[1].x).mul(2))),r.direct=c[0],r.end.direct=c[1],s.modifyNextDirect(c[0]);let g=new S(-s.directInfo.lastDirect.y,s.directInfo.lastDirect.x),y=s.directInfo.lastDirect.cross(s.directInfo.end.sub(i.point)),b=s.clone(s.directInfo.start.add(g.mul(2)),p,y<0?4:0),P=s.clone(s.directInfo.start.add(g.mul(-2)),m,y<0?0:4);this.draw(s),this.draw(b),this.draw(P)}}draw1(t,e,r,i,n){let s=r.result.command,a=t.directInfo.end,l=e.end.model,c=!1,h;(l instanceof et||l instanceof Ct)&&l instanceof et&&l.net==e.net&&(c=n.singleWireIsNeedFanout(e.layerId,[e.start.model,l],!1));let u=this.fixEndpoint(r,e.start.point,e.start.direct,a,Math.PI/4);if(u.equals1(e.start.point))h=this.degreeTool.degree45(t.directInfo.nextDirect,e.start.point,u);else{e.isReverse&&(t.edgeParam.edgeLength=0);let d=this.tool.degree45_v1(t);if(c){let p,m=Rn.getInstance().getLastEvent();m?p=m.node.end.point:p=e.start.point;let[,g]=n.getFanoutResults(t.directInfo.end,l,p,r,c),y=this.degreeTool.degree45(t.directInfo.nextDirect,d[d.length-1],g);this.modifyWireDirection(e,e.start.direct,y),h=Su(d.concat([].concat(y,n.endPoints)));let b=!0;if(h.length>2){let P=h.slice(h.length-3),T=zs(t.directInfo.nextDirect,P);b=T[0].dot(T[1])>.1}if(!b||this.hasObstacle(h,e)){let P=this.degreeTool.degree45(t.directInfo.nextDirect,d[d.length-1],t.directInfo.end);h=Su(d.concat(P))}}else{let p=this.degreeTool.degree45(t.directInfo.nextDirect,d[d.length-1],t.directInfo.end);h=Su(d.concat(p))}}this.factory.drawWireTrack(h,e,s,i)}hasObstacle(t,e){if(Zt.getInstance().mode=="WIRING_MODE_OBSTRUCT"){let r=new ms,i=wt.filter;wt.setPushFilter(),wt.pushFilter.trackfilter.setMode(!0),wt.pushFilter.setNetAndLayerId(e.net,e.layerId);for(let n=1;n<t.length;n++){let s=new zr("",e.layerId,t[n-1],t[n],e.width,!1,e.net),a=r.blockTrackPrimitive(s,s.primitive,!0,!1);if(s.remove(),a.length!=0)return wt.filter=i,!0}wt.filter=i}return!1}draw(t){let e=this.tool.degree45_v1(t);this.degreeTool.degree45(t.directInfo.nextDirect,e[e.length-1],t.directInfo.end)}draw90_v1(t,e,r,i){let n=this.tool.degree90_v1(t),s=this.degreeTool.degree90(t.directInfo.nextDirect,n[n.length-1],t.directInfo.end);this.factory.drawWireTrack(n.concat(s),e,r,i)}drawArcAlignPath(t,e,r,i){t.primitives.forEach(n=>{let s;if(n instanceof M){s=this.factory.createTrack(e.layerId,n.start(),n.end(),e.width,e.net,r);let a=this.factory.addList(s,i,r);a.ignoreArcOptimization=!0}else if(n instanceof q){s=this.factory.createArcTrack(e.layerId,n.center,n.rx,n.startAngle*(Math.PI/180),(n.startAngle+n.sweepAngle)*(Math.PI/180),n.isCCW?1:0,e.width,e.net,r);let a=this.factory.addList(s,i,r);a.ignoreArcOptimization=!0}})}};var _ce=new S(1,0),vce=new S(1,1).normalize(),xce=new S(0,1),Rce=new S(-1,1).normalize(),Dce=class extends U8{constructor(e,r){super();this.map=new Map;this.map1=new Map;this.event=e;let i=R0.getInstance(),n,s=e.tracks.map(p=>p.start.model).filter(Boolean),a=s.map(p=>p.globalIndex),l=a,c=ds.getInstance().wireMode=="Multi-route wiring";if(c&&i.startItems.length){for(let p of i.startItems)if(p instanceof gt){let m=At.getInstance().getListNode(p).parent.getAllItems();m.length&&m.forEach(g=>{l.includes(g.globalIndex)||l.push(g.globalIndex)})}}this.resetDrawStatus(e);let h=(()=>{let p=e.tracks.map(b=>b.net),m=p.every(b=>b==null),g=p[0],y=p.every(b=>b===g);return m||y})(),u=no.getSingleItems(r.x,r.y);u instanceof mn||(r=no.getItemAndPoint(u,r.x,r.y,!0,!1).point);let d=e.tracks.some(p=>p.start.point.equals(r));if(h){if(u instanceof mn||!(u instanceof Le||u instanceof Ge||u instanceof Ue))return;let p=e.tracks.reduce((y,b)=>(y.set(b.net,(y.get(b.net)||0)+1),y),new Map);if(!p.has(u.net))return;let m=r,g=new Set([u]);for(let y of e.tracks){if(u!=null&&c&&l.includes(u.globalIndex))return;let b=new Set(g);if(g.size==e.tracks.length)break;if(!((Array.from(g).reduce((T,I)=>(T.set(I.net,(T.get(I.net)||0)+1),T),new Map).get(y.net)||0)>=(p.get(y.net)||0)))for(let T of b){let I=this.getNearItem1(T,y.net,y.layerId,m,C=>C.filter(E=>{if(a.includes(E.globalIndex))return!1;if(!g.has(E))return!0}));if(I&&!g.has(I)){m=this.fixPosition(I,m,c),g.add(I);break}}}this.findOptimalMatch(e,g,r)}else{for(let m of e.tracks){let g=this.getEndpoint(m,r);if(g!=null&&!d){if(c&&l.includes(g.globalIndex))break;this.map.set(m,g);let y=this.fixPosition(g,r,c);this.map1.set(m,y),n=y}}if(this.map.size==0)return;let p=null;for(let m of e.tracks){let g=this.map.get(m);if(g==null){let y=p;if(p==null&&(y=this.getNextReferItem(m)),y!=null){let b=this.map.get(y);if(g=this.getNearItem1(b,m.net,m.layerId,n,P=>P.filter(T=>a.includes(T.globalIndex)&&T.getParent()?!s.map(I=>I.getParent()).includes(T.getParent().model):!0)),this.isResult(g,m)){let P=this.fixPosition(g,r,c);this.map.set(m,g),this.map1.set(m,P)}else g=null}}g!=null&&(p=m)}}if(this.map1.size>1){this.map1=this.filterByStandardDeviation(this.map1,3);for(let[p,m]of this.map)this.map1.get(p)||this.map.delete(p)}}resetDrawStatus(e){for(let r of e.tracks)r.end.model=null,r.drawing!=1&&(r.drawing=0)}sortItems(e,r){let i=r.length;if(i===0)return r;let n=r.map(I=>this.fixPosition(I,e)),s=n[0];for(let I=1;I<i;I++)s=s.add(n[I]);s=s.mul(1/i);let a=0,l=0,c=0,h=0;for(let I of n){let C=I.sub(s).normalize();a+=Math.abs(_ce.cross(C)),l+=Math.abs(vce.cross(C)),c+=Math.abs(xce.cross(C)),h+=Math.abs(Rce.cross(C))}let u=[{sum:a,dir:_ce},{sum:l,dir:vce},{sum:c,dir:xce},{sum:h,dir:Rce}];u.sort((I,C)=>I.sum-C.sum);let d=u[0].dir,p=new S(-d.y,d.x).normalize(),m=n.map((I,C)=>({item:r[C],project:I.sub(s).dot(d)}));m.sort((I,C)=>{let E=I.project-C.project;if(Math.abs(E)<1e-4){let O=n[r.indexOf(I.item)].sub(s).dot(p),_=n[r.indexOf(C.item)].sub(s).dot(p);return O-_}else return E});let g=m.map(I=>I.item),y=this.event.tracks.map(I=>I.start.point),b=y[0],T=y[y.length-1].sub(b).normalize();return d.dot(T)<0?g.reverse():g}findOptimalMatch(e,r,i){let n=e.tracks,s=Array.from(r),a=(h,u,d,p)=>Vee(h,u,d,p),c=((h,u)=>{let d=h.length,p=u.length,m=Array.from({length:d+1},()=>Array(p+1).fill(0)),g=Array.from({length:d+1},()=>Array(p+1).fill(null));for(let T=1;T<=d;T++)for(let I=1;I<=p;I++){let C=h[T-1],E=u[I-1];if(C.net===E.net&&C.layerId===E.layerId){let O=!0;for(let _=0;_<T-1;_++){let x=h[_],v=g[_+1][I-1];if(v&&a(x.start.point,this.fixPosition(v,i),C.start.point,this.fixPosition(E,i))){O=!1;break}}O?(m[T][I]=m[T-1][I-1]+1,g[T][I]=E):m[T][I]=Math.max(m[T-1][I],m[T][I-1])}else m[T][I]=Math.max(m[T-1][I],m[T][I-1])}let y=[],b=d,P=p;for(;b>0&&P>0;)m[b][P]===m[b-1][P]?b--:(m[b][P]===m[b][P-1]||(y.push({track:h[b-1],item:g[b][P]}),b--),P--);return y.reverse()})(n,this.sortItems(i,s));if(c){for(let{track:h,item:u}of c)if(u){this.map.set(h,u);let d=this.fixPosition(u,i);this.map1.set(h,d)}}}isPointsCollinear(e){if(e.length<=2||Vie(e))return!0;let r=e[1].sub(e[0]);for(let i=2;i<e.length;i++){let n=e[i].sub(e[0]),s=r.cross(n);if(!ne.eq(s,0))return!1}return!0}filterByStandardDeviation(e,r){let i=[];for(let p of e.values())i.push(p);if(i.length>1&&this.isPointsCollinear(i))return e;let n=0,s=0;e.forEach(p=>{n+=p.x,s+=p.y});let a=n/e.size,l=s/e.size,c=0;e.forEach(p=>{c+=(p.x-a)**2+(p.y-l)**2});let h=c/e.size,u=Math.sqrt(h),d=new Map;return e.forEach((p,m)=>{Math.sqrt((p.x-a)**2+(p.y-l)**2)<=r*u&&d.set(m,p)}),d}getEndPoint(){if(this.map.size==0)return!1;let e=new Array;for(let a=0;a<this.event.tracks.length;a++){let l=this.event.tracks[a];if(l.drawing==1)continue;l.end.point=l.start.point,l.drawing=2;let c=this.map.get(l);if(c!=null){let h=this.map1.get(l),{direct:u,allowModify:d}=no.getDirect(h,c);d?l.end.allowModifyDirect=!0:l.end.direct=u,l.end.point=this.map1.get(l),e.push({info:l,item:c,project:0})}}let i=this.sort(e).map(a=>a.info),n=this.findMaxCommonSubsequence(this.event.tracks,i),s=this.findMaxCommonSubsequence(this.event.tracks,i.reverse());if(n.length>s.length){for(let a of n)a.end.direct=a.end.direct.mul(-1),a.end.allowModifyDirect=!1,a.drawing=0;return!0}else{for(let a of s)a.drawing=0,a.end.allowModifyDirect=!1;return!0}}getEndPoint_v1(){if(this.map.size==0)return!1;let e=new Array;for(let u=0;u<this.event.tracks.length;u++){let d=this.event.tracks[u];if(d.drawing==1)continue;d.end.point=d.start.point,d.drawing=2;let p=this.map.get(d);if(p!=null){let m=this.map1.get(d),{direct:g,allowModify:y}=no.getDirect(m,p);y?d.end.allowModifyDirect=!0:d.end.direct=g,d.end.point=m,d.end.model=Mt.checkIsCanEditByItem(p)?p.model:void 0,e.push({info:d,item:p,project:0})}}let i=this.sort(e).map(u=>u.info),n=i.map(u=>this.map1.get(u)),s=!0,a=i.map(u=>u.start.point);if(i.map(u=>u.net).some(u=>Hu.getNet(u).netDifferentail))s=!1;else if(n.some(u=>!u))s=!1;else for(let u=0;u<i.length;u++){let d=a[u],m=n[u].sub(d).normalize(),g=i[u].direct;if(Math.abs(m.cross(g))>.0875){s=!1;break}}if(s){for(let u=0;u<i.length;u++){let d=i[u],p=this.map.get(d),m=this.map1.get(d);d.end.point=m,d.drawing=0,d.end.direct=p instanceof Ge?no.getDirect(m,p).direct:d.direct,d.end.allowModifyDirect=!1,d.end.model=Mt.checkIsCanEditByItem(p)?p.model:void 0}return this.clearWaitInfoModel(),!0}let c=this.findMaxCommonSubsequence(this.event.tracks,i),h=this.findMaxCommonSubsequence(this.event.tracks,[...i].reverse());if(c.length>h.length)for(let u of c)u.end.allowModifyDirect=!1,u.drawing=0;else for(let u of h)u.drawing=0,u.end.direct=u.end.direct.mul(-1).normalize(),u.end.allowModifyDirect=!1;return this.clearWaitInfoModel(),!0}clearWaitInfoModel(){for(let e of this.event.tracks)e.drawing==2&&(e.end.model=null)}getEndEvent(e){let r=e.length,i=new Array;for(let s=0;s<r;s++){let a=e[s];if(s==0&&(a.previous=null),s+1<r){let l=e[s+1],c=a.next,h=c.width,u=c.next;for(;u!=l;)h+=u.width,c=u.next,h+=c.width,u=c.next;let d=new xI(h);i.push(d)}else a.next=null}let n=new RI(e,i,e[0]);return n.linked(e,i),n}findMaxCommonSubsequence(e,r){let i=e.length,n=r.length,s=new Array(i+1);for(let h=0;h<=i;h++)s[h]=new Array(n+1).fill(0);for(let h=1;h<=i;h++)for(let u=1;u<=n;u++)e[h-1]===r[u-1]?s[h][u]=s[h-1][u-1]+1:s[h][u]=Math.max(s[h-1][u],s[h][u-1]);let a=[],l=i,c=n;for(;l>0&&c>0;)e[l-1]===r[c-1]?(a.unshift(e[l-1]),l--,c--):s[l-1][c]>=s[l][c-1]?l--:c--;return a}sort(e){let r=e.length;if(r==0)return;let i=e[0].info.end.point;for(let d=1;d<r;d++)i=i.add(e[d].info.end.point);i=i.mul(1/r);let n=0,s=0,a=0,l=0;for(let d of e){let p=d.info.end.point.sub(i).normalize();n+=Math.abs(_ce.cross(p)),s+=Math.abs(vce.cross(p)),a+=Math.abs(xce.cross(p)),l+=Math.abs(Rce.cross(p))}let c=[{sum:n,dir:_ce},{sum:s,dir:vce},{sum:a,dir:xce},{sum:l,dir:Rce}];c.sort((d,p)=>d.sum-p.sum);let h=c[0].dir,u=new S(-h.y,h.x).normalize();for(let d of e)d.project=d.info.end.point.sub(i).dot(h);if(e.sort((d,p)=>{let m=d.project-p.project;if(Math.abs(m)<1e-4){let g=d.info.end.point.sub(i).dot(u),y=p.info.end.point.sub(i).dot(u);return g-y}else return d.project-p.project}),!e[0].info.end.allowModifyDirect)h.cross(e[0].info.end.direct)<0&&(e=e.reverse());else for(let d of e)d.info.end.direct=u;return e}getNextReferItem(e){let r=e.next;for(;r!=null;)if(e=r.next,r=e.next,this.map.get(e)!=null)return e;return null}isResult(e,r){if(e instanceof Le){if((e.layerId==12||e.layerId==r.layerId)&&r.net==e.net)return!0}else if(e instanceof Ge){if(e.layerId==r.layerId&&r.net==e.net)return!0}else if(e instanceof Ue&&e.isContains(r.layerId)&&r.net==e.net)return!0;return!1}getEndpoint(e,r){let i=no.click4ConnectNode(r.x,r.y,["Pad","Via","Track","ArcTrack"]),n=new Array,s=new Array,a=new Array;for(let l of i)l instanceof Le?(l.layerId==12||l.layerId==e.layerId)&&e.net==l.net&&n.push(l):l instanceof Ge?l.layerId==e.layerId&&e.net==l.net&&s.push(l):l instanceof Ue&&l.isContains(e.layerId)&&e.net==l.net&&a.push(l);return n.length>0?n[0]:a.length>0?a[0]:s.length>0?s[0]:null}hightEnd(){this.map.forEach(e=>{Mi.getInstance().setHightItem(e),Cr.getInstance().current.setHight(e.globalIndex)})}};var wce=class{constructor(){this.startItemsConnects={}}setStartConnect(t){if(t){let e=this.startItemsConnects[t.globalIndex];if(!e){let r=t.globalIndex,n=new Jt().getItem(r);if(n instanceof Qo){let s=n.searchAllConnectNode1(),a=Array.from(s).map(l=>l.globalIndex);a.push(r),e=this.startItemsConnects[r]=a}else e=this.startItemsConnects[r]=[]}return e}return[]}getStartConnect(t){return this.startItemsConnects[t.globalIndex]}};var VV=class{constructor(t){this.clusters=new Array;this.ratline=[];this.startNodes=new Set;this.startNodeIds=[];this.net=t}highlight(){Ye.highlightNet(this.net,!0),this.hideDelNodes()}hideDelNodes(){R0.getInstance().oldStartItems.forEach(e=>{e instanceof gt&&$l.getInstance().has(e.globalIndex)&&pr.getItem(e.globalIndex).iteratorRatlines(i=>{i.hidden()})})}static hightRatlineNets(t){va.useWebgl||Wo.bulkUpdatesVisible(!1,t),Wo.highlightNets(t)}static unhighlight(){Ye.unhighlightNet(""),Wo.unHighlightNet(""),Wo.clearHighlightNet()}setStartItems(t){this.highlight();let e=this.net,r=new Jt;vp.useWireClusterCache=!0;let i=uS(e)||[];vp.useWireClusterCache=!1,this.startNodeIds=Array.from(t),this.startNodeIds.forEach(n=>{let s=r.getItem(n);s&&this.startNodes.add(s)});for(let n of i){let s=!0;for(let a of t)if(n.has(a)){s=!1;break}if(s){let a=hS.get(n);a&&this.clusters.push(a)}}}getEndpoint(t,e){let r,i=Number.MAX_SAFE_INTEGER;for(let n of e.junctions){let s=t.point.distance2(n.point);s<i&&(i=s,r=n)}return r}generateRatline(t,e){if(this.clear(),this.clusters.length+t.length>1){let i=new Array,n=[],s=0;for(let a of t){let l=new Array;s++;let c=new Ja(a);l.push(c),n.push(new Sx(l,s))}for(let a=0;a<n.length;a++){let l=n[a],c=n[a+1];if(c){let h=new T2(c,l,c.junctions[0],l.junctions[0]);i.push(h)}}for(let a=0;a<this.clusters.length;a++){let l=this.clusters[a];for(let c of n){let h=new T2(c,l,c.junctions[0],this.getEndpoint(c.junctions[0],l));i.push(h)}}if(Er(i,(a,l)=>a.length2-l.length2,0,i.length),i.length>0)for(let a=0;a<t.length;a++){let l=i[a];if(!l)return;let c=l.left,h=l.right;c.id&&this.hideRatline(c.id),h.id&&this.hideRatline(h.id);let u=Ye.getSpecialColor(e),d=new cr(57,c.point,h.point,!0,u);d.click(),this.ratline.push(d)}}}hideRatline(t){let r=new Jt().getItem(t);if(!r)return;let i=r;this.startNodes.forEach(n=>{n.iteratorRatlines(s=>{i.hasRatline(s)?s.hidden():s.visible()})})}clear(){this.ratline.forEach(t=>{t.remove()}),this.ratline.length=0}};var GV=class{static getViaPos(t){if(!t)return null;let e=t.viaNode;if(e!=null){let r=t.getAllItems(),n=t.getFirst().start,s=r.length-1;return r.length>0&&(e.next?(ds.getInstance().wireConfirmType=="previous"&&r.length>1&&(s=r.length-2),n=r[s].end):s=0),n}return null}};var aYe=Math.PI,B5o=Math.PI/2,lYe=Math.PI/4,uYe=Math.PI/8;var cYe=Math.sin(uYe),hYe=Math.tan(uYe),Gvt=cYe*hYe/(hYe-cYe),uq=class uq{constructor(t,e,r,i){this.sameCornerRef=[];this.models=[];let n=r.item.start,s=r.item.end,a=i.item.end;this.delta=t,this.corner=s,this.style=e,this.SC=s.sub(n).normalize(),this.CE=a.sub(s).normalize();let l=this.SC.cross(this.CE);this.sweep=l>0?ae.CCW:ae.CW,uq.cornerType===0?this.angle=this.sweep===ae.CCW?lYe:-lYe:(l<-1?l=-1:l>1&&(l=1),this.angle=Math.asin(l));let c=this.angle>0?(aYe-this.angle)/2:-(aYe+this.angle)/2;this.bisectorDirect=this.CE.rotate(S.ORIGIN,c),this.models.push(r.item,i.item)}getModels(){return this.models}get factor(){if(uq.cornerType===0)return Gvt;let t=Math.abs(this.angle)/2,e=Math.sin(t),r=Math.tan(t);return e*r/(r-e)}getArcCenter(){let t=this.bisectorDirect.mul(this.delta/this.factor);return this.corner.add(t)}getLine(){let t=this.getArcCenter();return new M(this.corner,t)}getLine1(t){let e=this.delta/this.factor,r=this.corner.add(this.bisectorDirect.mul(e+t));return new M(this.corner,r)}getArcStartAndEnd(){if(this.delta==0)return[this.corner,this.corner];let t=this.corner.add(this.SC.mul(-this.delta)),e=this.corner.add(this.CE.mul(this.delta));return[t,e]}calcDelta(t){return this.factor*t}isSame(t){if(this.sweep!==t.sweep||!this.bisectorDirect.similarEquals(t.bisectorDirect,1e-7))return!1;let e=this.corner.sub(t.corner).normalize();if(e.similarEquals(this.bisectorDirect,.001)||e.mul(-1).similarEquals(this.bisectorDirect,.001))return!0}getOutsideTargetDelta(t){let r=this.corner.sub(t.corner).length()*Math.sin(Math.abs(this.angle/2));return this.delta+r}getInnerTargetDelta(t){let r=this.corner.sub(t.corner).length()*Math.sin(Math.abs(this.angle/2));return this.delta>r?this.delta-r:0}getNeedFilterNodes(){let t=[],e=this.sameCornerRef;return this.innerCornerRef&&(t.push(...this.innerCornerRef.models),e=this.innerCornerRef.sameCornerRef),e&&e.forEach(r=>{t.push(...r.models)}),new Set(t)}};uq.cornerType=0;var Yy=uq,dq=class{constructor(){this.arc=new Yn;this.blockShape=new ms;this.wireStatusManager=Mr.getInstance();this.fac=new Zr,this.cornerMap=new Map,this.sourceCornerMap=new Map}optimization(t){this.result=t;let e=Zt.getInstance().type;this.command=t.command,oi.getInstance().update();let r=!1;switch(e){case"WIRING_CORNER_ARC45":{Yy.cornerType=0;break}case"WIRING_CORNER_ARC":{Yy.cornerType=1;break}case"WIRING_CORNER_ARC90":Yy.cornerType=1;break;case"WIRING_CORNER_LINE45":{if(le.pcbConfig.autoChamferTrack=="off")return;Yy.cornerType=0,r=!0;break}case"WIRING_CORNER_LINE90":case"WIRING_CORNER_FREEANGLE":if(le.pcbConfig.autoChamferTrack=="off")return;Yy.cornerType=1,r=!0;break;default:return}let i=this.getLists(t);for(let n of i){let s=n.listIterator(),a;s.hasNext()&&(a=s.next());let l=this.wireStatusManager.getStatus(a);for(;!l.isInput&&s.hasNext();)a=s.next(),l=this.wireStatusManager.getStatus(a);let c;if(s.hasNext()&&(c=s.next()),r&&(a!=null&&a.prev)){let h=this.getArcCornerInfo(a.prev,a,c);this.addCornerInfo2SourceMap(n,h)}for(;s.hasNext();){let h=s.next(),u=this.getArcCornerInfo(a,c,h);this.addCornerInfo2SourceMap(n,u),a=c,c=h}if(c){let h=this.getArcCornerInfo(a,c);this.addCornerInfo2SourceMap(n,h)}}this.buildInnerCornerRef(i),Zt.getInstance().mode!=="WIRING_MODE_IGNORE"&&this.fixObstacleAroundDelta(),this.fixOutsideCornerDelta(i),this.maximumRadius(i),this.gnrArcCorner(i),this.cornerMap=null,e==="WIRING_CORNER_ARC"&&this.optimizeArcLineCorner(i),ds.getInstance().wireConfirmType==="previous"&&this.fixViaPosition()}maximumRadius(t){let e=Zt.getInstance().type,r=le.pcbConfig.autoChamferTrack!="off"&&["WIRING_CORNER_LINE45","WIRING_CORNER_LINE90"].includes(e)?le.pcbConfig.filletRadiusTrack:Ha.getInstance().getMaximumRadius()/10;for(let i of t){let n=this.sourceCornerMap.get(i);if(n)for(let s of n){let a=Math.tan(Math.abs(s.angle/2));s.delta/a>r&&(s.delta=r*a)}}}addCornerInfo2SourceMap(t,e){if(!e)return;let r=this.sourceCornerMap.get(t);r||(r=[],this.sourceCornerMap.set(t,r)),r.push(e)}getArcCornerInfo(t,e,r){let i=t.item.start,n=t.item.end,s=e.item.end;if(this.isCollinear(i,n,s)||t.ignoreArcOptimization||e.ignoreArcOptimization||t.item instanceof Ii||e.item instanceof Ii||t.item.width!==e.item.width||Yy.cornerType===0&&!(this.isDirect45(t.item.direct)&&this.isDirect45(e.item.direct)))return;if(!r){let m=n.sub(i).length(),g=s.sub(n).length(),y=this.cornerMap.get(t);y&&(m=m-y.delta);let b=m-g,P;return b>0?P=new Yy(g,0,t,e):P=new Yy(m,1,t,e),this.cornerMap.set(e,P),P}let a=r.item.end,l=n.sub(i).length(),c=this.cornerMap.get(t);c&&(l=l-c.delta);let h=s.sub(n).length(),u=a.sub(s).length(),d=l-h,p;return this.isCollinear(n,s,a)?(d>0?p=new Yy(h,0,t,e):p=new Yy(l,1,t,e),this.cornerMap.set(e,p),p):(h>=l+u?p=new Yy(l,1,t,e):l<h/2?p=new Yy(l,1,t,e):u<h/2?p=new Yy(h-u,2,t,e):p=new Yy(h/2,2,t,e),this.cornerMap.set(e,p),p)}buildInnerCornerRef(t){let e=this;for(let i=0;i<t.length-1;i++){let n=t[i],s=this.sourceCornerMap.get(n);if(s)for(let a=0;a<s.length;a++){let l=s[a];!l||l.innerCornerRef||l.sweep===ae.CCW&&r(l,!0,i)}}for(let i=t.length-1;i>0;i--){let n=t[i],s=this.sourceCornerMap.get(n);if(s)for(let a=0;a<s.length;a++){let l=s[a];!l||l.innerCornerRef||l.sweep===ae.CW&&r(l,!1,i)}}function r(i,n,s){let a=0,l=s;for(n&&(a=s+1,l=t.length);a<l;a++){let c=t[a],h=e.sourceCornerMap.get(c);if(h)for(let u of h){if(u.innerCornerRef)continue;i.isSame(u)&&(u.innerCornerRef=i,i.sameCornerRef.push(u))}}}}fixObstacleAroundDelta(){let t=new ms;this.cornerMap.forEach((e,r)=>{let i=this.getArcByCornerInfo(e);if(!i){e.delta=0;return}let n=e.getNeedFilterNodes(),s=(c,h,u,d=!1)=>{let p=t.blockTrackPrimitive(c,h,u,d);return p=p.filter(m=>!(m.obstacle instanceof gt&&n.has(m.obstacle)||m.source instanceof gt&&n.has(m.source))),p},a=s(r.item,i,!1,!1),l=!1;if(a.length>0){let c=a[0].clearance,h=e.getLine1(c),u=s(r.item,h,!1,!1);if(u.length>0){let d=u[0].point;if(d.equals1(e.corner))e.delta=0;else{let p=d.sub(e.corner).length(),m=e.calcDelta(p);m<e.delta&&(e.delta=m,e.style=2)}}l=!0}if(l&&e.delta>0){let c=0,h=0,u=e.delta;for(;c<8;){c++;let d=this.getArcByCornerInfo(e);if(!d){e.delta=0;return}if(s(r.item,d,!1,!1).length>0&&(u=e.delta,e.delta=(h+e.delta)/2,e.style=2),c===1)break;h=e.delta,e.delta=(e.delta+u)/2}c>=8&&(e.delta=h,e.style=2)}})}fixOutsideCornerDelta(t){for(let e=0;e<t.length;e++){let r=t[e],i=this.sourceCornerMap.get(r);if(i)for(let n=0;n<i.length;n++){let s=i[n];if(!s||s.sameCornerRef.length<=0)continue;let a=Array.from(s.sameCornerRef);a.sort((u,d)=>{let p=u.corner.sub(s.corner).length(),m=d.corner.sub(s.corner).length();return p-m});let l=a[a.length-1];s.corner.sub(l.corner).normalize().similarEquals(s.bisectorDirect.mul(-1),1e-7)&&(a.pop(),a.unshift(s),a.reverse(),s=l);let h=s;for(let u=0;u<a.length;u++){let d=a[u],p=h.getOutsideTargetDelta(d);if(d.delta>p)d.delta=p,d.style=2;else if(d.delta<p){let m=d.getInnerTargetDelta(h);m>0&&(h.delta=m,h.style=2)}h=d}if(ds.getInstance().wireMode=="Differential pair wiring"){let u=a[a.length-1],d=Ha.getInstance().getMaximumRadius()/10*Math.tan(Math.abs(u.angle/2));if(d<u.delta){u.delta=d;let p=Array.from(a);p.reverse(),p.push(s);let m=null;for(let g of p){if(m!=null){let y=m.getInnerTargetDelta(g);g.delta=y}m=g}}}}}}gnrArcCorner(t){for(let e of t){let r=e.listIterator(),i;for(r.hasNext()&&(i=r.next());r.hasNext();){let n=r.next();if(i.item instanceof Ii||i.ignoreArcOptimization){i=n;continue}i=this.optimizationArc45PathNode(i,n)}}}optimizationArc45PathNode(t,e){let r=this.cornerMap.get(e);if(this.cornerMap.delete(e),!r)return e;let i=t.item,n=e.item,s=i.start,a=i.end,l=n.end,c=this.command,h=a.sub(s).length(),u=l.sub(a).length(),d=r.style,p=r.delta,m=1.2,y=Et(i.primitive).equals1(Et(n.primitive))&&(h<m*i.width||u<m*n.width);if(p<=0||y)return e;switch(h>p&&u>p?d=2:h>p?d=0:u>p?d=1:(p=Math.min(h,u),d=2),d){case 0:{let b=s.sub(a).normalize().mul(p).add(a),P=r.angle,T=this.creatArc(b,l,P);if(T!=null){let I=t.item,C=At.getInstance().createList(),E=this.fac.createTrack(I.layerId,s,b,I.width,I.showNet,c,I.getGroupID());this.fac.addList(E,C,c);let O=this.createLineArcTrack(T,I,C,c);this.result.setInputStatus(C),C.replace(t,e),c.addCommand(new mi(C)),e=O}break}case 1:{let b=l.sub(a).normalize().mul(p).add(a),P=r.angle,T=this.creatArc(s,b,P),I=t.item,C=At.getInstance().createList();if(T!=null){let E=this.createLineArcTrack(T,I,C,c);if(p>=u)this.result.setInputStatus(C),C.replace(t,e),c.addCommand(new mi(C)),e=E;else{let O=this.fac.createTrack(I.layerId,b,l,I.width,I.showNet,c,I.getGroupID()),_=this.fac.addList(O,C,c);this.result.setInputStatus(C),C.replace(t,e),c.addCommand(new mi(C)),e=_}}break}case 2:{let b=s.sub(a).normalize().mul(p).add(a),P=l.sub(a).normalize().mul(p).add(a),T=r.angle,I=this.creatArc(b,P,T),C=t.item,E=At.getInstance().createList();if(I!=null){let O=this.fac.createTrack(C.layerId,s,b,C.width,C.showNet,c,C.getGroupID());this.fac.addList(O,E,c),this.createLineArcTrack(I,C,E,c);let _=this.fac.createTrack(C.layerId,P,l,C.width,C.showNet,c,C.getGroupID()),x=this.fac.addList(_,E,c);this.result.setInputStatus(E),E.replace(t,e),c.addCommand(new mi(E)),e=x}break}default:break}return e}getArcByCornerInfo(t){let e=t.style,r=t.getModels(),i=r[0],n=r[1],s=i.start,a=i.end,l=n.end,c=t.delta,h=t.angle;switch(e){case 0:{let u=s.sub(a).normalize().mul(c).add(a);return this.creatArc(u,l,h)}case 1:{let u=l.sub(a).normalize().mul(c).add(a);return this.creatArc(s,u,h)}case 2:{let u=s.sub(a).normalize().mul(c).add(a),d=l.sub(a).normalize().mul(c).add(a);return this.creatArc(u,d,h)}default:return null}}getLists(t){let e=[];for(let[r,i]of t.wireMap)e.push(i);return e}fixViaPosition(){let t=Rn.getInstance().current;for(let e of t.tracks){let r=t.result.wireMap.get(e);if(!r)continue;let i=r.getAllItems(),n=t.result.wireVia.get(e);if(i.length>=0&&n){let s=i.length===0?e.start.point:GV.getViaPos(r);n.item.center=s}}}optimizeArcLineCorner(t){for(let e of t){let r=e.listIterator(),i;r.hasNext()&&(i=r.next());let n=this.wireStatusManager.getStatus(i);for(;!n.isInput&&r.hasNext();)i=r.next(),n=this.wireStatusManager.getStatus(i);for(;r.hasNext();){let s=r.next();if(!this.checkArcLineCorner(i,s)){i=s;continue}i=this.roundArcLineCorner(i,s)}}}checkArcLineCorner(t,e){if(t.item.width!==e.item.width)return!1;let r,i;if(t.item instanceof zr?i=t.item:t.item instanceof Ii&&(r=t.item),e.item instanceof zr?i=e.item:e.item instanceof Ii&&(r=e.item),!(r&&i))return!1;let n=i.direct;if(e.item instanceof Ii){let a=Et(r.primitive,r.start);if(n.equals1(a))return!1}else if(t.item instanceof Ii){let a=Et(r.primitive);if(n.equals1(a))return!1}let s=i.width;return i.length>s&&r.length>Math.PI*s}roundArcLineCorner(t,e){let r,i;t.item instanceof zr?i=t.item:t.item instanceof Ii&&(r=t.item),e.item instanceof zr?i=e.item:e.item instanceof Ii&&(r=e.item);let n=this.calcArcLineDelta(t,e),s=zt.toDegrees(2*Math.asin(n/(2*r.radius))),a=this.command;if(t.item instanceof zr&&e.item instanceof Ii){let l=r.primitive,c=i.direct,h=l.sweep()===ae.CCW?l.startAngle+s:l.startAngle-s,u=l.pointOn(h),d=Et(r.primitive,u);if(c.equals1(d)||u.equals1(l.end()))return e;let p=i.start.add(c.mul(i.length-n)),m=this.creatArc1(p,u,c),g=q.build4(u,l.end(),l.center,l.rx,l.rx,l.sweep());if(m&&g){if(this.blockTrackPrimitive(r,m))return e;let b=t.item,P=At.getInstance().createList(),T=this.fac.createTrack(b.layerId,i.start,p,b.width,b.showNet,a,b.getGroupID());this.fac.addList(T,P,a),this.createLineArcTrack(m,b,P,a);let I=this.createLineArcTrack(g,b,P,a);P.replace(t,e),a.addCommand(new mi(P)),e=I}}else if(t.item instanceof Ii&&e.item instanceof zr){let l=r.primitive,c=i.direct,h=l.sweep()===ae.CCW?l.endAngle()-s:l.endAngle()+s,u=l.pointOn(h),d=Et(r.primitive,u);if(c.equals1(d)||u.equals1(l.start()))return e;let p=i.start.add(c.mul(n)),m=q.build4(l.start(),u,l.center,l.rx,l.rx,l.sweep()),g=this.creatArc1(u,p,d);if(m&&g){if(this.blockTrackPrimitive(r,g))return e;let b=t.item,P=At.getInstance().createList();this.createLineArcTrack(m,b,P,a),this.createLineArcTrack(g,b,P,a);let T=this.fac.createTrack(b.layerId,p,i.end,b.width,b.showNet,a,b.getGroupID()),I=this.fac.addList(T,P,a);P.replace(t,e),a.addCommand(new mi(P)),e=I}}return e}calcArcLineDelta(t,e){let r,i;if(t.item instanceof zr&&e.item instanceof Ii){let l=e.item;r=t.item.direct,i=Et(l.primitive,l.start)}else if(t.item instanceof Ii&&e.item instanceof zr){let l=t.item;r=Et(l.primitive),i=e.item.direct}let n=Math.min(t.item.start.distance1(t.item.end),e.item.start.distance1(e.item.end)),s=r.dot(i),a=t.item.width;return s<0&&(a=(1+Math.abs(s)*1.2)*a),n<a&&(a=n),a}blockTrackPrimitive(t,e){let r=this.blockShape.blockTrackPrimitive(t,e,!1);return r.length>0?r.some(i=>!i.isSameNet):!1}createLineArcTrack(t,e,r,i){let n;le.pcbConfig.autoChamferTrack=="chamfer"?n=this.fac.createTrack(e.layerId,t.start(),t.end(),e.width,e.showNet,i,e.getGroupID()):n=this.fac.createArcTrack(e.layerId,t.center,t.rx,zt.toRadians(t.startAngle),zt.toRadians(t.endAngle()),t.sweep(),e.width,e.net,i,void 0,e.getGroupID());let s=this.fac.addList(n,r,i);return s.ignoreArcOptimization=!0,s}createTrack(){}creatArc(t,e,r){if(Math.abs(r)<.01)return null;let{center:i,radius:n,startAngle:s,endAngle:a,sweep:l}=this.arc.pointToAngle(t,e,r);return n>0?q.build2(i,zt.toDegrees(s),zt.toDegrees(a),n,n,l):null}creatArc1(t,e,r){let{center:i,radius:n,startAngle:s,endAngle:a,sweep:l}=this.arc.tangentToArc(r,t,e);return n>0?q.build2(i,zt.toDegrees(s),zt.toDegrees(a),n,n,l):null}isCollinear(t,e,r){let i=e.sub(t).normalize(),n=r.sub(e).normalize(),s=i.cross(n);return Math.abs(s)<1e-6}isDirect45(t){function e(i,n){return Math.abs(i-n)<=1e-5}if(e(t.x,0)||e(t.y,0))return!0;let r=Math.abs(t.x/t.y);return!!e(r,1)}};var KA=class{constructor(t,e,r,i,n,s,a,l,c,h){this._state="Only Main";this.globalIndex=Lh(),this.fonts=t,this.position=e,this.angle=r,this.limitMin=i,this.limitMax=n,this.fontWidth=s,this.fontHeight=a,this.layerId=l,this.color=c,this.layerIds=h,this.refreshRender()}get highlightColor(){return ee.BLACK}get highLightType(){return null}get viewGroupId(){if(this.layerIds&&this.layerId==1001)return"DRCError"+this.layerIds.toString()}setPosition(t){let e=t.sub(this.position),r=Ae.translate(e.x,e.y,0);this.transform(r)}getPosition(){return this.position}setAngle(t){this.angle=t,this.refreshRender()}getAngle(){return this.angle}setLineWidth(t){this.fontHeight=t,this.refreshRender()}getLineWidth(){return this.fontHeight}setLineLength(t){this.fontWidth=t,this.refreshRender()}getLineLength(){return this.fontHeight}remove(){this._state="Not Shown",this.refreshRender()}getText(){return this.fonts}modifyText(t){this.fonts=t,this.refreshRender()}transform(t){this.position=this.position.multiply4(t),this.refreshRender()}getType(){return 32}refreshRender(){Mo.attach(this,this.getType())}getViewState(){return this._state}getRenderData(){return this}};var J6=class J6{constructor(){this.shapes=new Array;this.color=ee.of3("#7F7F7F");this.layerId=1002;this.width=.3;this.LENGTH_RATIO=1.5;this.PI4=Math.PI/4}static getInstance(){return J6.tool==null&&(J6.tool=new J6),J6.tool}refresh(t){this.remove();let e=t.end.direct,r=t.end.point,i=e.angleX()+this.PI4,n=new KA("\xD7",r,i,10,30,20,20,this.layerId);this.shapes.push(n)}clear(){this.remove()}remove(){for(let t of this.shapes)t.remove();this.shapes.length=0}};J6.tool=null;var HS=J6;var Lce=class extends Kh{upload(t){throw new Error("Method not implemented.")}updateData(){throw new Error("Method not implemented.")}constructor(t,e){super(),this.tool=e,this.mode=t}redo(){throw new Error("Method not implemented.")}undo(){this.tool.modifyWireMode(this.mode)}};var Mce=class extends wI{constructor(){super();this.found=new Map}run(e){for(let[r,i]of e.wireMap){let n=this.split2(i);n.length>0&&e.command.addCommand(n)}}split(e){let r=new Lr,i=e.getFirstNode(),n=e.getLastNode();for(;i!=null;){let s=i.item;if(!this.needCheck(s.globalIndex)){i=i.next;continue}let a=s.primitive,l=a.bbox().extendOfSize(s.width/2),c=wt.searchPartition(l),h=this.getBlockInfo(a,c,n.item.end);if(h.length>0){let u=s.primitive,d=h[0].inter,p=h[0].pl,m=h[0].foot,g=h[0].globalIndex;if(d.equals1(a.start())){let C=this.partitionExtend(c,s.width/2,g);if(this.getBlockInfo1(a,C,n.item.end).length)d=m;else{i=i.next;continue}}let y=new Zr,b;if(u instanceof M)b=y.createTrack(s.layerId,u.start(),d,s.width,s.showNet,r,s.getGroupID());else{let C=q.build4(u.start(),d,u.center,u.rx,u.rx,u.sweep());b=y.createArcTrackByArc(s.layerId,C,s.width,s.showNet,r,s.getGroupID())}let P=y.createList(),T=y.addList(b,P,r),I=Mr.getInstance().getStatus(i);Mr.getInstance().setStatus(T,I.clone()),P.replace(i,e.getLastNode()),r.addCommand(new mi(P));break}else i=i.next}return r}split1(e){let r=new Lr,i=e.getFirstNode(),n=e.getLastNode(),s=i.item.start;for(;i!=null;){let a=i.item;if(!this.needCheck(a.globalIndex)){s=a.end,i=i.next;continue}let l=a.primitive,c=l.bbox().extendOfSize(a.width/2),h=wt.searchPartition(c),u=this.getBlockInfo(l,h,n.item.end);if(u.length>0){let d=a.primitive,p=u[0].inter,m=u[0].pl,g=u[0].foot,y=u[0].globalIndex;if(p.equals1(l.start())){let E=this.partitionExtend(h,1e-4,y);if(this.getBlockInfo1(l,E,n.item.end).length)p=g;else{s=a.end,i=i.next;continue}}let b=new Zr,P;if(d instanceof M)P=b.createTrack(a.layerId,s,p,a.width,a.showNet,r,a.getGroupID());else{let E=q.build4(s,p,d.center,d.rx,d.rx,d.sweep());P=b.createArcTrackByArc(a.layerId,E,a.width,a.showNet,r,a.getGroupID())}let T=b.createList(),I=b.addList(P,T,r),C=Mr.getInstance().getStatus(i);Mr.getInstance().setStatus(I,C.clone()),T.replace(i,i),r.addCommand(new mi(T)),s=p,i=i.next}else s=a.end,i=i.next}return r}split2(e){let r=new Lr,i=e.getFirstNode();for(;i!=null;){let n=i.item;if(!this.needCheck(n.globalIndex)){i=i.next;continue}let s=n.primitive,a=s.bbox().extendOfSize(n.width/2),l=wt.searchPartition(a),c=this.blockShape.blockTrack4Shapes(n,s,!0,l);if(c.length>0){let h=n.primitive,u=c[0].point,d=new Zr,p;if(h instanceof M)p=d.createTrack(n.layerId,h.start(),u,n.width,n.showNet,r,n.getGroupID());else{let b=q.build4(h.start(),u,h.center,h.rx,h.rx,h.sweep());p=d.createArcTrackByArc(n.layerId,b,n.width,n.showNet,r,n.getGroupID())}let m=d.createList(),g=d.addList(p,m,r),y=Mr.getInstance().getStatus(i);Mr.getInstance().setStatus(g,y.clone()),m.replace(i,e.getLastNode()),r.addCommand(new mi(m));break}else i=i.next}return r}needCheck(e){let r=Mi.getInstance().getMap;return r.size?!Array.from(r.keys()).includes(e):!0}getBlockInfo(e,r,i){let n=[];for(let s of r.profiles)if(s.type=="Partition"&&s.component.isPartitionSplitOut()){let c=s.getMathGraphics().primitives;for(let h of c){let u=Pt(h,e);if(u>0){let d=Om(u,[]);Er(d,(y,b)=>y.distance2(e.start())-b.distance2(e.start()));let m=new er(h,new M(i,i)).getLine(),g;m.start().equals1(i)?g=m.end():m.end().equals1(i)&&(g=m.start()),n.push({inter:d[0],foot:g,pl:h,globalIndex:s.globalIndex})}}}return n.length&&Er(n,(s,a)=>s.inter.distance2(e.start())-a.inter.distance2(e.start())),n}getBlockInfo1(e,r,i){let n=[];for(let s in r){let a=s,c=r[s].primitives;for(let h of c){let u=Pt(h,e);if(u>0){let d=Om(u,[]);Er(d,(y,b)=>y.distance2(e.start())-b.distance2(e.start()));let m=new er(h,new M(i,i)).getLine(),g;m.start().equals1(i)?g=m.end():m.end().equals1(i)&&(g=m.start()),n.push({inter:d[0],foot:g,pl:h,globalIndex:a})}}}return n.length&&Er(n,(s,a)=>s.inter.distance2(e.start())-a.inter.distance2(e.start())),n}partitionExtend(e,r,i){let n={},s;for(let a of e.profiles)if(a.globalIndex==i){let c=a.getMathGraphics().primitives,h=ge.build2(c);a.globalIndex==R.getInstance().partitionId?s=X0(h,r):s=X0(h,-r),n[a.globalIndex]=s[0]}return n}drawTrack(e,r){let i=new Zr,n=i.createList(),s=e[0],a=e[0],l=e.length;for(let c=1;c<l;c++){a=e[c];let h;if(r.type=="line")h=i.createTrack(r.layerId,s,a,r.width,r.showNet,r.command);else{let u=q.build4(s,a,r.center,r.rx,r.rx,r.sweep);h=i.createArcTrackByArc(r.layerId,u,r.width,r.showNet,r.command)}i.addList(h,n,r.command),s=a}return n}};var Nce=class extends NI{constructor(e,r,i){var a;super(e);this.tool=new Xn;this.change=!1;this.nodes=r,this.blockShape=i;let n=((a=r[0])==null?void 0:a.item.net)||"",s=re.getInstance().getNet(n);this.isDiff=s!=null&&s.netDifferential!=null}optimize1(){if(this.nodes.length==0)return this.nodes;let e=this.nodes;for(;this.endtime>performance.now()&&(this.change=!1,e=this.merge(e),e=this.optimizeCorner(e),!!this.change););return e}replaceNodes(e,r,i,n){return n.length()>1e-8&&(i.direction==0?i.pt=new M(n.start(),n.end()):i.pt=new M(n.end(),n.start()),e.insertBefore(r,i)),i}cloneOrderNode(e){let r=new Zd(e.item,e.pt);return r.direction=e.direction,r.newDirection=e.newDirection,r.status=e.status.clone(),r}isCollide(e,r){if(r.length()<1e-8)return!1;let i=e instanceof Zd?e.item:e.item.item;return this.blockShape.checkDRC4Primitive(i,r)}optimizeCorner(e){if(e.length==0)return e;this.addDebug(e,ee.BLUE);let r=new Tn;for(let a of e)r.add(a);let n=r.listIterator().next();e:for(;n!=null;){let a=n.item.getPathPrimitive(),l=Et(a),c=a.start(),h=a.end(),u=new Array,d=n.next;for(;d!=null;){if(u.push(d),u.length>1){let p=d.item.getPathPrimitive(),m=Et(p);h=p.end();let g=this.tool.degree45(l,c,h),y=zs(l,g),b=d.item.item.width,P=u[u.length-2].item.item.width;if(vCe(l,y[0])&&vCe(m,y[1])&&b===P){let T=new M(g[0],g[1]),I=new M(g[1],g[2]),C=new M(g[1],p.start());if(!this.isCollide(n,T)&&!this.isCollide(d,C)){let E=d,O=l.cross(m);if(ne.eq(O,0)&&mg(h.sub(c.normalize()),m)){let _=new M(c,h),x;_.direct.dot(m)>.99?x=this.cloneOrderNode(E.item):x=this.cloneOrderNode(n.item),this.replaceNodes(r,n,x,_)}else{let _=this.cloneOrderNode(n.item);T.direct.dot(l)<.99&&(_.status.isSource=!1);let x=this.cloneOrderNode(E.item);I.direct.dot(m)<.99&&(x.status.isSource=!1),this.addDebug([n.item,...u.map(v=>v.item)],ee.BLUE),this.replaceNodes(r,n,_,T),this.replaceNodes(r,n,x,I),this.addDebug([_,x],ee.GREEN)}this.change=!0,r.remove(n);for(let _ of u)r.remove(_);n=d==null?void 0:d.prev;continue e}}}else{let p=n.item.item.width,m=d.item.item.width;if(p!==m){n=n.next;continue e}if(n.item.status.isSource&&!d.item.status.isSource&&d.next!=null){let g=d.next.item.getPathPrimitive(),y=d.item.getPathPrimitive(),b=Et(g);if((!d.next.item.status.isSource||ud(y)<.5)&&mg(l,b)){let P=Et(y);h=y.end();let T=this.tool.degree45(P,c,h),I=new M(T[0],T[1]),C=new M(T[1],T[2]);if(!this.isCollide(n,I)&&!this.isCollide(d,C)){let E=d,O=l.cross(P);if(ne.eq(O,0)&&mg(h.sub(c.normalize()),P)){let _=new M(c,h),x;_.direct.dot(P)>.99?x=this.cloneOrderNode(E.item):x=this.cloneOrderNode(n.item),this.replaceNodes(r,n,x,_)}else{let _=this.cloneOrderNode(n.item);I.direct.dot(l)<.99&&(_.status.isSource=!1);let x=this.cloneOrderNode(E.item);C.direct.dot(P)<.99&&(x.status.isSource=!1),this.addDebug([n.item,...u.map(v=>v.item)],ee.BLUE),this.replaceNodes(r,n,_,I),this.replaceNodes(r,n,x,C),this.addDebug([_,x],ee.GREEN)}this.change=!0,r.remove(n);for(let _ of u)r.remove(_);n=d==null?void 0:d.prev;continue e}}}}if(this.isDiff&&u.length>=2)break;d=d.next}n=n.next}let s=r.toArray();return this.addDebug(s,ee.GREEN),s}};var kce=class{constructor(t,e,r){this.utils=new Kd;this.blockShape=new ms;this.command=new Lr;this.interrupt=!1;this.level="WEAK";this.originListMap=new Map;this.adsorption=e,this.lists=t,this.command=new Lr("shove"),this.timeout=r,this.endTime=performance.now()+this.timeout}initShoveEnvironment(){Ou.getInstance().clear(),oi.getInstance().update(),PS.getInstance().clear()}shoveMain(){let t=new Map;this.initShoveEnvironment();let e=0,r=Array.from(this.lists);for(let s of r)s instanceof Fn&&t.set(s,s.getAllItems());let i=this.getAwaitShoveTracks(this.lists);wt.useShoveTree=!1,gg("freeArc");do{this.setFilter4Solid(r);let s=this.initAroundPath(r);if(xe.addAllSet(s.awaitShove,i),i.clear(),this.blockLists(r,s),wt.pushFilter.setNet(null,null),oi.getInstance().update(),e++,this.filterAwaitShoveItem(s.awaitShove),s.awaitShove.size==0||e>=8)break;xe.addAllSet(i,s.awaitShove),r=r.reverse()}while(this.endTime>performance.now()&&!this.interrupt);for(let s of this.lists)s instanceof Fn&&s.size()>0&&(this.sycnVia(s,this.command),this.resetViaChangePosition(s));yg();let n=r.filter(s=>s instanceof Fn);this.getCollideList(t,n)}getCollideList(t,e){for(let r of e){let i=t.get(r),n=i.length,s=this.getChangeTracks(r);if(s.length==0)this.originListMap.set(r,i);else{let a=s[s.length-1],l=i.findIndex(c=>c.start.equals2(a.end,1e-5));i.splice(0,l),n!==i.length&&this.originListMap.set(r,i)}}}blockLists(t,e){let r=Array.from(t);for(;r.length>0&&!this.interrupt&&this.endTime>performance.now();){e.awaitingVias.clear();let i=r.shift();if(wt.pushFilter.addAroundList(i),i instanceof Fn){if(this.adsorption){gg("free");let n=this.adsorp(i,e,this.command);yg(),n&&this.optimize(this.getChangeTracks(i),this.command),this.collideNext(i,e),wt.pushFilter.setNet(null,null)}this.block(i,e,this.command),this.collideNext(i,e)}else if(e.awaitShove.has(i)){let n=!1;for(let[s,a]of i.connectTrack)this.getViaCollideTracks(s,a,e,this.command).length>0&&(n=!0);if(!n){let s=i.item,a=new Lr,l=new SA(i,a,e,this.endTime,e.completes);l.offset(),wt.pushFilter.addAroundTracks(i),l.success?(this.command.addCommand(a),oi.getInstance().deleteShoveTree(s),oi.getInstance().addShoveTree(i.item),l.checkShove(i.item),this.updateNextOrder(i,r,e)):(a.undo(),a=new Lr,e.awaitShove.add(i))}}wt.pushFilter.setNet(null,null)}}isObstacle(t,e){return!(t instanceof gt&&e.canShove(t)&&!t.locked&&!xs(t)&&t.getParent()==null&&e.awaitShove.has(t))}updateNextOrder(t,e,r){try{if(e.length>0){let i=0;for(;i<e.length&&t!=null;){let n=e[i];if(n instanceof Fn){let s=new ES(n.toArray());t instanceof as?s.getViaShoveTracks(t.item,r.awaitShove):t.length>0&&s.getShoveTracks(t,r);break}i++}}}catch(i){this.interrupt=!0,console.log(i)}}collideNext(t,e){if(this.lists.length==1)return;let r=this.getChangeTracks(t);for(let i of r){let n=this.blockShape.blockOtherTrackOnlyTrack(i);for(let s of n){let a=s.source;a instanceof gt&&e.canShove(a)&&e.awaitShove.add(a)}}}optimize(t,e){if(t.length==0||this.level=="WEAK")return;let r=new Set,i=new Array;for(let p of t){let m=new Zd(p,p.primitive),g=At.getInstance().getNode(p);m.status=Mr.getInstance().getStatus(g).clone(),i.push(m),r.add(m)}let s=new Nce(performance.now()+this.timeout,i,this.blockShape).optimize1();for(let p of s)r.has(p)?p.source=!0:p.source=!1;let a=new Array,l=new Zr,c=At.getInstance(),h=null,u=null,d=null;for(let p of s)if(p.source){a.push(p.item);let m=c.getNode(p.item);h!=null&&(m!=null&&m.prev!=null&&(d=m.prev),h.replace(u,d),e.addCommand(new mi(h))),u=m.next,h=null,d=null}else{let m=p.item,g=p.getPathPrimitive();u==null&&(u=c.getNode(m)),d=c.getNode(m);let y;g instanceof M?y=l.createTrack(m.layerId,g.start(),g.end(),m.width,m.showNet,e,m.getGroupID()):y=l.createArcTrackByArc(m.layerId,g,m.width,m.showNet,e,m.getGroupID()),h==null&&(h=c.createList());let b=l.addList(y,h,e);Mr.getInstance().setStatus(b,p.status.clone()),a.push(y)}if(h!=null){let p=c.getNode(t[t.length-1]);p!=null&&(d=p),h.replace(u,d),e.addCommand(new mi(h))}return h=null,u=null,d=null,a}getViaCollideTracks(t,e,r,i){let n=new Array;if(e){let a=t.getFirstNode();for(;a!=null;){if(r.awaitShove.has(a.item))n.push(a);else{let l=a.item;if(this.blockShape.blockTrackOnlyTrack(l,l.primitive,!0).length>0)n.push(a);else break}a=a.next}}else{let a=t.getLastNode();for(;a!=null;){if(r.awaitShove.has(a.item))n.unshift(a);else{let l=a.item;if(this.blockShape.blockTrackOnlyTrack(l,l.primitive,!0).length>0)n.unshift(a);else break}a=a.prev}}let s=new Array;if(n.length>0){for(let l of n)Mr.getInstance().getStatus(l).change(),s.push(l.item);let a=new CS(s,e?t.viaNode.prev.item:t.viaNode.next.item,i,!e,this.endTime,!0,r);a.offset(),a.getResult()}return s}adsorp(t,e,r){if(t.size()==0)return!1;let i=this.getChangeTracks(t);if(Gr.debug){let s=new Array;for(let l of i){let c=new Gn(l.primitive,{color:ee.BLUE,net:l.net});s.push(c)}let a=new Cd(s);Gr.inputDebugGraphics(a),Gr.inputClear()}this.deleteAwaitShove(i,e),wt.pushFilter.setNet(t.getFirst().net,new Set(i));let n=new Set(i);for(let s of i){let a=this.blockShape.blockTrackOtherObstruct(s,n);for(let l of a){let c=l.obstacle,h=l.block.obstalce.outline.pointInHull(l.point,"free");if(!h&&c instanceof gt){let d=At.getInstance().getListNode(c).parent,p=d.toArray().map(b=>b.primitive),m=i[i.length-1],g=this.getEndCollide(i,l.point,d),y=m.end;g!=null&&(m=g.source,y=g.point),this.adsorpPath(s,m,p,l.point,y,r)}else if(!h&&c instanceof or)if(c.type=="Line"||c.type=="Board Outline"||c.type=="Partition"){let u=c.getMathGraphics(),d=i[i.length-1],p=this.getEndCollide(i,l.point,t),m=d.end;p!=null&&(d=p.source,m=p.point),this.adsorpPath(s,d,u.primitives,l.point,m,r)}else{let u=i[i.length-1];this.block4Obstacle(s,u,l.point,r)}else{let u=i[i.length-1];this.block4Obstacle(s,u,l.point,r)}return!0}}return!1}getEndCollide(t,e,r){for(let i=t.length-1;i>=0;i--){let n=t[i],s=this.blockShape.blockTrackPrimitive(n,n.primitive.reverse(),!0,!1);for(let a of s){let l=a.obstacle;if(l instanceof gt){let c=At.getInstance().getListNode(l);if(r==c.parent){let h=new ky(r.toArray().map(p=>p.primitive),e),u=h.calculateDirect(e),d=h.calculateDirect(a.point);return u==d?c.next==null&&ne.eq(a.point.distance1(l.end),(n.width+l.width)/2+a.clearance)||c.prev==null&&ne.eq(a.point.distance1(l.start),(n.width+l.width)/2+a.clearance)?null:a:null}else return null}else if(l instanceof or)if(r==l){let c=new ky(l.getMathGraphics().primitives,e),h=c.calculateDirect(e),u=c.calculateDirect(a.point);return h==u?a:null}else return null;else continue}}return null}block(t,e,r){if(t.size()==0)return;let i=this.getChangeTracks(t);this.deleteAwaitShove(i,e),wt.pushFilter.setNet(t.getFirst().net,new Set(i));let n=new Set(i);for(let s of i){let a=this.blockShape.blockTrackOtherObstruct(s,n);for(let l of a)if(this.isObstacle(l.obstacle,e)){let c=i[i.length-1];this.block4Obstacle(s,c,l.point,r);return}}}sycnVia(t,e){if(t.viaNode.next!=null&&!t.viaNode.next.isSource){let r=t.getLast().end;t.viaNode.next.item.center.equals1(r)||nF(t.viaNode.next.item,r,e,[])}}resetViaChangePosition(t){t.viaNode.next!=null&&!t.viaNode.next.isSource&&(ps.getInstance().remove(t.viaNode.next.item),ps.getInstance().changeViaPosition(t.viaNode.next.item,t.viaNode.next.item.center))}deleteAwaitShove(t,e){for(let r of t)e.awaitShove.delete(r)}filterAwaitShoveItem(t){let e=Array.from(t);for(let r of e)if(r instanceof gt){let i=At.getInstance().getNode(r);i!=null&&i.ignore&&t.delete(r)}}initAroundPath(t){let e=new N3;for(let r of t)r instanceof as?e.canShoveVia.add(r):e.canShovePath.add(r);return e}getAwaitShoveTracks(t){let e=new Set;for(let r of t)if(r instanceof Fn){let i=this.getChangeTracks(r);xe.addAllSet(e,i)}else e.add(r);return e}isChangeViaNode(t){return!t.isSource}setFilter4Solid(t){wt.setPushFilter(),wt.pushFilter.setAroundMode();for(let e of t)wt.pushFilter.addWaitList(e)}adsorpPath(t,e,r,i,n,s){let a=new Zl(i,n,r,null,t.primitive,e.primitive);function l(g,y,b){if(g!=null&&b.length>0){let P=b[0],T=Pt(g,P);if(T>0){let I=new Array;for(let C=0;C<T;C+=2)I.push(new S(Ee[C],Ee[C+1]));an(I,g),i=I[0]}else if(P instanceof M){let I=new _e().ext1(g.bbox()).ext1(P.bbox()).build(),C=I.width()+I.height(),E=new M(P.start().sub(P.direct.mul(C)),P.end()),O=Pt(g,E);if(O>0){let _=new Array;for(let x=0;x<O;x+=2)_.push(new S(Ee[x],Ee[x+1]));an(_,g),i=_[0]}}}if(y!=null&&b.length>0){let P=b[b.length-1],T=Pt(y,P);if(T>0){let I=new Array;for(let C=0;C<T;C+=2)I.push(new S(Ee[C],Ee[C+1]));an(I,y),n=I[I.length-1]}else if(P instanceof M){let I=new _e().ext1(y.bbox()).ext1(P.bbox()).build(),C=I.width()+I.height(),E=new M(P.start(),P.end().add(P.direct.mul(C))),O=Pt(y,E);if(O>0){let _=new Array;for(let x=0;x<O;x+=2)_.push(new S(Ee[x],Ee[x+1]));an(_,y),n=_[_.length-1]}}}}l(t.primitive,e.primitive,a.result);let c=Gu(t.primitive,i)[0],h=null;for(let g of a.result)if(ud(g)>1e-8){h=this.getSweep(t.primitive,i,g);break}let u=a.result.length>0?Mm(a.result[a.result.length-1],e.end,null,null):null;if(a.result.length>0&&!a.result[0].start().equals1(i)&&(a.result.length=0),a.result.unshift(c),Gr.debug){let g=new Array;for(let b of a.result){let P=new Gn(b,{color:ee.GREEN,net:t.net});g.push(P)}let y=new Cd(g);Gr.inputDebugGraphics(y),Gr.inputClear()}if(a.result.length>0&&!a.result[a.result.length-1].end().equals1(n)&&h==u){let g=a.result.pop(),b=Gu(g,n).shift();a.result.push(b)}if(a.result[a.result.length-1].end().equals1(n)&&!a.result[a.result.length-1].end().equals1(e.end)){let y=Gu(e.primitive,n).pop();a.result.push(y)}let d=this.getList(t,a.result,s,h);if(d.size()==0)return;let p=At.getInstance().getListNode(t),m=At.getInstance().getListNode(e);d.replace(p,m),s.addCommand(new mi(d))}getSweep(t,e,r){let i=Et(t,e),n=Et(r,e),s=i.cross(n);return ne.greater(s,0)?ae.CCW:ne.less(s,0)?ae.CW:null}block4Obstacle(t,e,r,i){let n=Gu(t.primitive,r)[0],s=this.getList(t,[n],i),a=At.getInstance().getListNode(t),l=At.getInstance().getListNode(e);if(s.size()==0){let c=une(a,l),h=a.parent;for(let u of c)i.addCommand(new lF(u,!1)),i.addCommand(new cF(h,u.prev,u)),j4(u,!1),h.remove(u)}else s.replace(a,l),i.addCommand(new mi(s))}getList(t,e,r,i=null){let n=At.getInstance().getListNode(t),s=Mr.getInstance().getStatus(n),a=new Zr,l=a.createList();for(let c of e){if(ud(c)<1e-8)continue;let h=a.createTrack4Pt(c,t,r),u=a.addList(h,l,r),d=s.clone();i!=null&&d.setPushDirect(null,i),d.change(),c.start().equals1(t.start)&&mg(Et(t.primitive,t.start),Et(c,c.start()))&&(d.isSource=s.isSource),Mr.getInstance().setStatus(u,d)}return l}getChangeTracks(t){let e=t.getFirstNode(),r=t.getLastNode();for(;e!=null&&!(this.isChangeNode(e)||(e=e.next,e==r)););for(;r!=null&&!(this.isChangeNode(r)||(r=r.prev,e==r)););let i=e,n=[];for(;i!=null&&(n.push(i.item),i!=r);)i=i.next;return n}isChangeNode(t){let e=Mr.getInstance().getStatus(t);return!e.checkDRC&&(e.isInput||!e.notChange)}};var Bce=class extends wI{constructor(e=300){super();this.hasToggleStyle=!1;this.level="NONE";this.isWire=!1;this.adsorp=!0;this.originListMap=new Map;this.timeout=e}run(e){Ou.getInstance().clear(),oi.getInstance().update();let r=new kce(this.getLists(e),this.adsorp,this.timeout);r.level=this.level,r.shoveMain(),r.command.length>0&&e.command.addCommand(r.command),this.sycnLists(e),this.originListMap=this.getBlockListMap(r.originListMap,e)}getLists(e){let r=[];for(let[i,n]of e.wireMap)i.drawing==0&&n.size()>0&&r.push(n);return r}sycnLists(e){let r=[];for(let[i,n]of e.wireMap)if(i.end.model!=null&&i.drawing==0){let s=!1;n.size()>0&&n.getLast().end.equals1(i.end.point)&&(s=!0),s||(i.end.model=null,n.otherNode.next=null,n.viaNode.next!=null&&n.viaNode.next.isSource&&(n.viaNode.next=null))}return r}getBlockListMap(e,r){if(e&&e.size){this.pointInObstacle=!0,Nh.getInstance().pointInObstacle=!0;let i=new Map;for(let[n,s]of r.wireMap){let a=e.get(s);i.set(n,a)}return i}}};var fq=class{constructor(){this.preview=new Map;this.command=new Lr;this.config=ds.getInstance()}delPreviewList(t,e,r){this.config.wireConfirmType=="previous"&&e.result.wireMap.forEach((i,n)=>{let s=e.result.wireVia.get(n),a={pathList:i,isVia:!1,pathLen:i.size()};if(this.preview.set(n,a),s&&n.via.viaPosition=="currentInflectionPoint"&&(a.isVia=!0),s&&n.via.viaPosition=="currentInflectionPoint"&&t.size()>1){let l=new Zr().createList(),c=t.getLastNode();a.previewModel=[c.item.clone()],l.replace(c,c),s.item.center=t.getLast().end,r.addCommand(new mi(l))}})}showPreviewList(t,e){this.preview.forEach((r,i)=>{let{pathList:n,isVia:s,previewModel:a,pathLen:l}=r;if(s){if(!a||!a[0])return;let c=n.viaNode.next,h=a[0].start,u=a[0].end;if(c.item.center.equals(h)){let d=a[0];r.previewModel=[this.createPreviewList(d)]}else{let d=this.getWireEvent(),p=e.redraw(d,u);r.previewModel=null,p.size()>0&&(r.previewModel=p.getAllItems(),r.previewModel.forEach(m=>{Cr.getInstance().current.setTrackWhite(m.globalIndex)})),this.command.addCommand(d.result.command)}}else if(n.size()-l>1){if(no.fixEndPosition(i.end.point).select)return;let h=n.getLastNode(),u=new Zr().createList(),d=h.item.clone();u.replace(h,h),i.end.model=n.getLast(),t.addCommand(new mi(u)),r.previewModel=[this.createPreviewList(d)]}})}createPreviewList(t){let e=this.command,r=new Zr,i=r.createList(),n;return t instanceof zr?n=r.createTrack(t.layerId,t.start,t.end,t.width,t.showNet,this.command):t instanceof Ii&&(n=r.createArcTrack(t.layerId,t.center,t.radius,t.startAngle,t.endAngle,t.sweep,t.width,t.showNet,this.command)),n.layerId=Pe.getActiveLayerID(),r.addList(n,i,e),Cr.getInstance().current.setTrackVisible(n.globalIndex),Cr.getInstance().current.setTrackWhite(n.globalIndex),n}getWireEvent(){let t=Rn.getInstance().getNext();return Rn.getInstance().current=Rn.getInstance().events.pop(),t}undo(){this.command.undo(),this.command=new Lr}addCommand(t){t.addCommand(this.command),this.command=new Lr}};var Fce=class extends mR{constructor(t){super(),this.layerId=t}doAction(t){return t instanceof Le?t.layerId==12||t.layerId==this.layerId:t instanceof Ge?t.layerId==this.layerId:t instanceof Ue?t.isContains(this.layerId):t.layerId==this.layerId}};var UV=class{};var Vce=class extends UV{isNeedItem(t){if(!(t instanceof He))return!0;let e=!1;return(t.type==="Line"||t.type==="Fill Region"&&!((t==null?void 0:t.getComponent())instanceof Zi))&&(e=!0),e}doAction(t){return t instanceof Ue?!0:!!(this.isNeedItem(t)&&!(t instanceof ke))}};function HV(o,t,e){let r=t,i=e.end().sub(e.start()),n=e.end().sub(o),s=r.cross(i);if(ne.eq(s,0))return ne.eq(n.cross(r),0)&&ne.greater(n.dot(r),0)?o.distance1(e.start())<o.distance2(e.end())?e.start():e.end():null;{let a=n.cross(i)/s,l=n.cross(r)/-s;return ne.greatereq(a,0)&&ne.greatereq(l,0)&&ne.lesseq(l,1)?o.add(t.mul(a)):null}}var dYe=1e-5,Gce=class{constructor(t,e){this.remove=t,this.wire=e}removeLoop(t){if(this.event=t,!this.remove)return;this.autoBackRemove();let{pathLists:e,pathReverse:r}=this.getAllPath(),i=[];e.forEach((n,s)=>{if(n.length>0){let a=this.event.tracks[s];this.calcLoopPaths(n,r[s],a)&&i.push(a)}}),i.length>0&&this.optiomRemoveloopAngle()}getPathNode(t){return At.getInstance().getNode(t)}autoBackRemove(){if(this.wire==="Differential pair wiring"){let t=new _e,e=new _e;if(this.event.tracks.forEach(r=>{let i=r.end.model;((i==null?void 0:i.modelType)==="Pad"||(i==null?void 0:i.modelType)==="Via")&&t.ext1(i.buildBBox()),e.ext2(r.start.point)}),t.valid()&&e.valid()){let r=t.build(),i=e.build();r.isIntersect(i)&&this.event.tracks.forEach(n=>{let s=n.end.model,a=n.start.model;if(a instanceof zr&&((s==null?void 0:s.modelType)==="Pad"||(s==null?void 0:s.modelType)==="Via")){let l=this.event.result.wireMap.get(n);this.calcAutoBackPath(l,a,n)}})}}}calcAutoBackPath(t,e,r){let i=r.end.point,s=r.start.point.sub(i),a=e.direct,l=t.getAllItems(),c=s.dot(a),h=a.normalize(),u=l.indexOf(e);if(c>0){let d=new S(h.y,-h.x);s.dot(d)<0&&(d=new S(-h.y,h.x));for(let p=u;p>=0;p--){let m=l[p];if(m instanceof zr){let g=HV(i,d,m.primitive);if(g){this.optiomBackTrack([m.start,g,i],r,m,this.getPathNode(m),t.getLastNode());return}}}}else if(u>=0)for(let d=l.length-1;d>u;d--){let p=l[d];if(this.isBackTrack(e,p,i)){let g=new Xn().degree45(e.direct,e.start,i);this.optiomBackTrack(g,r,p,this.getPathNode(e),t.getLastNode());return}}}optiomBackTrack(t,e,r,i,n){let s=this.event.result.command,a=this.createListForPoint(t,r);a.replace(i,n,n.parent),s.addCommand(new mi(a)),this.optiomPath(e)}isBackTrack(t,e,r){let i=t.end.sub(t.start),n=e.start.sub(t.start),s=e.end.sub(t.start);return!!(this.checkHotizontal(i,n)||this.checkHotizontal(i,s)||this.checkVectical(t,e.start,r,i)||this.checkVectical(t,e.end,r,i))}checkHotizontal(t,e){let r=t.dot(e),i=t.length();return!!ne.less(r/i,i)}checkVectical(t,e,r,i){let n=r.sub(t.start),s=e.sub(t.start),a=i.cross(n),l=i.cross(s);return a*l<0}createListForPoint(t,e){let r=new Zr,i=this.event.result.command,n=r.createList();for(let s=0;s<t.length-1;s++){let a=t[s],l=t[s+1];if(ne.lesseq(a.distance1(l),0))continue;let c=r.createTrack(e.layerId,a,l,e.width,e.showNet,i);r.addList(c,n,i)}return this.event.result.setInputStatus(n),n}calcLoopPaths(t,e,r){let i=t.pop();if(i==null)return!1;e.pop();let n=i.getAllItems();if(n.length==1&&n[0].start.equals1(n[0].end)||n.length<=0)return!1;let s=this.calcInterMessage(t,i,e);if(this.needRemove(s)){this.replaceLoopVia(s,i,t,e);let a=this.replaceLoopPath(s,t,r,e);return a&&!a.equals1(new S(0,0))&&(r.end.direct=a),!0}}needRemove(t){if(!(t!=null&&t.point))return!1;let{p1:e,p2:r,point:i,reverse:n}=t,s=!0,a=e.parent.getAllItems(),c=r.parent.getAllItems().indexOf(r.item),h=a.indexOf(e.item),u=Et(e.item.primitive),d=Et(r.item.primitive),p=e.parent===r.parent,m=e.item.start.equals(i),g=e.item.end.equals(i),y=r.item.start.equals(i);return n?m&&y&&c==0&&h==0&&!this.inEsp(u,d)&&(s=!1):g&&y&&!this.inEsp(d.mul(-1),u)&&(c==0&&h==a.length-1||p&&c===h+1)&&(s=!1),s}replaceLoopPath(t,e,r,i){let{index:n,p1:s,p2:a,point:l,reverse:c,tracks:h}=t;if(h)return this.changePath(h,s,a,a.parent,e,n,c,i);if(s.item instanceof zr&&a.item instanceof zr){let u=this.replaceSameDirectPath(t,e,r);if(u)return u}return this.replace(s,a,l,r,e,n,c)}sameDirectPreTrack(t,e){let r=new Zr,i=this.event.result.command,n=t.start,s=e.end,a=s.sub(n).normalize(),c=t.direct.dot(a)>=0?t.width:e.width;return r.createTrack(e.layerId,n,s,c,e.showNet,i,e.getGroupID())}replaceSameDirectPath(t,e,r){let{index:i,p1:n,p2:s,point:a,reverse:l}=t,c=this.event.result.command,h=n.parent===s.parent,u=new Zr,d=this.removePathDirect(n,s),p=u.createList(),m=s.item,g=n.item;if(d){let y=this.sameDirectPreTrack(g,m);if(u.addList(y,p,c),this.event.result.setInputStatus(p),h)return p.replace(n,s),c.addCommand(new mi(p)),n.item===r.end.model&&(r.end.model=this.event.result.wireMap.get(r).getLast()),y.direct;{let b=u.createList();this.event.result.setInputStatus(b),l?b.replace(n.parent.getFirstNode(),n):b.replace(n,n.parent.getLastNode()),c.addCommand(new mi(b,l)),this.deleteMiddlePathList(e,i);let P=l?u.createTrack(m.layerId,g.end,m.end,m.width,m.showNet,c,m.getGroupID()):u.createTrack(m.layerId,g.start,m.end,m.width,m.showNet,c,m.getGroupID());return u.addList(P,p,c),this.event.result.setInputStatus(p),p.replace(s.parent.getFirstNode(),s),c.addCommand(new mi(p)),n.item===r.end.model&&(r.end.model=this.event.result.wireMap.get(r).getLast()),P.direct}}}replaceLoopVia(t,e,r,i){let{index:n,p1:s,p2:a}=t,l=this.event.result.command;s.parent!==a.parent&&this.removeVia(n,r,e,i,l)}removeVia(t,e,r,i,n){let s=new Array,a;for(let h=t;h<e.length;h++){let u=e[h],d=i[h],p=u.viaNode,m;h===t&&(a=d?p.prev:p.next),m=d?p.prev:p.next,m&&s.push(m.item)}let l=r.viaNode.prev,c=s.map(h=>h.globalIndex);l&&(c.indexOf(l.item.globalIndex)<0&&(a&&a.item.globalIndex===l.item.globalIndex||s.push(l.item)),r.viaNode.prev=null),s.forEach(h=>{let u=Si.getInstance(),d=u.getNode(h),p=new Ny(h,"delete");n.addCommand(new iF(h,d,"delete")),n.addCommand(p),p.remove(),u.delete(h),u.nodeMap.delete(h)})}calcInterMessage(t,e,r){let i=e.getAllItems();for(let n=0;n<t.length;n++){let s=t[n],a=r[n],l=s.getAllItems();a&&this.reversePaths(l);let c=this.checkIntersection(l,i,n,r);if(c)return c}return this.calcCurrent(e,r)}initPaths(){if(_1.canRemoveLoop===null){let t=_1.firstEvent||this.event,e=t.tracks,r=0;e.forEach((i,n)=>{let s=i.start.model;if((s instanceof Ct||s instanceof et)&&this.wire==="Single wiring"){_1.canRemoveLoop=0;return}let a=t.result.wireMap.get(i);if(a&&a.size()>0){r++;let l=a.otherNode;if(l.prev&&l.prev instanceof Fn){let c;l.prev.size()>0&&(c=l.prev.getLast().end);let h=a.getFirst().start;if(c&&c.equals1(h))return;_1.canRemoveLoop=0;return}}}),_1.canRemoveLoop===null&&r>0&&(_1.canRemoveLoop=1)}}initPathList(t,e,r){let i=this.event.tracks.length;t.forEach(n=>{for(let s=0;s<i;s++){let a=n.tracks[s],l=n.result.wireMap.get(a),c=e[s].indexOf(l);l&&l.size()>0&&c<0&&(e[s].push(l),r[s].push(!1))}});for(let n=0;n<i;n++){let s=this.event.tracks[n],a=this.event.result.wireMap.get(s),l=e[n].indexOf(a);a&&a.size()>0&&l<0&&(e[n].push(a),r[n].push(!1))}}getLoopPath(){let t=[],e=[],r=Rn.getInstance(),i=r.current,n=r.events,s=i.tracks.length;for(let a=0;a<s;a++)t[a]=[],e[a]=[];return this.initPathList(n,t,e),{pathLists:t,pathReverse:e}}allLoopPath(t,e,r,i){let n=t.otherNode.prev,s=t.viaNode.prev,a=n||s,l=!1;for(;a;){let c;if(a instanceof Ct&&(a=Si.getInstance().getNode(a)),a instanceof as){let h=a.item.globalIndex,u=Si.getInstance().getItem(h);u||(new EI(a.item).generateList(),u=a.item);let p=Si.getInstance().getNode(u).connectTrack,m=Array.from(p);if(m=m.filter((y,b)=>{let P=y[0];return!(e[i].indexOf(P)>=0)}),m.length!=1)return;c=m[0][0];let g=m[0][1];l!=g&&(l=!l)}else return;if(e[i].unshift(c),r[i].unshift(l),l){let h=c.otherNode.next,u=c.viaNode.next;a=h||u}else{let h=c.otherNode.prev,u=c.viaNode.prev;a=h||u}}}getAllPath(){this.wire==="Multi-route wiring"&&(_1.canRemoveLoop=1),this.initPaths();let r=Rn.getInstance().current;if(_1.canRemoveLoop===0)return this.getLoopPath();let i=[],n=[];return r.tracks.forEach((s,a)=>{let l=r.result.wireMap.get(s);if(!l)return[];i[a]=[],n[a]=[];let c=!1;i[a].unshift(l),n[a].unshift(c),this.allLoopPath(l,i,n,a)}),{pathLists:i,pathReverse:n}}vertIntersection(t,e,r,i,n){let s=e.end.add(t.mul(n/2)),a=this.interPoint(r,new M(e.end,s));return a&&!jr.inEdge4Polyline(a,i)&&jr.inPolyline(a,i),a}calcCurrent(t,e){let{p2:r}=this.sortCurrentPath(t),i=t.getAllItems();for(let n=r.length-1;n>=0;n--){let s=r[n],a=i.indexOf(s),l=i.slice(0,a),c=this.checkIntersection(l,[s],a,e);if(c)return c}}getRemoveMsg(t,e,r,i,n){let s={index:t,point:e,p1:r,p2:i,reverse:n};return this.needRemove(s)?s:null}removePathDirect(t,e){let r=t.item.direct,i=e.item.direct;return!!this.inEsp(i.mul(-1),r)}replace(t,e,r,i,n,s,a=!1){let l=t.parent===e.parent,c=this.createPrevList(t.item,r,a),h=this.createNextList(e.item,r);if(l?this.replaceCurrent(c,h,t,e):this.replaceLists(c,h,t,e,i,n,s,a),this.wire==="Differential pair wiring"&&Cr.getInstance().current.deleteHight(t.item.globalIndex),t.item===i.end.model){let u=this.event.result.wireMap.get(i);u.size()?i.end.model=u.getLast():i.end.model=null}return Et(e.parent.getLastNode().item.primitive)}replaceCurrent(t,e,r,i){let n=this.event.result.command;V8(t,e),this.event.result.setInputStatus(t),t.replace(r,i),this.event.result.setInputStatus(t),n.addCommand(new mi(t))}replaceLists(t,e,r,i,n,s,a,l){let c=r.parent,h=i.parent,u=this.event.result.command;this.event.result.setInputStatus(t),l?(this.reverseLists(r,t),t.replace(c.getFirstNode(),h.getLastNode())):t.replace(r,r.parent.getLastNode()),u.addCommand(new mi(t,l)),this.event.result.setInputStatus(e),e.replace(h.getFirstNode(),i),u.addCommand(new mi(e,!0)),this.event.result.mergeLists(c,h),this.event.result.wireMap.set(n,c),this.deleteMiddlePathList(s,a)}reverseLists(t,e){let r=new Zr,i=this.event.result.command,n=t.next;for(;n;){let s=n.item;if(s instanceof zr){let a=r.createTrack(s.layerId,s.end,s.start,s.width,s.showNet,i,s.getGroupID());r.addFirst(a,e,i)}else if(s instanceof Ii){let a=s.primitive.reverse(),l=r.createArcTrackByArc(s.layerId,a,s.width,s.showNet,i,s.getGroupID());r.addFirst(l,e,i)}n=n.next}}deleteMiddlePathList(t,e){let r=new Zr,i=this.event.result.command;for(let n=e+1;n<t.length;n++){let s=t[n],a=r.createList();a.replace(s.getFirstNode(),s.getLastNode()),i.addCommand(new mi(a))}}createPrevList(t,e,r=!1){let i=new Zr,n=this.event.result.command,s=i.createList();if(t instanceof zr){let a=r?t.end:t.start;if(!a.equals1(e)){let l=i.createTrack(t.layerId,a,e,t.width,t.showNet,n,t.getGroupID());i.addList(l,s,n)}}else if(t instanceof Ii){let a=r?t.sweep==ae.CCW?ae.CW:ae.CCW:t.sweep,l=r?t.end:t.start,c=q.build4(l,e,t.center,t.radius,t.radius,a);if(!c.end().equals1(c.start())){let h=i.createArcTrackByArc(t.layerId,c,t.width,t.showNet,n,t.getGroupID());i.addList(h,s,n)}}return s}createNextList(t,e){let r=new Zr,i=this.event.result.command,n=r.createList();if(t instanceof zr){if(!t.end.equals1(e)){let s=r.createTrack(t.layerId,e,t.end,t.width,t.showNet,i,t.getGroupID());r.addList(s,n,i)}}else if(t instanceof Ii){let a=t.start.distance1(e)>t.start.distance1(t.end)?t.sweep==ae.CCW?ae.CW:ae.CCW:t.sweep,l=q.build4(e,t.end,t.center,t.radius,t.radius,a),c=Math.abs(l.sweepAngle)%360;if(!l.end().equals1(l.start())&&!ne.eq(c,0)&&!ne.eq(c,360)){let h=r.createArcTrackByArc(t.layerId,l,t.width,t.showNet,i,t.getGroupID());r.addList(h,n,i)}}return n}changePath(t,e,r,i,n,s,a=!1,l){if(t.length<=0)return;let c=new Zr,h=e.item.width,u=e.item.net,d=e.item.layerId,p=e.parent===r.parent,m=this.event.result.command,g=e.parent,y=c.createList();p||(this.removeVia(s,n,i,l,m),a?y.replace(g.getFirstNode(),e):y.replace(e,g.getLastNode()),m.addCommand(new mi(y,a))),this.deleteMiddlePathList(n,s);let b=c.createList();for(let P=0;P<t.length-1;P++){let T=t[P],I=t[P+1];if(T.distance1(I)>1e-8){let C=c.createTrack(d,T,I,h,e.item.showNet,m);c.addList(C,b,m)}h=r.item.width}this.event.result.setInputStatus(b),p?b.replace(e,r):b.replace(r.parent.getFirstNode(),r),m.addCommand(new mi(b,p))}sortCurrentPath(t){let e=Mr.getInstance(),r=t.getAllItems(),i=r.length;for(let a=0;a<r.length;a++){let l=r[a];if(e.getStatus(At.getInstance().getNode(l)).isInput){i=a;break}}let n=r.slice(0,i),s=r.slice(i);return{p1:n,p2:s}}reversePaths(t){t=t.map(e=>this.getModel(e,!0)).reverse()}getModel(t,e=!1){if(t instanceof zr){let r=e?t.end:t.start,i=e?t.start:t.end;return new zr(t.globalIndex,t.layerId,r,i,t.width,!1,t.net)}else if(t instanceof Ii){let r=e?t.sweep==ae.CW?ae.CCW:ae.CW:t.sweep,i=e?t.endAngle:t.startAngle,n=e?t.startAngle:t.endAngle;return new Ii(t.globalIndex,t.layerId,t.center,t.radius,t.width,i,n,r,!1,t.net,1)}}inEsp(t,e){let r=Math.abs(t.x-e.x),i=Math.abs(t.y-e.y);return r<dYe&&i<dYe}getNodes(t){let e=t.getFirstNode(),r=[];for(;e;)r.push(e),e=e.next;return r}optiomPath(t){if(Zt.getInstance().type==="WIRING_CORNER_LINE45"){let e=this.event.result.wireMap.get(t);if(!e)return;let r=new Zr,i=this.event.result.command,n=r.createList(),{startNode:s,endNode:a,points:l}=this.getOptiomPoint(e,t);if(s&&a){let c=s.item.width;for(let h=0;h<l.length-1;h++){let u=l[h],d=l[h+1];if(u.distance1(d)>1e-8){let p=r.createTrack(t.layerId,u,d,c,t.net,i);r.addList(p,n,i)}c=t.width}this.event.result.setInputStatus(n),n.replace(s,a),i.addCommand(new mi(n))}}}optiomRemoveloopAngle(){this.event.tracks.forEach(t=>{this.optiomPath(t)})}reverseTracks(t,e,r){let i=Math.abs(t.length*r),n=Math.abs(e.length*r),s=n<i,a=e.primitive,l=t.primitive;if(s){let u=new M(l.end(),l.start());l=new M(a.end(),a.start()),a=u,[i,n]=[n,i]}let c=a.direct,h=l.direct;return{height:i,height2:n,line1:a,line2:l,reverse:s,dir1:c,dir2:h}}optVerticalAngle(t,e,r,i,n){let s=i.direct,a=r.direct,l=r.length,c=i.length,h=Math.min(n*(Math.sqrt(2)/2),l,c),u=i.end.add(s.mul(-h)),d=r.start.add(a.mul(h));return{startNode:t,endNode:e,points:[i.start,u,d,r.end]}}optAcuteAngleStyle1(t,e,r,i,n,s){let{height:a,height2:l,line1:c,line2:h,reverse:u,dir1:d,dir2:p}=this.reverseTracks(r,i,n);if(a-s<=1e-8&&l-s<=1e-8){let b=new Xn;return{startNode:t,endNode:e,points:this.reversePoints(!1,b.degree45(c.direct,c.start(),h.end()))}}let m=new M(h.end(),h.end().add(new S(-d.y,d.x))),g=c2(c.start(),c.end(),m.start(),m.end());if(g==null)return;let y=g.add(d.mul(-a));return{startNode:t,endNode:e,points:this.reversePoints(u,[c.start(),y,h.end()])}}optAcuteAngleStyle2(t,e,r,i,n,s){let{height:a,height2:l,line1:c,line2:h,reverse:u,dir1:d,dir2:p}=this.reverseTracks(r,i,n),m=h.end(),g=new M(m,m.add(new S(-d.y,d.x))),y=c2(c.start(),c.end(),g.start(),g.end());if(y==null)return;let b=m.sub(y).normalize(),P=y.add(d.mul(-s));if(c.start().sub(P).normalize().dot(d)>0)return{};let I=y.add(b.mul(s));return{startNode:t,endNode:e,points:this.reversePoints(u,[c.start(),P,I,m])}}optAcuteAngleStyle3(t,e,r,i,n,s,a){let l=i.direct,c=r.direct,h=r.end,u=Math.abs((s+a)/n),d=r.start.add(c.mul(u)),p=new M(d,d.add(new S(-l.y,l.x))),m=c2(i.start,i.end,p.start(),p.end());if(m==null)return;let g=d.sub(m).normalize(),y=m.add(l.mul(-s)),b=m.add(g.mul(s));return{startNode:t,endNode:e,points:this.reversePoints(!1,[i.start,y,b,d,h])}}getOptiomPoint(t,e){let r=this.getNodes(t),i=e.width;for(let n=r.length-1;n>0;n--){let s=r[n-1],a=r[n],l=s.item,c=a.item,h=Mr.getInstance().getStatus(s),u=Mr.getInstance().getStatus(a);if(h.isInput&&u.isInput&&l instanceof zr&&c instanceof zr){let d=l.direct,p=c.direct,m=d.dot(p);if(m>1e-8)continue;if(Math.abs(m)<=1e-8){let g=c.length,y=l.length,b=Math.min(i*(Math.sqrt(2)/2),g,y),P=l.end.add(d.mul(-b)),T=c.start.add(p.mul(b));return{startNode:s,endNode:a,points:[l.start,P,T,c.end]}}if(m<0){let g=i*(Math.sqrt(2)/2),y=Math.abs(c.length*m),b=Math.abs(l.length*m);if(y<=g||b<=g){let{height:P,height2:T,line1:I,line2:C,reverse:E,dir1:O,dir2:_}=this.reverseTracks(c,l,m);if(P-g<=1e-8&&T-g<=1e-8){let w=new Xn;return{startNode:s,endNode:a,points:this.reversePoints(!1,w.degree45(I.direct,I.start(),C.end()))}}let x=new M(C.end(),C.end().add(new S(-O.y,O.x))),D=c2(I.start(),I.end(),x.start(),x.end()).add(O.mul(-P));return{startNode:s,endNode:a,points:this.reversePoints(E,[I.start(),D,C.end()])}}else if(y<=g+i||b<=g+i){let{height:P,height2:T,line1:I,line2:C,reverse:E,dir1:O,dir2:_}=this.reverseTracks(c,l,m),x=C.end(),v=new M(x,x.add(new S(-O.y,O.x))),D=c2(I.start(),I.end(),v.start(),v.end()),w=x.sub(D).normalize(),F=D.add(O.mul(-g));if(I.start().sub(F).normalize().dot(O)>0)break;let z=D.add(w.mul(g));return{startNode:s,endNode:a,points:this.reversePoints(E,[I.start(),F,z,x])}}else{let P=c.end,T=Math.abs((g+i)/m),I=c.start.add(p.mul(T)),C=new M(I,I.add(new S(-d.y,d.x))),E=c2(l.start,l.end,C.start(),C.end()),O=I.sub(E).normalize(),_=E.add(d.mul(-g)),x=E.add(O.mul(g));return{startNode:s,endNode:a,points:this.reversePoints(!1,[l.start,_,x,I,P])}}}}}return{}}reversePoints(t,e){return t?e.reverse():e}isPolylineInter(t,e){let r=t.getMathGraphics(),i=e.getMathGraphics();if(r&&i){if(vk(r,i))return!0;let s=Dv(t.start,i)||Dv(t.end,i),a=Dv(e.start,r)||Dv(e.end,r);return s||a}return!1}checkIntersection(t,e,r,i){let n=i[r];for(let s=e.length-1;s>=0;s--)for(let a=0;a<t.length;a++){let l=t[a],c=e[s],h=l.getMathGraphics(),u=c.getMathGraphics(),d=this.isPolylineInter(l,c);if(c.layerId!==l.layerId||!d)continue;let p=this.getPathNode(l),m=this.getPathNode(c),g;p.parent==m.parent&&(p.next==m?g=l.end:p.prev==m&&(g=l.start));let y=this.interPoint(l.primitive,c.primitive,g),b=this.getRemoveMsg(r,y,p,m,n);if(b)return b;if(!y)if(l instanceof zr&&c instanceof zr){let P=l.direct,T=c.direct;if(ne.eq(P.cross(T),0)){let I=this.horizontalInterPoints(l,c);if(I.length>0)return{index:r,point:I[0],p1:p,p2:m,reverse:n,tracks:I}}else{let I=this.getExtendsInter(l,c,r,g,n),C=this.getExtendsInter(l,c,r,g,n,!1);if(I||C)return I||C}}else{let P=Et(c.primitive),T=c.width/Math.cos(Math.PI/4),I=c.end.add(P.mul(T)),C=c.end,E=this.interPoint(l.primitive,new M(C,I),g);if(E&&!jr.inEdge4Polyline(E,u)&&jr.inPolyline(E,u)){let O=this.getRemoveMsg(r,E,p,m,n);if(O)return O}else{let O=new S(P.y,-P.x),_=new S(-P.y,P.x),x=this.vertIntersection(O,c,l.primitive,u,T),v=this.vertIntersection(_,c,l.primitive,u,T),D=this.getRemoveMsg(r,x,p,m,n),w=this.getRemoveMsg(r,v,p,m,n);if(D||w)return D||w}}}return null}getExtendsInter(t,e,r,i,n=!1,s=!0){let a=t.direct,l=e.direct.mul(s?1:-1),c=this.getPathNode(t),h=this.getPathNode(e),u=s?e.start:e.end,d=s?e.end:e.start,p=Math.abs(l.dot(a)),m=p==0?t.width*2:t.width*2/p,g=d.add(l.mul(m)),y=this.interPoint(new M(t.start,t.end),new M(u,g),i);return this.getRemoveMsg(r,y,c,h,n)}interPoint(t,e,r){let i=Pt(t,e),n=null;for(let s=0;s<i;s+=2){let a=new S(Ee[s],Ee[s+1]);r&&a.equals1(r)||(n=a)}return n}horizontalInterPoints(t,e){let r=[],i=t.start,n=e.end,{pointPre:s,pointNext:a}=this.getHorizontalPoints(t,e);return s&&a?r=[s,a]:s?r=[i,s,n]:a&&(r=[i,a,n]),r}getHorizontalPoints(t,e){let r=t.direct,i=t.start,n=t.end,s=e.start,a=e.end,l=new S(r.y,-r.x),c=HV(a,l,new M(i,n)),h=HV(a,l.mul(-1),new M(i,n)),u=c||h,d=null;if(!u){let p=HV(i,l,new M(s,a)),m=HV(i,l.mul(-1),new M(s,a));d=p||m}return{pointPre:u,pointNext:d}}};var ZA=class ZA extends Oo{constructor(e,r){super();this.command=new Lr;this.changeCommand=new De("wire");this.templateNetCommand=new De("change net");this.startConnect=new wce;this.partitionEdgeNets=new Set;this.previewTool=new fq;this.originViaSize=new Map;this.oldMode=r,this.wire=r,this.event=e,this.wiretool=new Ace,this.config=ds.getInstance(r),this.silkLayerTrans(),this.initNearNode(),this.wirePanelInstance=Ys.getInstance(),this.placeViaByDiff(),Nl.getInstance().init(),ps.getInstance().clear()}silkLayerTrans(){Pe.getGrayIndex()==0&&[Pe.getTopSilkLayer(),Pe.getBottomSilkLayer()].forEach(i=>{i.setTransparency(1-(1-i.transparency)*.5,!0)})}initNearNode(){this.nearNodes&&this.clearRatline(),this.nearNodes={};let r=(Rn.getInstance().events[0]||Rn.getInstance().current).tracks,i=new Set;if(r.forEach(n=>{let s=n.net;if(s&&n.start.model){let a=this.nearNodes[s];a||(a=this.nearNodes[s]={startModels:new Set,nearNode:new VV(s)},i.add(s));let l=n.start.model.globalIndex;l&&a.startModels.add(l)}}),this.wire=="Single wiring"){i=new Set;let n=Rn.getInstance().current.node.net;n&&i.add(n)}VV.hightRatlineNets(i),i.forEach(n=>{let s=this.nearNodes[n];s?s.nearNode.setStartItems(s.startModels):(this.partitionEdgeNets.add(n),Ye.highlightNet(n))})}publishViolateDRCMsg(){Nh.getInstance().pointInObstacle&&A.publish("ui/toastMsg",{type:"warn",msg:"Track DRC violation detected,track could not be generated,please check the white DRC border"},Q())}samePositionClickLock(){let e=()=>{let r=!1;for(let[i,n]of this.event.result.wireMap)i.drawing==0&&n.size()==0&&(r=!0);return r?(this.publishViolateDRCMsg(),!0):!1};if(this.wire=="Single wiring"){let r=this.event.node,i=fi.getInstance(),n,s=new S(i.sceneX,i.sceneY);if(i.adsorb)s=no.fixEndPosition(s,!1).point;else return!1;let a=this.event.result.wireVia.get(r);if(a&&r.via.viaPosition==="lastInflectionPoint"?n=a.item:n=r.start.model,n instanceof et&&le.adsorptionConfig.isNeedPadObj()||n instanceof Ct&&le.adsorptionConfig.isNeedViaObj()){if(n.inOutline(s))return n}else if(n instanceof gt&&!(a&&a.item.inOutline(r.end.point)))return n.end.equals1(r.end.point)}return e()}isInVia(){let e=[],r;for(let s of this.event.tracks){let a,l=this.event.result.wireVia.get(s);l&&this.event.node.via.viaPosition==="lastInflectionPoint"?a=l.item:a=s.start.model,s===this.event.node&&(r=a),e.push(a)}let i=this.event.position||this.event.node.start.point;return e.some(s=>{if((s instanceof Ct||s instanceof et)&&s.inOutline(i))return s})?r:!1}clearAlignMapCache(){let e=["Differential pair wiring","Multi-route wiring"].includes(this.wire);e&&this.lastMode=="Single wiring"&&this.event.tracks.forEach(i=>{i.alignMap.size>0&&i.alignMap.clear()}),e&&this.event.tracks.forEach(i=>{i.startAlignMap.size>0&&i.startAlignMap.clear()})}onMouseLeftDown(e){let r=new S(e.sceneX,e.sceneY);if(this.reDraw(r),this.samePositionClickLock()){this.publishViolateDRCMsg();return}let i=this.viewTrackUpdate(),n=Rn.getInstance();Cr.getInstance().current.clearPreview(),Cr.getInstance().current.unHightAll();let s=Mi.getInstance().view4Status(Cr.getInstance().current);this.event.result.command.addCommand(s),this.command.addCommand(this.event.result.command),this.wireModeCommand&&(this.wireModeCommand=null),Jf.getInstance().executeCommand(this.command),this.command=new Lr;let a=this.event.gaps,l=["Differential pair wiring","Multi-route wiring"].includes(this.lastMode)&&this.wire=="Single wiring";n.events.length==0&&l&&n.current.tracks.forEach(u=>{u!==n.current.node&&(u.end=u.start.clone())});let c=!1;this.event.node.isReverse&&(c=!0),this.event.saveWirePanelInfo(this.wire);let h=this.event.node.layerId;if(this.event=n.getNext(),this.updateByRule(this.event,h),c&&VCe(this.event.tracks,!1),this.clearAlignMapCache(),Cr.getInstance().getNext(),this.previewTool.addCommand(this.event.result.command),Mi.getInstance().restoreTrackColor(i),this.handleNetCommand(),Nh.getInstance().needRedraw2ShowObstaclePl){let{sceneX:u,sceneY:d}=fi.getInstance();this.reDraw(new S(u,d))}this.initSketcherAttrPanel(this.wire)}viewTrackUpdate(){let e=Cr.getInstance().current,r=[].concat(Rn.getInstance().events,[Rn.getInstance().current]),i=new Set,n=new Set,s=new Set;r.forEach(a=>{a.result.wireMap.forEach(l=>{l.size()>0&&l.getAllItems().forEach(c=>{n.add(c.globalIndex)})}),a.result.wireVia.forEach(l=>{l.item&&n.add(l.item.globalIndex)})});for(let[a,l]of e.trackStatus)!l||n.has(a)||i.add(a);for(let[a,l]of e.viaStatus)!l||n.has(a)||s.add(a);return{updateTracks:i,updateVias:s}}handleNetCommand(){this.templateNetCommand.commands.forEach(e=>{this.changeCommand.addCommand(e)}),this.templateNetCommand=new De("change net")}toggleRouteMode(e){if(this.wireModeCommand!=null)this.wireModeCommand.undo(),this.wireModeCommand=null;else{this.wireModeCommand=new Lce(this.wire,e);let r=this.wire=="Single wiring"?this.oldMode=="Single wiring"?"Differential pair wiring":this.oldMode:"Single wiring";e.modifyWireMode(r)}}onMouseMove(e){if(Gr.pause){Gr.play4Next();return}let r=new S(e.sceneX,e.sceneY);this.reDraw(r)}reDraw(e){Gr.replay?e=Gr.position||e:Gr.position=e,AVe.clear(),wt.filter=null,pa.getInstance().clear(),Mr.getInstance().clear(),this.clearViaCache(),Nh.getInstance().pointInObstacle=!1,this.event.result.command.undo(),this.templateNetCommand.undo(),this.previewTool.undo(),this.previewTool=new fq,this.templateNetCommand=new De("change net"),Cr.getInstance().current.unHightAll(),Mi.getInstance().view4Status(Cr.getInstance().current);let r=this.viewTrackUpdate();switch(this.event.result.command=new Lr,this.event.position=e,dj(Zt.getInstance().type),this.event.resetInfo(),Gr.init(),this.event.nextEvent=null,fs.getInstance().clear(),HS.getInstance().clear(),this.restorePathListEndPoint(),this.pathComplete(),this.wire){case"Single wiring":{let a=this.event.node,l=this.event.result.wireVia.get(a);this.event.result.wireMap.delete(a);let c;a.via.viaPosition==="lastInflectionPoint"&&l!=null?c=this.event.result.creataList(a):c=this.event.result.initList(a),this.changeNet(this.event,e);let h=this.wiretool.redraw(this.event,e);this.previewTool.delPreviewList(h,this.event,this.event.result.command),this.event.node.end.point=e;let d=new w3().runSingle(this.event,h);if(d&&(d.replace(h.getFirstNode(),h.getLastNode()),this.event.result.command.addCommand(new mi(d))),ZA.firstEvent===null&&(ZA.firstEvent=this.event),this.event.result.setInputStatus(h),c.size()>0){let p=this.event.node,m=c.getLast(),g=p.start.model;m!==g&&(c=new Zr().createList(),this.event.result.wireMap.set(p,c))}if(this.event.result.mergeLists(c,h),l!=null)if(a.via.viaPosition==="lastInflectionPoint"){this.event.result.initViaNode(a),c.viaNode.prev=l;let p=!0;l.addConnectTrack(c,p),this.event.result.command.addCommand(new aT(l,c,p,!0))}else{c.viaNode.next=l;let p=!1;l.addConnectTrack(c,p),this.event.result.command.addCommand(new aT(l,c,p,!0))}break}case"Differential pair wiring":{let a=this.event.node.start.model;if(a!=null&&(a.modelType=="Pad"||a.modelType=="Via")&&a.inShape(e.x,e.y))return}case"Multi-route wiring":{this.fixFanoutDirect(this.event,e);let a=new Dce(this.event,e),l=a.getEndPoint_v1();this.event.isCanEndWire=l,a.hightEnd();let c;l||this.wiretool.fixEnd(this.event,e),c=this.wiretool.getCornerEvent(this.event,l),$A.getInstance().setStatus(l,this);let h=this.wiretool.redrawMulti3(c,this.event,l),u=0;for(let[,g]of h.map){let y=this.event.tracks[u],b=this.event.result.wireVia.get(y);b!=null&&(g.viaNode.next=b),u++}let d=null,p=new w3,m=this.getList(h.map);if(this.wire==="Differential pair wiring"){let g=[];if(m.forEach((y,b)=>{y.size()>0&&g.push({path:y,index:b})}),g.length==2)d=p.run(this.event,m);else if(g.length==1){let y=p.runSingle(this.event,g[0].path),b=new Array(2);y&&(b[g[0].index]=y,b[g[0].index===0?1:0]=m[g[0].index===0?1:0],d={result:b,command:null})}}else d=p.run(this.event,m);if(d!=null){h.command.undo();let g=this.event.tracks.length;for(let y=0;y<g;y++){let b=this.event.result.initList(this.event.tracks[y]);if(this.event.result.setInputStatus(d.result[y]),b.size()>0){let P=this.event.tracks[y],T=b.getLast(),I=P.start.model;T!==I&&(b=new Zr().createList(),this.event.result.wireMap.set(P,b))}this.event.result.mergeLists(b,d.result[y])}}else{let g=new x3,y=h.map,b=h.event;for(let I=0;I<b.tracks.length;I++){let C=b.tracks[I],E=y.get(C);g.optimization(E,C,h.command)}this.event.result.command.addCommand(h.command);let P=this.getList(h.map),T=this.event.tracks.length;for(let I=0;I<T;I++){let C=this.event.result.initList(this.event.tracks[I]);if(this.event.result.setInputStatus(P[I]),C.size()>0){let E=this.event.tracks[I],O=C.getLast(),_=E.start.model;O!==_&&(C=new Zr().createList(),this.event.result.wireMap.set(E,C))}this.event.result.mergeLists(C,P[I])}}if($A.getInstance().checkEndWireSpace(h.event),$A.getInstance().redraw){let g=Mi.getInstance().view4Status(Cr.getInstance().current);this.event.result.command.addCommand(g),this.reDraw(e);return}for(let g of this.event.tracks){let y=this.event.result.wireMap.get(g),b=this.event.result.wireVia.get(g);if(y.size()>=0&&b){y.viaNode.next=b;let P=!1;b.addConnectTrack(y,P),this.event.result.command.addCommand(new aT(b,y,P,!0))}}break}}for(let a of this.event.tracks){let l=this.event.result.wireMap.get(a);if(!l)continue;this.event.result.bind4Info(a);let c=this.event.result.wireVia.get(a);if(l.size()>=0&&c&&a.via.viaPosition!=="lastInflectionPoint"){let h=l.size()===0?a.start.point:GV.getViaPos(l);c.item.center=h}}this.constraintModifyViaSize(),new dq().optimization(this.event.result);let i=Zt.getInstance().mode,n=new Gce(this.wirePanelInstance.removeLoop,this.wire);switch(n.removeLoop(this.event),i){case"WIRING_MODE_IGNORE":{let a=new Mce;this.event.result.direct=this.event.node.direct;try{a.run(this.event.result)}catch(l){throw new Error(l)}break}case"WIRING_MODE_OBSTRUCT":{let a=new Bce;this.sycnMode(a);try{if(a.run(this.event.result),Nh.getInstance().originListMap=a.originListMap,this.event.result.wireVia.size>0){let l=new By;this.sycnMode(l);try{l.run(this.event.result),this.event.publish||l.publish(),this.event.publish=l.pointInObstacle}catch(c){throw new Error(c)}break}n.removeLoop(this.event),this.event.publish=a.pointInObstacle}catch(l){throw new Error(l)}break}case"WIRING_MODE_SURROUND":{let a=new By;this.sycnMode(a);try{a.run(this.event.result),n.removeLoop(this.event),this.event.publish||a.publish(),this.event.publish=a.pointInObstacle}catch(l){throw new Error(l)}break}case"WIRING_MODE_PUSHAWAY":case"WIRING_MODE_SURROUND_AND_PUSHAWAY":{let a=new km(i=="WIRING_MODE_SURROUND_AND_PUSHAWAY");switch(this.sycnMode(a),this.wirePanelInstance.pushVia){case"OPTIMIZA_OPEN":{a.canPushViaLevel=2;break}case"OPTIMIZA_NONE":{a.canPushViaLevel=0;break}}switch(this.wirePanelInstance.pathOptimization4BePushed){case 1:{a.level="SUPER";break}case 0:{a.level="STRONG";break}case 2:{a.level="WEAK";break}}try{a.run(this.event.result),this.event.publish||a.publish(),this.event.publish=a.pointInObstacle}catch(l){throw new Error(l)}break}}$A.getInstance().optimization(),new dq().optimization(this.event.result);for(let[a,l]of this.event.result.wireMap)l.size()>0&&(l.viaNode.next!=null?(a.end.model=a.end.model==null?l.viaNode.next.item:a.end.model,a.end.point=l.viaNode.next.item.center):(a.end.model=a.end.model==null?l.getLast():a.end.model,a.end.point=l.getLast().end));this.wire!=="Single wiring"&&(HS.getInstance().refresh(this.event.node),this.updateEndDirect(this.event)),this.realRatline(),this.setPreTrackView(),this.previewTool.showPreviewList(this.event.result.command,this.wiretool),Nh.getInstance().realTimeCheckRule(this.wire=="Single wiring");let s=Mi.getInstance().view4Status(Cr.getInstance().current);Mi.getInstance().restoreTrackColor(r),this.event.result.command.addCommand(s),oi.getInstance().update(),Jd.updateNetLengthMsg(this.event,this.wire),R0.getInstance().hight()}updateEndDirect(e){let r=e.node.start.direct,i,n=!0;for(let s of e.tracks)if(s.end.model instanceof gt){let a=Et(s.end.model.primitive);if(!a.equals1(s.end.direct))i==null?i=a:i.equals1(a)||(n=!1);else{i=s.end.direct,n=!0;break}}if(n||(i=e.node.start.direct),i)for(let s of e.tracks)s.end.direct=i}clearViaCache(){for(let[e,r]of this.event.result.wireVia)ps.getInstance().remove(r.item);ps.getInstance().fanoutCenter=null}sycnMode(e){if(Nh.getInstance().recordEndPoints(this.event,this.wire=="Single wiring"),this.event.result.direct=this.event.node.direct,e.isWire=!0,e instanceof km)switch(this.wirePanelInstance.currentPathOptimization4BePushed){case"OPTIMIZA_STRONG":{e.inputLevel="SUPER";break}case"OPTIMIZA_WEAK":{e.inputLevel="STRONG";break}case"OPTIMIZA_NONE":{e.inputLevel="WEAK";break}default:{e.inputLevel="NONE";break}}else switch(this.wirePanelInstance.currentPathOptimization4BePushed){case"OPTIMIZA_STRONG":{e.level="SUPER";break}case"OPTIMIZA_WEAK":{e.level="STRONG";break}case"OPTIMIZA_NONE":{e.level="WEAK";break}default:{e.level="NONE";break}}}restorePathListEndPoint(){let e=this.event.result.wireMap;for(let[r,i]of e){let n=i.otherNode.next,s=r.end.point;n instanceof et&&n.inShape(s.x,s.y)||(i.otherNode.next=null)}}handlePartitionBlock(e,r){let i,n=r.getAllItems(),s=Mi.getInstance().getMap;if(s.size){let d=Array.from(s.keys());n=n.filter(p=>!d.includes(p.globalIndex))}if(!n.length)return i;let a,l=new _e;for(let d of n)l.ext1(d.bbox);l.valid()&&(a=l.build());let c=wt.search1(a),h=[],u=this.event.node.start.point;for(let d of n){let p=d.primitive;for(let m of c.profiles)if(m.type=="Partition"&&m.component.isPartitionSplitOut()){let b=m.getMathGraphics().primitives;for(let P of b){let T=Pt(P,p);if(T>0){let I=Eu.foot(new M(P.start(),P.end()),e),C=Om(T,[]);Er(C,(E,O)=>E.distance2(u)-O.distance2(u)),h.push({inter:C,foot:I})}}}}if(h.length){if(Er(h,(m,g)=>m.inter[0].distance2(u)-g.inter[0].distance2(u)),u.equals1(h[0].inter[0])){if(Mt.checkIsInCanEdit(n.map(m=>m.primitive),void 0,"track"))return i;if(Mt.isChildPcb()){let m=h[h.length-1].foot;if(Mt.checkIsCanEditByPoint(m))return m}else{let m=h[0].foot;if(Mt.checkIsCanEditByPoint(m))return m}}let d=h[0].inter[0],p=h[h.length-1].inter[h[h.length-1].inter.length-1];i=Mt.isChildPcb()?p:d}return i}setPreTrackView(){let e=this.event;if(e!=null){let r=e.result.wireMap,i=e.result.wireVia;e.tracks.forEach(n=>{let s=r.get(n),a=i.get(n);s&&s.getAllItems().forEach(c=>{Cr.getInstance().current.setTrackPreview(c.globalIndex)}),a&&Cr.getInstance().current.setViaPreview(a.item.globalIndex)})}}viaRunModeWhenRestoreInit(e){if(e.size>0){let r=[];for(let[,i]of e)i.isSource=!1,r.push(i);switch(Zt.getInstance().mode){case"WIRING_MODE_PUSHAWAY":let i=new km(!1);switch(this.sycnMode(i),this.wirePanelInstance.pushVia){case"OPTIMIZA_OPEN":{i.canPushViaLevel=2;break}case"OPTIMIZA_NONE":{i.canPushViaLevel=0;break}}switch(this.wirePanelInstance.pathOptimization4BePushed){case 1:{i.level="SUPER";break}case 0:{i.level="STRONG";break}case 2:{i.level="WEAK";break}}try{i.run1(r,this.event.result.command,this.event.node.direct),this.event.publish||i.publish(),this.event.publish=i.pointInObstacle}catch(n){throw new Error(n)}break}}}restoreCurrentInitState(e){if(pa.getInstance().clear(),Mr.getInstance().clear(),this.clearViaCache(),Nh.getInstance().pointInObstacle=!1,this.event.result.command.undo(),this.templateNetCommand.undo(),this.previewTool.undo(),this.templateNetCommand=new De("change net"),this.event.node.via.viaPosition!=="lastInflectionPoint")this.command.undo();else{let i=this.event.result.wireVia;this.event.result.command=new Lr;let n=this.event.node;this.event.result.wireVia.get(n)!=null&&this.event.result.initViaNode(n),this.viaRunModeWhenRestoreInit(i);let a=Mi.getInstance().view4Status(Cr.getInstance().current);a.length>0&&this.event.result.command.addCommand(a),this.event.result.command.length>0&&this.command.addCommand(this.event.result.command),this.command.length>0&&Jf.getInstance().executeCommand(this.command)}this.command=new Lr,this.event.result.command=new Lr;let r=this.viewTrackUpdate();Mi.getInstance().view4Status(Cr.getInstance().current),Mi.getInstance().restoreTrackColor(r),this.event=Rn.getInstance().restoreCurrentInitState(Rn.getInstance().getLastEvent()),this.lastMode=e,Nh.getInstance().clear()}complete(){this.previewTool.undo(),Mi.getInstance().view4Status(Cr.getInstance().current)}realRatline(){if(Object.keys(this.nearNodes).length==0)return;let e={},r=this.event,i=r.tracks;this.wire=="Single wiring"&&(i=[r.node]),i.forEach(n=>{if(n.drawing!=1&&n.net){e[n.net]||(e[n.net]=[]);let s=r.result.wireMap.get(n);if(s!=null&&s.size()){let a=s.getLast().end;e[n.net].push(a)}else e[n.net].push(n.start.point)}});for(let n in e){let s=this.nearNodes[n],a=e[n]||[];s.nearNode.generateRatline(a,n)}}getList(e){let r=new Array;for(let[,i]of e)r.push(i);return r}changeNet(e,r){if(e.node.allowModifyNet){let i=this.isTouch(r,e.node.layerId),n=i&&Ao(i)||"";if(e.node.net=n,n=="")return;let s=Array.from(Rn.getInstance().events).reverse(),a=e.node.start.model,l=e.result.wireVia.get(e.node),c=e.result.command;if(l!=null&&l.item){let d=l==null?void 0:l.item;c.addCommand(new Ny(d,"modify")),d.net=n,Cr.getInstance().current.setViaVisible(d.globalIndex)}let h=Ml.getInstance(),u=new Set;if(s.forEach(d=>{var p;for(let m of d.tracks)if(((p=m.end.model)==null?void 0:p.globalIndex)==(a==null?void 0:a.globalIndex)){a=m.start.model;let g=d.result.wireVia.get(m);if(g!=null&&g.item){let P=g==null?void 0:g.item;c.addCommand(new Ny(P,"modify")),P.net=n,Cr.getInstance().current.setViaVisible(P.globalIndex)}let y=d.result.wireMap.get(m);if(u.has(y))continue;u.add(y),y.toArray().forEach(P=>{let T=h.getItem(P.globalIndex);c.addCommand(new yA(T,"modify")),T.net=n,Cr.getInstance().current.setTrackUpdate(P.globalIndex)});break}}),a){let d=this.startConnect.getStartConnect(a),p;d||(d=this.startConnect.setStartConnect(a),p=d.map(m=>new Jt().getItem(m))),p||(p=d.map(m=>new Jt().getItem(m))),p.forEach(m=>{this.templateNetCommand.addCommand(Ce.dispatch(m,"modify"))}),p.forEach(m=>{m.net=n})}}else{let i=this.isTouch(r,e.node.layerId);if((i instanceof Ge||i instanceof Le||i instanceof Ue)&&(i&&Ao(i)||"")==""&&e.node.net&&no.canModifyNet(i)){let a=mre(i);a.add(i),a.forEach(l=>{this.templateNetCommand.addCommand(Ce.dispatch(l,"modify")),l.net=e.node.net})}}}isTouch(e,r){let i=s=>{if(!(s instanceof He))return!0;let a=!1;return(s instanceof rr||s instanceof Pr||s instanceof lt)&&(s.type==="Line"||s.type==="Fill Region"&&!((s==null?void 0:s.component)instanceof Zi))&&(a=!0),a},n=kt.search(new ht(e.x,e.x,e.y,e.y));return n.setFilter(new Mp(e.x,e.y)).setFilter(new ed).setFilter(new Fce(r)),n.setOnceAction(new Vce),n.once(["Via","Track","ArcTrack","Pad","Polygon","Rect","Circle"])}fixFanoutDirect(e,r){if(e.node.start.allowModifyDirect){let i=r.sub(e.node.start.point).normalize();if(e.node.start.direct.dot(i)<0){let s=e.node.start.direct.mul(-1);for(let a of e.tracks)a.start.direct=s;e.reverse()}}else for(let i of e.tracks)i.start.allowModifyDirect&&(i.start.direct=e.node.start.direct)}backspace(){var s;if(this.event.tracks.some(a=>this.event.result.wireVia.get(a))){this.placeVia();return}let r=Rn.getInstance().current;this.event.result.command.undo(),this.command.undo(),this.command=new Lr,this.event=Rn.getInstance().undo();let i=!1;this.event||(r.gaps.forEach(a=>{a.width=a.preWidth}),this.event=Rn.getInstance().current=r.clone(),i=!0),this.backspaceVia(this.event),Cr.getInstance().undo(),Jf.getInstance().undo(),this.event.result.command=new Lr,Pe.setActiveLayerId(this.event.node.layerId),i&&R0.getInstance().backspace(this.wire=="Single wiring",this.event.position)&&this.backspaceVia(this.event),this.event.wirePanelInfo&&((s=this.event.wirePanelInfo)==null||s.resetWirePanelData(),this.wire=this.event.wirePanelInfo.wireMode,this.config.wireMode=this.wire),this.initNearNode(),this.placeViaByDiff(),this.wireModeCommand&&this.toggleRouteMode(null);let n=fi.getInstance();this.event.position=new S(n.sceneX,n.sceneY),this.event.position!=null&&this.reDraw(this.event.position)}backspaceVia(e){let r=this.command;e.tracks.forEach(i=>{if(i.via.viaPosition=="currentInflectionPoint")e.result.wireVia.delete(i);else{let s=e.result.wireVia.get(i);if(s){let a=new IS,l=a.cloneVia(s.item,r),c=a.createNode(l,r);c.isSource=s.isSource,e.result.wireVia.set(i,c)}}})}toggleFanOutMode(){}placeViaByDiff(){if(this.wire=="Differential pair wiring"){let e=this.event.node.layerId,r=!0,i=this.event.node;for(let n of this.event.tracks)if(n.layerId!=e){r=!1,i=n;break}if(!r){let n=this.command,{radius:s,inner:a}=i.via,l=new IS,c=l.addVia(i.start.point,s,a,i.net,n),h=l.createNode(c,n);h.isSource=!1,this.event.result.wireVia.set(i,h),i.via.viaPosition=this.config.viaPosition,i.end.signalLayers=new Set(no.getSignalLayerIds(c,i.end.layerId))}}}placeVia(e=!0){if(!e&&this.isInVia())return;let r=this.event.node.layerId;switch(this.wire){case"Single wiring":{let i=this.event.tracks.indexOf(this.event.node),n=this.placeViaHandle(this.event,i);n!=null&&Pe.setActiveLayerId(n);break}case"Multi-route wiring":case"Differential pair wiring":{let i;this.event.tracks.forEach((n,s)=>{if(n.drawing==1)return;let a=this.placeViaHandle(this.event,s);this.event.tracks[s]==this.event.node&&(i=a)}),i!=null&&Pe.setActiveLayerId(i);break}}if(this.updateByRule(this.event,r),this.initSketcherAttrPanel(this.wire),this.event.position!=null)this.reDraw(this.event.position);else{let i=this.event.node.start.point;this.reDraw(i)}Nh.getInstance().checkViaDRC({cbCancel:()=>ZA.firstEvent&&this.placeVia()})}updateByRule(e,r){let i=e.node.layerId;r!=i&&e.updateSpacing()}placeViaHandle(e,r,i,n=!1){let s=T=>{let I=re.getInstance().getRadiusPhysicsByNet(T.net);I&&(T.via.resetViaSizes={radius:I.defalutRadius,inner:I.defalutInner})},a=e.tracks[r],l=this.event.result.wireVia.get(a),c=this.command,h=a.via.viaPosition;if(l){if(this.event.result.wireVia.delete(a),this.event.result.command.undo(),this.event.result.command=new Lr,c.undo(),this.command=new Lr,h=="lastInflectionPoint"){let T=a.start.layerId;a.end.signalLayers=new Set([T]),a.end.layerId=T,a.layerId=T,a.start.signalLayers=new Set([T]),a.start.allowModifyDirect=!1,le.pcbConfig.startTrackWidth=="rule"&&w3.syncEventRule(a)}else a.end.signalLayers=new Set([a.layerId]);return h=="lastInflectionPoint"?a.start.layerId:a.layerId}let u=le.pcbConfig.startViaSize,d=new IS,{radius:p,inner:m}=a.via,g,y=!1;if(i!=null&&(this.config.placeBlind||n)){let T=this.getBlind(a,i);T&&(g=d.addBlind(a.start.point,T.name,T.startLayer,T.endLayer,p,m,a.net,c),u==="rule"&&(y=!0))}g||(g=d.addVia(a.start.point,p,m,a.net,c));let b=d.createNode(g,c);Zt.getInstance().mode!=="WIRING_MODE_PUSHAWAY"&&h=="lastInflectionPoint"?b.isSource=!0:b.isSource=!1,this.event.result.wireVia.set(a,b);let P;if(i!=null)P=i;else{let T=e.node.layerId;P=this.getLayerAfterPlaceVia(T)}if(this.config.viaPosition=="lastInflectionPoint"&&(this.changeViaTrackWidth(g,P,a),le.pcbConfig.startTrackWidth==="rule")){let I=a.width;we.prevTrackWidth=I}return a.via.viaPosition=this.config.viaPosition,this.config.viaPosition=="lastInflectionPoint"?(a.layerId=P,a.end.layerId=P,a.end.signalLayers=new Set([P]),a.start.signalLayers=new Set(no.getSignalLayerIds(g,a.end.layerId)),a.start.allowModifyDirect=!0):a.end.signalLayers=new Set(no.getSignalLayerIds(g,a.end.layerId)),u==="rule"&&(this.changeViaSize(a),y&&s(a)),P}changeViaSize(e){let r=this.event.result.wireVia.get(e),i=r.item,n=this.getViaSize(i,e.layerId);if(n!=null){r.item.viaBaseInfo=la.getViaBaseInfo(r.item.startLayer,r.item.endLayer,n.radius,n.innerRadius),e.via.radius=r.item.radius,e.via.inner=r.item.holeRadius,e.via.restrainViaSize=!0;return}if(i.name!==""){let a=re.getInstance().getDefaultBlindPhysics().getBlindVia(i.name);if(a.viaSizeRule!==""){e.via.restrainViaSize=!1;let l=re.getInstance().getRadiusPhysicsByName(a.viaSizeRule);r.item.viaBaseInfo=la.getViaBaseInfo(r.item.startLayer,r.item.endLayer,l.defalutRadius,l.defalutInner),e.via.radius=r.item.radius,e.via.inner=r.item.holeRadius;return}}if(e.via.restrainViaSize){e.via.restrainViaSize=!1;let s=re.getInstance().getRadiusPhysicsByNet(e.net);r.item.viaBaseInfo=la.getViaBaseInfo(r.item.startLayer,r.item.endLayer,s.defalutRadius,s.defalutInner),e.via.radius=r.item.radius,e.via.inner=r.item.holeRadius}}changeViaTrackWidth(e,r,i){let n=e.center;if(le.pcbConfig.startTrackWidth=="rule"){let s=Ts(n,r),a=i.net,l=Zf(s,a,i.layerId);if(l!=null)i.width=l;else{let c=no.getWidth(null,"rule",null,!1,i.start.point,r,i.net);c!=null&&(i.width=c)}return i.width}else return i.width=we.prevTrackWidth,we.prevTrackWidth}getBlind(e,r){let i=this.getBlinds(e),n,s=60,a=Ze.getInstance().getAllCopperLayerId4Order();return i!=null&&i.forEach(l=>{if(l.isContains(r)){let c=0,h=a.indexOf(l.startLayer),u=a.indexOf(l.endLayer);c=Math.abs(h-u),c<s&&(n=l,s=c)}}),n}getBlinds(e){let r=re.getInstance().getDefaultBlindPhysics();return r!=null?r.getContainsLayerVias(e.layerId):re.getInstance().getDefaultBlindPhysics().getContainsLayerVias(e.layerId)}getLayerAfterPlaceVia(e){return this.config.autoChangeLayerWhileRoutingVias?this.wirePanelInstance.AfterPlacingTheViaSwitch2Layer?this.wirePanelInstance.AfterPlacingTheViaSwitch2Layer:2==e?1:2:e}placeBlind(e){var l;let r=this.event.node,n=re.getInstance().getDefaultBlindPhysics().getBlindVia(e);if(!n)return;if(n.viaSizeRule!==""){let c=re.getInstance().getRadiusPhysicsByName(n.viaSizeRule);r.via.radius=c.defalutRadius,r.via.inner=c.defalutInner}let s=r.layerId,a=this.getLayerAfterPlaceVia(s);if(n.isContains(s)){switch(a!==s&&n.isContains(a)?a=a:n.startLayer===s?a=n.endLayer:n.endLayer===s?a=n.startLayer:n.isContains(a)||(a=n.endLayer),this.wire){case"Single wiring":{let c=this.event.tracks.indexOf(this.event.node),h=this.placeViaHandle(this.event,c,a,!0);h!=null&&(a=h);break}case"Multi-route wiring":case"Differential pair wiring":{this.event.tracks.forEach((c,h)=>{let u=this.placeViaHandle(this.event,h,a,!0);this.event.tracks[h]==this.event.node&&(a=u)});break}}if(this.config.autoChangeLayerWhileRoutingVias&&Pe.setActiveLayerId(a),this.initSketcherAttrPanel(this.wire),this.event.position!=null)this.reDraw(this.event.position);else{let c=this.event.node.start.point;this.reDraw(c)}for(let c of this.event.tracks){let h=(l=c.via)==null?void 0:l.resetViaSizes;if(h){let{radius:u,inner:d}=h;c.via.radius=u,c.via.inner=d}}Nh.getInstance().checkViaDRC({cbCancel:()=>ZA.firstEvent&&this.placeBlind(e)})}}dblClickPlaceVia(){let e=Pe.getActiveLayerID(),r=this.event.node.layerId,i=this.getLayerAfterPlaceVia(r);if(this.config.placeBlind&&e!==i){if(this.isInVia())return;this.toggleLayer(i)}else this.placeVia(!1)}toggleLayer(e){var h;let r=Pe.getLayer(e),i=this.event.node;if(!r.isSignalLayer()){Pe.setActiveLayerId(i.layerId);return}let n=Rn.getInstance().events,s=new Map,a=this.event.node.layerId;switch(this.wire){case"Single wiring":{let u=this.event.tracks.indexOf(this.event.node);l.call(this,this.event.node,u,!0);break}case"Multi-route wiring":case"Differential pair wiring":{let u=this.event.tracks.every(d=>d.drawing==1?!0:c.call(this,d));this.event.tracks.forEach((d,p)=>{d.drawing!=1&&l.call(this,d,p,u)});break}}this.updateByRule(this.event,a);function l(u,d,p=!1){let m=u.layerId,g=this.event.result.wireVia.get(u);if(p&&u.start.signalLayers.has(e)&&!g&&(u.end.layerId=e,u.end.signalLayers=new Set([e]),u.layerId=e,this.event.updateSpacing()),e===u.layerId&&!g){let b=le.pcbConfig.startTrackWidth;if(e!==m&&b==="rule"){let P=no.getWidth(null,b,null,!1,u.start.point,e,u.net);u.width=P,we.prevTrackWidth=P}return}this.placeViaHandle(this.event,d,e)!==e&&s.set(u,!0)}function c(u){let d=this.event.result.wireVia.get(u);return!!(u.start.signalLayers.has(e)&&!d)}if(this.event.tracks.forEach((u,d)=>{s.get(u)&&this.placeViaHandle(this.event,d,e)}),Pe.setActiveLayerId(e),this.initSketcherAttrPanel(this.wire),this.event.position!=null)this.reDraw(this.event.position);else{let u=this.event.node.start.point;this.reDraw(u)}for(let u of this.event.tracks){let d=(h=u.via)==null?void 0:h.resetViaSizes;if(d){let{radius:p,inner:m}=d;u.via.radius=p,u.via.inner=m}}Nh.getInstance().checkViaDRC({cbCancel:()=>ZA.firstEvent&&this.placeVia()})}getWireWidth(){return this.event!=null?this.event.node.width:null}getViaRadius(){if(this.event!=null){let e=this.event.node;return{radius:e.via.radius,innerRadius:e.via.inner}}return null}wireCorner(){}wireMode(){}wireWidth(e,r){let i=Rn.getInstance().events.length!==0,n=re.getInstance(),s=new T3,a=0,l=0,c=d=>{let p=d.start.point,m,g,y=n.getNet(d.net),b=d.layerId,P=Ts(p,b),T=Ene(P,d.net,d.layerId),I=One(P,d.net,d.layerId),C=Zf(P,d.net,b);if(r==="WIRING_WIDTH_FOLLOWRULES"&&C!=null&&(e=C),T!=null&&I!=null)return[ve(T,2),ve(I,2)];if(y&&y.netDifferential!=null){let E=n.getDifferentialPhysicsByNet(d.net);m=E.getStrokeWidthMin(b),g=E.getStrokeWidthMax(b),r==="WIRING_WIDTH_FOLLOWRULES"&&(e=E.getStrokeWidthDefault(b))}else{let E=n.getTrackPhysicsByNet(d.net);m=E.getMinWidth(b),g=E.getMaxWidth(b),r==="WIRING_WIDTH_FOLLOWRULES"&&(e=E.getDefaultWidth(b))}return[ve(m,2),ve(g,2)]},[h,u]=c(this.event.node);if(ve(e,2)<h||ve(e,2)>u)return A.publish("ui/toastMsg",{type:"warn",msg:"The modified value is not within the DRC requirements"},Q()),!1;for(let d of this.event.tracks){let[p,m]=c(d);if(ve(e,2)>=p&&ve(e,2)<=m){if(i){d.width=e;continue}if(e>d.preWidth){let g=(e-d.preWidth)/2,y=d.previous;if(y&&y.previous){let P=y.preWidth-g-a,T=s.getSafeClearance2(0,0,d.net,y.previous.net,[],d.layerId);P>=T?y.width=P:y.width=T}let b=d.next;if(b&&b.next){let P=b.preWidth-g,T=s.getSafeClearance2(0,0,d.net,b.next.net,[],d.layerId);P>=T?b.width=P:b.width=T,a=g}}else if(this.wire!=="Differential pair wiring"){let y=(d.preWidth-e)/2,b=d.previous;if(b&&b.previous){let T=b.preWidth+l+y;b.width=T}let P=d.next;if(P&&P.next){let T=P.preWidth+y;P.width=T,l=y}}d.width=e}}return!0}modifySpacing(e){this.event.modifySpacing1(e)}viaSize(e,r,i){let n=i||this.event,s=re.getInstance().getRadiusPhysicsByNet(n.node.net);if(r!=null&&sf.inValidRadius(s,r)){A.publish("ui/toastMsg",{type:"warn",msg:"The modified value is not within the DRC requirements"},Q());return}else if(e!=null&&sf.inValidInnerRadius(s,e)){A.publish("ui/toastMsg",{type:"warn",msg:"The modified value is not within the DRC requirements"},Q());return}let a=(l,c=!1)=>{r!=null&&(l.radius=r),e!=null&&(c?l.inner=e:l.holeRadius=e)};a(n.node.via,!0);for(let[l,c]of n.result.wireVia){let h=c.item;a(h)}for(let l of n.tracks)l.via.radius=r==null?l.via.radius:r,l.via.inner=e==null?l.via.inner:e;this.initSketcherAttrPanel(this.wire),this.onMouseMove(fi.getInstance())}modifyViaSize(e){let r=e||this.event,i=re.getInstance();if(this.constraintModifyViaSize(r))return!0;for(let[s,a]of r.result.wireVia){let l=a.item,c=i.getNet(l.net),h=i.getRadiusPhysicsByNet(c==null?void 0:c.name);h||(h=i.getDefaultRadiusPhysics()),l.viaBaseInfo=la.getViaBaseInfo(l.startLayer,l.endLayer,h.defalutRadius,h.defalutInner),ut.defaultVia.radius=h.defalutRadius,ut.defaultVia.innerRadius=h.defalutInner}for(let s of r.tracks)s.via.radius=ut.defaultVia.radius,s.via.inner=ut.defaultVia.innerRadius;this.onMouseMove(fi.getInstance())}constraintModifyViaSize(e){if(le.pcbConfig.startViaSize!=="rule")return;let r=e||this.event,i=r.result.wireVia,n=r.result.wireMap,s=r.tracks,a=i.size,l=re.getInstance();if(a<=0)return;let c=!1;return s.forEach(h=>{let u=i.get(h),d=n.get(h);if(!u||!d)return;let p=u.item;if(d.size()==0)return;let m=this.getViaSize(p,h.layerId);if(m!=null){this.originViaSize.has(p)||this.originViaSize.set(p,{radius:p.radius,holeRadius:p.holeRadius}),p.viaBaseInfo=la.getViaBaseInfo(p.startLayer,p.endLayer,m.radius,m.innerRadius),h.via.radius=p.radius,h.via.inner=p.holeRadius,h.via.restrainViaSize=!0,c=!0;return}if(!c){if(this.originViaSize.has(p)){let g=this.originViaSize.get(p);p.viaBaseInfo=la.getViaBaseInfo(p.startLayer,p.endLayer,g.radius,g.holeRadius),this.originViaSize.delete(p),h.via.restrainViaSize=!1,h.via.radius=p.radius,h.via.inner=p.holeRadius}else if(h.via.restrainViaSize){h.via.restrainViaSize=!1;let g=re.getInstance().getRadiusPhysicsByNet(p.net);p.viaBaseInfo=la.getViaBaseInfo(p.startLayer,p.endLayer,g.defalutRadius,g.defalutInner),h.via.radius=p.radius,h.via.inner=p.holeRadius}}}),this.modifyViaPosition(e,c),c}getViaSize(e,r){let i=e.startLayer,n=e.endLayer,s=Ts(e.center,r,!0,!0);if(i!==1||n!==2){let l=i===1,c=n===2,h=Pe.getSortCopperLayer().map(m=>m.layerID),u=h.indexOf(i),d=h.indexOf(n),p=h.slice(u,d+1);l||(p=p.filter(m=>m!=1)),c||(p=p.filter(m=>m!=2)),s=s.filter(m=>{let g=m.layerId;return p.indexOf(g)>=0||g==12})}return Q8(s)}modifyViaPosition(e,r=!1){if(!r)return;let i=new w3,n=e||this.event,s=n.result.wireVia,a=n.result.wireMap,l=n.tracks,c=n.node.layerId;if(s.size<=1)return;let u=[],d=[];l.forEach(g=>{d.push(s.get(g)),u.push(a.get(g))});let p=i.calcViaPosition(d,u);this.changeViaPosition(p);let m=new x3;for(let g=0;g<l.length;g++){let y=l[g],b=a.get(y);m.optimization(b,y,n.result.command)}}changeViaPosition(e,r){let i=r||this.event,n=i.result.wireVia,s=i.result.wireMap,a=i.tracks,l=i.node.layerId,c=n.size,h=new w3,u=i.result.command,d=new Zr,p=[];a.forEach(g=>{p.push(n.get(g))});let m=h.getViasCenter(p);a.forEach(g=>{let y=s.get(g),b=n.get(g),P=e.get(b);if(!P)return;let T=m.sub(P.rawPosi).normalize(),I=P.direct,C=T.rotate(new S(0,0),Math.PI/2),E=C.cross(I),O=C.cross(T),_=E*O;if(_/=Math.abs(_),_>0)return;let x=y.getLast(),v=y.getLastNode(),D=d.createList(),w=d.createTrack(x.layerId,x.start,x.end,x.width,x.net,u,x.getGroupID()),F=d.createTrack(x.layerId,x.end,P.posi,x.width,x.net,u,x.getGroupID());d.addList(w,D,u),d.addList(F,D,u),D.replace(v,v),u.addCommand(new mi(D));let H=new nT(F.direct,-1);y.getLastNode().fanoutInfo=H,b.item.center=P.posi})}flipPath(){for(let e of this.event.tracks){let r=e.direct;e.direct=e.end.direct,e.end.direct=r}this.event.position!=null&&this.reDraw(this.event.position)}interrupt(){Jd.updateNetLengthMsg(this.event,this.wire),this.clearRatline(),this.clearPartitionEdgeNets(),this.resetSilkLayerTrans(),Nl.getInstance().clear(),wI.lastPublishTime=0}clearPartitionEdgeNets(){if(this.partitionEdgeNets.size)for(let e of this.partitionEdgeNets)Ye.unhighlightNet(e)}clearRatline(){for(let e in this.nearNodes)this.nearNodes[e].nearNode.clear();VV.unhighlight(),this.nearNodes={}}resetSilkLayerTrans(){[Pe.getTopSilkLayer(),Pe.getBottomSilkLayer()].forEach(r=>{r.setActiveColor(null,!0)})}startPathComplete(e=!1){let r=new IA(this.event),i=Rn.getInstance().getLastEvent(),n=R0.getInstance().startItems;if(this.wire=="Differential pair wiring"&&!i)try{if(!r.needComplete(this.event.node,n))return;let s=r.getDiffStartRoutes();if(!s)return null;let[a,l]=s,c=new Map;for(let h=0;h<a.length;h++){let u=a[h],d=this.event.tracks[h];d!==this.event.node&&(d.end.point=u.end(),d.start.point=u.end(),e?c.set(d,u):d.startAlignMap.set(d,u)),d.end.direct=l,d.start.direct=l}return e&&c.size>0?c:!0}catch{return null}}pathComplete(){let e=Rn.getInstance().getLastEvent(),r=this.event.node;if(this.wire!=="Single wiring"&&!e){if(this.event.tracks.some(n=>n.startAlignMap.size>0))return;this.startPathComplete()&&VCe(this.event.tracks,!1);return}else if(!this.lastMode||!e)return;let i=this.lastMode=="Single wiring"&&this.wire!=="Single wiring";if(!x0.isAlign(this.event.tracks)&&i&&!this.event.isCanEndWire){if(this.event.tracks.some(n=>n.alignMap.size>0))return;try{let s=new IA(this.event).getRoutes(this),a=this.event.tracks.findIndex(c=>c==r),l=s[a];s.forEach((c,h)=>{let u=this.event.tracks[h];if(e.tracks[h]!==e.node){let d=c.primitives[c.primitives.length-1].end();u.end.point=d,u.start.point=d,u.alignMap.set(u,c)}u.end.direct=Et(l.primitives)||r.end.direct,u.start.direct=Et(l.primitives)||r.start.direct})}catch(n){console.log(n)}}this.lastMode=null}initSketcherAttrPanel(e,r=!1){let i=A8(e);A.publish("FlushSketcherAttrView",{type:i,isInitAllParams:!0,switchTab:r})}};ZA.firstEvent=null,ZA.canRemoveLoop=null;var _1=ZA;var uf=class{constructor(t,e){this.all=new Set;this.all.add(t),this.track=t,this.branch=e;let r=this.getConnectTracks(t);for(this.addAll(r,this.all);r.size>0;){let i=new Set;r.forEach(n=>{let s=this.getConnectTracks(n);this.addAll(s,this.all),this.addAll(s,i)}),r=i}}addAll(t,e){t.forEach(r=>{e.add(r)})}getConnectTracks(t){let e=new Set,r=t.searchCycleNode(),i=this.getEnds(t,r);return i.length>0?r.forEach(n=>{n instanceof Ge&&!this.all.has(n)&&!this.isSelect(n,i)&&e.add(n)}):r.forEach(n=>{n instanceof Ge&&!this.all.has(n)&&e.add(n)}),e}getEnds(t,e){let r=new Array,i=0,n=0;return e.forEach(s=>{(s instanceof Le||s instanceof Ue)&&r.push(s.center),!this.branch&&s instanceof Ge&&((s.start.equals1(t.start)||s.end.equals1(t.start))&&i++,(s.start.equals1(t.end)||s.end.equals1(t.end))&&n++,i>1&&r.push(t.start),n>1&&r.push(t.end))}),r}isSelect(t,e){for(let r of e)if(t.isVisible&&t.isSelect(r.x,r.y))return!0;return!1}};var mq=class{autoAssignTrackNet(t){if(!ds.getInstance().isAssignNetForFreeTrack)return;let e=Ye.getAllNets(),r=[],i="",n=Rn.getInstance().events,s=[].concat(n,Rn.getInstance().current),a=this.getEvenTrackSort(s),l=s[0].tracks.length;s[0].tracks.forEach((c,h)=>{var P;if(c.net)return;let u=c.start.model,d=s[s.length-1],p=h;if(a[s.length-1]!=a[0]&&(p=l-1-h),d.tracks[p].net)return;let m=d.tracks[p].end.point,g=(P=no.getSingleItems(m.x,m.y))==null?void 0:P.model;if(u&&u instanceof et||g&&g instanceof et){let T=u==null?void 0:u.getParent(),I=g==null?void 0:g.getParent(),C=T&&T.designator,E=I&&I.designator,O=u?`${Tr}${u.number}`:void 0,_=g?`${Tr}${g.number}`:void 0;if(C&&E){let x=[C,E].sort((v,D)=>this.sortRule(v,D,!0));i="$"+x[0]+"_"+(x[0]==C?u.num:g.num)}else!C&&!E?u instanceof et&&g instanceof et?i="$"+[O,_].sort((v,D)=>this.sortRule(v,D,!1))[0]:u instanceof et?i="$"+O:g instanceof et&&(i="$"+_):(C&&(i="$"+C+"_"+u.num),E&&(i="$"+E+"_"+g.num));u&&u instanceof et&&u.net&&(i=u.net),g&&g instanceof et&&g.net&&(i=g.net)}else e.forEach(T=>{if(T.includes("$")){let I=Number(T.split("$")[1]);!isNaN(I)&&r.push(I)}}),r.length?(r=r.sort((T,I)=>T-I),i="$"+(r[r.length-1]+1)):i="$1";if(i=i.toUpperCase(),u&&!u.net){let T=Pe.getLayer(u.layerId);(T.isSignalLayer()||T.type=="MULTI")&&this.changeModelNet(u,i,t)}if(g&&!g.net){let T=Pe.getLayer(g.layerId);if(T.isSignalLayer()||T.type=="MULTI")if(g instanceof gt){let C=new Jt().getItem(g.globalIndex);new uf(C,!1).all.forEach(O=>{this.changeModelNet(O.model,i,t)})}else this.changeModelNet(g,i,t)}let y=u instanceof et&&g instanceof et,b=new Set;s.forEach((T,I)=>{let C=h;a[I]!=a[0]&&(C=l-1-h);let E=T.tracks[C],O=T.result.wireMap.get(E),_=T.result.wireVia.get(E);_!=null&&_.item&&(_.item.net=i),((O==null?void 0:O.getAllItems())||[]).forEach(v=>{y&&this.getPad(v,b),v.net=i})}),b.forEach(T=>{this.changeModelNet(T,i,t)})})}getPad(t,e){let r=wt.search4RtreePad(t.bbox),i=new gd;r.forEach(n=>{e.has(n)||i.needCheckIntersection(t,n)&&t.inShape(n.center.x,n.center.y)&&e.add(n)})}changeModelNet(t,e,r){let n=new Jt().getItem(t.globalIndex);r.addCommand(Ce.dispatch(n,"modify")),n.net=e,A.publish("hasModifyPcbItem",n)}sortRule(t,e,r){var i=/[^a-zA-Z]/g,n=/[^0-9]/g,s=parseInt(t,10),a=parseInt(e,10);if(isNaN(s)&&isNaN(a)){var l=r?t.replace(i,""):t.replace(n,""),c=r?e.replace(i,""):e.replace(n,"");if(l===c){var h=parseInt(r?t.replace(n,""):t.replace(i,""),10),u=parseInt(r?e.replace(n,""):e.replace(i,""),10);return h===u?0:h>u?1:-1}else return l===""?1:c===""?-1:l>c?1:-1}else return isNaN(s)?1:isNaN(a)?-1:s>a?1:-1}getEvenTrackSort(t){let e=[],r=!0,i;return t.forEach(n=>{var s,a;i&&((s=n.tracks[0].start.model)==null?void 0:s.globalIndex)!=((a=i.tracks[0].end.model)==null?void 0:a.globalIndex)&&(r=!r),i=n,e.push(r)}),e}getTrackInfoPath2(t){let e={},r=Rn.getInstance().events,i=[].concat(r,[Rn.getInstance().current]),n=this.getEvenTrackSort(i),s=i[0].tracks.length,a=new Set;return i[0].tracks.forEach((l,c)=>{let h=[],u=[],d="";i.forEach((p,m)=>{var C,E;let g=[],y=[],b=c;n[m]!=n[0]&&(b=s-1-c);let P=p.tracks[b],T=p.result.wireMap.get(P),I=p.result.wireVia.get(P);if(!a.has(T)&&T&&T.size()>0){let O=(T==null?void 0:T.getAllItems())||[],_=P.start.point,x=O.findIndex(v=>v.start.equals(_));x!=-1&&O.splice(0,x),d=(C=O[0])==null?void 0:C.net,_=(E=O[0])==null?void 0:E.start,O.forEach(v=>{let D=v.primitive,w=D.start().distance2(_),F=D.end().distance2(_);w<F||(D=pp(D)),_=D.end(),t[v.globalIndex]&&(y.push(D),g.push({id:t[v.globalIndex],width:v.width,isTrack:!0,layer:v.layerId}))}),a.add(T)}I&&(d==""&&(d=I.item.net),t[I.item.globalIndex]&&(P.via.viaPosition=="currentInflectionPoint"?(g.push({id:t[I.item.globalIndex],isTrack:!1}),y.push(null)):(g.unshift({id:t[I.item.globalIndex],isTrack:!1}),y.unshift(null)))),h.push(...y),u.push(...g)}),e[d]||(e[d]=[]),e[d].push({path:h,tracks:u,net:d})}),e}};var Uce=class{constructor(t,e){this.oldSimilarStartPath=new Array;this.oldSimilarEndPath=new Array;this.newSimilarStartPath=new Array;this.newSimilarEndPath=new Array;this.old=t,this.path=e,this.similarity=this.getSimilarity(t,e)}comparison(){let t=0,e=0;for(let i=this.old.length;t<i;t++){let n=this.old[t],s=this.getLength(n),a=0,l=new Array;for(let c=this.path.length;e<c;){let h=this.path[e],u=this.getLength(h);if(this.overlap(n,h))l.push(h),a+=u,e++;else break;if(ne.eq(a,s))break}if(ne.eq(a,s))this.oldSimilarStartPath.push(n),xe.addAll(this.newSimilarStartPath,l);else break}let r=this.path.length-1;for(let i=this.old.length-1;i>t;i--){let n=this.old[i],s=this.getLength(n),a=0,l=new Array;for(;r>e;){let c=this.path[r],h=this.getLength(c);if(this.overlap(n,c))l.push(c),a+=h,r--;else break;if(ne.eq(a,s))break}if(ne.eq(a,s))this.oldSimilarEndPath.push(n),xe.addAll(this.newSimilarEndPath,l);else break}}getSimilarity(t,e){let r=this.getPathLength(t),i=0;for(let n of t){let s=this.getLength(n);for(let a of e)if(this.overlap(n,a)){let l=this.getLength(a);s<l?i+=s:i+=l}}return i/r}getPathLength(t){let e=0;for(let r of t)e+=this.getLength(r);return e}getNewModifyPath(){let t=this.newSimilarStartPath.length,e=this.path.length-this.newSimilarEndPath.length;return this.path.slice(t,e)}getLength(t){let e=0;if(t instanceof M)e=t.length();else if(t instanceof q){let r=t.rx,i=Math.abs(Xh(t.sweepAngle));e=r*i}return e}overlap(t,e){let r=t.bbox().isInside(e.bbox()),i=e.bbox().isInside(t.bbox());if(r||i){if(t instanceof M&&e instanceof M){let n=t.end().sub(t.start()).normalize(),s=e.end().sub(e.start()).normalize(),a=n.cross(s),l=n.dot(s);if(ne.eq(a,0)&&ne.greater(l,0)){let c=er.foot(t,e.start());if(ne.eq(c.distance2(e.start()),0))return!0}}else if(t instanceof q&&e instanceof q){let n=t.center,s=e.center;if(ne.eq(n.distance2(s),0)&&t.rx==e.rx&&t.sweep()==e.sweep()){let a=t.sweepAngle,l=e.sweepAngle;if(Math.abs(a)>=Math.abs(l)){let c=t.pointOn(e.startAngle),h=t.pointOn(e.endAngle());if(ne.eq(c.distance2(e.start()),0)&&ne.eq(h.distance2(e.end()),0))return!0}else{let c=e.pointOn(t.startAngle),h=e.pointOn(t.endAngle());if(ne.eq(c.distance2(t.start()),0)&&ne.eq(h.distance2(t.end()),0))return!0}}}}return!1}similar(t,e){if(t instanceof M&&e instanceof M){let r=t.end().sub(t.start()).normalize(),i=e.end().sub(e.start()).normalize(),n=r.cross(i),s=r.dot(i);if(ne.eq(n,0)&&ne.greater(s,0))return!0}else if(t instanceof q&&e instanceof q){let r=t.center,i=e.center;if(ne.eq(r.distance2(i),0)&&t.sweep()==e.sweep())return!0}return!1}equals(t,e){let r=t.start(),i=t.end(),n=e.start(),s=e.end();if(ne.eq(r.distance2(n),0)&&ne.eq(i.distance2(s),0)){if(t instanceof M&&e instanceof M)return!0;if(t instanceof q&&e instanceof q){let a=t.center,l=e.center;if(ne.eq(a.distance2(l),0)&&t.sweep()==e.sweep())return!0}return!1}else return!1}getStart(t){for(let e of t)return e.start();return null}getEnd(t){let e=t[t.length-1];return e!=null?e.end():null}};var JA=class{constructor(t,e,r){this.text=t,this.action=e,this.buttomData=r}};var WV=class o extends Zx{constructor(e,r,i,n,s,a=!1,l=400){super(n||2);this.title="Warning";this.buttoms=new Array;this.callbacks=new Array;this.checked=!1;this.msg=e,this.id=s,this.buttoms=r,this.checked=a||!1,this.callbacks.push(i),this.msgBoxWidth=l||400}equal(e){return e instanceof o&&this.type==e.type&&this.msg==e.msg}open(e){let r=new Array;for(let i of this.buttoms){let n={text:i.text,actionTag:i.action};i.buttomData!=null&&(n.btnData=i.buttomData),r.push(n)}return{type:this.type,id:this.id,option:{contentText:this.msg,title:this.title,btns:r,checked:this.checked,centered:!1,msgBoxWidth:this.msgBoxWidth},extra:{}}}close(e){let r=e.action;this.callbacks.forEach(i=>{i(r,e.checked)})}};var Hce=class extends Xk{constructor(e,r,i,n){super(e);this.map=new Map;this.checkModelConnect=new TS(!0);this.needUpdateConnect=!0;this.excludesItem=new Set;this.maxNum=1e3;this.modifyItem=new Set;this.connectOther=null,this.init(r,i,n)}setModify(e){this.needUpdateConnect=!0,this.modifyItem.add(e)}hasExceed(){return!!this.connectOther}setReplaceTrack(e,r){if(this.connectOther&&this.connectOther.has(e)){this.connectOther.delete(e);for(let i of r)this.connectOther.add(i)}}isPoint(e){return this.connectOther?this.connectOther.has(e):!1}clearSearchCondition(){ox.model=null}insertPlatedPad2Rtree(e){this.rtree==null&&(this.rtree=new $u(this.capacity)),this.rtree.insert(e)}netShapes(){let e=[];return this.net?Ye.getSameNetItems(this.net,r=>r.model instanceof xi&&e.push(r.model)&&!1):Ye.getAllNoneNetsItems().forEach(r=>r.model instanceof xi&&e.push(r.model)),e.filter(r=>this.validItem(r))}getNeedCalculationItem(e,r,i){let n=this,s=Iu.getNode(this.net);s.trim();let a=s.map,l=[];h(a.get(e)).forEach(u=>{l.push(u)}),h(a.get(r)).forEach(u=>{l.push(u)}),i.forEach(u=>{l.push(a.get(u))});let c=new Set(l);function h(u){let d=[u],p=new Set,m=new Set;for(p.add(u);d.length;){let g=d.pop(),y=[],b=[];for(let P of g.near)n.validItem(P.item)&&(P.item instanceof zr&&y.push(P),b.push(P));if(y=y.sort((P,T)=>{let I=P.item,C=T.item;return ne.eq(C.length,I.length)?C.width-I.width:C.length-I.length}),y.length>15)for(let P=0;P<y.length;P++){let I=y[P].item.clone(),C=I.width;for(let E=P+1;E<y.length;E++){let O=y[E].item;I.width=C+O.width/2,I.inShape(O.start.x,O.start.y)&&I.inShape(O.end.x,O.end.y)&&m.add(y[E])}}for(let P of b)!p.has(P)&&!m.has(P)&&(d.unshift(P),p.add(P));if(p.size>n.maxNum){n.connectOther||(n.connectOther=new Set);for(let P of d){let T=[],I=!1;for(let C of P.near)p.has(C)?T.push(C.item.globalIndex):I=!0;if(I)for(let C of T)n.connectOther.add(C)}break}}return Array.from(p)}if(Gr.debug){let u=[];Array.from(c).map(p=>{p.item instanceof zr&&u.push(new Gn(new M(p.item.start,p.item.end),{color:ee.BLUE}))});let d=new Cd(u);Gr.inputDebugGraphics(d)}return c}init(e,r,i){let n=this.getNeedCalculationItem(e,r,i),s=Iu.getNode(this.net),a=s.map.keys(),l=new Set;for(let h of a){let u=s.map.get(h);if(n.has(u)){l.add(h);let d=new Wce(h);this.map.set(h,d)}else this.excludesItem.add(h)}let c=s.getConditionMap();l.forEach(h=>{let u=s.map.get(h),d=this.map.get(h);u.near.forEach(m=>{let g=this.map.get(m.item);g&&d.addNear(g)});let p=c.get(h.globalIndex);if(p){let m=new Map;this.conditionMap.set(h.globalIndex,m),p.forEach((g,y)=>{m.set(y,g)})}})}validItem(e){return e instanceof et||e instanceof Ct||e instanceof gt}updateConnect(e=!0){this.trim(!1,null,e)}getConnectStatus(e){return this.trim(),this.map.get(e.model)}getCluster(){this.trim();let e=Array.from(this.map.keys());e.forEach(n=>{let s=this.map.get(n);s.directConnect||this.updateLoopData(s)});let r=new Jt,i=new Array;for(let n of e)i.push(r.getLoopNode(n.globalIndex));return i}trim(e,r,i=!0){if(!this.needUpdateConnect)return!1;let{add:n,remove:s}=this.vary();return this.excludesItem.forEach(a=>{n.has(a)&&n.delete(a)}),this.needUpdateConnect=!1,this.modifyItem.clear(),n.size==0&&s.size==0?!1:(s.forEach(a=>{this.remove4Rtree(this.map.get(a)),this.map.get(a).near.forEach(c=>c.deleteNear(this.map.get(a)));let l=this.map.get(a);l.directConnect&&i&&(l.directConnect.forEach(c=>{let h=this.map.get(c.model);if(h){let u=h.directConnect.values();for(let d of u)if(d.globalIndex==a.globalIndex){h.directConnect.delete(d);break}h.startConnect=null,h.endConnect=null}}),l.otherConnect.forEach(c=>{let h=this.map.get(c.model);if(h){let u=h.otherConnect.values();for(let d of u)if(d.globalIndex==a.globalIndex){h.otherConnect.delete(d);break}}})),this.map.delete(a)}),n.forEach(a=>{let l=new Wce(a);this.map.set(a,l)}),n.forEach(a=>{let c=new Jt().getLoopNode(a.globalIndex);ox.model=a;let h=this.search(a.buildBBox()).filter(d=>this.condition(a,d.item)),u=this.map.get(a);u.deleteAllNear();for(let d of h)u.addNear(d),d.addNear(u);i&&(this.updateLoopData(this.map.get(a)),this.map.get(a).directConnect.forEach(d=>{var m;(m=this.map.get(d.model).directConnect)==null||m.add(c)}),this.map.get(a).otherConnect.forEach(d=>{var m;(m=this.map.get(d.model).otherConnect)==null||m.add(c)}))}),!0)}vary(e){let r=new Set,i=new Set;if(this.map.size===0){let{shapes:n,platPads:s}=this.shapes();for(let a of n)r.add(a);return{add:r,remove:i,platPads:s}}else{let n=new Set;for(let a of this.modifyItem)a.isEmpty?i.add(a):n.add(a);let s=!1;for(let a of n)s=this.map.has(a),a.layerOrBoxModified?(s&&i.add(a),r.add(a),e&&(a.layerOrBoxModified=!1)):s||r.add(a);return{add:r,remove:i,platPads:new Set}}}updateLoopData(e){let r=e.near,i=new Jt,n=e.item;e.directConnect=new Set,e.otherConnect=new Set,e.startConnect=null,e.endConnect=null,r.forEach(s=>{let a=s.item;if(!(a instanceof et||a instanceof Ct||a instanceof gt))return;let l=i.getLoopNode(a.globalIndex);if(this.checkModelConnect.isConnect(a,n)||this.checkPadConnectHole(a,n)){e.directConnect.add(l);return}this.validSearchModelNode(n,a)&&e.otherConnect.add(l)})}isPadAndVia(e){return e instanceof et||e instanceof Ct}checkPadConnectHole(e,r){if(this.isPadAndVia(e)&&this.isPadAndVia(r)){let i=e,n=r;return i.center.distance2(n.center)<1e-4}return!1}validSearchModelNode(e,r){if(e instanceof et||e instanceof Ct){if(r instanceof Ii)return e.inShape(r.start.x,r.start.y)||e.inShape(r.end.x,r.end.y);if(r instanceof zr)return!0;if(e instanceof et&&(e.layerId==1||e.layerId==2)){if(r instanceof et&&r.layerId==12){let i=r.holeRadius;return e.center.distance1(r.center)<i}if(r instanceof Ct&&r.isContains(e.layerId)){let i=r.holeRadius;return e.center.distance1(r.center)<i}}else if(r instanceof et&&(r.layerId==1||r.layerId==2)){let i=e.holeRadius;return e.center.distance1(r.center)<i}return!1}else{if(e instanceof Ii)return r instanceof et||r instanceof Ct?r.inShape(e.start.x,e.start.y)||r.inShape(e.end.x,e.end.y):!0;if(e instanceof zr)return!0}return!1}isConnect(e,r){if(e instanceof Ct){let i=e.radius;if(new er(r.primitive,new M(e.center,e.center)).getDistance()>=i)return!1}else if(!(e.inShape(r.start.x,r.start.y)||e.inShape(r.end.x,r.end.y))){let n=e.getMathGraphics(),s;n instanceof ge&&(s=n);let a=ge.build4([r.start,r.end]);return new As(s,a,0).relation==0}return!0}search(e){this.trim();let r=kt.search4Types(e,jd,ox.keep),i=new Array;for(let n of jd){let s=r.getResults(n);for(let a of s){let l=a.model;if(l instanceof xi){let c=this.map.get(l);c!=null&&i.push(c)}}}if(this.rtree!=null){let n=this.rtree.search(e);for(let s of n)i.push(s)}return i}end(){this.rtree=null}},Wce=class extends Tb{constructor(t){super(t)}bbox(){return this.item.bbox}};var Q6=class Q6{getRatlineNet(){return this.ratlineNet}static getInstance(){return Q6.manager==null&&(Q6.manager=new Q6),Q6.manager}getRTree(){return this.ratlineNet.clearSearchCondition(),this.ratlineNet}clear(){this.ratlineNet=null}hasItem(t){return this.ratlineNet?this.ratlineNet.getModel(t.globalIndex)!=null:!1}setModify(t){this.ratlineNet&&(t instanceof Ge||t instanceof Le||t instanceof Ue)&&(this.ratlineNet.net==t.net,this.ratlineNet.setModify(t.model))}set(t,e,r,i){let n=!0;if(this.ratlineNet&&this.ratlineNet.net==t&&(n=!i.every(s=>!!this.ratlineNet.getModel(s.globalIndex))),n){t==""&&Iu.updateEmptyNet();let s=new Hce(t,e,r,i);this.ratlineNet=s,s.updateConnect(!1)}return n}init(t,e,r,i){return this.set(t,r,i,e.map(s=>s.model))?this.ratlineNet.getCluster():(this.ratlineNet.trim(),[])}searchTrackConnectTrack(t){return this.searchNode(t).filter(e=>e instanceof Ge)}getDirectConnect(t){return this.getConnectStatus(t)}getConnectStatus(t){return this.ratlineNet.getConnectStatus(t)}trackConnect(t){let e=this.getDirectConnect(t);return e.startConnect==null&&(e.startConnect=!1,e.endConnect=!1,e.directConnect.forEach(r=>{if(e.startConnect&&e.endConnect&&!r)return;let i=this.generateConnect(t,r);e.startConnect=i.startConnect||e.startConnect,e.endConnect=i.endConnect||e.endConnect})),{startConnect:e.startConnect,endConnect:e.endConnect}}getTrackConnectType(t){let r=this.searchCycleNode(t),i=[],n,s,a=r.filter(p=>p instanceof Le||p instanceof Ue),l=t.start,c=t.end;a.find(p=>(l.distance2(p.center)<1e-4?n=p:c.distance2(p.center)<1e-4&&(s=p),!1));let h,u;if(n&&(h=n instanceof Ue?2:1),s&&(u=s instanceof Ue?2:1),n&&s)return{startType:h,endType:u};if(!n){let p=d(l);h=p.type,n=p.nextTrack}if(!s){let p=d(c);u=p.type,s=p.nextTrack}return{startType:h,endType:u,startNode:n,endNode:s};function d(p){let m,g,y=null;return i.every(P=>{let T=null;return p.distance2(P.start)<1e-4?(T=!0,y=!0):p.distance2(P.end)<1e-4&&(T=!1,y=!1),g&&T!=null?(m=11,!1):(T!=null&&(g=P),!0)})&&g?m=y?g instanceof Ir?5:7:g instanceof Ir?6:8:g||(m=0),{type:m,nextTrack:g}}}generateConnect(t,e){let r=!1,i=!1,n=1e-4;return t instanceof Ge&&(e instanceof Ge?t.start.distance2(e.start)<n||t.start.distance2(e.end)<n?r=!0:(t.end.distance2(e.start)<n||t.end.distance2(e.end)<n)&&(i=!0):t.start.distance2(e.center)<n?r=!0:t.end.distance2(e.center)<n&&(i=!0)),{startConnect:r,endConnect:i}}searchNode(t){let e=this.getConnectStatus(t);return this.getNode(t,e)}getNode(t,e,r=!0,i=!0){let n=[];if(r&&(n=Array.from(e.directConnect)),i&&(n=n.concat(Array.from(e.otherConnect))),t instanceof Le||t instanceof Ue){let s=new Set;return n.filter(a=>{if(a instanceof Le||a instanceof Ue){let l=this.getConnectStatus(a),c=[];r&&(c=Array.from(l.directConnect)),i&&(c=c.concat(Array.from(l.otherConnect))),c.filter(h=>{h instanceof Ge&&s.add(h)})}else s.add(a)}),Array.from(s)}return n}searchCycleNodeTrack(t){let e=this.getDirectConnect(t);return this.getNode(t,e,!0,!1).filter(r=>r instanceof Ge)}searchCycleNode(t){let e=this.getDirectConnect(t);return this.getNode(t,e,!0,!1)}searchOtherNode(t){let e=this.getConnectStatus(t);return this.getNode(t,e,!1,!0)}};Q6.manager=null;var Jl=Q6;function pYe(o,t){let e=[],r=[],i=nr(),n=nr(),s=Jl.getInstance().getRatlineNet();s=s.hasExceed()?s:null,o.cycles.forEach((m,g)=>{let y=Array.from(m.cycle),b=[];y.forEach((P,T)=>{P instanceof Le?b.push({item:P.globalIndex,index:T}):T==0?b.push({item:i,index:T-1}):T==y.length-1?b.push({item:n,index:T+1}):s&&s.isPoint(P.globalIndex)&&b.push({item:P.globalIndex,index:T})}),b.length==1&&b.push({item:n,index:1});for(let P=1;P<b.length;P++){let T=b[P-1],I=b[P],C=new zce(T.item,I.item,y.slice(T.index+1,I.index));g==t?e.push(C):r.push(C)}});let a=o.getLeaves(),l=0;a.forEach(m=>{let g=Array.from(m).shift(),y=new zce(g.globalIndex,l.toString(),m);e.push(y),l++}),r=r.sort((m,g)=>{if(m.hasVia==g.hasVia)return 0;if(m.hasVia)return-1;if(g.hasVia)return 1});let c=new Set,h=new Set;xe.addAll(e,r);let u=new Set;e.forEach(m=>{Uvt(m,u)?c.add(m):h.add(m)});let d=new Set;c.forEach(m=>{m.path.forEach(g=>{d.add(g)})});let p=[];return h.forEach(m=>{p.push(m.path)}),{saves:d,deleteItems:p}}function Uvt(o,t){let e=null,r=null;for(let i of t)i.has(o.cluster1)&&(e=i);for(let i of t)i.has(o.cluster2)&&(r=i);if(e==null&&r==null){let i=new Set;return i.add(o.cluster1),i.add(o.cluster2),t.add(i),!0}else{if(e!=null&&r==null)return e.add(o.cluster2),!0;if(e==null&&r!=null)return r.add(o.cluster1),!0;if(e!=r){t.delete(e),t.delete(r);let i=Hvt(e,r);return t.add(i),!0}}return!1}function Hvt(o,t){let e=new Set;for(let r of o)e.add(r);for(let r of t)e.add(r);return e}var zce=class{constructor(t,e,r){this.cluster1=t,this.cluster2=e,this.path=r,this.hasVia=!!r.find(i=>i instanceof Ue),this.pathLen=0,r.forEach(i=>{i instanceof Ge&&(this.pathLen+=i.length)})}};var Jb=class extends dh{constructor(e){super();this.path=[];this.start=e}addLine(e){this.path.push(e)}displayPath(e){var r;(r=this.path[e])==null||r.display(),he.publish("updateFrame","")}display(){var e;(e=this.start)==null||e.display();for(let r of this.path)r.display()}remove(){var e;(e=this.start)==null||e.remove();for(let r of this.path)r.remove()}};var lD=class{constructor(t,e,r,i){this.trunk=new Array;this.data=t,this.start=r,this.end=i,this.cycle=new Set(e),this.all=new Set(e)}getTrunk(t,e){xe.addAllSet(this.all,t),xe.addAllSet(this.all,e);let r=this.data,i=new Set,n=new Array;r.forEach((s,a)=>{let l=this.getIntersection(s,r[a+1]);s instanceof Le?n.length>0&&(this.trunk.push(n),n=new Array):n.push(s),l.length>0&&(n.length>0&&this.trunk.push(n),n=new Array),i=new Set(l)}),n.length>0&&this.trunk.push(n)}getIntersection(t,e){let r=new Array;if(e==null)return r;let i=Jl.getInstance(),n=new Set(i.searchNode(t)),s=new Set(i.searchNode(e));for(let a of n)!this.all.has(a)&&a!=t&&this.isNeed(a)&&s.has(a)&&r.push(a);return this.filterNodes(r)}filterNodes(t){let e=new Array,r=new Array;return t.forEach(i=>{i instanceof Le||i instanceof Ue?e.push(i):r.push(i)}),e.length==0?r:[...e]}isNeed(t){return t instanceof Ge||t instanceof Le||t instanceof Ue}cycleContainsPad(t,e,r=!1){for(let i of this.cycle)if(!t.has(i)&&!e.has(i)&&(i instanceof Le||r&&i instanceof Ue))return!0;return!1}reverse(){let t=new Array;for(let e=this.trunk.length-1;e>=0;e--)t.push(this.trunk[e]);this.trunk.length=0,t.forEach(e=>{this.trunk.push(e)})}};var zV=class{constructor(t,e,r){this.startIsLoop=null;this.endIsLoop=null;this._startIsLoop=0;this._endIsLoop=0;this.pathList=t,this.start=e,this.end=r}getFirst(){return this.pathList.getFirst()}getLast(){return this.pathList.getLast()}getLen(){let t=this.pathList.getAllItems(),e=0;return t.forEach(r=>{e+=r.length}),e}hasModel(t){return this.pathList.getAllItems().includes(t)}queryChannel(t){let e=this.getFirst().start,r=this.getLast().end,i=!0;return e.distance2(t)>r.distance2(t)&&(i=!1),i?this._startIsLoop:this._endIsLoop}queryChannelNext(t){let e=this.getFirst().start,r=this.getLast().end,i=r,n=this.startIsLoop;return e.distance2(t)>r.distance2(t)&&(n=this.endIsLoop,i=e),{nextConnectPoint:i,nextNode:n}}setNextSuccessChannel(t,e){if(t){if(this.startIsLoop)return;this.startIsLoop=e,this._startIsLoop=1}else{if(this.endIsLoop)return;this.endIsLoop=e,this._endIsLoop=1}}setNextFailChannel(t){t?this._startIsLoop=2:this._endIsLoop=2}},Wvt=At.getInstance(),t5=class o{static generateListByItem(t){if(!Jl.getInstance().hasItem(t.model))return[];if(t instanceof Ge){if(gT.getInstance().getLoopPathList(t))return[];let{startNode:e,endNode:r}=o.generateList2(t),n=Wvt.getNode(t.model).parent,s=new zV(n,e==null?void 0:e.model,r==null?void 0:r.model);return gT.getInstance().set(s),[s]}if(t instanceof Le||Ue){let e=t.searchNodeLoopType(),r=[];return e.forEach(i=>{i instanceof Ge&&r.push(...o.generateListByItem(i))}),r}return[]}static generateList(t,e){let r=At.getInstance(),i=t.tracks,n=t.pts,s=r.createList(),a=i.findIndex(d=>d==e),l=a;for(let d=a;d>=0&&!r.getNode(i[d].model);d--)l=d;let c=a;for(let d=a+1;d<i.length&&!r.getNode(i[d].model);d++)c=d;for(let d=l;d<=c;d++){let p=i[d],m=n[d];p.start=m.start(),p.end=m.end(),p instanceof yi&&m instanceof q&&(p.center=m.center,p.radius=m.rx,p.startAngle=zt.toRadians(m.startAngle),p.endAngle=zt.toRadians(m.endAngle()),p.sweep=m.sweep());let g=p.model;r.createNode(g,s)}let h,u;return l==0&&(s.startType=t.startType,h=t.start),c==i.length-1&&(s.endType=t.endType,u=t.end),{startNode:h,endNode:u}}static generateList2(t){let e=[t],r=[t],i=[!1],n=o.getConnectItem(e,i,r,t.end),s=[t],a=[t],l=[!1],c=o.getConnectItem(s,l,a,t.start);for(a.shift(),l.shift();a.length>0;){let u=a.shift(),d=l.shift();r.unshift(u),i.unshift(!d)}let h=r.map((u,d)=>{let p=u.primitive;return i[d]&&(p=pp(p)),p});return o.generateList({tracks:r,pts:h,startType:c.endNode?c.endNode instanceof Le?1:2:c.isMulti,endType:n.endNode?n.endNode instanceof Le?1:2:n.isMulti,start:c.endNode,end:n.endNode},t)}static getConnectItem(t,e,r,i){let s,a=null,l=Jl.getInstance(),c=new Set;for(;t.length>0;){let h=t.pop();c.add(h);let u=l.searchCycleNode(h),d=[],m=u.filter(P=>P instanceof Le||P instanceof Ue?!0:(c.has(P)||d.push(P),!1)).find(P=>i.distance2(P.center)<1e-4);if(m){s=m;break}let g,y=null;d.every(P=>{let T=null;return i.distance2(P.start)<1e-4?T=!0:i.distance2(P.end)<1e-4&&(T=!1),g&&T!=null?(a=11,!1):(T!=null&&(g=P,y=T),!0)})&&g&&(t.push(g),r.push(g),e.push(!y),i=y?g.end:g.start)}return{endNode:s,isMulti:a}}},e5=class e5{constructor(){this.map=new Map}static getInstance(){return e5.manager==null&&(e5.manager=new e5),e5.manager}set(t){let e=t.getFirst().globalIndex;this.map.set(e,t)}getLoopPathList(t){return this.getLoopPathListByModel(t.model)}getLoopPathListByModel(t){let e=At.getInstance().getNode(t);if(e){let i=e.parent.getFirst().globalIndex;return this.getLoopPathListById(i)}return null}update(t,e){let r=this.map.get(t);this.map.delete(t),this.map.set(e,r)}getLoopPathListById(t){return this.map.get(t)}getAllLoops(){return[...this.map.values()]}clear(){this.map.clear()}};e5.manager=null;var gT=e5;var nE=gT.getInstance(),Yce=class{constructor(t){this.curr=[];this.debug=new Jb;this.cycles=new Array;this.leaves=new Array;this.leaveHasPad=!1;this.currIdex=0;this.saveVias=[];this.sameNetData=[];this.antenna=[];if(this.sameNetData=[...t.getPathByNet(t.getNet())],this.split=t,this.start=this.start1=t.getStart(),this.end=this.end1=t.getEnd(),this.startNodes=this.split.getLoopStartNodes(),this.endNodes=this.split.getLoopEndNodes(),this.oldStartNodes=this.split.getOldStartNodes(),this.oldEndNodes=this.split.getOldEndNodes(),this.process=new Set,this.needCycle()){let r=[...this.startNodes].map(i=>{let n=nE.getLoopPathList(i);return this.process.add(n),n});for(let i of r)i&&this.DFS(i,r,this.start);Er(this.cycles,(i,n)=>i.cycle.size-n.cycle.size,0,this.cycles.length)}}needCycle(){let t=this.split.getOldPath();if(!t||t.length==0)return!0;let e=0,r=this.start,i=new Set,n=t.filter(l=>l instanceof Ue).map(l=>l.model);if(t.find(l=>{if(l instanceof Ge){let c=gT.getInstance().getLoopPathList(l);c&&i.add(c)}}),[...this.startNodes].forEach(l=>{let c=nE.getLoopPathList(l);i.has(c)||e++}),[...this.endNodes].forEach(l=>{let c=nE.getLoopPathList(l);i.has(c)||e++}),e>=2)return!0;let s=Array.from(i);return!s.every((l,c)=>{let h=this.getNodes(l,r,i),u=s[c+1];if(u){let d=l.getFirst().start.distance2(r)<l.getLast().end.distance2(r);r=d?l.getLast().end:l.getFirst().start;let p=u.getFirst().start,m=u.getLast().end,g=p.distance2(r)<m.distance2(r)?m:p,y=this.getNodes(u,g,i),b=Array.from(h);if(xe.addAll(b,y),b.find(T=>!!(h.includes(T)&&y.includes(T))))e++;else{let T=d?l.end:l.start;T&&!n.includes(T)&&(e+=2)}}return!(e>=2)})}updateTrunk(){let t=[];xe.addAll(t,this.startNodes),xe.addAll(t,this.oldStartNodes);let e=[];xe.addAll(e,this.endNodes),xe.addAll(e,this.oldEndNodes),this.cycles.forEach(r=>{r.getTrunk(t,e)})}removeLoopAntenna(t){this.antenna.forEach(e=>{let{connectItem:r,antenna:i}=e;r.every(s=>t.includes(s))&&i.forEach(s=>{s.forEach(a=>{this.addDebug(a,3)}),this.finishDebug(),this.split.deleteTracks(s,new Set)})})}removeAllLoopAntenna(){this.antenna.forEach(t=>{let{antenna:e}=t;e.forEach(r=>{r=r.filter(i=>!i.isEmpty),r.forEach(i=>{this.addDebug(i,3)}),this.finishDebug(),this.split.deleteTracks(r,new Set)})})}DFS(t,e,r){let i=!1;if(this.curr.push(t),this.isEnd(t)){let n=t.getFirst().start,s=t.getLast().end;if(n.distance2(this.end)<s.distance2(this.end)&&([n,s]=[s,n]),r.distance2(n)>r.distance2(s))i=!1;else{i=!0;let a=[...this.curr],l=[...this.getLoopPathData(a)];if(this.cycles.push(new lD(l,l,this.start,this.end)),this.debug!=null){for(let c of l)this.addDebug(c,1);Gr.debug&&(Gr.inputDebugGraphics(this.debug),this.debug=new Jb)}}}else{let n=this.getNodes(t,r,new Set([...this.curr,...e]));n.forEach(h=>{this.process.add(h)});let s=t.getFirst().start,a=t.getLast().end,l=s.distance2(r)<a.distance2(r),c=l?a:s;n.forEach(h=>{let u=h.queryChannel(c);u==0?this.DFS(h,n,c)&&(i=!0,t.setNextSuccessChannel(l,h)):u==1&&(i=!0,this.addCycleByChannel(this.curr,h,c)&&t.setNextSuccessChannel(l,h))}),i===!1&&t.setNextFailChannel(l),n.forEach(h=>{this.process.delete(h)})}return this.curr.pop(),i}addCycleByChannel(t,e,r){let i=[...t];for(;!this.isEnd(e);){i.push(e);let{nextConnectPoint:n,nextNode:s}=e.queryChannelNext(r);if(r=n,e=s,!e)return console.warn("loop find error"),!1}if(e){i.push(e);let n=[...this.getLoopPathData(i)];if(this.cycles.push(new lD(n,n,this.start,this.end)),this.debug!=null){for(let s of n)this.addDebug(s,1);Gr.debug&&(Gr.inputDebugGraphics(this.debug),this.debug=new Jb)}return!0}return!1}getNodes(t,e,r){let i=this.searchCycleNode(t,e),n=new Set;return i.forEach(s=>{let a=nE.getLoopPathList(s);a&&!r.has(a)&&!this.process.has(a)&&a!=t&&n.add(a)}),[...n]}searchCycleNode(t,e){let r=t.getFirst().start,i=t.getLast().end,n=r.distance2(e)<i.distance2(e),s=n?t.end||t.getLast():t.start||t.getFirst(),l=new Jt().getLoopNode(s.globalIndex);if(!l)return[];let c;if(l instanceof Ge){c=Jl.getInstance().searchCycleNodeTrack(l);let h=this.split.searchNode(l),u=n?i:r,d=n?r:i,p=Jl.getInstance().trackConnect(l),m=n?p.endConnect:p.startConnect;h.forEach(g=>{if(!c.includes(g)&&g instanceof Ge){if(!this.connectPoint(g,u,d))return;if(!m){c.push(g);return}let y=Jl.getInstance().trackConnect(g);y.startConnect&&y.endConnect||c.push(g)}})}else c=this.split.searchNode(l);return c.filter(h=>h instanceof Ge)}connectPoint(t,e,r){let i=t.start,n=t.end,s=i.distance2(e),a=n.distance2(e),l=i.distance2(r),c=i.distance2(r);return Math.min(s,a)<Math.min(l,c)}finishDebug(){Gr.debug&&(Gr.inputDebugGraphics(this.debug),this.debug=new Jb)}addDebug(t,e){if(this.debug!=null){let r;switch(e){case 1:r=ee.GREEN;break;case 2:r=ee.WHITE;break;case 3:r=ee.Golden;break}let i=null;t instanceof Ir?i=t.primitive:(t instanceof Le||t instanceof Ue)&&(i=new M(t.center,t.center)),i!=null&&this.debug.addLine(new Gn(i,{color:r,id:t.globalIndex}))}}isEnd(t){return!![...this.endNodes].find(e=>t.hasModel(e.model))}getLoopPathData(t){let e=this.start,r=new Jt,i=[],n=new Set;return t.forEach(s=>{let a=s.getFirst().start,l=s.getLast().end,c=[];if(s.start){let h=r.getLoopNode(s.start.globalIndex);if(c.push(h),!n.has(s.start)){let u=this.removeRing(h,s,a,!0);u.length&&n.add(s.start);for(let d of u){let p=r.getLoopNode(d.globalIndex);c.push(p)}}}if(s.pathList.getAllItems().forEach(h=>{let u=r.getLoopNode(h.globalIndex);c.push(u)}),s.end){let h=r.getLoopNode(s.end.globalIndex);if(c.push(h),!n.has(s.end)){let u=this.removeRing(h,s,l,!1);u.length&&n.add(s.start);for(let d of u){let p=r.getLoopNode(d.globalIndex);c.push(p)}}}a.distance2(e)>l.distance2(e)?(c.reverse(),e=a):e=l,i.push(...c)}),new Set(i)}removeRing(t,e,r,i=!0){let n=this.split.searchOtherNode(t);for(let s of n)if(s instanceof Ge){let a=nE.getLoopPathList(s);if(a.start==a.end&&a.start==t.model&&e!=a){let c=a.getFirst().start,h=a.getLast().end;if(c.distance2(r)<1e-4)return i?a.pathList.getAllItems().reverse():a.pathList.getAllItems();if(h.distance2(r)<1e-4)return i?a.pathList.getAllItems():a.pathList.getAllItems().reverse()}}return[]}modifyCycle(t){if(this.cycles.length>1){let e=new Set,r=this.cycles.map((p,m)=>(p.cycleContainsPad(this.oldStartNodes,this.oldEndNodes,!0)||e.add(m),[...p.cycle])),i=t,n=i[i.length-1],s=!1;(n instanceof Le||n instanceof Ue)&&(s=!0);let a=i[0],l=!1;if((a instanceof Le||a instanceof Ue)&&(l=!0),!this.cycleContainsPad()){this.cycles.length=0,this.curr.length=0,r.push(t),r.forEach(p=>{p.length!=0&&this.cycles.push(new lD(p,p,this.start,this.end))}),this.currIdex=this.cycles.length-1;return}let c=[],h=this.end;for(;!s;){let p,m=!0;for(let g=0;g<r.length;g++){let y=r[g];if(!e.has(g)&&(p||(p=y[y.length-1]),y[y.length-1]!=p)){m=!1;break}}m?(c.push(p),p instanceof Le||p instanceof Ue?(s=!0,h=p.center):(p.start.distance2(h)<p.end.distance2(h)?h=p.end:h=p.start,r.forEach((g,y)=>{e.has(y)||g.pop()}))):s=!0}this.end1=h,e.forEach(p=>{r[p].push(...c)}),t.push(...c),n=i[i.length-1];let u=this.start,d=[];for(;!l;){let p,m=!0;for(let g=0;g<r.length;g++){let y=r[g];if(!e.has(g)&&(p||(p=y[0]),y[0]!=p)){m=!1;break}}m?(d.unshift(p),p instanceof Le||p instanceof Ue?(l=!0,u=p.center):(p.start.distance2(u)<p.end.distance2(u)?u=p.end:u=p.start,r.forEach((g,y)=>{e.has(y)||g.shift()}))):l=!0}a=d[0],a==n?(d.shift(),r.forEach((p,m)=>{e.has(m)||p.unshift(...d.reverse())})):(e.forEach(p=>{r[p].unshift(...d)}),t.unshift(...d),this.start1=u),this.cycles.length=0,this.curr.length=0,r.push(t),r.forEach(p=>{p.length!=0&&this.cycles.push(new lD(p,p,this.start,this.end))}),this.currIdex=this.cycles.length-1}else this.cycles.push(new lD(t,t,this.start,this.end)),this.currIdex=this.cycles.length-1;console.log("-------------------"),this.cycles.forEach(e=>{let r=e.data.filter(i=>i instanceof Le);console.log(r.map(i=>i.num))}),console.log(this.cycles),console.log("-------------------")}getCanDelVia(t){let e=new Set;return this.cycles.forEach((r,i)=>{if(i==this.currIdex)return;let n=r.data;n.forEach((s,a)=>{if(s instanceof Ue){let l=n[a-1],c=n[a+1];l&&c&&(!t.has(l)||!t.has(c))&&e.add(s)}})}),e}cycleContainsPad(){for(let t of this.cycles)if(t.cycleContainsPad(this.oldStartNodes,this.oldEndNodes))return!0;return this.leaveHasPad}getLoopBranch(){this.leaveHasPad=!1;let t=this.getAllCycleId(),e=this.cycles[this.currIdex];this.startNodes.forEach(i=>{t.add(i.globalIndex)}),this.endNodes.forEach(i=>{t.add(i.globalIndex)});let r=new Set;this.generateLeaves(e,t,e,r),this.cycles.forEach(i=>{i!=e&&this.generateLeaves(i,t,e,r)})}generateLeaves(t,e,r,i){let n=0,s,a=!(r.data[0]instanceof Ge),l=!(r.data[r.data.length-1]instanceof Ge),c=!0;a&&!l&&(c=!1);let h=this.start1,u=t.data;c==!1&&(h=this.end1,u=[...u].reverse()),u.forEach((d,p)=>{let m;d instanceof Ge&&(m=nE.getLoopPathList(d));let g=!1;if(m&&(s?s!=m&&(g=!0):s=m),g){let y=this.getIntersection2(s,m,h,e),b=y.loop;h=y.start;let P=!0;this.process=new Set,b.forEach(I=>{this.process.add(I)});let T=[];if(b.forEach(I=>{let C=this.deleteLoopAntenna(I,new Set,e,h,T,i);P&&(P=C)}),t==r&&this.process.forEach(I=>{I.pathList.getAllItems().forEach(C=>{e.add(C.globalIndex)})}),T.length>0&&this.antenna.push({connectItem:[y.lastNode,y.currNode],antenna:T}),!P)if(t!=r){let I=p;this.leaves.push(u.slice(n,I))}else{let I=new Jt;b.forEach(C=>{if(C.start instanceof Ct){let E=I.getLoopNode(C.start.globalIndex);E&&this.saveVias.push(E)}if(C.end instanceof Ct){let E=I.getLoopNode(C.end.globalIndex);E&&this.saveVias.push(E)}})}s=m}})}getInter(t,e){let r=a(t),i=a(e),n=Number.MAX_VALUE,s;for(let l of r)for(let c of i){let h=l.distance2(c);h<n&&(s=l,n=h)}return s;function a(l){return l instanceof Ge?[l.start,l.end]:[l.center]}}deleteLoopAntenna(t,e,r,i,n,s){if(this.split.searchHasPoint(t))return this.leaveHasPad=!0,!1;s.add(t);let a=!0,l=t.getFirst().start,c=t.getLast().end,h,u;l.distance2(i)<c.distance2(i)?(h=c,u=t.end):(h=l,u=t.start),u&&u.modelType=="Pad"?this.leaveHasPad=!0:e.add(t);let d=this.getNodes(t,i,new Set([...e]));d=d.filter(m=>{let g=m.getFirst();return!r.has(g.globalIndex)}),d.forEach(m=>{this.process.add(m)});let p=!1;if(d.length>0&&(d=d.filter(m=>s.has(m)?(p=!0,!1):!0)),p)return!1;if(d.length>1||u){for(let m of d){let g=this.deleteLoopAntenna(m,new Set,r,h,n,s);a=a&&g}if(d.forEach(m=>{this.process.delete(m)}),u)return!1;if(a){let g=[...this.getLoopPathData([...e])].filter(y=>y instanceof Ge);if(g.length>0&&n.push(g),e.size>0)return!0}return!1}else if(d.length==1){let m=this.deleteLoopAntenna(d[0],e,r,h,n,s);return d.forEach(g=>{this.process.delete(g)}),m}else{let g=[...this.getLoopPathData([...e])].filter(y=>y instanceof Ge);return g.length>0&&n.push(g),e.size>0}}findTrack(t,e,r,i){if(this.split.searchHasPoint(t))return[];let n=t.getFirst().start,s=t.getLast().end,a,l;if(n.distance2(i)<s.distance2(i)?(a=s,l=t.end):(a=n,l=t.start),l)return[];e.add(t);let c=this.getNodes(t,i,new Set([...e]));return c=c.filter(h=>{let u=h.getFirst();return!(r.has(u.globalIndex)||e.has(h)||this.process.has(h))}),c.forEach(h=>{this.process.add(h)}),c.length>1?[]:c.length==1?this.findTrack(c[0],e,r,a):[...this.getLoopPathData([...e])].filter(d=>d instanceof Ge)}getAllCycleId(){let t=new Set;return this.cycles.forEach(e=>{e.data.forEach(r=>{t.add(r.globalIndex)})}),this.sameNetData.forEach(e=>{t.add(e.globalIndex)}),t}getIntersection2(t,e,r,i){if(t&&e){let s=new Set,a=t.getFirst().start,l=t.getLast().end,c,h,u=new Jt;a.distance2(r)<l.distance2(r)?(c=l,h=u.getLoopNode((t.end||t.getLast()).globalIndex)):(c=a,h=u.getLoopNode((t.start||t.getFirst()).globalIndex));let d=e.getFirst().start,p=e.getLast().end,m,g;d.distance2(c)<p.distance2(c)?(m=p,g=u.getLoopNode((e.start||e.getFirst()).globalIndex)):(m=d,g=u.getLoopNode((e.end||e.getLast()).globalIndex));let y=new Set(this.getNodes(t,r,new Set)),b=new Set(this.getNodes(e,m,new Set));for(let P of y){let T=P.getFirst().globalIndex;!i.has(T)&&b.has(P)&&s.add(P)}return{start:c,loop:[...s],lastNode:h,currNode:g}}return{loop:[],start:r}}isNeed(t){return t instanceof Ge||t instanceof Le||t instanceof Ue}getLeaves(){return this.leaves||[]}deleteAntenna(t){if(this.cycles.length==0)return;let e=this.getAllCycleId();t=t.filter(s=>s&&!s.isEmpty);let r=this.cycles[this.cycles.length-1],i=(r==null?void 0:r.data)||[];A.publish("updateRtree",""),this.clearProcess(),[...this.endNodes].forEach(s=>{let a=nE.getLoopPathList(s);this.process.add(a)}),i[0]instanceof Le||i[0]instanceof Ue?this.deleteAntenna2(i[0],e):this.deleteAntenna2(t[0],e),this.clearProcess(),[...this.startNodes].forEach(s=>{let a=nE.getLoopPathList(s);this.process.add(a)});let n=i[i.length-1];n instanceof Le||n instanceof Ue?this.deleteAntenna2(n,e,!1):this.deleteAntenna2(t[t.length-1],e,!1)}clearProcess(){this.process=new Set}deleteAntenna2(t,e,r=!0){if(A.publish("updateRtree",""),t instanceof Le||t instanceof Ue){let i=this.getNodes2(t,e).filter(s=>s instanceof Ge),n=new Set;i.forEach(s=>{if(!s||s.isEmpty)return;let a=nE.getLoopPathList(s);a&&n.add(a)}),this.deleteAntenna3([...n],e,t.center);return}if(t instanceof Ge){let n=(r?[...this.startNodes]:[...this.endNodes]).map(s=>nE.getLoopPathList(s));n=n.filter(s=>{let a=s.getFirst().globalIndex;return!e.has(a)}),n.length>1&&this.deleteAntenna3(n,e,r?this.start:this.end)}}getCurrMap(){let t=new Set;return this.cycles[this.currIdex].data.forEach(r=>{t.add(r.globalIndex)}),t}deleteAntenna3(t,e,r){this.process=new Set,t.forEach(i=>{i&&this.process.add(i)}),t.forEach(i=>{let n=this.findTrack(i,new Set,e,r);n.length>0&&(n.forEach(s=>{this.addDebug(s,2)}),this.finishDebug(),this.split.deleteTracks(n,e))})}connectOther(t){return[1,2,11].includes(t)}getNodes2(t,e){let r=this.split.searchNode(t),i=new Array;return r.forEach(n=>{!e.has(n.globalIndex)&&n!=t&&this.isNeed(n)&&i.push(n)}),this.filterNodes2(i,t)}filterNodes2(t,e){let r=new Array,i=new Array;return t.forEach(n=>{n instanceof Le||n instanceof Ue?r.push(n):i.push(n)}),r.length==0?i:[...r]}};var jce=class{constructor(t,e,r){this.dialogId="askRemoveLoopDialog";this.saveViaLoop=!1;this.popMsg=!0;this.debug=new Jb;this.canDelVias=new Set;this.commands=t,this.splitTrack=e,this.splitTrack.initCurr(),this.path=e.getPrimitivePath();let i=e.getStart(),n=e.getEnd(),s=e.getNet(),a=e.getStartLayerId(),l=e.getEndLayerId(),c=this.getNodes(i,a,s),h=this.getNodes(n,l,s);this.splitTrack.findOldPathByCurr(c,h),this.cycle=new Yce(e);let u=[...c].find(p=>p instanceof Le||p instanceof Ue),d=[...h].find(p=>p instanceof Le||p instanceof Ue);console.log(this.cycle.cycles),this.getPathNode(e,u,d),!(this.cycle.cycles.length==0&&!r)&&(this.cycle.modifyCycle(this.pathNode),this.pathNode.forEach(p=>{this.addDebug(p)}),this.finishDebug(),this.cycle.getLoopBranch(),this.cycle.updateTrunk(),this.getCanDelVias())}getCanDelVias(){let t=this.cycle.cycles[this.cycle.currIdex],e=new Set(t.data);this.canDelVias=this.cycle.getCanDelVia(e)}getSaveVia(){return this.cycle.saveVias}addDebug(t){if(this.debug!=null){let e=null;t instanceof Ir?e=t.primitive:(t instanceof Le||t instanceof Ue)&&(e=new M(t.center,t.center)),e!=null&&this.debug.addLine(new Gn(e,{color:ee.BLUE,id:t.globalIndex}))}}finishDebug(){Gr.debug&&(Gr.inputDebugGraphics(this.debug),this.debug=new Jb)}getPathNode(t,e,r){let i=t.getOldPath();if(i&&i.length>0){this.pathNode=[...i],e&&this.pathNode.unshift(e),r&&this.pathNode.push(r);return}let n=this.getCurrentPath(this.cycle);this.pathNode=[...n.data]}removeLoop(t=!1){let e=!0;if(this.cycle.cycles.length>1){let r=this.cycle.cycles[this.cycle.currIdex],i=this.cycle.currIdex||this.cycle.cycles.indexOf(r);if(this.popMsg&&this.needRemoveLoop()&&this.cycle.cycleContainsPad()){let s=[],a=0,l=0,c=this.getNextSelect(a,l,this.cycle,i);a=c.i,l=c.j,s=c.result,this.highLightItems(s),this.openRemoveLoopBox(a,l,this.cycle,s,i,t),e=!1}else{let s=new Set,a=pYe(this.cycle,i);if(a){let{saves:c,deleteItems:h}=a;h.forEach(u=>{let d=!0;this.saveViaLoop&&u.find(m=>m instanceof Ue)&&(d=!1),d&&u.forEach(p=>{!p.locked&&!c.has(p)&&s.add(p)})})}else this.cycle.cycles.forEach((c,h)=>{if(h!=i){let d=this.getSelect(h,0,this.cycle,i),p=!0;this.saveViaLoop&&d.find(g=>g instanceof Ue)&&(p=!1),p&&d.forEach(m=>{r.cycle.has(m)||s.add(m)})}});let l=[...s];this.deleteSelect(l)}let n=this.splitTrack.getNet();A.publish("updateNets",{updateNetLength:{[n]:Ye.getNetLength(n)}},Q())}return e}needRemoveLoop(){let t=0;this.cycle.cycles.forEach(n=>{t+=n.trunk.length});let e=0,r=0,i=0;for(let n=0;n<t;n++){let s=this.getNext(r,i,this.cycle);if(r=s.i,i=s.j,this.getSelect(r,i,this.cycle,this.cycle.currIdex).length>0&&e++,e>=2)break}return e>=2}hasVia(t){return!![...t].find(e=>e instanceof Ue)}getSelect(t,e,r,i){let n=this.cycle.cycles[t].trunk[e];if(t!=i){let s=r.cycles[i],a=new Array;for(let l of n)!l.locked&&!l.isEmpty&&s.data.indexOf(l)<0&&a.push(l);return this.saveViaLoop&&a.find(l=>l instanceof Ue)?[]:a}return[]}getFirstCycle(t,e){let r=this.cycle.cycles.length;return r>1&&this.cycle.cycles[t]==e?(t++,t==r?0:this.getFirstCycle(t,e)):t}reverse(t){this.cycle.cycles.forEach(e=>{t!=e&&e.reverse()})}removeLeave(){this.cycle.deleteAntenna(this.pathNode),this.cycle.removeAllLoopAntenna()}getDeleteItems(t,e){let r=new Set;return t.forEach(i=>{!i.isEmpty&&!(i instanceof Le)&&!e.cycle.has(i)&&!i.locked&&r.add(i)}),r}deleteSelect(t){let e=this.getSaveVia();t=t.filter(r=>r instanceof Ue?!e.includes(r)&&this.canDelVias.has(r):!0),t.forEach(r=>{!(r instanceof Le)&&!r.isEmpty&&r.getParent()==null&&(this.commands!=null&&(this.commands.addCommand(Ce.dispatch(r,"delete")),A.publish("hasModifyPcbItem",r)),r.remove(),A.publish("delete",r))}),this.cycle.removeLoopAntenna([...t])}getNext(t,e,r){let i=r.cycles[t].trunk.length,n=r.cycles.length;return e+1<i?(e++,{i:t,j:e}):(t++,e=0,t>=n&&(t=0),{i:t,j:e})}highLightItems(t){let e=this.getSaveVia();t=t.filter(r=>!e.includes(r)),t.forEach(r=>{r.click()})}cancelItems(t){t.forEach(e=>{e.visible()})}openRemoveLoopBox(t,e,r,i,n,s=!1){let a=new JA("Confirm","confirm"),l=new JA("Next segment","next"),c=new JA("Ignore","ignore"),h=new WV("There is a loop, whether to remove the picked loop segment.",[a,l,c],(u,d)=>{if(this.popMsg=!d,u=="confirm")this.deleteSelect(i),d&&(ds.getInstance().autoLoopUpMsgBox=this.popMsg),s&&A.publish("flushService","");else if(u=="next"){this.cancelItems(i);let{i:p,j:m,result:g}=this.getNextSelect(t,e,r,n);if(i=g,this.highLightItems(i),i.length>0){let y=ys(i);if(y.valid()){let b=y.build1(),P=Jx();if(!b.isInside(P)){let T=new _e().ext1(b).ext1(P).build1();A.publish("adaptBBox",T)}}}this.openRemoveLoopBox(p,m,r,i,n,s)}else(u=="ignore"||u=="cancel"||u=="close"||u==null)&&(d&&(ds.getInstance().autoLoopUpMsgBox=this.popMsg),this.cancelItems(i),s&&A.publish("flushService",""))},3,this.dialogId,!this.popMsg,400);setTimeout(()=>{A.publish("openMsgbox",h)})}getNextSelect(t,e,r,i){let n=[],s,a,l=0;this.cycle.cycles.forEach(h=>{l+=h.trunk.length});let c=0;for(;n.length==0&&!(c>l);){let h=this.getNext(t,e,r);s=h.i,a=h.j,n=this.getSelect(s,a,this.cycle,i),t=s,e=a,c++}return{i:s,j:a,result:n}}getNodes(t,e,r){let n=this.searchNodes(t,e,r);for(let s of n)if(s instanceof Le||s instanceof Ue)return new Set([s]);return n}searchNodes(t,e,r){let i=new Set,n=this.splitTrack.getConnectItemsByBbox(new ht(t.x,t.x,t.y,t.y),{net:r,layer:e});for(let s of n)if(s.isSelect(t.x,t.y)){if(s instanceof Le)return new Set([s]);if(s instanceof Ge)i.add(s);else if(s instanceof Ue)return new Set([s])}return i}static getNodesByPoint(t,e,r,i){return t.getConnectItemsByBbox(new ht(e.x,e.x,e.y,e.y),{net:i,layer:r}).filter(s=>s instanceof Ge)}getCurrentPath(t,e){let r=0,i=null;return t.cycles.forEach(n=>{let s=this.equals(n.data);(s>r||Aee(s,r)&&r!=0&&n.data.length<i.data.length)&&(r=s,i=n)}),e?r>e?i:null:(i==null&&Array.isArray(t.cycles)&&(i=t.cycles[0]),i)}equals(t){let e=this.splitTrack.getStart(),r=this.getPrimitive(t,e),i=this.path;return new Uce(i,r).similarity}getPrimitive(t,e){let r=new Array;for(let i of t)if(i instanceof Ge){let n=i.primitive,s=n.start().distance2(e),a=n.end().distance2(e);if(s<a)r.push(n),e=n.end();else{let l=pp(n);r.push(l),e=n.start()}}return r}};var iEe=At.getInstance(),r5=gT.getInstance(),Xce=class{constructor(t,e,r){this.debug=null;if(r5.clear(),this.oldStartNodes=t,this.oldEndNodes=e,this.split=r,this.start=r.getStart(),this.end=r.getEnd(),this.init(t,e),this.startNodes=this.getTracks(t,this.start),this.endNodes=this.getTracks(e,this.end),this.debug=new Jb,this.debug!=null){for(let i of this.startNodes)this.addDebug(i,1);Gr.debug&&(Gr.inputDebugGraphics(this.debug),this.debug=new Jb)}if(this.debug!=null){for(let i of this.endNodes)this.addDebug(i,1);Gr.debug&&(Gr.inputDebugGraphics(this.debug),this.debug=new Jb)}this.updateLoopEnd(),this.breakInit(),this.breakLoopList2(r5.getAllLoops())}initPadSplit(t){for(let e of t)if(e instanceof Le||e instanceof Ue){let r=this.split.searchNode(e);for(let i of r)i instanceof Ir&&(e.isSelect(i.start.x,i.start.y)||e.isSelect(i.end.x,i.end.y)||this.split.splitTrack3(i,[],[e]))}}needSplitByPad(t,e){if(t.isSelect(e.start.x,e.start.y)||t.isSelect(e.end.x,e.end.y))return!0;let r=new M(t.center,t.center),n=new er(e.primitive,r).getLine(),s=n.start();return n.start().equals(t.center)&&(s=n.end()),e.start.equals(s)||e.end.equals(s)}updateLoopEnd(){let t=new Set,e=r5.getAllLoops(),r=new Jt;e.forEach(i=>{i.pathList.getAllItems().forEach(s=>{let a=r.getLoopNode(s.globalIndex);this.split.searchNode(a).filter(c=>c instanceof Le||c instanceof Ue).forEach(c=>{if(t.has(c.globalIndex))return;let h=this.split.searchNode(c);h=h.filter(m=>this.needSplitByPad(c,m.model));let u=[];h=h.filter(m=>{let g=m.start.equals(c.center),y=m.end.equals(c.center);return g&&this.breakStart(m.model,c),y&&this.breakEnd(m.model,c),g||y?(u.push(m),!1):!0}),h=this.filterConnect(u,h);let d=[];h=h.filter(m=>{let g=Jl.getInstance().trackConnect(m),y=g.startConnect,b=g.endConnect,P=!1;return!y&&c.isSelect(m.start.x,m.start.y)&&(this.breakStart(m.model,c),P=!0),!b&&c.isSelect(m.end.x,m.end.y)&&(this.breakEnd(m.model,c),P=!0),P?(d.push(m),!1):!0}),h=this.filterConnect(d,h);let p=c.center;for(Er(h,(m,g)=>{let y=m.start.distance2(p)<m.end.distance2(p)?m.start:m.end,b=g.start.distance2(p)<g.end.distance2(p)?g.start:g.end;return y.distance2(p)-b.distance2(p)},0,h.length);h.length>0;){let m=h.shift();h=this.filterConnect2(m,h,p),m.start.distance2(p)>m.end.distance2(p)?this.breakEnd(m.model,c):this.breakStart(m.model,c)}t.add(c.globalIndex)})})})}breakInit(){let t=[...this.oldStartNodes].find(r=>r instanceof Le||r instanceof Ue);this.startNodes.forEach(r=>{r.start.distance2(this.start)<r.end.distance2(this.start)?this.breakStart(r.model,t):this.breakEnd(r.model,t)});let e=[...this.oldEndNodes].find(r=>r instanceof Le||r instanceof Ue);this.endNodes.forEach(r=>{r.start.distance2(this.end)<r.end.distance2(this.end)?this.breakStart(r.model,e):this.breakEnd(r.model,e)})}breakLoopList2(t){t.forEach(r=>{r.start||this.splitLoopByEnd(r,!0),r.end||this.splitLoopByEnd(r,!1)});let e=new Jt;t.forEach(r=>{r.pathList.getAllItems().forEach(n=>{if(n instanceof Ii)return;let s=e.getLoopNode(n.globalIndex);if(s){let a=[],l=this.split.searchOtherNode(s).filter(c=>{if((c instanceof Ue||c instanceof Le)&&!this.needSplitByPad(c,n))return!0;if(c instanceof Ge){let h=Jl.getInstance().trackConnect(c);if(!h.startConnect){let u=c.start;new er(new M(u,u),n.primitive).getDistance()>(n.width+c.width)/2||a.push({point:u,isStart:!0,track:c.model})}if(!h.endConnect){let u=c.end;new er(new M(u,u),n.primitive).getDistance()>(n.width+c.width)/2||a.push({point:u,isStart:!1,track:c.model})}}return!1});this.splitTrack(s,a,l)}})})}splitLoopByEnd(t,e){let r,i;e?(i=t.pathList.getFirst(),r=i.start):(i=t.pathList.getLast(),r=i.end);let s=new Jt().getLoopNode(i.globalIndex);Jl.getInstance().searchCycleNodeTrack(s).forEach(l=>{let c;l.start.distance2(r)<1e-4&&(c=!0),l.end.distance2(r)<1e-4&&(c=!1),c===!0?this.breakStart(l.model):c==!1&&this.breakEnd(l.model)})}splitTrack(t,e,r){let i=r5.getLoopPathList(t),n=t.model,s=this.split.splitTrack3(t,e,r);if(s){let a=new Zr,l=i;if(!l)return;let{newTracks:c,points:h,isReplace:u}=s;if(u){this.replacePoint(t,c);let d=n.globalIndex;l.getFirst()==n&&r5.update(d,c[0].globalIndex);let p=a.createList();c.forEach(g=>{a.addList(g.model,p,new Lr)});let m=iEe.getNode(n);p.replace(m,m)}for(let d of c)for(let p of h){let m=p.point;if(d.start.equals(m)){this.breakStart(d.model,p.end),p.end=null;continue}if(d.end.equals(m)){this.breakEnd(d.model,p.end),p.end=null;break}}}}replacePoint(t,e){if(this.startNodes.has(t))if(this.startNodes.delete(t),e.length>1){let r=this.start.distance2(t.start)<this.start.distance2(t.end)?t.start:t.end;r.equals(e[0].start)||r.equals(e[0].end)?this.startNodes.add(e[0]):this.startNodes.add(e[e.length-1])}else this.startNodes.add(e[0]);if(this.endNodes.has(t))if(this.endNodes.delete(t),e.length>1){let r=this.end.distance2(t.start)<this.end.distance2(t.end)?t.start:t.end;r.equals(e[0].start)||r.equals(e[0].end)?this.endNodes.add(e[0]):this.endNodes.add(e[e.length-1])}else this.endNodes.add(e[0])}breakStart(t,e){let r=r5.getLoopPathListByModel(t);if(!r)return;let i=iEe.getNode(t),n=i.parent;if(i==n.getFirstNode()){r.start=r.start||(e==null?void 0:e.model);return}let a=new Zr().createList();a.replace(i,n.getLastNode());let l=new zV(a,e==null?void 0:e.model,r.end);return r.end=e==null?void 0:e.model,gT.getInstance().set(l),l}breakEnd(t,e){let r=r5.getLoopPathListByModel(t);if(!r)return;let i=iEe.getNode(t),n=i.parent;if(i==n.getLastNode()){r.end=r.end||(e==null?void 0:e.model);return}let a=new Zr().createList();a.replace(i.next,n.getLastNode());let l=new zV(a,e==null?void 0:e.model,r.end);return r.end=e==null?void 0:e.model,gT.getInstance().set(l),l}addDebug(t,e){if(this.debug!=null){let r;switch(e){case 1:r=ee.GREEN;break;case 2:r=ee.WHITE;break;case 3:r=ee.Golden;break}let i=null;t instanceof Ir?i=t.primitive:(t instanceof Le||t instanceof Ue)&&(i=new M(t.center,t.center)),i!=null&&this.debug.addLine(new Gn(i,{color:r,id:t.globalIndex}))}}init(t,e){this.initPadSplit(t),this.initPadSplit(e),t.forEach(r=>{this.generateLoopLists(r)}),e.forEach(r=>{this.generateLoopLists(r)})}generateLoopLists(t){let e=new Jt,r=t5.generateListByItem(t);for(;r.length>0;){let i=r.pop(),n=i.end;if(n){let a=e.getLoopNode(n.globalIndex);a&&this.split.searchNode(a).filter(c=>this.isNeed(c)).forEach(c=>{let h=t5.generateListByItem(c);r.push(...h)})}let s=i.start;if(s){let a=e.getLoopNode(s.globalIndex);a&&this.split.searchNode(a).filter(c=>this.isNeed(c)).forEach(c=>{let h=t5.generateListByItem(c);r.push(...h)})}i.pathList.getAllItems().forEach(a=>{let l=e.getLoopNode(a.globalIndex);l&&this.split.searchNode(l).filter(h=>this.isNeed(h)).forEach(h=>{let u=t5.generateListByItem(h);r.push(...u)})})}}isNeed(t){return t instanceof Ge||t instanceof Le||t instanceof Ue}getTracks(t,e){let r=new Set;return t.forEach(i=>{i instanceof Ge?r.add(i):this.split.searchNode(i).forEach(n=>{n instanceof Ge&&r.add(n)})}),this.filterNodes3([...r],e)}filterNodes3(t,e){let r=[],i=[],n=t.filter(s=>s.start.equals(e)||s.end.equals(e)?!0:(i.push(s),!1));for(r=[...n],i=this.filterConnect(n,i),Er(i,(s,a)=>{let l=s.start.distance2(e)<s.end.distance2(e)?s.start:s.end,c=a.start.distance2(e)<a.end.distance2(e)?a.start:a.end;return l.distance2(e)-c.distance2(e)},0,i.length);i.length>0;){let s=i.shift();i=this.filterConnect2(s,i,e),r.push(s)}return new Set(r)}filterConnect(t,e){for(;t.length>0;){let r=[];t=e.filter(i=>t.find(s=>!!(s.start.equals(i.start)||s.start.equals(i.end)||s.end.equals(i.start)||s.end.equals(i.end)))?!0:(r.push(i),!1)),e=r}return e}filterConnect2(t,e,r){let i=[t],n=t.start,s=t.end;for(t.start.distance2(r)>t.end.distance2(r)&&(n=t.end,s=t.start);i.length>0;){let a=[];i=e.filter(l=>i.find(h=>!!(s.equals(l.start)||s.equals(l.end)))?!0:(a.push(l),!1)),e=a}return e}};var nEe=class{constructor(t){this.inters=new Array;this.interSet=new Ta;this.track=t}addInter(t){!this.interSet.contains(t)&&t.distance2(this.track.start)>1e-8&&t.distance2(this.track.end)>1e-8&&(this.inters.push(t),this.interSet.add(t))}},qce=class extends Ei{constructor(){super(...arguments);this.idMap={};this.tracks=new Array;this.arcTrack=new Array;this.result=new Array;this.modifyTracks=new Set;this.replaceTracks={}}update(e){let r="updateConnectRelation-time-loop";Cn(r),this.removeCoincide(e),this.splitTrack(e),this.removeCoincide(e),this.removeZeroLengthTrack(e),this.clear(),Xi(r,.05)}splitTrack(e){for(let r of e)r instanceof ke?(r.getPads().forEach(s=>{this.dispatch(s,e)}),r.getVias().forEach(s=>{this.dispatch(s,e)})):this.dispatch(r,e);for(let r of this.modifyTracks)this.dispatch(r,e,!1);this.modifyTracks.clear(),this.split()}removeCoincide(e){e.forEach(r=>{r instanceof Ge&&this.autoRemoveCoincide(r)}),this.tracks.forEach(r=>{this.autoRemoveCoincide(r)})}removeZeroLengthTrack(e){for(let r of e)r instanceof Ge&&!r.isEmpty&&r.length<.01&&this.removeTrack1(r,[])}clear(){this.tracks.length=0,this.arcTrack.length=0,this.result.length=0,this.idMap={}}dispatch(e,r,i=!0){e.isEmpty||(e instanceof Le?this.dispatchPad(e,[...r]):e instanceof Ge?this.dispatchTrack(e,[...r],i):e instanceof Ue&&this.dispatchVia(e,[...r]))}dispatchPad(e,r){let i=Jl.getInstance().searchNode(e);for(let n of i)n instanceof Ge&&this.splitPadTrack(n,e)}dispatchTrack(e,r,i=!0){let n=Jl.getInstance().searchNode(e);for(let s of n)s instanceof Le?this.splitPadTrack(e,s):s instanceof Ge?this.splitTracks(e,s,i):s instanceof Ue&&this.splitViaTrack(e,s)}dispatchVia(e,r){let i=Jl.getInstance().searchNode(e);for(let n of i)n instanceof Ge&&this.splitViaTrack(n,e)}splitPadTrack(e,r){if(!e.isEmpty&&!r.isEmpty&&!r.isSelect4Layer(e.start.x,e.start.y,e.layerId)&&!r.isSelect4Layer(e.end.x,e.end.y,e.layerId)&&e.isSelect(r.center.x,r.center.y)){if(e instanceof yi){let i=r.center.sub(e.center).normalize(),n=new M(e.center,r.center.add(i.mul(e.radius))),s=e.primitive,a=Pt(n,s),l=s.bbox();if(a>0){let c=this.getSide(e);for(let h=0;h<a;h+=2){let u=new S(Ee[h],Ee[h+1]);l.isContains(u)&&c.addInter(u)}}}else if(e instanceof Ir){let i=e.primitive,n=i.bbox(),s=er.foot(i,r.center);s!=null&&n.isContains(s)&&s.distance1(r.center)<Math.min(.01,e.width/2)&&this.getSide(e).addInter(s)}}}getTrackConnectState(e){let r=Jl.getInstance().trackConnect(e),i=!r.startConnect,n=!r.endConnect;return i&&n?0:i&&!n?1:!i&&n?2:3}modifyTrack(e,r,i){let n=e.track,s=r.track,a=s.end.sub(s.start),l=this.getLine(n.start,n.end),c=er.foot(l,s.start),h=null,u=Jl.getInstance().trackConnect(e.track),d=!u.startConnect,p=!u.endConnect;if(!d&&(c.equals1(e.track.start)||c.add(a).equals1(e.track.start)))return h;if(!p&&(c.equals1(e.track.end)||c.add(a).equals1(e.track.end)))return h;let m=n.primitive.bbox();switch(i){case 0:{h=Ce.dispatch(s,"modify"),s.start=c,s.end=c.add(a),m.isContains(c)&&e.addInter(c),m.isContains(s.end)&&e.addInter(s.end);break}case 1:{h=Ce.dispatch(s,"modify"),s.start=c,m.isContains(c)&&e.addInter(c);break}case 2:{h=Ce.dispatch(s,"modify"),s.start=c,s.end=c.add(a),m.isContains(s.end)&&e.addInter(s.end);break}default:}return h}splitTracks(e,r,i=!0){if(e.isEmpty||r.isEmpty)return;let n=null;if(e instanceof Ir&&r instanceof Ir){let u=e.direct,d=r.direct;if(Math.abs(u.cross(d))<.001&&e.length>.001&&r.length>.001){let m=Math.min(e.width,r.width)/4,g=this.getLine(e.start,e.end);if(er.foot(g,r.start).distance1(r.start)<m){let b=this.getTrackConnectState(e),P=this.getTrackConnectState(r),T=this.getSide(e),I=this.getSide(r);if(b<3&&T.inters.length==0)if(i){this.modifyTracks.add(T.track);return}else n=this.modifyTrack(I,T,b);else if(P<3&&I.inters.length==0)if(i){this.modifyTracks.add(I.track);return}else n=this.modifyTrack(T,I,P)}}}let s=e.primitive,a=r.primitive,l=Pt(s,a),c=s.bbox(),h=a.bbox();if(l>0){qe.stack!=null&&n!=null&&qe.stack.addCommand(n);let u=this.getSide(e),d=this.getSide(r);for(let p=0;p<l;p+=2){let m=new S(Ee[p],Ee[p+1]);c.isContains(m)&&u.addInter(m),h.isContains(m)&&d.addInter(m)}}else n!=null&&n.undo()}splitViaTrack(e,r){if(!e.isEmpty&&!r.isEmpty&&!r.isSelect(e.start.x,e.start.y)&&!r.isSelect(e.end.x,e.end.y)&&e.isSelect(r.center.x,r.center.y)){if(e instanceof yi){let i=r.center.sub(e.center).normalize(),n=new M(e.center,r.center.add(i.mul(e.radius))),s=e.primitive,a=Pt(n,s),l=s.bbox();if(a>0){let c=this.getSide(e);for(let h=0;h<a;h+=2){let u=new S(Ee[h],Ee[h+1]);l.isContains(u)&&c.addInter(u)}}}else if(e instanceof Ir){let i=e.primitive,n=er.foot(i,r.center),s=i.bbox();n!=null&&s.isContains(n)&&n.distance1(r.center)<Math.min(.01,e.width/2)&&this.getSide(e).addInter(n)}}}getSide(e){let r=this.idMap[e.globalIndex];return r==null&&(r=new nEe(e),this.idMap[e.globalIndex]=r),r}split(){Object.values(this.idMap).forEach(r=>{if(r.track instanceof Ir&&r.inters.length>0){Er(r.inters,(l,c)=>l.distance2(r.track.start)-c.distance2(r.track.start),0,r.inters.length),r.inters.push(r.track.end);let i=r.track.start,n=r.track.layerId,s=r.track.width,a=[];r.inters.forEach(l=>{if(!l.equals1(i)){let c=pr.addTrack(n,i,l,s,r.track.locked,r.track.net);c.updateFilterVisible=!0,c.visible(),this.joinCombination([c],r.track.getGroupID()),this.addTrack(c),a.push(c),i=l}}),xe.addAll(this.tracks,a),this.removeTrack1(r.track,a)}else if(r.track instanceof yi&&r.inters.length>0){an(r.inters,r.track.primitive),r.inters.push(r.track.end);let i=r.track.start,n=r.track.layerId,s=r.track,a=r.track.width,l=s.startAngle,c=[];r.inters.forEach(h=>{if(!h.equals1(i)){let u=h.angle(s.center),d=pr.addArcTrack(n,s.center,s.radius,l,u,s.sweep,a,s.locked,s.net,s.arcType);d.updateFilterVisible=!0,d.visible(),this.joinCombination([d],r.track.getGroupID()),this.addTrack(d),c.push(d),i=h,l=u}}),xe.addAll(this.arcTrack,c),this.removeTrack1(r.track,c)}})}joinCombination(e,r){Ht.getItem(r)!=null&&Ht.joinCombination(e,r)}addTrack(e){qe.stack!=null&&(e.partition=R.getInstance().partitionId,qe.stack.addCommand(Ce.dispatch(e,"add"))),A.publish("hasModifyPcbItem",e)}removeTrack(e){qe.stack!=null&&qe.stack.addCommand(Ce.dispatch(e,"delete")),e.remove(),A.publish("delete",e)}autoRemoveCoincide(e){if(e.isEmpty)return;if(e.length<.001){this.removeTrack(e);return}let r=Jl.getInstance().searchTrackConnectTrack(e);for(let i of r)if(this.checkCoincide(e,i))if(i instanceof Ir)if(i.width<e.width)this.removeTrack1(i,[e]);else if(i.width==e.width)if(i.length>e.length){this.removeTrack1(e,[i]);return}else this.removeTrack1(i,[e]);else{this.removeTrack1(e,[i]);return}else this.removeTrack1(e,[i])}removeTrack1(e,r){let i=this.replaceTracks[e.globalIndex];i||(i=this.replaceTracks[e.globalIndex]=new Set),r.forEach(n=>{i.add(n.globalIndex)}),this.removeTrack(e)}checkTrackCoincide(e,r){if(e instanceof Ge&&r instanceof Ge){if(e.start.similarEquals(r.start,1e-5)&&e.end.similarEquals(r.end,1e-5))return!0;if(e.start.similarEquals(r.end,1e-5)&&e.end.similarEquals(r.start,1e-5))return!0}return!1}checkArcTrackCoincide(e,r){if(e instanceof yi&&r instanceof yi&&e.center.similarEquals(r.center,1e-5)&&Aee(e.radius,r.radius)&&e.model.primitive.isLarge()===r.model.primitive.isLarge()){if(e.start.similarEquals(r.start,1e-5)&&e.end.similarEquals(r.end,1e-5))return!0;if(e.start.similarEquals(r.end,1e-5)&&e.end.similarEquals(r.start,1e-5))return!0}return!1}checkCoincide(e,r){return e.isEmpty||r.isEmpty?!1:!!(e instanceof Ir&&r instanceof Ir&&this.checkTrackCoincide(e,r)||e instanceof yi&&r instanceof yi&&this.checkArcTrackCoincide(e,r))}getLine(e,r){let i=r.sub(e).normalize().mul(1e3);return new M(e.sub(i),r.add(i))}};var $ce=class{constructor(t){this.split=new Set;this.oldPath=[];this.saveVia=new Set;this.currIndex=0;this.paths=[];this.replaceTracks={};this.command=t}clearSplit(){this.split.clear()}setCurrIndex(t){this.currIndex=t}getStart(){return this.getPathInfo().path.find(e=>e!=null).start()}getEnd(){let t=this.getPathInfo().path;for(let e=t.length-1;e>=0;e--)if(t[e])return t[e].end()}init(t){this.paths=t}getPrimitivePath(){return this.getPathInfo().path.filter(t=>t!=null)}getStartLayerId(){return this.paths[this.currIndex].tracks.find(t=>t!=null).layer}getEndLayerId(){let t=this.paths[this.currIndex].tracks;for(let e=t.length-1;e>=0;e--)if(t[e])return t[e].layer}getNet(){return this.getNetByIndex(this.currIndex)}getNetByIndex(t){return this.paths[t].net}getWidth(){var t;return(t=this.paths[this.currIndex].tracks.find(e=>{if(e)return!0}))==null?void 0:t.width}getNeedSaveVia(){return this.saveVia}getPathInfo(){return this.paths[this.currIndex]}getOldPath(){return this.oldPath[this.currIndex]}getPathByNet(t){let e=[];return this.oldPath.forEach((r,i)=>{if(i==this.currIndex)return;let n=this.getNetByIndex(i);r&&t==n&&e.push(...r)}),new Set(e)}initCurr(){let t=this.currIndex,e=this.paths[t],r=[],{path:i,tracks:n,net:s}=e;if(i.forEach((m,g)=>{if(m==null){this.saveVia.add(n[g].id);return}let y=this.getTrackById(n[g].id);for(let b of y)b&&r.push(b)}),r.length==0)return;let a=r[0],l=r[r.length-1],c=Jl.getInstance().getRatlineNet(),h=!c||c.net!=s,u=Jl.getInstance().init(s,r,a.model,l.model);h&&(this.replaceTracks={},c=Jl.getInstance().getRatlineNet()),c.hasExceed()?this.nets=c:this.nets=null;let d=new qce;d.update(u.filter(m=>m instanceof Ge));let p=d.replaceTracks;Object.assign(this.replaceTracks,p);for(let m in p)this.setReplaceTrack(m,p[m]);this.pointSplitTracks(a.start,{net:s,width:a.width,layer:a.layerId}),this.pointSplitTracks(l.end,{net:s,width:l.width,layer:l.layerId})}setReplaceTrack(t,e){this.nets&&this.nets.setReplaceTrack(t,e)}getTrackById(t){let e=new Jt,r=e.getLoopNode(t),i=[];if(r)return[r];{let n=new Set,s=Array.from(this.replaceTracks[t]||[])||[];for(;s.length>0;){let a=s.shift();if(!n.has(a))if(n.add(a),this.replaceTracks[a])xe.addAll(s,this.replaceTracks[a]);else{let l=e.getLoopNode(a);i.push(l)}}}return i}findOldPathByCurr(t,e){this.loopTool=new Xce(t,e,this);let r=this.currIndex,i=this.paths[r],n=this.getPath2(i);this.oldPath[r]=n;let s=this.getNetByIndex(r);for(let a=r+1;a<this.paths.length;a++)if(this.getNetByIndex(a)==s){let c=this.getPath2(this.paths[a]);this.oldPath[a]=c}}getLoopStartNodes(){return this.loopTool.startNodes}getLoopEndNodes(){return this.loopTool.endNodes}getOldStartNodes(){return this.loopTool.oldStartNodes}getOldEndNodes(){return this.loopTool.oldEndNodes}getPath2(t){let{path:e,tracks:r,net:i}=t,n=[];return e.forEach((s,a)=>{if(s==null){let u=new Jt().getLoopNode(r[a].id);u&&n.push(u);return}let l=this.getTrackById(r[a].id);l[0]&&xe.addAll(n,l)}),n}pointSplitTracks(t,e){let r=this.getConnectItemsByTrackPoint(t,e).filter(i=>i instanceof Ir);this.splitTracksByPoint(r,t)}splitTracksByPoint(t,e){t.forEach(r=>{if(LP(r.primitive,e)>0)e.equals(r.start)||e.equals(r.end)||this.changeTrack(r,[e],this.command);else{let n=new er(r.primitive,new M(e,e)),s=e,a=n.getLine();n.getDistance()<r.width/2&&(s=a.start().equals(e)?a.end():a.start(),s.equals(r.start)||s.equals(r.end)||this.changeTrack(r,[s],this.command))}})}splitTrack3(t,e,r){let i=[];if(e.forEach(n=>{let a=new er(t.primitive,new M(n.point,n.point)).getLine(),l=a.start(),c=a.end();LP(t.primitive,l)>0?i.push({point:l}):i.push({point:c})}),r.forEach(n=>{let a=new er(t.primitive,new M(n.center,n.center)).getLine(),l=a.start(),c=a.end();LP(t.primitive,l)>0?i.push({point:l,end:n}):i.push({point:c,end:n})}),i.length>0){let n=t.start;Er(i,(h,u)=>h.point.distance2(n)-u.point.distance2(n),0,i.length);let s=[],a;i.forEach(h=>{if(this.validPoint(h.point,t.primitive,t.width)){if(!a){a=h.point,s.push(a);return}a.equals(h.point)||(a=h.point,s.push(a))}});let l=this.changeTrack(t,s,this.command);l.forEach(h=>{this.split.add(h.globalIndex)});let c=!0;return l.length==1&&l[0]==t&&(c=!1),{newTracks:l,points:i,isReplace:c}}else return this.split.add(t.globalIndex),null}validPoint(t,e,r){let i=r/2;return t.distance1(e.start())>=i&&t.distance1(e.end())>=i}changeTrack(t,e,r){let i=t.start,n=[];return e.length>0?(e=e.sort((s,a)=>s.distance2(i)-a.distance2(i)),e.push(t.end),e.forEach(s=>{let a=t.model.clone();a.start=i,a.end=s;let l=pr.addTrackByModel(a,!0);l.partition=R.getInstance().partitionId,i=s,l.updateFilterVisible=!0,l.visible(),n.push(l),r.addCommand(Ce.dispatch(l,"add")),A.publish("hasModifyPcbItem",l)}),r!=null&&(r.addCommand(Ce.dispatch(t,"delete")),A.publish("hasModifyPcbItem",t)),t.remove(),this.joinCombination(n,t.getGroupID()),A.publish("delete",t),A.publish("updateRtree",""),this.removeTrack1(t,n)):n.push(t),n}removeTrack1(t,e){let r=this.replaceTracks[t.globalIndex];r||(r=this.replaceTracks[t.globalIndex]=new Set),e.forEach(i=>{r.add(i.globalIndex)}),this.setReplaceTrack(t.globalIndex,r)}joinCombination(t,e){Ht.getItem(e)!=null&&Ht.joinCombination(t,e)}getConnectTrackByBbox(t,e){let r=Jl.getInstance().getRTree().search(t);r=r.filter(n=>n.item instanceof zr&&n.item.layerId==e.layer&&!ne.lesseq(n.item.length,0));let i=new Jt;return r.map(n=>i.getLoopNode(n.item.globalIndex))}getConnectItemsByBbox(t,e){let r=Jl.getInstance().getRTree().search(t);r=r.filter(n=>{let s=n.item,a=s.layerId;if(s instanceof et){if(a==12||a==e.layer)return!0}else if(s instanceof Ct){if(s.isContains(e.layer))return!0}else if(s instanceof gt){if(ne.lesseq(s.length,0))return!1;if(a==e.layer)return!0}return!1});let i=new Jt;return r.map(n=>i.getLoopNode(n.item.globalIndex))}getConnectItemsByTrackPoint(t,e){return this.getConnectTrackByBbox(t.bbox().extendOfSize(e.width),e)}deleteTracks(t,e,r=!0){if(!t||t.length==0)return;let i=new Set(e);this.oldPath.forEach(n=>{n&&n.forEach(s=>{i.add(s.globalIndex)})}),t.forEach(n=>{n&&(r&&i.has(n.globalIndex)||n.isEmpty||(this.command.addCommand(Ce.dispatch(n,"delete")),A.publish("hasModifyPcbItem",n),n.remove(),A.publish("delete",n)))}),A.publish("updateRtree","")}searchNode(t){return Jl.getInstance().searchNode(t)}searchOtherNode(t){return Jl.getInstance().searchOtherNode(t)}searchHasPoint(t){if(this.nets){let e=t.pathList.iterator();for(;e.hasNext();){let r=e.next();if(this.nets.isPoint(r.globalIndex))return!0}return!1}return!1}};var vo=class extends ni{constructor(e){super();this.event=null;this.nextTool=null;this.changeControlStatus=!1;this.lastClick=null;this._wireMode=e,this.config=ds.getInstance(e);let r=this.config.doubleClickItem;this.selectEndpointTool=new sT(e,this),Ua.addTool(this),Ur.addDrawTool(this),Ys.getInstance().setTool(this),this.initSketcherAttrPanel(e,!0),this.isHoldPCBAttrPanel=!0,r&&(this.config.userModifyWidth=!1,this.onMouseLeftDown(fi.getInstance())),this.config.clear()}getWidth(){let e=Rn.getInstance().current;return e?e.node.width:0}onKeyDown(e){let r;switch(this._wireMode=="Differential pair wiring"&&_3.changeFanOut?r=tr.getLocalAction(["changeDiffPairFanOutMode"],e):["Multi-route wiring","Single wiring"].includes(this._wireMode)&&(r=tr.getLocalAction(["decrease_routing_width","increase_routing_width"],e)),!r&&this._wireMode=="Multi-route wiring"&&(r=tr.getLocalAction(["IncreaseMultiSpace","decreaseMultiSpace"],e)),r||(r=tr.getAction(4,e)),r){case"changeRoutingAngle":case"Routing Corner":this.wireCorner(Ur.getNextType()),wi();break;case"Change Track Width While Routing":he.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"Switch Common Track Width":this.showCommonTrackWidthMenu(e);break;case"Switch Common Via Size While Routing/Placing Via":this.showCommonViaSizeMenu(e);break;case"Cancel":this.cancel();break;case"Finish":this.event?this.completed():(this.onMouseLeftDown(e),this.onMouseLeftUp(e));break;case"Backspace":this.backspace();break;case"Place Via":this.placeVia();break;case"changeDiffPairFanOutMode":this.toggleFanOutMode();break;case"Filp Path While Drawing":this.flipPath();break;case"displayRealTimeNetLengthAndLengthTolerance":{let i=le.pcbConfig.showNetLength||le.pcbConfig.showDiffLength;le.pcbConfig.showNetLength=!i,le.pcbConfig.showDiffLength=!i;break}case"decrease_routing_width":{let i=this.event.node.width-.2;i>=.1&&(this.setWireWidth(i),wi())}break;case"increase_routing_width":{let i=this.event.node.width+.2;this.setWireWidth(i),wi()}break;case"IncreaseMultiSpace":Ha.getInstance().increaseTracksGap(),this.initSketcherAttrPanel(this._wireMode);break;case"decreaseMultiSpace":Ha.getInstance().decreaseTracksGap(),this.initSketcherAttrPanel(this._wireMode);break}he.publish("updateFrame","")}handleMultiSelectItem(e){if(e.length>0){let{sceneX:r,sceneY:i}=fi.getInstance(),n=e.every(a=>a instanceof mn),s;n?s=no.multiSelectRatline(e,new S(r,i)):s=no.multiSelectEleFilter(e,new S(r,i)),s.length>1&&(this.selectEndpointTool.setSelectItems(s),this.selectEndpointTool.onMouseLeftDown(fi.getInstance()),this.selectEndpointTool.clearSelectItems(),this.confirmResult())}}onMouseLeftDown(e){if(!this.lastClick||!this.event)this.onMouseLeftDown1(e);else{let{mouseX:i,mouseY:n}=this.lastClick.ctx,{mouseX:s,mouseY:a}=e;if(Math.max(Math.abs(s-i),Math.abs(a-n))>=10)this.onMouseLeftDown1(e);else{this.dblClickPlaceVia();return}}let r=setTimeout(()=>{this.lastClick&&(clearTimeout(this.lastClick.timer),this.lastClick=null)},400);this.lastClick={timer:r,ctx:{...e}}}dblClickPlaceVia(){this.lastClick&&(clearTimeout(this.lastClick.timer),this.lastClick=null),this.nextTool!=null&&ds.getInstance().dblclickPlaceViasWhileRouting&&this.nextTool.dblClickPlaceVia()}onMouseLeftDown1(e){if(this.changeControlStatus){this.changeControlNode(e);return}if(this.event==null){if(!Mt.checkTrackCanEditByPoint(new S(e.sceneX,e.sceneY)))return;this.selectEndpointTool.onMouseLeftDown(e),this.confirmResult()}else if(this.nextTool!=null){if(!Mt.checkTrackCanEditByPoint(new S(this.event.node.end.point.x,this.event.node.end.point.y))){let i="Cannot be added beyond drawing range";Mt.showMassageTip(i,i);return}if(e.ctrlKey){this.completed();return}this.nextTool.onMouseLeftDown(e);let r=Rn.getInstance().current;this.event=r,this._wireMode=="Single wiring"?this.singleAutoTerminate():this.multiAutoTerminate()}}confirmResult(){var e;this.event=this.selectEndpointTool.event,Rn.getInstance().current=this.event,this.selectEndpointTool.event=null,this.autoToggle(),Ut.getToleranceTargetNet((e=this.event)==null?void 0:e.node.net),this.nextTool&&this._wireMode!=="Differential pair wiring"&&this.nextTool.onMouseMove(fi.getInstance()),this.event&&le.pcbConfig.startTrackWidth==="last"&&(we.prevTrackWidth=this.event.node.width),this.initSketcherAttrPanel(this._wireMode)}multiAutoTerminate(){let e=Rn.getInstance().current;if(!this.config.autoTerminateRouting)return!1;let r=0,i,n=e.tracks.findIndex(a=>a==e.node),s=!1;for(;r<e.tracks.length;){n=n%e.tracks.length;let a=e.tracks[n];if(r++,n++,a.drawing==1)continue;if(a.drawing==2&&!i){s=!0,a.drawing=0,i=a;continue}let l=a.start.point,c=no.autoEndItem(l,a.layerId,a.net,Array.from(a.start.signalLayers));if(c&&Rn.getInstance().hasTrack(a)){a.drawing=1,c.visible();continue}i||(i=a)}if(i)s&&this.changeWireMode("Single wiring"),e.node=i;else return this.completed(),!0;return!1}async changeWireMode(e){let r;this.nextTool!=null&&(r=this.nextTool.wire,this.nextTool.wire=e,this.event=Rn.getInstance().current,ds.getInstance(e)),this._wireMode=e,this.config.wireMode=e;let i=A8(r);await he.windowBridge.rpcCall("PCB2UIAboutUnmountedSketcherAttrView",{header:{action:i}},Q()),this.initSketcherAttrPanel(this._wireMode)}singleAutoTerminate(){var s,a;let e=Rn.getInstance().current,r=e.node.start.point,i=no.autoEndItem(r,e.node.layerId,e.node.net,Array.from(e.node.start.signalLayers)),n=this.config.autoTerminateRouting&&i&&Rn.getInstance().hasTrack(e.node);if(!n)return i&&(e.node.start.allowModifyDirect=!0),!1;if(n){i.visible();let l=this.event.tracks.length;if(l>1&&this.nextTool.oldMode!="Single wiring"){e.node.drawing=1;let c=e.node.drawing;l--;let h=!0,u=e.tracks.indexOf(e.node),d=((s=e.tracks[u-1])==null?void 0:s.drawing)==1,p=((a=e.tracks[u+1])==null?void 0:a.drawing)==1;for((u==e.tracks.length-1||!d&&p)&&(h=!1);l>0&&c!=0;)h?this.toggleNext():this.togglePre(),c=e.node.drawing,c===2&&(c=e.node.drawing=0),l--;if(c!=0)return this._wireMode="Multi-route wiring",this.selectEndpointTool.wire="Multi-route wiring",this.completed(),!0;{let m=e.node.layerId;Pe.setActiveLayerId(m)}}else return this.completed(),!0}return!1}changeControlNode(e){let r=this.selectEndpointTool.getControlTrack(e);r&&r.find(i=>{let{find:n,sort:s,eventPos:a}=this.findControlByTrack(i);if(n!=-1){let l=s[a],c=Rn.getInstance().current,h=s[0],u=n;return h!=l&&(u=c.tracks.length-1-n),c.changeControlNodeByIndex(u),this.changeControlStatus=!1,Ut.cancel(),!0}return!1})}findControlByTrack(e){let r=Rn.getInstance().events,i=[].concat(r,[Rn.getInstance().current]).reverse(),n=[],s=!0,a,l=-1,c;return i.find((h,u)=>{var d;return l==-1&&(l=this.selectEndpointTool.getControlTrackIndex(e,h),c=u),a&&((d=h.tracks[0].end.model)==null?void 0:d.globalIndex)!=a.tracks[0].start.model.globalIndex&&(s=!s),a=h,n.push(s),l!=-1}),{find:l,sort:n,eventPos:c}}onMouseMove(e){if(this.inputInfo=e,this.changeControlStatus){Ut.update(fi.getInstance(),"Please click to select a track to serve as the control line.");return}this.event==null?this.selectEndpointTool.onMouseMove(e):this.nextTool!=null&&this.nextTool.onMouseMove(e)}onMouseLeftUp(e){this.changeControlStatus||(this.event==null?(this.selectEndpointTool.onMouseLeftUp(e),this.confirmResult()):this.nextTool!=null&&this.nextTool.onMouseLeftUp(e))}autoToggle(){this.event==null?this.nextTool=null:(this.start(),this.nextTool=new _1(this.event,this._wireMode))}wireCorner(e){Zt.getInstance().type=e,we.synchronize(),this.nextTool!=null&&this.nextTool.wireCorner(),this.refresh(),this.initSketcherAttrPanel(this._wireMode)}wireMode(e){Zt.getInstance().mode=e,we.synchronize(),this.nextTool!=null&&(this.nextTool.wireMode(),Nh.getInstance().clearCollidePl()),this.initSketcherAttrPanel(this._wireMode)}async toggleRouteMode(){this.nextTool.toggleRouteMode(this);let e=A8(this.nextTool.lastMode);await he.windowBridge.rpcCall("PCB2UIAboutUnmountedSketcherAttrView",{header:{action:e}},Q()),this.initSketcherAttrPanel(this._wireMode)}toggleSingleRoute(){if(this._wireMode=="Single wiring"&&this.event!=null){this.toggleNext();let r=Rn.getInstance().current.node.layerId;Pe.setActiveLayerId(r)}}toggleNext(){let e=Rn.getInstance().current;e.toggleNext(),e.tracks.forEach(r=>{r!==e.node&&(r.end=r.start.clone()),e.result.wireMap.delete(r)}),this.nextTool.initNearNode()}togglePre(){Rn.getInstance().current.togglePre(),this.nextTool.initNearNode()}changeControlRoute(){if(this._wireMode!="Single wiring"&&this.event!=null){if(this.event.tracks.length==2){this.toggleNext();return}this.changeControlStatus=!0,Ut.update(fi.getInstance(),"Please click to select a track to serve as the control line.")}}modifyWireMode(e){this.nextTool!=null&&(this.nextTool.wire=e,this.nextTool.restoreCurrentInitState(this._wireMode),this.nextTool.initNearNode(),this.event=Rn.getInstance().current,ds.getInstance(e)),this._wireMode=e,this.config.wireMode=e}backspace(){this.nextTool!=null&&(this.nextTool.backspace(),this._wireMode=this.nextTool.wire,this.initSketcherAttrPanel(this._wireMode))}placeVia(){this.nextTool!=null?this.nextTool.placeVia():he.publish("tool","place_part(via)")}placeBlind(e){switch(e){case"VIA_TYPE_RULESSETTING":{let r={activeTab:"Rule",activeMenu:"Blind/Buried Via"};he.publish("openMainDialog",{cmd:5,data:{option:r,tool:this}});break}default:this.nextTool!=null&&this.nextTool.placeBlind(e)}}toggleFanOutMode(){this.nextTool!=null&&(this.config.changeFanOutMode=!0,this.config.fanOutMode===2?this.config.fanOutMode=1:this.config.fanOutMode=2,this.refresh())}flipPath(){this.nextTool!=null&&this.nextTool.flipPath()}setWireWidth(e){if(!(e==null||isNaN(e)||e==0)){if(this.nextTool!=null)this.nextTool.wireWidth(e)&&le.pcbConfig.startTrackWidth=="last"&&(this.config.width=e,we.prevTrackWidth=e),this.refresh();else{let r;if(this.event)r=this.event.node.layerId;else{let a=Pe.getActiveLayer();a.isCopperLayer()||(a=Pe.getTopLayer()),r=a.layerID}let i,n;if(this._wireMode=="Differential pair wiring"){let a=re.getInstance().getDefaultDifferentialPhysics();i=a.getStrokeWidthMin(r),n=a.getStrokeWidthMax(r)}else{let a=re.getInstance().getDefaultTrackPhysics();i=a.getMinWidth(r),n=a.getMaxWidth(r)}let s=R.getInstance().unit==="mm"?3:2;ve(e,s)<ve(i,s)||ve(e,s)>ve(n,s)?he.publish("ui/toastMsg",{type:"warn",msg:"The modified value is not within the DRC requirements"},Q()):(this.config.width=e,we.prevTrackWidth=e,this.config.userModifyWidth=!0)}this.initSketcherAttrPanel(this._wireMode)}}cancel(){this.changeControlStatus?(this.changeControlStatus=!1,Ut.cancel()):this.event==null?(Ur.clearDrawTool(),he.publish("tool","dropdrag"),this.config.reset(),Ys.getInstance().setTool(null)):(this.interrupt(),this.nextTool=null,this.event=null,this.initSketcherAttrPanel(this._wireMode))}getEventStatus(){return this.event}completed(){this.nextTool!=null&&(this.nextTool.complete(),this.complete2history(),this.nextTool=null,this.event=null,Ut.cancel(),Nh.getInstance().clear(),_1.firstEvent=null,_1.canRemoveLoop=null)}clear(){var e;(e=this.nextTool)==null||e.interrupt(),Mi.getInstance().clear(),Ml.getInstance().deleteAll(),Jf.getInstance().clear(),Rn.getInstance().clear(),Si.getInstance().clear(),R0.getInstance().clear(),n0.getInstance().clear(),oi.getInstance().clear(),At.getInstance().clear(),fs.getInstance().clear(),Cr.getInstance().clear(),HS.getInstance().clear(),$l.getInstance().clear(),pa.getInstance().clear(),ps.getInstance().clear(),Kl.getInstance().clear(),Mr.getInstance().clear()}complete2history(){var l;let e=new De("wire");Mt.isChildPcb()||new mq().autoAssignTrackNet(e);let r=this.nextTool.changeCommand,{newIds:i}=Mi.getInstance().complete(r),n=this.selectEndpointTool.clearDelteCommands(),s=new De("wire");if(n.length)if(r.commands.length>0){let c=n==null?void 0:n.commands;if(c.length)for(let h=c.length-1;h>=0;h--){let u=c[h];s.addCommand(u)}}else this.selectEndpointTool.clearDelteCommands(!0);let a=r.commands;for(let c of a)s.addCommand(c);if(e.commands.forEach(c=>{s.addCommand(c)}),he.publish("SetSuspend",!1),s.commands.length>0&&qe.executeCommand(s),he.publish("SetSuspend",!0),this.config.removeLoop)try{console.time("remove loop");let c=Ys.getInstance(),h=new mq().getTrackInfoPath2(i),u=[];for(let b in h)u.push(...h[b]);let d=new Jt;u.forEach(b=>{let P=b.tracks.map(T=>d.getItem(T.id));console.log(P)});let p=new $ce(qe.stack);p.init(u);let m=!0;At.getInstance().clear(),Si.getInstance().clear(),gT.getInstance().clear();let y;u.forEach((b,P)=>{let T=!1;P==u.length-1&&(T=!0);let I=Array.from(b.path).filter(x=>x!=null);if(!(I&&I.length>0))return;p.setCurrIndex(P);let C=p.getNet(),E=p.getEndLayerId(),O=b.path[b.path.length-1].end();if(!y)y={net:C,end:O,layerId:E};else if(C==y.net&&O.equals(y.layerId)&&E==y.layerId)return;let _=new jce(qe.stack,p,c.removeAntenna);_.popMsg=this.config.autoLoopUpMsgBox,_.saveViaLoop=!c.removeCircuitsContainingVias,c.removeAntenna&&_.removeLeave(),m=_.removeLoop(T)&&m}),m&&(he.publish("flushService",""),Jl.getInstance().clear()),console.timeEnd("remove loop")}catch(c){console.warn(c),he.publish("flushService",""),Jl.getInstance().clear()}else he.publish("flushService","");setTimeout(()=>{he.publish("flushTearDrop",""),he.publish("updateFrame","")},10),this.clear(),Jd.updateNetLengthMsg(this.event,this._wireMode),this._wireMode=(l=this.config.lastMode)!=null?l:this.nextTool.oldMode,this.config.wireMode=this._wireMode,this.selectEndpointTool.wire=this._wireMode,this.initSketcherAttrPanel(this._wireMode),he.publish("clearSelect",""),this.end()}interrupt(){this.nextTool!=null&&(this.nextTool.restoreCurrentInitState(),this.complete2history()),_1.firstEvent=null,_1.canRemoveLoop=null,Ut.cancel(),this.selectEndpointTool.interrupt()}toggleLayer(e,r){if(r!=null){let i=Ze.getInstance().getSingleLayerId4Order(),n=Pe.getLastActiveLayerID(),s=i.indexOf(n);r=="next"?s>=i.length-1||s<0?s=0:s++:s<0?s=0:s==0?s=i.length-1:s--,e=i[s],Pe.setActiveLayerId(e)}this.nextTool!=null&&this.nextTool.toggleLayer(e)}updateTrackWidth(){if(le.pcbConfig.startTrackWidth=="rule"&&this.event!=null){let e=0,r=this.event;r.node.net!=""?e=re.getInstance().getTrackPhysicsByNet(r.node.net).getDefaultWidth():e=re.getInstance().getDefaultTrackPhysics().getDefaultWidth(),this.setWireWidth(e)}}getWireWidth(){return this.nextTool!=null?this.nextTool.getWireWidth():this.config.width}toggleWidth(e){if(e==="WIRING_WIDTH_FOLLOWRULES"){let r=le.pcbConfig.startTrackWidth=="rule"?"last":"rule";if(le.pcbConfig.startTrackWidth=r,we.widthFollowRule=le.pcbConfig.startTrackWidth=="rule",le.pcbConfig.startTrackWidth=="rule"){this.nextTool!=null&&this.nextTool.wireWidth(0,"WIRING_WIDTH_FOLLOWRULES");let i,n,s;if(this.event){let a=this.event.node;n=a.layerId,s=a.net}else{let a=Pe.getActiveLayer();a.isCopperLayer()||(a=Pe.getTopLayer()),n=a.layerID,s=""}if(this._wireMode=="Single wiring"&&this.event){let l=this.event.node.start.point,c=Ts(l,n,!0),h=Zf(c,s,n);if(h!=null)i=h;else{let u=re.getInstance().getNet(s);u!=null&&(u==null?void 0:u.netDifferential)!=null?i=re.getInstance().getDifferentialPhysicsByNet(s).getStrokeWidthDefault(n):i=re.getInstance().getTrackPhysicsByNet(s).getDefaultWidth(n)}}else if(this._wireMode=="Differential pair wiring"&&this.event){this.event.node.net!=""&&(i=re.getInstance().getDifferentialPhysicsByNet(this.event.node.net).getStrokeWidthDefault(n));let a=this.event.tracks;for(let l of a){let c=l.start.point,h=Ts(c,l.layerId),u=Zf(h,l.net,l.layerId);if(u!=null){i=u;break}}}else this._wireMode=="Differential pair wiring"?i=re.getInstance().getDefaultDifferentialPhysics().getStrokeWidthDefault(n):i=re.getInstance().getDefaultTrackPhysics().getDefaultWidth(n);this.setWireWidth(i)}}else if(e=="WIRING_WIDTH_INPUT")he.publish("openMainDialog",{cmd:26,data:{tool:this}});else if(e=="WIRING_WIDTH_RULESSETTING"){let r={activeTab:"Rule",activeMenu:"Track"};he.publish("openMainDialog",{cmd:5,data:{option:r,tool:this}})}else if(e=="WIRING_WIDTH_COMMONLY_SSETTING")he.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",Q());else{let i=le.trackConfig[e].getSizeAccordingToUnit();this.setWireWidth(i),we.prevTrackWidth=i}this.initSketcherAttrPanel(this._wireMode),this.refresh()}getTracksGap(){if(this.event!=null&&this._wireMode!=="Single wiring")return this.event.gaps}setTracksGap(e){this.event!=null&&this._wireMode!=="Single wiring"&&(this.event.modifySpacing1(e),this.nextTool!=null&&this.nextTool.modifySpacing(e),this.refresh())}getViaRadius(){return this.nextTool!=null?this.nextTool.getViaRadius():{innerRadius:this.config.innerRadius,radius:this.config.radius}}setViaSize(e,r,i){var n;if(this.nextTool!==null)this.nextTool.viaSize(e,r,i);else{let s=((n=this.event)==null?void 0:n.node.net)||"",a=re.getInstance().getRadiusPhysicsByNet(s);if(r!=null&&sf.inValidRadius(a,r)){he.publish("ui/toastMsg",{type:"warn",msg:"The modified value is not within the DRC requirements"},Q());return}else if(e!=null&&sf.inValidInnerRadius(a,e)){he.publish("ui/toastMsg",{type:"warn",msg:"The modified value is not within the DRC requirements"},Q());return}r&&(this.config.radius=r,ut.setDefaultVia({net:null,holeRadius:null,radius:r})),e&&(this.config.innerRadius=e,ut.setDefaultVia({net:null,holeRadius:e,radius:null})),this.config.userModifyViaSize=!0}this.initSketcherAttrPanel(this._wireMode)}modifyViaSize(e,r){this.setViaSize(e,r)}toggleViaSize(e){var i;let r=new dt;if(e[1]==="VIA_SIZE_RULESSETTING"){let n={activeTab:"Rule",activeMenu:"Via Size"};he.publish("openMainDialog",{cmd:5,data:{option:n,tool:this}})}else if(e[1]==="VIA_SIZE_FOLLOWRULES"){let n=le.pcbConfig.startViaSize=="rule"?"last":"rule";if(le.pcbConfig.startViaSize=n,we.sizeFollowRule=le.pcbConfig.startViaSize=="rule",le.pcbConfig.startViaSize=="rule"){this.nextTool!=null&&this.nextTool.modifyViaSize();let s=re.getInstance().getRadiusPhysicsByNet(((i=this.event)==null?void 0:i.node.net)||"");this.setViaSize(s.defalutInner,s.defalutRadius)}}else if(e[1]=="VIA_SIZE_COMMONLY_SETTING")he.publish("openSystemDialog","PCB_COMM_VIA_SIZE",Q());else if(e[1]=="VIA_SIZE_INPUT")he.publish("openMainDialog",{cmd:28,data:{tool:this}});else{let n=le.viaConfig[e[1]].getSizeAccordingToUnit(),s=n.radius,a=n.innerRadius;this.setViaSize(a,s),ut.setDefaultVia({net:null,holeRadius:a,radius:s})}this.initSketcherAttrPanel(this._wireMode)}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed();break;case"CANCEL":this.cancel();break;case"REGRESSION":this.backspace();break;case"PLACE_VIA":this.placeVia();break;case"PLACE_BURIEDHOLE":this.placeBlind(i[1]);break;case"REPLACE_LAYER":let n=parseInt(i[1].split("switchToLayer(")[1]);this.toggleLayer(n);break;case"WIRING_CORNER":this.wireCorner(i[1]),wi();break;case"WIRING_MODE":this.wireMode(i[1]),wi();break;case"WIRING_WIDTH":this.toggleWidth(i[1]),wi();break;case"WIRING_WIDTH_COMMONLY_SSETTING":he.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",Q());break;case"VIA_SIZE":this.toggleViaSize(i),wi();break;case"REMOVE_LOOP":pr.removeLoop=!pr.removeLoop,we.removeLoop=pr.removeLoop;break;case"toggleAdsorb":he.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":he.publish("openSystemDialog","ADSORPTION",Q());break;case"VIA_SIZE_COMMONLY_SETTING":he.publish("openSystemDialog","PCB_COMM_VIA_SIZE",Q());break;case"SINGlE_ROUTE":this.toggleRouteMode();break;case"CHANGETRACK":this.toggleSingleRoute();break;case"CHANGECONTROLTRACK":this.changeControlRoute();break}he.publish("updateFrame","")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:this.getMenu(e.adsorb).result};$t.getInstance().menuData(r,this),this.drawing=!1}getWires(){let e=new Set;return this.event?(this._wireMode=="Single wiring"?e.add(this.event.node.net):this.event.tracks.forEach(r=>{e.add(r.net)}),Array.from(e)):[]}getShiftStartControl(){var e;return this._wireMode=="Single wiring"?(e=this.event)==null?void 0:e.node.start.point:null}getMenu(e){return oVe(e,this.event,this._wireMode=="Single wiring")}showCommonTrackWidthMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,this.event!=null?r.filter=Dm(this.event.node.width).result:r.filter=Dm(we.prevTrackWidth).result,$t.getInstance().menuData(r,this),this.drawing=!1}showCommonViaSizeMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=QB(this.config.innerRadius,this.config.radius).result,$t.getInstance().menuData(r,this),this.drawing=!1}option1(e){switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}refresh(){this.onMouseMove(this.inputInfo)}getWireMode(){return this._wireMode}initSketcherAttrPanel(e,r=!1){let i=A8(e);he.publish("FlushSketcherAttrView",{type:i,isInitAllParams:!0,switchTab:r})}};var Ha=class o{constructor(){this.tool=null;this.trackWidth=-1,this.asRuleMiniumSpacing=-1,this.viaRadius=-1,this.viaInnerRadius=-1,this.afterPlacingTheViaSwitch2Layer=[-1,-1],this.maximumRadius=100,this.pushViaOptimization="OPTIMIZA_OPEN",this.currentPathOptimization="OPTIMIZA_WEAK",this.pathOptimization=0,this.removeCircuitsContainingVias=!0,this.removeAntenna=!0,this.minimumTrackCorners=we.stretchTrackMinCorner,A.subscribe("updateMaximumRadius",this.setMaximumRadius.bind(this))}static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}setTool(t){this.tool=t}get wireEvent(){var t;return(t=this.tool)==null?void 0:t.getEventStatus()}getStartTrackWidth(){return le.pcbConfig.startTrackWidth}setStartTrackWidth(t){if(this.tool instanceof vo)this.tool.toggleWidth("WIRING_WIDTH_FOLLOWRULES");else{if(t=="last"){let e=this.getTrackWidth(10).value;this.setTrackWidth(e)}le.pcbConfig.startTrackWidth=t,we.widthFollowRule=le.pcbConfig.startTrackWidth=="rule"}}getTrackWidth(t=1){let e=ds.getInstance().wireMode=="Differential pair wiring",r,i,n=Pe.getActiveLayer();if(n.isCopperLayer()||(n=Pe.getTopLayer()),i=n.layerID,e?r=re.getInstance().getDifferentialPhysicsByNet("").getStrokeWidthDefault(i):r=re.getInstance().getTrackPhysicsByNet("").getDefaultWidth(i),this.tool instanceof vo){let s=this.tool.getWireWidth();return s==null&&(s=le.pcbConfig.startTrackWidth=="rule"?r:we.prevTrackWidth),{title:"Track Width",value:s*t}}else return{title:"Track Width",value:le.pcbConfig.startTrackWidth=="rule"?r*t:we.prevTrackWidth*t}}getPanelTrackWidth(){if(this.tool instanceof vo){let e=this.tool.getWireWidth();return e==null&&(e=le.pcbConfig.startTrackWidth=="rule"?t():we.prevTrackWidth),e}return le.pcbConfig.startTrackWidth=="rule"?t():we.prevTrackWidth;function t(){let e=Pe.getActiveLayer();e.isCopperLayer()||(e=Pe.getTopLayer());let r=e.layerID,i=ds.getInstance().wireMode=="Differential pair wiring",n;return i?n=re.getInstance().getDifferentialPhysicsByNet("").getStrokeWidthDefault(r):n=re.getInstance().getTrackPhysicsByNet("").getDefaultWidth(r),n}}setTrackWidth(t){if(+t<=0)return;let e=oo(t/10);this.tool instanceof vo?this.tool.setWireWidth(e):we.prevTrackWidth=e}getStartViaSize(){return le.pcbConfig.startViaSize}setStartViaSize(t){if(this.tool instanceof vo)this.tool.toggleViaSize(["VIA_SIZE","VIA_SIZE_FOLLOWRULES"]);else{if(t=="last"){let e=this.getViaOutsideDiameter().value,r=this.getViaInsideDiameter().value;this.setViaOutsideDiameter(e),this.setViaInsideDiameter(r)}le.pcbConfig.startViaSize=t,we.sizeFollowRule=le.pcbConfig.startViaSize=="rule"}}getViaOutsideDiameter(){let t=re.getInstance().getRadiusPhysicsByNet(""),e=le.pcbConfig.startViaSize=="rule"?t.defalutRadius:ut.defaultVia.radius;if(this.tool instanceof vo){let r=this.tool.getViaRadius().radius;return r&&(e=r),{title:"Via Outside Diameter",value:e*20}}else return{title:"Via Outside Diameter",value:e*20}}setViaOutsideDiameter(t){if(+t<=0)return;let e=t/20;e=oo(e*2)/2,this.tool instanceof vo?this.tool.setViaSize(void 0,e):ut.setDefaultVia({net:null,holeRadius:null,radius:e})}getViaInsideDiameter(){let t=re.getInstance().getRadiusPhysicsByNet(""),e=le.pcbConfig.startViaSize=="rule"?t.defalutInner:ut.defaultVia.innerRadius;if(this.tool instanceof vo){let r=this.tool.getViaRadius().innerRadius;return r&&(e=r),{title:"Via Inside Diameter",value:e*20}}else return{title:"Via Inside Diameter",value:e*20}}setViaInsideDiameter(t){if(+t<=0)return;let e=t/20;e=oo(e*2)/2,this.tool instanceof vo?this.tool.setViaSize(e,void 0):ut.setDefaultVia({net:null,holeRadius:e,radius:null})}getAfterPlacingTheViaSwitch2Layer(){let t=le.pcbConfig.autoChangeLayerWhileRoutingVias,e=Pe.getActiveLayerID(),r=R.getInstance().doctype==pi.PCB&&Pe.getAllCopperLayer().length!==2&&le.pcbConfig.autoChangeLayerWhileRoutingVias,i="",n=!1,s=[];if(t){s=Pe.getAllSignalLayer();let l=s.map(c=>c.layerId);if(n=!l.includes(e),!r||n)i="";else{let c=this.afterPlacingTheViaSwitch2Layer[0]!==-1&&this.afterPlacingTheViaSwitch2Layer[1]!==-1,[h,u]=this.afterPlacingTheViaSwitch2Layer||[],d=l.includes(u);c&&d&&e===h&&u?i=u:i=e===2?1:2}}let a=s.filter(l=>l.layerId!==e).map(l=>({value:l.layerId,text:l.name}));return{title:"switch2Layer",value:i,activeLayerId:e,options:a,visible:r,disabled:n}}setAfterPlacingTheViaSwitch2Layer(t){this.afterPlacingTheViaSwitch2Layer=t}getWiringCorner(){return Zt.getInstance().type}setWiringCorner(t){this.tool instanceof vo&&this.tool.wireCorner(t)}getMaximumRadius(){return this.maximumRadius}setMaximumRadius(t){t<0&&(t=0),this.maximumRadius=t,this.tool instanceof vo&&this.wireEvent&&(this.tool.onMouseMove(fi.getInstance()),this.tool.initSketcherAttrPanel(ds.getInstance().wireMode))}getRoutingMode(){return Zt.getInstance().mode}setRoutingMode(t,e=!1){this.tool instanceof vo?this.tool.wireMode(t):(Zt.getInstance().mode=t,we.synchronize()),e&&wi()}getPushVia(){return this.pushViaOptimization}setPushVia(t,e=!1){this.pushViaOptimization=t,e&&wi()}getPathOptimization4BePushed(){return this.pathOptimization}setPathOptimization4BePushed(t,e=!1){this.pathOptimization=t,e&&wi()}getCurrentPathOptimization(){return this.currentPathOptimization}setCurrentPathOptimization(t,e=!1){this.currentPathOptimization=t,e&&wi()}getRemoveCircuitsContainingVias(){return this.removeCircuitsContainingVias}getRemoveAntenna(){return this.removeAntenna}getRemoveLoop(){return{title:"Remove Loop",value:we.removeLoop,removeLoopOptions:[{value:we.removeLoop&&this.removeCircuitsContainingVias,text:"Remove Circuits Containing Vias"},{value:we.removeLoop&&this.removeAntenna,text:"Remove Antenna"}]}}setRemoveLoop(t,e,r=!1){if(!e)we.removeLoop=t;else switch(e){case"Remove Circuits Containing Vias":this.removeCircuitsContainingVias=t;break;case"Remove Antenna":this.removeAntenna=t;break}r&&wi()}roundAndUniqueNumbers(t,e=!1){let r=new Set,i=t.map(n=>Math.round(n*1e3)/1e3);if(e){let n=i.filter(s=>r.has(s)?!1:(r.add(s),!0));if(n.length===1)return n}return i}increaseTracksGap(){if(this.tool instanceof vo&&this.wireEvent){let t=this.tool.getTracksGap(),e=this.roundAndUniqueNumbers(t.map(n=>n.width*10)),r=this.wireEvent.isDiffGap(),i=e.map((n,s)=>r[s]?n:n+1);this.setTracksGap(i)}}decreaseTracksGap(){if(this.tool instanceof vo&&this.wireEvent){let t=this.tool.getTracksGap(),e=this.roundAndUniqueNumbers(t.map(s=>s.width*10)),r=this.roundAndUniqueNumbers(this.getAsRuleMiniumSpacing()),i=this.wireEvent.isDiffGap(),n=e.map((s,a)=>{if(i[a])return s;let l=r[a];return s-1>=l?s-1:s});this.setTracksGap(n)}}setRuleMiniumSpacing(){if(this.tool instanceof vo&&this.wireEvent){let t=this.getAsRuleMiniumSpacing();t=this.roundAndUniqueNumbers(t,!0),this.tool.setTracksGap(t.map(e=>e/10))}}getAsRuleMiniumSpacing(t){var e;if(this.tool instanceof vo&&this.wireEvent){let r=new Array,i=t||this.wireEvent,n=new T3,s=i.tracks,a=re.getInstance();for(let l=0;l<s.length-1;l++){let c=n.isDiffPair(s[l].net,s[l+1].net),h=s[l].start,u=s[l+1].start,d=Ts(h.point,s[l].layerId,!0),p=Ts(u.point,s[l+1].layerId,!0),m=d.concat(p);gI(m);let g=Vb(m,s[l].net,s[l+1].net,s[l].layerId);if(g==null)if(c){let y=n.getDiffPair(s[l].net);g=(e=a.getDifferentialPhysics(y.differentialPhysics))==null?void 0:e.getDifferentialPairSpacingDefault(s[l].layerId)}else g=re.getInstance().getSafeClearance({id:"",net:s[l].net,layerId:s[l].layerId,shapeType:0},{id:"",net:s[l+1].net,layerId:s[l+1].layerId,shapeType:0},s[l].layerId);r.push(g)}return r.map(l=>l*10)}}getTracksGap(){if(this.tool instanceof vo&&this.wireEvent){let t=this.tool.getTracksGap();return this.roundAndUniqueNumbers(t.map(r=>r.width),!0).length!==1?"<...>":String(t[0].width*10)}else return"<...>"}setTracksGap(t){if(this.tool instanceof vo&&this.wireEvent){let e=this.getAsRuleMiniumSpacing();if(e=this.roundAndUniqueNumbers(e,!0),e.some((i,n)=>t[n]<i)){A.publish("ui/toastMsg",{type:"warn",msg:"The set spacing is smaller than the minimum spacing specified by the design rules"},Q()),this.tool.setTracksGap(e.map(i=>i/10));return}this.tool.setTracksGap(t.map(i=>i/10))}}getTrackMinCorner(){return parseInt(this.minimumTrackCorners.toString())}setTrackMinCorner(t,e=!1){t<0?t=0:t>1e3&&(t=1e3),this.minimumTrackCorners=parseInt(t.toString()),e&&wi()}getHideCopper(){return!jt.getVisible(21)}setHideCopper(t,e=!1){jt.setVisible(21,!t),jt.flush(),e&&wi()}getUnit(){return R.getInstance().unit}setUnit(t){eC(t)}getGridType(){return we.gridType}setGridType(t){we.gridType=t,A.messageBus.publish("switchGridType",t),A.publish("switchGridTypeBtn",t,Q())}getBlodGridType(){return we.multiType}setBlodGridType(t){we.multiType=t,A.messageBus.publish("switchMultiGridType",t)}getBlodGridRatio(){return we.multiRatio}setBlodGridRatio(t){A.messageBus.publish("switchMultiGridRatio",t)}getGridSize(){let t=It.getInstance().getGridX()*10,e=It.getInstance().getGridY()*10;return t==e?String(t):`${t},${e}`}setGridSize(t,e){It.getInstance().setGridX(t/10),It.getInstance().setGridY(e/10),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),we.synchronize()}getSnapSize(){let t=It.getInstance().getSnapX()*10,e=It.getInstance().getSnapY()*10;return t==e?String(t):`${t},${e}`}setSnapSize(t,e){It.getInstance().setSnapX(t/10),It.getInstance().setSnapY(e/10),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q())}getSnap(){return{title:"Snap",value:we.adsorb}}setSnap(t,e=!1){e||A.publish("toggleAdsorb",t)}getAltSnapSize(){let t=R.getInstance().altGridSize,e=Bs.conversion1(t.GridX.unit,R.getInstance().unit,t.GridX.number),r=Bs.conversion1(t.GridY.unit,R.getInstance().unit,t.GridY.number);return e==r?String(e):`${e},${r}`}setAltSnapSize(t,e){let r={GridX:{number:t,unit:R.getInstance().unit},GridY:{number:e,unit:R.getInstance().unit}};R.getInstance().altGridSize=r}};function np(){R.getInstance().compiler.uploadCanvas(Sr.getInstance().encode("CANVAS"))}var Ys=class o extends fI{constructor(){super();this.tool=null;this.wiringRouterParams=Ha.getInstance(),this._isOpenedContextmenu=!1,this._hasSettingResult=!1}set(){return this}getTool(){return this.tool}setTool(e){this.wiringRouterParams.setTool(e)}static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}get isOpenedContextmenu(){return this._isOpenedContextmenu}set isOpenedContextmenu(e){this._isOpenedContextmenu=e}get hasSettingResult(){return this._hasSettingResult}set hasSettingResult(e){this._hasSettingResult=e}get AfterPlacingTheViaSwitch2Layer(){return this.wiringRouterParams.getAfterPlacingTheViaSwitch2Layer().value}get pushVia(){return this.wiringRouterParams.getPushVia()}get pathOptimization4BePushed(){return this.wiringRouterParams.getPathOptimization4BePushed()}get currentPathOptimization4BePushed(){return this.wiringRouterParams.getCurrentPathOptimization()}get removeLoop(){return this.wiringRouterParams.getRemoveLoop().value}get removeCircuitsContainingVias(){return this.wiringRouterParams.getRemoveCircuitsContainingVias()}get removeAntenna(){return this.wiringRouterParams.getRemoveAntenna()}get wiringTrackMinCorner(){return this.trackMinCorner*this.wiringRouterParams.getTrackWidth(10).value/10}get trackMinCorner(){return this.wiringRouterParams.getTrackMinCorner()}get viaOutsideDiameter(){return this.wiringRouterParams.getViaOutsideDiameter().value/10}get viaInsideDiameter(){return this.wiringRouterParams.getViaInsideDiameter().value/10}createHeader(e){let r=this.createBaseHeader();return r.id=e,r.action=e,r.tabId=R.getInstance().tabId,r}handleHeaderUpdate(e){}createBody(e){let r={};switch(e){case"SINGLE_WIRE":r=this.wirePanelDataAssemble("SINGLE_WIRE");break;case"DIFF_WIRE":r=this.wirePanelDataAssemble("DIFF_WIRE");break;case"MULTI_WIRE":r=this.wirePanelDataAssemble("MULTI_WIRE");break}return r}wirePanelDataAssemble(e){switch(e){case"SINGLE_WIRE":return{trackProperty:this.createProperty(),trackOptions:this.createOptions(),trackCanvas:this.createCanvas()};case"DIFF_WIRE":return{trackProperty:this.createProperty(),trackOptions:this.createOptions(),trackCanvas:this.createCanvas()};case"MULTI_WIRE":return{trackProperty:this.createMultiProperty(),trackOptions:this.createOptions(),trackCanvas:this.createCanvas()}}}handleBodyUpdate(e,r){let{trackProperty:i,trackOptions:n,trackCanvas:s}=r;switch(e){case"SINGLE_WIRE":this.updateProperty(i),this.updateOptions(n),this.updateCanvas(s);break;case"DIFF_WIRE":this.updateProperty(i),this.updateOptions(n),this.updateCanvas(s);break;case"MULTI_WIRE":this.updateMultiProperty(i),this.updateOptions(n),this.updateCanvas(s);break}A.publish("updateFrame","")}createProperty(){let e={};return e.startTrackWidth=this.wiringRouterParams.getStartTrackWidth(),e.trackWidth=this.wiringRouterParams.getTrackWidth(10),e.startViaSize=this.wiringRouterParams.getStartViaSize(),e.viaOutsideDiameter=this.wiringRouterParams.getViaOutsideDiameter(),e.viaInsideDiameter=this.wiringRouterParams.getViaInsideDiameter(),e.afterPlacingTheViaSwitch2Layer=this.wiringRouterParams.getAfterPlacingTheViaSwitch2Layer(),e}createMultiProperty(){let e={};return e.startTrackWidth=this.wiringRouterParams.getStartTrackWidth(),e.trackWidth=this.wiringRouterParams.getTrackWidth(10),e.tracksGap=this.wiringRouterParams.getTracksGap(),e.setAsRuleMiniumSpacing=this.wiringRouterParams.getAsRuleMiniumSpacing(),e.startViaSize=this.wiringRouterParams.getStartViaSize(),e.viaOutsideDiameter=this.wiringRouterParams.getViaOutsideDiameter(),e.viaInsideDiameter=this.wiringRouterParams.getViaInsideDiameter(),e.afterPlacingTheViaSwitch2Layer=this.wiringRouterParams.getAfterPlacingTheViaSwitch2Layer(),e}createOptions(){let e={};return e.routingCorner=this.wiringRouterParams.getWiringCorner(),e.maximumRadius=this.wiringRouterParams.getMaximumRadius(),e.routingMode=this.wiringRouterParams.getRoutingMode(),e.pushVia=this.wiringRouterParams.getPushVia(),e.pathOptimization4BePushed=this.wiringRouterParams.getPathOptimization4BePushed(),e.currentPathOptimization=this.wiringRouterParams.getCurrentPathOptimization(),e.removeLoop=this.wiringRouterParams.getRemoveLoop(),e.minimumTrackCorners=this.wiringRouterParams.getTrackMinCorner(),e.isHideCopperRegion=this.wiringRouterParams.getHideCopper(),e}createCanvas(){let e={};return e.unit=this.wiringRouterParams.getUnit(),e.gridType=this.wiringRouterParams.getGridType(),e.blodGridType=this.wiringRouterParams.getBlodGridType(),e.blodGridRatio=this.wiringRouterParams.getBlodGridRatio(),e.gridSize=this.wiringRouterParams.getGridSize(),e.snapSize=this.wiringRouterParams.getSnapSize(),e.snap=this.wiringRouterParams.getSnap(),e.altSnapSize=this.wiringRouterParams.getAltSnapSize(),e}isNeedUpdateAfterPlacingConfig(e,r){let i=n=>Array.isArray(n)&&n.length===2;if(i(e)&&i(r)){let[n,s]=e,[a,l]=r;return n!==a||s!==l}return!1}updateProperty(e){let{startTrackWidth:r,trackWidth:i,startViaSize:n,viaOutsideDiameter:s,viaInsideDiameter:a,afterPlacingTheViaSwitch2Layer:l}=e,c=this.wiringRouterParams.getStartTrackWidth(),h=this.wiringRouterParams.getTrackWidth(10).value,u=this.wiringRouterParams.getStartViaSize(),d=this.wiringRouterParams.getViaOutsideDiameter().value,p=this.wiringRouterParams.getViaInsideDiameter().value,m=[this.wiringRouterParams.getAfterPlacingTheViaSwitch2Layer().activeLayerId,this.wiringRouterParams.getAfterPlacingTheViaSwitch2Layer().value],g=!1;r!==c&&(g=!0,this.wiringRouterParams.setStartTrackWidth(r)),i.value!==h&&(g=!0,this.wiringRouterParams.setTrackWidth(i.value)),n!==u&&(g=!0,this.wiringRouterParams.setStartViaSize(n)),s.value!==d&&(g=!0,this.wiringRouterParams.setViaOutsideDiameter(s.value)),a.value!==p&&(g=!0,this.wiringRouterParams.setViaInsideDiameter(a.value)),this.isNeedUpdateAfterPlacingConfig(m,l.value)&&this.wiringRouterParams.setAfterPlacingTheViaSwitch2Layer(l.value),g&&wi()}updateMultiProperty(e){let{startTrackWidth:r,trackWidth:i,setAsRuleMiniumSpacing:n,tracksGap:s,startViaSize:a,viaOutsideDiameter:l,viaInsideDiameter:c,afterPlacingTheViaSwitch2Layer:h}=e,u=this.wiringRouterParams.getStartTrackWidth(),d=this.wiringRouterParams.getTrackWidth(10).value,p=this.wiringRouterParams.getTracksGap(),m=this.wiringRouterParams.getStartViaSize(),g=this.wiringRouterParams.getViaOutsideDiameter().value,y=this.wiringRouterParams.getViaInsideDiameter().value,b=[this.wiringRouterParams.getAfterPlacingTheViaSwitch2Layer().activeLayerId,this.wiringRouterParams.getAfterPlacingTheViaSwitch2Layer().value],P=!1;r!==u&&(P=!0,this.wiringRouterParams.setStartTrackWidth(r)),i.value!==d&&(P=!0,this.wiringRouterParams.setTrackWidth(i.value));let T=s.split(",");T.length==1&&T[0]!=="<...>"?this.wiringRouterParams.setTracksGap([Number(s)]):Array.from(new Set(T))[0]!==p&&this.wiringRouterParams.setRuleMiniumSpacing(),a!==m&&(P=!0,this.wiringRouterParams.setStartViaSize(a)),l.value!==g&&(P=!0,this.wiringRouterParams.setViaOutsideDiameter(l.value)),c.value!==y&&(P=!0,this.wiringRouterParams.setViaInsideDiameter(c.value)),this.isNeedUpdateAfterPlacingConfig(b,h.value)&&this.wiringRouterParams.setAfterPlacingTheViaSwitch2Layer(h.value),P&&wi()}updateOptions(e){let{routingCorner:r,maximumRadius:i,routingMode:n,pushVia:s,pathOptimization4BePushed:a,currentPathOptimization:l,removeLoop:c,minimumTrackCorners:h,isHideCopperRegion:u}=e,d=this.wiringRouterParams.getWiringCorner(),p=this.wiringRouterParams.getMaximumRadius(),m=this.wiringRouterParams.getRoutingMode(),g=this.wiringRouterParams.getPushVia(),y=this.wiringRouterParams.getPathOptimization4BePushed(),b=this.wiringRouterParams.getCurrentPathOptimization(),P=this.wiringRouterParams.getRemoveLoop().value,T=this.wiringRouterParams.getRemoveLoop().removeLoopOptions[0].value,I=this.wiringRouterParams.getRemoveLoop().removeLoopOptions[1].value,C=this.wiringRouterParams.getTrackMinCorner(),E=this.wiringRouterParams.getHideCopper(),O=!1;r!==d&&(O=!0,this.wiringRouterParams.setWiringCorner(r)),i!==p&&(O=!0,this.wiringRouterParams.setMaximumRadius(i)),n!==m&&(O=!0,this.wiringRouterParams.setRoutingMode(n)),s!==g&&(O=!0,this.wiringRouterParams.setPushVia(s)),a!==y&&(O=!0,this.wiringRouterParams.setPathOptimization4BePushed(a)),l!==b&&(O=!0,this.wiringRouterParams.setCurrentPathOptimization(l)),c.value!==P&&(O=!0,this.wiringRouterParams.setRemoveLoop(c.value)),c.removeLoopOptions[0].value!==T&&(O=!0,this.wiringRouterParams.setRemoveLoop(c.removeLoopOptions[0].value,"Remove Circuits Containing Vias")),c.removeLoopOptions[1].value!==I&&(O=!0,this.wiringRouterParams.setRemoveLoop(c.removeLoopOptions[1].value,"Remove Antenna")),h!==C&&(O=!0,this.wiringRouterParams.setTrackMinCorner(h)),u!==E&&(O=!0,this.wiringRouterParams.setHideCopper(u)),O&&wi()}updateCanvas(e){let{unit:r,gridType:i,blodGridType:n,blodGridRatio:s,gridSize:a,snapSize:l,snap:c,altSnapSize:h}=e,u=this.wiringRouterParams.getUnit(),d=this.wiringRouterParams.getGridType(),p=this.wiringRouterParams.getBlodGridType(),m=this.wiringRouterParams.getBlodGridRatio(),g=String(this.wiringRouterParams.getGridSize()),y=String(this.wiringRouterParams.getSnapSize()),b=this.wiringRouterParams.getSnap().value,P=this.wiringRouterParams.getAltSnapSize(),T=!1;r!==u&&(T=!0,this.wiringRouterParams.setUnit(r)),i!==d&&(T=!0,this.wiringRouterParams.setGridType(i)),n!==p&&(T=!0,this.wiringRouterParams.setBlodGridType(n)),s!==m&&(T=!0,this.wiringRouterParams.setBlodGridRatio(s)),a!==g&&(T=!0,this.updateCanvasGirdSnap("attr-grid-size",a)),l!==y&&(T=!0,this.updateCanvasGirdSnap("attr-snap-size",l)),c.value!==b&&(T=!0,this.wiringRouterParams.setSnap(c.value)),h!==P&&(T=!0,this.updateCanvasGirdSnap("attr-alt-grid-size",h)),T&&np()}updateCanvasGirdSnap(e,r){let i=r.toString().split(/,|，/),n,s;i.length==1?n=s=parseFloat(i[0]):i.length==2&&(n=parseFloat(i[0]),s=parseFloat(i[1])),!(isNaN(n)||isNaN(s))&&(e=="attr-grid-size"?this.wiringRouterParams.setGridSize(n,s):e=="attr-snap-size"?this.wiringRouterParams.setSnapSize(n,s):e=="attr-alt-grid-size"&&this.wiringRouterParams.setAltSnapSize(n,s))}};var gF=class extends In{getData(t,e){let r=Ys.getInstance();switch(t){case"startTrackWidthFollowLast":return e.trackWidthFollow=="last";case"lastTrackWidth":return ve(e.lastTrackWidth*10,4);case"startViaSizeFollowLast":return e.viaSizeFollow=="last";case"lastViaInnerDiameter":return ve(e.lastInnerRadius*20,4);case"lastViaDiameter":return ve(e.lastRadius*20,4);case"snap":return e.snap;case"routingMode":return M8e(e.routingMode);case"routingCorner":return Zt.getInstance().getRoutingTypeByEnum(e.routingCorner);case"removeLoop":return e.removeLoop;case"rotatingObject":return e.rotatingObject=="single";case"trackFollow":return e.trackFollow=="moveKeep";case"stretchTrackMinCorner":return e.stretchTrackMinCorner;case"preferenceConfig":return e.preferenceConfig;case"realTimeUpdateUnusedLayers":return e.realTimeUpdateUnusedLayers;case"unusedPadRange":return k8e(e.unusedPadRange);case"pushVia":return F8e(r.pushVia);case"pathOptimization4BePushed":return G8e(r.pathOptimization4BePushed);case"currentPathOptimization4BePushed":return H8e(r.currentPathOptimization4BePushed);case"removeCircuitsContainingVias":return r.removeCircuitsContainingVias;case"removeAntenna":return r.removeAntenna}}};var Zce=class extends S0{getData(t,e){let r=e.component;switch(this.id=e.globalIndex,t){case"partitionId":return e.partition;case"index":return this.id;case"groupId":return Ia(e);case"layerId":return e.layerId;case"depth":return ve(r.slotDepth*10,4);case"strokeWidth":return ve(e.strokeWidth*10,4);case"path":return this.getShapeInfo(e);case"locked":return e.locked;case"zIndex":return e.zIndex;case"refs":return[r.lineId]}}};var i5=class i5{constructor(t){this.ignorePartitionId=!1;this.version=t,this.format=new Ib().getConfig(t)}static getInstance(){return i5.tool==null&&(i5.tool=new i5("2.0")),i5.tool}setIgnorePartitionId(t){this.ignorePartitionId=t}getEncode(t){switch(t){case"CANVAS":return new FB;case"LAYER":return new VB;case"LAYER_PHYS":return new jB;case"ACTIVE_LAYER":return new GB;case"NET":return new UB;case"PRIMITIVE":return new HB;case"GROUP":return new WB;case"VIA":return new d3;case"PAD":return new mx;case"LINE":return new vx;case"ARC":case"CARC":return new xx;case"POLY":return new Rx;case"FILL":return new p3;case"FPC_FILL":return new jx;case"REGION":return new Dx;case"PARTITION":return new qx;case"POUR":return new zB;case"POURED":return new Xx;case"INNER":return new uA;case"IMAGE":return new wx;case"OBJ":return new Vx;case"TEARDROP":return new Lx;case"FONT":return new sA;case"STRING":return new f3;case"ATTR":return new YP;case"DIMENSION":return new Mx;case"DIMENSIONATTR":return new Nx;case"COMPONENT":return new m3;case"PAD_NET":return new g3;case"RULE_TEMPLATE":return new a8;case"RULE":return new o8;case"RULE_SELECTOR":return new YB;case"EQLEN_GRP":return new $B;case"EQLEN":return new KB;case"SHELLCUT":return new Zce;case"SHELL_ENTITY":return new Gx;case"SHELL":return new kx;case"CREASE":return new Bx;case"BOSS":return new Fx;case"PANELIZE":return new XB;case"SILK_OPTS":return new qB;case"PREFERENCE":return new gF;case"FONT":return new sA;case"INNER":return new uA;case"BOARD":return new mF}}feed(t,e){let r=t;r=="DIMENSIONATTR"&&(r="ATTR");let i=this.getItemFormat(r),n=this.getEncode(t),s={};for(let a of i)this.ignorePartitionId&&a=="partitionId"||(s[a]=this.getData(a,n,e));return s}getItemFormat(t){return this.format[t]}getData(t,e,r){return e.getData(t,r)}encode(t,e){return this.feed(t,e)}encodeProfile(t){switch(t.type){case"Board Outline":case"Line":return this.encode("POLY",t);case"Fill Region":case"Slot Region":return this.encode("FILL",t);case"Prohibited Region":case"Constraint Region":return this.encode("REGION",t);case"Copper Region":return this.encode("POUR",t);case"Partition":return this.encode("PARTITION",t);case"TearDrop":return this.encode("TEARDROP",t);case"FPC Stiffener":return this.encode("FPC_FILL",t);case"3D Shell - Outline":return this.encode("SHELL",t);case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":return this.encode("SHELL_ENTITY",t);case"3D Shell - Side Datum Line":return this.encode("CREASE",t);case"3D Shell - Screw Pillar":return this.encode("BOSS",t);case"Board":return this.encode("BOARD",t)}return null}encodeComponent(t,e){if(!e)return;let r=this.feed(t,e),i=new Map,n=[],s=e.attributes,a=!0;for(let h of s)h.key=="Device"&&(a=!1),$d(h,e)&&i.set(h.globalIndex,this.feed("ATTR",h));if(a)throw new Error("The device is missing device attributes, saving will lead to data loss, please contact the official customer service in time!");return e.getPads().forEach(h=>{n.push(this.feed("PAD_NET",h))}),e.getItems().filter(h=>h.modelType=="Via").forEach(h=>{n.push(this.feed("PAD_NET",h))}),{componentData:r,attrData:i,padNetData:n}}};i5.tool=null;var Sr=i5;var oEe=new Map,zvt="The font was not found,has automatically switched to the browser's default font.",sEe=class{async getPath(t,e,r,i,n,s,a=!1,l=!1){typeof e!="string"&&(e="default");let c=jy.getFontTemplate(t);if(c!=null&&jy.isEqual(e,r,i,n,s,a,l,c)||(c=jy.getFontCache(e,r,i,n,s,a,l),c!=null))return c.polylines;{if(r=="")return[];await this.hasFontFamily(e),A.publish("AwaitService",1);let h=a?"bold":"normal",u=l?"italic":"normal",d=r.split(`
`),p=new Array,m=0,g=0,y=0,b=i;for(let O=0,_=d.length;O<_;O++){let x=d[O];if(x.length==0){y=g,g+=b;continue}let v=(await A.windowBridge.rpcCall("/engine/extractFont",[x,{"font-family":e,"font-size":i,"font-weight":h,"font-style":u}],Q())).message,D=v[0],w=v[1],F=v[2];b=F,m=Math.max(m,w),y=g,D.forEach(H=>{for(let z of H)for(let V=0,W=z.ys.length;V<W;V++)z.ys[V]-=y;p.push(H)}),g+=F}A.publish("AwaitService",-1);let P=new Array,T=p.length;for(let O=0;O<T;O++){let _=p[O],x=[];_.forEach(v=>{let D=v.xs.length,w=[];for(let H=0;H<D;H++){let z=new S(ve(v.xs[H],5),ve(v.ys[H],5));w.push(z)}let F=ge.build4(w);x.push(F)}),P=[].concat(P,x)}let I=Qe.translate(0,y);if(P=this.transform(P,I),n){let O=new ht(0,m,0,g),_=this.getReverse(O,s);m+=s*2,g+=s*2,P=P.map(v=>v.reverse()),P.push(_);let x=Qe.translate(s,s);P=this.transform(P,x)}P=Jh(I0(P));let C=jy.addFontCache(e,r,i,n,s,m,g,P,a,l),E=Sr.getInstance().encode("FONT",C);return R.getInstance().compiler.uploadFont(E),P}}async hasFontFamily(t){let e=!1;return oEe.has(t)?e=oEe.get(t):(e=await new FontFace(t,`local('${t}')`).load().then(i=>!0).catch(i=>!1),oEe.set(t,e),e||A.publish("ui/toastMsg",{type:"info",msg:{text:zvt}},Q())),e}transform(t,e){let r=new Array;for(let i of t){let n=i.multiply3(e);r.push(n)}return r}getReverse(t,e){return t=t.extendOfSize(e),ge.build4([t.LL(),t.LR(),t.UR(),t.UL(),t.LL()])}getSvg(t){let e="",r=new Set;for(let i=0;i<t.length;i++){let n=t[i],s="";Object.values(n).forEach(a=>{typeof a=="string"?r.add(a):typeof a=="number"&&(a=Math.round(a*1e4)/1e4),s=s+a+" "}),e=e+s+" "}return e}},gYe=new sEe;function Jce(o){let t=o.getText();if(t==""||t==null)return o.updateTextOutlines([]),o.setTextBox(0,0),!0;let e=YO(o.globalIndex,o.fontFamily,t,o.fontSize,o.reverse,o.reverseExpansion,o.strokeWidth);return e!=null?(o.updateTextOutlines(e.path),o.setTextBox(e.width,e.height),!0):!1}var mYe=330;function Yvt(o,t){var h;let e=document.createElementNS("http://www.w3.org/2000/svg","svg"),r=document.createElementNS("http://www.w3.org/2000/svg","text");e.appendChild(r),r.textContent=o,r.style.whiteSpace="pre";let i=t,n=Number(i["font-size"]||"8");i["font-size"]=`${mYe}`,i["font-family"]=(h=i["font-family"])==null?void 0:h.split(",").map(u=>(u=u.trim(),u.startsWith('"')&&u.endsWith('"')||u.startsWith("'")&&u.endsWith("'")?u:`"${u}"`)).join(",");for(let u in i)e.setAttribute(u,i[u]);document.body.appendChild(e);let s=e.getBBox();document.body.removeChild(e);let a=n/mYe,l=Math.ceil(s.width),c=Math.ceil(s.height);return{width:l*a,height:c*a}}function yYe(o,t,e,r,i,n,s,a=!1,l=!1){if(e==""||e==null)return{width:0,height:0};let c=YO(o,t,e,r,i,n,s);if(c!=null)return{width:c.width,height:c.height};{if(e=="")return{width:0,height:0};let h=a?"bold":"normal",u=l?"italic":"normal",d=e.split(`
`),p=0,m=0,g=0,y=r;for(let b=0,P=d.length;b<P;b++){let T=d[b];if(T.length==0){m+=y;continue}let I=Yvt(T,{"font-family":t,"font-size":r,"font-weight":h,"font-style":u}),C=I.width,E=I.height;y=E,p=Math.max(p,C),g=m,m+=E}return i&&(p+=n*2,m+=n*2),{width:p,height:m}}}var aEe=class{constructor(){this.list=new Set;this.timeout=null}addText(t){Lf.ins.deleteFont(t.model),Jce(t)||(this.list.add(t),this.timeout!=null&&(clearTimeout(this.timeout),this.timeout=null),this.timeout=setTimeout(async()=>{let r=new Set(this.list);this.list.clear(),await this.execute(r),this.timeout=null},0))}async execute(t){let e=new Array;this.promises=e;let r=new Set,i=new Set;for(let n of t)if(Jce(n))r.add(n);else{let a=n.getText(),l=`${n.fontFamily}/${a}/${n.fontSize}/${n.reverse}/${n.reverseExpansion}/`;if(i.has(l))continue;i.add(l);let c=gYe.getPath(n.globalIndex,n.fontFamily,a,n.fontSize,n.reverse,n.reverseExpansion);e.push(c)}for(let n of r)t.delete(n);e.length>0&&await Promise.all(e);for(let n of t)Jce(n);return t.clear(),this.promises=null,!0}async loadTextSuccess(){return this.promises&&await Promise.all(this.promises),!0}},ep=new aEe;var lr=class extends Ls{constructor(e){super();this.textChange=!0;this.model=e,this.fixFontFamily(),this.textChange=!0,ep.addText(this),e.setModelWatcher(this),Ro("editor/shape/PcbText")}get box(){return this.model.box}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId!=e&&(this.model.layerId=e,this.refreshRender())}set origin(e){this.model.origin!=e&&(this.model.origin=e,this.refreshRender())}get origin(){return this.model.origin}get mirror(){return this.model.mirror}set mirror(e){this.model.mirror!=e&&(this.model.mirror=e,this.refreshRender())}get rotation(){return this.model.rotation}set rotation(e){this.model.rotation!=e&&(this.model.rotation=e,this.refreshRender())}get key(){return this.model.key}set key(e){this.model.key!=e&&(this.model.key=e,this.textChange=!0,ep.addText(this))}get showKey(){return this.model.showKey}set showKey(e){this.model.showKey!=e&&(this.model.showKey=e,this.fixFontFamily(),this.textChange=!0,ep.addText(this))}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get value(){return this.model.value}set value(e){if(this.key==""&&e==""||this.model.value==e&&this.model.key!=="Name")return;this.model.value=e;let r=this.getParent();if(r!=null&&r instanceof ke)if(this.key=="Designator"&&r.name!=e)r.name=this.value;else if(this.key=="Name"){r.modifyATTRMap(this.key,e);let i=r.getFormulaName();this.model.value=i}else r.modifyATTRMap(this.key,e);this.fixFontFamily(),this.textChange=!0,ep.addText(this)}get showValue(){return this.model.showValue}set showValue(e){this.model.showValue!=e&&(this.model.showValue=e,this.fixFontFamily(),this.textChange=!0,ep.addText(this))}get position(){return this.model.position}set position(e){this.model.position.equals1(e)||(this.model.position=e,this.refreshRender())}set positionIsNull(e){this.model.positionIsNull=e}get positionIsNull(){return this.model.positionIsNull}get fontSize(){return this.model.fontSize}set fontSize(e){e=oo(e),this.model.type===0&&e<=this.strokeWidth&&(e=this.strokeWidth+e),this.model.fontSize!=e&&(this.model.fontSize!=e&&(this.model.fontSize=e),this.textChange=!0,ep.addText(this))}get textWidth(){return this.textChange&&this.updateCurrentBox(),this.model.box.width}get textHeight(){return this.textChange&&this.updateCurrentBox(),this.model.box.height}get strokeWidth(){return this.model.strokeWidth}set strokeWidth(e){e>=this.fontSize&&(e=this.fontSize-.1),e=oo(e),this.model.strokeWidth!=e&&(this.model.strokeWidth=e,this.textChange=!0,ep.addText(this))}get fontFamily(){return this.model.fontFamily}set fontFamily(e){this.model.fontFamily!=e&&this.refreshFamily(e)}refreshFamily(e){let r=this.model,{key:i,value:n,showKey:s,showValue:a}=r,l=this.getTextValue(i,n,s,a),c=r.type,h=c,u=r.fontFamily;if(!cy.everyCharHasDefaultFontPath(l)||!Hk.everyCharHasDefaultFontPath(l)||e!=""&&!["default","default2","Serif","Sans Serif"].includes(e)?(h=1,u=WIe(e)):e==="default2"?(h=0,u=ut.defaultTextFamily[2]):e==="Serif"?(h=0,u=ut.defaultTextFamily[3]):e==="Sans Serif"?(h=0,u=ut.defaultTextFamily[4]):(h=0,u=ut.defaultTextFamily[0]),c!=h){let d=Mo.remove(this,this.getType());r.type=h,d&&Mo.attach(this,this.getType())}r.fontFamily=u,this.textChange=!0,ep.addText(this)}get reverse(){return this.model.reverse}set reverse(e){this.model.reverse!=e&&(this.model.reverse=e,this.textChange=!0,ep.addText(this))}get reverseExpansion(){return this.model.reverseExpansion}set reverseExpansion(e){this.model.reverseExpansion!=e&&(this.model.reverseExpansion=e,this.textChange=!0,ep.addText(this))}get path(){return this.model.outline}get matrix(){return this.model.matrix}get width(){return this.model.width}get height(){return this.model.height}get outlineModified(){return this.model.outlineModified}get hasHelpLine(){return this._helpLine&&this._helpLine.length>0||!1}updateCurrentBox(){let{globalIndex:e,fontFamily:r,fontSize:i,reverse:n,reverseExpansion:s,strokeWidth:a}=this,l=this.getText(),{width:c,height:h}=yYe(e,r,l,i,n,s,a);this.setTextBox(c,h)}fixFontFamily(){let e=IFe(this.getText(),this.model.fontFamily,this.model.type);this.model.fontFamily=e.fontFamily,this.model.type=e.type}getTextValue(e,r,i,n){let s="";return e!=""&&r===""&&R.getInstance().doctype!=3&&this.getParent()==null&&e!="Footprint"&&!we.footprintIsConnectDevice&&(r=`<${e}>`),i?n?s=e+":"+r:s=e:n?s=r:s="",s}removeHelpLine(){this._helpLine&&(this._helpLine.forEach(e=>{e.remove()}),this._helpLine.length=0)}createHelpLine(){let e=this.getParent();if(e!=null&&e instanceof ke&&this.key&&this.getText()!=""&&jt.getVisible(2)){this._helpLine||(this._helpLine=[]);let r=new cr(1002,e.position,this.position,!0);this._helpLine.push(r),this.createCross(this.position),this.createCross(e.position)}}createCross(e){let r=new S(2.5,0),i=new S(0,2.5),n=new cr(1002,e.add(r),e.sub(r),!0),s=new cr(1002,e.add(i),e.sub(i),!0);this._helpLine||(this._helpLine=[]),this._helpLine.push(n),this._helpLine.push(s)}getFontCache(){if(this.model.type==1){let e=jy.getFontTemplate(this.globalIndex);return e==null&&(e=jy.getFontCache(this.fontFamily,this.getText(),this.fontSize,this.reverse,this.reverseExpansion)),e}}getFlip(e){return!!is(e)}setValue(e){this.model.value=e,this.fixFontFamily(),this.textChange=!0,ep.addText(this)}updateTextOutlines(e){this.model.outline=e,this.refreshRender()}setTextBox(e,r){this.model.updateBox4(e,r),this.textChange=!1}getText(){return this.getTextValue(this.model.key,this.model.value,this.model.showKey,this.model.showValue)}initVisible(){let e=jt.getElementFilterVisible(this);this.key!=""&&(e=jt.getVisible(2)),this.setDataState(0,e)}visible(e=!1){if(this.key!=""&&!jt.getVisible(2)){this.isVisible&&this.hidden();return}(this.key==""||this.key!=""&&jt.getVisible(2))&&(this.unHighLight(),this.removeHelpLine()),super.visible(e)}hidden(){this.removeHelpLine(),super.hidden()}click(e=!1,r=!1){this.isEmpty||this.key!=""&&!jt.getVisible(2)||((this.key==""||this.key!=""&&jt.getVisible(2))&&this.updateHelpLine(),this.key!=""?jt.getVisible(2)&&super.click(e,r):super.click(e,r))}updateHelpLine(){this.removeHelpLine(),this.createHelpLine()}deleteHelpLine(){this.removeHelpLine()}getType(){return this.model.type==0?21:6}getRenderData(){return this.textChange&&this.updateCurrentBox(),super.getRenderData()}getViewState(){return this.isEmpty?"Not Shown":!this.isVisible||this.model.getText()==""||!this.path||!this.path.length?"Not Shown":this.isHighLight?"Main And Highlight":"Only Main"}transform(e){this.model.transform(e),this.removeHelpLine(),this.refreshRender()}remove(){this.isEmpty||(this.getParent()==null?(this.textChange=!1,super.remove()):(this.isVisible=!1,this.model.showKey=!1,this.model.showValue=!1,this.textChange=!0,ep.addText(this),this.refreshRender()),this.removeHelpLine())}isSelect(e,r){return this.key==""&&this.getParent()!=null?!1:(this.textChange&&this.updateCurrentBox(),!!this.model.inShape(e,r))}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.transform(i)}getOffset(e){switch(e){case 3:return new S(0,0);case 2:return new S(0,.5);case 1:return new S(0,1);case 6:return new S(.5,0);case 5:return new S(.5,.5);case 4:return new S(.5,1);case 9:return new S(1,0);case 8:return new S(1,.5);case 7:return new S(1,1);default:return new S(0,0)}}getTextOutline(){this.textChange&&this.updateCurrentBox();let e=this.model.matrix,r=this.model.outline;return this.model.type==1?(r=r.map(i=>i.multiply3(e.toMatrix3())),r):r.map(i=>i.multiply3(e.toMatrix3()))}getRealOutline(){this.textChange&&this.updateCurrentBox();let e=this.model.matrix,r=this.model.outline;if(this.model.type==1){let i=jvt(this);return i.forEach(n=>{n.pl=n.pl.multiply3(e.toMatrix3())}),i}else return r.map(i=>i.multiply3(e.toMatrix3()))}getMathGraphics(e,r=0){return this.isEmpty?null:this.model.getMathGraphics(e,r)}buildBBox(){return this.isEmpty?null:(this.textChange&&this.updateCurrentBox(),this.model.buildBBox())}toJSON(){var i,n;let e=this.getFontCache();return{globalIndex:this.globalIndex,layerId:this.layerId,key:this.key,showKey:this.showKey,value:this.value,formulaName:(i=this.getParent())==null?void 0:i.attrsMapSource[this.key],showValue:this.showValue,fontFamily:this.fontFamily,fontSize:this.fontSize,rotation:this.rotation,locked:this.locked,position:this.position,origin:this.origin,strokeWidth:this.strokeWidth,reverse:this.reverse,reverseExpansion:this.reverseExpansion,silkColor:((n=this.silkColor)==null?void 0:n.toString())||null,mirror:this.mirror,font:e,positionIsNull:this.positionIsNull}}toJSON1(){var i;let e=this.getFontCache();return{globalIndex:this.globalIndex,layerId:this.layerId,key:"",showKey:!1,value:this.getText(),showValue:!0,fontFamily:this.fontFamily,fontSize:this.fontSize,rotation:this.rotation,locked:this.locked,position:this.position,origin:this.origin,strokeWidth:this.strokeWidth,reverse:this.reverse,reverseExpansion:this.reverseExpansion,silkColor:((i=this.silkColor)==null?void 0:i.toString())||null,mirror:this.mirror,font:e,positionIsNull:this.positionIsNull}}},Qce=class extends lr{constructor(){super(...arguments);this._parent=void 0}};function jvt(o){let t=new Array,e=o.getText();if(e=="")return t;if(o.model.type==1){let r=o.getParent(),i=o.globalIndex;r!==null&&r instanceof ke&&(i.includes(r.globalIndex)||(i=r.globalIndex+i));let n=jy.getFontTemplate(i);if(n!=null&&n.text==e){let s=n.polylines,a=new wf("",0,s);t=t.concat(a.pls)}else if(n=jy.getFontCache(o.fontFamily,o.getText(),o.fontSize,o.reverse,o.reverseExpansion),n!=null){let s=n.polylines,a=new wf("",0,s);t=t.concat(a.pls)}}return t}var Xvt=["Reuse Block","Add into BOM","Layer","Locked","Device","Footprint","3D Model","FootprintId","3D Model Transform","3D Model Title","ID"];function lEe(o,t,e){if(!cEe(o,t,e))return!1;let r=hEe(e);return`={${r[0]}}`===e&&!Xvt.includes(r[0])}function cEe(o,t,e){return!(o!==3||t!=="Name"||!e||!e.startsWith("="))}function hEe(o){let t=/\{([^\}]+)\}/g,e=null,r=[];for(;e=t.exec(o);)r.push(e[1]);return r}function YV(o){let t=new _e,e=o.model.outline,r=o.model.matrix;for(let i of e)t.ext1(i.multiply3(r.toMatrix3()).bbox());return o.model.type==0&&t.ext7(o.strokeWidth/2),t.build1()}function bYe(o,t,e,r,i,n){return o?(PYe(o,t,e,r),o.inShape(i,n)):!1}function PYe(o,t,e,r){if(o)if(t==2){let n=Ae.getMatrix4(S.ORIGIN,(Math.PI-r)%Wd,-1,e);o.transform(n)}else{let n=Ae.getMatrix4(S.ORIGIN,r,1,e);o.transform(n)}}function TYe(o,t,e,r,i,n){if(o){PYe(o,t,e,r);let s=new As(o.getMathGraphics(),i,0);switch(n){case"inside":if(s.relation==2)return!0;break;case"contact":if(s.relation!=3)return!0;break}}return!1}var ke=class extends Ls{constructor(e,r,i){super();this.pads=new Array(0);this.attrs={};this.others=new Array(0);this.model=i,i.setModelWatcher(this);for(let n of r)n instanceof Le?this.pads.push(n):this.others.push(n),n.setParent(this);for(let n of e)this.attrs[n.key]=n,n.setParent(this);A.publish("ComponentChanged",this),this.refreshRender(),Ro("editor/shape/Component")}get attrsMap(){return this.model.attrsMap}get reuseBlock(){return this.model.reuseBlock}set reuseBlock(e){this.model.reuseBlock=e.trim()}get combinationID(){return this.model.combinationID}set combinationID(e){this.model.combinationID=e.trim()}get channelID(){return this.model.channelID}set channelID(e){this.model.channelID=e.trim()}get deviceUUID(){return this.model.deviceUUID}get footprintUUID(){return this.model.footprintUUID}set footprintUUID(e){this.model.footprintUUID=e}get numShape(){return this.attrs.Designator}set numShape(e){this.attrs.Designator=e,e.setParent(this)}get deviceShape(){return this.attrs.Device}set deviceShape(e){this.attrs.Device=e,e.setParent(this)}get idShape(){return this.attrs.Footprint}set idShape(e){this.attrs.Footprint=e,e.setParent(this)}get attributes(){return Array.from(Object.values(this.attrs))}get attrsObject(){return this.attrs}get attrKeyValue(){return this.model.attrKeyValue}get attrsMapSource(){return this.model.attrsMapSource}get attrKeyText(){return this.attrs}get locked(){return this.model.locked}set locked(e){this.model.locked=e}setNet(e,r,i){this.model.setNet(e,r,i)}getNet(e,r){return this.model.getNet(e,r)}deleteNet(e,r){this.model.deleteNet(e,r)}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId!=e&&(this.model.layerId=e,this.refreshRender()),A.publish("ComponentChanged",this)}get position(){return this.model.position}set position(e){e.x===this.position.x&&e.y===this.position.y||(this.model.position=e,this.refreshRender())}get name(){return this.model.name}set name(e){this.model.name!=e&&(this.modifyATTRMap("Designator",e),this.numShape.value=e)}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get footprintId(){return this.model.footprintId}set footprintId(e){this.idShape&&(this.idShape.value=e),this.modifyATTRMap("Footprint",e)}get device(){return this.model.device}set device(e){this.deviceShape.value=e,this.modifyATTRMap("Device",e);let r=ts.getItem(this.model.deviceUUID);if(r==null)throw new Error(`Device ${this.model.deviceUUID} loss!!!data error!!!`);r.add(this.model)}get designator(){return this.model.designator}get rotation(){return this.model.rotation}set rotation(e){this.model.rotation!=e&&(this.model.rotation=e,this.refreshRender()),this.model.rotation=e,A.publish("ComponentChanged",this)}set textOffset(e){this.model.textOffset=e}get textOffset(){return this.model.textOffset}get leftLow(){return this.model.box.leftLow}get leftUp(){return this.model.box.leftUp}get rightUp(){return this.model.box.rightUp}get rightLow(){return this.model.box.rightLow}getBoundFootprint(){return Ji.getInstance().getItem(this.footprintUUID)}getBasicLayerTable(){let r=this.model.getChildrenLayerIdSet(!0,!1);return this.getBoundFootprint().getBasicLayerTable(r)}getLayerIdReplacementTable(){return this.model.getLayerIdReplacementTable()}setLayerIdReplacementTable(e,r){let i=this.getLayerIdReplacementTable(),n=my(i),s=my(e);if(n&&s)return;let a=hM(i),l=hM(e),{less:c,more:h,same:u}=PL(a,l),d=new Map;this.iterateAllChildren(p=>{ug(d,p.layerId,[],!0).push(p)}),sc(c,p=>{let m=i[p];if(!m)return;let g=parseInt(p),y=ug(d,m);sc(y,b=>{b.layerId=g})}),sc(h,p=>{let m=e[p];if(!m)return;let g=parseInt(p),y=ug(d,g);sc(y,b=>{b.layerId=m})}),sc(u,p=>{let m=i[p];if(!m)return;let g=e[p];if(!g||m==g)return;let y=ug(d,m);sc(y,b=>{b.layerId=g})}),r&&kf(e,p=>{Tx(d,p)||delete e[p]}),this.model.setLayerIdReplacementTable(e,r,!0)}itemLayerIsOpened(e){let r=e.layerId;if(r){let i=Pe.getLayer(r);return i&&i.config}return!0}itemLayerIsOpenAndVisible(e){let r=e.layerId;if(r){let i=Pe.getLayer(r);return i&&i.config&&i.visible}return!0}iterateShapes(e){for(let r of this.pads)if(e(r))return!0;for(let r of this.others)if(e(r))return!0;return!1}generateValidId(){let e=this.getAllId(),r;for(;;){let i=nr();if(r=`${this.globalIndex}${i}`,!e.has(r))break}return r}getAllId(){let e=new Set;for(let r in this.attrs)e.add(this.attrs[r].globalIndex);return this.pads.forEach(r=>{e.add(r.globalIndex)}),this.others.forEach(r=>{e.add(r.globalIndex)}),e}getPads(){return this.pads}updatePads(e,r){r=="add"&&(this.pads.push(e),e.setParent(this)),r=="delete"&&(this.pads=this.pads.filter(i=>i!==e)),this.model.updatePads(e.model,r)}getVias(){let e=new Array;for(let r of this.others)r instanceof Ue&&e.push(r);return e}getItems(){let e=new Array;for(let r of this.pads)e.push(r);for(let r of this.others)e.push(r);return e}iterateItems(e){let r=sc(this.pads,e);return r||sc(this.others,e)}iterateAttrs(e){return kf(this.attrs,e)}iterateAllChildren(e){let r=this.iterateItems(e);return r||this.iterateAttrs(e)}getOutlines(){return this.others.filter(e=>e instanceof He&&e.layerId==11)}getTexts(){let e=new Array;for(let r of this.others)r instanceof lr&&e.push(r);for(let r in this.attrs)e.push(this.attrs[r]);return e}flip(e,r){this.model.flip(e,r),this.refreshRender(),A.publish("ComponentChanged",this)}addAttribute(e){this.attrs[e.key]=e;let r=/^=\{([^\}]+)\}/g;(e.key!=="Name"||e.key=="Name"&&!r.test(this.model.attrsMap[e.key]||""))&&this.modifyATTRMap(e.key,e.value),e.setParent(this),this.model.addAttribute(e.model),this.refreshRender(),A.publish("ComponentChanged",this)}removeAttribute(e){delete this.attrs[e.key],this.model.removeAttribute(e.model),e.setParent(void 0),e.remove(),ri.delete(e),A.publish("delete",e),A.publish("ComponentChanged",this)}getFormulaName(){return this.model.getFormulaName()}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.transform(i)}set manualHighLight(e){for(let r of this.pads)r.manualHighLight=e;for(let r of this.attributes)r.manualHighLight=e;for(let r of this.others)r.manualHighLight=e;super.manualHighLight=e}visible(e=!1){for(let r of this.pads)r.updateFilterVisible=!0,r.visible(),r.highlightByComponent=!1;for(let r of this.attributes)r.updateFilterVisible=!0,r.visible();for(let r of this.others)r.updateFilterVisible=!0,r.visible(),r instanceof He?r.fill():r instanceof Ue&&(r.highlightByComponent=!1);this.maskChildRender=!0,super.visible(e),this.maskChildRender=!1}hidden(){for(let e of this.pads)e.hidden(),e.highlightByComponent=!1;for(let e of this.attributes)e.hidden();for(let e of this.others)e.hidden(),e instanceof Ue&&(e.highlightByComponent=!1);this.maskChildRender=!0,super.hidden(),this.maskChildRender=!1}get maskChildRender(){return this.hasDataState(10)}set maskChildRender(e){this.setDataState(10,e)}click(e=!1,r=!1){var u;let i=(u=Pe.getLayer(this.layerId))==null?void 0:u.visible;if(!i){this.visible();return}let n=Ri.getInstance(),s=n.getItem(3).visible,a=n.getItem(9).visible,l=n.getItem(6).visible,c=n.getItem(5).visible,h=n.getItem(2).visible;this.maskChildRender=!0,super.click(e,r),this.maskChildRender=!1;for(let d of this.pads){if(!i||!c&&d.isTestPad||!d.isTestPad&&!l||!this.itemLayerIsOpenAndVisible(d)){d.unHighLight(),d.highlightByComponent=!1;continue}d.highlightByComponent=!0}for(let d of this.others){if(!i||!this.itemLayerIsOpenAndVisible(d)){d instanceof Ue&&(d.highlightByComponent=!1),(d instanceof lt||d instanceof Pr)&&(d.notShowFill=!0),d.unHighLight();continue}let p=!1;if((!s&&(d.model.layerId==3||d.model.layerId==4)||!a&&d instanceof Ue)&&(p=!0),p){d.unHighLight();continue}d instanceof Ue?d.highlightByComponent=!0:d.click(e,r)}for(let d of this.attributes){if(!i||!h||!this.itemLayerIsOpenAndVisible(d)){d.unHighLight();continue}d.click(e,r)}if(this.needUpdateBBox){let d=this.position,p=this.rotation,m=Ae.translate(-d.x,-d.y,0).rotateZ(-p),g=Ae.rotateZ(p).translate1(d.x,d.y,0);this.transform(m),this.updateComponentBBox(),this.transform(g),this.pads.forEach(y=>{let b=re.getInstance().getNet(y.net);if(b==null)throw new Error(`Net ${y.net} loss!!!`);y.iteratorRatlines(P=>{b.showRatline?P.visible():P.hidden()})}),this.needUpdateBBox=!1}}remove(){for(let e of this.pads)e.highlightByComponent=!1,e.remove(),A.publish("delete",e);this.pads.length=0;for(let e of this.attributes)e.setParent(void 0),e.remove(),A.publish("delete",e);this.attrs={};for(let e of this.others)e.setParent(void 0),e instanceof Ue&&(e.highlightByComponent=!1),e.remove(),A.publish("delete",e);this.others.length=0,this.model.remove(),super.remove(),A.publish("ComponentChanged",this),this.refreshRender()}updateComponentBBox(){let e=this.getItems(),r=[];for(let s of e)this.itemLayerIsOpened(s)&&!s.isEmpty&&r.push(s);let i=new _e;for(let s of r){let a=s.buildBBox();a!=null&&i.ext1(a)}let n=i.build1();this.model.box.leftLow=n.LL(),this.model.box.leftUp=n.UL(),this.model.box.rightLow=n.LR(),this.model.box.rightUp=n.UR()}transform(e){this.model.transform(e),A.publish("ComponentChanged",this),this.refreshRender(!0)}isSelect(e,r,i=!1){if(this.getParent()!=null)return!1;if(i){let n=this.getVisibleBBox(),s;return n&&(s=new bs(1,n.LL(),n.UL(),n.LR(),n.UR(),!1,n)),bYe(s,this.layerId,this.position,this.rotation,e,r)}return!!this.model.inShape(e,r)}isBoxSelect(e,r){let i=this.getVisibleBBox(),n;return i&&(n=new bs(1,i.LL(),i.UL(),i.LR(),i.UR(),!1,i)),TYe(n,this.layerId,this.position,this.rotation,e,r)}getVisibleBBox(){let e=Hi.getItem(this.footprintUUID),r=e==null?void 0:e.getLayeredBoxMap();if(r){let i,n=new _e;for(let s in r){let a;this.getLayerIsVisible(+s)&&(a=r[s],n.ext1(a))}if(n.valid())return i=n.build(),i}return null}getLayerIsVisible(e){let r=e;return this.layerId==2&&(r=sg(e)),Pe.getLayer(r).visible}getAttrBBox(){let e=new _e,r=!1;for(let i in this.attrs){let n=this.attrs[i];if(n.showKey&&n.key!==""||n.showValue&&n.value!==""){r=!0;let s=n.buildBBox();s!=null&&e.ext1(s)}}if(r)return e.build1()}addATTRMap(e,r){this.model.addATTRMap(e,r)}modifyATTRMap(e,r){if(e=="Value"&&this.attrsMap[e]!=null&&this.attrsMap[e]!=r&&this.attrsMap["Supplier Part"]!=null&&this.attrsMap["Supplier Part"]!=""&&(A.publish("clearSupplierPart",{id:this.globalIndex,designator:this.designator,"Supplier Part":this.attrsMap["Supplier Part"]}),this.model.attrsMap["Supplier Part"]="",this.attrKeyText["Supplier Part"]!=null&&(this.attrKeyText["Supplier Part"].value="")),e=="Name"){if(this.model.attrsMap[e]==r)return;if(this.getFormulaName()==r)return}if(e=="Designator"&&this.model.name!=null&&r!=null){let i=Hi.getItem(this.model.footprintUUID);if(i==null)throw new Error(`Footprint loss:${this.model.footprintUUID}`);i.modifyName(this.model.name,r)}this.model.modifyATTRMap(e,r),this.attrs.Name!=null&&this.attrs.Name.value!=this.getFormulaName()&&(this.attrs.Name.value=this.getFormulaName()),A.publish("ComponentChanged",this)}deleteATTRMap(e){this.model.deleteATTRMap(e),A.publish("ComponentChanged",this)}clearMap(){this.model.clearMap()}getNewTextPosition(){return this.model.getNewTextPosition()}toJSON(){var g;let e=Hi.getItem(this.footprintUUID);e==null&&console.error(`Footprint loss:${this.model.footprintUUID}`);let r=e.uuid,i;if(e instanceof Sc){let y=Hi.getItem(e.source);y==null?console.error(`Custom Footprint Source loss:${e.source}`):(r=y.uuid,i=e.uuid)}let n=ts.getItem(this.model.deviceUUID),s;n!=null?s=n.uuid:console.error(`Device loss:${this.model.deviceUUID}`);let a=new Array,l=this.attributes;for(let y of l)a.push(y.toJSON());let c=this.getPads(),h=this.getVias(),u=[];for(let y=0;y<c.length;y++){let b=c[y];u.push({num:b.num,net:b.net,id:b.globalIndex.replace(this.globalIndex,""),padLen:$o.getInstance().getPadLen(this.globalIndex,b.globalIndex)})}for(let y=0;y<h.length;y++){let b=h[y],P=b.getParent(),T;if(P!=null){let I=P.globalIndex,C=new RegExp(I);T=b.globalIndex.replace(C,"")}else T=b.globalIndex;u.push({num:T,net:b.net,id:T})}let d={},p=!1;for(let y of this.getPads())y.partition!=""&&(d[y.globalIndex]=y.partition,p=!0);for(let y of this.getVias())y.partition!=""&&(d[y.globalIndex]=y.partition,p=!0);let m={footprint:r,device:s,globalIndex:this.globalIndex,layerId:this.model.layerId,position:this.model.position,rotation:this.model.rotation,textOffset:this.model.textOffset,locked:this.model.locked,silkColor:((g=this.silkColor)==null?void 0:g.toString())||void 0,attrsMap:{...this.model.attrsMap},ATTR:a,pads:u};return p&&(m.childPartition=d),i!=null&&(m.custom=i),m}getMathGraphics(e=this.layerId,r=0){return this.model.getMathGraphics(e,r)}getFlip(e){return 2==e}modifyAttrPosition(e,r){if(!(e.showValue&&e.value||e.showKey&&e.key))return;let i=YV(e),n=this.buildBBox();if(n==null)throw new Error("this component was removed!!!");let s=n.LL(),a=n.LR(),l=n.UL(),c=n.UR();this.getFlip(this.model.layerId)&&(a=n.LL(),s=n.LR(),c=n.UL(),l=n.UR());let h=i.width()/2,u=i.height()/2,d=a.sub(s).normalize().mul(h),p=l.sub(s).normalize().mul(u),m;switch(r){case 3:m=s.sub(d).sub(p);break;case 2:m=s.add(l).mul(.5).sub(d);break;case 1:m=l.add(p).sub(d);break;case 6:m=s.add(a).mul(.5).sub(p);break;case 5:m=n.center();break;case 4:m=l.add(c).mul(.5).add(p);break;case 9:m=a.add(d).sub(p);break;case 8:m=a.add(c).mul(.5).add(d);break;case 7:m=c.add(d).add(p);break}let g=m.sub(i.center()),y=Ae.translate(g.x,g.y,0);e.transform(y)}refreshNameValue(){this.attrKeyText.Name!=null&&(this.attrKeyText.Name.value=this.getFormulaName())}resetAttr(e){e&&e.key!=""&&(e.showValue||e.showKey)&&e.positionIsNull&&(e.origin!=3&&(e.origin=3),e.position=this.getNewTextPosition(),e.positionIsNull=!1,e.key==="Name"&&(e.value=this.attrKeyValue.Name||""))}getType(){return 27}refreshRender(e=!1){if(this.maskChildRender){super.refreshRender();return}for(let i of this.pads)i.refreshRender();for(let i of this.others)e&&i instanceof He&&i.removeFill(),i.refreshRender();let r=this.isHighLight;for(let i in this.attrs){let n=this.attrs[i];r?n.updateHelpLine():n.deleteHelpLine(),n.refreshRender()}super.refreshRender()}buildBBox(){return this.model.buildBBox()}getPoints(){let{leftLow:e,leftUp:r,rightLow:i,rightUp:n}=this.model.box;return[e,e.add(r).mul(.5),r,r.add(n).mul(.5),n,n.add(i).mul(.5),i,i.add(e).mul(.5)]}getLines(){let{leftLow:e,leftUp:r,rightLow:i,rightUp:n}=this.model.box,s=[],a=new M(e,i),l=new M(i,n),c=new M(n,r),h=new M(r,e),u=new M(e.add(r).mul(.5),n.add(i).mul(.5)),d=new M(r.add(n).mul(.5),i.add(e).mul(.5));return s.push(a,l,c,h,u,d),s}getSilkLines(){let e=[];for(let r of this.others)r instanceof He&&[3,4].includes(r.layerId)&&e.push(r);return e}deleteItem(e){if(this.model.deleteModel(e.model),e instanceof Le){let r=this.pads.indexOf(e);r>=0&&this.pads.splice(r,1)}else if(e instanceof lr&&e.key!="")delete this.attrs[e.key];else{let r=this.others.indexOf(e);r>=0&&this.others.splice(r,1)}e.setParent(void 0)}addCompositionItem(e){this.model.addCompositionItem(e.model),e instanceof _i||e instanceof sn?this.pads.push(e):this.others.push(e),e.setParent(this)}removeCompositionItemById(e){let r=-1,i=null,n=!1;for(let s=0;s<this.pads.length;s++)if(this.pads[s].globalIndex===e){n=!0,r=s,i=this.pads[s];break}if(r<=-1){n=!1;for(let s=0;s<this.others.length;s++)if(this.others[s].globalIndex===e){r=s,i=this.others[s];break}}return r<=-1?null:(n?this.pads.splice(r):this.others.splice(r),this.model.removeCompositionItemById(e,n),i)}};var yT=(i=>(i.TurnAround="turnAround",i.TurnUpsideDown="turnUpsideDown",i.TurnAroundByReferPoint="turnAroundByReferPoint",i.TurnUpsideDownByReferPoint="turnUpsideDownByReferPoint",i))(yT||{});var ehe=class o{constructor(){this.hightIds=new Set;this.nets=new Set}static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}itemHighlighted(t,e){let r=t;return!!(this.hightIds.has(r)||this.nets.has(e))}};var n5=class n5{constructor(){this.viewGroups=new Set}static getInstance(){return n5.manager==null&&(n5.manager=new n5),n5.manager}addViewGroup(t,e){this.mergeViewGroup(e,t,t.info),this.viewGroups.add(t)}removeViewGroup(t,e){let r=t.viewGroupId;this.viewGroups.has(t)&&(this.viewGroups.delete(t),this.deleteViewGroupIds(t,e,r))}mergeViewGroup(t,e,r){for(let i of t){let n=Object.assign({},r);for(let s of this.viewGroups)if(s!=e&&s.viewGroupId.has(i)){let a=s.info;for(let l in a){if(l=="highLightType"){n.highLightType==null&&(n.highLightType=a.highLightType);continue}n[l]=n[l]||a[l]}}Mo.attachViewGroup(i,n)}}deleteViewGroupIds(t,e,r){this.mergeViewGroup(r,t,e)}};n5.manager=null;var cD=n5;var jV=class{constructor(t){this._viewGroupIds=new Set;this.info=t}get viewGroupId(){return this._viewGroupIds}addViewGroupId(t){for(let e of t)this._viewGroupIds.add(e)}deleteViewGroupId(t){for(let e of t)this._viewGroupIds.delete(e)}viewGroup(t){cD.getInstance().addViewGroup(this,t),this.addViewGroupId(t)}deleteViewGroup(t){cD.getInstance().deleteViewGroupIds(this,{visible:!0,doubleRgb:!1},t),this.deleteViewGroupId(t)}stash(){cD.getInstance().removeViewGroup(this,{visible:!0,doubleRgb:!1})}fresh(){this.restore()}restore(){cD.getInstance().addViewGroup(this,this._viewGroupIds)}clear(){cD.getInstance().removeViewGroup(this,{visible:!0,doubleRgb:!1}),this._viewGroupIds.clear()}};var XV=class{constructor(t,e){this.hightManage=ehe.getInstance();this.tool=new Jt;this._viewGroup=e||new jV({visible:!0,isForceHighLight:!0,highLightType:0}),this.netGroupTool=t}get nets(){return this.hightManage.nets}get hightIds(){return this.hightManage.hightIds}get viewGroup(){return this._viewGroup}restore(){this.refresh()}stash(){this._viewGroup.stash()}refreshViewGroup(){this._viewGroup.fresh()}addHightId(t){return this.viewGroup.viewGroupId.has(t.viewGroupId)?!1:(this.hightIds.add(t.globalIndex),!0)}deleteHightId(t){if(!t)return!1;if(this.viewGroup.viewGroupId.has(t.viewGroupId)){let e=Ao(t);if(e!=null&&this.nets.has(e)){this.nets.delete(e);let r=this.netGroupTool;this.viewGroup.deleteViewGroup(r.getGroupIdByNets(new Set([e])));let i=r.filterItemsByNets(new Set([e]));for(let n of i)this.addHightId(n)}}return this.hightIds.delete(t.globalIndex),!0}addHightByNet(t){for(let r of t)this.nets.add(r);let e=this.netGroupTool.getGroupIdByNets(new Set(t));this._viewGroup.viewGroup(e),C2.getInstance().setHighlight(t,!0)}deleteHightByNet(t){for(let r of t)this.nets.delete(r);let e=this.netGroupTool.getGroupIdByNets(new Set(t));this._viewGroup.deleteViewGroup(e),C2.getInstance().setHighlight(t,!1)}refresh(){this.refreshHightIds(),this.refreshViewGroup()}itemHighlighted(t){let e=this.getItem(t);return e?this.itemHighlightedByItem(e):!1}itemHighlightedByItem(t){let e=t.globalIndex;if(this.hightIds.has(e))return!0;let r=this.netGroupTool.getGroupIds([t]);return!!(t!=null&&r.length>0&&this._viewGroup.viewGroupId.has(r[0]))}getItem(t){let e=this.tool.getItem(t);return e!=null?e:Wo.getRatlineById(t)}replaceTool(t){let e=this.netGroupTool.getGroupIdByNets(t.nets);this._viewGroup.addViewGroupId(e),t.stash(),this.refresh()}clear(){C2.getInstance().setHighlight(this.nets,!1),this.hightIds.clear(),this.nets.clear(),this._viewGroup.clear()}hasHightItem(){return this.hightIds.size!=0||this._viewGroup.viewGroupId.size!=0}};var gq=class{getGroupIds(t,e){let r=[];return t.forEach(i=>{if(i.isEmpty||e&&e(i))return;let n=i.viewGroupId;this.addSpecialGroupId(i,r),!(!n||r.includes(n))&&(i instanceof Ue?r.push(n,i.holeViewGroupId):(i instanceof Ge||i instanceof Le||i instanceof rr||i instanceof Pr||i instanceof lt||i instanceof mn||i instanceof Jr)&&r.push(n))}),r}addSpecialGroupId(t,e){}getGroupIdByNet(t){return["Track"+t,"ArcTrack"+t,"Pad"+t+"_mask","Via"+t+"_mask","Rect"+t,"Circle"+t,"Polygon"+t,"Ratline"+t,"Copper"+t]}getGroupIdByNets(t){let e=[],r;for(let i of t){r=this.getGroupIdByNet(i);for(let n of r)e.push(n)}return e}filterItemsByNets(t){let e=[];return t.forEach(r=>{let i=Ye.getItem(r)||Ye.getNoneNetsItem(r);i!=null&&i.forEach(s=>{this.isNeedNet(s)&&e.push(s)});let n=Wo.getRatlineByNetName(r);for(let s of n)e.push(s)}),e}isNeedNet(t){return t instanceof He&&t.type=="Copper Region"||t instanceof Gi?!1:t instanceof Ue||t instanceof Le?!0:Pe.getLayer(t.layerId).isSignalLayer()?!(t instanceof lr||t instanceof Mn||this.isLine2DTypeNoNetWork(t)||t instanceof qs):!1}isLine2DTypeNoNetWork(t){let e=!1;if(t instanceof He)switch(t.type){case"Board Outline":case"Slot Region":case"Prohibited Region":case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Datum Line":e=!0;break}return e}},qV=class extends gq{addSpecialGroupId(t,e){(t instanceof Le||t instanceof Ue)&&e.push(t.wireViewGroupId)}getGroupIdByNet(t){return["Track"+t,"ArcTrack"+t,"Pad"+t+"_mask","Pad"+t+"_mask_W","Via"+t+"_mask_W","Via"+t+"_mask","Via"+t+"_mask_hole","Rect"+t,"Circle"+t,"Polygon"+t,"Ratline"+t,"Copper"+t]}};var uEe=class extends XV{constructor(){super(new qV)}addHightId(t){return super.addHightId(t)&&(t.manualHighLight=!0,this.updateForceDeactive()),!0}updateForceDeactive(t=!0){Pe.forceDeactive(t)}deleteHightId(t){return super.deleteHightId(t)&&(t.manualHighLight=!1),this.hasHightItem()||this.updateForceDeactive(!1),!0}addHightByNet(t){super.addHightByNet(t),this.updateForceDeactive()}deleteHightByNet(t){super.deleteHightByNet(t),this.hasHightItem()||this.updateForceDeactive(!1)}stash(){Pe.forceDeactive(!1),this.hightIds.forEach(t=>{let e=this.getItem(t);!e||e.isEmpty||(e.manualHighLight=!1)}),super.stash()}removeAllHighLight(){this.hightIds.forEach(t=>{let e=this.getItem(t);e&&!e.isEmpty&&(e.manualHighLight=!1)}),this.clear()}refresh(){super.refresh(),this.hasHightItem()?this.updateForceDeactive():this.clear()}refreshHightIds(){let t=this.hightIds;for(let e of t){let r=this.getItem(e);!r||r.isEmpty?this.hightIds.delete(e):r.manualHighLight=!0}}clear(){super.clear(),Pe.forceDeactive(!1)}},dEe=new uEe;var pEe=class extends XV{constructor(){super(new gq);this.isHover=!0}addHightId(e){return super.addHightId(e)&&e.isVisible&&(e.manualHighLight=!0,e.click(this.isHover&&!e.highLightBySelect)),!0}deleteHightId(e){if(super.deleteHightId(e)){let r=new Set(ze.getSelects()),i=e.globalIndex;this.hightIds.delete(i),e.manualHighLight=!1,r.has(e)||(e.updateFilterVisible=!0,e.visible())}return!0}stash(){let e=new Set(ze.getSelects());this.hightIds.forEach(r=>{let i=this.getItem(r);!i||i.isEmpty||(i.manualHighLight=!1,e.has(i)||(i.updateFilterVisible=!0,i.visible()))}),super.stash()}refreshHightIds(){let e=this.hightIds;for(let r of e){let i=this.getItem(r);!i||i.isEmpty?this.hightIds.delete(r):(i.manualHighLight=!0,i.click(this.isHover&&!i.highLightBySelect))}}removeAllHighLight(){let e=new Set(ze.getSelects());for(let r of this.hightIds){let i=this.getItem(r);i!=null&&!i.isEmpty&&(i.manualHighLight=!1,e.has(i)||(i.updateFilterVisible=!0,i.visible()))}this.clear()}},IYe=new pEe;var WS=class o{constructor(){this.highlightUnselectIds=new Set;this.tool=new Jt;this.highLightTool=dEe;this.colorDarkened=!0}static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}get isDarked(){return this.colorDarkened}addHightItem(t){this.addItem(t)}toggleHighLightNetsLoop(t){let e=!0,r=this.highLightTool.nets;for(let i of t)r.has(i)||(e=!1);e?this.unhighLightNets(t):this.highLightNets(t)}changeLightShow(t){let{isDark:e,force:r}=t;if(r!=R.getInstance().forceVisibleHighLightPt&&(R.getInstance().forceVisibleHighLightPt=r),e!=R.getInstance().highLightModeIsDark&&R.getInstance().setHighLightMode(e),e!=this.colorDarkened){if(e!=this.colorDarkened){let i=this.highLightTool;e?this.highLightTool=dEe:this.highLightTool=IYe,this.highLightTool.replaceTool(i)}this.colorDarkened=e}}highLightNets(t){this.highLightTool.addHightByNet(t)}unhighLightNets(t){this.highLightTool.deleteHightByNet(t),t.clear()}addItem(t){t!=null&&!t.isEmpty&&(t.updateFilterVisible=!0,this.highLightTool.addHightId(t))}highLight(){this.highLightTool.refresh()}unhighLight(t){if(t==null){this.highLightTool.removeAllHighLight();return}t.forEach(e=>{let r=this.getItem(e);this.highLightTool.deleteHightId(r)}),t.clear()}highlightUnselect(t){this.highlightUnselectIds=t,t.forEach(e=>{let r=this.getItem(e);r!=null&&!r.isEmpty&&r.click()})}cancelHighlightUnselect(){this.highlightUnselectIds.forEach(t=>{let e=this.getItem(t);e!=null&&!e.isEmpty&&(e.updateFilterVisible=!0,e.visible())}),this.highlightUnselectIds.clear()}unhighLightDevice(t){t.forEach(e=>{let r=this.getItem(e);r!=null&&!r.isEmpty&&this.highLightTool.deleteHightId(r)}),t.clear()}unhighLigthAll(){this.unhighLight()}refreshHighLigth(){this.highLight()}isItemHighlighted(t){return this.highLightTool.itemHighlighted(t)}isItemHighlightedByItem(t){return this.highLightTool.itemHighlightedByItem(t)}getAllHighLightNets(){return this.highLightTool.nets}stash(){this.highLightTool.stash()}restore(){this.highLightTool.restore()}getItem(t){let e=this.tool.getItem(t);return e!=null?e:Wo.getRatlineById(t)}};var hD=class{constructor(t){this.all=new Set;this.result=new Set;this.hasPad1=!1;this.hasPad2=!1;this.item=t,this.find()}find(){if(this.item instanceof Ge){this.findPath4Track(this.item);return}if(this.item instanceof Le)this.hasPad1=!0;else if(this.isEnd(this.item))return;this.all.add(this.item);let t=this.getItems(this.item);this.getRatlinesNodes(this.item,t);let e=this.getPad(t);e!=null&&(t=this.filter(t,e),this.addPad(e),this.hasPad2||(e=this.getPad(t),e!=null&&(t=this.filter(t,e),this.addPad(e)))),t.forEach(r=>{let i=this.findPath(r);i&&(this.hasPad1?this.hasPad2=i:this.hasPad1=i)}),this.hasPad1&&this.hasPad2?this.result.add(this.item):this.result.clear()}findPath4Track(t){if(this.isEnd(t))return;this.all.add(t);let r=this.getItems(t),i=new Set,n=new Set;t.iteratorRatlines(l=>{let c=this.getRatlineStartNode(l,t),h=this.getRatlineEndNode(l,t);c!=null&&(l.end.equals1(t.start)?i.add(c):n.add(c),this.all.add(c)),h!=null&&(l.start.equals1(t.start)?i.add(h):n.add(h),this.all.add(h))});for(let l of r)if(l instanceof Ge){let c=l.start.distance2(t.start),h=l.end.distance2(t.start),u=l.start.distance2(t.end),d=l.end.distance2(t.end);Math.min(c,h)<Math.min(u,d)?i.add(l):n.add(l)}else{let c=l.center.distance2(t.start),h=l.center.distance2(t.end);c<h?i.add(l):n.add(l)}let s=this.getPad(i);s!=null&&(i=this.filter(i,s),this.result.add(s),this.hasPad1=!0);let a=this.getPad(n);a!=null&&(n=this.filter(n,a),this.result.add(a),this.hasPad2=!0),i.forEach(l=>{this.findPath(l)&&(this.hasPad1=!0)}),n.forEach(l=>{this.findPath(l)&&(this.hasPad2=!0)}),this.hasPad1&&this.hasPad2?this.result.add(this.item):this.result.clear()}getRatlinesNodes(t,e){t.iteratorRatlines(r=>{let i=this.getRatlineStartNode(r,t),n=this.getRatlineEndNode(r,t);i!=null&&(e.add(i),this.all.add(i)),n!=null&&(e.add(n),this.all.add(n))})}getRatlineStartNode(t,e){return t.startNode!=e&&(t.startNode instanceof Ge||t.startNode instanceof Le||t.startNode instanceof Ue)&&!this.all.has(t.startNode)?t.startNode:null}getRatlineEndNode(t,e){return t.endNode!=e&&(t.endNode instanceof Ge||t.endNode instanceof Le||t.endNode instanceof Ue)&&!this.all.has(t.endNode)?t.endNode:null}getItems(t){let e=t.searchCycleNode(),r=this.filterItems(e);return r.size==0&&(e=t.searchNode(),r=this.filterItems(e)),r}filterItems(t){let e=new Set,r=new Set;for(let i of t)if(i instanceof Ue){let n=i.searchNode();for(let s of n)s instanceof Ge&&(VM.isEnd(s,s.start)||VM.isEnd(s,s.end))&&r.add(s)}return t.forEach(i=>{if(i!=this.item&&(i instanceof Ge||i instanceof Le||i instanceof Ue)&&!this.all.has(i)){if(i instanceof Ge&&r.has(i))return;e.add(i),this.all.add(i)}}),e}addPad(t){this.result.add(t),this.hasPad1?this.hasPad2=!0:this.hasPad1=!0}getPad(t){for(let e of t)if(e instanceof Le&&!e.isTestPad)return e;return null}filter(t,e){if(e==null)return t;{let r=new Set;return t.forEach(i=>{i.isSelect(e.center.x,e.center.y)||r.add(i)}),r}}findPath(t){if(this.isEnd(t))return t instanceof Le?(this.result.add(t),!0):!1;{let r=this.getItems(t);if(this.getRatlinesNodes(t,r),r.size==0)return!1;{let i=!1;if(r.forEach(n=>{n instanceof Le&&!n.isTestPad&&(i=!0,this.result.add(t),this.result.add(n))}),i)return i;{let n=!1;return r.forEach(s=>{this.findPath(s)&&(n=!0)}),n&&this.result.add(t),n}}}}isEnd(t){return t instanceof Ge?this.checkTrackIsEnd(t):t instanceof Le?!0:t instanceof Ue?!(this.getConnects(t).size>1):!0}getConnects(t){let e=t.searchNode(),r=new Set;return e.forEach(i=>{i!=t&&(i instanceof Ge||i instanceof Le||i instanceof Ue)&&r.add(i)}),t.iteratorRatlines(i=>{i.startNode!=t&&(i.startNode instanceof Ge||i.startNode instanceof Le||i.startNode instanceof Ue)&&r.add(i.startNode),i.endNode!=t&&(i.endNode instanceof Ge||i.endNode instanceof Le||i.endNode instanceof Ue)&&r.add(i.endNode)}),r}checkTrackIsEnd(t){let e=t.searchNode(),r=!1,i=!1;for(let n of e)if(n!=t&&(n instanceof Ge||n instanceof Le||n instanceof Ue)&&(n.isSelect(t.start.x,t.start.y)&&(r=!0),n.isSelect(t.end.x,t.end.y)&&(i=!0)),r&&i)return!1;return t.iteratorRatlines(n=>{if(n.startNode!=t&&(n.startNode instanceof Ge||n.startNode instanceof Le||n.startNode instanceof Ue)&&(n.end.sub(t.start).length()<1e-8?r=!0:i=!0),n.endNode!=t&&(n.endNode instanceof Ge||n.endNode instanceof Le||n.endNode instanceof Ue)&&(n.start.sub(t.start).length()<1e-8?r=!0:i=!0),r&&i)return!1}),!0}};function df(o=!1){let t=new qt;return t.add("MOVE_BY_CENTER_POINT"),o&&t.add("MOVE_BY_ORIGIN_POINT"),t.add("MOVE_BY_REFERENCE_POINT"),t}function sm(){let o=new qt;return o.add("HIGHLIGHT_NET"),o.add("HIGHLIGHT_COMPONENT"),o.add("HIGHLIGHT_SELECTED_OBJECTS",!0),o.add("HIGHLIGHT_CANCEL_NET"),o.add("HIGHLIGHT_CANCEL_COMPONENT"),o.add("HIGHLIGHT_CANCEL_SELECTED_OBJECTS"),o.add("HIGHLIGHT_CANCELALL",!0),o}function Um(){let o=new qt;return o.add("OFFSET_ABSOLUTE"),o.add("OFFSET_RELATIVE"),o}function Ag(){let o=new qt;return o.add("rotate_left"),o.add("rotate_right"),o.add("rotate_reference_point"),o}function N2(){let o=new qt;return o.add("DUPLICATE_TO_CURSOR"),o.add("DUPLICATE_TO_OTHER_LAYER"),o}function Xy(o=!0){let t=new qt;return t.add("FLIP_LEFTANDRIGHT"),t.add("FLIP_UPANDDOWN"),o&&(t.add("FLIP_LEFTANDRIGHT_BY_REFER_POINT"),t.add("FLIP_UPANDDOWN_BY_REFER_POINT")),t}function v1(){let o=new qt,t=ze.getSelects();ze.getSelectedGroups().length>0&&(o.add("COMBINATION_MOVE_OUT"),o.add("COMBINATION_CANCEL")),t.length>0&&o.add("COMBINATION_SELECT");let r=Ht.getAllGroupId().length>0,i=t.some(n=>n.getGroupID()==null);return r&&i&&o.add("COMBINATION_JOIN"),ze.getComponents().length>0&&o.add("REUSE_LAYOUT_ROUTE"),o}function the(o){let t=new qt,e=ze.getSelects();return t.add("ADDWITH_TRACK"),t.add("ADDWITH_VIA"),!o&&t.add("ADDWITH_TESTPOINTER"),t.add("ADDVIA_FENCE"),t.add("ADDWITH_TEARS"),t}function oE(){let o=new qt,e=ze.getItems().reduce((n,s)=>((s instanceof Ge||s instanceof Le||s instanceof Ue||s instanceof mn)&&s.net&&n.add(s.net),n),new Set);if(o.add("NET_COLOR",e.size>0),!e.size)return o;let r=[...e].map(n=>re.getInstance().getNet(n));return r.some(n=>!n.netClass)&&(o.add("new-net-class"),re.getInstance().getAllNetClass().size&&o.add("join-net-class")),r.some(n=>n.netClass)&&o.add("remove-from_net-class",!0),r.some(n=>!n.equalLengthGroup)&&(o.add("new-equal-length-group"),re.getInstance().getAllEqualLengthGroups().size&&o.add("join-equal-length-group")),r.some(n=>n.equalLengthGroup)&&o.add("remove-from_equal-length-group",!0),r.length==2&&r.every(n=>!n.netDifferential)&&o.add("new-differentialPair"),r.some(n=>n.netDifferential?n.netDifferential.getAllNets().every(s=>r.includes(s)):!1)&&o.add("delete-differentialPair"),o}function am(){let o=new qt;return o.add("selectedBSSaveAsCloud"),o.add("selectedBSSaveAsLocal"),o}function mEe(){let o=ze.getItems(),t=[];for(let e of o)(e instanceof He&&us.getValidProfile(e.type)||e instanceof Ge)&&t.push(e);qvt.generateBoard(t),A.publish("updateFrame","")}function rhe(){us.getInstance().board&&A.publish("openMainDialog",{cmd:49})}function CYe(){let o=ze.getItems();for(let t of o)if(t instanceof He&&us.getValidProfile(t.type)||t instanceof Ge)return!0;return!1}var fEe=class{collectValidItem(t){let e=us.getInstance();if(e.autoGenerate){for(let r of t)if(r instanceof He&&us.getValidProfile(r.type)&&(e.outlineCollect.delete(r.globalIndex),r.layerId==11&&!r.isEmpty)){let i=[],n;if(r.model.modelType=="Polygon")n=this.getProfile(r,i);else return this.addRectOrCircleToBoard(r.model,!1);if(!n){e.outlineCollect.set(r.globalIndex,i);let s=[],a=e.outlineCollect.values();for(let c of a)for(let h of c)s.push(h);e.bbox.ext1(r.bbox());let l=e.bbox.build1().extendOfSize(2);n=this.checkIsClosed(s,l)}if(n){this.addPolyToBoard(n,!1);break}}}}getProfile(t,e){let r,i=t.getMathGraphics();if(i instanceof Bt?r=i[0]:r=i,Bu(t.type)||r.isClose())return r;let n=r.primitives;for(let s of n)e.push(s);return null}checkIsClosed(t,e){var a;if(t.length<=1)return null;let r=new $c(e,2,.1,new Di(1),t),i=e.extendOfSize(e.width()),s=(a=r.detect2().items[0])==null?void 0:a.items[0];return s.bbox().width()>=i.width()&&(s=null),s}generateBoard(t){if(t&&t.length>0){let e,r=new Map,i,n=new _e;for(let l of t){if(e)break;if(i=r.get(l.layerId),i||(i=[],r.set(l.layerId,i)),l instanceof He)if(l.model.modelType=="Polygon")e=this.getProfile(l,i);else return this.addRectOrCircleToBoard(l.model);else i.push(l.primitive);n.ext1(l.bbox())}if(e){this.addPolyToBoard(e);return}let s=n.build1().extendOfSize(2);for(let[,l]of r)if(e=this.checkIsClosed(l,s),e)break;if(e){this.addPolyToBoard(e);return}let a=new e0("The selected shape is not closed,Should the automatically closed shape be converted to a board shape?",()=>{let l,c=t[0];if(c instanceof Ge)l=c.getMathGraphics(c.layerId);else{let h=TI(c.getEdgePolylines());for(let u of h)if(u.isClose()){l=u;break}}this.addPolyToBoard(l)});A.publish("openMsgbox",a)}}addPolyToBoard(t,e=!0){if(t){let r="Polygon",i=e?new De("board"):qe.stack,n=new Po().plToShapes(t),s=us.getInstance(),a=s.board;if(r==(a==null?void 0:a.model.modelType)){i.addCommand(this.getBoardCommand(s.board,"modify"));let c=s.board.getChildrens();for(let h of c)for(let u of h)u.remove();s.board.setChildrens(n)}else{a&&(i.addCommand(this.getBoardCommand(a,"delete")),a.remove());let c=new Ep(us.id,"Board",1006,[],us.width,null,!1,null,null,null);s.board=new lt(c,[]),s.board.setChildrens(n),i.addCommand(this.getBoardCommand(s.board,"add"))}e&&qe.executeCommand(i)}}getBoardCommand(t,e){if(t instanceof rr)return new f8(t,e);if(t instanceof Pr)return new m8(t,e);if(t instanceof lt)return new p8(t,e)}addRectOrCircleToBoard(t,e=!0){if(t){let r=e?new De("board"):qe.stack,i=us.getInstance(),n=i.board;if(t.modelType==(n==null?void 0:n.model.modelType))if(r.addCommand(this.getBoardCommand(n,"modify")),t instanceof Sp){let a=n;a.start=t.start,a.width=t.width,a.height=t.height,a.cornerRadius=t.radius,a.rotation=t.rotation}else{let a=n;a.center=t.center,a.radius=t.radius}else{n&&(r.addCommand(this.getBoardCommand(n,"delete")),n.remove());let a;t instanceof Sp?a=this.getRectByModel(t):a=this.getCircleByModel(t),i.addBoard(a,!0),r.addCommand(this.getBoardCommand(i.board,"add"))}e&&qe.executeCommand(r)}}getRectByModel(t){return new Sp(us.id,"Board",1006,t.start,t.width,t.height,t.rotation,t.radius,"",us.width,!1,null,null)}getCircleByModel(t){return new Ip(us.id,"Board",1006,t.center,t.radius,us.width,!1,"",null,null)}},qvt=new fEe;function $V(){let o=new qt;return o.add("convertToBoard"),o.add("convertToLineFromBoard",!1,void 0,void 0,!us.getInstance().board),o}function _g(o,t){let e=new qt;e.add("copyToSvg"),e.add("copyToPng"),o.addExtend("copyToImage",e)}function SYe(o){let t=ze.getSelects(),e=new qt;e.add("CANCEL",!0);let r=!0,i=!1,n=!1,s=!1,a=t.some(u=>u instanceof Le||u instanceof Ue||u instanceof Ge||u instanceof mn),l=!1;R.getInstance().doctype==3&&(t.forEach(u=>{if(u instanceof ke)r=!1,n=!0;else if(u instanceof Le){let d=u.getParent();d!=null&&d instanceof ke&&(r=!1),i=!0}else if(u instanceof lr){let d=u.getParent();d!=null&&d instanceof ke&&(s=!0)}}),l=!0),l&&Uy&&e.add("CROSSPROBE",!0),r?(e.add("COPY"),_g(e,we),e.add("CUT")):_g(e,we),e.addExtend("DUPLICATE",N2()),e.addExtend("MOVE",df()),e.add("DELETE"),n&&(e.add("component_distribute_by_region"),e.add("SAVE_TO_LIBRARY")),r&&(s||e.add("ARRAYS"));let c=new qt;if(we.canIntersectionAggregate&&(c.add("boolIntersection"),c.add("boolAggregate")),we.canSubtractionExclusive&&(c.add("boolSubtraction"),c.add("boolExclusive")),we.canBooleanSplit&&c.add("boolSplit"),(we.canIntersectionAggregate||we.canSubtractionExclusive||we.canBooleanSplit)&&e.addExtend("boolOperation",c),o<2&&e.add("LOCKED",o==0),o>0&&e.add("LOCKED_CANCEL",!0),R.getInstance().doctype==3&&CYe()&&e.addExtend("opensubmenu-boardshape",$V()),we.canSplit&&e.add("SPLIT"),we.canCutout||we.canAvoidSlotsOrPads){let u=new qt;we.canCutout&&(u.add("CUTOUT_RECT"),u.add("CUTOUT_CIRCLE"),u.add("CUTOUT_POLYGON")),we.canAvoidSlotsOrPads&&(u.add("avoidSlots"),u.add("avoidPads")),e.addExtend("CUTOUT",u,!0)}return e.add("ADAPT_SELECTED"),e.addExtend("HIGHLIGHT",sm(),!a),a&&e.addExtend("NET_MENU",oE(),!0),i&&e.addExtend("ADD",the(!1)),e.addExtend("COMBINATION",v1()),l&&e.add("BATCH_FANOUT"),e.addExtend("OFFSET",Um()),e.addExtend("ROTATE",Ag(),!1),e.addExtend("FLIP",Xy()),l&&e.add("TURNOVER",!0),To.getInstance().getNeedAnnotation()&&l&&e.add("ANNOTATION"),e.add("ATTRIBUTE"),R.getInstance().doctype==3&&!R.getInstance().isPreview&&e.addExtend("REUSE_BLOCK",am()),e}var Jc=class{};Jc.pcbConfig={Common:{COMPONENT:!0,ATTR:!0,TRACK:!0,FPC_STIFFENER:!0,PAD_TEST:!0,PAD:!0,VIA:!0,SUTUREVIA:!0,TEXT:!0,IMAGE:!0,PICTURE:!0,DIMENSION:!0,SHEETBOARD:!0,SLOT:!0,POUR:!0,REGION:!0,PROHIBIT:!0,LINE:!0,CONSTRAINT:!0,PADSPAIR:!1,NETWORK:!1,TEARDROP:!0,DRCTAGGING:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!0,BOSS:!0,CREASE:!0,SIDESHELLCUT:!0,TOPSHELLCUT:!0,TOPBOTTOMENTITY:!0,SIDEENTITY:!0},"Only Component":{COMPONENT:!0,ATTR:!1,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only Component Attribute":{COMPONENT:!1,ATTR:!0,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only Track":{COMPONENT:!1,ATTR:!1,TRACK:!0,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only Via":{COMPONENT:!1,ATTR:!1,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!0,SUTUREVIA:!0,TEXT:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only Pad Pair":{COMPONENT:!1,ATTR:!1,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!0,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only Net":{COMPONENT:!1,ATTR:!1,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!0,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only Group":{COMPONENT:!1,ATTR:!1,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!0,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only Image":{COMPONENT:!1,ATTR:!1,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!1,IMAGE:!0,PICTURE:!0,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1}},Jc.silkViewerPcbConfig={"Only Image":{COMPONENT:!1,ATTR:!1,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!1,IMAGE:!0,PICTURE:!0,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only Text":{COMPONENT:!1,ATTR:!1,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!0,IMAGE:!1,PICTURE:!0,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only Image And Text":{COMPONENT:!1,ATTR:!1,TRACK:!1,FPC_STIFFENER:!1,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!0,IMAGE:!0,PICTURE:!0,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1},"Only FPC STIFFENER":{COMPONENT:!1,ATTR:!1,TRACK:!1,FPC_STIFFENER:!0,PAD_TEST:!1,PAD:!1,VIA:!1,SUTUREVIA:!1,TEXT:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SHEETBOARD:!1,SLOT:!1,POUR:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,PADSPAIR:!1,NETWORK:!1,TEARDROP:!1,RATLINE:!1,COMBINATION:!1,LOCKED:!0,UNLOCKED:!0,SHELL:!1,BOSS:!1,CREASE:!1,SIDESHELLCUT:!1,TOPSHELLCUT:!1,TOPBOTTOMENTITY:!1,SIDEENTITY:!1}},Jc.footprintConfig={Common:{PAD:!0,VIA:!0,TEXT:!0,ATTR:!0,IMAGE:!0,PICTURE:!0,DIMENSION:!0,SLOT:!0,REGION:!0,PROHIBIT:!0,LINE:!0,CONSTRAINT:!0,LOCKED:!0,UNLOCKED:!0},"Only Pad":{PAD:!0,VIA:!1,TEXT:!1,ATTR:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SLOT:!1,REGION:!1,PROHIBIT:!1,LINE:!1,CONSTRAINT:!1,LOCKED:!0,UNLOCKED:!0},"Only Line":{PAD:!1,VIA:!1,TEXT:!1,ATTR:!1,IMAGE:!1,PICTURE:!1,DIMENSION:!1,SLOT:!1,REGION:!1,PROHIBIT:!1,LINE:!0,CONSTRAINT:!1,LOCKED:!0,UNLOCKED:!0}},Jc.operation={"Save As Config...":{disabled:!1},"Set as default config":{disabled:!1},"Rename Config...":{disabled:!0},"Save Config":{disabled:!0},"Delete Config":{disabled:!0}};function EYe(){var r,i;let o=new qt,t=jt.userConfig||{},e=jt.currentSelected||t.pcbConfigDefault||{configName:"Common",configType:"systemConfig"};if(R.getInstance().doctype==3){let n=Object.assign({},Jc.pcbConfig),s=jt.getPcbDefault()||"Common",a={};n[s]?(a[s]=n[s],delete n[s]):(r=t.pcb)!=null&&r[s]&&(a[s]=t.pcb[s],delete t.pcb[s]);let l=Object.keys(a),c=Object.keys(n||{}),h=Object.keys(t.pcb||{});KV(o,l,void 0,e.configName),KV(o,c,void 0,e.configName),KV(o,h,!0,e.configName)}else if(R.getInstance().doctype==4){let n=Object.assign({},Jc.footprintConfig),s=jt.getFootprintDefault()||"Common",a={};n[s]?(a[s]=n[s],delete n[s]):(i=t.footprint)!=null&&i[s]&&(a[s]=t.footprint[s],delete t.footprint[s]);let l=Object.keys(a),c=Object.keys(n||{}),h=Object.keys(t.footprint||{});KV(o,l,void 0,e.configName),KV(o,c,void 0,e.configName),KV(o,h,!0,e.configName)}return o.add("MORE"),o}function KV(o,t,e=!1,r=""){t.map((i,n)=>{n==t.length-1?o.add(i,!0,r?r===i:void 0,void 0,void 0,e):o.add(i,void 0,r?r===i:void 0,void 0,void 0,e)})}function OYe(){let o=new qt;return It.getInstance().currentCoord?le.gridConfig.forEach(e=>{let r=e.getMenu(),i=!1;It.getInstance().getGridX()==e.milDeltaX&&It.getInstance().getGridY()==e.milDeltaY&&(i=!0),o.addObj(r,!1,i)}):le.polarConfig.forEach(e=>{let r=e.getMenu(),i=!1;It.getInstance().angleDelta==e.angleDelta&&It.getInstance().radius==e.milStep&&(i=!0),o.addObj(r,!1,i)}),o.result.length>0&&(o.result[o.result.length-1].separate=!0),o.add("GRID_SNAP_KEEP_RATIO",!1,!!le.getAssociationPCBCanvasGridAndSnap()),o.add("GRID_SETTING"),o.add("GRID_RANGE_SETTING"),o}function AYe(){let o=new qt,t=we.gridType;return o.add("GRID_COORDINATE",!1,It.getInstance().currentCoord),o.add("POLAR_COORDINATE",!0,!It.getInstance().currentCoord),o.add("GRID_TYPE_DOT",!1,t==="outlets"),o.add("GRID_TYPE_GRID",!1,t==="grid"),o.add("GRID_TYPE_NONE",!1,t==="none"),o}function _Ye(){let o=new qt,t=le.gridConfig,e=new dt;return t.forEach(r=>{let i=r.getMenu(),n=!1,s=R.getInstance().unit=="mil"?r.milDeltaX:e.conversion("mm","mil",r.mmDeltaX),a=R.getInstance().unit=="mil"?r.milDeltaY:e.conversion("mm","mil",r.mmDeltaY);ne.eq(It.getInstance().getSnapX(),s)&&ne.eq(It.getInstance().getSnapY(),a)&&(n=!0),o.addObj(i,!1,n)}),o.result.length>0&&(o.result[o.result.length-1].separate=!0),o.add("GRID_SNAP_KEEP_RATIO",!1,!!le.getAssociationPCBCanvasGridAndSnap()),o.add("GRID_SETTING"),o}function vYe(o){let t=new qt;return t.add("LOOKUP",!0),R.getInstance().doctype==3&&t.add("HIGHLIGHT_CANCELALL",!0),t.add("PASTE",!0),t.addExtend("FILTER",EYe(),!0),t.addExtend("MOVE",df(!0)),t.add("ENLARGE"),t.add("NARROW"),t.add("ADAPT_ALL"),t.addExtend("GRID",OYe()),It.getInstance().currentCoord&&t.addExtend("SNAP_SIZE",_Ye()),t.addExtend("GRIDTYPE",AYe(),!0),R.getInstance().doctype==4&&t.add("RENUMBER",!0),we.docNeedUpdate&&R.getInstance().doctype==3&&t.add("REFRESH"),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),!ze.getSelects().length&&R.getInstance().isConcurrentStrictMode&&(t.add("CHECK_OUT"),t.add("CHECK_IN")),To.getInstance().getNeedAnnotation()&&t.add("ANNOTATION"),t}function ZV(o,t=!1,e=!1,r,i=!1){let n=new qt;return r.getIsBoxSelection()||n.add("OVERLAP"),n.add("PRIMITIV_PADPAIR"),e&&n.add("PRIMITIV_TRACK"),t||n.add("CONNECT"),i&&n.add("CONNECTED_COPPER",void 0,void 0,!1),n.add("NET"),o&&n.add("SECOND_COMBINATION"),n}function uD(){let o=new qt;return o.add("align_left"),o.add("align_right"),o.add("align_top"),o.add("align_bottom"),o.add("align_horizontal_center"),o.add("align_vertical_center"),o.add("align_grid"),o}function dD(){let o=new qt;return o.add("distribute_horizontal_equidistant"),o.add("distribute_vertical_equidistant"),o.add("distribute_left_side_edge_equidistant"),o.add("distribute_top_side_edge_equidistant"),o.add("distribute_horizontal_by_center_distance"),o.add("distribute_vertical_by_center_distance"),o.add("distribute_horizontal_by_edges_distance"),o.add("distribute_vertical_by_edges_distance"),o.add("distribute"),o.add("component_distribute_by_region"),o}function xYe(){let o=new qt;return Mt.isChildPcb()||o.add("ONLY_SELECT"),o.add("ALL_PROJECT"),o}function RYe(o){return o=="0"?"1":o}function DYe(o,t,e,r){let i=new qt,n=ze.getSelects();return i.add("CANCEL",!0),i.add("LOOKUP",!0),Uy&&i.add("CROSSPROBE",!0),i.addExtend("SELECT",ZV(t,!0,void 0,r)),i.add("COPY",void 0,void 0,void 0,Mt.isChildPcb()),_g(i,we),i.add("CUT",void 0,void 0,void 0,Mt.isChildPcb()),i.addExtend("DUPLICATE",N2(),void 0,void 0,Mt.isChildPcb()),n.length==1?i.addExtend("MOVE",df(!0)):(i.addExtend("MOVE",df()),i.add("MOVE_SEQUENTIAL")),i.add("DELETE",void 0,void 0,void 0,Mt.isChildPcb()),e<2&&i.add("LOCKED",e==0),e>0&&i.add("LOCKED_CANCEL",!0),i.add("ADAPT_SELECTED"),i.addExtend("HIGHLIGHT",sm(),!0),i.add("ADDWITH_TEARS"),i.add("ADDVIA_FENCE"),i.add("BATCH_FANOUT",!0),i.add("UNROUTE_ATTACHED_SEGMENTS"),i.add("UNROUTE_CONNECTIONS",!0),i.addExtend("COMBINATION",v1()),n.length==2&&i.add("EXCHANGE_LOCATION"),i.add("ATTR_LOCATION"),i.addExtend("OFFSET",Um()),i.addExtend("ROTATE",Ag()),n.length>1&&(i.addExtend("ALIGNMENT",uD()),i.addExtend("DISTRIBUTION",dD())),i.add("TURNOVER",!0),n.length==1&&i.addExtend("PACKAGE_EDIT",xYe()),o&&!Mt.isChildPcb()&&i.add("RECOVER_FOOTPRINT"),n.length==1&&(le.getSymbolLibManageMode()=="1"?i.add("EASY_DEVICE_EDIT"):i.add("DEVICE_EDIT")),i.add("SAVE_TO_LIBRARY"),i.add("UPDATE_COMPONENT",!0),To.getInstance().getNeedAnnotation()&&i.add("ANNOTATION"),i.add("IPC2552"),i.add("ATTRIBUTE"),R.getInstance().isPreview||i.addExtend("REUSE_BLOCK",am()),i}function gEe(o=!1,t,e,r){let i=new qt;i.add("CANCEL",!0),i.add("LOOKUP",!0);let n=ze.getSelects();if(R.getInstance().doctype==3){Uy&&i.add("CROSSPROBE",!0);let s=ZV(!1,!1,!1,e,!0);if(s.add("PRIMITIV_COMPONENT"),i.addExtend("SELECT",s),o?(i.add("COPY"),_g(i,we),i.add("CUT"),i.addExtend("DUPLICATE",N2()),i.addExtend("MOVE",df())):(i.addExtend("MOVE",df()),i.addExtend("OFFSET",Um(),r)),o||!r){i.add("DELETE"),n.length==1&&n[0]instanceof sn&&i.add("EDIT_BOUNDARY");let l=new qt;we.canIntersectionAggregate&&(l.add("boolIntersection"),l.add("boolAggregate")),we.canSubtractionExclusive&&(l.add("boolSubtraction"),l.add("boolExclusive")),we.canBooleanSplit&&l.add("boolSplit"),(we.canIntersectionAggregate||we.canSubtractionExclusive||we.canBooleanSplit)&&i.addExtend("boolOperation",l),t<2&&i.add("LOCKED",t===0),t>0&&i.add("LOCKED_CANCEL",!0)}i.add("BATCH_FANOUT",!0),i.addExtend("ADD",the(o)),i.addExtend("COMBINATION",v1()),i.add("ADAPT_SELECTED"),i.addExtend("HIGHLIGHT",sm()),i.addExtend("NET_MENU",oE(),!0),o||(i.add("RATLINES_SHOW"),i.add("RATLINES_HIDE",!0)),o&&i.addExtend("OFFSET",Um(),!0),To.getInstance().getNeedAnnotation()&&i.add("ANNOTATION"),i.add("ATTRIBUTE"),i.addExtend("REUSE_BLOCK",am())}else if(R.getInstance().doctype==4){e.getIsBoxSelection()||i.add("SELECTOVERLAP"),i.add("COPY"),_g(i,we),i.add("CUT"),i.addExtend("DUPLICATE",N2()),i.addExtend("MOVE",df()),i.add("DELETE"),n.length==1&&n[0]instanceof sn&&i.add("EDIT_BOUNDARY");let s=0;n.forEach(a=>{a instanceof Le&&s++}),i.add("ARRAYS",s<2),s>=2&&i.add("MERGE_PADS",!0),i.addExtend("COMBINATION",v1()),i.add("ADAPT_SELECTED",!0),i.addExtend("OFFSET",Um()),i.addExtend("ROTATE",Ag()),i.addExtend("FLIP",Xy()),i.add("TURNOVER",!0),n.length>1&&(i.addExtend("ALIGNMENT",uD()),i.addExtend("DISTRIBUTION",dD(),!0)),i.add("RENUMBER",!0),i.add("ATTRIBUTE")}return i}function wYe(){let o=new qt;return o.add("WIRING_CLEAR_CONNECT"),o.add("WIRING_CLEAR_NET"),o.add("WIRING_CLEAR_ALL"),o}function LYe(){let o=new qt,t=ze.getSelects();gr.model==0&&(o.add("ADDWITH_VIA"),o.add("ADDWITH_TESTPOINTER"),o.add("ADDWITH_TRACK")),o.add("ADD_FILLET"),o.add("ADD_CHAMFER"),o.add("ADDVIA_FENCE");let e=!0;return t.forEach(r=>{r instanceof Ge?!ao(r.layerId)&&2!=r.layerId&&(e=!1):e=!1}),e?(o.add("ADDWITH_TEARS"),o.add("SETUP_WINDOWINGAREA",!0)):o.add("ADDWITH_TEARS",!0),o}function MYe(o,t,e){let r=new qt;if(r.add("CANCEL",!0),r.add("LOOKUP",!0),R.getInstance().doctype==3){let s=ze.getSelects();Ao(s[0])&&jt.getPick(8)&&Uy&&r.add("CROSSPROBE",!0)}let i=ZV(o,!1,!0,e,!0);if(r.addExtend("SELECT",i),r.add("COPY"),_g(r,we),r.add("CUT"),r.addExtend("DUPLICATE",N2()),r.addExtend("MOVE",df()),r.add("INSERT_NODE"),r.add("DELETE"),t<2&&r.add("LOCKED",t==0),t>0&&r.add("LOCKED_CANCEL",!0),R.getInstance().doctype==3&&r.addExtend("opensubmenu-boardshape",$V()),we.canSplit&&r.add("SPLIT"),we.canCutout||we.canAvoidSlotsOrPads){let s=new qt;we.canCutout&&(s.add("CUTOUT_RECT"),s.add("CUTOUT_CIRCLE"),s.add("CUTOUT_POLYGON")),we.canAvoidSlotsOrPads&&(s.add("avoidSlots"),s.add("avoidPads")),r.addExtend("CUTOUT",s,!0)}return gr.model==0&&r.add("STRETCHING"),r.addExtend("WIRING_CLEAR",wYe(),!0),r.add("ADAPT_SELECTED"),r.addExtend("HIGHLIGHT",sm()),r.addExtend("NET_MENU",oE(),!0),gr.model==0&&r.add("ADDWITH_EQUALLENGTHTUNING"),r.add("CONVERT_TO_2D_LINE"),r.addExtend("ADD",LYe()),r.addExtend("OFFSET",Um()),r.addExtend("COMBINATION",v1(),!0),r.addExtend("FLIP",Xy()),r.add("TURNOVER",!0),To.getInstance().getNeedAnnotation()&&r.add("ANNOTATION"),r.add("ATTRIBUTE"),R.getInstance().doctype==3&&!R.getInstance().isPreview&&r.addExtend("REUSE_BLOCK",am()),r}function NYe(){let o=new qt,t=ze.getSelects();return o.add("ADDWITH_TRACK"),o.add("ADDWITH_VIA",!0),o}function kYe(){let o=new qt;o.add("CANCEL",!0);let t=new qt;return t.add("NET"),o.addExtend("SELECT",t,!0),o.add("ADAPT_SELECTED"),o.add("RATLINES_HIDE"),o.addExtend("NET_MENU",oE(),!0),ze.getSelects().length==1&&o.addExtend("ADD",NYe()),o}function BYe(){let o=new qt;return ze.getSelects().length==1&&o.add("ADDWITH_TRACK"),o.add("ADDWITH_TEARS",!0),o}function FYe(o,t,e,r){let i=new qt,n=ze.getSelects();i.add("CANCEL",!0),i.add("LOOKUP",!0),R.getInstance().doctype==3&&Ao(n[0])&&jt.getPick(8)&&Uy&&i.add("CROSSPROBE",!0);let s=new qt;return e.getIsBoxSelection()||s.add("OVERLAP"),R.getInstance().doctype==3&&(s.add("CONNECT"),s.add("CONNECTED_COPPER",void 0,void 0,!1),s.add("NET")),o&&s.add("SECOND_COMBINATION"),s.result.length>0&&i.addExtend("SELECT",s),i.add("COPY"),_g(i,we),r||i.add("CUT"),i.add("DUPLICATE_TO_CURSOR"),i.addExtend("MOVE",df()),r||(i.add("DELETE"),t<2&&i.add("LOCKED",t==0),t>0&&i.add("LOCKED_CANCEL",!0)),i.addExtend("ADD",BYe()),i.add("ADAPT_SELECTED"),i.addExtend("HIGHLIGHT",sm()),R.getInstance().doctype==3&&i.addExtend("NET_MENU",oE(),!0),i.addExtend("COMBINATION",v1()),i.addExtend("OFFSET",Um(),!0),To.getInstance().getNeedAnnotation()&&i.add("ANNOTATION"),i.add("ATTRIBUTE"),R.getInstance().doctype==3&&!R.getInstance().isPreview&&i.addExtend("REUSE_BLOCK",am()),i}function VYe(){let o=new qt;return o.add("HIDE_SELECTED_COPPER_FILLS"),o.add("SHOW_SELECTED_COPPER_FILLS"),o.add("HIDE_COPPER_FILLS"),o.add("SHOW_COPPER_FILLS"),o.add("REBUILD_SELECTED"),o.add("REBUILD_ALL",!0),o.add("RAISE_PRIORITY"),o.add("LOWER_PRIORITY",!0),o.add("COPPER_MANAGER"),o}var ihe=re.getInstance(),sE=class{constructor(t){this.oldItem=t}extendOldItem(t){if(t===this.oldItem)return;let e=this.oldItem,r=JSON.stringify(e.getComponent());new bl(r,t.type).rebuildComponent(t);let n=t.getComponent();if(t instanceof lt&&n instanceof y0&&n.type=="DRAWER"&&(n.type="T&B"),t.type==="Constraint Region"&&e.type==="Constraint Region"){let s=ihe.getRegion(t.globalIndex);s==null&&(s=ihe.addConstraintSelector(t.globalIndex));let a=this.getOldRegionSelector();ihe.updateRegionSelector(t.globalIndex,a,!0)}}extendOldCopperOrder(t){if(t===this.oldItem)return;let e=this.oldItem;t.type==="Copper Region"&&e.type==="Copper Region"&&(t.getComponent().order=e.getComponent().order)}getOldRegionSelector(){let t=this.oldItem;return ihe.getRegion(t.globalIndex)}};var yq=class{constructor(t,e,r){this.shapes=[];this.otherShapes=[];this.controlLines=[];this.originItem=t,this.fac=r,this.cutItemByPoint(e)}mouseMove(t){if(this.controlLines){let[e,r]=this.controlLines;e.end=t,r.start=t}}completed(){let t=new De("Insert Node");this.fac.addGroup(t);let e=this.getResult();if(e==null){A.publish("delete",this.originItem),this.fac.addCommand4Item(this.originItem,"delete"),this.originItem.remove(),this.originItem=null;return}let r=[e];this.shapes.length&&Eo(e.getMathGraphics())&&(r=lm(e),e.remove());let i=new sE(this.originItem);r.length==1?i.extendOldCopperOrder(r[0]):r.forEach(n=>{un.addOrder(n,this.fac.getCommand())}),r.forEach(n=>{i.extendOldItem(n),A.publish("hasModifyPcbItem",n),this.fac.addCommand4Item(n,"add")}),A.publish("delete",this.originItem),this.fac.addCommand4Item(this.originItem,"delete"),this.originItem.remove(),this.originItem=null,this.fac.checkOutlines(r,new Set)}getResult(){let t=this.originItem,e=Bu(this.originItem.type);if(e&&!Qh(this.shapes.map(d=>d.primitive),t.strokeWidth)){for(let d of this.shapes)d.remove();return this.shapes.length=0,this.otherShapes.length=0,null}e&&!Qh(this.shapes.map(d=>d.primitive))&&t instanceof lt&&this.shapes.push(Vi.build(t.layerId,t.end,t.start,t.strokeWidth));let r=[],i=new Po;this.shapes.forEach(d=>{let p=i.clone4(d.model);r.push(p),d.remove()});let n=this.otherShapes.map(d=>d.map(p=>{let m=i.clone4(p.model);return p.remove(),m}));r=A1(r);let{type:s,layerId:a,strokeWidth:l,net:c,locked:h}=t,u=pt.addPolygon(s,a,[].concat([r],n),l,c,h);return u.fill(),u}check(){let t=this.shapes.map(r=>this.getPt(r));return!t.length||!Eo(ge.build2(t))}interrupt(){this.shapes.forEach(t=>{t.remove()}),this.shapes.length=0,this.otherShapes.length=0,this.controlLines.length=0}cutItemByPoint(t){let e=this.originItem;if(e instanceof He){let r=e.layerId,{shapes:i,otherShapes:n}=this.convertToShape(e,t);this.otherShapes=n;let s=!1;for(let a=0;a<i.length;a++){let l=i[a];if(!l.isSelect(t.x,t.y)||s)this.shapes.push(l);else{s=!0;let c=l.width;if(l instanceof Vi){let h=Vi.build(r,l.start,t,c),u=Vi.build(r,t,l.end,c);this.controlLines=[h,u],this.shapes.push(h,u);let d=a>0?i[a-1].end.sub(i[a-1].start).angle(S.ORIGIN):0,p=a<i.length-1?i[a+1].end.sub(i[a+1].start).angle(S.ORIGIN):0;ai.handleAddSnapFlagData(void 0,void 0,[{center:l.start,rotation:d},{center:l.end,rotation:p}])}else{let{center:h,radius:u,startAngle:d,endAngle:p,sweep:m}=l,g=t.angleX(h),y=es.build(r,h,u,c,d,g,m),b=es.build(r,h,u,c,g,p,m);this.controlLines=[y,b],this.shapes.push(y,b)}l.remove()}}this.shapes.forEach(a=>{a.color=e.color||null}),this.otherShapes.flat(1).forEach(a=>{a.color=e.color||null})}}convertToShape(t,e){let{layerId:r,strokeWidth:i}=t,n=new Array,s=new Array;if(t instanceof rr)t.getAllLinesInOrder().forEach(a=>{a instanceof M?n.push(Vi.build(r,a.start(),a.end(),i)):a instanceof q&&n.push(es.build(r,a.center,a.rx,i,zt.toRadians(a.startAngle),zt.toRadians(a.endAngle()),a.sweep()))});else if(t instanceof Pr){let a=Math.PI,l=[a/2,0,-a/2,a,a/2],{center:c,radius:h}=t;for(let u=0;u<l.length-1;u++){let d=es.build(r,c,h,i,l[u],l[u+1],ae.CW);n.push(d)}}else if(t instanceof lt){let a=t.getChildrens();for(let l of a){let c=new Array;for(let u of l)if(u instanceof mt){let d=Vi.build(r,u.start,u.end,i);c.push(d)}else{let{center:d,radius:p,startAngle:m,endAngle:g,sweep:y}=u,b=es.build(r,d,p,i,m,g,y);c.push(b)}c.some(u=>u.isSelect(e.x,e.y))?n=c:s.push(c)}}return{shapes:n,otherShapes:s}}getPt(t){if(t instanceof Vi)return new M(t.start,t.end);{let{center:e,startAngle:r,endAngle:i,radius:n,sweep:s}=t,a=r/Math.PI*180,l=i/Math.PI*180;return q.build2(e,a,l,n,n,s)}}};var bq=class{constructor(t,e,r){this.shoveEvent=new rR;this.block=new w0;this.numberOfIterator=0;this.lastBlockEnd=null;this.shapes=[];this.controlLines=[];this.controlArcs=[];let i=this.correctSelectPoint(t,e);this.originItem=t,this.fac=r,this.cutItemByPoint(i),this.originItem instanceof Ir&&(this.chain=this.shoveEvent.getChain(this.originItem),this.shoveEvent.shoveFun.result.sourceTrackChain.push(this.chain.tracks),this.shoveEvent.shoveFun.result.shovePathMap[0]=this.chain)}mouseMove(t){if(this.originItem instanceof yi){let[e,r]=this.controlArcs;e.end=t,r.start=t}else{let[e,r,i]=this.controlLines,n=45,s=e.start,a=i.end,l=a.sub(s),h=t.sub(s).cross(l)<0?1:-1,u=Math.PI*n/180,p=l.multiply4(Ae.rotateZ(u*h)).normalize().mul(l.length()*Math.cos(u)),m=s.add(p),g=this.getVectorProjection(t.sub(s),l),y=t.sub(s).sub(g),b=new M(s.add(y),a.add(y)),P=new M(s,m),T=new M(a,m),I=this.getIntersection(P,b)[0],C=this.getIntersection(T,b)[0];I&&C?(e.end=I,r.start=I,r.end=C,i.start=C):(e.end=m,r.start=m,r.end=m,i.start=m),this.blockTrack()}}blockTrack(){if(!(this.originItem instanceof Ir))return;if(this.numberOfIterator++,this.numberOfIterator>100){this.numberOfIterator=0,this.lastBlockEnd=null;return}let[t,e,r]=this.controlLines;if(this.isBlock()){this.block.adsorp=null;let i=this.block.blockBaseTrack(t,!0);if(i.distance2(t.end)>1e-8)this.mouseMove(i);else{let n=this.block.blockBaseTrack(r,!1);if(n.distance2(r.start)>1e-8)this.mouseMove(n);else if(this.block.blockBaseTrack(e).distance2(e.end)>1e-8){let a=this.block.getEnd4Block(e.direct,e.layerId,e.width,e.net);a=a.filter(c=>this.lastBlockEnd?!c.equals1(this.lastBlockEnd):!0);let l=this.getEnd(this.originItem.primitive,a);this.lastBlockEnd=l,this.mouseMove(l)}}}else if(this.isPush()){this.shove();for(let i of this.controlLines)i.hidden()}}shove(){let t=this.splitPath(this.chain),e=this.shoveEvent.getNewChainFactory(this.chain,t).build();this.shoveEvent.shoveFun.remove4Rtree([this.chain]),this.shoveEvent.shoveFun.shoveMain(e),this.shoveEvent.shoveFun.add4Rtree([this.chain]);let r=this.shoveEvent.shoveFun.result;r.sourceTrackChain[0]=this.chain.tracks,this.shoveEvent.current=r,this.shoveEvent.preview(r)}splitPath(t){let e=0,r=new Array,i=new Array,n=new Array;for(let a of t.path)switch((a.equals1(this.originItem.start)||a.equals1(this.originItem.end))&&e++,e){case 0:r.push(a);break;case 1:i.push(a);break;case 2:i.push(a),e++;break;default:n.push(a);break}let s=new Array;s.push(this.shapes[0].start);for(let a of this.shapes)s.push(a.end);return s[0].equals1(i[0])?[].concat(r,s,n):s[s.length-1].equals1(i[0])?[].concat(r,s.reverse(),n):[].concat(r,[i[0]],s,i[1],n)}shoveInterrupt(){this.shoveEvent.shoveTrackInterrupt()}getEnd(t,e){let r=Number.MAX_VALUE,i=e[0];for(let n of e){let a=er.foot(t,n).distance2(n);a<r&&(r=a,i=n)}return i}isBlock(){let t=Zt.getInstance();return t.mode=="WIRING_MODE_SURROUND_AND_PUSHAWAY"||t.mode=="WIRING_MODE_SURROUND"||t.mode=="WIRING_MODE_OBSTRUCT"}isPush(){return Zt.getInstance().mode=="WIRING_MODE_PUSHAWAY"}completed(){let t=this.getResult(),e=new De("Insert Node");this.fac.addGroup(e),this.shoveEvent.shoveTrackGroupComplete(e),t.forEach(r=>{A.publish("hasModifyPcbItem",r),this.fac.addCommand4Item(r,"add")}),A.publish("delete",this.originItem),this.fac.addCommand4Item(this.originItem,"delete"),this.originItem.remove(),this.originItem=null,this.fac.execute()}getResult(){return this.shapes.map(e=>{let r=this.createTrack(e);return e.remove(),r})}check(){return!0}createTrack(t){let{layerId:e,width:r,net:i}=t;if(t instanceof Id)return pr.addTrack(e,t.start,t.end,r,!1,i);if(t instanceof yR){let{center:n,radius:s,startAngle:a,endAngle:l,sweep:c}=t;return pr.addArcTrack(e,n,s,a,l,c,r,!1,i)}}interrupt(){this.shoveInterrupt(),this.shapes.forEach(t=>{t.remove()}),this.shapes.length=0,this.controlLines.length=0,this.controlArcs=[]}getIntersection(t,e){let r=Pt(t,e);return Om(r,[])}correctSelectPoint(t,e){if(t instanceof yi)return e;{let r=e.sub(t.start),i=t.end.sub(t.start),n=this.getVectorProjection(r,i);return t.start.add(n)}}cutItemByPoint(t){let e=this.originItem,r=e.layerId;if(e instanceof Ir){let{start:i,end:n,net:s,width:a}=e,c=(i.distance2(t)>n.distance2(t)?n:i).sub(t).mul(.5),h=t.add(c),u=t.sub(c);h.distance2(i)>u.distance2(i)&&(h=t.sub(c),u=t.add(c));let d=Id.build(r,h,h,a,s),p=Id.build(r,h,u,a,s),m=Id.build(r,u,u,a,s),g=Id.build(r,i,h,a,s),y=Id.build(r,u,n,a,s);this.controlLines.push(d,p,m),this.shapes.push(g,...this.controlLines,y)}else if(e instanceof yi){let{center:i,radius:n,startAngle:s,endAngle:a,sweep:l,width:c,net:h}=e,u=t.angleX(i),d=yR.build(r,i,n,s,u,l,c,h),p=yR.build(r,i,n,u,a,l,c,h);this.controlArcs=[d,p],this.shapes.push(...this.controlArcs)}}getVectorProjection(t,e){let r=e.normalize(),i=r.dot(t);return r.mul(i)}};var nhe=class{constructor(t,e,r){this.selectLines=[null,null];this.clickRectPointType=0;let i=new De("Move Item Node");this.originItem=t,this.fac=r,this.fac.addGroup(i),this.init(e),t instanceof rr||t instanceof Pr?this.fac.addCommand4Item(t,"modify"):this.filterItem(this.selectLines).forEach(s=>{this.fac.addCommand4Item(s,"modify")})}getFilterItems(){let t=[].concat([this.originItem],this.selectLines);return t=t.filter(e=>e),new Set(t)}mouseMove(t){let e=this.originItem;e instanceof rr?this.moveRect(t):e instanceof Pr?e.radius=e.center.distance1(t):this.selectLines.forEach((r,i)=>{r&&(this.clickPointType[i]==0?r.start=t:this.clickPointType[i]==1&&(r.end=t))})}completed(){if(this.originItem instanceof He){if(this.originItem instanceof lt&&(iD(this.originItem),this.originItem.getChildrens().length&&Eo(this.originItem.getMathGraphics()))){let e=lm(this.originItem,this.fac.getCommand());this.fac.checkOutlines(e,new Set);return}this.originItem.fill()}A.publish("hasModifyPcbItem",this.originItem),this.fac.checkOutlines([this.originItem],new Set)}check(){if(this.originItem instanceof lt){let e=this.originItem.getChildrens().every(r=>{let i=r.map(n=>this.getPt(n));return!i.length||!Eo(ge.build2(i))});if(!e){A.publish("ui/toastMsg",{type:"warn",msg:"This object has self-intersection, please modify"},Q());return}return e}return!0}interrupt(){this.fac.undo()}clear(){}moveRect(t){let e=this.originItem,r=[e.getUL(),e.getUR(),e.getLR(),e.getLL()],i=Ae.rotateZForPoint(e.getUL(),-e.rotation),n=Ae.rotateZForPoint(e.getUL(),e.rotation),s=(this.clickRectPointType+2)%r.length,a=t.multiply4(i),l=r[s].multiply4(i),c=new _e;c.ext2(a).ext2(l);let h=c.build1(),u=[h.UL(),h.UR(),h.LR(),h.LL()];u=u.map(d=>d.multiply4(n)),e.setUL(u[0]),e.setUR(u[1]),e.setLR(u[2]),e.setLL(u[3]),this.isSamePoint(t,e.getUL())?this.clickRectPointType=0:this.isSamePoint(t,e.getUR())?this.clickRectPointType=1:this.isSamePoint(t,e.getLR())?this.clickRectPointType=2:this.isSamePoint(t,e.getLL())&&(this.clickRectPointType=3)}getPt(t){if(t instanceof mt)return new M(t.start,t.end);{let{center:e,startAngle:r,endAngle:i,radius:n,sweep:s}=t,a=r/Math.PI*180,l=i/Math.PI*180;return q.build2(e,a,l,n,n,s)}}init(t){let e=this.originItem;if(e instanceof rr)this.isSamePoint(t,e.getUL())?this.clickRectPointType=0:this.isSamePoint(t,e.getUR())?this.clickRectPointType=1:this.isSamePoint(t,e.getLR())?this.clickRectPointType=2:this.isSamePoint(t,e.getLL())&&(this.clickRectPointType=3);else if(!(e instanceof Pr)){if(e instanceof lt){let r=e.getChildrens().map(i=>i.map(n=>n));for(let i=0;i<r.length;i++){let n=r[i],s=[],a=n.length;for(let l=0;l<a;l++)if(this.isSamePoint(n[l].start,t)){s.push(l-1,l);break}else if(this.isSamePoint(n[l].end,t)){s.push(l,l+1);break}s[0]>=0&&s[0]<a&&(this.selectLines[0]=n[s[0]]),s[1]>=0&&s[1]<a&&(this.selectLines[1]=n[s[1]]),e.isClose(i)&&this.isSamePoint(n[0].start,t)&&(this.selectLines=[n[a-1],n[0]])}this.clickPointType=[1,0]}else if(e instanceof Ge){let r=this.isSelectTrackEndPoint(e,t)===-1,i=new ou(e),{startType:n,endType:s,startNodes:a,endNodes:l}=i,c=r?n:s,h=r?a[0]:l[0],u=r?0:1;switch(c){case 5:case 7:this.selectLines=[e,h],this.clickPointType=[u,0];break;case 6:case 8:this.selectLines=[e,h],this.clickPointType=[u,1];break;case 0:this.selectLines=[e,null],this.clickPointType=[u,2]}}}}isSelectTrackEndPoint(t,e){let r=t.width/2,i=ne.greatereq(r,t.start.distance1(e)),n=ne.greatereq(r,t.end.distance1(e));return i?-1:n?1:0}isSamePoint(t,e){return t.distance1(e)<1e-8}filterItem(t){let e=new Set;return t.forEach(r=>{if(r instanceof Ls){let i=r.getParent();i?e.add(i):e.add(r)}}),Array.from(e)}};var ohe=class extends ni{constructor(e={},r){super();this.tool=null;this.originItem=null;this.selects=[];this.ready=!1;this.drawing=!0;let{selects:i=ze.getSelects()}=e;this.selects=JV(i),this.fac=r,this.start()}changeToReady(e){this.checkToReady(this.selects,e),this.ready||this.cancel()}checkToReady(e,r){var n;let i=(n=e.filter(s=>this.isSelectItem(s,r)))==null?void 0:n[0];if(i){let s=JV([i]);this.originItem=s[0];let a=this.originItem;a&&(this.ready=!0,this.selects=e,Ut.cancel(),this.isSelectEndPoint(a,r)?(gr.model=3,a instanceof He&&a.removeFill(),this.tool=new nhe(a,r,this.fac),this.filterItems=this.tool.getFilterItems()):(A.publish("clearSelect",""),a.hidden(),a instanceof He?(a.removeFill(),this.tool=new yq(a,r,this.fac)):this.tool=new bq(a,r,this.fac)))}}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY);this.ready?this.tool&&this.completed():this.checkToReady(this.selects,r)}onMouseMove(e){if(!this.drawing||!this.ready||!this.tool){this.ready||Ut.update(e,"Please select a node to insert");return}this.tool instanceof yq&&ai.snapToSnapFlag(e,void 0,!0);let r=new S(e.sceneX,e.sceneY);this.tool instanceof bq&&(this.tool.numberOfIterator=0,this.tool.lastBlockEnd=null),this.tool.mouseMove(r)}completed(){!this.tool||!this.originItem||(this.tool.completed(),this.interrupt())}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":{this.cancel();break}case"Finish":this.onEnterPlace(e);break}}onMouseRightUp(e){if(e.openMenu)switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this)}parse(e){switch(e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}cancel(){this.interrupt(),A.publish("onlySelect",this.selects)}interrupt(){this.ready=!1,this.tool&&this.tool.interrupt(),Ut.cancel(),A.publish("tool","dropdrag"),this.end()}isSelectItem(e,r){return e instanceof rr||e instanceof Pr?e.isSelectOnlyLine(r.x,r.y):e instanceof lt?e.onlyOutline(r.x,r.y):e instanceof Ge?this.isSelectTrack(e,r):e.isSelect(r.x,r.y)}isSelectTrack(e,r){let i=this.isSelectTrackEndPoint(e,r);if(i){let n=i===-1,s=new ou(e);switch(n?s.startType:s.endType){case 5:case 7:case 6:case 8:case 0:return!0}return!1}return e.isSelect(r.x,r.y)}isSelectEndPoint(e,r){if(e instanceof rr)return[e.getUL(),e.getUR(),e.getLR(),e.getLL()].some(n=>n.distance1(r)<1e-8);if(e instanceof Pr){let{center:i,radius:n}=e,{x:s,y:a}=i;return[new S(s,a-n),new S(s,a+n),new S(s-n,a),new S(s+n,a)].some(c=>c.distance1(r)<1e-8)}else{if(e instanceof lt)return e.getChildrens().some(n=>n.some(s=>s.start.distance1(r)<1e-8||s.end.distance1(r)<1e-8));if(e instanceof Ge)return!!this.isSelectTrackEndPoint(e,r)}}isSelectTrackEndPoint(e,r){let i=e.width/2,n=ne.greatereq(i,e.start.distance1(r)),s=ne.greatereq(i,e.end.distance1(r));return n?-1:s?1:0}};function JV(o){let t=new Set;return o.forEach(e=>{if(!(e instanceof Jr)&&e instanceof Ls){let r=e.getParent();r?t.add(r):t.add(e)}}),o=Array.from(t),o.length===1&&o[0]instanceof He&&o[0].type!=="3D Shell - Screw Pillar"||o.every(r=>r instanceof Ge)?o:[]}function GYe(o){let t=new qt,e=ze.getSelects(),r=e.some(i=>i instanceof He&&i.type==="3D Shell - Screw Pillar");return!r&&t.add("ADD_FILLET"),!r&&t.add("ADD_CHAMFER"),o&&t.add("SETUP_WINDOWINGAREA"),R.getInstance().doctype===pi.PCB&&e.every(n=>n instanceof He&&(n.type=="Line"||n.type=="Fill Region"||n.type=="Board Outline"||n.layerId==11))&&t.add("ADDVIA_FENCE"),t}function UYe(o,t,e){let r=ze.getSelects(),i=new qt;if(i.add("CANCEL",!0),i.add("LOOKUP",!0),R.getInstance().doctype==pi.PCB){let b=ze.getSelects();Ao(b[0])&&jt.getPick(8)&&Uy&&i.add("CROSSPROBE",!0)}let n=new qt;e.getIsBoxSelection()||n.add("OVERLAP"),n.add("PRIMITIV_2DLINE"),o&&n.add("SECOND_COMBINATION"),i.addExtend("SELECT",n),i.add("COPY"),_g(i,we),i.add("CUT"),i.add("DELETE"),i.addExtend("DUPLICATE",N2()),i.addExtend("MOVE",df());let s=r.some(b=>b instanceof He&&b.type==="3D Shell - Screw Pillar"),a=B6.filterD3Shell(r).length===0,l=0,c=!1,h=new Set;if(r.forEach(b=>{if(oq(b)||l++,b instanceof _t||b instanceof mt){let T=b.getParent();T instanceof lt&&T.getAllChildrens().length>0&&(c=!0),T instanceof He&&h.add(T.type)}else b instanceof lt?(b.getAllChildrens().length>0&&(c=!0),h.add(b.type)):(b instanceof Pr||b instanceof rr)&&(c=!0,h.add(b.type))}),JV(r).length&&!s&&i.add("INSERT_NODE"),c&&!s&&i.add("EDIT_BOUNDARY"),r.length===1&&R.getInstance().doctype==pi.PCB){let b=r[0];(b instanceof _t||b instanceof mt)&&(b=b.getParent()),b instanceof He&&b.type==="Board Outline"&&i.add("GENERATE_D3_SHELL_OUTLINE")}if(l>=2&&i.add("MERGE_AS_CLOSED_OBJECT"),r.length>=1){let b=r.filter(P=>{let T=P;return(P instanceof mt||P instanceof _t)&&(T=P.getParent()),T.type=="Line"});a&&i.add("DISPERSED_AS_INDEPENDENT_LIEN")}let u=new qt;if(we.canIntersectionAggregate&&(u.add("boolIntersection"),u.add("boolAggregate")),we.canSubtractionExclusive&&(u.add("boolSubtraction"),u.add("boolExclusive")),we.canBooleanSplit&&u.add("boolSplit"),(we.canIntersectionAggregate||we.canSubtractionExclusive||we.canBooleanSplit)&&i.addExtend("boolOperation",u),R.getInstance().doctype==pi.PCB&&i.addExtend("opensubmenu-boardshape",$V()),we.canSplit&&i.add("SPLIT"),we.canCutout||we.canAvoidSlotsOrPads){let b=new qt;we.canCutout&&(b.add("CUTOUT_RECT"),b.add("CUTOUT_CIRCLE"),b.add("CUTOUT_POLYGON")),we.canAvoidSlotsOrPads&&(b.add("avoidSlots"),b.add("avoidPads")),i.addExtend("CUTOUT",b)}let d=new qt,p=h.size!=1;h.has("Line")&&R.getInstance().doctype==pi.PCB&&d.add("CONVERT_TO_TRACK"),d.add("CONVERT_TO_PAD"),r.length>=1&&((p||!h.has("Line"))&&d.add("CONVERT_TO_2D_LINE"),(p||!h.has("Slot Region"))&&d.add("CONVERT_TO_SLOT_REGION"),(p||!h.has("Fill Region"))&&d.add("CONVERT_TO_FILL_REGION"),R.getInstance().doctype==pi.PCB&&(p||!h.has("Copper Region"))&&d.add("CONVERT_TO_COPPER_REGION"),(p||!h.has("Prohibited Region"))&&d.add("CONVERT_TO_PROHIBITED_REGION"),R.getInstance().doctype==pi.PCB&&((p||!h.has("Board Outline"))&&d.add("CONVERT_TO_BOARD_OUTLINE"),(p||!h.has("Constraint Region"))&&d.add("CONVERT_TO_CONSTRAINT_REGION"),(p||!h.has("3D Shell - Outline"))&&d.add("CONVERT_TO_D3_SHELL_OUTLINE"),(p||!h.has("3D Shell - Side Slot Region")&&!h.has("3D Shell - Top Slot Region"))&&d.add("CONVERT_TO_D3_SHELL_SLOT_REGION"),(p||!h.has("3D Shell - Side Entity")&&!h.has("3D Shell - Top/Bottom Entity"))&&d.add("CONVERT_TO_D3_SHELL_ENTITY")),(p||!h.has("FPC Stiffener"))&&d.add("CONVERT_TO_FPC_STIFFENER")),i.addExtend("CONVERT_TO",d),t<2&&i.add("LOCKED",t==0),t>0&&i.add("LOCKED_CANCEL",!0),i.add("ADAPT_SELECTED"),i.addExtend("HIGHLIGHT",sm(),!0);let m=!1,g=!0;return r.forEach(b=>{if(b instanceof He)b.type=="Copper Region"?(m=!0,g=!1):(b.type=="Fill Region"||b.type=="Line")&&!(b.getParent()&&b.getParent()instanceof ke)?!ao(b.layerId)&&2!=b.layerId&&(g=!1):g=!1;else if(b instanceof _t||b instanceof mt){let P=b.getParent();P!=null&&P instanceof He&&(P.type=="Copper Region"?(m=!0,g=!1):(P.type=="Fill Region"||P.type=="Line")&&!(P.getParent()&&P.getParent()instanceof ke)?!ao(P.layerId)&&2!=P.layerId&&(g=!1):g=!1)}}),s||i.addExtend("ADD",GYe(g)),m&&i.addExtend("COPPER_AREA",VYe()),i.result[i.result.length-1].separate=!0,i.addExtend("COMBINATION",v1()),s?i.addExtend("OFFSET",Um(),!0):(i.addExtend("OFFSET",Um()),i.addExtend("ROTATE",Ag()),i.addExtend("FLIP",Xy()),i.add("TURNOVER",!0)),To.getInstance().getNeedAnnotation()&&i.add("ANNOTATION"),i.add("ATTRIBUTE"),R.getInstance().doctype==pi.PCB&&!R.getInstance().isPreview&&i.addExtend("REUSE_BLOCK",am()),i}function HYe(o,t,e){let r=ze.getSelects(),i=new qt;i.add("CANCEL",!0),i.add("LOOKUP",!0);let n=new qt;e.getIsBoxSelection()||n.add("OVERLAP");let s=!1;return r.forEach(l=>{let c=l.getParent();c!=null&&c instanceof ke&&(s=!0)}),s&&n.add("PRIMITIV_COMPONENT"),o&&n.add("SECOND_COMBINATION"),i.addExtend("SELECT",n),i.add("COPY"),_g(i,we),i.add("CUT"),i.addExtend("DUPLICATE",N2()),i.addExtend("MOVE",df()),i.add("DELETE"),s||i.add("ARRAYS"),t<2&&i.add("LOCKED",t==0),t>0&&i.add("LOCKED_CANCEL",!0),i.add("ADAPT_SELECTED"),i.addExtend("HIGHLIGHT",sm(),!0),i.addExtend("COMBINATION",v1()),i.addExtend("OFFSET",Um()),i.addExtend("ROTATE",Ag()),i.addExtend("FLIP",Xy()),i.add("TURNOVER"),r.length>1&&(i.addExtend("ALIGNMENT",uD()),i.addExtend("DISTRIBUTION",dD(),!0)),To.getInstance().getNeedAnnotation()&&i.add("ANNOTATION"),i.add("ATTRIBUTE"),R.getInstance().doctype==3&&!R.getInstance().isPreview&&i.addExtend("REUSE_BLOCK",am()),i}function WYe(o,t,e){let r=new qt;r.add("CANCEL",!0),r.add("LOOKUP",!0);let i=new qt;i.add("OVERLAP"),o&&i.add("SECOND_COMBINATION"),r.addExtend("SELECT",i),r.add("COPY"),_g(r,we),r.add("CUT"),r.addExtend("DUPLICATE",N2()),r.addExtend("MOVE",df()),r.add("DELETE");let n=ze.getSelects();return r.add("ARRAYS"),t<2&&r.add("LOCKED",t==0),t>0&&r.add("LOCKED_CANCEL",!0),r.add("ADAPT_SELECTED"),r.addExtend("HIGHLIGHT",sm(),!0),r.addExtend("COMBINATION",v1()),r.addExtend("OFFSET",Um()),r.addExtend("ROTATE",Ag()),r.addExtend("FLIP",Xy()),r.add("TURNOVER"),n.length>1&&(r.addExtend("ALIGNMENT",uD()),r.addExtend("DISTRIBUTION",dD(),!0)),To.getInstance().getNeedAnnotation()&&r.add("ANNOTATION"),r.add("ATTRIBUTE"),R.getInstance().doctype==3&&!R.getInstance().isPreview&&r.addExtend("REUSE_BLOCK",am()),r}function zYe(o){let t=new qt;return t.add("CANCEL",!0),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),To.getInstance().getNeedAnnotation()&&t.add("ANNOTATION"),t}var k2=class{constructor(t,e,r){this.items=new Array;t.forEach(i=>{i instanceof He&&i.type=="Prohibited Region"&&i.getParent()!=null||this.items.push(i)}),this._referX=e,this._referY=r}setReferPointSuccess(t,e){return!0}setReferPoint(t,e){this._referX=t,this._referY=e;let r={command:"batchMoveItem",refer:this,menu:"MOVE_BY_REFERENCE_POINT"};A.publish("toggle",r)}get referX(){return this._referX}set referX(t){this._referX=t}get referY(){return this._referY}set referY(t){this._referY=t}};var yEe=null,bT=class o{static filter(t){return yEe==null&&(yEe=new o),yEe.filter(t)}constructor(){}isUnique(t){if(t instanceof mn||t instanceof Jr||t instanceof Gi)return!0;if(t instanceof Le&&t.getParent()==null||t instanceof lr||t instanceof Ue)return!1;if(t instanceof hh)return!0;let e=t.getParent();if(e!=null){if(e instanceof ke)return!0;if(e instanceof lt)return!0}return!1}filter(t){let e=new Set;return t.forEach(r=>{if(!this.isUnique(r))e.add(r);else if(r instanceof mt||r instanceof _t){let i=r.getParent();i instanceof lt&&i.getParent()==null&&e.add(i)}}),Array.from(e)}};var she=class{};var bEe=class extends she{deleteModel(t){let e=t[0].getParent();if(t.some(r=>r.getParent()!==e))throw new Error("models has different parent");if(e instanceof lt)return e.type==="Line"?this.deleteLine(t,e):this.delete2DLine(t,e);throw new Error(`Not allowed to delete ${t.map(r=>r.globalIndex)}`)}delete2DLine(t,e){let r=e.getChildrens(),i=new Po,n=new Array,s=!1;for(let a=0;a<r.length;a++){let l=r[a],c=[...l];n[a]=c;let h=l.length;if(h>3&&e.isClose()&&t.length==1){let u=t[0],d=e.getConnect(u,!0),p=l.indexOf(u);if(p==-1)continue;c.length=0;let m=l.indexOf(d);if(p==0)for(let y=p+1;y<m;y++)c.push(l[y]);else{for(let y=p+1;y<h;y++)c.push(l[y]);for(let y=0;y<m;y++)c.push(l[y])}s=!0;let g=i.addLine(d.start,u.end,u.layerId,u.width,u.locked);c.push(g)}}if(s){let a=this.getPolygon(n,e);if(n.flat(1).forEach(l=>l.remove()),a!=null)return[a]}return null}deleteLine(t,e){let r=new Array,i=e.getChildrens(),n=new Set(t);for(let s of i){let a=s.length;if(n.size==a||a<=1)return r;let l=0;if(e.isClose())for(let c=0;c<a&&!n.has(s[c]);c++)l++;for(let c=l;c<a+l;c++){let h=new Array;for(;c<a+l&&!n.has(s[c%a]);)h.push(s[c%a]),c++;if(h.length){let u=this.getPolygon([h],e);u&&r.push(u)}}}return r}getPolygon(t,e){let r=new Array;for(let i=0;i<t.length;i++){let n=t[i];if(t.length>0){if(Bu(e.type)&&!Qh(n.map(a=>a.primitive))){for(let a of n)a.remove(),he.publish("delete",a);return null}let s=this.conversionModel(n);s=nm(s),s.length>0&&r.push(s)}}return r.length>0?pt.addPolygon(e.type,e.layerId,r,e.strokeWidth,e.net,e.locked):null}conversionModel(t){let e=new Array,r=new Po;return t.forEach(i=>{let n=r.clone4(i.model);e.push(n)}),e}delete(t){}deleteItems(t){}},YYe=new bEe;function jYe(){let o=new qt;if(o.add("CANCEL",!0),R.getInstance().doctype==3){let e=ze.getSelects();Ao(e[0])&&jt.getPick(8)&&Uy&&o.add("CROSSPROBE",!0)}return o.add("CONVERT_TO_FILL_REGION"),o.add("ADAPT_SELECTED"),o.addExtend("HIGHLIGHT",sm(),!0),o.add("DELETE"),o.add("SETUP_WINDOWINGAREA",!0),To.getInstance().getNeedAnnotation()&&o.add("ANNOTATION"),o.add("ATTRIBUTE"),R.getInstance().doctype==3&&!R.getInstance().isPreview&&o.addExtend("REUSE_BLOCK",am()),o}var ahe=class{constructor(){this.isTabSwitch=!1}switchItemSelect(t){A.publish("clearSelect","");for(let e of t)e.click();A.publish("select",t),ze.crossWindow()}};var lhe=class extends ahe{switchRange(){let t=this.tabSwitchMsg,e=t.selectItem;switch(t.type){case"Track":t.range=this.switchByTrack(t.range,e);break;case"Pad":t.range=this.switchByPad(t.range,e);break;case"PcbText":t.range=this.switchByAtrr(t.range,e);break;case"Component":t.range=this.switchByComponent(t.range,e);break;case"LineModel":t.range=this.switchByLine(t.range,e);break}this.isTabSwitch=!0,this.tabSwitchMsg=t}switchByTrack(t,e){switch(t){case"single track":let r=new uf(e,!1).all;return this.switchItemSelect(r),"whole track";case"whole track":let i=e.net;if(i){let n=Ye.getSameNetItemsWithoutPourAndPlaneZone(i);return this.switchItemSelect(n),"whole net"}case"whole net":return this.switchRangeItem(e,"single track")}}switchByPad(t,e){switch(t){case"pad":return this.switchRangeItem(e,"single component",void 0,!0);case"single component":return this.switchRangeItem(e,"component group","pad",void 0,!0);case"component group":return this.switchRangeItem(e,"pad")}}switchByAtrr(t,e){switch(t){case"attr":return this.switchRangeItem(e,"single component",void 0,!0);case"single component":return this.switchRangeItem(e,"component group","attr",void 0,!0);case"component group":return this.switchRangeItem(e,"attr")}}switchByComponent(t,e){switch(t){case"single component":return this.switchRangeItem(e,"component group",void 0,void 0,!0);case"component group":return this.switchRangeItem(e,"single component")}}switchByLine(t,e){switch(t){case"single line":return this.switchRangeItem(e,"whole line",void 0,!0);case"whole line":return this.switchRangeItem(e,"single line")}}startSwitch(t){let e=t[0];e instanceof Ge?this.tabSwitchMsg=this.singleSelect(e,"Track","whole track"):e instanceof Le?this.tabSwitchMsg=this.singleSelect(e,"Pad","single component"):e instanceof lr&&e.key!=""?this.tabSwitchMsg=this.singleSelect(e,"PcbText","single component"):e instanceof ke?this.tabSwitchMsg=this.singleSelect(e,"Component","component group"):(e instanceof mt||e instanceof _t)&&(this.tabSwitchMsg=this.singleSelect(e,"LineModel","whole line")),this.isTabSwitch=!0}switchRangeItem(t,e,r,i=!1,n=!1){var s;if(i){let a=t.getParent();a&&this.switchItemSelect([a])}else if(n){let a=r?(s=t.getParent())==null?void 0:s.getGroupID():t.getGroupID();if(a){let l=Ht.getItem(a).getItems();this.switchItemSelect(l)}else if(r)return this.switchItemSelect([t]),r}else this.switchItemSelect([t]);return e}singleSelect(t,e,r){if(t instanceof Ge){let i=new uf(t,!1).all;this.switchItemSelect(i)}else if(t instanceof ke){let i=t.getGroupID();if(i){let n=Ht.getItem(i).getItems();this.switchItemSelect(n)}else r="single component"}else{let i=t.getParent();i&&this.switchItemSelect([i])}return{selectItem:t,type:e,range:r}}};var che=class{constructor(){this.components=new Set}add(t){let e=t.getParent();e instanceof ke&&!ze.highlight.isItemHighlighted(e.globalIndex)&&!ze.getSelects().includes(e)&&(this.components.add(e),e.click())}clear(){this.components.forEach(t=>t.visible()),this.components.clear()}};var PEe=class{constructor(t,e){this.items=new Array;this.pls=new Array;this.items=t,this.pls=e}},hhe=class{mergePads(t){let e=new hi;e.createGroup("merge pads");let r=this.getMergeGroup(t);for(let i of r)i.items.length>1&&this.mergePadGroup(i,e);e.execute()}getMergeGroup(t){let e=new Array,r={};for(let n=0,s=t.length;n<s;n++){let a=t[n],l=r[a.globalIndex];l==null&&(l=new Set,r[a.globalIndex]=l),l.add(a);let c=this.getPadMathGraphics(a);for(let h=n+1;h<s;h++){let u=t[h],d=r[u.globalIndex];if(d==null&&(d=new Set,r[u.globalIndex]=d),d.add(u),u.buildBBox().isIntersect(a.buildBBox())){let p=this.getPadMathGraphics(u),{relation:m}=new Xl(c,p,0);m!==3&&(l.add(u),d.add(a))}}}let i=new Set;for(let n in r)if(!i.has(n)){let s=new Array,a=new Set;for(s.push(n);s.length>0;){let u=s.pop();i.add(u);let d=r[u];for(let p of d)i.has(p.globalIndex)||s.push(p.globalIndex),a.add(p)}let l=new Array,c=new Array;for(let u of a)c.push(u),l.push(this.getPadMathGraphics(u));let h=new PEe(c,l);e.push(h)}return e}getPadMathGraphics(t){if(ar(t.layerId)){if(t instanceof _i){let e=1;return t.getMathGraphics(e)}if(t instanceof sn){let e=1;return t.getMathGraphics(e)}}else return t.getMathGraphics()}mergePadGroup(t,e){let r=TI(t.pls),i=new Array;for(let y of r)y.isClose()&&i.push(y);let n=i[0],s=0,a=!0,l=new Wf(n.primitives),c=a2(t.items.map(y=>y.num))[0],u=t.items.filter(y=>y.layerId===12).length?12:t.items[0].layerId;t.items.forEach(y=>{e.addCommand4Item(y,"delete"),A.publish("delete",y),y.remove()});let d=l.high*.3,p=ge.build2([q.build2(l.center,0,360,d,d,ae.CCW)]),m=!0;do{let y=!1;Hn(n.primitives,(b,P)=>{let T=P.stroke(.1,wr.ROUND,ae.CW);if(new As(T,p,0).relation===0&&d>0){if(y=!0,d=d*.9,d=d<.01?0:d,d==0)return;p=ge.build2([q.build2(l.center,0,360,d,d,ae.CCW)])}}),y||(m=!1)}while(m);let g=Qt.addPolygonPad(u,`${c}`,l.center,s,n,"",!1,1,.4,.4,.4,[],a,1,d,"ROUND",0,ut.defalutPad.holeOffset);e.addCommand4Item(g,"add")}};var TEe=class{constructor(){this.preItems=Array();this.locked=!0;this.selectItem=null}onMouseLeftDown(t){let e=new S(t.realSceneX,t.realSceneY),r=ze.getSelects();if(!t.ctrlKey&&this.selectItem?this.isSelectItem(this.selectItem,e)?this.locked=!1:this.resetStatus():this.resetStatus(),r.length&&!this.selectItem){let i=r.filter(n=>this.isSelectItem(n,e))[0];this.selectItem=i,this.selectItem&&!this.preItems.length&&(this.preItems=r)}}onDoubleClick(t){let{locked:e,selectItem:r}=this,i=this.preItems;this.resetStatus();let n=JV(i);if(!(e||t.ctrlKey||!r||!n.length)){for(let s of i)if(s.isEmpty){i=ze.getSelects();break}A.publish("toggle",{command:"insertNode",selects:i,ready:!0,position:new S(t.realSceneX,t.realSceneY)})}}resetStatus(){this.locked=!0,this.selectItem=null,this.preItems=[]}isSelectItem(t,e){if(t.isEmpty)return!1;if(t instanceof rr||t instanceof Pr)return t.isSelectOnlyLine(e.x,e.y);if(t instanceof lt)return t.onlyOutline(e.x,e.y);if(t instanceof Ge){let r=t.start.distance1(e)<1e-8,i=t.end.distance1(e)<1e-8;return t.isSelect(e.x,e.y)&&!r&&!i||this.checkSelectTrackEndPoint(t,e)}return t.isSelect(e.x,e.y)}checkSelectTrackEndPoint(t,e){let r=t.start.distance1(e)<1e-8,i=t.end.distance1(e)<1e-8;if(r||i){let n=new ou(t);switch(r?n.startType:n.endType){case 5:case 7:case 6:case 8:case 0:return!0}return!1}}},IEe=new TEe;function Kvt(o){let t="";for(let e=0;e<o.length;e++){let r=o[e].getParent();if(!r)return!1;if(e===0){t=r.globalIndex;continue}if(t!==r.globalIndex)return!1}return!0}function XYe(o){let t=ze.getSelects(),e=[];t.forEach(a=>{a instanceof Jr&&e.push(a)});let r=new qt;if(r.add("CANCEL",!0),R.getInstance().doctype==3){let a=ze.getSelects();Ao(a[0])&&jt.getPick(8)&&Uy&&r.add("CROSSPROBE",!0)}let i=new qt;return Kvt(e)&&i.add("SELECT_PARENT",!1),i.add("SELECT_CONNECTED_THERMALS",!1),r.addExtend("SELECT",i,!0),r.add("CONVERT_TO_FILL_REGION",!1),e.some(a=>a instanceof Jr&&[1,2].includes(a.layerId))&&r.add("ADD_SOLDER_MASK"),r.add("ADAPT_SELECTED",!1),r.addExtend("HIGHLIGHT",sm(),!0),r.add("DELETE"),To.getInstance().getNeedAnnotation()&&r.add("ANNOTATION"),r.add("ATTRIBUTE"),R.getInstance().doctype==3&&!R.getInstance().isPreview&&r.addExtend("REUSE_BLOCK",am()),r}var CEe=class{constructor(){this.timeOut=null;this.objs=new Array;this.groups=new Array}addObj(t,e){this.objs.push({attr:{id:t,pcbid:R.getInstance().tabId},text:`${Tr}${e}`})}addGroup(t,e){this.groups.push({attr:{id:t,pcbid:R.getInstance().tabId},text:`${e} (${t})`})}execute(){this.timeOut!=null&&(clearTimeout(this.timeOut),this.timeOut=null),this.timeOut=setTimeout(()=>{he.publish("ui/toastMsg",{type:"error",msg:"Object has been deleted, exited group",bottomBarMsg:{type:"warn",msg:['<span class="i18n">Object</span>',...this.objs,'<span class="i18n">has been deleted, exited group </span>',...this.groups]}},Q()),this.objs.length=0,this.groups.length=0,this.timeOut=null},10)}executeTrack(){this.timeOut!=null&&(clearTimeout(this.timeOut),this.timeOut=null),this.timeOut=setTimeout(()=>{he.publish("ui/toastMsg",{type:"error",msg:"Track has been stretched, exited group",bottomBarMsg:{type:"warn",msg:['<span class="i18n">Track</span>',...this.objs,'<span class="i18n">has been stretched, exited group </span>',...this.groups]}},Q()),this.objs.length=0,this.groups.length=0,this.timeOut=null},10)}},tC=new CEe;function Zvt(){let o=document.querySelector(window.canvas_2d_selector||"#canvas-2d")||document.getElementById("canvas");return o instanceof HTMLCanvasElement||(o=document.createElement("canvas")),o.style.width="100%",o.style.height="100%",o}var QA=Zvt();function zu(o){QA.style.cursor=o,document.documentElement.style.cursor=o}var uhe=class{constructor(t,e,r){this.shape=t,this.layer=e,this.clearance=r}getPolylines(){let t=new Array;if(this.shape instanceof Os||this.shape instanceof Rm){let e=this.shape.shape(this.layer,this.clearance).closeEndpoint();t.push(e)}else if(this.shape instanceof Jp){if(this.layer.equals($r.MULTI)&&this.layer.equals(this.shape.layer)){let e=this.shape.shape(this.layer,this.clearance).closeEndpoint();t.push(e)}else if(!this.shape.isUnuseLayers(this.layer)){let e=this.shape.shape(this.layer,this.clearance).closeEndpoint();t.push(e)}}else if(this.shape instanceof gl||this.shape instanceof yy){if(this.layer.equals($r.MULTI)){let e=this.shape.shape($r.MULTI,this.clearance).closeEndpoint();t.push(e)}else if(!this.shape.isUnuseLayers(this.layer)){let e=this.shape.shape(this.layer,this.clearance).closeEndpoint();t.push(e)}}else if(this.shape instanceof $P||this.shape instanceof by||this.shape instanceof E0){let e=this.shape.shape(this.layer,this.clearance).closeEndpoint();for(let r of e.primitives){let i=r.stroke(this.clearance*2,wr.ROUND,ae.CCW).closeEndpoint();t.push(i)}}else if(this.shape instanceof Q0){let e=this.shape.shape(this.layer,this.clearance);for(let r of e.primitives){let i=r.stroke(this.clearance*2+this.shape.width,wr.ROUND,ae.CCW).closeEndpoint();t.push(i)}}else if(this.shape instanceof c1){let e=this.shape.shape(this.layer,this.clearance).closeEndpoint();t.push(e)}else if(this.shape instanceof Db){let e=this.shape.shape(this.layer,0).closeEndpoint();t.push(e)}return t.filter(e=>e)}};var SEe=class{constructor(){this._infos=new Array;this._backup=new Array;this.lines=new Array;this.sourceOutlines=new Array}add(t,e,r){let i=new uhe(t,e,r);this._infos.push(i)}backup(){this._backup=this._infos,this._infos=new Array}recover(){this._infos=this._backup,this._backup=new Array}clear(){this._infos.length=0;for(let t of this.lines)t.remove();this.lines.length=0}getInfos(){return Array.from(this._infos)}displayCollideInfo(){for(let t of this.lines)t.remove();this.lines.length=0;for(let t of this._infos){let e=t.getPolylines();for(let r of e)this.displayPolyline(r)}}displayPolyline(t){if(t!=null){let e=Bb(t.primitives,1002);for(let r of e)r.color=ee.WHITE,this.lines.push(r)}}displaySource(){for(let t of B2.sourceOutlines)B2.displayPolyline(t)}},B2=new SEe;var dhe=class{constructor(t,e){this.shapeBool=new Ec;this.mergeInstance=new XA(.1,.1);this.hasLockedItems=!1;this.selectCache=t,this.selectedItems=t.filter(r=>r.locked?(this.hasLockedItems=!0,!1):!(r instanceof ke)),this.groupCommand=e||new De("Execute Clip Polyline"),this.newPolygons=[],this.splitLineSubscribe=A.messageBus.subscribe("sendSplitLine",this.sendSplitLine.bind(this)),this.selectedItems&&A.publish("selecting",{items:this.selectedItems,triggerFrom:"COMMON"})}getSplitLine(){return this.polylines}sendSplitLine(t){if(!t||t.length==0)return;let e=t[0];if(t.some(i=>i.isEmpty))return;let r=t.flatMap(i=>i.getMathGraphics().primitives);this.polylines=r.map(i=>i.stroke(e.strokeWidth,wr.ROUND,ae.CW).asClose());for(let i of t)i.remove(),A.publish("delete",i)}handleSplitLine(){let t=this.shapeBool.normalizeData(this.polylines,3).items;t[0].items.length&&(this.polylines=t.flatMap(e=>e.items))}runSplit(){if(this.hasLockedItems&&A.publish("ui/toastMsg",{type:"error",msg:"The element is locked. Please unlock it and try again."},Q()),this.selectedItems=this.selectedItems.filter(r=>!r.isEmpty),this.selectedItems.length==0)return;let t=this.getFilteredItems(OEe),e=this.getFilteredItems(AEe);this.runBooleanItems(t),this.handleSplitLine(),this.runIntersectItems(e),A.publish("autoFill",""),A.publish("updateRtree",""),A.publish("updateFrame",""),A.publish("flushSelectingInfo",""),this.groupCommand.length>0&&(A.publish("selecting",{items:this.selectedItems,triggerFrom:"COMMON"}),qe.executeCommand(this.groupCommand)),this.clearCache()}getFilteredItems(t){return this.selectedItems.filter(t)}runBooleanItems(t){for(let e of t){if(e.isEmpty||this.polylines.every(a=>!e.buildBBox().intersection1(a.bbox())))continue;let r=e.getMathGraphics(),i;r instanceof ge?i=[r]:i=r.items;let n=this.shapeBool.getSubtraction(i,this.polylines);if(!["FPC Stiffener","Fill Region"].includes(e.type)&&n.some(a=>a.items.length>1)){A.publish("ui/toastMsg",{type:"error",msg:"Split failed, non-stiffener region and non-fill region doesn't support for internal split."},Q());continue}this.processClippedPolylines(n,e),this.newPolygons.length>0&&this.resetSelectedItems(this.newPolygons,e),this.newPolygons=[]}}resetSelectedItems(t,e){let r=this.selectedItems.indexOf(e);t.forEach((i,n)=>{r!==-1&&(n==0?this.selectedItems.splice(r,1,i):this.selectedItems.splice(r+n,0,i))}),this.selectedItems.forEach(i=>!i.isEmpty&&i.click())}runIntersectItems(t){let e=new Map;for(let r of t){if(r.isEmpty)continue;let i=this.clipWithIntersection(r);if(i){let{items:n,profileItems:s}=i;s&&s.forEach((a,l)=>{if(e.has(l)){let c=e.get(l)||[];e.set(l,[...c,...a])}else e.set(l,a)}),n.length>0&&r instanceof Ge&&this.resetSelectedItems(n,r)}}this.mergePolygon(e)}mergePolygon(t){if(t&&t.size>0)for(let[e,r]of t){let i=r.map(s=>s.getGroupID()).filter(Boolean),n=i.length>0?i[0]:null;this.mergeInstance.build(r,(s,a)=>{var l;if(qe.stack&&qe.stack.description=="merge polygon"&&(qe.stack.commands.forEach(c=>this.groupCommand.addCommand(c)),qe.stack=null),s.forEach(c=>{A.publish("delete",c),c.remove()}),r.length!==s.length&&r.filter(h=>!s.includes(h)).forEach(h=>{h instanceof lt&&a.push(h)}),this.resetSelectedItems(a,e),n){let c=(l=Ht.getItem(n))==null?void 0:l.name;Ht.joinCombination(a,n),a.forEach(h=>{h.setGroupID(n);let u=this.groupCommand.commands.find(d=>d.gId==h.globalIndex);u&&(u.groupId=n,u.groupName=c)})}})}}add2Command(t,e="add"){let r=Ce.dispatch(t,e);this.groupCommand.addCommand(r)}clipWithIntersection(t){if(this.polylines.every(n=>!t.buildBBox().intersection1(n.bbox())))return;let e;t instanceof Ge?e=[t.primitive]:t instanceof He&&(e=t.getMathGraphics().primitives);let r=!1,i=[];for(let n=0;n<e.length;n++){let s=e[n];if(!s.start().equals1(s.end())){let u=this.getPointRelation(s.start()),d=this.getPointRelation(s.end());if(u===1&&d===1||u===1&&d===2||u===2&&d===2){r=!0;continue}}let l=new Array;for(let u of this.polylines)this.findIntersections(s,u).forEach(p=>{l.push(p)});if(this.polylines[0].start().equals1(this.polylines[0].end())&&an(l,s),l.length===0){i.push(s);continue}let h=this.breakPrimitive(s,l);if(h.length>0){r=!0;for(let u of h)i.push(u)}}if(r){let n=new Array,s=new Map;if(t instanceof He){let a=new Mh;i.forEach(l=>{let c=a.create4Pt("Line",t.layerId,l,t.strokeWidth,t.net,!1);n.push(c)}),n.forEach(l=>{let c=s.get(t)||[];s.set(t,[...c,l])})}else t instanceof Ge&&i.forEach(a=>{if(a instanceof M){let l=pr.addTrack(t.layerId,a.start(),a.end(),t.width,!1,t.net);n.push(l)}else if(a instanceof q){let l=pr.addArcTrack(t.layerId,a.center,a.rx,zt.toRadians(a.startAngle),zt.toRadians(a.endAngle()),a.sweep(),t.width,!1,t.net);n.push(l)}});return this.adjustCombinationInfo(t,n),this.add2Command(t,"delete"),n.forEach(a=>this.add2Command(a)),t.remove(),A.publish("delete",t),{items:n,profileItems:s}}}breakPrimitive(t,e){let i=[],n=t.start(),s=t.end(),a=this.polylines.length>1,l=e.filter(h=>!this.equals(h,n,1e-6)&&!this.equals(h,s,1e-6)),c=h=>{let u=[];if(h instanceof M){let d=h.start().add(h.end()).mul(.5);u.push(h.start(),h.end(),d)}else if(h instanceof q){let d=h.pointOn(h.startAngle+h.sweepAngle/2);u.push(d)}if(a){let d=this.polylines[0],p=u[u.length-1];return this.pip(p,d)&&!this.polylines.slice(1).some(m=>this.pip(p,m))}else return u.every(d=>this.polylines.every(p=>this.pip(d,p)))};if(t instanceof q&&t.sweepAngle===360)for(let h=0;h<l.length;h++){let u=(h+1)%l.length,d=q.build4(l[h],l[u],t.center,t.rx,t.ry,t.sweep());d&&!c(d)&&i.push(d)}else{let h=n;for(let d of l){let p;t instanceof M?p=new M(h,d):t instanceof q&&(p=q.build4(h,d,t.center,t.rx,t.ry,t.sweep())),p&&!c(p)&&i.push(p),h=d}let u;t instanceof M?u=new M(h,s):t instanceof q&&(u=q.build4(h,s,t.center,t.rx,t.ry,t.sweep())),u&&!c(u)&&i.push(u)}return i}equals(t,e,r){return t.distance2(e)<r}pip(t,e){return jr.inPolyline(t,e,void 0,void 0,.001)}getPointRelation(t){for(let e of this.polylines){let r=jr.inEdge4Polyline(t,e),i=this.pip(t,e);return r?1:i?2:3}}findIntersections(t,e){let r=t.end(),i=t.bbox(),n=new Ta;n.add(r);for(let a of e.primitives){let l=a.bbox();if(!i.isIntersect(l))continue;let c=Pt(t,a);for(let h=0;h<c;h+=2){let u=new S(Ee[h],Ee[h+1]);n.add(u)}}let s=this.sortInters(n,t);if(s.length>0)return s.filter(a=>!a.equals1(r))}sortInters(t,e){let r=t.iterator(),i=new Array;for(;r.hasNext();){let n=r.next();i.push(n)}return an(i,e)}getCopper(){return[...Kt.getAllItem(),...Xt.getAllItem(),...pt.getAllItem()].filter(e=>e.type=="Copper Region")}adjustCopperInfo(t){if(t.type!=="Copper Region"||this.newPolygons.length==0)return;this.newPolygons.sort((n,s)=>{let a=n.buildBBox().area();return s.buildBBox().area()-a});let e=this.newPolygons[0],r=t.getComponent();Ti.nameManager.deleteNum(r.name),e.component.name=r.name,e.component.order=r.order,Ti.nameManager.add(r.name);let i=this.getCopper().filter(n=>!(n instanceof lt&&this.newPolygons.includes(n))).map(n=>n.component.name);un.insertAfter(this.newPolygons.slice(1),e,this.groupCommand),this.newPolygons.slice(1).forEach((n,s)=>{let a=`${r.name}-${s+1}`,l=s+1;for(;i.includes(a);)l++,a=`${r.name}-${l}`;n.component.name=a,i.push(a),Ti.nameManager.add(a)})}adjustCombinationInfo(t,e){let r=c=>c instanceof mt?{id:c.getParent().getGroupID(),globalIndex:c.getParent().globalIndex,number:c.getParent().number}:{id:c.getGroupID(),globalIndex:c.globalIndex,number:c.number},{id:i,globalIndex:n,number:s}=r(t);if(i==null)return;let a=Ht.getItem(i),l=a.getItems();if(e.length===0&&l.length>=1){let c=a.name;tC.addObj(n,s),tC.addGroup(i,c),tC.execute()}Ht.joinCombination(e.filter(c=>c!==t),i),e.length===0&&l.length<=1&&(this.add2Command(a,"delete"),setTimeout(()=>{A.publish("delete",a)},10))}processClippedPolylines(t,e){let r=new Mh;this.add2Command(e,"modify"),t.forEach(i=>{let n=r.create4PlGrp(e.type,e.layerId,i,e.strokeWidth,e.net,!1);if(["FPC Stiffener","Fill Region","3D Shell - Side Slot Region"].includes(e.type)){let s=JSON.stringify(e.getComponent());new bl(s,n.type).rebuildComponent(n)}this.newPolygons.push(n)}),this.adjustCopperInfo(e),this.adjustCombinationInfo(e,this.newPolygons),this.newPolygons.forEach(i=>this.add2Command(i)),this.add2Command(e,"delete"),e.remove(),A.publish("delete",e),e instanceof lt&&e.keepOutline(),A.publish("hasModifyPcbItem",e)}clearCache(){this.polylines=null,this.groupCommand=new De("Execute Clip Polyline")}clearView(){B2.clear(),[...this.selectedItems,...this.selectCache].forEach(t=>!t.isEmpty&&t.visible())}clearSubscribe(){this.splitLineSubscribe.cancel()}};function OEe(o){return["Fill Region","FPC Stiffener","Copper Region","Slot Region","Prohibited Region","3D Shell - Side Slot Region","3D Shell - Top Slot Region","3D Shell - Side Entity","3D Shell - Top/Bottom Entity"].includes(o.type)}function AEe(o){if(o instanceof Ge)return!0;if(o instanceof He)return["Line","Board Outline"].includes(o.type);let t=o.getParent();return t instanceof He?["Line","Board Outline"].includes(t.type):!1}var qYe=new Set(["Board Outline","Copper Region","Fill Region","Slot Region","Prohibited Region","FPC Stiffener","Constraint Region"]),phe=new Set(["Fill Region","FPC Stiffener"]);function fhe(o,t,e,r,i,n){let s=!1,a=!1,l=new bT;for(let G of o)if(!s&&!(G instanceof Gi||G instanceof mn)&&(s=!0),!a&&!l.isUnique(G)&&(a=!0),s&&a)break;let c=a,h=s,u=o.length>1,d=t.length>0,p=!1,m=jt.getPick(8),g=0,y=new Array,b=o.length>0,P=!1,T=!1,I=0,C={},E={},O=0,_=0;for(let G of o)if(G instanceof Le)g++,p=m&&!0,b=!1,P=P||G.getParent()==null,T=T||G.getParent()==null;else if(G instanceof Ue)p=m&&!0,b=!1,T=!0;else if(G instanceof Ge)p=m&&!0,P=!0,T=!0,_++;else if(G instanceof He)p=m&&!0,P=!0,T=!0,y.push(G),I<2&&!oq(G)&&I++,G.getParent()==null&&qYe.has(G.type)&&(C[G.type+G.layerId]?C[G.type+G.layerId]+=1:C[G.type+G.layerId]=1),phe.has(G.type)&&(E[G.type+G.layerId]?E[G.type+G.layerId]+=1:E[G.type+G.layerId]=1),G instanceof lt&&phe.has(G.type)&&G.isComplexPolygon()&&O++;else if(G instanceof Qp)p=m&&!0,b=!1,T=!0;else if(G instanceof mt||G instanceof _t){if(p=m&&!0,P=!0,T=!0,G instanceof mt||G instanceof _t){let Y=G.getParent();Y instanceof He&&(y.push(Y),I<2&&!oq(Y)&&I++,Y.getParent()==null&&qYe.has(Y.type)&&(C[Y.type+Y.layerId]?C[Y.type+Y.layerId]+=1:C[Y.type+Y.layerId]=1),phe.has(Y.type)&&(E[Y.type+Y.layerId]?E[Y.type+Y.layerId]+=1:E[Y.type+Y.layerId]=1),Y instanceof lt&&phe.has(Y.type)&&Y.isComplexPolygon()&&O++)}}else p=p||m&&Ao(G)!=null,b=!1,G instanceof mn||G instanceof hh||(P=!0,T=!0);let x=_==o.length,v=g>0,D=t.length==o.length&&t.length>0,w=t.length==o.length&&t.length==2;i=i&&t.length!==o.length;let F=y.length>0,H=F&&B6.filterD3Shell(y).length===0,z=I>=2,V=Object.values(C).some(G=>G>=2)||g>=2,W=Object.values(E).some(G=>G>=2),L=O>0,k=Jvt(o),N=Qvt(o),U=y.some(G=>OEe(G))||o.some(G=>AEe(G)),B=y.some(G=>G.type=="Line");return{hasSelected:s,rotate:c,canCopy:a,flipMenu:h,hasMoreThanOneSelected:u,hasSelectedDevice:d,hasSelectedPad:v,hasSelectedNet:p,onlyAbstractProfile:b,canDupToOtherLayer:P,canDupToCursor:T,onlyDevice:D,twoDevice:w,joinGroup:e,ungroupSelected:r,route:n,flip:i,has2DLine:F,canDispersedLine:H,hasMultiUnCloseLine:z,canIntersectionAggregate:V,canSubtractionExclusive:W,canBooleanSplit:L,canSplit:U,canCutout:k,hasPoly2DLine:B,canConvert2dLine:x||F,hasBoard:!!us.getInstance().board,canAvoidSlotsOrPads:N}}function Jvt(o=ze.getSelects()){if(!o.length)return!1;let t=o.every(a=>((a instanceof mt||a instanceof _t)&&(a=a.getParent()),a instanceof He&&a.type=="Copper Region")),e=o.every(a=>a instanceof Gi),r=o.every(a=>((a instanceof mt||a instanceof _t)&&(a=a.getParent()),a instanceof He&&a.type=="Fill Region")),i=o.every(a=>((a instanceof mt||a instanceof _t)&&(a=a.getParent()),a instanceof He&&a.type=="FPC Stiffener")),n=o.every(a=>a instanceof Ge);return t||e||r||i||n}function Qvt(o){return o||(o=ze.getSelects()),o.length==0?!1:W3e(o).length>0}var _Ee=class{getCrossProbeData(t=ze.getItems()){let e={pad:[],component:[],designator:[]};return jt.getPick(8)&&(e.nets=[]),t.length&&(t=t.filter(r=>{if(e.nets){let i=Ao(r);i&&!e.nets.includes(i)&&e.nets.push(i)}return r instanceof Le||r instanceof ke}),Hn(t,(r,i)=>{if(i instanceof Le){let n=i.getParent();if(n!=null&&n instanceof ke){let s=n.attrKeyValue["Unique ID"],a=n.attrKeyValue.Designator;(s||a)&&e.pad.push({groupUniqueId:s,padNum:i.num,groupDesignator:a})}}i instanceof ke&&(i.attrKeyValue["Unique ID"]&&e.component.push(i.attrKeyValue["Unique ID"]),i.attrKeyValue.Designator&&e.designator.push(i.attrKeyValue.Designator))})),e}notifySchToCrossProbe(t=!1){he.messageBus.rpcCall("getPcbCrossProbeToSchData").then(e=>{let{rule:r,hasSelected:i}=e.message,n={isManualTrigger:!0,isCrossProbeTool:t};he.windowBridge.publish("cross-window",{selectObj:r,otherData:n,cmd:"crossProbeBetweenWindows"},Q())})}},pD=new _Ee;var mhe=class{constructor(t){let e=t.filter(r=>this.validItems(r));this.selectItems=new Set(t),this.backspaceItems=new Set(e),this.deleteItems=new Set}validItems(t){return t instanceof Ge||t instanceof Ue}backspace(t){let e=this.filter=new Set,r=Array.from(this.backspaceItems);this.backspaceItems=new Set,r.forEach(i=>{e.has(i.globalIndex)||this.backspaceItem(i)}),this.deleteItem(t),this.completeOneBack()}completeOneBack(){this.filter=new Set,this.deleteItems=new Set}getSelectItem(){let t=new Set;return this.backspaceItems.forEach(e=>{t.add(e)}),this.selectItems.forEach(e=>{e.isEmpty||t.add(e)}),t}deleteItem(t){this.deleteItems.forEach(e=>{t.addCommand(Ce.dispatch(e,"delete")),e.remove(),he.publish("delete",e),he.publish("hasModifyPcbItem",e)})}backspaceItem(t){t instanceof Ge?this.backsSpaceTrack(t):t instanceof Ue&&this.backSpaceVia(t)}backsSpaceTrack(t){var a,l,c;let e=At.getInstance().getNode(t.model);e||(new su(t.model).generateList(),e=At.getInstance().getNode(t.model));let r=e.parent,i=new Jt,n=!0,s=!0;if(r.viaNode.prev&&r.viaNode.prev==r.viaNode.next||r.otherNode.prev&&r.otherNode.prev==r.otherNode.next){let h=((a=r.viaNode.next)==null?void 0:a.item)||r.otherNode.next,u=r.getFirst().start.distance2(h.center),d=r.getLast().end.distance2(h.center);ne.eq(u,d)||(ne.less(u,d)?s=!1:n=!1)}if(e.next==null&&(!s||!this.validEnd(r.endType))&&(e.prev||this.validEnd(r.startType))){this.addFilterData(t),r.pop(),this.deleteItems.add(t);let h=r.getLastNode(),u=(h==null?void 0:h.item)||((l=r.viaNode.prev)==null?void 0:l.item)||r.otherNode.prev;if(u){let d=i.getItem(u.globalIndex);this.backspaceItems.add(d)}}else if(e.prev==null&&(!s||!this.validEnd(r.startType))&&(e.next||this.validEnd(r.endType))){this.addFilterData(t),r.shift(),this.deleteItems.add(t);let h=r.getFirstNode(),u=(h==null?void 0:h.item)||((c=r.viaNode.next)==null?void 0:c.item)||r.otherNode.next;if(u){let d=i.getItem(u.globalIndex);this.backspaceItems.add(d)}}}addFilterData(t){let r=At.getInstance().getNode(t.model).parent;if(r.getAllItems().forEach(i=>{this.filter.add(i.globalIndex)}),r.viaNode.prev){let i=r.viaNode.prev.item;this.filter.add(i.globalIndex)}if(r.viaNode.next){let i=r.viaNode.next.item;this.filter.add(i.globalIndex)}}validEnd(t){return t==1||t==2}backSpaceVia(t){var r,i;let e=t.searchCycleNodeTrack().filter(n=>n instanceof Ge);if(e.length==1){this.deleteItems.add(t);let n=e[0];this.backspaceItems.add(n);let s=At.getInstance().getNode(n.model);if(s){let a=s.parent;((r=a.viaNode.prev)==null?void 0:r.item)==t.model?a.viaNode.prev==null:((i=a.viaNode.next)==null?void 0:i.item)==t.model&&a.viaNode.next==null}}}complete(){At.getInstance().clear(),Si.getInstance().clear()}};var $Ye={0:"ns-resize",1:"ew-resize",2:"nesw-resize",3:"nwse-resize",5:"move"};var vEe=class{switch(t){if(t===4){QA.style.removeProperty("cursor"),document.documentElement.style.removeProperty("cursor");return}zu($Ye[t])}switchByPointType(t,e=0){let r=[3,1,2,0],i=Math.floor((e+zh/8)%kr/(zh/4)%4);switch(t){case 3:return this.switch(r[i]);case 0:return this.switch(r[(i+3)%4]);case 1:return this.switch(r[(i+1)%4]);case 2:return this.switch(r[(i+2)%4])}}},xEe=new vEe;var Cs=class{constructor(){this.mouseLeftDown=!1;this.moveStartPoint=null;this.lastPosition=S.ORIGIN;this.shiftMoveHelpLine=null}onMouseUpMove(t){return!1}onKeyDown(t){return!1}onMouseRightDown(t){return!1}onMouseRightUp(t){return!1}onDoubleClick(t){return!1}parse(t){}changleMouseStyle(t){zu(t)}changeNativeCursor(t){QA.style.cursor!=="grabbing"&&xEe.switch(t)}changeNativeCursor1(t,e){xEe.switchByPointType(t,e)}rotate(t){}createShiftMoveHelpLine(t,e){this.shiftMoveHelpLine?this.shiftMoveHelpLine.end=e:this.shiftMoveHelpLine=new cr(1002,t,e,!0)}removeShiftMoveHelpLine(){this.shiftMoveHelpLine&&(this.shiftMoveHelpLine.remove(),this.shiftMoveHelpLine=null)}shiftControl(t){this.moveStartPoint===null&&(this.moveStartPoint=new S(t.lastSceneX,t.lastSceneY),this.lastPosition=this.moveStartPoint);let e=new S(t.sceneX,t.sceneY),r=e.sub(this.lastPosition);if(t.shiftKey){let i=e.sub(this.moveStartPoint),n;Math.abs(i.x)>=Math.abs(i.y)?(n=new S(t.sceneX,this.moveStartPoint.y),r=n.sub(this.lastPosition)):(n=new S(this.moveStartPoint.x,t.sceneY),r=n.sub(this.lastPosition)),this.createShiftMoveHelpLine(this.moveStartPoint,n)}else this.shiftMoveHelpLine!=null&&this.removeShiftMoveHelpLine();return this.lastPosition=this.lastPosition.add(r),r}};var ghe=class extends sF{constructor(e,r,i,n,s,a=new Set){super(r,i,n,a);this.layerMap=new Map;this.via=e,this.constraintPoint=new Cg(this.via,s,S.ORIGIN,!0);let l=Si.getInstance().getViaNode(this.via);this.directFilter=n,this.directFilter.awaitShove.has(l)&&(this.directFilter.awaitShove.delete(l),this.directFilter.awaitingVias.add(l))}get net(){return this.via.net}closeShapeOnlyDrc(e){if(e.layerId==11){for(let[,r]of this.layerMap)if(r)return!1;return!0}else return e.layerId==1004?!1:e.layerId!=12&&!this.layerMap.get(e.layerId)}getPoint(){return this.constraintPoint.point}onlyDrc(e){return this.layerMap.get(e.layerId)?this.isWire?this.isInput(e):!1:!0}trackCheck(e,r,i,n){let s=ps.getInstance().getFirstPosition(this.via),a=this.block.blockTrackOnlyTrack(e,r?new M(this.constraintPoint.point,s||e.start):new M(s||e.end,this.constraintPoint.point),!0),l=this.constraintPoint.parentMap.get(e.layerId);if(l==null&&(l=new Cg(this.via,s,S.ORIGIN,!0),this.constraintPoint.setParent(e.layerId,l)),a.length>0)for(let c of a){let h=c.obstacle;if(!c.isSameNet&&h instanceof gt){let d=At.getInstance().getListNode(h).parent;if(this.obstacles.has(d))continue;return this.addObstacle(d),i.set(n,a),!0}}return!1}init(){let e=0,r=Si.getInstance().getViaNode(this.via),i=new Map;for(let[c,h]of r.connectTrack)if(h){let d=c.getLastNode().item;if(this.trackCheck(d,h,i,c))break}else{let d=c.getFirstNode().item;if(this.trackCheck(d,h,i,c))break}let n=Ze.getInstance().getAllCopperLayerIds(),s=ps.getInstance().getFirstPosition(this.via);for(let c of n)if(this.constraintPoint.parentMap.get(c)==null){this.layerMap.set(c,!1);let h=new Cg(this.via,s,S.ORIGIN,!0);this.constraintPoint.setParent(c,h)}else this.layerMap.set(c,!0);let a=!1,l=new Ta;do{a=!1;for(let[c]of r.connectTrack){let h=i.get(c);if(h!=null)for(let u of h){let d=u.obstacle;new LI(d,this.onlyDrc(d)).constraint(this.constraintPoint)&&!l.contains(this.constraintPoint.point)&&(a=!0,l.add(this.constraintPoint.point),this.constraintPoint.setConstraintObstacle(d))}}e++}while(a&&e<20)}getSize(){return Math.max(this.via.radius,this.via.holeRadius)}};function REe(o){let t=new Set,e=new Set;for(let r of o){let i=n=>{t.has(n)?e.add(n):t.add(n)};if(r.viaNode){let n=r.viaNode.next,s=r.viaNode.prev;n&&i(n),s&&i(s)}}return Array.from(e)}function txt(o,t){for(let[e,r]of o.connectTrack)en.lockedMap.set(e,!r),t&&t.push(e)}function aE(o,t,e,r=!1,i){let n=new IS;if(o.every(s=>s instanceof Ue)){let s=[];return o.forEach(a=>{let l=a.model,c=Si.getInstance().getNode(l);if(c==null){let h=new EI(l);h.generateList(),c=h.viaNode}if(c.isSource){i==null||i.set(a,c);let h=n.cloneVia(l,t),u=new a6(c,c.item,h);Si.getInstance().replace(l,h),t.addCommand(u),c.isSource=!1}r&&c.connectTrack.size>0?txt(c,s):s.push(c)}),s}else{if(o.every(s=>s instanceof Ge))return[];{let{tracks:s,vias:a}=o.reduce((u,d)=>(d instanceof Ge?u.tracks.push(d):d instanceof Ue&&u.vias.push(d),u),{tracks:[],vias:[]}),l=[];s.forEach(u=>{let d=At.getInstance().getListNode(u.model);if(d&&d.parent){let p=d.parent;l.includes(p)||l.push(p)}});let c=u=>{let d=a.map(p=>p.model.globalIndex).findIndex(p=>p==u.item.globalIndex);d!==-1&&(Pq(u.item,t),u.isSource=!1,e==null||e.set(u,!0),i==null||i.set(a[d],u))},h=REe(l);h.forEach(u=>{c(u)});for(let u=0;u<l.length;u++){let d=l[u];if(d.viaNode.next||d.viaNode.prev){let m=d.viaNode.next,g=d.viaNode.prev;m&&!h.includes(m)&&c(m),g&&!h.includes(g)&&c(g)}}return a.forEach(u=>{let d=u.model;if(Si.getInstance().getNode(d)==null){let m=new EI(d);if(!m.starts.length&&!m.ends.length){let g=m.viaNode;c(g),l.push(g)}}}),l}}}function yhe(o){if(le.pcbConfig.isPlaceViasAutoShove){let{newIds:t}=Mi.getInstance().complete(o);return t}}function lE(){le.pcbConfig.isPlaceViasAutoShove&&(Nl.getInstance().clear(),Mi.getInstance().clear(),Ml.getInstance().deleteAll(),oi.getInstance().clear(),At.getInstance().clear(),Si.getInstance().clear(),Cr.getInstance().clear(),$l.getInstance().clear())}function bhe(){en.clear(),Mr.getInstance().clear(),Cr.getInstance().clear(),pa.getInstance().clear(),ps.getInstance().clear(),fs.getInstance().clear()}function Pq(o,t,e){let r=Si.getInstance().getNode(o),n=new IS().cloneVia(o,t);e instanceof Function&&(n=e(n));let s=new a6(r,r.item,n);Si.getInstance().replace(r.item,n),t.addCommand(s)}function DEe(o,t,e,r=!1,i,n){let s=new Zr,a=s.createList(),l=t,c=new Map;if(l.forEach(h=>{let u;if(h instanceof zr?u=s.createTrack(h.layerId,h.start,h.end,h.width,h.showNet,e,h.getGroupID()):h instanceof Ii&&(u=s.createArcTrack(h.layerId,h.center,h.radius,h.startAngle,h.endAngle,h.sweep,h.width,h.net,e,void 0,h.getGroupID())),n instanceof Function&&(u=n(u)),i){let d=Array.from(i).find(p=>p.globalIndex==h.globalIndex);c.set(d,u)}s.addList(u,a,e),r&&Cr.getInstance().current.setTrackSelect(u.globalIndex)}),o.getFirstNode()&&o.getLastNode()&&a.replace(o.getFirstNode(),o.getLastNode(),o),e.addCommand(new mi(a)),i)return c}function ZYe(o){if(!o.every(e=>e instanceof Ge||e instanceof Ue))return!1;let t=o.filter(e=>e instanceof Ue);return!(t.length>20||!Vie(t.map(e=>e.center),78.65))}function rxt(o){var t,e;for(let r of o)if(r instanceof Fn){let i=((t=r.viaNode.prev)==null?void 0:t.isSource)==!1,n=((e=r.viaNode.next)==null?void 0:e.isSource)==!1;i&&Mr.getInstance().addInputStatus(r.getFirstNode()),n&&Mr.getInstance().addInputStatus(r.getLastNode())}else Mr.getInstance().addInputStatus(r)}function Phe(o,t,e){let r=t.item.center,i=Ae.translate(o.x,o.y,0);Pq(t.item,e,n=>(n.transform(i),n)),t.isSource=!1,ps.getInstance().changeViaPosition(t.item,r)}function ixt(o){return["WIRING_MODE_PUSHAWAY"].includes(o)}function The(o,t){if(this.shoveData&&this.shoveData.length>0){let e=o.sub(t),r=Zt.getInstance().mode,i=ixt(r);if(r!=="WIRING_MODE_IGNORE"){i&&(wt.setPushFilter(),this.canPushViaLevel==0?wt.pushFilter.setSolidViaFilterMode(!this.hugPrefered):wt.pushFilter.setSolidFilterMode(!this.hugPrefered));let n=this.via.center.add(e),s=new ghe(this.node.item,performance.now()+20,!1,new N3,n);s.offset(),e=e.add(s.getPoint().sub(n)),i&&(wt.filter=null)}return e}return o.sub(t)}function QV(o){o.remove(),pt.delete(o)}function zS(o,t,e=!1,r){let i=Zt.getInstance().mode;if(["WIRING_MODE_SURROUND_AND_PUSHAWAY","WIRING_MODE_SURROUND","WIRING_MODE_OBSTRUCT"].includes(i)&&e)return;let n=Ys.getInstance(),s=o.filter(c=>c instanceof Fn),a;if(o.length&&s.length==o.length){let c=s.map(h=>{var d;let u=h.getFirstNode().item;if(u instanceof gt)return(d=Et(u.primitive))==null?void 0:d.mul(-1).normalize()}).filter(Boolean);a=z4(c)}switch(i){case"WIRING_MODE_IGNORE":break;case"WIRING_MODE_OBSTRUCT":case"WIRING_MODE_SURROUND":{let c=new By;try{rxt(o),c.run1(o,t,a)}catch(h){throw new Error(h)}break}case"WIRING_MODE_PUSHAWAY":case"WIRING_MODE_SURROUND_AND_PUSHAWAY":{let c=new km(i=="WIRING_MODE_SURROUND_AND_PUSHAWAY");switch(n.pushVia){case"OPTIMIZA_OPEN":{c.canPushViaLevel=2;break}case"OPTIMIZA_NONE":{c.canPushViaLevel=0;break}default:c.canPushViaLevel=2}switch(n.pathOptimization4BePushed){case 1:{c.level="SUPER";break}case 0:{c.level="STRONG";break}case 2:{c.level="WEAK";break}default:c.level="WEAK"}c.inputLevel="NONE";try{c.run1(o,t,a)}catch(h){throw new Error(h)}break}}let l=Mi.getInstance().view4Status(Cr.getInstance().current);t.addCommand(l),oi.getInstance().update(),r&&Nh.getInstance().showViaObstaclePl(r.item)}function qy(){return re.getInstance().getDefaultOtherSpacing().deviceClearance}function k0(o,t){let e={isColliding:!0},r=JYe(o),i=JYe(t),n=[],s=[].concat(r,i);for(let c of s){let{mid:h,direct:u}=c,d=new S(-u.y,u.x),p=QYe(o,h,d),m=QYe(t,h,d),g=wEe(p,h,d),y=wEe(m,h,d),b=nxt(g,y,h,d);if(b==null)return e.isColliding=!1,e;n.push(b)}n.sort((c,h)=>c[0].distance1(c[1])-h[0].distance1(h[1]));let a=n[0],l=a[0].sub(a[1]);return e.isColliding=!0,e.penetrationVector=l,console.log("\u78B0\u649E\u7684\u65B9\u5411",e.penetrationVector),e}function JYe(o){return[{mid:o.leftLow.add(o.leftUp).mul(.5),direct:o.leftLow.sub(o.leftUp).normalize()},{mid:o.rightLow.add(o.leftLow).mul(.5),direct:o.rightLow.sub(o.leftLow).normalize()},{mid:o.rightUp.add(o.rightLow).mul(.5),direct:o.rightUp.sub(o.rightLow).normalize()},{mid:o.leftUp.add(o.rightUp).mul(.5),direct:o.leftUp.sub(o.rightUp).normalize()}]}function QYe(o,t,e){let r=[o.leftLow,o.rightLow,o.rightUp,o.leftUp],i=[];return r.forEach(n=>{let s=n.sub(t).dot(e),a=t.add(e.mul(s));i.push(a)}),i}function wEe(o,t,e){return o.sort((r,i)=>{let n=e.dot(r.sub(t)),s=e.dot(i.sub(t));return n-s})}function nxt(o,t,e,r){let i=[].concat(o,t);wEe(i,e,r);let n=Number.MAX_VALUE,s=-1,a=Number.MAX_VALUE,l=-1;for(let c of o){let h=i.indexOf(c);h<n&&(n=h),h>s&&(s=h)}for(let c of t){let h=i.indexOf(c);h<a&&(a=h),h>l&&(l=h)}if(n>l||a>s)return null;if(n>a&&s<l){let c=i[l].sub(i[n]),h=i[a].sub(i[s]);return c.length()>h.length()?[i[a],i[s]]:[i[l],i[n]]}else if(a>n&&l<s){let c=i[a].sub(i[s]),h=i[l].sub(i[n]);return c.length()>h.length()?[i[l],i[n]]:[i[a],i[s]]}else{let c,h;return n>a?c=n:h=a,s<l?c=s:h=l,[i[h],i[c]]}}var rC={},fD={},Ihe=!0;function eje(o,t,e){let r=Array.from(Vr.rtreeSearchNotOutsideForComponent(o.layerId,o.getMathGraphics(o.layerId,t))).filter(i=>!e.some(n=>i.globalIndex===n.globalIndex));r&&r.forEach(i=>{let n=Object.keys(fD),s=n==null?void 0:n.reduce((a,l)=>a.length>l.length?a:l,"");Ihe=!s.includes(i.globalIndex),Ihe||(rC[s]={initBox:fD[s].initBox}),!rC[i.globalIndex]&&Ihe&&(rC[i.globalIndex]={initBox:i.model.box}),fD[i.globalIndex]||(fD[i.globalIndex]={initBox:i.model.box})})}function eG(o,t,e){console.log("movedMap",fD),console.log("blockMap",rC),console.log("components",e),rC={},fD={};let r={};eje(o,t,e);let i=Object.keys(rC);for(;i.length>0;){let n=i.shift(),s=rC[n],a=new bs(o.layerId,o.leftLow,o.leftUp,o.rightLow,o.rightUp,o.locked).extendOfSize(t);console.log("movedBox",a),console.log("components",e);let l=k0(s.initBox,a);if(l.isColliding){let c=Ae.translate(-l.penetrationVector.x,-l.penetrationVector.y,0),h=!1;e.forEach(u=>{k0(s.initBox,u.model.box).isColliding&&(h=!0)}),h&&(e.forEach(u=>{u.transform(c)}),o.transform(c),eje(o,t,e))}if(r[n]=(r[n]||0)+1,r[n]>1){let c=Object.keys(r),h=c.join(""),u=[];c.forEach(b=>{let P=fD[b].initBox,T=new bs(P.layerId,P.leftLow,P.leftUp,P.rightLow,P.rightUp,P.locked);u.push(T)});let d=new S(u[0].bbox.minX,u[0].bbox.minY),p=new S(u[0].bbox.maxX,u[0].bbox.maxY);u.forEach(b=>{d=new S(Math.min(d.x,b.bbox.minX),Math.min(d.y,b.bbox.minY)),p=new S(Math.max(p.x,b.bbox.maxX),Math.max(p.y,b.bbox.maxY))});let m=new S(d.x,p.y),g=new S(p.x,d.y),y=new bs(u[0].layerId,d,m,g,p,u[0].locked);rC={},fD[h]={initBox:y},rC[h]={initBox:y},r={},i=Object.keys(rC)}else Ihe=!0,delete rC[n],i=Object.keys(rC)}}var tG=class extends Cs{constructor(e,r){super();this.wireCommands=new Lr;this.shoveCommands=new Lr;this.addHistory=!0;this.items=new Set;this.repairTracks=new Set;this.associationItem=null;this.alreadyRotate=!1;this.revokeMove=!1;this.firstMove=!0;this.position=S.ORIGIN;this.moveViasMap=new Map;this.originViaMap=new Map;e.forEach(i=>{i instanceof mn||i instanceof Jr||i instanceof rr&&i.type=="Annotation"||(i instanceof Ue&&(this.via=i),this.items.add(i))}),this.position=this.via.center,this.fac=new hi,r?this.fac.addGroup(r):this.fac.createGroup("Batch move pcb item")}customSyncAssociation(e){this.associationItem=e}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;this.addHistory=!0;for(let s of this.items)if(s.isSelect(r,i))return!0;let n=Vr.pointSelect(r,i);if(n.length>0){let s=n[0];if(this.items.has(n[0]))return!0;if(s.getParent()!=null&&this.items.has(s.getParent()))return!0}return!1}init(){if(this.associationItem==null){this.associationItem=new Ya(this.items);let e=pt.getTears(this.via.globalIndex);if(e&&e.size>0)for(let r of e)this.fac.addCommand4Item(r,"delete"),QV(r)}if(this.addHistory){let e=this.associationItem.getAllItem(),r=Array.from(e).filter(i=>i instanceof Ue);this.shoveData=aE(r,this.wireCommands,void 0,!0),Nl.getInstance().init()}}fixMousePosition(e){this.moveStartPoint===null&&(this.moveStartPoint=new S(e.lastSceneX,e.lastSceneY),this.lastPosition=this.moveStartPoint);let r=new S(e.sceneX,e.sceneY);if(e.adsorbGrid&&(r=ai.adsorpGrid(r)),e.shiftKey){let i=r.sub(this.moveStartPoint);Math.abs(i.x)>=Math.abs(i.y)?r=new S(r.x,this.moveStartPoint.y):r=new S(this.moveStartPoint.x,r.y),this.createShiftMoveHelpLine(this.moveStartPoint,r)}else this.shiftMoveHelpLine!=null&&this.removeShiftMoveHelpLine();return r}getViaOffset(e){return The.bind(this,e,this.moveStartPoint)()}getTrackOffset(e){return e.sub(this.moveStartPoint)}undoShoveHistory(){var e,r,i;Np.needclearWireCache=!1,bhe(),(e=this.shoveCommands)==null||e.undo(),this.shoveCommands=new Lr,(r=this.associationItem.getRepairToolCommand())==null||r.undo(),this.associationItem.setRepairToolCommand(new Lr),(i=this.wireCommands)==null||i.undo(),this.wireCommands=new Lr}setConstraintLocks(){for(let[e,r]of this.node.connectTrack)en.lockedMap.set(e,!r)}movePathList(e){let r=this.associationItem.itemConnectTrack;if(r.tracks.size!==0){e=this.position.sub(this.lastPosition);let i=Ae.translate(e.x,e.y,0);this.alreadyRotate||this.associationItem.moveConnectTrack(i),this.items.forEach(n=>{!n.locked&&!r.tracks.has(n.globalIndex)&&!(n instanceof Ue)&&n.transform(i)})}else{let i=Ae.translate(e.x,e.y,0);for(let[n]of this.node.connectTrack){let s=n.getAllItems();if(s.length>0)return DEe(n,s,this.wireCommands,!1,Array.from(this.items),a=>(a.transform(i),a))}}}onMouseMove(e,r=null){this.addHistory&&(this.node=Si.getInstance().getViaNode(this.via.model),this.init());let i=this.fixMousePosition(e),n=this.getViaOffset(i);this.position=this.moveStartPoint.add(n);let s=this.getTrackOffset(this.position);gr.mouseAltDown&&!e.altKey&&(this.revokeMove=!0),this.associationItem==null&&(this.associationItem=new Ya(this.items)),this.associationItem.setUpConnectTrack();let a=new Set;for(let h of this.associationItem.items)a.add(h);let l=this.associationItem.getAllItem();if(this.addHistory)for(let h of l)a.has(h)&&!h.locked&&this.fac.addCommand4Item(h,"modify");this.firstMove&&(this.firstMove=!1),this.undoShoveHistory(),this.setConstraintLocks(),Phe(n,this.node,this.wireCommands),this.associationItem.setAllAssociationRatlinesVisible();let c=this.movePathList(s);if(zS(this.shoveData,this.shoveCommands,!1,this.node),this.shoveData&&(this.via.iteratorRatlines(h=>{h.startNode==this.via&&(h.start=this.node.item.center),h.endNode==this.via&&(h.end=this.node.item.center)}),c&&c.size>0)){for(let h of this.items)if(h instanceof Ge){let u=c.get(h);if(!u)continue;h.iteratorRatlines(d=>{d.startNode==h&&(d.start=u.start),d.endNode==h&&(d.end=u.end)})}}return this.revokeMove&&this.associationItem!=null&&this.associationItem.interrupt(),this.addHistory&&(this.addHistory=!1),this.changeNativeCursor(5),this.lastPosition=this.position,!0}onMouseUpMove(e){return this.setCursor(e),!1}removeConnectTrack(){this.node!=null&&(this.undoShoveHistory(),this.associationItem.itemConnectTrack.tracks.clear(),this.node.connectTrack.clear(),this.shoveData=[this.node],Mi.getInstance().view4Status(Cr.getInstance().current))}setCursor(e){for(let r of this.items)if(!r.isEmpty&&r.isSelect(e.sceneX,e.sceneY))return this.changeNativeCursor(5);this.changeNativeCursor(4)}onMouseLeftUp(e){return this.fac.getCommand().length>0&&(A.publish("isMoveSwitch",!0),this.associationItem.complete(this.fac.getCommand()),this.fac.checkOutlines(Array.from(this.associationItem.items),new Set),this.fac=new hi,this.fac.createGroup("Batch move pcb item"),this.wireCommands=new Lr,this.shoveCommands=new Lr,lE(),A.publish("autoFill",""),this.flushModify(),A.publish("isMoveSwitch",!1)),ze.highlightComponentWhenMoveText.clear(),this.associationItem=null,this.removeShiftMoveHelpLine(),A.publish("flushSelectingInfo",""),this.filterRemove(),this.revokeMove=!1,!0}rotate(e=le.pcbConfig.rotate){if(this.associationItem.itemConnectTrack.tracks.size===0&&this.shoveData.length>0){let r=new _e;if(this.items.forEach(i=>{r.ext1(i.buildBBox())}),this.alreadyRotate=!0,r.valid()){let n=r.build1().center(),s=Ae.rotateZForPoint(n,e),a=this.associationItem.getAllItem();for(let l of a)l.locked||this.fac.addCommand4Item(l,"modify");this.items.forEach(l=>{l.transform(s)}),this.onMouseMove(fi.getInstance()),this.addHistory&&(this.addHistory=!1)}}}transformShoveData(e){if(this.shoveData&&this.shoveData.length>0){let r=this.shoveData.filter(s=>s instanceof Fn),i=[];for(let s of this.shoveData)if(s instanceof as)s.connectTrack.size==0&&i.push(s);else{let a=s.getAllItems();a.length>0&&DEe(s,a,this.shoveCommands,!1),s.viaNode.prev!=null&&i.push(s.viaNode.prev),s.viaNode.next!=null&&i.push(s.viaNode.next)}let n=REe(r);i.forEach(s=>{let a=!0;this.moveViasMap.size>0&&(a=this.moveViasMap.get(s)),!n.includes(s)&&a&&(Pq(s.item,this.shoveCommands,l=>(l.transform(e),l)),ps.getInstance().changeViaPosition(s.item,this.moveStartPoint),s.isSource=!1)}),n.length&&n.forEach(s=>{s instanceof as&&(Pq(s.item,this.shoveCommands,a=>(a.transform(e),a)),ps.getInstance().changeViaPosition(s.item,this.moveStartPoint),s.isSource=!1)}),zS(this.shoveData,this.shoveCommands),this.originViaMap.size>0&&this.associationItem.getAllItem().forEach(a=>{if(a instanceof Ue){let l=this.originViaMap.get(a).item;a.iteratorRatlines(c=>{c.startNode==a&&(c.start=l.center),c.endNode==a&&(c.end=l.center)})}})}}interrupt(){var e,r,i;return(e=this.fac.getCommand())==null||e.undo(),(r=this.shoveCommands)==null||r.undo(),(i=this.wireCommands)==null||i.undo(),Mi.getInstance().view4Status(Cr.getInstance().current),Nh.getInstance().clear(),this.associationItem!=null&&(this.associationItem.interrupt(),this.associationItem=null),this.items.clear(),this.changeNativeCursor(4),this.removeShiftMoveHelpLine(),!0}filterRemove(){let e=new Set;this.items.forEach(r=>{r.isEmpty||e.add(r)}),this.items=e}flushModify(){let e=new Ya(this.items),r=e.items;for(let n of r)if(n instanceof Ge)A.publish("hasModifyPcbItem",n);else if(n instanceof Le){let s=n.getParent();s!=null&&s instanceof ke?A.publish("hasModifyPcbItem",s):A.publish("hasModifyPcbItem",n)}else n instanceof Ue?A.publish("hasModifyPcbItem",n):n instanceof Mn?A.publish("hasModifyPcbItem",n):n instanceof lr?A.publish("hasModifyPcbItem",n):n instanceof He?A.publish("hasModifyPcbItem",n):n instanceof ke?A.publish("hasModifyPcbItem",n):n instanceof ua&&A.publish("hasModifyPcbItem",n);e.getAllRepairTracks().forEach(n=>{A.publish("hasModifyPcbItem",n)})}};var wd=class o{constructor(){this.highlighted=!1}static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}highlight(t){if(le.hightShowConfig.dragDarked){this.highlighted&&this.unhighlight();let e=new Set,r=!1;t.forEach(i=>{i instanceof Ge||i instanceof Le||i instanceof Ue?(r=!0,e.add(i.net)):i instanceof ke&&(r=!0,i.getPads().forEach(n=>{e.add(n.net)}))}),r&&(this.highlightedItems=t,Ye.dragHighlightNets(Array.from(e)),this.highlighted=!0,t.forEach(i=>{i.manualHighLight=!0}))}}unhighlight(){if(le.hightShowConfig.dragDarked&&R.getInstance().forceDeactive&&this.highlighted){let t=this.highlightedItems||[];this.highlighted=!1,t.forEach(e=>{e.manualHighLight=!1}),this.highlightedItems=null,Ye.dragUnhighlightNet()}}};var LEe=class o{constructor(){this.movedMap={};this.blockMap={};this.shouldAdd=!0}static getInstance(){return o.instance||(o.instance=new o),o.instance}initAllMap(){this.movedMap={},this.blockMap={}}setShouldAdd(t){this.shouldAdd=t}getShouldAdd(){return this.shouldAdd}addMovedMap(t,e){this.movedMap[t]={initBox:e}}getMovedMap(t){return this.movedMap[t]}getMovedMapKeys(){return Object.keys(this.movedMap)}removeMovedMap(t){delete this.movedMap[t]}addBlockMap(t,e){this.blockMap[t]={initBox:e}}getBlockMap(t){return this.blockMap[t]}getBlockMapKeys(){return Object.keys(this.blockMap)}removeBlockMap(t){delete this.blockMap[t]}clearBlockMap(){this.blockMap={}}},ya=LEe.getInstance();function tje(o,t,e){let r=Array.from(Vr.rtreeSearchNotOutsideForComponent(o.layerId,o.getMathGraphics(o.layerId,t))).filter(i=>!e.some(n=>`${Tr}${i.number}`==`${Tr}${n.number}`));r&&r.forEach(i=>{let n=`${Tr}${i.number}`,s=ya.getMovedMapKeys(),a=s==null?void 0:s.reduce((l,c)=>l.length>c.length?l:c,"");if(ya.setShouldAdd(!a.includes(n)),!ya.getShouldAdd()){let l=ya.getMovedMap(a).initBox;ya.addBlockMap(a,l)}!ya.getBlockMap(n)&&ya.getShouldAdd()&&ya.addBlockMap(n,i.model.box),ya.getMovedMap(n)||ya.addMovedMap(n,i.model.box)})}function rje(o,t,e,r){console.log("components",e),ya.initAllMap();let i={};tje(o,t,e);let n=ya.getBlockMapKeys();for(;n.length>0;){let s=n.shift(),a=ya.getBlockMap(s),l=new bs(o.layerId,o.leftLow,o.leftUp,o.rightLow,o.rightUp,o.locked).extendOfSize(t);console.log("movedBox",l),console.log("components",e);let c=k0(a.initBox,l);if(c.isColliding){let h=Ae.translate(-c.penetrationVector.x,-c.penetrationVector.y,0),u=!1;e.forEach(d=>{k0(a.initBox,d.model.box).isColliding&&(u=!0)}),u&&(e.forEach(d=>{d.transform(h)}),o.transform(h),tje(o,t,e))}if(i[s]=(i[s]||0)+1,i[s]>1){let h=Object.keys(i),u=h.join(""),d=[];h.forEach(P=>{let T=ya.getMovedMap(P).initBox,I=new bs(T.layerId,T.leftLow,T.leftUp,T.rightLow,T.rightUp,T.locked);(I.locked||!r)&&d.push(I)});let p=new S(d[0].bbox.minX,d[0].bbox.minY),m=new S(d[0].bbox.maxX,d[0].bbox.maxY);d.forEach(P=>{p=new S(Math.min(p.x,P.bbox.minX),Math.min(p.y,P.bbox.minY)),m=new S(Math.max(m.x,P.bbox.maxX),Math.max(m.y,P.bbox.maxY))});let g=new S(p.x,m.y),y=new S(m.x,p.y),b=new bs(d[0].layerId,p,g,y,m,d[0].locked);ya.clearBlockMap(),ya.addMovedMap(u,b),ya.addBlockMap(u,b),i={},n=ya.getBlockMapKeys()}else ya,ya.setShouldAdd(!0),ya.removeBlockMap(s),n=ya.getBlockMapKeys()}}var MEe=class o{constructor(){this.moveMap={};this.pushIdMap={};this.lockMap={};this.collisionCountMap={};this.combinedMap={};this.filterComponentIds=[];this.orderNumber=0;this.multiComponentUniqueId=`${Tr}99999`}static getInstance(){return o.instance||(o.instance=new o),o.instance}initAllMap(){this.moveMap={},this.pushIdMap={},this.lockMap={},this.combinedMap={},this.collisionCountMap={},this.filterComponentIds=[]}setOrderNumber(t){this.orderNumber=t}addOrderNumber(){return this.orderNumber++,this.orderNumber}getOrderNumber(){return this.orderNumber}setFilterComponentIds(t){this.filterComponentIds=t}addFilterComponentIds(t){this.filterComponentIds=[...new Set([...this.filterComponentIds,...t])]}getFilterComponentIds(){return this.filterComponentIds}getMultiComponentUniqueId(){return this.multiComponentUniqueId}addMoveMap(t,e,r){this.moveMap[t]={component:e,order:r}}getMoveMap(t){return this.moveMap[t]}removeMoveMap(t){delete this.moveMap[t]}addPushIdMap(t,e,r){this.pushIdMap[t]={moveId:e,pushIds:r}}getPushIdMap(t){return this.pushIdMap[t]}getPushIdMapKeys(){return Object.keys(this.pushIdMap)}removePushIdMap(t){delete this.pushIdMap[t]}addLockMap(t,e,r){this.lockMap[t]||(this.lockMap[t]={}),this.lockMap[t].hasOwnProperty(r)||(this.lockMap[t][r]={lockedBox:e})}getLockMap(t){return this.lockMap[t]}getLockCombinedBox(t,e){let r=e instanceof ke?new S(e.model.buildBBox().minX,e.model.buildBBox().minY):e.leftLow,i=e instanceof ke?new S(e.model.buildBBox().maxX,e.model.buildBBox().maxY):e.rightUp,n=this.lockMap[t];Object.entries(n).forEach(([c,h])=>{let u=h.lockedBox;r=new S(Math.min(r.x,u.leftLow.x),Math.min(r.y,u.leftLow.y)),i=new S(Math.max(i.x,u.rightUp.x),Math.max(i.y,u.rightUp.y))});let s=new S(r.x,i.y),a=new S(i.x,r.y);return new bs(e.layerId,r,s,a,i,e.locked)}removeLockMap(t){delete this.lockMap[t]}addCombinedMap(t,e){this.combinedMap[t]={box:e}}getCombinedMap(t){return this.combinedMap[t]}removeCombinedMap(t){delete this.combinedMap[t]}getCollisionCountMapEntries(t){return this.collisionCountMap[t]}getCollisionCountMapValue(t,e){var r;return(r=this.collisionCountMap[t])==null?void 0:r[e]}updateCollisionCountMap(t,e){var r;if(!this.collisionCountMap[t])this.collisionCountMap[t]={[e]:1};else if(this.collisionCountMap[t][e])this.collisionCountMap[t][e]++;else{let i=((r=e.match(/[a-zA-Z]+\d+/g))==null?void 0:r.sort())||[],n=!1;for(let s in this.collisionCountMap[t]){let a=s.match(/[a-zA-Z]+[0-9]+/g)||[];if(i.every(c=>a.includes(c))){this.collisionCountMap[t][s]++,n=!0;break}}n||(this.collisionCountMap[t][e]=1)}}removeCollisionCountMap(t,e){e?this.collisionCountMap[t]&&(delete this.collisionCountMap[t][e],Object.keys(this.collisionCountMap[t]).length===0&&delete this.collisionCountMap[t]):delete this.collisionCountMap[t]}},dn=MEe.getInstance();function oxt(o){return(o.match(/[a-zA-Z]+/g)||[]).length>1}function sxt(o){return o.reduce((t,e)=>e.match(/[a-zA-Z]+\d+/g)?t.concat(e.match(/[a-zA-Z]+\d+/g)):(t.push(e),t),[])}function rG(o,t,e,r,i){A.publish("updateRtree",""),i&&dn.addFilterComponentIds(sxt(i));let n=Array.from(Vr.rtreeSearchNotOutsideForComponent(o.layerId,o.getMathGraphics(o.layerId,r))).filter(s=>{let a=`${Tr}${s.number}`,l=o instanceof ke?`${Tr}${o.number}`:dn.getMultiComponentUniqueId(),c=t instanceof ke?`${Tr}${t.number}`:dn.getMultiComponentUniqueId();return a!==l&&a!==c&&!dn.getFilterComponentIds().includes(a)});if(n.length>0){let s=[];n.forEach(c=>{let h=`${Tr}${c.number}`;if(c.number!==-1&&(s.push(h),!dn.getMoveMap(h))){let u=e.get(c);u==null&&(u=dn.addOrderNumber(),e.set(c,u)),dn.addMoveMap(h,c,u)}});let a=o instanceof ke?`${Tr}${o.number}`:dn.getMultiComponentUniqueId(),l=`${a}, ${s}`;dn.getPushIdMap(l)||dn.addPushIdMap(l,a,s)}}function iG(o,t,e,r,i,n){let s=r.size>0?Math.max(...Array.from(r.values())):0;dn.setOrderNumber(s+1),dn.initAllMap(),dn.setFilterComponentIds(i),rG(o,o,r,e);let a=dn.getPushIdMapKeys();for(;a.length>0;){let l=a.shift(),c=l,h=dn.getPushIdMap(c).moveId;dn.getPushIdMap(c).pushIds.forEach(d=>{let p=dn.getMoveMap(d),m=new bs(p.component.model.box.layerId,p.component.model.box.leftLow,p.component.model.box.leftUp,p.component.model.box.rightLow,p.component.model.box.rightUp,p.component.model.box.locked),g=dn.getMoveMap(h)?dn.getMoveMap(h).component:o,y=g instanceof ke?new bs(g.model.box.layerId,g.model.box.leftLow,g.model.box.leftUp,g.model.box.rightLow,g.model.box.rightUp,g.model.box.locked).extendOfSize(e):new bs(g.layerId,g.leftLow,g.leftUp,g.rightLow,g.rightUp,g.locked).extendOfSize(e);if(g!=o&&p.order<dn.getMoveMap(h).order){console.log("\u53CD\u5E8F\u903B\u8F91\u7684\u88AB\u63A8\u6324\u5668\u4EF6\u7684id",`${Tr}${p.component.number}`),dn.updateCollisionCountMap(h,d);let P=0,T=[],I=Object.keys(dn.getCollisionCountMapEntries(h));for(let C of I)if(dn.getCollisionCountMapValue(h,C)>=2&&(T.push(C),P++,P>=2))break;if(P>=2){let C=[],E=T.sort().join("");dn.updateCollisionCountMap(h,E),console.log("\u8FDB\u5165\u53CD\u5E8F\u903B\u8F91\u5408\u5E76,\u6B64\u65F6\u6EE1\u8DB3\u6761\u4EF6\u7684moveId\u548CpushId",h,T),T.forEach(F=>{let H=dn.getMoveMap(F)?dn.getMoveMap(F).component.model.box:dn.getCombinedMap(F).box,z=new bs(H.layerId,H.leftLow,H.leftUp,H.rightLow,H.rightUp,H.locked);C.push(z)});let O=new S(C[0].bbox.minX,C[0].bbox.minY),_=new S(C[0].bbox.maxX,C[0].bbox.maxY);C.forEach(F=>{O=new S(Math.min(O.x,F.bbox.minX),Math.min(O.y,F.bbox.minY)),_=new S(Math.max(_.x,F.bbox.maxX),Math.max(_.y,F.bbox.maxY))});let x=new S(O.x,_.y),v=new S(_.x,O.y),D=new bs(C[0].layerId,O,x,v,_,C[0].locked);dn.removeCollisionCountMap(h,T[0]),dn.removeCollisionCountMap(h,T[1]),dn.getCombinedMap(E)||dn.addCombinedMap(E,D);let w=k0(y,D);if(w.isColliding){let F=Ae.translate(w.penetrationVector.x,w.penetrationVector.y,0);g.transform(F),g instanceof ke&&g.buildBBox(),rG(g,g,r,e,T)}}else{let C=!1,E="";for(let O in dn.getCollisionCountMapEntries(h))if(C=O.includes(`${Tr}${p.component.number}`),C){E=O;break}if(C&&oxt(E)){console.log("\u8FDB\u5165\u53CD\u5E8F\u975E\u5408\u5E76\u903B\u8F911111111111111111");let O=dn.getCombinedMap(E).box,_=k0(y,O);if(_.isColliding){let x=Ae.translate(_.penetrationVector.x,_.penetrationVector.y,0);g.transform(x),g instanceof ke&&g.buildBBox(),rG(g,g,r,e)}}else{console.log("\u8FDB\u5165\u53CD\u5E8F\u975E\u5408\u5E76\u903B\u8F9122222222222222");let O=k0(y,m);if(O.isColliding){let _=Ae.translate(O.penetrationVector.x,O.penetrationVector.y,0);g.transform(_),g instanceof ke&&g.buildBBox(),rG(g,p.component,r,e)}}}return}let b=k0(m,y);if(b.isColliding){p!=null&&p.component!=o&&t.addCommand(Ce.dispatch(p.component,"modify"));let P=p.component.partition,T=R.getInstance().partitionId,I=P==T;if(p.component.locked||!I){let C=g instanceof ke?`${Tr}${g.number}`:dn.getMultiComponentUniqueId(),E=`${Tr}${p.component.number}`;if(dn.getLockMap(C)||dn.addLockMap(C,m,E),!dn.getMoveMap(C))console.log("\u8FDB\u5165\u9501\u5B9A\u903B\u8F911111111111111111"),rje(o,e,n,I);else{console.log("\u8FDB\u5165\u9501\u5B9A\u903B\u8F91-\u975E\u8DDF\u968F\u9F20\u6807\u7684\u79FB\u52A8\u5668\u4EF6\u88AB\u5939\u51FB 22222222222222");let O=`${Tr}${p.component.number}`;if(console.log("\u6B64\u65F6\u88AB\u79FB\u52A8\u7684\u5668\u4EF6",C),dn.addLockMap(C,m,O),I){let _=dn.getLockCombinedBox(C,o),x=[];Object.entries(dn.getLockMap(C)).forEach(([D])=>{x.push(D)});let v=k0(y,_);if(v.isColliding){let D=Ae.translate(v.penetrationVector.x,v.penetrationVector.y,0);g.transform(D),g instanceof ke&&g.buildBBox(),rG(g,g,r,e,x)}}}}else{let C=Ae.translate(b.penetrationVector.x,b.penetrationVector.y,0);p.component.transform(C),p.component.buildBBox(),rG(p.component,g,r,e)}}}),dn.removePushIdMap(l),a=dn.getPushIdMapKeys()}}var Qc=class extends Cs{constructor(e,r=!1){super();this.commandFactory=new De("push component");this.addHistory=!0;this.items=new Set;this.associationItem=null;this.alreadyRotate=!1;this.revokeMove=!1;this.firstMove=!0;e.forEach(i=>{i instanceof mn||i instanceof Jr||i instanceof rr&&i.type=="Annotation"||this.items.add(i)}),!r&&this.isNeedShove()&&(this.isNeedShoveVia=!0,this.viaShoveTool=new tG(this.items)),this.fac=new hi,this.fac.createGroup("Batch move pcb item")}isNeedShove(){let e=Array.from(this.items),r=e.filter(n=>n instanceof Ue);if(r.length!==1)return!1;let i=r[0];for(let n of e)if(!(n instanceof Ue||n instanceof lt&&n.type=="TearDrop"))if(n instanceof Ge){if(n.net==i.net&&i.isContains(n.layerId)&&(i.isSelect(n.start.x,n.start.y)||i.isSelect(n.end.x,n.end.y)))continue;return!1}else return!1;return!0}onKeyDown(e){let r=new S(e.realSceneX,e.realSceneY),i=di.getScene();switch(tr.getAction(i,e)){case"Flip Right and Left":{this.items.size&&Array.from(this.items).every(s=>s instanceof ke)&&pf.flipComponent("Flip Right and Left",r,Array.from(this.items),this.fac.getCommand());break}case"Flip Up and Down":{this.items.size&&Array.from(this.items).every(s=>s instanceof ke)&&pf.flipComponent("Flip Up and Down",r,Array.from(this.items),this.fac.getCommand());break}}return A.publish("showAndUpdateCross",e),!1}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;this.addHistory=!0;for(let s of this.items)if(!s.isEmpty&&s.buildBBox().isContains1(r,i)&&s.isSelect(r,i))return!0;let n=Vr.pointSelect(r,i);if(n.length>0){let s=n[0];if(this.items.has(n[0]))return!0;if(s.getParent()!=null&&this.items.has(s.getParent()))return!0}return!1}moveComponent(){let e=Array.from(this.items).filter(n=>n instanceof ke);if(this.items.size==e.length&&e.length>0&&le.pcbConfig.moveComponent!=="ignore"){let n=e[0],s=n.position,a=[],l=qy(),c=e[0].model.buildBBox(),h=new S(c.minX,c.minY),u=new S(c.maxX,c.maxY);if(e.forEach(y=>{a.push(`${Tr}${y.number}`);let b=y.model.buildBBox();h=new S(Math.min(h.x,b.minX),Math.min(h.y,b.minY)),u=new S(Math.max(u.x,b.maxX),Math.max(u.y,b.maxY))}),new Set(a).size!==a.length)return;let d=new S(h.x,u.y),p=new S(u.x,h.y),m=new bs(e[0].layerId,h,d,p,u,e[0].locked);switch(le.pcbConfig.moveComponent){case"push":this.commandFactory.undo(),this.commandFactory=new De("push component");let y=new Map;iG(m,this.commandFactory,l,y,a,e),y.clear();break;case"block":eG(m,l,e);break}let g=n.position.sub(s);this.lastPosition=this.lastPosition.add(g)}let r=Array.from(this.items).filter(n=>n instanceof ke||n.getParent()instanceof ke),i=new Set(r.map(n=>n.getParent()instanceof ke?n.getParent():n));jb.runWithStrategy(YI.createMultiItemStrategy({selectedItems:i}),async()=>{$i.getInstance().language=(await aD()).message||"zh-cn",A.publish("updateDRC",i)})}onMouseMove(e,r=null){if(this.isNeedShoveVia)return this.viaShoveTool.onMouseMove(e,r);r=r||this.shiftControl(e);let i=this.lastPosition;gr.mouseAltDown&&!e.altKey&&(this.revokeMove=!0);let n=Ae.translate(r.x,r.y,0),s=[];for(let c of this.items)c instanceof Le&&c.getParent()?Mt.checkIsCanEditByItem(c.getParent())&&s.push(c):this.isNeedShoveVia&&c instanceof lt&&c.type=="TearDrop"?(this.items.delete(c),this.fac.addCommand4Item(c,"delete"),QV(c)):s.push(c);this.associationItem==null&&(this.associationItem=new Ya(s)),this.associationItem.setUpConnectTrack();let a=new Set;for(let c of this.associationItem.items){if(c instanceof lr){let h=c.getParent();if(h!=null&&this.associationItem.items.has(h))continue}a.add(c)}if(this.addHistory){let c=this.associationItem.getAllItem();for(let h of c)a.has(h)&&!h.locked&&(this.fac.addCommand4Item(h,"modify"),h instanceof He&&h.type==="Copper Region"&&(Ce.dispatchCoppers(h,"delete",this.fac.getCommand()),h.clearCopper()))}this.firstMove&&(a.forEach(c=>{c instanceof lr&&ze.highlightComponentWhenMoveText.add(c)}),this.firstMove=!1,wd.getInstance().highlight(Array.from(a))),this.alreadyRotate||this.associationItem.moveConnectTrack(n),this.associationItem.setAllAssociationRatlinesVisible();let l=this.associationItem.itemConnectTrack;if(this.tool==null){let c=new Array;for(let h of a)!h.locked&&!l.tracks.has(h.globalIndex)&&c.push(h);this.tool=new Ad(c),this.tool.recordStyle()}return this.tool.transform(n),a.forEach(c=>{!c.locked&&!l.tracks.has(c.globalIndex)&&c instanceof lr&&c.updateHelpLine()}),this.moveComponent(),this.revokeMove&&this.associationItem!=null&&this.associationItem.interrupt(),this.addHistory&&(this.addHistory=!1),this.changeNativeCursor(5),!0}onMouseUpMove(e){return this.setCursor(e),!1}setCursor(e){for(let r of this.items)if(!r.isEmpty&&r.isSelect(e.sceneX,e.sceneY))return this.changeNativeCursor(5);this.changeNativeCursor(4)}onMouseLeftUp(e){var r;if(this.isNeedShoveVia)return this.viaShoveTool.onMouseLeftUp(e);if((r=this.tool)==null||r.complete(),wd.getInstance().unhighlight(),this.fac.getCommand().length>0){if(A.publish("isMoveSwitch",!0),this.associationItem.complete(this.fac.getCommand()),le.pcbConfig.moveComponent=="push")for(let i of this.commandFactory.commands)this.fac.addCommand(i);this.fac.checkOutlines(Array.from(this.associationItem.items),new Set),this.fac=new hi,this.commandFactory=new De("push component"),this.fac.createGroup("Batch move pcb item"),this.associationItem.items.forEach(i=>{i instanceof lt&&i.fill()}),A.publish("autoFill",""),this.flushModify(),A.publish("isMoveSwitch",!1)}return ze.highlightComponentWhenMoveText.clear(),this.associationItem=null,this.removeShiftMoveHelpLine(),A.publish("flushSelectingInfo",""),this.filterRemove(),this.revokeMove=!1,!0}rotate(e=le.pcbConfig.rotate){var r;if(this.isNeedShoveVia)return this.viaShoveTool.rotate(e);if(this.associationItem.itemConnectTrack.tracks.size===0&&this.items.size>0){this.alreadyRotate=!0;let i=ys(this.items);if(i.valid()){let s=i.build1().center(),a=Ae.rotateZForPoint(s,e);this.associationItem==null&&(this.associationItem=new Ya(this.items)),this.associationItem.interrupt();let l=this.associationItem.items;if(this.associationItem.setUpConnectTrack(),this.addHistory){let h=this.associationItem.getAllItem();for(let u of h)u.locked||this.fac.addCommand4Item(u,"modify")}this.alreadyRotate||this.associationItem.moveConnectTrack(a),this.associationItem.setAllAssociationRatlinesVisible();let c=this.associationItem.itemConnectTrack;if(this.tool==null){let h=new Array;for(let u of l)!u.locked&&!c.tracks.has(u.globalIndex)&&h.push(u);this.tool=new Ad(h),this.tool.recordStyle()}this.tool!=null&&(this.tool.isMoveBox()&&(a=this.tool.matrix.getInverseMatrix().multiply4(a).multiply4(this.tool.matrix)),(r=this.tool)==null||r.transform(a)),this.addHistory&&(this.addHistory=!1)}}}interrupt(){var e,r;if(wd.getInstance().unhighlight(),this.isNeedShoveVia)return this.viaShoveTool.interrupt();if(this.tool!=null&&this.tool.cancel(),!pf.getStatus()&&((e=this.fac.getCommand())==null||e.undo()),this.associationItem!=null&&this.associationItem.interrupt(),le.pcbConfig.moveComponent=="push"&&((r=this.commandFactory)==null||r.undo()),!this.firstMove){let i=Array.from(this.items).filter(s=>s instanceof ke||s.getParent()instanceof ke),n=new Set(i.map(s=>s.getParent()instanceof ke?s.getParent():s));jb.runWithStrategy(YI.createMultiItemStrategy({selectedItems:n}),()=>{A.publish("updateDRC",n)})}return this.items.clear(),this.changeNativeCursor(4),this.removeShiftMoveHelpLine(),!0}setCommand(e){for(let r of e)this.fac.getCommand().addCommand(r)}filterRemove(){let e=new Set;this.items.forEach(r=>{r.isEmpty||e.add(r)}),this.items=e}flushModify(){let e=new Ya(this.items),r=e.items;for(let n of r)if(n instanceof Ge)A.publish("hasModifyPcbItem",n);else if(n instanceof Le){let s=n.getParent();s!=null&&s instanceof ke?A.publish("hasModifyPcbItem",s):A.publish("hasModifyPcbItem",n)}else n instanceof Ue?A.publish("hasModifyPcbItem",n):n instanceof Mn?A.publish("hasModifyPcbItem",n):n instanceof lr?A.publish("hasModifyPcbItem",n):n instanceof He?A.publish("hasModifyPcbItem",n):n instanceof ke?A.publish("hasModifyPcbItem",n):n instanceof ua&&A.publish("hasModifyPcbItem",n);e.getAllRepairTracks().forEach(n=>{A.publish("hasModifyPcbItem",n)})}};var iC=class{constructor(t){if(this.component=t,ai.pointInPolar(t.position)){let e=t.position.angle(R.getInstance().origin);e=e>=0?e:e+kr,this.startAngle=t.rotation-e}else this.startAngle=t.rotation}fixPosition(t,e){return ai.pointInPolar(e)&&!ai.pointInPolar(t)&&(t=e),t}getMatrix(t,e){t=this.fixPosition(t,e);let r=this.getRealTimeAngle(t);return Ae.rotateZForPoint(t,r)}getRealTimeAngle(t){if(ai.pointInPolar(t)){let e=t.angle(R.getInstance().origin);return e=e>=0?e:e+kr,this.startAngle+e-this.component.rotation}else return this.startAngle-this.component.rotation}};function ije(o,t,e){let r=e||o,i=Array.from(Vr.rtreeSearchNotOutsideForComponent(r.layerId,r.getMathGraphics(r.layerId,t))).filter(n=>`${Tr}${n.number}`!=`${Tr}${o.number}`);i&&i.forEach(n=>{let s=`${Tr}${n.number}`,a=ya.getMovedMapKeys(),l=a==null?void 0:a.reduce((c,h)=>c.length>h.length?c:h,"");if(ya.setShouldAdd(!l.includes(s)),!ya.getShouldAdd()){let c=ya.getMovedMap(l).initBox;ya.addBlockMap(l,c)}!ya.getBlockMap(s)&&ya.getShouldAdd()&&ya.addBlockMap(s,n.model.box),ya.getMovedMap(s)||ya.addMovedMap(s,n.model.box)})}function nje(o,t,e){ya.initAllMap();let r={};ije(o,t);let i=ya.getBlockMapKeys();for(;i.length>0;){let n=i.shift(),s=ya.getBlockMap(n),a=new bs(o.model.box.layerId,o.model.box.leftLow,o.model.box.leftUp,o.model.box.rightLow,o.model.box.rightUp,o.model.box.locked).extendOfSize(t),l=k0(s.initBox,a);if(l.isColliding){let c=Ae.translate(-l.penetrationVector.x,-l.penetrationVector.y,0);o.transform(c),ije(o,t)}if(r[n]=(r[n]||0)+1,r[n]>1){let c=Object.keys(r),h=c.join(""),u=[];c.forEach(b=>{let P=ya.getMovedMap(b).initBox,T=new bs(P.layerId,P.leftLow,P.leftUp,P.rightLow,P.rightUp,P.locked);(T.locked||!e)&&u.push(T)});let d=new S(u[0].bbox.minX,u[0].bbox.minY),p=new S(u[0].bbox.maxX,u[0].bbox.maxY);u.forEach(b=>{d=new S(Math.min(d.x,b.bbox.minX),Math.min(d.y,b.bbox.minY)),p=new S(Math.max(p.x,b.bbox.maxX),Math.max(p.y,b.bbox.maxY))});let m=new S(d.x,p.y),g=new S(p.x,d.y),y=new bs(u[0].layerId,d,m,g,p,u[0].locked);ya.clearBlockMap(),ya.addMovedMap(h,y),ya.addBlockMap(h,y),r={},i=ya.getBlockMapKeys()}else ya.setShouldAdd(!0),ya.removeBlockMap(n),i=ya.getBlockMapKeys()}}function axt(o){return(o.match(/[a-zA-Z]+/g)||[]).length>1}function lxt(o){return o.reduce((t,e)=>e.match(/[a-zA-Z]+\d+/g)?t.concat(e.match(/[a-zA-Z]+\d+/g)):(t.push(e),t),[])}function nG(o,t,e,r,i){A.publish("updateRtree",""),i&&dn.addFilterComponentIds(lxt(i));let n=Array.from(Vr.rtreeSearchNotOutsideForComponent(o.layerId,o.getMathGraphics(o.layerId,r))).filter(s=>{let a=`${Tr}${s.number}`,l=`${Tr}${o.number}`,c=`${Tr}${t.number}`;return a!==l&&a!==c&&!dn.getFilterComponentIds().includes(a)});if(n.length>0){let s=[];n.forEach(c=>{let h=`${Tr}${c.number}`;if(c.number!==-1&&(s.push(h),!dn.getMoveMap(h))){let u=e.get(c);u==null&&(u=dn.addOrderNumber(),e.set(c,u)),dn.addMoveMap(h,c,u)}});let a=`${Tr}${o.number}`,l=`${a}, ${s}`;dn.getPushIdMap(l)||dn.addPushIdMap(l,a,s)}}function mD(o,t,e,r){let i=r.size>0?Math.max(...Array.from(r.values())):0;dn.setOrderNumber(i+1),dn.initAllMap(),nG(o,o,r,e);let n=dn.getPushIdMapKeys();for(;n.length>0;){let s=n.shift(),a=s,l=dn.getPushIdMap(a).moveId;dn.getPushIdMap(a).pushIds.forEach(h=>{let u=dn.getMoveMap(h),d=new bs(u.component.model.box.layerId,u.component.model.box.leftLow,u.component.model.box.leftUp,u.component.model.box.rightLow,u.component.model.box.rightUp,u.component.model.box.locked),p=dn.getMoveMap(l)?dn.getMoveMap(l).component:o,m=new bs(p.model.box.layerId,p.model.box.leftLow,p.model.box.leftUp,p.model.box.rightLow,p.model.box.rightUp,p.model.box.locked).extendOfSize(e);if(p!=o&&u.order<dn.getMoveMap(l).order){console.log("\u53CD\u5E8F\u903B\u8F91\u7684\u88AB\u63A8\u6324\u5668\u4EF6\u7684id",`${Tr}${u.component.number}`),dn.updateCollisionCountMap(l,h);let y=0,b=[],P=Object.keys(dn.getCollisionCountMapEntries(l));for(let T of P)if(dn.getCollisionCountMapValue(l,T)>=2&&(b.push(T),y++,y>=2))break;if(y>=2){let T=[],I=b.sort().join("");dn.updateCollisionCountMap(l,I),console.log("\u8FDB\u5165\u53CD\u5E8F\u903B\u8F91\u5408\u5E76,\u6B64\u65F6\u6EE1\u8DB3\u6761\u4EF6\u7684moveId\u548CpushId",l,b),b.forEach(D=>{let w=dn.getMoveMap(D)?dn.getMoveMap(D).component.model.box:dn.getCombinedMap(D).box,F=new bs(w.layerId,w.leftLow,w.leftUp,w.rightLow,w.rightUp,w.locked);T.push(F)});let C=new S(T[0].bbox.minX,T[0].bbox.minY),E=new S(T[0].bbox.maxX,T[0].bbox.maxY);T.forEach(D=>{C=new S(Math.min(C.x,D.bbox.minX),Math.min(C.y,D.bbox.minY)),E=new S(Math.max(E.x,D.bbox.maxX),Math.max(E.y,D.bbox.maxY))});let O=new S(C.x,E.y),_=new S(E.x,C.y),x=new bs(T[0].layerId,C,O,_,E,T[0].locked);dn.removeCollisionCountMap(l,b[0]),dn.removeCollisionCountMap(l,b[1]),dn.getCombinedMap(I)||dn.addCombinedMap(I,x);let v=k0(m,x);if(v.isColliding){let D=Ae.translate(v.penetrationVector.x,v.penetrationVector.y,0);p.transform(D),p.buildBBox(),nG(p,p,r,e,b)}}else{let T=!1,I="";for(let C in dn.getCollisionCountMapEntries(l))if(T=C.includes(`${Tr}${u.component.number}`),T){I=C;break}if(T&&axt(I)){console.log("\u8FDB\u5165\u53CD\u5E8F\u975E\u5408\u5E76\u903B\u8F911111111111111111");let C=dn.getCombinedMap(I).box,E=k0(m,C);if(E.isColliding){let O=Ae.translate(E.penetrationVector.x,E.penetrationVector.y,0);p.transform(O),p.buildBBox(),nG(p,p,r,e)}}else{console.log("\u8FDB\u5165\u53CD\u5E8F\u975E\u5408\u5E76\u903B\u8F9122222222222222");let C=k0(m,d);if(C.isColliding){let E=Ae.translate(C.penetrationVector.x,C.penetrationVector.y,0);p.transform(E),p.buildBBox(),nG(p,u.component,r,e)}}}return}let g=k0(d,m);if(g.isColliding){u!=null&&u.component!=o&&t.addCommand(Ce.dispatch(u.component,"modify"));let y=u.component.partition,b=R.getInstance().partitionId,P=y==b;if(u.component.locked||!P){let T=`${Tr}${p.number}`;if(!dn.getMoveMap(T))console.log("\u8FDB\u5165\u9501\u5B9A\u903B\u8F911111111111111111"),nje(o,e,P);else{console.log("\u8FDB\u5165\u9501\u5B9A\u903B\u8F91-\u975E\u8DDF\u968F\u9F20\u6807\u7684\u79FB\u52A8\u5668\u4EF6\u88AB\u5939\u51FB 22222222222222");let I=`${Tr}${u.component.number}`;if(console.log("\u6B64\u65F6\u88AB\u79FB\u52A8\u7684\u5668\u4EF6",T),dn.addLockMap(T,d,I),P){let C=dn.getLockCombinedBox(T,o),E=[];Object.entries(dn.getLockMap(T)).forEach(([_])=>{E.push(_)});let O=k0(m,C);if(O.isColliding){let _=Ae.translate(O.penetrationVector.x,O.penetrationVector.y,0);p.transform(_),p.buildBBox(),nG(p,p,r,e,E)}}}}else{let T=Ae.translate(g.penetrationVector.x,g.penetrationVector.y,0);u.component.transform(T),u.component.buildBBox(),nG(u.component,p,r,e)}}}),dn.removePushIdMap(s),n=dn.getPushIdMapKeys()}}var nC={},gD={},Che=!0;function oje(o,t,e){let r=e||o,i=Array.from(Vr.rtreeSearchNotOutside(r.getMathGraphics(r.layerId,t)).components).filter(n=>n.layerId==o.layerId&&n.globalIndex!==o.globalIndex);i&&i.forEach(n=>{let s=Object.keys(gD),a=s==null?void 0:s.reduce((l,c)=>l.length>c.length?l:c,"");Che=!a.includes(n.globalIndex),Che||(nC[a]={initBox:gD[a].initBox}),!nC[n.globalIndex]&&Che&&(nC[n.globalIndex]={initBox:n.model.box}),gD[n.globalIndex]||(gD[n.globalIndex]={initBox:n.model.box})})}function t_(o,t){console.log("movedMap",gD),console.log("blockMap",nC),nC={},gD={};let e={};oje(o,t);let r=Object.keys(nC);for(;r.length>0;){let i=r.shift(),n=nC[i],s=new bs(o.model.box.layerId,o.model.box.leftLow,o.model.box.leftUp,o.model.box.rightLow,o.model.box.rightUp,o.model.box.locked).extendOfSize(t),a=k0(n.initBox,s);if(a.isColliding){let l=Ae.translate(-a.penetrationVector.x,-a.penetrationVector.y,0);o.transform(l),oje(o,t)}if(e[i]=(e[i]||0)+1,e[i]>1){let l=Object.keys(e),c=l.join(""),h=[];l.forEach(y=>{let b=gD[y].initBox,P=new bs(b.layerId,b.leftLow,b.leftUp,b.rightLow,b.rightUp,b.locked);h.push(P)});let u=new S(h[0].bbox.minX,h[0].bbox.minY),d=new S(h[0].bbox.maxX,h[0].bbox.maxY);h.forEach(y=>{u=new S(Math.min(u.x,y.bbox.minX),Math.min(u.y,y.bbox.minY)),d=new S(Math.max(d.x,y.bbox.maxX),Math.max(d.y,y.bbox.maxY))});let p=new S(u.x,d.y),m=new S(d.x,u.y),g=new bs(h[0].layerId,u,p,m,d,h[0].locked);nC={},gD[c]={initBox:g},nC[c]={initBox:g},e={},r=Object.keys(nC)}else Che=!0,delete nC[i],r=Object.keys(nC)}}var yD=class extends Cs{constructor(e){super();this.commandFactory=new De("push component");this.addHistory=!0;this.associationItem=null;this.alreadyRotate=!1;this.position=S.ORIGIN;this.pad=e,this.command=new De("single select Component");let r=this.pad.getParent();r!=null&&r instanceof ke&&(this.util=new iC(r)),this.moveTool=new Qc([this.pad]),this.position=this.pad.center}onKeyDown(e){if(this.pad.getParent()||this.pad.getGroupID()){let r=this.pad.getParent();r&&r instanceof ke&&(e.sceneX=r.position.x,e.sceneY=r.position.y,A.publish("showAndUpdateCross",e))}else e.sceneX=this.pad.center.x,e.sceneY=this.pad.center.y,A.publish("showAndUpdateCross",e);return!1}onMouseLeftDown(e){let r=e.sceneX,i=e.sceneY;return this.pad.isSelect(r,i)}onMouseMove(e){if(this.pad.locked)return!1;let r=this.shiftControl(e);if(this.position=this.lastPosition,this.addHistory&&wd.getInstance().highlight([this.pad]),this.pad.getParent()||this.pad.getGroupID()){if(e.adsorbGrid&&this.addHistory&&le.pcbConfig.snapToCenterWhileDragPadOrVia&&(r=new S(e.sceneX-this.pad.center.x,e.sceneY-this.pad.center.y)),le.pcbConfig.alignToNearComponentOrPadWhileDrag&&e.adsorb){let h=le.pcbConfig.snapToCenterWhileDragPadOrVia?new S(e.sceneX,e.sceneY):this.pad.center.add(r),u=ai.snapToOtherComponent(this.pad,r,h,e);u&&(this.lastPosition=this.lastPosition.sub(r),h=u,r=h.sub(this.pad.center),this.lastPosition=this.lastPosition.add(r))}let i=Ae.translate(r.x,r.y,0);if(!It.getInstance().currentCoord&&this.util!=null){let h=new S(e.sceneX,e.sceneY),u=this.util.getMatrix(this.position,h);i=i.multiply4(u)}if(this.pad.getParent()&&!Mt.checkIsCanEditByItem(this.pad.getParent()))return!0;this.associationItem==null&&(this.associationItem=new Ya(this.pad.getParent()?[this.pad.getParent()]:[this.pad]));let n=this.associationItem.items;if(this.associationItem.setUpConnectTrack(),this.addHistory){let h=this.associationItem.getAllItem();for(let u of h)u.locked||(this.command.addCommand(Ce.dispatch(u,"modify")),A.publish("hasModifyPcbItem",this.pad))}this.alreadyRotate||this.associationItem.moveConnectTrack(i),this.associationItem.setAllAssociationRatlinesVisible();let s=this.associationItem.itemConnectTrack;if(this.tool==null){let h=new Array;for(let u of n)!u.locked&&!s.tracks.has(u.globalIndex)&&h.push(u);this.tool=new Ad(h),this.tool.recordStyle()}this.tool.transform(i);let a=this.pad.getParent();if(a&&a instanceof ke){let h=new S(e.sceneX,e.sceneY).sub(a.position);if(e.sceneX=a.position.x,e.sceneY=a.position.y,A.publish("showAndUpdateCross",e),le.pcbConfig.moveComponent=="push"&&this.pad.getParent()instanceof ke&&!a.model.getGroupID()){let u=qy();this.commandFactory.undo(),this.commandFactory=new De("push component");let d=this.pad.getParent(),p=new Map;p.set(d,0),mD(d,this.commandFactory,u,p),p.clear(),this.lastPosition=d.position.add(h)}if(le.pcbConfig.moveComponent=="block"&&!a.model.getGroupID()&&this.pad.getParent()instanceof ke){let u=qy(),d=this.pad.getParent();t_(d,u),this.lastPosition=d.position.add(h)}}let l=Array.from(n).filter(h=>h instanceof ke||h.getParent()instanceof ke),c=new Set(l.map(h=>h.getParent()instanceof ke?h.getParent():h));jb.runWithStrategy(YI.createMultiItemStrategy({selectedItems:c}),async()=>{$i.getInstance().language=(await aD()).message||"zh-cn",A.publish("updateDRC",c)})}else{this.addHistory&&(this.command.addCommand(Ce.dispatch(this.pad,"modify")),A.publish("hasModifyPcbItem",this.pad)),le.pcbConfig.snapToCenterWhileDragPadOrVia&&(r=new S(e.sceneX,e.sceneY).sub(this.pad.center));let i=le.pcbConfig.snapToCenterWhileDragPadOrVia?new S(e.sceneX,e.sceneY):this.pad.center.add(r);if(e.adsorbGrid&&(i=ai.adsorpGrid(i),r=i.sub(this.pad.center)),le.pcbConfig.alignToNearComponentOrPadWhileDrag&&e.adsorb){let l=ai.snapToOtherComponent(this.pad,r,i,e);l&&(this.lastPosition=this.lastPosition.sub(r),i=l,r=i.sub(this.pad.center),this.lastPosition=this.lastPosition.add(r))}let n=Ae.translate(r.x,r.y,0);this.associationItem==null&&(this.associationItem=new Ya([this.pad]));let s=this.associationItem.items;if(this.associationItem.setUpConnectTrack(),this.addHistory){let l=this.associationItem.getAllItem();for(let c of l)!c.locked&&c!=this.pad&&this.command.addCommand(Ce.dispatch(c,"modify"))}this.alreadyRotate||this.associationItem.moveConnectTrack(n),this.associationItem.setAllAssociationRatlinesVisible();let a=this.associationItem.itemConnectTrack;s.forEach(l=>{!l.locked&&!a.tracks.has(l.globalIndex)&&l.transform(n)}),e.sceneX=this.pad.center.x,e.sceneY=this.pad.center.y,A.publish("showAndUpdateCross",e)}return this.addHistory&&(this.addHistory=!1),this.changeNativeCursor(5),!0}onMouseUpMove(e){return this.pad.isSelect(e.sceneX,e.sceneY)?this.changeNativeCursor(5):this.changeNativeCursor(4),!1}onMouseLeftUp(e){var r;if((r=this.tool)==null||r.complete(),this.position=this.pad.center,wd.getInstance().unhighlight(),this.command.length>0){if(this.associationItem!=null){if(this.associationItem.complete(this.command),le.pcbConfig.moveComponent=="push"&&this.pad.getParent()instanceof ke)for(let i of this.commandFactory.commands)this.command.addCommand(i);this.associationItem.getAllItem().forEach(i=>{A.publish("hasModifyPcbItem",i)})}qe.executeCommand(this.command),this.command=new De("select pad"),this.commandFactory=new De("push component")}return this.associationItem=null,this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),A.publish("flushService",""),A.publish("flushSelectingInfo",""),A.publish("autoFill",""),!0}rotate(e=le.pcbConfig.rotate){var i;if(this.pad.getParent()!=null){this.alreadyRotate=!0;let n=ys([this.pad]);if(n.valid()){let a=n.build1().center(),l=Ae.rotateZForPoint(a,e);this.associationItem==null&&(this.associationItem=new Ya([this.pad])),this.associationItem.interrupt();let c=this.associationItem.items;if(this.associationItem.setUpConnectTrack(),this.addHistory){let u=this.associationItem.getAllItem();for(let d of u)d.locked||this.command.addCommand(Ce.dispatch(d,"modify"))}if(this.addHistory){let u=this.associationItem.getAllItem();for(let d of u)d.locked||this.command.addCommand(Ce.dispatch(d,"modify"))}this.alreadyRotate||this.associationItem.moveConnectTrack(l),this.associationItem.setAllAssociationRatlinesVisible();let h=this.associationItem.itemConnectTrack;if(this.tool==null){let u=new Array;for(let d of c)!d.locked&&!h.tracks.has(d.globalIndex)&&u.push(d);this.tool=new Ad(u),this.tool.recordStyle()}this.tool!=null&&(this.tool.isMoveBox()&&(l=this.tool.matrix.getInverseMatrix().multiply4(l).multiply4(this.tool.matrix)),(i=this.tool)==null||i.transform(l)),this.addHistory&&(this.addHistory=!1)}}else{this.addHistory&&(this.command=new De("select pad"),this.command.addCommand(Ce.dispatch(this.pad,"modify")),this.addHistory=!1);let n=ys([this.pad]);if(n.valid()){let a=n.build1().center();$n.rotate(a,e,[this.pad])}}}interrupt(){var r,i;this.tool!=null&&this.tool.cancel(),(r=this.command)==null||r.undo(),le.pcbConfig.moveComponent=="push"&&((i=this.commandFactory)==null||i.undo()),this.associationItem!=null&&(this.associationItem.interrupt(),this.associationItem=null),wd.getInstance().unhighlight(),this.removeShiftMoveHelpLine(),this.moveTool.interrupt(),this.changeNativeCursor(4);let e=this.pad.getParent()instanceof ke?new Set([this.pad.getParent()]):null;return jb.runWithStrategy(YI.createMultiItemStrategy({selectedItems:e}),()=>{A.publish("updateDRC",e)}),!0}};var oG=class extends yD{constructor(e){super(e);this.firstMove=!0;this.pad=e}onMouseLeftDown(e){return!1}onMouseMove(e){_s.cancel();let r=this.shiftControl(e);return this.position=this.lastPosition,kB.move(this.pad.globalIndex,r,this.firstMove),this.firstMove=!1,!0}onMouseLeftUp(e){return _s.executeCommand(),this.command=null,!0}onMouseUpMove(e){return _s.move(e),!1}interrupt(){return super.interrupt(),this.firstMove=!0,!0}rotate(e=le.pcbConfig.rotate){_s.addCommand(this.pad,"modify"),super.rotate(e)}};var sG=class extends Cs{constructor(t){super(),this.dimension=t}onMouseLeftDown(t){let e=t.sceneX,r=t.sceneY,i=this.dimension.isSelect(e,r);return i&&this.dimension.length>0&&_s.reAddRestriction(this.dimension),i}onMouseMove(t){return _s.move(t),!0}onMouseLeftUp(t){return _s.build(),!0}interrupt(){return!0}};var aG=class extends ni{constructor(e){super();this.template=null;this.hashId="";this.image=null;this.option="OPTIONLEFTUP",this.setSize(e),this.hashId=e.hashId,this.drawing=!0,xo.setTool(this),this.start()}onKeyDown(e){switch(tr.getAction(5,e)){case"Cancel":this.cancel();break;case"Rotate Left":this.image!=null&&(this.image.rotateFor(this.image.start,le.pcbConfig.rotate),ut.defaultImage.rotation+=le.pcbConfig.rotate);break;case"rotate_right":this.image!=null&&(this.image.rotateFor(this.image.start,-le.pcbConfig.rotate),ut.defaultImage.rotation-=le.pcbConfig.rotate);break;case"Flip Right and Left":A.publish("turn","turnAround");break;case"Flip Up and Down":A.publish("turn","turnUpsideDown");break}A.publish("updateFrame","")}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY);if(this.image!=null){if(this.image.start=r,!Mt.checkIsInCanEdit(this.image)){let n="beyond drawing range";Mt.showMassageTip(n,n);return}this.image.partition=R.getInstance().partitionId,A.publish("onlySelect",[this.image]);let i=new De("insert image");i.addCommand(Ce.dispatch(this.image,"add")),qe.executeCommand(i),A.publish("hasModifyPcbItem",this.image),this.image=null,this.drawing=!0}A.publish("flushService","")}onMouseMove(e){if(this.drawing){let r=new S(e.sceneX,e.sceneY);if(this.image!=null)this.image.layerId!=this.getLayer()&&(this.image.layerId=this.getLayer()),this.image.start=r;else{let{hashId:i,width:n,height:s}=this,a=this.getLayer(),l=ut.defaultImage.rotation;this.image=So.addImage(a,r,n,s,l,!1,!1,i)}}}interrupt(){this.image!==null&&(this.image.remove(),A.publish("delete",this.image),this.image=null,A.publish("flushService","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}getLayer(){let e=Pe.getActiveLayer();switch(e.layerID){case 3:case 4:case 13:return e.layerID;default:return 3}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"FLIP":i[1]=="FLIP_LEFTANDRIGHT"?this.turn("turnAround"):i[1]=="FLIP_UPANDDOWN"&&this.turn("turnUpsideDown");break}A.publish("updateFrame","")}turn(e){if(!(!R.getInstance().isactive||23==R.getInstance().doctype))switch(e){case"turnAround":xo.turn([this.image],!1,!1);break;case"turnUpsideDown":xo.turn([this.image],!0,!1);break}}setSize(e){let r=new dt;e.unit!=="mil"?(this.width=r.conversion(e.unit,"mil",+e.width)/10,this.height=r.conversion(e.unit,"mil",+e.height)/10):(this.width=+e.width/10,this.height=+e.height/10)}};var She=class{constructor(){this.higtLightItems=new Set;this.allHightTimeId=[];this._ignoreItemCheck=!1;this._selectionByDRCHover=!1;let t=new Jt;A.subscribe("realTimeHighlight",e=>{this.cancelhighLight(),this.higtLightItems.clear(),e.forEach(r=>{let i=t.getItem(r);i&&this.higtLightItems.add(i)}),this.highLight()}),A.subscribe("cancelRealTimeHighlight",()=>this.cancelhighLight())}highLight(){let t=ze.getSelects();this.higtLightItems.forEach(e=>{if(e instanceof mt||e instanceof _t){let r=e.getParent();if(!r.isEmpty&&t.indexOf(r)>=0)return}!e.isEmpty&&t.indexOf(e)<0&&e.isVisible&&!ze.highlight.isItemHighlighted(e.globalIndex)&&this.itemClickOrVisible(e,!0,ze.realTimeHighlight)}),A.publish("updateFrame","")}interrupt(){this.allHightTimeId.forEach(t=>{clearTimeout(t)}),this.allHightTimeId=[]}cancelhighLight(){this.allHightTimeId.shift(),this.highlightTimeId&&this.allHightTimeId.pop(),clearTimeout(this.highlightTimeId),this.highlightTimeId=null;let t=ze.getSelects();this.higtLightItems.forEach(e=>{if(e instanceof mt||e instanceof _t){let r=e.getParent();if(!r.isEmpty&&t.indexOf(r)>=0)return}if(!e.isEmpty&&t.indexOf(e)<0&&e.isVisible&&!ze.highlight.isItemHighlighted(e.globalIndex)&&this.itemClickOrVisible(e,!1),e instanceof Le||e instanceof Ue){let r=e.getParent();r!=null&&!r.isEmpty&&t.indexOf(r)>=0&&this.itemClickOrVisible(r,!0)}else if(e instanceof ke){let r=e.getItems();for(let i of r)!i.isEmpty&&t.indexOf(i)>=0&&this.itemClickOrVisible(i,!0)}}),A.publish("updateFrame","")}select(t){this.highlightTimeId=setTimeout(()=>{if(ze.dragging)return;let e=t.realSceneX,r=t.realSceneY;this.cancelhighLight(),this.higtLightItems.clear(),this._ignoreItemCheck=!1,this._selectionByDRCHover=!1;let i=new Set;if(!t.leftDown&&!t.rightDown){let s=Vr.pointSelect(e,r,!1,!0);if(s[0]instanceof Tp){this._ignoreItemCheck=!0,this._selectionByDRCHover=!0;let a=Vr.getDrcAssoicItems(s);for(let l of a)i.add(l)}else le.pcbConfig.highLight&&(i=new Set(this.filter(s)))}let n=!1;i.forEach(s=>{!n&&!this.higtLightItems.has(s)&&(n=!0)}),n&&(this.higtLightItems=i,this.highLight())},120),this.allHightTimeId.push(this.highlightTimeId)}filter(t){let e=[];for(let r of t)if(!(r instanceof He&&r.type=="Copper Region")){if(r instanceof Jr)continue;e.push(r)}if(e.length==1){let r=e[0];if(r instanceof Ge)return jt.filterTrack(r,le.pcbConfig.clickTrackSelect)}return e}itemClickOrVisible(t,e,r){if(t&&!(Ao(t)&&le.pcbConfig.highLightNet&&r)){if(this._selectionByDRCHover){e?(t.highLight(r),t.click(r)):(t.unHighLight(),t.visible());return}e?t.click(r):t.visible()}}};var Ehe=class{constructor(){this.highLightItems=new Set;this.allHightTimeId=[];this._viewGroup=new jV({visible:!0,highLightType:0})}selectFilter(t){let e=[];for(let r of t)if(!(r instanceof He&&r.type=="Copper Region")){if(r instanceof Jr)continue;e.push(r)}if(e.length==1){let r=e[0];if(r instanceof Ge)return jt.filterTrack(r,le.pcbConfig.clickTrackSelect)}return e}isBridgingCopper(t){return(t.getComponent()instanceof Zi&&t.getComponent()).isBridgingCopper}itemTypeCheck(t){return t instanceof Ge||t instanceof Le||t instanceof Ue||t instanceof lt&&t.type=="TearDrop"?!0:((t instanceof mt||t instanceof _t)&&(t=t.getParent()),(t instanceof lt||t instanceof Pr||t instanceof rr)&&(t.type=="Line"||t.type=="Fill Region"&&!this.isBridgingCopper(t))&&!(t.getParent()&&t.getParent()instanceof ke))}select(t){let e=null,r=t.realSceneX,i=t.realSceneY;this.net=null,this.highlightTimeId=setTimeout(()=>{if(this.cancelHighLight(),!we.drawing){if(le.pcbConfig.highLightNet&&!t.leftDown&&!t.rightDown&&this.highlightTimeId!=null){let n=this.selectFilter(Vr.pointSelect(r,i,!1,!0));if(n[0]instanceof Tp)return;{let s=[];n.forEach(a=>{var l;if(this.itemTypeCheck(a)){(a instanceof mt||a instanceof _t)&&(a=a.getParent());let c=a&&Ao(a);c&&!s.includes(c)&&(e=c,s.push(c),(l=Ye.getItem(c))==null||l.forEach(h=>{h instanceof lt&&h.type=="TearDrop"||this.highLightItems.add(h)}))}})}}this.net=e,this.highLight()}},120),this.allHightTimeId.push(this.highlightTimeId)}highLight(){let t=[],e=[],r=ze.getSelects();this.highLightItems.forEach(i=>{if(i instanceof mt||i instanceof _t){let l=i.getParent();if(l&&!l.isEmpty&&r.indexOf(l)>=0)return;l&&(i=l)}let n=i.viewGroupId;if(!n||t.includes(n))return;let s=i.layerId;if(e.includes(s))return;let a=Pe.getLayer(s);if(a&&!a.visible){e.push(s);return}!i.isEmpty&&r.indexOf(i)<0&&i.isVisible&&!ze.highlight.isItemHighlighted(i.globalIndex)&&this.itemTypeCheck(i)&&t.push(n)}),this.net&&Wo.highlightByNets([this.net],ze.realTimeHighlight,(i,n)=>{let s=i.viewGroupId;!s||t.includes(s)||t.push(s)}),t.length>0&&this._viewGroup.viewGroup(t),A.publish("updateFrame","")}cancelHighLight(){this.firstHighlightTimeId=this.allHightTimeId.shift(),this.highlightTimeId&&this.allHightTimeId.pop(),this.highLightItems.clear(),this._viewGroup.clear()}interrupt(){this.allHightTimeId.forEach(t=>{clearTimeout(t)}),clearTimeout(this.firstHighlightTimeId),clearTimeout(this.highlightTimeId),this.highlightTimeId=null,this.firstHighlightTimeId=null,this.allHightTimeId.length=0,this.cancelHighLight()}};var Vc=class extends Oo{constructor(){super();this.realdTimeHighLight=new She;this.realTimeHighLightNet=new Ehe;di.dropDrag=!0,ze.getSelects().length>0?di.setSelect():di.setNonSelect()}getCanUndo(){return!0}onKeyDown(e){ze.onKeyDown(e)}onEnterPlace(e){this.onMouseLeftUp(e)}onMouseLeftDown(e){ze.realTimeHighlight=!1,this.realdTimeHighLight.cancelhighLight(),this.realTimeHighLightNet.cancelHighLight(),ze.onMouseLeftDown(e)}onMouseLeftUp(e){ze.onMouseLeftUp(e)}onMouseRightDown(e){ze.realTimeHighlight=!1,this.realdTimeHighLight.cancelhighLight(),this.realTimeHighLightNet.cancelHighLight(),ze.onMouseRightDown(e)}onMouseRightUp(e){ze.onMouseRightUp(e)}onMouseMove(e){ze.realTimeHighlight=!0,this.realdTimeHighLight.select(e),this.realTimeHighLightNet.select(e),ze.onMouseMove(e)}onMouseWheel(e){ze.onMouseWheel(e)}onMouseLeave(e){setTimeout(()=>{ze.realTimeHighlight=!1,this.realdTimeHighLight.cancelhighLight(),this.realTimeHighLightNet.cancelHighLight()},120)}onDoubleClick(e){ze.onDoubleClick(e)}clear(){this.realdTimeHighLight.interrupt(),this.realTimeHighLightNet.interrupt(),this.realdTimeHighLight.cancelhighLight(),this.realTimeHighLightNet.cancelHighLight()}interrupt(){this.clear(),ze.interrupt()}};var NEe=class{constructor(){this._measureMode="MeasureObjectDistance";this._showRichInfo=!1}get measureMode(){return this._measureMode}set measureMode(t){this._measureMode=t}get showRichInfo(){return this._showRichInfo}set showRichInfo(t){this._showRichInfo=t}},gh=new NEe;function sje(o,t=!1){let e=new qt;return e.add("CANCEL",!0),e.add("MeasuringDistance"),e.add("OBJECT_PRIORITY",t),LS&&e.add("CreepageDistance",!0),e.add("toggleAdsorb",!1,o),e.add("ADSORBENT_CONFIG"),e.result}var Ohe=class{constructor(){this._startTarget=this.createTargetReult("DOT",null),this._endTarget=this.createTargetReult("DOT",null),this._measureResult=this.createMeasureReult()}get startTarget(){return this._startTarget}set startTarget(t){this._startTarget=t}get endTarget(){return this._endTarget}set endTarget(t){this._endTarget=t}get measureResult(){return this._measureResult}set measureResult(t){this._measureResult=t}reset(){this.startTarget=this.createTargetReult("DOT",null),this.endTarget=this.createTargetReult("DOT",null),this.measureResult=this.createMeasureReult()}toJSON(){return{startTarget:this.startTarget,endTarget:this.endTarget,measureResult:this.measureResult}}createTargetReult(t,e){let r={};return r.allElements=[],r.elementId=e,r.type=t,r.x=0,r.y=0,r.sourceX=0,r.sourceY=0,r.layerId=1,r.layerOptions=[],r.position="EDGE",r.elementShowData={},r.isBeFilledType=!0,r}createMeasureReult(){let t={};return t.angle="0(0)",t.distance="0(0)",t.dx="0(0)",t.dy="0(0)",t}};function hxt(o){return!(o instanceof Ir||o instanceof Pr&&o.type==="Line"||o instanceof rr&&o.type==="Line"||o.type==="Board Outline"||o instanceof _t||o instanceof mt||o instanceof lt&&o.type==="Line")}function Tq(o,t=R.getInstance().unit){return t==="mil"?gn(o*10,1,!0):t==="mm"?gn(Bs.conversion("mil","mm",o)*10,3,!0):0}function Iq(o,t){let e=Pe.getAllLayer(),r=Pe.getAllEnableInnerLayers(),i=new Set,n=Pe.getActiveLayerID(),s=!1,a=null;for(let h=0;h<o.length;h++){let u=o[h],d=u.layerId,p=JSON.parse(JSON.stringify(u.toJSON()))||{};t.elementShowData=p,t.elementShowData.DISTPLAY_TITLE=u.type||u.model.modelType||"Object",+d&&i.add(+d),u instanceof Le?(s=!0,u.isTestPad?t.elementShowData.DISTPLAY_TITLE="Test Point":t.elementShowData.DISTPLAY_TITLE="Pad",uxt(u,r).forEach(m=>{i.add(m)}),u.unusedInnerLayers.indexOf(n)>=0&&(a=47)):u instanceof Ue&&(s=!0,t.elementShowData.DISTPLAY_TITLE="Via",dxt(u,r).forEach(m=>{i.add(m)}),u.unusedInnerLayers.indexOf(n)>=0&&(a=47)),u instanceof Jr&&(t.elementShowData.DISTPLAY_TITLE="Copper Region(Filled)"),(!hxt(u)||u instanceof Jr&&u.style!=="solid")&&(t.isBeFilledType=!1)}t.layerOptions.length=0,i.forEach(h=>{if(Number.isNaN(h))return;let u={text:"",value:h};if(!(s&&u.value===12)){for(let d=0;d<e.length;d++)if(e[d].layerID===h){u.text=e[d].name,u.showOriginalText=Es(h)&&!/^Inner\d+$/.test(u.text);break}t.layerOptions.push(u)}});let l=new Set(Array.from(i).sort((h,u)=>h-u)),c=l.size>0?l.has(n)?n:Array.from(l)[0]:1;a!==null&&l.has(a)&&(c=a),t.layerId=c}function uxt(o,t){let e=new Set,r=o.layerId;if(+r===1)e.add(1),cE(o,5)&&e.add(5),cE(o,7)&&e.add(7);else if(+r===2)e.add(2),cE(o,6)&&e.add(6),cE(o,8)&&e.add(8);else{let i=o.unusedInnerLayers||[];e.add(1),e.add(2),t.forEach(n=>{i.indexOf(n.layerID)<=-1&&e.add(n.layerID)}),e.add(47),cE(o,5)&&e.add(5),cE(o,6)&&e.add(6),cE(o,7)&&e.add(7),cE(o,8)&&e.add(8)}return e}function dxt(o,t){let e=t.map(i=>i.layerID),r=new Set;if(o.startLayer===1&&o.endLayer===2||o.endLayer===1&&o.startLayer===2)r.add(1),t.forEach(i=>{o.unusedInnerLayers.indexOf(i.layerID)<=-1&&r.add(i.layerID)}),r.add(2);else if(e.indexOf(o.startLayer)>=0&&e.indexOf(o.endLayer)>=0){let i=o.startLayer>o.endLayer?o.endLayer:o.startLayer,n=i===o.endLayer?o.startLayer:o.endLayer;for(let s=0;s<t.length;s++)t[s].layerID>=i&&t[s].layerID<=n&&o.unusedInnerLayers.indexOf(t[s].layerID)<=-1&&r.add(t[s].layerID)}else{let i=o.startLayer>o.endLayer?o.endLayer:o.startLayer,n=i===o.endLayer?o.startLayer:o.endLayer;if(i===1){r.add(1);for(let s=0;s<t.length;s++)t[s].layerID<=n&&o.unusedInnerLayers.indexOf(t[s].layerID)<=-1&&r.add(t[s].layerID)}if(i===2){for(let s=0;s<t.length;s++)t[s].layerID>=n&&o.unusedInnerLayers.indexOf(t[s].layerID)<=-1&&r.add(t[s].layerID);r.add(2)}}return r.add(47),r.has(1)&&cE(o,5)&&r.add(5),r.has(2)&&cE(o,6)&&r.add(6),r}function cE(o,t){return!!o.getMathGraphics(t)}var kEe=class{to16(t){return Array.from(t).map(e=>{let r=e.toString(16).toUpperCase();return r.length===1?"0"+r:r})}toAsii(t){return Array.from(t).map(e=>String.fromCharCode(e))}async readFileAsDataURL(t){let e=this;return new Promise((r,i)=>{let n=new FileReader;n.onload=async function(){r(this.result)},n.onerror=function(){r("")},n.readAsDataURL(t)})}async readImageSrcAsBlob(t){return new Promise((e,r)=>{fetch(t).then(i=>{if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);return i.blob()}).then(i=>{console.log("\u56FE\u7247\u5DF2\u8F6C\u6362\u4E3ABlob:",i),e(i)}).catch(i=>{console.error("\u56FE\u7247\u8F6C\u6362\u4E3ABlob\u65F6\u51FA\u9519:",i)})})}async readFileAsUint8(t,e=t.size){e=Math.min(e,t.size);let r=[],i=2*1024*1024,n=0,s=Math.min(i,e);for(;n<e;){let a=new Promise((l,c)=>{let h=new FileReader;h.onload=function(){if(this.result instanceof ArrayBuffer){let u=new Uint8ClampedArray(this.result);l(u)}},h.readAsArrayBuffer(t.slice(n,s))});r.push(a),n=s,s=Math.min(n+i,e)}return Promise.all(r).then(a=>{let l=new Uint8ClampedArray(e);for(let c=0,h=0;c<a.length;c++){let u=a[c];l.set(u,h),h+=u.byteLength}return Promise.resolve(l)})}},VEe=5*1024*1024,_he=class extends kEe{async getImageType(t){let e=await this.readFileAsUint8(t,64),r=this.to16(e),i=l=>{for(let c=0;c<l.length;c++)if(r[c].trim()!==l[c].trim().toUpperCase())return!1;return!0};if(i(["FF","D8"]))return"jpg";if(i(["89","50","4E","47","0D","0A","1A","0A"]))return"png";let n=["47","49","46","38","39","61"],s=["47","49","46","38","37","61"];if(i(n)||i(s))return"gif";if(i(["42","4D"]))return"bmp";let a=this.toAsii(e).join("");return i(["52","49","46","46"])&&a.indexOf("WEBP")>-1?"webp":null}replaceDataUrlMineType(t,e){var i;let r=/^(data:image\/)(.{1,10})(;)/;return((i=t.match(r))==null?void 0:i[2])!==e?t.replace(r,`$1${e}$3`):t}async readFileAsDataURL(t,e){let r=await super.readFileAsDataURL(t);if(r&&e){let i=await this.getImageType(t);i&&(r=this.replaceDataUrlMineType(r,i))}return r}async readImageSrcAsBlob(t){return new Promise((e,r)=>{fetch(t).then(i=>{if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);return i.blob()}).then(i=>{console.log("\u56FE\u7247\u5DF2\u8F6C\u6362\u4E3ABlob:",i),e(i)}).catch(i=>{console.error("\u56FE\u7247\u8F6C\u6362\u4E3ABlob\u65F6\u51FA\u9519:",i)})})}readUrlAsImage(t){return new Promise((e,r)=>{let i=new Image;i.onload=function(n){e({image:i,msg:""})},i.onerror=function(n){e({image:null,msg:"Read image file error."})},i.src=t})}async compressImageByCanvas(t,e=VEe,r,i=.92,n=!1){if(!n&&(r||t.length)<e)return t;{let s=new BEe;return await s.drawImageByUrl(t),await s.getDataUrlWithCompress(e,i)}}},BEe=class{constructor(){this.reset()}readCanvasAsDataURL(t=.92){return this.canvas.toDataURL("image/jpeg",t)}async readCanvasAsBlob(t=.92){return new Promise((e,r)=>{this.canvas.toBlob(i=>e(i),"image/jpeg",t)})}async getDataUrlWithCompress(t,e=.92){let r=!0;for(;e>=.1||r;){r=!1;let i=this.readCanvasAsDataURL(e);if(i.length<=t)return i;e=e-.1}return null}async drawImageByUrl(t){let{canvas:e,ctx:r}=this,i=new Image,n=!1;return new Promise((s,a)=>{i.onload=function(){n||(n=!0,this.width>0&&this.height>0&&(e.width=this.width,e.height=this.height),r.drawImage(i,0,0),s(!0))},i.src=t})}reset(){this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d")}};async function lje(o){let t=new TextEncoder().encode(o),e=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(e)).map(n=>n.toString(16).padStart(2,"0")).join("")}function cje(o,t){let e=o.width,r=o.height,i=t.naturalWidth,n=t.naturalHeight,s=i/n,a=e/10,l=r/10,c=0,h=0,u=0,d=0;return s>a/l?(c=l*s,h=l):(c=a,h=a/s),u=(e-c)/2,d=(r-h)/2,{boardWidth:e,boardHeight:r,sourceMarginLeft:0,sourceMarginTop:0,sourceImageWidth:i,sourceImageHeight:n,drawMarginLeft:u,drawMarginTop:d,drawImageWidth:c,drawImageHeight:h}}function vhe(o,t,e){let r=o.width,i=o.height,n=t.naturalWidth,s=t.naturalHeight,a=e.width,l=e.height,c=(r-a)/2,h=(i-l)/2;return{boardWidth:r,boardHeight:i,sourceMarginLeft:0,sourceMarginTop:0,sourceImageWidth:n,sourceImageHeight:s,drawMarginLeft:c,drawMarginTop:h,drawImageWidth:a,drawImageHeight:l}}function Cq(o){let e=/(\d+(\.\d+)?)([*x ]?)(\d+(\.\d+)?)?\s*([a-zA-Z]+)/i.exec(o);if(e){let r=parseFloat(e[1]),i=parseFloat(e[4])||0,n=e[6].trim(),s=new dt;return n!=="mil"?(i=s.conversion("mm","mil",i)/10,r=s.conversion("mm","mil",r)/10):(i=i/10,r=r/10),{width:i,height:r,unit:"mm"}}else return null}function Sq(o,t){let e=new dt;return t!=="mil"?o=e.conversion(t,"mil",o)/10:o=o/10,o}var FEe=class{constructor(){this.components={};this.initial()}update(t,e){this.isFontAppend(e,t.id)||this.render(t,e);let r=this.components[e][t.id].node;Object.keys(t).forEach(i=>{switch(i){case"transform":{r.style.transform=this.transform(r,t.transform);break}case"content":r.querySelectorAll(".triangleToolFont-content").forEach(s=>{s.textContent=t.content})}})}delete(t,e){this.isFontAppend(t,e)&&(this.components[t][`${e}`].node.remove(),delete this.components[t][e])}render(t,e){if(this.parent||(this.parent=document.querySelector("#canvas-2d").parentNode),this.components[t.id])return console.warn("TriangleToolFont: id duplicate");this.components[e]||(this.components[e]={});let r=this.components[e],i=r[t.id];if(!i){let n=this.createRender(t,e);i={node:n.children[0]},r[t.id]=i,this.parent.appendChild(n)}}isFontAppend(t,e){return this.components[t]&&this.components[t][e]}transform(t,e){let[r,i,n]=e;switch(r){case"leftCenter":{n=n-t.offsetHeight/2;break}case"rightCenter":{i=i-t.offsetWidth,n=n-t.offsetHeight/2;break}case"topCenter":{i=i-t.offsetWidth/2;break}case"bottomCenter":{i=i-t.offsetWidth/2,n=n-t.offsetHeight;break}case"rightTop":{i=i-t.offsetWidth;break}case"rightBottom":{i=i-t.offsetWidth,n=n-t.offsetHeight;break}case"leftBottom":{n=n-t.offsetHeight;break}}return`translate(${i}px, ${n}px)`}initial(){let t=this.components[R.getInstance().id]||{};Object.keys(t).forEach(e=>{t[e]&&(t[e].node.style.display="block")})}createRender(t,e){let r=`
			<div 
				class="TriangleToolFont-${t.id}"
				style="
					position: absolute; 
					left: 0; 
					top: 0;
					z-index: 999;
					padding: 4px 9px;
					background-color: rgba(0, 0, 0, 0.9); 
					color: white;
					border: 1px solid rgb(80, 80, 80, 0.5); 
					box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 10px 5px; 
					letter-spacing: 1px;
					pointer-events: none;
					width: auto; 
					height: auto;
				"
				${e?'data-host-id="'+e+'"':""}
			>
				<span class="triangleToolFont-content">${t.content}</span>
			</div>
    	`;return document.createRange().createContextualFragment(r)}},aje=new FEe;function GEe(o){let t=R.getInstance().id;o.options.forEach(e=>{if(e.transform){let[r,i,n]=e.transform;e.transform[1]=e.transform[1],e.transform[2]=e.transform[2]}switch(e.operate){case"update":{aje.update(e,t);break}case"delete":{aje.delete(t,e.id);break}}})}var UEe=class{constructor(){this.unitConversion=new dt;this.start=null;this.end=null;this.line1=null;this.line2=null;this.line3=null;this.arc=null;this.lines=new Array;this.fonts=new Array;this.statisticFontsId=new Set;this.dx="";this.dy="";this.length="";this.angle="";this.isFilpPath=!1;this.oldScale=0;this.isRuning=!1;this.creepageDistanceIns=null}getOriginPoint(t,e){let r=e.sub(t),i;return this.isFilpPath?i=this.start.add(new S(0,r.y)):i=this.start.add(new S(r.x,0)),i}calculateCreepageDistance(t,e){var P;if(this.creepageDistanceIns!=null){for(let T of this.creepageDistanceIns.lines)T.remove();this.creepageDistanceIns.font.remove(),this.creepageDistanceIns=null}let r=t.elements[0],i=e.elements[0];if(!r||!i)return;let n=M6(r.model),s=M6(i.model),a=r.model,l=i.model;if(!n||!s||n===""||s==="")return;let h=new rV().measure(r.model,i.model,void 0,(T,I)=>{he.publish("ui/toastMsg",{type:"error",msg:"Selection failed. Selected object is not within the board outline."},f0())});if(h===null)return;let u=h.path,d=this.getLengthInfo(h.realDistance),p=h.realDistance,m=[],g=new _e;for(let T of u){if(T instanceof M){let I=Vi.build(1001,T.start(),T.end(),.01);m.push(I)}else if(T instanceof q){let I=es.build(1001,T.center,T.rx,.01,Xh(T.startAngle),Xh(T.endAngle()),T.sweep());m.push(I)}g.ext1(T.bbox())}let y=(P=g.build())==null?void 0:P.center(),b=new KA(this.getDisplayText(p),y,0,10,20,30,40,1001);this.creepageDistanceIns={lines:m,font:b,path:u,pathDistance:d,realDistance:p,showRichInfo:gh.showRichInfo}}modifyTriangle(t,e,r=!1){this.isRuning=!0,this.start!=null&&(this.end!=null&&!r&&this.end.equals(t)?this.modifyRule(this.start,t,e,r):(this.modifyLine(this.start,t,e),this.modifyRule(this.start,t,e,r),this.modifyStatisticFonts(this.start,t,e)))}modifyRule(t,e,r,i=!1){let n=Ai().getScale();if(!i&&Math.abs(n-this.oldScale)<1e-8&&this.end!=null)return;this.oldScale=n;let{startAngle:s,endAngle:a}=this.getStartAndEndAngle(this.start,e);if(this.arc!=null){(this.arc.center.x!==e.x||this.arc.center.y!==e.y)&&(this.arc.center=e),this.arc.startAngle!==s&&(this.arc.startAngle=s),this.arc.endAngle!==a&&(this.arc.endAngle=a);let E=this.getSweep(t,e);this.arc.sweep!==E&&(this.arc.sweep=E)}else this.arc=gs.build(1002,e,40/n,s,a,this.getSweep(t,e),this.getColor());this.lines.forEach(E=>{E.remove()}),this.lines.length=0,this.fonts.forEach(E=>{E.remove()}),this.fonts.length=0;let l=0,c=n;for(;;)if(c>=1){if(c=c/10,c<1)break;l++}else if(c=c*10,l--,c>=1)break;let h=n/Math.pow(10,l),u;h>=1&&h<2?u=Math.pow(10,l):h>=2&&h<5?u=2*Math.pow(10,l):u=5*Math.pow(10,l);let d=10/u,p=t.distance1(r),m=e.distance1(r),g=e.sub(r).normalize(),y=t.sub(r).normalize(),b=1,P=20/n,T=14/n,I=8/n,C=20/n;for(let E=d;E<=p;E+=d){let O=r.add(y.mul(E)),_;if(b%10==0){_=O.add(g.mul(P));let v=new KA(this.conversion(E),_,0,5,15,1e5,C,1002);this.fonts.push(v)}else b%5==0?_=O.add(g.mul(T)):_=O.add(g.mul(I));let x=new cr(1002,O,_,!0,this.getColor());this.lines.push(x),b++}b=1;for(let E=d;E<=m;E+=d){let O=r.add(g.mul(E)),_;if(b%10==0){_=O.add(y.mul(P));let v=this.conversion(E),D=new KA(v,_.add(y.mul(P)),0,5,15,1e5,C,1002);this.fonts.push(D)}else b%5==0?_=O.add(y.mul(T)):_=O.add(y.mul(I));let x=new cr(1002,O,_,!0,this.getColor());this.lines.push(x),b++}}getStartAndEndAngle(t,e){let r=0,i=0;return e.x>t.x?(r=e.y<=t.y?90*(Math.PI/180):-90*(Math.PI/180),i=this.getAngle(t,e)):e.x<t.x&&(r=this.getAngle(t,e),i=e.y<=t.y?90*(Math.PI/180):-90*(Math.PI/180)),{startAngle:r,endAngle:i}}modifyStatisticFonts(t,e,r){let n=R.getInstance().getRatio()/Ai().getScale(),s=t,a=e;this.isFilpPath&&(s=e,a=t);let l=s.distance1(r),c=a.distance1(r);this.dx=this.getLengthInfo(l),this.dy=this.getLengthInfo(c),this.length=this.getLengthInfo(t.distance1(e));let{startAngle:h,endAngle:u}=this.getStartAndEndAngle(this.start,e);this.angle=(Math.abs(h-u)/Math.PI*180).toFixed(3)+"\xB0";let d=s.sub(r).normalize(),p=a.sub(r).normalize(),m=this.arc.radius,g=s.add(r).mul(.5),y=a.add(r).mul(.5),b=t.add(e).mul(.5).add(d.mul(10*n)),P=e,T=d.dot(new S(we.flipBoard?-1:1,0))>0,I=p.dot(new S(0,1))>0,C=I?"topCenter":"bottomCenter",E=T?"rightCenter":"leftCenter",O=Number(I)^Number(this.isFilpPath)?"bottomCenter":"topCenter",_=T?"leftBottom":"rightBottom";!I&&(_=T?"leftTop":"rightTop");let x=this.dx,v=this.dy,D=this.length,w=this.angle;if(this.isFilpPath?P=e.sub(p.mul(23*n)):I||(O=T?"leftTop":"rightTop"),this.isFilpPath?l>.1&&c<.1?(E=T?"rightTop":"leftTop",P=P.add(new S(0,1).mul(43*n))):l<.1&&c>.1&&(E="rightCenter",g=g.sub(p.mul(43*n)),I?(O="leftTop",C="leftTop"):(O="leftBottom",C="leftBottom")):l>.1&&c<.1?(T?(E="rightTop",y=y.sub(d.mul(m+10*n))):E="leftTop",P=P.add(new S(0,1).mul(65*n))):l<.1&&c>.1&&(I?(O="rightBottom",C="rightTop"):(O="rightTop",C="rightBottom")),l<.1&&c<.1&&(P=r.add(new S(0,1).mul(m)),g=r.add(new S(-1,0).mul(m)),y=r.add(new S(1,0).mul(m)),O="bottomCenter",C="rightCenter",E="leftCenter"),c>.1&&l>.1){let z=24*n,V,W=!1;if(this.isFilpPath?(T&&c<m||!T&&l<m)&&(V=s.add(new S(1,0).mul(m)),W=!0):(!T&&c<m||T&&l<m)&&(V=I?a:r,V=V.add(new S(1,0).mul(m)),W=!0),W){let L=window["SILKVIEWER-SOURCE"]=="FOREIGN-TRADE";V=V.add(new S(0,1).mul(z)),C="leftTop",E="leftTop",O="leftTop",_="leftTop",g=V,y=g.add(new S(0,-1).mul(z)),P=y.add(new S(0,-1).mul(z)),b=P.add(new S(0,-1).mul(z)),x="DX: "+x,v="DY: "+v,w=L?"R":"\u89D2\u5EA6: "+w,D=L?"L":"\u957F\u5EA6: "+D}}let F=[];if(this.pushStatisticFontData(F,"dX",C,g,x),this.pushStatisticFontData(F,"dY",E,y,v),this.pushStatisticFontData(F,"angle",O,P,w),Math.abs(l)<1e-8||Math.abs(c)<1e-8?this.deleteStatisticFonts("length"):this.pushStatisticFontData(F,"length",_,b,D),R.getInstance().envFlag=="silk-preview"){GEe({options:F});return}he.windowBridge.publish("RenderTriangleToolFont",{options:F},f0())}deleteStatisticFonts(t){if(!this.statisticFontsId.has(t))return;if(R.getInstance().envFlag=="silk-preview"){GEe({options:[{operate:"delete",id:t}]});return}he.windowBridge.publish("RenderTriangleToolFont",{options:[{operate:"delete",id:t}]},f0()),this.statisticFontsId.delete(t)}pushStatisticFontData(t,e,r,i,n){i=_o(i);let s=[r,i.x,i.y];t.push({operate:"update",id:e,transform:s,content:n}),this.statisticFontsId.add(e)}getColor(){return le.pcbConfig.graphicEffectMode=="effectFirst"?ee.WHITE:ee.build(1,1,1,.7)}modifyLine(t,e,r){this.line1!=null?(this.line1.start=r,this.line1.end=t):this.line1=new cr(1002,r,t,!0,this.getColor()),this.line2!=null?(this.line2.start=r,this.line2.end=e):this.line2=new cr(1002,r,e,!0,this.getColor()),this.line3!=null?(this.line3.start=t,this.line3.end=e):this.line3=new cr(1002,t,e,!0,this.getColor())}getAngle(t,e){let r=t.sub(e).normalize();return Math.atan2(r.y,r.x)}getSweep(t,e){let r=t.sub(e).normalize();return new S(1,0).cross(r)>=0?ae.CCW:ae.CW}conversion(t){let e=this.unitConversion.conversion("mil",R.getInstance().unit,t);return e=Math.round(e*1e4)/1e3,e.toString()}getLengthInfo(t){let e=this.unitConversion.conversion("mil","mm",t)*10;e=Math.round(e*1e3)/1e3;let r=Math.round(t*100)/10;return e.toFixed(3)+"mm"+"("+r.toFixed(1)+"mil)"}getDisplayText(t){if(!gh.showRichInfo){let e=this.unitConversion.conversion("mil","mm",t)*10;return e=Math.round(e*1e3)/1e3,e.toFixed(3)+"mm"}return this.getLengthInfo(t)}updateSavedMeasurementsDisplay(){var t;if(this.creepageDistanceIns!=null&&this.creepageDistanceIns.showRichInfo===gh.showRichInfo){this.creepageDistanceIns.font.remove();let e=this.getDisplayText(this.creepageDistanceIns.realDistance),r=new _e;for(let n of this.creepageDistanceIns.path)r.ext1(n.bbox());let i=(t=r.build())==null?void 0:t.center();this.creepageDistanceIns.font=new KA(e,i,0,10,20,30,40,1001)}}destroy(){this.start=null,this.end=null,this.line1!=null&&(this.line1.remove(),this.line1=null),this.line2!=null&&(this.line2.remove(),this.line2=null),this.line3!=null&&(this.line3.remove(),this.line3=null),this.arc!=null&&(this.arc.remove(),this.arc=null),this.lines.forEach(t=>{t.remove()}),this.lines.length=0,this.fonts.forEach(t=>{t.remove()}),this.fonts.length=0;for(let t of this.statisticFontsId)this.deleteStatisticFonts(t);if(this.creepageDistanceIns!=null){for(let t of this.creepageDistanceIns.lines)t.remove();this.creepageDistanceIns.font.remove(),this.creepageDistanceIns=null}this.isRuning=!1}},tn=new UEe;var HEe=class{constructor(){}getMinDistResultAboutDotAndElement(t,e,r="CENTER",i){let n={minDistValue:0,minline:null},s=this.getCalcOutline(t,r,+i),a=this.createPrimitiveSet(s),l=Number.MAX_SAFE_INTEGER;for(let c of a){let h=new Eu(e,c),u=h.getDistance();l>=u&&(l=u,n.minDistValue=l,n.minline=h.getLine())}return n}getMinDistResultAboutElementAndElement(t,e,r="CENTER",i="CENTER",n,s){let a={minDistValue:0,minline:null,swap:!1},l=this.getCalcOutline(t,r,+n),c=this.getCalcOutline(e,i,+s),h=this.createPrimitiveSet(l),u=this.createPrimitiveSet(c),d=null,p=!1;h.size<=1e3&&u.size<=1e3?d=this.findMinDistItemByLoop(h,u):(p=!0,d=this.findMinDistItemBySearch(h,u)),p&&(d===null||typeof d>"u")&&(d=this.findMinDistItemByLoop(h,u));let m=!1,g=null;if(d){g=d.getLine().start();let y=new Eu(new M(g,g),d.pt1),b=new Eu(new M(g,g),d.pt2),P=y.getDistance()>b.getDistance()?b:y;(u.has(P.pt1)||u.has(P.pt2))&&(m=!0),a.minDistValue=d.getDistance(),a.minline=d.getLine()}return a.swap=m,a}createPrimitiveSet(t){let e=new Set;if(!t)return e;if(t instanceof rl)return e.add(t),e;if(t instanceof ge){for(let r of t.primitives)e.add(r);return e}if(t instanceof Bt){for(let r of t.items)for(let i of r.primitives)e.add(i);return e}for(let r of t)for(let i of r.primitives)e.add(i);return e}getCalcOutline(t,e,r){if(t instanceof Ge)return e=="CENTER"?t.primitive:t.getMathGraphics(t.layerId);if(t instanceof Le){if(e=="CENTER"){let i=t.getMathGraphics(r);return i===null?null:new M(i.bbox().center(),i.bbox().center())}return t.getMathGraphics(r)}if(t instanceof Ue)return e=="CENTER"?new M(t.center,t.center):t.getMathGraphics(r);if(t instanceof Dp||t instanceof lr){if(e=="CENTER"){let n=t.buildBBox().center();return new M(n,n)}return t.getMathGraphics(t.layerId,0)}if(t instanceof Qp){if(e=="CENTER"){if(t instanceof Jr){let s=t.getOutline(),a=new Array;if(t.style=="solid"){let c=t.buildBBox().center();return new M(c,c)}for(let l of s)a.push(l);return a}let n=t.buildBBox().center();return new M(n,n)}if(t instanceof Jr){let i=t.getOutline(),n=new Array;if(t.style=="solid"){if(xe.addAll(n,i),t.optimization)for(let s of i)for(let a of s.primitives){let l=a.stroke(t.optimizationWidth,wr.ROUND,ae.CCW);n.push(l)}}else for(let s of i)for(let a of s.primitives){let l=a.stroke(t.gridLineWidth,wr.ROUND,ae.CCW);n.push(l)}return n}return t instanceof Gi?t.getOutline():null}if(t instanceof ke)return e=="CENTER"?new M(t.position,t.position):t.getMathGraphics(t.layerId,0);if(t instanceof mt||t instanceof _t)return e=="CENTER"?t.primitive:t.getMathGraphics(t.layerId,0);if(t instanceof He){let i=t.getMathGraphics();if(e=="CENTER"){if(t.type=="Fill Region"||t.type=="Constraint Region"||t.type=="Slot Region"||t.type=="Prohibited Region"||t.type=="FPC Stiffener"||t.type=="3D Shell - Top Slot Region"||t.type=="3D Shell - Side Slot Region"||t.type=="3D Shell - Side Entity"||t.type=="TearDrop"){let a=t.buildBBox().center();return new M(a,a)}return i}if(t instanceof Pr){let s=i.primitives[0],a=q.build3(s.center,0,180,s.rx,s.ry),l=q.build3(s.center,180,360,s.rx,s.ry);i=ge.build2([a,l])}let n=new Array;if(["Copper Region","Fill Region","Slot Region","Prohibited Region","Constraint Region","FPC Stiffener","3D Shell - Outline","3D Shell - Side Slot Region","3D Shell - Top Slot Region","3D Shell - Top/Bottom Entity","3D Shell - Side Entity"].includes(t.type))for(let s of i.primitives){let a=ge.build4([s.start(),s.end()]);n.push(a)}else for(let s of i.primitives){let a=s.stroke(t.strokeWidth,wr.ROUND,ae.CCW);n.push(a)}return n}return null}buildStaticRTree(t){let e=new ji(10);for(let r of t)e.add(r);return e}findMinDistItemByLoop(t,e){let r=null,i=Number.MAX_SAFE_INTEGER;for(let n of t)for(let s of e){let a=new Eu(n,s),l=a.getDistance();i>=l&&(i=l,r=a)}return r}findMinDistItemBySearch(t,e){return t.size>=e.size?this.searchRtree(t,e):this.searchRtree(e,t)}searchRtree(t,e){let r=null,i=.01,n=of(),s=n.width(),a=n.height(),l=a>=s?a:s,c=this.buildStaticRTree(t),h=(d,p,m)=>{let g=null,y=!0;for(let b of p){let P=b.bbox().extendOfSize(m),T=d.search(P);for(let I of T){let C=new Eu(b,I),E=C.getDistance();if(y){y=!1,m=E,g=C;continue}m>=E&&(m=E,g=C)}}return g},u=1e-5;for(;u<=l;){if(r=h(c,e,u),r)return r;u+=i}return r}},r_=new HEe;var hu=class o extends fI{static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}constructor(){super(),this._distMeasureParams=new Ohe,this._isOpenedContextmenu=!1,this._hasSettingResult=!1}get distMeasureParams(){return this._distMeasureParams}set distMeasureParams(t){this._distMeasureParams=t}get isOpenedContextmenu(){return this._isOpenedContextmenu}set isOpenedContextmenu(t){this._isOpenedContextmenu=t}get hasSettingResult(){return this._hasSettingResult}set hasSettingResult(t){this._hasSettingResult=t}setAllElementsInitStatus(){let t=this.getAllElements();for(let e=0;e<t.length;e++)[this.distMeasureParams.startTarget.elementId,this.distMeasureParams.endTarget.elementId].indexOf(t[e].globalIndex)>=0&&t[e].visible()}createMeasureResulBySelectTarget(t,e){this.distMeasureParams.startTarget.allElements=t.elements,this.distMeasureParams.startTarget.elementId=null,this.distMeasureParams.startTarget.isBeFilledType=!0,this.distMeasureParams.startTarget.x=0,this.distMeasureParams.startTarget.y=0,this.distMeasureParams.startTarget.sourceX=t.x,this.distMeasureParams.startTarget.sourceY=t.y,this.distMeasureParams.startTarget.type="DOT",this.distMeasureParams.startTarget.position="EDGE",this.distMeasureParams.endTarget.allElements=e.elements,this.distMeasureParams.endTarget.elementId=null,this.distMeasureParams.endTarget.isBeFilledType=!0,this.distMeasureParams.endTarget.x=0,this.distMeasureParams.endTarget.y=0,this.distMeasureParams.endTarget.sourceX=e.x,this.distMeasureParams.endTarget.sourceY=e.y,this.distMeasureParams.endTarget.type="DOT",this.distMeasureParams.endTarget.position="EDGE",this.distMeasureParams.measureResult.dx=tn.dx,this.distMeasureParams.measureResult.dy=tn.dy,this.distMeasureParams.measureResult.distance=tn.length,this.distMeasureParams.measureResult.angle=tn.angle+"",gh.measureMode==="CreepageDistance"?(this.distMeasureParams.measureResult.distance=tn.creepageDistanceIns.pathDistance,console.log(this.distMeasureParams.measureResult.distance),t.elements.length&&(this.distMeasureParams.startTarget.type="CREEPAGE",Iq(t.elements,this.distMeasureParams.startTarget)),e.elements.length&&(this.distMeasureParams.endTarget.type="CREEPAGE",Iq(e.elements,this.distMeasureParams.endTarget))):(t.elements.length&&(this.distMeasureParams.startTarget.type="OBJECT",Iq(t.elements,this.distMeasureParams.startTarget)),e.elements.length&&(this.distMeasureParams.endTarget.type="OBJECT",Iq(e.elements,this.distMeasureParams.endTarget))),this.refreshMeasureResultBySelectedElements()}createHeader(t){let e=this.createBaseHeader();return e.id=t,e.action=t,e.tabId=R.getInstance().tabId,e}createBody(t=!1){let e={};return e.measureMode=gh.measureMode,e.showRichInfo=gh.showRichInfo,e.canvas=this.createCanvas(),t&&this.distMeasureParams.reset(),e={...e,...this.distMeasureParams.toJSON()},e}correct(t,e){this.distMeasureParams.startTarget.allElements=t,this.distMeasureParams.endTarget.allElements=e}handleHeaderUpdate(t){}handleBodyUpdate(t){this.updateCommon(t),this.updateCanvas(t.canvas),this.updateTarget("startTarget",t.startTarget),this.updateTarget("endTarget",t.endTarget),A.publish("flushService",""),A.publish("updateFrame","")}refreshMeasureResultBySelectedElements(){let t=new S(this.distMeasureParams.startTarget.sourceX,this.distMeasureParams.startTarget.sourceY),e=new S(this.distMeasureParams.endTarget.sourceX,this.distMeasureParams.endTarget.sourceY);if(this.distMeasureParams.startTarget.allElements.length<=0&&this.distMeasureParams.endTarget.allElements.length<=0){this.flushResult(t,e,null,null);return}let r=Number.MAX_SAFE_INTEGER,i=null,n=null,s=null,a=null;if(this.distMeasureParams.startTarget.allElements.length<=0&&this.distMeasureParams.endTarget.allElements.length>0){for(let c=0;c<this.distMeasureParams.endTarget.allElements.length;c++){let h=r_.getMinDistResultAboutDotAndElement(this.distMeasureParams.endTarget.allElements[c],new M(t,t),this.distMeasureParams.endTarget.position,this.distMeasureParams.endTarget.layerId);h.minline&&r>=h.minDistValue&&(r=h.minDistValue,i=h.minline.start(),n=h.minline.end(),a=this.distMeasureParams.endTarget.allElements[c])}i&&n&&(t.x===n.x&&t.y===n.y?e=i:e=n),this.flushResult(t,e,s,a);return}if(this.distMeasureParams.startTarget.allElements.length>0&&this.distMeasureParams.endTarget.allElements.length<=0){for(let c=0;c<this.distMeasureParams.startTarget.allElements.length;c++){let h=r_.getMinDistResultAboutDotAndElement(this.distMeasureParams.startTarget.allElements[c],new M(e,e),this.distMeasureParams.startTarget.position,this.distMeasureParams.startTarget.layerId);h.minline&&r>=h.minDistValue&&(r=h.minDistValue,i=h.minline.start(),n=h.minline.end(),s=this.distMeasureParams.startTarget.allElements[c])}i&&n&&(e.x===i.x&&e.y===i.y?t=n:t=i),this.flushResult(t,e,s,a);return}let l=!1;for(let c=0;c<this.distMeasureParams.startTarget.allElements.length;c++)for(let h=0;h<this.distMeasureParams.endTarget.allElements.length;h++){let u=r_.getMinDistResultAboutElementAndElement(this.distMeasureParams.startTarget.allElements[c],this.distMeasureParams.endTarget.allElements[h],this.distMeasureParams.startTarget.position,this.distMeasureParams.endTarget.position,this.distMeasureParams.startTarget.layerId,this.distMeasureParams.endTarget.layerId);u.minline&&r>=u.minDistValue&&(r=u.minDistValue,i=u.minline.start(),n=u.minline.end(),l=!!u.swap,s=this.distMeasureParams.startTarget.allElements[c],a=this.distMeasureParams.endTarget.allElements[h])}i&&n&&(l?(t=n,e=i):(t=i,e=n)),this.flushResult(t,e,s,a)}createCanvas(){let t=R.getInstance().unit,e=Bs.conversion1("mil",t,It.getInstance().getGridX()*10),r=Bs.conversion1("mil",t,It.getInstance().getGridY()*10),i=e===r?e+"":e+","+r,n=Bs.conversion1("mil",t,It.getInstance().getSnapX()*10),s=Bs.conversion1("mil",t,It.getInstance().getSnapY()*10),a=n===s?n+"":e+","+s,l={};return l.unit=t,l.gridType=we.gridType,l.blodGridType=we.multiType,l.gridSize=i+"",l.snapSize=a+"",l.adsorb=we.adsorb?"yes":"no",l}updateCommon(t){gh.showRichInfo!=t.showRichInfo&&(gh.showRichInfo=t.showRichInfo,tn.updateSavedMeasurementsDisplay());let e=gh.measureMode;gh.measureMode=t.measureMode,this.handleToolSwitching(t,e)}handleToolSwitching(t,e){if(t.measureMode!==e&&t.measureMode)switch(A.publish("resetToolLastCmd",""),t.measureMode){case"MeasureDistance":A.publish("tool","MeasureDistance");break;case"CreepageDistance":A.publish("tool","CreepageDistance");break;case"MeasureObjectDistance":A.publish("tool","MeasureObjectDistance");break}}updateTarget(t,e){let r=!1;t==="startTarget"&&(this.distMeasureParams.startTarget.layerId!==e.layerId&&(this.distMeasureParams.startTarget.layerId=e.layerId,r=!0),this.distMeasureParams.startTarget.position!==e.position&&(this.distMeasureParams.startTarget.position=e.position,r=!0)),t==="endTarget"&&(this.distMeasureParams.endTarget.layerId!==e.layerId&&(this.distMeasureParams.endTarget.layerId=e.layerId,r=!0),this.distMeasureParams.endTarget.position!==e.position&&(this.distMeasureParams.endTarget.position=e.position,r=!0)),r&&(gh.measureMode==="CreepageDistance"?this.recalculateCreepageDistance():this.refreshMeasureResultBySelectedElements())}updateCanvas(t){let e=R.getInstance().unit,r=Bs.conversion1("mil",e,It.getInstance().getGridX()*10),i=Bs.conversion1("mil",e,It.getInstance().getGridY()*10),n=r===i?r+"":r+","+i,s=Bs.conversion1("mil",e,It.getInstance().getSnapX()*10),a=Bs.conversion1("mil",e,It.getInstance().getSnapY()*10),l=s===a?s+"":r+","+a,c=we.gridType,h=we.multiType,u=we.adsorb;t.unit!==e&&eC(t.unit),t.gridType!==c&&(we.gridType=t.gridType,A.messageBus.publish("switchGridType",t.gridType),A.publish("switchGridTypeBtn",t.gridType,Q())),t.blodGridType!==h&&(we.multiType=t.blodGridType,A.messageBus.publish("switchMultiGridType",t.blodGridType)),t.gridSize!==n&&this.updateCanvasGirdSnap("gridSize",t.gridSize),t.snapSize!==l&&this.updateCanvasGirdSnap("snapSize",t.gridSize);let d=t.adsorb==="yes";d!==u&&A.publish("toggleAdsorb",d)}updateCanvasGirdSnap(t,e){let r=e.split(/,|，/),i=0,n=0;r.length==1?i=n=parseFloat(r[0]):r.length==2&&(i=parseFloat(r[0]),n=parseFloat(r[1])),!(isNaN(i)||isNaN(n))&&(i=Pa(i,R.getInstance().unit=="mil"?1:3),n=Pa(n,R.getInstance().unit=="mil"?1:3),t==="gridSize"&&(It.getInstance().setGridX(Bs.conversion(R.getInstance().unit,"mil",i)/10),It.getInstance().setGridY(Bs.conversion(R.getInstance().unit,"mil",n)/10),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q())),t==="snapSize"&&(It.getInstance().setSnapX(Bs.conversion(R.getInstance().unit,"mil",i)/10),It.getInstance().setSnapY(Bs.conversion(R.getInstance().unit,"mil",n)/10),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q())),np())}flushResult(t,e,r,i){let n=R.getInstance().origin;if(gh.measureMode=="CreepageDistance")tn.start=t,tn.end=e,tn.creepageDistanceIns!=null&&(this.distMeasureParams.measureResult.distance=tn.creepageDistanceIns.pathDistance);else{tn.destroy(),tn.start=t,tn.end=e;let s=tn.getOriginPoint(tn.start,tn.end);tn.modifyTriangle(tn.end,s,!0),tn.modifyStatisticFonts(tn.start,tn.end,s),this.distMeasureParams.measureResult.dx=tn.dx,this.distMeasureParams.measureResult.dy=tn.dy,this.distMeasureParams.measureResult.distance=tn.length,this.distMeasureParams.measureResult.angle=tn.angle+""}r&&(this.distMeasureParams.startTarget.elementId=`${Tr}${r.number}`),this.distMeasureParams.startTarget.x=Tq(t.x-n.x),this.distMeasureParams.startTarget.y=Tq(t.y-n.y),i&&(this.distMeasureParams.endTarget.elementId=`${Tr}${i.number}`),this.distMeasureParams.endTarget.x=Tq(e.x-n.x),this.distMeasureParams.endTarget.y=Tq(e.y-n.y),A.publish("updateFrame",""),A.publish("FlushSketcherAttrView",{type:"DIST_MEASURE"})}recalculateCreepageDistance(){let t={x:this.distMeasureParams.startTarget.sourceX,y:this.distMeasureParams.startTarget.sourceY,hasValue:!0,elements:this.distMeasureParams.startTarget.allElements},e={x:this.distMeasureParams.endTarget.sourceX,y:this.distMeasureParams.endTarget.sourceY,hasValue:!0,elements:this.distMeasureParams.endTarget.allElements};tn.calculateCreepageDistance(t,e),tn.creepageDistanceIns!=null&&(this.distMeasureParams.measureResult.distance=tn.creepageDistanceIns.pathDistance),A.publish("updateFrame",""),A.publish("FlushSketcherAttrView",{type:"DIST_MEASURE"})}getAllCopperResults(t){let e=new Set;for(let r=0;r<t.length;r++)if(t[r].coppers){let i=t[r].coppers;for(let n=0;n<i.length;n++)e.add(i[n])}return e}getAllElements(){let t=Kc(),e=new Set(Kc()),r=new Set(rD()),i=this.getAllCopperResults(t),n=new Array;return xe.addAll(n,e),xe.addAll(n,r),xe.addAll(n,i),n}};var lG=class extends ni{constructor(e){super();this.isMouseRightDown=!1;this.isMouseMidDown=!1;this.isHoldPCBAttrPanel=!0,this.isMouseLeftDown=!1,this.mouseRightDownPageX=0,this.mouseRightDownPageY=0,this.selectedItems=e,this.hoverItems=new Set,this.initSelectTarget(),this.option="OPTIONLEFTUP",this.initSketcherAttrPanel()}updateSelectedItems(e){this.selectedItems=e}getSelctedItems(){return this.selectedItems}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":this.cancel();break;case"Filp Path While Drawing":tn.isFilpPath=!tn.isFilpPath,this.onMouseMove(e);break;case"Scroll Right":case"Scroll Left":case"Scroll Up":case"Scroll Down":if(tn.start){let i=tn.end||new S(e.sceneX,e.sceneY);tn.modifyStatisticFonts(tn.start,i,tn.getOriginPoint(tn.start,i))}break;case"Finish":this.onEnterPlace(e);break}he.publish("updateFrame","")}onMouseLeftDown(e){this.isMouseLeftDown=!0,this.startTarget.hasValue&&this.endTarget.hasValue&&(this.selectTargetReset(),hu.getInstance().distMeasureParams.reset(),hu.getInstance().setAllElementsInitStatus(),hu.getInstance().hasSettingResult=!1,he.publish("FlushSketcherAttrView",{type:"DIST_MEASURE"}),this.end())}onMouseLeftUp(e){this.isMouseLeftDown=!1;let r=this.startTarget.hasValue?this.endTarget:this.startTarget,i=this.getFilteredPcbItemByClickedPoint(e);r.x=e.sceneX,r.y=e.sceneY,r.elements=i.target,r.hasValue=!0;let n=new S(e.sceneX,e.sceneY);if(tn.start==null)this.start(),tn.start=n;else if(tn.end==null)switch(tn.end=n,gh.measureMode){case"MeasureDistance":case"MeasureObjectDistance":{he.publish("MeasureDistance",{dx:tn.dx,dy:tn.dy,length:tn.length,angle:tn.angle},Q());let s=tn.getOriginPoint(tn.start,tn.end);hu.getInstance().hasSettingResult=!0,tn.modifyTriangle(tn.end,s),tn.modifyStatisticFonts(tn.start,tn.end,s),hu.getInstance().createMeasureResulBySelectTarget(this.startTarget,this.endTarget),he.publish("updateFrame","");break}case"CreepageDistance":{if(hu.getInstance().hasSettingResult=!0,tn.calculateCreepageDistance(this.startTarget,this.endTarget),tn.creepageDistanceIns==null){this.selectTargetReset(),tn.destroy(),hu.getInstance().hasSettingResult=!1,he.publish("updateFrame","");break}he.publish("MeasureDistance",{length:tn.creepageDistanceIns.pathDistance},Q()),hu.getInstance().createMeasureResulBySelectTarget(this.startTarget,this.endTarget),he.publish("updateFrame","");break}}else tn.destroy(),tn.start=n}onMouseRightDown(e){this.isMouseRightDown=!0,this.mouseRightDownPageX=e.mouseX,this.mouseRightDownPageY=e.mouseY}onMouseRightUp(e){if(this.isMouseRightDown=!1,!(e.mouseX!==this.mouseRightDownPageX||e.mouseY!==this.mouseRightDownPageY)){if(le.pcbConfig.endDrawing==="ctrl+rightClick"){if(e.ctrlKey){this.isMouseRightDown=!1,e.clearCrossFlag(),this.cancel();return}this.rightClickMenuData(e);return}if(e.ctrlKey){this.rightClickMenuData(e);return}e.clearCrossFlag(),this.cancel(),hu.getInstance().hasSettingResult=!1}}onMouseWheel(e){if(this.isMouseMidDown=e.middleDown,tn.start!=null){let r=new S(e.sceneX,e.sceneY),i=tn.end||r,n=tn.getOriginPoint(tn.start,i);tn.statisticFontsId.size&&tn.modifyStatisticFonts(tn.start,i,n)}}onMouseMove(e){this.cancelHightlightHoverItems();let r=gh.measureMode=="CreepageDistance"?jd:Df;if(gh.measureMode=="CreepageDistance"){let i=jt.measureFilter(e.realSceneX,e.realSceneY,this.filterCreepageItems(Vr.pointSelectBeforeFilter(e.realSceneX,e.realSceneY).getResult(r)));e:for(let n=0;n<i.length;n++){let s=i[n];if(!(s instanceof He&&s.type==="Copper Region")){if(s instanceof ke){let a=s.getPads();for(let l=0;l<a.length;l++)if(i.indexOf(a[l])>=0)continue e}this.hoverItems.add(s)}}}else{if(gh.measureMode=="MeasureObjectDistance"){let n=jt.measureFilter(e.realSceneX,e.realSceneY,this.filterCreepageItems(Vr.pointSelectBeforeFilter(e.realSceneX,e.realSceneY).getResult(r)));e:for(let s=0;s<n.length;s++){let a=n[s];if(!(a instanceof He&&a.type==="Copper Region")){if(a instanceof ke){let l=a.getPads();for(let c=0;c<l.length;c++)if(n.indexOf(l[c])>=0)continue e}this.hoverItems.add(a)}}}let i=new S(e.sceneX,e.sceneY);if(tn.start!=null){let n=tn.end||i,s=tn.getOriginPoint(tn.start,n);this.drawing&&tn.modifyTriangle(n,s),(this.isMouseRightDown||this.isMouseMidDown)&&tn.statisticFontsId.size&&tn.modifyStatisticFonts(tn.start,n,s)}}this.hightlightHoverItems()}onEnterPlace(e){this.onMouseLeftUp(e),this.onMouseLeftDown(e)}interrupt(){tn.destroy(),this.end()}cancel(){this.interrupt(),this.selectTargetReset(),this.cancelHightlightHoverItems(),he.publish("tool","dropdrag"),he.publish("destoryCanvasCross",null),he.publish("ExitSketcherAttrView",{type:"DIST_MEASURE"})}rightClickMenuData(e){if(this.isMouseLeftDown)return;let r={state:"show",left:e.mouseX,top:e.mouseY,filter:sje(e.adsorb,gh.measureMode=="MeasureObjectDistance")};$t.getInstance().menuData(r,this),this.drawing=!1,hu.getInstance().isOpenedContextmenu=!0}parse(e){let r=e.cmdKey;this.drawing=!0;let i=r.split(":"),n={CreepageDistance:"CreepageDistance",MeasuringDistance:"MeasureDistance",OBJECT_PRIORITY:"MeasureObjectDistance"};switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":he.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":he.publish("openSystemDialog","ADSORPTION",Q());break;case"CreepageDistance":case"MeasuringDistance":case"OBJECT_PRIORITY":{gh.measureMode=n[i[0]],he.publish("FlushSketcherAttrView",{type:"DIST_MEASURE"});break}}hu.getInstance().isOpenedContextmenu=!1,he.publish("updateFrame","")}initSelectTarget(){this.startTarget={x:-1,y:-1,hasValue:!1,elements:[]},this.endTarget={x:-1,y:-1,hasValue:!1,elements:[]}}selectTargetReset(){this.startTarget.elements.forEach(e=>{e.visible()}),this.startTarget.elements=[],this.startTarget.x=this.startTarget.y=-1,this.startTarget.hasValue=!1,this.endTarget.elements.forEach(e=>{e.visible()}),this.endTarget.x=this.endTarget.y=-1,this.endTarget.hasValue=!1,this.endTarget.elements=[]}filterCreepageItems(e){if(gh.measureMode=="CreepageDistance"){let r=new Set;for(let i of e)i instanceof Qo&&Ud(i.layerId)&&r.add(i);return r}else return e}getFilteredPcbItemByClickedPoint(e){let r={target:[]};if(gh.measureMode=="MeasureDistance")return r;let i=gh.measureMode=="CreepageDistance"?jd:Df,n=jt.measureFilter(e.realSceneX,e.realSceneY,this.filterCreepageItems(Vr.pointSelectBeforeFilter(e.realSceneX,e.realSceneY).getResult(i)));if(n.length===1&&n[0]instanceof Le){let s=this.findOtherPadsByPadsPairs(n[0]);n=[].concat(n,s)}return r.target=n,r}initSketcherAttrPanel(){let e=this.getSelctedItems(),r=[];for(let a=0;a<e.length;a++){let l=e[a];l instanceof mn||l instanceof ix||l instanceof ua||l instanceof gy||l instanceof He&&l.type==="Copper Region"||r.push(l)}let i=[],n=[],s=-1;for(let a=0;a<r.length;a++)if(!(i.indexOf(r[a])>=0)){if(r[a]instanceof Ge){s++,n[s]||(n[s]=[]);let l=jt.filterTrack(r[a],"whole");for(let c=0;c<l.length;c++)r.indexOf(l[c])>=0&&(n[s].push(l[c]),i.push(l[c]));continue}s++,n[s]||(n[s]=[]),n[s].push(r[a])}if(n.length===2){if(this.startTarget.elements=n[0],this.startTarget.elements.length===1&&this.startTarget.elements[0]instanceof Le){let a=this.findOtherPadsByPadsPairs(this.startTarget.elements[0]);this.startTarget.elements=[].concat(this.startTarget.elements,a)}if(this.startTarget.hasValue=!0,this.endTarget.elements=n[1],this.endTarget.elements.length===1&&this.endTarget.elements[0]instanceof Le){let a=this.findOtherPadsByPadsPairs(this.endTarget.elements[0]);this.endTarget.elements=[].concat(this.endTarget.elements,a)}this.endTarget.hasValue=!0,gh.measureMode="MeasureObjectDistance",hu.getInstance().createMeasureResulBySelectTarget(this.startTarget,this.endTarget),hu.getInstance().hasSettingResult=!0;return}he.publish("FlushSketcherAttrView",{type:"DIST_MEASURE",isInitAllParams:!0})}hightlightHoverItems(){this.hoverItems.forEach(e=>{e.click()})}cancelHightlightHoverItems(){this.hoverItems.forEach(e=>{this.startTarget.elements.indexOf(e)<=-1&&this.endTarget.elements.indexOf(e)<=-1&&(e.visible(),this.hoverItems.delete(e))}),this.hoverItems.clear()}findOtherPadsByPadsPairs(e){let r=[],i=[],n=re.getInstance().getAllPadsPairGroupsInstances();e:for(let s=0;s<n.length;s++){let a=n[s].toJSON_ofDeatails();for(let l=0;l<a.length;l++){let c=Object.values(a[l]).map(u=>u.id),h=c.indexOf(e.globalIndex);if(h>=0){c.splice(h,1),i=Array.from(c);break e}}}for(let s=0;s<i.length;s++){let a=Qt.getItem(i[s]);a&&r.push(a)}return r}};var Qb=class o extends Oo{constructor(){super();this.editedColor=ee.of3("#FF9700");this.selectedColor=ee.of3("3673FE");this.items=[];this.hoverItems=new Set;this.counterBoresMap=new Map;this.counterBoresLabelMap=new Map}static getInstance(){return o._instance||(o._instance=new o),o._instance}initEditedItems(e){for(let r of e){let{position:i}=r,{x:n,y:s}=this.convertToMil(i),a=this.getItemByPosition(n,s);a.color=this.editedColor,this.counterBoresMap.set(a.globalIndex,r),this.renderCounterBoreLabel(a,r)}}onMouseLeftDown(e){this.clearItems();let r=e.realSceneX,i=e.realSceneY,n=this.getItemByPosition(r,i),s=Pe.getActiveLayerID();if(n){this.items.push(n),n.color=this.selectedColor;let a=_o(n.center),l={position:{x:je(n.center.x,null,"mm"),y:je(n.center.y,null,"mm")},smallHoleSize:je(n.radius*2,null,"mm"),layerId:s,isPTH:n instanceof Ue,screenPosition:{x:a.x,y:a.y}};if(this.counterBoresMap.has(n.globalIndex)){let c=this.counterBoresMap.get(n.globalIndex);Object.assign(l,c)}A.messageBus.publish("transCounterBore",l)}}onMouseMove(e){let r=e.realSceneX,i=e.realSceneY,n=this.getItemByPosition(r,i);if(n)this.hoverItems.add(n),n.color=this.selectedColor;else{for(let s of this.hoverItems)this.items.find(a=>a.globalIndex==s.globalIndex)?s.color=this.selectedColor:this.counterBoresMap.has(s.globalIndex)?s.color=this.editedColor:s.color=null;this.hoverItems=new Set}}updateSelectedCounterBore(e){if(!e)return!1;let{position:r}=e;if(!r)return!1;let{x:i,y:n}=this.convertToMil(r),s=this.getItemByPosition(i,n);if(!s)return!1;if(e.holeLabel&&this.renderCounterBoreLabel(s,e),this.counterBoresMap.has(s.globalIndex)){let a=this.counterBoresMap.get(s.globalIndex);Object.assign(a,e)}else this.counterBoresMap.set(s.globalIndex,e);return!0}renderCounterBoreLabel(e,r){this.getLabel(e.globalIndex)||this.renderSvg(e,r.holeLabel.toString()),this.updateSvg(e)}getLabel(e){return this.counterBoresLabelMap.get(e)}renderSvg(e,r){let i=this.createSVG(e,r),n=i.children[0];return document.querySelector("#canvas-2d").parentNode.appendChild(i),this.counterBoresLabelMap.set(e.globalIndex,n),n}createSVG(e,r){let i=`<svg t="1726762356052" style="position:absolute;top:0;left:0;pointer-events: none" class="holeLabel-${e.globalIndex}" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1341"
    width="80" height="80">
    <path
        d="M918.884 408.584c0-210.684-170.788-381.028-381.476-381.028-210.676 0-381.476 171.944-381.476 382.628 0 113.168 49.296 213.82 127.564 285.82h-1.216s162.356 144.04 228.036 272.836c0 0 11.252 35.628 27.088 35.628 15.828 0 26.836-37.392 26.836-37.392C629.964 838.22 792.2 692 792.2 692h-0.48c78.032-68 127.164-170.436 127.164-283.416z"
        fill="#FFF" p-id="1342"></path>
   <circle cx="535" cy="410" r="300" fill="#1871ff"></circle>
    
    <text x="450" y="480" fill="#fff" font-size="300px">${r}</text>
</svg>`;return document.createRange().createContextualFragment(i)}updateSvg(e){let r=_o(e.center.add1(0,4)),i=this.counterBoresLabelMap.get(e.globalIndex);i.style.transform=`translate(${r.x-40}px, ${r.y-80}px)`}deleteEditedCounterBore(e){if(!e)return!1;let{position:r}=e;if(!r)return!1;let{x:i,y:n}=this.convertToMil(r),s=this.getItemByPosition(i,n);if(!s)return!1;if(this.counterBoresMap.has(s.globalIndex)){s.color=null,this.counterBoresMap.delete(s.globalIndex);let a=this.getLabel(s.globalIndex);return a&&(a.remove(),this.counterBoresLabelMap.delete(s.globalIndex)),this.items=this.items.filter(l=>l.globalIndex!==s.globalIndex),!0}else return!1}convertToMil(e){let r=Bs.conversion("mm","mil",e.x)/10,i=Bs.conversion("mm","mil",e.y)/10;return{x:r,y:i}}getItemByPosition(e,r){let i=Array.from(Vr.pointSelectBeforeFilter(e,r).getResult(["Circle","Via"]));return i=i.filter(s=>s instanceof Pr&&s.layerId==12||s instanceof Ue),i[0]}clearItems(){if(this.items.length)for(let e of this.items)this.counterBoresMap.has(e.globalIndex)?e.color=this.editedColor:e.color=null;this.items.length=0}onMouseWheel(){for(let[e,r]of this.counterBoresLabelMap.entries())if(r.style.display!=="none"){let i=this.counterBoresMap.get(e).position,{x:n,y:s}=this.convertToMil(i),a=this.getItemByPosition(n,s);this.updateSvg(a)}}};var pxt=Bs.conversion("mm","mil",10)/10,Bp=class o extends ni{constructor(){super();this.template=new Array;this.image=null;this.unit="mm";A.subscribe("updateULSize",this.updateULSize.bind(this))}static getInstance(){return o._instance||(o._instance=new o),o._instance}init(e){this.start(),this.clearUL(),this.initialWidth=e.width,this.initialHeight=e.height,this.initialRotation=e.rotation,this.initialCenter=e.center,this.template=K3(e.path)}place(){let e=Qe.translate(-this.initialWidth/2,this.initialHeight/2),r=this.initialCenter.multiply3(e);this.image=Bn.addImage(this.getLayer(),r,this.initialWidth,this.initialHeight,ut.defaultImage.rotation,!1,!1,this.template),this.initialRotation&&(this.image.rotation=this.initialRotation),this.image.center=this.initialCenter}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY),i=new De("insert ULLogo");this.image!=null&&(this.image.start=r,A.publish("onlySelect",[this.image]),i.addCommand(Ce.dispatch(this.image,"add")),qe.executeCommand(i),A.publish("hasModifyPcbItem",this.image),this.drawing=!1),A.messageBus.publish("updateCode",this.getCurrentULInfo()),A.publish("flushService",""),A.publish("tool","dropdrag")}onMouseMove(e){if(this.drawing){let r=new S(e.sceneX,e.sceneY);this.image!=null?(this.image.layerId!=this.getLayer()&&(this.image.layerId=this.getLayer()),this.image.start=r):this.image=Bn.addImage(this.getLayer(),r,this.initialWidth,this.initialHeight,this.initialRotation,!1,!1,this.template)}}interrupt(){this.image!==null&&(this.image.remove(),A.publish("delete",this.image),this.image=null,A.publish("flushService","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}getLayer(){return Pe.getActiveLayer().layerID}updateULSize(e){this.image&&(e.width&&(this.image.width=e.width),e.height&&(this.image.height=e.height),(e.width||e.height)&&(A.messageBus.publish("updateCode",this.getCurrentULInfo()),gr.model=gr.model,A.publish("tool","dropdrag"),A.publish("updateFrame","")))}getULData(){let e=this.image;if(e){let r=e.layerId,i=e.model.box,n=Eq(i,this.unit),s=e.width/pxt,a=n,l={x:je(e.center.x,null,this.unit),y:je(e.center.y,null,this.unit)},c=Yl(ve(-(e.rotation/Math.PI)*180,3)),h=je(e.width,null,this.unit),u=je(e.height,null,this.unit);return{layerId:r,ratio:s,bbox:a,rotation:c,center:l,width:h,height:u}}else return null}getCurrentULInfo(){if(this.image){let{layerId:r,rotation:i,center:n,width:s,height:a}=this.getULData(),l=2,c,h=this.checkULPosValid();return h&&(c=h),{layerId:r,dataType:l,rotation:i,center:n,width:s,height:a,posCheckedInfo:c}}else return null}checkULPosValid(){if(!PT.isChecked){console.warn("\u672A\u5F00\u542F\u4F4D\u7F6E\u68C0\u6D4B");return}let e=window["SILKVIEWER-SOURCE"]=="FOREIGN-TRADE",r=PT.outlineInfoForQRCode;if(!r)return console.log("\u5F00\u542F\u68C0\u6D4B\uFF0C\u4F46\u662F\u5E76\u6CA1\u6709\u83B7\u53D6\u5230\u76F8\u5173\u677F\u6846\u6570\u636E\uFF0C\u65E0\u6CD5\u8FDB\u884C\u68C0\u6D4B"),{posValid:!1,reason:this.getReason("\u5F00\u542F\u68C0\u6D4B\uFF0C\u4F46\u662F\u5E76\u6CA1\u6709\u83B7\u53D6\u5230\u76F8\u5173\u677F\u6846\u6570\u636E\uFF0C\u65E0\u6CD5\u8FDB\u884C\u68C0\u6D4B",e)};let i=this.image,n;if(i)n=i.getMathGraphics(i.layerId,0).bbox();else return console.log("\u672A\u68C0\u6D4BUL\u6807\u8BC6\u653E\u7F6E\u7684\u60C5\u51B5"),{posValid:!1,reason:this.getReason("\u672A\u68C0\u6D4B\u5230UL\u6807\u8BC6\u653E\u7F6E\u7684\u60C5\u51B5",e)};let s=r.bbox().area(),a=Math.abs(r.area(.1));if(s===a){if(!r.bbox().isContainsBBox(n))return console.log("\u68C0\u6D4B\u5230UL\u6807\u8BC6\u4E0D\u5728\u677F\u6846\u5185"),{posValid:!1,reason:this.getReason("\u68C0\u6D4B\u5230UL\u6807\u8BC6\u4E0D\u5728\u677F\u6846\u5185",e)}}else{let u=hP([Cl.INTERSECT,r,ge.build6(n)]).bbox().area();if(u!==n.area()||ne.eq(u,a))return console.log("\u68C0\u6D4B\u5230UL\u6807\u8BC6\u4E0D\u5728\u677F\u6846\u5185"),{posValid:!1,reason:this.getReason("\u68C0\u6D4B\u5230UL\u6807\u8BC6\u4E0D\u5728\u677F\u6846\u5185",e)}}let l=hb(i.layerId)?[3,5,12]:[4,6,12],c=kt.searchByLayers(n,l).getAllItems().filter(h=>h===this.image?!1:h instanceof Pr&&h.layerId===12?PT.coverOil:!!h.getParent());if(c.length>=1){let h=ge.buildBBox(n).primitives,u=this;for(let d of c){let p=function(){return console.log("UL\u6807\u8BC6\u68C0\u6D4B\u4F4D\u7F6E\u4E0D\u901A\u8FC7, \u4E0E\u5176\u5B83\u56FE\u5143\u5B58\u5728\u91CD\u53E0",d),{posValid:!1,reason:u.getReason("UL\u6807\u8BC6\u68C0\u6D4B\u4F4D\u7F6E\u4E0D\u901A\u8FC7, \u4E0E\u5176\u5B83\u56FE\u5143\u5B58\u5728\u91CD\u53E0",e)}};if(d instanceof mt||d instanceof _t){let m=d.width/2,g=d.primitive;if(n.extendOfSize(m).isContainsBBox(g.bbox()))return p();for(let y of h)if(er.getMinDistance(y,g)<=m)return p()}else return p()}}return console.log("UL\u6807\u8BC6\u4F4D\u7F6E\u68C0\u6D4B\u901A\u8FC7"),{posValid:!0,reason:this.getReason("UL\u6807\u8BC6\u4F4D\u7F6E\u68C0\u6D4B\u901A\u8FC7",e)}}clearUL(){this.image&&(this.image.remove(),A.publish("delete",this.image),this.image=null)}getReason(e,r){let i=e;return r&&(i=this.commonToFT(e)),i}commonToFT(e){switch(e){case"\u68C0\u6D4B\u5230UL\u6807\u8BC6\u4E0D\u5728\u677F\u6846\u5185":return"i18n_shared_ul_mark_outline_tip";case"UL\u6807\u8BC6\u68C0\u6D4B\u4F4D\u7F6E\u4E0D\u901A\u8FC7, \u4E0E\u5176\u5B83\u56FE\u5143\u5B58\u5728\u91CD\u53E0":return"i18n_shared_ul_mark_overlap_tip";default:return""}}};var op=class op{static destroy(){var t,e;op.id==="adsorption"&&mxt(),op.editingWhat="",op.data=null,op.lockX=0,op.lockY=0,op.isWidthRulerLocked=!1,op.isHeightRulerLocked=!1,op.startPoint=null,op.cursorPoint=null,op.priority=0,op.lineLockedLength=null,op.lineLockedAngle=null,(t=op.auxiliaryLine1)==null||t.remove(),(e=op.auxiliaryLine2)==null||e.remove(),A.publish("showFloatingInputBox",{show:!1},Q())}static create(t,e="",r=!1){To.getInstance().canDrawing&&(op.data=t,r||(op.id=e),op.id==="adsorption"?fxt(1e3)&&A.publish("showFloatingInputBox",t,Q()):A.publish("showFloatingInputBox",t,Q()))}static updateUnit(t){if(!op.data)return;let e=new dt;(op.data.data||[]).forEach(r=>{r.info.value=e.conversion(r.info.unit,t,r.info.value),r.info.unit=t}),A.publish("showFloatingInputBox",op.data,Q())}};op.editingWhat="",op.priority=0,op.id="";var at=op;var WEe=!1,zEe=null;function fxt(o){if(WEe){if(Date.now()-zEe>=o)return!0}else return WEe=!0,zEe=Date.now(),!1;return!1}function mxt(){WEe=!1,zEe=null}var i_=class extends ro{constructor(){super(...arguments);this.partitionNeedAskBeforeDelete=!0;this.othersCommand=new De("Create partition!!!")}getItem(){return"ignore"}rebuild(){}remove(){}modify(){}updateData(){}addOthersCommand(e){this.othersCommand.addCommand(e)}undo(){this.partitionNeedAskBeforeDelete&&this.othersCommand.undo(),this.partitionNeedAskBeforeDelete=!1}redo(){this.othersCommand.redo()}hasFileUUID(){for(let e of this.othersCommand.commands)if(e instanceof pg){let r=e.getItem();if(r!=null&&r instanceof He&&r.type=="Partition"){let i=r.getComponent();if(i instanceof ac&&i.fileUuid!="")return!0}}return!1}upload(e){this.othersCommand!=null&&this.othersCommand.upload(e)}};var bD=class o{static getInstance(){return o.instance||(o.instance=new o),o.instance}constructor(){}placeSuccess(t,e){let r;if(t==="Rect"&&(r=Xt.getItem(e)),t==="Circle"&&(r=Kt.getItem(e)),!r)return;r.notShowFill=!1,bo.getInstance().addItem(r);let i=new De("create partition"),n=new i_;cce(e,n.othersCommand)?(r.refreshRender(),i.addCommand(Ce.dispatch(r,"add")),i.addCommand(n),qe.executeCommand(i),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),A.publish("updateRtree","")):bo.getInstance().deleteItemById(r.globalIndex)}createRectPartitionByArea(t,e){let{minX:r,maxX:i,minY:n,maxY:s}=t;return Xt.addRect("Partition",1004,new S(r,s),i-r,s-n,"",!1,.01,void 0,void 0,void 0,e)}createCirclePartitionByArea(t,e){let{center:r,width:i}=t;return Kt.addCircle("Partition",1004,r,.01,i,!1,"")}interrupt(t,e){this.deleteItem(t,e),A.publish("updateFrame","")}deleteItem(t,e){if(!e)return;let r;t==="Rect"&&(r=Xt.getItem(e)),t==="Circle"&&(r=Kt.getItem(e)),r&&(r.remove(),bo.getInstance().deleteItemById(r.globalIndex))}};var YS=class o{static getInstance(){return o.instance||(o.instance=new o),o.instance}constructor(){}placeSuccess(t,e){let r,i;if(t===1&&(r=Xt.getItem(e),i="draw Rect"),t===0&&(r=Kt.getItem(e),i="draw Circle"),t===2&&(r=pt.getItem(e),i="draw Polygon",this.isSelfIntersectionCheck(r)),!r)return;let n=this.getType(),s=ze.getSelects(),a=this.getIntersectionSelectItems(r,s);if(a.some(h=>h.locked)&&A.publish("ui/toastMsg",{type:"error",msg:"Locked objects found, please try again after unlock"},Q()),a=a.filter(h=>!h.locked),!a.length){r.remove(),A.publish("delete",r);return}let l=new Array,c=new Map;if(n=="Copper Region"||n==0){let h=new hi;h.createGroup(i);let u=r.getComponent();if(u.device=!1,u.track=!1,u.fill=!1,n=="Copper Region"?u.copper=!0:u.copper=!1,n==0?u.planzone=!0:u.planzone=!1,r.isEmpty||l.push(r),this.addMultiLayerProhibitArea(a,r,h,t,n),h.execute(),n=="Copper Region"){let d=a.filter(p=>p instanceof He&&p.type=="Copper Region");A.publish("rebuildConnectCopper",d.map(p=>p.globalIndex))}else{let d=a.filter(p=>p instanceof Gi);A.publish("rebuildSinglePlane",d.map(p=>p.layerId))}}else if(n=="Fill Region"||n=="FPC Stiffener")this.boolSubtraction(r,a,c),c.size&&this.tipForGroup(c),r.remove(),A.publish("delete",r);else if(n==1){let h=new hi;h.createGroup(i);let u=h.getCommand(),d=new Set;xe.addAllSet(d,s);for(let p of a)this.splitTrack(p,r,u,c,d);d.size&&A.publish("onlySelect",Array.from(d)),c.size&&this.tipForGroup(c),h.execute(),r.remove(),A.publish("delete",r)}else r.remove(),A.publish("delete",r)}addMultiLayerProhibitArea(t,e,r,i,n){let s=r.getCommand(),a=new Set,l=-1;for(let c of t){l++;let h=c.layerId;if(l==0)e.layerId=h,un.addOrder(e,r.getCommand()),r.addCommand4Item(e,"add"),this.splitCutout(e,s);else{if(a.has(h)||n=="Copper Region"&&!(c instanceof He&&c.type=="Copper Region")||n==0&&!(c instanceof Gi))continue;let u;switch(i){case 1:u=Xt.addRect("Prohibited Region",h,e.start,e.width,e.height,"",!1,e.strokeWidth);break;case 0:u=Kt.addCircle("Prohibited Region",h,e.center,e.radius,e.strokeWidth,!1,"");break;case 2:let d=e.model.clone();d.layerId=h;let p=new Array;for(let m of d.childrens){let g=new Array;for(let y of m)y instanceof hs&&g.push(Cu.addByModel(y,!0)),y instanceof Va&&g.push(Yc.addArcByModel(y,!0));p.push(g)}u=pt.addPolygonByModel(d,p,!0);break}un.addOrder(u,r.getCommand()),r.addCommand4Item(u,"add"),this.splitCutout(u,s)}a.add(h)}}isSelfIntersectionCheck(t,e=!0){let r=Eo(t.getMathGraphics());return e&&r&&A.publish("ui/toastMsg",{type:"info",msg:"There is a self-intersection and will be split automatically"},Q()),r}splitCutout(t,e){if(t instanceof lt){let r=t?[t]:[],i=!1;i=this.isSelfIntersectionCheck(t,!1),i&&(r=lm(t,e)),r.length&&r.forEach(n=>{n.fill()})}}getIntersectionSelectItems(t,e){let r=new Set;return e.forEach(i=>{t.buildBBox().isIntersect(i.buildBBox())&&r.add(i)}),Array.from(r)}boolSubtraction(t,e,r){let i=[],n=new De("Execute Boolean Operation"),s=new Ec,a=t.getMathGraphics(),l=[a];a instanceof Bt&&(l=a.items);let c=OA(e);for(let h of e){let u=h.getMathGraphics(),d=[u];u instanceof Bt&&(d=u.items);let p=this.checkItemIsInner(d,a),m=h.getGroupID();if(p){m&&r.set(`${Tr}${h.number}`,m),n.addCommand(Ce.dispatch(h,"delete")),h.remove(),A.publish("delete",h);continue}let g=s.getSubtraction(d,l),y=new Mh;g.forEach(b=>{let P=y.create4PlGrp(h.type,h.layerId,b,h.strokeWidth,h.net,!1);if(m&&(Ht.joinCombination([P],m),P.setGroupID(m)),h.type=="FPC Stiffener"||h.type=="Fill Region"&&c){let I=JSON.stringify(h.getComponent());new bl(I,P.type).rebuildComponent(P)}let T=Ce.dispatch(P,"add");n.addCommand(T),i.push(P),P.click()}),n.addCommand(Ce.dispatch(h,"delete")),A.publish("hasModifyPcbItem",h),h.remove(),A.publish("delete",h)}A.publish("autoFill",""),A.publish("updateRtree",""),n.length>0&&(qe.executeCommand(n),A.publish("onlySelect",i))}splitTrack(t,e,r,i,n){let s=e.getMathGraphics(),a=t.primitive,l=this.checkTrackIsInner(a,s),c=t.getGroupID();if(l){c&&i.set(`${Tr}${t.number}`,c),r.addCommand(Ce.dispatch(t,"delete")),t.remove(),A.publish("delete",t),n.delete(t);return}let h=[];for(let p of s.primitives){let m=Pt(a,p);for(let g=0;g<m;g+=2){let y=new S(Ee[g],Ee[g+1]);h.push(y)}}if(!h.length)return;h=an(h,a);let u=[].concat([a.start()],h,[a.end()]),d=new Array;for(let p=1;p<u.length;p++){let m=u[p-1],g=u[p];if(m.distance2(g)<1e-8)continue;let y;if(a instanceof M){let b=new M(m,g);if(this.checkTrackIsInner(b,s))continue;y=pr.addTrack(t.layerId,m,g,t.width,t.locked,t.net)}else{let b=m.angle(a.center),P=g.angle(a.center),T=q.build2(t.center,b,P,t.radius,t.radius,a.sweep());if(this.checkTrackIsInner(T,s))continue;y=pr.addArcTrack(t.layerId,t.center,t.radius,b,P,a.sweep(),t.width,t.locked,t.net,t.arcType)}c&&y.setGroupID(c),d.push(y),r.addCommand(Ce.dispatch(y,"add"))}xe.addAllSet(n,d),n.delete(t),r.addCommand(Ce.dispatch(t,"delete")),t.remove(),A.publish("delete",t)}tipForGroup(t){let e=[],r=[];for(let[i,n]of t.entries()){e.push({attr:{id:i,pcbid:R.getInstance().tabId},text:i});let s=Ht.getItem(n).name;r.push({attr:{id:n,pcbid:R.getInstance().tabId},text:`${s} (${n})`})}A.publish("ui/toastMsg",{type:"error",msg:"Object has been deleted, exited group",bottomBarMsg:{type:"warn",msg:['<span class="i18n">Object</span>',...e,'<span class="i18n">has been deleted, exited group </span>',...r]}},Q())}checkItemIsInner(t,e){let r=!0,i=[];for(let n of t){let s=n.primitives.flatMap(a=>a.points(1));xe.addAll(i,s)}return e instanceof Bt?r=i.some(n=>!jr.inPolygon(n,e.items)):r=i.some(n=>!jr.inPolyline(n,e)),!r}checkTrackIsInner(t,e){let r=!1,i=[t.start(),t.midPoint,t.end()];return e instanceof Bt?r=i.every(n=>jr.inPolygon(n,e.items)):r=i.every(n=>jr.inPolyline(n,e)),r}handleCutout(t,e,r,i){let n="Cutout",s=this.getType();(s=="Copper Region"||s==0)&&(n="Prohibited Region");let a;switch(t){case 1:a=Xt.addRect(n,r,e,1,1,"",!1,i);break;case 0:a=Kt.addCircle(n,r,e,.1,i,!1,"");break;case 2:a=pt.addPolygon(n,r,e,i,"",!1);break}return a}getType(){let t,r=ze.getSelects()[0];return(r instanceof mt||r instanceof _t)&&(r=r.getParent()),r instanceof He&&(t=r.type),r instanceof Gi&&(t=0),r instanceof Ge&&(t=1),t}};var cG=class cG extends ni{constructor(e){super();this._pcbCircle=null;this._width=1;this.drawMode=0;this.dialogHandler=null;this.subline=null;this.lockProcess=!1;this.timer=null;this.option="OPTIONLEFTUP",we.drawing=!0,this.type=e,e=="Line"?R.getInstance().doctype==pi.FOOTPRINT?this._width=we.prevTrackWidth||ut.defaultOutlineWidth:this._width=Ha.getInstance().getTrackWidth().value||ut.defaultOutlineWidth:e=="Board Outline"||e=="3D Shell - Outline"?this._width=ut.defaultOutlineWidth:this._width=.02,e=="3D Shell - Outline"&&(this._width=Pu(-1,e)),e=="Partition"&&(this._width=.01,this.partitionTool=bD.getInstance()),e=="Cutout"&&(this.cutoutTool=YS.getInstance()),Ur.addDrawTool(this),Ua.addTool(this),Ea.changeTool(this),uu.setTool(this),cG._readyType=e}static get readyType(){return this._readyType}set pcbCircle(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._pcbCircle=e}get pcbCircle(){return this._pcbCircle}onKeyDown(e){if(this.lockProcess)return;let r;switch((this.type==="Line"||this.type==="Board Outline")&&(r=tr.getLocalAction(["decrease_routing_width","increase_routing_width"],e)),r||(r=tr.getAction(4,e)),r){case"Cancel":this.cancel();break;case"Switch Common Track Width":this.type==="Line"&&this.showCommonTrackWidthMenu(e);break;case"decrease_routing_width":{let n=this._width-.2;n>=.1&&(this.setWireWidth(n),wi())}break;case"increase_routing_width":{let n=this._width+.2;this.setWireWidth(n),wi()}break;case"Change Track Width While Routing":{this.canChangeWhileRouting(this.type)&&A.publish("openMainDialog",{cmd:26,data:{tool:this}});break}case"Finish":this.onEnterPlace(e);break}A.publish("updateFrame","")}setDialogHandler(e){this.dialogHandler=e}onMouseLeftUp(e){if(this.lockProcess)return;if(!this.drawing){this.drawing=!0,A.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},Q());return}let r=new S(e.sceneX,e.sceneY);if(this.drawMode==0)if(this.pcbCircle==null){if(!Mt.checkIsCanEditByPoint(new S(e.sceneX,e.sceneY)))return;this.start(),this.startDraw(r)}else{if(!Mt.checkIsCanEditByPoint(new S(e.sceneX,e.sceneY))){let i="Cannot be added beyond drawing range";Mt.showMassageTip(i,i);return}at.editingWhat?at.editingWhat="":(this.confirmWindow(),at.destroy(),this.subline.remove(),this.subline=null)}else this.netSelect(e)}onMouseRightUp(e){this.lockProcess||super.onMouseRightUp(e)}startDraw(e){this.type=="Partition"?this.pcbCircle=bD.getInstance().createCirclePartitionByArea({center:e,width:this._width}):this.type=="Cutout"?this.pcbCircle=YS.getInstance().handleCutout(0,e,this.getLayerIdByCanvasDocType(),this._width):this.pcbCircle=Kt.addCircle(this.type,this.getLayerIdByCanvasDocType(),e,.1,this._width,!1,""),this.drawing=!0,this.subline=new cr(1002,e,e,!0,ee.WHITE)}onMouseMove(e){if(!this.lockProcess){if(this.drawMode==0&&this.pcbCircle!==null&&this.drawing){let r=new S(e.sceneX,e.sceneY),i=r.sub(this.pcbCircle.center);this.pcbCircle.radius=Math.max(i.length(),.1),this.pcbCircle.notShowFill=!0,at.startPoint=this.pcbCircle.center,at.cursorPoint=r,this.subline&&(this.subline.end=r);let n=nf(),s=at.startPoint,a=at.cursorPoint,l=_o(at.cursorPoint),c=_o(at.startPoint),h={data:[{startPoint:s,cursorPoint:a,frameStartPoint:c,frameCursorPoint:l,info:{type:"circle",tagName:"radius",value:je(this.pcbCircle.radius),unit:R.getInstance().unit,onlyPositive:!0}}],show:!0,type:"circle",frameInfo:n},u=9;u>=at.priority&&(at.priority=u,at.create(h))}this.drawMode==1?Ut.update(e,"Please select a network"):Ut.cancel()}}applyInputAtCursorValue(e){let{editing:r}=e;if(r){at.editingWhat="circle";return}this.applyValue(e)}applyValue(e){console.log(e);let{value:r,keyCode:i,cursorPoint:n,startPoint:s,type:a}=e;if(r===void 0)return;r=new dt().conversion(R.getInstance().unit,"mil",r/10);let c;if(a==="free"){let h=new S(n.x-s.x,n.y-s.y).normalize();h=new S(h.x*r,h.y*r);let u=new S(h.x+s.x,h.y+s.y);if(this.pcbCircle==null){this.startDraw(u),at.destroy();return}else c=this.pcbCircle.center.distance1(u)}else c=r;this.pcbCircle.radius=c,A.publish("flushService",""),(i===108||i===13)&&(this.confirmWindow(),this.subline.remove(),this.subline=null,at.destroy())}restore(){var e;at.destroy(),this.pcbCircle.remove(),this.dialogHandler!=null&&this.dialogHandler.closeOpenDialog(),A.publish("delete",this.pcbCircle),this.drawMode=0,this.pcbCircle=null,this.drawing=!0,(e=this.subline)==null||e.remove(),this.subline=null,A.publish("updateRtree","")}interrupt(){var e;this.pcbCircle!==null&&(at.destroy(),this.pcbCircle.remove(),this.dialogHandler!=null&&this.dialogHandler.closeOpenDialog(),A.publish("delete",this.pcbCircle),this.drawMode=0,this.pcbCircle=null,(e=this.subline)==null||e.remove(),this.subline=null,A.publish("updateRtree","")),Ur.clearDrawTool(),cG._readyType=null,this.end()}cancel(){if(!this.timer)if(this.drawMode==0){let e=!!this.pcbCircle;this.interrupt(),e||(A.publish("tool","dropdrag"),cG._readyType=null)}else this.drawMode=0,this.confirmWindow()}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this),this.drawing=!1}showCommonTrackWidthMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=Dm(this._width).result,$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"WIRING_WIDTH":this.toggleWidth(i[1]);break;case"WIRING_WIDTH_COMMONLY_SSETTING":A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",Q());break;case"INHERIT_NET":this.handleChangeCircleNet(i[1]);break}A.publish("updateFrame","")}toggleWidth(e){let r=le.trackConfig[e];this.setWireWidth(r.getSizeAccordingToUnit()),wi()}getWidth(){return this._width}setWireWidth(e){this.pcbCircle!=null&&(this.pcbCircle.strokeWidth=e),this._width=e,we.prevTrackWidth=e,A.publish("flushSelectingInfo","")}confirmWindow(){if(this.timer=setTimeout(()=>{this.timer=null},500),this.pcbCircle!=null){if(this.pcbCircle.type!=="Partition"&&!Mt.checkIsInCanEdit(this.pcbCircle)){let e="Cannot be added beyond drawing range";Mt.showMassageTip(e,e),this.interrupt();return}this.type=="Copper Region"||this.type=="Prohibited Region"||this.type=="Constraint Region"||this.type=="Fill Region"?(this.drawing=!1,A.publish("openMainDialog",{cmd:17,data:{shape:this.pcbCircle,tool:this}})):(_y(this.pcbCircle),this.modify(!0))}}placeSuccess(){if(this.pcbCircle.partition=R.getInstance().partitionId,(this.pcbCircle.type=="Line"||this.pcbCircle.type=="Board Outline")&&(this._width=this.pcbCircle.strokeWidth,ut.defaultOutlineWidth=this.pcbCircle.strokeWidth),this.pcbCircle.type=="Partition"){this.pcbCircle.fill(),this.partitionTool.placeSuccess("Circle",this.pcbCircle.globalIndex),this.pcbCircle=null,this.drawing=!0,A.publish("updateFrame",""),this.end();return}if(this.type=="Cutout"){this.pcbCircle.fill(),this.cutoutTool.placeSuccess(0,this.pcbCircle.globalIndex),this.pcbCircle=null,this.drawing=!0,A.publish("updateFrame",""),this.end();return}let e=new hi;e.createGroup("draw 2DLine Circle"+this.type),un.addOrder(this.pcbCircle,e.getCommand()),e.addCommand4Item(this.pcbCircle,"add"),e.checkOutlines([this.pcbCircle],new Set),this.pcbCircle.type=="Copper Region"&&A.publish("rebuildConnectCopper",[this.pcbCircle.globalIndex]),!z9(this.pcbCircle.layerId)&&this.type!=="3D Shell - Side Slot Region"&&A.publish("onlySelect",[this.pcbCircle]),A.publish("hasModifyPcbItem",this.pcbCircle),this.pcbCircle.fill(),this.pcbCircle=null,this.drawing=!0,A.publish("flushService",""),this.end()}modify(e){if(e&&this.pcbCircle!=null)if(Uu.realtimeCheckItems([this.pcbCircle]))this.placeSuccess();else{this.lockProcess=!0;let r=()=>{this.placeSuccess(),this.lockProcess=!1},i=()=>{this.lockProcess=!1},n=new e0("Violation of DRC rules, whether to ignore?",r,i);A.publish("openMsgbox",n),this.drawing=!0,this.drawMode=0}else this.pcbCircle!=null&&(this.pcbCircle.remove(),A.publish("delete",this.pcbCircle)),A.publish("updateRtree",""),this.pcbCircle=null,this.drawing=!0,this.end()}toggleMode(e,r){this.drawMode=e,this.drawing=!0;let{pcbBridgingCopperIndex:i}=r;i&&(this.pcbBridgingCopperIndex=i)}toggleLayer(e){if(this.type==="Fill Region"){let r=Pe.getLastActiveLayerID(),i=Pe.getAllPinLayerIds();if(i.includes(e)!==i.includes(r))return Pe.setActiveLayerId(r)}this.pcbCircle!=null&&this.pcbCircle.layerId!=e&&(this.pcbCircle.layerId=e)}netSelect(e){let r=e.sceneX,i=e.sceneY;if(this.pcbCircle!=null&&this.drawMode==1){let n=Vr.selectNet(r,i);if(n!==null){let s=this.getNearNetPcbItems(n,r,i);this.handleNets(e,s)}}}handleChangeCircleNet(e){this.pcbCircle.net=e,wR(this.pcbCircle,e,this.pcbBridgingCopperIndex),this.drawMode=0,this.confirmWindow()}getNearNetPcbItems(e,r,i){let n=new Set,s=new Set,a=new Set;return e.forEach(l=>{if(l instanceof He&&l.type=="Fill Region"){let h=l.getComponent();if(h instanceof Zi&&h.isBridgingCopper)return}let c=l.net;if(l instanceof He&&l.type=="Copper Region"){let h=!1;if(l.iteratorCopper(u=>{h||u.inCopper(r,i)&&u.isVisible&&(h=!0)}),!h)return}c&&(a.add(l),s.add(c))}),n.add({group:a,nets:s}),n}handleNets(e,r){let i=new Set;r.forEach(n=>{i=n.nets}),i.size&&(i.size===1?i.forEach(n=>{this.handleChangeCircleNet(n)}):(Ut.cancel(),this.showNetsMenu(e,i)))}showNetsMenu(e,r){let i={};i.state="show",i.left=e.mouseX,i.top=e.mouseY,i.filter=this.getNetsMenuData(r).result,$t.getInstance().menuData(i,this),this.drawing=!1}getNetsMenuData(e){let r=new qt,i="INHERIT_NET:";return e.forEach(n=>{if(n){let s={name:n,cmd:`${i+n}`,tips:"",option:{disabledI18n:!0}};r.addObj(s,!1,!1)}}),r}getLayerIdByCanvasDocType(){let e=Pe.getActiveLayerID();return R.getInstance().doctype!==pi.FOOTPRINT&&_v(e)&&(e=1),e}wireCorner(e){}wireMode(e){}};cG._readyType=null;var Vh=cG;var hG=class hG extends ni{constructor(e){super();this._start=null;this._rect=null;this._width=1;this.drawMode=0;this.dialogHandler=null;this.blockRight=!1;this.lockProcess=!1;this.option="OPTIONLEFTUP",we.drawing=!0,this.type=e,e=="Line"?R.getInstance().doctype==4?this._width=we.prevTrackWidth||ut.defaultOutlineWidth:this._width=Ha.getInstance().getTrackWidth().value||ut.defaultOutlineWidth:e=="Board Outline"||e=="3D Shell - Outline"?this._width=ut.defaultOutlineWidth:this._width=.02,e=="3D Shell - Outline"&&(this._width=Pu(-1,e)),e=="Annotation"&&(this._width=1,this.annotationUtils=To.getInstance()),e=="Partition"&&(this._width=.01,this.partitionTool=bD.getInstance()),e=="Cutout"&&(this.cutoutTool=YS.getInstance()),Ur.addDrawTool(this),Ua.addTool(this),Ea.changeTool(this),uu.setTool(this),hG._readyType=e}static get readyType(){return this._readyType}set rect(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._rect=e}get rect(){return this._rect}setDialogHandler(e){this.dialogHandler=e}onKeyDown(e){if(this.lockProcess)return;let r;switch((this.type==="Line"||this.type==="Board Outline")&&(r=tr.getLocalAction(["decrease_routing_width","increase_routing_width"],e)),r||(r=tr.getAction(4,e)),r){case"Cancel":this.cancel();break;case"Switch Common Track Width":this.type==="Line"&&this.showCommonTrackWidthMenu(e);break;case"decrease_routing_width":{let n=this._width-.2;n>=.1&&(this.setWireWidth(n),wi())}break;case"increase_routing_width":{let n=this._width+.2;this.setWireWidth(n),wi()}break;case"Change Track Width While Routing":{this.canChangeWhileRouting(this.type)&&A.publish("openMainDialog",{cmd:26,data:{tool:this}});break}case"Finish":{this.onEnterPlace(e);break}}A.publish("updateFrame","")}onMouseLeftUp(e){if(this.lockProcess)return;let r=new S(e.sceneX,e.sceneY);if(this.drawMode==0)if(this.rect===null){if(this.start(),!Mt.checkIsCanEditByPoint(new S(e.sceneX,e.sceneY)))return;this.startDraw(r)}else{if(!Mt.checkIsCanEditByPoint(new S(e.sceneX,e.sceneY))){let i="Cannot be added beyond drawing range";Mt.showMassageTip(i,i);return}at.editingWhat==="horizontal"||at.editingWhat==="vertical"?at.editingWhat="":(ne.eq(this.rect.buildBBox().area(),0)||this.confirmWindow(),this.widthLocked=!1,this.heightLocked=!1,at.destroy())}else this.netSelect(e)}onMouseRightUp(e){this.lockProcess||super.onMouseRightUp(e)}onMouseMove(e){if(!this.lockProcess){if(this.drawMode==0){let r=new S(e.sceneX,e.sceneY);this.showFloatingInputBox(r)}this.drawMode==1?Ut.update(e,"Please select a network"):Ut.cancel()}}showFloatingInputBox(e,r=!1){if(this.rect!==null&&this.drawing){let i=e.x,n=e.y;r||(this.widthLocked&&(i=this.cursorPoint.x),this.heightLocked&&(n=this.cursorPoint.y)),this.cursorPoint=new S(i,n);let s=new _e().ext2(this._start).ext2(this.cursorPoint).build1();this.rect instanceof rr?(this.rect.width=s.width(),this.rect.height=s.height()):this.createChamferRect(this._start,s.width(),s.height());let a=this.rect.getMathGraphics().bbox().UL(),l=s.UL().sub(a),c=Ae.translate(l.x,l.y,0);this.rect.transform(c),at.startPoint=new S(this._start.x,this._start.y),at.cursorPoint=new S(i,n);let h=nf(),u=at.startPoint,d=at.cursorPoint,p=_o(at.cursorPoint),m=_o(at.startPoint),g=s.width(),y=s.height();u.x>d.x&&(g=-g),u.y>d.y&&(y=-y);let b={data:[{startPoint:u,cursorPoint:d,frameStartPoint:m,frameCursorPoint:p,info:{type:"horizontal",value:je(g),unit:R.getInstance().unit}},{startPoint:u,cursorPoint:d,frameStartPoint:m,frameCursorPoint:p,info:{type:"vertical",value:je(y),unit:R.getInstance().unit}}],type:"rect",show:!0,frameInfo:h},P=9;P>=at.priority&&(at.priority=P,at.create(b))}}lockUnlock(e){at.editingWhat="";let{value:r,type:i,locked:n,unlocked:s}=e,a=new dt;if(i==="vertical")if(n){this.heightLocked=!0;let l=at.startPoint.y+a.conversion(R.getInstance().unit,"mil",r/10);this.cursorPoint=new S(this.cursorPoint.x,l),this.applyValue(e)}else s&&(this.heightLocked=!1);else if(i==="horizontal")if(n){this.widthLocked=!0;let l=at.startPoint.x+a.conversion(R.getInstance().unit,"mil",r/10);this.cursorPoint=new S(l,this.cursorPoint.y),this.applyValue(e)}else s&&(this.widthLocked=!1)}startDraw(e){if(this.type=="Annotation")this.rect=To.getInstance().createAnnotationByArea({minX:e.x,maxX:e.x+1,minY:e.y-1,maxY:e.y});else if(this.type=="Partition")this.rect=bD.getInstance().createRectPartitionByArea({minX:e.x,maxX:e.x+1,minY:e.y-1,maxY:e.y});else if(this.type=="Cutout")this.rect=YS.getInstance().handleCutout(1,e,this.getLayerIdByCanvasDocType(),this._width);else if(this.isChamferRect())this.createChamferRect(e,1,1);else{let r=this.canFillet()&&le.pcbConfig.autoChamfer2DLine=="fillet"?le.pcbConfig.filletRadius2DLine:0;this.rect=Xt.addRect(this.type,this.getLayerIdByCanvasDocType(),e,1,1,"",!1,this._width,0,r)}this._start=e,this.drawing=!0}createChamferRect(e,r,i){this.rect!=null&&this.rect.remove();let n=Math.min(le.pcbConfig.filletRadius2DLine,r/2,i/2),s=[e.add1(n,0),e.add1(r-n,0),e.add1(r,-n),e.add1(r,-i+n),e.add1(r-n,-i),e.add1(n,-i),e.add1(0,-i+n),e.add1(0,-n),e.add1(n,0)],a=new Mh,l=ge.build4(s);this.rect=a.create4Pl(this.type,this.getLayerIdByCanvasDocType(),l,this._width,"",!1)}isChamferRect(){return le.pcbConfig.autoChamfer2DLine=="chamfer"&&this.canFillet()&&le.pcbConfig.filletRadius2DLine>0}canFillet(){return le.pcbConfig.autoChamfer2DLine!="off"&&["Line","Copper Region","Fill Region","Slot Region","Prohibited Region","Constraint Region","Board Outline"].includes(this.type)}applyValue(e){let{value:r,type:i,startPoint:n,cursorPoint:s,keyCode:a}=e;if(r===void 0)return;r=new dt().conversion(R.getInstance().unit,"mil",r/10);let c;if(i==="vertical")c=new S(at.cursorPoint.x,at.startPoint.y+r);else if(i==="horizontal")c=new S(at.startPoint.x+r,at.cursorPoint.y);else if(i==="free"){let h=new S(s.x-n.x,s.y-n.y).normalize();h=new S(h.x*r,h.y*r);let u=new S(h.x+n.x,h.y+n.y);if(this.rect==null){this.startDraw(u),at.destroy();return}else c=u}console.log(c),this.showFloatingInputBox(c,a===108||a===13),A.publish("updateFrame",""),(a===108||a===13)&&(this.confirmWindow(),this.widthLocked=!1,this.heightLocked=!1,at.destroy())}applyInputAtCursorValue(e){console.log(e);let{value:r,type:i,locked:n,unlocked:s,editing:a,keyCode:l}=e;if(a){at.editingWhat=i;return}if(n||s)return this.lockUnlock(e);this.applyValue(e)}restore(){at.destroy(),this.dialogHandler!=null&&this.dialogHandler.closeOpenDialog(),this.rect.remove(),A.publish("delete",this.rect),this.drawing=!0,this.drawMode=0,this.rect=null,this._start=null,this.widthLocked=!1,this.heightLocked=!1,A.publish("updateRtree","")}interrupt(){var r;let e=(r=this.rect)==null?void 0:r.globalIndex;this.rect!==null&&(at.destroy(),this.dialogHandler!=null&&this.dialogHandler.closeOpenDialog(),this.rect.remove(),A.publish("delete",this.rect),this.drawMode=0,this.rect=null,this._start=null,this.widthLocked=!1,this.heightLocked=!1,A.publish("updateRtree","")),this.annotationUtils&&this.annotationUtils.interrupt(e),Ur.clearDrawTool(),Ut.cancel(),hG._readyType=null,this.end()}cancel(){if(this.drawMode==0){if(this.blockRight)return;let e=!!this.rect;this.interrupt(),e||(A.publish("tool","dropdrag"),hG._readyType=null)}else this.drawMode=0,ne.eq(this.rect.buildBBox().area(),0)||this.confirmWindow();Ut.cancel()}rightClickMenuData(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=po(e.adsorb),$t.getInstance().menuData(r,this),this.drawing=!1}showCommonTrackWidthMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=Dm(this._width).result,$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"WIRING_WIDTH":this.toggleWidth(i[1]);break;case"WIRING_WIDTH_COMMONLY_SSETTING":A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",Q());break;case"INHERIT_NET":this.handleChangeRectNet(i[1]);break}A.publish("updateFrame","")}toggleWidth(e){let r=le.trackConfig[e];this.setWireWidth(r.getSizeAccordingToUnit()),wi()}getWidth(){return this._width}setWireWidth(e){this.rect!=null&&(this.rect.strokeWidth=e),this._width=e,we.prevTrackWidth=e,A.publish("flushSelectingInfo","")}confirmWindow(){if(this.rect!=null){if(this.rect.type!=="Partition"&&!Mt.checkIsInCanEdit(this.rect)){let e="Cannot be added beyond drawing range";Mt.showMassageTip(e,e),this.interrupt();return}this.type=="Copper Region"||this.type=="Prohibited Region"||this.type=="Constraint Region"||this.type=="Fill Region"?(this.drawing=!1,A.publish("openMainDialog",{cmd:17,data:{shape:this.rect,tool:this}}),this.blockRight=!0):(_y(this.rect),this.modify(!0))}}placeSuccess(){if(this.rect.partition=R.getInstance().partitionId,(this.rect.type=="Line"||this.rect.type=="Board Outline")&&(this._width=this.rect.strokeWidth,ut.defaultOutlineWidth=this.rect.strokeWidth),this.type=="Cutout"){this.rect.fill(),this.cutoutTool.placeSuccess(1,this.rect.globalIndex),this.rect=null,this.drawing=!0,this._start=null,this.widthLocked=!1,this.heightLocked=!1,A.publish("updateFrame",""),this.end();return}if(this.rect.type=="Annotation"){this.rect.fill(),this.annotationUtils.waitData(this.rect.globalIndex),this.rect=null,this.drawing=!0,this._start=null,this.widthLocked=!1,this.heightLocked=!1,A.publish("updateFrame",""),this.end();return}if(this.rect.type=="Partition"){this.rect.fill(),this.partitionTool.placeSuccess("Rect",this.rect.globalIndex),this.rect=null,this.drawing=!0,this._start=null,this.widthLocked=!1,this.heightLocked=!1,A.publish("updateFrame",""),this.end();return}!z9(this.rect.layerId)&&this.type!=="3D Shell - Side Slot Region"&&A.publish("onlySelect",[this.rect]);let e=new hi;e.createGroup("draw Rect"),this.rect.type=="Copper Region"&&un.addOrder(this.rect,e.getCommand()),e.addCommand4Item(this.rect,"add"),e.checkOutlines([this.rect],new Set),this.rect.type=="Copper Region"&&A.publish("rebuildConnectCopper",[this.rect.globalIndex]),this.rect.fill(),this.rect=null,this.drawing=!0,this._start=null,this.widthLocked=!1,this.heightLocked=!1,A.publish("flushService",""),this.end()}modify(e){if(this.blockRight=!1,e&&this.rect!=null)if(Uu.realtimeCheckItems([this.rect]))this.placeSuccess();else{this.lockProcess=!0;let r=()=>{this.placeSuccess(),this.lockProcess=!1},i=()=>{this.lockProcess=!1},n=new e0("Violation of DRC rules, whether to ignore?",r,i);A.publish("openMsgbox",n),this.drawing=!0,this.drawMode=0}else this.rect!=null&&(this.rect.remove(),A.publish("delete",this.rect)),A.publish("updateRtree",""),this.rect=null,this.drawing=!0,this._start=null,this.end()}toggleMode(e,r){this.drawMode=e,this.drawing=!0;let{pcbBridgingCopperIndex:i}=r;i&&(this.pcbBridgingCopperIndex=i)}toggleLayer(e){if(this.type==="Fill Region"){let r=Pe.getLastActiveLayerID(),i=Pe.getAllPinLayerIds();if(i.includes(e)!==i.includes(r))return Pe.setActiveLayerId(r)}this.rect!=null&&this.rect.layerId!=e&&(this.rect.layerId=e)}netSelect(e){if(this.rect!=null&&this.drawMode==1){let r=Vr.selectNet(e.sceneX,e.sceneY);if(r!==null){let i=this.getNearNetPcbItems(r,e.sceneX,e.sceneY);this.handleNets(e,i)}}}handleChangeRectNet(e){this.rect.net=e,wR(this.rect,e,this.pcbBridgingCopperIndex),this.drawMode=0,ne.eq(this.rect.buildBBox().area(),0)||this.confirmWindow()}getNearNetPcbItems(e,r,i){let n=new Set,s=new Set,a=new Set;return e.forEach(l=>{if(l instanceof He&&l.type=="Fill Region"){let h=l.getComponent();if(h instanceof Zi&&h.isBridgingCopper)return}let c=l.net;if(l instanceof He&&l.type=="Copper Region"){let h=!1;if(l.iteratorCopper(u=>{h||u.inCopper(r,i)&&u.isVisible&&(h=!0)}),!h)return}c&&(a.add(l),s.add(c))}),n.add({group:a,nets:s}),n}handleNets(e,r){let i=new Set;r.forEach(n=>{i=n.nets}),i.size&&(i.size===1?i.forEach(n=>{this.handleChangeRectNet(n)}):(Ut.cancel(),this.showNetsMenu(e,i)))}showNetsMenu(e,r){let i={};i.state="show",i.left=e.mouseX,i.top=e.mouseY,i.filter=this.getNetsMenuData(r).result,$t.getInstance().menuData(i,this),this.drawing=!1}getNetsMenuData(e){let r=new qt,i="INHERIT_NET:";return e.forEach(n=>{if(n){let s={name:n,cmd:`${i+n}`,tips:"",option:{disabledI18n:!0}};r.addObj(s,!1,!1)}}),r}getLayerIdByCanvasDocType(){let e=Pe.getActiveLayerID();return R.getInstance().doctype!==4&&_v(e)&&(e=1),e}wireCorner(e){}wireMode(e){}proportionalZoom(){}};hG._readyType=null;var Ac=hG;function vg(o,t,e,r=!1,i=!1,n){let s=new qt;return e?(s.add("COMPLETE"),s.add("CANCEL"),s.add("REGRESSION",!0)):s.add("CANCEL",!0),r?(s.addExtend("WIRING_CORNER",fS(o)),i&&(s.addExtend("WIDTH",Dm(n)),s.add("WIRING_WIDTH_INPUT",!0)),R.getInstance().doctype===pi.FOOTPRINT&&s.add("AUTO_TRIM_SILKSCREEN",!1,we.autoTrimSilkscreen)):s.addExtend("WIRING_CORNER",fS(o),!0),s.add("toggleAdsorb",!1,t),s.add("ADSORBENT_CONFIG"),s}var du=class{constructor(){this.commands=null;this._width=1;this.shape=new Array;this.cutSilkLines=new Array;this.start=null;this.last=null;this.curr=null;this.lastDirect=new S(1,0);this.closeLine=null;this.completing=!1;this.needClose=!0;this.drawMode=0;this.drawScene=null;this.isEditOutLine=!1;this.drawHistory=[]}convert(){let t=new Array;for(let e of this.shape){let r=e.width;if(e instanceof Vi||e instanceof cr){let i=new M(e.start,e.end);t.push({primitive:i,width:r})}else{let[i,n,s,a,l]=[e.center,e.startAngle/Math.PI*180,e.endAngle/Math.PI*180,e.radius,e.sweep],c=q.build2(i,n,s,a,a,l);t.push({primitive:c,width:r})}}return t}setAdsorptionDrawingLine(){let t=this.convert();ai.drawingLines=t}clearAdsorptionDrawingLine(){ai.drawingLines=[]}clearDrawHistory(){this.drawHistory.length=0}newData(){return this.convert().filter(({primitive:t})=>!t.start().equals(t.end()))}drawHistoryRecord(){this.drawHistory.push(this.newData())}historyBack(t){var n;this.drawHistory.pop(),this.drawHistory.length==0&&(this.shape.length&&(this.start=this.shape[0].start,this.last=this.shape[0].start),vu.canCut()&&(this.cutSilkLines.length=0)),this.shape.forEach(s=>{s.remove()}),this.shape.length=0;let{lineColor:e,lineSolid:r}=Ns.getInstance().getRegionLineStyle2(this.drawScene,((n=this.shape[0])==null?void 0:n.color)||ee.BLACK),i=this.drawHistory[this.drawHistory.length-1];i&&(i.forEach(({primitive:s,width:a})=>{let l;if(s instanceof M)l=this.createSceneLine(t,s.start(),s.end(),e,r,a);else{let c=s.startAngle/180*Math.PI,h=s.endAngle()/180*Math.PI;l=this.createSceneArc(t,s.center,s.rx,c,h,s.sweep(),e,a)}this.shape.push(l)}),this.start=this.shape[this.shape.length-1].end,this.last=this.shape[this.shape.length-1].end,vu.canCut()&&this.rebuildCutSilkLines())}createSceneLine(t,e,r,i,n=!1,s=this._width){let a=this.drawScene==="Segment",l;return a?l=new cr(t,e,r,n,i):l=Vi.build(t,e,r,s),l}createSceneArc(t,e,r,i,n,s,a,l){let c=this.drawScene==="Segment",h;return c?h=gs.build(t,e,r,i,n,s,a):h=es.build(t,e,r,l,i,n,s),h}rebuildCutSilkLines(){let t=this.shape,e=[];for(let r=0;r<t.length;r++){let i=[t[r]];for(;t[r+1]&&t[r].end.equals1(t[r+1].start);)i.push(t[r+1]),r++;e.push(i)}this.cutSilkLines=e}};var eP=class{};var Hm=class extends eP{constructor(e){super();this.profile=null;this.profiles=[];this.shouldAddHistory=!0;this.type=e}getResult(e){if((Pe.getActiveLayerID()===3||Pe.getActiveLayerID()===4)&&e.cutSilkLines.length>0)return this.getResult1(e);let r=new Array;e.shape.forEach(i=>{let n=this.getModel(e,i);r.push(n),i.remove()}),r=A1(r),this.validChilds(this.type,r)?r.length>0&&(this.type=="Cutout"?(this.profile=YS.getInstance().handleCutout(2,[r],this.getLayerIdByCanvasDocType(),e._width),e.drawScene=this.profile.type):this.profile=pt.addPolygon(this.type,this.getLayerIdByCanvasDocType(),[r],e._width,"",!1)):r.forEach(i=>{i.remove()}),e.shape.length=0}validChilds(e,r){return!(Bu(e)&&!Qh(r.map(i=>i.primitive)))}getPrimitive(e){if(e instanceof Vi||e instanceof es)return e.primitive;if(e instanceof cr)return new M(e.start,e.end);if(e instanceof gs)return q.build2(e.center,vL(e.startAngle),vL(e.endAngle),e.radius,e.radius,e.sweep)}getResult1(e){let r=new Array;e.cutSilkLines.forEach(i=>{let n=new Array,s=!0;Bu(this.type)&&!Qh(i.map(a=>this.getPrimitive(a)))&&(s=!1);for(let a=0;a<i.length;a++){if(s){let l=this.getModel(e,i[a]);n.push(l)}i[a].remove()}s&&r.push(n)}),e.shape.forEach(i=>{i.remove()});for(let i=0;i<r.length;i++){let n=A1(r[i]);n.length!=0&&this.profiles.push(pt.addPolygon(this.type,this.getLayerIdByCanvasDocType(),[n],e._width,"",!1))}e.shape.length=0,e.cutSilkLines.length=0}getModel(e,r){let i=Pe.getActiveLayerID();return new Po().clone4Shape(this.getPrimitive(r),i,e._width)}confirmWindow(e,r){if(this.profile!=null){if(this.profile.type!=="Partition"&&!Mt.checkIsInCanEdit(this.profile)){let i="Cannot be added beyond drawing range";Mt.showMassageTip(i,i),this.profile.remove(),A.publish("delete",this.profile);return}this.type=="Copper Region"||this.type=="Prohibited Region"||this.type=="Constraint Region"||this.type=="Fill Region"?A.publish("openMainDialog",{cmd:17,data:{shape:this.profile,tool:r}}):this.type=="Line"&&this.profile.layerId===11?(this.profile.isClose()&&(this.profile.type="Board Outline"),this.modify(e,r,!0)):this.type=="Cutout"?YS.getInstance().placeSuccess(2,this.profile.globalIndex):(_y(this.profile),this.modify(e,r,!0))}else this.profiles.length>0&&this.modify(e,r,!0)}modify(e,r,i){if(this.profiles.length>0)return this.modify1(e,r,i);if(i&&this.profile!=null){e._width=this.profile.strokeWidth;let n=new hi;un.addOrder(this.profile,e.commands),this.shouldAddHistory&&(n.addGroup(e.commands),n.addCommand4Item(this.profile,"add"));let s=this.profile?[this.profile]:[],a=!1,l=new Array,c=this.profile.layerId;if(this.profile instanceof lt&&(a=Eo(this.profile.getMathGraphics()),a)){if(this.type==="Partition"){n.addCommand4Item(this.profile,"delete"),this.profile.remove(),A.publish("delete",this.profile),A.publish("ui/toastMsg",{type:"info",msg:"There is a self-intersection and please redraw a polygon"},Q());return}s=lm(this.profile,e.commands)}if(this.profile.isEmpty||l.push(this.profile),s.length&&this.type!=="Partition"&&(this.shouldAddHistory?(n.checkOutlines(s),s.forEach(h=>{h.fill()}),xe.addAll(l,s)):s.forEach(h=>h.hidden())),!z9(c)&&!("3D Shell - Side Slot Region","Partition").includes(this.type)&&this.shouldAddHistory&&A.publish("onlySelect",l),this.type=="Copper Region"){let h=l.map(u=>u.globalIndex);A.publish("rebuildConnectCopper",h)}if(this.shouldAddHistory&&(e.commands=new De("draw 2DLine - "+this.type)),this.type==="Partition"){let h=new i_;Array.from(new Set(l)).every(d=>(bo.getInstance().addItem(d),cce(d.globalIndex,h.othersCommand)))?(qe.stack.addCommand(h),qe.increaseUpload()):Array.from(new Set(l)).forEach(d=>{bo.getInstance().deleteItemById(d.globalIndex)})}s.forEach(h=>h.partition=R.getInstance().partitionId),this.profileRes=s,!this.shouldAddHistory&&A.publish("sendSplitLine",s),this.profile=null,r.drawing=!0,this.type!=="Partition"&&A.publish("flushService","")}else this.profile!=null&&(this.profile.remove(),A.publish("delete",this.profile)),A.publish("updateRtree",""),this.profile=null,r.drawing=!0,A.publish("updateFrame","")}modify1(e,r,i){if(i&&this.profiles.length>0){!this.shouldAddHistory&&A.publish("sendSplitLine",this.profiles),A.publish("onlySelect",this.profiles.filter(s=>!s.isEmpty)),e._width=this.profiles[0].strokeWidth,e.commands=new De("draw 2DLine - "+this.type);let n=new hi;n.addGroup(e.commands);for(let s=0;s<this.profiles.length;s++)n.addCommand4Item(this.profiles[s],"add"),this.profiles[s].fill();n.checkOutlines(Array.from(this.profiles),new Set),this.profiles.length=0,r.drawing=!0,A.publish("flushService","")}else{if(this.profiles!=null)for(let n=0;n<this.profiles.length;n++)this.profiles[n].remove(),A.publish("delete",this.profiles[n]);A.publish("updateRtree",""),this.profiles=[],r.drawing=!0,A.publish("updateFrame","")}}getLayerIdByCanvasDocType(){let e=Pe.getActiveLayerID();return R.getInstance().doctype!==pi.FOOTPRINT&&_v(e)&&(e=1),e}};var jS=class extends eP{constructor(){super(...arguments);this.pad=null}getResult(e){let r=new Array;e.shape.forEach(n=>{let s=this.getModel(e,n);r.push(s),n.remove(),A.publish("delete",n)}),r=A1(r);let i=r.map(n=>n.primitive);if(r.forEach(n=>{n.remove(),A.publish("delete",n)}),!(i.length==2&&i[0]instanceof M&&i[1]instanceof M)){if(r.length>0){let n=new Wf(i);this.pad=Qt.addPolygonPad(Pe.getActiveLayerID(),"",n.center,0,ge.build2(i),"",!1,1,.4,.4,.4,[],!0,n.high*.6,n.high*.3,"ROUND",0,new S(0,0))}}e.shape.length=0}getPrimitive(e){if(e instanceof Vi||e instanceof es)return e.primitive;if(e instanceof cr)return new M(e.start,e.end);if(e instanceof gs)return q.build2(e.center,e.startAngle,e.endAngle,e.radius,e.radius,e.sweep)}getModel(e,r){let i=Pe.getActiveLayerID();return new Po().clone4Shape(this.getPrimitive(r),i,e._width)}confirmWindow(e,r){this.pad!=null&&A.publish("openMainDialog",{cmd:21,data:{shape:this.pad,tool:r}})}modify(e,r,i){if(i&&this.pad!=null){let n=Eo(this.pad.getMathGraphics()),s=[];n?s=Rhe(this.pad,e.commands,{onlyMove:!0}):(e.commands.addCommand(Ce.dispatch(this.pad,"add")),A.publish("hasModifyPcbItem",this.pad),s=[this.pad],A.publish("onlySelect",s)),Uu.realtimeCheckItems(s),qe.executeCommand(e.commands),e.commands=new De("draw polygon pad"),A.publish("flushService",""),this.pad=null,r.drawing=!0,this.notifyPadReset(r)}else this.pad!=null&&(this.pad.remove(),A.publish("delete",this.pad)),A.publish("updateRtree",""),this.pad=null,r.drawing=!0,this.notifyPadReset(r)}notifyPadReset(e){A.publish("PolygonPadReset",e)}};var F2=class extends Hm{constructor(e,r){super(e.type);this.nextShape=new Array;this.profile=e,this.index=r}getResult(e){let r=new Array;if(e.shape.forEach(i=>{let n=this.getModel(e,i);n!=null&&r.push(n),i.remove()}),this.nextShape.forEach(i=>{let n=this.getModel(e,i);n!=null&&r.push(n),i.remove()}),r=A1(r),this.validChilds(this.profile.type,r)){let i=this.profile.getChildrens(),n=i[this.index];n&&(this.profile instanceof lt&&n.length===2&&(r[r.length-1].end=n[1].end),n.forEach(s=>{s.remove()}),n.length=0),r.forEach(s=>{s.setParent(this.profile)}),i[this.index]=r,this.profile.setChildrens(i),this.profile.strokeWidth=e._width}else{for(let i of r)i.remove();e.commands.addCommand(Ce.dispatch(this.profile,"delete")),this.profile.remove(),A.publish("delete",this.profile),this.profile=null}e.shape.length=0,this.nextShape.length=0,A.publish("hasModifyPcbItem",this.profile)}getModel(e,r){let i=this.profile.layerId,n=new Po;return r.length>0?n.clone4Shape(this.getPrimitive(r),i,e._width):null}confirmWindow(e,r){this.modify(e,r,!0)}modify(e,r,i){let n=new hi;n.addGroup(e.commands);let s=this.profile?[this.profile]:[];this.profile.model.update4Childs(),this.profile instanceof lt&&Eo(this.profile.getMathGraphics())&&(s=lm(this.profile,e.commands)),s.length&&(Uu.realtimeCheckItems(s),n.checkOutlines(s),s.forEach(a=>{a.fill()})),this.profile!=null&&(this.profile.visible(),this.profile.fill(),this.profile=null),r.drawing=!1,A.publish("updateRtree",""),A.publish("tool","dropdrag"),A.publish("flushService","")}};var PD=class extends eP{constructor(e,r){super();this.profile=null;this.type=e,this.confirmWindowCb=r}getResult(e){let r=new Array;e.shape.forEach(i=>{let n=this.getModel(i);r.push(n),i.remove()}),r.length>0&&(this.profile=ge.build2(r)),e.shape.length=0}getModel(e){if(e instanceof Vi||e instanceof es)return e.primitive;if(e instanceof cr)return new M(e.start,e.end);if(e instanceof gs)return q.build4(e.start,e.end,e.center,e.radius,e.radius,e.sweep)}confirmWindow(e,r){this.profile!=null&&(this.type=="Line"||this.type=="Prohibited Region"||this.type=="Fill Region"&&(this.confirmWindowCb(this.profile),A.publish("tool","dropdrag")))}modify(e,r,i){}};var TD=class extends eP{constructor(e,r){super();this.profile=null;this.type=e,this.confirmWindowCb=r}getResult(e){let r=new Array;e.shape.forEach(i=>{let n=this.getModel(i);r.push(n),i.remove()}),r.length>0&&(this.profile=ge.build2(r)),e.shape.length=0}getModel(e){if(e instanceof Vi||e instanceof es)return e.primitive;if(e instanceof cr)return new M(e.start,e.end);if(e instanceof gs)return q.build4(e.start,e.end,e.center,e.radius,e.radius,e.sweep)}confirmWindow(e,r){if(this.profile!=null){if(this.type=="Line"){let i=new Array,n=new Array;this.profile.primitives.forEach(a=>{let l=a.stroke(e._width,wr.ROUND,ae.CCW);i.push(l);let c=Vr.getSelectContect(l);n=n.concat(Array.from(c))});let s=jt.filterElement(n,{boxChoose:!0});s.forEach(a=>{a.click()}),A.publish("select",s),gr.model=1,A.publish("tool","dropdrag")}else if(this.type=="Prohibited Region"){let i=new Set(Kc());Vr.getSelectContect(this.profile).forEach(a=>{i.delete(a)});let s=jt.filterElement(i,{boxChoose:!0});s.forEach(a=>{a.click()}),A.publish("select",s),gr.model=1,A.publish("tool","dropdrag")}else if(this.type=="Fill Region"){let i=Vr.getSelectInside(this.profile);i=jt.filterElement(i,{boxChoose:!0}),i.forEach(n=>{n.click()}),A.publish("select",i),gr.model=1,A.publish("tool","dropdrag")}this.confirmWindowCb&&this.confirmWindowCb(this.profile)}}modify(e,r,i){}};function pje(o){let t=new qt;return o?(t.add("EDIT_BOUNDARY"),t.add("EDIT_NODE"),t.add("MOVE_NODE"),t.add("DELETE_NODE"),t.add("INSERT_NODE")):t.add("COMPLETE"),t}var ID=class extends Cs{constructor(e){super();this.addHistory=!0;this.controlPointMove=!1;this.selectIndex=NaN;this.position=null;this.circle=e,this.commands=new De("select Circle 2D line -"+this.circle.type);let r=this.circle.center.add(new S(-this.circle.radius,0)),i=this.circle.center.add(new S(this.circle.radius,0)),n=this.circle.center.add(new S(0,this.circle.radius)),s=this.circle.center.add(new S(0,-this.circle.radius)),a=this.circle.layerId;this.right=new Ui(a,i),this.top=new Ui(a,n),this.left=new Ui(a,r),this.bottom=new Ui(a,s),this.center=new Ui(a,this.circle.center),this.moveTool=new Qc([this.circle])}flushPoint(){let e=this.circle.center.add(new S(-this.circle.radius,0)),r=this.circle.center.add(new S(this.circle.radius,0)),i=this.circle.center.add(new S(0,this.circle.radius)),n=this.circle.center.add(new S(0,-this.circle.radius));this.center.setPosition(this.circle.center),this.left.setPosition(e),this.right.setPosition(r),this.top.setPosition(i),this.bottom.setPosition(n)}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY,n=NaN;this.mouseLeftDown=!0;let s=!1;if(this.top.isSelect(r,i)&&(n=0,s=!0),this.right.isSelect(r,i)&&(n=1,s=!0),this.bottom.isSelect(r,i)&&(n=2,s=!0),this.left.isSelect(r,i)&&(n=3,s=!0),this.center.isSelect(r,i)&&(this.controlPointMove=!0,s=!0),isNaN(n)||(this.selectIndex=n),R.getInstance().envFlag=="silk-preview"&&this.circle.type==="FPC Stiffener"){let l=this.circle.buildBBox().width(),c=this.circle.buildBBox().height();l=je(l,void 0,"mm"),c=je(c,void 0,"mm"),A.messageBus.publish("changeFPCSize",`${c}*${l}`);let h=this.circle.getComponent(),u={id:this.circle.globalIndex,layerid:this.circle.layerId,material:h==null?void 0:h.material,model:h==null?void 0:h.fpcModel,thickness:h==null?void 0:h.thickness};A.messageBus.publish("changeCheckFPCComponent",u)}return this.addHistory=!0,s||this.circle.isSelect(r,i)}onMouseMove(e){if(this.circle.locked)return!1;let r=this.shiftControl(e),i=this.lastPosition;if(this.addHistory&&(this.commands.addCommand(Ce.dispatch(this.circle,"modify")),this.addHistory=!1,Ce.dispatchCoppers(this.circle,"delete",this.commands),this.circle.clearCopper()),this.circle.removeFill(),this.left.status()){let s=new S(i.x,this.left.y);this.left.setPosition(s),this.circle.radius=this.circle.center.distance1(s);let a=new S(this.circle.center.x*2-s.x,this.circle.center.y),l=new S(this.circle.center.x,this.circle.center.y+this.circle.radius),c=new S(this.circle.center.x,this.circle.center.y-this.circle.radius);return this.right.setPosition(a),this.top.setPosition(l),this.bottom.setPosition(c),!0}if(this.right.status()){let s=new S(i.x,this.right.y);this.right.setPosition(s),this.circle.radius=this.circle.center.distance1(s);let a=new S(this.circle.center.x*2-s.x,this.circle.center.y),l=new S(this.circle.center.x,this.circle.center.y+this.circle.radius),c=new S(this.circle.center.x,this.circle.center.y-this.circle.radius);return this.left.setPosition(a),this.top.setPosition(l),this.bottom.setPosition(c),!0}if(this.top.status()){let s=new S(this.top.x,i.y);this.top.setPosition(s),this.circle.radius=this.circle.center.distance1(s);let a=new S(this.circle.center.x,this.circle.center.y*2-s.y),l=new S(this.circle.center.x-this.circle.radius,this.circle.center.y),c=new S(this.circle.center.x+this.circle.radius,this.circle.center.y);return this.right.setPosition(c),this.left.setPosition(l),this.bottom.setPosition(a),!0}if(this.bottom.status()){let s=new S(this.top.x,i.y);this.bottom.setPosition(s),this.circle.radius=this.circle.center.distance1(s);let a=new S(this.circle.center.x,this.circle.center.y*2-s.y),l=new S(this.circle.center.x-this.circle.radius,this.circle.center.y),c=new S(this.circle.center.x+this.circle.radius,this.circle.center.y);return this.right.setPosition(c),this.left.setPosition(l),this.top.setPosition(a),!0}if(this.center.status()){this.circle.center=i,this.center.setPosition(i);let s=this.circle.center.add(new S(-this.circle.radius,0)),a=this.circle.center.add(new S(this.circle.radius,0)),l=this.circle.center.add(new S(0,this.circle.radius)),c=this.circle.center.add(new S(0,-this.circle.radius));return this.right.setPosition(a),this.top.setPosition(l),this.left.setPosition(s),this.bottom.setPosition(c),!0}this.changeNativeCursor(5);let n=Ae.translate(r.x,r.y,0);return this.circle.getGroupID()!=null?(this.commands=new De("select Circle 2D line -"+this.circle.type),this.moveTool.onMouseMove(e)):this.circle.transform(n),this.center.transform(n),this.right.transform(n),this.top.transform(n),this.left.transform(n),this.bottom.transform(n),!0}onMouseLeftUp(e){if(this.commands.length>0){let r=new hi;r.addGroup(this.commands),r.checkOutlines([this.circle],new Set),this.commands=new De("select Circle 2D line -"+this.circle.type),A.publish("hasModifyPcbItem",this.circle)}return this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),A.publish("flushService",""),A.publish("flushSelectingInfo",""),oC.ready&&!isNaN(this.selectIndex)&&(this.editNode(this.selectIndex),this.clearSelectIndex()),!0}interrupt(){return this.commands.undo(),this.left.remove(),this.right.remove(),this.top.remove(),this.bottom.remove(),this.center.remove(),this.moveTool.interrupt(),this.changeNativeCursor(4),this.removeShiftMoveHelpLine(),A.publish("updateRtree",""),!0}onMouseUpMove(e){let r=e.sceneX,i=e.sceneY;return this.selectPoint(r,i),!1}onMouseRightUp(e){if(e.openMenu){let r=NaN;if(this.top.isSelect(e.realSceneX,e.realSceneY)&&(r=0),this.right.isSelect(e.realSceneX,e.realSceneY)&&(r=1),this.bottom.isSelect(e.realSceneX,e.realSceneY)&&(r=2),this.left.isSelect(e.realSceneX,e.realSceneY)&&(r=3),!isNaN(r))return this.selectIndex=r,this.position=new S(e.realSceneX,e.realSceneY),this.rightClickMenuData(e),!0}return!1}clearSelectIndex(){this.selectIndex=NaN}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:pje(!0).result};$t.getInstance().menuData(r,this)}selectPoint(e,r){this.left.inTop(e,r)||this.right.inTop(e,r)?this.changeNativeCursor(1):this.top.inTop(e,r)||this.bottom.inTop(e,r)?this.changeNativeCursor(0):this.center.inTop(e,r)?this.changeNativeCursor(5):this.circle.isInProfile(e,r)?this.changeNativeCursor(5):this.changeNativeCursor(4)}getArcModel(e,r,i){let n=new zc(this.circle.globalIndex,this.circle.center,this.circle.radius,e,r,i,{layerId:this.circle.layerId,strokeWidth:this.circle.strokeWidth,locked:!1});return new _t(n)}deleteNode(){isNaN(this.selectIndex)||Is.getInstance().init([this.circle],"delete circle node check lock",(e,r)=>{let i=new Array,n=this.circle.center.add(new S(-this.circle.radius,0)),s=this.circle.center.add(new S(this.circle.radius,0)),a=this.circle.center.add(new S(0,this.circle.radius)),l=this.circle.center.add(new S(0,-this.circle.radius)),c=new Po;if(this.selectIndex===2||this.selectIndex===0){let h=this.selectIndex===0?ae.CW:ae.CCW,u=this.selectIndex===0?-Math.PI:Math.PI,d=c.addLine(n,s,this.circle.layerId,this.circle.strokeWidth),p=Yc.addArc(this.circle.layerId,this.circle.center,this.circle.radius,this.circle.strokeWidth,0,u,h,!1);i.push(d,p)}if(this.selectIndex===1||this.selectIndex===3){let h=this.selectIndex===1?ae.CW:ae.CCW,u=-Math.PI/2,d=this.selectIndex===1?-3*Math.PI/2:Math.PI/2,m=new Po().addLine(a,l,this.circle.layerId,this.circle.strokeWidth),g=Yc.addArc(this.circle.layerId,this.circle.center,this.circle.radius,this.circle.strokeWidth,u,d,h,!1);i.push(m,g)}if(i=nm(i),i.length>0){let h=pt.addPolygon(this.circle.type,this.circle.layerId,[i],this.circle.strokeWidth,"",!1);r.addCommand4Item(h,"add"),r.addCommand4Item(this.circle,"delete"),A.publish("delete",this.circle),this.circle.remove()}this.clearSelectIndex(),A.publish("flushSelectingInfo",""),A.publish("updateRtree",""),r.execute()})}editNode(e){let r=new Array,i=this.circle.center.add(new S(-this.circle.radius,0)),n=this.circle.center.add(new S(this.circle.radius,0)),s=this.circle.center.add(new S(0,this.circle.radius)),a=this.circle.center.add(new S(0,-this.circle.radius)),l,c,h,u;e===1&&(u=this.getArcModel(Math.PI/2,3*Math.PI/2,ae.CCW),l=a,c=s,h=n),e===2&&(u=this.getArcModel(0,Math.PI,ae.CCW),l=i,c=n,h=a),e===3&&(u=this.getArcModel(Math.PI/2,3*Math.PI/2,ae.CW),l=a,c=s,h=i),e===0&&(u=this.getArcModel(0,Math.PI,ae.CW),l=i,c=n,h=s),r.push(u),A.publish("redrawPolygon",{shapes:r,last:l,start:c,curr:h,profile:this.circle})}parse(e){switch(e.cmdKey.split(":")[0]){case"INSERT_NODE":{A.publish("toggle",{command:"insertNode"});break}case"EDIT_NODE":this.editNode(this.selectIndex);break;case"MOVE_NODE":A.publish("toggle",{command:"MOVE_NODE",filterItems:[this.circle],inputInfo:this.position,commands:this.commands});break;case"DELETE_NODE":this.deleteNode();break;case"EDIT_BOUNDARY":A.publish("toggle",{command:"editOutline",item:this.circle});break}}rotate(e=le.pcbConfig.rotate){if(!this.controlPointMove){let r=this.circle.getParent();if(r!=null&&r.getGroupID()!=null)this.commands=new De("select Circle 2D line -"+this.circle.type),this.moveTool.rotate(e);else{this.addHistory&&(this.commands=new De("select Circle 2D line -"+this.circle.type),this.commands.addCommand(Ce.dispatch(this.circle,"modify")),this.addHistory=!1);let i=ys([this.circle]);if(i.valid()){let s=i.build1().center();$n.rotate(s,e,[this.circle]),this.flushPoint()}}}}};function fje(o){let t=new qt;return o?(t.add("EDIT_BOUNDARY"),t.add("EDIT_NODE"),t.add("MOVE_NODE"),t.add("DELETE_NODE"),t.add("INSERT_NODE")):t.add("COMPLETE"),t}var s_=class extends Cs{constructor(e){super();this.addHistory=!0;this.controlPointMove=!1;this.selectIndex=NaN;this.curr=null;this.position=null;this.ratio=NaN;this.rect=e,this.commands=new De("select RECT 2D line -"+e.type);let r=this.rect.layerId;this.width=this.rect.width,this.height=this.rect.height,this.matrix=Ae.rotateZ(-this.rect.rotation),this.matrix1=Ae.rotateZ(this.rect.rotation),this.leftLow=new Ui(r,this.rect.getLL()),this.rightLow=new Ui(r,this.rect.getLR()),this.leftUp=new Ui(r,this.rect.getUL()),this.rightUp=new Ui(r,this.rect.getUR()),this.top=new Ui(r,this.rect.getUR().add(this.rect.getUL()).mul(.5),!0),this.bottom=new Ui(r,this.rect.getLL().add(this.rect.getLR()).mul(.5),!0),this.left=new Ui(r,this.rect.getLL().add(this.rect.getUL()).mul(.5),!0),this.right=new Ui(r,this.rect.getUR().add(this.rect.getLR()).mul(.5),!0),this.moveTool=new Qc([this.rect]),this.topDirect=hf(this.leftUp.getPosition().sub(this.rightUp.getPosition()).normalize()),this.leftDirect=hf(this.leftUp.getPosition().sub(this.leftLow.getPosition()).normalize())}flushPoint(){this.leftLow.setPosition(this.rect.getLL()),this.rightLow.setPosition(this.rect.getLR()),this.leftUp.setPosition(this.rect.getUL()),this.rightUp.setPosition(this.rect.getUR()),this.top.setPosition(this.rect.getUR().add(this.rect.getUL()).mul(.5)),this.bottom.setPosition(this.rect.getLL().add(this.rect.getLR()).mul(.5)),this.left.setPosition(this.rect.getLL().add(this.rect.getUL()).mul(.5)),this.right.setPosition(this.rect.getUR().add(this.rect.getLR()).mul(.5))}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY,n=NaN;if(this.controlPointMove=!1,this.leftUp.isSelect(r,i)&&(this.controlPointMove=!0,n=3,this.curr=this.leftUp.getPosition()),this.rightUp.isSelect(r,i)&&(this.controlPointMove=!0,n=2,this.curr=this.rightUp.getPosition()),this.rightLow.isSelect(r,i)&&(this.controlPointMove=!0,n=1,this.curr=this.rightLow.getPosition()),this.leftLow.isSelect(r,i)&&(this.controlPointMove=!0,n=0,this.curr=this.leftLow.getPosition()),this.top.isSelect(r,i)&&(this.controlPointMove=!0,this.curr=this.top.getPosition()),this.bottom.isSelect(r,i)&&(this.controlPointMove=!0,this.curr=this.bottom.getPosition()),this.left.isSelect(r,i)&&(this.controlPointMove=!0,this.curr=this.left.getPosition()),this.right.isSelect(r,i)&&(this.controlPointMove=!0,this.curr=this.right.getPosition()),isNaN(n)||(this.selectIndex=n),R.getInstance().envFlag=="silk-preview"&&this.rect.type==="FPC Stiffener"){let c=this.width,h=this.height;c=je(c,void 0,"mm"),h=je(h,void 0,"mm"),A.messageBus.publish("changeFPCSize",`${h}*${c}`);let u=this.rect.getComponent(),d={id:this.rect.globalIndex,layerid:this.rect.layerId,material:u==null?void 0:u.material,model:u==null?void 0:u.fpcModel,thickness:u==null?void 0:u.thickness};A.messageBus.publish("changeCheckFPCComponent",d)}this.mouseLeftDown=!0,this.addHistory=!0;let a=this.rect.getLL().distance1(this.rect.getUL()),l=this.rect.getLL().distance1(this.rect.getLR());return this.ratio=l/a,this.controlPointMove?this.controlPointMove:this.rect.isSelect(r,i)}onMouseMove(e){if(this.rect.locked)return!1;let r=this.shiftControl(e),i=this.lastPosition;if(this.addHistory&&(this.commands.addCommand(Ce.dispatch(this.rect,"modify")),this.addHistory=!1,Ce.dispatchCoppers(this.rect,"delete",this.commands),this.rect.clearCopper()),e.shiftKey){if(this.proportionRect(r,e))return!0}else{if(this.leftLow.status())return this.changeNativeCursor1(2,this.rect.rotation),this.leftLow.setPosition(i),this.updateLeftLow(),this.updateMids(),this.updateRect(),!0;if(this.rightLow.status())return this.changeNativeCursor1(3,this.rect.rotation),this.rightLow.setPosition(i),this.updateLeftUp(),this.updateMids(),this.updateRect(),!0;if(this.rightUp.status())return this.changeNativeCursor1(2,this.rect.rotation),this.rightUp.setPosition(i),this.updateLeftLow(),this.updateMids(),this.updateRect(),!0;if(this.leftUp.status())return this.changeNativeCursor1(3,this.rect.rotation),this.leftUp.setPosition(i),this.updateLeftUp(),this.updateMids(),this.updateRect(),!0;if(this.top.status()){this.changeNativeCursor1(0,this.rect.rotation);let s=this.rightUp.getPosition().sub(this.leftUp.getPosition()).normalize();r=this.getNormalOffset(s,r);let a=this.rightUp.getPosition().add(r),l=this.leftUp.getPosition().add(r);return hf(l.sub(this.leftLow.getPosition()).normalize()).dot(this.leftDirect)<=0&&(a=this.rightLow.getPosition(),l=this.leftLow.getPosition()),this.rightUp.setPosition(a),this.leftUp.setPosition(l),this.updateLeftLow(),this.updateMids(),this.updateRect(),!0}if(this.bottom.status()){this.changeNativeCursor1(0,this.rect.rotation);let s=this.rightLow.getPosition().sub(this.leftLow.getPosition()).normalize();r=this.getNormalOffset(s,r);let a=this.rightLow.getPosition().add(r),l=this.leftLow.getPosition().add(r);return hf(this.leftUp.getPosition().sub(l).normalize()).dot(this.leftDirect)<=0&&(a=this.rightUp.getPosition(),l=this.leftUp.getPosition()),this.rightLow.setPosition(a),this.leftLow.setPosition(l),this.updateLeftLow(),this.updateMids(),this.updateRect(),!0}if(this.right.status()){this.changeNativeCursor1(1,this.rect.rotation);let s=this.rightUp.getPosition().sub(this.rightLow.getPosition()).normalize();r=this.getNormalOffset(s,r);let a=this.rightUp.getPosition().add(r),l=this.rightLow.getPosition().add(r);return hf(this.leftUp.getPosition().sub(a).normalize()).dot(this.topDirect)<=0&&(l=this.leftLow.getPosition(),a=this.leftUp.getPosition()),this.rightUp.setPosition(a),this.rightLow.setPosition(l),this.updateLeftLow(),this.updateMids(),this.updateRect(),!0}if(this.left.status()){this.changeNativeCursor1(1,this.rect.rotation);let s=this.leftUp.getPosition().sub(this.leftLow.getPosition()).normalize();r=this.getNormalOffset(s,r);let a=this.leftUp.getPosition().add(r),l=this.leftLow.getPosition().add(r);return hf(a.sub(this.rightUp.getPosition()).normalize()).dot(this.topDirect)<=0&&(a=this.rightUp.getPosition(),l=this.rightLow.getPosition()),this.leftUp.setPosition(a),this.leftLow.setPosition(l),this.updateLeftUp(),this.updateMids(),this.updateRect(),!0}}this.changeNativeCursor(5);let n=Ae.translate(r.x,r.y,0);return this.rect.getGroupID()!=null?(this.commands=new De("select RECT 2D line -"+this.rect.type),this.moveTool.onMouseMove(e,r)):this.rect.transform(n),this.leftLow.transform(n),this.rightLow.transform(n),this.rightUp.transform(n),this.leftUp.transform(n),this.top.transform(n),this.bottom.transform(n),this.left.transform(n),this.right.transform(n),!0}onMouseLeftUp(e){let r=this.isZeroLenLine(this.leftUp,this.rightUp),i=this.isZeroLenLine(this.leftUp,this.leftLow);if(!r&&i?this.rect.height=0:r&&!i?this.rect.width=0:r&&i&&(this.commands.undo(),this.commands=new De("select RECT 2D line -"+this.rect.type),A.publish("autoFill",""),A.publish("hasModifyPcbItem",this.rect)),this.commands.length>0){let n=new hi;n.addGroup(this.commands),n.checkOutlines([this.rect],new Set),this.commands=new De("select RECT 2D line -"+this.rect.type),A.publish("autoFill",""),A.publish("hasModifyPcbItem",this.rect)}return this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),A.publish("flushSelectingInfo",""),oC.ready&&!isNaN(this.selectIndex)&&(this.editNode(this.selectIndex),this.clearSelectIndex()),!0}isZeroLenLine(e,r){return e.getPosition().distance1(r.getPosition())<1e-8}interrupt(){return this.commands.undo(),this.leftLow.remove(),this.rightLow.remove(),this.rightUp.remove(),this.leftUp.remove(),this.top.remove(),this.bottom.remove(),this.left.remove(),this.right.remove(),this.moveTool.interrupt(),this.changeNativeCursor(4),this.removeShiftMoveHelpLine(),A.publish("updateRtree",""),!0}onMouseUpMove(e){let r=e.sceneX,i=e.sceneY;return this.selectPoint(r,i),!1}onMouseRightUp(e){if(e.openMenu){let r=NaN;if(this.leftUp.isSelect(e.realSceneX,e.realSceneY)&&(r=3),this.rightUp.isSelect(e.realSceneX,e.realSceneY)&&(r=2),this.rightLow.isSelect(e.realSceneX,e.realSceneY)&&(r=1),this.leftLow.isSelect(e.realSceneX,e.realSceneY)&&(r=0),!isNaN(r))return this.selectIndex=r,this.position=new S(e.realSceneX,e.realSceneY),this.rightClickMenuData(e),!0}return!1}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:fje(!0).result};$t.getInstance().menuData(r,this)}clearSelectIndex(){this.selectIndex=NaN}selectIndexToPoint(e){switch(e){case 0:return this.rect.getLL();case 3:return this.rect.getUL();case 1:return this.rect.getLR();case 2:return this.rect.getUR();default:throw"selectSide is illegal"}}getOtherLinesExcept(e){let r=this.rect.getAllLinesInOrder(),i=r.length,n=new Array;if(this.rect.cornerRadius<=0){let s=e+1;for(let a=s;a<s+2;a++)n.push(r[a%i])}else for(let s=e*2+2;s<e*2-1+i;s++)n.push(r[s%i]);return n}editNode(e){let r=new Array,i={layerId:this.rect.layerId,strokeWidth:this.rect.strokeWidth,locked:!1};this.getOtherLinesExcept(e).forEach(n=>{if(n instanceof M){let s=new wc(this.rect.globalIndex,n.start(),n.end(),i);r.push(new mt(s))}else if(n instanceof q){let s=new zc(this.rect.globalIndex,n.center,n.rx,zt.toRadians(n.startAngle),zt.toRadians(n.endAngle()),n.sweep(),i);r.push(new _t(s))}}),A.publish("redrawPolygon",{shapes:r,last:r[r.length-1].end,start:r[0].start,curr:this.selectIndexToPoint(e),profile:this.rect})}deleteNode(){isNaN(this.selectIndex)||Is.getInstance().init([this.rect],"delete rect node check lock",(e,r)=>{let i=new Po,n=i.ptsToShapes(this.getOtherLinesExcept(this.selectIndex),this.rect.layerId,this.rect.strokeWidth);if(n.push(i.addLine(n[n.length-1].end,n[0].start,this.rect.layerId,this.rect.strokeWidth)),n=nm(n),n.length>0){let s=pt.addPolygon(this.rect.type,this.rect.layerId,[n],this.rect.strokeWidth,"",!1);r.addCommand4Item(s,"add")}r.addCommand4Item(this.rect,"delete"),A.publish("delete",this.rect),this.rect.remove(),this.selectIndex=NaN,A.publish("flushSelectingInfo",""),A.publish("updateRtree",""),r.execute()})}parse(e){switch(e.cmdKey.split(":")[0]){case"INSERT_NODE":{A.publish("toggle",{command:"insertNode"});break}case"EDIT_NODE":this.editNode(this.selectIndex);break;case"MOVE_NODE":A.publish("toggle",{command:"MOVE_NODE",filterItems:[this.rect],inputInfo:this.position,commands:this.commands});break;case"DELETE_NODE":this.deleteNode();break;case"EDIT_BOUNDARY":A.publish("toggle",{command:"editOutline",item:this.rect});break}}getNormalOffset(e,r){let i=new S(-e.y,e.x);return i.mul(r.dot(i))}selectPoint(e,r){this.leftLow.inTop(e,r)||this.rightUp.inTop(e,r)?this.changeNativeCursor1(2,this.rect.rotation):this.rightLow.inTop(e,r)||this.leftUp.inTop(e,r)?this.changeNativeCursor1(3,this.rect.rotation):this.top.inTop(e,r)||this.bottom.inTop(e,r)?this.changeNativeCursor1(0,this.rect.rotation):this.left.inTop(e,r)||this.right.inTop(e,r)?this.changeNativeCursor1(1,this.rect.rotation):this.rect.isInProfile(e,r)?this.changeNativeCursor(5):this.changeNativeCursor(4)}getBBox(e,r){let i=new _e;return i.ext2(e).ext2(r),i.build1()}getTop(){return this.rightUp.getPosition().add(this.leftUp.getPosition()).mul(.5)}getBottom(){return this.leftLow.getPosition().add(this.rightLow.getPosition()).mul(.5)}getLeft(){return this.leftLow.getPosition().add(this.leftUp.getPosition()).mul(.5)}getRight(){return this.rightUp.getPosition().add(this.rightLow.getPosition()).mul(.5)}updateRect(){let e=Ae.rotateZForPoint(this.rect.getUL(),-this.rect.rotation),r=Ae.rotateZForPoint(this.rect.getUL(),this.rect.rotation),i=this.leftLow.getPosition().multiply4(e),n=this.rightUp.getPosition().multiply4(e),s=this.getBBox(i,n);this.rect.setLL(this.getPoint(s.LL().multiply4(r))),this.rect.setLR(this.getPoint(s.LR().multiply4(r))),this.rect.setUR(this.getPoint(s.UR().multiply4(r))),this.rect.setUL(this.getPoint(s.UL().multiply4(r))),this.rect.removeFill()}getPoint(e){let r=Number.MAX_VALUE,i=e,n=e.distance2(this.leftLow.getPosition());n<r&&(r=n,i=this.leftLow.getPosition());let s=e.distance2(this.leftUp.getPosition());s<r&&(r=s,i=this.leftUp.getPosition());let a=e.distance2(this.rightLow.getPosition());a<r&&(r=a,i=this.rightLow.getPosition());let l=e.distance2(this.rightUp.getPosition());return l<r&&(r=l,i=this.rightUp.getPosition()),i}updateLeftLow(){let e=Ae.rotateZForPoint(this.rect.getUL(),-this.rect.rotation),r=Ae.rotateZForPoint(this.rect.getUL(),this.rect.rotation),i=this.leftLow.getPosition().multiply4(e),n=this.rightUp.getPosition().multiply4(e),s=new S(i.x,n.y),a=new S(n.x,i.y);this.rightLow.setPosition(a.multiply4(r)),this.leftUp.setPosition(s.multiply4(r))}updateLeftUp(){let e=Ae.rotateZForPoint(this.rect.getUL(),-this.rect.rotation),r=Ae.rotateZForPoint(this.rect.getUL(),this.rect.rotation),i=this.leftUp.getPosition().multiply4(e),n=this.rightLow.getPosition().multiply4(e),s=new S(i.x,n.y),a=new S(n.x,i.y);this.leftLow.setPosition(s.multiply4(r)),this.rightUp.setPosition(a.multiply4(r))}updateMids(){this.top.setPosition(this.getTop()),this.bottom.setPosition(this.getBottom()),this.left.setPosition(this.getLeft()),this.right.setPosition(this.getRight())}rotate(e=le.pcbConfig.rotate){if(!this.controlPointMove){let r=this.rect.getParent();if(r!=null&&r.getGroupID()!=null)this.commands=new De("select RECT 2D line -"+this.rect.type),this.moveTool.rotate(e);else{this.addHistory&&(this.commands=new De("select RECT 2D line -"+this.rect.type),this.commands.addCommand(Ce.dispatch(this.rect,"modify")),this.addHistory=!1);let i=ys([this.rect]);if(i.valid()){let s=i.build1().center();$n.rotate(s,e,[this.rect]),this.flushPoint()}}}}proportionRect(e,r){let i=new S(r.sceneX,r.sceneY);if(this.leftLow.status()){let n=this.curr.sub(this.rightUp.getPosition()).multiply4(this.matrix),s=new S(n.x,0).normalize().multiply4(this.matrix1),a=new S(0,n.y).normalize().multiply4(this.matrix1),l=i.sub(this.curr),c=l.dot(s),h=l.dot(a);c!=0&&Math.abs(c)>Math.abs(h)?h=(c+this.width)/this.ratio-this.height:h!=0&&Math.abs(h)>Math.abs(c)&&(c=(h+this.height)*this.ratio-this.width);let u=s.mul(c).add(a.mul(h)),d=this.curr.add(u);return this.leftLow.setPosition(d),this.updateLeftLow(),this.updateMids(),this.updateRect(),!0}if(this.rightLow.status()){let n=this.curr.sub(this.leftUp.getPosition()).multiply4(this.matrix),s=new S(n.x,0).normalize().multiply4(this.matrix1),a=new S(0,n.y).normalize().multiply4(this.matrix1),l=i.sub(this.curr),c=l.dot(s),h=l.dot(a);c!=0&&Math.abs(c)>Math.abs(h)?h=(c+this.width)/this.ratio-this.height:h!=0&&Math.abs(h)>Math.abs(c)&&(c=(h+this.height)*this.ratio-this.width);let u=s.mul(c).add(a.mul(h)),d=this.curr.add(u);return this.rightLow.setPosition(d),this.updateLeftUp(),this.updateMids(),this.updateRect(),!0}if(this.rightUp.status()){let n=this.curr.sub(this.leftLow.getPosition()).multiply4(this.matrix),s=new S(n.x,0).normalize().multiply4(this.matrix1),a=new S(0,n.y).normalize().multiply4(this.matrix1),l=i.sub(this.curr),c=l.dot(s),h=l.dot(a);c!=0&&Math.abs(c)>Math.abs(h)?h=(c+this.width)/this.ratio-this.height:h!=0&&Math.abs(h)>Math.abs(c)&&(c=(h+this.height)*this.ratio-this.width);let u=s.mul(c).add(a.mul(h)),d=this.curr.add(u);return this.rightUp.setPosition(d),this.updateLeftLow(),this.updateMids(),this.updateRect(),!0}if(this.leftUp.status()){let n=this.curr.sub(this.rightLow.getPosition()).multiply4(this.matrix),s=new S(n.x,0).normalize().multiply4(this.matrix1),a=new S(0,n.y).normalize().multiply4(this.matrix1),l=i.sub(this.curr),c=l.dot(s),h=l.dot(a);c!=0&&Math.abs(c)>Math.abs(h)?h=(c+this.width)/this.ratio-this.height:h!=0&&Math.abs(h)>Math.abs(c)&&(c=(h+this.height)*this.ratio-this.width);let u=s.mul(c).add(a.mul(h)),d=this.curr.add(u);return this.leftUp.setPosition(d),this.updateLeftUp(),this.updateMids(),this.updateRect(),!0}if(this.top.status()){let n=this.top.getPosition().sub(this.bottom.getPosition()).multiply4(this.matrix),s=new S(1,0).normalize().multiply4(this.matrix1),a=new S(0,n.y).normalize().multiply4(this.matrix1),c=i.sub(this.curr).dot(a),h;a.y<0?h=(-c+this.height)*this.ratio/2:h=(c+this.height)*this.ratio/2;let u=a.mul(c).add(s.mul(-h)),d=a.mul(c).add(s.mul(h)),p=this.curr.add(d),m=this.curr.add(u);return this.rightUp.setPosition(p),this.updateLeftLow(),this.leftUp.setPosition(m),this.updateLeftUp(),this.updateMids(),this.updateRect(),!0}if(this.bottom.status()){let n=this.bottom.getPosition().sub(this.top.getPosition()).multiply4(this.matrix),s=new S(1,0).normalize().multiply4(this.matrix1),a=new S(0,n.y).normalize().multiply4(this.matrix1),c=i.sub(this.curr).dot(a),h;a.y<0?h=(c+this.height)*this.ratio/2:h=(-c+this.height)*this.ratio/2;let u=a.mul(c).add(s.mul(-h)),d=a.mul(c).add(s.mul(h)),p=this.curr.add(d),m=this.curr.add(u);return this.leftLow.setPosition(m),this.updateLeftLow(),this.rightLow.setPosition(p),this.updateLeftUp(),this.updateMids(),this.updateRect(),!0}if(this.right.status()){let n=this.right.getPosition().sub(this.left.getPosition()).multiply4(this.matrix),s=new S(n.x,0).normalize().multiply4(this.matrix1),a=new S(0,1).normalize().multiply4(this.matrix1),c=i.sub(this.curr).dot(s),h;s.x<0?h=(-c+this.width)/this.ratio/2:h=(c+this.width)/this.ratio/2;let u=s.mul(c).add(a.mul(-h)),d=s.mul(c).add(a.mul(h)),p=this.curr.add(u),m=this.curr.add(d);return this.rightUp.setPosition(p),this.updateLeftLow(),this.rightLow.setPosition(m),this.updateLeftUp(),this.updateMids(),this.updateRect(),!0}if(this.left.status()){let n=this.left.getPosition().sub(this.right.getPosition()).multiply4(this.matrix),s=new S(n.x,0).normalize().multiply4(this.matrix1),a=new S(0,1).normalize().multiply4(this.matrix1),c=i.sub(this.curr).dot(s),h;s.x<0?h=(c+this.width)/this.ratio/2:h=(-c+this.width)/this.ratio/2;let u=s.mul(c).add(a.mul(-h)),d=s.mul(c).add(a.mul(h)),p=this.curr.add(u),m=this.curr.add(d);return this.leftUp.setPosition(p),this.updateLeftUp(),this.leftLow.setPosition(m),this.updateLeftLow(),this.updateMids(),this.updateRect(),!0}return!1}isControlPoint(){return this.leftLow.status()||this.leftUp.status()||this.rightLow.status()||this.rightUp.status()}};function Dhe(o,t=!1,e=NaN){let r=new qt;return o?(r.add("EDIT_BOUNDARY"),isNaN(e)?r.add("MOVE_NODE"):(r.add("EDIT_NODE"),r.add("MOVE_NODE"),t||r.add("DELETE_NODE")),r.add("INSERT_NODE")):r.add("COMPLETE"),r}var whe=class{constructor(){this.event=new Array}getOffset(t,e){let r=new S(-t.y,t.x);return r.mul(e.dot(r))}getLine(t,e,r=1e4,i){i=i||hf(t.sub(e).normalize());let n=i.normalize().mul(r+e.sub(t).length());return new M(t.sub(n),e.add(n))}getInterestPoint(t,e){return Y9(t,e)>0?new S(Ee[0],Ee[1]):null}isEqualSlope(t,e){return V3e(t,e)}};var Oq=class extends whe{constructor(t){super(),this.polygon=t,this.event=t.getChildrens().map(e=>e.map(r=>new tce(r)))}moveOffset(t,e,r){let i=this.event[t][e].shape,n=i.getParent(),s=n.getConnect(i,!0),a=n.getConnect(i,!1),l=this.event[t][e].direct,c=this.getOffset(l,r),h=i.start.sub(i.end),u=i.start.add(c),d=i.end.add(c),p=this.getLine(u,u.add(l),void 0,l);return s!=null&&a!=null?[u,d]=this.has2Line(t,e,u,d,s,a,p,l,h):s!=null&&a==null&&s instanceof mt?[u,d]=this.updateByPrev(t,e,u,d,s,h,p,l):s==null&&a!=null&&a instanceof mt&&([u,d]=this.updateByNext(t,e,u,d,a,h,p,l)),this.child=i,this.selectIndex=[t,e],[u,d]}has2Line(t,e,r,i,n,s,a,l,c){return n instanceof mt&&s instanceof mt?[r,i]=this.updateBy2Line(t,e,r,i,n,s,a,l):n instanceof _t&&s instanceof mt?[r,i]=this.updateByNext(t,e,r,i,s,c,a,l,n):n instanceof mt&&s instanceof _t&&([r,i]=this.updateByPrev(t,e,r,i,n,c,a,l,s)),[r,i]}updateBy2Line(t,e,r,i,n,s,a,l){let c=this.event[t],h=e===c.length-1?c[0].direct:c[e+1].direct,u=e==0?c[c.length-1].direct:c[e-1].direct;if(this.isEqualSlope(l,h)||this.isEqualSlope(l,u))return[c[e].oldStart,c[e].oldEnd];let d=this.getLine(s.start,s.end,void 0,h),p=this.getLine(n.start,n.end,void 0,u),m=this.getInterestPoint(a,d),g=this.getInterestPoint(a,p);if(m!=null&&g!=null&&hf(m.sub(g).normalize()).dot(l)<=0){let b=this.getInterestPoint(p,d);b!=null&&(m=b,g=b)}return m!=null&&g!=null&&(hf(g.sub(n.start).normalize()).dot(u)<=0&&(g=n.start,a=this.getLine(g.add(l),g),m=this.getInterestPoint(a,d)),hf(s.end.sub(m).normalize()).dot(h)<=0&&(m=s.end,a=this.getLine(m.add(l),m),g=this.getInterestPoint(a,p))),m!=null&&g!=null&&(r=g,i=m),[r,i]}updateByPrev(t,e,r,i,n,s,a,l,c){let h=this.event[t],u=e==0?h[h.length-1].direct:h[e-1].direct,d=h[e];if(this.isEqualSlope(l,u))return[d.oldStart,d.oldEnd];let p=this.getLine(n.start,n.end,void 0,u),m=this.getLine(d.oldEnd,i,void 0,new S(-l.y,l.x)),g=this.getInterestPoint(a,p);if(g!=null){if(hf(i.sub(g).normalize()).dot(l)<=0){let P=m?this.getInterestPoint(p,m):null;P!=null?(i=c?P:n.end,r=c?P:n.end,g=P):(i=n.end,r=n.end)}if(hf(g.sub(n.start).normalize()).dot(u)<=0){g=n.start;let P=g.sub(d.oldStart),T=this.getOffset(l,P);i=c?d.oldEnd.add(T):g.sub(s)}r=g}return[r,i]}updateByNext(t,e,r,i,n,s,a,l,c){let h=this.event[t],u=e===h.length-1?h[0].direct:h[e+1].direct,d=h[e];if(this.isEqualSlope(l,u))return[d.oldStart,d.oldEnd];let p=this.getLine(n.start,n.end,void 0,u),m=this.getLine(d.oldStart,r,void 0,new S(-l.y,l.x)),g=this.getInterestPoint(a,p);if(g!=null){if(hf(g.sub(r).normalize()).dot(l)<=0){let P=m?this.getInterestPoint(m,p):null;P!=null?(i=c?P:n.start,r=c?P:n.start,g=P):(i=n.start,r=n.start)}if(hf(n.end.sub(g).normalize()).dot(u)<=0){g=n.end;let P=g.sub(d.oldEnd),T=this.getOffset(l,P);r=c?d.oldStart.add(T):g.add(s)}i=g}return[r,i]}removeZeroLenLine(t,e,r){let[i,n]=e,s=this.child;if(!s&&!e)return!0;if(!s&&e)return this.updateChildren(t),!0;s&&([i,n]=this.selectIndex);let a=this.event[i].length,l=s.getParent(),c=l.getConnect(s,!0),h=l.getConnect(s,!1);if(a===3&&s instanceof mt&&h!=null&&h instanceof mt&&c!=null&&c instanceof mt&&this.polygon.isClose(i)&&(s.length<=1e-8||h.length<=1e-8||c.length<=1e-8))return t.undo(),!1;if(a===4&&r&&r!="Line"&&s instanceof mt&&h!=null&&h instanceof mt&&c!=null&&c instanceof mt&&h!=null&&h instanceof mt&&this.polygon.isClose(i)){let u=!0;for(let d=0;d<3;d++)if(!this.isEqualSlope(this.event[i][d].direct,this.event[i][d+1].direct)){u=!1;break}if(u)return t.undo(),!1}return this.updateChildren(),!0}updateChildren(t){let e=this.polygon.getChildrens(),r=new Array;for(let i of e){r.push([]);for(let n of i)if(!ne.eq(n.length,0))r[r.length-1].push(n);else{if(t&&i.length===1){t.undo();return}n.remove()}}e.length=0,this.polygon.setChildrens(r)}getClickPosition(t){let[e,r]=t,i=this.event[e][r].oldStart,n=this.event[e][r].oldEnd;return[i,n]}};var gxt=.1,yxt=ee.WHITE,bxt=[new S(1,0),new S(0,1)],Pxt=[new S(1,0).rotate(S.ORIGIN,Math.PI/4),new S(1,0).rotate(S.ORIGIN,-Math.PI/4)],uG=class extends Cs{constructor(e,r=!0,i){super();this.polygon=null;this._points=new Array;this._mids=new Array;this.insertMsg="Please select a node to insert";this.polygonPad=null;this._nodeInsert=!1;this.selectPolyIndex=[NaN,NaN];this._selectIndex=[NaN,NaN];this._controlPointMove=!1;this._letfSelectIndex=[NaN,NaN];this._mouseLeftSelectIndex=[NaN,NaN];this.insertCb=null;this.obliqueLine=[];this.polygon=e,this.showAllPoints=r;let n=this.getChildrens(this.polygon),s=this.polygon.layerId;n.forEach((a,l)=>{if(this._points[l]=[],this._mids[l]=[],a.forEach((c,h)=>{let u=new Ui(s,c.start);this._points[l].push(u);let d=new Ui(s,c.midPoint,!0);this._mids[l].push(d),c===i&&(this.selectPolyIndex=[l,h])}),!this.polygon.isClose(l)){let c=new Ui(s,a[a.length-1].end);this._points[l].push(c)}}),this.dragPolygon=new Oq(e)}getChildrens(e){return this.showAllPoints?e.getChildrens():e.filterOutMostChildren().slice(0,1)}get nodeInsert(){return this._nodeInsert}set nodeInsert(e){this._nodeInsert=e}get points(){return this._points}get mids(){return this._mids}get letfSelectIndex(){return this._letfSelectIndex}set letfSelectIndex(e){this._letfSelectIndex=e}get selectIndex(){return this._selectIndex}set selectIndex(e){this._selectIndex=e}get controlPointMove(){return this._controlPointMove}get mouseLeftSelectIndex(){return this._mouseLeftSelectIndex}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;if(this._controlPointMove=!1,this.nodeInsert)return!1;for(let s=0;s<this._points.length;s++)for(let a=0;a<this._points[s].length;a++)this._points[s][a].isSelect(r,i)&&(this._controlPointMove=!0,this._letfSelectIndex=[s,a]);for(let s=0;s<this._mids.length;s++)for(let a=0;a<this._mids[s].length;a++)this._mids[s][a].isSelect(r,i)&&(this._controlPointMove=!0);this._controlPointMove&&this.polygon.removeFill();let n=dG(this.polygon);this._mouseLeftSelectIndex=[NaN,NaN];for(let s=0;s<this._points.length;s++)for(let a=0;a<this._points[s].length;a++){let c=this._points[s][a].isSelect(r,i);c&&(this._mouseLeftSelectIndex=[s,a]),!(n==3&&(a==0||a==this._points[s].length-1))&&c&&(this.selectIndex=[s,a])}return this.mouseLeftDown=!0,this.lastPosition=new S(r,i),this._controlPointMove?this._controlPointMove:this.polygon.isSelect(r,i)}onMouseMove(e){if(this.polygon.locked)return!1;this.removeObliqueLine(),ze.lastItems=[],ai.snapToSnapFlag(e,void 0,!0);let r=this.shiftControl(e),i=this.lastPosition,n=this.getChildrens(this.polygon);for(let s=0;s<n.length;s++){let a=n[s],l=a.length,c=this._points[s],h=this._mids[s];for(let u=0;u<l;u++){let d=a[u],p=c[u];if(p.status()){this.changleMouseStyle("pointer");let m=this.hasCArc(d,s,u,l),g=this.polygon.getConnect(d,!0);if(m===-1||m===u){if(m===-1)d.start=i,p.setPosition(i),h[u].setPosition(d.midPoint);else{d=d;let y=i.angle(d.center);d.startAngle=y,p.setPosition(d.start),i=d.start,h[u].setPosition(d.midPoint)}g!=null&&(g.end=i,u==0?h[l-1].setPosition(g.midPoint):h[u-1].setPosition(g.midPoint)),this.handelObliqueLineData(p,c),ai.handleAddSnapFlagData(g,d)}else{let y=a[m];y=y;let b=i.angle(y.center);y.endAngle=b,p.setPosition(y.end),i=y.end,h[m].setPosition(y.midPoint);let P=this.polygon.getConnect(y,!1);P.start=i;let T=m+1===l?0:m+1;h[T].setPosition(P.midPoint)}return!0}}if(c.length>l){let u=c[c.length-1];if(u.status()){this.changleMouseStyle("pointer");let d=a[l-1];if(d instanceof _t&&d.arcType===2&&this.selectPolyIndex[1]==l-1){let p=i.angle(d.center);d.endAngle=p,u.setPosition(d.end),h[l-1].setPosition(d.midPoint)}else a[l-1].end=i,u.setPosition(i),h[l-1].setPosition(a[l-1].midPoint),this.handelObliqueLineData(u,c),ai.handleAddSnapFlagData(d);return!0}}for(let u=0;u<l;u++){let d=h[u];if(d.status()){this.changleMouseStyle("pointer");let p=a[u];if(p instanceof mt){if(a.length<=1)continue;let[m,g]=this.dragPolygon.moveOffset(s,u,r);p.start=m,p.end=g,c[u].setPosition(m),d.setPosition(p.midPoint);let y=this.polygon.getConnect(p,!1);y!=null?(y.start=g,u==l-1?c[0].setPosition(g):c[u+1].setPosition(g),u==l-1?h[0].setPosition(y.midPoint):h[u+1].setPosition(y.midPoint)):c.length>l&&c[l].setPosition(g);let b=this.polygon.getConnect(p,!0);b!=null&&(b.end=m,u==0?h[l-1].setPosition(b.midPoint):h[u-1].setPosition(b.midPoint))}else if(Math.abs(p.start.sub(i).cross(p.end.sub(i)))>1e-8){let m=new Yn,{center:g,radius:y,startAngle:b,endAngle:P,sweep:T}=m.point2Angle(p.start,p.end,i);p.center=g,p.radius=y,p.startAngle=b,p.endAngle=P,p.sweep=T,d.setPosition(p.midPoint)}return!0}}}return!1}onMouseUpMove(e){if(this.nodeInsert)return Ut.update(e,this.insertMsg),!1;let r=e.sceneX,i=e.sceneY;for(let n of this.points)for(let s of n)if(s.inTop(r,i))return this.changleMouseStyle("pointer"),!0;for(let n of this.mids)for(let s of n)if(s.inTop(r,i))return this.changleMouseStyle("pointer"),!0;return this.polygon.isInProfile(r,i)?this.changeNativeCursor(5):this.changleMouseStyle("default"),!0}onMouseLeftUp(e){return this.mouseLeftDown=!1,this.removeObliqueLine(),ai.clearSnapFlag(),this.nodeInsert&&this.insert(e),!0}onMouseRightUp(e){return!0}interrupt(){return this._points.forEach(e=>e.forEach(r=>r.remove())),this._mids.forEach(e=>e.forEach(r=>r.remove())),this._points.length=0,this._mids.length=0,this.removeShiftMoveHelpLine(),this.removeObliqueLine(),!0}flushPoint(){let e=this.getChildrens(this.polygon),r=this.polygon.layerId;for(let i=0,n=e.length;i<n;i++){let s=e[i],a=this.points[i],l=this.mids[i],c=s.length;for(let h=0;h<c;h++){let u=s[h];a[h].setPosition(u.start),l[h].setPosition(u.midPoint)}if(a.length==c){let h=new Ui(r,s[c-1].end);a.push(h)}else a[c].setPosition(s[c-1].end)}}editNode(e){let[r,i]=e,s=this.getChildrens(this.polygon)[r],a=s.length,l=new Array,c=new Array,h=this.polygon.isClose();if(i>0)if(h){for(let g=i+1;g<a;g++)l.push(s[g]);for(let g=0;g<i-1;g++)l.push(s[g])}else{for(let g=0;g<i-1;g++)l.push(s[g]);for(let g=i+1;g<a;g++)c.push(s[g])}else for(let g=i+1;g<a-1;g++)l.push(s[g]);let u,d,p,m=this.polygon.getConnect(s[i],!0);return this.polygon.type=="Line"&&!this.polygon.isClose(r)?s.length==1?i==0?(u=s[0].end,d=s[0].end,p=s[0].start):(u=s[0].start,d=s[0].start,p=s[0].end):i==s.length?(u=s[i-1].start,d=s[i-1].start,p=s[i-1].end):this.selectIndex[1]==0?(u=s[0].end,d=s[0].end,p=s[0].start):(u=m.start,d=s[i].end,p=s[i].start):(u=m.start,d=s[i].end,p=s[i].start),this.handelObliqueLineData(this.points[r][i],this.points[r]),ai.handleAddSnapFlagData(m,s[i]),{shapes:l,nextshapes:c,last:u,start:d,curr:p}}insert(e){var l;let r=e.realSceneX,i=e.realSceneY,n=new S(r,i),s=this.polygon.primitives,a=-1;for(let c=0;c<s.length;c++)if(s[c].inArea(n,.2,wr.ROUND)){a=c;break}if(a>=0){let c=new Array;for(let u=a+1;u<s.length;u++)c.push(s[u]);for(let u=0;u<a;u++)c.push(s[u]);let h=[];Ut.cancel(),(l=this.insertCb)==null||l.call(this,{shapes:c,last:c[c.length-1].end(),start:c[0].start(),curr:n,profile:this.polygonPad,padDrillModels:h})}}insertNode(e,r){if(this.nodeInsert=!0,this.polygonPad=e,this.insertCb=r,!e)return A.publish("toggle",{command:"insertNode"})}deletePoint(){!isNaN(this.selectIndex[0])&&!isNaN(this.selectIndex[1])&&(this.polygon.deletePoint(this.selectIndex),this.flushPoint())}cancel(){this.nodeInsert&&(Ut.cancel(),this.nodeInsert=!1,this.polygonPad=null)}hasCArc(e,r,i,n){let s=this.polygon.getConnect(e,!0),a=-1;return[e,s].find((c,h)=>{if(c&&c instanceof _t&&c.arcType==2&&(a=h===0?i:i-1,a===-1&&(a=n-1),a===this.selectPolyIndex[1]))return!0})?a:-1}handelObliqueLineData(e,r){le.adsorptionConfig.getConfig("Extended Line")&&this.checkOblique(e,r)}checkOblique(e,r){let{orthogonal:i,oblique:n}=this.getObliquePoints(e,r);r.filter(s=>s!==e).forEach(s=>{ai.handelAddSnapFlagPoint(s.position)}),i.forEach(s=>{s.length>0&&this.generateAdsorbLine(e.position,s)}),n.forEach(s=>{s.length>0&&this.generateAdsorbLine(e.position,s)})}inEps(e,r){return Math.abs(e-r)<=1e-5}getObliquePoints(e,r){let i=[[],[]],n=[[],[]];return r.forEach(s=>{let a=s.position.sub(e.position);if(ne.greater(a.length(),0)){let l=a.normalize();bxt.forEach((c,h)=>{let u=Math.abs(c.dot(l));if(this.inEps(u,1))return i[h].push(s.position)}),Pxt.forEach((c,h)=>{let u=Math.abs(c.dot(l));if(this.inEps(u,1))return n[h].push(s.position)})}}),{orthogonal:i,oblique:n}}generateAdsorbLine(e,r){let i=[];i.push(e);for(let l of r)i.push(l);let n=i[1].sub(i[0]);Er(i,(l,c)=>n.x!==0?l.x-c.x:l.y-c.y);let s=i[0],a=i[i.length-1];this.addObliqueLine(s,a)}addObliqueLine(e,r){let i=Vi.build(this.polygon.layerId,e,r,gxt,yxt);i.manualHighLight=!0,this.obliqueLine.push(i)}removeObliqueLine(){for(let e of this.obliqueLine)e.remove();this.obliqueLine=[]}updatePoints(){this.dragPolygon=new Oq(this.polygon),this.interrupt();let e=this.polygon.layerId;this.getChildrens(this.polygon).forEach((i,n)=>{if(this._points[n]=[],this._mids[n]=[],i.forEach((s,a)=>{let l=new Ui(e,s.start);this._points[n].push(l);let c=new Ui(e,s.midPoint,!0);this._mids[n].push(c),this.selectPolyIndex=[NaN,NaN]}),!this.polygon.isClose(n)){let s=new Ui(e,i[i.length-1].end);this._points[n].push(s)}}),this.polygon.manualHighLight=!1,this.selectPolyIndex=[NaN,NaN],this._selectIndex=[NaN,NaN],this._controlPointMove=!1,this._letfSelectIndex=[NaN,NaN],this._mouseLeftSelectIndex=[NaN,NaN],this.polygon.manualHighLight=!0}removeZeroLenLine(e){return this.dragPolygon.removeZeroLenLine(e,this.letfSelectIndex,this.polygon.type)}};var V2=class extends Cs{constructor(e,r){super();this.addHistory=!0;this.position=null;this.polygon=e,this.commands=new De("select Polygon 2D line -"+e.type),this.showAllPoints=ze.lastItems&&ze.lastItems.length==1&&ze.lastItems[0].globalIndex==e.globalIndex,this.controlPointTool=new uG(e,this.showAllPoints),this.moveTool=new Qc([this.polygon])}get selectIndex(){return this.controlPointTool.selectIndex}set selectIndex(e){this.controlPointTool.selectIndex=e}onMouseLeftDown(e){let r=this.controlPointTool.onMouseLeftDown(e);if(R.getInstance().envFlag=="silk-preview"&&this.polygon.type==="FPC Stiffener"){let n=this.polygon.buildBBox().width(),s=this.polygon.buildBBox().height();n=je(n,void 0,"mm"),s=je(s,void 0,"mm"),A.messageBus.publish("changeFPCSize",`${s}*${n}`);let a=this.polygon.getComponent(),l={id:this.polygon.globalIndex,ayerid:this.polygon.layerId,material:a==null?void 0:a.material,model:a==null?void 0:a.fpcModel,thickness:a==null?void 0:a.thickness};A.messageBus.publish("changeCheckFPCComponent",l)}return this.addHistory=!0,r}onMouseMove(e){if(this.polygon.locked)return!1;ze.lastItems=[];let r=this.shiftControl(e);if(this.addHistory&&(this.commands.addCommand(Ce.dispatch(this.polygon,"modify")),this.addHistory=!1,Ce.dispatchCoppers(this.polygon,"delete",this.commands),this.polygon.clearCopper()),!this.controlPointTool.onMouseMove(e)){let n=Ae.translate(r.x,r.y,0);this.polygon.getGroupID()==null&&this.polygon.transform(n),this.controlPointTool.points.forEach(s=>{s.forEach(a=>a.transform(n))}),this.controlPointTool.mids.forEach(s=>{s.forEach(a=>a.transform(n))})}return!0}flushPoint(){this.controlPointTool.flushPoint()}onMouseLeftUp(e){if(this.polygon.isEmpty)return;let r=this.getChildrens(this.polygon);for(let a=0;a<r.length;a++){let l=r[a];if(this.polygon.isClose(a)&&this.polygon.type=="Line"&&this.polygon.layerId==11&&this.controlPointTool.points.length>l.length){let h=l.length-1;isNaN(this.controlPointTool.letfSelectIndex[1])||(this.controlPointTool.letfSelectIndex[1]===0?l[0].start=l[h].end:this.controlPointTool.letfSelectIndex[1]===h+1&&(l[h].end=l[0].start),this.controlPointTool.letfSelectIndex=[a,NaN]),this.polygon.type="Board Outline"}}let i=this.controlPointTool.removeZeroLenLine(this.commands),n=this.polygon.layerId,s=this.polygon.getMathGraphics(n,0);if(this.commands.length>0&&i){let a=Eo(s),l=[this.polygon];iD(this.polygon),a&&(l=lm(this.polygon,this.commands)),A.publish("autoFill",""),A.publish("hasModifyPcbItem",this.polygon);let c=new hi;c.addGroup(this.commands),c.checkOutlines(l,new Set),this.commands=new De("select Polygon 2D line -"+this.polygon.type)}return this.commands.length>0&&!i&&(this.commands=new De("select Polygon 2D line -"+this.polygon.type)),oC.ready&&!isNaN(this.selectIndex[0])&&!isNaN(this.selectIndex[1])?(this.editNode(this.selectIndex),this.selectIndex=[NaN,NaN],!0):(this.moveTool.onMouseLeftUp(e),this.controlPointTool.onMouseLeftUp(e),this.polygon.fill(),this.removeShiftMoveHelpLine(),ai.clearSnapFlag(),A.publish("flushSelectingInfo",""),!0)}onMouseUpMove(e){return this.controlPointTool.onMouseUpMove(e),!1}selectPoint(e,r){for(let i of this.controlPointTool.points)for(let n of i)if(n.inTop(e,r)){this.changleMouseStyle("pointer");return}for(let i of this.controlPointTool.mids)for(let n of i)if(n.inTop(e,r)){this.changleMouseStyle("pointer");return}this.polygon.isInProfile(e,r)?this.changeNativeCursor(5):this.changleMouseStyle("default")}interrupt(){var e;return this.controlPointTool.interrupt(),(e=this.commands)==null||e.undo(),this.removeShiftMoveHelpLine(),this.polygon.fill(),this.moveTool.interrupt(),this.changleMouseStyle("default"),A.publish("updateRtree",""),!0}onDoubleClick(e){if(A.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},Q()),this.polygon.type!="Line"){let r=e.sceneX,i=e.sceneY;for(let n=0;n<this.controlPointTool.points.length;n++)for(let s=0;s<this.controlPointTool.points[n].length;s++)if(this.controlPointTool.points[n][s].isSelect(r,i))return this.editNode([n,s]),!0}return!1}deleteNode(){isNaN(this.selectIndex[0])||isNaN(this.selectIndex[1])||Is.getInstance().init([this.polygon],"delete Polygon node check lock",(e,r)=>{let i=r.getCommand();this.polygon.removeFill();let s=this.getChildrens(this.polygon)[this.selectIndex[0]],a=!1;if(this.polygon.type=="Line")if(this.polygon.isClose())if(s.length==3){let c=!1;s.forEach(h=>{h instanceof _t&&(c=!0)}),c||(this.removePolygon(i,this.selectIndex[0]),a=!0)}else s.length==2&&(this.removePolygon(i,this.selectIndex[0]),a=!0);else s.length==1?(this.removePolygon(i,this.selectIndex[0]),a=!0):(this.selectIndex[1]==s.length&&(this.selectIndex[1]=this.selectIndex[1]-1),this.selectIndex[1]==0&&(this.selectIndex[1]=1));else if(s.length==3){let l=!1;s.forEach(c=>{c instanceof _t&&(l=!0)}),l||(this.removePolygon(i,this.selectIndex[0]),a=!0)}else s.length==2&&(this.removePolygon(i,this.selectIndex[0]),a=!0);this.polygon.isEmpty?(A.publish("clearSelect",""),A.publish("delete",this.polygon)):(a||(i.addCommand(Ce.dispatch(this.polygon,"modify")),this.polygon.deletePoint(this.selectIndex)),iD(this.polygon),this.selectIndex=[NaN,NaN],this.polygon.fill(),A.publish("flushSelectingInfo","")),A.publish("updateRtree",""),A.publish("tool","dropdrag"),r.addGroup(i),r.checkOutlines([this.polygon],new Set),r.execute()})}editNode(e){let[r]=e,{shapes:i,last:n,start:s,curr:a,nextshapes:l}=this.controlPointTool.editNode(e);A.publish("redrawPolygon",{shapes:i,last:n,start:s,curr:a,profile:this.polygon,nextshapes:l,index:r}),this.interrupt()}onMouseRightUp(e){if(e.openMenu){let r=dG(this.polygon);for(let i=0,n=this.controlPointTool.points.length;i<n;i++)for(let s=0,a=this.controlPointTool.points[i].length;s<a;s++){let l=this.controlPointTool.points[i][s];if(l.isSelect(e.realSceneX,e.realSceneY))return r==3&&(s==0||s==a-1)||(this.selectIndex=[i,s]),this.rightClickMenuData(e),this.position=l.getPosition(),!0}}return!1}rightClickMenuData(e){let r=this.getIsEndpoint(),i={state:"show",left:e.mouseX,top:e.mouseY,filter:Dhe(!0,r,this.selectIndex[1]).result};$t.getInstance().menuData(i,this)}getIsEndpoint(){if(!isNaN(this.selectIndex[0])&&!isNaN(this.selectIndex[1])&&this.polygon.type=="Line"){let e=this.getChildrens(this.polygon),r=this.polygon.isClose();for(let i=0;i<e.length;i++)if(!r&&(this.selectIndex[1]==0||this.selectIndex[1]==this.controlPointTool.mids[i].length))return!0}return!1}parse(e){switch(e.cmdKey.split(":")[0]){case"INSERT_NODE":{this.controlPointTool.insertNode();break}case"CANCEL":{this.controlPointTool.cancel();break}case"EDIT_NODE":!isNaN(this.selectIndex[0])&&!isNaN(this.selectIndex[1])&&(this.editNode(this.selectIndex),this.selectIndex=[NaN,NaN]);break;case"MOVE_NODE":{let n=this.getChildrens(this.polygon);for(let s of n){let a=s.filter(l=>!l.isSelect(this.position.x,this.position.y));if(a.length>0){this.setAdsorptionDrawingLine(a);break}}A.publish("toggle",{command:"MOVE_NODE",filterItems:[this.polygon],inputInfo:this.position,commands:this.commands});break}case"DELETE_NODE":this.deleteNode();break;case"EDIT_BOUNDARY":A.publish("toggle",{command:"editOutline",item:this.polygon});break}A.publish("updateFrame","")}removePolygon(e,r){if(this.polygon.outMostChildrenIndex()==r){e.addCommand(Ce.dispatch(this.polygon,"delete")),this.polygon.remove();return}e.addCommand(Ce.dispatch(this.polygon,"modify")),this.polygon.getChildrens().splice(r,1)[0].forEach(s=>{s.remove(),A.publish("delete",s)}),this.polygon.setChildrens([])}rotate(e=le.pcbConfig.rotate){if(!this.controlPointTool.controlPointMove){let r=this.polygon.getParent();if(r!=null&&r.getGroupID()!=null)this.commands=new De("select Polygon 2D line -"+this.polygon.type),this.moveTool.rotate(e);else{this.addHistory&&(this.commands=new De("select Polygon 2D line -"+this.polygon.type),this.commands.addCommand(Ce.dispatch(this.polygon,"modify")),this.addHistory=!1);let i=ys([this.polygon]);if(i.valid()){let s=i.build1().center();$n.rotate(s,e,[this.polygon]),this.flushPoint()}}}}removeZeroLenLine(){let[e,r]=this.controlPointTool.mouseLeftSelectIndex;if(isNaN(e)||isNaN(r))return!1;let i,n,s,a;return r&&(i=this.controlPointTool.points[e][r-1]),r+1<=this.controlPointTool.points[e].length-1&&(n=this.controlPointTool.points[e][r+1]),i&&(s=this.controlPointTool.points[e][r].getDistance(i.x,i.y)),n&&(a=this.controlPointTool.points[e][r].getDistance(n.x,n.y)),a===0&&this.polygon.removeChild([e,r]),s===0&&this.polygon.removeChild([e,r-1]),!0}setAdsorptionDrawingLine(e){let r=new Array;for(let i of e){let n=i.width;if(i instanceof mt){let s=new M(i.start,i.end);r.push({primitive:s,width:n})}else{let[s,a,l,c,h]=[i.center,i.startAngle/Math.PI*180,i.endAngle/Math.PI*180,i.radius,i.sweep],u=q.build2(s,a,l,c,c,h);r.push({primitive:u,width:n})}}ai.drawingLines=r}getChildrens(e){return this.showAllPoints?e.getChildrens():e.filterOutMostChildren().slice(0,1)}isControlPoint(){return this.controlPointTool.points.some(e=>e.some(r=>r.status()))}};var o5=class extends Cs{constructor(e){super();this.addHistory=!0;this.controlPointMove=!1;this.position=null;this.arc=e,this.command=new De("select 2dLine - arc");let r=this.arc.layerId;this.start=new Ui(r,this.arc.start),this.mid=new Ui(r,this.arc.midPoint,!0),this.end=new Ui(r,this.arc.end),this.center=new Ui(r,this.arc.center),this.moveTool=new Qc([this.arc])}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;return this.controlPointMove=!1,this.start.isSelect(r,i)&&(this.controlPointMove=!0),this.mid.isSelect(r,i)&&(this.controlPointMove=!0),this.end.isSelect(r,i)&&(this.controlPointMove=!0),this.center.isSelect(r,i)&&(this.controlPointMove=!0),this.mouseLeftDown=!0,this.addHistory=!0,this.controlPointMove}onMouseMove(e){if(this.arc.getParent().locked)return!1;let r=this.shiftControl(e),i=this.lastPosition;if(this.addHistory&&(this.command.addCommand(Ce.dispatch(this.arc.getParent(),"modify")),this.addHistory=!1),this.start.status()){if(this.changleMouseStyle("pointer"),this.arc.arcType==1)this.start.setPosition(i),this.arc.start=i,this.mid.setPosition(this.arc.midPoint),this.center.setPosition(this.arc.center);else{let a=i.angle(this.arc.center);this.arc.startAngle=a,this.start.setPosition(this.arc.start),this.mid.setPosition(this.arc.midPoint)}return!0}if(this.mid.status()){if(this.changleMouseStyle("pointer"),Math.abs(this.arc.start.sub(i).cross(this.arc.end.sub(i)))>1e-8){let a=new Yn,{center:l,radius:c,startAngle:h,endAngle:u,sweep:d}=a.point2Angle(this.arc.start,this.arc.end,i);this.arc.center=l,this.arc.radius=c,this.arc.startAngle=h,this.arc.endAngle=u,this.arc.sweep=d,this.mid.setPosition(this.arc.midPoint),this.center.setPosition(this.arc.center)}return!0}if(this.end.status()){if(this.changleMouseStyle("pointer"),this.arc.arcType==1)this.end.setPosition(i),this.arc.end=i,this.mid.setPosition(this.arc.midPoint),this.center.setPosition(this.arc.center);else{let a=i.angle(this.arc.center);this.arc.endAngle=a,this.end.setPosition(this.arc.end),this.mid.setPosition(this.arc.midPoint)}return!0}if(this.center.status())return this.changleMouseStyle("pointer"),this.arc.center=i,this.center.setPosition(i),this.start.setPosition(this.arc.start),this.mid.setPosition(this.arc.midPoint),this.end.setPosition(this.arc.end),!0;let n=Ae.translate(r.x,r.y,0),s=this.arc.getParent();return s!=null&&s.getGroupID()!=null?(this.command=new De("select 2dLine - arc"),this.moveTool.onMouseMove(e)):this.arc.transform(n),this.flushPoint(),!0}flushPoint(){this.start.setPosition(this.arc.start),this.mid.setPosition(this.arc.midPoint),this.end.setPosition(this.arc.end),this.center.setPosition(this.arc.center)}onMouseLeftUp(e){if(this.command.length>0){let r=this.arc.getParent(),i=new hi;i.addGroup(this.command),i.checkOutlines([r],new Set),this.command=new De("select 2dLine - arc"),A.publish("hasModifyPcbItem",this.arc)}return this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),A.publish("flushService",""),A.publish("flushSelectingInfo",""),!0}interrupt(){return this.command.undo(),this.start.remove(),this.mid.remove(),this.end.remove(),this.center.remove(),this.moveTool.interrupt(),this.changleMouseStyle("default"),this.removeShiftMoveHelpLine(),!0}onMouseUpMove(e){let r=e.sceneX,i=e.sceneY;return this.selectPoint(r,i),!1}onMouseRightUp(e){return e.openMenu&&(this.start.isSelect(e.sceneX,e.sceneY)||this.end.isSelect(e.sceneX,e.sceneY))?(this.position=e,this.rightClickMenuData(e),!0):!1}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:Dhe(!0,!0).result};$t.getInstance().menuData(r,this)}parse(e){switch(e.cmdKey.split(":")[0]){case"INSERT_NODE":{A.publish("toggle",{command:"insertNode"});break}case"MOVE_NODE":A.publish("toggle",{command:"MOVE_NODE",filterItems:[this.arc],inputInfo:this.position,commands:this.command});break}}selectPoint(e,r){let i=!1;if(this.start.inTop(e,r)&&(i=!0),this.mid.inTop(e,r)&&(i=!0),this.end.inTop(e,r)&&(i=!0),this.center.inTop(e,r)){this.changeNativeCursor(5);return}i?this.changleMouseStyle("pointer"):this.arc.isSelect(e,r)?this.changeNativeCursor(5):this.changleMouseStyle("default")}rotate(e=le.pcbConfig.rotate){if(!this.controlPointMove){let r=this.arc.getParent();if(r!=null&&r.getGroupID()!=null)this.command=new De("select 2dLine - arc"),this.moveTool.rotate(e);else{this.addHistory&&(this.command=new De("select 2dLine - arc"),this.command.addCommand(Ce.dispatch(this.arc,"modify")),this.addHistory=!1);let i=ys([this.arc]);if(i.valid()){let s=i.build1().center();$n.rotate(s,e,[this.arc]),this.flushPoint()}}}}};var oC=class o extends ni{constructor(e){super();this.leftDown=!1;if(this.option="OPTIONLEFTUP",e.click(),e instanceof Pr)this.control=new ID(e),this.profile=e;else if(e instanceof rr)this.control=new s_(e),this.profile=e;else if(e instanceof mt){let r=e.getParent();this.profile=r,this.control=new V2(r)}else if(e instanceof _t){let r=e.getParent();this.profile=r,r instanceof lt&&(r.onlyOneChilds()!=null?this.control=new o5(e):this.control=new V2(r))}else e instanceof lt&&(this.control=new V2(e),this.profile=e);this.profile.removeFill(),this.drawing=!0,this.msg="Please select a point",o.ready=!0,this.start()}static status(){return this.ready}static exit(){o.ready=!1}onKeyDown(e){if(!this.control.onKeyDown(e)){switch(tr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);return}A.publish("updateFrame","")}}onMouseLeftDown(e){this.control.onMouseLeftDown(e)&&(this.leftDown=!0)}onMouseMove(e){this.drawing&&Ut.update(e,this.msg),this.leftDown&&this.drawing&&this.control.onMouseMove(e)}onMouseLeftUp(e){this.control.onMouseLeftUp(e),this.leftDown=!1,this.profile.removeFill()}interrupt(){this.control.interrupt(),this.profile.fill(),Ut.cancel(),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}onMouseRightDown(e){this.control.onMouseRightDown(e)}onMouseRightUp(e){!this.control.onMouseRightUp(e)&&e.openMenu&&super.onMouseRightUp(e)}onDoubleClick(e){this.control.onDoubleClick(e)}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this)}parse(e){switch(e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}};var pG=class extends Hm{constructor(e){super(e.type);this.nextShape=new Array;this.profile=e}getResult(e){let r=new Array;if(e.shape.forEach(i=>{let n=this.getModel(e,i);n!=null&&r.push(n),i.remove()}),r=A1(r),this.validChilds(this.profile.type,r)){let i=this.profile;this.profile=pt.addPolygon(this.profile.type,this.profile.layerId,[r],this.profile.strokeWidth,this.profile.net,!1),this.profile.strokeWidth=e._width;let n=new sE(i);n.extendOldItem(this.profile),e.commands.addCommand(Ce.dispatch(i,"delete")),n.extendOldCopperOrder(this.profile),A.publish("delete",i),i.remove(),e.commands.addCommand(Ce.dispatch(this.profile,"add"))}else{for(let i of r)i.remove();e.commands.addCommand(Ce.dispatch(this.profile,"delete")),this.profile.remove(),A.publish("delete",this.profile),this.profile=null}e.shape.length=0,A.publish("hasModifyPcbItem",this.profile)}getPrimitive(e){if(e instanceof Vi||e instanceof es)return e.primitive;if(e instanceof cr)return new M(e.start,e.end);if(e instanceof gs)return q.build2(e.center,e.startAngle,e.endAngle,e.radius,e.radius,e.sweep)}getModel(e,r){let i=this.profile.layerId,n=new Po;return r.length>0?n.clone4Shape(this.getPrimitive(r),i,e._width):null}confirmWindow(e,r){this.modify(e,r,!0)}modify(e,r,i){let n=new hi;n.addGroup(e.commands);let s=this.profile?[this.profile]:[];this.profile instanceof lt&&Eo(this.profile.getMathGraphics())&&(s=lm(this.profile,e.commands)),s.length&&(Uu.realtimeCheckItems(s),n.checkOutlines(s),s.forEach(a=>{a.fill()})),this.profile=null,r.drawing=!1,A.publish("updateRtree",""),A.publish("tool","dropdrag"),A.publish("flushService","")}};var fG=class extends Hm{constructor(e){super(e.type);this.nextShape=new Array;this.profile=e}getResult(e){let r=new Array;if(e.shape.forEach(i=>{let n=this.getModel(e,i);n!=null&&r.push(n),i.remove()}),r=A1(r),this.validChilds(this.profile.type,r)){let i=this.profile;this.profile=pt.addPolygon(this.profile.type,this.profile.layerId,[r],this.profile.strokeWidth,this.profile.net,!1);let n=new sE(i);n.extendOldItem(this.profile),e.commands.addCommand(Ce.dispatch(i,"delete")),n.extendOldCopperOrder(this.profile),A.publish("delete",i),i.remove(),e.commands.addCommand(Ce.dispatch(this.profile,"add"))}else{for(let i of r)i.remove();e.commands.addCommand(Ce.dispatch(this.profile,"delete")),this.profile.remove(),A.publish("delete",this.profile),this.profile=null}e.shape.length=0,A.publish("hasModifyPcbItem",this.profile)}getModel(e,r){let i=this.profile.layerId,n=new Po;return r.length>0?n.clone4Shape(this.getPrimitive(r),i,e._width):null}confirmWindow(e,r){this.modify(e,r,!0)}modify(e,r,i){let n=new hi;n.addGroup(e.commands);let s=this.profile?[this.profile]:[];this.profile instanceof lt&&Eo(this.profile.getMathGraphics())&&(s=lm(this.profile,e.commands)),s.length&&(Uu.realtimeCheckItems(s),n.checkOutlines(s),s.forEach(a=>{a.fill()})),this.profile=null,r.drawing=!1,A.publish("updateRtree",""),A.publish("tool","dropdrag"),A.publish("flushService","")}};function gje(o,t){if(o.x===0&&o.y===0||t.x===0&&t.y===0)throw new Error("\u96F6\u5411\u91CF\u4E0D\u80FD\u8BA1\u7B97\u5939\u89D2");let e=(o.x*t.x+o.y*t.y)/(o.length()*t.length());return e>1?e=1:e<-1&&(e=-1),Math.acos(e)}function mje(o,t){let e;if(o.x===t.x)e=Go;else{let r=new S(t.x-o.x,t.y-o.y),i=new S(Math.abs(o.x-t.x),0);e=gje(r,i)}return t.y<o.y&&(e=kr-e),e}function Aq(o,t,e,r){if(o.equals(t)||t.equals(e))return{canAddFillet:!1};let i=1,n=!0,s=o.sub(t),a=e.sub(t),l=gje(s,a)/2;if(Math.abs(l-Go)<.001)return{canAddFillet:!1};let c=r/Math.sin(l>Go?Math.PI-l:l),h=r/Math.tan(l>Go?Math.PI-l:l),u=h/s.length();if(ne.greater(u,i))return{canAddFillet:!1};let d=new S(s.x*u,s.y*u),p=new S(d.x+t.x,d.y+t.y);if(u=h/a.length(),ne.greater(u,i))return{canAddFillet:!1};let m=new S(a.x*u,a.y*u),g=new S(m.x+t.x,m.y+t.y);u=s.length()/a.length(),a=new S(a.x*u,a.y*u);let y=new S(a.x+t.x,a.y+t.y),b=(o.x+y.x)/2,P=(o.y+y.y)/2,T=new S(b-t.x,P-t.y);if(T.length()===0)throw new Error("v3\u662F\u96F6\u5411\u91CF");u=c/T.length();let I=new S(T.x*u,T.y*u),C=I.x+t.x,E=I.y+t.y,O=new S(C,E),_=mje(O,p),x=mje(O,g),v;return _>x&&_-x<Math.PI||_<x&&x-_>Math.PI?v=ae.CW:v=ae.CCW,{radius:r,circleCenter:O,tangencyPoint1:p,tangencyPoint2:g,startAngle:_,endAngle:x,sweep:v,canAddFillet:n}}var hE=class extends Oo{constructor(e,r,i,n){super();this._abortLast=!0;this.isDrawingInflection=!1;this.dialogHandler=null;this.event=e,this.param=r,this.resultEvent=i,this.drawing=!0,this.lineType=n}get abortLast(){return this._abortLast}set abortLast(e){this._abortLast=e}get shape(){return this.event.shape}setDialogHandler(e){this.dialogHandler=e}onKeyDown(e){switch(tr.getAction(4,e)){case"Finish":this._abortLast=!1,this.completed(!1);break;case"Cancel":this.event.shape&&this.event.shape.length?(this.abortLast=!0,this.completed(!1)):this.cancel();break;case"Backspace":this.backspace();break;case"Filp Path While Drawing":this.flipPath();break}A.publish("updateFrame","")}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY);if(this.event.curr=r,this.event.drawMode==0){if(this.event.start==null){if(!Mt.checkIsCanEditByPoint(new S(e.sceneX,e.sceneY)))return;this.event.start=r}else if(this.event.last!=null&&this.event.last.distance1(r)>1e-8){if(!Mt.checkIsCanEditByPoint(new S(e.sceneX,e.sceneY))){let i="Cannot be added beyond drawing range";Mt.showMassageTip(i,i);return}if(this.isDrawingInflection=!0,e.ctrlKey){this._abortLast=!1,this.completed(!1);return}this.asMouseLeftUp(r)}}else this.netSelect(e)}asMouseLeftUp(e){this.draw(this.event.last,e,Zt.getInstance().type),this.asClose(e),this.isSelectStart(e)?(this.abortLast=!1,this.completed(!0)):(this.drawLineCoincideAutoDeal(),this.addShape(e))}onMouseMove(e,r=!1){if(this.event.drawMode==0){let i=Zt.getInstance().type,n=new S(e.sceneX,e.sceneY);if(this.event.curr=n,this.isDrawingInflection){let s=this.event.shape[this.event.shape.length-1];s&&s.end.distance1(n)>this.event._width&&(this.isDrawingInflection=!1)}this.event.start!=null&&this.drawing&&(this.event.last==null&&(this.event.last=this.event.start),!this.isDrawingInflection&&this.event.setAdsorptionDrawingLine(),this.draw(this.event.last,n,i),this.asClose(n)),ai.snapToSnapFlag(e,void 0,r)}this.event.drawMode==1?Ut.update(e,"Please select a network"):Ut.cancel()}clearEvent(){let e=this.event.shape;this.event.closeLine!=null&&!e.includes(this.event.closeLine)&&(this.event.closeLine.remove(),this.event.closeLine instanceof Vi&&A.publish("delete",this.event.closeLine)),this.event.closeLine=null,this.event.start=null,this.event.last=null,this.event.curr=null,this.event.lastDirect=new S(1,0),this.event.completing=!1,this.event.clearAdsorptionDrawingLine(),this.event.clearDrawHistory()}interrupt(){this.dialogHandler!=null&&this.dialogHandler.closeOpenDialog(),this.clear(),this.clearEvent(),this.event.shape.forEach(e=>{e.remove()}),this.event.shape.length=0,oC.exit()}cancel(){this.event.drawMode==0?(this.interrupt(),A.publish("tool","dropdrag")):(this.event.drawMode=0,this.confirmResult())}flipPath(){}isSelectStart(e){return this.event.shape.length>0&&this.confirmStart().distance1(e)<=this.event._width/2}getPt(e){if(e instanceof Vi||e instanceof es)return e.primitive;if(e instanceof cr)return new M(e.start,e.end);if(e instanceof gs)return q.build4(e.start,e.end,e.center,e.radius,e.radius,e.sweep)}getLayer(){if(this.lineType==="Partition")return 1004;if(this.resultEvent instanceof Hm)return xm(this.resultEvent.type,Pe.getActiveLayerID(),2);if(this.resultEvent instanceof jS){let e=Pe.getActiveLayerID();return e!=1&&e!=2&&e!=12&&(e=1),e}else return this.resultEvent instanceof PD||this.resultEvent instanceof TD?1002:Pe.getActiveLayerID()}getLayerId(){if(this.resultEvent instanceof Hm)return xm(this.resultEvent.type,Pe.getActiveLayerID(),2);if(this.resultEvent instanceof jS){let e=Pe.getActiveLayerID();return e!=1&&e!=2&&e!=12&&(e=1),e}else return this.resultEvent instanceof PD||this.resultEvent instanceof TD?1002:Pe.getActiveLayerID()}getColor(){var e;return this.resultEvent&&this.resultEvent.type==="Partition"?Ns.getInstance().getRegionLineStyle2("Partition").lineColor:this.event.drawScene=="Segment"?this.event.isEditOutLine?ee.of3("#00FFFF"):Ns.getInstance().getRegionLineStyle2(this.resultEvent.type,((e=this.event.shape[0])==null?void 0:e.color)||ee.BLACK).lineColor:this.resultEvent instanceof pG||this.resultEvent instanceof F2||this.resultEvent instanceof fG?this.resultEvent.profile.color:this.resultEvent instanceof PD||this.resultEvent instanceof TD?ee.WHITE:ee.BLACK}confirmResult(){this.resultEvent.getResult(this.event),this.resultEvent.confirmWindow(this.event,this)}modify(e){this.resultEvent.modify(this.event,this,e)}toggleMode(e,r){this.event.drawMode=e;let{pcbBridgingCopperIndex:i}=r;i&&(this.event.pcbBridgingCopperIndex=i)}netSelect(e){let r=e.sceneX,i=e.sceneY;if(this.resultEvent instanceof Hm){if(this.resultEvent.profile!=null&&this.event.drawMode==1){let n=Vr.selectNet(r,i);if(n!==null){this.nextTool;let s=this.getNearNetPcbItems(n,r,i);this.handleNets(e,s)}}}else if(this.resultEvent instanceof jS&&this.resultEvent.pad!=null&&this.event.drawMode==1){let n=Vr.selectNet(r,i);if(n!==null){let s=this.getNearNetPcbItems(n,r,i);this.handleNets(e,s)}for(let s of n)if(s.isSelect(r,i)&&s.net!=null){this.resultEvent.pad.net=s.net,this.event.drawMode=0,this.resultEvent.confirmWindow(this.event,this);break}}}handleChangePolygonNet(e){this.resultEvent instanceof Hm?(this.resultEvent.profile.net=e,wR(this.resultEvent.profile,e,this.event.pcbBridgingCopperIndex)):this.resultEvent instanceof jS&&(this.resultEvent.pad.net=e),this.event.drawMode=0,this.resultEvent.confirmWindow(this.event,this)}getNearNetPcbItems(e,r,i){let n=new Set,s=new Set,a=new Set;return e.forEach(l=>{if(l instanceof He&&l.type=="Fill Region"){let h=l.getComponent();if(h instanceof Zi&&h.isBridgingCopper)return}let c=l.net;if(l instanceof He&&l.type=="Copper Region"){let h=!1;if(l.iteratorCopper(u=>{h||u.inCopper(r,i)&&u.isVisible&&(h=!0)}),!h)return}c&&(a.add(l),s.add(c))}),n.add({group:a,nets:s}),n}handleNets(e,r){let i=new Set;r.forEach(n=>{i=n.nets}),i.size&&(i.size===1?i.forEach(n=>{this.handleChangePolygonNet(n)}):(Ut.cancel(),this.showNetsMenu(e,i)))}showNetsMenu(e,r){let i={};i.state="show",i.left=e.mouseX,i.top=e.mouseY,i.filter=this.getNetsMenuData(r).result,$t.getInstance().menuData(i,this),this.drawing=!1}getNetsMenuData(e){let r=new qt,i="INHERIT_NET:";return e.forEach(n=>{if(n){let s={name:n,cmd:`${i+n}`,tips:"",option:{disabledI18n:!0}};r.addObj(s,!1,!1)}}),r}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"INHERIT_NET":this.handleChangePolygonNet(i[1]);break}A.publish("updateFrame","")}toggleLayer(e){if(e==null)return;let r=this.getLayer();this.event.shape.forEach(i=>{i.layerId=r}),this.toggleCurrentShape(r)}confirmStart(){return this.resultEvent instanceof F2&&this.resultEvent.nextShape.length>0?this.resultEvent.nextShape[0].start:this.event.shape.length?this.event.shape[0].start:null}canFillet(){return this.event.drawScene==="Split Line"?!1:le.pcbConfig.autoChamfer2DLine!="off"&&["Line","Copper Region","Fill Region","Slot Region","Prohibited Region","Constraint Region","Board Outline"].includes(this.lineType)}getArcKeyPoint2(e,r,i,n){return this.canFillet()?Aq(e,r,i,n):{canAddFillet:!1}}};var eh=class extends hE{constructor(){super(...arguments);this.tool=new Xn;this.lineArcs=new Array;this.autoAddedLines=new Array}flipPath(){if(this.event.drawMode==0){let e=Zt.getInstance().type;if(this.lineArcs.length){let r=this.lineArcs[0].start,i=this.lineArcs.at(-1).end,n;switch(e){case"WIRING_CORNER_LINE45":{n=this.tool.degree45(this.event.lastDirect,r,i);break}case"WIRING_CORNER_LINE90":{n=this.tool.degree90(this.event.lastDirect,r,i);break}}let s=n[2].sub(n[1]).normalize();(s.x!=0||s.y!=0)&&(this.event.lastDirect=s),this.draw(r,i,e)}}}check(e=!1){let{shape:r,needClose:i,closeLine:n}=this.event,s=[...r,...this.lineArcs].filter(a=>a.getViewState()!="Not Shown").map(a=>this.getPt(a));if(this.resultEvent instanceof F2){let a=this.resultEvent.nextShape,l=[];if(a.forEach(c=>l.push(this.getPt(c))),e&&i&&n){let c=this.getPt(n);return s.push(c,...l),!s.length||!Eo(ge.build2(s))}else return!ax([s,l])}else return e&&i&&n&&s.push(this.getPt(n)),!s.length||!Eo(ge.build2(s))}drawLineCoincideAutoDeal(e=!1){if(this.lineArcs=this.lineArcs.filter(c=>c.getViewState()!="Not Shown"),!this.lineArcs.length)return!0;let r=this.event.shape,i=r.map(c=>this.getPt(c)),n=this.lineArcs.map(c=>this.getPt(c)),{coincideLines:s,coincidePoint:a,drawCoincideLines:l}=$k(i,n);if(s.length){let c=s.pop(),h=r[c],u=new Set(s);c==0?this.lineArcs[0].start.equals(h.end)?h.end=a:(h.start=a,this.event.start=a,this.event.closeLine!=null&&(this.event.closeLine.end=a)):h.end=a;for(let g=0;g<l.length;g++)g==l.length-1?this.lineArcs[g].start=a:this.lineArcs[g].start=this.lineArcs[g].end;let d=this.getLayerId(),p=this.event.drawScene;!vu.canCut()||!(d==3||d!==4)||p!=="Line"?r.push(...this.lineArcs):r.push(...this.autoTrimSilkscreen()),this.event.shape=r.filter((g,y)=>g instanceof Vi&&(u.has(y)||g.length<1e-8)?(g.remove(),!1):!0),vu.canCut()&&(d==3||d==4)&&this.event.rebuildCutSilkLines(),this.event.drawHistoryRecord(),this.lineArcs.length=0,this.autoAddedLines.length=0;let m=this.event.shape.length;this.event.last=m?this.event.shape[m-1].end:this.event.curr}}autoTrimSilkscreen(){let e=this.getLayer(),r=this.getLayerId(),i=this.getColor();return vu.cut(e,r,i,this)}addShape(e,r){let i=r||this.getColor(),n=this.canFillet();if(n&&(this.lineArcs=this.lineArcs.filter(s=>s.getViewState()=="Not Shown"?(s.remove(),!1):!0)),this.lineArcs.length){n&&(this.event.shape=this.event.shape.filter(c=>c.getViewState()!="Not Shown"));let s=[],a=this.getLayerId(),l=this.event.drawScene;if(vu.canCut()&&(a==3||a==4)&&l==="Line"){let c=this.getLayer();s=vu.cut(c,a,i,this),s.length>0&&(this.event.shape.push(...s),this.event.drawHistoryRecord())}else for(let c=0;c<this.lineArcs.length;c++){let h=this.lineArcs[c],u=this.lineArcs[c+1];if(h.length>1e-8){if(this.event.shape.push(h),this.event.isEditOutLine&&(h instanceof cr||h instanceof gs)&&(h.isSolid=!0),h.color=i,this.autoAddedLines.includes(h)&&(u instanceof Vi||u instanceof cr))continue;this.event.drawHistoryRecord()}else h.remove()}this.lineArcs.length=0,this.autoAddedLines.length=0,this.event.last=null,this.event.start=e,this.event.shape.forEach(c=>{c.color=i})}}draw(e,r,i,n=!1){if(!(e==null||r==null))switch(i){case"WIRING_CORNER_LINE45":{let s=this.tool.degree45(this.event.lastDirect,e,r);this.modifyLine(s,n);break}case"WIRING_CORNER_LINE90":{let s=this.tool.degree90(this.event.lastDirect,e,r);this.modifyLine(s,n);break}}}asClose(e){var r,i;if(this.event.needClose){let n=this.isSegmentLine(),{lineColor:s,lineSolid:a}=Ns.getInstance().getRegionLineStyle2(this.resultEvent.type,((r=this.event.shape[0])==null?void 0:r.color)||ee.BLACK);if(this.event.closeLine==null){let l=this.getLayer();this.event.closeLine=this.createSceneLine(l,e,this.event.start,s,a)}else this.event.closeLine.start=e;this.event.closeLine&&(this.event.closeLine.color=Ns.getInstance().getRegionLineStyle2(this.resultEvent.type,((i=this.event.shape[0])==null?void 0:i.color)||ee.BLACK).lineColor)}}clear(){let e=this.event.shape;this.lineArcs.forEach(r=>{e.includes(r)||r.remove()}),this.lineArcs.length=0,this.autoAddedLines.length=0}completed(e,r){let i=this.getColor();if(this.event.drawMode==0){if(!this.abortLast&&(this.drawLineCoincideAutoDeal(),this.lineArcs.length)){this.event.shape.push(...this.lineArcs);let n=this.getLayer(),s=this.event.drawScene;vu.canCut()&&(n==3||n==4)&&s==="Line"&&(this.autoTrimSilkscreen(),this.event.shape=this.event.shape.filter(a=>!a.isEmpty),this.event.shape.push(...this.lineArcs))}if(this.event.needClose||e){let n=this.event.shape,s=n.length,a=s?n[s-1].end:this.event.last;if(e&&(this.event.start=this.confirmStart()||a,this.asClose(a)),this.event.needClose&&this.event.closeLine){if(this.abortLast){let l=this.event.closeLine.end;this.draw(a,l,Zt.getInstance().type,!0),this.check()||this.flipPath(),this.addShape(l,r)}else if(n.length>0){let l=n[0].color;this.event.closeLine.color=l,this.event.shape.push(this.event.closeLine)}}}this.confirmResult(),this.clear(),this.clearEvent(),this.drawCompleteModify(),this.event.shape.forEach(n=>{n.color=i})}}backspace(){this.event.drawMode==0&&(this.event.historyBack(this.getLayer()),this.draw(this.event.last,this.event.curr,Zt.getInstance().type))}drawCompleteModify(){pt.getAllItem().forEach(e=>{e.type==="Partition"&&(e.color=Ns.getInstance().getRegionLineStyle2("Partition").lineColor)})}isSegmentLine(){return this.event.drawScene==="Segment"}createLineAndPush(e,r,i,n,s=!1,a=this.event._width,l=2,c=3){if(r.equals(i))return;let h=this.createSceneLine(e,r,i,n,s,a,l,c);this.lineArcs.push(h)}createSceneLine(e,r,i,n,s=!1,a=this.event._width,l=2,c=3){let h=this.isSegmentLine(),u;return h?u=new cr(e,r,i,s,n,l,c):u=Vi.build(e,r,i,a,n),u}createSceneArc(e,r,i,n,s,a,l,c=this.event._width){let h=this.isSegmentLine(),u;return h?u=gs.build(e,r,i,n,s,a,l):u=es.build(e,r,i,c,n,s,a),u}modifyLine(e,r){var u;let i=this.event.shape.at(-1);this.lineArcs.forEach(d=>d.remove()),this.lineArcs.length=0,this.autoAddedLines.length=0;let n=this.getLayer(),{lineColor:s,lineSolid:a}=Ns.getInstance().getRegionLineStyle2(this.resultEvent.type,((u=this.event.shape[0])==null?void 0:u.color)||ee.BLACK),l,c;if(this.event.isEditOutLine&&(n=1002,s=ee.of3("#F0F0F0"),a=!1,l=13,c=28),!this.canFillet()||!(i&&(i instanceof Vi||i instanceof cr))){let d=this.createSceneLine(n,e[0],e[1],s,a,this.event._width,l,c);d.color=s,this.lineArcs.push(d);let p=this.lineArcs.at(-1),{radius:m,circleCenter:g,tangencyPoint1:y,tangencyPoint2:b,startAngle:P,endAngle:T,sweep:I,canAddFillet:C}=this.getArcKeyPoint2(e[0],e[1],r?this.event.closeLine.end:e[2],le.pcbConfig.filletRadius2DLine);if(C){if(p.hidden(),this.createLineAndPush(n,p.start,y,s,a,this.event._width,l,c),le.pcbConfig.autoChamfer2DLine=="fillet"){let E=this.createSceneArc(n,g,m,P,T,I,s);this.lineArcs.push(E),this.autoAddedLines.push(E)}else{let E=this.createSceneLine(n,y,b,s,a,this.event._width,l,c);this.lineArcs.push(E),this.autoAddedLines.push(E)}this.createLineAndPush(n,b,e[2],s,a,this.event._width,l,c)}else p.visible(),this.createLineAndPush(n,e[1],e[2],s,a,this.event._width,l,c)}else{let{radius:d,circleCenter:p,tangencyPoint1:m,tangencyPoint2:g,startAngle:y,endAngle:b,sweep:P,canAddFillet:T}=this.getArcKeyPoint2(i.start,i.end,e[1],le.pcbConfig.filletRadius2DLine);if(T){if(i.hidden(),this.createLineAndPush(n,i.start,m,s,a,this.event._width,l,c),le.pcbConfig.autoChamfer2DLine=="fillet"){let F=this.createSceneArc(n,p,d,y,b,P,s);this.lineArcs.push(F),this.autoAddedLines.push(F)}else{let F=this.createSceneLine(n,m,g,s,a,this.event._width,l,c);this.lineArcs.push(F),this.autoAddedLines.push(F)}this.createLineAndPush(n,g,e[1],s,a,this.event._width,l,c)}else i.visible(),this.createLineAndPush(n,e[0],e[1],s,a,this.event._width,l,c);let I=this.lineArcs.at(-1),{radius:C,circleCenter:E,tangencyPoint1:O,tangencyPoint2:_,startAngle:x,endAngle:v,sweep:D,canAddFillet:w}=this.getArcKeyPoint2(I.start,I.end,e[2],le.pcbConfig.filletRadius2DLine);if(w){if(I.hidden(),this.createLineAndPush(n,I.start,O,s,a,this.event._width,l,c),le.pcbConfig.autoChamfer2DLine=="fillet"){let F=this.createSceneArc(n,E,C,x,v,D,s);this.lineArcs.push(F),this.autoAddedLines.push(F)}else{let F=this.createSceneLine(n,O,_,s,a,this.event._width,l,c);this.lineArcs.push(F),this.autoAddedLines.push(F)}this.createLineAndPush(n,_,e[2],s,a,this.event._width,l,c)}else I.visible(),this.createLineAndPush(n,e[1],e[2],s,a,this.event._width,l,c);if(r){let F=this.event.shape[0],H=this.lineArcs.at(-1);if((H instanceof Vi||H instanceof cr)&&(F instanceof Vi||F instanceof cr)){let{radius:z,circleCenter:V,tangencyPoint1:W,tangencyPoint2:L,startAngle:k,endAngle:N,sweep:U,canAddFillet:B}=this.getArcKeyPoint2(H.start,F.start,F.end,le.pcbConfig.filletRadius2DLine);if(B){if(H.end=W,le.pcbConfig.autoChamfer2DLine=="fillet"){let G=this.createSceneArc(n,V,z,k,N,U,s);this.lineArcs.push(G),this.autoAddedLines.push(G)}else{let G=this.createSceneLine(n,W,L,s,a,this.event._width,l,c);this.lineArcs.push(G),this.autoAddedLines.push(G)}F.start=L}else F.start=H.end}}}let h=this.lineArcs[0].end.sub(this.lineArcs[0].start).normalize();(h.x!=0||h.y!=0)&&(this.event.lastDirect=h)}wireWidth(e){this.lineArcs.length&&this.lineArcs.forEach(r=>r.width=e),this.event.closeLine!=null&&(this.event.closeLine.width=e),this.event.shape.forEach(r=>{r.width=e}),this.event._width=e,ut.defaultOutlineWidth=e}toggleCurrentShape(e){this.lineArcs.length&&this.lineArcs.forEach(r=>r.layerId=e),this.event.closeLine&&(this.event.closeLine.layerId=e)}getLine(){return this.lineArcs[0]}updateAssisLineColor(e){e&&this.lineArcs.length&&this.lineArcs.forEach(r=>r.color=e)}getPreviewOutline(){return[...this.lineArcs]}};var ja=class extends hE{constructor(){super(...arguments);this.adjustAngle=!1;this.arc=null;this.helpLine=null}getArc(){return this.arc}check(e=!1){let{shape:r,needClose:i,closeLine:n}=this.event,s=r.map(a=>this.getPt(a));if(this.arc&&s.push(this.getPt(this.arc)),this.resultEvent instanceof F2){let a=this.resultEvent.nextShape,l=[];if(a.forEach(c=>l.push(this.getPt(c))),e&&i&&n){let c=this.getPt(n);return s.push(c,...l),!s.length||!Eo(ge.build2(s))}else return!ax([s,l])}else return e&&i&&n&&s.push(this.getPt(n)),!s.length||!Eo(ge.build2(s))}drawLineCoincideAutoDeal(e=!1){return!1}addShape(e){var n;let{lineColor:r,lineSolid:i}=Ns.getInstance().getRegionLineStyle2(this.resultEvent.type,((n=this.event.shape[0])==null?void 0:n.color)||ee.BLACK);if(this.event.isEditOutLine&&(r=ee.of3("#00FFFF")),!this.adjustAngle)this.helpLine!=null&&(this.helpLine.end=e,this.helpLine.color=r,this.adjustAngle=!0);else{let s=this.getLayerId(),a=this.arc;a||(a=this.createSceneLine(s,this.helpLine.start,this.helpLine.end,r,i),this.helpLine.remove(),this.helpLine=null),this.event.shape.push(a),this.event.drawHistoryRecord(),vu.canCut()&&(s==3||s==4)&&(this.event.cutSilkLines.length==0?this.event.cutSilkLines.push([a]):this.event.cutSilkLines[this.event.cutSilkLines.length-1].push(a)),a.color=r,this.event.last=null,this.event.start=a.end,this.arc=null,this.adjustAngle=!1,this.event.completing&&this.completed(!1)}this.event.shape.forEach(s=>{s.color=r})}draw(e,r,i){var a;if(e==null||r==null)return;let{lineColor:n,lineSolid:s}=Ns.getInstance().getRegionLineStyle2(this.resultEvent.type,((a=this.event.shape[0])==null?void 0:a.color)||ee.BLACK);if(this.event.isEditOutLine&&(n=ee.of3("#F0F0F0"),s=!1),this.adjustAngle){let l=new Yn;if(this.helpLine!=null){if(Math.abs(this.helpLine.start.sub(r).cross(this.helpLine.end.sub(r)))>1e-8){let{center:c,radius:h,startAngle:u,endAngle:d,sweep:p}=l.point2Angle(this.helpLine.start,this.helpLine.end,r);if(this.arc==null){let m=this.getLayer();this.event.isEditOutLine&&(m=1002),this.arc=this.createSceneArc(m,c,h,u,d,p,n,s)}this.helpLine.remove(),this.helpLine=null}}else if(this.arc!=null&&Math.abs(this.arc.start.sub(r).cross(this.arc.end.sub(r)))>1e-8){let{center:c,radius:h,startAngle:u,endAngle:d,sweep:p}=l.point2Angle(this.arc.start,this.arc.end,r);this.arc.center=c,this.arc.radius=h,this.arc.startAngle=u,this.arc.endAngle=d,this.arc.sweep=p}}else if(this.helpLine==null){let l=this.getLayer();this.event.isEditOutLine&&(l=1002),this.helpLine=this.createSceneLine(l,e,r,n,s)}else this.helpLine.end=r}isSelectStart(e){return this.adjustAngle?!1:super.isSelectStart(e)}createSceneLine(e,r,i,n,s=!1,a=this.event._width){let l=this.isSegmentLine(),c;return l?c=new cr(e,r,i,s,n):c=Vi.build(e,r,i,a,n),c}createSceneArc(e,r,i,n,s,a,l,c=!1,h=this.event._width){let u=this.isSegmentLine(),d;return u?d=gs.build(e,r,i,n,s,a,l):d=es.build(e,r,i,h,n,s,a,l),d}asClose(e){var r;if(this.event.needClose){let i=this.isSegmentLine(),{lineColor:n,lineSolid:s}=Ns.getInstance().getRegionLineStyle2(this.resultEvent.type,((r=this.event.shape[0])==null?void 0:r.color)||ee.BLACK);if(this.event.closeLine==null){let a=this.getLayer();this.event.closeLine=this.createSceneLine(a,e,this.event.start,n,s),i||(this.event.closeLine.color=ee.WHITE)}else this.adjustAngle||(this.event.closeLine.start=e)}}clear(){let e=this.event.shape;this.arc!=null&&!e.includes(this.arc)&&this.arc.remove(),this.arc=null,this.helpLine!=null&&(this.helpLine.remove(),this.helpLine=null),this.adjustAngle=!1}completed(e){var r,i;if(this.event.completing=e,this.event.drawMode==0){!this.abortLast&&this.arc&&this.event.shape.push(this.arc);let n=this.event.needClose;if(this.event.drawScene==="Line"&&(this.event.needClose=e),this.event.needClose||e){let s=this.event.shape,a=s.length,l=a?s[a-1].end:this.event.last;if(e&&(this.event.start=this.confirmStart()||l,this.asClose(l)),this.event.needClose&&this.event.closeLine){if(this.abortLast){let{lineColor:c,lineSolid:h}=Ns.getInstance().getRegionLineStyle2(this.resultEvent.type,((i=this.event.shape[0])==null?void 0:i.color)||ee.BLACK),u=this.event.closeLine.end,d=this.getLayer(),p=this.createSceneLine(d,l,u,c,h);this.event.shape.push(p);let m=this.arc;this.arc=null,this.arc=m;let g=this.getLayerId();vu.canCut()&&(g==3||g==4)&&this.event.cutSilkLines[this.event.cutSilkLines.length-1].push(p)}else if(s.length>0&&!s[s.length-1].end.equals1(this.event.start))return(r=this.event.closeLine)==null||r.remove(),this.event.needClose=n,this.addShape(this.event.start)}}this.event.needClose=n,this.confirmResult(),this.clear(),this.clearEvent(),this.drawCompleteModify()}}backspace(){this.event.drawMode==0&&(this.helpLine!=null&&(this.helpLine.remove(),this.helpLine=null),this.arc!=null&&(this.arc.remove(),this.arc=null),this.adjustAngle=!1,this.event.historyBack(this.getLayer()),this.draw(this.event.last,this.event.curr,Zt.getInstance().type))}drawCompleteModify(){pt.getAllItem().forEach(e=>{e.type==="Partition"&&(e.color=Ns.getInstance().getRegionLineStyle2("Partition").lineColor)})}wireWidth(e){this.arc!=null&&(this.arc.width=e),this.event.closeLine!=null&&(this.event.closeLine.width=e),this.helpLine!=null&&(this.helpLine.width=e),this.event.shape.forEach(r=>{r.width=e}),this.event._width=e,ut.defaultOutlineWidth=e}toggleCurrentShape(e){this.helpLine!=null&&(this.helpLine.layerId=e),this.arc!=null&&(this.arc.layerId=e),this.event.closeLine&&(this.event.closeLine.layerId=e)}hasArc(){return!!this.arc}getArcAngle(){let e=new Yn,{angle:r}=e.angleToPoint(this.arc.center,this.arc.radius,this.arc.startAngle,this.arc.endAngle,this.arc.sweep);return ve(r/Math.PI*180,3)}getArcStartAngle(){return this.arc.startAngle}getArcEndAngle(){return this.arc.endAngle}getArcRadius(){return this.arc.radius}getArcCenter(){return this.arc.center}getArcSweep(){return this.arc.sweep}getArcEnd(){return this.arc.end}getArcStart(){return this.arc.start}updateAssisLineColor(e){e&&this.arc&&(this.arc.color=e)}getPreviewOutline(){return[this.arc,this.helpLine]}isSegmentLine(){return this.event.drawScene==="Segment"}};var Tl=class extends hE{constructor(){super(...arguments);this.lineArcs=new Array;this.autoAddedLines=new Array}check(e=!1){let{shape:r,needClose:i,closeLine:n}=this.event,s=[...r,...this.lineArcs].map(a=>this.getPt(a));if(this.resultEvent instanceof F2){let a=this.resultEvent.nextShape,l=[];if(a.forEach(c=>l.push(this.getPt(c))),e&&i&&n){let c=this.getPt(n);return s.push(c,...l),!s.length||!Eo(ge.build2(s))}else return!ax([s,l])}else return e&&i&&n&&s.push(this.getPt(n)),!s.length||!Eo(ge.build2(s))}drawLineCoincideAutoDeal(e=!1){if(!this.lineArcs.length)return!0;let r=this.event.shape,i=r.filter(h=>h.getViewState()!="Not Shown").map(h=>this.getPt(h)),n=this.lineArcs.map(h=>this.getPt(h)),{coincideLines:s,coincidePoint:a,drawCoincideLines:l}=$k(i,n),c=this.getLayerId();if(s.length){let h=s.pop(),u=r[h],d=new Set(s);h==0?this.lineArcs[0].start.equals(u.end)?u.end=a:(u.start=a,this.event.start=a,this.event.closeLine!=null&&(this.event.closeLine.end=a)):u.end=a;let p=this.event.drawScene;for(let g=0;g<l.length;g++)g==l.length-1?this.lineArcs[g].start=a:this.lineArcs[g].start=this.lineArcs[g].end;!vu.canCut()&&(c==3||c==4)||p!=="Line"?r.push(...this.lineArcs):r.push(...this.autoTrimSilkscreen()),this.event.shape=r.filter((g,y)=>g instanceof Vi&&(d.has(y)||g.length<1e-8)?(g.remove(),!1):!0),vu.canCut()&&(c==3||c==4)&&this.event.rebuildCutSilkLines(),this.event.drawHistoryRecord(),this.lineArcs.length=0,this.autoAddedLines.length=0;let m=this.event.shape.length;this.event.last=m?this.event.shape[m-1].end:this.event.curr}}autoTrimSilkscreen(){let e=this.getLayer(),r=this.getLayerId(),i=this.getColor();return vu.cut(e,r,i,this)}addShape(e,r){let i=r||this.getColor(),n=this.getLayerId();if(this.lineArcs.length){this.event.shape=this.event.shape.filter(l=>l.getViewState()!="Not Shown");let s=[],a=this.event.drawScene;if(vu.canCut()&&(n==3||n==4)&&a==="Line"){let l=this.getLayer(),c=this.getLayerId();s=vu.cut(l,c,i,this),s.length>0&&(this.event.shape.push(...s),this.event.drawHistoryRecord())}else{this.lineArcs=this.lineArcs.filter(l=>l.length>0);for(let l=0;l<this.lineArcs.length;l++){let c=this.lineArcs[l],h=this.lineArcs[l+1];c.color=i,this.event.isEditOutLine&&(c instanceof cr||c instanceof gs)&&(c.isSolid=!0),this.event.shape.push(c),!(this.autoAddedLines.includes(c)&&(h instanceof Vi||h instanceof cr))&&this.event.drawHistoryRecord()}}this.lineArcs.length=0,this.autoAddedLines.length=0,this.event.last=null,this.event.start=e,this.event.shape.forEach(l=>{l.color=i})}}draw(e,r,i,n=!1){var d;if(e==null||r==null)return;let s,a,l=this.event.shape.at(-1);this.lineArcs.forEach(p=>p.remove()),this.lineArcs.length=0,this.autoAddedLines.length=0;let c=this.getLayer(),{lineColor:h,lineSolid:u}=Ns.getInstance().getRegionLineStyle2(this.resultEvent.type,((d=this.event.shape[0])==null?void 0:d.color)||ee.BLACK);if(this.event.isEditOutLine&&(c=1002,h=ee.of3("#F0F0F0"),u=!1,s=13,a=28),!this.canFillet()||!(l&&(l instanceof Vi||l instanceof cr)))this.lineArcs.push(this.createSceneLine(c,e,r,h,u,this.event._width,s,a));else{let{radius:p,circleCenter:m,tangencyPoint1:g,tangencyPoint2:y,startAngle:b,endAngle:P,sweep:T,canAddFillet:I}=Aq(l.start,l.end,n?this.event.closeLine.end:r,le.pcbConfig.filletRadius2DLine);if(I){if(l.hidden(),this.lineArcs.push(this.createSceneLine(c,l.start,g,h,u,this.event._width,s,a)),le.pcbConfig.autoChamfer2DLine=="fillet"){let C=this.createSceneArc(c,m,p,b,P,T,h);this.lineArcs.push(C),this.autoAddedLines.push(C)}else{let C=this.createSceneLine(c,g,y,h,u,this.event._width,s,a);this.lineArcs.push(C),this.autoAddedLines.push(C)}this.lineArcs.push(this.createSceneLine(c,y,r,h,u,this.event._width,s,a))}else l.visible(),this.lineArcs.push(this.createSceneLine(c,e,r,h,u,this.event._width,s,a));if(n){let C=this.event.shape[0],E=this.lineArcs.at(-1);if((E instanceof Vi||E instanceof cr)&&(C instanceof Vi||C instanceof cr)){let{radius:O,circleCenter:_,tangencyPoint1:x,tangencyPoint2:v,startAngle:D,endAngle:w,sweep:F,canAddFillet:H}=Aq(E.start,C.start,C.end,le.pcbConfig.filletRadius2DLine);if(H){if(E.end=x,le.pcbConfig.autoChamfer2DLine=="fillet"){let z=this.createSceneArc(c,_,O,D,w,F,h);this.lineArcs.push(z),this.autoAddedLines.push(z)}else{let z=this.createSceneLine(c,x,v,h,u,this.event._width,s,a);this.lineArcs.push(z),this.autoAddedLines.push(z)}C.start=v}}}}}createSceneLine(e,r,i,n,s=!1,a=this.event._width,l=2,c=3){let h=this.isSegmentLine(),u;return h?u=new cr(e,r,i,s,n,l,c):u=Vi.build(e,r,i,a,n),u}createSceneArc(e,r,i,n,s,a,l,c=this.event._width){let h=this.isSegmentLine(),u;return h?u=gs.build(e,r,i,n,s,a,l):u=es.build(e,r,i,c,n,s,a),u}asClose(e){var r,i;if(this.event.needClose){let n=this.isSegmentLine(),{lineColor:s,lineSolid:a}=Ns.getInstance().getRegionLineStyle2(this.resultEvent.type,((r=this.event.shape[0])==null?void 0:r.color)||ee.BLACK);if(this.event.last!=null)if(this.event.closeLine==null){let l=this.getLayer();this.event.closeLine=this.createSceneLine(l,e,this.event.start,s,a),n||(this.event.closeLine.color=ee.WHITE)}else this.event.closeLine.start=e;this.event.closeLine&&(this.event.closeLine.color=Ns.getInstance().getRegionLineStyle2(this.resultEvent.type,((i=this.event.shape[0])==null?void 0:i.color)||ee.BLACK).lineColor)}}clear(){let e=this.event.shape;this.lineArcs.forEach(r=>{e.includes(r)||r.remove()}),this.lineArcs.length=0,this.autoAddedLines.length=0}completed(e,r){if(this.event.drawMode==0){let i=this.getLayerId();if(!this.abortLast&&(this.drawLineCoincideAutoDeal(),this.lineArcs.length)){this.event.shape.push(...this.lineArcs);let n=this.event.drawScene;vu.canCut()&&(i==3||i==4)&&n==="Line"&&this.autoTrimSilkscreen()}if(this.event.needClose||e){let n=this.event.shape,s=n.length,a=s?n[s-1].end:this.event.last;if(e&&(this.event.start=this.confirmStart()||a,this.asClose(a)),this.event.needClose&&this.event.closeLine){if(this.abortLast){let l=this.event.closeLine.end;this.draw(a,l,Zt.getInstance().type,!0),this.addShape(l,r)}else if(n.length>0){let l=this.event.shape[0].color;this.event.closeLine.color=l,this.event.shape.push(this.event.closeLine)}}}this.confirmResult(),this.clear(),this.clearEvent()}}backspace(){this.event.drawMode==0&&(this.event.historyBack(this.getLayer()),this.draw(this.event.last,this.event.curr,Zt.getInstance().type))}wireWidth(e){this.lineArcs.length&&this.lineArcs.forEach(r=>r.width=e),this.event.closeLine!=null&&(this.event.closeLine.width=e),this.event.shape.forEach(r=>{r.width=e}),this.event._width=e,ut.defaultOutlineWidth=e}toggleCurrentShape(e){this.lineArcs.length&&this.lineArcs.forEach(r=>r.layerId=e),this.event.closeLine&&(this.event.closeLine.layerId=e)}updateAssisLineColor(e){e&&this.lineArcs.length&&this.lineArcs.forEach(r=>r.color=e)}getPreviewOutline(){return[...this.lineArcs]}isSegmentLine(){return this.event.drawScene==="Segment"}};var Gh=class extends hE{constructor(){super(...arguments);this.tool=new Xn;this.line=null;this.line1=null}flipPath(){if(this.event.drawMode==0){let e=Zt.getInstance().type;if(this.line!=null){let r=this.line.start,i;this.line1!=null?i=this.line1.end:i=this.line.end;let n=i.sub(r),s=Math.abs(n.x),a=Math.abs(n.y);if(ne.eq(s,a)){let h=null;if(this.line instanceof es?h=this.line:this.line1 instanceof es&&(h=this.line1),h){let u=ae.CCW==h.sweep?ae.CW:ae.CCW,d=this.mirrorPoint(r,i,h.center),p=h.startAngle,m=h.endAngle;h.center=d,h.sweep=u,h.startAngle=m+Math.PI,h.endAngle=p+Math.PI;return}}let l=this.tool.degree45(this.event.lastDirect,r,i),c=l[2].sub(l[1]).normalize();(c.x!=0||c.y!=0)&&(this.event.lastDirect=c),this.tool.arcFirst=!this.tool.arcFirst,this.draw(r,i,e)}}}mirrorPoint(e,r,i){let n=r.x-e.x,s=r.y-e.y,a=Math.sqrt(n*n+s*s);if(a===0)return null;let l=n/a,c=s/a,h=i.x-e.x,u=i.y-e.y,d=h*l+u*c,p=e.x+d*l,m=e.y+d*c,g=2*p-i.x,y=2*m-i.y;return new S(g,y)}getModel(e){if(e instanceof Vi||e instanceof es)return e.primitive;if(e instanceof cr)return new M(e.start,e.end);if(e instanceof gs)return q.build2(e.center,e.startAngle,e.endAngle,e.radius,e.radius,e.sweep)}check(e=!1){let{shape:r,needClose:i,closeLine:n}=this.event,s=r.map(a=>this.getModel(a));if((this.line||this.line)&&(this.line&&s.push(this.getPt(this.line)),this.line1&&s.push(this.getPt(this.line1))),this.resultEvent instanceof F2){let a=this.resultEvent.nextShape,l=[];if(a.forEach(c=>l.push(this.getPt(c))),e&&i&&n){let c=this.getPt(n);return s.push(c,...l),!s.length||!Eo(ge.build2(s))}else return!ax([s,l])}else return e&&i&&n&&s.push(this.getPt(n)),!s.length||!Eo(ge.build2(s))}drawLineCoincideAutoDeal(e=!1){if(!this.line)return!0;let r=this.event.shape,i=r.map(h=>this.getPt(h)),n=[this.line,this.line1].filter(Boolean).map(h=>this.getPt(h)),{coincideLines:s,coincidePoint:a,drawCoincideLines:l}=$k(i,n);if(s.length){let h=s.pop(),u=r[h],d=new Set(s);h==0?this.line.start.equals(u.end)?u instanceof Vi||u instanceof cr?u.end=a:u.endAngle=c(u):(u instanceof Vi||u instanceof cr?u.start=a:u.startAngle=c(u),this.event.start=a,this.event.closeLine!=null&&(this.event.closeLine.end=a)):u instanceof Vi||u instanceof cr?u.end=a:u.endAngle=c(u),l.length==1?this.line instanceof Vi||this.line instanceof cr?this.line.start=a:this.line.startAngle=c(this.line):l.length==2&&(this.line.remove(),this.line=null,this.line1 instanceof Vi||this.line1 instanceof cr?this.line1.start=a:this.line1.startAngle=c(this.line1)),r.push(this.line,this.line1),this.event.shape=r.filter((g,y)=>g?d.has(y)||g.start.distance1(g.end)<1e-8?(g.remove(),!1):!0:!1);let p=this.getLayerId();vu.canCut()&&(p==3||p==4)&&this.event.rebuildCutSilkLines(),this.event.drawHistoryRecord(),this.line=null,this.line1=null;let m=this.event.shape.length;this.event.last=m?this.event.shape[m-1].end:this.event.curr}function c(h){let u=a.sub(h.center),d=Math.atan2(u.y,u.x);return d<0&&(d=Math.PI*2+d),d}}addShape(e,r){let i=r||this.getColor();if(this.line!=null){if(this.line1==null){let l=this.getLayer();this.line1=Vi.build(l,e,e,this.event._width)}let n=l=>{l.length>1e-8&&(this.event.shape.push(l),this.event.drawHistoryRecord(),l.color=i)},s=l=>{l!=null&&(this.event.shape.push(l),this.event.drawHistoryRecord(),l.color=i,this.event.last=null,this.event.start=l.end,l=null,this.event.completing&&this.completed(!1,r))},a=this.getLayerId();vu.canCut()&&(a==3||a==4)&&(this.event.cutSilkLines.length==0?this.event.cutSilkLines.push([this.line,this.line1]):this.event.cutSilkLines[this.event.cutSilkLines.length-1].push(this.line,this.line1)),this.line instanceof Vi||this.line instanceof cr?(n(this.line),s(this.line1)):(s(this.line),n(this.line1)),this.line=null,this.line1=null,this.event.last=null,this.event.start=e}}draw(e,r,i){if(!(e==null||r==null))switch(i){case"WIRING_CORNER_ARC90":{let n=this.tool.degree45(this.event.lastDirect,e,r);this.modifyArc90(n);break}case"WIRING_CORNER_ARC45":{let n=this.tool.arc45(this.event.lastDirect,e,r);this.modifyArc45(n);break}}}asClose(e){var r,i;if(this.event.needClose){let n=this.isSegmentLine();if(this.event.closeLine==null){let s=this.getLayer(),{lineColor:a,lineSolid:l}=Ns.getInstance().getRegionLineStyle2(this.resultEvent.type,((r=this.event.shape[0])==null?void 0:r.color)||ee.BLACK);this.event.closeLine=this.createSceneLine(s,e,this.event.start,a,l),n||(this.event.closeLine.color=ee.WHITE)}else this.event.closeLine.start=e;this.event.closeLine&&(this.event.closeLine.color=Ns.getInstance().getRegionLineStyle2(this.resultEvent.type,((i=this.event.shape[0])==null?void 0:i.color)||ee.BLACK).lineColor)}}clear(){let e=this.event.shape;this.line!=null&&!e.includes(this.line)&&this.line.remove(),this.line=null,this.line1!=null&&!e.includes(this.line1)&&this.line1.remove(),this.line1=null}completed(e,r){if(this.event.drawMode==0){if(!this.abortLast){this.drawLineCoincideAutoDeal();let i=[this.line,this.line1].filter(n=>n);if(this.line&&i.length){this.event.shape.push(...i);let n=this.getLayerId();vu.canCut()&&(n==3||n==4)&&(this.event.cutSilkLines.length==0?this.event.cutSilkLines.push(i):this.event.cutSilkLines[this.event.cutSilkLines.length-1].push(...i))}}if(this.event.needClose||e){let i=this.event.shape,n=i.length,s=n?i[n-1].end:this.event.last;if(e&&(this.event.start=this.confirmStart()||s,this.asClose(s)),this.event.needClose&&this.event.closeLine){if(this.abortLast){let a=this.event.closeLine.end;this.draw(s,a,Zt.getInstance().type),this.check()||this.flipPath(),this.addShape(a,r)}else if(i.length>0){let a=this.event.shape[0].color;this.event.closeLine.color=a,this.event.shape.push(this.event.closeLine)}}}this.confirmResult(),this.clear(),this.clearEvent(),this.drawCompleteModify()}}backspace(){this.event.drawMode==0&&(this.event.historyBack(this.getLayer()),this.draw(this.event.last,this.event.curr,Zt.getInstance().type))}drawCompleteModify(){pt.getAllItem().forEach(e=>{e.type==="Partition"&&(e.color=Ns.getInstance().getRegionLineStyle2("Partition").lineColor)})}createSceneLine(e,r,i,n,s=!1,a=this.event._width){let l=this.isSegmentLine(),c;return l?c=new cr(e,r,i,s,n):c=Vi.build(e,r,i,a,n),c}createSceneArc(e,r,i,n,s,a,l,c=!1,h=this.event._width){let u=this.isSegmentLine(),d;return u?d=gs.build(e,r,i,n,s,a,l):d=es.build(e,r,i,h,n,s,a,l),d}createLine(e,r,i,n){var l;let{lineColor:s,lineSolid:a}=Ns.getInstance().getRegionLineStyle2(this.resultEvent.type,((l=this.event.shape[0])==null?void 0:l.color)||ee.BLACK);return this.event.isEditOutLine&&(e=1002,s=ee.of3("#F0F0F0"),a=!1),r==null?r=this.createSceneLine(e,i,n,s,a):r instanceof es||r instanceof gs?(r.remove(),r=this.createSceneLine(e,i,n,s,a)):(r.start=i,r.end=n),r}createArc(e,r,i,n,s,a=Go){var T;let l=new Yn,c=i[1].sub(i[0]),h=i[2].sub(i[1]),u=c.cross(h);if(u>0)a=a;else if(u==0)if((r instanceof Vi||r instanceof cr)&&c.length()>0&&Math.abs(c.x)>0&&Math.abs(c.y)>0)r.end.sub(r.start).cross(c)>0?a=a:a=-a;else if(r==null&&c.length()>0&&Math.abs(c.x)>0&&Math.abs(c.y)>0)a=a;else if((r instanceof es||r instanceof gs)&&c.length()>0&&Math.abs(c.x)>0&&Math.abs(c.y)>0)a=(r.sweep===ae.CW?-1:1)*(r.getAngle()%Math.PI);else return a=0,r;else a=-a;let{center:d,radius:p,startAngle:m,endAngle:g,sweep:y}=l.pointToAngle(n,s,a),{lineColor:b,lineSolid:P}=Ns.getInstance().getRegionLineStyle2(this.resultEvent.type,((T=this.event.shape[0])==null?void 0:T.color)||ee.BLACK);if(this.event.isEditOutLine&&(e=1002,b=ee.of3("#F0F0F0"),P=!1),r==null)r=this.createSceneArc(e,d,p,m,g,y,b,P);else if(r instanceof Vi||r instanceof cr)r.remove(),r=this.createSceneArc(e,d,p,m,g,y,b,P);else{let I=r.getAngle(),C=r.start,E=r.end;(!C.equals(n)||!E.equals(s)||!ne.eq(a,I))&&(r.center=d,r.radius=p,r.startAngle=m,r.endAngle=g,r.sweep=y)}return r}modifyArc90(e){var a;let r=this.getLayer(),i=Ns.getInstance().getRegionLineStyle2(this.resultEvent.type,((a=this.event.shape[0])==null?void 0:a.color)||ee.BLACK).lineColor;this.event.isEditOutLine&&(r=1002,i=ee.of3("#F0F0F0"));let n=e[1].sub(e[0]),s=e[2].sub(e[1]);if(ne.greater(n.length(),0)&&ne.greater(s.length(),0)?Math.abs(n.x)<1e-5||Math.abs(n.y)<1e-5?(this.line=this.createLine(r,this.line,e[0],e[1]),this.line1=this.createArc(r,this.line1,e,e[1],e[2])):(this.line=this.createArc(r,this.line,e,e[0],e[1]),this.line1=this.createLine(r,this.line1,e[1],e[2])):ne.greater(n.length(),0)&&ne.lesseq(s.length(),0)?(Math.abs(n.x)<1e-5||Math.abs(n.y)<1e-5?this.line=this.createLine(r,this.line,e[0],e[1]):this.line=this.createArc(r,this.line,e,e[0],e[1]),this.line1&&(this.line1.remove(),this.line1=null)):ne.lesseq(n.length(),0)&&ne.greater(s.length(),0)&&(Math.abs(s.x)<1e-5||Math.abs(s.y)<1e-5?this.line=this.createLine(r,this.line,e[1],e[2]):this.line=this.createArc(r,this.line,e,e[1],e[2]),this.line1&&(this.line1.remove(),this.line1=null)),this.line&&(this.line.color=i),this.line1&&(this.line1.color=i),this.line!=null){let l=this.line.end.sub(this.line.start).normalize();(l.x!=0||l.y!=0)&&(this.event.lastDirect=l)}}modifyArc45(e){var l;let r=this.getLayer(),i=Ns.getInstance().getRegionLineStyle2(this.resultEvent.type,((l=this.event.shape[0])==null?void 0:l.color)||ee.BLACK).lineColor;this.event.isEditOutLine&&(r=1002,i=ee.of3("#F0F0F0"));let n=Math.PI/4,s=e[1].sub(e[0]),a=e[2].sub(e[1]);if(s.length()!=0&&a.length()!=0?this.tool.arcFirst?(this.line=this.createArc(r,this.line,e,e[0],e[1],n),this.line1=this.createLine(r,this.line1,e[1],e[2])):(this.line=this.createLine(r,this.line,e[0],e[1]),this.line1=this.createArc(r,this.line1,e,e[1],e[2],n)):s.length()!=0&&a.length()==0?(Math.abs(s.x)<1e-5||Math.abs(s.y)<1e-5||s.length()>0&&Math.abs(Math.abs(s.x)-Math.abs(s.y))<1e-5?this.line=this.createLine(r,this.line,e[0],e[1]):this.line=this.createArc(r,this.line,e,e[0],e[1],n),this.line1!=null&&(this.line1.remove(),this.line1=null)):s.length()==0&&a.length()!=0&&(Math.abs(a.x)<1e-5||Math.abs(a.y)<1e-5||s.length()>0&&Math.abs(Math.abs(s.x)-Math.abs(s.y))<1e-5?this.line=this.createLine(r,this.line,e[1],e[2]):this.line=this.createArc(r,this.line,e,e[1],e[2],n),this.line1!=null&&(this.line1.remove(),this.line1=null)),this.line&&(this.line.color=i),this.line1&&(this.line1.color=i),this.line!=null){let c=this.line.end.sub(this.line.start).normalize();if(this.line instanceof es||this.line instanceof gs){let h=this.line.start.sub(this.line.center).normalize();c=new S(-h.y,h.x),this.line.sweep==ae.CW&&(c=c.mul(-1))}this.event.lastDirect=c}}wireWidth(e){this.line!=null&&(this.line.width=e),this.line1!=null&&(this.line1.width=e),this.event.closeLine!=null&&(this.event.closeLine.width=e),this.event.shape.forEach(r=>{r.width=e}),this.event._width=e,ut.defaultOutlineWidth=e}toggleLineOrArc(e,r){return r instanceof Vi||r instanceof cr?this.createSceneLine(e,r.start,r.end,r.color,!0,r.width):this.createSceneArc(e,r.center,r.radius,r.startAngle,r.endAngle,r.sweep,r.color,!0,r.width)}toggleCurrentShape(e){this.line&&(this.line.layerId=e),this.line1&&(this.line1.layerId=e),this.event.closeLine&&(this.event.closeLine.layerId=e)}updateAssisLineColor(e){e&&(this.line&&(this.line.color=e),this.line1&&(this.line1.color=e))}getPreviewOutline(){return[this.line,this.line1]}isSegmentLine(){return this.event.drawScene==="Segment"}};var CD=class{constructor(t,e,r,i){this.lines=[];let n=new cr(1002,t,e,!0),s=gs.build(1002,t,r,0,i,ae.CCW);this.lines.push(n),this.lines.push(s)}update(t,e,r,i){if(this.lines.length)this.lines[0].start=t,this.lines[0].end=e,this.lines[1].center=t,this.lines[1].startAngle=0,this.lines[1].endAngle=i,this.lines[1].radius=r;else{let n=new cr(1002,t,e,!0),s=gs.build(1002,t,r,0,i,ae.CCW);this.lines.push(n),this.lines.push(s)}}remove(){for(let t=0;t<this.lines.length;t++)this.lines[t].remove();this.lines.length=0}},SD=class{constructor(t,e,r,i,n,s,a){this.line1=new cr(1002,r,t,!0),this.line2=new cr(1002,r,e,!0),this.line3=gs.build(1002,r,i,n,s,a)}update(t,e,r,i,n,s,a){this.line1&&this.line2&&this.line3?(this.line1.start=r,this.line1.end=t,this.line2.start=r,this.line2.end=e,this.line3.center=r,this.line3.startAngle=n,this.line3.endAngle=s,this.line3.radius=i,this.line3.sweep=a):(this.line1=new cr(1002,r,t,!0),this.line2=new cr(1002,r,e,!0),this.line3=gs.build(1002,r,i,n,s,a))}remove(){var t,e,r;(t=this.line1)==null||t.remove(),(e=this.line2)==null||e.remove(),(r=this.line3)==null||r.remove(),this.line1=null,this.line2=null,this.line3=null}};var mG=class mG extends ni{constructor(e){super();this.widthFollowRule=!1;this.event=new du;this.started=!1;switch(this.lineType=e,this.event=new du,we.drawing=!0,this.lineType=="Line"?R.getInstance().doctype==4?this.event._width=we.prevTrackWidth||ut.defaultOutlineWidth:this.event._width=Ha.getInstance().getTrackWidth().value||ut.defaultOutlineWidth:this.lineType=="Board Outline"||this.lineType=="3D Shell - Outline"?this.event._width=ut.defaultOutlineWidth:this.event._width=.02,this.lineType=="3D Shell - Outline"&&(this.event._width=Pu(-1,this.lineType)),this.lineType=="Partition"&&(this.event._width=.01),this.resultEvent=new Hm(this.lineType),this.lineType==="Line"&&(this.event.needClose=!1),this.event.drawScene=this.lineType,Zt.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new eh(this.event,Ur,this.resultEvent,this.lineType);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new Gh(this.event,Ur,this.resultEvent,this.lineType);break;case"WIRING_CORNER_ARC":this.drawPolygon=new ja(this.event,Ur,this.resultEvent,this.lineType);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Tl(this.event,Ur,this.resultEvent,this.lineType);break}this.event.commands=new De("draw 2DLine - "+this.lineType),Ur.addDrawTool(this),Ea.changeTool(this),uu.setTool(this),mG._readyType=this.lineType}static get readyType(){return this._readyType}getWidth(){return this.event._width}onKeyDown(e){let r;switch((this.resultEvent.type==="Line"||this.resultEvent.type==="Board Outline")&&(r=tr.getLocalAction(["decrease_routing_width","increase_routing_width"],e)),r||(r=tr.getAction(4,e)),r){case"changeRoutingAngle":case"Routing Corner":let i=Ur.getNextType();if(this.wireCorner(i),i==="WIRING_CORNER_FREEANGLE"||i==="WIRING_CORNER_ARC"){let s=new S(e.sceneX,e.sceneY);this.showFloatingInputBox(s)}else at.destroy();wi();break;case"Switch Common Track Width":(this.resultEvent.type==="Line"||this.resultEvent.type==="Board Outline")&&this.showCommonTrackWidthMenu(e);break;case"Change Track Width While Routing":let n=Zt.getInstance().type;this.canChangeWhileRouting(this.resultEvent.type)&&(!le.pcbConfig.useDynamicInputBox||n!=="WIRING_CORNER_FREEANGLE")&&(this.resultEvent.type==="Line"||this.resultEvent.type==="Board Outline")&&A.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"decrease_routing_width":{let a=this.event._width-.2;a>=.1&&(this.setWireWidth(a),wi())}break;case"increase_routing_width":{let a=this.event._width+.2;this.setWireWidth(a),wi()}break}r==="Cancel"?this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.cancel():r==="Finish"?this.next(e):this.drawPolygon.onKeyDown(e)}onMouseLeftUp(e){this.next(e)}onEnterPlace(e){}next(e){if(at.editingWhat){at.editingWhat="";return}this.started||(this.started=!0,this.start()),this.dealLocked(e),this.drawPolygon.onMouseLeftUp(e),this.lineType==="Partition"&&this.drawPolygon.shape.forEach(r=>{r.color=Ns.getInstance().getRegionLineStyle2("Partition").lineColor}),at.destroy()}dealLocked(e){if(typeof at.lineLockedLength=="number"){let r=at.startPoint,i=new S(e.sceneX,e.sceneY),n=new S(i.x-r.x,i.y-r.y).normalize(),s=new S(n.x*at.lineLockedLength,n.y*at.lineLockedLength);i=new S(s.x+r.x,s.y+r.y),e.sceneX=i.x,e.sceneY=i.y}if(typeof at.lineLockedAngle=="number"){let r=at.startPoint,i=new S(e.sceneX-r.x,e.sceneY-r.y),n=_q(i),s=jEe(i,at.lineLockedAngle-n);e.sceneX=s.x+r.x,e.sceneY=s.y+r.y}}onMouseMove(e){this.dealLocked(e),this.drawing&&this.drawPolygon.onMouseMove(e);let r=new S(e.sceneX,e.sceneY);this.showFloatingInputBox(r),this.lineType==="Partition"&&this.drawPolygon.updateAssisLineColor(Ns.getInstance().getRegionLineStyle2("Partition").lineColor)}showFloatingInputBox(e){if(le.pcbConfig.useDynamicInputBox&&this.started&&this.event.last&&(this.drawPolygon instanceof Tl||this.drawPolygon instanceof ja)){let r=nf(),i=this.event.last;at.startPoint=i;let n=i.distance1(e);if(!n)return;let s=_o(e),a=_o(i),l=new S(e.x-i.x,e.y-i.y),c=_q(l);if(this.drawPolygon instanceof Tl||this.drawPolygon instanceof ja&&!this.drawPolygon.hasArc()){let h=c/180*Math.PI,u=new S(i.x+n,i.y);at.id!=="adsorption"&&(at.auxiliaryLine1?at.auxiliaryLine1.update(i,u,n,h):at.auxiliaryLine1=new CD(i,u,n,h));let d=9;if(d>=at.priority){at.priority=d;let p={data:[{startPoint:i,cursorPoint:e,frameStartPoint:a,frameCursorPoint:s,info:{type:"free",value:je(n),unit:R.getInstance().unit}},{startPoint:i,cursorPoint:e,frameStartPoint:a,frameCursorPoint:s,info:{type:"circle",value:c,tagName:"angle"}}],type:"rect",show:!0,frameInfo:r};at.create(p)}}else if(this.drawPolygon instanceof ja&&this.drawPolygon.hasArc()){let h=this.drawPolygon.getArcAngle(),u=this.event.start,d=this.drawPolygon.getArcEnd(),p=this.drawPolygon.getArcCenter(),m=this.drawPolygon.getArcRadius(),g=this.drawPolygon.getArcStartAngle(),y=this.drawPolygon.getArcEndAngle(),b=this.drawPolygon.getArcSweep();at.id!=="adsorption"&&(at.auxiliaryLine2?at.auxiliaryLine2.update(u,d,p,m/10,g,y,b):at.auxiliaryLine2=new SD(u,d,p,m,g,y,b)),at.id!=="Free Arc"&&at.destroy();let P=9;if(P>=at.priority){at.priority=P;let T={data:[{startPoint:u,center:p,frameStartPoint:a,frameCursorPoint:_o(p),info:{type:"circle",value:h,tagName:"angle",canNotLock:!0}}],type:"rect",show:!0,frameInfo:r};at.create(T,"Free Arc")}}}else this.started&&at.id!=="adsorption"&&at.destroy()}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,keyCode:l,startPoint:c}=e;if(a){at.editingWhat=i;return}let h=!1;if((at.editingWhat||typeof at.lineLockedLength=="number"||typeof at.lineLockedAngle=="number")&&(h=!0),at.editingWhat="",n||s){this.drawPolygon instanceof ja?this.drawPolygon.getArc()||this.lockUnlock(e):this.lockUnlock(e);return}let u=this.applyValue(e);(l===108||l===13)&&(u?h?(this.drawPolygon.asMouseLeftUp(u),at.destroy()):(this.drawPolygon.addShape(u),this.completed()):at.destroy())}lockUnlock(e){let{value:r,type:i,locked:n,unlocked:s}=e,a=new dt;i==="free"?n?(this.applyValue(e),r=a.conversion(R.getInstance().unit,"mil",r/10),at.lineLockedLength=r):s&&(at.lineLockedLength=null):i==="circle"&&(n?(at.lineLockedAngle=r,this.applyValue(e)):s&&(at.lineLockedAngle=null))}applyValue(e){let{value:r,type:i,startPoint:n,cursorPoint:s}=e,a=new dt,l,c;if(i==="free")if(r=a.conversion(R.getInstance().unit,"mil",r/10),at.id==="adsorption"){let h=new S(s.x-n.x,s.y-n.y).normalize();h=new S(h.x*r,h.y*r);let u=new S(h.x+n.x,h.y+n.y);if(this.started)c=u;else{this.event.start=u,this.started=!0;return}}else{let h=new S(this.event.curr.x-this.event.last.x,this.event.curr.y-this.event.last.y).normalize();l=new S(h.x*r,h.y*r),c=new S(l.x+this.event.last.x,l.y+this.event.last.y)}else if(i==="circle"&&this.drawPolygon instanceof ja){let h=this.drawPolygon.getArc();if(h){let u=h.start,d=h.end,p=new S((u.x+d.x)/2,(u.y+d.y)/2),m=new S(d.x-u.x,d.y-u.y),g=m.length(),y=g/2/Math.sin(r/2/180*Math.PI),b=g/2/Math.tan(r/2/180*Math.PI),P=m.normalize(),T=new S(-P.y,P.x),I=new S(T.x*b+p.x,T.y*b+p.y);c=new S(-T.x*y+I.x,-T.y*y+I.y)}else{let u=at.startPoint;s=this.event.curr||s;let d=new S(s.x-u.x,s.y-u.y),p=_q(d),m=jEe(d,r-p);c=new S(m.x+u.x,m.y+u.y)}}else if(i==="circle"&&this.drawPolygon instanceof Tl){let h=at.startPoint;s=this.event.curr||s;let u=new S(s.x-h.x,s.y-h.y),d=_q(u),p=jEe(u,r-d);c=new S(p.x+h.x,p.y+h.y)}return this.showFloatingInputBox(c),this.event.curr=c,this.drawPolygon.draw(this.event.last,this.event.curr,Zt.getInstance().type),this.drawPolygon.asClose(c),A.publish("updateFrame",""),c}onMouseRightUp(e){if(e.openMenu)switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.cancel();break}}}interrupt(){this.drawPolygon.interrupt(),at.destroy(),this.started=!1,mG._readyType=null,this.end()}cancel(){let{drawPolygon:e}=this;this.started?this.interrupt():(Ur.clearDrawTool(),e.cancel(),mG._readyType=null),at.destroy(),this.started=!1}flipPath(){this.drawPolygon.flipPath()}toggleLayer(e){if(this.resultEvent.type==="Fill Region"){let r=Pe.getLastActiveLayerID(),i=Pe.getAllPinLayerIds();if(i.includes(e)!==i.includes(r))return Pe.setActiveLayerId(r)}this.drawPolygon.toggleLayer(e)}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new eh(this.event,Ur,this.resultEvent,this.lineType);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new Gh(this.event,Ur,this.resultEvent,this.lineType);break;case"WIRING_CORNER_ARC":this.drawPolygon=new ja(this.event,Ur,this.resultEvent,this.lineType);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Tl(this.event,Ur,this.resultEvent,this.lineType);break}this.event.start!=null&&this.drawing&&(this.event.last==null&&(this.event.last=this.event.start),this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr)),Zt.getInstance().type=e,we.synchronize()}completed(){let e;this.lineType==="Partition"&&(e=Ns.getInstance().getRegionLineStyle2("Partition").lineColor),this.drawPolygon.completed(!1,e),at.destroy(),this.started=!1,this.end()}backspace(){this.drawPolygon.backspace(),at.destroy(),this.started=!1}wireMode(e){}rightClickMenuData(e){let r=this.event.start!=null,i=this.resultEvent.type==="Line"||this.resultEvent.type==="Board Outline",n={state:"show",left:e.mouseX,top:e.mouseY,filter:vg(Zt.getInstance().type,e.adsorb,r,!0,i,this.event._width).result};$t.getInstance().menuData(n,this),this.drawing=!1}showCommonTrackWidthMenu(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:Dm(this.event._width).result};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"AUTO_TRIM_SILKSCREEN":A.publish("autoTrimSilkscreen","");break;case"COMPLETE":this.drawPolygon.abortLast=!1,this.completed();break;case"CANCEL":this.event.shape&&this.event.shape.length?(this.drawPolygon.abortLast=!0,this.completed()):this.cancel();break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":this.wireCorner(i[1]),wi();break;case"WIRING_WIDTH_INPUT":A.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"WIDTH":i[1]==="WIRING_WIDTH"?this.toggleWidth(i[2]):i[1]==="WIRING_WIDTH_COMMONLY_SSETTING"&&A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",Q());break;case"WIRING_WIDTH":this.toggleWidth(i[1]);break;case"WIRING_WIDTH_COMMONLY_SSETTING":A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",Q());break}A.publish("updateFrame","")}toggleWidth(e){if(this.resultEvent.type==="Line"||this.resultEvent.type==="Board Outline"){let r=le.trackConfig[e];this.setWireWidth(r.getSizeAccordingToUnit()),wi()}}setWireWidth(e){this.drawPolygon.wireWidth(e),this.widthFollowRule=!1,we.prevTrackWidth=e,A.publish("flushSelectingInfo","")}getFirstLine(){if(this.drawPolygon instanceof eh)return this.drawPolygon.getLine()}};mG._readyType=null;var hc=mG;function _q(o){if(o.length()<=0)return 0;let t=new S(1,0),e=Math.atan(o.y/o.x);return e=e/Math.PI*180,o.x<0?e=180+e:o.y<0&&(e=360+e),e}function jEe(o,t){let e=o.length(),r=_q(o),i=Math.cos((t+r)/180*Math.PI)*e,n=Math.sin((t+r)/180*Math.PI)*e;return new S(i,n)}var Lhe=class{constructor(t){this.tool=t,A.subscribe("tool",this.update.bind(this)),A.subscribe("DrawImage",this.drawImage.bind(this)),A.subscribe("DrawTrueColorPictureBySilkViewer",this.drawTrueColorPictureBySilkViewer.bind(this)),A.subscribe("PlaceQRCodeBySilkViewer",this.placeQRCodeBySilkViewer.bind(this)),A.subscribe("draw(RectFPCStiffener)",this.drawRectFPCStiffener.bind(this)),A.subscribe("draw(CirFPCStiffener)",this.drawCircleFPCStiffener.bind(this)),A.subscribe("draw(PolyFPCStiffener)",this.drawPolygonFPCStiffener.bind(this)),A.subscribe("updateQRCodeSize",this.updateQRCodeSize.bind(this)),A.subscribe("toggleQRCodeLayer",this.toggleQRCodeLayer.bind(this)),A.subscribe("toggleCounterBoreLabelLayer",this.toggleCounterBoreLabelLayer.bind(this)),A.subscribe("updateRotation",this.updateRotation.bind(this)),A.subscribe("updateFPCComponent",this.updateFPCComponent.bind(this)),A.subscribe("updateTextDirection",this.updateTextDirection.bind(this)),A.messageBus.rpcService("getQRCodePosition",()=>this.getQRCodePosition()),A.messageBus.rpcService("getCounterBoreData",()=>this.getCounterBoreData()),A.messageBus.rpcService("getDiagram",()=>this.getDiagram()),A.messageBus.rpcService("getCommentInfo",()=>this.getCommentInfo()),A.messageBus.rpcService("getULData",()=>Bp.getInstance().getULData()),A.messageBus.rpcService("getFPCCollect",()=>this.getFPCCollect())}getQRCodePosition(){let t={},e=Yr.QRCode,r=Yr.plainCode,i=Pe.getActiveLayerID();if(t.layerId=i,e){let n=e.model.box,s=Eq(n,Yr.imgUnit);t.qrCodeBbox={...s,rotation:Yl(ve(-(e.rotation/Math.PI)*180,3))},t.qrCodeSize=gG(Yr.imgHeight,Yr.imgUnit,Yr.imgWidth),t.qrCode=Yr.base64,t.qrCodeStart={x:je(e.start.x,null,Yr.imgUnit),y:je(e.start.y,null,Yr.imgUnit)}}if(r){let n=r.model.box,s=Eq(n,Yr.textUnit);t.plainCodeBbox={...s,rotation:Yl(ve(-(r.rotation/Math.PI)*180,3))},t.plainCodeHeight=je(r.fontSize,null,Yr.textUnit),t.plainCodeSize=gG(r.textHeight,Yr.textUnit,r.textWidth),t.plainCode=r.value,t.direction=Yr.textDirection,t.plainCodePosition={x:je(r.position.x,null,Yr.textUnit),y:je(r.position.y,null,Yr.textUnit)}}return!e&&!r&&(t=null),t}getResultPlainBox(t,e){let r=e.model.box;if(t){let i=t.model.box,n=new _e,s=r.bbox;n.ext1(s),n.ext1(i.bbox);let l=n.build().center(),c=r.layerId==3?e.rotation:-e.rotation,h=Ae.rotateZForPoint(l,-c),u=Ae.rotateZForPoint(l,c);i.transform(h),r.transform(h),r.leftLow=new S(i.leftLow.x,r.leftLow.y),r.leftUp=new S(i.leftUp.x,r.leftUp.y),r.rightLow=new S(i.rightLow.x,r.rightLow.y),r.rightUp=new S(i.rightUp.x,r.rightUp.y),i.transform(u),r.transform(u)}return r}getCounterBoreData(){let t=Qb.getInstance().counterBoresMap;return Array.from(t.values())}async getDiagram(){Pe.forceDeactive(!0),R.getInstance().forceDeactive=!0,ze.getSelects().length&&ze.clearSelect();let t=(await A.messageBus.rpcCall("exportPCBPng",{width:1920,height:1360})).message,e=t.data,r=null;if(e instanceof Uint8ClampedArray)r=e;else{r=new Uint8ClampedArray(t.width*t.height*4);for(let u in t.data)r[u]=t.data[u]}let i=document.createElement("canvas");i.width=t.width,i.height=t.height,i.getContext("2d").putImageData(new ImageData(r,t.width,t.height),0,0);let n=100,s=300*1024,a=null,l={quality:100,size:s},c={quality:10,size:0},h;for(;(!a||a.size>s)&&(h=i.toDataURL("image/webp",n),!(n<=c.quality));)l.quality=n,n=Math.floor((l.quality+c.quality)/2);return h}async downloadImage(t,e){let r=await this.canvas2Blob(t,"image/webp",e);xd.downloadFile("aaa",r)}canvas2Blob(t,e,r){return new Promise((i,n)=>{try{t.toBlob(s=>{i(s)},e,r/100)}catch(s){n(s)}})}getFPCCollect(){let t=[],e=Fi.getInstance().getAllItem(),r=Qi.getInstance().getAllItem(),i=vi.getInstance().getAllItem();for(let n of e)if(J0("FPC Stiffener",n.component,n.layerId)){let s=n.component,a={fpcModel:s.fpcModel,material:s.material,thickness:s.thickness,layerId:n.layerId};t.push(a)}for(let n of r)if(J0("FPC Stiffener",n.component,n.layerId)){let s=n.component,a={fpcModel:s.fpcModel,material:s.material,thickness:s.thickness,layerId:n.layerId};t.push(a)}for(let n of i)if(J0("FPC Stiffener",n.component,n.layerId)){let s=n.component,a={fpcModel:s.fpcModel,material:s.material,thickness:s.thickness,layerId:n.layerId};t.push(a)}return t}getCommentInfo(){let t={},e=Yr.plainCode;if(e){t.layerId=e.layerId,t.rotation=Yl(ve(e.rotation/Math.PI*180,3)),t.comment=e.value;let r=e.model.box,i=Eq(r,Yr.textUnit);t.commentBbox=i,t.commentSize=gG(e.textHeight,Yr.textUnit,e.textWidth),t.commentPosition={x:je(e.position.x,null,Yr.textUnit),y:je(e.position.y,null,Yr.textUnit)}}else t=null;return t}update(t){if(!R.getInstance().isactive||23==R.getInstance().doctype||this.lastCmd===t)return;this.lastCmd=t,gr.model=3,Ur.clearDrawTool(),uu.setTool(null);let e=this.tool.getNextTool();switch(di.setDraw(),di.dropDrag=!1,t){case"dropdrag":{this.tool.setNextTool(new Vc),ze.dragging=!1,ze.getSelects().length==0?di.setNonSelect():A.publish("flushSelectingInfo",""),di.dropDrag=!0;break}case"MeasureDistance":{let r=ze.getSelects(),i=new lG(r);i.drawing=!0,this.tool.setNextTool(i);break}}A.publish("refreshNextTool",""),A.publish("updateFrame","")}drawImage(t){Bp.getInstance().init(t),t.hasPosition?this.drawUL():Bp.getInstance().place(),A.publish("updateFrame","")}drawUL(){di.dropDrag=!1,this.lastCmd="PlaceQRCode",this.tool.interrupt();let t=Bp.getInstance();t.drawing=!0,this.tool.setNextTool(t),A.publish("refreshNextTool","")}drawTrueColorPicture(t){di.dropDrag=!1,this.lastCmd="DrawImage",this.tool.interrupt();let e=new aG(t);this.tool.setNextTool(e),A.publish("refreshNextTool","")}drawTrueColorPictureBySilkViewer(t){let{hashId:e,dataUrl:r}=t;if(qd.getItem(e))this.drawTrueColorPicture(t);else{let n=new Image;n.src=r,n.onload=()=>{qd.addTemplate(e,"aaa",n),this.drawTrueColorPicture(t)}}}drawCircleFPCStiffener(){di.dropDrag=!1,this.lastCmd="draw(CirFPCStiffener)",this.tool.interrupt();let t=new Vh("FPC Stiffener");t.drawing=!0,this.tool.setNextTool(t),A.publish("refreshNextTool",""),A.publish("updateFrame","")}drawRectFPCStiffener(){di.dropDrag=!1,this.lastCmd="draw(RectFPCStiffener)",this.tool.interrupt();let t=new Ac("FPC Stiffener");t.drawing=!0,this.tool.setNextTool(t),A.publish("refreshNextTool",""),A.publish("updateFrame","")}drawPolygonFPCStiffener(){di.dropDrag=!1,this.lastCmd="draw(PolyFPCStiffener)",this.tool.interrupt();let t=new hc("FPC Stiffener");t.drawing=!0,Ua.addTool(t),this.tool.setNextTool(t),A.publish("refreshNextTool",""),A.publish("updateFrame","")}updateFPCComponent(t){let e=ze.getSelects();if(e.length===0)return;let r=e[0];if(t.layerid!=null&&(r.layerId=t.layerid),t.material!=null){let i=t.material;td.correctMaterial(i,r.getComponent())}if(t.model!=null){let i=t.model;td.correctModel(i,r.getComponent())}if(t.thickness!=null){let i=+t.thickness;td.correctThickness(i,r.getComponent())}td.correctAllProps(r.getComponent()),A.publish("updateFrame","")}placeQRCode(t){di.dropDrag=!1,this.lastCmd="PlaceQRCode",this.tool.interrupt();let e=new Yr(t);this.tool.setNextTool(e),A.publish("refreshNextTool","")}placeQRCode1(t){if(t.imageData){let{position:e}=t.imageData;e&&Yr.placeQRCode(t.imageData)}if(t.textData){let{position:e}=t.textData;e&&Yr.placePlainCode(t.textData)}Yr.QRCode&&Yr.plainCode?(Ht.combination([Yr.QRCode,Yr.plainCode],"qr_code_group"),Yr.QRCode.rotation=t.imageData.qrCodeRotation,Yr.plainCode.rotation=t.textData.plainCodeRotation,Yr.textDirection=t.textData.textDirection,Yr.plainCode.position=Yr.getTextPosition(Yr.plainCode.position)):Yr.QRCode?Yr.QRCode.rotation=t.imageData.qrCodeRotation:Yr.plainCode&&(Yr.plainCode.rotation=t.textData.plainCodeRotation),A.publish("updateFrame",""),Yr.updateCodeInfo()}placeQRCodeBySilkViewer(t){if(Yr.clearAll(),t.imageData){let{hashId:e,dataUrl:r,base64:i}=t.imageData;if(qd.getItem(e))Yr.base64=i,t.imageData.position?this.placeQRCode1(t):this.placeQRCode(t);else{let s=new Image;s.src=r,s.onload=()=>{qd.addTemplate(e,"aaa",s),Yr.base64=i,t.imageData.position?this.placeQRCode1(t):this.placeQRCode(t)}}}else t.textData&&(t.textData.position?this.placeQRCode1(t):this.placeQRCode(t))}updateQRCodeSize(t){let{img:e,text:r}=t;if(e&&r){if(Yr.QRCode&&(Yr.QRCode.width=e.width,Yr.QRCode.height=e.height,Yr.imgWidth=e.width,Yr.imgHeight=e.height),Yr.plainCode){Yr.plainCode.fontSize=r.height,Yr.textHeight=r.height,Yr.textWidth=Yr.plainCode.textWidth;let i=Yr.getTextTopCenterByRotation(r.height);i&&(Yr.plainCode.position=i)}}else if(e){if(Yr.QRCode&&(Yr.QRCode.width=e.width,Yr.QRCode.height=e.height,Yr.imgWidth=e.width,Yr.imgHeight=e.height),Yr.plainCode){let i=Yr.getTextPosition();i&&(Yr.plainCode.position=i)}}else if(r&&Yr.plainCode){Yr.plainCode.fontSize=r.height,Yr.textHeight=r.height,Yr.textWidth=Yr.plainCode.textWidth;let i=Yr.getTextPosition();i&&(Yr.plainCode.position=i)}(Yr.QRCode||Yr.plainCode)&&A.messageBus.publish("updateCode",Yr.getCurrentCodeInfo()),gr.model=gr.model,A.publish("tool","dropdrag"),A.publish("updateFrame","")}updateRotation(t){switch(t.type){case 1:let e=Yr.QRCode,r=Yr.plainCode;if(e&&r){let n=Yr.QRCode.center;Yr.QRCode.rotation=t.angle.QRCodeAngle,Yr.plainCode.rotation=t.angle.plainCodeAngle+t.angle.QRCodeAngle,Yr.QRCode.center=n,Yr.plainCode.position=Yr.getTextPosition(Yr.plainCode.position)}else e?this.changeRotation(t.angle.QRCodeAngle,e):r&&this.changeRotation(t.angle.plainCodeAngle+t.angle.QRCodeAngle,r);(e||r)&&A.messageBus.publish("updateCode",Yr.getCurrentCodeInfo());break;case 2:let i=Bp.getInstance().image;i&&(this.changeRotation(t.angle,i),A.messageBus.publish("updateCode",Bp.getInstance().getCurrentULInfo()));break}gr.model=gr.model,A.publish("tool","dropdrag"),A.publish("updateFrame","")}updateTextDirection(t){let e=Yr.QRCode,r=Yr.plainCode;e&&r&&(Yr.textDirection=t,Yr.plainCode.position=Yr.getTextPosition(Yr.plainCode.position),Yr.updateCodeInfo(),A.publish("updateFrame",""))}changeRotation(t,e){let r=e.center;e.rotation=t,e.center=r}toggleCounterBoreLabelLayer(t){Qb.getInstance().onMouseWheel()}toggleQRCodeLayer(t){if(Yr.QRCode&&Yr.plainCode){let e=Yr.QRCode.center;Yr.QRCode.layerId=t,Yr.plainCode.layerId=t,Yr.QRCode.center=e,Yr.plainCode.position=Yr.getTextPosition(Yr.plainCode.position)}else{if(Yr.QRCode){let e=Yr.QRCode.center;Yr.QRCode.layerId=t,Yr.QRCode.center=e}Yr.plainCode&&(Yr.plainCode.layerId=t)}}};function gG(o,t,e,r){let i,n;if(e&&(i=je(e,null,t)),n=r?2:je(o,null,t),i&&n)return`${n}*${i}${t}`;if(n)return`${n}${t}`}function Eq(o,t){let{leftLow:e,leftUp:r,rightLow:i,rightUp:n}=o,s={x:je(e.x,null,t),y:je(e.y,null,t)},a={x:je(r.x,null,t),y:je(r.y,null,t)},l={x:je(i.x,null,t),y:je(i.y,null,t)},c={x:je(n.x,null,t),y:je(n.y,null,t)};return{leftDown:s,leftUp:a,rightDown:l,rightUp:c}}var ti=class ti extends ni{constructor(e){super();this.hashId="";this.lastText="";this.initialQRCodeRotation=0;this.initialPlainCodeRotation=0;this.start(),this.option="OPTIONLEFTUP";let{imageData:r,textData:i}=e;if(r){let{hashId:n,width:s,height:a,unit:l,qrCodeRotation:c}=r;this.hashId=n,ti.imgWidth=s,ti.imgHeight=a,ti.imgUnit=l,this.initialQRCodeRotation=c,this.drawing=!0}if(i){let{text:n,height:s,unit:a,plainCodeRotation:l,textDirection:c}=i;this.lastText=n,ti.textHeight=s,ti.textUnit=a,ti.textDirection=c||"bottom",this.initialPlainCodeRotation=l,this.drawing=!0}xo.setTool(this)}static placeQRCode(e){let{hashId:r,width:i,height:n,position:s,unit:a,layerId:l,rotation:c}=e,h=l||this.getLayer();ti.imgUnit=a,ti.imgWidth=i,ti.imgHeight=n;let u=new S(s.x,s.y);ti.QRCode=So.addImage(h,u,i,n,ut.defaultImage.rotation,!1,!1,r)}static placePlainCode(e){let{text:r,position:i,height:n,unit:s,layerId:a}=e;ti.textUnit=s,ti.plainCode=ri.addText(a||this.getLayer(),"",!1,r,!0,"\u5B8B\u4F53",n,ri.textAttr["attr-rotation"],!1,i,5,.8,!1,0,!1,void 0,"#ffffff"),ti.textHeight=n,ti.textWidth=ti.plainCode.textWidth}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY),i=[],n=new De("insert QRCode");ti.QRCode!=null&&(ti.QRCode.start=r,i.push(ti.QRCode),n.addCommand(Ce.dispatch(ti.QRCode,"add")),A.publish("hasModifyPcbItem",ti.QRCode),this.drawing=!1),ti.plainCode!=null&&(i.push(ti.plainCode),n.addCommand(Ce.dispatch(ti.plainCode,"add")),this.drawing=!1,A.publish("updateRtree","")),i.length&&(A.publish("onlySelect",i),ti.QRCode&&ti.plainCode&&Ht.combination([ti.QRCode,ti.plainCode],"qr_code_group")),n.length&&qe.executeCommand(n),A.messageBus.publish("updateCode",ti.getCurrentCodeInfo()),A.publish("flushService",""),A.publish("tool","dropdrag")}static updateCodeInfo(){function e(){setTimeout(()=>{if(ep.list.size==0){let r=ti.plainCode.textHeight;if(Math.abs(r-ti.textHeight)>1e-5){ti.plainCode.fontSize=ti.plainCode.fontSize/r*ti.textHeight,e();return}A.messageBus.publish("updateCode",ti.getCurrentCodeInfo())}else e()},5)}ti.plainCode?e():A.messageBus.publish("updateCode",ti.getCurrentCodeInfo())}static getCurrentCodeInfo(){let e={},r=ti.QRCode,i=ti.plainCode,n=Pe.getActiveLayerID();e.layerId=n,e.dataType=1,r&&(e.imgSize=gG(ti.imgHeight,ti.imgUnit,ti.imgWidth),e.qrCodeRotation=Yl(ve(-(r.rotation/Math.PI)*180,3)),e.img=ti.base64,e.imgPosition={x:je(r.start.x,null,ti.imgUnit),y:je(r.start.y,null,ti.imgUnit)}),i&&(e.textSize=gG(i.textHeight,ti.textUnit,i.textWidth),e.plainCodeRotation=Yl(ve(-(i.rotation/Math.PI)*180,3)),e.text=i.value,e.direction=ti.textDirection,e.textPosition={x:je(i.position.x,null,ti.textUnit),y:je(i.position.y,null,ti.textUnit)});let s=ti.checkQRCodePosVaild();return s&&(e.posCheckedInfo=s),!r&&!i&&(e=null),e}static checkQRCodePosVaild(){if(!PT.isChecked){console.warn("\u672A\u5F00\u542F\u4F4D\u7F6E\u68C0\u6D4B");return}let e=PT.outlineInfoForQRCode;if(!e)return console.log("\u5F00\u542F\u68C0\u6D4B\uFF0C\u4F46\u662F\u5E76\u6CA1\u6709\u83B7\u53D6\u5230\u76F8\u5173\u677F\u6846\u6570\u636E\uFF0C\u65E0\u6CD5\u8FDB\u884C\u68C0\u6D4B"),{posValid:!1,reason:"\u5F00\u542F\u68C0\u6D4B\uFF0C\u4F46\u662F\u5E76\u6CA1\u6709\u83B7\u53D6\u5230\u76F8\u5173\u677F\u6846\u6570\u636E\uFF0C\u65E0\u6CD5\u8FDB\u884C\u68C0\u6D4B"};let r=new _e,i=[1,3,5,58],n=[2,4,6,8],s,a;if(ti.QRCode!=null){let g=ti.QRCode.layerId;s=i.includes(g)||(n.includes(g)?!1:void 0),r.ext1(ti.QRCode.getMathGraphics(g,0).bbox())}if(ti.plainCode!=null){let g=ti.plainCode.layerId;a=i.includes(g)||(n.includes(g)?!1:void 0),r.ext1(ti.plainCode.getMathGraphics(g,0).bbox())}if(!r.valid())return console.log("\u672A\u68C0\u6D4B\u5230\u4E8C\u7EF4\u7801\u548C\u660E\u7801\u653E\u7F6E\u7684\u60C5\u51B5"),{posValid:!1,reason:"\u672A\u68C0\u6D4B\u5230\u4E8C\u7EF4\u7801\u548C\u660E\u7801\u653E\u7F6E\u7684\u60C5\u51B5"};let l=ti.QRCode&&ti.plainCode?"\u4E8C\u7EF4\u7801+\u660E\u7801":ti.QRCode?"\u4E8C\u7EF4\u7801":"\u660E\u7801",c=s!=null?s:a;c===void 0&&(console.warn("QRCode: \u4E8C\u7EF4\u7801\u6216\u660E\u7801\u540C\u65F6\u4E0D\u5B58\u5728\u4E8E\u9876\u5C42\u6216\u5E95\u5C42"),c=!0);let h=r.build(),u=e.bbox().area(),d=Math.abs(e.area(.1));if(u===d){if(!e.bbox().isContainsBBox(h))return console.log(`\u68C0\u6D4B\u5230${l}\u4E0D\u5728\u677F\u6846\u5185`),{posValid:!1,reason:`\u68C0\u6D4B\u5230${l}\u4E0D\u5728\u677F\u6846\u5185`}}else{let y=hP([Cl.INTERSECT,e,ge.build6(h)]).bbox().area();if(y!==h.area()||ne.eq(y,d))return console.log(`\u68C0\u6D4B\u5230${l}\u4E0D\u5728\u677F\u6846\u5185`),{posValid:!1,reason:`\u68C0\u6D4B\u5230${l}\u4E0D\u5728\u677F\u6846\u5185`}}let p=c?[3,5,12]:[4,6,12],m=kt.searchByLayers(h,p).getAllItems().filter(g=>g===ti.QRCode||g===ti.plainCode?!1:g instanceof Pr&&g.layerId===12?PT.coverOil:!!g.getParent());if(m.length>=1){let g=ge.buildBBox(h).primitives;for(let y of m){let P=function(){return console.log(`${l}\u68C0\u6D4B\u4F4D\u7F6E\u4E0D\u901A\u8FC7, \u4E0E\u5176\u5B83\u56FE\u5143\u5B58\u5728\u91CD\u53E0`,b),{posValid:!1,reason:`${l}\u68C0\u6D4B\u4F4D\u7F6E\u4E0D\u901A\u8FC7, \u4E0E\u5176\u5B83\u56FE\u5143\u5B58\u5728\u91CD\u53E0`}},b=y;if(b instanceof mt||b instanceof _t){let T=b.width/2,I=b.primitive;if(h.extendOfSize(T).isContainsBBox(I.bbox()))return P();for(let C of g)if(er.getMinDistance(C,I)<=T)return P()}else return P()}}return console.log(`${l}\u4F4D\u7F6E\u68C0\u6D4B\u901A\u8FC7`),{posValid:!0,reason:`${l}\u4F4D\u7F6E\u68C0\u6D4B\u901A\u8FC7`}}onMouseMove(e){if(this.drawing){let r=new S(e.sceneX,e.sceneY);if(this.hashId)if(ti.QRCode!=null)ti.QRCode.layerId!=ti.getLayer()&&(ti.QRCode.layerId=ti.getLayer()),ti.QRCode.start=r;else{let{hashId:i}=this,n=ti.getLayer(),s=this.initialQRCodeRotation;ti.QRCode=So.addImage(n,r,ti.imgWidth,ti.imgHeight,s,!1,!1,i)}if(this.lastText)if(ti.plainCode!==null)ti.plainCode.layerId!=ti.getLayer()&&(ti.plainCode.layerId=ti.getLayer()),ti.textWidth=ti.plainCode.textWidth,ti.plainCode.position=ti.getTextPosition(r);else{let i=ti.getTextPosition(r,ti.textHeight);this.createText(i,void 0,void 0,ti.textHeight),ti.textWidth=ti.plainCode.textWidth,ti.plainCode.position=ti.getTextPosition(r,ti.textHeight)}}}static getTextPosition(e,r=(i=>(i=ti.plainCode)==null?void 0:i.height)()){let n=e;return ti.QRCode&&(ti.plainCode&&(r=yje(ti.QRCode.width,ti.plainCode),ti.plainCode.fontSize=r,ti.textHeight=r,ti.textWidth=ti.QRCode.width),n=this.getTextTopCenterByRotation(r)),n}static getTextTopCenterByRotation(e){var y,b;let r,i=ti.QRCode.height,n=ti.QRCode.rotation,s=n/Math.PI*180+360||0,a=((y=ti.plainCode)==null?void 0:y.rotation)/Math.PI*180+360+s||0,l=((b=ti.plainCode)==null?void 0:b.model.box.width)||ti.textWidth,c=(i+(a%360%180===0?l:e))/2,h=(i+(a%360%180===0?e:l))/2,u=ti.QRCode.center,d=ti.textDirection,p=is(ti.QRCode.layerId),m=Bs.conversion("mm","mil",.3)/10;switch(d){case"top":r=Ae.translate(-u.x,-u.y,0).rotateZ(-n).translate1(0,m+h,0).rotateZ(p?-n:n).translate1(u.x,u.y,0);break;case"bottom":r=Ae.translate(-u.x,-u.y,0).rotateZ(-n).translate1(0,-(m+h),0).rotateZ(p?-n:n).translate1(u.x,u.y,0);break;case"left":r=Ae.translate(-u.x,-u.y,0).rotateZ(-n).translate1(p?m+c:-(m+c),0,0).rotateZ(p?-n:n).translate1(u.x,u.y,0);break;case"right":r=Ae.translate(-u.x,-u.y,0).rotateZ(-n).translate1(p?-(m+c):m+c,0,0).rotateZ(p?-n:n).translate1(u.x,u.y,0);break;default:break}return u.multiply4(r)}static clearAll(){ti.QRCode!==null&&(ti.QRCode.remove(),A.publish("delete",ti.QRCode),ti.QRCode=null,A.publish("flushService","")),ti.plainCode!==null&&(ti.plainCode.remove(),A.publish("delete",ti.plainCode),ti.plainCode=null,A.publish("updateRtree",""))}interrupt(){ti.QRCode!==null&&(ti.QRCode.remove(),A.publish("delete",ti.QRCode),ti.QRCode=null,A.publish("flushService",""),this.drawing=!1),ti.plainCode!==null&&(ti.plainCode.remove(),A.publish("delete",ti.plainCode),this.drawing=!1,ti.plainCode=null,A.publish("updateRtree","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}static getLayer(){let e=Pe.getActiveLayer();switch(e.layerID){case 3:case 4:case 13:return e.layerID;default:return 3}}createText(e,r="\u5B8B\u4F53",i=ri.textAttr["attr-text-stroke-width"],n=ri.textAttr["attr-text-size"]){ti.plainCode=ri.addText(ti.getLayer(),"",!1,this.lastText,!0,r,n,this.initialPlainCodeRotation,!1,e,5,i,ri.textAttr["attr-reversed-phase"],ri.textAttr["attr-reversed-phase-extend"],ri.textAttr["attr-mirror"],void 0,"#ffffff")}};ti.QRCode=null,ti.plainCode=null;var Yr=ti;var Mhe=class{constructor(t,e,r){this.via=new d3;this.pad=new mx;this.line=new vx;this.arc=new xx;this.poly=new Rx;this.fill=new p3;this.fpcFill=new jx;this.region=new Dx;this.partition=new qx;this.copper=new Xx;this.image=new wx;this.obj=new Vx;this.tear=new Lx;this.font=new sA;this.str=new f3;this.attr=new YP;this.inner=new uA;this.dimension=new Mx;this.dimensionAttr=new Nx;this.component=new m3;this.padNet=new g3;this.shell=new kx;this.shellEntity=new Gx;this.crease=new Bx;this.boss=new Fx;this.source=!1;this.version=t,this.doctype=e,this.compiler=r,this.format=new Ib().getConfig(t),this.compiler==null&&(this.encoder=new ZJ(R.getInstance().id))}get ignorePartitionId(){return this.doctype!=3}saveCommonData(){this.feed("CANVAS"),Ze.getInstance().getAllItem().forEach(D=>{this.feed("LAYER",D)}),Ze.getInstance().getLayerPhys().forEach(D=>{this.feed("LAYER_PHYS",D)}),this.feed("ACTIVE_LAYER");let r=re.getInstance(),i=r.getAllSafeSpacing(),n=r.getAllOtherSpacing(),s=r.getAllTrackPhysics(),a=r.getAllNetLengthPhysics(),l=r.getAllNetLengthTolerancePhysics(),c=r.getAllDifferentialPhysics(),h=r.getAllBlindPhysics(),u=r.getAllRadiusPhysics(),d=r.getAllInnerPlane(),p=r.getAllCopperPlane(),m=r.getAllPasteExpansion(),g=r.getAllSolderExpansion(),y=r.getAllAutoRouterRules(),b=r.getAllNetClass(),P=r.getAllNets(),T=r.getAllNetDifferentials(),I=r.getAllEqualLengthGroups(),C=r.getAllPadsPairGroups(),E=r.getAllRegions(),O=r.getAllCreepageSpacing();P.forEach(D=>{this.feed("NET",D)}),this.feed("RULE_TEMPLATE"),i.forEach(D=>{this.feed("RULE",D)}),n.forEach(D=>{this.feed("RULE",D)}),O.forEach(D=>{this.feed("RULE",D)}),s.forEach(D=>{this.feed("RULE",D)}),a.forEach(D=>{this.feed("RULE",D)}),l.forEach(D=>{this.feed("RULE",D)}),c.forEach(D=>{this.feed("RULE",D)}),h.forEach(D=>{this.feed("RULE",D)}),u.forEach(D=>{this.feed("RULE",D)}),d.forEach(D=>{this.feed("RULE",D)}),p.forEach(D=>{this.feed("RULE",D)}),m.forEach(D=>{this.feed("RULE",D)}),g.forEach(D=>{this.feed("RULE",D)}),y.forEach(D=>{this.feed("RULE",D)}),C.forEach(D=>{this.feed("EQLEN_GRP",D)});let _=[];C.forEach(D=>{D.details.forEach(w=>{_.push(w)})}),_.forEach(D=>{this.feed("EQLEN",D)}),b.forEach(D=>{this.feed("RULE_SELECTOR",D)}),P.forEach(D=>{this.feed("RULE_SELECTOR",D)}),T.forEach(D=>{this.feed("RULE_SELECTOR",D)}),I.forEach(D=>{this.feed("RULE_SELECTOR",D)}),r.betweenNetRule.rule.forEach(D=>{this.feed("RULE_SELECTOR",D)}),E.forEach(D=>{this.feed("RULE_SELECTOR",D)}),this.getPrimitives().forEach(D=>{this.feed("PRIMITIVE",D)}),this.feed("SILK_OPTS",Ze.getInstance().getLayer(3)),this.feed("SILK_OPTS",Ze.getInstance().getLayer(4))}getFile(){return this.encoder.getDataStr()}getItems(t){return this.feedItems(t),this.getFile()}feed(t,e){let r=this.getItemFormat(t),i=this.getEncode(t),n={};for(let s of r)this.ignorePartitionId&&s=="partitionId"||(n[s]=this.getData(s,i,e));return this.upload2Compiler(t,n,e),this.uploadSource(t,n,e),n}feedFromGerber(t,e){let r=this.getItemFormat(t),i=this.getEncode(t),n={};for(let s of r)this.ignorePartitionId&&s=="partitionId"||(n[s]=this.getData(s,i,e));this.uploadSource(t,n,e)}feedItem(t){let e=this.getFileType(t);this.feed(e,t)}feedCopper(t){let e=new Map,r,i=[];for(let n of t)r=n.getParent().globalIndex,i=e.get(r),i||(i=[],e.set(r,i)),i.push(n);e.forEach((n,s)=>{this.feed("POURED",n)})}feedInner(t){let e=new Map,r,i=[];for(let n of t)r=n.layerId,i=e.get(r),i||(i=[],e.set(r,i)),i.push(n);e.forEach((n,s)=>{this.feed("INNER",n)})}feedComponent(t){this.feed("COMPONENT",t);let e=t.attributes,r=!0;for(let s of e)s.key=="Device"&&(r=!1),$d(s,t)&&this.feed("ATTR",s);if(r)throw new Error("The device is missing device attributes, saving will lead to data loss, please contact the official customer service in time!");t.getPads().forEach(s=>{this.feed("PAD_NET",s)}),t.getItems().filter(s=>s instanceof Ct).forEach(s=>{this.feed("PAD_NET",s)})}feed4Type(t){switch(t){case"CANVAS":return this.feed(t);case"ACTIVE_LAYER":return this.feed(t);default:break}}feedItems(t){t.forEach(e=>{if(e.getParent()==null){let r=this.getFileType(e);this.feed(r,e)}})}feedPanelize(){let t=si.getInstance(),e=JSON.parse(JSON.stringify(t.getDefaultPanelize()));this.feed("PANELIZE",e)}getFileType(t){if(t instanceof zr)return"LINE";if(t instanceof et)return"PAD";if(t instanceof Ct)return"VIA";if(t instanceof Ii)return"ARC";if(t instanceof or)switch(t.type){case"Line":case"Board Outline":return"POLY";case"Fill Region":case"Slot Region":return"FILL";case"TearDrop":return"TEARDROP";case"FPC Stiffener":return"FPC_FILL";case"Prohibited Region":case"Constraint Region":return"REGION";case"Partition":return"PARTITION";case"Copper Region":return"POUR";case"3D Shell - Outline":return"SHELL";case"3D Shell - Screw Pillar":return"BOSS";case"3D Shell - Side Datum Line":return"CREASE";case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":return"SHELL_ENTITY"}else{if(t instanceof Li)return t.key!=""?"ATTR":"STRING";if(t instanceof Ap)return"DIMENSION";if(t instanceof Am)return"DIMENSION";if(t instanceof _m)return"DIMENSION";if(t instanceof Bi)return"COMPONENT";if(t instanceof Dl)return"IMAGE";if(t instanceof Ff)return"OBJ";if(t instanceof lS)return"GROUP";if(t instanceof yn)return"FILL";if(t instanceof hn)return"POURED";throw new Error("not support this shape:"+t)}}getItemFormat(t){return this.format[t]}getEncode(t){switch(t){case"VIA":return this.via;case"PAD":return this.pad;case"LINE":return this.line;case"ARC":return this.arc;case"POLY":return this.poly;case"FILL":return this.fill;case"FPC_FILL":return this.fpcFill;case"REGION":return this.region;case"PARTITION":return this.partition;case"POURED":return this.copper;case"IMAGE":return this.image;case"OBJ":return this.obj;case"TEARDROP":return this.tear;case"FONT":return this.font;case"STRING":return this.str;case"ATTR":return this.attr;case"DIMENSION":return this.dimension;case"COMPONENT":return this.component;case"PAD_NET":return this.padNet;case"SHELL_ENTITY":return this.shellEntity;case"SHELL":return this.shell;case"CREASE":return this.crease;case"BOSS":return this.boss}}getData(t,e,r){return e.getData(t,r)}getPrimitives(){return["ALL","COMPONENT","PROPERTY","COMPONENTSILK","TRACK","VIA","TESTPOINT","PAD","PADSPAIR","NETWORK","SUTUREHOLE","TEARDROP","RATLINE","GROUP","TEXT","IMAGE","PICTURE","DIMENSION","BOARDOUTLINE","SLOTREGION","FILLREGIEN","COPPEROUTLINE","COPPERFILLED","PROHIBITEDREGION","CONSTRAINT","PARTITION","LINE","LOCKED","UNLOCKED","SHELL","BOSS","CREASE","TOPSHELLCUT","SIDESHELLCUT","TOPBOTTOMENTITY","SIDEENTITY","FPC_STIFFENER"]}uploadSource(t,e,r){var i;if(this.encoder!=null)switch(t){case"CANVAS":return this.encoder.uploadCanvas(e);case"LAYER":return this.encoder.uploadLayer(r.layerId,e);case"LAYER_PHYS":return this.encoder.uploadLayerPhys(r.layerId,e);case"ACTIVE_LAYER":return this.encoder.uploadActiveLayer(e);case"NET":return this.encoder.uploadNet(r.name,e);case"PRIMITIVE":return this.encoder.uploadPrimitive(r,e);case"GROUP":return this.encoder.uploadGroup(r.globalIndex,e);case"VIA":return this.encoder.uploadVia(r.globalIndex,e);case"PAD":return this.encoder.uploadPad(r.globalIndex,e);case"LINE":return this.encoder.uploadLine(r.globalIndex,e);case"ARC":case"CARC":return this.encoder.uploadArc(r.globalIndex,e);case"POLY":return this.encoder.uploadPoly(r.globalIndex,e);case"FILL":return this.encoder.uploadFill(r.globalIndex,e);case"FPC_FILL":return this.encoder.uploadFpcFill(r.globalIndex,e);case"REGION":return this.encoder.uploadRegion(r.globalIndex,e);case"PARTITION":return this.encoder.uploadPartition(r.globalIndex,e);case"POUR":return this.encoder.uploadPour(r.globalIndex,e);case"POURED":return this.encoder.uploadPoured((i=r[0])==null?void 0:i.getParent().globalIndex,e);case"IMAGE":return this.encoder.uploadImage(r.globalIndex,e);case"OBJ":return this.encoder.uploadObj(r.globalIndex,e);case"TEARDROP":return this.encoder.uploadTeardrop(r.globalIndex,e);case"STRING":return this.encoder.uploadString(r.globalIndex,e);case"ATTR":return this.encoder.uploadAttr(r.globalIndex,e);case"DIMENSION":return this.encoder.uploadDimension(r.globalIndex,e);case"COMPONENT":return this.encoder.uploadComponent(r.globalIndex,e);case"PAD_NET":return this.encoder.uploadPadNet(e);case"RULE_TEMPLATE":return this.encoder.uploadRuleTemplate(e);case"RULE":return this.encoder.uploadRule(e);case"RULE_SELECTOR":return this.encoder.uploadRuleSelector(e);case"EQLEN_GRP":return this.encoder.uploadEQLenGrp(r.number,e);case"SHELLCUT":return this.encoder.uploadShellCut(r.globalIndex,e);case"SHELL_ENTITY":return this.encoder.uploadShellEntity(r.globalIndex,e);case"SHELL":return this.encoder.uploadShell(r.globalIndex,e);case"CREASE":return this.encoder.uploadCrease(r.globalIndex,e);case"BOSS":return this.encoder.uploadBoss(r.globalIndex,e);case"PANELIZE":return this.encoder.uploadPanelize(e);case"SILK_OPTS":return this.encoder.uploadSilkOpts(r.layerId,e);case"PREFERENCE":return this.encoder.uploadPreference(e);case"INNER":return this.encoder.uploadLayerFill(r[0].layerId,e)}}upload2Compiler(t,e,r){var n,s;if(this.compiler==null)return;let i=this.doctype!=3;switch(t){case"PAD":{(i||r.getParent()==null)&&this.compiler.uploadPad(r.globalIndex,e);break}case"POLY":{(i||r.getParent()==null)&&this.compiler.uploadPoly(r.globalIndex,e);break}case"POUR":{(i||r.getParent()==null)&&this.compiler.uploadPour(r.globalIndex,e);break}case"POURED":{((s=(n=r[0])==null?void 0:n.getParent())==null?void 0:s.globalIndex)!=null&&this.compiler.uploadPour(r.globalIndex,e);break}case"INNER":{e[0]&&this.compiler.uploadLayerFill(e[0].layerId,e);break}case"FILL":{(i||r.getParent()==null)&&this.compiler.uploadFill(r.globalIndex,e);break}case"FPC_FILL":{(i||r.getParent()==null)&&this.compiler.uploadFpcFill(r.globalIndex,e);break}case"REGION":{(i||r.getParent()==null)&&this.compiler.uploadRegion(r.globalIndex,e);break}case"PARTITION":{this.compiler.uploadPartition(r.globalIndex,e);break}case"ARC":{(i||r.getParent()==null)&&this.compiler.uploadArc(r.globalIndex,e);break}case"LINE":{(i||r.getParent()==null)&&this.compiler.uploadLine(r.globalIndex,e);break}case"VIA":{(i||r.getParent()==null)&&this.compiler.uploadVia(r.globalIndex,e);break}case"STRING":{(i||r.getParent()==null)&&this.compiler.uploadString(r.globalIndex,e);break}case"ATTR":{this.compiler.uploadAttr(r.globalIndex,e);break}case"FONT":this.compiler.uploadFont(e);break;case"IMAGE":{(i||r.getParent()==null)&&this.compiler.uploadImage(r.globalIndex,e);break}case"OBJ":{(i||r.getParent()==null)&&this.compiler.uploadObj(r.globalIndex,e);break}case"DIMENSION":{(i||r.getParent()==null)&&this.compiler.uploadDimension(r.globalIndex,e);break}case"DIMENSIONATTR":{this.compiler.uploadAttr(r.globalIndex,e);break}case"LAYER":{this.compiler.uploadLayer(r.layerId,e);break}case"LAYER_PHYS":{this.compiler.uploadLayerPhys(r.layerId,e);break}case"ACTIVE_LAYER":{this.compiler.uploadActiveLayer(e);break}case"COMPONENT":{this.compiler.uploadComponent(r.globalIndex,e);break}case"CANVAS":{this.compiler.uploadCanvas(e);break}case"PAD_NET":{this.compiler.uploadPadNet(e);break}case"PRIMITIVE":{this.compiler.uploadPrimitive(r,e);break}case"GROUP":{this.compiler.uploadGroup(r.globalIndex,e);break}case"NET":{this.compiler.uploadNet(r,e);break}case"TEARDROP":{this.compiler.uploadTeardrop(r.globalIndex,e);break}case"FONT":break;case"RULE_TEMPLATE":{this.compiler.uploadRuleTemplate(e);break}case"RULE":{this.compiler.uploadRule(e);break}case"RULE_SELECTOR":{this.compiler.uploadRuleSelector(e);break}case"SHELL":{this.compiler.uploadShell(r.globalIndex,e);break}case"CREASE":{this.compiler.uploadCrease(r.globalIndex,e);break}case"SHELLCUT":{this.compiler.uploadShellCut(r.globalIndex,e);break}case"SHELL_ENTITY":{this.compiler.uploadShellEntity(r.globalIndex,e);break}case"BOSS":{this.compiler.uploadBoss(r.globalIndex,e);break}case"PANELIZE":{this.compiler.uploadPanelize(e);break}case"SILK_OPTS":{this.compiler.uploadSilkOpts(r.layerId,e);break}case"EQLEN":case"EQLEN_GRP":{this.compiler.uploadEQLenGrp(r.number,e);break}case"PREFERENCE":{this.compiler.uploadPreference(e);break}default:break}}};function ED(o,t,e){let r=new Mhe("2.0",t),i=e!=null?e:r.getFileType(o),n=r.feed(i,o);return new vm().parse(i,n,1,o.globalIndex,o.number)}function vq(o){if(o instanceof xi)switch(o.modelType){case"Pad":case"Via":return"PAD_NET";case"Text":return o instanceof Li&&o.key!=""?"ATTR":null;default:return null}return null}function xq(o,t,e,r,i=!0){if(e==null)return null;switch(e){case"ATTR":return $d(o,r,i)?ED(o,t,e):null;default:return ED(o,t,e)}}function $Ee(o,t,e){let r=Tu.getInstance().getItem(t.deviceUUID);if(r!=null&&(r.overlapValue(o),e)){let i=t.attrKeyValue[o.key];i!=null&&i!=o.value&&o.key!="Name"&&(o.value=i)}}function bje(o,t){switch(t.modelType){case"Via":return o.deleteVia(t.globalIndex);case"Pad":return o.deletePad(t.globalIndex);case"Track":return o.deleteLine(t.globalIndex);case"ArcTrack":return o.deleteArc(t.globalIndex);case"Image":return o.deleteImage(t.globalIndex);case"Picture":return o.deleteObj(t.globalIndex);case"Text":return t.key!=""?o.deleteAttr(t.globalIndex):o.deleteString(t.globalIndex);case"Length Dimension":case"Protractor Dimension":case"Radius Dimension":return o.deleteDimension(t.globalIndex);case"Component":return o instanceof bW?o.deleteComponent(t.globalIndex):void 0;case"Rect":case"Circle":case"Polygon":{let e=t,r=e.type,i=e.globalIndex;switch(r){case"Board Outline":case"Line":return o.deletePoly(i);case"Fill Region":case"Slot Region":return o.deleteFill(i);case"Prohibited Region":case"Constraint Region":return o.deleteRegion(i);case"Copper Region":return o.deletePour(i);case"Partition":return o instanceof bW?o.deletePartition(i):void 0;case"TearDrop":return o.deleteTeardrop(i);case"FPC Stiffener":return o.deleteFpcFill(i);case"3D Shell - Outline":return o.deleteShell(i);case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":return o.deleteShellEntity(i);case"3D Shell - Side Datum Line":return o.deleteCrease(i);case"3D Shell - Screw Pillar":return o.deleteBoss(i);case"Board":return o.deleteBoard()}}default:console.warn(`deleteUpload: \u672A\u77E5\u7684 modelType ${t.modelType}`);break}}function Nhe(o,t,e,r){let i=t instanceof et||t instanceof Ct;o.deleteItem(t);let n=o.getComponents();for(let s of n){i&&s.initPadNet();let a=s.globalIndex+t.globalIndex,l=eA(t.modelType,a);if(l==null&&t instanceof Li&&t.key!=""&&(l=s.attrKeyText[t.key]),l!=null)if(l instanceof Li&&l.key!=""){let c=vq(l);if(xq(l,3,c,s,!1)==null&&l.key!="Device"&&l.key!="Footprint"){let u=null;s.attrKeyValue[l.key]!=t.value&&(u=s.attrKeyValue[l.key]),e(t,a),u!=null&&s.addATTRMap(l.key,u)}}else e(t,a);s.initBox(),r(s.modelType,s.globalIndex,t)}t instanceof Li&&t.key!=""&&o.deleteAttrDecode(t.key)}var Pje=new RegExp(/(_([0-9]+))$/),yG=class extends oD{constructor(t){super(),this.footprint=t,this.origin=t.origin}build(){let t=this.footprint.getComponents(),{restoreMap:e,moveMap:r}=this.getMatrixMap();for(let i of this.models){if(this.footprint.getModelBy(i.modelType,i.globalIndex)==null){this.footprint.addItem(i);for(let s of t)s.initBox(),this.updateShape(QP(s.modelType,s.globalIndex))}else{this.footprint.updateBBox();for(let s of t)s.initBox()}for(let s of t){let a=s.globalIndex+i.globalIndex,l=eA(i.modelType,a);l==null&&i instanceof Li&&i.key!=""&&(l=s.attrKeyText[i.key]);let c;if(l==null){l=this.footprint.clone(i,a),l instanceof Li&&l.key!=""&&$Ee(l,s,!0);let h=r.get(s);l.transform(h),1!==s.layerId&&s.flipShape(l),l.globalIndex=a,this.bindParent(l,s)}else{this.updateTearDropInfo(l.modelType,a,"modify");let h=s.layerId!=1;h&&s.flipShape(l);let u=e.get(s);if(l.transform(u),!this.update4Template(i,l)){let p=vq(l),m=xq(l,3,p,s),g=this.map.get(i);g.model=l,g.load(),m!=null?(m instanceof yx&&(m.parentModel=s),m.model=l,m.load()):p=="ATTR"&&$Ee(l,s,!1)}let d=r.get(s);l.transform(d),h&&s.flipShape(l),l instanceof Li&&l.key!=""&&s.modifyATTRMap(l.key,l.value),c=QP(l.modelType,a)}this.updateShape(c),this.refreshComponentItemStatus(s)}if(i instanceof Li&&(i.outlineModified=!1),i instanceof Li&&i.key!=""){let s=this.map.get(i);if(s!=null&&this.footprint.updateAttrDecode(s),i.key==="Footprint"&&i.value!=this.footprint.id){this.footprint.id=i.value;for(let a of t){a.modifyATTRMap("Footprint",i.value);let l=a.attrKeyText.Footprint;l&&(l.value=i.value);let c=QP("Component",a.globalIndex);c&&he.publish("hasModifyPcbItem",c)}}}}for(let[,i]of this.layers)this.footprint.updateLayer(i);Og.historyFlushService(),this.clear()}update4Template(t,e){if(!MM.isRender4GPU)return!1;switch(t.modelType){case"Pad":return e.model=t,e.updateShapeData(),!0;case"Via":return e.model=t,e.updateShapeData(),!0;case"Image":return e.model=t,e.updateShapeData(),!0;case"Picture":return e.model=t,e.updateShapeData(),!0;case"Polygon":{let r=e,i=r.childrens;for(let s of i)for(let a of s)a.remove();r.model=t,r.updateShapeData();let n=[];for(let s of t.childrens){let a=new Array;for(let l of s)if(l instanceof hs){let c=new DB(l.globalIndex,l,r);a.push(c)}else if(l instanceof Va){let c=new wB(l.globalIndex,l,r);a.push(c)}n.push(a)}return r.childrens=n,!0}case"Rect":return e.model=t,e.updateShapeData(),!0;case"Circle":return e.model=t,e.updateShapeData(),!0;case"Text":return t.key!=""?!1:(e.model=t,e.updateShapeData(),!0);default:return!1}}getModelBy(t,e){return this.footprint.getModelBy(t,e)}getCombination(t){}addCombination(t){}getCanvas(){return this.footprint}updateOrigin(){let t=this.footprint.getComponents(),e=this.origin.sub(this.footprint.origin),r=Ae.translate(e.x,e.y,0),{restoreMap:i,moveMap:n}=this.getMatrixMap(),s=this.footprint.getItems();for(let a of t){let l=i.get(a),c=n.get(a);for(let[,h]of s){let u=a.globalIndex+h.globalIndex,d=eA(h.modelType,u);if(d==null&&h instanceof Li&&h.key!=""&&(d=a.attrKeyText[h.key]),d==null)continue;this.updateTearDropInfo(d.modelType,u,"modify");let p=a.layerId!=1;if(p&&a.flipShape(d),d.transform(l),!this.update4Template(h,d))if(d instanceof Li&&d.key!=""){let g=vq(d);xq(d,3,g,a)==null&&d.transform(r)}else d.transform(r);d.transform(c),p&&a.flipShape(d);let m=QP(d.modelType,u);this.updateShape(m)}a.initBox(),this.refreshComponentItemStatus(a)}Og.historyFlushService(),this.clear(),this.origin=this.footprint.origin}bindParent(t,e){let r=Xc(t),i=QP("Component",e.globalIndex);i!=null&&r.getParent()==null&&(r instanceof lr&&r.key!=""?i.addAttribute(r):(r instanceof Le&&e.isCachePadNet()&&(r.net=i.getNet(r.num,r.globalIndex)),i.addCompositionItem(r)))}refreshComponentItemStatus(t){let e=QP("Component",t.globalIndex);e&&(e.updateView=!1)}updateTearDropInfo(t,e,r){let i=QP(t,e);(i instanceof Le||i instanceof Ir||i instanceof yi||i instanceof Ue)&&he.publish("cheakTearDrop",new zf(r,i.toJSON(),i))}updateShape(t){t!=null&&(NV(t),this.addGroup(t),t.refreshRender(),he.publish("hasModifyPcbItem",t))}getMatrixMap(){let t=this.footprint.getComponents(),e=this.footprint.origin,r=new Map,i=new Map;for(let n of t){let s=n.layerId==2?(Math.PI-n.rotation)%kr:n.rotation,a=Ae.translate(-e.x,-e.y,0).rotateZ(s).translate1(n.position.x,n.position.y,0),l=Ae.translate(-n.position.x,-n.position.y,0).rotateZ(-s).translate1(e.x,e.y,0);r.set(n,l),i.set(n,a)}return{restoreMap:r,moveMap:i}}addGroup(t){let e=t.model.getGroupID();if(e!=null){let r=Ht.getItem(e);if(r==null)r=Ht.rebuild(e,[t]);else if(r.addItem(t),t instanceof ke&&t.attrsMap["Reuse Block"]==null){let i=r.name;i!=null&&Pje.test(i)&&(t.reuseBlock=i.replace(Pje,""),t.combinationID==""&&(t.combinationID=i.replace(t.reuseBlock+"_","")))}}}getLayer(t){return null}addNet(t){}getLayerPhy(t){}getNetModel(t){}deleteModel(t){super.deleteModel(t),Nhe(this.footprint,t,iE,(e,r,i)=>{this.updateShape(QP(e,r))}),t instanceof Li&&t.key!=""&&this.footprint.deleteAttrDecode(t.key)}deleteLayer(t){super.deleteLayer(t),this.footprint.deleteLayer(t)}};var Rq=class extends ro{constructor(e,r,i){super();this.changeList=new Array;this.changes=new Map;this.footprint=e,this.action=r;for(let[n,s]of i){if(n!="add"){let a=s.clone();this.changes.set(s.globalIndex,a)}this.changeList.push([n,s.globalIndex])}}snapshotModel(e){let r=ED(e,4);return r.clearFootExcludeProps(),this.extractData(r)}extractData(e){let r={},i=e;for(let n of Object.keys(e)){let s=i[n];typeof s!="function"&&(r[n]=s)}return r}applyData(e,r){if(!r)return;let i=ED(e,4);i.model=e;let n=i;for(let s of Object.keys(r))s in i&&(n[s]=r[s]);i.load()}rebuild(){Ji.getInstance().getItem(this.footprint)!=null&&this.modify()}remove(){this.modify()}modify(){let e=Ji.getInstance().getItem(this.footprint),r=new Array,i=new Map;for(let[n,s]of this.changeList){let a=this.changes.get(s),l=e.getItems().get(s);switch(n!="add"&&a==null&&console.error("Custom footprint shape lossed!!!"),n){case"add":{i.set(s,l.clone()),r.push(["delete",s]),e.deleteItem(l),Nhe(e,l,iE,(c,h,u)=>{let d=QP(c,h);d!=null&&(NV(d),d.refreshRender(),A.publish("hasModifyPcbItem",d))});break}case"modify":{let c=this.snapshotModel(a);r.push(["modify",s]),i.set(s,l.clone()),this.applyData(l,c);break}default:{r.push(["add",s]);let c=ED(a,4),h=new yG(e);h.addModel(a.clone(),c),h.build();break}}}r.reverse(),this.changeList=r,this.changes=i}getItem(){return"ignore"}async upload(e=!1){let r=Ji.getInstance().getItem(this.footprint);if(r==null)return;let i=r.getInstance(),n=new Qd("2.0",4,i);for(let[s,a]of this.changeList)if(s!="delete"){let l=r.getItems().get(a);n.feedItem(l)}else{let l=this.changes.get(a);bje(i,l)}i==null||i.save()}updateData(){}};var ff=class{constructor(){this.refreshService=!1}async updateCustomFootprint(t,e,r){let i=Ji.getInstance().getItem(t.footprintUUID),n=i.getOrigin(),s=t.layerId;t.layerId=1;let a=t.position,l=t.rotation,c=Ae.translate(-a.x,-a.y,0).rotateZ(-l).translate1(n.x,n.y,0),h=Ae.translate(-n.x,-n.y,0).rotateZ(l).translate1(a.x,a.y,0);t.transform(c);let u="modify",d=new Array;if(!(i instanceof Sc)){let p=R.getInstance().id+"_"+t.globalIndex,m=Ji.getInstance().getItem(p);m!=null&&(await m.destroy(),Ji.getInstance().deleteById(p)),u="add";let g=await Ji.getInstance().cloneFootprint(i,p);if(g){t.footprintUUID=p,g.add(t.model),i.delete(t.model),g.modifyName(t.name,t.name),i=g,this.saveCommonData(i,n);let y=new Qd("2.0",pi.PCB,R.getInstance().compiler);R.getInstance().compiler.setTicket(),y.feedItem(t.attrKeyText.Footprint.model)}}this.generateFootprint(t,i,d,r),t.transform(h),t.layerId=s,e!=null&&!(u=="modify"&&d.length==0)&&e.addCommand(new Rq(i.uuid,u,d)),this.refreshService&&he.publish("hasModifyPcbItem",t),this.refreshService&&he.publish("flushService","")}saveCommonData(t,e){let r=R.getInstance().origin;R.getInstance().origin=e;let i=new Qd("2.0",pi.FOOTPRINT,t.getInstance());i.feed("CANVAS"),Ze.getInstance().getAllItem().forEach(a=>{i.feed("LAYER",a)}),Ze.getInstance().getLayerPhys().forEach(a=>{i.feed("LAYER_PHYS",a)}),i.feed("ACTIVE_LAYER"),R.getInstance().origin=r}deletePad(t,e,r){let i=Ji.getInstance().getItem(e.footprintUUID);if(i instanceof Sc&&t.globalIndex.startsWith(e.globalIndex)){let n=t.globalIndex.replace(new RegExp("^"+e.globalIndex),""),s=i.getModelBy("Pad",n);r.addCommand(new Rq(i.uuid,"modify",[["delete",s.clone()]])),i.deleteItem(s)}}generateFootprint(t,e,r,i){if(i!=null&&i.length>0){let n=this.removePrefix(i,t);for(let s of i){let a=s.model.clone();if(!(a instanceof xi))continue;let l=e.getModelBy(a.modelType,s.globalIndex);l==null?(l=a,r.push(["add",l.clone()]),e.addItem(a)):r.push(["modify",l.clone()]);let c=ED(a,pi.FOOTPRINT);c.clearFootExcludeProps(),c.model=l,c.load();let h=s.model;(h instanceof oS||h instanceof LM)&&h.reset4Model(l)}this.recoverPrefix(i,n),this.replaceModel(t,e)}}replaceModel(t,e){let r=t.getItems(),i=this.removePrefix(r,t);for(let n of r)if(n instanceof Le||n instanceof Ue){let s=e.getModelBy(n.model.modelType,n.globalIndex),a=n.model;(a instanceof oS||a instanceof LM)&&a.reset4Model(s)}this.recoverPrefix(r,i)}removePrefix(t,e){let r={};for(let i of t)if(i.globalIndex.startsWith(e.globalIndex)){let n=i.globalIndex.replace(new RegExp("^"+e.globalIndex),"");r[n]=i.globalIndex,i.globalIndex=n}return r}recoverPrefix(t,e){for(let r of t){let i=e[r.globalIndex];i!=null&&(r.globalIndex=i)}}};var khe=class{constructor(){this._hightType="darked";this._tempHight=!0;this._dragDarked=!0}get hightType(){return this._hightType}set hightType(t){this._hightType=t}get tempHight(){return this._tempHight}set tempHight(t){this._tempHight=t}get dragDarked(){return this._dragDarked}set dragDarked(t){this._dragDarked=t}};var uE=class{constructor(t,e,r,i){this.cbs=new Array;this._referX=t,this._referY=e,r.forEach(n=>{this.cbs.push(n)}),this.checkCb=i}setReferPointSuccess(t,e){return this.checkCb!=null?this.checkCb(t,e):!0}setReferPoint(t,e){this._referX=t,this._referY=e,this.cbs.forEach(r=>{r(t,e)})}get referX(){return this._referX}set referX(t){this._referX=t}get referY(){return this._referY}set referY(t){this._referY=t}};function KEe(o=!0){a_(o)}function a_(o=!0,t=ze.getSelects()){!R.getInstance().isactive||23==R.getInstance().doctype||Is.getInstance().init(t,"flip to OppositeLayer",(e,r)=>{let i=new Set;for(let l of e)if(l instanceof Le)l.getParent()==null&&i.add(l);else if(l instanceof mt||l instanceof _t){let c=l.getParent();c!=null&&c instanceof lt&&c.getParent()==null&&i.add(c)}else l instanceof He?l.getParent()==null&&i.add(l):l instanceof qc||i.add(l);i.forEach(l=>r.addCommand4Item(l,"modify"));let n=new _e;for(let l of i)n.ext1(l.buildBBox());let a=n.build1().center();for(let l of i){let c=l.layerId,h;(hb(c)||is(c))&&(h=sg(c)),c==12&&l instanceof Le&&l.oppositeLayer();let u;l instanceof ke||l instanceof lr?u=l.position:l instanceof Dp?u=l.start:u=l.buildBBox().center();let d=Ae.translate((a.x-u.x)*2,0,0),p=Ae.translate(-a.x,-a.y,0).scale(-1,1,1).translate1(a.x,a.y,0),m=[];if(l instanceof ke)h&&(l.layerId=h),l.transform(d);else if(l instanceof lr||l instanceof Dp){let g=l.getParent();(g==null||!i.has(g))&&(h&&(l.layerId=h),l.transform(d))}else if(l instanceof Le)l.getParent()==null&&(h&&(l.layerId=h),l.transform(p));else if(l instanceof mt||l instanceof _t){let g=l.getParent();if(g!=null&&g instanceof lt){let y=g.globalIndex;if(g.getParent()==null){if(!m.includes(y))m.push(y);else continue;h&&(g.layerId=h),g.transform(p)}}}else l instanceof He?l.getParent()==null&&(h&&(l.layerId=h,un.changeModelLayer(l,void 0,r.getCommand())),l instanceof rr?(l.start=l.getUR().multiply4(p),l.rotation=Math.PI*2-l.rotation):l.transform(p)):(h&&(l.layerId=h),l.transform(p));l.click()}o&&(r.checkOutlines(Array.from(i),new Set),he.publish("flushSelectingInfo","")),gr.model=gr.model})}function Dq(o){!R.getInstance().isactive||23==R.getInstance().doctype||Is.getInstance().init(ze.getComponents(),"flip to OppositeLayer",(t,e)=>{let r=!1;for(let i of t)i instanceof ke&&i.layerId!=o&&(e.addCommand4Item(i,"modify"),i.layerId=o,i.click(),r=!0);Pe.setActiveLayerId(o),r&&(e.execute(),he.publish("flushSelectingInfo",""))})}var s5=class s5 extends Ei{constructor(){super(...arguments);this.updateIds=new Set}static getInstance(){return s5.manager==null&&(s5.manager=new s5),s5.manager}updateItem(e){let r=e.globalIndex;this.updateIds.has(r)&&this.map.set(r,e)}addItem(e){let r=e.globalIndex;this.map.set(r,e),this.updateIds.add(r)}recycle(){super.recycle(),this.updateIds.clear()}delete(e,r){this.updateIds.has(r)&&(e instanceof mt||e instanceof Ok)&&this.map.delete(r)}};s5.manager=null;var Ky=s5;var a5=class a5{constructor(){this.selectIds=new Map;this.hasRecode=!1}static getInstance(){return a5.tool==null&&(a5.tool=new a5),a5.tool}modify(){this.hasRecode&&(this.hasRecode=!1,this.selectIds.clear(),Ky.getInstance().recycle())}stash(){if(this.hasRecode)return;let t=ze.getSelects(),e;if(t.length>0){let i,n=Ky.getInstance();this.hasRecode=!0;for(let s of t){if(e=s.model,i=e.modelType,i=="Line"||i=="Arc"){n.addItem(s);continue}this.addMap(this.selectIds,i,e.globalIndex)}}let r=ze.getAnnotationItems();if(r.length>0){this.hasRecode=!0;for(let i of r)e=i.model,this.addMap(this.selectIds,e.modelType,e.globalIndex)}}addMap(t,e,r){if(e==null)return;let i=t.get(e);i==null&&(i=new Set,t.set(e,i)),i.add(r)}pop(){if(this.hasRecode){let r=function(i){i&&(i.updateFilterVisible=!0,i.click(),t.push(i))},t=[],e=new Jt;this.selectIds.forEach((i,n)=>{let s;if(n=="Ratline"){let l=Wo;for(let c of i)s=l.getRatlineById(c),r(s);return}let a=e.getManageByType(n);if(a)for(let l of i)s=a.getItem(l),r(s)}),Ky.getInstance().iterator(i=>{r(i)}),ze.select(t,void 0,!1)}}};a5.tool=null;var l5=a5;var Txt=["Board Outline","Copper Region","Fill Region","Slot Region","Prohibited Region","Constraint Region","FPC Stiffener","3D Shell - Outline","3D Shell - Side Slot Region","3D Shell - Top Slot Region","3D Shell - Side Entity","3D Shell - Top/Bottom Entity"];function Bhe(o){let t,e=o||ze.getSelects();for(let r of e)if(JEe(r)){t=r;break}t==null?A.publish("tool","SelectHelp"):A.publish("toggle",{command:"editOutline",item:t})}function JEe(o){return o instanceof sn?!0:o instanceof He?o.type==="Line"?!!(o instanceof rr||o instanceof Pr||o instanceof lt&&o.isClose()):Txt.includes(o.type):!1}function QEe(o,t){let e,r=Number.MAX_SAFE_INTEGER;for(let i of o){let n;i instanceof mt?n=AL(t.x,t.y,i.start.x,i.start.y,i.end.x,i.end.y):n=Ixt(t,i),n<r&&(r=n,e=i)}return e}var Tje=new Rc(.01);function Fhe(o,t,e=.02){return!!(Tje.eq(o.direct.cross(t.sub(o.start())),0)&&o.bbox().extendSize(e).isContains(t))}function Vhe(o,t,e=.02){let r=t.sub(o.center);if(Tje.eq(r.length(),o.rx)&&o.bbox().extendOfSize(e).isContains(t)){r=r.normalize();let i=o.start().sub(o.center).normalize(),n=o.end().sub(o.center).normalize();return Math.abs(o.sweepAngle)<180?iT(r,i,n):!iT(r,i,n)}return!1}function Ixt(o,t){let{center:e,radius:r,startAngle:i,endAngle:n,sweep:s}=t,a=o.x-e.x,l=o.y-e.y,c=Math.sqrt(a*a+l*l);if(c<1e-8)return r;let h=ZEe(Math.atan2(l,a)),u=ZEe(i),d=ZEe(n),p=new S(e.x+r*Math.cos(u),e.y+r*Math.sin(u)),m=new S(e.x+r*Math.cos(d),e.y+r*Math.sin(d));if(Cxt(h,u,d,s))return Math.abs(c-r);{let y=o.distance1(p),b=o.distance1(m);return Math.min(y,b)}}function ZEe(o){return o=o%(2*Math.PI),o<0?o+2*Math.PI:o}function Cxt(o,t,e,r){return Math.abs(t-e)<1e-8?!0:r?t<=e?o>=t&&o<=e:o>=t||o<=e:e<=t?o>=e&&o<=t:o>=e||o<=t}var xg=class xg extends Ei{constructor(){super();this.items=new Array;this.logger=new Di(1);this.selections=new Array;this.mouseLeftDown=!1;this.mouseLeftUp=!1;this.mouseLeftUpX=0;this.mouseLeftUpY=0;this.mouseLeftX=0;this.mouseLeftY=0;this.mouseFrameX=0;this.mouseFrameY=0;this.mouseRightX=0;this.mouseRightY=0;this.mouseRightFrameX=0;this.mouseRightFrameY=0;this.components=new Array;this.tracks=new Array;this.lines=new Set;this.rectSelectId=null;this.currentPointSelectedItems=Array();this.target="click-canvas-blank";this.highlight=WS.getInstance();this.highlightComponentWhenMoveText=new che;this.readyToCopyDragging=!1;this.keepSelection=!1;this.isSpecialPaste=!1;this.selectAnnotations=[];this.hasBottomTipIds=new Set;this.realTimeHighlight=!1;this.tabSwitch=new lhe;this.selectionOrder=new Map;this.selectionOrderNumber=0;this.dragging=!1;this.drcItems=new Set;this.isClick=!1;this.selectRepeater=!0;he.subscribe("removeSelect",this.delete.bind(this)),he.subscribe("select",this.select.bind(this)),he.subscribe("onlySelect",this.onlySelect.bind(this)),he.messageBus.rpcService("copyItems",this.copy.bind(this)),he.subscribe("clearSelect",this.clearSelect.bind(this)),he.subscribe("flushSelectingInfo",this.flushSelect.bind(this)),he.subscribe("updateNetwork",this.updateNetwork.bind(this)),he.subscribe("updateHightShow",this.updateHightLightShow.bind(this)),he.subscribe("highLight",this.highLight.bind(this)),he.subscribe("restoreHight",this.restoreHighLight.bind(this)),he.subscribe("highlightValue",this.highlightValue.bind(this)),he.subscribe("changeHighlightValue",this.changeHighlightValue.bind(this)),he.subscribe("stashHight",this.stashHighLight.bind(this)),he.subscribe("selectAll",this.selectAll.bind(this)),he.subscribe("updatePCBDeviceFootprint",this.modifyCurrentTemplate.bind(this)),he.subscribe("refreshHighLigth",()=>{this.highlight.refreshHighLigth()}),he.subscribe("rotation",e=>{this.rotation(e)}),he.messageBus.rpcService("pcb/closePcbPage",this.closePcbPage.bind(this))}get dialog(){return this._dialog}set dialog(e){e?Vr.validType=e.tool.validType:Vr.validType=null,this._dialog=e}getDRCItems(){return this.drcItems}onKeyDown(e){let r=di.getScene(),i=tr.getAction(r,e);if(Mt.isChildPcb()&&this.target=="select-device"&&i!=null&&["Copy","cut","Delete Selected","Duplicate","DuplicateToCursor","DuplicateToOtherLayer","editArray"].includes(i))return;let n=new S(e.realSceneX,e.realSceneY);if(this.mouseLeftDown){if(this.items.length>0){di.setArea(["Scroll Right","Scroll Up","Scroll Down","Scroll Left","place","switchToLayer(1)","switchToLayer(2)"]);let a=di.getScene();i=tr.getAction(a,e)}switch(i){case"Rotate Left":{gr.rotate();break}case"rotate_right":{gr.rotate(-le.pcbConfig.rotate);break}case"switchToLayer(1)":{gr.onMouseLeftUp(e),Dq(1),gr.onMouseLeftDown(e);break}case"switchToLayer(2)":{gr.onMouseLeftUp(e),Dq(2),gr.onMouseLeftDown(e);break}case"flip2OppositeSide":{gr.onMouseLeftUp(e),KEe(),gr.onMouseLeftDown(e);break}case"Scroll Down":{he.publish("Scroll Down",{});break}case"Scroll Up":{he.publish("Scroll Up",{});break}case"Scroll Right":{he.publish("Scroll Right",{});break}case"Scroll Left":{he.publish("Scroll Left",{});break}case"Cancel":{this.cancel({clearSelect:!1});break}case"place":{this.onMouseLeftUp(e);break}default:{gr.onKeyDown(e);break}}Sg.set(e);return}let s=!0;switch(i){case"convertToBoard":{mEe();break}case"Backspace":{let a=this.getSelects(),l=new mhe(Array.from(a)),c=new De("backspace track");l.backspace(c),qe.executeCommand(c);let h=l.getSelectItem();h.forEach(u=>{u.click()}),he.publish("select",h),he.publish("flushService",""),l.complete()}break;case"Delete Selected":{this.delete();break}case"Rotate Left":{this.rotation(le.pcbConfig.rotate);break}case"rotate_right":{this.rotation(-le.pcbConfig.rotate);break}case"Undo":{he.publish("undo","");break}case"Redo":{he.publish("redo","");break}case"Move by Center Point":{he.publish("batchMove","MOVE_BY_CENTER_POINT");break}case"Flip Right and Left":{he.publish("turn","turnAround");break}case"Flip Up and Down":{he.publish("turn","turnUpsideDown");break}case"selectedBSSaveAsCloud":case"selectedBSSaveAsLocal":{he.publish("Pcb/doCommand",i,Q());break}case"Copy":{he.publish("tool","COPY");break}case"copyToSvg":he.publish("copyToSvg","");break;case"copyToPng":he.publish("copyToPng","");break;case"cut":{he.publish("tool","CLIP");break}case"Paste":{this.isSpecialPaste=!1;try{navigator.clipboard.read().then(a=>{if(a.length>0){let l=a[0].types;if(l&&!l.length)return;for(let c of l)if(!c)return}he.publish("tool","PASTE")}).catch(()=>he.publish("tool","PASTE"))}catch{he.publish("tool","PASTE")}break}case"specialPaste":{this.changeLayerStatus();break}case"Select All":{s=!1,this.selectAll();break}case"Highlight Selected Objects":{this.highLight("HIGHLIGHT_SELECTED_OBJECTS"),s=!1;break}case"Show/Hide Selected Ratline":{he.publish("toggleSelectedRatline",{type:"allSelected",isCycleSwitch:!0});break}case"Hide Selected Ratline":{this.hideRatlines();break}case"Show Selected Ratline":{this.showRatlines();break}case"Group Selected":{he.publish("combination",""),s=!1;break}case"displayRealTimeNetLengthAndLengthTolerance":{let a=le.pcbConfig.showNetLength||le.pcbConfig.showDiffLength;le.pcbConfig.showNetLength=!a,le.pcbConfig.showDiffLength=!a;break}case"Ungroup Selected":{he.publish("dissolution",""),s=!1;break}case"Join Group":{he.publish("joinCombination","");break}case"Align Right":{he.publish("align","align_right");break}case"Align Top":{he.publish("align","align_top");break}case"Align Vertical Centers":{he.publish("align","align_vertical_center");break}case"Align Bottom":{he.publish("align","align_bottom");break}case"Align Grid":{he.publish("align","align_grid");break}case"Horizontal Equidistant Distribution":{he.publish("distribute","distribute_horizontal_equidistant");break}case"Vertical Equidistant Distribution":{he.publish("distribute","distribute_vertical_equidistant");break}case"Component Distribute By Region":{he.publish("distribute","component_distribute_by_region");break}case"Align Left":{he.publish("align","align_left");break}case"Align Horizontal Centers":{he.publish("align","align_horizontal_center");break}case"Select Overlap":{this.selectOverlap(e);break}case"Highlight Or Unhighlight Net":{this.highLight("HIGHLIGHT_NET_LOOP");break}case"changeRoutingAngle":case"Routing Corner":{Zt.getInstance().type=Ur.getNextType(),we.synchronize();break}case"Cancel":{this.cancel();break}case"Move Selected Left":{let a=It.getInstance().flip?-1:1,l=Ae.translate(-It.getInstance().getSnapX()*a,0,0);OD(e,l),gr.model=gr.model;break}case"move_selected_left_by_alt_grid":{let a=It.getInstance().flip?-1:1,{snapX:l}=R.getInstance().getAltGridSize(),c=Ae.translate(-l*a,0,0);OD(e,c),gr.model=gr.model;break}case"Move Selected Right":{let a=It.getInstance().flip?-1:1,l=Ae.translate(It.getInstance().getSnapX()*a,0,0);OD(e,l),gr.model=gr.model;break}case"move_selected_right_by_alt_grid":{let a=It.getInstance().flip?-1:1,{snapX:l}=R.getInstance().getAltGridSize(),c=Ae.translate(l*a,0,0);OD(e,c),gr.model=gr.model;break}case"Move Selected Down":{let a=Ae.translate(0,-It.getInstance().getSnapY(),0);OD(e,a),gr.model=gr.model;break}case"move_selected_down_by_alt_grid":{let{snapY:a}=R.getInstance().getAltGridSize(),l=Ae.translate(0,-a,0);OD(e,l),gr.model=gr.model;break}case"Move Selected Up":{let a=Ae.translate(0,It.getInstance().getSnapY(),0);OD(e,a),gr.model=gr.model;break}case"move_selected_up_by_alt_grid":{let{snapY:a}=R.getInstance().getAltGridSize(),l=Ae.translate(0,a,0);OD(e,l),gr.model=gr.model;break}case"showAbsoluteOffsetDialog":{he.publish("offset","OFFSET_ABSOLUTE");break}case"showRelativeOffsetDialog":{he.publish("offset","OFFSET_RELATIVE");break}case"toggleLocked":{let a=new Ya(this.items,void 0,!0).items;a.size>0&&(Array.from(a).every(c=>c.locked)?this.unlockAllSelect():this.lockAll());break}case"pcbCrossProbe":{he.messageBus.rpcCall("getPcbCrossProbeToSchData").then(a=>{let{rule:l,hasSelected:c}=a.message;if(!c)he.publish("tool","crossProbeTool");else{let h={isManualTrigger:!0};he.windowBridge.publish("cross-window",{selectObj:l,otherData:h,cmd:"crossProbeBetweenWindows"},Q())}});break}case"Switch Selected Range When Object Is Selected":{!this.tabSwitch.isTabSwitch&&this.items.length===1?this.tabSwitch.startSwitch(this.items):this.tabSwitch.isTabSwitch&&this.tabSwitch.tabSwitchMsg&&this.tabSwitch.switchRange();break}case"MOVE_BY_REFERENCE_POINT":{he.publish("batchMove","MOVE_BY_REFERENCE_POINT");break}case"switchToLayer(1)":{Dq(1);break}case"switchToLayer(2)":{Dq(2);break}case"expandAndModifyProperties":{he.publish("expandAndModifyProperties","",Q());break}default:s=!1;break}Sg.set(e),s&&he.publish("clearDimension",""),he.publish("updateFrame","")}onMouseLeftDown(e){e.setIsBoxSelection(!1),this.bbox=void 0;let r=e.realSceneX,i=e.realSceneY;this.mouseLeftDown=!0,this.mouseLeftUp=!1,this.mouseLeftX=r,this.mouseLeftY=i,this.mouseFrameX=e.mouseX,this.mouseFrameY=e.mouseY,IEe.onMouseLeftDown(e);let n=Vr.pointSelectBeforeFilter(r,i).getResult(Df),s=jt.pointFilter(r,i,n);this.classifyTrack(),this.lastItems=Array.from(this.items),this.leftDowSelect=Array.from(this.items),this.currentPointSelectedItems=Array.from(s);let a=e.ctrlKey,l=e.altKey;if(a&&!l)s[0]&&(!(s[0]instanceof Le)||!s[0].getParent())&&le.pcbConfig.isCtrlDragToCopy&&(this.readyToCopyDragging=!0);else if(Sg.set(e),gr.onMouseLeftDown(e)||this.pointSelect(r,i,e,"MouseLeftDown"),this.smartSelection(Array.from(n),s),we.smartMode){let c=this.getSelects();c.length==0&&!_s.justSelectOnePoint?_s.cancel():c.length==1&&c[0]instanceof hh&&_s.state!=2&&_s.needMoreClickToDrag&&(_s.needMoreClickToDrag=!1,this.onMouseLeftDown(e))}s[0]||(this.readyToCopyDragging=!1)}onMouseLeftUp(e){if(!e.leftDown)return;let r=this.dragging,i=!1;this.dragging=!1;let n=e.realSceneX,s=e.realSceneY;if(this.mouseLeftDown=!1,this.mouseLeftUp=!0,this.mouseLeftUpX=n,this.mouseLeftUpY=s,this.selections.length>0){this.bbox=new _e().ext6(n,s).ext6(this.mouseLeftX,this.mouseLeftY).build1();let a=this.bbox;this.mouseLeftX>n?It.getInstance().flip?this.boxSelect(a,!0,e.ctrlKey):this.boxSelect(a,!1,e.ctrlKey):It.getInstance().flip?this.boxSelect(a,!1,e.ctrlKey):this.boxSelect(a,!0,e.ctrlKey),this.clearSelectBox(),e.setIsBoxSelection(!0)}else(!e.ctrlKey||r)&&gr.onMouseLeftUp(e),e.setIsBoxSelection(!1),i=!0,e.ctrlKey&&!r&&(this.selectAnnotations.forEach(a=>{a.visible()}),this.selectAnnotations.length=0,gce(n,s,!0,this.leftDowSelect),this.crossWindow(),this.mouseSelectedForAPI());!e.ctrlKey&&e.leftClick&&!e.shiftKey&&this.pointSelect(n,s,e,"MouseLeftUp"),!r&&i&&(this.isClick=!e.ctrlKey,this.selectWholeOrSingleTrack(n,s),this.shiftHighLight(e)),we.smartMode&&(_s.needMoreClickToDrag=!0),Sg.set(e),he.publish("flushService",!0),this.flushSelect(),zu("default"),this.mouseLeftUp=!1,this.isClick=!1}shiftHighLight(e){let r=e.ctrlKey,i=e.altKey,n=e.shiftKey;if(R.getInstance().doctype==3&&n)if(this.items.length==0)this.highlight.unhighLigthAll();else{r||this.highlight.unhighLigthAll();let s=new Set,a=new Set,l=[],c=[];for(let h of this.items)if(this.highlight.isItemHighlighted(h.globalIndex)){let u=Ao(h);u!=null&&a.add(u),c.push(h)}else{let u=Ao(h);u!=null&&s.add(u),l.push(h)}this.highlight.highLightNets(s),this.addHightObj(l),this.highlight.unhighLightNets(a),this.unHightObj(c),this.clearSelect()}}onMouseMove(e){let r=e.realSceneX,i=e.realSceneY;if(e.hovering=!0,e.hover(),this.mouseLeftDown)if(e.ctrlKey&&this.readyToCopyDragging){if(new Date().getTime()-e.downTime>200){let n=this.mouseLeftX,s=this.mouseLeftY;this.logger.debug3("%s,%s ,%s",333,this.items,this.items.filter(c=>{c.isSelect(n,s)}));let a=Vr.pointSelect(n,s);ze.getSelects().some(c=>c===a[0])||(this.tempSelects=[a[0]]),he.publish("updateFlag",!1),he.publish("toggle",{command:"PASTE2"}),he.publish("updateFlag",!0),this.readyToCopyDragging=!1,this.mouseLeftDown=!1}}else if(this.selections.length==0&&(!e.ctrlKey||e.ctrlKey&&e.altKey)||this.dragging){if(we.smartMode&&this.getSelects().filter(s=>s instanceof Le||s instanceof hh).length>1){this.interrupt(),he.publish("showPcbSlideMsg",["Under smart dimension mode, only one pad or dimension can be dragged at a time!"],Q());return}Sg.set(e),gr.onMouseMove(e)?(this.tracks.length=0,this.lines.clear(),this.rectSelectId=null,this.dragging=!0):this.updateSelectBox(r,i)}else this.updateSelectBox(r,i);else{if(oa)oa.onMouseMove(e);else if(we.smartMode){let n=gr.getControl();return _s.control=n,(n instanceof oG||n instanceof sG)&&(_s.control=null),_s.move(e)}gr.onMouseUpMove(e)}}onMouseRightDown(e){gr.onMouseRightDown(e),this.closeActionDialog()}onMouseRightUp(e){if(!(R.getInstance().envFlag=="silk-preview"||!e||!e.openMenu)){if(this.dragging)e.openMenu=!1,this.cancel({clearSelect:!1});else if(!gr.onMouseRightUp(e)){if(Q()!==window.parent)return;this.rightClickMenuData(e)}}}onMouseWheel(e){gr.onMouseWheel(e)}onDoubleClick(e){if(R.getInstance().isReadOnlyMode)return!1;if(!gr.onDoubleClick(e)){let i=e.realSceneX,n=e.realSceneY,s=Vr.pointSelect(i,n);for(let a of s){let l=a;if(l.isSelect(i,n)){if(l instanceof lr){if(l.key!=""&&R.getInstance().doctype==4&&!we.footprintIsConnectDevice)return;let c=this.getRatio(),h=!0;Mt.isChildPcb()&&l.getParent()&&l.getParent()instanceof ke&&(h=!1),h&&he.publish("openMainDialog",{cmd:25,data:{text:l,x:e.mouseX/c,y:e.mouseY/c}});for(let u of this.items)u.visible();this.clearItems(),l.click(),this.select([l]);return}else if(!e.ctrlKey&&R.getInstance().doctype===3&&(l instanceof Le||l instanceof Ue)&&this.initialSelect!=null){this.onlySelect([this.initialSelect]);let c=ds.getInstance("Single wiring");c.doubleClickItem=l,this.addTrack()}IEe.onDoubleClick(e)}if(we.smartMode&&l instanceof hh){he.publish("openMainDialog",{cmd:32,data:{option:{value:l.length+l.unit,rulerId:l.globalIndex,unit:l.unit,isNew:!1}}});return}}}}getRatio(e=1){return R.getInstance().getRatio()}interrupt(){var r;let e=new Array;for(let i of this.items)i.isEmpty?he.publish("delete",i):e.push(i);for(let i of e)if(i.isEmpty)he.publish("delete",i);else{i.updateFilterVisible=!0;let n=i.getParent();n instanceof lt?(n.iteratorChildren(s=>{s.visible()}),i.visible()):i instanceof mn?(r=re.getInstance().getNet(i.net))!=null&&r.showRatline&&i.visible():i.visible()}for(let i of this.selectAnnotations)i.isEmpty?he.publish("delete",i):i.isVisible&&(i.updateFilterVisible=!0,i.visible());Mt.cancelHightLightAll(),this.highlight.cancelHighlightUnselect(),this.clearPadAndItemSelect(),this.items.length=0,this.selectAnnotations.length=0,this.components.length=0,this.mouseLeftDown=!1,gr.model=3,this.clearSelectBox()}cancel({clearSelect:e=!0}={}){let r=e?[]:Array.from(this.items);this.interrupt(),this.items.push(...r),this.flushSelect(),e&&this.crossWindow(),e&&this.mouseSelectedForAPI()}getLastClickPosition(){return new S(this.mouseLeftX,this.mouseLeftY)}getLastUpPosition(){return new S(this.mouseLeftUpX,this.mouseLeftUpY)}isShowCursorMsg(e){bT.filter(this.items).length>0&&Ut.update(e,"Please select a reference point")}selectedConnectedCopper(e,r,i=!1,n){let s=n||Vr.pointSelectBeforeFilter(e,r).getResult(Df),a=new Set;for(let u of s)l(u)&&(u instanceof mt||u instanceof _t?a.add(u.getParent()):a.add(u));if(!a.size)return;function l(u){if(u instanceof Ge||u instanceof Ue||u instanceof Le)return!0;if(u instanceof He){let d=Pe.getLayer(u.layerId);if(d&&d.isSignalLayer())return!0}return!1}let c=Vr.getTouchItems(Array.from(a)),h=new Set;c.forEach(u=>{u instanceof He?(u.type=="Fill Region"||u.type=="Line"||u.type=="TearDrop")&&h.add(u):h.add(u)}),i&&this.items.forEach(u=>{h.add(u)}),this.clearSelect(),h=jt.filter(h),h.forEach(u=>{u.click()}),this.select(h),he.publish("updateFrame",""),gr.model=1}pointSelect(e,r,i,n){let s=i1.getInstance(),a=!0,l=Vr.pointSelect(e,r);l=Array.from(jt.filter(l));let c=Vr.filterPartiton(l);s.setTargetDRCItemsVisible(this.drcItems),this.drcItems.clear(),this.keepSelection&&(this.items.some(d=>c.includes(d))&&(c=this.items,a=!1),this.keepSelection=!1);let h,u=[];if(a){let d=this.mouseLeftDown;Vr.handleClickPourOutline(this.leftDowSelect,!0),this.interrupt(),this.mouseLeftDown=d,c=l,c=Vr.handleClickPour(Vr.filterPartiton(c),this.leftDowSelect),Vr.handleClickPourOutline(this.leftDowSelect,!1),h=c.find(p=>To.isAnnotation(p)),c=c.filter(p=>p instanceof hy?(u.push(p),!1):!0),this.currentPointSelectedItems=c,h?To.getInstance().selectPcbAnnotation2(h.globalIndex,void 0,!1):(c.forEach(p=>{p.click()}),he.publish("selectSource",0),this.select(c))}if(h?gr.model=1:c.length==1?gr.model=0:c.length>1?i.ctrlKey?gr.model=0:gr.model=1:gr.model=3,this.drcItems=new Set(u),this.drcItems.size>0){if(n==="MouseLeftDown"){let[d]=this.drcItems;s.setTargetDRCItemsClicked([d])}}else s.resetClickStatus();this.crossWindow(),this.mouseSelectedForAPI()}boxSelect(e,r,i){if(!i){let s=this.mouseLeftDown;this.interrupt(),this.mouseLeftDown=s}let n=new Array;if(r?n=this.leftToRight(e):n=this.rightToLeft(e),n=Vr.filterPartiton(n),n=n.filter(s=>!this.isAnnotation(s)),i){let s=new Set;this.items.forEach(l=>{s.add(l)}),n.forEach(l=>{s.add(l)}),n.length=0;let a=this.mouseLeftDown;this.interrupt(),this.mouseLeftDown=a,s.forEach(l=>{this.isAnnotation(l)||(l.click(),n.push(l))})}this.select(n),n.length==1?gr.model=0:gr.model=1,this.crossWindow(),this.mouseSelectedForAPI()}isAnnotation(e){return To.isAnnotation(e)}getPrimitiveType(e){let r="";return e instanceof _i?r="Pad":e instanceof ke?r="Component":e instanceof qs?r="Dimension":e instanceof Ps?r="Picture":e instanceof Mn?r="Image":e instanceof lr?r="Text":e instanceof rr||e instanceof Pr||e instanceof lt?r=e.model.type:e instanceof Ir?r="Track":e instanceof Ue&&(r="Via"),r}crossWindow(){if(window.BroadcastChannel){let e=pD.getCrossProbeData(this.items),r={isManualTrigger:!1};if(he.publish("cross-window-top",{props:e},Q()),!we.isCheckedCrossProbeMode)return;he.windowBridge.publish("cross-window",{selectObj:e,otherData:r,cmd:"crossProbeBetweenWindows"},Q())}}mouseSelectedForAPI(){if(this.items.length>0){let e=[];this.items.forEach(r=>{if(r instanceof ke){let i={primitiveId:r.globalIndex,primitiveType:this.getPrimitiveType(r),net:Ao(r),designator:r instanceof ke?r.model.attrsMap.Designator:null};e.push(i)}else{let i={primitiveId:r.globalIndex,primitiveType:this.getPrimitiveType(r),net:Ao(r)};e.push(i)}}),he.extensionApiMessageBus2().publish("extensionApi.PCB_Event.mouseEvent",{eventType:"selected",props:e})}}getSelectsById(e){return this.items.find(i=>i.globalIndex==e)}getSelects(){var e;return this.tempSelects&&((e=this.tempSelects)==null?void 0:e.length)>0?this.tempSelects:Array.from(this.items)}getSelectedGroups(){return this.items.filter(e=>{let r=e;return(e instanceof mt||e instanceof _t)&&(r=e.getParent()),!!r.getGroupID()})}clipHandleSelectItem(){let e=this.items.map(r=>((r instanceof mt||r instanceof _t)&&(r=r.getParent()),r));this.items=e}exitLeftDown(){this.mouseLeftDown=!1}updateHightLightShow(){let r=le.hightShowConfig.hightType=="darked";this.highlight.changeLightShow({isDark:r,force:le.hightShowConfig.tempHight})}updateNetwork(e){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let r=new De("update select item network");for(let i of this.items)if(i instanceof mt||i instanceof _t){let n=i.getParent();n!=null&&n instanceof lt&&(he.publish("hasModifyPcbItem",n),r.addCommand(Ce.dispatch(n,"modify")),n.net=e,he.publish("hasModifyPcbItem",n))}else i.net!=null&&(he.publish("hasModifyPcbItem",i),r.addCommand(Ce.dispatch(i,"modify")),i.net=e,he.publish("hasModifyPcbItem",i));r.length>0&&(qe.executeCommand(r),he.publish("flushService","")),this.flushSelect()}flushSelect(e={triggerFrom:"COMMON"}){var n,s;if(R.getInstance().isPreview||this.items.length>0&&this.mouseLeftDown&&this.dragging)return;let r=new Array;for(let a of this.items)a.isEmpty?he.publish("delete",a):(a.updateFilterVisible=!0,a.click(),r.push(a));for(let a of this.selectAnnotations)a.isEmpty?he.publish("delete",a):(a.updateFilterVisible=!0,a.click(),r.push(a));he.publish("selectSource",1);let i=(s=(n=this.tool)==null?void 0:n.getSplitItems())!=null?s:r;this.select(i,e),this.tabSwitch.isTabSwitch=!1,this.tabSwitch.tabSwitchMsg=null,gr.model=gr.model}clearTempSelect(){this.tempSelects&&(this.tempSelects.length=0)}clearSelect(e){let{tabId:r}=e||{},i=R.getInstance();if(!([23].includes(i.doctype)||(r?i.tabId!=r:!i.isactive))){for(let n of this.items)n.isEmpty?he.publish("delete",n):(n.updateFilterVisible=!0,n instanceof mn?re.getInstance().getNet(n.net).showRatline&&n.visible():n.visible());for(let n of this.selectAnnotations)n.isEmpty?he.publish("delete",n):(n.updateFilterVisible=!0,n.visible());this.clearItems(),this.tabSwitch.isTabSwitch=!1,this.tabSwitch.tabSwitchMsg=null,this.select(new Array)}}onlySelect(e){let r=new Set(Array.from(e)),i=new Array;for(let n of this.items)r.has(n)||(i.push(n),this.selectionOrder.delete(n.globalIndex),n.isEmpty?he.publish("delete",n):(n.updateFilterVisible=!0,n.visible()));for(let n of this.selectAnnotations)r.has(n)||(n.isEmpty?he.publish("delete",n):(n.updateFilterVisible=!0,n.visible()));if(r.size==0)this.clearSelect();else{if(this.items.length==r.size&&i.length==0)return;Wo.unHighlightAll(i),this.select(e),this.crossWindow(),this.mouseSelectedForAPI();for(let n of r)n!=null&&!n.isEmpty&&(n.updateFilterVisible=!0,n.click())}}rotation(e){let r=new Ya(this.items,null,!0);Is.getInstance().init(r.items,"rotation items",(i,n)=>{let s=[],a=i.some(h=>h instanceof Ge);if(le.pcbConfig.rotateWhole=="whole"||a){let h=new _e;i.forEach(p=>{h.ext1(p instanceof ua?p.getLineBBox():p.buildBBox())});let d=h.build1().center();s=i.map(p=>i.length==1&&p instanceof ke?p.position:d)}else s=i.map(h=>h instanceof ke?h.position:h.buildBBox().center());r.getAllRepairTracks().forEach(h=>{n.addCommand4Item(h,"modify")}),i.forEach((h,u)=>{this.rotatable(h)&&(n.addCommand4Item(h,"modify"),$n.rotate(s[u],e,[h]))}),R.getInstance().envFlag=="silk-preview"&&((i.includes(Yr.QRCode)||i.includes(Yr.plainCode))&&he.messageBus.publish("updateCode",Yr.getCurrentCodeInfo()),i.includes(Bp.getInstance().image)&&he.messageBus.publish("updateCode",Bp.getInstance().getCurrentULInfo())),n.checkOutlines(this.items,new Set),gr.model=gr.model,he.publish("selecting",{items:this.items}),he.publish("flushService","")})}rotatable(e){return!(e instanceof mn||e instanceof Jr||e instanceof Gi)}calFindResultSelected(){let e=new Map,r=new Set,i=new Array;for(let n of this.items){let s=n.getGroupID();if(s!=null&&s!=""){r.add(s);let a=e.get(s)||0;e.set(s,++a)}i.push(n.globalIndex)}for(let[n,s]of e)Ht.getItem(n).size==s&&i.push(n);return i}setSelect(e,r=!0){if(r){this.select(e);return}e.forEach(i=>{i.click(!r),this.items.push(i)})}cancelNetSelect(e){let r=this.items.filter(i=>!e.includes(i.net));this.clearSelect(),this.items=r}select(e,r={triggerFrom:"COMMON"},i=!0){i&&l5.getInstance().modify();let{triggerFrom:n}=r;e=new Set(e),this.clearPadAndItemSelect(),this.items.length=0,this.selectAnnotations.length=0;let s=new Array;for(let l of e)if(l!=null){if(!Mt.checkIsCanEditByItem(l)){Mt.hightItems([l]);continue}if(l instanceof rr&&l.type=="Annotation"){this.selectAnnotations.push(l);continue}this.dialog?this.dialog.tool.validItem(l)?(this.items.push(l),s.push(l)):l.visible():(this.items.push(l),s.push(l)),this.selectionOrder.get(l.globalIndex)==null&&this.selectionOrder.set(l.globalIndex,this.selectionOrderNumber)}this.dialog&&this.dialog.update(),this.arrtDialog&&this.arrtDialog.update(),this.selectionOrderNumber++,this.category(this.items),this.enableMenuItems(),he.publish("selecting",this.selectAnnotations.length>0?{items:[].concat(this.selectAnnotations,s),triggerFrom:n||"COMMON"}:{items:this.items,triggerFrom:n||"COMMON"}),this.addPadAndItemSelect(),he.publish("findResultSelected",this.calFindResultSelected(),Q()),this.items.length==0?(gr.model=3,di.dropDrag&&di.setNonSelect(),this.selectionOrderNumber=0,this.selectionOrder.clear()):(this.items.length+this.selectAnnotations.length==1?gr.model=0:gr.model=1,di.dropDrag&&di.setSelect());let a=R.getInstance();if(!a.isReadOnlyMode&&a.compiler instanceof gp&&a.compiler.getSelectHandle()&&this.selectRepeater){let l=a.compiler.getSelectHandle(),c=a.compiler.canvasSelected();c!=l.lastStr&&(l.lastTime&&clearTimeout(l.lastTime),l.lastTime=setTimeout(()=>{l.lastTime=null,l.lastStr=c,a.compiler.getHandle()!=null&&a.compiler.publishSelected(c)},0))}this.components.length>0&&di.setArea(["switchToLayer(1)","switchToLayer(2)"]),PG("pcb-copper-manager")&&this.refreshCopperMangerDialog(),he.publish("refreshHighLigth",""),this.tabSwitch.isTabSwitch=!1,this.tabSwitch.tabSwitchMsg=null}getSelectStr(){let e=[],r,i,n=0,s=this.items.length;for(let l=0;l<s&&!(n>=1e3);l++){if(r=this.items[l],r.model instanceof xi)i=r.model.modelType;else continue;i!="Ratline"&&(n++,e.push({type:i,id:r.globalIndex}))}return JSON.stringify({action:"select",data:e})}async copy(e){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let r=bT.filter(this.items),i=(await he.messageBus.rpcCall("copy",r)).message;return he.publish("referPosition",null),i&&we.updatePartialState({refreshPasteState:!0}),i}existGroupAndShowLog(e,r){let i,n,s,a,l;if(e instanceof mt?(i=e.getParent().getGroupID(),n=e.getParent().globalIndex,l=e.getParent().number):(i=e.getGroupID(),n=e.globalIndex,l=e.number),i!=null){let c=R.getInstance().tabId;if(s=Ht.getItem(i),a=s.getItems(),a.length>=1){let h=Ht.getItem(i).name;tC.addObj(n,l),tC.addGroup(i,h),tC.execute()}}a!=null&&a.length<=1&&(r.addCommand4Item(s,"delete"),setTimeout(()=>{he.publish("delete",s)},10))}updateBridgingCopperNetLists(e,r){let i=mS().filter(n=>n.type==="Fill Region"&&n.component instanceof Zi&&n.component.isBridgingCopper);for(let n of i){let s=n.component.networkList;s.includes(e)&&(r.addCommand4Item(n,"modify"),s.splice(s.indexOf(e),1))}}delete(e){!R.getInstance().isactive||23==R.getInstance().doctype||this.mouseLeftDown||Is.getInstance().init(this.items,"delete select item",(r,i)=>{var y,b,P;e&&e();let n=new Set,s=new Array,a=new Map;if(r.forEach(T=>{if(T instanceof Le)T.getParent()==null?n.add(T):s.push(T);else if(!(T instanceof mn)){if(T instanceof Jr)n.add(T);else if(!(T instanceof Gi))if(T instanceof mt||T instanceof _t){let I=T.getParent();I!=null&&I instanceof He&&I.type!=="3D Shell - Side Datum Line"?(a.has(I)||a.set(I,[]),a.get(I).push(T)):n.add(T)}else n.add(T)}}),n.size==0&&a.size==0){i.undo();return}let l="deleteItems-time";Cn(l),gr.interrupt(),gr.model=3;let c=new Set,h=new Array,u=new Map,d=new Set,p=new Array;for(let[T,I]of a){let C=YYe.deleteModel(I);if(C==null){this.clearSelect();continue}this.existGroupAndShowLog(T,i),i.addCommand4Item(T,"delete"),T.remove(),he.publish("delete",T);for(let E of C)p.push(E),i.addCommand4Item(E,"add")}for(let T of n){let I=T.getParent();if(I!=null){if(T instanceof lr||T instanceof Jr)continue;c.has(I)||(i.addCommand4Item(I,"delete"),c.add(I))}}for(let T of n)if(this.existGroupAndShowLog(T,i),T instanceof lr)if(T.key!==""){let I=T.getParent();if(I!=null&&(n.has(I)||c.has(I)))continue;i.addCommand4Item(T,"modify"),h.push(T)}else i.addCommand4Item(T,"delete"),c.add(T);else if(T instanceof Jr)i.addCommand4Item(T,"delete"),c.add(T);else{let I=T.getParent();I!=null?T instanceof lr?(i.addCommand4Item(T,"modify"),h.push(T)):c.has(I)||(i.addCommand4Item(I,"delete"),c.add(I)):(i.addCommand4Item(T,"delete"),c.add(T))}let m=[];for(let T of h)T.showKey=!1,T.showValue=!1,T.visible();let g=R.getInstance().envFlag=="silk-preview";for(let T of c){if(g){if(T instanceof lr)if(T.globalIndex==((y=Yr.plainCode)==null?void 0:y.globalIndex))Yr.plainCode=null;else continue;if(T instanceof Ps)if(T.globalIndex==((b=Yr.QRCode)==null?void 0:b.globalIndex))Yr.QRCode=null;else continue;if(T instanceof Mn)if(T.globalIndex==((P=Bp.getInstance().image)==null?void 0:P.globalIndex))Bp.getInstance().image=null;else continue}T instanceof ke&&m.push(T.globalIndex),T instanceof Jr&&T.getParent().deleteCopperById(T.globalIndex),T.remove();let I=Ao(T);if(I!=null&&I!=""){let C=(u.get(I)||0)+1;u.set(I,C),Ye.getSameNetItems(I).length==0&&this.updateBridgingCopperNetLists(I,i)}he.publish("delete",T)}he.publish("deviceRemoved",m,Q());for(let T of this.items)T.visible();this.clearItems(),s.forEach(T=>{T.isEmpty||T.visible()}),this.enableMenuItems(),i.checkOutlines(p,d),he.publish("selecting",{items:this.items}),he.publish("flushService",""),he.publish("rebuildRatline",{nets:u}),R.getInstance().doctype===4&&he.publish("flushAttrPlane",""),this.crossWindow(),this.mouseSelectedForAPI(),Xi(l,.05)},{isDelete:!0})}deleteItem(e){let r=Ije(e);if(r&&e.isEmpty){this.items=this.items.filter(n=>n!==e);let i=r.getItem(e.globalIndex);i&&!i.isEmpty&&this.items.push(i)}}refreshCopperMangerDialog(){let e=this.items,r=[];e.forEach(i=>{i instanceof He&&i.type=="Copper Region"&&r.push(i.globalIndex)}),he.publish("pcbdialogModify",{dialogType:"pcb-copper-manager",action:"refreshCopperMangerDialog",data:r})}enableMenuItems(){let e=this.items,r=Ht.getAllGroupId().length>0,i=e.some(s=>s.getGroupID()==null),n=fhe(this.items,this.components,r&&i,this.canDissolute(e).length>0,this.canFlipDevice(),["select-device","select-pad","select-via","select-track","select-blend-objects"].includes(this.target));we.select(n)}canDissolute(e){if(e.every(n=>!n.getGroupID()))return[];let i=new Set;return e.forEach(n=>{let s;n instanceof mt||n instanceof _t?s=n.getParent().getGroupID():s=n.getGroupID(),s&&i.add(s)}),Array.from(i)}category(e){this.components.length=0;let r=!1;for(let i of e)i instanceof mn||(r=!0),i instanceof ke&&this.components.push(i);if(r&&(e=e.filter(i=>!(i instanceof mn))),e.length==0)we.smartMode&&_s.state==2?this.target="select-smart-dimension":this.target="click-canvas-blank";else{let i=null;e.forEach(n=>{if(n instanceof ke)i=this.getTarget("select-device",i);else if(n instanceof Le){let s=n.isTestPad?"select-test-pad":"select-pad";i=this.getTarget(s,i)}else n instanceof Ge?i=this.getTarget("select-track",i):n instanceof mn?i=this.getTarget("select-ratlines",i):n instanceof He?n.type=="TearDrop"?i=this.getTarget("select-teardrop",i):i=this.getTarget("select-2dline",i):n instanceof lr?i=this.getTarget("select-text",i):n instanceof Mn||n instanceof Ps?i=this.getTarget("select-image",i):n instanceof qs||n instanceof Ga||n instanceof da?i=this.getTarget("select-dimension",i):n instanceof Ue?i=this.getTarget("select-via",i):n instanceof mt||n instanceof _t?i=this.getTarget("select-2dline",i):n instanceof hh?i="select-smart-dimension":n instanceof Jr?i=this.getTarget("select-copperresult",i):i="select-blend-objects"}),i!=null?this.target=i:this.target="select-blend-objects"}}getTarget(e,r){return r==null?e:r!=e?"select-blend-objects":e}clearItems(){this.clearPadAndItemSelect(),this.selectAnnotations.length=0,this.components.length=0,this.target="click-canvas-blank",Wo.unHighlightAll(this.items),this.items.length=0}clearPadAndItemSelect(){if(uo.getInstance().selectOpen())for(let e of this.items)(e instanceof Le||e instanceof Ue)&&(e.selectItem=!1)}addPadAndItemSelect(){if(uo.getInstance().selectOpen())for(let e of this.items)(e instanceof Le||e instanceof Ue)&&(e.selectItem=!0)}canFlipDevice(){return this.items.length==this.components.length&&this.components.length!=0}lockedStatus(e=this.items){let r=new Ya(e,null,!0).items,i=!1,n=!1;for(let s of r)if(!i&&s.locked?i=!0:!n&&!s.locked&&(n=!0),i&&n)return 1;if(i)return 2;if(n)return 0}lockAll(){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e=new De("unlock all"),r=new Ya(this.items,null,!0).items;for(let i of r)if(!i.locked){let n=Ce.dispatch(i,"modify");e.addCommand(n),i.locked=!0}e.length>0&&(qe.executeCommand(e),he.publish("flushSelectingInfo",""))}unlockAllSelect(){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e=new De("unlock select all"),r=new Ya(this.items,null,!0).items;for(let i of r)if(i.locked){let n=Ce.dispatch(i,"modify");e.addCommand(n),i.locked=!1}e.length>0&&(qe.executeCommand(e),he.publish("flushSelectingInfo",""))}checkCombination(e=this.items){for(let r of e){if(r.getGroupID()!=null)return!0;{let n=r.getParent();if(n!=null&&n.getGroupID()!=null)return!0}}return!1}checkHasCustomFootprint(e=this.items){for(let r of e)if(r instanceof ke&&r.footprintUUID.indexOf("_")>-1)return!0;return!1}recoverFootprintTemplate(e=this.items){let r=[];for(let n of e)n instanceof ke&&n.footprintUUID.indexOf("_")>-1&&r.push(n.globalIndex);let i={action:"recoverFootprint",data:{id:r}};he.messageBus.publish("buttomCommand",i)}clearSelectBox(){for(let e of this.selections)e.remove();this.selections.length=0}updateSelectBox(e,r){let i=le.themeConfig.canvasTheme,n=i.isSolidLine(i.selectBoxLineStyle),s=i.selectBoxColor;if(this.selections.length>0)this.selections[0].start=new S(this.mouseLeftX,this.mouseLeftY),this.selections[0].end=new S(e,this.mouseLeftY),this.selections[1].start=new S(e,this.mouseLeftY),this.selections[1].end=new S(e,r),this.selections[2].start=new S(e,r),this.selections[2].end=new S(this.mouseLeftX,r),this.selections[3].start=new S(this.mouseLeftX,r),this.selections[3].end=new S(this.mouseLeftX,this.mouseLeftY);else{let a=new cr(1002,new S(this.mouseLeftX,this.mouseLeftY),new S(e,this.mouseLeftY),n,s),l=new cr(1002,new S(e,this.mouseLeftY),new S(e,r),n,s),c=new cr(1002,new S(e,r),new S(this.mouseLeftX,r),n,s),h=new cr(1002,new S(this.mouseLeftX,r),new S(this.mouseLeftX,this.mouseLeftY),n,s);this.selections.push(a),this.selections.push(l),this.selections.push(c),this.selections.push(h)}}leftToRight(e){let r=jt.filterElement(Vr.getSelectInside(ll(e),{boxChoose:!0,isBBox:!0}),{boxChoose:!0});return Array.from(r)}rightToLeft(e){let r=jt.filterElement(Vr.getSelectContect(ll(e),{boxChoose:!0,isBBox:!0}),{boxChoose:!0});return US(r)}dispatch(e,r,i){switch(r){case"click-canvas-blank":i.filter=vYe(e.adsorb).result;break;case"select-device":i.filter=DYe(this.checkHasCustomFootprint(),this.checkCombination(),this.lockedStatus(),e).result;break;case"select-pad":i.filter=gEe(!1,0,e,this.hasParent()).result;break;case"select-test-pad":i.filter=gEe(!0,this.lockedStatus(),e,this.hasParent()).result;break;case"select-track":i.filter=MYe(this.checkCombination(),this.lockedStatus(),e).result;break;case"select-ratlines":i.filter=kYe().result;break;case"select-via":i.filter=FYe(this.checkCombination(),this.lockedStatus(),e,this.hasParent()).result;break;case"select-2dline":i.filter=UYe(this.checkCombination(),this.lockedStatus(),e).result;break;case"select-text":i.filter=HYe(this.checkCombination(),this.lockedStatus(),e).result;break;case"select-dimension":case"select-image":i.filter=WYe(this.checkCombination(),this.lockedStatus(),e).result;break;case"select-smart-dimension":i.filter=zYe(we.adsorb).result;break;case"select-teardrop":i.filter=jYe().result;break;case"select-blend-objects":i.filter=SYe(this.lockedStatus()).result;break;case"select-copperresult":i.filter=XYe(e).result;break}}hasParent(){for(let e of this.items)if(e.getParent()!=null)return!0;return!1}rightClickMenuData(e){if(this.mouseLeftDown)return;let r={state:"show",left:e.mouseX,top:e.mouseY,filter:[]};this.dispatch(e,this.target,r),this.updateMouseRightPosition(e),this.lastClickHasCtrlKey=e.ctrlKey,$t.getInstance().menuData(r,this)}group(e){switch(e){case"COMBINATION_SELECT":he.publish("combination","");break;case"COMBINATION_CANCEL":he.publish("dissolution","");break;case"COMBINATION_JOIN":he.publish("joinCombination","");break;case"REUSE_LAYOUT_ROUTE":he.publish("tool","reuseLayoutRoute");break;case"COMBINATION_MOVE_OUT":he.publish("removeFromCombination","");break}}parse(e){let r=e.cmdKey,i=r.split(":",r.length),{targetItemBoundingRect:n}=e,s=!0;switch(i[0]){case"opensubmenu-boardshape":i[1]=="convertToBoard"?mEe():i[1]=="convertToLineFromBoard"&&rhe();break;case"ANNOTATION":To.getInstance().getNeedAnnotation()&&(To.getInstance().hasConnectItem()?To.getInstance().createAnnotationByItems():he.messageBus.publish("tool","draw(annotation)"));break;case"DELETE":this.menuDelete();break;case"COPY":this.menuCopy();break;case"copyToImage":{switch(i[1]){case"copyToSvg":he.publish("copyToSvg","");break;case"copyToPng":he.publish("copyToPng","");break}break}case"DUPLICATE":this.duplicate(i[1]);break;case"DUPLICATE_TO_CURSOR":he.publish("duplicateToCursor","");break;case"PASTE":this.paste();break;case"ENLARGE":s=!1,this.zoomIn();break;case"NARROW":s=!1,this.zoomOut();break;case"CUT":this.menuCut();break;case"ADAPT_ALL":s=!1,this.fitAll();break;case"ADAPT_SELECTED":s=!1,this.fitSelect();break;case"ADDWITH_ROUTING":this.addTrack();break;case"BATCH_FANOUT":he.publish("pcbBatchFanout","");break;case"COMBINATION":this.group(i[1]);break;case"GRID":this.grid(i[1]);break;case"SNAP_SIZE":this.snapSize(i[1]);break;case"GRIDTYPE":this.gridType(i[1]);break;case"OFFSET":he.publish("clearDimension",!0),s=!1,he.publish("offset",i[1]);break;case"RATLINES_SHOW":this.showRatlines();break;case"RATLINES_HIDE":this.hideRatlines();break;case"WIRING_CLEAR":this.menuClearRouting(i[1]);break;case"TURNOVER":he.publish("clearDimension",!0),s=!1,KEe();break;case"ROTATE":he.publish("clearDimension",!0),s=!1,this.menuRotation(i[1]);break;case"LOCKED":this.lockAll();break;case"LOCKED_CANCEL":this.unlockAllSelect();break;case"MOVE":he.publish("batchMove",i[1]);break;case"MOVE_SEQUENTIAL":this.moveSequential();break;case"CANCEL":this.menuCancel();break;case"STRETCHING":this.menuStretching();break;case"ALIGNMENT":he.publish("align",i[1]);break;case"DISTRIBUTION":he.publish("distribute",i[1]);break;case"component_distribute_by_region":he.publish("distribute","component_distribute_by_region");break;case"PACKAGE_EDIT":{this.modifyTemplate(i[1],"PcbEditFootprint");break}case"RECOVER_FOOTPRINT":{this.recoverFootprintTemplate();break}case"UPDATE_COMPONENT":{he.publish("updateComponent",{type:2,component:this.components});break}case"DEVICE_EDIT":{he.publish("pcbEditDevice",{type:2,component:this.components});break}case"SAVE_TO_LIBRARY":{let h=new Set,u=new Set,d={},p=new Set(["Device","Footprint","Designator","Unique ID"]);for(let m of this.components)if(m.footprintUUID&&u.add(m.footprintUUID),m.deviceUUID&&h.add(m.deviceUUID),!!m.deviceUUID)for(let g in m.attrsObject)p.has(g)||(d[m.deviceUUID]=d[m.deviceUUID]||{},d[m.deviceUUID][g]=m.attrsObject[g].value);he.publish("saveToLibrary",{devices:Array.from(h),footprints:Array.from(u),changeDeviceAttributes:d},Q());break}case"ATTR_LOCATION":{he.publish("attrData","");break}case"EXCHANGE_LOCATION":{he.publish("interchange","");break}case"WIRING_MODE":{Zt.getInstance().mode=i[1],we.synchronize(),he.publish("flushSelectingInfo","");break}case"INSERT_NODE":{he.publish("toggle",{command:"insertNode"});break}case"EDIT_BOUNDARY":{Bhe(this.items);break}case"GENERATE_D3_SHELL_OUTLINE":{let h=new dt;he.publish("openMainDialog",{cmd:33,data:{option:{value:h.conversion1("mm",R.getInstance().unit,5),unit:R.getInstance().unit}}});break}case"FILTER":this.filter(i[1]);break;case"HIGHLIGHT":s=!1,this.highLight(i[1]);break;case"HIGHLIGHT_CANCELALL":s=!1,this.highLight(i[0]);break;case"NET_MENU":{let h=this.items.reduce((u,d)=>((d instanceof Ge||d instanceof Le||d instanceof Ue||d instanceof mn)&&d.net&&u.add(d.net),u),new Set);switch(i[1]){case"NET_COLOR":{let u=this.items.map(p=>Ao(p)).filter(p=>!!p),d=Ye.getSpecialColor(u[0]).toString();he.publish("showColorPicker",{nets:u,color:d,targetItemBoundingRect:n},Q());break}case"new-net-class":case"new-equal-length-group":{let u=[...h].filter(d=>{let p=re.getInstance().getNet(d);return i[1].includes("net-class")?!p.netClass:!p.equalLengthGroup});he.publish("showEditNetClassDlg",{type:i[1],nets:[...u]});break}case"remove-from_net-class":case"remove-from_equal-length-group":{let u=[...h].map(d=>{let p=re.getInstance().getNet(d);if(i[1].includes("net-class")){if(p.netClass)return{netClassName:p.netClass.name,netName:d}}else if(p.equalLengthGroup)return{netClassName:p.equalLengthGroup.name,netName:d};return null}).filter(Boolean);he.publish("remove-from-net-group",{isNetClass:i[1].includes("net-class"),nets:[...u]},Q());break}case"join-net-class":case"join-equal-length-group":{let u=[...h].filter(d=>{let p=re.getInstance().getNet(d);return i[1].includes("net-class")?!p.netClass:!p.equalLengthGroup});he.publish("joinNetGroupDlg",{isNetClass:i[1].includes("net-class"),nets:[...u]});break}case"new-differentialPair":{let u=j8(),d=[...h].filter(p=>!re.getInstance().getNet(p).netDifferential);he.publish("openDifferentailPairDlg",{differentailPairName:X8(),differentailPairPositiveNet:d[0],differentailPairNegativeNet:d[1],differentailPairList:LVe(),netOptions:u},Q());break}case"delete-differentialPair":{let u=[...h].reduce((p,m)=>{let g=re.getInstance().getNet(m);return g.netDifferential&&p.add(g.netDifferential),p},new Set),d=new Array;for(let p of u)p.getAllNets().every(m=>h.has(m.name))&&d.push(p.name);he.publish("delete-differential-pair",d,Q());break}}break}case"ADDWITH_TEARS":he.publish("openTearDrop","");break;case"ADDVIA_FENCE":{he.publish("openMainDialog",{cmd:12,data:{}});break}case"SETUP_WINDOWINGAREA":this.createWindowArea();break;case"ADDWITH_EQUALLENGTHTUNING":he.publish("equalLengthTuning",!1);break;case"INCREASE_GAP":break;case"REFRESH":he.publish("Pcb/doCommand","checkDocTicket",Q());break;case"REUSE_BLOCK":he.publish("Pcb/doCommand",i[1],Q());break;case"RENUMBER":let a=Qt.getAllItem().length,l=0;this.items.forEach(h=>{h instanceof Le&&l++}),he.publish("openMainDialog",{cmd:16,data:{selectPadsNum:l,allPadsNum:a}});break;case"SELECTOVERLAP":{this.selectOverlap();break}case"SELECT":{switch(i[1]){case"OVERLAP":{let{mouseLeftX:h,mouseLeftY:u,mouseFrameX:d,mouseFrameY:p}=this.getMousePosition(),m=Vr.pointSelect(h,u,!0);m.length>0&&this.cacheMousePosition(),he.publish("openMainDialog",{cmd:18,data:{items:m,x:d,y:p}});break}case"PRIMITIV_PADPAIR":{let h=new Set;for(let u of this.items)u instanceof Ge||u instanceof Le||u instanceof Ue?new hD(u).result.forEach(p=>{h.add(p)}):u instanceof ke&&u.getPads().forEach(p=>{new hD(p).result.forEach(g=>{h.add(g)})});h=jt.filter(h),this.clearSelect(),h.forEach(u=>{u.click()}),this.select(h),h.size==0&&he.publish("ui/toastMsg",{type:"info",msg:"No pad pair found."},Q()),h.size==1?gr.model=0:h.size>1?gr.model=1:gr.model=3;break}case"CONNECT":{let h=Cje(this.items);for(let u of h){let d=pt.getTears(u.globalIndex);d!=null&&d.forEach(p=>h.add(p))}this.clearSelect(),h=jt.filter(h),h.forEach(u=>{u.click()}),this.select(h),he.publish("updateFrame",""),gr.model=1;break}case"NET":{let h=new Set,u=new Set;this.items.forEach(d=>{let p=Ao(d);p!=null?(u.add(p),Ye.getSameNetItemsWithoutPourAndPlaneZoneByItem(d).forEach(g=>{h.add(g)})):d instanceof ke&&d.getPads().forEach(g=>{u.add(g.net),Ye.getSameNetItemsWithoutPourAndPlaneZoneByItem(g).forEach(b=>{h.add(b)})})}),this.clearSelect(),Wo.highlightByNets(u,!1),h=jt.filter(h),h.forEach(d=>{d.click()}),this.select(h),gr.model=1;break}case"PRIMITIV_COMPONENT":{let h=new Set;this.items.forEach(u=>{if(u instanceof ke)h.add(u);else if(u instanceof Le){let d=u.getParent();d!=null&&h.add(d)}else if(u instanceof lr){let d=u.getParent();d!=null&&h.add(d)}else h.add(u)}),this.clearSelect(),h=jt.filter(h),h.forEach(u=>{u.click()}),this.select(h),gr.model=1;break}case"PRIMITIV_2DLINE":{let h=this.getSelects(),u=new Set;this.clearSelect(),h.forEach(d=>{let p=d.getParent();p!=null&&p instanceof He?(p.click(),u.add(p)):d instanceof He&&(d.click(),u.add(d))}),this.select(u),gr.model=1;break}case"SECOND_COMBINATION":{let h=new Set;this.items.forEach(u=>{let d=u.getGroupID();if(d==null){let p=u.getParent();p!=null&&(d=p.getGroupID())}d!=null?Ht.getItem(d).getItems().forEach(m=>{h.add(m)}):h.add(u)}),this.clearSelect(),h=jt.filter(h),h.forEach(u=>{u.click()}),this.select(h),gr.model=1;break}case"PRIMITIV_TRACK":{let h=new Set;this.items.forEach(u=>{u instanceof Ge&&new uf(u,!0).all.forEach(p=>{h.add(p)})}),this.clearSelect(),h=jt.filter(h),h.forEach(u=>{u.click()}),this.select(h),gr.model=1;break}case"CONNECTED_COPPER":{this.selectedConnectedCopper(this.mouseLeftX,this.mouseLeftY,this.lastClickHasCtrlKey,this.items);break}case"SELECT_PARENT":{let h=[];this.items.forEach(u=>{u instanceof Jr&&h.push(u.globalIndex)}),this.selectParentOfCopperResult(h);break}case"SELECT_CONNECTED_THERMALS":{this.selectThermalWhenSelectCopperFill();break}}break}case"toggleAdsorb":he.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":he.publish("openSystemDialog","ADSORPTION",Q());break;case"CHECK_OUT":he.publish("CheckInAndOut","check_out",Q());break;case"CHECK_IN":he.publish("CheckInAndOut","check_in",Q());break;case"COPPER_AREA":{this.copperFunction(i[1]);break}case"ARRAYS":{he.publish("openCreateArrayDialog","");break}case"FLIP":{he.publish("clearDimension",!0),s=!1,i[1]=="FLIP_LEFTANDRIGHT"?this.turn("turnAround"):i[1]=="FLIP_UPANDDOWN"?this.turn("turnUpsideDown"):i[1]=="FLIP_LEFTANDRIGHT_BY_REFER_POINT"?this.turn("turnAroundByReferPoint"):i[1]=="FLIP_UPANDDOWN_BY_REFER_POINT"&&this.turn("turnUpsideDownByReferPoint");break}case"ATTRIBUTE":{he.publish("openAttributePlane","",Q());break}case"IPC2552":{he.publish("Pcb/doCommand","openIpcDac2552Dlg",Q());break}case"MERGE_AS_CLOSED_OBJECT":{he.publish("mergeAsClosedLine","");break}case"DISPERSED_AS_INDEPENDENT_LIEN":{he.publish("dispersedAsIndependentLine","");break}case"boolOperation":{Fze(i[1]);break}case"SPLIT":{he.publish("tool","Split");break}case"CUTOUT":{switch(i[1]){case"CUTOUT_RECT":he.publish("tool","draw(RCutout)");break;case"CUTOUT_CIRCLE":he.publish("tool","draw(CCutout)");break;case"CUTOUT_POLYGON":he.publish("tool","draw(PCutout)");break;case"avoidPads":case"avoidSlots":he.publish("cutoutToAvoid",{type:i[1]});break}break}case"CONVERT_TO":{he.publish("convertTo",i[1]);break}case"CONVERT_TO_2D_LINE":{he.publish("convertTo",i[0]);break}case"CONVERT_TO_FILL_REGION":{he.publish("convertTo","CONVERT_TO_FILL_REGION");break}case"ADD_SOLDER_MASK":{this.createWindowArea();break}case"MERGE_PADS":let c=US(this.items.slice()).filter(h=>h instanceof Le);this.mergePads(c);break;case"LOOKUP":{he.publish("findObjects_PCB","");break}case"UNROUTE_ATTACHED_SEGMENTS":{let h=new De("UNROUTE_ATTACHED_SEGMENTS");for(let u=0;u<this.items.length;u++){let d=this.items[u];if(d instanceof ke){let p=d.getPads();for(let m=0;m<p.length;m++){let g=p[m].searchNode();for(let y=0;y<g.length;y++)g[y]instanceof Ge&&(h.addCommand(Ce.dispatch(g[y],"delete")),g[y].remove(),he.publish("delete",g[y]))}}}qe.executeCommand(h),he.publish("flushService","");break}case"UNROUTE_CONNECTIONS":{let h=new De("UNROUTE_CONNECTIONS");for(let u=0;u<this.items.length;u++){let d=this.items[u];if(d instanceof ke){let p=d.getPads();for(let m=0;m<p.length;m++){let g=OGe(p[m]);for(let y=0;y<g.length;y++)h.addCommand(Ce.dispatch(g[y],"delete")),g[y].remove(),he.publish("delete",g[y])}}}qe.executeCommand(h),he.publish("flushService","");break}case"CROSSPROBE":{pD.notifySchToCrossProbe();break}case"ADD":switch(i[1]){case"ADD_FILLET":{let u={command:"AddChamfer",items:Array.from(this.items),type:"fillet"};he.publish("toggle",u);break}case"ADD_CHAMFER":{let u={command:"AddChamfer",items:Array.from(this.items),type:"chamfer"};he.publish("toggle",u);break}case"ADDWITH_TEARS":{he.publish("openTearDrop","");break}case"SETUP_WINDOWINGAREA":{this.createWindowArea();break}case"ADDWITH_VIA":{this.addVia();break}case"ADDVIA_FENCE":{he.publish("openMainDialog",{cmd:12,data:{}});break}case"ADDWITH_TESTPOINTER":{this.addTestPad();break}case"ADDWITH_TRACK":{he.publish("tool","draw(track)");break}default:}default:s=!1;break}s&&he.publish("clearDimension","")}updateMousePosition(){this.mouseLeftX=xg.lastMouseLeftX,this.mouseLeftY=xg.lastMouseLeftY,this.mouseFrameX=xg.lastMouseFrameX,this.mouseFrameY=xg.lastMouseFrameY}updateMouseRightPosition(e){this.mouseLeftX=e.realSceneX,this.mouseLeftY=e.realSceneY,this.mouseFrameX=e.mouseX,this.mouseFrameY=e.mouseY}getMousePosition(){let e=this.mouseLeftX,r=this.mouseLeftY,i=this.mouseFrameX,n=this.mouseFrameY;return!e&&!r&&!i&&!n&&(e=this.mouseRightX,r=this.mouseRightY,i=this.mouseRightFrameX,n=this.mouseRightFrameY),{mouseLeftX:e,mouseLeftY:r,mouseFrameX:i,mouseFrameY:n}}cacheMousePosition(){xg.lastMouseLeftX=this.mouseLeftX,xg.lastMouseLeftY=this.mouseLeftY,xg.lastMouseFrameX=this.mouseFrameX,xg.lastMouseFrameY=this.mouseFrameY}selectOverlap(e){if(this.bbox)return;e=e||{},this.getSelects().length&&(e={});let i=e.realSceneX||this.mouseLeftX,n=e.realSceneY||this.mouseLeftY,s=e.mouseX||this.mouseFrameX,a=e.mouseY||this.mouseFrameY,l=Vr.pointSelect(i,n,!0);l.length&&(xg.lastMouseLeftX=i,xg.lastMouseLeftY=n,xg.lastMouseFrameX=s,xg.lastMouseFrameY=a),he.publish("openMainDialog",{cmd:18,data:{items:l,x:s,y:a}})}createWindowArea(){let e=new De("Create a windows area");this.items.forEach(r=>{if(r.getParent()instanceof He&&!(r instanceof Jr)&&(r=r.getParent()),r instanceof Ge){let i=null;if(ao(r.layerId)?i=5:2==r.layerId&&(i=6),i!=null){let n=new Po,s=new Array,a=n.clone4Shape(r.model.primitive,i,r.width);if(s.push(a),s=nm(s),s.length==0)return;let l=pt.addPolygon("Line",i,[s],r.width,"",!1);e.addCommand(Ce.dispatch(l,"add"))}}else if(r instanceof He&&(r.type=="Fill Region"||r.type=="Line")){let i=null;if(ao(r.layerId)?i=5:2==r.layerId&&(i=6),i!=null){let n=JSON.stringify(r),s=null;r instanceof Pr?s=Kt.copy(JSON.parse(n)):r instanceof rr?s=Xt.copy(JSON.parse(n)):r instanceof lt&&(s=pt.copy(JSON.parse(n))),s!=null&&(s.layerId=i,s.net="",s.fill(),e.addCommand(Ce.dispatch(s,"add")))}}else if(r instanceof He&&r.type=="TearDrop"){let i=null;if(ao(r.layerId)?i=5:2==r.layerId&&(i=6),i!=null){let n=r.getMathGraphics();if(!Qh(n.primitives))return;let a=new Po().plToShapes(n,i);if(a=nm(a),a.length==0)return;let l=pt.addPolygon("Fill Region",i,[a],0,"",!1);l.layerId=i,l.net="",l.fill(),e.addCommand(Ce.dispatch(l,"add"))}}else if(r instanceof Jr){let i;if(ao(r.layerId))i=5;else if(2==r.layerId)i=6;else return;qA.convertCopperResult2FillRegion([r],!0,e).forEach(s=>{(s.layerId!=i||!s.net)&&(e.addCommand(Ce.dispatch(s,"modify")),s.layerId=i,s.net=null)})}}),e.length>0&&(he.publish("showPcbSlideMsg",["Successfully added solder mask region!"],Q()),qe.executeCommand(e)),he.publish("flushService","")}highLight(e){if(!(!R.getInstance().isactive||23==R.getInstance().doctype)){if(e=="HIGHLIGHT_NET"){let r=this.getSelectItemsNets();this.highlight.highLightNets(r)}else if(e==="HIGHLIGHT_NET_LOOP"){let r=this.getSelectItemsNets();this.highlight.toggleHighLightNetsLoop(r)}else if(e=="HIGHLIGHT_COMPONENT")this.items.forEach(r=>{if(r instanceof ke)this.highlight.addHightItem(r);else if(r instanceof Le){let i=r.getParent();i!=null&&this.highlight.addHightItem(i)}else if(r instanceof lr){let i=r.getParent();i!=null&&this.highlight.addHightItem(i)}});else if(e=="HIGHLIGHT_SELECTED_OBJECTS")this.addHightObj(this.items);else if(e=="HIGHLIGHT_CANCEL_NET"){let r=this.getSelectItemsNets();this.highlight.unhighLightNets(r)}else if(e=="HIGHLIGHT_CANCEL_COMPONENT"){let r=new Set;this.items.forEach(i=>{if(i instanceof ke)r.add(i.globalIndex);else if(i instanceof Le){let n=i.getParent();n!=null&&r.add(n.globalIndex)}else if(i instanceof lr){let n=i.getParent();n!=null&&r.add(n.globalIndex)}}),this.highlight.unhighLightDevice(r)}else if(e=="HIGHLIGHT_CANCEL_SELECTED_OBJECTS"){let r=new Set;this.items.forEach(i=>{if(i instanceof mt||i instanceof _t){let n=i.getParent();n!=null&&n instanceof lt&&r.add(n.globalIndex)}else r.add(i.globalIndex)}),this.highlight.unhighLight(r)}else if(e=="HIGHLIGHT_CANCELALL")this.highlight.unhighLigthAll();else if(e=="INCREASE_BRIGHTNESS"){let r=R.getInstance().forceValue;r=gn(r+.1,3),r>1&&(r=1),this.highlightValue(r),he.publish("flushSelectingInfo","")}else if(e=="DECREASE_BRIGHTNESS"){let r=R.getInstance().forceValue;r=gn(r-.1,3),r<0&&(r=0),this.highlightValue(r),he.publish("flushSelectingInfo","")}he.publish("refreshHighLigth",""),he.publish("updateFrame","")}}restoreHighLight(){!R.getInstance().isactive||23==R.getInstance().doctype||this.highlight.restore()}changeHighlightValue(e){R.getInstance().forceValue=e,Pe.forceDeactive(R.getInstance().forceDeactive),he.publish("updateFrame","")}highlightValue(e){R.getInstance().forceValue=e,Pe.forceDeactive(R.getInstance().forceDeactive),np(),he.publish("restoreHight","")}stashHighLight(){!R.getInstance().isactive||23==R.getInstance().doctype||this.highlight.stash()}addHightObj(e){e.forEach(r=>{if(r instanceof mt||r instanceof _t){let i=r.getParent();i!=null&&i instanceof lt&&this.highlight.addHightItem(i)}else this.highlight.addHightItem(r)})}unHightObj(e){let r=new Set;e.forEach(i=>{if(i instanceof mt||i instanceof _t){let n=i.getParent();n!=null&&n instanceof lt&&r.add(n.globalIndex)}else r.add(i.globalIndex)}),this.highlight.unhighLight(r)}getSelectItemsNets(){let e=new Set;return this.items.forEach(r=>{if(r instanceof ke)r.getPads().forEach(n=>{e.add(n.net)}),r.getVias().forEach(n=>{e.add(n.net)});else if(r instanceof mt||r instanceof _t){let i=r.getParent();i!=null&&i instanceof lt&&e.add(i.net)}else if(r instanceof He)switch(r.type){case"Copper Region":case"TearDrop":{e.add(r.net);break}case"Fill Region":case"Line":{let i=r.model.component;if(i instanceof Zi&&i.isBridgingCopper)break;Pe.getLayer(r.layerId).isSignalLayer()&&e.add(r.net);break}}else{let i=Ao(r);i!=null&&e.add(i)}}),e}copperFunction(e){var r,i;switch(e){case"HIDE_SELECTED_COPPER_FILLS":{let n={ids:this.getSelects().map(s=>s.globalIndex),isLayer:!1,visible:!1};he.publish("toggleCopper",n),he.publish("clearSelect","");break}case"SHOW_SELECTED_COPPER_FILLS":{let n={ids:this.getSelects().map(s=>s.globalIndex),isLayer:!1,visible:!0};he.publish("toggleCopper",n);break}case"HIDE_COPPER_FILLS":{he.publish("clearSelect",""),((r=Ri.getInstance().getItem(21))==null?void 0:r.visible)==!1?(he.publish("toggleCopper",{all:!0,visible:!1,ids:[]}),he.publish("getAllItems","Copper Region")):jt.setVisible(21,!1),rE();break}case"SHOW_COPPER_FILLS":{((i=Ri.getInstance().getItem(21))==null?void 0:i.visible)==!0?(he.publish("toggleCopper",{all:!0,visible:!0,ids:[]}),he.publish("getAllItems","Copper Region")):jt.setVisible(21,!0),rE();break}case"REBUILD_SELECTED":{this.getSelects().forEach(s=>{if(s instanceof He&&s.type=="Copper Region")he.publish("rebuildSingleCopper",{ids:[s.globalIndex],isLast:!1,isManual:!0});else if(s instanceof mt||s instanceof _t){let a=s.getParent();a!=null&&a instanceof He&&a.type=="Copper Region"&&he.publish("rebuildSingleCopper",{ids:[a.globalIndex],isLast:!1,isManual:!0})}});break}case"REBUILD_ALL":{he.publish("rebuildCopper",{isManual:!0}),he.publish("rebuildPlane",{isManual:!0});break}case"RAISE_PRIORITY":{let n=new De("toHighest"),s=this.getSelects(),a=new Array;for(let l of s)l instanceof He&&l.type=="Copper Region"&&(n.addCommand(Ce.dispatch(l,"modify")),a.push(l));a.length>0&&(un.toHighest(s,n),n.openSendCopperOrder(),qe.executeCommand(n));break}case"LOWER_PRIORITY":{let n=new De("toLowest"),s=this.getSelects(),a=new Array;for(let l of s)l instanceof He&&l.type=="Copper Region"&&(n.addCommand(Ce.dispatch(l,"modify")),a.push(l));a.length>0&&(un.toLowest(a),n.openSendCopperOrder(),qe.executeCommand(n));break}case"COPPER_MANAGER":he.publish("copperAreaManagerDialog","");break}}getComponents(){return this.components}getItems(){return this.items}getItemsByBBox(e,r){return this.boxSelect(e,r,!1),this.items}getAnnotationItems(){return this.selectAnnotations}changeLayerStatus(){this.isSpecialPaste=!0,he.publish("tool","PASTE")}getCombination(e){let r=new Array;for(let i of e){let n=this.getGroupId(i);n!=null&&r.push(n)}return r}getGroupId(e){let r=e.getGroupID();if(r!=null)return r;{let i=e.getParent();if(i!=null)return this.getGroupId(i)}return null}filter(e){switch(e){case"MORE":{he.publish("setActiveTab",{tabName:"ELEMENT",determinedAsTruthClick:!0},Q());break}case"ATTRIBUTE":he.publish("openAttributePlane","",Q());case"PRIMITIV_PAD":{let r={primitive:{value:0,isChecked:!1}};he.publish("toggleElementFilter",r);let i={primitive:{value:6,isChecked:!0}};he.publish("toggleElementFilter",i);break}default:{he.publish("filterConfig",e);break}}}fitSelect(){he.publish("adaptSelect","")}zoomIn(){he.publish("zoom","in")}zoomOut(){he.publish("zoom","out")}fitAll(){he.publish("adaptAll","1")}grid(e){switch(e){case"GRID_CUSTOM":break;case"GRID_SNAP_KEEP_RATIO":{he.windowBridge.publish("toggleAndSaveUserPreferences",[],Q()),he.publish("flushSelectingInfo","");break}case"GRID_SETTING":he.publish("openSystemDialog","PCB_COMM_GRID_SIZE",Q());break;case"GRID_RANGE_SETTING":{he.publish("gridRangeSetting",{startAngle:pb(we.startAngle),endAngle:pb(we.endAngle),minRadius:eF(we.minRadius),maxRadius:eF(we.maxRadius),unit:R.getInstance().unit},Q());break}default:if(It.getInstance().currentCoord){let r=le.gridConfig[e],{gridX:i,gridY:n}=r.getSizeAccordingToUnit();he.publish("GridSetting",{gridX:`${i*10}mil`,gridY:`${n*10}mil`})}else{let r=le.polarConfig[e];le.gridSetting.polarSetting({angleDelta:r.angleDelta,milStep:r.getSizeAccordingToUnit()})}he.publish("flushSelectingInfo","");break}he.publish("flushService","")}snapSize(e){switch(e){case"GRID_SETTING":he.publish("openSystemDialog","PCB_COMM_GRID_SIZE",Q());break;case"GRID_SNAP_KEEP_RATIO":{he.windowBridge.publish("toggleAndSaveUserPreferences",[],Q()),he.publish("flushSelectingInfo","");break}default:if(It.getInstance().currentCoord){let r=le.gridConfig[e],{gridX:i,gridY:n}=r.getSizeAccordingToUnit();he.publish("SnapSizeSetting",{snapX:`${i*10}mil`,snapY:`${n*10}mil`})}break}he.publish("flushService","")}gridType(e){switch(e){case"GRID_CUSTOM":break;case"GRID_COORDINATE":It.getInstance().currentCoord=!0,he.publish("switchCoordinateBtn","cartesian",Q()),we.synchronize(),he.publish("flushSelectingInfo","");break;case"POLAR_COORDINATE":It.getInstance().currentCoord=!1,he.publish("switchCoordinateBtn","polar",Q()),we.synchronize(),he.publish("flushSelectingInfo","");break;case"GRID_TYPE_DOT":he.publish("switchGridTypeBtn","outlets",Q()),he.messageBus.publish("switchGridType","outlets");break;case"GRID_TYPE_GRID":he.publish("switchGridTypeBtn","grid",Q()),he.messageBus.publish("switchGridType","grid");break;case"GRID_TYPE_NONE":he.publish("switchGridTypeBtn","none",Q()),he.messageBus.publish("switchGridType","none");break;default:break}he.publish("flushService","")}menuCopy(){he.publish("tool","COPY")}menuCut(){he.publish("tool","CLIP")}paste(){he.publish("tool","PASTE")}menuDelete(){this.delete()}showRatlines(){he.publish("toggleSelectedRatline",{type:"allSelected",visible:!0})}hideRatlines(){he.publish("toggleSelectedRatline",{type:"allSelected",visible:!1});let e=!1,r=this.items.filter(i=>i instanceof mn?(e=!0,!1):!0);e&&(this.items=r)}menuRotation(e){if(!(!R.getInstance().isactive||23==R.getInstance().doctype)&&(e==="rotate_left"&&this.rotation(le.pcbConfig.rotate),e==="rotate_right"&&this.rotation(-le.pcbConfig.rotate),e==="rotate_reference_point")){let r=new Ya(this.items,null,!0);Is.getInstance().init(r.items,"Rotate By Reference Point",(i,n)=>{this.rotateAssociationItem=new Ya(i,null,!0);let s={items:new Ad(Array.from(this.rotateAssociationItem.items)),executeCommand:!0,commands:n.getCommand()};$n.rotateReferPoint(s,this,null,null,this.rotateReferPointCallback.bind(this))})}}rotateReferPointCallback(e,r,i,n={}){this.items.forEach(s=>{he.publish("hasModifyPcbItem",s)}),i?this.rotateAssociationItem.interrupt():this.rotateAssociationItem.complete(n.commands),this.rotateAssociationItem=null,he.publish("updateCross",""),he.publish("flushService",""),he.publish("flushSelectingInfo","")}menuClearRouting(e){switch(e){case"WIRING_CLEAR_CONNECT":he.publish("unrouteClearConnect","");break;case"WIRING_CLEAR_NET":he.publish("unrouteClearNetwork","");break;case"WIRING_CLEAR_ALL":he.publish("clearAllRoute","");break}}menuCancel(){let e=this.getSelects();e&&e.length&&this.clearSelect(),we.smartMode&&_s.exit()}menuStretching(){he.publish("tool","draw(stretchtrack)")}addVia(){if(this.items.length==1){let e=this.items[0];e instanceof Le?ut.defaultVia.net=e.net:e instanceof Ge?ut.defaultVia.net=e.net:e instanceof mn&&(ut.defaultVia.net=e.net)}else this.items.length>1&&this.items.find(r=>r instanceof Le)&&(ut.defaultVia.net=this.items[0].net);he.publish("tool","place_part(via)")}addTestPad(){if(this.items.length==1){let e=this.items[0];(e instanceof Le||e instanceof Ge)&&(ut.defalutTestPad.net=e.net)}else this.items.length>1&&this.items.find(r=>r instanceof Le)&&(ut.defalutTestPad.net=this.items[0].net);he.publish("tool","place_part(testPad)")}addTrack(){he.publish("tool","draw(track)")}turn(e){if(!(!R.getInstance().isactive||23==R.getInstance().doctype)){switch(e){case"turnAround":xo.turn(this.items,!1,!0);break;case"turnUpsideDown":xo.turn(this.items,!0,!0);break;case"turnAroundByReferPoint":xo.turnByReferPoint({items:this.items,isTurnUpsideDown:!1,executeCommand:!0},this);break;case"turnUpsideDownByReferPoint":xo.turnByReferPoint({items:this.items,isTurnUpsideDown:!0,executeCommand:!0},this);break}he.publish("flushSelectingInfo",""),gr.model=gr.model,he.publish("updateFrame","")}}selectAll(){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;this.clearSelect();let e=jt.filterElement(eOe(),{boxChoose:!0}),r=Array.from(e).filter(i=>!To.isAnnotation(i));r.forEach(i=>{i.click()}),this.selectRepeater=!1,this.select(r),this.selectRepeater=!0,gr.model=1,this.crossWindow(),this.mouseSelectedForAPI(),he.publish("updateFrame","")}closePcbPage(){this.items.length&&(this.clearSelect(),this.crossWindow(),this.mouseSelectedForAPI())}duplicate(e){switch(e){case"DUPLICATE_TO_CURSOR":he.publish("duplicateToCursor","");break;case"DUPLICATE_TO_OTHER_LAYER":he.publish("duplicateToOtherLayer","");break}}moveByReferPoint(e,r){this.toggleMove(e,r,"MOVE_BY_REFERENCE_POINT")}nextSignalLayer(e){let r=Pe.getActiveLayerID(),i=[1];for(let l=15;l<=46;l++){let c=Pe.getLayer(l);c.config&&(c.isSignalLayer()||c.isPlaneLayer())&&i.push(l)}i.push(2),e!="next"&&(i=i.reverse());let n,s=i.indexOf(r);s>=i.length-1&&(s=-1),s>-1?n=s+1:n=0;let a=i[n];he.publish("toggleLayerSelected",{layerid:a,toggleType:e})}nextLayer(e){let r=Pe.getAllConfigLayerSortByRightPanel(),i=Pe.getActiveLayerID(),n;e!=="next"&&(r=r.reverse());let s=r.findIndex(l=>l.layerID==i);s>=r.length-1&&(s=-1),s>-1?n=s+1:n=0;let a=r[n].layerID;he.publish("toggleLayerSelected",{layerid:a})}mouseSeleceMove(e,r){switch(e){case"MOVE_BY_CENTER_POINT":this.moveByCenterPoint(r);break;case"MOVE_BY_ORIGIN_POINT":this.moveByOriginPoint(r);break;case"MOVE_BY_REFERENCE_POINT":this.toggleMoveByRefer(r);break}}moveByCenterPoint(e=!1){this.toggleMove(this.mouseLeftX,this.mouseLeftY,"MOVE_BY_CENTER_POINT",e)}moveByOriginPoint(e=!1){if(this.items.length==0){he.publish("toggle",{command:"MouseSelect",cmd:"MOVE_BY_ORIGIN_POINT"});return}if(this.items.length==1){let i=this.items[0];if(i instanceof ke){let n=i.position;this.toggleMove(n.x,n.y,"MOVE_BY_ORIGIN_POINT",e);return}}he.publish("ui/toastMsg",{type:"warn",msg:"Selected elements has no origin, select a reference point and then move"},Q());let r={command:"referencePoint",program:new k2(this.items,0,0),isContinuousMode:e,msg:"Please select a reference point"};he.publish("toggle",r)}toggleMoveByRefer(e=!1){if(this.items.length==0)he.publish("toggle",{command:"MouseSelect",cmd:"MOVE_BY_REFERENCE_POINT"});else{let r={command:"referencePoint",program:new k2(this.items,0,0),isContinuousMode:e,msg:"Please select a reference point"};he.publish("toggle",r)}}toggleMove(e,r,i,n=!1){let s={command:"batchMoveItem",refer:new k2(this.items,e,r),menu:i,isContinuousMode:n};s.refer.items.length>0?he.publish("toggle",s):he.publish("toggle",{command:"MouseSelect",cmd:i})}moveSequential(){this.toggleMoveItem(this.items,this.mouseLeftX,this.mouseLeftY,"MOVE_SEQUENTIAL")}toggleMoveItem(e,r,i,n){let s={command:"BatchMoveSequentialItem",refer:new k2(e,r,i),menu:n};he.publish("toggle",s)}getType(e){let r=2;switch(e){case"ONLY_SELECT":{r=0;break}case"CURRENT_PCB":{r=1;break}case"ALL_PROJECT":{r=2;break}}return r}async modifyTemplate(e,r){let i=this.getType(e);if(i==0){let n=new Array;for(let s of this.components){let a=new ff;a.refreshService=!0;let l=a.updateCustomFootprint(s);n.push(l)}await Promise.all(n)}he.publish(r,{type:i,component:this.components}),this.clearSelect()}modifyCurrentTemplate(e){if(e.type===1){let r=Ar.getAllItem();e.action===1&&he.publish("pcbUpdateDevice",{type:1,component:r}),e.action===3&&he.publish("updateComponent",{type:1,component:r}),this.clearSelect()}else e.type===0&&(e.action===1&&he.publish("pcbUpdateDevice",{type:0,component:this.components}),e.action===3&&he.publish("updateComponent",{type:0,component:this.components}),this.clearSelect())}smartSelectionForFilterPadPairOrNet(e){let r=this.getSelects(),i=jt.filterActiveLayer(e),n=Ao(i);if(i&&n){let s=!1;if(jt.getPick(8))s=r.every(a=>Ao(a)==n);else if(jt.getPick(7)&&(i instanceof Le||i instanceof Ue||i instanceof Ge)){let a=new hD(i);a.result.size>0&&(s=r.every(l=>l instanceof Le||l instanceof Ue||l instanceof Ge?a.result.has(l):!1))}if(s)return[i]}return null}smartSelection(e,r){let i=e.filter(s=>r.includes(s)),n=this.smartSelectionForFilterPadPairOrNet(i);n&&n.length>0&&(this.onlySelect(n),gr.model=n.length>1?1:0)}selectWholeOrSingleTrack(e,r){this.initialSelect=this.items[0];let i=[],n=[],s=le.pcbConfig.realTimeTrackSelectStats=="single";this.currentPointSelectedItems.forEach(a=>{if(a instanceof Ge){let l=jt.filterTrack(a,"whole");if(l.filter(h=>this.items.includes(h)).length==1){let h=l.every(p=>this.tracks.includes(p.globalIndex)),u=this.tracks.includes(a.globalIndex)&&l.every(p=>a==p||!this.tracks.includes(p.globalIndex));i.push(...l);let d=le.pcbConfig.realTimeTrackSelectStats=="single";h?!d&&n.push(a):u?d&&n.push(...l):d?n.push(a):n.push(...l)}}else if(a instanceof lt){if(this.items.includes(a)){i.push(a);let l=a.selectChild(e,r);if(l!=null){let c=a.childrens.length==1&&a.childrens[0]==l;!this.lines.has(a.globalIndex)&&!this.lines.has(l.globalIndex)?s&&!c?n.push(l):n.push(a):c||(s?this.lines.has(l.globalIndex)&&n.push(a):this.lines.has(a.globalIndex)&&n.push(l))}else n.push(a)}}else if(a instanceof mt||a instanceof _t){i.push(a);let l=a.getParent();!this.lines.has(a.globalIndex)&&!this.lines.has(l.globalIndex)?s?n.push(l):n.push(a):this.lines.has(l.globalIndex)?n.push(a):n.push(l)}else a instanceof rr&&this.items.includes(a)&&(n.push(a),i.push(a),this.lines.has(a.globalIndex)?this.rectSelectId==null?a.selectChild(e,r):a.clearSelectChildId():s?a.selectChild(e,r):a.clearSelectChildId())}),this.items.forEach(a=>{i.includes(a)||n.push(a)}),n.push(...this.selectAnnotations),n=n.filter(a=>Mt.checkIsCanEditByItem(a)),this.onlySelect(n),this.items.length==0&&(this.lines.clear(),this.rectSelectId=null),this.currentPointSelectedItems.length=0;for(let a of this.items)a instanceof rr&&(a.isSelectChild()?console.log(`Rect is Select Child:${a.selectChildId}`):console.log("Rect is All"))}selectThermalWhenSelectCopperFill(){let e=this.items.filter(n=>n instanceof Jr&&!(n.style!="solid"&&n.copperPath.length==1)),r={};for(let n of e){let s=n.getParent();r[s.globalIndex]||(r[s.globalIndex]={coppers:[],outline:s}),r[s.globalIndex].coppers.push(n)}let i=Array.from(e);for(let n in r){let s=r[n].coppers;r[n].outline.iteratorCopper(a=>{if(s.includes(a))return;s.some(c=>nx(c.model,a.model))&&(s.push(a),i.push(a))})}this.onlySelect(new Set([].concat(this.items,i)))}mergePads(e){new hhe().mergePads(e),this.flushSelect()}crossProbe(e=this.items,r=""){let i=pD.getCrossProbeData(e);he.publish("NotifySchCrossProbe",{pcbUuid:R.getInstance().id,rule:i,selectTabId:r},Q())}classifyTrack(){if(this.tracks.length=0,this.items.every(i=>i instanceof Ge)&&(this.tracks=this.items.map(i=>i.globalIndex)),this.lines.clear(),this.rectSelectId=null,this.items.every(i=>i instanceof mt||i instanceof _t||i instanceof lt||i instanceof rr)){let i=new Set;for(let n of this.items)n instanceof rr&&n.isSelectChild()&&(this.rectSelectId=n.selectChildId),i.add(n.globalIndex);this.lines=i}}addSolderMaskRegionByTeardrop(){this.createWindowArea()}selectParentOfCopperResult(e){let r=e[0],i=jt.filterElement(eOe(),{boxChoose:!0}),n=[];i.forEach(s=>{let a=s.copperResultMap||new Set,l=!1;a.forEach(c=>{if(!l&&c.globalIndex===r){n.push(s),l=!0;return}}),s.visible()}),he.publish("clearSelect",""),this.cancel(),window.setTimeout(()=>{n.forEach(s=>{s.click()}),he.publish("select",n),he.publish("updateFrame","")})}selectNet(){jt.filterNetItems1(this.items).length>0&&he.publish("toggle",{command:"netSelect"})}closeActionDialog(){he.publish("DialogCloseByAction",{action:"display-overlap-primitive"})}cancelAllElementsHightlight(e=!1){this.highlight.unhighLigthAll(),e&&Kc().forEach(r=>{r.visible()})}setTool(e){this.tool=e}};xg.lastMouseLeftX=null,xg.lastMouseLeftY=null,xg.lastMouseFrameX=null,xg.lastMouseFrameY=null;var bG=xg;function Sxt(o){let t=o.filter(r=>r instanceof Ue);if(t.length!==1)return!1;let e=t[0];for(let r of o)if(!(r instanceof Ue||r instanceof lt&&r.type=="TearDrop"))if(r instanceof Ge){if(r.net==e.net&&e.isContains(r.layerId)&&(e.isSelect(r.start.x,r.start.y)||e.isSelect(r.end.x,r.end.y)))continue;return!1}else return!1;return!0}var OD=(function(){let o=null,t=[],e=null,r=null;return function(i,n){o||(t=ze.getSelects());let s=Sxt(t),a=new Ya(t);Is.getInstance().init(a.items,"offset Items",(l,c)=>{o&&window.clearTimeout(o),o||(e=new Ya(l),r=c,e.items.forEach(d=>{c.addCommand4Item(d,"modify")}),e.getAllRepairTracks().forEach(d=>{c.addCommand4Item(d,"modify")})),e.setUpConnectTrack(),e.moveConnectTrack(n);let h=e.itemConnectTrack;e.items.forEach(u=>{h.tracks.has(u.globalIndex)||u.transform(n)}),e.items.forEach(u=>{he.publish("hasModifyPcbItem",u)}),o=setTimeout(()=>{if(s){let u=l.filter(g=>g instanceof Ue),d=new Lr,p=aE(u,d,void 0,!0);Nl.getInstance().init();let m=Zt.getInstance().mode;["WIRING_MODE_SURROUND","WIRING_MODE_OBSTRUCT"].includes(m)?gg("freeArc"):gg("45"),zS(p,d,!1),yg(),Mi.getInstance().complete(r.getCommand()),lE()}o=null,e.complete(r.getCommand()),r.execute(),c.checkOutlinesNoExecute(Array.from(e.items),new Set),l=[],e=null,r=null,he.publish("autoFill",""),he.publish("flushService",""),he.publish("flushSelectingInfo","")},200)})}})();var ze=new bG;var tOe=class{getDefaultTopSlotDepth(){let t=this.getOutline();return t!=null?t.getComponent().shellHeight/2:CL/2}getDefaultSideSlotDepth(t){let e=this.getOutline();if(e!=null){let i=new Jt().getItem(t);if(i!=null&&i.getChildrens().length>0)return er.foot(i.getChildrens()[0][0].primitive,e.buildBBox().center()).distance1(e.buildBBox().center())}return CL/2}getDefaultSubstrateHeight(t,e){let r=new dt().conversion("mm","mil",2)/10,{shellHeight:i,botShellHeight:n}=e;return t==="T&B"&&typeof n=="number"?n-r:t==="DRAWER"&&typeof i=="number"?i*2/3-r:0}getTopInnerHeight(t,e,r){let i=e-r;return i<0?t:t<0?0:t>i?i:t}getBottomInnerHeight(t,e,r){let i=e-r;return i<0?t:t<0?0:t>i?i:t}getOutline(){let t=[].concat(Kt.getAllItem(),Xt.getAllItem(),pt.getAllItem());for(let e of t)if(e.type==="3D Shell - Outline")return e;return null}},XS=new tOe;var tP=class{modifyName(t,e){return!1}syncLatestData(t){}updateModelLatestData(t){}};var Ghe=class extends tP{syncLatestData(t){Gf.syncProhibitData(t)}updateModelLatestData(t){Gf.updateProhibitComponent(t)}};var Uhe=class extends tP{modifyName(t,e){let r=Z0.getInstance();return e!=t.name&&!r.hasName(e)?(r.deleteName(t.name),Z0.getInstance().addName(e),!0):!1}};var Hhe=class extends tP{syncLatestData(t){Gf.syncFillData(t)}updateModelLatestData(t){Gf.updateFillComponent(t)}modifyName(t,e){return Ti.nameManager.has(e)?!1:(Ti.nameManager.deleteNum(t.name),Ti.nameManager.add(e),!0)}};var Whe=class extends tP{syncLatestData(t){Gf.syncD3ShellScrewPillarData(t)}};var zhe=class extends tP{syncLatestData(t){Gf.syncD3ShellSlotRegionComponentData(t)}};var Yhe=class extends tP{modifyName(t,e){return e!=t.name&&!bo.getInstance().hasName(e)?(bo.getInstance().deleteName(t.name),bo.getInstance().addName(e),!0):!1}};function Ob(o){o instanceof Fu?o.setWatcher(new Ghe):o instanceof Dh?o.setWatcher(new Uhe):o instanceof xn?o.setWatcher(new Hhe):o instanceof Rf?o.setWatcher(new Whe):o instanceof wh?o.setWatcher(new zhe):o instanceof ac&&o.setWatcher(new Yhe)}function a1(o,t){let{type:e,layerId:r,strokeWidth:i=.1}=t;switch(e){case"Prohibited Region":{let{device:n,track:s,copper:a,fill:l,planzone:c}=Gf.prohibitComponent;return new Fu(n,s,a,l,c)}case"Constraint Region":{let n=Z0.getInstance().getName();return Z0.getInstance().addName(n),new Dh(n)}case"Copper Region":{let n=Ti.nameManager.getNum("pour1");Ti.nameManager.add(n);let{style:s,gridLineWidth:a,clearance:l,keepIsland:c,optimization:h,optimizationValue:u}=Gf.fillComponent,d=un.getNextOrders4Layer(r);return new xn(s,a,l,c,h,n,d,u)}case"Fill Region":{let n="",s=ze.getSelects();return s.length===1&&s[0]instanceof Le&&(n=s[0].globalIndex),new Zi(n)}case"FPC Stiffener":{let{material:n,fpcModel:s}=td.default,a=new tu(n,s);return td.correctAllProps(a),a}case"3D Shell - Outline":{let n=i;return new y0("T&B",CL,0,0,n)}case"3D Shell - Screw Pillar":{if(o===0){let n=r===55,s=r!==55,{specification:a}=Gf.d3ShellScrewPillarComponent,l=new Rf(a,S1.getDefaultScrewHeight(r));return xP.updatePropsBySpecification(l,a,n,s),l}break}case"3D Shell - Side Slot Region":{let n,s=Fc.getBaseLine();s&&(n=s.globalIndex);let a=XS.getDefaultSideSlotDepth(n),{slotOption:l}=Gf.d3ShellSlotRegionComponent;return new wh("Side",a,l,n)}case"3D Shell - Top Slot Region":{let n=XS.getDefaultTopSlotDepth(),{slotOption:s}=Gf.d3ShellSlotRegionComponent;return new wh("Top",n,s,null)}case"3D Shell - Top/Bottom Entity":{let n=XS.getDefaultTopSlotDepth();return new ml("top_bottom",n,null)}case"3D Shell - Side Entity":{let n,s=Fc.getBaseLine();s&&(n=s.globalIndex);let a=XS.getDefaultTopSlotDepth();return new ml("side",a,n)}case"TearDrop":return new Sb([]);case"Annotation":return new dx;case"Partition":{let n=bo.getInstance().getName();return bo.getInstance().addName(n),new ac(n)}default:return}}function J0(o,t,e){switch(o){case"Prohibited Region":return t instanceof Fu;case"Constraint Region":return t instanceof Dh;case"Copper Region":return t instanceof xn;case"Fill Region":return t instanceof Zi;case"FPC Stiffener":return t instanceof tu;case"3D Shell - Outline":return t instanceof y0;case"3D Shell - Screw Pillar":return t instanceof Rf;case"3D Shell - Top Slot Region":case"3D Shell - Side Slot Region":return t instanceof wh;case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":return t instanceof ml;case"TearDrop":return t instanceof Sb;case"Annotation":return t instanceof dx;case"Partition":return t instanceof ac;default:return t==null}}var Pr=class extends He{constructor(e){super();this._notShowFill=!1;if(this.model=e,e.setModelWatcher(this),this.layerId=xm(this.type,this.layerId,0),this.net=ru(this.net,this.layerId,this.type),J0(this.type,this.model.component,this.model.layerId)||(this.model.component=a1(0,this.model)),this.type==="Constraint Region"){let r=re.getInstance().addConstraintSelector(this.globalIndex);Pp.getInstance().publish("modify",r)}Ob(this.model.component),this.initRefreshRender()}get component(){return this.getComponent()}get color(){return super.color||oA.getLineColor(this)}set color(e){super.color=e,this.refreshRender()}get type(){return this.model.type}set type(e){if(this.model.type!=e){if(this.hiddenCopperResult=!1,this.model.type=="Copper Region"?(Ti.nameManager.deleteNum(this.component.name),this.deleteRegionRuleSelector()):this.model.type==="Constraint Region"&&(Z0.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()),e==="Constraint Region"){let i=re.getInstance().addConstraintSelector(this.globalIndex);Pp.getInstance().publish("modify",i)}let r=this.model.type;this.model.type=e,this.model.component=a1(0,this.model),this.layerId=xm(e,this.layerId,0),this.strokeWidth=qk(this.strokeWidth,this.model.type,r),this.net=ru(this.net,this.layerId,this.type),Ob(this.model.component),this.refreshRender()}}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId=xm(this.type,e,0,this.layerId),this.checkRegion(0),this.refreshRender()}get strokeWidth(){return this.model.strokeWidth}set strokeWidth(e){this.model.strokeWidth=e,this.type=="3D Shell - Outline"&&(this.component.shellThickness=this.strokeWidth),this.refreshRender()}get center(){return this.model.center}set center(e){this.model.center=e,this.refreshRender()}get radius(){return this.model.radius}set radius(e){this.model.radius=e,this.refreshRender()}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get primitive(){return q.build2(this.center,0,360,this.radius,this.radius,ae.CCW)}get net(){var e;return(e=this.model.net)==null?void 0:e.toUpperCase()}get showNet(){return this.model.net}set net(e){if(this.net!=e){Ye.delete(this),this.model.net=e;let r=Pe.getLayer(this.layerId);r&&r.isSignalLayer()&&Ye.addItem(this),this.refreshRender()}}get start(){return new S(this.center.x-this.radius,this.center.y)}get viewColor(){var n,s;let e=this.color,r=(s=(n=le)==null?void 0:n.themeConfig)==null?void 0:s.canvasTheme;r&&(e=r.getRegionColor(this,e));let i=Mt.getTransparencyByPcbType(this,e);return e!=null&&i!=null&&e.alpha!=i&&(e=ee.of6(e,i)),e}get fillColor(){var n,s;let e=super.color||oA.getFillColor(this),r=(s=(n=le)==null?void 0:n.themeConfig)==null?void 0:s.canvasTheme;r&&(e=r.getRegionColor(this,e));let i=Mt.getTransparencyByPcbType(this,e);return i!=null&&e.alpha!=i&&(e=ee.of6(e,i)),e}get partitionName(){return this.component instanceof ac?this.component.name:""}get constrainName(){return this.component instanceof Dh?this.component.name:""}get fpcMaterial(){return this.component instanceof tu?this.component.material:""}get fpcThickness(){return this.component instanceof tu?this.component.thickness:""}get viewGroupId(){return this.model.component instanceof Zi&&this.model.component.isBridgingCopper?this.model.modelType+null:this.model.modelType+this.net}get viewGroupIdModified(){return this.netModified}getShape(){return this.model}fill(){this.isEmpty||!this.notShowFill||(this.notShowFill=!1,this.refreshRender())}removeFill(){this.notShowFill=!0,this.refreshRender()}setCustomColor(e){this.color=e}getComponent(){return this.model.component}setComponent(e){J0(this.type,e,this.model.layerId)&&(this.model.component=e,Ob(this.model.component))}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.transform(i)}visible(e=!1){this.fill(),super.visible(e)}hidden(){this.fill(),super.hidden()}click(e=!1,r=!1){this.fill(),super.click(e,r)}remove(){this.type=="Copper Region"?(Ti.nameManager.deleteNum(this.component.name),this.clearCopper(),this.deleteRegionRuleSelector()):this.type=="Constraint Region"?(Z0.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()):this.type=="Partition"&&(bo.getInstance().deleteName(this.component.name),this.deleteRegionRuleSelector()),super.remove()}transform(e){this.removeFill(),this.model.transform(e),this.refreshRender()}refreshRender(){var e;this.model!=null&&((e=Pe.getLayer(57))!=null&&e.visible)&&this.iteratorRatlines(i=>{i.isVisible&&(i.startNode==this&&!i.start.equals(this.start)&&(i.start=this.start,i.click()),i.endNode==this&&!i.end.equals(this.start)&&(i.end=this.start,i.click()))}),super.refreshRender()}isSelect(e,r,i){if(this.getParent()!=null)return!1;let n=this.model.inShape(e,r,i?Ai():void 0);return this.type=="Copper Region"&&(this.needShowOutline()||(n=!1)),this.type=="Copper Region"&&this.isHighLight?n||this.isInInnerArea(e,r):n}isInInnerArea(e,r){return this.model.InnerArea(e,r)}isSelectOnlyLine(e,r){return!this.isVisible||this.getParent()!=null?!1:this.model.isSelectOnlyLine(e,r)}isInProfile(e,r){return this.isVisible?this.model.inShape(e,r):!1}isSignalLayer(){throw new Error("Method not implemented.")}buildBBox(){return this.model.buildBBox()}toJSON(){var s;let e;this.type==="Constraint Region"&&(e=re.getInstance().getRegion(this.globalIndex).clone());let r=this.getComponent(),i=r&&typeof r.toJSON=="function"?r.toJSON():null;return{globalIndex:this.globalIndex,partition:this.partition,type:this.type,layerId:this.layerId,center:this.center,radius:this.radius,strokeWidth:this.strokeWidth,locked:this.locked,net:this.net,silkColor:((s=this.silkColor)==null?void 0:s.toString())||null,componentData:i,regionRuleSelector:e}}getType(){return 3}getMathGraphics(e=this.layerId,r=0){return this.isEmpty?null:this.layerId==e||ar(this.layerId)||11==this.layerId?ge.build2([q.build2(this.center,0,360,this.radius+r,this.radius+r,ae.CCW)]):null}getViewState(){return this.isEmpty?"Not Shown":this.isVisible?this.notShowFill?this.needShowOutline()?"Not Show Fill":"Not Shown":this.isHighLight?"Main And Highlight":this.needShowOutline()?"Only Main":"Not Shown":"Not Shown"}};var l_=class o extends Zx{constructor(e,r={}){super(0);this.title="Warning";this.msg=e,this.extra=r}equal(e){return e instanceof o&&this.type==e.type&&this.msg==e.msg}open(e){return{type:this.type,option:{msg:this.msg,title:this.title},extra:this.extra}}close(e){}};function wq(o,t){if(o==1||o==2||Es(o)){let e=re.getInstance().getAllBlindPhysics();for(let r of e){let i=r.getAllVias();for(let n of i)n.isContains(o)&&(n.status.setVisible(o,t),C2.getInstance().setLayer(n.name,n.status.isVisible()))}}}function Kc(){let o=new Array,t=Qt.getAllItem(),e=Ar.getAllItem(),r=pr.getAllItem(),i=Wr.getAllItem(),n=pt.getAllItem(),s=Xt.getAllItem(),a=Kt.getAllItem(),l=ri.getAllItem(),c=os.getAllItem(),h=Yo.getAllItem(),u=jo.getAllItem(),d=Bn.getAllItem(),p=So.getAllItem();return t.forEach(m=>{m.getParent()==null&&o.push(m)}),e.forEach(m=>{m.getParent()==null&&o.push(m)}),r.forEach(m=>{m.getParent()==null&&o.push(m)}),i.forEach(m=>{m.getParent()==null&&o.push(m)}),n.forEach(m=>{m.getParent()==null&&o.push(m)}),s.forEach(m=>{m.getParent()==null&&o.push(m)}),a.forEach(m=>{m.getParent()==null&&o.push(m)}),l.forEach(m=>{(m.key!=""||m.getParent()==null)&&o.push(m)}),c.forEach(m=>{m.getParent()==null&&o.push(m)}),h.forEach(m=>{m.getParent()==null&&o.push(m)}),u.forEach(m=>{m.getParent()==null&&o.push(m)}),d.forEach(m=>{m.getParent()==null&&o.push(m)}),p.forEach(m=>{m.getParent()==null&&o.push(m)}),o}function rOe(o){Qt.iterator(o),Ar.iterator(o),pr.iterator(o),Wr.iterator(o),pt.iterator(o),Xt.iterator(o),Kt.iterator(o),ri.iterator(o),os.iterator(o),Yo.iterator(o),jo.iterator(o),Bn.iterator(o),So.iterator(o),Ti.iterator(o),zn.iterator(o)}function eOe(){let o=new Array;return kt.itoratorAllItems(t=>{let e=t.item;e.isEmpty||o.push(e)}),o}function rD(){return Qt.getAllItem()}function aze(){let o=new Set,t=YX(),e=new _e,r;if(t){let O=t.width()*5,_=t.height()*5,x=t.minX-O,v=t.maxX+O,D=t.minY-_,w=t.maxY+_;e.ext5(x,v,D,w),r=e.build1()}let i=new _e,n=Qt.getAllItem(),s=Ar.getAllItem(),a=pr.getAllItem(),l=Wr.getAllItem(),c=pt.getAllItem(),h=Xt.getAllItem(),u=Kt.getAllItem(),d=ri.getAllItem(),p=os.getAllItem(),m=Yo.getAllItem(),g=jo.getAllItem(),y=Bn.getAllItem(),b=So.getAllItem(),P=Ti.getAllItem(),T=[...n,...s,...a,...l,...c,...h,...u,...d,...p,...m,...g,...y,...b,...P],I=new Set,C=si.getInstance().getDefaultPanelize();for(let O of T){if(O.type=="Board Outline"||O.type=="Line"&&O.layerId==11||O instanceof lr&&!O.showKey&&!O.showValue)continue;let _=O.buildBBox();if(i.ext1(_),r)if(!_.isInside(r))o.add(O),O instanceof ke&&I.add(O);else continue;if(C.success&&!C.onlyOutline){let x=si.getInstance().offset,v=C.row,D=C.column;for(let w=0;w<v;w++)for(let F=0;F<D;F++){if(w===0&&F===0)continue;let H=Ae.translate(x.x*F,x.y*w,0);O.transform(H),_=O.buildBBox(),i.ext1(_),r&&(_.isInside(r)||(o.add(O),O instanceof ke&&I.add(O)));let z=Ae.translate(-x.x*F,-x.y*w,0);O.transform(z)}}}let E=Array.from(o).filter(O=>O.getParent()?!I.has(O.getParent()):O);return i.valid()?{allItemBbox:i.build1(),outOfBoardBBoxItems:E}:{allItemBbox:null,outOfBoardBBoxItems:E}}function of(){let o=new _e;io.getInstance().getAllItem().forEach(r=>{if(r.getText()!=""){let i=r.buildBBox();i&&o.ext1(i)}});let e=kt.getIgnoreTextBBox();return e&&(o.ext1(e),o.valid())?o.build1():null}function Eje(){var t;let o=si.getInstance();return(t=o.getDefaultPanelize())!=null&&t.success?ht.extend2(o.bbox,of()):of()}function sV(){let o=Au(),t=new _e;for(let e of o){let r=e.getMathGraphics();t.ext1(r.bbox())}return t.valid()?t.build1():null}function ZWe(){let o=Au(),t=new S(0,0).sub(R.getInstance().origin),e=Qe.translate1(t),r=sV().transform(e);if(!r)return[];let i=[];o.forEach(p=>xe.addAll(i,p.getMathGraphics().primitives.map(m=>m.multiply3(e))));let s=new $c(r.extendOfSize(10),2,.1,new Di(4),i).detect(),a=new Array;for(let p of s.items)nh(p)&&(p=p.reverse()),V1.getExtendPolyLine(p,-3).forEach(m=>a.push(m));let l=[];for(let p of a)p.points(1,m=>{l.push(m)});let c=l[0],h=l[0],u=l[0];for(let p=1;p<l.length;p++){let m=l[p];(m.x<c.x||m.x===c.x&&m.y<c.y)&&!Od(m,h)&&!Od(m,u)&&(c=m),(m.x<h.x||m.x===h.x&&m.y>h.y)&&!Od(m,c)&&!Od(m,u)&&(h=m),(m.x>u.x||m.x===u.x&&m.y>u.y)&&!Od(m,c)&&!Od(m,h)&&(u=m)}if(Od(c,h)||Od(h,u)||Od(c,u))for(let p of l)Od(c,h)&&!Od(p,c)&&p.y>h.y&&(h=p),Od(h,u)&&!Od(p,h)&&p.x>u.x&&(u=p),Od(c,u)&&!Od(p,u)&&p.x+p.y<c.x+c.y&&(c=p);let d=si.getInstance().getDefaultPanelize();if(d.success&&!d.onlyOutline&&(d.column>1||d.row>1)){let p=si.getInstance().offset;if(d.row==1){let m=Qe.translate1(new S(p.x*(d.column-1),p.y*(d.row-1)));u=c.multiply3(m)}else if(d.column==1){let m=Qe.translate1(new S(p.x*0,p.y*(d.row-1)));h=c.multiply3(m)}else{let m=Qe.translate1(new S(p.x*0,p.y*(d.row-1)));h=c.multiply3(m);let g=Qe.translate1(new S(p.x*(d.column-1),p.y*(d.row-1)));u=c.multiply3(g)}}return[c,h,u]}function YX(){let o=Au(),t=new _e;for(let e of o){let r=e.getMathGraphics();t.ext1(r.bbox())}if(si.getInstance().getDefaultPanelize().success){let e=si.getInstance().outerBBox;t.ext1(e)}return t.valid()?t.build1():null}function JWe(){let o=Xt.getAllItem().filter(n=>n.layerId==56),t=Kt.getAllItem().filter(n=>n.layerId==56),e=pt.getAllItem().filter(n=>n.layerId==56),r=ri.getAllItem().filter(n=>n.layerId==56),i=Bn.getAllItem().filter(n=>n.layerId==56);return!!(o.length||t.length||e.length||r.length||i.length)}function Ije(o){if(o instanceof Ge)return pr;if(o instanceof _i)return Qt;if(o instanceof Ue)return Wr;if(o instanceof Pr)return Kt;if(o instanceof rr)return Xt;if(o instanceof lr)return ri;if(o instanceof Ga)return os;if(o instanceof qs)return Yo;if(o instanceof da)return jo;if(o instanceof ke)return Ar;if(o instanceof lt)return pt;if(o instanceof mt)return pt;if(o instanceof _t)return pt;if(o instanceof sn)return Qt;if(o instanceof Mn)return Bn;if(o instanceof Gi)return zn;if(o instanceof Jr)return Ti;if(o instanceof Ps)return So}function vR(){let o=new Array;return pt.getAllItem().forEach(i=>{i.type=="Copper Region"&&o.push(i)}),Xt.getAllItem().forEach(i=>{i.type=="Copper Region"&&o.push(i)}),Kt.getAllItem().forEach(i=>{i.type=="Copper Region"&&o.push(i)}),o}function Au(){let o=new Array;return[vi.getInstance().getAllItem(),Qi.getInstance().getAllItem(),Fi.getInstance().getAllItem()].forEach(t=>{t.forEach(e=>{!e.isEmpty&&(e.type=="Board Outline"||e.type=="Line"&&e.layerId==11)&&o.push(e)})}),o}function QVe(){let o=new Array;return[pt.getAllItem(),Xt.getAllItem(),Kt.getAllItem()].forEach(t=>{t.forEach(e=>{!e.isEmpty&&(e.type=="Board Outline"||e.type=="Line"&&e.layerId==11)&&o.push(e)})}),o}function yF(){let o=new Array;return[vi.getInstance().getAllItem(),Qi.getInstance().getAllItem(),Fi.getInstance().getAllItem()].forEach(t=>{t.forEach(e=>{!e.isEmpty&&e.type=="Slot Region"&&o.push(e)})}),o}function dG(o){if(o instanceof mt||o instanceof _t||o instanceof lt){let t;return o instanceof lt?t=o:t=o.getParent(),t.isClose()?2:3}return 2}function jhe(){pr.recycle(),Qt.recycle(),Wr.recycle(),Kt.recycle(),Xt.recycle(),ri.recycle(),os.recycle(),Yo.recycle(),jo.recycle(),Ar.recycle(),pt.recycle(),Bn.recycle(),Ti.recycle(),zn.recycle(),jy.recycle(),Ye.recycle(),Ht.recycle(),Hu.recycle(),Pe.recycle(),kt.recycle()}function ys(o){let t=new _e;return o.forEach(e=>{t.ext1(e.buildBBox())}),t}function Hze(o){return o instanceof _t||o instanceof mt?[o.start,o.end]:o instanceof lt?[o.start,o.end]:o instanceof LV?[o.start,o.end]:null}function YVe(o,t){let e=[{point:o.center.add(new S(-o.radius,0)),distance:0,order:3},{point:o.center.add(new S(o.radius,0)),distance:0,order:1},{point:o.center.add(new S(0,-o.radius)),distance:0,order:2},{point:o.center.add(new S(0,o.radius)),distance:0,order:4}];for(let a of e)a.distance=t.distance1(a.point);e=e.sort((a,l)=>a.distance-l.distance);let r=e[0].order,i=e[1].order,n=e[0].point,s=e[1].point;return r<i?r==1&&i==4&&(n=e[1].point,s=e[0].point):(r!==4||i!==1)&&(n=e[1].point,s=e[0].point),[n,s]}function Jx(){let o=Ai(),t=o.getWidth(),e=o.getHeight(),r=new S(0,0),i=new S(t,-e),n=new S(t/2,-e/2),s=r.sub(n),a=i.sub(n),l=s.multiply4(o.get2dCameraMatrix().inverse()),c=a.multiply4(o.get2dCameraMatrix().inverse());return new _e().ext2(l).ext2(c).build1()}function Oje(){let o=Wr.getAllItem(),t={};for(let e of o)if(e.type==1){let r=re.getInstance().getNet(e.net),n=re.getInstance().getDefaultBlindPhysics().name,s=t[n];s==null&&(s={},t[n]=s);let a=s[e.name];a==null&&(a=[],s[e.name]=a),a.push(e)}return t}function Aje(){let o=Wr.getAllItem();for(let e of o)if(e.type==1){let i=re.getInstance().getDefaultBlindPhysics().getBlindVia(e.name);i!=null&&i.status.used.add(e.globalIndex)}let t=Pe.getAllCopperLayer();for(let e of t)wq(e.layerID,e.visible)}function G3(o,t){let e=ri.getAllItem();e=e.filter(n=>n.key!=""&&!n.showKey&&!n.showValue);let r=t||new De("modify Frame Origin"),i=new bF;r.addCommand(i),R.getInstance().doctype==4&&e.forEach(n=>{r.addCommand(Ce.dispatch(n,"modify"));let s=n.position.sub(R.getInstance().origin).add(o);n.position=s}),!t&&qe.executeCommand(r),R.getInstance().origin=o,np()}function c5(o,t,e=.5){if(o.length==0)return o;let r=t*e,i=r*(Math.sqrt(2)/2),n=[o[0]];for(let s=1;s<o.length;s++){let a=n[n.length-1],l=o[s],c=o[s+1],h=!1;if(a instanceof M&&a.length()>=1e-8&&l instanceof M){let u=a.direct,d=a,p=null;if(Math.abs(u.dot(l.direct))<1e-4?p=l:c instanceof M&&Math.abs(u.dot(c.direct))<1e-4&&(p=c,s++),p){let m=d.direct,g=p.direct,y=p.start().sub(d.end()),b=Math.abs(m.dot(y)),P=Math.abs(g.dot(y)),T=d.length()+b,I=p.length()+P,C=Math.min(T,I),E=Math.max(b,P);if(C>=r+i+1e-8)E=Gke(E,i,C-r).value;else{E=Math.max(E,C-r);let v=t*.5,D=r*(Math.sqrt(2)/2);if(E<D){let w=v/3;if(C-D>=w)E=D;else{E=C;let F=n[n.length-2],H=o[s+1],z=!1;if(F instanceof M&&T-E<w&&Math.abs(F.direct.dot(m))<=1e-8&&(z=!0),H instanceof M&&I-E<w&&Math.abs(H.direct.dot(g))<=1e-8&&(z=!0),z){let V=D/(v+D);E=C*V}}}}let O=d.start().add(m.mul(T-E)),_=p.end().sub(g.mul(I-E)),x=ge.build4([d.start(),O,_,p.end()]);n.pop(),n.push(...x.primitives),h=!0}}h||n.push(l)}return n}function Ext(o){if(o.primitives.length<2)return ge.build2(o.primitives);let t=o.primitives[0],e=new Array;for(let r=1;r<o.primitives.length+1;r++){let i=o.primitives[r],n=!1;if(i instanceof M&&t instanceof M){let s=t.direct,a=i.direct;n=Math.abs(s.cross(a))<1e-8&&s.dot(a)>=0}n?(e.pop(),t=new M(t.start(),i.end()),e.push(t)):(e.push(t),t=i)}return ge.build2(e)}function Oxt(o,t,e){let r=o.layerId,i=o.getMathGraphics(r,0),n=o.strokeWidth,s=o.locked,a=o.net,l=o.type;Object.is(e,void 0)&&(e=l!="Line");let c;if(i instanceof ge&&!Qh(i.primitives,1e-5)){let{unclose:d,close:p}=vxt(i);c=[],p!=null&&(c=hI(p)),c.push(d)}else c=(i instanceof Bt?i.items:[i]).map(d=>hI(d)).flat(2);c=c.map(d=>Ext(d)),t&&(t.addCommand(Ce.dispatch(o,"delete")),A.publish("delete",o),o.remove());let h=[],u=new Po;return c.forEach(d=>{if(e&&!d.isClose()||d.isClose()&&d.primitives.length==2&&d.primitives[0]instanceof M&&d.primitives[1]instanceof M||Bu(l)&&!Qh(d.primitives))return;let p=nm(u.plToShapes(d,r,n,s));if(p.length==0)return;let m=pt.addPolygon(l,r,[p],n,a,s);m.fill(),h.push(m),m.type=="Copper Region"&&un.addOrder(m,t),t&&(t.addCommand(Ce.dispatch(m,"add")),A.publish("hasModifyPcbItem",m))}),A.publish("ui/toastMsg",{type:"info",msg:"There is a self-intersection and will be split automatically"},Q()),h}function lm(o,t,e){let r=o.getMathGraphics();if(r instanceof ge)return Oxt(o,t,e);let i=r.items.filter(d=>!nh(d))[0],n=r.getOutMostPolyline(),s=i;if(n!=i){let{relation:d}=new As(s,n,0);d==2&&(s=n)}let l=new Ec().getSubtraction([s],r.items.filter(d=>d!=s),[2,0]),c=o,h=[],u=new Mh;return l.forEach(d=>{let p=u.create4PlGrp(c.type,c.layerId,d,c.strokeWidth,c.net,!1);if(t){let m=Ce.dispatch(p,"add");t&&t.addCommand(m)}h.push(p)}),t&&(t.addCommand(Ce.dispatch(o,"delete")),A.publish("hasModifyPcbItem",o),o.remove(),A.publish("delete",o)),A.publish("ui/toastMsg",{type:"info",msg:"There is a self-intersection and will be split automatically"},Q()),h}function Rhe(o,t,e){let r=o.layerId,i=o.getMathGraphics(r,0),n=o.getParent(),s=-1;o.num&&(s=parseInt(o.num)||s);let a=hI(i),l=[];a.forEach(h=>{if(h.primitives.length<=1||!h.isClose()||h.primitives.length==2&&h.primitives[0]instanceof M&&h.primitives[1]instanceof M)return;let u=h,d=new Wf(u.primitives),p=u;p.area()>0&&(p=p.reverse());let m=Lo.getStyle("POLYGON",-1,-1,-1,p),g=null,y=null,b=null,P=null;r===1?g=m:r===2?y=m:(g=m,y=m.clone(),b=m.clone(),P=nc.getHoleStyle(d.high*.6,d.high*.3,"ROUND",0,S.ORIGIN));let T=o.padRule?o.padRule.clone():void 0,I=jn.getInstance().addPad(nr(),r,1,s>-1?(s++).toString():o.num,d.center,o.rotation,o.locked,o.showNet,o.expansionType,o.pasteExpansion,o.topSolderExpansion,o.bottomSolderExpansion,o.unusedInnerLayers,o.plated,g,y,b,P,T);l.push(I)});let c=new Array;if(n!=null&&n instanceof ke){t&&t.addCommand(Ce.dispatch(n,"modify")),A.publish("hasModifyPcbItem",n);for(let h of l){h.globalIndex=n.globalIndex+h.globalIndex;let u=Qt.addPolygonPadByModel(h);u.fill(),n.updatePads(u,"add"),c.push(u),A.publish("hasModifyPcbItem",u)}}else for(let h of l){let u=Qt.addPolygonPadByModel(h);u.fill(),c.push(u),t&&(t.addCommand(Ce.dispatch(u,"add")),A.publish("hasModifyPcbItem",u))}return t&&(e!=null&&e.onlyMove||(n&&n instanceof ke?n.updatePads(o,"delete"):t.addCommand(Ce.dispatch(o,"delete")),A.publish("hasModifyPcbItem",o)),o.remove(),A.publish("delete",o)),A.publish("ui/toastMsg",{type:"info",msg:"There is a self-intersection and will be split automatically"},Q()),c}function Bb(o,t){let e=Ze.getInstance().getLayer(t);e==null&&(e=Ze.getInstance().getHelpLayer(t));let r=e==null?void 0:e.activeColor,i=new Array;for(let n of o)if(n instanceof M)i.push(new cr(1002,n.start(),n.end(),!1,r));else if(n instanceof q)i.push(gs.build(1002,n.center,n.rx,Xh(n.startAngle),Xh(n.endAngle()),n.sweep(),r));else if(n instanceof Dr){let s=n.points(.1),a=s[0];for(let l=1,c=s.length;l<c;l++){let h=s[l];i.push(new cr(1002,a,h,!1,r)),a=h}}return i}function ace(o,t=!0,e,r,i=!0){if(!R.getInstance().isactive||R.getInstance().doctype!==3)return;o=o||new De("Clear all route!");let n=[],s=[],a=[];e?e==="track"?(n=pr.getAllItem(),xe.addAll(a,n)):e==="via"&&(s=Wr.getAllItem(),xe.addAll(a,s)):(n=pr.getAllItem(),s=Wr.getAllItem(),xe.addAll(a,[].concat(s,n)));for(let l=0;l<n.length;l++){let c=n[l];c.getParent()==null&&!c.locked&&!xs(c.model)&&(!r||r.includes(c.net))&&(o.addCommand(Ce.dispatch(c,"delete")),A.publish("hasModifyPcbItem",c),c.sendDeleteMsg=!1,c.remove(),A.publish("delete",c))}for(let l=0;l<s.length;l++){let c=s[l];c.locked||xs(c.model)||c.getParent()==null&&(!r||r.includes(c.net))&&(o.addCommand(Ce.dispatch(c,"delete")),A.publish("hasModifyPcbItem",c),c.sendDeleteMsg=!1,c.remove(),A.publish("delete",c))}t&&qe.executeCommand(o),i&&A.publish("flushService",""),A.publish("clearSelect","")}function _je(o){let t=o.net?Ye.getSameNetItems(o.net):Axt(o),e=new Set;for(let n of t)n instanceof Qo&&e.add(n);let r=new Set(o.searchNowNode()),i=new Set;for(let n of r)e.delete(n),i.add(n);for(r.add(o),e.delete(o);i.size>0&&e.size>0;)for(let n of i){let s=n.searchNowNode();s=_xt(s);for(let a of s)r.has(a)||a instanceof Le||(i.add(a),r.add(a),i.has(a)||e.delete(a));i.delete(n);break}return r}function Axt(o){let t=o.searchAllConnectNode(),e=new Array;for(let r of t)r instanceof Ge&&e.push(r);return e}function Cje(o){let t=new Set,e=new Map;for(let i of o)if(i instanceof Qo){let n=e.get(i.net);n==null&&(n=new Set,e.set(i.net,n)),n.add(i)}let r=new Jt;for(let[i,n]of e){let s=uS(i);for(let a of s)for(let l of n)if(a.has(l.globalIndex)&&!t.has(l)){for(let c of a){let h=r.getConnectNode(c);t.add(h)}break}}return t}function _xt(o){let t=!1,e=[],r=new Array;for(let i of o)i instanceof Le&&(i.searchCycleNode().forEach(s=>{e.push(s.globalIndex)}),t=!0);if(t)for(let i of o)e.includes(i.globalIndex)||r.push(i);else r=o;return r}function qS(){let o=It.getInstance().getGridX(),t=It.getInstance().getGridY(),e=It.getInstance().getSnapX(),r=It.getInstance().getSnapY();return{xRatio:o/e,yRatio:t/r,gridX:o,gridY:t,snapX:e,snapY:r}}function vje(o,t){if(o!=t){let e=le.gridConfig,r=new dt;for(let i of e){let n=o=="mil"?i.milDeltaX:r.conversion("mm","mil",i.mmDeltaX),s=o=="mil"?i.milDeltaY:r.conversion("mm","mil",i.mmDeltaY);if(ne.eq(It.getInstance().getSnapX(),n)&&ne.eq(It.getInstance().getSnapY(),s)){let a=t=="mil"?i.milDeltaX:r.conversion("mm","mil",i.mmDeltaX),l=t=="mil"?i.milDeltaY:r.conversion("mm","mil",i.mmDeltaY),c=qS();It.getInstance().setSnapX(a),It.getInstance().setSnapY(l),le.getAssociationPCBCanvasGridAndSnap()===1&&(It.getInstance().setGridX(a*c.xRatio),It.getInstance().setGridY(l*c.yRatio));break}if(ne.eq(It.getInstance().getGridX(),n)&&ne.eq(It.getInstance().getGridY(),s)){let a=t=="mil"?i.milDeltaX:r.conversion("mm","mil",i.mmDeltaX),l=t=="mil"?i.milDeltaY:r.conversion("mm","mil",i.mmDeltaY),c=qS();It.getInstance().setGridX(a),It.getInstance().setGridY(l),le.getAssociationPCBCanvasGridAndSnap()===1&&(It.getInstance().setSnapX(a/c.xRatio),It.getInstance().setSnapY(l/c.yRatio));break}}}}function aVe(o){let t=Kc(),e=!0;for(let r of t){let i=r.model;!(i instanceof et)&&!(i instanceof Bi)&&!(i instanceof Ct)&&i instanceof xi&&i.layerId==o&&(!(i instanceof Li)||i.getText()!="")&&(e=!1)}return e}function iOe(o,t){let e="",r=!0;return t?((o==="Constraint Region"&&Z0.getInstance().hasName(t)||o==="Copper Region"&&Ti.nameManager.has(t))&&(e="The name already exists, please modify",r=!1),o==="Partition"&&bo.getInstance().hasName(t)&&(e="The name already exists, please modify",r=!1)):(e="The name cannot be empty, please modify",r=!1),r||A.publish("openMsgbox",new l_(e)),r}function PG(o){let t=xje.getIdMapHandler();return Object.values(t).findIndex(r=>r.dialogType===o)!==-1}function nOe(o){let t={};o.forEach(e=>{t[e.globalIndex]=!0});for(let e of o){let r;e.net==""?r=e.searchNode():r=e.searchNowNode();for(let i of r)if(!t[i.globalIndex])return!0}return!1}var Sje=Bs.conversion("mm","mil",2)/10;function yje(o,t){let e=t.model.box.width||1,r=o/e,i=t.fontSize*r;return i>Sje?Sje:i}function Lq(o,t,e){if(t==null)return;let r=o.get(t);r==null&&(r=new Array,o.set(t,r)),r.push(e)}function vxt(o){let t=o.primitives,e=t.length,r=new Map;for(let c=0;c<e;c++){let h=t[c];for(let u=c+1;u<e;u++){let d=t[u];if(h.bbox().isSeparated(d.bbox()))continue;let p=Pt(h,d);for(let m=0;m<p;m+=2){let g=new S(Ee[m],Ee[m+1]);g.equals1(h.end())&&g.equals(d.start())||(Lq(r,h,g),Lq(r,d,g))}}}for(let[c,h]of r)an(h,c);let i=new Map,n=0,s=new Map;for(let c of t){let h=n++;Lq(i,c.start(),h),s.set(h,c);let u=r.get(c);if(u!=null&&u.length>0)for(let d of u){let p=n++;s.set(p,c),Lq(i,d,p)}}Lq(i,t[e-1].end(),n++);let a=null,l=0;for(let[c,h]of i)if(h.length>1){let u=Math.max(...h)-Math.min(...h);u>l&&(l=u,a=c)}if(a!=null){let c=i.get(a),h=Math.max(...c),u=Math.min(...c),d=s.get(u),p=s.get(h),m=t.indexOf(d),g=t.indexOf(p),y=new Array,b=new Array;for(let P=0;P<e;P++)if(P<m)y.push(t[P]);else if(P==m){let T=Gu(t[P],a);y.push(T[0]),b.push(T[1])}else if(P<g)b.push(t[P]);else if(P==g){let T=Gu(t[P],a);b.push(T[0]),y.push(T[1])}else y.push(t[P]);return{unclose:ge.build2(y),close:ge.build2(b)}}return{unclose:o,close:null}}function tj(o){return kt.search(o,(t,e)=>l8(e)||e=="Polygon")}function l8(o){return o=="ArcTrack"||o=="Arc"||o=="Circle"||o=="Rect"}var De=class extends Kh{constructor(e){super();this._commands=new Array;this.refreshService=!1;this.needCheckFilterCommand=!0;this._partitionNeedAskBeforeDelete=!1;this.createPartitionFile=!1;this.idMap=new Map;this.waitingUploadStack=new Array;this.sendCopperOrderChange=!1;this.description=e}openSendCopperOrder(){this.sendCopperOrderChange=!0}get commands(){return this._commands}undo(){let e=this._commands.length;if(e!=0){for(let r=e-1;r>=0;r--){let i=this._commands[r];i&&(!we.smartMode&&i instanceof BP||i.undo())}this.refreshService&&he.publish("HistoryFlushService",""),this.refresh(),this.sendInfo2Proxy("undo"),this.sendCopperOrderChange&&he.publish("CopperOrderUndo","")}}redo(){if(this._commands.length!=0){for(let r of this._commands)r&&(!we.smartMode&&r instanceof BP||r.redo());this.refreshService&&he.publish("HistoryFlushService",""),this.refresh(),this.sendInfo2Proxy("redo"),this.sendCopperOrderChange&&he.publish("CopperOrderRedo","")}}upload(e=!1){let r=this._commands.length;if(this.idMap.clear(),r!=0){if(e)for(let i=r-1;i>=0;i--){let n=this._commands[i];n&&(!we.smartMode&&n instanceof BP||n.upload(e))}else for(let i of this._commands)i&&(!we.smartMode&&i instanceof BP||i.upload(e));gS.getInstance().upload(),eT.getInstance().upload(),g4.getInstance().upload()}}addConnectChangeCommand(e){if(e.hasConnectChange()){let r=e.getConnnectChangeCommand();for(let i of r)this.addCommand(i)}}updateData(){}addCommand(e){if(e!=null){if(this.addConnectChangeCommand(e),this.refreshService&&this.waitingUploadStack.push(e),e.gId!=null){let r=this.idMap.get(e.gId);if(r!=null){if(!this.refreshService&&r.getAction()=="add"&&e.getAction()=="modify")return;r.updateData()}this.idMap.set(e.gId,e)}e instanceof i_&&(this._partitionNeedAskBeforeDelete=!0,this.createPartitionFile=!0),this._commands.push(e)}}get partitionNeedAskBeforeDelete(){if(this._partitionNeedAskBeforeDelete)return!0;if(this.createPartitionFile){for(let e of this.commands)if(e instanceof i_){if(e.hasFileUUID())return!0}else if(e instanceof pg){let r=e.getItem();if(r!=null&&r instanceof He&&r.type=="Partition"){let i=r.getComponent();if(i instanceof ac&&i.fileUuid!="")return!0}}}return!1}setCheckFilter(e){this.needCheckFilterCommand=e}increaseUpload(){if(this.waitingUploadStack.length>0){let e=Array.from(this.waitingUploadStack);this.waitingUploadStack.length=0;for(let r of e)r&&(!we.smartMode&&r instanceof BP||r.upload(!1))}gS.getInstance().upload(),eT.getInstance().upload(),g4.getInstance().upload()}checkFilterCommand(){let e=new Array,r=new Array,{canEditArr:i,hasCanNotEdit:n}=this.checkItemsAreCanEdit(),s=!1,a=new Array;for(let c of this._commands)if(c){if(n)if(c instanceof wA){if(!c.getStackTableIsCanEdit()&&!s){let u="beyond drawing range";Mt.showMassageTip(u,u),s=!0}continue}else{let h=i.get(c.gId);if(a.unshift(c),!h&&!s){let u="beyond drawing range";Mt.showMassageTip(u,u),s=!0}continue}this.needCheckFilterCommand&&c instanceof pg?c.compareDataChange(r)&&e.push(c):e.push(c)}for(let c=0;c<a.length;c++)a[c].undo();this._commands=new Array(e.length+r.length);let l=0;for(let c=0;c<e.length;c++,l++)this._commands[l]=e[c];for(let c=0;c<r.length;c++,l++)this._commands[l]=r[c];return e.length=0,r.length=0,this._commands}checkItemsAreCanEdit(){let e=new Map,r=!1;if(R.getInstance().projectId==""&&!bo.getInstance().hasSpiltOutPartition())return{canEditArr:e,hasCanNotEdit:r};for(let i of this._commands){if(!i)continue;if(i instanceof wA){i.getStackTableIsCanEdit()||(r=!0);continue}let n=Ce.getManager(i),s=n&&n.getItem(i.gId);if(s){let a=Mt.checkIsInCanEdit(s);if(s instanceof lr&&s.getParent()instanceof ke&&(!s.showKey&&!s.showValue&&(a=!0),s.showKey&&!s.key&&(a=!0),s.showValue&&!s.value&&(a=!0)),s instanceof ke){let c=!0;for(let h of s.attributes){if(!h.showKey&&!h.showValue||h.showKey&&!h.key||h.showValue&&!h.value)continue;let u=Mt.checkIsInCanEdit(h);u||(c=u)}for(let h of s.getPads())Mt.checkIsInCanEdit(h)&&(h.partition=R.getInstance().partitionId);a&&!c&&(a=c)}this.description=="create partition"&&(a=!0),(this.description=="line break up"||this.description=="merge polygon")&&(a=!0),["clear-Designator","refDesignator","resetUniquId"].indexOf(this.description)>=0&&(a=!0);let l=a?1:0;e.set(i.gId,l),r===!1&&l===0&&(r=!0)}}return{canEditArr:e,hasCanNotEdit:r}}needSendInfo(){let e=[];for(let r of this._commands)if(r&&r instanceof pg){let{action:i,data:n}=r.needSendInfo(r);if(i=="fullUpdate")return{action:i};if(i=="notUpdate"){if(this._commands.length==1)return{action:"notUpdate"};continue}if(i=="halfUpdate"){e.push(n);continue}}if(e.length>0)return{action:"halfUpdate",data:e};if(e.length==0)return{action:"notUpdate"}}refresh(){let e=!1;for(let r of this._commands)if(r&&r instanceof pg&&r.tool.is3DShell()){e=!0;break}e&&he.publish("needRefresh3DWindow","")}sendInfo2Proxy(e){if(PG("pcb-copper-manager")&&this._commands.some(r=>r instanceof pg)){let{action:r,data:i}=this.needSendInfo();if(r=="notUpdate")return;if(r=="fullUpdate")he.publish("pcbdialogModify",{dialogType:"pcb-copper-manager",action:"modifyCopperMangerDialogParams"});else{if(i.length>0)for(let n of i){if(e=="execute"&&n.key=="layerId")return;n.command=e}he.publish("pcbdialogModify",{dialogType:"pcb-copper-manager",action:"modifyCopperMangerDialogParams",data:i})}}}get length(){return this._commands.length}warnDeleteSubPcbBeforeRemove(){let e;if(this._commands.forEach(n=>{n.type=="Partition"&&(e=n.gId)}),!e)return;let r=bo.getInstance().getItemById(e);if(!r)return;let i=r.model.component.fileUuid;he.publish("deletePartitionItemAndSubPcb",{subPcbUuid:i,mainPcbUuid:R.getInstance().id},Q())}};var Xhe=class{constructor(){this.undoCommand=new Array;this.redoCommand=new Array;this.stack=null}executeCommand(t){if(t instanceof De&&!t.checkFilterCommand().length)return;t instanceof De&&(t.refreshService=!0),R.getInstance().isactive&&23!=R.getInstance().doctype&&A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),this.stack!=null&&(this.undoCommand.push(this.stack),this.stack=null),t instanceof De?(this.stack=t,t.refresh()):this.undoCommand.push(t),this.redoCommand.length>0&&(this.redoCommand.length=0),!(t instanceof De&&t.description=="create partition")&&A.publish("flushTearDrop",""),t instanceof De&&t.sendInfo2Proxy("execute");let e=50;for(this.stack!=null&&(e=49);this.undoCommand.length>e;)this.undoCommand.shift();this.updateTop(),t.upload(),t instanceof De&&this.sendMessageToExtensionApi(t)}increaseUpload(){this.stack!=null&&this.stack.increaseUpload()}redo(){if(this.stack!=null&&(this.undoCommand.push(this.stack),this.stack instanceof De&&this.sendMessageToExtensionApi(this.stack),this.stack=null),this.redoCommand.length>0){let t=this.redoCommand.pop();t!=null&&(t.redo(),t.upload(),this.undoCommand.push(t),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),t instanceof De&&this.sendMessageToExtensionApi(t))}this.updateTop()}undo(){if(this.stack!=null)this.singleUndo(this.stack)&&(this.stack=null);else if(this.undoCommand.length>0){let t=this.undoCommand.pop();t!=null&&(this.singleUndo(t)||this.undoCommand.push(t))}this.updateTop()}singleUndo(t){return t instanceof De&&t.partitionNeedAskBeforeDelete?(t.warnDeleteSubPcbBeforeRemove(),!1):(t.undo(),t.upload(!0),this.redoCommand.push(t),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),t instanceof De&&this.sendMessageToExtensionApi(t,!0),!0)}clear(){this.undoCommand.length=0,this.redoCommand.length=0,this.stack=null,this.updateTop()}updateTop(){(R.getInstance().doctype===3||R.getInstance().doctype===4)&&(this.stack!=null?we.undo=!0:this.undoCommand.length>0?we.undo=!0:we.undo=!1,this.redoCommand.length>0?we.redo=!0:we.redo=!1)}sendMessageToExtensionApi(t,e=!1){var s,a;let r=t.commands[0].getAction();if(e)switch(r){case"add":r="delete";break;case"delete":r="add";break}let i=[],n=t.commands;for(let l=0;l<n.length;l++){let c=n[l],h=this.getCommandType(c);c instanceof Rb&&r=="delete"?i.push({primitiveId:c.gId,primitiveType:h,designator:(s=c==null?void 0:c.data)==null?void 0:s.attrsMap.Designator}):"gId"in c&&i.push({primitiveId:c.gId,primitiveType:h})}(a=A.extensionApiMessageBus2())==null||a.publish("extensionApi.PCB_Event.primitiveEvent",{eventType:r,props:i})}getCommandType(t){let e="";return t instanceof JM?e="Dimension":t instanceof BP?e="SmartDimension":t instanceof QM?e="Pad":t instanceof p4?e="PolygonPad":t instanceof cA?e="PcbCircle":t instanceof t4?e="Protractor":t instanceof hA?e="Rect":t instanceof r4?e="Text":t instanceof i4?e="Track":t instanceof d4?e="ArcTrack":t instanceof n4?e="Via":t instanceof l4?e="RadiusMark":t instanceof tT?e="Polygon":t instanceof Rb?e="Component":t instanceof f4?e="Image":t instanceof m4?e="TrueColorPicture":t instanceof d8?e="PlaneZone":t instanceof Wx&&(e="CopperResult"),e}set partitionNeedAskBeforeDelete(t){if(this.stack!=null)this.stack._partitionNeedAskBeforeDelete=t;else if(this.undoCommand.length>0){let e=this.undoCommand[this.undoCommand.length-1];e instanceof De&&(e._partitionNeedAskBeforeDelete=t)}}};var sC=class{constructor(t,e,r,i=!1,n){this._needGray=!1;this._beforeGrayHidden=null;this._isUnderGrid=!1;this.model=t,this._active=e,this._order=r,(t.layerId==1||t.layerId==2)&&(n=r+10),this._copperOrder=n,this._isUnderGrid=i,this._active?this._status=!0:this._status=!1,(this.layerID==57||this.layerID==1001||this.layerID==1002)&&(this._status=!0),wq(this.layerID,this.visible),this.refreshRender()}refreshRender(){Mo.attachLayer(this)}getOrder(t){return t==null?1e3+this.model.layerId:t}get layerID(){return this.model.layerId}get state(){return this.model.state}get layerStatus(){return this.model.config?this.model.visible?1:2:0}set layerStatus(t){t==0?(this.config=!1,this.visible=!1):t==2?(this.config=!0,this.visible=!1):(this.config=!0,this.visible=!0),this.refreshRender()}get needGray(){return this._needGray}set needGray(t){this._needGray=t,this.refreshRender()}get isColorful(){return this._needGray?!!this._active:!0}get beforeGrayHidden(){return this._beforeGrayHidden}set beforeGrayHidden(t){this._beforeGrayHidden=t}get type(){return this.model.type}set type(t){this.model.type=t}get status(){return this._status}set status(t){if(this._status=t,this.model.config&&this.model.layerId==12){let e=Pe.getHoleLayer();e!=null&&(e.status=t)}(this.layerID==57||this.layerID==1001||this.layerID==1002)&&(this._status=!0),this.refreshRender()}get order(){return this._order}set order(t){t=this.getOrder(t),this._order=t,this.refreshRender()}get copperOrder(){return this._copperOrder}set copperOrder(t){t=this.getOrder(t),this._copperOrder=t,this.refreshRender()}set isUnderGrid(t){this._isUnderGrid=t}get isUnderGrid(){return this._isUnderGrid}get name(){return this.model.name}set name(t){this.model.name=t}get activeColor(){return this.model.activeColor}set activeColor(t){this.model.setActiveColor(t),this.refreshRender()}get deactiveColor(){return this.model.deactiveColor}set deactiveColor(t){this.model.deactiveColor=t,this.deactiveAlpha=t.alpha*this.model.activeColor.alpha,this.refreshRender()}set deactiveAlpha(t){this.model.deactiveColor=ee.of6(this.model.deactiveColor,t),this.refreshRender()}get color(){return this.model.activeColor}get visible(){return this.model.visible}set visible(t){if(this.model.visible=t,this.model.config){if(this.layerID==47){let e=Pe.getMultLayer();e!=null&&(t=e.visible)}if(this.model.layerId==12){let e=Pe.getHoleLayer();e!=null&&(e.visible=t)}}wq(this.layerID,t),this.refreshRender()}get locked(){return this.model.locked}set locked(t){this.model.locked=t}get active(){return this._active}set active(t){if(this._active=t,this._status=t,this.model.layerId==12){let e=Pe.getHoleLayer();e!=null&&(e.active=t)}(this.layerID==57||this.layerID==1001||this.layerID==1002)&&(this._status=!0),this.refreshRender()}get config(){return this.model.config}set config(t){this.model.config=t,this.refreshRender()}get transparency(){return 1-this.model.activeColor.alpha}set transparency(t){this.setTransparency(t,!1)}setTransparency(t,e){let r=1-t,i=ee.build(this.model.activeColor.r,this.model.activeColor.g,this.model.activeColor.b,r);this.model.setActiveColor(i,e),this.refreshRender()}setActiveColor(t,e){this.model.setActiveColor(t,e),this.refreshRender()}isSignalLayer(){return ns(this.model.type)}isPlaneLayer(){return mu(this.model.type)}isCopperLayer(){return Ree(this.model.type)}isDrillLayer(){return Hke(this.model.type)}isInnerLayer(){return this.layerID>=15&&this.layerID<=46}getMenu(){return{name:this.name,cmd:`switchToLayer(${this.layerID})`,tips:""}}getRenderData(){let t=gk.build(this.config,this.visible,this._status,this.isColorful,this.isPlaneLayer());return{layerId:this.model.layerId,order:this._order,copperOrder:this._copperOrder,activeColor:this.model.activeColor,deactiveColor:this.model.deactiveColor,layerState:t,highlightColor:ee.BLACK,highLightType:null,isUnderGrid:this._isUnderGrid}}getType(){return 26}getViewState(){return this.config?this.visible?this.isColorful?"Main And Highlight":"Only Main":"Not Shown":"Not Shown"}};var qhe=class extends Ei{constructor(){super(...arguments);this.modelManager=Ze.getInstance();this.grayIndex=0;this._layerMap={};this.lastActiveLayer=0;this.activeOrder=10;this.configInnerLayers=new Set}get activeLayer(){return Ze.getInstance().activeLayer}set activeLayer(e){Ze.getInstance().activeLayer=e}get ratlineLayer(){return this.getLayer(57)}get layerMap(){return this._layerMap}set layerMap(e){this._layerMap=e}refreshConfigInnerLayers(e,r){r.isInnerLayer()&&(r.config?this.configInnerLayers.add(e):this.configInnerLayers.delete(e))}addPcbLayer(e,r,i,n,s,a,l,c){let h=ny.build(c!=0,c==1,!1),u=Ze.getInstance().addLayer(e,r,i,h,s,a),d=new sC(u,l,n);return this.layerMap[e]=d,l&&(this.lastActiveLayer=this.activeLayer,this.activeLayer=e),this.refreshConfigInnerLayers(e,d),d}addPcbLayerByModel(e,r=!1,i=jTe[e.layerId.toString()]){let n=e.layerId;i=i==null?this.getCustomLayerOrder(n):i;let s=new sC(e,r,i);return this.layerMap[n]=s,r&&(this.lastActiveLayer=this.activeLayer,this.activeLayer=n),this.refreshConfigInnerLayers(n,s),s}modifyLayer(e,r,i,n,s,a,l,c){let h=this.layerMap[e];return h==null?this.addPcbLayer(e,r,i,n,s,a,l,c):(h.type=r,h.order=n,h.name=i,h.activeColor=s,this.activeLayer!=e?(h.active=l,l&&(this.lastActiveLayer=this.activeLayer,this.activeLayer=e)):h.active=!0,h.layerStatus=c,(this.activeLayer==1&&e==3||this.activeLayer==2&&e==4)&&(h.status=!0),this.refreshConfigInnerLayers(e,h),h)}getTopSilkLayer(){return this.getLayer(3)}getBottomSilkLayer(){return this.getLayer(4)}getTopLayer(){return this.getLayer(1)}getBottomLayer(){return this.getLayer(2)}getAllLayer(){let e=new Array;for(let r in this.layerMap)e.push(this.layerMap[r]);return e}getLayer(e){let r=this.layerMap[e];return r==null?null:r}setLayer(e){let r=e.layerID;this.layerMap[r]=e}hiddenAllPlanes(){let e=this.activeLayer;this.getLayer(e).isPlaneLayer()||A.publish("endAllPlane",null)}setActiveLayer(e,r){let i=this.activeLayer;this.getLayer(i).isPlaneLayer()&&A.publish("endPlane",i),e.isPlaneLayer()&&A.publish("startPlane",e.layerID);let n=this.layerMap[i].status;if(this.layerMap[i].active=!1,is(i)?(this.rostoreBottom(),(i==2||i==4)&&this.rostoreBottomColor()):hb(i)?(this.rostoreTop(),(i==1||i==3)&&this.rostoreTopColor()):this.restoreLayer(i),this.grayIndex==2){let s=[{layerId:e.layerID,show:!0}];[12,47,11,57].includes(i)||(e.layerID!=i&&s.push({layerId:i,show:!1}),this.layerMap[i].needGray=!1,this.layerMap[i].visible=!1),e.needGray=!1,e.visible=!0,A.publish("layerStatus",s,Q())}this.lastActiveLayer=i,this.activeLayer=e.layerID,i=e.layerID,is(i)?(this.setBottomActive(i),i==2?this.setBottomActiveColor(n):e.order=this.activeOrder):hb(i)?(this.setTopActive(i),i==1?this.setTopActiveColor(n):e.order=this.activeOrder):i==12||i==47||(e.order=this.activeOrder),this.setActiveLayerTopAfterGray(),e.active=!0,e.status=n,this.grayIndex==1&&this.setGray(1),R.getInstance().isactive&&23!=R.getInstance().doctype&&A.publish("setActive",{activeLayer:i,LayerBartoggleLayer:r},Q())}setActiveLayerId(e){let r=this.getLayer(e);r!=null&&this.setActiveLayer(r)}getActiveLayer(){return this.layerMap[this.activeLayer]}getOutlineLayer(){return this.getLayer(11)}getActiveLayerID(){return this.activeLayer}getLastActiveLayerID(){return this.lastActiveLayer}getHoleLayer(){return this.layerMap[47]}getMultLayer(){return this.layerMap[12]}getRatlineLayer(){return this.ratlineLayer}getLayerName(e){return this.layerMap[e].name}getLayerOptions(){let e=new Array;for(let r in this.layerMap){let i=this.layerMap[r];if(i.config){let n={};n.text=i.name,n.value=r,e.push(n)}}return e}getSignalLayerOptions(e=!0){let r=new Array;for(let i in this.layerMap){let n=this.layerMap[i];if(n.config&&(n.isSignalLayer()||e&&n.isPlaneLayer())){let s={};s.text=n.name,s.value=i,s.color=n.color.toString(),r.push(s)}}return r}getAllEnableInnerLayers(){let e=new Array;for(let r in this.layerMap){let i=this.layerMap[r];(i.isSignalLayer()||i.isPlaneLayer())&&i.layerID!==1&&i.layerID!==2&&String(i.layerStatus)!=="0"&&e.push(i)}return e}getAllSignalLayer(){let e=new Array;for(let r in this.layerMap){let i=this.layerMap[r];i.config&&i.isSignalLayer()&&e.push(i)}return e}getAllSignalLayerIds(){return this.getAllSignalLayer().map(e=>e.layerID)}getAllPlaneLayer(){let e=new Array;for(let r in this.layerMap){let i=this.layerMap[r];i.config&&i.isPlaneLayer()&&e.push(i)}return e}getAllPlaneLayerIds(){return this.getAllPlaneLayer().map(e=>e.layerID)}getAllPinLayer(){return[this.layerMap[50],this.layerMap[51]]}getAllPinLayerIds(){return[50,51]}getAllCopperLayer(){let e=new Array;for(let r in this.layerMap){let i=this.layerMap[r];i.config&&i.isCopperLayer()&&e.push(i)}return e}getSortCopperLayer(){return this.copperLayerSort(this.getAllCopperLayer())}copperLayerSort(e){return e.sort((r,i)=>Es(r.layerID)!==Es(i.layerID)?r.layerID===1?-1:i.layerID===1?1:Es(r.layerID)?-1:1:r.layerID>i.layerID?1:-1)}getAllCopperLayerIds(){return this.getAllCopperLayer().map(e=>e.layerID)}setTopActive(e){let r=this.getLayer(3),i=this.getLayer(1),n=this.getLayer(5),s=this.getLayer(7),a=this.getLayer(9),l=this.getLayer(58);r&&(r.order=12),i&&(i.order=13),n&&(n.order=14),s&&(s.order=16),a&&(a.order=17),l&&(l.order=18),i&&(i.copperOrder=19)}setBottomActive(e){let r=this.getLayer(4),i=this.getLayer(2),n=this.getLayer(6),s=this.getLayer(8),a=this.getLayer(10),l=this.getLayer(59);r&&(r.order=12),i&&(i.order=13),n&&(n.order=14),s&&(s.order=16),a&&(a.order=17),l&&(l.order=18),i&&(i.copperOrder=19)}setTopActiveColor(e){let r=this.getLayer(3),i=this.getLayer(1);r&&(r.status=e),i&&(i.status=e)}setBottomActiveColor(e){let r=this.getLayer(4),i=this.getLayer(2);r&&(r.status=e),i&&(i.status=e)}restoreLayer(e){let r=this.getLayer(e);r!==null&&(r.order=jTe[e.toString()])}getAllConfigLayerSortByRightPanel(){let e=this.getAllEnableLayer(),r={top:new Array,bottom:new Array,inner:new Array,other:new Array,component:new Array,shell3D:new Array},i=new Array;for(let n of e){let s=n.layerID;hb(s)?r.top.push(n):is(s)?r.bottom.push(n):Es(s)?r.inner.push(n):this.inOther(s)?r.other.push(n):Dee(s)?r.component.push(n):ra(s)&&r.shell3D.push(n)}return i.push(...r.top,...r.bottom,...r.inner,...r.other,...r.component,...r.shell3D),i}inOther(e){return!!(e==11||e==12||e==13||e==14||e==56||e==57||this.modelManager.isCustomLayer(e))}getLayersByOrder(){let e=new Array;for(let i in this.layerMap){let n=this.layerMap[i];n.config&&e.push(n)}Er(e,(i,n)=>i.order-n.order,0,e.length);let r=new Array;for(let i of e)r.push(i.layerID);return r}rostoreTop(){this.restoreLayer(3),this.restoreLayer(1),this.restoreLayer(5),this.restoreLayer(7),this.restoreLayer(9),this.restoreLayer(58);let e=this.getLayer(3),r=this.getLayer(1);e&&(e.status=!1),r&&(r.status=!1),r&&(r.copperOrder=r.order+10)}rostoreTopColor(){let e=this.getLayer(3),r=this.getLayer(1);e&&(e.status=!1),r&&(r.status=!1)}rostoreBottom(){this.restoreLayer(4),this.restoreLayer(2),this.restoreLayer(6),this.restoreLayer(8),this.restoreLayer(10),this.restoreLayer(59);let e=this.getLayer(4),r=this.getLayer(2);e&&(e.status=!1),r&&(r.status=!1),r&&(r.copperOrder=r.order+10)}rostoreBottomColor(){let e=this.getLayer(4),r=this.getLayer(2);e&&(e.status=!1),r&&(r.status=!1)}setGrayIndex(e){this.grayIndex=e}getGrayIndex(){return this.grayIndex}setGray(e){let r=this.grayIndex,i=isNaN(parseInt(e.toString()))?(this.grayIndex+1)%3:parseInt(e.toString());if(r===i)return;let n=!1;i!=0&&(n=!0),R.getInstance().forceVisibleHighRange=n,C2.getInstance().setForceHightRange(n),this.grayIndex=i,we.grayState=this.getGrayIndex();let s=this.getAllLayer(),a=new Array;this.grayIndex==0?s.forEach(l=>{if(l.layerID!=12&&l.layerID!=47&&l.layerID!=11&&l.layerID!=57&&l.layerID!=this.activeLayer){l.visible=l.beforeGrayHidden!=null?l.beforeGrayHidden:l.visible;let c={layerId:l.layerID,show:l.visible};a.push(c)}l.beforeGrayHidden=null,l.needGray=!1}):this.grayIndex==1?s.forEach(l=>{if(l.layerID!=12&&l.layerID!=47&&l.layerID!=11&&l.layerID!=57){l.needGray=!0,l.visible=l.beforeGrayHidden!=null?l.beforeGrayHidden:l.visible;let c={layerId:l.layerID,show:l.visible};a.push(c)}}):s.forEach(l=>{if(l.layerID!=12&&l.layerID!=47&&l.layerID!=11&&l.layerID!=57&&(l.needGray=!1,l.beforeGrayHidden=l.visible,l.layerID!=this.activeLayer)){l.visible=!1;let c={layerId:l.layerID,show:!1};a.push(c)}}),(r==0&&this.grayIndex!=0||r!=0&&this.grayIndex==0)&&(this.setActiveLayerTopAfterGray(),this.setActiveLayerId(this.activeLayer)),A.publish("dealMultLayer",this.grayIndex),A.publish("layerStatus",a,Q())}setActiveLayerTopAfterGray(){let e=this.getActiveLayer();this.grayIndex!=0&&(e.layerID==1||e.layerID==2?(e.order=8,this.getLayer(e.layerID).copperOrder=9):e.order=9)}getLayerPhy(e){return this.modelManager.getLayerPhy(e)}getLayerPhys(){return this.modelManager.getLayerPhys()}setLayerPhys(e,r=!1){let i=new Set(this.modelManager.getLayerPhys());for(let n of e){let s=this.modelManager.modifyLayerPhy(n["Layer Id"],n.Material,n.Thickness,n.Permittivity,n["Loss Tangent"],n.IsKeepIsLand==null?!0:n.IsKeepIsLand==1,n.zIndex);i.delete(s),r&&h8(s)}for(let n of i)this.modelManager.deleteLayerPhy(n.layerId),r&&h8(n,!0)}checkLayerPhys(){if(this.getLayerPhys().length==0){this.setDefaultLayerPhys();return}let e=this.getSortCopperLayer();this.sortLayerPhys(e)}sortLayerPhys(e){let r=["TOP_SILK","TOP_PASTE_MASK","TOP_SOLDER_MASK","TOP","SUBSTRATE","BOTTOM","BOT_SOLDER_MASK","BOT_PASTE_MASK","BOT_SILK"],i=new Array(r.length),n=r.indexOf("SUBSTRATE"),s=0;this.iteratorLayerPhysical((c,h)=>{let u=h.layerType;Es(c)&&s++;let d=r.indexOf(u);return d<0&&(d=n),i[d]||(i[d]=[]),i[d].push(h),!0}),Hn(i,(c,h,u)=>{if(u==n)return!0;if(!h){let d=this.createPcbLayerPhy(pce[u]);d&&(i[u]=[d])}});let a=e.filter(c=>!!c.isInnerLayer());if(s<a.length){let c=i[n];c||(c=[]);let h={};c.forEach(u=>{h[u.layerId]=u}),Hn(a,(u,d)=>{h[d.layerID]||c.push(this.getPhyByLayer(d))}),c=this.sortInnerPhy(c),i[n]=c}let l=i.flat();return this.resetLayerPhy(l),i[n]}resetLayerPhy(e){let r=this.modelManager.getLayerPhys();for(let i of r)this.modelManager.deleteLayerPhy(i.layerId);for(let i of e)this.modelManager.addLayerPhyModel(i)}checkInnerPhy(e,r,i){e=e||[];let n=-1,s=-1,a=361,l=new dt().mm2mil(j3e-lq*r-X3e*2)/(r-1)/10,c=[];if(Hn(e,(h,u,d)=>{if(Es(u.layerId)){if(s++,d-n-1<=0){let m=this.getDefPhys(s,i,l,a);a=m.substrateLayerId,c.push(m.phy)}n=d}c.push(u)}),n!=-1&&n==e.length-1||n==-1&&e.length==0){let h=this.getDefPhys(s,i,l,a);c.push(h.phy)}return c}getDefPhys(e,r,i,n){let s,a=n;for(;this.layerMap[a]!=null;)a++;let l=a-361+1;return s=this.createPcbLayerPhy({"Layer Id":a,Layer:`\u4ECB\u7535${l}`,Type:"Substrate",Material:e===r/2-1?"FR4":"PP",Thickness:i,Permittivity:cq,"Loss Tangent":hq,IsKeepIsLand:1,zIndex:999+l*2}),this.layerMap[a]==null&&(this.addPcbLayer(a,"SUBSTRATE",`Dielectric${l}`,a,ee.of1(0),ee.of1(0),!1,0),a++),{phy:s,substrateLayerId:a}}sortInnerPhy(e){return e.sort((r,i)=>Es(r.layerId)&&Es(i.layerId)?r.layerId>i.layerId?1:-1:1)}createPcbLayerPhy(e){if(e)return new GO(e["Layer Id"],e.Material,e.Thickness,e.Permittivity,e["Loss Tangent"],e.IsKeepIsLand,e.zIndex)}getPhyByLayer(e){return this.createPcbLayerPhy({"Layer Id":e.layerID,Layer:e.name,Type:"Copper",Material:null,Thickness:new dt().mm2mil(lq)/10,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:this.getCopperLayerPhyZInde(e.layerID)})}getCopperLayerPhyZInde(e){return e==1?1e3:e==2?9e3:(e-15+1)*2+1e3}iteratorLayerPhysical(e){Hn(this.getLayerPhys(),(r,i,n)=>{e(i.layerId,i)})}setDefaultLayerPhys(){this.delAllSubstrateLayers();let e=this.getSortCopperLayer(),r=e.length===2?pce:this.getLayerPhySettingByLayer(e);for(let i=1;i<e.length;i++)this.addPcbLayer(361+i-1,"SUBSTRATE",`Dielectric${i}`,361+i-1,ee.of1(0),ee.of1(0),!1,0);this.setLayerPhys(r)}getLayerPhySettingByLayer(e){let r=GVe(pce),i=new dt().mm2mil(j3e-lq*e.length-X3e*2)/(e.length-1)/10,n=e.reduce((s,a,l,c)=>(s.push({"Layer Id":a.layerID,Layer:a.name,Type:"Copper",Material:null,Thickness:new dt().mm2mil(lq)/10,Permittivity:null,"Loss Tangent":null,IsKeepIsLand:1,zIndex:this.getCopperLayerPhyZInde(a.layerID)}),l!==c.length-1&&s.push({"Layer Id":361+l,Layer:`\u4ECB\u7535${l+1}`,Type:"Substrate",Material:l===c.length/2-1?"FR4":"PP",Thickness:i,Permittivity:cq,"Loss Tangent":hq,IsKeepIsLand:1,zIndex:1001+l*2}),s),[]);return r.splice(3,3,...n),r}delAllSubstrateLayers(){Hn(this.layerMap,(e,r,i)=>{Number(e)>=361&&delete this.layerMap[e]})}getInnerLayerOrder(e){let r=15;return Es(e)?e-r+1:0}getCustomLayerOrder(e){return 1e3+e}getAllEnableLayer(){return this.getAllLayer().filter(e=>e.config)}checkDefault(){let e=this.defaultLayerID();for(let r of e){let i=this.getLayer(r);if(i!=null&&i.layerStatus==0&&(i.layerStatus=1),i==null){for(let n of oy)if(n.layerId==r){let s=this.addPcbLayer(n.layerId,n.type,n.name,n.order,n.activeColor,n.deactiveColor,n.active,n.layerStatus);s.locked=!0}}}this.setActiveLayerId(this.activeLayer),this.checkLayerPhys()}defaultLayerID(){return[1,2,3,4,5,6,7,8,9,10,11,12,13,14,47,48,49,50,51,53,54,55,56,57]}getfilterPhyLayers(){let e={};for(let r in this.layerMap){let i=this.layerMap[r];i.type=="SUBSTRATE"?this.getLayerPhy(i.layerID)!=null&&(e[r]=i):e[r]=i}return e}updatePlanzoneLayerKeepIsland(e,r){let i=this.getLayerPhy(e);i&&(i.isKeepIsland=r)}fetchPlanzoneLayerKeepIsland(e){let r=this.getLayerPhy(e);return r?r.isKeepIsland:!1}forceDeactive(e){R.getInstance().forceDeactive!=e&&(R.getInstance().forceDeactive=e,this.refreshRender())}refreshRender(){for(let e in this.layerMap){let r=this.layerMap[e];r.config&&r.refreshRender()}}getLayerNameMap(){let e=this.layerMap,r=new Map;return kf(e,i=>{let{layerID:n,name:s}=i;Ix(r,s,n,!1)}),r}enableLayer(e){let r=this.getLayer(e);return r?(r.config||(r.config=!0,r.visible=!0),r):null}isLayerEnabled(e){let r=this.getLayer(e);return!!(r!=null&&r.config)}getBasicLayerTable(e){let r={};return e.forEach(i=>{let n=this.getLayer(i);if(!n)return;let{name:s,type:a}=n,l={layerId:i,layerType:a,layerName:s};r[i]=l}),r}detectDisabledLayerTable(e){let r=null,i={},n={};return kf(e,s=>{let{layerId:a,layerType:l,layerName:c}=s;r||(r=this.getLayerNameMap());let h;if(l=="CUSTOM"){let u=r.get(c);u&&(h=this.getLayer(u),u!=a&&(n[a]=u))}else h=this.getLayer(a);(!h||!h.config)&&(i[a]=s)}),{disabledLayerTable:i,layerIdReplacementTable:n}}detectDisabledLayerTables(e){let r={};return kf(e,(i,n)=>{let s=this.detectDisabledLayerTable(i);r[n]=s}),r}enableLayers(e,r){if(my(e))return null;let i=this.getLayerNameMap(),n=new Map,s=[];kf(e,d=>{let{layerName:p,layerType:m}=d;if(m!="CUSTOM")return;let g=i[p];g?Ix(n,p,g,!1):xBe(p,s,!1)});let a=s.length;if(a>0){let d=-1;JO(i,p=>{let m=this.getLayer(p),{name:g,type:y,config:b}=m;if(y=="CUSTOM"&&!b&&!Tx(n,g)){let P=s[++d];n.set(P,p)}return a==d+1})}let l={},c={},h=NIe(i),u=[];if(kf(e,d=>{let{layerId:p,layerName:m,layerType:g}=d;if(r&&g!="CUSTOM"||u.includes(p)||qO(l,m))return;let y=p;if(g=="CUSTOM")y=n.get(m),y!=p&&$O(l,m,y);else if(g=="SIGNAL"||g=="PLANE")u.push(y);else if(g=="TOP_STIFFENER"||g=="BOTTOM_STIFFENER"){let P=this.enableLayer(g=="TOP_STIFFENER"?59:58);P&&A0(P.layerID)}let b=r?this.getLayer(y):this.enableLayer(y);if(b){let P=this.resetLayerName(b,i);if(P!=m){let T=i.get(m);!T||T==y?b.name=m:m!=P&&(c[m]={layerId:b.layerID,layerType:g,layerName:P})}i.set(b.name,y),h.push(m),b.type=g,A0(b.layerID)}}),u.length%2!=0){let d=null;sc(u.sort(),m=>{if(m%2!=0){let y=m+1;if(!this.isLayerEnabled(y))return d=y,!0}else if(!d){let y=m-1;this.isLayerEnabled(y)||(d=y)}});let p=d;if(!p)for(p=15;this.isLayerEnabled(p);)p+=1;if(!r){let m=this.enableLayer(p);this.resetLayerName(m,i),i.set(m.name,p),m&&A0(m.layerID)}}return this.checkLayerPhys(),{layerIdReplacementTableByName:l,repeatedNameLayers:c}}resetLayerName(e,r){if(!e)return"";r||(r=this.getLayerNameMap());let{name:i,layerID:n}=e,s=r.get(i);if(!s||s==n)return i;let a=this.getDefaultLayerName(n),l=r.get(a);if(!l||l==n)return e.name=a,a;let c=NIe(r),h=xke(i,c);return e.name=h,h}getDefaultLayerName(e){let r="";return sc(oy,i=>{if(i.layerId==e)return r=i.name,!0}),r||(e>=71?r=`Custom${e-71+1}`:r="UnknownLayerName"),r}};var $he=class{constructor(){this.GGEIDs=new Set;this.id=0}addId(t){this.GGEIDs.add(t)}has(t){return this.GGEIDs.has(t)}getID(t="e"){let e=R.getInstance().partitionId;for(;;){let r=e?`${this.id}_partition_${e}`:this.id;this.id++;let i=t+r;if(!this.GGEIDs.has(i))return r}}delete(t){this.GGEIDs.delete(t)}};var yh=class extends Ei{getItem(t){var e;return(e=this.mgr.getItem(t))==null?void 0:e.stateWatcher}getAllItem(){let t=[],e=0;return this.mgr.iterator(r=>{r.stateWatcher&&(t[e]=r.stateWatcher,e++)}),t}iterator(t){this.mgr.iterator((e,r)=>{e.stateWatcher&&t(e.stateWatcher,r)})}iteratorBreakable(t){this.mgr.iteratorBreakable((e,r)=>{if(e.stateWatcher)return t(e.stateWatcher,r)})}get itemsCount(){return this.mgr.itemsCount}deleteById(t){return this.mgr.deleteById(t)}};var h5=class extends yh{constructor(){super(...arguments);this.mgr=Sn.getInstance();this.last=null;this.removeLoop=!0}addTrackByModel(e,r=!1){if(r){let i=e.globalIndex;Sn.getInstance().getItem(i)==e&&Sn.getInstance().delete(e,i),e.globalIndex=nr(),Sn.getInstance().addModel(e)}return e.modelType=="Track"?this.last=new Ir(e):e.modelType=="ArcTrack"&&(this.last=new yi(e)),this.addControllerCache(this.last),this.last}addControllerCache(e){Ye.addItem(e),e.model.modelType=="Track"?kt.insert(e):kt.insert(e)}addTrack(e,r,i,n,s,a){let l=nr(),c=Sn.getInstance().addTrack(l,e,r,i,n,s,a),h=new Ir(c);return this.addControllerCache(h),h}addArcTrack(e,r,i,n,s,a,l,c,h,u=1){let d=nr(),p=Sn.getInstance().addArcTrack(d,e,r,i,n,s,a,l,c,h,u),m=new yi(p);return this.addControllerCache(m),m}rebuild(e,r,i,n,s,a,l){let c=Sn.getInstance().addTrack(e,r,i,n,s,a,l),h=new Ir(c);return this.addControllerCache(h),h}rebuildArcTrack(e,r,i,n,s,a,l,c,h,u,d=1){let p=Sn.getInstance().addArcTrack(e,r,i,n,s,a,l,c,h,u,d),m=new yi(p);return this.addControllerCache(m),m}copy(e){if(Object.values(e).length>9)return this.copyArc(e);let{globalIndex:i,layerId:n,start:s,end:a,width:l,locked:c,net:h}=e,u=new S(s.x,s.y),d=new S(a.x,a.y),p=i.slice(0,-16)+nr();return this.rebuild(p,n,u,d,l,c,h)}copyArc(e){let{globalIndex:r,layerId:i,center:n,radius:s,startAngle:a,endAngle:l,sweep:c,width:h,locked:u,net:d,arcType:p}=e;n=new S(n.x,n.y);let m=r.slice(0,-16)+nr();return this.rebuildArcTrack(m,i,n,s,a,l,c,h,u,d,p)}delete(e){(e.model.modelType==="ArcTrack"||e.model.modelType==="Track")&&Sn.getInstance().delete(e.model,e.model.globalIndex)}};var Khe=class extends yh{constructor(){super(...arguments);this.mgr=jn.getInstance()}addControllerCache(e){Ye.addItem(e),kt.insert(e)}addPad(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,x,v,D,w,F,H,z,V,W){let L=xp.getNumberManager();xp.isStart&&(i==""&&(i=R.getInstance().doctype===3?"":"1"),xp.isStart=!1),i=R.getInstance().doctype===3?L.getIncrementalNumber(i):L.getNum(i),L.add(i);let k=nr(),N=null,U=null,B=null,G=null;if(e===1)N=Lo.getStyle(s,a,l,c,null);else if(e===2)U=Lo.getStyle(h,u,d,p,null);else{N=Lo.getStyle(s,a,l,c,null),U=Lo.getStyle(h,u,d,p,null),B=Lo.getStyle(m,g,y,b,null);let K=Math.min(a,l)*.6;D=D||K,w=w||K/2,F=F||"ROUND",H=H||0,z=z||new S(0,0),G=nc.getHoleStyle(D,w,F,H,z)}let Y=jn.getInstance().addPad(k,e,r,i,n,P,T,I,C,E,O,_,x,v,N,U,B,G,V,W),X=new _i(Y);return this.addControllerCache(X),X}addPadByModel(e,r=!1){let i=e.num;if(xp.getNumberManager().add(i),r){let a=e.globalIndex;jn.getInstance().getItem(a)==e&&jn.getInstance().delete(e,a),e.globalIndex=nr(),jn.getInstance().addModel(e)}let s=new _i(e);return this.addControllerCache(s),s}rebuild(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,x,v,D,w,F,H,z,V,W=!1,L,k,N){let U=null,B=null,G=null,Y=null;r===1?U=Lo.getStyle(a,l,c,h,null):r===2?B=Lo.getStyle(u,d,p,m,null):(U=Lo.getStyle(a,l,c,h,null),B=Lo.getStyle(u,d,p,m,null),G=Lo.getStyle(g,y,b,P,null),Y=nc.getHoleStyle(w,F,H,z,V));let X=jn.getInstance().addPad(e,r,i,n,s,T,I,C,E,O,_,x,v,D,U,B,G,Y,L,void 0,k,N),K=new _i(X);return xp.getNumberManager().add(K.num),K.isTestPad=W,K.smartPad||(K.smartPad=we.smartMode?new nA(K.buildBBox(),e):null),this.addControllerCache(K),K}copy(e){if(e.shapes!=null)return this.copyPolygon(e);let{globalIndex:r,layerId:i,type:n,num:s,center:a,topType:l,topWidth:c,topHeight:h,topRatio:u,bottomType:d,bottomWidth:p,bottomHeight:m,bottomRatio:g,innerType:y,innerWidth:b,innerHeight:P,innerRatio:T,rotation:I,locked:C,net:E,expansionType:O,pasteExpansion:_,topSolderExpansion:x,bottomSolderExpansion:v,unusedInnerLayers:D,plated:w,holeLength:F,holeRadius:H,holeShape:z,holeRotation:V,holeOffset:W,isTestPad:L,padRule:k,padLen:N,attrsMap:U}=e;a=new S(a.x,a.y);let B=new S(W.x,W.y),G=r.slice(0,-16)+nr();return this.rebuild(G,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,x,v,D,w,F,H,z,V,B,L,q0.buildByJson(k),N,U)}delete(e){e instanceof Le&&(xp.getNumberManager().deleteNum(e.num),jn.getInstance().delete(e.model,e.model.globalIndex))}updateExpansion(){this.iterator(e=>{if(e.expansionType===1){let r=e.net,i=re.getInstance().getSolderExpansionByNet(r),n=re.getInstance().getPasteExpansionByNet(r),s=e.isTestPad?i.testPointTopExpansion:i.padTopExpansion,a=e.isTestPad?i.testPointBottomExpansion:i.padBottomExpansion;e.padExpansion=yu.getPadExpansion(e.model.expansionType,e.queryPasteExpansion(n),s,a)}})}getAllTestPad(){let e=super.getAllItem();return e=e.filter(r=>r.isTestPad),e}allAddSmartPad(){this.iterator(e=>{e.smartPad||(e.smartPad=new nA(e.buildBBox(),e.globalIndex))})}removeAllSmartPad(){this.iterator(e=>{e.smartPad&&(e.smartPad.remove(),e.smartPad=null)})}allSmartPadVisible(e){let r=!1;return this.iterator(i=>{i.smartPad&&(!r&&i.smartPad.isVisible!=e&&(r=!0),e?i.smartPad.visible():i.smartPad.hidden())}),r}addPolygonPad(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I){let C=xp.getNumberManager();xp.isStart&&(r==""&&(r="1"),xp.isStart=!1),r=C.getNum(r),C.add(r);let E=nr();e=this.getLayerId(e);let O=this.createModel(E,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I),_=new sn(O);return this.addControllerCache(_),_}addPolygonPadByModel(e,r=!1){let i=e.num;if(xp.getNumberManager().add(i),r){let l=e.globalIndex;jn.getInstance().getItem(l)==e&&jn.getInstance().delete(e,l),e.globalIndex=nr(),jn.getInstance().addModel(e)}let s=this.getLayerId(e.layerId);e.layerId!=s&&(e.layerId=s);let a=new sn(e);return this.addControllerCache(a),a}createModel(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E){let O=null,_=null,x=null,v=null,D=a;D.area()>0&&(D=D.reverse());let w=Lo.getStyle("POLYGON",-1,-1,-1,D);return r===1?O=w:r===2?_=w:(O=w,_=w.clone(),x=w.clone(),v=nc.getHoleStyle(y,b,P,T,I)),jn.getInstance().addPad(e,r,1,i,n,s,c,l,h,u,d,p,m,g,O,_,x,v,C,void 0,void 0,E)}rebuildPolygonPad(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E){let O=this.createModel(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E),_=new sn(O);return this.addControllerCache(_),_}copyPolygon(e){let{globalIndex:r,layerId:i,num:n,center:s,rotation:a,shapes:l,net:c,locked:h,expansionType:u,pasteExpansion:d,topSolderExpansion:p,bottomSolderExpansion:m,unusedInnerLayers:g,plated:y,holeLength:b,holeRadius:P,holeShape:T,holeRotation:I,holeOffset:C,padRule:E,attrsMap:O}=e,_=ge.build2(this.parseShape(l));s=new S(s.x,s.y),C=new S(C.x,C.y);let x=r.slice(0,-16)+nr();return this.rebuildPolygonPad(x,i,n,s,a,_,c,h,u,d,p,m,g,y,b,P,T,I,C,q0.buildByJson(E),O)}parseShape(e){let r=new Array;for(let i of e)for(let n in i){let s=i[n];if(n=="LINE"){let a=new S(s.start.x,s.start.y),l=new S(s.end.x,s.end.y),c=new M(a,l);r.push(c)}if(n=="ARC"){let a=new S(s.center.x,s.center.y),l=q.build2(a,s.startAngle,s.endAngle,s.rx,s.rx,s.sweep);r.push(l)}}return r}getLayerId(e){return e==1||e==2||e==12?e:1}};var Zhe=class extends yh{constructor(){super(...arguments);this.mgr=bn.getInstance()}addControllerCache(e){if(e.type==1){let i=re.getInstance().getDefaultBlindPhysics().getBlindVia(e.name);i==null||i.status.used.add(e.globalIndex)}Ye.addItem(e),kt.insert(e)}addViaByModel(e,r=!1){if(r){let n=e.globalIndex;bn.getInstance().getItem(n)==e&&bn.getInstance().delete(e,n),e.globalIndex=nr(),bn.getInstance().addModel(e)}let i=new Ue(e);return this.addControllerCache(i),i}initAddViaByModel(e){let r=new Ue(e);if(e.type==1){let n=re.getInstance().getDefaultBlindPhysics().getBlindVia(r.name);n==null||n.status.used.add(e.globalIndex)}return Ye.addInitItem(r),kt.insert(r),r}addVia(e,r,i,n,s,a,l,c,h,u,d,p,m=new Array,g=!1){let y=nr();a=oo(a),c=oo(c),e==0&&g&&(e=2);let b=bn.getInstance().addVia(y,e,r,i,n,s,a,l,c,h,u,d,p,m,g),P=new Ue(b);return this.addControllerCache(P),P}rebuild(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y=!1){l=oo(l),h=oo(h),r==0&&y&&(r=2);let b=bn.getInstance().addVia(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y),P=new Ue(b);return this.addControllerCache(P),P}copy(e){let{globalIndex:r,type:i,name:n,startLayer:s,endLayer:a,net:l,radius:c,center:h,holeRadius:u,locked:d,expansion:p,topExpansion:m,bottomExpansion:g,unusedInnerLayers:y,isSuture:b}=e,P=new S(h.x,h.y),T=r.slice(0,-16)+nr();return this.rebuild(T,i,n,s,a,l,c,P,u,d,p,m,g,y,b)}delete(e){e instanceof Ue&&bn.getInstance().delete(e.model,e.model.globalIndex)}getSameSizeVias(e){let r=new Array;r.push(e);let i=this.getAllItem();for(let n of i)n!=e&&n.radius==e.radius&&n.holeRadius==e.holeRadius&&r.push(n);return r}updateExpansion(){this.iterator(e=>{if(e.expansionType===1){let r=e.net,i=re.getInstance().getSolderExpansionByNet(r);e.viaExpansion=qp.getViaExpansion(e.expansionType,i.viaTopExpansion,i.viaBottomExpansion)}})}};function G2(o,t){let e=o.component;if(e&&(e instanceof Zi||e instanceof wh||e instanceof ml)){let r=e instanceof Zi?e.padId:e.lineId;switch(t){case"add":La.getInstance().addConnectRelatedId(r,o.globalIndex);break;case"delete":La.getInstance().delConnectRelatedId(r,o.globalIndex);break}}}var Jhe=class extends yh{constructor(){super(...arguments);this.mgr=Fi.getInstance()}addCircle(e,r,i,n,s,a,l,c){l=ru(l,r,e);let h=nr();(c==null||!J0(e,c,r))&&(c=a1(1,{type:e,layerId:r,strokeWidth:s}));let u=Fi.getInstance().addCircle(h,e,r,i,n,s,a,l,null,c),d=new Pr(u);return this.addControllerCache(d),G2(d.model,"add"),d}addControllerCache(e){Ye.addItem(e),kt.insert(e)}addCircleByModel(e,r=!1){if(r){let n=e.globalIndex;Fi.getInstance().getItem(n)==e&&Fi.getInstance().delete(e),e.globalIndex=nr(),Fi.getInstance().addModel(e)}let i=new Pr(e);return this.addControllerCache(i),G2(i.model,"add"),i}rebuild(e,r,i,n,s,a,l,c,h,u){c=ru(c,i,r),(u==null||!J0(r,u,i))&&(u=a1(1,{type:r,layerId:i,strokeWidth:a}));let d=Fi.getInstance().addCircle(e,r,i,n,s,a,l,c,h,u),p=new Pr(d);return this.addControllerCache(p),p}copy(e){let{globalIndex:r,type:i,layerId:n,center:s,radius:a,strokeWidth:l,locked:c,net:h,silkColor:u}=e,d=e.componentData,p=new bl(d,i),m=new S(s.x,s.y),g=r.slice(0,-16)+nr(),y=this.rebuild(g,i,n,m,a,l,c,h,ee.of7(u));return p!=null&&p.rebuildComponent(y),this.modifyRegionSelector(y,e.regionRuleSelector),y}delete(e){e instanceof Pr&&(G2(e.model,"delete"),e.type=="Partition"&&bo.getInstance().deleteItemById(e.globalIndex),Fi.getInstance().delete(e.model))}autoFill(){let e=this.getAllItem();for(let r of e)r.isVisible&&r.fill()}autoRefreshAll(){let e=this.getAllItem();for(let r of e)r.isVisible&&r.refreshRender()}modifyRegionSelector(e,r){if(e.type==="Constraint Region"){let i=e.globalIndex,n=re.getInstance().addRegionSelector(i);re.getInstance().updateRegionSelector(i,r,!0)}}};var Qhe=class extends yh{constructor(){super(...arguments);this.mgr=Qi.getInstance()}addControllerCache(e){Ye.addItem(e),kt.insert(e)}addRect(e,r,i,n,s,a,l,c=1,h=0,u=0,d,p){let m=p||nr(),g=this.buildModel(m,e,r,i,n,s,a,l,c,h,u,void 0,d),y=new rr(g);return this.addControllerCache(y),G2(y.model,"add"),y}addRectByModel(e,r=!1){if(r){let n=e.globalIndex;Qi.getInstance().getItem(n)==e&&Qi.getInstance().delete(e,n),e.globalIndex=nr(),Qi.getInstance().addModel(e)}let i=new rr(e);return this.addControllerCache(i),G2(i.model,"add"),i}rebuild(e,r,i,n,s,a,l,c,h=1,u=0,d=0,p=null,m){let g=this.buildModel(e,r,i,n,s,a,l,c,h,u,d,p,m),y=new rr(g);return this.addControllerCache(y),y}copy(e){let{globalIndex:r,type:i,layerId:n,start:s,width:a,height:l,net:c,locked:h,strokeWidth:u,rotation:d,cornerRadius:p,silkColor:m}=e,g=e.componentData,y=new bl(g,i),b=new S(s.x,s.y),P=r.slice(0,-16)+nr(),T=this.rebuild(P,i,n,b,a,l,c,h,u,d,p,ee.of7(m));return y!=null&&y.rebuildComponent(T),this.modifyRegionSelector(T,e.regionRuleSelector),T}delete(e){if(e instanceof rr){G2(e.model,"delete");let r=e.globalIndex;e.type=="Partition"&&bo.getInstance().deleteItemById(r),Qi.getInstance().delete(e.model,r)}}autoFill(){let e=this.getAllItem();for(let r of e)r.isVisible&&r.fill()}autoRefreshAll(){let e=this.getAllItem();for(let r of e)r.isVisible&&r.refreshRender()}modifyRegionSelector(e,r){if(e.type==="Constraint Region"){let i=e.globalIndex,n=re.getInstance().addRegionSelector(i);re.getInstance().updateRegionSelector(i,r,!0)}}buildModel(e,r,i,n,s,a,l,c,h=1,u=0,d=0,p=null,m){return i=xm(r,i,1),l=ru(l,i,r),(m==null||!J0(r,m,i))&&(m=a1(1,{type:r,layerId:i,strokeWidth:h})),Qi.getInstance().addRect(e,r,i,n,s,a,l,c,h,u,d,p,m)}};var u5=class extends yh{constructor(){super();this.mgr=io.getInstance();this.textAttr={"attr-layerid":Pe.getActiveLayerID(),"attr-text-typeface":"default","attr-text-size":12,"attr-rotation":0,"attr-locked":!1,"attr-origin":3,"attr-text-stroke-width":.8,"attr-reversed-phase":!1,"attr-reversed-phase-extend":0,"attr-mirror":!1}}addControllerCache(e){kt.insert(e)}addtextByModel(e,r=!1){if(r){let n=e.globalIndex;io.getInstance().getItem(n)==e&&io.getInstance().delete(e),e.globalIndex=nr(),io.getInstance().addModel(e)}let i=e.getParent()!==void 0?new Qce(e):new lr(e);return this.addControllerCache(i),i}addText(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y=!1,b=!1,P=tH){let T=nr();l=oo(l),p=oo(p);let I=io.getInstance().addText(T,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,null,ee.of7(P)),C=new lr(I);return this.addControllerCache(C),C}rebuild(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b=!1,P=!1,T=tH){let I=io.getInstance().addText(e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,null,ee.of7(T)),C=new lr(I);return this.addControllerCache(C),C}copy(e,r){let{globalIndex:i,layerId:n,key:s,showKey:a,value:l,showValue:c,fontFamily:h,fontSize:u,rotation:d,locked:p,position:m,origin:g,strokeWidth:y,reverse:b,reverseExpansion:P,mirror:T,font:I,silkColor:C,positionIsNull:E}=e;return r==null&&(r=i.slice(0,-16)+nr()),I!=null&&jy.copy(I,r),m=new S(m.x,m.y),this.rebuild(r,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,E,C)}delete(e){if(e instanceof lr){let r=this.getItem(e.globalIndex);(r==null&&e.isEmpty||r===e)&&io.getInstance().delete(e.model)}}changeTextAttribute(e){let r=new dt;for(let i of e)for(let n in i)if(Object.prototype.hasOwnProperty.call(i,n)){let s=i[n],a;if(n in this.textAttr){switch(n){case"attr-layerid":let l=parseInt(i["attr-layerid"]);isNaN(l)||(a=l);break;case"attr-text-typeface":a=i["attr-text-typeface"];break;case"attr-text-size":let c=parseFloat(i["attr-text-size"])/10;R.getInstance().unit!="mil"&&(c=r.conversion(R.getInstance().unit,"mil",c)),a=c;break;case"attr-rotation":let h=parseFloat(i["attr-rotation"])/180*Math.PI;isNaN(h)||(a=h);break;case"attr-locked":case"attr-mirror":case"attr-reversed-phase":a=s=="yes";break;case"attr-origin":let u=parseInt(i["attr-origin"]);isNaN(u)||(a=u);break;case"attr-text-stroke-width":let d=parseFloat(i["attr-text-stroke-width"])/10;R.getInstance().unit!="mil"&&(d=r.conversion(R.getInstance().unit,"mil",d)),a=d;break;case"attr-reversed-phase-extend":let p=parseFloat(i["attr-reversed-phase-extend"])/10;R.getInstance().unit!="mil"&&(p=r.conversion(R.getInstance().unit,"mil",p)),a=p;break}this.textAttr[n]=a}}}};var eue=class extends yh{constructor(){super(...arguments);this.mgr=Na.getInstance()}addProtractorByModel(e,r=!1){if(r){let s=e.globalIndex;Na.getInstance().getItem(s)==e&&Na.getInstance().delete(e),e.globalIndex=nr(),Na.getInstance().addModel(e)}let i=e.globalIndex,n=new Ga(e);return this.addControllerCache(n),n}addControllerCache(e){kt.insert(e)}addProtractor(e,r,i,n,s,a,l,c){let h=nr(),u=Na.getInstance().addProtractor(h,e,r,i,n,s,a,l,c),d=new Ga(u);return this.lastPrecision=d.precision,this.addControllerCache(d),d}rebuild(e,r,i,n,s,a,l,c,h){let u=Na.getInstance().addProtractor(e,r,i,n,s,a,l,c,h),d=new Ga(u);return this.addControllerCache(d),d}copy(e){let{globalIndex:r,layerId:i,width:n,fontsize:s,precision:a,center:l,end1:c,end2:h,locked:u,textPosition:d,silkColor:p}=e,m=new S(l.x,l.y),g=new S(c.x,c.y),y=new S(h.x,h.y),b=new S(d.x,d.y),P=r.slice(0,-16)+nr(),T=this.rebuild(P,i,n,s,a,m,g,y,u);return T.textPosition=b,T.silkColor=ee.of7(p),T}delete(e){e instanceof Ga&&Na.getInstance().delete(e.model)}};var tue=class extends yh{constructor(){super(...arguments);this.mgr=Ma.getInstance()}addControllerCache(e){kt.insert(e)}addDimensionByModel(e,r=!1){if(r){let n=e.globalIndex;Ma.getInstance().getItem(n)==e&&Ma.getInstance().delete(e,n),e.globalIndex=nr(),Ma.getInstance().addModel(e)}let i=new qs(e);return this.addControllerCache(i),i}addDimension(e,r,i,n,s,a,l,c,h,u){let d=nr(),p=Ma.getInstance().addDimension(d,e,r,i,n,s,a,l,c,h,u),m=new qs(p);return this.lastPrecision=m.precision,this.addControllerCache(m),m}rebuild(e,r,i,n,s,a,l,c,h,u,d){let p=Ma.getInstance().addDimension(e,r,i,n,s,a,l,c,h,u,d),m=new qs(p);return this.addControllerCache(m),m}copy(e){let{globalIndex:r,layerId:i,start:n,end:s,precision:a,height:l,width:c,unit:h,locked:u,leftPoint:d,rightPoint:p,silkColor:m}=e,g=new S(n.x,n.y),y=new S(s.x,s.y),b=new S(d.x,d.y),P=new S(p.x,p.y),T=r.slice(0,-16)+nr(),I=this.rebuild(T,i,g,y,b,P,a,l,c,h,u);return I.silkColor=ee.of7(m),I}delete(e){if(e instanceof qs){let r=e.globalIndex;Ma.getInstance().delete(e.model,r)}}};var rue=class extends Ei{constructor(){super();this.rubbish=new Set;this.netLength=new Map;this.netModify=new Map;this.netOptions=new Array;this.noneNetMap=new Map;this.updateNets={addNet:[],deleteNet:[],updateNetLength:{}};this.ratlineVisibleBeforeGray={};this.debounce=new t6;A.subscribe("cycleNetwork",this.clear.bind(this))}isBridgingCopper(e){return(e.getComponent()instanceof Zi&&e.getComponent()).isBridgingCopper}updateLeftTreeNets(){let e=R.getInstance().unit,r=this.updateNets.addNet.map(s=>({name:s,color:Ye.getSpecialColor(s).toString(),netLength:this.getNetLength(s,!0)}));this.updateNets.addNet=[];let i=[...this.updateNets.deleteNet];this.updateNets.deleteNet=[];let n={...this.updateNets.updateNetLength};this.updateNets.updateNetLength={},A.publish("updateNets",{addNet:r,deleteNet:i,updateNetLength:n,unit:e},Q()),this.updateLeftTree=null}notifyUpdateNets(){this.updateLeftTree==null&&(this.updateLeftTree=()=>{this.updateLeftTreeNets()});let e=this.updateLeftTree;this.debounce.debounce(e,200)}addItem(e){let r=e.net?e.net.toUpperCase():"";if(!(e instanceof He&&(["Constraint Region","Prohibited Region"].includes(e.type)||this.isBridgingCopper(e))))if(r!=""&&r!=null){let i=this.map.get(r);i==null&&(i=new Set,this.map.set(r,i),this.updateNets.addNet.push(r),this.notifyUpdateNets()),i.add(e),Hu.getNet(r)==null&&(Hu.addNet(r),Kf(r)),this.netModify.set(r,!0)}else{let i=e.model;if(r==""&&i instanceof xi&&Ud(i.layerId)&&this.isCopperModel(e)){let n=this.noneNetMap.get(r);n==null&&n==null&&(n=new Set,this.noneNetMap.set(r,n)),n.add(e),Hu.getNet(r)==null&&(Hu.addNet(r),Kf(r))}}}addInitItem(e){let r=e.net?e.net.toUpperCase():"";if(r!=""&&r!=null){let i=this.map.get(r);i==null&&(i=new Set,this.map.set(r,i)),i.add(e)}else{let i=e.model;if(r==""&&Ud(i.layerId)&&this.isCopperModel(e)){let n=this.noneNetMap.get(r);n==null&&n==null&&(n=new Set,this.noneNetMap.set(r,n)),n.add(e)}}}finishInit(){for(let[e]of this.map)Hu.getNet(e)==null&&(Hu.addNet(e),Kf(e)),this.netModify.set(e,!0)}isCopperModel(e){return e instanceof Qo?e instanceof He?e.type=="Fill Region"||e.type=="Line"||e.type=="TearDrop":!0:!1}updateNetLength(e,r=!1){let i=this.getNetLen(e);this.netLength.get(e)!=i&&(this.netLength.set(e,i),this.updateNets.updateNetLength[e]=i,!r&&this.notifyUpdateNets())}getNetLen(e){let r=0,i=this.getSameNetItems(e);for(let n=0;n<i.length;n++){let s=i[n];if(s instanceof Ge)r+=s.length;else if(s instanceof Le){let a=$o.getInstance().getPadLenByModel(s.model);a!=null&&(r+=a)}}return r}getSpecialColor(e,r=ee.BLACK){if(e!=null){let i=e.toUpperCase(),n=re.getInstance().getNet(i);return(n==null?void 0:n.color)||r}return r}getAllNets(){let e=new Array(this.map.size),r=0;for(let[i]of this.map)e[r]=i.toString(),r++;return e}getNetCount(){let e=new Map;for(let[r,i]of this.map)e.set(r.toString(),i.size);return e}getAllNoneNets(){let e=new Array,r=this.noneNetMap.keys();for(let i of r)e.push(i);return e}getNoneNetsItem(e){return this.noneNetMap.get(e)}getAllNoneNetsItems(){let e=[],r=this.noneNetMap.keys();for(let i of r)this.noneNetMap.get(i).forEach(s=>e.push(s));return e}getNetLength(e,r=!1){let i=e.toUpperCase();this.netModify.get(i)&&(this.updateNetLength(i,r),this.netModify.set(i,!1));let s=this.netLength.get(i);return s==null&&(s=0),s}modifyNet(e){let r=e.toUpperCase();this.netModify.set(r,!0)}isNetSelectFilterObj(e){return e instanceof He&&e.type=="Copper Region"||e instanceof Gi||e instanceof Jr}getSameNetItemsWithoutPourAndPlaneZoneByItem(e){return this.isNetSelectFilterObj(e)?[]:this.getSameNetItemsWithoutPourAndPlaneZone(Ao(e))}getSameNetItemsWithoutPourAndPlaneZone(e){let r=e?e.toUpperCase():null,i=r==null?null:this.map.get(r)||this.noneNetMap.get(r),n=new Array;if(i!=null)for(let s of i)this.isNetSelectFilterObj(s)||n.push(s);return n}getSameNetItems(e,r){let i=e.toUpperCase(),n=this.map.get(i),s=new Array,a=!!r;if(n!=null&&n!=null)for(let l of n)a?r(l)&&s.push(l):s.push(l);return s}dragHighlightNets(e){le.hightShowConfig.dragDarked&&this.highlightNets(e)}dragUnhighlightNet(){le.hightShowConfig.dragDarked&&this.unhighlightNet("")}getHighlightIds(e,r=!1,i=!1){e=e.toUpperCase();let n=Array.from(this.map.get(e)||[]);i&&(n=n.concat(Array.from(this.noneNetMap.get(e)||[])));let s,a=new qV,l=new Set;return l.add("Copper"),r&&(l.add("ArcTrack"),l.add("Track")),s=a.getGroupIds(n,c=>{let h=c.model.modelType;return!!l.has(h)}),s.push("Ratline"+e),r&&["ArcTrack","Track"].forEach(h=>{let u=h+e;s.includes(u)||(cn.getInstance().getEngineGroupId(u),s.push(u))}),s}highlightById(e){e.forEach(r=>{Mo.attachViewGroup(r,{visible:!0,doubleRgb:!0})}),this._viewGroupIds?this._viewGroupIds=this._viewGroupIds.concat(e):this._viewGroupIds=e}highlightNets(e,r=!1,i=!1){A.publish("stashHight",""),Pe.forceDeactive(!0);let n=[];for(let s of e)s&&xe.addAll(n,this.getHighlightIds(s,r,i));this.highlightById(n)}highlightNet(e,r=!1,i=!1){if(A.publish("stashHight",""),Pe.forceDeactive(!0),!e)return;let n=this.getHighlightIds(e,r,i);this.highlightById(n)}unhighlightNet(e,r=!1){var i;Pe.forceDeactive(!1),(i=this._viewGroupIds)==null||i.forEach(n=>{Mo.attachViewGroup(n,{visible:!0,doubleRgb:!1})}),delete this._viewGroupIds,A.publish("restoreHight","")}getNet(){return this.updateNetOptions(),this.netOptions}updateNetOptions(){let e=new Array,r=new Set;for(let i of this.getAllNets()){let n=Pne(i);n&&r.add(n)}for(let i of r){let n={};n.value=i,n.text=i,e.push(n)}this.netOptions=e}delete(e,r=e.net?e.net.toUpperCase():""){A.publish("hasModifyPcbItem",e);let i=this.map.get(r)||this.noneNetMap.get(r);i!=null&&(i.delete(e),i.size==0&&this.rubbish.add(r),this.netModify.set(r,!0))}clear(){for(let e of this.rubbish){let r=this.map.get(e)||this.noneNetMap.get(e);r!=null&&r.size==0&&(Hu.deleteNet(e),Kf(e,!0),this.map.delete(e),this.updateNets.deleteNet.push(e),this.notifyUpdateNets())}this.rubbish.clear()}};var xxt=Xd.getInstance(),iue=class extends Ei{addControllerCache(t){this.map.set(t.globalIndex,t)}combination(t,e){let r=Xd.getInstance().combination(t.map(n=>n.model),e),i=new qc(r);return this.addControllerCache(i),i}getGroupByName(t){for(let e of this.map.values())if(e.name==t)return e;return null}getGroupNameByGroupId(t){return Xd.getInstance().getGroupNameByGroupId(t)}getDefaultName(){let t=R.getInstance().partitionId,e="";return t&&(e=`partition_${t}_`),e+Xd.getInstance().getDefaultName()}joinCombination(t,e){let r=this.map.get(e);return Xd.getInstance().joinCombination(t.map(i=>i.model),e),r}removeFromCombination(t,e){let r=this.map.get(e);return Xd.getInstance().removeFromCombination(t.map(i=>i.model),e),r}getAllGroupId(){return Xd.getInstance().getAllGroupId()}getCombin(){return Xd.getInstance().getCombin()}copy(t){}rebuild(t,e,r){let i=Xd.getInstance().rebuild(t,e.map(s=>s.model),r),n=new qc(i);return this.map.set(t,n),n}rebuildByModel(t){let e=t.globalIndex,r=new qc(t);return this.addControllerCache(r),r}delete(t){let e=t.globalIndex;xxt.delete(t.model,e),t instanceof qc&&this.map.delete(e)}};var AD=class extends ua{constructor(e,r,i,n,s,a,l,c,h,u,d,p){super();this.type="Check Dimension";this._globalIndex=e,this.model=new QO(e,"Help Dimension",r,n,s,a,l,c,h,u,d,!0,.2,1.3,.1,i),kt.insert(this),this.initRefreshRender()}get globalIndex(){return this._globalIndex}get layerId(){return this.model.layerId}set layerId(e){this.model.layerId=e,this.refreshRender()}getLength(){return this.model.length*10}get locked(){return this.model.locked}set locked(e){this.model.locked=e}get textPosition(){return this.model.textPosition}get width(){return this.model.strokeWidth}set width(e){this.model.strokeWidth=e,this.refreshRender()}get unit(){return this.model.unit}set unit(e){this.model.unit=e,this.refreshRender()}get precision(){return this.model.precision}set precision(e){this.model.precision=e,this.refreshRender()}get start(){return this.model.start}set start(e){this.model.calibrateLine([this.start,this.left,this.start,e],!0,!1,0),this.model.start=e,this.refreshRender()}get end(){return this.model.end}set end(e){this.model.calibrateLine([this.end,this.right,this.end,e],!0,!0,1),this.model.end=e,this.refreshRender()}get strokeWidth(){return this.model.strokeWidth}modifyEnd(e){this.model.end=e,this.model.right=e,this.refreshRender()}modifyDimension(e,r){this.model.start=e,this.model.end=r,this.refreshRender()}get silkColor(){return this.model.silkColor}set silkColor(e){this.model.silkColor=e}get length(){let e=this.model.length*10;this.unit!="mil"&&(e=new dt().conversion1("mil",this.unit,e));let r=Math.pow(10,this.precision);return e=Math.round(e*r)/r,e}set length(e){this.model.length=e,this.refreshRender()}set height(e){this.model.fontSize=e,this.refreshRender()}get height(){return this.model.fontSize}set left(e){this.model.calibrateLine([this.right,this.end,this.left,e],!1,!1,2),this.model.left=e,this.refreshRender()}get left(){return this.model.left}set right(e){this.model.calibrateLine([this.left,this.start,this.right,e],!1,!0,3),this.model.right=e,this.refreshRender()}get right(){return this.model.right}click(){}get highlightColor(){return ee.RED}hightlight(e=!1){this.dimensionIsSelect=e,super.visible()}rotateFor(e,r){let i=Ae.translate(-e.x,-e.y,0).rotateZ(r).translate1(e.x,e.y,0);this.transform(i)}transform(e){this.model.transform(e),this.refreshRender()}buildBBox(){return this.model.buildBBox()}getLineBBox(){return Ik(this.start,this.end,this.left,this.right,this.strokeWidth,this.lineLen,this.arrLineLen)}isSelect(e,r){return!this.isVisible||this.getParent()!=null?!1:this.model.inShape(e,r)}toJSON(){return{globalIndex:this.globalIndex,layerId:this.layerId,start:this.start,end:this.end,precision:this.precision,height:this.height,width:this.width,unit:this.unit,locked:this.locked,leftPoint:this.left,rightPoint:this.right}}getType(){return 5}get textPath(){return this.model.text.outline}get textMatrix(){return this.model.text.matrix}get viewWidth(){return this.model.text.width}get viewHeight(){return this.model.text.height}get lineLen(){return .2}get arrLineLen(){return 1.3}get outlineModified(){return this.model.text.outlineModified}flip(e){}};var nue=class extends _2{async buildDevice(t){let{uuid:e,ticket:r}=t,i=new ux(e,R.getInstance().compilerChannel);await i.parse(!1,async n=>{try{return await n.onDocDetail("",r,t),{success:!0}}catch{return{success:!1}}}),ts.addDevice(e,i)}async buildFootPrint(t){if(!t)return!1;let{uuid:e,canvas:r,project_uuid:i,ticket:n}=t,s=R.getInstance().compilerChannel,a,l=!1;e.indexOf("_")>-1?(l=!0,a=new Sc(e,s,i)):a=new pI(e,s,i),await a.parse(!1,c=>{new F3(c).parseFull(r),c.onDocDetail("",n,t,!1)}),l&&(await Hi.add(a.source,s)).addChild(a),Hi.addFootPrint(e,a)}};function Dxt(o){let t=new Array(o.childrens.length);if(!o.isSimplify){let e=0;for(let r of o.childrens){let i=new Array(r.length),n=0;for(let s of r)s instanceof hs?i[n++]=new mt(s):i[n++]=new _t(s);t[e++]=i}}return new lt(o,t)}var oue=class{constructor(){this.position=null;this.data=null;A.subscribe("referPosition",this.setPosition.bind(this)),A.messageBus.rpcService("copy",this.copy.bind(this)),A.subscribe("pcb/paste",this.paste.bind(this),Q()),A.messageBus.rpcService("pcb/editor/pasteTemplates",this.pasteTemplate.bind(this))}setPosition(t){this.position=t}extractCopyInfo(t,e){let r={position:e,copyTime:new Date().getTime(),layerInfos:{}},i=[],n=[],s=[],a=new Set;for(let E of t)E instanceof hh||E instanceof AD||(E instanceof lt&&E.type==="TearDrop"&&!E.getChildrens().length&&E.refreshChildrenByOutline(),E.type==="Copper Region"?n.push(E):E instanceof lr?E.getParent()?s.push(E):(E.showKey||E.showValue)&&i.push(E):Mt.isChildPcb()?E instanceof ke||i.push(E):(i.push(E),E instanceof ke&&a.add(E)));let l;for(let E of s)l=E.getParent(),l!=null&&l instanceof ke&&!a.has(l)&&i.push(E);C(n),i.push(...n);let c={},h=new Set,u=[],d=new Map,p,m,g,y=[];for(let E of i)E instanceof ke&&(p=Hi.getItem(E.footprintUUID),p instanceof Sc&&y.push({customFootprintUuid:E.footprintUUID,componentGlobalIndex:E.globalIndex}));let b=new Map;for(let{customFootprintUuid:E}of y)b.set(E,(b.get(E)||0)+1);let P=new Set;for(let[E,O]of b)O>1&&P.add(E);let T=new Set;for(let E of i){let O=E.layerId||(E==null?void 0:E.startLayer);if(O&&(E instanceof ke||!T.has(O))){let{name:x,type:v}=Pe.getLayer(O);if(r.layerInfos[O]={name:x,type:v},T.add(O),E instanceof ke)for(let D of E.getItems()){let w=D.layerId||(D==null?void 0:D.startLayer);if(w&&!T.has(w)){let{name:F,type:H}=Pe.getLayer(w);r.layerInfos[w]={name:F,type:H},T.add(w)}}}let _=this.getFlag(E);if(c[_]||(c[_]=[]),E instanceof ke){p=Hi.getItem(E.footprintUUID);let x=null;p instanceof Sc&&(x=E.footprintUUID,p=Hi.getItem(p.source)),p||(p=Ji.getInstance().getItem(m.footprintUUID)),m=ts.getItem(E.deviceUUID);let v=x&&P.has(x);u.push({deviceUuid:(m==null?void 0:m.uuid)||"",footprintUuid:p.uuid,customFootprintUuid:x,componentGlobalIndex:v?E.globalIndex:void 0})}if(E instanceof Ps){let x=qd.getItem(E.hashId);d.set(E.hashId,{hashId:E.hashId,fileName:x.fileName})}if(l=E.getParent(),E instanceof lr&&E.key!=="")g=JSON.stringify(E.toJSON1()),c[_].push(g);else if(l!=null&&l instanceof lt&&l.type!="TearDrop"&&l.type!="Board Outline")h.has(l)||(h.add(l),g=JSON.stringify(l.toJSON()),c[_].push(g));else{let x=E.toJSON();E instanceof ke&&p&&(x.projectId=p.projectId),g=JSON.stringify(x),c[_].push(g)}}let I=Array.from(d.values());return{head:r,data:c,template:u,blobTemplete:I,doctype:R.getInstance().doctype};function C(E){let O=E.map(_=>({item:_,order:un.getOrder(_.globalIndex)}));O.sort((_,x)=>_.order-x.order);for(let _=0;_<E.length;_++)E[_]=O[_].item}}async copy(t){return this.data=this.extractCopyInfo(t,this.position),this.data.head.type="copy",this.data.head.uuid=R.getInstance().compiler.uuid,(await A.windowBridge.rpcCall("copyData",this.data,Q())).message}getData(){return this.data}async paste(t){var s;let e=R.getInstance().doctype;if(!R.getInstance().isactive||23==e)return;if(t==null){A.publish("getPasteData",t);return}let r=t.copyData,i=(s=t.copyData)==null?void 0:s.componentParts,n=t.copyData.doctype==3&&e==4;try{i&&await this.createTempComponentParts(i),(i||n)&&this.handleAcrossDocType(r)}finally{i&&this.recycleTempComponentParts(t.copyData)}if(e==3&&await this.pasteTemplate(t,n),r.head!=null&&this.data!=null&&r.head.copyTime<this.data.head.copyTime){r=this.data;for(let a of Object.keys(r.data)){let l=r.data[a];for(let c=0;c<l.length;c++){let h=JSON.parse(l[c]);if(h.custom){let u=Ji.getInstance().getItem(h.custom),d=await Ji.getInstance().cloneFootprint(u),p=d==null?void 0:d.uuid;p||console.error(`add footprint error footprintUuid: ${h.custom.uuid}`),h.custom.uuid=p}r.data[a][c]=JSON.stringify(h)}}}else if(t.map.blobMap&&Object.keys(t.map.blobMap).length>0){let a=[];for(let l in t.map.blobMap){let c=t.map.blobMap[l];if(!qd.getItem(c))try{let u=(await A.windowBridge.rpcCall(Jo.BLOB.GET,[c,R.getInstance().projectId],Q())).message;a.push({hashId:c,dataUrl:u.content,fileName:u.fileName})}catch(u){console.error(`Failed to load blob image with hashId: ${c}`,u)}}RB(a).then(()=>{A.publish("getPasteData",t)}).catch(l=>{console.error("Failed to add picture template from blobMap:",l),A.publish("getPasteData",t)});return}A.publish("getPasteData",t)}async createTempComponentParts(t){let{footprints:e,devices:r}=t,i=new nue(R.getInstance().compiler);for(let n of r)await i.buildDevice(n);for(let n of e)await i.buildFootPrint(n)}recycleTempComponentParts(t){let{footprints:e,devices:r}=t.componentParts||{footprints:[],devices:[]};for(let i of e)Hi.deleteById(i.uuid);for(let i of r)ts.deleteById(i.uuid);t.componentParts=null}async pasteTemplate(t,e=!1){var l,c;let r=t.map||{},i=r.customMap||{},n=i.componentGids||{},s=i.gidMap||{},a=(l=t.copyData)==null?void 0:l.data[15];try{if(r.deviceMap){let h=R.getInstance().compilerChannel;for(let u in r.deviceMap){let d=r.deviceMap[u];await ts.add(d,h)}}if(r.footprintMap||Object.keys(s).length){let h=R.getInstance().compilerChannel;if(e&&!a)throw new Error("Missing components data for PCB2 footprint paste.");let u=new Set,d=m=>{if(!e)return;let g,y=new RegExp(`"footprint":"${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}".*?"projectId":"([^"]+)"`);for(let b of a){let P=b.match(y);if(P){g=P[1];break}}Ji.curProjectUuid=g},p=async(m,g)=>{!g||u.has(g)||(d(m),g.indexOf("_")>-1?await Ji.getInstance().addCustomFootprint(g,h):await Ji.getInstance().add(g,h),u.add(g))};if(r.footprintMap)for(let m in r.footprintMap){if((c=n[m])!=null&&c.length)continue;let g=r.footprintMap[m];await p(m,g)}if(Object.keys(n).length&&Object.keys(s).length&&(a!=null&&a.length)){for(let m in n){let g=r.footprintMap[m];if(!g)continue;await p(m,g);let y=n[m]||[];for(let b of y){let P=s[b];await p(g,P)}}for(let m=0;m<a.length;m++){let g=JSON.parse(a[m]),y=g.globalIndex?s[g.globalIndex]:void 0;g.custom&&y&&(g.footprint=y,g.custom=y,a[m]=JSON.stringify(g))}}}}finally{Ji.curProjectUuid=R.getInstance().projectId}return a}handleAcrossDocType(t){let e={},r={reviver:(i,n)=>n&&(i==="start"||i==="end"||i==="center"||i==="position")?new S(n.x,n.y):n};for(let[i,n]of Object.entries(t.data))for(let s=n.length-1;s>=0;s--){let a=JSON.parse(n[s],r.reviver);if(!a)continue;let l=Number(i)===15,c=this.convertElementData(l,{data:l?a:{...a,flag:Number(i)},flag:Number(i)});if(c){n.splice(s,1);for(let[h,u]of Object.entries(c)){let d=Number(h);e[d]=e[d]||[],e[d].push(...u)}}}for(let[i,n]of Object.entries(e)){let s=Number(i);t.data[s]=t.data[s]||[],t.data[s].push(...n)}}convertElementData(t,e){let r=[],i=[],n={},s=null;try{if(t){let{footprint:a,custom:l,device:c,rotation:h,textOffset:u,position:d,ATTR:p}=e.data;if(!a||!c)return;let m=ts.getItem(c);if(!m)return;let g=new E2,y=m.createComponent(nr(),l!=null?l:a);y.resultNeedToBeCached=!1;let b=g.build(y,S.ORIGIN);if(!(b instanceof ke))return;s=b,b.rotation=h,b.textOffset=u,b.position=d;for(let P of p){let T=P.key,I=b.attrKeyText[T];if(I!=null&&b.removeAttribute(I),P.showKey||P.showValue){let C=this.createTempController(10,P);b.addAttribute(C)}}for(let P in b.attrKeyText){let T=b.attrKeyText[P];if(T.showKey||T.showValue){let I=JSON.stringify(T.toJSON1());r.push(I),i.push(this.getFlag(T))}}}else if(s=this.createTempController(e.flag,e.data),!s)return;if(s){let a=t?s.getItems():[s],l=t?new Set:null;for(let c of a){if(c instanceof Ps)continue;let h=c.getParent();if(t&&h&&c instanceof lr||!t&&c instanceof lr){let u=JSON.stringify(c.toJSON1());r.push(u),i.push(this.getFlag(c))}else if(h&&h instanceof lt&&l){if(!l.has(h)){l.add(h);let u=JSON.stringify(h);r.push(u),i.push(this.getFlag(h))}}else if(c instanceof Ir){let u={globalIndex:nr(),layerId:c.layerId,start:c.start,end:c.end,width:c.width,locked:c.locked,isSegment:c.width==0},d={globalIndex:c.globalIndex,type:"Line",layerId:c.layerId,shapes:[[{LINE:u}]],strokeWidth:c.width,locked:c.locked,net:c.net,silkColor:null,componentData:null,regionRuleSelector:null};r.push(JSON.stringify(d)),i.push(16)}else if(c instanceof He)if(c.type=="TearDrop"){let u=c.toJSON();u.type="Fill Region",u.componentData=null,r.push(JSON.stringify(u)),i.push(this.getFlag(c))}else if(c.type=="Board Outline"){let u=c.toJSON();u.type="Line",r.push(JSON.stringify(u)),i.push(this.getFlag(c))}else r.push(JSON.stringify(c)),i.push(this.getFlag(c));else r.push(JSON.stringify(c)),i.push(this.getFlag(c))}}for(let a=0;a<i.length;a++){let l=i[a];n[l]=n[l]||[],n[l].push(r[a])}return n}finally{s&&(!t&&(s.sendDeleteMsg=!1),s.remove(),A.publish("delete",s))}}createTempController(t,e){switch(t){case 1:{let{globalIndex:r,layerId:i,start:n,end:s,width:a,locked:l,net:c}=e,h=new zr(r,i,n,s,a,l,c,null),u=new Ir(h);return u.update(),u}case 4:{let{globalIndex:r,layerId:i,center:n,radius:s,width:a,startAngle:l,endAngle:c,sweep:h,locked:u,net:d,arcType:p}=e,m=new Ii(r,i,n,s,a,l,c,h,u,d,p,null),g=new yi(m);return g.update(),g}case 6:{let{globalIndex:r,type:i,layerId:n,center:s,radius:a,strokeWidth:l,locked:c,net:h,silkColor:u,componentData:d}=e,p=new Ip(r,i,n,s,a,l,c,h,ee.of7(u),null,null);if(p){let m=new Pr(p);if(m.update(),d){let g=new bl(d,i);g!=null&&g.rebuildComponent(m)}return m}}case 9:{let{globalIndex:r,type:i,layerId:n,start:s,width:a,height:l,net:c,locked:h,strokeWidth:u,rotation:d,cornerRadius:p,silkColor:m,componentData:g}=e,y=new Sp(r,i,n,s,a,l,d,p,c,u,h,ee.of7(m),null,null);if(y){let b=new rr(y);if(b.update(),g){let P=new bl(g,i);P!=null&&P.rebuildComponent(b)}return b}}case 10:{let{globalIndex:r,layerId:i,key:n,showKey:s,value:a,showValue:l,fontFamily:c,fontSize:h,rotation:u,locked:d,position:p,origin:m,strokeWidth:g,reverse:y,reverseExpansion:b,mirror:P,positionIsNull:T,silkColor:I}=e,C=oo(h),E=oo(g),O=n!==""?o3:Ku,_=new O(nr(),i,0,n,s,a,l,c,C,u,p,m,E,y,b,P,T,[],0,0,d,ee.of7(I));return new lr(_)}case 16:{let{globalIndex:r,type:i,layerId:n,shapes:s,strokeWidth:a,net:l,locked:c,silkColor:h,componentData:u,bbox:d,outline:p}=e,m={layerId:n,strokeWidth:a,locked:c},g=s.map(b=>b.map(P=>{for(let T in P){if(T=="LINE"){let{start:I,end:C}=P[T];return new wc(nr(),I,C,m)}if(T=="ARC"){let{layerId:I,center:C,radius:E,width:O,startAngle:_,endAngle:x,sweep:v,locked:D,arcType:w}=P[T];return new zc(nr(),C,E,_,x,v,m,w)}}}).filter(P=>P!=null)),y=new Ep(r,i,n,g,a,l,c,ee.of7(h),null,d,p);if(y){let b=Dxt(y);if(b.update(),u){let P=new bl(u,i);P!=null&&P.rebuildComponent(b)}return b}}}}getCombinationInfo(t){let e=new Array;for(let i of t){let n=i.getGroupID();n!=null&&e.indexOf(n)<0&&e.push(n)}let r=new Array;for(let i of e){let s=Ht.getItem(i).getItems(),a=new Array;for(let l of s){let c=t.indexOf(l);if(c>=0)a.push(c);else break}s.length==a.length&&r.push(a)}return r}getFlag(t){if(t instanceof Ir)return 1;if(t instanceof _i)return 2;if(t instanceof Ue)return 3;if(t instanceof yi)return 4;if(t instanceof Pr)return 6;if(t instanceof rr)return 9;if(t instanceof lr)return 10;if(t instanceof Ga)return 11;if(t instanceof qs)return 12;if(t instanceof da)return 14;if(t instanceof ke)return 15;if(t instanceof lt)return 16;if(t instanceof mt)return 16;if(t instanceof _t)return 16;if(t instanceof sn)return 17;if(t instanceof Mn)return 18;if(t instanceof Ps)return 19}getManager(t){switch(t){case 1:return pr;case 2:return Qt;case 3:return Wr;case 4:return pr;case 6:return Kt;case 9:return Xt;case 10:return ri;case 11:return os;case 12:return Yo;case 14:return jo;case 15:return Ar;case 16:case 16:case 16:return pt;case 17:return Qt;case 18:return Bn;case 19:return So}}};var sue=class extends yh{constructor(){super(...arguments);this.mgr=sl.getInstance()}addControllerCache(e){kt.insert(e)}addRadiusMarkByModel(e){let r=new da(e);return this.addControllerCache(r),r}addRadius(e,r,i,n,s,a,l,c,h){let u=nr(),d=sl.getInstance().addRadius(u,e,r,i,n,s,a,l,c,h),p=new da(d);return this.lastPrecision=p.precision,this.addControllerCache(p),p}rebuild(e,r,i,n,s,a,l,c,h,u){let d=sl.getInstance().addRadius(e,r,i,n,s,a,l,c,h,u),p=new da(d);return this.addControllerCache(p),p}copy(e){let{globalIndex:r,layerId:i,start:n,end:s,width:a,height:l,length:c,precision:h,unit:u,locked:d,textPosition:p,silkColor:m}=e,g=new S(n.x,n.y),y=new S(s.x,s.y);p=new S(p.x,p.y);let b=r.slice(0,-16)+nr(),P=this.rebuild(b,i,g,y,a,l,c,h,u,d);return P.textPosition=p,P.silkColor=ee.of7(m),P}delete(e){e instanceof da&&sl.getInstance().delete(e.model)}};var aue=class{add(t,e,r,i,n){let s=nr(),a=new wc(s,e,r,{layerId:t,strokeWidth:i,locked:n}),l=new mt(a);return Ky.getInstance().updateItem(l),l}addByModel(t,e=!1){e&&(t.globalIndex=nr());let r=new mt(t);return Ky.getInstance().updateItem(r),r}rebuild(t,e,r,i,n,s){let a=new wc(t,r,i,{layerId:e,strokeWidth:n,locked:s}),l=new mt(a);return Ky.getInstance().updateItem(l),l}copy(t){let{globalIndex:e,layerId:r,start:i,end:n,width:s,locked:a}=t,l=new S(i.x,i.y),c=new S(n.x,n.y);return this.add(r,l,c,s,a)}};var lue=class{constructor(){this._arcType=1}set arcType(t){this._arcType=t}get arcType(){return this._arcType}addArc(t,e,r,i,n,s,a,l,c=1){let h=nr(),u=new zc(h,e,r,n,s,a,{layerId:t,strokeWidth:i,locked:l},c),d=new _t(u);return Ky.getInstance().updateItem(d),d}addArcByModel(t,e=!1){e&&(t.globalIndex=nr());let r=new _t(t);return Ky.getInstance().updateItem(r),r}rebuild(t,e,r,i,n,s,a,l,c,h=1){let u=new zc(t,r,i,s,a,l,{layerId:e,strokeWidth:n,locked:c},h),d=new _t(u);return Ky.getInstance().updateItem(d),d}copy(t){let{globalIndex:e,layerId:r,center:i,radius:n,width:s,startAngle:a,endAngle:l,sweep:c,locked:h,arcType:u}=t,d=new S(i.x,i.y);return this.addArc(r,d,n,s,a,l,c,h,u)}};var cue=class extends yh{constructor(){super(...arguments);this.mgr=vi.getInstance();this.idMapTears=new Map}clearIdMapTear(e){let r=this.idMapTears.get(e);r!=null&&r.size===0&&this.idMapTears.delete(e)}addControllerCache(e){Ye.addItem(e),kt.insert(e)}addPolygon(e,r,i,n,s,a,l,c){let h=nr(),u=i.map(m=>m.map(g=>g.model));s=ru(s,r,e),(c==null||!J0(e,c,r))&&(c=a1(1,{type:e,layerId:r,strokeWidth:n}));let d=vi.getInstance().addPolygon(h,e,r,u,n,s,a,null,c,null,l),p=new lt(d,i);return p.updateFilterVisible=!0,p.refreshFilterVisible(),this.addControllerCache(p),p}addPolygonByModel(e,r,i=!1){if(i){let s=e.globalIndex;vi.getInstance().getItem(s)==e&&vi.getInstance().delete(e,s),e.globalIndex=nr(),vi.getInstance().addModel(e)}let n=new lt(e,r);return this.addControllerCache(n),G2(n.model,"add"),n.fill(),n}rebuild(e,r,i,n,s,a,l,c,h){let u=n.map(m=>m.map(g=>g.model));a=ru(a,i,r),(h==null||!J0(r,h,i))&&(h=a1(1,{type:r,layerId:i,strokeWidth:s}));let d=vi.getInstance().addPolygon(e,r,i,u,s,a,l,c,h),p=new lt(d,n);return this.addControllerCache(p),p}copy(e){let r=e.globalIndex,i=e.type,n=parseInt(e.layerId),s=e.shapes,a=parseFloat(e.strokeWidth),l=e.net,c=e.locked,h=e.componentData,u=e.silkColor,d=new bl(h,i),p=s.map(y=>y.map(b=>{for(let P in b){if(P=="LINE")return Cu.copy(b[P]);if(P=="ARC")return Yc.copy(b[P])}}).filter(b=>b!=null)),m=r.slice(0,-16)+nr(),g=this.rebuild(m,i,n,p,a,l,c,ee.of7(u));return d!=null&&d.rebuildComponent(g),this.modifyRegionSelector(g,e.regionRuleSelector),g}delete(e){if(e instanceof lt){let r=e.globalIndex;if(G2(e.model,"delete"),e.type=="Partition"&&bo.getInstance().deleteItemById(r),vi.getInstance().delete(e.model,r),e.type=="TearDrop"){let i=e.getComponent().connects;for(let n=0;n<i.length;n++){let s=this.idMapTears.get(i[n]);typeof s<"u"&&s.delete(e)}}}}autoFill(){let e=this.getAllItem();for(let r of e)r.isVisible&&r.notShowFill&&!["Line","Copper Region","Board Outline"].includes(r.type)&&r.fill()}autoRefreshAll(){let e=this.getAllItem();for(let r of e)r.isVisible&&r.refreshRender()}getTears(e){return this.idMapTears.get(e)}idMapTearsIsNull(){return this.idMapTears.size===0}deleteConnects(e,r){r.forEach(i=>{var n;(n=this.idMapTears.get(i))==null||n.delete(e)})}addConncect(e,r){r.forEach(i=>{let n=this.idMapTears.get(i);n==null&&(n=new Set,this.idMapTears.set(i,n)),n.add(e)})}modifyConnect(e,r){let n=e.getComponent().connects;n.forEach(s=>{var a;(a=this.idMapTears.get(s))==null||a.delete(e)}),n.length=0,xe.addAll(n,r),n.forEach(s=>{let a=this.idMapTears.get(s);a==null&&(a=new Set,this.idMapTears.set(s,a)),a.add(e)})}modifyRegionSelector(e,r){if(e.type==="Constraint Region"){let i=e.globalIndex,n=re.getInstance().addRegionSelector(i);re.getInstance().updateRegionSelector(i,r,!0)}}};function Rje(){Sn.getInstance().recycle(),jn.getInstance().recycle(),bn.getInstance().recycle(),Hs.getInstance().recycle(),_p.getInstance().recycle(),Ma.getInstance().recycle(),Na.getInstance().recycle(),sl.getInstance().recycle(),vi.getInstance().recycle(),Qi.getInstance().recycle(),Fi.getInstance().recycle(),qo.getInstance().recycle(),Xo.getInstance().recycle(),UP.getInstance().recycle(),io.getInstance().recycle(),Ms.getInstance().recycle(),Xd.getInstance().recycle(),Ze.getInstance().recycle(),re.getInstance().recycle(),La.getInstance().recycle(),bo.getInstance().recycle()}var hue=class{constructor(){this.groupCommand=null;A.subscribe("clearElements",this.clearElements.bind(this)),A.subscribe("clearAll",this.clearAll.bind(this)),A.subscribe("previewClearAll",this.previewClearAll.bind(this))}clearElements(t){if(!(!R.getInstance().isactive||23==R.getInstance().doctype)){this.groupCommand=new De("clearElements"),A.publish("clearSelect","");for(let e of t)switch(e){case"track":this.delete(pr);break;case"via":this.delete(Wr);break;case"suture via":this.deleteSutureVia();break;case"text":this.delete(ri);break;case"attr":this.deleteAttr(ri);break;case"device":this.delete(Ar);break;case"testPoint":this.delete(Qt,!0);break;case"pad":this.delete(Qt);break;case"boardOutline":case"boardCutout":case"region":case"fpcStiffener":case"prohibit":case"constraint":case"pour":case"line":case"3dShellOutline":case"3dShellScrewPillar":case"3dShellSideSlotDatumLine":case"3dShellSideSlotRegion":case"3dShellTopSlotRegion":case"3dShellTopBottomEntity":case"3dShellSlotEntity":{this.delete2Dline(pt,e),this.delete2Dline(Kt,e),this.delete2Dline(Xt,e);break}case"image":this.delete(Bn);break;case"trueColorPicture":this.delete(So);break;case"dimension":{this.delete(jo),this.delete(Yo),this.delete(os);break}case"teardrop":this.delete2Dline(pt,e);default:}this.groupCommand.length>0&&(qe.executeCommand(this.groupCommand),A.publish("flushService","")),this.groupCommand=null,ze.crossWindow()}}clearAll(t,e,r=!0,i=!0){!R.getInstance().isactive||23==R.getInstance().doctype||(this.groupCommand=t||new De("clear all"),A.publish("clearSelect",""),this.deleteAll(Ar,r,e),this.deleteAll(pr,r,e),this.deleteAll(Wr,r,e),this.deleteAttrAll(ri,r,e),this.deleteAll(Qt,r,e),this.deleteAll(pt,r,e),this.deleteAll(Kt,r,e),this.deleteAll(Xt,r,e),this.deleteAll(jo,r,e),this.deleteAll(Yo,r,e),this.deleteAll(os,r,e),this.deleteAll(Bn,r,e),this.deleteAll(So,r,e),this.groupCommand.length>0&&i&&(qe.executeCommand(this.groupCommand),A.publish("flushService","")),this.groupCommand=null,ze.crossWindow(),A.messageBus.publish("RestoreToolStatus",void 0))}previewClearAll(){if(23!=R.getInstance().doctype)return;this.groupCommand=null,A.publish("clearSelect",""),Rje(),jhe(),Mo.clear();let t=[];for(let r of Pe.getAllLayer())t.push(r.layerID);for(let r of Ze.getInstance().getAllHelpLayer())t.push(r);let e=cn.getInstance();for(let r of t){let i=e.getLayer(r);i&&i.clear()}R1.clear(),Pe.layerMap={},this.groupCommand=null}async deleteTemplate(){await Hi.clear(),await ts.clear(),jy.clear()}deleteAll(t,e=!0,r,i=!1){let n=t.getAllItem(),s=typeof r=="function";for(let a of n)if(!(s&&r(a))&&!(!i&&(!Mt.checkIsCanEditByItem(a)||Mt.isChildPcb()&&(a instanceof ke||a instanceof He&&a.type=="Partition")))&&(e&&!a.locked||!e)&&a.getParent()==null){if(this.groupCommand!=null){let l=Ce.dispatch(a,"delete");this.groupCommand.addCommand(l)}A.publish("hasModifyPcbItem",a),a.remove(),A.publish("delete",a)}}deleteAttrAll(t,e=!0,r,i=!1){let n=t.getAllItem(),s=typeof r=="function";for(let a of n)if(!(s&&r(a))&&!(!i&&(!Mt.checkIsCanEditByItem(a)||Mt.isChildPcb()&&(a instanceof ke||a instanceof He&&a.type=="Partition")))&&(e&&!a.locked||!e)&&a.getParent()==null){if(R.getInstance().doctype==4&&a.key=="Footprint"){this.hiddenAttr(a);continue}if(this.groupCommand!=null){let l=Ce.dispatch(a,"delete");this.groupCommand.addCommand(l)}A.publish("hasModifyPcbItem",a),a.remove(),A.publish("delete",a)}}deleteAttr(t){let e=t.getAllItem();for(let r of e){if(!Mt.checkIsCanEditByItem(r))continue;let i=r.getGroupID(),n=r.getParent();if(!r.locked&&n instanceof ke){if(R.getInstance().doctype==4&&r.key=="Footprint"){this.hiddenAttr(r);continue}if(this.groupCommand!=null){let s=Ce.dispatch(r,"modify");this.groupCommand.addCommand(s)}this.deleteCombinationMsg(i,r.globalIndex,r.number),A.publish("hasModifyPcbItem",r),r.showKey=!1,r.showValue=!1}}}hiddenAttr(t){if(this.groupCommand!=null){let e=Ce.dispatch(t,"modify");this.groupCommand.addCommand(e)}A.publish("hasModifyPcbItem",t),t.showKey=!1,t.showValue=!1}delete(t,e=!1){let r=t.getAllItem(),i=[];for(let n of r){if(n instanceof Le){if(n.isTestPad===e){i.push(n);continue}continue}i.push(n)}for(let n of i){if(!Mt.checkIsCanEditByItem(n))continue;let s=n.getGroupID();if(!n.locked&&n.getParent()==null){if(R.getInstance().doctype==4&&n instanceof lr&&n.key=="Footprint"){this.hiddenAttr(n);continue}if(this.groupCommand!=null){let a=Ce.dispatch(n,"delete");this.groupCommand.addCommand(a)}this.deleteCombinationMsg(s,n.globalIndex,n.number),A.publish("hasModifyPcbItem",n),n.remove(),A.publish("delete",n)}}}deleteCombinationMsg(t,e,r){if(t!=null){let i=Ht.getItem(t).name;tC.addObj(e,r),tC.addGroup(t,i),tC.execute()}}deleteSutureVia(){let t=Wr.getAllItem();for(let e of t){if(!Mt.checkIsCanEditByItem(e))continue;let r=e.getGroupID();if(!e.locked&&e.getParent()==null&&e.isSuture){if(this.groupCommand!=null){let i=Ce.dispatch(e,"delete");this.groupCommand.addCommand(i)}this.deleteCombinationMsg(r,e.globalIndex,e.number),A.publish("hasModifyPcbItem",e),e.remove(),A.publish("delete",e)}}}delete2Dline(t,e){let r=t.getAllItem();for(let i of r){if(!Mt.checkIsCanEditByItem(i))continue;let n=i.getGroupID(),s=this.getType(i),a=i.getParent();if(!i.locked&&s==e&&a==null){if(this.groupCommand!=null){let l=Ce.dispatch(i,"delete");this.groupCommand.addCommand(l)}this.deleteCombinationMsg(n,i.globalIndex,i.number),A.publish("hasModifyPcbItem",i),i.remove(),A.publish("delete",i)}}}getType(t){if(t instanceof Ir)return"track";if(t instanceof Ue)return"via";if(t instanceof lr)return"text";if(t instanceof ke)return"device";if(t instanceof _i){if(t.getParent()==null)return"pad"}else if(t instanceof sn){if(t.getParent()==null)return"polygonpad"}else if(t instanceof Pr)switch(t.type){case"Line":return"line";case"Copper Region":return"pour";case"Prohibited Region":return"prohibit";case"Constraint Region":return"constraint";case"Partition":return"partition";case"Fill Region":return"region";case"FPC Stiffener":return"fpcStiffener";case"Board Outline":return"boardOutline";case"Slot Region":return"boardCutout";case"3D Shell - Outline":return"3dShellOutline";case"3D Shell - Screw Pillar":return"3dShellScrewPillar";case"3D Shell - Side Datum Line":return"3dShellSideSlotDatumLine";case"3D Shell - Top Slot Region":return"3dShellTopSlotRegion";case"3D Shell - Side Slot Region":return"3dShellSideSlotRegion";case"3D Shell - Top/Bottom Entity":return"3dShellTopBottomEntity";case"3D Shell - Side Entity":return"3dShellSlotEntity"}else if(t instanceof rr)switch(t.type){case"Line":return"line";case"Copper Region":return"pour";case"Prohibited Region":return"prohibit";case"Constraint Region":return"constraint";case"Partition":return"partition";case"Fill Region":return"region";case"FPC Stiffener":return"fpcStiffener";case"Board Outline":return"boardOutline";case"Slot Region":return"boardCutout";case"3D Shell - Outline":return"3dShellOutline";case"3D Shell - Screw Pillar":return"3dShellScrewPillar";case"3D Shell - Side Datum Line":return"3dShellSideSlotDatumLine";case"3D Shell - Top Slot Region":return"3dShellTopSlotRegion";case"3D Shell - Side Slot Region":return"3dShellSideSlotRegion";case"3D Shell - Top/Bottom Entity":return"3dShellTopBottomEntity";case"3D Shell - Side Entity":return"3dShellSlotEntity"}else if(t instanceof lt)switch(t.type){case"Line":return"line";case"Copper Region":return"pour";case"Prohibited Region":return"prohibit";case"Constraint Region":return"constraint";case"Partition":return"partition";case"Fill Region":return"region";case"FPC Stiffener":return"fpcStiffener";case"Board Outline":return"boardOutline";case"Slot Region":return"boardCutout";case"3D Shell - Outline":return"3dShellOutline";case"3D Shell - Screw Pillar":return"3dShellScrewPillar";case"3D Shell - Side Datum Line":return"3dShellSideSlotDatumLine";case"3D Shell - Top Slot Region":return"3dShellTopSlotRegion";case"3D Shell - Side Slot Region":return"3dShellSideSlotRegion";case"3D Shell - Top/Bottom Entity":return"3dShellTopBottomEntity";case"3D Shell - Side Entity":return"3dShellSlotEntity";case"TearDrop":return"teardrop"}else{if(t instanceof qs)return"dimension";if(t instanceof Ga)return"dimension";if(t instanceof da)return"dimension";if(t instanceof Mn)return"image";if(t instanceof Ps)return"trueColorPicture"}return""}};function Dje(o,t,e=!0,r,i,n,s,a){let l="getNetListOfPcb-time";Cn(l);let{pageId:c}=n||{},h={netList:{version:"2.0.0",components:{}},repeatMap:{},noneMap:[],componentPinIdMap:{}},{netList:u,repeatMap:d,noneMap:p,componentPinIdMap:m}=h,g=u.components,y=0,b=[];o.forEach(v=>{var L;let D=v instanceof Bi?v:v.model,w=sFe(D),F=Object.assign({},w);t=t||"Unique ID";let H=F[t];if(e){let k=!1;for(H||(H="$"+ ++y,k=!0);b.includes(H);)H="$"+ ++y,k=!0;k&&r&&r(v,t,H)}F.FootprintName=D.footprintId||"",F.DeviceName=D.device||"",F.SymbolName=w.Symbol,F.Device=v.deviceUUID,F.Designator=((L=v.numShape)==null?void 0:L.value)||v.name,F["Group ID"]=v.combinationID,F["Channel ID"]=v.channelID,F["Reuse Block"]=v.reuseBlock;let z=a?a(v):null;F.Footprint=z||v.footprintUUID,F["PCB Layer"]=v.layerId==1?"TopLayer":"BottomLayer",i&&i(v,F);let V={};H&&(m[H]={}),v.getPads().forEach(k=>{let U=k.num,B=k.showNet;if(V[k.num]={name:"",number:U,net:B},H){let G=m[H][k.num];G?Array.isArray(G)?G.push(k.globalIndex):m[H][k.num]=[G,k.globalIndex]:m[H][k.num]=k.globalIndex}});let W={props:F,pinInfoMap:V,source:{pageId:c,componentId:v.globalIndex,isPartition:s?s(v):!1,displayId:Tr+v.number}};z&&(W.source.id=v.footprintUUID),H?b.includes(H)?(d[H]||(d[H]=[g[H]]),d[H].push(W)):(g[H]=W,b.push(H)):p.push(W)});let P=re.getInstance();u.designRule={trackPhysics:{},netRule:{}};let T=u.designRule.trackPhysics,I=10;P.getAllTrackPhysics().forEach(v=>{let D=v.unit,w=rH(D,I),F={name:v.name,isDefault:v.isDefault,unit:D,strokeValue:{}},H=F.strokeValue;v.iterateTable((z,V)=>{let W={default:tb(z.defaultValue,I,w),min:tb(z.minValue,I,w),max:tb(z.maxValue,I,w)};H[V.toString()]=W}),T[F.name]=F});let C=u.designRule.netRule;P.getAllNets().forEach(v=>{let D=v.name;D&&(C[D]={net:D,ruleMap:{TrackPhysics:x(v.trackPhysics)}})});let E=u.netClass={};P.getAllNetClass().forEach(v=>{let D=v.name;D&&(E[D]={name:D,nets:Array.from(v._nets),netRule:{}})});let O=u.equalLengthNetGroup={};P.getAllEqualLengthGroups().forEach(v=>{let D=v.name;D&&(O[D]={name:D,nets:Array.from(v.getNets()),useRuleName:x(v.netLengthPhysics)})});let _=u.differentialPair={};return P.getAllNetDifferentials().forEach(v=>{var F,H;let D=v.name,w={name:D,positiveNet:((F=v.positiveNet)==null?void 0:F.name)||"",negativeNet:((H=v.negativeNet)==null?void 0:H.name)||""};_[D]=w}),Xi(l),h;function x(v){return!v||v=="default"?"":v}}var _D=class extends yh{constructor(){super(...arguments);this.mgr=Ms.getInstance()}isEmpty(){return this.mgr.itemsCount==0}addControllerCache(e){this.add2Template(e),kt.insert(e)}addComponentByModel(e,r,i,n=!1){if(n){let a=i.globalIndex;Ms.getInstance().getItem(a)==i&&Ms.getInstance().delete(i,a),i.globalIndex=nr(),Ms.getInstance().addModel(i)}let s=new ke(e,r,i);return this.addControllerCache(s),s}add(e,r,i,n,s,a,l,c,h,u,d){let p=nr();h.locked=c;let m=a.map(P=>P.model),g=new Array;for(let P of l){let T=P.model;T instanceof xi&&g.push(T)}let y=Ms.getInstance().add(p,e,r,i,n,s,m,g,h,u,d),b=new ke(a,l,y);return this.addControllerCache(b),b}rebuild(e,r,i,n,s,a,l,c,h,u,d,p){u.locked=h;let m=l.map(P=>P.model),g=new Array;for(let P of c){let T=P.model;T instanceof xi&&g.push(T)}let y=Ms.getInstance().add(e,r,i,n,s,a,m,g,u,d,p),b=new ke(l,c,y);return this.addControllerCache(b),b}copy(e,r){let{footprint:i,device:n,globalIndex:s,layerId:a,position:l,rotation:c,textOffset:h,locked:u,attrsMap:d,ATTR:p,pads:m,custom:g,silkColor:y}=e,b=new Array;l=new S(l.x,l.y),h=new S(h.x,h.y);let P=Hi.getItem(i),T=null;if(g!=null){let v=g;T=v.split("_")[1],P=Hi.getItem(v)}let I,C;T==null&&(T=nr()),n!=null?(C=ts.getItem(n),I=C.copy(P.uuid,T)):(I=new s3(P.uuid,"",T,P.getBBox()),I=P.generate(I)),I.attrsMap=d;let O=new E2().build(I,S.ORIGIN,!0,r);O.layerId=a,O.rotation=c,O.textOffset=h,O.locked=u,O.position=l,y&&(O.silkColor=y);let _=O.getAllId();p.forEach(v=>{let D=[...v.globalIndex.matchAll(/[a-zA-Z]+[0-9]+/g)],w="",F="";D.length==2?(w=D[0][0],F=D[1][0]):F=D[D.length-1][0];let H;for(;H=`${O.globalIndex}${F}`,!!_.has(H);)F=s.slice(0,-16)+nr();_.add(H);let z=ri.copy(v,H);z.key=v.key,z.showKey=v.showKey,b.push(z)}),b.forEach(v=>{if(v.key=="Designator"){let D=d.Designator;d.Designator=D,v.value=D}else v.key=="Footprint"?(d.Footprint=P.footprintId,v.value=P.footprintId):v.key=="Device"&&C!=null&&(d.Device=C.name,v.value=C.name);O.addAttribute(v)}),this.add2Template(O);let x=Op(v=>v.num,m);if(O.getPads().forEach(v=>{let D=x.get(v.num);if(D!=null)if(D.length==1)v.net=D[0].net,D[0].padLen!=null&&$o.getInstance().setPadLen(O.globalIndex,v.globalIndex,D[0].padLen);else{let w=v.globalIndex.replace(O.globalIndex,"");for(let F of D)F.id==w&&(v.net=F.net,F.padLen!=null&&$o.getInstance().setPadLen(O.globalIndex,v.globalIndex,F.padLen))}}),O.getVias().forEach(v=>{let D=v.getParent(),w;if(D!=null){let H=D.globalIndex,z=new RegExp(H);w=v.globalIndex.replace(z,"")}else w=v.globalIndex;let F=x.get(w);if(F!=null)if(F.length==1)v.net=F[0].net;else for(let H of F)H.id==w&&(v.net=H.net)}),C!=null)for(let v of O.attributes){let D=C.getAttrData(O.model,v.model);C.addAttr(v.key,D)}return O}delete(e){if(e instanceof ke){let r=e.globalIndex;Ms.getInstance().delete(e.model,r)}}getName(e){let r=e.replace(/[?\d]+$/,""),i=+e.replace(r,"")||0;return[r,i]}getPrefix(e){var i;let r=e.match(/\b(\d*[A-Za-z]+\d*)/);if(r==null){let n=(i=e.match(/^(\d+)/))==null?void 0:i[1];if(n==null){let s=e.match(/^(.*?)(?:_|$)/);return s?s[1]:e.includes("_")?e.split("_")[0]:e}else return n}else return r[0]}getNewNum(e){let r=1,i=this.getAllItem(),n={};i.forEach(l=>{let c=l.attrKeyValue.Designator,[h,u]=this.getName(c);!n[h]&&(n[h]=[]),!n[h].includes(u)&&n[h].push(u)});for(let l in n)if(Object.prototype.hasOwnProperty.call(n,l)){let c=n[l];c=c.sort((h,u)=>u-h)}let[s,a]=this.getName(e);return r=n[s]?n[s][0]+1:r,s+r}generateNetList(e,r=!0){var i;return Dje(this.getAllItem(),e,r,(n,s,a)=>{n instanceof ke&&this.updateDeviceAttr(n,s,a)},null,{pageId:(i=R.getInstance().tabId)==null?void 0:i.replace(/\@.+$/,"")},n=>n.partition!="",n=>{let s=Hi.getItem(n.footprintUUID);return s instanceof Sc?s.source:null})}add2Template(e){let r=Hi.getItem(e.footprintUUID);r.add(e.model),r.modifyName(e.name,e.name);let i=ts.getItem(e.deviceUUID);i!=null&&i.add(e.model)}updateDeviceAttr(e,r,i){e.modifyATTRMap(r,i);let n=e.attrKeyText;i!==null&&n[r]&&(n[r].value=i)}autoDesignator(e,r){if(le.pcbConfig.autoDesignator){this.handleSameDesignator(e);for(let i of e){let n=this.getPrefix(i.attrsMap.Designator),[s]=this.getName(n);le.pcbConfig.designatorAnnocationType==="2"&&(s=s.toUpperCase());let a=this.getNumber(s,r);r&&r.delete(i),this.updateDesignator([{component:i,prefix:s,suffix:a}])}}}placeCBBAutoSuffix(e,r){if(le.pcbConfig.autoDesignator&&e.size){this.handleSameDesignator(r);for(let[,i]of e){let n=[],s=this.getSuffixNum(new Set(i));for(let a of i){let l=a.attrsMap.Designator,c=this.getPrefix(l);n.push({component:a,prefix:c+"_",suffix:s})}this.updateDesignator(n)}}}handleSameDesignator(e){let r=new Map;for(let n of e){let s=this.getPrefix(n.attrsMap.Designator);r.has(s)||r.set(s,new Set),r.get(s).add(n)}let i=new Set;for(let[,n]of r)if(n.size>1){let s=n.values();s.next();for(let a of s)i.add(a)}i.size>0&&this.autoDesignator(i,i)}getNumber(e,r){let i=le.pcbConfig.designatorAnnocationType,n=this.getAllItem(),s=new Map;for(let c of n){if(r&&r.has(c))continue;let[h,u]=this.getName(this.getPrefix(c.attrsMap.Designator));le.pcbConfig.designatorAnnocationType==="2"&&(h=h.toUpperCase()),s.has(h)||s.set(h,new Set),s.get(h).add(u)}let a=s.get(e)||new Set().add(0),l=1;switch(i){case"1":return Math.max(...a)+1;case"2":for(;;){if(!a.has(l))return l;l++}}}getSuffixNum(e){let r=this.getAllItem(),i=new Set().add(0);for(let n of r){if(e&&e.has(n))continue;let s=n.attrsMap.Designator;if(s.includes("_")){let[,a]=this.getName(s);i.add(a)}}return Math.max(...i)+1}updateDesignator(e){for(let r of e){let i=r.component.designator,n=r.prefix+r.suffix;r.component.modifyATTRMap("Designator",n),Hi.getItem(r.component.footprintUUID).addName(i);let a=r.component.attrKeyText;a.Designator&&(a.Designator.value=n)}}};var oOe=class{constructor(t){this.inters=new Array;this.interSet=new Ta;this.track=t}addInter(t){!this.interSet.contains(t)&&t.distance2(this.track.start)>1e-8&&t.distance2(this.track.end)>1e-8&&(this.inters.push(t),this.interSet.add(t))}},uue=class extends Ei{constructor(){super(...arguments);this.idMap={};this.tracks=new Array;this.arcTrack=new Array;this.result=new Array;this.modifyTracks=new Set;this.stateMap=new Map;this.splitMap=new Map;this.mergeMap=new Map}update(e){if(pr.getAllItem().length==0)return;this.splitMap.clear(),this.mergeMap.clear();let r="updateConnectRelation-time";Cn(r);let i=new Array;for(let n of e)(n instanceof ke||n instanceof Ge||n instanceof Ue||n instanceof Le)&&i.push(n);i.length<4e3&&(this.stateMap.clear(),this.removeCoincide(i),this.splitTrack(i),this.removeCoincide(i),this.mergeParallelTrack(i),this.removeZeroLengthTrack(i),this.updateSelect()),this.clear(),Xi(r,.05)}splitTrack(e){for(let r of e)if(r instanceof ke){let i=r.getPads();for(let s=0;s<i.length;s++)this.dispatch(i[s],e);let n=r.getVias();for(let s=0;s<n.length;s++)this.dispatch(n[s],e)}else this.dispatch(r,e);for(let r of this.modifyTracks)this.dispatch(r,e,!1);this.modifyTracks.clear(),this.split()}removeCoincide(e){for(let r of e)r instanceof Ge&&this.autoRemoveCoincide(r);for(let r of this.tracks)this.autoRemoveCoincide(r)}removeZeroLengthTrack(e){for(let r of e)r instanceof Ge&&!r.isEmpty&&r.getParent()==null&&r.length<.01&&this.removeTrack(r)}mergeParallelTrack(e){for(let r of e)r instanceof Ir&&this.autoMergeTrack(r);for(let r of this.tracks)this.autoMergeTrack(r);for(let r of this.result)this.autoRemoveCoincide(r)}updateSelect(){let e=new Set(ze.getSelects());if(e.size>0){let r=!1;for(let[i,n]of this.splitMap)e.has(i)&&(e.delete(i),xe.addAllSet(e,n),r=!0);for(let[i,n]of this.mergeMap)for(let s of i)if(e.has(s)){for(let a of i)e.delete(a);e.add(n),r=!0;break}if(r){let i=new Array;for(let n of e)n.isEmpty||i.push(n);ze.select(i),A.publish("flushSelectingInfo","")}}}clear(){this.tracks.length=0,this.arcTrack.length=0,this.result.length=0,this.idMap={},this.splitMap.clear(),this.mergeMap.clear()}dispatch(e,r,i=!0){e.isEmpty||(e instanceof Le?this.dispatchPad(e,r):e instanceof Ge?this.dispatchTrack(e,r,i):e instanceof Ue&&this.dispatchVia(e,r))}dispatchPad(e,r){let i=e.searchNode(!0);for(let n of i)n instanceof Ge&&this.splitPadTrack(n,e)}dispatchTrack(e,r,i=!0){if(e.isEmpty||e.getParent()!=null)return;let n=e.searchNode(!0);for(let s of n)s instanceof Le?this.splitPadTrack(e,s):s instanceof Ge?this.splitTracks(e,s,i):s instanceof Ue&&this.splitViaTrack(e,s)}dispatchVia(e,r){let i=e.searchNode(!0);for(let n of i)n instanceof Ge&&this.splitViaTrack(n,e)}splitPadTrack(e,r){if(!(e.isEmpty||e.getParent()!=null)&&!r.isEmpty&&!r.isSelect4Layer(e.start.x,e.start.y,e.layerId)&&!r.isSelect4Layer(e.end.x,e.end.y,e.layerId)&&e.isSelect(r.center.x,r.center.y)){if(e instanceof yi){let i=r.center.sub(e.center).normalize(),n=new M(e.center,r.center.add(i.mul(e.radius))),s=e.primitive,a=Pt(n,s),l=s.bbox();if(a>0){let c=this.getSide(e);for(let h=0;h<a;h+=2){let u=new S(Ee[h],Ee[h+1]);l.isContains(u)&&c.addInter(u)}}}else if(e instanceof Ir){let i=e.primitive,n=i.bbox(),s=er.foot(i,r.center);s!=null&&n.isContains(s)&&s.distance1(r.center)<Math.min(.01,e.width/2)&&this.getSide(e).addInter(s)}}}getTrackConnectState(e){let r=this.stateMap.get(e);if(r!=null)return r;let i=new ou(e),n=i.startType==0||i.startType==4,s=i.endType==0||i.endType==4;return n&&s?(this.stateMap.set(e,0),0):n&&!s?(this.stateMap.set(e,1),1):!n&&s?(this.stateMap.set(e,2),2):(this.stateMap.set(e,3),3)}modifyTrack(e,r,i){let n=e.track,s=r.track,a=s.end.sub(s.start),l=this.getLine(n.start,n.end),c=er.foot(l,s.start),h,u=new ou(e.track),d=u.startType==0||u.startType==4,p=u.endType==0||u.endType==4;if(!d&&(c.equals1(e.track.start)||c.add(a).equals1(e.track.start)))return h;if(!p&&(c.equals1(e.track.end)||c.add(a).equals1(e.track.end)))return h;let m=n.primitive.bbox();switch(i){case 0:{h=Ce.dispatch(s,"modify"),s.start=c,s.end=c.add(a),m.isContains(c)&&e.addInter(c),m.isContains(s.end)&&e.addInter(s.end);break}case 1:{h=Ce.dispatch(s,"modify"),s.start=c,m.isContains(c)&&e.addInter(c);break}case 2:{h=Ce.dispatch(s,"modify"),s.start=c,s.end=c.add(a),m.isContains(s.end)&&e.addInter(s.end);break}default:}return h}splitTracks(e,r,i=!0){if(e.isEmpty||e.getParent()!=null||r.isEmpty||r.getParent()!=null)return;let n;if(e instanceof Ir&&r instanceof Ir){let u=e.direct,d=r.direct;if(Math.abs(u.cross(d))<.001&&e.length>.001&&r.length>.001){let m=Math.min(e.width,r.width)/4,g=this.getLine(e.start,e.end);if(er.foot(g,r.start).distance1(r.start)<m){let b=this.getTrackConnectState(e),P=this.getTrackConnectState(r),T=this.getSide(e),I=this.getSide(r);if(b<3&&T.inters.length==0)if(i){this.modifyTracks.add(T.track);return}else n=this.modifyTrack(I,T,b);else if(P<3&&I.inters.length==0)if(i){this.modifyTracks.add(I.track);return}else n=this.modifyTrack(T,I,P)}}}let s=e.primitive,a=r.primitive,l=Pt(s,a),c=s.bbox(),h=a.bbox();if(l>0){qe.stack!=null&&n!=null&&qe.stack.addCommand(n);let u=this.getSide(e),d=this.getSide(r);for(let p=0;p<l;p+=2){let m=new S(Ee[p],Ee[p+1]);c.isContains(m)&&u.addInter(m),h.isContains(m)&&d.addInter(m)}}else n!=null&&n.undo()}splitViaTrack(e,r){if(!(e.isEmpty||e.getParent()!=null)&&!r.isEmpty&&!r.isSelect(e.start.x,e.start.y)&&!r.isSelect(e.end.x,e.end.y)&&e.isSelect(r.center.x,r.center.y)){if(e instanceof yi){let i=r.center.sub(e.center).normalize(),n=new M(e.center,r.center.add(i.mul(e.radius))),s=e.primitive,a=Pt(n,s),l=s.bbox();if(a>0){let c=this.getSide(e);for(let h=0;h<a;h+=2){let u=new S(Ee[h],Ee[h+1]);l.isContains(u)&&c.addInter(u)}}}else if(e instanceof Ir){let i=e.primitive,n=er.foot(i,r.center),s=i.bbox();n!=null&&s.isContains(n)&&n.distance1(r.center)<Math.min(.01,e.width/2)&&this.getSide(e).addInter(n)}}}getSide(e){let r=this.idMap[e.globalIndex];return r==null&&(r=new oOe(e),this.idMap[e.globalIndex]=r),r}split(){Object.values(this.idMap).forEach(r=>{if(r.track instanceof Ir&&r.inters.length>0){Er(r.inters,(l,c)=>l.distance2(r.track.start)-c.distance2(r.track.start),0,r.inters.length),r.inters.push(r.track.end);let i=r.track.start,n=r.track.layerId,s=r.track.width,a=new Set;r.inters.forEach(l=>{if(!l.equals1(i)){let c=pr.addTrack(n,i,l,s,r.track.locked,r.track.net);c.partition=r.track.partition,a.add(c),c.updateFilterVisible=!0,c.visible(),this.joinCombination([c],r.track.getGroupID()),qe.stack!=null&&(A.publish("addAutoServiceModify",c),qe.stack.addCommand(Ce.dispatch(c,"add"))),this.tracks.push(c),i=l}}),this.removeTrack(r.track),this.splitMap.set(r.track,a)}else if(r.track instanceof yi&&r.inters.length>0){an(r.inters,r.track.primitive),r.inters.push(r.track.end);let i=r.track.start,n=r.track.layerId,s=r.track,a=r.track.width,l=s.startAngle,c=new Set;r.inters.forEach(h=>{if(!h.equals1(i)){let u=h.angle(s.center),d=pr.addArcTrack(n,s.center,s.radius,l,u,s.sweep,a,s.locked,s.net,s.arcType);if(d.length>s.length){d.remove();return}d.partition=r.track.partition,d.updateFilterVisible=!0,d.visible(),c.add(d),this.joinCombination([d],r.track.getGroupID()),qe.stack!=null&&(A.publish("addAutoServiceModify",d),qe.stack.addCommand(Ce.dispatch(d,"add"))),this.arcTrack.push(d),i=h,l=u}}),this.removeTrack(r.track),this.splitMap.set(r.track,c)}})}joinCombination(e,r){(r?Ht.getItem(r):null)!=null&&Ht.joinCombination(e,r)}removeTrack(e){qe.stack!=null&&(A.publish("addAutoServiceModify",e),qe.stack.addCommand(Ce.dispatch(e,"delete"))),e.sendDeleteMsg=!1,e.remove(),A.publish("delete",e)}autoRemoveCoincide(e){if(e.isEmpty||e.getParent()!=null)return;if(e.length<.001){this.removeTrack(e);return}let r=e.searchNode();for(let i of r)if(this.checkCoincide(e,i))if(i instanceof Ir)if(i.width<e.width)this.removeTrack(i);else if(i.width==e.width)if(i.length>e.length){this.removeTrack(e);return}else this.removeTrack(i);else{this.removeTrack(e);return}else this.removeTrack(e)}checkTrackCoincide(e,r){if(e instanceof Ge&&r instanceof Ge){if(e.start.similarEquals(r.start,1e-5)&&e.end.similarEquals(r.end,1e-5))return!0;if(e.start.similarEquals(r.end,1e-5)&&e.end.similarEquals(r.start,1e-5))return!0;if(e instanceof Ir&&r instanceof Ir){let i=e.direct,n=r.direct;if(Math.abs(i.cross(n))<.001){let a=e.start,l=e.end.angle(e.start),c=Ae.translate(-a.x,-a.y,0).rotateZ(-l),h=e.end.multiply4(c),u=r.start.multiply4(c),d=r.end.multiply4(c),p=new _e().ext2(u).ext2(d).ext7(r.width/2).build(),m=new _e().ext2(S.ORIGIN).ext2(h).ext7(e.width/2).build();return m.isInside(p.extendOfSize(1e-4))||p.isInside(m.extendOfSize(1e-4))}}}return!1}checkArcTrackCoincide(e,r){if(e instanceof yi&&r instanceof yi&&e.center.similarEquals(r.center,1e-5)&&aBe(e.radius,r.radius)&&e.model.primitive.isLarge()===r.model.primitive.isLarge()){if(e.start.similarEquals(r.start,1e-5)&&e.end.similarEquals(r.end,1e-5))return!0;if(e.start.similarEquals(r.end,1e-5)&&e.end.similarEquals(r.start,1e-5))return!0}return!1}checkCoincide(e,r){return e.isEmpty||e.getParent()!=null||r.isEmpty||r.getParent()!=null?!1:!!(e instanceof Ir&&r instanceof Ir&&this.checkTrackCoincide(e,r)||e instanceof yi&&r instanceof yi&&this.checkArcTrackCoincide(e,r))}autoMergeTrack(e){if(e.isEmpty||e.getParent()!=null)return;let r=new ou(e),i=r.startType,n=r.endType,s=e.end,a=null,l=null,c=e.start,h=null,u=null;if(i==5||i==6){let d=r.startNodes[0],p=e.end.sub(e.start).normalize(),m=d.end.sub(d.start).normalize();Math.abs(p.cross(m))<dl&&e.width==d.width&&!d.isEmpty&&(i==5?(a=d.end,l=d):i==6&&(a=d.start,l=d))}if(n==5||n==6){let d=r.endNodes[0],p=e.end.sub(e.start).normalize(),m=d.end.sub(d.start).normalize();Math.abs(p.cross(m))<dl&&e.width==d.width&&!d.isEmpty&&(n==5?(h=d.end,u=d):n==6&&(h=d.start,u=d))}if(a!=null&&h!=null&&l!=null&&u!=null){if(!this.checkTrackPartition(e,l,u))return;let d=pr.addTrack(e.layerId,a,h,e.width,e.locked,e.net);d.partition=e.partition,d.updateFilterVisible=!0,d.visible(),e.getGroupID()!=null&&e.getGroupID()==l.getGroupID()&&e.getGroupID()==u.getGroupID()&&this.joinCombination([d],e.getGroupID()),qe.stack!=null&&(d.isEmpty||(A.publish("addAutoServiceModify",d),qe.stack.addCommand(Ce.dispatch(d,"add")))),this.result.push(d);let p=new Set([e,l,u]);this.mergeMap.set(p,d),this.removeTrack(e),this.removeTrack(l),this.removeTrack(u)}else if(a!=null&&h==null&&l!=null){if(!this.checkTrackPartition(e,l,u))return;let d=pr.addTrack(e.layerId,s,a,e.width,e.locked,e.net);d.partition=e.partition,d.updateFilterVisible=!0,d.visible(),e.getGroupID()!=null&&e.getGroupID()==l.getGroupID()&&this.joinCombination([d],e.getGroupID()),this.mergeTrack(e,l,d)}else if(a==null&&h!=null&&u!=null){if(!this.checkTrackPartition(e,l,u))return;let d=pr.addTrack(e.layerId,c,h,e.width,e.locked,e.net);d.partition=e.partition,d.updateFilterVisible=!0,d.visible(),e.getGroupID()!=null&&e.getGroupID()==u.getGroupID()&&this.joinCombination([d],e.getGroupID()),this.mergeTrack(e,u,d)}}checkTrackPartition(e,r,i){let n=!0;return e&&(Mt.checkIsCanEditByItem(e)||(n=!1)),r&&(Mt.checkIsCanEditByItem(r)||(n=!1)),i&&(Mt.checkIsCanEditByItem(i)||(n=!1)),n}mergeTrack(e,r,i){qe.stack!=null&&(i.isEmpty||(A.publish("addAutoServiceModify",i),qe.stack.addCommand(Ce.dispatch(i,"add")))),this.result.push(i),this.removeTrack(e),this.removeTrack(r);let n=new Set([e,r]);this.mergeMap.set(n,i)}getLine(e,r){let i=r.sub(e).normalize().mul(1e3);return new M(e.sub(i),r.add(i))}};var TG=class extends Cs{constructor(e){super();this.commandFactory=new De("push component");this.position=S.ORIGIN;this.addHistory=!0;this.associationItem=null;this.alreadyRotate=!1;this.revokeMove=!1;this.component=e,this.util=new iC(e),this.commands=new De("single select Component"),this.position=this.component.position}onKeyDown(e){e.sceneX=this.component.position.x,e.sceneY=this.component.position.y;let r=new S(e.realSceneX,e.realSceneY),i=di.getScene();switch(tr.getAction(i,e)){case"Flip Right and Left":{pf.flipComponent("Flip Right and Left",r,[this.component],this.commands),this.commands=new De("single select Component");break}case"Flip Up and Down":{pf.flipComponent("Flip Up and Down",r,[this.component],this.commands),this.commands=new De("single select Component");break}}return A.publish("showAndUpdateCross",e),!1}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;return this.component.isSelect(r,i)}onMouseMove(e){this.addHistory&&wd.getInstance().highlight([this.component]);let r=this.shiftControl(e);this.position=this.lastPosition;let i=this.position.sub(r);le.pcbConfig.snapToOriginWhileDragFootprint&&(r=new S(e.sceneX,e.sceneY).sub(this.component.position));let n=le.pcbConfig.snapToOriginWhileDragFootprint?new S(e.sceneX,e.sceneY):this.component.position.add(r);if(e.adsorbGrid&&(n=ai.adsorpGrid(n),r=n.sub(this.component.position)),le.pcbConfig.alignToNearComponentOrPadWhileDrag&&e.adsorb){let d=ai.snapToOtherComponent(this.component,r,n,e);d&&(this.lastPosition=this.lastPosition.sub(r),n=d,r=n.sub(this.component.position),this.lastPosition=this.lastPosition.add(r))}let s=Ae.translate(r.x,r.y,0);if(!It.getInstance().currentCoord){let d=new S(e.sceneX,e.sceneY),p=this.util.getMatrix(n,d);s=s.multiply4(p)}this.associationItem==null&&(this.associationItem=new Ya([this.component]),this.associationItem.moveInit());let a=this.associationItem.items;if(this.associationItem.setUpConnectTrack(),this.addHistory){let d=this.associationItem.getAllItem();for(let p of d)p.locked||(this.commands.addCommand(Ce.dispatch(p,"modify")),A.publish("hasModifyPcbItem",p))}let l=this.component.position;this.associationItem.setAllAssociationRatlinesVisible();let c=this.associationItem.itemConnectTrack;a.forEach(d=>{!d.locked&&!c.tracks.has(d.globalIndex)&&d.transform(s)});let h=new S(this.position.x,this.position.y).sub(this.component.position),u=qy();if(le.pcbConfig.moveComponent=="block"&&!this.component.model.getGroupID()&&(t_(this.component,u),this.lastPosition=this.component.position.add(h)),e.sceneX=this.component.position.x,e.sceneY=this.component.position.y,le.pcbConfig.moveComponent=="push"&&!this.component.model.getGroupID()){this.commandFactory.undo(),this.commandFactory=new De("push component");let d=new Map;d.set(this.component,0),mD(this.component,this.commandFactory,u,d),d.clear(),this.lastPosition=this.component.position.add(h)}if(!this.alreadyRotate)if((le.pcbConfig.moveComponent=="block"||le.pcbConfig.moveComponent=="push")&&!this.component.model.getGroupID()){let d=this.component.position.sub(l),p=Ae.translate(d.x,d.y,0);this.associationItem.moveConnectTrack(p)}else this.associationItem.moveConnectTrack(s);return A.publish("showAndUpdateCross",e),this.revokeMove&&this.associationItem!=null&&this.associationItem.interrupt(),this.addHistory&&(this.addHistory=!1),this.changeNativeCursor(5),jb.runWithStrategy(YI.createSingleComponentStrategy(),async()=>{$i.getInstance().language=(await aD()).message||"zh-cn",A.publish("updateDRC",[this.component])}),!0}onMouseUpMove(e){let r=e.sceneX,i=e.sceneY;return this.component.isSelect(r,i)?this.changeNativeCursor(5):this.changeNativeCursor(4),!1}onMouseLeftUp(e){if(!pf.getStatus()){if(wd.getInstance().unhighlight(),this.position=this.component.position,this.commands.length>0){if(this.associationItem.complete(this.commands),le.pcbConfig.moveComponent=="push")for(let r of this.commandFactory.commands)this.commands.addCommand(r);qe.executeCommand(this.commands),this.commands=new De("single select Component"),this.commandFactory=new De("push component"),this.addHistory=!0,this.flushModify()}return this.removeShiftMoveHelpLine(),this.associationItem=null,A.publish("flushSelectingInfo",""),A.publish("autoFill",""),this.revokeMove=!1,!0}}interrupt(){return wd.getInstance().unhighlight(),this.associationItem!=null&&(this.associationItem.interrupt(),this.associationItem=null),!pf.getStatus()&&this.commands.undo(),le.pcbConfig.moveComponent=="push"&&this.commandFactory.undo(),this.changeNativeCursor(4),this.removeShiftMoveHelpLine(),jb.runWithStrategy(YI.createSingleComponentStrategy(),()=>{A.publish("updateDRC",[this.component])}),!0}flushModify(){let e=new Ya([this.component]);A.publish("hasModifyPcbItem",this.component),e.getAllRepairTracks().forEach(i=>{A.publish("hasModifyPcbItem",i)})}rotate(e=le.pcbConfig.rotate){let r=ys([this.component]);if(r.valid()){this.alreadyRotate=!0;let n=r.build1().center(),s=Ae.rotateZForPoint(n,e);this.associationItem==null&&(this.associationItem=new Ya([this.component])),this.associationItem.interrupt();let a=this.associationItem.items;if(this.associationItem.setUpConnectTrack(),this.addHistory){let c=this.associationItem.getAllItem();for(let h of c)h.locked||this.commands.addCommand(Ce.dispatch(h,"modify"))}this.alreadyRotate||this.associationItem.moveConnectTrack(s),this.associationItem.setAllAssociationRatlinesVisible();let l=this.associationItem.itemConnectTrack;a.forEach(c=>{!c.locked&&!l.tracks.has(c.globalIndex)&&c.transform(s)}),this.addHistory&&(this.addHistory=!1)}}};var IG=class extends Cs{constructor(e){super();this.commandFactory=new De("push component");this.addHistory=!0;this.position=S.ORIGIN;this.associationItem=null;this.wireCommands=new Lr;this.shoveCommands=new Lr;this.via=e,this.commands=new De("select via");let r=this.via.getParent()!=null||this.via.getGroupID()!=null;this.moveTool=new Qc([this.via],r),this.position=this.via.center}onKeyDown(e){if(this.via.getParent()!=null||this.via.getGroupID()!=null){let r=this.via.getParent();r&&r instanceof ke&&(e.sceneX=r.position.x,e.sceneY=r.position.y,A.publish("showAndUpdateCross",e))}else{let{x:r,y:i}=this.node.item.center;e.sceneX=r,e.sceneY=i,A.publish("showAndUpdateCross",e)}return!1}onMouseLeftDown(e){return!1}init(){if(this.associationItem==null&&(this.associationItem=new Ya([this.via],this.commands)),this.addHistory&&!(!this.associationItem.hasConnectTrack()&&!le.pcbConfig.isPlaceViasAutoShove)){let i=pt.getTears(this.via.globalIndex);if(i&&i.size>0)for(let l of i)this.commands.addCommand(Ce.dispatch(l,"delete")),QV(l);let n=this.associationItem.getAllItem(),s=Array.from(n).filter(l=>l instanceof Ue),a=Sg.getTrackFollowViaStatus();this.shoveData=aE(s,this.wireCommands,void 0,a),Nl.getInstance().init()}}fixMousePosition(e){this.moveStartPoint===null&&(this.moveStartPoint=new S(e.lastSceneX,e.lastSceneY),this.lastPosition=this.moveStartPoint,le.pcbConfig.snapToCenterWhileDragPadOrVia&&(this.moveStartPoint=this.via.center,this.lastPosition=this.via.center));let r=new S(e.sceneX,e.sceneY);if(e.adsorbGrid){r=ai.adsorpGrid(r);let i=this.via.getParent()==null&&this.via.getGroupID()==null;this.addHistory&&i&&(this.commands.addCommand(Ce.dispatch(this.via,"modify")),A.publish("hasModifyPcbItem",this.via),le.pcbConfig.snapToCenterWhileDragPadOrVia||(this.via.center=ai.adsorpGrid(this.via.center)))}if(e.shiftKey){let i=r.sub(this.moveStartPoint);Math.abs(i.x)>=Math.abs(i.y)?r=new S(r.x,this.moveStartPoint.y):r=new S(this.moveStartPoint.x,r.y),this.createShiftMoveHelpLine(this.moveStartPoint,r)}else this.shiftMoveHelpLine!=null&&this.removeShiftMoveHelpLine();return r}getViaOffset(e){return The.bind(this,e,this.moveStartPoint)()}getTrackOffset(e){return e.sub(this.lastPosition)}undoShoveHistory(){var e,r,i;Np.needclearWireCache=!1,bhe(),(e=this.shoveCommands)==null||e.undo(),this.shoveCommands=new Lr,(r=this.associationItem.getRepairToolCommand())==null||r.undo(),this.associationItem.setRepairToolCommand(new Lr),(i=this.wireCommands)==null||i.undo(),this.wireCommands=new Lr}setConstraintLocks(){for(let[e,r]of this.node.connectTrack)en.lockedMap.set(e,!r)}onMouseUpMove(e){return this.via.isSelect(e.sceneX,e.sceneY)?this.changeNativeCursor(5):this.changeNativeCursor(4),!1}moveComponent(e,r){if(!e.model.getGroupID()){let i=new S(r.sceneX,r.sceneY).sub(e.position),n=qy(),s=this.via.getParent();switch(le.pcbConfig.moveComponent){case"push":{this.commandFactory.undo(),this.commandFactory=new De("push component");let a=new Map;a.set(s,0),mD(s,this.commandFactory,n,a),a.clear();break}case"block":{t_(s,n);break}}this.lastPosition=s.position.add(i)}}moveVia(e){let r=this.position,{trackOffset:i,viaOffset:n}=e;if(!this.associationItem.hasConnectTrack()&&!le.pcbConfig.isPlaceViasAutoShove){this.associationItem.setAllAssociationRatlinesVisible();let l=this.associationItem.itemConnectTrack;this.associationItem.items.forEach(c=>{!c.locked&&!l.tracks.has(c.globalIndex)&&c.transform(Ae.translate(i.x,i.y,0))}),r=r.add(this.node.item.center.sub(r))}else{this.undoShoveHistory(),this.setConstraintLocks(),Phe(n,this.node,this.wireCommands),this.associationItem.moveConnectTrack(Ae.translate(i.x,i.y,0));let l=this.node.item.center;zS(this.shoveData,this.shoveCommands,!1,this.node),this.associationItem.setAllAssociationRatlinesVisible();let c=this.node.item.center.sub(l),h=r.add(c);r=le.pcbConfig.snapToCenterWhileDragPadOrVia?h:h.add(this.node.item.center.sub(h)),this.via.iteratorRatlines(u=>{u.startNode==this.via&&(u.start=this.node.item.center),u.endNode==this.via&&(u.end=this.node.item.center)})}return r}onMouseMove(e){if(this.via.locked)return!1;if(this.via.getParent()==null&&this.via.getGroupID()==null&&this.addHistory&&this.associationItem==null&&(this.associationItem=new Ya([this.via],this.commands),this.associationItem.moveInit()),this.addHistory){this.node=Si.getInstance().getViaNode(this.via.model);let s=Zt.getInstance().mode,a=!1;["WIRING_MODE_SURROUND","WIRING_MODE_OBSTRUCT"].includes(s)&&(a=!0),this.node.connectTrack.size==0&&a?gg("freeArc"):gg("45"),this.via.getGroupID()==null&&this.init(),wd.getInstance().highlight([this.via])}let r=this.fixMousePosition(e),i=this.getViaOffset(r);this.position=this.moveStartPoint.add(i);let n=this.getTrackOffset(this.position);if(this.lastPosition=this.position,this.via.getParent()!=null||this.via.getGroupID()!=null){this.commands=new De("select group via"),this.moveTool.onMouseMove(e,n);let s=this.via.getParent();s&&s instanceof ke&&(this.moveComponent(s,e),e.sceneX=s.position.x,e.sceneY=s.position.y,A.publish("showAndUpdateCross",e))}else{if(this.associationItem==null&&(this.associationItem=new Ya([this.via],this.commands)),this.associationItem.setUpConnectTrack(),this.addHistory){let a=this.associationItem.getAllItem();for(let l of a)l.locked||(this.commands.addCommand(Ce.dispatch(l,"modify")),A.publish("hasModifyPcbItem",l))}let s=this.moveVia({trackOffset:n,viaOffset:i});e.sceneX=s.x,e.sceneY=s.y,A.publish("showAndUpdateCross",e)}return this.changeNativeCursor(5),this.addHistory&&(this.addHistory=!1),!0}onMouseLeftUp(e){this.position=this.via.center;let r=this.commands.length;return yg(),this.associationItem!=null&&(this.associationItem.complete(this.commands),le.pcbConfig.moveComponent=="push"&&this.via.getParent()instanceof ke&&this.moveTool.setCommand(this.commandFactory.commands)),wd.getInstance().unhighlight(),qe.executeCommand(this.commands),this.commands=new De("select via"),this.commandFactory=new De("push component"),this.wireCommands=new Lr,this.shoveCommands=new Lr,r&&A.publish("hasModifyPcbItem",this.via),this.associationItem=null,this.moveTool.onMouseLeftUp(e),lE(),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),A.publish("flushService",""),A.publish("flushSelectingInfo",""),!0}rotate(e){let r=this.via.getParent();r!=null&&r.getGroupID()!=null&&(this.commands=new De("select group text"),this.moveTool.rotate(e))}interrupt(){var e,r,i,n;return yg(),wd.getInstance().unhighlight(),(e=this.commands)==null||e.undo(),le.pcbConfig.moveComponent=="push"&&((r=this.commandFactory)==null||r.undo()),(i=this.shoveCommands)==null||i.undo(),(n=this.wireCommands)==null||n.undo(),Mi.getInstance().view4Status(Cr.getInstance().current),Nh.getInstance().clear(),this.associationItem!=null&&(this.associationItem.interrupt(),this.associationItem=null),this.moveTool.interrupt(),this.removeShiftMoveHelpLine(),this.changeNativeCursor(4),!0}};var wxt=Math.sin(Math.PI/180),d5=class extends Qf{constructor(e,r,i,n){super(n);this.adsorb=!0;this.block=new w0;let s=new _e;s.ext1(e.buildBBox()).ext1(r.buildBBox()),this.bbox=s.build1(),this.findTrack=new au(this.event.track,!0);let a=this.findTrack.tracks.indexOf(e),l=this.findTrack.tracks.indexOf(r);a>l&&this.findTrack.reverseResult(),this.track1=e,this.track2=r,this.angleType=i,this.event=n,this.index1=this.findTrack.tracks.indexOf(this.track1),this.index2=this.findTrack.tracks.indexOf(this.track2);let c=this.findTrack.pts[this.index1],h=this.findTrack.pts[this.index2];this.direct1=c.direct,this.direct2=h.direct,this.endDirect1=h.direct,this.endDirect2=c.direct;let u=c.direct.cross(h.direct);switch(i){case 0:{if(Math.abs(this.direct1.x)<1e-8||Math.abs(this.direct2.x)<1e-8)this.endDirect1=new S(1,0);else if(Math.abs(this.direct1.y)<1e-8||Math.abs(this.direct2.y)<1e-8)this.endDirect1=new S(0,1);else{let p=new S(-this.direct1.y,this.direct1.x);this.endDirect1=p.mul(this.direct2.dot(p)).normalize()}let d=c.direct.cross(this.endDirect1);u*d<0&&(this.endDirect1=this.endDirect1.mul(-1));break}case 1:{this.endDirect1=c.direct.add(h.direct);break}case 2:default:break}if(this.rangeEnd1=c.start(),this.rangeStart=c.end(),this.rangeEnd2=h.end(),this.angleType==0||this.angleType==1){let d=this.generateLine(c,this.bbox),p=this.generateLine(h,this.bbox),m=this.bbox.width()+this.bbox.height()+1e4,g=this.getLine(this.rangeEnd1,this.endDirect1,m),y=this.getLine(this.rangeEnd2,this.endDirect1,m),b=this.getIntersection(d,y),P=this.getIntersection(p,g);b!=null&&this.inRange(b,this.track1.start,this.track1.end)?this.rangeEnd1=b:this.rangeEnd2=P}this.blockPrev=this.block.checkIntersection(this.track1),this.blockNext=this.block.checkIntersection(this.track2),this.templine1=this.createBaseTrack(this.rangeStart,this.rangeStart,this.track1),this.templine2=this.createBaseTrack(this.rangeStart,this.rangeStart,this.track2)}generateLine(e,r){let i=r.width()+r.height()+1e3,n=e.direct.mul(i),s=e.start().sub(n),a=e.end().add(n);return new M(s,a)}move(e){if(this.adsorb&&(e=this.event.adsorb(e,Math.max(this.event.track.width/2,.1),this.event.track.layerId)),this.track1.locked||this.track2.locked)return;let r=!1;this.angleType==1&&this.event.addHistory&&(r=!0),this.recordHistory([this.track1,this.track2]),r&&this.fixRightAngleLine();let i=new _e().ext1(this.bbox).ext2(e).build1(),n=i.width()+i.height()+1e4,s=this.generateLine(this.findTrack.pts[this.index1],i),a=this.generateLine(this.findTrack.pts[this.index2],i),l=this.getLine(e,this.endDirect1,n),c=null;this.angleType==2?c=this.getLine(e,this.endDirect2,n):(this.angleType==1||this.angleType==0)&&(c=l);let h=this.getIntersection(l,s),u=this.getIntersection(c,a);if(h!=null||u!=null){let d=this.inRange(h,this.rangeEnd1,this.rangeStart),p=this.inRange(u,this.rangeStart,this.rangeEnd2),m=this.rangeStart.sub(h).normalize(),g=u.sub(this.rangeStart).normalize(),y=m.dot(this.direct1),b=g.dot(this.direct2);if(d&&!p?b>0?((this.angleType==1||this.angleType==0)&&(h=this.rangeEnd1),u=this.rangeEnd2):(h=this.rangeStart,u=this.rangeStart):!d&&p?y>0?((this.angleType==1||this.angleType==0)&&(u=this.rangeEnd2),h=this.rangeEnd1):(h=this.rangeStart,u=this.rangeStart):!d&&!p&&(y>0&&b>0?(h=this.rangeEnd1,u=this.rangeEnd2):(h=this.rangeStart,u=this.rangeStart)),this.angleType==2){l=this.getLine(h,this.endDirect1,n),c=this.getLine(u,this.endDirect2,n);let P=this.getIntersection(l,c);this.changeBaseTrack(this.templine1,h,P),this.changeBaseTrack(this.templine2,P,u)}else this.changeBaseTrack(this.templine1,h,u),this.changeBaseTrack(this.templine2,u,u);this.changeBaseTrack(this.track1,this.findTrack.pts[this.index1].start(),h),this.changeBaseTrack(this.track2,u,this.findTrack.pts[this.index2].end()),this.blockEndpoint()}}fixRightAngleLine(){let e=this.direct1,r=this.direct2,i=Math.sqrt(2)/2,n=new S(1,0),s=new S(i,i),a=new S(0,1),l=new S(-i,i),c=[n,s,a,l],h=[e,r],u=e,d=!0,p=!0;for(let C=0;C<2;C++){let E=h[C];for(let O of c){let _=O.cross(E);if(this.kit.lesseq(Math.abs(_),wxt)){u=O,d=!1,C==0?p=!0:p=!1;break}}if(!d)break}let m=this.bbox.width()+this.bbox.height()+1e4,g=new S(-u.y,u.x),y=this.findTrack.pts[this.index1],b=this.findTrack.pts[this.index2],P=this.getLine(y.start(),p?u:g,m),T=this.getLine(b.end(),p?g:u,m),I=this.getIntersection(P,T);if(I!=null){let C=new M(y.start(),I),E=new M(I,b.end());this.findTrack.pts.splice(this.index1,1,C),this.findTrack.pts.splice(this.index2,1,E),this.changeBaseTrack(this.track1,y.start(),I),this.changeBaseTrack(this.track2,I,b.end()),this.changeBaseTrack(this.templine1,I,I),this.changeBaseTrack(this.templine1,I,I),this.rangeStart=I,this.endDirect1=C.direct.add(E.direct)}}realTimePath(){let e=new Array,r=!1,i=this.getLines(this.findTrack.pts);for(let n=0,s=i.length;n<s;n++){let a=i[n];n<this.index1?e.push(a.start()):n>this.index2?e.push(a.end()):r||(e.push(this.track1.start,this.track1.end,this.templine1.end,this.templine2.end,this.track2.start,this.track2.end),r=!0)}return e}moveOffset(e){}blockEndpoint(){let e=this.event.adsorpTrackSetting;if(this.event.adsorpTrackSetting=!1,this.event.numberOfIterator++,this.event.numberOfIterator>100){this.event.numberOfIterator=0;return}if(this.adsorb=!1,this.isBlock())if((!this.blockPrev||!this.blockNext||!this.event.blockTrack)&&(this.blockPrev=this.block.checkIntersection(this.track1),this.blockNext=this.block.checkIntersection(this.track2),this.event.blockTrack=this.block.checkBaseIntersection(this.templine1)),this.block.adsorp=null,this.angleType==2){let r=this.block.blockTrack(this.track1),i=this.track1.end;if(r.distance2(i)>1e-8&&this.blockPrev)this.move(r);else{let n=this.block.blockTrack(this.track2),s=this.track2.end;if(n.distance2(s)>1e-8&&this.blockNext)this.move(n);else{let a=this.block.blockBaseTrack(this.templine1),l=this.block.blockBaseTrack(this.templine2,!1),c=a.distance2(this.templine1.end)>1e-8,h=l.distance2(this.templine2.start)>1e-8;if(c&&h){let u=a.sub(this.templine1.start),d=this.rangeStart.sub(this.templine1.start),p=l.sub(this.templine2.end),m=this.rangeStart.sub(this.templine1.end);Math.abs(u.cross(d))>Math.abs(p.cross(m))?this.move(a):this.move(l)}else c&&!h?this.move(a):!c&&h&&this.move(l)}}}else{let r=new Array;if(this.blockBaseTrack(this.block,this.track1,this.blockPrev,this.endDirect1,this.templine1,r),this.blockBaseTrack(this.block,this.track2,this.blockNext,this.endDirect1,this.templine1,r),this.blockBaseTrack(this.block,this.templine1,this.event.blockTrack,this.endDirect1,this.templine1,r),r.length>0){let i=new M(this.rangeStart,this.rangeStart.add(this.endDirect1)),s=this.event.getEnd(i,r).sub(i.start());this.moveOffset(s)}}else this.isPush()&&(this.shove(),this.track1.hidden(),this.track2.hidden(),this.templine1.hidden(),this.templine2.hidden());this.adsorb=!0,this.event.adsorpTrackSetting=e}complete(){this.shoveEvent.shoveTrackComplete(this.event)||(this.optimization(),this.mapBase2Track(),A.publish("hasModifyPcbItem",this.track1),A.publish("hasModifyPcbItem",this.track2)),this.recycleBaseTrack(),this.templine1=null,this.templine2=null,this.shoveEvent.clearCache()}optimization(){this.templine1!=null&&this.templine1.length<=this.event.track.width&&this.move(this.rangeStart),this.templine2!=null&&this.templine2.length<=this.event.track.width&&this.angleType==2&&this.move(this.rangeStart),this.track1.length!==0&&this.track1.length<=this.track1.width&&this.move(this.rangeEnd1),this.track2.length!==0&&this.track2.length<=this.track2.width&&this.move(this.rangeEnd2)}interrupt(){this.recycleBaseTrack(),this.templine1=null,this.templine2=null,this.shoveInterrupt()}getLine(e,r,i=1e4){let n=r.normalize().mul(i+r.length());return new M(e.sub(n),e.add(n))}inRange(e,r,i){return!!(this.sameDirect(e,r,i)&&this.sameDirect(e,i,r))}sameDirect(e,r,i){let n=e.sub(r).normalize(),s=i.sub(r).normalize();return n.dot(s)>=0}};var p5=class extends Qf{constructor(e){super(e);this.follow=!1;this.block=new w0;this.reverse=!1;this.findTrack=new au(this.event.track,!0),this.findTrack.tracks.indexOf(this.event.track)!=0&&this.findTrack.reverseResult(),this.event.blockTrack=this.block.checkIntersection(this.event.track),this.next=this.createBaseTrack(this.event.track.start,this.event.track.start,this.event.track)}movePointOffset(e,r){if(r){let i=this.event.oldStart.add(e);this.modifyStart(i)}else{let i=this.event.oldEnd.add(e);this.modifyEnd(i)}}moveByIntercept(e,r,i,n){if(this.event.track.locked)return;this.visible(),this.recordHistory([this.event.track]);let s=this.event.track,a=this.next;if(e.some(l=>l.length()>1e-8)){let l=this.findTrack.tracks.indexOf(s),c=this.findTrack.pts[l],h=er.foot(new M(c.start(),c.end()),e[0].start()),u=new Zl(h,r,e).result;if(u.length){let d=u[0].end(),p=n?this.event.oldEnd:this.event.oldStart,m=d.sub(p);if(i.dot(m)>-1e-8&&Math.abs(i.cross(m))<1e-8)return n?s.start=d:s.end=d,a.start=d,a.end=u[0].end(),u.length>=2&&(a.start=d,a.end=u[1].end()),!0}}}modifyStart(e){if(this.follow||(e=this.event.adsorb(e,this.event.track.width,this.event.track.layerId)),this.event.track.locked)return;this.visible(),this.recordHistory([this.event.track]),this.findTrack.pts[0].start().equals(this.event.oldEnd)&&this.findTrack.reverseResult();let i=this.event.track.end,n=this.event.track.direct;n.x==0&&n.y==0&&(n=this.event.direct);let s=this.draw(i,e,n.mul(-1));this.event.track.start=s[1],this.changeBaseTrack(this.next,s[1],s[2]),this.blockEndPoint(!1)}modifyEnd(e){if(this.follow||(e=this.event.adsorb(e,this.event.track.width,this.event.track.layerId)),this.event.track.locked)return;this.visible(),this.recordHistory([this.event.track]),this.findTrack.pts[0].start().equals(this.event.oldStart)&&this.findTrack.reverseResult();let i=this.event.track.start,n=this.event.track.direct;n.x==0&&n.y==0&&(n=this.event.direct);let s=this.draw(i,e,n);this.event.track.end=s[1],this.changeBaseTrack(this.next,s[1],s[2]),this.blockEndPoint(!0)}move(e){}moveOffset(e){}draw(e,r,i){return new Xn().degree45(i,e,r)}realTimePath(){let e=this.getLines(this.findTrack.pts),r=[this.next.end,this.next.start];for(let i of e)r.push(i.end());return r}blockEndPoint(e){let r=this.event.adsorpTrackSetting;if(this.event.adsorpTrackSetting=!1,this.event.numberOfIterator++,this.event.numberOfIterator>100){this.event.numberOfIterator=0;return}if(this.isBlock()&&!this.follow){this.block.adsorp=null;let i=this.block.blockTrack(this.event.track,e),n=this.event.track.end;if(e||(n=this.event.track.start),i.distance2(n)>1e-8&&this.event.blockTrack)e?this.modifyEnd(i):this.modifyStart(i);else if(this.next!=null){let s=this.block.blockBaseTrack(this.next);s.distance2(this.next.end)>1e-8&&(e?this.modifyEnd(s):this.modifyStart(s))}}else this.isPush()&&!this.follow&&(this.shove(),this.event.track.hidden(),this.next.hidden());this.event.adsorpTrackSetting=r}complete(){this.event.clearAdsorpPoint(),this.shoveEvent.shoveTrackComplete(this.event)||(this.mapBase2Track(!0),A.publish("hasModifyPcbItem",this.event.track)),this.recycleBaseTrack(),this.next=null,this.shoveEvent.clearCache()}interrupt(){this.recycleBaseTrack(),this.next=null,this.shoveInterrupt()}};function CG(o){let t=new qt;return o&&(t.add("MOVE_NODE"),t.add("INSERT_NODE")),t}var SG=class extends Cs{constructor(e){super();this.tool=null;this.repair1=null;this.repair2=null;this.position=null;this.rightUpSelectType=null;this.addHistory=!0;this.controlPointMove=!1;this.event=new CR(e);let r=()=>e.layerId;this.commands=new De("select Track"),this.start=this.addPoint(r,e.start),this.end=this.addPoint(r,e.end),this.canDragStart=this.event.identify.canDrag(this.event.identify.startType),this.canDragEnd=this.event.identify.canDrag(this.event.identify.endType),this.canDragPoint=this.event.track.length>this.event.track.width*1.5}get getRepair1(){return this.repair1}get getRepair2(){return this.repair2}onMouseLeftDown(e){this.currPos=e;let r=e.realSceneX,i=e.realSceneY;this.event.lastMousePosition=new S(e.sceneX,e.sceneY),this.event.lastRealMousePosition=new S(r,i);let n=!1,s=this.event.track.width;return this.controlPointMove=!1,this.canDragPoint?(this.start.isSelectWidth(r,i,s)&&(n=!0,this.controlPointMove=!0),this.end.isSelectWidth(r,i,s)&&(n=!0,this.controlPointMove=!0)):this.event.identify.startType==0?this.start.isSelectWidth(r,i,s)&&(n=!0,this.controlPointMove=!0):this.event.identify.endType==0&&this.end.isSelectWidth(r,i,s)&&(n=!0,this.controlPointMove=!0),this.addHistory=!0,this.event.addHistory=!0,this.event.track.isEmpty?!1:n}realTimeDiffPairLengthErr(){let e=this.event.track.net,r=re.getInstance().getNet(e);if(r!=null&&r.netDifferential!=null){let i=r.netDifferential,n=i.positiveNet.name,s=i.negativeNet.name;Ye.modifyNet(n),Ye.modifyNet(s);let a=Ye.getNetLength(n),l=Ye.getNetLength(s),c=this.getIncrement(this.tool,n,s),h=this.getIncrement(this.repair1,n,s),u=this.getIncrement(this.repair2,n,s);return Zt.getInstance().mode=="WIRING_MODE_PUSHAWAY"?(a=a+c[0]+h[0]+u[0],l=l+c[1]+h[1]+u[1]):this.event.track.net==n?a=a+c[2]+h[2]+u[2]:l=l+c[2]+h[2]+u[2],a-l}return 0}realTimeNetLength(){let e=this.event.track.net,r=re.getInstance().getNet(e);if(r!=null&&r.netLengthPhysics!=null){Ye.modifyNet(e);let i=Ye.getNetLength(e),n=this.tool==null?0:this.tool.getLengthIncrement(),s=this.repair1==null?0:this.repair1.getLengthIncrement(),a=this.repair2==null?0:this.repair2.getLengthIncrement();return i+n+s+a}return 0}getIncrement(e,r,i){if(e!=null){let n=e.shoveEvent.getNetDelta(r),s=e.shoveEvent.getNetDelta(i),a=e.getLengthIncrement();return[n,s,a]}return[0,0,0]}snapExtendedLine(e){if(!e.adsorb||!le.adsorptionConfig.getConfig("Extended Line"))return;let r=new S(this.end.x,this.end.y),i=new S(e.realSceneX,e.realSceneY),n=new S(this.start.x,this.start.y),s=n.sub(r).angle(S.ORIGIN);ai.getExtendedLinePointInfo(i,r,n,s,e)}onMouseMove(e){if(this.changeNativeCursor(5),this.event.adsorbtion=e.adsorbGrid,this.addHistory=!1,this.currPos=e,this.event.isPush()?(this.start.hidden(),this.end.hidden()):(this.start.visible(),this.end.visible()),this.start.status()&&this.end.status()){this.snapExtendedLine(e);let r=e.sceneX,i=e.sceneY,n=new S(r,i),s=this.start.getPosition().distance2(n);this.end.getPosition().distance2(n)>s?this.end.setStatus(!1):this.start.setStatus(!1)}if(this.event.numberOfIterator=0,this.start.status()&&this.canDragStart){this.snapExtendedLine(e);let r=e.sceneX,i=e.sceneY,n=new S(r,i);if([0,4,1].includes(this.event.identify.startType))this.changleMouseStyle(this.getMouseStyle(this.event.oldEnd.sub(this.event.oldStart))),this.repair1==null&&(this.repair1=new p5(this.event)),this.repair1.modifyStart(n);else{let s=this.event.identify.startNodes[0];this.repair2==null&&(this.repair2=new d5(this.event.track,s,this.event.identify.startAngleType,this.event)),this.repair2.move(n)}this.start.setPosition(this.event.track.start),this.end.setPosition(this.event.track.end)}else if(this.end.status()&&this.canDragEnd){this.snapExtendedLine(e);let r=e.sceneX,i=e.sceneY,n=new S(r,i);if([0,4,1].includes(this.event.identify.endType))this.changleMouseStyle(this.getMouseStyle(this.event.oldEnd.sub(this.event.oldStart))),this.repair1==null&&(this.repair1=new p5(this.event)),this.repair1.modifyEnd(n);else{let s=this.event.identify.endNodes[0];this.repair2==null&&(this.repair2=new d5(this.event.track,s,this.event.identify.endAngleType,this.event)),this.repair2.move(n)}this.start.setPosition(this.event.track.start),this.end.setPosition(this.event.track.end)}else{let r=e.sceneX,i=e.sceneY,n=new S(r,i);this.tool==null&&(this.tool=this.event.getTool()),this.event.numberOfIterator=0,this.tool.move(n,e),this.start.setPosition(this.event.track.start),this.end.setPosition(this.event.track.end)}return Ut.updateNetLengthMsg(e,{diffPairLength:this.realTimeDiffPairLengthErr(),netLength:this.realTimeNetLength(),net:this.event.track.net}),!0}onMouseUpMove(e){let r=e.realSceneX,i=e.realSceneY;return this.selectPoint(r,i),!1}onMouseLeftUp(e){return this.mouseLeftDown=!1,this.tool!=null&&(this.tool.complete(),this.tool=null),this.repair2!=null&&(this.repair2.complete(),this.repair2=null),this.repair1!=null&&(this.repair1.complete(),this.repair1=null),this.commands.length>0?(qe.executeCommand(this.commands),this.commands=new De("select Arc Track"),this.event.commands=null):this.event.commands!=null&&this.event.commands.length>0&&(qe.executeCommand(this.event.commands),this.event.commands=null),(this.start.status()&&this.canDragStart||this.end.status()&&this.canDragEnd)&&A.publish("clearSelect",""),A.publish("flushService",""),this.removeShiftMoveHelpLine(),ai.clearSnapFlag(),!0}interrupt(){return this.event.commands!=null&&this.event.commands.undo(),this.start.remove(),this.end.remove(),this.tool!=null&&(this.tool.interrupt(),this.tool=null),this.repair2!=null&&(this.repair2.interrupt(),this.repair2=null),this.repair1!=null&&(this.repair1.interrupt(),this.repair1=null),this.mouseLeftDown=!1,Ut.cancel(),this.changleMouseStyle("default"),this.removeShiftMoveHelpLine(),ai.clearSnapFlag(),!0}onMouseRightUp(e){if(this.canDragPoint){if(e.openMenu){let r=e.realSceneX,i=e.realSceneY,n=this.event.track.width,s=this.start.isSelectWidth(r,i,n),a=this.end.isSelectWidth(r,i,n);if(s||a){this.position=e,this.rightUpSelectType=s?0:1;let l=new ou(this.event.track),c;if(s&&(l==null?void 0:l.startNodes.length)===1&&(c=l.startNodes[0]),a&&(l==null?void 0:l.endNodes.length)===1&&(c=l.endNodes[0]),(s||a)&&!(c instanceof Le))return this.rightClickMenuData(e),!0}}return!1}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:CG(!0).result};$t.getInstance().menuData(r,this)}getTrackCenter(){return this.event.track.start.add(this.event.track.end).mul(.5)}addPoint(e,r){return new Ui(e(),r)}selectPoint(e,r){if(this.start.inTop(e,r)&&this.canDragStart){this.changleMouseStyle("pointer");return}if(this.end.inTop(e,r)&&this.canDragEnd){this.changleMouseStyle("pointer");return}this.event.track.isSelect(e,r)?this.changeNativeCursor(5):this.changleMouseStyle("default")}getMouseStyle(e){let r=Math.atan2(e.y,e.x);return r>=Math.PI/8*1&&r<Math.PI/8*3||r>=-(Math.PI/8)*7&&r<-(Math.PI/8)*5?"ne-resize":r>=Math.PI/8*3&&r<Math.PI/8*5||r>=-(Math.PI/8)*5&&r<-(Math.PI/8)*3?"n-resize":r>=Math.PI/8*5&&r<Math.PI/8*7||r>=-(Math.PI/8)*3&&r<-(Math.PI/8)*1?"nw-resize":"w-resize"}parse(e){switch(e.cmdKey.split(":")[0]){case"INSERT_NODE":{A.publish("toggle",{command:"insertNode"});break}case"MOVE_NODE":let n=this.canDragStart&&this.start.status()?this.event.identify.startNodes[0]:this.event.identify.endNodes[0];A.publish("toggle",{command:"MOVE_NODE",filterItems:[this.event.track,n],inputInfo:this.position,commands:this.event.commands,options:{track:this.event.track,selectType:this.rightUpSelectType,controlPoint:this.rightUpSelectType===0?this.start:this.end}});break}}rotate(e=le.pcbConfig.rotate){if(this.tool==null&&(this.tool=this.event.getTool()),!this.controlPointMove&&this.tool instanceof dF){this.addHistory?(this.commands=new De("select Track"),this.commands.addCommand(Ce.dispatch(this.event.track,"modify")),this.addHistory=!1):this.event.commands.length>0&&(this.commands=this.event.commands);let r=ys([this.event.track]);if(r.valid()){let l=r.build1().center();$n.rotate(l,e,[this.event.track]),this.flushPoint()}this.event.addHistory=!1;let i=this.currPos,n=i.realSceneX,s=i.realSceneY;this.event.lastMousePosition=new S(i.sceneX,i.sceneY),this.event.lastRealMousePosition=new S(n,s),this.event.oldStart=this.event.track.start,this.event.oldEnd=this.event.track.end}}flushPoint(){this.start.setPosition(this.event.track.start),this.end.setPosition(this.event.track.end)}};var due=class extends Cs{constructor(e){super();this.tool=null;this.repair1=null;this.repair2=null;this.position=null;this.rightUpSelectType=null;this.initMove=!0;this.event=new kh(e);let r=()=>e.layerId;this.start=this.addPoint(r,e.start),this.end=this.addPoint(r,e.end),this.canDragStart=this.event.identify.canDrag(this.event.identify.startType),this.canDragEnd=this.event.identify.canDrag(this.event.identify.endType),this.canDragPoint=this.event.track.length>this.event.track.width*1.5}get getRepair1(){return this.repair1}get getRepair2(){return this.repair2}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;this.event.lastMousePosition=new S(e.sceneX,e.sceneY),this.event.lastRealMousePosition=new S(r,i);let n=!1;if(!this.event.track)return!1;Ut.getToleranceTargetNet(this.event.track.net);let s=this.event.track.width;return this.canDragPoint?(this.start.isSelectWidth(r,i,s)&&(n=!0),this.end.isSelectWidth(r,i,s)&&(n=!0)):this.event.identify.startType==0?this.start.isSelectWidth(r,i,s)&&(n=!0):this.event.identify.endType==0&&this.end.isSelectWidth(r,i,s)&&(n=!0),n||(n=this.event.track.isSelect(r,i)),n}realTimeDiffPairLengthErr(){let e=this.event.track.net,r=re.getInstance().getNet(e);if(r!=null&&r.netDifferential!=null){let i=r.netDifferential,n=i.positiveNet.name,s=i.negativeNet.name;Ye.modifyNet(n),Ye.modifyNet(s);let a=Jd.getNetLengthDelta(n),l=Jd.getNetLengthDelta(s);return{len_P:a,len_N:l}}return null}realTimeNetLength(){let e=this.event.track.net,r=re.getInstance().getNet(e);return r!=null&&r.netLengthPhysics!=null?(Ye.modifyNet(e),Jd.getNetLengthDelta(e)):0}snapExtendedLine(e){if(!e.adsorb||!le.adsorptionConfig.getConfig("Extended Line"))return;let r=new S(this.end.x,this.end.y),i=new S(e.realSceneX,e.realSceneY),n=new S(this.start.x,this.start.y),s=n.sub(r).angle(S.ORIGIN);ai.getExtendedLinePointInfo(i,r,n,s,e)}onMouseMove(e){this.changeNativeCursor(5),this.event.adsorbtion=e.adsorbGrid;let r=ds.getInstance();if(this.event.isPush()?(this.start.hidden(),this.end.hidden()):(this.start.visible(),this.end.visible()),this.initMove&&(Ye.dragHighlightNets([this.event.track.net]),this.event.track.manualHighLight=!0,this.initMove=!1),this.start.status()&&this.end.status()){this.snapExtendedLine(e);let i=e.sceneX,n=e.sceneY,s=new S(i,n),a=this.start.getPosition().distance2(s);this.end.getPosition().distance2(s)>a?this.end.setStatus(!1):this.start.setStatus(!1)}if(this.start.status()&&this.canDragStart){let i=this.event,n,s=i.adsorb(new S(e.realSceneX,e.realSceneY),i.track.width,i.track.layerId,!0);if(s)n=s;else{this.snapExtendedLine(e);let a=e.sceneX,l=e.sceneY;n=new S(a,l)}[0,4,1].includes(this.event.identify.startType)||this.event.needModifyRepair1(this.event.identify.startType,this.event.identify.startNodes[0])?(this.changleMouseStyle(this.getMouseStyle(this.event.oldEnd.sub(this.event.oldStart))),this.repair1==null&&(this.repair1=this.event.getRepairEndTool()),this.repair1.modifyPoint(n,!0)):(this.repair2==null&&(this.repair2=this.event.getLineTool(this.event.identify.startAngleType,!0)),this.repair2.move(n)),this.flushPoint()}else if(this.end.status()&&this.canDragEnd){let i=this.event,n,s=i.adsorb(new S(e.realSceneX,e.realSceneY),i.track.width,i.track.layerId,!0);if(s)n=s;else{this.snapExtendedLine(e);let a=e.sceneX,l=e.sceneY;n=new S(a,l)}[0,4,1].includes(this.event.identify.endType)||this.event.needModifyRepair1(this.event.identify.endType,this.event.identify.endNodes[0])?(this.changleMouseStyle(this.getMouseStyle(this.event.oldEnd.sub(this.event.oldStart))),this.repair1==null&&(this.repair1=this.event.getRepairEndTool()),this.repair1.modifyPoint(n,!1)):(this.repair2==null&&(this.repair2=this.event.getLineTool(this.event.identify.endAngleType,!1)),this.repair2.move(n)),this.flushPoint()}else{let i=e.sceneX,n=e.sceneY,s=new S(i,n);this.tool==null&&(this.tool=this.event.getTool()),this.tool.move(s,e),this.flushPoint()}return Ut.updateNetLengthMsg2(e,{diffPairLength:r.showDiffLength?this.realTimeDiffPairLengthErr():null,netLength:r.showNetLength?this.realTimeNetLength():null,net:this.event.track.net}),!0}onMouseUpMove(e){let r=e.realSceneX,i=e.realSceneY;return this.selectPoint(r,i),!1}onMouseLeftUp(e){this.mouseLeftDown=!1;let r=!1;if(this.initMove=!0,this.event.track.manualHighLight=!1,Ye.dragUnhighlightNet(),!Mi.getInstance().checkTrackIsCanEdit())return this.interrupt(),!0;this.tool!=null&&(r=!0,this.tool.complete(),this.tool=null),this.repair2!=null&&(r=!0,this.repair2.complete(),this.repair2=null),this.repair1!=null&&(r=!0,this.repair1.complete(),this.repair1=null);let n=new De("");return this.event.complete(n),r&&(kh.complete2(n),kh.clear()),n.commands.length>0&&(qe.executeCommand(n),this.event.commands=null),(this.start.status()&&this.canDragStart||this.end.status()&&this.canDragEnd)&&A.publish("clearSelect",""),A.publish("flushService",""),this.removeShiftMoveHelpLine(),ai.clearSnapFlag(),!0}interrupt(){let e=!1;return this.initMove=!0,this.event.track.manualHighLight=!1,Ye.dragUnhighlightNet(),this.start.remove(),this.end.remove(),this.tool!=null&&(this.tool.interrupt(),this.tool=null,e=!0),this.repair2!=null&&(this.repair2.interrupt(),this.repair2=null,e=!0),this.repair1!=null&&(this.repair1.interrupt(),this.repair1=null,e=!0),this.event.interrupt(),e&&kh.clear(),this.mouseLeftDown=!1,Ut.cancel(),this.changleMouseStyle("default"),this.removeShiftMoveHelpLine(),ai.clearSnapFlag(),!0}onMouseRightUp(e){if(this.canDragPoint){if(e.openMenu){let r=e.realSceneX,i=e.realSceneY,n=this.event.track.width,s=this.start.isSelectWidth(r,i,n),a=this.end.isSelectWidth(r,i,n);if(s||a){this.position=e,this.rightUpSelectType=s?0:1;let l=new ou(this.event.track),c;if(s&&(l==null?void 0:l.startNodes.length)===1&&(c=l.startNodes[0]),a&&(l==null?void 0:l.endNodes.length)===1&&(c=l.endNodes[0]),(s||a)&&!(c instanceof Le))return this.rightClickMenuData(e),!0}}return!1}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:CG(!0).result};$t.getInstance().menuData(r,this)}addPoint(e,r){return new Ui(e(),r)}selectPoint(e,r){if(this.start.inTop(e,r)&&this.canDragStart){this.changleMouseStyle("pointer");return}if(this.end.inTop(e,r)&&this.canDragEnd){this.changleMouseStyle("pointer");return}this.event.track.isSelect(e,r)?this.changeNativeCursor(5):this.changleMouseStyle("default")}getMouseStyle(e){let r=Math.atan2(e.y,e.x);return r>=Math.PI/8*1&&r<Math.PI/8*3||r>=-(Math.PI/8)*7&&r<-(Math.PI/8)*5?"ne-resize":r>=Math.PI/8*3&&r<Math.PI/8*5||r>=-(Math.PI/8)*5&&r<-(Math.PI/8)*3?"n-resize":r>=Math.PI/8*5&&r<Math.PI/8*7||r>=-(Math.PI/8)*3&&r<-(Math.PI/8)*1?"nw-resize":"w-resize"}parse(e){switch(e.cmdKey.split(":")[0]){case"INSERT_NODE":{A.publish("toggle",{command:"insertNode"});break}case"MOVE_NODE":let n=this.canDragStart&&this.start.status()?this.event.identify.startNodes[0]:this.event.identify.endNodes[0];A.publish("toggle",{command:"MOVE_NODE",filterItems:[this.event.track,n],inputInfo:this.position,commands:this.event.commands,options:{track:this.event.track,selectType:this.rightUpSelectType,controlPoint:this.rightUpSelectType===0?this.start:this.end}});break}}rotate(e=le.pcbConfig.rotate){this.tool.rotate(e),this.flushPoint()}flushPoint(){this.start.setPosition(this.event.start),this.end.setPosition(this.event.end)}};var vD=class{constructor(t){this.shoveEvent=new rR;this.event=t}getNormalOffset(t,e){let r=new S(-t.y,t.x);return r.mul(e.dot(r))}getLine(t,e){let r=e.sub(t),i=r.normalize().mul(1e3+r.length());return new M(t.sub(i),t.add(i))}getIntersection(t,e){return Pt(t,e)>0?new S(Ee[0],Ee[1]):null}getNewTrackEnd(t,e,r,i){i||(e=e.mul(-1));let n=r.sub(t),s=this.getNormalOffset(e,n);return t.add(s.add(e.mul(s.length())))}createTrack(t,e,r){return pr.addTrack(r.layerId,t,e,r.width,!1,r.net)}lock(){return!1}isBlock(){return this.event.isBlock()}isPush(){return this.event.isPush()}};var pue=class extends vD{getLengthIncrement(){return 0}constructor(t){super(t),this.event.commands=new De("repair line - drag single arcTrack"),this.start=this.event.oldStart,this.end=this.event.oldEnd}move(t){if(this.lock())return;t=this.event.adsorpTrack(t,this.event.track.width,this.event.track.layerId,new Set([this.event.track]));let e=t.sub(this.event.track.start);this.moveOffset(e)}moveOffset(t){this.event.addHistory&&(this.event.commands.addCommand(Ce.dispatch(this.event.track,"modify")),this.event.addHistory=!1);let e=Ae.translate(t.x,t.y,0);this.event.track.transform(e)}complete(){this.event.commands!=null&&this.event.commands.length>0&&A.publish("hasModifyPcbItem",this.event.track)}interrupt(){}};var fue=class extends vD{constructor(e,r,i,n,s){super(e);this.block=new w0;this.prev=r,this.next=i,this.angle=this.event.track.angle,this.prevDirect=this.event.optimizationDirect(r.end.sub(r.start).normalize()),this.nextDirect=this.event.optimizationDirect(i.end.sub(i.start).normalize());let a=this.prevDirect.mul(1e3+r.length);this.prevLine=new M(r.start.sub(a),r.start.add(a));let l=this.nextDirect.mul(1e3+i.length);this.nextLine=new M(i.start.sub(l),i.start.add(l)),this.prevConnect=n,this.nextConnect=s,this.event.commands=new De("repair arc - connnect Track"),this.blockPrev=this.block.checkIntersection(this.prev),this.blockNext=this.block.checkIntersection(this.next),this.event.blockTrack=this.block.checkIntersection(this.event.track),this.arcTrans=new Yn}getLengthIncrement(){return 0}move(e){if(this.lock())return;e=this.event.adsorpTrack(e,this.event.track.width,this.event.track.layerId,new Set([this.event.track,this.prev,this.next]));let r=e.sub(this.event.track.start);this.moveOffset(r)}moveOffset(e){this.event.addHistory&&(this.event.commands.addCommand(Ce.dispatch(this.event.track,"modify")),this.event.commands.addCommand(Ce.dispatch(this.prev,"modify")),this.event.commands.addCommand(Ce.dispatch(this.next,"modify")),this.event.addHistory=!1);let r=this.getNormalOffset(this.event.direct,e),i=this.event.track.start.add(r),n=this.getLine(i,i.add(this.event.direct)),s=this.getIntersection(n,this.prevLine),a=this.getIntersection(n,this.nextLine);if(s!=null&&a!=null){if(this.event.optimizationDirect(a.sub(s).normalize()).dot(this.event.direct)<=0){let c=this.getIntersection(this.prevLine,this.nextLine);s=c,a=c}if(s!=null&&a!=null){if(this.getNewDirect(this.prevConnect,s,this.prev).dot(this.prevDirect)<=0){let u=this.getPoint(this.prevConnect,this.prev);n=this.getLine(u.add(this.event.direct),u),s=u,a=this.getIntersection(n,this.nextLine)}if(this.getNewDirect(this.nextConnect,a,this.next).dot(this.nextDirect)<=0){let u=this.getPoint(this.nextConnect,this.next);n=this.getLine(u.add(this.event.direct),u),s=this.getIntersection(n,this.prevLine),a=u}s!=null&&a!=null&&(this.modify(this.prevConnect,s,this.prev),this.modify(this.nextConnect,a,this.next),this.modifyArc(s,a))}}this.blockTrack()}modifyArc(e,r){let i=this.event.track,{center:n,radius:s,startAngle:a,endAngle:l,sweep:c}=this.arcTrans.pointToAngle(e,r,this.angle);i.center=n,i.radius=s,i.startAngle=a,i.endAngle=l,i.sweep=c}blockTrack(){}complete(){this.event.commands!=null&&this.event.commands.length>0&&(this.optimization(),this.event.track.start.equals(this.event.track.end)?(this.event.commands.addCommand(Ce.dispatch(this.event.track,"delete")),this.event.track.remove(),A.publish("delete",this.event.track)):A.publish("hasModifyPcbItem",this.event.track),this.event.commands.addCommand(Ce.dispatch(this.prev,"modify")),A.publish("hasModifyPcbItem",this.prev),this.event.commands.addCommand(Ce.dispatch(this.next,"modify")),A.publish("hasModifyPcbItem",this.next))}optimization(){if(this.event.track.length<=.01){let e=this.getIntersection(this.prevLine,this.nextLine);e!=null&&this.move(e)}else{let e=this.event.adsorpTrack(this.event.track.start,this.event.track.width,this.event.track.layerId,new Set([this.event.track,this.prev,this.next]));e.distance2(this.event.track.start)>1e-8&&this.move(e);let r=this.event.adsorpTrack(this.event.track.end,this.event.track.width,this.event.track.layerId,new Set([this.event.track,this.prev,this.next]));r.distance2(this.event.track.end)>1e-8&&this.move(r)}if(this.prev.length<=.01){let e=this.getPoint(this.prevConnect,this.prev);this.move(e)}if(this.next.length<=.01){let e=this.getPoint(this.nextConnect,this.next);this.move(e)}}interrupt(){}getNewDirect(e,r,i){switch(e){case 2:case 0:return this.event.optimizationDirect(i.end.sub(r).normalize());case 3:case 1:return this.event.optimizationDirect(r.sub(i.start).normalize())}}getCheckEnd(e,r){switch(e){case 2:case 0:return!1;case 3:case 1:return!0}}getBlockEnd(e,r){switch(e){case 2:case 0:return r.start;case 3:case 1:return r.end}}getPoint(e,r){switch(e){case 2:case 0:return r.end;case 3:case 1:return r.start}}modify(e,r,i){switch(e){case 2:case 0:i.start=r;break;case 3:case 1:i.end=r;break}}};var Mq=class extends vD{constructor(e,r,i,n){super(e);this.newLine=null;this.block=new w0;this.track=r,this.angle=e.track.angle,this.arcTrans=new Yn,this.direct=this.event.optimizationDirect(r.end.sub(r.start).normalize());let s=n.sub(this.event.track.center).normalize();this.direct1=new S(s.y,-s.x);let a=s.cross(this.direct1);i==0||i==1?this.event.track.sweep==ae.CCW&&a>=0?this.direct1=new S(-s.y,s.x):this.event.track.sweep==ae.CW&&a<=0&&(this.direct1=new S(-s.y,s.x)):this.event.track.sweep==ae.CW&&a>=0?this.direct1=new S(-s.y,s.x):this.event.track.sweep==ae.CCW&&a<=0&&(this.direct1=new S(-s.y,s.x));let l=this.direct.mul(1e3+r.length),c=this.direct1.mul(1e3+r.length);this.event.startTangent?(this.prevLine=new M(r.start.sub(l),r.start.add(l)),this.nextLine=new M(n.sub(c),n.add(c))):(this.prevLine=new M(n.sub(c),n.add(c)),this.nextLine=new M(r.start.sub(l),r.start.add(l))),this.line=new M(r.start.sub(c),r.start.add(c)),this.connect=i,this.center=n,this.event.commands=new De("repair arc - connnect Track and other"),this.blockPrev=this.block.checkIntersection(this.track),this.event.blockTrack=this.block.checkIntersection(this.event.track)}getLengthIncrement(){return this.newLine!=null?this.newLine.length:0}move(e){if(this.lock())return;let r=e.sub(this.event.track.start);this.moveOffset(r)}moveOffset(e){this.event.addHistory&&(this.event.commands.addCommand(Ce.dispatch(this.event.track,"modify")),this.event.commands.addCommand(Ce.dispatch(this.track,"modify")),this.event.addHistory=!1);let r=this.getNormalOffset(this.event.direct,e);if(r!=null){let i=this.event.track.start.add(r),n=this.getLine(i,i.add(this.event.direct)),s=this.getIntersection(n,this.prevLine),a=this.getIntersection(n,this.nextLine);if(s!=null&&a!=null){if(this.event.optimizationDirect(a.sub(s).normalize()).dot(this.event.direct)<=0){let c=this.getIntersection(this.prevLine,this.nextLine);s=c,a=c}if(s!=null&&a!=null)if(this.event.startTangent){if(this.getNewDirect(this.connect,s,this.track).dot(this.direct)<=0){let u=this.getPoint2(this.connect,this.track);n=this.getLine(u.add(this.event.direct),u),s=u,a=this.getIntersection(n,this.nextLine)}if(this.event.optimizationDirect(a.sub(this.center).normalize()).dot(this.direct1)<=0){let u=this.center;n=this.getLine(u.add(this.event.direct),u),s=this.getIntersection(n,this.prevLine),a=u}}else{if(this.getNewDirect(this.connect,a,this.track).dot(this.direct)<=0){let u=this.getPoint2(this.connect,this.track);n=this.getLine(u.add(this.event.direct),u),a=u,s=this.getIntersection(n,this.prevLine)}if(this.event.optimizationDirect(s.sub(this.center).normalize()).dot(this.direct1)<=0){let u=this.center;n=this.getLine(u.add(this.event.direct),u),a=this.getIntersection(n,this.nextLine),s=u}}s!=null&&a!=null&&(this.modifyArc(s,a),this.event.startTangent?(this.modify(this.connect,s,this.track),this.updateLine(this.center,a,this.event.track)):(this.modify(this.connect,a,this.track),this.updateLine(this.center,s,this.event.track)))}}}modifyArc(e,r){let i=this.event.track,{center:n,radius:s,startAngle:a,endAngle:l,sweep:c}=this.arcTrans.pointToAngle(e,r,this.angle);i.center=n,i.radius=s,i.startAngle=a,i.endAngle=l,i.sweep=c}blockTrack(){}complete(){if(this.event.commands!=null&&this.newLine!=null&&(this.optimization(),this.event.commands!=null&&this.newLine!=null)){let e=this.createTrack(this.newLine.start,this.newLine.end,this.event.track);this.event.commands.addCommand(Ce.dispatch(e,"add")),A.publish("hasModifyPcbItem",e),A.publish("hasModifyPcbItem",this.track),this.event.track.start.equals(this.event.track.end)?(this.event.commands.addCommand(Ce.dispatch(this.event.track,"delete")),this.event.track.remove(),A.publish("delete",this.event.track)):A.publish("hasModifyPcbItem",this.event.track),this.newLine.remove(),this.newLine=null}}optimization(){if(this.event.track.length<=this.event.track.width&&this.event.track.length<1){let e=this.getPoint(),r=this.getLine(e,e.add(this.direct)),i=this.getNewTrackEnd(this.center,this.event.direct,this.event.track.start,!0),n=this.getLine(this.center,i);i=this.getIntersection(r,n),i!=null&&(i=this.event.adsorpTrack(i,this.event.track.width,this.event.track.layerId,new Set([this.event.track,this.track])),this.move(i))}else{let e=this.event.adsorpTrack(this.event.track.start,this.event.track.width,this.event.track.layerId,new Set([this.event.track,this.track]));e.distance2(this.event.track.start)>1e-8&&this.move(e);let r=this.event.adsorpTrack(this.event.track.end,this.event.track.width,this.event.track.layerId,new Set([this.event.track,this.track]));r.distance2(this.event.track.end)>1e-8&&this.move(r)}if(this.track.length<=this.track.width){let e=this.event.adsorpTrack(this.getPoint(),this.event.track.width,this.event.track.layerId,new Set([this.event.track,this.track]));this.move(e)}if(this.newLine!=null&&this.newLine.length<=this.event.track.width&&this.event.track.length<1){let e=this.event.adsorpTrack(this.center,this.event.track.width,this.event.track.layerId,new Set([this.event.track,this.track]));this.move(e)}}interrupt(){this.newLine!=null&&(this.newLine.remove(),this.newLine=null)}updateLine(e,r,i){this.newLine!=null?e.equals(r)?(this.newLine.remove(),this.newLine=null):(this.newLine.start=e,this.newLine.end=r):this.newLine=Id.build(i.layerId,e,r,i.width,i.net)}getPoint(){switch(this.connect){case 2:case 0:return this.track.end;case 3:case 1:return this.track.start}}modify(e,r,i){switch(e){case 2:case 0:i.start=r;break;case 3:case 1:i.end=r;break}}getNewDirect(e,r,i){switch(e){case 2:case 0:return this.event.optimizationDirect(i.end.sub(r).normalize());case 3:case 1:return this.event.optimizationDirect(r.sub(i.start).normalize())}}getPoint2(e,r){switch(e){case 2:case 0:return r.end;case 3:case 1:return r.start}}};var mue=class{constructor(t){this.commands=null;this.addHistory=!0;this.identify=null;this.track=null;this.direct=null;this.adsorbtion=!1;this.point=null;this.blockTrack=!0;this.resultTrack=null;this.isCoSelect=!1;this.isMultiRepair=!1;this.startTangent=!1;this.endTangent=!1;this.track=t,this.oldStart=t.start,this.oldEnd=t.end,this.direct=this.optimizationDirect(this.oldEnd.sub(this.oldStart).normalize()),this.identify=new ou(t),this.arc=this.track.primitive,this.isCoSelect=this.isCoSelect,this.startTangent=this.identify.startTangent,this.endTangent=this.identify.endTangent,this.commands=null,this.lastMousePosition=t.start,Ut.getToleranceTargetNet(this.track.net)}get coSelect(){return this.isCoSelect}set coSelect(t){this.isCoSelect=t}getTool(){let t=this.identify.startType,e=this.identify.endType;if(this.startTangent){let r=this.identify.startNodes[0],i=this.identify.endNodes[0];return this.endTangent?new fue(this,r,i,this.getConnect(!0,t),this.getConnect(!1,e)):new Mq(this,r,this.getConnect(!0,t),this.oldEnd)}else if(this.endTangent){let r=this.identify.endNodes[0];return new Mq(this,r,this.getConnect(!1,e),this.oldStart)}else return new pue(this)}setMultiRepair(t){this.isMultiRepair=t}isBlock(){return this.isMultiRepair?!1:Zt.getInstance().mode=="WIRING_MODE_SURROUND"}isPush(){return this.isMultiRepair?!1:Zt.getInstance().mode=="WIRING_MODE_PUSHAWAY"}optimizationDirect(t){let e;Math.abs(t.x)<1e-8?e=0:e=t.x;let r;return Math.abs(t.y)<1e-8?r=0:r=t.y,new S(e,r)}getConnect(t,e){return t?e==5?0:1:e==5?2:3}adsorb(t,e,r){this.clearAdsorpPoint();let i=new _e().ext2(t).ext7(e).build1(),n=kt.search(i,(l,c)=>(c=="ArcTrack"||c=="Track")&&l==r||c=="Pad"&&(l==12||l==r)||c=="Via");n.setFilter(new Mp(t.x,t.y)).setFilter(new ed);let s=new b1;n.setAction(s),n.doAction(["Track","ArcTrack","Pad","Via"]);let a=new Array;for(let l of s.pads)if(l.net==this.track.net)return this.showAdsorpPoint(l.center),l.center;for(let l of s.vias)if(l.net==this.track.net)return this.showAdsorpPoint(l.center),l.center;for(let l of s.tracks)l!=this.track&&a.push(l);return a.length>0?ai.adsorpTrack(t,a[0]):t}showAdsorpPoint(t){this.point=new Ui(1002,t),setTimeout(()=>{this.point!=null&&(this.point.remove(),this.point=null)},2e3)}clearAdsorpPoint(){this.point!=null&&(this.point.remove(),this.point=null)}adsorpTrack(t,e,r,i){let n=new _e().ext2(t).ext7(e).build1(),s=kt.search(n,(l,c)=>l==r&&(c=="Track"||c=="ArcTrack")),a=new Array;for(let l of s.getTracks())!i.has(l)&&l.isSelect(t.x,t.y)&&l.isVisible&&l.layerId==r&&a.push(l);return a.length>0?ai.adsorpTrack(t,a[0]):t}getEnd(t,e){let r=Number.MAX_VALUE;return e[0]}};var gue=class extends Cs{constructor(e){super();this.addHistory=!0;this.arcTransition=new Yn;this.tool=null;this.controlPointMove=!1;this.startTangent=!1;this.endTangent=!1;this.position=null;this.rightUpSelectType=null;this.arc=e,this.event=new mue(e),this.commands=new De("select Arc Track");let r=this.arc.layerId;this.start=new Ui(r,this.arc.start),this.mid=new Ui(r,this.arc.midPoint),this.end=new Ui(r,this.arc.end),this.moveTool=new Qc([this.arc]),this.startTangent=this.event.identify.startTangent,this.endTangent=this.event.identify.endTangent}onMouseLeftDown(e){let r=e.sceneX,i=e.sceneY;return this.controlPointMove=!1,this.mouseLeftDown=!0,this.start.isSelect(r,i)&&(this.controlPointMove=!0),this.mid.isSelect(r,i)&&(this.controlPointMove=!0),this.end.isSelect(r,i)&&(this.controlPointMove=!0),this.controlPointMove}onMouseMove(e){if(this.arc.locked)return!1;this.changeNativeCursor(5);let r=new S(e.sceneX,e.sceneY);if(this.start.status()){if(this.addHistory&&(this.commands.addCommand(Ce.dispatch(this.arc,"modify")),this.addHistory=!1),this.changleMouseStyle("pointer"),this.arc.arcType===2){let i=r.angle(this.arc.center);this.arc.startAngle=i,this.start.setPosition(this.arc.start),this.mid.setPosition(this.arc.midPoint)}else{let i=this.getTangent(this.arc.end).mul(-1),{center:n,radius:s,startAngle:a,endAngle:l,sweep:c}=this.moveEndpoint(i,this.arc.end,r,!1);this.arc.center=n,this.arc.radius=s,this.arc.startAngle=l,this.arc.endAngle=a,this.arc.sweep=c==ae.CCW?ae.CW:ae.CCW,this.start.setPosition(this.arc.start),this.mid.setPosition(this.arc.midPoint)}this.handleArcConnect(this.event.identify.startNodes[0],this.arc.start,this.event.identify.startType)}else if(this.end.status()){if(this.addHistory&&(this.commands.addCommand(Ce.dispatch(this.arc,"modify")),this.addHistory=!1),this.changleMouseStyle("pointer"),this.arc.arcType===2){let i=r.angle(this.arc.center);this.arc.endAngle=i,this.end.setPosition(this.arc.end),this.mid.setPosition(this.arc.midPoint)}else{let i=this.getTangent(this.arc.start),{center:n,radius:s,startAngle:a,endAngle:l,sweep:c}=this.moveEndpoint(i,this.arc.start,r);this.arc.center=n,this.arc.radius=s,this.arc.startAngle=a,this.arc.endAngle=l,this.arc.sweep=c,this.end.setPosition(this.arc.end),this.mid.setPosition(this.arc.midPoint)}this.handleArcConnect(this.event.identify.endNodes[0],this.arc.end,this.event.identify.endType)}else if(this.mid.status()){if(this.addHistory&&(this.commands.addCommand(Ce.dispatch(this.arc,"modify")),this.addHistory=!1),this.changleMouseStyle("pointer"),this.event.startTangent||this.event.endTangent)this.stretchingHandle(e);else if(Math.abs(this.arc.start.sub(r).cross(this.arc.end.sub(r)))>1e-8){let{center:i,radius:n,startAngle:s,endAngle:a,sweep:l}=this.arcTransition.point2Angle(this.arc.start,this.arc.end,r);this.arc.center=i,this.arc.radius=n,this.arc.startAngle=s,this.arc.endAngle=a,this.arc.sweep=l,this.mid.setPosition(this.arc.midPoint)}}else this.stretchingHandle(e);return Ut.updateNetLengthMsg(e,{diffPairLength:this.realTimeDiffPairLengthErr(),netLength:this.realTimeNetLength(),net:this.event.track.net}),!0}handleArcConnect(e,r,i){switch(i){case 7:case 5:this.commands.addCommand(Ce.dispatch(e,"modify")),e.start=r;break;case 8:case 6:this.commands.addCommand(Ce.dispatch(e,"modify")),e.end=r;break}}stretchingHandle(e){this.tool==null&&(this.tool=this.event.getTool());let r=new S(e.realSceneDeltaX,e.realSceneDeltay);this.tool.moveOffset(r),this.flushPoint()}onMouseUpMove(e){let r=e.sceneX,i=e.sceneY;return this.selectPoint(r,i),!1}selectPoint(e,r){let i=!1;this.start.inTop(e,r)&&(i=!0),this.mid.inTop(e,r)&&(i=!0),this.end.inTop(e,r)&&(i=!0),i?this.changleMouseStyle("pointer"):this.event.track.isSelect(e,r)?this.changeNativeCursor(5):this.changleMouseStyle("default")}realTimeDiffPairLengthErr(){let e=this.event.track.net,r=re.getInstance().getNet(e);if(r!=null&&r.netDifferential!=null){let i=r.netDifferential,n=i.positiveNet.name,s=i.negativeNet.name;Ye.modifyNet(n),Ye.modifyNet(s);let a=Ye.getNetLength(n),l=Ye.getNetLength(s),c=this.getIncrement(this.tool,n,s);return Zt.getInstance().mode=="WIRING_MODE_PUSHAWAY"?(a=a+c[0],l=l+c[1]):this.event.track.net==n?a=a+c[2]:l=l+c[2],a-l}return 0}realTimeNetLength(){let e=this.event.track.net,r=re.getInstance().getNet(e);if(r!=null&&r.netLengthPhysics!=null){Ye.modifyNet(e);let i=Ye.getNetLength(e),n=this.tool==null?0:this.tool.getLengthIncrement();return i+n}return 0}getIncrement(e,r,i){if(e!=null){let n=e.shoveEvent.getNetDelta(r),s=e.shoveEvent.getNetDelta(i),a=e.getLengthIncrement();return[n,s,a]}return[0,0,0]}flushPoint(){this.start.setPosition(this.arc.start),this.mid.setPosition(this.arc.midPoint),this.end.setPosition(this.arc.end)}onMouseLeftUp(e){return this.mouseLeftDown=!1,this.tool!=null&&(this.tool.complete(),this.tool=null),this.commands.length>0&&(qe.executeCommand(this.commands),this.commands=new De("select Arc Track"),A.publish("hasModifyPcbItem",this.arc)),this.event.commands!=null&&this.event.commands.length>0&&(qe.executeCommand(this.event.commands),this.event.commands=null),A.publish("flushService",""),A.publish("flushSelectingInfo",""),!0}onMouseRightUp(e){if(e.openMenu){let r=e.realSceneX,i=e.realSceneY,n=this.event.track.width,s=this.start.isSelectWidth(r,i,n),a=this.end.isSelectWidth(r,i,n);if(s||a){this.position=e,this.rightUpSelectType=s?0:1;let l=new ou(this.event.track);if(s&&(l==null?void 0:l.startNodes.length)==1||a&&(l==null?void 0:l.endNodes.length)==1)return this.rightClickMenuData(e),!0}}return!1}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:CG(!0).result};$t.getInstance().menuData(r,this)}interrupt(){return this.commands!=null&&this.commands.undo(),this.start.remove(),this.mid.remove(),this.end.remove(),this.moveTool.interrupt(),this.changleMouseStyle("default"),this.event.commands!=null&&this.event.commands.undo(),this.tool!=null&&(this.tool.interrupt(),this.tool=null),this.mouseLeftDown=!1,Ut.cancel(),!0}moveEndpoint(e,r,i,n=!0){return this.arcTransition.tangentToArc(e,r,i,n)}getDirect(e){return this.arc.sweep==ae.CCW?new S(-e.y,e.x):new S(e.y,-e.x)}getTangent(e){let r=e.sub(this.arc.center).normalize();return this.getDirect(r)}rotate(e=le.pcbConfig.rotate){if(!this.controlPointMove){let r=this.arc.getParent();if(r!=null&&r.getGroupID()!=null)this.commands=new De("select Arc Track"),this.moveTool.rotate(e);else{this.addHistory&&(this.commands=new De("select Arc Track"),this.commands.addCommand(Ce.dispatch(this.arc,"modify")),this.addHistory=!1);let i=ys([this.arc]);if(i.valid()){let s=i.build1().center();$n.rotate(s,e,[this.arc]),this.flushPoint()}}}}parse(e){switch(e.cmdKey.split(":")[0]){case"MOVE_NODE":let n=this.start.status()&&(this.event.identify.startType==0||this.event.identify.startType==4)?this.event.identify.startNodes[0]:this.event.identify.endNodes[0];A.publish("toggle",{command:"MOVE_NODE",filterItems:[this.event.track,n],inputInfo:this.position,commands:this.event.commands,options:{track:this.event.track,selectType:this.rightUpSelectType,controlPoint:this.rightUpSelectType===0?this.start:this.end,midPoint:this.mid}});break}}};var yue=class extends Cs{constructor(e){super();this.tool=null;this.modifyEndTool=null;this.controlPointMove=!1;this.initMove=!0;this.event=new BI(e);let r=e.layerId;this.start=new Ui(r,e.start),this.mid=new Ui(r,e.midPoint),this.end=new Ui(r,e.end)}onMouseLeftDown(e){this.event.lastMousePosition=new S(e.sceneX,e.sceneY);let r=e.sceneX,i=e.sceneY;return this.controlPointMove=!1,this.mouseLeftDown=!0,Ut.getToleranceTargetNet(this.event.track.net),this.start.isSelect(r,i)&&(this.controlPointMove=!0),this.mid.isSelect(r,i)&&(this.controlPointMove=!0),this.end.isSelect(r,i)&&(this.controlPointMove=!0),this.controlPointMove}onMouseMove(e){this.initMove&&(wd.getInstance().highlight([this.event.track]),this.initMove=!1),this.changeNativeCursor(5);let r=new S(e.sceneX,e.sceneY);return this.start.status()?(this.changleMouseStyle("pointer"),this.modifyEndTool||(this.modifyEndTool=this.event.getEndTool(0)),this.modifyEndTool.move(r),this.flushPoint()):this.end.status()?(this.changleMouseStyle("pointer"),this.modifyEndTool||(this.modifyEndTool=this.event.getEndTool(2)),this.modifyEndTool.move(r),this.flushPoint()):this.mid.status()?(this.changleMouseStyle("pointer"),this.event.startTangent||this.event.endTangent?this.stretchingHandle(e):Math.abs(this.event.start.sub(r).cross(this.event.end.sub(r)))>1e-8&&(this.modifyEndTool||(this.modifyEndTool=this.event.getEndTool(1)),this.modifyEndTool.move(r),this.flushPoint())):this.stretchingHandle(e),Ut.updateNetLengthMsg2(e,{diffPairLength:this.realTimeDiffPairLengthErr(),netLength:this.realTimeNetLength(),net:this.event.track.net}),!0}stretchingHandle(e){this.tool==null&&(this.tool=this.event.getTool());let r=new S(e.sceneX,e.sceneY);this.tool.move(r),this.flushPoint()}onMouseLeftUp(e){var r,i;if(this.mouseLeftDown=!1,wd.getInstance().unhighlight(),this.initMove=!0,this.tool!=null||this.modifyEndTool!=null){(r=this.tool)==null||r.complete(),(i=this.modifyEndTool)==null||i.complete(),this.tool=null,this.modifyEndTool=null;let n=new De("repair Arc track");this.event.complete(n);let s=BI.complete2(n),a=this.event.resultId,l=s[a];if(l){let h=new Jt().getItem(l);A.publish("select",[h])}n.commands.length>0&&qe.executeCommand(n),BI.clear()}return A.publish("flushService",""),A.publish("flushSelectingInfo",""),!0}onMouseUpMove(e){let r=e.sceneX,i=e.sceneY;return this.selectPoint(r,i),!1}selectPoint(e,r){let i=!1;this.start.inTop(e,r)&&(i=!0),this.mid.inTop(e,r)&&(i=!0),this.end.inTop(e,r)&&(i=!0),i?this.changleMouseStyle("pointer"):this.event.track.isSelect(e,r)?this.changeNativeCursor(5):this.changleMouseStyle("default")}realTimeDiffPairLengthErr(){let e=this.event.track.net,r=re.getInstance().getNet(e);if(r!=null&&r.netDifferential!=null){let i=r.netDifferential,n=i.positiveNet.name,s=i.negativeNet.name;Ye.modifyNet(n),Ye.modifyNet(s);let a=Jd.getNetLengthDelta(n),l=Jd.getNetLengthDelta(s);return{len_P:a,len_N:l}}return null}realTimeNetLength(){let e=this.event.track.net,r=re.getInstance().getNet(e);return r!=null&&r.netLengthPhysics!=null?(Ye.modifyNet(e),Jd.getNetLengthDelta(e)):0}flushPoint(){this.start.setPosition(this.event.start),this.mid.setPosition(this.event.midPoint),this.end.setPosition(this.event.end)}interrupt(){var e,r;return wd.getInstance().unhighlight(),this.initMove=!0,this.start.remove(),this.mid.remove(),this.end.remove(),this.changleMouseStyle("default"),(this.tool!=null||this.modifyEndTool!=null)&&((e=this.tool)==null||e.interrupt(),(r=this.modifyEndTool)==null||r.interrupt(),this.tool=null,this.modifyEndTool=null,this.event.interrupt(),BI.clear()),this.mouseLeftDown=!1,Ut.cancel(),!0}rotate(){this.tool&&(this.tool.rotate(),this.flushPoint())}};var bue=class extends Cs{constructor(e){super();this.addHistory=!0;this.controlPointMove=!1;this.dimension=e,this.commands=new De("select dimension");let r=this.dimension.layerId;this.start=new Ui(r,e.start),this.end=new Ui(r,e.end),this.left=new Ui(r,e.left),this.right=new Ui(r,e.right),this.moveTool=new Qc([this.dimension]);let i=ys([this.dimension]);if(i.valid()){let n=i.build1();this.rotateCenter=n.center()}else this.rotateCenter=e.start}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;return this.controlPointMove=!1,this.mouseLeftDown=!0,this.left.isSelect(r,i)&&(this.controlPointMove=!0),this.right.isSelect(r,i)&&(this.controlPointMove=!0),this.start.isSelect(r,i)&&(this.controlPointMove=!0),this.end.isSelect(r,i)&&(this.controlPointMove=!0),this.dimension.length===0&&(this.right.remove(),this.left.remove()),this.addHistory=!0,this.controlPointMove}onMouseMove(e){if(this.dimension.locked)return!1;let r=this.shiftControl(e),i=this.lastPosition;if(this.addHistory&&(this.commands.addCommand(Ce.dispatch(this.dimension,"modify")),this.addHistory=!1),this.start.status())return this.start.setPosition(i),this.dimension.start=i,this.end.setPosition(this.dimension.end),this.left.setPosition(this.dimension.left),!0;if(this.end.status())return this.end.setPosition(i),this.dimension.end=i,this.start.setPosition(this.dimension.start),this.right.setPosition(this.dimension.right),!0;if(this.left.status())return this.left.setPosition(i),this.dimension.left=i,this.start.setPosition(this.dimension.start),!0;if(this.right.status())return this.right.setPosition(i),this.dimension.right=i,this.end.setPosition(this.dimension.end),!0;let n=Ae.translate(r.x,r.y,0);return this.dimension.getGroupID()!=null?(this.commands=new De("select dimension"),this.moveTool.onMouseMove(e)):(this.dimension.transform(n),this.rotateCenter=this.rotateCenter.multiply4(n)),this.flushPoint(),!0}flushPoint(){this.start.setPosition(this.dimension.start),this.end.setPosition(this.dimension.end),this.left.setPosition(this.dimension.left),this.right.setPosition(this.dimension.right)}onMouseLeftUp(e){return this.commands.length>0&&(qe.executeCommand(this.commands),this.commands=new De("select 2dLine - arc")),this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),A.publish("flushService",""),A.publish("flushSelectingInfo",""),!0}interrupt(){var e,r;return this.commands.undo(),this.start.remove(),this.end.remove(),(e=this.left)==null||e.remove(),(r=this.right)==null||r.remove(),this.moveTool.interrupt(),this.removeShiftMoveHelpLine(),!0}rotate(e=le.pcbConfig.rotate){if(!this.controlPointMove){let r=this.dimension.getParent();r!=null&&r.getGroupID()!=null?(this.commands=new De("select dimension"),this.moveTool.rotate(e)):(this.addHistory&&(this.commands=new De("select dimension"),this.commands.addCommand(Ce.dispatch(this.dimension,"modify")),this.addHistory=!1),$n.rotate(this.rotateCenter,e,[this.dimension]),this.flushPoint())}}};var Pue=class extends Cs{constructor(e){super();this.addHistory=!0;this.controlPointMove=!1;this.protractor=e,this.commands=new De("select dimension");let r=this.protractor.layerId;this.start=new Ui(r,e.start),this.end=new Ui(r,e.end),this.center=new Ui(r,e.center),this.text=new Ui(r,e.textPosition),this.moveTool=new Qc([this.protractor])}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;return this.controlPointMove=!1,this.mouseLeftDown=!0,this.text.isSelect(r,i)&&(this.controlPointMove=!0),this.center.isSelect(r,i)&&(this.controlPointMove=!0),this.start.isSelect(r,i)&&(this.controlPointMove=!0),this.end.isSelect(r,i)&&(this.controlPointMove=!0),this.addHistory=!0,this.controlPointMove}onMouseMove(e){if(this.protractor.locked)return!1;let r=this.shiftControl(e),i=this.lastPosition;if(this.addHistory&&(this.commands.addCommand(Ce.dispatch(this.protractor,"modify")),this.addHistory=!1),this.start.status())return this.start.setPosition(i),this.protractor.start=i,this.text.setPosition(this.protractor.textPosition),!0;if(this.end.status())return this.end.setPosition(i),this.protractor.end=i,this.text.setPosition(this.protractor.textPosition),!0;if(this.text.status())return this.text.setPosition(i),this.protractor.textPosition=i,!0;if(this.center.status())return this.center.setPosition(i),this.protractor.center=i,this.text.setPosition(this.protractor.textPosition),!0;let n=Ae.translate(r.x,r.y,0);return this.protractor.getGroupID()!=null?(this.commands=new De("select dimension"),this.moveTool.onMouseMove(e)):this.protractor.transform(n),this.flushPoint(),!0}flushPoint(){this.start.setPosition(this.protractor.start),this.end.setPosition(this.protractor.end),this.center.setPosition(this.protractor.center),this.text.setPosition(this.protractor.textPosition)}onMouseLeftUp(e){return this.commands.length>0&&(qe.executeCommand(this.commands),this.commands=new De("select 2dLine - arc")),this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),A.publish("flushService",""),A.publish("flushSelectingInfo",""),!0}interrupt(){var e;return(e=this.commands)==null||e.undo(),this.removeShiftMoveHelpLine(),this.start.remove(),this.end.remove(),this.center.remove(),this.text.remove(),this.moveTool.interrupt(),!0}rotate(e=le.pcbConfig.rotate){if(!this.controlPointMove){let r=this.protractor.getParent();if(r!=null&&r.getGroupID()!=null)this.commands=new De("select dimension"),this.moveTool.rotate(e);else{this.addHistory&&(this.commands=new De("select dimension"),this.commands.addCommand(Ce.dispatch(this.protractor,"modify")),this.addHistory=!1);let i=ys([this.protractor]);if(i.valid()){let s=i.build1().center();$n.rotate(s,e,[this.protractor]),this.flushPoint()}}}}};var Tue=class extends Cs{constructor(e){super();this.addHistory=!0;this.controlPointMove=!1;this.selectControlPointType=null;this.arc=null;this.radius=e,this.commands=new De("select radius");let r=this.radius.layerId;this.start=new Ui(r,this.radius.start),this.end=new Ui(r,this.radius.end),this.text=new Ui(r,this.radius.textPosition),this.moveTool=new Qc([this.radius])}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY,n=!1,s=null;return this.start.isSelect(r,i)&&(n=!0,s=0),this.end.isSelect(r,i)&&(n=!0,s=1),this.text.isSelect(r,i)&&(n=!0,s=2),this.updateLinkArcInfo(),this.controlPointMove=n,this.selectControlPointType=s,this.mouseLeftDown=!0,this.addHistory=!0,n}onMouseMove(e){if(this.radius.locked)return!1;let r=this.shiftControl(e),i=this.lastPosition;if(this.addHistory&&(this.commands.addCommand(Ce.dispatch(this.radius,"modify")),this.addHistory=!1),this.selectControlPointType===0){let s=Fee(this.radius.start,this.radius.end,i),a=new S(s.x,s.y);return this.radius.start=a,this.start.setPosition(a),this.text.setPosition(this.radius.textPosition),!0}if(this.selectControlPointType===2)return this.radius.textPosition=i,this.text.setPosition(this.radius.textPosition),!0;if(this.selectControlPointType===1){if(this.arc){let s=new S(e.sceneX,e.sceneY),a=s.sub(this.arc.center).normalize().mul(this.arc.radius).add(this.arc.center);if(this.arc.isSelect(a.x,a.y))if(a.distance1(s)>this.radius.getRadiusLength())this.radius.updateRadius(s,a);else{let c=s.sub(a).normalize().mul(this.radius.getRadiusLength()).add(a);this.radius.updateRadius(c,a)}else if(this.arc instanceof _t){let l=s.sub(this.arc.center).normalize(),c=this.arc.start.sub(this.arc.center),h=this.arc.end.sub(this.arc.center),u=c.dot(l),d=h.dot(l);u>d?a=this.arc.start:a=this.arc.end;let p=this.radius.start.sub(this.radius.end).length();if(s.distance1(this.arc.center)>this.arc.radius){let m=a.add(a.sub(this.arc.center).normalize().mul(p));this.radius.updateRadius(m,a)}else{let m=a.add(this.arc.center.sub(a).normalize().mul(p));this.radius.updateRadius(m,a)}}}else this.radius.layerId===4?this.radius.updateRadius(this.radius.start,i):this.radius.end=i;return this.flushPoint(),!0}let n=Ae.translate(r.x,r.y,0);return this.radius.getGroupID()!=null?(this.commands=new De("select radius"),this.flushPoint(),this.moveTool.onMouseMove(e)):(this.radius.transform(n),this.flushPoint()),!0}onMouseLeftUp(e){return this.commands.length>0&&(qe.executeCommand(this.commands),this.commands=new De("select radius"),A.publish("hasModifyPcbItem",this.radius)),this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.selectControlPointType=null,this.arc=null,this.removeShiftMoveHelpLine(),A.publish("flushService",""),A.publish("flushSelectingInfo",""),!0}flushPoint(){this.start.setPosition(this.radius.start),this.end.setPosition(this.radius.end),this.text.setPosition(this.radius.textPosition)}getLinkArc(e){let r=e.end,i=new ht(r.x,r.x,r.y,r.y),n=kt.search(i,(a,l)=>l=="ArcTrack"||l=="Arc"||l=="Circle"),s=null;for(let a of n.getArcs())if(a.isSelect(r.x,r.y)){s=a;break}return s}updateLinkArcInfo(){let e=this.getLinkArc(this.radius);return e?(this.arc=e,!0):(this.arc=null,!1)}rotate(e=le.pcbConfig.rotate){let r=this.radius.getParent();if(r!=null&&r.getGroupID()!=null)this.commands=new De("select radius"),this.moveTool.rotate(e);else{this.addHistory&&(this.commands=new De("select radius"),this.commands.addCommand(Ce.dispatch(this.radius,"modify")),this.addHistory=!1);let i=ys([this.radius]);if(i.valid()){let s=i.build1().center();$n.rotate(s,e,[this.radius])}}}interrupt(){var e;return(e=this.commands)==null||e.undo(),this.removeShiftMoveHelpLine(),this.start.remove(),this.end.remove(),this.text.remove(),this.moveTool.interrupt(),!0}};var Iue=class extends Cs{constructor(e){super();this.addHistory=!0;this.position=S.ORIGIN;this.firstMove=!0;this.text=e,this.command=new De("select Text"),this.moveTool=new Qc([this.text]),this.position=this.text.position}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;return this.text.isSelect(r,i)}onMouseMove(e){if(this.text.locked)return!1;this.addHistory&&(this.command.addCommand(Ce.dispatch(this.text,"modify")),this.addHistory=!1),this.firstMove&&(ze.highlightComponentWhenMoveText.add(this.text),this.firstMove=!1);let r=this.shiftControl(e);if(this.position=this.lastPosition,this.text.getGroupID()!=null)this.command=new De("select group text"),this.moveTool.onMouseMove(e);else{if(e.adsorbGrid){let n=this.text.position.add(r);n=ai.adsorpGrid(n),r=n.sub(this.text.position)}let i=Ae.translate(r.x,r.y,0);this.text.transform(i),this.text.updateHelpLine()}return!0}onMouseLeftUp(e){var r;return this.position=this.text.position,this.command.length>0&&(qe.executeCommand(this.command),this.command=new De("select text"),A.publish("hasModifyPcbItem",this.text)),ze.highlightComponentWhenMoveText.clear(),this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),A.publish("flushService",""),A.publish("flushSelectingInfo",""),this.text.globalIndex==((r=Yr.plainCode)==null?void 0:r.globalIndex)&&A.messageBus.publish("updateCode",Yr.getCurrentCodeInfo()),!0}rotate(e=le.pcbConfig.rotate){if(this.text.getGroupID()!=null)this.command=new De("select group text"),this.moveTool.rotate(e);else{this.addHistory&&(this.command=new De("select text"),this.command.addCommand(Ce.dispatch(this.text,"modify")),this.addHistory=!1);let r=ys([this.text]);if(r.valid()){let n=r.build1().center();$n.rotate(n,e,[this.text])}}}interrupt(){var e;return(e=this.command)==null||e.undo(),ze.highlightComponentWhenMoveText.clear(),this.moveTool.interrupt(),this.removeShiftMoveHelpLine(),!0}};var Nq=class extends Cs{constructor(e){super();this.events=[];this.tools=new Array;this.repair1=new Array;this.repair2=new Array;this.canDragStarts=[];this.canDragEnds=[];this.startArr=[];this.endArr=[];this.currentSelectIndex=null;this.SelectIndex=0;this.tool=null;e.forEach(r=>{let i=new CR(r);i.setMultiRepair(!0);let n=()=>r.layerId,s=this.addPoint(n,r.start),a=this.addPoint(n,r.end);this.events.push(i),this.startArr.push(s),this.endArr.push(a);let l=i.identify.canDrag(i.identify.startType),c=i.identify.canDrag(i.identify.endType);this.canDragStarts.push(l),this.canDragEnds.push(c)})}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;this.events.forEach(s=>{s.lastMousePosition=new S(e.sceneX,e.sceneY),s.lastRealMousePosition=new S(r,i)}),this.events.forEach((s,a)=>{this.startArr[a].isSelect(r,i)||this.endArr[a].isSelect(r,i)?s.isClickPoint=!0:s.isClickPoint=!1});let n=this.getCurrentIndex(e);if(this.currentSelectIndex!=null&&le.pcbConfig.clickTrackSelect=="whole"){let s=this.events[this.currentSelectIndex].track,a=jt.filterTrack(s,"whole"),l=!0;for(let c of this.events)if(a.indexOf(c.track)<0){l=!1;break}l&&(this.tool!=null&&(this.tool.interrupt(),this.tool=null),this.tool=new SG(s),this.tool.onMouseLeftDown(e))}return n!==null}getCurrentIndex(e){let r=e.realSceneX,i=e.realSceneY,n=null;return this.events.forEach((s,a)=>{s.track.isSelect(r,i)&&(n=a),this.startArr[a].isSelect(r,i)&&(n=a),this.endArr[a].isSelect(r,i)&&(n=a),this.events[a].addHistory=!0,this.events[a].track.isEmpty&&(n=null)}),this.currentSelectIndex=n==null?this.events.length-1:n,n}realTimeNetLength(){let e=this.events[0].track.net,r=re.getInstance().getNet(e);if(r!=null&&r.netLengthPhysics!=null){Ye.modifyNet(e);let i=Ye.getNetLength(e),n=[].concat(this.tools,this.repair1,this.repair2);for(let s of n){let a=s==null?0:s.getLengthIncrement();i=i+a}return i}return 0}realTimeDiffPairLengthErr(){let e=this.events[0].track.net,r=re.getInstance().getNet(e);if(r!=null&&r.netDifferential!=null){let i=r.netDifferential,n=i.positiveNet.name,s=i.negativeNet.name;Ye.modifyNet(n),Ye.modifyNet(s);let a=Ye.getNetLength(n),l=Ye.getNetLength(s),c=[0,0,0,0],h=[].concat(this.tools,this.repair1,this.repair2);for(let d of h){let p=this.getIncrement(d,n,s);c[0]+=p[0],c[1]+=p[1],d.event.track.net==n?c[2]+=p[2]:c[3]+=p[2]}return Zt.getInstance().mode=="WIRING_MODE_PUSHAWAY"?(a=a+c[0],l=l+c[1]):(a=a+c[2],l=l+c[3]),a-l}return 0}getIncrement(e,r,i){if(e!=null){let n=e.shoveEvent.getNetDelta(r),s=e.shoveEvent.getNetDelta(i),a=e.getLengthIncrement();return[n,s,a]}return[0,0,0]}onMouseMove(e){if(this.changeNativeCursor(5),this.tool!=null)return this.tool.onMouseMove(e),this.events.forEach((u,d)=>{this.startArr[d].hidden(),this.endArr[d].hidden()}),!0;let r=this.currentSelectIndex;this.events[r].adsorbtion=e.adsorbGrid;let i=this.startArr[r],n=this.endArr[r],s=e.sceneX,a=e.sceneY,l=new S(s,a);this.getAllCoCurrentTrack(this.events[r]);let c=i.status()&&this.canDragStarts[r],h=n.status()&&this.canDragEnds[r];if(c||h)return this.repairByControlPoint(e,c),!0;if(this.filterWholeTrack(r),this.move2Position(l,r),this.inSameNetDifferential())Ut.updateNetLengthMsg(e,{diffPairLength:this.realTimeDiffPairLengthErr(),netLength2:this.realTimeNetLength(),net:this.events[0].track.net});else if(this.tools.length===1)return Ut.updateNetLengthMsg(e,{diffPairLength:this.realTimeDiffPairLengthErr(),netLength:this.realTimeNetLength(),net:this.events[0].track.net}),!0;return!0}snapExtendedLine(e,r){if(!r.adsorb||!le.adsorptionConfig.getConfig("Extended Line"))return null;let i=e.track,n=new S(i.end.x,i.end.y),s=new S(r.realSceneX,r.realSceneY),a=new S(i.start.x,i.start.y),l=a.sub(n).angle(S.ORIGIN),{point:c}=ai.getExtendedLinePointInfo(s,n,a,l,r);return c}repairByControlPoint(e,r){let i=this.currentSelectIndex,n=this.events[i],s=!1,a=r?n.oldStart:n.oldEnd,l=new S(e.sceneX,e.sceneY),c=l.sub(a);u.call(this,n,i),this.events.forEach((d,p)=>{i!==p&&u.call(this,d,p)});let h=this.repair2.map(d=>d.event);this.events.forEach((d,p)=>{h.indexOf(d)>=0?(this.startArr[p].setPosition(d.track.start),this.endArr[p].setPosition(d.track.end)):(this.startArr[p].hidden(),this.endArr[p].hidden())});function u(d,p){if(!d.isCoSelect)return;let m=r;n.direct.dot(d.direct)<0&&(m=!r);let g=d.identify.startType,y=d.identify.startNodes[0],b=d.identify.startAngleType;if(m||(g=d.identify.endType,y=d.identify.endNodes[0],b=d.identify.endAngleType),[0,4,1].includes(g)){if(p===i&&this.snapExtendedLine(n,e)&&(l=new S(e.sceneX,e.sceneY),c=l.sub(a)),this.changleMouseStyle(this.getMouseStyle(d.oldEnd.sub(d.oldStart))),this.repair1[p]==null&&(this.repair1[p]=new p5(d)),p!==i&&s){let P=n.track,T=this.repair1[i].next,I=n.direct;if(I.dot(P.direct)>-1e-8||Math.abs(I.cross(P.direct))<1e-8){let C=r?I.mul(-1):I,E=r?P.end:P.start,O=r?P.start:P.end,_=[new M(E,O),new M(T.start,T.end)];if(this.repair1[p].moveByIntercept(_,T.end,C,m))return}}this.repair1[p].movePointOffset(c,m),p===i&&(s=!0)}else if(y instanceof Ge){let P=l;if(p!==i&&(P=(m?d.oldStart:d.oldEnd).add(c)),this.repair2[p]==null){let T=y;this.repair2[p]=new d5(d.track,T,b,d)}this.repair2[p].move(P)}}}move2Position(e,r){let i=new Array,n=e.sub(this.events[r].oldEnd),s=this.events[r].oldEnd;this.tools[this.SelectIndex].moveOffset(n);let a=this.events[r].track.end.sub(s);a.length()>0&&this.tools.forEach((h,u)=>{if(u!=this.SelectIndex){let d=h.event.oldEnd;h.moveOffset(a);let m=h.event.track.end.sub(d);i.push(m)}else i.push(a)});let l=Array.from(i);Er(i,(h,u)=>h.length()-u.length(),0,i.length);let c=new Set;l.forEach((h,u)=>{let d=this.tools[u];d.moveOffset(i[0]),c.add(d.event)}),this.events.forEach((h,u)=>{c.has(h)?(this.startArr[u].setPosition(h.track.start),this.endArr[u].setPosition(h.track.end)):(this.startArr[u].hidden(),this.endArr[u].hidden())})}inSameNetDifferential(){let e=this.events.reduce((i,n)=>i.add(n.track.net),new Set),r=Array.from(e);if(r.length==1||r.length==2){let i=r[0],n=re.getInstance().getNet(i);if(n!=null&&n.netDifferential!=null){if(r.length==1)return!0;let s=n.netDifferential;return r[1]==s.positiveNet.name||r[1]==s.negativeNet.name}}return!1}getAllCoCurrentTrack(e){let r=u=>u.direct,i=r(e),n=Ae.translate(-e.oldStart.x,-e.oldStart.y,0).rotateZ(-i.angle(S.ORIGIN)),s=e.oldEnd.multiply4(n),a=new ht(Math.min(0,s.x),Math.max(0,s.x),0,0),l=new Array;this.events.forEach((u,d)=>{let p=r(u);if(p.length()>0&&Math.abs(i.cross(p))<.001&&(u.isCoSelect=!0,u!=e)){let m=u.oldStart.multiply4(n),g=u.oldEnd.multiply4(n),y=new ht(Math.min(m.x,g.x),Math.max(m.x,g.x),0,0),b=a.intersection1(y);l.push({event:u,interBox:b})}}),Er(l,(u,d)=>u.interBox!=null&&d.interBox!=null?d.interBox.width()-u.interBox.width():u.interBox==null&&d.interBox!=null?d.interBox.width():u.interBox!=null&&d.interBox==null?-u.interBox.width():1,0,l.length);let c=new Set,h=new uf(e.track,!1);for(let u of h.all)u instanceof Ir&&c.add(u);for(let u of l){if(c.has(u.event.track)){u.event.isCoSelect=!1;continue}let d=new uf(u.event.track,!1);for(let p of d.all)p instanceof Ir&&c.add(p)}}onMouseUpMove(e){let r=e.sceneX,i=e.sceneY,n=this.getCurrentIndex(e);return this.selectPoint(r,i,n),!1}onMouseLeftUp(e){if(this.tool!=null)return this.tool.onMouseLeftUp(e);this.mouseLeftDown=!1;let r=[],i=[];this.tools.forEach(u=>{u.complete()}),this.repair2.forEach(u=>{u.complete()}),this.repair1.forEach(u=>{u.complete()});let n=new De("Multi repair line"),s=[],a,l=this.events.filter(u=>u.isCoSelect),c=this.events.filter(u=>!u.isCoSelect),h=this.currentSelectIndex;if(this.events[h].setMultiRepair(!0),this.events.forEach(u=>{if(u.isCoSelect){if(u.commands){for(let d of u.commands.commands)n.addCommand(d);u.commands=null}u.resultTrack?r.push(u.resultTrack):!u.track.isEmpty&&r.push(u.track)}else!u.track.isEmpty&&i.push(u.track)}),n.length>0&&qe.executeCommand(n),A.publish("clearSelect",""),l.length<2)l.length>0&&(this.events[h].isClickPoint?(i.forEach(u=>{u.click()}),A.publish("select",i)):(c.forEach(u=>{let d=this.events[h];a=d.oldStart.equals1(u.oldStart)||d.oldStart.equals1(u.oldEnd)||d.oldEnd.equals1(u.oldStart)||d.oldEnd.equals1(u.oldEnd),a||(u.track.click(),s.push(u.track))}),A.publish("select",s)));else{if(this.events[h].isClickPoint)r.push(...i),r.forEach(u=>{u.click()}),A.publish("select",r);else{let u=[];l.forEach(d=>{d.track.isEmpty||(d.track.click(),u.push(d.track))}),i.forEach(d=>{d.click()}),A.publish("select",[].concat(u,i))}r.forEach(u=>{u=null}),gr.model=0}return A.publish("flushService",""),this.removeShiftMoveHelpLine(),!0}interrupt(){return this.tool!=null&&(this.tool.interrupt(),this.tool=null),Ut.cancel(),this.events.forEach((e,r)=>{this.events[r].commands!=null&&this.events[r].commands.undo(),this.startArr[r].remove(),this.endArr[r].remove()}),this.tools.forEach(e=>{e!=null&&(e.interrupt(),e=null)}),this.repair2.forEach(e=>{e!=null&&(e.interrupt(),e=null)}),this.repair1.forEach(e=>{e!=null&&(e.interrupt(),e=null)}),this.changleMouseStyle("default"),this.removeShiftMoveHelpLine(),this.mouseLeftDown=!1,!0}addPoint(e,r){return new Ui(e(),r)}selectPoint(e,r,i){let n=this.currentSelectIndex;if(this.startArr[n].inTop(e,r)&&this.canDragStarts[n]){this.changleMouseStyle("pointer");return}if(this.endArr[n].inTop(e,r)&&this.canDragEnds[n]){this.changleMouseStyle("pointer");return}i!=null?this.changeNativeCursor(5):this.changleMouseStyle("default")}getMouseStyle(e){let r=Math.atan2(e.y,e.x);return r>=Math.PI/8*1&&r<Math.PI/8*3||r>=-(Math.PI/8)*7&&r<-(Math.PI/8)*5?"ne-resize":r>=Math.PI/8*3&&r<Math.PI/8*5||r>=-(Math.PI/8)*5&&r<-(Math.PI/8)*3?"n-resize":r>=Math.PI/8*5&&r<Math.PI/8*7||r>=-(Math.PI/8)*3&&r<-(Math.PI/8)*1?"nw-resize":"w-resize"}setSupportPushOrBlock(e){if(!this.events[e].isMultiRepair)return[this.events[e]];let r=jt.filterTrack(this.events[e].track,"whole"),i=this.events.slice(0);for(let n=0;n<i.length;n++){let s=i[n],a=r.findIndex(l=>s.track===l&&this.events[e].track!==s.track);a>=0&&(i.splice(n,1),r.splice(a,1),n--)}return i.length===1&&this.events[e].setMultiRepair(!1),i}filterWholeTrack(e){let r=this.setSupportPushOrBlock(e);this.tools.length==0&&r.forEach((i,n)=>{if(i.isCoSelect){let s=i.getTool();this.tools.push(s)}}),this.tools.forEach((i,n)=>{this.events[e].track===i.event.track&&(this.SelectIndex=n)})}};var xD=class{constructor(){this.repairLineBlockMax=100;this.blockNum=-1;this.map=new Map;this.wireResult=new Tg,this.command=new Lr}static isPush(){return Zt.getInstance().mode=="WIRING_MODE_PUSHAWAY"}static isBlock(){let t=Zt.getInstance();return t.mode=="WIRING_MODE_SURROUND_AND_PUSHAWAY"||t.mode=="WIRING_MODE_SURROUND"||t.mode=="WIRING_MODE_OBSTRUCT"}initClear(){Cr.getInstance().clear(),pa.getInstance().clear(),fs.getInstance().clear(),Mr.getInstance().clear()}addPathListByTool(t,e=!0){let i=t.getPathList();e&&t.shoveHandle(this.command);let n=t.generateTrackInfoByItem(i.getFirst(),i.getLast());this.map.set(n,t),this.wireResult.wireMap.set(n,i)}addDirect(t){this.wireResult.direct=t}generateDirect(t,e){let r=new S(-t.y,t.x),n=r.mul(e.dot(r)).normalize();return this.addDirect(n),n}shove(){if(this.wireResult.command=this.command,this.wireResult.wireMap.size<=0)return;let t=new km,e=Ys.getInstance();switch(e.pushVia){case"OPTIMIZA_OPEN":{t.canPushViaLevel=2;break}case"OPTIMIZA_NONE":{t.canPushViaLevel=0;break}}switch(e.pathOptimization4BePushed){case 1:{t.level="SUPER";break}case 0:{t.level="STRONG";break}case 2:{t.level="WEAK";break}}switch(e.currentPathOptimization4BePushed){case"OPTIMIZA_STRONG":{t.inputLevel="SUPER";break}case"OPTIMIZA_WEAK":{t.inputLevel="STRONG";break}case"OPTIMIZA_NONE":{t.inputLevel="WEAK";break}default:{t.inputLevel="NONE";break}}try{t.run(this.wireResult)}catch(i){throw new Error(i)}Mi.getInstance().view4Status(Cr.getInstance().current).commands.forEach(i=>{this.command.addCommand(i)}),this.wireResult.wireMap.forEach((i,n)=>{let s=this.map.get(n);s instanceof OS&&s.updatePointByPathList(i)}),Cr.getInstance().clear()}obstruct(t=!1){if(this.wireResult.command=this.command,this.wireResult.wireMap.size<=0)return;let e=new By;if(t)switch(Ys.getInstance().currentPathOptimization4BePushed){case"OPTIMIZA_STRONG":{e.level="SUPER";break}case"OPTIMIZA_WEAK":{e.level="STRONG";break}case"OPTIMIZA_NONE":{e.level="WEAK";break}default:{e.level="NONE";break}}try{e.run(this.wireResult)}catch(i){throw new Error(i)}Mi.getInstance().view4Status(Cr.getInstance().current).commands.forEach(i=>{this.command.addCommand(i)}),this.wireResult.wireMap.forEach((i,n)=>{let s=this.map.get(n);s instanceof OS&&s.updatePointByPathList(i)}),Cr.getInstance().clear()}obstruct2(t,e){if(wt.setPushFilter(),this.wireResult.wireMap.forEach(a=>{wt.pushFilter.addWaitList(a)}),oi.getInstance().update(),this.blockNum>this.repairLineBlockMax)return this.blockNum=-1,null;let r,i,n=new S(-t.y,t.x);return e.find(a=>{if(!a||!a.repairBlock)return!1;if(a.repairBlock.updateBlock(),a.repairBlock.isBlock())return!0})?(e.forEach(a=>{a.shoveHandle(this.command)}),this.obstruct(),null):(e.forEach(a=>{if(a&&a.repairBlock){let l=a.repairBlock.block();if(!l)return;let c=n.dot(l),h=n.mul(c);r?h.length()<r.length()&&(r=h,i=l):(r=h,i=l)}}),i?this.blockNum++:this.blockNum=-1,wt.setPushFilter(),i)}obstructEnd(t){t.forEach(e=>{if(e&&e.repairBlock){let r=e.repairBlock.block();if(!r)return;e.modifyPoint(r,e.moveStart)}})}undo(){this.command.undo(),this.command=new Lr,this.wireResult=new Tg,Mi.getInstance().view4Status(Cr.getInstance().current),Np.needclearWireCache=!1,this.initClear()}};var kq=class extends Cs{constructor(e,r=!1,i=!1){super();this.events=[];this.arcEvent=[];this.tools=new Array;this.repair1=new Array;this.repair2=new Array;this.canDragStarts=[];this.canDragEnds=[];this.startArr=[];this.endArr=[];this.currentSelectIndex=null;this.filter=!1;this.multiRepairLinePushTool=new xD;this.repairMultiLine=!1;this.initMove=!0;this.isClick=!1;this.allData=[];e.filter(s=>s instanceof Ir?!0:(this.arcEvent.push(new BI(s)),!1)).forEach(s=>{let a=new kh(s);a.setMultiRepair(!0);let l=()=>s.layerId,c=this.addPoint(l,s.start),h=this.addPoint(l,s.end);this.events.push(a),this.startArr.push(c),this.endArr.push(h);let u=a.identify.canDrag(a.identify.startType),d=a.identify.canDrag(a.identify.endType);this.canDragStarts.push(u),this.canDragEnds.push(d)}),i&&(this.allData=e),this.isClick=r}onMouseLeftDown(e){var a;let r=!1,i=e.realSceneX,n=e.realSceneY;if(this.events.forEach((l,c)=>{this.startArr[c].isSelect(i,n)||this.endArr[c].isSelect(i,n)?(l.isClickPoint=!0,r=!0):l.isClickPoint=!1}),r&&(this.moveTool=null),this.moveTool)return this.moveTool.onMouseLeftDown(e);if(this.events.forEach(l=>{l.lastMousePosition=new S(e.sceneX,e.sceneY),l.lastRealMousePosition=new S(i,n)}),Ut.getToleranceTargetNet((a=this.events[0])==null?void 0:a.track.net),this.filter)return!1;let s=this.getCurrentIndex(e);return!r&&this.allData.length>0&&s!==null?(this.moveTool=new Qc(this.allData),this.moveTool.onMouseLeftDown(e)):(this.moveTool=null,s!==null)}getCurrentIndex(e){let r=e.realSceneX,i=e.realSceneY,n=null;return this.events.forEach((s,a)=>{var l;(l=s.track)!=null&&l.isSelect(r,i)&&(n=a),this.startArr[a].isSelect(r,i)&&(n=a),this.endArr[a].isSelect(r,i)&&(n=a),this.events[a].track.isEmpty&&(n=null)}),this.currentSelectIndex=n==null?this.events.length-1:n,n}realTimeNetLength(){let e=this.events[0].track.net,r=re.getInstance().getNet(e);return r!=null&&r.netLengthPhysics!=null?(Ye.modifyNet(e),Jd.getNetLengthDelta(e)):0}realTimeDiffPairLengthErr(){let e=this.events[0].track.net,r=re.getInstance().getNet(e);if(r!=null&&r.netDifferential!=null){let i=r.netDifferential,n=i.positiveNet.name,s=i.negativeNet.name;Ye.modifyNet(n),Ye.modifyNet(s);let a=Jd.getNetLengthDelta(n),l=Jd.getNetLengthDelta(s);return{len_P:a,len_N:l}}return null}onMouseMove(e){if(this.moveTool){let d=this.moveTool.onMouseMove(e);return this.events.forEach((p,m)=>{let g=p.track;g.isEmpty?(this.startArr[m].hidden(),this.endArr[m].hidden()):(this.startArr[m].setPosition(g.start),this.endArr[m].setPosition(g.end))}),d}this.initMove&&(this.initMove=!1,wd.getInstance().highlight(this.events.map(d=>d.track))),this.changeNativeCursor(5);let r=this.currentSelectIndex,i=e.sceneX,n=e.sceneY,s=new S(i,n);this.getAllCoCurrentTrack(this.events[r],s),r=this.currentSelectIndex,this.events[r].adsorbtion=e.adsorbGrid;let a=this.startArr[r],l=this.endArr[r],c=a.status()&&this.canDragStarts[r],h=l.status()&&this.canDragEnds[r];c||h?this.repairByControlPoint(e,c):(this.filterWholeTrack(r),this.repairMultiLine?this.move2PositionMulti(s,r):this.move2Position(s,r));let u=this.events.filter(d=>d.isCoSelect);return this.inSameNetDifferential()?Ut.updateNetLengthMsg2(e,{diffPairLength:this.realTimeDiffPairLengthErr(),netLength2:this.realTimeNetLength(),net:this.events[0].track.net}):u.length===1&&Ut.updateNetLengthMsg2(e,{diffPairLength:this.realTimeDiffPairLengthErr(),netLength:this.realTimeNetLength(),net:this.events[0].track.net}),!0}snapExtendedLine(e,r){if(!r.adsorb||!le.adsorptionConfig.getConfig("Extended Line"))return null;let i=e,n=new S(i.end.x,i.end.y),s=new S(r.realSceneX,r.realSceneY),a=new S(i.start.x,i.start.y),l=a.sub(n).angle(S.ORIGIN),{point:c}=ai.getExtendedLinePointInfo(s,n,a,l,r);return c}repairByControlPoint(e,r){this.isMultiMode()&&this.multiRepairLinePushTool.undo();let i=this.currentSelectIndex,n=this.events[i],s=!1,a=r?n.oldStart:n.oldEnd,l=new S(e.sceneX,e.sceneY),c=l.sub(a),h;d.call(this,n,i),this.events.forEach((p,m)=>{i!==m&&d.call(this,p,m)}),this.isMultiMode()&&(this.repair1.forEach(p=>{p&&this.multiRepairLinePushTool.addPathListByTool(p)}),this.repair2.forEach(p=>{p&&this.multiRepairLinePushTool.addPathListByTool(p)}),this.isPush()?this.multiRepairLinePushTool.shove():(this.multiRepairLinePushTool.obstructEnd(this.repair1),this.repair2.length&&this.multiRepairLinePushTool.obstruct()));let u=this.repair2.map(p=>p.event);this.events.forEach((p,m)=>{u.indexOf(p)>=0?(this.startArr[m].setPosition(p.start),this.endArr[m].setPosition(p.end)):(this.startArr[m].hidden(),this.endArr[m].hidden())});function d(p,m){if(!p.isCoSelect)return;let g=r;n.direct.dot(p.direct)<0&&(g=!r);let y=p.identify.startType,b=p.identify.startNodes[0],P=p.identify.startAngleType;if(g||(y=p.identify.endType,b=p.identify.endNodes[0],P=p.identify.endAngleType),[0,4,1].includes(y)||p.needModifyRepair1(y,b)&&(m===i||s)){if(m===i){let T,I=p.adsorb(new S(e.realSceneX,e.realSceneY),n.track.width,n.track.layerId,!0);I?T=I:T=this.snapExtendedLine(n,e),T&&(l=new S(e.sceneX,e.sceneY),c=l.sub(a))}if(this.changleMouseStyle(this.getMouseStyle(p.oldEnd.sub(p.oldStart))),this.repair1[m]==null&&(this.repair1[m]=p.getRepairEndTool()),m!==i&&s){let T=this.repair1[i].next,I=n.direct,C=n.end.sub(n.start);if(I.dot(C)>-1e-8||Math.abs(I.cross(C))<1e-8){let E=r?I.mul(-1):I,O=r?n.end:n.start,_=r?n.start:n.end,x=[new M(O,_),new M(T.start(),T.end())];if(this.repair1[m].moveByIntercept(x,T.end(),E,g))return}}this.repair1[m].movePointOffset(c,g),m===i&&(s=!0)}else if(b instanceof Ge&&(m===i||!s)){let T=l;m!==i&&(T=(g?p.oldStart:p.oldEnd).add(c)),this.repair2[m]==null&&(this.repair2[m]=p.getLineTool(P,g)),this.repair2[m].move(T)}}}move2PositionMulti(e,r){this.isMultiMode()&&this.multiRepairLinePushTool.undo();let i=this.tools[r],n=this.events[r],s=n.direct,a=e.sub(n.lastMousePosition);if(a.length()){if(i.moveOffset(a),this.isMultiMode()){let l=this.multiRepairLinePushTool;this.isPush()?(l.addPathListByTool(i),l.generateDirect(s,a),l.shove()):(l.addPathListByTool(i,!1),l.obstruct(!1))}this.events.forEach((l,c)=>{this.startArr[c].hidden(),this.endArr[c].hidden()})}}move2Position(e,r){this.isMultiMode()&&this.multiRepairLinePushTool.undo();let i=new Array,n=e.sub(this.events[r].oldEnd),s=this.events[r].oldEnd,a=this.events[r].direct;this.tools[r].moveOffset(n);let l=this.events[r].end.sub(s);if(l.length()>0&&this.tools.forEach((h,u)=>{if(h)if(u!=r){let d=h.event.oldEnd;h.moveOffset(l);let m=h.event.end.sub(d);i.push(m)}else i.push(l)}),!i.length)return;Er(i,(h,u)=>h.length()-u.length(),0,i.length);let c=new Set;if(this.tools.forEach(h=>{h&&(h.moveOffset(i[0]),c.add(h.event))}),this.isMultiMode()){let h=this.multiRepairLinePushTool;if(this.isPush())this.tools.forEach(u=>{u&&h.addPathListByTool(u)}),h.generateDirect(a,i[0]),h.shove();else{this.tools.forEach(d=>{d&&h.addPathListByTool(d,!1)});let u=h.obstruct2(a,this.tools);for(;u;)this.tools.forEach(d=>{d&&d.moveOffset(u)}),u=h.obstruct2(a,this.tools)}}this.events.forEach((h,u)=>{c.has(h)?(this.startArr[u].setPosition(h.start),this.endArr[u].setPosition(h.end)):(this.startArr[u].hidden(),this.endArr[u].hidden())})}isMultiMode(){return Zt.getInstance().mode!="WIRING_MODE_IGNORE"}isPush(){return Zt.getInstance().mode=="WIRING_MODE_PUSHAWAY"}inSameNetDifferential(){let e=this.events.reduce((i,n)=>(n.isCoSelect&&i.add(n.track.net),i),new Set),r=Array.from(e);if(r.length==1||r.length==2){let i=r[0],n=re.getInstance().getNet(i);if(n!=null&&n.netDifferential!=null){if(r.length==1)return!0;let s=n.netDifferential;return r[1]==s.positiveNet.name||r[1]==s.negativeNet.name}}return!1}getAllCoCurrentTrack(e,r){if(this.filter)return;this.filter=!0;let i=u=>u.direct,n=i(e),s=Ae.translate(-e.oldStart.x,-e.oldStart.y,0).rotateZ(-n.angle(S.ORIGIN)),a=e.oldEnd.multiply4(s),l=new ht(Math.min(0,a.x),Math.max(0,a.x),0,0),c=new Array;this.events.forEach((u,d)=>{let p=i(u);if(p.length()>0&&Math.abs(n.cross(p))<.001&&(u.isCoSelect=!0,u!=e)){let m=u.oldStart.multiply4(s),g=u.oldEnd.multiply4(s),y=new ht(Math.min(m.x,g.x),Math.max(m.x,g.x),0,0),b=l.intersection1(y);c.push({event:u,interBox:b})}}),Er(c,(u,d)=>u.interBox!=null&&d.interBox!=null?d.interBox.width()-u.interBox.width():u.interBox==null&&d.interBox!=null?d.interBox.width():u.interBox!=null&&d.interBox==null?-u.interBox.width():1,0,c.length);let h=new Set;At.getInstance().getListNode(e.track.model).parent.getAllItems().map(u=>u.globalIndex).forEach(u=>{h.add(u)});for(let u of c){if(h.has(u.event.track.globalIndex)){u.event.isCoSelect=!1;continue}let d=At.getInstance().getListNode(u.event.track.model).parent.getAllItems();for(let p of d)p instanceof zr&&h.add(p.globalIndex)}this.sortEvents(r)}sortEvents(e){let r=this.events,i=[],n=[],s=new Map,a=0;for(let g of r)g.isCoSelect?i.push(g):n.push(g),s.set(g.track.globalIndex,a),a++;if(i.length<=1)return;let l=this.events[this.currentSelectIndex],c=l.lastRealMousePosition||l.track.start,h=e.sub(c),u=l.track.direct,d=this.generateDirect(u,h),p=this.sortItemsByEvent(i,d);this.events.length=0;let m=[];for(let g of p)g.event==l&&(this.currentSelectIndex=this.events.length),this.events.push(g.event),m.push(g.event.track.globalIndex);for(let g of n)this.events.push(g),m.push(g.track.globalIndex);this.updateData(s,m)}generateDirect(e,r){let i=new S(-e.y,e.x);return i.mul(r.dot(i)).normalize()}updateData(e,r){let i=this.startArr.length,n=new Array(i),s=new Array(i),a=new Array(i),l=new Array(i),c=0;for(let h of r){let u=e.get(h);n[c]=this.startArr[u],s[c]=this.endArr[u],a[c]=this.canDragStarts[u],l[c]=this.canDragEnds[u],c++}this.startArr=n,this.endArr=s,this.canDragStarts=a,this.canDragEnds=l}sortItemsByEvent(e,r){let n=e[0].track.start,s=[];for(let a of e)s.push({event:a,project:a.track.start.sub(n).dot(r)});return s.sort((a,l)=>a.project-l.project),s}onMouseUpMove(e){let r=e.sceneX,i=e.sceneY,n=this.getCurrentIndex(e);return this.selectPoint(r,i,n),!1}onMouseLeftUp(e){if(this.moveTool){let b=this.moveTool.onMouseLeftUp(e);return this.moveTool=null,b}if(!Mi.getInstance().checkTrackIsCanEdit())return this.interrupt(),!0;wd.getInstance().unhighlight(),this.initMove=!0,this.mouseLeftDown=!1;let i=[],n=[],s=!1;this.tools.forEach((b,P)=>{b&&(s=!0),b==null||b.complete()}),this.repair2.forEach((b,P)=>{b&&(s=!0),b==null||b.complete()}),this.repair1.forEach((b,P)=>{b&&(s=!0),b==null||b.complete()});let a=new De("Multi repair line"),l=[],c,h=this.events.filter(b=>b.isCoSelect),u=this.events.filter(b=>!b.isCoSelect),d=this.currentSelectIndex;this.events[d].setMultiRepair(!0);let p=[];if(this.events.forEach(b=>{b.isCoSelect?(b.complete(a),b.resultId&&p.push(b.resultId)):n.push(b.track.globalIndex)}),s){let b=kh.complete2(a);for(let P of p)b[P]&&i.push(b[P]);p.length=0,kh.clear()}a.length>0&&qe.executeCommand(a),A.publish("clearSelect","");let m=[],g=new Jt;n.forEach(b=>{let P=g.getItem(b);P&&m.push(P)});let y=[];if(i.forEach(b=>{let P=g.getItem(b);P&&y.push(P)}),h.length<2)h.length>0&&(this.events[d].isClickPoint?(m.forEach(b=>{b.click()}),A.publish("select",m)):(u.forEach(b=>{let P=this.events[d];c=P.oldStart.equals1(b.oldStart)||P.oldStart.equals1(b.oldEnd)||P.oldEnd.equals1(b.oldStart)||P.oldEnd.equals1(b.oldEnd),c||(b.track.click(),l.push(b.track))}),A.publish("select",l)));else{if(this.events[d].isClickPoint)y.push(...m),y.forEach(b=>{b.click()}),A.publish("select",y);else{let b=[];y.forEach(P=>{P.click(),b.push(P)}),m.forEach(P=>{P.click()}),A.publish("select",[].concat(b,m))}y.forEach(b=>{b=null}),gr.model=0}return A.publish("flushService",""),this.removeShiftMoveHelpLine(),!0}interrupt(){this.moveTool&&this.moveTool.interrupt(),this.moveTool=null,this.allData.length=0,Ut.cancel(),wd.getInstance().unhighlight(),this.initMove=!0,this.events.forEach((r,i)=>{this.events[i].commands!=null&&(this.events[i].commands.undo(),this.events[i].commands=null),this.startArr[i].remove(),this.endArr[i].remove(),r.interrupt()});let e=!1;return this.tools.forEach(r=>{r!=null&&(e=!0,r.interrupt(),r=null)}),this.repair2.forEach(r=>{r!=null&&(e=!0,r.interrupt(),r=null)}),this.repair1.forEach(r=>{r!=null&&(e=!0,r.interrupt(),r=null)}),e&&kh.clear(),this.changleMouseStyle("default"),this.removeShiftMoveHelpLine(),this.mouseLeftDown=!1,!0}addPoint(e,r){return new Ui(e(),r)}selectPoint(e,r,i){var s,a;let n=this.currentSelectIndex;if((s=this.startArr[n])!=null&&s.inTop(e,r)&&this.canDragStarts[n]){this.changleMouseStyle("pointer");return}if((a=this.endArr[n])!=null&&a.inTop(e,r)&&this.canDragEnds[n]){this.changleMouseStyle("pointer");return}i!=null?this.changeNativeCursor(5):this.changleMouseStyle("default")}getMouseStyle(e){let r=Math.atan2(e.y,e.x);return r>=Math.PI/8*1&&r<Math.PI/8*3||r>=-(Math.PI/8)*7&&r<-(Math.PI/8)*5?"ne-resize":r>=Math.PI/8*3&&r<Math.PI/8*5||r>=-(Math.PI/8)*5&&r<-(Math.PI/8)*3?"n-resize":r>=Math.PI/8*5&&r<Math.PI/8*7||r>=-(Math.PI/8)*3&&r<-(Math.PI/8)*1?"nw-resize":"w-resize"}setSupportPushOrBlock(e){if(!this.events[e].isMultiRepair)return[this.events[e]];let r=this.events;return r.length===1&&this.events[e].setMultiRepair(!1),r}filterWholeTrack(e){let r=this.setSupportPushOrBlock(e);if(this.tools.length==0){let i=r.filter(n=>n.isCoSelect);if(i.length==1&&r.length>1){let n=i[0];if(!this.isClick){let s=this.multiConnect(n,r);if(s){this.repairMultiLine=!0,r.forEach((a,l)=>{if(a.isCoSelect){a.setConnectTrack(s);let c=a.getMultiTool();this.tools[l]=c}});return}}}r.forEach((n,s)=>{if(n.isCoSelect){let a=n.getTool();this.tools[s]=a}})}}multiConnect(e,r){let i=r.map(h=>h.track.model),a=At.getInstance().getListNode(e.track.model).parent.getFirstNode(),l=!1,c=[];for(;a;){let h=a.item,u=i.includes(h);if(u&&(l=!0,c.push(h)),l&&!u)break;a=a.next}return c.length==i.length?c:null}};var f5=class f5{constructor(){this.initAction=new Array;this.isQR=null}static getInstance(){return f5.ins==null&&(f5.ins=new f5),f5.ins}addInitAction(t){return this.initAction.push(t)}addIsQR(t){this.isQR=t}init(){for(let t of this.initAction)t()}isQr(){var t;return((t=this.isQR)==null?void 0:t.call(this))||!1}};f5.ins=null;var TT=f5;var Cue=class extends Cs{constructor(e){super();this.addHistory=!0;this.controlPointMove=!1;this.selectIndex=NaN;this.curr=null;this.ratio=NaN;this.image=e,this.command=new De("select pcbImage");let r=this.image.layerId;this.width=this.image.width,this.height=this.image.height,this.oldWidth=this.image.width,this.oldHeight=this.image.height,this.ratio=this.oldWidth/this.oldHeight,this.rotation=this.image.rotation,this.mirror=this.image.mirror,this.matrix=Ae.rotateZ(-this.image.rotation),this.matrix1=Ae.rotateZ(this.image.rotation);let i=this.image.model.box;this.leftLow=new Ui(r,i.leftLow),this.rightLow=new Ui(r,i.rightLow),this.leftUp=new Ui(r,i.leftUp),this.rightUp=new Ui(r,i.rightUp),this.top=new Ui(r,i.rightUp.add(i.leftUp).mul(.5),!0),this.bottom=new Ui(r,i.leftLow.add(i.rightLow).mul(.5),!0),this.left=new Ui(r,i.leftLow.add(i.leftUp).mul(.5),!0),this.right=new Ui(r,i.rightUp.add(i.rightLow).mul(.5),!0),this.horizontalDirect=i.rightUp.sub(i.leftUp).normalize(),this.verticalDirect=i.leftLow.sub(i.leftUp).normalize(),this.moveTool=new Qc([this.image])}getNormal(e,r){let i=new S(-e.y,e.x),n=i.dot(r);return i.mul(n)}getSameDirect(e,r){let i=e.dot(r);return e.mul(i)}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY,n=NaN;return this.controlPointMove=!1,this.leftUp.isSelect(r,i)&&(this.controlPointMove=!0,n=0,this.curr=this.leftUp.getPosition()),this.rightUp.isSelect(r,i)&&(this.controlPointMove=!0,n=1,this.curr=this.rightUp.getPosition()),this.rightLow.isSelect(r,i)&&(this.controlPointMove=!0,n=2,this.curr=this.rightLow.getPosition()),this.leftLow.isSelect(r,i)&&(this.controlPointMove=!0,n=3,this.curr=this.leftLow.getPosition()),this.top.isSelect(r,i)&&(this.controlPointMove=!0,this.curr=this.top.getPosition()),this.bottom.isSelect(r,i)&&(this.controlPointMove=!0,this.curr=this.bottom.getPosition()),this.left.isSelect(r,i)&&(this.controlPointMove=!0,this.curr=this.left.getPosition()),this.right.isSelect(r,i)&&(this.controlPointMove=!0,this.curr=this.right.getPosition()),isNaN(n)||(this.selectIndex=n),this.mouseLeftDown=!0,this.addHistory=!0,this.controlPointMove?this.controlPointMove:this.image.isSelect(r,i)}getLimitValue(e){return ne.less(e,.01)?.01:e}onMouseMove(e){if(this.image.locked)return!1;this.addHistory&&(this.command.addCommand(Ce.dispatch(this.image,"modify")),this.addHistory=!1),R.getInstance().envFlag=="silk-preview"&&TT.getInstance().isQr()&&(this.leftUp.status()||this.leftLow.status()||this.left.status()||this.top.status()||this.right.status()||this.bottom.status()||this.rightUp.status()||this.rightLow.status())&&(e.shiftKey=!0);let i=this.shiftControl(e),n=this.lastPosition,s=this.getSameDirect(this.horizontalDirect,i),a=this.getSameDirect(this.verticalDirect,i),l=this.horizontalDirect.dot(s),c=this.verticalDirect.dot(a);if(e.shiftKey){if(this.proportionImage(i,e))return!0}else{let u,d,p;if(this.curr&&(p=n.sub(this.curr),u=p.dot(this.horizontalDirect),d=p.dot(this.verticalDirect)),this.leftLow.status()){this.width=this.oldWidth-u,this.height=this.oldHeight+d;let m=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(m=!m);let g=this.rotation,y=this.image.model.box.rightUp.add(this.horizontalDirect.mul(-this.width));return this.image.rotation=0,this.image.start=y,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=m&&(this.image.mirror=m),this.mirror!=m&&(g=Math.PI*2-this.rotation),this.height<0&&(g+=Math.PI),this.image.rotation=g,this.changePointRealTime(),!0}if(this.rightLow.status()){this.width=this.oldWidth+u,this.height=this.oldHeight+d;let m=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(m=!m);let g=this.rotation;return this.image.rotation=0,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=m&&(this.image.mirror=m),this.mirror!=m&&(g=Math.PI*2-this.rotation),this.height<0&&(g+=Math.PI),this.image.rotation=g,this.changePointRealTime(),this.rightLow.setPosition(n),!0}if(this.rightUp.status()){this.width=this.oldWidth+u,this.height=this.oldHeight-d;let m=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(m=!m);let g=this.rotation,y=this.image.model.box.leftLow.add(this.verticalDirect.mul(-this.height));return this.image.rotation=0,this.image.start=y,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=m&&(this.image.mirror=m),this.mirror!=m&&(g=Math.PI*2-this.rotation),this.height<0&&(g+=Math.PI),this.image.rotation=g,this.changePointRealTime(),!0}if(this.leftUp.status()){this.width=this.oldWidth-u,this.height=this.oldHeight-d;let m=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(m=!m);let g=this.rotation,y=this.image.model.box.rightLow.add(this.horizontalDirect.mul(-this.width)).add(this.verticalDirect.mul(-this.height));return this.image.rotation=0,this.image.start=y,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=m&&(this.image.mirror=m),this.mirror!=m&&(g=Math.PI*2-this.rotation),this.height<0&&(g+=Math.PI),this.image.rotation=g,this.changePointRealTime(),!0}if(this.top.status()){c<0?this.height+=a.length():c>0&&(this.height-=a.length());let m=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(m=!m);let g=this.rotation,y=this.image.start.add(a);return this.image.rotation=0,this.image.start=y,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=m&&(this.image.mirror=m),this.mirror!=m&&(g=Math.PI*2-this.rotation),this.height<0&&(g+=Math.PI),this.image.rotation=g,this.changePointRealTime(),!0}if(this.bottom.status()){c>0?this.height+=a.length():c<0&&(this.height-=a.length());let m=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(m=!m);let g=this.rotation;return this.image.rotation=0,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=m&&(this.image.mirror=m),this.mirror!=m&&(g=Math.PI*2-this.rotation),this.height<0&&(g+=Math.PI),this.image.rotation=g,this.changePointRealTime(),!0}if(this.right.status()){l>0?this.width+=s.length():l<0&&(this.width-=s.length());let m=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(m=!m);let g=this.rotation;return this.image.rotation=0,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=m&&(this.image.mirror=m),this.mirror!=m&&(g=Math.PI*2-this.rotation),this.height<0&&(g+=Math.PI),this.image.rotation=g,this.changePointRealTime(),!0}if(this.left.status()){l<0?this.width+=s.length():l>0&&(this.width-=s.length());let m=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(m=!m);let g=this.rotation,y=this.image.start.add(s);return this.image.rotation=0,this.image.start=y,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=m&&(this.image.mirror=m),this.mirror!=m&&(g=Math.PI*2-this.rotation),this.height<0&&(g+=Math.PI),this.image.rotation=g,this.changePointRealTime(),!0}}if(this.changeNativeCursor(5),this.image.getGroupID()!=null)this.command=new De("select group image"),this.moveTool.onMouseMove(e,i);else{if(e.adsorbGrid){let d=this.image.start.add(i);d=ai.adsorpGrid(d),i=d.sub(this.image.start)}let u=Ae.translate(i.x,i.y,0);this.image.transform(u)}let h=Ae.translate(i.x,i.y,0);return this.leftLow.transform(h),this.rightLow.transform(h),this.rightUp.transform(h),this.leftUp.transform(h),this.top.transform(h),this.bottom.transform(h),this.left.transform(h),this.right.transform(h),!0}onMouseLeftUp(e){var r,i;if(this.command.length>0&&(qe.executeCommand(this.command),this.command=new De("select image"),A.publish("hasModifyPcbItem",this.image)),this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),this.image.globalIndex==((r=Yr.QRCode)==null?void 0:r.globalIndex)){if(this.controlPointMove){let n=this.image.width,s=this.image.height;if(Yr.imgWidth=n,Yr.imgHeight=s,n=je(n,null,Yr.imgUnit),s=je(s,null,Yr.imgUnit),A.messageBus.publish("changeQRCodeSize",`${s}*${n}`),Yr.plainCode){let a=Yr.getTextPosition();a&&(Yr.plainCode.position=a)}}A.messageBus.publish("updateCode",Yr.getCurrentCodeInfo())}return this.image.globalIndex==((i=Bp.getInstance().image)==null?void 0:i.globalIndex)&&A.messageBus.publish("updateCode",Bp.getInstance().getCurrentULInfo()),A.publish("flushService",""),A.publish("flushSelectingInfo",""),!0}onMouseUpMove(e){let r=e.sceneX,i=e.sceneY;return this.selectPoint(r,i),!1}selectPoint(e,r){let i=oc(this.image.layerId,this.image.mirror),{leftLow:n,rightUp:s,rightLow:a,leftUp:l,top:c,bottom:h,left:u,right:d}=this,p=this.image.rotation;i&&(n=this.rightLow,u=this.right,l=this.rightUp,a=this.leftLow,d=this.left,s=this.leftUp,p=kr-p),n.inTop(e,r)||s.inTop(e,r)?this.changeNativeCursor1(2,p):a.inTop(e,r)||l.inTop(e,r)?this.changeNativeCursor1(3,p):c.inTop(e,r)||h.inTop(e,r)?this.changeNativeCursor1(0,p):u.inTop(e,r)||d.inTop(e,r)?this.changeNativeCursor1(1,p):this.image.isSelect(e,r)?this.changeNativeCursor(5):this.changeNativeCursor(4)}changePointRealTime(){let e=this.image.model.box;this.rightUp.setPosition(e.rightUp),this.leftUp.setPosition(e.leftUp),this.rightLow.setPosition(e.rightLow),this.leftLow.setPosition(e.leftLow),this.top.setPosition(e.rightUp.add(e.leftUp).mul(.5)),this.bottom.setPosition(e.leftLow.add(e.rightLow).mul(.5)),this.left.setPosition(e.leftLow.add(e.leftUp).mul(.5)),this.right.setPosition(e.rightUp.add(e.rightLow).mul(.5))}clearSelectIndex(){this.selectIndex=NaN}getLineModel(e,r){}rotate(e=le.pcbConfig.rotate){let r=this.image.getParent();if(r!=null&&r.getGroupID()!=null)this.command=new De("select image"),this.moveTool.rotate(e);else{this.addHistory&&(this.command=new De("select image"),this.command.addCommand(Ce.dispatch(this.image,"modify")),this.addHistory=!1);let i=ys([this.image]);if(i.valid()){let s=i.build1().center();$n.rotate(s,e,[this.image]),this.changePointRealTime()}}}proportionImage(e,r){let i=new S(r.sceneX,r.sceneY);if(this.leftLow.status()){this.changeNativeCursor1(2,this.image.rotation);let n=i.sub(this.curr),s=n.dot(this.horizontalDirect),a=n.dot(this.verticalDirect);if(s!=0&&Math.abs(s)>=Math.abs(a)?(a=(-s+this.oldWidth)/this.ratio-this.oldHeight,this.width=-s+this.oldWidth,this.height=(-s+this.oldWidth)/this.ratio):a!=0&&(s=(a+this.oldHeight)*this.ratio-this.oldWidth,this.width=(a+this.oldHeight)*this.ratio,this.height=a+this.oldHeight),R.getInstance().envFlag=="silk-preview"){let d=this.minMum();d&&(this.width<d.width&&(this.width=d.width),this.height<d.height&&(this.height=d.height))}let c=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(c=!c);let h=this.rotation,u=this.image.model.box.rightUp.add(this.horizontalDirect.mul(-this.width));return this.image.rotation=0,this.image.start=u,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=c&&(this.image.mirror=c),this.mirror!=c&&(h=Math.PI*2-this.rotation),this.height<0&&(h+=Math.PI),this.image.rotation=h,this.changePointRealTime(),!0}if(this.rightLow.status()){this.changeNativeCursor1(3,this.image.rotation);let n=i.sub(this.curr),s=n.dot(this.horizontalDirect),a=n.dot(this.verticalDirect);if(s!=0&&Math.abs(s)>=Math.abs(a)?(a=(s+this.oldWidth)/this.ratio-this.oldHeight,this.width=s+this.oldWidth,this.height=(s+this.oldWidth)/this.ratio):a!=0&&(s=(a+this.oldHeight)*this.ratio-this.oldWidth,this.width=(a+this.oldHeight)*this.ratio,this.height=a+this.oldHeight),R.getInstance().envFlag=="silk-preview"){let u=this.minMum();u&&(this.width<u.width&&(this.width=u.width),this.height<u.height&&(this.height=u.height))}let c=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(c=!c);let h=this.rotation;return this.image.rotation=0,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=c&&(this.image.mirror=c),this.mirror!=c&&(h=Math.PI*2-this.rotation),this.height<0&&(h+=Math.PI),this.image.rotation=h,this.changePointRealTime(),!0}if(this.rightUp.status()){this.changeNativeCursor1(2,this.image.rotation);let n=i.sub(this.curr),s=n.dot(this.horizontalDirect),a=n.dot(this.verticalDirect);if(s!=0&&Math.abs(s)>=Math.abs(a)?(a=(s+this.oldWidth)/this.ratio-this.oldHeight,this.width=s+this.oldWidth,this.height=(s+this.oldWidth)/this.ratio):a!=0&&(s=(-a+this.oldHeight)*this.ratio-this.oldWidth,this.width=(-a+this.oldHeight)*this.ratio,this.height=-a+this.oldHeight),R.getInstance().envFlag=="silk-preview"){let d=this.minMum();d&&(this.width<d.width&&(this.width=d.width),this.height<d.height&&(this.height=d.height))}let c=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(c=!c);let h=this.rotation,u=this.image.model.box.leftLow.add(this.verticalDirect.mul(-this.height));return this.image.rotation=0,this.image.start=u,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=c&&(this.image.mirror=c),this.mirror!=c&&(h=Math.PI*2-this.rotation),this.height<0&&(h+=Math.PI),this.image.rotation=h,this.changePointRealTime(),!0}if(this.leftUp.status()){this.changeNativeCursor1(3,this.image.rotation);let n=i.sub(this.curr),s=n.dot(this.horizontalDirect),a=n.dot(this.verticalDirect);if(s!=0&&Math.abs(s)>=Math.abs(a)?(a=(-s+this.oldWidth)/this.ratio-this.oldHeight,this.width=-s+this.oldWidth,this.height=(-s+this.oldWidth)/this.ratio):a!=0&&(s=(-a+this.oldHeight)*this.ratio-this.oldWidth,this.width=(-a+this.oldHeight)*this.ratio,this.height=-a+this.oldHeight),R.getInstance().envFlag=="silk-preview"){let d=this.minMum();d&&(this.width<d.width&&(this.width=d.width),this.height<d.height&&(this.height=d.height))}let c=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(c=!c);let h=this.rotation,u=this.image.model.box.rightLow.add(this.horizontalDirect.mul(-this.width)).add(this.verticalDirect.mul(-this.height));return this.image.rotation=0,this.image.start=u,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=c&&(this.image.mirror=c),this.mirror!=c&&(h=Math.PI*2-this.rotation),this.height<0&&(h+=Math.PI),this.image.rotation=h,this.changePointRealTime(),!0}if(this.top.status()){this.changeNativeCursor1(0,this.image.rotation);let s=i.sub(this.curr).dot(this.verticalDirect),a=this.mirror,l;if(s!=0&&(l=(-s+this.oldHeight)*this.ratio,this.width=Math.abs(l),this.height=-s+this.oldHeight),R.getInstance().envFlag=="silk-preview"){let d=this.minMum();d&&(l&&l<d.width&&(this.width=d.width),this.height<d.height&&(this.height=d.height))}(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(a=!a);let h=this.rotation,u=this.bottom.getPosition().add(this.verticalDirect.mul(-this.height)).add(this.horizontalDirect.mul(-(this.width/2)));return this.image.rotation=0,this.image.start=u,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=a&&(this.image.mirror=a),this.mirror!=a&&(h=Math.PI*2-this.rotation),this.height<0&&(h+=Math.PI),this.image.rotation=h,this.changePointRealTime(),!0}if(this.bottom.status()){this.changeNativeCursor1(0,this.image.rotation);let s=i.sub(this.curr).dot(this.verticalDirect),a;if(s!=0&&(a=(s+this.oldHeight)*this.ratio,this.width=Math.abs(a),this.height=s+this.oldHeight),R.getInstance().envFlag=="silk-preview"){let d=this.minMum();d&&(a&&a<d.width&&(this.width=d.width),this.height<d.height&&(this.height=d.height))}let c=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(c=!c);let h=this.rotation,u=this.top.getPosition().add(this.horizontalDirect.mul(-(this.width/2)));return this.image.rotation=0,this.image.start=u,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=c&&(this.image.mirror=c),this.mirror!=c&&(h=Math.PI*2-this.rotation),this.height<0&&(h+=Math.PI),this.image.rotation=h,this.changePointRealTime(),!0}if(this.right.status()){this.changeNativeCursor1(1,this.image.rotation);let s=i.sub(this.curr).dot(this.horizontalDirect),a;if(s!=0&&(this.width=s+this.oldWidth,a=(s+this.oldWidth)/this.ratio,this.height=Math.abs(a)),R.getInstance().envFlag=="silk-preview"){let d=this.minMum();d&&(this.width<d.width&&(this.width=d.width),a&&a<d.height&&(this.height=d.height))}let c=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(c=!c);let h=this.rotation,u=this.left.getPosition().add(this.verticalDirect.mul(-(this.height/2)));return this.image.rotation=0,this.image.start=u,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=c&&(this.image.mirror=c),this.mirror!=c&&(h=Math.PI*2-this.rotation),this.height<0&&(h+=Math.PI),this.image.rotation=h,this.changePointRealTime(),!0}if(this.left.status()){this.changeNativeCursor1(1,this.image.rotation);let s=i.sub(this.curr).dot(this.horizontalDirect),a;if(s!=0&&(this.width=-s+this.oldWidth,a=(-s+this.oldWidth)/this.ratio,this.height=Math.abs(a)),R.getInstance().envFlag=="silk-preview"){let d=this.minMum();d&&(this.width<d.width&&(this.width=d.width),a&&a<d.height&&(this.height=d.height))}let c=this.mirror;(this.width<0&&this.height>0||this.width>0&&this.height<0)&&(c=!c);let h=this.rotation,u=this.right.getPosition().add(this.verticalDirect.mul(-(this.height/2))).add(this.horizontalDirect.mul(-this.width));return this.image.rotation=0,this.image.start=u,this.image.width=this.getLimitValue(Math.abs(this.width)),this.image.modifyHeight(this.getLimitValue(Math.abs(this.height))),this.image.mirror!=c&&(this.image.mirror=c),this.mirror!=c&&(h=Math.PI*2-this.rotation),this.height<0&&(h+=Math.PI),this.image.rotation=h,this.changePointRealTime(),!0}return!1}minMum(){var i,n;let e,r;if(this.image.globalIndex==((i=Yr.QRCode)==null?void 0:i.globalIndex)&&(e=5,r=5),this.image.globalIndex==((n=Bp.getInstance().image)==null?void 0:n.globalIndex)&&(e=10,r=3),e&&r){let s=Bs.conversion("mm","mil",e)/10,a=Bs.conversion("mm","mil",r)/10;return{width:s,height:a}}else return null}interrupt(){return this.command.undo(),this.leftLow.remove(),this.rightLow.remove(),this.rightUp.remove(),this.leftUp.remove(),this.top.remove(),this.bottom.remove(),this.left.remove(),this.right.remove(),this.moveTool.interrupt(),this.changeNativeCursor(4),this.removeShiftMoveHelpLine(),!0}flushPoint(){this.changePointRealTime()}};var Sue=class extends Cs{constructor(e){super();this.addHistory=!0;this.circle=e,this.command=new De("select screw pillar"),this.moveTool=new Qc([this.circle])}onMouseLeftDown(e){return!1}onMouseMove(e){if(this.circle.locked)return!1;this.addHistory&&(this.command.addCommand(Ce.dispatch(this.circle,"modify")),this.addHistory=!1);let r=this.shiftControl(e);if(this.circle.getGroupID()!=null)this.command=new De("select screw pillar"),this.moveTool.onMouseMove(e);else{if(e.adsorbGrid){let n=this.circle.center.add(r);n=ai.adsorpGrid(n),r=n.sub(this.circle.center)}let i=Ae.translate(r.x,r.y,0);this.circle.transform(i)}return!0}onMouseLeftUp(e){return this.command.length>0&&(qe.executeCommand(this.command),this.command=new De("select screw pillar"),A.publish("hasModifyPcbItem",this.circle)),this.moveTool.onMouseLeftUp(e),this.mouseLeftDown=!1,this.removeShiftMoveHelpLine(),A.publish("flushService",""),A.publish("flushSelectingInfo",""),!0}rotate(e=le.pcbConfig.rotate){this.addHistory&&(this.command=new De("select screw pillar"),this.command.addCommand(Ce.dispatch(this.circle,"modify")),this.addHistory=!1);let r=ys([this.circle]);if(r.valid()){let n=r.build1().center();$n.rotate(n,e,[this.circle])}}interrupt(){var e;return(e=this.command)==null||e.undo(),this.moveTool.interrupt(),this.removeShiftMoveHelpLine(),!0}};var Eue=class extends Cs{constructor(t){super(),this.rect=t}onMouseLeftDown(t){return!0}onMouseMove(t){return!0}onMouseLeftUp(t){return!0}interrupt(){return!0}onDoubleClick(t){return!0}};function Lje(o){let t=ze.getSelects(),e=null;if(t.some(i=>{let n=i instanceof mt||i instanceof _t?i.getParent():i;return n.getGroupID()!=null&&(n instanceof Ge||n instanceof He)}))return e=new Qc(t),e;if(o==0){let i=t.every(n=>n instanceof Ge);if(t.length>1&&i)le.changeRepairLineTool?e=new kq(t,!0,!nOe(t)):(t=t.filter(n=>n instanceof Ir),t.length>1&&(e=new Nq(t)));else for(let n of t)if(!(n.getParent()!=null&&n instanceof He&&n.type=="Prohibited Region"||n.isEmpty))if(n instanceof Ir)le.changeRepairLineTool?e=new due(n):e=new SG(n);else if(n instanceof yi)le.changeRepairLineTool?e=new yue(n):e=new gue(n);else if(n instanceof qs)e=new bue(n);else if(n instanceof Ga)e=new Pue(n);else if(n instanceof Pr)e=n.type==="3D Shell - Screw Pillar"?new Sue(n):new ID(n);else if(n instanceof rr)n.type!=="Annotation"?e=new s_(n):e=new Eue(n);else if(n instanceof mt){let s=n.getParent();e=new V2(s,n)}else if(n instanceof _t){let s=n.getParent();s instanceof lt&&(s.onlyOneChilds()!=null?e=new o5(n):e=new V2(s,n))}else if(n instanceof lt){let s=n.onlyOneChilds();s instanceof _t?e=new o5(s):e=new V2(n)}else n instanceof ke?e=new TG(n):n instanceof da?e=new Tue(n):t.length==1&&n instanceof Le?we.smartMode?e=new oG(n):e=new yD(n):t.length===1&&n instanceof Ue?e=new IG(n):t.length===1&&n instanceof lr?e=new Iue(n):t.length===1&&n instanceof Dp?e=new Cue(n):t.length===1&&n instanceof hh&&we.smartMode&&(e=new sG(n))}if(t.length>1&&e==null){let i=[],n;t.every(a=>(n=a.model.modelType,n=="Ratline"?!0:n=="ArcTrack"||n=="Track"?(i.push(a),!0):!1))?le.changeRepairLineTool?e=new kq(i,ze.isClick,!nOe(i)):e=new Nq(i):e=new Qc(t)}return e}var Oue=class{constructor(){this._model=3;this.control=null;this.lockedLayers=new Set;this.mouseMoveCheck=!1;this.mouseAltDown=!1;this.hasAlt=!1}get model(){return this._model}set model(t){this._model=t,this.control!=null&&(On.getInstance().noControl=!0,this.control.interrupt(),this.control=null),t!=3&&this.autoControlPoint()}getControl(){return this.control}onMouseLeftDown(t){return we.smartMode&&_s.build()?!0:(this.mouseAltDown=t.altKey,this.control!=null?(On.getInstance().noControl=!1,this.mouseMoveCheck=!0,this.control.onMouseLeftDown(t)):!1)}onMouseMove(t){if(this.control!=null){if(this.mouseMoveCheck){this.mouseMoveCheck=!1;let{locked:i,hasItemInLockedLayer:n,items:s}=this.checkLockedItems();if(A.publish("clearDimension",""),n){let a=new e0("Certain layers of the dragged objects have been locked, do you want to unlock the corresponding layers?",()=>{let l=new Array;this.lockedLayers.forEach(c=>{let h=Pe.getLayer(+c);h.locked=!1,l.push({layerId:+c,locked:!1}),A0(+c)}),A.publish("layerStatus",l,Q())});return A.publish("openMsgbox",a),this.mouseMoveCheck=!0,!0}if(i){let a=ze.getLastClickPosition();if(s.length==1&&(this.control instanceof ID&&this.control.selectIndex>=0||this.control instanceof s_&&this.control.selectIndex>=0||this.control instanceof V2&&this.control.selectIndex[0]>=0))return Is.getInstance().init(s,"item locked, control point move",(c,h)=>{A.publish("toggle",{command:"MOVE_NODE",filterItems:c,inputInfo:a,commands:h.getCommand(),options:{locked:c[0].locked}})}),this.mouseMoveCheck=!0,!0;let l={command:"batchMoveItem",refer:new k2(s,a.x,a.y),menu:"MOVE_BY_REFERENCE_POINT",from:"move-lock"};return A.publish("toggle",l),this.mouseMoveCheck=!0,!0}}let r=!R.getInstance().isReadOnlyMode&&this.control.onMouseMove(t);return r&&(On.getInstance().noControl=!1),r}return!1}onMouseUpMove(t){return this.control!=null?!R.getInstance().isReadOnlyMode&&this.control.onMouseUpMove(t):we.smartMode?_s.move(t):!1}onMouseLeftUp(t){return this.mouseAltDown=!1,this.control!=null?this.control.onMouseLeftUp(t):(On.getInstance().noControl=!0,!1)}onMouseWheel(t){return this.control!=null&&t.leftDown&&(this.control instanceof TG||this.control instanceof IG||this.control instanceof yD)?!R.getInstance().isReadOnlyMode&&this.control.onMouseMove(t):!1}interrupt(){return this.control!=null?(this.mouseMoveCheck=!1,this.control.interrupt()):(On.getInstance().noControl=!0,!1)}onKeyDown(t){return this.control!=null?this.control.onKeyDown(t):!1}onMouseRightDown(t){return this.control!=null?this.control.onMouseRightDown(t):!1}onMouseRightUp(t){return this.control!=null?this.control.onMouseRightUp(t):!1}onDoubleClick(t){return this.control!=null?!R.getInstance().isReadOnlyMode&&this.control.onDoubleClick(t):!1}checkLockedItems(){let t=ze.getSelects(),e=this.control.moveTool,r=this.control.items||e&&e.items||t,i=Pe.getAllLayer().filter(l=>l.locked).map(l=>l.layerID),n=!1,s=i.length!=0,a=!1;if(this.lockedLayers=new Set,r){let l=new Ya(r).items;for(let c of l)if(!a&&c.locked&&(a=!0),!n&&s){let h=c instanceof Ue?12:c.layerId;i.includes(h)&&(n=!0,this.lockedLayers.add(h.toString()))}}return{locked:a,hasItemInLockedLayer:n,items:[...r]}}checkDragItemsIsPolygon(){let t=!1;if(!(this.control instanceof V2)&&!(this.control instanceof s_))return{dragIsPolygon:t,dragItems:[]};let e=this.control.moveTool,r=this.control.items||e&&e.items,i=this.control.moveStartPoint;return r&&i&&r.forEach(n=>{n instanceof mt||n instanceof _t||n instanceof lt?this.control.isControlPoint()&&(t=!0):n instanceof rr&&this.control.isControlPoint()&&(t=!0)}),t||(r=null),{dragIsPolygon:t,dragItems:r}}autoControlPoint(){this.control=Lje(this._model),this.control!=null&&!we.smartMode&&(this.control.onMouseLeftDown(fi.getInstance()),this.mouseMoveCheck=!0)}rotate(t){if(this.control!=null)return!R.getInstance().isReadOnlyMode&&this.control.rotate(t)}refresh(){this.model=this.model}};var Aue=class extends Ei{constructor(){super(...arguments);this.id=0;this.idMap=new Map;this.highLightNets=new Set;this.clickHighlightRatlines=new Set;this.hoverHighlightRatlines=new Set}addControllerCache(e){let r=this.map.get(e.net);r==null&&(r=new Array,this.map.set(e.net,r)),r.push(e),this.idMap.set(e.globalIndex,e),kt.insert(e)}addRatlineByModel(e){let r=new mn(e);return this.addControllerCache(r),r}add(e,r,i,n,s){let a="rat"+this.id++,l=UP.getInstance().add(a,e,r,i,n,s),c=new mn(l);return this.addControllerCache(c),c}getRatlineByNetName(e){return this.map.get(e)||[]}highlightByNets(e,r,i){var s;this.clearHighlight(r),(s=Pe.getLayer(57))!=null&&s.visible&&e.forEach(a=>{this.getRatlineByNetName(a).forEach(l=>{if(l.isVisible&&!l.isEmpty){if(r&&l.isHighLight)return;i?i(l,r):((r?this.hoverHighlightRatlines:this.clickHighlightRatlines).add(l),l.click(r))}})})}clearHighlight(e=!1){this.hoverHighlightRatlines.forEach(r=>{r.isVisible&&!r.isEmpty&&!this.clickHighlightRatlines.has(r)&&r.visible()}),this.hoverHighlightRatlines.clear(),e||(this.clickHighlightRatlines.forEach(r=>{r.isVisible&&!r.isEmpty&&r.visible()}),this.clickHighlightRatlines.clear())}getRatlineLengthByName(e){let r=this.getRatlineByNetName(e),i=0;return r.forEach(n=>i+=n.getLength()),i}getRatlineById(e){return this.idMap.get(e)}highlightNet(e){var n;let r=this.getAllNets();this.highLightNets.add(e);let i=(n=Pe.getLayer(57))==null?void 0:n.visible;r.forEach(s=>{s.forEach(a=>{a.isEmpty||(i&&this.highLightNets.has(a.net)?(a.visible(),a.color=ee.WHITE):this.bulkHiddenFilterNets||a.hidden())})})}highlightNets(e){var n;let r=this.getAllNets();xe.addAllSet(this.highLightNets,e);let i=(n=Pe.getLayer(57))==null?void 0:n.visible;r.forEach(s=>{s.forEach(a=>{a.isEmpty||(i&&this.highLightNets.has(a.net)?(a.visible(),a.color=ee.WHITE):this.bulkHiddenFilterNets||a.hidden())})})}unHighlightNet(e){this.highLightNets.delete(e),this.bulkHiddenFilterNets!=null&&this.bulkHiddenFilterNets.has(e)&&(this.bulkHiddenFilterNets.delete(e),this.bulkHiddenFilterNets.size==0&&(this.bulkHiddenFilterNets=null));let r=!1;for(let[i,n]of this.map){let s=re.getInstance().getNet(i),a=!1;this.bulkHiddenFilterNets!=null&&this.bulkHiddenFilterNets.has(i)?r=!0:r=!1,s?a=!0:a=!1,!r&&!va.useWebgl?Mo.attachViewGroup(n[0].viewGroupId,{visible:a}):n.forEach(l=>{l.isEmpty||(a&&s.showRatline?l.visible():l.hidden(),l.color=null)})}}clearHighlightNet(){this.highLightNets.clear()}removeNetRatlines(e){let r=this.map.get(e);if(r!=null)for(let n of r)n.sendDeleteMsg=!1,n.startNode.clearRatlines(),n.endNode.clearRatlines(),n.remove(),this.idMap.delete(n.globalIndex);UP.getInstance().delete(e);let i=kt.ratlineMap.get(e);i!=null&&i.recycle(),this.map.delete(e)}unHighlightAll(e){if(this.highLightNets.size>0)return;let r={};this.clearHighlight();let i=[];e?e.forEach(n=>{n instanceof Qo&&n.iteratorRatlines(s=>{i.push(s)})}):i=Object.values(Object.fromEntries(this.idMap.entries())),i.forEach(n=>{n.isEmpty?this.idMap.delete(n.globalIndex):(r[n.net]=r[n.net]||re.getInstance().getNet(n.net).showRatline,r[n.net]&&(n.isHighLight||!n.isVisible)&&n.visible())})}getAllNets(){let e=new Array(this.map.size),r=0;for(let i of this.map.values())e[r]=i,r++;return e}bulkUpdatesVisible(e,r){if(e)if(r!=null&&r.size>0&&this.bulkHiddenFilterNets!=null&&this.bulkHiddenFilterNets.size>0)for(let i of r)this.bulkHiddenFilterNets.delete(i);else delete this.bulkHiddenFilterNets;else this.bulkHiddenFilterNets=r||new Set;this.map.forEach((i,n)=>{if(!e&&(r!=null&&r.has(n.toString())))return;let s=e&&!(r!=null&&r.has(n.toString())),a=i[0];a&&Mo.attachViewGroup(a.viewGroupId,{visible:s})})}};var Bq=class{constructor(t){this.model=t}get name(){return this.model.name}set name(t){this.model.name=t}get showRatline(){return this.model.showRatline}set showRatline(t){this.model.showRatline=t;let e=Wo.getRatlineByNetName(this.model.name);this.model.showRatline?e.forEach(r=>{r.visible()}):e.forEach(r=>{r.hidden()}),A.publish("updateFrame","")}get netClass(){return this.model.netClass}set netClass(t){this.model.netClass=t}get netDifferentail(){return this.model.netDifferential}set netDifferentail(t){this.model.netDifferential=t}remove(){this.model.remove()}};var gi=re.getInstance(),Rg=class{constructor(){this.unitConversion=new dt}getDesignRulers(){return{Rule:this.getRulerManager(),Net:this.getNetClassELGroupsData(),NetDifferentails:this.getNetDifferentailData(),NetnetList:this.getBetweenNetList(),Region:this.getRegionData(),constraintRegion:this.getConstraintRegionData(),option:this.getOptions(),ruleTemplateName:gi.getRuleTemplateName()}}setDesignRulers(t){gi.defaultRuleMap.clear();let e=t.Rule,r=t.Net,i=t.NetDifferentails,n=t.NetnetList,s=t.Region,a=t.constraintRegion,l=t.RuleTemplateName;this.setRulerManager(e),this.setNetRuler(r),this.setDifferentailRuler(i),this.setEqualLengthGroupRuler(r),this.setBetweenNetList(n),this.setRegionRuler(s),this.setConstraintRegionRuler(a),this.setRuleTemplateName(l),re.getInstance().getMaxSafe(),A.publish("updateExpansion",""),A.publish("updateFrame",""),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),_re.clear()}setRulerManagerData(t){this.setRulerManager(t)}getOptions(){return Pe.getSignalLayerOptions()}getRulerManager(){return{Spacing:{"Safe Spacing":this.getSafeSpacingData(),"Other Spacing":this.getOtherSpacingData(),"Creepage Distance":this.getCreepageSpacingData()},Physics:{Track:this.getTrackData(),"Net Length Range":this.getNetLengthData(),"Net Length Tolerance":this.getNetLengthToleranceData(),"Differential Pair":this.getDifferentailData(),"Blind/Buried Via":this.getBlindData(),"Via Size":this.getRadiusData()},Plane:{"Plane Zone":this.getInnerData(),"Copper Zone":this.getCopperData()},Expansion:{"Solder Mask Expansion":this.getSolderData(),"Paste Mask Expansion":this.getPasteData()}}}setRulerManager(t){let e=t.Spacing["Safe Spacing"],r=t.Spacing["Other Spacing"],i=t.Spacing["Creepage Distance"],n=t.Physics.Track,s=t.Physics["Net Length Range"],a=t.Physics["Net Length Tolerance"],l=t.Physics["Differential Pair"],c=t.Physics["Blind/Buried Via"],h=t.Physics["Via Size"],u=t.Plane["Plane Zone"],d=t.Plane["Copper Zone"],p=t.Expansion["Solder Mask Expansion"],m=t.Expansion["Paste Mask Expansion"];this.setSafeSpacingData(e,d),this.setOtherSpacingData(r),this.setCreepageSpacingData(i),this.setTrackData(n),this.setNetLengthData(s),this.setNetLengthToleranceData(a),this.setDifferentailData(l),this.setBlindData(c),this.setRadiusData(h),this.setInnerData(u),this.setCopperData(d),this.setSolderData(p),this.setPasteData(m)}getNetRuler(){return this.getNetData()}getBetweenNetList(){let t=gi.betweenNetRule,e=[],r=[];for(let i of t.rule){if(i.ruleName!=null||i.safeCopperPlane!=null||i.safeInnerPlane!=null){let n=this.getBetweenNetDataItem(i);n&&e.push(n)}if(i.creepageRule){let n=this.getBetweenNetCreepageDataItem(i);n&&r.push(n)}}return{"Safe Spacing":e,"Creepage Distance":r}}setBetweenNetList(t){let e=this.getBetweenNets(t["Safe Spacing"]),r=this.getBetweenNetsForCreepage(t["Creepage Distance"]),i=new Map;for(let l of e){let c=`${l._net1Type}:${l._net1}|${l._net2Type}:${l._net2}`;i.set(c,{safeRule:l})}for(let l of r){let c=`${l._net1Type}:${l._net1}|${l._net2Type}:${l._net2}`,h=i.get(c);h?h.creepageRule=l:i.set(c,{creepageRule:l})}let n=gi.betweenNetRule,s=new Set;for(let l of n.rule){let c=`${l._net1Type}:${l._net1}|${l._net2Type}:${l._net2}`;s.add(c)}let a=[];for(let l of s)i.has(l)||a.push(l);for(let l of a){let[c,h]=l.split("|"),[u,d]=c.split(":"),[p,m]=h.split(":"),g=n.getRuleWithType(u,d,p,m);g&&(n.deleteRuleWithType(u,d,p,m),this.deleteBetweenRuleSelector(g.net1,g.net2))}for(let[l,c]of i.entries()){let[h,u]=l.split("|"),[d,p]=h.split(":"),[m,g]=u.split(":"),y=n.getRuleWithType(d,p,m,g);if(y)c.safeRule?(y.ruleName=c.safeRule.ruleName,y.safeCopperPlane=c.safeRule.safeCopperPlane,y.safeInnerPlane=c.safeRule.safeInnerPlane):(y.ruleName=null,y.safeCopperPlane=null,y.safeInnerPlane=null),c.creepageRule?y.creepageRule=c.creepageRule.creepageRule:y.creepageRule=null,R.getInstance().compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",y));else{let b=c.safeRule||c.creepageRule,P=new lg(b._net1Type,p,b._net2Type,g);c.safeRule&&(P.ruleName=c.safeRule.ruleName,P.safeCopperPlane=c.safeRule.safeCopperPlane,P.safeInnerPlane=c.safeRule.safeInnerPlane),c.creepageRule&&(P.creepageRule=c.creepageRule.creepageRule),n.addRule(P),R.getInstance().compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",P))}}}deleteBetweenRuleSelector(t,e){R.getInstance().compiler.deleteRuleSelector([this.getRuleSelect(t),this.getRuleSelect(e)])}getRuleSelect(t){return t instanceof $h?["NET_CLASS",t.name]:t instanceof dd?["EQ_LEN_GRP",t.name]:t instanceof zd?["NET",t.name]:[]}getNet(t,e){switch(t){case"net":return gi.getNet(e);case"netClass":return gi.getNetClass(e);case"equalLengthGroup":return gi.getEqualLengthGroup(e);default:return null}}getBetweenNetDataItem(t){let e=t.net1,r=t.net2;if(e==null||r==null)return null;let i={};return e instanceof $h?i.net1={type:"netClass",name:e.name}:e instanceof dd?i.net1={type:"equalLengthGroup",name:e.name}:e instanceof zd&&(i.net1={type:"net",name:e.name}),r instanceof $h?i.net2={type:"netClass",name:r.name}:r instanceof dd?i.net2={type:"equalLengthGroup",name:r.name}:r instanceof zd&&(i.net2={type:"net",name:r.name}),i.rule=t.ruleName,i.copperRuleName=t.safeCopperPlane,i.planeRuleName=t.safeInnerPlane,i}getBetweenNetCreepageDataItem(t){let e=t.net1,r=t.net2;if(e==null||r==null)return null;let i={};return e instanceof $h?i.net1={type:"netClass",name:e.name}:e instanceof dd?i.net1={type:"equalLengthGroup",name:e.name}:e instanceof zd&&(i.net1={type:"net",name:e.name}),r instanceof $h?i.net2={type:"netClass",name:r.name}:r instanceof dd?i.net2={type:"equalLengthGroup",name:r.name}:r instanceof zd&&(i.net2={type:"net",name:r.name}),i.rule=t.creepageRule,i}getBetweenNets(t){let e=new Array;for(let r of t){let i=r.net1,n=r.net2,s=r.rule,a=r.copperRuleName,l=r.planeRuleName,c=new lg(i.type,i.name,n.type,n.name);c.ruleName=s,c.safeCopperPlane=a,c.safeInnerPlane=l,e.push(c)}return e}getBetweenNetsForCreepage(t){let e=new Array;for(let r of t){let i=r.net1,n=r.net2,s=r.rule,a=new lg(i.type,i.name,n.type,n.name);a.creepageRule=s,e.push(a)}return e}setNetRuler(t){let e=gi.getAllNetClass();for(let r of t){let i=r.type;if(i==="netClass"){let n=this.setNetClassInfo(r);e.delete(n)}else i==="net"&&this.setNetInfo(r)}for(let r of e)gi.deleteNetClass(r.name),R.getInstance().compiler.deleteRuleSelector(["NET_CLASS",r.name])}setDifferentailRuler(t){let e=gi.getAllNetDifferentials();for(let r of t)if(r.type==="netDifferentail"){let n=this.setNetDifferentailInfo(r);e.delete(n)}for(let r of e)gi.deleteNetDifferential([r.name]),R.getInstance().compiler.deleteRuleSelector(["DIFF_PAIR",r.name])}setEqualLengthGroupRuler(t){let e=gi.getAllEqualLengthGroups();for(let r of t){let i=r.type;if(i==="equalLengthGroup"){let n=this.setEqualLengthGroupInfo(r);e.delete(n)}else if(i==="net"){let n=gi.getNet(r.name);n.equalLengthGroup==null&&(n.netLengthPhysics=r["Net Length Range"],n.netLengthTolerancePhysics=r["Net Length Tolerance"],R.getInstance().compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",n)))}}for(let r of e)gi.deleteEqualLengthGroup(r.name),R.getInstance().compiler.deleteRuleSelector(["EQ_LEN_GRP",r.name])}setRegionRuler(t){if(t==null)return;let e=gi.getAllCopperPlaneRegions();for(let r of t){let i=r.type,n=this.setRegionInfo(r);e.delete(n)}for(let r of e)gi.deleteRegion(r.name),R.getInstance().compiler.deleteRuleSelector(["REGION",r.name])}setConstraintRegionRuler(t){if(t==null)return;let e=gi.getAllConstraintRegions();for(let r of t){let i=this.setConstraintRegionInfo(r);e.delete(i)}for(let r of e)gi.deleteRegion(r.name),R.getInstance().compiler.deleteRuleSelector(["REGION",r.name])}setRuleTemplateName(t){t!=null&&(gi.setRuleTemplateName(t),R.getInstance().compiler.uploadRuleTemplate(Sr.getInstance().encode("RULE_TEMPLATE")))}getNetData(){let t=gi.getAllNetClass(),e=gi.getAllNets(),r=new Array;for(let i of t){let n=this.getNetClassInfo(i);r.push(n)}for(let i of e)i.netClass==null&&i.name&&r.push(this.getNetInfo(i));return r}getNetClassELGroupsData(){let t=gi.getAllNetClass(),e=gi.getAllEqualLengthGroups(),r=gi.getAllNets(),i=new Array;for(let n of t){let s=this.getNetClassInfo(n);i.push(s)}for(let n of e){let s=this.getEqualLengthGroupInfo(n);i.push(s)}for(let n of r)n.netClass==null&&n.equalLengthGroup==null&&n.name&&i.push(this.getNetInfo(n));return i}getRegionData(){let t=gi.getAllCopperPlaneRegions(),e=new Array;for(let r of t){let i=this.getRegionInfo(r);i&&e.push(i)}return e}getConstraintRegionData(){let t=gi.getAllConstraintRegions(),e=new Array;for(let r of t){let i=this.getConstraintRegionInfo(r);i&&e.push(i)}return e}getNetDifferentailData(){let t=gi.getAllNetDifferentials(),e=gi.getAllNets(),r=new Array;for(let i of t){let n=this.getNetDifferentailInfo(i);r.push(n)}for(let i of e)i.netDifferential==null&&i.name&&r.push(this.getNetInfo(i));return r}getEqualLengthGroupData(){let t=gi.getAllEqualLengthGroups(),e=gi.getAllNets(),r=new Array;for(let i of t){let n=this.getEqualLengthGroupInfo(i);r.push(n)}for(let i of e)i.equalLengthGroup==null&&i.name&&r.push(this.getNetInfo(i));return r}getNetClassInfo(t){let e=t.getAllNets(),r=new Array;for(let i of e)r.push(this.getNetInfo(i));return{type:"netClass",name:t.name,"Safe Spacing":t.safeSpacing,"Copper Safe Spacing":t.safeCopperPlane,"Plane Safe Spacing":t.safeInnerPlane,Track:t.trackPhysics,"Blind/Buried Via":t.blindViaPhysics,"Via Size":t.radiusPhysics,"Plane Zone":t.innerPlane,"Copper Zone":t.copperPlane,"Solder Mask Expansion":t.solderExpansion,"Paste Mask Expansion":t.pasteExpansion,"Net Length Range":t.netLengthPhysics,"Net Length Tolerance":t.netLengthTolerancePhysics,targetNet:t.targetNet,sub:r,"Creepage Distance":t.creepageSpacing}}setNetClassInfo(t){let e=t.name,r=t["Safe Spacing"],i=t["Copper Safe Spacing"],n=t["Plane Safe Spacing"],s=t.Track,a=t["Blind/Buried Via"],l=t["Via Size"],c=t["Plane Zone"],h=t["Copper Zone"],u=t["Solder Mask Expansion"],d=t["Paste Mask Expansion"],p=t["Net Length Range"],m=t["Net Length Tolerance"],g=t["Creepage Distance"],y=t.sub,b=gi.getNetClass(e);b==null&&(b=gi.addNetClass(e)),b.safeSpacing=r,b.safeCopperPlane=i,b.safeInnerPlane=n,b.trackPhysics=s,b.blindViaPhysics=a,b.radiusPhysics=l,b.innerPlane=c,b.copperPlane=h,b.solderExpansion=u,b.pasteExpansion=d,b.netLengthPhysics=p,b.netLengthTolerancePhysics=m,b.creepageSpacing=g,b.targetNet=t.targetNet,b.remove();for(let P of y){let T=P.name,I=gi.getNet(T);I!=null&&(I.safeSpacing=P["Safe Spacing"],I.safeCopperPlane=P["Copper Safe Spacing"],I.safeInnerPlane=P["Plane Safe Spacing"],I.trackPhysics=P.Track,I.blindViaPhysics=P["Blind/Buried Via"],I.radiusPhysics=P["Via Size"],I.innerPlane=P["Plane Zone"],I.copperPlane=P["Copper Zone"],I.solderExpansion=P["Solder Mask Expansion"],I.pasteExpansion=P["Paste Mask Expansion"],I.netLengthPhysics=P["Net Length Range"],I.netLengthTolerancePhysics=P["Net Length Tolerance"],I.targetNet=P.targetNet,I.creepageSpacing=P["Creepage Distance"]),b.addNetwork(I),R.getInstance().compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",I)),R.getInstance().compiler.uploadNet(T,Sr.getInstance().encode("NET",I))}return R.getInstance().compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",b)),b}getNetDifferentailInfo(t){let e=t.getAllNets(),r=new Array;for(let i of e)i.isPositiveNet?r.unshift({name:i.name,type:"net","Differential Pair":i.differentialPhysics}):r.push({name:i.name,type:"net","Differential Pair":i.differentialPhysics});return{type:"netDifferentail",name:t.name,"Differential Pair":t.differentialPhysics,sub:r}}setNetDifferentailInfo(t){let e=t.name,r=t["Differential Pair"],i=t.sub,n=gi.getNetDifferential(e);n==null&&(n=gi.addNetDifferential(e,i[0].name,i[1].name)),n.differentialPhysics=r,n.remove();for(let s=0;s<i.length;s++){let a=i[s].name,l=gi.getNet(a);l!=null&&(l.differentialPhysics=r),s==0?n.fillPositiveNet(l):n.fillNegativeNet(l),R.getInstance().compiler.uploadNet(a,Sr.getInstance().encode("NET",l)),R.getInstance().compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",l))}return R.getInstance().compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",n)),n}getEqualLengthGroupInfo(t){let e=t.getAllNets(),r=new Array;for(let i of e)r.push(this.getNetInfo(i));return{type:"equalLengthGroup",name:t.name,"Safe Spacing":t.safeSpacing,"Copper Safe Spacing":t.safeCopperPlane,"Plane Safe Spacing":t.safeInnerPlane,Track:t.trackPhysics,"Blind/Buried Via":t.blindViaPhysics,"Via Size":t.radiusPhysics,"Plane Zone":t.innerPlane,"Copper Zone":t.copperPlane,"Solder Mask Expansion":t.solderExpansion,"Paste Mask Expansion":t.pasteExpansion,"Net Length Range":t.netLengthPhysics,"Net Length Tolerance":t.netLengthTolerancePhysics,"Creepage Distance":t.creepageSpacing,targetNet:t.targetNet,sub:r}}setEqualLengthGroupInfo(t){let e=t.name,r=t["Safe Spacing"],i=t["Copper Safe Spacing"],n=t["Plane Safe Spacing"],s=t.Track,a=t["Blind/Buried Via"],l=t["Via Size"],c=t["Plane Zone"],h=t["Copper Zone"],u=t["Solder Mask Expansion"],d=t["Paste Mask Expansion"],p=t["Net Length Range"],m=t["Net Length Tolerance"],g=t["Creepage Distance"],y=t.sub,b=gi.getEqualLengthGroup(e);b==null&&(b=gi.addEqualLengthGroup(e)),b.safeSpacing=r,b.safeCopperPlane=i,b.safeInnerPlane=n,b.trackPhysics=s,b.blindViaPhysics=a,b.radiusPhysics=l,b.innerPlane=c,b.copperPlane=h,b.solderExpansion=u,b.pasteExpansion=d,b.netLengthPhysics=p,b.netLengthTolerancePhysics=m,b.creepageSpacing=g,b.targetNet=t.targetNet,b.remove();for(let P of y){let T=P.name,I=gi.getNet(T);I!=null&&(I.safeSpacing=P["Safe Spacing"],I.safeCopperPlane=P["Copper Safe Spacing"],I.safeInnerPlane=P["Plane Safe Spacing"],I.trackPhysics=P.Track,I.blindViaPhysics=P["Blind/Buried Via"],I.radiusPhysics=P["Via Size"],I.innerPlane=P["Plane Zone"],I.copperPlane=P["Copper Zone"],I.solderExpansion=P["Solder Mask Expansion"],I.pasteExpansion=P["Paste Mask Expansion"],I.netLengthPhysics=P["Net Length Range"],I.netLengthTolerancePhysics=P["Net Length Tolerance"],I.targetNet=P.targetNet,I.creepageSpacing=P["Creepage Distance"]),b.addEqualLengthGroup(I),R.getInstance().compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",I)),R.getInstance().compiler.uploadNet(T,Sr.getInstance().encode("NET",I)),R.getInstance().compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",I))}return R.getInstance().compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",b)),b}setNetInfo(t){let e=t.name,r=t["Safe Spacing"],i=t["Copper Safe Spacing"],n=t["Plane Safe Spacing"],s=t.Track,a=t["Net Length Range"],l=t["Net Length Tolerance"],c=t["Blind/Buried Via"],h=t["Via Size"],u=t["Plane Zone"],d=t["Copper Zone"],p=t["Solder Mask Expansion"],m=t["Paste Mask Expansion"],g=t["Creepage Distance"],y=gi.getNet(e);return y!=null&&(y.safeSpacing=r,y.safeCopperPlane=i,y.safeInnerPlane=n,y.trackPhysics=s,y.netLengthPhysics=a,y.netLengthTolerancePhysics=l,y.blindViaPhysics=c,y.radiusPhysics=h,y.innerPlane=u,y.copperPlane=d,y.solderExpansion=p,y.pasteExpansion=m,y.creepageSpacing=g),R.getInstance().compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",y)),R.getInstance().compiler.uploadNet(e,Sr.getInstance().encode("NET",y)),y}getNetInfo(t){return{type:"net",name:t.name,"Safe Spacing":t.safeSpacing,"Copper Safe Spacing":t.safeCopperPlane,"Plane Safe Spacing":t.safeInnerPlane,Track:t.trackPhysics,"Net Length Range":t.netLengthPhysics,"Net Length Tolerance":t.netLengthTolerancePhysics,"Blind/Buried Via":t.blindViaPhysics,"Via Size":t.radiusPhysics,"Plane Zone":t.innerPlane,"Copper Zone":t.copperPlane,"Solder Mask Expansion":t.solderExpansion,"Paste Mask Expansion":t.pasteExpansion,"Creepage Distance":t.creepageSpacing,targetNet:t.targetNet}}getRegionInfo(t){return{type:"region",name:t.name,"Plane Zone":t.innerPlane,"Copper Zone":t.copperPlane,"Safe Spacing":t.safeClearance,"Creepage Distance":t.creepageClearance}}getConstraintRegionInfo(t){let e=ch(t.name);if(e==null||e.type!=="Constraint Region")return null;let r=e.component;return{type:"region",name:e.globalIndex,constraintName:r.name,"Safe Spacing":t.safeClearance,"Copper Safe Spacing":t.safeCopperPlane,"Plane Safe Spacing":t.safeInnerPlane,"Other Spacing":t.otherClearance,Track:t.track,"Differential Pair":t.diff,"Via Size":t.radius,"Plane Zone":t.innerPlane,"Copper Zone":t.copperPlane,"Creepage Distance":t.creepageClearance}}setRegionInfo(t){let e=t.name,r=t["Plane Zone"];Array.from(gi.getAllInnerPlane()).some(d=>d.name==r)||(r="default");let n=t["Copper Zone"];Array.from(gi.getAllCopperPlane()).some(d=>d.name==n)||(n="default");let a=t["Safe Spacing"];Array.from(gi.getAllSafeSpacing()).some(d=>d.name==a)||(a="default");let c=t["Creepage Distance"];Array.from(gi.getAllCreepageSpacing()).some(d=>d.name==c)||(c="default");let u=gi.getRegion(e);return u!=null&&(u.innerPlane=r,u.copperPlane=n,u.safeClearance=a),R.getInstance().compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",u)),u}setConstraintRegionInfo(t){let e=gi.getRegion(t.name);if(e==null)return null;let r={safeClearance:t["Safe Spacing"],safeCopperPlane:t["Copper Safe Spacing"],safeInnerPlane:t["Plane Safe Spacing"],otherClearance:t["Other Spacing"],track:t.Track,diff:t["Differential Pair"],radius:t["Via Size"],innerPlane:t["Plane Zone"],copperPlane:t["Copper Zone"],creepageClearance:t["Creepage Distance"]};gi.updateRegionSelector(e.name,r);let n=ch(t.name).component;return n.name=t.constraintName,R.getInstance().compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",e)),e}getSafeSpacingData(){let t=gi.getAllSafeSpacing(),e={},r=(i,n)=>i.map(s=>s.map(a=>this.fromMil(n,a*10)));for(let i of t){let n={};n.editName=i.name,n.unit=i.unit,n.isSetDefault=i.isDefault,n.column=i.getRowLabel(),n.row=i.getColLabel(),n.status=i.status;let s=i.toJSON();n.tables={},s.forEach((a,l)=>{let c=r(a.table,i.unit);n.tables[l]={status:a.layerState,content:c}}),e[i.name]=n}return e}setSafeSpacingData(t,e){let r=this.ruleSet2Map(gi.getAllSafeSpacing()),i=Object.values(e).find(n=>n.isSetDefault);for(let n in t){let s=t[n],a=s.unit,l=s.isSetDefault,c=s.tables,h=c[1].content,u=s.status,d=gi.getSafeSpacing(n);if(h.length==8){s.row=["Track","SMD Pad","TH Pad","Via","Fill Region/Teardrop","Slot Region","Line","Text/Image","Board Outline","Hole"],s.column=["Track","SMD Pad","TH Pad","Via","Fill Region/Teardrop","Slot Region","Line","Text/Image","Board Outline"],h.splice(1,0,h[1].slice(0));for(let g=2;g<h.length;g++)h[g].splice(1,0,h[g][1]);h.push([].concat([h[1][0]],h.slice(1).map(g=>g[1])))}if(h.length==10){s.row=["Track","SMD Pad","TH Pad","SMD Test Point","TH Test Point","Via","Fill Region/Teardrop","Copper/Plane Zone","Slot Region","Line","Text/Image","Board Outline","Hole"],s.column=["Track","SMD Pad","TH Pad","SMD Test Point","TH Test Point","Via","Fill Region/Teardrop","Copper/Plane Zone","Slot Region","Line","Text/Image","Board Outline"],h.splice(3,0,[...h[1],h[2][1],h[1][1]],[...h[2],h[2][1],h[2][2]]);for(let g=5;g<h.length;g++)h[g].splice(3,0,h[g][1],h[g][2]);h.splice(7,0,Array(8).fill(i.form.networkSpacing));for(let g=8;g<h.length;g++)h[g].splice(7,0,i.form.networkSpacing);h[8][7]=i.form.distance2Border,h[11][7]=i.form.distance2Border}d==null&&(d=gi.addSafeSpacing(n)),r.delete(d.name),d.unit=a,d.isDefault=l,d.status=u;let p=new Map,m=new Map;for(let g in c){let y=c[g],b=y.content.map(P=>P.map(T=>{let I=T/10;return a!="mil"&&(I=this.unitConversion.conversion(a,"mil",I)),I}));p.set(+g,b),m.set(+g,y.status)}d.overWriteTables(new wa(p,m)),R.getInstance().compiler.uploadRule(Sr.getInstance().encode("RULE",d))}for(let[n]of r)gi.deleteSafeSpacing(n),R.getInstance().compiler.deleteRule(Nf("1"),n)}getOtherSpacingData(){let t=gi.getAllOtherSpacing(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault;let n=r.clearances,s=n[0]*10;s=this.fromMil(r.unit,s);let a=n[1]*10;a=this.fromMil(r.unit,a);let l=n[2]*10;l=this.fromMil(r.unit,l),i.form={device2device:s,thru2Smd:a,hole2Hole:l},e[r.name]=i}return e}setOtherSpacingData(t){let e=this.ruleSet2Map(gi.getAllOtherSpacing());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form.device2device/10;a=this.toMil(n,a);let l=i.form.thru2Smd/10||0;l=this.toMil(n,l);let c=i.form.hole2Hole!=null?i.form.hole2Hole/10:this.toMil(n,.3);c=this.toMil(n,c);let h=gi.getOtherSpacing(r);h==null&&(h=gi.addOtherSpacing(r)),e.delete(h.name),h.unit=n,h.isDefault=s,h.clearances=[a,l,c],R.getInstance().compiler.uploadRule(Sr.getInstance().encode("RULE",h))}for(let[r]of e)gi.deleteOtherSpacing(r),R.getInstance().compiler.deleteRule(Nf("2"),r)}getCreepageSpacingData(){let t=gi.getAllCreepageSpacing(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault;let s=r.creepageDistance*10;s=this.fromMil(r.unit,s);let a=r.ignoreLayer;i.form={creepageDistance:s,ignoreLayer:a},e[r.name]=i}return e}setCreepageSpacingData(t){let e=this.ruleSet2Map(gi.getAllCreepageSpacing());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form.creepageDistance/10,l=i.form.ignoreLayer;a=this.toMil(n,a);let c=gi.getCreepageSpacing(r);c==null&&(c=gi.addCreepageSpacing(r)),e.delete(c.name),c.unit=n,c.isDefault=s,c.creepageDistance=a,c.ignoreLayer=l,R.getInstance().compiler.uploadRule(Sr.getInstance().encode("RULE",c));for(let[h]of e)gi.deleteCreepageSpacing(h),R.getInstance().compiler.deleteRule(Nf("14"),h)}}fromMil(t,e){return t!="mil"&&(e=this.unitConversion.conversion("mil",t,e)),e}toMil(t,e){return t!="mil"&&(e=this.unitConversion.conversion(t,"mil",e)),e}getTrackData(){let t=gi.getAllTrackPhysics(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault,i.form={status:r.getLayerStatus(),data:{}};for(let[n,s]of r.toJSON())i.form.data[n]={minValue:this.fromMil(r.unit,s.minValue*10),defaultValue:this.fromMil(r.unit,s.defaultValue*10),maxValue:this.fromMil(r.unit,s.maxValue*10)};e[r.name]=i}return e}setTrackData(t){let e=this.ruleSet2Map(gi.getAllTrackPhysics());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form.data,l=i.form.status,c=gi.getTrackPhysics(r);c==null&&(c=gi.addTrackPhysics(r)),e.delete(c.name),c.unit=n,c.isDefault=s,c.setLayerStatus(l);let h=new Map;for(let u in a){let d=a[u];h.set(+u,{minValue:this.toMil(n,d.minValue/10),defaultValue:this.toMil(n,d.defaultValue/10),maxValue:this.toMil(n,d.maxValue/10)})}c.overWriteTables(new wa(h)),R.getInstance().compiler.uploadRule(Sr.getInstance().encode("RULE",c))}for(let[r]of e)gi.deleteTrackPhysics(r),R.getInstance().compiler.deleteRule(Nf("3"),r);A.publish("flushSelectingInfo","")}getNetLengthData(){let t=gi.getAllNetLengthPhysics(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault,i.form={netLengthMin:this.fromMil(r.unit,r.netLengthMin*10),netLengthMax:this.fromMil(r.unit,r.netLengthMax*10)},e[r.name]=i}return e}setNetLengthData(t){let e=this.ruleSet2Map(gi.getAllNetLengthPhysics());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form,l=a.netLengthMin/10,c=a.netLengthMax/10,h=gi.getNetLengthPhysics(r);h==null&&(h=gi.addNetLengthPhysics(r)),e.delete(h.name),h.unit=n,h.isDefault=s,h.netLengthMin=this.toMil(n,l),h.netLengthMax=this.toMil(n,c),R.getInstance().compiler.uploadRule(Sr.getInstance().encode("RULE",h))}for(let[r]of e)gi.deleteNetLengthPhysics(r),R.getInstance().compiler.deleteRule(Nf("11"),r);A.publish("netLengthRuleChanged","")}getNetLengthToleranceData(){let t=gi.getAllNetLengthTolerancePhysics(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault,i.form={netLengthTolerance:this.fromMil(r.unit,r.netLengthTolerance*10)},e[r.name]=i}return e}setNetLengthToleranceData(t){let e=this.ruleSet2Map(gi.getAllNetLengthTolerancePhysics());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,l=i.form.netLengthTolerance/10,c=gi.getNetLengthTolerancePhysics(r);c==null&&(c=gi.addNetLengthTolerancePhysics(r)),e.delete(c.name),c.unit=n,c.isDefault=s,c.netLengthTolerance=this.toMil(n,l),R.getInstance().compiler.uploadRule(Sr.getInstance().encode("RULE",c))}for(let[r]of e)gi.deleteNetLengthTolerancePhysics(r),R.getInstance().compiler.deleteRule(Nf("13"),r);A.publish("netLengthRuleChanged","")}getDifferentailData(){let t=gi.getAllDifferentialPhysics(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault,i.form={};let n=r.toJSON();for(let s in n){let a=n[s];i.form[s]={status:a.status,data:{}};for(let[l,c]of a.tables)i.form[s].data[l]={minValue:this.fromMil(r.unit,c.minValue*10),defaultValue:this.fromMil(r.unit,c.defaultValue*10),maxValue:c.maxValue==null?null:this.fromMil(r.unit,c.maxValue*10)}}i.form.differentailPairLenTolerMax=this.fromMil(r.unit,r.differentialPairLenTolerMax*10),e[r.name]=i}return e}setDifferentailData(t){let e=this.ruleSet2Map(gi.getAllDifferentialPhysics());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form,l=gi.getDifferentialPhysics(r);l==null&&(l=gi.addDifferentialPhysics(r)),e.delete(l.name),l.unit=n,l.isDefault=s;for(let[c,h]of[[1,"diffPairSpacingTables"],[0,"strokeWidthTables"]]){let u=new Map,d=a[h].data;l.setLayerStatus(c,a[h].status);for(let p in d){let m=d[p];u.set(+p,{minValue:this.toMil(n,m.minValue/10),defaultValue:this.toMil(n,m.defaultValue/10),maxValue:m.maxValue==null?null:this.toMil(n,m.maxValue/10)})}l.overWriteTables(c,new wa(u))}l.differentialPairLenTolerMax=this.toMil(n,a.differentailPairLenTolerMax/10),R.getInstance().compiler.uploadRule(Sr.getInstance().encode("RULE",l))}for(let[r]of e)gi.deleteDifferentialPhysics(r),R.getInstance().compiler.deleteRule(Nf("10"),r)}getBlindData(){let t=Ure(),e={};for(let r of t){let i={};i.editName=r.name,i.isSetDefault=r.isDefault,i.table=r.data,e[r.name]=i}return e}setBlindData(t){let e=this.batchModifyVias(t),r=this.ruleSet2Map(gi.getAllBlindPhysics());for(let i in t){let n=t[i],s=n.isSetDefault,a=n.table,l=gi.getBlindPhysics(i);l==null&&(l=gi.addBlindPhysics(i)),r.delete(l.name),l.isDefault=s,l.data=a,R.getInstance().compiler.uploadRule(Sr.getInstance().encode("RULE",l))}for(let[i]of r)gi.deleteBlindPhysics(i),R.getInstance().compiler.deleteRule(Nf("4"),i);Aje(),e&&A.publish("flushService","")}batchModifyVias(t){let e=new De("Synchronize Rule, Batch modify Vias"),r=Oje();for(let i in t){let s=t[i].table,a=gi.getBlindPhysics(i);if(a==null)continue;let l=r[i];if(l!=null)for(let c of s){let h=c.key,u=a.map.get(h);if(u==null)continue;let d=c.name,p=parseInt(c.startLayer),m=parseInt(c.endLayer),g=!1;u.name!=d&&(g=!0);let y=!1;u.startLayer==p&&u.endLayer==m||u.startLayer==m&&u.endLayer==p||(g=!0,y=!0);let b=l[u.name];if(b!=null&&g)for(let P of b)e.addCommand(Ce.dispatch(P,"modify")),P.name=d,y&&(P.viaBaseInfo=la.getViaBaseInfo(p,m,P.radius,P.holeRadius),A.publish("hasModifyPcbItem",P))}}if(e.length>0)return qe.executeCommand(e),!0}getRadiusData(){let t=gi.getAllRadiusPhysics(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault,i.form={viaOuterdiameterMin:this.fromMil(r.unit,r.minRadius*20),viaOuterdiameterMax:this.fromMil(r.unit,r.maxRadius*20),viaOuterdiameterDefault:this.fromMil(r.unit,r.defalutRadius*20),viaInnerdiameterMin:this.fromMil(r.unit,r.minInner*20),viaInnerdiameterMax:this.fromMil(r.unit,r.maxInner*20),viaInnerdiameterDefault:this.fromMil(r.unit,r.defalutInner*20)},e[r.name]=i}return e}setRadiusData(t){let e=this.ruleSet2Map(gi.getAllRadiusPhysics());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form,l=a.viaOuterdiameterMin/20,c=a.viaOuterdiameterMax/20,h=a.viaOuterdiameterDefault/20,u=a.viaInnerdiameterMin/20,d=a.viaInnerdiameterMax/20,p=a.viaInnerdiameterDefault/20,m=gi.getRadiusPhysics(r);m==null&&(m=gi.addRadiusPhysics(r)),e.delete(m.name),m.unit=n,m.isDefault=s,m.minRadius=this.toMil(n,l),m.maxRadius=this.toMil(n,c),m.defalutRadius=this.toMil(n,h),m.minInner=this.toMil(n,u),m.maxInner=this.toMil(n,d),m.defalutInner=this.toMil(n,p),R.getInstance().compiler.uploadRule(Sr.getInstance().encode("RULE",m))}for(let[r]of e)gi.deleteRadiusPhysics(r),R.getInstance().compiler.deleteRule(Nf("5"),r);A.publish("flushSelectingInfo","")}getInnerData(){let t=gi.getAllInnerPlane(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault,i.form={status:r.getLayerStatus(),data:{}};let n=r.toJSON();for(let[s,a]of n.tables)i.form.data[s]={connectMode:a.connectMode,lineClearance:this.fromMil(r.unit,a.lineClearance*10),lineWidth:this.fromMil(r.unit,a.lineWidth*10),lineAngle:ve(r.getMultiLineAngle(s)/Math.PI*180,3)};e[r.name]=i}return e}setInnerData(t){let e=this.ruleSet2Map(gi.getAllInnerPlane());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form.data,l=i.form.status,c=gi.getInnerPlane(r);c==null&&(c=gi.addInnerPlane(r)),e.delete(c.name),c.unit=n,c.isDefault=s,c.setLayerStatus(l);let h=new Map;for(let u in a){let d=a[u];h.set(+u,{connectMode:Number(d.connectMode),lineClearance:this.toMil(n,d.lineClearance/10),lineWidth:this.toMil(n,d.lineWidth/10),lineAngle:parseFloat(d.lineAngle)/180*Math.PI})}c.overWriteTables(new wa(h)),R.getInstance().compiler.uploadRule(Sr.getInstance().encode("RULE",c))}for(let[r]of e)gi.deleteInnerPlane(r),R.getInstance().compiler.deleteRule(Nf("6"),r)}getCopperData(){let t=gi.getAllCopperPlane(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault,i.form={};let n=r.toJSON();for(let s in n){let a=n[s];i.form[s]={status:a.status,data:{}};for(let[l,c]of a.tables)s!=="trackConnectModel"?i.form[s].data[l]={connectMode:c.connectMode,lineClearance:this.fromMil(r.unit,c.lineClearance*10),lineWidth:this.fromMil(r.unit,c.lineWidth*10),lineAngle:ve((s=="singleLayerPadModel"?r.getSingleLineAngle(l):r.getMultiLineAngle(l))/Math.PI*180,3)}:i.form[s].data[l]={trackConnectMode:c}}e[r.name]=i}return e}setCopperData(t){let e=this.ruleSet2Map(gi.getAllCopperPlane());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form,l=gi.getCopperPlane(r);l==null&&(l=gi.addCopperPlane(r)),e.delete(l.name),l.unit=n,l.isDefault=s;for(let[c,h]of[[0,"singleLayerPadModel"],[1,"multiLayerPadModel"],[2,"trackConnectModel"]]){let u=new Map,d=a[h].data;l.setLayerStatus(c,a[h].status);for(let p in d){let m=d[p];h!=="trackConnectModel"?u.set(+p,{connectMode:Number(m.connectMode),lineClearance:this.process(this.toMil(n,m.lineClearance/10)),lineWidth:this.process(this.toMil(n,m.lineWidth/10)),lineAngle:parseFloat(m.lineAngle)/180*Math.PI}):u.set(+p,Number(m.trackConnectMode))}l.overWriteTables(new wa(u),c)}R.getInstance().compiler.uploadRule(Sr.getInstance().encode("RULE",l))}for(let[r]of e)gi.deleteCopperPlane(r),R.getInstance().compiler.deleteRule(Nf("7"),r)}process(t){return t>=0?t:0}getSolderData(){let t=gi.getAllSolderExpansion(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault,i.form={padToplayerExpansion:this.fromMil(r.unit,r.padTopExpansion*10),padBottomlayerExpansion:this.fromMil(r.unit,r.padBottomExpansion*10),viaToplayerExpansion:this.fromMil(r.unit,r.viaTopExpansion*10),viaBottomlayerExpansion:this.fromMil(r.unit,r.viaBottomExpansion*10),testPointToplayerExpansion:this.fromMil(r.unit,r.testPointTopExpansion*10),testPointBottomlayerExpansion:this.fromMil(r.unit,r.testPointBottomExpansion*10)},e[r.name]=i}return e}setSolderData(t){let e=this.ruleSet2Map(gi.getAllSolderExpansion());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form,l=a.padToplayerExpansion/10,c=a.padBottomlayerExpansion/10,h=a.viaToplayerExpansion/10,u=a.viaBottomlayerExpansion/10,d=a.testPointToplayerExpansion/10,p=a.testPointBottomlayerExpansion/10,m=gi.getSolderExpansion(r);m==null&&(m=gi.addSolderExpansion(r)),e.delete(m.name),m.unit=n,m.isDefault=s,m.padTopExpansion=this.toMil(n,l),m.padBottomExpansion=this.toMil(n,c),m.viaTopExpansion=this.toMil(n,h),m.viaBottomExpansion=this.toMil(n,u),m.testPointTopExpansion=this.toMil(n,d),m.testPointBottomExpansion=this.toMil(n,p),R.getInstance().compiler.uploadRule(Sr.getInstance().encode("RULE",m))}for(let[r]of e)gi.deleteSolderExpansion(r),R.getInstance().compiler.deleteRule(Nf("9"),r)}getPasteData(){let t=gi.getAllPasteExpansion(),e={};for(let r of t){let i={};i.editName=r.name,i.unit=r.unit,i.isSetDefault=r.isDefault,i.form={padToplayerExpansion:this.fromMil(r.unit,r.padTopExpansion*10),padBottomlayerExpansion:this.fromMil(r.unit,r.padBottomExpansion*10),testPointToplayerExpansion:this.fromMil(r.unit,r.testPointTopExpansion*10),testPointBottomlayerExpansion:this.fromMil(r.unit,r.testPointBottomExpansion*10)},e[r.name]=i}return e}setPasteData(t){let e=this.ruleSet2Map(gi.getAllPasteExpansion());for(let r in t){let i=t[r],n=i.unit,s=i.isSetDefault,a=i.form,l=a.padToplayerExpansion/10,c=a.padBottomlayerExpansion/10,h=a.testPointToplayerExpansion/10,u=a.testPointBottomlayerExpansion/10,d=gi.getPasteExpansion(r);d==null&&(d=gi.addPasteExpansion(r)),e.delete(d.name),d.unit=n,d.isDefault=s,d.padTopExpansion=this.toMil(n,l),d.padBottomExpansion=this.toMil(n,c),d.testPointTopExpansion=this.toMil(n,h),d.testPointBottomExpansion=this.toMil(n,u),R.getInstance().compiler.uploadRule(Sr.getInstance().encode("RULE",d))}for(let[r]of e)gi.deletePasteExpansion(r),R.getInstance().compiler.deleteRule(Nf("8"),r)}ruleSet2Map(t){let e=new Map;for(let r of t)e.set(r.name,r);return e}};var _ue=class{async initRuleData(){let t=await A.windowBridge.rpcCall("getUsrPcbProcessConfigProfile","",Q());if(re.getInstance().deleteAll(),!t.message)return this.twoLayersBoard();let e=t.message.defaultPcbProcessConfigProfile,r=t.message.config.find(i=>i.name==e);try{if(r){new Rg().setRulerManagerData(r.config),re.getInstance().setRuleTemplateName(e);return}}catch{e=null}switch(e){case b2.TWO_LAYERS_BOARD:this.twoLayersBoard();break;case b2.SINGLE_LAYER_BOARD:this.singleLayerBoard();break;case b2.MULTIPLE_LAYERS_BOARD:this.multipleLayersBoard();break;case b2.HIGH_FREQUENCY_BOARD:this.highFrequencyBoard();break;case b2.ALUMINUM_SUBSTRATE_BOARD:this.aluminumSubstrateBoard();break;case b2.COPPER_SUBSTRATE_BOARD:this.copperSubstrateBoard();break;default:this.twoLayersBoard();break}}twoLayersBoard(){this.initSafeSpacing(),this.initOtherSpacing(),this.initTrackPhysics(),this.initDifferentailPhysics(),this.initNetLengthPhysics(),this.initNetLengthTolerancePhysics(),this.initBlindPhysics(),this.initRadiusPhysics(),this.initInnerPlane(),this.initCopperPlane(),this.initSolderExpansion(),this.initPasteExpansion(),re.getInstance().setRuleTemplateName(b2.TWO_LAYERS_BOARD)}singleLayerBoard(){this.initSafeSpacing(),this.initOtherSpacing(),this.initTrackPhysics1(),this.initDifferentailPhysics(),this.initNetLengthPhysics(),this.initNetLengthTolerancePhysics(),this.initBlindPhysics(),this.initRadiusPhysics1(),this.initInnerPlane(),this.initCopperPlane(),this.initSolderExpansion(),this.initPasteExpansion(),re.getInstance().setRuleTemplateName(b2.SINGLE_LAYER_BOARD)}multipleLayersBoard(){this.initSafeSpacing("multi"),this.initOtherSpacing(),this.initTrackPhysics1("multi"),this.initDifferentailPhysics(),this.initNetLengthPhysics(),this.initNetLengthTolerancePhysics(),this.initBlindPhysics(),this.initRadiusPhysics2(),this.initInnerPlane(),this.initCopperPlane(),this.initSolderExpansion(),this.initPasteExpansion(),re.getInstance().setRuleTemplateName(b2.MULTIPLE_LAYERS_BOARD)}highFrequencyBoard(){this.initSafeSpacing1(),this.initOtherSpacing(),this.initTrackPhysics2(),this.initDifferentailPhysics(),this.initNetLengthPhysics(),this.initNetLengthTolerancePhysics(),this.initBlindPhysics(),this.initRadiusPhysics3(),this.initInnerPlane(),this.initCopperPlane(),this.initSolderExpansion(),this.initPasteExpansion(),re.getInstance().setRuleTemplateName(b2.HIGH_FREQUENCY_BOARD)}aluminumSubstrateBoard(){this.initSafeSpacing1(),this.initOtherSpacing(),this.initTrackPhysics2(),this.initDifferentailPhysics(),this.initNetLengthPhysics(),this.initNetLengthTolerancePhysics(),this.initBlindPhysics(),this.initRadiusPhysics4(),this.initInnerPlane(),this.initCopperPlane(),this.initSolderExpansion(),this.initPasteExpansion(),re.getInstance().setRuleTemplateName(b2.ALUMINUM_SUBSTRATE_BOARD)}copperSubstrateBoard(){this.initSafeSpacing1(),this.initOtherSpacing(),this.initTrackPhysics2(),this.initDifferentailPhysics(),this.initNetLengthPhysics(),this.initNetLengthTolerancePhysics(),this.initBlindPhysics(),this.initRadiusPhysics4(),this.initInnerPlane(),this.initCopperPlane(),this.initSolderExpansion(),this.initPasteExpansion(),re.getInstance().setRuleTemplateName(b2.COPPER_SUBSTRATE_BOARD)}initSafeSpacing(t){let e=re.getInstance().addSafeSpacing("copperThickness1oz",!0);e.unit="mm",e.setData(vIe,kP);let r=re.getInstance().addSafeSpacing("copperThickness2oz");if(r.unit="mm",r.setData(eFe,kP),t=="multi"){let i=re.getInstance().addSafeSpacing("copperThicknessInner0.5oz");i.unit="mm",i.setData(tFe,kP)}}initSafeSpacing1(){let t=re.getInstance().addSafeSpacing("safeClearance",!0);t.unit="mm",t.setData(vIe,kP)}initOtherSpacing(){let t=re.getInstance().addOtherSpacing("otherClearance");t.isDefault=!0,t.unit="mm"}initTrackPhysics(){let t=re.getInstance().addTrackPhysics("copperThickness1oz",!0);t.setDefaultWidth(1),t.setMaxWidth(10),t.setMinWidth(.5),t.unit="mm";let e=re.getInstance().addTrackPhysics("copperThickness2oz");e.isDefault=!1,e.setDefaultWidth(1),e.setMaxWidth(10),e.setMinWidth(.79921),e.unit="mm"}initTrackPhysics1(t){let e=re.getInstance().addTrackPhysics("copperThickness1oz",!0);e.setDefaultWidth(1),e.setMaxWidth(10),e.setMinWidth(.40157),e.unit="mm";let r=re.getInstance().addTrackPhysics("copperThickness2oz");if(r.isDefault=!1,e.setDefaultWidth(1),e.setMaxWidth(10),e.setMinWidth(.79921),r.unit="mm",t=="multi"){let i=re.getInstance().addTrackPhysics("copperThickness0.5oz");i.isDefault=!1,e.setDefaultWidth(1),e.setMaxWidth(10),e.setMinWidth(.35039),i.unit="mm"}}initTrackPhysics2(){let t=re.getInstance().addTrackPhysics("trackWidth",!0);t.setDefaultWidth(1),t.setMaxWidth(10),t.setMinWidth(.40157),t.unit="mm"}initDifferentailPhysics(){let t=re.getInstance().addDifferentialPhysics("differentialPair",!0);t.differentialPairLenTolerMax=this.getData("mm",.254),t.setDifferentialPairSpacingDefault(this.getData("mm",.152)),t.setDifferentialPairSpacingMax(this.getData("mm",0)),t.setDifferentialPairSpacingMin(this.getData("mm",.152)),t.setStrokeWidthDefault(this.getData("mm",.254)),t.setStrokeWidthMax(this.getData("mm",2.54)),t.setStrokeWidthMin(this.getData("mm",.127)),t.unit="mm"}initNetLengthPhysics(){let t=re.getInstance().addNetLengthPhysics("netLength");t.isDefault=!0,t.unit="mm"}initNetLengthTolerancePhysics(){let t=re.getInstance().addNetLengthTolerancePhysics("netLengthTolerance");t.isDefault=!0,t.unit="mm"}initBlindPhysics(){let t=re.getInstance().addBlindPhysics("blindVia");t.isDefault=!0}initRadiusPhysics(){let t=re.getInstance().addRadiusPhysics("viaSize");t.isDefault=!0,t.defalutInner=.60039,t.maxInner=12.40157,t.minInner=.59055,t.defalutRadius=1.20079,t.maxRadius=19.68504,t.minRadius=.98425,t.unit="mm"}initRadiusPhysics1(){let t=re.getInstance().addRadiusPhysics("viaSize");t.isDefault=!0,t.defalutInner=.98425,t.maxInner=12.40157,t.minInner=.59055,t.defalutRadius=1.9685,t.maxRadius=19.68504,t.minRadius=.98425,t.unit="mm"}initRadiusPhysics2(){let t=re.getInstance().addRadiusPhysics("viaSize");t.isDefault=!0,t.defalutInner=.60039,t.maxInner=12.40157,t.minInner=.3937,t.defalutRadius=1.20079,t.maxRadius=19.68504,t.minRadius=.59055,t.unit="mm"}initRadiusPhysics3(){let t=re.getInstance().addRadiusPhysics("viaSize");t.isDefault=!0,t.defalutInner=.60039,t.maxInner=11.81102,t.minInner=.49213,t.defalutRadius=1.20079,t.maxRadius=19.68504,t.minRadius=.98425,t.unit="mm"}initRadiusPhysics4(){let t=re.getInstance().addRadiusPhysics("viaSize");t.isDefault=!0,t.defalutInner=1.9685,t.maxInner=11.81102,t.minInner=1.9685,t.defalutRadius=3.93701,t.maxRadius=19.68504,t.minRadius=1.9685,t.unit="mm"}initInnerPlane(){let t=re.getInstance().addInnerPlane("innerPlane",!0);t.setMultiConnectMode(0),t.setMultiLineClearance(this.getData("mm",.254)),t.setMultiLineWidth(this.getData("mm",.254)),t.setMultiLineAngle(Go),t.unit="mm"}initCopperPlane(){let t=re.getInstance().addCopperPlane("copperRegion",!0);t.setSingleConnectMode(0),t.setSingleLineClearance(this.getData("mm",.254)),t.setSingleLineWidth(this.getData("mm",.254)),t.setSingleLineAngle(Go),t.setMultiConnectMode(0),t.setMultiLineClearance(this.getData("mm",.254)),t.setMultiLineWidth(this.getData("mm",.254)),t.setMultiLineAngle(Go),t.unit="mm"}initSolderExpansion(){let t=re.getInstance().addSolderExpansion("solderMaskExpansion");t.isDefault=!0,t.padBottomExpansion=this.getData("mm",.051),t.padTopExpansion=this.getData("mm",.051),t.viaBottomExpansion=this.getData("mm",-25.4),t.viaTopExpansion=this.getData("mm",-25.4),t.unit="mm"}initPasteExpansion(){let t=re.getInstance().addPasteExpansion("pasteMaskExpansion");t.isDefault=!0,t.unit="mm"}getData(t,e){return t!="mil"&&(e=new dt().conversion1(t,"mil",e/10)),e}};var vue=class extends Ei{async initRuleManager(){await new _ue().initRuleData()}addNet(t){if(t==null)return null;let e=this.map.get(t);if(e==null){let r=re.getInstance().addNet(t);e=new Bq(r),this.map.set(t,e)}return e}addNetByModel(t){let e=t.name,r=this.map.get(e);return r==null?(r=new Bq(t),this.map.set(e,r)):r.model=t,r}getNet(t){return this.map.get(t)}deleteNet(t){re.getInstance().deleteNet(t);let e=this.map.get(t);e&&(re.getInstance().betweenNetRule.deltetRule4Net(e.model),e!=null&&e.remove(),this.map.delete(t))}};var RD=class extends hy{constructor(t){super(),this.model=t,this.initRefreshRender()}getType(){return 18}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId=t,this.refreshRender()}get start(){return this.model.start}set start(t){this.model.start=t,this.refreshRender()}get end(){return this.model.end}set end(t){this.model.end=t,this.refreshRender()}get text(){return this.model.text}set text(t){this.model.text=t,this.refreshRender()}get textWidth(){return this.model.textWidth}set textWidth(t){this.model.textWidth=t,this.refreshRender()}buildBBox(){return this.model.bbox}isSelect(t,e){return this.model.inShape(t,e)}get isVisible(){return this._parent.isVisible}set isVisible(t){this.isVisible!=t&&(this.setDataState(0,t),this.refreshRender())}get locked(){return!1}set locked(t){throw new Error("Method not implemented.")}visible(t=!1){super.visible(t),this.unHighLight()}transform(t){throw new Error("Method not implemented.")}rotateFor(t,e){throw new Error("Method not implemented.")}injectedBBox(t){this.model.injectedBBox(t)}};function xue(){let o=le.pcbConfig.drcErrorZoom==="keepConstantSize",t=i=>$S.mm2mil(i)/10,e={arrowWidth:3,arrowHeight:6,arrowLineLength:7.5,arrowLineWidth:1.5,arrowHeightMaxPxLimit:30,arrowHeightMinPxLimit:12},r={arrowWidth:t(.2),arrowHeight:t(.4),arrowLineLength:t(.5),arrowLineWidth:t(.1),arrowHeightMaxPxLimit:0,arrowHeightMinPxLimit:0};return o?e:r}var Fq=class Fq{setupDrcArrowStyle(){var e,r;if(Fq.arrowStyleInitialized)return;let t=(e=cn.getInstance())==null?void 0:e.getLayer(1001);if(!((r=t==null?void 0:t.layer)!=null&&r.plane)){console.warn("StyleConfigProxy: Failed to get layer 1001");return}try{let i=xue();t.layer.plane.scene.setDrcArrowPtStyle(ee.of3("#FECC00"),i.arrowWidth,i.arrowHeight,i.arrowLineLength,i.arrowLineWidth,i.arrowHeightMaxPxLimit,i.arrowHeightMinPxLimit),Fq.arrowStyleInitialized=!0}catch(i){console.error("StyleConfigProxy: Failed to set DRC arrow style:",i)}}};Fq.arrowStyleInitialized=!1;var EG=Fq;function aOe(o,t,e,r){let i=r.sub(t),n=e.sub(t),s=o.sub(t),a=i.dot(i),l=i.dot(n),c=i.dot(s),h=n.dot(n),u=n.dot(s),d=1/(a*h-l*l),p=(h*c-l*u)*d,m=(a*u-l*c)*d;return p>=0&&m>=0&&p+m<1}var Rue=class extends e3{constructor(e,r,i,n,s,a=1001){super();this.modelType="DrcComponentSpacing";this.startArrowPoints=null;this.endArrowPoints=null;this.lineWidth=0;this.globalIndex=e,this._start=r,this._end=i,this._text=n,this._textWidth=s,this._layerId=a,this.updateBox()}get layerId(){return this._layerId}set layerId(e){this._layerId!==e&&(this._layerId=e,this.layerModified=!0)}get start(){return this._start}set start(e){this._start.equals(e)||(this._start=e,this.updateBox())}get end(){return this._end}set end(e){this._end.equals(e)||(this._end=e,this.updateBox())}get text(){return this._text}set text(e){this._text!==e&&(this._text=e)}get textWidth(){return this._textWidth}set textWidth(e){this._textWidth!==e&&(this._textWidth=e,this.updateBox())}updateBox(){return this._bbox||new ht(0,0,0,0)}getScaledValueWithLimits(e,r,i){let n=Ai().getScale();if(!(le.pcbConfig.drcErrorZoom==="keepConstantSize"))return e;let a=Math.abs(e)*n;return i>0&&a>i?i/n:r>0&&a<r?0:e}calcArrowGeometries(){let e=xue(),r=this.getScaledValueWithLimits(e.arrowHeight,e.arrowHeightMinPxLimit,e.arrowHeightMaxPxLimit),i=e.arrowHeightMinPxLimit/e.arrowHeight,n=e.arrowHeightMaxPxLimit/e.arrowHeight,s=this.getScaledValueWithLimits(e.arrowLineLength,e.arrowLineLength*i,e.arrowLineLength*n);this.lineWidth=this.getScaledValueWithLimits(e.arrowLineWidth,e.arrowLineWidth*i,e.arrowLineWidth*n);let a=r/2,l=this.end.sub(this.start),c=Math.atan2(l.y,l.x),h=new S(this.start.x+a*Math.cos(c),this.start.y+a*Math.sin(c)),u=new S(this.end.x+a*Math.cos(c+Math.PI),this.end.y+a*Math.sin(c+Math.PI));this.startArrowPoints=a>0?this.getArrowPoints(this.start,h,c,a):null,this.endArrowPoints=a>0?this.getArrowPoints(this.end,u,c+Math.PI,a):null,this.startLineSegment={start:h,end:h.add(l.normalize().mul(s))},this.endLineSegment={start:u,end:u.add(l.normalize().mul(-s))}}getArrowPoints(e,r,i,n){let s=new S(Math.cos(i+Math.PI/2),Math.sin(i+Math.PI/2)).mul(n),a=new S(Math.cos(i-Math.PI/2),Math.sin(i-Math.PI/2)).mul(n);return[e,r.add(s),r.add(a)]}getVirtualBBoxes(){let e=xue(),r=this.end.sub(this.start),i=Math.atan2(r.y,r.x);return this.injectedBBoxes.map((n,s)=>s===0?Zv(n,e.arrowHeightMinPxLimit,e.arrowHeightMaxPxLimit,this.start):s===1?Zv(n,e.arrowHeightMinPxLimit,e.arrowHeightMaxPxLimit,this.end):Zv(n,e.arrowHeightMinPxLimit,e.arrowHeightMaxPxLimit))}inShape(e,r){this.calcArrowGeometries();let i=this.startArrowPoints===null&&this.endArrowPoints===null,n=this.lineWidth===0;if(i&&n)return!1;let s=new S(e,r),[a,l,c]=this.getVirtualBBoxes();return!!(c.isContains(s)||this.startArrowPoints&&a.isContains(s)&&(aOe(s,...this.startArrowPoints)||this.lineWidth>0&&Da(s,this.startLineSegment.start,this.startLineSegment.end,this.lineWidth))||this.endArrowPoints&&l.isContains(s)&&(aOe(s,...this.endArrowPoints)||this.lineWidth>0&&Da(s,this.endLineSegment.start,this.endLineSegment.end,this.lineWidth)))}get locked(){return!1}set locked(e){throw new Error("Method not implemented.")}clone(...e){throw new Error("Method not implemented.")}transform(e){throw new Error("Method not implemented.")}};var m5=class m5 extends r3{static getInstance(){return m5.instance||(m5.instance=new m5),m5.instance}updateCache(t){this.map.set(t.globalIndex,t)}addItemByModel(t){let e=new RD(t);return this.updateCache(e),e}addItem(t,e,r,i,n=1001){let s=new Rue(nr(),e,r,i,200,n),a=this.addItemByModel(s);return a.setParent(t),a}};m5.instance=null;var Vq=m5;var Due=class extends e3{constructor(e,r,i,n=ee.of3("#FF0000"),s=1001){super();this.modelType="DrcComponentOverlap";this._zoomType=le.pcbConfig.drcErrorZoom;this.globalIndex=e,this._radius=i,this._center=r,this._str=$i.getInstance().language==="zh-hans"?"\u78B0\u649E":"Collision",this._textPosition=r.add(new S(1.21*i,0));let a=new dt;this._textWidth=200,this._textHeight=this._zoomType==="keepConstantSize"?6:a.mm2mil(.5)/10,this._layerId=s,this._color=n,this.updateBox()}get layerId(){return this._layerId}set layerId(e){this._layerId!==e&&(this._layerId=e,this.layerModified=!0)}get center(){return this._center}set center(e){this._center!==e&&(this._center=e)}get radius(){return this._radius}set radius(e){this._radius!==e&&(this._radius=e)}get str(){return this._str}set str(e){this._str!==e&&(this._str=e)}get textPosition(){return this._textPosition}set textPosition(e){this._textPosition!==e&&(this._textPosition=e)}get textWidth(){return this._textWidth}set textWidth(e){this._textWidth!==e&&(this._textWidth=e)}get textHeight(){return this._textHeight}set textHeight(e){this._textHeight!==e&&(this._textHeight=e)}get color(){return this._color}set color(e){(this._color.r!==e.r||this._color.g!==e.g||this._color.b!==e.b||this._color.alpha!==e.alpha)&&(this._color=e)}updateBox(){return this._bbox||new ht(0,0,0,0)}inShape(e,r){let i=new S(e,r),[n,s]=this.injectedBBoxes;if(s.isContains(i))return!0;if(n.isContains(i)){let a=$S.mm2mil(.1)/10,l=Ai();a<.05&&l!=null&&(a=10/l.getScale());let c=this.center.distance1(i);return c<=this.radius+a/2&&c>=this.radius-a/2}return!1}get locked(){return!1}set locked(e){throw new Error("Method not implemented.")}clone(...e){throw new Error("Method not implemented.")}transform(e){throw new Error("Method not implemented.")}};var DD=class extends hy{constructor(t){super(),this.model=t,this.initRefreshRender()}getType(){return 19}get layerId(){return this.model.layerId}set layerId(t){this.model.layerId=t,this.refreshRender()}get center(){return this.model.center}set center(t){this.model.center=t,this.refreshRender()}get radius(){return this.model.radius}set radius(t){this.model.radius=t,this.refreshRender()}get str(){return this.model.str}set str(t){this.model.str=t,this.refreshRender()}get textPosition(){return this.model.textPosition}set textPosition(t){this.model.textPosition=t,this.refreshRender()}get textWidth(){return this.model.textWidth}set textWidth(t){this.model.textWidth=t,this.refreshRender()}get textHeight(){return this.model.textHeight}set textHeight(t){this.model.textHeight=t,this.refreshRender()}get color(){return this.model.color}set color(t){this.model.color=t,this.refreshRender()}buildBBox(){return this.model.bbox}isSelect(t,e){return this.model.inShape(t,e)}get isVisible(){return this._parent.isVisible}set isVisible(t){this.isVisible!=t&&(this.setDataState(0,t),this.refreshRender())}get locked(){return!1}set locked(t){throw new Error("Method not implemented.")}transform(t){throw new Error("Method not implemented.")}rotateFor(t,e){throw new Error("Method not implemented.")}injectedBBox(t){this.model.injectedBBox(t)}};var g5=class g5 extends r3{static getInstance(){return g5.instance||(g5.instance=new g5),g5.instance}updateCache(t){this.map.set(t.globalIndex,t)}addItemByModel(t){let e=new DD(t);return this.updateCache(e),e}addItem(t,e,r,i=ee.of3("#FFCC00"),n=1001){let s=new Due(nr(),e,r,i,n),a=this.addItemByModel(s);return a.setParent(t),a}};g5.instance=null;var Gq=g5;var wue=class{isComponentError(t){return!(t.errorType!=="Other Spacing"||t.obj1Type!=="Device"||t.obj2Type!=="Device")}getRelatedComponentIds(t){return[t==null?void 0:t.obj1,t==null?void 0:t.obj2].filter(Boolean)}createComponentError(t,e){if(!this.isComponentError(t))return;let r=this.getRelatedComponentIds(t);if(!UL.registerError(t.globalIndex,r)){console.debug(`[DRC Limit] Skip ${t.globalIndex}, component exceeded limit`);return}t.minDistance>0?this.createSpacingError(t,e):this.createOverlapError(t,e)}deleteComponentError(t){let e=t.child;e instanceof RD?Vq.getInstance().deleteItem(e):e instanceof DD&&Gq.getInstance().deleteItem(e),UL.unregisterError(t.contentModel.globalIndex),t.child=null}calcSpacingText(t){let e=R.getInstance().unit,r=t.length()*10;return e!="mil"&&(r=new dt().conversion1("mil",e,r)),r.toFixed(e=="mil"?1:3)+e}createSpacingError(t,e){let r=t.line,i=Vq.getInstance().addItem(e,r.start(),r.end(),this.calcSpacingText(r));e.child=i}createOverlapError(t,e){let r=Ar.getItem(t.obj1),i=Ar.getItem(t.obj2),s=new _e().ext1(r.bbox()).ext1(i.bbox()).build(),a=s.UR().sub(s.LL()).length()*1.2/2,l=s.center(),c=Gq.getInstance().addItem(e,l,a);e.child=c}};var Lue=class extends Ei{constructor(){super(...arguments);this.highlightedError=[];this.componentErrorFactory=new wue}unHighlightAll(){}highlightError(e){}syncFromContentModel(e=ci.getInstance().getAllItem()){let r=[];for(let i of e){let n=i.globalIndex;if(this.getItem(n)==null){let s=this.addErrorByContentModel(i);r.push(s)}}return r}deleteAll(){ci.getInstance().deleteAllError();let e=this.map.keys();for(let r of e)this.delete(this.map.get(r))}deleteCopperClearanceError(){[].concat(Ti.getAllItem(),zn.getAllItem()).forEach(e=>{let r=ci.getInstance().deleteClearanceError(e.globalIndex);this.deleteByModel(r)})}getAllErrors(){let e=this.modelRefItem2(ci.getInstance().idMapClearance),r=this.modelRefItem2(ci.getInstance().idMapInner);return{clearance:new Set([].concat(e,r)),diff:this.modelRefItem2(ci.getInstance().idMapDiffPairGap),track:this.modelRefItem(ci.getInstance().idMapTrack),diffPairTrack:this.modelRefItem(ci.getInstance().idMapDiffPairWidth),diffPairLength:this.modelRefItem(ci.getInstance().idMapDiffPairLength),blind:this.modelRefItem(ci.getInstance().idMapBlind),netLength:this.modelRefItem(ci.getInstance().idMapNetLength),netLengthTolerance:this.modelRefItem(ci.getInstance().idMapNetLengthTolerance),radius:this.modelRefItem(ci.getInstance().idMapRadius),connect:this.modelRefItem(ci.getInstance().idMapConnect),netlist:this.modelRefItem(ci.getInstance().idMapNetlist),creepage:this.modelRefItem2(ci.getInstance().idMapCreepage)}}modelRefItem(e){let r=new Set;for(let i of e.keys()){let n=e.get(i).globalIndex,s=this.getItem(n);s&&r.add(s)}return Array.from(r)}modelRefItem2(e){let r=new Set;for(let i of e.keys())e.get(i).forEach(n=>{let s=this.getItem(n.globalIndex);s&&r.add(s)});return Array.from(r)}getClearanceError(e,r){return ci.getInstance().getClearanceError(e,r)}getCreepageError(e,r){return ci.getInstance().getCreepageError(e,r)}existClearanceError(e,r){let i=ci.getInstance().idMapClearance.get(e),n={exsitError:!1,existClearanceError:!1};if(i==null)return n;let s=new Jt;for(let a of i){if(a.obj1!=e){let l=s.getItem(a.obj1);if(l instanceof Qp&&l.layerId!=r){n.exsitError=!0;continue}}else if(a.obj2!=e){let l=s.getItem(a.obj2);if(l instanceof Qp&&l.layerId!=r){n.exsitError=!0;continue}}n.existClearanceError=!0}return n}hasDiffLengthError(e){return ci.getInstance().hasDiffLengthError(e)}getDiffPairGapError(e,r){return ci.getInstance().getDiffPairGapError(e,r)}addErrorByContentModel(e){let{globalIndex:r,name:i,position:n,errorType:s,layerIds:a}=e,l=i1.getInstance().addItem(r,i,n,s,le.pcbConfig.drcErrorZoom,a);return l.contentModel=e,l.model.content=e,this.map.set(e.globalIndex,l),l.model.loadViewGroupId(),s=="Creepage Distance"&&e instanceof vb&&this.createCreepageError(e,l),le.pcbConfig.displayComponentSpacing&&e instanceof O0&&this.componentErrorFactory.createComponentError(e,l),l}createCreepageError(e,r){let i=e.path,n=this.formatDistanceValue(e.minDistance),s=this.formatDistanceValue(e.clearance),a=HL.getInstance().addItem(r,n,s,i);r.child=a}formatDistanceValue(e){let r=R.getInstance().unit,i=e*10;r!=="mil"&&(i=new dt().conversion1("mil",r,i));let n=r==="mil"?1:3;return i.toFixed(n)+r}deleteClearanceError(e){let r=ci.getInstance().deleteClearanceError(e);this.deleteByModel(r)}deleteCreepageError(e){let r=ci.getInstance().deleteCreepageError(e);this.deleteByModel(r)}addInnerError(e,r,i,n,s,a,l,c,h){let u=ci.getInstance().addInnerError(e,r,i,n,s,a,l,c,h);return this.addErrorByContentModel(u)}deleteInnerError(e){let r=ci.getInstance().deleteInnerError(e);this.deleteByModel(r)}addNetLengthError(e,r,i,n,s,a){let l=ci.getInstance().addNetLengthError(e,r,i,n,s,a);return this.addErrorByContentModel(l)}deleteNetLengthError(e){let r=ci.getInstance().deleteNetLengthError(e);this.deleteByModel(r)}addNetLengthToleranceError(e,r,i,n,s){let a=ci.getInstance().addNetLengthToleranceError(e,r,i,n,s);return this.addErrorByContentModel(a)}deleteNetLengthToleranceError(e){let r=ci.getInstance().deleteNetLengthToleranceError(e);this.deleteByModel(r)}addTrackWidthError(e,r,i,n,s,a,l){let c=ci.getInstance().addTrackWidthError(e,r,i,n,s,a,l);return this.addErrorByContentModel(c)}deleteTrackWidthError(e){let r=ci.getInstance().deleteTrackWidthError(e);this.deleteByModel(r)}addDiffPairTrackWidthError(e,r,i,n,s,a,l){let c=ci.getInstance().addDiffPairTrackWidthError(e,r,i,n,s,a,l);return this.addErrorByContentModel(c)}deleteDiffPairTrackWidthError(e){let r=ci.getInstance().deleteDiffPairTrackWidthError(e);this.deleteByModel(r)}addDiffPairTrackGapError(e,r,i,n,s,a,l,c,h){let u=ci.getInstance().addDiffPairTrackGapError(e,r,i,n,s,a,l,c,h);return this.addErrorByContentModel(u)}deleteDiffPairTrackGapError(e){let r=ci.getInstance().deleteDiffPairTrackGapError(e);this.deleteByModel(r)}addDiffPairTrackLengthError(e,r,i,n,s,a,l,c){let h=ci.getInstance().addDiffPairTrackLengthError(e,r,i,n,s,a,l);return this.addErrorByContentModel(h)}deleteDiffPairTrackLengthError(e){let r=ci.getInstance().deleteDiffPairTrackLengthError(e);this.deleteByModel(r)}addBlindError(e,r,i,n,s,a){let l=ci.getInstance().addBlindError(e,r,i,n,s,a);return this.addErrorByContentModel(l)}deleteBlindError(e){let r=ci.getInstance().deleteBlindError(e);this.deleteByModel(r)}addRadiusError(e,r,i,n,s,a,l,c,h){let u=ci.getInstance().addRadiusError(e,r,i,n,s,a,l,c,h);return this.addErrorByContentModel(u)}deleteRadiusError(e){let r=ci.getInstance().deleteRadiusError(e);this.deleteByModel(r)}addConnectError(e,r,i,n,s,a,l){let c=ci.getInstance().addConnectError(e,r,i,n,s,a,l);return this.addErrorByContentModel(c)}deleteConnectError(e){let r=ci.getInstance().deleteConnectError(e);this.deleteByModel(r)}deleteAllConnectError(){let e=ci.getInstance().idMapConnect;for(let r of e.keys()){let i=e.get(r);this.deleteByModel(i)}}deleteAllNetLengthError(){let e=ci.getInstance().idMapNetLength;for(let r of e.keys()){let i=e.get(r);this.deleteByModel(i)}}deleteAllNetLengthToleranceError(){let e=ci.getInstance().idMapNetLengthTolerance;for(let r of e.keys()){let i=e.get(r);this.deleteByModel([i])}}deleteNetlistError(){let e=ci.getInstance().idMapNetlist;for(let r of e.keys()){let i=e.get(r);this.deleteByModel([i])}}delete(e){e instanceof Tp&&(e.child instanceof RD||e.child instanceof DD?this.componentErrorFactory.deleteComponentError(e):e.child instanceof Jv&&HL.getInstance().deleteCreepageError(e),i1.getInstance().deleteItem(e),ci.getInstance().deleteError(e.contentModel),this.map.delete(e.globalIndex))}deleteByModel(e){e!=null&&(e=Array.isArray(e)?e:[e],e.forEach(r=>{this.delete(this.getItem(r.globalIndex))}))}deleteByPcbItem(e,r=!1){let i=[Pe.getMultLayer().layerID,...Pe.getAllCopperLayerIds()];e=e instanceof Set||Array.isArray(e)?e:[e];for(let n of e){let s=n.globalIndex;if(this.deleteClearanceError(s),this.deleteCreepageError(s),r&&this.deleteConnectError(s),n instanceof Jr)this.deleteClearanceError(s);else if(n instanceof Ue)this.deleteBlindError(s),this.deleteRadiusError(s);else if(n instanceof Ge)this.deleteTrackWidthError(s),this.deleteDiffPairTrackWidthError(s),this.deleteDiffPairTrackGapError(s),this.deleteDiffPairTrackLengthError(n.net);else if(n instanceof Gi)this.deleteInnerError(s);else if(n instanceof ke){let a=new Set(n.getPads()),l=new Set(n.getVias()),c=n.getItems();a.forEach(h=>{this.deleteClearanceError(h.globalIndex)}),l.forEach(h=>{this.deleteClearanceError(h.globalIndex),this.deleteBlindError(h.globalIndex),this.deleteRadiusError(h.globalIndex)}),c.forEach(h=>{!a.has(h)&&!l.has(h)&&i.includes(h.layerId)&&this.deleteClearanceError(h.globalIndex)})}}}};var OG=class o{constructor(){this.tool=null;this.property={paste2CurrentActiveLayer:!0,inheritNet:"InheritNetsfromTouchedObjects"};this.layout={isCursorChange:!1,isApply:!1,mouseX:0,mouseY:0,rotation:0};this.isInit=!0}static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}getTool(){return this.tool}setTool(t){this.tool=t}async initPaste2CurrentActiveLayer(){this.isInit&&(this.setPaste2CurrentActiveLayer(!!(await A.windowBridge.rpcCall("UserPreferencesGetCacheObj","paste2CurrentActiveLayer",f0())).message),this.isInit=!1)}getPaste2CurrentActiveLayer(){return this.property.paste2CurrentActiveLayer}setPaste2CurrentActiveLayer(t){this.property.paste2CurrentActiveLayer=t}getInheritNet(){return this.property.inheritNet}setInheritNet(t){this.property.inheritNet=t}getIsCursorChange(){return this.layout.isCursorChange}setIsCursorChange(t){this.layout.isCursorChange=t}getIsApply(){return this.layout.isApply}setIsApply(t){if(this.layout.isApply=t,this.layout.isApply&&this.tool){bh.type=null;let e=fi.getInstance();e.sceneX=this.getMouseX(),e.sceneY=this.getMouseY(),this.tool.onMouseMove(e),this.tool.onMouseLeftUp(e),A.publish("adaptSelect","")}}getMouseX(){return this.layout.mouseX}setMouseX(t){this.layout.mouseX=t/10}getMouseY(){return this.layout.mouseY}setMouseY(t){this.layout.mouseY=t/10}getRotation(){return Yl(ve(this.layout.rotation/Math.PI*180,3))}setRotation(t){let e=parseFloat((t/180).toString())*Math.PI;isNaN(e)||(this.layout.rotation=e),A.publish("rotateForAngle",this.layout.rotation)}getUnit(){return R.getInstance().unit}setUnit(t){eC(t)}getGridType(){return we.gridType}setGridType(t){we.gridType=t,A.messageBus.publish("switchGridType",t),A.publish("switchGridTypeBtn",t,f0())}getBlodGridType(){return we.multiType}setBlodGridType(t){we.multiType=t,A.messageBus.publish("switchMultiGridType",t)}getBlodGridRatio(){return we.multiRatio}setBlodGridRatio(t){A.messageBus.publish("switchMultiGridRatio",t)}getGridSize(){let t=It.getInstance().getGridX()*10,e=It.getInstance().getGridY()*10;return t==e?String(t):`${t},${e}`}setGridSize(t,e){It.getInstance().setGridX(t/10),It.getInstance().setGridY(e/10),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],f0()),we.synchronize()}getSnapSize(){let t=It.getInstance().getSnapX()*10,e=It.getInstance().getSnapY()*10;return t==e?String(t):`${t},${e}`}setSnapSize(t,e){It.getInstance().setSnapX(t/10),It.getInstance().setSnapY(e/10),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],f0())}getSnap(){return{title:"Snap",value:we.adsorb}}setSnap(t){A.publish("toggleAdsorb",t)}getAltSnapSize(){let t=R.getInstance().altGridSize,e=Bs.conversion1(t.GridX.unit,R.getInstance().unit,t.GridX.number),r=Bs.conversion1(t.GridY.unit,R.getInstance().unit,t.GridY.number);return e==r?String(e):`${e},${r}`}setAltSnapSize(t,e){let r={GridX:{number:t,unit:R.getInstance().unit},GridY:{number:e,unit:R.getInstance().unit}};R.getInstance().altGridSize=r}};var a0=class o extends fI{static getInstance(){var t;return(t=o.instance)!=null?t:o.instance=new o}setTool(t){this.pastePanelParams.setTool(t),this.pastePanelParams.setIsApply(!1)}constructor(){super(),this.pastePanelParams=OG.getInstance()}get isUnmounted(){return this.pastePanelParams.getIsApply()}get paste2CurrentActiveLayer(){return this.pastePanelParams.getPaste2CurrentActiveLayer()}get inheritNet(){return this.pastePanelParams.getInheritNet()}get isCursorChange(){return this.pastePanelParams.getIsCursorChange()}get mouseX(){return this.pastePanelParams.getMouseX()*10}set mouseX(t){this.pastePanelParams.setMouseX(t)}get mouseY(){return this.pastePanelParams.getMouseY()*10}set mouseY(t){this.pastePanelParams.setMouseY(t)}get rotation(){return this.pastePanelParams.getRotation()}createHeader(t){return{...this.createBaseHeader(),id:t,action:t,tabId:R.getInstance().tabId}}handleHeaderUpdate(t){}createBody(t){return{PasteProperty:this.createProperty(),PasteLayout:this.createLayout(),PasteCanvas:this.createDocument()}}handleBodyUpdate(t,e){let{PasteProperty:r,PasteLayout:i,PasteCanvas:n}=e;this.updateProperty(r),this.updateLayout(i),this.updateDocument(n),A.publish("updateFrame","")}createProperty(){return{paste2CurrentActiveLayer:this.pastePanelParams.getPaste2CurrentActiveLayer(),inheritNet:this.pastePanelParams.getInheritNet()}}createLayout(){return{isCursorChange:this.pastePanelParams.getIsCursorChange(),isApply:this.pastePanelParams.getIsApply(),mouseX:this.mouseX,mouseY:this.mouseY,rotation:this.pastePanelParams.getRotation()}}createDocument(){return{unit:this.pastePanelParams.getUnit(),gridType:this.pastePanelParams.getGridType(),blodGridType:this.pastePanelParams.getBlodGridType(),blodGridRatio:this.pastePanelParams.getBlodGridRatio(),gridSize:this.pastePanelParams.getGridSize(),snapSize:this.pastePanelParams.getSnapSize(),snap:this.pastePanelParams.getSnap(),altSnapSize:this.pastePanelParams.getAltSnapSize()}}updateProperty(t){let{paste2CurrentActiveLayer:e,inheritNet:r}=t;e!==this.pastePanelParams.getPaste2CurrentActiveLayer()&&this.pastePanelParams.setPaste2CurrentActiveLayer(e),r!==this.pastePanelParams.getInheritNet()&&this.pastePanelParams.setInheritNet(r)}updateLayout(t){let{isCursorChange:e,isApply:r,mouseX:i,mouseY:n,rotation:s}=t;e!==this.pastePanelParams.getIsCursorChange()&&this.pastePanelParams.setIsCursorChange(e),r!==this.pastePanelParams.getIsApply()&&this.pastePanelParams.setIsApply(r),Math.abs(i-this.pastePanelParams.getMouseX())>.001&&this.pastePanelParams.setMouseX(i),Math.abs(n-this.pastePanelParams.getMouseY())>.001&&this.pastePanelParams.setMouseY(n),Math.abs(s-this.pastePanelParams.getRotation())>.1&&this.pastePanelParams.setRotation(s)}updateDocument(t){let{unit:e,gridType:r,blodGridType:i,blodGridRatio:n,gridSize:s,snapSize:a,snap:l,altSnapSize:c}=t,h=this.pastePanelParams.getUnit(),u=this.pastePanelParams.getGridType(),d=this.pastePanelParams.getBlodGridType(),p=this.pastePanelParams.getBlodGridRatio(),m=String(this.pastePanelParams.getGridSize()),g=String(this.pastePanelParams.getSnapSize()),y=this.pastePanelParams.getSnap().value,b=this.pastePanelParams.getGridSize(),P=!1;e!==h&&(P=!0,this.pastePanelParams.setUnit(e)),r!==u&&(P=!0,this.pastePanelParams.setGridType(r)),i!==d&&(P=!0,this.pastePanelParams.setBlodGridType(i)),n!==p&&(P=!0,this.pastePanelParams.setBlodGridRatio(n)),s!==m&&(P=!0,this.updateCanvasGirdSnap("attr-grid-size",s)),a!==g&&(P=!0,this.updateCanvasGirdSnap("attr-snap-size",a)),l.value!==y&&(P=!0,this.pastePanelParams.setSnap(l.value)),c!==b&&(P=!0,this.updateCanvasGirdSnap("attr-alt-grid-size",c)),P&&np()}updateCanvasGirdSnap(t,e){let r=e.toString().split(/,|，/),i,n;r.length==1?i=n=parseFloat(r[0]):r.length==2&&(i=parseFloat(r[0]),n=parseFloat(r[1])),!(isNaN(i)||isNaN(n))&&(t=="attr-grid-size"?this.pastePanelParams.setGridSize(i,n):t=="attr-snap-size"?this.pastePanelParams.setSnapSize(i,n):t=="attr-alt-grid-size"&&this.pastePanelParams.setAltSnapSize(i,n))}isCrossLayers(t){let e=/"layerId"\s*:\s*(\d+)/g,r=new Set;for(let i of Object.values(t))for(let n of i){if(!n.trim())continue;e.lastIndex=0;let s;if((s=e.exec(n))!==null){let a=parseInt(s[1],10);if(r.add(a),r.size>1)return!0}}return!1}analyzePasteData(t,e){var c;if(!t||!t.data)return null;let r=(c=t.head)==null?void 0:c.layerInfos,i=Object.keys(t.data).some(h=>h===15 .toString()),n=Object.values(r).length>1;if(!i&&n||this.isCrossLayers(t.data))return null;let s=t.data,a=[],l=Pe.getActiveLayerID();for(let h of Object.keys(s)){let u=s[h];if(!u||u.length===0)continue;let d=/"globalIndex"\s*:\s*"([^"]+)"/g.exec(u[0]),p=d?e[d[1]]:null;if(!p)continue;let m=aC.getManager(Number(h));if(!m)continue;let g=m.getItem(p);if(!g||!Un.canChangeLayer(g,l))continue;let y=[];for(let b of u){let P=/"globalIndex"\s*:\s*"([^"]+)"/g.exec(b),T=P?e[P[1]]:null;if(!T)continue;let I=aC.getManager(Number(h));if(!I)continue;let C=I.getItem(T);C&&y.push(C)}a.push({key:h,items:y})}return this.pastePanelParams.cachedAnalysisResult=a,a}filterAnalysisResult(t,e){let r=[];for(let i of t){let n=i.items[0];if(!n)continue;Un.canChangeLayer(n,e)&&r.push(i)}return r}toggle2ActiveLayer(t,e,r=!1){let i=t?this.analyzePasteData(t,e):this.pastePanelParams.cachedAnalysisResult;if(!this.paste2CurrentActiveLayer||!i||i.reduce((a,l)=>a+l.items.length,0)>400&&!r)return;let s=Pe.getActiveLayerID();t||(i=this.filterAnalysisResult(i,s));for(let a of i)for(let l of a.items)l.layerId!=s&&(l.layerId=s)}reset(){this.pastePanelParams.setIsCursorChange(!1),this.pastePanelParams.setRotation(0),this.pastePanelParams.cachedAnalysisResult=null,this.pastePanelParams.setTool(null),A.publish("ExitSketcherAttrView",{type:"PASTE"})}};var Mue=class{constructor(){this.tool=null}toggleLayer(t,e,r){let i=Pe.getLayer(t);i.config&&(Pe.setActiveLayer(i,r),u8(),this.tool!=null&&this.tool.toggleLayer(t,e),bh.type=="PASTE"&&a0.getInstance().toggle2ActiveLayer())}addTool(t){this.tool=t}};var Nue=class{constructor(){this.placingPad=null;this.defaultTextFamily=["default","\u9ED1\u4F53","default2","Serif","Sans Serif"];this.defalutPad={layerId:12,type:1,num:"",topType:"ELLIPSE",topWidth:6,topHeight:6,topRatio:0,bottomType:"ELLIPSE",bottomWidth:6,bottomHeight:6,bottomRatio:0,innerType:"ELLIPSE",innerWidth:6,innerHeight:6,innerRatio:0,rotation:0,net:"",expansionType:1,pasteExpansion:0,topSolderExpansion:.4,bottomSolderExpansion:.4,holeLength:3.6,holeRadius:1.8,holeShape:"ROUND",holeRotation:0,holeOffset:new S(0,0)};this.defalutTestPad={layerId:12,type:1,num:"",topType:"ELLIPSE",topWidth:2.4,topHeight:2.4,topRatio:0,bottomType:"ELLIPSE",bottomWidth:2.4,bottomHeight:2.4,bottomRatio:0,innerType:"ELLIPSE",innerWidth:2.4,innerHeight:2.4,innerRatio:0,rotation:0,net:"",expansionType:1,pasteExpansion:0,topSolderExpansion:.4,bottomSolderExpansion:.4,unusedInnerLayers:[],holeLength:3.6,holeRadius:.6,holeShape:"ROUND",holeRotation:0,holeOffset:new S(0,0)};this.defaultText={layerId:3,text:"text",fontFamily:"",strokeWidth:.8,fontSize:8,rotation:0,silkColor:"#000000"};this.defaultImage={rotation:0,silkColor:"#000000"};this.defaultMark={silkColor:"#000000"};this.defaultSmartDimension={silkColor:"#000000"};this.default2DLine={silkColor:"#000000"};this.defaultTable={lineWidth:1,fontSize:8};this.defaultVia={net:"",type:0,name:"",startLayer:1,endLayer:2,radius:1.20079,innerRadius:.60039};this.defaultSutureVia={lineSpacing:20,columnSpacing:20};this.LineTypeSutureVia=20;this.footprintDefault={idData:{key:"Footprint",value:"Name",ggeid:""},rotation:0};this.defaultOutlineWidth=1;this.defaultTrackWidth=[];this.defaultTearDrop={operationType:"add",applyScope:"all",tearShape:"arc",ignoreDRC:!1,circleWidth:75,circleHeight:35,circlePadViaChecked:!0,otherWidth:250,otherHeight:150,specialShapedPadChecked:!0,routingWidth:70,routingHeight:100,routingChecked:!0,TConnectionWidth:300,TConnectionHeight:300,TConnectionChecked:!0}}getDefaultPad(t,e=""){let r=this.defalutPad.net,i=re.getInstance().getSolderExpansionByNet(r);return Qt.addPad(this.defalutPad.layerId,this.defalutPad.type,e,t,this.defalutPad.topType,this.defalutPad.topWidth,this.defalutPad.topHeight,this.defalutPad.topRatio,this.defalutPad.bottomType,this.defalutPad.bottomWidth,this.defalutPad.bottomHeight,this.defalutPad.bottomRatio,this.defalutPad.innerType,this.defalutPad.innerWidth,this.defalutPad.innerHeight,this.defalutPad.innerRatio,this.defalutPad.rotation,!1,this.defalutPad.net,this.defalutPad.expansionType,this.defalutPad.pasteExpansion,i.padTopExpansion,i.padBottomExpansion,[],!0,this.defalutPad.holeLength,this.defalutPad.holeRadius,this.defalutPad.holeShape,this.defalutPad.holeRotation,this.defalutPad.holeOffset)}getDefaultTestPad(t){let e=this.defalutTestPad.net,r=re.getInstance().getSolderExpansionByNet(e);return Qt.addPad(this.defalutTestPad.layerId,this.defalutTestPad.type,this.defalutTestPad.num,t,this.defalutTestPad.topType,this.defalutTestPad.topWidth,this.defalutTestPad.topHeight,this.defalutTestPad.topRatio,this.defalutTestPad.bottomType,this.defalutTestPad.bottomWidth,this.defalutTestPad.bottomHeight,this.defalutTestPad.bottomRatio,this.defalutTestPad.innerType,this.defalutTestPad.innerWidth,this.defalutTestPad.innerHeight,this.defalutTestPad.innerRatio,this.defalutTestPad.rotation,!1,this.defalutTestPad.net,this.defalutTestPad.expansionType,this.defalutTestPad.pasteExpansion,r.testPointTopExpansion,r.testPointBottomExpansion,[],!0,this.defalutTestPad.holeLength,this.defalutTestPad.holeRadius,this.defalutTestPad.holeShape,this.defalutTestPad.holeRotation,this.defalutTestPad.holeOffset)}getDefaultVia(t,e,r){let i=this.defaultVia.net;(Ye.getItem(i)==null||Ye.getItem(i).size==0)&&(i="");let n=re.getInstance().getSolderExpansionByNet(i);return Wr.addVia(this.defaultVia.type,this.defaultVia.name,this.defaultVia.startLayer,this.defaultVia.endLayer,i,e,t,r,!1,1,n.viaTopExpansion,n.viaBottomExpansion)}getDefaultBaseVia(t,e,r){let i=this.defaultVia.net;(Ye.getItem(i)==null||Ye.getItem(i).size==0)&&(i="");let n=re.getInstance().getSolderExpansionByNet(i),s=dR.build(t,e,r,n.viaTopExpansion,n.viaBottomExpansion,ee.BLACK);return s.type=this.defaultVia.type,s.name=this.defaultVia.name,s.viaBaseInfo=la.getViaBaseInfo(this.defaultVia.startLayer,this.defaultVia.endLayer,e,r),s.net=i,s.expansionType=1,s}setDefaultSutureVia(t,e){this.defaultSutureVia.lineSpacing=t,this.defaultSutureVia.columnSpacing=e}setDefaultLineSutureVia(t){this.LineTypeSutureVia=t}setDefaultVia(t,e=!0){t.net!=null&&(this.defaultVia.net=t.net),t.holeRadius!=null&&(this.defaultVia.innerRadius=t.holeRadius),t.radius!=null&&(this.defaultVia.radius=t.radius),e&&A.publish("flushSelectingInfo","")}togglePadLayerId(t){this.defalutPad.layerId!=12&&this.defalutPad.layerId!=t&&(t==12?this.defalutPad.layerId==1?(this.defalutPad.bottomType=this.defalutPad.topType,this.defalutPad.bottomWidth=this.defalutPad.topWidth,this.defalutPad.bottomHeight=this.defalutPad.topHeight,this.defalutPad.bottomRatio=this.defalutPad.topRatio,this.defalutPad.innerType=this.defalutPad.topType,this.defalutPad.innerWidth=this.defalutPad.topWidth,this.defalutPad.innerHeight=this.defalutPad.topHeight,this.defalutPad.innerRatio=this.defalutPad.topRatio):(this.defalutPad.topType=this.defalutPad.bottomType,this.defalutPad.topWidth=this.defalutPad.bottomWidth,this.defalutPad.topHeight=this.defalutPad.bottomHeight,this.defalutPad.topRatio=this.defalutPad.bottomRatio,this.defalutPad.innerType=this.defalutPad.bottomType,this.defalutPad.innerWidth=this.defalutPad.bottomWidth,this.defalutPad.innerHeight=this.defalutPad.bottomHeight,this.defalutPad.innerRatio=this.defalutPad.bottomRatio):t==1?(this.defalutPad.topType=this.defalutPad.bottomType,this.defalutPad.topWidth=this.defalutPad.bottomWidth,this.defalutPad.topHeight=this.defalutPad.bottomHeight,this.defalutPad.topRatio=this.defalutPad.bottomRatio):(this.defalutPad.bottomType=this.defalutPad.topType,this.defalutPad.bottomWidth=this.defalutPad.topWidth,this.defalutPad.bottomHeight=this.defalutPad.topHeight,this.defalutPad.bottomRatio=this.defalutPad.topRatio)),this.defalutPad.layerId=t}setDefaultPad(t){this.defalutPad.layerId=t.layerId,this.defalutPad.type=t.type,this.defalutPad.num=t.num,this.defalutPad.topType=t.topType,this.defalutPad.topWidth=t.topWidth,this.defalutPad.topHeight=t.topHeight,this.defalutPad.topRatio=t.topRatio,this.defalutPad.bottomType=t.bottomType,this.defalutPad.bottomWidth=t.bottomWidth,this.defalutPad.bottomHeight=t.bottomHeight,this.defalutPad.bottomRatio=t.bottomRatio,this.defalutPad.innerType=t.innerType,this.defalutPad.innerWidth=t.innerWidth,this.defalutPad.innerHeight=t.innerHeight,this.defalutPad.innerRatio=t.innerRatio,this.defalutPad.rotation=t.rotation,this.defalutPad.net=t.net,this.defalutPad.expansionType=t.expansionType,this.defalutPad.pasteExpansion=t.pasteExpansion,this.defalutPad.topSolderExpansion=t.topSolderExpansion,this.defalutPad.bottomSolderExpansion=t.bottomSolderExpansion,this.defalutPad.holeLength=t.holeLength,this.defalutPad.holeRadius=t.holeRadius,this.defalutPad.holeShape=t.holeShape,this.defalutPad.holeRotation=t.holeRotation,this.defalutPad.holeOffset=t.holeOffset}setDefaultTestPad(t){let{layerId:e,type:r,num:i,topType:n,topWidth:s,topHeight:a,topRatio:l,bottomType:c,bottomWidth:h,bottomHeight:u,bottomRatio:d,innerType:p,innerWidth:m,innerHeight:g,innerRatio:y,rotation:b,net:P,expansionType:T,pasteExpansion:I,topSolderExpansion:C,bottomSolderExpansion:E,holeLength:O,holeRadius:_,holeShape:x,holeRotation:v,holeOffset:D}=t;this.defalutTestPad={...this.defalutTestPad,layerId:e,type:r,num:i,topType:n,topWidth:s,topHeight:a,topRatio:l,bottomType:c,bottomWidth:h,bottomHeight:u,bottomRatio:d,innerType:p,innerWidth:m,innerHeight:g,innerRatio:y,rotation:b,net:P,expansionType:T,pasteExpansion:I,topSolderExpansion:C,bottomSolderExpansion:E,holeLength:O,holeRadius:_,holeShape:x,holeRotation:v,holeOffset:D}}};var kue=class{constructor(){this.numManager=new T0;this.idMapHandler={};this.time=0;this.actions=new Map,A.subscribe("openDialog",this.open.bind(this)),A.subscribe("pcbdialogModify",this.modify.bind(this)),A.subscribe("pcbdialogClose",this.close.bind(this)),A.subscribe("DialogCloseByAction",this.closeByAction.bind(this)),A.subscribe("pcbdialogCMD",this.toggleMode.bind(this)),A.subscribe("TempMaskDialog",this.mask50ms.bind(this))}mask50ms(){this.time=new Date().getTime()+200}check(){return!(!R.getInstance().isactive||23==R.getInstance().doctype)}open(t){if(!(new Date().getTime()<=this.time)&&this.check()){let e=this.numManager.getNum("dialog1");t.id=e,this.numManager.add(e),this.idMapHandler[e]=t;let r=t.open(t.option,t);if(r.action){let i=this.actions.get(r.action)||[];this.actions.set(r.action,[].concat(i,[e]))}r.dialogId=e,A.publish("dialogPcbOpen",r,Q()),A.publish("updateFrame","")}}modify(t){if(this.check()){let e=t.dialogId,r=this.idMapHandler[e];if(!e&&t.dialogType){let i=Object.keys(this.idMapHandler).find(n=>{var s;return((s=this.idMapHandler[n])==null?void 0:s.dialogType)===t.dialogType});r=this.idMapHandler[i]}if(r!=null){r.modify(t),r.type="modify";let i=r.open(r.option,r);i.dialogId=e,A.publish("PcbdialogDataFlush",i,Q()),A.publish("updateFrame","")}}}close(t){if(this.check()){let e=t.dialogId,r=this.idMapHandler[e];if(r!=null){let i=r.close(t);A.publish("updateFrame",""),i&&(A.publish("PcbcloseDialog",t,Q()),r=null,delete this.idMapHandler[e])}}}closeByAction({action:t}){(this.actions.get(t)||[]).forEach(r=>{let i={dialogId:r},n=this.idMapHandler[r];if(n!=null){let s=n.close(i);A.publish("updateFrame",""),s&&(A.publish("PcbcloseDialog",i,Q()),n=null,delete this.idMapHandler[r])}}),this.actions.delete(t)}toggleMode(t){if(this.check()){let e=t.dialogId,r=this.idMapHandler[e];if(!r){A.publish("updateFrame",""),A.publish("PcbcloseDialog",t,Q());return}r.command(t)&&(A.publish("updateFrame",""),A.publish("PcbcloseDialog",t,Q()),r=null,delete this.idMapHandler[e])}}getIdMapHandler(){let t={};return Object.entries(this.idMapHandler).forEach(([e,r])=>{let{dialogType:i,id:n,type:s}=r,a={dialogType:i,id:n,type:s};t[e]=a}),t}};var Bue=class{constructor(){this.handler=null;this.stack=new Array;A.subscribe("openMsgbox",this.open.bind(this)),A.subscribe("msgboxClose",this.close.bind(this))}check(){return!(!R.getInstance().isactive||23==R.getInstance().doctype)}open(t){if(this.check)if(this.handler==null){this.handler=t;let e=this.handler.open();A.publish("msgboxPcbOpen",e,Q()),A.publish("updateFrame","")}else this.handler.equal(t)||this.stack.push(t)}close(t){if(this.check&&(this.handler!=null&&(this.handler.close(t),A.publish("updateFrame","")),this.handler=null,this.stack.length>0)){let e=this.stack.shift();this.open(e)}}};var Uq=class{static executable(){return!(!R.getInstance().isactive||23==R.getInstance().doctype)}};var wD=class extends kl{constructor(){super();this.existingInDevice=!1;this.existPolygonPad=!0;this.unionAttribute=null;this.interAttribute=null;this.attrIdMap={};this._netLengthMap=new Map,this.pad=null}set(e){return this.pad=e,this}getExtra(){return{existingInDevice:this.existingInDevice,existPolygonPad:this.existPolygonPad}}getHtmlData(e){var b;this.idList.push(e.globalIndex),this.count++;let r=Ht.getCombin(),i=R.getInstance().unit,n=R.getInstance().origin;this.attrlist==null&&(this.attrlist={});let s=this.attrlist;if(e.getParent()!=null){let P=e.getParent();P instanceof ke&&((s["attr-footprint-id"]==null||s["attr-footprint-id"].value!=Ve)&&(s["attr-footprint-id"]={title:"Footprint ID",value:this.getCompareValue("attr-footprint-id",P.footprintId)}),this.existingInDevice=!0)}else(s["attr-footprint-id"]==null||s["attr-footprint-id"].value!=Ve)&&(s["attr-footprint-id"]={title:"Footprint ID",value:this.getCompareValue("attr-footprint-id","")});(s["attr-select-net"]==null||s["attr-select-net"].value!=Ve)&&(s["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",e.showNet),options:this.poolCache.allNetOptions||Ye.getNet()}),(s["attr-layerid"]==null||s["attr-layerid"].value!=Ve)&&(s["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:Un.abstractPad()}),(s["attr-combination"]==null||s["attr-combination"].value!=Ve)&&(s["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",Ht.getGroupNameByGroupId(e.getGroupID())||""),options:r,hasParent:e.getParent()!=null}),(s["attr-number"]==null||s["attr-number"].value!=Ve)&&(s["attr-number"]={title:"Number",value:this.getCompareValue("attr-number",e.num)}),(s["attr-id"]==null||s["attr-id"].value!=Ve)&&(s["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${Tr}${e.number}`),sourceId:e.globalIndex}),(s["attr-pad-shape-showtype"]==null||s["attr-pad-shape-showtype"].value!=Ve)&&(s["attr-pad-shape-showtype"]={title:"Type",value:this.getCompareValue("attr-pad-shape-showtype",3)}),(s["attr-x"]==null||s["attr-x"].value!=Ve)&&(s["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",je(e.center.x-n.x,void 0,i,this.unitConversion))}),(s["attr-y"]==null||s["attr-y"].value!=Ve)&&(s["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",je(e.center.y-n.y,void 0,i,this.unitConversion))}),(s["attr-rotation"]==null||s["attr-rotation"].value!=Ve)&&(s["attr-rotation"]={title:"Rotation",value:this.getCompareValue("attr-rotation",Yl(ve(e.rotation/Math.PI*180,3)))});let a=e.locked,l=e.getParent();l!=null&&l instanceof ke&&l.locked&&(a=l.locked),(s["attr-locked"]==null||s["attr-locked"].value!=Ve)&&(s["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",a?"yes":"no"),options:this.poolCache.lockSettingOptions}),(s["attr-pad-hole-shape"]==null||s["attr-pad-hole-shape"].value!=Ve)&&(s["attr-pad-hole-shape"]={title:"Shape",value:this.getCompareValue("attr-pad-hole-shape",e.holeShape),options:this.getHoleShapeOption()}),(s["attr-pad-hole-diameter"]==null||s["attr-pad-hole-diameter"].value!=Ve)&&(s["attr-pad-hole-diameter"]={title:"Hole Diameter",value:this.getCompareValue("attr-pad-hole-diameter",je(e.holeRadius*2,void 0,i,this.unitConversion))}),(s["attr-pad-hole-length"]==null||s["attr-pad-hole-length"].value!=Ve)&&(s["attr-pad-hole-length"]={title:"Hole Length",value:this.getCompareValue("attr-pad-hole-length",je(e.holeLength,void 0,i,this.unitConversion))}),(s["attr-pad-hole-width"]==null||s["attr-pad-hole-width"].value!=Ve)&&(s["attr-pad-hole-width"]={title:"Hole Width",value:this.getCompareValue("attr-pad-hole-width",je(e.holeRadius*2,void 0,i,this.unitConversion))}),(s["attr-pad-hole-rotation"]==null||s["attr-pad-hole-rotation"].value!=Ve)&&(s["attr-pad-hole-rotation"]={title:"Hole Rotation",value:this.getCompareValue("attr-pad-hole-rotation",ve(e.holeRotation/Math.PI*180,3))}),(s["attr-pad-offset-x"]==null||s["attr-pad-offset-x"].value!=Ve)&&(s["attr-pad-offset-x"]={title:"Offset X",value:this.getCompareValue("attr-pad-offset-x",je(e.holeOffset.x,void 0,i,this.unitConversion))}),(s["attr-pad-offset-y"]==null||s["attr-pad-offset-y"].value!=Ve)&&(s["attr-pad-offset-y"]={title:"Offset Y",value:this.getCompareValue("attr-pad-offset-y",je(e.holeOffset.y,void 0,i,this.unitConversion))}),(s["attr-pad-plated"]==null||s["attr-pad-plated"].value!=Ve)&&(s["attr-pad-plated"]={title:"Plated",value:this.getCompareValue("attr-pad-plated",e.plated?"yes":"no")}),(s["attr-soldermask-showtype"]==null||s["attr-soldermask-showtype"].value!=Ve)&&(s["attr-soldermask-showtype"]={title:"Solder Type",value:this.getCompareValue("attr-soldermask-showtype",e.expansionType)}),(s["attr-pastemask"]==null||s["attr-pastemask"].value!=Ve)&&(s["attr-pastemask"]={title:"Paste",value:this.getCompareValue("attr-pastemask",je(e.pasteExpansion,void 0,i,this.unitConversion))});let c=je(e.topSolderExpansion,void 0,i,this.unitConversion),h=je(e.bottomSolderExpansion,void 0,i,this.unitConversion),u=c;e.layerId==2&&(u=h),(s["attr-soldermask"]==null||s["attr-soldermask"].value!=Ve)&&(s["attr-soldermask"]={title:"Solder",value:this.getCompareValue("attr-soldermask",u)}),(s["attr-soldermask-toplayer"]==null||s["attr-soldermask-toplayer"].value!=Ve)&&(s["attr-soldermask-toplayer"]={title:"Top Solder",value:this.getCompareValue("attr-soldermask-toplayer",e.expansionType===1?"Follow Rule":c)}),(s["attr-soldermask-bottomlayer"]==null||s["attr-soldermask-bottomlayer"].value!=Ve)&&(s["attr-soldermask-bottomlayer"]={title:"Bottom Soler",value:this.getCompareValue("attr-soldermask-bottomlayer",e.expansionType===1?"Follow Rule":h)});let d=e.net,p=0;this._netLengthMap.has(d)?p=this._netLengthMap.get(d):(p=Ye.getNetLength(d),this._netLengthMap.set(d,p)),(s["attr-net-length"]==null||s["attr-net-length"].value!=Ve)&&(s["attr-net-length"]={title:"Net Length",value:this.getCompareValue("attr-net-length",je(p,void 0,i,this.unitConversion))});let m=e.padRule;if(m?((s["attr-pad-thermal-type"]==null||s["attr-pad-thermal-type"].value!=Ve)&&(s["attr-pad-thermal-type"]={title:"Thermal",value:this.getCompareValue("attr-pad-thermal-type",2)}),(s["attr-pad-connection"]==null||s["attr-pad-connection"].value!=Ve)&&(s["attr-pad-connection"]={title:"Pad Connection",value:this.getCompareValue("attr-pad-connection",m.connectMode)}),(s["attr-spoke-angles"]==null||s["attr-spoke-angles"].value!=Ve)&&(s["attr-spoke-angles"]={title:"Spoke Angles",value:this.getCompareValue("attr-spoke-angles",ve(m.lineAngle/Math.PI*180,3))}),(s["attr-spoke-width"]==null||s["attr-spoke-width"].value!=Ve)&&(s["attr-spoke-width"]={title:"Spoke Width",value:this.getCompareValue("attr-spoke-width",je(m.lineWidth,void 0,i,this.unitConversion))}),(s["attr-spoke-spacing"]==null||s["attr-spoke-spacing"].value!=Ve)&&(s["attr-spoke-spacing"]={title:"Spoke Spacing",value:this.getCompareValue("attr-spoke-spacing",je(m.lineClearance,void 0,i,this.unitConversion))})):(s["attr-pad-thermal-type"]==null||s["attr-pad-thermal-type"].value!=Ve)&&(s["attr-pad-thermal-type"]={title:"Thermal",value:this.getCompareValue("attr-pad-thermal-type",1)}),l!=null&&l instanceof ke){let P=$o.getInstance().getPadLenByModel(e.model);(s["attr-pad-len"]==null||s["attr-pad-len"].value!=Ve)&&(s["attr-pad-len"]={title:"Pin length",value:this.getCompareValue("attr-pad-len",je(P,void 0,i,this.unitConversion))})}else if(R.getInstance().doctype==pi.FOOTPRINT){let P=e.padLen;(s["attr-pad-len"]==null||s["attr-pad-len"].value!=Ve)&&(s["attr-pad-len"]={title:"Pin length",value:this.getCompareValue("attr-pad-len",je(P,void 0,i,this.unitConversion))})}let g=e.attrsMap,y=new Array;for(let P in g){let T=g[P],I={key:P,value:T,update:!1};!I.update&&l!=null&&l instanceof ke&&((b=Hi.getItem(l.footprintUUID).getModelBy(e.model.modelType,e.globalIndex.replace(l.globalIndex,"")).attrsMap)==null?void 0:b[P])==T?I.update=!1:I.update=!0,y.push(I)}return this.unionAttribute=this.getUnionAttrs(this.unionAttribute,y,e.globalIndex),this.interAttribute=this.getIntersectionAttrs(this.interAttribute,y),(s["attr-array"]==null||s["attr-array"].value!=Ve)&&(s["attr-array"]={title:"Attribute",value:Array.from(this.interAttribute.values())}),this}modifyBy(e,r){let i=new dt,n=R.getInstance().origin,s=e["attr-layerid"];s!=null&&(this.pad.layerId=parseInt(s));for(let a in e)if(a=="attr-layerid")this.pad.layerId=parseInt(e[a]);else if(a=="attr-select-net")this.pad.net=e[a],_A(this.pad,r);else if(a=="attr-combination"){let l=this.modifyCombination(e[a],this.pad);r&&l.forEach(c=>r.addCommand(c))}else if(a=="attr-number")this.pad.num=e[a];else if(a=="attr-x"||a=="attr-y"){if(this.pad.locked)continue;let l=parseFloat(e[a])/10;R.getInstance().unit!="mil"&&(l=i.conversion(R.getInstance().unit,"mil",l));let c;a=="attr-x"?c=new S(l+n.x,this.pad.center.y):c=new S(this.pad.center.x,l+n.y);let h=this.pad.getParent();if(_d.moveWhole&&h instanceof ke){r.addCommand(Ce.dispatch(h,"modify"));let u=Ae.translate(c.x-this.pad.center.x,c.y-this.pad.center.y,0);this.pad.getParent().transform(u),A.publish("flushSelectingInfo","")}else this.pad.center=c}else if(a=="attr-rotation"){let l=parseFloat(e[a])/180*Math.PI;this.pad.rotation=l}else if(a=="attr-locked"){let l=e[a]=="yes",c=this.pad.getParent();c!=null&&c instanceof ke?(r.addCommand(Ce.dispatch(c,"modify")),c.locked=l,this.pad.locked=l):this.pad.locked=l}else if(a=="attr-pad-hole-shape")this.pad.holeShape=e[a];else if(a=="attr-pad-hole-diameter"){let l=parseFloat(e[a])/10;R.getInstance().unit!="mil"&&(l=i.conversion(R.getInstance().unit,"mil",l)),this.pad.holeRadius=l/2}else if(a=="attr-pad-hole-length"){let l=parseFloat(e[a])/10;R.getInstance().unit!="mil"&&(l=i.conversion(R.getInstance().unit,"mil",l)),this.pad.holeLength=l}else if(a=="attr-pad-hole-width"){let l=parseFloat(e[a])/20;R.getInstance().unit!="mil"&&(l=i.conversion(R.getInstance().unit,"mil",l)),this.pad.holeRadius=l}else if(a=="attr-pad-hole-rotation"){let l=parseFloat(e[a])/180*Math.PI;this.pad.holeRotation=l}else if(a=="attr-pad-offset-x"){let l=parseFloat(e[a])/10;R.getInstance().unit!="mil"&&(l=i.conversion(R.getInstance().unit,"mil",l)),this.pad.holeOffset=new S(l,this.pad.holeOffset.y)}else if(a=="attr-pad-offset-y"){let l=parseFloat(e[a])/10;R.getInstance().unit!="mil"&&(l=i.conversion(R.getInstance().unit,"mil",l)),this.pad.holeOffset=new S(this.pad.holeOffset.x,l)}else if(a=="attr-pad-plated"){let l=e[a]=="yes";this.pad.plated=l}else if(a=="attr-soldermask-showtype")this.pad.expansionType=parseInt(e[a]);else if(a=="attr-pastemask"){let l=parseFloat(e[a])/10;isNaN(l)||(R.getInstance().unit!="mil"&&(l=i.conversion(R.getInstance().unit,"mil",l)),this.pad.pasteExpansion=l)}else if(a=="attr-soldermask"){let l=parseFloat(e[a])/10;isNaN(l)||(R.getInstance().unit!="mil"&&(l=i.conversion(R.getInstance().unit,"mil",l)),this.pad.layerId==1?this.pad.topSolderExpansion=l:this.pad.layerId==2&&(this.pad.bottomSolderExpansion=l))}else if(a=="attr-soldermask-toplayer"){let l=parseFloat(e[a])/10;isNaN(l)||(R.getInstance().unit!="mil"&&(l=i.conversion(R.getInstance().unit,"mil",l)),this.pad.topSolderExpansion=l)}else if(a=="attr-soldermask-bottomlayer"){let l=parseFloat(e[a])/10;isNaN(l)||(R.getInstance().unit!="mil"&&(l=i.conversion(R.getInstance().unit,"mil",l)),this.pad.bottomSolderExpansion=l)}else if(a=="attr-pad-thermal-type"){let l=parseInt(e[a]);this.pad.padRuleType=l}else if(a=="attr-pad-connection")if(+e[a]===0){let l=re.getInstance().getRuleByNet(this.pad.net,10),c=this.pad.layerId!==12,h=this.pad.layerId;this.pad.padRule=qh.getPadRule(+e[a],c?l.getSingleLineClearance(h):l.getMultiLineClearance(),c?l.getSingleLineWidth(h):l.getMultiLineWidth(),c?l.getSingleLineAngle(h):l.getMultiLineAngle())}else this.pad.padRule=qh.getPadRuleByconnectMode(+e[a],this.pad.padRule);else if(a=="attr-spoke-width"){let l=parseFloat(e[a])/10;isNaN(l)||(R.getInstance().unit!="mil"&&(l=i.conversion(R.getInstance().unit,"mil",l)),this.pad.padRule=qh.getPadRuleBylineWidth(l,this.pad.padRule))}else if(a=="attr-spoke-angles")this.pad.padRule=qh.getPadRuleBylineAngle(parseFloat(e[a])*Math.PI/180,this.pad.padRule);else if(a=="attr-spoke-spacing"){let l=parseFloat(e[a])/10;isNaN(l)||(R.getInstance().unit!="mil"&&(l=i.conversion(R.getInstance().unit,"mil",l)),this.pad.padRule=qh.getPadRuleBylineClearance(l,this.pad.padRule))}else if(a=="attr-pad-len"){let l=parseFloat(e[a])/10;isNaN(l)||(R.getInstance().unit!="mil"&&(l=i.conversion(R.getInstance().unit,"mil",l)),R.getInstance().doctype==pi.FOOTPRINT?this.pad.padLen=l:$o.getInstance().setPadLenByModel(this.pad.model,l))}else if(a=="attr-array"){let l=e[a];for(let c of l)c.update==null||c.update?c.isAdd?this.updateAttr(c,this.pad):this.pad.attrsMap[c.key]!==void 0&&this.updateAttr(c,this.pad):this.restoreAttr(c,this.pad)}}updateAttr(e,r){e.value!==Ve&&r.modifyATTRMap(e.key,e.value||"")}restoreAttr(e,r){var n;let i=r.getParent();if(i&&i instanceof ke){let l=(n=Hi.getItem(i.footprintUUID).getModelBy(r.model.modelType,r.globalIndex.replace(i.globalIndex,"")).attrsMap)==null?void 0:n[e.key];l?r.modifyATTRMap(e.key,l.toString()):r.deleteATTRMap(e.key)}else r.deleteATTRMap(e.key)}isShapeChange(e){let r=["attr-layerid","attr-x","attr-y","attr-rotation","attr-pad-hole-shape","attr-pad-hole-diameter","attr-pad-hole-length","attr-pad-hole-width","attr-pad-hole-rotation","attr-pad-offset-x","attr-pad-offset-y","attr-pad-plated","attr-soldermask-showtype","attr-pastemask","attr-soldermask","attr-soldermask-toplayer","attr-soldermask-bottomlayer","attr-pad-thermal-type","attr-pad-connection","attr-spoke-angles","attr-spoke-spacing","attr-spoke-width"];for(let i in e){if(["attr-x","attr-y"].includes(i)&&_d.moveWhole)return!1;if(r.indexOf(i)>=0)return!0}return!1}getPrimitive(e){let r=new Array;for(let i of e)if(i instanceof mt)r.push(new M(i.start,i.end));else{let n=i.startAngle/Math.PI*180,s=i.startAngle===i.endAngle?360:i.endAngle/Math.PI*180,a=q.build2(i.center,n,s,i.radius,i.radius,i.sweep);r.push(a)}return r}checkDrillInInner(){let e=this.pad.pl,r=this.pad.getMathGraphics();return Gy.build2(e,r).inInner()}getHoleShapeOption(){return[{value:"SLOT",text:"Slot"},{value:"ROUND",text:"Round"}]}clearCache(){var e,r;super.clearCache(),this._netLengthMap=new Map,this.existingInDevice=!1,(e=this.unionAttribute)==null||e.clear(),(r=this.interAttribute)==null||r.clear(),this.unionAttribute=null,this.interAttribute=null,this.attrIdMap={}}getUnionAttrs(e,r,i){e==null&&(e=new Map);for(let n of r){let s=e.get(n.key);this.attrIdMap[n.key]==null&&(this.attrIdMap[n.key]=[]),this.attrIdMap[n.key].push(i),s!=null?(n.value!=s.value&&(s.value=Ve),this.hasTrue(n.update,s.update)&&(s.update=!0)):e.set(n.key,n)}return e}getIntersectionAttrs(e,r){if(e==null||!e.size){e=new Map;for(let i of r)e.set(i.key,i);return e}else{let i=new Set(e.keys());for(let n of r){let s=e.get(n.key);s!=null&&(n.value!=s.value&&(s.value=Ve),this.hasTrue(n.update,s.update)&&(s.update=!0)),i.delete(n.key)}for(let n of i)e.delete(n);return e}}hasTrue(e,r){return e||r}updateAttrlist4OnlyPads(){this.attrlist["attr-array"]={title:"Attribute",value:Array.from(this.unionAttribute.values())}}};var Fue=class extends kl{constructor(){super(),this._netLengthMap=new Map,this.track=null}set(t){return this.track=t,this}getHtmlData(t){this.idList.push(t.globalIndex),this.count++;let e=R.getInstance().unit,r=R.getInstance().origin;this.attrlist==null&&(this.attrlist={});let i=this.attrlist;(i["attr-layerid"]==null||i["attr-layerid"].value!=Ve)&&(i["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",t.layerId),options:this.poolCache.trackLayerOptions}),(i["attr-locked"]==null||i["attr-locked"].value!=Ve)&&(i["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",t.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),(i["attr-id"]==null||i["attr-id"].value!=Ve)&&(i["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${Tr}${t.number}`),sourceId:t.globalIndex}),(i["attr-combination"]==null||i["attr-combination"].value!=Ve)&&(i["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",Ht.getGroupNameByGroupId(t.getGroupID())||""),options:this.poolCache.combinationOptions,hasParent:t.getParent()!=null}),(i["attr-select-net"]==null||i["attr-select-net"].value!=Ve)&&(i["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",t.showNet),options:this.poolCache.allNetOptions||Ye.getNet()}),(i["attr-stroke-width"]==null||i["attr-stroke-width"].value!=Ve)&&(i["attr-stroke-width"]={title:"Stroke Width",value:this.getCompareValue("attr-stroke-width",je(t.width,void 0,e,this.unitConversion).toString())}),(i["attr-track-length"]==null||i["attr-track-length"].value!=Ve)&&(i["attr-track-length"]={title:"Track Length",value:this.getCompareValue("attr-track-length",je(t.length,void 0,e,this.unitConversion))}),(i["attr-start-x"]==null||i["attr-start-x"].value!=Ve)&&(i["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",je(t.start.x-r.x,void 0,e,this.unitConversion))}),(i["attr-start-y"]==null||i["attr-start-y"].value!=Ve)&&(i["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",je(t.start.y-r.y,void 0,e,this.unitConversion))}),(i["attr-end-x"]==null||i["attr-end-x"].value!=Ve)&&(i["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",je(t.end.x-r.x,void 0,e,this.unitConversion))}),(i["attr-end-y"]==null||i["attr-end-y"].value!=Ve)&&(i["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",je(t.end.y-r.y,void 0,e,this.unitConversion))});let n=t.net,s=0;return this._netLengthMap.has(n)?s=this._netLengthMap.get(n):(s=Ye.getNetLength(n),this._netLengthMap.set(n,s)),(i["attr-net-length"]==null||i["attr-net-length"].value!=Ve)&&(i["attr-net-length"]={title:"Net Length",value:this.getCompareValue("attr-net-length",je(s,void 0,e,this.unitConversion))}),this}clearCache(){super.clearCache(),this._netLengthMap.clear()}modifyBy(t,e,r){let i=new dt,n=R.getInstance().origin;for(let s in t)if(s=="attr-layerid"){if(this.track.locked)continue;let a=parseInt(t[s]);this.track.layerId=a}else if(s=="attr-locked"){let a=t[s]=="yes";this.track.locked=a}else if(s=="attr-stroke-width"){let a=parseFloat(t[s])/10;R.getInstance().unit!="mil"&&(a=i.conversion(R.getInstance().unit,"mil",a)),a>=gO&&(a=gO),a>=vc&&(this.track.width=a,le.pcbConfig.startTrackWidth=="last"&&(we.prevTrackWidth=this.track.width))}else if(s=="attr-track-length"){if(this.track.locked)continue;let a=parseFloat(t[s])/10;R.getInstance().unit!="mil"&&(a=i.conversion(R.getInstance().unit,"mil",a)),a>=yO&&(a=yO);let l=this.track.end.sub(this.track.start).normalize();if(a>=vc)if(t.hasMultiTrack){if(r.type=="shorten"){if(r.currentIndex==r.modifyIndex){let c=r.sum-r.offset,h=this.track.start.add(l.mul(c));this.track.end=h}if(r.currentIndex>r.modifyIndex){let c=Ce.dispatch(this.track,"delete");e.addCommand(c),A.publish("delete",this.track),this.track.remove()}}else if(r.currentIndex==r.modifyIndex){let c=this.track.length+(a-r.originLength),h=this.track.start.add(l.mul(c));this.track.end=h}}else{let c=this.track.start.add(l.mul(a));this.track.end=c}}else if(s=="attr-start-x"){if(this.track.locked)continue;let a=parseFloat(t[s])/10;R.getInstance().unit!="mil"&&(a=i.conversion(R.getInstance().unit,"mil",a)),a=a+n.x;let l=new S(a,this.track.start.y);this.track.start=l}else if(s=="attr-start-y"){if(this.track.locked)continue;let a=parseFloat(t[s])/10;R.getInstance().unit!="mil"&&(a=i.conversion(R.getInstance().unit,"mil",a)),a=a+n.y;let l=new S(this.track.start.x,a);this.track.start=l}else if(s=="attr-end-x"){if(this.track.locked)continue;let a=parseFloat(t[s])/10;R.getInstance().unit!="mil"&&(a=i.conversion(R.getInstance().unit,"mil",a)),a=a+n.x;let l=new S(a,this.track.end.y);this.track.end=l}else if(s=="attr-end-y"){if(this.track.locked)continue;let a=parseFloat(t[s])/10;R.getInstance().unit!="mil"&&(a=i.conversion(R.getInstance().unit,"mil",a)),a=a+n.y;let l=new S(this.track.end.x,a);this.track.end=l}else s=="attr-select-net"?this.track.net=t[s]:s=="attr-combination"&&this.modifyCombination(t[s],this.track).forEach(l=>{e.addCommand(l)})}isNeedAddVia(t){for(let e of t)if(e["attr-layerid"]!=null)return!0;return!1}};var Vue=class extends kl{constructor(){super(),this._netLengthMap=new Map,this.track=null}set(t){return this.track=t,this}getHtmlData(t){this.idList.push(t.globalIndex),this.count++;let e=R.getInstance().unit,r=R.getInstance().origin;this.attrlist==null&&(this.attrlist={});let i=this.attrlist;if((i["attr-track-type"]==null||i["attr-track-type"].value!=Ve)&&(i["attr-track-type"]={title:"Type",value:this.getCompareValue("attr-track-type",2)}),(i["attr-layerid"]==null||i["attr-layerid"].value!=Ve)&&(i["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",t.layerId),options:this.poolCache.trackLayerOptions}),(i["attr-locked"]==null||i["attr-locked"].value!=Ve)&&(i["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",t.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),(i["attr-id"]==null||i["attr-id"].value!=Ve)&&(i["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${Tr}${t.number}`),sourceId:t.globalIndex}),(i["attr-select-net"]==null||i["attr-select-net"].value!=Ve)&&(i["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",t.showNet),options:Ye.getNet()}),i["attr-combination"]==null||i["attr-combination"].value!=Ve){let l=t.getGroupID();i["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",l!=null&&Ht.getGroupNameByGroupId(l)||""),options:this.poolCache.combinationOptions,hasParent:t.getParent()!=null}}(i["attr-stroke-width"]==null||i["attr-stroke-width"].value!=Ve)&&(i["attr-stroke-width"]={title:"Line Width",value:this.getCompareValue("attr-stroke-width",je(t.width,void 0,e,this.unitConversion).toString())}),(i["attr-track-length"]==null||i["attr-track-length"].value!=Ve)&&(i["attr-track-length"]={title:"Length",value:this.getCompareValue("attr-track-length",je(t.length,void 0,e,this.unitConversion))}),(i["attr-track-outline-type"]==null||i["attr-track-outline-type"].value!=Ve)&&(i["attr-track-outline-type"]={title:"Type",value:this.getCompareValue("attr-track-outline-type",4)});let n=t.arcType;(i["attr-arc-type"]==null||i["attr-arc-type"].value!=Ve)&&(i["attr-arc-type"]={title:"Type",value:this.getCompareValue("attr-arc-type",n)}),n==1?((i["attr-start-x"]==null||i["attr-start-x"].value!=Ve)&&(i["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",je(t.start.x-r.x,void 0,e,this.unitConversion))}),(i["attr-start-y"]==null||i["attr-start-y"].value!=Ve)&&(i["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",je(t.start.y-r.y,void 0,e,this.unitConversion))}),(i["attr-end-x"]==null||i["attr-end-x"].value!=Ve)&&(i["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",je(t.end.x-r.x,void 0,e,this.unitConversion))}),(i["attr-end-y"]==null||i["attr-end-y"].value!=Ve)&&(i["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",je(t.end.y-r.y,void 0,e,this.unitConversion))}),(i["attr-arc-angle"]==null||i["attr-arc-angle"].value!=Ve)&&(i["attr-arc-angle"]={title:"Arc Angle",value:this.getCompareValue("attr-arc-angle",ve(t.angle/Math.PI*180,3))})):((i["attr-x"]==null||i["attr-x"].value!=Ve)&&(i["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",je(t.center.x-r.x,void 0,e,this.unitConversion))}),(i["attr-y"]==null||i["attr-y"].value!=Ve)&&(i["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",je(t.center.y-r.y,void 0,e,this.unitConversion))}),(i["attr-radius"]==null||i["attr-radius"].value!=Ve)&&(i["attr-radius"]={title:"Radius",value:this.getCompareValue("attr-radius",je(t.radius,void 0,e,this.unitConversion))}),(i["attr-start-arc-angle"]==null||i["attr-start-arc-angle"].value!=Ve)&&(i["attr-start-arc-angle"]={title:"Start Angle",value:this.getCompareValue("attr-start-arc-angle",ve(t.startAngle/Math.PI*180,3))}),(i["attr-end-arc-angle"]==null||i["attr-end-arc-angle"].value!=Ve)&&(i["attr-end-arc-angle"]={title:"End Angle",value:this.getCompareValue("attr-end-arc-angle",ve(t.endAngle/Math.PI*180,3))}));let s=t.net,a=0;return this._netLengthMap.has(s)?a=this._netLengthMap.get(s):(a=Ye.getNetLength(s),this._netLengthMap.set(s,a)),(i["attr-net-length"]==null||i["attr-net-length"].value!=Ve)&&(i["attr-net-length"]={title:"Net Length",value:this.getCompareValue("attr-net-length",je(a,void 0,e,this.unitConversion))}),this}clearCache(){this._netLengthMap.clear(),super.clearCache()}modifyBy(t,e,r){if(this.track==null)return;let i=new dt,n=R.getInstance().origin;for(let s in t)if(s=="attr-layerid"){let a=parseInt(t[s]);this.track.layerId=a}else if(s=="attr-locked"){let a=t[s]=="yes";this.track.locked=a}else if(s=="attr-stroke-width"){let a=parseFloat(t[s])/10;R.getInstance().unit!="mil"&&(a=i.conversion(R.getInstance().unit,"mil",a)),a>=vc&&(this.track.width=oo(a),le.pcbConfig.startTrackWidth=="last"&&(we.prevTrackWidth=this.track.width))}else if(s=="attr-track-length"){let a=parseFloat(t[s])/10;if(R.getInstance().unit!="mil"&&(a=i.conversion(R.getInstance().unit,"mil",a)),a>=vc){let l=this.track.end.sub(this.track.start).normalize();if(t.hasMultiTrack){if(r!=null&&r.type=="shorten"){if(r.currentIndex==r.modifyIndex){let c=r.sum-r.offset;this.track.length=c}if(r.currentIndex>r.modifyIndex&&e!=null){let c=Ce.dispatch(this.track,"delete");e.addCommand(c),A.publish("delete",this.track),this.track.remove()}}else if(r!=null&&r.currentIndex==r.modifyIndex&&e!=null){let c=a-r.originLength,h=this.track.end.add(l.mul(c)),u=pr.addTrack(this.track.layerId,this.track.end,h,this.track.width,!1,this.track.net),d=Ce.dispatch(u,"add");A.publish("hasModifyPcbItem",u),e.addCommand(d),this.handleSelectAddTrack(u)}}else{let c=this.track.start.add(l.mul(a));this.track.end=c}}}else if(s=="attr-start-x"){let a=parseFloat(t[s])/10;R.getInstance().unit!="mil"&&(a=i.conversion(R.getInstance().unit,"mil",a)),a=a+n.x;let l=new S(a,this.track.start.y);this.track.start=l}else if(s=="attr-start-y"){let a=parseFloat(t[s])/10;R.getInstance().unit!="mil"&&(a=i.conversion(R.getInstance().unit,"mil",a)),a=a+n.y;let l=new S(this.track.start.x,a);this.track.start=l}else if(s=="attr-end-x"){let a=parseFloat(t[s])/10;R.getInstance().unit!="mil"&&(a=i.conversion(R.getInstance().unit,"mil",a)),a=a+n.x;let l=new S(a,this.track.end.y);this.track.end=l}else if(s=="attr-end-y"){let a=parseFloat(t[s])/10;R.getInstance().unit!="mil"&&(a=i.conversion(R.getInstance().unit,"mil",a)),a=a+n.y;let l=new S(this.track.end.x,a);this.track.end=l}else if(s=="attr-select-net")this.track.net=t[s];else if(s=="attr-combination"){let a=this.modifyCombination(t[s],this.track);e!=null&&a.forEach(l=>{e.addCommand(l)})}else if(s=="attr-arc-angle"){let a=parseFloat(t[s])/180*Math.PI;isNaN(a)||(this.track.angle=a)}else if(s=="attr-arc-type")this.track.arcType=parseInt(t[s]);else if(s=="attr-start-arc-angle"){let a=parseFloat(t[s])/180*Math.PI;isNaN(a)||(this.track.startAngle=a)}else if(s=="attr-end-arc-angle"){let a=parseFloat(t[s])/180*Math.PI;isNaN(a)||(this.track.endAngle=a)}else if(s=="attr-x"){let a=parseFloat(t["attr-x"])/10;R.getInstance().unit!="mil"&&(a=i.conversion(R.getInstance().unit,"mil",a)),a=a+n.x,this.track.center=new S(a,this.track.center.y)}else if(s=="attr-y"){let a=parseFloat(t["attr-y"])/10;R.getInstance().unit!="mil"&&(a=i.conversion(R.getInstance().unit,"mil",a)),a=a+n.y,this.track.center=new S(this.track.center.x,a)}else if(s=="attr-radius"){let a=parseFloat(t[s])/10;R.getInstance().unit!="mil"&&(a=i.conversion(R.getInstance().unit,"mil",a)),this.track.radius=a}}isNeedAddVia(t){for(let e of t)if(e["attr-layerid"]!=null)return!0;return!1}handleSelectAddTrack(t){let e=ze.getSelects(),r=new Array;e.push(t),A.publish("clearSelect",""),e.forEach(i=>{r.push(i),i.click()}),A.publish("select",r)}};var Gue=class extends kl{constructor(){super();this.existingInDevice=!1;this._netLengthMap=new Map,this.via=null}set(e){return this.via=e,this}getExtra(){return{existingInDevice:this.existingInDevice}}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=R.getInstance().unit,i=R.getInstance().origin;this.attrlist==null&&(this.attrlist={});let n=this.attrlist,s=e.getParent();if(e.getParent()!=null){let d=e.getParent();d instanceof ke&&((n["attr-footprint-id"]==null||n["attr-footprint-id"].value!=Ve)&&(n["attr-footprint-id"]={title:"Footprint ID",value:this.getCompareValue("attr-footprint-id",d.footprintId)}),this.existingInDevice=!0)}else(n["attr-footprint-id"]==null||n["attr-footprint-id"].value!=Ve)&&(n["attr-footprint-id"]={title:"Footprint ID",value:this.getCompareValue("attr-footprint-id","")});(n["attr-via-buriedhole-showtype"]==null||n["attr-via-buriedhole-showtype"].value!=Ve)&&(n["attr-via-buriedhole-showtype"]={title:"Type",value:this.getCompareValue("attr-via-buriedhole-showtype",e.type==1?2:1)}),(n["attr-start-layerid"]==null||n["attr-start-layerid"].value!=Ve)&&(n["attr-start-layerid"]={title:"Start Layer",value:this.getCompareValue("attr-start-layerid",e.startLayer),options:Un.via()}),(n["attr-end-layerid"]==null||n["attr-end-layerid"].value!=Ve)&&(n["attr-end-layerid"]={title:"End Layer",value:this.getCompareValue("attr-end-layerid",e.endLayer),options:Un.via()});let l=re.getInstance().getDefaultBlindPhysics().getOptions();e.type==1?(n["attr-via-buriedhole-type"]==null||n["attr-via-buriedhole-type"].value!=Ve)&&(n["attr-via-buriedhole-type"]={title:"Buried Hole Type",value:this.getCompareValue("attr-via-buriedhole-type",e.name),options:l,disabled:this.getCompareDisabledValue("attr-via-buriedhole-type",s!=null)}):(n["attr-via-buriedhole-type"]==null||n["attr-via-buriedhole-type"].value!=Ve)&&(n["attr-via-buriedhole-type"]={title:"Buried Hole Type",value:"",options:l,disabled:this.getCompareDisabledValue("attr-via-buriedhole-type",s!=null)}),(n["attr-select-net"]==null||n["attr-select-net"].value!=Ve)&&(n["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",e.showNet),options:this.poolCache.allNetOptions||Ye.getNet()}),(n["attr-id"]==null||n["attr-id"].value!=Ve)&&(n["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${Tr}${e.number}`),sourceId:e.globalIndex}),(n["attr-combination"]==null||n["attr-combination"].value!=Ve)&&(n["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",Ht.getGroupNameByGroupId(e.getGroupID())||""),options:this.poolCache.combinationOptions,hasParent:e.getParent()!=null}),(n["attr-via-general-outerdiameter"]==null||n["attr-via-general-outerdiameter"].value!=Ve)&&(n["attr-via-general-outerdiameter"]={title:"Normal Outer Diameter",value:this.getCompareValue("attr-via-general-outerdiameter",je(e.radius*2,void 0,r,this.unitConversion))}),(n["attr-via-general-innerdiameter"]==null||n["attr-via-general-innerdiameter"].value!=Ve)&&(n["attr-via-general-innerdiameter"]={title:"Normal inner Diameter",value:this.getCompareValue("attr-via-general-innerdiameter",je(e.holeRadius*2,void 0,r,this.unitConversion))}),(n["attr-x"]==null||n["attr-x"].value!=Ve)&&(n["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",je(e.center.x-i.x,void 0,r,this.unitConversion))}),(n["attr-y"]==null||n["attr-y"].value!=Ve)&&(n["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",je(e.center.y-i.y,void 0,r,this.unitConversion))});let c=e.locked;s!=null&&s instanceof ke&&s.locked&&(c=s.locked),(n["attr-locked"]==null||n["attr-locked"].value!=Ve)&&(n["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",c?"yes":"no")}),(n["attr-soldermask-showtype"]==null||n["attr-soldermask-showtype"].value!=Ve)&&(n["attr-soldermask-showtype"]={title:"Solder Resist",value:this.getCompareValue("attr-soldermask-showtype",e.expansionType)}),(n["attr-soldermask-toplayer"]==null||n["attr-soldermask-toplayer"].value!=Ve)&&(n["attr-soldermask-toplayer"]={title:"TopLayer Solder Mask Expansion",value:this.getCompareValue("attr-soldermask-toplayer",e.expansionType===1?"Follow Rule":je(e.topExpansion,void 0,r,this.unitConversion))}),(n["attr-soldermask-bottomlayer"]==null||n["attr-soldermask-bottomlayer"].value!=Ve)&&(n["attr-soldermask-bottomlayer"]={title:"BottomLayer Solder Mask Expansion",value:this.getCompareValue("attr-soldermask-bottomlayer",e.expansionType===1?"Follow Rule":je(e.bottomExpansion,void 0,r,this.unitConversion))});let h=e.net,u=0;return this._netLengthMap.has(h)?u=this._netLengthMap.get(h):(u=Ye.getNetLength(h),this._netLengthMap.set(h,u)),(n["attr-net-length"]==null||n["attr-net-length"].value!=Ve)&&(n["attr-net-length"]={title:"Net Length",value:this.getCompareValue("attr-net-length",je(u,void 0,r,this.unitConversion))}),this}clearCache(){super.clearCache(),this._netLengthMap.clear(),this.existingInDevice=!1}modifyBy(e,r){let i=R.getInstance().unit,n=R.getInstance().origin,s=new dt;for(let a in e)if(a=="attr-start-layerid"){let l=parseInt(e[a]);this.via.startLayer=l}else if(a=="attr-end-layerid"){let l=parseInt(e[a]);this.via.endLayer=l}else if(a=="attr-via-buriedhole-showtype"){let l=parseInt(e[a])==1?0:1;this.via.type=l,ML(this.via)}else if(a=="attr-via-buriedhole-type"){let l=e[a];l!=""?this.via.type=1:this.via.type=0,this.via.name=l,this.via.model.updateBox(),ML(this.via)}else if(a=="attr-select-net"){let l=e[a];this.via.net=l,ut.setDefaultVia({net:l,holeRadius:null,radius:null},!1)}else if(a=="attr-combination")this.modifyCombination(e[a],this.via).forEach(c=>{r.addCommand(c)});else if(a=="attr-via-general-outerdiameter"){let l=parseFloat(e[a])/20;R.getInstance().unit!="mil"&&(l=s.conversion(R.getInstance().unit,"mil",l)),l>=vc/2&&(this.via.radius=l,le.pcbConfig.startViaSize=="last"&&ut.setDefaultVia({net:null,holeRadius:null,radius:l},!1))}else if(a=="attr-soldermask-showtype"){let l=parseInt(e[a]);this.via.expansionType=l}else if(a=="attr-via-general-innerdiameter"){let l=parseFloat(e[a])/20;R.getInstance().unit!="mil"&&(l=s.conversion(R.getInstance().unit,"mil",l)),l>=vc/2&&(this.via.holeRadius=l,le.pcbConfig.startViaSize=="last"&&ut.setDefaultVia({net:null,holeRadius:l,radius:null},!1))}else if(a=="attr-x"){if(this.via.locked)continue;let l=parseFloat(e[a])/10;R.getInstance().unit!="mil"&&(l=s.conversion(R.getInstance().unit,"mil",l)),l=l+n.x;let c=new S(l,this.via.center.y);this.via.center=c}else if(a=="attr-y"){if(this.via.locked)continue;let l=parseFloat(e[a])/10;R.getInstance().unit!="mil"&&(l=s.conversion(R.getInstance().unit,"mil",l)),l=l+n.y;let c=new S(this.via.center.x,l);this.via.center=c}else if(a=="attr-locked"){let l=e[a]=="yes",c=this.via.getParent();c!=null&&c instanceof ke?(r.addCommand(Ce.dispatch(c,"modify")),c.locked=l):this.via.locked=l}else if(a=="attr-soldermask-toplayer"){let l=parseFloat(e[a])/10;R.getInstance().unit!="mil"&&(l=s.conversion(R.getInstance().unit,"mil",l)),this.via.topExpansion=l}else if(a=="attr-soldermask-bottomlayer"){let l=parseFloat(e[a])/10;R.getInstance().unit!="mil"&&(l=s.conversion(R.getInstance().unit,"mil",l)),this.via.bottomExpansion=l}}check(e){let r=new Set;for(let i of e){let n=i["attr-id"],s=Wr.getItem(n);i["attr-select-net"]!=null}return r}isShapeChange(e){let r=["attr-via-general-outerdiameter","attr-soldermask-showtype","attr-via-general-innerdiameter","attr-x","attr-y","attr-soldermask-toplayer","attr-soldermask-bottomlayer"];for(let i in e)if(r.indexOf(i)>=0)return!0;return!1}isNeedOpenNetDialog(e){for(let r of e){let i=r["attr-id"],n=Wr.getItem(i),s=r["attr-select-net"];if(s!=null&&s!=n.net&&this.getConnect(n))return!0}return!1}getNewNet(e){for(let r of e){let i=r["attr-select-net"];if(i!=null)return i.toUpperCase()}return""}getConnect(e){let r=kt.search4Types(e.buildBBox(),["Track","ArcTrack"]);for(let i of r.getTracks())if(jk(e.model,i.model)&&new uy().checkIntersection(e.model,i.model))return!0;return!1}};var Uue=class{constructor(){this.cbs=new Array}addTask(t){this.cbs.push(t)}execute(){this.cbs.forEach(t=>{t()}),this.cbs.length=0}};var LD=class{get pad(){return this._pad}set pad(t){this._pad=t,this.cb(t)}constructor(t){this.cb=t}};var AG=class extends Oo{constructor(){super(...arguments);this.lastHightLightPad=new Array}onMouseMove(e){this.clear();let r=Vr.pointSelectBeforeFilter(e.realSceneX,e.realSceneY).pads,i=new Array;for(let n of r)n instanceof Le&&i.push(n);if(i.length>0){let n=i[0];n.click(),this.lastHightLightPad.push(n),A.windowBridge.publish("setHighlightRowByNumber",n.num,Q())}else A.windowBridge.publish("setHighlightRowByNumber",null,Q())}clear(){for(let e of this.lastHightLightPad)e.visible();this.lastHightLightPad.length=0}};var kje=1.5,Hue=class extends Oo{constructor(){super();this.isMouseRightDown=!1;this.prevRightX=0;this.prevRightY=0;this.isMouseMidDown=!1;this.prevMidY=0;this.zoomCenter=Dt.ORIGIN;this.lastClickX=null;this.lastClickY=null;this.camera=Ai(),this.setNextTool(new Vc),A.subscribe("adaptAll",()=>{if(!(!R.getInstance().isactive||23!=R.getInstance().doctype)){if(kt.size()>0){let e=Kc(),r=new _e;e.forEach(n=>{if(n.isVisible){if(n instanceof lr&&n.getText()=="")return;r.ext1(n.buildBBox())}});let i=Pi.getBBox();if(i instanceof ht&&r.ext1(i),oa){let n=oa.buildBox();if(r.ext1(n),r.valid()){let s=r.build1();XT(this.camera,s,.8)}}else if(r.valid()){let n=r.build1();XT(this.camera,n,.8)}}A.publish("updateFrame","")}}),A.subscribe("adaptBBox",(e,r=.8)=>{XT(this.camera,e,r),A.publish("updateFrame","")}),A.messageBus.rpcService("FootprintPadSize",()=>new Promise((e,r)=>{let i=Qt.getAllItem(),n={};return i.forEach(s=>{let a=s.getDimensionBBox();n[s.num]={width:a.width()*10,height:a.height()*10,number:s.globalIndex}}),e(n)})),A.messageBus.rpcService("HighlightItemsInPreview",this.highlightItems.bind(this)),A.messageBus.rpcService("PreviewPanelize",e=>new L0().applyPanelize(e)),A.messageBus.subscribe("PreviewHighLightTool",()=>{let e=new AG;this.setNextTool(e)})}onKeyDown(e){A.publish("pcb_hotkey",{keyCode:e.keyCode,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey},Q())}onKeyUp(e){A.publish("pcb_hotkey",{keyCode:e.keyCode,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey},Q())}onMouseRightDown(e){this.prepare(e),e.realSceneDeltaX=0,e.realSceneDeltay=0,e.rightDown=!0,e.openMenu=!0,e.downTime=new Date().getTime(),this.isMouseRightDown=!0,this.prevRightX=e.mouseX,this.prevRightY=e.mouseY}onMouseLeftUp(e){e.leftDown=!1}onMouseRightUp(e){this.prepare(e),this.isMouseRightDown=!1,e.openMenu&&A.publish("showPreviewRightClickMenu",{x:e.mouseX,y:e.mouseY,iframeElementId:window.frameElement.id},Q()),e.rightDown=!1,e.openMenu=!1}onMouseMove(e){let r=new Date().getTime();if(this.isMouseRightDown){let i=e.mouseX-this.prevRightX,n=e.mouseY-this.prevRightY;this.camera.addOffset1(i,n),this.prevRightX=e.mouseX,this.prevRightY=e.mouseY}if(this.isMouseMidDown){let n=1-(e.mouseY-this.prevMidY)/e.canvasHeight*20;n<0&&(n=1),this.setScale(n),this.prevMidY=e.mouseY}this.prepare(e),e.rightDown&&r-e.downTime<120?e.openMenu=!0:e.rightDown&&(e.realSceneDeltaX!=0||e.realSceneDeltay!=0)&&(e.openMenu=!1),oa&&oa.onMouseMove(e)}onMouseWheel(e){this.prepare(e);let r;e.deltaY<0?r=kje:r=1/kje,this.markZoomCenter(e),this.setScale(r),this.prepare(e)}onResize(e){R.getInstance().resize()}prepare(e){let r=this.mouseRealOffset(e);e.realSceneDeltaX=r.x-e.realSceneX,e.realSceneDeltay=r.y-e.realSceneY,e.realSceneX=r.x,e.realSceneY=r.y}markZoomCenter(e){this.zoomCenter=new Dt(e.mouseX,e.mouseY,0)}setScale(e){let r=this.camera.getScale();!isNaN(r)&&r!=0&&this.camera.scaleAtPoint1(e,this.zoomCenter.x,this.zoomCenter.y)}mouseRealOffset(e){let r=new Dt(e.mouseX,-e.mouseY,0),i=new Dt(e.canvasWidth/2,-e.canvasHeight/2,0);return r.sub(i).multiply4(this.camera.get2dCameraMatrix().inverse())}highlightItems(e){if(A.publish("clearSelect",""),e.length==0)return;let r=new Jt;e.forEach(i=>{let n=Ht.getItem(i),s;if(n)n.getItems().forEach(a=>{a.click()});else{if(s=r.getItem(i),!s)return;jt.filter([s]).size>0&&(s instanceof Gi&&Pe.setActiveLayer(Pe.getLayer(s.layerId)),s.click())}}),A.publish("updateFrame","")}};function Wue(o){switch(o){case"autoLayout":return"autoLayout";case"printPDF":return"printPDF";case"openProject":return"OpenProject";case"createAnnotation":return"createAnnotation";case"placeDevice":return"placeDevice";case"newProject":return"NewProject";case"file_save":return"Save";case"close_tab":return"close_tab";case"close_all_tabs":return"close_all_tabs";case"save_all":return"SaveAll";case"tutorials":return"tutorials";case"operateBottomPanel":return"OperateBottomPanel";case"draw(arc)":return"DrawArc";case"draw(rect)":return"DrawRect";case"draw(circle)":return"DrawCircle";case"draw(polyline)":return"DrawPolyline";case"undo":return"Undo";case"redo":return"Redo";case"copy":return"Copy";case"copyToImage":return"copyToImage";case"copyToSvg":return"copyToSvg";case"copyToPng":return"copyToPng";case"cut":return"cut";case"duplicateToCursor":return"DuplicateToCursor";case"duplicateToOtherLayer":return"DuplicateToOtherLayer";case"paste":return"Paste";case"specialPaste":return"specialPaste";case"copySpecial":return"Copy Special";case"centerViewByCursor":return"CenterViewByCursor";case"MOVE_BY_CENTER_POINT":return"Move by Center Point";case"MOVE_BY_REFERENCE_POINT":return"MOVE_BY_REFERENCE_POINT";case"Delete":return"Delete Selected";case"full_screen":return"fullScreen";case"select_all":return"Select All";case"findObjects":return"Find and Replace";case"zoom(in)":return"Zoom In";case"zoom(out)":return"Zoom Out";case"fitview":return"Fit All in Window";case"Unit":return"Unit";case"showOrHideSelectedObjRatline":return"Show/Hide Selected Ratline";case"hideSelectedObjRatline":return"Hide Selected Ratline";case"showSelectedObjRatline":return"Show Selected Ratline";case"Highlight Selected Objects":return"HIGHLIGHT_SELECTED_OBJECTS";case"SwitchLayerBrightness":return"Switch Layer Brightness";case"Flip Board":return"Flip Board";case"PlaceSinglePad":return"Place Single Pad";case"place_part(testPad)":return"Place Test Point";case"PlaceVia":return"Place Via";case"PlaceViaFence":return"PlaceViaFence";case"groupSelected":return"Group Selected";case"ungroupSelected":return"Ungroup Selected";case"rotate_left":return"Rotate Left";case"align_left":return"Align Left";case"align_horizontal_center":return"Align Horizontal Centers";case"align_right":return"Align Right";case"align_top":return"Align Top";case"align_vertical_center":return"Align Vertical Centers";case"align_bottom":return"Align Bottom";case"align_grid":return"Align Grid";case"align_horizontal_equidistant":return"Horizontal Equidistant Distribution";case"align_vertical_equidistant":return"Vertical Equidistant Distribution";case"component_distribute_by_region":return"Component Distribute By Region";case"fliph":return"Flip Right and Left";case"flipv":return"Flip Up and Down";case"SingleRouting":return"Single Routing";case"MultiRouting":return"MultiRouting";case"IncreaseMultiSpace":return"IncreaseMultiSpace";case"decreaseMultiSpace":return"decreaseMultiSpace";case"draw(stretchtrack)":return"Stretch Track";case"RoutingCorner":return"Routing Corner";case"MeasureDistance":return"Measure Distance";case"Command":return"Command";case"RebuildAllCopperArea":return"Rebuild All Copper Area";case"finish":return"Finish";case"draw_end":return"Cancel";case"undoDraw":return"Backspace";case"SelectOverlap":return"Select Overlap";case"FilpPathWhileDrawing":return"Filp Path While Drawing";case"show_drawing_attr_dlg":return"Show Attribute Dialog When Placing Object";case"change_track_width_while_routing":return"Change Track Width While Routing";case"switch_common_track_width":return"Switch Common Track Width";case"switch_common_via_size":return"Switch Common Via Size While Routing/Placing Via";case"ChangetoTopLayer":return"ChangetoTopLayer";case"ChangetoBottomLayer":return"ChangetoBottomLayer";case"ChangetoInner1":return"ChangetoInner1";case"ChangetoInner2":return"ChangetoInner2";case"ChangetoInner3":return"ChangetoInner3";case"ChangetoInner4":return"ChangetoInner4";case"ChangetoInner5":return"ChangetoInner5";case"ChangetoInner6":return"ChangetoInner6";case"ChangeCopperZoneVisibleorInvisible":return"ChangeCopperZoneVisibleorInvisible";case"DisplayAllLayers":return"DisplayAllLayers";case"scrollLeft":return"Scroll Left";case"scrollRight":return"Scroll Right";case"scrollUp":return"Scroll Up";case"scrollDown":return"Scroll Down";case"highlightConnectedsByWire":return"Highlight Or Unhighlight Net";case"showOrHideNumberOrNetName":return"Show Or Hide Number Or Net Name";case"UnhighlightSelectedObjects":return"Unhighlight All";case"moveSelectedLeft":return"Move Selected Left";case"moveSelectedRight":return"Move Selected Right";case"moveSelectedUp":return"Move Selected Up";case"moveSelectedDown":return"Move Selected Down";case"switchToTheNextSignalLayer":return"Switch to the Next Signal Layer";case"switchToThePreviousSignalLayer":return"Switch to the Previous Signal Layer";case"switchToTheNextLayer":return"Switch to the Next Layer";case"switchToThePreviousLayer":return"Switch to the Previous Layer";case"crossProbe":return"pcbCrossProbe";case"increaseSnakeGap":return"increaseSnakeGap";case"decreaseSnakeGap":return"decreaseSnakeGap";case"changeDiffPairFanOutMode":return"changeDiffPairFanOutMode";case"switchSelectedRangeWhenObjectIsSelected":return"Switch Selected Range When Object Is Selected";case"switchNextDoc":return"switchNextDoc";case"switchPreDoc":return"switchPreDoc";case"setOriginByCoordinate":return"setOriginByCoordinate";case"draw(origin)":return"draw(origin)";case"placeOriginCenter":return"placeOriginCenter";case"draw(arcCenter)":return"draw(arcCenter)";case"layerOptionsSet":return"layerOptionsSet";case"displayRealTimeNetLengthAndLengthTolerance":return"displayRealTimeNetLengthAndLengthTolerance";case"draw(dimension)":return"draw(dimension)";case"draw(PCopper)":return"draw(PCopper)";case"switchToLayer(1)":return"switchToLayer(1)";case"switchToLayer(2)":return"switchToLayer(2)";case"placePad":return"placePad";case"changeRoutingAngle":return"changeRoutingAngle";case"changeRoutingMode":return"changeRoutingMode";case"importChangesFromSch":return"importChangesFromSch";case"importChangesFromPcb":return"importChangesFromPcb";case"reuseTemplateLayoutAndRoute":return"reuseTemplateLayoutAndRoute";case"showAbsoluteOffsetDialog":return"showAbsoluteOffsetDialog";case"showRelativeOffsetDialog":return"showRelativeOffsetDialog";case"expandAndModifyProperties":return"expandAndModifyProperties";case"toggleLocked":return"toggleLocked";case"toolbar_toggle(leftbar)":return"toolbar_toggle(leftbar)";case"toolbar_toggle(rightbar)":return"toolbar_toggle(rightbar)";case"switchPreDoc":return"switchPreDoc";case"switchNextDoc":return"switchNextDoc";case"switchNextDocByNatural":return"switchNextDocByNatural";case"switchPreDocByNatural":return"switchPreDocByNatural";case"draw(origin)":return"draw(origin)";case"setOriginByCoordinate":return"setOriginByCoordinate";case"draw(difftrack)":return"draw(difftrack)";case"equalLengthTuning":return"equalLengthTuning";case"toggleAdsorb":return"toggleAdsorb";case"openMenu(#mm-common-file)":return"openMenu(#mm-common-file)";case"openMenu(#mm-common-edit)":return"openMenu(#mm-common-edit)";case"openMenu(#mm-common-view)":return"openMenu(#mm-common-view)";case"openMenu(#mm-common-place)":return"openMenu(#mm-common-place)";case"openMenu(#mm-common-design)":return"openMenu(#mm-common-design)";case"openMenu(#mm-common-route)":return"openMenu(#mm-common-route)";case"openMenu(#mm-common-layout)":return"openMenu(#mm-common-layout)";case"openMenu(#mm-common-tools)":return"openMenu(#mm-common-tools)";case"openMenu(#mm-common-fabrication2)":return"openMenu(#mm-common-fabrication2)";case"openMenu(#mm-common-order)":return"openMenu(#mm-common-order)";case"openMenu(#mm-common-advanced)":return"openMenu(#mm-common-advanced)";case"openMenu(#mm-common-settings)":return"openMenu(#mm-common-settings)";case"openMenu(#mm-common-help)":return"openMenu(#mm-common-help)";case"new_board":return"new_board";case"new_schematic":return"new_schematic";case"new_PCB":return"new_PCB";case"new_Panel":return"new_Panel";case"new_device":return"new_device";case"new_NetFlag":return"new_NetFlag";case"new_NetPort":return"new_NetPort";case"new_Drawing":return"new_Drawing";case"new_Non_Electronic":return"new_Non_Electronic";case"new_schematicLib":return"new_schematicLib";case"new_footprint":return"new_footprint";case"new_3D_model":return"new_3D_model";case"new_CBB":return"new_CBB";case"standard_edition_migration":return"standard_edition_migration";case"projectSaveAsCloud":return"projectSaveAsCloud";case"projectSaveAsLocal":return"projectSaveAsLocal";case"docSaveAsCloud":return"docSaveAsCloud";case"docSaveAsLocal":return"docSaveAsLocal";case"selectedBSSaveAsCloud":return"selectedBSSaveAsCloud";case"selectedBSSaveAsLocal":return"selectedBSSaveAsLocal";case"backup":return"backup";case"version_management":return"version_management";case"new_node":return"new_node";case"new_branch":return"new_branch";case"recovery":return"recovery";case"cacheRecovery":return"cacheRecovery";case"importDXF":return"importDXF";case"insertImage":return"insertImage";case"importFile(easyeda)":return"importFile(easyeda)";case"file_open":return"file_open";case"importFile(altium)":return"importFile(altium)";case"importFile(eagle)":return"importFile(eagle)";case"importFile(kicad)":return"importFile(kicad)";case"importFile(pads)":return"importFile(pads)";case"importFile(protel)":return"importFile(protel)";case"importFile(ltspice)":return"importFile(ltspice)";case"importSes":return"importSes";case"importNetlist":return"importNetlist";case"exportBOM":return"exportBOM";case"pcb_fabrication":return"pcb_fabrication";case"pcb_export_coordinate_file":return"pcb_export_coordinate_file";case"export3DFile":return"export3DFile";case"export3DShellFile":return"export3DShellFile";case"openDxfExportDlg":return"openDxfExportDlg";case"export(filePdf)":return"export(filePdf)";case"exportTestPointReport":return"exportTestPointReport";case"exportManufacturingFilesForOneClick":return"exportManufacturingFilesForOneClick";case"export(altium)":return"export(altium)";case"exportDSN":return"exportDSN";case"closeProject":return"closeProject";case"clearRecentList":return"clearRecentList";case"source(easyEDA)":return"source(easyEDA)";case"MOVE_BY_ORIGIN_POINT":return"MOVE_BY_ORIGIN_POINT";case"delete-target":return"delete-target";case"delete-all":return"delete-all";case"continuousSelection":return"continuousSelection";case"rectangleOutside":return"rectangleOutside";case"rectangleInside":return"rectangleInside";case"polygonInside":return"polygonInside";case"polygonOutside":return"polygonOutside";case"lineTouched":return"lineTouched";case"connectedCopper":return"connectedCopper";case"editArray":return"editArray";case"ADD_FILLET":return"ADD_FILLET";case"ADD_CHAMFER":return"ADD_CHAMFER";case"unlockAll":return"unlockAll";case"connectPads":return"connectPads";case"Preview2D":return"Preview2D";case"Preview3D":return"Preview3D";case"Preview3DInNewWindow":return"Preview3DInNewWindow";case"fitview":return"fitview";case"adaptSelectionView":return"adaptSelectionView";case"adaptAreaSelectionView":return"adaptAreaSelectionView";case"fitBoard":return"fitBoard";case"switchView(normal)":return"switchView(normal)";case"switchView(outline)":return"switchView(outline)";case"brightness(0)":return"brightness(0)";case"brightness(1)":return"brightness(1)";case"brightness(2)":return"brightness(2)";case"gridSnapKeepRatio":return"gridSnapKeepRatio";case"setGridSize":return"setGridSize";case"setGridRange":return"setGridRange";case"switchGridType(outlets)":return"switchGridType(outlets)";case"switchGridType(grid)":return"switchGridType(grid)";case"switchGridType(none)":return"switchGridType(none)";case"hideSelectedComponentRatline":return"hideSelectedComponentRatline";case"hideAllRatline":return"hideAllRatline";case"showSelectedComponentRatline":return"showSelectedComponentRatline";case"showAllRatline":return"showAllRatline";case"HIGHLIGHT_COMPONENT":return"HIGHLIGHT_COMPONENT";case"HIGHLIGHT_SELECTED_OBJECTS":return"HIGHLIGHT_SELECTED_OBJECTS";case"HIGHLIGHT_CANCEL_COMPONENT":return"HIGHLIGHT_CANCEL_COMPONENT";case"HIGHLIGHT_CANCEL_SELECTED_OBJECTS":return"HIGHLIGHT_CANCEL_SELECTED_OBJECTS";case"toolbar_toggle(topbar)":return"toolbar_toggle(topbar)";case"boolIntersection":return"boolIntersection";case"boolAggregate":return"boolAggregate";case"boolSubtraction":return"boolSubtraction";case"boolExclusive":return"boolExclusive";case"boolSplit":return"boolSplit";case"draw(rectSutureVia)":return"draw(rectSutureVia)";case"draw(polygonSutureVia)":return"draw(polygonSutureVia)";case"draw(lineSutureVia)":return"draw(lineSutureVia)";case"place_part(line_pads)":return"place_part(line_pads)";case"place_part(rect_pads)":return"place_part(rect_pads)";case"draw(ROutline)":return"draw(ROutline)";case"draw(POutline)":return"draw(POutline)";case"draw(COutline)":return"draw(COutline)";case"Cutout":return"Cutout";case"draw(RCutout)":return"draw(RCutout)";case"draw(CCutout)":return"draw(CCutout)";case"draw(PCutout)":return"draw(PCutout)";case"avoidSlots":return"avoidSlots";case"avoidPads":return"avoidPads";case"draw(RCopper)":return"draw(RCopper)";case"draw(CCopper)":return"draw(CCopper)";case"draw(RRegion)":return"draw(RRegion)";case"draw(PRegion)":return"draw(PRegion)";case"draw(CRegion)":return"draw(CRegion)";case"draw(RectFPCStiffener)":return"draw(RectFPCStiffener)";case"draw(CirFPCStiffener)":return"draw(CirFPCStiffener)";case"draw(PolyFPCStiffener)":return"draw(PolyFPCStiffener)";case"draw(RSlot)":return"draw(RSlot)";case"draw(PSlot)":return"draw(PSlot)";case"draw(CSlot)":return"draw(CSlot)";case"draw(RProhibit)":return"draw(RProhibit)";case"draw(PProhibit)":return"draw(PProhibit)";case"draw(CProhibit)":return"draw(CProhibit)";case"draw(arc2)":return"draw(arc2)";case"place_part(testPad)":return"place_part(testPad)";case"place_part(autoTestPad)":return"place_part(autoTestPad)";case"showTextDialog_pcb":return"showTextDialog_pcb";case"draw(protractor)":return"draw(protractor)";case"draw(radius)":return"draw(radius)";case"place_part(stack_table)":return"place_part(stack_table)";case"place_part(drill_table)":return"place_part(drill_table)";case"placeOriginPad":return"placeOriginPad";case"draw(R3dShellOutline)":return"draw(R3dShellOutline)";case"draw(C3dShellOutline)":return"draw(C3dShellOutline)";case"draw(P3dShellOutline)":return"draw(P3dShellOutline)";case"place_part(3dShellScrewPillar)":return"place_part(3dShellScrewPillar)";case"draw(3dShellSideSlotDatumLine)":return"draw(3dShellSideSlotDatumLine)";case"draw(R3dShellSideSlotRegion)":return"draw(R3dShellSideSlotRegion)";case"draw(C3dShellSideSlotRegion)":return"draw(C3dShellSideSlotRegion)";case"draw(P3dShellSideSlotRegion)":return"draw(P3dShellSideSlotRegion)";case"draw(R3dShellTopSlotRegion)":return"draw(R3dShellTopSlotRegion)";case"draw(C3dShellTopSlotRegion)":return"draw(C3dShellTopSlotRegion)";case"draw(P3dShellTopSlotRegion)":return"draw(P3dShellTopSlotRegion)";case"draw(R3dShellSideEntity)":return"draw(R3dShellSideEntity)";case"draw(C3dShellSideEntity)":return"draw(C3dShellSideEntity)";case"draw(P3dShellSideEntity)":return"draw(P3dShellSideEntity)";case"draw(R3dShellTopBottomEntity)":return"draw(R3dShellTopBottomEntity)";case"draw(C3dShellTopBottomEntity)":return"draw(C3dShellTopBottomEntity)";case"draw(P3dShellTopBottomEntity)":return"draw(P3dShellTopBottomEntity)";case"pcb_DRC":return"pcb_DRC";case"checkERC":return"checkERC";case"checkDRCCustom":return"checkDRCCustom";case"clearErrors":return"clearErrors";case"toggleRealTimeDRC":return"toggleRealTimeDRC";case"ref_designator_annotate":return"ref_designator_annotate";case"netClassManager":return"netClassManager";case"differentialPairManager":return"differentialPairManager";case"equalLengthGroupManager":return"equalLengthGroupManager";case"EditPadsPairGroupDialog":return"EditPadsPairGroupDialog";case"updateComponent":return"updateComponent";case"updateReuseBlock":return"updateReuseBlock";case"trackWidthSetting(WIRING_WIDTH_FOLLOWRULES)":return"trackWidthSetting(WIRING_WIDTH_FOLLOWRULES)";case"trackWidthSetting(WIRING_WIDTH_RULESSETTING)":return"trackWidthSetting(WIRING_WIDTH_RULESSETTING)";case"trackWidthSetting(WIRING_WIDTH_INPUT)":return"trackWidthSetting(WIRING_WIDTH_INPUT)";case"removeLoop":return"removeLoop";case"autoTrimSilkscreen":return"autoTrimSilkscreen";case"unrouteClearConnect":return"unrouteClearConnect";case"unrouteClearNetwork":return"unrouteClearNetwork";case"diffPairEqualLengthTuning":return"diffPairEqualLengthTuning";case"clearAllRoute":return"clearAllRoute";case"joinGroup":return"joinGroup";case"reuseLayoutRoute":return"reuseLayoutRoute";case"ungroupAll":return"ungroupAll";case"set-attr-text-position":return"set-attr-text-position";case"swapLocation":return"swapLocation";case"flip2OppositeSide":return"flip2OppositeSide";case"absoluteOffset":return"absoluteOffset";case"relativeOffset":return"relativeOffset";case"distribute_left_side_edge_equidistant":return"distribute_left_side_edge_equidistant";case"distribute_top_side_edge_equidistant":return"distribute_top_side_edge_equidistant";case"distribute_horizontal_by_center_distance":return"distribute_horizontal_by_center_distance";case"distribute_vertical_by_center_distance":return"distribute_vertical_by_center_distance";case"distribute_horizontal_by_edges_distance":return"distribute_horizontal_by_edges_distance";case"distribute_vertical_by_edges_distance":return"distribute_vertical_by_edges_distance";case"distribute":return"distribute";case"component_distribute_by_region":return"component_distribute_by_region";case"rotate_right":return"rotate_right";case"rotate_reference_point":return"rotate_reference_point";case"fliph_reference_point":return"fliph_reference_point";case"flipv_reference_point":return"flipv_reference_point";case"smartSize":return"smartSize";case"checkDimension":return"checkDimension";case"renumberPads":return"renumberPads";case"teardrop":return"teardrop";case"openPanelizeDlg":return"openPanelizeDlg";case"removeUnusedPad":return"removeUnusedPadDlg";case"prioritizeObjectSelection":return"prioritizeObjectSelection";case"clearMeasureResults":return"clearMeasureResults";case"creepageDistance":return"creepageDistance";case"openDeviceManager":return"openDeviceManager";case"openDeviceStandardizationTab":return"openDeviceStandardizationTab";case"log-tool":return"log-tool";case"view3DModelManager":return"view3DModelManager";case"viewPinDelayManager":return"viewPinDelayManager";case"openPcbComparisonDlg":return"openPcbComparisonDlg";case"viewCopperAreaManager":return"viewCopperAreaManager";case"commonButtonsSetting(SYSTEM)":return"commonButtonsSetting(SYSTEM)";case"commonButtonsSetting(CATEGORY)":return"commonButtonsSetting(CATEGORY)";case"commonButtonsSetting(BASE_LIBRARY)":return"commonButtonsSetting(BASE_LIBRARY)";case"commonButtonsSetting(CANVAS)":return"commonButtonsSetting(CANVAS)";case"commonButtonsSetting(OBJECT)":return"commonButtonsSetting(OBJECT)";case"commonButtonsSetting(PCB_FOOTPRINT)":return"commonButtonsSetting(PCB_FOOTPRINT)";case"commonButtonsSetting(PCB_THEME)":return"commonButtonsSetting(PCB_THEME)";case"commonButtonsSetting(PCB_COMM_GRID_SIZE)":return"commonButtonsSetting(PCB_COMM_GRID_SIZE)";case"commonButtonsSetting(PCB_COMM_TRACK_WIDTH)":return"commonButtonsSetting(PCB_COMM_TRACK_WIDTH)";case"commonButtonsSetting(PCB_COMM_VIA_SIZE)":return"commonButtonsSetting(PCB_COMM_VIA_SIZE)";case"commonButtonsSetting(ADSORPTION)":return"commonButtonsSetting(ADSORPTION)";case"commonButtonsSetting(PANEL_CANVAS)":return"commonButtonsSetting(PANEL_CANVAS)";case"commonButtonsSetting(PANEL_THEME)":return"commonButtonsSetting(PANEL_THEME)";case"commonButtonsSetting(COMM_TYPEFACE)":return"commonButtonsSetting(COMM_TYPEFACE)";case"commonButtonsSetting(DESIGN)":return"commonButtonsSetting(DESIGN)";case"commonButtonsSetting(PROPERTY)":return"commonButtonsSetting(PROPERTY)";case"commonButtonsSetting(HOTKEY)":return"commonButtonsSetting(HOTKEY)";case"commonButtonsSetting(CUSTOM_TOOLBAR)":return"commonButtonsSetting(CUSTOM_TOOLBAR)";case"commonButtonsSetting(SAVE)":return"commonButtonsSetting(SAVE)";case"show_help_file(community)":return"show_help_file(community)";case"show_help_file(contact)":return"show_help_file(contact)";case"show_about":return"show_about";case"opensubmenu-move":return"opensubmenu-move";case"opensubmenu-new":return"opensubmenu-new";case"opensubmenu-import":return"opensubmenu-import";case"opensubmenu-selectobj":return"opensubmenu-selectobj";case"opensubmenu-gridsize-pcb":return"opensubmenu-gridsize-pcb";case"opensubmenu-drawline":return"opensubmenu-drawline";case"opensubmenu-dimension":return"opensubmenu-dimension";case"opensubmenu-export":return"opensubmenu-export";case"opensubmenu-recent":return"opensubmenu-recent";case"opensubmenu-pad":return"opensubmenu-pad";case"switchVersion":return"switchVersion";case"historicalRecords":return"historicalRecords";case"bom_order_parts":return"bom_order_parts";case"orderPCB":return"orderPCB";case"order3DShell":return"order3DShell";case"show_help_file(part_store)":return"show_help_file(part_store)";case"show_help_file(pcb_manu_facturing)":return"show_help_file(pcb_manu_facturing)";case"show_help_file(3d_cnc)":return"show_help_file(3d_cnc)";case"opensubmenu-delete":return"opensubmenu-delete";case"opensubmenu-duplicate":return"opensubmenu-duplicate";case"opensubmenu-snapsize":return"opensubmenu-snapsize";case"opensubmenu-gridtype-pcb":return"opensubmenu-gridtype-pcb";case"opensubmenu-ratline":return"opensubmenu-ratline";case"opensubmenu-highlight-pcb":return"opensubmenu-highlight-pcb";case"opensubmenu-suturevias":return"opensubmenu-suturevias";case"opensubmenu-boardoutline":return"opensubmenu-boardoutline";case"opensubmenu-testPad":return"opensubmenu-testPad";case"opensubmenu-saveas":return"opensubmenu-saveas";case"copperRegion":return"copperRegion";case"fillRegion":return"fillRegion";case"opensubmenu-fpcStiffener":return"opensubmenu-fpcStiffener";case"prohibitedRegion":return"prohibitedRegion";case"opensubmenu-slotRegion":return"opensubmenu-slotRegion";case"opensunmenu-3dShellOutline":return"opensunmenu-3dShellOutline";case"opensubmenu-3DShellSideSlotRegion":return"opensubmenu-3DShellSideSlotRegion";case"opensubmenu-3DShell-Top_Bottom-SlotRegion":return"opensubmenu-3DShell-Top_Bottom-SlotRegion";case"opensubmenu-3DShell-SideEntity":return"opensubmenu-3DShell-SideEntity";case"opensubmenu-3DShell-TopEntity":return"opensubmenu-3DShell-TopEntity";case"opensubmenu-unroute":return"opensubmenu-unroute";case"opensubmenu-offset":return"opensubmenu-offset";case"opensubmenu-group":return"opensubmenu-group";case"opensubmenu-align":return"opensubmenu-align";case"opensubmenu-distribute":return"opensubmenu-distribute";case"opensubmenu-rotate":return"opensubmenu-rotate";case"opensubmenu-flip":return"opensubmenu-flip";case"opensubmenu-canvasOrigin":return"opensubmenu-canvasOrigin";case"opensubmenu-system":return"opensubmenu-system";case"opensubmenu-schematic_symbol":return"opensubmenu-schematic_symbol";case"opensubmenu-pcb_footprint":return"opensubmenu-pcb_footprint";case"opensubmenu-panel":return"opensubmenu-panel";case"opensubmenu-tabmenu":return"opensubmenu-tabmenu";case"opensubmenu-routingWidth":return"opensubmenu-routingWidth";case"auto-routing":return"auto-routing";case"pcbBatchFanout":return"pcbBatchFanout";case"resetUniqueId":return"resetUniqueId";case"select_net":return"select_net";case"decrease_routing_width":return"decrease_routing_width";case"increase_routing_width":return"increase_routing_width";case"decrease_snap_size":return"decrease_snap_size";case"increase_snap_size":return"increase_snap_size";case"move_selected_left_by_alt_grid":return"move_selected_left_by_alt_grid";case"move_selected_right_by_alt_grid":return"move_selected_right_by_alt_grid";case"move_selected_up_by_alt_grid":return"move_selected_up_by_alt_grid";case"move_selected_down_by_alt_grid":return"move_selected_down_by_alt_grid";case"open_in_new_window":return"open_in_new_window";case"refresh":return"refresh";case"clone":return"clone";case"modifyFile":return"modifyFile";case"open_create_panel_lib_dialog":return"open_create_panel_lib_dialog";case"recycleBin":return"recycleBin";case"viewPCBInformation":return"viewPCBInformation";case"pcbOptimizedPath":return"pcbOptimizedPath";case"Split":return"Split";case"CONVERT_TO_PAD":return"CONVERT_TO_PAD";case"CONVERT_TO_TRACK":return"CONVERT_TO_TRACK";case"CONVERT_TO_2D_LINE":return"CONVERT_TO_2D_LINE";case"CONVERT_TO_SLOT_REGION":return"CONVERT_TO_SLOT_REGION";case"CONVERT_TO_FILL_REGION":return"CONVERT_TO_FILL_REGION";case"CONVERT_TO_COPPER_REGION":return"CONVERT_TO_COPPER_REGION";case"CONVERT_TO_PROHIBITED_REGION":return"CONVERT_TO_PROHIBITED_REGION";case"CONVERT_TO_BOARD_OUTLINE":return"CONVERT_TO_BOARD_OUTLINE";case"CONVERT_TO_CONSTRAINT_REGION":return"CONVERT_TO_CONSTRAINT_REGION";case"CONVERT_TO_D3_SHELL_OUTLINE":return"CONVERT_TO_D3_SHELL_OUTLINE";case"CONVERT_TO_D3_SHELL_SLOT_REGION":return"CONVERT_TO_D3_SHELL_SLOT_REGION";case"CONVERT_TO_D3_SHELL_ENTITY":return"CONVERT_TO_D3_SHELL_ENTITY";case"CONVERT_TO_FPC_STIFFENER":return"CONVERT_TO_FPC_STIFFENER";case"drawpartition(Rectangle)":return"drawpartition(Rectangle)";case"drawpartition(Circle)":return"drawpartition(Circle)";case"drawpartition(Polygon)":return"drawpartition(Polygon)";case"OPEN_PARTITION_MANAGER":return"OPEN_PARTITION_MANAGER";case"INCREASE_BRIGHTNESS":return"INCREASE_BRIGHTNESS";case"DECREASE_BRIGHTNESS":return"DECREASE_BRIGHTNESS";case"stop_video_capture":return"stop_video_capture";case"show_videocapture":return"show_videocapture";case"compareNetlist":return"compareNetlist";case"runScript":return"runScript";case"scriptManager":return"scriptManager";case"showExtensionsManager":return"showExtensionsManager";case"place":return"place";case"EDIT BOUNDARY":return"EDIT BOUNDARY";default:return null}}var zue=class extends e8{constructor(e){super();this.nextTool=null;this.mouseRightDownTimer=null;this.mouseDownStatus=null;this.lastPressTime=0;this.f12Count=0;this.canvas=e,this.camera=Ai(),this.inputInfo=fi.getInstance(),this.inputInfo.canvasWidth=e.width||1,this.inputInfo.canvasHeight=e.height||1}setNextTool(e){this.nextTool=e,this.onResize()}handler(e,r){he.publish("updateFrame",r),this.nextTool!=null&&e(this.nextTool)}getRatio(e=1){return R.getInstance().getRatio()}getInputInfo(){return this.inputInfo}onKeyDown1(e){tr.handleHotkeyAction=Wue(e.hotkeyCmd),this.inputInfo.subMenuFunc=e.func,this.inputInfo.keyCode=e.keyCode,this.inputInfo.shiftKey=e.shiftKey,this.inputInfo.realCtrlKey=e.ctrlKey,this.inputInfo.ctrlKey=e.ctrlKey||A2&&e.metaKey,this.inputInfo.altKey=e.altKey,gr.hasAlt=e.altKey,this.inputInfo.metaKey=e.metaKey;let r=tr.getHotKey(this.inputInfo);(tr.hotkeys.has(r)||r==tr.getCtrlShift())&&$t.getInstance().close(),this.handler(i=>{i.onKeyDown(this.inputInfo)})}checkF12(e){if(console.log(e),e==="F12"){let r=new Date().getTime();return r-this.lastPressTime>800?this.f12Count=1:this.f12Count++,this.lastPressTime=r,this.f12Count>=3?(this.f12Count=0,!0):!1}else this.f12Count>0&&(this.f12Count=0);return!0}onKeyDown(e){this.inputInfo.keyCode=e.keyCode,this.inputInfo.shiftKey=e.shiftKey,this.inputInfo.realCtrlKey=e.ctrlKey,this.inputInfo.ctrlKey=this.isCtrl(e),this.inputInfo.altKey=e.altKey,this.inputInfo.metaKey=e.metaKey,gr.hasAlt=e.altKey;let r=tr.getHotKey(this.inputInfo);if(!this.checkF12(r)){e.preventDefault();return}tr.useBrowserHotkey(r)||((tr.hotkeys.has(r)||r==tr.getCtrlShift())&&(e.preventDefault(),$t.getInstance().close()),tr.isAltAndDirection(r)&&e.preventDefault(),tr.shouldPreventHotkey(r)&&e.preventDefault()),he.publish("iframeHotkey",{event:{keyCode:e.keyCode,metaKey:e.metaKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,target:{tagName:""}},fromDoctype:R.getInstance().doctype},Q()),he.publish("recordingIframeKeyDown",{event:{key:e.key},fromDoctype:R.getInstance().doctype},Q()),this.dispatchEventMessage("keydown")}onKeyUp1(e){this.inputInfo.keyCode=e.keyCode,this.inputInfo.shiftKey=e.shiftKey,this.inputInfo.ctrlKey=e.ctrlKey,this.inputInfo.altKey=e.altKey,gr.hasAlt=e.altKey,this.inputInfo.metaKey=e.metaKey,this.handler(r=>{r.onKeyUp(this.inputInfo)})}onKeyUp(e){this.inputInfo.keyCode=e.keyCode,this.inputInfo.shiftKey=e.shiftKey,this.inputInfo.realCtrlKey=e.ctrlKey,this.inputInfo.ctrlKey=this.isCtrl(e),this.inputInfo.altKey=e.altKey,gr.hasAlt=e.altKey,this.inputInfo.metaKey=e.metaKey,this.handler(r=>{r.onKeyUp(this.inputInfo)}),he.publish("iframeHotkeyup",{event:{keyCode:e.keyCode,metaKey:e.metaKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,target:{tagName:""}},fromDoctype:R.getInstance().doctype},Q()),he.publish("recordingIframeKeyUp",{event:{key:e.key},fromDoctype:R.getInstance().doctype},Q()),this.dispatchEventMessage("keyup")}prepare(e){this.inputInfo.mouseX=e.offsetX*this.getRatio(),this.inputInfo.mouseY=e.offsetY*this.getRatio(),this.inputInfo.shiftKey=e.shiftKey,this.inputInfo.realCtrlKey=e.ctrlKey,this.inputInfo.ctrlKey=this.isCtrl(e),this.inputInfo.altKey=e.altKey,this.inputInfo.metaKey=e.metaKey}isCtrl(e){return e.ctrlKey||A2&&e.metaKey}onMouseMove(e){this.prepare(e),this.handler(r=>{r.onMouseMove(this.inputInfo)},"mousemove"),this.dispatchEventMessage("mousemove")}onMouseWheel(e){e.preventDefault(),this.isCtrl(e)&&(e.returnValue=!1);let r=1;switch(e.deltaMode){case 1:r=40;break;case 2:r=100}this.inputInfo.deltaX=e.deltaX*r,this.inputInfo.deltaY=e.deltaY*r,this.prepare(e),this.handler(i=>{i.onMouseWheel(this.inputInfo)}),this.dispatchEventMessage("mousewheel")}onDoubleClick(e){this.prepare(e),this.handler(r=>{r.onDoubleClick(this.inputInfo)})}onResize(){this.handler(e=>{e.onResize(this.inputInfo)}),this.inputInfo.canvasWidth=this.camera.getWidth()||1,this.inputInfo.canvasHeight=this.camera.getHeight()||1,this.handler(e=>{e.onMouseMove(this.inputInfo)}),he.publish("moveCrosshair",this.inputInfo),he.publish("updateFrame","")}onMouseDown(e){On.getInstance().mouseDown=!0,this.mouseDownStatus=e.button,this.prepare(e),e.button===0?this.handler(r=>{r.onMouseLeftDown(this.inputInfo)}):e.button===1?(e.preventDefault(),this.handler(r=>{r.onMouseMidDown(this.inputInfo)})):e.button===2&&(R.getInstance().doctype!=23&&e.preventDefault(),this.mouseRightDownTimer=setTimeout(()=>{zu("grabbing"),this.inputInfo.openMenu=!1},200),this.handler(r=>{r.onMouseRightDown(this.inputInfo)})),he.publish("recordingIframeMouseDown",{event:{clientX:e.clientX,clientY:e.clientY},fromDoctype:R.getInstance().doctype},Q()),this.dispatchEventMessage("mousedown")}onMouseUp(e){this.mouseDownStatus=null,this.prepare(e),e.button===0?this.handler(r=>{r.onMouseLeftUp(this.inputInfo)}):e.button===1?(zu("default"),this.handler(r=>{r.onMouseMidUp(this.inputInfo)})):e.button===2&&(clearTimeout(this.mouseRightDownTimer),zu("default"),this.handler(r=>{r.onMouseRightUp(this.inputInfo)})),he.publish("recordingIframeMouseUp",{event:{clientX:e.clientX,clientY:e.clientY},fromDoctype:R.getInstance().doctype},Q()),this.dispatchEventMessage("mouseup"),On.getInstance().mouseDown=!1}onMouseLeave(e){this.inputInfo.mouseInFrame=!1,this.handler(r=>{r.onMouseLeave(this.inputInfo)})}onMouseOut(e){this.inputInfo.mouseInFrame=!1,this.handler(r=>{r.onMouseOut(this.inputInfo)})}onMouseEnter(e){this.inputInfo.mouseInFrame=!0,this.handler(r=>{r.onMouseEnter(this.inputInfo)})}onMouseOver(e){this.inputInfo.mouseInFrame=!0,this.handler(r=>{r.onMouseOver(this.inputInfo)})}onIframeBlur(e){document.visibilityState=="hidden"&&(this.inputInfo.mouseInFrame=!1,clearTimeout(this.mouseRightDownTimer),zu("default"),this.handler(r=>{r.onMouseRightUp(this.inputInfo)}))}install(){let r=!!window.frameElement&&!window["USE-IFRAME-FOR-MAIN"]&&!window["META-PANELIZE-ENV"]&&window["SILKVIEWER-SOURCE"]!=="FOREIGN-TRADE"?document:this.canvas;window.addEventListener("beforeResize",this.onResize.bind(this),!1),window.addEventListener("resize",this.onResize.bind(this),!1),he.subscribe("keydown",this.onKeyDown1.bind(this)),he.subscribe("keyup",this.onKeyUp1.bind(this)),window.addEventListener("keydown",this.onKeyDown.bind(this),!1),window.addEventListener("keyup",this.onKeyUp.bind(this),!1),document.documentElement.addEventListener("pointerdown",function(i){i.currentTarget&&i.buttons&2&&zu("grabbing")}),document.documentElement.addEventListener("pointermove",function(i){let n=i.currentTarget}),document.documentElement.addEventListener("pointerup",function(i){zu("default")}),r.addEventListener("mousedown",this.onMouseDown.bind(this),!1),r.addEventListener("mouseup",this.onMouseUp.bind(this),!1),r.addEventListener("mousemove",this.onMouseMove.bind(this),!1),r.addEventListener("wheel",this.onMouseWheel.bind(this),{passive:!1}),r.addEventListener("dblclick",this.onDoubleClick.bind(this),!1),r.addEventListener("mouseleave",this.onMouseLeave.bind(this),!1),r.addEventListener("mouseout",this.onMouseOut.bind(this),!1),r.addEventListener("mouseenter",this.onMouseEnter.bind(this),!1),r.addEventListener("mouseover",this.onMouseOver.bind(this),!1),document.addEventListener("paste",async i=>{var a;let n=i.clipboardData.items,s;(a=n[0])!=null&&a.type.startsWith("image/")&&(s=n[0].getAsFile());try{if((await navigator.permissions.query({name:"clipboard-read"})).state=="granted"&&s){let c=await s.arrayBuffer();he.publish("pasteImage",{buffer:c,name:s.name,type:s.type,lastModified:s.lastModified},Q())}}catch(l){console.warn("\u6743\u9650\u68C0\u6D4B\u5931\u8D25:",l)}},!1),document.addEventListener("dragover",i=>i.preventDefault()),document.addEventListener("drop",async i=>{i.preventDefault();let n=i.dataTransfer.files[0];if(n&&n.type.startsWith("image/")){let s=await n.arrayBuffer();he.publish("pasteImage",{buffer:s,name:n.name,type:n.type,lastModified:n.lastModified},Q())}}),window.addEventListener("visibilitychange",this.onIframeBlur.bind(this),!1),document.oncontextmenu=()=>!1,he.subscribe("main2iframe/trigger-event",i=>{let{type:n,button:s}=i[0]||{};n==="mouseup"&&s===this.mouseDownStatus&&(s===0?this.handler(a=>{a.onMouseLeftUp(this.inputInfo)}):s===1?(zu("default"),this.handler(a=>{a.onMouseMidUp(this.inputInfo)})):s===2&&(clearTimeout(this.mouseRightDownTimer),zu("default"),this.handler(a=>{a.onMouseRightUp(this.inputInfo)})))})}dispatchEventMessage(e){he.windowBridge.publish("pcb/iframeOperate",{type:e},Q())}};var Yue=class{constructor(t,e){this.rtree1=new ji(10);this.rtree2=new ji(10);this.left=null;this.right=null;this.distance=Number.MAX_VALUE;t.itemList.length==1?this.left=t.itemList[0]:this.rtree1=t,e.itemList.length==1?this.right=e.itemList[0]:this.rtree2=e,this.find()}findNearXPoint(t,e){let r=Number.MAX_VALUE,i=e[0];for(let n of e){let s=Math.abs(n.point.x-t.point.x);s<r&&(r=s,i=n)}return i}findNearest(t,e){let r=t.bbox().extendOfSize(this.distance),i=e.search(r),n=null,s=this.distance*this.distance;for(let a of i){let l=a.point.distance2(t.point);l<s&&(s=l,n=a)}return this.distance=Math.sqrt(s),n}find(){if(this.rtree1.itemList.length==0&&this.rtree2.itemList.length==0){this.distance=this.left.point.distance1(this.right.point);return}else if(this.rtree1.itemList.length==0&&this.rtree2.itemList.length!=0){let t=this.findNearest(this.left,this.rtree2);t!=null&&(this.right=t)}else if(this.rtree1.itemList.length!=0&&this.rtree2.itemList.length==0){let t=this.findNearest(this.right,this.rtree1);t!=null&&(this.left=t)}else{let t=this.findNearXPoint(this.rtree1.itemList[0],this.rtree2.itemList),e=this.rtree1.itemList[0].point.distance1(t.point);e<this.distance&&(this.distance=e,this.left=this.rtree1.itemList[0],this.right=t)}for(let t of this.rtree1.itemList){let e=this.findNearest(t,this.rtree2);e!=null&&(this.left=t,this.right=e)}}};var jue=class{constructor(t,e){this.cluster1=t,this.cluster2=e,this.nearest=new Yue(t.junctions,e.junctions)}build(t){let e=this.nearest.left,r=this.nearest.right;return Wo.add(e.point,r.point,t,e.node.globalIndex,r.node.globalIndex)}};var id=class o{constructor(t){this._node=null;this.point=t}hashCode(){return this.point.hashCode()}equals(t){return t instanceof o?this.point.equals(t.point):t instanceof S?this.point.equals(t):!1}bbox(){return this.point.bbox()}get node(){return this._node}set node(t){this._node=t}};var Xue=class{constructor(t,e){this.junctions=new ji(10);this.id=e,this.junctions=t}bbox(){return this.junctions.bbox()}};var que=class{constructor(t){this.map=new Map;this.capacity=t}add(t,e,r){let i=this.map.get(r);i==null&&(i=new Map,this.map.set(r,i));let n=i.get(e);n==null&&(n=new ji(this.capacity),i.set(e,n)),n.add(t)}search(t,e,r){for(let i of e){let n=this.map.get(i);if(n!=null){for(let[,s]of n)if(s.conditionQuery(t,r))return}}}search4Tracks(t,e,r){for(let i of e){let n=this.map.get(i);if(n!=null){let s=n.get("Track");if(s!=null&&s.conditionQuery(t,r)||(s=n.get("ArcTrack"),s!=null&&s.conditionQuery(t,r)))return}}}search4Others(t,e,r){for(let i of e){let n=this.map.get(i);if(n!=null){for(let[s,a]of n)if(s!="Track"&&s!="ArcTrack"&&a.conditionQuery(t,r))return}}}};var $ue=class{constructor(t){this.node=t}bbox(){return this.node.buildBBox()}},Hq=class extends $ue{constructor(t,e){super(t),this.point=e,this.box=e.bbox().extendOfSize(.1)}bbox(){return this.box}},Wq=class o{static getCluster(t,e){let r=new ji(10);if(t.size==1){for(let i of t)if(i instanceof Le||i instanceof Ue){let n=new id(i.center);n.node=i}else if(i instanceof Ge){let n=new id(i.start);n.node=i;let s=new id(i.end);s.node=i,r.add(n),r.add(s)}else if(i instanceof Pr){let n=new id(new S(i.center.x-i.radius,i.center.y));n.node=i,r.add(n)}else if(i instanceof rr){let n=new id(i.start);n.node=i,r.add(n)}else if(i instanceof lt){let n=new id(i.start);if(n.node=i,r.add(n),i.type=="Line"&&!i.isClose()){let s=new id(i.end);s.node=i,r.add(s)}}else if(i instanceof Jr||i instanceof Gi){let n=new id(i.start);n.node=i,r.add(n)}}else{let i=new Array,n=new que(10);for(let c of t)if(c instanceof Ge){let h=new Hq(c,c.start),u=new Hq(c,c.end);n.add(h,c.model.modelType,c.layerId),n.add(u,c.model.modelType,c.layerId),i.push(h),i.push(u)}else if(c instanceof Le||c instanceof Ue){n.add(new $ue(c),c.model.modelType,c.model.layerId);let h=new id(c.center);h.node=c,r.add(h)}else if(c instanceof Pr){let h=new id(new S(c.center.x-c.radius,c.center.y));h.node=c,r.add(h)}else if(c instanceof rr){let h=new id(c.start);h.node=c,r.add(h)}else if(c instanceof lt){let h=new id(c.start);if(h.node=c,r.add(h),c.type=="Line"&&!c.isClose()){let u=new id(c.end);u.node=c,r.add(u)}}else if(c instanceof Jr||c instanceof Gi){let h=new id(c.start);h.node=c,r.add(h)}let s=new gd,a=new Set,l=!1;for(let c of i){let h=function(u){if(c==u||c.node==u.node||!s.needCheckIntersection(c.node.model,u.node.model))return!1;let d=u.node;if(u instanceof Hq){if(c.point.distance1(u.point)<=.1)return a.add(u),a.add(c),l=!0,!0}else if(d.model.inOutline(c.point))return a.add(c),l=!0,!0;return!1};if(!a.has(c)&&(l=!1,n.search4Tracks(c.point.bbox().extendOfSize(.1),[c.node.layerId],h),l||n.search4Others(c.bbox(),[c.node.layerId,12],h),!l)){let u=new id(c.point);u.node=c.node,r.add(u)}}}if(Er(r.itemList,(i,n)=>i.point.x-n.point.x,0,r.itemList.length),r.size()==0){let i=o.getDefault(t);i!=null&&r.add(i)}return new Xue(r,e)}static getDefault(t){for(let e of t)if(e instanceof Le||e instanceof Ue){let r=new id(e.center);return r.node=e,r}else if(e instanceof Ge){let r=new id(e.start);return r.node=e,r}else if(e instanceof Pr){let r=new id(new S(e.center.x-e.radius,e.center.y));return r.node=e,r}else if(e instanceof rr){let r=new id(e.start);return r.node=e,r}else if(e instanceof lt){let r=new id(e.start);return r.node=e,r}else if(e instanceof Jr||e instanceof Gi){let r=new id(e.start);return r.node=e,r}return null}};var D1=class{constructor(t,e=new Set){this.exclusions=new Set;this.connects=new Set;this.clusters=new Array;this.ratline=null;this.other=null;this.net=t.net,this.item=t;let r=Ye.getSameNetItems(t.net);if(r.length==0)return;let i=uS(t.net),n=new Jt;for(let c of i){for(let h of e)if(c.has(h==null?void 0:h.globalIndex)){for(let u of c){let d=n.getConnectNode(u);d instanceof Qo&&this.exclusions.add(d)}break}if(c.has(this.item.globalIndex))for(let h of c){let u=n.getConnectNode(h);u instanceof Qo&&this.connects.add(u)}}this.connects.add(this.item);let s=new Set;s.add(t);let a=0;r=r.filter(c=>{let h=!0;return(c instanceof Qo&&this.exclusions.has(c)||c instanceof Jr||c instanceof Gi||c instanceof He&&c.type=="Copper Region")&&(h=!1),h});let l=new Map;for(let c of i)for(let h of c)l.set(h,c);for(let c of r)if(c instanceof Qo&&!s.has(c)&&!e.has(c)){let h=new Set,u=l.get(c.globalIndex);if(u!=null)for(let d of u){let p=n.getConnectNode(d);p instanceof Qo&&h.add(p)}if(h=this.filter(h),h.size>0){let d=Wq.getCluster(h,a++);this.clusters.push(d);for(let p of h)s.add(p)}}this.ratline!=null&&this.ratline.remove()}filter(t){let e=new Array;t=this.filterCopper(t),t.forEach(i=>{e.push(i)}),e=e.filter(i=>{let n=!0;return this.exclusions.has(i)&&(n=!1),n});let r=new Set;return e.forEach(i=>{r.add(i)}),r}filterCopper(t){let e=new Set;return t.forEach(r=>{r instanceof Jr||r instanceof Gi||r instanceof He&&r.type=="Copper Region"||e.add(r)}),e}generateRatline(){this.clear();let t=this.clusters.length;if(t>0){let e=new Array,r=this.connects,i=0,n=Wq.getCluster(r,i++);if(this.item instanceof Ir||this.item instanceof yi){let s=-1,a=this.item.start;for(let l=0,c=n.junctions.itemList.length;l<c;l++){let h=n.junctions.itemList[l];h.point.x==a.x&&h.point.y==a.y&&(s=l)}s>=0&&n.junctions.itemList.splice(s,1)}for(let s=0;s<t;s++){let a=this.clusters[s],l=new jue(n,a);e.push(l)}if(Er(e,(s,a)=>s.nearest.distance-a.nearest.distance,0,e.length),e.length>0){let s=e[0],a=s.nearest.left,l=s.nearest.right;if(this.item instanceof Ir||this.item instanceof yi){let c=Ye.getSpecialColor(this.item.net);if(a.equals(this.item.start)){this.other=l.node,this.ratline=new cr(57,this.item.end,l.point,!0,c),this.ratline.click();return}else if(l.equals(this.item.start)){this.other=a.node,this.ratline=new cr(57,a.point,this.item.end,!0,c),this.ratline.click();return}}a.node==this.item?this.other=l.node:this.other=a.node,this.ratline=new cr(57,a.point,l.point,!0)}}this.ratline!=null&&this.ratline.click()}getOther(){return this.other}clear(){this.ratline!=null&&this.ratline.remove()}};var _G=class extends ni{constructor(){super();this._pads=null;this.startPoint=null;this.count=0;this.angle=0;this.fixAngle=!0;this.option="OPTIONLEFTUP",xo.setTool(this),Ea.changeTool(this),Ua.addTool(this)}set pads(e){if(this.filterItems.clear(),e!=null)for(let r of e)this.filterItems.add(r);this._pads=e}get pads(){return this._pads}get interval(){return this._interval?this._interval:new dt().conversion("mm","mil",2/10)}set interval(e){this._interval=e}onKeyDown(e){switch(tr.getAction(5,e)){case"Cancel":this.cancel();break}A.publish("updateFrame","")}checkPadRotate(e){let r=e.bbox(),i=r.width(),n=r.height();return i>n}onMouseLeftUp(e){if(at.editingWhat){at.editingWhat="";return}let r=new S(e.sceneX,e.sceneY);if(this.pads===null){this.start();let i=ut.getDefaultPad(r);ut.setDefaultPad(i),this.rotate90=this.checkPadRotate(i);let n=i.rotation;ne.eq(n%Math.PI,0)||(this.fixAngle=!1),i.hidden(),this.pads=[i],this.startPoint=r}else this.placeSuccess()}placeSuccess(){let e=new De("Batch move pcb item");for(let r=0;r<this.count;r++)e.addCommand(Ce.dispatch(this.pads[r],"add")),A.publish("hasModifyPcbItem",this.pads[r]);this.pads!=null&&A.publish("onlySelect",this.pads.slice(0,this.count)),qe.executeCommand(e),this.end()}resetEndPoint(){let e=this.endPoint.x-this.startPoint.x,r=this.endPoint.y-this.startPoint.y;e>0&&(this.endPoint=new S(this.startPoint.x+this.count*this.interval,this.endPoint.y)),e<0&&(this.endPoint=new S(this.startPoint.x-this.count*this.interval,this.endPoint.y)),r>0&&(this.endPoint=new S(this.endPoint.x,this.startPoint.y+this.count*this.interval)),r>0&&(this.endPoint=new S(this.endPoint.x,this.startPoint.y-this.count*this.interval))}applyInputAtCursorValue(e){at.editingWhat="";let{value:r,editing:i,type:n,index:s,keyCode:a,locked:l,unlocked:c}=e;if(i){at.editingWhat=n;return}if(r){if(r=Math.abs(r),s===0){let h=new dt;this.interval=h.conversion(R.getInstance().unit,"mil",r/10)}else s===1&&(this.count=r,l?(this.locked=!0,this.resetEndPoint()):c&&(this.locked=!1));this.hidePads(),this.placePads(),A.publish("updateFrame",""),(a===108||a===13)&&this.placeSuccess()}}onMouseMove(e){this.drawing&&this.pads!==null&&(this.hidePads(),this.getState(e),this.placePads())}hidePads(){if(this.pads!=null)for(let e=0;e<this.pads.length;e++)this.pads[e].hidden()}getState(e){let r,i;Math.abs(e.sceneX-this.startPoint.x)>Math.abs(e.sceneY-this.startPoint.y)?(r=e.sceneX,i=this.startPoint.y):(r=this.startPoint.x,i=e.sceneY),this.locked||(this.endPoint=new S(r,i));let n=this.endPoint.x-this.startPoint.x,s=this.endPoint.y-this.startPoint.y;if(n>0?this.angle=0:n<0?this.angle=Math.PI:s>0?this.angle=Math.PI/2:s<0&&(this.angle=Math.PI*3/2),this.rotate90&&(this.angle=this.angle+Math.PI/2),!this.locked){let a=Math.max(Math.abs(this.endPoint.x-this.startPoint.x),Math.abs(this.endPoint.y-this.startPoint.y));this.count=Math.ceil(a/this.interval)}}placePads(){let e=this.pads.length;if(e<this.count)for(let a=0;a<this.count-e;a++){let l=ut.getDefaultPad(new S(0,0));l.hidden(),this.pads.push(l)}let r=this.startPoint.x,i=this.startPoint.y,n=this.endPoint,s=this.angle;for(let a=0;a<this.count;a++){n.x!==this.startPoint.x&&(r=this.interval*a+this.startPoint.x,n.x<this.startPoint.x&&(r=-this.interval*a+this.startPoint.x)),n.y!==this.startPoint.y&&(i=this.interval*a+this.startPoint.y,n.y<this.startPoint.y&&(i=-this.interval*a+this.startPoint.y));let l=this.pads[a];l.center=new S(r,i),this.fixAngle&&(l.rotation=s),l.visible()}if(this.count>1){at.startPoint=new S(this.startPoint.x,this.startPoint.y);let a={data:[{startPoint:at.startPoint,cursorPoint:new S(this.pads[1].center.x,this.pads[1].center.y),frameStartPoint:_o(at.startPoint),frameCursorPoint:_o(new S(this.pads[1].center.x,this.pads[1].center.y)),info:{type:"distance",isLocked:!0,value:je(this.interval),unit:R.getInstance().unit}},{startPoint:at.startPoint,cursorPoint:new S(this.pads[this.count-1].center.x,this.pads[this.count-1].center.y),frameStartPoint:_o(at.startPoint),frameCursorPoint:_o(new S(this.pads[this.count-1].center.x,this.pads[this.count-1].center.y)),info:{type:"distance",tagName:"amount",value:this.count,polylineLength:270,middleLineHeight:135,onlyInteger:!0,onlyPositive:!0}}],type:"linePad",show:!0,frameInfo:nf()};ut.setDefaultPad(this.pads[0]),at.create(a),this.canSetInterval=!0}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:MD(ut.defalutPad.layerId,e.adsorb,this).result};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"REPLACE_LAYER":let n=parseInt(i[1].split("switchToLayer(")[1]);this.toggleLayer(n);break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}toggleLayer(e){if(e!=ut.defalutPad.layerId&&(e==1||e==2||e==12))if(this.pads!=null){for(let r=0;r<this.pads.length;r++)this.pads[r].layerId=e;ut.setDefaultPad(this.pads[0])}else ut.togglePadLayerId(e)}interrupt(){if(this.pads!==null){for(let e=0;e<this.pads.length;e++)A.publish("hasModifyPcbItem",this.pads[e]),this.pads[e].remove(),A.publish("delete",this.pads[e]);this.end()}}cancel(){let e=!!this.pads;this.interrupt(),e||(A.publish("tool","dropdrag"),ze.keepSelection=!0)}end(){if(this.pads!=null)for(let e=this.count;e<this.pads.length;e++)A.publish("delete",this.pads[e]),this.pads[e].remove(),A.publish("hasModifyPcbItem",this.pads[e]);this.pads=null,this.locked=!1,this.canSetInterval=!1,at.destroy(),A.publish("flushService",""),super.end()}};var vG=class extends ni{constructor(){super();this._pads=null;this.startPoint=null;this.endPoint=null;this.count=0;this.widthNum=0;this.heightNum=0;this.fixAngle=!0;this.widthFactor=1;this.heightFactor=1;this._widthInterval=0;this._heightInterval=0;this.option="OPTIONLEFTUP",xo.setTool(this),Ea.changeTool(this),Ua.addTool(this)}set pads(e){if(this.filterItems.clear(),e!=null)for(let r of e)this.filterItems.add(r);this._pads=e}get pads(){return this._pads}get widthInterval(){return this._widthInterval?this._widthInterval:new dt().conversion("mm","mil",2/10)}set widthInterval(e){this._widthInterval=e}set heightInterval(e){this._heightInterval=e}get heightInterval(){return this._heightInterval?this._heightInterval:new dt().conversion("mm","mil",2/10)}onKeyDown(e){switch(tr.getAction(5,e)){case"Cancel":this.cancel();break}A.publish("updateFrame","")}checkPadRotate(e){let r=e.bbox(),i=r.width(),n=r.height();return i>n}onMouseLeftUp(e){if(at.editingWhat){at.editingWhat="";return}let r=new S(e.sceneX,e.sceneY);if(this.pads===null){this.start();let i=ut.getDefaultPad(r);i.hidden(),ut.setDefaultPad(i),this.rotate90=this.checkPadRotate(i);let n=i.rotation;ne.eq(n%Math.PI,0)||(this.fixAngle=!1),this.pads=[i],this.startPoint=r}else this.placeSuccess()}placeSuccess(){let e=new De("Batch move pcb item");for(let r=0;r<this.count;r++)this.pads[r].partition=R.getInstance().partitionId,e.addCommand(Ce.dispatch(this.pads[r],"add")),A.publish("hasModifyPcbItem",this.pads[r]);A.publish("onlySelect",this.pads),qe.executeCommand(e),this.end()}applyInputAtCursorValue(e){at.editingWhat="";let{value:r,editing:i,type:n,index:s,keyCode:a,locked:l,unlocked:c}=e;if(i){at.editingWhat=n;return}if(l?s===1?this.widthLocked=!0:s===3&&(this.heightLocked=!0):c&&(s===1?this.widthLocked=!1:s===3&&(this.heightLocked=!1)),r){let u=new dt().conversion(R.getInstance().unit,"mil",r/10);s===0?this.widthInterval=u:s===1?this.widthNum=r+1:s===2?this.heightInterval=u:s===3&&(this.heightNum=r+1),this.hidePads(),this.updateEndPoint(),this.placePads(),A.publish("updateFrame",""),(a===108||a===13)&&this.placeSuccess()}}onMouseMove(e){this.drawing&&this.pads!==null&&(this.hidePads(),this.getState(e),this.placePads())}hidePads(){if(this.pads!=null)for(let e=0;e<this.pads.length;e++){let r=this.pads[e];this.fixAngle&&(r.rotation=0),r.hidden()}}getState(e){this.widthLocked||(this.widthNum=Math.ceil(Math.abs((e.sceneX-this.startPoint.x)/this.widthInterval))),this.heightLocked||(this.heightNum=Math.ceil(Math.abs((e.sceneY-this.startPoint.y)/this.heightInterval))),e.sceneX<this.startPoint.x?this.widthFactor=-1:this.widthFactor=1,e.sceneY<this.startPoint.y?this.heightFactor=-1:this.heightFactor=1,this.endPoint=new S(this.startPoint.x+this.widthNum*this.widthInterval*this.widthFactor,this.startPoint.y+this.heightNum*this.heightInterval*this.heightFactor)}updateEndPoint(){this.endPoint=new S(this.startPoint.x+this.widthNum*this.widthInterval*this.widthFactor,this.startPoint.y+this.heightNum*this.heightInterval*this.heightFactor)}placePads(){this.addPads(),ut.setDefaultPad(this.pads[0]),this.addFloatingInputBox()}addPads(){let e=new S(Math.min(this.endPoint.x,this.startPoint.x),Math.min(this.endPoint.y,this.startPoint.y)),r=new S(Math.max(this.endPoint.x,this.startPoint.x),Math.max(this.endPoint.y,this.startPoint.y)),i=this.pads.length,n=(this.widthNum+this.heightNum)*2-4;if(this.widthNum<1?n=this.heightNum:this.heightNum<1&&(n=this.widthNum),i<n)for(let s=0;s<n-i;s++){let a=ut.getDefaultPad(new S(0,0));a.hidden(),this.pads.push(a)}this.count=0,this.widthNum>1&&this.heightNum>1?this.case1(e,r):this.widthNum>0&&this.heightNum==1?this.case2(e,r):this.widthNum==1&&this.heightNum>0?this.case3(e,r):this.widthNum>0&&this.heightNum==0?this.case4(e,r):this.widthNum==0&&this.heightNum>0&&this.case5(e,r)}case1(e,r){for(let i=1;i<this.widthNum;i++){let n=this.widthInterval*i+e.x,s=e.y,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=this.rotate90?Math.PI/2:0),a.visible()}for(let i=1;i<this.heightNum;i++){let n=r.x,s=this.heightInterval*i+e.y,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=Math.PI/2+(this.rotate90?Math.PI/2:0)),a.visible()}for(let i=1;i<this.widthNum;i++){let n=r.x-this.widthInterval*i,s=r.y,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=this.rotate90?Math.PI/2:0),a.visible()}for(let i=1;i<this.heightNum;i++){let n=e.x,s=r.y-this.heightInterval*i,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=Math.PI/2+(this.rotate90?Math.PI/2:0)),a.visible()}}case2(e,r){for(let i=1;i<this.widthNum;i++){let n=this.widthInterval*i+e.x,s=e.y,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=this.rotate90?Math.PI/2:0),a.visible()}for(let i=1;i<this.widthNum;i++){let n=r.x-this.widthInterval*i,s=r.y,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=this.rotate90?Math.PI/2:0),a.visible()}}case3(e,r){for(let i=1;i<this.heightNum;i++){let n=e.x,s=r.y-this.heightInterval*i,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=Math.PI/2+(this.rotate90?Math.PI/2:0)),a.visible()}for(let i=1;i<this.heightNum;i++){let n=r.x,s=this.heightInterval*i+e.y,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=Math.PI/2+(this.rotate90?Math.PI/2:0)),a.visible()}}case4(e,r){for(let i=1;i<this.widthNum;i++){let n=this.widthInterval*i+e.x,s=e.y,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=this.rotate90?Math.PI/2:0),a.visible()}}case5(e,r){for(let i=1;i<this.heightNum;i++){let n=e.x,s=r.y-this.heightInterval*i,a=this.pads[this.count++];a.center=new S(n,s),this.fixAngle&&(a.rotation=Math.PI/2+(this.rotate90?Math.PI/2:0)),a.visible()}}addVerticalFloatingInputBox(e){let r=new S(this.pads[0].center.x,this.pads[0].center.y),i=r,n=r;if(this.heightNum>0){let s=this.pads[this.count-this.heightNum+1];this.widthNum<=1&&(s=this.pads[0]);let a=this.pads[this.count-1];this.heightNum==1&&(this.count-1>=0&&(s=this.pads[this.count-1]),a=this.pads[0]),r=new S(s.center.x,s.center.y),i=new S(s.center.x,s.center.y-this.heightInterval),n=i,a&&this.widthNum>3&&(n=new S(a.center.x,a.center.y))}e.data.push({startPoint:r,cursorPoint:i,frameStartPoint:_o(r),frameCursorPoint:_o(i),info:{type:"vertical",value:je(this.heightInterval),isLocked:!0,unit:R.getInstance().unit,direction:"left"}},{startPoint:r,cursorPoint:n,frameStartPoint:_o(r),frameCursorPoint:_o(n),info:{type:"vertical",isLocked:!1,tagName:"amount",value:this.heightNum-1,polylineLength:270,middleLineHeight:135,onlyInteger:!0,onlyPositive:!0,direction:"left"}})}addHorizontalFloatingInputBox(e){let r=new S(this.pads[0].center.x,this.pads[0].center.y),i=r,n=r;if(this.widthNum>0){let s=this.pads[this.widthNum*2+this.heightNum-4];this.heightNum<1&&(s=this.pads[0]),this.widthNum==1&&(s=this.pads[0]);let a=this.pads[this.count-this.heightNum-this.widthNum+2];r=new S(s.center.x,s.center.y),i=new S(s.center.x+this.widthInterval,s.center.y),n=i,a&&(n=new S(a.center.x,a.center.y))}e.data.push({startPoint:r,cursorPoint:i,frameStartPoint:_o(r),frameCursorPoint:_o(i),info:{type:"horizontal",value:je(this.widthInterval),isLocked:!0,unit:R.getInstance().unit}},{startPoint:r,cursorPoint:n,frameStartPoint:_o(r),frameCursorPoint:_o(n),info:{type:"horizontal",isLocked:!1,tagName:"amount",value:this.widthNum-1,polylineLength:100,middleLineHeight:50,onlyInteger:!0,onlyPositive:!0}})}addFloatingInputBox(){let e={type:"rectPad",show:!0,frameInfo:nf(),data:[]};at.startPoint=new S(this.startPoint.x,this.startPoint.y),this.addHorizontalFloatingInputBox(e),this.addVerticalFloatingInputBox(e),at.create(e),(this.heightNum<1||this.widthNum<1)&&(e.data=[{hide:!1},{hide:!1},{hide:!1},{hide:!1}],this.widthNum<1&&(e.data[0].hide=!0,e.data[1].hide=!0),this.heightNum<1&&(e.data[2].hide=!0,e.data[3].hide=!0),at.create(e))}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:MD(ut.defalutPad.layerId,e.adsorb,this).result};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"REPLACE_LAYER":let n=parseInt(i[1].split("switchToLayer(")[1]);this.toggleLayer(n);break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}toggleLayer(e){if(e!=ut.defalutPad.layerId&&(e==1||e==2||e==12))if(this.pads!=null){for(let r=0;r<this.pads.length;r++)this.pads[r].layerId=e;ut.setDefaultPad(this.pads[0])}else ut.togglePadLayerId(e)}turn(e){}interrupt(){if(this.pads!==null){for(let e=0;e<this.pads.length;e++)A.publish("hasModifyPcbItem",this.pads[e]),this.pads[e].remove(),A.publish("delete",this.pads[e]);this.resetStatus()}this.end()}cancel(){let e=!!this.pads;this.interrupt(),e||(A.publish("tool","dropdrag"),ze.keepSelection=!0)}resetStatus(){this.pads=null,this.widthLocked=!1,this.heightLocked=!1,at.destroy(),A.publish("flushService","")}end(){if(this.pads!==null)for(let e=this.count;e<this.pads.length;e++)A.publish("delete",this.pads[e]),this.pads[e].remove(),A.publish("hasModifyPcbItem",this.pads[e]);this.resetStatus(),super.end()}};function MD(o,t,e,r=!1){let i=new qt;i.add("CANCEL",!0),!r&&!(e instanceof _G)&&!(e instanceof vG)&&i.add("PAD_NUMBER");let n=new Array;return n.push(Pe.getTopLayer()),n.push(Pe.getBottomLayer()),n.push(Pe.getMultLayer()),i.addExtend("REPLACE_LAYER",kre(n,o),!0),i.add("toggleAdsorb",!1,t),i.add("ADSORBENT_CONFIG"),i}var dE=class extends ni{constructor(e=!1){super();this._pad=null;this.nearNode=null;this.isDrawTestPad=!1;this.option="OPTIONLEFTUP",xo.setTool(this),this.isDrawTestPad=e,Ea.changeTool(this),this.start()}set pad(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._pad=e}get pad(){return this._pad}onKeyDown(e){switch(tr.getAction(5,e)){case"Cancel":this.cancel();break;case"Show Attribute Dialog When Placing Object":this.pad&&!this.pad.isTestPad&&this.openDialog();break;case"Rotate Left":this.pad!=null&&(this.pad.rotateFor(this.pad.center,le.pcbConfig.rotate),ut.defalutPad.rotation+=le.pcbConfig.rotate);break;case"rotate_right":this.pad!=null&&(this.pad.rotateFor(this.pad.center,-le.pcbConfig.rotate),ut.defalutPad.rotation-=le.pcbConfig.rotate);break;case"Flip Right and Left":A.publish("turn","turnAround");break;case"Flip Up and Down":A.publish("turn","turnUpsideDown");break}A.publish("updateFrame","")}openDialog(){this.pad!=null&&A.publish("openMainDialog",{cmd:19,data:{tool:this}})}getDialogData(){return{action:"attribute-for-place-pad",unit:R.getInstance().unit,number:this.pad.num}}modifyByDialog(e){if(e.action=="confirm"){let i=e.number,n=xp.getNumberManager();n!=null&&n.deleteNum(this.pad.num),n.add(i),this.pad.num=i,this.pad.isTestPad?ut.setDefaultTestPad(this.pad):ut.setDefaultPad(this.pad)}}applyValue(e){let{value:r,cursorPoint:i,startPoint:n}=e;r=new dt().conversion(R.getInstance().unit,"mil",r/10);let a=new S(i.x-n.x,i.y-n.y).normalize();a=new S(a.x*r,a.y*r);let l=new S(a.x+n.x,a.y+n.y);this.placePad(l),at.destroy(),fi.getInstance().clearCrossFlag()}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,keyCode:l,startPoint:c}=e;if(a){at.editingWhat=i;return}this.applyValue(e)}onMouseLeftUp(e){if(!at.editingWhat){if(this.isDrawTestPad){let r=new S(e.sceneX,e.sceneY);this.placePad(r)}else if(this.pad!==null){let r=new S(e.sceneX,e.sceneY);this.pad.center=r;let i=this.getNearNetPcbItems(e);this.handleNets(e,i)}}}getNearNetPcbItems(e){let r=new Ay([this.pad]);r.updateScene();let{netsGroupSet:i}=r.getNetPcbItems(e);return i}handleNets(e,r){let i=[];r.forEach(n=>{i.push(...Array.from(n.nets))}),i.length?i.length===1?(i.forEach(n=>{this.pad.net=n,ut.defalutPad.net=n}),this.placePad(this.pad.center)):this.showNetsMenu(e,i):this.placePad(this.pad.center)}placePad(e){if(this.pad!==null){if(!Mt.checkIsInCanEdit(this.pad)){let s="beyond drawing range";Mt.showMassageTip(s,s);return}this.pad.partition=R.getInstance().partitionId;let r=e.sub(this.pad.center),i=Ae.translate(r.x,r.y,0);this.pad.transform(i),Bje.update([this.pad]),A.publish("onlySelect",[this.pad]);let n=new De("draw pad");n.addCommand(Ce.dispatch(this.pad,"add")),qe.executeCommand(n),this.nearNode.clear(),ut.placingPad=null,A.publish("hasModifyPcbItem",this.pad),A.publish("flushService",""),this.pad=this.isDrawTestPad?ut.getDefaultTestPad(e):ut.getDefaultPad(e,this.pad.num),ut.placingPad=this.pad,this.nearNode=new D1(this.pad),this.drawing=!0}}flushNear(){this.pad!=null&&this.pad.net!=this.nearNode.net&&(this.nearNode.clear(),this.nearNode=new D1(this.pad),this.nearNode.generateRatline())}onMouseMove(e,r){if(this.drawing){let i=new S(e.sceneX,e.sceneY);if(this.pad!==null){let n=i.sub(this.pad.center),s=Ae.translate(n.x,n.y,0);this.pad.transform(s),this.nearNode.generateRatline()}else this.pad=this.isDrawTestPad?ut.getDefaultTestPad(i):ut.getDefaultPad(i),r&&r(),this.isDrawTestPad?ut.setDefaultTestPad(this.pad):ut.setDefaultPad(this.pad),this.nearNode=new D1(this.pad)}}rightClickMenuData(e){let r=this.pad.isTestPad?ut.defalutTestPad.layerId:ut.defalutPad.layerId,i={state:"show",left:e.mouseX,top:e.mouseY,filter:MD(r,e.adsorb,this,this.pad.isTestPad).result};$t.getInstance().menuData(i,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"PAD_NUMBER":this.openDialog();break;case"REPLACE_LAYER":let n=parseInt(i[1].split("switchToLayer(")[1]);this.toggleLayer(n);break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"FLIP":i[1]=="FLIP_LEFTANDRIGHT"?this.turn("turnAround"):i[1]=="FLIP_UPANDDOWN"&&this.turn("turnUpsideDown");break;case"INHERIT_NET":let s=i[1];this.pad.net=s,ut.defalutPad.net=s,this.placePad(this.pad.center);break}A.publish("updateFrame","")}showNetsMenu(e,r){let i=new qt,n="INHERIT_NET:";for(let a of r){let l={name:a,cmd:n+a,tips:"",option:{disabledI18n:!0}};i.addObj(l,!1,!1)}let s={state:"show",left:e.mouseX,top:e.mouseY,filter:i.result};$t.getInstance().menuData(s,this),this.drawing=!1}turn(e){if(!(!R.getInstance().isactive||23==R.getInstance().doctype))switch(e){case"turnAround":xo.turn([this.pad],!1,!1);break;case"turnUpsideDown":xo.turn([this.pad],!0,!1);break}}onMouseRightUp(e){if(e.openMenu)switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}restore(){at.destroy(),A.publish("hasModifyPcbItem",this.pad),this.pad.remove(),ut.placingPad=null,this.nearNode.clear(),A.publish("delete",this.pad),this.pad=null,this.drawing=!0,A.publish("flushService","")}interrupt(){this.pad!==null&&(at.destroy(),A.publish("hasModifyPcbItem",this.pad),this.pad.remove(),ut.placingPad=null,this.nearNode.clear(),A.publish("delete",this.pad),this.pad=null,this.drawing=!1,A.publish("flushService","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}toggleLayer(e,r){if(!(e!=12&&e!=1&&e!=2)){if(this.pad.isTestPad){this.pad.layerId=e,ut.setDefaultTestPad(this.pad);return}e!=ut.defalutPad.layerId&&(this.pad.layerId=e,ut.setDefaultPad(this.pad))}}getPad(){return this.pad}};function Fje(o){let t=new qt;if(t.add("VIA_TYPE_THROUGH_VIA"),R.getInstance().doctype!==pi.FOOTPRINT){let r=re.getInstance().getDefaultBlindPhysics().getAllVias();r!=null&&r.forEach(i=>{let n={name:i.name,cmd:i.name,tips:"",offTranslation:!0},s=!1;o!=null&&o.name==i.name&&(s=!0),t.addObj(n,!1,s)})}return t.addSeparate(),t.add("VIA_TYPE_RULESSETTING"),t}function Kue(o,t){let e=new qt,r=R.getInstance().doctype!==pi.FOOTPRINT;return e.add("CANCEL",!0),e.addExtend("VIA_SIZE",Nre(o.holeRadius,o.radius),!r),r&&e.addExtend("VIA_TYPE",Fje(o),!0),e.add("toggleAdsorb",!1,t),e.add("ADSORBENT_CONFIG"),e}var w1=class extends ni{constructor(){super();this.commands=new De("draw via");this._radius=re.getInstance().getDefaultRadiusPhysics().defalutRadius;this._innerRadius=re.getInstance().getDefaultRadiusPhysics().defalutInner;this.type=0;this.name="";this._via=null;this.nearNode=null;this.followRule=le.pcbConfig.startViaSize=="rule";this.option="OPTIONLEFTUP",Ea.changeTool(this),uu.setTool(this)}set via(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._via=e}get via(){return this._via}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,startPoint:l,keyCode:c}=e;if(a){at.editingWhat=i;return}this.applyValue(e),c===13&&at.destroy()}applyValue(e){let{value:r,startPoint:i,cursorPoint:n}=e,s=new dt,a=new S(n.x-i.x,n.y-i.y).normalize();r=s.conversion(R.getInstance().unit,"mil",r/10),a=new S(a.x*r,a.y*r);let l=new S(a.x+i.x,a.y+i.y);this.via.center=l,this.placeVia(l)}onKeyDown(e){switch(tr.getAction(5,e)){case"Cancel":this.cancel();break;case"Switch Common Via Size While Routing/Placing Via":this.showCommonViaSizeMenu(e);break;case"Show Attribute Dialog When Placing Object":this.via!=null&&A.publish("openMainDialog",{cmd:28,data:{tool:this,item:this.via}});break}A.publish("updateFrame","")}onMouseLeftUp(e){if(!at.editingWhat&&this.via!==null){let r=new S(e.sceneX,e.sceneY);this.via.center=r,this.netsGroupSet=this.getNearNetPcbItems(e),this.handleNets(e)}}showNetsMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=this.getNetsMenuData().result,$t.getInstance().menuData(r,this),this.drawing=!1}getNetsMenuData(){let e=new qt,r="INHERIT_NET:";return this.nets.forEach(i=>{if(i){let n={name:i,cmd:`${r+i}`,tips:"",option:{disabledI18n:!0}};e.addObj(n,!1,!1)}}),e}getNearNetPcbItems(e){let r=new Ay([this.via]);r.updateScene();let{netsGroupSet:i}=r.getNetPcbItems(e);return i}handleNets(e){this.nets=new Set,this.netsGroupSet.forEach(r=>{this.nets=r.nets}),this.nets.size?this.nets.size===1?(this.nets.forEach(r=>{this.via.net=r,ut.setDefaultVia({net:r,holeRadius:null,radius:null})}),this.placeVia(this.via.center)):this.showNetsMenu(e):this.placeVia(this.via.center)}placeVia(e){if(!Mt.checkIsInCanEdit(this.via)){let n="beyond drawing range";Mt.showMassageTip(n,n);return}let r=Wr.addViaByModel(this.via.model.clone(),!0);r.partition=R.getInstance().partitionId,this.nearNode.clear(),A.publish("onlySelect",[r]),A.publish("hasModifyPcbItem",r);let i=Ce.dispatch(r,"add");this.commands.addCommand(i),qe.executeCommand(this.commands),A.publish("flushService",""),this.commands=new De("draw via"),this.drawing=!0,this.type=this.via.type,this.name=this.via.name,this.nearNode=new D1(this.via)}getViaRadius(){return this.via?{radius:this.via.radius,innerRadius:this.via.holeRadius}:{radius:this.radius,innerRadius:this.innerRadius}}updateViaRadius(){if(le.pcbConfig.startViaSize=="rule"){let e;ut.defaultVia.net!=""&&Ye.getSameNetItems(ut.defaultVia.net).length>0?e=re.getInstance().getRadiusPhysicsByNet(ut.defaultVia.net):e=re.getInstance().getDefaultRadiusPhysics(),this.modifyViaSize(e.defalutInner,e.defalutRadius,void 0,!0)}}onMouseMove(e){let r=new S(e.sceneX,e.sceneY);this.drawing&&(this.via!==null?(this.via.center=r,this.nearNode.generateRatline()):(this.start(),this.via=ut.getDefaultBaseVia(r,this.radius,this.innerRadius),this.via.type=this.type,this.via.name=this.name,this.nearNode=new D1(this.via)))}restore(){at.destroy(),this.via.remove(),this.nearNode.clear(),A.publish("delete",this.via),this.drawing=!0,this.via=null,A.publish("updateRtree",""),A.publish("flushSelectingInfo","")}interrupt(){this.via!==null&&(at.destroy(),this.via.remove(),this.nearNode.clear(),A.publish("delete",this.via),this.drawing=!1,this.via=null,A.publish("updateRtree",""),A.publish("flushSelectingInfo","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}flushNear(){this.via!=null&&this.via.net!=this.nearNode.net&&(this.nearNode.clear(),this.nearNode=new D1(this.via),this.nearNode.generateRatline())}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:Kue(this.via,e.adsorb).result};$t.getInstance().menuData(r,this),this.drawing=!1}changeType(e){switch(e){case"VIA_TYPE_RULESSETTING":{let r={activeTab:"Rule",activeMenu:"Blind/Buried Via"};A.publish("openMainDialog",{cmd:5,data:{option:r,tool:this}});break}case"VIA_TYPE_THROUGH_VIA":{this.via!=null&&(this.via.type=0,this.via.name="");break}default:{this.via!=null&&(this.via.type=1,this.via.name=e);break}}ML(this.via)}modifyViaSize(e,r,i,n=!1){let s;if(this.via.name!==""){let l=re.getInstance().getDefaultBlindPhysics().getBlindVia(this.via.name);l.viaSizeRule!==""?s=re.getInstance().getRadiusPhysicsByName(l.viaSizeRule):s=re.getInstance().getRadiusPhysicsByNet(this.via.net)}else s=re.getInstance().getRadiusPhysicsByNet(this.via.net);if(!(R.getInstance().doctype===pi.FOOTPRINT)&&(sf.inValidRadius(s,r)||sf.inValidInnerRadius(s,e))){A.publish("ui/toastMsg",{type:"warn",msg:"The modified value is not within the DRC requirements"},Q());return}i!=null&&(this.followRule=i),r!=null&&(this.via.radius=r,this._radius=r),e!=null&&(this.via.holeRadius=e,this._innerRadius=e),this.type=this.via.type,this.name=this.via.name,ut.setDefaultVia(this.via),n&&wi()}parse(e){this.drawing=!0;let i=e.cmdKey.split(":"),n=new dt;switch(i[0]){case"CANCEL":this.cancel();break;case"VIA_TYPE":this.changeType(i[1]);break;case"VIA_SIZE":if(i[1]==="VIA_SIZE_INPUT")A.publish("openMainDialog",{cmd:28,data:{tool:this,item:this.via}});else if(i[1]=="VIA_SIZE_COMMONLY_SETTING")A.publish("openSystemDialog","PCB_COMM_VIA_SIZE",Q());else if(i[1]=="VIA_SIZE_RULESSETTING"){let a={activeTab:"Rule",activeMenu:"Via Size"};A.publish("openMainDialog",{cmd:5,data:{option:a,tool:this}})}else if(i[1]=="VIA_SIZE_FOLLOWRULES"){let a=le.pcbConfig.startViaSize=="rule"?"last":"rule";le.pcbConfig.startViaSize=a,we.sizeFollowRule=le.pcbConfig.startViaSize=="rule",this.followRule=le.pcbConfig.startViaSize=="rule",le.pcbConfig.startViaSize=="rule"&&this.modifyViaSize(this.innerRadius,this.radius,void 0,!0)}else{this.followRule=!1;let a=le.viaConfig[i[1]].getSizeAccordingToUnit();this.modifyViaSize(a.innerRadius,a.radius,void 0,!0)}break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"INHERIT_NET":let s=i[1];this.via.net=s,ut.setDefaultVia({net:s,holeRadius:null,radius:null}),this.placeVia(this.via.center),this.drawing=!0;break;case"VIA_SIZE_COMMONLY_SETTING":A.publish("openSystemDialog","PCB_COMM_VIA_SIZE",Q());break}A.publish("updateFrame","")}getBlinds(){return this.via!=null&&re.getInstance().getDefaultBlindPhysics().getAllVias(),null}getBlindViaOptions(){let e=this.getBlinds(),r=new Array,i={name:"Through Via",cmd:"VIA_TYPE_THROUGH_VIA",tips:""};return r.push(i),e!=null&&e.forEach(n=>{let s={name:n.name,cmd:n.name,tips:""};this.via!=null&&this.via.name==n.name&&(s.selectedTag=!0),r.push(s)}),r}get radius(){let e=ut.defaultVia.net;(e==""||Ye.getSameNetItems(e).length==0)&&(e="");let r=re.getInstance().getRadiusPhysicsByNet(e),i=r.defalutRadius,n=r.minRadius,s=r.maxRadius;return this.followRule||ut.defaultVia.radius==null?this._radius=i:ut.defaultVia.radius<n?this._radius=n:ut.defaultVia.radius>s?this._radius=s:this._radius=ut.defaultVia.radius,this._radius}set radius(e){let r=ut.defaultVia.net;(r==""||Ye.getSameNetItems(r).length==0)&&(r="");let i=re.getInstance().getRadiusPhysicsByNet(r);if(e<i.minRadius||e>i.maxRadius){alert("The modified value is not within the DRC requirements");return}this._radius=e}get innerRadius(){let e=ut.defaultVia.net;(e==""||Ye.getSameNetItems(e).length==0)&&(e="");let r=re.getInstance().getRadiusPhysicsByNet(e),i=r.defalutInner,n=r.minInner,s=r.maxInner;return this.followRule||ut.defaultVia.radius==null?this._innerRadius=i:ut.defaultVia.innerRadius<n?this._innerRadius=n:ut.defaultVia.innerRadius>s?this._innerRadius=s:this._innerRadius=ut.defaultVia.innerRadius,this._innerRadius}set innerRadius(e){this._innerRadius=e}showCommonViaSizeMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=QB(this.innerRadius,this.radius).result,$t.getInstance().menuData(r,this),this.drawing=!1}};function Vje(o,t){let e=new qt;return e.add("CANCEL"),e.add("toggleAdsorb",!1,o),e.add("ADSORBENT_CONFIG"),e.result}function Gje(o){return o<0&&(o=kr+o),o}var lC=class extends ni{constructor(){super();this.state=0;this.defaultLineWidth=Ha.getInstance().getTrackWidth().value||1;this._pcbArc=null;this._polygon=null;this.option="OPTIONLEFTUP",Ur.addDrawTool(this)}set pcbArc(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._pcbArc=e}get pcbArc(){return this._pcbArc}get polygon(){return this._polygon}getWidth(){return this.defaultLineWidth}set polygon(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._polygon=e}onKeyDown(e){let r=tr.getLocalAction(["decrease_routing_width","increase_routing_width"],e);switch(r||(r=tr.getAction([4],e)),r){case"Cancel":this.cancel();break;case"Switch Common Track Width":this.showCommonTrackWidthMenu(e);break;case"decrease_routing_width":{let n=this.defaultLineWidth-.2;n>=.1&&(this.setWireWidth(n),wi())}break;case"increase_routing_width":{let n=this.defaultLineWidth+.2;this.setWireWidth(n),wi()}break;case"Change Track Width While Routing":{A.publish("openMainDialog",{cmd:26,data:{tool:this}});break}case"Finish":this.onEnterPlace(e);break}A.publish("updateFrame","")}onMouseLeftUp(e){if(!this.drawing){this.drawing=!0,A.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},Q());return}let r=new S(e.sceneX,e.sceneY);if(this.state==0){if(!Mt.checkIsCanEditByPoint(r))return;this.start(),this.pcbArc=Yc.addArc(Pe.getActiveLayerID(),r,.1,this.defaultLineWidth,0,kr,ae.CCW,!1,2),this.polygon=pt.addPolygon("Line",Pe.getActiveLayerID(),[[this.pcbArc]],this.defaultLineWidth,"",!1),this.state=1,this.drawing=!0}else if(this.pcbArc!==null)switch(this.pcbArc.partition=R.getInstance().partitionId,this.polygon.partition=R.getInstance().partitionId,this.state){case 1:if(!Mt.checkIsCanEditByPoint(r))return;let i=r.sub(this.pcbArc.center),n=Gje(Math.atan2(i.y,i.x));this.pcbArc.startAngle=n,this.pcbArc.endAngle=n,this.state=2;break;case 2:if(!Mt.checkIsInCanEdit(this.polygon)){let a="beyond drawing range";Mt.showMassageTip(a,a);return}r.distance1(this.pcbArc.start)<.1&&(this.pcbArc.sweep===ae.CCW?this.pcbArc.endAngle=this.pcbArc.startAngle-1e-4:this.pcbArc.endAngle=this.pcbArc.startAngle+1e-4);let s=new hi;s.createGroup("draw center arc"),s.addCommand4Item(this.polygon,"add"),s.checkOutlines([this.polygon],new Set),_y(this.polygon),A.publish("onlySelect",[this.pcbArc]),A.publish("flushService",""),this.pcbArc=null,this.polygon=null,this.state=0,this.drawing=!0,this.end();break}}onMouseMove(e){if(this.state!==0&&this.pcbArc!==null&&this.drawing){let i=new S(e.sceneX,e.sceneY).sub(this.pcbArc.center);switch(this.state){case 1:{this.pcbArc.radius=Math.max(i.length(),.1);break}case 2:{let n=Gje(Math.atan2(i.y,i.x));this.pcbArc.endAngle=n;break}}}}restore(){this.state=0,this.pcbArc.remove(),this.polygon.remove(),A.publish("delete",this.pcbArc),A.publish("delete",this.polygon),this.pcbArc=null,this.drawing=!0,this.polygon=null,A.publish("updateRtree","")}interrupt(){this.pcbArc!==null&&(this.state=0,this.pcbArc.remove(),this.polygon.remove(),A.publish("delete",this.pcbArc),A.publish("delete",this.polygon),this.pcbArc=null,this.polygon=null,A.publish("updateRtree","")),this.state=0,Ur.clearDrawTool(),this.end()}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:Vje(e.adsorb,this.defaultLineWidth)};$t.getInstance().menuData(r,this),this.drawing=!1}toggleLayer(e){this._pcbArc!=null&&this._pcbArc.layerId!=e&&(this._pcbArc.layerId=e)}showCommonTrackWidthMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=Dm(this.defaultLineWidth).result,$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){let r=e.cmdKey;this.drawing=!0;let i=r.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"WIRING_WIDTH":this.toggleWidth(i[1]);break;case"WIRING_WIDTH_COMMONLY_SSETTING":A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",Q());break}A.publish("updateFrame","")}toggleWidth(e){let r=le.trackConfig[e];this.setWireWidth(r.getSizeAccordingToUnit()),wi()}setWireWidth(e){this.polygon!=null&&(this.polygon.strokeWidth=e),we.prevTrackWidth=e,this.defaultLineWidth=e,A.publish("flushSelectingInfo","")}cancel(){let e=this.pcbArc!=null;this.interrupt(),e||A.publish("tool","dropdrag")}wireCorner(e){}wireMode(e){}};var cC=class extends ni{constructor(){super();this.defaultLineWidth=Ha.getInstance().getTrackWidth().value||1;this._start=null;this._pcbArc=null;this._polygon=null;this.option="OPTIONLEFTUP",Ur.addDrawTool(this)}set pcbArc(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._pcbArc=e}get pcbArc(){return this._pcbArc}getWidth(){return this.defaultLineWidth}get polygon(){return this._polygon}set polygon(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._polygon=e}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":this.cancel();break;case"Switch Common Track Width":this.showCommonTrackWidthMenu(e);break;case"Change Track Width While Routing":{A.publish("openMainDialog",{cmd:26,data:{tool:this}});break}case"Finish":this.onEnterPlace(e);break}A.publish("updateFrame","")}onMouseLeftUp(e){if(!this.drawing){this.drawing=!0,A.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},Q());return}let r=new S(e.sceneX,e.sceneY);if(this.pcbArc==null){if(!Mt.checkIsCanEditByPoint(r))return;this.start(),this._start=r,this.pcbArc=Yc.addArc(Pe.getActiveLayerID(),r,.1,this.defaultLineWidth,0,Math.PI,ae.CCW,!1),this.polygon=pt.addPolygon("Line",Pe.getActiveLayerID(),[[this.pcbArc]],this.defaultLineWidth,"",!1),this.polygon.partition=R.getInstance().partitionId,this.drawing=!0}else{if(!Mt.checkIsInCanEdit(this.polygon)){let n="beyond drawing range";Mt.showMassageTip(n,n);return}let i=new hi;i.createGroup("draw Semicircle arc"),i.addCommand4Item(this.polygon,"add"),i.checkOutlines([this.polygon],new Set),_y(this.polygon),A.publish("onlySelect",[this.polygon]),A.publish("flushService",""),this.pcbArc=null,this._start=null,this.drawing=!0,this.end()}}onMouseMove(e){if(this.pcbArc!==null&&this.drawing){let i=new S(e.sceneX,e.sceneY).sub(this._start),n=i.length()/2,s=this._start.add(i.mul(.5)),a=Math.atan2(-i.y,-i.x),l=Math.atan2(i.y,i.x);this.pcbArc.center=s,this.pcbArc.radius=n,this.pcbArc.startAngle=a,this.pcbArc.endAngle=l}}interrupt(){this.pcbArc!==null&&(this.pcbArc.remove(),this.polygon.remove(),A.publish("delete",this.pcbArc),A.publish("delete",this.polygon),this._start=null,this.pcbArc=null,this.polygon=null,A.publish("updateRtree","")),Ur.clearDrawTool(),this.end()}onMouseRightUp(e){if(e.openMenu)switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.onMouseLeftUp(e):this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}cancel(){let e=this.pcbArc!=null;Ut.cancel(),this.interrupt(),e||A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this),this.drawing=!1}showCommonTrackWidthMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=Dm(this.defaultLineWidth).result,$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"WIRING_WIDTH":this.toggleWidth(i[1]);break;case"WIRING_WIDTH_COMMONLY_SSETTING":A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",Q());break}A.publish("updateFrame","")}toggleWidth(e){let r=le.trackConfig[e];this.setWireWidth(r.getSizeAccordingToUnit()),wi()}setWireWidth(e){this.polygon!=null&&(this.polygon.strokeWidth=e),we.prevTrackWidth=e,this.defaultLineWidth=e,A.publish("flushSelectingInfo","")}toggleLayer(e){this._pcbArc!=null&&this._pcbArc.layerId!=e&&(this._pcbArc.layerId=e)}wireCorner(e){}wireMode(e){}};var RG=class extends ni{constructor(){super();this.commands=new De("draw text");this.text=null;this.option="OPTIONLEFTUP",xo.setTool(this)}onKeyDown(e){switch(tr.getAction(5,e)){case"Cancel":this.cancel();break;case"Rotate Left":this.text!=null&&(this.text.rotateFor(this.text.position,le.pcbConfig.rotate),ut.defaultText.rotation+=le.pcbConfig.rotate);break;case"rotate_right":this.text!=null&&(this.text.rotateFor(this.text.position,-le.pcbConfig.rotate),ut.defaultText.rotation-=le.pcbConfig.rotate);break;case"Flip Right and Left":A.publish("turn","turnAround");break;case"Flip Up and Down":A.publish("turn","turnUpsideDown");break;case"Show Attribute Dialog When Placing Object":A.publish("getLastText","");break}A.publish("updateFrame","")}toggleLayer(e){this.text.layerId!=this.getLayer()&&(this.text.layerId=this.getLayer())}onMouseLeftUp(e){if(!this.drawing)this.drawing=!0,A.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},Q());else{if(this.text.partition=R.getInstance().partitionId,!Mt.checkIsInCanEdit(this.text,this.getLayer())){let l="beyond drawing range";Mt.showMassageTip(l,l);return}let r=new S(e.sceneX,e.sceneY);A.publish("onlySelect",[this.text]);let i=Ce.dispatch(this.text,"add");this.commands.addCommand(i),qe.executeCommand(this.commands),this.commands=new De("draw text"),A.publish("hasModifyPcbItem",this.text),A.publish("flushService","");let n=KS("typeface"),s=KS("height"),a=KS("strokeWidth");this.createText(r,n,a,s),xG(this.getNextValue(ND)),this.drawing=!0}}getNextValue(e){if(e.match(/\d+$/)){let r=e.match(/\d{1,15}$/)[0],i=e.split(new RegExp(r+"$"))[0],n;if(!Number.isNaN(+r)&&r.length>1){let s=r.match(/^0+/),a=Number(r);s&&(n=s[0],String(a+1).length!=String(a).length&&(n=n.substr(0,n.length-1)),i=i+n)}return`${i}${Number(r)+1}`}else return e}getLastValue(e){if(e.match(/\d+$/)){let r=e.match(/\d{1,15}$/)[0],i=e.split(new RegExp(r+"$"))[0],n;if(!Number.isNaN(+r)&&r.length>1){let s=r.match(/^0+/),a=Number(r);s&&(n=s[0],String(a+1).length!=String(a).length&&(n=n.substr(0,n.length-1)),i=i+n)}return`${i}${Number(r)-1}`}else return e}onMouseMove(e){if(this.drawing){let r=new S(e.sceneX,e.sceneY);if(this.text!==null)this.text.layerId!=this.getLayer()&&(this.text.layerId=this.getLayer()),this.text.position=r;else{let i=KS("typeface"),n=KS("height"),s=KS("strokeWidth");this.createText(r,i,s,n),xG(this.getNextValue(ND))}}}interrupt(){this.text!==null&&(this.text.remove(),A.publish("delete",this.text),this.drawing=!1,this.text=null,A.publish("updateRtree","")),this.end()}cancel(){this.interrupt(),xG(this.getLastValue(ND)),A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"FLIP":i[1]=="FLIP_LEFTANDRIGHT"?this.turn("turnAround"):i[1]=="FLIP_UPANDDOWN"&&this.turn("turnUpsideDown");break}A.publish("updateFrame","")}createText(e,r=ri.textAttr["attr-text-typeface"],i=ri.textAttr["attr-text-stroke-width"],n=ri.textAttr["attr-text-size"]){this.start(),this.text=ri.addText(this.getLayer(),"",!1,ND,!0,r,n,ri.textAttr["attr-rotation"],!1,e,ri.textAttr["attr-origin"],i,ri.textAttr["attr-reversed-phase"],ri.textAttr["attr-reversed-phase-extend"],ri.textAttr["attr-mirror"])}getLayer(){let e=Ze.getInstance().activeLayer;return(7==e||8==e||57==e||ub(e)||ar(e)||mu(Ze.getInstance().getLayer(e).type)||W9(e)||ic(e)||ra(e)||52===e)&&(e=3),e}turn(e){if(!(!R.getInstance().isactive||23==R.getInstance().doctype))switch(e){case"turnAround":xo.turn([this.text],!1,!1);break;case"turnUpsideDown":xo.turn([this.text],!0,!1);break}}};var Zue=class extends ni{constructor(){super();this.commands=new De("draw protractor");this.line=null;this._start=null;this.state=0;this.length=0;this.protractor=null;this.option="OPTIONLEFTUP"}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);break}A.publish("updateFrame","")}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY);if(this.line===null&&this.protractor===null){this.start(),this._start=r,this.drawing=!0,this.state=0;let i=HM();this.line=Vi.build(i,r,r,1)}else switch(this.state){case 0:let i=os.lastPrecision?os.lastPrecision:R.getInstance().unit=="mil"?1:3;this.protractor=os.addProtractor(HM(),.6,4.5,i,this.line.start,this.line.end,this.line.end,!1),this.length=this.line.length,this.state=1;break;case 1:this.protractor.partition=R.getInstance().partitionId,this.line.remove(),this.line=null,this._start=null,this.state=0,this.length=0,A.publish("onlySelect",[this.protractor]),this.commands.addCommand(Ce.dispatch(this.protractor,"add")),qe.executeCommand(this.commands),this.commands=new De("draw protractor"),this.protractor=null,this.drawing=!0,A.publish("updateRtree",""),this.end();break;default:break}}onMouseMove(e){if(this.line!==null&&this.drawing)switch(this.state){case 0:this.line.end=new S(e.sceneX,e.sceneY);break;case 1:if(this.protractor!=null){let r=new S(e.sceneX,e.sceneY).sub(this._start).normalize().mul(this.length);this.protractor.end=this._start.add(r)}break;default:break}}interrupt(){this.line!==null&&(this.line.remove(),this.line=null,this.protractor!=null&&(this.protractor.remove(),A.publish("delete",this.protractor),this.protractor=null),this._start=null,this.state=0,this.length=0,this.drawing=!1,A.publish("updateRtree","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this)}parse(e){switch(e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}};var Jue=class extends ni{constructor(){super();this.dimension=null;this.adjustText=!1;this._start=null;this._end=null;this.bbox=null;this.option="OPTIONLEFTUP"}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);break}A.publish("updateFrame","")}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY);if(this.dimension===null){this.start();let i=Yo.lastPrecision?Yo.lastPrecision:R.getInstance().unit=="mil"?1:3;this.dimension=Yo.addDimension(HM(),r,r,r,r,i,10,.6,R.getInstance().unit,!1),this.drawing=!0,this._start=r}else if(!this.adjustText)this.adjustText=!0,this._end=r,this.bbox=new _e().ext2(this._start).ext2(this._end).build1();else{this.dimension.partition=R.getInstance().partitionId,A.publish("onlySelect",[this.dimension]);let i=new De("draw dimension");i.addCommand(Ce.dispatch(this.dimension,"add")),qe.executeCommand(i),this.dimension=null,this.reset(),this.drawing=!0,A.publish("updateRtree","")}}onMouseMove(e){if(this.dimension!==null&&this.drawing)if(!this.adjustText)this.dimension.modifyEnd(new S(e.sceneX,e.sceneY));else{let r=new S(e.sceneX,e.sceneY);if(this.bbox.isContainsX(r.x)&&!this.bbox.isContainsY(r.y)){let i=new S(this._start.x,r.y),n=new S(this._end.x,r.y);this.dimension.modifyDimension(i,n)}else if(!this.bbox.isContainsX(r.x)&&this.bbox.isContainsY(r.y)){let i=new S(r.x,this._start.y),n=new S(r.x,this._end.y);this.dimension.modifyDimension(i,n)}else{let i=this._end.sub(this._start).normalize(),n=new S(-i.y,i.x),s=r.sub(this._start).dot(n),a=this._start.add(n.mul(s)),l=a.add(this._end.sub(this._start));this.dimension.modifyDimension(a,l)}}}interrupt(){this.dimension!==null&&(this.dimension.remove(),A.publish("delete",this.dimension),this.dimension=null,this.drawing=!1,A.publish("updateRtree","")),this.end()}cancel(){this.interrupt(),this._start==null?A.publish("tool","dropdrag"):this.drawing=!0,this.reset()}reset(){this._start=null,this._end=null,this.adjustText=!1,this.bbox=null}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this)}parse(e){switch(e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}};var DG=class extends ni{constructor(){super(),this.option="OPTIONLEFTUP",Ea.changeTool(this)}onKeyDown(t){switch(tr.getAction(4,t)){case"Cancel":this.cancel();break}A.publish("updateFrame","")}onMouseLeftUp(t){let e=new S(t.sceneX,t.sceneY);this.place(e)}place(t){G3(t),this.drawing=!1,A.publish("tool","dropdrag"),at.destroy()}interrupt(){this.drawing=!1,this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}applyValue(t){let{value:e,cursorPoint:r,startPoint:i}=t;e=new dt().conversion(R.getInstance().unit,"mil",e/10);let s=new S(r.x-i.x,r.y-i.y).normalize();s=new S(s.x*e,s.y*e);let a=new S(s.x+i.x,s.y+i.y);this.place(a),at.destroy()}applyInputAtCursorValue(t){let{value:e,type:r,locked:i,unlocked:n,editing:s,keyCode:a,startPoint:l}=t;if(s){at.editingWhat=r;return}this.applyValue(t)}rightClickMenuData(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:po(t.adsorb)};$t.getInstance().menuData(e,this),this.drawing=!1}parse(t){switch(this.drawing=!0,t.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}};var kD=class o extends Oo{static copy(t){A.messageBus.rpcCall("copy",t).then(e=>e.message&&o.copySuccess()).then(()=>we.updatePartialState({refreshPasteState:!0})),A.publish("referPosition",null)}static copySuccess(){A.publish("ui/toastMsg",{type:"success",msg:"Copy Success!"},Q())}constructor(){super(),this.drawing=!0,Ut.update(fi.getInstance(),"Please select a reference point"),On.getInstance().allowPull=!1}onKeyDown(t){let e=tr.getAction(3,t);switch(e==null&&(e=tr.getAction(4,t)),e){case"Cancel":this.cancel();break;case"Paste":let r=ze.getSelects(),i=ys(r),n;i.valid()&&(n=i.build1()),A.publish("referPosition",new S(n.center().x,n.center().y)),A.messageBus.rpcCall("copyItems","").then(s=>{s.message&&o.copySuccess()}),A.publish("tool","PASTE"),A.publish("clearSelect",""),this.interrupt();break}A.publish("updateFrame","")}onEnterPlace(t){this.onMouseLeftUp(t)}onMouseMove(t){this.drawing&&(super.onMouseMove(t),Ut.update(t,"Please select a reference point"))}onMouseLeftUp(t){this.drawing=!1,A.publish("referPosition",new S(t.sceneX,t.sceneY)),A.messageBus.rpcCall("copyItems","").then(e=>{e.message&&o.copySuccess()}),A.publish("clearSelect",""),A.publish("tool","dropdrag"),Ut.cancel(),Fl.nthTime=1}interrupt(){this.drawing=!1,Ut.cancel(),On.getInstance().allowPull=!0}cancel(){this.interrupt(),A.publish("tool","dropdrag")}onMouseRightUp(t){if(t.openMenu){if(le.pcbConfig.endDrawing=="ctrl+rightClick"){if(!t.ctrlKey){this.rightClickMenuData(t);return}}else if(t.ctrlKey){this.rightClickMenuData(t);return}this.cancel()}}rightClickMenuData(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:po(t.adsorb)};$t.getInstance().menuData(e,this),this.drawing=!1}parse(t){switch(this.drawing=!0,t.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}};var pE=class extends Oo{constructor(){super(),A.publish("pasteData",{uuid:R.getInstance().compiler.uuid,title:R.getInstance().name,doctype:R.getInstance().doctype},Q()),Ea.changeTool(this),Fl.tool=this,On.getInstance().allowPull=!1}async initPastePanel(){ze.isSpecialPaste||(await OG.getInstance().initPaste2CurrentActiveLayer(),a0.getInstance().setTool(this),A.publish("FlushSketcherAttrView",{type:"PASTE",isInitAllParams:!0,switchTab:!0}))}onKeyDown(t){Fl.onKeyDown(t)}onEnterPlace(t){Fl.onMouseLeftUp(t)}onKeyUp(t){Fl.onKeyUp(t)}onMouseLeftUp(t){Fl.onMouseLeftUp(t),R.getInstance().doctype===3&&A.windowBridge.rpcCall(fTe.LOG.SET,[{type:NPe.PRIMITIVE_PASTE_ACROSS_PROJECT,content:[{"PCB Name":R.getInstance().name}],project_uuid:R.getInstance().currOpenProjectId}],Q())}applyInputAtCursorValue(t){let{type:e,editing:r,keyCode:i}=t;if(r){at.editingWhat=e;return}Fl.applyValue(t),i===13&&at.destroy()}onMouseMove(t){Fl.onMouseMove(t)}interrupt(){Fl.interrupt(),Fl.tool=null,On.getInstance().allowPull=!0}cancel(){Fl.cancel(),Fl.tool=null,On.getInstance().allowPull=!0}onMouseRightUp(t){Fl.onMouseRightUp(t)}};var y5=class o extends Oo{static clip(){let t=()=>{A.publish("referPosition",null),A.messageBus.rpcCall("copyItems","").then(e=>{e&&o.cutSuccess()}),A.publish("clearSelect","")};A.publish("removeSelect",t)}static cutSuccess(){A.publish("ui/toastMsg",{type:"success",msg:"Cut Success!"},Q())}constructor(){super(),this.drawing=!0,Ut.update(fi.getInstance(),"Please select a reference point"),On.getInstance().allowPull=!1}onKeyDown(t){let e=tr.getAction(3,t);switch(e==null&&(e=tr.getAction(4,t)),e){case"Cancel":this.cancel();break;case"Paste":ze.clipHandleSelectItem();let r=()=>{A.publish("referPosition",null),A.messageBus.rpcCall("copyItems","").then(i=>{i&&o.cutSuccess()}),A.publish("clearSelect",""),A.publish("tool","PASTE"),this.interrupt()};A.publish("removeSelect",r);break}A.publish("updateFrame","")}onEnterPlace(t){this.onMouseLeftUp(t)}onMouseMove(t){this.drawing&&(super.onMouseMove(t),Ut.update(t,"Please select a reference point"))}onMouseLeftUp(t){this.drawing=!1,ze.clipHandleSelectItem();let e=new S(t.sceneX,t.sceneY),r=()=>{A.publish("referPosition",e),A.messageBus.rpcCall("copyItems","").then(i=>{i&&o.cutSuccess()}),A.publish("clearSelect",""),A.publish("updateRtree",""),A.publish("tool","dropdrag"),Ut.cancel()};A.publish("removeSelect",r)}onMouseRightUp(t){if(t.openMenu){if(le.pcbConfig.endDrawing=="ctrl+rightClick"){if(!t.ctrlKey){this.rightClickMenuData(t);return}}else if(t.ctrlKey){this.rightClickMenuData(t);return}this.cancel()}}rightClickMenuData(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:po(t.adsorb)};$t.getInstance().menuData(e,this),this.drawing=!1}parse(t){switch(this.drawing=!0,t.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}interrupt(){this.drawing=!1,Ut.cancel(),On.getInstance().allowPull=!0}cancel(){this.interrupt(),A.publish("tool","dropdrag")}};var Que=class extends ni{constructor(){super();this.selections=new Array;this.mouseLeftX=0;this.mouseLeftY=0;this.drawing=!0}option1(e){switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.completed():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.selections.length>0?this.reDraw():this.cancel();break}}}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":this.selections.length?this.reDraw():this.cancel();break}A.publish("updateFrame","")}onMouseLeftDown(e){}onMouseMove(e){let r=e.sceneX,i=e.sceneY;this.selections.length>0&&this.drawing&&(this.selections[0].start=new S(this.mouseLeftX,this.mouseLeftY),this.selections[0].end=new S(r,this.mouseLeftY),this.selections[1].start=new S(r,this.mouseLeftY),this.selections[1].end=new S(r,i),this.selections[2].start=new S(r,i),this.selections[2].end=new S(this.mouseLeftX,i),this.selections[3].start=new S(this.mouseLeftX,i),this.selections[3].end=new S(this.mouseLeftX,this.mouseLeftY))}onMouseLeftUp(e){let r=le.themeConfig.canvasTheme,i=r.isSolidLine(r.selectBoxLineStyle),n=r.selectBoxColor;if(this.selections.length==0){this.start();let s=e.sceneX,a=e.sceneY;this.mouseLeftX=s,this.mouseLeftY=a,this.selections.push(new cr(1002,new S(this.mouseLeftX,this.mouseLeftY),new S(s,this.mouseLeftY),i,n)),this.selections.push(new cr(1002,new S(s,this.mouseLeftY),new S(s,a),i,n)),this.selections.push(new cr(1002,new S(s,a),new S(this.mouseLeftX,a),i,n)),this.selections.push(new cr(1002,new S(this.mouseLeftX,a),new S(this.mouseLeftX,this.mouseLeftY),i,n))}else{this.reDraw();let s=new _e().ext6(this.mouseLeftX,this.mouseLeftY).ext6(e.sceneX,e.sceneY).build1();A.publish("adaptBBox",s),A.publish("updateCrossDirect",e),this.end()}}reDraw(){for(let e of this.selections)e.remove();this.selections.length=0}interrupt(){for(let e of this.selections)e.remove();this.selections.length=0,this.drawing=!1,this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}};var ede=class extends ni{constructor(){super();this.commands=new De("Place radius size");this.radius=null;this.arc=null;this.option="OPTIONLEFTUP"}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);break}A.publish("updateFrame","")}onMouseMove(e){if(this.arc!=null&&this.radius!=null&&this.drawing){let r=new S(e.sceneX,e.sceneY),i;this.arc instanceof rr?i=this.rectArcCenter:i=this.arc.center;let n=r.sub(i).normalize().mul(this.arc.radius).add(i);if(this.arc.isSelect(n.x,n.y))if(n.distance1(r)>this.radius.getRadiusLength())this.radius.updateRadius(r,n);else{let a=r.sub(n).normalize().mul(this.radius.getRadiusLength()).add(n);this.radius.updateRadius(a,n)}else if(this.arc instanceof _t||this.arc instanceof yi){let s=r.sub(this.arc.center).normalize(),a=this.arc.start.sub(this.arc.center),l=this.arc.end.sub(this.arc.center),c=a.dot(s),h=l.dot(s);c>h?n=this.arc.start:n=this.arc.end;let u=this.radius.start.sub(this.radius.end).length();if(r.distance1(this.arc.center)>this.arc.radius){let d=n.add(n.sub(this.arc.center).normalize().mul(u));this.radius.updateRadius(d,n)}else{let d=n.add(this.arc.center.sub(n).normalize().mul(u));this.radius.updateRadius(d,n)}}}}onMouseLeftUp(e){if(this.arc==null&&this.radius==null){let r=new S(e.sceneX,e.sceneY),i=e.sceneX,n=e.sceneY,s=new ht(i,i,n,n),a=tj(s);for(let l of a.getArcs())l.isSelect(i,n)&&(jt.filter([l]).size&&l.click(),this.arc=l);for(let l of a.rects)if(l.isSelect(i,n)){if(l instanceof rr){let c=l.getHoveredArc(i,n);if(c)this.rectArcCenter=c.center;else continue}jt.filter([l]).size&&l.click(),this.arc=l}for(let l of a.polygons){let c=l.getAllChildrens();for(let h of c)h.isSelect(i,n)&&l8(h.model.modelType)&&(jt.filter([h]).size&&h.click(),this.arc=h)}if(this.arc!=null){this.start();let l;this.arc instanceof rr?l=this.rectArcCenter:l=this.arc.center;let c=l.sub(r).normalize(),h=jo.lastPrecision?jo.lastPrecision:R.getInstance().unit=="mil"?1:3;this.radius=jo.addRadius(HM(),r.add(c),r,.6,8,this.arc.radius,h,R.getInstance().unit,!1)}this.arc&&jt.filter([this.arc]).size&&A.publish("onlySelect",[this.arc])}else{A.publish("onlySelect",[this.radius]),A.publish("updateRtree","");let r=Ce.dispatch(this.radius,"add");this.commands.addCommand(r),qe.executeCommand(this.commands),this.commands=new De("Place radius size"),this.arc=null,this.radius=null,this.rectArcCenter=null,this.end()}}interrupt(){if(this.arc!=null&&this.radius!=null){A.publish("select",[]),this.radius.remove(),A.publish("delete",this.radius);let e=this.arc.getParent();e&&e instanceof lt?jt.filter([e]).size>0&&(e.visible(),e.getAllChildrens().forEach(r=>r.visible())):jt.filter([this.arc]).size>0&&this.arc.visible(),this.arc=null,this.radius=null,this.rectArcCenter=null,this.drawing=!1,A.publish("updateRtree","")}this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this)}parse(e){switch(e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}};var hC=class extends ni{constructor(){super();this.helpLine=null;this.defaultLineWidth=Ha.getInstance().getTrackWidth().value||1;this._pcbArc=null;this._polygon=null;this.adjustAngle=!1;this.option="OPTIONLEFTUP",Ur.addDrawTool(this)}set pcbArc(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._pcbArc=e}get pcbArc(){return this._pcbArc}get polygon(){return this._polygon}getWidth(){return this.defaultLineWidth}set polygon(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._polygon=e}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":this.cancel();break;case"Switch Common Track Width":this.showCommonTrackWidthMenu(e);break;case"Change Track Width While Routing":{A.publish("openMainDialog",{cmd:26,data:{tool:this}});break}case"Finish":this.onEnterPlace(e);break}A.publish("updateFrame","")}onMouseLeftUp(e){if(!this.drawing){this.drawing=!0,A.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},Q());return}let r=new S(e.sceneX,e.sceneY);if(this.pcbArc==null&&this.helpLine==null){if(!Mt.checkIsCanEditByPoint(r))return;this.start();let i=Pe.getActiveLayerID();this.helpLine=Vi.build(i,r,r,this.defaultLineWidth,ee.WHITE),this.drawing=!0}else if(this.adjustAngle){if(this.polygon!=null){if(this.polygon.partition=R.getInstance().partitionId,this.pcbArc.partition=R.getInstance().partitionId,!Mt.checkIsInCanEdit(this.polygon)){let n="beyond drawing range";Mt.showMassageTip(n,n);return}let i=new hi;i.createGroup("draw three point arc"),i.addCommand4Item(this.polygon,"add"),i.checkOutlines([this.polygon],new Set),_y(this.polygon),A.publish("onlySelect",[this.pcbArc])}this.helpLine!=null&&(this.helpLine.remove(),this.helpLine=null),this.polygon=null,this.pcbArc=null,this.drawing=!0,this.adjustAngle=!1,this.end()}else{if(!Mt.checkIsCanEditByPoint(r))return;this.helpLine.end=r,this.helpLine.length>.01?(this.helpLine.color=ee.BLACK,this.adjustAngle=!0):(this.helpLine.remove(),this.helpLine=null)}}onMouseMove(e){if(this.drawing){let r=new S(e.sceneX,e.sceneY);if(this.adjustAngle){let i=new Yn;if(this.pcbArc==null&&this.helpLine!=null){if((r.equals(this.helpLine.start)||r.equals(this.helpLine.end))&&(r=r.add(new S(.001,0))),Math.abs(this.helpLine.start.sub(r).cross(this.helpLine.end.sub(r)))>1e-8){let{center:n,radius:s,startAngle:a,endAngle:l,sweep:c}=i.point2Angle(this.helpLine.start,this.helpLine.end,r);this.pcbArc=Yc.addArc(Pe.getActiveLayerID(),n,s,this.defaultLineWidth,a,l,c,!1),this.helpLine.remove(),this.helpLine=null,this.polygon=pt.addPolygon("Line",Pe.getActiveLayerID(),[[this.pcbArc]],this.defaultLineWidth,"",!1)}}else{let n=this.pcbArc.start,s=this.pcbArc.end;if(Math.abs(n.sub(r).cross(s.sub(r)))>1e-8){let{center:a,radius:l,startAngle:c,endAngle:h,sweep:u}=i.point2Angle(n,s,r);this.pcbArc.center=a,this.pcbArc.radius=l,this.pcbArc.startAngle=c,this.pcbArc.endAngle=h,this.pcbArc.sweep=u}}}else this.helpLine!=null&&(this.helpLine.end=r)}}interrupt(){this.helpLine!=null&&(this.helpLine.remove(),this.helpLine=null),this.pcbArc!==null&&(this.pcbArc.remove(),this.polygon.remove(),A.publish("delete",this.pcbArc),A.publish("delete",this.polygon),this.pcbArc=null,this.polygon=null,this.adjustAngle=!1,A.publish("updateRtree","")),Ur.clearDrawTool(),this.end()}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this),this.drawing=!1}toggleLayer(e){this._pcbArc!=null&&this._pcbArc.layerId!=e&&(this._pcbArc.layerId=e)}showCommonTrackWidthMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=Dm(this.defaultLineWidth).result,$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"WIRING_WIDTH":this.toggleWidth(i[1]);break;case"WIRING_WIDTH_COMMONLY_SSETTING":A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",Q());break}A.publish("updateFrame","")}toggleWidth(e){let r=le.trackConfig[e];this.setWireWidth(r.getSizeAccordingToUnit()),wi()}setWireWidth(e){this.helpLine&&(this.helpLine.width=e),this.polygon&&(this.polygon.strokeWidth=e),we.prevTrackWidth=e,this.defaultLineWidth=e,A.publish("flushSelectingInfo","")}cancel(){let e=this.helpLine!=null||this.pcbArc!=null;Ut.cancel(),this.interrupt(),e||A.publish("tool","dropdrag")}wireCorner(e){}wireMode(e){}};var wG=class extends ni{constructor(){super();this.event=new du;this.started=!1;switch(this.event=new du,this.event._width=.02,this.resultEvent=new jS,Zt.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new eh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new Gh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new ja(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Tl(this.event,Ur,this.resultEvent);break}this.event.commands=new De("draw polygon pad"),Ur.addDrawTool(this),A.subscribe("PolygonPadReset",this.onPolygonPadReset.bind(this))}onPolygonPadReset(e){e===this.drawPolygon&&(this.started=!1)}onKeyDown(e){switch(tr.getAction(4,e)){case"changeRoutingAngle":case"Routing Corner":let i=Ur.getNextType();if(this.wireCorner(i),i==="WIRING_CORNER_FREEANGLE"||i==="WIRING_CORNER_ARC"){let n=new S(e.sceneX,e.sceneY);this.showFloatingInputBox(n)}else at.destroy();wi();break;case"Finish":if(!this.started){this.onEnterPlace(e);return}}this.drawPolygon.onKeyDown(e)}onMouseLeftUp(e){if(at.editingWhat){at.editingWhat="";return}this.started||(this.started=!0,this.start()),this.dealLocked(e),this.drawPolygon.onMouseLeftUp(e),at.destroy()}dealLocked(e){if(typeof at.lineLockedLength=="number"){let r=at.startPoint,i=new S(e.sceneX,e.sceneY),n=new S(i.x-r.x,i.y-r.y).normalize(),s=new S(n.x*at.lineLockedLength,n.y*at.lineLockedLength);i=new S(s.x+r.x,s.y+r.y),e.sceneX=i.x,e.sceneY=i.y}if(typeof at.lineLockedAngle=="number"){let r=at.startPoint,i=new S(e.sceneX-r.x,e.sceneY-r.y),n=(i.angleD(S.ORIGIN)+360)%360,s=i.rotateD(S.ORIGIN,at.lineLockedAngle-n);e.sceneX=s.x+r.x,e.sceneY=s.y+r.y}}showFloatingInputBox(e){if(le.pcbConfig.useDynamicInputBox&&this.started&&this.event.last&&(this.drawPolygon instanceof Tl||this.drawPolygon instanceof ja)){let r=nf(),i=this.event.last;at.startPoint=i;let n=i.distance1(e);if(!n)return;let s=_o(e),a=_o(i),c=(new S(e.x-i.x,e.y-i.y).angleD(S.ORIGIN)+360)%360;if(this.drawPolygon instanceof Tl||this.drawPolygon instanceof ja&&!this.drawPolygon.hasArc()){let h=c/180*Math.PI,u=new S(i.x+n,i.y);at.id!=="adsorption"&&(at.auxiliaryLine1?at.auxiliaryLine1.update(i,u,n,h):at.auxiliaryLine1=new CD(i,u,n,h));let d=9;if(d>=at.priority){at.priority=d;let p={data:[{startPoint:i,cursorPoint:e,frameStartPoint:a,frameCursorPoint:s,info:{type:"free",value:je(n),unit:R.getInstance().unit}},{startPoint:i,cursorPoint:e,frameStartPoint:a,frameCursorPoint:s,info:{type:"circle",value:c,tagName:"angle"}}],type:"rect",show:!0,frameInfo:r};at.create(p)}}else if(this.drawPolygon instanceof ja&&this.drawPolygon.hasArc()){let h=this.drawPolygon.getArcAngle(),u=this.event.start,d=this.drawPolygon.getArcEnd(),p=this.drawPolygon.getArcCenter(),m=this.drawPolygon.getArcRadius(),g=this.drawPolygon.getArcStartAngle(),y=this.drawPolygon.getArcEndAngle(),b=this.drawPolygon.getArcSweep();at.id!=="adsorption"&&(at.auxiliaryLine2?at.auxiliaryLine2.update(u,d,p,m/10,g,y,b):at.auxiliaryLine2=new SD(u,d,p,m,g,y,b)),at.id!=="Free Arc"&&at.destroy();let P=9;if(P>=at.priority){at.priority=P;let T={data:[{startPoint:u,center:p,frameStartPoint:a,frameCursorPoint:_o(p),info:{type:"circle",value:h,tagName:"angle",canNotLock:!0}}],type:"rect",show:!0,frameInfo:r};at.create(T,"Free Arc")}}}else this.started&&at.id!=="adsorption"&&at.destroy()}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,keyCode:l,startPoint:c}=e;if(a){at.editingWhat=i;return}let h=!1;if((at.editingWhat||typeof at.lineLockedLength=="number"||typeof at.lineLockedAngle=="number")&&(h=!0),at.editingWhat="",n||s){this.drawPolygon.arc||this.lockUnlock(e);return}let u=this.applyValue(e);l===13&&(u?h?(this.drawPolygon.asMouseLeftUp(u),at.destroy()):(this.drawPolygon.addShape(u),this.completed()):at.destroy())}lockUnlock(e){let{value:r,type:i,locked:n,unlocked:s}=e,a=new dt;i==="free"?n?(this.applyValue(e),r=a.conversion(R.getInstance().unit,"mil",r/10),at.lineLockedLength=r):s&&(at.lineLockedLength=null):i==="circle"&&(n?(at.lineLockedAngle=r,this.applyValue(e)):s&&(at.lineLockedAngle=null))}applyValue(e){let{value:r,type:i,startPoint:n,cursorPoint:s}=e,a=new dt,l,c;if(i==="free")if(r=a.conversion(R.getInstance().unit,"mil",r/10),at.id==="adsorption"){let h=new S(s.x-n.x,s.y-n.y).normalize();h=new S(h.x*r,h.y*r);let u=new S(h.x+n.x,h.y+n.y);if(this.started)c=u;else{this.event.start=u,this.started=!0;return}}else{let h=new S(this.event.curr.x-this.event.last.x,this.event.curr.y-this.event.last.y).normalize();l=new S(h.x*r,h.y*r),c=new S(l.x+this.event.last.x,l.y+this.event.last.y)}else if(i==="circle"){let h=this.drawPolygon.arc;if(h){let u=h.getStart(),d=h.getEnd(),p=new S((u.x+d.x)/2,(u.y+d.y)/2),m=new S(d.x-u.x,d.y-u.y),g=m.length(),y=g/2/Math.sin(r/2/180*Math.PI),b=g/2/Math.tan(r/2/180*Math.PI),P=m.normalize(),T=new S(-P.y,P.x),I=new S(T.x*b+p.x,T.y*b+p.y);c=new S(-T.x*y+I.x,-T.y*y+I.y)}else{let u=at.startPoint;s=this.event.curr||s;let d=new S(s.x-u.x,s.y-u.y),p=(d.angleD(S.ORIGIN)+360)%360,m=d.rotateD(S.ORIGIN,r-p);c=new S(m.x+u.x,m.y+u.y)}}return this.showFloatingInputBox(c),this.event.curr=c,this.drawPolygon.draw(this.event.last,this.event.curr,Zt.getInstance().type),this.drawPolygon.asClose(c),A.publish("updateFrame",""),c}onMouseMove(e){this.dealLocked(e),this.drawing&&this.drawPolygon.onMouseMove(e);let r=new S(e.sceneX,e.sceneY);this.showFloatingInputBox(r)}onMouseRightUp(e){if(e.openMenu)switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.cancel();break}}}interrupt(){this.drawPolygon.interrupt(),Ur.clearDrawTool(),at.destroy(),this.started=!1,this.end()}cancel(){this.drawPolygon.cancel(),at.destroy(),this.started=!1}flipPath(){this.drawPolygon.flipPath()}toggleLayer(e){this.drawPolygon.toggleLayer(e)}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new eh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new Gh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new ja(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Tl(this.event,Ur,this.resultEvent);break}this.event.last!=null&&this.event.curr!=null&&(this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr)),Zt.getInstance().type=e,we.synchronize()}wireMode(e){}completed(){this.drawPolygon.completed(!1),at.destroy(),this.started=!1,this.end()}backspace(){this.drawPolygon.backspace(),at.destroy(),this.started=!1}rightClickMenuData(e){let r=this.event.start!=null,i={state:"show",left:e.mouseX,top:e.mouseY,filter:vg(Zt.getInstance().type,e.adsorb,r).result};$t.getInstance().menuData(i,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.drawPolygon.abortLast=!1,this.completed();break;case"CANCEL":this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.cancel();break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":this.wireCorner(i[1]),wi();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}};function lOe(o,t=!1,e=NaN,r=!1){let i=new qt;return o&&(isNaN(e)?i.add("MOVE_NODE"):(i.add("EDIT_NODE"),i.add("MOVE_NODE"),t||i.add("DELETE_NODE")),i.add("INSERT_NODE")),r&&i.add("CANCEL"),i.addSeparate(),i.add("EXIT_EDIT_PAD_SHAPE_MOE"),i.add("toggleAdsorb"),i.add("ADSORBENT_CONFIG"),i}var b5=class o{constructor(t,e,r){this.primitives=t,this.drillPosition=e,this.padDrillSnapshots=r}static fromPolygon(t,e,r){let i=[];t.getAllChildrens().forEach(s=>{s instanceof mt?i.push({type:"line",start:s.start.clone(),end:s.end.clone(),layerId:s.layerId}):s instanceof _t&&i.push({type:"arc",center:s.center.clone(),radius:s.radius,startAngle:s.startAngle,endAngle:s.endAngle,sweep:s.sweep,arcType:s.arcType,layerId:s.layerId})});let n;return r&&r.length>0&&(n=r.map(s=>{if(s instanceof mt)return{type:"line",start:s.start.clone(),end:s.end.clone(),layerId:s.layerId};if(s instanceof _t)return{type:"arc",center:s.center.clone(),radius:s.radius,startAngle:s.startAngle,endAngle:s.endAngle,sweep:s.sweep,arcType:s.arcType,layerId:s.layerId};throw new Error("Unsupported drill primitive type")})),new o(i,e,n)}restore(t,e,r){this.clearPolygon(t);let i=this.primitives.map(n=>{let s=nr(),a={layerId:t.layerId,strokeWidth:0,locked:!1};if(n.type==="line"){let l=new wc(s,n.start.clone(),n.end.clone(),a),c=new mt(l);return c.setParent(t),c}else if(n.type==="arc"){let l=new zc(s,n.center.clone(),n.radius,n.startAngle,n.endAngle,n.sweep,a,n.arcType),c=new _t(l);return c.setParent(t),c}throw new Error(`Unsupported primitive type: ${n.type}`)});t.setChildrens(i),e&&this.drillPosition&&e.setPosition(this.drillPosition),this.padDrillSnapshots&&r&&(r.forEach(n=>n.remove()),r.length=0,this.padDrillSnapshots.forEach(n=>{let s=nr(),a={layerId:n.layerId,strokeWidth:0,locked:!1};if(n.type==="line"){let l=new wc(s,n.start.clone(),n.end.clone(),a),c=new mt(l);r.push(c)}else if(n.type==="arc"){let l=new zc(s,n.center.clone(),n.radius,n.startAngle,n.endAngle,n.sweep,a,n.arcType),c=new _t(l);r.push(c)}}))}serialize(){return JSON.stringify({primitives:this.primitives,drillPosition:this.drillPosition?{x:this.drillPosition.x,y:this.drillPosition.y}:void 0,padDrillSnapshots:this.padDrillSnapshots})}static deserialize(t){var e,r;try{let i=JSON.parse(t);return new o(i.primitives||[],new S(((e=i.drillPosition)==null?void 0:e.x)||0,((r=i.drillPosition)==null?void 0:r.y)||0),i.padDrillSnapshots)}catch(i){return console.error("Failed to deserialize PolygonMemento:",i),null}}clone(){return o.deserialize(this.serialize())}clearPolygon(t){let e=t.getChildrens();e.forEach(r=>{r.forEach(i=>i.remove())}),e.forEach(r=>{r.length=0})}};var tde=class{constructor(){this.undoStack=[];this.redoStack=[];this.initialSnapshot=null;this.activePolygon=null;this.activeDrillPoint=null;this.activeDrillModels=null;this._switchPadNodeTool=!1;this.editing=!1}get switchPadNodeTool(){return this._switchPadNodeTool}set switchPadNodeTool(t){this._switchPadNodeTool=t}getInitialMemento(){return this.initialSnapshot}beginSession(t,e,r){this.activePolygon=t,this.activeDrillPoint=e,this.activeDrillModels=r,this.editing=!0,this.initialSnapshot=b5.fromPolygon(t,e==null?void 0:e.position,r)}commit(){if(!this.editing||!this.activePolygon||!this.initialSnapshot)return;let t=this.getCurrentSnapshot();this.hasSnapshotChanged(this.initialSnapshot,t)&&this.undoStack.push(this.initialSnapshot),this.initialSnapshot=null,this.editing=!1,this.updateViewState()}cancel(){!this.editing||!this.initialSnapshot||!this.activePolygon||(this.initialSnapshot.restore(this.activePolygon,this.activeDrillPoint,this.activeDrillModels),this.initialSnapshot=null,this.editing=!1,this.updateViewState())}undo(){if(!this.activePolygon||this.undoStack.length===0)return!1;let t=this.getCurrentSnapshot();this.redoStack.push(t);let e=this.undoStack.pop();return e&&e.restore(this.activePolygon,this.activeDrillPoint,this.activeDrillModels),this.updateViewState(),!0}redo(){if(!this.activePolygon||this.redoStack.length===0)return!1;let t=this.getCurrentSnapshot();this.undoStack.push(t);let e=this.redoStack.pop();return e&&e.restore(this.activePolygon,this.activeDrillPoint,this.activeDrillModels),this.updateViewState(),!0}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}clear(){this.undoStack.length=0,this.redoStack.length=0,this.initialSnapshot=null,this.editing=!1,this.activePolygon=null,this.activeDrillModels=null,this.activeDrillPoint=null,this.activeTool=null,this.switchPadNodeTool=!1}hasSnapshotChanged(t,e){return t?t.serialize()!==e.serialize():!0}getCurrentSnapshot(){var t;return b5.fromPolygon(this.activePolygon,(t=this.activeDrillPoint)==null?void 0:t.position,this.activeDrillModels)}updateTop(){we.undo=this.canUndo(),we.redo=this.canRedo()}updateViewState(){this.updateTop(),this.activeTool&&this.activeTool.updatePolygon()}setActiceTool(t){this.activeTool=t}};var P5=class P5{constructor(){this.activeToolHistory=null;this.activeToolId=null}static getInstance(){return P5.instance||(P5.instance=new P5),P5.instance}canUndo(){return this.activeToolHistory?this.activeToolHistory.canUndo():!1}canRedo(){return this.activeToolHistory?this.activeToolHistory.canRedo():!1}registerToolHistory(t,e){return this.activeToolHistory!==null?(console.warn(`ToolHistoryState: \u5DF2\u5B58\u5728\u6CE8\u518C\u7684\u5DE5\u5177 [${this.activeToolId}]\uFF0C\u65E0\u6CD5\u6CE8\u518C [${t}]`),!1):(this.activeToolHistory=e,this.activeToolId=t,!0)}unregisterToolHistory(t){(!t||this.activeToolId===t)&&(this.activeToolHistory=null,this.activeToolId=null)}undo(){return this.activeToolHistory?this.activeToolHistory.undo():!1}redo(){return this.activeToolHistory?this.activeToolHistory.redo():!1}clear(){this.activeToolHistory&&this.activeToolHistory.clear()}hasActiveToolHistory(){return this.activeToolHistory!==null}getActiveToolId(){return this.activeToolId}};P5.instance=null;var L1=P5;var T5=class extends ni{constructor(e){super();this.mouseLeftX=0;this.mouseLeftY=0;this.mouseLeftDown=!1;this.drillPointIsSelect=!1;this.padDrillModels=new Array;this.isDragging=!1;this.position=null;this.controlPointTool=null;this.polygon=null;this.pcbPolygon=null;this.toolId="EditPPadTool";this.option="OPTIONLEFTUP",e?this.editHistory=e:(this.editHistory=new tde,L1.getInstance().registerToolHistory(this.toolId,this.editHistory)),this.editHistory.setActiceTool(this)}get points(){return this.controlPointTool.points[0]}get mids(){return this.controlPointTool.mids[0]}get pathModels(){return this.pcbPolygon.getAllChildrens()}get selectIndex(){return this.controlPointTool.selectIndex[1]}set selectIndex(e){isNaN(e)?this.controlPointTool.selectIndex=[NaN,NaN]:this.controlPointTool.selectIndex=[0,e]}async showEditPadTag(){he.windowBridge.publish("editPadShape","",Q())}async exitEditPadTag(){he.windowBridge.publish("interuptEditPadMode","",Q())}setPad(e){this.start(),this.polygon=e,this.polygon.removeFill(),this.polygon.hidden();let r=this.polygon.layerId;if(ar(r)){let n=this.polygon.getMathGraphics(),s=new Po;n.primitives.forEach(l=>{let c=s.ptToShape(l,r,0);this.padDrillModels.push(c)}),this.padDrillModels.forEach(l=>l.visible());let a=n.bbox().center();this.padDrillPoint=new Ui(r,a)}let i=this.polygon.createPreviewChildrens();this.pcbPolygon=pt.addPolygon("Line",r,[i],.02,"",!1),this.controlPointTool=new uG(this.pcbPolygon),this.startHide(),this.showEditPadTag(),this.beginSession(),this.editHistory.cancel()}startHide(){WS.getInstance().addHightItem(this.pcbPolygon)}resotreHight(){WS.getInstance().unhighLigthAll()}manualHighLight(){this.pcbPolygon.manualHighLight=!0}onKeyDown(e){switch(tr.getAction(3,e)){case"Cancel":case"Finish":this.completed();break;case"Undo":L1.getInstance().undo();break;case"Redo":L1.getInstance().redo()}}updatePolygon(){this.controlPointTool.updatePoints(),this.updateDrillPoint(),this.manualHighLight(),he.publish("updateFrame","")}updateDrillPoint(){}getPolyLines(e){return e.map(i=>{if(i instanceof M)return Cu.add(this.polygon.layerId,i.start(),i.end(),.02,!1);if(i instanceof q){let n=i.startAngle/180*Math.PI,s=i.endAngle()/180*Math.PI;return Yc.addArc(this.polygon.layerId,i.center,i.rx,.02,n,s,i.sweep(),!1)}})}onMouseLeftDown(e){e.sceneX=e.realSceneX,e.sceneY=e.realSceneY,he.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},Q());let r=e.sceneX,i=e.sceneY;this.drillPointIsSelect=this.padDrillPoint&&this.padDrillPoint.isSelect(r,i),this.mouseLeftX=r,this.mouseLeftY=i,(this.controlPointTool.onMouseLeftDown(e)||this.drillPointIsSelect)&&(this.mouseLeftDown=!0,this.manualHighLight(),this.beginSession())}beginSession(){this.editHistory.beginSession(this.pcbPolygon,this.padDrillPoint,this.padDrillModels)}onMouseMove(e){this.mouseLeftDown?this.drillPointIsSelect?this.selectDrillMoving(e):this.selectPadMoving(e):this.controlPointTool.onMouseUpMove(e)}selectPadMoving(e){this.controlPointTool.onMouseMove(e)}selectDrillMoving(e){if(this.padDrillPoint.status()){let r=this.padDrillPoint.position;this.mouseLeftX=e.sceneX,this.mouseLeftY=e.sceneY;let i=new S(e.sceneX,e.sceneY);this.padDrillPoint.setPosition(i);let n=i.sub(r);this.padDrillModels.forEach(s=>{let a=Ae.translate(n.x,n.y,0);s.transform(a)})}}checkDrillInInner(e){if(ar(this.polygon.layerId)){let r=ge.build2(e),i=ge.build2(this.getPrimitive(this.padDrillModels));return Gy.build2(r,i).inInner()}else return!0}getPrimitive(e){let r=new Array;for(let i of e)if(i instanceof mt)r.push(new M(i.start,i.end));else{let n=i.startAngle/Math.PI*180,s=i.startAngle===i.endAngle?360:i.endAngle/Math.PI*180,a=q.build2(i.center,n,s,i.radius,i.radius,i.sweep);r.push(a)}return r}onMouseLeftUp(e){var a;this.drillPointIsSelect=!1;let r=this.polygon,i=r.layerId;this.mouseLeftDown=!1;let n=new De("zero line");if(this.controlPointTool.removeZeroLenLine(n)){iD(this.pcbPolygon);let l=this.pcbPolygon.getMathGraphics().primitives,c=!1;if(this.editHistory.getInitialMemento()){let h=b5.fromPolygon(this.pcbPolygon,(a=this.padDrillPoint)==null?void 0:a.position,this.padDrillModels);c=this.editHistory.getInitialMemento().serialize()!==h.serialize()}if(c){if(this.editHistory.commit(),ar(i)){let h=Ae.translate(-r.center.x,-r.center.y,0).rotateZ(-r.rotation);this.polygon.holeOffset=this.padDrillPoint.getPosition().multiply4(h)}this.polygon.setChildrens(ge.build2(l))}else this.editHistory.cancel()}else this.editHistory.cancel();this.controlPointTool.onMouseLeftUp(e),this.manualHighLight()}async completed(){this.addUndoHistory();let e=ge.build2(this.pcbPolygon.primitives),r=Eo(e),i=new De("edit polygon pad");if(r){this.polygon.setChildrens(e);let n=new Wf(this.pcbPolygon.primitives);if(this.polygon.center=n.center,ar(this.polygon.layerId)){let l=Ae.translate(-this.polygon.center.x,-this.polygon.center.y,0).rotateZ(-this.polygon.rotation);this.polygon.holeOffset=this.padDrillPoint.getPosition().multiply4(l)}let s=this.polygon.getParent(),a=Rhe(this.polygon,i);if(s!=null&&s instanceof ke){let l=new ff;await l.updateCustomFootprint(s,i,a),l.deletePad(this.polygon,s,i)}}else{let n=this.polygon;this.pathModels.forEach(a=>a.remove()),n.fill(),n.visible();let s=n.getParent();s!=null&&s instanceof ke&&(i.addCommand(Ce.dispatch(s,"modify")),he.publish("hasModifyPcbItem",s),await new ff().updateCustomFootprint(s,i,[n]))}this.clear(),this.editHistory.clear(),L1.getInstance().unregisterToolHistory(this.toolId),qe.executeCommand(i),he.publish("tool","dropdrag"),he.publish("flushSelectingInfo",""),this.end()}addUndoHistory(){let e=[],r=0;for(;this.editHistory.canUndo();)r++,this.editHistory.undo();for(let i=0;i<r;i++){let n=new De("edit pad shape");this.updatePadShape(),n.addCommand(Ce.dispatch(this.polygon,"modify")),qe.executeCommand(n),this.editHistory.redo()}e.forEach(i=>qe.executeCommand(i))}updatePadShape(){let e=this.polygon,r=this.pcbPolygon.getMathGraphics().primitives;if(e.setChildrens(ge.build2(r)),iD(e),ar(this.polygon.layerId)){let i=this.padDrillPoint.getPosition(),n=e.center;e.holeOffset=i.sub(n)}}onDoubleClick(e){e.sceneX=e.realSceneX,e.sceneY=e.realSceneY,he.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},Q());let r=e.sceneX,i=e.sceneY;for(let n=0,s=this.points.length;n<s;n++)if(this.points[n].isSelect(r,i)){this.editNode(n);return}}editNode(e){this.isDragging=!0;let r=[],i=new Po;this.padDrillModels.forEach(h=>{let u=i.clone4(h.model);r.push(u)});let{shapes:n,last:s,start:a,curr:l}=this.controlPointTool.editNode([0,e]),c={shapes:n.map(h=>h.primitive),last:s,start:a,curr:l,profile:this.polygon,padDrillModels:r};this.toggleRedrawPadTool(c)}onMouseRightUp(e){if(e.sceneX=e.realSceneX,e.sceneY=e.realSceneY,this.position=e,e.openMenu){for(let r=0,i=this.points.length;r<i;r++)if(this.points[r].isSelect(e.sceneX,e.sceneY)){this.selectIndex=r,this.rightClickMenuData(e);return}}if(this.selectIndex=NaN,e.openMenu)switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.isDragging?this.onMouseLeftUp(e):this.completed():this.rightClickMenuData1(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData1(e):this.isDragging?this.onMouseLeftUp(e):this.rightClickMenuData1(e);break}}}rightClickMenuData1(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:lOe(!1,!1,NaN,this.controlPointTool.nodeInsert).result};this.position=e,$t.getInstance().menuData(r,this)}rightClickMenuData(e){let i={state:"show",left:e.mouseX,top:e.mouseY,filter:lOe(!0,!1,this.selectIndex,this.controlPointTool.nodeInsert).result};this.position=e,$t.getInstance().menuData(i,this)}parse(e){switch(e.cmdKey.split(":")[0]){case"EDIT_NODE":isNaN(this.selectIndex)||(this.editNode(this.selectIndex),this.selectIndex=NaN);break;case"DELETE_NODE":isNaN(this.selectIndex)||(this.deletePoint(),this.selectIndex=NaN);break;case"MOVE_NODE":this.mouseLeftDown=!0;break;case"INSERT_NODE":this.insertNode();break;case"CANCEL":this.controlPointTool.cancel();break;case"COMPLETE":this.completed();break;case"EXIT_EDIT_PAD_SHAPE_MOE":this.exitEditPadTag(),this.completed();break;case"toggleAdsorb":he.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":he.publish("openSystemDialog","ADSORPTION",Q());break}he.publish("updateFrame","")}insertNode(){this.controlPointTool.insertNode(this.polygon,this.toggleRedrawPadTool.bind(this))}toggleRedrawPadTool(e){this.editHistory.switchPadNodeTool=!0;let{shapes:r,last:i,start:n,curr:s,profile:a,padDrillModels:l}=e;he.publish("redrawPolygonPad",{shapes:r,last:i,start:n,curr:s,profile:a,padDrillModels:l,history:this.editHistory})}deletePoint(){this.beginSession(),this.controlPointTool.deletePoint(),this.editHistory.commit(),this.controlPointTool.updatePoints(),this.manualHighLight(),this.selectIndex=NaN}interrupt(){this.clear(),this.interruptTool(),this.polygon.isEmpty||(this.polygon.fill(),this.polygon.visible()),this.editHistory.switchPadNodeTool||(this.editHistory.clear(),L1.getInstance().unregisterToolHistory(this.toolId)),this.polygon=null,this.resotreHight(),this.exitEditPadTag(),this.editHistory.switchPadNodeTool=!1,this.editHistory.setActiceTool(null)}interruptTool(){this.controlPointTool.interrupt(),this.pathModels.forEach(e=>e.remove()),this.pathModels.length=0,this.pcbPolygon.remove(),pt.delete(this.pcbPolygon),this.pcbPolygon=null}clear(){this.padDrillPoint&&(this.padDrillPoint.remove(),this.padDrillPoint=null),this.padDrillModels.forEach(e=>e.remove()),this.padDrillModels.length=0}};var rde=class extends ni{constructor(){super();this.commands=new De("draw suture via");this.net="";this._start=null;this.selections=[];this.hasEffectiveDrawn=!1;this.drawMode=null;this.option="OPTIONLEFTUP";let e=re.getInstance().getDefaultRadiusPhysics();this.radius=e.defalutRadius,this.innerRadius=e.defalutInner,this.lineSpacing=ut.defaultSutureVia.lineSpacing,this.columnSpacing=ut.defaultSutureVia.columnSpacing,A.publish("openMainDialog",{cmd:19,data:{tool:this}})}getDialogData(){let e=R.getInstance().unit,r=new dt;return{action:"attribute-for-place-sut-via",attrNet:this.net||"",netList:Ye.getNet(),attrViaGeneralOuterdiameter:r.conversion("mil",e,this.radius*20),attrViaGeneralInnerdiameter:r.conversion("mil",e,this.innerRadius*20),attrRowSpacing:r.conversion("mil",e,this.lineSpacing*10),attrColSpacing:r.conversion("mil",e,this.columnSpacing*10),unit:e}}modifyByDialog(e){let r=e.action;if(r=="confirm"){this.drawMode=0;let i=new dt,n=e["attr-net"],s=parseFloat(e["attr-col-spacing"])/10,a=parseFloat(e["attr-row-spacing"])/10,l=parseFloat(e["attr-via-general-innerdiameter"])/20,c=parseFloat(e["attr-via-general-outerdiameter"])/20;this.net=n||"",this.columnSpacing=i.conversion(R.getInstance().unit,"mil",s),this.lineSpacing=i.conversion(R.getInstance().unit,"mil",a),this.radius=i.conversion(R.getInstance().unit,"mil",c),this.innerRadius=i.conversion(R.getInstance().unit,"mil",l),ut.setDefaultSutureVia(this.lineSpacing,this.columnSpacing)}else r=="cancel"&&this.cancel()}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);break}A.publish("updateFrame","")}async onMouseLeftUp(e){if(!this.drawing){this.drawing=!0,A.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},Q());return}if(this.drawMode===1){this.netSelect(e.sceneX,e.sceneY);return}let r=e.sceneX,i=e.sceneY,n=new S(r,i);if(this.selections.length==0){this.start(),Ut.cancel(),this._start=n;let s=new cr(1002,new S(this._start.x,this._start.y),new S(r,this._start.y),!1,ee.WHITE),a=new cr(1002,new S(r,this._start.y),new S(r,i),!1,ee.WHITE),l=new cr(1002,new S(r,i),new S(this._start.x,i),!1,ee.WHITE),c=new cr(1002,new S(this._start.x,i),new S(this._start.x,this._start.y),!1,ee.WHITE);this.selections.push(s),this.selections.push(a),this.selections.push(l),this.selections.push(c),this.drawing=!0}else{this.clearSelectBox();let s=new _e().ext2(this._start).ext2(n).build1(),a=await this.placeSutureVias(s),l=[];for(let c of a){A.publish("hasModifyPcbItem",c);let h=Ce.dispatch(c,"add");this.commands.addCommand(h),l.push(c)}A.publish("onlySelect",l),qe.executeCommand(this.commands),this.commands=new De("draw suture via"),A.publish("flushService",""),this.end()}}onMouseMove(e){if(this.drawMode===0){let r=e.sceneX,i=e.sceneY;this.selections.length>0&&this.drawing?(this.selections[0].start=new S(this._start.x,this._start.y),this.selections[0].end=new S(r,this._start.y),this.selections[1].start=new S(r,this._start.y),this.selections[1].end=new S(r,i),this.selections[2].start=new S(r,i),this.selections[2].end=new S(this._start.x,i),this.selections[3].start=new S(this._start.x,i),this.selections[3].end=new S(this._start.x,this._start.y)):Ut.update(e,"Please select an area")}else this.drawMode==1?Ut.update(e,"Please select a network"):Ut.cancel()}getLayerId(){let e=Pe.getActiveLayer();return e.isCopperLayer()?e.layerID:1}interrupt(){this.drawMode=0,this.clearSelectBox(),Ut.cancel(),this.end()}cancel(){this.drawMode===null||this.drawMode==0?(this.interrupt(),this.hasEffectiveDrawn&&A.publish("rebuildCopperRegionDialog",{msg:""}),A.publish("tool","dropdrag")):(this.drawMode=0,this.confirmWindow())}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"INHERIT_NET":this.update(i[1]);break}A.publish("updateFrame","")}confirmWindow(){A.publish("openMainDialog",{cmd:19,data:{tool:this}})}modify(e){}clearSelectBox(){for(let e of this.selections)e.remove();this.selections.length=0}placeVia(e){(Ye.getItem(this.net)==null||Ye.getItem(this.net).size==0)&&(this.net="");let r=re.getInstance().getSolderExpansionByNet(this.net),i=new hg(nr(),2,"",1,2,[],this.net,this.radius,e,this.innerRadius,1,r.viaTopExpansion,r.viaBottomExpansion,!1);return bn.getInstance().addModel(i),i}async placeSutureVias(e){let r=new Array,i=new Array,n=e.width(),s=e.height(),a=this.radius*2;if(n>=a&&s>=a){let l=e.UL(),c=Math.floor((n-a)/this.columnSpacing)+1,h=Math.floor((s-a)/this.lineSpacing)+1,u=new Array,d=new Array,p=l.y-this.radius,m=l.x+this.radius;for(let P=0;P<h;P++){let T=p-this.lineSpacing*P;u.push(T)}for(let P=0;P<c;P++){let T=m+this.columnSpacing*P;d.push(T)}for(let P of u)for(let T of d){let I=new S(T,P),C=this.placeVia(I);r.push(C)}if(!r.length)return i;let g=this.getLayerId(),{message:y}=await A.messageBus.rpcCall("sutureViaDrc",{vias:r,checkSameNet:!0,profile:lh(ge.build6(e)),layerId:g,mode:1,maxProgress:.9}),{filterIds:b}=y;r.forEach(P=>{let T=Bo.existClearanceError(P.globalIndex,g);if(!T.existClearanceError&&!b.includes(P.globalIndex)){T.exsitError&&(this.hasEffectiveDrawn=!0);let I=Wr.addViaByModel(P);i.push(I)}else P.remove(),bn.getInstance().delete(P,P.globalIndex),Bo.deleteClearanceError(P.globalIndex),Bo.deleteBlindError(P.globalIndex),Bo.deleteRadiusError(P.globalIndex)}),A.publish("progressUpdate",[1,"Design rule check"],Q()),i.length==0&&!y.hasSameNetCoppers&&A.publish("ui/toastMsg",{type:"warn",msg:"The selection area must contain the same network copper filled before adding suture holes"},Q())}return i}toggleMode(e){this.drawMode=e,this.drawing=!0}netSelect(e,r){let i=Vr.selectNet(e,r),n=new Set;for(let s of i)s.isSelect(e,r)&&s.net&&n.add(s.net);n.size>1?this.showNetsMenu(Array.from(n)):this.update(Array.from(n)[0])}update(e){this.net=e,this.drawMode=0,this.confirmWindow()}getNetsMenuData(e){let r=new qt,i="INHERIT_NET:";return e.forEach(n=>{if(n){let s={name:n,cmd:`${i+n}`,tips:"",option:{disabledI18n:!0}};r.addObj(s,!1,!1)}}),r}showNetsMenu(e){let r={},i=fi.getInstance();r.state="show",r.left=i.mouseX,r.top=i.mouseY,r.filter=this.getNetsMenuData(e).result,$t.getInstance().menuData(r,this),this.drawing=!1}};var ide=class extends ni{constructor(e){super();this.template=new Array;this.image=null;this.option="OPTIONLEFTUP";let r=new dt;e.unit!=="mil"?(this.width=r.conversion(e.unit,"mil",+e.width)/10,this.height=r.conversion(e.unit,"mil",+e.height)/10):(this.width=+e.width/10,this.height=+e.height/10),this.template=K3(e.path);let i=new _e;this.template.forEach(n=>{i.ext1(n.bbox())}),this.box=i.build1(),this.drawing=!0,xo.setTool(this),this.start()}onKeyDown(e){switch(tr.getAction(5,e)){case"Cancel":this.cancel();break;case"Rotate Left":this.image!=null&&(this.image.rotateFor(this.image.start,le.pcbConfig.rotate),ut.defaultImage.rotation+=le.pcbConfig.rotate);break;case"rotate_right":this.image!=null&&(this.image.rotateFor(this.image.start,-le.pcbConfig.rotate),ut.defaultImage.rotation-=le.pcbConfig.rotate);break;case"Flip Right and Left":A.publish("turn","turnAround");break;case"Flip Up and Down":A.publish("turn","turnUpsideDown");break}A.publish("updateFrame","")}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY);if(this.image!=null){if(this.image.start=r,!Mt.checkIsInCanEdit(this.image)){let n="beyond drawing range";Mt.showMassageTip(n,n);return}this.image.partition=R.getInstance().partitionId,A.publish("onlySelect",[this.image]);let i=new De("insert image");i.addCommand(Ce.dispatch(this.image,"add")),qe.executeCommand(i),A.publish("hasModifyPcbItem",this.image),this.image=null,this.drawing=!0}A.publish("flushService","")}onMouseMove(e){if(this.drawing){let r=new S(e.sceneX,e.sceneY);this.image!=null?(this.image.layerId!=this.getLayer()&&(this.image.layerId=this.getLayer()),this.image.start=r):this.image=Bn.addImage(this.getLayer(),r,this.width,this.height,ut.defaultImage.rotation,!1,!1,this.template)}}interrupt(){this.image!==null&&(this.image.remove(),A.publish("delete",this.image),this.image=null,A.publish("flushService","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}getLayer(){let e=Pe.getActiveLayer();return e.isPlaneLayer()||12==e.layerID||11==e.layerID||7==e.layerID||8==e.layerID||47==e.layerID||ra(e.layerID)||52===e.layerID||W9(e.layerID)?3:e.layerID}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"FLIP":i[1]=="FLIP_LEFTANDRIGHT"?this.turn("turnAround"):i[1]=="FLIP_UPANDDOWN"&&this.turn("turnUpsideDown");break}A.publish("updateFrame","")}turn(e){if(!(!R.getInstance().isactive||23==R.getInstance().doctype))switch(e){case"turnAround":xo.turn([this.image],!1,!1);break;case"turnUpsideDown":xo.turn([this.image],!0,!1);break}}};var nde=class extends ni{constructor(t,e,r,i,n){super(),this.start(),this.option="OPTIONLEFTUP",this.oldToolDrawing=e,this.drawing=!0,this.tool=t,this.lastTool=r,this.referPointProgram=i,this.msg=n}onKeyDown(t){switch(tr.getAction(4,t)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(t);return}A.publish("updateFrame","")}onMouseMove(t){Ut.update(t,this.msg)}onMouseLeftUp(t){if(this.drawing){if(!this.referPointProgram.setReferPointSuccess(t.sceneX,t.sceneY))return;this.tool.setNextTool(this.lastTool),di.resetLastScene(),this.tool.drawing=this.oldToolDrawing,this.referPointProgram.setReferPoint(t.sceneX,t.sceneY),Ut.cancel(),this.end(),A.publish("flushService","")}}interrupt(){this.drawing=!1,this.tool.setNextTool(this.lastTool),di.resetLastScene(),this.tool.drawing=this.oldToolDrawing,Ut.cancel(),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:po(t.adsorb)};$t.getInstance().menuData(e,this),this.drawing=!1}parse(t){switch(this.drawing=!0,t.cmdKey.split(":")[0]){case"CANCEL":this.cancel(),(this.msg=="Please select a starting point"||this.msg=="Please select a center point")&&A.publish("showArrayDistributionDlg",null,Q());break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}};var ode=class extends ni{constructor(e,r,i,n,s,a=new Array,l,c){super();this.widthFollowRule=!1;this.event=new du;this.isDetermineLine=!1;this.start(),this.event._width=s.strokeWidth,s instanceof Pr?this.resultEvent=new fG(s):s instanceof lt?this.resultEvent=new F2(s,l):s instanceof rr&&(this.resultEvent=new pG(s)),this.event.commands=c||new De("redraw polygon 2D LINE"+s.type),this.event.commands.addCommand(Ce.dispatch(s,"modify")),Ce.dispatchCoppers(s,"delete",this.event.commands),s.clearCopper();for(let h of e){let u=this.getShape(h,s.color);this.event.shape.push(u),this.event.drawHistoryRecord()}for(let h of a){let u=this.getShape(h,s.color);this.resultEvent.nextShape.push(u)}switch(Pe.setActiveLayerId(s.layerId),this.drawing=!0,this.event.start=i,this.event.last=r,s.type!="Line"?this.event.needClose=!0:r.equals(i)||(this.event.needClose=!0),s.hidden(),s.removeFill(),Zt.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new eh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new Gh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new ja(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Tl(this.event,Ur,this.resultEvent);break}this.drawPolygon.draw(this.event.last,n,Zt.getInstance().type),this.drawPolygon.asClose(n),s instanceof Pr?e.forEach(h=>{h.remove()}):s instanceof rr&&e.forEach(h=>{h.remove()}),Ur.addDrawTool(this),we.synchronize()}getWidth(){return this.event._width}getShape(e,r=ee.BLACK){let i=e.layerId;return e instanceof _t?es.build(i,e.center,e.radius,e.width,e.startAngle,e.endAngle,e.sweep,r):Vi.build(i,e.start,e.end,e.width,r)}onKeyDown(e){switch(tr.getAction(4,e)){case"changeRoutingAngle":case"Routing Corner":this.wireCorner(Ur.getNextType()),wi();break;case"Cancel":this.completed(!0);break;case"Change Track Width While Routing":{A.publish("openMainDialog",{cmd:26,data:{tool:this}});break}case"Finish":this.onMouseLeftUp(e);break}this.drawPolygon.onKeyDown(e)}onMouseLeftUp(e){this.drawPolygon.onMouseLeftUp(e),this.isDetermineLine=!0}onMouseMove(e){this.drawing&&this.drawPolygon.onMouseMove(e,!0)}onMouseRightUp(e){if(e.openMenu)switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.completed(!0):this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.completed(!0);break}}}interrupt(){Ur.clearDrawTool(),this.drawPolygon.interrupt(),this.resultEvent.nextShape.forEach(e=>{e.remove()}),this.resultEvent.nextShape.length=0,this.resultEvent.profile!=null&&(this.resultEvent.profile.visible(),this.resultEvent.profile.fill(),this.event.commands.undo()),this.end()}cancel(){this.drawPolygon.cancel()}flipPath(){this.drawPolygon.flipPath()}toggleLayer(e){this.drawPolygon.toggleLayer(e)}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new eh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new Gh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new ja(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Tl(this.event,Ur,this.resultEvent);break}this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr),Zt.getInstance().type=e,we.synchronize(),wi()}setWireWidth(e){this.drawPolygon.wireWidth(e),this.resultEvent.nextShape.forEach(r=>{r.width=e}),wi()}completed(e=!1){if(e&&!this.isDetermineLine){this.interrupt(),A.publish("tool","dropdrag");return}this.resultEvent.profile&&(this.resultEvent.profile.visible(),this.resultEvent.profile.fill()),this.drawPolygon.abortLast=e,this.drawPolygon.completed(!1)}backspace(){this.drawPolygon.backspace()}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vg(Zt.getInstance().type,e.adsorb,!0,!0).result};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed();break;case"CANCEL":this.completed(!0);break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":this.wireCorner(i[1]),wi();break;case"WIRING_WIDTH_INPUT":A.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}wireMode(e){}};var sde=class extends jS{constructor(t){super(),this.pad=t}getResult(t){let e=new Array;if(t.shape.forEach(r=>{let i=this.getModel(t,r);e.push(i),r.remove()}),e=A1(e),e.length>0){let r=e.map(i=>i.primitive);e.forEach(i=>i.remove()),this.pad.setChildrens(ge.build2(r)),this.pad.fill()}t.shape.length=0}getPrimitive(t){if(t instanceof Vi||t instanceof es)return t.primitive;if(t instanceof cr)return new M(t.start,t.end);if(t instanceof gs)return q.build2(t.center,t.startAngle,t.endAngle,t.radius,t.radius,t.sweep)}getModel(t,e){let r=this.pad.layerId;return new Po().clone4Shape(this.getPrimitive(e),r,t._width)}confirmWindow(t,e){this.modify(t,e,!0)}async modify(t,e,r){let i=this.pad.getParent();i!=null&&i instanceof ke&&(t.commands.addCommand(Ce.dispatch(i,"modify")),await new ff().updateCustomFootprint(i,t.commands,[this.pad])),Uu.realtimeCheckItems([this.pad]),qe.executeCommand(t.commands),A.publish("hasModifyPcbItem",this.pad),this.pad.fill(),this.pad.visible(),this.pad=null,e.drawing=!0,A.publish("tool","dropdrag"),A.publish("flushSelectingInfo",""),A.publish("flushService","")}};var LG=class extends ni{constructor(e,r,i,n,s,a,l,c){super();this.event=new du;this.padDrillModels=new Array;this.isDetermineLine=!1;this.selectPoint=null;this.pcbPolygon=null;this.editPadNodeShape=!1;this.start(),this.editHistory=c,this.resultEvent=new sde(s),this.event.commands=l||new De("redraw polygon Pad"),this.event._width=.02;for(let u of e){let d=this.getShape(u,s.layerId);this.event.shape.push(d)}this.drawing=!0,this.event.start=i,this.event.last=r,this.selectPoint=n,Zt.getInstance().type="WIRING_CORNER_FREEANGLE",this.event.needClose=!0,s.hidden(),s.removeFill(),Pe.setActiveLayerId(s.layerId),this.pad=s,this.padDrillModels=a;let h=this.pad.createPreviewChildrens();this.pcbPolygon=pt.addPolygon("Line",this.pad.layerId,[h],.02,"",!1),this.pcbPolygon.hidden(),this.drawPolygon=new Tl(this.event,Ur,this.resultEvent),this.drawPolygon.draw(this.event.last,this.selectPoint,Zt.getInstance().type),this.drawPolygon.asClose(this.selectPoint),he.windowBridge.publish("editPadShape","",Q()),Ur.addDrawTool(this),we.synchronize(),this.startHide()}getShape(e,r){let i=r;if(e instanceof q){let n=e.startAngle/180*Math.PI,s=e.endAngle()/180*Math.PI;return es.build(i,e.center,e.rx,this.event._width,n,s,e.sweep())}else return Vi.build(i,e.start(),e.end(),this.event._width)}onKeyDown(e){switch(tr.getAction(4,e)){case"changeRoutingAngle":case"Routing Corner":this.wireCorner(Ur.getNextType()),wi();break;case"Cancel":this.completed(!0);case"Finish":this.onEnterPlace(e);return}this.drawPolygon.onKeyDown(e)}onMouseRightUp(e){if(e.openMenu)switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.completed(!0):this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.completed(!0);break}}}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY),i=this.isSelectStart(r);this.drawPolygon.onMouseLeftUp(e),this.isDetermineLine=!0,this.manualHighLight(),i&&(this.addCommand(),he.publish("select",[this.pad]),he.publish("editPadShape",{history:this.editHistory}))}isSelectStart(e){return this.event.shape.length>0&&this.event.shape[0].start.distance1(e)<=this.event._width/2}onMouseMove(e){this.drawing&&(this.drawPolygon.onMouseMove(e),this.manualHighLight())}interrupt(){this.drawPolygon.interrupt(),this.resultEvent.pad!=null&&(this.resultEvent.pad.visible(),this.resultEvent.pad.fill()),this.padDrillModels.forEach(e=>{e.remove()}),this.pcbPolygon.remove(),pt.delete(this.pcbPolygon),this.padDrillModels.length=0,he.windowBridge.publish("interuptEditPadMode","",Q()),this.resotreHight(),this.end()}cancel(){this.drawPolygon.cancel()}flipPath(){this.drawPolygon.flipPath()}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new eh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new Gh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new ja(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Tl(this.event,Ur,this.resultEvent);break}this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr),Zt.getInstance().type=e,we.synchronize()}completed(e=!1){e&&!this.isDetermineLine&&this.drawPolygon.asMouseLeftUp(this.selectPoint),this.drawPolygon.abortLast=e,this.drawPolygon.completed(!1),this.addCommand(),this.padDrillModels.forEach(r=>{r.remove()}),this.padDrillModels.length=0,this.end(),this.pad.fill(),he.publish("select",[this.pad]),he.publish("editPadShape",{history:this.editHistory})}checkDrillInInner(){if(ar(this.pad.layerId)){let e=this.event.shape,r=ge.build2(this.getPrimitive(e)),i=ge.build2(this.getPrimitive1(this.padDrillModels));return Gy.build2(r,i).inInner()}else return!0}getPrimitive(e){let r=new Array;for(let i of e)r.push(this.getModel(i));return r}getModel(e){if(e instanceof Vi||e instanceof es)return e.primitive;if(e instanceof cr)return new M(e.start,e.end);if(e instanceof gs)return q.build2(e.center,e.startAngle,e.endAngle,e.radius,e.radius,e.sweep)}getPrimitive1(e){let r=new Array;for(let i of e)if(i instanceof mt)r.push(new M(i.start,i.end));else{let n=i.startAngle/Math.PI*180,s=i.startAngle===i.endAngle?360:i.endAngle/Math.PI*180,a=q.build2(i.center,n,s,i.radius,i.radius,i.sweep);r.push(a)}return r}backspace(){this.drawPolygon.backspace()}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:vg(Zt.getInstance().type,e.adsorb,!0).result};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed();break;case"CANCEL":this.completed(!0);break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":this.wireCorner(i[1]),wi();break;case"toggleAdsorb":he.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":he.publish("openSystemDialog","ADSORPTION",Q());break}he.publish("updateFrame","")}wireMode(e){}startHide(){he.publish("stashHight",""),Pe.forceDeactive(!0),Pe.setActiveLayerId(Pe.getActiveLayerID()),this.manualHighLight()}manualHighLight(){this.event.shape.forEach(e=>e.manualHighLight=!0),this.drawPolygon.getPreviewOutline().forEach(e=>e&&(e.manualHighLight=!0)),this.event.closeLine&&(this.event.closeLine.manualHighLight=!0)}resotreHight(){Pe.forceDeactive(!1),Pe.setActiveLayerId(Pe.getActiveLayerID()),he.publish("restoreHight","")}addCommand(){if(!this.editPadNodeShape){let e=this.pad.createPreviewChildrens();L1.getInstance().getActiveToolId()==="EditPPadTool"&&(this.editHistory.beginSession(this.pcbPolygon,null,this.padDrillModels),this.pcbPolygon.setChildrens(e),this.editHistory.commit()),this.editPadNodeShape=!0}}};function Hje(o){let t=new qt;return t.add("CANCEL",!0),t.addExtend("ROTATE",Ag()),t.add("TURNOVER",!0),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t}var ade=class extends bi{constructor(e,r,i=!0){super();this.item=null;this.isTestPad=!1;this.item=e,this.tool=r,this.isVia=i,e instanceof Le&&(this.isTestPad=!0)}open(e){let r;return this.item!=null?r={action:"attribute-for-place-ind-via",attrNet:this.item.net,netList:Ye.getNet(),isTestPad:this.isTestPad}:r={action:"attribute-for-place-ind-via",attrNet:"",netList:Ye.getNet(),isTestPad:this.isTestPad},this.isTestPad&&(r.title="Test Point Property"),r}modify(e){}close(e){if(e.action=="confirm"){let i=e.net;i==null&&(i=""),i=i.toUpperCase(),this.isVia&&(ut.defaultVia.net=i),this.item!=null&&this.item instanceof Ue&&(this.item.net=i,ut.setDefaultVia(this.item)),this.isTestPad&&(this.item.net=i,ut.setDefaultPad(this.item)),(this.tool instanceof w1||this.tool instanceof dE)&&this.tool.flushNear()}return!0}};var BD=class BD extends dE{constructor(){super(!0)}get mouseLeftUpInfo(){return this._mouseLeftUpInfo}set mouseLeftUpInfo(t){this._mouseLeftUpInfo=t}onKeyDown(t){switch(super.onKeyDown(t),t.keyCode){case 9:let e=this.getPad();if(e){let r=new ade(e,this);A.publish("openDialog",r)}break}}onMouseMove(t){this.mouseLeftUpInfo||super.onMouseMove(t,this.initTestPad.bind(this))}parse(t){switch(super.parse(t),this.mouseLeftUpInfo=null,t.cmdKey.split(":")[0]){case"INHERIT_NET":this.setPadIsTestPad();break}}onMouseLeftUp(t){let e=this.getPad();if(!e)return;let r=new S(t.sceneX,t.sceneY);e.center=r;let i=new Ay([e]);i.updateScene();let{netsGroupSet:n}=i.getNetPcbItems(t),s=[];for(let l of n)s.push(...Array.from(l.nets));let a=s.length;a===1?(e.net=s[0],super.onMouseLeftUp(t),this.setPadIsTestPad()):a>1?(this.showNetsMenu(t,s),this.mouseLeftUpInfo={...t}):(super.onMouseLeftUp(t),this.setPadIsTestPad())}cancel(){BD.num--,super.cancel()}setPadIsTestPad(){let t=this.getPad();t.isTestPad=!0,$p(t.model),t.num="TP"+BD.num,BD.num++}rightClickMenuData2(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:MD(ut.defalutTestPad.layerId,t.adsorb,this,!0).result};$t.getInstance().menuData(e,this),this.drawing=!1}initTestPad(){let t=this.getPad();t.isTestPad=!0,t.num="TP"+BD.num,BD.num++;let e=Pe.getActiveLayer(),r=[2,12].includes(e.layerID)?e.layerID:1;t.layerId=r,$p(t.model),ut.setDefaultTestPad(t)}};BD.num=1;var MG=BD;function lde(o,t){let e=new qt;e.add("CANCEL",!0),e.addExtend("ROTATE",Ag());let r=!0,i=!0;return o.forEach(n=>{n instanceof lr||n instanceof Mn?i=!1:n instanceof ke?r=!1:(r=!1,i=!1)}),e.addExtend("FLIP",Xy()),e.add("TURNOVER",!0),e.add("toggleAdsorb",!1,t),e.add("ADSORBENT_CONFIG"),e}var FD=class extends ni{constructor(e,r,i,n,s){super();this.items=new Set;this.alreadyRotate=!1;this.isMoveInOrder=!1;this.curItem=null;this.util=null;this.pcbPlaceTransfer=null;this.firstMove=!0;this.logger=new Di(4);if(this.start(),this.option="OPTIONLEFTUP",this.isContinuousMode=n,e.items.length==1&&r=="MOVE_BY_CENTER_POINT"){let u=e.items[0],d=u.getParent();if((u instanceof Ue||u instanceof Le)&&d!=null&&d instanceof ke){let p=u.center;e.referX=p.x,e.referY=p.y,r="MOVE_BY_ORIGIN_POINT"}}this.menu=r,this.fac=i,this.itemsSortByDesignator=new Array,this.associationItem=new Ya(e.items);let a=this.associationItem.items;this.associationItem.setUpConnectTrack();let l=this.associationItem.itemConnectTrack,c=new Array;switch(a.forEach(u=>{if(s.includes(u))return;u.click(),this.items.add(u),(e.items.includes(u)||!l.tracks.has(u.globalIndex))&&c.push(u),this.addFilterItem(u),this.fac.addCommand4Item(u,"modify")}),this.tool=new Ad(c),this.tool.recordStyle(),this.associationItem.getAllRepairTracks().forEach(u=>{this.fac.addCommand4Item(u,"modify")}),r){case"MOVE_BY_CENTER_POINT":this.isMoveInOrder=!1,this.moveByCenterPoint();break;case"MOVE_BY_ORIGIN_POINT":case"MOVE_BY_REFERENCE_POINT":this.isMoveInOrder=!1,this.oldX=e.referX,this.oldY=e.referY,this.referX=e.referX,this.refery=e.referY,he.publish("updateLastMousePosition",new S(this.oldX,this.oldY));let u=new S(ba.x-this.oldX,ba.y-this.oldY),d=Ae.translate(u.x,u.y,0);this.alreadyRotate||this.associationItem.moveConnectTrack(d),this.associationItem.setAllAssociationRatlinesVisible(),this.tool.transform(d),this.oldX=ba.x,this.oldY=ba.y;break;case"MOVE_SEQUENTIAL":this.isMoveInOrder=!0,a.forEach(p=>{p instanceof ke&&this.itemsSortByDesignator.push({des:p.name,item:p})}),this.moveInOrder();break}if(zu("move"),this.drawing=!0,this.items.size==1){let u=Array.from(this.items)[0];u instanceof ke&&(this.util=new iC(u))}$n.setTool(this),xo.setTool(this),Ea.changeTool(this)}addFilterItem(e){this.filterItems.add(e),e instanceof ke&&e.getItems().forEach(r=>{this.filterItems.add(r)})}moveByCenterPoint(){if(!this.items.size)return;let e=new _e;this.items.forEach(a=>{e.ext1(a.buildBBox())});let i=e.build1().center();this.oldX=i.x,this.oldY=i.y,this.referX=i.x,this.refery=i.y,he.publish("updateLastMousePosition",new S(this.oldX,this.oldY));let n=new S(ba.x-this.oldX,ba.y-this.oldY),s=Ae.translate(n.x,n.y,0);this.alreadyRotate||(this.associationItem.setUpConnectTrack(),this.associationItem.moveConnectTrack(s)),this.associationItem.setAllAssociationRatlinesVisible(),this.tool.transform(s),this.items.forEach(a=>{var l,c;a instanceof lr&&(ze.highlightComponentWhenMoveText.add(a),a.updateHelpLine()),(c=(l=gr.getControl())==null?void 0:l.flushPoint)==null||c.call(l)}),this.oldX=ba.x,this.oldY=ba.y}moveInOrder(){if(this.isMoveInOrder&&this.itemsSortByDesignator.length){this.logger.debug3("%s,%s","\u6392\u5E8F\u524D...",this.itemsSortByDesignator),this.itemsSortByDesignator.sort(this.sortRule),this.logger.debug3("%s,%s","\u6392\u5E8F\u540E...",this.itemsSortByDesignator),this.fac=new hi,this.fac.createGroup("move select for "+this.menu),this.setCurItem();let r=this.curItem.buildBBox().center();this.oldX=r.x,this.oldY=r.y}}setCurItem(){this.itemsSortByDesignator.length?(this.curItem=this.itemsSortByDesignator[0].item,this.associationItem=new Ya([this.curItem]),this.util=new iC(this.curItem),this.fac.addCommand4Item(this.curItem,"modify")):this.curItem=null}sortRule(e,r){var i=/[^a-zA-Z]/g,n=/[^0-9]/g,s=parseInt(e.des,10),a=parseInt(r.des,10);if(isNaN(s)&&isNaN(a)){var l=e.des.replace(i,""),c=r.des.replace(i,"");if(l===c){var h=parseInt(e.des.replace(n,""),10),u=parseInt(r.des.replace(n,""),10);return h===u?0:h>u?1:-1}else return l===""?1:c===""?-1:l>c?1:-1}else return isNaN(s)?1:isNaN(a)?-1:s>a?1:-1}onKeyDown(e){let r=tr.getAction(2,e),i=new S(e.realSceneX,e.realSceneY);switch(r){case"Flip Right and Left":this.items.size&&Array.from(this.items).every(n=>n instanceof ke)?pf.flipComponent("Flip Right and Left",i,Array.from(this.items),this.fac.getCommand()):he.publish("turn","turnAround");break;case"Flip Up and Down":this.items.size&&Array.from(this.items).every(n=>n instanceof ke)?pf.flipComponent("Flip Up and Down",i,Array.from(this.items),this.fac.getCommand()):he.publish("turn","turnUpsideDown");break;case"Cancel":this.cancel();break;case"Rotate Left":this.rotate("rotate_left");break;case"rotate_right":this.rotate("rotate_right");break;case"flip2OppositeSide":a_(void 0,Array.from(this.items));break;case"Switch Selected Range When Object Is Selected":{he.publish("openMainDialog",{cmd:48,data:{position:{x:this.referX,y:this.refery},tool:this}});break}}he.publish("updateFrame","")}onMouseMove(e){this.fac&&this.drawing&&(this.isMoveInOrder?this.itemMovingInOrder(e):this.itemsMoving(e),this.firstMove&&(this.items.forEach(r=>{r instanceof lr&&ze.highlightComponentWhenMoveText.add(r)}),this.firstMove=!1))}onMouseLeftUp(e){var r;this.fac&&((r=this.tool)==null||r.complete(),this.isMoveInOrder?this.itemMovedInOrderMouseUp(e):this.itemsMovedMouseUp(e),ze.highlightComponentWhenMoveText.clear(),pf.clear())}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,keyCode:l}=e;if(a){at.editingWhat=i;return}this.applyValue(e),l===13&&at.destroy()}applyValue(e){let r=new dt,{value:i,type:n,startPoint:s,cursorPoint:a}=e,l=new S(a.x-s.x,a.y-s.y).normalize();i=r.conversion(R.getInstance().unit,"mil",i/10),l=new S(l.x*i,l.y*i);let c=new S(l.x+s.x,l.y+s.y),h=new S(c.x-a.x,c.y-a.y),u=Ae.translate(h.x,h.y,0);this.items.forEach(d=>{this.fac.addCommand4Item(d,"modify")}),this.tool.transform(u),this.itemsMovedMouseUp(null)}itemsMoving(e){this.placeTransferbeforeMoving(),this.moveTo(e.sceneX,e.sceneY)}moveTo(e,r){let i=new S(e-this.oldX,r-this.oldY),n=Ae.translate(i.x,i.y,0);if(this.util!=null&&!It.getInstance().currentCoord){let s=new S(e,r),a=this.util.getMatrix(s,s);n=n.multiply4(a)}this.alreadyRotate||(this.associationItem.setUpConnectTrack(),this.associationItem.moveConnectTrack(n)),this.associationItem.setAllAssociationRatlinesVisible(),this.tool.transform(n),this.tool.isMoveBox()||this.items.forEach(s=>{var a,l;(l=(a=gr.getControl())==null?void 0:a.flushPoint)==null||l.call(a),s instanceof lr&&s.updateHelpLine()}),this.oldX=e,this.oldY=r}moveToCenterWhenOutOfFrame(){let e=ys(this.items).build(),r=Jx();e.isInside(r)||he.publish("adaptBBox",{bbox:e,needAdaptAll:!1})}placeTransferbeforeMoving(){if(!this.pcbPlaceTransfer)return;let e=this.pcbPlaceTransfer.positionMap||[],r=[],i=10,n=new _e;if(e.forEach(d=>{let p=d.offset,m=nn.convert(p.x,d.unit,i),g=nn.convert(p.y,d.unit,i);r.push({uniqueId:d.uniqueId,x:m,y:g}),n.ext6(m,g)}),!n.valid())return;let s=new BR({sourcePositionMap:r,targets:Array.from(this.items),config:{autoSpace:nn.convert(.5,39.37,i),maxSpace:nn.convert(3,39.37,i),minSpace:0}}).getLayouts(),a=new _e,l=n.build1().center(),h=ba.sub(l);if(s.forEach(d=>{let p=d.component,m=d.position.sub(p.position).add(h);return p.transform(Ae.translate(m.x,m.y,0)),a.ext1(d.bbox.transform(Qe.translate1(h))),!0}),!a.valid())return;let u=a.build1().center();this.oldX=u.x,this.oldY=u.y,this.setPcbPlaceTransfer(null)}itemsMovedMouseUp(e){this.associationItem.complete(this.fac.getCommand()),this.fac.checkOutlines(Array.from(this.items),new Set),this.fac=new hi,this.fac.createGroup("move select for "+this.menu),zu("default");let r=new Array;this.items.forEach(i=>{r.push(i),he.publish("hasModifyPcbItem",i)}),he.publish("select",r),this.toggle(),he.publish("flushService","")}itemMovingInOrder(e){if(this.curItem){let r=new S(e.sceneX-this.oldX,e.sceneY-this.oldY),i=Ae.translate(r.x,r.y,0);if(this.util!=null&&!It.getInstance().currentCoord){let n=new S(e.sceneX,e.sceneY),s=this.util.getMatrix(n,n);i=i.multiply4(s)}this.curItem.transform(i),this.curItem instanceof lr&&this.curItem.updateHelpLine(),this.oldX=e.sceneX,this.oldY=e.sceneY}}itemMovedInOrderMouseUp(e){if(this.curItem)if(this.fac.checkOutlines([this.curItem],new Set),he.publish("hasModifyPcbItem",this.curItem),this.itemsSortByDesignator.length>1){this.itemsSortByDesignator.splice(0,1),he.publish("refreshTearDrop",""),this.fac=new hi,this.fac.createGroup("move select for "+this.menu),this.setCurItem();let i=this.curItem.buildBBox().center();this.oldX=i.x,this.oldY=i.y,he.publish("flushService","")}else{this.itemsSortByDesignator.splice(0,1),this.fac=new hi,this.fac.createGroup("move select for "+this.menu),this.setCurItem(),zu("default");let r=new Array;this.items.forEach(i=>{r.push(i)}),this.isMoveInOrder=!1,this.drawing=!1,he.publish("select",r),this.toggle(),he.publish("flushService","")}}interrupt(){var e;if(this.items.size>0){(e=this.tool)==null||e.cancel(),this.associationItem.interrupt();let r=new Array;this.items.forEach(i=>{r.push(i)}),this.tool.isMoveBox()||this.fac.undo(),setTimeout(()=>{let i=r.filter(n=>n.isEmpty?!1:(n.click(),!0));he.publish("select",i),he.publish("updateFrame","")},10),this.items.clear(),this.drawing=!1,this.fac=new hi,this.fac.createGroup("move select for "+this.menu),at.destroy(),zu("default")}$n.setTool(null),this.end()}cancel(){this.interrupt(),this.toggle()}toggle(){this.isContinuousMode&&(this.menu=="MOVE_BY_CENTER_POINT"||this.menu=="MOVE_BY_ORIGIN_POINT"||this.menu=="MOVE_BY_REFERENCE_POINT")?he.publish("toggle",{command:"MouseSelect",cmd:this.menu}):he.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:lde(this.items,e.adsorb).result};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"ROTATE":this.rotate(i[1]);break;case"FLIP":this.flip(i[1]);break;case"TURNOVER":this.flip2OppositeLayer();break;case"toggleAdsorb":he.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":he.publish("openSystemDialog","ADSORPTION",Q());break}he.publish("updateFrame","")}rotate(e){if(e==="rotate_left"){this.rotateFor(this.oldX,this.oldY,le.pcbConfig.rotate);let r=new S(this.oldX,this.oldY),i=this.curItem?[this.curItem]:this.items;this.curItem?$n.rotate(r,le.pcbConfig.rotate,i):this.tool.rotateFor(r,le.pcbConfig.rotate)}if(e==="rotate_right"){this.rotateFor(this.oldX,this.oldY,-le.pcbConfig.rotate);let r=new S(this.oldX,this.oldY),i=this.curItem?[this.curItem]:this.items;this.curItem?$n.rotate(r,-le.pcbConfig.rotate,i):this.tool.rotateFor(r,-le.pcbConfig.rotate)}if(e==="rotate_reference_point"){this.rotateReferPointCallback=(n,s,a,l)=>{this.rotateReferPointCallback=null},this.rotateFor(this.oldX,this.oldY,le.pcbConfig.rotate);let r=this.curItem?[this.curItem]:this.items,i={x:this.oldX,y:this.oldY,items:this.tool,executeCommand:!1};$n.rotateAssignReferPoint(i,this,null,null,this.rotateReferPointCallback.bind(this))}}flip2OppositeLayer(){!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype||Is.getInstance().init(this.items,"flip to OppositeLayer",(e,r)=>{let i=!1;for(let n of e)n instanceof ke&&(r.addCommand4Item(n,"modify"),ao(n.layerId)?n.layerId=2:n.layerId=1,n.click(),i=!0);i&&r.execute()})}flip(e){var r;switch(xo.setTool(this),(r=this.tool)==null||r.sycn(),e){case"FLIP_LEFTANDRIGHT":xo.turn(this.items,!1,!1,new S(this.oldX,this.oldY));break;case"FLIP_UPANDDOWN":xo.turn(this.items,!0,!1,new S(this.oldX,this.oldY));break;case"FLIP_LEFTANDRIGHT_BY_REFER_POINT":{let i={items:this.items};xo.turnByReferPoint(i,this);break}case"FLIP_UPANDDOWN_BY_REFER_POINT":{let i={items:this.items,isTurnUpsideDown:!0};xo.turnByReferPoint(i,this);break}}}setCenter(e,r){this.oldX=e,this.oldY=r}rotateFor(e,r,i){let n=Ae.translate(-e,-r,0).rotateZ(i).translate1(e,r,0);this.alreadyRotate=!0,this.associationItem.interrupt(),this.alreadyRotate||(this.associationItem.setUpConnectTrack(),this.associationItem.moveConnectTrack(n))}setPcbPlaceTransfer(e){this.pcbPlaceTransfer=e||null}};var I5=class extends Oo{constructor(e,r,i,n,s){super();this.status=0;On.getInstance().allowPull=!1,this.oldToolDrawing=r,this.drawing=!0,this.tool=e,this.lastTool=i,this.positiveMsg="Please select a positive network",this.negativeMsg="Please select a negative network",this.name=n.differentailPairName,this.positiveNet=n.differentailPairPositiveNet,this.negativeNet=n.differentailPairNegativeNet,this.netOptions=n.netOptions,this.differentailPairList=n.differentailPairList,this.isEdit=n.isEdit,this.fromRule=n.fromRule,this.status=s=="positive"?0:1,this.oldData=n.oldData}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":this.cancel();break}A.publish("updateFrame","")}onEnterPlace(e){this.onMouseLeftUp(e)}onMouseMove(e){let r=this.status===0?this.positiveMsg:this.negativeMsg;Ut.update(e,r),this.isRightMouseMove=!0}onMouseLeftUp(e){if(this.drawing){let r=ze.getSelects(),i=Vr.selectNet(e.sceneX,e.sceneY);this.selectItems=r;let n=!1;r!==null&&(this.netsGroupSet=this.getNearNetPcbItems(i,e.sceneX,e.sceneY),n=this.handleNets(e,r)),n&&this.successEvent()}}successEvent(){let e=[];re.getInstance().getAllNets().forEach(r=>{r.name&&e.push({value:r.name,text:r.name})}),this.status===0?this.handleMatchData(e,"pos"):this.handleMatchData(e,"neg"),this.differentailPairList.forEach(r=>{r.name==this.name&&(r.sub[0]?r.sub[0].name=this.positiveNet:r.sub.unshift({"Differential Pair":"default",name:this.positiveNet,type:"net"}),r.sub[1]?r.sub[1].name=this.negativeNet:r.sub.push({"Differential Pair":"default",name:this.negativeNet,type:"net"}))}),this.interrupt(),A.publish("openDifferentailDialog",{name:this.name,positiveNet:this.positiveNet,negativeNet:this.negativeNet,diffPairList:this.differentailPairList,netOptions:this.netOptions,isEdit:this.isEdit,fromRule:this.fromRule,oldData:this.oldData},Q())}getNearNetPcbItems(e,r,i){let n=new Set,s=new Set,a=new Set;return e.forEach(l=>{let c=l.net;if(l instanceof He&&l.type=="Copper Region"){let h=!1;if(l.iteratorCopper(u=>{h||u.inCopper(r,i)&&u.isVisible&&(h=!0)}),!h)return}c&&(a.add(l),s.add(c))}),n.add({group:a,nets:s}),n}handleNets(e,r){let i=!1;return this.nets=new Set,this.netsGroupSet.forEach(n=>{this.nets=n.nets}),this.nets.size?this.nets.size===1?(this.nets.forEach(n=>{this.updateNetwork(n,r)}),i=!0):(Ut.cancel(),this.showNetsMenu(e)):i=!1,i}showNetsMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=this.getNetsMenuData().result,$t.getInstance().menuData(r,this),this.drawing=!1}getNetsMenuData(){let e=new qt,r="INHERIT_NET:";return this.nets.forEach(i=>{if(i){let n={name:i,cmd:`${r+i}`,tips:"",option:{disabledI18n:!0}};e.addObj(n,!1,!1)}}),e}handleMatchData(e,r){let i=["_P","_N","+","-"],n=r=="pos"?this.positiveNet:this.negativeNet,s=i.find(l=>n.endsWith(l));if(!(r=="pos"?this.negativeNet:this.positiveNet)&&s){let l={_P:"_N",_N:"_P","+":"-","-":"+"};this.matchDiffPair({allNets:e,suffix:l[s],val:n,type:r})}}extractCommonPart(e,r){let i=e.lastIndexOf(r);return i===-1?null:e.substring(0,i)}matchDiffPair(e){var c;let r=e.val,i=["_P","_N","+","-"],n=null,s=null;for(let h of i)if(r.endsWith(h)){n=h,s=e.suffix;break}if(!n||!s)return;let a=this.extractCommonPart(r,n);if(a===null)return;let l=(c=e.allNets.find(h=>{let u=h.value;return u.endsWith(s)?this.extractCommonPart(u,s)===a:!1}))==null?void 0:c.value;l&&(e.type=="pos"?this.negativeNet=l:this.positiveNet=l)}updateNetwork(e,r){if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let i=this.differentailPairList.find(n=>{var s,a;return n.name!==this.name&&(((s=n.sub[0])==null?void 0:s.name)==e||((a=n.sub[1])==null?void 0:a.name)==e)});return i?(A.publish("showPcbSlideMsg",["The network {0} already exists in the Differentail-pair {1}, Unable to added success.",[e,i.name]],Q()),!1):(A.publish("flushService",""),A.publish("flushSelectingInfo",""),this.status===0?this.positiveNet=e:this.status===1&&(this.negativeNet=e),!0)}checkConnect(e){let r=e.searchNode();for(let i of r)if(i instanceof Ge)return!0;return!1}interrupt(){this.drawing=!1,this.tool.setNextTool(this.lastTool),this.lastTool instanceof vo&&this.lastTool.getWireMode()=="Differential pair wiring"&&we.setCommand("draw(difftrack)"),di.resetLastScene(),this.tool.drawing=this.oldToolDrawing,Ut.cancel(),On.getInstance().allowPull=!0}cancel(){this.interrupt(),A.publish("cancelDifferentailSelect","",Q()),A.publish("tool","dropdrag")}onMouseRightDown(e){this.isRightMouseMove=!1}onMouseRightUp(e){if(le.pcbConfig.endDrawing=="ctrl+rightClick"){if(!e.ctrlKey){this.rightClickMenuData(e);return}}else if(e.ctrlKey){this.rightClickMenuData(e);return}this.isRightMouseMove||(this.interrupt(),A.publish("openDifferentailDialog",{name:this.name,positiveNet:this.positiveNet,negativeNet:this.negativeNet,diffPairList:this.differentailPairList,netOptions:this.netOptions,isEdit:this.isEdit,oldData:this.oldData},Q()))}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel(),A.publish("openDifferentailDialog",{name:this.name,positiveNet:this.positiveNet,negativeNet:this.negativeNet,diffPairList:this.differentailPairList,netOptions:this.netOptions,isEdit:this.isEdit,oldData:this.oldData},Q());break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"INHERIT_NET":this.updateNetwork(i[1],this.selectItems),this.successEvent();break}A.publish("updateFrame","")}};var cde=class o extends Pr{constructor(e,r){super(e);this.isBase=!0;super.color=r,this.sendDeleteMsg=!1}static build(e,r,i,n,s,a=ee.BLACK){s=Pu(s,e),r=xm(e,r,0);let l=new Ip(Lh(),e,r,i,n,s,!1,"",null,null);return new o(l,a)}setBBoxModify(){}setLayerModify(e){}};var NG=class extends ni{set circle(t){this.filterItems.clear(),this._circle=t}get circle(){return this._circle}constructor(){super(),this.option="OPTIONLEFTUP",this.setCircle(),Ea.changeTool(this),this.start()}onKeyDown(t){switch(tr.getAction(4,t)){case"Cancel":this.cancel();break}A.publish("updateFrame","")}onMouseLeftUp(t){this.place()}place(){if(this.circle){if(!Mt.checkIsInCanEdit(this.circle)){let r="beyond drawing range";Mt.showMassageTip(r,r);return}let t=new De("draw screw pillar"),e=Kt.addCircle("3D Shell - Screw Pillar",this.circle.layerId,this.circle.center,this.circle.radius,this.circle.strokeWidth,!1,"");e.partition=R.getInstance().partitionId,e.layerId===54&&(e.strokeWidth=1,e.fill()),t.addCommand(Ce.dispatch(e,"add")),qe.executeCommand(t),A.publish("onlySelect",[e]),this.drawing=!0,A.publish("updateRtree",""),this.setCircle(),A.publish("updateFrame","")}}applyInputAtCursorValue(t){let{value:e,type:r,locked:i,unlocked:n,editing:s,keyCode:a,startPoint:l}=t;if(s){at.editingWhat=r;return}this.applyValue(t),a===13&&at.destroy()}applyValue(t){let{value:e,type:r,startPoint:i,cursorPoint:n}=t,s=new dt,a,l;if(e=s.conversion(R.getInstance().unit,"mil",e/10),at.id==="adsorption"){let c=new S(n.x-i.x,n.y-i.y).normalize();c=new S(c.x*e,c.y*e);let h=new S(c.x+i.x,c.y+i.y);this.circle.center=h,this.place(),A.publish("updateFrame","")}}onMouseMove(t){this.circle!=null&&this.drawing&&(this.circle.visible(),this.circle.removeFill(),this.circle.center=new S(t.sceneX,t.sceneY))}rightClickMenuData(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:po(t.adsorb)};$t.getInstance().menuData(e,this)}interrupt(){this.circle!=null&&(this.circle.remove(),this.circle=null,this.drawing=!1,A.publish("updateRtree","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}parse(t){switch(t.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}setCircle(){if(this.circle==null){let t=new S(0,0),e=Pe.getActiveLayerID(),r=e!==55,{specification:i}=Gf.d3ShellScrewPillarComponent,n=Ov[i],a=(r?n.screwheadDiameter:n.holeDiameterWithoutSpigot)/2;this.circle=cde.build("3D Shell - Screw Pillar",e,t,a,1),this.circle.hidden()}}toggleLayer(t){this.circle.layerId!==t&&[this.circle.layerId,t].includes(55)&&(this.interrupt(),this.drawing=!0,this.setCircle())}};var kG=class extends ni{constructor(){super();this.started=!1;this.option="OPTIONLEFTUP",Ea.changeTool(this)}set line(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._line=e}get line(){return this._line}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);break}A.publish("updateFrame","")}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY);this.line==null?this.startDraw(r):this.endDraw()}startDraw(e){if(!Mt.checkIsCanEditByPoint(e))return;this.start();let r=Pe.getActiveLayerID(),n=new Po().addLine(e,e,r);this.line=pt.addPolygon("3D Shell - Side Datum Line",r,[[n]],1,"",!1),this.drawing=!0,this.started=!0}endDraw(){this.line.partition=R.getInstance().partitionId,A.publish("onlySelect",[this.line]);let e=new De("draw datum line");e.addCommand(Ce.dispatch(this.line,"add")),qe.executeCommand(e),this.line=null,this.drawing=!0,this.started=!1,A.publish("updateRtree",""),this.end()}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,keyCode:l,startPoint:c}=e;if(a){at.editingWhat=i;return}this.applyValue(e),l===13&&at.destroy()}applyValue(e){let{value:r,type:i,startPoint:n,cursorPoint:s}=e,a=new dt,l,c;if(r=a.conversion(R.getInstance().unit,"mil",r/10),at.id==="adsorption"){let h=new S(s.x-n.x,s.y-n.y).normalize();h=new S(h.x*r,h.y*r);let u=new S(h.x+n.x,h.y+n.y);this.started?(this.line.getChildrens()[0][0].end=u,this.end()):this.startDraw(u),A.publish("updateFrame","")}}onMouseMove(e){this.line!=null&&this.drawing&&(this.line.getChildrens()[0][0].end=new S(e.sceneX,e.sceneY))}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this)}interrupt(){this.line!=null&&(this.line.remove(),A.publish("delete",this.line),this.line=null,this.drawing=!1,this.started=!1,A.publish("updateRtree","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}parse(e){switch(e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}};var zq=class zq extends ni{constructor(e,r,i){super();this.addHistory=!0;this.mouseLeftDown=!1;this.isTrack=!1;this.track=null;this.trackIdentify=null;this.connectNodes=new Array;this.isConnectStart=!1;this.lockedAfter=!1;if(this.start(),this.option="OPTIONLEFTUP",Ea.changeTool(this),this._ready=!0,this.drawing=!0,this.mouseLeftDown=!1,e?this.commands=e:this.commands=new De("move outline"),this.filterItems.clear(),this.updateFilterItems(r),i&&(i!=null&&i.track)){this.track=i.track;let s=new ou(this.track);i.selectType===0&&(this.connectNodes=s.startNodes),i.selectType===1&&(this.connectNodes=s.endNodes),this.trackIdentify=s,this.isConnectStart=i.selectType===0;let a=this.isConnectStart?this.trackIdentify.startNodes[0]:this.trackIdentify.endNodes[0];if(a instanceof Le&&i.controlPoint){let l=new S(i.controlPoint.x,i.controlPoint.y),c=this.addPoint(()=>this.track.layerId,l);c.click(),this.trackControlPoint=c}else this.trackControlPoint=i.controlPoint;if(i.track instanceof yi&&i.midPoint)if(a instanceof Le){let l=new S(i.midPoint.x,i.midPoint.y),c=this.addPoint(()=>this.track.layerId,l);c.click(),this.midPoint=c}else this.midPoint=i.midPoint}i!=null&&i.locked&&(this.filterItems.forEach(s=>s.locked=!1),this.lockedAfter=!0);let n=!1;this.filterItems.forEach(s=>{s instanceof Ge&&(n=!0)}),this.isTrack=n}get _ready(){return zq.ready}set _ready(e){zq.ready=e}updateFilterItems(e){e!=null&&e.forEach(r=>{this.filterItems.add(r)})}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,keyCode:l,startPoint:c}=e;if(a){at.editingWhat=i;return}this.applyValue(e),l===13&&at.destroy()}applyValue(e){let{value:r,type:i,startPoint:n,cursorPoint:s}=e,a=new dt,l,c;if(r=a.conversion(R.getInstance().unit,"mil",r/10),at.id==="adsorption"){let h=new S(s.x-n.x,s.y-n.y).normalize();h=new S(h.x*r,h.y*r);let u=new S(h.x+n.x,h.y+n.y);this.inputInfo.sceneX=u.x,this.inputInfo.sceneY=u.y,this.onMouseMove(this.inputInfo),this.onMouseLeftUp(this.inputInfo),A.publish("updateFrame","")}}onMouseLeftDown(e){this.mouseLeftDown||(this.mouseLeftDown=!0,ze.onMouseLeftDown(e))}onMouseLeftUp(e){this._ready&&(this.isTrack||(gr.onMouseMove(e),gr.onMouseLeftUp(e)),this.completed(),this.commands.length&&qe.executeCommand(this.commands))}checkIntersection(){let e=ze.getSelects();for(let r of e)if(r instanceof He){if(Eo(r.getMathGraphics(r.layerId,0)))return!0}else if(r instanceof mt||r instanceof _t){let i=r.getParent();if(i instanceof He&&Eo(i.getMathGraphics(i.layerId,0)))return!0}return!1}onMouseRightDown(e){ze.onMouseRightDown(e)}onMouseRightUp(e){if(this._ready&&e.openMenu)switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}onMouseMove(e){if(!this._ready)return;this.inputInfo=e;let r=new S(e.sceneX,e.sceneY);if(this.isTrack){let i=this.isConnectStart?this.trackIdentify.startType:this.trackIdentify.endType,n=i===0?null:this.isConnectStart?this.trackIdentify.startNodes[0]:this.trackIdentify.endNodes[0];if(this.addHistory&&(this.commands.addCommand(Ce.dispatch(this.track,"modify")),n&&this.commands.addCommand(Ce.dispatch(n,"modify")),this.addHistory=!1),n)switch(i){case 5:n.start=r;break;case 6:n.end=r;break;case 7:n.start=r;break;case 8:n.end=r;break}this.isConnectStart?this.track.start=r:this.track.end=r,this.trackControlPoint.setPosition(r),this.track instanceof yi&&this.midPoint.setPosition(this.track.midPoint)}else ze.onMouseMove(e)}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":{this.interrupt();break}case"Finish":{this.onMouseLeftUp(e);break}}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this)}interrupt(){var e,r;this.drawing=!1,this._ready=!1,(e=this.trackControlPoint)==null||e.remove(),(r=this.midPoint)==null||r.remove(),this.commands.length&&(this.commands.undo(),this.commands.commands.length=0),A.publish("tool","dropdrag"),this.lockedAfter&&(this.lockedAfter=!1,this.filterItems.forEach(i=>i.locked=!0)),ze.exitLeftDown(),gr.model=0,this.end()}completed(){var e,r;at.destroy(),this.drawing=!1,this._ready=!1,(e=this.trackControlPoint)==null||e.remove(),(r=this.midPoint)==null||r.remove(),ze.exitLeftDown(),this.commands.commands.length&&qe.executeCommand(this.commands),this.commands=new De("move outline"),A.publish("tool","dropdrag"),gr.model=0,this.end()}addPoint(e,r){return new Ui(e(),r)}parse(e){switch(e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}cancel(){at.destroy(),this.interrupt()}};zq.ready=!1;var BG=zq;var cOe=class{toggleAllStateLoop(){let t=!0,e=ea.getInstance();e.padShowNet&&e.padShowNum&&e.trackShowNet&&e.viaShowNet&&e.viaShowPair?t=!1:t=!0,(e.padShowNum!=t||e.padShowNet!=t)&&(e.padShowNet=t,e.padShowNum=t,this.padFlushNumNet()),e.trackShowNet!=t&&(e.trackShowNet=t,this.trackFlushNet());let r=!1;e.viaShowNet!=t&&(e.viaShowNet=t,this.viaFlushNet(),r=!0),e.viaShowPair!=t&&(e.viaShowPair=t,!r&&this.viaFlushNet()),A.publish("updateFrame","")}padFlushNumNet(){Qt.getAllItem().forEach(t=>{t.refreshRender()})}trackFlushNet(){pr.getAllItem().forEach(t=>{t.refreshRender()})}viaFlushNet(){Wr.getAllItem().forEach(t=>{t.refreshRender()})}},VD=new cOe;function hOe(o){let t=re.getInstance().getPadsPairGroupItemByGroupName(o);R.getInstance().compiler.uploadEQLenGrp(t.number,Sr.getInstance().encode("EQLEN_GRP",t))}function uOe(o){R.getInstance().compiler.deleteEQLenGrp(o)}function IT(o,t={},e={},r=[],i=[],n="",s=""){var d;let a=o.includes("net-class"),l;for(let p of r)a?re.getInstance().renameNetClass(p.oldName,p.newName):re.getInstance().renameEqualLengthGroup(p.oldName,p.newName);let c=Object.keys(t),u=Object.keys(e).filter(p=>{let m=!c.includes(p),g=r.find(y=>y.oldName==p);if(m&&!g)return!0});if(u)for(let p of u)if(a){let m=re.getInstance().getNetClass(p).getAllNets().map(g=>g.name);l=re.getInstance().deleteNetClass(p);for(let g of m)Kf(g);R.getInstance().compiler.deleteRuleSelector(["NET_CLASS",p])}else{let m=re.getInstance().getEqualLengthGroup(p).getAllNets().map(g=>g.name);l=re.getInstance().deleteEqualLengthGroup(p);for(let g of m)Kf(g);R.getInstance().compiler.deleteRuleSelector(["EQ_LEN_GRP",p])}for(let p in t)if(Object.prototype.hasOwnProperty.call(t,p)){let m=t[p];a?l=re.getInstance().getNetClass(p)||re.getInstance().addNetClass(p):l=re.getInstance().getEqualLengthGroup(p)||re.getInstance().addEqualLengthGroup(p),m.forEach(y=>{let b=re.getInstance().getNet(y==null?void 0:y.toUpperCase());if(a){if(b.netClass==l)return}else if(b.equalLengthGroup==l)return;a?b.netClass&&(b.netClass.removeNetwork(b.name),R.getInstance().compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",b.netClass))):b.equalLengthGroup&&(b.equalLengthGroup.removeNetwork(b.name),R.getInstance().compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",b.equalLengthGroup)));let P=a?["safeSpacing","trackPhysics","differentailPhysics","blindViaPhysics","radiusPhysics","innerPlane","copperPlane","solderExpansion","pasteExpansion"]:["netLengthPhysics","netLengthTolerancePhysics"];for(let T of P)b[T]=l[T];R.getInstance().compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",b)),a?l.addNetwork(b):l.addEqualLengthGroup(b),Kf(b.name)});let g=[];g=(d=e[p])==null?void 0:d.filter(y=>!m.includes(y)),g==null||g.forEach(y=>{l.removeNetwork(y);let b=re.getInstance().getNet(y);Mxt(b,a),Kf(y)}),R.getInstance().compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",l))}return A.publish("forceRenderTree",a?xl.NetClasses:xl.EqualLengthGroups,Q()),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),!0}function Mxt(o,t){(t?["blindViaPhysics","copperPlane","pasteExpansion","innerPlane","safeSpacing","solderExpansion","trackPhysics","radiusPhysics"]:["netLengthPhysics","netLengthTolerancePhysics"]).forEach(r=>{o[r]="default"})}function GD(o){let t=re.getInstance(),e=!1;return o.forEach(r=>{var n;let i=(n=t.getPadsPairGroupItemByGroupName(r.oldGroupName))==null?void 0:n.number;switch(r.action){case"CREATED":{e=!0;let s=new Array;for(let a of r.details){let l=Em.createPadItemShowTitle(a.pad1),c=Em.createPadItemShowTitle(a.pad2),h=new Em(l,c);s.push(h)}t.addPadsPairGroup(r.groupName,s),hOe(r.groupName);break}case"UPDATED":{e=!0;let s=new Array;for(let a of r.details){let l=Em.createPadItemShowTitle(a.pad1),c=Em.createPadItemShowTitle(a.pad2),h=new Em(l,c);s.push(h)}t.deletePadsPairGroup(r.oldGroupName),uOe(i),t.addPadsPairGroup(r.groupName,s),hOe(r.groupName);break}case"DELETED":{e=!0,t.deletePadsPairGroup(r.oldGroupName),uOe(i);break}default:}}),A.publish("forceRenderTree",xl.PadsPairGroups,Q()),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),e}function Wje(){return Qt.getAllItem().map(t=>{let e=t.getParent();return{id:t.globalIndex,text:`${Tr}${t.number}`,designator:e?e.designator||`${Tr}${e.number}`:"",isDissociate:!e,number:t.num||"",nets:[t.net],belongDeiviceId:(e==null?void 0:e.globalIndex)||""}})}function fE(){return re.getInstance().getAllPadsPairGroupsInstances().map(e=>({groupName:e.groupName,oldGroupName:e.groupName,action:"UNCHANGED",details:e.toJSON_ofDeatails()}))}var hde=class extends bi{constructor(t={},e){super(),this.option=t,this.tool=e}open(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let{selectedGroupName:e,isSettingAdding:r,isSettingEditing:i}=t,n=t.canvasReturnData||{},s=Wje(),a=this.createAllNetsParams(),l=fE(),c=n.selectedPadItem;n&&delete n.selectedPadItem;let h={action:"edit-pads-group",allPads:s,allNets:a,allGroups:l,isSettingAdding:!!r||!1,isSettingEditing:!!i||!1,selectedGroupName:e||(l.length?l[0].groupName:""),selectedNet:"",selectedPad1:"",selectedPad2:"",triggerBtn:"",...n||{}};return Object.keys(n).length&&(c&&(n.triggerBtn==="pad1-select-btn"&&(h.selectedPad1=c.globalIndex),n.triggerBtn==="pad2-select-btn"&&(h.selectedPad2=c.globalIndex),h.selectedNet=c.net||"Null network"),h.isSettingAdding=!1,h.isSettingEditing=!1),h}modify(t){if(!(!R.getInstance().isactive||23==R.getInstance().doctype))return this.handleModify(t)}close(t){if(!(!R.getInstance().isactive||23==R.getInstance().doctype))return this.handleModify(t)}flush(){A.publish("forceRenderTree",xl.PadsPairGroups,Q()),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q())}handleModify(t){let{action:e,allGroups:r}=t,i=!1;return(e==="confirm"||e==="apply")&&(i=GD(r),i&&this.flush()),!0}createAllNetsParams(){return Ye.getAllNets()}};var FG=class extends Oo{constructor(e,r,i,n){super();this.selectNets=new Array;this.drawing=!0,this.tool=e,this.lastTool=i,this.formData=n,this.cursorMessage="Please select a pad",this.oldToolDrawing=r,this.isRightMouseMove=!1,this.lastHightLightPad=[];let s=this.formData.selectedNet;s!="All nets"&&(s=="Null network"&&(s=""),Ye.highlightNet(s,!0,!0),this.selectNets.push(s))}onMouseMove(e){Ut.update(e,this.cursorMessage),this.isRightMouseMove=!0,this.clear();let r=Array.from(jt.filterElement(Vr.pointSelectBeforeFilter(e.realSceneX,e.realSceneY).getResult(Df))),i=[];if(this.formData.selectedNet!=="All nets")for(let n of r)n instanceof Le&&(this.formData.selectedNet=="Null network"?n.net=="":n.net===this.formData.selectedNet)&&i.push(n);else for(let n of r)n instanceof Le&&i.push(n);if(i.length>0){let n=i[0];n.click(),this.lastHightLightPad.push(n)}}onMouseLeftUp(e){if(this.drawing){let r=ze.getSelects(),i=Array.from(jt.filterElement(Vr.selectPad(e.sceneX,e.sceneY)));if(this.formData.selectedNet==="All nets"){if(i.length){this.cancel(),this.clear(),this.openSourceDialog(i);return}this.clear();return}let n=i.filter(a=>this.formData.selectedNet=="Null network"?a.net=="":a.net===this.formData.selectedNet),s=n.filter(a=>{let l=!0;return this.formData.triggerBtn&&(this.formData.triggerBtn=="pad1-select-btn"?l=a.globalIndex!==this.formData.selectedPad2:this.formData.triggerBtn=="pad2-select-btn"&&(l=a.globalIndex!==this.formData.selectedPad1)),l});if(s.length==0&&n.length>0&&A.publish("ui/toastMsg",{type:"warn",msg:"Pad1 is the same as pad2, please re-select!"},Q()),s.length){this.cancel(),this.clear(),this.openSourceDialog(s);return}this.clear()}}onMouseRightDown(e){this.isRightMouseMove=!1}onMouseRightUp(e){if(le.pcbConfig.endDrawing=="ctrl+rightClick"){if(!e.ctrlKey){this.rightClickMenuData(e),this.isRightMouseMove=!1;return}}else if(e.ctrlKey){this.rightClickMenuData(e),this.isRightMouseMove=!1;return}this.isRightMouseMove||(this.interrupt(),this.openSourceDialog())}interrupt(){this.drawing=!1,this.tool.setNextTool(this.lastTool),di.resetLastScene(),this.tool.drawing=this.oldToolDrawing;for(let e of this.selectNets)Ye.unhighlightNet(e,!0);Ut.cancel()}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel(),this.openSourceDialog();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}rightClickMenuData(e){if(this.isRightMouseMove)return;let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this),this.drawing=!1}cancel(){this.interrupt(),A.publish("tool","dropdrag")}openSourceDialog(e=[]){let r=e[0]||null;if(e.length>1){let i=e.find(n=>n.layerId==Pe.getActiveLayerID());i&&(r=i)}A.publish("EditPadsPairGroupDialog",{canvasReturnData:{...this.formData,selectedPadItem:r}})}clear(){for(let e of this.lastHightLightPad)e.visible();this.lastHightLightPad.length=0}};var CT=class o{constructor(t){this.matchList=new Array;this.allUse=!1;this.templateInfo=t}classify4Group(){let t=Op(r=>r.groupId,this.matchList),e={};for(let[r,i]of t){let n=new o(this.templateInfo);e[r]=n,xe.addAll(n.matchList,i)}return e}classify4Channel(){let t=Op(r=>r.channelId,this.matchList),e=new o(this.templateInfo);for(let[r,i]of t)(r==""||r==this.templateInfo.channelId)&&xe.addAll(e.matchList,i);return e.sortMatchList(),e}sortMatchList(){Er(this.matchList,(t,e)=>{let r=t.channelId!=""&&t.channelId==this.templateInfo.channelId,i=e.channelId!=""&&t.channelId==this.templateInfo.channelId;return r&&i||r&&!i?-1:!r&&i?1:0},0,this.matchList.length)}getIdMaps(t,e){let r=this.matchList[t],i=this.templateInfo.component.getPads(),n=r.component.getPads(),s=new Set;for(let c of i)for(let h of n)!s.has(h)&&c.num==h.num&&(e[c.globalIndex]=h.globalIndex,s.add(h));let a=this.templateInfo.component.getVias(),l=r.component.getVias();for(let c of a){let h=c.globalIndex.replace(this.templateInfo.component.globalIndex,"");for(let u of l){let d=u.globalIndex.replace(r.component.globalIndex,"");!s.has(u)&&h==d&&(e[c.globalIndex]=u.globalIndex,s.add(u))}}}};var uC=class{constructor(t){this.groupId="";this.channelId="";this.netMapNums={};this.id=t.globalIndex,this.uuid=t.footprintUUID;let e=Ji.getInstance().getItem(this.uuid);e instanceof Sc&&(this.uuid=e.source),this.component=t,this.groupId=t.combinationID,this.channelId=t.channelID;let r=t.getPads();for(let i of r){let n=i.num,s=i.net,a=this.netMapNums[s];a==null&&(a=new Array,this.netMapNums[s]=a),a.push(n)}this.sort()}sort(){for(let t in this.netMapNums){let e=this.netMapNums[t];Er(e,(r,i)=>r<i?-1:r==i?0:1,0,e.length)}}isMatch(t,e){if(this.component.attrsMap.Footprint.toUpperCase()===t.component.attrsMap.Footprint.toUpperCase()){let r=Object.keys(this.netMapNums),i=Object.keys(t.netMapNums);if(r.length==i.length){let n=new Set,s=!0;for(let a in this.netMapNums){let l=this.netMapNums[a],c=!1;for(let h in t.netMapNums){if(n.has(h))continue;let u=t.netMapNums[h];if(l.length==u.length){let d=!0;for(let p=0;p<l.length;p++)l[p]!=u[p]&&(d=!1);if(d){n.add(h),c=!0;break}}}c||(s=!1)}if(s)return!0;{let a=`template(${this.id}) and reuses(${t.id} are the same numbered pin n network does not match `;e.push(a)}}else{let n=`template(${this.id}) has ${r.length} nets,reuses(${t.id}) has ${i.length}  nets,the number of them is not match `;e.push(n)}}return!1}matchNums(t,e){if(t.length==e.length){let r=!0;for(let i=0;i<t.length;i++)t[i]!=e[i]&&(r=!1);return r}return!1}getNetMatchList(t){let e=new Map,r=new Set;for(let i in this.netMapNums){let n=this.netMapNums[i];for(let s in t.netMapNums){if(r.has(s))continue;let a=t.netMapNums[s];this.matchNums(n,a)&&(e.set(i,s),r.add(s))}}return e}getAllNets(){let t=[];for(let e in this.netMapNums)t.push(e);return t}};var mE=class o{constructor(t){this.reuseMap=new Array;this.netMaps=t}classify4GroupId(t){let e={};for(let i of t){let n=i.classify4Group();for(let s in n){let a=e[s];a==null&&(a=new Array,e[s]=a);let l=n[s];a.push(l)}}let r={};for(let i in e){let n=e[i];if(n.length==t.length){let s=new o(new Map);for(let[a,l]of this.netMaps)s.netMaps.set(a,l);xe.addAll(s.reuseMap,n),r[i]=s}}return r}classify4Group(){let t=Op(a=>a.templateInfo.groupId,this.reuseMap),e={};for(let[a,l]of t){let c=this.classify4GroupId(l);e[a]=c}let r=Object.keys(e);if(r.length==0)return[];let i=1,n=r.length,s=Object.values(e[r[0]]);for(;i<n;i++){let a=r[i],l=e[a];s=this.getFullPermutation(s,l)}return s}getFullPermutation(t,e){let r=new Array;for(let i of t)for(let n in e){let s=e[n],a=new o(new Map(this.netMaps));xe.addAll(a.reuseMap,i.reuseMap),xe.addAll(a.reuseMap,s.reuseMap),r.push(a)}return r}hasMatchChannelID(){for(let t of this.reuseMap)for(let e of t.matchList)if(e.channelId==t.templateInfo.channelId)return!0;return!1}classify4Channel(){let t=new Array;for(let e of this.reuseMap){let r=e.classify4Channel();r.matchList.length>0&&t.push(r)}if(t.length==this.reuseMap.length){let e=new o(new Map);for(let[r,i]of this.netMaps)e.netMaps.set(r,i);return xe.addAll(e.reuseMap,t),e}return null}matchGroup(t){return this.matchNetMap(t.netMaps)?this.mergeGroup(t):null}mergeGroup(t){let e=new o(new Map);for(let[r,i]of t.netMaps)e.netMaps.set(r,i);for(let[r,i]of this.netMaps)e.netMaps.set(r,i);return xe.addAll(e.reuseMap,t.reuseMap),xe.addAll(e.reuseMap,this.reuseMap),e}matchNetMap(t){let e=new Set;for(let[r,i]of this.netMaps){e.add(i);let n=t.get(r);if(n!==void 0&&n!==i)return!1}for(let[r,i]of t)if(e.has(i)&&this.netMaps.get(r)!==i)return!1;return!0}};var ude=class{constructor(){this.result=new Array}};var dOe=class{generateGroup(t){let e=this.classify4Infos(t.matchList),r=new Set,i=new Array,n=new Map;for(let a of t.matchList){if(r.has(a))continue;let l=t.templateInfo.getNetMatchList(a),c=new CT(t.templateInfo);if(Object.keys(Object.fromEntries(l)).length==0)for(let u of t.matchList)c.matchList.push(u),r.add(u);else{let u=this.getSameNetMapList(l,t.templateInfo,e);for(let d of u)c.matchList.push(d),r.add(d)}let h=new mE(l);for(let[u,d]of l){let p=n.get(u);p==null&&(p=new Set,n.set(u,p)),p.add(d)}h.reuseMap.push(c),i.push(h)}let s=0;for(let[,a]of n)s+=a.size;return{groups:i,allNetMaps:n,cnt:s}}generateGroup1(t){let e=this.classify4Infos(t.matchList),r=new Set,i=new Array,n=new Map;for(let s of t.matchList){if(r.has(s))continue;let a=t.templateInfo.getNetMatchList(s),l=new CT(t.templateInfo);if(Object.keys(a).length==0)for(let h of t.matchList)l.matchList.push(h),r.add(h);else{let h=this.getSameNetMapList(a,t.templateInfo,e);for(let u of h)l.matchList.push(u),r.add(u)}let c=new mE(a);for(let h in a){let u=a[h],d=n.get(h);d==null&&(d=new Set,n.set(h,d)),d.add(u)}c.reuseMap.push(l),i.push(c)}return i}getSameNetMapList(t,e,r){let i=new Set,n=!0;for(let[s,a]of t){let l=e.netMapNums[s],c=r[a];if(n)for(let h of c){let u=h.netMapNums[a];e.matchNums(l,u)&&i.add(h)}else{let h=new Set;for(let u of c)if(i.has(u)){let d=u.netMapNums[a];e.matchNums(l,d)&&h.add(u)}i=h}n=!1}return i}classify4Infos(t){let e={};for(let r of t)for(let i in r.netMapNums){let n=e[i];n==null&&(n=new Array,e[i]=n),n.push(r)}return e}},dde=class{constructor(){this.debugInfo=new Array}classify4Infos(t){let e={};for(let r of t)for(let i in r.netMapNums){let n=e[i];n==null&&(n=new Set,e[i]=n),n.add(r)}return e}generateGroupMap(t,e){let r=[];for(let m of t)r.push(new CT(new uC(m)));this.filter4UUID(r,e);for(let m of r)if(m.matchList.length==0)return this.debugInfo.push(`template component ID for ${m.templateInfo.component.globalIndex} has not match reuse component`),[];let i=this.getReuseGroups(r);if(i.length==0)return this.debugInfo.push("reuse not match template"),[];for(let m of i)if(m.groups.length==0)return this.debugInfo.push("Multiplexed element nets do not exactly match template nets "),[];let n=this.netFlush(i,"allMatch");n.sort((m,g)=>m.length-g.length);let s=this.getNetMapGroups(n),a=new Array,l=this.allHasMatchChannalID(n),c=new Set,h=new Array,u=n[0],d=0;for(let m=0;m<u.length;m++)if(u[m].netMaps.get("")===""){if(d===m)continue;{let g=u[d];u[d]=u[m],u[m]=g,d++}}else continue;let p=u.shift();for(;p!=null;){let m=!0;for(let y of p.reuseMap)for(let b of y.matchList)if(!c.has(b.component)){m=!1;break}if(m){p.reuseMap[0].allUse=!0,p=u.shift();continue}a.push(p);let g=this.DFS(p,n,1,a,l,s);if(g!=null){let y=this.groupByGroupId([[g]]),b=this.groupByChannelId(y,l);for(let T of b)for(let I of T)for(let C of I.result)this.generateUniqueMap(C,c,h);let P=!0;for(let T of g.reuseMap){let I=new Array,C=T.matchList.length;for(;T.matchList.length>0;){let E=T.matchList.shift();c.has(E.component)||I.push(E)}xe.addAll(T.matchList,I),I.length!=C&&(P=!1),I.length==0&&(T.allUse=!0)}P&&(p=u.shift())}else p=u.shift();a.pop()}return h}generateNotAllMatchGroupMap(t,e,r){let i=[];for(let d of t)i.push(new CT(new uC(d)));let n=this.getTemplateInfo(i),s=!0;this.filter4UUID2(i,e,r);for(let d of i)if(d.matchList.length>0){s=!1;break}if(s)return this.progressUpdate(r,1),{templateInfos:n,allReuseIDList:[],idMapMatchListObj:{},allNotMatch:s,allReuseGroupNetMaps:null};let a=new Set,l=new Map,{res:c,allResult:h}=this.getMatchResult(i);if(c){let d=this.allHasMatchChannalID(h);for(let p of e)a.add(p.globalIndex);this.FillTemplateInfo(c,n,l,a,r,d),this.handleOtherGroups(c,h,l,n,a)}else s=!0;if(this.progressUpdate(r,1),s)return{templateInfos:n,allReuseIDList:[],idMapMatchListObj:{},allNotMatch:s,allReuseGroupNetMaps:null};let u=new Map;for(let[d,p]of l)u.set(d,Array.from(p));return n=this.changeOrder(n),{templateInfos:n,allReuseIDList:Array.from(a),idMapMatchListObj:Object.fromEntries(u),allNotMatch:!1,allReuseGroupNetMaps:c.netMaps}}getMatchResult(t){let e=null,r=this.getReuseGroups(t),i=this.getReuseGroups(t),n=[],s=[];r=r.filter(d=>d.groups.length>0),this.getSameNetMap(r,n,s);let a=[];for(let d of r)a.push(d.groups);let l=[],c=[],h;if(n.length>0){let d=n.flat(1),p=d[0];for(let m=1;m<d.length;m++)p=p.matchGroup(d[m]);h=this.handleSpecialData(p,s,c),h==null&&(h=this.findMaxGroups([p],s,c,0))}this.netFlush(i,"notAllMatch");let u=[];for(let d of i)d.groups.length!==0&&u.push(d.groups);if(u.length===0)return{res:null};if(u.sort((d,p)=>p.length-d.length),e=this.findMaxGroups(u[0],u,l),h&&h.reuseMap.length>=e.reuseMap.length){if(e=h,c.length>0){let d=this.findMaxGroups(c[0],c,[]);e=this.mergeIntoGroup(e,d,s)}}else if(l.length>0){let d=this.findMaxGroups(l[0],l,[]);e=this.mergeIntoGroup(e,d,u),a=u}return{res:e,allResult:a}}handleSpecialData(t,e,r){e.sort((c,h)=>c.length-h.length);let i=[],n=[];for(let c of e)c.length==1?i.push(c):n.push(c);if(i.length===0||i.length<e.length/2)return null;let s=-1,a;for(let c=0;c<i.length;c++){let h=i.shift(),u=this.findMaxGroups(h,i,[],0);u.reuseMap.length>s&&(s=u.reuseMap.length,a=u),i.push(h)}let l=[t.matchGroup(a)];return l[0]==null?null:this.findMaxGroups(l,n,r,0)}changeOrder(t){let e=[],r=[];for(let i of t)i.match.id&&i.match.tag?e.push(i):r.push(i);return e.concat(r)}getReuseGroups(t){let e=[];for(let r of t){let i=new dOe().generateGroup(r);e.push(i)}return e}handleOtherGroups(t,e,r,i,n){let s=new Set;for(let l of t.reuseMap)s.add(l.templateInfo.id);let a=[];for(let l of e){if(l.length===0)continue;let c=l[0].reuseMap[0].templateInfo.id;s.has(c)||a.push(l)}if(a.length>0)for(let l of a)for(let c of l){let h=c.reuseMap[0].templateInfo.id,u=r.get(h);u==null&&(u=new Set,r.set(h,u));for(let d of i)if(d.id===h)for(let p of c.reuseMap[0].matchList){if(u.add(p.id),!n.has(p.id))continue;let m={id:"",tag:"",channelId:""};m.id=p.id,m.tag=p.component.attrsMap.Designator,m.channelId=p.channelId,d.matchList.push(m)}}}mergeIntoGroup(t,e,r){let i=new Map;for(let[s,a]of e.netMaps){let l=t.netMaps.get(s);if(l!=null&&a!==l)i.set(s,l);else for(let[c,h]of t.netMaps)c!==s&&a===h&&i.set(c,h)}let n=[];for(let s of r)for(let a of s){let l=!1;for(let[c,h]of a.netMaps)if(i.has(c)&&i.get(c)===h){n.push([a]),l=!0;break}if(l)break}if(e.reuseMap.length>n.length){for(let[s,a]of i)t.netMaps.delete(s);for(let s=t.reuseMap.length-1;s>=0;s--){let a=t.reuseMap[s],l=Object.keys(a.templateInfo.netMapNums),c=!1;for(let h of l)if(i.has(h)){c=!0;break}c&&t.reuseMap.splice(s,1)}for(let[s,a]of e.netMaps)t.netMaps.set(s,a);for(let s of e.reuseMap)t.reuseMap.push(s)}return t}getSameNetMap(t,e,r){for(let i=0;i<t.length;i++){let n=t[i],s=!1;for(let a of n.groups){let l=!0;for(let[c,h]of a.netMaps)if(c!==h){l=!1;break}if(l){s=!0,e.push([a]);break}}s||r.push(n.groups)}}findMaxGroups(t,e,r,i){let n=!1,s=-1,a=null,l=null,c=[];for(let h of t){a=h;let u=i==null?1:i;for(;u!==e.length;){let d=e[u],p=!1;for(let m of d){let g=a.matchGroup(m);if(g!=null){a=g,p=!0;break}}p||c.push(d),u++}if(a.reuseMap.length===e.length){n=!0;break}else if(a.reuseMap.length>s){l=a,s=a.reuseMap.length,r.length=0;for(let d of c)r.push(d)}c.length=0,a=null}return n||(a=l),a}netFlush(t,e){let r=!0,i=0,n=new Array;for(t.sort((s,a)=>s.cnt-a.cnt);i<10&&r;){r=!1;let s=t.reduce((l,c)=>l+c.cnt,0);this.filterNetMaps(t,e);let a=t.reduce((l,c)=>l+c.cnt,0);r=s!=a,i++}for(let s of t)n.push(s.groups);return n}progressUpdate(t,e){t!=null&&t({title:"reuseLayoutRoute",value:e})}FillTemplateInfo(t,e,r,i,n,s){let a=0;for(let l of t.reuseMap){let c=l.templateInfo.id;for(let h of e)if(h.id==c){let u=r.get(c);u==null&&(u=new Set,r.set(c,u));let d=!0;if(s){for(let p of l.matchList){if(u.add(p.id),!i.has(p.id))continue;let m={id:p.id,tag:p.component.attrsMap.Designator,channelId:p.channelId,uuid:p.uuid};h.match.id===""&&p.channelId===h.channelId?(h.match=m,i.delete(h.match.id)):h.matchList.push(m)}if(h.match.id===""&&h.matchList.length){let p=h.matchList.shift();h.match=p,i.delete(p.id)}}else this.matchFirst(l,i,u,d,h)}n&&n({title:"reuseLayoutRoute",value:a/t.reuseMap.length*.1+.7}),a++}for(let l of e)for(let c=l.matchList.length-1;c>=0;c--){let h=l.matchList[c];i.has(h.id)||l.matchList.splice(c,1)}}matchFirst(t,e,r,i,n){for(let s of t.matchList){if(!e.has(s.id))continue;let a={id:"",tag:"",channelId:""};a.id=s.id,a.tag=s.component.attrsMap.Designator,a.channelId=s.channelId,r.add(s.id),i?(n.match=a,i=!1,e.delete(a.id)):n.matchList.push(a)}}getTemplateInfo(t){let e=[];for(let r of t){let i={id:"",tag:"",channelId:"",uuid:"",match:{id:"",tag:"",channelId:""},matchList:[]},n=r.templateInfo.id,s=r.templateInfo.component.attrsMap.Designator,a=r.templateInfo.channelId,l=r.templateInfo.uuid;i.uuid=l,i.id=n,i.tag=s,i.channelId=a,e.push(i)}return e}filterNetMaps(t,e){for(let r=0;r<t.length;r++){let i=t[r],n=new Map;for(let[s,a]of i.allNetMaps)n.set(s,a);for(let s=r+1;s<t.length;s++){let a=t[s];for(let[l,c]of n){let h=a.allNetMaps.get(l);if(h!=null&&h.size>0){let u=new Set;for(let d of c)h.has(d)&&u.add(d);if(u.size===0)for(let d of c)u.add(d);if(e==="notAllMatch"&&i.groups.length<=1){this.deleteNets(h,u),this.delete4Nets(a.groups,l,u);continue}this.deleteNets(h,u),this.deleteNets(c,u),this.delete4Nets(i.groups,l,u),this.delete4Nets(a.groups,l,u)}}}}this.updateNetMap(t)}updateNetMap(t){for(let e of t){let r=new Map;for(let n of e.groups){let s=n.netMaps;for(let[a,l]of s){let c=r.get(a);c==null&&(c=new Set,r.set(a,c)),c.add(l)}}e.allNetMaps=r;let i=0;for(let[,n]of r)i+=n.size;e.cnt=i}}getNetMapGroups(t){let e=new Map;for(let r=0;r<t.length;r++){let i=t[r];for(let n of i)for(let[s,a]of n.netMaps){let l=e.get(s);l==null&&(l=new Map,e.set(s,l));let c=l.get(a);c==null&&(c=new Map,l.set(a,c));let h=c.get(r);h==null&&(h=new Set,c.set(r,h)),h.add(n)}}return e}deleteNets(t,e){for(let r of t)e.has(r)||t.delete(r)}delete4Nets(t,e,r){let i=Array.from(t);t.length=0;for(let n=0;n<i.length;n++){let s=i[n];s.netMaps.get(e)!=null?r.has(s.netMaps.get(e))&&t.push(s):t.push(s)}}allHasMatchChannalID(t){for(let e of t){if(e.length==0)continue;let r=!1;for(let i of e){let n=!1;for(let s of i.reuseMap){let a=!1;s.sortMatchList();for(let l of s.matchList)if(l.channelId==s.templateInfo.channelId){a=!0;break}if(a){n=!0;break}}if(n){r=!0;break}}if(!r)return!1}for(let e of t)Er(e,(r,i)=>{let n=r.hasMatchChannelID(),s=i.hasMatchChannelID();return n&&s||n?-1:s?1:0},0,e.length);return!0}DFS(t,e,r,i,n,s){if(e.length==1)return t;let l=this.getRangeMaps(t,s).get(r)||e[r];for(let c of l){if(c.reuseMap[0].allUse)continue;let h=t.matchGroup(c);if(h!=null){i.push(c);let u=r+1;if(u<e.length){let d=this.DFS(h,e,u,i,n,s);if(d!=null)return d;i.pop()}else{if(!(h.classify4Group().length>0&&n)||h.classify4Channel()!=null)return i.length=0,h;i.pop()}}}return null}getRangeMaps(t,e){let r=new Map,i=new Set,n=new Map;for(let[s,a]of t.netMaps)n.set(s,a);for(let[s,a]of n){let l=e.get(s);if(i.add(s),l.size==1)continue;let c=l.get(a);for(let[h,u]of c){let d=r.get(h);d==null&&(d=new Set,r.set(h,d));for(let p of u)for(let[m,g]of p.netMaps)n.get(m)==null&&t.matchNetMap(new Map().set(m,g))&&n.set(m,g);xe.addAllSet(d,u)}}return r}getFullPermutation(t,e){let r=new Array;for(let i of t){let n=new Array;for(let s of i)for(let a of e){let l=s.matchGroup(a);l!=null&&n.push(l)}n.length>0&&r.push(n)}return r}filterConnects(t,e,r){let i=this.classify4Infos(e),n=this.classify4Infos(r);for(let s of t){for(let a=s.matchList.length-1;a>=0;a--){let l=s.templateInfo.getNetMatchList(s.matchList[a]);for(let[c,h]of l){let u=i[c],d=n[h];if(u.size>d.size){let p=`map(${s.templateInfo.uuid}),id(${s.templateInfo.id}):templateNet(${c}) map reuseNet(${h}),templateConnect size(${u.size}) is greater reuseNet size(${d.size})`;this.debugInfo.push(p),s.matchList.splice(a,1);break}}}if(s.matchList.length==0){let a=`map(${s.templateInfo.uuid}),id(${s.templateInfo.id}):has not match list`;this.debugInfo.push(a);return}}}filter4UUID(t,e){let r=Op(l=>l.templateInfo.uuid,t),i=Op(l=>{let c=Ji.getInstance().getItem(l.footprintUUID);return c instanceof Sc?c.source:l.footprintUUID},e),n=new Set,s=new Set,a=new Set;for(let[l,c]of i){let h=r.get(l);if(h!=null){if(c.length<h.length){this.debugInfo.push(`the number of footprint UUID:${l} reuses(${c.length}) is less than the number of template(${h.length})`);return}let u=new Set,d=new Set;for(let p of c){let m=new uC(p);for(let g of h)g.templateInfo.isMatch(m,this.debugInfo)&&(g.matchList.push(m),d.add(m),a.add(p)),u.add(g.templateInfo)}this.filterConnects(h,u,d),xe.addAllSet(n,u);for(let p of h)xe.addAllSet(s,p.matchList);this.filterConnects(h,n,s)}}for(let l of e)if(!a.has(l))for(let c in r){let h=l.footprintUUID;if(c!==h){let u=r[c];if(this.isSameFootprint(u[0],l)){let p=new uC(l),m=new Set,g=new Set;for(let y of u)y.templateInfo.isMatch(p,this.debugInfo)&&(y.matchList.push(p),g.add(p)),m.add(y.templateInfo);this.filterConnects(u,m,g),xe.addAllSet(n,m);for(let y of u)xe.addAllSet(s,y.matchList);this.filterConnects(u,n,s);for(let y of t)if(y.matchList.length==0)return}}}}filter4UUID2(t,e,r){let i=Op(a=>a.templateInfo.uuid,t),n=Op(a=>{let l=Ji.getInstance().getItem(a.footprintUUID);return l instanceof Sc?l.source:a.footprintUUID},e),s=0;for(let[a,l]of n){let c=i.get(a);if(c!=null)for(let h of l){let u=new uC(h);this.templateMatchReuseInfo(c,u)}}for(let a of e){for(let[l,c]of i){let h=a.footprintUUID;if(l!==h&&this.isSameFootprint(c[0],a)){let d=new uC(a);this.templateMatchReuseInfo(c,d)}}s++,this.progressUpdate(r,s/e.length*.2)}}templateMatchReuseInfo(t,e){for(let r of t)r.templateInfo.isMatch(e,this.debugInfo)&&r.matchList.push(e)}isSameFootprint(t,e){let r=e.attrsMap.Footprint,i=t.templateInfo.component.attrsMap.Footprint;if(r===i){let n=e.getPads(),s=t.templateInfo.component.getPads();if(n.length===s.length){let a=n.map(c=>c.num),l=new Set(a);if(s.forEach(c=>{l.has(c.num)&&l.delete(c.num)}),l.size===0)return!0}}return!1}groupByGroupId(t){let e=new Array;for(let r of t){let i=new Array;for(let n of r){let s=n.classify4Group();if(s.length>0){let a=new ude;xe.addAll(a.result,s),i.push(a)}}i.length>0&&e.push(i)}return e.length==0&&this.debugInfo.push("classify group ID fail,please check groupID!!"),e}groupByChannelId(t,e){let r=new Array;for(let i of t){let n=new Array;for(let s of i){let a=new ude;for(let l of s.result){if(!e){a.result.push(l);continue}let c=l.classify4Channel();c!=null&&a.result.push(c)}a.result.length>0&&n.push(a)}n.length>0&&r.push(n)}return r.length==0&&this.debugInfo.push("classify channel ID fail,please check channel ID!!"),r}generateUniqueMap(t,e,r){let i=!1;for(let n of t.reuseMap){let s=!0;for(let a of n.matchList)if(!e.has(a.component)){s=!1;break}if(s){i=!0;break}}if(!i){let n=new Array;for(let a of t.reuseMap){let l=new Array;for(let c of a.matchList)if(!e.has(c.component)){let h=new CT(a.templateInfo);h.matchList.push(c),l.push(h)}n.push(l)}let s=0;for(;;){let a=new Array,l=new Set;for(let c of n){let h=c[s];if(h!=null&&(l.has(h.matchList[0].component)||e.has(h.matchList[0].component))){let u=s+1,d=c.length;for(;u<d&&(h=c[u],!!(l.has(h.matchList[0].component)||e.has(h.matchList[0].component)));u++);h!=null&&(l.has(h.matchList[0].component)||e.has(h.matchList[0].component))&&(h=null)}if(h!=null)a.push(h),l.add(h.matchList[0].component);else break}if(a.length==n.length){let c=new mE(new Map);for(let[h,u]of t.netMaps)c.netMaps.set(h,u);for(let h of a)c.reuseMap.push(h),e.add(h.matchList[0].component);r.push(c),s++}else break}}}};function zje(o){let t=new qt;return t.add("COLUMNS_INPUT",!0),t.add("CANCEL"),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t.result}var Nxt="Please select a group",UD=class extends ni{constructor(e){super();this._reuseComponent=new Array;this._reusing=!1;this._isDialogOpen=!1;this._highlightItems=new Array;this.result=new Array;this.coppers=new Array;this.lastX=0;this.lastY=0;this.layoutColumns=2;this.map=new Map;this.bbox=null;this.templates=new Array;xe.addAll(this._reuseComponent,e),this.drawing=!0,this.commandFactory=new hi,this.start()}getColumns(){return this.layoutColumns}setColumns(e){this.layoutColumns=e,this.result.length>0&&this.bbox!=null&&this.typesetting(this.bbox)}onKeyDown(e){switch(tr.getAction(5,e)){case"Cancel":this.cancel();break;case"Rotate Left":this.rotate(e);break;case"Show Attribute Dialog When Placing Object":A.publish("openMainDialog",{cmd:44,data:{tool:this}});break}A.publish("updateFrame","")}onMouseMove(e){if(this.unhighlightItems(),this._reusing)Ut.cancel(),this.translate(e.sceneX-this.lastX,e.sceneY-this.lastY);else if(this._isDialogOpen)Ut.cancel();else{Ut.update(e,Nxt);let r=Vr.pointSelectBeforeFilter(e.realSceneX,e.realSceneY).getResult(Df),i=jt.filterCombination(r),n=!1;for(let s of i)if(s instanceof ke){n=!0;break}n&&(xe.addAll(this._highlightItems,i),this.highlightItems())}this.lastX=e.sceneX,this.lastY=e.sceneY}highlightItems(){for(let e of this._highlightItems)e.click();A.publish("updateFrame","")}unhighlightItems(){let e=this._highlightItems.length>0;for(let r of this._highlightItems)r.updateFilterVisible=!0,r.visible();this._highlightItems.length=0,e&&A.publish("updateFrame","")}onMouseLeftUp(e){if(!this._isDialogOpen)if(this._reusing){for(let n of this.result)n.complete();this.addOtherItemCommand(),this.commandFactory.execute();let r="{value} group reuse completed",i={value:this.result.length};this.sendMessage(r,i),this.coppers.length>0&&A.publish("rebuildSingleCopper",{ids:this.coppers,isLast:!0}),A.publish("autoFill",""),A.publish("tool","dropdrag")}else{let r=Vr.pointSelectBeforeFilter(e.realSceneX,e.realSceneY).getResult(Df),i=jt.filterCombination(r),n=new Array,s=new Array,a=new _e,l=new S(e.sceneX,e.sceneY);for(let c of i)c instanceof ke?n.push(c):s.push(c),a.ext1(c.buildBBox());if(n.length>0){Ut.cancel();let c=this.filterResult(this._reuseComponent);if(c.length===0){A.publish("tool","dropdrag");return}let h=this.getComponentModel(n),u=this.getComponentModel(c);if(n.length<500){let d=new dde,p=d.generateGroupMap(h,u);if(p.length==0){let{idMapTemplateMaps:m,idMapNetInfos:g}=this.idMapTemplateInfo(h,u),{templateInfos:y,allReuseIDList:b,allNotMatch:P,idMapMatchListObj:T,allReuseGroupNetMaps:I}=d.generateNotAllMatchGroupMap(h,u),C={templateInfos:y,allReuseIDList:b,allNotMatch:P,idMapMatchListObj:T};this.handleNotallMatchData(C,I,m,g,l,a,s)}else this.hasLock(p,l,a,s)}else{let d=new jI().encode(),p=tm.getInstance().addWorker(`editor?entry=pcb-decode-worker.js${Q().location.search.replace(/\?/,"&")}`),m=this.getComponentID(n),g=this.getComponentID(c),{idMapTemplateMaps:y,idMapNetInfos:b}=this.idMapTemplateInfo(h,u);p.rpcCall("pcb/worker/reuseLayoutRoute",{world:d,templateIDs:m,reuseIDs:g}).then(P=>{let{workerName:T,data:I,type:C}=P.message;if(C=="allMatch"){let E=I,O=[];for(let _ of E){let x=new mE(new Map);for(let[v,D]of _.netMaps)x.netMaps.set(v,D);for(let v of _.reuseMaps){let D=y.get(v.templateID),w=new CT(D.templateInfo);w.matchList.push(b.get(v.reuseID)),x.reuseMap.push(w)}O.push(x)}this.hasLock(O,l,a,s)}else{let{templateData:E,allReuseGroupNetMaps:O}=I;this.handleNotallMatchData(E,O,y,b,l,a,s)}tm.getInstance().deleteWorker(T)}).catch(P=>{throw P})}}}}sendLockedMessage(e,r,i,n,s){let a=new e0("Locked components found, whether to reuse the locked components together?",()=>{this.reuse(e,r,i,n,s)});A.publish("openMsgbox",a)}idMapTemplateInfo(e,r){let i=e.map(l=>new CT(new uC(l))),n=r.map(l=>new uC(l)),s=new Map;for(let l of i)s.set(l.templateInfo.id,l);let a=new Map;for(let l of n)a.set(l.id,l);return{idMapTemplateMaps:s,idMapNetInfos:a}}handleNotallMatchData(e,r,i,n,s,a,l){let c;if(this.otherInfo={position:s,fac:a,others:l},e.allNotMatch)c=null;else{c=new mE(new Map);for(let[u,d]of r)c.netMaps.set(u,d);for(let u in e.idMapMatchListObj){let d=e.idMapMatchListObj[u],p=i.get(u),m=new CT(p.templateInfo);for(let g of d)m.matchList.push(n.get(g));c.reuseMap.push(m)}}if(this.isAllMatch(e.templateInfos)){let u=[],d=new mE(new Map(r));for(let p of e.templateInfos)for(let m of c.reuseMap)if(p.id===m.templateInfo.id){let g=new CT(m.templateInfo);for(let y of m.matchList)if(y.id===p.match.id){g.matchList.push(y);break}d.reuseMap.push(g)}u.push(d),this.hasLock(u,this.otherInfo.position,this.otherInfo.fac,this.otherInfo.others,e.templateInfos[0].id)}else A.publish("openMainDialog",{cmd:45,data:{info:{type:"reuse_layout_route",templateData:e},tool:this,allReuseGroupInfo:c}})}isAllMatch(e){for(let r of e)if(r.match.id==="")return!1;return!0}getComponentModel(e){let r=[];for(let i of e)r.push(i.model);return r}getComponentID(e){let r=[];for(let i of e)r.push(i.model.globalIndex);return r}reuse(e,r,i,n,s){this._reusing=!0,this.commandFactory.createGroup("Reuse layout route");let a=r.build1(),l=e;this.lastX=e.x,this.lastY=e.y;let c=aC.extractCopyInfo(n,l);if(i.length>0)for(let h of i){let u=this.sycnTemplate(h,c),d=new Ad(u);d.recordStyle(),this.result.push(d)}else if(i.length==0){let h=new Array,u="";u=Ar.getItem(s).getGroupID();let{group:d}=Fl.reuseRepeat(c);for(let P of d)P.visible(),P instanceof He&&P.type=="Copper Region"&&this.coppers.push(P.globalIndex),h.push(P);let p=new Ad(h);p.recordStyle(),this.result.push(p);let m=new T0,g=Ht.getAllItem().map(P=>P.name);for(let P of g)m.add(P);let y=Ht.getItem(u).name,b=Ht.combination(h,m.getUniqueName(y));this.commandFactory.addCommand4Item(b,"add")}this.bbox=a,this.typesetting(a)}hasLock(e,r,i,n,s){let a=!1;for(let l of e)for(let c of l.reuseMap)for(let h of c.matchList)if(h.component.locked){a=!0;break}a?this.sendLockedMessage(r,i,e,n):this.reuse(r,i,e,n,s)}filterResult(e){let r=new Array;for(let i of e)if(i.getGroupID()!=null){let n=i.getGroupID(),s=Ht.getItem(n),a="The selected object {objectID} already exists in group {groupName}, cannot be reused",l=R.getInstance().tabId,c={objectID:`${Tr}${i.number}`,object:{attr:{id:i.globalIndex,pcbid:l},text:i.name},group:{attr:{id:n,pcbid:l},text:`${s.name} (${n})`},groupName:s.name,groupID:n},h={type:"warn",msg:['<span class="i18n">The selected object</span> ',c.object,' <span class="i18n">already exists in group</span> ',c.group,' <span class="i18n">cannot be reused</span>']};this.sendMessage(a,c,"warn",h)}else r.push(i);return r}translate(e,r){let i=Ae.translate(e,r,0);for(let n of this.result)n.transform(i)}typesetting(e){let r=e.width()+10,i=e.height()+10,n=this.result.length;for(let s=0;s<n;s++){let a=this.result[s],l=s%this.layoutColumns*r,c=-Math.floor(s/this.layoutColumns)*i,h=this.map.get(a);h==null&&(h=S.ORIGIN),h=h.mul(-1).add1(l,c);let u=Ae.translate(h.x,h.y,0);this.map.set(a,new S(l,c)),a.transform(u)}}sycnTemplate(e,r){let i=new Array,n="",s={};for(let d of e.reuseMap){let p=d.templateInfo.component,m=Ar.getItem(p.globalIndex),g=d.matchList[0].component,y=Ar.getItem(g.globalIndex);n=m.getGroupID(),d.getIdMaps(0,s),this.commandFactory.addCommand4Item(y,"modify"),y.layerId=m.layerId,y.position=m.position,y.rotation=m.rotation;for(let b in m.attrKeyText){let P=m.attrKeyText[b],T=y.attrKeyText[b];T!=null&&(T.layerId=P.layerId,T.position=P.position,T.rotation=P.rotation,T.fontSize=P.fontSize,T.strokeWidth=P.strokeWidth,T.reverse=P.reverse,T.reverseExpansion=P.reverseExpansion,T.origin=P.origin,T.mirror=P.mirror,T.positionIsNull=P.positionIsNull,T.fontFamily=P.fontFamily,ep.addText(T))}i.push(y)}let{group:a}=Fl.reuseRepeat(r,s);for(let d of a){if(d.visible(),d.net!=null&&e.netMaps.get(d.net)!=null&&(d.net=e.netMaps.get(d.net)),d instanceof He&&d.type=="Copper Region"&&this.coppers.push(d.globalIndex),d.model instanceof or&&d.model.component instanceof Zi){let m=d.model.component.networkList,g=[];for(let y=0;y<m.length;y++){let b=e.netMaps.get(m[y]);b!=null?m[y]=b:Ye.getItem(m[y])==null&&g.push(y)}for(let y=g.length-1;y>=0;y--)m.splice(g[y],1)}i.push(d)}let l=new T0,c=Ht.getAllItem().map(d=>d.name);for(let d of c)l.add(d);let h=Ht.getItem(n).name,u=Ht.combination(i,l.getUniqueName(h));return this.commandFactory.addCommand4Item(u,"add"),i}sendMessage(e,r,i="info",n){A.publish("ui/toastMsg",{type:i,msg:{value:e,options:r},bottomBarMsg:n},Q())}interrupt(){this._reuseComponent.length=0,this.addOtherItemCommand(),Ut.cancel(),this.commandFactory.undo(),this.unhighlightItems();for(let e of this.result)e.cancel();this.result.length=0,this.end()}addOtherItemCommand(){if(this._reusing)for(let e of this.result)for(let r of e.group)r instanceof ke||this.commandFactory.addCommand4Item(r,"add")}rotate(e){let r=new S(e.sceneX,e.sceneY);for(let i of this.result)i.rotateFor(r,le.pcbConfig.rotate)}getReuseComponents(){return this._reuseComponent}cancel(){this._isDialogOpen||(this.interrupt(),A.publish("tool","dropdrag"))}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:zje(e.adsorb)};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"COLUMNS_INPUT":A.publish("openMainDialog",{cmd:44,data:{tool:this}});break;case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}};var Zy=class{constructor(t="offset commands",e={}){this.profiles=new Array;this.hasMovedItem=new Set;e={...{saveHistory:!0,rotateWhole:!1,movePadItSelf:!1},...e},this.commandFactory=typeof t=="string"?new hi().createGroup(t):t,this.saveHistory=e.saveHistory,this.rotateWhole=e.rotateWhole,this.movePadItSelf=e.movePadItSelf}reset(){this.hasMovedItem.clear()}execute(t,e,r,i=!1){if(t.length==0)return;let{noGroup:n,groupMap:s}=this.categoryByGroup(t);n.forEach(a=>{let l=Array.isArray(e)?e[a.originIndex]:e,c=Array.isArray(r)?r[a.originIndex]:r;this.transformOne(a.item,l,c,i)}),Object.values(s).forEach(a=>{let l=a.items[0].originIndex,c=Array.isArray(e)?e[l]:e,h=Array.isArray(r)?r[l]:r;this.transformOne(a.ULItem,c,h,a.rotateFromZero)}),this.commandFactory&&this.commandFactory.checkOutlinesNoExecute(this.profiles,new Set),this.saveHistory&&(this.commandFactory&&this.commandFactory.execute(),setTimeout(()=>{A.publish("autoFill",""),A.publish("flushService","")},0))}transformOne(t,e,r,i){let n=this.getGroupItems([t]),s=t.getGroupID()!=null;n.forEach(a=>{if(!this.hasMovedItem.has(a)){if(this.commandFactory&&this.commandFactory.addCommand4Item(a,"modify"),this.rotateWhole){if(r){let l=0;if("rotation"in a&&a.rotation!=null){let h=+a.rotation;typeof h=="number"&&!isNaN(h)&&(l=h)}let c=i?l:0;a.rotateFor(r.center,r.angle-c)}}else if(s)r&&a.rotateFor(Yje(t),i?r.angle:r.angle-t.rotation);else if(r&&"rotation"in a&&a.rotation!=null){let l=0;if("rotation"in a&&a.rotation!=null){let h=+a.rotation;typeof h=="number"&&!isNaN(h)&&(l=h)}let c=i?0:l;a.rotation=r.angle+c}a.transform(Ae.translate(e.x,e.y,0)),this.hasMovedItem.add(a),A.publish("hasModifyPcbItem",a),a instanceof He&&this.profiles.push(a)}})}getParentElements(t,e=!1){let r={},i=new Map;for(let n=0;n<t.length;n++){let s=t[n],a=s.getParent();a instanceof ke&&(s instanceof lr||s instanceof Le&&this.movePadItSelf)?t.includes(a)||i.set(s,n):a?e&&!r[a.globalIndex]?r[a.globalIndex]={item:s,index:n}:r[a.globalIndex]={item:a,index:n}:i.set(s,n)}return Object.values(r).forEach(n=>i.set(n.item,n.index)),i}getGroupItems(t){let e=[],r=new Set;return t.forEach(i=>{let n=i.getGroupID();n?r.add(n):e.push(i)}),r.forEach(i=>{let n=Ht.getItem(i).getItems();e=e.concat(n)}),e}categoryByGroup(t){let e=this.getParentElements(t),r={},i=new Array;for(let[n,s]of e){let a=n.getGroupID();a!=null?(r[a]==null&&(r[a]={items:[],rotateFromZero:!1,ULItem:null}),r[a].items.push({item:n,originIndex:s})):i.push({item:n,originIndex:s})}for(let n in r){let s=r[n];s.rotateFromZero=s.items.length>1,s.ULItem=s.items.length==1?s.items[0].item:this.getULItem(n)}return{groupMap:r,noGroup:i}}getULItem(t){let e=Ht.getItem(t),r=e.getItems();if(r.length==1)return r[0];let i=e.buildBBox().UL(),n={dist2:Number.MAX_SAFE_INTEGER,item:null};for(let s of r){let l=pde(s).UL().distance2(i);l<n.dist2&&(n.dist2=l,n.item=s)}return n.item}};var U2=class extends ni{constructor(){super();this.commands=new De("draw via");this._radius=re.getInstance().getDefaultRadiusPhysics().defalutRadius;this._innerRadius=re.getInstance().getDefaultRadiusPhysics().defalutInner;this.type=0;this.name="";this._via=null;this.nearNode=null;this.followRule=le.pcbConfig.startViaSize=="rule";this.option="OPTIONLEFTUP",Ea.changeTool(this),uu.setTool(this)}set via(e){this.filterItems.clear(),e!=null&&this.filterItems.add(e),this._via=e}get via(){return this._via}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,startPoint:l,keyCode:c}=e;if(a){at.editingWhat=i;return}this.applyValue(e),c===13&&at.destroy()}applyValue(e){let{value:r,startPoint:i,cursorPoint:n}=e,s=new dt,a=new S(n.x-i.x,n.y-i.y).normalize();r=s.conversion(R.getInstance().unit,"mil",r/10),a=new S(a.x*r,a.y*r);let l=new S(a.x+i.x,a.y+i.y);this.via.center=l,this.placeVia(l)}onKeyDown(e){switch(tr.getAction(5,e)){case"Cancel":this.cancel();break;case"Switch Common Via Size While Routing/Placing Via":this.showCommonViaSizeMenu(e);break;case"Show Attribute Dialog When Placing Object":this.via!=null&&A.publish("openMainDialog",{cmd:28,data:{tool:this,item:this.via}});break}A.publish("updateFrame","")}onMouseLeftUp(e){if(!at.editingWhat&&this.via!==null){let r=new S(e.sceneX,e.sceneY);this.via.center=r,this.netsGroupSet=this.getNearNetPcbItems(e),this.handleNets(e)}}showNetsMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=this.getNetsMenuData().result,$t.getInstance().menuData(r,this),this.drawing=!1}getNetsMenuData(){let e=new qt,r="INHERIT_NET:";return this.nets.forEach(i=>{if(i){let n={name:i,cmd:`${r+i}`,tips:"",option:{disabledI18n:!0}};e.addObj(n,!1,!1)}}),e}getNearNetPcbItems(e){let r=new Ay([this.via]);r.updateScene();let{netsGroupSet:i}=r.getNetPcbItems(e);return i}handleNets(e){this.nets=new Set,this.netsGroupSet.forEach(r=>{this.nets=r.nets}),this.nets.size?this.nets.size===1?(this.nets.forEach(r=>{this.via.net=r,ut.setDefaultVia({net:r,holeRadius:null,radius:null})}),this.placeVia(this.via.center)):this.showNetsMenu(e):this.placeVia(this.via.center)}placeVia(e){if(!Mt.checkIsInCanEdit(this.via)){let a="beyond drawing range";Mt.showMassageTip(a,a);return}let r=Wr.addViaByModel(this.via.model.clone(),!0);r.partition=R.getInstance().partitionId,this.nearNode.clear(),A.publish("onlySelect",[r]),A.publish("hasModifyPcbItem",r),A.publish("updateRtree",""),this.wireCommands=new Lr,this.shoveCommands=new Lr,this.shoveData=aE([r],this.wireCommands),Nl.getInstance().init();let i=Zt.getInstance().mode;["WIRING_MODE_SURROUND","WIRING_MODE_OBSTRUCT"].includes(i)?gg("freeArc"):gg("45"),zS(this.shoveData,this.shoveCommands,!0),yg();let n=Ce.dispatch(r,"add");this.commands.addCommand(n);let s=yhe(this.commands);qe.executeCommand(this.commands),A.publish("flushService",""),this.commands=new De("draw via"),this.shoveCommands=new Lr,lE(),r=this.getNewViaAfterShove(s),this.drawing=!0,this.type=this.via.type,this.name=this.via.name,this.nearNode=new D1(r)}getNewViaAfterShove(e){if(!e)return this.via;let r=Object.values(e);for(let i of r){let n=Wr.getItem(i);if(n&&n.center.equals1(this.via.center))return n}return this.via}getViaRadius(){return this.via?{radius:this.via.radius,innerRadius:this.via.holeRadius}:{radius:this.radius,innerRadius:this.innerRadius}}updateViaRadius(){if(le.pcbConfig.startViaSize=="rule"){let e;ut.defaultVia.net!=""&&Ye.getSameNetItems(ut.defaultVia.net).length>0?e=re.getInstance().getRadiusPhysicsByNet(ut.defaultVia.net):e=re.getInstance().getDefaultRadiusPhysics(),this.modifyViaSize(e.defalutInner,e.defalutRadius,void 0,!0)}}onMouseMove(e){let r=new S(e.sceneX,e.sceneY);this.drawing&&(this.via!==null?(this.via.center=r,this.nearNode.generateRatline()):(this.start(),this.via=ut.getDefaultBaseVia(r,this.radius,this.innerRadius),this.via.type=this.type,this.via.name=this.name,this.nearNode=new D1(this.via)))}interrupt(){this.via!==null&&(at.destroy(),this.via.remove(),this.nearNode.clear(),A.publish("delete",this.via),this.drawing=!1,this.via=null,A.publish("updateRtree",""),A.publish("flushSelectingInfo","")),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}flushNear(){this.via!=null&&this.via.net!=this.nearNode.net&&(this.nearNode.clear(),this.nearNode=new D1(this.via),this.nearNode.generateRatline())}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:Kue(this.via,e.adsorb).result};$t.getInstance().menuData(r,this),this.drawing=!1}changeType(e){switch(e){case"VIA_TYPE_RULESSETTING":{let r={activeTab:"Rule",activeMenu:"Blind/Buried Via"};A.publish("openMainDialog",{cmd:5,data:{option:r,tool:this}});break}case"VIA_TYPE_THROUGH_VIA":{this.via!=null&&(this.via.type=0,this.via.name="");break}default:{this.via!=null&&(this.via.type=1,this.via.name=e);break}}ML(this.via)}modifyViaSize(e,r,i,n=!1){let s;if(this.via.name!==""){let l=re.getInstance().getDefaultBlindPhysics().getBlindVia(this.via.name);l.viaSizeRule!==""?s=re.getInstance().getRadiusPhysicsByName(l.viaSizeRule):s=re.getInstance().getRadiusPhysicsByNet(this.via.net)}else s=re.getInstance().getRadiusPhysicsByNet(this.via.net);if(!(R.getInstance().doctype===pi.FOOTPRINT)&&(sf.inValidRadius(s,r)||sf.inValidInnerRadius(s,e))){A.publish("ui/toastMsg",{type:"warn",msg:"The modified value is not within the DRC requirements"},Q());return}i!=null&&(this.followRule=i),r!=null&&(this.via.radius=r,this._radius=r),e!=null&&(this.via.holeRadius=e,this._innerRadius=e),this.type=this.via.type,this.name=this.via.name,ut.setDefaultVia(this.via),n&&wi()}parse(e){this.drawing=!0;let i=e.cmdKey.split(":"),n=new dt;switch(i[0]){case"CANCEL":this.cancel();break;case"VIA_TYPE":this.changeType(i[1]);break;case"VIA_SIZE":if(i[1]==="VIA_SIZE_INPUT")A.publish("openMainDialog",{cmd:28,data:{tool:this,item:this.via}});else if(i[1]=="VIA_SIZE_COMMONLY_SETTING")A.publish("openSystemDialog","PCB_COMM_VIA_SIZE",Q());else if(i[1]=="VIA_SIZE_RULESSETTING"){let a={activeTab:"Rule",activeMenu:"Via Size"};A.publish("openMainDialog",{cmd:5,data:{option:a,tool:this}})}else if(i[1]=="VIA_SIZE_FOLLOWRULES"){let a=le.pcbConfig.startViaSize=="rule"?"last":"rule";le.pcbConfig.startViaSize=a,we.sizeFollowRule=le.pcbConfig.startViaSize=="rule",this.followRule=le.pcbConfig.startViaSize=="rule",le.pcbConfig.startViaSize=="rule"&&this.modifyViaSize(this.innerRadius,this.radius,void 0,!0),A.publish("flushSelectingInfo","")}else{this.followRule=!1;let a=le.viaConfig[i[1]].getSizeAccordingToUnit();this.modifyViaSize(a.innerRadius,a.radius,void 0,!0)}break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"INHERIT_NET":let s=i[1];this.via.net=s,ut.setDefaultVia({net:s,holeRadius:null,radius:null}),this.placeVia(this.via.center),this.drawing=!0;break;case"VIA_SIZE_COMMONLY_SETTING":A.publish("openSystemDialog","PCB_COMM_VIA_SIZE",Q());break}A.publish("updateFrame","")}getBlinds(){return this.via!=null&&re.getInstance().getDefaultBlindPhysics().getAllVias(),null}getBlindViaOptions(){let e=this.getBlinds(),r=new Array,i={name:"Through Via",cmd:"VIA_TYPE_THROUGH_VIA",tips:""};return r.push(i),e!=null&&e.forEach(n=>{let s={name:n.name,cmd:n.name,tips:""};this.via!=null&&this.via.name==n.name&&(s.selectedTag=!0),r.push(s)}),r}get radius(){let e=ut.defaultVia.net;(e==""||Ye.getSameNetItems(e).length==0)&&(e="");let r=re.getInstance().getRadiusPhysicsByNet(e),i=r.defalutRadius,n=r.minRadius,s=r.maxRadius;return this.followRule||ut.defaultVia.radius==null?this._radius=i:ut.defaultVia.radius<n?this._radius=n:ut.defaultVia.radius>s?this._radius=s:this._radius=ut.defaultVia.radius,this._radius}set radius(e){let r=ut.defaultVia.net;(r==""||Ye.getSameNetItems(r).length==0)&&(r="");let i=re.getInstance().getRadiusPhysicsByNet(r);if(e<i.minRadius||e>i.maxRadius){alert("The modified value is not within the DRC requirements");return}this._radius=e}get innerRadius(){let e=ut.defaultVia.net;(e==""||Ye.getSameNetItems(e).length==0)&&(e="");let r=re.getInstance().getRadiusPhysicsByNet(e),i=r.defalutInner,n=r.minInner,s=r.maxInner;return this.followRule||ut.defaultVia.radius==null?this._innerRadius=i:ut.defaultVia.innerRadius<n?this._innerRadius=n:ut.defaultVia.innerRadius>s?this._innerRadius=s:this._innerRadius=ut.defaultVia.innerRadius,this._innerRadius}set innerRadius(e){this._innerRadius=e}showCommonViaSizeMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=QB(this.innerRadius,this.radius).result,$t.getInstance().menuData(r,this),this.drawing=!1}};var VG=class extends ni{constructor(e,r,i,n,s){super();this.commandFactory=new De("push component");this.items=new Set;this.alreadyRotate=!1;this.isMoveInOrder=!1;this.curItem=null;this.util=null;this.pcbPlaceTransfer=null;this.firstMove=!0;this.logger=new Di(4);this.allMoveComponents=null;if(this.start(),this.option="OPTIONLEFTUP",this.isContinuousMode=n,e.items.length==1&&r=="MOVE_BY_CENTER_POINT"){let u=e.items[0],d=u.getParent();if((u instanceof Ue||u instanceof Le)&&d!=null&&d instanceof ke){let p=u.center;e.referX=p.x,e.referY=p.y,r="MOVE_BY_ORIGIN_POINT"}}this.menu=r,this.fac=i,this.itemsSortByDesignator=new Array,this.associationItem=new Ya(e.items);let a=this.associationItem.items;this.associationItem.setUpConnectTrack();let l=this.associationItem.itemConnectTrack,c=new Array;switch(a.forEach(u=>{if(s.includes(u))return;u.click(),this.items.add(u),(e.items.includes(u)||!l.tracks.has(u.globalIndex))&&c.push(u),this.addFilterItem(u),this.fac.addCommand4Item(u,"modify")}),this.tool=new Ad(c),this.tool.recordStyle(),this.associationItem.getAllRepairTracks().forEach(u=>{this.fac.addCommand4Item(u,"modify")}),r){case"MOVE_BY_CENTER_POINT":this.isMoveInOrder=!1,this.moveByCenterPoint();break;case"MOVE_BY_ORIGIN_POINT":case"MOVE_BY_REFERENCE_POINT":this.isMoveInOrder=!1,this.oldX=e.referX,this.oldY=e.referY,this.referX=e.referX,this.refery=e.referY,he.publish("updateLastMousePosition",new S(this.oldX,this.oldY));let u=new S(ba.x-this.oldX,ba.y-this.oldY),d=Ae.translate(u.x,u.y,0);this.alreadyRotate||this.associationItem.moveConnectTrack(d),this.associationItem.setAllAssociationRatlinesVisible(),this.tool.transform(d),this.oldX=ba.x,this.oldY=ba.y;break;case"MOVE_SEQUENTIAL":this.isMoveInOrder=!0,a.forEach(p=>{p instanceof ke&&this.itemsSortByDesignator.push({des:p.name,item:p})}),this.moveInOrder();break}if(zu("move"),this.drawing=!0,this.items.size==1){let u=Array.from(this.items)[0];u instanceof ke&&(this.util=new iC(u))}this.createShoveTool(Array.from(a)),$n.setTool(this),xo.setTool(this),Ea.changeTool(this)}createShoveTool(e){let r=e.filter(i=>i instanceof Ue);if(e.length==1&&r.length==1&&(this.shoveVia=r[0],this.shoveVia&&!this.shoveVia.locked)){let i=new EI(this.shoveVia.model),n=Array.from(i.getConnectTracks()),s=e.filter(a=>a instanceof Ge);(n.length==0||s.length!==n.length)&&(this.shoveTool=new tG(e,this.fac.getCommand()),this.shoveTool.customSyncAssociation(this.associationItem))}}addFilterItem(e){this.filterItems.add(e),e instanceof ke&&e.getItems().forEach(r=>{this.filterItems.add(r)})}moveByCenterPoint(){if(!this.items.size)return;let e=new _e;this.items.forEach(a=>{e.ext1(a.buildBBox())});let i=e.build1().center();this.oldX=i.x,this.oldY=i.y,this.referX=i.x,this.refery=i.y,he.publish("updateLastMousePosition",new S(this.oldX,this.oldY));let n=new S(ba.x-this.oldX,ba.y-this.oldY),s=Ae.translate(n.x,n.y,0);this.alreadyRotate||(this.associationItem.setUpConnectTrack(),this.associationItem.moveConnectTrack(s)),this.associationItem.setAllAssociationRatlinesVisible(),this.tool.transform(s),this.items.forEach(a=>{var l,c;a instanceof lr&&(ze.highlightComponentWhenMoveText.add(a),a.updateHelpLine()),(c=(l=gr.getControl())==null?void 0:l.flushPoint)==null||c.call(l)}),this.oldX=ba.x,this.oldY=ba.y}moveInOrder(){if(this.isMoveInOrder&&this.itemsSortByDesignator.length){this.logger.debug3("%s,%s","\u6392\u5E8F\u524D...",this.itemsSortByDesignator),this.itemsSortByDesignator.sort(this.sortRule),this.logger.debug3("%s,%s","\u6392\u5E8F\u540E...",this.itemsSortByDesignator),this.fac=new hi,this.fac.createGroup("move select for "+this.menu),this.setCurItem();let r=this.curItem.buildBBox().center();this.oldX=r.x,this.oldY=r.y}}setCurItem(){this.itemsSortByDesignator.length?(this.curItem=this.itemsSortByDesignator[0].item,this.associationItem=new Ya([this.curItem]),this.util=new iC(this.curItem),this.fac.addCommand4Item(this.curItem,"modify")):this.curItem=null}sortRule(e,r){var i=/[^a-zA-Z]/g,n=/[^0-9]/g,s=parseInt(e.des,10),a=parseInt(r.des,10);if(isNaN(s)&&isNaN(a)){var l=e.des.replace(i,""),c=r.des.replace(i,"");if(l===c){var h=parseInt(e.des.replace(n,""),10),u=parseInt(r.des.replace(n,""),10);return h===u?0:h>u?1:-1}else return l===""?1:c===""?-1:l>c?1:-1}else return isNaN(s)?1:isNaN(a)?-1:s>a?1:-1}onKeyDown(e){let r=tr.getAction(2,e),i=new S(e.realSceneX,e.realSceneY);switch(r){case"Flip Right and Left":this.items.size&&Array.from(this.items).every(n=>n instanceof ke)?pf.flipComponent("Flip Right and Left",i,Array.from(this.items),this.fac.getCommand()):he.publish("turn","turnAround");break;case"Flip Up and Down":this.items.size&&Array.from(this.items).every(n=>n instanceof ke)?pf.flipComponent("Flip Up and Down",i,Array.from(this.items),this.fac.getCommand()):he.publish("turn","turnAround");break;case"Cancel":this.cancel();break;case"Rotate Left":this.rotate("rotate_left");break;case"rotate_right":this.rotate("rotate_right");break;case"flip2OppositeSide":a_(void 0,Array.from(this.items));break;case"Switch Selected Range When Object Is Selected":{he.publish("openMainDialog",{cmd:48,data:{position:{x:this.referX,y:this.refery},tool:this}});break}}he.publish("updateCross",""),he.publish("updateFrame","")}onMouseMove(e){this.fac&&this.drawing&&(this.isMoveInOrder?this.itemMovingInOrder(e):this.itemsMoving(e),this.firstMove&&(this.items.forEach(r=>{r instanceof lr&&ze.highlightComponentWhenMoveText.add(r)}),this.firstMove=!1))}onMouseLeftUp(e){var r;this.fac&&((r=this.tool)==null||r.complete(),this.isMoveInOrder?this.itemMovedInOrderMouseUp(e):this.itemsMovedMouseUp(e),ze.highlightComponentWhenMoveText.clear(),pf.clear())}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,keyCode:l}=e;if(a){at.editingWhat=i;return}this.applyValue(e),l===13&&at.destroy()}applyValue(e){let r=new dt,{value:i,type:n,startPoint:s,cursorPoint:a}=e,l=new S(a.x-s.x,a.y-s.y).normalize();i=r.conversion(R.getInstance().unit,"mil",i/10),l=new S(l.x*i,l.y*i);let c=new S(l.x+s.x,l.y+s.y),h=new S(c.x-a.x,c.y-a.y),u=Ae.translate(h.x,h.y,0);this.items.forEach(d=>{this.fac.addCommand4Item(d,"modify")}),this.tool.transform(u),this.itemsMovedMouseUp(null)}itemsMoving(e){if(this.placeTransferbeforeMoving(),this.shoveTool)return e.adsorbGrid=!1,this.menu!=="MOVE_BY_REFERENCE_POINT"&&this.firstMove&&(e.lastSceneX=this.shoveVia.center.x,e.lastSceneY=this.shoveVia.center.y),this.shoveTool.onMouseMove(e);this.moveTo(e.sceneX,e.sceneY)}moveTo(e,r){let i=new S(e-this.oldX,r-this.oldY),n=Ae.translate(i.x,i.y,0);if(this.util!=null&&!It.getInstance().currentCoord){let a=new S(e,r),l=this.util.getMatrix(a,a);n=n.multiply4(l)}this.alreadyRotate||(this.associationItem.setUpConnectTrack(),this.associationItem.moveConnectTrack(n)),this.associationItem.setAllAssociationRatlinesVisible(),this.tool.transform(n);let s=gr.getControl();this.tool.isMoveBox()||this.items.forEach(a=>{var l;(l=s==null?void 0:s.flushPoint)==null||l.call(s),a instanceof lr&&a.updateHelpLine()}),this.oldX=e,this.oldY=r,this.moveComponent()}moveToCenterWhenOutOfFrame(){let e=ys(this.items).build(),r=Jx();e.isInside(r)||he.publish("adaptBBox",{bbox:e,needAdaptAll:!1})}placeTransferbeforeMoving(){if(!this.pcbPlaceTransfer)return;let e=this.pcbPlaceTransfer.positionMap||[],r=[],i=10,n=new _e;if(e.forEach(d=>{let p=d.offset,m=nn.convert(p.x,d.unit,i),g=nn.convert(p.y,d.unit,i);r.push({uniqueId:d.uniqueId,x:m,y:g}),n.ext6(m,g)}),!n.valid())return;let s=new BR({sourcePositionMap:r,targets:Array.from(this.items),config:{autoSpace:nn.convert(.5,39.37,i),maxSpace:nn.convert(3,39.37,i),minSpace:0}}).getLayouts(),a=new _e,l=n.build1().center(),h=ba.sub(l);if(s.forEach(d=>{let p=d.component,m=d.position.sub(p.position).add(h);return p.transform(Ae.translate(m.x,m.y,0)),a.ext1(d.bbox.transform(Qe.translate1(h))),!0}),!a.valid())return;let u=a.build1().center();this.oldX=u.x,this.oldY=u.y,this.setPcbPlaceTransfer(null)}itemsMovedMouseUp(e){if(this.shoveTool){this.shoveTool.onMouseLeftUp(e),zu("default"),this.toggle();return}if(this.associationItem.complete(this.fac.getCommand()),le.pcbConfig.moveComponent=="push"){for(let i of this.commandFactory.commands)this.fac.addCommand(i);this.commandFactory=new De("push component")}this.fac.checkOutlines(Array.from(this.items),new Set),this.fac=new hi,this.fac.createGroup("move select for "+this.menu),zu("default");let r=new Array;this.items.forEach(i=>{r.push(i),he.publish("hasModifyPcbItem",i)}),he.publish("select",r),this.toggle(),he.publish("flushService","")}itemMovingInOrder(e){if(this.curItem){let r=new S(e.sceneX-this.oldX,e.sceneY-this.oldY),i=Ae.translate(r.x,r.y,0);if(this.util!=null&&!It.getInstance().currentCoord){let n=new S(e.sceneX,e.sceneY),s=this.util.getMatrix(n,n);i=i.multiply4(s)}this.associationItem.setAllAssociationRatlinesVisible(),this.curItem.transform(i),this.curItem instanceof lr&&this.curItem.updateHelpLine(),this.oldX=e.sceneX,this.oldY=e.sceneY}}itemMovedInOrderMouseUp(e){if(this.curItem)if(this.fac.checkOutlines([this.curItem],new Set),he.publish("hasModifyPcbItem",this.curItem),this.itemsSortByDesignator.length>1){this.itemsSortByDesignator.splice(0,1),he.publish("refreshTearDrop",""),this.fac=new hi,this.fac.createGroup("move select for "+this.menu),this.setCurItem();let i=this.curItem.buildBBox().center();this.oldX=i.x,this.oldY=i.y,he.publish("flushService","")}else{this.itemsSortByDesignator.splice(0,1),this.fac=new hi,this.fac.createGroup("move select for "+this.menu),this.setCurItem(),zu("default");let r=new Array;this.items.forEach(i=>{r.push(i)}),this.isMoveInOrder=!1,this.drawing=!1,he.publish("select",r),this.toggle(),he.publish("flushService","")}}interrupt(){var e,r;if(this.items.size>0){(e=this.tool)==null||e.cancel();let i=()=>{at.destroy(),zu("default"),this.items.clear(),this.drawing=!1};if(this.shoveTool){this.shoveTool.interrupt(),i(),$n.setTool(null);return}this.associationItem.interrupt();let n=new Array;this.items.forEach(s=>{n.push(s)}),this.tool.isMoveBox()||this.fac.undo(),setTimeout(()=>{let s=n.filter(a=>a.isEmpty?!1:(a.click(),!0));he.publish("select",s),he.publish("updateFrame","")},10),i(),this.fac=new hi,this.fac.createGroup("move select for "+this.menu),le.pcbConfig.moveComponent=="push"&&((r=this.commandFactory)==null||r.undo()),(le.pcbConfig.moveComponent=="block"||le.pcbConfig.moveComponent=="push")&&(this.subPosition=null)}$n.setTool(null),this.end()}cancel(){this.interrupt(),this.toggle()}toggle(){this.isContinuousMode&&(this.menu=="MOVE_BY_CENTER_POINT"||this.menu=="MOVE_BY_ORIGIN_POINT"||this.menu=="MOVE_BY_REFERENCE_POINT")?he.publish("toggle",{command:"MouseSelect",cmd:this.menu}):he.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:lde(this.items,e.adsorb).result};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"ROTATE":this.rotate(i[1]);break;case"FLIP":this.flip(i[1]);break;case"TURNOVER":this.flip2OppositeLayer();break;case"toggleAdsorb":he.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":he.publish("openSystemDialog","ADSORPTION",Q());break}he.publish("updateFrame","")}moveItemsToCursor(e,r){let i=this.items;switch(e){case"MOVE_BY_CENTER_POINT":{this.moveByCenterPoint();break}case"MOVE_BY_ORIGIN_POINT":i.forEach(a=>{this.oldX=a.position.x,this.oldY=a.position.y});break;case"MOVE_BY_REFERENCE_POINT":r&&(this.oldX=r.x,this.oldY=r.y);break;case"MOVE_SEQUENTIAL":i=[this.curItem];break}let n=new S(ba.x-this.oldX,ba.y-this.oldY),s=Ae.translate(n.x,n.y,0);this.alreadyRotate||(this.associationItem.setUpConnectTrack(),this.associationItem.moveConnectTrack(s)),this.associationItem.setAllAssociationRatlinesVisible(),this.tool.transform(s),this.oldX=ba.x,this.oldY=ba.y}rotate(e){if(e==="rotate_left"){this.rotateFor(this.oldX,this.oldY,le.pcbConfig.rotate);let r=new S(this.oldX,this.oldY),i=this.curItem?[this.curItem]:this.items;this.curItem?$n.rotate(r,le.pcbConfig.rotate,i):this.tool.rotateFor(r,le.pcbConfig.rotate)}if(e==="rotate_right"){this.rotateFor(this.oldX,this.oldY,-le.pcbConfig.rotate);let r=new S(this.oldX,this.oldY),i=this.curItem?[this.curItem]:this.items;this.curItem?$n.rotate(r,-le.pcbConfig.rotate,i):this.tool.rotateFor(r,-le.pcbConfig.rotate)}if(e==="rotate_reference_point"){this.rotateReferPointCallback=(n,s,a,l)=>{this.rotateReferPointCallback=null},this.rotateFor(this.oldX,this.oldY,le.pcbConfig.rotate);let r=this.curItem?[this.curItem]:this.items,i={x:this.oldX,y:this.oldY,items:this.tool,executeCommand:!1};$n.rotateAssignReferPoint(i,this,null,null,this.rotateReferPointCallback.bind(this))}}flipOppositeLayer(){(this.curItem?[this.curItem]:this.items).forEach(r=>{if(r instanceof ke){let i=new S(this.oldX,this.oldY).sub(r.position);ao(r.layerId)?r.layerId=2:r.layerId=1,r.position=r.position.add(i.add(new S(i.x,-i.y)))}})}flip2OppositeLayer(){!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype||Is.getInstance().init(this.items,"flip to OppositeLayer",(e,r)=>{let i=!1;for(let n of e)n instanceof ke&&(r.addCommand4Item(n,"modify"),ao(n.layerId)?n.layerId=2:n.layerId=1,n.click(),i=!0);i&&r.execute()})}flip(e){var r;switch(xo.setTool(this),(r=this.tool)==null||r.sycn(),e){case"FLIP_LEFTANDRIGHT":xo.turn(this.items,!1,!1,new S(this.oldX,this.oldY));break;case"FLIP_UPANDDOWN":xo.turn(this.items,!0,!1,new S(this.oldX,this.oldY));break;case"FLIP_LEFTANDRIGHT_BY_REFER_POINT":{let i={items:this.items};xo.turnByReferPoint(i,this);break}case"FLIP_UPANDDOWN_BY_REFER_POINT":{let i={items:this.items,isTurnUpsideDown:!0};xo.turnByReferPoint(i,this);break}}}setCenter(e,r){this.oldX=e,this.oldY=r}rotateFor(e,r,i){let n=Ae.translate(-e,-r,0).rotateZ(i).translate1(e,r,0);this.alreadyRotate=!0,this.shoveTool!=null?this.shoveTool.removeConnectTrack():this.associationItem.interrupt(),this.alreadyRotate||(this.associationItem.setUpConnectTrack(),this.associationItem.moveConnectTrack(n))}moveComponent(){if(this.allMoveComponents==null&&(this.allMoveComponents=Array.from(this.items).filter(e=>e instanceof ke)),this.items.size==this.allMoveComponents.length&&this.allMoveComponents.length>0&&le.pcbConfig.moveComponent!=="ignore"){let e=[],r=qy(),i=this.allMoveComponents[0].model.buildBBox(),n=new S(i.minX,i.minY),s=new S(i.maxX,i.maxY);if(this.allMoveComponents.forEach(h=>{if(!this.subPosition){let d=h.position;this.subPosition=new S(this.oldX,this.oldY).sub(d)}e.push(`${Tr}${h.number}`);let u=h.model.buildBBox();n=new S(Math.min(n.x,u.minX),Math.min(n.y,u.minY)),s=new S(Math.max(s.x,u.maxX),Math.max(s.y,u.maxY))}),new Set(e).size!==e.length)return;let a=new S(n.x,s.y),l=new S(s.x,n.y),c=new bs(this.allMoveComponents[0].layerId,n,a,l,s,this.allMoveComponents[0].locked);switch(le.pcbConfig.moveComponent){case"push":this.commandFactory.undo(),this.commandFactory=new De("push component");let h=new Map;iG(c,this.commandFactory,r,h,e,this.allMoveComponents),h.clear();break;case"block":eG(c,r,this.allMoveComponents);break}this.allMoveComponents.forEach(h=>{this.menu=="MOVE_BY_CENTER_POINT"?(this.oldX=h.position.x-this.subPosition.x,this.oldY=h.position.y-this.subPosition.y):(this.oldX=h.position.x+this.subPosition.x,this.oldY=h.position.y+this.subPosition.y)})}}setPcbPlaceTransfer(e){this.pcbPlaceTransfer=e||null}};var pOe=class{constructor(){this.line1=null;this.line2=null;this.line3=null;this.line4=null}getTimer(){return this.timer}setTimer(t){this.timer=t}show(t){let e=le.themeConfig.canvasTheme,r=e.isSolidLine(e.cursorLineStyle),i=e.cursorColor;this.line1=new cr(1002,t.LL(),t.UL(),r,i),this.line2=new cr(1002,t.UL(),t.UR(),r,i),this.line3=new cr(1002,t.UR(),t.LR(),r,i),this.line4=new cr(1002,t.LR(),t.LL(),r,i)}click(){this.line1!=null&&this.line1.click(),this.line2!=null&&this.line2.click(),this.line3!=null&&this.line3.click(),this.line4!=null&&this.line4.click()}visible(){this.line1!=null&&this.line1.visible(),this.line2!=null&&this.line2.visible(),this.line3!=null&&this.line3.visible(),this.line4!=null&&this.line4.visible()}remove(){this.line1!=null&&(this.line1.remove(),this.line1=null),this.line2!=null&&(this.line2.remove(),this.line2=null),this.line3!=null&&(this.line3.remove(),this.line3=null),this.line4!=null&&(this.line4.remove(),this.line4=null)}},HD=new pOe;var fOe=class{constructor(){this.lineArr=[];this.circleArr=[];this.pointArr=[];this.rectArr=[];this.arcArr=[];this.fac=new _e}show(t,e={r:255,g:255,b:255,alpha:.8},r){let i=ee.build(e.r,e.g,e.b,e.alpha);switch(t.type){case"arc":let n=new S(t.startX/10,t.startY/10),s=new S(t.endX/10,t.endY/10),a=t.angle,l=new Yn,{center:c,radius:h,startAngle:u,endAngle:d,sweep:p}=l.pointToAngle(n,s,a),m=new zc(nr(),c,h,u,d,p,{layerId:1002,strokeWidth:r/10,locked:!1}),g=new _t(m),y=new Ep(nr(),"Line",1002,[m],r/10,null,!1,null,null),b=new lt(y,[g]);b.color=i,this.arcArr.push(b),this.fac.ext1(b.buildBBox());break;case"circle":let P=new Ip(nr(),"Line",1002,new S(t.x/10,t.y/10),t.r/10,r/10,!1,null,null,null),T=new Pr(P);T.color=i,this.circleArr.push(T),this.fac.ext1(T.buildBBox());break;case"line":let I=new wc(nr(),new S(t.startX/10,t.startY/10),new S(t.endX/10,t.endY/10),{layerId:1002,strokeWidth:r/10,locked:!1}),C=new mt(I),E=new Ep(nr(),"Line",1002,[I],r/10,null,!1,null,null),O=new lt(E,[C]);O.color=i,this.lineArr.push(O),this.fac.ext1(O.buildBBox());break;case"point":let _=new Ui(1002,new S(t.x/10,t.y/10),!1,i);this.pointArr.push(_);let x=new ht(t.x/10,t.x/10,t.y/10,t.y/10);this.fac.ext1(x);break;case"rectangle":let v=t.top,D=t.bottom,w=t.left,F=t.right,H=(w+F)/2,z=(v+D)/2,V=Math.abs(w-F)/2,W=Math.abs(v-D)/2,L=new Sp(nr(),"Line",1002,new S(H/10-V/10,z/10+W/10),V/5,W/5,0,0,null,r/10,!1,null,null),k=new rr(L);k.color=i,this.rectArr.push(k),this.fac.ext1(k.buildBBox());break;default:break}}remove(){this.arcArr.length>0&&(this.arcArr.forEach(t=>{t.remove()}),this.arcArr=[]),this.circleArr.length>0&&(this.circleArr.forEach(t=>{t.remove()}),this.circleArr=[]),this.lineArr.length>0&&(this.lineArr.forEach(t=>{t.remove()}),this.lineArr=[]),this.pointArr.length>0&&(this.pointArr.forEach(t=>{t.remove()}),this.pointArr=[]),this.rectArr.length>0&&(this.rectArr.forEach(t=>{t.remove()}),this.rectArr=[]),this.fac.clear()}getAllTypesBBox(){return this.lineArr.length===0&&this.circleArr.length===0&&this.pointArr.length===0&&this.rectArr.length===0&&this.arcArr.length===0?null:this.fac.valid()?this.fac.build1():null}},fde=new fOe;function kxt(o,t,e,r=!1){let i=!le.pcbConfig.isRebuildCopperAuto;if(!R.getInstance().isactive||R.getInstance().doctype!=3)return;let n=JSON.parse(t),s=n.workerName;o.deleteWorker(s);let a=n.pours,l=new Jt,c=i?r&&qe.stack?qe.stack:new De("rebuild copper"):null,h=new Array;for(let T in a){let I=a[T];if(!I.needCopper)continue;let C=l.getItem(T);if(!(C instanceof He))continue;let E=C.getComponent();E instanceof xn&&(E.copperResult=I.paths,c&&Ce.dispatchCoppers(C,"delete",c),C.fillCopper(),h.push(C),he.publish("hasModifyPcbItem",C),C.refreshRender())}console.time("generate thermal");let u=new wF(new ef(new X6)),d=Object.keys(a);d.forEach(T=>u.generateThermal(T)),u.removeIsland(d).forEach(T=>{let I=Ti.getItem(T),C=l.getItem(I.getParent().globalIndex);I.remove(),C.deleteCopperById(T),he.publish("delete",I)});let m=u.getResult(),g=qo.getInstance();if(u.complete(),m.forEach(T=>{let I=T.getParent();I.deleteCopper(T.globalIndex),g.delete(T,T.globalIndex);let C=nr();T.globalIndex=C,I.addCopper(C),g.addModel(T),l.getItem(T.getParent().globalIndex).addNewCopperModel(T)}),console.timeEnd("generate thermal"),c)for(let T of h)Ce.dispatchCoppers(T,"add",c);i?!r&&c.length>0&&(c.setCheckFilter(!1),qe.executeCommand(c)):Jle(h),jt.getVisible(21)||he.publish("showPcbSlideMsg",['Copper pour completed! Please set the "Copper Region(Filled)" to visible in the "Right Hand Panel - Filter - Display".'],Q());let b=ze.getItems().filter(T=>!T.isEmpty);he.publish("select",b),e||he.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),he.publish("flushService","");let P=Ti.getAllItem();return e&&(P.length>0&&he.windowBridge.rpcCall("save",{tabId:R.getInstance().tabId},Q()),e=!1),P}function mOe(){he.messageBus.rpcService("adaptAllAndGetBBox",o=>{let t=1,e="";typeof o=="object"?(t=o.ratio||1,e=o.tabId):o>0&&(t=o);let r=R.getInstance();if([23].includes(r.doctype))return;let i=of();if(i!=null){let n=Pi.getBBox();if(n instanceof ht){let s=new _e;s.ext1(i),s.ext1(n),i=s.build1()}this.adaptAll(i,t),he.publish("updateFrame","")}return this.camera.getBBox2()}),he.messageBus.rpcService("pcbZoomToRegion",({minX:o,maxX:t,maxY:e,minY:r})=>{let i=new ht(o,t,r,e);this.adaptAll(i,1)}),he.messageBus.rpcService("pcbZoomTo",({x:o,y:t,scaleRatio:e})=>{let r=new Dt(o,t,0);return this.camera.setTarget(r),this.camera.setScale(e),this.camera.getBBox2()}),he.messageBus.rpcService("getPCBCanvasImg",async()=>{let{width:o,height:t}=this.camera.getCanvas();return{data:(await om.scene.getCaptureImageData1(o,t,()=>{},()=>{})).data,width:o,height:t}}),he.messageBus.rpcService("adaptSelectAndGetBbox",()=>{if(23==R.getInstance().doctype)return;let o=ze.getSelects(),t=new _e;for(let e of o){if(e instanceof ke){let r=e.getAttrBBox();r&&t.ext1(r)}t.ext1(e.buildBBox())}if(t.valid()){let e=t.build1();this.adaptAll(e,.8,Math.pow(10,6))}return he.publish("updateFrame",""),this.camera.getBBox2()}),he.messageBus.rpcService("pcbGenerateIndicatorMarkers",o=>{let{markers:t,color:e,lineWidth:r,zoom:i}=o;if(t.forEach(n=>{fde.show(n,e,r)}),i){let n=fde.getAllTypesBBox();this.adaptAll(n,1)}he.publish("updateFrame","")}),he.messageBus.rpcService("pcbRemoveIndicatorMarkers",()=>{fde.remove(),he.publish("updateFrame","")}),he.messageBus.rpcService("pcb/pcbRebuildCopperRegion",async o=>{let t=!1,e=new Set,r=tm.getInstance(),{ids:i,isLast:n}=o;if(!R.getInstance().isactive||R.getInstance().doctype!=3||Array.isArray(i)&&i.length==0)return!1;for(let u of e)if(u!="all"){let d=!0;if(u.isLast==o.isLast&&o.ids.length==u.ids.length){for(let p=0;p<u.ids.length;p++)if(o.ids[p]!=u.ids[p]){d=!1;break}}else d=!1;if(d)return!1}let s="rebuildSelectedCopper-time";Cn(s,!0),he.windowBridge.publish("pcbUpdateProgress",{ratio:0,descripte:"copper"},Q());let a=new j6(i,!1);e.add(o);let l=r.addWorker(`editor?entry=pcb-worker.js${Q().location.search.replace(/\?/,"&")}`),c=JSON.stringify(a.encode()),h=[];return await l.rpcCall("pourDocument",c).then(u=>{let d=kxt(r,u.message,t,n);e.delete(o),Xi(s),h=d.map(m=>({...m.toJSON(),pourPrimitiveId:m.getParent().globalIndex}))}),c=null,h})}var C5=class extends ni{constructor(e){super();this.mouseLeftX=0;this.mouseLeftY=0;this.selections=new Array;this.items=new Set;this.ctrlDown=!1;this.drawing=!0,this.cmd=e}onKeyDown(e){switch(this.ctrlDown=e.ctrlKey,tr.getAction(4,e)){case"Cancel":{this.cancel();break}case"Finish":{this.onEnterPlace(e);break}}}onKeyUp(e){this.ctrlDown&&!e.ctrlKey&&this.items.size>0&&!e.leftDown&&(A.publish("select",this.items),ze.mouseSeleceMove(this.cmd,!0),this.end()),this.ctrlDown=e.ctrlKey}onMouseLeftDown(e){this.mouseLeftX=e.realSceneX,this.mouseLeftY=e.realSceneY,A.publish("clearSelect",""),this.start()}onMouseMove(e){let r=e.realSceneX,i=e.realSceneY;e.hovering=!0,e.hover(),e.leftDown&&this.updateSelectBox(r,i)}onMouseLeftUp(e){let r=e.realSceneX,i=e.realSceneY;if(this.selections.length>0){let n=new _e().ext6(r,i).ext6(this.mouseLeftX,this.mouseLeftY).build1();this.mouseLeftX>r?It.getInstance().flip?this.boxSelect(n,!0,e.ctrlKey):this.boxSelect(n,!1,e.ctrlKey):It.getInstance().flip?this.boxSelect(n,!1,e.ctrlKey):this.boxSelect(n,!0,e.ctrlKey),this.clearSelectBox(),e.setIsBoxSelection(!0)}else{let n=Vr.pointSelect(r,i);if(n=Array.from(jt.filter(n)),!e.ctrlKey&&this.items.size==0&&n.length==1&&this.cmd=="MOVE_BY_REFERENCE_POINT"){this.select(n),A.publish("select",this.items);let s={command:"batchMoveItem",refer:new k2(Array.from(this.items),e.sceneX,e.sceneY),menu:"MOVE_BY_REFERENCE_POINT",isContinuousMode:!0};A.publish("toggle",s);return}else this.select(n)}!e.ctrlKey&&this.items.size>0&&(A.publish("select",this.items),ze.mouseSeleceMove(this.cmd,!0),this.end())}select(e){for(let r of e)this.items.has(r)?(r.visible(),this.items.delete(r)):(r.click(),this.items.add(r))}boxSelect(e,r,i){let n=new Array;r?n=this.leftToRight(e):n=this.rightToLeft(e),n=Vr.filterPartiton(n),this.select(n)}clearSelectBox(){for(let e of this.selections)e.remove();this.selections.length=0}updateSelectBox(e,r){let i=le.themeConfig.canvasTheme,n=i.isSolidLine(i.selectBoxLineStyle),s=i.selectBoxColor;if(this.selections.length>0)this.selections[0].start=new S(this.mouseLeftX,this.mouseLeftY),this.selections[0].end=new S(e,this.mouseLeftY),this.selections[1].start=new S(e,this.mouseLeftY),this.selections[1].end=new S(e,r),this.selections[2].start=new S(e,r),this.selections[2].end=new S(this.mouseLeftX,r),this.selections[3].start=new S(this.mouseLeftX,r),this.selections[3].end=new S(this.mouseLeftX,this.mouseLeftY);else{let a=new cr(1002,new S(this.mouseLeftX,this.mouseLeftY),new S(e,this.mouseLeftY),n,s),l=new cr(1002,new S(e,this.mouseLeftY),new S(e,r),n,s),c=new cr(1002,new S(e,r),new S(this.mouseLeftX,r),n,s),h=new cr(1002,new S(this.mouseLeftX,r),new S(this.mouseLeftX,this.mouseLeftY),n,s);this.selections.push(a),this.selections.push(l),this.selections.push(c),this.selections.push(h)}}leftToRight(e){let r=jt.filterElement(Vr.getSelectInside(ll(e),{boxChoose:!1,isBBox:!0}),{boxChoose:!0});return Array.from(r)}rightToLeft(e){let r=jt.filterElement(Vr.getSelectContect(ll(e),{boxChoose:!0,isBBox:!0}),{boxChoose:!0});return US(r)}interrupt(){for(let e of this.items)e.visible();this.items.clear(),this.clearSelectBox()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this)}parse(e){switch(e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}};var Fxt=20,Vxt=16,Gxt=24,Uxt={detectionSize:50,detectionAwaitingTime:300,detectionIgnoreRule:!1,panningStep:30,altPanningStep:100,panningFrequency:.5,panningFrequencyRange:[2,30],panningModel:0,variableSpeedRatioRange:[.5,2]},ZS=class o{static getInstance(){return this._instance||(this._instance=new o),this._instance}constructor(){this.options=Object.assign({},Uxt),this.initState()}initState(){this.env=null,this.state=0,this.lastAdsorb=!1,this.bindingAfterPanningCall(null)}checking(t,e,r){let i=this.state;if(!t||i==2)return!1;this.state=2,this.updateOptions(e),this.bindingAfterPanningCall(r);let{detectionSize:n,detectionAwaitingTime:s,detectionIgnoreRule:a,panningModel:l,variableSpeedRatioRange:c}=this.options,u=R.getInstance().openRuler,d=we.isShowBottomLayerScrollBarShow,p=a?0:Fxt,m=Vxt,g=Gxt,y=u?p:0,b=0,P=u?p:0,T=(d?m:0)+g,{canvasWidth:I,canvasHeight:C,mouseX:E,mouseY:O,altKey:_}=t,x=E-y,v=I-E-b,D=O-P,w=C-O-T,F=0;this.isOneDetectionRange(x)?F=1:this.isOneDetectionRange(v)&&(F=-1);let H=0;this.isOneDetectionRange(D)?H=-1:this.isOneDetectionRange(w)&&(H=1);let z=F!=0||H!=0,V=1;if(l==1&&z){let W=Math.min(c[0],c[1]),L=Math.max(c[0],c[1]);if(F!=0){let k;F==1?k=(n-x)/n:k=(n-v)/n,V=W+(L-W)*k}else if(H!=0){let k;H==-1?k=(n-D)/n:k=(n-w)/n,V=W+(L-W)*k}}return this.refreshEnv({horizontalIndex:F,verticalIndex:H,variableSpeedRatio:V,hasAltKey:_}),this.state=i,i==0?(z||(this.state=1),!1):(i==1?z&&(this.state=3,this.awaitingTimer=setTimeout(()=>{this.panning()},s)):(i==3||i==4)&&(z||this.ending()),z)}getAutoPanningOptions(t){if(!t)return null;let e={},{type:r,speed:i,step:n,altStep:s}=t,a=r==null?void 0:r.value;a=="uniformTranslation"?e.panningModel=0:a=="variableSpeedTranslation"&&(e.panningModel=1);let l=i==null?void 0:i.value;l>=0&&l<=100&&(e.panningFrequency=l/100);let c=n==null?void 0:n.value;c>0&&(e.panningStep=c);let h=s==null?void 0:s.value;return h>0&&(e.altPanningStep=h),e}updateOptions(t){if(!t)return;let e=t.panningFrequency;(e||e==0)&&(e=Math.max(0,Math.min(e,1)),t.panningFrequency=e),this.options=Object.assign(this.options,t)}bindingAfterPanningCall(t){this.afterPanningCall=t}refreshEnv(t){this.env=t}refreshInputEnv(t){let e=this.env;if(!e||!t||this.state==0||this.state==1)return;let r=t.keyCode;if([27,123].includes(r)){this.ending();return}let s=r==18;s&&(e.hasAltKey=s)}isOneDetectionRange(t){let e=this.options.detectionSize;return t>=0&&t<=e}panning(){let{horizontalIndex:t,verticalIndex:e,variableSpeedRatio:r,hasAltKey:i}=this.env,{panningStep:n,altPanningStep:s,panningFrequency:a,panningFrequencyRange:l}=this.options,c=i?s:n,h=Math.min(l[0],l[1]),u=Math.max(l[0],l[1]),d=h+(u-h)*a,p=d*r,m=1/p*1e3;we.adsorb&&(we.adsorb=!1,A.publish("toggleAdsorb","isFalse"),this.lastAdsorb=!0),this.state=4;let y=t*c,b=e*c;Ai().addOffset1(y,-b),console.log("auto panning",{moveOffsetX:y,moveOffsetY:b,uniformPanningFrequency:d,variablePanningFrequency:p,finalPanningTime:m}),this.afterPanningCall&&this.afterPanningCall(),this.panningTimer=setTimeout(()=>{this.panning()},m)}ending(){this.state==0||this.state==1||(this.lastAdsorb&&(we.adsorb=!0,A.publish("toggleAdsorb","isTrue")),this.initState(),clearTimeout(this.awaitingTimer),clearTimeout(this.panningTimer))}};var mde=class{constructor(t,e){this.profile=t,this.groupCommand=e||new De("Execute Edit outLine")}set polyline(t){this._polyline=t}get polyline(){return this._polyline}getSpiltInfo(t){let e=new Array,r=new Array,i=new Array,n=0;for(let s of t)if(s.inter.length>0){let a=oR(s.pt,s.inter);switch(n){case 0:{if(e.push(a[0]),a.length==2)r.push(a[1]),n=1;else if(a.length==3)r.push(a[1]),i.push(a[2]),n=2;else throw new Error("data error!!");break}case 1:{if(r.push(a[0]),a.length==2)i.push(a[1]),n=2;else throw new Error("data error!!");break}default:{i.push(s.pt);break}}}else switch(n){case 0:{e.push(s.pt);break}case 1:{r.push(s.pt);break}default:{i.push(s.pt);break}}return{firstPts:e,secondPts:r,lastPts:i}}getSpiltPts(t,e,r,i){if(t[t.length-1].end().equals1(i)){let n=ge.build2(t.concat(this.polyline.primitives).concat(r)),s=ge.build2(e),a=ge.build2(this.polyline.primitives.concat(s.reverse().primitives));return n.area()>0&&(n=n.reverse()),a.area()>0&&(a=a.reverse()),{polyline1:n,polyline2:a,needSavePl:a}}else{let n=ge.build2(t.concat(this.polyline.reverse().primitives).concat(r)),s=ge.build2(this.polyline.primitives.concat(e));return n.area()>0&&(n=n.reverse()),s.area()>0&&(s=s.reverse()),{polyline1:n,polyline2:s,needSavePl:n}}}handleEditResult(t,e,r,i){let n,s=this.handleOutLine(r,t,e),{firstPts:a,secondPts:l,lastPts:c}=this.getSpiltInfo(s),{polyline1:h,polyline2:u,needSavePl:d}=this.getSpiltPts(a,l,c,t),p=Eo(h),m=Eo(u);if(p&&m){this.sendMessage();return}if(p)n=this.createPolygon(u,i);else if(m)n=this.createPolygon(h,i);else{let g,y=Math.abs(h.area()),b=Math.abs(u.area());Math.abs(y-b)<1e-6?g=d:g=y>b?h:u,n=this.createPolygon(g,i)}this.inherit(n),(this.profile instanceof rr||this.profile instanceof Pr)&&(this.addCommand(n,"add"),this.addCommand(this.profile,"delete"),this.profile.remove(),A.publish("delete",this.profile)),A.publish("hasModifyPcbItem",this.profile),A.publish("autoFill",""),A.publish("updateRtree",""),A.publish("updateFrame",""),A.publish("select",[n]),qe.executeCommand(this.groupCommand),this.resetState()}inherit(t){if(t instanceof He&&!(this.profile instanceof lt)){this.profile instanceof He&&this.profile.getComponent()&&t.setComponent(this.profile.getComponent().clone()),this.profile.net&&(t.net=this.profile.net);let e=re.getInstance().getRegion(this.profile.globalIndex);e&&re.getInstance().addRegionSelectorByRuleModel(t.globalIndex,e.clone());let r=Ht.getItem(this.profile.getGroupID());if(r&&r.addItem(t),this.profile.type==="Copper Region"){let i=un.getOrder(this.profile.globalIndex);i&&un.setOrder(t,i,this.groupCommand)}}t instanceof He&&t.type=="Copper Region"&&A.publish("rebuildSingleCopper",{ids:[t.globalIndex],isLast:!1,isManual:!0})}sendMessage(){A.publish("ui/toastMsg",{type:"warn",msg:"Edit failed. Unable to determine the retained outline. Please try again!"},Q())}handleOutLine(t,e,r){let i=new Array,n=!1,s=!1;for(let a of t.primitives){let l={pt:a,inter:[]};a instanceof M?(!n&&sR(a,e)&&(l.inter.push(e),n=!0),!s&&sR(a,r)&&(l.inter.push(r),s=!0),l.inter.length>1&&an(l.inter,l.pt)):a instanceof q&&(aR(a,e)&&l.inter.push(e),aR(a,r)&&l.inter.push(r)),i.push(l)}return i}createPolygon(t,e){let r;if(this.addCommand(this.profile,"modify"),this.profile instanceof sn)this.profile.setChildrens(t);else if(this.profile instanceof rr||this.profile instanceof Pr)r=new Mh().create4Pl(this.profile.type,this.profile.layerId,t,this.profile.strokeWidth,this.profile.net,this.profile.locked);else if(this.profile instanceof lt){let i=new Po;this.profile.removeChildByIndex(e);let n=this.profile.getChildrens();e&&(t=t.reverse());let s=[];for(let a of t.primitives){let l=i.ptToShape(a);s.push(l)}n[e]=s,this.profile.setChildrens(n)}return r||this.profile}addCommand(t,e="add"){let r=Ce.dispatch(t,e);this.groupCommand.addCommand(r)}resetState(){this._polyline=null,this.profile=null,this.groupCommand=new De("Execute Clip Polyline")}};function jje(o,t){let e=new qt;return t&&e.add("COMPLETE"),e.add("CANCEL"),t&&e.add("REGRESSION"),e.addExtend("WIRING_CORNER",fS(Zt.getInstance().type)),e.add("toggleAdsorb",!1,o),e.add("ADSORBENT_CONFIG"),e.result}var GG=class extends ni{constructor(e){super();this.msg="Please select a starting point";this.started=!1;switch(this.type="Segment",e.click(),this.profile=e,this.event=new du,this.event.needClose=!1,this.resultEvent=new Hm(this.type),this.resultEvent.shouldAddHistory=!1,Zt.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new eh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new Gh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new ja(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Tl(this.event,Ur,this.resultEvent);break}this.event.commands=new De("draw 2DLine - "+this.type),this.event.drawScene=this.type,this.event.isEditOutLine=!0,Ur.addDrawTool(this),this.drawing=!0}onMouseLeftUp(e){if(this.start(),this.started){if(this.isCanFinish(e)){this.drawPolygon.onMouseLeftUp(e),this.completed(e);return}}else this.startPoint=new S(e.sceneX,e.sceneY),this.getEditOutLine(),Ut.cancel(),this.started=!0;this.drawPolygon.onMouseLeftUp(e)}onMouseMove(e){this.started?this.drawPolygon.onMouseMove(e):Ut.update(e,this.msg)}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.started&&this.isCanFinish(e)?this.completed(e):this.onEnterPlace(e);break;case"Backspace":this.backspace();break;case"changeRoutingAngle":case"Routing Corner":this.wireCorner(Ur.getNextType()),wi();break;case"Filp Path While Drawing":this.drawPolygon.onKeyDown(e);break}}completed(e){var s;if(this.drawPolygon.completed(!1),!((s=this.resultEvent)!=null&&s.profileRes)||this.resultEvent.profileRes.length===0){console.warn("EditOutline2: \u8F6E\u5ED3\u6570\u636E\u672A\u751F\u6210\uFF0C\u672A\u8FDB\u884C\u79FB\u52A8\u64CD\u4F5C"),this.cancel();return}let r=this.resultEvent.profileRes[0],i=this.resultEvent.profileRes[0].getMathGraphics().primitives,n=ge.build2(i);r.remove(),A.publish("delete",r),y1.displayPolyline(n),this.editOutLineUtils.polyline=n,this.editOutLineUtils.handleEditResult(this.startPoint,this.endPoint,this.currentEditOutLine,this.outLineIndex),y1.clear(),Ut.cancel(),this.resultEvent.profileRes.length=0,this.drawing=!1,A.publish("tool","dropdrag"),this.end()}interrupt(){let e=this.editOutLineUtils.polyline;y1.displayPolyline(e),y1.clear(),this.profile.visible(),Ut.cancel(),this.drawPolygon.cancel(),this.drawing=!1}backspace(){this.drawPolygon.backspace()}cancel(){this.event.shape.length>0?this.backspace():(this.interrupt(),this.nextTool=null,this.event=null,this.drawPolygon.cancel())}restoreCurrentInitState(){var e;(e=this.event)==null||e.commands.undo(),this.event=new du}onMouseRightUp(e){if(e.openMenu)switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.event.shape.length>0&&this.isCanFinish(e)?this.completed(e):this.interrupt():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.event.shape.length>0&&this.isCanFinish(e)?this.completed(e):this.interrupt();break}}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:jje(e.adsorb,this.started)};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed(fi.getInstance());case"CANCEL":this.cancel();break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":{this.wireCorner(i[1]),wi();break}case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new eh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new Gh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new ja(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Tl(this.event,Ur,this.resultEvent);break}this.event.start!=null&&this.drawing&&(this.event.last==null&&(this.event.last=this.event.start),this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr)),Zt.getInstance().type=e,we.synchronize()}wireMode(){}initUtils(e){this.editOutLineUtils=new mde(e)}isCanFinish(e){let r=new S(e.sceneX,e.sceneY);if(this.profile instanceof lt){for(let i of this.profile.getAllChildrens())if(this.getEndPoint(i.primitive,r),this.endPoint)return!0}else if(this.profile instanceof rr||this.profile instanceof Pr||this.profile instanceof sn){let i=this.profile.getMathGraphics().primitives;for(let n of i)if(this.getEndPoint(n,r),this.endPoint)return!0}return!1}getEndPoint(e,r){let i=!1;if(e instanceof M&&Fhe(e,r,this.profile.strokeWidth)&&(i=!0),e instanceof q&&Vhe(e,r,this.profile.strokeWidth)&&(i=!0),i){let s=new Po().ptToShape(e);return this.endPoint=ai.getNearestOutlineObjPointInfo(r,s,["Line Center"]).point,s.remove(),!0}return!1}getEditOutLine(){let e=this.profile.getMathGraphics();if(e instanceof ge)this.outLineIndex=0,this.currentEditOutLine=e;else for(let r=0;r<e.items.length;r++){let i=!1;for(let n of e.items[r].primitives)if(n instanceof M?i=sR(n,this.startPoint):n instanceof q&&(i=aR(n,this.startPoint)),i)break;if(i){this.outLineIndex=r,this.currentEditOutLine=e.items[r];break}}}};function Xje(o){let t=new qt;return t.add("CANCEL",!0),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t}var UG=class o{static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}constructor(){this.mode="ShortestPath",this._pushTrack=!0}set glossMode(t){this.mode=t}get glossMode(){return this.mode}get pushTrack(){return this._pushTrack}set pushTrack(t){this._pushTrack=t}};var gde=class{constructor(t,e=!1){this.events=[];this.commands=new De("track average");let r=this.getAllCoCurrentTrack(t);if(!r)return;r=this.sortTracks(r),r.forEach(s=>{let a=new kh(s);a.setMultiRepair(!0),this.events.push(a)});let{average:i,direct:n}=this.getAverageAndDirect();this.move(i,n,e)}getAverageAndDirect(){let t=this.events[0].oldStart,e=this.events[this.events.length-1].oldStart,r=this.events[0].direct,i=r.cross(e.sub(t)),n;return i>0?n=new S(r.y,-r.x):n=new S(-r.y,r.x),{average:Math.abs(i)/(this.events.length-1),direct:n}}move(t,e,r=!1){let i=this.events,n=i[0],s=n.direct,a=new xD;for(let l=1;l<i.length-1;l++){let c=i[l],u=Math.abs(s.cross(n.start.sub(c.start)))-t*l;c.lastRealMousePosition=c.start;let d=c.getTool();Np.needclearWireCache=!1,d.moveOffset(e.mul(u)),a&&a.addPathListByTool(d),d.complete()}r?a.shove():a.obstruct(),i.forEach(l=>{l.complete(this.commands)}),kh.complete2(this.commands),qe.executeCommand(this.commands),kh.clear()}sortTracks(t){let e=t[0].direct,r=t[0].start,i=[];return t.forEach(n=>{let a=n.start.sub(r),l=e.cross(a);i.push({track:n,dis:l})}),Er(i,(n,s)=>n.dis-s.dis,0,i.length),i.map(n=>n.track)}getAllCoCurrentTrack(t){let e=a=>a.direct,r=[];if(t.forEach(a=>{let l=e(a),c=!1;if(r.forEach(h=>{let{tracksInfo:u,direct:d,matrix:p,bbox:m}=h;if(l.length()>0&&Math.abs(l.cross(d))<.001){let g=a.start.multiply4(p),y=a.end.multiply4(p),b=new ht(Math.min(g.x,y.x),Math.max(g.x,y.x),0,0),P=m.intersection1(b);u.push({track:a,interBox:P})}}),!c&&l.length()>0){let h=Ae.translate(-a.start.x,-a.start.y,0).rotateZ(-l.angle(S.ORIGIN)),u=a.end.multiply4(h),d=new ht(Math.min(0,u.x),Math.max(0,u.x),0,0),p=new Array;p.push({track:a,interBox:d}),r.push({tracksInfo:p,direct:l,bbox:d,matrix:h})}}),r.length<=0)return;Er(r,(a,l)=>l.tracksInfo.length-a.tracksInfo.length,0,r.length);let i=r[0].tracksInfo;if(i.length<=2)return;Er(i,(a,l)=>a.interBox!=null&&l.interBox!=null?l.interBox.width()-a.interBox.width():a.interBox==null&&l.interBox!=null?l.interBox.width():a.interBox!=null&&l.interBox==null?-a.interBox.width():1,0,i.length);let n=new Set;return i.filter(a=>{let{track:l}=a;if(n.has(l))return!1;let c=new uf(l,!1);for(let h of c.all)h instanceof Ir&&n.add(h);return!0}).map(a=>a.track)}};var yde=class{constructor(t,e=!1){this.extendsSize=10;this.events=[];this.commands=new De("track average");let r=this.getValidTrack(t);!r||r.length<1||(r.forEach(i=>{let n=new kh(i);n.setMultiRepair(!0),this.events.push(n)}),this.move(e))}getValidTrack(t){let e=new Set;return t.filter(i=>{if(e.has(i))return!1;let n=new uf(i,!1);for(let s of n.all)s instanceof Ir&&e.add(s);return!0})}move(t=!1){let e=this.events,r=new xD;r.initClear();for(let i=0;i<e.length;i++){let n=e[i],s=n.track,a=this.getTrackMoveDis(s);n.lastRealMousePosition=n.start;let l=n.getTool();Np.needclearWireCache=!1,l.moveOffset(a),r&&r.addPathListByTool(l),l.complete()}t?r.shove():r.obstruct(),e.forEach(i=>{i.complete(this.commands)}),kh.complete2(this.commands),qe.executeCommand(this.commands),kh.clear()}getTrackMoveDis(t){let e=t.buildBBox();e=e.extendOfSize(this.extendsSize);let i=kt.search(e,(h,u)=>u=="Pad").pads,n=[],s=[],a=t.direct,l=r_;if(i.forEach(h=>{let u=Pe.getLayer(h.layerId);if(h.layerId!=t.layerId&&u.type!="MULTI")return;let d=l.getMinDistResultAboutElementAndElement(t,h,"CENTER","EDGE",t.layerId,t.layerId),p=a.cross(h.center.sub(t.start)),m;if(!d.minline||ne.eq(d.minDistValue,0))m=0;else{let g=!!d.swap,y,b;g?(y=d.minline.start(),b=d.minline.end()):(y=d.minline.end(),b=d.minline.start()),m=a.cross(y.sub(b)),ne.lesseq(p*m,0)&&(m=0)}p<0?s.push({item:h,dis:Math.abs(m),area:p}):n.push({item:h,dis:m,area:p})}),n.length>0&&s.length>0){c(n),c(s);let h=n[0],u=s[0],d;if(ne.eq(h.dis,0)||ne.eq(u.dis,0)){if(!ne.eq(h.dis,u.dis)){let y=l.getMinDistResultAboutElementAndElement(h.item,u.item,"EDGE","EDGE",t.layerId,t.layerId),b,P;ne.eq(y.minDistValue,0)||(!!y.swap?(b=y.minline.end(),P=y.minline.start()):(b=y.minline.start(),P=y.minline.end()));let T=a.cross(b.sub(P));if(T>0){let I=T/2;if(ne.eq(h.dis,0)){let C=new S(a.y,-a.x),E=u.dis-I;return C.mul(E)}else{let C=new S(-a.y,a.x),E=h.dis-I;return C.mul(E)}}}d=Math.abs(h.area)+Math.abs(u.area),h.dis=h.area,u.dis=u.area}else d=Math.abs(h.dis)+Math.abs(u.dis);let p=d/2,m=new S(-a.y,a.x),g=h.dis-p;return m.mul(g)}return new S(0,0);function c(h){Er(h,(u,d)=>u.item.layerId==t.layerId&&u.item.layerId==d.item.layerId?u.dis-d.dis:u.item.layerId==t.layerId?-1:d.item.layerId==t.layerId?1:u.dis-d.dis,0,h.length)}}};var bde=class{constructor(t){this.bheap=new Array;this.count=0;this.comp=t}clear(){this.count=0,this.bheap.length=0}toArray(){return this.bheap}size(){return this.count}add(t){this.count>0?this.siftUp(this.count,t):this.bheap[0]=t,this.count++}poll(){for(;;)if(this.count>0){this.count--;let t=this.bheap[0];return this.count>0&&this.siftDown(0,this.bheap[this.count]),t}else return null}siftUp(t,e){for(;t>0;){let r=t-1>>>1,i=this.bheap[r];if(this.comp(e,i)>=0)break;this.bheap[t]=i,t=r}this.bheap[t]=e}siftDown(t,e){let r=this.count>>>1;for(;t<r;){let i=(t<<1)+1,n=this.bheap[i],s=i+1;if(s<this.count){let a=this.bheap[s];this.comp(n,a)>0&&(i=s,n=a)}if(this.comp(e,n)<=0)break;this.bheap[t]=n,t=i}this.bheap[t]=e}};var gOe=class extends S{constructor(e,r){super(e,r);this.F=0;this.G=0;this.H=0;this.index=0;this.direct=new S(1,0);this.parent=null;this.modCount=0;this.candidateNodes=new Array;this.jump=!1;this.draw=!0}calcF(){this.F=this.G+this.H}},Yq=class{constructor(t){this.node=t,this.modCount=t.modCount}notChanged(){return this.modCount===this.node.modCount}};function Wxt(o,t){return o.node.F-t.node.F}var zxt=Math.cos(Math.PI/4),HG=class{constructor(t,e,r,i,n,s=!1){this.queue=new bde(Wxt);this.closeSet=new Set;this.tool=new Xn;this.lines=new Array;this.timeout=performance.now()+e,this.setting=r,this.canReach=i;let a=new Array,l=0,c=new S(1,0),h=null,u=null;for(let m of t){let g=new gOe(m.x,m.y);if(g.index=l,h!=null)switch(c=g.sub(h).normalize(),h.direct=c,this.setting){case"STRONG":break;case"WEAK":default:{if(u!=null){let y=c.dot(u.direct);ne.greatereq(y,zxt)&&(u.jump=!0,u.candidateNodes.push(h))}u=h;break}}a.push(g),h=g,l++}let d=a[0],p=a[a.length-1];for(s&&(d.direct=d.direct.multiply3(Qe.ROT_90));a.length>0;){let m=a.shift();m.jump||xe.addAll(m.candidateNodes,a)}this.end=this.findPath(d,p),n&&!p.equals1(this.end)&&(this.end=p)}connect(){let t=this.end,e=new Array;if(t!=null)for(e.push(t);t.parent!=null;)t=t.parent,e.push(t);let r=new Array,i=e.length;if(i>0){let n=e[0];for(let s=1;s<i;s++){let a=e[s],l=[];if(n.draw){let c=n.direct.mul(-1);l=this.tool.degree45(c,n,a)}else l=[n,a];for(let c of l)r.push(c.clone());n=a}r=Su(r)}return r.reverse()}getLen(){return this.end.G}findPath(t,e){let r=null,i=Number.MAX_VALUE;for(this.queue.add(new Yq(t));;){let n=this.findMinFNodeInOpneList();if(n!=null&&!n.equals(t)&&n.F+n.H<=i&&(i=n.F+n.H,r=n),n!==null){if(n.equals(e))return n;if(this.closeSet.has(n))continue;this.closeSet.add(n),n.modCount++;let s=this.findNeighborNodes(n);for(let a of s){let l=a.node;l.parent?this.foundPoint(n,l,a.direct,a.points):l=this.notFoundPoint(n,e,l,a.direct,a.points)}}else return r}}findMinFNodeInOpneList(){for(;;){let t=this.queue.poll();if(t===null)return null;if(t.notChanged())return t.node}}findNeighborNodes(t){let e=t.candidateNodes,r=new Array;for(let i of e)this.checkNextNode(t,r,i);if(r.length==0&&e[0]){e[0].draw=!1;let i=new S(e[0].x,e[0].y);r.push({node:e[0],direct:t.direct,points:[new S(t.x,t.y),i,i]})}return r}checkNextNode(t,e,r){let i=t.direct,n=this.degree45(i,t,r),s=n.points;if(!this.closeSet.has(r)){if(this.canReach(s[0],s[1],s[2]))e.push({node:r,direct:i,points:s});else if(n.other){s=n.other;let a=s[1].sub(s[0]).normalize();a.dot(i)>0&&this.canReach(s[0],s[1],s[2])&&e.push({node:r,direct:a,points:s})}}}degree45(t,e,r){let i=this.tool.degree45Model(e,r),n=i[0].sub(e);if(ne.eq(n.x,0)&&ne.eq(n.y,0))return{points:[e,i[1],r],other:null};let s=i[1].sub(e);if(ne.eq(s.x,0)&&ne.eq(s.y,0))return{points:[e,i[0],r],other:null};n=n.normalize(),s=s.normalize();let a=Math.acos(t.dot(n)),l=Math.acos(t.dot(s));return a>l?{points:[e,i[1],r],other:[e,i[0],r]}:{points:[e,i[0],r],other:[e,i[1],r]}}foundPoint(t,e,r,i){let n=this.calcG(t,r,i),s=n.G;s<e.G&&(e.parent=t,e.direct=n.lastDirect,e.G=s,e.calcF(),e.modCount++,this.queue.add(new Yq(e)))}notFoundPoint(t,e,r,i,n){r.parent=t;let s=this.calcG(t,i,n);return r.G=s.G,r.direct=s.lastDirect,r.H=this.calcH(e,r),r.calcF(),r.modCount++,this.queue.add(new Yq(r)),r}calcG(t,e,r){let i=r[0].distance1(r[1])+r[1].distance1(r[2]),n=0;!r[0].equals1(r[1])&&!r[1].equals1(r[2])&&(n+=.01);let s=r[2].equals1(r[1])?r[2].sub(r[0]).normalize():r[2].sub(r[1]).normalize();return ne.eq(t.direct.cross(e),0)||(n+=.01),{G:t.G+i+n,lastDirect:s}}calcH(t,e){return 0}};var WG=class extends dh{constructor(){super();this.path=[];this.shortLine=[]}addLine(e,r,i,n){this.path.push([new Gn(e,{color:ee.GREEN,info:{canReach:i}}),new Gn(r,{color:ee.GREEN,info:{canReach:n}})])}addPreLine(e,r){let i=new M(e[0],e[1]),n=new M(e[1],e[2]);this.shortLine.push([new Gn(i,{color:ee.GREEN,info:{len:r}}),new Gn(n,{color:ee.GREEN})])}displayPath(e){var r;(r=this.path[e])==null||r.forEach(i=>{i.display()}),he.publish("updateFrame","")}display(){for(let e of this.path)e.forEach(r=>{r.display()});for(let e of this.shortLine)e.forEach(r=>{r.display()})}remove(){for(let e of this.path)e.forEach(r=>{r.remove()});for(let e of this.shortLine)e.forEach(r=>{r.remove()})}};var Pde=class{constructor(){this.commands=new Lr;this.optimizationList=[];this.blockShape=new ms;this.canPush=!0}getCommand(){return this.commands}runChain(t,e,r=!0){this.init(),this.pathList=t,this.trackInfo=e,this.canPush=r,this.getMinList(),this.run(this.optimizationList);let i=Mi.getInstance().view4Status(Cr.getInstance().current);if(this.commands.addCommand(i),Cr.getInstance().clear(),gg("45"),this.canPush){let a=this.pushWire();this.setPushFilter(),a||(this.run(this.optimizationList),this.getMinPathByBlock())}else this.setPushFilter(),this.getMinPathByBlock();Cr.getInstance().clear(),oi.getInstance().update();let n=this.optimization2(this.commands),s=Mi.getInstance().view4Status(Cr.getInstance().current);return this.commands.addCommand(s),Cr.getInstance().clear(),Nl.getInstance().clear(),yg(),this.getResultIds(n)}optimization2(t){let e=Array.from(this.optimizationList);e.forEach(n=>{this.setInputStatus(n)});let i=new kI(e,"SUPER",new S(1,0),performance.now()+1e5).optimize(!0);return t.addCommand(i),this.pathList}optimization(t){let e=this.pathList.filter(i=>!this.optimizationList.includes(i));return this.generateMinList(t).forEach((i,n)=>{let s=this.optimizationList[n];i.replace(s.getFirstNode(),s.getLastNode()),t.addCommand(new mi(i)),e.push(s)}),e}init(){Gr.init(),pa.getInstance().clear(),Mr.getInstance().clear(),fs.getInstance().clear(),Nl.getInstance().init()}showPath(t){t.getAllItems().forEach(r=>{Cr.getInstance().current.setTrackVisible(r.globalIndex)})}getResultIds(t){let e=[];return t.forEach(r=>{let i=r.getAllItems();e.push(...i.map(n=>n.globalIndex))}),e}generateMinList(t){let e=Array.from(this.optimizationList),r=0,i=[],n=new Lr;return e.forEach(s=>{this.hidePath(s);let a=this.generateMinListPoints(s),l=a.path,c=s.getFirst(),h=this.getListByPoints(l,c,n);r+=a.len?a.len:this.getListLen(h),i.push(h)}),t.addCommand(n),i}getListLen(t){let e=0;return t.getAllItems().forEach(r=>{e+=r.length}),e}generateMinListPoints(t){let e=[];t.getAllItems().map(a=>a.primitive).forEach(a=>{xe.addAll(e,[a.start(),a.end()])});let n=t.getFirst();return this.generateMinPoints(e,n)}setInputStatus(t){let e=t.listIterator();for(;e.hasNext();){let r=e.next();Mr.getInstance().addInputStatus(r)}}getListByPoints(t,e,r){let i=new Zr,n=i.createList();for(let s=1;s<t.length;s++){let a=i.createTrack(e.layerId,t[s-1],t[s],e.width,e.net,r);i.addList(a,n,r)}return n}generateMinPoints(t,e){t=Su(t),this.debug=new WG;let r=this.getOptimalPath(t,e),i=r.connect(),n=0;return i.length>0&&(i=Su(i),t=i,n=r.getLen()),this.debug&&Gr.inputDebugGraphics(this.debug),{path:t,len:n}}getOptimalPath(t,e,r=!1){return new HG(t,1e4,"STRONG",(i,n,s)=>{let a=new M(i,n),l=new M(n,s),c=this.canReach(e,a),h=this.canReach(e,l),u=c&&h;return this.debug&&this.debug.addLine(a,l,c,h),u},!0,r)}hidePath(t){t.getAllItems().forEach(r=>{Cr.getInstance().current.setTrackHidden(r.globalIndex)})}setPushFilter(){wt.setPushFilter()}run(t){this.wireResult=new Tg;let e=this.wireResult;return t.forEach(r=>{let i=this.trackInfo.get(r);e.setInputStatus(r),e.wireMap.set(i,r)}),e}getMinList(){let t=new Xn,e=this.pathList;this.optimizationList=e.filter(r=>{if(r.size()==1)return!1;let i=r.getFirst(),n=i.start,s=r.getLast().end,a=this.getDirect(i),l=t.degree45(a,n,s);if(l=Su(l),l.length<=1&&l.push(l[0]),r.size()==2&&i.end.equals(l[1]))return!1;let c=this.getListByPoints(l,i,this.commands);return c.replace(r.getFirstNode(),r.getLastNode()),this.commands.addCommand(new mi(c)),!0})}getMinList2(t,e){let r=new Xn,i=t.getFirst(),n=i.start,s=t.getLast().end,a=this.getDirect(i),l=r.degree45(a,n,s);l=Su(l);let c=this.getListByPoints(l,i,e);c.replace(t.getFirstNode(),t.getLastNode()),e.addCommand(new mi(c))}getDirect(t){if(t instanceof zr)return t.direct;if(t instanceof Ii){let e=t.center,r=t.start,i=e.sub(r).normalize();return t.sweep==ae.CCW?new S(-i.y,i.x):new S(i.y,-i.x)}}pushWire(){new km().run(this.wireResult);let e=this.isValidPath(new Lr),r=Mi.getInstance().view4Status(Cr.getInstance().current);return this.commands.addCommand(this.wireResult.command),this.commands.addCommand(r),e}getMinPathByBlock(){new By().run(this.wireResult),this.isValidPath()||this.getMinPathByBlock2();let r=Mi.getInstance().view4Status(Cr.getInstance().current);this.commands.addCommand(this.wireResult.command),this.commands.addCommand(r)}getMinPathByBlock2(){this.optimizationList.forEach(e=>{let r=new Lr;this.getMinList2(e,r),this.run([e]),new By().run(this.wireResult),this.isValidPath(r)&&this.commands.addCommand(r)});let t=Mi.getInstance().view4Status(Cr.getInstance().current);this.commands.addCommand(this.wireResult.command),this.commands.addCommand(t)}isValidPath(t){this.setPushFilter();let e=this.wireResult,r=this.blockShape,i=!0;return e.wireMap.forEach((n,s)=>{if(!i)return;let a=n.getAllItems(),l=s.start.point,c=s.end.point;a[0].start.equals(l)||(i=!1),a[a.length-1].end.equals(c)||(i=!1),i&&a.find(u=>r.checkDRC4Primitive(u,u.primitive))&&(i=!1)}),i?!0:(e.command.undo(),e.command=new Lr,t?t.undo():(this.commands.undo(),this.commands=new Lr),!1)}canReach(t,e){return!this.blockShape.checkDRC4Primitive(t,e)}};var Tde=class{constructor(){this.commands=new Lr;this.optimizationList=[];this.blockShape=new ms}getCommand(){return this.commands}runChain(t,e){this.init(),this.pathList=[t],this.trackInfo=new Map,this.trackInfo.set(t,e),this.getMinList(),this.run(this.optimizationList);let r=Mi.getInstance().view4Status(Cr.getInstance().current);this.commands.addCommand(r),Cr.getInstance().clear(),gg("45"),this.setPushFilter(),this.getMinPathByBlock(),Cr.getInstance().clear(),oi.getInstance().update(),this.optimization2(this.commands);let i=Mi.getInstance().view4Status(Cr.getInstance().current);this.commands.addCommand(i),Cr.getInstance().clear(),yg()}optimization2(t){let e=Array.from(this.optimizationList);e.forEach(n=>{this.setInputStatus(n)});let i=new kI(e,"SUPER",new S(1,0),performance.now()+1e5).optimize(!0);return t.addCommand(i),this.pathList}optimization(t){let e=this.pathList.filter(i=>!this.optimizationList.includes(i));return this.generateMinList(t).forEach((i,n)=>{let s=this.optimizationList[n];i.replace(s.getFirstNode(),s.getLastNode()),t.addCommand(new mi(i)),e.push(s)}),e}init(){Gr.init(),pa.getInstance().clear(),Mr.getInstance().clear(),fs.getInstance().clear()}generateMinList(t){let e=Array.from(this.optimizationList),r=0,i=[],n=new Lr;return e.forEach(s=>{this.hidePath(s);let a=this.generateMinListPoints(s),l=a.path,c=s.getFirst(),h=this.getListByPoints(l,c,n);r+=a.len?a.len:this.getListLen(h),i.push(h)}),t.addCommand(n),i}getListLen(t){let e=0;return t.getAllItems().forEach(r=>{e+=r.length}),e}generateMinListPoints(t){let e=[];t.getAllItems().map(a=>a.primitive).forEach(a=>{xe.addAll(e,[a.start(),a.end()])});let n=t.getFirst();return this.generateMinPoints(e,n)}setInputStatus(t){let e=t.listIterator();for(;e.hasNext();){let r=e.next();Mr.getInstance().addInputStatus(r)}}getListByPoints(t,e,r){let i=new Zr,n=i.createList();for(let s=1;s<t.length;s++){let a=i.createTrack(e.layerId,t[s-1],t[s],e.width,e.net,r);i.addList(a,n,r)}return n}generateMinPoints(t,e){t=Su(t),this.debug=new WG;let r=this.getOptimalPath(t,e),i=r.connect(),n=0;return i.length>0&&(i=Su(i),t=i,n=r.getLen()),this.debug&&Gr.inputDebugGraphics(this.debug),{path:t,len:n}}getOptimalPath(t,e,r=!1){return new HG(t,1e4,"STRONG",(i,n,s)=>{let a=new M(i,n),l=new M(n,s),c=this.canReach(e,a),h=this.canReach(e,l),u=c&&h;return this.debug&&this.debug.addLine(a,l,c,h),u},!0,r)}hidePath(t){t.getAllItems().forEach(r=>{Cr.getInstance().current.setTrackHidden(r.globalIndex)})}setPushFilter(){wt.setPushFilter()}run(t){this.wireResult=new Tg;let e=this.wireResult;return t.forEach(r=>{let i=this.trackInfo.get(r);e.setInputStatus(r),e.wireMap.set(i,r)}),e}getMinList(){let t=new Xn,e=this.pathList;this.optimizationList=e.filter(r=>{if(r.size()==1)return!1;let i=r.getFirst(),n=i.start,s=r.getLast().end,a=this.getDirect(i),l=t.degree45(a,n,s);if(l=Su(l),l.length<=1&&l.push(l[0]),r.size()==2&&i.end.equals(l[1]))return!1;let c=this.getListByPoints(l,i,this.commands);return c.replace(r.getFirstNode(),r.getLastNode()),this.commands.addCommand(new mi(c)),!0})}getMinList2(t,e){let r=new Xn,i=t.getFirst(),n=i.start,s=t.getLast().end,a=this.getDirect(i),l=r.degree45(a,n,s);l=Su(l);let c=this.getListByPoints(l,i,e);c.replace(t.getFirstNode(),t.getLastNode()),e.addCommand(new mi(c))}getDirect(t){if(t instanceof zr)return t.direct;if(t instanceof Ii){let e=t.center,r=t.start,i=e.sub(r).normalize();return t.sweep==ae.CCW?new S(-i.y,i.x):new S(i.y,-i.x)}}getMinPathByBlock(){new By(1e8).run(this.wireResult),this.isValidPath();let e=Mi.getInstance().view4Status(Cr.getInstance().current);this.commands.addCommand(this.wireResult.command),this.commands.addCommand(e)}isValidPath(t){this.setPushFilter();let e=this.wireResult,r=this.blockShape,i=!0;return e.wireMap.forEach((n,s)=>{if(!i)return;let a=n.getAllItems(),l=s.start.point,c=s.end.point;a[0].start.equals(l)||(i=!1),a[a.length-1].end.equals(c)||(i=!1),i&&a.find(u=>r.checkDRC4Primitive(u,u.primitive))&&(i=!1)}),i?!0:(e.command.undo(),e.command=new Lr,t?t.undo():(this.commands.undo(),this.commands=new Lr),!1)}canReach(t,e){return!this.blockShape.checkDRC4Primitive(t,e)}};var Ide=class{constructor(t,e=!0){this.pathList={};this.commands=null;this.init(),this.getPath2(t);let r=this.getSortTrackInfo();if(this.resultIds=[],e){let i=[];for(let a in this.pathList){let l=this.pathList[a],c=new Pde().runChain(l,r,e);xe.addAll(i,c)}let n=Mi.getInstance().complete(this.commands),s=i.map(a=>n.newIds[a]).filter(a=>a!=null);xe.addAll(this.resultIds,s),Mi.getInstance().clear()}else{for(let i in this.pathList){let n=this.pathList[i],s=this.getLen(n),l=performance.now()+1e10,c=n.length;for(;performance.now()-l<0&&c>=0;){n.forEach(u=>{new Tde().runChain(u,r.get(u))});let h=this.getLen(n);if(ne.eq(h,s)||n.length<2)break;s=h,n.reverse(),c--}}for(let i in this.pathList){let n=this.pathList[i],s=Mi.getInstance().complete(this.commands),l=this.getResultIds(n).map(c=>s.newIds[c]).filter(c=>c!=null);xe.addAll(this.resultIds,l),Mi.getInstance().clear()}}qe.executeCommand(this.commands),this.clear(),A.publish("flushService","")}getResultIds(t){let e=[];return t.forEach(r=>{let i=r.getAllItems();e.push(...i.map(n=>n.globalIndex))}),e}getLen(t){let e=0;return t.forEach(r=>{r.getAllItems().forEach(i=>{e+=i.length})}),e}get glossItems(){return this.resultIds}getSortTrackInfo(){let t=new Map;for(let e in this.pathList){let r=this.pathList[e],i=r.map(h=>{let u=this.generateTrackInfoByItem(h.getFirst(),h.getLast());return t.set(h,u),u}),n=new Jt,s=i.map((h,u)=>{let d=r[u].getFirst(),p=n.getItem(d.globalIndex);return{info:h,item:p,project:0}}),l=sT.sort(s).map(h=>h.item.model),c=r.sort((h,u)=>{let d=h.getFirst(),p=u.getFirst(),m=l.findIndex(y=>y==d),g=l.findIndex(y=>y==p);return m-g});this.pathList[e]=c}return t}generateTrackInfoByItem(t,e){let r=t.layerId,i=t.end.sub(t.start).normalize(),n=!0,s=no.getSignalLayerIds(null,r),a=new Ly(new Set(s),r,t.start,i,n,null),l=new Ly(new Set(s),r,e.end,i,n,null),c=new v0(t.net,t.width,t.layerId,i,!1);return c.start=a,c.end=l,c}getPath2(t){let e=new Set,r;t.forEach(i=>{if(e.has(i.model))return;if(!At.getInstance().getNode(i.model)){let c=new su(i.model,1e-4),h=c.reverseTrack[0]?c.tracks[0].end:c.tracks[0].start;if(!r)r=h;else{let u=c.tracks.length-1,d=c.reverseTrack[u]?c.tracks[0].start:c.tracks[0].end;r.distance2(h)>r.distance2(d)&&c.reversePath()}c.generateList()}let n=At.getInstance().getNode(i.model).parent;n.getAllItems().forEach(c=>{e.add(c)});let a=i.layerId,l=this.pathList[a];l||(l=this.pathList[a]=[]),l.push(n)})}clear(){Mi.getInstance().clear(),Ml.getInstance().deleteAll(),Jf.getInstance().clear(),Si.getInstance().clear(),oi.getInstance().clear(),At.getInstance().clear(),fs.getInstance().clear(),Cr.getInstance().clear(),$l.getInstance().clear(),pa.getInstance().clear(),ps.getInstance().clear(),Kl.getInstance().clear(),Mr.getInstance().clear(),ps.getInstance().clear(),Nl.getInstance().clear()}init(){this.commands=new De("wire"),At.getInstance().clear(),Si.getInstance().clear()}};var Cde=class extends Oo{constructor(){super();this.selectItems=[];this.hightItems=[];this.glossItems=[];this.params=UG.getInstance(),this.box=new Sj}onMouseLeftDown(e){this.cancelHight(),this.box.isBBox()||this.box.start(e.sceneX,e.sceneY)}setSelectItems(e){this.selectItems=e.filter(r=>!r.locked)}onMouseMove(e){if(this.box.update(e.sceneX,e.sceneY),this.box.isBBox()){let r=this.box.getBBox(e.sceneX,e.sceneY);this.cancelHight(),this.hightItems=this.getBoxItem(r),this.hights()}else{let r=Vr.pointSelect(e.sceneX,e.sceneY).find(i=>i instanceof Ge);if(this.cancelHight(),r&&!r.locked)if(this.params.glossMode==="ShortestPath"){let n=new au(r,!1);this.hightItems.push(...n.tracks)}else this.hightItems.push(r);this.hights()}}getBoxItem(e){let r=[],i=this.boxSelect(e).filter(n=>!n.locked);return this.params.glossMode=="ShortestPath"?i.forEach(n=>{let s=new au(n,!1);r.push(...s.tracks)}):r.push(...i),r}cancelHight(){this.hightItems.forEach(e=>{this.glossItems.includes(e)||e.visible()}),this.hightItems=[]}hights(){this.hightItems.forEach(e=>{this.glossItems.includes(e)||e.click()})}cancelGloss(){this.glossItems.forEach(e=>{e.visible()}),this.glossItems=[]}clearBox(){this.box.interrupt()}glossHight(){setTimeout(()=>{this.glossItems.forEach(e=>{e.click()}),he.publish("updateFrame","")})}onMouseLeftUp(e){let r=this.box.success(e.sceneX,e.sceneY);if(r){let i=this.getBoxItem(r.extendOfSize(.1));this.setSelectItems(i),this.handleSelectTracks()}else{let i=Vr.pointSelect(e.sceneX,e.sceneY).find(n=>n instanceof Ge);if(i&&!i.locked){if(this.params.glossMode==="ShortestPath"){let s=new au(i,!1);this.setSelectItems(s.tracks)}else this.setSelectItems([i]);this.handleSelectTracks(),this.box.interrupt()}}}complete(){this.selectItems=[]}handleSelectTracks(){this.selectItems=this.selectItems.filter(i=>!i.locked);let e=this.selectItems,r=this.params.glossMode;if(this.cancelGloss(),this.cancelHight(),e.length!=0){switch(r){case"ShortestPath":let i=new Jt,n=new Ide(e,this.params.pushTrack);this.glossItems=n.glossItems.map(s=>i.getItem(s)).filter(s=>s instanceof Ge);break;case"AverageSpacing":{let s=e.filter(a=>a instanceof Ir);new gde(s,this.params.pushTrack);break}case"PadCenter":{let s=e.filter(a=>a instanceof Ir);new yde(s,this.params.pushTrack);break}}this.glossHight()}}boxSelect(e){let r=ll(e),i=Vr.rtreeSearchNotOutside(r,!0);return jt.filterWireElement(i.getResult(jd),!0).filter(s=>s instanceof Ge)}};var zG=class extends Oo{constructor(){super();this.option="OPTIONCOMPLETE";this.initSketcherAttrPanel(),this.selectOptiTrackTool=new Cde}getCanUndo(){return!0}initSketcherAttrPanel(e=!0){A.publish("FlushSketcherAttrView",{type:"TRACK_OPTIMIZATION",isInitAllParams:!0,switchTab:e})}handleSelectItems(e){this.selectOptiTrackTool.setSelectItems(e.filter(r=>r instanceof Ge)),this.selectOptiTrackTool.handleSelectTracks(),this.completed()}onKeyDown(e){let r=tr.getAction(3,e);switch(r==null&&(r=tr.getAction(4,e)),r){case"Undo":A.publish("undo","");break;case"Cancel":this.cancel();break}A.publish("updateFrame","")}onEnterPlace(e){this.onMouseLeftDown(e),this.onMouseLeftUp(e)}onMouseLeftUp(e){this.selectOptiTrackTool.onMouseLeftUp(e),this.completed()}onMouseMove(e){this.selectOptiTrackTool.onMouseMove(e),Ut.update(e,"Please click or select the track to be glossed")}onMouseWheel(e){this.onMouseMove(e)}onMouseLeftDown(e){this.selectOptiTrackTool.onMouseLeftDown(e)}onMouseRightUp(e){if(e.openMenu)switch(this.option){case"OPTIONCOMPLETE":{this.option1(e);break}case"OPTIONLEFTUP":{this.option2(e);break}}}option1(e){switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.completed():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}option2(e){switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.onMouseLeftUp(e):this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}completed(e){this.selectOptiTrackTool.complete(),A.publish("flushService","")}cancel(e){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:this.getMenu(e.adsorb).result};$t.getInstance().menuData(r,this),this.drawing=!1}getMenu(e){return Xje(e)}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}}interrupt(){this.selectOptiTrackTool.cancelHight(),this.selectOptiTrackTool.cancelGloss(),this.selectOptiTrackTool.clearBox(),Ut.cancel()}};var c_=class extends Oo{constructor(t,e,r){super(),this.drawing=!0,Ea.changeTool(this)}async copyToCursor(t){if(t=bT.filter(t),t.length<=0){A.publish("tool","dropdrag");return}let e=null,r=ys(t);r.valid()&&(e=r.build1().center());let i=aC.extractCopyInfo(t,e);i=await this.handleCustom(i);let n=Fl.getPasteData({copyData:i});if(n){let{tool:s}=n;this.transformTool=s,Fl.pastePosition(new S(fi.getInstance().sceneX,fi.getInstance().sceneY),!1),On.getInstance().allowPull=!1}}async copyToOtherLayer(t,e){if(t=bT.filter(t),t.length<=0)return;let r=[];t.map(s=>{Un.canChangeLayer(s,e)&&r.push(s)});let i,n=[];if(r.length>0){let s=null,a=ys(r);a.valid()&&(s=a.build1().center());let l=aC.extractCopyInfo(r,s);l=await this.handleCustom(l);let c=Fl.getPasteData({copyData:l});if(!c)return;let{tool:h,position:u}=c;if(this.transformTool=h,this.transformTool.group.forEach(d=>{d instanceof He&&d.type=="3D Shell - Side Slot Region"&&(d.type="3D Shell - Top Slot Region")}),this.transformTool.group.length>0){let d=Pe.getLayer(e);this.transformTool.group.map(p=>{p.layerId=e,p.net&&!d.isCopperLayer()&&(p.net=""),p.click()}),Pe.setActiveLayer(d),u8(),i="{0} objects duplicated successfully",n.push(this.transformTool.group.length+"")}Fl.pastePosition(s)}else i="Selected objects cannot be duplicated to {0}",n.push(Pe.getLayerName(e)),this.canPlace=!1;A.publish("message",{type:"show",message:i,replaceWords:n},Q()),Fl.complete(),this.cancelSelectRepeatResult()}async handleCustom(t){for(let e of Object.keys(t.data)){let r=t.data[e];for(let i=0;i<r.length;i++){let n=JSON.parse(r[i]);if(n.custom){let s=Ji.getInstance().getItem(n.custom),a=await Ji.getInstance().cloneFootprint(s),l=a==null?void 0:a.uuid;l||console.error(`add footprint error footprintUuid: ${n.custom}`),n.custom=l}t.data[e][i]=JSON.stringify(n)}}return t}onKeyDown(t){Fl.onKeyDown(t)}onKeyUp(t){Fl.onKeyUp(t)}onEnterPlace(t){Fl.onMouseLeftUp(t)}onMouseLeftUp(t){$t.getInstance().getMenuStatus()||(Fl.onMouseLeftUp(t),this.cancelSelectRepeatResult())}applyInputAtCursorValue(t){let{type:e,editing:r,keyCode:i}=t;if(r){at.editingWhat=e;return}Fl.applyValue(t),i===13&&at.destroy()}onMouseMove(t){Fl.onMouseMove(t)}interrupt(){Fl.interrupt(),On.getInstance().allowPull=!0}cancel(){Fl.cancel(),On.getInstance().allowPull=!0}onMouseRightUp(t){Fl.onMouseRightUp(t)}cancelSelectRepeatResult(){this.transformTool&&(this.transformTool.group.length&&A.publish("onlySelect",this.transformTool.group),this.transformTool.group.length=0)}};function qje(o){let t=new qt;return t.add("CANCEL"),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t.result}var YG=class extends Oo{constructor(){super()}onMouseLeftUp(t){let e,r=Vr.pointSelect(t.sceneX,t.sceneY);for(let i of r)if(JEe(i)){e=i;break}e==null?A.publish("tool","SelectHelp"):A.publish("toggle",{command:"editOutline",item:e}),this.completed()}onMouseMove(t){Ut.update(t,"Please select a object")}onEnterPlace(t){this.onMouseLeftUp(t)}onKeyDown(t){switch(tr.getAction(4,t)){case"Cancel":this.cancel();break;case"Finish":this.completed();break}}onMouseRightUp(t){if(t.openMenu)switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{t.ctrlKey?this.cancel():this.rightClickMenuData(t);break}case"rightClick":{t.ctrlKey?this.rightClickMenuData(t):this.cancel();break}}}rightClickMenuData(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:qje(t.adsorb)};$t.getInstance().menuData(e,this),this.drawing=!1}parse(t){switch(this.drawing=!0,t.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}cancel(){Ut.cancel(),A.publish("tool","dropdrag")}completed(){Ut.cancel()}};var $je=(a=>(a.ClearanceError="Clearance Error",a.ClearanceErrorInTheSameFootprint="Clearance Error in the same footprint",a.PhysicalError="Physical Error",a.DifferentialPairError="Differential Pair Error",a.ConnectionError="Connection Error",a.NetListError="Netlist Error",a.CreepageError="Creepage Error",a))($je||{});function Kje(o){if(o.list!==void 0){if(!o.list.length)return o.visible;let t=o.list.map(r=>Kje(r));t.every(r=>r==t[0])&&(o.visible=t[0])}return o.visible}function Zje(o){if(o.list!==void 0){let t=o.list.reduce((r,i)=>r+Zje(i),0);o.count=t;let e=o.name.includes(" to ")?[o.name.split(" to ")[0],"to",o.name.split(" to ")[1]]:[o.name];return o.title=o.doNotTranslate?`${o.name} (${t})`:[...e,`(${t})`],t}else return 1}var rP=class{static create(t){return t.filter(e=>e!=null).join(this.separator)}static get(t){if(t==null)return null;let e=t.split(this.separator);return e[e.length-1]}};rP.separator="|_|";var Jje=rP.create(["DRCTab","Errors"]);function POe(o){let t={name:"All",list:o,count:0,title:[],visible:!0};return Zje(t),Kje(t),[{id:Jje,title:t.title,args:{iconCls:"icon-eda-eye",eyeState:t.visible,treeNodeType:"errors"},children:o.filter(r=>r.list.length>0).map(r=>({id:rP.create(["DRCTab","Errors",r.name]),title:r.title,args:{iconCls:"icon-eda-eye",eyeState:r.visible,treeNodeType:"errorType"},children:r.list.map(i=>({id:rP.create(["DRCTab","Errors",r.name,i.name]),title:i.title,args:{iconCls:"icon-eda-eye",eyeState:i.visible,list:i.list,treeNodeType:xl.ErrorObjType}}))}))}]}var yOe=class{constructor(){this.cachedTreeData=null;this.errorTypeVisibilityMap=new Map;this.idToNodeMap=new Map;this.globalIndexToLeafMap=new Map;this.groupChange=!1}getErrorTree(t){return this.clearCache(),this.cachedTreeData=POe(t),this.buildMaps(),this.cachedTreeData}buildMaps(){var r,i,n,s;if(!((i=(r=this.cachedTreeData)==null?void 0:r[0])!=null&&i.children))return;let t=[...this.cachedTreeData[0].children],e=new Set;for(;t.length;){let a=t.shift();if(!this.idToNodeMap.get(a.id)){if(this.idToNodeMap.set(a.id,a),!((n=a.children)!=null&&n.length)){let l=rP.get(a.id);l&&!e.has(l)&&(e.add(l),this.errorTypeVisibilityMap.set(l,!0))}if(((s=a.args)==null?void 0:s.treeNodeType)===xl.ErrorObjType&&a.args.list)for(let l of a.args.list)l.parentId=a.id,l.globalIndex!=null&&this.globalIndexToLeafMap.set(l.globalIndex,l);a.children&&t.push(...a.children)}}}updateDRCErrorVisibility(t,e){var h,u,d;if(!((u=(h=this.cachedTreeData)==null?void 0:h[0])!=null&&u.children))return;this.groupChange=!1;let r=t.id,i=this.cachedTreeData[0],n=rP.get(r),s=r===Jje,a=this.isGroupType(n),l=((d=t.args)==null?void 0:d.treeNodeType)===xl.ErrorObjType,c=this.findNodeById(r)||t;c.args.eyeState=e,s?(i.args.eyeState=e,this.updateChildrenVisibility(i,e)):a?(this.errorTypeVisibilityMap.set(n,e),this.updateChildrenVisibility(c,e)):l&&n!=="Netlist Error"?this.updateLeafVisibility(c,e,!0):n=="Netlist Error"&&(l?this.updateLeafVisibility(c,e,!0):this.updateChildrenVisibility(c,e)),this.updateNodeStateChain(s?i:t),this.updateRootState(),(s||a||this.groupChange)&&pd.updateVisibility()}updateTableItemVisibility(t,e){var a,l;let r=this.globalIndexToLeafMap.get(t);if(!r)return;r.visible=e;let i=r.parentId?this.findNodeById(r.parentId):this.findParentNode(r);if(!i)return;this.groupChange=!1,this.updateLeaf(r,e,!0);let n=i.args.eyeState,s=(l=(a=i.args.list)==null?void 0:a.some(c=>c.visible))!=null?l:n;n!==s&&(i.args.eyeState=s,this.updateNodeStateChain(i),this.updateRootState(),pd.refreshRender()),this.groupChange&&pd.updateVisibility()}updateChildrenVisibility(t,e){var r,i,n;if(t.children)for(let s of t.children){s.args.eyeState=e;let a=rP.get(s.id);this.isGroupType(a)&&this.errorTypeVisibilityMap.set(a,e),(r=s.children)!=null&&r.length?this.updateChildrenVisibility(s,e):((i=s.args)==null?void 0:i.treeNodeType)===xl.ErrorObjType&&this.updateLeafVisibility(s,e,a=="Netlist Error"||e&&((n=s.args)==null?void 0:n.list.some(l=>!l.visible)))}}updateLeafVisibility(t,e,r=!1){var i;if((i=t.args)!=null&&i.list)for(let n of t.args.list)n.visible=e,this.updateLeaf(n,e,r)}updateLeaf(t,e,r=!1){let i=i1.getInstance().getItem(t.globalIndex);i&&(r?e?i.visible():i.hidden():i.onlySetVisibleState(e))}updateNodeStateChain(t){var r,i,n,s;let e=t;for(;e;){let a=e.id,l=(i=(r=a==null?void 0:a.split(rP.separator))==null?void 0:r.slice(0,-1))==null?void 0:i.join(rP.separator),c=l?this.findNodeById(l):void 0;if(!c)break;let h=(s=(n=c.children)==null?void 0:n.some(u=>u.args.eyeState&&this.nodeHasVisibleError(u)))!=null?s:!1;if(c.args.eyeState!==h){c.args.eyeState=h;let u=rP.get(c.id);this.isGroupType(u)&&(this.errorTypeVisibilityMap.set(u,h),this.groupChange=!0),e=c}else break}}updateRootState(){var i,n;let t=(i=this.cachedTreeData)==null?void 0:i[0];if(!t||!((n=t.children)!=null&&n.length))return;let e=!0;for(let s of t.children)if(s.args.eyeState&&this.nodeHasVisibleError(s)){e=!1;break}t.args.eyeState=!e;let r=Ri.getInstance().getItem(35);r.visible=!e,pd.refreshDRCLayer()}nodeHasVisibleError(t){var e,r,i,n,s;return((e=t.args)==null?void 0:e.treeNodeType)===xl.ErrorObjType?(i=(r=t.args.list)==null?void 0:r.some(a=>a.visible))!=null?i:!1:(s=(n=t.children)==null?void 0:n.some(a=>{var l;return a.args.eyeState&&((l=a.children)!=null&&l.length?this.nodeHasVisibleError(a):this.nodeHasVisibleError(a))}))!=null?s:!1}findNodeById(t){return this.idToNodeMap.get(t)||null}findParentNode(t){var i,n;if(t.parentId)return this.findNodeById(t.parentId);let r=(n=(i=(t.id||"").split(rP.separator))==null?void 0:i.slice(0,-1))==null?void 0:n.join(rP.separator);return r?this.findNodeById(r):null}isGroupType(t){return["Clearance Error","Clearance Error in the same footprint","Connection Error","Differential Pair Error","Physical Error","Creepage Error"].includes(t)}isErrorTypeVisible(t){var e;return(e=this.isGroupType(t)&&this.errorTypeVisibilityMap.get(t))!=null?e:!0}getAllStates(){return new Map(this.errorTypeVisibilityMap)}getAllState(){var t,e;return this.cachedTreeData===null?!0:(e=(t=this.cachedTreeData)==null?void 0:t[0])==null?void 0:e.args.eyeState}clearCache(){this.cachedTreeData=null,this.errorTypeVisibilityMap.clear(),this.idToNodeMap.clear(),this.globalIndexToLeafMap.clear()}},bOe=class{constructor(){this.layerVisibilityMap=new Map;this.copperVisibilityMap=new Map;this.multLayerVisible=!1;this.updateLayerVisibility()}updateLayerVisibility(){let t=[...Pe.getAllCopperLayer(),Pe.getMultLayer()];this.multLayerVisible=Pe.getMultLayer().visible,t.forEach(e=>{let{layerID:r,visible:i}=e;r!==12&&this.copperVisibilityMap.set(r,i),this.layerVisibilityMap.set(r,i)})}isLayerVisible(t){var e;return(e=this.layerVisibilityMap.get(t))!=null?e:!1}isCopperVisible(){return Array.from(this.copperVisibilityMap.values()).some(t=>t)}isMultiLayerVisible(){return this.multLayerVisible}shouldDisplayError(t){if(t.length===1)return this.isLayerVisible(t[0]);let e=t.includes(12);return t.length===2&&e?this.isLayerVisible(ay(t[0],t[1])):e?this.isMultiLayerVisible()&&t.some(r=>r!==12&&this.isLayerVisible(r)):this.isMultiLayerVisible()&&t.some(r=>this.isLayerVisible(r))}},Sde=class{static generate(t,e){return!t||t.length==0?null:t.length===1?`L:${t[0]}|T:${e}`:`L:${[...t].sort().join(",")}|T:${e}`}static parse(t){if(!t)return null;let e=t.match(/L:([^|]+)\|T:(.+)/);if(!e)return{};let r=e[1].trim(),i=[];r.includes(",")?i=r.split(",").map(a=>Number(a.trim())):i=r?[Number(r)]:[];let n=e[2].trim(),s=Object.values($je).find(a=>a===n);return{layerIds:i,errorType:s}}},Ede=class{constructor(){this.groupStates=new Map}initialize(){this.layeredGroup=new bOe,this.panelManager=new yOe}isInSameComponent(t,e){let r=n(t),i=n(e);return r&&i&&r==i;function n(s){let l=new Jt().getItem(s);if(l){let c=l.getParent();if(c){if(c instanceof ke)return c;let h=c.getParent();if(h&&h instanceof ke)return h}}return!1}}getErrorType(t){if(t instanceof O0)return this.isInSameComponent(t.obj1,t.obj2)?"Clearance Error in the same footprint":"Clearance Error";if(t instanceof Oy||t instanceof Sy||t instanceof KP||t instanceof _b||t instanceof Ey)return"Physical Error";if(t instanceof Py)return"Connection Error";if(t instanceof Ty||t instanceof Cy||t instanceof Iy)return"Differential Pair Error";if(t instanceof vb)return"Creepage Error"}async setGroupVisibility(t,e){this.groupStates.set(t,e),await Mo.attachViewGroup(t,{visible:e})}generateViewGroupId(t){let e=t.referenceLayerIds;if(!e||e.length==0||t.errType=="Netlist Error")return null;let r=t.content,i=this.getErrorType(r),n=Sde.generate(e,i);if(n&&!this.groupStates.has(n)){let s=this.layeredGroup.shouldDisplayError(e)&&this.panelManager.isErrorTypeVisible(i);this.updateGroupStates(n,s)}return n}updateGroupStates(t,e){this.groupStates.set(t,e)}refreshRender(){let t=i1.getInstance().getAllItem();for(let e of t)e.refreshRender()}refreshDRCLayer(){let t=!jt.getVisible(35),e=!this.layeredGroup.isCopperVisible()&&!this.layeredGroup.isMultiLayerVisible(),r=!this.panelManager.getAllState(),i=t||e||r;if(i&&this.DRCLayer.visible){if(this.DRCLayer.visible=!i,e&&!t&&!r)return i;let n=i1.getInstance().getAllItem();for(let s of n)s.onlySetVisibleState(!i)}else!i&&!this.DRCLayer.visible&&(this.DRCLayer.visible=!0,this.refreshRender());return i}updateVisibility(t=!1){if(!this.refreshDRCLayer())for(let[e,r]of this.groupStates){let i=Sde.parse(e);if(!i)continue;let{layerIds:n,errorType:s}=i,a=this.layeredGroup.shouldDisplayError(n)&&this.panelManager.isErrorTypeVisible(s);(t||r!==a)&&this.setGroupVisibility(e,a)}}getActualVisibility(t){if(t instanceof hy&&!(t instanceof Tp))return this.getActualVisibility(t.getParent());let{referenceLayerIds:e}=t;if(!this.layeredGroup.shouldDisplayError(e))return!1;let i=this.getErrorType(t.model.content);return this.panelManager.isErrorTypeVisible(i)?t.isVisible:!1}reset(){var t,e,r;this.DRCLayer.visible||(this.DRCLayer.visible=!0);for(let[i]of this.groupStates)this.setGroupVisibility(i,!0);(t=this.groupStates)==null||t.clear(),(e=this.panelManager)==null||e.clearCache(),(r=UL)==null||r.reset()}};var ba=S.ORIGIN,jq=1.5;var Qje=new S(-1,-1),Ode=class extends Oo{constructor(){super();this.lastClickX=null;this.lastClickY=null;this.isMouseRightDown=!1;this.prevRightX=0;this.prevRightY=0;this.prevMidX=0;this.prevMidY=0;this.isMouseMidDown=!1;this.zoomCenter=Dt.ORIGIN;this.mark=[];this.adsorb=!0;this.canMouseMove=!1;this.mouseX=0;this.mouseY=0;this.stepHandlePx=50;this.iframeLeftTopPosition=Qje;this.wheelData={lastTime:Date.now(),x:0,y:0,clearTime:null};this.wheelTime=500;this.shiftMoveHelpLine=null;this.flag=!0;this.lastOffset=null;this.inputInfo=null;this._lastMousePosition=null,mOe.call(this),this.camera=Ai(),this.zoomCenter=new Dt(this.camera.getWidth()*.5,this.camera.getHeight()*.5,0),this.setNextTool(new Vc),A.messageBus.subscribe("refreshDrawStatus",()=>{this.handler(e=>{e.interrupt(),A.publish("tool","dropdrag")})}),A.messageBus.subscribe("RestoreToolStatus",()=>{fi.getInstance().clearCrossFlag(),this.handler(e=>{e.restore()})}),A.messageBus.rpcService("getHotKeyCmd",e=>{let r=new fi(Ai().getWidth(),Ai().getHeight());r.subMenuFunc=e.func,r.keyCode=e.keyCode,r.shiftKey=e.shiftKey,r.ctrlKey=e.ctrlKey,r.altKey=e.altKey,r.metaKey=e.metaKey;let i=di.getScene(),n=tr.getAction(i,r);return tr.getConfigHotkeyInfo(n)}),A.subscribe("setOrigin",e=>{!R.getInstance().isactive||23==R.getInstance().doctype||(G3(new S(e.originX,e.originY)),A.publish("updateFrame",""))}),A.subscribe("updateFlag",e=>{this.flag=e}),A.subscribe("Scroll Left",e=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let r=It.getInstance().flip?-1:1;this.moveCamera1(this.getRulerScale()*r,0)}),A.subscribe("Scroll Right",e=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let r=It.getInstance().flip?-1:1;this.moveCamera1(-this.getRulerScale()*r,0)}),A.subscribe("Scroll Up",e=>{!R.getInstance().isactive||23==R.getInstance().doctype||this.moveCamera1(0,-this.getRulerScale())}),A.subscribe("Scroll Down",e=>{!R.getInstance().isactive||23==R.getInstance().doctype||this.moveCamera1(0,this.getRulerScale())}),A.subscribe("toggleAdsorb",e=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;this.adsorb=typeof e=="boolean"?e:!this.adsorb;let r=!1;if(e=="isTrue"||e=="isFalse")switch(r=!0,e){case"isTrue":this.adsorb=!0;break;case"isFalse":this.adsorb=!1;break}if(this.nextTool instanceof RG&&(this.nextTool.drawing=!0),we.adsorb!==this.adsorb&&(we.adsorb=this.adsorb,wi()),!r){let n=this.adsorb?"Open Snap Already!":"Close snap Already!";A.publish("ui/toastMsg",{type:"success",msg:n},Q())}!ze.getSelects().length&&A.publish("flushSelectingInfo",""),this.adsorptionAddFloatingInputBox(null,null)}),A.subscribe("adaptAll",e=>{let r=1,i="";typeof e=="object"?(r=e.ratio||1,i=e.tabId):e>0&&(r=e);let n=R.getInstance();if([23].includes(n.doctype)||(i?n.tabId!=i:!n.isactive))return;let s=of();if(s!=null){let a=Pi.getBBox();if(a instanceof ht){let l=new _e;l.ext1(s),l.ext1(a),s=l.build1()}this.adaptAll(s,r),A.publish("updateFrame","")}},Q()),A.subscribe("fitBoard",e=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;(e==null||e=="")&&(e=1);let r=Au();if(r.length>0){let i=new _e;if(r.forEach(n=>{i.ext1(n.buildBBox())}),i.valid()){let n=i.build1();this.adaptAll(n,e)}A.publish("updateFrame","")}}),A.subscribe("adaptSelect",()=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e=ze.getSelects(),r=Ai(),i=new _e;for(let n of e){if(n instanceof ke){let a=n.getAttrBBox();a&&i.ext1(a)}let s=n.buildBBox();n instanceof mn&&(s.width()==0?s=s.extendSize(r.getPxLength(),0):s.height()==0&&(s=s.extendSize(0,r.getPxLength()))),i.ext1(s)}if(i.valid()){let n=i.build1();this.adaptAll(n,.8,Math.pow(10,6))}A.publish("updateFrame","")}),A.subscribe("highlightItems",this.highlightItems.bind(this),Q()),A.subscribe("highlightError",this.highlightError.bind(this)),A.subscribe("highlightTrackInNets",({trackInNets:e,needAdaptAll:r,isHighlight:i})=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;A.publish("clearSelect","");let n=pr.getAllItem().filter(s=>e.includes(s.net)).map(s=>s.globalIndex);this.highlightItems({globalIndexArr:n,needAdaptAll:r,isHighlight:i})}),A.subscribe("highlightGroupPadsPairNets",({padsPairGroupName:e,needAdaptAll:r,isHighlight:i})=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;A.publish("clearSelect","");let n=[];for(let l=0;l<e.length;l++){let c=re.getInstance().getPadsPairGroupItemByGroupName(e[l]);c&&xe.addAll(n,c.details)}let{lostPads:s,globalIndexArr:a}=UCe(n);if(s.length&&A.publish("ui/toastMsg",{type:"warn",msg:{text:"Pad(s): {0} has been lost.",i18nParam:Array.from(new Set(s))}},Q()),a.length){this.highlightItems({globalIndexArr:Array.from(new Set(a)),needAdaptAll:r,isHighlight:i});return}}),A.subscribe("highlightPadsPairNets",({padsPairNames:e,needAdaptAll:r,isHighlight:i})=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;A.publish("clearSelect","");let n=[];for(let l=0;l<e.length;l++){let c=e[l],h=RVe(c);n.push(h)}let{lostPads:s,globalIndexArr:a}=UCe(n);if(s.length&&A.publish("ui/toastMsg",{type:"warn",msg:{text:"Pad(s): {0} has been lost.",i18nParam:Array.from(new Set(s))}},Q()),a.length){this.highlightItems({globalIndexArr:Array.from(new Set(a)),needAdaptAll:r,isHighlight:i});return}}),A.subscribe("setPadsPairGroupColor",({message:e})=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let{groupName:r,groupColor:i}=e;if(!r||!i)return;let s=re.getInstance().getPadsPairGroupItemByGroupName(r);s!=null&&(s.groupColor=i),A.publish("forceRenderTree",xl.PadsPairGroups,Q()),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q())}),A.subscribe("highlightComponentInClassification",({type:e,componentClassifications:r,needAdaptAll:i,isHighlight:n})=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;A.publish("clearSelect","");let s=Ar.getAllItem().filter(a=>{let l;switch(e){case"Designator":l=a.name.match(/[^\d]*/)[0]||"None";break;case"Device":l=a.device;break;case"Footprint":l=a.footprintId;break;case"Name":l=a.getFormulaName()||"None";break;default:return!1}return r.some(c=>c===l)}).map(a=>a.globalIndex);this.highlightItems({globalIndexArr:s,needAdaptAll:i,isHighlight:n})}),A.subscribe("highlightRatlineNet",({ratlineNets:e,needAdaptAll:r,isHighlight:i})=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;A.publish("clearSelect",""),Wo.unHighlightAll(),i&&R.getInstance().doctype==3&&ze.highlight.unhighLigthAll();let n=[];if(e.forEach(s=>{n=n.concat(Wo.getRatlineByNetName(s))}),n.length>0){let s=[],a=new _e;n.forEach(l=>{l.click(),s.push(l),[l.startNode,l.endNode].forEach(c=>{s.push(c),c.click(),a.ext1(c.buildBBox())})}),a.valid()&&(r?this.adaptAll(a.build1(),.6):this.locationMapItem(a.build1())),i&&R.getInstance().doctype==3&&(n.forEach(l=>{ze.highlight.addHightItem(l)}),s.forEach(l=>{ze.highlight.addHightItem(l)})),A.publish("select",s),A.publish("updateFrame","")}}),A.subscribe("adaptBBox",e=>{if(e instanceof ht||Array.isArray(e)){let r=.8;Array.isArray(e)&&(r=e[1]||1,e=e[0]),this.adaptAll(e,r)}else{let r=!1,{bbox:i,needAdaptAll:n}=e;n?this.adaptAll(i,.6,r?Number.MAX_SAFE_INTEGER:7):this.locationMapItem(i)}}),A.subscribe("AdaptBBox2",e=>{let{box:r,onlyMove:i,showCrossLines:n}=e,s=.8;if(Array.isArray(r)&&(s=r[1]||1,r=r[0]),n&&ql.show(new ht(r.minX,r.maxX,r.minY,r.maxY).center()),this.adaptAll(r,s,void 0,i),n){let a=window.setTimeout(()=>{ql.remove(),ql.setTimer(null),A.publish("updateFrame","")},1e3);ql.setTimer(a)}}),A.subscribe("SetCanvasCrossLine",e=>{let{box:r,delay:i=1e3,isAutoRemove:n=!0}=e,s=.8;if(Array.isArray(r)&&(s=r[1]||1,r=r[0]),ql.show(new ht(r.minX,r.maxX,r.minY,r.maxY).center()),ql.click(),A.publish("updateFrame",""),n){let a=window.setTimeout(()=>{ql.remove(),ql.setTimer(null),A.publish("updateFrame","")},i);ql.setTimer(a)}}),A.subscribe("HiddenCanvasCrossLine",()=>{window.clearTimeout(ql.getTimer()),ql.remove(),ql.setTimer(null),A.publish("updateFrame","")}),A.subscribe("showCanvasRectRegion",e=>{let{box:r,delay:i=1e3,isAutoRemove:n=!0}=e,s=.8;if(Array.isArray(r)&&(s=r[1]||1,r=r[0]),ql.show(new ht(r.minX,r.maxX,r.minY,r.maxY).center()),HD.show(r),A.publish("updateFrame",""),n){let a=window.setTimeout(()=>{ql.remove(),ql.setTimer(null),HD.remove(),HD.setTimer(null),A.publish("updateFrame","")},i);ql.setTimer(a),HD.setTimer(a)}}),A.subscribe("hiddenCanvasRectRegion",()=>{window.clearTimeout(ql.getTimer()),ql.remove(),ql.setTimer(null),window.clearTimeout(HD.getTimer()),HD.remove(),HD.setTimer(null),A.publish("updateFrame","")}),A.subscribe("adaptBBox_OnlyMove",e=>{this.adaptAll(e,void 0,void 0,!0)}),A.subscribe("clearAllHight",()=>{!R.getInstance().isactive||23==R.getInstance().doctype||ze.highlight.unhighLigthAll()}),A.subscribe("highlightNetClass",({netClasses:e,needAdaptAll:r,isHighlight:i})=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;A.publish("clearSelect","");let n=[];e.forEach(s=>{let a=re.getInstance().getNetClass(s);a&&(n=n.concat(a.getAllNets().map(l=>l.name)))}),this.highlightNet({nets:n,needAdaptAll:r,isHighlight:i})}),A.subscribe("highlightEqualLengthGroup",({equalLengthGroups:e,needAdaptAll:r,isHighlight:i})=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;A.publish("clearSelect","");let n=[];e.forEach(s=>{let a=re.getInstance().getEqualLengthGroup(s);a&&(n=n.concat(a.getAllNets().map(l=>l.name)))}),this.highlightNet({nets:n,needAdaptAll:r,isHighlight:i})}),A.subscribe("highlightDifferentails",({netDifferentails:e,needAdaptAll:r,isHighlight:i})=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;A.publish("clearSelect","");let n=[];e.forEach(s=>{let a=re.getInstance().getNetDifferential(s);a&&(n=n.concat(a.getAllNets().map(l=>l.name)))}),this.highlightNet({nets:n,needAdaptAll:r,isHighlight:i})}),A.subscribe("highlightNet",({nets:e,needAdaptAll:r,isHighlight:i,globalIndex:n})=>{!R.getInstance().isactive||23==R.getInstance().doctype||(A.publish("clearSelect",""),this.highlightNet({nets:e,needAdaptAll:r,isHighlight:i,globalIndex:n}))}),A.subscribe("highlightNetsByDataName",({dataTargetType:e,name:r,needAdaptAll:i,isHighlight:n,globalIndex:s})=>{var l,c;if(!R.getInstance().isactive||23==R.getInstance().doctype||!r)return;let a=[];if(e=="DifferentialPair"){let h=re.getInstance().getNetDifferential(r);if(h){let u=(l=h.positiveNet)==null?void 0:l.name,d=(c=h.negativeNet)==null?void 0:c.name;u&&a.push(u),d&&a.push(d)}}else if(e=="NetClass"){let h=re.getInstance().getNetClass(r);a=Array.from(h._nets)}else if(e=="EqualLengthNetGroup"){let h=re.getInstance().getEqualLengthGroup(r);a=Array.from(h.getNets())}a.length>0&&(A.publish("clearSelect",""),this.highlightNet({nets:a,needAdaptAll:i,isHighlight:n,globalIndex:s}))}),A.subscribe("toggleRatlineNet",({netName:e,visible:r})=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let i=Ye.getAllNets(),n=e===""?i:[e],s={};n.forEach(a=>{let l=Hu.getNet(a);l.showRatline=r,Kf(a)}),i.forEach(a=>{let l=Hu.getNet(a);s[a]=l.showRatline}),A.publish("toggleSelectedRatlineNet",s,Q()),A.publish("updateFrame","")}),A.subscribe("toggleSelectedRatline",({type:e,visible:r,isCycleSwitch:i})=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let n=ze.getSelects(),s=new Set;n.forEach(c=>{c instanceof ke?c.getPads().forEach(u=>{s.add(u.net)}):e!=="DeviceOnly"&&(c instanceof _i||c instanceof sn||c instanceof Ue||c instanceof Ir||c instanceof mn)&&s.add(c.net)});let a=Array.from(s);i&&(r=!a.every(h=>{let u=Hu.getNet(h);return u!=null?u.showRatline:!0}));let l={};a.forEach(c=>{let h=Hu.getNet(c);h!=null&&(h.showRatline=r,l[c]=r,Kf(c))}),A.publish("toggleSelectedRatlineNet",l,Q()),A.publish("updateFrame","")}),A.subscribe("toggleDRCError",e=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let{item:r,visible:i,globalIndex:n}=e;n?pd.panelManager.updateTableItemVisibility(n,i):pd.panelManager.updateDRCErrorVisibility(r,i),jt.flush(),A.publish("updateFrame",""),A.publish("flushSelectingInfo","")}),A.subscribe("clearDRCError",()=>{!R.getInstance().isactive||23==R.getInstance().doctype||(pd.reset(),Bo.deleteAll(),A.publish("getAllErrorsBack",POe([]),Q()),A.publish("updateFrame",""))}),A.subscribe("toggleCopper",e=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let r=[].concat(pt.getAllItem(),Xt.getAllItem(),Kt.getAllItem()).filter(a=>{var l;return a.type!="Copper Region"?!1:e.all?!0:e.isLayer?e.ids.includes((l=a.layerId)==null?void 0:l.toString()):e.ids.includes(a.globalIndex)});r.forEach(a=>{a.toggleCopperResult(e.visible)});let i=r.reduce((a,l)=>(a[l.globalIndex]=e.visible,a),{}),n=ze.getItems(),s=n.filter(a=>!(!a.isVisible&&!a.isHighLight));s.length!=n.length&&A.publish("select",s),A.publish("toggleCopperEyeState",i,Q()),A.publish("updateFrame","")}),A.subscribe("updateCopperStateByLeft",()=>{let e=[].concat(pt.getAllItem(),Xt.getAllItem(),Kt.getAllItem()),r=e.find(n=>n.type=="Copper Region"&&n.hiddenCopperResult),i=e.find(n=>n.type=="Copper Region"&&!n.hiddenCopperResult);if(r&&!i){let n=ze.getItems(),s=n.filter(l=>l instanceof He&&l.type=="Copper Region"?(l.visible(),!1):!0);s.length!=n.length&&A.publish("select",s);let a=Ri.getInstance().getItem(21);a.visible=!1,jt.flush()}else if(!r&&i){let n=Ri.getInstance().getItem(21);n.visible=!0,jt.flush()}}),A.subscribe("zoom",e=>{!R.getInstance().isactive||23==R.getInstance().doctype||(e=="in"?this.zoomIn():this.zoomOut(),A.publish("updateFrame",""))}),A.subscribe("flipBoard",this.flip.bind(this)),A.subscribe("ToggleCanvasBottomLayerBarStatus",e=>{!R.getInstance().isactive||23==R.getInstance().doctype||(we.isShowBottomLayerScrollBarShow=e)}),A.subscribe("autoTrimSilkscreen",this.toggleAutoTrimSilkscreen.bind(this)),A.subscribe("updateLastMousePosition",e=>{this.lastMousePosition=e}),A.subscribe("removeLoop",()=>{!R.getInstance().isactive||23==R.getInstance().doctype||(pr.removeLoop=!pr.removeLoop,we.removeLoop=pr.removeLoop,wi())}),A.subscribe("Absolute",this.absolute.bind(this)),A.subscribe("Relative",this.relative.bind(this)),A.subscribe("RelativeY",this.relativeY.bind(this)),A.subscribe("updateCross",this.updateCross.bind(this)),A.subscribe("updateCrossDirect",e=>{this.prepare(e)}),A.subscribe("showAndUpdateCross",e=>{this.showAndUpdateCross(e)}),A.subscribe("moveCrosshair",e=>{this.moveCrosshair(e)}),A.subscribe("destoryCanvasCross",()=>{this.destoryCanvasCross()}),A.messageBus.rpcService("getPcbCrossProbeToSchData",e=>{var n;let r=pD.getCrossProbeData(),i=(n=ze.getItems())==null?void 0:n.length;return{rule:r,hasSelected:i}}),A.subscribe("CheckAndNotifySchCrossProbe",e=>{ze.crossProbe(void 0,e.selectTabId)}),A.messageBus.subscribe("pcbCrossProbe",function(e){A.publish("updateFrame","");let r="[pcb]pcbCrossProbe";console.time(r);let{parts:i,pins:n,nets:s,pcbPlaceTransfer:a,otherData:l,partKey:c="Unique ID"}=e;if(!(l!=null&&l.isManualTrigger)&&!we.isCheckedCrossProbeMode)return;let h=[];n&&n.map(m=>{let g=m.pinNum.split(",");h.push(...g)});let u=[],d={},p=Ar.getAllItem();for(let m of p){let g=m.attrKeyValue[c];if(g!=null&&g!=""){let y=d[g];y==null&&(y=new Array,d[g]=y),y.push(m)}}if(i!=null&&i.length)for(let m of i){let g=d[m]||[];for(let y of g)y.click(),u.push(y)}if(n!=null&&n.length>0&&!a)for(let m of n){let g=m.groupUniqueId;if(!g)continue;let y=d[g]||[];for(let b of y){let P=b.getPads();for(let T of P)m.pinNum.split(",").includes(T.num)&&(T.click(),u.push(T))}}if(s!=null&&s.length){let m=Ye.getAllItem();Hn(m,(g,y)=>{let b=Array.from(y),P=b[0].net;s.indexOf(P)!==-1&&Hn(b,(T,I)=>{I.click(),u.push(I)})})}if(ze.clearSelect({tabId:R.getInstance().tabId}),Mt.cancelHightLightAll(),le.pcbConfig.isOtherObjectsDimDuringCrossProbe){let m=R.getInstance().isactive;R.getInstance().isactive=!0,A.publish("highLight","HIGHLIGHT_CANCELALL"),R.getInstance().isactive=m}if(!u.length)l!=null&&l.isManualTrigger&&!(l!=null&&l.isCrossProbeTool)&&A.publish("showPcbSlideMsg",["Can't find matching objects"],Q());else{let m=new Set,g=[];for(let y of u)if(y!=null&&!y.isEmpty){if(!Mt.checkIsCanEditByItem(y)){m.add(y);continue}g.push(y),y.click()}Mt.hightItems(Array.from(m)),A.publish("select",g),setTimeout(()=>{let y=null,b=new _e;if(g.forEach(P=>{b.ext1(P.buildBBox())}),m.forEach(P=>{b.ext1(P.buildBBox())}),b.valid()){let P=R.getInstance().isactive;R.getInstance().isactive=!0,y=b.build1(),le.pcbConfig.isAutoMoveCanvasDuringCrossProbe&&A.publish("adaptBBox_OnlyMove",y),le.pcbConfig.isAutoFitSelectionDuringCrossProbe&&A.publish("adaptBBox",y),le.pcbConfig.isOtherObjectsDimDuringCrossProbe&&A.publish("highLight","HIGHLIGHT_SELECTED_OBJECTS"),R.getInstance().isactive=P}if(g.length&&a&&!R.getInstance().isReadOnlyMode){let P=R.getInstance().isactive;R.getInstance().isactive=!0,ba=y.center(),A.publish("toggle",{command:"batchMoveItem",refer:new k2(g,ba.x,ba.y),menu:"MOVE_BY_CENTER_POINT",pcbPlaceTransfer:a}),R.getInstance().isactive=P}if(!a){let P;g.length==1&&!m.size?P=g[0].buildBBox().center():!g.length&&m.size==1&&(P=Array.from(m)[0].buildBBox().center()),P&&(ql.show(P),ql.click(),clearTimeout(this.timer),this.timer=setTimeout(()=>{ql.remove(),A.publish("updateFrame","")},1e3))}A.publish("updateFrame","")},0)}console.timeEnd(r)}),A.subscribe("clearSelected",function(){A.publish("clearSelect",""),A.publish("flushService","")}),A.subscribe("refreshNextTool",this.refreshNextTool.bind(this)),A.subscribe("main2iframe/trigger-event",e=>{var y;let{type:r,button:i,buttons:n,clientX:s,clientY:a}=e[0]||{},{x:l,y:c,width:h,height:u,top:d,bottom:p,left:m,right:g}=((y=window.frameElement)==null?void 0:y.getBoundingClientRect())||{};(i===1||n&4)&&r==="mouseup"&&this.onMouseMidUp(this.inputInfo),(i===1||n&4)&&r==="mousemove"&&(fi.getInstance().mouseX=(s-m)*this.getRatio(),fi.getInstance().mouseY=(a-d)*this.getRatio(),this.onMouseMove(fi.getInstance()),A.publish("updateFrame",""))}),A.subscribe("from/ui/canvas/scale",({scale:e})=>{this.camera.setScale(e),A.publish("updateFrame","")}),A.subscribe("showAndUpdateCross2Pcb",e=>{let{x:r,y:i}=e,n=new _e;n.ext5(r-100,r+100,i-100,i+100),this.adaptAll(n.build1(),.6,void 0,!0);let s=fi.getInstance();s.sceneX=r,s.sceneY=i,this.showAndUpdateCross(s),A.publish("updateModify",""),setTimeout(()=>{A.publish("destoryCanvasCross",""),A.publish("updateModify","")},1e3)},Q())}get lastMousePosition(){return this._lastMousePosition==null?(this._lastMousePosition=R.getInstance().origin,this._lastMousePosition):this._lastMousePosition}set lastMousePosition(e){this._lastMousePosition=e}getRatio(e=1){return R.getInstance().getRatio()}setNextTool(e){this.nextTool=e,fi.getInstance().hovering=!1,di.currentCanUndoTool=e.getCanUndo()}getNextTool(){return this.nextTool}updateCross(){this.onMouseMove(fi.getInstance())}showAndUpdateCross(e){let r=le.themeConfig.canvasTheme.cursorColor;if(this.nextTool!=null&&this.nextTool instanceof Oo&&le.pcbConfig.crossCursor!="None"){let i=this.computeLength(new Dt(e.mouseX,0,0),e),n=this.computeLength(new Dt(e.mouseX,-e.canvasHeight,0),e),s=this.computeLength(new Dt(0,e.mouseY,0),e),a=this.computeLength(new Dt(e.canvasWidth,e.mouseY,0),e);if(le.pcbConfig.crossCursor==="Small"){let c=30/this.camera.getScale();i=new Dt(e.sceneX,e.sceneY+c,0),n=new Dt(e.sceneX,e.sceneY-c,0),s=new Dt(e.sceneX-c,e.sceneY,0),a=new Dt(e.sceneX+c,e.sceneY,0)}if(this.mark.length==0){let l=le.themeConfig.canvasTheme,c=l.isSolidLine(l.cursorLineStyle),h=new cr(1002,new S(e.sceneX,i.y),new S(e.sceneX,n.y),c,r),u=new cr(1002,new S(s.x,e.sceneY),new S(a.x,e.sceneY),c,r);this.mark.push(h),this.mark.push(u)}else this.mark[0].start=new S(e.sceneX,i.y),this.mark[0].end=new S(e.sceneX,n.y),this.mark[1].start=new S(s.x,e.sceneY),this.mark[1].end=new S(a.x,e.sceneY)}else this.mark.length!=0&&(this.mark[0].remove(),this.mark[1].remove(),this.mark.length=0);this.mark.forEach(i=>{i.color=r})}destoryCanvasCross(){this.mark.length!=0&&(this.mark[0].remove(),this.mark[1].remove(),this.mark.length=0)}highlightError({globalIndex:e,objs:r,pos:i,needAdaptAll:n}){let l=new ht(i.x-5,i.x+5,i.y-5,i.y+5);n?this.adaptAll(l,.6):this.locationMapItem(l),this.highlightItems({globalIndexArr:r,needAdaptAll:!1}),Bo.highlightError(e),A.publish("updateFrame","")}highlightItems({globalIndexArr:e,needAdaptAll:r,noNeedCrossLine:i,isHighlight:n}){if(!R.getInstance().isactive||23==R.getInstance().doctype||(Wo.unHighlightAll(),Bo.unHighlightAll(),Mt.cancelHightLightAll(),ze.highlight.cancelHighlightUnselect(),n&&R.getInstance().doctype==3&&ze.highlight.unhighLigthAll(),A.publish("clearSelect",""),e.length==0))return;let s=new Jt,a=[],l=new Set,c=new _e,h=!1,u=new Set,d=!0;if(e.forEach(p=>{let m,g;typeof p=="object"?p.start&&p.end&&p.net?m=Wo.getRatlineByNetName(p.net).filter(I=>I.startNode.globalIndex==p.start&&I.endNode.globalIndex==p.end)[0]:p.id&&p.visible!=null&&(g=p.id,d=p.visible):g=p;let y=Ht.getItem(g),b=s.getItem(g);if(!b&&g&&(b=y),b&&!Mt.checkIsCanEditByItem(b)){u.add(b);return}let P;if(m)h=!0,Hu.getNet(m.net).showRatline&&(m.click(),a.push(m));else if(y)y.getItems().forEach(T=>{c.ext1(T.buildBBox()),a.push(T),T.click()});else{if(P=s.getItem(g),!P)return;P instanceof Gi&&Pe.setActiveLayer(Pe.getLayer(P.layerId));let T=new Set([P]);n&&R.getInstance().doctype==3&&R.getInstance().forceVisibleHighLightPt&&R.getInstance().forceVisibleHighRange||(T=jt.filter([P])),c.ext1(P.buildBBox()),T.size>0&&d&&(P instanceof ke&&P.attributes.forEach(I=>{I.key&&(I.showKey||I.showValue)&&c.ext1(I.buildBBox())}),!(P.getParent()instanceof ke)||P instanceof Le||P instanceof lr&&P.key?(a.push(P),P.click()):l.add(P.globalIndex))}}),c.valid()&&d&&(r?this.adaptAll(c.build1(),.6,h?Number.MAX_SAFE_INTEGER:7):this.locationMapItem(c.build1())),e.length==1&&!i){let p=typeof e[0]=="object"?e[0].id:e[0],m=s.getItem(p)||Ht.getItem(p);if(!m)return;ql.show(m.buildBBox().center()),ql.click(),clearTimeout(this.timer),this.timer=setTimeout(()=>{ql.remove(),A.publish("updateFrame","")},1e3)}n&&R.getInstance().doctype==3&&a.forEach(p=>{ze.highlight.addHightItem(p)}),Mt.hightItems(Array.from(u)),A.publish("select",a),ze.highlight.highlightUnselect(l),this.moveCrosshair(fi.getInstance()),A.publish("updateFrame",""),ze.crossWindow(),ze.mouseSelectedForAPI()}absolute(e){if(!(!R.getInstance().isactive||23==R.getInstance().doctype)&&e.length==3){let r=L3(parseFloat(e[1])),i=L3(parseFloat(e[2]));this.click4Command(r+R.getInstance().origin.x,i+R.getInstance().origin.y,"absolute")}}relative(e){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;if(ze.getSelects().length>1)if(e.length===3)this.relative4MultiMove(+e[1],+e[2]);else if(e.length===2)this.relative4MultiMove(+e[1],0);else return;else{let i=0,n=0;if(e.length===3)i=L3(parseFloat(e[1])),n=L3(parseFloat(e[2]));else if(e.length===2)i=L3(parseFloat(e[1]));else return;let s=this.lastMousePosition.x+i,a=this.lastMousePosition.y+n;this.click4Command(s,a,"relative")}}relativeY(e){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;if(ze.getSelects().length>1)if(e.length===2)this.relative4MultiMove(0,+e[1]);else return;else{let i=0,n=0;if(e.length===2)n=L3(parseFloat(e[1]));else return;let s=this.lastMousePosition.x+i,a=this.lastMousePosition.y+n;this.click4Command(s,a,"relative")}}click4Command(e,r,i){let n=new fi(Ai().getWidth(),Ai().getHeight()),s=le.pcbConfig.snapToOriginWhileDragFootprint,a=le.pcbConfig.snapToOriginWhileDragFootprint;i=="relative"?(le.pcbConfig.snapToOriginWhileDragFootprint=!1,le.pcbConfig.snapToCenterWhileDragPadOrVia=!1):(le.pcbConfig.snapToOriginWhileDragFootprint=!0,le.pcbConfig.snapToCenterWhileDragPadOrVia=!0);let l=this.adsorb;this.adsorb=!1,this.update4Click(n,this.lastMousePosition.x,this.lastMousePosition.y),n.leftDown=!0,this.handler(c=>{c.onMouseLeftDown(n)}),this.update4Click(n,e,r),this.handler(c=>{c.onMouseMove(n)}),this.lastMousePosition=new S(e,r),this.handler(c=>{c.onMouseLeftUp(n)}),this.updateMousePosition(n),this.moveCrosshair(n),A.publish("updateFrame",""),n.removePoint(),le.pcbConfig.snapToOriginWhileDragFootprint=s,le.pcbConfig.snapToCenterWhileDragPadOrVia=a,this.adsorb=l}zoomIn(){this.setScale(jq)}zoomOut(){this.setScale(1/jq)}highlightNet({nets:e,needAdaptAll:r,isHighlight:i,globalIndex:n}){let s=new Set;Wo.highlightByNets(e,!1),i&&R.getInstance().doctype==3&&ze.highlight.unhighLigthAll();let a={eventType:"selected",props:e.map(h=>({net:h}))};if(A.windowBridge.publish("leftTree-net",a,Q()),e.forEach(h=>{Ye.getSameNetItemsWithoutPourAndPlaneZone(h.toUpperCase()).forEach(d=>{s.add(d)})}),n){let u=new Jt().getItem(n);s.add(u)}i&&R.getInstance().doctype==3&&(!R.getInstance().forceVisibleHighLightPt||!R.getInstance().forceVisibleHighRange)&&(s=jt.filter(s));let l=Array.from(s),c=new Set;if(l=l.filter(h=>Mt.checkIsCanEditByItem(h)?!0:(c.add(h),!1)),l.length>0||c.size>0){let h=new _e;l.forEach(u=>{u.click(),h.ext1(u.buildBBox()),h.valid()&&(r?this.adaptAll(h.build1(),.6):this.locationMapItem(h.build1())),l.length==1&&(ql.show(u.buildBBox().center()),ql.click(),clearTimeout(this.timer),this.timer=setTimeout(()=>{ql.remove(),A.publish("updateFrame","")},1e3))}),i&&R.getInstance().doctype==3&&l.forEach(u=>{ze.highlight.addHightItem(u)}),Mt.cancelHightLightAll(),Mt.hightItems(Array.from(c)),A.publish("select",l),A.publish("updateFrame","")}}onKeyDown(e){this.prepare(e),ZS.getInstance().refreshInputEnv(this.inputInfo);let r=di.getScene(),i=tr.getAction(r,e);if(!i){let n=Xq.getHotkeyInfo(r,e);n&&A.publish("Pcb/ui_hotkey",{function:n.uiAction,key:n.uiAction,cmd:"",keyStr:n.hotKey,keyCode:e.keyCode,funcE:""},Q())}if(i!=null)switch(i){case"convertToLineFromBoard":{rhe();break}case"place":{(this.nextTool&&this.nextTool instanceof ni||this.nextTool instanceof Vc||this.nextTool instanceof zG||this.nextTool instanceof kD||this.nextTool instanceof y5||this.nextTool instanceof pE||this.nextTool instanceof c_||this.nextTool instanceof YG||this.nextTool instanceof I5)&&this.nextTool.onEnterPlace(e);break}case"decrease_snap_size":{let n=qS(),s=n.snapX*10-1,a=n.snapY*10-1,l=(s<1?s+1:s)+"mil",c=(a<1?a+1:a)+"mil";A.publish("SnapSizeSetting",{snapX:l,snapY:c});break}case"increase_snap_size":{let n=qS(),s=n.snapX*10+1+"mil",a=n.snapY*10+1+"mil";A.publish("SnapSizeSetting",{snapX:s,snapY:a});break}case"select_net":{ze.selectNet();break}case"Fit All in Window":{A.publish("adaptAll","");break}case"Single Routing":{if(R.getInstance().doctype==3){A.publish("tool","draw(track)");return}break}case"MultiRouting":{if(R.getInstance().doctype==3){A.publish("tool","draw(multiTrack)");return}break}case"Save":{A.windowBridge.rpcCall("save",{tabId:R.getInstance().tabId},Q());break}case"close_tab":{A.publish("Pcb/doCommand","close_tab",Q());break}case"close_all_tabs":{A.publish("Pcb/doCommand","close_all_tabs",Q());break}case"toolbar_toggle(leftbar)":{A.publish("Pcb/doCommand","toolbar_toggle(leftbar)",Q());break}case"toolbar_toggle(rightbar)":{A.publish("Pcb/doCommand","toolbar_toggle(rightbar)",Q());break}case"switchNextDoc":{A.publish("Pcb/doCommand","switchNextDoc",Q());break}case"switchPreDoc":{A.publish("Pcb/doCommand","switchPreDoc",Q());break}case"switchNextDocByNatural":{A.publish("Pcb/doCommand","switchNextDocByNatural",Q());break}case"switchPreDocByNatural":{A.publish("Pcb/doCommand","switchPreDocByNatural",Q());break}case"draw(origin)":{A.publish("Pcb/doCommand","draw(origin)",Q());break}case"setOriginByCoordinate":{A.publish("Pcb/doCommand","setOriginByCoordinate",Q());break}case"SaveAll":{A.publish("saveAll","",Q());break}case"OperateBottomPanel":{A.publish("operateBottomPanel","",Q());break}case"DrawArc":{A.publish("tool","draw(arc)");break}case"draw(arcCenter)":{A.publish("tool","draw(arcCenter)");break}case"DrawRect":{A.publish("tool","draw(rect)");break}case"DrawCircle":{A.publish("tool","draw(circle)");break}case"DrawPolyline":{A.publish("tool","draw(Line)");break}case"placePad":{A.publish("tool","PlaceSinglePad");break}case"Show Or Hide Number Or Net Name":{VD.toggleAllStateLoop();break}case"placeOriginCenter":{A.publish("placeOrigin","center");break}case"ShowTextDialog":{A.publish("getLastText","");break}case"Stretch Track":{if(R.getInstance().doctype==3){A.publish("tool","draw(stretchtrack)");return}break}case"draw(difftrack)":{if(R.getInstance().doctype==3){A.publish("tool","draw(difftrack)");return}break}case"equalLengthTuning":{if(R.getInstance().doctype==3){A.publish("equalLengthTuning","");return}break}case"Place Via":{if((R.getInstance().doctype==3||R.getInstance().doctype==4)&&!(this.nextTool instanceof vo&&this.nextTool.drawing)&&!(this.nextTool instanceof vo&&this.nextTool.drawing)){ze.parse({cmdKey:"ADD:ADDWITH_VIA"});return}break}case"PlaceViaFence":{if(R.getInstance().doctype==3){A.publish("openMainDialog",{cmd:12,data:{}});return}break}case"Switch Layer Brightness":{A.publish("layerNeedGray","");break}case"Find and Replace":{A.publish("doCommand_ui",["findObjects"],Q());break}case"Zoom In":{this.markZoomCenter({positionX:e.mouseX,positionY:e.mouseY},e),this.zoomIn();break}case"Zoom Out":{this.markZoomCenter({positionX:e.mouseX,positionY:e.mouseY},e),this.zoomOut();break}case"Flip Board":{this.flip();break}case"Measure Distance":{A.publish("tool","MeasureDistance");break}case"creepageDistance":{A.publish("tool","CreepageDistance");break}case"Copy Special":{A.publish("tool","copySpecial");break}case"Place Single Pad":{A.publish("tool","PlaceSinglePad");break}case"Place Test Point":{A.publish("tool","place_part(testPad)");break}case"Rebuild All Copper Area":{A.publish("rebuildCopper",{isManual:!0}),A.publish("rebuildPlane",{isManual:!0});break}case"ChangeCopperZoneVisibleorInvisible":{jt.setVisible(21,!jt.getVisible(21)),A.publish("flushSelectingInfo",""),bh.type&&A.publish("FlushSketcherAttrView",{type:bh.type}),rE();break}case"DisplayAllLayers":{A.publish("DisplayLayer",["DisplayLayer","all"]);break}case"OpenProject":{A.publish("Pcb/doCommand","openProject",Q());break}case"tutorials":{A.publish("Pcb/doCommand","tutorials",Q());break}case"NewProject":{A.publish("Pcb/doCommand","new_project",Q());break}case"fullScreen":{A.publish("doCommand_ui",["fullScreen",{keyCode:e.keyCode}],Q());break}case"Unit":{R.getInstance().unit=="mil"?eC("mm"):eC("mil");break}case"Command":{A.publish("Pcb/doCommand","command-tool",Q());break}case"ChangetoTopLayer":{A.publish("toggleLayerSelected",{layerid:1});break}case"ChangetoBottomLayer":{A.publish("toggleLayerSelected",{layerid:2});break}case"ChangetoInner1":{A.publish("toggleLayerSelected",{layerid:15});break}case"ChangetoInner2":{A.publish("toggleLayerSelected",{layerid:16});break}case"ChangetoInner3":{A.publish("toggleLayerSelected",{layerid:17});break}case"ChangetoInner4":{A.publish("toggleLayerSelected",{layerid:18});break}case"ChangetoInner5":{A.publish("toggleLayerSelected",{layerid:19});break}case"ChangetoInner6":{A.publish("toggleLayerSelected",{layerid:20});break}case"Switch to the Next Signal Layer":{ze.nextSignalLayer("next");break}case"Switch to the Previous Signal Layer":{ze.nextSignalLayer("previous");break}case"Switch to the Next Layer":{ze.nextLayer("next");break}case"Switch to the Previous Layer":{ze.nextLayer("previous");break}case"Scroll Down":{r.indexOf(2)<0&&this.moveCamera1(0,this.getRulerScale());break}case"Scroll Up":{r.indexOf(2)<0&&this.moveCamera1(0,-this.getRulerScale());break}case"Scroll Right":{if(r.indexOf(2)<0){let n=It.getInstance().flip?-1:1;this.moveCamera1(-this.getRulerScale()*n,0)}break}case"Scroll Left":{if(r.indexOf(2)<0){let n=It.getInstance().flip?-1:1;this.moveCamera1(this.getRulerScale()*n,0)}break}case"CenterViewByCursor":{let n=new _e;n.ext5(e.realSceneX-100,e.realSceneX+100,e.realSceneY-100,e.realSceneY+100),this.adaptAll(n.build1(),.6,void 0,!0);break}case"DuplicateToCursor":{A.publish("duplicateToCursor","");break}case"DuplicateToOtherLayer":{A.publish("duplicateToOtherLayer","");break}case"changeRoutingMode":{A.publish("toggleRouteMode",Zt.getInstance().getNextMode());break}case"layerOptionsSet":{A.publish("openLayerManagerDialog","");break}case"DrawCircle":{A.publish("tool","draw(circle)");break}case"draw(dimension)":{A.publish("tool","draw(dimension)");break}case"draw(PCopper)":{A.publish("tool","draw(PCopper)");break}case"Unhighlight All":{A.publish("highLight","HIGHLIGHT_CANCELALL");break}case"toggleAdsorb":{A.publish("toggleAdsorb","");break}case"openMenu(#mm-common-file)":case"opensubmenu-move":case"opensubmenu-new":case"opensubmenu-import":case"opensubmenu-selectobj":case"opensubmenu-booleanoperation":case"opensubmenu-gridsize-pcb":case"opensubmenu-drawline":case"opensubmenu-dimension":case"opensubmenu-export":case"opensubmenu-recent":case"opensubmenu-pad":case"opensubmenu-duplicate":case"opensubmenu-delete":case"opensubmenu-gridtype-pcb":case"opensubmenu-snapsize":case"opensubmenu-ratline":case"opensubmenu-highlight-pcb":case"opensubmenu-suturevias":case"opensubmenu-boardoutline":case"opensubmenu-testPad":case"opensubmenu-saveas":case"copperRegion":case"fillRegion":case"opensubmenu-fpcStiffener":case"prohibitedRegion":case"opensubmenu-slotRegion":case"opensunmenu-3dShellOutline":case"opensubmenu-3DShellSideSlotRegion":case"opensubmenu-3DShell-Top_Bottom-SlotRegion":case"opensubmenu-3DShell-SideEntity":case"opensubmenu-3DShell-TopEntity":case"opensubmenu-unroute":case"opensubmenu-group":case"opensubmenu-offset":case"opensubmenu-align":case"opensubmenu-rotate":case"opensubmenu-flip":case"opensubmenu-canvasOrigin":case"opensubmenu-system":case"opensubmenu-schematic_symbol":case"opensubmenu-pcb_footprint":case"opensubmenu-panel":case"opensubmenu-routingWidth":case"opensubmenu-tabmenu":case"opensubmenu-distribute":case"opensubmenu-boardshape":case"importChangesFromSch":case"importChangesFromPcb":case"reuseTemplateLayoutAndRoute":case"viewPCBInformation":case"createAnnotation":case"placeDevice":case"pcbOptimizedPath":case"Split":case"Cutout":case"draw(RCutout)":case"draw(PCutout)":case"draw(CCutout)":case"avoidSlots":case"avoidPads":case"CONVERT_TO_PAD":case"CONVERT_TO_2D_LINE":case"CONVERT_TO_SLOT_REGION":case"CONVERT_TO_FILL_REGION":case"CONVERT_TO_COPPER_REGION":case"CONVERT_TO_PROHIBITED_REGION":case"CONVERT_TO_BOARD_OUTLINE":case"CONVERT_TO_CONSTRAINT_REGION":case"CONVERT_TO_D3_SHELL_OUTLINE":case"CONVERT_TO_D3_SHELL_SLOT_REGION":case"CONVERT_TO_D3_SHELL_ENTITY":case"CONVERT_TO_FPC_STIFFENER":case"drawpartition(Rectangle)":case"drawpartition(Circle)":case"drawpartition(Polygon)":case"OPEN_PARTITION_MANAGER":case"copyToImage":case"INCREASE_BRIGHTNESS":case"DECREASE_BRIGHTNESS":{this.openTopMenu({cmd:i},e);break}case"openMenu(#mm-common-edit)":{this.openTopMenu({cmd:"openMenu(#mm-common-edit)"},e);break}case"openMenu(#mm-common-view)":{this.openTopMenu({cmd:"openMenu(#mm-common-view)"},e);break}case"openMenu(#mm-common-place)":{this.openTopMenu({cmd:"openMenu(#mm-common-place)"},e);break}case"openMenu(#mm-common-design)":{this.openTopMenu({cmd:"openMenu(#mm-common-design)"},e);break}case"openMenu(#mm-common-route)":{this.openTopMenu({cmd:"openMenu(#mm-common-route)"},e);break}case"openMenu(#mm-common-layout)":{this.openTopMenu({cmd:"openMenu(#mm-common-layout)"},e);break}case"openMenu(#mm-common-tools)":{this.openTopMenu({cmd:"openMenu(#mm-common-tools)"},e);break}case"openMenu(#mm-common-fabrication2)":{this.openTopMenu({cmd:"openMenu(#mm-common-fabrication2)"},e);break}case"openMenu(#mm-common-advanced)":{this.openTopMenu({cmd:"openMenu(#mm-common-advanced)"},e);break}case"openMenu(#mm-common-order)":{this.openTopMenu({cmd:"openMenu(#mm-common-order)"},e);break}case"openMenu(#mm-common-settings)":{this.openTopMenu({cmd:"openMenu(#mm-common-settings)"},e);break}case"openMenu(#mm-common-help)":{this.openTopMenu({cmd:"openMenu(#mm-common-help)"},e);break}case"prioritizeObjectSelection":{if(bh.type==="DIST_MEASURE")switch(gh.measureMode){case"MeasureDistance":gh.measureMode="MeasureObjectDistance";break;case"MeasureObjectDistance":gh.measureMode="CreepageDistance";break;default:gh.measureMode="MeasureDistance";break}break}case"new_board":{A.publish("Pcb/doCommand","new_board",Q());break}case"new_PCB":{A.publish("Pcb/doCommand","new_PCB",Q());break}case"new_Panel":{A.publish("Pcb/doCommand","new_Panel",Q());break}case"new_schematic":{A.publish("Pcb/doCommand","new_schematic",Q());break}case"new_device":{let n={};n.cmd="new_device",n.args={docType:2},A.publish("Pcb/doCommand",n,Q());break}case"new_NetFlag":{let n={};n.cmd="new_device",n.args={docType:18},A.publish("Pcb/doCommand",n,Q());break}case"new_NetPort":{let n={};n.cmd="new_device",n.args={docType:19},A.publish("Pcb/doCommand",n,Q());break}case"new_Drawing":{let n={};n.cmd="new_device",n.args={docType:20},A.publish("Pcb/doCommand",n,Q());break}case"new_Non_Electronic":{let n={};n.cmd="new_device",n.args={docType:21},A.publish("Pcb/doCommand","new_schematic",Q());break}case"new_schematicLib":{A.publish("Pcb/doCommand","new_schematicLib",Q());break}case"new_footprint":{A.publish("Pcb/doCommand","new_footprint",Q());break}case"new_3D_model":{A.publish("Pcb/doCommand","new_3D_model",Q());break}case"new_CBB":{A.publish("Pcb/doCommand","new_CBB",Q());break}case"Paste":{this.nextTool instanceof ni&&!at.editingWhat&&A.publish("tool","PASTE");break}case"compareNetlist":{A.publish("doCommand_ui",["compareNetlist"],window.top);break}case"standard_edition_migration":case"projectSaveAsCloud":case"projectSaveAsLocal":case"docSaveAsCloud":case"docSaveAsLocal":case"backup":case"version_management":case"new_node":case"new_branch":case"recovery":case"cacheRecovery":case"importDXF":case"insertImage":case"importFile(easyeda)":case"file_open":case"importFile(altium)":case"importFile(eagle)":case"importFile(kicad)":case"importFile(pads)":case"importFile(protel)":case"importFile(ltspice)":case"importSes":case"importNetlist":case"exportBOM":case"pcb_fabrication":case"pcb_export_coordinate_file":case"export3DFile":case"export3DShellFile":case"openDxfExportDlg":case"export(filePdf)":case"exportTestPointReport":case"exportManufacturingFilesForOneClick":case"export(altium)":case"exportDSN":case"closeProject":case"clearRecentList":case"source(easyEDA)":case"MOVE_BY_ORIGIN_POINT":case"delete-target":case"delete-all":case"continuousSelection":case"rectangleOutside":case"rectangleInside":case"polygonInside":case"polygonOutside":case"lineTouched":case"connectedCopper":case"editArray":case"ADD_FILLET":case"ADD_CHAMFER":case"unlockAll":case"switchVersion":case"historicalRecords":case"connectPads":case"bom_order_parts":case"orderPCB":case"order3DShell":case"show_help_file(part_store)":case"show_help_file(pcb_manu_facturing)":case"show_help_file(3d_cnc)":case"Preview2D":case"Preview3D":case"Preview3DInNewWindow":case"fitview":case"adaptSelectionView":case"adaptAreaSelectionView":case"fitBoard":case"switchView(normal)":case"switchView(outline)":case"brightness(0)":case"brightness(1)":case"brightness(2)":case"gridSnapKeepRatio":case"setGridSize":case"setGridRange":case"switchGridType(outlets)":case"switchGridType(none)":case"hideSelectedComponentRatline":case"hideAllRatline":case"showSelectedComponentRatline":case"showAllRatline":case"HIGHLIGHT_COMPONENT":case"HIGHLIGHT_SELECTED_OBJECTS":case"HIGHLIGHT_CANCEL_COMPONENT":case"HIGHLIGHT_CANCEL_SELECTED_OBJECTS":case"toolbar_toggle(topbar)":case"boolIntersection":case"boolAggregate":case"boolSubtraction":case"boolExclusive":case"boolSplit":case"draw(rectSutureVia)":case"draw(polygonSutureVia)":case"draw(lineSutureVia)":case"place_part(line_pads)":case"place_part(rect_pads)":case"draw(ROutline)":case"draw(POutline)":case"draw(COutline)":case"draw(RCopper)":case"draw(CCopper)":case"draw(RRegion)":case"draw(PRegion)":case"draw(CRegion)":case"draw(RectFPCStiffener)":case"draw(CirFPCStiffener)":case"draw(PolyFPCStiffener)":case"draw(RSlot)":case"draw(PSlot)":case"draw(CSlot)":case"draw(RProhibit)":case"draw(PProhibit)":case"draw(CProhibit)":case"draw(arc2)":case"place_part(testPad)":case"place_part(autoTestPad)":case"showTextDialog_pcb":case"draw(protractor)":case"draw(radius)":case"place_part(stack_table)":case"place_part(drill_table)":case"placeOriginPad":case"draw(R3dShellOutline)":case"draw(C3dShellOutline)":case"draw(P3dShellOutline)":case"place_part(3dShellScrewPillar)":case"draw(3dShellSideSlotDatumLine)":case"draw(R3dShellSideSlotRegion)":case"draw(C3dShellSideSlotRegion)":case"draw(P3dShellSideSlotRegion)":case"draw(R3dShellTopSlotRegion)":case"draw(C3dShellTopSlotRegion)":case"draw(P3dShellTopSlotRegion)":case"draw(R3dShellSideEntity)":case"draw(C3dShellSideEntity)":case"draw(P3dShellSideEntity)":case"draw(R3dShellTopBottomEntity)":case"draw(C3dShellTopBottomEntity)":case"draw(P3dShellTopBottomEntity)":case"pcb_DRC":case"checkDRCCustom":case"clearErrors":case"toggleRealTimeDRC":case"ref_designator_annotate":case"netClassManager":case"differentialPairManager":case"equalLengthGroupManager":case"EditPadsPairGroupDialog":case"updateComponent":case"updateReuseBlock":case"trackWidthSetting(WIRING_WIDTH_FOLLOWRULES)":case"trackWidthSetting(WIRING_WIDTH_RULESSETTING)":case"trackWidthSetting(WIRING_WIDTH_INPUT)":case"removeLoop":case"autoTrimSilkscreen":case"unrouteClearConnect":case"unrouteClearNetwork":case"clearAllRoute":case"diffPairEqualLengthTuning":case"joinGroup":case"reuseLayoutRoute":case"ungroupAll":case"set-attr-text-position":case"swapLocation":case"flip2OppositeSide":case"absoluteOffset":case"relativeOffset":case"distribute_left_side_edge_equidistant":case"distribute_top_side_edge_equidistant":case"distribute_horizontal_by_center_distance":case"distribute_vertical_by_center_distance":case"distribute_horizontal_by_edges_distance":case"distribute_vertical_by_edges_distance":case"distribute":case"component_distribute_by_region":case"rotate_reference_point":case"fliph_reference_point":case"flipv_reference_point":case"smartSize":case"checkDimension":case"renumberPads":case"teardrop":case"openPanelizeDlg":case"removeUnusedPadDlg":case"log-tool":case"view3DModelManager":case"viewPinDelayManager":case"openPcbComparisonDlg":case"viewCopperAreaManager":case"openDeviceManager":case"openDeviceStandardizationTab":case"commonButtonsSetting(SYSTEM)":case"commonButtonsSetting(CATEGORY)":case"commonButtonsSetting(BASE_LIBRARY)":case"commonButtonsSetting(CANVAS)":case"commonButtonsSetting(OBJECT)":case"commonButtonsSetting(PCB_FOOTPRINT)":case"commonButtonsSetting(PCB_THEME)":case"commonButtonsSetting(PCB_COMM_GRID_SIZE)":case"commonButtonsSetting(PCB_COMM_TRACK_WIDTH)":case"commonButtonsSetting(PCB_COMM_VIA_SIZE)":case"commonButtonsSetting(ADSORPTION)":case"commonButtonsSetting(PANEL_CANVAS)":case"commonButtonsSetting(PANEL_THEME)":case"commonButtonsSetting(COMM_TYPEFACE)":case"commonButtonsSetting(DESIGN)":case"commonButtonsSetting(PROPERTY)":case"commonButtonsSetting(HOTKEY)":case"commonButtonsSetting(CUSTOM_TOOLBAR)":case"commonButtonsSetting(SAVE)":case"show_help_file(community)":case"show_help_file(contact)":case"show_about":case"printPDF":case"autoLayout":case"resetUniqueId":case"auto-routing":{!e.leftDown&&!e.rightDown&&A.publish("Pcb/doCommand",i,Q());break}case"pcbBatchFanout":A.publish("pcbBatchFanout","");break;case"checkERC":{!e.leftDown&&!e.rightDown&&A.publish("Pcb/doCommand","checkDRC",Q());break}case"stop_video_capture":{A.publish("Pcb/doCommand","stop_video_capture",Q());break}case"show_videocapture":{A.publish("Pcb/doCommand","show_videocapture",Q());break}case"EDIT BOUNDARY":{Bhe();break}}if(e.keyCode===27){at.destroy(),we.smartMode&&_s.exit();let n=$t.getInstance().close();if(A.publish("closeLastDialog","",Q()),n)return}else e.keyCode===49?A.publish("hiddenDebug",2):e.keyCode===50?A.publish("showDebug",2):e.keyCode===51?A.publish("hiddenDebug",3):e.keyCode===52?A.publish("showDebug",3):e.keyCode===53?A.publish("hiddenDebug",4):e.keyCode===54?A.publish("showDebug",4):e.keyCode===55?A.publish("hiddenDebug",5):e.keyCode===56?A.publish("showDebug",5):e.shiftKey&&(this.shiftControl(e),this.nextTool instanceof Oo&&!(this.nextTool instanceof C5&&e.ctrlKey)&&this.canMouseMove&&this.nextTool.onMouseMove(e));this.handler(n=>{n.onKeyDown(e)})}onKeyUp(e){this.handler(r=>{r.onKeyUp(e)}),e.keyCode===16&&this.canMouseMove&&this.onMouseMove(e)}onMouseLeave(e){this.prepare(e),ZS.getInstance().ending(),this.nextTool instanceof Vc&&this.nextTool.onMouseLeave(e)}onMouseOut(e){this.prepare(e)}getRulerScale(){let e=1,r=new dt;R.getInstance().unit!="mil"&&(e=r.conversion(R.getInstance().unit,"mil",1));let i=this.camera.getScale(),n=e*i,s=0,a=n;for(;;)if(n>=1){if(n=n/10,n<1)break;s++}else if(n=n*10,s--,n>=1)break;let l=a/Math.pow(10,s);return l>=1&&l<2?10/Math.pow(10,s):l>=2&&l<5?5/Math.pow(10,s):2/Math.pow(10,s)}openCommandDialog(){A.publish("openMainDialog",{cmd:11})}onMouseRightDown(e){this.isMouseMidDown=!1,e.middleDown=!1,this.inputInfo=e,e.rightDown=!0,this.canMouseMove=!1,this.prepare(e),this.mouseX=e.mouseX,this.mouseY=e.mouseY,e.realSceneDeltaX=0,e.realSceneDeltay=0,e.openMenu=!0,e.downTime=new Date().getTime(),this.isMouseRightDown=!0,this.prevRightX=e.mouseX,this.prevRightY=e.mouseY,this.hideRightMenu(),ZS.getInstance().ending(),this.handler(r=>{r.onMouseRightDown(e)}),A.publish("iframe2main/trigger-event",{type:"mouseRightDown"},Q()),A.publish("CancelDelayAutoAdaptAll","")}onMouseRightUp(e){this.prepare(e),this.isMouseRightDown=!1,this.handler(r=>{r.onMouseRightUp(e)}),e.rightDown=!1,e.openMenu=!1,this.inputInfo=null,A.publish("iframe2main/trigger-event",{type:"mouseRightUp"},Q())}onMouseLeftDown(e){this.isMouseMidDown=!1,e.middleDown=!1,this.inputInfo=e,this.canMouseMove=!1,this.mouseX=e.mouseX,this.mouseY=e.mouseY,this.prepare(e),this.lastMousePosition=new S(e.sceneX,e.sceneY),e.leftDown=!0,e.leftClick=!0,e.downTime=new Date().getTime(),this.nextTool instanceof Vc&&(this.lastClickX=e.sceneX,this.lastClickY=e.sceneY),this.updateMousePosition(e),ZS.getInstance().ending(),this.handler(r=>{r.onMouseLeftDown(e)}),A.publish("iframe2main/trigger-event",{type:"mouseLeftDown"},Q()),A.publish("CancelDelayAutoAdaptAll","")}onMouseLeftUp(e){if(this.prepare(e),this.lastMousePosition=new S(e.sceneX,e.sceneY),ZS.getInstance().ending(),this.handler(r=>{r.onMouseLeftUp(e)}),!(this.nextTool instanceof Vc)&&(this.lastClickX=e.sceneX,this.lastClickY=e.sceneY,this.nextTool instanceof vo)){let r=this.nextTool.getShiftStartControl();r&&(this.lastClickX=r.x,this.lastClickY=r.y)}this.removeShiftMoveHelpLine(),e.leftDown=!1,e.leftClick=!1,e.clearCrossFlag(),this.inputInfo=null,A.publish("iframe2main/trigger-event",{type:"mouseLeftUp"},Q())}onMouseMidDown(e){e.rightDown||(this.inputInfo=e,this.isMouseMidDown=!0,this.canMouseMove=!1,this.mouseX=e.mouseX,this.mouseY=e.mouseY,this.prepare(e),e.realSceneDeltaX=0,e.realSceneDeltay=0,e.middleDown=!0,e.openMenu=!1,e.downTime=new Date().getTime(),this.prevMidX=e.mouseX,this.prevMidY=e.mouseY,e.clearCrossFlag(),ZS.getInstance().ending(),this.handler(r=>{r.onMouseWheel(e)}),A.publish("iframe2main/trigger-event",{type:"mouseMiddleDown"},Q()),A.publish("CancelDelayAutoAdaptAll",""))}onMouseMidUp(e){this.isMouseMidDown=!1,e&&(this.prepare(e),this.handler(r=>{r.onMouseRightUp(e)}),e.middleDown=!1,e.openMenu=!1,this.inputInfo=null,A.publish("iframe2main/trigger-event",{type:"mouseMiddleUp"},Q()))}onMouseMove(e){var h;let r=this,i=le.getSystemAutoPanning(),n=(h=i==null?void 0:i.type)==null?void 0:h.value,s=n&&n!="disabled",a=this.nextTool;s&&a&&(s=[Vc,ni,kD,pE].some(d=>a instanceof Vc?e.leftDown:a instanceof d));let l=!1;if(s){let u=ZS.getInstance(),d=u.getAutoPanningOptions(i);l=u.checking(e,d,()=>{c(!0)})}l||c(l);function c(u){u&&A.publish("updateFrame","");let d=new Date().getTime();if((Math.abs(e.mouseX-r.mouseX)>2||Math.abs(e.mouseY-r.mouseY)>2)&&(r.canMouseMove=!0),r.canMouseMove){if(r.isMouseRightDown&&!at.editingWhat){let p=e.mouseX-r.prevRightX,m=e.mouseY-r.prevRightY;r.camera.addOffset1(p,m),r.prevRightX=e.mouseX,r.prevRightY=e.mouseY}if(r.isMouseMidDown){if(le.getDragMiddleMouseButton()==="zoomCanvas"){let p=e.mouseY-r.prevMidY,m=1;p<0?m=Math.abs(p)/e.canvasHeight*3+1:p==0?m=1:m=1-Math.abs(p)/e.canvasHeight*3,m<=0&&(m=1),r.markZoomCenter({positionX:r.mouseX,positionY:r.mouseY},e),r.setScale(m),Ut.update(e,null),r.prevMidX=e.mouseX,r.prevMidY=e.mouseY}else if(le.getDragMiddleMouseButton()==="moveCanvas"&&(zu("grabbing"),!at.editingWhat)){let p=e.mouseX-r.prevMidX,m=e.mouseY-r.prevMidY;r.camera.addOffset1(p,m),r.prevMidX=e.mouseX,r.prevMidY=e.mouseY}}r.prepare(e),e.rightDown&&(Math.abs(e.mouseX-r.mouseX)>5||Math.abs(e.mouseY-r.mouseY)>5)?e.openMenu=!1:e.rightDown&&d-e.downTime<120?e.openMenu=!0:e.rightDown&&(e.realSceneDeltaX!=0||e.realSceneDeltay!=0)&&(e.openMenu=!1),e.leftDown&&d-e.downTime<120?e.leftClick=!0:e.leftDown&&(e.realSceneDeltaX!=0||e.realSceneDeltay!=0)&&(e.leftClick=!1),r.handler(p=>{p.onMouseMove(e)})}ze.dialog&&(ze.getItems().length>0?Ut.cancel():Ut.update(e,"Please select the elements to which you want to add ground vias."))}}onMouseWheel(e){if(this.prepare(e),ZS.getInstance().ending(),!(this.isMouseMidDown&&le.getDragMiddleMouseButton()==="zoomCanvas")){if(le.zoomType==="roller"){let r=Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.deltaY;e.ctrlKey?this.moveCamera(0,r):e.shiftKey?this.moveCamera(-r,0):Math.abs(e.deltaX)>Math.abs(e.deltaY)?this.moveCamera(-e.deltaX,0):this.scaleCanvas1(e)}else if(e.ctrlKey)this.scaleCanvas1(e);else if(e.shiftKey){let r=Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.deltaY;this.moveCamera(-r,0)}else this.moveCamera(-e.deltaX,e.deltaY);this.prepare(e),this.handler(r=>{r.onMouseWheel(e)}),A.publish("iframe2main/trigger-event",{type:"mouseWheel"},Q()),A.publish("CancelDelayAutoAdaptAll","")}}scaleCanvas(e){let r;e.deltaY<0?r=jq:r=1/jq,this.markZoomCenter({positionX:e.mouseX,positionY:e.mouseY},e),this.setScale(r),Ut.update(e,null),this.prepare(e)}needScale(e){let r=e.deltaX||0,i=e.deltaY||0;return e.detail&&!r&&!i&&(i=e.detail),{wheelX:r,wheelY:i}}scaleCanvas1(e,r=!1){let i=this.needScale(e);i&&this.scaleByWheel(i,e,r)}scaleByWheel(e,r,i=!1){let n,s=i?e.wheelX:e.wheelY,a=(jq-1)/100*Math.abs(s)+1;s<0?n=a:n=1/a,this.markZoomCenter({positionX:r.mouseX,positionY:r.mouseY},r),this.setScale(n),Ut.update(r,null),this.prepare(r)}onResize(e){let r=window.parent.document.getElementsByTagName("iframe"),i;for(var n=0;n<r.length;n++)if(r[n].src==location.href){i=r[n];break}let s=i==null?void 0:i.getBoundingClientRect(),a=!this.iframeLeftTopPosition.equals1(Qje),l=new S(s.x,s.y),c=S.ORIGIN;a&&(c=l.sub(this.iframeLeftTopPosition).mul(this.getRatio())),this.iframeLeftTopPosition=new S(s.x,s.y);let h=Ai().getWidth(),u=new S(Ai().getWidth(),Ai().getHeight());R.getInstance().resize();let d=Ai().getWidth(),m=new S(Ai().getWidth(),Ai().getHeight()).sub(u).mul(.5),g=new Dt(-m.x,m.y,0),y=new S(s.x,s.y);if(this.lastOffset!=null){let b=y.sub(this.lastOffset);(b.x<0&&d>h||b.x>0&&d<h)&&(g=new Dt(m.x,m.y,0))}this.lastOffset=y,a&&(e.mouseX!=null&&(e.mouseX-=c.x),e.mouseY!=null&&(e.mouseY-=c.y)),this.camera.addOffset1(g.x,-g.y)}adaptAll(e,r=1,i=Number.MAX_SAFE_INTEGER,n=!1){let s=e.center(),a=e.width(),l=e.height(),c=this.camera.getScale();if(c==0||a==0||l==0)return;let h=0,u=R.getInstance().openRuler?20:0,d=we.isShowBottomLayerScrollBarShow?40:24;r==1&&(h+=u,R.getInstance().doctype===4?h+=100:h+=20);let p=window.devicePixelRatio,m=(window.innerWidth*p-h)/a,g=(window.innerHeight*p-h-d)/l;m<=0&&(m=1),g<=0&&(g=1);let y=Math.min(m*r,g*r,i);y=Math.min(1e3,Math.max(y,.05)),y=y/c;let b=this.camera.getTarget();It.getInstance().flip&&(b=b.multiply4(Ae.flipY())),n&&(y=1);let P=s.x-u/2*this.getRatio()/(y*c),T=s.y+(u-d)/2*this.getRatio()/(y*c);Math.abs(P)>1e10&&(P=b.x),Math.abs(T)>1e10&&(T=b.y);let I=new Dt(P,T,0);this.camera.setTarget(I),this.camera.setScale(c*y),we.synchronize()}locationMapItem(e){let r=e.center(),i=R.getInstance().openRuler?20:0,n=we.isShowBottomLayerScrollBarShow?40:24,s=this.camera.getScale(),a=r.x-i/2*this.getRatio()/s,l=r.y+(i-n)/2*this.getRatio()/s,c=new Dt(a,l,0);this.camera.setTarget(c)}prepare(e){if(!e)return;e.lastSceneX=e.sceneX,e.lastSceneY=e.sceneY,e.hidePoint();let r=this.mouseRealOffset(e);e.realSceneDeltaX=r.x-e.realSceneX,e.realSceneDeltay=r.y-e.realSceneY,e.realSceneX=r.x,e.realSceneY=r.y,e.adsorb=this.adsorb,e.adsorbGrid=this.adsorb&&le.adsorptionConfig.getConfig("Grid Point"),gr.hasAlt=e.altKey;let i=!1;e.removeExtensionCord(),e.hovering=!1;let n=!0,s;if(this.adsorb){let{dragIsPolygon:a,dragItems:l}=gr.checkDragItemsIsPolygon(),[c,h,u]=this.adsorption(e,a,l);if(h&&h.length&&(n=!h.find(p=>p.adsorptionObj instanceof Ge||p.adsorptionObj instanceof Le||p.adsorptionObj instanceof Ue)),c.x==r.x&&c.y==r.y||this.nextTool!=null&&this.nextTool instanceof Vc&&!a){if(le.adsorptionConfig.getConfig("Grid Point")){let d=new S(e.realSceneX,e.realSceneY);r=ai.adsorpGrid(d)}}else if(r=c,this.nextTool!=null&&this.nextTool instanceof Oo&&(this.nextTool.drawing||a)){if(i=!0,l)for(let d of l)h=h.filter(p=>{let m=p.adsorptionObj;return p.adsorptionObj instanceof mt||p.adsorptionObj instanceof _t?(m=p.adsorptionObj.getParent(),m.globalIndex!==d.globalIndex):p.adsorptionObj instanceof rr?p.adsorptionObj.globalIndex!==d.globalIndex:p.adsorptionObj});for(let d of h)this.judgeAndAddCrossFlag(d.adsorptionObj,e,new S(d.position.x,d.position.y),d.rotation,a);u&&e.addExtensionCord(u)}s=c}if(this.nextTool!=null&&this.nextTool instanceof GG)if(!this.nextTool.started)r=this.editOutLineAdsorption(e,this.nextTool.profile);else{let a=this.editOutLineAdsorption(e,this.nextTool.profile,!0);a?(r=a,i=!0):r=r||this.mouseRealOffset(e);let l=!1,c=s?new S(s.x,s.y):new S(e.realSceneX,e.realSceneY);for(let h of this.nextTool.currentEditOutLine.primitives)if(h instanceof M?l=Fhe(h,c,this.nextTool.profile.strokeWidth):h instanceof q&&(l=Vhe(h,c,this.nextTool.profile.strokeWidth)),l){i=!0;break}}e.sceneDeltaX=r.x-e.sceneX,e.sceneDeltaY=r.y-e.sceneY,e.sceneX=r.x,e.sceneY=r.y,n&&this.snapExtendedLine(e),i&&e.showPoint(),this.shiftControl(e),this.updateMousePosition(e),this.moveCrosshair(e),ba=new S(e.sceneX,e.sceneY),we.realSynchronize(),this.camera.setScreenPosition(new S(e.mouseX-e.canvasWidth/2,e.canvasHeight/2-e.mouseY))}update4Click(e,r,i){if(!e)return;e.lastSceneX=e.sceneX,e.lastSceneY=e.sceneY,e.hidePoint();let n=new S(r,i);e.realSceneDeltaX=n.x-e.realSceneX,e.realSceneDeltay=n.y-e.realSceneY,e.realSceneX=n.x,e.realSceneY=n.y,e.adsorb=this.adsorb,e.adsorbGrid=this.adsorb&&le.adsorptionConfig.getConfig("Grid Point"),gr.hasAlt=e.altKey;let s=!1;e.removeExtensionCord(),e.hovering=!1;let a=!0;if(this.adsorb){let{dragIsPolygon:l,dragItems:c}=gr.checkDragItemsIsPolygon(),[h,u,d]=this.adsorption(e,l,c);if(u&&u.length&&(a=!u.find(m=>m.adsorptionObj instanceof Ge||m.adsorptionObj instanceof Le||m.adsorptionObj instanceof Ue)),h.x==n.x&&h.y==n.y||this.nextTool!=null&&this.nextTool instanceof Vc&&!l){if(le.adsorptionConfig.getConfig("Grid Point")){let p=new S(e.realSceneX,e.realSceneY);n=ai.adsorpGrid(p)}}else if(n=h,this.nextTool!=null&&this.nextTool instanceof Oo&&(this.nextTool.drawing||l)){if(s=!0,c)for(let p of c)u=u.filter(m=>{let g=m.adsorptionObj;return m.adsorptionObj instanceof mt||m.adsorptionObj instanceof _t?(g=m.adsorptionObj.getParent(),g.globalIndex!==p.globalIndex):m.adsorptionObj instanceof rr?m.adsorptionObj.globalIndex!==p.globalIndex:m.adsorptionObj});for(let p of u)this.judgeAndAddCrossFlag(p.adsorptionObj,e,new S(p.position.x,p.position.y),p.rotation,l);d&&e.addExtensionCord(d)}}e.sceneDeltaX=n.x-e.sceneX,e.sceneDeltaY=n.y-e.sceneY,e.sceneX=n.x,e.sceneY=n.y,a&&this.snapExtendedLine(e),s&&e.showPoint(),this.shiftControl(e),this.updateMousePosition(e),this.moveCrosshair(e),ba=new S(e.sceneX,e.sceneY),we.realSynchronize(),this.camera.setScreenPosition(new S(e.mouseX-e.canvasWidth/2,e.canvasHeight/2-e.mouseY))}shiftControl(e){if(e.shiftKey&&this.nextTool!=null&&this.nextTool instanceof Oo&&this.nextTool.drawing&&this.lastClickX!=null&&this.lastClickY!=null){let r=new S(e.sceneX,e.sceneY);if(this.nextTool instanceof C5&&e.ctrlKey)return;if(this.nextTool instanceof Ac){let i=this.overrideStart(new S(this.lastClickX,this.lastClickY),r,Math.abs(e.sceneX-this.lastClickX));e.sceneX=i.x,e.sceneY=i.y}else{let i=new S(this.lastClickX,this.lastClickY),n=r.sub(i);Math.abs(n.x)>=Math.abs(n.y)?e.sceneY=this.lastClickY:e.sceneX=this.lastClickX}}e.shiftKey&&this.lastClickY!=null&&this.lastClickX!=null&&this.nextTool!=null&&this.nextTool instanceof Oo&&this.nextTool.drawing?this.createShiftMoveHelpLine(new S(this.lastClickX,this.lastClickY),new S(e.sceneX,e.sceneY)):this.removeShiftMoveHelpLine()}snapExtendedLine(e){if(!(!e.adsorb||!le.adsorptionConfig.getConfig("Extended Line"))&&this.nextTool!=null&&(this.nextTool instanceof vo||this.nextTool instanceof hc)){let r=new S(this.lastClickX,this.lastClickY),i=r.x!==null&&r.y!==null,n=new S(e.realSceneX,e.realSceneY),s;if(this.nextTool instanceof hc){if(!this.nextTool.getFirstLine())return null;i||(r=this.nextTool.getFirstLine().start),s=this.nextTool.getFirstLine().end}else if(this.nextTool instanceof vo){let l=Rn.getInstance().current;if(l){let c=l.node,h=c.start.point,u=h.add(c.direct);r=h,s=u}else return null}let a=s?s.sub(r).angle(S.ORIGIN):null;return ai.getExtendedLinePointInfo(n,r,s,a,e,!0)}}judgeAndAddCrossFlag(e,r,i,n,s=!1){if(this.nextTool instanceof Oo&&(this.nextTool.drawing||s)&&!(this.nextTool instanceof vo||this.nextTool instanceof B3||this.nextTool instanceof B3||this.nextTool instanceof I5||this.nextTool instanceof FG)){let a=le.adsorptionConfig;if(e instanceof ke&&(a.getConfig("Footprint Origin")||a.getConfig("Footprint Center"))){let l=a.getConfig("Footprint Origin")?e.position:e.buildBBox().center();r.addCrossFlag(l,null)}if(e instanceof He&&a.getConfig("Region Center")){let l=e instanceof mt||e instanceof _t?e.getParent():e;if(l.type==="Slot Region"||l.type==="Fill Region"){let c=l.buildBBox().center();r.addCrossFlag(c,null)}}if(a.getConfig("Arc/Circle Center Point")&&(e instanceof _t||e instanceof Pr||e instanceof q||e instanceof rr))if(e instanceof rr){let l=e.getHoveredArc(r.sceneX,r.sceneY);l&&r.addCrossFlag(l.center,null)}else r.addCrossFlag(e.center,null);i&&!(e instanceof t8)&&!(e instanceof Ge&&!Od(e.start,i)&&!Od(e.end,i))&&r.addCrossFlag(i,n)}}moveCrosshair(e){if(le.pcbConfig.crossCursor==="None"){this.mark.length!=0&&(this.mark[0].remove(),this.mark[1].remove(),this.mark.length=0);return}let r=le.themeConfig.canvasTheme.cursorColor;if(this.nextTool!=null&&this.nextTool instanceof Oo&&(this.nextTool.drawing||le.pcbConfig.showCrossCursor)){let i=this.computeLength(new Dt(e.mouseX,0,0),e),n=this.computeLength(new Dt(e.mouseX,-e.canvasHeight,0),e),s=this.computeLength(new Dt(0,e.mouseY,0),e),a=this.computeLength(new Dt(e.canvasWidth,e.mouseY,0),e);if(le.pcbConfig.crossCursor==="Small"){let c=30/this.camera.getScale();i=new Dt(e.sceneX,e.sceneY+c,0),n=new Dt(e.sceneX,e.sceneY-c,0),s=new Dt(e.sceneX-c,e.sceneY,0),a=new Dt(e.sceneX+c,e.sceneY,0)}if(this.mark.length==0){let l=le.themeConfig.canvasTheme,c=l.isSolidLine(l.cursorLineStyle),h=new cr(1002,new S(e.sceneX,i.y),new S(e.sceneX,n.y),c,r),u=new cr(1002,new S(s.x,e.sceneY),new S(a.x,e.sceneY),c,r);this.mark.push(h),this.mark.push(u)}else this.mark[0].start=new S(e.sceneX,i.y),this.mark[0].end=new S(e.sceneX,n.y),this.mark[1].start=new S(s.x,e.sceneY),this.mark[1].end=new S(a.x,e.sceneY)}else this.mark.length!=0&&(this.mark[0].remove(),this.mark[1].remove(),this.mark.length=0);this.mark.forEach(i=>{i.color=r})}updateMousePosition(e){let r=R.getInstance().origin,i=new dt,n=(e.sceneX-r.x)*10,s=(e.sceneY-r.y)*10,a=(e.realSceneX-r.x)*10,l=(e.realSceneY-r.y)*10,c=(e.sceneX-this.lastMousePosition.x)*10,h=(e.sceneY-this.lastMousePosition.y)*10,u=this.camera.getScale(),d=R.getInstance().unit;R.getInstance().unit!="mil"&&(n=i.conversion("mil",R.getInstance().unit,n),s=i.conversion("mil",R.getInstance().unit,s),c=i.conversion("mil",R.getInstance().unit,c),h=i.conversion("mil",R.getInstance().unit,h)),n=ve(n,3),s=ve(s,3),c=ve(c,3),h=ve(h,3),A.publish("mouseAcoordinate",{mouseX:n,mouseY:s,realXMil:a,realYMil:l,deltaX:c,deltaY:h,scale:u,unit:d},Q()),this.updatePastePanelPosition(a,l)}updatePastePanelPosition(e,r){bh.type!=="PASTE"||a0.getInstance().isCursorChange||(a0.getInstance().mouseX=e,a0.getInstance().mouseY=r,A.publish("FlushSketcherAttrView",{type:"PASTE"}))}markZoomCenter(e,r){this.zoomCenter=new Dt(e.positionX,e.positionY,0)}moveCamera1(e,r){this.camera.addOffset(new Dt(-e,-r,0)),this.onMouseMove(fi.getInstance())}moveCamera(e,r){this.camera.addOffset1(e,-r),this.onMouseMove(fi.getInstance())}setScale(e){let r=this.camera.getScale();if(!isNaN(r)&&r!=0&&this.camera.scaleAtPoint1(e,this.zoomCenter.x,this.zoomCenter.y),at.startPoint){let n={show:!0,frameInfo:nf()};at.create(n,"",!0)}fi.getInstance().clearCrossFlag(),we.synchronize()}mouseRealOffset(e){let r=new Dt(e.mouseX,-e.mouseY,0),i=new Dt(e.canvasWidth/2,-e.canvasHeight/2,0);return r.sub(i).multiply4(this.camera.get2dCameraMatrix().inverse())}adsorption(e,r=!1,i=[]){if(di.dropDrag&&!r)return[new Dt(e.realSceneX,e.realSceneY,0)];let n=new S(e.realSceneX,e.realSceneY),{nonPolygonNodes:s,polygonNodes:a}=ai.filterNodes(n,this.nextTool,r,i),l=ai.drawingLines,c=e.getCrossFlags(),h=le.adsorptionConfig,u=le.adsorptionConfig.getSnapDistanceValue();if(s.length==0&&a.length==0&&c.length==0&&l.length==0){n=ai.adsorpGrid(n);let d=ai.filterNodes(n,this.nextTool,r,i);s=d.nonPolygonNodes,a=d.polygonNodes,l=ai.drawingLines,c=e.getCrossFlags(),h=le.adsorptionConfig}if(s.length==0&&a.length==0&&c.length==0&&l.length==0)return this.adsorptionAddFloatingInputBox(null,null),[new Dt(e.realSceneX,e.realSceneY,0)];{let d=u,p=n.bbox().extendOfSize(d),m,g=[],y=!1,b=[];for(let O of s)if(O.buildBBox().intersect(p))if([d,m,g,y]=this.getAdsorptionInfo(d,m,g,O,n),O instanceof ke){if(this.nextTool instanceof UD&&this.nextTool.getReuseComponents().find(x=>x.globalIndex==O.globalIndex))continue;this.judgeAndAddCrossFlag(O,e,void 0,void 0,r)}else(O instanceof He||O instanceof _t||O instanceof mt)&&(b.push(O),this.judgeAndAddCrossFlag(O,e,void 0,void 0,r));for(let O of a)O.buildBBox().intersect(p)&&this.judgeAndAddCrossFlag(O,e,void 0,void 0,r);let P=ai.getDrawingLinePointInfo(n,le.adsorptionConfig.getAdsorptionOutlines());P.distance&&P.distance<d?[d,m,g]=[P.distance,P.point,P.crossObjs.map(O=>({rotation:O.angle,adsorptionObj:O.adsorptionObj,position:P.point}))]:Od(m,P.point)&&g.push(...P.crossObjs.map(O=>({rotation:O.angle,adsorptionObj:O.adsorptionObj,position:m})));let T=[];if(h.getConfig("Intersection")){let O=b.reduce((_,x)=>(_[x.layerId]?_[x.layerId].push(x):_[x.layerId]=[x],_),{});Hn(O,(_,x)=>{T.push(...ai.getIntersectPoint(...x))})}for(let O of T){let _=u,{point:x,items:v}=O,D=Array.from(v)[0],w,F=D.primitive;F?w=F:w=D;let H=x.distance1(n);Od(m,x)?g.push({adsorptionObj:w,rotation:null,position:m}):y&&H<_?(_=H,[d,m,g]=[H,x,[{adsorptionObj:w,rotation:null,position:x}]]):!y&&H<d&&([d,m,g]=[H,x,[{adsorptionObj:w,rotation:null,position:x}]])}let I=[];for(let O of c){let{point:_,distance:x,line:v}=ai.getNearestCrossPointInfo(n,O);v&&m&&!I.length&&g.length&&g[0].adsorptionObj||(x<d?[d,m,g,I]=[x,_,[],v?[{line:v,cross:O}]:[]]:v&&I&&_.x===m.x&&_.y===m.y&&(Array.isArray(I)?I.push({line:v,cross:O}):I=[I,{line:v,cross:O}]))}let C=!1,E=ai.getCrossLineIntersectPointsInfo(c,this.getCanvasDiagonalLen(e));if(I.length){let O=u;for(let _ of E){let{point:x,lines:v}=_,D=x.distance1(n);D<O&&(O=D,m=x,I=Array.from(v),C=!0)}}if(g.length&&!g[0].adsorptionObj){if(!C){let O=ai.getCrossAndLineCenterIntersectPointsInfo(c,{prePosition:g[0].position,preRotation:g[0].rotation},this.getCanvasDiagonalLen(e)),_=u;for(let x of O){let v=x.distance1(n);v<_&&(_=v,m=x)}}g=[]}return this.adsorptionAddFloatingInputBox(m,I),m==null?[new Dt(e.realSceneX,e.realSceneY,0)]:[new Dt(m.x,m.y,0),g,I.length?I.map(O=>O.line):null]}}adsorptionAddFloatingInputBox(e,r=[]){if(e==null)at.id==="adsorption"&&at.destroy();else if(this.nextTool instanceof pE||this.nextTool instanceof w1||this.nextTool instanceof U2||this.nextTool instanceof dE||this.nextTool instanceof hc||this.nextTool instanceof wG||this.nextTool instanceof DG||this.nextTool instanceof MG||this.nextTool instanceof FD||this.nextTool instanceof VG||this.nextTool instanceof Ac||this.nextTool instanceof Vh||this.nextTool instanceof NG||this.nextTool instanceof kG||this.nextTool instanceof BG||this.nextTool instanceof jG){if(!r.length){if(at.id==="adsorption"){let n=at.data;if(!n||!n.data)return;let s=n.data[0];s.cursorPoint=e;let{cursorPoint:a,startPoint:l}=s;s.frameStartPoint=_o(l),s.frameCursorPoint=_o(a),s.info.value=je(new S(a.x-l.x,a.y-l.y).length()),at.create(n,"adsorption")}return}let i=!0;for(let n=1;n<r.length;n++)(r[n].line.start!==r[n-1].line.start||r[n].line.end!==r[n-1].line.end)&&(i=!1);if(i){let n=r[0].cross.position,s=e,a=nf(),l=_o(s),c=_o(n),h=new S(s.x-n.x,s.y-n.y).length(),u=10;if(at.id!=="adsorption"&&at.destroy(),u>=at.priority){at.priority=u;let d={data:[{startPoint:n,cursorPoint:s,frameStartPoint:c,frameCursorPoint:l,info:{type:"free",value:je(h),unit:R.getInstance().unit}}],type:"rect",show:!0,frameInfo:a};at.create(d,"adsorption")}}}}getCanvasDiagonalLen(e){return this.computeLength(new Dt(e.canvasWidth,e.canvasHeight,0),e).sub(this.computeLength(new Dt(0,0,0),e)).length()}padAdsorptionLayerIds(e){let r=new Array,i;if(e.layerId==12){for(let n of Pe.getAllEnableInnerLayers())if(!e.unusedInnerLayers.includes(n.layerID)){i=n.layerID;break}}if(e.layerId==12&&e instanceof _i&&e.type==2)if(ai.snapOnlyCurrentLayer()){let n=Pe.getActiveLayerID();n!=12&&r.push(n)}else r.push(1),e.topType=="ELLIPSE"?(e.bottomType=="ELLIPSE"&&e.topWidth==e.bottomWidth||r.push(2),i&&!(e.innerType=="ELLIPSE"&&e.topWidth==e.innerWidth)&&r.push(i)):e.topType=="OVAL"?(e.bottomType=="OVAL"&&e.topWidth==e.bottomWidth&&e.topHeight==e.bottomHeight||r.push(2),i&&!(e.innerType=="OVAL"&&e.topWidth==e.innerWidth&&e.topHeight==e.innerHeight)&&r.push(i)):e.topType=="RECT"&&(e.bottomType=="RECT"&&e.topWidth==e.bottomWidth&&e.topHeight==e.bottomHeight&&e.topRatio==e.bottomRatio||r.push(2),i&&!(e.innerType=="RECT"&&e.topWidth==e.innerWidth&&e.topHeight==e.innerHeight&&e.topRatio==e.innerRatio)&&r.push(i));else r.push(e.layerId==12?1:e.layerId);return r.filter(n=>n&&Pe.getLayer(n).layerStatus==1)}getAdsorptionInfo(e,r,i,n,s){let a=le.adsorptionConfig.getSnapDistanceValue(),l=!1;if(n instanceof Le||n instanceof Ue){let c=e,h=n.center.distance1(s);if(this.nextTool instanceof vo&&this.nextTool.getNextTool()){let d=!0;for(let p of i){let m=p.adsorptionObj;(m instanceof Le||m instanceof Ue)&&m.center.distance1(s)<h&&(d=!1)}d&&(c=Number.POSITIVE_INFINITY)}let u=new Array;if(n instanceof Le){if(le.adsorptionConfig.getConfig("Pad Center")&&u.push(n.center),le.adsorptionConfig.getConfig("Pad Vertices")&&!(this.nextTool instanceof vo)){let d=this.padAdsorptionLayerIds(n);for(let p of d){let m=n.getMathGraphics(p==12?1:p).primitives;for(let g of m){if(g instanceof q&&ne.eq(g.sweepAngle%360,0)){let y=g.rx,b=g.center;u.push(b.add1(y,0)),u.push(b.add1(-y,0)),u.push(b.add1(0,y)),u.push(b.add1(0,-y));continue}(g instanceof M||g instanceof q)&&(u.push(g.start()),u.push(g.midPoint))}}}}else u.push(n.center);for(let d of u){if(Od(r,d)){i.push({adsorptionObj:n,rotation:null,position:d});continue}h=d.distance1(s),h<=c&&(c=h,[e,r,i]=[h,d,[{adsorptionObj:n,rotation:null,position:d}]])}if(!r&&n instanceof Le&&le.adsorptionConfig.getConfig("Pad Edges")&&!(this.nextTool instanceof vo)){let d=this.padAdsorptionLayerIds(n),p=new Array;for(let m of d){let g=n.getMathGraphics(m==12?1:m).primitives;for(let y of g)y.bbox().extendSize(e).isContains(s)&&p.push(y)}for(let m of p){let g=ai.handleLineCenter(m.start(),m.end(),m,s,1,m instanceof M?m.end().sub(m.start()).angle(S.ORIGIN):0),y=g[0].point.distance1(s);y<e&&([e,r,i]=[y,g[0].point,[{adsorptionObj:null,rotation:g[0].rotation,position:g[0].point}]])}}}else if(n instanceof Ge){let c=n.primitive,h=new er(c,new M(s,s)).getDistance();h<e&&([e,r,i]=[h,ai.adsorpTrack(s,n),[{adsorptionObj:n,rotation:null,position:ai.adsorpTrack(s,n)}]])}else if(n instanceof Pr||n instanceof rr||n instanceof _t||n instanceof mt){let{point:c,distance:h,crossObjs:u}=ai.getNearestOutlineObjPointInfo(s,n,le.adsorptionConfig.getAdsorptionOutlines());if(Od(r,c))for(let d of u){let p=d.adsorptionType!=="Line Center";i.push({adsorptionObj:p?n:null,rotation:d.angle,position:r})}else if(h&&h<e&&i.length==0){l=!0;for(let d of u){let p=d.adsorptionType!=="Line Center";!p&&l&&(l=!1),h<a&&([e,r,i]=[h,c,i.concat({adsorptionObj:p?n:null,rotation:d.angle,position:c})])}}}return[e,r,i,l]}clearCrossFlag(){fi.getInstance().clearCrossFlag()}computeLength(e,r,i=1){let n=new Dt(r.canvasWidth/2,-r.canvasHeight/2,0);return e.sub(n).multiply4(this.camera.get2dCameraMatrix().inverse())}flip(){!R.getInstance().isactive||23==R.getInstance().doctype||(It.getInstance().flip=!It.getInstance().flip,this.camera.setCameraDirect(!It.getInstance().flip),A.publish("updateFrame",""),we.flipBoard=It.getInstance().flip,tn.destroy(),Pe.getAllLayer().forEach(e=>{e.order=e.order}),pd.DRCLayer.order=pd.DRCLayer.order,It.getInstance().flip?Pe.setActiveLayerId(2):Pe.setActiveLayerId(1),this.onMouseMove(fi.getInstance()))}toggleAutoTrimSilkscreen(){we.autoTrimSilkscreen=!we.autoTrimSilkscreen}createShiftMoveHelpLine(e,r){this.shiftMoveHelpLine?this.shiftMoveHelpLine.end=r:this.shiftMoveHelpLine=new cr(1002,e,r,!0)}removeShiftMoveHelpLine(){this.shiftMoveHelpLine&&(this.shiftMoveHelpLine.remove(),this.shiftMoveHelpLine=null)}clearClickPos(){this.flag&&(this.lastClickX=null,this.lastClickY=null)}overrideStart(e,r,i){let{x:n,y:s}=r.sub(e);return n>=0?e.add1(i,s>=0?i:-i):e.add1(-i,s>=0?i:-i)}refreshNextTool(){di.dropDrag||this.handler(e=>{e.onMouseMove(fi.getInstance())})}openTopMenu(e,r){let i=r,n=this.getRatio();e.args={clientX:i.mouseX/n,clientY:i.mouseY/n},A.publish("Pcb/doCommand",e,Q())}hideRightMenu(){A.publish("hideRightClickPcbMenu",{},Q())}relative4MultiMove(e,r){let i=ze.getSelects(),n=R.getInstance().unit,s=new S(na(e,n,"pixel"),na(r,n,"pixel"));Is.getInstance().init(i,"relative offset",(a,l)=>{_d.init(a,l,async(c,h)=>{if(new Zy(h,{movePadItSelf:!_d.moveWhole,saveHistory:!1}).execute(c,s),!_d.moveWhole){let d=new Set;c.forEach(m=>{if(m instanceof Le){let g=m.getParent();g instanceof ke&&d.add(g)}});let p=new Array;for(let m of d){h.addCommand4Item(m,"modify");let y=new ff().updateCustomFootprint(m,h.getCommand(),c.filter(b=>b.getParent()==m));p.push(y)}await Promise.all(p)}h.execute(),setTimeout(()=>{A.publish("selecting",{items:c}),A.publish("flushService","")},0),gr.refresh()})})}editOutLineAdsorption(e,r,i=!1){let n,s=new S(e.realSceneX,e.realSceneY),a=new Set(["Line Center","Arc/Circle Center Point","Region Center"]),l=le.adsorptionConfig.getAdsorptionOutlines().filter(h=>!a.has(h)),c=h=>({point:ai.getNearestOutlineObjPointInfo(s,h,["Line Center"]).point,tempPoint:ai.getNearestOutlineObjPointInfo(s,h,l).point});if(r instanceof lt){let h=r.getAllChildrens(),u=QEe(h,s);n=c(u)}else if(r instanceof sn){let h=new Po,u=[];for(let p of r.getChildrens().primitives){let m=h.ptToShape(p);u.push(m)}let d=QEe(u,s);n=c(d);for(let p of u)p.remove()}else n=c(r);return i&&!r.model.inShape(s.x,s.y)?s.distance1(n.point)<le.adsorptionConfig.getSnapDistanceValue()?n.point:null:n.tempPoint&&n.tempPoint.distance1(n.point)<=le.adsorptionConfig.getSnapDistanceValue()?n.tempPoint:n.point}};var jG=class extends ni{constructor(e,r){super();this.source=r;this.commandFactory=new De("push component");this._component=null;this.nearNodes=new Array;this.option="OPTIONLEFTUP",this.device=e,this.drawing=!0,this.updateTopMenuRotateStatus(!0),$n.setTool(this),Ea.changeTool(this);let i=fi.getInstance();this.start(),this.onMouseMove(i)}set component(e){this.filterItems.clear(),e!=null&&(this.filterItems.add(e),e.getItems().forEach(r=>{this.filterItems.add(r)})),this._component=e}get component(){return this._component}applyInputAtCursorValue(e){let{editing:r}=e;if(r){at.editingWhat="component";return}this.applyValue(e)}applyValue(e){let{value:r,cursorPoint:i,startPoint:n}=e;r=new dt().conversion(R.getInstance().unit,"mil",r/10);let a=new S(i.x-n.x,i.y-n.y).normalize();a=new S(a.x*r,a.y*r);let l=new S(a.x+n.x,a.y+n.y);this.place(l),at.destroy(),fi.getInstance().clearCrossFlag()}onKeyDown(e){switch(tr.getAction(5,e)){case"Cancel":this.cancel();break;case"Rotate Left":this.component!=null&&($n.rotate(this.component.position,le.pcbConfig.rotate,[this.component]),ut.footprintDefault.rotation+=le.pcbConfig.rotate);break;case"rotate_right":this.component!=null&&($n.rotate(this.component.position,-le.pcbConfig.rotate,[this.component]),ut.footprintDefault.rotation-=le.pcbConfig.rotate);break;case"Scroll Up":if(this.component!=null){let i=Ae.translate(0,It.getInstance().getSnapY(),0);this.changeInputInfo(e,i),A.publish("moveCrosshair",e),this.onMouseMove(e)}break;case"Scroll Down":if(this.component!=null){let i=Ae.translate(0,-It.getInstance().getSnapY(),0);this.changeInputInfo(e,i),A.publish("moveCrosshair",e),this.onMouseMove(e)}break;case"Scroll Left":if(this.component!=null){let i=It.getInstance().flip?-1:1,n=Ae.translate(-It.getInstance().getSnapX()*i,0,0);this.changeInputInfo(e,n),A.publish("moveCrosshair",e),this.onMouseMove(e)}break;case"Scroll Right":if(this.component!=null){let i=It.getInstance().flip?-1:1,n=Ae.translate(It.getInstance().getSnapX()*i,0,0);this.changeInputInfo(e,n),A.publish("moveCrosshair",e),this.onMouseMove(e)}break;case"flip2OppositeSide":this.flip();break}A.publish("updateFrame","")}changeInputInfo(e,r){let i=new S(e.sceneX,e.sceneY);i=i.multiply4(r),e.sceneX=i.x,e.sceneY=i.y}onMouseLeftUp(e){if(at.editingWhat)return;let r=new S(e.sceneX,e.sceneY);this.component===null||this.place(r)}place(e){if(le.pcbConfig.moveComponent=="block"&&!this.component.model.getGroupID()){let a=qy();t_(this.component,a)}if(!Mt.checkIsInCanEdit(this.component)){let a="beyond drawing range";Mt.showMassageTip(a,a);return}if(this.component.partition=R.getInstance().partitionId,!(le.pcbConfig.moveComponent=="block"&&!this.component.model.getGroupID())){let a=e.sub(this.component.position),l=Ae.translate(a.x,a.y,0);this.component.transform(l)}for(let a of this.nearNodes)a.clear();this.nearNodes.length=0,A.publish("hasModifyPcbItem",this.component),A.publish("onlySelect",[this.component]);let r=new De("draw component");if(r.addCommand(Ce.dispatch(this.component,"add")),le.pcbConfig.moveComponent=="push")for(let a of this.commandFactory.commands)r.addCommand(a);qe.executeCommand(r),this.uploadPlaceDeviceLog(),this.commandFactory=new De("push component"),A.publish("flushService",""),A.publish("deviceAdded",{globalIndex:this.component.globalIndex,name:this.component.name,attributes:{globalIndex:this.component.globalIndex,deviceName:this.component.name,pads:this.component.getPads().map(a=>({globalIndex:a.globalIndex,deviceName:this.component.name,num:a.num}))}},Q());let i=new E2,n=nr();this.component=i.build(this.device.createComponent(n),e),this.component.visible(),this.checkEnableLayer(),this.asycnConfig(this.component);let s=this.component.getPads();for(let a of s){if(a.net=="")continue;let l=new D1(a);this.nearNodes.push(l)}this.drawing=!0}onMouseMove(e){var i;let r=new S(e.sceneX,e.sceneY);if(A.publish("updateRtree",""),this.drawing)if(this.component!==null){this.component.layerId!=this.getLayer()&&(this.component.layerId=this.getLayer());let n=r.sub(this.component.position),s=Ae.translate(n.x,n.y,0);this.component.transform(s);for(let l of this.nearNodes)l.generateRatline();let a=qy();if(le.pcbConfig.moveComponent=="push"&&!this.component.model.getGroupID()){(i=this.commandFactory)==null||i.undo(),this.commandFactory=new De("push component");let l=new Map;l.set(this.component,0),mD(this.component,this.commandFactory,a,l),l.clear()}le.pcbConfig.moveComponent=="block"&&!this.component.model.getGroupID()&&t_(this.component,a)}else{let n=new E2,s=nr();this.component=n.build(this.device.createComponent(s),r),this.component.visible(),this.checkEnableLayer(),this.asycnConfig(this.component);let a=this.component.getPads();for(let l of a){if(l.net=="")continue;let c=new D1(l);this.nearNodes.push(c)}}}async checkEnableLayer(){let e=this.component,r=e.footprintUUID,i=e.getBasicLayerTable(),n={[r]:i},s=await _Se(n);if(!s)return;let{layerIdReplacementTableMapping:a}=s,l=a[r];e.setLayerIdReplacementTable(l)}asycnConfig(e){$n.rotate(this.component.position,ut.footprintDefault.rotation,[this.component]),e.attributes.forEach(r=>{let i=le.attributeConfig.getAttribute(r.key);i!=null&&(r.showKey=i.showKey,r.showValue=i.showValue)})}restore(){at.destroy(),this.component.remove();for(let e of this.nearNodes)e.clear();this.nearNodes.length=0,A.publish("delete",this.component),this.component=null,ut.footprintDefault.rotation=0,this.drawing=!0,A.publish("updateRtree","")}interrupt(){var e;if(this.component!==null){at.destroy(),this.component.remove();for(let r of this.nearNodes)r.clear();this.nearNodes.length=0,A.publish("delete",this.component),this.component=null,ut.footprintDefault.rotation=0,this.drawing=!1,A.publish("updateRtree",""),le.pcbConfig.moveComponent=="push"&&((e=this.commandFactory)==null||e.undo())}$n.setTool(null),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}getLayer(){let e=Pe.getActiveLayerID();return is(e)?2:1}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:Hje(e.adsorb).result};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"ROTATE":this.rotate(i[1]);break;case"TURNOVER":this.flip();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}translateComp(e){let r=e.sub(this.component.position),i=Ae.translate(r.x,r.y,0);this.component.transform(i)}rotate(e){if(this.component!=null&&(e==="rotate_left"&&($n.rotate(this.component.position,le.pcbConfig.rotate,[this.component]),this.translateComp(ba),ut.footprintDefault.rotation+=le.pcbConfig.rotate),e==="rotate_right"&&($n.rotate(this.component.position,-le.pcbConfig.rotate,[this.component]),this.translateComp(ba),ut.footprintDefault.rotation-=le.pcbConfig.rotate),e==="rotate_reference_point")){let r={x:this.component.position.x,y:this.component.position.y,items:new Ad([this.component]),executeCommand:!1};$n.rotateAssignReferPoint(r,this,null,null,this.rotateReferPointCallback.bind(this))}}rotateReferPointCallback(e,r,i,n={}){if(i)this.translateComp(ba);else{let s=new S(e,r);this.translateComp(s),n.angle&&(ut.footprintDefault.rotation+=n.angle)}}flip(){this.component!=null&&(ao(this.component.layerId)?this.component.layerId=2:this.component.layerId=1,Pe.setActiveLayerId(this.component.layerId))}updateTopMenuRotateStatus(e){we.rotate=e}uploadPlaceDeviceLog(){try{let[e,r]=this.source.split("|");A.windowBridge.publish("addUploadPlaceLibLog",{uuid:e,path:r,lib_type:1},Q())}catch(e){console.error(e)}}};var Ade=class extends bi{constructor(e,r){super();this.items=new Array;this.allClonedItems=[];this.numManager=xp.getNumberManager();this.commandFactory=new hi().createGroup("Create Array");this.itemsMapOffset=new Map;this.itemsMapRotations=new Map;this.preAngle=0;this.selectedItems=[];this.numList=[];this.transformItems=new Zy(null,{saveHistory:!1,rotateWhole:!0});this.originalNetsMap=new Map;this.inheritNet="KeepOriginNets";this.shouldToast=!1;this.tool=r;let i=Mt.isChildPcb();e.forEach(s=>{i&&s instanceof Bi||(this.items.push(s),s.click())});let n=this.getSelectPosition(e);this.checkHasComponent(),this.option={pos:n,unit:R.getInstance().unit},this.recordOriginalNets()}recordOriginalNets(){this.selectedItems.forEach(e=>{this.originalNetsMap.set(e.globalIndex,e.net||"")})}checkHasComponent(){let e=!1;this.items.forEach(r=>{this.isPartOfComponent(r)&&!this.items.includes(r.getParent())?!e&&(e=!0):r.getParent()?this.selectedItems.push(r.getParent()):!r.isEmpty&&!(r instanceof mn)&&this.selectedItems.push(r)}),e&&A.publish("showPcbSlideMsg",["Objects within component cannot be arrayed"],Q()),this.sortOrder();for(let r of this.selectedItems)r instanceof Le&&this.numList.push(r.num);if(this.selectedItems.length==1&&(this.selectedItems[0]instanceof ke||this.selectedItems[0]instanceof lr))this.selectionCenter=this.selectedItems[0].position,this.selectBBox=this.selectedItems[0].buildBBox();else{let r=new _e;for(let i of this.selectedItems){let n=i.buildBBox();r.ext1(n)}this.selectBBox=r.build1(),this.selectionCenter=this.selectBBox.center()}}sortOrder(){let e=new Map,r=this.selectedItems.filter(i=>i instanceof He&&i.type==="Copper Region"?(e.has(i.layerId)||e.set(i.layerId,[]),e.get(i.layerId).push(i),!1):!0);for(let i of e.values())i.sort((n,s)=>un.getOrder(n.globalIndex)-un.getOrder(s.globalIndex)),r.push(...i);this.selectedItems=r}getSelectPosition(e){if(e.length===0)return null;if(e.length===1){let r,i=e[0];return i instanceof ke||i instanceof lr?r=i.position:r=i.buildBBox().center(),r.sub(R.getInstance().origin)}else{let r=new _e;for(let n of e){let s=n.buildBBox();r.ext1(s)}return r.build1().center().sub(R.getInstance().origin)}}open(e){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let r={};return r.action="create-array",this.option!=null&&(r.extra=this.option),r}modify(e){this.createArrayPreview(e)}close(e){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let r=e.action;jP.on=!0;let i=this.allClonedItems.flat(1);if(i.forEach(n=>this.commandFactory.addCommand4Item(n,"add")),r=="confirm"){for(let n of this.selectedItems)i.push(n);A.publish("select",i),this.commandFactory.execute()}else if(r=="cancel"&&this.selectedItems.length){A.publish("select",this.selectedItems);let n=new _e;n.ext1(this.selectBBox),A.publish("adaptBBox",{bbox:n.build(),needAdaptAll:!1}),this.commandFactory.undo()}return this.tool.cancel(),this.allClonedItems.length=0,this.numList.length=0,this.itemsMapOffset=null,this.itemsMapRotations=null,this.originalNetsMap=null,!0}createArrayPreview(e){if(!this.selectedItems.length)return;this.transformItems.reset();let r;if(jP.on=!1,this.inheritNet=e.inheritNet,e["array-type"]==="matrix"){let a=e["distribute-by"],l={x:e["space-x"],y:e["space-y"]},c=+e.rotation,h=+e["per-row-count"],u=+e["per-column-count"],d=h*u,p=d-1;if(d!=this.allClonedItems.length)if(this.allClonedItems.length>p)this.removeItem(p);else{let m=this.allClonedItems.length;this.numList.length&&this.addPadNums(p);let g=this.cloneModel(this.selectedItems,p);this.generateItem(g),this.highLight(m)}this.preAngle!=c&&this.rotateSelectItem(c-this.preAngle),r=this.offestItemPosition(a,c,h,u,l),this.preAngle=c}else{let a={x:e["center-x"]+R.getInstance().origin.x,y:e["center-y"]+R.getInstance().origin.y},l=e.direction==="anti-clockwise"?1:-1,c=e["r-to-match"]=="yes",h=+e["start-degree"],u=+e["spacing-degree"],d=+e["start-rotation-degree"],p=new S(a.x,a.y).distance1(new S(this.selectionCenter.x,this.selectionCenter.y)),g=+e.quantity-1;if(this.allClonedItems.length!==g)if(this.allClonedItems.length>g)this.removeItem(g);else{let y=this.allClonedItems.length;this.numList.length&&this.addPadNums(g);let b=this.cloneModel(this.selectedItems,g);this.generateItem(b),this.highLight(y)}this.preAngle!=d&&this.rotateSelectItem(d-this.preAngle),r=this.offestCirleItemPosition(l,a,p,h,u,d,c),this.preAngle=d}let i=this.getBBox(r),n=new _e;n.ext1(i);let s=this.allClonedItems.flat(1).concat(this.selectedItems);this.shouldToast&&(this.shouldToast=!1,A.publish("ui/toastMsg",{type:"info",msg:"Some networks were not inherited, please check",timer:6,autoHeight:!0},Q())),A.publish("adaptBBox",{bbox:n.build(),needAdaptAll:!0}),A.publish("selecting",{items:s}),A.publish("autoFill","")}isPartOfComponent(e){let r=e.getParent();if(r){if(r instanceof ke)return!0;let i=r.getParent();if(i&&i instanceof ke)return!0}return!1}restoreAllOriginalNets(e){this.selectedItems.forEach(r=>{this.originalNetsMap.has(r.globalIndex)&&(r.net=this.originalNetsMap.get(r.globalIndex))}),e.forEach((r,i)=>{i<this.selectedItems.length?r.net=this.selectedItems[i].net:r.net=""})}handleNets(e,r,i){switch(this.inheritNet){case"KeepOriginNets":this.restoreAllOriginalNets(e);break;case"ClearNets":[...this.selectedItems,...e].forEach(c=>{this.clearPrimitiveNet(c)});break;case"InheritNetsfromTouchedObjects":this.restoreAllOriginalNets(e);let n=new Ay([...this.selectedItems,...e]);n.updateScene();let s=i.add(r),{netsGroupSet:a,isMoreThan2Nets:l}=n.getNetPcbItems({sceneX:s.x,sceneY:s.y});l&&(this.shouldToast=!0),a.forEach(c=>{let h=c.nets;h.size==1&&c.group.forEach(u=>{(u instanceof Ge||u instanceof Le||u instanceof Ue||u instanceof lt||u instanceof rr||u instanceof Pr||u instanceof Gi)&&(u.net=Array.from(h)[0])})});break}}clearPrimitiveNet(e){if(e instanceof ke){let r=e.getItems();for(let i of r)"net"in i&&i.net&&(i.net="")}else"net"in e&&e.net&&(e.net="")}resetID(e,r=nr()){if(e instanceof ss){for(let i of e.childrens)for(let n of i)n.globalIndex=nr();e.globalIndex=r}else if(e instanceof Bi){let i=e.globalIndex;e.globalIndex=r;for(let n of e.getItems())if(n instanceof ss){let s=n.globalIndex,a=s.replace(i,r);for(let l of n.childrens)for(let c of l){let h=c.globalIndex.replace(s,a);h==c.globalIndex?c.globalIndex=nr():c.globalIndex=h}n.globalIndex=a}else{let s=n.globalIndex.replace(i,r);s==n.globalIndex?n.globalIndex=nr():n.globalIndex=s}for(let n of e.attributes){let s=n.globalIndex.replace(i,r);s==n.globalIndex?n.globalIndex=nr():n.globalIndex=s}}else e.globalIndex=r}generatePcbItemByModel(e){return this.resetID(e),e instanceof et&&(e.num=this.allPadNums.shift()),aS(e),Xc(e)}highLight(e){for(let r=e;r<this.allClonedItems.length;r++){let i=this.allClonedItems[r];for(let n of i)n.click()}}addPadNums(e){let r=this.allClonedItems.length;if(r>0){let i=this.allClonedItems[r-1];this.numList.length=0;for(let n of i)n instanceof Le&&this.numList.push(n.num)}this.allPadNums=this.numManager.getArrayPadNum(this.numList,e-r)}rotateSelectItem(e){this.selectedItems.forEach(r=>{this.commandFactory.addCommand4Item(r,"modify")}),this.transformItems.execute(this.selectedItems,new S(0,0),{center:this.selectionCenter,angle:e/180*Math.PI})}getBBox(e){let r=new _e;r.ext1(this.selectBBox);for(let i of e)for(let n of i){let s=n.buildBBox();r.ext1(s)}return r.build1()}removeItem(e){let r=this.allClonedItems.length-e,i=new hi().createGroup("remove item");for(let n=0;n<r;n++)this.allClonedItems.pop().forEach(a=>{a instanceof Le&&this.numManager.deleteNum(a.num),i.addCommand4Item(a,"add")});i.undo()}cloneModel(e,r){let i=r-this.allClonedItems.length,n=[];for(let s=0;s<i;s++){let a=[];for(let l of e){let c=l.model.clone();a.push(c)}n.push(a)}return n}generateItem(e){for(let r of e){let i=[],n=[],s=new Map,a=new Set;for(let l of r){let c=l.globalIndex,h=this.generatePcbItemByModel(l);if(h instanceof He)switch(h.type){case"Copper Region":n.push(h);break;case"3D Shell - Side Datum Line":s.set(c,h.globalIndex);break;case"3D Shell - Side Entity":case"3D Shell - Side Slot Region":h.getComponent().lineId&&a.add(h);break}i.push(h)}for(let l of a){let c=l.getComponent(),h=s.get(c.lineId);h&&(c.lineId=h)}un.toLowest(n,!1),this.allClonedItems.push(i)}}offestItemPosition(e,r,i,n,s){let a=1,l=[],c=(r-this.preAngle)/180*Math.PI,h={center:this.selectionCenter,angle:c};for(let u of this.allClonedItems){let d;if(e==="row"?d=new S(a%i*s.x,-Math.floor(a/i)*s.y):e==="column"&&(d=new S(Math.floor(a/n)*s.x,-(a%n)*s.y)),(d.x===s.x*(i-1)&&d.y===0||d.x===0&&d.y===-s.y*(n-1))&&l.push(u),a++,this.itemsMapOffset.get(u))if(this.isChange(u,r,d))this.resetItemPosition(u);else{this.handleNets(u,d,this.selectionCenter);continue}this.autoDesignator(u),this.itemsMapOffset.set(u,d),this.transformItems.execute(u,d,h),this.handleNets(u,d,this.selectionCenter)}return l}isChange(e,r,i){let n=this.itemsMapOffset.get(e),s=!1;return this.preAngle!=r&&(s=!0),!(n.x===i.x&&n.y===i.y&&!s)}resetItemPosition(e){let r=e,i=this.itemsMapOffset.get(r),n=new S(-i.x,-i.y);this.transformItems.reset(),this.transformItems.execute(e,n),this.transformItems.reset()}offestCirleItemPosition(e,r,i,n,s,a,l){let c=1,h=1/0,u=1/0,d=-1/0,p=-1/0,m=[];for(let g=0;g<this.allClonedItems.length;g++){let y,b=a+(l?e*c*s:0);y=new S(r.x+i*Math.cos((n+e*c*s)/180*Math.PI)-this.selectionCenter.x,r.y+i*Math.sin((n+e*c*s)/180*Math.PI)-this.selectionCenter.y),y.x<h&&(h=y.x,m[0]=this.allClonedItems[g]),y.y<u&&(u=y.y,m[1]=this.allClonedItems[g]),y.x>d&&(d=y.x,m[2]=this.allClonedItems[g]),y.y>p&&(p=y.y,m[3]=this.allClonedItems[g]);let P=this.itemsMapRotations.get(this.allClonedItems[g])?b-this.itemsMapRotations.get(this.allClonedItems[g]).angle:b,T={center:this.selectionCenter,angle:P/180*Math.PI};if(c++,this.itemsMapOffset.get(this.allClonedItems[g]))if(this.isChange(this.allClonedItems[g],b,y))this.resetItemPosition(this.allClonedItems[g]);else{this.handleNets(this.allClonedItems[g],y,this.selectionCenter);continue}this.itemsMapOffset.set(this.allClonedItems[g],y),this.itemsMapRotations.set(this.allClonedItems[g],{center:this.selectionCenter,angle:b}),this.autoDesignator(this.allClonedItems[g]),this.transformItems.execute(this.allClonedItems[g],y,T),this.handleNets(this.allClonedItems[g],y,this.selectionCenter)}return m}autoDesignator(e){if(!le.pcbConfig.autoDesignator)return;let r=new Set;for(let i of e)i instanceof ke&&r.add(i);Ar.autoDesignator(r)}};var _de=class extends bi{constructor(e,r){super();this.items=new Array;this.tool=r,e.forEach(i=>{this.items.push(i),i.click()}),this.option={quantity:e.length,unit:R.getInstance().unit}}open(e){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let r={};return r.action="distribute",this.option!=null&&(r.extra=this.option),r}modify(e){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;e&&e.items&&(this.items=e.items),e.action=="apply"&&Is.getInstance().init(this.items,"relative offset",(i,n)=>{i=this.sortItems(i);let s=[],a=[],l=new Zy(n);i.forEach((c,h)=>{let u;if(c instanceof ke||c instanceof lr?u=c.position:c instanceof Dp?u=c.start:u=c.buildBBox().center(),e["distribute-type"]==="matrix"){let d=e["distribute-by"],p={x:e["space-x"],y:e["space-y"]},m=e["per-count"],g={x:e["start-x"]+R.getInstance().origin.x,y:e["start-y"]+R.getInstance().origin.y};a.push({center:u,angle:e.rotation/180*Math.PI}),d=="row"?s.push(new S(g.x+h%m*p.x-u.x,g.y-Math.floor(h/m)*p.y-u.y)):s.push(new S(g.x+Math.floor(h/m)*p.x-u.x,g.y-h%m*p.y-u.y))}else{let d={x:e["center-x"]+R.getInstance().origin.x,y:e["center-y"]+R.getInstance().origin.y},p=e.direction==="anti-clockwise"?1:-1,m=e["r-to-match"]=="yes",g=+e["start-degree"],y=+e["spacing-degree"],b=+e["start-rotation-degree"],P=e.radius,T=b+(m?p*h*y:0);(c instanceof lr||c instanceof Dp)&&is(c.layerId)&&(T=180-T),a.push({center:u,angle:T/180*Math.PI}),s.push(new S(d.x+P*Math.cos((g+p*h*y)/180*Math.PI)-u.x,d.y+P*Math.sin((g+p*h*y)/180*Math.PI)-u.y))}}),l.execute(i,s,a,!0),i.forEach(c=>c.click())})}close(e){return this.tool.cancel(),!0}sortItems(e){let r=[],i=[],n=[],s=[];return e.forEach(a=>{a instanceof ke?r.push(a):a instanceof _i?i.push(a):a instanceof Ir?n.push(a):s.push(a)}),[].concat(a2(r,"name"),a2(i,"num"),n,s)}};var vde=class extends Oo{constructor(e,r){super();this.items=new Array;this.selections=new Array;this.mouseLeftDown=!1;this.mouseLeftX=0;this.mouseLeftY=0;On.getInstance().allowPull=!1,r.forEach(n=>{this.items.push(n)}),this.dialog=e=="createArrayTool"?new Ade(r,this):new _de(r,this),A.publish("openDialog",this.dialog);let i=fhe([],[],!1,!1,!1,!1);we.select(i)}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":this.cancel();break}A.publish("updateFrame","")}onMouseLeftDown(e){let r=e.realSceneX,i=e.realSceneY;this.mouseLeftDown=!0,this.mouseLeftX=r,this.mouseLeftY=i,e.ctrlKey?this.ctrlSelect(r,i,e):this.pointSelect(r,i,e)}onMouseLeftUp(e){if(this.mouseLeftDown=!1,this.selections.length>0){let r=new _e().ext6(e.realSceneX,e.realSceneY).ext6(this.mouseLeftX,this.mouseLeftY).build1();this.mouseLeftX>e.realSceneX?It.getInstance().flip?this.boxSelect(r,!0,e.ctrlKey):this.boxSelect(r,!1,e.ctrlKey):It.getInstance().flip?this.boxSelect(r,!1,e.ctrlKey):this.boxSelect(r,!0,e.ctrlKey),this.clearSelectBox()}}onMouseMove(e){let r=e.sceneX,i=e.sceneY;this.mouseLeftDown&&(e.realSceneDeltaX!=0||e.realSceneDeltay!=0)&&(this.selections.length==0&&!e.ctrlKey?this.updateSelectBox(r,i):this.updateSelectBox(r,i))}interrupt(e=!0){for(let r of this.items)r.buildBBox()!=null&&r.visible();this.items.length=0,A.publish("selecting",{items:this.items}),On.getInstance().allowPull=!0}cancel(){this.interrupt(!0),A.publish("tool","dropdrag")}select(e){this.items.length=0;let r=new Array;for(let n of e)n!=null&&(this.items.push(n),r.push(n));let i=Array.from(r);this.dialog.modify({items:i}),A.publish("selecting",{items:this.items})}ctrlSelect(e,r,i){let n=new Set;for(let a of this.items)n.add(a);for(let a of n)if(a.isSelect(e,r)){jt.filterElement([a],{boxChoose:!1}).forEach(c=>{c.visible(),n.delete(c)}),this.select(n);return}let s=Vr.pointSelect(e,r);for(let a of s)n.add(a);this.select(this.filter2DLine(n))}pointSelect(e,r,i){this.interrupt(!1);let n=Vr.pointSelect(e,r);n.forEach(s=>{s.click()}),this.select(n)}boxSelect(e,r,i){i||this.interrupt(!1);let n=new Array;if(r?n=this.leftToRight(e):n=this.rightToLeft(e),i){let s=new Set;this.items.forEach(a=>{s.add(a)}),n.forEach(a=>{s.add(a)}),n.length=0,this.interrupt(!1),s.forEach(a=>{a.click(),n.push(a)})}this.select(n)}clearSelectBox(){for(let e of this.selections)e.remove();this.selections.length=0}leftToRight(e){let r=jt.filterElement(Vr.getSelectInside(ll(e)),{boxChoose:!0});return this.filter2DLine(r)}rightToLeft(e){let r=jt.filterElement(Vr.getSelectContect(ll(e),{boxChoose:!0,isBBox:!0}),{boxChoose:!0});return this.filter2DLine(r)}updateSelectBox(e,r){if(this.selections.length>0)this.selections[0].start=new S(this.mouseLeftX,this.mouseLeftY),this.selections[0].end=new S(e,this.mouseLeftY),this.selections[1].start=new S(e,this.mouseLeftY),this.selections[1].end=new S(e,r),this.selections[2].start=new S(e,r),this.selections[2].end=new S(this.mouseLeftX,r),this.selections[3].start=new S(this.mouseLeftX,r),this.selections[3].end=new S(this.mouseLeftX,this.mouseLeftY);else{let i=Pe.getActiveLayerID(),n=new cr(i,new S(this.mouseLeftX,this.mouseLeftY),new S(e,this.mouseLeftY),!1),s=new cr(i,new S(e,this.mouseLeftY),new S(e,r),!1),a=new cr(i,new S(e,r),new S(this.mouseLeftX,r),!1),l=new cr(i,new S(this.mouseLeftX,r),new S(this.mouseLeftX,this.mouseLeftY),!1);this.selections.push(n),this.selections.push(s),this.selections.push(a),this.selections.push(l)}}filter2DLine(e){let r=new Array,i=new Array;return e.forEach(n=>{n instanceof lt&&i.push(n)}),i.forEach(n=>{n.getChildrens().forEach(a=>{a.forEach(l=>{e.delete(l)})})}),e.forEach(n=>{if(n instanceof mt||n instanceof _t){let s=n.getParent();s instanceof lt&&s.onlyOneChilds()!=null?(s.click(),r.push(s)):(n.click(),r.push(n))}else n.click(),r.push(n)}),r}};var Dg=class extends ni{};var xde=class extends Dg{onKeyDown(t){switch(tr.getAction(2,t)){case"Cancel":{this.cancel();break}}A.publish("updateFrame","")}onMouseLeftDown(t){this.start();let e=t.realSceneX,r=t.realSceneY;gce(e,r)}onMouseRightUp(t){t.openMenu&&this.cancel()}interrupt(){A.publish("tool","dropdrag"),gr.model=1,this.end()}cancel(){this.interrupt()}};var qq=class extends Dg{constructor(e=!1){super();this._start=null;this.mouseLeftX=0;this.mouseLeftY=0;this.selections=new Array;this.isOnlyInsideTouch=e}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":{this.cancel();break}case"Finish":this.onEnterPlace(e);break;default:}A.publish("updateFrame","")}onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY);if(!this.isSelectBoxExistence())this.start(),this.mouseLeftX=e.realSceneX,this.mouseLeftY=e.realSceneY,this.createSelectBox(e.realSceneX,e.realSceneY),this._start=r,this.drawing=!0;else{let i=new _e().ext2(this._start).ext2(new S(e.sceneX,e.sceneY)).build1();this.updateSelectBox(e.sceneX,e.sceneY);let n=new Set(Array.from(ze.getSelects())),s;if(this.isOnlyInsideTouch)s=jt.filterElement(Vr.getSelectInside(ll(i),{boxChoose:!1,isBBox:!0,model:$L}),{boxChoose:!0});else{let l=new Set(Kc());Vr.getSelectContect(ll(i),{boxChoose:!1,isBBox:!0}).forEach(h=>{l.delete(h)}),s=jt.filterElement(l,{boxChoose:!0})}let a=new Set;xe.addAllSet(a,n),xe.addAllSet(a,s),s=a,s.forEach(l=>{l.click()}),A.publish("select",s),gr.model=1,this._start=null,this.clearSelectBox(),this.end()}}onMouseMove(e){this.isSelectBoxExistence()&&this.drawing&&this.updateSelectBox(e.sceneX,e.sceneY)}interrupt(){this.isSelectBoxExistence()&&(this.drawing=!1,this._start=null,this.clearSelectBox()),gr.model=1,this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":{this.cancel();break}case"toggleAdsorb":{A.publish("toggleAdsorb","");break}case"ADSORBENT_CONFIG":{A.publish("openSystemDialog","ADSORPTION",Q());break}default:}A.publish("updateFrame","")}createSelectBox(e,r){let i=le.themeConfig.canvasTheme,n=i.isSolidLine(i.selectBoxLineStyle),s=i.selectBoxColor,a=new cr(1002,new S(this.mouseLeftX,this.mouseLeftY),new S(e,this.mouseLeftY),n,s),l=new cr(1002,new S(e,this.mouseLeftY),new S(e,r),n,s),c=new cr(1002,new S(e,r),new S(this.mouseLeftX,r),n,s),h=new cr(1002,new S(this.mouseLeftX,r),new S(this.mouseLeftX,this.mouseLeftY),n,s);this.selections.push(a),this.selections.push(l),this.selections.push(c),this.selections.push(h)}updateSelectBox(e,r){if(this.isSelectBoxExistence()){this.selections[0].start=new S(this.mouseLeftX,this.mouseLeftY),this.selections[0].end=new S(e,this.mouseLeftY),this.selections[1].start=new S(e,this.mouseLeftY),this.selections[1].end=new S(e,r),this.selections[2].start=new S(e,r),this.selections[2].end=new S(this.mouseLeftX,r),this.selections[3].start=new S(this.mouseLeftX,r),this.selections[3].end=new S(this.mouseLeftX,this.mouseLeftY);return}this.createSelectBox(e,r)}clearSelectBox(){for(let e of this.selections)e.remove();this.selections.length=0}isSelectBoxExistence(){return this.selections.length>0}};var Rde=class extends eP{constructor(e,r,i){super();this.profile=null;this.type=e,this.optionType=r,this.confirmWindowCb=i}getResult(e){let r=new Array;e.shape.forEach(i=>{let n=this.getModel(i);r.push(n),i.remove()}),r.length>0&&(this.profile=ge.build2(r)),e.shape.length=0}getModel(e){if(e instanceof Vi||e instanceof es)return e.primitive;if(e instanceof cr)return new M(e.start,e.end);if(e instanceof gs)return q.build4(e.start,e.end,e.center,e.radius,e.radius,e.sweep)}confirmWindow(e,r){if(this.profile!=null){if(this.optionType=="Line"){let i=new Set(Array.from(ze.getSelects())),n=new Array,s=new Array;this.profile.primitives.forEach(l=>{let c=l.stroke(e._width,wr.ROUND,ae.CCW);n.push(c);let h=Vr.getSelectContect(c,{boxChoose:!1});s=s.concat(Array.from(h))});let a=jt.filterElement(s,{boxChoose:!0});a=_ee(i,a),a.forEach(l=>{l.click()}),A.publish("select",a),gr.model=1}else if(this.optionType=="Prohibited Region"){let i=new Set(Array.from(ze.getSelects())),n=new Set(Kc()),s=Vr.getSelectContect(this.profile,{boxChoose:!1});s.forEach(l=>{n.delete(l)});let a=jt.filterElement(n,{boxChoose:!0});s=_ee(i,a),a.forEach(l=>{l.click()}),A.publish("select",s),gr.model=1}else if(this.optionType=="Fill Region"){let i=new Set(Array.from(ze.getSelects())),n=Vr.getSelectInside(this.profile,{boxChoose:!1});n=_ee(i,n),n.forEach(s=>{s.click()}),A.publish("select",n),gr.model=1}this.confirmWindowCb&&this.confirmWindowCb(this.profile)}}modify(e,r,i){}};var WD=class extends Dg{constructor(e,r){super();this.event=new du;switch(this.event=new du,this.resultEvent=new Rde("Segment",e,r),e==="Line"&&(this.event.needClose=!1),Zt.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new eh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new Gh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new ja(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Tl(this.event,Ur,this.resultEvent);break}this.event.commands=new De("draw 2DLine - "+e),this.event.drawScene="Segment",Ur.addDrawTool(this)}onKeyDown(e){switch(tr.getAction(4,e)){case"changeRoutingAngle":case"Routing Corner":this.wireCorner(Ur.getNextType());break;case"Finish":this.onEnterPlace(e);return}this.drawPolygon.onKeyDown(e)}onMouseLeftUp(e){this.start(),this.drawPolygon.onMouseLeftUp(e)}onMouseMove(e){this.drawing&&this.drawPolygon.onMouseMove(e)}interrupt(){this.drawPolygon.interrupt(),Ur.clearDrawTool(),gr.model=1,this.end()}cancel(){this.drawPolygon.cancel()}flipPath(){this.drawPolygon.flipPath()}toggleLayer(e){this.drawPolygon.toggleLayer(e)}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new eh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new Gh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new ja(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Tl(this.event,Ur,this.resultEvent);break}this.event.start!=null&&this.drawing&&(this.event.last==null&&(this.event.last=this.event.start),this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr)),Zt.getInstance().type=e,we.synchronize()}wireWidth(e){this.drawPolygon.wireWidth(e)}completed(){this.drawPolygon.completed(!1)}backspace(){this.drawPolygon.backspace()}wireMode(e){}onMouseRightUp(e){if(e.openMenu)switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.event.shape.length>0?this.completed():this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.event.shape.length>0?this.completed():this.cancel();break}}}rightClickMenuData(e){let r=this.event.start!=null,i={state:"show",left:e.mouseX,top:e.mouseY,filter:vg(Zt.getInstance().type,e.adsorb,r,!0).result};$t.getInstance().menuData(i,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed();break;case"CANCEL":this.cancel();break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":this.wireCorner(i[1]);break;case"WIRING_WIDTH_INPUT":A.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}};var Dde=class extends WD{constructor(){super("Fill Region")}};var wde=class extends WD{constructor(){super("Prohibited Region")}};var Lde=class extends WD{constructor(){super("Line")}};function Mde(o,t,e){let r=new Array,i=new Array;for(let n of o){let s=Wr.getItem(n);if(s!=null&&s.net!=t){let a=_je(s);for(let l of a)l instanceof Ge&&r.push(l),l instanceof Ue&&l.globalIndex!==s.globalIndex&&i.push(l);e.addCommand(Ce.dispatch(s,"modify")),A.publish("hasModifyPcbItem",s),s.net=t,A.publish("hasModifyPcbItem",s)}}A.windowBridge.rpcCall("tipsModalBackToPcb","syncViaConnectNet",Q()).then(n=>{if(n.message.action=="yes"){for(let s of r)e.addCommand(Ce.dispatch(s,"modify")),A.publish("hasModifyPcbItem",s),s.net=t,A.publish("hasModifyPcbItem",s);for(let s of i)e.addCommand(Ce.dispatch(s,"modify")),A.publish("hasModifyPcbItem",s),s.net=t,A.publish("hasModifyPcbItem",s);A.publish("flushService","")}})}var $q=class extends ni{constructor(t,e,r,i,n){super(),this.option="OPTIONLEFTUP",this.oldToolDrawing=r,this.drawing=!0,this.tool=t,this.lastTool=i,this.lastCmd=e,this.msg="Please select a network",this.pcbBridgingCopperIndex=n,this.start()}onKeyDown(t){switch(tr.getAction(4,t)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(t);break}A.publish("updateFrame","")}onMouseMove(t){Ut.update(t,this.msg)}onMouseLeftUp(t){if(this.drawing){let e=ze.getSelects(),r=Vr.selectNet(t.sceneX,t.sceneY);this.selectItems=e;let i=!1;e!==null&&(this.netsGroupSet=this.getNearNetPcbItems(r,t.sceneX,t.sceneY),i=this.handleNets(t,e)),i&&(this.tool.setNextTool(this.lastTool),di.resetLastScene(),this.tool.drawing=this.oldToolDrawing,Ut.cancel(),A.publish("resetToolLastCmd",this.lastCmd),A.publish("updateCrossDirect",fi.getInstance()),A.publish("flushSelectingInfo",""),this.end())}}getNearNetPcbItems(t,e,r){let i=new Set,n=new Set,s=new Set;return t.forEach(a=>{if(a instanceof He&&a.type=="Fill Region"){let c=a.getComponent();if(c instanceof Zi&&c.isBridgingCopper)return}let l=a.net;if(a instanceof He&&a.type=="Copper Region"){let c=!1;if(a.iteratorCopper(h=>{c||h.inCopper(e,r)&&h.isVisible&&(c=!0)}),!c)return}l&&(s.add(a),n.add(l))}),i.add({group:s,nets:n}),i}handleNets(t,e){let r=tXe.getAttributePlaneFilterControl(),i=r.update(e).getStatus(e),n=[];for(let a=0;a<e.length;a++)i[r.getType(e[a])]&&n.push(e[a]);let s=!1;return this.nets=new Set,this.netsGroupSet.forEach(a=>{this.nets=a.nets}),this.nets.size?this.nets.size===1?(this.nets.forEach(a=>{this.updateNetwork(a,n)}),s=!0):(Ut.cancel(),this.showNetsMenu(t)):s=!1,s}showNetsMenu(t){let e={};e.state="show",e.left=t.mouseX,e.top=t.mouseY,e.filter=this.getNetsMenuData().result,$t.getInstance().menuData(e,this),this.drawing=!1}getNetsMenuData(){let t=new qt,e="INHERIT_NET:";return this.nets.forEach(r=>{if(r){let i={name:r,cmd:`${e+r}`,tips:"",option:{disabledI18n:!0}};t.addObj(i,!1,!1)}}),t}updateNetwork(t,e){if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let r=new De("update select item network"),i=new Array,n=new Set;e.forEach(s=>{s instanceof Ue&&this.checkConnect(s)?i.push(s.globalIndex):n.add(s)});for(let s of n)if(s instanceof mt||s instanceof _t){let a=s.getParent();a!=null&&a instanceof lt&&(A.publish("hasModifyPcbItem",a),r.addCommand(Ce.dispatch(a,"modify")),a.net=t,A.publish("hasModifyPcbItem",a))}else if(s instanceof Qo){let a=!1;s instanceof He&&s.getComponent()instanceof Zi&&(a=s.getComponent().isBridgingCopper);let l=new hi;l.createGroup("modify Primitive Data By Select Net");let c=l.getCommand();if(a){let u=s,d=u.getComponent(),p=JSON.stringify(d);new bl(p,u.type).rebuildComponent(u)}let h=Ce.dispatch(s,"modify");if(c.addCommand(h),r.addCommand(Ce.dispatch(s,"modify")),a){wR(s,t,this.pcbBridgingCopperIndex);continue}s.net=t,A.publish("hasModifyPcbItem",s),s instanceof He&&s.type=="Copper Region"&&A.publish("rebuildSingleCopper",{ids:[s.globalIndex],isLast:!0}),s instanceof Le&&_A(s,c)}i.length>0&&Mde(i,t,r),qe.executeCommand(r),A.publish("flushService",""),A.publish("flushSelectingInfo","")}checkConnect(t){let e=t.searchNowNode();for(let r of e)if(r instanceof Ge)return!0;return!1}interrupt(){this.drawing=!1,this.tool.setNextTool(this.lastTool),di.resetLastScene(),this.tool.drawing=this.oldToolDrawing,Ut.cancel(),A.publish("resetToolLastCmd",this.lastCmd),A.publish("updateCrossDirect",fi.getInstance()),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:po(t.adsorb)};$t.getInstance().menuData(e,this),this.drawing=!1}parse(t){this.drawing=!0;let r=t.cmdKey.split(":");switch(r[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"INHERIT_NET":this.updateNetwork(r[1],this.selectItems),this.interrupt();break}A.publish("updateFrame","")}};var XG=class extends ni{constructor(e,r,i,n,s,a,l){super();this.lastRotateTool=null;this.start(),this.option="OPTIONLEFTUP",Ea.changeTool(this),this.oldToolDrawing=r,this.drawing=!0,this.tool=e,this.lastTool=i,this.referPointProgram=n,this.msg=s,this.clickCn=0,this.needInput=l,a&&this.assignReferPoint(a),this.lastRotateTool=$n.getTool(),$n.setTool(this)}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);return}A.publish("updateFrame","")}onMouseMove(e){switch(this.clickCn){case 0:this.drawing&&Ut.update(e,this.msg);break;case 1:if(this.drawing){let r=this.referPointProgram.movePoint(e.sceneX,e.sceneY),i=Gee(r/Math.PI*180),n=nf(),s=_o(new S(e.sceneX,e.sceneY)),a={frameInfo:n,show:!0,type:"circle",data:[{frameCursorPoint:s,info:{type:"circle",tagName:"angle",value:i}}]};at.create(a)}break}}onMouseLeftUp(e){if(this.clickCn!==void 0)switch(this.clickCn++,this.clickCn){case 1:this.drawing&&(this.referPointProgram.setReferPoint(e.sceneX,e.sceneY),Ut.cancel());break;case 2:at.editingWhat?(at.editingWhat="",this.clickCn--):(this.completed({x:e.sceneX,y:e.sceneY}),at.destroy());break}}interrupt(){this.referPointProgram.interrupt(),this.drawing=!1,this.tool.setNextTool(this.lastTool),di.resetLastScene(),this.tool.drawing=this.oldToolDrawing,Ut.cancel(),at.destroy(),$n.setTool(this.lastRotateTool),this.end()}cancel(){this.interrupt()}completed(e){this.clickCn=void 0,this.tool.setNextTool(this.lastTool),di.resetLastScene(),this.tool.drawing=this.oldToolDrawing,this.referPointProgram.setEndPoint(e.x,e.y),at.destroy(),$n.setTool(this.lastRotateTool)}applyInputAtCursorValue(e){let{value:r,browserCursorPoint:i,editing:n}=e;if(n){at.editingWhat="circle";return}A.publish("rotateAssignAngle",{angle:r,x:i.x,y:i.y})}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}assignReferPoint(e){this.clickCn=1,this.referPointProgram.setReferPoint(e.x,e.y)}};var Nde=class extends Dg{constructor(e,r){super();this.event=new du;switch(this.event=new du,this.resultEvent=new PD(e,r),e==="Line"&&(this.event.needClose=!1),Zt.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new eh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC45":case"WIRING_CORNER_ARC90":this.drawPolygon=new Gh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new ja(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Tl(this.event,Ur,this.resultEvent);break}this.event.commands=new De("draw 2DLine - "+e),Ur.addDrawTool(this),this.drawing=!0}onKeyDown(e){switch(tr.getAction(4,e)){case"changeRoutingAngle":case"Routing Corner":this.wireCorner(Ur.getNextType());break;case"Finish":this.onEnterPlace(e);return}this.drawPolygon.onKeyDown(e)}onMouseLeftUp(e){this.start(),this.drawPolygon.onMouseLeftUp(e)}onMouseMove(e){this.drawing&&this.drawPolygon.onMouseMove(e)}interrupt(){this.drawPolygon.interrupt(),Ur.clearDrawTool(),gr.model=1,this.end()}cancel(){this.drawPolygon.cancel()}flipPath(){this.drawPolygon.flipPath()}toggleLayer(e){this.drawPolygon.toggleLayer(e)}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new eh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC45":case"WIRING_CORNER_ARC90":this.drawPolygon=new Gh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new ja(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Tl(this.event,Ur,this.resultEvent);break}this.event.start!=null&&this.drawing&&(this.event.last==null&&(this.event.last=this.event.start),this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr)),Zt.getInstance().type=e,we.synchronize()}wireWidth(e){this.drawPolygon.wireWidth(e)}completed(){this.drawPolygon.completed(!1)}backspace(){this.drawPolygon.backspace()}wireMode(e){}rightClickMenuData(e){let r=this.event.start!=null,i={state:"show",left:e.mouseX,top:e.mouseY,filter:vg(Zt.getInstance().type,e.adsorb,r,!0).result};$t.getInstance().menuData(i,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed();break;case"CANCEL":this.cancel();break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":this.wireCorner(i[1]);break;case"WIRING_WIDTH_INPUT":A.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}};var kde=class{static fillGrid(t,e,r=ee.Gray){let i=new Array,n=Qe.rotate(Math.PI/4),s=Qe.rotate(-Math.PI/4),a=t.multiply3(n),l=t.multiply3(s),c=a.bbox(),h=l.bbox(),u=new Array,d=new q9(new Di(1));d.addPolyline(a);for(let g=c.minY;g<=c.maxY;g+=6){let y=new M(new S(c.minX,g),new S(c.maxX,g));xe.addAll(u,d.scan(g,y))}let p=new Array,m=new q9(new Di(1));m.addPolyline(l);for(let g=h.minY;g<=h.maxY;g+=6){let y=new M(new S(h.minX,g),new S(h.maxX,g));xe.addAll(p,m.scan(g,y))}for(let g of u){let y=g.multiply3(s);i.push(new cr(e,y.start(),y.end(),!0,r))}for(let g of p){let y=g.multiply3(n);i.push(new cr(e,y.start(),y.end(),!0,r))}return i}static getGridPoint(t,e,r){let i=Qe.rotate(Math.PI/2),n=Qe.rotate(-Math.PI/2),s=t.multiply3(i),a=t,l=s.bbox(),c=a.bbox(),h=new Array,u=new q9(new Di(1));u.addPolyline(s);for(let y=l.minY;y<=l.maxY;y+=r){let b=new M(new S(l.minX,y),new S(l.maxX,y));xe.addAll(h,u.scan(y,b))}let d=new Array,p=new q9(new Di(1));p.addPolyline(a);for(let y=c.minY;y<=c.maxY;y+=e){let b=new M(new S(c.minX,y),new S(c.maxX,y));xe.addAll(d,p.scan(y,b))}let m=new Array;for(let y of h){let b=y.multiply3(n);m.push(b)}let g=new Array;for(let y of m)for(let b of d){let P=Pt(y,b);for(let T=0;T<P;T+=2){let I=new S(Ee[T],Ee[T+1]);g.push(I)}}return g}};var qG=class extends ni{constructor(e=!0){super();this.commands=new De("draw suture via");this.net="";this.hasEffectiveDrawn=!1;this.drawMode=null;let r=re.getInstance().getDefaultRadiusPhysics();this.radius=r.defalutRadius,this.innerRadius=r.defalutInner,this.lineSpacing=ut.defaultSutureVia.lineSpacing,this.columnSpacing=ut.defaultSutureVia.columnSpacing,e&&A.publish("openMainDialog",{cmd:19,data:{tool:this}}),this.clickCn=0,this.drawing=!0}getDialogData(){let e=R.getInstance().unit,r=new dt;return{action:"attribute-for-place-sut-via",attrNet:this.net||"",netList:Ye.getNet(),attrViaGeneralOuterdiameter:r.conversion("mil",e,this.radius*20),attrViaGeneralInnerdiameter:r.conversion("mil",e,this.innerRadius*20),attrRowSpacing:r.conversion("mil",e,this.lineSpacing*10),attrColSpacing:r.conversion("mil",e,this.columnSpacing*10),unit:e}}modifyByDialog(e){let r=e.action;if(r=="confirm"){this.drawMode=0;let i=new dt,n=e["attr-net"],s=parseFloat(e["attr-col-spacing"])/10,a=parseFloat(e["attr-row-spacing"])/10,l=parseFloat(e["attr-via-general-innerdiameter"])/20,c=parseFloat(e["attr-via-general-outerdiameter"])/20;this.net=n||"",this.columnSpacing=i.conversion(R.getInstance().unit,"mil",s),this.lineSpacing=i.conversion(R.getInstance().unit,"mil",a),this.radius=i.conversion(R.getInstance().unit,"mil",c),this.innerRadius=i.conversion(R.getInstance().unit,"mil",l),ut.setDefaultSutureVia(this.lineSpacing,this.columnSpacing)}else r=="cancel"&&this.cancel()}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);break;default:this.drawPolygonSutureVia!=null&&this.drawPolygonSutureVia.onKeyDown(e)}A.publish("updateFrame","")}async onMouseLeftUp(e){if(!this.drawing){this.drawing=!0,A.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},Q());return}if(this.drawMode===1){this.netSelect(e.sceneX,e.sceneY);return}let r=e.sceneX,i=e.sceneY,n=new S(r,i);this.clickCn++,this.clickCn===1?(this.start(),Ut.cancel(),this.drawPolygonSutureVia=new Nde("Fill Region",await this.confirmWindow.bind(this)),this.drawPolygonSutureVia.onMouseLeftUp(e)):this.clickCn>=2&&this.drawPolygonSutureVia.onMouseLeftUp(e)}onMouseMove(e){if(this.drawMode===0){if(!this.drawing)return;let r=e.sceneX,i=e.sceneY;this.clickCn>=1?this.drawPolygonSutureVia.onMouseMove(e):this.clickCn===0&&Ut.update(e,"Please select an area")}else this.drawMode==1?Ut.update(e,"Please select a network"):Ut.cancel()}interrupt(){this.drawMode=0,this.drawPolygonSutureVia&&(this.drawPolygonSutureVia.interrupt(),this.drawing=!1,this.clickCn=void 0,this.drawPolygonSutureVia=null),Ut.cancel(),this.end()}cancel(){this.drawMode===null||this.drawMode==0?(this.drawPolygonSutureVia&&(this.drawPolygonSutureVia.cancel(),this.drawing=!1,this.clickCn=void 0,this.drawPolygonSutureVia=null),this.interrupt(),this.hasEffectiveDrawn&&A.publish("rebuildCopperRegionDialog",{msg:""}),A.publish("tool","dropdrag")):(this.drawMode=0,this.confirmWindow(null))}completed(){this.drawPolygonSutureVia.completed(),this.end(),this.clickCn=void 0}onMouseRightUp(e){if(e.openMenu)switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.clickCn>=1?this.completed():this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.clickCn>=1?this.completed():this.cancel();break}}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:this.getMenu(e.adsorb)};$t.getInstance().menuData(r,this),this.drawing=!1}getMenu(e){let r=new qt;this.drawPolygonSutureVia&&r.add("COMPLETE"),r.add("CANCEL"),r.add("REGRESSION",!0);let i=Zt.getInstance().type;return r.addExtend("WIRING_CORNER",fS(i)),r.add("toggleAdsorb",!1,e),r.result}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed();break;case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"REGRESSION":this.drawPolygonSutureVia!=null&&this.drawPolygonSutureVia.backspace();break;case"WIRING_CORNER":this.drawPolygonSutureVia!=null&&this.drawPolygonSutureVia.wireCorner(i[1]);break;case"INHERIT_NET":this.update(i[1]);break}A.publish("updateFrame","")}async confirmWindow(e){if(e!=null){let{vias:r}=await this.placeSutureVias([[e]]);for(let i of r){A.publish("hasModifyPcbItem",i);let n=Ce.dispatch(i,"add");this.commands.addCommand(n)}A.publish("onlySelect",r),qe.executeCommand(this.commands),this.commands=new De("draw suture via"),A.publish("flushService","")}this.drawing=!1,this.clickCn=void 0,this.drawPolygonSutureVia=null}modify(e){}placeVia(e){let r=this.net;(Ye.getItem(r)==null||Ye.getItem(r).size==0)&&(r="");let i=re.getInstance().getSolderExpansionByNet(r),n=new hg(nr(),2,"",1,2,[],this.net,this.radius,e,this.innerRadius,1,i.viaTopExpansion,i.viaBottomExpansion,!1);return bn.getInstance().addModel(n),n}async placeSutureVias(e,r=!1){let i=new Array;for(let u of e){if(u.length==0)continue;let d=new Set(kde.getGridPoint(u[0],this.lineSpacing,this.columnSpacing));if(d.size){if(u.length>1)for(let p of d)for(let m=1;m<u.length;m++){let g=u[m];if(jr.inPolyline(p,g)){d.delete(p);break}}d.size&&i.push(...d)}}if(i.length===0)return{vias:[]};let n=i.map(u=>this.placeVia(u)),s=this.getLayerId(),{message:a}=await A.messageBus.rpcCall("sutureViaDrc",{vias:n,checkSameNet:!0,profile:e.flatMap(u=>I0(u)),layerId:s,mode:2,maxProgress:.9}),{filterIds:l}=a,c=n.filter(u=>{let d=Bo.existClearanceError(u.globalIndex,s);return!d.existClearanceError&&!l.includes(u.globalIndex)?(d.exsitError&&(this.hasEffectiveDrawn=!0),!0):(u.remove(),bn.getInstance().delete(u,u.globalIndex),Bo.deleteClearanceError(u.globalIndex),Bo.deleteBlindError(u.globalIndex),Bo.deleteRadiusError(u.globalIndex),!1)}).map(u=>Wr.addViaByModel(u));A.publish("progressUpdate",[1,"Design rule check"],Q());let h=a.hasSameNetCoppers;return r||(this.hasEffectiveDrawn&&A.publish("rebuildCopperRegionDialog",{msg:""}),c.length==0&&!h&&A.publish("ui/toastMsg",{type:"warn",msg:"The selection area must contain the same network copper filled before adding suture holes"},Q())),{vias:c,hasSameNetCoppers:h}}getLayerId(){let e=Pe.getActiveLayer();return e.isCopperLayer()||e.isPlaneLayer()?e.layerID:1}toggleMode(e){this.drawMode=e,this.drawing=!0}netSelect(e,r){let i=Vr.selectNet(e,r),n=new Set;for(let s of i)s.isSelect(e,r)&&s.net&&n.add(s.net);n.size>1?this.showNetsMenu(Array.from(n)):this.update(Array.from(n)[0])}update(e){this.net=e,this.drawMode=0,A.publish("openMainDialog",{cmd:19,data:{tool:this}})}getNetsMenuData(e){let r=new qt,i="INHERIT_NET:";return e.forEach(n=>{if(n){let s={name:n,cmd:`${i+n}`,tips:"",option:{disabledI18n:!0}};r.addObj(s,!1,!1)}}),r}showNetsMenu(e){let r={},i=fi.getInstance();r.state="show",r.left=i.mouseX,r.top=i.mouseY,r.filter=this.getNetsMenuData(e).result,$t.getInstance().menuData(r,this),this.drawing=!1}};var Bde=class extends Dg{constructor(e,r){super();this.event=new du;switch(this.event=new du,this.resultEvent=new TD(e,r),e==="Line"&&(this.event.needClose=!1),Zt.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new eh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new Gh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new ja(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Tl(this.event,Ur,this.resultEvent);break}this.event.commands=new De("draw 2DLine - "+e),Ur.addDrawTool(this)}onKeyDown(e){switch(tr.getAction(4,e)){case"changeRoutingAngle":case"Routing Corner":this.wireCorner(Ur.getNextType());break;case"Finish":this.onEnterPlace(e);break}this.drawPolygon.onKeyDown(e)}onMouseLeftUp(e){this.start(),this.drawPolygon.onMouseLeftUp(e)}onMouseMove(e){this.drawing&&this.drawPolygon.onMouseMove(e)}interrupt(){this.drawPolygon.interrupt(),Ur.clearDrawTool(),gr.model=1,this.end()}cancel(){this.drawPolygon.cancel()}flipPath(){this.drawPolygon.flipPath()}toggleLayer(e){this.drawPolygon.toggleLayer(e)}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new eh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new Gh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new ja(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Tl(this.event,Ur,this.resultEvent);break}this.event.start!=null&&this.drawing&&(this.event.last==null&&(this.event.last=this.event.start),this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr)),Zt.getInstance().type=e,we.synchronize()}wireWidth(e){this.drawPolygon.wireWidth(e)}completed(){this.drawPolygon.completed(!1)}backspace(){this.drawPolygon.backspace()}wireMode(e){}rightClickMenuData(e){let r=this.event.start!=null,i={state:"show",left:e.mouseX,top:e.mouseY,filter:vg(Zt.getInstance().type,e.adsorb,r,!0).result};$t.getInstance().menuData(i,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed();break;case"CANCEL":this.cancel();break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":this.wireCorner(i[1]);break;case"WIRING_WIDTH_INPUT":A.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}};var Fde=class extends Bde{constructor(t){super("Line",t)}};var Vde=class extends ni{constructor(){super();this.commands=new De("draw suture via");this.net="";this.hasEffectiveDrawn=!1;this.drawMode=null;let e=re.getInstance().getDefaultRadiusPhysics();this.radius=e.defalutRadius,this.innerRadius=e.defalutInner,this.spacing=ut.LineTypeSutureVia,A.publish("openMainDialog",{cmd:19,data:{tool:this}}),this.drawing=!0}getDialogData(){let e=R.getInstance().unit,r=new dt;return{action:"attribute-for-place-sut-via",attrNet:this.net||"",netList:Ye.getNet(),attrViaGeneralOuterdiameter:r.conversion("mil",e,this.radius*20),attrViaGeneralInnerdiameter:r.conversion("mil",e,this.innerRadius*20),attrSpacing:r.conversion("mil",e,this.spacing*10),unit:e,type:"lineSutureVia"}}modifyByDialog(e){let r=e.action;if(r=="confirm"){this.drawMode=0;let i=new dt,n=e["attr-net"],s=parseFloat(e["attr-spacing"])/10,a=parseFloat(e["attr-via-general-innerdiameter"])/20,l=parseFloat(e["attr-via-general-outerdiameter"])/20;this.net=n||"",this.spacing=i.conversion(R.getInstance().unit,"mil",s),this.radius=i.conversion(R.getInstance().unit,"mil",l),this.innerRadius=i.conversion(R.getInstance().unit,"mil",a),ut.setDefaultLineSutureVia(this.spacing)}else r=="cancel"&&this.cancel()}onKeyDown(e){let r=tr.getAction(4,e);if(r){switch(r){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);break;default:this.lineTool!=null&&this.lineTool.onKeyDown(e)}A.publish("updateFrame","")}}async onMouseLeftUp(e){if(!this.drawing){this.drawing=!0,A.publish("rightClickPcbMenu",{state:"hide",left:e.mouseX,top:e.mouseY},Q());return}if(this.drawMode===1){this.netSelect(e.sceneX,e.sceneY);return}let r=e.sceneX,i=e.sceneY,n=new S(r,i);!this.lineTool&&this.drawing?(this.start(),Ut.cancel(),this.lineTool=new Fde(await this.confirmWindow.bind(this)),this.lineTool.drawing=!0,this.lineTool.onMouseLeftUp(e)):this.lineTool.onMouseLeftUp(e)}onMouseMove(e){if(this.drawMode===0){let r=e.sceneX,i=e.sceneY;this.drawing&&(this.lineTool?this.lineTool.onMouseMove(e):Ut.update(e,"Please draw a line"))}else this.drawMode==1?Ut.update(e,"Please select a network"):Ut.cancel()}onMouseRightUp(e){if(e.openMenu)switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.lineTool?this.completed():this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.lineTool?this.completed():this.cancel();break}}}interrupt(){this.drawMode=0,this.lineTool&&(this.lineTool.interrupt(),this.lineTool=null,this.drawing=!1),Ut.cancel(),this.end()}cancel(){this.drawMode===null||this.drawMode==0?(this.lineTool&&(this.lineTool.cancel(),this.lineTool=null,this.drawing=!1),this.interrupt(),this.hasEffectiveDrawn&&A.publish("rebuildCopperRegionDialog",{msg:""}),A.publish("tool","dropdrag")):(this.drawMode=0,this.confirmWindow(null))}completed(){this.lineTool.completed(),this.lineTool=null,this.end()}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:this.getMenu(e.adsorb)};$t.getInstance().menuData(r,this),this.drawing=!1}getMenu(e){let r=new qt;this.lineTool&&r.add("COMPLETE"),r.add("CANCEL"),r.add("REGRESSION",!0);let i=Zt.getInstance().type;return r.addExtend("WIRING_CORNER",fS(i)),r.add("toggleAdsorb",!1,e),r.result}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed();break;case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"REGRESSION":this.lineTool!=null&&this.lineTool.backspace();break;case"WIRING_CORNER":this.lineTool!=null&&this.lineTool.wireCorner(i[1]);break;case"INHERIT_NET":this.update(i[1]);break}A.publish("updateFrame","")}async confirmWindow(e){if(e!=null){let r=await this.placeSutureVias(e);for(let i of r){A.publish("hasModifyPcbItem",i);let n=Ce.dispatch(i,"add");this.commands.addCommand(n)}A.publish("onlySelect",r),qe.executeCommand(this.commands),this.commands=new De("draw suture via"),A.publish("flushService","")}this.drawing=!1,this.lineTool=null,this.end()}modify(e){}placeVia(e){let r=this.net;(Ye.getItem(r)==null||Ye.getItem(r).size==0)&&(r="");let i=re.getInstance().getSolderExpansionByNet(r),n=new hg(nr(),2,"",1,2,[],this.net,this.radius,e,this.innerRadius,1,i.viaTopExpansion,i.viaBottomExpansion,!1);return bn.getInstance().addModel(n),n}async placeSutureVias(e){let r=new Array,i=e.primitives,n=this.points(i),s=new Array;if(n.forEach(h=>{let u=this.placeVia(h);s.push(u)}),!s.length)return r;let a=this.getLayerId(),{message:l}=await A.messageBus.rpcCall("sutureViaDrc",{vias:s,checkSameNet:!0,profile:lh(e),layerId:a,mode:0,maxProgress:.9}),{filterIds:c}=l;return s.forEach(h=>{let u=Bo.existClearanceError(h.globalIndex,a);if(!u.existClearanceError&&!c.includes(h.globalIndex)){u.exsitError&&(this.hasEffectiveDrawn=!0);let d=Wr.addViaByModel(h);r.push(d)}else h.remove(),bn.getInstance().delete(h,h.globalIndex),Bo.deleteClearanceError(h.globalIndex),Bo.deleteBlindError(h.globalIndex),Bo.deleteRadiusError(h.globalIndex)}),A.publish("progressUpdate",[1,"Design rule check"],Q()),this.hasEffectiveDrawn&&A.publish("rebuildCopperRegionDialog",{msg:""}),r.length==0&&!l.hasSameNetCoppers&&A.publish("ui/toastMsg",{type:"warn",msg:"The selection area must contain the same network copper filled before adding suture holes"},Q()),r}points(e){let r=new Array,i=0;return e.forEach((n,s)=>{if(n instanceof q){let a,l=1,c=n.length();for(;;){let h=this.spacing*l-i;if(c-h>=0){let u=this.arcPoint(n,h);r.push(u),a=u}else{i=c-(this.spacing*(l-1)-i),a=null;break}l++}}else if(n instanceof M){let a=n.start(),l=n.end(),c=l.sub(a).normalize(),h;for(i?(h=a.add(c.mul(this.spacing-i)),i=0):h=a,h.distance1(a)<=l.distance1(a)&&r.push(h);;){let u=l.distance1(h);if(u>=this.spacing){let d=h.add(c.mul(this.spacing));r.push(d),h=d}else{i=u,h=null;break}}}}),r}arcPoint(e,r){let i=e.rx*kr,n=r,s=zt.toDegrees(n/i*kr),a=e.sweep()==ae.CCW?e.startAngle+s:e.startAngle-s;return q.build2(e.center,e.startAngle,a,e.rx,e.ry,e.sweep()).end()}getLayerId(){let e=Pe.getActiveLayer();return e.isCopperLayer()?e.layerID:1}toggleMode(e){this.drawMode=e,this.drawing=!0}netSelect(e,r){let i=Vr.selectNet(e,r),n=new Set;for(let s of i)s.isSelect(e,r)&&s.net&&n.add(s.net);n.size>1?this.showNetsMenu(Array.from(n)):this.update(Array.from(n)[0])}update(e){this.net=e,this.drawMode=0,A.publish("openMainDialog",{cmd:19,data:{tool:this}})}getNetsMenuData(e){let r=new qt,i="INHERIT_NET:";return e.forEach(n=>{if(n){let s={name:n,cmd:`${i+n}`,tips:"",option:{disabledI18n:!0}};r.addObj(s,!1,!1)}}),r}showNetsMenu(e){let r={},i=fi.getInstance();r.state="show",r.left=i.mouseX,r.top=i.mouseY,r.filter=this.getNetsMenuData(e).result,$t.getInstance().menuData(r,this),this.drawing=!1}};function rXe(o){let t=new qt;return t.add("CANCEL",!0),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t}var Gde=class extends ni{constructor(e,r,i){super();this.dragMode=!1;this.logger=new Di(4);if(this.option="OPTIONLEFTUP",this.cornerType=i,Ea.changeTool(this),this.items=this.getLineAndRect(e),A.publish("onlySelect",e),this.dragMode=this.isDragMode(this.items),this.command=r||new De("Add Corner"),this.dragMode)if(this.drawing=!0,this.items[0]instanceof Ir&&this.items[1]instanceof Ir)this.command.addCommand(Ce.dispatch(this.corner.line1,"modify")),this.command.addCommand(Ce.dispatch(this.corner.line2,"modify"));else{let n=new Set;this.items.forEach(s=>{if(s instanceof mt){let a=this.items[0].getParent();a instanceof lt&&(a.removeFill(),n.add(a))}}),n.forEach(s=>this.command.addCommand(Ce.dispatch(s,"modify")))}else A.publish("valueInput",{title:"Fillet Radius",unit:R.getInstance().unit},Q());this.start()}get corner(){return this._corner}set corner(e){this.filterItems.clear(),e!=null&&(this.filterItems.add(e.line1),this.filterItems.add(e.line2)),this._corner=e}getLineAndRect(e){let r=new Set;return e.forEach(i=>{if((i instanceof Ir||i instanceof mt)&&r.add(i),i instanceof lt&&(r.add(i),!i.isClose())){let n=i.getOutMostChildren(),s=n[0];if(s instanceof mt&&r.add(s),n.length>1){let a=n.at(-1);a instanceof mt&&r.add(a)}}i instanceof rr&&r.add(i)}),[...r]}onKeyDown(e){e.keyCode===27&&this.cancel(),A.publish("updateFrame","")}valueInputEnd(e){let r=[];if(e>0&&(e=new dt().conversion(R.getInstance().unit,"mil",e/10),r=this.addFillets(this.items,e)),this.end(),r.length>0)A.publish("onlySelect",[].concat(r,this.items.filter(i=>!i.isEmpty)));else if(!isNaN(e)){let i=e>0?`Failed to add ${this.cornerType}, please try again with a smaller number`:"Please enter a number larger than zero";A.publish("ui/toastMsg",{type:"warn",msg:i},Q())}}applyInputAtCursorValue(e){let{value:r,browserCursorPoint:i,keyCode:n,editing:s}=e;if(s){at.editingWhat="circle";return}let l=new dt().conversion(R.getInstance().unit,"mil",r/10);if(l>0){let c=this.addOrUpdateFillet(this.corner,l);n===13&&(c?this.endDrag():A.publish("ui/toastMsg",{type:"warn",msg:`Failed to add ${this.cornerType}, please try again with a smaller number`},Q()))}else this.cancel()}addFillets(e,r){let i=[],n={};for(let s of e)n[s.layerId]==null&&(n[s.layerId]=new Array),n[s.layerId].push(s);for(let s of Object.values(n)){let{lineCorners:a,trackCorners:l,polygons:c,rects:h}=this.filter(s);l.forEach(u=>{if(u.points){let d=this.getArcKeyPoint(u,r),p=this.addOrUpdateTrackFillet(u,d,this.command,"add");p&&i.push(p)}}),c.forEach(u=>{let d=u.filterOutMostChildren()[0];if(d.length<2)return;let p=[];for(let m=0;m<d.length-1;m++)d[m]instanceof mt&&d[m+1]instanceof mt&&p.push(new Jy(d[m],d[m+1]));u.isClose()&&d[d.length-1]instanceof mt&&d[0]instanceof mt&&p.push(new Jy(d[d.length-1],d[0])),this.command.addCommand(Ce.dispatch(u,"modify")),p.forEach(m=>{if(m.points){let g=this.getArcKeyPoint(m,r);this.addOrUpdateLineModelFillet(m,g,"add")}}),A.publish("hasModifyPcbItem",u),u.removeFill(),u.fill(),i.push(u)}),h.forEach(u=>{if(this.cornerType==="chamfer"){let d=u.cornerRadius;if(!ne.greater(r,d)||ne.greater(r,Math.min(u.width,u.height)/2))return;let p=u.getLL(),m=u.getLR(),g=u.getUL(),y=u.getUR(),b=new Po,P=b.addLine(p,m,u.layerId,u.strokeWidth),T=b.addLine(m,y,u.layerId,u.strokeWidth),I=b.addLine(y,g,u.layerId,u.strokeWidth),C=b.addLine(g,p,u.layerId,u.strokeWidth),E=pt.addPolygon(u.type,u.layerId,[[P,T,I,C]],u.strokeWidth,u.net,!1),O=[];O.push(new Jy(P,T)),O.push(new Jy(T,I)),O.push(new Jy(I,C)),O.push(new Jy(C,P)),O.forEach(x=>{if(x.points){let v=this.getArcKeyPoint(x,r);this.addOrUpdateLineModelFillet(x,v,"add",!1)}});let _=new sE(u);_.extendOldItem(E),this.command.addCommand(Ce.dispatch(u,"delete")),_.extendOldCopperOrder(E),A.publish("delete",u),u.remove(),this.command.addCommand(Ce.dispatch(E,"add")),A.publish("hasModifyPcbItem",E),E.removeFill(),E.fill(),E.type=="Copper Region"&&A.publish("rebuildSingleCopper",{ids:[E.globalIndex],isLast:!0}),i.push(E)}else this.command.addCommand(Ce.dispatch(u,"modify")),u.cornerRadius=r,u.removeFill(),u.fill(),u.type=="Copper Region"&&A.publish("rebuildSingleCopper",{ids:[u.globalIndex],isLast:!0}),A.publish("hasModifyPcbItem",u),i.push(u)}),a.forEach(u=>{if(u.points){let d=this.getArcKeyPoint(u,r),p=this.addOrUpdateLineModelFillet(u,d,"add");p&&i.push(p)}})}return this.res=i,i}addOrUpdateFillet(e,r){if(e.line1 instanceof mt&&e.points){let i=this.getArcKeyPoint(e,r);if(!i.canAddFillet)return!1;this.addOrUpdateLineModelFillet(e,i)}else if(e.line1 instanceof Ir&&e.points){let i=this.getArcKeyPoint(e,r);if(!i.canAddFillet)return!1;this.addOrUpdateTrackFillet(e,i)}return this.filterItems.add(this.corner.arc),this.corner.arc&&this.corner.arc.click(),!0}addOrUpdateLineModelFillet(e,r,i,n=!0){let{radius:s,circleCenter:a,tangencyPoint1:l,tangencyPoint2:c,startAngle:h,endAngle:u,sweep:d,canAddFillet:p}=r;if(!p)return;let m=()=>(y==="fillet"?e.arc=Yc.addArc(b.layerId,a,s,b.width,h,u,d,!1):y==="chamfer"&&(e.arc=Cu.add(b.layerId,l,c,b.width,!1)),b.getParent().insertChildren(e.arc,[T[0],T[1]+1]),e.arc),g=()=>{if(e.arc instanceof _t||e.arc instanceof mt)return y==="fillet"?(e.arc.center=a,e.arc.radius=s,e.arc.startAngle=h,e.arc.endAngle=u):y==="chamfer"&&(e.arc.start=l,e.arc.end=c),e.arc},y=this.cornerType,b=e.line1,P=new Set;[e.line1,e.line2].forEach(C=>{P.add(C.getParent())}),P.forEach(C=>{n&&this.command.addCommand(Ce.dispatch(C,"modify")),this.filterItems.add(C)}),this.fixCornerLines(e,l,c);let T=[0,0],I=b.getParent().getChildrens();for(let C=0;C<I.length;C++)for(let E=0;E<I[C].length;E++)if(I[C][E]===b){T=[C,E];break}return i==="add"?m():e.arc instanceof _t||e.arc instanceof mt?g():m()}addOrUpdateTrackFillet(e,r,i,n){let{circleCenter:s,tangencyPoint1:a,tangencyPoint2:l,startAngle:c,endAngle:h,sweep:u,radius:d,canAddFillet:p}=r,m=e.line1,g=e.line2;if(!p)return;this.command.addCommand(Ce.dispatch(e.line1,"modify")),this.command.addCommand(Ce.dispatch(e.line2,"modify")),this.fixCornerLines(e,a,l);let y=this.cornerType;if(n==="add")return b();if(e.arc instanceof yi||e.arc instanceof Ir)return P();return b();function b(){y==="fillet"?e.arc=pr.addArcTrack(m.layerId,s,d,c,h,u,m.width,!1,m.net):y==="chamfer"&&(e.arc=pr.addTrack(m.layerId,a,l,m.width,!1,m.net));let T=e.arc;return i&&i.addCommand(Ce.dispatch(T,"add")),A.publish("hasModifyPcbItem",e.line1),A.publish("hasModifyPcbItem",e.line2),A.publish("hasModifyPcbItem",T),T}function P(){return y==="fillet"?(e.arc.center=s,e.arc.radius=d,e.arc.startAngle=c,e.arc.endAngle=h):y==="chamfer"&&(e.arc.start=a,e.arc.end=l),e.arc}}fixCornerLines(e,r,i){let n=e.line1,s=e.line2,a=e.midPoint;l(n,r),l(s,i);function l(c,h){c.start.distance2(a)<c.end.distance2(a)?c.start=h:c.end=h}}getArcKeyPoint(e,r){let i=this.dragMode?1:.5,n=!0,{startPoint:s,midPoint:a,endPoint:l}=e.points,c=s.sub(a),h=l.sub(a),u=zD(c,h)/2;if(Math.abs(u-Go)<.001)return this.logger.debug1("\u5E73\u89D2\u4E0D\u7528\u5012\u89D2"),{canAddFillet:!1};let d=r/Math.sin(u>Go?Math.PI-u:u),p=r/Math.tan(u>Go?Math.PI-u:u),m=p/c.length();if(ne.greater(m,i))return this.logger.debug1("\u5207\u70B91\u8D85\u51FA\u8303\u56F4\u4E0D\u505A\u5012\u89D2"),{canAddFillet:!1};let g=new S(c.x*m,c.y*m),y=new S(g.x+a.x,g.y+a.y);if(m=p/h.length(),ne.greater(m,i))return this.logger.debug1("\u5207\u70B92\u8D85\u51FA\u8303\u56F4\u4E0D\u505A\u5012\u89D2"),{canAddFillet:!1};let b=new S(h.x*m,h.y*m),P=new S(b.x+a.x,b.y+a.y);m=c.length()/h.length(),h=new S(h.x*m,h.y*m);let T=new S(h.x+a.x,h.y+a.y),I=(s.x+T.x)/2,C=(s.y+T.y)/2,E=new S(I-a.x,C-a.y);if(E.length()===0)throw new Error("v3\u662F\u96F6\u5411\u91CF");m=d/E.length();let O=new S(E.x*m,E.y*m),_=O.x+a.x,x=O.y+a.y,v=new S(_,x),D=iXe(v,y),w=iXe(v,P),F;if(D>w&&D-w<Math.PI||D<w&&w-D>Math.PI?F=ae.CW:F=ae.CCW,s.equals1(e.line2.start)||s.equals1(e.line2.end)){let H=y;y=P,P=H}return{radius:r,circleCenter:v,tangencyPoint1:y,tangencyPoint2:P,startAngle:D,endAngle:w,sweep:F,canAddFillet:n}}getRadius(e,r){let{startPoint:i,midPoint:n,endPoint:s}=e.points;if(n.equals1(r))return 0;let a=new S(r.x-n.x,r.y-n.y),l=new S(i.x-n.x,i.y-n.y),c=new S(s.x-n.x,s.y-n.y),h=zD(a,l),u=zD(a,c),d=zD(l,c);if(h>=d||u>=d)return 0;let p=Math.sin(d/2),m=nXe(l,c),g=new S(r.x-n.x,r.y-n.y),y=zD(m,g),b=g.length()*Math.cos(y),P=g.length()*Math.sin(y),T=1/(p*p)-1,I=-2*b/p,C=b*b+P*P,E;if(T!==0){let{x1:O,x2:_}=Zxt(T,I,C);E=Math.max(O,_)}else E=-C/I;if(isNaN(E))throw new Error("\u534A\u5F84\u8BA1\u7B97\u51FA\u9519");return E}getRadius1(e,r){let{startPoint:i,midPoint:n,endPoint:s}=e.points;if(n.equals1(r))return 0;let a=new S(i.x-n.x,i.y-n.y),l=new S(s.x-n.x,s.y-n.y),c=nXe(a,l),h=Jxt(c,n,r),u=new S(h.x-n.x,h.y-n.y),d=zD(a,l)/2,p=u.length()/Math.cos(d)*Math.tan(d);if(isNaN(p))throw new Error("\u534A\u5F84\u8BA1\u7B97\u51FA\u9519");return p}filter(e){let r=new Array,i=new Array,n=new Array,s=new Array;for(let c=0;c<e.length;c++){let h=e[c];h instanceof mt?r.push(h):h instanceof Ir?i.push(h):h instanceof lt?n.push(h):h instanceof rr&&s.push(h)}let a=this.getCorners(r),l=this.getCorners(i);return{lineCorners:a,trackCorners:l,polygons:n,rects:s}}getCorners_(e){let r={};for(let i=0;i<e.length;i++)for(let n=i+1;n<e.length;n++){let s=Kxt(e[i],e[n]);s&&(r[s.midPoint.toString()]?r[s.midPoint.toString()].push(s):r[s.midPoint.toString()]=[s])}return Object.values(r).reduce((i,n)=>(n.length==1&&i.push(n[0]),i),[])}getCorners(e){let r={},i=[];return e.forEach(n=>{if(n.start.equals(n.end))return;let s=n.start.clone(),a=n.end.clone(),l=n.layerId,c=i.find(u=>Qy(u[0],s)),h=i.find(u=>Qy(u[0],a));if(c){let u=c[1],d=u[l];d?(d.forEach(p=>{let m;Qy(p.start,s)?m=new Jy(n,p):m=new Jy(p,n),r[m.midPoint.toString()]?r[m.midPoint.toString()].push(m):r[m.midPoint.toString()]=[m]}),d.push(n)):u[l]=[n]}else i.push([s,{[l]:[n]}]);if(h){let u=h[1],d=u[l];d?(d.forEach(p=>{let m;Qy(p.end,a)?m=new Jy(p,n):m=new Jy(n,p),r[m.midPoint.toString()]?r[m.midPoint.toString()].push(m):r[m.midPoint.toString()]=[m]}),d.push(n)):u[l]=[n]}else i.push([a,{[l]:[n]}])}),Object.values(r).reduce((n,s)=>(s.length==1&&n.push(s[0]),n),[])}onMouseLeftUp(e){this.dragMode&&(at.destroy(),this.endDrag())}endDrag(){if(this.corner.arc){if(this.items[0]instanceof mt){let e=this.items[0].getParent();e.fill(),A.publish("hasModifyPcbItem",e),A.publish("onlySelect",[e])}else this.items[0]instanceof Ir&&(this.command.addCommand(Ce.dispatch(this.corner.arc,"add")),A.publish("hasModifyPcbItem",this.corner.line1),A.publish("hasModifyPcbItem",this.corner.line2),A.publish("hasModifyPcbItem",this.corner.arc),A.publish("onlySelect",[this.corner.line1,this.corner.line2,this.corner.arc]));at.destroy(),this.end()}}end(){var r;this.dragMode=!1,this.drawing=!1;let e=(r=this.corner)==null?void 0:r.arc;if(e){let i=e.getParent();i instanceof lt&&i.removeSelect(e)}qe.executeCommand(this.command),this.command=new De("Add Corner"),A.publish("flushService",""),A.publish("tool","dropdrag"),A.publish("updateCross",""),this.res!=null&&A.publish("onlySelect",new Set([...this.items.filter(i=>!i.isEmpty),...this.res]))}onMouseMove(e){if(!this.dragMode)return;let r=this.getRadius1(this.corner,new S(e.sceneX,e.sceneY));r>0?this.addOrUpdateFillet(this.corner,r):r=0;let i=nf(),n=_o(new S(e.sceneX,e.sceneY)),s={frameInfo:i,show:!0,type:"circle",data:[{frameCursorPoint:n,info:{tagName:"Fillet Radius",value:je(r),unit:R.getInstance().unit,type:"circle"}}]};at.create(s)}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:rXe(e.adsorb).result};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}interrupt(){at.destroy(),this.end()}cancel(){if(this.fixCornerLines(this.corner,this.corner.midPoint,this.corner.midPoint),this.corner.arc instanceof _t||this.corner.arc instanceof mt){let e=this.corner.arc.getParent(),r=e.getChildrens();for(let i=0;i<r.length;i++)for(let n=0;n<r[i].length;n++)r[i][n]==this.corner.arc&&e.removeChild([i,n])}this.corner.arc!=null&&(this.corner.arc.remove(),A.publish("delete",this.corner.arc)),this.interrupt(),this.end()}isDragMode(e){this.logger.debug3("%s %s","111111",e);let r=e.filter(i=>i instanceof lt);if(e.length-r.length==2){let i=e.filter(a=>!(a instanceof lt)),n=r.map(a=>a.getChildrens()).flat(2);n.length==i.length&&n.every(a=>i.includes(a))&&(e=i)}if(e.length===2&&(e[0]instanceof mt&&e[1]instanceof mt||e[0]instanceof Ir&&e[1]instanceof Ir)&&$xt(e[0],e[1]))return this.corner=this.getCorners(e)[0],this.corner!=null;if(e.length===1&&e[0]instanceof lt){let i=e[0].getChildrens();if(i.length!=1)return!1;let n=i[0];if(n.length===2&&n[0]instanceof mt&&n[1]instanceof mt)return this.corner=this.getCorners(n)[0],this.corner!=null}return!1}};function Qy(o,t){return Math.abs(o.x-t.x)<1e-4&&Math.abs(o.y-t.y)<1e-4}function $xt(o,t){let e=o.start,r=o.end,i=t.start,n=t.end;return!!(Qy(e,i)||Qy(e,n)||Qy(r,i)||Qy(r,n))}function Kxt(o,t){if(o.start.equals(o.end)||t.start.equals(t.end)||o.layerId!=t.layerId)return null;let e=o.start.clone(),r=o.end.clone(),i=t.start.clone(),n=t.end.clone(),s=0,a;return Qy(e,i)&&(s++,a=new Jy(t,o)),Qy(e,n)&&(s++,a=new Jy(t,o)),Qy(r,i)&&(s++,a=new Jy(o,t)),Qy(r,n)&&(s++,a=new Jy(t,o)),s===1?a:null}var Jy=class{constructor(t,e){this.line1=t,this.line2=e,this.points=this.keyPoints(),this.points&&(this.startPoint=this.points.startPoint,this.midPoint=this.points.midPoint,this.endPoint=this.points.endPoint)}isConnect(){return!!this.keyPoints()}keyPoints(){let t=this.line1,e=this.line2;if(t.start.equals(t.end)||e.start.equals(e.end))return null;let r=t.start.clone(),i=t.end.clone(),n=e.start.clone(),s=e.end.clone(),a=0,l;return Qy(r,n)&&(a++,l={startPoint:i,midPoint:r,endPoint:s}),Qy(r,s)&&(a++,l={startPoint:n,midPoint:s,endPoint:i}),Qy(i,n)&&(a++,l={startPoint:r,midPoint:i,endPoint:s}),Qy(i,s)&&(a++,l={startPoint:r,midPoint:i,endPoint:n}),a===1?l:null}};function zD(o,t){if(o.x===0&&o.y===0||t.x===0&&t.y===0)throw new Error("\u96F6\u5411\u91CF\u4E0D\u80FD\u8BA1\u7B97\u5939\u89D2");let e=(o.x*t.x+o.y*t.y)/(o.length()*t.length());return e>1?e=1:e<-1&&(e=-1),Math.acos(e)}function iXe(o,t){let e;if(o.x===t.x)e=Go;else{let r=new S(t.x-o.x,t.y-o.y),i=new S(Math.abs(o.x-t.x),0);e=zD(r,i)}return t.y<o.y&&(e=kr-e),e}function nXe(o,t){let e=o.normalize(),r=t.normalize();return new S(e.x+r.x,e.y+r.y).normalize()}function Zxt(o,t,e){try{if(t*t-4*o*e<0)throw new Error("\u65B9\u7A0B\u65E0\u89E3");let r=Math.sqrt(t*t-4*o*e),i=(-t+r)/(2*o),n=(-t-r)/(2*o);return{x1:i,x2:n}}catch(r){console.log(r)}}function Jxt(o,t,e){let r=new S(e.x-t.x,e.y-t.y),i=zD(o,r),n=r.length()*Math.cos(i),s=new S(o.x*n,o.y*n);return new S(s.x+t.x,s.y+t.y)}var Ude=class extends ni{constructor(t,e,r,i,n){super(),this.start(),this.option="OPTIONLEFTUP",this.oldToolDrawing=e,this.drawing=!0,this.tool=t,this.lastTool=r,this.selectPadProgram=i,this.msg=n}onKeyDown(t){switch(tr.getAction(4,t)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(t);return}A.publish("updateFrame","")}onMouseMove(t){if(this.drawing){Ut.update(t,this.msg);let r=new _e().ext2(new S(t.realSceneX,t.realSceneY)).ext7(1).build1(),i=kt.search(r,(s,a)=>a=="Pad");i.setFilter(new ed);let n=new b1;i.setAction(n),i.doAction(["Pad"]);for(let s of n.pads){s.click(),A.publish("onlySelect",[s]);return}A.publish("clearSelect","")}}onMouseLeftUp(t){if(this.drawing){let r=new _e().ext2(new S(t.realSceneX,t.realSceneY)).ext7(1).build1(),i=kt.search(r,(s,a)=>a=="Pad");i.setFilter(new ed);let n=new b1;i.setAction(n),i.doAction(["Pad"]);for(let s of n.pads){this.toggleLastTool(),di.resetLastScene(),Ut.cancel(),s.click(),A.publish("select",[s]),this.selectPadProgram.pad=s;return}}}toggleLastTool(){this.tool.setNextTool(new Vc),this.tool.drawing=this.oldToolDrawing}interrupt(){this.drawing=!1,this.toggleLastTool(),di.resetLastScene(),this.selectPadProgram.pad=null,Ut.cancel(),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}parse(t){switch(this.drawing=!0,t.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}rightClickMenuData(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:po(t.adsorb)};$t.getInstance().menuData(e,this),this.drawing=!1}};var Hde=class extends ni{constructor(e,r,i,n){super();this.temDatumLine=null;this.start(),this.option="OPTIONLEFTUP",this.oldToolDrawing=r,this.drawing=!0,this.tool=e,this.lastTool=i,this.msg=n}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onEnterPlace(e);return}A.publish("updateFrame","")}onMouseMove(e){if(this.drawing){Ut.update(e,this.msg);let i=new _e().ext2(new S(e.realSceneX,e.realSceneY)).ext7(1).build1(),n=kt.search(i,(a,l)=>l=="Polygon");n.setFilter(new ed).setFilter(new Mp(e.sceneX,e.sceneY));let s=new Z4;n.setAction(s),n.doAction(["Polygon"]),this.temDatumLine&&this.temDatumLine.visible();for(let a of s.d3SideSlotDatumLine){this.temDatumLine=a,a.click();return}A.publish("clearSelect","")}}onMouseLeftUp(e){if(this.drawing){let i=new _e().ext2(new S(e.realSceneX,e.realSceneY)).ext7(1).build1(),n=kt.search(i,(a,l)=>l=="Polygon");n.setFilter(new ed).setFilter(new Mp(e.sceneX,e.sceneY));let s=new Z4;n.setAction(s),n.doAction(["Polygon"]);for(let a of s.d3SideSlotDatumLine){this.tool.setNextTool(new Vc),di.resetLastScene(),Ut.cancel(),a.click(),A.publish("select",[a]),Fc.pushBaseLine(a),Fc.completed();return}}}interrupt(){this.drawing=!1,Ut.cancel(),Fc.interrupt(),this.temDatumLine&&(this.temDatumLine.visible(),this.temDatumLine=null),this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this),this.drawing=!1}};var Wde=class extends ni{constructor(){super();this.commands=new De("draw stacktable");this.stackTable=null;this.groupName="\u5C42\u5806\u53E0";this.option="OPTIONLEFTUP";let e=this.getPhysicalStackConfig();A.windowBridge.rpcCall("getPhysicalStackingConfig",[e],Q()).then(i=>{this.stackConfig=i.message}),this.start()}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":this.cancel();break}}onMouseLeftUp(e){oXe(this.stackTable)||this.placeStackTable(e)}onMouseMove(e){let r=new S(e.sceneX,e.sceneY);if(this.drawing){if(this.stackTable!==null&&!this.stackTable.isUpdate()){let i=r.sub(this.stackTable.origin),n=Ae.translate(i.x,i.y,0);this.stackTable.transform(n)}else if(this.stackTable!==null&&(this.stackTable.remove(),A.publish("delete",this.stackTable),this.stackTable=null),this.stackConfig){let i=new v6(this.stackConfig,13,this.groupName);i.addStackTable(r),this.stackTable=i}}}placeStackTable(e){let r=!0;for(let a of this.stackTable.items)if(r&&!Mt.checkIsInCanEdit(a)){let l="beyond drawing range";Mt.showMassageTip(l,l),r=!1}if(!r){for(let a of this.stackTable.items)a.partition="";return}if(!this.stackTable.joinCombination())return;let i=this.stackTable.items;A.publish("onlySelect",i);for(let a of i)A.publish("hasModifyPcbItem",a);this.commands.addCommand(new wA(this.stackTable,"add")),qe.executeCommand(this.commands),A.publish("flushService",""),this.commands=new De("draw stacktable"),this.drawing=!0,this.stackTable=null;let n=new S(e.sceneX,e.sceneY),s=new v6(this.stackConfig,13,this.groupName);s.addStackTable(n),this.stackTable=s}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:Cse(e.adsorb).result};$t.getInstance().menuData(r,this),this.drawing=!1}cancel(){this.interrupt(),A.publish("tool","dropdrag")}interrupt(){this.stackTable!==null&&(this.stackTable.remove(),this.drawing=!1,this.stackTable=null,A.publish("updateRtree","")),this.end()}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"TABLE_SETTING":A.windowBridge.publish("openTableSetting",{cmd:"place_part(stack_table)"},Q());break}}getPhysicalStackConfig(){let e=new dt,r=Pe.getLayerPhys().map(n=>({Layer:n.layerName,Type:n.layerType,Material:i(n.material),Thickness:n.thickness!=null?ve(e.mil2mm(n.thickness*10),3):"-",Permittivity:i(n.permittivity),"Loss Tangent":i(n.lossTangent)}));function i(n){return oXe(n)?"-":n}return r}};function oXe(o){return o==null}var zde=class extends eP{constructor(e,r){super();this.profile=null;this.type=e,this.confirmWindowCb=r}getResult(e){let r=new Array;e.shape.forEach(i=>{let n=this.getModel(i);r.push(n),i.remove()}),r.length>0&&(this.profile=ge.build2(r)),e.shape.length=0}getModel(e){if(e instanceof Vi||e instanceof es)return e.primitive;if(e instanceof cr)return new M(e.start,e.end);if(e instanceof gs)return q.build2(e.center,e.startAngle,e.endAngle,e.radius,e.radius,e.sweep)}confirmWindow(e,r){if(this.profile!=null){let i=new Array;this.type=="Line"?(this.profile.primitives.forEach(n=>{let s=n.stroke(e._width,wr.ROUND,ae.CCW),a=Vr.getSelectContect(s);if(n instanceof M){let l=n.start(),c=Array.from(a);Er(c,(h,u)=>h.buildBBox().center().distance2(l)-u.buildBBox().center().distance2(l),0,c.length),i=i.concat(c)}}),i=Array.from(jt.filterElement(i,{boxChoose:!0})),i.forEach(n=>{n.click()}),A.publish("clearSelect",""),A.publish("select",i),gr.model=1,A.publish("tool","dropdrag")):this.type=="Prohibited Region"||this.type=="Fill Region",this.confirmWindowCb&&this.confirmWindowCb(i)}}setConfirmWindowCb(e){this.confirmWindowCb=e}modify(e,r,i){}};var Yde=class extends Dg{constructor(e,r){super();this.event=new du;this.logger=new Di(4);switch(this.event=new du,this.resultEvent=new zde(e,r),e==="Line"&&(this.event.needClose=!1),Zt.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new eh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new Gh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new ja(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Tl(this.event,Ur,this.resultEvent);break}this.event.commands=new De("draw 2DLine - "+e),Ur.addDrawTool(this),vu.disable=!0,this.start()}onKeyDown(e){switch(tr.getAction(4,e)){case"changeRoutingAngle":case"Routing Corner":this.wireCorner(Ur.getNextType());break}this.drawPolygon.onKeyDown(e)}onMouseLeftUp(e){this.drawPolygon.onMouseLeftUp(e)}onMouseMove(e){this.drawing&&this.drawPolygon.onMouseMove(e)}onMouseRightUp(e){if(e.openMenu)switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?(this.drawPolygon.abortLast=!0,this.completed()):this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.cancel();break}}}interrupt(){vu.disable=!1,this.drawPolygon.interrupt(),Ur.clearDrawTool(),gr.model=1,this.end()}cancel(){vu.disable=!1,A.publish("clearSelect",""),this.drawPolygon.cancel()}flipPath(){this.drawPolygon.flipPath()}toggleLayer(e){this.drawPolygon.toggleLayer(e)}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new eh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new Gh(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_ARC":this.drawPolygon=new ja(this.event,Ur,this.resultEvent);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Tl(this.event,Ur,this.resultEvent);break}this.event.start!=null&&this.drawing&&(this.event.last==null&&(this.event.last=this.event.start),this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr)),Zt.getInstance().type=e,we.synchronize()}wireWidth(e){this.drawPolygon.wireWidth(e)}completed(){vu.disable=!1,A.publish("clearSelect",""),this.drawPolygon.completed(!1)}backspace(){this.drawPolygon.backspace()}wireMode(e){}rightClickMenuData(e){let r=this.event.start!=null,i={state:"show",left:e.mouseX,top:e.mouseY,filter:vg(Zt.getInstance().type,e.adsorb,r,!0).result};$t.getInstance().menuData(i,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"COMPLETE":this.completed();break;case"CANCEL":this.cancel();break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":this.wireCorner(i[1]);break;case"WIRING_WIDTH_INPUT":A.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}setConfirmWindowCb(e){this.resultEvent.setConfirmWindowCb(e)}};var jde=class extends Yde{constructor(){super("Line");this.oldSelect=new Set;this.setConfirmWindowCb(this.confirmWindowCb.bind(this)),this.oldSelect=new Set(ze.getSelects())}confirmWindowCb(e){this.logger.debug3("%s %s","\u81EA\u5B9A\u4E49\u8DEF\u5F84\u91CD\u65B0\u7F16\u53F7\u9009\u62E9\u7ED3\u679C...",e);let r=S5.options;r.range!=="allPads"&&(e=e.filter(i=>this.oldSelect.has(i))),r.selectItems=e,S5.renumber(r),this.end()}};var dC=class o{constructor(t=!1,e=!1,r=1.6){this.isDiffRoute=e,this.diffPairSpacing=r,this.checkPath=t}draw(t,e,r,i,n,s,a,l,c,h,u,d){let{start:p,end:m,endX:g,endY:y,directX:b,directY:P,height:T}=t;wt.setPushFilter(),this.isDiffRoute?(e=this.midLineLimitWidth(r,e),r=="arc90"&&(i+=this.diffPairSpacing)):wt.pushFilter.setNetAndLayerId(l.item.net,l.item.layerId);let I=s*2;n=this.getMinWidth(r,s,n);let C=Math.max(Math.abs(T),i),E=new Array,O=p,_=!1,x=0,v=!1,D=0;for(;D<e;){let w=x%2==0||a?1:-1,F="1",H="1";(x==0||!_||a)&&(F="0"),a&&(H="0");let z=new TOe(O,b,P.mul(w),C,n,s,a,F,H,r),V=this.block(z,i,I,r,C,l,c,u,d),W=!V;if(O.distance1(z.end)+D>=e)V=!1;else if(v=this.isNeedSplit(E,z,W,l),v)return{splitBlockTrack:v};if(h!=null&&V&&(V=this.restrictByMaxLength(h,z,E,i,I,r,C,s,u,l,d,c).success),V)E.push(z),_=!0;else{let k=E.pop();for(;k!=null;)if(k.rightStyle="0",V=this.block(k,i,I,r,C,l,c,u,d),p.distance1(k.end)>=e&&(V=!1),h!=null&&V&&(V=this.restrictByMaxLength(h,k,E,i,I,r,C,s,u,l,d,c).success),V){E.push(k);break}else k=E.pop();_=!1}O=this.getNextPoint(z,r),D=p.distance1(O),z.result.length>0&&x++}if(wt.filter=null,this.isDiffRoute){let w=[new Array,new Array],F=[];for(let H of E)H.diffResult.forEach((z,V)=>{let W=z[0].start();F[V]!=null&&W.distance2(F[V])>1e-8&&w[V].push(new M(F[V],W)),xe.addAll(w[V],z),F[V]=z[z.length-1].end()});return{paths:w.map(H=>this.mergeArcs(H).filter(z=>z.length()>1e-8)),templates:E}}else{let w=p,F=new Array;for(let H of E)H.start.distance2(w)>1e-8&&F.push(new M(w,H.start)),xe.addAll(F,H.result),w=H.end;return{path:this.mergeArcs(F).filter(H=>H.length()>1e-8),templates:E,splitBlockTrack:v}}}static lengthen(t,e=100){let r=t.length(),i=t.direct.mul(e*r);return new M(t.start().sub(i),t.end().add(i))}isNeedSplit(t,e,r,i){if(!r||!this.checkPath||t.length<0)return!1;let n=Zt.getInstance().mode;if(n==="WIRING_MODE_SURROUND_AND_PUSHAWAY"||n==="WIRING_MODE_SURROUND"||n==="WIRING_MODE_OBSTRUCT"){let s=e.start,a=e.end,l=new zr(`TRACK${rf.getInstance().getID()}`,i.item.layerId,s,a,i.item.width,!1,i.item.net);if(new ms().blockTrack2(l).length>0)return!0}return!1}mergeArcs(t){if(t.length==0)return[];let e=[t[0]];for(let r=1;r<t.length;r++){let i=e[e.length-1],n=t[r];if(n instanceof q&&i instanceof q){let s=this.arcAngleMerge(i,n);s?(e.pop(),e.push(s)):e.push(n)}else e.push(n)}return e}arcAngleMerge(t,e){return!t.center.equals1(e.center)||!ne.eq(t.rx,e.rx)?null:q.build2(t.center,t.startAngle,t.sweepAngle*e.sweepAngle>0?e.endAngle():e.startAngle,t.rx,t.ry,t.sweep())}getMinWidth(t,e,r){switch(t){case"line45":return Math.max(r,e*2);case"line90":return Math.max(r,e);case"arc90":default:return Math.max(r,e)}}getNextPoint(t,e){let r=!1;switch(t.result.length||(r=!0),e){case"line45":{let i=t.lineWidth,n=t.gap-Math.min(i/Math.sqrt(2)*2,t.height);return r?t.start.add(t.referDirect.mul(n/2)):t.isSingleSide?(this.isDiffRoute&&(i=this.midLineWidth(i)),t.end.add(t.referDirect.mul(n))):t.end}case"line90":return r?t.start.add(t.referDirect.mul(t.gap/2)):t.isSingleSide?t.end.add(t.referDirect.mul(t.gap)):t.end;case"arc90":{if(r){let i=t.gap;return t.start.add(t.referDirect.mul(i/2))}return t.isSingleSide?t.end.add(t.referDirect.mul(t.gap-Math.min(t.height,t.gap))):t.end}default:return t.end}}block(t,e,r,i,n,s,a,l,c){t.height=n;let h=Zt.getInstance().mode;if(a&&a.length>0){let d=this.collide(t,e,r,i,n,s,a,l,c);return d||(t.result.length=0,t.diffResult.forEach(p=>p.length=0)),d}let u=!1;switch(h){case"WIRING_MODE_IGNORE":return this.snake(t,i),!0;case"WIRING_MODE_PUSHAWAY":case"WIRING_MODE_SURROUND_AND_PUSHAWAY":case"WIRING_MODE_SURROUND":case"WIRING_MODE_OBSTRUCT":return u=this.collide(t,e,r,i,n,s,a,l,c),u||(t.result.length=0,t.diffResult.forEach(d=>d.length=0)),u}}collide(t,e,r,i,n,s,a,l,c){for(;!ne.less(t.height,e);){let d=this.blockTemplete(t,i,s,a,l,c);if(d.length>0){let p=this.getBlockMin(d,t);t.height=Math.min(p,n)}else return!0}return t.height=e,!(this.blockTemplete(t,i,s,a,l,c,!0).length>0)}getBlockMin(t,e){let r=Number.MAX_VALUE,i=e.normalDirect,n=e.referDirect,s=e.start,a=[];if(t.forEach(l=>{let c=l.point.sub(s),h=Math.abs(i.dot(c)),u=e.style,d=l.source,p=l.point;if(u==="line45")if(d.direct.equals(i)||d.direct.equals(i.mul(-1)))this.isDiffRoute?h+=this.midLineWidth2(e.lineWidth)/Math.sqrt(2):h+=e.lineWidth/Math.sqrt(2);else{let m=Math.abs(s.sub(p).dot(i));this.isDiffRoute&&(m-=this.diffPairSpacing/2);let g=e.height-m;h+=g}this.isDiffRoute&&(h-=this.diffPairSpacing/2),Math.abs(e.height-h)<=.001&&a.push(l),h<r&&(r=h)}),Math.abs(e.height-r)<=.001){let l=e.lineWidth/2;r-=l}return r}blockTemplete(t,e,r,i,n,s,a=!1){let l=new ms,c=Zt.getInstance().mode;this.snake(t,e,!0);let h=this.getSnakeShapes(t,r,s,n),u=[],d=r==null?void 0:r.parent.getAllItems(),p=s==null?void 0:s.parent.getAllItems();for(let m of h){let g=l.blockTrack2(m,c==="WIRING_MODE_PUSHAWAY");if(this.isDiffRoute&&(g=g.filter(y=>{let b=p.indexOf(y.obstacle)<0,P=d.indexOf(y.obstacle)<0;return b&&P})),u.push(...g),u.length&&a)return u;Sn.getInstance().delete(m,m.globalIndex)}return u}getSnakeShapes(t,e,r,i){let n;if(this.isDiffRoute){let s=e,a=r;if(i){let l=this.create4Path(t,t.diffResult[0],s),c=this.create4Path(t,t.diffResult[1],a);n=[].concat(l,c)}else{let l=this.create4Path(t,t.diffResult[1],s),c=this.create4Path(t,t.diffResult[0],a);n=[].concat(l,c)}}else n=this.create4Path(t,t.result,e);return n}snake(t,e,r=!1){this.isDiffRoute?this.diffPairSnake(t,e,r):this.singleSnake(t,e,r)}singleSnake(t,e,r=!1){switch(t.result.length=0,t.height==0&&t.result.push(new M(t.start,t.end)),e){case"line45":{this.degree45(t,r);break}case"line90":{this.degree90(t,r);break}case"arc90":default:{this.arc90(t,r);break}}}diffPairSnake(t,e,r=!1){t.diffResult.forEach(a=>a.length=0);let i=t.lineWidth;t.lineWidth=this.midLineWidth(i),this.singleSnake(t,e,r),t.lineWidth=i;let n=[-1,1].map(a=>{let l=new M(t.start,t.start.add(t.referDirect)),c=new M(t.end,t.end.add(t.referDirect)),h=[].concat([l],t.result,[c]);return h=h.filter(u=>u.length()>0),h.map(u=>u.panDistance(a*this.diffPairSpacing/2))}),s=[[],[]];n.forEach((a,l)=>{let c=s[l];for(let h=1;h<a.length;h++){let u=h==1?a[0]:c[h-1],d=a[h];if(u instanceof q&&d instanceof M)c[h]=new M(u.end(),d.end());else if(u instanceof M&&d instanceof q)c[h-1]=new M(u.start(),d.start()),c[h]=d;else if(u instanceof M&&d instanceof M)if(Pt(o.lengthen(u),o.lengthen(d))>0){let m=new S(Ee[0],Ee[1]);c[h-1]=new M(u.start(),m),c[h]=new M(m,d.end())}else c[h]=d;else c[h]=d}c.shift(),c.pop()}),t.diffResult=s}degree45(t,e=!1){let r=null;if(t.isSingleSide){let i=this.line45Model(t.start,t.referDirect,t.normalDirect,t.height,t.lineWidth,t.leftStyle,!1),n=t.referDirect.mul(t.gap-Math.min(t.lineWidth/Math.sqrt(2)*2,t.height)),s=i[i.length-1].add(n),a=this.line45Model(s,t.referDirect,t.normalDirect.mul(-1),t.height,t.lineWidth,t.rightStyle,!1);r=a[a.length-1],i.push(s),this.createLines(i,t.result),this.createLines(a,t.result)}else{let i=this.line45Model(t.start,t.referDirect,t.normalDirect,t.height,t.lineWidth,t.leftStyle,!1),n=t.referDirect.mul(t.gap-Math.min(t.lineWidth/Math.sqrt(2),t.height)*2),s=i[i.length-1].add(n),a=this.line45Model(s,t.referDirect,t.normalDirect.mul(-1),t.height,t.lineWidth,t.rightStyle,!0);r=a[a.length-1],i.push(s),this.createLines(i,t.result),this.createLines(a,t.result)}return t.end=r,r}degree90(t,e=!1){let r=t.referDirect.mul(t.gap),i=this.line90Model(t.start,t.normalDirect,t.height),n=i[i.length-1].add(r),s=this.line90Model(n,t.normalDirect.mul(-1),t.height),a=s[s.length-1];return i.push(n),this.createLines(i,t.result),this.createLines(s,t.result),t.end=a,a}arc90(t,e=!1){let r,i=this.arc90Model(t.start,t.referDirect,t.normalDirect,t.height,t.gap,t.leftStyle,!1),n=t.referDirect.mul(t.gap-Math.min(t.height,t.gap)),s=i[i.length-1].end().add(n),a=this.arc90Model(s,t.referDirect,t.normalDirect.mul(-1),t.height,t.gap,t.rightStyle,!0);return r=a[a.length-1].end(),xe.addAll(t.result,i),i[i.length-1].end().equals1(s)||t.result.push(new M(i[i.length-1].end(),s)),xe.addAll(t.result,a),t.end=r,r}line45Model(t,e,r,i,n,s,a){let l=e.add(r).normalize();if(n=n/Math.sqrt(2),s=="0"){let c=i-n*2;if(ne.less(c,0)){let m=i*Math.sqrt(2),g=t.add(l.mul(m));return[t,g]}let h=n*Math.sqrt(2),u=t.add(l.mul(h)),d=u.add(r.mul(c)),p=d.add(l.mul(h));return[t,u,d,p]}else{let c=i-n;if(ne.less(c,0)){let h=i*Math.sqrt(2),u=t.add(l.mul(h));return[t,u]}if(a){let h=n*Math.sqrt(2),u=t.add(l.mul(h)),d=u.add(r.mul(c));return[t,u,d]}else{let h=n*Math.sqrt(2),u=t.add(r.mul(c)),d=u.add(l.mul(h));return[t,u,d]}}}line90Model(t,e,r){return[t,t.add(e.mul(r))]}arc90Model(t,e,r,i,n,s,a){let l=new Array;if(s=="0"){let c=i-n,h=e.add(r).normalize();if(ne.less(c,0)){let P=i*Math.sqrt(2)/2,T=t.add(h.mul(P)),I=this.createArc(e,t,T),C=T.add(h.mul(P)),E=this.createArc(r,T,C);return l.push(I,E),l}let u=n*Math.sqrt(2)/2,d=t.add(h.mul(u)),p=d.add(r.mul(c)),m=p.add(h.mul(u)),g=this.createArc(e,t,d),y=new M(d,p),b=this.createArc(r,p,m);return l.push(g,y,b),l}else{let c=i-n/2,h=e.add(r).normalize();if(a){if(ne.less(i,n)){let y=i*Math.sqrt(2)/2,b=t.add(h.mul(y)),P=this.createArc(e,t,b),T=b.add(r.mul(i/2)),I=new M(b,T);return l.push(P,I),l}let u=n*Math.sqrt(2)/2,d=t.add(h.mul(u)),p=d.add(r.mul(c)),m=this.createArc(e,t,d),g=new M(d,p);return l.push(m,g),l}else{if(ne.less(i,n)){let y=i*Math.sqrt(2)/2,b=t.add(r.mul(i/2)),P=new M(t,b),T=b.add(h.mul(y)),I=this.createArc(r,b,T);return l.push(P,I),l}let u=n*Math.sqrt(2)/2,d=t.add(r.mul(c)),p=d.add(h.mul(u)),m=new M(t,d),g=this.createArc(r,d,p);return l.push(m,g),l}}}createLines(t,e){let r=t[0];for(let i=1,n=t.length;i<n;i++){let s=t[i],a=new M(r,s);e.push(a),r=s}}createArc(t,e,r){let i=new Yn,{center:n,radius:s,startAngle:a,endAngle:l,sweep:c}=i.tangentToArc(t,e,r);return q.build2(n,a/Math.PI*180,l/Math.PI*180,s,s,c)}create4Path(t,e,r){let i=new Array;for(let n=0;n<e.length;n++){let s=e[n],a=!1,{style:l,isSingleSide:c}=t;switch(l){case"line45":if(c)n>=4?a=!0:a=!1;else{let h=t.leftStyle==="0"?1:0;n>=3+h?a=!0:a=!1}break;case"line90":c&&(n>=2?a=!0:a=!1);break;case"arc90":if(c)n>=3?a=!0:a=!1;else{let h=t.leftStyle==="0"?1:0;n>=2+h?a=!0:a=!1}break}if(a){if(s instanceof M){let h=new zr(`TRACK${rf.getInstance().getID()}`,r.item.layerId,s.end(),s.start(),r.item.width,!1,r.item.net);i.push(h)}else if(s instanceof q){let h=new Ii(`TRACK${rf.getInstance().getID()}`,r.item.layerId,s.center,s.rx,r.item.width,(s.startAngle+s.sweepAngle)*(Math.PI/180),s.startAngle*(Math.PI/180),s.isCCW?0:1,!1,r.item.net,1);i.push(h)}}else if(s instanceof M){let h=new zr(`TRACK${rf.getInstance().getID()}`,r.item.layerId,s.start(),s.end(),r.item.width,!1,r.item.net);i.push(h)}else if(s instanceof q){let h=new Ii(`TRACK${rf.getInstance().getID()}`,r.item.layerId,s.center,s.rx,r.item.width,s.startAngle*(Math.PI/180),(s.startAngle+s.sweepAngle)*(Math.PI/180),s.isCCW?1:0,!1,r.item.net,1);i.push(h)}}return i}midLineWidth(t){let e=(this.diffPairSpacing-t)/2;return t+(t+2*e)*Math.tan(Math.PI/8)}midLineWidth2(t){let e=this.diffPairSpacing-t/2;return t+(t+2*e)*Math.tan(Math.PI/8)}midLineLimitWidth(t,e){return t=="line90"?e-this.diffPairSpacing/2:t=="line45"?e-this.diffPairSpacing/2/Math.tan(Math.PI*3/8):e}restrictByMaxLength(t,e,r,i,n,s,a,l,c,h,u,d){let p=new Array;xe.addAll(p,r);let m=this.currentAdditionalLength(p,c);if(ne.eq(m-t,0))return{success:!1,maxHeight:0};let g=!0;p.push(e);let b=this.currentAdditionalLength(p,c)-t;if(ne.greater(b,0)){let P=this.heightDecreasedTo(s,e,b,l);ne.greater(i,Math.max(P,0))?g=!1:(e.height=P,g=this.block(e,i,n,s,P,h,d,c,u))}return{success:g,maxHeight:a}}currentAdditionalLength(t,e){return t.reduce((r,i)=>{let n=this.isDiffRoute?i.diffResult[e?1:0]:i.result,s=n[0].start().distance1(n[n.length-1].end());return r+n.reduce((a,l)=>a+l.length(),-s)},0)}heightDecreasedTo(t,e,r,i){switch(t){case"line90":return Math.max(0,e.height-r/2);case"line45":{let n=e.height-r/2;if(ne.greater(n,2*i))return n;r=r-(e.height-i*2)*2;let s=[e.leftStyle,e.rightStyle].reduce((c,h)=>c+(h=="0"?1:0),0),a=i*2-r/(s*(Math.sqrt(2)-1)+(2-s));if(ne.greater(a,i))return a;r=r-i*(s*(Math.sqrt(2)-1)+(2-s));let l=i-r/(2*(Math.sqrt(2)-1));return Math.max(0,l)}case"arc90":{let n=e.height-r/2;if(ne.greater(n,e.gap))return n;r=r-(e.height-e.gap)*2;let s=[e.leftStyle,e.rightStyle].reduce((l,c)=>l+(c=="0"?1:0),0),a=e.gap-r/((s+2)*(Math.PI/2-1)/2+(2-s)/2);return Math.max(0,a)}}}};var TOe=class{constructor(t,e,r,i,n,s,a,l,c,h){this.result=Array();this.end=null;this.diffResult=[Array(),Array()];this.start=t,this.referDirect=e,this.normalDirect=r,this.height=i,this.gap=n,this.lineWidth=s,this.isSingleSide=a,this.leftStyle=l,this.rightStyle=c,this.style=h}};function Xde(o,t){let e=new qt;return e.add("CANCEL",!0),e.add("INCREASE_GAP"),e.add("DECREASE_GAP"),e.add("GAP_STEP_VALUE",!0),e.add("EQUAL_LENGTH_TUNING_SETTING"),t&&e.add("DIFFERENTIAL_PAIR_LENGTH_TOLERANCE_RULE_SETTING"),e.add("toggleAdsorb",!1,o),e.add("ADSORBENT_CONFIG"),e}var Ph=class Ph extends ni{constructor(e=Ph.isSingleSide,r=Ph.type,i=Ph.width,n=Ph.minHeight,s=null,a=null,l=!1,c=0,h=!1,u=null,d=!1){super();this.restrictLength=!1;this.rectHelpLine=[];this.init=!0;this.drawMode=0;this.option="OPTIONLEFTUP",(d||!Ph.init)&&(Ph.isSingleSide=e,Ph.type=r,Ph.width=i,Ph.minHeight=n,Ph.restrictLength=l,Ph.additionalLength=c,Ph.init=!0),this.isSingleSide=Ph.isSingleSide,this.type=Ph.type,this.width=Ph.width,this.minHeight=Ph.minHeight,this.restrictLength=Ph.restrictLength,this.additionalLength=Ph.additionalLength,this.addedTo=u,h&&s?(this.selectStartPoint(s.x,s.y),a&&(this.mouseXY=a,this.draw(new S(a.x,a.y)),this.moveEnd())):this.onMouseMove(fi.getInstance())}onMouseMove(e){this.drawing=!0,this.mouseXY=new S(e.sceneX,e.sceneY),this.drawMode==1?Ut.update(e,"Please select a network"):this.startPoint?(this.init==!1&&(this.start(),this.moveInit()),this.draw(this.mouseXY),this.moveEnd()):Ut.update(e,"Please select a starting point for Track Tunning,press the tab key to set parameters")}onMouseLeftUp(e){let r=e.sceneX,i=e.sceneY;this.drawMode==0?this.startPoint?(this.finishDraw(),Ut.cancel()):this.selectStartPoint(r,i):this.netSelect(e)}onKeyDown(e){switch(tr.getAction([6,4],e)){case"Cancel":this.cancel();break;case"Change Track Width While Routing":this.reOpenDialog();break;case"increaseSnakeGap":this.changeGap(this.stepSize,e);break;case"decreaseSnakeGap":this.changeGap(-this.stepSize,e);break;case"Finish":this.onEnterPlace(e);break}}cancel(){if(this.drawMode==1){this.drawMode=0,this.reOpenDialog();return}this.startPoint?this.interrupt():(Mi.getInstance().clear(),Ml.getInstance().deleteAll(),Jf.getInstance().clear(),Rn.getInstance().clear(),Si.getInstance().clear(),R0.getInstance().clear(),n0.getInstance().clear(),oi.getInstance().clear(),At.getInstance().clear(),fs.getInstance().clear(),Cr.getInstance().clear(),HS.getInstance().clear(),$l.getInstance().clear(),pa.getInstance().clear(),ps.getInstance().clear(),Kl.getInstance().clear(),A.publish("tool","dropdrag"))}interrupt(){var r,i,n;this.init===!1&&this.moveInit(),Ye.unhighlightNet((r=this.targetTrack)==null?void 0:r.net),this.drawing=!1;let e=this.wireCommands;e==null||e.undo(),(i=this.wireResult)==null||i.command.undo(),(n=this.targetTrack)!=null&&n.net&&this.updateNetLengthMsg({restrictLength:this.restrictLength,netLengthAtBeginning:this.netLengthAtBeginning,additionalLength:this.additionalLength,net:this.targetTrack.net,showNetLength:!0}),this.wireResult=null,this.startPoint=null,this.mouseXY=null,this.targetTrack=null,this.pathList=null,this.wireCommands=null,this.commands=null,this.trackNode=null,this.pts=[],Ut.cancel(),Nl.getInstance().clear(),this.rectHelpLine.forEach(s=>s.remove()),this.end()}toggleMode(e){this.drawMode=e,this.drawing=!0}netSelect(e){if(this.drawMode==1){let r=Vr.selectNet(e.sceneX,e.sceneY);if(r!==null){let i=this.getNearNetPcbItems(r,e.sceneX,e.sceneY);this.handleNets(e,i)}}}handleNets(e,r){let i=new Set;r.forEach(n=>{i=n.nets}),i.size&&(i.size===1?i.forEach(n=>{this.handleChangeSelectedNet(n)}):(Ut.cancel(),this.showNetsMenu(e,i)))}handleChangeSelectedNet(e){var r;e!=((r=this.targetTrack)==null?void 0:r.net)&&this.reOpenDialog(e)&&(this.drawMode=0,Ut.cancel())}showNetsMenu(e,r){let i={};i.state="show",i.left=e.mouseX,i.top=e.mouseY,i.filter=this.getNetsMenuData(r).result,$t.getInstance().menuData(i,this),this.drawing=!1}getNetsMenuData(e){let r=new qt,i="INHERIT_NET:";return e.forEach(n=>{if(n){let s={name:n,cmd:`${i+n}`,tips:"",option:{disabledI18n:!0}};r.addObj(s,!1,!1)}}),r}getNearNetPcbItems(e,r,i){let n=new Set,s=new Set,a=new Set;return e.forEach(l=>{let c=l.net;if(l instanceof He&&l.type=="Copper Region"){let h=!1;if(l.iteratorCopper(u=>{h||u.inCopper(r,i)&&u.isVisible&&(h=!0)}),!h)return}c&&(a.add(l),s.add(c))}),n.add({group:a,nets:s}),n}selectStartPoint(e,r){var a;let i=no.getSingleItems(e,r);if(!i||!(i instanceof Ir))return;this.startPoint=new S(e,r),this.targetTrack=i,this.startTrackCenterPoint(this.startPoint,i),this.trackNode=this.getPathList(i),this.pathList=this.trackNode.parent;let n=this.pathList.getAllItems(),s=[];n.forEach(l=>s.push(l.primitive)),this.pts=s,Ye.highlightNet((a=this.targetTrack)==null?void 0:a.net),this.netLengthAtBeginning=Ye.getNetLength(this.targetTrack.net),Nl.getInstance().init(),Ut.cancel(),Ut.getToleranceTargetNet(this.targetTrack.net)}startTrackCenterPoint(e,r){let i=r.start,n=r.end,s=Fee(i,n,e);this.startPoint=new S(s.x,s.y)}getPathList(e){return this.wireCommands=new Lr,this.commands=new De("wire"),new su(e.model).generateList(),At.getInstance().getNode(e.model)}finishDraw(){var e;this.init=!0,Ye.unhighlightNet((e=this.targetTrack)==null?void 0:e.net),Mi.getInstance().complete(this.commands),Jf.getInstance().executeCommand(this.wireCommands),qe.executeCommand(this.commands),A.publish("flushService",""),this.startPoint=null,this.mouseXY=null,this.targetTrack=null,this.pathList=null,this.wireCommands=null,this.commands=null,this.trackNode=null,this.pts=[],this.drawing=!1,this.wireResult=null,this.rectHelpLine.forEach(r=>r.remove()),Mi.getInstance().clear(),Ml.getInstance().deleteAll(),Jf.getInstance().clear(),oi.getInstance().clear(),Cr.getInstance().clear(),this.end()}moveInit(){var e,r;(e=this.wireResult)==null||e.command.undo(),(r=this.wireCommands)==null||r.undo(),Mi.getInstance().view4Status(Cr.getInstance().current),this.wireCommands=new Lr,this.pathList=this.trackNode.parent,this.wireResult=null,this.init=!0}moveEnd(){let e=Mi.getInstance().view4Status(Cr.getInstance().current);this.wireCommands.addCommand(e),oi.getInstance().update(),this.init=!1,this.updateNetLengthMsg({restrictLength:this.restrictLength,netLengthAtBeginning:this.netLengthAtBeginning,additionalLength:this.additionalLength,net:this.targetTrack.net,showNetLength:!0})}reOpenDialog(e){var l;let r=(l=this.targetTrack)!=null&&l.net?this.targetTrack.net:"",i=re.getInstance().getNetLengthPhysicsByNet(r),n=re.getInstance().getNetLengthTolerancePhysicsByNet(r),s=new Array,a=r?Ye.getNetLength(r):-1;if(Ye.getAllNets().forEach(c=>{if(c!=r){let h=Ye.getNetLength(c);h>a&&s.push({net:c,netLength:h})}}),r&&e){if(s.every(c=>c.net!=e))return A.publish("ui/toastMsg",{type:"warn",msg:{text:"Network {addToNet} is shorter than the current equal-length network and cannot be selected.",i18nParam:{addToNet:e}}},Q()),!1;this.additionalLength=s.find(c=>c.net==e).netLength-a}A.publish("openMainDialog",{cmd:34,data:{reOpenDialog:!0,unit:R.getInstance().unit,type:this.type,isSingleSide:this.isSingleSide,width:this.width,minHeight:this.minHeight,startPoint:this.startPoint,mouseXY:this.mouseXY,restrictLength:this.restrictLength,netLengthMin:i.netLengthMin,netLengthMax:i.netLengthMax,netLengthTolerance:(n==null?void 0:n.netLengthTolerance)||0,additionalLength:this.additionalLength,lengthType:this.lengthType,longerNets:s,currentNetLength:a,addToNet:e,addedTo:this.addedTo,addedLength:this.addedLength}}),this.init==!1&&this.moveInit()}changeGap(e,r){let i=this.width+e;i<1e-6||(this.width=i,Ph.width=this.width,r&&(this.init==!1&&this.moveInit(),this.draw(new S(r.sceneX,r.sceneY)),this.moveEnd()))}get stepSize(){return Ph.stepSize}set stepSize(e){Ph.stepSize=e}showRectHelpLine(e,r,i){let{endX:n,endY:s}=this.convertRectRegionInfo(e,r,i),a=[e,n,r,s,e],l=[];for(let c=1;c<a.length;c++)l.push(new M(a[c-1],a[c]));this.rectHelpLine.forEach(c=>c.remove()),this.rectHelpLine=Bb(l,1002);for(let c of this.rectHelpLine)c.color=ee.WHITE}convertRectRegionInfo(e,r,i){let n=r.sub(e),s=new S(-i.y,i.x),a=i.dot(n),l=s.dot(n),c=i.mul(a).normalize(),h=s.mul(l).normalize(),u=Math.abs(a),d=Math.abs(l),p=e.add(c.mul(u)),m=e.add(h.mul(d));return{start:e,endX:p,end:r,endY:m,directX:c,directY:h,width:u,height:d}}getPathLength(e){return e.reduce((r,i)=>r+i.length(),0)}isPointInRect(e,r){let[i,n,s,a]=r,l=n.sub(i).normalize(),c=a.sub(i).normalize(),h=i.distance1(n),u=i.distance1(a),d=e.sub(i),p=d.dot(l),m=d.dot(c),g=1e-5;return p>=-g&&p<=h+g&&m>=-g&&m<=u+g}getRandomNet(e,r="id"){for(let i=0;i<100;i++){let n=`tempNet-${r}-${Math.random()*1e16}-${Date.now()}`;if(!e.has(n))return n}return""}createCollideTrack(e,r,i,n=this.trackNode.item.width){return new Zr().createTrack(this.trackNode.item.layerId,e.start(),e.end(),n,r,i,this.trackNode.item.getGroupID())}createArcCollideTrack(e,r,i,n=this.trackNode.item.width){return new Zr().createArcTrackByArc(this.trackNode.item.layerId,e,n,r,i,this.trackNode.item.getGroupID())}deleteCollideTrack(e,r){r.undo()}updateTrack(e,r,i,n=!1){let s=new Zr,a=this.pathList.getAllItems().reverse();n||(a=a.reverse());let l=s.createList(),c=this.targetTrack,h=this.pathList,u=e.length-(a.length-i);e.forEach((d,p)=>{let m=c.width;p<=r?m=a[p].width:p>=u&&(m=a[p-u+i].width);let g;ud(d)<1e-8||(d instanceof M?(g=s.createTrack(c.layerId,d.start(),d.end(),m,c.net,this.wireCommands,c.getGroupID()),s.addList(g,l,this.wireCommands)):d instanceof q&&(g=s.createArcTrack(c.layerId,d.center,d.rx,d.startAngle*(Math.PI/180),(d.startAngle+d.sweepAngle)*(Math.PI/180),d.isCCW?1:0,m,c.net,this.wireCommands,void 0,c.getGroupID()),s.addList(g,l,this.wireCommands)))}),l.replace(h.getFirstNode(),h.getLastNode(),h),this.wireCommands.addCommand(new mi(l))}reverse(e){let r=new Array(e.length);for(let i=0,n=e.length-1;n>=0;i++,n--){let s=pp(e[n]);r[i]=s}return r}calculateAdjustIndexAndLength(e,r,i,n){let s=this.startPoint,a=0,l=i,c=[],h=!0;for(let u=i,d=e.length;u<d;u++){let p=e[u],m=n.dot(p.start().sub(s)),g=n.dot(p.end().sub(s));if(p instanceof M&&ne.eq(p.direct.cross(n),0)&&m<g&&(l=u,r>g?a=g:(a=r,h=!1)),r<=g)break}if(h)for(let u=l+1;u<e.length;u++){let d=e[u];if(d instanceof M){let m=d.start().sub(s).dot(n);if(r>=m){c.push(u);break}}}return{length:a,resultIndex:l,extendResultIndexs:c}}baseLineLengthChange(e,r,i,n,s,a,l){let c=0;for(let g=r;g<=i;g++)c+=e[g].length();let h=e[r].start(),u=e[i].end(),d=Math.abs(u.sub(h).dot(n)),p=Math.abs(u.sub(h).dot(s)),m=l?Math.min(Math.max(p/a-Math.sqrt(2),0),2)*(Math.sqrt(2)-2)*a:0;return d+p-c+m}updateNetLengthMsg(e){let r=new Array;r.push(new v0(this.trackNode.item.net,this.trackNode.item.width,this.trackNode.item.layerId,this.trackNode.item.direct,!1));let i=this.trackNode.item.net,n=re.getInstance().getNet(i);if(n&&n.netDifferential){e.showDiffLength=!0;let a=n.netDifferential.positiveNet.name,l=n.netDifferential.negativeNet.name,c=this.trackNode.item.net==a?l:a;r.push(new v0(c,0,this.trackNode.item.layerId,this.trackNode.item.direct,!1))}let s=new RI(r,[],r[0]);Jd.updateNetLengthMsg2(s,"Single wiring",e)}rightClickMenuData(e){var s;let r=(s=this.targetTrack)==null?void 0:s.net,i=!1;if(r){let a=re.getInstance().getNet(r);a!=null&&a.netDifferential!=null&&(i=!0)}let n={};n.state="show",n.left=e.mouseX,n.top=e.mouseY,n.filter=Xde(e.adsorb,i).result,$t.getInstance().menuData(n,this)}parse(e){let r=e.cmdKey,i=r.split(":",r.length);switch(i[0]){case"CANCEL":this.cancel();break;case"INCREASE_GAP":this.changeGap(1);break;case"DECREASE_GAP":this.changeGap(-1);break;case"EQUAL_LENGTH_TUNING_SETTING":this.reOpenDialog();break;case"DIFFERENTIAL_PAIR_LENGTH_TOLERANCE_RULE_SETTING":{let n={activeTab:"Rule",activeMenu:"Differential Pair"};A.publish("openMainDialog",{cmd:5,data:{option:n,tool:this}});break}case"GAP_STEP_VALUE":A.publish("openMainDialog",{cmd:37,data:{tool:this,stepSize:this.stepSize}});break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"INHERIT_NET":this.handleChangeSelectedNet(i[1]);break}}calculateSplitLength(e,r,i,n){let s=this.startPoint,a=0,l=i,c=[],h=!0;for(let u=i,d=e.length;u<d;u++){let p=e[u],m=n.dot(p.start().sub(s)),g=n.dot(p.end().sub(s));if(p instanceof M&&ne.eq(p.direct.cross(n),0)&&m<g&&(l=u,r>g?a=g:(a=r,h=!1)),r<=g)break}if(h)for(let u=l+1;u<e.length;u++){let d=e[u];if(d instanceof M){let m=d.start().sub(s).dot(n);if(r>=m){c.push(u);break}}}return{length:a,resultIndex:l,extendResultIndexs:c}}create4Path(e,r){let i=new Array;for(let n of e)if(n instanceof M){let s=new zr(`TRACK${rf.getInstance().getID()}`,r.item.layerId,n.start(),n.end(),r.item.width,!1,r.item.net);i.push(s)}else if(n instanceof q){let s=new Ii(`TRACK${rf.getInstance().getID()}`,r.item.layerId,n.center,n.rx,r.item.width,n.startAngle*(Math.PI/180),(n.startAngle+n.sweepAngle)*(Math.PI/180),n.isCCW?1:0,!1,r.item.net,1);i.push(s)}return i}getMaxLengthChange(e,r,i,n,s){if(!this.restrictLength||isNaN(this.additionalLength))return null;if(this.addedTo){let l=parseFloat(this.addedTo)/10-Ye.getNetLength(this.targetTrack.net)||0;this.additionalLength=l>0?l:0}return this.additionalLength-this.baseLineLengthChange(e,r,i,n,s,this.targetTrack.width,Ph.type!="line90")}draw(e){if(Gr.pause){Gr.play4Next();return}Gr.replay?e=Gr.position||e:Gr.position=e;let r=Zt.getInstance().mode;this.clearCache();let{targetTrack:i,startPoint:n,type:s,minHeight:a,width:l,isSingleSide:c}=this,{reverse:h,pts:u,startIndex:d,startPt:p,direct:m,dir:g}=this.getTrackDirect(e,n),y=this.convertRectRegionInfo(n,e,m),{directX:b,directY:P}=y;if(b.x==0&&b.y==0||P.x==0&&P.y==0)return;let{length:T,resultIndex:I,extendResultIndexs:C}=this.calculateAdjustIndexAndLength(u,Math.abs(g),d,b),{shapes:E,command:O,prePath:_}=this.selfBlockTracks(u,d,I,C),x=this.getMaxLengthChange(u,d,I,b,P),v=new dC(!0),{path:D,templates:w,splitBlockTrack:F}=v.draw(y,T,s,a,l,i.width,c,this.trackNode,E,x);O.undo();let H=new Array;if(F){let W=I;C.forEach(L=>{L>W&&(W=L)}),H=this.splitTrackDraw(d,W,y,x,h),this.updateTrack(H,d,W,h)}else if(D.length>0){z.apply(this);let W=V.apply(this);this.updateTrack(H,d,W,h)}if(r==="WIRING_MODE_PUSHAWAY"){let W=new Tg;this.wireResult=W;let L=new v0(this.trackNode.item.net,this.trackNode.item.width,this.trackNode.item.layerId,this.trackNode.item.direct,!1);W.setInputStatus(this.pathList),W.wireMap.set(L,this.pathList);let k=new km(!1);try{k.level="SUPER",k.inputLevel="NONE",k.run(W)}catch(N){throw new Error(N)}}this.showRectHelpLine(this.startPoint,e,this.targetTrack.direct);function z(){if(D.length>0){let W=u[I],L=W.start().sub(this.startPoint),k=P.mul(L.dot(P)),N=this.startPoint.add(b.mul(T)),U=N.add(k),B=u.slice(0,d),G=u.slice(I+1,u.length);xe.addAll(H,B);let Y=new Array,X=new M(p.start(),this.startPoint);Y.push(X),Y.push(...D);let K=D[D.length-1].end(),J=new M(K,N),se=new M(N,U),ce=new M(U,W.end()),te=[J,se,ce];s!=="line90"&&(te=c5(te,i.width,Math.sqrt(2))),Y.push(...te),xe.addAll(H,Y),xe.addAll(H,G)}else xe.addAll(H,u)}function V(){if(C.length){let L=null;if(this.restrictLength&&x){let k=this.getPathLength(H)-this.getPathLength(u);L=x-k}for(let k of w)_.push(...k.result);for(let k=0;k<C.length;k++){let N=u[C[k]],U=this.drawTemplateLimitInRect(N.start(),N.end(),y,L,_);if(U.length){let B=U[0].start(),G=U[U.length-1].end(),Y=new M(N.start(),B),X=new M(G,N.end()),K=[].concat([Y],U,[X]),J=H.indexOf(N);if(H.splice(J,1,...K),this.restrictLength&&x&&(L-=this.getPathLength(K)-N.length(),L<=1e-8))break}}}let W=I;return C.forEach(L=>{L>W&&(W=L)}),W}}getTrackDirect(e,r){let i=this.pathList.getAllItems().indexOf(this.targetTrack.model),n=this.pts[i],s=n.direct,a=e.sub(r).dot(s),l=!1,c=this.pts;return a<0&&(l=!0,c=this.reverse(c),i=c.length-i-1,n=c[i],s=n.direct),{reverse:l,pts:c,startIndex:i,startPt:n,direct:s,dir:a}}clearCache(){Gr.init(),pa.getInstance().clear(),ps.getInstance().clear(),fs.getInstance().clear(),Mr.getInstance().clear()}selfBlockTracks(e,r,i,n){let s=[];if(Zt.getInstance().mode=="WIRING_MODE_SURROUND_AND_PUSHAWAY"||Zt.getInstance().mode=="WIRING_MODE_SURROUND"||Zt.getInstance().mode=="WIRING_MODE_OBSTRUCT"){let u=r,d=Math.max(r,i);for(let g=0;g<n.length;g++)n[g]>d&&(d=n[g]);let p=e.slice(0,u),m=e.slice(d+1,e.length);s=[].concat(p,m)}let a=[],l=new Set(Ye.getAllNets()),c=new Lr,h=this.getRandomNet(l,"prePath");for(let u of s){let d;if(u instanceof M)d=this.createCollideTrack(u,h,c);else if(u instanceof q)d=this.createArcCollideTrack(u,h,c);else throw new Error("not support others!!!!");a.push(d)}return{shapes:a,command:c,prePath:s}}updateNetLengthRuleInDialog(){var a;let e=(a=this.targetTrack)!=null&&a.net?this.targetTrack.net:"",r=re.getInstance().getNetLengthPhysicsByNet(e),i=r.netLengthMin*10,n=r.netLengthMax*10,s="updateNetLengthRule";A.publish("pcbdialogModify",{dialogType:"equal-length-tuning",action:s,netLengthMin:i,netLengthMax:n})}mergeLine(e){let r=new Array;if(!e.length)return[];r.push(e[0]);for(let i=1;i<e.length;i++){let n=r[r.length-1],s=e[i];if(n instanceof M&&s instanceof M&&this.getSweep(n.start(),n.end(),s.end())===0){let l=new M(n.start(),s.end());r.splice(r.length-1,1,l);continue}r.push(s)}return r}changeHistory(e,r){let i=e.commands,n=i.length;for(let s=n-1;s>=0;s--){let a=i[s];if(a instanceof Lr)this.changeHistory(a,r);else if(a instanceof mi){let c=a.list.parentNode.target;r===c&&(a.undo(),i.splice(s,1))}}}getSweep(e,r,i){let n=r.sub(e),s=i.sub(r);return Math.abs(n.cross(s))<1e-8?0:n.cross(s)>0?1:-1}splitTrackDraw(e,r,i,n,s){let a=this.pts,l=i.directY,c=this.pathList.getFirstNode(),h=new Array;for(;c;)h.push(c),c=c.next;s&&(a=this.reverse(a),h.reverse());let u=new Array;for(let p=0;p<e;p++){let m=a[p];u.push(m)}let d=!1;for(let p=e;p<=r;p++){let m=a[p],g=m.start(),y=m.end(),b=y.sub(g).normalize();if(d||Math.abs(b.cross(l))<1e-6){u.push(m);continue}let P=!1;p===e&&(P=!0,g=this.startPoint);let T=i,I=h[p],C=I.item;if(C instanceof zr){let O=s?C.end:C.start,_=s?C.start:C.end,x=_.sub(O),{start:v,endX:D,end:w,endY:F,directX:H,directY:z}=T,V=[v,D,w,F];if(!this.isPointInRect(O,V)||!this.isPointInRect(_,V)){let W=x.dot(z),L=O;ne.less(W,0)&&(L=O.add(z.mul(-Math.abs(W)))),T=this.convertRectRegionInfo(L,w,H)}}let E=this.drawTemplateLimitInRect(g,y,T,n,u,I,P);if(E.length){let O=E[0].start(),_=E[E.length-1].end(),x=new M(m.start(),O),v=new M(_,m.end()),D=[].concat([x],E,[v]);u.push(...D),this.restrictLength&&n&&(n-=this.getPathLength(D)-m.length(),n<=1e-8&&(d=!0))}else{let O=new M(m.start(),m.end());u.push(O)}}for(let p=r+1;p<a.length;p++){let m=a[p];u.push(m)}return u}drawTemplateLimitInRect(e,r,i,n,s=[],a=this.trackNode,l=!1){let{targetTrack:c,type:h,minHeight:u,width:d,isSingleSide:p}=this,m=l?0:this.targetTrack.width*1.5,{start:g,endX:y,end:b,endY:P,directX:T,directY:I}=i,C=[g,y,b,P],E=[e,r],O=new M(e,r);for(let x=1,v=C.length;x<=v;x++){let D=new M(C[x-1],C[x%v]),w=Pt(O,D),F=Om(w,[])[0];F&&E.push(F)}let _=[Number.MAX_VALUE,-Number.MAX_VALUE];for(let x of E)if(this.isPointInRect(x,C)){let v=e.distance1(x);_[0]=Math.min(_[0],v),_[1]=Math.max(_[1],v)}if(_[1]-_[0]>m*2){let x=r.sub(e).normalize(),v=e.add(x.mul(_[0]+m)),D=e.add(x.mul(_[1]-m)),w=D.sub(v).normalize(),F=new S(-w.y,w.x),H=0;w.dot(T)>=0?F.dot(I)<0&&(F=F.mul(-1)):F.dot(I)>0&&(F=F.mul(-1)),x.equals1(T)?H=AL(D.x,D.y,P.x,P.y,b.x,b.y):H=g.distance1(b);let z=D.add(F.mul(H)),V=this.convertRectRegionInfo(v,z,x),W=[],L=[],k=new Set(Ye.getAllNets()),N=this.getRandomNet(k,"limitRect"),U=new Lr;if(!x.equals1(T))for(let X=1,K=C.length;X<=K;X++){let J=new M(C[X-1],C[X%K]),se=this.createCollideTrack(J,N,U);W.push(se),L.push(null)}let B=this.getRandomNet(k,"prePath");for(let X of s){let K=this.createCollideTrack(X,B,U);W.push(K),L.push(null)}let G=new dC,{path:Y}=G.draw(V,V.width,h,u,d,c.width,p,a,W,n);return this.deleteCollideTrack(W,U),Y}return[]}getCentroid(e){let r=0,i=0,n=e.length||1;return e.forEach(s=>{r+=s.x,i+=s.y}),new S(r/n,i/n)}};Ph.init=!1,Ph.isSingleSide=!0,Ph.type="line45",Ph.width=6,Ph.minHeight=1,Ph.stepSize=1,Ph.restrictLength=!1,Ph.additionalLength=0;var $G=Ph;var uc=class uc extends ni{constructor(e=uc.isSingleSide,r=uc.type,i=uc.width,n=uc.minHeight,s=null,a=null,l=!1,c=0,h=!1,u=null,d=!1){super();this.restrictLength=!1;this.diffPairSpacing=1.6;this.targetTrack=null;this.init=!0;this.track_P=null;this.track_N=null;this.pathNode_P=null;this.pathNode_N=null;this.pathList_P=null;this.pathList_N=null;this.pts_P=[];this.pts_N=[];this.rectHelpLine=[];this.drawMode=0;this.option="OPTIONLEFTUP",(d||!uc.init)&&(uc.isSingleSide=e,uc.type=r,uc.width=i,uc.minHeight=n,uc.restrictLength=l,uc.additionalLength=c,uc.init=!0),this.isSingleSide=uc.isSingleSide,this.type=uc.type,this.width=uc.width,this.minHeight=uc.minHeight,this.restrictLength=uc.restrictLength,this.additionalLength=uc.additionalLength,this.addedTo=u,h&&s&&(this.selectStartPoint(s.x,s.y),a&&(this.mouseXY=a,this.draw(new S(a.x,a.y)),this.moveEnd()))}onMouseMove(e){this.drawing=!0,this.mouseXY=new S(e.sceneX,e.sceneY),this.drawMode==1?Ut.update(e,"Please select a network"):this.startPoint?(this.init==!1&&(this.start(),this.moveInit()),this.draw(this.mouseXY),this.moveEnd()):Ut.update(e,"Please select a starting point for Track Tunning,press the tab key to set parameters")}onMouseLeftUp(e){let r=e.sceneX,i=e.sceneY;this.drawMode==0?this.startPoint?(this.finishDraw(),Ut.cancel()):this.selectStartPoint(r,i):this.netSelect(e)}finishDraw(){var e,r;this.init=!0,Ye.unhighlightNet((e=this.track_N)==null?void 0:e.net),Ye.unhighlightNet((r=this.track_P)==null?void 0:r.net),Mi.getInstance().complete(this.commands),Jf.getInstance().executeCommand(this.commands),qe.executeCommand(this.commands),A.publish("flushService",""),this.startPoint=null,this.mouseXY=null,this.targetTrack=null,this.startPoint_N=null,this.startPoint_P=null,this.track_P=null,this.track_N=null,this.wireCommands=null,this.commands=null,this.pathNode_P=null,this.pathNode_N=null,this.pathList_N=null,this.pathList_P=null,this.pts_P=null,this.pts_N=null,this.wireResult=null,this.drawing=!1,this.rectHelpLine.forEach(i=>i.remove()),Mi.getInstance().clear(),Ml.getInstance().deleteAll(),Jf.getInstance().clear(),oi.getInstance().clear(),Cr.getInstance().clear(),this.end()}onKeyDown(e){switch(tr.getAction([6,4],e)){case"Cancel":this.cancel();break;case"Change Track Width While Routing":this.reOpenDialog();break;case"increaseSnakeGap":this.changeGap(this.stepSize,e);break;case"decreaseSnakeGap":this.changeGap(-this.stepSize,e);break;case"Finish":this.onEnterPlace(e);break}}get stepSize(){return uc.stepSize}set stepSize(e){uc.stepSize=e}changeGap(e,r){let i=this.width+e;i<1e-6||(uc.type=="line45"&&this.targetTrack&&(i=Math.max(i,this.targetTrack.width*2)),i!=this.width&&(this.width=Math.max(i,this.targetTrack.width*2),uc.width=this.width,r&&(this.init==!1&&this.moveInit(),this.draw(new S(r.sceneX,r.sceneY)),this.moveEnd())),r&&(this.init==!1&&this.moveInit(),this.draw(new S(r.sceneX,r.sceneY)),this.moveEnd()))}reOpenDialog(e){var l;let r=(l=this.targetTrack)!=null&&l.net?this.targetTrack.net:"",i=re.getInstance().getNetLengthPhysicsByNet(r),n=re.getInstance().getNetLengthTolerancePhysicsByNet(r),s=new Array,a=r?Ye.getNetLength(r):-1;if(Ye.getAllNets().forEach(c=>{if(c!=r){let h=Ye.getNetLength(c);h>a&&s.push({net:c,netLength:h})}}),r&&e){if(s.every(c=>c.net!=e))return A.publish("ui/toastMsg",{type:"warn",msg:{text:"Network {addToNet} is shorter than the current equal-length network and cannot be selected.",i18nParam:{addToNet:e}}},Q()),!1;this.additionalLength=s.find(c=>c.net==e).netLength-a}A.publish("openMainDialog",{cmd:34,data:{reOpenDialog:!0,unit:R.getInstance().unit,isDiffPair:!0,type:this.type,isSingleSide:this.isSingleSide,width:this.width,minHeight:this.minHeight,startPoint:this.startPointSelected,mouseXY:this.mouseXY,restrictLength:this.restrictLength,netLengthMin:i.netLengthMin,netLengthMax:i.netLengthMax,netLengthTolerance:(n==null?void 0:n.netLengthTolerance)||0,additionalLength:this.additionalLength,lengthType:this.lengthType,longerNets:s,currentNetLength:a,addToNet:e,addedTo:this.addedTo,addedLength:this.addedLength}}),this.init==!1&&this.moveInit()}cancel(){var e;if(this.drawMode==1){this.drawMode=0,this.reOpenDialog((e=this.targetTrack)==null?void 0:e.net);return}this.startPoint?this.interrupt():(Mi.getInstance().clear(),Ml.getInstance().deleteAll(),Jf.getInstance().clear(),Rn.getInstance().clear(),Si.getInstance().clear(),R0.getInstance().clear(),n0.getInstance().clear(),oi.getInstance().clear(),At.getInstance().clear(),fs.getInstance().clear(),Cr.getInstance().clear(),HS.getInstance().clear(),$l.getInstance().clear(),pa.getInstance().clear(),ps.getInstance().clear(),Kl.getInstance().clear(),A.publish("tool","dropdrag"))}interrupt(){var i,n,s,a;this.init==!1&&this.moveInit(),Ye.unhighlightNet((i=this.track_N)==null?void 0:i.net),Ye.unhighlightNet((n=this.track_P)==null?void 0:n.net),this.drawing=!1;let e=this.wireCommands;e==null||e.undo();let r=Mi.getInstance().view4Status(Cr.getInstance().current);this.rectHelpLine.forEach(l=>l.remove()),(s=this.wireResult)==null||s.command.undo(),(a=this.targetTrack)!=null&&a.net&&this.updateNetLengthMsg({net:this.targetTrack.net,restrictLength:this.restrictLength,netLengthAtBeginning:this.netLengthAtBeginning,additionalLength:this.additionalLength,showNetLength:!0}),this.wireResult=null,this.startPoint=null,this.targetTrack=null,this.startPoint_P=null,this.startPoint_N=null,this.track_P=null,this.track_N=null,this.pathNode_P=null,this.pathNode_N=null,this.pathList_P=null,this.pathList_N=null,this.pts_P=[],this.pts_N=[],this.wireCommands=null,this.commands=null,this.rectHelpLine=[],Nl.getInstance().clear(),Ut.cancel(),this.end()}toggleMode(e){this.drawMode=e,this.drawing=!0}netSelect(e){if(this.drawMode==1){let r=Vr.selectNet(e.sceneX,e.sceneY);if(r!==null){let i=this.getNearNetPcbItems(r,e.sceneX,e.sceneY);this.handleNets(e,i),this.drawMode=0}}}handleNets(e,r){let i=new Set;r.forEach(n=>{i=n.nets}),i.size&&(i.size===1?i.forEach(n=>{this.handleChangeSelectedNet(n)}):(Ut.cancel(),this.showNetsMenu(e,i)))}handleChangeSelectedNet(e){var r;e!=((r=this.targetTrack)==null?void 0:r.net)&&this.reOpenDialog(e)&&(this.drawMode=0,Ut.cancel())}showNetsMenu(e,r){let i={};i.state="show",i.left=e.mouseX,i.top=e.mouseY,i.filter=this.getNetsMenuData(r).result,$t.getInstance().menuData(i,this),this.drawing=!1}getNetsMenuData(e){let r=new qt,i="INHERIT_NET:";return e.forEach(n=>{if(n){let s={name:n,cmd:`${i+n}`,tips:"",option:{disabledI18n:!0}};r.addObj(s,!1,!1)}}),r}getNearNetPcbItems(e,r,i){let n=new Set,s=new Set,a=new Set;return e.forEach(l=>{let c=l.net;if(l instanceof He&&l.type=="Copper Region"){let h=!1;if(l.iteratorCopper(u=>{h||u.inCopper(r,i)&&u.isVisible&&(h=!0)}),!h)return}c&&(a.add(l),s.add(c))}),n.add({group:a,nets:s}),n}syncSpacing(){let e=Ts(this.startPoint,this.targetTrack.layerId,!0),r=re.getInstance(),i=this.targetTrack.layerId,n=r.getDifferentialPhysicsByNet(this.targetTrack.net).getDifferentialPairSpacingDefault(i);for(let s=0;s<e.length;s++){let a=re.getInstance().getRegion(e[s].globalIndex);if(a.diff){n=r.getDifferentialPhysics(a.diff).getDifferentialPairSpacingDefault(i);break}}this.diffPairSpacing=n+this.targetTrack.width}selectStartPoint(e,r){let i=no.getSingleItems(e,r);if(!i||!(i instanceof Ir))return;let n=i,s=new S(e,r),a=re.getInstance().getNet(n.net);if(a!=null&&a.netDifferential!=null){let l=new H8(n,s,!1,!1);this.targetTrack=n,uc.type=="line45"&&(this.width=uc.width=Math.max(uc.width,this.targetTrack.width*2)),this.wireCommands=new Lr,this.commands=new De("wire"),this.track_P=l.positive,this.track_N=l.negative,this.startPoint_P=l.start_P,this.startPoint_N=l.start_N,this.pathNode_P=this.getPathList(this.track_P),this.pathNode_N=this.getPathList(this.track_N),this.pathList_P=this.pathNode_P.parent,this.pathList_N=this.pathNode_N.parent;let c=this.pathList_P.getAllItems(),h=this.pathList_N.getAllItems(),u=[],d=[];c.forEach(p=>u.push(p.primitive)),h.forEach(p=>d.push(p.primitive)),this.pts_P=u,this.pts_N=d,this.startPointSelected=s,this.startPoint=l.start_P.add(l.start_N).mul(.5),Nl.getInstance().init(),this.syncSpacing(),Ut.cancel(),Ye.highlightNet(l.positive.net),Ye.highlightNet(l.negative.net),this.netLengthAtBeginning=Ye.getNetLength(this.targetTrack.net)}else{let l=new e0("No differential pair, do you want to create a differential pair?",()=>{A.publish("openDifferentailDialog",{name:X8(),positiveNet:n.net,negativeNet:"",netOptions:j8()},Q())});A.publish("openMsgbox",l);return}}parse(e){let r=e.cmdKey,i=r.split(":",r.length);switch(i[0]){case"CANCEL":this.cancel();break;case"INCREASE_GAP":this.changeGap(1);break;case"DECREASE_GAP":this.changeGap(-1);break;case"EQUAL_LENGTH_TUNING_SETTING":this.reOpenDialog();break;case"DIFFERENTIAL_PAIR_LENGTH_TOLERANCE_RULE_SETTING":{let n={activeTab:"Rule",activeMenu:"Differential Pair"};A.publish("openMainDialog",{cmd:5,data:{option:n,tool:this}});break}case"GAP_STEP_VALUE":A.publish("openMainDialog",{cmd:37,data:{tool:this,stepSize:this.stepSize}});break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"INHERIT_NET":this.handleChangeSelectedNet(i[1]);break}}getPathList(e){return this.wireCommands=new Lr,this.commands=new De("wire"),new su(e.model).generateList(),At.getInstance().getNode(e.model)}moveInit(){var e,r;(e=this.wireResult)==null||e.command.undo(),(r=this.wireCommands)==null||r.undo(),Mi.getInstance().view4Status(Cr.getInstance().current),this.wireCommands=new Lr,this.pathList_P=this.pathNode_P.parent,this.pathList_N=this.pathNode_N.parent,this.wireResult=null,this.init=!0}moveEnd(){let e=Mi.getInstance().view4Status(Cr.getInstance().current);this.wireCommands.addCommand(e),oi.getInstance().update(),this.init=!1,this.updateNetLengthMsg({net:this.targetTrack.net,restrictLength:this.restrictLength,netLengthAtBeginning:this.netLengthAtBeginning,additionalLength:this.additionalLength,showNetLength:!0})}getMaxLengthChange(e,r,i,n,s,a,l,c,h,u,d){if(!this.restrictLength||isNaN(this.additionalLength))return null;if(this.addedTo){let m=parseFloat(this.addedTo)/10-Ye.getNetLength(this.targetTrack.net);this.additionalLength=m>0?m:0}return this.additionalLength-this.baseLineLengthChange(e?r:i,e?n:s,e?a:l,c,h,this.targetTrack.width,uc.type!="line90",u,d!=e)}draw(e){if(Gr.pause){Gr.play4Next();return}Gr.replay?e=Gr.position||e:Gr.position=e,Gr.init(),pa.getInstance().clear(),ps.getInstance().clear(),fs.getInstance().clear();let r=!1,{targetTrack:i,startPoint:n,type:s,minHeight:a,width:l,isSingleSide:c}=this;l+=this.diffPairSpacing;let h=this.targetTrack.net===this.pathNode_P.item.net,u=this.pathList_P.getAllItems().indexOf(this.pathNode_P.item),d=this.pathList_N.getAllItems().indexOf(this.pathNode_N.item),p=this.pts_P[u],m=this.pts_N[d];if(!p.direct||!m.direct){let B=this.pathList_P.getAllItems(),G=this.pathList_N.getAllItems();B.forEach((Y,X)=>this.pts_P[X].direct=Y.direct),G.forEach((Y,X)=>this.pts_N[X].direct=Y.direct)}let g=p.direct,y=m.direct;if(!(Math.abs(g.cross(y))<1e-4))return;let b=e.sub(n).dot(g),P=e.sub(n).dot(y),T=this.pts_P,I=this.pts_N,C=!1,E=!1;b<0&&(C=!0,T=this.reverse(this.pts_P),u=T.length-u-1,p=T[u],g=p.direct),P<0&&(E=!0,I=this.reverse(this.pts_N),d=I.length-d-1,m=I[d],y=m.direct);let O=this.convertRectRegionInfo(n,e,h?g:y),{directX:_,directY:x}=O;if(_.x==0&&_.y==0||x.x==0&&x.y==0)return;let{length:v,resultIndex_P:D,resultIndex_N:w}=this.calculateAdjustIndexAndLengthForDiffPair(T,I,Math.abs(b),u,d,_),F=this.startPoint_N.sub(this.startPoint_P),H=_.rotate(new S(0,0),Math.PI/2).dot(F)>0,z=new dC(!1,!0,this.diffPairSpacing),{shapes:V,command:W}=this.selfBlockTracks(T,I,u,d,D,w),L=this.getMaxLengthChange(h,T,I,u,d,D,w,_,x,n,H),{paths:k,templates:N}=z.draw(O,v,s,a,l,i.width,c,this.pathNode_P,V,L,H,this.pathNode_N);if(W.undo(),Zt.getInstance().mode==="WIRING_MODE_PUSHAWAY"){let{pathChange:B,resultPath:G}=this.pushAwaySnakeTrack(k);B&&(k=this.generateDiff(G,_))}let U=[];[I,T].forEach((B,G)=>{let Y=new Array,X=k[H?(G+1)%2:G],K=F.dot(x)<0;if(X.length>0){let se=G==0?d:u,ce=G==0?w:D,te=G==0?m:p,oe=B[ce],$=G==0?this.pathNode_N:this.pathNode_P,fe=X[0].start(),Oe=X.slice(-1)[0].end(),ue=k[H?G:(G+1)%2].slice(-1)[0].end(),be=Math.max(Oe.sub(this.startPoint).dot(_)),j=Math.max(ue.sub(this.startPoint).dot(_));if(ne.less(be,j)){let Ne=Oe.add(_.mul(j-be));Y.push(new M(Oe,Ne)),Oe=Ne}let Z=new ms;for(;v>Math.max(be,j);){let Ne=this.create4Path([new M(Oe,Oe.add(_.mul(v-Math.max(be,j))))],$),Vt=[];for(let Ft=0;Ft<Ne.length;Ft++){let ir=Ne[Ft],Fe=Z.block(ir);Vt.push(...Fe)}if(Vt.length>0){let Ft=this.getBlockMin(Vt,this.startPoint,_);Math.abs(v-Ft)<=.001&&(Ft=Math.max(Ft-this.width/2,0)),v=Ft}else break;Ne.forEach(Ft=>Sn.getInstance().delete(Ft,Ft.globalIndex))}v=Math.max(be,j,v);let ie=this.startPoint.add(_.mul(v)),de=G==1?I:T,me=G==1?w:D,Se=de[me],Re=oe.end().sub(Oe).dot(x),Je=Se.end().sub(ue).dot(x),Ke;if(!ne.eq(Re,0)&&!ne.eq(Je,0)&&Re*Je>0){let Ne=(Re<0==K==(G==0)?-1:1)*this.diffPairSpacing/2,Vt=ie.add(_.mul(Ne));Ke=new M(Vt,Vt.add(x))}else Ke=new M(ie,ie.add(x));let Gt=new M(Oe,Oe.add(_)),Nr=Pt(dC.lengthen(Gt),dC.lengthen(Ke)),xr;Nr>0?xr=new S(Ee[0],Ee[1]):xr=fe.add(_.mul(v));let vr=ce,_r;for(let Ne=se;Ne<=ce;Ne++){let Vt=B[Ne],Ft=new M(xr,xr.add(x.mul(-1))),ir=dC.lengthen(Ft);if(Pt(Vt,ir)){vr=Ne,_r=new S(Ee[0],Ee[1]);break}}if(_r){G==0?(w=vr,ce=vr):(D=vr,ce=vr);let Ne=oe.start().sub(fe),Vt=x.mul(Ne.dot(x)),Ft=xr.add(Vt),ir=B.slice(0,se),Fe=B.slice(ce+1,B.length),tt=Eu.foot(te,fe),ye=new M(te.start(),tt),yt=new M(tt,fe),Wt=[ye,yt];s!=="line90"&&(Wt=c5(Wt,i.width,Math.sqrt(2)));let pe=Array.from(Y);Y=[].concat(ir,Wt),xe.addAll(Y,X),Y=Y.concat(pe);let Xe=B[vr],ct=new M(Oe,xr),Me=new M(xr,_r),st=new M(_r,Xe.end()),Ot=[ct,Me,st];s!=="line90"&&(Ot=c5(Ot,i.width,Math.sqrt(2))),Y.push(...Ot),xe.addAll(Y,Fe)}else{let Ne=oe.start().sub(fe),Vt=x.mul(Ne.dot(x)),Ft=xr.add(Vt),ir=B.slice(0,se),Fe=B.slice(ce+1,B.length),tt=Eu.foot(te,fe),ye=new M(te.start(),tt),yt=new M(tt,fe),Wt=[ye,yt];s!=="line90"&&(Wt=c5(Wt,i.width,Math.sqrt(2)));let pe=Array.from(Y);Y=[].concat(ir,Wt),xe.addAll(Y,X),Y=Y.concat(pe);let Xe=new M(Oe,xr),ct=new M(xr,Ft),Me=new M(Ft,oe.end()),st=[Xe,ct,Me];s!=="line90"&&(st=c5(st,i.width,Math.sqrt(2))),Y.push(...st),xe.addAll(Y,Fe)}}else xe.addAll(Y,B);let J=G===0?P:b;U[G]=J<0?this.reverse(Y):Y}),U.forEach((B,G)=>{let Y=G===0?this.pathList_N:this.pathList_P,X=G===0?this.pathNode_N:this.pathNode_P,K=G===0?d:u,J=G===0?w:D,se=G===0?E:C;this.updateTrack(B,Y,X,K,J,se)}),this.showRectHelpLine(this.startPoint,e,this.targetTrack.direct)}selfBlockTracks(e,r,i,n,s,a){let l=[],c=new Lr;return(Zt.getInstance().mode=="WIRING_MODE_SURROUND_AND_PUSHAWAY"||Zt.getInstance().mode=="WIRING_MODE_SURROUND"||Zt.getInstance().mode=="WIRING_MODE_OBSTRUCT")&&(this.getBlockTrack(e,i,s,this.pathNode_P,l,c),this.getBlockTrack(r,n,a,this.pathNode_N,l,c)),{shapes:l,command:c}}createCollideTrack(e,r,i,n){return new Zr().createTrack(this.track_N.item.layerId,e.start(),e.end(),i,r,n)}createArcCollideTrack(e,r,i,n){return new Zr().createArcTrackByArc(this.track_N.item.layerId,e,i,r,n)}getRandomNet(e,r="id"){for(let i=0;i<100;i++){let n=`tempNet-${r}-${Math.random()*1e16}-${Date.now()}`;if(!e.has(n))return n}return""}getBlockTrack(e,r,i,n,s,a){let l=r,c=Math.max(r,i),h=e.slice(0,l),u=e.slice(c+1,e.length),d=[].concat(h,u),p=new Set(Ye.getAllNets()),m=this.getRandomNet(p,"prePath");for(let g of d){let y;if(g instanceof M)y=this.createCollideTrack(g,m,n.item.width,a);else if(g instanceof q)y=this.createArcCollideTrack(g,m,n.item.width,a);else throw new Error("not support others!!!!");s.push(y)}return d}generateDiff(e,r){let i=e[0].start(),n=e[e.length-1].end(),s=[-1,1].map((l,c)=>{let h=new M(i,i.add(r)),u=new M(n,n.add(r)),d=[].concat([h],e,[u]);return d=d.filter(p=>p.length()>0),d.map(p=>p.panDistance(l*this.diffPairSpacing/2))}),a=[[],[]];return s.forEach((l,c)=>{let h=a[c];for(let u=1;u<l.length;u++){let d=u==1?l[0]:h[u-1],p=l[u];if(d instanceof q&&p instanceof M)h[u]=new M(d.end(),p.end());else if(d instanceof M&&p instanceof q)h[u-1]=new M(d.start(),p.start()),h[u]=p;else if(d instanceof M&&p instanceof M)if(Pt(dC.lengthen(d),dC.lengthen(p))>0){let g=new S(Ee[0],Ee[1]);h[u-1]=new M(d.start(),g),h[u]=new M(g,p.end())}else h[u]=p;else h[u]=p}h.shift(),h.pop()}),a}reverse(e){let r=new Array(e.length);for(let i=0,n=e.length-1;n>=0;i++,n--){let s=pp(e[n]);r[i]=s}return r}convertRectRegionInfo(e,r,i){let n=r.sub(e),s=new S(-i.y,i.x),a=i.dot(n),l=s.dot(n),c=i.mul(a).normalize(),h=s.mul(l).normalize(),u=Math.abs(a),d=Math.abs(l),p=e.add(c.mul(u)),m=e.add(h.mul(d));return{start:e,endX:p,end:r,endY:m,directX:c,directY:h,width:u,height:d}}calculateAdjustIndexAndLengthForDiffPair(e,r,i,n,s,a){let l=0,c=n,h=s,u=n,d=s;do{let p=e[c],m=r[h];for(;!(p instanceof M&&Math.abs(p.direct.cross(a))<1e-4)&&c<e.length-1;)c++,p=e[c];for(;!(m instanceof M&&Math.abs(m.direct.cross(a))<1e-4)&&h<r.length-1;)h++,m=r[h];if(!(p instanceof M&&Math.abs(p.direct.cross(a))<1e-4)||!(m instanceof M&&Math.abs(m.direct.cross(a))<1e-4))break;let g=p.start().sub(this.startPoint_P).dot(a),y=p.end().sub(this.startPoint_P).dot(a)-this.diffPairSpacing/2,b=m.start().sub(this.startPoint_N).dot(a),P=m.end().sub(this.startPoint_N).dot(a)-this.diffPairSpacing/2;if(y<b)if(c<e.length-1){c++;continue}else break;if(P<g&&h<r.length-1)if(h<r.length-1){h++;continue}else break;if(i<Math.max(g,b))break;if(i>Math.min(y,P))u=c,d=h,l=Math.min(y,P);else{u=c,d=h,l=i;break}if(y<P)if(c<e.length-1)c++;else break;else if(ne.eq(P,y))c++,h++;else if(h<r.length-1)h++;else break}while(c<e.length-1||h<r.length-1);return{length:Math.max(l,0),resultIndex_P:u,resultIndex_N:d}}showRectHelpLine(e,r,i){let{endX:n,endY:s}=this.convertRectRegionInfo(e,r,i),a=[e,n,r,s,e],l=[];for(let c=1;c<a.length;c++)l.push(new M(a[c-1],a[c]));this.rectHelpLine.forEach(c=>c.remove()),this.rectHelpLine=Bb(l,1002);for(let c of this.rectHelpLine)c.color=ee.WHITE}baseLineLengthChange(e,r,i,n,s,a,l,c,h){let u=0;for(let C=r;C<=i;C++)u+=e[C].length();let d=e[r].start(),p=e[i].end(),m=Math.abs(p.sub(d).dot(n)),g=n.rotate(new S(0,0),Math.PI/2).dot(s)>0,y=(h==g?-1:1)*this.diffPairSpacing/2,b=Math.abs(d.sub(c).dot(s)+y),P=Math.abs(p.sub(c).dot(s)+y),T=l?Math.min(Math.max(b/a-Math.sqrt(2),0),1)*(Math.sqrt(2)-2)*a:0,I=l?Math.min(Math.max(P/a-Math.sqrt(2),0),2)*(Math.sqrt(2)-2)*a:0;return m+b+P-u+T+I}create4Path(e,r){let i=new Array;for(let n of e)if(n instanceof M){let s=new zr(`TRACK${rf.getInstance().getID()}`,r.item.layerId,n.start(),n.end(),r.item.width,!1,r.item.net);i.push(s)}else if(n instanceof q){let s=new Ii(`TRACK${rf.getInstance().getID()}`,r.item.layerId,n.center,n.rx,r.item.width,n.startAngle*(Math.PI/180),(n.startAngle+n.sweepAngle)*(Math.PI/180),n.isCCW?1:0,!1,r.item.net,1);i.push(s)}return i}getBlockMin(e,r,i){let n=Number.MAX_VALUE;for(let s of e){let a=s.point.sub(r),l=Math.abs(i.dot(a));l<n&&(n=l)}return n}updateTrack(e,r,i,n,s,a=!1){let l=new Zr,c=l.createList(),h=i.item,u=r.getAllItems();a&&(n=u.length-n-1,s=u.length-s-1);let d=e.length-(u.length-s);e.forEach((p,m)=>{let g=h.width;m<=n?g=u[m].width:m>=d&&(g=u[m-d+s].width);let y;ud(p)<1e-8||(p instanceof M?(y=l.createTrack(h.layerId,p.start(),p.end(),g,h.net,this.wireCommands,h.getGroupID()),l.addList(y,c,this.wireCommands)):p instanceof q&&(y=l.createArcTrack(h.layerId,p.center,p.rx,p.startAngle*(Math.PI/180),(p.startAngle+p.sweepAngle)*(Math.PI/180),p.isCCW?1:0,g,h.net,this.wireCommands,void 0,h.getGroupID()),l.addList(y,c,this.wireCommands)))}),c.replace(r.getFirstNode(),r.getLastNode(),r),this.wireCommands.addCommand(new mi(c))}updateNetLengthMsg(e){let r=[];r.push(new v0(this.pathNode_P.item.net,this.pathNode_P.item.width,this.pathNode_P.item.layerId,this.pathNode_P.item.direct,!1)),r.push(new v0(this.pathNode_N.item.net,this.pathNode_N.item.width,this.pathNode_N.item.layerId,this.pathNode_N.item.direct,!1));let i=new RI(r,[],r[0]);Jd.updateNetLengthMsg2(i,"Differential pair wiring",e)}pushAway(){if(Zt.getInstance().mode==="WIRING_MODE_PUSHAWAY"){let r=new Tg;this.wireResult=r;let i=new v0(this.pathNode_N.item.net,this.pathNode_N.item.width,this.pathNode_N.item.layerId,this.pathNode_N.item.direct,!1),n=new v0(this.pathNode_P.item.net,this.pathNode_P.item.width,this.pathNode_P.item.layerId,this.pathNode_P.item.direct,!1);r.setInputStatus(this.pathList_N),r.setInputStatus(this.pathList_P),r.wireMap.set(i,this.pathList_N),r.wireMap.set(n,this.pathList_P);let s=new km;try{s.level="SUPER",s.inputLevel="NONE",OVe(this.type),s.run(r)}catch(a){throw new Error(a)}}}pushAwaySnakeTrack(e){let{tracks:r,width:i}=this.getMiddleLine(e);if(i<=0)return{resultPath:[],pathChange:!1};let n=new Lr,s=new Zr,a=s.createList(),l=this.pathNode_N.item;r.forEach(P=>{let T;ud(P)<1e-8||(P instanceof M?(T=s.createTrack(l.layerId,P.start(),P.end(),i,l.net,n,l.getGroupID()),s.addList(T,a,n)):P instanceof q&&(T=s.createArcTrack(l.layerId,P.center,P.rx,P.startAngle*(Math.PI/180),(P.startAngle+P.sweepAngle)*(Math.PI/180),P.isCCW?1:0,i,l.net,n,void 0,l.getGroupID()),s.addList(T,a,n)))});let c=this.pathList_N,h=this.pathList_P,u=s.createList(),d=s.createList();u.replace(c.getFirstNode(),c.getLastNode()),d.replace(h.getFirstNode(),h.getLastNode()),n.addCommand(new mi(u)),n.addCommand(new mi(d));let p=new Tg;this.wireResult=p;let m=new v0(this.pathNode_N.item.net,i,this.pathNode_N.item.layerId,this.pathNode_N.item.direct,!1);p.setInputStatus(a),p.wireMap.set(m,a);let g=new km(!1,300);try{g.level="SUPER",g.inputLevel="NONE",g.run(p)}catch(P){throw new Error(P)}let b={resultPath:a.getAllItems().map(P=>P.primitive),pathChange:!1};return this.changeHistory(p.command,a,b),n.undo(),b}changeHistory(e,r,i){let n=e.commands,s=n.length;for(let a=s-1;a>=0;a--){let l=n[a];if(l instanceof Lr)this.changeHistory(l,r,i);else if(l instanceof mi){let h=l.list.parentNode.target;r===h&&(i.pathChange=!0,l.undo(),n.splice(a,1))}}}getMiddleLine(e){let r=new Array(2),i=e[0].length,n=e[1].length;if(!i||!n)return{paths:e,width:0};if(e[0].length!==e[1].length)return{paths:e,width:0};let s=e[0].length,a=[],l=0;for(let c=0;c<s;c++){let h=e[0][c],u=e[1][c];if(c===0){let p=new Eu(new M(h.start(),h.start()),u),m=new Eu(new M(u.start(),u.start()),h),g=p.getDistance(),y=m.getDistance();l=(g<=y?g:y)+this.track_N.width/2+this.track_P.width/2}let d;if(h instanceof M&&u instanceof M){let p=h.start().add(u.start()).mul(.5),m=h.end().add(u.end()).mul(.5);if(d=new M(p,m),c!==0){let g=a[a.length-1];if(g instanceof M){let y=g.direct;d.direct.dot(y)>.99&&p.equals1(g.end())&&(d=new M(g.start(),m),a.pop())}}}else if(h instanceof q&&u instanceof q){let p=(h.rx+u.rx)/2,m=(h.ry+u.ry)/2;d=q.build2(h.center,h.startAngle,h.startAngle+h.sweepAngle,p,m,h.sweep())}a.push(d)}return{tracks:a,width:l}}rightClickMenuData(e){var s;let r=(s=this.targetTrack)==null?void 0:s.net,i=!1;if(r){let a=re.getInstance().getNet(r);a!=null&&a.netDifferential!=null&&(i=!0)}let n={state:"show",left:e.mouseX,top:e.mouseY,filter:Xde(e.adsorb,i).result};$t.getInstance().menuData(n,this)}updateNetLengthRuleInDialog(){var a;let e=(a=this.targetTrack)!=null&&a.net?this.targetTrack.net:"",r=re.getInstance().getNetLengthPhysicsByNet(e),i=r.netLengthMin*10,n=r.netLengthMax*10,s="updateNetLengthRule";A.publish("pcbdialogModify",{dialogType:"equal-length-tuning",action:s,netLengthMin:i,netLengthMax:n})}};uc.init=!1,uc.isSingleSide=!0,uc.type="line45",uc.width=6,uc.minHeight=1,uc.stepSize=1,uc.restrictLength=!1,uc.additionalLength=0;var KG=uc;var qde=class extends Oo{constructor(){super();this.selections=new Array;this.mouseLeftX=0;this.mouseLeftY=0;this.commandFactory=new hi;this.drawing=!0}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":this.cancel();break;case"Finish":this.onMouseLeftUp(e);break}he.publish("updateFrame","")}onMouseLeftDown(e){}onMouseMove(e){let r=e.sceneX,i=e.sceneY;this.selections.length>0&&this.drawing?(this.selections[0].start=new S(this.mouseLeftX,this.mouseLeftY),this.selections[0].end=new S(r,this.mouseLeftY),this.selections[1].start=new S(r,this.mouseLeftY),this.selections[1].end=new S(r,i),this.selections[2].start=new S(r,i),this.selections[2].end=new S(this.mouseLeftX,i),this.selections[3].start=new S(this.mouseLeftX,i),this.selections[3].end=new S(this.mouseLeftX,this.mouseLeftY)):this.drawing&&Ut.update(e,"Please select an area")}onMouseLeftUp(e){let r=le.themeConfig.canvasTheme,i=r.isSolidLine(r.selectBoxLineStyle),n=r.selectBoxColor;if(this.selections.length==0){On.getInstance().allowPull=!1;let s=e.sceneX,a=e.sceneY;this.mouseLeftX=s,this.mouseLeftY=a,this.selections.push(new cr(1002,new S(this.mouseLeftX,this.mouseLeftY),new S(s,this.mouseLeftY),i,n)),this.selections.push(new cr(1002,new S(s,this.mouseLeftY),new S(s,a),i,n)),this.selections.push(new cr(1002,new S(s,a),new S(this.mouseLeftX,a),i,n)),this.selections.push(new cr(1002,new S(this.mouseLeftX,a),new S(this.mouseLeftX,this.mouseLeftY),i,n)),Ut.cancel()}else{let s=ze.getSelects();s=s.slice(0),this.commandFactory.createGroup("modify by select arrange");let[a,l]=this.getCursor(this.selections),c=s.filter(h=>h instanceof ke);Is.getInstance().init(c,"flip to OppositeLayer",(h,u)=>{this.arrange(h,a,l),he.publish("onlySelect",h),h.map(d=>d.click()),this.commandFactory.execute();for(let d of this.selections)d.remove();this.selections.length=0,he.publish("updateCrossDirect",e)})}}getCursor(e){let r=e[0],i=r.start,n=r.end;for(let s=1;s<e.length;s++){r=e[s];let a=r.start,l=r.end;ne.greatereq(i.x,a.x)&&ne.lesseq(i.y,a.y)&&(i=a),ne.greatereq(i.x,l.x)&&ne.lesseq(i.y,l.y)&&(i=l),ne.lesseq(n.x,a.x)&&ne.lesseq(n.y,a.y)&&(n=a),ne.lesseq(n.x,l.x)&&ne.lesseq(n.y,l.y)&&(n=l)}return[i,n]}arrange(e,r,i){let n={};for(let s of e)if(s instanceof ke){let l=s.model.buildBBox().height(),c=n[l],h=s.footprintId;c?c[h]?c[h].push(s):c[h]=[s]:(n[l]={},n[l][h]=[s])}this.greedy(n,r,r,i)}greedy(e,r,i,n){if(Object.keys(e).length===0)return;let s=0,a=0,l=null,c=null,h=null;for(let u in e){let d=e[u];for(let p in d)if(d[p]instanceof Array){let m=d[p][0],g=parseFloat(u),b=m.buildBBox().width();(ne.greater(g,s)||ne.eq(g,s)&&ne.greater(b,a))&&(s=g,a=b,l=d[p],c=u,h=p)}}delete e[c][h],Object.keys(e[c]).length===0&&delete e[c];for(let u of l){let d=u.buildBBox(),p=d.width(),m=d.height(),g=u.position.x-d.minX,y=d.maxY-u.position.y,b=nn.convert(.05,39.37,1);this.commandFactory.addCommand4Item(u,"modify"),n.x>i.x&&Math.abs(n.x-i.x)>=p?(u.position=new S(i.x+g,i.y-y),i===r&&(r=new S(r.x,r.y-m-b)),i=new S(i.x+p+b,i.y)):(u.position=new S(r.x+g,r.y-y),i=new S(r.x+p+b,r.y),r=new S(r.x,r.y-m-b),n=new S(n.x,n.y-m-b))}this.greedy(e,r,i,n)}interrupt(){for(let e of this.selections)e.remove();this.selections.length=0,this.drawing=!1,Ut.cancel(),On.getInstance().allowPull=!0}cancel(){this.interrupt(),he.publish("tool","dropdrag");let e=ze.getSelects();gr.model=e.length>1?1:0}onMouseRightUp(e){if(e.openMenu)switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":e.ctrlKey?this.cancel():this.rightClickMenuData(e);break;case"rightClick":e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:po(e.adsorb)};$t.getInstance().menuData(r,this),Ut.cancel(),this.drawing=!1}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":he.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":he.publish("openSystemDialog","ADSORPTION",Q());break}he.publish("updateFrame","")}};var $de=class extends ni{constructor(t,e){super(),this.tool=t,this.lastTool=e}execute(t){Is.getInstance().init(t.refer.items,t.commandFactory||t.command,(e,r,i)=>{this.tool.interrupt(),t.refer.items=e,le.pcbConfig.snapToOriginWhileDragFootprint&&e.length==1&&e[0]instanceof ke&&t.from=="move-lock"&&(t.refer.referX=e[0].position.x,t.refer.referY=e[0].position.y),A.publish("select",e);let n=le.pcbConfig.isPlaceViasAutoShove||le.pcbConfig.moveComponent=="push"||le.pcbConfig.moveComponent=="block"?new VG(t.refer,t.menu,r,t.isContinuousMode||!1,i):new FD(t.refer,t.menu,r,t.isContinuousMode||!1,i);A.publish("resetToolLastCmd",""),di.setPlace(),this.tool.setNextTool(n),t.command=="batchMoveItem"&&t.pcbPlaceTransfer&&n.setPcbPlaceTransfer(t.pcbPlaceTransfer)})}interrupt(){this.lastTool!=null&&this.lastTool.interrupt()}};var sXe={align_left:"selectRefObjectForAlignLeft",align_right:"selectRefObjectForAlignRight",align_top:"selectRefObjectForAlignTop",align_bottom:"selectRefObjectForAlignBottom",align_vertical_center:"selectCenterObjectForVertical",align_horizontal_center:"selectCenterObjectForHorizontal",selectRefObjectForAlignLeft:"align_left",selectRefObjectForAlignRight:"align_right",selectRefObjectForAlignTop:"align_top",selectRefObjectForAlignBottom:"align_bottom",selectCenterObjectForVertical:"align_vertical_center",selectCenterObjectForHorizontal:"align_horizontal_center"};function Kde(o,t){let e=new qt;return e.add("CANCEL",!0),e.addExtend("ROTATE",Ag()),e.addExtend("FLIP",Xy()),e.add("TURNOVER",!0),e.add("toggleAdsorb",!1,t),e.add("ADSORBENT_CONFIG"),e}var Zde=class extends ni{constructor(e){super();this.placing=!1;this.unCheckingEnableLayer=!1;this.start(),this.pcbModule=e}get groups(){var e;return((e=this.tool)==null?void 0:e.group)||[]}set groups(e){this.tool!=null&&this.tool.cancel(),this.tool=new Ad(e),this.tool.recordStyle()}async hasItems(){for(let e in this.pcbModule){let r=this.pcbModule[e],i=new AA;if(await i.parseTemplate(r),i.hasItems())return!0}return!1}async getInstance(){this.placing=!0,this.groups.length=0;let r=new _e,i=new Array;this.filterItems.clear();let n=new Map,s=new Map,a=new Set;for(let l in this.pcbModule){let c=this.pcbModule[l],h=new AA;await h.parseTemplate(c);let u=h.copy(l,!0);A.publish("AutoServiceClear","");let d=u.buildBBox(),p=u.getItems(),m=l,g=p.filter(y=>!(y instanceof ke));for(let y of g)a.add(y.layerId);n.set(m,{items:p,group:u,bbox:d,decoder:h}),s.set(m,p)}if(!this.unCheckingEnableLayer){let l=await rse(s,(c,h)=>{let u=n.get(h);return u?u.decoder.getBasicLayerTable(c):{}});this.unCheckingEnableLayer=!0;for(let[c,h]of l){let u=n.get(c);u&&(u.items=h)}}for(let l of n.values()){let{items:c,group:h,bbox:u}=l;for(let d of c)this.filterItems.add(d);if(le.pcbConfig.autoDesignator){let d=new Set;for(let p of c)p instanceof ke&&d.add(p);IOe(d)}xe.addAll(i,c),i.push(h),r.ext1(u)}this.tool=new Ad(i),this.bbox=r.build1(),A.publish("onlySelect",this.groups),this.tool.recordStyle(),this.placing=!1}onKeyDown(e){if(e.keyCode===32){if(this.groups.length>0){let i=this.bbox.center();this.tool.rotateFor(i,le.pcbConfig.rotate)}}else e.keyCode===9?A.publish("openMainDialog",{cmd:23,data:{option:{unit:R.getInstance().unit}}}):e.keyCode===27&&this.cancel();switch(tr.getAction(5,e)){case"Cancel":this.cancel();break;case"Flip Right and Left":{this.turn("turnAround");break}case"Flip Up and Down":{this.turn("turnUpsideDown");break}}A.publish("updateFrame","")}async onMouseLeftUp(e){let r=new S(e.sceneX,e.sceneY);if(this.groups.length>0){this.moveTo(r),this.tool.complete();for(let n of this.groups)A.publish("hasModifyPcbItem",n);A.publish("onlySelect",this.groups);let i=new hi;i.createGroup("Place Pcb module");for(let n of this.groups)i.addCommand4Item(n,"add");i.execute(),this.uploadPlacePcbLog(),A.publish("flushService",""),A.publish("clearSelect",""),await this.getInstance(),this.moveTo(r),A.publish("updateFrame",""),this.drawing=!0}}async onMouseMove(e){if(this.placing)return;let r=new S(e.sceneX,e.sceneY);this.drawing&&(this.groups.length>0?this.moveTo(r):await this.getInstance())}moveTo(e){if(this.groups.length>0){let r=this.bbox.center(),i=e.sub(r),n=Ae.translate(i.x,i.y,0);this.tool.transform(n),this.bbox=this.bbox.transform(n.toMatrix3())}}interrupt(){if(this.groups.length>0){for(let e of this.groups)e.remove(),A.publish("delete",e);this.tool.cancel(),this.groups.length=0,this.drawing=!1,this.unCheckingEnableLayer=!1,A.publish("clearSelect",""),A.publish("updateRtree","")}this.end()}cancel(){this.interrupt(),A.publish("tool","dropdrag")}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:Kde(this.groups,e.adsorb).result};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"ROTATE":this.rotate(i[1]);break;case"FLIP":i[1]=="FLIP_LEFTANDRIGHT"?this.turn("turnAround"):i[1]=="FLIP_UPANDDOWN"?this.turn("turnUpsideDown"):i[1]=="FLIP_LEFTANDRIGHT_BY_REFER_POINT"?this.turn("turnAroundByReferPoint"):i[1]=="FLIP_UPANDDOWN_BY_REFER_POINT"&&this.turn("turnUpsideDownByReferPoint");break;case"TURNOVER":{a_(!1);break}}A.publish("updateFrame","")}rotate(e){let r=this.bbox.center();if(e==="rotate_left"&&this.tool.rotateFor(r,le.pcbConfig.rotate),e==="rotate_right"&&this.tool.rotateFor(r,-le.pcbConfig.rotate),e==="rotate_reference_point"){let i={x:r.x,y:r.y,items:this.tool,executeCommand:!1};$n.rotateAssignReferPoint(i,this,null,null,this.rotateReferPointCallback.bind(this))}}turn(e){var n;xo.setTool(this),(n=this.tool)==null||n.sycn();let r=this.bbox.center(),i=this.groups.filter(s=>!(s instanceof qc));switch(e){case"turnAround":xo.turn(i,!1,!1,r);break;case"turnUpsideDown":xo.turn(i,!0,!1,r);break;case"turnAroundByReferPoint":{let s={items:i};xo.turnByReferPoint(s,this);break}case"turnUpsideDownByReferPoint":{let s={items:i,isTurnUpsideDown:!0};xo.turnByReferPoint(s,this);break}}}rotateReferPointCallback(e,r,i,n){let s=this.bbox.center(),a=new Dt(ba.x-s.x,ba.y-s.y,0),l=Ae.translate1(a);this.tool.transform(l),this.bbox=this.bbox.transform(l.toMatrix3()),Uu.realtimeCheckItems(this.groups),this.rotateReferPointCallback=null}uploadPlacePcbLog(){for(let e in this.pcbModule){let{uuid:r,projectId:i}=this.pcbModule[e];A.windowBridge.publish("addUploadPlaceLibLog",{uuid:r,path:i,lib_type:4},Q())}}};function IOe(o){let t=new Map,e=new Set;for(let r of o)if(r.attrsMap["Reuse Block"]){let i=`${r.attrsMap["Reuse Block"]}_${r.attrsMap["Group ID"]}`;t.has(i)||t.set(i,new Set),t.get(i).add(r)}else e.add(r);t.size?Ar.placeCBBAutoSuffix(t,o):e.size&&Ar.autoDesignator(e)}var Jde=class extends ni{constructor(){super();this.ratline=null;this.pad1=null;this.mouseRightDown=!1;this.isNeedCancel=!0;this.drawing=!0,Ut.update(fi.getInstance(),"Please select a Pad")}onKeyDown(e){switch(tr.getAction(4,e)){case"Cancel":this.cancel();break}}onEnterPlace(e){this.onMouseLeftDown(e)}onMouseLeftDown(e){let r=Vr.selectPadCenter(e.realSceneX,e.realSceneY);if(r&&r instanceof Le)if(this.start(),this.pad1){let i=new De("connect pads"),n=this.pad1.net,s=r.net;if(n&&s){if(n==s){this.interrupt();return}A.windowBridge.rpcCall("connectPadsToMergeNet",[[n,s]],Q()).then(a=>{if(a.message.action=="ok"){let l=a.message.selectedVal,c=n==l?s:n,h=Ye.getSameNetItems(c);for(let u of h)(u instanceof Le||u instanceof Ge||u instanceof Ue)&&(i.addCommand(Ce.dispatch(u,"modify")),A.publish("hasModifyPcbItem",u),u.net=l,A.publish("hasModifyPcbItem",u));qe.executeCommand(i),A.publish("flushService","")}})}else if(!n&&!s){let a=this.getAutoAssignNet(this.pad1,r);for(let l of[this.pad1,r])i.addCommand(Ce.dispatch(l,"modify")),A.publish("hasModifyPcbItem",l),l.net=a,A.publish("hasModifyPcbItem",l)}else n?(i.addCommand(Ce.dispatch(r,"modify")),A.publish("hasModifyPcbItem",r),r.net=n,A.publish("hasModifyPcbItem",r)):(i.addCommand(Ce.dispatch(this.pad1,"modify")),A.publish("hasModifyPcbItem",this.pad1),this.pad1.net=s,A.publish("hasModifyPcbItem",this.pad1));qe.executeCommand(i),this.interrupt(),A.publish("flushService",""),this.end()}else this.pad1=r}onMouseLeftUp(e){}onMouseRightDown(e){this.mouseRightDown=!0}onMouseRightUp(e){if(!this.isNeedCancel){this.isNeedCancel=!0;return}e.openMenu&&(this.ratline?this.interrupt():this.cancel())}onMouseMove(e){if(this.drawing){if(super.onMouseMove(e),e.rightDown&&(this.isNeedCancel=!1),this.pad1){this.ratline!=null&&this.ratline.remove();let r=new id(this.pad1.center),i=new id(new S(e.realSceneX,e.realSceneY));this.ratline=new cr(57,r.point,i.point,!0)}Ut.update(e,"Please select a Pad")}}rightClickMenuData(e){}cancel(){this.interrupt(),Ut.cancel(),A.publish("tool","dropdrag")}interrupt(){this.pad1=null,this.ratline&&(this.ratline.remove(),this.ratline=null),this.end()}getAutoAssignNet(e,r){let i=Ye.getAllNets(),n=[],s="",a=e,l=r;if(a&&a instanceof Le||l&&l instanceof Le){let c=a==null?void 0:a.getParent(),h=l==null?void 0:l.getParent(),u=c&&c.designator.toUpperCase(),d=h&&h.designator.toUpperCase(),p=a&&`${Tr.toUpperCase()}${a==null?void 0:a.number}`,m=l&&`${Tr.toUpperCase()}${l==null?void 0:l.number}`;if(u&&d){let g=[u,d].sort((y,b)=>this.sortRule(y,b,!0));s="$"+g[0]+"_"+(g[0]==u?a.num:l.num)}else!u&&!d?a instanceof Le&&l instanceof Le?s="$"+[p,m].sort((y,b)=>this.sortRule(y,b,!1))[0]:a instanceof Le?s="$"+p:l instanceof Le&&(s="$"+m):(u&&(s="$"+u+"_"+a.num),d&&(s="$"+d+"_"+l.num))}else i.forEach(c=>{c.includes("S$")&&n.push(Number(c.split("S$")[1]))}),n.length?(n=n.sort((c,h)=>c-h),s="S$"+(n[n.length-1]+1)):s="S$1";return s}sortRule(e,r,i){var n=/[^a-zA-Z]/g,s=/[^0-9]/g,a=parseInt(e,10),l=parseInt(r,10);if(isNaN(a)&&isNaN(l)){var c=i?e.replace(n,""):e.replace(s,""),h=i?r.replace(n,""):r.replace(s,"");if(c===h){var u=parseInt(i?e.replace(s,""):e.replace(n,""),10),d=parseInt(i?r.replace(s,""):r.replace(n,""),10);return u===d?0:u>d?1:-1}else return c===""?1:h===""?-1:c>h?1:-1}else return isNaN(a)?1:isNaN(l)?-1:a>l?1:-1}parse(e){}};function aXe(o){let t=new qt;return t.add("CANCEL"),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t.result}var Qde=class extends Dg{constructor(){super()}onMouseLeftUp(t){this.start();let e=t.sceneX,r=t.sceneY;ze.selectedConnectedCopper(e,r,t.ctrlKey)}onMouseRightUp(t){if(t.openMenu){if(le.pcbConfig.endDrawing=="ctrl+rightClick"){if(!t.ctrlKey){this.rightClickMenuData(t);return}}else if(t.ctrlKey){this.rightClickMenuData(t);return}this.cancel()}}rightClickMenuData(t){let e={state:"show",left:t.mouseX,top:t.mouseY,filter:aXe(t.adsorb)};$t.getInstance().menuData(e,this),this.drawing=!1}parse(t){switch(this.drawing=!0,t.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}interrupt(){this.end(),this.drawing=!1}cancel(){this.interrupt(),A.publish("tool","dropdrag")}};var ZG=class ZG extends ni{constructor(){super();this.widthFollowRule=!1;this.event=new du;this.started=!1;this.shouldSplit=!1;switch(this.lineType="Line",this.event=new du,we.drawing=!0,this.event._width=Ha.getInstance().getTrackWidth().value||ut.defaultOutlineWidth,this.resultEvent=new Hm(this.lineType),this.resultEvent.shouldAddHistory=!1,this.event.needClose=!1,this.event.drawScene="Split Line",Zt.getInstance().type){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new eh(this.event,Ur,this.resultEvent,this.lineType);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new Gh(this.event,Ur,this.resultEvent,this.lineType);break;case"WIRING_CORNER_ARC":this.drawPolygon=new ja(this.event,Ur,this.resultEvent,this.lineType);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Tl(this.event,Ur,this.resultEvent,this.lineType);break}this.event.commands=new De("draw 2DLine - "+this.lineType),Ur.addDrawTool(this),Ea.changeTool(this),ZG._readyType=this.lineType}static get readyType(){return this._readyType}get isShowProfileView(){return!0}get needClear(){return Zt.getInstance().type!=="WIRING_CORNER_ARC"}getCanUndo(){return!0}initSplitUtils(e){this.splitUtils=new dhe(e)}onKeyDown(e){let r=tr.getLocalAction(["decrease_routing_width","increase_routing_width","Undo","Redo"],e);switch(r||(r=tr.getAction(4,e)),r){case"changeRoutingAngle":case"Routing Corner":let i=Ur.getNextType();if(this.wireCorner(i),i==="WIRING_CORNER_FREEANGLE"||i==="WIRING_CORNER_ARC"){let s=new S(e.sceneX,e.sceneY);this.showFloatingInputBox(s)}else at.destroy();wi();break;case"Switch Common Track Width":(this.resultEvent.type==="Line"||this.resultEvent.type==="Board Outline")&&this.showCommonTrackWidthMenu(e);break;case"Change Track Width While Routing":Zt.getInstance().type!=="WIRING_CORNER_FREEANGLE"&&(this.resultEvent.type==="Line"||this.resultEvent.type==="Board Outline")&&A.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"decrease_routing_width":{let a=this.event._width-.2;a>=.1&&this.setWireWidth(a)}break;case"increase_routing_width":{let a=this.event._width+.2;this.setWireWidth(a)}break}if(r==="Cancel")this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.cancel();else if(r==="Finish")this.next(e);else if(r==="Undo"){let i=qe.stack.description=="Execute Clip Polyline"&&qe.stack.length>0;A.publish("undo",""),i&&(this.splitUtils.selectedItems=new Array)}else r==="Redo"?A.publish("redo",""):(r=="Filp Path While Drawing"&&this.onMouseMove(e,!1),this.drawPolygon.onKeyDown(e),r=="Backspace"&&this.onMouseMove(e),r=="Filp Path While Drawing"&&(this.drawPolygon.clear(),this.onMouseMove(e)))}onMouseLeftUp(e){this.next(e)}next(e){if(at.editingWhat){at.editingWhat="";return}if(this.started||(this.started=!0,this.start()),this.dealLocked(e),this.drawPolygon.onMouseLeftUp(e),this.isShowProfileView){B2.clear();let r=[...this.drawPolygon.shape],i=this.drawPolygon.getPreviewOutline().filter(Boolean);i.length&&i.forEach(s=>r.push(s)),r.forEach(s=>{B2.displayPolyline(s.getMathGraphics()),s.hidden()}),this.needClear&&this.drawPolygon.clear();let n=this.splitUtils.getSplitLine();i.length==0&&r.length==0&&n&&(n.forEach(s=>{B2.displayPolyline(s)}),this.shouldSplit=!0)}at.destroy()}getWidth(){return this.event._width}dealLocked(e){if(typeof at.lineLockedLength=="number"){let r=at.startPoint,i=new S(e.sceneX,e.sceneY),n=new S(i.x-r.x,i.y-r.y).normalize(),s=new S(n.x*at.lineLockedLength,n.y*at.lineLockedLength);i=new S(s.x+r.x,s.y+r.y),e.sceneX=i.x,e.sceneY=i.y}if(typeof at.lineLockedAngle=="number"){let r=at.startPoint,i=new S(e.sceneX-r.x,e.sceneY-r.y),n=epe(i),s=lXe(i,at.lineLockedAngle-n);e.sceneX=s.x+r.x,e.sceneY=s.y+r.y}}onMouseMove(e,r=!0){if(this.dealLocked(e),this.drawing){this.drawPolygon.onMouseMove(e);let n=this.drawPolygon.getPreviewOutline().filter(Boolean);this.isShowProfileView&&n.length>0&&(B2.clear(),this.drawPolygon.shape.length>0&&(n=n.concat(this.drawPolygon.shape)),n.forEach(s=>{B2.displayPolyline(s.getMathGraphics()),s.hidden()}),r&&this.needClear&&this.drawPolygon.clear())}let i=new S(e.sceneX,e.sceneY);this.showFloatingInputBox(i)}showFloatingInputBox(e){if(le.pcbConfig.useDynamicInputBox&&this.started&&this.event.last&&(this.drawPolygon instanceof Tl||this.drawPolygon instanceof ja)){let r=nf(),i=this.event.last;at.startPoint=i;let n=i.distance1(e);if(!n)return;let s=_o(e),a=_o(i),l=new S(e.x-i.x,e.y-i.y),c=epe(l);if(this.drawPolygon instanceof Tl||this.drawPolygon instanceof ja&&!this.drawPolygon.hasArc()){let h=c/180*Math.PI,u=new S(i.x+n,i.y);at.id!=="adsorption"&&(at.auxiliaryLine1?at.auxiliaryLine1.update(i,u,n,h):at.auxiliaryLine1=new CD(i,u,n,h));let d=9;if(d>=at.priority){at.priority=d;let p={data:[{startPoint:i,cursorPoint:e,frameStartPoint:a,frameCursorPoint:s,info:{type:"free",value:je(n),unit:R.getInstance().unit}},{startPoint:i,cursorPoint:e,frameStartPoint:a,frameCursorPoint:s,info:{type:"circle",value:c,tagName:"angle"}}],type:"rect",show:!0,frameInfo:r};at.create(p)}}else if(this.drawPolygon instanceof ja&&this.drawPolygon.hasArc()){let h=this.drawPolygon.getArcAngle(),u=this.event.start,d=this.drawPolygon.getArcEnd(),p=this.drawPolygon.getArcCenter(),m=this.drawPolygon.getArcRadius(),g=this.drawPolygon.getArcStartAngle(),y=this.drawPolygon.getArcEndAngle(),b=this.drawPolygon.getArcSweep();at.id!=="adsorption"&&(at.auxiliaryLine2?at.auxiliaryLine2.update(u,d,p,m/10,g,y,b):at.auxiliaryLine2=new SD(u,d,p,m,g,y,b)),at.id!=="Free Arc"&&at.destroy();let P=9;if(P>=at.priority){at.priority=P;let T={data:[{startPoint:u,center:p,frameStartPoint:a,frameCursorPoint:_o(p),info:{type:"circle",value:h,tagName:"angle",canNotLock:!0}}],type:"rect",show:!0,frameInfo:r};at.create(T,"Free Arc")}}}else this.started&&at.id!=="adsorption"&&at.destroy()}applyInputAtCursorValue(e){let{value:r,type:i,locked:n,unlocked:s,editing:a,keyCode:l,startPoint:c}=e;if(a){at.editingWhat=i;return}let h=!1;if((at.editingWhat||typeof at.lineLockedLength=="number"||typeof at.lineLockedAngle=="number")&&(h=!0),at.editingWhat="",n||s){this.drawPolygon.arc||this.lockUnlock(e);return}let u=this.applyValue(e);l===13&&(u?h?(this.drawPolygon.asMouseLeftUp(u),at.destroy()):(this.drawPolygon.addShape(u),this.completed()):at.destroy())}lockUnlock(e){let{value:r,type:i,locked:n,unlocked:s}=e,a=new dt;i==="free"?n?(this.applyValue(e),r=a.conversion(R.getInstance().unit,"mil",r/10),at.lineLockedLength=r):s&&(at.lineLockedLength=null):i==="circle"&&(n?(at.lineLockedAngle=r,this.applyValue(e)):s&&(at.lineLockedAngle=null))}applyValue(e){let{value:r,type:i,startPoint:n,cursorPoint:s}=e,a=new dt,l,c;if(i==="free")if(r=a.conversion(R.getInstance().unit,"mil",r/10),at.id==="adsorption"){let h=new S(s.x-n.x,s.y-n.y).normalize();h=new S(h.x*r,h.y*r);let u=new S(h.x+n.x,h.y+n.y);if(this.started)c=u;else{this.event.start=u,this.started=!0,this.start();return}}else{let h=new S(this.event.curr.x-this.event.last.x,this.event.curr.y-this.event.last.y).normalize();l=new S(h.x*r,h.y*r),c=new S(l.x+this.event.last.x,l.y+this.event.last.y)}else if(i==="circle"){let h=this.drawPolygon.arc;if(h){let u=h.getStart(),d=h.getEnd(),p=new S((u.x+d.x)/2,(u.y+d.y)/2),m=new S(d.x-u.x,d.y-u.y),g=m.length(),y=g/2/Math.sin(r/2/180*Math.PI),b=g/2/Math.tan(r/2/180*Math.PI),P=m.normalize(),T=new S(-P.y,P.x),I=new S(T.x*b+p.x,T.y*b+p.y);c=new S(-T.x*y+I.x,-T.y*y+I.y)}else{let u=at.startPoint;s=this.event.curr||s;let d=new S(s.x-u.x,s.y-u.y),p=epe(d),m=lXe(d,r-p);c=new S(m.x+u.x,m.y+u.y)}}return this.showFloatingInputBox(c),this.event.curr=c,this.drawPolygon.draw(this.event.last,this.event.curr,Zt.getInstance().type),this.isShowProfileView&&(B2.clear(),[...this.drawPolygon.shape,...this.drawPolygon.getPreviewOutline()].forEach(u=>B2.displayPolyline(u.getMathGraphics())),this.needClear&&this.drawPolygon.clear()),this.drawPolygon.asClose(c),A.publish("updateFrame",""),c}onMouseRightUp(e){if(e.openMenu)switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.shouldSplit?(this.splitUtils.runSplit(),this.shouldSplit=!1):this.cancel():this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.event.shape.length>0?(this.drawPolygon.abortLast=!0,this.completed()):this.shouldSplit?(this.splitUtils.runSplit(),this.shouldSplit=!1):this.cancel();break}}}getSplitItems(){var e;return(e=this.splitUtils)==null?void 0:e.selectedItems}splitRelease(){this.splitUtils.clearCache(),this.splitUtils.clearView(),this.splitUtils.clearSubscribe(),this.splitUtils=null}interrupt(){if(this.drawPolygon.interrupt(),at.destroy(),ZG._readyType=null,this.end(),this.started&&this.event.shape.length==0){B2.clear(),this.started=!1;return}this.started=!1,this.splitRelease()}cancel(){let{drawPolygon:e}=this;this.started?this.interrupt():(Ur.clearDrawTool(),e.cancel(),ZG._readyType=null),at.destroy(),this.started=!1,this.end()}flipPath(){this.drawPolygon.flipPath()}toggleLayer(e){if(this.resultEvent.type==="Fill Region"){let r=Pe.getLastActiveLayerID(),i=Pe.getAllPinLayerIds();if(i.includes(e)!==i.includes(r))return Pe.setActiveLayerId(r)}this.drawPolygon.toggleLayer(e)}wireCorner(e){switch(this.drawPolygon.clear(),this.drawPolygon=null,e){case"WIRING_CORNER_LINE45":case"WIRING_CORNER_LINE90":this.drawPolygon=new eh(this.event,Ur,this.resultEvent,this.lineType);break;case"WIRING_CORNER_ARC90":case"WIRING_CORNER_ARC45":this.drawPolygon=new Gh(this.event,Ur,this.resultEvent,this.lineType);break;case"WIRING_CORNER_ARC":this.drawPolygon=new ja(this.event,Ur,this.resultEvent,this.lineType);break;case"WIRING_CORNER_FREEANGLE":this.drawPolygon=new Tl(this.event,Ur,this.resultEvent,this.lineType);break}this.event.start!=null&&this.drawing&&(this.event.last==null&&(this.event.last=this.event.start),this.drawPolygon.draw(this.event.last,this.event.curr,e),this.drawPolygon.asClose(this.event.curr)),Zt.getInstance().type=e,we.synchronize()}wireWidth(e){this.drawPolygon.wireWidth(e),A.publish("flushSelectingInfo","")}completed(e){this.drawPolygon.completed(!1,void 0),B2.clear(),e=="CANCEL"?this.splitUtils.clearCache():(this.splitUtils.getSplitLine().forEach(i=>B2.displayPolyline(i)),this.splitUtils.runSplit()),at.destroy(),this.started=!1,this.shouldSplit=!1,this.end()}backspace(){this.drawPolygon.backspace(),at.destroy()}wireMode(e){}rightClickMenuData(e){let r=this.event.start!=null,i=this.resultEvent.type==="Line",n={state:"show",left:e.mouseX,top:e.mouseY,filter:vg(Zt.getInstance().type,e.adsorb,r,!0,i,this.event._width).result};$t.getInstance().menuData(n,this),this.drawing=!1}showCommonTrackWidthMenu(e){let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=Dm(this.event._width).result,$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"AUTO_TRIM_SILKSCREEN":A.publish("autoTrimSilkscreen","");break;case"COMPLETE":this.drawPolygon.abortLast=!1,this.completed();break;case"CANCEL":this.event.shape&&this.event.shape.length?(this.drawPolygon.abortLast=!0,this.completed("CANCEL")):this.cancel();break;case"REGRESSION":this.backspace();break;case"WIRING_CORNER":this.wireCorner(i[1]),wi();break;case"WIRING_WIDTH_INPUT":A.publish("openMainDialog",{cmd:26,data:{tool:this}});break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"WIDTH":i[1]==="WIRING_WIDTH"?this.toggleWidth(i[2]):i[1]==="WIRING_WIDTH_COMMONLY_SSETTING"&&A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",Q());break;case"WIRING_WIDTH":this.toggleWidth(i[1]);break;case"WIRING_WIDTH_COMMONLY_SSETTING":A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",Q());break}A.publish("updateFrame","")}toggleWidth(e){if(this.resultEvent.type==="Line"){let r=le.trackConfig[e];this.setWireWidth(r.getSizeAccordingToUnit())}}setWireWidth(e){this.wireWidth(e),this.widthFollowRule=!1,we.prevTrackWidth=e,this.onMouseMove(fi.getInstance()),A.publish("flushSelectingInfo","")}getFirstLine(){if(this.drawPolygon instanceof eh)return this.drawPolygon.getLine()}};ZG._readyType=null;var tpe=ZG;function epe(o){if(o.length()<=0)return 0;let t=new S(1,0),e=Math.atan(o.y/o.x);return e=e/Math.PI*180,o.x<0?e=180+e:o.y<0&&(e=360+e),e}function lXe(o,t){let e=o.length(),r=epe(o),i=Math.cos((t+r)/180*Math.PI)*e,n=Math.sin((t+r)/180*Math.PI)*e;return new S(i,n)}function cXe(){let o=[];return R.getInstance().doctype===3&&o.push({text:"Line",value:"Line"},{text:"Board Outline",value:"Board Outline"},{text:"Slot Region",value:"Slot Region"},{text:"Copper Region",value:"Copper Region"},{text:"Fill Region",value:"Fill Region"},{text:"Prohibited Region",value:"Prohibited Region"},{text:"Constraint Region",value:"Constraint Region"},{text:"FPC Stiffener",value:"FPC Stiffener"},{text:"3D Shell - Outline",value:"3D Shell - Outline"},{text:"3D Shell - Top Slot Region",value:"3D Shell - Top Slot Region"},{text:"3D Shell - Top/Bottom Entity",value:"3D Shell - Top/Bottom Entity"}),R.getInstance().doctype===4&&o.push({text:"Line",value:"Line"},{text:"Slot Region",value:"Slot Region"},{text:"Fill Region",value:"Fill Region"},{text:"Prohibited Region",value:"Prohibited Region"},{text:"FPC Stiffener",value:"FPC Stiffener"}),o.length<=0&&o.push({text:"Line",value:"Line"}),o}function rpe(o){let t=1;return Un.fixLayerOptions(void 0,Un.createLayerOptionsByType(o)).map(r=>({text:r.text,value:String(r.value)}))}var ipe=class{constructor(){this._primitiveType="Line",this._primitiveTypeList=cXe(),this._layerList=rpe(this._primitiveTypeList[0].value),this._layerId=this._layerList[0].value,this._lineWidth=1,this._defaultLineWidth=1,this._isKeepNetProfile=!0,this._copyOperationType="ZoomIntByDist",this._zoomDist=1,this._defaultZoomDist=1,this._zoomRatio=2,this._defaultZoomRatio=2,this._isRemoveSourceTarget=!1}get primitiveType(){return this._primitiveType}set primitiveType(t){this._primitiveType=t}get primitiveTypeList(){return this._primitiveTypeList}set primitiveTypeList(t){this._primitiveTypeList=t}get layerId(){return this._layerId}set layerId(t){this._layerId=t}get layerList(){return this._layerList}set layerList(t){this._layerList=t}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t}get defaultLineWidth(){return this._defaultLineWidth}get isKeepNetProfile(){return this._isKeepNetProfile}set isKeepNetProfile(t){this._isKeepNetProfile=t}get copyOperationType(){return this._copyOperationType}set copyOperationType(t){this._copyOperationType=t}get zoomDist(){return this._zoomDist}set zoomDist(t){this._zoomDist=t}get defaultZoomDist(){return this._defaultZoomDist}get zoomRatio(){return this._zoomRatio}set zoomRatio(t){this._zoomRatio=t}get defaultZoomRatio(){return this._defaultZoomRatio}get isRemoveSourceTarget(){return this._isRemoveSourceTarget}set isRemoveSourceTarget(t){this._isRemoveSourceTarget=t}reset(){this.primitiveType="Line",this.primitiveTypeList=[],this.lineWidth=1,this.isKeepNetProfile=!0,this.copyOperationType="ZoomIntByDist",this.zoomDist=1,this.zoomRatio=1,this.isRemoveSourceTarget=!1}toJSON(){return{primitiveType:this.primitiveType,primitiveTypeList:this.primitiveTypeList,layerId:this.layerId,layerList:this.layerList,lineWidth:this.lineWidth,isKeepNetProfile:this.isKeepNetProfile,copyOperationType:this.copyOperationType,zoomDist:this.zoomDist,zoomRatio:this.zoomRatio,isRemoveSourceTarget:this.isRemoveSourceTarget}}};var zo=class o extends fI{static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}constructor(){super(),this._copySpecialParams=new ipe,this._hasSettingResult=!1}get copySpecialParams(){return this._copySpecialParams}set copySpecialParams(t){this._copySpecialParams=t}get hasSettingResult(){return this._hasSettingResult}set hasSettingResult(t){this._hasSettingResult=t}createHeader(t){let e=this.createBaseHeader();return e.id=t,e.action=t,e.tabId=R.getInstance().tabId,e.unit=R.getInstance().unit,e}createBody(t=!1){let e={};return t&&this.copySpecialParams.reset(),e={...e,...this.copySpecialParams.toJSON()},e.lineWidth*=10,e.zoomDist*=10,e.lineWidth=+gn(e.lineWidth,3,!1),e.zoomDist=+gn(e.zoomDist,3,!1),e.zoomRatio=+gn(e.zoomRatio,6,!1),e}handleHeaderUpdate(t){}handleBodyUpdate(t,e){this.updateCommon(t,e),this.updateAttrParam(t,e),A.publish("flushService",""),A.publish("updateFrame","")}updateCommon(t,e){}updateAttrParam(t,e){let r=!1;this.copySpecialParams.primitiveType!==t.primitiveType&&(this.copySpecialParams.primitiveType=t.primitiveType,r=!0),this.copySpecialParams.layerId=t.layerId,this.copySpecialParams.lineWidth=t.lineWidth/10,this.copySpecialParams.isKeepNetProfile=t.isKeepNetProfile,this.copySpecialParams.copyOperationType=t.copyOperationType,this.copySpecialParams.zoomDist=+t.zoomDist/10,this.copySpecialParams.zoomRatio=+t.zoomRatio,this.copySpecialParams.isRemoveSourceTarget=t.isRemoveSourceTarget,this.copySpecialParams.zoomDist=isNaN(this.copySpecialParams.zoomDist)?1:this.copySpecialParams.zoomDist,this.copySpecialParams.zoomRatio=isNaN(this.copySpecialParams.zoomRatio)?1:this.copySpecialParams.zoomRatio,this.copySpecialParams.zoomDist=+gn(this.copySpecialParams.zoomDist,4,!1),this.copySpecialParams.lineWidth=+gn(this.copySpecialParams.lineWidth,4,!1),this.copySpecialParams.zoomRatio=+gn(this.copySpecialParams.zoomRatio,6,!1),this.copySpecialParams.zoomRatio<1e-6&&(this.copySpecialParams.zoomRatio=this.copySpecialParams.defaultZoomRatio),e.unit==="mm"&&(this.copySpecialParams.lineWidth<.0039&&(this.copySpecialParams.lineWidth=Bs.mm2mil(this.copySpecialParams.defaultLineWidth)),this.copySpecialParams.zoomDist<0&&(this.copySpecialParams.zoomDist=Bs.mm2mil(this.copySpecialParams.defaultZoomDist))),e.unit==="mil"&&(this.copySpecialParams.lineWidth<.01&&(this.copySpecialParams.lineWidth=this.copySpecialParams.defaultLineWidth),this.copySpecialParams.zoomDist<0&&(this.copySpecialParams.zoomDist=this.copySpecialParams.defaultZoomDist)),r&&(this.copySpecialParams.layerList=rpe(this.copySpecialParams.primitiveType),this.copySpecialParams.layerId=this.copySpecialParams.layerList[0].value),A.messageBus.publish("copySpecialParamUpdate",null)}};function Qxt(o){return jt.filterElement(Vr.getSelectInside(ll(o),{boxChoose:!1,isBBox:!0}),{boxChoose:!0})}function eRt(o){return jt.filterElement(Vr.getSelectContect(ll(o),{boxChoose:!0,isBBox:!0}),{boxChoose:!0})}function Kq(o,t,e){let r=new Set;if(e?r=Qxt(o):r=eRt(o),r=new Set(Vr.filterPartiton(Array.from(r))),zo.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"||zo.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist"){let i=tRt(t,Array.from(r));return new Set([i])}return r}function tRt(o,t){let e=o,r=o,i=Number.MAX_SAFE_INTEGER,n=null,s=null,a=null;for(let l=0;l<t.length;l++){let c=r_.getMinDistResultAboutDotAndElement(t[l],new M(e,e),"EDGE",zo.getInstance().copySpecialParams.layerId);c.minline&&i>=c.minDistValue&&(i=c.minDistValue,n=c.minline.start(),s=c.minline.end(),a=t[l])}return n&&s&&(o.x===s.x&&o.y===s.y?r=n:r=s),a}function npe(o){let t=bo.getInstance().getAllItem(),e=Number.MAX_SAFE_INTEGER;for(let r=0;r<t.length;r++)for(let i=0;i<o.length;i++){let n=r_.getMinDistResultAboutElementAndElement(t[r],o[i],"EDGE","EDGE",zo.getInstance().copySpecialParams.layerId,zo.getInstance().copySpecialParams.layerId);n.minline&&e>=n.minDistValue&&(e=n.minDistValue)}return e}function ope(o){let t=X0(ge.build2(o.getMathGraphics().primitives),0),e=0;return t.forEach(r=>{r.items.forEach(i=>{e+=i.area()})}),Math.abs(e)}function E5(o,t){let e=t.sub(o),r=ne.eq(e.x,0),i=ne.eq(e.y,0);return r&&i?S.ORIGIN:e.normalize()}var spe=class{constructor(t){this.start=null;this.end=null;this.pan=null;this.prev=null;this.next=null;this.valid=!0;this.visited=!1;this.primitive=t}updateValid(){if(this.start!=null)if(this.primitive instanceof M){let t=E5(this.start,this.end),e=this.primitive.direct,r=t.dot(e);ne.greatereq(r,0)?this.valid=!0:this.valid=!1}else{if(this.pan==null){this.valid=!1;return}let t=E5(this.start,this.pan.start()),e=Et(this.primitive,this.primitive.start()),r=t.dot(e);if(ne.greatereq(r,0)){let i=Et(this.primitive),s=E5(this.pan.end(),this.end).dot(i);ne.greatereq(s,0)?this.valid=!0:this.valid=!1}else this.valid=!1}}panDis(t){if(!(this.start==null||this.primitive==null))if(this.primitive instanceof M)this.pan=new M(this.start,this.end);else{if(ne.lesseq(this.primitive.rx+t,0))return;this.pan=this.primitive.panDistance(t);let e=ne.eq(this.start.distance1(this.pan.center),this.pan.rx)&&$f(this.pan,this.start),r=ne.eq(this.end.distance1(this.pan.center),this.pan.rx)&&$f(this.pan,this.end);e&&(this.pan=Zl.modifyStart(this.start,this.pan)),r&&(this.pan=Zl.modifyEnd(this.end,this.pan))}}};function rRt(o,t){let e=E5(o,t.start()),r=Et(t,t.start());return ne.less(e.dot(r),0)}var ape=class{extends(t,e){nh(t)&&(t=t.reverse());let r=this.getPts(t),i=r.length;if(i>1){for(let h=0;h<i;h++)r[h].start=this.getPoint4Pts(r[h],e),r[h].prev.end=r[h].start;for(let h of r)h.panDis(e),h.updateValid();for(let h of r)if(!h.valid&&h.primitive instanceof q&&h.pan!=null){let u=h.prev;if(!rRt(h.start,h.pan))continue;for(;u!=h;){if(u.valid&&u.primitive instanceof q&&!u.pan.end().equals1(u.end)){let m=new M(u.pan.end(),u.end),g=this.getInters(m,h.pan);if(g!=null&&!g.equals1(h.start)&&(h.start=g,h.panDis(e),h.updateValid(),h.valid))break}let d=u.primitive,p=this.getPointPts(d,h.primitive,e);if(p!=null&&!p.equals1(h.start)&&(h.start=p,h.panDis(e),h.updateValid(),h.valid))break;if(u.valid&&u.primitive instanceof q&&!u.pan.start().equals1(u.start)){let m=new M(u.start,u.pan.start()),g=this.getInters(m,h.pan);if(g!=null&&!g.equals1(h.start)&&(h.start=g,h.panDis(e),h.updateValid(),h.valid))break}u=u.prev}}let n=new Array;e:for(let h of r)if(!h.visited)if(h.visited=!0,h.valid)n.push(h);else{let u=this.getPrev(h),d=this.getNext(h),p=r.indexOf(u),m=r.indexOf(d);if(u==null||d==null)continue;if(m-p==2||m==0&&p==i-2||m==1&&p==i-1){let g=u.primitive.start().equals1(d.primitive.end())?this.getInters4BBox1(u.pan,d.pan):this.getInters4BBox(u.pan,d.pan);if(g!=null)u.end=g,d.start=g;else{let y=r.indexOf(h);for(let b=y;b!=m;b=(b+1)%i){let P=r[b];P.visited=!0}}}else{let g=r.indexOf(h),y=u.pan,b=d.pan;for(let T=g;T!=m;T=(T+1)%i){let I=r[T];I.visited=!0;let C=I.primitive.panDistance(e),E=this.getInters(y,C);E!=null&&(y=Zl.modifyEnd(E,y),C instanceof q&&(I.start=E));let O=this.getInters(C,b);if(O!=null&&(b=Zl.modifyStart(O,b),C instanceof q&&(I.end=O)),I.panDis(e),I.updateValid(),I.valid){n.push(I);continue e}}let P=this.getInters(y,b);if(P!=null)u.end=P,d.start=P;else{let T=new spe(null);T.start=y.end(),T.end=b.start(),T.pan=new M(T.start,T.end),u.end=y.end(),d.start=b.start(),n.push(T)}}}for(let h of n)h.valid&&h.panDis(e);let s=new Array;for(let h of n)(h.primitive||h.pan)instanceof M?(h.pan=new M(h.start,h.end),s.push(h.pan)):(h.start.equals1(h.pan.start())||s.push(new M(h.start,h.pan.start())),s.push(h.pan),h.end.equals1(h.pan.end())||s.push(new M(h.pan.end(),h.end)));if(s.length==0)return[];let a=ge.build2(s).asClose();return new Ec().normalizeData([a],3).toPolylineGroups()}else{let s=r[0].primitive;if(s instanceof q){if(ne.lesseq(s.rx+e,0))return[];let a=s.panDistance(e);return ge.build2([a])}return t}}getPrev(t){if(!t.valid){let e=t.prev;for(;!e.valid&&e!=t;)e=e.prev;return e==t?null:e}return t}getNext(t){if(!t.valid){let e=t.next;for(;!e.valid&&e!=t;)e=e.next;return e==t?null:e}return t}getInters(t,e,r=!0){let i=Pt(t,e);if(i>0){let n=new Array;for(let s=0;s<i;s+=2){let a=new S(Ee[s],Ee[s+1]);n.push(a)}return r?(an(n,t),n[0]):(an(n,e),n[n.length-1])}return null}getInters1(t,e){let r=Pt(t,e);if(r>0){let i=new Array;for(let n=0;n<r;n+=2){let s=new S(Ee[n],Ee[n+1]);i.push(s)}return an(i,t),i[i.length-1]}return null}getInters4BBox(t,e,r=!0){let i=new _e;i.ext1(t.bbox()).ext1(e.bbox());let n=i.build(),s=n.width()+n.height(),a=this.getExtendLine(t,s,!0),l=this.getExtendLine(e,s,!1);return this.getInters(a,l,r)}getInters4BBox1(t,e){let r=new _e;r.ext1(t.bbox()).ext1(e.bbox());let i=r.build(),n=i.width()+i.height(),s=this.getExtendLine(t,n,!0),a=this.getExtendLine(e,n,!1);return this.getInters1(s,a)}getExtendLine(t,e,r){return t instanceof M?r?new M(t.start(),t.end().add(t.direct.mul(e))):new M(t.start().sub(t.direct.mul(e)),t.end()):t}getPts(t){let e=new Array,r=null;for(let i of t.primitives)if(ud(i)>1e-5&&(i instanceof M||i instanceof q)){let s=new spe(i);r!=null&&(s.prev=r,r.next=s),r=s,e.push(s)}return e.length>0&&(e[0].prev=e[e.length-1],e[e.length-1].next=e[0]),e}getPoint4Pts(t,e){let r=t.prev.primitive,i=t.primitive;if(r instanceof M&&i instanceof M)return this.extend4Lines(r,i,e);if(r instanceof M&&i instanceof q)return this.extend4LineArc(r,i,e);if(r instanceof q&&i instanceof M)return this.extend4ArcLine(r,i,e);if(r instanceof q&&i instanceof q)return this.extend4Arcs(r,i,e);throw new Error("not support!!!")}getPointPts(t,e,r){if(t instanceof M&&e instanceof M)return this.extend4Lines(t,e,r);if(t instanceof M&&e instanceof q)return this.extend4LineArc(t,e,r);if(t instanceof q&&e instanceof M)return this.extend4ArcLine(t,e,r);if(t instanceof q&&e instanceof q)return this.extend4Arcs(t,e,r);throw new Error("not support!!!")}getPoint(t,e,r,i){let n=e.add(r);if(ne.eq(n.x,0)&&ne.eq(n.y,0))return t.add(new S(-r.y,r.x).mul(i));n=n.normalize();let s=r.cross(n);if(ne.eq(s,0))return t;let a=i/s;return t.add(n.mul(a))}extend4Lines(t,e,r){let i=t.direct.mul(-1),n=e.direct;return this.getPoint(t.end(),i,n,r)}extend4LineArc(t,e,r){let i=t.direct.mul(-1),n=Et(e,e.start()),s=this.getPoint(t.end(),i,n,r),a=e.panDistance(r),l=E5(s,a.start()),c=Et(a,a.start()),h=l.dot(c),u=s.sub(t.end()).normalize();if(ne.less(h,0))if(t.start().equals1(e.end())){let d=this.getInters4BBox1(t.panDistance(r),a);if(d!=null)return d}else{if(ne.less(u.dot(n),0)){let p=t.panDistance(r),m=e.panDistance(r),g=Pt(p,m);if(g>0){let y=new Array;for(let b=0;b<g;b+=2){let P=new S(Ee[b],Ee[b+1]);y.push(P)}return an(y,m),y[0]}else{let y=new _e().ext1(p.bbox()).ext1(m.bbox()).build1(),b=y.width()+y.height(),P=i.mul(b),T=new M(p.start().sub(P),p.end().add(P)),I=Pt(T,m);if(I>0){let C=new Array;for(let E=0;E<I;E+=2){let O=new S(Ee[E],Ee[E+1]);C.push(O)}return an(C,m),C[0]}}}let d=this.getInters4BBox(t.panDistance(r),a);if(d!=null)return d}return s}extend4ArcLine(t,e,r){let i=Et(t).mul(-1),n=e.direct,s=this.getPoint(t.end(),i,n,r),a=s.sub(t.end()).normalize(),l=t.panDistance(r),c=E5(l.end(),s),h=Et(l),u=c.dot(h);if(ne.less(u,0))if(t.start().equals1(e.end())){let d=this.getInters4BBox1(l,e.panDistance(r));if(d!=null)return d}else{if(ne.less(a.dot(n),0)){let p=e.panDistance(r),m=t.panDistance(r),g=Pt(p,m);if(g>0){let y=new Array;for(let b=0;b<g;b+=2){let P=new S(Ee[b],Ee[b+1]);y.push(P)}return an(y,p),y[0]}else{let y=new _e().ext1(p.bbox()).ext1(m.bbox()).build1(),b=y.width()+y.height(),P=n.mul(b),T=new M(p.start().sub(P),p.end().add(P)),I=Pt(T,m);if(I>0){let C=new Array;for(let E=0;E<I;E+=2){let O=new S(Ee[E],Ee[E+1]);C.push(O)}return C.sort((E,O)=>E.distance2(p.start())-O.distance2(p.start())),C[0]}}}let d=this.getInters4BBox(l,$f(l,s)?Zl.modifyStart(s,e.panDistance(r)):e.panDistance(r),!1);if(d!=null)return d}return s}extend4Arcs(t,e,r){let i=Et(t).mul(-1),n=Et(e,e.start()),s=this.getPoint(t.end(),i,n,r),a=t.panDistance(r),l=E5(a.end(),s),c=Et(a),h=l.dot(c);if(ne.less(h,0)){let u=this.getStart(a,e.panDistance(r));if(u!=null)return u}return s}getStart(t,e){let r=Pt(t,e);if(r>0){let i=new Array;for(let n=0;n<r;n+=2){let s=new S(Ee[n],Ee[n+1]);i.push(s)}return an(i,e),i[0]}return null}};var EOe=["Board Outline","Slot Region","Copper Region","Fill Region","Prohibited Region","Constraint Region","TearDrop","LINESUTUREVIA","3D Shell - Outline","3D Shell - Side Slot Region","3D Shell - Top Slot Region","3D Shell - Top/Bottom Entity","3D Shell - Side Entity","3D Shell - Screw Pillar","FPC Stiffener"];function iRt(o,t){if(o instanceof rr){if((zo.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"||zo.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist")&&ope(o)<.1)return o.remove(),Xt.delete(o),t.ret=-1,t.msg="The scaled primitive is too small and cannot be generated",t.msgType="error",!1;if(Mt.checkIsCanEditByItem(o)){if(npe([o])<=1e-8)return o.remove(),Xt.delete(o),t.ret=-1,t.msg="The newly generated primitive exceeds the partition range and cannot be generated",t.msgType="error",!1}else return o.remove(),Xt.delete(o),t.ret=-1,t.msg="The newly generated primitive exceeds the partition range and cannot be generated",t.msgType="error",!1;return!0}else if(o instanceof Pr){if((zo.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"||zo.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist")&&ope(o)<.1)return o.remove(),Kt.delete(o),t.ret=-1,t.msg="The scaled primitive is too small and cannot be generated",t.msgType="error",!1;if(Mt.checkIsCanEditByItem(o)){if(npe([o])<=1e-8)return o.remove(),Kt.delete(o),t.ret=-1,t.msg="The newly generated primitive exceeds the partition range and cannot be generated",t.msgType="error",!1}else return o.remove(),Kt.delete(o),t.ret=-1,t.msg="The newly generated primitive exceeds the partition range and cannot be generated",t.msgType="error",!1;return!0}else if(o instanceof lt){if((zo.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"||zo.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist")&&ope(o)<.1)return o.remove(),pt.delete(o),t.ret=-1,t.msg="The scaled primitive is too small and cannot be generated",t.msgType="error",!1;if(Mt.checkIsCanEditByItem(o)){if(npe([o])<=1e-8)return o.remove(),pt.delete(o),t.ret=-1,t.msg="The newly generated primitive exceeds the partition range and cannot be generated",t.msgType="error",!1}else return o.remove(),pt.delete(o),t.ret=-1,t.msg="The newly generated primitive exceeds the partition range and cannot be generated",t.msgType="error",!1;return!0}return!1}function nRt(o){o.ret===0&&(zo.getInstance().copySpecialParams.isRemoveSourceTarget&&o.refItems.forEach(t=>{o.rmCommands.push(Ce.dispatch(t,"delete"))}),o.newItems.forEach(t=>{o.addCommands.push(Ce.dispatch(t,"add"))}))}function uXe(o,t,e){let r={ret:0,msg:"",msgType:"info",elements:new Set},i=null;o==="zoomDist"&&(i=new ape);let n=[];for(let c of t){let h=o==="zoomDist"?oRt(c,i):sRt(c,e);n.push(h)}let s=0,a="",l="";e:for(let c of n){if(c.ret!==0){s=c.ret,a=c.msg,l=c.msgType;for(let h of n){h.ret=s,h.msg=a,h.msgType=l;for(let u of h.newItems)SOe(u);h.newItems=[]}break e}for(let h of c.newItems)if(iRt(h,c)===!1){s=c.ret,a=c.msg,l=c.msgType;for(let d of n){d.ret=s,d.msg=a,d.msgType=l;for(let p of d.newItems)SOe(p);d.newItems=[]}break e}}if(s===0){r.msg="Copy Success!";let c=new De("draw copyspecial"),h=zo.getInstance().copySpecialParams.isRemoveSourceTarget,u=zo.getInstance().copySpecialParams.primitiveType=="FPC Stiffener",d=!1;for(let p of n)u&&p.newItems.some(m=>m.type=="FPC Stiffener")&&(d=!0),nRt(p),h&&p.refItems.forEach(m=>{SOe(m)}),p.addCommands.forEach(m=>{c.addCommand(m)}),p.rmCommands.forEach(m=>{c.addCommand(m)}),p.newItems.forEach(m=>{r.elements.add(m)}),h||p.refItems.forEach(m=>{r.elements.add(m)}),qe.executeCommand(c),A.publish("autoFill","");return d&&A.publish("checkOpenStiffenerLayer",{notShowTip:!0}),r}for(let c of n)for(let h of c.refItems)r.elements.add(h);return r.ret=s,r.msg=a,r.msgType=l,r}function oRt(o,t){let e={ret:0,msg:"",msgType:"info",refItems:[],newItems:[],addCommands:[],rmCommands:[]},r=zo.getInstance().copySpecialParams.isKeepNetProfile&&o.net||"",i=zo.getInstance().copySpecialParams.primitiveType,n=+zo.getInstance().copySpecialParams.layerId,s=Pu(-1,o.type)||1;if(s=zo.getInstance().copySpecialParams.primitiveType==="Board Outline"||zo.getInstance().copySpecialParams.primitiveType==="Line"?zo.getInstance().copySpecialParams.lineWidth:s,zo.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist"||zo.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"){let a=zo.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist"?zo.getInstance().copySpecialParams.zoomDist:-zo.getInstance().copySpecialParams.zoomDist;if(o instanceof rr){let l=new S(-1,1).rotate(S.ORIGIN,o.rotation).normalize(),c=a*(2/Math.sqrt(2)),h=o.start.add(l.mul(c)),u=o.width+a*2,d=o.height+a*2;if(u<=0||d<=0)return e.ret=-1,e.msg="The scaled primitive is too small and cannot be generated",e.msgType="error",e;let p=Xt.addRect(i,n,h,u,d,r,!1,s,o.rotation,o.cornerRadius);p.net=r,p.partition=o.partition,e.refItems.push(o),e.newItems.push(p)}else if(o instanceof Pr){let l=o.radius+a;if(l<=0)return e.ret=-1,e.msg="The scaled primitive is too small and cannot be generated",e.msgType="error",e;let c=Kt.addCircle(i,n,o.center,l,s,!1,r);c.net=r,c.partition=o.partition,e.refItems.push(o),e.newItems.push(c)}else if(o instanceof lt){let l=o.getMathGraphics(),c=l instanceof Bt?l.getOutMostPolyline():l;if(o.type==="Line"&&!Qh(l.primitives)&&(zo.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"||zo.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist"))return e.ret=-1,e.msg="The selected element is not closed and cannot be copied",e.msgType="error",e;let h=t.extends(c,a);if(e.refItems.push(o),h instanceof Array){if(h.length<=0)return e.ret=-1,e.msg="The scaled primitive is too small and cannot be generated",e.msgType="error",e;for(let m=0;m<h.length;m++)hXe(o,[h[m]],n,i,s,r,e);return e}let u=ge.build2(h.primitives);u=u.asClose();let d=Nz(FO,[u]),p=[];for(let m of d)xe.addAll(p,m.items);hXe(o,d,n,i,s,r,e)}}return e}function hXe(o,t,e,r,i,n,s){if(Er(t,(c,h)=>h.bbox().area()-c.bbox().area(),0,t.length),t.length<=0||t[0].items.length<=0)return s.ret=-1,s.msg="",s;let a=t[0].items,l=new Po;for(let c=0;c<a.length;c++){let h=a[c].primitives,u=l.ptsToShapes(h,e,o.strokeWidth),d=nm(u);if(d.length>0){let p=pt.addPolygon(r,e,[d],i,n,!1);p.net=n,p.partition=o.partition,EOe.includes(r)&&p.checkClose(),s.newItems.push(p)}}return s}function sRt(o,t){let e={ret:0,msg:"",msgType:"info",refItems:[],newItems:[],addCommands:[],rmCommands:[]},r=zo.getInstance().copySpecialParams.isKeepNetProfile&&o.net||"",i=zo.getInstance().copySpecialParams.zoomRatio,n=Qe.scale(zo.getInstance().copySpecialParams.zoomRatio).setOrigin1(t),s=zo.getInstance().copySpecialParams.primitiveType,a=+zo.getInstance().copySpecialParams.layerId,l=Pu(-1,o.type)||1;if(l=zo.getInstance().copySpecialParams.primitiveType==="Board Outline"||zo.getInstance().copySpecialParams.primitiveType==="Line"?zo.getInstance().copySpecialParams.lineWidth:l,o instanceof rr){let c=o.width*i,h=o.height*i,u=o.radius*i,d=o.start.multiply3(n),p=Xt.addRect(s,a,d,c,h,r,o.locked,l,o.rotation,u);p.net=r,p.partition=o.partition,e.refItems.push(o),e.newItems.push(p)}else if(o instanceof Pr){let c=o.center.multiply3(n),h=o.radius*i,u=Kt.addCircle(s,a,c,h,l,!1,r);u.net=r,u.partition=o.partition,e.refItems.push(o),e.newItems.push(u)}else if(o instanceof lt){let c=[];if(o.iteratorChildren(y=>{c.push(y)}),c.length===1&&c[0]instanceof mt&&EOe.includes(s))return e.ret=-1,e.msg="The selected element is not closed and cannot be copied",e.msgType="error",e;let h=o.getMathGraphics(),u=[];h.primitives.forEach(y=>{let b=y.multiply3(n);u.push(b)});let p=new Po().ptsToShapes(u,a,o.strokeWidth),m=nm(p),g=pt.addPolygon(s,a,[m],l,r,!1);g.net=r,g.partition=o.partition,EOe.includes(s)&&g.checkClose(),e.refItems.push(o),e.newItems.push(g)}return e}function SOe(o){o&&(o instanceof rr?(Xt.delete(o),o.remove()):o instanceof Pr?(Kt.delete(o),o.remove()):o instanceof lt&&(pt.delete(o),o.remove()))}function dXe(o){let t=new qt;return t.add("CANCEL",!0),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t.result}var O5=class O5{static getInstance(){return O5.instance==null&&(O5.instance=new O5),O5.instance}constructor(){this._inRunning=!1}get isRunning(){return this._inRunning}set isRunning(t){this._inRunning=t}};O5.instance=null;var A5=O5,lpe=class extends ni{constructor(t){super(),this.drawing=!0,this.isHoldPCBAttrPanel=!0,this.selections=[],this.mouseRightDownPageX=-1,this.mouseRightDownPageY=-1,this.isMouseLeftDown=!1,this.selectItems=new Set,this.hoverItems=new Set,this.copyOperationType=zo.getInstance().copySpecialParams.copyOperationType,this.isWaittingSelectRefPositionStatus=!1,this.accessPrimitives=zo.getInstance().copySpecialParams.primitiveTypeList.map(e=>e.value),Ut.update(fi.getInstance(),"Please select or box select the object to copy"),this.initSketcherAttrPanel(),this.cancelHightlightAllItems(),this.cancelAllSelectedMessageHandler=A.messageBus.subscribe("copySpecialParamUpdate",()=>{this.copyOperationType==="ZoomByRatio"&&(zo.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"||zo.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist")&&(this.isWaittingSelectRefPositionStatus=!1,this.cancelHightlightHoverItems(),this.hoverItems.clear(),this.selectItems.clear(),Ut.update(fi.getInstance(),"Please select or box select the object to copy")),this.copyOperationType=zo.getInstance().copySpecialParams.copyOperationType}),A5.getInstance().isRunning=!0}getCanUndo(){return!0}onKeyDown(t){di.setArea(["Undo","Redo"]);let e=di.getScene(),r=tr.getAction(e,t);switch(r||(r=tr.getAction(4,t)),r){case"Cancel":this.cancel();break;case"Undo":{A.publish("undo","");break}case"Redo":{A.publish("redo","");break}}A.publish("updateFrame","")}onMouseLeftDown(t){this.isMouseLeftDown=!0,this.realSceneLeftDownPageX=t.realSceneX,this.realSceneLeftDownPageY=t.realSceneY,this.clearSelectBox(),ze.clearSelect(),this.start()}onMouseLeftUp(t){if(this.isWaittingSelectRefPositionStatus)this.selectItems.size&&this.doCopy(t.sceneX,t.sceneY);else if(this.selections.length>0){this.cancelHightlightHoverItems();let e=new _e().ext6(t.realSceneX,t.realSceneY).ext6(this.realSceneLeftDownPageX,this.realSceneLeftDownPageY).build1(),r=new Set;this.realSceneLeftDownPageX>t.realSceneX?It.getInstance().flip?r=Kq(e,new S(this.realSceneLeftDownPageX,this.realSceneLeftDownPageY),!0):r=Kq(e,new S(this.realSceneLeftDownPageX,this.realSceneLeftDownPageY),!1):It.getInstance().flip?r=Kq(e,new S(this.realSceneLeftDownPageX,this.realSceneLeftDownPageY),!1):r=Kq(e,new S(this.realSceneLeftDownPageX,this.realSceneLeftDownPageY),!0),this.updateSelectItems(r,t.sceneX,t.sceneY,"RangeSelection"),this.updateHoverItems(this.selectItems,t.sceneX,t.sceneY,"RangeSelection"),this.hightlightHoverItems(),t.setIsBoxSelection(!0),this.selectItems.size>0&&(zo.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"||zo.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist"?this.selectItems.size&&this.doCopy(t.sceneX,t.sceneY):(Ut.update(t,"Please select a reference point"),this.isWaittingSelectRefPositionStatus=!0))}else{let e=new ht(t.realSceneX,t.realSceneX,t.realSceneY,t.realSceneY),r=kt.search(e,(i,n)=>n==null?!1:Kp.includes(n)||n=="Copper",!1);this.updateSelectItems(r.getResult([...Kp,"Copper"]),t.sceneX,t.sceneY,"SingleDotSelection"),this.selectItems.size&&(zo.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"||zo.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist"?this.doCopy(t.sceneX,t.sceneY):(Ut.update(t,"Please select a reference point"),this.isWaittingSelectRefPositionStatus=!0))}this.clearSelectBox(),this.isMouseLeftDown=!1,this.realSceneLeftDownPageX=-1,this.realSceneLeftDownPageY=-1,A.publish("updateFrame","")}onMouseRightDown(t){this.mouseRightDownPageX=t.mouseX,this.mouseRightDownPageY=t.mouseY}onMouseRightUp(t){if(!(t.mouseX!==this.mouseRightDownPageX||t.mouseY!==this.mouseRightDownPageY)){if(le.pcbConfig.endDrawing==="ctrl+rightClick"){if(t.ctrlKey){t.clearCrossFlag(),this.cancel();return}this.rightClickMenuData(t);return}if(t.ctrlKey){this.rightClickMenuData(t);return}t.clearCrossFlag(),this.cancel(),this.mouseRightDownPageX=-1,this.mouseRightDownPageY=-1}}onMouseWheel(t){}onMouseMove(t){if(this.isMouseLeftDown)this.updateSelectBox(t.realSceneX,t.realSceneY),this.cancelHightlightHoverItems(),this.hoverItems.clear(),this.selectItems.clear(),this.isWaittingSelectRefPositionStatus=!1;else if(this.selectItems.size<=0){this.cancelHightlightHoverItems();let e=new ht(t.realSceneX,t.realSceneX,t.realSceneY,t.realSceneY),r=kt.search(e,(i,n)=>n==null?!1:Kp.includes(n)||n=="Copper",!1);this.updateHoverItems(r.getResult([...Kp,"Copper"]),t.sceneX,t.sceneY,"SingleDotSelection")}this.isWaittingSelectRefPositionStatus?Ut.update(t,"Please select a reference point"):Ut.update(t,"Please select or box select the object to copy"),this.hightlightHoverItems()}interrupt(){tn.destroy(),this.end()}cancel(){Ut.cancel(),this.interrupt(),this.cancelHightlightHoverItems(),this.selectItems.clear(),this.hoverItems.clear(),this.isWaittingSelectRefPositionStatus=!1,A.publish("tool","dropdrag"),A.publish("destoryCanvasCross",null),A.publish("ExitSketcherAttrView",{type:"COPY_SPECIAL"}),this.cancelAllSelectedMessageHandler&&this.cancelAllSelectedMessageHandler.cancel(),A5.getInstance().isRunning=!1}rightClickMenuData(t){if(this.isMouseLeftDown)return;let e={state:"show",left:t.mouseX,top:t.mouseY,filter:dXe(t.adsorb)};$t.getInstance().menuData(e,this),this.drawing=!1,hu.getInstance().isOpenedContextmenu=!0}parse(t){let e=t.cmdKey;switch(this.drawing=!0,e.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}hu.getInstance().isOpenedContextmenu=!1,A.publish("updateFrame","")}initSketcherAttrPanel(){A.publish("FlushSketcherAttrView",{type:"COPY_SPECIAL",isInitAllParams:!0})}updateSelectItems(t,e,r,i){this.selectItems.clear();let n=new Set;t.forEach(s=>{if(s===null||typeof s>"u"||s.isVisible===!1)return;let a=Pe.getLayer(s.layerId);if(!(!a||a.visible===!1)&&Mt.checkIsCanEditByItem(s)){if(s instanceof Jr){let l=s.getParent();l&&n.add(l);return}if(s instanceof He){if(s.type==="Copper Region"){if(i==="RangeSelection"){n.add(s);return}s.isSelect(e,r)&&n.add(s);return}if(s.type==="Line"||s.type==="Board Outline"||s.type==="3D Shell - Outline"){if(i==="RangeSelection"){n.add(s);return}s.isSelect(e,r)&&n.add(s);return}this.accessPrimitives.indexOf(s.type)<=-1||n.add(s)}}}),this.selectItems=n}updateHoverItems(t,e,r,i){this.hoverItems.clear();let n=new Set;t.forEach(s=>{if(s===null||typeof s>"u"||s.isVisible===!1)return;let a=Pe.getLayer(s.layerId);if(!(!a||a.visible===!1)&&Mt.checkIsCanEditByItem(s)){if(s instanceof Jr){n.add(s);let l=s.getParent();l&&n.add(l);return}if(s instanceof He){if(s.type==="Copper Region"){s.isSelect(e,r)&&(n.add(s),s.getCopperResult()&&n.add(s));return}if(s.type==="Line"||s.type==="Board Outline"||s.type==="3D Shell - Outline"){if(i==="RangeSelection"){n.add(s);return}s.isSelect(e,r)&&n.add(s);return}this.accessPrimitives.indexOf(s.type)<=-1||n.add(s)}}}),this.hoverItems=n}hightlightHoverItems(){this.hoverItems.forEach(t=>{t.isVisible!==!1&&t.click()})}cancelHightlightHoverItems(){this.hoverItems.forEach(t=>{t.isVisible!==!1&&t.visible()})}cancelHightlightAllItems(){Kc().forEach(t=>{t.isVisible!==!1&&t.visible()})}doCopy(t,e){let r=zo.getInstance().copySpecialParams.copyOperationType==="ZoomIntByDist"||zo.getInstance().copySpecialParams.copyOperationType==="ZoomOutByDist"?"zoomDist":"zoomRatio";if(r==="zoomDist"){this.sortSelectedItems();let n=Array.from(this.selectItems)[0];this.selectItems.clear(),this.selectItems.add(n)}let i=uXe(r,this.selectItems,new S(t,e));A.publish("ui/toastMsg",{type:i.msgType,msg:i.msg,timer:2},Q()),this.cancelHightlightHoverItems(),this.selectItems.clear(),this.hoverItems.clear(),ze.setSelect(i.elements,!1),this.isWaittingSelectRefPositionStatus=!1,Ut.update(fi.getInstance(),"Please select or box select the object to copy"),this.end()}updateSelectBox(t,e){let r=le.themeConfig.canvasTheme,i=r.isSolidLine(r.selectBoxLineStyle),n=r.selectBoxColor;if(this.selections.length>0)this.selections[0].start=new S(this.realSceneLeftDownPageX,this.realSceneLeftDownPageY),this.selections[0].end=new S(t,this.realSceneLeftDownPageY),this.selections[1].start=new S(t,this.realSceneLeftDownPageY),this.selections[1].end=new S(t,e),this.selections[2].start=new S(t,e),this.selections[2].end=new S(this.realSceneLeftDownPageX,e),this.selections[3].start=new S(this.realSceneLeftDownPageX,e),this.selections[3].end=new S(this.realSceneLeftDownPageX,this.realSceneLeftDownPageY);else{let s=new cr(1002,new S(this.realSceneLeftDownPageX,this.realSceneLeftDownPageY),new S(t,this.realSceneLeftDownPageY),i,n),a=new cr(1002,new S(t,this.realSceneLeftDownPageY),new S(t,e),i,n),l=new cr(1002,new S(t,e),new S(this.realSceneLeftDownPageX,e),i,n),c=new cr(1002,new S(this.realSceneLeftDownPageX,e),new S(this.realSceneLeftDownPageX,this.realSceneLeftDownPageY),i,n);this.selections.push(s),this.selections.push(a),this.selections.push(l),this.selections.push(c)}}clearSelectBox(){for(let t of this.selections)t.remove();this.selections.length=0}sortSelectedItems(){let t=[],e=[];for(let r of this.selectItems){if(r.layerId===Pe.getActiveLayerID()){t.push(r);continue}e.push(r)}this.selectItems=new Set([].concat(t,e))}};function pXe(o){let t=new qt;return t.add("CANCEL"),t.add("toggleAdsorb",!1,o),t.add("ADSORBENT_CONFIG"),t.result}var Zq=class extends Dg{constructor(){super();this.mouseLeftX=0;this.mouseLeftY=0;this.selections=new Array;this.items=new Set;this.drawing=!0,Ut.update(fi.getInstance(),"Please click or select the object you want to cross probe")}onKeyDown(e){let r=tr.getAction(3,e);switch(r==null&&(r=tr.getAction(4,e)),r){case"Cancel":this.cancel();break;case"Finish":case"place":this.onEnterPlace(e);return}}onMouseLeftDown(e){this.mouseLeftX=e.realSceneX,this.mouseLeftY=e.realSceneY,A.publish("clearSelect",""),this.start()}onMouseMove(e){let r=e.realSceneX,i=e.realSceneY;e.hovering=!0,e.hover(),e.leftDown&&this.updateSelectBox(r,i),this.drawing&&Ut.update(e,"Please click or select the object you want to cross probe")}async onMouseLeftUp(e){let r=e.realSceneX,i=e.realSceneY;if(R.getInstance().isactive||await A.windowBridge.rpcCall("setTabActive",[R.getInstance().tabId],Q()),this.selections.length>0){let n=new _e().ext6(r,i).ext6(this.mouseLeftX,this.mouseLeftY).build1();this.mouseLeftX>r?It.getInstance().flip?this.boxSelect(n,!0,e.ctrlKey):this.boxSelect(n,!1,e.ctrlKey):It.getInstance().flip?this.boxSelect(n,!1,e.ctrlKey):this.boxSelect(n,!0,e.ctrlKey),this.clearSelectBox(),e.setIsBoxSelection(!0)}else{let n=Vr.pointSelect(r,i);n=Array.from(jt.filter(n)),this.select(n,e.ctrlKey)}A.publish("select",this.items),pD.notifySchToCrossProbe(!0),this.end()}async onMouseRightDown(e){R.getInstance().isactive||await A.windowBridge.rpcCall("setTabActive",[R.getInstance().tabId],Q()),e.openMenu=!0}onMouseRightUp(e){if(e.openMenu){if(le.pcbConfig.endDrawing=="ctrl+rightClick"){if(!e.ctrlKey){this.rightClickMenuData(e);return}}else if(e.ctrlKey){this.rightClickMenuData(e);return}this.cancel()}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:pXe(e.adsorb)};$t.getInstance().menuData(r,this),this.drawing=!1}select(e,r){if(r)for(let i of e)this.items.has(i)?(i.visible(),this.items.delete(i)):(i.click(),this.items.add(i));else{this.items.forEach(i=>{i.visible(),this.items.delete(i)}),ze.clearSelect();for(let i of e)i.click(),this.items.add(i)}}boxSelect(e,r,i){let n=new Array;r?n=this.leftToRight(e):n=this.rightToLeft(e),n=Vr.filterPartiton(n),this.select(n,i)}clearSelectBox(){for(let e of this.selections)e.remove();this.selections.length=0}updateSelectBox(e,r){let i=le.themeConfig.canvasTheme,n=i.isSolidLine(i.selectBoxLineStyle),s=i.selectBoxColor;if(this.selections.length>0)this.selections[0].start=new S(this.mouseLeftX,this.mouseLeftY),this.selections[0].end=new S(e,this.mouseLeftY),this.selections[1].start=new S(e,this.mouseLeftY),this.selections[1].end=new S(e,r),this.selections[2].start=new S(e,r),this.selections[2].end=new S(this.mouseLeftX,r),this.selections[3].start=new S(this.mouseLeftX,r),this.selections[3].end=new S(this.mouseLeftX,this.mouseLeftY);else{let a=new cr(1002,new S(this.mouseLeftX,this.mouseLeftY),new S(e,this.mouseLeftY),n,s),l=new cr(1002,new S(e,this.mouseLeftY),new S(e,r),n,s),c=new cr(1002,new S(e,r),new S(this.mouseLeftX,r),n,s),h=new cr(1002,new S(this.mouseLeftX,r),new S(this.mouseLeftX,this.mouseLeftY),n,s);this.selections.push(a),this.selections.push(l),this.selections.push(c),this.selections.push(h)}}leftToRight(e){let r=jt.filterElement(Vr.getSelectInside(ll(e),{boxChoose:!1,isBBox:!0}),{boxChoose:!0});return Array.from(r)}rightToLeft(e){let r=jt.filterElement(Vr.getSelectContect(ll(e),{boxChoose:!0,isBBox:!0}),{boxChoose:!0});return US(r)}parse(e){switch(this.drawing=!0,e.cmdKey.split(":")[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break}A.publish("updateFrame","")}interrupt(){this.end(),this.drawing=!1}cancel(){this.interrupt(),A.publish("tool","dropdrag")}};var cpe=class{constructor(t){this.tool=t,this.isHoldPCBAttrPanel=!1,A.subscribe("tool",this.update.bind(this)),A.subscribe("place_part(pcbtext)",this.placeText.bind(this)),A.subscribe("editPadShape",this.toggleEditPad.bind(this)),A.subscribe("redrawPolygonPad",this.toggleRedrawPad.bind(this)),A.subscribe("redrawPolygon",this.toggleRedraw.bind(this)),A.subscribe("DrawImage",this.drawImage.bind(this)),A.subscribe("DrawTrueColorPicture",this.drawTrueColorPicture.bind(this)),A.subscribe("toggle",this.toggle.bind(this)),A.subscribe("resetToolLastCmd",this.resetLastCmd.bind(this)),A.subscribe("userCancelCurrentCommand",this.receiveUserCommand.bind(this)),this.initDropDrag()}initDropDrag(){this.tool.setNextTool(new Vc),$n.setTool(ze),xo.setTool(ze),di.setNonSelect(),ze.dragging=!1,di.dropDrag=!0,this.lastCmd="dropdrag"}receiveUserCommand(t){t.command&&A.publish("tool","dropdrag")}resetLastCmd(t){this.lastCmd=t}openCopperInterruptDialog(t){t!=="dropdrag"&&PG("pcb-copper-manager")&&A.publish("pcbdialogModify",{dialogType:"pcb-copper-manager",action:"saveAndCloseCopperDialog"})}update(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;if(R.getInstance().isReadOnlyMode)switch(t){case"dropdrag":case"MeasureDistance":case"copySpecial":case"rectangleOutside":case"rectangleInside":case"polygonInside":case"polygonOutside":case"lineTouched":case"connectedCopper":case"continuousSelection":case"boxselect":case"draw(annotation)":case"COPY":case"crossProbeTool":break;default:return}if(this.lastCmd===t)return;On.getInstance().allowPull=!0,we.drawing=!1,Ut.cancel(),this.tool.clearClickPos(),this.openCopperInterruptDialog(t),this.lastCmd==="placeComponent"&&t==="dropdrag"&&A.windowBridge.publish("openPlaceClosedBottomBar",null,Q()),A.publish("clearDimension",""),this.lastCmd=t,we.setCommand(t);let e=ze.getSelects(),r=Array.from(ze.getComponents());gr.model=3,Ua.addTool(null),$n.setTool(null),xo.setTool(null),pf.clear(),Ur.clearDrawTool(),uu.setTool(null),this.tool.clearCrossFlag();let i=this.tool.getNextTool();if(i instanceof Vc&&i.clear(),i instanceof Zq&&i.drawing&&t==="dropdrag"){this.lastCmd="crossProbeTool";return}switch((this.needClearStatus(t)||i!=null&&i instanceof Oo&&i.drawing)&&(this.tool.interrupt(),di.setNonSelect()),di.setDraw(),di.dropDrag=!1,at.destroy(),bh.clearSketcherAttrView(),t){case"reuseLayoutRoute":{let n=new UD(r);this.tool.setNextTool(n);break}case"createArrayDistributionTool":case"createArrayTool":{let n=new vde(t,e);this.tool.setNextTool(n);break}case"draw(origin)":{let n=new DG;n.drawing=!0,di.setPlace(),this.tool.setNextTool(n);break}case"draw(track)":{di.setArea(["decrease_routing_width","increase_routing_width"]);let s=ds.getInstance("Single wiring").doubleClickItem,a=new vo("Single wiring"),l=a.getShiftStartControl();s&&l&&(this.tool.lastClickX=l.x,this.tool.lastClickY=l.y),a.drawing=!0,we.drawing=!0,this.tool.setNextTool(a),this.isHoldPCBAttrPanel=a.isHoldPCBAttrPanel;break}case"draw(difftrack)":{di.setArea(["changeDiffPairFanOutMode"]);let n=new vo("Differential pair wiring");n.drawing=!0,we.drawing=!0,this.tool.setNextTool(n),this.isHoldPCBAttrPanel=n.isHoldPCBAttrPanel;break}case"draw(multiTrack)":{di.setArea(["IncreaseMultiSpace","decreaseMultiSpace","decrease_routing_width","increase_routing_width"]);let n=new vo("Multi-route wiring");n.handleMultiSelectItem(e),n.drawing=!0,we.drawing=!0,this.tool.setNextTool(n),this.isHoldPCBAttrPanel=n.isHoldPCBAttrPanel;break}case"pcbOptimizedPath":{let n=new zG;n.handleSelectItems(e),n.drawing=!0,we.drawing=!0,this.tool.setNextTool(n),di.setNonSelect();break}case"editPadShape":{if(e.length==1&&e[0]instanceof sn){let n=new T5;n.setPad(e[0]),this.tool.setNextTool(n),di.currentCanUndoTool=!0}break}case"draw(rectSutureVia)":{let n=new rde;n.drawing=!0,this.tool.setNextTool(n);break}case"draw(lineSutureVia)":{let n=new Vde;this.tool.setNextTool(n);break}case"draw(polygonSutureVia)":{let n=new qG;this.tool.setNextTool(n);break}case"place_part(polygonpad)":{let n=new wG;n.drawing=!0,Ua.addTool(n),this.tool.setNextTool(n);break}case"PlaceSinglePad":{let n=new dE;n.drawing=!0,Ua.addTool(n),this.tool.setNextTool(n),di.setPlace();break}case"place_part(testPad)":{let n=new MG;n.drawing=!0,Ua.addTool(n),this.tool.setNextTool(n),di.setPlace();break}case"place_part(line_pads)":{let n=new _G;n.drawing=!0,di.setPlace(),this.tool.setNextTool(n);break}case"place_part(rect_pads)":{let n=new vG;n.drawing=!0,di.setPlace(),this.tool.setNextTool(n);break}case"place_part(via)":{if(le.pcbConfig.isPlaceViasAutoShove){let n=new U2;n.drawing=!0,we.drawing=!0,this.tool.setNextTool(n),di.setPlace()}else{let n=new w1;n.drawing=!0,we.drawing=!0,this.tool.setNextTool(n),di.setPlace()}break}case"place_part(pcbtext)":{let n=new RG;n.drawing=!0,this.tool.setNextTool(n),Ua.addTool(n),di.setPlace();break}case"draw(arc2)":{let n=new cC;n.drawing=!0,this.tool.setNextTool(n),uu.setTool(n),Ua.addTool(n);break}case"draw(arcCenter)":{let n=new lC;n.drawing=!0,this.tool.setNextTool(n),uu.setTool(n),Ua.addTool(n);break}case"draw(arc)":{let n=new hC;n.drawing=!0,this.tool.setNextTool(n),uu.setTool(n),Ua.addTool(n);break}case"draw(protractor)":{let n=new Zue;n.drawing=!0,this.tool.setNextTool(n);break}case"draw(rect)":{let n=new Ac("Line");n.drawing=!0,this.tool.setNextTool(n),uu.setTool(n);break}case"draw(ROutline)":{let n=new Ac("Board Outline");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(RSlot)":{let n=new Ac("Slot Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(RRegion)":{if(R.getInstance().doctype===4&&Pe.getAllPinLayerIds().includes(Pe.getActiveLayer().layerID)){let n=new LD(a=>{if(a){let l=new Ac("Fill Region");l.drawing=!0,this.tool.setNextTool(l)}}),s={command:"selectPadWithRegion",program:n,msg:"Please select a pad to associate"};A.publish("toggle",s)}else{let n=new Ac("Fill Region");n.drawing=!0,this.tool.setNextTool(n)}break}case"draw(annotation)":{let n=new Ac("Annotation");n.drawing=!0,this.tool.setNextTool(n);break}case"drawpartition(Rectangle)":{let n=new Ac("Partition");n.drawing=!0,this.tool.setNextTool(n);break}case"drawpartition(Circle)":{let n=new Vh("Partition");n.drawing=!0,this.tool.setNextTool(n);break}case"drawpartition(Polygon)":{let n=new hc("Partition");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(RCutout)":{let n=new Ac("Cutout");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(CCutout)":{let n=new Vh("Cutout");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(PCutout)":{let n=new hc("Cutout");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(RectFPCStiffener)":{let n=new Ac("FPC Stiffener");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(RProhibit)":{let n=new Ac("Prohibited Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(RConstraint)":{let n=new Ac("Constraint Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(RCopper)":{let n=new Ac("Copper Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(stretchtrack)":{let n=new B3;if(n.drawing=!0,e.length==1){let s=e[0];if(n.source=!0,s instanceof Ir){let{x:a,y:l}=ze.getLastClickPosition();n.addTrack(s,a,l)}else s instanceof yi&&n.addArcTracK(s)}this.tool.setNextTool(n);break}case"draw(circle)":{let n=new Vh("Line");n.drawing=!0,this.tool.setNextTool(n),uu.setTool(n);break}case"draw(COutline)":{let n=new Vh("Board Outline");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(CSlot)":{let n=new Vh("Slot Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(CRegion)":{if(R.getInstance().doctype===4&&Pe.getAllPinLayerIds().includes(Pe.getActiveLayer().layerID)){let n=new LD(a=>{if(a){let l=new Vh("Fill Region");l.drawing=!0,this.tool.setNextTool(l)}}),s={command:"selectPadWithRegion",program:n,msg:"Please select a pad to associate"};A.publish("toggle",s)}else{let n=new Vh("Fill Region");n.drawing=!0,this.tool.setNextTool(n)}break}case"draw(CirFPCStiffener)":{let n=new Vh("FPC Stiffener");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(CProhibit)":{let n=new Vh("Prohibited Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(CConstraint)":{let n=new Vh("Constraint Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(CCopper)":{let n=new Vh("Copper Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(POutline)":{let n=new hc("Board Outline");n.drawing=!0,Ua.addTool(n),this.tool.setNextTool(n);break}case"draw(Line)":{let n=new hc("Line");Ua.addTool(n),n.drawing=!0,this.tool.setNextTool(n),uu.setTool(n);break}case"draw(PSlot)":{let n=new hc("Slot Region");n.drawing=!0,Ua.addTool(n),this.tool.setNextTool(n);break}case"draw(PRegion)":{if(R.getInstance().doctype===4&&Pe.getAllPinLayerIds().includes(Pe.getActiveLayer().layerID)){let n=new LD(a=>{if(a){let l=new hc("Fill Region");Ua.addTool(l),l.drawing=!0,this.tool.setNextTool(l)}}),s={command:"selectPadWithRegion",program:n,msg:"Please select a pad to associate"};A.publish("toggle",s)}else{let n=new hc("Fill Region");Ua.addTool(n),n.drawing=!0,this.tool.setNextTool(n)}break}case"draw(PolyFPCStiffener)":{let n=new hc("FPC Stiffener");n.drawing=!0,Ua.addTool(n),this.tool.setNextTool(n);break}case"draw(PProhibit)":{let n=new hc("Prohibited Region");n.drawing=!0,Ua.addTool(n),this.tool.setNextTool(n);break}case"draw(PConstraint)":{let n=new hc("Constraint Region");n.drawing=!0,Ua.addTool(n),this.tool.setNextTool(n);break}case"draw(PCopper)":{let n=new hc("Copper Region");n.drawing=!0,Ua.addTool(n),this.tool.setNextTool(n);break}case"draw(dimension)":{let n=new Jue;n.drawing=!0,this.tool.setNextTool(n);break}case"dropdrag":{this.tool.setNextTool(new Vc),$n.setTool(ze),xo.setTool(ze),ze.dragging=!1,ze.getSelects().length==0?(di.setNonSelect(),bh.type&&bh.exitSketcherAttrView({type:bh.type})):A.publish("flushSelectingInfo",""),di.dropDrag=!0;break}case"COPY":{this.isHoldPCBAttrPanel=!0;let n=bT.filter(e);if(n.length>0){if(A.publish("clearImageCopy","",Q()),le.pcbConfig.referencePointPcbSelectMethod=="select"){let s=new kD;this.tool.setNextTool(s),di.setPlace()}else kD.copy(n),this.tool.setNextTool(new Vc),this.lastCmd="dropdrag",we.setCommand(this.lastCmd);i instanceof Vc&&(i.realdTimeHighLight.cancelhighLight(),i.realTimeHighLightNet.cancelHighLight())}else this.tool.setNextTool(new Vc),this.lastCmd="dropdrag",we.setCommand(this.lastCmd);break}case"PASTE":{xo.setTool(Fl),this.tool.setNextTool(new pE),di.setPlace();break}case"selectCenterObjectForVertical":case"selectCenterObjectForHorizontal":case"selectRefObjectForAlignLeft":case"selectRefObjectForAlignRight":case"selectRefObjectForAlignTop":case"selectRefObjectForAlignBottom":{let n=sXe[t],s,a=new uE(0,0,[(l,c)=>{let h=Array.from(Vr.pointSelectBeforeFilter(l,c).getResult(Df)),u=ze.getSelects();s=h.filter(m=>u.includes(m))[0];let d=pde(s),p;switch(n){case"align_left":case"align_right":p=!we.flipBoard==(n=="align_left")?d.LL():d.UR();break;case"align_top":p=d.UL();break;case"align_bottom":p=d.LR();break;case"align_vertical_center":case"align_horizontal_center":p=d.center();break;default:break}A.publish("alignSelectedObjs",{cmd:n,refPoint:p,refItemId:s.globalIndex}),A.publish("tool","dropdrag"),A.publish("select",e),A.publish("flushSelectingInfo","")}],(l,c)=>{let h=Array.from(Vr.pointSelectBeforeFilter(l,c).getResult(Df)),u=ze.getSelects(),d=h.filter(p=>u.includes(p))[0];return h.length>0&&d!=null});A.publish("toggle",{command:"referencePoint",program:a,msg:"Please Select The Reference Object"});break}case"selectStartPoint":case"selectCenterPoint":{let n=new uE(0,0,[(s,a)=>{let l=R.getInstance().origin;A.publish("showArrayDistributionDlg",{refPoint:{x:s-l.x,y:a-l.y},unit:R.getInstance().unit},Q())}]);A.publish("toggle",{command:"referencePoint",program:n,msg:t=="selectStartPoint"?"Please select a starting point":"Please select a center point"});break}case"CLIP":{if(bT.filter(e).length>0){if(A.publish("clearImageCopy","",Q()),le.pcbConfig.referencePointPcbSelectMethod=="select"){let s=new y5;this.tool.setNextTool(s),di.setPlace()}else y5.clip(),this.tool.setNextTool(new Vc),this.lastCmd="dropdrag",we.setCommand(this.lastCmd);i instanceof Vc&&(i.realdTimeHighLight.cancelhighLight(),i.realTimeHighLightNet.cancelHighLight())}else this.tool.setNextTool(new Vc),this.lastCmd="dropdrag",we.setCommand(this.lastCmd);break}case"boxselect":{this.tool.setNextTool(new Que);break}case"component_distribute_by_region":{this.tool.setNextTool(new qde);break}case"draw(radius)":{let n=new ede;n.drawing=!0,this.tool.setNextTool(n);break}case"CreepageDistance":case"MeasureDistance":case"MeasureObjectDistance":{gh.measureMode=t;let n=new lG(e);n.drawing=!0,this.tool.setNextTool(n),this.isHoldPCBAttrPanel=n.isHoldPCBAttrPanel;break}case"copySpecial":{let n=new lpe(e);n.drawing=!0,this.tool.setNextTool(n),this.isHoldPCBAttrPanel=n.isHoldPCBAttrPanel;break}case"continuousSelection":{let n=new xde;n.drawing=!0,this.tool.setNextTool(n);break}case"rectangleOutside":{let n=new qq;n.drawing=!0,this.tool.setNextTool(n);break}case"rectangleInside":{let n=new qq(!0);n.drawing=!0,this.tool.setNextTool(n);break}case"polygonInside":{let n=new Dde;n.drawing=!0,this.tool.setNextTool(n);break}case"polygonOutside":{let n=new wde;n.drawing=!0,this.tool.setNextTool(n);break}case"lineTouched":{let n=new Lde;n.drawing=!0,this.tool.setNextTool(n);break}case"connectedCopper":{let n=new Qde;i instanceof Vc&&(i.realdTimeHighLight.cancelhighLight(),i.realTimeHighLightNet.cancelHighLight()),n.drawing=!0,this.tool.setNextTool(n);break}case"crossProbeTool":{let n=new Zq;n.drawing=!0,this.tool.setNextTool(n);break}case"customPathRenumberPads":{let n=new jde;n.drawing=!0,this.tool.setNextTool(n);break}case"draw(R3dShellOutline)":{let n=new Ac("3D Shell - Outline");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(C3dShellOutline)":{let n=new Vh("3D Shell - Outline");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(P3dShellOutline)":{let n=new hc("3D Shell - Outline");n.drawing=!0,Ua.addTool(n),this.tool.setNextTool(n);break}case"place_part(3dShellScrewPillar)":{let n=new NG;n.drawing=!0,Ua.addTool(n),di.setPlace(),this.tool.setNextTool(n);break}case"draw(3dShellSideSlotDatumLine)":{let n=new kG;n.drawing=!0,this.tool.setNextTool(n);break}case"draw(R3dShellSideSlotRegion)":{Fc.toggleTool(),Fc.setOnceCallback(()=>{let n=new Ac("3D Shell - Side Slot Region");n.drawing=!0,di.setDraw(),this.tool.setNextTool(n)});break}case"draw(C3dShellSideSlotRegion)":{Fc.toggleTool(),Fc.setOnceCallback(()=>{let n=new Vh("3D Shell - Side Slot Region");n.drawing=!0,di.setDraw(),this.tool.setNextTool(n)});break}case"draw(P3dShellSideSlotRegion)":{Fc.toggleTool(),Fc.setOnceCallback(()=>{let n=new hc("3D Shell - Side Slot Region");n.drawing=!0,di.setDraw(),Ua.addTool(n),this.tool.setNextTool(n)});break}case"draw(R3dShellTopSlotRegion)":{let n=new Ac("3D Shell - Top Slot Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(C3dShellTopSlotRegion)":{let n=new Vh("3D Shell - Top Slot Region");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(P3dShellTopSlotRegion)":{let n=new hc("3D Shell - Top Slot Region");n.drawing=!0,Ua.addTool(n),this.tool.setNextTool(n);break}case"draw(R3dShellSideEntity)":{Fc.toggleTool(),Fc.setOnceCallback(()=>{let n=new Ac("3D Shell - Side Entity");n.drawing=!0,di.setDraw(),this.tool.setNextTool(n)});break}case"draw(C3dShellSideEntity)":{Fc.toggleTool(),Fc.setOnceCallback(()=>{let n=new Vh("3D Shell - Side Entity");n.drawing=!0,di.setDraw(),this.tool.setNextTool(n)});break}case"draw(P3dShellSideEntity)":{Fc.toggleTool(),Fc.setOnceCallback(()=>{let n=new hc("3D Shell - Side Entity");n.drawing=!0,di.setDraw(),Ua.addTool(n),this.tool.setNextTool(n)});break}case"draw(R3dShellTopBottomEntity)":{let n=new Ac("3D Shell - Top/Bottom Entity");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(C3dShellTopBottomEntity)":{let n=new Vh("3D Shell - Top/Bottom Entity");n.drawing=!0,this.tool.setNextTool(n);break}case"draw(P3dShellTopBottomEntity)":{let n=new hc("3D Shell - Top/Bottom Entity");n.drawing=!0,Ua.addTool(n),this.tool.setNextTool(n);break}case"place_part(stack_table)":{let n=new Wde;n.drawing=!0,this.tool.setNextTool(n),di.setPlace();break}case"place_part(drill_table)":{let n=new Ese;n.drawing=!0,this.tool.setNextTool(n),di.setPlace();break}case"connectPads":{let n=new Jde;n.drawing=!0,this.tool.setNextTool(n),di.setPlace();break}case"Split":{let n=new tpe;n.initSplitUtils(e),e.forEach(s=>s.click()),Ua.addTool(n),n.drawing=!0,this.isHoldPCBAttrPanel=!0,this.tool.setNextTool(n),uu.setTool(n),ze.setTool(n);break}case"SelectHelp":{let n=new YG;n.drawing=!0,di.setPlace(),this.tool.setNextTool(n);break}}A.publish("updateCrossDirect",fi.getInstance()),A.publish("refreshNextTool",""),A.publish("updateFrame",""),this.isHoldPCBAttrPanel||A.publish("flushSelectingInfo","")}placeText(){this.lastCmd=null,this.update("place_part(pcbtext)")}drawImage(t){if(di.dropDrag=!1,this.lastCmd==="DrawImage")return;this.lastCmd="DrawImage",this.tool.interrupt();let e=new ide(t);this.tool.setNextTool(e),di.setPlace(),A.publish("refreshNextTool","")}drawTrueColorPicture(t){if(di.dropDrag=!1,this.lastCmd==="DrawImage")return;this.lastCmd="DrawImage",this.tool.interrupt();let e=new aG(t);this.tool.setNextTool(e),di.setPlace(),A.publish("refreshNextTool","")}toggleRedraw(t){this.lastCmd!=="redrawPolygon"&&Is.getInstance().init([t.profile],"edit Polygon node check lock",(e,r)=>{di.dropDrag=!1,this.lastCmd="redrawPolygon",this.tool.interrupt();let i=new ode(t.shapes,t.last,t.start,t.curr,t.profile,t.nextshapes,t.index,r.getCommand());Ua.addTool(i),oC.ready=!0,this.tool.setNextTool(i)})}toggleRedrawPad(t){this.lastCmd!=="redrawPolygonPad"&&Is.getInstance().init([t.profile],"edit Polygon node check lock",(e,r)=>{di.dropDrag=!1,this.lastCmd="redrawPolygonPad",this.tool.interrupt();let i=new LG(t.shapes,t.last,t.start,t.curr,t.profile,t.padDrillModels,r.getCommand(),t.history);this.tool.setNextTool(i)})}toggleEditPad(t){let e="editPadShape";this.lastCmd=e,A.publish("clearDimension","");let r=ze.getSelects();if(r.length==1&&r[0]instanceof sn){let i=new T5(t.history);i.setPad(r[0]),this.tool.setNextTool(i),di.currentCanUndoTool=!0}}toggle(t){if(R.getInstance().isReadOnlyMode)switch(t){case"referencePoint":case"referencePoint1":case"selectPadWithRegion":case"selectDatumLineWithRegion":break;default:return}if(!this.needMultiToggle(t.command)&&this.lastCmd===t.command)return;On.getInstance().allowPull=!0,this.tool.clearCrossFlag(),di.dropDrag=!1,di.setDraw();let e=this.tool.getNextTool(),r=t.command;if(this.openCopperInterruptDialog(t),r!=null){A.publish("clearDimension","");let i=this.lastCmd;switch(this.lastCmd=r,we.setCommand(r),r){case"draw(snake_track)":{ze.onMouseLeftUp(fi.getInstance()),this.tool.interrupt(),di.setArea(["increaseSnakeGap","decreaseSnakeGap"]);let n=t.isDiffPair,s=t.data,a=!!s;s||(s=n?OOe.getDiffPairSnakeTrackToolConfig():OOe.getSnakeTrackToolConfig()),t.startPoint&&t.startPoint instanceof S&&(s.startPoint=t.startPoint,s.reOpenDialog=!0);let l;l=n?new KG(s.isSingleSide,s.type,s.width,s.minHeight,s.startPoint,s.mouseXY,s.restrictLength,s.additionalLength,s.reOpenDialog,s.addedTo,a):new $G(s.isSingleSide,s.type,s.width,s.minHeight,s.startPoint,s.mouseXY,s.restrictLength,s.additionalLength,s.reOpenDialog,s.addedTo,a),uu.setTool(l),we.drawing=!0,this.tool.setNextTool(l);break}case"MouseSelect":{let n=new C5(t.cmd);this.tool.setNextTool(n);break}case"referencePoint":{let n=new nde(this.tool,this.tool.drawing,this.tool.getNextTool(),t.program,t.msg);this.tool.setNextTool(n);break}case"referencePoint1":{let n=new XG(this.tool,this.tool.drawing,this.tool.getNextTool(),t.program,t.msg,t.assignReferPoint,t.needInput);this.tool.setNextTool(n);break}case"netSelect":{let n=this.tool.getNextTool();if(!Mt.isChildPcb()&&(!n||!(n instanceof $q))){let s=new $q(this.tool,i,this.tool.drawing,this.tool.getNextTool(),t.pcbBridgingCopperIndex);this.tool.setNextTool(s)}break}case"differentailNetSelect":{let n=t.formData,s=t.type,a=new I5(this.tool,this.tool.drawing,this.tool.getNextTool(),n,s);di.setPlace(),this.tool.setNextTool(a);break}case"PadsPairPadSelect":{let n=t.formData,s=new FG(this.tool,this.tool.drawing,this.tool.getNextTool(),n);this.tool.setNextTool(s);break}case"batchMoveItem":case"BatchMoveSequentialItem":{let n=this.tool.getNextTool(),s=new $de(this.tool,n);this.tool.setNextTool(s),s.execute(t);break}case"importDxf":{this.tool.interrupt();let n=xR.getInstance();this.tool.setNextTool(n);break}case"insertNode":{let n=ze.getSelects(),{ready:s,position:a,selects:l}=t;Is.getInstance().init(l||n,"insert node check lock",(c,h)=>{s&&this.tool.interrupt();let u=new ohe({selects:c},h);this.tool.setNextTool(u),s&&a&&u.changeToReady(a)});break}case"editOutline":{this.tool.interrupt();let n=new GG(t.item);n.initUtils(t.item),this.tool.setNextTool(n);break}case"placeComponent":{this.tool.interrupt();let n=new jG(t.device,t.source);this.tool.setNextTool(n),di.setPlace();break}case"AddChamfer":{Is.getInstance().init(t.items,"add chamfer check lock",(n,s)=>{this.tool.interrupt();let a=new Gde(n,s.getCommand(),t.type);this.tool.setNextTool(a)});break}case"selectPadWithRegion":{let n=new Ude(this.tool,this.tool.drawing,this.tool.getNextTool(),t.program,t.msg);this.tool.setNextTool(n);break}case"selectDatumLineWithRegion":{let n=new Hde(this.tool,this.tool.drawing,this.tool.getNextTool(),t.msg);di.setPlace(),this.tool.setNextTool(n);break}case"MOVE_NODE":{let n=new BG(t.commands,t.filterItems,t.options);this.tool.setNextTool(n);let s=t.inputInfo;fi.getInstance().realSceneX=s.x||s.realSceneX,fi.getInstance().realSceneY=s.y||s.realSceneY,n.onMouseLeftDown(fi.getInstance());break}case"PASTE2":{e instanceof Vc&&(e.realdTimeHighLight.cancelhighLight(),e.realTimeHighLightNet.cancelHighLight()),xo.setTool(Fl);let n=new c_(ze.getSelects(),null,t.layerId);this.tool.setNextTool(n),di.setPlace(),t.layerId?n.copyToOtherLayer(ze.getSelects(),t.layerId):n.copyToCursor(ze.getSelects());break}case"placePcb":{let n=new Zde(t.module);this.tool.setNextTool(n),n.drawing=!0,di.setPlace(),n.hasItems().then(s=>{s||(A.publish("ui/toastMsg",{type:"warn",msg:"Place content empty!"},Q()),A.publish("tool","dropdrag"))});break}}A.publish("updateCrossDirect",fi.getInstance())}}needMultiToggle(t){switch(t){case"PASTE2":return!1;default:return!0}}needClearStatus(t){switch(t){case"selectStartPoint":case"selectCenterPoint":case"selectRefObjectForAlignLeft":case"selectRefObjectForAlignRight":case"selectRefObjectForAlignTop":case"selectRefObjectForAlignBottom":case"selectCenterObjectForVertical":case"selectCenterObjectForHorizontal":case"boxselect":case"component_distribute_by_region":case"netSelect":case"COPY":case"CLIP":case"customPathRenumberPads":case"rectangleInside":case"rectangleOutside":case"polygonInside":case"polygonOutside":case"lineTouched":case"connectedCopper":case"continuousSelection":case"draw(RCutout)":case"draw(CCutout)":case"draw(PCutout)":case"crossProbeTool":return!1;default:return!0}}};var fXe=1.5,hpe=class extends Oo{constructor(){super();this.isMouseRightDown=!1;this.prevRightX=0;this.prevRightY=0;this.isMouseMidDown=!1;this.prevMidY=0;this.zoomCenter=Dt.ORIGIN;this.camera=Ai(),A.subscribe("adaptAll",e=>{let{tabId:r}=e||{},i=R.getInstance();if(!(![23].includes(i.doctype)||(r?i.tabId!=r:!i.isactive))){if(kt.size()>0){let n=Kc(),s=new _e;n.forEach(l=>{if(l.isVisible){if(l instanceof lr&&l.getText()=="")return;s.ext1(l.buildBBox())}});let a=Pi.getBBox();if(a instanceof ht&&s.ext1(a),oa){let l=oa.buildBox();if(s.ext1(l),s.valid()){let c=s.build1();XT(this.camera,c,.8)}}else if(s.valid()){let l=s.build1();XT(this.camera,l,.8)}}A.publish("updateFrame","")}}),A.subscribe("adaptBBox",(e,r=.8)=>{XT(this.camera,e,r),A.publish("updateFrame","")}),A.messageBus.rpcService("FootprintPadSize",()=>new Promise((e,r)=>{let i=Qt.getAllItem(),n={},s={};for(let a=0;a<i.length;a++){let l=i[a],c=l.getDimensionBBox();s[l.num]||(s[l.num]=[]),s[l.num].push(l.globalIndex),n[l.num]={width:c.width()*10,height:c.height()*10,number:l.globalIndex,no:l.num,gIdArr:s[l.num]}}e(Object.keys(n).map(a=>({...n[a]})))})),A.messageBus.rpcService("HighlightItemsInPreview",this.highlightItems.bind(this)),A.messageBus.rpcService("PreviewPanelize",e=>new L0().applyPanelize(e)),A.globalMessageBus.rpcService("PreviewPanelize2",e=>new L0().applyPanelize(e)),A.messageBus.subscribe("PreviewHighLightTool",()=>{let e=new AG;this.setNextTool(e)})}onKeyDown(e){A.publish("pcb_hotkey",{keyCode:e.keyCode,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey},Q())}onKeyUp(e){A.publish("pcb_hotkey",{keyCode:e.keyCode,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey},Q())}onMouseRightDown(e){this.prepare(e),e.realSceneDeltaX=0,e.realSceneDeltay=0,e.rightDown=!0,e.openMenu=!0,e.downTime=new Date().getTime(),this.isMouseRightDown=!0,this.prevRightX=e.mouseX,this.prevRightY=e.mouseY}onMouseLeftDown(e){jA(frameElement,"isPackageManager")=="true"&&(oa?oa.onMouseLeftDown(e):kt.size()>0&&Qt.getAllItem().forEach(r=>{r.isSelect(e.realSceneX,e.realSceneY)?(r.click(),A.publish("setHighlightRowByNumber",r.num,Q())):r.visible()}))}onDoubleClick(e){let r=(parent==null?void 0:parent.document.getElementsByTagName("iframe"))||[];for(let i of Array.from(r))i.contentWindow===window&&jA(i,"click_to_place")=="true"&&A.publish("clickPlaceBtn",R.getInstance().id,Q())}onMouseRightUp(e){var r;this.prepare(e),this.isMouseRightDown=!1,e.openMenu&&A.publish("showPreviewRightClickMenu",{x:e.mouseX,y:e.mouseY,iframeElementId:(r=window.frameElement)==null?void 0:r.id,isEnableRemovableByBlur:!0},Q()),e.rightDown=!1,e.openMenu=!1}onMouseMove(e){let r=new Date().getTime();if(this.isMouseRightDown){let i=e.mouseX-this.prevRightX,n=e.mouseY-this.prevRightY;this.camera.addOffset1(i,n),this.prevRightX=e.mouseX,this.prevRightY=e.mouseY}if(this.isMouseMidDown){let n=1-(e.mouseY-this.prevMidY)/e.canvasHeight*20;n<0&&(n=1),this.setScale(n),this.prevMidY=e.mouseY}this.prepare(e),e.rightDown&&r-e.downTime<120?e.openMenu=!0:e.rightDown&&(e.realSceneDeltaX!=0||e.realSceneDeltay!=0)&&(e.openMenu=!1),oa&&oa.onMouseMove(e),this.handler(i=>{i.onMouseMove(e)})}onMouseWheel(e){this.prepare(e);let r;e.deltaY<0?r=fXe:r=1/fXe,this.markZoomCenter(e),this.setScale(r),this.prepare(e)}onResize(e){R.getInstance().resize()}prepare(e){let r=this.mouseRealOffset(e);e.realSceneDeltaX=r.x-e.realSceneX,e.realSceneDeltay=r.y-e.realSceneY,e.realSceneX=r.x,e.realSceneY=r.y}markZoomCenter(e){this.zoomCenter=new Dt(e.mouseX,e.mouseY,0)}setScale(e){let r=this.camera.getScale();!isNaN(r)&&r!=0&&this.camera.scaleAtPoint1(e,this.zoomCenter.x,this.zoomCenter.y)}mouseRealOffset(e){let r=new Dt(e.mouseX,-e.mouseY,0),i=new Dt(e.canvasWidth/2,-e.canvasHeight/2,0);return r.sub(i).multiply4(this.camera.get2dCameraMatrix().inverse())}highlightItems(e){if(A.publish("clearSelect",""),e.length==0)return;let r=new Jt;e.forEach(i=>{let n=Ht.getItem(i),s;if(n)n.getItems().forEach(a=>{a.click()});else{if(s=r.getItem(i),!s)return;jt.filter([s]).size>0&&(s instanceof Gi&&Pe.setActiveLayer(Pe.getLayer(s.layerId)),s.click())}}),A.publish("updateFrame","")}};var TXe=Ru(r2());function aRt(){function o(p=0,m=0){this.x=p,this.y=m}o.prototype.copy=function(){return new o(this.x,this.y)};function t(p,m,g){var y=p.length,b=m*g;this.w=m,this.h=g,this.size=b,b==y?this.data=new Int8Array(p):this.data=new Int8Array(b)}t.prototype.at=function(p,m){return p>=0&&p<this.w&&m>=0&&m<this.h&&this.data[this.w*m+p]===1},t.prototype.index=function(p){var m=new o;return m.y=Math.floor(p/this.w),m.x=p-m.y*this.w,m},t.prototype.flip=function(p,m){this.at(p,m)?this.data[this.w*m+p]=0:this.data[this.w*m+p]=1},t.prototype.copy=function(){return new t(this.data,this.w,this.h)};function e(){this.area=0,this.len=0,this.curve={},this.pt=[],this.minX=1e5,this.minY=1e5,this.maxX=-1,this.maxY=-1}function r(p){this.n=p,this.tag=new Array(p),this.c=new Array(p*3),this.alphaCurve=0,this.vertex=new Array(p),this.alpha=new Array(p),this.alpha0=new Array(p),this.beta=new Array(p)}var i=null,n=[],s={turnpolicy:"minority",turdsize:0,optcurve:!0,alphamax:1,opttolerance:.2};function a(p){var m;for(m in p)p.hasOwnProperty(m)&&s.hasOwnProperty(m)&&(s[m]=p[m])}function l(p,m){var g=p.copy(),y=new o(0,0),b,P=[];function T(O){for(var _=g.w*O.y+O.x;_<g.size&&g.data[_]!==1;)_++;return _<g.size&&g.index(_)}function I(O,_){var x,v,D;for(x=2;x<5;x++){for(D=0,v=-x+1;v<=x-1;v++)D+=g.at(O+v,_+x-1)?1:-1,D+=g.at(O+x-1,_+v-1)?1:-1,D+=g.at(O+v-1,_-x)?1:-1,D+=g.at(O-x,_+v)?1:-1;if(D>0)return 1;if(D<0)return 0}return 0}function C(O){var _=new e,x=O.x,v=O.y,D=0,w=1,F;for(_.sign=p.at(O.x,O.y)?"+":"-";_.pt.push(new o(x,v)),x>_.maxX&&(_.maxX=x),x<_.minX&&(_.minX=x),v>_.maxY&&(_.maxY=v),v<_.minY&&(_.minY=v),_.len++,x+=D,v+=w,_.area-=x*w,!(x===O.x&&v===O.y);){var H=g.at(x+(D+w-1)/2,v+(w-D-1)/2),z=g.at(x+(D-w-1)/2,v+(w+D-1)/2);z&&!H?m.turnpolicy==="right"||m.turnpolicy==="black"&&_.sign==="+"||m.turnpolicy==="white"&&_.sign==="-"||m.turnpolicy==="majority"&&I(x,v)||m.turnpolicy==="minority"&&!I(x,v)?(F=D,D=-w,w=F):(F=D,D=w,w=-F):z?(F=D,D=-w,w=F):H||(F=D,D=w,w=-F)}return _}function E(O){var _=O.pt[0].y,x=O.len,v,D,w,F,H,z;for(H=1;H<x;H++)if(v=O.pt[H].x,D=O.pt[H].y,D!==_){for(F=_<D?_:D,w=O.maxX,z=v;z<w;z++)g.flip(z,F);_=D}}for(;y=T(y);)b=C(y),E(b),b.area>m.turdsize&&P.push(b);return P}function c(p,m){function g(){this.data=[0,0,0,0,0,0,0,0,0]}g.prototype.at=function(X,K){return this.data[X*3+K]};function y(X,K,J,se,ce){this.x=X,this.y=K,this.xy=J,this.x2=se,this.y2=ce}function b(X,K){return X>=K?X%K:X>=0?X:K-1-(-1-X)%K}function P(X,K){return X.x*K.y-X.y*K.x}function T(X,K,J){return X<=J?X<=K&&K<J:X<=K||K<J}function I(X){return X>0?1:X<0?-1:0}function C(X,K){var J=new Array(3),se,ce,te;for(J[0]=K.x,J[1]=K.y,J[2]=1,te=0,se=0;se<3;se++)for(ce=0;ce<3;ce++)te+=J[se]*X.at(se,ce)*J[ce];return te}function E(X,K,J){var se=new o;return se.x=K.x+X*(J.x-K.x),se.y=K.y+X*(J.y-K.y),se}function O(X,K){var J=new o;return J.y=I(K.x-X.x),J.x=-I(K.y-X.y),J}function _(X,K){var J=O(X,K);return J.y*(K.x-X.x)-J.x*(K.y-X.y)}function x(X,K,J){var se,ce,te,oe;return se=K.x-X.x,ce=K.y-X.y,te=J.x-X.x,oe=J.y-X.y,se*oe-te*ce}function v(X,K,J,se){var ce,te,oe,$;return ce=K.x-X.x,te=K.y-X.y,oe=se.x-J.x,$=se.y-J.y,ce*$-oe*te}function D(X,K,J){var se,ce,te,oe;return se=K.x-X.x,ce=K.y-X.y,te=J.x-X.x,oe=J.y-X.y,se*te+ce*oe}function w(X,K,J,se){var ce,te,oe,$;return ce=K.x-X.x,te=K.y-X.y,oe=se.x-J.x,$=se.y-J.y,ce*oe+te*$}function F(X,K){return Math.sqrt((X.x-K.x)*(X.x-K.x)+(X.y-K.y)*(X.y-K.y))}function H(X,K,J,se,ce){var te=1-X,oe=new o;return oe.x=te*te*te*K.x+3*(te*te*X)*J.x+3*(X*X*te)*se.x+X*X*X*ce.x,oe.y=te*te*te*K.y+3*(te*te*X)*J.y+3*(X*X*te)*se.y+X*X*X*ce.y,oe}function z(X,K,J,se,ce,te){var oe,$,fe,Oe,Te,ue,be,j,Z,ie;return oe=v(X,K,ce,te),$=v(K,J,ce,te),fe=v(J,se,ce,te),Oe=oe-2*$+fe,Te=-2*oe+2*$,ue=oe,be=Te*Te-4*Oe*ue,Oe===0||be<0?-1:(j=Math.sqrt(be),Z=(-Te+j)/(2*Oe),ie=(-Te-j)/(2*Oe),Z>=0&&Z<=1?Z:ie>=0&&ie<=1?ie:-1)}function V(X){var K,J,se;X.x0=X.pt[0].x,X.y0=X.pt[0].y,X.sums=[];var ce=X.sums;for(ce.push(new y(0,0,0,0,0)),K=0;K<X.len;K++)J=X.pt[K].x-X.x0,se=X.pt[K].y-X.y0,ce.push(new y(ce[K].x+J,ce[K].y+se,ce[K].xy+J*se,ce[K].x2+J*J,ce[K].y2+se*se))}function W(X){var K=X.len,J=X.pt,se,ce=new Array(K),te=new Array(K),oe=new Array(4);X.lon=new Array(K);var $=[new o,new o],fe=new o,Oe=new o,Te=new o,ue,be,j,Z,ie,de,me,Se,Re=0;for(be=K-1;be>=0;be--)J[be].x!=J[Re].x&&J[be].y!=J[Re].y&&(Re=be+1),te[be]=Re;for(be=K-1;be>=0;be--){for(oe[0]=oe[1]=oe[2]=oe[3]=0,se=(3+3*(J[b(be+1,K)].x-J[be].x)+(J[b(be+1,K)].y-J[be].y))/2,oe[se]++,$[0].x=0,$[0].y=0,$[1].x=0,$[1].y=0,Re=te[be],Z=be;;){if(ue=0,se=(3+3*I(J[Re].x-J[Z].x)+I(J[Re].y-J[Z].y))/2,oe[se]++,oe[0]&&oe[1]&&oe[2]&&oe[3]){ce[be]=Z,ue=1;break}if(fe.x=J[Re].x-J[be].x,fe.y=J[Re].y-J[be].y,P($[0],fe)<0||P($[1],fe)>0||(Math.abs(fe.x)<=1&&Math.abs(fe.y)<=1||(Oe.x=fe.x+(fe.y>=0&&(fe.y>0||fe.x<0)?1:-1),Oe.y=fe.y+(fe.x<=0&&(fe.x<0||fe.y<0)?1:-1),P($[0],Oe)>=0&&($[0].x=Oe.x,$[0].y=Oe.y),Oe.x=fe.x+(fe.y<=0&&(fe.y<0||fe.x<0)?1:-1),Oe.y=fe.y+(fe.x>=0&&(fe.x>0||fe.y<0)?1:-1),P($[1],Oe)<=0&&($[1].x=Oe.x,$[1].y=Oe.y)),Z=Re,Re=te[Z],!T(Re,be,Z)))break}ue===0&&(Te.x=I(J[Re].x-J[Z].x),Te.y=I(J[Re].y-J[Z].y),fe.x=J[Z].x-J[be].x,fe.y=J[Z].y-J[be].y,ie=P($[0],fe),de=P($[0],Te),me=P($[1],fe),Se=P($[1],Te),j=1e7,de<0&&(j=Math.floor(ie/-de)),Se>0&&(j=Math.min(j,Math.floor(-me/Se))),ce[be]=b(Z+j,K))}for(j=ce[K-1],X.lon[K-1]=j,be=K-2;be>=0;be--)T(be+1,ce[be],j)&&(j=ce[be]),X.lon[be]=j;for(be=K-1;T(b(be+1,K),j,X.lon[be]);be--)X.lon[be]=j}function L(X){function K(de,me,Se){var Re=de.len,Je=de.pt,Ke=de.sums,Gt,Nr,xr,vr,_r,Ne,Vt,Ft,ir,Fe,tt,ye,yt,Wt,pe=0;return Se>=Re&&(Se-=Re,pe=1),pe===0?(Gt=Ke[Se+1].x-Ke[me].x,Nr=Ke[Se+1].y-Ke[me].y,vr=Ke[Se+1].x2-Ke[me].x2,xr=Ke[Se+1].xy-Ke[me].xy,_r=Ke[Se+1].y2-Ke[me].y2,Ne=Se+1-me):(Gt=Ke[Se+1].x-Ke[me].x+Ke[Re].x,Nr=Ke[Se+1].y-Ke[me].y+Ke[Re].y,vr=Ke[Se+1].x2-Ke[me].x2+Ke[Re].x2,xr=Ke[Se+1].xy-Ke[me].xy+Ke[Re].xy,_r=Ke[Se+1].y2-Ke[me].y2+Ke[Re].y2,Ne=Se+1-me+Re),tt=(Je[me].x+Je[Se].x)/2-Je[0].x,ye=(Je[me].y+Je[Se].y)/2-Je[0].y,Wt=Je[Se].x-Je[me].x,yt=-(Je[Se].y-Je[me].y),Vt=(vr-2*Gt*tt)/Ne+tt*tt,Ft=(xr-Gt*ye-Nr*tt)/Ne+tt*ye,ir=(_r-2*Nr*ye)/Ne+ye*ye,Fe=yt*yt*Vt+2*yt*Wt*Ft+Wt*Wt*ir,Math.sqrt(Fe)}var J,se,ce,te,oe=X.len,$=new Array(oe+1),fe=new Array(oe+1),Oe=new Array(oe),Te=new Array(oe+1),ue=new Array(oe+1),be=new Array(oe+1),j,Z,ie;for(J=0;J<oe;J++)ie=b(X.lon[b(J-1,oe)]-1,oe),ie==J&&(ie=b(J+1,oe)),ie<J?Oe[J]=oe:Oe[J]=ie;for(se=1,J=0;J<oe;J++)for(;se<=Oe[J];)Te[se]=J,se++;for(J=0,se=0;J<oe;se++)ue[se]=J,J=Oe[J];for(ue[se]=oe,ce=se,J=oe,se=ce;se>0;se--)be[se]=J,J=Te[J];for(be[0]=0,$[0]=0,se=1;se<=ce;se++)for(J=be[se];J<=ue[se];J++){for(Z=-1,te=ue[se-1];te>=Te[J];te--)j=K(X,te,J)+$[te],(Z<0||j<Z)&&(fe[J]=te,Z=j);$[J]=Z}for(X.m=ce,X.po=new Array(ce),J=oe,se=ce-1;J>0;se--)J=fe[J],X.po[se]=J}function k(X){function K(Vt,Ft,ir,Fe,tt){for(var ye=Vt.len,yt=Vt.sums,Wt,pe,Xe,ct,Me,st,Ot,hr,Or,Xr,Oi,qi=0;ir>=ye;)ir-=ye,qi+=1;for(;Ft>=ye;)Ft-=ye,qi-=1;for(;ir<0;)ir+=ye,qi-=1;for(;Ft<0;)Ft+=ye,qi+=1;Wt=yt[ir+1].x-yt[Ft].x+qi*yt[ye].x,pe=yt[ir+1].y-yt[Ft].y+qi*yt[ye].y,Xe=yt[ir+1].x2-yt[Ft].x2+qi*yt[ye].x2,ct=yt[ir+1].xy-yt[Ft].xy+qi*yt[ye].xy,Me=yt[ir+1].y2-yt[Ft].y2+qi*yt[ye].y2,st=ir+1-Ft+qi*ye,Fe.x=Wt/st,Fe.y=pe/st,Ot=(Xe-Wt*Wt/st)/st,hr=(ct-Wt*pe/st)/st,Or=(Me-pe*pe/st)/st,Xr=(Ot+Or+Math.sqrt((Ot-Or)*(Ot-Or)+4*hr*hr))/2,Ot-=Xr,Or-=Xr,Math.abs(Ot)>=Math.abs(Or)?(Oi=Math.sqrt(Ot*Ot+hr*hr),Oi!==0&&(tt.x=-hr/Oi,tt.y=Ot/Oi)):(Oi=Math.sqrt(Or*Or+hr*hr),Oi!==0&&(tt.x=-Or/Oi,tt.y=hr/Oi)),Oi===0&&(tt.x=tt.y=0)}var J=X.m,se=X.po,ce=X.len,te=X.pt,oe=X.x0,$=X.y0,fe=new Array(J),Oe=new Array(J),Te=new Array(J),ue=new Array(3),be,j,Z,ie,de,me=new o;for(X.curve=new r(J),j=0;j<J;j++)Z=se[b(j+1,J)],Z=b(Z-se[j],ce)+se[j],fe[j]=new o,Oe[j]=new o,K(X,se[j],Z,fe[j],Oe[j]);for(j=0;j<J;j++)if(Te[j]=new g,be=Oe[j].x*Oe[j].x+Oe[j].y*Oe[j].y,be===0)for(Z=0;Z<3;Z++)for(ie=0;ie<3;ie++)Te[j].data[Z*3+ie]=0;else for(ue[0]=Oe[j].y,ue[1]=-Oe[j].x,ue[2]=-ue[1]*fe[j].y-ue[0]*fe[j].x,de=0;de<3;de++)for(ie=0;ie<3;ie++)Te[j].data[de*3+ie]=ue[de]*ue[ie]/be;var Se,Re,Je,Ke,Gt,Nr,xr,vr,_r,Ne;for(j=0;j<J;j++){for(Se=new g,Re=new o,me.x=te[se[j]].x-oe,me.y=te[se[j]].y-$,Z=b(j-1,J),de=0;de<3;de++)for(ie=0;ie<3;ie++)Se.data[de*3+ie]=Te[Z].at(de,ie)+Te[j].at(de,ie);for(;;){if(Gt=Se.at(0,0)*Se.at(1,1)-Se.at(0,1)*Se.at(1,0),Gt!==0){Re.x=(-Se.at(0,2)*Se.at(1,1)+Se.at(1,2)*Se.at(0,1))/Gt,Re.y=(Se.at(0,2)*Se.at(1,0)-Se.at(1,2)*Se.at(0,0))/Gt;break}for(Se.at(0,0)>Se.at(1,1)?(ue[0]=-Se.at(0,1),ue[1]=Se.at(0,0)):Se.at(1,1)?(ue[0]=-Se.at(1,1),ue[1]=Se.at(1,0)):(ue[0]=1,ue[1]=0),be=ue[0]*ue[0]+ue[1]*ue[1],ue[2]=-ue[1]*me.y-ue[0]*me.x,de=0;de<3;de++)for(ie=0;ie<3;ie++)Se.data[de*3+ie]+=ue[de]*ue[ie]/be}if(Je=Math.abs(Re.x-me.x),Ke=Math.abs(Re.y-me.y),Je<=.5&&Ke<=.5){X.curve.vertex[j]=new o(Re.x+oe,Re.y+$);continue}if(Nr=C(Se,me),vr=me.x,_r=me.y,Se.at(0,0)!==0)for(Ne=0;Ne<2;Ne++)Re.y=me.y-.5+Ne,Re.x=-(Se.at(0,1)*Re.y+Se.at(0,2))/Se.at(0,0),Je=Math.abs(Re.x-me.x),xr=C(Se,Re),Je<=.5&&xr<Nr&&(Nr=xr,vr=Re.x,_r=Re.y);if(Se.at(1,1)!==0)for(Ne=0;Ne<2;Ne++)Re.x=me.x-.5+Ne,Re.y=-(Se.at(1,0)*Re.x+Se.at(1,2))/Se.at(1,1),Ke=Math.abs(Re.y-me.y),xr=C(Se,Re),Ke<=.5&&xr<Nr&&(Nr=xr,vr=Re.x,_r=Re.y);for(de=0;de<2;de++)for(ie=0;ie<2;ie++)Re.x=me.x-.5+de,Re.y=me.y-.5+ie,xr=C(Se,Re),xr<Nr&&(Nr=xr,vr=Re.x,_r=Re.y);X.curve.vertex[j]=new o(vr+oe,_r+$)}}function N(X){var K=X.curve,J=K.n,se=K.vertex,ce,te,oe;for(ce=0,te=J-1;ce<te;ce++,te--)oe=se[ce],se[ce]=se[te],se[te]=oe}function U(X){var K=X.curve.n,J=X.curve,se,ce,te,oe,$,fe,Oe,Te,ue;for(se=0;se<K;se++)ce=b(se+1,K),te=b(se+2,K),ue=E(1/2,J.vertex[te],J.vertex[ce]),$=_(J.vertex[se],J.vertex[te]),$!==0?(oe=x(J.vertex[se],J.vertex[ce],J.vertex[te])/$,oe=Math.abs(oe),fe=oe>1?1-1/oe:0,fe=fe/.75):fe=4/3,J.alpha0[ce]=fe,fe>=m.alphamax?(J.tag[ce]="CORNER",J.c[3*ce+1]=J.vertex[ce],J.c[3*ce+2]=ue):(fe<.55?fe=.55:fe>1&&(fe=1),Oe=E(.5+.5*fe,J.vertex[se],J.vertex[ce]),Te=E(.5+.5*fe,J.vertex[te],J.vertex[ce]),J.tag[ce]="CURVE",J.c[3*ce+0]=Oe,J.c[3*ce+1]=Te,J.c[3*ce+2]=ue),J.alpha[ce]=fe,J.beta[ce]=.5;J.alphacurve=1}function B(X){function K(){this.pen=0,this.c=[new o,new o],this.t=0,this.s=0,this.alpha=0}function J(xr,vr,_r,Ne,Vt,Ft,ir){var Fe=xr.curve.n,tt=xr.curve,ye=tt.vertex,yt,Wt,pe,Xe,ct,Me,st,Ot,hr,Or,Xr,Oi,qi,Ni,Wi,fo,tl,Oa,Gc,B0,Uc,Lt,Ql;if(vr==_r||(yt=vr,ct=b(vr+1,Fe),Wt=b(yt+1,Fe),Xe=Ft[Wt],Xe===0))return 1;for(Ot=F(ye[vr],ye[ct]),yt=Wt;yt!=_r;yt=Wt)if(Wt=b(yt+1,Fe),pe=b(yt+2,Fe),Ft[Wt]!=Xe||I(v(ye[vr],ye[ct],ye[Wt],ye[pe]))!=Xe||w(ye[vr],ye[ct],ye[Wt],ye[pe])<Ot*F(ye[Wt],ye[pe])*-.999847695156)return 1;if(Xr=tt.c[b(vr,Fe)*3+2].copy(),Oi=ye[b(vr+1,Fe)].copy(),qi=ye[b(_r,Fe)].copy(),Ni=tt.c[b(_r,Fe)*3+2].copy(),Me=ir[_r]-ir[vr],Me-=x(ye[0],tt.c[vr*3+2],tt.c[_r*3+2])/2,vr>=_r&&(Me+=ir[Fe]),Oa=x(Xr,Oi,qi),Gc=x(Xr,Oi,Ni),B0=x(Xr,qi,Ni),Uc=Oa+B0-Gc,Gc==Oa||(Ql=B0/(B0-Uc),Lt=Gc/(Gc-Oa),fo=Gc*Ql/2,fo===0))return 1;for(tl=Me/fo,st=2-Math.sqrt(4-tl/.3),Ne.c[0]=E(Ql*st,Xr,Oi),Ne.c[1]=E(Lt*st,Ni,qi),Ne.alpha=st,Ne.t=Ql,Ne.s=Lt,Oi=Ne.c[0].copy(),qi=Ne.c[1].copy(),Ne.pen=0,yt=b(vr+1,Fe);yt!=_r;yt=Wt){if(Wt=b(yt+1,Fe),Ql=z(Xr,Oi,qi,Ni,ye[yt],ye[Wt]),Ql<-.5||(Wi=H(Ql,Xr,Oi,qi,Ni),Ot=F(ye[yt],ye[Wt]),Ot===0)||(hr=x(ye[yt],ye[Wt],Wi)/Ot,Math.abs(hr)>Vt)||D(ye[yt],ye[Wt],Wi)<0||D(ye[Wt],ye[yt],Wi)<0)return 1;Ne.pen+=hr*hr}for(yt=vr;yt!=_r;yt=Wt){if(Wt=b(yt+1,Fe),Ql=z(Xr,Oi,qi,Ni,tt.c[yt*3+2],tt.c[Wt*3+2]),Ql<-.5||(Wi=H(Ql,Xr,Oi,qi,Ni),Ot=F(tt.c[yt*3+2],tt.c[Wt*3+2]),Ot===0)||(hr=x(tt.c[yt*3+2],tt.c[Wt*3+2],Wi)/Ot,Or=x(tt.c[yt*3+2],tt.c[Wt*3+2],ye[Wt])/Ot,Or*=.75*tt.alpha[Wt],Or<0&&(hr=-hr,Or=-Or),hr<Or-Vt))return 1;hr<Or&&(Ne.pen+=(hr-Or)*(hr-Or))}return 0}var se=X.curve,ce=se.n,te=se.vertex,oe=new Array(ce+1),$=new Array(ce+1),fe=new Array(ce+1),Oe=new Array(ce+1),Te,ue,be,j,Z=new K,ie,de,me,Se,Re,Je,Ke,Gt=new Array(ce),Nr=new Array(ce+1);for(ue=0;ue<ce;ue++)se.tag[ue]=="CURVE"?Gt[ue]=I(x(te[b(ue-1,ce)],te[ue],te[b(ue+1,ce)])):Gt[ue]=0;for(me=0,Nr[0]=0,ie=se.vertex[0],ue=0;ue<ce;ue++)de=b(ue+1,ce),se.tag[de]=="CURVE"&&(Se=se.alpha[de],me+=.3*Se*(4-Se)*x(se.c[ue*3+2],te[de],se.c[de*3+2])/2,me+=x(ie,se.c[ue*3+2],se.c[de*3+2])/2),Nr[ue+1]=me;for(oe[0]=-1,$[0]=0,fe[0]=0,be=1;be<=ce;be++)for(oe[be]=be-1,$[be]=$[be-1],fe[be]=fe[be-1]+1,ue=be-2;ue>=0&&(j=J(X,ue,b(be,ce),Z,m.opttolerance,Gt,Nr),!j);ue--)(fe[be]>fe[ue]+1||fe[be]==fe[ue]+1&&$[be]>$[ue]+Z.pen)&&(oe[be]=ue,$[be]=$[ue]+Z.pen,fe[be]=fe[ue]+1,Oe[be]=Z,Z=new K);for(Te=fe[ce],Re=new r(Te),Je=new Array(Te),Ke=new Array(Te),be=ce,ue=Te-1;ue>=0;ue--)oe[be]==be-1?(Re.tag[ue]=se.tag[b(be,ce)],Re.c[ue*3+0]=se.c[b(be,ce)*3+0],Re.c[ue*3+1]=se.c[b(be,ce)*3+1],Re.c[ue*3+2]=se.c[b(be,ce)*3+2],Re.vertex[ue]=se.vertex[b(be,ce)],Re.alpha[ue]=se.alpha[b(be,ce)],Re.alpha0[ue]=se.alpha0[b(be,ce)],Re.beta[ue]=se.beta[b(be,ce)],Je[ue]=Ke[ue]=1):(Re.tag[ue]="CURVE",Re.c[ue*3+0]=Oe[be].c[0],Re.c[ue*3+1]=Oe[be].c[1],Re.c[ue*3+2]=se.c[b(be,ce)*3+2],Re.vertex[ue]=E(Oe[be].s,se.c[b(be,ce)*3+2],te[b(be,ce)]),Re.alpha[ue]=Oe[be].alpha,Re.alpha0[ue]=Oe[be].alpha,Je[ue]=Oe[be].s,Ke[ue]=Oe[be].t),be=oe[be];for(ue=0;ue<Te;ue++)de=b(ue+1,Te),Re.beta[ue]=Je[ue]/(Je[ue]+Ke[de]);Re.alphacurve=1,X.curve=Re}for(var G=0;G<p.length;G++){var Y=p[G];V(Y),W(Y),L(Y),k(Y),Y.sign==="-"&&N(Y),U(Y),m.optcurve&&B(Y)}}function h(p,m,g,y){return y&&a(y),i=new t(p,m,g),n=l(i,s),c(n,s),n}function u(){i=null,n=[]}function d(){function p(P){var T=P.n,I,C,E,O,_=[];for(C=(T-1)*3+2,_[0]={type:"M",values:[P.c[C].x,P.c[C].y]},I=0;I<T;I++)P.tag[I]==="CURVE"?(E=I*3,O=E+1,C=O+1,_.push({type:"C",values:[P.c[E].x,P.c[E].y,P.c[O].x,P.c[O].y,P.c[C].x,P.c[C].y]})):P.tag[I]==="CORNER"&&(E=I*3+1,O=E+1,_.push({type:"L",values:[P.c[E].x,P.c[E].y]}),_.push({type:"L",values:[P.c[O].x,P.c[O].y]}));return _}var m=n.length,g,y,b=[];for(y=0;y<m;y++)g=n[y].curve,b[y]=p(g);return b}return{setOptions:a,process:h,clear:u,getPathDataArray:d}}function lRt(o,t,e="mm",r,i){let s={width:mXe(o,e,"pixel"),height:mXe(t,e,"pixel")}.width/r.width,a=[0,0,0,0],l=+a[0]+a[2]/2,c=+a[1]+a[3]/2,h,u=i.bbox;if(i[0]&&i[0][0]&&i[0][0].type){l-=u.width*s/2,c-=u.height*s/2,l=+gn(l,2),c=+gn(c,2);let d=function(g){return g*s+l},p=function(g){return g*s+c},m=i;m.forEach(function(g){cRt(g,d,p)}),h=hRt(m)}else{let d=JSON.parse(JSON.stringify(i));uRt(d,s);let p=dRt(d);l-=(p.maxX-p.minX)/2,c-=(p.maxY-p.minY)/2,l=+gn(l,2),c=+gn(c,2),pRt(d,l,c),h=fRt(d)}return{path:h||null,width:o,height:t,unit:e}}function mXe(o,t,e){if(t==e)return o*1;if(typeof o=="string"&&(arguments.length==2&&(e=t,t=o.replace(/^[-+.\d\s]+/,""),o=o.replace(/[^-+.\d\s]+$/,"")),o=+o),typeof o!="number"||!isFinite(o))throw Error("Invalid value for unit convert");if(t=t.toLowerCase(),e=e.toLowerCase(),t=="cm"?(t="mm",o*=10):t=="px"&&(t="pixel"),e=="cm"?(e="mm",o*=.1):e=="px"&&(e="pixel"),t==e)return o*1;if(!r(t)||!r(e))throw Error("Not supported unit convert "+t+" to "+e);switch(t+"2"+e){case"mil2pixel":return o*.1;case"mil2mm":return o*.0254;case"mil2inch":return o*.001;case"mm2pixel":return o/.254;case"mm2mil":return o/.0254;case"mm2inch":return o/25.4;case"pixel2mil":return o*10;case"pixel2mm":return o*.254;case"pixel2inch":return o*.01;case"inch2pixel":return o*100;case"inch2mil":return o*1e3;case"inch2mm":return o*25.4;default:break}throw Error("Not supported unit convert "+t+" to "+e);function r(i){return/^(pixel|mil|mm|inch)$/i.test(i)}}function cRt(o,t,e){o.forEach(function(r){var i=r.values;switch(r.type){case"M":case"L":i[0]=t(i[0]),i[1]=e(i[1]);break;case"C":i[0]=t(i[0]),i[1]=e(i[1]),i[2]=t(i[2]),i[3]=e(i[3]),i[4]=t(i[4]),i[5]=e(i[5]);break;default:break}})}function hRt(o){for(var t=[],e=0,r=o.length;e<r;e++)for(var i=o[e],n=0,s=i.length;n<s;n++){var a=i[n],l=a.values;t.push(a.type+l.join(" "))}return t.join("")}function uRt(o,t){function e(r){r[0]*=t,r[1]*=t}t!==1&&o.forEach(function(r){r.forEach(e)})}function dRt(o){var t,e,r,i,n;return o.forEach(function(s){s.forEach(function(a){(t===n||a[0]<t)&&(t=a[0]),(e===n||a[1]<e)&&(e=a[1]),(r===n||a[0]>r)&&(r=a[0]),(i===n||a[1]>i)&&(i=a[1])})}),{minX:t||0,minY:e||0,maxX:r||0,maxY:i||0}}function pRt(o,t,e){function r(i){i[0]+=t,i[1]+=e}!t&&!e||o.forEach(function(i){i.forEach(r)})}function fRt(o){if(!o||!o.length)return"";function t(n,s){return(s===0?"M":" L")+n[0]+" "+n[1]}function e(n){return n.map(t).join("")+"Z"}if(o.groups){var r=o.groups.map(function(n){var s=n.map(function(a){return o[a]}).map(e).join("");return s});return r}var i=o.map(e).join("");return i}function mRt(o,t){t=parseInt(t);var e=o.length,r=e/t,i,n,s=1e9,a=1e9,l=-1,c=-1;e:for(n=0;n<r;n++)for(i=0;i<t;i++)if(o[i+n*t]){a=n;break e}e:for(i=0;i<t;i++)for(n=0;n<r;n++)if(o[i+n*t]){s=i;break e}e:for(n=r-1;n>=0;n--)for(i=t-1;i>=0;i--)if(o[i+n*t]){c=n;break e}e:for(i=t-1;i>=0;i--)for(n=r-1;n>=0;n--)if(o[i+n*t]){l=i;break e}return{x:s,y:a,width:l+1-s,height:c+1-a}}function gRt(o,t,e,r,i){if(!i)return r=r===!0,(function(g,y){for(var b=[],P=0,T=3,I=g.length;T<I;T+=4)b[P++]=g[T]<128==y;return b})(o,r);var n=yRt(o),s=n.values,a=n[0],l=n,c={},h=Object.keys(s).map(function(g){return Math.round(+g)}),u=h.map(function(g){return Math.abs(a-g)}),d=Math.max.apply(0,u),p,m=n.length;if(e<=0)for(p=0;p<m;p++)n[p]=n[p]==a!=r?1:0;else if(e>=1)for(p=0;p<m;p++)n[p]=Math.abs(a-n[p])==d!=r?1:0;else for(p=0;p<m;p++)n[p]=Math.abs(a-n[p])/d>e!=r?1:0;return n}function yRt(o){for(var t=new Uint8Array(o.length/4),e={},r=0,i=0,n=o.length-3;r<n;r+=4){var s=bRt(o[r],o[r+1],o[r+2],o[r+3]);e[s]=(e[s]||0)+1,t[i++]=s}return t.values=e,t}function bRt(o,t,e,r){if(r==255)return gXe(o,t,e);if(r===0)return 100;r/=255;var i=240+r*(o-240),n=240+r*(t-240),s=240+r*(e-240);return gXe(i,n,s)}function gXe(o,t,e){return(30*o+59*t+11*e)/255+.5|0}function yXe(o,t,e,r,i){let n=vhe({width:t,height:e},o,{width:r,height:i});return PRt(o,n)}function PRt(o,t){let e=aRt(),r=1,i=document.createElement("canvas"),n=document.createElement("canvas"),s=i.getContext("2d"),a=n.getContext("2d"),l=.5,c=0,h=0,u=0,d=!1,p=!1;i.width-=0,n.width-=0,r=Math.ceil(Math.sqrt(1600*1600/(t.sourceImageWidth*t.sourceImageHeight)));let m=r*t.sourceImageWidth,g=r*t.sourceImageHeight;i.width=m,i.height=g,n.width=m,n.height=g,a.drawImage(o,0,0,m,g);let y=a.getImageData(0,0,m,g),b=gRt(y.data,parseInt(m),l,d,p);e.process(b,parseInt(m),parseInt(g),{alphamax:h,opttolerance:c,turdsize:u*r*r});let P=e.getPathDataArray();n.width-=0,a.beginPath(),P.forEach(function(_){TRt(_,s)}),a.fillStyle="#000",a.fill("evenodd"),a.drawImage(n,t.drawMarginLeft,t.drawMarginTop,t.drawImageWidth,t.drawImageHeight);let T=0,I=0,C={};P.length?(C=mRt(b,m),T=C.width/r,I=C.height/r):T=I=0;let E=P;return E.bbox=C,n=null,lRt(t.drawImageWidth,t.drawImageHeight,"mm",{width:T},E)}function TRt(o,t){o.forEach(function(e){var r=e.values;switch(e.type){case"M":t.moveTo(r[0],r[1]);break;case"L":t.lineTo(r[0],r[1]);break;case"C":t.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case"Z":t.closePath();break;default:break}})}async function bXe(o,t){return new Promise((e,r)=>{let i=document.createElement("canvas"),n=i.getContext("2d"),s=new Image;s.src=o,s.onload=()=>{i.width=s.naturalWidth,i.height=s.naturalHeight+50,n.drawImage(s,0,0,s.naturalWidth,s.naturalHeight),n.font="bold 50px Arial",n.fillStyle="black",n.textAlign="center",n.fillText(t,i.width/2+82,s.naturalHeight+45);let a=i.toDataURL("image/png");e(a)}})}var IXe=Ru(YR()),AOe=xT(),pC=AOe._MSG_BUS_=AOe._MSG_BUS_||new TXe.MessageBus,Fs=he.messageBus,_5=class o{constructor(){this._origin="SilkViewer";this.initCanvas_2d=!1;this.initCanvas_3d=!1;this._previewOptions={canvasSelector_2d:"#canvas-2d",canvasSelector_3d:"#canvas-3d",renderTimeout_3d:300*100,activeLayerId:3},this._configFPC={holeAvoid:{isAvoid:!1,ext:.1},solderAvoid:{isAvoid:!1,ext:.1},viaAvoid:{isAvoid:!1,ext:.1},padAvoid:{isAvoid:!1,ext:.1}}}static getInstance(){return o._instance||(o._instance=new o),o._instance}getOrigin(){return this._origin}setOrigin(t){this._origin=t}clearInstance(){o._instance=null}resetOptions(t){Object.assign(this._previewOptions,t)}async loadWebJson(t){let e=await this.webJson2DataString(t);return this.loadPcbFile(e)}async loadPcbFile(t){return t?await this.preview_2d(t)?await this.preview_3d(!1)?0:3:2:1}async toggleActiveLayer(t,e=!0){this._previewOptions.activeLayerId=t,Fs.publish("toggleActiveLayerFromSilkView",{layerId:t,isFlip:e}),await this.preview_3d()}measureDistance(){Fs.publish("tool","MeasureDistance")}async partImage(t){let e=await(await Fs.rpcCall("getAllBoardBox")).message,r=e.width(),i=e.height(),n=cje({width:r,height:i},t),s=await this.convertToImageData(t,n,"px(100)");Fs.publish("DrawTrueColorPictureBySilkViewer",s)}async convertToImageData(t,e,r){document.createElement("canvas").getContext("2d").drawImage(t,e.sourceMarginLeft,e.sourceMarginTop,e.sourceImageWidth,e.sourceImageHeight,e.drawMarginLeft,e.drawMarginTop,e.drawImageWidth,e.drawImageHeight);let s=e.drawImageWidth,a=e.drawImageHeight,l=new _he,c=await l.readImageSrcAsBlob(t.src),h=await l.getImageType(c),u=await l.readFileAsDataURL(c,!0);h&&(u=l.replaceDataUrlMineType(u,h)),u=await l.compressImageByCanvas(u,VEe);let p={hashId:await lje(u),dataUrl:u,width:s,height:a,unit:r,base64:t.src};return console.log(p),p}async updateSilkScreenColor(t){Fs.publish("updateSilkScreenColor",t),await this.preview_3d()}async updateSimulation(){return await this.preview_3d()}async saveFile(t){let e=Object.assign({workerJsUrl:t.decodeWorkerJsUrl,silk:!0,flyingProbe:!0,language:"zh-hans",type:"oneKeyExport",unit:"MM",useOldBool:!1,unUseWorkerZip:!0},t),r=await Fs.rpcCall("generateGerberResult",e);return og("saveFile",void 0,r),r.message}async webJson2DataString(t){return(await pC.rpcCall("/pcb/format/toPcb",{source:t})).message}preview_2d(t){return new Promise(async e=>{let{canvasSelector_2d:r,activeLayerId:i}=this._previewOptions;if(!pee(r)){e(!1);return}let s={doctype:23,envFlag:"silk-preview",active:!0,file:t,id:r,ignoreSensors:!0,clearAll:!1,activeLayerId:i};this.initCanvas_2d?await Fs.rpcCall("loadPCB",s):(this.initCanvas_2d=!0,await Fs.rpcCall("rpcInitFrameInfo",s)),Fs.publish("show-all-layer",""),Fs.publish("toggleActiveLayerFromSilkView",{layerId:i||3,isFlip:!1}),Fs.publish("adaptAll",""),e(!0)})}preview_3d(t=!1){return new Promise(async e=>{let{canvasSelector_2d:r,canvasSelector_3d:i,renderTimeout_3d:n}=this._previewOptions,s=pee(i),a=pee(r);if(!s||!a){e(!0);return}let l=(await Fs.rpcCall("/pcb/3d/source",{filterPcbPoly:!1,isColorfulSilk:!0,configFPC:JSON.parse(JSON.stringify(this._configFPC))})).message;if(t)await pC.rpcCall("/pcb/3d/shell/refresh",l);else if(!(await pC.rpcCall("/pcb/3d/load/data",{source:l,renderTimeout_3d:n,isColorfulSilk:!0})).message)return e(!1);let c=(await Fs.rpcCall("/pcb/3d/blob","")).message;await pC.rpcCall("/pcb/3d/load/blob",c);let h=r;await pC.rpcCall("/pcb/3d/sync/3dview",[h,h,23,"silk-preview"]);let u=this._previewOptions.activeLayerId==3?"top":"bottom";await pC.publish("toggle3DView",{cmd:u}),this.initCanvas_3d||(pC.publish("3DViewModifyAttr",{key:"attr-silk-technology",value:"colorfulSilk"}),this.initCanvas_3d=!0),e(!0)})}async placeQRCode(t){let{img:e,text:r,imgSize:i,textSize:n,hasPosition:s,imgPosition:a,textPosition:l,layerId:c,rotation:h,textDirection:u,qrCodeRotation:d,plainCodeRotation:p}=t,m=await(await Fs.rpcCall("getAllBoardBox")).message,g={};if(e){let y=m.width(),b=m.height(),{width:P,height:T,unit:I}=Cq(i),C=new Image;C.src=e;let E=vhe({width:y,height:b},C,{width:P,height:T}),O=await this.convertToImageData(C,E,I);if(!s){let x=m.center();if(a){let v=Bs.conversion("mm","mil",a.x)/10,D=Bs.conversion("mm","mil",a.y)/10;x=new S(v,D)}O.position=x}O.layerId=c;let _=d||h;O.qrCodeRotation=_&&-parseFloat(_.toString())/180*Math.PI,g.imageData=O}if(r){let y={};y.text=r;let{width:b,height:P,unit:T}=Cq(n);if(y.width=b,y.height=P,y.unit=T,y.textDirection=u,!s){let C=m.center();if(l){let E=Bs.conversion("mm","mil",l.x)/10,O=Bs.conversion("mm","mil",l.y)/10;C=new S(E,O)}y.position=C}y.layerId=c;let I=p||h;y.plainCodeRotation=I&&-parseFloat(I.toString())/180*Math.PI,g.textData=y}Fs.publish("PlaceQRCodeBySilkViewer",g)}async updateQRCodeSize(t){let{imgSize:e,textSize:r}=t;if(!e&&!r)return;let i=e&&Cq(e)||null,n=r&&Cq(r)||null;Fs.publish("updateQRCodeSize",{img:i,text:n})}settingtextDirection(t){Fs.publish("updateTextDirection",t)}async getQRCodePosition(){return await(await Fs.rpcCall("getQRCodePosition")).message}async checkQRCodePos(t){await Fs.rpcCall("pcb/setCheckingQRCode",t)}async getCounterBoreData(){return await(await Fs.rpcCall("getCounterBoreData")).message}async getDiagram(){return await(await Fs.rpcCall("getDiagram")).message}async getCommentInfo(){return await(await Fs.rpcCall("getCommentInfo")).message}async getResultData(){if(["QRCodeViewer","ULViewer"].includes(this._origin)){let t=await this.getQRCodePosition(),e=await this.getCounterBoreData(),r=await(await Fs.rpcCall("getULData")).message,i=await this.getDiagram();return JSON.stringify({qrCodeInfo:t,counterBoreData:e,ulData:r,diagram:i})}}listenQRcodeSize(t){Fs.subscribe("changeQRCodeSize",e=>{t(e)})}listenCounterBore(t){Fs.subscribe("transCounterBore",e=>{t(e)})}listenUpdateCode(t){Fs.subscribe("updateCode",e=>{setTimeout(()=>{t(e)},50)})}listInitQRCounterBore(t){Fs.subscribe("initQRCounterBore",e=>{t(e)})}async getFPCCollect(){return await(await Fs.rpcCall("getFPCCollect")).message}async initQRCounterBore(t){if(typeof t=="string"&&(t=JSON.parse(t)),["QRCodeViewer","ULViewer"].includes(this._origin)){let{qrCodeInfo:e,counterBoreData:r}=t;if(e){let{layerId:i,qrCodeBbox:n,rotation:s,qrCodeSize:a,qrCode:l,qrCodeStart:c,plainCodeBbox:h,plainCode:u,plainCodeSize:d,plainCodePosition:p,direction:m}=e,g={},y,b;n&&(y=this.getBBoxByPosition(n),n.rotation&&(g.qrCodeRotation=n.rotation)),h&&(b=this.getBBoxByPosition(h),h.rotation&&(g.plainCodeRotation=h.rotation)),l&&u&&(g.textDirection=m),l&&this.queryParam(l,y,a,g,"img",c),u&&this.queryParam(u,b,d,g,"text",p),(l||u)&&(g.hasPosition=!1,g.layerId=i,g.rotation=s||0,await this.placeQRCode(g))}r&&r.length&&Fs.publish("initCounterBore",r),Fs.publish("initQRCounterBore",!0)}}getBBoxByPosition(t){let e,{leftDown:r,leftUp:i,rightUp:n,rightDown:s}=t,a=Math.min(r.x,i.x,n.x,s.x),l=Math.min(r.y,i.y,n.y,s.y),c=Math.max(r.x,i.x,n.x,s.x),h=Math.max(r.y,i.y,n.y,s.y);return e={minX:a,minY:l,maxX:c,maxY:h},e}queryGroupBbox(t,e){let r=new _e;return r.ext5(t.minX,t.maxX,t.minY,t.maxY),r.ext5(e.minX,e.maxX,e.minY,e.maxY),r.build()}queryParam(t,e,r,i,n,s){i[`${n}`]=t;let{minX:a,minY:l,maxX:c,maxY:h}=e;i[`${n}Size`]=r,i[`${n}Position`]=s}async updateSelectedCounterBore(t){return await(await Fs.rpcCall("updateSelectedCounterBore",t)).message}async deleteCounterBore(t){return await(await Fs.rpcCall("deleteCounterBore",t)).message}async placeULLogo(t){let e=await(await Fs.rpcCall("getAllBoardBox")).message,r=e.width(),i=e.height();if(t.center){let a=Bs.conversion("mm","mil",t.center.x)/10,l=Bs.conversion("mm","mil",t.center.y)/10;t.center=new S(a,l)}else t.center=e.center();let n=await bXe(t.img,t.text),s=new Image;s.src=n,t.width&&(t.width=Sq(t.width,"mm")),t.height&&(t.height=Sq(t.height,"mm")),t.rotation&&(t.rotation=-(parseFloat(t.rotation.toString())/180)*Math.PI),s.onload=()=>{let a=yXe(s,r,i,t.width,t.height);Fs.publish("DrawImage",{...a,...t})}}updateULSize(t){t.width&&(t.width=Sq(t.width,"mm")),t.height&&(t.height=Sq(t.height,"mm")),Fs.publish("updateULSize",t)}updateRotation(t){let e;typeof t.rotation=="number"?e=-parseFloat(t.rotation.toString())/180*Math.PI:e={QRCodeAngle:-parseFloat(t.rotation.QRCodeAngle.toString())/180*Math.PI,plainCodeAngle:-parseFloat(t.rotation.plainCodeAngle.toString())/180*Math.PI},Fs.publish("updateRotation",{angle:e,type:t.type})}cancelPlace(){Fs.publish("cancelPlace")}openStiffenerLayer(){pC.publish("3DViewModifyAttr",{key:"attr-board-material",value:"substrate_fpc"}),this.setOrigin("FPCViewer"),Fs.publish("checkOpenStiffenerLayer","")}drawFPCStiffener(t){switch(t){case"Rect":Fs.publish("draw(RectFPCStiffener)");break;case"Circle":Fs.publish("draw(CirFPCStiffener)");break;case"Polygon":Fs.publish("draw(PolyFPCStiffener)");break;default:break}}listenFPCSize(t){Fs.subscribe("changeFPCSize",e=>{t(e)})}listenCheckFPC(t){Fs.subscribe("changeCheckFPCComponent",e=>{t(e)})}settingFPCComponent(t){Fs.publish("updateFPCComponent",t)}polarSetting(t){Fs.publish("PolarGridSetting",t)}gridSetting(t){Fs.publish("GridSetting",t)}switchGridType(t){Fs.publish("switchGridType",t),he.publish("switchGridTypeBtn",t,window.top)}switchCoordinate(t){Fs.publish("switchCoordinate",t)}avoidFPCSetting(t){this._configFPC=t}async exprotData(){let t={drillMap:["PTH","NPTH"],drillTable:!1,fileName:"Gerber_PCB.zip",fileUuid:"6c33564569f3e6e5@13bf9bd67ec047c4969ae169902a8977",flyingProbe:!1,format:{Integer:"3",Decimals:"6"},language:"zh-hans",layerConfigs:[{layerId:58,isMirror:!1},{layerId:59,isMirror:!1}],mainVersion:"dev",objectConfigs:["FPCStiffener"],silk:!1,title:"PCB1",unit:"IN",useOldBool:!1,userUuid:"8396956ad23840d2ae857110ee25cf3b"},e=(await Fs.rpcCall("generateGerberResult",t)).message.data,r=await IXe.default.loadAsync(await e);await pC.rpcCall("/engine/camera/setDirect",["0",!0]);let i=(await pC.rpcCall("/engine/capture/png",["0",{fixedWidth:2160,watermarkConfig:null}])).message;await pC.rpcCall("/engine/camera/setDirect",["0",!1]);let n=(await pC.rpcCall("/engine/capture/png",["0",{fixedWidth:2160,watermarkConfig:null}])).message;r.file("Gerber_TopStiffenerLayer_pit_0.2.png",i),r.file("Gerber_BottomStiffenerLayer_pib_0.2.png",n);let s=await r.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:6}}),a=(await Fs.rpcCall("/pcb/3d/source",{filterPcbPoly:!1,isColorfulSilk:!0,configFPC:JSON.parse(JSON.stringify(this._configFPC))})).message,l=await this.getFPCCollect();return{gerberData:s,webData:a,fpcData:l}}};AOe.SilkViewerAPI=_5;var CXe=1.5,upe=class extends Oo{constructor(){super();this.isMouseRightDown=!1;this.prevRightX=0;this.prevRightY=0;this.isMouseMidDown=!1;this.prevMidY=0;this.zoomCenter=Dt.ORIGIN;this.lastClickX=null;this.lastClickY=null;this.camera=Ai(),this.setNextTool(new Vc),A.subscribe("adaptAll",()=>{if(!(!R.getInstance().isactive||23!=R.getInstance().doctype)){if(kt.size()>0){let e=Kc(),r=new _e;e.forEach(n=>{if(n.isVisible){if(n instanceof lr&&n.getText()=="")return;r.ext1(n.buildBBox())}});let i=Pi.getBBox();if(i instanceof ht&&r.ext1(i),oa){let n=oa.buildBox();if(r.ext1(n),r.valid()){let s=r.build1();XT(this.camera,s,.8)}}else if(r.valid()){let n=r.build1();XT(this.camera,n,.8)}}A.publish("updateFrame","")}}),A.subscribe("adaptBBox",(e,r=.8)=>{XT(this.camera,e,r),A.publish("updateFrame","")}),A.subscribe("show-all-layer",()=>{let e=Pe.layerMap||{};for(let r in e){let i=e[r];i.visible=!0}}),A.subscribe("toggleActiveLayerFromSilkView",e=>{let{layerId:r,isFlip:i}=e,n=["FPCViewer"].includes(_5.getInstance().getOrigin());this.toggleActiveLayerFromSilkView(r),i?this.flip():Pe.setActiveLayerId(r),n&&(It.getInstance().flip?Pe.setActiveLayerId(59):Pe.setActiveLayerId(58)),A.publish("toggleQRCodeLayer",r),Qb.getInstance().onMouseWheel();let s=Bp.getInstance().image;if(s){let a=s.center;s.layerId=r,s.center=a}}),A.messageBus.rpcService("getAllBoardBox",()=>sV()||of()),A.subscribe("initCounterBore",e=>{Qb.getInstance().initEditedItems(e),A.publish("updateFrame","")}),A.messageBus.rpcService("updateSelectedCounterBore",e=>{let r=Qb.getInstance().updateSelectedCounterBore(e);return A.publish("updateFrame",""),r}),A.messageBus.rpcService("deleteCounterBore",e=>{let r=Qb.getInstance().deleteEditedCounterBore(e);return A.publish("updateFrame",""),r}),A.subscribe("cancelPlace",()=>{this.nextTool!==null&&(this.nextTool instanceof Yr||this.nextTool instanceof Bp)&&this.nextTool.cancel()})}flip(){!R.getInstance().isactive||23==R.getInstance().doctype||(It.getInstance().flip=!It.getInstance().flip,this.camera.setCameraDirect(!It.getInstance().flip),A.publish("updateFrame",""),we.flipBoard=It.getInstance().flip,It.getInstance().flip?Pe.setActiveLayerId(4):Pe.setActiveLayerId(3))}onKeyDown(e){A.publish("pcb_hotkey",{keyCode:e.keyCode,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey},Q())}onKeyUp(e){let r=di.getScene(),i=tr.getAction(r,e);if(R.getInstance().envFlag=="silk-preview"&&e.keyCode==32){let s=ze.getItems();(s.includes(Yr.QRCode)||s.includes(Yr.plainCode)||s.includes(Bp.getInstance().image))&&(i="rotate_right")}switch(i){case"Delete Selected":A.publish("removeSelect","");break;case"rotate_right":A.publish("rotation",-le.pcbConfig.rotate);break;case"Rotate Left":A.publish("rotation",le.pcbConfig.rotate);break;case"Undo":{A.publish("undo","");break}case"Redo":{A.publish("redo","");break}}}onMouseRightDown(e){this.prepare(e),e.realSceneDeltaX=0,e.realSceneDeltay=0,e.rightDown=!0,e.openMenu=!0,e.downTime=new Date().getTime(),this.isMouseRightDown=!0,this.prevRightX=e.mouseX,this.prevRightY=e.mouseY,this.handler(r=>{r.onMouseRightDown(e)})}onMouseLeftDown(e){this.prepare(e),e.leftDown=!0,e.leftClick=!0,e.downTime=new Date().getTime(),this.handler(r=>{r.onMouseLeftDown(e)}),TT.getInstance().isQr()&&Qb.getInstance().onMouseLeftDown(e)}onMouseLeftUp(e){this.prepare(e),this.handler(r=>{r.onMouseLeftUp(e)}),e.leftDown=!1,e.leftClick=!1}onMouseRightUp(e){this.prepare(e),this.isMouseRightDown=!1,this.handler(r=>{r.onMouseRightUp(e)}),e.rightDown=!1,e.openMenu=!1}onMouseMove(e){let r=new Date().getTime();if(this.isMouseRightDown){let i=e.mouseX-this.prevRightX,n=e.mouseY-this.prevRightY;this.camera.addOffset1(i,n),this.prevRightX=e.mouseX,this.prevRightY=e.mouseY}if(this.isMouseMidDown){let n=1-(e.mouseY-this.prevMidY)/e.canvasHeight*20;n<0&&(n=1),this.setScale(n),this.prevMidY=e.mouseY}this.prepare(e),e.rightDown&&r-e.downTime<120?e.openMenu=!0:e.rightDown&&(e.realSceneDeltaX!=0||e.realSceneDeltay!=0)&&(e.openMenu=!1),e.rightDown&&TT.getInstance().isQr()&&Qb.getInstance().onMouseWheel(),oa&&oa.onMouseMove(e),this.handler(i=>{i.onMouseMove(e)}),TT.getInstance().isQr()&&Qb.getInstance().onMouseMove(e)}onMouseWheel(e){this.prepare(e);let r;e.deltaY<0?r=CXe:r=1/CXe,this.markZoomCenter(e),this.setScale(r),this.prepare(e),this.handler(i=>{i.onMouseWheel(e)}),TT.getInstance().isQr()&&Qb.getInstance().onMouseWheel()}onResize(e){R.getInstance().resize()}prepare(e){if(!e)return;e.lastSceneX=e.sceneX,e.lastSceneY=e.sceneY;let r=this.mouseRealOffset(e);e.realSceneDeltaX=r.x-e.realSceneX,e.realSceneDeltay=r.y-e.realSceneY,e.realSceneX=r.x,e.realSceneY=r.y,e.sceneDeltaX=r.x-e.sceneX,e.sceneDeltaY=r.y-e.sceneY,e.sceneX=r.x,e.sceneY=r.y,this.camera.setScreenPosition(new S(e.mouseX-e.canvasWidth/2,e.canvasHeight/2-e.mouseY))}markZoomCenter(e){this.zoomCenter=new Dt(e.mouseX,e.mouseY,0)}setScale(e){let r=this.camera.getScale();!isNaN(r)&&r!=0&&this.camera.scaleAtPoint1(e,this.zoomCenter.x,this.zoomCenter.y)}mouseRealOffset(e){let r=new Dt(e.mouseX,-e.mouseY,0),i=new Dt(e.canvasWidth/2,-e.canvasHeight/2,0);return r.sub(i).multiply4(this.camera.get2dCameraMatrix().inverse())}toggleActiveLayerFromSilkView(e){let r=[1,3,5,7,9,58],i=[2,4,6,8,10,59],n,s;r.includes(e)&&(n=!0,s=!1),i.includes(e)&&(n=!1,s=!0);for(let a of r)a!=null&&n!=null&&(Pe.getLayer(a).visible=n);for(let a of i)a!=null&&s!=null&&(Pe.getLayer(a).visible=s);A.publish("updateFrame","")}highlightItems(e){if(A.publish("clearSelect",""),e.length==0)return;let r=new Jt;e.forEach(i=>{let n=Ht.getItem(i),s;if(n)n.getItems().forEach(a=>{a.click()});else{if(s=r.getItem(i),!s)return;jt.filter([s]).size>0&&(s instanceof Gi&&Pe.setActiveLayer(Pe.getLayer(s.layerId)),s.click())}}),A.publish("updateFrame","")}};var SXe=17/16,IRt=30,dpe=8,ppe=class extends Oo{constructor(){super();this.mouseLeftDown=!1;this.mouseRightDown=!1;this.mouseMidDown=!1;this.prevMouseX=-1;this.prevMouseY=-1;this.ctrlWheel=!1;this.bAltBlockCamera=!1;if(this.camera=Ai(),this.canvas=this.camera.getCanvas(),!this.canvas)throw new Error("Camera canvas error")}onKeyDown(e){}onKeyUp(e){}onMouseLeftDown(e){this.mouseLeftDown=!0,this.prevMouseX=e.mouseX,this.prevMouseY=e.mouseY}onMouseMidDown(e){this.mouseMidDown=!0,this.prevMouseX=e.mouseX,this.prevMouseY=e.mouseY}onMouseRightDown(e){this.mouseRightDown=!0,this.prevMouseX=e.mouseX,this.prevMouseY=e.mouseY}onMouseLeftUp(e){this.mouseLeftDown=!1}onMouseMidUp(e){this.mouseMidDown=!1}onMouseRightUp(e){this.mouseRightDown=!1}rotateCamera(e,r,i,n,s){let a=this.canvas.getBoundingClientRect(),l=a.top,c=a.left,h=new ht(-1,1,-1,1),u=(r-c)/this.canvas.clientWidth*2-1,d=-((i-l)/this.canvas.clientHeight*2-1);u=(u-h.minX)/h.width()*2-1,d=(d-h.minY)/h.height()*2-1;let p=e.getTar2Pos().z>0,m=n-r,g=s-i;e.rotateH(m/this.canvas.clientWidth/h.width()*2*(1-Math.abs(d))*dpe),e.rotateP(m/this.canvas.clientWidth/h.width()*2*d*dpe),e.rotateV(g/this.canvas.clientHeight/h.height()*2*(1-Math.abs(u))*dpe),e.rotateP(g/this.canvas.clientHeight/h.height()*2*u*dpe),e.getTar2Pos().z>0}onMouseMove(e){if(this.mouseLeftDown)this.rotateCamera(this.camera,this.prevMouseX,this.prevMouseY,e.mouseX,e.mouseY);else if(this.mouseRightDown){let r=e.mouseX-this.prevMouseX,i=e.mouseY-this.prevMouseY;this.camera.addOffset1(r,i)}else e.leftDown;this.prevMouseX=e.mouseX,this.prevMouseY=e.mouseY}onMouseLeave(e){}onMouseOut(e){}onMouseEnter(e){}onMouseOver(e){}onMouseWheel(e){this.bAltBlockCamera&&e.altKey||(this.ctrlWheel?e.ctrlKey?this.scale(e,this.camera):e.shiftKey?this.moveX(e,this.camera):this.moveY(e,this.camera):e.ctrlKey?this.moveY(e,this.camera):e.shiftKey?this.moveX(e,this.camera):Math.abs(e.deltaX)>Math.abs(e.deltaY)?this.moveX2(e,this.camera):this.scale(e,this.camera))}scale(e,r){let i=e.altKey?SXe:(SXe-1)*8+1,n=1,s=ne.greatereq(Math.abs(e.deltaY)/IRt,1)?1:.01;if(e.deltaY>0?n=1-(1-1/i)*s:n=1+(i-1)*s,r.isOrthCamera()){let a=this.canvas.getBoundingClientRect(),l=a.top,c=a.left;r.scaleAtPoint(n,(e.mouseX-c)/this.canvas.clientWidth*2-1,-((e.mouseY-l)/this.canvas.clientHeight*2-1))}else r.setScale(r.limitScale(n)*r.getScale())}moveX(e,r){r.addOffset(new Dt(e.deltaY>0?this.canvas.width/10:-this.canvas.width/10,0,0).scale(1/r.getScale()))}moveY(e,r){r.addOffset(new Dt(0,e.deltaY>0?-this.canvas.height/10:this.canvas.height/10,0).scale(1/r.getScale()))}moveX2(e,r){r.addOffset(new Dt(e.deltaX,0,0).scale(1/r.getScale()))}onDoubleClick(e){}onResize(e){}interrupt(){}restore(){}parse(e){}};var EXe,OXe,CRt=new URLSearchParams((OXe=(EXe=Q())==null?void 0:EXe.location)==null?void 0:OXe.search).get("pcb3d")!=null,mf=new zue(QA);mf.install();function AXe(){if(R.getInstance().envFlag=="cnc-preview")mf.setNextTool(new Hue),R.getInstance().openRuler=!1,he.publish("updateFrame","");else if(R.getInstance().envFlag=="silk-preview"){R.getInstance().openRuler=!1;let o=new upe;mf.setNextTool(o),new Lhe(o),he.publish("updateFrame","")}else if(R.getInstance().doctype===23)mf.setNextTool(new hpe),R.getInstance().openRuler=!1,he.publish("updateFrame","");else{let o=R.getInstance().openRuler,t=new Ode;if(mf.setNextTool(t),new cpe(t),CRt){let e=new ppe;he.subscribe("previewTool",r=>{let i=Ai();i.is2D()?(R.getInstance().openRuler=!1,It.getInstance().renderGrid=!1,i.setCameraType(!1),i.setRotatable(!0),i.setObjectByBBox3(R.getInstance().getSceneBbox()),mf.setNextTool(e)):(i.setCameraDirect(!0),i.setCameraType(!0),i.setRotatable(!1),i.setObject(Dt.ORIGIN,Ebe),R.getInstance().openRuler=o,It.getInstance().renderGrid=!0,mf.setNextTool(t))})}}}function JG(o,t,e=!0){if(e)if(o instanceof mt)o.start=t;else{let r=o.end,i=o.endAngle,n=o.startAngle,s=o.sweep,a;s==ae.CW?a=(i-n-kr)%kr:a=(i-n+kr)%kr;let l=new Yn,{center:c,radius:h,startAngle:u,endAngle:d,sweep:p}=l.pointToAngle(t,r,a);o.center=c,o.radius=h,o.startAngle=u,o.endAngle=d,o.sweep=p}else if(o instanceof mt)o.end=t;else{let r=o.start,i=o.endAngle,n=o.startAngle,s=o.sweep,a;s==ae.CW?a=(i-n-kr)%kr:a=(i-n+kr)%kr;let l=new Yn,{center:c,radius:h,startAngle:u,endAngle:d,sweep:p}=l.pointToAngle(r,t,a);o.center=c,o.radius=h,o.startAngle=u,o.endAngle=d,o.sweep=p}}var sp=re.getInstance(),Hqa=new Uue,gE=class extends kl{constructor(){super(...arguments);this.isSetByDialog=!1;this.selects=new Array;this.lineloop=null;this.addCustomCount=0;this.hasNonSignalLayerItem=!1}set(e){return this.lineloop=e,this}getHtmlData(e){var p,m;if(e instanceof mt||e instanceof _t){let g=e.getParent();this.idList.push(g?g.globalIndex:e.globalIndex)}else this.idList.push(e.globalIndex);this.count++;let r=R.getInstance().unit;this.selects.length=0;let i=Ht.getCombin();if(e instanceof lt){this.selects=e.getSelects();let g=e.onlyOneChilds();g!=null&&(e=g)}else(e instanceof mt||e instanceof _t)&&this.selects.push(e);this.hasNonSignalLayerItem||(this.hasNonSignalLayerItem=!Pe.getLayer(e.layerId).isSignalLayer());let n=R.getInstance().origin;this.attrlist==null&&(this.attrlist={});let s=this.attrlist,a=null,l=null,c=null,h=e.globalIndex,u=((p=e.getParent())==null?void 0:p.globalIndex)||h,d=["Copper Region"];if((e instanceof mt||e instanceof _t)&&(h=e.globalIndex),e instanceof mt||e instanceof _t){let g=!1,y=e.getParent();if(y instanceof lt&&y.onlyOneChilds()!=null&&e instanceof mt&&(g=!0),s["attr-layerid"]==null||s["attr-layerid"].value!=Ve){let P=Un.createLayerOptionsByLineloop(e,s["attr-layerid"]?s["attr-layerid"].options:[]);s["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",y.layerId),options:Un.fixLayerOptions(e.layerId,P)}}(s["attr-combination"]==null||s["attr-combination"].value!=Ve)&&(s["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",Ht.getGroupNameByGroupId(y.getGroupID())||""),options:i});let b=this.getTypes(y.type);(s["attr-2dline-type"]==null||s["attr-2dline-type"].value!=Ve)&&(s["attr-2dline-type"]={title:"Type",value:this.getCompareValue("attr-2dline-type",y.type),options:this.get2DLineTypeOption(g),types:b}),l=y.type,d.includes(l)||(s["attr-stroke-width"]==null||s["attr-stroke-width"].value!=Ve)&&(s["attr-stroke-width"]={title:"Stroke Width",value:this.getCompareValue("attr-stroke-width",je(y.strokeWidth,4,r,this.unitConversion))}),c=y.net,R.getInstance().doctype==3&&(s["attr-select-net"]==null||s["attr-select-net"].value!=Ve)&&(s["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",y.showNet),options:this.poolCache.allNetOptions||Ye.getNet()}),(s["attr-locked"]==null||s["attr-locked"].value!=Ve)&&(s["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",y.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),(s["attr-id"]==null||s["attr-id"].value!=Ve)&&(s["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${Tr}${y.number}`),sourceId:y.globalIndex}),a=y.getComponent(),this.getSilkColor(y,s)}else{let g=!1;if(e instanceof lt&&e.onlyOneChilds()instanceof mt&&(g=!0),s["attr-layerid"]==null||s["attr-layerid"].value!=Ve){let P=Un.createLayerOptionsByLineloop(e,s["attr-layerid"]?s["attr-layerid"].options:[]);s["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:Un.fixLayerOptions(e.layerId,P)}}(s["attr-combination"]==null||s["attr-combination"].value!=Ve)&&(s["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",Ht.getGroupNameByGroupId(e.getGroupID())||""),options:i});let y=this.getTypes(e.type);(s["attr-2dline-type"]==null||s["attr-2dline-type"].value!=Ve)&&(s["attr-2dline-type"]={title:"Type",value:this.getCompareValue("attr-2dline-type",e.type),options:this.get2DLineTypeOption(g),types:y}),l=e.type,d.includes(l)||(s["attr-stroke-width"]==null||s["attr-stroke-width"].value!=Ve)&&(s["attr-stroke-width"]={title:"Stroke Width",value:this.getCompareValue("attr-stroke-width",je(e.strokeWidth,4,r,this.unitConversion))});let b=0;e instanceof lt&&(b=e.outlineLength(),(s["attr-length"]==null||s["attr-length"].value!=Ve)&&(s["attr-length"]={title:"Length",value:this.getCompareValue("attr-length",je(b,4,r,this.unitConversion))})),c=e.net,R.getInstance().doctype==3&&(s["attr-select-net"]==null||s["attr-select-net"].value!=Ve)&&(s["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",e.showNet),options:this.poolCache.allNetOptions||Ye.getNet(),disable:R.getInstance().doctype==3}),(s["attr-locked"]==null||s["attr-locked"].value!=Ve)&&(s["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",e.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),(s["attr-id"]==null||s["attr-id"].value!=Ve)&&(s["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${Tr}${e.number}`),sourceId:e.globalIndex}),a=e.getComponent(),this.getSilkColor(e,s)}if(a!=null){if(a instanceof Fu)(s["attr-prohibit-device"]==null||s["attr-prohibit-device"].value!=Ve)&&(s["attr-prohibit-device"]={title:"Prohibit Device",value:this.getCompareValue("attr-prohibit-device",a.device)}),(s["attr-prohibit-fill"]==null||s["attr-prohibit-fill"].value!=Ve)&&(s["attr-prohibit-fill"]={title:"Prohibit Fill",value:this.getCompareValue("attr-prohibit-fill",a.fill)}),(s["attr-prohibit-track"]==null||s["attr-prohibit-track"].value!=Ve)&&(s["attr-prohibit-track"]={title:"Prohibit Track",value:this.getCompareValue("attr-prohibit-track",a.track)}),(s["attr-prohibit-plane"]==null||s["attr-prohibit-plane"].value!=Ve)&&(s["attr-prohibit-plane"]={title:"Prohibit Plane",value:this.getCompareValue("attr-prohibit-plane",a.planzone)}),(s["attr-prohibit-copper"]==null||s["attr-prohibit-copper"].value!=Ve)&&(s["attr-prohibit-copper"]={title:"Prohibit Copper",value:this.getCompareValue("attr-prohibit-copper",a.copper)});else if(a instanceof Dh){let g=sp.getRegion(h)||{};if((s["attr-2dline-name"]==null||s["attr-2dline-name"].value!=Ve)&&(s["attr-2dline-name"]={title:"Name",value:this.getCompareValue("attr-2dline-name",a.name)}),s["attr-constraint-safe"]==null||s["attr-constraint-safe"].value!=Ve){let y=this.getRuleOptions("safe"),b;g.safeClearance&&(b=sp.getSafeSpacing(g.safeClearance).name),s["attr-constraint-safe"]={title:"Safe Clearance Name",value:this.getCompareValue("attr-constraint-safe",b),options:y}}if((s["attr-constraint-other"]==null||s["attr-constraint-other"].value!=Ve)&&(s["attr-constraint-other"]={title:"Other Clearance Name",value:this.getCompareValue("attr-constraint-other",g.otherClearance),options:this.getRuleOptions("other")}),s["attr-constraint-creepage"]==null||s["attr-constraint-creepage"].value!=Ve){let y=this.getRuleOptions("creepage"),b;g.creepageClearance&&(b=sp.getCreepageSpacing(g.creepageClearance).name),s["attr-constraint-creepage"]={title:"Creepage Clearance Name",value:this.getCompareValue("attr-constraint-creepage",b),options:y}}(s["attr-constraint-track"]==null||s["attr-constraint-track"].value!=Ve)&&(s["attr-constraint-track"]={title:"Track Name",value:this.getCompareValue("attr-constraint-track",g.track),options:this.getRuleOptions("track")}),(s["attr-constraint-diff"]==null||s["attr-constraint-diff"].value!=Ve)&&(s["attr-constraint-diff"]={title:"Diff Name",value:this.getCompareValue("attr-constraint-diff",g.diff),options:this.getRuleOptions("diff")}),(s["attr-constraint-radius"]==null||s["attr-constraint-radius"].value!=Ve)&&(s["attr-constraint-radius"]={title:"Radius Name",value:this.getCompareValue("attr-constraint-radius",g.radius),options:this.getRuleOptions("radius")}),(s["attr-constraint-copper"]==null||s["attr-constraint-copper"].value!=Ve)&&(s["attr-constraint-copper"]={title:"Copper Name",value:this.getCompareValue("attr-constraint-copper",g.copperPlane),options:this.getRuleOptions("copper")}),(s["attr-constraint-plane"]==null||s["attr-constraint-plane"].value!=Ve)&&(s["attr-constraint-plane"]={title:"Plane Name",value:this.getCompareValue("attr-constraint-plane",g.innerPlane),options:this.getRuleOptions("plane")})}else if(a instanceof xn){(s["attr-2dline-name"]==null||s["attr-2dline-name"].value!=Ve)&&(s["attr-2dline-name"]={title:"Name",value:this.getCompareValue("attr-2dline-name",a.name)}),(s["attr-copper-fill-style"]==null||s["attr-copper-fill-style"].value!=Ve)&&(s["attr-copper-fill-style"]={title:"Fill Style",value:this.getCompareValue("attr-copper-fill-style",a.style),options:Uke()});let g=a.style=="solid";(s["attr-copper-line-width"]==null||s["attr-copper-line-width"].value!=Ve)&&(s["attr-copper-line-width"]={title:"Line Width",value:this.getCompareValue("attr-copper-line-width",je(a.gridLineWidth,4,r,this.unitConversion)),show:!g}),(s["attr-copper-line-spacing"]==null||s["attr-copper-line-spacing"].value!=Ve)&&(s["attr-copper-line-spacing"]={title:"Lineine Spacing",value:this.getCompareValue("attr-copper-line-spacing",je(a.clearance,4,r,this.unitConversion)),show:!g}),(s["attr-isolated-island"]==null||s["attr-isolated-island"].value!=Ve)&&(s["attr-isolated-island"]={title:"Isolated Island",value:this.getCompareValue("attr-isolated-island",a.keepIsland?"yes":"no")}),(s["attr-manufacture-optimization"]==null||s["attr-manufacture-optimization"].value!=Ve)&&(s["attr-manufacture-optimization"]={title:"Manufacture Optimization",value:this.getCompareValue("attr-manufacture-optimization",a.optimization?"yes":"no")}),(s["attr-manufacture-optimization-value"]==null||s["attr-manufacture-optimization-value"].value!=Ve)&&(s["attr-manufacture-optimization-value"]={title:"Manufacture Optimization Value",value:this.getCompareValue("attr-manufacture-optimization-value",je(a.optimizationValue,4,r,this.unitConversion))});let y=sp.getRegion(h),b=y&&y.safeClearance?"2":"1";(s["attr-planezone-net-rule-type"]==null||s["attr-planezone-net-rule-type"].value!=Ve)&&(s["attr-planezone-net-rule-type"]={title:"Planezone Net Rule Type",value:this.getCompareValue("attr-planezone-net-rule-type",b)});let P=this.getSpacingRule(b,c,h);(s["attr-net-spacing-rule"]==null||s["attr-net-spacing-rule"].value!=Ve)&&(s["attr-net-spacing-rule"]={title:"Net Spacing Rule",value:this.getCompareValue("attr-net-spacing-rule",P.name),options:this.getRuleOptions("safe")});let T=x=>x.map(v=>P.getClearance(7,v)).map(v=>(r!="mil"?v=this.unitConversion.conversion1("mil",r,v*10):v=ve(v*10),v)),I=[11,8],C=T(Wz.filter(x=>!I.includes(x))),E=T(I);(s["attr-net-spacing-list"]==null||s["attr-net-spacing-list"].value!=Ve)&&(s["attr-net-spacing-list"]={title:"Net Spacing",value:this.getCompareValue("attr-net-spacing-list",C)}),(s["attr-dist-border-outline-list"]==null||s["attr-dist-border-outline-list"].value!=Ve)&&(s["attr-dist-border-outline-list"]={title:"Distance To Border Outline",value:this.getCompareValue("attr-dist-border-outline-list",E)});let O=y&&y.copperPlane?"2":"1";(s["attr-planezone-thermal-rule-type"]==null||s["attr-planezone-thermal-rule-type"].value!=Ve)&&(s["attr-planezone-thermal-rule-type"]={title:"Planezone Net Rule Type",value:this.getCompareValue("attr-planezone-thermal-rule-type",O)});let _=this.getCopperRule(O,c,h);(s["attr-net-thermals-rule"]==null||s["attr-net-thermals-rule"].value!=Ve)&&(s["attr-net-thermals-rule"]={title:"Net Thermals Rule",value:this.getCompareValue("attr-net-thermals-rule",_.name),options:this.getRuleOptions("copper")}),(s["attr-pad-connection"]==null||s["attr-pad-connection"].value!=Ve)&&(s["attr-pad-connection"]={title:"Pad Connection",value:this.getCompareValue("attr-pad-connection",_.getSingleConnectMode(e.layerId))}),(s["attr-spoke-angles"]==null||s["attr-spoke-angles"].value!=Ve)&&(s["attr-spoke-angles"]={title:"Spoke Angles",value:this.getCompareValue("attr-spoke-angles",ve(_.getSingleLineAngle(e.layerId)/Math.PI*180,3))}),(s["attr-spoke-spacing"]==null||s["attr-spoke-spacing"].value!=Ve)&&(s["attr-spoke-spacing"]={title:"Spoke Spacing",value:this.getCompareValue("attr-spoke-spacing",je(_.getSingleLineClearance(e.layerId),4,r,this.unitConversion))}),(s["attr-spoke-width"]==null||s["attr-spoke-width"].value!=Ve)&&(s["attr-spoke-width"]={title:"Spoke Width",value:this.getCompareValue("attr-spoke-width",je(_.getSingleLineWidth(e.layerId),4,r,this.unitConversion))}),(s["attr-multi-layer-pad-connection"]==null||s["attr-multi-layer-pad-connection"].value!=Ve)&&(s["attr-multi-layer-pad-connection"]={title:"Pad Connection",value:this.getCompareValue("attr-multi-layer-pad-connection",_.getMultiConnectMode(e.layerId))}),(s["attr-multi-layer-spoke-angles"]==null||s["attr-multi-layer-spoke-angles"].value!=Ve)&&(s["attr-multi-layer-spoke-angles"]={title:"Spoke Angles",value:this.getCompareValue("attr-multi-layer-spoke-angles",ve(_.getMultiLineAngle(e.layerId)/Math.PI*180,3))}),(s["attr-multi-layer-spoke-spacing"]==null||s["attr-multi-layer-spoke-spacing"].value!=Ve)&&(s["attr-multi-layer-spoke-spacing"]={title:"Spoke Spacing",value:this.getCompareValue("attr-multi-layer-spoke-spacing",je(_.getMultiLineClearance(e.layerId),4,r,this.unitConversion))}),(s["attr-multi-layer-spoke-width"]==null||s["attr-multi-layer-spoke-width"].value!=Ve)&&(s["attr-multi-layer-spoke-width"]={title:"Spoke Width",value:this.getCompareValue("attr-multi-layer-spoke-width",je(_.getMultiLineWidth(e.layerId),4,r,this.unitConversion))}),(s["attr-track-connection"]==null||s["attr-track-connection"].value!=Ve)&&(s["attr-track-connection"]={title:"Track Connection",value:this.getCompareValue("attr-track-connection",_.getTrackConnect(e.layerId))})}else if(a instanceof Zi){if((e.layerId==51||e.layerId==50)&&(s["attr-associated-pad-id"]==null||s["attr-associated-pad-id"].value!=Ve)&&(s["attr-associated-pad-id"]={title:"Associated Pad ID",value:this.getCompareValue("attr-associated-pad-id",a.padId)}),Pe.getAllSignalLayerIds().includes(e.layerId)){(s["attr-is-bridging-copper"]==null||s["attr-is-bridging-copper"].value!=Ve)&&(s["attr-is-bridging-copper"]={title:"Is Bridging Copper",value:this.getCompareValue("attr-is-bridging-copper",a.isBridgingCopper)});let y=(m=s["attr-bridging-copper-netlists"])==null?void 0:m.value,b=y!=null?this.isSameNetlist(y,a.networkList)?y:Ve:a.networkList;(s["attr-bridging-copper-netlists"]==null||s["attr-bridging-copper-netlists"].value!=Ve)&&(s["attr-bridging-copper-netlists"]={title:"Bridging Copper NetLists",value:b})}}else if(a instanceof tu){(s["attr-fpc-stiffener-material"]==null||s["attr-fpc-stiffener-material"].value!=Ve)&&(s["attr-fpc-stiffener-material"]={title:"Material",value:this.getCompareValue("attr-fpc-stiffener-material",a.material),options:td.getMaterialOptions()}),(s["attr-fpc-stiffener-model"]==null||s["attr-fpc-stiffener-model"].value!=Ve)&&(s["attr-fpc-stiffener-model"]={title:"Model",value:this.getCompareValue("attr-fpc-stiffener-model",a.fpcModel),options:td.getModelOptions(),show:a.material==="Tape"});let g=td.getThicknessOptions(a);(s["attr-fpc-stiffener-thickness"]==null||s["attr-fpc-stiffener-thickness"].value!=Ve)&&(s["attr-fpc-stiffener-thickness"]={title:"Thickness",value:this.getCompareValue("attr-fpc-stiffener-thickness",a.thickness),options:g,disabled:this.getCompareDisabledValue("attr-fpc-stiffener-thickness",g.length<=1)})}}if(e instanceof Pr)(s["attr-x"]==null||s["attr-x"].value!=Ve)&&(s["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",je(e.center.x-n.x,4,r,this.unitConversion))}),(s["attr-2dline-outline-type"]==null||s["attr-2dline-outline-type"].value!=Ve)&&(s["attr-2dline-outline-type"]={title:"Outline Type",value:this.getCompareValue("attr-2dline-outline-type",1)}),(s["attr-y"]==null||s["attr-y"].value!=Ve)&&(s["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",je(e.center.y-n.y,4,r,this.unitConversion))}),(s["attr-radius"]==null||s["attr-radius"].value!=Ve)&&(s["attr-radius"]={title:"Radius",value:this.getCompareValue("attr-radius",je(e.radius,4))}),(s["attr-length"]==null||s["attr-length"].value!=Ve)&&(s["attr-length"]={title:"Length",value:this.getCompareValue("attr-length",je(2*e.radius*Math.PI,4,r,this.unitConversion))});else if(e instanceof rr)if(e.isSelectChild()){let g=e.selectChildId/2,y=this.getStart(e,g),b=this.getEnd(e,g);(s["attr-2dline-outline-type"]==null||s["attr-2dline-outline-type"].value!=Ve)&&(s["attr-2dline-outline-type"]={title:"Outline Type",value:this.getCompareValue("attr-2dline-outline-type",3)}),(s["attr-start-x"]==null||s["attr-start-x"].value!=Ve)&&(s["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",je(y.x-n.x,4,r,this.unitConversion))}),(s["attr-start-y"]==null||s["attr-start-y"].value!=Ve)&&(s["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",je(y.y-n.y,4,r,this.unitConversion))}),(s["attr-end-x"]==null||s["attr-end-x"].value!=Ve)&&(s["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",je(b.x-n.x,4,r,this.unitConversion))}),(s["attr-end-y"]==null||s["attr-end-y"].value!=Ve)&&(s["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",je(b.y-n.y,4,r,this.unitConversion))}),(s["attr-line-length"]==null||s["attr-line-length"].value!=Ve)&&(s["attr-line-length"]={title:"Line Length",value:this.getCompareValue("attr-line-length",je(y.distance1(b),4,r,this.unitConversion))})}else(s["attr-2dline-outline-type"]==null||s["attr-2dline-outline-type"].value!=Ve)&&(s["attr-2dline-outline-type"]={title:"Outline Type",value:this.getCompareValue("attr-2dline-outline-type",2)}),(s["attr-start-x"]==null||s["attr-start-x"].value!=Ve)&&(s["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",je(e.start.x-n.x,4,r,this.unitConversion))}),(s["attr-start-y"]==null||s["attr-start-y"].value!=Ve)&&(s["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",je(e.start.y-n.y,4,r,this.unitConversion))}),(s["attr-width"]==null||s["attr-width"].value!=Ve)&&(s["attr-width"]={title:"Width",value:this.getCompareValue("attr-width",je(e.width,4,r,this.unitConversion))}),(s["attr-height"]==null||s["attr-height"].value!=Ve)&&(s["attr-height"]={title:"Height",value:this.getCompareValue("attr-height",je(e.height,4,r,this.unitConversion))}),(s["attr-corner-radius"]==null||s["attr-corner-radius"].value!=Ve)&&(s["attr-corner-radius"]={title:"Corner Radius",value:this.getCompareValue("attr-corner-radius",je(e.cornerRadius,4,r,this.unitConversion))}),(s["attr-rotation"]==null||s["attr-rotation"].value!=Ve)&&(s["attr-rotation"]={title:"Rotation",value:this.getCompareValue("attr-rotation",Yl(ve(e.rotation/Math.PI*180,3)))}),(s["attr-length"]==null||s["attr-length"].value!=Ve)&&(s["attr-length"]={title:"Length",value:this.getCompareValue("attr-length",je(2*(e.width+e.height),4,r,this.unitConversion))});else if(e instanceof mt)(s["attr-length"]==null||s["attr-length"].value!=Ve)&&(s["attr-length"]={title:"Length",value:this.getCompareValue("attr-length",je(e.length,4,r,this.unitConversion))}),(s["attr-2dline-outline-type"]==null||s["attr-2dline-outline-type"].value!=Ve)&&(s["attr-2dline-outline-type"]={title:"Outline Type",value:this.getCompareValue("attr-2dline-outline-type",3)}),(s["attr-start-x"]==null||s["attr-start-x"].value!=Ve)&&(s["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",je(e.start.x-n.x,4,r,this.unitConversion))}),(s["attr-start-y"]==null||s["attr-start-y"].value!=Ve)&&(s["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",je(e.start.y-n.y,4,r,this.unitConversion))}),(s["attr-end-x"]==null||s["attr-end-x"].value!=Ve)&&(s["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",je(e.end.x-n.x,4,r,this.unitConversion))}),(s["attr-end-y"]==null||s["attr-end-y"].value!=Ve)&&(s["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",je(e.end.y-n.y,4,r,this.unitConversion))}),(s["attr-line-length"]==null||s["attr-line-length"].value!=Ve)&&(s["attr-line-length"]={title:"Line Length",value:this.getCompareValue("attr-line-length",je(e.length,4,r,this.unitConversion))});else if(e instanceof _t)if((s["attr-length"]==null||s["attr-length"].value!=Ve)&&(s["attr-length"]={title:"length",value:this.getCompareValue("attr-length",je(e.length,4,r,this.unitConversion))}),(s["attr-2dline-outline-type"]==null||s["attr-2dline-outline-type"].value!=Ve)&&(s["attr-2dline-outline-type"]={title:"Outline Type",value:this.getCompareValue("attr-2dline-outline-type",4)}),(s["attr-arc-type"]==null||s["attr-arc-type"].value!=Ve)&&(s["attr-arc-type"]={title:"Arc Type",value:this.getCompareValue("attr-arc-type",e.arcType)}),(s["attr-arc-length"]==null||s["attr-arc-length"].value!=Ve)&&(s["attr-arc-length"]={title:"Arc Length",value:this.getCompareValue("attr-arc-length",je(e.length,4,r,this.unitConversion))}),e.arcType==1){let g=new Yn,{start:y,end:b,angle:P}=g.angleToPoint(e.center,e.radius,e.startAngle,e.endAngle,e.sweep);(s["attr-start-x"]==null||s["attr-start-x"].value!=Ve)&&(s["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",je(y.x-n.x,4,r,this.unitConversion))}),(s["attr-start-y"]==null||s["attr-start-y"].value!=Ve)&&(s["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",je(y.y-n.y,4,r,this.unitConversion))}),(s["attr-end-x"]==null||s["attr-end-x"].value!=Ve)&&(s["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",je(b.x-n.x,4,r,this.unitConversion))}),(s["attr-end-y"]==null||s["attr-end-y"].value!=Ve)&&(s["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",je(b.y-n.y,4,r,this.unitConversion))}),(s["attr-arc-angle"]==null||s["attr-arc-angle"].value!=Ve)&&(s["attr-arc-angle"]={title:"Arc Angle",value:this.getCompareValue("attr-arc-angle",ve(P/Math.PI*180,3))})}else(s["attr-x"]==null||s["attr-x"].value!=Ve)&&(s["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",je(e.center.x-n.x,4,r,this.unitConversion))}),(s["attr-y"]==null||s["attr-y"].value!=Ve)&&(s["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",je(e.center.y-n.y,4,r,this.unitConversion))}),(s["attr-radius"]==null||s["attr-radius"].value!=Ve)&&(s["attr-radius"]={title:"Radius",value:this.getCompareValue("attr-radius",je(e.radius,4,r,this.unitConversion))}),(s["attr-start-arc-angle"]==null||s["attr-start-arc-angle"].value!=Ve)&&(s["attr-start-arc-angle"]={title:"Start Angle",value:this.getCompareValue("attr-start-arc-angle",ve(e.startAngle/Math.PI*180,3))}),(s["attr-end-arc-angle"]==null||s["attr-end-arc-angle"].value!=Ve)&&(s["attr-end-arc-angle"]={title:"End Angle",value:this.getCompareValue("attr-end-arc-angle",ve(e.endAngle/Math.PI*180,3))});else(s["attr-2dline-outline-type"]==null||s["attr-2dline-outline-type"].value!=Ve)&&(s["attr-2dline-outline-type"]={title:"Outline Type",value:this.getCompareValue("attr-2dline-outline-type",5)});return this}getCompareValue(e,r){if(this.attrlist!=null){let i=this.attrlist[e];if(i!=null&&String(i.value)!=String(r))return Ve}return r}isSameNetlist(e,r){if(e.length==r.length){for(let i of r)if(!e.includes(i))return!1;return!0}return!1}check(e){let r=new Set;if(this.lineloop instanceof mt||this.lineloop instanceof _t){let i=this.lineloop.getParent();this.checkPolygon(e,i,r)}else this.lineloop instanceof lt&&this.checkPolygon(e,this.lineloop,r);return r}checkPolygon(e,r,i){if(e["attr-2dline-type"]!=null){let n=e["attr-2dline-type"];r.type=="Line"&&n!="Line"?dG(r)==3&&i.add("If the figure is not closed, it will be closed automatically after conversion. Do you want to continue?"):["Fill Region","FPC Stiffener"].includes(r.type)&&r.isComplexPolygon()&&i.add([n,"does not support polygons with holes,do you want to split the shape?"])}}getTypes(e){var i;let r=(i=this.attrlist["attr-2dline-type"])==null?void 0:i.types;return r!=null?r.includes(e)||r.push(e):r=[e],r}modifyBy(e,r,i){var c;let n=null,s="",a=this.lineloop.globalIndex,l=((c=this.lineloop.getParent())==null?void 0:c.globalIndex)||a;if(this.lineloop instanceof mt||this.lineloop instanceof _t){let h=this.lineloop.getParent();s=h.net,a=h.globalIndex,this.modifyPolygon(e,h,r,i),n=h.getComponent()}else this.lineloop instanceof lt?(s=this.lineloop.net,this.modifyPolygon(e,this.lineloop,r,i,!1),n=this.lineloop.getComponent()):this.lineloop instanceof Pr?(s=this.lineloop.net,this.modifyCircle(e,this.lineloop,r),n=this.lineloop.getComponent()):this.lineloop instanceof rr&&(s=this.lineloop.net,this.modifyRect(e,this.lineloop,r),n=this.lineloop.getComponent());n!=null&&(n instanceof Fu?this.modifyProhibitComponent(e,n):n instanceof Dh?this.modifyConstraintComponent(e,n,l):n instanceof xn?this.modifyFillComponent(e,n,s,a,l):n instanceof Zi?this.modifyBridgingCopperComponent(e,n,r):n instanceof tu&&this.modifyFPCStiffenerComponent(e,n,r))}modifyCircle(e,r,i){let n=new dt,s=R.getInstance().origin;if(e["attr-2dline-type"]!=null){let a=e["attr-2dline-type"],l=r.type;r.type!==a&&G2(r.model,"delete"),r.type=a,l!==a&&un.changeTypeToPour(r,i)}if(e["attr-layerid"]!=null){let a=r.layerId;if(r.layerId=parseInt(e["attr-layerid"]),r.locked)return;r.net=ru(r.net,r.layerId,r.type),a!=r.layerId&&r.type=="Copper Region"&&un.changeModelLayer(r,a,i)}if(e["attr-stroke-width"]!=null){let a=parseFloat(e["attr-stroke-width"])/10;R.getInstance().unit!="mil"&&(a=n.conversion(R.getInstance().unit,"mil",a)),a>=vc&&(r.strokeWidth=a)}if(e["attr-select-net"]!=null&&Pe.getLayer(r.layerId).isSignalLayer()&&(r.net=ru(e["attr-select-net"],r.layerId,r.type)),e["attr-locked"]!=null&&(r.locked=e["attr-locked"]=="yes"),e["attr-x"]!=null){if(r.locked)return;let a=parseFloat(e["attr-x"])/10;R.getInstance().unit!="mil"&&(a=n.conversion(R.getInstance().unit,"mil",a)),a=a+s.x,r.center=new S(a,r.center.y)}if(e["attr-y"]!=null){if(r.locked)return;let a=parseFloat(e["attr-y"])/10;R.getInstance().unit!="mil"&&(a=n.conversion(R.getInstance().unit,"mil",a)),a=a+s.y,r.center=new S(r.center.x,a)}if(e["attr-radius"]!=null){if(r.locked)return;let a=parseFloat(e["attr-radius"])/10;R.getInstance().unit!="mil"&&(a=n.conversion(R.getInstance().unit,"mil",a)),r.radius=a}if(e["attr-combination"]!=null){if(r.locked)return;let a=this.modifyCombination(e["attr-combination"],r);i&&a.forEach(l=>{i.addCommand(l)})}e["attr-silk-color"]!=null&&(e["attr-silk-color"]===""||e["attr-silk-color"]==="none"?r.silkColor=null:r.silkColor=ee.of3(e["attr-silk-color"]))}modifyRect(e,r,i){let n=new dt,s=R.getInstance().origin;if(e["attr-2dline-type"]!=null){if(r.locked)return;let a=r.type,l=e["attr-2dline-type"];r.type!==l&&G2(r.model,"delete"),r.type=l,a!==l&&un.changeTypeToPour(r,i)}if(e["attr-layerid"]!=null){if(r.locked)return;let a=r.layerId;r.layerId=parseInt(e["attr-layerid"]),r.net=ru(r.net,r.layerId,r.type),a!=r.layerId&&r.type=="Copper Region"&&un.changeModelLayer(r,a,i)}if(e["attr-stroke-width"]!=null){if(r.locked)return;let a=parseFloat(e["attr-stroke-width"])/10;R.getInstance().unit!="mil"&&(a=n.conversion(R.getInstance().unit,"mil",a)),a>=vc&&(r.strokeWidth=a)}if(e["attr-rotation"]!=null){if(r.locked)return;let a=parseFloat(e["attr-rotation"])/180*Math.PI;a=this.getValue(a),r.rotation=a}if(e["attr-select-net"]!=null&&Pe.getLayer(r.layerId).isSignalLayer()&&(r.net=ru(e["attr-select-net"],r.layerId,r.type)),e["attr-locked"]!=null&&(r.locked=e["attr-locked"]=="yes"),e["attr-start-x"]!=null){if(r.locked)return;let a=parseFloat(e["attr-start-x"])/10;if(R.getInstance().unit!="mil"&&(a=n.conversion(R.getInstance().unit,"mil",a)),a=a+s.x,r.isSelectChild()){let l=r.selectChildId/2,c=this.getStart(r,l),h=this.getStartCorner(r,l),u=new S(a,c.y);(l===0&&a>r.rightUp.x||l===2&&a<r.leftLow.x)&&r.setSelectChildIdByOver(this.getOverId(r.selectChildId)),this.updateRect(r,h,u)}else r.start=new S(a,r.start.y)}if(e["attr-start-y"]!=null){if(r.locked)return;let a=parseFloat(e["attr-start-y"])/10;if(R.getInstance().unit!="mil"&&(a=n.conversion(R.getInstance().unit,"mil",a)),a=a+s.y,r.isSelectChild()){let l=r.selectChildId/2,c=this.getStart(r,l),h=this.getStartCorner(r,l),u=new S(c.x,a);(l===1&&a<r.rightLow.y||l===3&&a>r.leftUp.y)&&r.setSelectChildIdByOver(this.getOverId(r.selectChildId)),this.updateRect(r,h,u)}else r.start=new S(r.start.x,a)}if(e["attr-end-x"]!=null){if(r.locked)return;let a=parseFloat(e["attr-end-x"])/10;if(R.getInstance().unit!="mil"&&(a=n.conversion(R.getInstance().unit,"mil",a)),a=a+s.x,r.isSelectChild()){let l=r.selectChildId/2,c=this.getEnd(r,l),h=this.getEndCorner(r,l),u=new S(a,c.y);(l===0&&a>r.rightLow.x||l===2&&a<r.leftUp.x)&&r.setSelectChildIdByOver(this.getOverId(r.selectChildId)),this.updateRect(r,h,u)}}if(e["attr-end-y"]!=null){if(r.locked)return;let a=parseFloat(e["attr-end-y"])/10;if(R.getInstance().unit!="mil"&&(a=n.conversion(R.getInstance().unit,"mil",a)),a=a+s.y,r.isSelectChild()){let l=r.selectChildId/2,c=this.getEnd(r,l),h=this.getEndCorner(r,l),u=new S(c.x,a);(l===1&&a<r.leftLow.y||l===3&&a>r.rightUp.y)&&r.setSelectChildIdByOver(this.getOverId(r.selectChildId)),this.updateRect(r,h,u)}}if(e["attr-width"]!=null){if(r.locked)return;let a=n.conversion(R.getInstance().unit,"mil",parseFloat(e["attr-width"])/10);if(a<vc)return;Hb()&&(r.height=r.height/r.width*a),r.width=a}if(e["attr-height"]!=null){if(r.locked)return;let a=n.conversion(R.getInstance().unit,"mil",parseFloat(e["attr-height"])/10);if(a<vc)return;Hb()&&(r.width=r.width/r.height*a),r.height=a}if(e["attr-corner-radius"]!=null){if(r.locked)return;let a=n.conversion(R.getInstance().unit,"mil",parseFloat(e["attr-corner-radius"])/10);a>=0&&(r.cornerRadius=a)}if(e["attr-combination"]!=null){if(r.locked)return;let a=this.modifyCombination(e["attr-combination"],r);i&&a.forEach(l=>{i.addCommand(l)})}e["attr-silk-color"]!=null&&(e["attr-silk-color"]===""||e["attr-silk-color"]==="none"?r.silkColor=null:r.silkColor=ee.of3(e["attr-silk-color"]))}getStartCorner(e,r){switch(r){case 0:return e.rightUp;case 1:return e.rightLow;case 2:return e.leftLow;case 3:return e.leftUp;default:return null}}getEndCorner(e,r){switch(r){case 0:return e.rightLow;case 1:return e.leftLow;case 2:return e.leftUp;case 3:return e.rightUp;default:return null}}getStart(e,r){switch(r){case 0:return e.leftLow;case 1:return e.leftUp;case 2:return e.rightUp;case 3:return e.rightLow;default:return null}}getEnd(e,r){switch(r){case 0:return e.leftUp;case 1:return e.rightUp;case 2:return e.rightLow;case 3:return e.leftLow}}updateRect(e,r,i){let n=Ae.rotateZForPoint(e.getUL(),-e.rotation),s=Ae.rotateZForPoint(e.getUL(),e.rotation);r=r.multiply4(n),i=i.multiply4(n);let a=this.getBBox(r,i);e.setLL(a.LL().multiply4(s)),e.setLR(a.LR().multiply4(s)),e.setUR(a.UR().multiply4(s)),e.setUL(a.UL().multiply4(s))}getBBox(e,r){let i=new _e;return i.ext2(e).ext2(r),i.build1()}getOverId(e){switch(e){case 0:return 4;case 2:return 6;case 4:return 0;case 6:return 2}}modifyPolygon(e,r,i,n,s=!0){let a=R.getInstance().origin,l=new dt;if(e["attr-silk-color"]!=null&&(e["attr-silk-color"]===""||e["attr-silk-color"]==="none"?r.silkColor=null:r.silkColor=ee.of3(e["attr-silk-color"])),e["attr-2dline-type"]!=null){let u=e["attr-2dline-type"],d=r.type;if(["Fill Region","FPC Stiffener"].includes(r.type)&&r.isComplexPolygon()){let p=wV([r],i);p.newPolygons.forEach(g=>{p.groupCommand.addCommand(Ce.dispatch(g,"modify")),g.type=u,A.publish("hasModifyPcbItem",g)}),d!==u&&un.changeTypeToPours(p.newPolygons,i);let m=[].concat(p.newPolygons,ze.getSelects());A.publish("select",Array.from(new Set(m))),A.publish("flushService",""),A.publish("flushSelectingInfo","")}else r.type!==u&&G2(r.model,"delete"),r.type=u,Bu(u)&&r.checkClose(),d!==u&&un.changeTypeToPour(r,i)}if(e["attr-layerid"]!=null){if(r.locked)return;let u=r.layerId;r.layerId=parseInt(e["attr-layerid"]),r.net=ru(r.net,r.layerId,r.type),u!=r.layerId&&r.type=="Copper Region"&&un.changeModelLayer(r,u,i)}if(e["attr-stroke-width"]!=null){if(r.locked)return;let u=parseFloat(e["attr-stroke-width"])/10;R.getInstance().unit!="mil"&&(u=l.conversion(R.getInstance().unit,"mil",u)),u>=vc&&(r.strokeWidth=u)}if(e["attr-select-net"]!=null&&Pe.getLayer(r.layerId).isSignalLayer()&&(r.net=ru(e["attr-select-net"],r.layerId,r.type)),e["attr-locked"]!=null&&(r.locked=e["attr-locked"]=="yes"),e["attr-combination"]!=null){if(r.locked)return;let u=this.modifyCombination(e["attr-combination"],r);i&&u.forEach(d=>{i.addCommand(d)})}let c=r.getSelects();c.length==0&&(c=this.selects),r.onlyOneChilds()!=null&&(c=[r.onlyOneChilds()]);let h=r.isClose();for(let u of c){if(e["attr-start-x"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-start-x"])/10;R.getInstance().unit!="mil"&&(g=l.conversion(R.getInstance().unit,"mil",g)),g=g+a.x,u.start=new S(g,u.start.y)}if(e["attr-start-y"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-start-y"])/10;R.getInstance().unit!="mil"&&(g=l.conversion(R.getInstance().unit,"mil",g)),g=g+a.y,u.start=new S(u.start.x,g)}if(e["attr-length"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-length"])/10;if(R.getInstance().unit!="mil"&&(g=l.conversion(R.getInstance().unit,"mil",g)),g<=0)return;g<vc&&(g=vc),u.length=g}if(e["attr-end-x"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-end-x"])/10;R.getInstance().unit!="mil"&&(g=l.conversion(R.getInstance().unit,"mil",g)),g=g+a.x,u.end=new S(g,u.end.y)}if(e["attr-end-y"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-end-y"])/10;R.getInstance().unit!="mil"&&(g=l.conversion(R.getInstance().unit,"mil",g)),g=g+a.y,u.end=new S(u.end.x,g)}if(u instanceof _t){if(e["attr-arc-type"]!=null){if(r.locked)continue;u.arcType=parseInt(e["attr-arc-type"])}if(e["attr-arc-angle"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-arc-angle"]);if(Math.abs(g)<.001)g=.001;else if(Math.abs(g)>.001){let O=Math.abs(g)%360;O<.001&&O>0?g=.001:(O>359.999||O==0)&&(g=359.999)}let y=g/180*Math.PI,b=new Yn,{center:P,radius:T,startAngle:I,endAngle:C,sweep:E}=b.pointToAngle(u.start,u.end,y);u.center=P,u.radius=T,u.startAngle=I,u.endAngle=C,u.sweep=E}if(e["attr-start-arc-angle"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-start-arc-angle"])/180*Math.PI;u.startAngle=g}if(e["attr-end-arc-angle"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-end-arc-angle"])/180*Math.PI;u.endAngle=g}if(e["attr-x"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-x"])/10;R.getInstance().unit!="mil"&&(g=l.conversion(R.getInstance().unit,"mil",g)),g=g+a.x,u.center=new S(g,u.center.y)}if(e["attr-y"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-y"])/10;R.getInstance().unit!="mil"&&(g=l.conversion(R.getInstance().unit,"mil",g)),g=g+a.y,u.center=new S(u.center.x,g)}if(e["attr-radius"]!=null){if(r.locked)continue;let g=parseFloat(e["attr-radius"])/10;R.getInstance().unit!="mil"&&(g=l.conversion(R.getInstance().unit,"mil",g)),u.radius=g}}if(e["attr-combination"]!=null){if(r.locked)continue;let g=this.modifyCombination(e["attr-combination"],r);i&&g.forEach(y=>{i.addCommand(y)})}let d=r.getConnect(u,!0,s,h),p=r.getConnect(u,!1,s,h);d!=null&&JG(d,u.start,!1),p!=null&&JG(p,u.end);let m=e["attr-is-bridging-copper"];m!==void 0&&(r.model.component=m?r.model.component||new Zi(m):null,Ob(r.model.component))}}modifyProhibitComponent(e,r){r!=null&&(e["attr-prohibit-device"]!=null&&(r.device=e["attr-prohibit-device"]),e["attr-prohibit-track"]!=null&&(r.track=e["attr-prohibit-track"]),e["attr-prohibit-fill"]!=null&&(r.fill=e["attr-prohibit-fill"]),e["attr-prohibit-copper"]!=null&&(r.copper=e["attr-prohibit-copper"]),e["attr-prohibit-plane"]!=null&&(r.planzone=e["attr-prohibit-plane"]))}modifyConstraintComponent(e,r,i){if(e["attr-2dline-name"]!=null){let s=e["attr-2dline-name"];r.name!=s&&iOe("Constraint Region",s)&&r.modifyName(s)}if(sp.getRegion(i)){if(e["attr-constraint-safe"]!=null){if(sp.getRegion(i)==null)return;let l=e["attr-constraint-safe"];sp.updateRegionSelector(i,{safeClearance:l})}if(e["attr-constraint-other"]!=null){let a=e["attr-constraint-other"];sp.updateRegionSelector(i,{otherClearance:a})}if(e["attr-constraint-creepage"]!=null){if(sp.getRegion(i)==null)return;let l=e["attr-constraint-creepage"];sp.updateRegionSelector(i,{creepageClearance:l})}if(e["attr-constraint-track"]!=null){let a=e["attr-constraint-track"];sp.updateRegionSelector(i,{track:a})}if(e["attr-constraint-diff"]!=null){let a=e["attr-constraint-diff"];sp.updateRegionSelector(i,{diff:a})}if(e["attr-constraint-radius"]!=null){let a=e["attr-constraint-radius"];sp.updateRegionSelector(i,{radius:a})}if(e["attr-constraint-copper"]!=null){let a=e["attr-constraint-copper"];sp.updateRegionSelector(i,{copperPlane:a})}if(e["attr-constraint-plane"]!=null){let a=e["attr-constraint-plane"];sp.updateRegionSelector(i,{innerPlane:a})}let s=sp.getRegion(i);Pp.getInstance().publish("modify",s)}}modifyFillComponent(e,r,i,n,s){let a=new dt;if(r!=null){if(e["attr-2dline-name"]!=null){let u=e["attr-2dline-name"];r.name!=u&&iOe("Copper Region",u)&&r.modifyName(u)}if(e["attr-copper-fill-style"]!=null&&(r.style=e["attr-copper-fill-style"]),e["attr-copper-line-width"]!=null){let u=parseFloat(e["attr-copper-line-width"])/10;R.getInstance().unit!="mil"&&(u=a.conversion(R.getInstance().unit,"mil",u)),r.gridLineWidth=u}if(e["attr-copper-line-spacing"]!=null){let u=parseFloat(e["attr-copper-line-spacing"])/10;R.getInstance().unit!="mil"&&(u=a.conversion(R.getInstance().unit,"mil",u)),r.clearance=u}if(e["attr-isolated-island"]!=null&&(r.keepIsland=e["attr-isolated-island"]=="yes"),e["attr-manufacture-optimization"]!=null&&(r.optimization=e["attr-manufacture-optimization"]=="yes"),e["attr-manufacture-optimization-value"]!=null){let u=parseFloat(e["attr-manufacture-optimization-value"])/10;r.optimizationValue=a.conversion(R.getInstance().unit,"mil",u)}let l=sp.getRegion(n),c,h=!1;if(e["attr-planezone-net-rule-type"]!=null)switch(e["attr-planezone-net-rule-type"]){case"1":{l&&(l.safeCopperPlane=null,l.safeClearance=null,c=l,h=!0,re.getInstance().deleteRegion(l.name));break}case"2":{let d=re.getInstance().addRegionSelector(n),p=re.getInstance().getSafeSpacingByNet(i,13);d.safeClearance=p.name,c=d;break}}if(e["attr-net-spacing-rule"]!=null){let u=e["attr-net-spacing-rule"];switch(l&&l.safeClearance?"2":"1"){case"1":{let p=re.getInstance().getNet(i);if(p!=null){let g=re.getInstance().getDefaultSafeSpacing().name!==u?u:"default";p.safeCopperPlane?p.safeCopperPlane=g:p.safeSpacing&&(p.safeSpacing=g),c=p}break}case"2":{let p=re.getInstance().addRegionSelector(n);p&&(p.safeClearance=u),c=p;break}}}if(e["attr-planezone-thermal-rule-type"]!=null)switch(e["attr-planezone-thermal-rule-type"]){case"1":{l&&(l.copperPlane=null),c=l;break}case"2":{let d=re.getInstance().addRegionSelector(n),p=re.getInstance().getCopperPlaneByNet(i);d.copperPlane=p.name,c=d;break}}if(e["attr-net-thermals-rule"]!=null){let u=e["attr-net-thermals-rule"];switch(l&&l.copperPlane?"2":"1"){case"1":{let p=re.getInstance().getNet(i);if(p!=null){let m=re.getInstance().getDefaultSafeSpacing();p.copperPlane=m.name!==u?u:"default",c=p}break}case"2":{let p=re.getInstance().addRegionSelector(n);p&&(p.copperPlane=u),c=p;break}}}c&&(h?Pp.getInstance().publish("delete",c):Pp.getInstance().publish("modify",c))}}modifyBridgingCopperComponent(e,r,i){var a;if(e["attr-layerid"]!=null){let l=this.lineloop instanceof mt||this.lineloop instanceof _t?this.lineloop.getParent():this.lineloop;if(z9(Number(e["attr-layerid"]))){if(l.locked)return;this.isSetByDialog?setTimeout(()=>{let c=mf.getNextTool().getNextTool(),h=c instanceof Ac?"draw(RRegion)":c instanceof hc?"draw(PRegion)":"draw(CRegion)";A.publish("tool","dropdrag"),Pe.setActiveLayerId(Number(e["attr-layerid"])),u8(),A.publish("tool",h),A.publish("closeLastDialog","",Q())}):(A.messageBus.publish("clearSelect",""),setTimeout(()=>{let c=new LD(u=>{if(u){r.padId=u.globalIndex,La.getInstance().addConnectRelatedId(u.globalIndex,l.globalIndex);let d=Ce.dispatch(l,"modify");A.publish("updateFrame",""),i&&(i.addCommand(d),qe.executeCommand(i))}else i&&i.undo();A.publish("tool","dropdrag")}),h={command:"selectPadWithRegion",program:c,msg:"Please select a pad to associate"};A.publish("toggle",h)}))}else{let c=r.padId;r.padId=null,c!=null&&La.getInstance().delConnectRelatedId(c,l.globalIndex)}}let n=e["attr-is-bridging-copper"];if(n!=null){r.isBridgingCopper=n;let l=this.lineloop,c=Ye.getItem(l.net);if(n?Ye.delete(l):c&&!c.has(l)&&Ye.addItem(l),l.model.netModified=!0,n&&r.networkList.length===0){let h=this.lineloop.getMathGraphics(this.lineloop.layerId),u=Array.from(Vr.rtreeSearchNotOutside(h).getResult(jd)).filter(d=>d instanceof Qo&&d!==this.lineloop);r.networkList=(a=u[0])!=null&&a.net?[u[0].net]:[]}else!n&&r.networkList.length>0&&(r.networkList=[])}let s=e["attr-bridging-copper-netlists"];if(s)if(Array.isArray(s))r.networkList=s;else{let{index:l,value:c}=s;r.networkList[l]?c==""?r.networkList.splice(l,1):r.networkList[l]=c:c!==""&&r.networkList.push(c)}}modifyFPCStiffenerComponent(e,r,i){let n=new dt;if(e["attr-fpc-stiffener-material"]!=null){let s=e["attr-fpc-stiffener-material"];if(s.locked)return;td.correctMaterial(s,r)}if(e["attr-fpc-stiffener-model"]!=null){let s=e["attr-fpc-stiffener-model"];td.correctModel(s,r)}if(e["attr-fpc-stiffener-thickness"]!=null){let s=+e["attr-fpc-stiffener-thickness"];td.correctThickness(s,r)}td.correctAllProps(r)}get2DLineTypeOption(e=!1){return R.getInstance().doctype===4?e?[{value:"Line",text:"Line"}]:[{value:"Line",text:"Line"},{value:"Slot Region",text:"Slot Region"},{value:"Fill Region",text:"Fill Region"},{value:"Prohibited Region",text:"Prohibited Region"}]:e?[{value:"Line",text:"Line"}]:[{value:"Board Outline",text:"Board Outline"},{value:"Copper Region",text:"Copper Region"},{value:"Fill Region",text:"Fill Region"},{value:"Slot Region",text:"Slot Region"},{value:"Prohibited Region",text:"Prohibited Region"},{value:"Constraint Region",text:"Constraint Region"},{value:"Line",text:"Line"}]}getRuleOptions(e){let r=new Set;switch(e){case"safe":r=sp.getAllSafeSpacing();break;case"other":r=sp.getAllOtherSpacing();break;case"creepage":r=sp.getAllCreepageSpacing();break;case"track":r=sp.getAllTrackPhysics();break;case"diff":r=sp.getAllDifferentialPhysics();break;case"radius":r=sp.getAllRadiusPhysics();break;case"copper":r=sp.getAllCopperPlane();break;case"plane":r=sp.getAllInnerPlane();break}let i=[];return r.forEach(n=>{i.push({text:n.name,value:n.name,isDefault:n.isDefault})}),i}getRule(e,r,i,n,s,a){let l;switch(e){case"1":l=n(r);break;case"2":let c=re.getInstance().getRegion(i);c!=null&&(l=s(c));break}return l||(l=a()),l}getSpacingRule(e,r,i){return this.getRule(e,r,i,n=>re.getInstance().getSafeSpacingByNet(n,13),n=>re.getInstance().getSafeSpacing(n.safeClearance),()=>re.getInstance().getDefaultSafeSpacing())}getCopperRule(e,r,i){return this.getRule(e,r,i,n=>re.getInstance().getCopperPlaneByNet(n),n=>re.getInstance().getCopperPlane(n.copperPlane),()=>re.getInstance().getDefaultCopperPlane())}getPourName(){if(this.attrlist["attr-2dline-type"].value==="Copper Region"&&this.attrlist["attr-2dline-name"]){let e=this.attrlist["attr-2dline-name"].value,r=new Set(Ti.nameManager.getNums());return r.delete(e),Array.from(r)}return[]}getExtra(){return{isSignalLayer:(()=>{let e=Pe.getAllSignalLayerIds().includes(this.attrlist["attr-layerid"].value);return this.getCompareValue("hasParent",e)})(),pourNames:this.getPourName()}}};function QG(o,t,e=3){let r=new dt;t!="mil"&&(o=r.conversion("mil",t,o));let i=Math.pow(10,e);return Math.round(o*i)/i}var fpe=class extends kl{constructor(){super(...arguments);this.mark=null}set(e){return this.mark=e,this}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=R.getInstance().origin;this.attrlist==null&&(this.attrlist={});let i=this.attrlist,n=R.getInstance().unit,s;return this.getSilkColor(e,i),(i["attr-id"]==null||i["attr-id"].value!=Ve)&&(i["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${Tr}${e.number}`),sourceId:e.globalIndex}),e instanceof da?(jo.lastPrecision=e.precision,(i["attr-radius"]==null||i["attr-radius"].value!=Ve)&&(i["attr-radius"]={title:"Radius",value:this.getCompareValue("attr-radius",e.getArcRadius())}),s=1):e instanceof qs?(Yo.lastPrecision=e.precision,(i["attr-length"]==null||i["attr-length"].value!=Ve)&&(i["attr-length"]={title:"Length",value:this.getCompareValue("attr-length",e.length)}),s=2):(os.lastPrecision=e.precision,s=3),(i["attr-tagging-type"]==null||i["attr-tagging-type"].value!=Ve)&&(i["attr-tagging-type"]={title:"Type",value:this.getCompareValue("attr-tagging-type",s),options:[{value:"1",text:"Radius Dimension"},{value:"2",text:"Length Dimension"},{value:"3",text:"Arc Dimension"}]}),(i["attr-layerid"]==null||i["attr-layerid"].value!=Ve)&&(i["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:Un.abstractDimension()}),(i["attr-combination"]==null||i["attr-combination"].value!=Ve)&&(i["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",Ht.getGroupNameByGroupId(e.getGroupID())||""),options:Ht.getCombin(),hasParent:e.getParent()!=null}),e instanceof da||e instanceof qs?(i["attr-unit"]==null||i["attr-unit"].value!=Ve)&&(i["attr-unit"]={title:"Unit",value:this.getCompareValue("attr-unit",e.unit)}):e instanceof Ga&&(i["attr-rotation"]==null||i["attr-rotation"].value!=Ve)&&(i["attr-rotation"]={title:"Rotation",value:this.getCompareValue("attr-rotation",Yl(e.angle,e.precision))}),(i["attr-width"]==null||i["attr-width"].value!=Ve)&&(i["attr-width"]={title:"Width",value:this.getCompareValue("attr-width",QG(e.width*10,n))}),(i["attr-text-height"]==null||i["attr-text-height"].value!=Ve)&&(i["attr-text-height"]={title:"Text Height",value:this.getCompareValue("attr-text-height",QG(e.height*10,n))}),(i["attr-tagging-accuracy"]==null||i["attr-tagging-accuracy"].value!=Ve)&&(i["attr-tagging-accuracy"]={title:"Accuracy",value:this.getCompareValue("attr-tagging-accuracy",e.precision),options:[{value:0,text:0},{value:1,text:1},{value:2,text:2},{value:3,text:3},{value:4,text:4}]}),(i["attr-start-x"]==null||i["attr-start-x"].value!=Ve)&&(i["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",QG((e.start.x-r.x)*10,n))}),(i["attr-start-y"]==null||i["attr-start-y"].value!=Ve)&&(i["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",QG((e.start.y-r.y)*10,n))}),(i["attr-end-x"]==null||i["attr-end-x"].value!=Ve)&&(i["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",QG((e.end.x-r.x)*10,n))}),(i["attr-end-y"]==null||i["attr-end-y"].value!=Ve)&&(i["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",QG((e.end.y-r.y)*10,n))}),(i["attr-locked"]==null||i["attr-locked"].value!=Ve)&&(i["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",e.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),this}modifyBy(e,r){let i=new dt,n=R.getInstance().origin,s=R.getInstance().unit;if(e["attr-layerid"]!=null){if(this.mark.locked)return;let a=parseInt(e["attr-layerid"]);this.mark.layerId=a}if(e["attr-combination"]!=null){if(this.mark.locked)return;this.modifyCombination(e["attr-combination"],this.mark).forEach(l=>{r.addCommand(l)})}if(e["attr-unit"]!=null){let a=e["attr-unit"];(this.mark instanceof qs||this.mark instanceof da)&&(this.mark.unit=a)}if(e["attr-rotation"]!=null){if(this.mark.locked)return;let a=parseFloat(e["attr-rotation"]);!isNaN(a)&&this.mark instanceof Ga&&(this.mark.angle=a)}if(e["attr-length"]!=null){let a=this.mark.unit,l=parseFloat(e["attr-length"])/10;!isNaN(l)&&a!="mil"&&(l=i.conversion(a,"mil",l)),!isNaN(l)&&l>0&&this.mark instanceof qs&&(this.mark.length=l)}if(e["attr-width"]!=null){let a=parseFloat(e["attr-width"])/10;!isNaN(a)&&s!="mil"&&(a=i.conversion(s,"mil",a)),isNaN(a)||(this.mark.width=a)}if(e["attr-text-height"]!=null){let a=parseFloat(e["attr-text-height"])/10;!isNaN(a)&&s!="mil"&&(a=i.conversion(s,"mil",a)),isNaN(a)||(this.mark.height=a)}if(e["attr-tagging-accuracy"]!=null){let a=parseInt(e["attr-tagging-accuracy"]);this.mark.precision=a}if(e["attr-start-x"]!=null){if(this.mark.locked)return;let a=parseFloat(e["attr-start-x"])/10;!isNaN(a)&&s!="mil"&&(a=i.conversion(s,"mil",a)),a=a+n.x,isNaN(a)||(this.mark.start=new S(a,this.mark.start.y))}if(e["attr-start-y"]!=null){if(this.mark.locked)return;let a=parseFloat(e["attr-start-y"])/10;!isNaN(a)&&s!="mil"&&(a=i.conversion(s,"mil",a)),a=a+n.y,isNaN(a)||(this.mark.start=new S(this.mark.start.x,a))}if(e["attr-end-x"]!=null){if(this.mark.locked)return;let a=parseFloat(e["attr-end-x"])/10;!isNaN(a)&&s!="mil"&&(a=i.conversion(s,"mil",a)),a=a+n.x,isNaN(a)||(this.mark.end=new S(a,this.mark.end.y))}if(e["attr-end-y"]!=null){if(this.mark.locked)return;let a=parseFloat(e["attr-end-y"])/10;!isNaN(a)&&s!="mil"&&(a=i.conversion(s,"mil",a)),a=a+n.y,isNaN(a)||(this.mark.end=new S(this.mark.end.x,a))}if(e["attr-locked"]!=null){let a=e["attr-locked"]=="yes";this.mark.locked=a}e["attr-silk-color"]!=null&&(e["attr-silk-color"]===""||e["attr-silk-color"]==="none"?this.mark.silkColor=null:this.mark.silkColor=ee.of3(e["attr-silk-color"]))}};var Jq=class extends kl{constructor(){super(...arguments);this.text=null;this.hasDefaultTextTypeface=!1}set(e){return this.text=e,this}getExtra(){return{hasDefaultTextTypeface:this.hasDefaultTextTypeface}}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=R.getInstance().unit,i=R.getInstance().origin;this.attrlist==null&&(this.attrlist={});let n=this.attrlist;return(n["attr-id"]==null||n["attr-id"].value!=Ve)&&(n["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${Tr}${e.number}`),sourceId:e.globalIndex}),this.getSilkColor(e,n),e.key!=""?((n["attr-text-type"]==null||n["attr-text-type"].value!=Ve)&&(n["attr-text-type"]={title:"text type",value:this.getCompareValue("attr-text-type","componentAttr")}),e.key==="Footprint"||e.key==="Device"||e.key==="3D Model"||e.key==="3D Model Title"||e.key==="3D Model Transform"||e.key==="Add into BOM"?(n["attr-text-content"]==null||n["attr-text-content"].value!=Ve)&&(n["attr-text-content"]={title:e.key,value:this.getCompareValue("attr-text-content",e.value),disabled:!0}):(n["attr-text-content"]==null||n["attr-text-content"].value!=Ve)&&(n["attr-text-content"]={title:e.key,value:this.getCompareValue("attr-text-content",(()=>{var s;return e.getParent()instanceof ke&&e.key==="Name"?(s=e.getParent())==null?void 0:s.attrKeyValue[e.key]:e.value})())}),(n["attr-text-title"]==null||n["attr-text-title"].value!=Ve)&&(n["attr-text-title"]={title:"text title",value:this.getCompareValue("attr-text-title",e.key),disabled:!0})):((n["attr-text-type"]==null||n["attr-text-type"].value!=Ve)&&(n["attr-text-type"]={title:"text type",value:this.getCompareValue("attr-text-type","normal")}),(n["attr-text-content"]==null||n["attr-text-content"].value!=Ve)&&(n["attr-text-content"]={title:"Content",value:this.getCompareValue("attr-text-content",e.value)})),(n["attr-layerid"]==null||n["attr-layerid"].value!=Ve)&&(n["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:Un.pcbText()}),(n["attr-combination"]==null||n["attr-combination"].value!=Ve)&&(n["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",Ht.getGroupNameByGroupId(e.getGroupID())||""),options:this.poolCache.combinationOptions,hasParent:e.getParent()!=null}),(n["attr-mirror"]==null||n["attr-mirror"].value!=Ve)&&(n["attr-mirror"]={title:"Mirror",value:this.getCompareValue("attr-mirror",e.mirror?"yes":"no")}),(n["attr-x"]==null||n["attr-x"].value!=Ve)&&(n["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",je(e.position.x-i.x,void 0,r,this.unitConversion))}),(n["attr-y"]==null||n["attr-y"].value!=Ve)&&(n["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",je(e.position.y-i.y,void 0,r,this.unitConversion))}),(n["attr-rotation"]==null||n["attr-rotation"].value!=Ve)&&(n["attr-rotation"]={title:"Rotation",value:this.getCompareValue("attr-rotation",Yl(ve(e.rotation/Math.PI*180,3)))}),(n["attr-locked"]==null||n["attr-locked"].value!=Ve)&&(n["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",e.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),(n["attr-origin"]==null||n["attr-origin"].value!=Ve)&&(n["attr-origin"]={title:"Origin",value:this.getCompareValue("attr-origin",e.origin)}),this.hasDefaultTextTypeface||(this.hasDefaultTextTypeface=["default","default2","Serif","Sans Serif"].includes(e.fontFamily)),(n["attr-text-typeface"]==null||n["attr-text-typeface"].value!=Ve)&&(n["attr-text-typeface"]={title:"Typeface",value:this.getCompareValue("attr-text-typeface",e.fontFamily),options:Pre()}),(n["attr-text-size"]==null||n["attr-text-size"].value!=Ve)&&(n["attr-text-size"]={title:"Size",value:this.getCompareValue("attr-text-size",je(e.fontSize,void 0,r,this.unitConversion))}),e.model.type==0?this.getDefultHtmlData(e,n):this.getFontData(e,n),this}modifyBy(e,r){let i=new dt,n=R.getInstance().origin;if(e["attr-text-content"]!=null&&(R.getInstance().doctype==4&&e["attr-text-title"]==="Designator"&&!/\?$/gi.test(e["attr-text-content"])?(e["attr-text-content"]=e["attr-text-content"]||"",e["attr-text-content"]+="?"):R.getInstance().doctype==3&&this.text.key==="Designator"&&e["attr-text-content"]!=null&&(e["attr-text-content"]=e["attr-text-content"].replace(/\s/g,"")),this.text.value=e["attr-text-content"]),e["attr-layerid"]!=null){if(this.text.locked)return;let s=parseInt(e["attr-layerid"]);isNaN(s)||(this.text.layerId=s)}if(e["attr-mirror"]!=null){if(this.text.locked)return;let s=e["attr-mirror"]=="yes";this.text.mirror=s}if(e["attr-combination"]!=null){if(this.text.locked)return;this.modifyCombination(e["attr-combination"],this.text).forEach(a=>{r.addCommand(a)})}if(e["attr-x"]!=null){if(this.text.locked)return;let s=parseFloat(e["attr-x"])/10;isNaN(s)||(R.getInstance().unit!="mil"&&(s=i.conversion(R.getInstance().unit,"mil",s)),s=s+n.x,this.text.position=new S(s,this.text.position.y))}if(e["attr-y"]!=null){if(this.text.locked)return;let s=parseFloat(e["attr-y"])/10;isNaN(s)||(R.getInstance().unit!="mil"&&(s=i.conversion(R.getInstance().unit,"mil",s)),s=s+n.y,this.text.position=new S(this.text.position.x,s))}if(e["attr-rotation"]!=null){if(this.text.locked)return;let s=parseFloat(e["attr-rotation"])/180*Math.PI;isNaN(s)||(this.text.rotation=s)}if(e["attr-locked"]!=null){let s=e["attr-locked"]=="yes";this.text.locked=s}if(e["attr-origin"]!=null){if(this.text.locked)return;let s=parseInt(e["attr-origin"]);isNaN(s)||(this.text.origin=s)}if(e["attr-text-typeface"]!=null){let s=e["attr-text-typeface"];this.text.fontFamily=s,(s==""||["default","default2","Serif","Sans Serif"].includes(s))&&(this.text.strokeWidth=this.text.strokeWidth,this.text.fontSize=this.text.fontSize)}if(e["attr-text-size"]!=null){let s=parseFloat(e["attr-text-size"])/10;R.getInstance().unit!="mil"&&(s=i.conversion(R.getInstance().unit,"mil",s)),this.text.fontSize=s}e["attr-silk-color"]!=null&&(e["attr-silk-color"]===""||e["attr-silk-color"]==="none"?this.text.silkColor=null:this.text.silkColor=ee.of3(e["attr-silk-color"])),this.text.model.type==0?this.modifyDefultText(this.text,e):this.modifyFont(this.text,e)}getFontData(e,r){let i=R.getInstance().unit;(r["attr-reversed-phase"]==null||r["attr-reversed-phase"].value!=Ve)&&(r["attr-reversed-phase"]={title:"Reversed",value:this.getCompareValue("attr-reversed-phase",e.reverse?"yes":"no")}),(r["attr-reversed-phase-extend"]==null||r["attr-reversed-phase-extend"].value!=Ve)&&(r["attr-reversed-phase-extend"]={title:"Reversed Extend",value:this.getCompareValue("attr-reversed-phase-extend",je(e.reverseExpansion,void 0,i,this.unitConversion))})}getDefultHtmlData(e,r){let i=R.getInstance().unit;(r["attr-text-stroke-width"]==null||r["attr-text-stroke-width"].value!=Ve)&&(r["attr-text-stroke-width"]={title:"Stroke Width",value:this.getCompareValue("attr-text-stroke-width",je(e.strokeWidth,void 0,i,this.unitConversion))}),(r["attr-reversed-phase"]==null||r["attr-reversed-phase"].value!=Ve)&&(r["attr-reversed-phase"]={title:"Reversed",value:this.getCompareValue("attr-reversed-phase","no")}),(r["attr-reversed-phase-extend"]==null||r["attr-reversed-phase-extend"].value!=Ve)&&(r["attr-reversed-phase-extend"]={title:"Reversed Extend",value:this.getCompareValue("attr-reversed-phase-extend","0")})}modifyDefultText(e,r){if(e.isEmpty)return;let i=new dt;if(r["attr-text-stroke-width"]!=null){let n=parseFloat(r["attr-text-stroke-width"])/10;R.getInstance().unit!="mil"&&(n=i.conversion(R.getInstance().unit,"mil",n)),e.strokeWidth=n}setTimeout(()=>{this.modifyFont(e,r)},0)}modifyFont(e,r){if(e.isEmpty)return;let i=new dt;if(r["attr-reversed-phase"]!=null){let n=r["attr-reversed-phase"]=="yes";e.reverse=n}if(r["attr-reversed-phase-extend"]!=null){let n=parseFloat(r["attr-reversed-phase-extend"])/10;R.getInstance().unit!="mil"&&(n=i.conversion(R.getInstance().unit,"mil",n)),e.reverseExpansion=n}}getFamily(){let e=new Array;for(let r of ut.defaultTextFamily)r!=""?e.push({value:r,text:r}):e.push({value:"default",text:"default"});return e}clearCache(){super.clearCache(),this.hasDefaultTextTypeface=!1}};var mpe=class extends kl{constructor(){super(...arguments);this.image=null}set(e){return this.image=e,this}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=R.getInstance().unit,i=R.getInstance().origin;this.attrlist==null&&(this.attrlist={});let n=this.attrlist;return this.getSilkColor(e,n),(n["attr-id"]==null||n["attr-id"].value!=Ve)&&(n["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${Tr}${e.number}`),sourceId:e.globalIndex}),(n["attr-layerid"]==null||n["attr-layerid"].value!=Ve)&&(n["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:Un.image()}),(n["attr-width"]==null||n["attr-width"].value!=Ve)&&(n["attr-width"]={title:"Width",value:this.getCompareValue("attr-width",je(e.width,void 0,r,this.unitConversion))}),(n["attr-height"]==null||n["attr-height"].value!=Ve)&&(n["attr-height"]={title:"Height",value:this.getCompareValue("attr-height",je(e.height,void 0,r,this.unitConversion))}),(n["attr-mirror"]==null||n["attr-mirror"].value!=Ve)&&(n["attr-mirror"]={title:"Mirror",value:this.getCompareValue("attr-mirror",e.mirror?"yes":"no")}),(n["attr-combination"]==null||n["attr-combination"].value!=Ve)&&(n["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",Ht.getGroupNameByGroupId(e.getGroupID())||""),options:this.poolCache.combinationOptions,hasParent:e.getParent()!=null}),(n["attr-start-x"]==null||n["attr-start-x"].value!=Ve)&&(n["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",je(e.start.x-i.x,void 0,r,this.unitConversion))}),(n["attr-start-y"]==null||n["attr-start-y"].value!=Ve)&&(n["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",je(e.start.y-i.y,void 0,r,this.unitConversion))}),(n["attr-rotation"]==null||n["attr-rotation"].value!=Ve)&&(n["attr-rotation"]={title:"Rotation",value:this.getCompareValue("attr-rotation",Yl(ve(e.rotation/Math.PI*180,3)))}),(n["attr-locked"]==null||n["attr-locked"].value!=Ve)&&(n["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",e.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),this}modifyBy(e,r){let n=new dt,s=R.getInstance().origin;if(e["attr-layerid"]!=null){if(this.image.locked)return;let a=parseInt(e["attr-layerid"]);this.image.layerId=a}if(e["attr-combination"]!=null){if(this.image.locked)return;this.modifyCombination(e["attr-combination"],this.image).forEach(l=>{r.addCommand(l)})}if(e["attr-width"]!=null){let a=parseFloat(e["attr-width"])/10;a=this.getValue(a),a=n.conversion(R.getInstance().unit,"mil",a),a>=gO&&(a=gO),a>0&&(a=Math.min(a,5e4),Hb()&&(this.image.height=this.image.height/this.image.width*a),this.image.width=a)}if(e["attr-height"]!=null){let a=parseFloat(e["attr-height"])/10;a=this.getValue(a),a=n.conversion(R.getInstance().unit,"mil",a),length>=yO&&(length=yO),a>0&&(a=Math.min(a,5e4),Hb()&&(this.image.width=this.image.width/this.image.height*a),this.image.height=a)}if(e["attr-mirror"]!=null){if(this.image.locked)return;let a=e["attr-mirror"]=="yes";this.image.mirror=a}if(e["attr-start-x"]!=null){if(this.image.locked)return;let a=parseFloat(e["attr-start-x"])/10;a=this.getValue(a),R.getInstance().unit!="mil"&&(a=n.conversion(R.getInstance().unit,"mil",a)),a=a+s.x;let l=new S(a,this.image.start.y);this.image.start=l}if(e["attr-start-y"]!=null){if(this.image.locked)return;let a=parseFloat(e["attr-start-y"])/10;a=this.getValue(a),R.getInstance().unit!="mil"&&(a=n.conversion(R.getInstance().unit,"mil",a)),a=a+s.y;let l=new S(this.image.start.x,a);this.image.start=l}if(e["attr-rotation"]!=null){if(this.image.locked)return;let a=parseFloat(e["attr-rotation"])/180*Math.PI;a=this.getValue(a),this.image.rotation=a}if(e["attr-locked"]!=null){let a=e["attr-locked"]=="yes";this.image.locked=a}e["attr-silk-color"]!=null&&(e["attr-silk-color"]===""||e["attr-silk-color"]==="none"?this.image.silkColor=null:this.image.silkColor=ee.of3(e["attr-silk-color"]))}};var h_=re.getInstance(),gpe=class extends kl{constructor(){super(...arguments);this.plane=null}set(e){return this.plane=e,this}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=R.getInstance().unit,i=e.layerId;this.attrlist==null&&(this.attrlist={});let n=this.attrlist;(n["attr-id"]==null||n["attr-id"].value!=Ve)&&(n["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${Tr}${e.number}`),sourceId:e.globalIndex}),(n["attr-select-net"]==null||n["attr-select-net"].value!=Ve)&&(n["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",e.net),options:this.poolCache.allNetOptions||Ye.getNet()});let s=Pd.fetchProfileItem(i);(n["attr-isolated-island"]==null||n["attr-isolated-island"].value!=Ve)&&(n["attr-isolated-island"]={title:"Keep Island",value:this.getCompareValue("attr-isolated-island",s&&s.keepIsland?"yes":"no")});let a=this.getSpacingRule("1",e.net,e.globalIndex);(n["attr-net-spacing-rule"]==null||n["attr-net-spacing-rule"].value!=Ve)&&(n["attr-net-spacing-rule"]={title:"Net Spacing Rule",value:this.getCompareValue("attr-net-spacing-rule",a.name),options:this.getRuleOptions("safe")});let l=p=>p.map(m=>a.getClearance(7,m)).map(m=>je(m,4,r,this.unitConversion)),c=[11,8],h=l(Wz.filter(p=>!c.includes(p))),u=l(c);(n["attr-net-spacing-list"]==null||n["attr-net-spacing-list"].value!=Ve)&&(n["attr-net-spacing-list"]={title:"Network Spacing",value:this.getCompareValue("attr-net-spacing-list",h)}),(n["attr-dist-border-outline-list"]==null||n["attr-dist-border-outline-list"].value!=Ve)&&(n["attr-dist-border-outline-list"]={title:"Distance To Border Outline",value:this.getCompareValue("attr-dist-border-outline-list",u)});let d=this.getInnerRule("1",e.net,e.globalIndex);return(n["attr-net-thermals-rule"]==null||n["attr-net-thermals-rule"].value!=Ve)&&(n["attr-net-thermals-rule"]={title:"Net Thermals Rule",value:this.getCompareValue("attr-net-thermals-rule",d.name),options:this.getRuleOptions("plane")}),(n["attr-multi-layer-pad-connection"]==null||n["attr-multi-layer-pad-connection"].value!=Ve)&&(n["attr-multi-layer-pad-connection"]={title:"Pad Connection",value:this.getCompareValue("attr-multi-layer-pad-connection",d.getMultiConnectMode(i)),options:[{text:"Spoke",value:0},{text:"Direct",value:1},{text:"No Connection",value:2}]}),(n["attr-multi-layer-spoke-width"]==null||n["attr-multi-layer-spoke-width"].value!=Ve)&&(n["attr-multi-layer-spoke-width"]={title:"Spoke Width",value:this.getCompareValue("attr-multi-layer-spoke-width",je(d.getMultiLineWidth(i),void 0,r,this.unitConversion))}),(n["attr-multi-layer-spoke-spacing"]==null||n["attr-multi-layer-spoke-spacing"].value!=Ve)&&(n["attr-multi-layer-spoke-spacing"]={title:"Spoke Spacing",value:this.getCompareValue("attr-multi-layer-spoke-spacing",je(d.getMultiLineClearance(i),void 0,r,this.unitConversion))}),(n["attr-multi-layer-spoke-angles"]==null||n["attr-multi-layer-spoke-angles"].value!=Ve)&&(n["attr-multi-layer-spoke-angles"]={title:"Spoke Angles",value:this.getCompareValue("attr-multi-layer-spoke-angles",ve(d.getMultiLineAngle(i)/Math.PI*180,3)),options:[{text:"45 Degrees",value:45},{text:"90 Degrees",value:90}]}),this}getCompareValue(e,r){if(this.attrlist!=null){let i=this.attrlist[e];if(i!=null&&String(i.value)!=String(r))return Ve}return r}modifyBy(e,r){e["attr-select-net"]!=null&&(this.plane.net=e["attr-select-net"].toUpperCase());let i=this.plane.globalIndex,n=this.plane.net,s=re.getInstance().getNet(n);if(e["attr-net-spacing-rule"]!=null){let a=e["attr-net-spacing-rule"];if(s!=null){let c=re.getInstance().getDefaultSafeSpacing().name!==a?a:"default";s.safeCopperPlane?s.safeInnerPlane=c:s.safeSpacing&&(s.safeSpacing=c)}}if(e["attr-net-thermals-rule"]!=null){let a=e["attr-net-thermals-rule"];if(s!=null){let l=re.getInstance().getDefaultInnerPlane();s.innerPlane=l.name!==a?a:"default"}}if(e["attr-isolated-island"]!=null){let a=e["attr-isolated-island"],l=Pd.fetchProfileItem(this.plane.layerId);l.keepIsland=a==="yes",Pe.updatePlanzoneLayerKeepIsland(this.plane.layerId,l.keepIsland),Pd.updateProfileItem(this.plane.layerId,l),A.publish("rebuildSinglePlane",[this.plane.layerId])}}getRuleOptions(e){let r=new Set;switch(e){case"safe":r=h_.getAllSafeSpacing();break;case"other":r=h_.getAllOtherSpacing();break;case"creepage":r=h_.getAllCreepageSpacing();break;case"track":r=h_.getAllTrackPhysics();break;case"diff":r=h_.getAllDifferentialPhysics();break;case"radius":r=h_.getAllRadiusPhysics();break;case"copper":r=h_.getAllCopperPlane();break;case"plane":r=h_.getAllInnerPlane();break}let i=[];return r.forEach(n=>{i.push({text:n.name,value:n.name,isDefault:n.isDefault})}),i}getRule(e,r,i,n,s,a){let l;switch(e){case"1":l=n(r);break;case"2":let c=re.getInstance().getRegion(i);c!=null&&(l=s(c));break}return l||(l=a()),l}getSafeSpacingByNet(e){return h_.getSafeSpacingByNet(e,14)}getSpacingRule(e,r,i){let n=re.getInstance();return this.getRule(e,r,i,s=>this.getSafeSpacingByNet(s),s=>n.getSafeSpacing(s.safeClearance),()=>n.getDefaultSafeSpacing())}getInnerRule(e,r,i){return this.getRule(e,r,i,n=>re.getInstance().getInnerPlaneByNet(n),n=>re.getInstance().getInnerPlane(n.innerPlane),()=>re.getInstance().getDefaultInnerPlane())}};var ype=class{constructor(){this.TAGGING=!0;this.PAD=!0;this.LINE2D=!0;this.TEXT=!0;this.COMPONENT_ATTR_TEXT=!0;this.COMPONENT=!0;this.TRACK=!0;this.VIA=!0;this.IMAGE=!0;this.TRUECOLORPICTRUE=!0;this.PLANEZONE=!0;this.TEARDROP=!0;this.SMARTDIMENSION=!0;this.D3SHELLOUTLINE=!0;this.D3SHELLSCREWPILLAR=!0;this.D3SHELLSLOTDATUNLINE=!0;this.D3SHELLGROOVINGAREA=!0;this.D3SHELLENTITY=!0;this.PADTEST=!0;this.FPC_STIFFENER=!0;this.COPPERRESULT=!0;this.ids=new Set;this.keepLast=!1}setStatus(t){let e=t.primitiveStatus;if(e!=null)for(let r of e)this.setStatus4AttributePrimitive(r.value,r.isChecked)}setStatus4AttributePrimitive(t,e){switch(t){case"TAGGING":this.TAGGING=e;break;case"PAD":this.PAD=e;break;case"2DLINE":this.LINE2D=e;break;case"TEXT":this.TEXT=e;break;case"COMPONENT_ATTR_TEXT":this.COMPONENT_ATTR_TEXT=e;break;case"DEVICE":this.COMPONENT=e;break;case"TRACK":this.TRACK=e;break;case"VIA":this.VIA=e;break;case"IMAGE":this.IMAGE=e;break;case"TRUECOLORPICTRUE":this.TRUECOLORPICTRUE=e;break;case"PLANEZONE":this.PLANEZONE=e;break;case"3D Shell - Outline":this.D3SHELLOUTLINE=e;break;case"3D Shell - Screw Pillar":this.D3SHELLSCREWPILLAR=e;break;case"3D Shell - Side Datum Line":this.D3SHELLSLOTDATUNLINE=e;break;case"3D Shell - Slot Region":this.D3SHELLGROOVINGAREA=e;break;case"3D Shell - Entity":this.D3SHELLENTITY=e;break;case"TESTPOINTER":{this.PADTEST=e;break}case"FPC_STIFFENER":{this.FPC_STIFFENER=e;break}case"TEARDROP":{this.TEARDROP=e;break}case"SMARTDIMENSION":{this.SMARTDIMENSION=e;break}case"COPPERRESULT":{this.COPPERRESULT=e;break}default:}}update(t){if(t.length==0)this.restore();else{this.keepLast=!1;let e=!1;for(let r of t)if(!this.ids.has(r.globalIndex)){e=!0;break}e&&this.restore(),this.ids.clear();for(let r of t)this.ids.add(r.globalIndex)}return this}inOld(t){return this.ids.has(t.globalIndex)}update4(t,e){return t&&this.restore(),this.ids.clear(),this.ids=e,this}getStatus4Types(t){let e={};for(let r of t){let i=this.getItemStatus4Type(r);r!=null&&i!=null&&(e[r]=i)}return e}getStatus(t){let e={};for(let r of t){let i=this.getType(r),n=this.getItemStatus(r);i!=null&&n!=null&&(e[i]=n)}return e}getItemStatus(t){return t instanceof qs?this.TAGGING:t instanceof Ga?this.TAGGING:t instanceof da?this.TAGGING:t instanceof _i?t.isTestPad?this.PADTEST:this.PAD:t instanceof sn?this.PAD:t instanceof Pr?ic(t.layerId)?this.FPC_STIFFENER:ra(t.layerId)?this.get3DShellStatus(t):this.LINE2D:t instanceof rr?ic(t.layerId)?this.FPC_STIFFENER:ra(t.layerId)?this.get3DShellStatus(t):this.LINE2D:t instanceof lt?ic(t.layerId)?this.FPC_STIFFENER:t.type=="TearDrop"?this.TEARDROP:ra(t.layerId)?this.get3DShellStatus(t):this.LINE2D:t instanceof mt?ic(t.layerId)?this.FPC_STIFFENER:ra(t.layerId)?this.get3DShellStatus(t):this.LINE2D:t instanceof _t?ic(t.layerId)?this.FPC_STIFFENER:ra(t.layerId)?this.get3DShellStatus(t):this.LINE2D:t instanceof lr?t.key!==""?this.COMPONENT_ATTR_TEXT:this.TEXT:t instanceof ke?this.COMPONENT:t instanceof Ge?this.TRACK:t instanceof Ue?this.VIA:t instanceof Mn?this.IMAGE:t instanceof Ps?this.TRUECOLORPICTRUE:t instanceof Gi?this.PLANEZONE:t instanceof hh?this.SMARTDIMENSION:t instanceof Jr?this.COPPERRESULT:null}getItemStatus4Type(t){switch(t){case"TAGGING":return this.TAGGING;case"TESTPOINTER":return this.PADTEST;case"PAD":return this.PAD;case"FPC_STIFFENER":return this.FPC_STIFFENER;case"2DLINE":return this.LINE2D;case"TEARDROP":return this.TEARDROP;case"COMPONENT_ATTR_TEXT":return this.COMPONENT_ATTR_TEXT;case"TEXT":return this.TEXT;case"DEVICE":return this.COMPONENT;case"TRACK":return this.TRACK;case"VIA":return this.VIA;case"IMAGE":return this.IMAGE;case"TRUECOLORPICTRUE":return this.TRUECOLORPICTRUE;case"PLANEZONE":return this.PLANEZONE;case"3D Shell - Outline":return this.D3SHELLOUTLINE;case"3D Shell - Screw Pillar":return this.D3SHELLSCREWPILLAR;case"3D Shell - Side Datum Line":return this.D3SHELLSLOTDATUNLINE;case"3D Shell - Slot Region":return this.D3SHELLGROOVINGAREA;case"3D Shell - Entity":return this.D3SHELLENTITY;case"COPPERRESULT":return this.COPPERRESULT;case"SMARTDIMENSION":return this.SMARTDIMENSION;default:return null}}getType(t){return t instanceof qs?"TAGGING":t instanceof Ga?"TAGGING":t instanceof da?"TAGGING":t instanceof _i?t.isTestPad?"TESTPOINTER":"PAD":t instanceof sn?"PAD":t instanceof Pr?ic(t.layerId)?"FPC_STIFFENER":ra(t.layerId)?this.get3DShellPrimitive(t):"2DLINE":t instanceof rr?ic(t.layerId)?"FPC_STIFFENER":ra(t.layerId)?this.get3DShellPrimitive(t):"2DLINE":t instanceof lt?ic(t.layerId)?"FPC_STIFFENER":t.type=="TearDrop"?"TEARDROP":ra(t.layerId)?this.get3DShellPrimitive(t):"2DLINE":t instanceof mt?ic(t.layerId)?"FPC_STIFFENER":ra(t.layerId)?this.get3DShellPrimitive(t):"2DLINE":t instanceof _t?ic(t.layerId)?"FPC_STIFFENER":ra(t.layerId)?this.get3DShellPrimitive(t):"2DLINE":t instanceof lr?t.key!==""?"COMPONENT_ATTR_TEXT":"TEXT":t instanceof ke?"DEVICE":t instanceof Ge?"TRACK":t instanceof Ue?"VIA":t instanceof Mn?"IMAGE":t instanceof Ps?"TRUECOLORPICTRUE":t instanceof Gi?"PLANEZONE":t instanceof hh?"SMARTDIMENSION":t instanceof Jr?"COPPERRESULT":null}get3DShellPrimitive(t){switch((t instanceof mt||t instanceof _t?t.getParent():t).type){case"3D Shell - Outline":return"3D Shell - Outline";case"3D Shell - Screw Pillar":return"3D Shell - Screw Pillar";case"3D Shell - Side Datum Line":return"3D Shell - Side Datum Line";case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":return"3D Shell - Slot Region";case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":return"3D Shell - Entity"}return null}get3DShellStatus(t){switch((t instanceof mt||t instanceof _t?t.getParent():t).type){case"3D Shell - Outline":return this.D3SHELLOUTLINE;case"3D Shell - Screw Pillar":return this.D3SHELLSCREWPILLAR;case"3D Shell - Side Datum Line":return this.D3SHELLSLOTDATUNLINE;case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":return this.D3SHELLGROOVINGAREA;case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":return this.D3SHELLENTITY}return null}restore(){this.TAGGING=!0,this.PAD=!0,this.LINE2D=!0,this.TEXT=!0,this.COMPONENT_ATTR_TEXT=!0,this.COMPONENT=!0,this.TRACK=!0,this.VIA=!0,this.IMAGE=!0,this.TRUECOLORPICTRUE=!0,this.PLANEZONE=!0,this.TEARDROP=!0,this.SMARTDIMENSION=!0,this.COPPERRESULT=!0,this.FPC_STIFFENER=!0,this.D3SHELLOUTLINE=!0,this.D3SHELLSCREWPILLAR=!0,this.D3SHELLSLOTDATUNLINE=!0,this.D3SHELLGROOVINGAREA=!0,this.D3SHELLENTITY=!0,this.PADTEST=!0,this.ids.clear()}};var bpe=class extends HI{constructor(){super()}getHtmlData(t){let e=super.getHtmlData(t);return delete e["attr-footprint-id"],this}};var u_=class extends kl{constructor(){super(...arguments);this.selects=new Array;this.d3ShellObj=null;this.obj=null}set(e){return this.d3ShellObj=e,this.obj=e instanceof mt||e instanceof _t?e.getParent():e,this}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=R.getInstance().unit;this.selects.length=0,e instanceof lt?this.selects=e.getSelects():(e instanceof mt||e instanceof _t)&&this.selects.push(e),this.attrlist==null&&(this.attrlist={});let i=this.attrlist,n=e instanceof mt||e instanceof _t?e.getParent():e;(i["attr-layerid"]==null||i["attr-layerid"].value!=Ve)&&(i["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",this.getCompareValue("attr-layerid",n.layerId)),options:Un.createLayerOptionsByLineloop(n,i["attr-layerid"]?i["attr-layerid"].options:[]),disabled:!1}),(i["attr-combination"]==null||i["attr-combination"].value!=Ve)&&(i["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",this.getCompareValue("attr-combination",Ht.getGroupNameByGroupId(n.getGroupID())||"")),options:this.poolCache.combinationOptions}),(i["attr-locked"]==null||i["attr-locked"].value!=Ve)&&(i["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",this.getCompareValue("attr-locked",n.locked?"yes":"no")),options:this.poolCache.lockSettingOptions}),(i["attr-id"]==null||i["attr-id"].value!=Ve)&&(i["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",this.getCompareValue("attr-id",`${Tr}${n.number}`)),sourceId:n.globalIndex});let s=n.type,a=n.getComponent();switch(s){case"3D Shell - Outline":{this.getOutlineAttrs(e,n,a);break}case"3D Shell - Screw Pillar":{this.getScrewPillarttrs(e,n,a);break}case"3D Shell - Side Datum Line":{this.getSideSlotDatumLineAttrs(e,n,a);break}case"3D Shell - Side Slot Region":{this.getSideSlotRegionAttrs(e,n,a);break}case"3D Shell - Top Slot Region":{this.getTopSlotRegionAttrs(e,n,a);break}case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":{this.getEntityAttrs(e,n,a);break}}return this}getOutlineAttrs(e,r,i){let n=R.getInstance().unit,s=this.attrlist;return s["attr-3d-shell-entityType"]={title:"Entity Type",value:this.getCompareValue("attr-3d-shell-entityType",r.type),disabled:!1},s["attr-3d-shell-type"]={title:"Type",value:this.getCompareValue("attr-3d-shell-type",i.type)},s["attr-3d-shell-push-cover-direction"]={title:"Push Cover Direction",value:this.getCompareValue("attr-3d-shell-push-cover-direction",i.pushCoverDir),options:[{text:"Shell X Axis Positive",value:1},{text:"Shell X Axis Negative",value:2},{text:"Shell Y Axis Positive",value:4},{text:"Shell Y Axis Negative",value:8}]},s["attr-3d-shell-top-inner-height"]={title:"Top Inner Height",value:this.getCompareValue("attr-3d-shell-top-inner-height",je(i.topInnerHeight,void 0,n,this.unitConversion))},s["attr-3d-shell-bottom-inner-height"]={title:"Bottom Inner Height",value:this.getCompareValue("attr-3d-shell-bottom-inner-height",je(i.bottomInnerHeight,void 0,n,this.unitConversion))},s["attr-3d-shell-height"]={title:"Overall height of shell",value:this.getCompareValue("attr-3d-shell-height",je(i.shellHeight))},s["attr-3d-shell-substrate-height"]={title:"PCB Height From The Bottom Surface of Shell",value:this.getCompareValue("attr-3d-shell-substrate-height",je(i.substrateHeight,void 0,n,this.unitConversion))},s["attr-3d-lower-shell-height"]={title:"Height of lower shell",value:this.getCompareValue("attr-3d-lower-shell-height",je(i.botShellHeight,void 0,n,this.unitConversion))},s["attr-3d-shell-thickness"]={title:"Shell thickness",value:this.getCompareValue("attr-3d-shell-thickness",je(i.shellThickness,void 0,n,this.unitConversion))},s["attr-3d-shell-line-width"]={title:"Line Width",value:this.getCompareValue("attr-3d-shell-line-width",je(r.strokeWidth,void 0,n,this.unitConversion))},Object.assign(s,this.getProfileAttrs(e)),s}getScrewPillarttrs(e,r,i){let n=R.getInstance().unit,s=this.attrlist,a=R.getInstance().origin;s["attr-3d-shell-entityType"]={title:"Entity Type",value:this.getCompareValue("attr-3d-shell-entityType",r.type),disabled:!1},s["attr-3d-shell-screw-specifications"]={title:"Screw specifications",value:this.getCompareValue("attr-3d-shell-screw-specifications",i.specification)},s["attr-3dshell-Shell-screw-column-height"]={title:"Height",value:this.getCompareValue("attr-3dshell-Shell-screw-column-height",je(i.height,void 0,n,this.unitConversion))},s["attr-3dshell-shell-screw-hole-diameter"]={title:"Hole Diameter",value:this.getCompareValue("attr-3dshell-shell-screw-hole-diameter",je(i.holeDiameter,void 0,n,this.unitConversion))},s["attr-3dshell-shell-screw-thickness"]={title:"Thickness",value:this.getCompareValue("attr-3dshell-shell-screw-thickness",je(i.thickness,void 0,n,this.unitConversion))},s["attr-3d-shell-need-stiffener"]={title:"Need Stiffener",value:this.getCompareValue("attr-3d-shell-need-stiffener",i.needStiffener)};let l=i.stiffenerProps;l&&(s["attr-3d-shell-stiffener-top-width"]={title:"Top Width of Stiffener",value:this.getCompareValue("attr-3d-shell-stiffener-top-width",je(l.topWidth,void 0,n,this.unitConversion))},s["attr-3d-shell-stiffener-bottom-width"]={title:"Bottom Width of Stiffener",value:this.getCompareValue("attr-3d-shell-stiffener-bottom-width",je(l.bottomWidth,void 0,n,this.unitConversion))},s["attr-3d-shell-stiffener-height"]={title:"Stiffener Height",value:this.getCompareValue("attr-3d-shell-stiffener-height",je(l.height,void 0,n,this.unitConversion))},s["attr-3d-shell-stiffener-thickness"]={title:"Stiffener Thickness",value:this.getCompareValue("attr-3d-shell-stiffener-thickness",je(l.stiffThickness,void 0,n,this.unitConversion))}),s["attr-3d-shell-need-counterbore"]={title:"Need Counterbore",value:this.getCompareValue("attr-3d-shell-need-counterbore",i.needCounterbore)};let c=i.counterboreProps;return c&&(s["attr-3d-shell-counterbore-height"]={title:"Counterbore Height",value:this.getCompareValue("attr-3d-shell-counterbore-height",je(c.height,void 0,n,this.unitConversion))},s["attr-3d-shell-counterbore-diameter"]={title:"Counterbore Diameter",value:this.getCompareValue("attr-3d-shell-counterbore-diameter",je(c.diameter,void 0,n,this.unitConversion))}),s["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",je(e.center.x-a.x,void 0,n,this.unitConversion))},s["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",je(e.center.y-a.y,void 0,n,this.unitConversion))},s}getSideSlotDatumLineAttrs(e,r,i){let n=R.getInstance().unit,s=this.attrlist,a=R.getInstance().origin;return s["attr-3d-shell-entityType"]={title:"Entity Type",value:this.getCompareValue("attr-3d-shell-entityType",r.type),disabled:!1},s["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",je(r.start.x-a.x,void 0,n,this.unitConversion))},s["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",je(r.start.y-a.y,void 0,n,this.unitConversion))},s["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",je(r.end.x-a.x,void 0,n,this.unitConversion))},s["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",je(r.end.y-a.y,void 0,n,this.unitConversion))},s}getEntityAttrs(e,r,i){let n=R.getInstance().unit,s=pt.getItem(i.lineId),a=this.attrlist;a["attr-3d-shell-entityType"]={title:"Entity Type",value:this.getCompareValue("attr-3d-shell-entityType","3D Shell - Entity"),disabled:!1},a["attr-3dshell-entity-region-type"]={title:"Entity Region Type",value:this.getCompareValue("attr-3dshell-entity-region-type",i.type)},a["attr-baseline"]={title:"Baseline",value:this.getCompareValue("attr-baseline",`${Tr}${s==null?void 0:s.number}`),sourceId:i.lineId,readonly:!0},a["attr-3dshell-entity-region-stretch-length"]={title:"Stretch Length",value:this.getCompareValue("attr-3dshell-entity-region-stretch-length",je(i.stretchLength,void 0,n,this.unitConversion))};let l=null,c=XS.getOutline();return c&&c.getComponent().type==="T&B"&&(l=i.belong),a["attr-3dshell-entity-region-belong"]={title:"Belong",value:this.getCompareValue("attr-3dshell-entity-region-belong",l),options:ml.getBelongOptions()},a["attr-3d-shell-line-width"]={title:"Line Width",value:this.getCompareValue("attr-3d-shell-line-width",je(r.strokeWidth,void 0,n,this.unitConversion))},Object.assign(a,this.getProfileAttrs(e)),a}getTopSlotRegionAttrs(e,r,i){let n=R.getInstance().unit,s=this.attrlist;s["attr-3d-shell-entityType"]={title:"Entity Type",value:this.getCompareValue("attr-3d-shell-entityType","3D Shell - Slot Region"),disabled:!1},s["attr-3d-shell-grooving-type"]={title:"Grooving Type",value:this.getCompareValue("attr-3d-shell-grooving-type","top_bottom")},s["attr-3d-shell-slot-depth"]={title:"Slot depth",value:this.getCompareValue("attr-3d-shell-slot-depth",je(i.slotDepth,void 0,n,this.unitConversion))},s["attr-3d-shell-line-width"]={title:"Line Width",value:this.getCompareValue("attr-3d-shell-line-width",je(r.strokeWidth,void 0,n,this.unitConversion))};let a=new Set(i.slotOption);return s["attr-3dshell-slot-option-outline"]={title:"D3shell Outline",value:this.getCompareValue("attr-3dshell-slot-option-outline",a.has(4))},s["attr-3dshell-slot-option-screw-pillar"]={title:"D3shell ScrewPillar",value:this.getCompareValue("attr-3dshell-slot-option-screw-pillar",a.has(8))},s["attr-3dshell-slot-option-entity"]={title:"D3shell Entity",value:this.getCompareValue("attr-3dshell-slot-option-entity",a.has(16))},Object.assign(s,this.getProfileAttrs(e)),s}getSideSlotRegionAttrs(e,r,i){let n=pt.getItem(i.lineId),s=R.getInstance().unit,a=this.attrlist;a["attr-3d-shell-entityType"]={title:"Entity Type",value:this.getCompareValue("attr-3d-shell-entityType","3D Shell - Slot Region"),disabled:!1},a["attr-3d-shell-grooving-type"]={title:"Grooving Type",value:this.getCompareValue("attr-3d-shell-grooving-type","side")},a["attr-baseline"]={title:"Baseline",value:this.getCompareValue("attr-baseline",`${Tr}${n.number}`),sourceId:i.lineId,readonly:!0},a["attr-3d-shell-slot-depth"]={title:"Slot depth",value:this.getCompareValue("attr-3d-shell-slot-depth",je(i.slotDepth,void 0,s,this.unitConversion))},a["attr-3d-shell-line-width"]={title:"Line Width",value:this.getCompareValue("attr-3d-shell-line-width",je(r.strokeWidth,void 0,s,this.unitConversion))};let l=new Set(i.slotOption);return a["attr-3dshell-slot-option-outline"]={title:"D3shell Outline",value:this.getCompareValue("attr-3dshell-slot-option-outline",l.has(4))},a["attr-3dshell-slot-option-screw-pillar"]={title:"D3shell ScrewPillar",value:this.getCompareValue("attr-3dshell-slot-option-screw-pillar",l.has(8))},a["attr-3dshell-slot-option-entity"]={title:"D3shell Entity",value:this.getCompareValue("attr-3dshell-slot-option-entity",l.has(16))},Object.assign(a,this.getProfileAttrs(e)),a}getProfileAttrs(e){let r=R.getInstance().unit,i=this.attrlist,n=R.getInstance().origin,s;if(e instanceof mt){let a=e;s="Line Outline",i["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",je(a.start.x-n.x,void 0,r,this.unitConversion))},i["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",je(a.start.y-n.y,void 0,r,this.unitConversion))},i["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",je(a.end.x-n.x,void 0,r,this.unitConversion))},i["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",je(a.end.y-n.y,void 0,r,this.unitConversion))}}else if(e instanceof lt&&this.selects.length===1&&this.selects[0]instanceof mt){let a=this.selects[0];s="Line Outline",i["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",je(a.start.x-n.x,void 0,r,this.unitConversion))},i["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",je(a.start.y-n.y,void 0,r,this.unitConversion))},i["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",je(a.end.x-n.x,void 0,r,this.unitConversion))},i["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",je(a.end.y-n.y))}}else if(e instanceof _t){let a=e;s="Arc Outline";let l=new Yn,{start:c,end:h,angle:u}=l.angleToPoint(a.center,a.radius,a.startAngle,a.endAngle,a.sweep);i["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",je(c.x-n.x,void 0,r,this.unitConversion))},i["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",je(c.y-n.y,void 0,r,this.unitConversion))},i["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",je(h.x-n.x,void 0,r,this.unitConversion))},i["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",je(h.y-n.y,void 0,r,this.unitConversion))},i["attr-arc-angle"]={title:"Arc Angle",value:this.getCompareValue("attr-arc-angle",ve(u/Math.PI*180,3))}}else if(e instanceof lt&&this.selects.length===1&&this.selects[0]instanceof _t){let a=this.selects[0];s="Arc Outline";let l=new Yn,{start:c,end:h,angle:u}=l.angleToPoint(a.center,a.radius,a.startAngle,a.endAngle,a.sweep);i["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",je(c.x-n.x,void 0,r,this.unitConversion))},i["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",je(c.y-n.y,void 0,r,this.unitConversion))},i["attr-end-x"]={title:"End X",value:this.getCompareValue("attr-end-x",je(h.x-n.x,void 0,r,this.unitConversion))},i["attr-end-y"]={title:"End Y",value:this.getCompareValue("attr-end-y",je(h.y-n.y,void 0,r,this.unitConversion))},i["attr-arc-angle"]={title:"Arc Angle",value:this.getCompareValue("attr-arc-angle",ve(u/Math.PI*180,3))}}else if(e instanceof Pr){let a=e;s="Round Outline",i["attr-x"]={title:"Center X",value:this.getCompareValue("attr-x",je(a.center.x-n.x,void 0,r,this.unitConversion))},i["attr-y"]={title:"Center Y",value:this.getCompareValue("attr-y",je(a.center.y-n.y,void 0,r,this.unitConversion))},i["attr-radius"]={title:"Radius",value:this.getCompareValue("attr-radius",je(a.radius,void 0,r,this.unitConversion))}}else if(e instanceof rr){let a=e;s="Rectangle Outline",i["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",je(a.start.x-n.x,void 0,r,this.unitConversion))},i["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",je(a.start.y-n.y,void 0,r,this.unitConversion))},i["attr-width"]={title:"Width",value:this.getCompareValue("attr-width",je(a.width,void 0,r,this.unitConversion))},i["attr-height"]={title:"Height",value:this.getCompareValue("attr-height",je(a.height,void 0,r,this.unitConversion))},i["attr-corner-radius"]={title:"Corner Radius",value:this.getCompareValue("attr-corner-radius",je(a.cornerRadius,void 0,r,this.unitConversion))},i["attr-rotation"]={title:"rotate",value:this.getCompareValue("attr-rotation",Yl(ve(a.rotation/Math.PI*180,3)))}}return i["attr-profile-type"]={title:"ProfileModel type",value:this.getCompareValue("attr-profile-type",s),disabled:!1},i}modifyBy(e,r){let i=null;if(this.d3ShellObj instanceof mt||this.d3ShellObj instanceof _t){let n=this.d3ShellObj.getParent();this.modifyPolygon(e,n,r),i=n.getComponent()}else this.d3ShellObj instanceof lt?(this.modifyPolygon(e,this.d3ShellObj,r),i=this.d3ShellObj.getComponent()):this.d3ShellObj instanceof Pr?(this.modifyCircle(e,this.d3ShellObj,r),i=this.d3ShellObj.getComponent()):this.d3ShellObj instanceof rr&&(this.modifyRect(e,this.d3ShellObj,r),i=this.d3ShellObj.getComponent());i!=null&&(i instanceof y0?this.modifyD3ShellOutlineComponent(e,i):i instanceof Rf?this.modifyD3ShellScrewPillarComponent(e,i):i instanceof wh?this.modifyD3ShellSlotRegionComponent(e,i,r):i instanceof ml&&this.modifyD3ShellEntityComponent(e,i,r))}modifyCircle(e,r,i){let n=new dt,s=R.getInstance().origin;if(e["attr-layerid"]!=null){if(r.locked)return;r.layerId=parseInt(e["attr-layerid"])}if(e["attr-3d-shell-line-width"]!=null){let a=parseFloat(e["attr-3d-shell-line-width"])/10;R.getInstance().unit!="mil"&&(a=n.conversion(R.getInstance().unit,"mil",a)),r.strokeWidth=a}if(e["attr-locked"]!=null&&(r.locked=e["attr-locked"]=="yes"),e["attr-x"]!=null){if(r.locked)return;let a=parseFloat(e["attr-x"])/10;R.getInstance().unit!="mil"&&(a=n.conversion(R.getInstance().unit,"mil",a)),a=a+s.x,r.center=new S(a,r.center.y)}if(e["attr-y"]!=null){if(r.locked)return;let a=parseFloat(e["attr-y"])/10;R.getInstance().unit!="mil"&&(a=n.conversion(R.getInstance().unit,"mil",a)),a=a+s.y,r.center=new S(r.center.x,a)}if(e["attr-radius"]!=null){if(r.locked)return;let a=parseFloat(e["attr-radius"])/10;R.getInstance().unit!="mil"&&(a=n.conversion(R.getInstance().unit,"mil",a)),r.radius=a}if(e["attr-combination"]!=null){if(r.locked)return;let a=this.modifyCombination(e["attr-combination"],r);i&&a.forEach(l=>{i.addCommand(l)})}}modifyRect(e,r,i){let n=new dt,s=R.getInstance().origin;if(e["attr-layerid"]!=null){if(r.locked)return;r.layerId=parseInt(e["attr-layerid"])}if(e["attr-3d-shell-line-width"]!=null){let a=parseFloat(e["attr-3d-shell-line-width"])/10;R.getInstance().unit!="mil"&&(a=n.conversion(R.getInstance().unit,"mil",a)),r.strokeWidth=a}if(e["attr-rotation"]!=null){if(r.locked)return;let a=parseFloat(e["attr-rotation"])/180*Math.PI;a=this.getValue(a),r.rotation=a}if(e["attr-locked"]!=null&&(r.locked=e["attr-locked"]=="yes"),e["attr-start-x"]!=null){if(r.locked)return;let a=parseFloat(e["attr-start-x"])/10;R.getInstance().unit!="mil"&&(a=n.conversion(R.getInstance().unit,"mil",a)),a=a+s.x,r.start=new S(a,r.start.y)}if(e["attr-start-y"]!=null){if(r.locked)return;let a=parseFloat(e["attr-start-y"])/10;R.getInstance().unit!="mil"&&(a=n.conversion(R.getInstance().unit,"mil",a)),a=a+s.y,r.start=new S(r.start.x,a)}if(e["attr-width"]!=null){if(r.locked)return;let a=n.conversion(R.getInstance().unit,"mil",parseFloat(e["attr-width"])/10);Hb()&&(r.height=r.height/r.width*a),r.width=a}if(e["attr-height"]!=null){if(r.locked)return;let a=n.conversion(R.getInstance().unit,"mil",parseFloat(e["attr-height"])/10);Hb()&&(r.width=r.width/r.height*a),r.height=a}if(e["attr-corner-radius"]!=null){if(r.locked)return;let a=n.conversion(R.getInstance().unit,"mil",parseFloat(e["attr-corner-radius"])/10);a>=0&&(r.cornerRadius=a)}if(e["attr-combination"]!=null){if(r.locked)return;let a=this.modifyCombination(e["attr-combination"],r);i&&a.forEach(l=>{i.addCommand(l)})}}modifyPolygon(e,r,i){let n=R.getInstance().origin,s=new dt;if(e["attr-layerid"]!=null){if(r.locked)return;r.layerId=parseInt(e["attr-layerid"])}if(e["attr-3d-shell-line-width"]!=null){let c=parseFloat(e["attr-3d-shell-line-width"])/10;R.getInstance().unit!="mil"&&(c=s.conversion(R.getInstance().unit,"mil",c)),r.strokeWidth=c}if(e["attr-locked"]!=null&&(r.locked=e["attr-locked"]=="yes"),e["attr-combination"]!=null){if(r.locked)return;let c=this.modifyCombination(e["attr-combination"],r);i&&c.forEach(h=>{i.addCommand(h)})}let a=r.getSelects();a.length==0&&(a=this.selects),r.onlyOneChilds()!=null&&(a=[r.onlyOneChilds()]);let l=r.isClose();for(let c of a){if(e["attr-start-x"]!=null){if(r.locked)continue;let d=parseFloat(e["attr-start-x"])/10;R.getInstance().unit!="mil"&&(d=s.conversion(R.getInstance().unit,"mil",d)),d=d+n.x,c.start=new S(d,c.start.y)}if(e["attr-start-y"]!=null){if(r.locked)continue;let d=parseFloat(e["attr-start-y"])/10;R.getInstance().unit!="mil"&&(d=s.conversion(R.getInstance().unit,"mil",d)),d=d+n.y,c.start=new S(c.start.x,d)}if(e["attr-end-x"]!=null){if(r.locked)continue;let d=parseFloat(e["attr-end-x"])/10;R.getInstance().unit!="mil"&&(d=s.conversion(R.getInstance().unit,"mil",d)),d=d+n.x,c.end=new S(d,c.end.y)}if(e["attr-end-y"]!=null){if(r.locked)continue;let d=parseFloat(e["attr-end-y"])/10;R.getInstance().unit!="mil"&&(d=s.conversion(R.getInstance().unit,"mil",d)),d=d+n.y,c.end=new S(c.end.x,d)}if(c instanceof _t){if(e["attr-arc-angle"]!=null){if(r.locked)continue;let d=parseFloat(e["attr-arc-angle"]);if(Math.abs(d)<.001)d=.001;else if(Math.abs(d)>.001){let I=Math.abs(d)%360;I<.001&&I>0?d=.001:(I>359.999||I==0)&&(d=359.999)}let p=d/180*Math.PI,m=new Yn,{center:g,radius:y,startAngle:b,endAngle:P,sweep:T}=m.pointToAngle(c.start,c.end,p);c.center=g,c.radius=y,c.startAngle=b,c.endAngle=P,c.sweep=T}if(e["attr-start-x"]!=null){if(r.locked)continue;let d=parseFloat(e["attr-start-x"])/10;R.getInstance().unit!="mil"&&(d=s.conversion(R.getInstance().unit,"mil",d)),d=d+n.x,c.start=new S(d,c.start.y)}if(e["attr-start-y"]!=null){if(r.locked)continue;let d=parseFloat(e["attr-start-y"])/10;R.getInstance().unit!="mil"&&(d=s.conversion(R.getInstance().unit,"mil",d)),d=d+n.y,c.start=new S(c.start.x,d)}if(e["attr-end-x"]!=null){if(r.locked)continue;let d=parseFloat(e["attr-end-x"])/10;R.getInstance().unit!="mil"&&(d=s.conversion(R.getInstance().unit,"mil",d)),d=d+n.x,c.end=new S(d,c.end.y)}if(e["attr-end-y"]!=null){if(r.locked)continue;let d=parseFloat(e["attr-end-y"])/10;R.getInstance().unit!="mil"&&(d=s.conversion(R.getInstance().unit,"mil",d)),d=d+n.y,c.end=new S(c.end.x,d)}}let h=r.getConnect(c,!0,!0,l),u=r.getConnect(c,!1,!0,l);h!=null&&JG(h,c.start,!1),u!=null&&JG(u,c.end)}}modifyD3ShellOutlineComponent(e,r){let i=new dt;if(e["attr-3d-shell-type"]!=null&&(r.type=e["attr-3d-shell-type"]),e["attr-3d-shell-push-cover-direction"]!=null&&(r.pushCoverDir=Number(e["attr-3d-shell-push-cover-direction"])),e["attr-3d-shell-top-inner-height"]!=null){let n=parseFloat(e["attr-3d-shell-top-inner-height"])/10;R.getInstance().unit!="mil"&&(n=i.conversion(R.getInstance().unit,"mil",n)),r.topInnerHeight=n}if(e["attr-3d-shell-bottom-inner-height"]!=null){let n=parseFloat(e["attr-3d-shell-bottom-inner-height"])/10;R.getInstance().unit!="mil"&&(n=i.conversion(R.getInstance().unit,"mil",n)),r.bottomInnerHeight=n}if(e["attr-3d-shell-height"]!=null){let n=parseFloat(e["attr-3d-shell-height"])/10;R.getInstance().unit!="mil"&&(n=i.conversion(R.getInstance().unit,"mil",n)),r.shellHeight=n}if(e["attr-3d-shell-substrate-height"]!=null){let n=parseFloat(e["attr-3d-shell-substrate-height"])/10;R.getInstance().unit!="mil"&&(n=i.conversion(R.getInstance().unit,"mil",n)),r.substrateHeight=n}if(e["attr-3d-lower-shell-height"]!=null){let n=parseFloat(e["attr-3d-lower-shell-height"])/10;R.getInstance().unit!="mil"&&(n=i.conversion(R.getInstance().unit,"mil",n)),r.botShellHeight=n}if(e["attr-3d-shell-thickness"]!=null){let n=parseFloat(e["attr-3d-shell-thickness"])/10;if(R.getInstance().unit!="mil"&&(n=i.conversion(R.getInstance().unit,"mil",n)),r.shellThickness=n,this.d3ShellObj instanceof mt||this.d3ShellObj instanceof _t){let s=this.d3ShellObj.getParent();s.strokeWidth=n}else this.d3ShellObj.strokeWidth=n}r.type==="DRAWER"&&this.d3ShellObj instanceof rr&&m6.correctPushCoverWidthAndHeight(r,this.d3ShellObj)&&A.publish("ui/toastMsg",{type:"warn",msg:"The width and height of the push cover type 3D shell should not be less than 5mm"},Q())}modifyD3ShellScrewPillarComponent(e,r){let i=new dt;if(e["attr-3d-shell-screw-specifications"]!=null&&(r.specification=e["attr-3d-shell-screw-specifications"]),e["attr-3dshell-Shell-screw-column-height"]!=null){let s=parseFloat(e["attr-3dshell-Shell-screw-column-height"])/10;R.getInstance().unit!="mil"&&(s=i.conversion(R.getInstance().unit,"mil",s)),S1.correctHeight(s,r)}if(e["automatic-calibration"]!=null&&(r.height=S1.getDefaultScrewHeight(this.obj.layerId)),e["attr-3dshell-shell-screw-hole-diameter"]!=null){let s=parseFloat(e["attr-3dshell-shell-screw-hole-diameter"])/10;R.getInstance().unit!="mil"&&(s=i.conversion(R.getInstance().unit,"mil",s)),S1.correctHoleDiameter(s,r)&&(r.specification="Custom")}if(e["attr-3dshell-shell-screw-thickness"]!=null){let s=parseFloat(e["attr-3dshell-shell-screw-thickness"])/10;R.getInstance().unit!="mil"&&(s=i.conversion(R.getInstance().unit,"mil",s)),S1.correctThickness(s,r)}if(e["attr-layerid"]!=null){let s=e["attr-layerid"]==55;r.needStiffener=s,r.needCounterbore=!s}if(e["attr-3d-shell-need-stiffener"]!=null){let s=e["attr-3d-shell-need-stiffener"]==="true";r.needStiffener=s}if(e["attr-3d-shell-stiffener-top-width"]!=null){let s=parseFloat(e["attr-3d-shell-stiffener-top-width"])/10;R.getInstance().unit!="mil"&&(s=i.conversion(R.getInstance().unit,"mil",s)),S1.correctStiffenerTopWidth(s,r)&&(r.specification="Custom")}if(e["attr-3d-shell-stiffener-bottom-width"]!=null){let s=parseFloat(e["attr-3d-shell-stiffener-bottom-width"])/10;R.getInstance().unit!="mil"&&(s=i.conversion(R.getInstance().unit,"mil",s)),S1.correctStiffenerBottomWidth(s,r)&&(r.specification="Custom")}if(e["attr-3d-shell-stiffener-height"]!=null){let s=parseFloat(e["attr-3d-shell-stiffener-height"])/10;R.getInstance().unit!="mil"&&(s=i.conversion(R.getInstance().unit,"mil",s)),S1.correctStiffenerHeight(s,r)&&(r.specification="Custom")}if(e["attr-3d-shell-stiffener-thickness"]!=null){let s=parseFloat(e["attr-3d-shell-stiffener-thickness"])/10;R.getInstance().unit!="mil"&&(s=i.conversion(R.getInstance().unit,"mil",s)),S1.correctStiffenerThickness(s,r)&&(r.specification="Custom")}if(e["attr-3d-shell-need-counterbore"]!=null){let s=e["attr-3d-shell-need-counterbore"]==="true";r.needCounterbore=s}if(e["attr-3d-shell-counterbore-height"]!=null){let s=parseFloat(e["attr-3d-shell-counterbore-height"])/10;R.getInstance().unit!="mil"&&(s=i.conversion(R.getInstance().unit,"mil",s)),S1.correctCounterboreHeight(s,r)&&(r.specification="Custom")}if(e["attr-3d-shell-counterbore-diameter"]!=null){let s=parseFloat(e["attr-3d-shell-counterbore-diameter"])/10;R.getInstance().unit!="mil"&&(s=i.conversion(R.getInstance().unit,"mil",s)),S1.correctCounterboreDiameter(s,r)&&(r.specification="Custom")}S1.correctAllProps(r),r.syncLatestData();let n=S1.getScrewPillarSizeInIframe(r);this.d3ShellObj.radius=n.outerRadius}modifyD3ShellEntityComponent(e,r,i){let n=new dt;if(e["attr-3dshell-entity-region-type"]!=null){let s=e["attr-3dshell-entity-region-type"];s==="top_bottom"?(r.lineId!=null&&La.getInstance().delConnectRelatedId(r.lineId,this.obj.globalIndex),r.type=s,r.lineId=null,this.obj.type="3D Shell - Top/Bottom Entity"):s==="side"&&(A.messageBus.publish("clearSelect",""),Fc.setGroup(i),Fc.addItem(this.obj.globalIndex),Fc.setOnceCallback(()=>{A.publish("tool","dropdrag")}),setTimeout(()=>{Fc.toggleTool()},0))}if(e["attr-3dshell-entity-region-stretch-length"]!=null){let s=parseFloat(e["attr-3dshell-entity-region-stretch-length"])/10;R.getInstance().unit!="mil"&&(s=n.conversion(R.getInstance().unit,"mil",s)),r.stretchLength=s}if(e["attr-3dshell-entity-region-belong"]!=null){let s=e["attr-3dshell-entity-region-belong"];r.belong=Number(s)}e["automatic-calibration"]!=null&&(r.stretchLength=r.type==="side"?XS.getDefaultSideSlotDepth(r.lineId):XS.getDefaultTopSlotDepth())}modifyD3ShellSlotRegionComponent(e,r,i){let n=new dt;if(e["attr-3d-shell-slot-depth"]!=null){let s=parseFloat(e["attr-3d-shell-slot-depth"])/10;R.getInstance().unit!="mil"&&(s=n.conversion(R.getInstance().unit,"mil",s)),r.slotDepth=s}if(e["attr-3dshell-slot-option-outline"]!=null){let s=e["attr-3dshell-slot-option-outline"];r.updateSlotOption(4,s)}if(e["attr-3dshell-slot-option-screw-pillar"]!=null){let s=e["attr-3dshell-slot-option-screw-pillar"];r.updateSlotOption(8,s)}if(e["attr-3dshell-slot-option-entity"]!=null){let s=e["attr-3dshell-slot-option-entity"];r.updateSlotOption(16,s)}if(r.syncLatestData(),e["attr-3d-shell-grooving-type"]!=null){let s=this.getD3SlotRegionType(e["attr-3d-shell-grooving-type"]);if(s==="Top"){let a=r.lineId;r.type=s,r.lineId=null,this.obj.type="3D Shell - Top Slot Region",a!=null&&La.getInstance().delConnectRelatedId(a,this.obj.globalIndex)}else s==="Side"&&(A.messageBus.publish("clearSelect",""),Fc.setGroup(i),Fc.addItem(this.obj.globalIndex),Fc.setOnceCallback(()=>{A.publish("tool","dropdrag")}),setTimeout(()=>{Fc.toggleTool()},0))}e["automatic-calibration"]!=null&&(r.slotDepth=r.type==="Side"?XS.getDefaultSideSlotDepth(r.lineId):XS.getDefaultTopSlotDepth())}getD3SlotRegionType(e){switch(e){case"Top":return"top_bottom";case"Side":return"side";case"top_bottom":return"Top";case"side":return"Side"}}};var Ppe=class extends kl{constructor(){super(...arguments);this.mark=null}set(e){return this.mark=e,this}getHtmlData(e){this.idList.push(e.globalIndex),this.count++,this.attrlist==null&&(this.attrlist={});let r=this.attrlist;return this.getSilkColor(e,r),(r["attr-id"]==null||r["attr-id"].value!=Ve)&&(r["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${Tr}${e.number}`),sourceId:e.globalIndex}),(r["attr-length"]==null||r["attr-length"].value!=Ve)&&(r["attr-length"]={title:"Length",value:this.getCompareValue("attr-length",e.length)}),this}modifyBy(e,r){let i=new dt,n=R.getInstance().unit;if(e["attr-length"]!=null){let s=parseFloat(e["attr-length"])/10;!isNaN(s)&&n!="mil"&&(s=i.conversion(n,"mil",s)),!isNaN(s)&&this.mark instanceof hh&&(this.mark.length=s)}e["attr-silk-color"]!=null&&(e["attr-silk-color"]===""||e["attr-silk-color"]==="none"?this.mark.silkColor=null:this.mark.silkColor=ee.of3(e["attr-silk-color"]))}};function vXe(o,t){let e=t["attr-select-net"];return!(e&&e.length>4096)}function xXe(o){let t=o.type,e=cb;switch(t){case"3D Shell - Outline":{let r=o.getComponent(),{botShellHeight:i,shellThickness:n,type:s,shellHeight:a}=r;if(a<e||s==="T&B"&&(i<e||i>a))return!1;let c=new dt().mil2mm(n*10);if(c>3||c<1)return!1;break}}return!0}var tU=class o{constructor(t){this.type="Normal";this.preTask=null;this._state="Pending";this.weight=0;this.nextTaskList=[];t(this.getChangeStateCallback())}static all(t){let e=t.length;return e?new o(({resolve:r,reject:i})=>{let n=[];t.forEach((s,a)=>{s.next((l,c)=>{e--,n[a]=c,e||r(n)}).catch((l,c)=>{i(c)})})}):new o(r=>r.resolve())}set state(t){this._state==="Pending"&&(this._state=t)}get state(){return this._state}next(t){let e=new o(r=>{});return e.preTask=this,e.type="Normal",this.nextTaskList.push({task:e,callback:t}),this.doneNextTask(),e}catch(t){let e=new o(n=>{});e.preTask=this,e.type="Error",this.nextTaskList.push({task:e,callback:t});let r=e.preTask,i=null;for(;r&&(r.state==="Reject"&&(i=r),r.type!=="Error");)r=r.preTask;return i&&t(e.getChangeStateCallback(),i.message),e}release(t){this.updateState(this.weight-1,t)}add(){this.updateState(this.weight+1)}resolve(t){this.updateState(-1,t)}reject(t){this.updateState(1/0,t)}updateState(t,e){this.state==="Pending"&&(this.weight=t,this.message=e,isFinite(t)?t<0&&(this.state="Resolve"):this.state="Reject",this.doneNextTask())}doneNextTask(){this.state!=="Pending"&&(this.state==="Reject"?this.searchCatchTask(this).forEach(e=>{let{task:r,callback:i}=e;i(r.getChangeStateCallback(),this.message)}):this.nextTaskList.forEach(t=>{let{task:e,callback:r}=t;if(e.type!=="Error")try{r(e.getChangeStateCallback(),this.message)}catch(i){console.log(i)}}),this.nextTaskList=[])}searchCatchTask(t){let e=[t],r=[];for(;e.length;){let i=e.shift();if(!i)break;i.nextTaskList.forEach(n=>{n.task.type==="Error"?r.push(n):e.push(n.task)})}return r}getChangeStateCallback(){return{add:this.add.bind(this),release:this.release.bind(this),resolve:this.resolve.bind(this),reject:this.reject.bind(this)}}};var Tpe=class extends kl{constructor(){super(...arguments);this.image=null}set(e){return this.image=e,this}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=R.getInstance().origin;this.attrlist==null&&(this.attrlist={});let i=this.attrlist;return(i["attr-id"]==null||i["attr-id"].value!=Ve)&&(i["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${Tr}${e.number}`),sourceId:e.globalIndex}),(i["attr-layerid"]==null||i["attr-layerid"].value!=Ve)&&(i["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:Un.trueColorImage()}),(i["attr-width"]==null||i["attr-width"].value!=Ve)&&(i["attr-width"]={title:"Width",value:this.getCompareValue("attr-width",je(e.width))}),(i["attr-height"]==null||i["attr-height"].value!=Ve)&&(i["attr-height"]={title:"Height",value:this.getCompareValue("attr-height",je(e.height))}),(i["attr-mirror"]==null||i["attr-mirror"].value!=Ve)&&(i["attr-mirror"]={title:"Mirror",value:this.getCompareValue("attr-mirror",e.mirror?"yes":"no")}),(i["attr-combination"]==null||i["attr-combination"].value!=Ve)&&(i["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",Ht.getGroupNameByGroupId(e.getGroupID())||""),options:Ht.getCombin(),hasParent:e.getParent()!=null}),(i["attr-start-x"]==null||i["attr-start-x"].value!=Ve)&&(i["attr-start-x"]={title:"Start X",value:this.getCompareValue("attr-start-x",je(e.start.x-r.x))}),(i["attr-start-y"]==null||i["attr-start-y"].value!=Ve)&&(i["attr-start-y"]={title:"Start Y",value:this.getCompareValue("attr-start-y",je(e.start.y-r.y))}),(i["attr-rotation"]==null||i["attr-rotation"].value!=Ve)&&(i["attr-rotation"]={title:"Rotation",value:this.getCompareValue("attr-rotation",Yl(ve(e.rotation/Math.PI*180,3)))}),(i["attr-locked"]==null||i["attr-locked"].value!=Ve)&&(i["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",e.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),this}modifyBy(e,r){let i=new dt,n=R.getInstance().origin;if(e["attr-layerid"]!=null){if(this.image.locked)return;let s=parseInt(e["attr-layerid"]);this.image.layerId=s}if(e["attr-combination"]!=null){if(this.image.locked)return;this.modifyCombination(e["attr-combination"],this.image).forEach(a=>{r.addCommand(a)})}if(e["attr-width"]!=null){let s=parseFloat(e["attr-width"])/10;s=this.getValue(s),s=i.conversion(R.getInstance().unit,"mil",s),s>=gO&&(s=gO),s>0&&(Hb()&&(this.image.height=this.image.height/this.image.width*s),this.image.width=s)}if(e["attr-height"]!=null){let s=parseFloat(e["attr-height"])/10;s=this.getValue(s),s=i.conversion(R.getInstance().unit,"mil",s),length>=yO&&(length=yO),s>0&&(Hb()&&(this.image.width=this.image.width/this.image.height*s),this.image.height=s)}if(e["attr-mirror"]!=null){if(this.image.locked)return;let s=e["attr-mirror"]=="yes";this.image.mirror=s}if(e["attr-start-x"]!=null){if(this.image.locked)return;let s=parseFloat(e["attr-start-x"])/10;s=this.getValue(s),R.getInstance().unit!="mil"&&(s=i.conversion(R.getInstance().unit,"mil",s)),s=s+n.x;let a=new S(s,this.image.start.y);this.image.start=a}if(e["attr-start-y"]!=null){if(this.image.locked)return;let s=parseFloat(e["attr-start-y"])/10;s=this.getValue(s),R.getInstance().unit!="mil"&&(s=i.conversion(R.getInstance().unit,"mil",s)),s=s+n.y;let a=new S(this.image.start.x,s);this.image.start=a}if(e["attr-rotation"]!=null){if(this.image.locked)return;let s=parseFloat(e["attr-rotation"])/180*Math.PI;s=this.getValue(s),this.image.rotation=s}if(e["attr-locked"]!=null){let s=e["attr-locked"]=="yes";this.image.locked=s}}};var Ipe=class extends kl{constructor(){super();this.tearDrop=null}set(e){return this.tearDrop=e,this}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=R.getInstance().origin;this.attrlist==null&&(this.attrlist={});let i=this.attrlist;return(i["attr-id"]==null||i["attr-id"].value!=Ve)&&(i["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${Tr}${e.number}`),sourceId:e.globalIndex}),(i["attr-layerid"]==null||i["attr-layerid"].value!=Ve)&&(i["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:this.getLayer()}),(i["attr-select-net"]==null||i["attr-select-net"].value!=Ve)&&(i["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",e.showNet),options:this.poolCache.allNetOptions||Ye.getNet()}),(i["attr-locked"]==null||i["attr-locked"].value!=Ve)&&(i["attr-locked"]={title:"Locked",value:this.getCompareValue("attr-locked",e.locked?"yes":"no"),options:this.poolCache.lockSettingOptions}),(i["attr-combination"]==null||i["attr-combination"].value!=Ve)&&(i["attr-combination"]={title:"Combination",value:this.getCompareValue("attr-combination",Ht.getGroupNameByGroupId(e.getGroupID())||""),options:Ht.getCombin()}),this}modifyBy(e,r){if(e["attr-combination"]!=null){let i=this.modifyCombination(e["attr-combination"],this.tearDrop);r&&i.forEach(n=>{r.addCommand(n)})}}getLayer(){let e=new Array,i=Ze.getInstance().getAllItem();for(let n of i)12!=n.layerId&&11!=n.layerId&&7!=n.layerId&&8!=n.layerId&&57!=n.layerId&&47!=n.layerId&&n.config&&!mu(n.type)&&!W9(n.layerId)&&![52].includes(n.layerId)&&!ra(n.layerId)&&e.push({text:n.name,value:n.layerId});return e}};var Cpe=class extends kl{constructor(){super();this.copperResult=null;this.showAddSolderMaskRegion=!0}set(e){return this.copperResult=e,this}getHtmlData(e){this.idList.push(e.globalIndex),this.count++;let r=R.getInstance().origin;this.attrlist==null&&(this.attrlist={});let i=this.attrlist;(i["attr-id"]==null||i["attr-id"].value!=Ve)&&(i["attr-id"]={title:"ID",value:this.getCompareValue("attr-id",`${Tr}${e.number}`),sourceId:e.globalIndex}),(i["attr-layerid"]==null||i["attr-layerid"].value!=Ve)&&(i["attr-layerid"]={title:"Layer",value:this.getCompareValue("attr-layerid",e.layerId),options:this.getLayer()}),(i["attr-select-net"]==null||i["attr-select-net"].value!=Ve)&&(i["attr-select-net"]={title:"Net",value:this.getCompareValue("attr-select-net",e.showNet),options:this.poolCache.allNetOptions||Ye.getNet()});let n=e.getParent();return(i["attr-select-parent-set"]==null||i["attr-select-parent-set"].value!=Ve)&&(i["attr-select-parent-set"]={title:"Parent",value:this.getCompareValue("attr-select-parent-set",n?`${Tr}${n.number}`:""),sourceId:n?n.globalIndex:""}),[1,2].includes(e.layerId)||(this.showAddSolderMaskRegion=!1),this}getExtra(){return{showAddSolderMaskRegion:this.showAddSolderMaskRegion}}modifyBy(e,r){}getLayer(){let e=new Array,r=Ze.getInstance().getAllItem();for(let i of r)12!=i.layerId&&11!=i.layerId&&7!=i.layerId&&8!=i.layerId&&57!=i.layerId&&47!=i.layerId&&i.config&&!mu(i.type)&&!W9(i.layerId)&&![52].includes(i.layerId)&&!ra(i.layerId)&&e.push({text:i.name,value:i.layerId});return e}};var Spe=class extends ro{constructor(t){super(),this.data=t.toJSON(),this.action="modify"}rebuild(){let{layerId:t,keepIsland:e}=this.data;Pe.updatePlanzoneLayerKeepIsland(t,e),Pd.updateProfileItem(t,new e4(t,e))}getItem(){return"ignore"}remove(){let{layerId:t,keepIsland:e}=this.data}modify(){let{layerId:t,keepIsland:e}=this.data;Pe.updatePlanzoneLayerKeepIsland(t,e),Pd.updateProfileItem(t,new e4(t,e))}upload(t){let e=this.isDelete(t),r=Pe.getLayerPhy(this.data.layerId);r!=null&&h8(r,e)}updateData(){}};function RXe(o,t){_Rt(o);let e=o,r=[];if(t.forEach(s=>{s.isChecked&&r.push(s.value)}),r.length<=0)return e.primitiveType=e.primitive.length===1?e.primitive[0]:"PCB",e;if(r.length===1)return e.primitiveType=r[0],e;if(r.length===2&&r.includes("TESTPOINTER")&&r.includes("PAD"))return e.primitiveType="PAD",e.primitiveTitle="Multiple Objects",e;let i="MULTI",n=vRt(o,i);return n?(n.primitiveType=i,n):(console.warn("the selected element has no public attributes."),e.primitiveType=i,e.attrlist={[i]:{}},e)}function _Rt(o){for(let t in o.attrlist)o.notShowNetPrimitive.has(t)&&delete o.attrlist[t]["attr-select-net"]}function vRt(o,t){let e={},r=o.attrlist;Object.keys(r).forEach(l=>{e[l]=Object.keys(r[l])});let i=xRt(e);if(!i.length)return null;o.attrlist={[t]:{}};let n=Object.keys(r),s=o.attrlist[t];for(let l=0;l<n.length;l++){let c=r[n[l]];for(let h=0;h<i.length;h++){let u=i[h];s[u]?typeof s[u].options<"u"&&typeof c[u].options<"u"&&(s[u].options=RRt(s[u].options,c[u].options)):s[u]=c[u],String(s[u].value)!==String(c[u].value)&&(s[u].value=Ve)}}let a=Object.values(s);for(let l=0;l<a.length;l++)typeof a[l].options<"u"&&typeof a[l].value<"u"&&Hv(a[l].options,"value",a[l].value).index<=-1&&a[l].value!==""&&a[l].options.unshift({text:a[l].value,value:a[l].value,disabled:!0});return o}function xRt(o){let t=Object.keys(o);if(!t.length)return[];let e=o[t[0]];return t.reduce((r,i,n,s)=>(e=e.filter(a=>o[i].indexOf(a)!==-1),e),o[t[0]]),e}function RRt(o=[],t=[]){let[e,r]=[o,t];o.length>t.length&&(e=t,r=o);let i=[];for(let n=0;n<e.length;n++)Hv(r,"value",e[n].value).data&&i.push({text:e[n].text,value:e[n].value});return i}function DXe(o,t){let e=t.combination;typeof e.names<"u"&&(o.selectCount=e.names.length,o.selectNumberForId=e.names.length),o.primitiveTitle=rGe}function wXe(o,t={}){let e=[];return o.forEach(r=>{let i=typeof t[r]<"u"?t[r]:!0;e.push({title:r,value:r,isChecked:i})}),e}function LXe(o){if(typeof o.status>"u"){let t={};for(let e=0;e<o.primitive.length;e++)t[o.primitive[e]]=!0;o.status=t}}function MXe(o,t){let e=DRt(o,t);return{...o,...e,primitiveType:"-",primitiveTitle:"",unit:o.unit,status:o.status,doctype:o.doctype,callScene:o.callScene,combination:typeof o.combination=="object"?o.combination:null,extra:{...e.extra,...o.extra}}}function DRt(o,t){let e=o.primitive.filter(m=>o.status[m]===!0),r=e.length===1&&e[0]==="DEVICE",i=e.length===1&&e[0]==="PAD",n=new Set;if(o.primitive.length<=1){let m=o.primitive[0],g=t[m][0];return g.hasNonSignalLayerItem&&n.add(m),{attrlist:g.attrlist,idListOfPrimitive:g.idListOfPrimitive,selectNumberForId:g.selectNumberForId,selectCount:o.selectCount||g.selectCount,extra:g.extra,isOnlySelectedDevices:r,isOnlySelectedPads:i,notShowNetPrimitive:n}}let s={},a={},l=0,c=0,h={},u,d,p=o.status.PAD&&o.status.TESTPOINTER;for(let m=0;m<o.primitive.length;m++){let g=o.primitive[m];if(!o.status[g]||p&&g=="TESTPOINTER")continue;let y=t[g][0];s[g]=y.attrlist[g],a[g]=y.idListOfPrimitive[g],l+=y.selectNumberForId,c+=y.selectCount,u!==!0&&(u=y.extra.existingInDevice),d!==!0&&(d=y.extra.hasDefaultTextTypeface),y.hasNonSignalLayerItem&&n.add(g),h={...h,...y.extra,existingInDevice:u,hasDefaultTextTypeface:d}}return{attrlist:s,idListOfPrimitive:a,selectNumberForId:l,selectCount:c,extra:h,isOnlySelectedDevices:r,notShowNetPrimitive:n}}function rU(o){var s;let{body:t,head:e}=o;LXe(e);let r=wXe(e.primitive,e.status),i=MXe(e,t),n=RXe(i,r);return n.isAllCombination=((s=e.combination)==null?void 0:s.isAllCombination)||!1,n.isAllCombination&&DXe(n,e),{blendedData:n,primitiveTypeList:r}}var Epe=class{constructor(){this.d3Shell=new u_;this.filter=new ype;this.customComponents=new Map;this.logger=new Di(1);this.updating=!1;this.pad=new HI,this.padTest=new bpe,this.polygonpad=new wD,this.track=new Fue,this.arctrack=new Vue,this.via=new Gue,this.component=new Gj,this.lineloop=new gE,this.mark=new fpe,this.smartDimension=new Ppe,this.text=new Jq,this.image=new mpe,this.trueColorPicture=new Tpe,this.plane=new gpe,this.d3ShellOutline=new u_,this.d3ShellScrewPillar=new u_,this.d3ShellSlotDatunLine=new u_,this.d3ShellGroovinGarea=new u_,this.d3ShellEntity=new u_,this.tearDrop=new Ipe,this.fpcStiffener=new gE,this.annotation=new gE,this.componentAttrText=new Jq,this.copperResult=new Cpe,this.modifiedLayerIdsOnPlaneZone=[],this._modifiedKeysFromUI=new Set,A.subscribe("flushAttrPlane",this.flushDeviceAttrPlane.bind(this)),A.subscribe("selecting",this.parse.bind(this)),A.subscribe("attrUpdate",this.preprocess.bind(this),Q()),A.subscribe("togglePrimitiveCheckedByPanel",t=>{this.filter.setStatus(t),this.filter.keepLast=!0,A.publish("flushSelectingInfo","")}),A.subscribe("selectSource",t=>this.selectSource=t),this.resetAllHtmlObjectCache()}getAttributePlaneFilterControl(){return this.filter}parse(t){this.antiShake==null?this.antiShake=this.send(t):(clearTimeout(this.antiShake),this.antiShake=this.send(t))}filter2(t){return t instanceof mn||t instanceof AD||t instanceof qc||t instanceof He&&(t.type=="Annotation"||t.type=="Partition")}send(t){return setTimeout(()=>{var x;if(!R.getInstance().isactive||R.getInstance().doctype==23)return!1;let{items:e,triggerFrom:r}=t;if(this.resetAllHtmlObjectCache(),R.getInstance().envFlag==="cnc-preview"){let D=rYe(e)[0],w=!1;if(D){let F=D instanceof lt||D instanceof Pr?D:D.getParent();if(F instanceof lt||F instanceof Pr){let H=F.globalIndex,z=F instanceof Pr?!0:F.isClose(),V=F.getComponent(),W=0,L=0,k=!1;V&&(V instanceof ml?(L=V.stretchLength,k=!0):V instanceof wh&&(W=V.slotDepth)),!L&&pt.getAllItem().some(U=>{let B=U.getComponent();return B&&B instanceof ml?(L=B.stretchLength,!0):!1});let N={id:H,isClose:z,isShell:k,depth:W,thickness:L};w=!0,A.publish("/ui/attributeForCnc",N,Q())}}return!w&&A.publish("/ui/unAttributeForCnc","",Q()),!1}let n=this.getHead(),s={};this.prevGetHtmlDataHandler();let a=!1,l=null,c=new Set,h=new Set,u=new Map,d=new Set,p=!1,m=0,g=0,y=0,b=null,P=!1,T=new Map;for(let v of e){if(!a&&To.isAnnotation(v)&&v instanceof rr&&(a=!0,l=v),this.filter2(v))continue;if(v instanceof mt||v instanceof _t){let z=v.getParent();z instanceof lt&&z.getSelects().length>1&&(v=z)}let D=v.getGroupID();if(D!=null&&D!=""){d.add(D);let z=u.get(D)||0;u.set(D,++z),g++}!P&&v instanceof Ge&&(b==null?(b=new uf(v,!1),y=v.length):b.all.has(v)?y+=v.length:(y=0,P=!0)),p||(p=!this.filter.inOld(v)),m++;let w=this.getType(v);if(w==null)continue;c.add(w),h.add(v.globalIndex);let F=this.getHtmlData(v);if(F==null)continue;let H=T.get(w);H==null&&(H=new Set,T.set(w,H)),H.add(F)}let I=T.size==1&&T.has("DEVICE"),C=T.size==1&&T.has("PAD");for(let[v,D]of T){let w=s[v];for(let F of D)I&&v=="DEVICE"&&F instanceof Gj&&F.updateAttrlist4OnlyComponents(),C&&v=="PAD"&&(F instanceof HI||F instanceof wD)&&F.updateAttrlist4OnlyPads(),w==null?(w=[F.getResult(v)],s[v]=w):this.merge(v,w[0],F.getResult(v))}!p&&m==0&&(p=!0);let E=this.filter.update4(p,h).getStatus4Types(c);if(T.has("PAD")&&T.has("TESTPOINTER")&&E.PAD&&E.TESTPOINTER&&(this.merge("PAD",s.PAD[0],s.TESTPOINTER[0],"TESTPOINTER"),delete s.TESTPOINTER),n.status=E,this.shieldCombination())this.selectSource=void 0,this.isAllCombination=!1;else{if(m!=g)n.combination=void 0;else{let v=!1;for(let[D,w]of u){let F=Ht.getItem(D);if(F!=null&&F.size==w)v=!0;else{v=!1;break}}n.combination={isAllCombination:v,names:Array.from(d).map(D=>Ht.getGroupNameByGroupId(D))}}(x=n.combination)!=null&&x.isAllCombination?this.isAllCombination=!0:this.isAllCombination=!1}if(y&&s.TRACK.forEach(v=>{v.attrlist.TRACK["attr-track-length"].value=je(y)}),m==0){let v=this.getHtmlData(null);c.add("PCB"),s.PCB=[v.getResult("PCB")]}a&&(n.Annotation={id:l.globalIndex},n.selectCount=e.length-1),c.forEach(v=>{n.primitive.push(v)}),n.readonly=R.getInstance().isReadOnlyMode,n.triggerFrom=r,n.triggerKeys=Array.from(this._modifiedKeysFromUI);let _={head:n,body:s};if(this.modifyAttributeDataByDrawCmd(_,we.getCommand()),n.primitive.length!==0){let v=rU(_);this.logger.debug2(v),A.publish("attributePlane",v,Q())}this.antiShake=null,this.updating=!1,this.resetAllHtmlObjectCache(),this._modifiedKeysFromUI.clear()},100)}merge(t,e,r,i=t){let n=r.attrlist[i],s=e.attrlist[t];for(let a in n){let l=n[a],c=s[a];if(c!=null)if(t=="PAD"&&a=="attr-array")for(let h=0;h<c.value.length;h++){let u=c.value[h],d=l.value.find(p=>p.key==u.key);u.value!==d.value&&(u.value=Ve),(u.update||d.update)&&(u.update=!0)}else c.value!=l.value&&(c.value=Ve)}if(xe.addAll(e.idListOfPrimitive[t],r.idListOfPrimitive[i]),e.selectNumberForId+=r.selectNumberForId,e.selectCount+=r.selectCount,(e.isOnlySelectedDevices||r.isOnlySelectedDevices)&&(e.isOnlySelectedDevices=!0),(e.isOnlySelectedPads||r.isOnlySelectedPads)&&(e.isOnlySelectedPads=!0),e.notShowNetPrimitive||r.notShowNetPrimitive){let a=e.notShowNetPrimitive||new Set;r.notShowNetPrimitive&&xe.addAllSet(a,r.notShowNetPrimitive),e.notShowNetPrimitive=a}(e.hasNonSignalLayerItem||r.hasNonSignalLayerItem)&&(e.hasNonSignalLayerItem=!0),e.extra={...e.extra,...r.extra}}handleContactSameNetTrackLength(t){let e=t.filter(l=>l instanceof Ir||l instanceof yi),r=0;if(!e.length)return{length:r,collectTracks:e};let i=new uf(e[0],!1),n=[];for(let l of i.all)n.push(l.gId);let s=e.every(l=>n.includes(l.gId)),a=e.every(l=>l.net==e[0].net);if(s&&a)for(let l=0;l<e.length;l++)r+=e[l].length;return{length:r,collectTracks:e}}resetAllHtmlObjectCache(){uu&&(uu.poolCache={}),this.pad.poolCache={},this.padTest.poolCache={},this.polygonpad.poolCache={},this.track.poolCache={},this.arctrack.poolCache={},this.via.poolCache={},this.component.poolCache={},this.lineloop.poolCache={},this.mark.poolCache={},this.smartDimension.poolCache={},this.text.poolCache={},this.image.poolCache={},this.trueColorPicture.poolCache={},this.plane.poolCache={},this.d3ShellOutline.poolCache={},this.d3ShellScrewPillar.poolCache={},this.d3ShellSlotDatunLine.poolCache={},this.d3ShellGroovinGarea.poolCache={},this.d3ShellEntity.poolCache={},this.tearDrop.poolCache={},this.copperResult.poolCache={},this.fpcStiffener.poolCache={},this.annotation.poolCache={},this.componentAttrText.poolCache={},this.track.clearCache(),this.arctrack.clearCache(),this.pad.clearCache(),this.via.clearCache(),this.padTest.clearCache(),this.polygonpad.clearCache(),this.component.clearCache(),this.lineloop.clearCache(),this.mark.clearCache(),this.smartDimension.clearCache(),this.text.clearCache(),this.image.clearCache(),this.tearDrop.clearCache(),this.trueColorPicture.clearCache(),this.plane.clearCache(),this.d3ShellOutline.clearCache(),this.d3ShellScrewPillar.clearCache(),this.d3ShellSlotDatunLine.clearCache(),this.d3ShellGroovinGarea.clearCache(),this.d3ShellEntity.clearCache(),this.copperResult.clearCache(),this.fpcStiffener.clearCache(),this.annotation.clearCache(),this.componentAttrText.clearCache()}prevGetHtmlDataHandler(){let t=Ye.getNet();uu.poolCache.allNetOptions=t,this.pad.poolCache.allNetOptions=t,this.padTest.poolCache.allNetOptions=t,this.polygonpad.poolCache.allNetOptions=t,this.track.poolCache.allNetOptions=t,this.arctrack.poolCache.allNetOptions=t,this.via.poolCache.allNetOptions=t,this.component.poolCache.allNetOptions=t,this.lineloop.poolCache.allNetOptions=t,this.mark.poolCache.allNetOptions=t,this.smartDimension.poolCache.allNetOptions=t,this.text.poolCache.allNetOptions=t,this.image.poolCache.allNetOptions=t,this.trueColorPicture.poolCache.allNetOptions=t,this.plane.poolCache.allNetOptions=t,this.d3ShellOutline.poolCache.allNetOptions=t,this.d3ShellScrewPillar.poolCache.allNetOptions=t,this.d3ShellSlotDatunLine.poolCache.allNetOptions=t,this.d3ShellGroovinGarea.poolCache.allNetOptions=t,this.d3ShellEntity.poolCache.allNetOptions=t,this.tearDrop.poolCache.allNetOptions=t,this.copperResult.poolCache.allNetOptions=t,this.fpcStiffener.poolCache.allNetOptions=t,this.annotation.poolCache.allNetOptions=t,this.componentAttrText.poolCache.allNetOptions=t;let e=Un.abstractTrack();this.track.poolCache.trackLayerOptions=e,this.arctrack.poolCache.trackLayerOptions=e;let r=Ht.getCombin();this.pad.poolCache.combinationOptions=r,this.padTest.poolCache.combinationOptions=r,this.polygonpad.poolCache.combinationOptions=r,this.track.poolCache.combinationOptions=r,this.arctrack.poolCache.combinationOptions=r,this.via.poolCache.combinationOptions=r,this.component.poolCache.combinationOptions=r,this.lineloop.poolCache.combinationOptions=r,this.mark.poolCache.combinationOptions=r,this.smartDimension.poolCache.combinationOptions=r,this.text.poolCache.combinationOptions=r,this.image.poolCache.combinationOptions=r,this.trueColorPicture.poolCache.combinationOptions=r,this.plane.poolCache.combinationOptions=r,this.d3ShellOutline.poolCache.combinationOptions=r,this.d3ShellScrewPillar.poolCache.combinationOptions=r,this.d3ShellSlotDatunLine.poolCache.combinationOptions=r,this.d3ShellGroovinGarea.poolCache.combinationOptions=r,this.d3ShellEntity.poolCache.combinationOptions=r,this.tearDrop.poolCache.combinationOptions=r,this.copperResult.poolCache.combinationOptions=r,this.fpcStiffener.poolCache.combinationOptions=r,this.annotation.poolCache.combinationOptions=r,this.componentAttrText.poolCache.combinationOptions=r;let i=[{value:"yes",text:"Yes"},{value:"no",text:"No"}];this.pad.poolCache.lockSettingOptions=i,this.padTest.poolCache.lockSettingOptions=i,this.polygonpad.poolCache.lockSettingOptions=i,this.track.poolCache.lockSettingOptions=i,this.arctrack.poolCache.lockSettingOptions=i,this.via.poolCache.lockSettingOptions=i,this.component.poolCache.lockSettingOptions=i,this.lineloop.poolCache.lockSettingOptions=i,this.mark.poolCache.lockSettingOptions=i,this.smartDimension.poolCache.lockSettingOptions=i,this.text.poolCache.lockSettingOptions=i,this.image.poolCache.lockSettingOptions=i,this.trueColorPicture.poolCache.lockSettingOptions=i,this.plane.poolCache.lockSettingOptions=i,this.d3ShellOutline.poolCache.lockSettingOptions=i,this.d3ShellScrewPillar.poolCache.lockSettingOptions=i,this.d3ShellSlotDatunLine.poolCache.lockSettingOptions=i,this.d3ShellGroovinGarea.poolCache.lockSettingOptions=i,this.d3ShellEntity.poolCache.lockSettingOptions=i,this.tearDrop.poolCache.lockSettingOptions=i,this.copperResult.poolCache.lockSettingOptions=i,this.fpcStiffener.poolCache.lockSettingOptions=i,this.annotation.poolCache.lockSettingOptions=i,this.componentAttrText.poolCache.lockSettingOptions=i}getHtmlData(t){return t==null?uu.getHtmlData():t instanceof hh?this.smartDimension.getHtmlData(t):t instanceof qs?this.mark.getHtmlData(t):t instanceof Ga?this.mark.getHtmlData(t):t instanceof da?this.mark.getHtmlData(t):t instanceof _i?t.isTestPad?this.padTest.getHtmlData(t):this.pad.getHtmlData(t):t instanceof sn?this.polygonpad.getHtmlData(t):t instanceof Pr?ra(t.layerId)?this.get3DShellHemlData(t):this.getProfileHtmlData(t):t instanceof rr?ra(t.layerId)?this.get3DShellHemlData(t):this.getProfileHtmlData(t):t instanceof lt?ra(t.layerId)?this.get3DShellHemlData(t):this.getProfileHtmlData(t):t instanceof mt?ra(t.layerId)?this.get3DShellHemlData(t):this.lineloop.getHtmlData(t):t instanceof _t?ra(t.layerId)?this.get3DShellHemlData(t):this.lineloop.getHtmlData(t):t instanceof lr?t.key!==""?this.componentAttrText.getHtmlData(t):this.text.getHtmlData(t):t instanceof Mn?this.image.getHtmlData(t):t instanceof Ps?this.trueColorPicture.getHtmlData(t):t instanceof Ir?this.track.getHtmlData(t):t instanceof yi?this.arctrack.getHtmlData(t):t instanceof Ue?this.via.getHtmlData(t):t instanceof ke?this.component.getHtmlData(t):t instanceof Gi?this.plane.getHtmlData(t):t instanceof Jr?this.copperResult.getHtmlData(t):void 0}getType(t){return t instanceof hh?"SMARTDIMENSION":t instanceof qs?"TAGGING":t instanceof Ga?"TAGGING":t instanceof da?"TAGGING":t instanceof _i?t.isTestPad?"TESTPOINTER":"PAD":t instanceof sn?"PAD":t instanceof Pr?ra(t.layerId)?this.get3DShellPrimitive(t):ic(t.layerId)?"FPC_STIFFENER":"2DLINE":t instanceof rr?ra(t.layerId)?this.get3DShellPrimitive(t):ic(t.layerId)?"FPC_STIFFENER":To.isAnnotation(t)?"Annotation":"2DLINE":t instanceof lt?ra(t.layerId)?this.get3DShellPrimitive(t):ic(t.layerId)?"FPC_STIFFENER":t.type=="TearDrop"?"TEARDROP":"2DLINE":t instanceof mt?ra(t.layerId)?this.get3DShellPrimitive(t):ic(t.layerId)?"FPC_STIFFENER":"2DLINE":t instanceof _t?ra(t.layerId)?this.get3DShellPrimitive(t):ic(t.layerId)?"FPC_STIFFENER":"2DLINE":t instanceof lr?t.key!==""?"COMPONENT_ATTR_TEXT":"TEXT":t instanceof ke?"DEVICE":t instanceof Ge?"TRACK":t instanceof Ue?"VIA":t instanceof Mn?"IMAGE":t instanceof Ps?"TRUECOLORPICTRUE":t instanceof Gi?"PLANEZONE":t instanceof Jr?"COPPERRESULT":void 0}get3DShellPrimitive(t){switch((t instanceof mt||t instanceof _t?t.getParent():t).type){case"3D Shell - Outline":return"3D Shell - Outline";case"3D Shell - Screw Pillar":return"3D Shell - Screw Pillar";case"3D Shell - Side Datum Line":return"3D Shell - Side Datum Line";case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":return"3D Shell - Slot Region";case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":return"3D Shell - Entity";default:return}}get3DShellHemlData(t){switch((t instanceof mt||t instanceof _t?t.getParent():t).type){case"3D Shell - Outline":return this.d3ShellOutline.getHtmlData(t);case"3D Shell - Screw Pillar":return this.d3ShellScrewPillar.getHtmlData(t);case"3D Shell - Side Datum Line":return this.d3ShellSlotDatunLine.getHtmlData(t);case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":return this.d3ShellGroovinGarea.getHtmlData(t);case"3D Shell - Top/Bottom Entity":case"3D Shell - Side Entity":return this.d3ShellEntity.getHtmlData(t)}}getProfileHtmlData(t){switch(t.type){case"FPC Stiffener":return this.fpcStiffener.getHtmlData(t);case"Annotation":return this.annotation.getHtmlData(t);case"TearDrop":return this.tearDrop.getHtmlData(t);default:return this.lineloop.getHtmlData(t)}}getHead(){return{primitive:new Array,unit:R.getInstance().unit,doctype:R.getInstance().doctype,tabid:R.getInstance().tabId,status:{}}}preprocess(t){if(!Uq.executable())return;let e=new Set;sy.getInstance().set("Main");let r=t.head.primitive,i=t.body;for(let n of r){let s=i[n];switch(n){case"PAD":break;case"VIA":{let a=this.via.check(s);xe.addAllSet(e,a);break}case"FPC_STIFFENER":case"2DLINE":case"TEARDROP":{let a=new Jt;for(let l of s){let c=a.getItem(l["attr-id"]);if(c instanceof He){let h=this.lineloop.set(c).check(l);xe.addAllSet(e,h)}}break}}}if(e.size>0){let a=function(c,h){if(h){let u=new e0(c,()=>{let d=n.shift();a(d,n.length>0)},()=>{A.publish("selecting",{items:ze.getItems()})});A.publish("openMsgbox",u)}else{let u=new e0(c,()=>{s.update(t)},()=>{A.publish("selecting",{items:ze.getItems()})});A.publish("openMsgbox",u)}},n=Array.from(e),s=this,l=n.shift();a(l,n.length>0)}else this.update(t)}async update(t){if(!Uq.executable())return;this.updating=!0;let e=t.head.primitive;if(R.getInstance().doctype===4&&e[0]==="FOOTPRINT")this.footprintAttrUpdate(t);else switch(t.head.action){case"modifyPrimitiveDataByPanel":await this.updatePcbitemData(t);break}!(e.length==1&&e[0]=="PCB")&&t.head.callScene==="ATTR_PANEL"&&(gr.model=gr.model,A.publish("tool","dropdrag")),A.publish("flushSelectingInfo",{triggerFrom:"ATTR_PLANE_UPDATE"}),R.getInstance().isactive&&R.getInstance().doctype===4&&this.flushDeviceAttrPlane({isUpdateDeviceData:"",doNotReloadPrjTree:""}),A.publish("clearDimension",""),A.publish("updateFrame","")}needShowAskPadMoveOptionDlg(t){if(_d.notAsking||!t.head.primitive.includes("PAD"))return[];if(!t.body.PAD.some(n=>n["attr-x"]!=null||n["attr-y"]!=null))return[];let r=new Jt,i=new Array;return t.body.PAD.forEach(n=>{let s=n["attr-id"],a=r.getItem(s);a instanceof Le&&a.getParent()instanceof ke&&i.push(a)}),i}moveOneObject(t){let e=Object.keys(t.body);if(e.length==1&&t.body[e[0]].length==1){let r=t.body[e[0]][0],i=Object.keys(r).some(l=>["attr-x","attr-y"].includes(l)),s=new Jt().getItem(r["attr-id"]);if(s==null)return!1;let a=s instanceof Le&&s.getParent()instanceof ke&&!_d.moveWhole;if(i&&!a){let l=this.getType(s);if(l==null)return!1;let c=this.getHtmlData(s).getResult(l).attrlist[l],h=Object.keys(r).includes("attr-x"),u,d=R.getInstance().unit;return h?u=new S(na(r["attr-x"]-c["attr-x"].value,d,"mil")/10,0):u=new S(0,na(r["attr-y"]-c["attr-y"].value,d,"mil")/10),Is.getInstance().init([s],"move one object",(p,m)=>{new Zy(m).execute(p,u)}),!0}}return!1}async updatePcbitemData(t){if(!t.noNeedAskingPadMoveOption){let c=this.needShowAskPadMoveOptionDlg(t);if(c.length>0){_d.init(c,null,async()=>{t.noNeedAskingPadMoveOption=!0,await this.updatePcbitemData(t),A.publish("flushSelectingInfo","")});return}}if(this.moveOneObject(t))return;this.addHistory=!0;let e=new hi;e.createGroup("modify Primitive Data By Panel");let r=e.getCommand(),i=t.head.primitive,n=t.body,s=t.head,a=s.callScene||"ATTR_PANEL",l=[];this._modifiedKeysFromUI.clear(),this.recordModidifiedKeysFromUI(n);for(let c of i){let h=n[c];switch(c){case"PCB":uu.modifyBy(h[0]);break;case"VIA":this.modifyVia(h,r);break;case"TRACK":this.modifyTrack(h,r);break;case"TEXT":this.modifyText(h,r),ri.changeTextAttribute(h);break;case"COMPONENT_ATTR_TEXT":this.modifyText(h,r),ri.changeTextAttribute(h);break;case"TAGGING":this.modifyTagging(h,r);break;case"SMARTDIMENSION":this.modifySmartDimension(h,r);break;case"PLANEZONE":this.modifyPlaneZone(h,r);break;case"TESTPOINTER":case"PAD":this.modifyPad(h,r);break;case"FPC_STIFFENER":case"2DLINE":case"TEARDROP":l.push(new tU(u=>{this.modifyLine2d(h,e,u,a),u.release()}));break;case"3D Shell - Outline":case"3D Shell - Screw Pillar":case"3D Shell - Side Datum Line":case"3D Shell - Slot Region":case"3D Shell - Entity":this.modifyD3Shell(h,e);break;case"IMAGE":this.modifyImage(h,r);break;case"TRUECOLORPICTRUE":this.modifyTrueColorPictrue(h,r);break;case"DEVICE":l.push(new tU(u=>{this.modifyDevice(h,r,s.deviceSinlgeSelected),setTimeout(()=>u.resolve(),0)}));break}}for(let[c,h]of this.customComponents)e.addCommand4Item(c,"modify"),await new ff().updateCustomFootprint(c,e.getCommand(),Array.from(h));this.customComponents.clear(),tU.all(l).next((c,h)=>{this.addHistory&&(e.needUndo?e.undo():e.checkOutlines(e.items,new Set))}),this.modifiedLayerIdsOnPlaneZone.forEach(c=>{let h=Pd.fetchProfileItem(c);h&&r.addCommand(new Spe(h))}),this.modifiedLayerIdsOnPlaneZone.length=0,A.publish("autoFill",""),A.publish("flushService","")}modifyVia(t,e){if(this.via.isNeedOpenNetDialog(t)){let i=this.via.getNewNet(t),n=new Array;for(let s of t){let a=s["attr-id"];a!=null&&n.push(a)}Mde(n,i,e)}else for(let i of t){let n=Wr.getItem(i["attr-id"]);if(n==null)continue;let s=Ce.dispatch(n,"modify");e.addCommand(s),A.publish("hasModifyPcbItem",n),this.via.set(n).modifyBy(i,e),A.publish("hasModifyPcbItem",n),this.needGenerateCustomFootprint(n,i)}}modifyTrack(t,e){let r=this.track.isNeedAddVia(t),i=new Set,n=new Set,s=new Array,a=this.handleMultiTracksModifyLength(t);a&&(t=a.datas);for(let l=0;l<t.length;l++){a&&(a.currentIndex=l);let c=t[l],h=pr.getItem(c["attr-id"]);if(h==null)continue;let u=new ou(h);n.add(u);let d=Ce.dispatch(h,"modify");e.addCommand(d),A.publish("hasModifyPcbItem",h),h instanceof Ir?this.track.set(h).modifyBy(c,e,a):h instanceof yi&&this.arctrack.set(h).modifyBy(c,e,a),r&&(s.push(h.start),s.push(h.end)),i.add(h),A.publish("hasModifyPcbItem",h)}r&&Array.from(i).forEach((l,c)=>{let h=Array.from(n)[c];if(h.onlyConnectTrack(h.startNodes)&&!h.isSameLayer(l,h.startNodes)){let u=l.net,d=re.getInstance().getRadiusPhysicsByNet(u),p=ut.getDefaultVia(l.start,d.defalutRadius,d.defalutInner);p.net=l.net,e.addCommand(Ce.dispatch(p,"add")),A.publish("hasModifyPcbItem",p)}if(h.onlyConnectTrack(h.endNodes)&&!h.isSameLayer(l,h.endNodes)){let u=l.net,d=re.getInstance().getRadiusPhysicsByNet(u),p=ut.getDefaultVia(l.end,d.defalutRadius,d.defalutInner);p.net=l.net,e.addCommand(Ce.dispatch(p,"add")),A.publish("hasModifyPcbItem",p)}})}handleMultiTracksModifyLength(t){let e={type:"lengthen",currentIndex:0,modifyIndex:0,sum:0,offset:0,originLength:0,datas:t};if(t.length<=1||!t[0]["attr-track-length"])return e;let r=[];t.forEach(h=>{r.push(h["attr-id"])});let i=[],n=pr.getItem(t[0]["attr-id"]),s=new au(n),a=[];s.tracks.forEach((h,u)=>{let d=t.find(p=>h.gId==p["attr-id"]);d&&(d.hasMultiTrack=!0,a.push(d),h.start=s.pts[u].start(),h.end=s.pts[u].end(),i.push(h))});let l=t.filter(h=>!s.tracks.find(u=>u.gId==h["attr-id"]));l.length&&a.push(...l),t=a;let c=this.handleContactSameNetTrackLength(i);if(c.length){let h=parseFloat(t[0]["attr-track-length"])/10;if(R.getInstance().unit!="mil"&&(h=new dt().conversion(R.getInstance().unit,"mil",h)),h=h<=.01?.01:h,c.length>h){let u=c.length-h,d=0,p=c.collectTracks.length;for(;d<u&&p>0;){p--;d+=c.collectTracks[p].length}e={type:"shorten",currentIndex:0,modifyIndex:p,sum:d,offset:u,originLength:c.length,datas:t}}else c.length<h&&(e={type:"lengthen",currentIndex:0,modifyIndex:c.collectTracks.length-1,sum:0,offset:0,originLength:c.length,datas:t})}return e}modifyText(t,e){for(let r of t){let i=ri.getItem(r["attr-id"]);if(i!=null){let n=i.getParent();if(n!=null){let s=Ce.dispatch(n,"modify");e.addCommand(s)}else{let s=Ce.dispatch(i,"modify");e.addCommand(s)}A.publish("hasModifyPcbItem",i),this.text.set(i).modifyBy(r,e)}}}modifyTagging(t,e){let r=new Jt;for(let i of t){let n=r.getItem(i["attr-id"]);if(n instanceof ua){let s=Ce.dispatch(n,"modify");e.addCommand(s),A.publish("hasModifyPcbItem",n),this.mark.set(n).modifyBy(i,e)}}}modifySmartDimension(t,e){let r=new Jt;if(t.length!==1)return;let i=t[0],n=r.getItem(i["attr-id"]);if(n instanceof hh){let s=na(parseFloat(i["attr-length"])/10,R.getInstance().unit,"mil");isNaN(s)||(_s.initGroupCommand(e),ah.setSmartDimensionLength(s,i["attr-id"]),this.mark.set(n).modifyBy(i))}}modifyPad(t,e){let r=new Jt;for(let i of t){let n=r.getItem(i["attr-id"]),s=i["attr-number"];if(!/[^a-zA-Z0-9]/.test(s)&&n instanceof Le){if(!vXe(n,i))continue;let a=Ce.dispatch(n,"modify");e.addCommand(a),A.publish("hasModifyPcbItem",n),n instanceof _i?this.pad.set(n).modifyBy(i,e):n instanceof sn&&this.polygonpad.set(n).modifyBy(i,e),A.publish("hasModifyPcbItem",n),this.needGenerateCustomFootprint(n,i)}}}needGenerateCustomFootprint(t,e){let r=!1,i=t.getParent();if(i!=null&&i instanceof ke&&(t instanceof _i?r=this.pad.isShapeChange(e,_d.moveWhole):t instanceof sn?r=this.polygonpad.isShapeChange(e):t instanceof Ue&&(r=this.via.isShapeChange(e)),r)){let n=this.customComponents.get(i);n==null&&(n=new Set,this.customComponents.set(i,n)),n.add(t)}return r}modifyLine2d(t,e,r,i="ATTR_PANEL"){let n=new Jt,s=new Array,a;for(let l of t){let c=n.getItem(l["attr-id"]);if(c instanceof He){let h=c.type,u=l["attr-2dline-type"];if(u&&u!=h){a=u;break}}}if(a){let u=function(d){let p=qA.convertProfile(d,a,l,!1);for(let m of p){if(m instanceof He)if(Eo(m.getMathGraphics(m.layerId,0))){if(m instanceof lt){let g=lm(m,e.getCommand());m.type=="Copper Region"&&g.forEach(y=>{s.push(y.globalIndex)})}}else m.type=="Copper Region"&&s.push(m.globalIndex);e.items.push(m)}},l=e.getCommand(),c=[],h=[];for(let d of t){let p=n.getItem(d["attr-id"]);p instanceof He&&(["Fill Region","FPC Stiffener"].includes(p.type)&&p instanceof lt&&p.isComplexPolygon()?h.push(p):c.push(p))}if(h.length>0){let{newPolygons:d}=wV(h,l);d.forEach(p=>{u([p])})}c.length>0&&u(c)}else for(let l of t){let c=n.getItem(l["attr-id"]);c instanceof He&&(e.addCommand4Item(c,"modify"),this.lineloop.set(c).modifyBy(l,e.getCommand(),r),c.removeFill(),c.fill(),e.items.push(c),Eo(c.getMathGraphics(c.layerId,0))&&c instanceof lt&&lm(c,e.getCommand()).forEach(u=>{s.push(u.globalIndex)}),c.type=="Copper Region"&&!e.needUndo&&(l["attr-2dline-name"]!=null||l["attr-stroke-width"]!=null||l["attr-locked"]!=null||s.push(c.globalIndex)),A.publish("hasModifyPcbItem",c))}i==="ATTR_PANEL"&&s.length>0&&!e.needUndo&&A.publish("rebuildSingleCopper",{ids:s,isLast:!0}),A.publish("open2DlineWornDialog","")}modifyD3Shell(t,e){let r=new Jt,i=[];t.filter(s=>{let a=r.getItem(s["attr-id"]);if(a instanceof He)return i.push(a),!0}).forEach((s,a)=>{let l=i[a];l!=null&&(e.addCommand4Item(l,"modify"),this.d3Shell.set(l).modifyBy(s,e.getCommand()),l.refreshRender(),l.removeFill(),l.fill(),(s["attr-3d-shell-grooving-type"]==="side"||s["attr-3dshell-entity-region-type"]==="side")&&(this.addHistory=!1),Eo(l.getMathGraphics(l.layerId,0))?l instanceof lt&&lm(l,e.getCommand()):xXe(l)||(e.needUndo=!0))})}modifyImage(t,e){for(let r of t){let i=Bn.getItem(r["attr-id"]);if(i==null)continue;let n=Ce.dispatch(i,"modify");e.addCommand(n),A.publish("hasModifyPcbItem",i),this.image.set(i).modifyBy(r,e)}}modifyTrueColorPictrue(t,e){for(let r of t){let i=So.getItem(r["attr-id"]);if(i==null)continue;let n=Ce.dispatch(i,"modify");e.addCommand(n),A.publish("hasModifyPcbItem",i),this.trueColorPicture.set(i).modifyBy(r,e)}}modifyDevice(t,e,r){for(let i of t){let n=Ar.getItem(i["attr-id"]);if(n==null)continue;let s=Ce.dispatch(n,"modify");e.addCommand(s),A.publish("hasModifyPcbItem",n),this.component.set(n).modifyBy(i,e,r),A.publish("hasModifyPcbItem",n)}}modifyPlaneZone(t,e){for(let r of t)if(r["attr-isolated-island"]!=null){let i=zn.getItem(r["attr-id"]);this.modifiedLayerIdsOnPlaneZone.push(i.layerId)}for(let r of t){let i=zn.getItem(r["attr-id"]);if(i==null)continue;let n=Ce.dispatch(i,"modify");e.addCommand(n),A.publish("hasModifyPcbItem",i),this.plane.set(i).modifyBy(r),A.publish("hasModifyPcbItem",i)}}flushDeviceAttrPlane(t){let e={};e.primitive="FOOTPRINT",e.action="FOOTPRINT",e.unit=R.getInstance().unit,e.doctype=R.getInstance().doctype,e.from=R.getInstance().tabId,e.to="",e.owner=R.getInstance().owner;let r={},i=new V3;r.FOOTPRINT=i.getHtmlData();let n=i.getPadList(),s={head:e,body:r,activeTabId:this.updating?"pcb-attr":""};this.updating=!1,A.publish("updateFootprintAttributePlane",{result:s,list:n,params:t},Q())}footprintAttrUpdate(t){let e=t.head.action,i=t.body.FOOTPRINT;switch(this.logger.debug2(i),e){case"modifyFootprintDataByPanel":new V3().modifyBy(i);break}}modifyAttributeDataByDrawCmd(t,e){if(!e||e==="dropdrag")return;let{body:r,head:i}=t;for(let n=0;n<i.primitive.length;n++){let s=i.primitive[n];if(!s||!r[s])continue;let a=r[s][0].attrlist[s];switch(s){case"PCB":{if([4,23].includes(i.doctype))break;let c=a["attr-start-via-size"],h=a["attr-via-inside-diameter"],u=a["attr-via-outside-diameter"];e==="place_part(via)"?(h.disabled=!1,u.disabled=!1):(h.disabled=c.disabled,u.disabled=c.disabled);break}}}}recordModidifiedKeysFromUI(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let i=t[e[r]];for(let n=0;n<i.length;n++){let s=Object.keys(i[n]);for(let a=0;a<s.length;a++)["attr-id"].indexOf(s[a])>=0||this._modifiedKeysFromUI.add(s[a])}}}shieldCombination(){let t=Ri.getInstance().getItem(12),e=(t==null?void 0:t.pick)===!1,r=this.selectSource!==void 0&&this.selectSource!==null&&(this.selectSource===1||this.selectSource===0);return e&&r}};var NRt=Ru(r2());var LRt=Ru(r2()),_Oe=class{};_Oe.LogExport=!1;var ptl=new Di(0);var Atl=new Di(0),vOe=class{};vOe.LogExport=!1;var BRt=Ru(YR());var Mtl=1440*60*1e3;var NXe=Ru(YR());async function ROe(o){return new Promise(async(t,e)=>{let r=!!o.__onlyGetFileContent,i="export3DShell-time";Cn(i),console.log("/pcb/3d/shell/export_inframe",o);let n=0;if(VRt()){t({error:null,sensorsData:{documentNumber3D:n,err:"shape overlap"}}),Xi(i);return}let a=Zae(39.37,!0),l=await A.globalMessageBus.rpcCall(`/model/export/shell/${o.type}2`,[a,o.name,o.timeout],o.timeout);if(l.message=="Export timed out, if you have any questions, please contact customer service"){A.windowBridge.publish("exportTimeOut","",Q()),t({error:null,sensorsData:{documentNumber3D:n,err:"time out"}}),Xi(i);return}if(l.message==="Memory leak"){xOe([],"There are too many 3D shell primitives and insufficient memory to generate them"),t({error:null,sensorsData:{documentNumber3D:n,err:"memory leak"}}),Xi(i);return}if(l.message instanceof Array){if(l.message.length){let u=l.message.map(p=>p.id);xOe(FRt(u),"The following components have problems. Thin surfaces will be formed following the export of the shell file. Please adjust before exporting: "),t({error:null,sensorsData:{documentNumber3D:n,err:"thin surface"}}),Xi(i);return}return}let c=await NXe.default.loadAsync(await l.message),h=Object.keys(c.files);if(n=h.length,o.getFile){let u=h[0],d=u&&c.file(u);if(!d){t({error:null,sensorsData:{documentNumber3D:n,err:"no files"},blobData:null,fileName:o.name}),Xi(i);return}let p=await d.async("arraybuffer"),m=u.split("."),g=o.name?o.name+"."+m[m.length-1]:u;t({data:new File([p],g),error:null,sensorsData:{documentNumber3D:n},blobData:p,fileName:o.name}),Xi(i);return}else c.generateAsync({type:"blob",compression:"DEFLATE"}).then(async u=>{let d;r===!1&&(o.getType?d=(await ZI(u)).data:(D2?JI(u,o.name+".zip","zip"):xe.downloadFile(o.name+".zip",u),d=null)),t({data:d,error:null,sensorsData:{documentNumber3D:n},blobData:u,fileName:o.name}),Xi(i)})})}function FRt(o){let t=["3D Shell - Outline","3D Shell - Side Slot Region","3D Shell - Top Slot Region","3D Shell - Top/Bottom Entity","3D Shell - Side Entity","3D Shell - Screw Pillar","3D Shell - Side Datum Line"],e=pt.getAllItem().filter(n=>t.includes(n.type)),r=Xt.getAllItem().filter(n=>t.includes(n.type)),i=Kt.getAllItem().filter(n=>t.includes(n.type));return o.map(n=>{let s;return s=e.find(a=>a.globalIndex===n),!s&&(s=r.find(a=>a.globalIndex===n)),!s&&(s=i.find(a=>a.globalIndex===n)),{text:s?`${Tr}${s.number}`:"",id:s?s.globalIndex:""}})}function VRt(){let o=["3D Shell - Top Slot Region","3D Shell - Side Slot Region"],t=pt.getAllItem().filter(c=>o.includes(c.type)),e=Xt.getAllItem().filter(c=>o.includes(c.type)),r=Kt.getAllItem().filter(c=>o.includes(c.type)),i=[];s(t),s(e),s(r);let n="The following components entirely overlap one another, resulting in thin surfaces when the shell file is exported. Please adjust before exporting: ";if(i.length>0)return i.forEach(c=>{xOe(c,n)}),!0;return!1;function s(c){for(let h=0;h<c.length;h++){let u=c[h];for(let d=h+1;d<c.length;d++){let p=c[d];a(u,p)&&i.push([{text:`${Tr}${u.number}`,id:u.globalIndex},{text:`${Tr}${p.number}`,id:p.globalIndex}])}}}function a(c,h){if(c.type!==h.type||c.layerId!==h.layerId)return!1;let u=c.getComponent(),d=h.getComponent();if(u.type==="Side"&&(!u.lineId||!d.lineId||!l(u.lineId,d.lineId)))return!1;let p=c.getMathGraphics(),m=h.getMathGraphics();return p instanceof Bt&&(p=p.items[0]),m instanceof Bt&&(m=m.items[0]),p.equals(m)}function l(c,h){if(c===h)return!0;let u=pt.getItem(c),d=pt.getItem(h);if(u&&d){let p=u.getMathGraphics().primitives[0],m=d.getMathGraphics().primitives[0];return p.equals(m)}return!1}}function xOe(o,t){let e=[`<span class="i18n">${t}</span> `];for(let r=0;r<o.length;r++){let i={text:o[r].text,attr:{pcbId:R.getInstance().tabId,id:o[r].id}};e.push(i,", ")}o.length&&e.pop(),A.publish("logPublishProxy",{type:"fatalError",msg:e,openTab:!0},Q())}var GRt=Ru(r2()),DOe=null;var Ope=class{constructor(){this.on=!0;this.asyncText=0;this.modify=new Set;this.nets=new Map;this._needRePanelize=!1;this.awaitShake=null;this.componentChanged=!1;this.previousBBoxAndNet={};this.num=0;A.subscribe("hasModifyPcbItem",this.addModify.bind(this)),A.subscribe("hasModifyNet",this.addModifyNet.bind(this)),A.subscribe("flushService",this.flushService.bind(this)),A.subscribe("HistoryFlushService",this.historyFlushService.bind(this)),A.subscribe("AwaitService",this.awaitService.bind(this)),A.subscribe("DelayCopper",this.autoCopper.bind(this)),A.subscribe("DelayAutoAdaptAll",this.autoAdaptAll.bind(this)),A.subscribe("addAutoServiceModify",this.add2Modify.bind(this)),A.subscribe("CancelDelayAutoAdaptAll",this.cancelAutoAdaptAll.bind(this)),A.subscribe("ComponentChanged",t=>{!this.componentChanged&&t instanceof ke&&(this.componentChanged=!0)}),A.subscribe("AutoServiceClear",t=>{this.modify.clear(),this.nets.clear()}),A.subscribe("addPreviousBBoxAndNet",this.addPreviousBBoxAndNet.bind(this))}get needRePanelize(){return this._needRePanelize}set needRePanelize(t){this._needRePanelize=t}awaitService(t){this.asyncText>=0&&(this.asyncText+=t,this.asyncText==0&&this.awaitShake==null&&(this.awaitShake=this.awaitFun()),this.asyncText<0&&(this.asyncText=0))}awaitFun(){return setTimeout(()=>{this.asyncText>0?(this.awaitShake!=null&&clearTimeout(this.awaitShake),this.awaitShake=this.awaitFun()):(this.historyFlushService(),A.publish("flushSelectingInfo",""),this.awaitShake=null)},50)}itemNeedPanelize(t){var e;return t.isEmpty||!((e=si.getInstance().getDefaultPanelize())!=null&&e.on)?!1:!!(t.layerId&&t.layerId==11||t instanceof rr||t instanceof Pr||t instanceof lt||t instanceof ke&&t.getOutlines().length)}addPreviousBBoxAndNet(t){t.forEach(e=>{this.previousBBoxAndNet[e.id]={net:e.net,bbox:e.bbox}})}addModify(t){if(!(t==null||!this.on||t instanceof Tp||(Jl.getInstance().setModify(t),this.modify.add(t),this.needRePanelize=this.needRePanelize||this.itemNeedPanelize(t),!t.model))){if(t instanceof ke)t.getPads().forEach(n=>{this.addNet(n.net)}),t.getVias().forEach(n=>{this.addNet(n.net)});else if(t instanceof Ge)this.addNet(t.net),Ye.modifyNet(t.net);else if(t instanceof Le)this.addNet(t.net),t.getParent()!=null&&Ye.modifyNet(t.net);else if(t instanceof Ue)this.addNet(t.net);else if(t instanceof He)Ud(t.layerId)&&(t.type=="Fill Region"||t.type=="Line"||t.type=="TearDrop")&&this.addNet(t.net);else if(t instanceof Gi)this.addNet(t.net);else if(t instanceof Jr)this.addNet(t.net);else if(t instanceof mt){let r=t.getParent();r instanceof He&&Ud(r.layerId)&&(r.type=="Fill Region"||r.type=="Line"||r.type=="TearDrop")&&(this.addNet(r.net),this.modify.add(r))}else if(t instanceof _t){let r=t.getParent();r instanceof He&&Ud(r.layerId)&&(r.type=="Fill Region"||r.type=="Line"||r.type=="TearDrop")&&(this.addNet(r.net),this.modify.add(r))}}}addNet(t){this.num=(this.nets.get(t)||0)+1,this.nets.set(t,this.num)}initModify(t){if(this.on)for(let e of t)this.modify.add(e)}initModifyEnd(){var e;if(!this.on)return;if(this.nets=Ye.getNetCount(),((e=si.getInstance().getDefaultPanelize())==null?void 0:e.on)&&!this.needRePanelize){for(let r of this.modify)if(this.needRePanelize=this.needRePanelize||this.itemNeedPanelize(r),this.needRePanelize)break}}addModifyNet(t){this.addNet(t)}add2Modify(t){this.modify.add(t)}async updatePreviewModel(){this.componentChanged&&(DOe&&await A.windowBridge.rpcCall("/pcb/3d/model/refresh",await ZX(1,!0),DOe),this.componentChanged=!1)}nearbySameNetObjects(){if(!le.pcbConfig.realTimeUpdateUnusedLayers)return;let t={};for(let r of this.modify){let i=this.previousBBoxAndNet[r.globalIndex];if(i){let s=i.net;s&&e(i.bbox,s)}let n=r.net;r.isEmpty||(n?e(r.buildBBox(),n):(le.pcbConfig.unusedPadRange!=3&&r instanceof Le&&r.layerId==12||le.pcbConfig.unusedPadRange!=2&&r instanceof Ue)&&(t[""]==null&&(t[""]=new Set),t[""].add(r.globalIndex)))}return t;function e(r,i){t[i]||(t[i]=new Set);let n=new Array;le.pcbConfig.unusedPadRange!=3&&n.push("Pad"),le.pcbConfig.unusedPadRange!=2&&n.push("Via"),kt.search4Types(r,n).getResult(n).forEach(a=>{a.net==i&&t[i].add(a.globalIndex)})}}async flushService(){if(this.on){if(va.rebuildingRatlineInWorker){va.needFlushService=!0;return}if(va.needFlushService=!1,A.publish("checkRemoveAllPlane",""),A.publish("updateRtree",""),A.publish("updateConnectRelation",this.modify),A.messageBus2.rpcCall("rebuildRatline",{nets:this.nets,nearbySameNetObjects:this.nearbySameNetObjects()}),To.getInstance().changeElements(this.modify),A.publish("updateDRC",this.modify),A.publish("updateRtree",""),A.publish("updateFrame",""),A.publish("updateRadiusMark",""),A.publish("updateLastModifyInPcb","",Q()),A.publish("cycleNetwork",""),A.publish("updateNetLengthAndPadPairLength",new Set(this.nets.keys())),R.getInstance().doctype===pi.FOOTPRINT&&A.publish("flushAttrPlane",{isUpdateDeviceData:"",doNotReloadPrjTree:""}),this.modify.clear(),this.nets.clear(),setTimeout(()=>{A.publish("updateRtree","")},10),this.needRePanelize){this.needRePanelize=!1;let t=new L0;setTimeout(()=>t.reRender(),0)}this.updatePreviewModel(),A.publish("refreshHighLigth",""),qe.increaseUpload()}}async historyFlushService(t){let{openPcb:e,unRebuildRatline:r,isOtherUser:i=!1,delayRatline:n}=t||{};if(A.publish("checkRemoveAllPlane",""),A.publish("updateRtree",""),!r&&!n&&A.messageBus2.rpcCall("rebuildRatline",{nets:this.nets}),e||A.publish("updateDRC",this.modify),To.getInstance().changeElements(this.modify),A.publish("updateRtree",""),A.publish("updateFrame",""),A.publish("updateRadiusMark",""),A.publish("updateLastModifyInPcb","",Q()),A.publish("cycleNetwork",""),A.publish("updateNetLengthAndPadPairLength",new Set(this.nets.keys())),R.getInstance().doctype===pi.FOOTPRINT&&A.publish("flushAttrPlane",""),!r&&n&&this.nets.size>0){let s=new Map(this.nets);setTimeout(()=>{A.messageBus2.rpcCall("rebuildRatline",{nets:s})})}if(this.modify.clear(),this.nets.clear(),setTimeout(()=>{A.publish("updateRtree","")},10),this.needRePanelize){this.needRePanelize=!1;let s=new L0;setTimeout(()=>s.reRender(),0)}this.updatePreviewModel()}autoCopper(){this.antiShake==null&&(this.antiShake=this.delayCopper())}delayCopper(){return setTimeout(()=>{this.asyncText>0?(this.antiShake!=null&&clearTimeout(this.antiShake),this.antiShake=this.delayCopper()):(A.publish("rebuildCopper",{autoSave:!0}),this.antiShake=null)},10)}autoAdaptAll(){this.antiAutoAdaptAll==null&&(this.antiAutoAdaptAll=this.delayAdaptAll())}cancelAutoAdaptAll(){this.antiAutoAdaptAll!=null&&clearTimeout(this.antiAutoAdaptAll)}delayAdaptAll(){return setTimeout(()=>{if(this.asyncText>0)this.antiAutoAdaptAll!=null&&clearTimeout(this.antiAutoAdaptAll),this.antiAutoAdaptAll=this.delayAdaptAll();else{let t=R.getInstance().isactive;if(R.getInstance().isactive=!0,A.publish("adaptAll",1),R.getInstance().isactive=t,this.antiAutoAdaptAll=null,!va.multiThreadingOnOpen){let e="createPcbEditorToRendered-time";mte(e)&&(Xi(e),gte())}}},10)}};var v5=class extends yh{constructor(){super(...arguments);this.mgr=Hs.getInstance()}addControllerCache(e){kt.insert(e)}addImage(e,r,i,n,s,a,l,c){let h=nr(),u=Hs.getInstance().addImage(h,e,r,i,n,s,a,l,c),d=new Mn(u);return this.addControllerCache(d),d}addImageByModel(e,r=!1){if(r){let n=e.globalIndex;Hs.getInstance().getItem(n)==e&&Hs.getInstance().delete(e),e.globalIndex=nr(),Hs.getInstance().addModel(e)}let i=new Mn(e);return this.addControllerCache(i),i}rebuild(e,r,i,n,s,a,l,c,h){let u=Hs.getInstance().addImage(e,r,i,n,s,a,l,c,h),d=new Mn(u);return this.addControllerCache(d),d}copy(e){let{globalIndex:r,layerId:i,start:n,width:s,height:a,rotation:l,mirror:c,locked:h,template:u}=e;n=new S(n.x,n.y),u=Jh(u);let d=r.slice(0,-16)+nr();return this.rebuild(d,i,n,s,a,l,c,h,u)}delete(e){e instanceof Mn&&Hs.getInstance().delete(e.model)}};var Ape=class extends yh{constructor(){super(...arguments);this.mgr=qo.getInstance();this.nameManager=new T0}addControllerCache(e){Ye.addItem(e),kt.insert(e)}addCopperByModel(e){let r=new Jr(e);return this.addControllerCache(r),r}addCopper(e,r,i,n,s,a,l,c=.8){let h=nr(),u=qo.getInstance().addCopper(h,e,r,i,n,s,a,l,!1,c),d=new Jr(u);return this.addControllerCache(d),d}rebuildCopper(e,r,i,n,s,a,l,c,h=.8){let u=qo.getInstance().addCopper(e,r,i,n,s,a,l,c,!1,h),d=new Jr(u);return this.addControllerCache(d),d}delete(e){if(e instanceof He||e instanceof Jr){let r=e.model,i=e.getParent();i&&i.refreshRender(),qo.getInstance().delete(r,r.globalIndex)}}};var _pe=class extends yh{constructor(){super();this.mgr=Xo.getInstance();this.layerMapSet={};Xo.getInstance(),A.subscribe("startPlane",this.startPlane.bind(this)),A.subscribe("endPlane",this.endPlane.bind(this)),A.subscribe("endAllPlane",this.endAllPlane.bind(this))}addControllerCache(e){let r=e.layerId,i=this.layerMapSet[r];i==null&&(i=new Set,this.layerMapSet[r]=i),i.add(e),Ye.addItem(e),kt.insert(e)}addCopper(e,r,i,n){let s=nr(),a=Xo.getInstance().add(s,e,r,i,n),l=new Gi(a);return this.addControllerCache(l),l}addPlaneZoneByModel(e){let r=new Gi(e);return this.addControllerCache(r),r}rebuild(e,r,i,n,s){let a=Xo.getInstance().add(e,r,i,n,s),l=new Gi(a);return this.addControllerCache(l),l}startPlane(e){let r=this.layerMapSet[e];r!=null&&r.forEach(i=>{i.visible()})}endPlane(e){let r=this.layerMapSet[e];if(r!=null&&(r.forEach(i=>{i.hidden()}),r.size>0)){let i=ze.getSelects(),n=i.filter(s=>s.layerId!=e);i.length>0&&n.length!=i.length&&ze.select(n)}}endAllPlane(){let e=Object.values(this.layerMapSet),r=new Set;for(let i of e)for(let n of i)n.hidden(),r.add(n.layerId);if(r.size>0){let i=ze.getSelects(),n=i.filter(s=>r.has(s.layerId));i.length>0&&n.length!=i.length&&ze.select(n)}}delete(e){let r=e.globalIndex;if(e instanceof Gi){let i=this.layerMapSet[e.layerId];i&&i.delete(e),Xo.getInstance().delete(e.model,r)}}};var vpe=class{constructor(){this._storage={}}addProfileItem(t,e){this._storage[t]=e}updateProfileItem(t,e){this.hasProfileItem(t)&&(this._storage[t]=e)}hasProfileItem(t){return!!this._storage[t]}fetchProfileItem(t){return this._storage[t]}fetchAllProfileItems(){return Object.values(this._storage)}deleteProfileItem(t){return delete this._storage[t]}};var xpe=class{constructor(){this.isMove=!1;this.suspend=!0;this.modify=new Set;this.task=new Set;this.modifyTears=new Set;this.timeoutId=null;A.subscribe("isMoveSwitch",this.isMoveSwitch.bind(this)),A.subscribe("SetSuspend",this.setSuspend.bind(this)),A.subscribe("cheakTearDrop",this.addModify.bind(this)),A.subscribe("addModifyTeardrop",this.addMaodifyTeardrop.bind(this)),A.subscribe("flushTearDrop",this.flushService.bind(this)),A.subscribe("refreshTearDrop",this.refreshService.bind(this))}isMoveSwitch(t){this.isMove=t}setSuspend(t){this.suspend=t}addMaodifyTeardrop(t){t instanceof lt&&this.modifyTears.add(t)}addModify(t){t instanceof zf&&this.modify.add(t)}flushService(){this.timeoutId!=null&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.timeoutId=setTimeout(()=>{if(this.suspend){let t=this.merge(),e=this.removeTears(t);this.addTears(e),this.task.clear()}else this.addTask();this.modify.clear(),this.modifyTears.clear(),this.timeoutId=null},0)}refreshService(){if(this.timeoutId!=null&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.suspend){let t=this.merge(),e=this.removeTears(t);this.addTears(e),this.task.clear()}else this.addTask();this.modify.clear(),this.modifyTears.clear()}addTask(){this.modify.forEach(t=>{this.task.add(t)})}merge(){let t=new Set,e={};return this.task.size&&this.task.forEach(r=>{let{data:i}=r;e[i.globalIndex]=r}),this.modify.size&&this.modify.forEach(r=>{var h;let{action:i,data:n,item:s}=r,a=s instanceof Ir||s instanceof yi,l=((h=e[n.globalIndex])==null?void 0:h.action)==="add",c=i==="modify";a&&e[n.globalIndex]&&l&&c&&!this.checkTrack(s,n)||(e[n.globalIndex]&&delete e[n.globalIndex],e[n.globalIndex]=r)}),e}removeTears(t){let e=Object.keys(t),r=new Set;for(let i in t){let n=t[i],s=!1;if(n.action=="modify"?n.item.isEmpty?s=!0:n.item instanceof _i?s=this.checkPad(n.item,n.data):n.item instanceof sn?s=this.checkPolygonPad(n.item,n.data):n.item instanceof Ir?s=this.checkTrack(n.item,n.data):n.item instanceof yi?s=this.checkArcTrack(n.item,n.data):n.item instanceof Ue&&(s=this.checkVia(n.item,n.data)):n.action=="delete"?s=!0:n.action=="add"&&this.getAddTears(n)&&r.add(i),s){let a=pt.getTears(i);if(a!=null){let l=new Set,c=!1;a.forEach(h=>{let u=h.getComponent().connects;if(this.keepTear(h,u,e))l.add(h);else{let p=new tT(h,"delete");qe.stack!=null&&qe.stack.length>0&&(qe.stack.addCommand(p),c=!0),u.forEach(m=>{pt.getTears(m).delete(h)}),h.remove(),A.publish("delete",h),this.getAddTears(n)&&r.add(i)}}),c&&A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),a.clear(),l.size==0&&pt.clearIdMapTear(i),xe.addAllSet(a,l)}else this.getAddTears(n)&&r.add(i)}else this.getAddTears(n)&&r.add(i)}return qe.increaseUpload(),r}keepTear(t,e,r){if(this.modifyTears.has(t))return t;if(this.isMove){let i=!0;if(e.forEach(n=>{r.includes(n)||(i=!1)}),i)return t}}addTears(t){t.size&&(console.log("tear ids...",t),A.publish("updateTears",t))}getAddTears(t){if(t.action=="modify"){let{item:e,data:r}=t;if(!e.isEmpty){if(e instanceof _i&&this.checkPad(e,r))return e.globalIndex;if(e instanceof sn&&this.checkPolygonPad(e,r))return e.globalIndex;if(e instanceof Ir&&this.checkTrack(e,r))return e.globalIndex;if(e instanceof yi&&this.checkArcTrack(e,r))return e.globalIndex;if(e instanceof Ue&&this.checkVia(e,r))return e.globalIndex}}else if(t.action=="add"){let{item:e,data:r}=t;if(!e.isEmpty){if(e instanceof _i)return e.globalIndex;if(e instanceof sn)return e.globalIndex;if(e instanceof Ir)return e.globalIndex;if(e instanceof yi)return e.globalIndex;if(e instanceof Ue)return e.globalIndex}}}checkPad(t,e){let{gId:r,layerId:i,type:n,num:s,center:a,topType:l,topWidth:c,topHeight:h,bottomType:u,bottomWidth:d,bottomHeight:p,innerType:m,innerWidth:g,innerHeight:y,rotation:b,locked:P,net:T,expansionType:I,pasteExpansion:C,topSolderExpansion:E,bottomSolderExpansion:O,plated:_,holeLength:x,holeRadius:v,holeShape:D,holeRotation:w,holeOffset:F}=e;return a=new S(a.x,a.y),t.layerId!=i||!t.center.equals(a)||t.topType!=l||t.topWidth!=c||t.topHeight!=h||t.bottomType!=u||t.bottomWidth!=d||t.bottomHeight!=p||t.innerType!=m||t.innerWidth!=g||t.innerHeight!=y||t.rotation!=b||t.net!=T}checkPolygonPad(t,e){let{globalIndex:r,layerId:i,num:n,center:s,rotation:a,shapes:l,net:c,locked:h,expansionType:u,pasteExpansion:d,topSolderExpansion:p,bottomSolderExpansion:m,plated:g,holeLength:y,holeRadius:b,holeShape:P,holeRotation:T,holeOffset:I}=e;return s=new S(s.x,s.y),t.layerId!=i?!0:t.num!=n?!1:!t.center.equals(s)||t.rotation!=a?!0:t.locked!=h?!1:t.net!=c?!0:!(t.expansionType!=u||t.pasteExpansion!=d||t.topSolderExpansion!=p||t.bottomSolderExpansion!=m||t.plated!=g||t.holeLength!=y||t.holeRadius!=b||t.holeShape!=P||t.holeRotation!=T||!t.holeOffset.equals(I))}checkTrack(t,e){let{layerId:r,start:i,end:n,width:s,net:a,center:l,radius:c,startAngle:h,endAngle:u,arcType:d}=e;if(t.layerId!=r)return!0;if(t instanceof yi){let p=new Rc(1e-4),m=new S(l.x,l.y);if(t.arcType!==d||!t.center.equals(m)||!p.eq(t.radius,c)||!p.eq(t.startAngle,h)||!p.eq(t.endAngle,u))return!0}else{let p=new S(i.x,i.y),m=new S(n.x,n.y);if(!t.start.equals(p)||!t.end.equals(m))return!0}return t.width!=s||t.net!=a}checkArcTrack(t,e){let{globalIndex:r,layerId:i,center:n,radius:s,startAngle:a,endAngle:l,sweep:c,width:h,locked:u,net:d}=e;return n=new S(n.x,n.y),t.layerId!=i||!t.center.equals(n)||t.radius!=s||t.startAngle!=a||t.endAngle!=l||t.sweep!=c||t.width!=h||t.net!=d}checkVia(t,e){let{globalIndex:r,type:i,name:n,startLayer:s,endLayer:a,net:l,radius:c,center:h,holeRadius:u,locked:d,expansion:p,topExpansion:m,bottomExpansion:g,isSuture:y}=e,b=new S(h.x,h.y);return t.type!=i||t.name!=n||t.startLayer!=s||t.endLayer!=a||t.net!=l||t.radius!=c||!t.center.equals(b)}};var wOe=class{getAllItems(t,e){let r=new Array,i=!!e;switch(t){case 1:return Ar.iterator((n,s)=>{i?e(n,s):r.push(n)}),r;case 2:return ri.iterator((n,s)=>{n.key!=""&&(i?e(n,s):r.push(n))}),r;case 3:return Ar.iterator((n,s)=>{let a=n.getItems();for(let l of a)l.layerId!=null&&(3==l.layerId||4==l.layerId)&&(i?e(l,s):r.push(l))}),r;case 4:return pr.iterator((n,s)=>{n.getParent()==null&&(i?e(n,s):r.push(n))}),r;case 5:return Qt.iterator((n,s)=>{n.isTestPad&&(i?e(n,s):r.push(n))}),r;case 6:return Qt.iterator((n,s)=>{n.isTestPad||(i?e(n,s):r.push(n))}),r;case 9:return Wr.iterator((n,s)=>{n.isSuture||(i?e(n,s):r.push(n))}),r;case 10:return Wr.iterator((n,s)=>{n.isSuture&&(i?e(n,s):r.push(n))}),r;case 13:return ri.iterator((n,s)=>{n.key==""&&n.getParent()==null&&(i?e(n,s):r.push(n))}),r;case 15:return Bn.iterator((n,s)=>{i?e(n,s):r.push(n)}),r;case 14:return So.iterator((n,s)=>{i?e(n,s):r.push(n)}),r;case 16:{let n=function(s,a){s.getParent()==null&&(i?e(s,a):r.push(s))};return Yo.iterator(n),jo.iterator(n),os.iterator(n),r}case 17:{let n=function(s,a){s.type=="Board Outline"&&s.getParent()==null&&(i?e(s,a):r.push(s))};return Kt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 18:{let n=function(s,a){s.type=="Slot Region"&&s.getParent()==null&&(i?e(s,a):r.push(s))};return Kt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 21:{let n=function(s,a){s.type=="Copper Region"&&s.getParent()==null&&(i?e(s,a):r.push(s))};return Kt.iterator(n),Xt.iterator(n),pt.iterator(n),Ti.iterator((s,a)=>{i?e(s,a):r.push(s)}),r}case 19:{let n=function(s,a){s.type=="Fill Region"&&s.getParent()==null&&(i?e(s,a):r.push(s))};return Kt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 38:return Xt.iterator((n,s)=>{n.type=="Annotation"&&n.getParent()==null&&(i?e(n,s):r.push(n))}),r;case 20:{let n=function(s,a){s.type=="FPC Stiffener"&&s.getParent()==null&&(i?e(s,a):r.push(s))};return Kt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 23:{let n=function(s,a){s.type=="Prohibited Region"&&s.getParent()==null&&(i?e(s,a):r.push(s))};return Kt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 24:{let n=function(s,a){s.type=="Constraint Region"&&s.getParent()==null&&(i?e(s,a):r.push(s))};return Kt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 26:{let n=function(s,a){s.type=="Line"&&s.getParent()==null&&(i?e(s,a):r.push(s))};return Kt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 34:{pt.iterator((s,a)=>{s.type=="TearDrop"&&s.getParent()==null&&(i?e(s,a):r.push(s))});let n=gr.getControl();return n instanceof V2&&n.interrupt(),r}case 11:return Wo.iterator((n,s)=>{n.forEach(a=>{i?e(a,s):r.push(a)})}),r;case 27:{let n=function(s,a){s.type=="3D Shell - Outline"&&(i?e(s,a):r.push(s))};return Kt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 28:{let n=function(s,a){s.type=="3D Shell - Screw Pillar"&&(i?e(s,a):r.push(s))};return Kt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 29:{let n=function(s,a){s.type=="3D Shell - Side Datum Line"&&(i?e(s,a):r.push(s))};return Kt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 31:{let n=function(s,a){s.type=="3D Shell - Side Slot Region"&&(i?e(s,a):r.push(s))};return Kt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 30:{let n=function(s,a){s.type=="3D Shell - Top Slot Region"&&(i?e(s,a):r.push(s))};return Kt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 33:{let n=function(s,a){s.type=="3D Shell - Side Entity"&&(i?e(s,a):r.push(s))};return Kt.iterator(n),Xt.iterator(n),pt.iterator(n),r}case 32:{let n=function(s,a){s.type=="3D Shell - Top/Bottom Entity"&&(i?e(s,a):r.push(s))};return Kt.iterator(n),Xt.iterator(n),pt.iterator(n),r}default:return r}}updateDisplay(t,e){this.getAllItems(t,r=>{if(r!=null&&!r.isEmpty){if(r instanceof Jr)return;e&&!r.isVisible?r.visible():!e&&r.isVisible&&r.hidden()}})}},x5=new wOe;var LOe=class{filter(t,e=!1){let r=Pe.getLayersByOrder(),i=this.getAnnotation(t);for(let a of r){let l=i.get(a);if(l!=null)return l[0]}let n=this.classify4LayerOrder(t,Pe.getActiveLayerID(),e);for(let a of r){let l=n.get(a);if(l!=null)return l[0]}let s=this.getPour(t);for(let a of r){let l=s.get(a);if(l!=null)return l[0]}return t[0]}wireFilter(t,e=!0){let r=Pe.getLayersByOrder(),i=this.getAnnotation(t);for(let l of r){let c=i.get(l);if(c!=null)return c[0]}let n=Pe.getMultLayer();n.visible&&r.unshift(n.layerID);let s=this.classify4LayerOrder(t,Pe.getActiveLayerID(),e);for(let l of r){let c=s.get(l);if(c!=null)return c[0]}let a=this.getPour(t);for(let l of r){let c=a.get(l);if(c!=null)return c[0]}return t[0]}getPour(t){let e=new Map;for(let r of t)if(r instanceof He&&r.type=="Copper Region")this.addMap(e,r.layerId,r);else if(r instanceof mt||r instanceof _t){let i=r.getParent();i!=null&&i instanceof He&&i.type=="Copper Region"&&this.addMap(e,r.layerId,r)}for(let[r,i]of e)this.sort(i);return e}getAnnotation(t){let e=new Map;for(let r of t)if(r instanceof rr&&r.type=="Annotation"){let i=BB(r.getComponent());for(let n of i)this.addMap(e,n,r)}for(let[r,i]of e)this.sort(i);return e}classify4LayerOrder(t,e,r=!1){let i=new Map;for(let n of t)if(n instanceof Ge)this.addMap(i,n.layerId,n);else if(n instanceof Le)this.addMap(i,n.layerId,n);else if(n instanceof Ue)this.addMap(i,Pe.getGrayIndex()==0?12:Pe.getActiveLayerID(),n);else if(n instanceof ua)this.addMap(i,n.layerId,n);else if(n instanceof Dp)this.addMap(i,n.layerId,n);else if(n instanceof lr)this.addMap(i,n.layerId,n);else if(n instanceof He)if(n.type=="Copper Region"){n.layerId==e&&this.addMap(i,n.layerId,n);continue}else if((n.type=="Prohibited Region"||n.type=="Constraint Region")&&n.layerId==12){let s=Pe.getAllCopperLayerIds();for(let a of s)this.addMap(i,a,n)}else this.addMap(i,n.layerId,n);else if(n instanceof Jr)this.addMap(i,n.layerId,n);else if(n instanceof Gi)this.addMap(i,n.layerId,n);else if(n instanceof mt){let s=n.getParent();if(s!=null&&s instanceof He&&s.type=="Copper Region"){n.layerId==e&&this.addMap(i,n.layerId,n);continue}this.addMap(i,n.layerId,n)}else if(n instanceof _t){let s=n.getParent();if(s!=null&&s instanceof He&&s.type=="Copper Region"){n.layerId==e&&this.addMap(i,n.layerId,n);continue}this.addMap(i,n.layerId,n)}else n instanceof mn?this.addMap(i,57,n):n instanceof ke&&this.addMap(i,n.layerId,n);for(let[n,s]of i)this.sort(s,r);return i}addMap(t,e,r){let i=t.get(e);i==null&&(i=[],t.set(e,i)),i.push(r)}sort(t,e=!1){e||Er(t,(r,i)=>{let n=r.buildBBox().area()-i.buildBBox().area();return n==0?r.globalIndex>i.globalIndex?1:-1:n},0,t.length)}},MOe=new LOe;var iU=class{constructor(){this.userConfig={};this.pcbConfigUnSaved=!1;this.footprintConfigUnSaved=!1;this.INDEPENDENT="Independent Object";this.OUTLINE="Outline Object";this._3DSHELL="3D Shell";this._OTHER="Other";this._STATUS="Status";A.subscribe("applyFilter",this.applyFilter.bind(this)),A.subscribe("applyCheck",this.applyCheck.bind(this)),A.subscribe("filterSelectedConfig",this.filterSelectedConfig.bind(this)),A.subscribe("filterConfig",this.onChange.bind(this)),A.subscribe("flushConfig",this.flush.bind(this)),A.subscribe("ResetFilterConfig",this.resetConfig.bind(this)),A.messageBus.rpcService("pcb/getFilterConfig",this.getFilterConfig.bind(this))}applyFilter(t){this.setPick(0,!1);let e=t[0];if(!e||!(e instanceof Array))return;let r={},i={};for(let n=0;n<e.length;n++){let{lists:s}=e[n];for(let a=0;a<s.length;a++){let{key:l,checked:c,visible:h}=s[a],u=this.getElement(l);u&&(c!=null&&this.getPick(u)!==c&&(r[l]=c),h!=null&&this.getVisible(u)!==h&&(i[l]=h))}}for(let n of Object.keys(r||{}))this.setPick(this.getElement(n),r[n]);for(let n of Object.keys(i||{}))if(this.setVisible(this.getElement(n),i[n]),n==="DRCTAGGING"){let s=i[n];A.publish("toggleErrorNodeVisible",{visibleMap:{all:s},globalIndex:"all"},Q())}this.flush()}applyCheck(t){A.publish("clearSelect",""),this.setPick(0,!1);let e=t[0];if(!e||!(e instanceof Array))return;let r={};for(let i=0;i<e.length;i++){let{lists:n}=e[i];for(let s=0;s<n.length;s++){let{key:a,checked:l}=n[s],c=this.getElement(a);c&&this.getPick(c)!==l&&(r[a]=l)}}for(let i of Object.keys(r||{}))this.setPick(this.getElement(i),r[i]);this.flush()}filterSelectedConfig(t){R.getInstance().doctype==3?this.pcbConfigSelected=t.configName:R.getInstance().doctype==4&&(this.footprintConfigSelected=t.configName),this.currentSelected=t}getPick(t){let e=Ri.getInstance().getItem(t);return e!=null?e.pick:!1}setPick(t,e){let r=Ri.getInstance().getItem(t);r!=null&&e!=null&&(r.pick=e,t!=38&&!R.getInstance().isPreview&&R.getInstance().compiler.uploadPrimitive(this.getUploadElement(t),{display:r.visible,pick:r.pick}),t==21&&!R.getInstance().isPreview&&R.getInstance().compiler.uploadPrimitive("COPPERFILLED",{display:r.visible,pick:r.pick}))}getUploadElement(t){switch(t){case 0:return"ALL";case 1:return"COMPONENT";case 2:return"PROPERTY";case 3:return"COMPONENTSILK";case 4:return"TRACK";case 5:return"TESTPOINT";case 20:return"FPC_STIFFENER";case 6:return"PAD";case 7:return"PADSPAIR";case 8:return"NETWORK";case 9:return"VIA";case 10:return"SUTUREHOLE";case 11:return"RATLINE";case 12:return"GROUP";case 13:return"TEXT";case 15:return"IMAGE";case 14:return"PICTURE";case 16:return"DIMENSION";case 17:return"BOARDOUTLINE";case 18:return"SLOTREGION";case 19:return"FILLREGIEN";case 21:return"COPPEROUTLINE";case 22:return"COPPEROUTLINE";case 23:return"PROHIBITEDREGION";case 24:return"CONSTRAINT";case 25:return"PARTITION";case 26:return"LINE";case 27:return"SHELL";case 31:return"SIDESHELLCUT";case 30:return"TOPSHELLCUT";case 33:return"SIDEENTITY";case 32:return"TOPBOTTOMENTITY";case 29:return"CREASE";case 28:return"BOSS";case 34:return"TEARDROP";case 36:return"LOCKED";case 37:return"UNLOCKED";default:return null}}getVisible(t){let e=Ri.getInstance().getItem(t);return e!=null?e.visible:!1}setVisible(t,e){let r=Ri.getInstance().getItem(t);if(r!=null&&e!=null&&r.visible!=e){t==9&&C2.getInstance().setVisible(e);let i="elementFilter-time";if(Cn(i),r.visible=e,t!=38&&!R.getInstance().isPreview&&R.getInstance().compiler.uploadPrimitive(this.getUploadElement(t),{display:r.visible,pick:r.pick}),x5.updateDisplay(r.type,r.visible),r.type==21&&(A.publish("toggleCopper",{all:!0,visible:e,ids:[]}),A.publish("getAllItems","Copper Region"),A.publish("refreshHighLigth",""),R.getInstance().isPreview||R.getInstance().compiler.uploadPrimitive("COPPERFILLED",{display:r.visible,pick:r.pick}),bh.type?A.publish("FlushSketcherAttrView",{type:bh.type}):A.publish("flushSelectingInfo",{triggerFrom:"FILTER_PLANE_UPDATE"})),r.type===1){this.setVisible(3,e),this.setVisible(2,e);let n=Ri.getInstance().getItem(6);x5.updateDisplay(n.type,n.visible)}Xi(i,.05)}}async resetConfig(){var e,r;let t=await this.getUserConfig()||{};R.getInstance().doctype==3?this.applyConfig(Jc.pcbConfig[this.pcbConfigSelected]||((e=t.pcb)==null?void 0:e[this.pcbConfigSelected])):R.getInstance().doctype==4&&this.applyConfig(Jc.footprintConfig[this.footprintConfigSelected]||((r=t.footprint)==null?void 0:r[this.footprintConfigSelected])),this.disableOperation(!0),this.flush()}async onChange(t){var r,i;let e=await this.getUserConfig()||{};R.getInstance().doctype==3?Jc.pcbConfig.hasOwnProperty(t)?(this.applyConfig(Jc.pcbConfig[t]),this.disableOperation(!0),this.pcbConfigSelected=t,this.currentSelected={configType:"systemConfig",configName:t},this.flush()):(r=e==null?void 0:e.pcb)!=null&&r.hasOwnProperty(t)&&(this.disableOperation(!1),this.pcbConfigSelected=t,this.currentSelected={configType:"userConfig",configName:t},this.applyFilter([e.pcb[t]])):R.getInstance().doctype==4&&(Jc.footprintConfig.hasOwnProperty(t)?(this.applyConfig(Jc.footprintConfig[t]),this.disableOperation(!0),this.footprintConfigSelected=t,this.currentSelected={configType:"systemConfig",configName:t},this.flush()):(i=e==null?void 0:e.footprint)!=null&&i.hasOwnProperty(t)&&(this.disableOperation(!1),this.footprintConfigSelected=t,this.currentSelected={configType:"userConfig",configName:t},this.applyFilter([e.footprint[t]])))}setPcbDefault(t,e){this.pcbConfigDefault=t,e&&(e.pcbConfigDefault=this.pcbConfigDefault)}getPcbDefault(){return this.pcbConfigDefault}setFootprintDefault(t,e){this.footprintConfigDefault=t,e&&(e.footprintConfigDefault=this.footprintConfigDefault)}getFootprintDefault(){return this.footprintConfigDefault}getElement(t){switch(t){case"COMPONENT":return 1;case"ATTR":return 2;case"TRACK":return 4;case"FPC_STIFFENER":return 20;case"PAD_TEST":return 5;case"PAD":return 6;case"VIA":return 9;case"SUTUREVIA":return 10;case"TEXT":return 13;case"IMAGE":return 15;case"PICTURE":return 14;case"DIMENSION":return 16;case"SHEETBOARD":return 17;case"SLOT":return 18;case"POUR":return 21;case"REGION":return 19;case"PROHIBIT":return 23;case"CONSTRAINT":return 24;case"LINE":return 26;case"PADSPAIR":return 7;case"NETWORK":return 8;case"TEARDROP":return 34;case"DRCTAGGING":return 35;case"COMBINATION":return 12;case"LOCKED":return 36;case"UNLOCKED":return 37;case"SHELL":return 27;case"BOSS":return 28;case"CREASE":return 29;case"SIDESHELLCUT":return 31;case"TOPSHELLCUT":return 30;case"TOPBOTTOMENTITY":return 32;case"SIDEENTITY":return 33;case"COMPONENTSILK":return 3;default:return null}}disableOperation(t){Jc.operation["Rename Config..."].disabled=t,Jc.operation["Save Config"].disabled=t,Jc.operation["Delete Config"].disabled=t}getCurrentConfig(){return{COMPONENT:this.getPick(1),ATTR:this.getPick(2),TRACK:this.getPick(4),PAD_TEST:this.getPick(5),PAD:this.getPick(6),VIA:this.getPick(9),SUTUREVIA:this.getPick(10),TEXT:this.getPick(13),IMAGE:this.getPick(15),PICTURE:this.getPick(14),DIMENSION:this.getPick(16),SHEETBOARD:this.getPick(17),SLOT:this.getPick(18),POUR:this.getPick(21),REGION:this.getPick(19),FPC_STIFFENER:this.getPick(20),PROHIBIT:this.getPick(23),CONSTRAINT:this.getPick(24),LINE:this.getPick(26),PADSPAIR:this.getPick(7),NETWORK:this.getPick(8),TEARDROP:this.getPick(34),COMBINATION:this.getPick(12),LOCKED:this.getPick(36),UNLOCKED:this.getPick(37),SHELL:this.getPick(27),BOSS:this.getPick(28),CREASE:this.getPick(29),SIDESHELLCUT:this.getPick(31),TOPSHELLCUT:this.getPick(30),TOPBOTTOMENTITY:this.getPick(32),SIDEENTITY:this.getPick(33)}}async isUnSaved(){var e,r;let t=await this.getUserConfig()||{};if(R.getInstance().doctype==3){if(Jc.pcbConfig.hasOwnProperty(this.pcbConfigSelected))return!this.isEqual(Jc.pcbConfig[this.pcbConfigSelected]);if((e=t==null?void 0:t.pcb)!=null&&e.hasOwnProperty(this.pcbConfigSelected))return!this.isEqual(t.pcb[this.pcbConfigSelected])}else if(R.getInstance().doctype==4){if(Jc.footprintConfig.hasOwnProperty(this.footprintConfigSelected))return!this.isEqual(Jc.footprintConfig[this.footprintConfigSelected]);if((r=t==null?void 0:t.footprint)!=null&&r.hasOwnProperty(this.footprintConfigSelected))return!this.isEqual(t.footprint[this.footprintConfigSelected])}}isEqual(t){for(let[e,r]of Object.entries(t||{}))if(this.getPick(this.getElement(e))!==r)return!1;return!0}applyConfig(t){this.setPick(0,!1);for(let[e,r]of Object.entries(t||{}))this.setPick(this.getElement(e),r)}async getUserConfig(){return this.userConfig=(await A.windowBridge.rpcCall("UserPreferencesGetCacheObj","filterConfig",Q())).message,this.userConfig}async getNewUserConfig(){let t=await this.getUserConfig(),e={};R.getInstance().doctype===3?e=t==null?void 0:t.pcb:R.getInstance().doctype===4&&(e=t==null?void 0:t.footprint);for(let r of Object.keys(e||{}))Array.isArray(e[r])||(e[r]=this.oldConfig2NewConfig(e[r]));return e}setUserConfig(t){A.windowBridge.publish("savePreference",["filterConfig",t],Q())}refreshHidden(){let t="refreshHidden-time";Cn(t);let e=Ri.getInstance().getAllItem();for(let r of e)x5.updateDisplay(r.type,r.visible);Xi(t,.01)}filterAll(t,e,r={}){if(t instanceof mt||t instanceof _t){let i=t.getParent();if(i!=null&&i instanceof lt){let n=i.getParent();n!=null&&n instanceof ke?e.add(n):e.add(t)}}else if(t instanceof lr){let i=t.getParent();(t.showKey||t.showValue||i==null&&(t.showKey||t.showValue)||t.key!=""&&(t.showKey||t.showValue))&&e.add(t)}else if(t instanceof Le||t instanceof Ue)e.add(t);else{let i=t.getParent();i!=null&&i instanceof ke?e.add(i):e.add(t)}}filterAll1(t,e,r){if(t instanceof mt||t instanceof _t){let i=t.getParent();if(i!=null&&i instanceof lt){let n=i.getParent();n!=null&&n instanceof ke?e.add(n):e.add(t)}}else t instanceof lr?(t.getParent()==null&&(t.showKey||t.showValue)||t.key!=""&&(t.showKey||t.showValue))&&e.add(t):e.add(t)}isComponentCanSelectElement(t){return t instanceof Le||t instanceof Ue?!0:t instanceof lr&&t.key!=""}filterElement(t,e={}){let r=R.getInstance().envFlag=="silk-preview",{boxChoose:i=!1}=e,n=new Set;if(Pe.getGrayIndex()){let a=Pe.getActiveLayerID();t=Array.from(t).filter(l=>{let c=l.layerId;return l instanceof Ue?l.isContains(a):[12,47,11,57].includes(c)?!0:l instanceof rr&&l.type=="Annotation"?l.inActiveLayer(a):!c||a==c})}let s=new Set;return t.forEach(a=>{var l,c,h;if(!this.isComponentCanSelectElement(a)&&a.getParent()!=null&&a.getParent()instanceof ke&&(a=a.getParent()),this.getPick(0))this.filterAll(a,n,e);else{if(a instanceof Le){let d=a.getParent();if(d&&d.locked&&!this.getPick(36))return}if(a instanceof Jr){let d=a.getParent();if(d&&d.locked&&!this.getPick(36))return}if(a instanceof Ls&&a.locked&&!this.getPick(36))return;if(a instanceof Ls&&!a.locked&&!this.getPick(37))return;if(a instanceof Ls&&!this.checkLayer(a.layerId))return;let u=this.getElement4Item(a);u!=null&&this.getPick(u)&&this.getVisible(u)&&(u==2?a instanceof lr&&(a.showKey||a.showValue)&&n.add(a):r?(a.globalIndex==((l=Yr.QRCode)==null?void 0:l.globalIndex)||a.globalIndex==((c=Yr.plainCode)==null?void 0:c.globalIndex)||a.globalIndex==((h=Bp.getInstance().image)==null?void 0:h.globalIndex)||a instanceof He&&a.type=="FPC Stiffener")&&n.add(a):n.add(a)),a instanceof Gi&&n.add(a),this.getPick(7)&&(a instanceof Ge||a instanceof Le||a instanceof Ue)&&(i?this.getPadpair(a,n):n.add(a)),this.getPick(8)&&Ao(a)!=null&&!(a instanceof He&&a.type=="Copper Region")&&!(a instanceof Jr||a instanceof Gi)&&(i?a instanceof mn?a.isVisible&&this.getNet(a,n,s):this.getNet(a,n,s):n.add(a)),a instanceof mn&&n.add(a),this.getPick(12)&&this.getCombination(a,n)}}),n=this.filterOutOfCanEditArea(n),n=this.filterViaFenceCanSelect(n),i?this.filterParent(this.filter(n)):this.filter(n)}filterViaFenceCanSelect(t){if(!this.dialog)return t;let e=new Set;for(let r of t){let i=this.dialog.tool.validItem(r);i&&e.add(i)}return e}measureFilterElement(t){let e=new Set;return Pe.getGrayIndex()&&(t=Array.from(t).filter(r=>{let i=r.layerId,n=Pe.getActiveLayerID();if(r instanceof _i&&i===12)return!0;if(r instanceof Ue){if(r.isContains(n))return!0;i=12}return!i||n==i})),t.forEach(r=>{let i=this.getElement4Item(r);if(r instanceof Jr&&this.getVisible(i)){let n=r.getParent(),s=this.getElement4Item(n);if(n instanceof He&&n.type==="Copper Region"&&this.getPick(s)){e.add(r);return}}i==21||i==16||r instanceof mn||this.getPick(i)&&(i!=null&&this.getVisible(i)&&e.add(r),r instanceof Gi&&e.add(r),this.getPick(7)&&(r instanceof Ge||r instanceof Le||r instanceof Ue)&&e.add(r))}),this.filter(e)}setVisibleByItem(t,e){let r=this.getElement4Item(t);this.setVisible(r,e)}getElement4Item(t){if(t instanceof Ge)return 4;if(t instanceof Le)return t.isTestPad?5:6;if(t instanceof Ue)return t.isSuture?10:9;if(t instanceof lr)return t.key==""?13:2;if(t instanceof Mn)return 15;if(t instanceof Ps)return 14;if(t instanceof He||t instanceof _t||t instanceof mt){let e;if(t instanceof He)e=t.type;else{let r=t.getParent();if(r!=null&&r instanceof He){let i=r.getParent();if(i!=null&&i instanceof ke)return null;e=r.type}else return null}switch(e){case"Board Outline":return 17;case"Slot Region":return 18;case"Fill Region":return 19;case"TearDrop":return 34;case"FPC Stiffener":return 20;case"Copper Region":return 21;case"Prohibited Region":return 23;case"Constraint Region":return 24;case"Line":return 26;case"3D Shell - Outline":return 27;case"3D Shell - Screw Pillar":return 28;case"3D Shell - Side Datum Line":return 29;case"3D Shell - Side Slot Region":return 31;case"3D Shell - Top Slot Region":return 30;case"3D Shell - Side Entity":return 33;case"3D Shell - Top/Bottom Entity":return 32;case"Annotation":return 38}}else return t instanceof ua?16:t instanceof ke?1:t instanceof Jr?21:null}getPadpair(t,e){new hD(t).result.forEach(i=>{e.add(i)})}getNet(t,e,r){let i=Ao(t);if(r.has(i))return;let n=Ye.getSameNetItemsWithoutPourAndPlaneZoneByItem(t);n.length>0&&r.add(i),n.forEach(s=>{var a;(s instanceof Ue||s.layerId==12&&s.type!="Slot Region"||(a=Pe.getLayer(s.layerId))!=null&&a.isSignalLayer())&&e.add(s)})}getCombination(t,e){if(t instanceof mt||t instanceof Le){let i=t.getParent();i!=null&&(t=i)}let r=t.getGroupID();r!=null&&Ht.getItem(r).getItems().forEach(n=>{Mt.checkIsCanEditByItem(n)&&e.add(n)})}pointFilter(t,e,r,i,n){let s=this.filterElement(r,{boxChoose:!1}),a=new Array;if(we.smartMode&&_s.clearHighlightSpot(),this.getPick(0)||this.getPick(1)&&this.getPick(6)?s.forEach(l=>{if(!(l instanceof Ls&&l.locked&&!this.getPick(36))&&!(l instanceof Ls&&!l.locked&&!this.getPick(37)))if(l instanceof Le){if(we.smartMode&&l.smartPad&&l.smartPad.isSelect(t,e))if(n)l.smartPad.highlightSpot(t,e);else{l.smartPad.selectOnePoint(t,e),a.length=0,s.clear();return}if(l.isSelect(t,e)){let c=l.getParent();c!=null?(a.push(l),s.delete(c)):a.push(l)}}else if(l instanceof ke&&l.isSelect(t,e)){let c=l.getPads(),h=!1;c.forEach(u=>{u.isSelect(t,e)&&(h=!0)}),i!=null&&i?a.push(l):h||a.push(l)}else a.push(l)}):s.forEach(l=>{a.push(l)}),this.getPick(7)||this.getPick(8)||this.getPick(12)){let l=this.filterActiveLayer(a);if(l!=null){let c=new Set;return this.getPick(8)&&!(l instanceof mn)&&this.isHasNetAttributes(l)&&this.getNet(l,c,new Set),c.size<=0&&this.getPick(7)&&this.getPadpair(l,c),c.size<=0&&this.getPick(12)&&this.getCombination(l,c),c.size>0?Array.from(c):[l]}else return[]}else if(this.getPick(21)){if(i!=null&&i)return a;if(a.length>0){let l=this.filterActiveLayer(a);return l==null?[]:[l]}else return[]}else{if(i!=null&&i)return a;if(a.length>0){Er(a,(c,h)=>c.buildBBox().area()-h.buildBBox().area(),0,a.length);let l=this.filterActiveLayer(a);return l==null?[]:[l]}else return[]}}isHasNetAttributes(t){if(Ao(t)==null)return!1;if(t instanceof Ue)return!0;let r=t.layerId,i=Pe.getLayer(r);return ar(r)||(i==null?void 0:i.isSignalLayer())}measureFilter(t,e,r){let i=this.measureFilterElement(r),n=new Array;if(this.getPick(1)&&this.getPick(6)?i.forEach(s=>{if(s instanceof Le){if(s.isSelect(t,e)){let a=s.getParent();a!=null?(n.push(s),i.delete(a)):n.push(s)}}else if(s instanceof ke&&s.isSelect(t,e)){let a=s.getPads(),l=!1;a.forEach(c=>{c.isSelect(t,e)&&(l=!0)}),n.push(s)}else n.push(s)}):i.forEach(s=>{n.push(s)}),this.getPick(7)){let s=this.filterActiveLayer(n);if(s!=null){let a=new Set;return a.size<=0&&this.getPick(7)&&this.getPadpair(s,a),a.size>0?Array.from(a):[s]}else return[]}else if(this.getPick(21))if(n.length>0){let s=this.filterActiveLayer(n);return s==null?[]:[s]}else return[];else if(n.length>0){Er(n,(a,l)=>a.buildBBox().area()-l.buildBBox().area(),0,n.length);let s=this.filterActiveLayer(n);return s==null?[]:[s]}else return[]}filterCombination(t){let e=this.filterActiveLayer(t);if(e!=null){let r=new Set;return r.size<=0&&this.getCombination(e,r),r.size>0?Array.from(r):[]}else return[]}selectNetFilter(t,e,r){let i=new Set;r.forEach(a=>{this.filterAll(a,i,{boxChoose:!1})}),i=this.filter(i);let n=new Array;i.forEach(a=>{if(a instanceof Le&&a.isSelect(t,e)){let l=a.getParent();l!=null?(n.push(a),i.delete(l)):n.push(a)}else if(a instanceof ke&&a.isSelect(t,e)){let l=a.getPads(),c=!1;l.forEach(h=>{h.isSelect(t,e)&&(c=!0)}),c||n.push(a)}else n.push(a)});let s=this.filterNetItems(n);return s==null?[]:s}filterNetItems1(t){let e=new Array;for(let r of t)if(!(r instanceof Tp))if(r instanceof Ue)e.push(r);else if(r instanceof Le||r instanceof Ge)e.push(r);else if(r instanceof He)switch(r.type){case"Copper Region":case"Fill Region":case"Line":e.push(r)}else r instanceof Gi&&e.push(r);return e}filterNetItems(t){let e=new Array;for(let r of t)r instanceof Tp||(r instanceof Ue||r instanceof Le||r instanceof Ge||r.layerId!=null&&Pe.getLayer(r.layerId).isCopperLayer())&&e.push(r);return e}selectItemFilter(t,e,r){let i=new Set;for(let a of r)this.filterAll1(a,i,!1);let n=this.filter(i),s=new Set;for(let a of n)if(a instanceof Le&&a.isSelect(t,e)){let l=a.getParent();l!=null?(s.add(a),n.delete(l)):s.add(a)}else if(a instanceof ke&&a.isSelect(t,e)){let l=!1,c=a.getPads();for(let h of c)if(h.isSelect(t,e)){l=!0;break}l||s.add(a)}else s.add(a);return s}filterActiveLayer(t,e){return MOe.filter(Array.from(t),e)}filterTrack(t,e=le.pcbConfig.realTimeTrackSelectStats){switch(e){case"single":return[t];case"whole":{let r=new Set;return new uf(t,!1).all.forEach(n=>{Mt.checkIsCanEditByItem(n)&&r.add(n)}),Array.from(r)}}}isCanWireItem(t){if(t instanceof Ge)return!0;if(t instanceof Le)return!0;if(t instanceof Ue)return!0;if(t instanceof He||t instanceof _t||t instanceof mt){let e;if(t instanceof He)e=t.type;else{let r=t.getParent();if(r!=null&&r instanceof He){let i=r.getParent();if(i!=null&&i instanceof ke)return!1;e=r.type}else return!1}switch(e){case"Fill Region":case"TearDrop":case"Line":return ns(Pe.getLayer(t.layerId).type);default:return!1}}else return t instanceof Jr?!0:t instanceof mn}filterWireElement(t,e){let r=new Set;t.forEach(s=>{let a=this.getElement4Item(s);this.isCanWireItem(s)&&(a==null||a!=null&&this.getVisible(a))&&r.add(s)});let i=Array.from(r);if(i=Array.from(this.filter(i,!0)),i.every(s=>s instanceof mn)||(i=i.filter(s=>!(s instanceof mn))),e)return Array.from(this.filterParent(new Set(i)));{let s=Array.from(this.filter(i,!0));return Er(s,(a,l)=>{let c=a.buildBBox().area(),h=l.buildBBox().area(),u=a instanceof Le||a instanceof Ue,d=l instanceof Le||l instanceof Ue;if(u&&!d)return-1;if(!u&&d)return 1;if(c===h){let p=a instanceof lt,m=l instanceof lt;return p&&!m?-1:!p&&m?1:0}return c-h},0,s.length),MOe.wireFilter(Array.from(s))}}filterOutOfCanEditArea(t){let e=new Set;return t.forEach(r=>{Mt.checkIsCanEditByItem(r)&&e.add(r)}),e}filter(t,e=!1){let r=new Set;return t.forEach(i=>{if(i.isVisible)if(i instanceof rr&&i.type=="Annotation")BB(i.getComponent()).find(a=>this.checkLayer(a))!=null&&r.add(i);else if(i instanceof Le||i instanceof Ge||i instanceof lr||i instanceof mt||i instanceof _t||i instanceof He||i instanceof Mn||i instanceof Ps||i instanceof ua||i instanceof ke||i instanceof Jr||i instanceof Gi)this.checkLayer(i.layerId,e)&&r.add(i);else if(i instanceof Ue)this.checkLayer(12,e)&&r.add(i);else if(i instanceof mn){let n=Pe.ratlineLayer;n.visible&&(e||!e&&!n.locked)&&r.add(i)}else r.add(i)}),r}checkPadByLayerVisible(t,e,r){if(t.model.modelType=="Pad"&&t.layerId==12){let i=t.model;if(t.smartPad!=null&&t.smartPad.isSelect(e,r)||Pe.getLayer(1).visible&&i.top.inShape(e,r,i.center,i.rotation)||Pe.getLayer(2).visible&&i.bottom.inShape(e,r,i.center,i.rotation))return!0;if(Pe.configInnerLayers.size>0){for(let n of Pe.configInnerLayers)if(Pe.getLayer(n).visible&&!i.isUnuseLayer(n)&&i.inner.inShape(e,r,i.center,i.rotation))return!0}return i.hole.inShape(e,r,i.center,i.rotation)}return!0}filterParent(t){let e=new Set;return t.forEach(r=>{let i=r.getParent();t.has(i)||e.add(r)}),e}filterParent2(t){let e=new Set;return t.forEach(r=>{let i=r.getParent();r instanceof lr&&i instanceof ke&&t.has(i)&&(r.showKey||r.showValue)?e.add(r):t.has(i)||e.add(r)}),e}handleNonPlatePadConnectNode(t,e){let r=[],i=Array.from(t);for(let n=0;n<i.length;n++){let s=i[n];s instanceof Le&&s.layerId==12&&!s.plated&&s.searchNode().forEach(a=>{!(a instanceof Ue)&&a.layerId!==e&&a.layerId!==12&&e!==12&&r.push(a.globalIndex)})}return t=i.filter(n=>!r.includes(n.globalIndex)),t}checkLayer(t,e=!1){let r=Pe.getLayer(t);return!!(r!=null&&r.visible&&(e||!e&&!(r!=null&&r.locked)))}setElement(t,e,r,i=""){A.publish("clearSelect",""),e!==void 0&&this.setPick(0,!1),t==0?this.setAll(e,r,i):(this.setPick(t,e),this.setVisible(t,r)),this.flush()}async flush(){let t=this.getElementFilters(),e=await this.getConfig();A.publish("updateFrame",""),A.publish("renderElementPanel",{data:t,config:e},Q())}setAll(t,e,r=""){r==this.INDEPENDENT?(this.setIndepentCheck(t),this.setIndepentVisible(e)):r==this.OUTLINE?(this.setOutlineCheck(t),this.setOutlineVisible(e)):r==this._3DSHELL?(this.set3DShellCheck(t),this.set3DShellVisible(e)):r===this._OTHER?this.setVisible(34,e):r===this._STATUS||(this.setAllCheck(t),this.setAllVisible(e))}set3DShellCheck(t){t!==void 0&&(this.setPick(27,t),this.setPick(31,t),this.setPick(30,t),this.setPick(33,t),this.setPick(32,t),this.setPick(28,t),this.setPick(29,t))}set3DShellVisible(t){t!==void 0&&(this.setVisible(27,t),this.setVisible(31,t),this.setVisible(30,t),this.setVisible(33,t),this.setVisible(32,t),this.setVisible(28,t),this.setVisible(29,t))}setOutlineCheck(t){t!==void 0&&(this.setPick(17,t),this.setPick(18,t),this.setPick(19,t),this.setPick(21,t),this.setPick(23,t),this.setPick(26,t),this.setPick(24,t))}setOutlineVisible(t){t!==void 0&&(this.setVisible(17,t),this.setVisible(18,t),this.setVisible(19,t),this.setVisible(21,t),this.setVisible(23,t),this.setVisible(26,t),this.setVisible(24,t))}setIndepentCheck(t){t!==void 0&&(this.setPick(1,t),this.setPick(2,t),this.setPick(3,t),this.setPick(4,t),this.setPick(5,t),this.setPick(20,t),this.setPick(6,t),this.setPick(9,t),this.setPick(10,t),this.setPick(13,t),this.setPick(15,t),this.setPick(14,t),this.setPick(16,t))}setIndepentVisible(t){t!==void 0&&(this.setVisible(1,t),this.setVisible(2,t),this.setVisible(3,t),this.setVisible(4,t),this.setVisible(5,t),this.setVisible(20,t),this.setVisible(6,t),this.setVisible(9,t),this.setVisible(10,t),this.setVisible(13,t),this.setVisible(15,t),this.setVisible(14,t),this.setVisible(16,t))}setStatusCheck(t){t!==void 0&&(this.setPick(36,t),this.setPick(37,t))}setStatusVisible(t){t!==void 0&&(this.setVisible(36,t),this.setVisible(37,t))}setAllCheck(t){t!==void 0&&(this.setIndepentCheck(t),this.setOutlineCheck(t),this.set3DShellCheck(t),this.setOtherChecked(t))}setOtherChecked(t){this.setPick(7,t),this.setPick(8,t),this.setPick(12,t),this.setPick(34,t)}setOtherVisible(t){this.setVisible(7,t),this.setVisible(8,t),this.setVisible(12,t),this.setVisible(34,t)}setAllVisible(t){t!==void 0&&(this.setIndepentVisible(t),this.setOutlineVisible(t),this.set3DShellVisible(t),this.setOtherVisible(t))}routineItemCheck(t){return!(t==7||t==8||t==21||t==12||t==34)}getFilterAttribute(t,e,r,i,n=!0,s=!0){let a={title:t,value:e,key:Ll[e],isForAllWithCheck:r,isForAllWithVisible:i};return n&&(a.checked=this.getPick(e)),s&&(a.visible=this.getVisible(e)),a}getSystemFilterAttribute(t,e,r,i,n,s=!0,a=!0){let l={title:e,value:r,key:Ll[r],isForAllWithCheck:i,isForAllWithVisible:n};return s&&(l.checked=!!t[Ll[r]]),a&&(l.visible=!0),l}oldConfig2NewConfig(t){return[{title:this.INDEPENDENT,lists:[{title:"All",value:this.INDEPENDENT},this.getSystemFilterAttribute(t,"Component",1,!0,!0),this.getSystemFilterAttribute(t,"Component Property",2,!0,!0),this.getSystemFilterAttribute(t,"Component Silkscreen",3,!1,!0,!1),this.getSystemFilterAttribute(t,"Track",4,!0,!0),this.getSystemFilterAttribute(t,"Test Point",5,!0,!0),this.getSystemFilterAttribute(t,"Pad",6,!0,!0),this.getSystemFilterAttribute(t,"Via",9,!0,!0),this.getSystemFilterAttribute(t,"Suture Hole",10,!0,!0),this.getSystemFilterAttribute(t,"Text",13,!0,!0),this.getSystemFilterAttribute(t,"Colorful Image",14,!0,!0),this.getSystemFilterAttribute(t,"Image",15,!0,!0),this.getSystemFilterAttribute(t,"FPC Stiffener",20,!0,!0),this.getSystemFilterAttribute(t,"Dimension",16,!0,!0)]},{title:this.OUTLINE,lists:[{title:"All",value:this.OUTLINE},this.getSystemFilterAttribute(t,"Board Outline",17,!0,!0),this.getSystemFilterAttribute(t,"Slot Region",18,!0,!0),this.getSystemFilterAttribute(t,"Copper Region",21,!0,!0),this.getSystemFilterAttribute(t,"Fill Region",19,!0,!0),this.getSystemFilterAttribute(t,"Prohibited Region",23,!0,!0),this.getSystemFilterAttribute(t,"Line",26,!0,!0),this.getSystemFilterAttribute(t,"Constraint Region",24,!0,!0)]},{title:this._3DSHELL,lists:[{title:"All",value:this._3DSHELL},this.getSystemFilterAttribute(t,"3DShell.outline",27,!0,!0),this.getSystemFilterAttribute(t,"3DShell.screwPillar",28,!0,!0),this.getSystemFilterAttribute(t,"3DShell.sideDatumLine",29,!0,!0),this.getSystemFilterAttribute(t,"3DShell.sideSlotRegion",31,!0,!0),this.getSystemFilterAttribute(t,"3DShell.topBottomSlotRegion",30,!0,!0),this.getSystemFilterAttribute(t,"Side Entity",33,!0,!0),this.getSystemFilterAttribute(t,"Top/Bottom Entity",32,!0,!0)]},{title:"Other",lists:[this.getSystemFilterAttribute(t,"Pad Pair",7,!0,!1,!0,!1),this.getSystemFilterAttribute(t,"Net",8,!0,!1,!0,!1),this.getSystemFilterAttribute(t,"TearDrop",34,!0,!0),this.getSystemFilterAttribute(t,"DRC Marking",35,!0,!0),this.getSystemFilterAttribute(t,"Group",12,!0,!1,!0,!1)]},{title:"Status",lists:[this.getSystemFilterAttribute(t,"Locked",36,!0,!0,!0,!1),this.getSystemFilterAttribute(t,"UnLocked",37,!0,!0,!0,!1)]}]}getElementFilters(){return R.getInstance().doctype==3?{indepent:{title:this.INDEPENDENT,lists:[{title:"All",value:this.INDEPENDENT},this.getFilterAttribute("Component",1,!0,!0),this.getFilterAttribute("Component Property",2,!0,!0),this.getFilterAttribute("Component Silkscreen",3,!1,!0,!1),this.getFilterAttribute("Track",4,!0,!0),this.getFilterAttribute("Test Point",5,!0,!0),this.getFilterAttribute("Pad",6,!0,!0),this.getFilterAttribute("Via",9,!0,!0),this.getFilterAttribute("Suture Hole",10,!0,!0),this.getFilterAttribute("Text",13,!0,!0),this.getFilterAttribute("Colorful Image",14,!0,!0),this.getFilterAttribute("Image",15,!0,!0),this.getFilterAttribute("FPC Stiffener",20,!0,!0),this.getFilterAttribute("Dimension",16,!0,!0)]},f2dline:{title:this.OUTLINE,lists:[{title:"All",value:this.OUTLINE},this.getFilterAttribute("Board Outline",17,!0,!0),this.getFilterAttribute("Slot Region",18,!0,!0),this.getFilterAttribute("Copper Region",21,!0,!0),this.getFilterAttribute("Fill Region",19,!0,!0),this.getFilterAttribute("Prohibited Region",23,!0,!0),this.getFilterAttribute("Line",26,!0,!0),this.getFilterAttribute("Constraint Region",24,!0,!0)]},other:{title:"Other",lists:[this.getFilterAttribute("Pad Pair",7,!0,!1,!0,!1),this.getFilterAttribute("Net",8,!0,!1,!0,!1),this.getFilterAttribute("TearDrop",34,!0,!0),this.getFilterAttribute("DRC Marking",35,!0,!0),this.getFilterAttribute("Group",12,!0,!1,!0,!1)]},status:{title:"Status",lists:[this.getFilterAttribute("Locked",36,!0,!0,!0,!1),this.getFilterAttribute("UnLocked",37,!0,!0,!0,!1)]},d3shell:{title:this._3DSHELL,lists:[{title:"All",value:this._3DSHELL},this.getFilterAttribute("3DShell.outline",27,!0,!0),this.getFilterAttribute("3DShell.screwPillar",28,!0,!0),this.getFilterAttribute("3DShell.sideDatumLine",29,!0,!0),this.getFilterAttribute("3DShell.sideSlotRegion",31,!0,!0),this.getFilterAttribute("3DShell.topBottomSlotRegion",30,!0,!0),this.getFilterAttribute("Side Entity",33,!0,!0),this.getFilterAttribute("Top/Bottom Entity",32,!0,!0)]}}:R.getInstance().doctype==4?{indepent:{title:this.INDEPENDENT,lists:[{title:"All",value:this.INDEPENDENT},this.getFilterAttribute("Pad",6,!0,!0),this.getFilterAttribute("Via",9,!0,!0),this.getFilterAttribute("Text",13,!0,!0),this.getFilterAttribute("Component Property",2,!0,!0),this.getFilterAttribute("Image",15,!0,!0),this.getFilterAttribute("Dimension",16,!0,!0)]},f2dline:{title:this.OUTLINE,lists:[{title:"All",value:this.INDEPENDENT},this.getFilterAttribute("Slot Region",18,!0,!0),this.getFilterAttribute("Fill Region",19,!0,!0),this.getFilterAttribute("Prohibited Region",23,!0,!0),this.getFilterAttribute("Line",26,!0,!0)]}}:{}}getSystemElementFilters(){if(R.getInstance().doctype==3){let t={};for(let e of Object.keys(Jc.pcbConfig||{})){let r=Jc.pcbConfig[e];t[e]=[{title:this.INDEPENDENT,lists:[{title:"All",value:this.INDEPENDENT},this.getSystemFilterAttribute(r,"Component",1,!0,!0),this.getSystemFilterAttribute(r,"Component Property",2,!0,!0),this.getSystemFilterAttribute(r,"Component Silkscreen",3,!1,!0,!1),this.getSystemFilterAttribute(r,"Track",4,!0,!0),this.getSystemFilterAttribute(r,"Test Point",5,!0,!0),this.getSystemFilterAttribute(r,"Pad",6,!0,!0),this.getSystemFilterAttribute(r,"Via",9,!0,!0),this.getSystemFilterAttribute(r,"Suture Hole",10,!0,!0),this.getSystemFilterAttribute(r,"Text",13,!0,!0),this.getSystemFilterAttribute(r,"Colorful Image",14,!0,!0),this.getSystemFilterAttribute(r,"Image",15,!0,!0),this.getSystemFilterAttribute(r,"FPC Stiffener",20,!0,!0),this.getSystemFilterAttribute(r,"Dimension",16,!0,!0)]},{title:this.OUTLINE,lists:[{title:"All",value:this.OUTLINE},this.getSystemFilterAttribute(r,"Board Outline",17,!0,!0),this.getSystemFilterAttribute(r,"Slot Region",18,!0,!0),this.getSystemFilterAttribute(r,"Copper Region",21,!0,!0),this.getSystemFilterAttribute(r,"Fill Region",19,!0,!0),this.getSystemFilterAttribute(r,"Prohibited Region",23,!0,!0),this.getSystemFilterAttribute(r,"Line",26,!0,!0),this.getSystemFilterAttribute(r,"Constraint Region",24,!0,!0)]},{title:this._3DSHELL,lists:[{title:"All",value:this._3DSHELL},this.getSystemFilterAttribute(r,"3DShell.outline",27,!0,!0),this.getSystemFilterAttribute(r,"3DShell.screwPillar",28,!0,!0),this.getSystemFilterAttribute(r,"3DShell.sideDatumLine",29,!0,!0),this.getSystemFilterAttribute(r,"3DShell.sideSlotRegion",31,!0,!0),this.getSystemFilterAttribute(r,"3DShell.topBottomSlotRegion",30,!0,!0),this.getSystemFilterAttribute(r,"Side Entity",33,!0,!0),this.getSystemFilterAttribute(r,"Top/Bottom Entity",32,!0,!0)]},{title:"Other",lists:[this.getSystemFilterAttribute(r,"Pad Pair",7,!0,!1,!0,!1),this.getSystemFilterAttribute(r,"Net",8,!0,!1,!0,!1),this.getSystemFilterAttribute(r,"TearDrop",34,!0,!0),this.getSystemFilterAttribute(r,"DRC Marking",35,!0,!0),this.getSystemFilterAttribute(r,"Group",12,!0,!1,!0,!1)]},{title:"Status",lists:[this.getSystemFilterAttribute(r,"Locked",36,!0,!0,!0,!1),this.getSystemFilterAttribute(r,"UnLocked",37,!0,!0,!0,!1)]}]}return t}else if(R.getInstance().doctype==4){let t={};for(let e of Object.keys(Jc.footprintConfig||{})){let r=Jc.footprintConfig[e];t[e]=[{title:this.INDEPENDENT,lists:[{title:"All",value:this.INDEPENDENT},this.getSystemFilterAttribute(r,"Pad",6,!0,!0),this.getSystemFilterAttribute(r,"Via",9,!0,!0),this.getSystemFilterAttribute(r,"Text",13,!0,!0),this.getSystemFilterAttribute(r,"Component Property",2,!0,!0),this.getSystemFilterAttribute(r,"Image",15,!0,!0),this.getSystemFilterAttribute(r,"Dimension",16,!0,!0)]},{title:this.OUTLINE,lists:[{title:"All",value:this.INDEPENDENT},this.getSystemFilterAttribute(r,"Slot Region",18,!0,!0),this.getSystemFilterAttribute(r,"Fill Region",19,!0,!0),this.getSystemFilterAttribute(r,"Prohibited Region",23,!0,!0),this.getSystemFilterAttribute(r,"Line",26,!0,!0)]}]}return t}else return{}}updateConfigForSilkPreview(){if(R.getInstance().envFlag=="silk-preview"){let t=this.queryConfig(),e=Jc.silkViewerPcbConfig[t];this.applyConfig(e)}}queryConfig(){let t=["FPCViewer"].includes(_5.getInstance().getOrigin()),e=TT.getInstance().isQr();return t?(R.getInstance().openRuler=!0,It.getInstance().visible=Ug.SHOW,"Only FPC STIFFENER"):e?"Only Image And Text":"Only Image"}async updateGetConfig(t=!1){var i,n;let e=await this.getUserConfig()||{},r=this.getSystemElementFilters();if(R.getInstance().doctype==3){if(!this.pcbConfigDefault){let s=e.pcbConfigDefault;s&&s.configName!=null&&(s=s.configName),this.pcbConfigSelected=this.pcbConfigDefault=s||"Common";let a=r[this.pcbConfigSelected];a||(a=(i=e.pcb)==null?void 0:i[this.pcbConfigSelected]),a?t&&this.applyFilter([a]):this.pcbConfigSelected=this.pcbConfigDefault="Common"}return{userConfig:await this.getNewUserConfig(),systemConfig:r,doctype:3,operation:this.getFilterOperateConfig(),selected:this.pcbConfigSelected,unSaved:await this.isUnSaved(),defaultValue:this.pcbConfigDefault}}else if(R.getInstance().doctype==4){if(!this.footprintConfigDefault){let s=e.footprintConfigDefault;s&&s.configName!=null&&(s=s.configName),this.footprintConfigSelected=this.footprintConfigDefault=s||"Common";let a=r[this.footprintConfigSelected];a||(a=(n=e.footprint)==null?void 0:n[this.footprintConfigSelected]),a?t&&this.applyFilter([a]):this.footprintConfigSelected=this.footprintConfigDefault="Common"}return{userConfig:await this.getNewUserConfig(),systemConfig:r,doctype:4,operation:this.getFilterOperateConfig(),selected:this.footprintConfigSelected,unSaved:await this.isUnSaved(),defaultValue:this.footprintConfigDefault}}else return{}}getFilterOperateConfig(){let t;return R.getInstance().doctype==3?t=Jc.pcbConfig[this.pcbConfigSelected]:R.getInstance().doctype==4&&(t=Jc.footprintConfig[this.footprintConfigSelected]),t?this.disableOperation(!0):this.disableOperation(!1),Jc.operation}async getConfig(){let t=await this.getNewUserConfig(),e=this.getSystemElementFilters();return R.getInstance().doctype==3?(!e[this.pcbConfigSelected]&&!t[this.pcbConfigSelected]&&(this.pcbConfigSelected=this.pcbConfigDefault="Common"),{userConfig:t,systemConfig:e,doctype:3,operation:Jc.operation,selected:{configName:this.pcbConfigSelected,configType:e.hasOwnProperty(this.pcbConfigSelected)?"systemConfig":"userConfig"},unSaved:await this.isUnSaved(),defaultValue:this.pcbConfigDefault}):R.getInstance().doctype==4?(!e[this.footprintConfigSelected]&&!t[this.footprintConfigSelected]&&(this.footprintConfigSelected=this.footprintConfigDefault="Common"),{userConfig:t,systemConfig:e,doctype:4,operation:Jc.operation,selected:{configName:this.footprintConfigSelected,configType:e.hasOwnProperty(this.footprintConfigSelected)?"systemConfig":"userConfig"},unSaved:await this.isUnSaved(),defaultValue:this.footprintConfigDefault}):{}}getElementFilterType(t){if(!t||!t.model)return;let r=t.model.modelType,i=t.getParent(),n=!1;if(i&&i.model.modelType==="Component"){let a=t.layerId;if(r=="Text"&&t.key)return 2;if(a==3||a==4)return 3;n=!0}if(["Rect","Circle","Polygon"].includes(r)){if(n)return 1;switch(t.model.type){case"Board Outline":return 17;case"Slot Region":return 18;case"Copper Region":return 21;case"Copper Region":return 17;case"Fill Region":return 19;case"Annotation":return 38;case"FPC Stiffener":return 20;case"Prohibited Region":return 23;case"Constraint Region":return 24;case"Line":return 26;case"TearDrop":return 34;case"3D Shell - Outline":return 27;case"3D Shell - Screw Pillar":return 28;case"3D Shell - Side Datum Line":return 29;case"3D Shell - Side Slot Region":return 31;case"3D Shell - Top Slot Region":return 30;case"3D Shell - Side Entity":return 33;case"3D Shell - Top/Bottom Entity":return 32;default:break}return}let s=null;switch(r){case"Component":s=1;break;case"Text":s=13;break;case"Track":case"ArcTrack":s=4;break;case"Pad":t.isTestPad?s=5:s=6;break;case"Via":t.isSuture?s=10:s=9;break;case"Image":s=15;break;case"Picture":s=14;break;case"Length Dimension":s=16;break;case"Ratline":s=11;break;case"Copper":s=21;break;default:break}return n&&[4,13,16,18].includes(s)&&(s=1),s}getElementFilterConfig(t){if(!t)return;let e=this.getElementFilterType(t);return Ri.getInstance().getItem(e)}getElementFilterVisible(t){let e=this.getElementFilterConfig(t);return e?e.visible:t instanceof Gi?Pe.getActiveLayerID()==t.layerId:!0}updateElementFilterVisible(t,e,r){if(!t)return!1;if(!t.isEmpty){t.updateFilterVisible=!1;let i=this.getElementFilterVisible(t);return i?e?t.click(r):t.visible():t.hidden(),t instanceof ke&&this.componentVisibleRefresh(i,t),!0}return!1}componentVisibleRefresh(t,e){let r=Ri.getInstance();[2,3,6].forEach(n=>{let s=r.getItem(n);if(s.visible!=t){if(n===2){this.refreshState(e.attributes,s.visible);return}if(n===6){this.refreshState(e.getPads(),s.visible);return}if(n===3){let a=e.getItems().filter(l=>l.layerId!=null&&(3==l.layerId||4==l.layerId));this.refreshState(a,s.visible)}}})}refreshState(t,e){for(let r of t)e&&!r.isVisible?r.visible():!e&&r.isVisible&&r.hidden()}updateElementsFilterVisible(t,e,r){t==null||t.forEach(i=>{this.updateElementFilterVisible(i,e,r)})}getFilterConfig(){let t={PlaneZone:!0},e=Ri.getInstance(),r={TopPad:6,BottomPad:6,MultiPad:6,Via:9,PadDrill:6,ViaDrill:9,Track:4,Text:13,Image:15,Dimension:16,BoardOutline:17,BoardCutout:18,CopperOutline:21,CopperFilled:21,TearDrop:34,"DRC Marking":35,SolidRegion:19,ProhibitedRegion:23,FPCStiffener:20,Line:26,ComponentProperty:2,ComponentSilkscreen:3,Shell_Outline:27,Shell_ScrewPillar:28,Shell_SideDatumLine:29,Shell_SideSlotRegion:30,Shell_TopBottomSlotRegion:30,Shell_SideEntity:31,Shell_TopBottomEntity:32};for(let i in r){let n=r[i],s=e.getItem(n);t[i]=s?s.visible:!0}return t}};var NOe=class extends $x{constructor(e){super("2.0",3);this.netMap=new Map;this.netMap=e}encodeRuleData(){let e=this.getNetModel(),r=re.getInstance().betweenNetRule,i=re.getInstance().getAllNetClass(),n=re.getInstance().getAllNetDifferentials(),s=re.getInstance().getAllEqualLengthGroups();e.forEach(a=>{this.feed("NET",a)}),e.forEach(a=>{this.feed("RULE_SELECTOR",a)}),i.forEach(a=>{this.feed("RULE_SELECTOR",a)}),n.forEach(a=>{this.feed("RULE_SELECTOR",a)}),s.forEach(a=>{this.feed("RULE_SELECTOR",a)}),r.rule.forEach(a=>{this.feed("RULE_SELECTOR",a)})}feed(e,r){let i=this.getItemFormat(e),n=this.getEncode(e),s={};for(let a of i)s[a]=this.getData(a,n,r);return this.uploadSource(e,s,r),s}getNetModel(){let e=new Set;for(let[r]of this.netMap){let i=re.getInstance().getNet(r);i==null&&(i=re.getInstance().addNet(r)),i!=null?e.add(i):console.warn(`${r}\u7F51\u7EDC\u65B0\u589E\u5931\u8D25`)}return e}getSource(){return this.encoder.getDataStr()}},kXe=NOe;var BXe=["EQ_LEN_GRP","NET","NET_CLASS"],kOe=class extends cS{constructor(e,r,i){super(e);this.netMap=new Map;this.netSuffix=null;this.netSuffix=r,this.netMap=i}pasteParseSource(e){let r=this.compiler.getHandle(),i=new s1(this);this.compiler.setHandle(i,!0),this.compiler.consistencyManager.parseFull(e),this.compiler.setHandle(r,!0)}updateDecodeData(){this.handleNet();for(let e of this.decode.ruleSelect)this.updateRuleSelector(e);this.uploadRule()}updateRuleSelector(e){if(Array.isArray(e.select[0])&&e.select[0].length>0)this.handleBetweenNetRule(e);else{let r=e.select[0],i=e.select[1];if(!this.check(i,r))return;if(BXe.includes(r))for(let n in e.keyValue){let s=e.keyValue[n];Array.isArray(s)&&(s[1]=this.netMap.get(s[1]))}e.select[1]=`${i}${this.netSuffix}`,e.load(),this.handleNetLengthTolerance(i,e.select[1],r)}}handleNet(){for(let e of this.decode.net){if(!this.netMap.has(e.name))continue;let r=this.netMap.get(e.name);e.name=r,e.type!=null&&this.check(e.type,"NET_CLASS")?e.type=`${e.type}${this.netSuffix}`:e.type=null,e.DifferentailName!=null&&this.check(e.DifferentailName,"DIFF_PAIR")?e.DifferentailName=`${e.DifferentailName}${this.netSuffix}`:e.DifferentailName=null,e.EqualLengthGroupName!=null&&this.check(e.EqualLengthGroupName,"EQ_LEN_GRP")?e.EqualLengthGroupName=`${e.EqualLengthGroupName}${this.netSuffix}`:e.EqualLengthGroupName=null,e.load()}}handleBetweenNetRule(e){let r=!1;for(let i of e.select){let n=i[0],s=i[1];if(n==="NET_CLASS"){if(!this.check(s,"NET_CLASS")){r=!0;break}i[1]=`${s}${this.netSuffix}`}else if(n==="EQ_LEN_GRP"){if(!this.check(s,"EQ_LEN_GRP")){r=!0;break}i[1]=`${s}${this.netSuffix}`}else if(n==="NET"){if(!this.check(s,"NET")){r=!0;break}i[1]=this.netMap.get(s)}}r||e.load()}check(e,r){let i=new Set;switch(r){case"NET_CLASS":{i=re.getInstance().getNetClass(e).getNets();break}case"DIFF_PAIR":{i=new Set(re.getInstance().getNetDifferential(e).getNets());break}case"EQ_LEN_GRP":{i=re.getInstance().getEqualLengthGroup(e).getNets();break}case"NET":return this.netMap.has(e)}if(i.size===0)return!1;for(let n of i)if(!this.netMap.has(n))return!1;return!0}handleNetLengthTolerance(e,r,i){if(!BXe.includes(i))return;let n,s;i==="NET"?(n=re.getInstance().getNet(e),s=re.getInstance().getNet(r)):i==="EQ_LEN_GRP"?(n=re.getInstance().getEqualLengthGroup(e),s=re.getInstance().getEqualLengthGroup(r)):i==="NET_CLASS"&&(n=re.getInstance().getNetClass(e),s=re.getInstance().getNetClass(r)),s&&n&&!n.netLengthTolerancePhysics&&(s.netLengthTolerancePhysics="")}uploadRule(){let e=new Set,r=re.getInstance().getAllNetClass(),i=re.getInstance().betweenNetRule,n=re.getInstance().getAllNetDifferentials(),s=re.getInstance().getAllEqualLengthGroups();for(let[a,l]of this.netMap){let c=re.getInstance().getNet(l);e.add(c)}for(let a of e)this.compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",a)),this.compiler.uploadNet(a.name,Sr.getInstance().encode("NET",a));for(let a of r)this.compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",a));for(let a of i.rule)this.compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",a));for(let a of n)this.compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",a));for(let a of s)this.compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",a))}},FXe=kOe;var URt=["Constraint Region","Copper Region","3D Shell - Outline","3D Shell - Screw Pillar","3D Shell - Side Entity","3D Shell - Side Datum Line","3D Shell - Side Slot Region","3D Shell - Top/Bottom Entity","3D Shell - Top Slot Region"],Rpe=class extends Ei{constructor(){super();this.commandFactory=new De("push component");this.commands=new De("paste");this.mouseLeftX=0;this.mouseLeftY=0;this.unitConversion=new dt;this._drawing=!1;this.specialPasteNetMap=new Map;this.nthTime=1;this.tool=null;this.bridgingCoppers=new Array;this.customCopperMap=new Map;A.publish("updateFrame",""),A.subscribe("getPasteData",this.getPasteData.bind(this)),A.subscribe("rotateForAngle",this.rotateFor.bind(this))}get drawing(){return this._drawing}set drawing(e){this._drawing=e,this.tool!=null&&(this.tool.drawing=e)}reuseRepeat(e,r){var d;if(!R.getInstance().isactive||23==R.getInstance().doctype||e==null)return;let i=e.head,n=e.data,{position:s,combination:a}=i,l=new Array;r==null&&(r={});let c=new Array,h=new Set([...Kt.getAllItem(),...Xt.getAllItem(),...pt.getAllItem()].filter(p=>p.type=="Copper Region").map(p=>p.component.name));for(let p in n){let m=n[p];for(let g=0;g<m.length;g++){let y=JSON.parse(m[g]);if(y.type=="Copper Region"){let T=y.componentData.name,I=Ti.nameManager.getNum(T);if(h.has(I)){let C=1,E=I.split("-")[0];for(;h.has(`${E}-${C}`);)C++;I=`${E}-${C}`}y.componentData.name=I}let b=aC.getManager(Number(p));if(b==null)continue;(b instanceof h5||b instanceof u5||b instanceof v5)&&(d=Pe.getLayer(y.layerId))!=null&&d.isPlaneLayer()&&(y.layerId=1);let P=b.copy(y);l.push(P),y.globalIndex!=null&&(r[y.globalIndex]=P.globalIndex),P instanceof He&&P.type=="Copper Region"&&c.push({item:P,order:P.getComponent().order})}}for(let p of l)if(p instanceof lt&&p.type=="TearDrop"){let m=new Array;for(let g of p.getComponent().connects){let y=r[g];y!=null&&m.push(y)}pt.modifyConnect(p,m)}let u=c.sort((p,m)=>p==null||m==null?0:p.order-m.order).map(p=>p.item);un.toLowest(u,!1);for(let p of l)p.click();return A.publish("updateFrame",""),{group:l,position:s}}generateUniqueIdInfo(){let e=R.getInstance().partitionId;return Ar.getAllItem().filter(r=>r.partition===e).reduce((r,i)=>{let n=i.attrKeyValue["Unique ID"];if(n){r.uniqueIdSet.add(n);let s=n.split("_")[0],a=r.prefixCountMap.get(s)||0,l=n.match(/_(\d+)$/),c=l?parseInt(l[1],10):0;r.prefixCountMap.set(s,Math.max(a,c))}return r},{uniqueIdSet:new Set,prefixCountMap:new Map})}getPasteData(e,r){var v,D;let i=R.getInstance().doctype;if(!R.getInstance().isactive||[23].includes(i))return;if(e==null){A.publish("tool","dropdrag");return}let n=e.copyData,s=n.layerIdReplacementTableMapping,l=Cb(s,"");if(!n.head.position&&!aC.getData()&&!n.head.type){A.publish("tool","dropdrag");return}let c=n.head,h=n.data,{position:u}=c,d=new Array,p=new Array;r==null&&(r={});let m;ze.isSpecialPaste&&(m=this.generateRandomString(4));let g=i==4,{uniqueIdSet:y,prefixCountMap:b}=this.generateUniqueIdInfo(),P=w=>{let[F]=w.split("_"),H=b.get(F)||1,z=w;for(;y.has(z);)z=`${F}_${H}`,H++;return b.set(F,H),y.add(z),z},T=new Set,I=new Set(Ar.getAllItem().map(w=>w.designator)),C=new Set([...Kt.getAllItem(),...Xt.getAllItem(),...pt.getAllItem()].filter(w=>w.type=="Copper Region").map(w=>w.component.name));for(let w of Object.keys(h)){let F=aC.getManager(Number(w));if(F!=null)for(let H of h[w]){let z=JSON.parse(H),V=z.layerId,W=Cb(l,V);if(W&&(z.layerId=W),z.type=="Copper Region"){let U=z.componentData.name,B=Ti.nameManager.getNum(U);if(C.has(B)){let G=1,Y=B.split("-")[0];for(;C.has(`${Y}-${G}`);)G++;B=`${Y}-${G}`}z.componentData.name=B}if(z.type=="TearDrop"&&(F=pt),g&&(Number(w)==19||URt.includes(z.type)||(z.net&&(z.net=""),!this.itemLayerIsOpened(z)))||Mt.isChildPcb()&&F instanceof _D)continue;if((F instanceof h5||F instanceof u5||F instanceof v5)&&(v=Pe.getLayer(z.layerId))!=null&&v.isPlaneLayer()&&(z.layerId=1),F instanceof _D){let U=z.attrsMap["Unique ID"];if(U&&y.has(U)){let B=P(U);z.attrsMap["Unique ID"]=B;let G=(D=z.ATTR)==null?void 0:D.find(Y=>Y.key==="Unique ID");G&&(G.value=B)}}ze.isSpecialPaste&&m!=null&&z.net&&(this.specialPasteNetMap.set(z.net,`${z.net}_$${m}`),z.net=z.net+`_$${m}`);let L=z.footprint,k=Cb(s,L),N=F instanceof _D?F.copy(z,k):F.copy(z);if(le.pcbConfig.autoDesignator&&N instanceof ke&&I.has(N.designator)&&T.add(N),N.partition=z.partition,this.collectCopperSelectorMap(w,z,N.globalIndex),R.getInstance().doctype!=3&&(N instanceof Le||N instanceof Ue)&&(N.unusedInnerLayers=[]),N instanceof ke&&ze.isSpecialPaste){let U=N.getItems();for(let B of U)"net"in B&&B.net&&(this.specialPasteNetMap.set(B.net,`${B.net}_$${m}`),B.net=B.net+`_$${m}`)}z.type=="Copper Region"&&N instanceof He?p.push(N):d.push(N),(z.globalIndex||z.gId)&&(r[z.globalIndex||z.gId]=N.globalIndex)}}if(le.pcbConfig.autoDesignator&&!ze.isSpecialPaste&&T.size&&IOe(T),ze.isSpecialPaste){let w=new kXe(this.specialPasteNetMap),F=new FXe(R.getInstance().compiler,`_$${m}`,this.specialPasteNetMap);w.encodeRuleData(),F.pasteParseSource(w.getSource()),F.updateDecodeData()}let E=mf.getNextTool()?mf.getNextTool().getNextTool():null,O=E instanceof pE;if(d.length+p.length==0){A.publish("tool","dropdrag");return}else O&&E.initPastePanel().then(w=>a0.getInstance().toggle2ActiveLayer(n,r));p.sort((w,F)=>w.getComponent().order-F.getComponent().order),xe.addAll(d,p);for(let w of d)if(w instanceof lt&&w.type=="TearDrop"){let F=new Array;for(let H of w.getComponent().connects){let z=r[H];z!=null&&F.push(z)}F.length>1?pt.modifyConnect(w,F):w.type="Fill Region"}else if(w instanceof Ue&&w.type==1)if(w.resetReadRender(),g)w.type=0;else{let F=re.getInstance().getDefaultBlindPhysics();(F==null?void 0:F.getBlindVia(w.name))||(w.type=0)}else if(w instanceof He&&["3D Shell - Side Slot Region","3D Shell - Side Entity"].includes(w.type)){let F=w.getComponent(),H=r[F.lineId];H!=null&&(F.lineId=H)}if(!u){let w=ys(d),F;if(w.valid()&&(F=w.build1()),u=new S(F.center().x,F.center().y),d.length==1){let H=d[0];(H instanceof Ge||H instanceof mt||H instanceof _t||H instanceof lt)&&(u=H.start)}}this.mouseLeftX=u.x,this.mouseLeftY=u.y,this.transformTool=new Ad(d),(O||E instanceof c_)&&E.filterItems.clear();for(let w of this.transformTool.group)if((O||E instanceof c_)&&(E.filterItems.add(w),w instanceof ke))for(let F of w.getItems())E.filterItems.add(F);let _=new Dt(ba.x-this.mouseLeftX,ba.y-this.mouseLeftY,0),x=Ae.translate1(_);return this.transformTool.transform(x),this.mouseLeftX=ba.x,this.mouseLeftY=ba.y,this.drawing=!0,A.publish("updateCross",""),A.publish("updateFrame",""),ze.isSpecialPaste=!1,this.transformTool.recordStyle(),{tool:this.transformTool,position:u}}generateRandomString(e){for(var r="",i="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",n=i.length,s=0;s<e;s++)r+=i.charAt(Math.floor(Math.random()*n));return r}itemLayerIsOpened(e){if(!e.layerId)return Pe.getLayer(e.startLayer).config||Pe.getLayer(e.endLayer).config;let r=Pe.getLayer(e.layerId);return r&&r.config}onKeyDown(e){var n;if(e.keyCode===32){if(((n=this.transformTool)==null?void 0:n.group.length)>0){let s=new S(this.mouseLeftX,this.mouseLeftY),a=Ae.translate(-s.x,-s.y,0).rotateZ(le.pcbConfig.rotate).translate1(s.x,s.y,0);this.transformTool.transform(a)}}else e.keyCode===9?A.publish("openMainDialog",{cmd:23,data:{option:{unit:R.getInstance().unit}}}):e.keyCode===27&&this.cancel();let r=5;switch(tr.getAction(r,e)){case"Flip Right and Left":{this.turn("turnAround");break}case"Flip Up and Down":{this.turn("turnUpsideDown");break}}A.publish("updateFrame","")}onKeyUp(e){var r;if(((r=this.transformTool)==null?void 0:r.group.length)>0){let i=new Dt(e.sceneX-this.mouseLeftX,e.sceneY-this.mouseLeftY,0),n=Ae.translate1(i);this.transformTool.transform(n),this.mouseLeftX=e.sceneX,this.mouseLeftY=e.sceneY}}onMouseLeftUp(e){this.drawing&&(this.transformTool.complete(),this.handleBridgingCopperNets(),this.handleCustomCopperRule(),this.handleNets(e),this.handlePastePanel(),this.nthTime++)}handleBridgingCopperNets(){let e=Ye.getAllNets();this.transformTool.group=this.transformTool.group.filter(r=>{if(r instanceof He&&r.type==="Fill Region"&&r.getComponent()instanceof Zi){let i=r.getComponent();if(i.isBridgingCopper&&i.networkList){let n=Ye.getSameNetItems(r.net);if(r.net!==""&&n.length==0&&i.networkList.length>0||n.length==1&&n[0]==r){Ye.delete(r);let s=i.networkList.indexOf(r.net);s>-1&&(i.networkList.splice(s,1),r.net="")}return i.networkList=i.networkList.filter(s=>e.includes(s)),this.bridgingCoppers.push(r),!1}}return!0})}collectCopperSelectorMap(e,r,i){if(e!=="6"&&e!=="9"&&e!=="16"||r.type!=="Copper Region")return;let s=re.getInstance().getRegion(r.globalIndex);s&&this.customCopperMap.set(i,s)}handleCustomCopperRule(){let e=re.getInstance();for(let[r,i]of this.customCopperMap.entries()){if(!i)continue;let n=e.addRegionSelector(r);i.safeClearance&&(n.safeClearance=i.safeClearance),i.copperPlane&&(n.copperPlane=i.copperPlane),Pp.getInstance().publish("modify",n)}}getNearNetPcbItems(e){let r=new _e,i=()=>{if(this.transformTool.group.length<1)return{canSkip:!0,criticalItems:null};let m=new Set,g=new WeakMap;for(let T of this.transformTool.group)if(r.ext1(T.buildBBox()),m.add(T),T instanceof ke){let I=g.get(T)||T.getItems();g.set(T,I),I.forEach(C=>m.add(C))}let P=kt.search4Types(r.build1(),sCe).getResult(jd).filter(T=>!m.has(T));return{canSkip:P.length===0,criticalItems:P}},n=(m,g)=>{if(!g||g.length===0)return m;let y=new _e;if(g.forEach(I=>y.ext1(I.buildBBox())),r.build1().area()*.8<y.build1().area())return m;let b=y.build1(),P=new Set,T=I=>{I.buildBBox().intersect(b)&&(P.add(I),I instanceof ke&&I.getItems().forEach(C=>{C.buildBBox().intersect(b)&&P.add(C)}))};return m.forEach(T),Array.from(P)},{canSkip:s,criticalItems:a}=i(),l=new Set;if(s)return{netsGroupSet:l,isMoreThan2Nets:!1};let c=this.transformTool.group.filter(m=>m instanceof He&&m.type=="Copper Region");if(c.length==this.transformTool.group.length){for(let m of c){let g=m.getMathGraphics(),y=Vr.getSelectContect(g),b=this.filterNearItemNet(y,m.layerId);l.add({group:[m],nets:b})}return{netsGroupSet:l,isMoreThan2Nets:!1}}let u=this.transformTool.group.length>8e4&&a?n(this.transformTool.group,a):this.transformTool.group,d=new Ay(u);d.updateScene();let p=d.getNetPcbItems(e);return d.recycle(),d=null,p}filterNearItemNet(e,r){let i=new Set;for(let n of e){let s=Ao(n);if(!(n instanceof Ue&&n.startLayer!==r&&n.endLayer!==r)&&!(r!==12&&n.layerId!==12&&!(n instanceof Ue)&&n.layerId!==r)&&s){if(n instanceof Ge||n instanceof Ue||n instanceof _i||n instanceof sn||n instanceof Jr||n instanceof Gi)i.add(s);else if(n instanceof He&&(n.type=="Line"||n.type=="Fill Region")){if(!Pe.getLayer(n.layerId).isSignalLayer())return;i.add(s)}}}return i}handlePastePanel(){a0.getInstance().toggle2ActiveLayer(void 0,void 0,!0),a0.getInstance().reset()}toastInheritInfo(e){e&&A.publish("ui/toastMsg",{type:"info",msg:"Some networks were not inherited, please check",timer:6,autoHeight:!0},Q())}handleNets(e){switch(a0.getInstance().inheritNet){case"KeepOriginNets":Mt.isChildPcb()&&this.transformTool.group.forEach(i=>i.net="");break;case"ClearNets":this.transformTool.group.forEach(i=>{i instanceof ke?i.getItems().forEach(n=>{Ao(n)!==null&&(n.net="")}):Ao(i)!==null&&(i.net="")});break;case"InheritNetsfromTouchedObjects":this.inheritNets(e);break}this.drawing&&this.complete()}inheritNets(e){let{netsGroupSet:r,isMoreThan2Nets:i}=this.getNearNetPcbItems(e);this.netsGroupSet=r,this.netsGroupSet.size>1?(this.mulGroupInheritNet(),this.toastInheritInfo(i)):this.netsGroupSet.size===1?this.singleGroupInheritNet(e,i):(Mt.isChildPcb()&&this.transformTool.group.forEach(n=>n.net=""),this.toastInheritInfo(i))}singleGroupInheritNet(e,r){this.nets=new Set;let i=!1;this.netsGroupSet.forEach(s=>{this.nets=s.nets,i=s.group.some(a=>a instanceof Jr||a instanceof He&&(a.type=="Copper Region"||a.type=="Fill Region"))});let n=this.nets.size>1&&i;if(!this.nets.size||n){Mt.isChildPcb()&&this.netsGroupSet.forEach(s=>{s.group.forEach(a=>{a.net=""})}),n&&this.toastInheritInfo(r);return}else if(this.nets.size===1){let s=Array.from(this.nets)[0];this.netsGroupSet.forEach(a=>{a.group.forEach(l=>{l.net=s})})}else Mt.isChildPcb()?this.netsGroupSet.forEach(s=>{s.group.forEach(a=>{a.net=""})}):this.showNetsMenu(e)}mulGroupInheritNet(){this.netsGroupSet.forEach(e=>{let r=e.nets;if(r&&r.size===0)return;let i=r&&r instanceof Set&&r.size==1?Array.from(r)[0]:"";Mt.isChildPcb()&&(!r.size||r.size>1)&&(i=""),e.group.forEach(n=>{n.net=i})})}createATTR(e,r,i){let n=3;e.layerId==2&&(n=4);let s=le.getDefaultFontSetting(),a=e.generateValidId(),l=ri.rebuild(a,n,r,!1,i,!1,s.defaultComponentFontTypeface,s.defaultComponentFontHeight,e.rotation,!1,S.ORIGIN,3,s.defaultComponentFontStrokeWidth,!1,0,!1,!0);return e.addAttribute(l),l}getUniqueIdCache(e){let r=Ar.getAllItem(),i=new Map;for(let n=0,s=r.length;n<s;n++){let a=r[n];if(a.partition!=R.getInstance().partitionId||e.has(a))continue;let l=r[n].attrKeyValue["Unique ID"],c=i.get(l)||0;c++,i.set(l,c)}return i}updateUniqueId(e,r){let i=this.getUniqueIdCache(r);for(let[n,s]of e){let a=n.split("_")[0];if(i.get(n)==null){let c=0;i.set(n,1);for(let h=1,u=s.length;h<u;h++){let d=s[h],p=`${a}_${h+c}`;for(;i.has(p);)p=`${a}_${h+ ++c}`;i.set(p,1),d.modifyATTRMap("Unique ID",p);let m=this.createATTR(d,"Unique ID",p),g=ts.getItem(d.deviceUUID);g.addAttr("Unique ID",g.getAttrData(d.model,m.model))}}else{let c=s.length;for(let h=0,u=s.length;h<u;h++){let d=s[h],p=`${a}_${h+c}`;for(;i.has(p);)p=`${a}_${h+ ++c}`;i.set(p,1),d.modifyATTRMap("Unique ID",p);let m=this.createATTR(d,"Unique ID",p),g=ts.getItem(d.deviceUUID);g.addAttr("Unique ID",g.getAttrData(d.model,m.model))}}}}complete(){var e;if(this.transformTool.complete(),this.bridgingCoppers.length>0&&(this.bridgingCoppers.forEach(r=>this.transformTool.group.push(r)),this.bridgingCoppers=new Array),this.transformTool.group.length>0){let r=new Map,i=new Set;for(let h of this.transformTool.group){if(!Mt.checkIsInCanEdit(h)){let u="beyond drawing range";Mt.showMassageTip(u,u);return}if(h instanceof ke){let u=h.attrsMap["Unique ID"];if(u){let d=r.get(u);d==null&&(d=new Array,r.set(u,d)),d.push(h),i.add(h)}}}this.updateUniqueId(r,i),A.publish("onlySelect",this.transformTool.group);let n=!1,s=ZYe(this.transformTool.group);if(le.pcbConfig.isPlaceViasAutoShove&&s){A.publish("updateRtree","");let h=this.transformTool.group.filter(u=>u instanceof Ue||u instanceof Ge);if(h.length>0){let u=new Lr,d=aE(h,u);Nl.getInstance().init(),(e=this.shoveCommands)==null||e.undo(),this.shoveCommands=new Lr,zS(d,this.shoveCommands,!0)}}if(le.pcbConfig.moveComponent=="push"){for(let h of this.commandFactory.commands)this.commands.addCommand(h);this.commandFactory=new De("push component")}let a=new hi;a.addGroup(this.commands);for(let h of this.transformTool.group)a.addCommand4Item(h,"add");this.addRuleCommand(a);let l;s&&(l=yhe(this.commands));for(let h of this.transformTool.group)un.addOrder(h,a.getCommand());this.transformTool.group.length<1e3?a.checkOutlines(this.transformTool.group,new Set):a.execute(),this.commands=new De("paste"),le.pcbConfig.isPlaceViasAutoShove&&s&&(this.shoveCommands=new Lr,lE(),this.getNewViaAfterShove(l));let c=new Set;for(let h of this.transformTool.group)h.isEmpty||h instanceof He&&h.type=="Copper Region"&&c.add(h.globalIndex);this.transformTool.group.length=0,c.size>0&&A.publish("rebuildConnectCopper",Array.from(c))}this.subPosition=null,A.publish("tool","dropdrag"),at.destroy()}getNewViaAfterShove(e){if(!e||Object.keys(e).length===0)return;let r=Object.values(e),i=[];for(let n of r){let s=Wr.getItem(n);for(let a of this.transformTool.group)a instanceof Ue&&s&&s.center.equals1(a.center)&&i.push(s)}A.publish("onlySelect",[].concat(i,this.transformTool.group.filter(n=>n instanceof Ge)))}pastePosition(e,r=!0){let i=new S(this.mouseLeftX,this.mouseLeftY),n=e.sub(i),s=Ae.translate(n.x,n.y,0);this.transformTool.group.length>0&&this.drawing&&(this.transformTool.transform(s),this.transformTool.complete(),r&&Uu.realtimeCheckItems(this.transformTool.group),this.mouseLeftX=e.x,this.mouseLeftY=e.y)}applyValue(e){let r=new dt,{value:i,type:n,startPoint:s,cursorPoint:a}=e,l=new S(a.x-s.x,a.y-s.y).normalize();i=r.conversion(R.getInstance().unit,"mil",i/10),l=new S(l.x*i,l.y*i);let c=new S(l.x+s.x,l.y+s.y),h=new S(c.x-a.x,c.y-a.y),u=Ae.translate(h.x,h.y,0);this.transformTool.transform(u),this.complete()}showNetsMenu(e){if(this.drawing){this.drawing=!1;let r={};r.state="show",r.left=e.mouseX,r.top=e.mouseY,r.filter=this.getNetsMenuData().result,$t.getInstance().menuData(r,this)}}getNetsMenuData(){let e=new qt,r="INHERIT_NET:";return this.nets.forEach(i=>{if(i){let n={name:i,cmd:`${r+i}`,tips:"",option:{disabledI18n:!0}};e.addObj(n,!1,!1)}}),e}moveComponent(){if(this.transformTool.group.length>400)return;let e=Array.from(this.transformTool.group).filter(r=>r instanceof ke);if(this.transformTool.group.length==e.length&&e.length>0&&le.pcbConfig.moveComponent!=="ignore"){let r=[],i=qy(),n=e[0].model.buildBBox(),s=new S(n.minX,n.minY),a=new S(n.maxX,n.maxY);if(e.forEach(u=>{if(!this.subPosition){let p=u.position;this.subPosition=new S(this.mouseLeftX,this.mouseLeftY).sub(p)}r.push(`${Tr}${u.number}`);let d=u.model.buildBBox();s=new S(Math.min(s.x,d.minX),Math.min(s.y,d.minY)),a=new S(Math.max(a.x,d.maxX),Math.max(a.y,d.maxY))}),new Set(r).size!==r.length)return;let l=new S(s.x,a.y),c=new S(a.x,s.y),h=new bs(e[0].layerId,s,l,c,a,e[0].locked);switch(le.pcbConfig.moveComponent){case"push":this.commandFactory.undo(),this.commandFactory=new De("push component");let u=new Map;iG(h,this.commandFactory,i,u,r,e),u.clear();break;case"block":eG(h,i,e);break}e.forEach(u=>{this.mouseLeftX=u.position.x+this.subPosition.x,this.mouseLeftY=u.position.y+this.subPosition.y})}}onMouseMove(e){var r;if(((r=this.transformTool)==null?void 0:r.group.length)>0&&this.drawing){let i=new Dt(e.sceneX-this.mouseLeftX,e.sceneY-this.mouseLeftY,0),n=Ae.translate1(i);this.transformTool.transform(n),this.mouseLeftX=e.sceneX,this.mouseLeftY=e.sceneY,this.moveComponent()}}interrupt(){var e;if((e=this.transformTool)!=null&&e.group){for(let r of this.transformTool.group)r.remove(),A.publish("delete",r);ze.clearTempSelect(),this.transformTool.cancel(),this.drawing=!1,this.transformTool.group.length=0,this.customCopperMap.clear(),a0.getInstance().reset(),at.destroy(),this.subPosition=null}}cancel(){var e;this.interrupt(),le.pcbConfig.moveComponent=="push"&&((e=this.commandFactory)==null||e.undo(),this.commandFactory=new De("push component")),A.publish("tool","dropdrag")}referPosition(e){var r;if(((r=this.transformTool.group)==null?void 0:r.length)>0){let i=new Dt(e.x-this.mouseLeftX,e.y-this.mouseLeftY,0),n=Ae.translate1(i);this.transformTool.transform(n),this.complete()}else A.publish("tool","dropdrag")}onMouseRightUp(e){if(e.openMenu)switch(le.pcbConfig.endDrawing){case"ctrl+rightClick":{e.ctrlKey?this.onMouseLeftUp(e):this.rightClickMenuData(e);break}case"rightClick":{e.ctrlKey?this.rightClickMenuData(e):this.cancel();break}}}rightClickMenuData(e){let r={state:"show",left:e.mouseX,top:e.mouseY,filter:Kde(this.transformTool.group,e.adsorb).result};$t.getInstance().menuData(r,this),this.drawing=!1}parse(e){this.drawing=!0;let i=e.cmdKey.split(":");switch(i[0]){case"CANCEL":this.cancel();break;case"toggleAdsorb":A.publish("toggleAdsorb","");break;case"ADSORBENT_CONFIG":A.publish("openSystemDialog","ADSORPTION",Q());break;case"ROTATE":this.rotate(i[1]);break;case"FLIP":i[1]=="FLIP_LEFTANDRIGHT"?this.turn("turnAround"):i[1]=="FLIP_UPANDDOWN"?this.turn("turnUpsideDown"):i[1]=="FLIP_LEFTANDRIGHT_BY_REFER_POINT"?this.turn("turnAroundByReferPoint"):i[1]=="FLIP_UPANDDOWN_BY_REFER_POINT"&&this.turn("turnUpsideDownByReferPoint");break;case"INHERIT_NET":let n=i[1];this.netsGroupSet.forEach(s=>{s.group.forEach(a=>{a.net=n})}),this.complete();break;case"TURNOVER":{a_(!1,this.transformTool.group);break}}A.publish("updateFrame","")}turn(e){var r;if(!(!R.getInstance().isactive||23==R.getInstance().doctype))switch(xo.setTool(this),(r=this.transformTool)==null||r.sycn(),e){case"turnAround":xo.turn(this.transformTool.group,!1,!1,new S(this.mouseLeftX,this.mouseLeftY));break;case"turnUpsideDown":xo.turn(this.transformTool.group,!0,!1,new S(this.mouseLeftX,this.mouseLeftY));break;case"turnAroundByReferPoint":{let i={items:this.transformTool.group};xo.turnByReferPoint(i,this);break}case"turnUpsideDownByReferPoint":{let i={items:this.transformTool.group,isTurnUpsideDown:!0};xo.turnByReferPoint(i,this);break}}}rotate(e){let r=new S(this.mouseLeftX,this.mouseLeftY);if(e==="rotate_left"){let i=Ae.translate(-r.x,-r.y,0).rotateZ(le.pcbConfig.rotate).translate1(r.x,r.y,0);this.transformTool.transform(i)}if(e==="rotate_right"){let i=Ae.translate(-r.x,-r.y,0).rotateZ(-le.pcbConfig.rotate).translate1(r.x,r.y,0);this.transformTool.transform(i)}if(e==="rotate_reference_point"){let i={x:this.mouseLeftX,y:this.mouseLeftY,items:this.transformTool,executeCommand:!1};$n.rotateAssignReferPoint(i,this,null,null,this.rotateReferPointCallback.bind(this))}}rotateReferPointCallback(e,r,i,n){this.mouseLeftX=n.referPoint.x,this.mouseLeftY=n.referPoint.y;let s=new Dt(ba.x-this.mouseLeftX,ba.y-this.mouseLeftY,0),a=Ae.translate1(s);this.transformTool.transform(a),Uu.realtimeCheckItems(this.transformTool.group),this.mouseLeftX=ba.x,this.mouseLeftY=ba.y}addRuleCommand(e){if(this.specialPasteNetMap.size>0){let r=new Set;for(let[i,n]of this.specialPasteNetMap){let s=re.getInstance().getNet(n);s.netClass&&(r.has(s.netClass)||(e.addCommand(Ce.disPatchRule(s.netClass,"add")),r.add(s.netClass))),s.equalLengthGroup&&(r.has(s.equalLengthGroup)||(e.addCommand(Ce.disPatchRule(s.equalLengthGroup,"add")),r.add(s.equalLengthGroup))),s.netDifferential&&(r.has(s.netDifferential)||(e.addCommand(Ce.disPatchRule(s.netDifferential,"add")),r.add(s.netDifferential))),e.addCommand(Ce.disPatchRule(s,"add"))}this.specialPasteNetMap.clear()}}rotateFor(e){let r=new S(this.mouseLeftX,this.mouseLeftY);this.transformTool.rotateForAngle(r,e)}};var Dpe=class{constructor(t){this._info={};this._type=t}get type(){return this._type}set type(t){this._type=t}addSize(t){this._info[t.id]=t}removeSize(t){delete this._info[t.id]}get info(){return this._info}clear(){this._info={}}};var fC=class{constructor(t,e){this._id=t,this._type=e}get id(){return this._id}set id(t){this._id=t}get type(){return this._type}set type(t){this._type=t}};function cm(o,t,e=!0){if(typeof o!="number"&&(o=+o),isNaN(o))return NaN;if(t=t|0,t<=0||!o&&!e)return Math.round(o);var r=[1,10,100,1e3],i=r[t]||Math.pow(10,t)||10;if(e){var n=o<0?"-":"";for(o=o<0?-o:o,o=Math.round(o*i)+"";o.length<=t;)o="0"+o;return o=o.slice(0,-t)+"."+o.slice(-t),n+o}else return Math.round(o*i+1e-10)/i}var wpe=class extends fC{constructor(t,e,r,i,n){super(t,0),this._milDeltaX=e,this._milDeltaY=r,this._mmDeltaX=i,this._mmDeltaY=n}get milDeltaX(){return this._milDeltaX}set milDeltaX(t){this._milDeltaX=t}get milDeltaY(){return this._milDeltaY}set milDeltaY(t){this._milDeltaY=t}get mmDeltaX(){return cm(this._mmDeltaX,4)}set mmDeltaX(t){this._mmDeltaX=t}get mmDeltaY(){return cm(this._mmDeltaY,4)}set mmDeltaY(t){this._mmDeltaY=t}getMenu(){return{name:`${cm(this.mmDeltaX*10,3)}, ${cm(this.mmDeltaY*10,3)}mm | ${cm(this.milDeltaX*10,1)}, ${cm(this.milDeltaY*10,1)}mil`,cmd:`${this.id}`,tips:""}}getSizeAccordingToUnit(){let t=R.getInstance().unit;return t!=="mil"?{gridX:new dt().conversion(t,"mil",this._mmDeltaX),gridY:new dt().conversion(t,"mil",this._mmDeltaY)}:{gridX:this._milDeltaX,gridY:this._milDeltaY}}};var Lpe=class extends fC{constructor(t,e,r){super(t,1),this._mil=e,this._mm=r}get mil(){return this._mil}set mil(t){this._mil=t}get mm(){return this._mm}set mm(t){this._mm=t}getMenu(t=""){return{name:`${cm(this.mm*10,3)}mm | ${cm(this.mil*10,1)}mil`,cmd:`${t+this.id}`,tips:""}}getSizeAccordingToUnit(){let t=R.getInstance().unit;return t!=="mil"?new dt().conversion(t,"mil",this._mm):this._mil}};var Mpe=class extends fC{constructor(t,e,r,i,n){super(t,2),this._milInnerRadius=e,this._mmInnerRadius=r,this._milRadius=i,this._mmRadius=n}get milInnerRadius(){return this._milInnerRadius}set milInnerRadius(t){this._milInnerRadius=t}get mmInnerRadius(){return this._mmInnerRadius}set mmInnerRadius(t){this._mmInnerRadius=t}get milRadius(){return this._milRadius}set milRadius(t){this._milRadius=t}get mmRadius(){return this._mmRadius}set mmRadius(t){this._mmRadius=t}getMenu(t=""){return{name:`${cm(this.mmInnerRadius*20,3)}, ${cm(this.mmRadius*20,3)}mm | ${cm(this.milInnerRadius*20,1)}, ${cm(this.milRadius*20,1)}mil`,cmd:`${t+this.id}`,tips:""}}getSizeAccordingToUnit(){let t=R.getInstance().unit;return t!=="mil"?{innerRadius:new dt().conversion(t,"mil",this._mmInnerRadius),radius:new dt().conversion(t,"mil",this._mmRadius)}:{innerRadius:this._milInnerRadius,radius:this._milRadius}}};function VXe(){return{GridX:{number:5,unit:"mil"},GridY:{number:5,unit:"mil"}}}var Npe=class{constructor(){this.configGridType="grid";this.configMultiGridType="grid";this.configMultiRatio=5;this._crossCursor="Large";this._drcErrorStyle="1";this._displayComponentSpacing=!1;this._drcErrorZoom="keepConstantSize";this._graphicEffectMode="speedFirst";this._coreRenderingEngine="auto";this._UNIT="mil";this._FOOTPRINT_UNIT="mm";this._altGridSize=VXe();this._rotate=90;this._clickTrackSelect="single";this._showDiffLength=!0;this._showNetLength=!0;this._placeBlind=!1;this._trackFollowComponent=!0;this._rotateWhole="whole";this._moveComponent="ignore";this._autoChamfer2DLine="off";this._filletRadius2DLine=1.969;this._autoChamferTrack="off";this._filletRadiusTrack=1.969;this._startTrackWidth="last";this._startViaSize="last";this._showCrossCursor=!1;this._checkNetBeforeGerber=!0;this._checkDrcBeforeGerber=!0;this._trackFollow="moveKeep";this._trackFollowVia="moveKeep";this._autoTerminateRouting=!0;this._isUsedJLCColorSilk=!1;this._isAutoGenerate3dModel=!0;this._isPlaceViasAutoShove=!1;this._isAutoMoveCanvasDuringCrossProbe=!0;this._isAutoFitSelectionDuringCrossProbe=!1;this._isOtherObjectsDimDuringCrossProbe=!1;this._isCtrlDragToCopy=!1;this._snapToCenterWhileDragPadOrVia=!1;this._snapToOriginWhileDragFootprint=!1;this._alignToNearComponentOrPadWhileDrag=!1;this._isAssignNetForFreeTrack=!1;this._addTeardropAutomatically=!0;this._isKeepRefdesPaste="2";this._useDynamicInputBox=!0;this._displayProperty=!0;this._highLight=!0;this._defaultComponentFontTypeface="default";this._defaultComponentFontStrokeWidth=.6;this._defaultComponentFontHeight=4.5;this._highLightNet=!0;this._realTimeTrackSelectStats="single";this._wireConfirm="previous";this._endDrawing="ctrl+rightClick";this._addViaMethodWhileRoute="lastInflectionPoint";this._pcbLayerSelectedNameCache="";this._autoChangeLayerWhileRoutingVias=!0;this._dblclickPlaceViasWhileRouting=!0;this._routeAutoFanoutEnd=!1;this._isRebuildCopperAuto=!0;this._allowFootprintFlipping=!1;this.unusedPadOperation="remove";this.unusedPadRange=3;this.unusedPadOnlySelect=!0;this.realTimeUpdateUnusedLayers=!1;this._autoLoopUpMsgBox=!1;this.isInit=!0;this._referencePointPcbSelectMethod="default"}get autoLoopUpMsgBox(){return this._autoLoopUpMsgBox}set autoLoopUpMsgBox(t){this._autoLoopUpMsgBox=t}get realTimeTrackSelectStats(){return this._realTimeTrackSelectStats}get referencePointPcbSelectMethod(){return this._referencePointPcbSelectMethod}set referencePointPcbSelectMethod(t){this._referencePointPcbSelectMethod=t}get showCrossCursor(){return this._showCrossCursor}set showCrossCursor(t){this._showCrossCursor=t}get checkNetBeforeGerber(){return this._checkNetBeforeGerber}set checkNetBeforeGerber(t){this._checkNetBeforeGerber=t}get checkDrcBeforeGerber(){return this._checkDrcBeforeGerber}set checkDrcBeforeGerber(t){this._checkDrcBeforeGerber=t}get gridType(){return R.getInstance().gridType}set gridType(t){R.getInstance().gridType=t}get multiType(){return R.getInstance().multiType}set multiType(t){R.getInstance().multiType=t}get multiRatio(){return R.getInstance().multiRatio}set multiRatio(t){R.getInstance().multiRatio=t}get crossCursor(){return this._crossCursor}set crossCursor(t){this._crossCursor=t}get graphicEffectMode(){return this._graphicEffectMode}set graphicEffectMode(t){this._graphicEffectMode!=t&&(this._graphicEffectMode=t,this._graphicEffectMode=="effectFirst"?R.getInstance().setAntialias(!0):R.getInstance().setAntialias(!1))}get coreRenderingEngine(){return this._coreRenderingEngine}set coreRenderingEngine(t){typeof t<"u"&&this._coreRenderingEngine!=t&&(this._coreRenderingEngine=t,R.getInstance().coreRenderingEngine=t)}get drcErrorStyle(){return this._drcErrorStyle}set drcErrorStyle(t){this._drcErrorStyle!=t&&(this._drcErrorStyle=t,this.isInit||A.messageBus.rpcCall("getAllErrors",{isOpenDRCCustomCheck:ka.getInstance().isOpenDRCCustomCheck}))}get displayComponentSpacing(){return this._displayComponentSpacing}set displayComponentSpacing(t){this._displayComponentSpacing!=t&&(this._displayComponentSpacing=t)}get drcErrorZoom(){return this._drcErrorZoom}set drcErrorZoom(t){this._drcErrorZoom!=t&&(this._drcErrorZoom=t,EG.arrowStyleInitialized=!1,this.isInit||A.messageBus.rpcCall("getAllErrors",{isOpenDRCCustomCheck:ka.getInstance().isOpenDRCCustomCheck}))}get UNIT(){return this._UNIT}set UNIT(t){this._UNIT=t}get FOOTPRINT_UNIT(){return this._FOOTPRINT_UNIT}set FOOTPRINT_UNIT(t){this._FOOTPRINT_UNIT=t}get altGridSize(){return this._altGridSize}getAltGridSize(){let t=this._altGridSize.GridX,e=this._altGridSize.GridY,r=t.number/10,i=e.number/10,n=new dt;return R.getInstance().unit=="mil"?t.unit!=R.getInstance().unit&&(r=n.conversion(t.unit,R.getInstance().unit,r),i=n.conversion(e.unit,R.getInstance().unit,i)):t.unit==R.getInstance().unit&&(r=n.conversion(t.unit,"mil",r),i=n.conversion(e.unit,"mil",i)),{snapX:r,snapY:i}}set altGridSize(t){this._altGridSize=t,R.getInstance().altGridSize=t}get rotate(){return this._rotate/180*Math.PI}set rotate(t){this._rotate=t}get clickTrackSelect(){return this._clickTrackSelect}set clickTrackSelect(t){this._clickTrackSelect=t,this._realTimeTrackSelectStats=t}toggleRealTimeTrackSelectStats(t){t?this._realTimeTrackSelectStats=this._realTimeTrackSelectStats=="single"?"whole":"single":this._realTimeTrackSelectStats=this._clickTrackSelect}get showRuler(){return R.getInstance().openRuler}set showRuler(t){R.getInstance().openRuler!=t&&!R.getInstance().isPreview&&(R.getInstance().openRuler=t)}get isRebuildCopperAuto(){return this._isRebuildCopperAuto}set isRebuildCopperAuto(t){this._isRebuildCopperAuto=t,XI.getInstance().modifyDynamicCopper(t)}get allowFootprintFlipping(){return this._allowFootprintFlipping}set allowFootprintFlipping(t){this._allowFootprintFlipping=t}get padShowNet(){return ea.getInstance().padShowNet}set padShowNet(t){ea.getInstance().padShowNet!=t&&(ea.getInstance().padShowNet=t,VD.padFlushNumNet(),A.publish("updateFrame",""))}get padShowNum(){return ea.getInstance().padShowNum}set padShowNum(t){ea.getInstance().padShowNum!=t&&(ea.getInstance().padShowNum=t,VD.padFlushNumNet(),A.publish("updateFrame",""))}get trackShowNet(){return ea.getInstance().trackShowNet}set trackShowNet(t){ea.getInstance().trackShowNet!=t&&(ea.getInstance().trackShowNet=t,VD.trackFlushNet())}get viaShowLayerPair(){return ea.getInstance().viaShowPair}set viaShowLayerPair(t){ea.getInstance().viaShowPair!=t&&(ea.getInstance().viaShowPair=t,VD.viaFlushNet())}get viaShowNet(){return ea.getInstance().viaShowNet}set viaShowNet(t){ea.getInstance().viaShowNet!=t&&(ea.getInstance().viaShowNet=t,VD.viaFlushNet())}get showDiffLength(){return this._showDiffLength}set showDiffLength(t){this._showDiffLength!=t&&(this._showDiffLength=t)}get showNetLength(){return this._showNetLength}set showNetLength(t){this._showNetLength!=t&&(this._showNetLength=t)}get placeBlind(){return this._placeBlind}set placeBlind(t){this._placeBlind=t}get trackFollowComponent(){return this._trackFollowComponent}set trackFollowComponent(t){this._trackFollowComponent=t}get rotateWhole(){return this._rotateWhole}set rotateWhole(t){this._rotateWhole=t}get moveComponent(){return this._moveComponent}set moveComponent(t){this._moveComponent=t}get autoChamfer2DLine(){return this._autoChamfer2DLine}set autoChamfer2DLine(t){this._autoChamfer2DLine=t}get filletRadius2DLine(){return this._filletRadius2DLine}set filletRadius2DLine(t){this._filletRadius2DLine=t}get autoChamferTrack(){return this._autoChamferTrack}set autoChamferTrack(t){this._autoChamferTrack=t}get filletRadiusTrack(){return this._filletRadiusTrack}set filletRadiusTrack(t){this._filletRadiusTrack=t}get startTrackWidth(){return this._startTrackWidth}set startTrackWidth(t){this._startTrackWidth=t}get startViaSize(){return this._startViaSize}set startViaSize(t){this._startViaSize=t}get trackFollow(){return this._trackFollow}set trackFollow(t){this._trackFollow=t}get trackFollowVia(){return this._trackFollowVia}set trackFollowVia(t){this._trackFollowVia=t}get autoTerminateRouting(){return this._autoTerminateRouting}set autoTerminateRouting(t){this._autoTerminateRouting=t}get isUsedJLCColorSilk(){return this._isUsedJLCColorSilk}set isUsedJLCColorSilk(t){this._isUsedJLCColorSilk=t}get isAutoGenerate3dModel(){return this._isAutoGenerate3dModel}set isAutoGenerate3dModel(t){this._isAutoGenerate3dModel=t}get isPlaceViasAutoShove(){return this._isPlaceViasAutoShove}set isPlaceViasAutoShove(t){this._isPlaceViasAutoShove=t}get isAutoMoveCanvasDuringCrossProbe(){return this._isAutoMoveCanvasDuringCrossProbe}set isAutoMoveCanvasDuringCrossProbe(t){this._isAutoMoveCanvasDuringCrossProbe=t}get isAutoFitSelectionDuringCrossProbe(){return this._isAutoFitSelectionDuringCrossProbe}set isAutoFitSelectionDuringCrossProbe(t){this._isAutoFitSelectionDuringCrossProbe=t}get isOtherObjectsDimDuringCrossProbe(){return this._isOtherObjectsDimDuringCrossProbe}set isOtherObjectsDimDuringCrossProbe(t){this._isOtherObjectsDimDuringCrossProbe=t}get isCtrlDragToCopy(){return this._isCtrlDragToCopy}set isCtrlDragToCopy(t){this._isCtrlDragToCopy=t}get snapToCenterWhileDragPadOrVia(){return this._snapToCenterWhileDragPadOrVia}set snapToCenterWhileDragPadOrVia(t){this._snapToCenterWhileDragPadOrVia=t}get snapToOriginWhileDragFootprint(){return this._snapToOriginWhileDragFootprint}set snapToOriginWhileDragFootprint(t){this._snapToOriginWhileDragFootprint=t}get alignToNearComponentOrPadWhileDrag(){return this._alignToNearComponentOrPadWhileDrag}set alignToNearComponentOrPadWhileDrag(t){this._alignToNearComponentOrPadWhileDrag=t}get isAssignNetForFreeTrack(){return this._isAssignNetForFreeTrack}set isAssignNetForFreeTrack(t){this._isAssignNetForFreeTrack=t}get addTeardropAutomatically(){return this._addTeardropAutomatically}set addTeardropAutomatically(t){this._addTeardropAutomatically=t}get isKeepRefdesPaste(){return this._isKeepRefdesPaste}set isKeepRefdesPaste(t){this._isKeepRefdesPaste=t}get autoDesignator(){return["2","1"].includes(this._isKeepRefdesPaste)}get designatorAnnocationType(){return this._isKeepRefdesPaste}set designatorAnnocationType(t){this._isKeepRefdesPaste=t}get useDynamicInputBox(){return this._useDynamicInputBox}set useDynamicInputBox(t){this._useDynamicInputBox=t}get displayProperty(){return this._displayProperty}set displayProperty(t){this._displayProperty=t}get highLight(){return this._highLight}set highLight(t){this._highLight=t}get highLightNet(){return this._highLightNet}set highLightNet(t){this._highLightNet=t}get wireConfirm(){return this._wireConfirm}set wireConfirm(t){this._wireConfirm=t}get endDrawing(){return this._endDrawing}set endDrawing(t){this._endDrawing=t}get addViaMethodWhileRoute(){return this._addViaMethodWhileRoute}set addViaMethodWhileRoute(t){this._addViaMethodWhileRoute=t}get pcbLayerSelectedNameCache(){return this._pcbLayerSelectedNameCache}set pcbLayerSelectedNameCache(t){this._pcbLayerSelectedNameCache=t}get autoChangeLayerWhileRoutingVias(){return this._autoChangeLayerWhileRoutingVias}set autoChangeLayerWhileRoutingVias(t){this._autoChangeLayerWhileRoutingVias=t}get dblclickPlaceViasWhileRouting(){return this._dblclickPlaceViasWhileRouting}set dblclickPlaceViasWhileRouting(t){this._dblclickPlaceViasWhileRouting=t}get routeAutoFanoutEnd(){return this._routeAutoFanoutEnd}set routeAutoFanoutEnd(t){this._routeAutoFanoutEnd=t}get defaultComponentFontTypeface(){return this._defaultComponentFontTypeface}set defaultComponentFontTypeface(t){typeof t=="string"&&(this._defaultComponentFontTypeface=t)}get defaultComponentFontStrokeWidth(){return this._defaultComponentFontStrokeWidth}set defaultComponentFontStrokeWidth(t){this._defaultComponentFontStrokeWidth=t}get defaultComponentFontHeight(){return this._defaultComponentFontHeight}set defaultComponentFontHeight(t){this._defaultComponentFontHeight=t}get layerPhyPerferenceConfig(){return this._layerPhyPerferenceConfig}set layerPhyPerferenceConfig(t){this._layerPhyPerferenceConfig=t}};var kpe=class{constructor(){this.canvasTheme=Ns.getInstance();this._canvasLayerTheme=[]}get canvasLayerTheme(){return this._canvasLayerTheme}set canvasLayerTheme(t){this._canvasLayerTheme=t}get canvasLayerThemeSelected(){return this._canvasLayerThemeSelected}set canvasLayerThemeSelected(t){this._canvasLayerThemeSelected=t}};var BOe=class{constructor(t,e,r,i){this.attr=t,this.obj=e,this.showKey=r,this.showValue=i}},Bpe=class{constructor(){this.attributes=new Set}add(t,e,r,i){let n=new BOe(t,e,r,i);this.attributes.add(n)}modify(t,e,r,i){let n=!1;this.attributes.forEach(s=>{!n&&s.attr===t&&(s.obj=e,s.showKey=r,s.showValue=i,n=!0)}),n||this.add(t,e,r,i)}getAttribute(t){for(let e of this.attributes)if(e.attr===t)return e;return null}restore(){this.attributes.clear()}};var Fpe=class{constructor(){this.config={};this.COMMON_OPTION=["Grid Point","Extended Line"];this.LAYOUT_ROUTE_OPTION=["Footprint Center","Footprint Origin","Pad Center","Pad Vertices","Pad Edges","Via Center","Track Center"];this.OUTLINE_OPTION=["Endpoint","Midpoint","Intersection","Arc/Circle Center Point","Perpendicular Foot","Tangent Point","Region Center","Line Center"];this.config.Snapping="allLayers",this.config["Snap Distance"]={number:8,unit:"mil"};for(let t of this.COMMON_OPTION.concat(this.LAYOUT_ROUTE_OPTION,this.OUTLINE_OPTION))this.config[t]=!1}getConfig(t){return t?this.config[t]:JSON.parse(JSON.stringify(this.config))}setConfig(t){Hn(t,(e,r,i)=>{this.config[e]=r})}isNeedTrackObj(){return this.getConfig("Track Center")}isNeedViaObj(){return this.getConfig("Via Center")}isNeedPadObj(){return this.getConfig("Pad Center")||this.getConfig("Pad Vertices")||this.getConfig("Pad Edges")}isNeedOutlineObj(){for(let t of this.OUTLINE_OPTION)if(this.getConfig(t))return!0;return!1}isNeedComponentObj(){return this.getConfig("Footprint Center")||this.getConfig("Footprint Origin")||this.isNeedOutlineObj()}getNeedObjTypes(t){let e=[];return!t&&this.isNeedOutlineObj()&&e.push(mt,_t,rr,Pr,lt),this.isNeedPadObj()&&e.push(Le),this.isNeedViaObj()&&e.push(Ue),this.isNeedTrackObj()&&e.push(Ge),this.isNeedComponentObj()&&e.push(ke),e}getAdsorptionOutlines(){return this.OUTLINE_OPTION.filter(t=>this.config[t])}getSnapDistanceValue(){let{number:t,unit:e}=this.config["Snap Distance"];return new dt().conversion1(e,"mil",t)/10}};var Vpe=class extends fC{constructor(t,e,r,i){super(t,6),this._angleDelta=e,this._milStep=r,this._mmStep=i}get angleDelta(){return Xh(this._angleDelta)}set angleDelta(t){this._angleDelta=t}get milStep(){return this._milStep}set milStep(t){this._milStep=t}get mmStep(){return this._mmStep}set mmStep(t){this._mmStep=t}getMenu(){return{name:`${cm(this._angleDelta,1)}\xB0, ${cm(this._mmStep*10,3)}mm | ${cm(this._angleDelta,1)}\xB0, ${cm(this._milStep*10,1)}mil`,cmd:`${this.id}`,tips:""}}getSizeAccordingToUnit(){let t=R.getInstance().unit;return t!=="mil"?new dt().conversion(t,"mil",this._mmStep):this._milStep}};var Gpe=class{polarSetting(t){if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let{angleDelta:e,milStep:r,isNeedUnitTranslate:i=!1,isNeedRadiansTranslate:n=!1}=t;n&&(e=Xh(e)),i&&(r=new dt().conversion(R.getInstance().unit,"mil",r)),It.getInstance().angleDelta=e,It.getInstance().startAngle=we.startAngle,It.getInstance().endAngle=we.endAngle,It.getInstance().radius=r,It.getInstance().minRadius=we.minRadius,It.getInstance().maxRadius=we.maxRadius,A.publish("updateFrame",""),we.synchronize(),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),A.publish("flushSelectingInfo",""),bh.type&&A.publish("FlushSketcherAttrView",{type:bh.type})}gridSetting(t){if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let e=qS(),r,i,n,s,a,l=new dt,c=t.gridX.replace(/^[-+.\d\s]+/,""),h=t.gridX.replace(/[^-+.\d\s]+$/,"");n=l.conversion(c,"mil",parseFloat(h)/10);let u=t.gridY.replace(/^[-+.\d\s]+/,""),d=t.gridY.replace(/[^-+.\d\s]+$/,"");s=l.conversion(u,"mil",parseFloat(d)/10),t.visible!==void 0&&(r=t.visible),t.color&&(i=ee.of3(t.color)),t.style&&(a=t.style==="line"),It.getInstance().updateGridParam(r,n,s,a),(i=null)&&(It.getInstance().gridColor=i),!t.isTriggerBySnapSizeSetting&&le.getAssociationPCBCanvasGridAndSnap()===1&&(It.getInstance().setSnapX(n/e.xRatio),It.getInstance().setSnapY(s/e.yRatio)),A.publish("flushSelectingInfo",""),bh.type&&A.publish("FlushSketcherAttrView",{type:bh.type}),A.publish("updateFrame",""),we.synchronize(),np(),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q())}};var Upe=class extends fC{constructor(t,e){super(t,3),this._family=e}get family(){return this._family}set family(t){this._family=t}getMenu(){return{name:this._family,cmd:`${this.id}`,tips:""}}};var FOe=class{updateLayerWithFootprint(){for(let t of HO.concat(wL)){let e=Pe.getLayer(t);if(e){let{type:r,name:i,order:n,activeColor:s,deactiveColor:a,active:l}=e;e&&Pe.modifyLayer(t,r,i,n,s,a,l,e.layerStatus)}}}updateLayerWithPCB(t,e,r=!1){let i=t[0].deactiveColorAlpha;for(let n=0;n<t.length;n++){let s=t[n],a=Pe.getLayer(+s.layerId);if(a){let{order:l,active:c}=a,h=a.type,u=a.name,d=e==="SYSTEMMGR_PCB_THEME"?h:s.layerType,p=e==="SYSTEMMGR_PCB_THEME"?u:s.layerName;Pe.modifyLayer(+s.layerId,d,p,l,ee.of5(s.activeColor,s.activeColorAlpha),ee.of5(s.deactiveColor,i),c,a.layerStatus),ER.deactiveAlpha=i,r&&A0(+s.layerId)}}}},t$=new FOe;var UXe={prioritizeObjectSelection:"prioritizeObjectSelection",ADAPT_BOARDOUTLINE:"ADAPT_BOARDOUTLINE",ADDWITH_ROUTING:"ADDWITH_ROUTING",ADDWITH_TESTPOINTER:"ADDWITH_TESTPOINTER",ADDWITH_NODE:"ADDWITH_NODE",ADDWITH_ARC:"ADDWITH_ARC",ADDWITH_EQUALLENGTHTUNING:"ADDWITH_EQUALLENGTHTUNING",ADD_SOLDER_MASK:"ADD_SOLDER_MASK",ALIGNMENT:"ALIGNMENT",COMBINATION:"COMBINATION",COMBINATION_JOIN:"COMBINATION_JOIN",SECOND_COMBINATION:"SECOND_COMBINATION",COMBINATION_MOVE_OUT:"COMBINATION_MOVE_OUT",DISTRIBUTION:"DISTRIBUTION",FLIP:"FLIP",GRID:"GRID",SNAP_SIZE:"SNAP_SIZE",GRIDTYPE:"GRIDTYPE",LOCKED:"LOCKED",LOCKED_CANCEL:"LOCKED_CANCEL",OFFSET:"OFFSET",PACKAGE_EDIT_IN_PCB:"PACKAGE_EDIT_IN_PCB",PACKAGE_EDIT:"PACKAGE_EDIT",PACKAGE_REPLACE:"PACKAGE_REPLACE",RECOVER_FOOTPRINT:"RECOVER_FOOTPRINT",PACKAGE_ATTR:"PACKAGE_ATTR",UPDATE_COMPONENT:"UPDATE_COMPONENT",DEVICE_EDIT:"DEVICE_EDIT",SYMBOL_UPDATE:"SYMBOL_UPDATE",SYMBOL_EDIT:"SYMBOL_EDIT",SYMBOL_REPLACE:"SYMBOL_REPLACE",ALL:"ALL",PRIMITIV_COMPONENT:"PRIMITIV_COMPONENT",PRIMITIV_DEVICE_ATTR:"PRIMITIV_DEVICE_ATTR",PRIMITIV_PAD:"PRIMITIV_PAD",PRIMITIV_TRACK:"PRIMITIV_TRACK",PRIMITIV_PADPAIR:"PRIMITIV_PADPAIR",PRIMITIV_VIA:"PRIMITIV_VIA",PRIMITIV_SUTUREVIA:"PRIMITIV_SUTUREVIA",PRIMITIV_2DLINE:"PRIMITIV_2DLINE",PRIMITIV_ALL:"PRIMITIV_ALL",PRIMITIV_BOARD:"PRIMITIV_BOARD",PRIMITIV_SLOT:"PRIMITIV_SLOT",PRIMITIV_POUR:"PRIMITIV_POUR",Default:"Default","Only Component":"Only Component","Only Component Attribute":"Only Component Attribute","Only Track":"Only Track","Only Via":"Only Via","Only Pad Pair":"Only Pad Pair","Only Net":"Only Net","Only Group":"Only Group","Only Pad":"Only Pad","Only Line":"Only Line",PLACE_BURIEDHOLE:"PLACE_BURIEDHOLE",PAD_NUMBER:"PAD_NUMBER",ROTATE:"ROTATE",SETUP_WINDOWINGAREA:"SETUP_WINDOWINGAREA",STRETCHING_PUSHAWAY:"STRETCHING_PUSHAWAY",SINGlE_ROUTE:"SINGlE_ROUTE",CHANGETRACK:"CHANGETRACK",TURNOVER:"TURNOVER",GAP_STEP_VALUE:"GAP_STEP_VALUE",DIFFERENTIAL_PAIR_LENGTH_TOLERANCE_RULE_SETTING:"DIFFERENTIAL_PAIR_LENGTH_TOLERANCE_RULE_SETTING",VIA_SIZE:"VIA_SIZE",VIA_SIZE_FOLLOWRULES:"VIA_SIZE_FOLLOWRULES",VIA_SIZE_RULESSETTING:"VIA_SIZE_RULESSETTING",VIA_SIZE_COMMONLY_SETTING:"VIA_SIZE_COMMONLY_SETTING",VIA_TYPE:"VIA_TYPE",VIA_TYPE_THROUGH_VIA:"VIA_TYPE_THROUGH_VIA",VIA_TYPE_RULESSETTING:"VIA_TYPE_RULESSETTING",HIDE_SELECTED_COPPER_FILLS:"HIDE_SELECTED_COPPER_FILLS",SHOW_SELECTED_COPPER_FILLS:"SHOW_SELECTED_COPPER_FILLS",REBUILD_SELECTED:"REBUILD_SELECTED",COPPER_MANAGER:"COPPER_MANAGER",WIRING_AUTO:"WIRING_AUTO",WIRING_AUTO_CONNECT:"WIRING_AUTO_CONNECT",WIRING_AUTO_NET:"WIRING_AUTO_NET",WIRING_AUTO_ALL:"WIRING_AUTO_ALL",WIRING_CLEAR:"WIRING_CLEAR",WIRING_CLEAR_CONNECT:"WIRING_CLEAR_CONNECT",WIRING_CLEAR_NET:"WIRING_CLEAR_NET",WIRING_CLEAR_ALL:"WIRING_CLEAR_ALL",WIRING_CORNER_LINE45:"WIRING_CORNER_LINE45",WIRING_CORNER_LINE90:"WIRING_CORNER_LINE90",WIRING_CORNER_ARC90:"WIRING_CORNER_ARC90",WIRING_CORNER_ARC45:"WIRING_CORNER_ARC45",WIRING_CORNER_ARC:"WIRING_CORNER_ARC",WIRING_CORNER_FREEANGLE:"WIRING_CORNER_FREEANGLE",WIRING_MODE_PUSHAWAY:"WIRING_MODE_PUSHAWAY",WIRING_MODE_SURROUND_AND_PUSHAWAY:"WIRING_MODE_SURROUND_AND_PUSHAWAY",WIRING_MODE_SURROUND:"WIRING_MODE_SURROUND",WIRING_MODE_OBSTRUCT:"WIRING_MODE_OBSTRUCT",WIRING_MODE_IGNORE:"WIRING_MODE_IGNORE",WIRING_WIDTH:"WIRING_WIDTH",WIRING_WIDTH_FOLLOWRULES:"WIRING_WIDTH_FOLLOWRULES",WIRING_WIDTH_RULESSETTING:"WIRING_WIDTH_RULESSETTING",WIRING_WIDTH_COMMONLY_SSETTING:"WIRING_WIDTH_COMMONLY_SSETTING",WIDTH:"WIDTH",AUTO_TRIM_SILKSCREEN:"AUTO_TRIM_SILKSCREEN",MORE:"MORE",TABLE_SETTING:"TABLE_SETTING",ADSORBENT_CONFIG:"ADSORBENT_CONFIG",FILTER:"FILTER",DISPLAY:"DISPLAY",LOOKUP:"LOOKUP",SELECT_PARENT:"SELECT_PARENT",PLACETRANSFER:"PLACETRANSFER",RENUMBER:"RENUMBER",REFRESH:"REFRESH",SELECT:"SELECT",MOVE:"MOVE",MOVE_SEQUENTIAL:"MOVE_SEQUENTIAL",UNROUTE_ATTACHED_SEGMENTS:"UNROUTE_ATTACHED_SEGMENTS",UNROUTE_CONNECTIONS:"UNROUTE_CONNECTIONS",DETACHING_WIRES_FROM_DEVICES:"DETACHING_WIRES_FROM_DEVICES",UNROUTE_COMPONENT_CONNECTIONS:"UNROUTE_COMPONENT_CONNECTIONS",ATTRIBUTE:"ATTRIBUTE",NET:"NET",DEVICE:"DEVICE",SELECTED_ELEMENT:"SELECTED_ELEMENT",SELECTOVERLAP:"SELECTOVERLAP",CONNECT:"CONNECT",NET_COLOR:"NET_COLOR",INSERT_NODE:"INSERT_NODE",EDIT_BOUNDARY:"EDIT_BOUNDARY",GENERATE_D3_SHELL_OUTLINE:"GENERATE_D3_SHELL_OUTLINE",FORMAT_BRUSH:"FORMAT_BRUSH",DIVISION:"DIVISION",REPLACE_LAYER:"REPLACE_LAYER",REMOVE_LOOP:"REMOVE_LOOP",SELECT_NET:"SELECT_NET",ADD_NODE:"ADD_NODE",EDIT_NODE:"EDIT_NODE",MOVE_NODE:"MOVE_NODE",DELETE_NODE:"DELETE_NODE",COMMENT:"COMMENT",EXPAND:"EXPAND",MERGE_AS_CLOSED_OBJECT:"MERGE_AS_CLOSED_OBJECT",DISPERSED_AS_INDEPENDENT_LIEN:"DISPERSED_AS_INDEPENDENT_LIEN",MERGE_PADS:"MERGE_PADS",ONLY_SELECT:"ONLY_SELECT",CURRENT_PCB:"CURRENT_PCB",ALL_PROJECT:"ALL_PROJECT",OPTIMIZA_NONE:"OPTIMIZA_NONE",OPTIMIZA_WEAK:"OPTIMIZA_WEAK",OPTIMIZA_STRONG:"OPTIMIZA_STRONG",OPTIMIZATION:"OPTIMIZATION","opensubmenu-convertTo":"CONVERT_TO","opensubmenu-boardshape":"opensubmenu-boardshape",convertToBoard:"convertToBoard",convertToLineFromBoard:"convertToLineFromBoard"};var Hpe=class{constructor(){this.gridSetting=new Gpe;this.zoomType="roller";this.showUpdateBox=!1;this.dragMiddleMouseButton="moveCanvas";this.symbolLibManageMode="1";this.isPlaceViasAutoShove=!1;this.changeRepairLineTool=!0;this.init=!1;this.gridConfig=[],this.polarConfig=[],this.trackConfig=[],this.viaConfig=[],this.fontConfig=new Dpe(3),this.pcbConfig=new Npe,this.themeConfig=new kpe,this.attributeConfig=new Bpe,this.adsorptionConfig=new Fpe,this.hightShowConfig=new khe,this.isAssociationPCBCanvasGridAndSnap=0,this.isAssociationPCBCanvasGridType=0,A.subscribe("updateSystemConfig",this.updatePreferences.bind(this),Q()),A.subscribe("updateSystemConfig2",this.updatePreferences2.bind(this),Q()),A.subscribe("updateAssociationPCBCanvasGridAndSnap",this.setAssociationPCBCanvasGridAndSnap.bind(this),Q()),A.subscribe("updateAssociationPCBCanvasGridType",this.setAssociationPCBCanvasGridType.bind(this),Q()),A.subscribe("GridSetting",this.gridSetting.gridSetting.bind(this),Q()),A.subscribe("SnapSizeSetting",this.snapSizeSetting.bind(this),Q()),A.subscribe("PolarGridSetting",this.gridSetting.polarSetting.bind(this),Q()),A.subscribe("updatePcbLayerByTheme",this.updatePcbLayerByTheme.bind(this),Q()),A.subscribe("changeRepairLineTool",()=>{this.changeRepairLineTool=!1},Q())}getData(t,e){return t[e]!=null&&t[e].commonlyList!=null?t[e].commonlyList:null}updatePreferences(t){let e;R.getInstance().isactive&&!R.getInstance().isPreview&&(e=X4()),this.updateSystemConfig(t.commSystemSetting,R.getInstance().isPreview),e&&this.uploadPreference(e,X4()),A.publish("flushSelectingInfo","")}uploadPreference(t,e){let r=!1;for(let i in t)if(t[i]!=e[i]){r=!0;break}r&&wi()}updatePreferences2(t){let{tabId:e,data:r}=t;R.getInstance().id===e&&(this.updateSystemConfig(r.commSystemSetting,R.getInstance().isPreview),A.publish("flushSelectingInfo",""))}snapSizeSetting(t){let e=qS(),r=new dt,i=t.snapX.replace(/^[-+.\d\s]+/,""),n=t.snapX.replace(/[^-+.\d\s]+$/,""),s=r.conversion(i,"mil",parseFloat(n)/10),a=t.snapY.replace(/^[-+.\d\s]+/,""),l=t.snapY.replace(/[^-+.\d\s]+$/,""),c=r.conversion(a,"mil",parseFloat(l)/10);It.getInstance().setSnapX(s),It.getInstance().setSnapY(c),!t.isTriggerByGridSizeSetting&&le.getAssociationPCBCanvasGridAndSnap()===1&&(It.getInstance().setGridX(s*e.xRatio),It.getInstance().setGridY(c*e.yRatio)),np(),A.publish("flushSelectingInfo","")}getAssociationPCBCanvasGridAndSnap(){return this.isAssociationPCBCanvasGridAndSnap}setAssociationPCBCanvasGridAndSnap(t){this.isAssociationPCBCanvasGridAndSnap=t}getAssociationPCBCanvasGridType(){return this.isAssociationPCBCanvasGridType}setAssociationPCBCanvasGridType(t){this.isAssociationPCBCanvasGridType=t}updateHotkeyForSilkPreview(){let t={Edit:[{cmdEditDisable:!0,funcE:"Delete - Selected",hotkey:"Delete",hotkeyCmd:"Delete",range:[10,2,3,6,4,5],scene:[2]}]};this.updateHotkey(t,{})}updateSystemConfig(t,e){if(t){if(this.getData(t,"PCB_COMM_GRID_SIZE")&&!e){let r=this.getData(t,"PCB_COMM_GRID_SIZE");this.updateGridConfig(r.value),this.updatePolarConfig(r.value2Polar)}if(this.getData(t,"PCB_COMM_TRACK_WIDTH")&&!e&&this.updateTrackConfig(this.getData(t,"PCB_COMM_TRACK_WIDTH")),this.getData(t,"PCB_COMM_VIA_SIZE")&&!e&&this.updateViaConfig(this.getData(t,"PCB_COMM_VIA_SIZE")),this.getData(t,"COMM_TYPEFACE")&&!e&&this.updateFontConfig(this.getData(t,"COMM_TYPEFACE")),t.PCB_FOOTPRINT!=null&&this.updatePcbConfig(t.PCB_FOOTPRINT,e),t.PCB_SHOW&&!e&&this.updateShowConfig(t.PCB_SHOW),t.PCB_THEME&&wke(t.PCB_THEME)&&this.updateTheme(t.PCB_THEME),t.PCB_SHOW&&this.updateSelectAlpha(t.PCB_SHOW.selectAlpha),t.SYSTEM!=null&&(this.zoomType=t.SYSTEM.canvasZoomType,this.showUpdateBox=t.SYSTEM.isShowSymbol,this.dragMiddleMouseButton=t.SYSTEM.dragMiddleMouseButton,this.symbolLibManageMode=RYe(t.SYSTEM.symbolLibManage),this.systemAutoPanning=t.SYSTEM.autoPanning||null),t.HOTKEY!=null){let r=t.HOTKEY.menuHotkey||{},i=Ss(t.HOTKEY.menuHotkeyCfg)||{};Hn(r,(s,a)=>{i[s]&&Hn(["hotkey"],(c,h)=>{i[s][h]=a[h]})});let n=t.HOTKEY.active;typeof n=="string"&&n!=="custom"&&t.HOTKEY.hotkeyCfg[n]?this.updateHotkey(t.HOTKEY.hotkeyCfg[n],i):this.updateHotkey(t.HOTKEY.hotkey,i)}t.PROPERTY!=null&&!e&&this.updateProperty(t.PROPERTY.property),t.ADSORPTION!=null&&!e&&this.updateAdsorption(t.ADSORPTION),A.publish("updateFrame","")}}updatePcbLayerByThemeCall(t){this.updatePcbLayerByTheme(t)}updatePcbLayerByTheme(t){if(!R.getInstance().isactive||R.getInstance().isPreview)return;let e=t!=null&&t.canvasColorTheme?t.canvasColorTheme:this.themeConfig.canvasLayerTheme,r=t!=null&&t.canvasColorThemeSelected?t.canvasColorThemeSelected:this.themeConfig.canvasLayerThemeSelected,i;if(t.applyTheme){let n=[];for(let s of t.applyTheme){let a=Pe.getLayer(+s.layerId),l={layerId:a.layerID,layerType:a.type,layerName:a.name,status:a.status,activeColor:s.activeColor,activeColorAlpha:s.activeColorAlpha,deactiveColor:s.deactiveColor,deactiveColorAlpha:s.deactiveColorAlpha};n.push(l)}i=[{name:t.canvasColorThemeSelected,list:n}]}else i=e==null?void 0:e.filter((n,s)=>n.name==r);Array.isArray(i)&&i.length>0&&(t$.updateLayerWithPCB(i[0].list,"SYSTEMMGR_PCB_THEME",!0),QI(!0),Ns.getInstance().refreshRender(),A.publish("updateFrame",""),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()))}updateAdsorption(t){let e=t["Snapping Key"],r=t["Snap Distance Key"];this.adsorptionConfig.setConfig({[e.id]:e.options.value}),this.adsorptionConfig.setConfig({[r.id]:{number:r.options.value,unit:r.options.unit}});let i=t.Common.options,n=t["Layout/Route"].options,s=t["Outline Object"].options;for(let a of i.concat(n,s)){let{id:l,checked:c}=a;this.adsorptionConfig.setConfig({[l]:c})}}updateProperty(t){if(this.attributeConfig.restore(),t!=null&&t!=""){let e=JSON.parse(t);Object.values(e).forEach(r=>{if(r!=null){let i=!1,n=!1,s=r.showStatus;s!=null&&s.split(",").forEach(l=>{l==="All"?(i=!0,n=!0):l==="PCB(Name)"?i=!0:l==="PCB(Value)"?n=!0:l==="PCB(Name|Value)"&&(i=!0,n=!0)}),this.attributeConfig.add(r.property,r.object,i,n)}})}}updateHotkey(t,e){if(t==null)return;let r={},i={};Hn(e,(n,s)=>{if(s.hotkeyCmd){i[s.hotkeyCmd]={value:s,menuHotkeyCmd:n};return}let a=UXe[n];a&&(r[a]={value:s,menuHotkeyCmd:n})}),tr.restore(),Xq.restore(),KM.restore();for(let n in t)t[n].forEach(a=>{let l=a.hotkeyCmd,c=this.fixCtrl(a.hotkey),h=Wue(l),u=a.publishName,d="",p="";if(i[l]&&(d=i[l].value.hotkey||"",p=i[l].menuHotkeyCmd),h!=null){let m=a.range,g=a.scene;for(let y of g)for(let b of m)u?Xq.modify(y,b,c,h,l,d,p):tr.modify(y,b,c,h,l,d,p)}else{let m=a.command;if(m!=null){let g=a.hotkeyCmd,y=m.split("&lt;")[0];HXe.modify(g,y)}}});Hn(r,(n,s)=>{KM.addSubMenu(n,s.value.hotkey,s.menuHotkeyCmd)})}fixCtrl(t){return typeof t=="string"&&(A2?t=t.replace(/Ctrl/g,"Cmd"):(t=t.replace(/Control/g,"Ctrl"),t=t.replace(/Cmd/g,"Ctrl"),t=t.replace(/Control\+Cmd|Cmd\+Control/g,"Ctrl"))),t}updatePcbConfig(t,e){if(t!=null){if(e){this.pcbConfig.coreRenderingEngine=t.coreRenderingEngine;return}(this.pcbConfig.configGridType!=t.gridType||this.pcbConfig.configMultiGridType!=t.multiType||this.pcbConfig.configMultiRatio!=t.multiRatio)&&(this.pcbConfig.configGridType=t.gridType,this.pcbConfig.gridType=t.gridType,this.pcbConfig.configMultiGridType=t.multiType,this.pcbConfig.multiType=t.multiType,this.pcbConfig.configMultiRatio=t.multiRatio,this.pcbConfig.multiRatio=t.multiRatio,R.getInstance().isactive&&A.publish("switchGridTypeBtn",t.gridType,Q())),this.pcbConfig.crossCursor=t.cursorSize,this.pcbConfig.drcErrorStyle=t.drcErrorStyle||"1",this.pcbConfig.displayComponentSpacing=t.displayComponentSpacing,this.pcbConfig.drcErrorZoom=t.drcErrorZoom||"followObjectScaling",this.pcbConfig.graphicEffectMode=t.graphicEffectMode,this.pcbConfig.coreRenderingEngine=t.coreRenderingEngine,this.pcbConfig.UNIT=t.newDocUint,this.pcbConfig.FOOTPRINT_UNIT=t.newFootprintDocUint,this.pcbConfig.altGridSize=t.altGridSize,this.pcbConfig.rotate=t.rotateSteppingAngle,this.pcbConfig.clickTrackSelect=t.clickTrackSelect,this.pcbConfig.showRuler=t.isShowRuler,this.pcbConfig.isRebuildCopperAuto=t.isRebuildCopperAuto,this.pcbConfig.allowFootprintFlipping=t.allowFootprintFlipping,this.pcbConfig.padShowNet=t.isShowNetInPad,this.pcbConfig.padShowNum=t.isShowNumberInPad,this.pcbConfig.trackShowNet=t.isShowNetInTrack,this.pcbConfig.viaShowLayerPair=t.isShowViaLayerPair,this.pcbConfig.viaShowNet=t.isShowNetInVia,this.pcbConfig.showDiffLength=t.isShowDiffLength,this.pcbConfig.showNetLength=t.isShowNetLength,this.pcbConfig.placeBlind=t.isPriorityViaToggleLayerRouting,this.pcbConfig.autoLoopUpMsgBox=t.selectLoopWindowRemovingLoop,this.pcbConfig.trackFollowComponent=t.isAutoFollowComponent,this.pcbConfig.rotateWhole=t.rotateWhole,this.pcbConfig.moveComponent=t.moveComponet,this.pcbConfig.autoChamfer2DLine=t.autoChamfer2DLine,this.pcbConfig.autoChamferTrack=t.autoChamferTrack,this.setFilletRadius(t),this.init||(this.pcbConfig.startTrackWidth=t.startTrackWidth,this.pcbConfig.startViaSize=t.startViaSize,this.init=!0),this.pcbConfig.showCrossCursor=t.isAlwaysShowCrossCursor,this.pcbConfig.checkNetBeforeGerber=t.isCheckNetBeforeGerber,this.pcbConfig.checkDrcBeforeGerber=t.isCheckDrcBeforeGerber,this.pcbConfig.trackFollow=t.trackFollow,this.pcbConfig.trackFollowVia=t.trackFollowVia,this.pcbConfig.autoTerminateRouting=t.autoTerminateRouting,this.pcbConfig.isUsedJLCColorSilk=t.isUsedJLCColorSilk,this.pcbConfig.isAutoGenerate3dModel=t.isAutoGenerate3dModel,this.pcbConfig.isPlaceViasAutoShove=t.isPlaceViasAutoShove,this.pcbConfig.isAutoMoveCanvasDuringCrossProbe=t.isAutoMoveCanvasDuringCrossProbe,this.pcbConfig.isAutoFitSelectionDuringCrossProbe=t.isAutoFitSelectionDuringCrossProbe,this.pcbConfig.isOtherObjectsDimDuringCrossProbe=t.isOtherObjectsDimDuringCrossProbe,this.pcbConfig.isCtrlDragToCopy=t.isCtrlDragToCopy,this.pcbConfig.snapToCenterWhileDragPadOrVia=t.snapToCenterWhileDragPadOrVia,this.pcbConfig.snapToOriginWhileDragFootprint=t.snapToOriginWhileDragFootprint,this.pcbConfig.alignToNearComponentOrPadWhileDrag=t.alignToNearComponentOrPadWhileDrag,this.pcbConfig.isAssignNetForFreeTrack=t.isAssignNetForFreeTrack,this.pcbConfig.addTeardropAutomatically=t.addTeardropAutomatically,this.pcbConfig.isKeepRefdesPaste=t.isKeepRefdesPaste,this.pcbConfig.useDynamicInputBox=t.useDynamicInputBox,this.pcbConfig.displayProperty=t.displayObjectPropertyHoverObject,this.pcbConfig.highLightNet=t.highlightNetHoverNet,this.pcbConfig.highLight=t.highlightObjectHoverObject,this.pcbConfig.autoChangeLayerWhileRoutingVias=t.autoChangeLayerWhileRoutingVias,this.pcbConfig.dblclickPlaceViasWhileRouting=t.dblclickPlaceViasWhileRouting,this.pcbConfig.routeAutoFanoutEnd=t.routeAutoFanoutEnd,this.pcbConfig.wireConfirm=t.trackConfirm,this.pcbConfig.endDrawing=t.endDrawing,this.pcbConfig.addViaMethodWhileRoute=t.addViaMethodWhileRoute,this.pcbConfig.referencePointPcbSelectMethod=t.referencePointPcbSelectMethod,this.pcbConfig.defaultComponentFontTypeface=t.defaultComponentFontTypeface,this.setDefaultComponentFontStrokeWidthUnit(t),this.setDefaultComponentFontHeightUnit(t),this.pcbConfig.isInit=!1}}updateTheme(t){if(t==null)return;let e=t.canvasPrimitiveSetting;this.themeConfig.canvasTheme.updateAll(e),this.themeConfig.canvasLayerTheme=t.canvasColorTheme,this.themeConfig.canvasLayerThemeSelected=t.canvasColorThemeSelected}updateSelectAlpha(t){this.themeConfig.canvasTheme.updateSelectAlpha(t)}updateGridConfig(t){t!=null&&(this.gridConfig=t.map((e,r)=>this.getGridSize(r.toString(),e.accuracyGridXMil,e.accuracyGridXMm,e.accuracyGridYMil,e.accuracyGridYMm)))}updatePolarConfig(t){t!=null&&(this.polarConfig=t.map((e,r)=>this.getPolarSize(r.toString(),e.angle,e.mil,e.mm)))}updateTrackConfig(t){t!=null&&(this.trackConfig=t.map((e,r)=>this.getTrackSize(r.toString(),e.trackWidthMil,e.trackWidthMm)))}updateFontConfig(t){if(t==null)return;let e=t.map((r,i)=>this.getFontSize(i.toString(),r.title));this.fontConfig.clear();for(let r of e)this.fontConfig.addSize(r)}updateShowConfig(t){t!=null&&(this.hightShowConfig.hightType=t.hightType,this.hightShowConfig.dragDarked=t.dragDarked,this.hightShowConfig.tempHight=t.tempHight,A.publish("updateHightShow",""))}updateViaConfig(t){t!=null&&(this.viaConfig=t.map((e,r)=>this.getViaSize(r.toString(),e.insideDiameterMil,e.insideDiameterMm,e.outersideDiameterMil,e.outersideDiameterMm)))}getGridSize(t,e,r,i,n){return new wpe(t,e/10,i/10,r/10,n/10)}getPolarSize(t,e,r,i){return new Vpe(t,e,r/10,i/10)}getTrackSize(t,e,r){return new Lpe(t,e/10,r/10)}getViaSize(t,e,r,i,n){return new Mpe(t,e/20,r/20,i/20,n/20)}getFontSize(t,e){return new Upe(t,e)}getDragMiddleMouseButton(){return this.dragMiddleMouseButton}getSymbolLibManageMode(){return this.symbolLibManageMode}getDefaultFontSetting(){return{defaultComponentFontHeight:this.pcbConfig.defaultComponentFontHeight,defaultComponentFontStrokeWidth:this.pcbConfig.defaultComponentFontStrokeWidth,defaultComponentFontTypeface:this.pcbConfig.defaultComponentFontTypeface}}setDefaultComponentFontStrokeWidthUnit(t){let e=new dt,r=t.defaultComponentFontStrokeWidthUnit,i=+t.defaultComponentFontStrokeWidth;r!=="mil"&&(i=e.conversion("mm","mil",i)),this.pcbConfig.defaultComponentFontStrokeWidth=i/10}setDefaultComponentFontHeightUnit(t){let e=new dt,r=t.defaultComponentFontHeightUnit,i=+t.defaultComponentFontHeight;r!=="mil"&&(i=e.conversion("mm","mil",i)),this.pcbConfig.defaultComponentFontHeight=i/10}setFilletRadius(t){let e=new dt,r=t.filletRadiusUnit2DLine,i=+t.filletRadius2DLine;r!=="mil"&&(i=e.conversion("mm","mil",i)),this.pcbConfig.filletRadius2DLine=i/10;let n=t.filletRadiusUnitTrack,s=+t.filletRadiusTrack;n!=="mil"&&(s=e.conversion("mm","mil",s)),this.pcbConfig.filletRadiusTrack=s/10}getSystemAutoPanning(){return this.systemAutoPanning}};var Wpe=class extends bi{constructor(t){super(),this.option=t}open(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e={};return e.action="absolute-offset",this.option!=null&&(e.extra=this.option),e}modify(t){}close(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;if(t.action=="confirm"){let r=ze.getSelects();if(r.length==0)return;let i=R.getInstance().unit,n=new S(na(t.offsetXY.offsetX,i,"pixel"),na(t.offsetXY.offsetY,i,"pixel"));Is.getInstance().init(r,"relative offset",(s,a)=>{_d.init(s,a,async(l,c)=>{if(new Zy(c,{movePadItSelf:!_d.moveWhole,saveHistory:!1}).execute(l,n),!_d.moveWhole){let u=new Set;l.forEach(p=>{if(p instanceof Le){let m=p.getParent();m instanceof ke&&u.add(m)}});let d=new Array;for(let p of u){c.addCommand4Item(p,"modify");let g=new ff().updateCustomFootprint(p,c.getCommand(),l.filter(y=>y.getParent()==p));d.push(g)}await Promise.all(d)}c.execute(),setTimeout(()=>{A.publish("selecting",{items:l}),A.publish("flushService","")},0),gr.refresh()})})}return!0}};function YRt(o){switch(o){case"top":return 4;case"bottom":return 6;case"left":return 2;case"right":return 8;case"center":return 5;case"lefttop":return 1;case"leftbottom":return 3;case"righttop":return 7;case"rightbottom":return 9;default:return 3}}var nU=class extends bi{constructor(e){super();this.components=new Array;this.components=e,ze.arrtDialog=this}open(e){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let r=new Array,i=new Array,n=new Set,s=new Set,a=[],l=new Set(Array.from(ze.getSelects()));for(let u of this.components){u.numShape!=null&&(u.numShape.showKey||u.numShape.showValue)&&(n.add(u.numShape.key),l.has(u)&&s.add(u.numShape.key)),u.idShape!=null&&(u.idShape.showKey||u.idShape.showValue)&&(n.add(u.idShape.key),l.has(u)&&s.add(u.idShape.key)),u.deviceShape!=null&&(u.deviceShape.showKey||u.deviceShape.showValue)&&(n.add(u.deviceShape.key),l.has(u)&&s.add(u.deviceShape.key));for(let d of u.attributes)(d.showKey||d.showValue)&&(n.add(d.key),l.has(u)&&s.add(d.key));l.has(u)&&u.attrsObject&&a.push(this.getDesignatorRelativePostion(u,u.attrsObject.Designator))}for(let u of n)r.push({title:u,value:u,_selected:!0});for(let u of s)i.push({title:u,value:u,_selected:!0});let c=Array.from(new Set(a));return{action:"set-attr-text-position",allItemsAttrList:r,selectedItemsAttrList:i,extra:{designatorRelativePostion:c[0]}}}modify(e){let r=e.radio;r==="allItems"?this.components=Ar.getAllItem():r==="selectedItems"&&(this.components=ze.getComponents()),e.action=="apply"&&this.comment(e)}comment(e){let r={};for(let c of this.components)for(let h of c.attributes)if(h.showKey||h.showValue){let u=r[h.key];u==null&&(u=new Array,r[h.key]=u),u.push(h)}let i=e["property-value"],n=e["text-position"],s=YRt(n),a=r[i],l=new De("batch modify attribute position");if(a!=null)for(let c of a){l.addCommand(Ce.dispatch(c,"modify"));let h=c.getParent();h instanceof ke&&h.modifyAttrPosition(c,s)}l.length>0&&qe.executeCommand(l)}close(e){return!R.getInstance().isactive||23==R.getInstance().doctype?void 0:(e.action=="confirm"&&(this.modify(e),this.comment(e),this.components=new Array,A.publish("updateFrame",""),A.publish("updateRtree",""),ze.arrtDialog=null),!0)}update(){let e=ze.getSelects(),r=e.length>0,i=new Set,n=new Set,s=[],a=new Set(e);for(let h of this.components){h.numShape!=null&&(h.numShape.showKey||h.numShape.showValue)&&(i.add(h.numShape.key),a.has(h)&&n.add(h.numShape.key)),h.idShape!=null&&(h.idShape.showKey||h.idShape.showValue)&&(i.add(h.idShape.key),a.has(h)&&n.add(h.idShape.key)),h.deviceShape!=null&&(h.deviceShape.showKey||h.deviceShape.showValue)&&(i.add(h.deviceShape.key),a.has(h)&&n.add(h.deviceShape.key));for(let u of h.attributes)(u.showKey||u.showValue)&&(i.add(u.key),a.has(h)&&n.add(u.key));a.has(h)&&h.attrsObject&&s.push(this.getDesignatorRelativePostion(h,h.attrsObject.Designator))}let l=Array.from(i).map(h=>({title:h,value:h,_selected:!0})),c=Array.from(n).map(h=>({title:h,value:h,_selected:!0}));A.publish("pcbAttrUpdate",{action:"set-attr-text-position",hasSelection:r,selectionCount:e.length,allItemsAttrList:l,selectedItemsAttrList:c,extra:{designatorRelativePostion:s[0]||"center"}},f0())}getDesignatorRelativePostion(e,r){if(!r)return"center";let i=gn(e.model.bbox.minX,4),n=gn(e.model.bbox.minY,4),s=gn(e.model.bbox.maxX,4),a=gn(e.model.bbox.maxY,4),l=gn(r.model.box.center.x,4),c=gn(r.model.box.center.y,4);if(l>=i&&l<=s)return c>a?"top":c<n?"bottom":"center";if(l>s)return c>a?"righttop":c<n?"rightbottom":"right";if(l<i)return c>a?"lefttop":c<n?"leftbottom":"left"}};var zpe=class zpe{constructor(){this.dialogIds=new Set;A.subscribe("refershDialog",()=>{for(let t of this.dialogIds)A.publish("pcbdialogModify",{dialogId:t})})}static getService(){return this.instance==null&&(this.instance=new zpe),this.instance}};zpe.instance=null;var YD=zpe;var Ype=class extends bi{constructor(t){super(),this.dialogType="pcb-copper-manager"}open(t){if(!R.getInstance().isactive||R.getInstance().doctype!=3)return;YD.getService().dialogIds.add(this.id);let e=Pe.getSignalLayerOptions(!1);return{action:"copper-manager",table:this.getLayerList(),netList:Ye.getNet(),layerList:e}}modify(t){var e;if(!(!R.getInstance().isactive||R.getInstance().doctype!=3))switch(t.action){case"apply":this.syncCopperOrderData(t);break;case"refreshCopperMangerDialog":A.publish("refreshCopperMangerDialog",{action:this.dialogType,data:t.data},Q());break;case"modifyCopperMangerDialogParams":if(((e=t==null?void 0:t.data)==null?void 0:e.length)>0)A.publish("modifyCopperMangerDialogParams",{action:"modify",data:t.data},Q());else{let r=Pe.getSignalLayerOptions(!1),i={table:this.getLayerList(),netList:Ye.getNet(),layerList:r};A.publish("modifyCopperMangerDialogParams",{action:this.dialogType,data:i},Q())}break;case"saveAndCloseCopperDialog":A.publish("saveAndCloseCopperDialog",{action:this.dialogType,data:{open:!0}},Q());break}}close(t){return!R.getInstance().isactive||R.getInstance().doctype!=3?void 0:(YD.getService().dialogIds.delete(this.id),t.action=="confirm"&&this.syncCopperOrderData(t),!0)}command(t){if(!R.getInstance().isactive||R.getInstance().doctype!=3)return!1;if(t.action=="callDesignRulesDialog"){let e={activeMenu:"Copper Zone"};if(t.data){let r,i=n=>{if(n.type=="Copper Region"&&t.data==n.globalIndex){let s=re.getInstance().getRegion(n.globalIndex),a=s&&s.copperPlane?"2":"1";r=this.getCopperRule(a,n.net,n.globalIndex).name}};this.curryFun(i)(),r&&(e.activeMenu="Safe Spacing",e.activeMenuName=r)}A.publish("openMainDialog",{cmd:5,data:{option:e}})}else if(t.action=="highLightSelectPour"){let e=[],r=i=>{i.type=="Copper Region"&&t.data.includes(i.globalIndex)&&e.push(i)};this.curryFun(r)(),A.publish("onlySelect",e),A.publish("updateFrame","")}else if(t.action=="highLightPour"){let e=r=>{r.type=="Copper Region"&&r.globalIndex==t.data&&!r.isHighLight&&r.click(!0)};this.curryFun(e)(),A.publish("updateFrame","")}else if(t.action=="unHighLightPour"){let e=ze.getSelects().map(i=>i.globalIndex),r=i=>{i.type=="Copper Region"&&!e.includes(i.globalIndex)&&i.visible()};this.curryFun(r)(),A.publish("updateFrame","")}else if(t.action=="refreshPanelData"){let{id:e,value:r,type:i}=t.data,n=new De("Modify Panel"),s=new hi;s.addGroup(n);let a=h=>{if(h.type=="Copper Region"&&h.globalIndex==e)switch(i){case"name":s.addCommand4Item(h,"modify"),h.getComponent().name=r;break;case"layer":s.addCommand4Item(h,"modify");let u=h.layerId;h.layerId=r,un.changeModelLayer(h,u,s.getCommand()),h.clearCopper();break;case"net":s.addCommand4Item(h,"modify"),h.net=r;break}};this.curryFun(a)(),s.execute(),A.publish("updateFrame",""),A.publish("flushSelectingInfo","");let l=Pe.getSignalLayerOptions(!1),c={table:this.getLayerList(),netList:Ye.getNet(),layerList:l};A.publish("modifyCopperMangerDialogParams",{action:this.dialogType,data:c},Q())}else t.action=="deletedRow"?t.data.forEach(r=>{let i=r.id,s=new Jt().getItem(i);s!=null&&(s.remove(),A.publish("delete",s),A.publish("updateFrame",""))}):t.action=="rebuildSelected"?A.publish("rebuildSingleCopper",{ids:t.data,isLast:!1,isManual:!0}):t.action=="rebuildAll"&&(A.publish("rebuildCopper",{isManual:!0}),A.publish("rebuildPlane",{data:{id:[]},isManual:!0}));return!1}curryFun(t){return()=>{[].concat(Kt.getAllItem(),Xt.getAllItem(),pt.getAllItem()).forEach(e=>{t(e)})}}flatTableData(t){let e=[];return t.forEach(r=>r.forEach(i=>{i.layerName||(i.layer,e.push(i))})),e}syncCopperOrderData(t){let e=new De("modify copper property"),r=new Jt,i=this.flatTableData(Object.values(t.table));this.syncActualPourData(i,e);let n={};if(this.checkName(i)){i.forEach(s=>{let a=s.id,l=r.getItem(a);if(l instanceof He){let c=l.getComponent();if(c instanceof xn){let h=n[l.layerId];h||(h=n[l.layerId]=[]),h.push(l),c.name=s.name,l.net=s.net,l.layerId=parseInt(s.layer)}}});for(let s in n){let a=n[s],l=a[0].getComponent().order-1;for(let c of a){let h=c.getComponent();h.order>l||(e.addCommand(Ce.dispatch(c,"modify")),h.order=l+1),l=h.order}}return qe.executeCommand(e),A.publish("autoFill",""),!0}else return!1}checkName(t){let e=new Set;for(let r of t){if(r.name){if(e.has(r.name)){let i="The name already exists, please modify";return A.publish("openMsgbox",new l_(i)),!1}}else{let i="The name cannot be empty, please modify";return A.publish("openMsgbox",new l_(i)),!1}e.add(r.name)}return!0}syncActualPourData(t,e){let r=[].concat(Kt.getAllItem(),Xt.getAllItem(),pt.getAllItem()),i=t.map(s=>s.id),n=!1;r.forEach(s=>{if(s.type=="Copper Region"&&!i.includes(s.globalIndex)){n=!0;let a=Ce.dispatch(s,"delete");A.publish("hasModifyPcbItem",s),e.addCommand(a),gr.interrupt(),gr.model=3,s.remove(),A.publish("delete",s)}})}getLayerList(){let t=un.getOrders(),e=new Jt,r={},i=[];for(let s in t)i.push(...t[s].map(a=>a.globalIndex));if(Pe.getSignalLayerOptions(!1).forEach(s=>{let a=s.text;r[a]||(r[a]=[{layerName:a,id:"F"+a,FlayerId:Number(s.value),fixed:!0}])}),i.forEach(s=>{let a=e.getItem(s);if(a!=null&&a instanceof He){let l=a.getComponent();if(l instanceof xn){let c=Pe.getLayerName(a.layerId);r[c].push({name:l.name,layer:a.layerId,net:a.net,id:s,parentName:c,lcEnableDragSort:!0})}}}),r["Bottom Layer"]){let s=r["Bottom Layer"];delete r["Bottom Layer"],r["Bottom Layer"]=s}return r}getCopperRule(t,e,r){let i=re.getInstance(),n;switch(t){case"1":{let s=i.getNet(e);n=i.getSafeSpacing(s==null?void 0:s.safeSpacing);break}case"2":{let s=i.getRegion(r);s!=null&&(n=i.getSafeSpacing(s.safeClearance));break}}return n||(n=i.getDefaultSafeSpacing()),n}};var jpe=class extends bi{constructor(){super(...arguments);this.pcbList=[{title:"Track",value:"track",_isChecked:!1},{title:"Via",value:"via",_isChecked:!1},{title:"Suture Vias",value:"suture via",_isChecked:!1},{title:"Text",value:"text",_isChecked:!1},{title:"Device",value:"device",_isChecked:!1,disabled:Mt.isChildPcb()},{title:"Device Attribute",value:"attr",_isChecked:!1},{title:"Test Point",value:"testPoint",_isChecked:!1},{title:"FPC Stiffener",value:"fpcStiffener",_isChecked:!1},{title:"Pad",value:"pad",_isChecked:!1},{title:"Board Outline",value:"boardOutline",_isChecked:!1},{title:"Slot Region",value:"boardCutout",_isChecked:!1},{title:"Fill Region",value:"region",_isChecked:!1},{title:"Prohibited Region",value:"prohibit",_isChecked:!1},{title:"Constraint Region",value:"constraint",_isChecked:!1},{title:"Pour",value:"pour",_isChecked:!1},{title:"Line",value:"line",_isChecked:!1},{title:"Image",value:"image",_isChecked:!1},{title:"Colorful Image",value:"trueColorPicture",_isChecked:!1},{title:"Dimension",value:"dimension",_isChecked:!1},{title:"3D Shell - Outline",value:"3dShellOutline",_isChecked:!1},{title:"3D Shell - Screw Pillar",value:"3dShellScrewPillar",_isChecked:!1},{title:"3D Shell - Side Datum Line",value:"3dShellSideSlotDatumLine",_isChecked:!1},{title:"3D Shell - Side Slot Region",value:"3dShellSideSlotRegion",_isChecked:!1},{title:"3D Shell - Top/Bottom Slot Region",value:"3dShellTopSlotRegion",_isChecked:!1},{title:"3D Shell - Top/Bottom Entity",value:"3dShellTopBottomEntity",_isChecked:!1},{title:"3D Shell - Side Entity",value:"3dShellSlotEntity",_isChecked:!1},{title:"Teardrop",value:"teardrop",_isChecked:!1}];this.footprintList=[{title:"Text",value:"text",_isChecked:!1},{title:"Pad",value:"pad",_isChecked:!1},{title:"Via",value:"via",_isChecked:!1},{title:"Slot Region",value:"boardCutout",_isChecked:!1},{title:"Fill Region",value:"region",_isChecked:!1},{title:"Prohibited Region",value:"prohibit",_isChecked:!1},{title:"Line",value:"line",_isChecked:!1},{title:"Image",value:"image",_isChecked:!1},{title:"Dimension",value:"dimension",_isChecked:!1},{title:"Test Point",value:"testPoint",_isChecked:!1},{title:"FPC Stiffener",value:"fpcStiffener",_isChecked:!1}]}open(e){if(R.getInstance().doctype==3)return{action:"delete-target",list:this.pcbList};if(R.getInstance().doctype==4)return{action:"delete-target",list:this.footprintList}}modify(e){}close(e){return!R.getInstance().isactive||23==R.getInstance().doctype?void 0:(e.action=="confirm"&&A.publish("clearElements",e.data),!0)}};var r$=class extends bi{constructor(t,e){super(),this.dialogType="equal-length-tuning",this.option=t,this.tool=e}open(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let r=new Rg().getDesignRulers();return r.action="design-rules",this.option!=null&&(r.extra=this.option),r}modify(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;t.action=="apply"&&(new Rg().setDesignRulers(t),this.flush())}close(t){return!R.getInstance().isactive||23==R.getInstance().doctype?void 0:(t.action=="confirm"&&(new Rg().setDesignRulers(t),this.flush(),we.drawing?A.publish("refershDialog",""):(A.publish("tool","dropdrag"),ze.getSelects().length>0&&A.publish("flushSelectingInfo",""))),A.publish("pcbdialogModify",{dialogType:"pcb-batch-fanout"}),!0)}flush(){this.tool!=null&&(this.tool instanceof vo?this.tool.updateTrackWidth():(this.tool instanceof w1||this.tool instanceof U2)&&this.tool.updateViaRadius())}};function WXe(o){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let t=ze.getSelects();Is.getInstance().init(t,o.cmd,(e,r)=>{let i={distribute_horizontal_equidistant:{axis:"x",pos:I=>I.UL().x},distribute_vertical_equidistant:{axis:"y",pos:I=>I.UL().y},distribute_left_side_edge_equidistant:{axis:"x",pos:I=>I.minX},distribute_top_side_edge_equidistant:{axis:"y",pos:I=>I.maxY},distribute_horizontal_by_center_distance:{axis:"x",pos:I=>I.center().x},distribute_vertical_by_center_distance:{axis:"y",pos:I=>I.center().y},distribute_horizontal_by_edges_distance:{axis:"x",pos:I=>I.center().x},distribute_vertical_by_edges_distance:{axis:"y",pos:I=>I.center().y}},n=i[o.cmd].pos,s=i[o.cmd].axis,a=o.spacing,l=new _e,c=[],h=0,u=0,d=e.reduce((I,C)=>{let E=C.getGroupID();return E&&I.add(E),I},new Set),p=new Set,m=new Array;for(let I of d)Ht.getItem(I).getItems().every(O=>e.includes(O))?m.push(Ht.getItem(I)):p.add(I);for(let I of e){let C=I.getGroupID();C?p.has(C)&&(m.push(I),p.delete(C)):m.push(I)}for(let I of m){let C;I instanceof lr?C=YV(I):C=I.buildBBox(),c.push({item:I,pos:n(C),width:C.width(),height:C.height(),bbox:C}),h+=C.width(),u+=C.height(),l.ext1(C)}let g,y,b=[];if(["distribute_horizontal_by_center_distance","distribute_vertical_by_center_distance"].includes(o.cmd))b=c.sort((I,C)=>I.pos-C.pos),a==null?(a=(b[b.length-1].pos-b[0].pos)/(b.length-1),g=b[0].pos):g=l.build1().center()[s]-a*(b.length-1)/2,y=b.map((I,C)=>{let E=g+a*C-I.pos;return s=="x"?new S(E,0):new S(0,E)});else if(o.cmd=="distribute_horizontal_by_edges_distance"){let[I,C]=c.reduce((_,x)=>[_[0].bbox.minX>x.bbox.minX?x:_[0],_[1].bbox.maxX<x.bbox.maxX?x:_[1]],[c[0],c[0]]),E=c.filter(_=>_.item!=I.item&&_.item!=C.item).sort((_,x)=>_.pos-x.pos);b=[].concat([I],E,[C]),y=[new S(0,0)];let O=b[0].bbox.maxX;for(let _=1;_<b.length;_++)O+=a+b[_].width/2,y.push(new S(O-b[_].pos,0)),O+=b[_].width/2}else if(o.cmd=="distribute_vertical_by_edges_distance"){let[I,C]=c.reduce((_,x)=>[_[0].bbox.minY>x.bbox.minY?x:_[0],_[1].bbox.maxY<x.bbox.maxY?x:_[1]],[c[0],c[0]]),E=c.filter(_=>_.item!=C.item&&_.item!=I.item).sort((_,x)=>_.pos-x.pos);b=[].concat([I],E,[C]),y=[new S(0,0)];let O=b[0].bbox.maxY;for(let _=1;_<b.length;_++)O+=a+b[_].height/2,y.push(new S(0,O-b[_].pos)),O+=b[_].height/2}else{b=c.sort((C,E)=>s=="x"?C.pos-E.pos:E.pos-C.pos),a==null&&(s=="x"?a=(l.build1().width()-h)/(b.length-1):a=(l.build1().height()-u)/(b.length-1)),g=l.build1().UL()[s];let I=0;y=b.map((C,E)=>{if(s=="x"){let O=g+a*E+I-C.pos;return I+=C.width,new S(O,0)}else if(s=="y"){let O=g-a*E+I-C.pos;return I-=C.height,new S(0,O)}})}let P=b.map(I=>I.item);new Zy(r).execute(P,y)})}var Xpe=class extends bi{constructor(t){super(),this.option=t}open(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e={};return e.action="distribute-spacing",this.option!=null&&(e.extra=this.option),e}modify(t){}close(t){return!R.getInstance().isactive||23==R.getInstance().doctype?void 0:(t.action=="confirm"&&WXe(t),!0)}};var qpe=class extends bi{constructor(t){super();for(let e in t.attrConfig){let r=t.attrConfig[e];r.globalIndex&&delete r.globalIndex}this.option=t}open(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e={};return e.action="find-objects",this.option!=null&&(e.extra=this.option),e}modify(t){return!R.getInstance().isactive||23==R.getInstance().doctype?void 0:(t.action=="apply"&&A.publish("showFindItemInBottomBar",{data:lce.objMatched(t.objType,t.strMode,t.conditions,t.componentPropertyType,t.objRange),selectFirstRow:t.selectFirstRow},Q()),!0)}close(t){}};var $pe=class extends kl{constructor(){super(...arguments);this.component=null}set(e){return this.component=e,this}getHtmlData(e){let r={};r.footprintName=e.footprintId;let i=new Array;for(let n of e.getItems())n instanceof _i&&i.push({text:n.num,value:n.num});return r.footprintList=i,r}getPadsData(e){let r=e.getItems(),i=new HI,n=new Array;for(let s of r)if(s instanceof _i){let a=i.getHtmlData(s);n.push(a.getAttrList()),i.clearCache()}return n}getFootprintNumber(e){let i=Hi.getItem(e.footprintUUID).getComponents();return i!=null?i.length:0}modifyBy(e,r){}};var Kpe=class extends bi{constructor(t){super(),this.component=t}open(t){let e=new $pe,r={};r.primitive=["PAD"],r.unit=R.getInstance().unit,r.doctype=R.getInstance().doctype,r.tabid=R.getInstance().tabId,r.quantity=e.getFootprintNumber(this.component);let i={},n="footprintData";i[n]=e.getHtmlData(this.component),i.panelData=e.getPadsData(this.component);let s={head:r,body:i};return s.action="attribute-for-footprint-pad",s}modify(t){}close(t){}};var Zpe=class extends bi{open(t){return{action:"global-cmd"}}modify(t){}close(t){return!R.getInstance().isactive||23==R.getInstance().doctype?void 0:(t.action=="confirm"&&A.publish("globalCommand",t["global-cmd"]),!0)}};var Jpe=class extends bi{constructor(t){super(),this.data=t}open(t){return{action:"insert-image-file",data:this.data}}modify(t){}close(t){if(!t)return;let{action:e,type:r}=t;if(e=="confirm")switch(r){case"Image":{let i=t.pathDataString;if(i.path==""||i.path==null){let n=new l_("Please select a picture");A.publish("openMsgbox",n)}else A.publish("DrawImage",i);break}case"TrueColorPicture":{let{dataUrl:i,width:n,height:s,unit:a,fileName:l}=t,c=R.getInstance().compiler.uploadBlob(l,i);if(c.success){let h=c.hash,u={dataUrl:i,width:n,height:s,unit:a,hashId:h};if(qd.getItem(h))A.publish("DrawTrueColorPicture",u);else{let p=new Image;p.src=i,p.onload=()=>{qd.addTemplate(h,l,p),A.publish("DrawTrueColorPicture",u)}}}else A.publish("ui/toastMsg",{type:"warn",msg:"Import failed!"},Q());break}}return!0}};async function Qpe(o){let t=new Jt,e=Object.keys(o),r=e.map(a=>t.getItem(a)).filter(a=>!a.isEmpty),i=new De("Remove unused pad"),n=new Set;for(let a of r){let l=o[a.globalIndex]||[];if(l.toString()!=a.unusedInnerLayers.toString()){i.addCommand(Ce.dispatch(a,"modify")),A.publish("hasModifyPcbItem",a),a.unusedInnerLayers=l;let c=a.getParent();c instanceof ke&&n.add(c)}}async function s(a){i.addCommand(Ce.dispatch(a,"modify")),await new ff().updateCustomFootprint(a,i,r.filter(c=>c.getParent()==a))}for(let a of n){let l=!0;for(let c of a.getPads())if(c.unusedInnerLayers.length!=0){l=!1;break}if(l){for(let c of a.getVias())if(c.unusedInnerLayers.length!=0){l=!1;break}}l?await jRt(a,i,e)||await s(a):await s(a)}return n.clear(),i}async function jRt(o,t,e){let r=Hi.getItem(o.footprintUUID);if(r instanceof Sc){let i=Hi.getItem(r.source),n=new vm,s=R.getInstance().compilerChannel,a=new HC(i.uuid,i.projectId,s);a.setHandle(new s1(n)),await a.init(),await a.destroy(),n.preAdjust();let l=new vm,c=new HC(r.uuid,i.projectId,s);c.setHandle(new s1(l)),await c.init(),await c.destroy(),l.preAdjust();let h=new SF(new hi);[n.pad,l.pad,n.via,l.via].forEach(p=>{p.forEach(m=>{m.net="",m.ticket=[]})}),o.getPads().forEach(p=>{let m=l.pad.find(g=>o.globalIndex+g.index==p.globalIndex);m&&(m.unusedInnerLayers=p.unusedInnerLayers)}),o.getVias().forEach(p=>{let m=l.via.find(g=>o.globalIndex+g.index==p.globalIndex);m&&(m.unusedInnerLayers=p.unusedInnerLayers)});let u=h.pushItem(n.pad,l.pad),d=h.pushItem(n.via,l.via);if(!u.length&&!d.length)return aq(o,t,e),!0}return!1}function e0e(o){let t={};o.forEach(e=>{let r=e.net||"";t[r]==null&&(t[r]={targets:[],ids:[]}),t[r].targets.push(e.globalIndex)});for(let e in t)t[e].ids=Ye.getSameNetItems(e).map(r=>r.globalIndex);return t}var VOe=class{toggleElementsLayer(t){let e=re.getInstance().getAllBlindPhysics(),r=this.createReferenceMap(t),i=pr.getAllItem(),n=Wr.getAllItem(),s=pt.getAllItem(),a=Xt.getAllItem(),l=Kt.getAllItem(),c=ri.getAllItem(),h=Bn.getAllItem(),u=So.getAllItem(),d=zn.getAllItem(),p=Ti.getAllItem();for(let b of e){let P=b.data,T=!1;for(let I of P){let C=I.startLayer,E=I.endLayer,O=r.get(C),_=r.get(E);C!==O.layerId&&(T=!0,I.startLayer=O.layerId),E!==_.layerId&&(T=!0,I.endLayer=_.layerId),T&&(I.name=this.resetBlindViaRuleName(O.layerId,_.layerId))}T&&(b.data=P)}for(let b of n){if(b.type==0)continue;let P=b.startLayer,T=b.endLayer,I=r.get(P),C=r.get(T),E=!1;P!==I.layerId&&(b.startLayer=I.layerId,E=!0),T!==C.layerId&&(b.endLayer=C.layerId,E=!0),E&&(b.name=this.resetBlindViaName(I.layerId,C.layerId))}let m=[].concat(i,c,h,u,d,s,a,l,p),g=new Array,y=new Set;for(let b of m){if(typeof b.layerId>"u")continue;let P=b.layerId,T=r.get(P);!T||P===T.layerId||(b.layerId=T.layerId,g.push(b),b instanceof He&&b.type=="Copper Region"&&y.add(b.globalIndex))}y.size&&(A.publish("rebuildSingleCopper",{ids:Array.from(y),isLast:!1,isManual:!0}),y.clear()),this.uploadModifiedElements(g)}createReferenceMap(t){let e=new Map;for(let r=0;r<t.length;r++)e.set(t[r].referenceLayerId,t[r]);return e}resetBlindViaRuleName(t,e){let r=this.getBlindLayerOrder(t),i=this.getBlindLayerOrder(e);return r<i?`${r}-${i}`:`${i}-${r}`}getBlindLayerOrder(t){return t==1?1:t==2?Pe.getAllSignalLayer().length:t-15+2}resetBlindViaName(t,e){let r=re.getInstance().getDefaultBlindPhysics();for(let i of r.getAllVias())if(i.startLayer===t&&i.endLayer===e)return i.name}uploadModifiedElements(t){if(t.length===0)return;let e=R.getInstance().compiler,r=Sr.getInstance(),i=e.consistencyManager.getMaxTicket(),n=0,s=0;for(let a of t)try{let l=a.globalIndex;if(a instanceof Ps){e.setTicket(++i);let c=r.encode("OBJ",a.model);e.uploadObj(l,c),n++}else if(a instanceof Mn){e.setTicket(++i);let c=r.encode("IMAGE",a.model);e.uploadImage(l,c),n++}else if(a instanceof lr){e.setTicket(++i);let c=r.encode("STRING",a.model);c&&(a.model.key!=""?e.uploadAttr(l,c):e.uploadString(l,c)),n++}else if(a instanceof Ge){if(e.setTicket(++i),a instanceof yi){let c=r.encode("ARC",a.model);e.uploadArc(l,c)}else if(a instanceof Ir){let c=r.encode("LINE",a.model);e.uploadLine(l,c)}n++}else if(a instanceof Gi)e.setTicket(++i),e.uploadLayerFill(a.layerId,r.encode("FILL",a.model)),n++;else if(a instanceof Jr){let c=u1(a.getParent().globalIndex);c&&c instanceof He&&c.type==="Copper Region"?(e.setTicket(++i),e.uploadPoured(c.globalIndex,r.encode("POURED",Array.from(c.copperResultMap||[]))),n++):console.warn(`\u94FA\u94DC\u7ED3\u679C\u56FE\u5143 ${l} \u672A\u627E\u5230\u5BF9\u5E94\u7236\u8F6E\u5ED3\uFF0C\u8DF3\u8FC7\u4E0A\u4F20`)}else if(a instanceof lt||a instanceof rr||a instanceof Pr){let c=a.type,h=r.encodeProfile(a.model);c3(l,c,h),n++}}catch(l){s++,console.error(`\u4E0A\u4F20\u56FE\u5143 ${a.globalIndex} \u5931\u8D25:`,l)}}};function zXe(o){new VOe().toggleElementsLayer(o)}var t0e=class extends bi{constructor(t){super(),this.option=t}open(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e={};return e.action="layerManager",this.option!=null&&(e.extra={...this.option,pcbLayerSelectedNameCache:le.pcbConfig.pcbLayerSelectedNameCache,layerPhyPerferenceConfig:le.pcbConfig.layerPhyPerferenceConfig||""}),e}modify(t){this.applyConfig(t),window.setTimeout(()=>{A.publish("updateFrame","")},100)}close(t){return!R.getInstance().isactive||23==R.getInstance().doctype?void 0:(t.action=="confirm"&&this.applyConfig(t),!0)}applyLayerConfig(t){let e=Pe.configInnerLayers.size,r=Pe.getAllLayer(),i=t.layerConfigArr,n=new E3,s=new Array,a=new Array,l,c=new Array;for(let h=0;h<r.length;h++){let u=n.toPlainObj(r[h]),d=!0,p=r[h].config;if(i.forEach(m=>{if(+m.layerId===u.layerId){d=!1;let g=Object.assign({},u,m),y=ee.of3(g.activeColor).getData();if(Pe.modifyLayer(g.layerId,g.layerType,g.layerName||r[h].name,r[h].order,ee.build(y[0],y[1],y[2],g.activeColorAlpha),ee.build(y[0],y[1],y[2],g.deactiveColorAlpha),r[h].active,g.status),ER.deactiveAlpha=g.deactiveColorAlpha,m.layerType==="PLANE"&&Pd.hasProfileItem(m.layerId)){let P=Pd.fetchProfileItem(m.layerId);Pe.updatePlanzoneLayerKeepIsland(m.layerId,P.keepIsland)}let b=Pe.getLayer(u.layerId).config;return d=!b,d||A0(m.layerId),!p&&b?g.layerType=="PLANE"&&s.push(g.layerId):p&&!b?g.layerType=="PLANE"&&a.push(g.layerId):g.layerType=="SIGNAL"&&u.layerType=="PLANE"?a.push(g.layerId):g.layerType=="PLANE"&&u.layerType=="SIGNAL"&&s.push(g.layerId),!1}}),r[h].active&&(l=r[h]),d)if(r[h].active&&(l=Pe.getTopLayer()),Pe.modifyLayer(r[h].layerID,r[h].type,r[h].name,r[h].order,r[h].activeColor,r[h].deactiveColor,!1,0),c.push(r[h].layerID),Pd.hasProfileItem(r[h].layerID)&&Pd.deleteProfileItem(r[h].layerID),u.layerType=="CUSTOM"){let m=r[h].layerID,g=Pe.getLayer(m).config;(p!=g||g)&&A0(m,d)}else A0(r[h].layerID)}this.updateHasDeleteLayerComponentsBBox(c),l!=null&&Pe.setActiveLayer(l),t.upgraded&&zXe(t.layerConfigArr),Hre(),ea.getInstance().viaShowPair&&e!=Pe.configInnerLayers.size&&Wr.iterator(h=>h.refreshRender()),A.publish("clearSinglePlane",a),A.publish("rebuildSinglePlane",s),A.publish("autoRefresh3DColor",""),A.publish("autoFill",""),A.publish("FinishedHandleLayerUpdate",{},Q())}updateHasDeleteLayerComponentsBBox(t){if(t.length==0)return;let e=Ar.getAllItem();for(let r of e)r.needUpdateBBox=!0}getPhyZIndex(t,e){switch(t){case 3:return 1;case 7:return 2;case 5:return 3;case 1:return 1e3;case 2:return 9e3;case 6:return 1e4;case 8:return 10001;case 4:return 10002;default:return 1e3+e-3}}applyLayerPhysConfig(t){let e=new dt;if(t.layerPhysConfigArr.length){Pe.delAllSubstrateLayers();let r=0,i=0;for(let n of t.layerPhysConfigArr)n.zIndex=this.getPhyZIndex(n["Layer Id"],i++),n.Type==="Substrate"&&(n["Layer Id"]=361+r,Pe.modifyLayer(n["Layer Id"],"SUBSTRATE",n.Layer,361+r,ee.build(0,0,0,0),ee.build(0,0,0,0),!1,0),r++),A0(n["Layer Id"]),n.Thickness!=null&&(n.Thickness=e.mm2mil(n.Thickness)/10);Pe.setLayerPhys(t.layerPhysConfigArr,!0)}}async updateCanvas(){QI(!0),await this.removeUsedLayerForMultiLayerPads(),A.publish("flushService",""),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),A.publish("ui/toastMsg",{type:"info",msg:"Apply successfully!"},Q())}async removeUsedLayerForMultiLayerPads(){if(!le.pcbConfig.realTimeUpdateUnusedLayers)return;let t=[...Qt.getAllItem().filter(i=>i.layerId==12),...Wr.getAllItem()],e=(await A.messageBus.rpcCall("unusedLayer",e0e(t))).message,r=await Qpe(e);t.length>0&&(qe.executeCommand(r),A.publish("flushService",""))}updateSystemConfig(t){t.pcbLayerSelectedName&&(le.pcbConfig.pcbLayerSelectedNameCache=t.pcbLayerSelectedName)}applyConfig(t){this.applyLayerConfig(t),this.applyLayerPhysConfig(t),this.updateCanvas(),this.updateSystemConfig(t),this.modifyPcbLayerPhyPerferenceConfig(t)}modifyPcbLayerPhyPerferenceConfig(t){typeof t.layerPhyPerferenceConfig<"u"&&(le.pcbConfig.layerPhyPerferenceConfig=t.layerPhyPerferenceConfig,wi())}createReferenceMap(t){let e=new Map;for(let r=0;r<t.length;r++)e.set(t[r].referenceLayerId,t[r]);return e}resetBlindViaRuleName(t,e){let r=this.getBlindLayerOrder(t),i=this.getBlindLayerOrder(e);return r<i?`${r}-${i}`:`${i}-${r}`}getBlindLayerOrder(t){return t==1?1:t==2?Pe.getAllSignalLayer().length:t-15+2}resetBlindViaName(t,e){let r=re.getInstance().getDefaultBlindPhysics();for(let i of r.getAllVias())if(i.startLayer===t&&i.endLayer===e)return i.name}};var r0e=class extends bi{constructor(t,e){super(),this.shape=t,this.tool=e,this.tool.setDialogHandler(this)}open(){let t=new gE;this.type=="open"&&_y(this.shape);let e=t.getHtmlData(this.shape),r={action:"attribute-for-2dline",head:{primitive:["2DLINE"],unit:R.getInstance().unit,doctype:R.getInstance().doctype},body:{"2DLINE":[e.getResult("2DLINE")]}};YD.getService().dialogIds.add(this.id);let i=rU(r);return i.action=r.action,i}modify(t){if(!(!R.getInstance().isactive||23==R.getInstance().doctype)&&this.shape!=null&&t!=null){let e=new gE;e.isSetByDialog=!0,e.set(this.shape).modifyBy(t)}}close(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e=t.action;if(e=="confirm"){let r=new gE;r.isSetByDialog=!0,r.set(this.shape).modifyBy(t.body["2DLINE"]),this.tool.modify(!0)}else e=="closeOpenDialog"||this.tool.modify(!1);return this.tool.setDialogHandler(null),YD.getService().dialogIds.delete(this.id),fi.getInstance().clearCrossFlag(),!0}command(t){var e;return t.action=="netSelect"?(this.tool.toggleMode(1,(e=t==null?void 0:t.data)!=null?e:{}),!0):!1}closeOpenDialog(){let t={};t.dialogId=this.id,t.action="closeOpenDialog",A.publish("pcbdialogClose",t,Q())}};var i0e=class extends bi{constructor(e,r,i){super();this.items=new Set;e.forEach(n=>{this.items.add(n)}),this.x=r,this.y=i}open(e){let r=new Array;return this.items.forEach(i=>{i instanceof Ge?r.push(this.getTrack(i)):i instanceof Ue?r.push(this.getVia(i)):i instanceof Le?r.push(this.getPad(i)):i instanceof ke?r.push(this.getDevice(i)):i instanceof He?r.push(this.getProfile(i)):i instanceof lr?r.push(this.getText(i)):i instanceof ua?r.push(this.getTagging(i)):i instanceof Mn?r.push(this.getImage(i)):i instanceof Ps?r.push(this.getTrueColorPicture(i)):i instanceof Jr?r.push(this.getCopperResult(i)):i instanceof Tp&&r.push(this.getDRCResult(i))}),{action:"display-overlap-primitive",left:this.x,top:this.y,lists:r}}recory(){for(let e of this.items)e.visible()}modify(e){if(!e||!e.action)return;let{action:r,content:i,dialogId:n,id:s,title:a}=e,c=new Jt().getItem(s,{isContainDRCs:!0});switch(this.recory(),r){case"highlightTarget":{c&&c.click(),ze.updateMousePosition();break}case"cancelHighlightTarget":{c&&c.visible(),A.publish("flushSelectingInfo","");break}}A.publish("flushService","")}close(e){return!0}command(e){if(e.id!=""){let i=new Jt().getItem(e.id);A.publish("clearSelect",""),i&&(i.updateFilterVisible=!0,i.click()),A.publish("onlySelect",i?[i]:[]),gr.model=0}return!0}getTrack(e){return{title:"Track",id:e.globalIndex,content:[{label:"id",value:`${Tr}${e.number}`}]}}getVia(e){return{title:"Via",id:e.globalIndex,content:[{label:"id",value:`${Tr}${e.number}`}]}}getPad(e){return{title:"Pad",id:e.globalIndex,content:[{label:"id",value:`${Tr}${e.number}`}]}}getDevice(e){return{title:"Device",id:e.globalIndex,content:[{label:"id",value:`${Tr}${e.number}`}]}}getProfile(e){let r=Pe.getLayer(e.layerId).name;switch(e.type){case"3D Shell - Outline":return{title:"3D Shell - Outline",id:e.globalIndex,content:[{label:"id",value:`${Tr}${e.number}`}]};case"3D Shell - Screw Pillar":return{title:"3D Shell - Screw Pillar",id:e.globalIndex,content:[{label:"id",value:`${Tr}${e.number}`}]};case"3D Shell - Side Datum Line":return{title:"3D Shell - Side Datum Line",id:e.globalIndex,content:[{label:"id",value:`${Tr}${e.number}`}]};case"3D Shell - Top Slot Region":case"3D Shell - Side Slot Region":return{title:"3D Shell - Slot Region",id:e.globalIndex,content:[{label:"id",value:`${Tr}${e.number}`}]};case"Annotation":return{title:"Annotation",id:e.globalIndex,content:[]};default:return{title:e.type||"Outline Object",id:e.globalIndex,content:[{label:"id",value:`${Tr}${e.number}`}]}}}getText(e){return{title:"Text",id:e.globalIndex,content:[{label:"id",value:`${Tr}${e.number}`}]}}getTagging(e){return{title:"Tagging",id:e.globalIndex,content:[{label:"id",value:`${Tr}${e.number}`}]}}getImage(e){return{title:"Image",id:e.globalIndex,content:[{label:"id",value:`${Tr}${e.number}`}]}}getTrueColorPicture(e){return{title:"Colorful Image",id:e.globalIndex,content:[{label:"id",value:`${Tr}${e.number}`}]}}getTearDrop(e){return{title:"Teardrop",id:e.globalIndex,content:[{label:"id",value:`${Tr}${e.number}`}]}}getCopperResult(e){return{title:"Copper Fills",id:e.globalIndex,content:[{label:"id",value:`${Tr}${e.number}`}]}}getDRCResult(e){return{title:"DRC\u3010DRC\u3011",id:e.globalIndex,content:[]}}};var n0e=class extends bi{constructor(t){super(),this.tool=t}open(t){return this.tool.getDialogData()}modify(t){}close(t){return this.tool.modifyByDialog(t),!0}command(t){return t.action=="netSelect"?(this.tool.toggleMode(1),!0):!1}};var s0e=class extends bi{constructor(){super()}open(t){let e=KS("typeface"),r=je(KS("height")),i=je(KS("strokeWidth"));return{action:"place-pcb-text",content:ND,typeface:e||wK,typefaceList:Pre(),height:r,strokeWidth:i}}modify(t){return!0}close(t){let e=new dt;if(t.action==="confirm"){let r=t["place-text-content"];if(r.trim()){let i=parseFloat(String(t["place-text-height"]))/10;R.getInstance().unit!="mil"&&(i=e.conversion(R.getInstance().unit,"mil",i));let n=parseFloat(String(t["place-text-strokewidth"]))/10;R.getInstance().unit!="mil"&&(n=e.conversion(R.getInstance().unit,"mil",n)),o0e("typeface",t["place-text-typeface"]),o0e("height",i),o0e("strokeWidth",n),xG(r),A.publish("place_part(pcbtext)","")}}return!0}};var a0e=class extends bi{constructor(t,e){super(),this.shape=t,this.currTool=e}open(){let t=new wD;this.type=="open"&&_y(this.shape);let e=t.getHtmlData(this.shape),r={action:"attribute-for-pad",head:{primitive:["PAD"],unit:R.getInstance().unit,doctype:R.getInstance().doctype},body:{PAD:[e.getResult("PAD")]}},i=rU(r);return i.action=r.action,i}modify(t){new wD().set(this.shape).modifyBy(t)}close(t){return!R.getInstance().isactive||23==R.getInstance().doctype?void 0:(t.action=="confirm"?this.currTool.modify(!0):this.currTool.modify(!1),!0)}command(t){var e;return t.action=="netSelect"?(this.currTool.toggleMode(1,(e=t==null?void 0:t.data)!=null?e:{}),!0):!1}};var l0e=class extends bi{constructor(t){super(),this.option=t}open(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e={};return e.action="relative-offset",this.option!=null&&(e.extra=this.option),e}modify(t){}close(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;if(t.action=="confirm"){let r=ze.getSelects();if(r.length==0)return;Is.getInstance().init(r,"relative offset",(i,n)=>{_d.init(i,n,async(s,a)=>{let l=R.getInstance().unit,c=new S(na(t.newPos.x,l,"pixel"),na(t.newPos.y,l,"pixel")).add(R.getInstance().origin),h=this.calcOffset(s,c);if(new Zy(a,{movePadItSelf:!_d.moveWhole,saveHistory:!1}).execute(s,h),!_d.moveWhole){let d=new Set;s.forEach(m=>{if(m instanceof Le){let g=m.getParent();g instanceof ke&&d.add(g)}});let p=new Array;for(let m of d){a.addCommand4Item(m,"modify");let y=new ff().updateCustomFootprint(m,a.getCommand(),s.filter(b=>b.getParent()==m));p.push(y)}await Promise.all(p)}a.execute(),setTimeout(()=>{A.publish("selecting",{items:s}),A.publish("flushService","")},0),gr.refresh()})})}return!0}calcOffset(t,e){let r=new _e;for(let s of t){let a=s.buildBBox();r.ext1(a)}let n=r.build1().center();return new S(e.x-n.x,e.y-n.y)}};var c0e=class extends bi{constructor(t){super(),this.option=t}open(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e={};return e.action="set-part-elements",this.option!=null&&(e.extra=this.option),e}modify(t){}close(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;if(t.action=="confirm"&&t&&t.newPos&&!isNaN(t.newPos.positionX)&&!isNaN(t.newPos.positionY)){let r=R.getInstance().unit,i=new S(na(t.newPos.positionX,r,"pixel"),na(t.newPos.positionY,r,"pixel")).add(R.getInstance().origin);Fl.referPosition(i),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q())}return!0}};var h0e=class extends bi{open(t){return{action:"tear-drap","operation-type":ut.defaultTearDrop.operationType,"apply-scope":ut.defaultTearDrop.applyScope,"tear-shape":ut.defaultTearDrop.tearShape,"ignore-DRC":ut.defaultTearDrop.ignoreDRC,"round-pad-width":ut.defaultTearDrop.circleWidth,"round-pad-height":ut.defaultTearDrop.circleHeight,"circle-pad-via-checked":ut.defaultTearDrop.circlePadViaChecked,"rect-pad-width":ut.defaultTearDrop.otherWidth,"rect-pad-height":ut.defaultTearDrop.otherHeight,"special-shaped-pad-checked":ut.defaultTearDrop.specialShapedPadChecked,"routing-width":ut.defaultTearDrop.routingWidth,"routing-height":ut.defaultTearDrop.routingHeight,"routing-checked":ut.defaultTearDrop.routingChecked,"t-connection-width":ut.defaultTearDrop.TConnectionWidth,"t-connection-height":ut.defaultTearDrop.TConnectionHeight,"t-connection-checked":ut.defaultTearDrop.TConnectionChecked}}modify(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;if(t.action=="apply"){let r=t["apply-scope"],i=t["operation-type"],n=t["tear-shape"],s=t["ignore-DRC"],a=parseFloat(t["rect-pad-height"]),l=parseFloat(t["rect-pad-width"]),c=!!t["special-shaped-pad-checked"],h=parseFloat(t["round-pad-height"]),u=parseFloat(t["round-pad-width"]),d=!!t["circle-pad-via-checked"],p=parseFloat(t["routing-width"]),m=parseFloat(t["routing-height"]),g=!!t["routing-checked"],y=parseFloat(t["t-connection-width"]),b=parseFloat(t["t-connection-height"]),P=!!t["t-connection-checked"];ut.defaultTearDrop.operationType=i,ut.defaultTearDrop.applyScope=r,ut.defaultTearDrop.tearShape=n,ut.defaultTearDrop.ignoreDRC=s,ut.defaultTearDrop.circlePadViaChecked=d,ut.defaultTearDrop.circleHeight=h,ut.defaultTearDrop.circleWidth=u,ut.defaultTearDrop.specialShapedPadChecked=c,ut.defaultTearDrop.otherHeight=a,ut.defaultTearDrop.otherWidth=l,ut.defaultTearDrop.routingChecked=g,ut.defaultTearDrop.routingWidth=p,ut.defaultTearDrop.routingHeight=m,ut.defaultTearDrop.TConnectionChecked=P,ut.defaultTearDrop.TConnectionWidth=y,ut.defaultTearDrop.TConnectionHeight=b,this.withTearDrop(i,r,n,s,d,u/100,h/100,c,l/100,a/100,g,p/100,m/100,P,y/100,b/100)}return!0}close(t){if(!(!R.getInstance().isactive||23==R.getInstance().doctype))return!0}withTearDrop(t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b=!0,P,T,I){if(t=="add"){if(!b&&P.length>1e3&&(T=!1,b=!0),T||A.publish("progressUpdate",[0,"add tear drop"],Q()),!P){e=="all"?P=this.getConnectNodesForGlobalIndex():P=this.getSelectNodesForGlobalIndex();let E=this.getTears(P);this.delTears(E)}P=Array.from(new Set(P)),A.publish("addTearDrop",{operationType:t,applyScope:e,tearShape:r,ignoreDRC:i,circlePadViaChecked:n,roundWidth:s,roundeHeight:a,specialShapedPadChecked:l,otherWidth:c,otherHeight:h,routingChecked:u,routingWidth:d,routingHeight:p,TConnectionChecked:m,TConnectionWidth:g,TConnectionHeight:y,ids:P,hideProgress:T,addTeardropAutomatically:I,useWorker:b})}else{let C="removeTearDrop-time";Cn(C);let E=new De("remove tear dropall"),O,_;if(e=="all")O=this.getConnectNodes(),_=new Set(pt.getAllItem());else{O=this.getSelectNodes();let v=Array.from(O).map(D=>D.globalIndex);_=this.getTears(v)}let x=ze.getSelects().filter(v=>!(v instanceof lt&&v.type=="TearDrop"));A.publish("onlySelect",x),_.forEach(v=>{if(v.type=="TearDrop"){let w=v.getComponent().connects.map(H=>ch(H)),F=w.filter(H=>H instanceof zr);if(F.length===2){if(!u)return}else if(F.length>2){if(!m)return}else if(F.length===1){let H=w.filter(z=>!(z instanceof zr));if(H.length!==1){let z=H[0];if(z instanceof et){let V=z,W=F[0].layerId;if((W===1?V.top:W===2?V.bottom:V.inner).type==="ELLIPSE"){if(!n)return}else if(!l)return}else if(z instanceof Ct&&!n)return}else console.warn(`TearDrapDialog delete error "pad or Via":${H.length}`)}else console.warn('TearDrapDialog delete error "track"');E.addCommand(Ce.dispatch(v,"delete")),v.getComponent().connects.forEach(H=>{pt.getTears(H).delete(v)}),A.publish("delete",v),v.remove()}}),qe.executeCommand(E),Xi(C)}}delTears(t){let e=new De("delete tear drop"),r=ze.getSelects().filter(i=>!(i instanceof lt&&i.type=="TearDrop"));A.publish("onlySelect",r),t.forEach(i=>{i.getComponent().connects.forEach(a=>{pt.getTears(a).delete(i)});let s=new tT(i,"delete");e.addCommand(s),i.remove()}),e.length&&qe.executeCommand(e)}getTears(t){let e=new Set;return pt.idMapTearsIsNull()||t.forEach(r=>{let i=pt.getTears(r);i!=null&&i.forEach(n=>{e.add(n)})}),e}getPadShape(t,e){return ao(t)?e.topType:2==t?e.bottomType:e.innerType}getConnectNodes(){let t=new Set;return Qt.getAllItem().forEach(n=>{t.add(n)}),Wr.getAllItem().forEach(n=>{t.add(n)}),pr.getAllItem().forEach(n=>{t.add(n)}),t}getConnectNodesForGlobalIndex(){let t=[];return Qt.getAllItem().forEach(n=>{t.push(n.globalIndex)}),Wr.getAllItem().forEach(n=>{t.push(n.globalIndex)}),pr.getAllItem().forEach(n=>{t.push(n.globalIndex)}),t}getConnectNodes1(){let t=new Set;return Qt.getAllItem().forEach(i=>{t.add(i)}),Wr.getAllItem().forEach(i=>{t.add(i)}),t}getSelectNodes(){let t=new Set;return ze.getSelects().forEach(r=>{r instanceof Le||r instanceof Ue||r instanceof Ge?t.add(r):r instanceof ke&&r.getItems().forEach(n=>{(n instanceof Ge||n instanceof Le||n instanceof Ue)&&t.add(n)})}),t}getSelectNodesForGlobalIndex(){let t=[];return ze.getSelects().forEach(r=>{r instanceof Le||r instanceof Ue||r instanceof Ge?t.push(r.globalIndex):r instanceof ke&&r.getItems().forEach(n=>{(n instanceof Ge||n instanceof Le||n instanceof Ue)&&t.push(n.globalIndex)})}),t}getSelectNodes1(){let t=new Set;return ze.getSelects().forEach(r=>{r instanceof Le?t.add(r):r instanceof Ge?r.searchNode().forEach(n=>{(n instanceof Le||n instanceof Ue)&&t.add(n)}):r instanceof Ue?t.add(r):r instanceof ke&&(r.getPads().forEach(s=>{t.add(s)}),r.getVias().forEach(s=>{t.add(s)}))}),t}getTracks(t,e=!1){let r=new Array,i=t.searchNode();if(e){let n=i.filter(s=>s instanceof Le||s instanceof Ue);if(n&&n.length)return r}return i.forEach(n=>{n instanceof Ge&&r.push(n)}),r}getTracksForGlobalIndex(t,e=!1){let r=[],i=t.searchNode();if(e){let n=i.filter(s=>s instanceof Le||s instanceof Ue);if(n&&n.length)return r}return i.forEach(n=>{n instanceof Ge&&r.push(n.globalIndex)}),r}intersBBox(t,e,r,i,n){let s=this.getLimitPoints(t,i,n);return s.length==0&&(s=this.interPoints(t,e,r,i,n,0)),s}interPoints(t,e,r,i,n,s){let a;i?a=this.getLeft(n,e+r):a=this.getRight(n,e+r);let l=this.getPoints(t,a);if(s<6){let c=r/2;if(l.length==0)l=this.interPoints(t,e,c,i,n,s+1);else{let h=this.interPoints(t,e+c,c/2,i,n,s+1);h.length>0&&(l=h)}}return l}getLimitPoints(t,e,r){let i=new Array;t.primitives.forEach(s=>{this.getInters(s,r).length>0&&(i.push(s.start()),i.push(s.end()))});let n=null;if(e){if(r instanceof M){let s=0,a=r.end().sub(r.start()).normalize();i.forEach(l=>{let c=er.foot(r,l),h=l.sub(c);a.cross(h)>0&&h.length()>s&&(n=l,s=h.length())})}else if(r instanceof q){let s=r.rx;i.forEach(a=>{let l=a.sub(r.center);l.length()<s&&(n=a,s=l.length())})}}else if(r instanceof M){let s=0,a=r.end().sub(r.start()).normalize();i.forEach(l=>{let c=er.foot(r,l),h=l.sub(c);a.cross(h)<0&&h.length()>s&&(n=l,s=h.length())})}else if(r instanceof q){let s=r.rx;i.forEach(a=>{let l=a.sub(r.center);l.length()>s&&(n=a,s=l.length())})}return n==null?[]:[n]}isStart(t,e){return e.isSelect(t.start.x,t.start.y)}getShape(t,e){if(e instanceof _i)if(ao(t.layerId)){let r=e.getTopShape(0);if(r!=null)return r}else if(2==t.layerId){let r=e.getBottomShape(0);if(r!=null)return r}else{let r=e.getInnerShape(0);if(r!=null)return r}else{let r=e.getMathGraphics(t.layerId,0);if(r!=null)return r}return null}dispatch(t,e,r,i){let n=this.isStart(t,e),s=this.getShape(t,e);return s!=null&&this.calculate(s,t,r,i,n)!=null,null}dispatchArc(t,e,r,i){let n=this.isStart(t,e),s=this.getShape(t,e);return s!=null&&s.primitives[0]instanceof q&&this.calculateCircle(s.primitives[0],t,r,i,n)!=null,null}calculateCircle(t,e,r,i,n){let s=this.getLine(e),a=this.getInters(t,s);if(a.length>0){let l=a[0],c=l.sub(t.center).normalize(),h=Math.sqrt(t.rx2-r*r/4),u=new S(-c.y,c.x),d=l.add(c.mul(i)),p=t.center.add(c.mul(h)),m=new M(d.sub(u.mul(100)),d.add(u.mul(100))),g=new M(p.sub(u.mul(100)),p.add(u.mul(100))),y=this.getInters(t,g),b=this.getLeft(s,e.width),P=new Array;if(b!=null)P=this.getInters(b,m);else return null;let T=this.getRight(s,e.width),I=this.getInters(T,m);if(P.length==0&&(n?P.push(b.end()):P.push(b.start())),P.length==0)return null;let C;if(P.length==1)C=P[0];else if(P.length>1){let O=e.length;n?P.forEach(_=>{let x=_.distance1(e.start);x<=O&&(O=x,C=_)}):P.forEach(_=>{let x=_.distance1(e.end);x<=O&&(O=x,C=_)})}if(I.length==0&&(n?I.push(T.end()):I.push(T.start())),I.length==0)return null;let E;if(I.length==1)E=I[0];else if(I.length>1){let O=e.length;n?I.forEach(_=>{let x=_.distance1(e.start);x<=O&&(O=x,E=_)}):I.forEach(_=>{let x=_.distance1(e.end);x<=O&&(O=x,E=_)})}if(C!=null&&E!=null&&y.length==2){let O=y[1].sub(y[0]).normalize(),_=E.sub(C).normalize();return O.dot(_)>0?(y.push(E),y.push(C)):(y.push(C),y.push(E)),y[0].distance2(y[1])<=C.distance2(E)?null:ge.build4(y).asClose()}else return null}}getLeft(t,e){if(e=e/2,t instanceof M){let r=t.end().sub(t.start()).normalize(),i=new S(-r.y,r.x).mul(e);return new M(t.start().add(i),t.end().add(i))}else{let r=t.rx;return r<e?null:q.build2(t.center,t.startAngle,t.endAngle(),r-e,r-e,t.sweep())}}getRight(t,e){if(e=e/2,t instanceof M){let r=t.end().sub(t.start()).normalize(),i=new S(r.y,-r.x).mul(e);return new M(t.start().add(i),t.end().add(i))}else{let r=t.rx;return q.build2(t.center,t.startAngle,t.endAngle(),r+e,r+e,t.sweep())}}calculate(t,e,r,i,n){let s=this.getLine(e),a=this.getLeft(s,e.width+r),l=this.getRight(s,e.width+r),c=this.getLeft(s,e.width),h=this.getRight(s,e.width),u=new Array,d=new Array,p=new Array,m=new Array;a!=null&&(u=this.getPoints(t,a)),l!=null&&(d=this.getPoints(t,l)),c!=null&&(p=this.getPoints(t,c)),h!=null&&(m=this.getPoints(t,h));let g,y;if(p.length==0||(p.length==1&&(g=p[0]),p.length>1&&p.forEach(C=>{let E=e.length;if(n){let O=C.distance1(e.start);O<=E&&(E=O,g=C)}else{let O=C.distance1(e.end);O<=E&&(E=O,g=C)}}),m.length==0))return null;m.length==1&&(y=m[0]),m.length>1&&m.forEach(C=>{let E=e.length;if(n){let O=C.distance1(e.start);O<=E&&(E=O,y=C)}else{let O=C.distance1(e.end);O<=E&&(E=O,y=C)}});let b,P;g!=null&&y!=null&&(b=this.getPoint4Distance(c,g,i,n),P=this.getPoint4Distance(h,y,i,n)),u.length==0&&(u=this.intersBBox(t,e.width,r,!0,s),u.length==0&&u.push(g));let T;if(u.length==1)T=u[0];else if(u.length>1){let C=Number.MAX_VALUE;u.forEach(E=>{let O=E.distance1(g);O<=C&&(C=O,T=E)})}d.length==0&&(d=this.intersBBox(t,e.width,r,!1,s),d.length==0&&d.push(y));let I;if(d.length==1)I=d[0];else if(d.length>1){let C=Number.MAX_VALUE;d.forEach(E=>{let O=E.distance1(y);O<=C&&(C=O,I=E)})}return b!=null&&P!=null&&T!=null&&I!=null?ge.build4([b,T,I,P]).asClose():null}getPoint(t,e){let r=Pt(t,e);if(r>0)for(let i=0;i<r;i+=2)return new S(Ee[i],Ee[i+1]);return null}getVector(t,e){if(t instanceof Ir)return e?t.end.sub(t.start):t.start.sub(t.end);if(t instanceof yi)if(e){let r=t.start.sub(t.center);return t.sweep==ae.CCW?new S(-r.y,r.x):new S(r.y,-r.x)}else{let r=t.end.sub(t.center);return t.sweep==ae.CCW?new S(r.y,-r.x):new S(-r.y,r.x)}}getPoints(t,e){let r=new Array;return t.primitives.forEach(i=>{this.getInters(i,e).forEach(s=>{r.push(s)})}),r}getInters(t,e){let r=new Array,i=Pt(t,e);if(i>0)for(let n=0;n<i;n+=2){let s=new S(Ee[n],Ee[n+1]);r.push(s)}return r}getLine(t){let e;return t instanceof yi?e=q.build2(t.center,t.startAngle/Math.PI*180,t.endAngle/Math.PI*180,t.radius,t.radius,t.sweep):e=new M(t.start,t.end),e}getPoint4Distance(t,e,r,i){if(t instanceof M){let n=t.end().sub(t.start()).normalize();return i?e.distance1(t.end())>r?e.add(n.mul(r)):t.end():e.distance1(t.start())>r?e.add(n.mul(-r)):t.start()}else{let n=Math.abs(r/t.rx),s=e.sub(t.center).normalize(),a=Math.atan2(s.y,s.x),l;i?t.sweep()==ae.CCW?l=a+n:l=a-n:t.sweep()==ae.CCW?l=a-n:l=a+n,l=(l%kr+kr)%kr/Math.PI*180;let c=t.pointOn(l);return V0(t,c)?c:i?t.end():t.start()}}};var u0e=class extends bi{constructor(t,e,r){super(),this.text=t,this.x=e,this.y=r}open(t){let e=!1,r=!0,i=this.text.getParent();return i&&i instanceof ke&&(e=!0),["Unique ID","Name","Designator","Add into BOM","Convert to PCB"].includes(this.text.key)&&(r=!1),{action:"modify-pcb-text-suspension",left:this.x,top:this.y,content:this.getContent(),id:this.text.globalIndex,key:this.text.key,isComponentAttr:e,isEnableBreakLine:r}}modify(t){}close(t){var r,i;if(!R.getInstance().isactive||23==R.getInstance().doctype)return;if(t.action=="confirm"){let n=new De("double click modify text");if(this.text.getParent()!=null?n.addCommand(Ce.dispatch(this.text.getParent(),"modify")):n.addCommand(Ce.dispatch(this.text,"modify")),lEe(R.getInstance().doctype,this.text.key,(r=this.text.getParent())==null?void 0:r.attrKeyValue[this.text.key])){let s=hEe((i=this.text.getParent())==null?void 0:i.attrKeyValue[this.text.key])[0],a=this.text.getParent();if(a!=null&&a instanceof ke){a.modifyATTRMap(s,t["place-text-content"]);let l=a.getFormulaName();this.text.setValue(l)}}else this.text.value=t["place-text-content"];R.getInstance().doctype==4&&this.text.key=="Designator"&&!/\?$/gi.test(this.text.value)?(this.text.value=this.text.value||"",this.text.value+="?"):R.getInstance().doctype==3&&this.text.key=="Designator"&&(this.text.value=this.text.value||""),R.getInstance().doctype==4&&A.publish("flushAttrPlane",""),A.publish("clearSelect",""),n.length>0&&qe.executeCommand(n)}return!0}getContent(){var t,e,r;return cEe(R.getInstance().doctype,this.text.key,(t=this.text.getParent())==null?void 0:t.attrKeyValue[this.text.key])&&!lEe(R.getInstance().doctype,this.text.key,(e=this.text.getParent())==null?void 0:e.attrKeyValue[this.text.key])?(r=this.text.getParent())==null?void 0:r.attrKeyValue[this.text.key]:this.text.value}};var d0e=class extends bi{constructor(t){super(),this.tool=t}getWidth(){return this.tool.getWidth()}open(t){return{action:"commonly-value-input",forms:[{type:"text",key:"input-value",value:je(this.tool!=null?this.getWidth():we.prevTrackWidth),tips:R.getInstance().unit,title:"",inputStatus:"selectAll"}],verificationType:1}}modify(t){}close(t){if(t.action=="confirm"){let i=new dt().conversion(R.getInstance().unit,"mil",parseFloat(t["input-value"])/10);if(!isNaN(i)&&!ne.less(i,vc)){if(this.tool instanceof vo)return this.tool.setWireWidth(i),wi(),!0;this.tool&&this.tool.setWireWidth(i),we.prevTrackWidth=i,A.publish("flushSelectingInfo",""),wi()}}return!0}};var p0e=class extends bi{constructor(e){super();this.components=new Set;e.forEach(r=>{this.components.add(r)})}open(e){let r=new Set;this.components.forEach(n=>{let s=Hi.getItem(n.footprintUUID);r.add(s)});let i=new Array;return r.forEach(n=>{let s=n.uuid;i.push(s)}),{action:"update-footprint",footprintList:i}}modify(e){}close(e){if(!R.getInstance().isactive||R.getInstance().doctype!=3)return;if(e.action=="confirm"){let i=new JA("Update All","all"),n=new JA("Update Selected Only","select"),s=new WV("Whether to update all attributes of the same package in the canvas?",[i,n],a=>{a=="all"?this.updateAll(e):this.updateSelect(e),qe.clear()});A.publish("openMsgbox",s)}return!0}update(e){}updateAll(e){let r=new De("update all footprint ");e.updatedData.forEach(n=>{let s=n.uuid,l=Hi.getItem(s).getComponents(),c=new Array;for(let d of l){let p=Ar.getItem(d.globalIndex);c.push(p)}let h=new Array,u=new d1("2.0");for(let d of c){let p=u.save(d.model);h.push(p),A.publish("hasModifyPcbItem",d),r.addCommand(Ce.dispatch(d,"delete")),d.remove(),A.publish("delete",d)}h.forEach(d=>{let p=new p1(d);p.build();let m=p.items[0];A.publish("hasModifyPcbItem",m),r.addCommand(Ce.dispatch(m,"add"))})}),qe.executeCommand(r),A.publish("flushService","")}updateSelect(e){let r=new De("update select footprint ");e.updatedData.forEach(n=>{let s=n.title,a=new Array;this.components.forEach(h=>{!h.isEmpty&&h.footprintId==s&&a.push(h)});let l=new Array,c=new d1("2.0");for(let h of a){let u=c.save(h.model);l.push(u),A.publish("hasModifyPcbItem",h),r.addCommand(Ce.dispatch(h,"delete")),h.remove(),A.publish("delete",h)}l.forEach(h=>{h.forEach(u=>{u[6]=="Footprint"&&(u[7]=s)})}),l.forEach(h=>{let u=new p1(h);u.build();let d=u.items[0];A.publish("hasModifyPcbItem",d),r.addCommand(Ce.dispatch(d,"add"))})}),qe.executeCommand(r),A.publish("flushService","")}uuid(){for(var e=[],r="0123456789abcdef",i=0;i<36;i++)e[i]=r.substr(Math.floor(Math.random()*16),1);e[14]="4",e[19]=r.substr(e[19]&3|8,1),e[8]=e[13]=e[18]=e[23]="-";var n=e.join("");return n}parseFootprintFile(e,r,i,n){let s=new Array;return s.push(["FOOTPRINT",e,{uuid:r,utime:i}]),JSON.parse(n).forEach(l=>{let c=l[0];this.isSingleItem(c)&&(c=="ATTR"&&l[6]=="Footprint"&&(l[7]=e),s.push(l))}),s.push(["END_FOOTPRINT"]),s}isSingleItem(e){switch(e){case"POUR":case"POLY":case"REGION":case"FILL":case"PAD":case"ARC":case"LINE":case"VIA":case"STRING":case"ATTR":case"DIMENSION":return!0}return!1}};var i$=class extends bi{constructor(e,r){super();this.item=null;this.tool=e,this.item=r}open(e){let r,i=R.getInstance().unit,n=new dt;if(r={action:"attribute-for-place-ind-via",netList:Ye.getNet(),unit:i,needSelectNet:(this.tool instanceof w1||this.tool instanceof U2)&&R.getInstance().doctype==pi.PCB},this.item!=null)r.attrNet=this.item.net,r.outerDiameter=n.conversion("mil",i,this.item.radius*20),r.innerDiameter=n.conversion("mil",i,this.item.holeRadius*20);else{let s=re.getInstance().getDefaultRadiusPhysics();r.attrNet=ut.defaultVia.net,r.outerDiameter=n.conversion("mil",i,s.defalutRadius*20),r.innerDiameter=n.conversion("mil",i,s.defalutInner*20)}return r}modify(e){}close(e){if(e.action=="confirm"){let i=e.net;if(i==null&&(i=""),(this.tool instanceof w1||this.tool instanceof U2)&&this.item!=null&&(this.item.net=i,this.tool.flushNear(),ut.setDefaultVia(this.item),this.tool.modifyViaSize(e.holeRadius,e.radius,!1)),this.tool instanceof vo&&(this.tool.modifyViaSize(e.holeRadius,e.radius),he.publish("flushSelectingInfo","")),this.tool instanceof vo){let n=this.tool.getNextTool();n?(n.viaSize(e.holeRadius,e.radius,this.tool.getEventStatus()),n.viaSize(e.holeRadius,e.radius)):this.tool.setViaSize(e.holeRadius,e.radius)}wi()}return!0}};var f0e=class extends bi{constructor(t){super(),this.option=t}open(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e={};return this.option!=null&&(e.extra=this.option),e.action="new-group",e}modify(t){}close(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;if(t.action=="confirm"){if(Ht.getGroupByName(t.groupName))return A.publish("showPcbSlideMsg",["Group name already exists!"],Q()),!1;let r=ze.getSelects(),i=jF(r);if(i.length){let n=new De("combination"),s=Ht.combination(i,t.groupName),a=Ce.dispatch(s,"add");n.addCommand(a),qe.executeCommand(n),A.publish("showPcbSlideMsg",["{0} objects grouped successfully",[i.length]],Q()),A.publish("flushSelectingInfo","")}else A.publish("ui/toastMsg",{type:"warn",msg:"None of the selected objects meets the conditions for joining the group"},Q())}return!0}};var m0e=class extends bi{constructor(t){super(),this.option=t}open(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e={};return this.option!=null&&(e.extra=this.option),e.action="join-group",e}modify(t){}close(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;if(t.action=="confirm"){let r=ze.getSelects(),i=jF(r);if(i.length){let n=new De("joinCombination"),s=Ht.getItem(t.groupId),a=Ce.dispatch(s,"modify");n.addCommand(a),Ht.joinCombination(i,t.groupId),qe.executeCommand(n),A.publish("showPcbSlideMsg",["{0} objects join group successfully",[i.length]],Q())}else A.publish("ui/toastMsg",{type:"warn",msg:"None of the selected objects meets the conditions for joining the group"},Q())}return!0}};var g0e=class extends bi{constructor(t){super(),this.option=t}open(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e=ah.getItem(this.option.rulerId);A.publish("onlySelect",[e]);let r={};return this.option!=null&&(r.extra=this.option),r.action="edit-smart-dimension",r}modify(t){}close(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e=t.action,{value:r,rulerId:i,noChangeValue:n,isNew:s}=t;if(e=="confirm"&&!n)ah.setSmartDimensionLength(r,i,s);else{let a=new Jt,l=_s.movedItems.map(c=>a.getItem(c));s&&_s.addCommand(ah.getItem(i),"add"),_s.executeCommand(),A.publish("hasModifyPcbItem",l),A.publish("flushService","")}return A.publish("flushSelectingInfo",""),!0}};var y0e=class extends bi{constructor(t){super(),this.selectPadsNum=t.selectPadsNum,this.allPadsNum=t.allPadsNum}open(t){return{action:"renumber-pads",selectPadsNum:this.selectPadsNum,allPadsNum:this.allPadsNum}}modify(t){}close(t={}){return t.action=="confirm"&&(t.sequsence==="custom_path"?(S5.options=t,S5.customPathRenumber()):S5.renumber(t)),!0}};var b0e=class extends bi{constructor(t){super(),this.option=t}open(){if(!(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype))return{action:"generate-3d-shell-outline",extra:{...this.option}}}modify(t){}close(t){return!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype?void 0:(t.action=="confirm"&&this.generateD3ShellOutline(t.value),!0)}generateD3ShellOutline(t){let e=ze.getSelects()[0];if((e instanceof mt||e instanceof _t)&&(e=e.getParent()),!(e instanceof He&&e.type==="Board Outline"))return;let r,i,n=53,s="3D Shell - Outline",a=Pu(-1,s);if(e instanceof rr){let l=new S(-1,1).rotate(S.ORIGIN,e.rotation).normalize(),c=t*(2/Math.sqrt(2)),h=e.start.add(l.mul(c)),u=Xt.addRect(s,n,h,e.width+t*2,e.height+t*2,"",!1,a,e.rotation,e.cornerRadius);r=new De("draw Rect"),i=Ce.dispatch(u,"add")}else if(e instanceof Pr){let l=Kt.addCircle(s,n,e.center,e.radius+t,a,!1,"");r=new De("draw 2DLine Circle "+s),i=Ce.dispatch(l,"add")}else if(e instanceof lt){let l=new Array,c=X0(ge.build2(e.getMathGraphics().primitives),t);if(Er(c,function(p,m){return m.bbox().area()-p.bbox().area()},0,c.length),c.length>0&&c[0].items.length>0)l=c[0].items[0].primitives;else return;if(Bu(s)&&!Qh(l))return;let u=new Po().ptsToShapes(l,n,e.strokeWidth),d=nm(u);if(d.length>0){let p=pt.addPolygon(s,n,[d],a,"",!1);r=new De("draw 2DLine Polygon "+s),i=Ce.dispatch(p,"add")}}A.publish("autoFill",""),r!=null&&i!=null&&(r.addCommand(i),qe.executeCommand(r))}};var P0e=class extends bi{constructor(e){super();this.cache={};this.dialogType="equal-length-tuning",this.option=e,this.cache={isDiffPair:e.isDiffPair,startPoint:e.startPoint,mouseXY:e.mouseXY,reOpenDialog:e.reOpenDialog}}open(e){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let r={};return r.action="equal-length-tuning",this.option!=null&&(r.extra=this.option),r}modify(e){if(e.action==="updateNetLengthRule"){let{netLengthMin:r,netLengthMax:i}=e;A.publish("updateNetLengthRule",{netLengthMin:r,netLengthMax:i},Q())}}command(e){let r=uu.getTool();return(r instanceof $G||r instanceof KG)&&e.action=="netSelect"?(r.toggleMode(1),r.addedTo=e.data.addedTo,r.lengthType=e.data.lengthType,r.addedLength=e.data.addedLength,!0):!1}close(e){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let r=e.action,i=e.formData;if(r=="confirm"){let n=i.minHeight,s=i.isSingleSide,a=i.type,l=i.width,c=i.restrictLength,h=i.additionalLength,u=i.addedTo,{isDiffPair:d,startPoint:p,mouseXY:m,reOpenDialog:g}=this.cache,y={isSingleSide:s,type:a,width:l,minHeight:n,restrictLength:c,additionalLength:h,addedTo:u};A.publish("toggle",{command:"draw(snake_track)",isDiffPair:d,data:{...y,startPoint:p,mouseXY:m,reOpenDialog:g}}),d?A.publish("UPDATE_DIFF_PAIR_EQUAL_LENGTH_TUNING",y,Q()):A.publish("UPDATE_EQUAL_LENGTH_TUNING",y,Q())}return!0}};var T0e=class extends bi{constructor(t){super(),this.option=t}open(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e={};return e.action="edit-netClass",this.option!=null&&(e.extra=this.option),e}modify(t){this.handleData(t)}close(t){return this.handleData(t),!0}handleData(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e=t.action;if(e=="confirm"||e=="apply"){let{type:r,newNetClassList:i,oldNetClassList:n,changeName:s,nets:a,netClassName:l,oldNetClassName:c}=t;IT(r,i,n,s,a,l,c)}}};var I0e=class extends bi{constructor(t){super(),this.tool=t}open(t){let e=new dt;return{action:"commonly-value-input",forms:[{type:"text",key:"input-value",value:je(this.tool.stepSize),tips:R.getInstance().unit,title:"",inputStatus:"selectAll"}]}}modify(t){}close(t){if(t.action=="confirm"){let r=new dt;this.tool.stepSize=r.conversion(R.getInstance().unit,"mil",parseFloat(t["input-value"])/10)}return!0}};var C0e=class extends bi{constructor(t){super(),this.option=t}open(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e={};return e.action="action-for-locked-objects",this.option!=null&&(e.extra=this.option),e}modify(t){}close(t){return!R.getInstance().isactive||23==R.getInstance().doctype?void 0:(t.action=="confirm"?Is.getInstance().execute(t.status):(Is.getInstance().interrupt(),he.publish("tool","dropdrag")),!0)}};var S0e=class extends bi{constructor(t){super(),this.option=t}open(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e={};return e.action="confirm-pad-move-option",this.option!=null&&(e.extra=this.option),e}modify(t){}close(t){return!R.getInstance().isactive||23==R.getInstance().doctype?void 0:(t.action=="confirm"?(_d.execute(t.moveWhole),_d.notAsking=t.notAsking):(_d.interrupt(),A.publish("tool","dropdrag")),!0)}};var E0e=class extends qG{constructor(e={}){super(!1);this.profile=null;this.parseData(e)}parseData(e){let r=new dt,i=parseFloat(e["attr-via-column-spacing"])/10,n=parseFloat(e["attr-via-line-spacing"])/10,s=parseFloat(e["attr-via-inner-diameter"])/20,a=parseFloat(e["attr-via-diameter"])/20;this.operation=e["attr-via-operation"],this.ids=e["attr-ids"],this.columnSpacing=r.conversion(R.getInstance().unit,"mil",i),this.lineSpacing=r.conversion(R.getInstance().unit,"mil",n),this.radius=r.conversion(R.getInstance().unit,"mil",a),this.innerRadius=r.conversion(R.getInstance().unit,"mil",s),ut.setDefaultSutureVia(this.lineSpacing,this.columnSpacing)}getLayerId(){return this.profile!=null?this.profile.layerId:super.getLayerId()}handler(){this.operation==="Add"?this.addSutureVias():this.removeSutureVias()}async addSutureVias(){let e="addSutureVias-time";Cn(e);let r=new Jt;this.ids.forEach(i=>{let n=r.getItem(i);n&&this.generateSutureVias(n)}),Xi(e)}async generateSutureVias(e){let r=()=>{this.net=e.net,this.profile=e};if(e instanceof Jr)r(),await this.placeSutVias([e]);else if(e instanceof He&&e.type==="Copper Region")if(e.hasCopperRes()){r();let i=Array.from(e.getCopperResult()),{count:n,hasSameNetCoppers:s}=await this.placeSutVias(i,!0);this.hasEffectiveDrawn&&A.publish("rebuildCopperRegionDialog",{msg:""}),n==0&&!s&&A.publish("ui/toastMsg",{type:"warn",msg:"The selection area must contain the same network copper filled before adding suture holes"},Q())}else A.publish("ui/toastMsg",{type:"warn",msg:"The selection area must contain the same network copper filled before adding suture holes"},Q());else e instanceof Gi&&(r(),await this.placeSutVias([e]))}removeSutureVias(){let e="removeSutureVias-time";Cn(e);let r=new Jt;this.ids.forEach(i=>{let n=r.getItem(i);n&&this.removeSuture(n)}),Xi(e)}removeSuture(e){e instanceof Jr?this.rmSutViasInResult([e],e):e instanceof He&&e.type==="Copper Region"&&e.hasCopperRes()?this.rmSutViasInResult(e.getCopperResult(),e):e instanceof Gi?this.rmSutViasInResult([e],e):A.publish("ui/toastMsg",{type:"warn",msg:"The selection area must contain the same network copper filled before removing suture holes"},Q())}async placeSutVias(e,r=!1){let i=e.map(l=>ei.getFillOutline(l.model)),{vias:n,hasSameNetCoppers:s}=await this.placeSutureVias(i,r),a=n.length;if(!r&&a==0&&!s&&A.publish("ui/toastMsg",{type:"warn",msg:"The selection area must contain the same network copper filled before adding suture holes"},Q()),a>0){let l=new De("draw suture via");for(let c of n){A.publish("hasModifyPcbItem",c);let h=Ce.dispatch(c,"add");l.addCommand(h)}A.publish("onlySelect",n),l.length&&qe.executeCommand(l),A.publish("flushService","")}return{count:a,hasSameNetCoppers:s}}searchSutureVia(e,r,i){if(r.net!==""||r instanceof Jr)return i.searchNode().filter(h=>h instanceof Ue&&h.isSuture);let n=i.buildBBox(),s=kt.searchByType(n,"Via").vias;if(s.size===0)return[];let a=r.net===""&&r instanceof Gi?r.pls[0]:r.model.getMathGraphics(),l=Zh.getInstance().addCache(r.model.globalIndex,r.model.layerId,a,0),c=[];for(let h of s){if(!h.isSuture)continue;e.checkCache(l,jc.getCache(h.model),0).relate===0&&c.push(h)}return c}rmSutViasInResult(e,r){let i=new FI,n=new De("delete suture via");for(let s of e){let a=this.searchSutureVia(i,r,s);for(let l of a)if(l.net==r.net&&ve(this.radius*2,2)==ve(l.radius*2,2)&&ve(this.innerRadius*2,2)==ve(l.holeRadius*2,2)){let c=Ce.dispatch(l,"delete");n.addCommand(c),l.remove(),A.publish("delete",l)}}n.length&&qe.executeCommand(n),A.publish("flushService","")}};var O0e=class extends bi{constructor(t){super(),this.option=t}open(){if(!(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype))return this.getDialogData(this.option)}getDialogData(t){let e=R.getInstance().unit,r=new dt;return{action:"attribute-auto-place-sut-via",diameter:r.conversion("mil",e,t.radius*20),innerDiameter:r.conversion("mil",e,t.innerRadius*20),lineSpacing:r.conversion("mil",e,t.lineSpacing*10),columnSpacing:r.conversion("mil",e,t.columnSpacing*10),unit:e,ids:t.ids}}modify(t){}close(t){return!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype?void 0:(t.action=="confirm"&&new E0e(t).handler(),!0)}};var A0e=class extends bi{constructor(t){super(),this.option=t}open(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e={};return e.action="delete-element",this.option!=null&&(e.extra=this.option),e}modify(t){}close(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e=t.action,r=t.status,i=fF.getInstance();return e=="confirm"?(i.execute("deleteAll"),i.changeDefSelect(r,"deleteAll")):e=="cancel"?(i.execute("remainComponent"),i.changeDefSelect(r,"remainComponent")):e=="close"&&(i.execute("remainAll"),he.publish("tool","dropdrag")),!0}};var _0e=class extends bi{constructor(t){super(),this.option=t}open(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e={};return e.action="combination-cancel",this.option!=null&&(e.extra=this.option),e}modify(t){}close(t){return!0}};var n$=re.getInstance(),v0e=class extends bi{constructor(t){super(),this.dialogType="pcb-batch-fanout",this.data=t}open(t){return this.getDialogMessage()}async modify(t){if(!(!R.getInstance().isactive||![3].includes(R.getInstance().doctype)))if(t.action==="apply"){let e=t.formData,r=ze.getSelects(),{message:i}=await he.messageBus.rpcCall("batchFanout",{items:r,config:e});i||he.publish("ui/toastMsg",{type:"info",msg:"Please select the component or pad to fanout on the canvas"},Q())}else he.publish("refreshBatchFanoutDialog",this.getDialogMessage(),Q())}close(t){}getDialogMessage(){let t=n$.getDefaultBlindPhysics(),e=R.getInstance().unit,r=t.getOptions(),i=this.getViaLayerOptions(),n=this.getDefaultTrackRule(),s=this.getDefaultViaSizeRule(),a=this.getBlindViaSizeRule(),l={unit:e,blindRuleOptions:r,viaLayerOptions:i,defaultTrackRule:n,defaultViaSizeRule:s,blindViaRules:a};return{action:this.dialogType,data:l}}getViaLayerOptions(){let t=new Array,e=Ze.getInstance().getAllItem();for(let r of e)r.config&&(ns(r.type)||mu(r.type))&&t.push({text:r.name,value:r.layerId});return t}getDefaultTrackRule(){let t=n$.getDefaultTrackPhysics();return{defaultWidth:this.getNum(t.getDefaultWidth())}}getDefaultViaSizeRule(){let t=n$.getDefaultRadiusPhysics();return{defaultDiameter:this.getNum(t.defalutRadius)*2,defaultInnerDiameter:this.getNum(t.defalutInner)*2}}getBlindViaSizeRule(){let t=[],e=n$.getDefaultBlindPhysics().getAllVias();for(let r of e){let i=n$.getRadiusPhysicsByName(r.viaSizeRule);t.push({blindViaName:r.name,ViaSizeRule:{defaultDiameter:this.getNum(i.defalutRadius)*2,defaultInnerDiameter:this.getNum(i.defalutInner)*2}})}return t}getNum(t){return t*10}};var x0e=class extends bi{constructor(t){super(),this.option=t}open(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e={};return this.option!=null&&(e.extra=this.option),e.action="join-net-group",e}modify(t){}close(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;if(t.action=="confirm"){let r=t.isNetClass?re.getInstance().getNetClass(t.netGroup):re.getInstance().getEqualLengthGroup(t.netGroup);t.nets.map(i=>{let n=re.getInstance().getNet(i);r instanceof $h?r.addNetwork(n):r.addEqualLengthGroup(n),Kf(i)}),t.isNetClass?A.publish("forceRenderTree",xl.NetClasses,Q()):A.publish("forceRenderTree",xl.EqualLengthGroups,Q()),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q())}return!0}};var R0e=class extends bi{constructor(t){super(),this.tool=t}open(t){return{action:"commonly-value-input",forms:[{type:"text",key:"input-value",value:this.tool.getColumns(),tips:"",title:"",inputStatus:"selectAll"}],verificationType:1}}modify(t){}close(t){if(t.action=="confirm"){let r=parseInt(t["input-value"]);!isNaN(r)&&!ne.less(r,.01)&&this.tool.setColumns(r)}return!0}};var D0e=class extends bi{constructor(t,e,r){super(),this.option=t,this.tool=e,this.allReuseGroupInfo=r}open(t,e){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let r={};return r.action="reuse_layout_route",this.option!=null&&(r.extra=this.option),this.tool.drawing=!1,this.tool._isDialogOpen=!0,r}modify(t){}close(t){let{position:e,fac:r,others:i}=this.tool.otherInfo,{templateData:n}=this.option,{action:s}=t;if(s==="confirm")this.tool.drawing=!0;else return this.tool._isDialogOpen=!1,A.publish("tool","dropdrag"),!0;let a=this.handleTemplateData(t),l=n.templateInfos[0].id;return a.length==0&&i.length==0?(this.tool.sendMessage("No exact matching",null),A.publish("tool","dropdrag")):this.tool instanceof UD&&this.tool.hasLock(a,e,r,i,l),this.tool._isDialogOpen=!1,!0}handleTemplateData(t){let{templateInfo:e,allNotMatch:r}=t;if(r)return[];if(this.allTemplateNotMatch(e))return[];let i=[],n=new Set;for(let a of e){let l=a.id;if(a.match.id===""){n.add(l);continue}for(let c of this.allReuseGroupInfo.reuseMap){let h;if(l===c.templateInfo.id){for(let u of c.matchList)u.id===a.match.id&&(h=u);c.matchList.length=0,c.matchList.push(h)}}}let s=[];for(let a of this.allReuseGroupInfo.reuseMap)n.has(a.templateInfo.id)||s.push(a);this.allReuseGroupInfo.reuseMap.length=0;for(let a of s)this.allReuseGroupInfo.reuseMap.push(a);return i.push(this.allReuseGroupInfo),i}allTemplateNotMatch(t){let e=!0;for(let r of t)if(r.match.id!==""){e=!1;break}return e}};var w0e=class extends bi{constructor(){super()}open(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e={};return e.action="pinDelayManager",e.value=$o.getInstance().getAllCompPadLenInfo(),e}modify(t){}close(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;if(t.action=="confirm"){let r=[],i=t.value.value,n=t.value.unit,s=$o.getInstance(),a=new dt,l=[];for(let c of i){let h=c.hashId,u=!1;for(let d of c.pads)if(d.padLen!=null){let p=a.conversion(n,"mil",d.padLen)/10,m=s.getPadLen(h,d.hashId);if(!ne.eq(p,m)){let g=Qt.getItem(d.hashId);l.push(g),u=!0}}u&&r.push(c)}if($o.getInstance().updatePadLen(t.value),l.length>0){let c=new Qd("2.0",R.getInstance().doctype,R.getInstance().compiler),h=new Set;l.forEach(u=>{Ye.modifyNet(u.net),c.feed("PAD_NET",u.model),h.add(u.net)}),h.forEach(u=>{Ye.getNetLength(u)}),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),A.publish("flushService","")}}return!0}};var R5=class R5{constructor(){this._netLists={};this.refreshNetLists(),A.subscribe("closeDialogAndRebuildCopper",this.rebuildCopper.bind(this))}static getInstance(){return R5.manager==null&&(R5.manager=new R5),R5.manager}get netLists(){return this._netLists}setNetLists(t){if(t)for(let[,e]of Object.entries(t)){let{net:r,checked:i,requiredQuantity:n}=e;this._netLists[r]&&(this._netLists[r]={checked:i,requiredQuantity:n})}}refreshNetLists(){let t=Ye.getAllNets(),e=Object.keys(this._netLists);t.forEach(r=>{this._netLists[r]||(this._netLists[r]={checked:!0,requiredQuantity:1})}),e.forEach(r=>{t.includes(r)||delete this._netLists[r]})}rebuildCopper(){this.needRebuild&&A.publish("rebuildCopperRegionDialog",{msg:"Test point have been placed,do you want to rebuid the copper area?"})}};R5.manager=null;var D5=R5;var mC=class mC{static publishLog(t,e){let{type:r,message:i,timeStamp:n}=t;switch(e){case"start":A.publish("bottomBarLogGroupStart","Log",Q()),A.publish("logI18nLogView1",{timeStamp:n,type:r,msg:i,openTab:!0},Q());break;case"content":A.publish("bottomBarLog",{timeStamp:n,type:r,msg:i,openTab:!0},Q());break;case"end":A.publish("logI18nLogView1",{timeStamp:n,type:r,msg:i,openTab:!0},Q()),A.publish("bottomBarLogGroupEnd","Log",Q());break}}static logStartGeneratingTestPoints(){this.publishLog({timeStamp:new Date().getTime(),type:"info",message:[{text:"Start generating test points"}]},"start")}static formatPads(t){return t.map(e=>({text:`(${ve(e.center.x,2)}, ${ve(e.center.y,2)}) , `,call:{cmd:"showAndUpdateCross",args:e.center}}))}static formatNets(t,e){return t.map(r=>({text:r,attr:{id:e(r).map(i=>i.globalIndex),pcbid:R.getInstance().tabId}}))}static logRemoveTestPoints(t,e,r){this.publishLog({timeStamp:r,type:"info",message:['<span class="i18n">remove test points</span>',String(e.length),'<span class="i18n">item</span>',...this.formatPads(e)]},"content")}static logGenerateTestPoints(t,e,r){let i=e.map(n=>({text:n.num,attr:{id:n.globalIndex,pcbid:R.getInstance().tabId}}));this.publishLog({timeStamp:r,type:"info",message:[{text:t,attr:{id:Ye.getSameNetItems(t).map(n=>n.globalIndex),pcbid:R.getInstance().tabId}},'<span class="i18n">generates test points</span>',String(e.length),'<span class="i18n">item</span>',...i]},"content")}static logDRCViolation(t,e){this.publishLog({timeStamp:e,type:"info",message:[String(t.length),'<span class="i18n">net have no test points generated because of DRC violations</span>',...this.formatNets(t,r=>Ye.getSameNetItems(r))]},"content")}static logRequiredNumberMet(t,e){this.publishLog({timeStamp:e,type:"info",message:[String(t.length),'<span class="i18n">net have no test points generated because the required number of test points was met</span>',...this.formatNets(t,r=>Qt.getAllTestPad().filter(i=>i.net===r))]},"content")}static logNoTracksNets(t,e){this.publishLog({timeStamp:e,type:"info",message:[String(t.length),'<span class="i18n">net have no test points generated because there were no regions to generate</span>',...this.formatNets(t,r=>Ye.getSameNetItems(r))]},"content")}static logCurrentNetCoverage(t,e,r){let i=new Date().getTime(),n=r.toFixed(1);this.publishLog({timeStamp:i,type:"info",message:mz("Current Run: Net Coverage {0}% (Successfully Added Nets: {1} / Target Nets: {2})",{params:{0:n,1:t,2:e}})},"content")}static logGlobalCoverage(t,e,r){let i=new Date().getTime(),n=r.toFixed(1);this.publishLog({timeStamp:i,type:"info",message:mz("Global Testpoint Coverage: {0}% (Total Covered Nets: {1} / Total Nets: {2})",{params:{0:n,1:t,2:e}})},"content")}static logFinishGeneratingTestPoints(){this.publishLog({timeStamp:new Date().getTime(),type:"info",message:[{text:"Finish generating test points"}]},"end")}static clear(){mC.deleteMap=new Map,mC.addMap=new Map,mC.violateDRC=new Map,mC.overNum=new Map,mC.noTracksNetSet=new Map}};mC.deleteMap=new Map,mC.addMap=new Map,mC.violateDRC=new Map,mC.overNum=new Map,mC.noTracksNetSet=new Map;var dc=mC,GOe=class{constructor(){this.nodes=new Set,this.edges=new Map}addNode(t){this.nodes.add(t)}addEdge(t,e,r){this.edges.has(t)||this.edges.set(t,[]),this.edges.get(t).push({track:e,index:r,visited:!1})}markEdgeVisited(t,e,r){let i=this.edges.get(t);if(i){let n=i.find(s=>s.track===e&&s.index===r);n&&(n.visited=!0)}}isEdgeVisited(t,e,r){let i=this.edges.get(t);if(i){let n=i.find(s=>s.track===e&&s.index===r);return n?n.visited:!1}return!1}getEdgeId(t){return t.map(e=>e.globalIndex).sort().join("-")}getTracks(){let t=new Set;for(let[,e]of this.edges)for(let r of e)r.track.length&&r.track.forEach(i=>t.add(i));return Array.from(t)}},UOe=class{constructor(t){this.ignoreDRC=t,this.visitedObjMap=new Map}createVisitedObjForCluster(t){let e=this.getVisitedObjForCluster(t);if(e)return e;let r;return this.ignoreDRC?r=new Array:r=this.buildVisitedObj(),this.visitedObjMap.set(t,r),r}getVisitedObjForCluster(t){return this.visitedObjMap.get(t)}buildVisitedObj(){return{visitedPads:new Map,visitedVias:new Map,visitedTracks:new Map}}},HOe=class{constructor(t){this.depth=0;this.maxDepthCache=new Map;this.exceedCount=new Map;this.exceedThreshold=t}getMaxDepth(t,e){if(!this.maxDepthCache.has(t)){let r=e();this.maxDepthCache.set(t,r)}return this.maxDepthCache.get(t)}incrementDepth(){this.depth++}decrementDepth(){this.depth--}hasExceededMaxDepth(t){return this.depth>=t}checkExceed(t){let e=this.exceedCount.get(t)||0;return e++,this.exceedCount.set(t,e),e>=this.exceedThreshold}reset(){this.depth=0}getExceedCount(t){return this.exceedCount.get(t)||0}},L0e=class{constructor(t){this.init(t)}init(t){let{commonOptions:e,testPointOptions:r,netLists:i}=t;this.commonOptions=e,this.testPointOptions=r,this.step=this.calculateStep(),this.netLists=i.filter(n=>n.checked),this.groupCommand=new De("Execute Auto Place Test Pad Service"),D0.onlyCheck=!0,D5.getInstance().needRebuild=!1,this.commonOptions.ignoreDRC||(this.recursionManager=new HOe(3))}execute(){if(Cn("$$ AutoPlaceTestPadService"),!this.netLists.length)return;dc.logStartGeneratingTestPoints();let t=this.commonOptions.operationType;t==="Add"?this.handleAdd():t==="Remove"&&this.handleDelete(),this.groupCommand.length>0&&qe.executeCommand(this.groupCommand),this.complete(),Xi("$$ AutoPlaceTestPadService")}complete(){A.publish("flushService",""),this.publishErrorLog(),dc.clear(),$i.getInstance().useForceModelPairClearance=!1,this.testPointCache=null,this.recursionManager=null}handleAdd(){this.commonOptions.removeExisting&&this.handleDelete(),this.commonOptions.allowedWithinComponent||(this.componentLists=Ar.getAllItem());let e=this.filterSatisfyQuantity(),r=this.divideEffectiveScope(e);this.run(r,e),this.rebuildCopper()}handleDelete(){let t=this.netLists.map(i=>i.net),e=Qt.getAllTestPad().filter(i=>!i.getParent()&&t.includes(i.net));switch(this.commonOptions.layer){case"Only Top":e=e.filter(i=>i.layerId==1);break;case"Only Bottom":e=e.filter(i=>i.layerId==2);break}e.forEach(i=>{let n=Ce.dispatch(i,"delete");this.groupCommand.addCommand(n),i.remove();let s=dc.deleteMap.get(i.net)||{pads:[],timeStamp:new Date().getTime()};dc.deleteMap.set(i.net,{pads:[...s.pads,i],timeStamp:s.timeStamp})})}divideEffectiveScope(t){let e=t.map(s=>s.net);e.forEach(s=>{Ye.getSameNetItems(s,l=>l instanceof Ge).length==0&&dc.noTracksNetSet.set(s,new Date().getTime())});let r=pr.getAllItem().filter(s=>e.includes(s.net));switch(this.testPointOptions.singleLayer&&(r=r.filter(s=>[1,2].includes(s.layerId))),this.commonOptions.layer){case"Only Top":r=r.filter(s=>s.layerId==1);break;case"Only Bottom":r=r.filter(s=>s.layerId==2);break}return r}filterSatisfyQuantity(){let t=new Array;for(let e of this.netLists){let{net:r,requiredQuantity:i}=e,n=Ye.getSameNetItems(r,s=>s instanceof Le&&s.isTestPad);if(i<=n.length){dc.overNum.set(r,new Date().getTime());continue}n.length>0&&(e.requiredQuantity=e.requiredQuantity-n.length),t.push(e)}return t}compareClusters(t,e){var s,a;let r=l=>l===1?0:l===2?1:2,i=r((s=t.graph.getTracks()[0])==null?void 0:s.layerId),n=r((a=e.graph.getTracks()[0])==null?void 0:a.layerId);return i-n}buildCluster(t,e,r){let i=[t];for(r.add(t);i.length>0;){let n=i.shift();if(n instanceof Ge){let s=n.searchCycleNode();for(let a of s){if(a instanceof Le||a instanceof Ue){e.addNode(a);let l=new au(n,!0).all,c=Array.from(l);e.addEdge(a,c,e.getEdgeId(c))}r.has(a)||(r.add(a),i.push(a))}}}}clusterTracks(t){let e=new Map,r=new Set;for(let i of t)if(!r.has(i)){let n=new GOe;this.buildCluster(i,n,r);let s=Array.from(n.nodes).filter(c=>c instanceof Le),a=Array.from(n.nodes).filter(c=>c instanceof Ue),l={pads:s,vias:a,graph:n,isFull:!1};e.has(i.net)?e.get(i.net).push(l):e.set(i.net,[l])}for(let[i,n]of e)n.sort((s,a)=>this.compareClusters(s,a));return e}rebuildCopper(){for(let{pads:t}of dc.addMap.values())for(let e of t){let r=this.getModelPair(e,!0),i=k6(r);if(D0.checkSpacing(i).fail.length>0){D5.getInstance().needRebuild=!0;break}}}breakPrimitives(t,e,r){let i=[],n=this.testPointOptions.singleLayer?3:4,s=[...e.pads,...e.vias],a=e.graph.getTracks();for(let c of t){let h=c.start(),u=c.end(),d=h,m=s.flatMap(y=>{let b=y.layerId===12?2:1,P=this.step+r.getItemMaxClearance(b,[n]),T=y.getMathGraphics(a[0].layerId,P);return this.findIntersections(c,T)}).sort((y,b)=>y.distance1(h)-b.distance1(h));for(let y of m){let b;c instanceof M?b=new M(d,y):c instanceof q&&(b=q.build4(d,y,c.center,c.rx,c.ry,c.sweep())),b&&i.push(b),d=y}let g;c instanceof M?g=new M(d,u):c instanceof q&&(g=q.build4(d,u,c.center,c.rx,c.ry,c.sweep())),g&&i.push(g)}return i.filter(c=>!s.some(h=>h.center.equals1(c.start())||h.center.equals1(c.end())))}calculateStep(){let{shape:t,rotationAngle:e}=this.testPointOptions,{diaMeter:r,width:i,height:n,ratio:s}=this.getShapeSpecificConfigs(t,this.testPointOptions),a=Yl(parseFloat(e))/180*Math.PI,l,c=(h,u)=>{let d=Math.abs(h*Math.cos(a))+Math.abs(u*Math.sin(a)),p=Math.abs(h*Math.sin(a))+Math.abs(u*Math.cos(a));return{rotatedWidth:d,rotatedHeight:p}};switch(t){case"ELLIPSE":l=r/2;break;case"RECT":case"OVAL":{let{rotatedWidth:h,rotatedHeight:u}=c(i,n);l=Math.max(h,u)/2;break}default:throw l=r/2,new Error(`TestPad Error calculateStep: ${t}`)}return l}ignoreDRCPlaceTestPad(t,e,r){for(let i of t)if(!e.some(n=>n.equals1(i))){if(!this.commonOptions.allowedWithinComponent&&this.componentLists.some(l=>l.buildBBox().isContains(i)))continue;e.push(i);let n=this.placeTestPad(i,r),s=dc.addMap.get(r)||{pads:[],timeStamp:new Date().getTime()};return dc.addMap.set(r,{pads:[...s.pads,n],timeStamp:s.timeStamp}),this.add2Command(n),!0}return!1}ignoreDRCGenerateAl(t,e,r,i){this.testPointCache||(this.testPointCache=new Map);let n=`${e}-${t}`;if(this.testPointCache.has(n)){let b=this.testPointCache.get(n);return this.ignoreDRCPlaceTestPad(b,i,e)}let{pads:s,vias:a,graph:l}=r,c=l.getTracks().flatMap(b=>b.primitive),h=re.getInstance().getSafeSpacingByNet(e,2),u=this.testPointOptions.singleLayer?3:4,d=h.getItemMaxClearance(u,[3,4]),p=[...s,...a],m=this.step*2+d,g=this.breakPrimitives(c,r,h),y=this.generatePoints(g,m).filter(b=>!p.some(P=>jr.inPolyline(b,P.getMathGraphics(l.getTracks()[0].layerId,d))));return this.testPointCache.set(n,y),this.ignoreDRCPlaceTestPad(y,i,e)}generateTestPointAl(t,e,r,i){var x;this.recursionManager.reset();let{pads:n,vias:s,graph:a}=r,{visitedPads:l,visitedVias:c}=i,h,u,d=!1;if(n.length&&l.size<n.length?(h=n,u=l):s.length&&c.size<s.length?(h=s,u=c):d=!0,d){let v=a.getTracks(),D=v.flatMap(F=>F.primitive),w=this.generatePoints(D,this.step*2+1);return w&&w.length?this.checkTestPadDRCError(t,e,v,w)?(r.isFull=!0,!1):!0:(r.isFull=!0,!1)}let p=h.find(v=>!u.has(v));if(!p)return r.isFull=!0,!1;let m,g,y,b,P=a.edges.get(p);if(!P)return r.isFull=!0,!1;let T=!1,I=0,C=10,E=re.getInstance().getSafeSpacingByNet(e,2),O=this.testPointOptions.singleLayer?3:4,_=E.getItemMaxClearance(O,[3,4]);for(;;){if(I>=C)return dc.violateDRC.set(e,new Date().getTime()),console.warn(`$$ AutoTestPad Max retries reached for net: ${e}. Forcing termination.`),!0;let v=!1;for(let w=0;w<P.length;w++){if(b=P[w],b.visited)continue;let F=b.track,H=(x=F.find(V=>p.model instanceof et&&p.model.isUnuseLayer(V.layerId)))==null?void 0:x.layerId,z=p.model.getMathGraphics(H!=null?H:F[0].layerId,this.step+_);for(let V of F)if(g=this.findIntersections(V.primitive,z),T||(g=g.filter(W=>W.length&&!Array.from(u.values()).some(L=>jr.inPolyline(W,L)))),g.length){y=F,m=p.model.getMathGraphics(H!=null?H:F[0].layerId),v=!0;break}if(v)break}if(v)if(u.set(p,m),this.checkTestPadDRCError(t,e,y,g)){if(b.visited=!0,P.some(F=>!F.visited))continue}else return!0;else b.visited=!0,T=!0,u.set(p,p.model.getMathGraphics(b.track[0].layerId));let D=this.findUnvisitedEdgeParams(a);if(!D){this.clusters.get(e).length==1&&dc.violateDRC.set(e,new Date().getTime());break}p=D.item,P=D.edgeParams,I++}return r.isFull=!0,!1}findUnvisitedEdgeParams(t){for(let[e,r]of t.edges)if(r.findIndex(n=>!n.visited)!==-1)return{item:e,edgeParams:r};return null}pointInPrimitive(t,e){let r=!1;return e instanceof M?r=Da(t,e.start(),e.end(),.01):e instanceof q&&(r=$0(t,e.center,e.rx,e.startAngle/180*Math.PI,e.endAngle()/180*Math.PI,e.sweep(),.01)),r}findCluster(t){let e=t.filter(n=>!n.isFull),r=e.findIndex(n=>n.pads.length>0);if(r!==-1)return r;let i=e.findIndex(n=>n.vias.length>0);return i!==-1?i:t.length>0?0:null}run(t,e){if(e.length==0)return;this.clusters=this.clusterTracks(t);let r=this.commonOptions.ignoreDRC;for(let i of e){let n=new UOe(r),{net:s,requiredQuantity:a}=i,l=this.clusters.get(s);if(!l)continue;let c=a,h=l.length,u=this.findCluster(l);if(u===null)continue;let d=0;for(;c>0;){let p=!1;for(let m=0;m<h;m++){let g=(u+d+m)%h,y=l[g];if(!y.isFull){if(r){let b=n.createVisitedObjForCluster(g);p=this.ignoreDRCGenerateAl(g,s,y,b)}else{let b=n.createVisitedObjForCluster(g);p=this.generateTestPointAl(g,s,y,b)}if(p){c--,d=(d+m+1)%h;break}}}if(!p){dc.violateDRC.set(s,new Date().getTime());break}}}}getModelPair(t,e=!1){let r=[],i=hae([t]),n=uae(i),s=new P1;return n.forEach((a,l)=>{for(let c of a)if(e)c instanceof or&&c.type=="Copper Region"&&nV(s,l,c).forEach(h=>{c&&r.push([l,c,h])}),(c instanceof hn||c instanceof yn)&&nV(s,l,c).forEach(h=>{c&&r.push([l,c,h])});else{if(c instanceof or&&c.type=="Copper Region"||c instanceof hn||c instanceof yn||c instanceof gt&&c.net==l.net)continue;if(!this.commonOptions.allowedWithinComponent&&c instanceof Bi&&(l.layerId===12||l.layerId===c.layerId)){$i.getInstance().useForceModelPairClearance||($i.getInstance().useForceModelPairClearance=!0),r.push([l,c,3]),$i.getInstance().ruleHelper.setModelPairClearance(.1,l,c,ay(l.layerId,c.layerId),3),l.layerId===12&&(r.push([l,c,0]),$i.getInstance().ruleHelper.setModelPairClearance(.1,l,c,ay(l.layerId,c.layerId),0));continue}s.checkSameNet=!0,nV(s,l,c).forEach(h=>{c&&r.push([l,c,h])}),s.checkSameNet=!1}}),r}checkTestPadDRCError(t,e,r,i,n,s=!1){let a=`${e}-${t}`,l=this.recursionManager,c=l.getMaxDepth(a,()=>{let u=re.getInstance().getSafeSpacingByNet(e,2),d=this.testPointOptions.singleLayer?3:4,p=u.getItemMaxClearance(d,[3,4]),m=this.step*2+p,g=r.flatMap(P=>P.primitive),y=this.clusters.get(e)[t].pads.filter(P=>!P.isTestPad),b=this.generatePoints(g,m).length*3+y.length;return b>50?50:b});if(l.hasExceededMaxDepth(c)){if(l.checkExceed(a))return dc.violateDRC.set(e,new Date().getTime()),this.clusters.get(e)[t].isFull=!0,console.warn(`$$ Max recursion depth exceeded threshold for net: ${e}.`),!1;console.warn(`$$ Max recursion depth exceeded for net: ${e} , times:${l.getExceedCount(a)}`)}else l.incrementDepth();let h=r.flatMap(u=>u.primitive);if(i.length===1){let u=this.placeTestPad(i[0],e);this.add2Command(u);let d=this.getModelPair(u),p=k6(d),m=D0.checkSpacing(p);return m.fail.length?this.handleDRCError(u,m,h,i,n,t,e,r,s):this.handleNoDRCError(u,t,e,r,i,s)}else{let u=null,d=1/0;for(let p of i){let m=this.placeTestPad(p,e);this.add2Command(m);let g=this.getModelPair(m),y=k6(g),b=D0.checkSpacing(y);b.fail.length<=d?(u&&(this.add2Command(u,"delete"),Qt.delete(u),u.remove()),d=b.fail.length,u=m):(this.add2Command(m,"delete"),Qt.delete(m),m.remove())}if(u){let p=this.getModelPair(u),m=k6(p),g=D0.checkSpacing(m);return g.fail.length?this.handleDRCError(u,g,h,i,n,t,e,r,s):this.handleNoDRCError(u,t,e,r,i,s)}}return l.decrementDepth(),!1}handleDRCError(t,e,r,i,n,s,a,l,c){let h=-1/0,u;if(e.fail.every(p=>{let m=p.id1===t.globalIndex?ch(p.id2):ch(p.id1);return m instanceof ss&&m.type==="TearDrop"})){let p=dc.addMap.get(a)||[],m;return Array.isArray(p)?m={pads:p,timeStamp:new Date().getTime()}:m=p,dc.addMap.set(a,{pads:[...m.pads,t],timeStamp:m.timeStamp}),!1}for(let p of e.fail){let m=p.id1==t.globalIndex?ch(p.id2):ch(p.id1);if(m instanceof ss&&m.type=="TearDrop")continue;let g=0;m instanceof Bi?g=.1:{clearance:g}=$i.getInstance().ruleHelper.getShape2Clearance(t.model,m,void 0,p.holeState);let y=g+p.distance;if(y>h){h=y;let b=m.getMathGraphics(p.collideLayerIds[0]==12?1:p.collideLayerIds[0]);u=XP.zoomPolygon(b,h+this.step)}}if(u){let m=r.flatMap(g=>this.findIntersections(g,u)).filter(g=>g.length).filter(g=>!i.some(y=>y.equals1(g)));if(n&&(m=m.filter(g=>!jr.inPolyline(g,n))),m.length){if(this.add2Command(t,"delete"),Qt.delete(t),t.remove(),this.checkTestPadDRCError(s,a,l,m,u,c))return!0}else return this.add2Command(t,"delete"),Qt.delete(t),t.remove(),!0}return!1}handleNoDRCError(t,e,r,i,n,s){if(!s){let a=this.clusters.get(r)[e];a.pads.push(t),a.graph.addEdge(t,i,a.graph.getEdgeId(i));let l=dc.addMap.get(r)||{pads:[],timeStamp:new Date().getTime()};dc.addMap.set(r,{pads:[...l.pads,t],timeStamp:l.timeStamp})}return!1}findIntersections(t,e){let r=t.end(),i=t.bbox(),n=new Ta;n.add(r);for(let a of e.primitives){let l=a.bbox();if(!i.isIntersect(l))continue;let c=Pt(t,a);for(let h=0;h<c;h+=2){let u=new S(Ee[h],Ee[h+1]);n.add(u)}}let s=this.sortInters(n,t);if(s.length>0)return s.filter(a=>!a.equals1(r))}sortInters(t,e){let r=t.iterator(),i=new Array;for(;r.hasNext();){let n=r.next();i.push(n)}return an(i,e)}add2Command(t,e="add"){let r=Ce.dispatch(t,e);this.groupCommand.addCommand(r)}generatePoints(t,e){let r=[],i=0,n,s=(l,c,h)=>new S(l.x+h*(c.x-l.x),l.y+h*(c.y-l.y)),a=(l,c,h)=>{let u=[],d=h;if(l instanceof M){let p=l.start(),m=l.end();for(n=l.length();d<n;)u.push(s(p,m,d/n)),d+=c}else if(l instanceof q){n=l.length();let{startAngle:p,sweepAngle:m}=l;for(;d<n;){let g=d/n,y=p+g*m;u.push(l.pointOn(y)),d+=c}}return{points:u,remainingOffset:d-n}};return t.forEach(l=>{let c=a(l,e,i);r.push(...c.points),i=c.remainingOffset}),r}generateTestPadName(t){let e=Qt.getAllTestPad(),r=new Set(e.map(s=>{let a=s.getParent();return a&&a instanceof ke?a.designator+s.num:s.num})),i=1,n=t+i;for(;r.has(n);)i++,n=t+i;return n}getLayerCode(t,e,r){if(!e)return 12;switch(r){case"Only Top":return 1;case"Only Bottom":return 2;default:let{point:i,net:n}=t;for(let s of this.clusters.get(n)){let a=s.graph.getTracks().find(l=>l.isSelect(i.x,i.y));if(a)return a.layerId}}}convertValue(t){let e=parseFloat(t)/10;return rS(e)}getSolderConfigs(t){let e={};return[{key:"topSolder",configKey:"topSolder"},{key:"bottomSolder",configKey:"bottomSolder"},{key:"paste",configKey:"paste"},{key:"solder",configKey:"solder"}].forEach(i=>{let n=this.convertValue(t[i.key]);isNaN(n)||(e[i.configKey]=n)}),e}getShapeSpecificConfigs(t,e){let{diaMeter:r,width:i,height:n,ratio:s}=e,a={};switch(t){case"ELLIPSE":a.diaMeter=this.convertValue(r);break;case"RECT":a.width=this.convertValue(i),a.height=this.convertValue(n),a.ratio=Pa(s/100,2);break;case"OVAL":a.width=this.convertValue(i),a.height=this.convertValue(n);break}return a}getTestPointConfig(){let{singleLayer:t,numberPrefix:e,shape:r,diaMeter:i,width:n,height:s,ratio:a,rotationAngle:l,holeDiaMeter:c,isFollowRule:h,topSolder:u,bottomSolder:d,paste:p,solder:m}=this.testPointOptions;return{singleLayer:t,num:this.generateTestPadName(e),type:r,rotation:Yl(parseFloat(l))/180*Math.PI,holeDiaMeter:this.convertValue(c),isFollowRule:h,...this.getSolderConfigs({topSolder:u,bottomSolder:d,paste:p,solder:m}),...this.getShapeSpecificConfigs(r,{diaMeter:i,width:n,height:s,ratio:a})}}placeTestPad(t,e){(Ye.getItem(e)==null||Ye.getItem(e).size==0)&&(e="");let{singleLayer:r,num:i,type:n,diaMeter:s,width:a,height:l,ratio:c,rotation:h,holeDiaMeter:u,isFollowRule:d,topSolder:p,bottomSolder:m,paste:g,solder:y}=this.getTestPointConfig(),b=this.getLayerCode({point:t,net:e},r,this.commonOptions.layer),P=r?Math.min(a,l)*.3:u/2;s&&(a=s,l=s);let T,I,C,E;if(d){T=1;let w=re.getInstance();if(r){let F=w.getPasteExpansionByNet(e),H=w.getSolderExpansionByNet(e);b===1?(I=F.testPointTopExpansion,C=H.testPointTopExpansion):b===2&&(I=F.testPointBottomExpansion,E=H.testPointBottomExpansion)}else{let F=w.getSolderExpansionByNet(e);C=F.testPointTopExpansion,E=F.testPointBottomExpansion}}else T=2,r?(I=g,b===1?C=y:b===2&&(E=y)):(C=p,E=m);let O=a!=null?a:ut.defalutTestPad.topWidth,_=l!=null?l:ut.defalutTestPad.topHeight,x=c!=null?c:ut.defalutTestPad.topRatio,v=E!=null?E:ut.defalutTestPad.bottomSolderExpansion,D=Qt.addPad(b,1,"",t,n,O,_,x,n,O,_,x,n,O,_,x,h,!1,e,T,I,C,v,[],!0,ut.defalutTestPad.holeLength,P,ut.defalutTestPad.holeShape,ut.defalutTestPad.holeRotation,ut.defalutTestPad.holeOffset);return D.num=i,D.isTestPad=!0,D}publishErrorLog(){if((this.commonOptions.operationType=="Remove"||this.commonOptions.removeExisting)&&dc.deleteMap.forEach((n,s)=>{dc.logRemoveTestPoints(s,n.pads,n.timeStamp)}),dc.noTracksNetSet.size>0){let n=Array.from(dc.noTracksNetSet),s=n.map(([l])=>l),a=n[n.length-1][1];dc.logNoTracksNets(s,a)}if(this.commonOptions.operationType=="Add"&&dc.addMap.forEach((n,s)=>{dc.logGenerateTestPoints(s,n.pads,n.timeStamp)}),!this.commonOptions.ignoreDRC&&dc.violateDRC.size>0){let n=Array.from(dc.violateDRC),s=n.map(([l])=>l),a=n[n.length-1][1];dc.logDRCViolation(s,a)}if(dc.overNum.size>0){let n=Array.from(dc.overNum),s=n.map(([l])=>l),a=n[n.length-1][1];dc.logRequiredNumberMet(s,a)}if(this.commonOptions.operationType=="Add"&&this.netLists.length>0){let n=dc.addMap.size,s=n/this.netLists.length*100;dc.logCurrentNetCoverage(n,this.netLists.length,s)}let t=Qt.getAllTestPad(),e=new Set(t.map(n=>n.net)).size,r=Ye.getNetCount().size,i=e/r*100;dc.logGlobalCoverage(e,r,i),dc.logFinishGeneratingTestPoints()}};var M0e=class extends bi{constructor(){super();this.netListsStore=D5.getInstance()}getDialogData(){return this.netListsStore.refreshNetLists(),{action:"auto-place-test-pad",unit:R.getInstance().unit,netLists:this.netListsStore.netLists}}open(){if(!(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype))return this.getDialogData()}modify(e){}close(e){if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;if(e.action=="confirm"){this.netListsStore.setNetLists(e.netLists);let{commonOptions:i,testPointOptions:n,netLists:s}=e;new L0e({commonOptions:i,testPointOptions:n,netLists:s}).execute()}return!0}};var o$=class extends dh{constructor(e,r){super();this.lines=new Array;this.ps=e;let i=e.length;for(let n=0;n<i;n++){let s=e[n],a=new Gn(s,{color:r});this.lines.push(a)}}display(){for(let e of this.lines)e.display()}remove(){for(let e of this.lines)e.remove()}};var N0e=class{constructor(){this.objSpace=1;this.selectItems={lines:[],tracks:[],outlines:[],pads:[],fills:[],comps:[]};this.pointsNoDrc=[];this.viaPreviewData=[];this.validType=["Track","ArcTrack","Pad","Polygon","Rect","Circle","Component","Line","Arc"];this.outDiameter=Ys.getInstance().viaOutsideDiameter,this.insideDiameter=Ys.getInstance().viaInsideDiameter}getSelectItem(){return this.selectItems}get net(){return this._net||""}set net(t){this._net=t}updateSelectItems(t){this.clearSelectItems(),this.selectItems=this.filterItem(t)}resetGenerate(){let t=this.getFirstOutline(),e=t.out.length>0?this.mergeOutline(t.out):[],r=[];xe.addAll(r,e),xe.addAll(r,t.inner);let i=new N6(10),n=this.generateViaPos(r,0,i);this.pointsNoDrc=[n];let s=Math.abs(this.lineSpace)+Math.max(this.outDiameter,this.insideDiameter),a=[],l=[];for(let c=1;c<this.rowCount;c++){c==1&&(e.forEach(g=>{a.push(g.items[0]);for(let y=1;y<g.items.length;y++)l.push(g.items[y])}),t.inner.forEach(g=>{xe.addAll(l,g.items)}));let h=[];a.forEach(g=>{let y=V1.getExtendPolyLine(g,s);xe.addAll(h,y)});let u=h.length>0?this.mergeOutline(h):[],d=Array.from(u),p=[];l.forEach(g=>{let y=g.bbox();if(Math.abs(s)>y.width()||Math.abs(s)>y.height())return null;let b=X0(g,-s);xe.addAll(p,b)}),xe.addAll(d,p);let m=this.generateViaPos(d,c,i);this.pointsNoDrc.push(m),a=[],l=[],u.forEach(g=>{a.push(g.items[0]);for(let y=1;y<g.items.length;y++)l.push(g.items[y])}),p.forEach(g=>{xe.addAll(l,g.items)})}i.clear()}preview(t){let e=[];if(t){let r=[];this.pointsNoDrc.forEach(i=>{xe.addAll(r,i)}),e=this.getValidVia(r)}else return;this.clearPreview(),this.generateViaPreview(e)}clearPreview(){this.viaPreviewData.map(t=>t.remove()),this.viaPreviewData.length=0}generateViaFence(t){let e=[];if(t){let r=[];this.pointsNoDrc.forEach(i=>{xe.addAll(r,i)}),e=this.getValidVia(r)}else e=this.viaPreviewData.map(r=>r.center);if(e.length>0){let r=new De("add viaFence"),i=re.getInstance().getSolderExpansionByNet(this.net),n=[];e.forEach(s=>{let a=Wr.addVia(0,"",1,2,this.net||"",this.outDiameter/2,s,this.insideDiameter/2,!1,1,i.viaTopExpansion,i.viaBottomExpansion);a.partition=R.getInstance().partitionId,a.updateFilterVisible=!0,a.visible(),n.push(a.model),he.publish("hasModifyPcbItem",a),r.addCommand(Ce.dispatch(a,"add"))}),qe.executeCommand(r),he.publish("flushService",""),he.publish("ui/toastMsg",{type:"info",msg:"Placement Successful."},Q()),le.pcbConfig.isRebuildCopperAuto||this.checkDRCCopper(n)||he.publish("rebuildCopperRegionDialog",{msg:"Via Fence have been placed,do you want to rebuild the copper area?"})}else he.publish("ui/toastMsg",{type:"info",msg:"No vias have been placed. Please check and try again."},Q())}checkDRCVia(t){let e=i=>i[0]instanceof hn||i[1]instanceof hn?!1:!(i[0]instanceof yn||i[1]instanceof yn);return!(kR.checkSpacingError([t],{disableProgressFromWorker:!0,excludeCheckPair:e}).fail.length>0)}checkDRCCopper(t){D0.onlyCheck=!0;let e=new ef(xb());$i.getInstance().initialEnv(e);let r=!0;for(let i of t){let n=a=>a[0]instanceof hn||a[1]instanceof hn?!0:a[0]instanceof yn||a[1]instanceof yn;if(kR.checkSpacingError([i],{disableProgressFromWorker:!0,excludeCheckPair:n}).fail.length>0){r=!1;break}}return $i.getInstance().clear(),D0.onlyCheck=!1,r}generateViaPos(t,e,r){let i=[];t.forEach(h=>{xe.addAll(i,h.items)});let n=Math.max(this.outDiameter,this.insideDiameter)+this.viaSpace,s=Math.max(this.outDiameter,this.insideDiameter)+this.lineSpace,a=Math.max(n,s),l=[];i.forEach(h=>{let u=null,d=h.start(),p=[];c(d,p);for(let y=0;y<h.primitives.length;y++){let b=h.primitives[y],P=q.buildCircle(d,n),T=this.getIntersection(P,b).filter(C=>{if(u){if(C.distance2(u)<1e-4)return!1;if(b instanceof M){if(C.sub(d).dot(b.direct)>0)return!0}else if(b instanceof q){let E=this.getRelativeAngle(b,d);if(this.getRelativeAngle(b,C)>E)return!0}return!1}return!0}),I=T[0];if(T.length>1){if(b instanceof M){let C=b.start(),E=-1;T.forEach(O=>{let _=O.distance2(C);_>E&&(I=O,E=_)})}else if(b instanceof q){let C=null;T.forEach(E=>{let O=this.getRelativeAngle(b,E);if(C==null){I=E,C=O;return}O<C&&(I=E,C=O)})}}I?(u==null?u=b.start():u=d,d=I,c(d,p),y--):u=null}let m=h.start(),g=d;ne.less(m.distance1(g),n)&&p[p.length-1].p.equals(g)&&p.pop();for(let y of p)r.add(y),l.push(y.p)});function c(h,u){(r.items().length>0?r.search(h.bbox().extendOfSize(a)):[]).find(m=>{let g=m.p.distance1(h);return e==m.row?ne.less(g,n):ne.less(g,s)})||u.push(new WOe(h,e))}return l}getRelativeAngle(t,e){let r=zt.regularD(t.startAngle),i=ve(zt.regularD(e.angleD(t.center)-r),4);return t.sweep()==ae.CCW?zt.regularD(i):zt.regularD(360-i)}getViaModel(t,e){let r=new hg(`VIAFence_${e}`,0,"",1,2,[],this.net||"",this.outDiameter/2,t,this.insideDiameter/2,1,-100,-100,!1,null);return bn.getInstance().addModel(r),r}getValidVia(t){oi.getInstance().update();let e=new N6(10),r,n=re.getInstance().getOtherSpacingByNet(this.net).holeClearance+this.insideDiameter,s=!1,a=1;return t.forEach(l=>{if(!(e.items().length>0?e.search(l.bbox().extendOfSize(n)):[]).find(u=>u.distance1(l)<n)){if(!this.ignoreDrc){if(!s){D0.onlyCheck=!0;let d=new ef(xb());$i.getInstance().initialEnv(d),s=!0}r=this.getViaModel(l,a),a++;let u=this.checkDRCVia(r);if(bn.getInstance().delete(r,r.globalIndex),r.remove(),!u)return}e.add(l)}}),s&&(D0.onlyCheck=!1),fs.getInstance().clear(),Array.from(e.items())}generateViaPreview(t){let e=[],r=Math.max(this.outDiameter,this.insideDiameter)/2;t.forEach(i=>{let n=q.buildCircle(i,r);e.push(n)}),this.displayPolyline(e)}displayPolyline(t){if(t!=null){let e=Bb(t,1002);for(let r of e)r.color=ee.WHITE,this.viaPreviewData.push(r)}}getIntersection(t,e){let r=Pt(t,e);if(r>0){let i=[];for(let n=0;n<r;n+=2){let s=new S(Ee[n],Ee[n+1]);i.push(s)}return i}else return[]}showOutLines(t){t.forEach(e=>{if(Gr.inputDebugGraphics(new o$(e.items[0].primitives,ee.WHITE)),e.items.length>1)for(let r=1;r<e.items.length;r++)Gr.inputDebugGraphics(new o$(e.items[r].primitives,ee.RED))})}filterItem(t,e=this.objSpace>=0){let r={lines:[],tracks:[],outlines:[],pads:[],fills:[],comps:[]};for(let i of t)if(i instanceof He){let n=i.layerId,s=Pe.getLayer(n);if(s.type=="OUTLINE"||i.type=="Line"){if(i instanceof lt){let l=i.getMathGraphics();l instanceof ge&&l.isClose()?r.outlines.push(i):e&&r.lines.push(i)}else r.outlines.push(i);continue}if(!s.isCopperLayer())continue;switch(i.type){case"Fill Region":r.fills.push(i);break;default:break}}else i instanceof Le?r.pads.push(i):i instanceof ke?r.comps.push(i):i instanceof Ge&&e&&r.tracks.push(i);return r}validItem(t){let e=t.getParent();if(e&&e instanceof He&&(t=e),t instanceof He){let r=t.layerId,i=Pe.getLayer(r);if(i.type=="OUTLINE"||t.type=="Line")return t;if(!i.isCopperLayer())return null;switch(t.type){case"Fill Region":return t;default:return null}}else{if(t instanceof Le)return t;if(t instanceof ke)return t;if(t instanceof Ge)return t}return null}selectItem(t,e){this.clearSelectItems(),this.selectItems=this.filterItem(t,e);let r=[];for(let i in this.selectItems){let n=this.selectItems[i];xe.addAll(r,n)}ze.select(t)}clearSelectItems(){for(let t in this.selectItems){let e=this.selectItems[t];e.length=0}}getFirstOutline(){let t=[],e=[],r=this.objSpace,i=Math.abs(this.objSpace)*2+Math.max(this.outDiameter,this.insideDiameter);for(let a of this.selectItems.lines){let l=a.getMathGraphics();l instanceof ge&&l.primitives.forEach(c=>{t.push(c.stroke(i+a.strokeWidth,wr.ROUND,ae.CW))})}for(let a of this.selectItems.tracks){let l=a.getMathGraphics(a.layerId,i/2);t.push(l)}let n=Math.abs(this.objSpace)+Math.max(this.outDiameter,this.insideDiameter)/2;for(let a of this.selectItems.outlines){let l=a.getMathGraphics();s(l,n+a.strokeWidth/2)}for(let a of this.selectItems.pads)if(a instanceof _i)a.getFileGraphics(a.layerId,0).forEach(l=>{s(l,n)});else{let l=a.layerId==12?1:a.layerId,c=a.getMathGraphics(l);s(c,n)}for(let a of this.selectItems.fills){let l=a.getMathGraphics();s(l,n)}for(let a of this.selectItems.comps){let l=a.getMathGraphics();s(l,n)}function s(a,l){if(a instanceof ge){if(a.area()>0&&(a=a.reverse()),a.primitives.length==1&&a.primitives[0]instanceof q){let c=a.primitives[0];if(Math.abs(c.sweepAngle)==360&&ne.eq(c.rx,c.ry)){if(r>=0){let h=[];h.push(ge.build2([q.buildCircle(c.center,c.rx+l)])),xe.addAll(t,h)}else{let h=c.rx-l;if(h>0){let u=[];u.push(ge.build2([q.buildCircle(c.center,h)])),xe.addAll(e,[new Bt(u)])}}return{out:t,inner:e}}}if(r>=0){let c=V1.getExtendPolyLine(a,l,!1);xe.addAll(t,c)}else{let c=a.bbox();if(Math.abs(l)>c.width()||Math.abs(l)>c.height())return null;let h=X0(a,-l);xe.addAll(e,h)}}else s(a.items[0],l)}return{out:t,inner:e}}mergeOutline(t){let e=new Ec,r=t.map(i=>[i]);return e.getUnionForSingle(r)}},WOe=class{constructor(t,e){this.row=e,this.p=t}bbox(){return this.p.bbox()}};var k0e=class extends bi{constructor(){super();this.change=!1;let e=ze.getItems();this.items={},this.tool=new N0e,jt.dialog=this,ze.dialog=this,this.tool.selectItem(e),this.nets=Ye.getAllNets().toString(),this.hasSelect=e.length>0}open(e){let r=ze.getItems();return{action:"add-pcb-via-fence",unit:R.getInstance().unit,outSideD:this.tool.outDiameter*10,inSideD:this.tool.insideDiameter*10,netOptions:Ye.getNet(),hasSelect:r.length>0}}compareDataChange(e){let r=ze.getItems(),i=Object.keys(this.items),n=!1;if(i.length==r.length)for(let s of r){let a=s.buildBBox();if(this.items[s.globalIndex]!=a){n=!0;break}}else n=!0;if(n){this.items={};for(let s of r){let a=s.buildBBox();this.items[s.globalIndex]=a}return this.tool.updateSelectItems(r),!0}return this.change?(this.change=!1,!0):!ne.eq(e.outSideD,this.tool.outDiameter)||!ne.eq(e.inSideD,this.tool.insideDiameter)||this.tool.objSpace!=null||!ne.eq(e.objSpace,this.tool.objSpace)||!ne.eq(e.lineSpace,this.tool.lineSpace)||!ne.eq(e.viaSpace,this.tool.viaSpace)||!ne.eq(e.rowCount,this.tool.rowCount)}handleData(e){let r={outSideD:e.outSideD/10,inSideD:e.inSideD/10,objSpace:e.objSpace/10,lineSpace:e.lineSpace/10,viaSpace:e.viaSpace/10,rowCount:e.rowCount,ignoreDrc:e.ignoreDrc,net:e.net},i=this.compareDataChange(r);return this.tool.outDiameter=r.outSideD,this.tool.insideDiameter=r.inSideD,this.tool.objSpace=r.objSpace,this.tool.lineSpace=r.lineSpace,this.tool.viaSpace=r.viaSpace,this.tool.rowCount=r.rowCount,this.tool.net=r.net,this.tool.ignoreDrc=r.ignoreDrc,i&&this.tool.resetGenerate(),!0}modify(e){}close(e){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let r=e.type;if(r=="modify"){let i=this.tool.objSpace,n=e.objSpace/10;return this.change=this.tool.objSpace!=null||!ne.eq(i,n),this.tool.objSpace=n,i>=0&&n<0&&this.tool.selectItem(ze.getItems(),!1),!1}if(r=="preview"){let i=this.handleData(e);return this.tool.preview(i),!1}if(ze.dialog=null,jt.dialog=null,Ut.cancel(),this.tool.clearPreview(),r=="confirm"){let i=this.handleData(e);this.tool.generateViaFence(i)}return!0}update(){let e=ze.getItems().length>0,r=Ye.getAllNets().toString();(e!=this.hasSelect||this.nets!=r)&&(A.publish("pcbviaFenceUpdate",{netOptions:Ye.getNet(),hasSelect:e},Q()),this.hasSelect=e,this.nets=r)}};var B0e=class extends bi{constructor(t,e){super(),this.position=t,this.tool=e}open(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e={};e.action="pcb-move-tab";let r=R.getInstance().origin,i=this.position.x-r.x,n=this.position.y-r.y;return e.refPoint={x:i,y:n},e}modify(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e=t.position,r=R.getInstance().origin,i=new S(e.x,e.y).add(r);return this.tool.moveTo(i.x,i.y),this.tool.moveToCenterWhenOutOfFrame(),!0}close(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return;let e=t.action;if(e=="confirm"){let r=t.position,i=R.getInstance().origin,n=new S(r.x,r.y).add(i);this.tool.moveTo(n.x,n.y),this.tool.itemsMovedMouseUp(fi.getInstance())}else if(e=="SelectRefer"){let r=new uE(0,0,[(n,s)=>{let a=R.getInstance().origin;n-=a.x,s-=a.y,he.publish("openMainDialog",{cmd:48,data:{position:{x:n,y:s},tool:this.tool}})}]),i={command:"referencePoint",program:r,msg:"Please select a reference point"};he.publish("toggle",i)}return!0}};var F0e=class extends bi{open(t,e){return{action:"convert-board-to-line",unit:R.getInstance().unit,width:10,layerId:1,options:Un.fixLayerOptions(1,Un.createLayerOptionsByType("Line"))}}modify(t){}close(t){if(t.action=="confirm"){let r=us.getInstance().board;if(r){let{width:i,layerId:n}=t;i=i/10;let s,a=r.toJSON();a.layerId=n,a.strokeWidth=i,a.type="Line",r instanceof rr?s=Xt.copy(a):r instanceof Pr?s=Kt.copy(a):r instanceof lt&&(s=pt.copy(a));let l=new De("convert board to line");l.addCommand(Ce.dispatch(s,"add")),A.publish("hasModifyPcbItem",s),qe.executeCommand(l),A.publish("onlySelect",[s])}}}};var V0e=class extends bi{constructor(t){super(),this.option=t}open(t){return Object.assign(t||this.option||{},{action:"cutout-to-avoid-dialog"})}modify(t){}close(t){nce(t)}};var G0e=class{constructor(){A.subscribe("openMainDialog",this.getDialog.bind(this))}dispatch(t,e){switch(t){case 0:return new Wpe(e.option);case 1:return new nU(e.foots);case 2:return new Ype;case 4:return new jpe;case 5:return e!=null?new r$(e.option,e.tool):new r$;case 6:return new v0e(e.option);case 8:return new Xpe(e.option);case 9:return new qpe(e.option);case 35:return new T0e(e);case 36:return new x0e(e);case 34:return new P0e(e);case 10:return new Kpe(e.device);case 11:return new Zpe;case 14:return new Jpe(e.data);case 15:return new t0e(e.option);case 17:return new r0e(e.shape,e.tool);case 18:return new i0e(e.items,e.x,e.y);case 16:return new y0e(e);case 19:return new n0e(e.tool);case 40:return new O0e(e.option);case 47:return new M0e;case 20:return new s0e;case 21:return new a0e(e.shape,e.tool);case 22:return new l0e(e.option);case 23:return new c0e(e.option);case 24:return new h0e;case 25:return new u0e(e.text,e.x,e.y);case 26:return new d0e(e.tool);case 44:return new R0e(e.tool);case 37:return new I0e(e.tool);case 38:return new C0e(e.option);case 39:return new S0e(e.option);case 42:return new A0e(e.option);case 27:return new p0e(e.device);case 28:return new i$(e.tool,e.item);case 29:return new i$(e.tool,e.item);case 30:return new f0e(e.option);case 31:return new m0e(e.option);case 32:return new g0e(e.option);case 33:return new b0e(e.option);case 41:return new hde(e.option);case 43:return new _0e(e.option);case 45:return new D0e(e.info,e.tool,e.allReuseGroupInfo);case 46:return new w0e;case 12:return new k0e;case 48:return new B0e(e.position,e.tool);case 49:return new F0e;case 50:return new V0e(e)}}getDialog(t){A.publish("TempMaskRightClickMenu","");let e=this.dispatch(t.cmd,t.data);A.publish("openDialog",e)}};var jD=class jD extends Mc{constructor(t,e){super(jD.entityName,t,e)}isValid(){return!!this.entity.radius}parseEntity(t,e){let r=this.initEntity();e=t.next();let i=!1;for(;!this.isEof(e)&&e.code!==0;){switch(e.code){case 10:r.center=$s(t);break;case 40:r.radius=e.value;break;case 230:i=e.value==-1;break;default:Sd(r,e);break}e=t.next()}return i&&(r.center=r.center.mirrorY()),this}initEntity(){return this.entity={type:jD.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,center:null,radius:null},this.entity}multiply3(t){return super.multiply3(t),this.entity.center=this.vector2Multiply(this.entity.center,t),this.entity.radius=this.numberMultiply(this.entity.radius,t),this}bbox(){let t=this.entity,e=t.center.x-t.radius,r=t.center.y-t.radius,i=t.center.x+t.radius,n=t.center.y+t.radius;return new ht(e,i,r,n)}cloneOne(){let t=new jD(null,null);return t.entity=this.cloneEntity(),t}static circle(t,e){let r=new jD(null,null);return r.initEntity(),r.entity.center=t,r.entity.radius=e,r}entityDxfItems(){let t=this.entity;return t.layer=this.autoDefault(t.layer,"0"),super.entityDxfItems(),this.autoItem(5,t.handle),this.autoItem(100,"AcDbEntity"),Ed(this.dxfItems,t,"layer"),t.lineStroke&&this.autoItem(370,this.getLineStroke(t.lineStroke)),this.autoItem(100,"AcDbCircle"),ph(this.dxfItems,t.center,10),this.autoItem(40,t.radius),this.dxfItems}static builder(t){let e=new jD(null,null);return e.entity=t,e}};jD.entityName="CIRCLE";var yE=jD;var w5=class w5 extends Mc{constructor(t,e){super(w5.entityName,t,e)}cloneOne(){let t=new w5(null,null);return t.entity=this.cloneEntity(),t}isValid(){return this.validVertices(this.entity.vertexs)}parseEntity(t,e){let r={type:w5.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,elevation:null,depth:null,shape:null,hasContinuousLinetypePattern:null,numberOfVertices:null,vertexs:[],width:null,startWidth:null,endWidth:null,extrusionDirectionX:null,extrusionDirectionY:null,extrusionDirectionZ:null};for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 38:r.elevation=e.value;break;case 39:r.depth=e.value;break;case 70:r.shape=(e.value&1)===1,r.hasContinuousLinetypePattern=(e.value&128)===128;break;case 90:r.numberOfVertices=e.value;break;case 10:r.vertexs=r.vertexs.concat(this.parseLWPolylineVertices(r.numberOfVertices,t));break;case 43:e.value!==0&&(r.width=e.value);break;case 40:e.value!==0&&(r.startWidth=e.value);break;case 41:e.value!==0&&(r.endWidth=e.value);break;case 210:r.extrusionDirectionX=e.value;break;case 220:r.extrusionDirectionY=e.value;break;case 230:r.extrusionDirectionZ=e.value;break;default:Sd(r,e);break}e=t.next()}return r.shape&&(r.vertexs=J8(r.vertexs)),this.entity=r,this}parseLWPolylineVertices(t,e){if(!t||t<=0)throw Error("n must be greater than 0 verticies");let r=[],i=!1,n=!1,s=e.lastReadGroup;for(let a=0;a<t;a++){let l=new R3(null,null);for(l.initEntity();!this.isEof(s)&&!(s.code===0||n);){switch(s.code){case 10:if(i){n=!0;continue}i=!0,l.entity.center=$s(e);break;case 40:l.entity.startWidth=s.value;break;case 41:l.entity.endWidth=s.value;break;case 42:s.value!=0&&(l.entity.bulge=s.value);break;default:return e.rewind(),i&&r.push(l),e.rewind(),r}s=e.next()}l.isValid()?r.push(l):console.warn("vartex is bad data!"),i=!1,n=!1}return e.rewind(),r}multiply3(t){return super.multiply3(t),Sne(this.entity.vertexs,t),this.entity.width=this.numberMultiply(this.entity.width,t),this}bbox(){return this.verticesBBox(this.entity.vertices)}entityDxfItems(){let t=this.entity;return t.layer=this.autoDefault(t.layer,"0"),super.entityDxfItems(),this.autoItem(5,t.handle),this.autoItem(100,"AcDbEntity"),Ed(this.dxfItems,t,"layer"),this.autoItem(100,"AcDbPolyline"),this.autoItem(90,t.numberOfVertices),this.autoItem(70,t.shape?1:0),this.autoItem(38,t.elevation),this.autoItem(39,t.depth),this.autoItem(43,t.width),this.autoItem(40,t.startWidth),this.autoItem(41,t.endWidth),this.autoItem(210,t.extrusionDirectionX),this.autoItem(220,t.extrusionDirectionY),this.autoItem(230,t.extrusionDirectionZ),this.autoEncoderVertexs(this.dxfItems),this.dxfItems}autoEncoderVertexs(t){let e=this.entity.vertexs;for(let r of e){let i=r.entity;ph(t,i.center,10),i.bulge&&this.dxfItems.push([42,i.bulge])}}static builder(t){let e=new w5(null,null);return e.entity=t,e}};w5.entityName="LWPOLYLINE";var gC=w5;var L5=class L5 extends Mc{constructor(t,e){super(L5.entityName,t,e)}parseEntity(t,e){return null}initEntity(){return this.entity={type:L5.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,position:null,extrusionDirection:null,linkHandle:null,outlines:null,seedName:null},this.entity}isValid(){var t;return((t=this.entity.outlines)==null?void 0:t.length)>0}multiply3(t){let e=this.entity;e.position=this.vector2Multiply(e.position,t);let r=new Array(e.outlines.length),i=-1;for(let n of e.outlines)i++,r[i]=n.multiply3(t);return e.position=this.vector2Multiply(e.position,t),e.outlines=r,super.multiply3(t),this}bbox(){let t=new _e;return this.entity.outlines.forEach(e=>{t.ext1(e.bbox())}),t.build1()}cloneOne(){let t=new L5(null,null);return t.entity=this.cloneEntity(),t}entityDxfItems(){let t=this.entity;t.layer=this.autoDefault(t.layer,"0"),super.entityDxfItems(),this.autoItem(5,t.handle),this.autoItem(100,"AcDbEntity"),Ed(this.dxfItems,t,"layer"),this.autoItem(100,"AcDbHatch");let e=new Dt(0,0,1);return ph(this.dxfItems,t.position||e,10,0),ph(this.dxfItems,t.position||e,210),this.fillOutLineAndSeed(),this.dxfItems}fillOutLineAndSeed(){let t=this.entity.seedName;this.seedEncorder(t)}seedEncorder(t){let e=this.entity,r=e.outlines[0]instanceof yE,i=nn.convert(1,39.37,this.entity.unit||39.37);if(this.autoItem(2,t),this.autoItem(70,t==="SOLID"?1:0),this.autoItem(71,0),this.autoItem(91,e.outlines.length),this.autoEncorderOutline({name:t,isCircle:r}),t==="ANSI37")this.autoItem(97,1),this.autoItem(330,e.linkHandle),this.autoItem(75,0),this.autoItem(76,1),this.autoItem(52,0),this.autoItem(41,1),this.autoItem(77,0),this.autoItem(78,2),this.autoItem(53,45),this.autoItem(43,0),this.autoItem(44,0),this.autoItem(45,-2.245064030267287),this.autoItem(46,2.245064030267288),this.autoItem(79,0),this.autoItem(53,135),this.autoItem(43,0),this.autoItem(44,0),this.autoItem(45,-2.245064030267287),this.autoItem(46,-2.245064030267288),this.autoItem(79,0),this.autoItem(47,r?.8681437583925616:.0542074568195396),this.autoItem(98,1),this.autoItem(10,r?3.629517071192367:18.06657317416238),this.autoItem(20,r?33.92795499968543:5.650245182409889),this.autoItem(1001,"ACAD"),this.autoItem(1010,0),this.autoItem(1020,0),this.autoItem(1030,0);else if(t==="SOLID")this.autoItem(97,1),this.autoItem(330,e.linkHandle),this.autoItem(75,0),this.autoItem(76,1),this.autoItem(47,r?.8681437583925616:.4128176842155181),this.autoItem(98,1),this.autoItem(10,r?3.629517071192367:34.90568961886538),this.autoItem(20,r?33.92795499968543:22.81183545379326),this.autoItem(450,0),this.autoItem(451,0),this.autoItem(460,0),this.autoItem(461,0),this.autoItem(452,1),this.autoItem(462,1),this.autoItem(453,2),this.autoItem(463,0),this.autoItem(63,5),this.autoItem(421,255),this.autoItem(463,1),this.autoItem(63,7),this.autoItem(421,16777215),this.autoItem(470,"LINEAR"),this.autoItem(1001,"ACAD"),this.autoItem(1010,0),this.autoItem(1020,0),this.autoItem(1030,0);else throw new Error("not support this seed type: "+t)}autoEncorderOutline(t){let{isCircle:e}=t;for(let r=0;r<this.entity.outlines.length;r++){let i=this.entity.outlines[r];if(r>0&&this.autoItem(97,0),this.autoItem(92,7),this.autoItem(72,e?1:0),this.autoItem(73,1),i instanceof yE){let n=i.entity.center,s=i.entity.radius;this.autoItem(93,2),this.autoItem(10,n.x-s),this.autoItem(20,n.y),this.autoItem(42,1),this.autoItem(10,n.x+s),this.autoItem(20,n.y),this.autoItem(42,1)}else this.autoItem(93,i.entity.vertexs.length),i.autoEncoderVertexs(this.dxfItems)}}static builder(t){let e=new L5(null,null);return e.entity=t,e}scaleNumber(t,e){return isNaN(t)?t:t*e}};L5.entityName="HATCH";var s$=L5;var M5=class M5 extends Mc{constructor(t,e){super(M5.entityName,t,e)}cloneOne(){let t=new M5(null,null);return t.entity=this.cloneEntity(),t}isValid(){return!!this.entity.text}parseEntity(t,e){let r={type:M5.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,text:"",startPoint:null,endPoint:null,height:null,xScale:null,rotation:null,halign:null,valign:null,tiltAngle:null,pcbString:null,fontSize:null,fontFamily:null};for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 10:r.startPoint=$s(t),r.endPoint||(r.endPoint=r.startPoint);break;case 11:r.endPoint=$s(t);break;case 40:r.height=e.value;break;case 41:r.xScale=e.value;break;case 461:r.fontSize=e.value;break;case 7:r.fontFamily=e.value;break;case 50:r.rotation=e.value;break;case 1:r.text=e.value;break;case 72:r.halign=e.value;break;case 73:r.valign=e.value;break;case 51:r.tiltAngle=e.value;default:Sd(r,e);break}e=t.next()}let i=new xv(r.fontFamily||"NotoSerifCJKsc-Medium",r.fontSize||r.height,r.xScale,!1,!1),n=new S((r.startPoint.x+r.endPoint.x)/2,(r.startPoint.y+r.endPoint.y)/2);return r.pcbString=new eS("",this.pcb_layer,n,r.rotation,r.text,i,!1),this.entity=r,this}multiply3(t){return super.multiply3(t),this.entity.pcbString&&(this.entity.pcbString=this.entity.pcbString.multiply3(t)),this.entity.startPoint=this.vector2Multiply(this.entity.startPoint,t),this.entity.endPoint=this.vector2Multiply(this.entity.endPoint,t),this.entity.height=this.numberMultiply(this.entity.height,t),this.entity.fontSize=this.numberMultiply(this.entity.fontSize,t),this}bbox(){return this.entity.pcbString.bbox()}entityDxfItems(){let t=this.entity;return t.layer=this.autoDefault(t.layer,"0"),super.entityDxfItems(),this.autoItem(5,t.handle),this.autoItem(100,"AcDbEntity"),Ed(this.dxfItems,t,"layer"),this.autoItem(7,t.fontFamily),this.autoItem(461,t.fontSize),this.autoItem(100,"AcDbText"),ph(this.dxfItems,t.startPoint,10),ph(this.dxfItems,t.endPoint,11),this.autoItem(40,t.height),this.autoItem(1,t.text.replace(/\r|\n/g," ")),this.autoItem(50,t.rotation||0),this.autoItem(71,t.reverse?2:1),this.autoItem(72,t.halign||0),this.autoItem(41,t.xScale||1),this.autoItem(100,"AcDbText"),this.autoItem(73,t.valign||0),this.dxfItems}static builder(t){let e=new M5(null,null);return t.text=(t.text||"").trim(),e.entity=t,e}};M5.entityName="TEXT";var N5=M5;var U0e=class{constructor(t){this.lastReadGroup=null;let e=t.trim().split(/\r\n|\r|\n/g);this._data=e,this._pointer=0,this._eof=!1}next(){if(!this.hasNext())throw new Error("Cannot call 'next' after EOF group has been read");let t=parseInt(this.getPointerValue());this._pointer++;let e=Ej(t,this.getPointerValue());this._pointer++,t===0&&e==="EOF"&&(this._eof=!0);let r={code:t,value:e};return this.lastReadGroup=r,r}getPointerValue(){return this._data[this._pointer].trim()}hasNext(){return!(this._eof||this._pointer>this._data.length-2)}get isEOF(){return this._eof}rewind(t){t=t||1,this._pointer-=t*2}};var oU=class oU extends Mc{constructor(t,e){super(oU.entityName,t,e)}cloneOne(){let t=new oU(null,null);return t.entity=this.cloneEntity(),t}isValid(){return this.validVertices()}parseEntity(t,e){let r={type:oU.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,vertices:null,invisibleEdge:null,shape:null,hasContinuousLinetypePattern:null};for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 70:r.invisibleEdge=e.value,r.shape=(e.value&1)===1,r.hasContinuousLinetypePattern=(e.value&128)===128;break;case 10:r.vertices=Cne(t,e),e=t.lastReadGroup;break;default:Sd(r,e);break}e=t.next()}return this.entity=r,this.autoPorts(),this}multiply3(t){return super.multiply3(t),this}bbox(){return this.verticesBBox(this.entity.vertices)}entityDxfItems(){let t=this.entity;super.entityDxfItems();for(let e in t){let r=t[e];if(!o0(r))switch(e){case"invisibleEdge":this.autoItem(70,r?0:1);break;case"vertices":ph(this.dxfItems,r,10);break;default:Ed(this.dxfItems,t,e);break}}return this.dxfItems}};oU.entityName="3DFACE";var H0e=oU;var sU=class sU extends Mc{constructor(t,e){super(sU.entityName,t,e)}parseEntity(t,e){let r=this.initEntity();for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 10:r.center=$s(t);break;case 220:r.extrusionDirection=$s(t);break;case 40:r.radius=e.value;break;case 50:r.startAngle=e.value;break;case 51:r.endAngle=e.value;break;default:Sd(r,e);break}e=t.next()}return r.extrusionDirection&&r.extrusionDirection.y===-1&&(r.center=new S(-r.center.x,r.center.y)),this.initArc(),this.autoPorts(),this}autoPorts(){this.entity.vertices=[this.entity.arc.start(),this.entity.arc.end()],super.autoPorts()}initArc(){let t=this.entity;this.entity.arc=q.build2(t.center,t.startAngle,t.endAngle,t.radius,t.radius,ae.CCW)}initEntity(){return this.entity={type:sU.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,center:null,radius:null,startAngle:null,endAngle:null,arc:null,extrusionDirection:null},this.entity}isValid(){return!!this.entity.center}multiply3(t){return super.multiply3(t),this.entity.arc=this.entity.arc.multiply3(t),this.entity.center=this.vector2Multiply(this.entity.center,t),this.entity.radius=this.numberMultiply(this.entity.radius,t),this}bbox(){return this.entity.arc.bbox()}cloneOne(){let t=new sU(null,null);return t.entity=this.cloneEntity(),t}entityDxfItems(){let t=this.entity;super.entityDxfItems();for(let e in t){let r=t[e];if(!o0(r))switch(e){case"center":ph(this.dxfItems,r,10);break;case"radius":this.autoItem(40,r);break;case"startAngle":this.autoItem(50,r);break;case"endAngle":this.autoItem(51,r);break;default:Ed(this.dxfItems,t,e);break}}return this.dxfItems}};sU.entityName="ARC";var k5=sU;var aU=class aU extends Mc{constructor(t,e){super(aU.entityName,t,e)}isValid(){return!!this.entity.center}cloneOne(){let t=new aU(null,null);return t.entity=this.cloneEntity(),t}parseEntity(t,e){let r={type:aU.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,name:null,center:null,majorAxisEndPoint:null,axisRatio:null,startAngle:null,endAngle:null,stretching:null,a:null,b:null};for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 10:r.center=$s(t);break;case 11:r.majorAxisEndPoint=$s(t);break;case 210:r.stretching=$s(t);break;case 40:r.axisRatio=e.value;break;case 41:r.startAngle=e.value;break;case 42:r.endAngle=e.value;break;case 2:r.name=e.value;break;default:Sd(r,e);break}e=t.next()}let i=r.center,n=r.majorAxisEndPoint,s=i.add(n),a=Math.abs(s.distance1(i)),l=r.axisRatio>1?a/r.axisRatio:a*r.axisRatio;return r.a=a,r.b=l,this.entity=r,r.vertices=this.getVertices(this.getVerticesNumber()),this}multiply3(t){return super.multiply3(t),this.entity.center=this.vector2Multiply(this.entity.center,t),this.entity.majorAxisEndPoint=this.vector2Multiply(this.entity.majorAxisEndPoint,t),this}bbox(){return this.verticesBBox(this.entity.vertices)}ellipsePolar2(t,e,r){return new S(t*Math.cos(r),e*Math.sin(r))}ellipsePolar(t,e,r){let i;return r-=3/2*Math.PI,i=t*(1-e*e)/(1-e*Math.cos(r)),new S(i*Math.cos(r),i*Math.sin(r))}getVertices(t){let e=this.entity,r=e.center,i=e.majorAxisEndPoint,n=e.a,s=e.b,a=Math.sqrt(n*n-s*s),l=a/n,c=i.x,h=i.y,u=Math.atan(h/c);isNaN(u)&&(console.warn("radio is NaN."),u=0),c<0&&(u+=Math.PI);let d=Qe.rotate(u).translate1(r),p=e.startAngle||0,m=e.endAngle||2*Math.PI,g=(m-p)/(t-1),y=[];for(let b=p;b<=m;b+=g)y.push(this.ellipsePolar2(n,s,b).multiply3(d));return y}getVerticesNumber(){let t=2*Math.PI,e=this.entity.startAngle||0,r=this.entity.endAngle||t,i=Math.abs((r-e)/t),n=t*this.entity.a*i,s=Math.floor(n/.1);return Math.min(Math.max(20,s),5e3)}entityDxfItems(){let t=this.entity;super.entityDxfItems();for(let e in t){let r=t[e];if(!o0(r))switch(e){case"center":ph(this.dxfItems,r,10);break;case"majorAxisEndPoint":this.autoItem(11,r);break;case"stretching":ph(this.dxfItems,r,210);break;case"axisRatio":this.autoItem(40,r);break;case"startAngle":this.autoItem(41,r);break;case"endAngle":this.autoItem(42,r);break;case"name":this.autoItem(2,r);break;default:Ed(this.dxfItems,t,e);break}}return this.dxfItems}};aU.entityName="ELLIPSE";var W0e=aU;var lU=class lU extends Mc{constructor(t,e){super(lU.entityName,t,e)}cloneOne(){let t=new lU(null,null);return t.entity=this.cloneEntity(),t}parseEntity(t,e){let r={type:lU.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,shape:null,hasContinuousLinetypePattern:null,insert:null,name:null,rotate:0};for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 70:r.shape=(e.value&1)===1,r.hasContinuousLinetypePattern=(e.value&128)===128;break;case 10:let i=Cne(t,e);r.insert=i&&i[0],e=t.lastReadGroup;break;case 2:r.name=e.value;break;case 50:r.rotate=e.value;break;default:Sd(r,e);break}e=t.next()}return this.entity=r,this}isValid(){return!!this.entity.insert}multiply3(t){return super.multiply3(t),this}bbox(){return this.verticesBBox(this.entity.vertices)}get blockName(){return this.entity.name}entityDxfItems(){let t=this.entity;super.entityDxfItems();for(let e in t){let r=t[e];if(!o0(r))switch(e){case"shape":this.autoItem(70,Object.is(r,!1)?0:1);break;case"name":this.autoItem(2,r);break;case"insert":ph(this.dxfItems,r,10);break;default:Ed(this.dxfItems,t,e);break}}return this.dxfItems}};lU.entityName="INSERT";var cU=lU;var hU=class hU extends Mc{constructor(t,e){super(hU.entityName,t,e)}cloneOne(){let t=new hU(null,null);return t.entity=this.cloneEntity(),t}isValid(){return this.validVertices(this.entity.controlPoints)}parseEntity(t,e){let r={type:hU.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,controlPoints:null,fitPoints:null,startTangent:null,endTangent:null,knotValues:null,shape:null,periodic:null,rational:null,planar:null,linear:null,degreeOfSplineCurve:null,numberOfKnots:null,numberOfControlPoints:null,numberOfFitPoints:null,normalVector:null};for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 10:r.controlPoints||(r.controlPoints=[]),r.controlPoints.push($s(t));break;case 11:r.fitPoints||(r.fitPoints=[]),r.fitPoints.push($s(t));break;case 12:r.startTangent=$s(t);break;case 13:r.endTangent=$s(t);break;case 40:r.knotValues||(r.knotValues=[]),r.knotValues.push(e.value);break;case 70:(e.value&1)!=0&&(r.shape=!0),(e.value&2)!=0&&(r.periodic=!0),(e.value&4)!=0&&(r.rational=!0),(e.value&8)!=0&&(r.planar=!0),(e.value&16)!=0&&(r.planar=!0,r.linear=!0);break;case 71:r.degreeOfSplineCurve=e.value;break;case 72:r.numberOfKnots=e.value;break;case 73:r.numberOfControlPoints=e.value;break;case 74:r.numberOfFitPoints=e.value;break;case 210:r.normalVector=$s(t);break;default:Sd(r,e);break}e=t.next()}return this.entity=r,r.vertices=this.getVertices(this.getVerticesNumber()),r.shape&&J8(r.vertices),this.autoPorts(),this}multiply3(t){super.multiply3(t);let e=this.entity;return this.entity.controlPoints=this.verticesMultiply(e.controlPoints,t),this.entity.fitPoints=this.verticesMultiply(e.fitPoints,t),this.entity.startTangent=this.vector2Multiply(e.startTangent,t),this.entity.endTangent=this.vector2Multiply(e.endTangent,t),this.entity.normalVector=this.vector2Multiply(e.normalVector,t),this}bbox(){return this.verticesBBox(this.entity.vertices)}DeBoor(t,e,r){if(e==1)return this.Knot(t)<=r&&r<=this.Knot(t+1)?1:0;let i=this.Knot(t),s=this.Knot(t+e-1)-i,a=s===0?0:(r-i)/s*this.DeBoor(t,e-1,r),l=this.Knot(t+e),c=this.Knot(t+1),h=l-c,u=h===0?0:(l-r)/h*this.DeBoor(t+1,e-1,r);return a+u}getDeBoorPoint(t,e,r){let i=new S(0,0);for(let n=0;n<t;n++){let s=this.entity.controlPoints[n],a=this.DeBoor(n,e,r);i=i.add(s.multiply3(Qe.scale(a)))}return i}Knot(t){return this.entity.knotValues[t]}getVertices(t){let e=this.entity.knotValues.length,r=this.entity.controlPoints.length,i=this.Knot(0),n=this.Knot(e-1);t=Math.max(2,t);let s=(n-i)/(t-1),a=[],l=e-r,c=i;for(;c<=n;c+=s)a.push(this.getDeBoorPoint(r,l,c));return c-s!=n&&a.push(this.getDeBoorPoint(r,l,n)),a}getVerticesNumber(){let t=0,e=this.entity.controlPoints;for(let i=0;i<e.length-1;i++)t+=e[i].distance1(e[i+1]);let r=Math.floor(t/.5);return Math.min(Math.max(50,r),5e3)}entityDxfItems(){let t=this.entity;super.entityDxfItems();let e=K8(t,{shape:1,periodic:2,rational:4,linear:16,planar:8},!0,0);this.autoItem(70,e);for(let r in t){let i=t[r];if(!o0(i))switch(r){case"controlPoints":Z8(this.dxfItems,i,10);break;case"fitPoints":Z8(this.dxfItems,i,11);break;case"startTangent":Z8(this.dxfItems,i,12);break;case"endTangent":Z8(this.dxfItems,i,13);break;case"normalVector":Z8(this.dxfItems,i,210);break;case"knotValues":i&&i.forEach(n=>{this.autoItem(40,n)});break;case"degreeOfSplineCurve":this.autoItem(71,i);break;case"numberOfKnots":this.autoItem(72,i);break;case"numberOfControlPoints":this.autoItem(73,i);break;case"numberOfFitPoints":this.autoItem(74,i);break;default:Ed(this.dxfItems,t,r);break}}return this.dxfItems}};hU.entityName="SPLINE";var z0e=hU;var uU=class uU extends Mc{constructor(t,e){super(uU.entityName,t,e)}cloneOne(){let t=new uU(null,null);return t.entity=this.cloneEntity(),t}isValid(){return!!this.entity.start&&!this.entity.start.equals(this.entity.end,10)}parseEntity(t,e){let r=this.initEntity();for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 10:r.start=$s(t);break;case 11:r.end=$s(t);break;case 210:r.extrusionDirection=$s(t);break;case 100:break;default:Sd(r,e);break}e=t.next()}return this.autoPorts(),this}autoPorts(){this.entity.vertices=[this.entity.start,this.entity.end],super.autoPorts()}initEntity(){return this.entity={type:uU.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,start:null,end:null,extrusionDirection:null},this.entity}multiply3(t){super.multiply3(t);let e=this.entity;return this.entity.start=this.vector2Multiply(e.start,t),this.entity.end=this.vector2Multiply(e.end,t),this.entity.extrusionDirection=this.vector2Multiply(e.extrusionDirection,t),this}bbox(){let t=this.entity;return this.verticesBBox([t.start,t.end])}entityDxfItems(){let t=this.entity;super.entityDxfItems();for(let e in t){let r=t[e];if(!o0(r))switch(e){case"start":ph(this.dxfItems,r,10);break;case"end":ph(this.dxfItems,r,11);break;case"extrusionDirection":ph(this.dxfItems,r,210);break;default:Ed(this.dxfItems,t,e);break}}return this.dxfItems}};uU.entityName="LINE";var B5=uU;var dU=class dU extends Mc{constructor(t,e){super(dU.entityName,t,e)}isValid(){return this.validVertices(this.entity.vertexs)}cloneOne(){let t=new dU(null,null);return t.entity=this.cloneEntity(),t}parseEntity(t,e){let r={type:dU.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,vertexs:[],thickness:null,startWidth:null,endWidth:null,shape:null,includesCurveFitVertices:null,includesSplineFitVertices:null,is3dPolyline:null,is3dPolygonMesh:null,is3dPolygonMeshClosed:null,isPolyfaceMesh:null,hasContinuousLinetypePattern:null,extrusionDirection:null};for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 10:case 20:break;case 30:break;case 39:r.thickness=e.value;break;case 40:r.startWidth=e.value;break;case 41:r.endWidth=e.value;break;case 70:r.shape=(e.value&1)!==0,r.includesCurveFitVertices=(e.value&2)!==0,r.includesSplineFitVertices=(e.value&4)!==0,r.is3dPolyline=(e.value&8)!==0,r.is3dPolygonMesh=(e.value&16)!==0,r.is3dPolygonMeshClosed=(e.value&32)!==0,r.isPolyfaceMesh=(e.value&64)!==0,r.hasContinuousLinetypePattern=(e.value&128)!==0;break;case 71:break;case 72:break;case 73:break;case 74:break;case 75:break;case 210:r.extrusionDirection=$s(t);break;default:Sd(r,e);break}e=t.next()}return r.vertexs=VVe(t,e),r.shape&&(r.vertexs=J8(r.vertexs)),this.entity=r,this}multiply3(t){super.multiply3(t);let e=this.entity;return this.entity.thickness=this.numberMultiply(e.thickness,t),this.entity.startWidth=this.numberMultiply(e.startWidth,t),this.entity.endWidth=this.numberMultiply(e.endWidth,t),this.entity.extrusionDirection=this.vector2Multiply(e.extrusionDirection,t),Sne(this.entity.vertexs,t),this}bbox(){return this.verticesBBox(this.entity.vertices)}entityDxfItems(){let t=this.entity;super.entityDxfItems(),this.autoItem(10,0),this.autoItem(20,0),this.autoItem(30,0);let e=K8(t,{shape:1,includesCurveFitVertices:2,includesSplineFitVertices:4,is3dPolyline:8,is3dPolygonMesh:16,is3dPolygonMeshClosed:32,isPolyfaceMesh:64,hasContinuousLinetypePattern:128},!0,0);this.autoItem(70,e);for(let r in t){let i=t[r];if(!o0(i))switch(r){case"thickness":this.autoItem(39,i);break;case"startWidth":this.autoItem(40,i);break;case"endWidth":this.autoItem(41,i);break;case"extrusionDirection":ph(this.dxfItems,i,210);break;default:Ed(this.dxfItems,t,r);break}}return this.dxfItems}};dU.entityName="POLYLINE";var a$=dU;var F5=class F5 extends Mc{constructor(t,e){super(F5.entityName,t,e)}isValid(){return!!this.entity.text}cloneOne(){let t=new F5(null,null);return t.entity=this.cloneEntity(),t}parseEntity(t,e){let r={type:F5.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,text:[],position:null,height:null,width:null,rotation:null,attachmentPoint:null,drawingDirection:null,pcbString:null};for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 3:case 1:r.text=r.text.concat(this.parseString(e.value));break;case 10:r.position=$s(t);break;case 11:let n=$s(t);r.rotation=n.angleD(S.ORIGIN);break;case 40:r.height=e.value;break;case 41:r.width=e.value;break;case 50:r.rotation=e.value;break;case 71:r.attachmentPoint=e.value;break;case 72:r.drawingDirection=e.value;break;default:Sd(r,e);break}e=t.next()}let i=new xv("NotoSerifCJKsc-Medium",r.height,r.width,!1,!1);return r.pcbString=new eS("",this.pcb_layer,r.position,r.rotation,r.text.join(`\r
`),i,!1),this.entity=r,this}multiply3(t){super.multiply3(t);let e=this.entity;return e.pcbString&&(e.pcbString=e.pcbString.multiply3(t)),e.position=e.position.multiply3(t),e.height=this.numberMultiply(e.height,t),e.width=this.numberMultiply(e.width,t),this}bbox(){return this.entity.pcbString.bbox()}entityDxfItems(){let t=this.entity;return t.layer=this.autoDefault(t.layer,"0"),super.entityDxfItems(),this.autoItem(5,t.handle),this.autoItem(100,"AcDbEntity"),Ed(this.dxfItems,t,"layer"),this.autoItem(100,"AcDbMText"),ph(this.dxfItems,t.position,10),this.autoItem(40,t.height),this.autoItem(41,t.width),this.autoItem(50,t.rotation||0),this.autoItem(71,t.attachmentPoint||1),this.autoItem(72,t.drawingDirection||5),this.autoItem(1,this.encoderMString(t.text)),this.dxfItems}static builder(t){let e=new F5(null,null);return e.entity=t,e}parseString(t){if(!t)return[""];let e=[];return t.split("\\P").forEach(r=>{r=r.replace(/\\f/g,"~F~"),r=r.replace(/^{/,"").replace(/}$/,""),r=r.replace(/(~F~)(.*?)(;)/g,""),e.push(r)}),e}encoderMString(t){if(!t)return"";let e=[];return t.forEach(r=>{e.push("{\\fSimSun|b0|i0|c134|p2;"+r+"}")}),e.join("\\P")}};F5.entityName="MTEXT";var Y0e=F5;var pU=class pU extends Mc{constructor(t,e){super(pU.entityName,t,e)}cloneOne(){let t=new pU(null,null);return t.entity=this.cloneEntity(),t}isValid(){return this.validVertices()}parseEntity(t,e){let r=this.initEntity();for(e=t.next();!this.isEof(e)&&e.code!==0;){switch(e.code){case 71:(e.value&2)!=0&&(r.isClose=!0),(e.value&4)!=0&&(r.noStartSealing=!0),(e.value&8)!=0&&(r.noEndSealing=!0);break;case 10:r.vertices.unshift($s(t));break;case 11:r.vertices.push($s(t));break;default:Sd(r,e);break}e=t.next()}return this.autoPorts(),this}initEntity(){return this.entity={type:pU.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,isClose:null,noStartSealing:null,noEndSealing:null,vertices:[]},this.entity}multiply3(t){return super.multiply3(t),this}bbox(){return this.verticesBBox(this.entity.vertices)}};pU.entityName="MLINE";var j0e=pU;var fU=class fU extends Mc{constructor(e,r){super(fU.entityName,null,null);this.place=null;this.place=r,e&&(this.parseEntity(),this.extendEntity(e,[1,0]))}cloneOne(){let e=new fU(null,this.place);return e.entity=this.cloneEntity(),e}isValid(){return this.validVertices(this.entity.entities)}parseEntity(){let e={type:fU.entityName,pcb_layer:this.pcb_layer,handle:null,layer:null,entities:[],shape:!1};return this.entity=e,this}extendEntity(e,r){if(!r)return console.error("ports is un linked whith MultiPoly."),this;if(!this.entity.ports&&!this.entity.shape)return this.entity.layer=e.entity.layer,this.entity.pcb_layer=e.entity.pcb_layer,this.entity.ports=[e.entity.ports[0],e.entity.ports[1]],this.entity.entities.push(e),this;if(!this.entity.ports)return console.warn("multiPoly is closed"),this;if(!e.entity.ports)return console.error("ports is null in MultiPoly."),this;if(r[0]===r[1])if(e instanceof k5){let i=e.entity.arc;e.entity.arc=q.build2(i.center,i.endAngle(),i.startAngle,i.rx,i.ry,i.sweepAngle>=0?ae.CW:ae.CCW),e.autoPorts()}else e.entity.vertices.reverse(),e instanceof B5&&(e.entity.start=e.entity.vertices[0],e.entity.end=e.entity.vertices[1]),e.autoPorts();return r[0]===0?this.entity.entities.unshift(e):this.entity.entities.push(e),this.autoPorts(),this.autoShape(),this}autoPorts(){let e=this.entity.entities,r=e&&e.length;if(!r)return;let i=e[0],n=e[r-1];this.entity.ports=[i.entity.ports[0],n.entity.ports[1]]}autoShape(){return this.entity.shape?!0:this.entity.ports[0].equals(this.entity.ports[1],this.place)?(this.entity.ports=null,this.entity.shape=!0,!0):!1}multiply3(e){super.multiply3(e);let r=[];return this.entity.entities.forEach(i=>{r.push(i.multiply3(e))}),this.entity.entities=r,this}bbox(){let e=this.entity,r=new _e;return e.entities.forEach(n=>{r.ext1(n.bbox())}),r.valid()||r.ext6(0,0),r.build1()}};fU.entityName="MultiPoly";var l$=fU;var X0e=class{constructor(){this._entityHandlers={};this.strokeWidth=10;this.lastHandle=0;this.pointerPlace=10;this._tableDefinitions={VPORT:{tableName:"viewPort",dxfSymbolName:"VPORT",parseTableRecords:null},LTYPE:{tableName:"lineType",dxfSymbolName:"LTYPE",parseTableRecords:null},LAYER:{tableName:"layer",dxfSymbolName:"LAYER",parseTableRecords:null}};this.registerDefaultEntityHandlers(),this.loadTableDefinitions(),this.parseUnit=1}registerEntityHandler(t){this._entityHandlers[t.entityName.toUpperCase()]=t}registerDefaultEntityHandlers(){this.registerEntityHandler(H0e),this.registerEntityHandler(k5),this.registerEntityHandler(yE),this.registerEntityHandler(W0e),this.registerEntityHandler(cU),this.registerEntityHandler(B5),this.registerEntityHandler(j0e),this.registerEntityHandler(z0e),this.registerEntityHandler(a$),this.registerEntityHandler(gC),this.registerEntityHandler(R3),this.registerEntityHandler(Y0e),this.registerEntityHandler(N5)}loadTableDefinitions(){this._tableDefinitions.VPORT.parseTableRecords=this.parseViewPortRecords,this._tableDefinitions.LTYPE.parseTableRecords=this.parseLineTypes,this._tableDefinitions.LAYER.parseTableRecords=this.parseLayers}debugCode(t){return t.code+":"+t.value}log(t){return console.log(t)}parseSync(t){this.scanner=new U0e(t);let e=this.scanner;for(this.layerSelectedInfo={},this.parseData={header:{},blocks:{},entities:null,tables:null,unit:null,scale:1,unitName:null,strokeWidth:null,layerConvertInfo:{},origin:null,CLASSES_items:null,TABLES_items:null,OBJECTS_items:null},this.curr=e.next();!e.isEOF;)if(this.curr.code===0&&this.curr.value==="SECTION"){if(this.curr=e.next(),this.curr.code!==2){console.error("Unexpected code %s after 0:SECTION",this.debugCode(this.curr)),this.curr=e.next();continue}this.curr.value==="HEADER"?this.parseHeader():this.curr.value==="BLOCKS"?this.parseBlocks():this.curr.value==="ENTITIES"?this.parseData.entities=this.parseEntities(!1):this.curr.value==="TABLES"?this.parseData.TABLES_items=this.readSection2Items():this.curr.value==="CLASSES"?this.parseData.CLASSES_items=this.readSection2Items():this.curr.value==="OBJECTS"?this.parseData.OBJECTS_items=this.readSection2Items():this.curr.value==="EOF"?this.log("EOF"):(console.warn("Skipping section '%s'",this.curr.value),this.curr=e.next())}else this.curr=e.next();let r=kVe(this.getHeadValue("$INSUNITS"));this.parseData.unit=r.unit,this.parseData.unitName=r.name,this.parseData.scale=nn.convert(1,this.parseData.unit,this.parseUnit)||1,this.parseData.strokeWidth=this.strokeWidth,this.parseData.origin=this.getHeadValue("$PUCSORG");for(let i in this.parseData.layerConvertInfo){let n=this.parseData.layerConvertInfo[i];Y0(this.layerSelectedInfo,i)&&(n.selected=this.layerSelectedInfo[i])}return this}getHeadValue(t){return this.parseData.header?this.parseData.header[t]:null}get isEndSec(){return this.groupIs(0,"ENDSEC")}get isEndTab(){return this.groupIs(0,"ENDTAB")}get isEof(){return this.curr.value=="EOF"}parseHeader(){let t=this.parseData.header,e=this.scanner,r=this.headerCodeInfo={},i,n=null;for(this.curr=e.next();!this.isEof;){if(this.isEndSec){i&&(t[i]=n);break}else this.curr.code===9?(i&&(t[i]=n),i=this.curr.value):(this.curr.code===10?n={x:this.curr.value}:this.curr.code===20?n.y=this.curr.value:this.curr.code===30?n.z=this.curr.value:n=this.curr.value,r[i]=this.curr.code);this.curr=e.next()}this.curr=e.next()}parseBlocks(){let t=this.scanner,e=this.parseData.blocks,r;for(this.curr=t.next();!this.isEof&&!this.isEndSec;)if(this.groupIs(0,"BLOCK"))if(r=this.parseBlock(),!r.name)console.error('block with handle "'+r.handle+'" is missing a name.');else{let i=this.autoEntity(r);Y0(e,r.name)&&console.warn('block with handle "'+r.handle+'" is reapeat a name.'),i&&(e[r.name]=r)}else r?r.endBlock=this.parseEndBlock():this.curr=t.next()}parseBlock(){let t=this.scanner,e={entities:null,handle:null,ownerHandle:null,subclassTag:[],layer:null,name:null,name2:null,xrefPath:null,type:null,position:null,paperSpace:null,endBlock:null};this.curr=t.next();let r;for(;!this.isEof;){switch(r=this.curr.value,this.curr.code){case 0:if(r=="ENDBLK")break;e.entities=this.parseEntities(!0);break;case 5:e.handle=r,this.curr=t.next();break;case 330:e.ownerHandle=r,this.curr=t.next();break;case 100:e.subclassTag.push(r),this.curr=t.next();break;case 8:e.layer=r,this.curr=t.next();break;case 2:e.name=r,this.curr=t.next();break;case 3:e.name2=r,e.name||(e.name=r),this.curr=t.next();break;case 1:e.xrefPath=r,this.curr=t.next();break;case 70:e.type=r||0,this.curr=t.next();break;case 10:e.position=$s(t),this.curr=t.next();break;case 67:e.paperSpace=!!(r&&r==1),this.curr=t.next();break;default:this.curr=t.next()}if(this.groupIs(0,"ENDBLK")){this.curr=t.next();break}}return e}parseEndBlock(){let t=this.scanner;if(this.curr.code==5){let e=[];for(;!this.isEof&&this.curr.code!=0;)Gb(e,this.curr.code,this.curr.value),this.curr=t.next();return e}else return this.curr=t.next(),null}parseTables(){let t=this.scanner;for(this.curr=t.next();!this.isEof&&!this.isEndSec;)if(this.groupIs(0,"TABLE")){this.curr=t.next();let e=this.curr.value,r=this._tableDefinitions[e];r?(this.parseData.tables||(this.parseData.tables={}),this.parseData.tables[r.tableName]=this.parseTable(r)):(console.warn("Unhandled Table "+e),this.curr=t.next())}else this.curr=t.next();this.curr=t.next()}parseTable(t){let e=this.scanner,r={handle:null,ownerHandle:null,records:null,expectedCount:null};this.curr=e.next();let i;for(;!this.isEndTab;)switch(i=this.curr.value,this.curr.code){case 5:r.handle=i,this.curr=e.next();break;case 330:r.ownerHandle=i,this.curr=e.next();break;case 100:i==="AcDbSymbolTable"?this.curr=e.next():this.curr=e.next();break;case 70:r.expectedCount=i,this.curr=e.next();break;case 0:if(i===t.dxfSymbolName)r.records=t.parseTableRecords.call(this);else return console.warn("tableDefinition.dxfSymbolName is wrong!",i),this.curr=e.next(),r;break;default:this.curr=e.next()}return this.curr=e.next(),r}parseViewPortRecords(){let t=this.scanner,e=[],r=this._initTabViewPort();this.curr=t.next();let i;for(;!this.isEndTab;)switch(i=this.curr.value,this.curr.code){case 2:r.name=i,this.curr=t.next();break;case 10:r.lowerLeftCorner=$s(t),this.curr=t.next();break;case 11:r.upperRightCorner=$s(t),this.curr=t.next();break;case 12:r.center=$s(t),this.curr=t.next();break;case 13:r.snapBasePoint=$s(t),this.curr=t.next();break;case 14:r.snapSpacing=$s(t),this.curr=t.next();break;case 15:r.gridSpacing=$s(t),this.curr=t.next();break;case 16:r.viewDirectionFromTarget=$s(t),this.curr=t.next();break;case 17:r.viewTarget=$s(t),this.curr=t.next();break;case 42:r.lensLength=i,this.curr=t.next();break;case 43:r.frontClippingPlane=i,this.curr=t.next();break;case 44:r.backClippingPlane=i,this.curr=t.next();break;case 45:r.viewHeight=i,this.curr=t.next();break;case 50:r.snapRotationAngle=i,this.curr=t.next();break;case 51:r.viewTwistAngle=i,this.curr=t.next();break;case 79:r.orthographicType=i,this.curr=t.next();break;case 110:r.ucsOrigin=$s(t),this.curr=t.next();break;case 111:r.ucsXAxis=$s(t),this.curr=t.next();break;case 112:r.ucsYAxis=$s(t),this.curr=t.next();break;case 281:r.renderMode=i,this.curr=t.next();break;case 292:r.defaultLightingOn=i,this.curr=t.next();break;case 330:r.ownerHandle=i,this.curr=t.next();break;case 63:case 421:case 431:r.ambientColor=i,this.curr=t.next();break;case 0:i==="VPORT"&&(e.push(r),r=this._initTabViewPort(),this.curr=t.next());break;default:this.curr=t.next();break}return e.push(r),e}parseLineTypes(){let t=this.scanner,e={},r,i,n=this._initTabLine();this.curr=t.next();let s;for(;!this.isEndTab;)switch(s=this.curr.value,this.curr.code){case 2:n.name=s,r=s,this.curr=t.next();break;case 3:n.description=s,this.curr=t.next();break;case 73:i=s,i>0&&(n.pattern=[]),this.curr=t.next();break;case 40:n.patternLength=s,this.curr=t.next();break;case 49:n.pattern===null&&(n.pattern=[]),n.pattern.push(s),this.curr=t.next();break;case 0:i>0&&i!==n.pattern.length&&console.warn("lengths do not match on LTYPE pattern"),e[r]=n,n=this._initTabLine(),this.curr=t.next();break;default:this.curr=t.next()}return e[r]=n,e}parseLayers(){let t=this.scanner,e={},r,i=this._initTabLayer();this.curr=t.next();let n;for(;!this.isEndTab;)switch(n=this.curr.value,this.curr.code){case 2:i.name=n,r=n,this.curr=t.next();break;case 62:i.visible=n>=0,i.colorIndex=Math.abs(n),i.color=Tne(i.colorIndex),this.curr=t.next();break;case 70:i.standardMark=n,i.frozen=(n&1)!=0||(n&2)!=0,this.curr=t.next();break;case 0:n==="LAYER"&&(e[r]=i,this.popLayerSelectedInfo(r,i),i=this._initTabLayer(),r=null,this.curr=t.next());break;default:this.curr=t.next();break}return e[r]=i,this.popLayerSelectedInfo(r,i),e}popLayerSelectedInfo(t,e){this.layerSelectedInfo||(this.layerSelectedInfo={}),this.layerSelectedInfo[t]=!e.frozen&&e.visible}_initTabViewPort(){return{name:null,lowerLeftCorner:null,upperRightCorner:null,center:null,snapBasePoint:null,snapSpacing:null,gridSpacing:null,viewDirectionFromTarget:null,viewTarget:null,lensLength:null,frontClippingPlane:null,backClippingPlane:null,viewHeight:null,snapRotationAngle:null,viewTwistAngle:null,orthographicType:null,ucsOrigin:null,ucsXAxis:null,ucsYAxis:null,renderMode:null,defaultLightingOn:null,ownerHandle:null,ambientColor:null}}_initTabLine(){return{name:null,description:null,pattern:null,patternLength:null}}_initTabLayer(){return{name:null,visible:null,colorIndex:null,color:null,standardMark:null,frozen:null}}parseEntities(t){let e=this.scanner,r=t?"ENDBLK":"ENDSEC",i=[];for(t||(this.curr=e.next());;){let n=this.curr.value;if(this.curr.code===0){if(n===r)break;let s,a=this._entityHandlers[n];if(a)s=new a(e,this.curr),this.curr=e.lastReadGroup;else{console.warn("Unhandled entity "+n),this.curr=e.next();continue}this.autoEntity(s,i)}else this.curr=e.next()}return t||(this.curr=e.next(),this.autoEntities(i)),i}groupIs(t,e){return this.curr.code===t&&this.curr.value===e}autoEntity(t,e){let r=e?t.entity:t;if(!r)throw new TypeError("entity cannot be undefined or null");if(t instanceof Mc){if(!t.isValid())return console.warn("entity is not a valid data.",t.entity.type),!1}else return!0;return r.handle||(r.handle=(++this.lastHandle).toString()),r.layer&&(this.parseData.layerConvertInfo||(this.parseData.layerConvertInfo={}),this.parseData.layerConvertInfo[r.layer]||(this.parseData.layerConvertInfo[r.layer]={selected:!0,pcblayer:null})),e&&this.autoLinkedPoly(t,e),!0}autoLinkedPoly(t,e){let r=t.entity;if(!r.ports||!r.vertices){e.push(t);return}let i=null,n=r.ports;for(let s=0;s<e.length;s++){if(i=e[s].entity.ports,!i||!e[s].entity.pcb_layer.equals(t.entity.pcb_layer))continue;let a=BVe(i,n,this.pointerPlace);if(a!==null){if(a[0]==-1&&(a=[1,0]),e[s]instanceof l$)e[s].extendEntity(t,a);else{let l=new l$(mee(e,e[s]),this.pointerPlace).extendEntity(t,a);e.push(l)}return}}e.push(t)}insertBlock(t,e){let r=t.blockName,i=t.entity.insert;if(!r||!i){console.warn("this insert is no block name or no insertPoint:",r);return}let n=this.parseData.blocks[r];if(!n){console.warn("unmatch block named:",r);return}let s=n.entities;if(!s||!s.length)return console.warn("block is null"),null;let a=n.position;e||(e=Qe.translate(-a.x,-a.y)),e=e.rotateD(t.entity.rotate||0).setOrigin1(a).translate(i.x,i.y);let l=[],c=n.layer;return s.forEach(h=>{if(h instanceof cU){let u=this.insertBlock(h,e);u&&(l=l.concat(u))}else{let u=h.cloneOne();if(!u){console.warn("cloneOne is null:",h.entity.type);return}l.push(u.multiply3(e))}}),l.length>0?l:null}autoEntities(t){if(!t)return;let e=t.length;for(let r=0;r<e;r++){let i=t[r];i instanceof cU?(this.autoInsert(i,t),r--):(i instanceof gC||i instanceof a$)&&(this.autoVerTexPoly(i,t),r--)}}autoInsert(t,e){mee(e,t);let r=this.insertBlock(t);r&&(this.autoEntities(r),r.forEach(i=>{e.push(i)}))}autoVerTexPoly(t,e){mee(e,t);let r=t.entity.layer,i=t.entity.vertexs,n=[];for(let s=0;s<i.length-1;s++){let a=i[s].entity,l=i[s+1].entity,c=a.center,h=l.center;if(c.equals(h,this.pointerPlace)){console.warn("start equals end");continue}if(a.bulge){let u=new k5(null,null);u.initEntity(),u.entity.layer=r;let d=FVe(c,h,a.bulge),p=d.radius,m=d.largeArcFlag,g=d.sweepFlag,y=q.build1(c,h,p,p,m,g);u.entity.arc=y,u.entity.center=y.center,u.entity.startAngle=y.startAngle,u.entity.endAngle=y.endAngle(),u.autoPorts(),this.autoLinkedPoly(u,n)}else{let u=new B5(null,null);u.initEntity(),u.entity.layer=r,u.entity.start=c,u.entity.end=h,u.autoPorts(),this.autoLinkedPoly(u,n)}}n.forEach(s=>{e.push(s)})}readSection2Items(){let t=this.scanner,e=[];Gb(e,0,"SECTION");let r=t.lastReadGroup;for(Gb(e,r.code,r.value),this.curr=t.next();!this.isEof&&!this.isEndSec;)Gb(e,this.curr.code,this.curr.value),this.curr=t.next();return Gb(e,0,"ENDSEC"),this.curr=t.next(),e}};var YXe=`  0
SECTION
  2
HEADER
  9
$ACADVER
  1
AC1018
  9
$ACADMAINTVER
 70
   104
  9
$DWGCODEPAGE
  3
ANSI_936
  9
$LASTSAVEDBY
  1
win10
  9
$INSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$EXTMIN
 10
1.000000000000000E+20
 20
1.000000000000000E+20
 30
1.000000000000000E+20
  9
$EXTMAX
 10
-1.000000000000000E+20
 20
-1.000000000000000E+20
 30
-1.000000000000000E+20
  9
$LIMMIN
 10
0.0
 20
0.0
  9
$LIMMAX
 10
12.0
 20
9.0
  9
$ORTHOMODE
 70
     0
  9
$REGENMODE
 70
     1
  9
$FILLMODE
 70
     1
  9
$QTEXTMODE
 70
     0
  9
$MIRRTEXT
 70
     0
  9
$LTSCALE
 40
1.0
  9
$ATTMODE
 70
     1
  9
$TEXTSIZE
 40
0.2
  9
$TRACEWID
 40
0.05
  9
$TEXTSTYLE
  7
Standard
  9
$CLAYER
  8
0
  9
$CELTYPE
  6
ByLayer
  9
$CECOLOR
 62
   256
  9
$CELTSCALE
 40
1.0
  9
$DISPSILH
 70
     0
  9
$DIMSCALE
 40
1.0
  9
$DIMASZ
 40
0.18
  9
$DIMEXO
 40
0.0625
  9
$DIMDLI
 40
0.38
  9
$DIMRND
 40
0.0
  9
$DIMDLE
 40
0.0
  9
$DIMEXE
 40
0.18
  9
$DIMTP
 40
0.0
  9
$DIMTM
 40
0.0
  9
$DIMTXT
 40
0.18
  9
$DIMCEN
 40
0.09
  9
$DIMTSZ
 40
0.0
  9
$DIMTOL
 70
     0
  9
$DIMLIM
 70
     0
  9
$DIMTIH
 70
     1
  9
$DIMTOH
 70
     1
  9
$DIMSE1
 70
     0
  9
$DIMSE2
 70
     0
  9
$DIMTAD
 70
     0
  9
$DIMZIN
 70
     0
  9
$DIMBLK
  1

  9
$DIMASO
 70
     1
  9
$DIMSHO
 70
     1
  9
$DIMPOST
  1

  9
$DIMAPOST
  1

  9
$DIMALT
 70
     0
  9
$DIMALTD
 70
     2
  9
$DIMALTF
 40
25.4
  9
$DIMLFAC
 40
1.0
  9
$DIMTOFL
 70
     0
  9
$DIMTVP
 40
0.0
  9
$DIMTIX
 70
     0
  9
$DIMSOXD
 70
     0
  9
$DIMSAH
 70
     0
  9
$DIMBLK1
  1

  9
$DIMBLK2
  1

  9
$DIMSTYLE
  2
Standard
  9
$DIMCLRD
 70
     0
  9
$DIMCLRE
 70
     0
  9
$DIMCLRT
 70
     0
  9
$DIMTFAC
 40
1.0
  9
$DIMGAP
 40
0.09
  9
$DIMJUST
 70
     0
  9
$DIMSD1
 70
     0
  9
$DIMSD2
 70
     0
  9
$DIMTOLJ
 70
     1
  9
$DIMTZIN
 70
     0
  9
$DIMALTZ
 70
     0
  9
$DIMALTTZ
 70
     0
  9
$DIMUPT
 70
     0
  9
$DIMDEC
 70
     4
  9
$DIMTDEC
 70
     4
  9
$DIMALTU
 70
     2
  9
$DIMALTTD
 70
     2
  9
$DIMTXSTY
  7
Standard
  9
$DIMAUNIT
 70
     0
  9
$DIMADEC
 70
     0
  9
$DIMALTRND
 40
0.0
  9
$DIMAZIN
 70
     0
  9
$DIMDSEP
 70
    46
  9
$DIMATFIT
 70
     3
  9
$DIMFRAC
 70
     0
  9
$DIMLDRBLK
  1

  9
$DIMLUNIT
 70
     2
  9
$DIMLWD
 70
    -2
  9
$DIMLWE
 70
    -2
  9
$DIMTMOVE
 70
     0
  9
$LUNITS
 70
     2
  9
$LUPREC
 70
     4
  9
$SKETCHINC
 40
0.1
  9
$FILLETRAD
 40
0.0
  9
$AUNITS
 70
     0
  9
$AUPREC
 70
     0
  9
$MENU
  1
.
  9
$ELEVATION
 40
0.0
  9
$PELEVATION
 40
0.0
  9
$THICKNESS
 40
0.0
  9
$LIMCHECK
 70
     0
  9
$CHAMFERA
 40
0.0
  9
$CHAMFERB
 40
0.0
  9
$CHAMFERC
 40
0.0
  9
$CHAMFERD
 40
0.0
  9
$SKPOLY
 70
     0
  9
$TDCREATE
 40
2460560.605914352
  9
$TDUCREATE
 40
2460560.272581019
  9
$TDUPDATE
 40
2460560.629189815
  9
$TDUUPDATE
 40
2460560.295856482
  9
$TDINDWG
 40
0.0232870370
  9
$TDUSRTIMER
 40
0.0232870370
  9
$USRTIMER
 70
     1
  9
$ANGBASE
 50
0.0
  9
$ANGDIR
 70
     0
  9
$PDMODE
 70
     0
  9
$PDSIZE
 40
0.0
  9
$PLINEWID
 40
0.0
  9
$SPLFRAME
 70
     0
  9
$SPLINETYPE
 70
     6
  9
$SPLINESEGS
 70
     8
  9
$HANDSEED
  5
300
  9
$SURFTAB1
 70
     6
  9
$SURFTAB2
 70
     6
  9
$SURFTYPE
 70
     6
  9
$SURFU
 70
     6
  9
$SURFV
 70
     6
  9
$UCSBASE
  2

  9
$UCSNAME
  2

  9
$UCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$UCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$UCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$UCSORTHOREF
  2

  9
$UCSORTHOVIEW
 70
     0
  9
$UCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSBASE
  2

  9
$PUCSNAME
  2

  9
$PUCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$PUCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$PUCSORTHOREF
  2

  9
$PUCSORTHOVIEW
 70
     0
  9
$PUCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$USERI1
 70
     0
  9
$USERI2
 70
     0
  9
$USERI3
 70
     0
  9
$USERI4
 70
     0
  9
$USERI5
 70
     0
  9
$USERR1
 40
0.0
  9
$USERR2
 40
0.0
  9
$USERR3
 40
0.0
  9
$USERR4
 40
0.0
  9
$USERR5
 40
0.0
  9
$WORLDVIEW
 70
     1
  9
$SHADEDGE
 70
     3
  9
$SHADEDIF
 70
    70
  9
$TILEMODE
 70
     1
  9
$MAXACTVP
 70
    64
  9
$PINSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMCHECK
 70
     0
  9
$PEXTMIN
 10
0.0
 20
0.0
 30
0.0
  9
$PEXTMAX
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMMIN
 10
0.0
 20
0.0
  9
$PLIMMAX
 10
12.0
 20
9.0
  9
$UNITMODE
 70
     0
  9
$VISRETAIN
 70
     1
  9
$PLINEGEN
 70
     0
  9
$PSLTSCALE
 70
     1
  9
$TREEDEPTH
 70
  3020
  9
$CMLSTYLE
  2
Standard
  9
$CMLJUST
 70
     0
  9
$CMLSCALE
 40
1.0
  9
$PROXYGRAPHICS
 70
     1
  9
$MEASUREMENT
 70
     0
  9
$CELWEIGHT
370
    -1
  9
$ENDCAPS
280
     0
  9
$JOINSTYLE
280
     0
  9
$LWDISPLAY
290
     0
  9
$INSUNITS
 70
     4
  9
$HYPERLINKBASE
  1

  9
$STYLESHEET
  1

  9
$XEDIT
290
     1
  9
$CEPSNTYPE
380
     0
  9
$PSTYLEMODE
290
     0
  9
$FINGERPRINTGUID
  2
{FA9A02B2-7E04-C34E-BD13-02980AC2B394}
  9
$VERSIONGUID
  2
{964EB223-33A2-D549-8684-CDE005EE773C}
  9
$EXTNAMES
290
     1
  9
$PSVPSCALE
 40
0.0
  9
$OLESTARTUP
290
     0
  9
$SORTENTS
280
   127
  9
$INDEXCTL
280
     0
  9
$HIDETEXT
280
     1
  9
$XCLIPFRAME
290
     0
  9
$HALOGAP
280
     0
  9
$OBSCOLOR
 70
   257
  9
$OBSLTYPE
280
     0
  9
$INTERSECTIONDISPLAY
280
     0
  9
$INTERSECTIONCOLOR
 70
   257
  9
$DIMASSOC
280
     2
  9
$PROJECTNAME
  1

  0
ENDSEC
  0
SECTION
  2
CLASSES
  0
CLASS
  1
ACDBDICTIONARYWDFLT
  2
AcDbDictionaryWithDefault
  3
ObjectDBX Classes
 90
        0
 91
        1
280
     0
281
     0
  0
CLASS
  1
DICTIONARYVAR
  2
AcDbDictionaryVar
  3
ObjectDBX Classes
 90
        0
 91
       15
280
     0
281
     0
  0
CLASS
  1
MATERIAL
  2
AcDbMaterial
  3
ObjectDBX Classes
 90
     1153
 91
        3
280
     0
281
     0
  0
CLASS
  1
VISUALSTYLE
  2
AcDbVisualStyle
  3
ObjectDBX Classes
 90
     4095
 91
       24
280
     0
281
     0
  0
CLASS
  1
TABLESTYLE
  2
AcDbTableStyle
  3
ObjectDBX Classes
 90
     4095
 91
        1
280
     0
281
     0
  0
CLASS
  1
SCALE
  2
AcDbScale
  3
ObjectDBX Classes
 90
     1153
 91
       33
280
     0
281
     0
  0
CLASS
  1
MLEADERSTYLE
  2
AcDbMLeaderStyle
  3
ACDB_MLEADERSTYLE_CLASS
 90
     4095
 91
        2
280
     0
281
     0
  0
CLASS
  1
CELLSTYLEMAP
  2
AcDbCellStyleMap
  3
ObjectDBX Classes
 90
     1152
 91
        3
280
     0
281
     0
  0
CLASS
  1
EXACXREFPANELOBJECT
  2
ExAcXREFPanelObject
  3
EXAC_ESW
 90
     1025
 91
        0
280
     0
281
     0
  0
CLASS
  1
NPOCOLLECTION
  2
AcDbImpNonPersistentObjectsCollection
  3
ObjectDBX Classes
 90
     1153
 91
        0
280
     0
281
     0
  0
CLASS
  1
LAYER_INDEX
  2
AcDbLayerIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
SPATIAL_INDEX
  2
AcDbSpatialIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
IDBUFFER
  2
AcDbIdBuffer
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
ACDBSECTIONVIEWSTYLE
  2
AcDbSectionViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
CLASS
  1
ACDBDETAILVIEWSTYLE
  2
AcDbDetailViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
ENDSEC
  0
SECTION
  2
TABLES
  0
TABLE
  2
VPORT
  5
8
330
0
100
AcDbSymbolTable
 70
     1
  0
VPORT
  5
90
330
8
100
AcDbSymbolTableRecord
100
AcDbViewportTableRecord
  2
*Active
 70
     0
 10
0.0
 20
0.0
 11
1.0
 21
1.0
 12
97.5486911906951
 22
42.51345460271504
 13
0.0
 23
0.0
 14
0.5
 24
0.5
 15
0.5
 25
0.5
 16
0.0
 26
0.0
 36
1.0
 17
0.0
 27
0.0
 37
0.0
 40
78.45799938217576
 41
1.945409429280396
 42
50.0
 43
0.0
 44
0.0
 50
0.0
 51
0.0
 71
     0
 72
  1000
 73
     1
 74
     3
 75
     0
 76
     1
 77
     0
 78
     0
281
     0
 65
     1
110
0.0
120
0.0
130
0.0
111
1.0
121
0.0
131
0.0
112
0.0
122
1.0
132
0.0
 79
     0
146
0.0
1001
ACAD_NAV_VCDISPLAY
1070
     3
  0
ENDTAB
  0
TABLE
  2
LTYPE
  5
5
330
0
100
AcDbSymbolTable
 70
     1
  0
LTYPE
  5
14
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByBlock
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
15
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByLayer
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
16
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
Continuous
 70
     0
  3
Solid line
 72
    65
 73
     0
 40
0.0
  0
ENDTAB
  0
TABLE
  2
LAYER
  5
2
102
{ACAD_XDICTIONARY
360
18B
102
}
330
0
100
AcDbSymbolTable
 70
     1
  0
LAYER
  5
10
102
{ACAD_XDICTIONARY
360
E1
102
}
330
2
100
AcDbSymbolTableRecord
100
AcDbLayerTableRecord
  2
0
 70
     0
 62
     7
  6
Continuous
370
    -3
390
F
  0
ENDTAB
  0
TABLE
  2
STYLE
  5
3
330
0
100
AcDbSymbolTable
 70
     2
  0
STYLE
  5
11
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Standard
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
ACAD
1000
Arial
1071
       34
  0
STYLE
  5
D7
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD
1000
Arial
1071
       34
  0
ENDTAB
  0
TABLE
  2
VIEW
  5
6
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
UCS
  5
7
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
APPID
  5
9
330
0
100
AcDbSymbolTable
 70
     7
  0
APPID
  5
12
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD
 70
     0
  0
APPID
  5
D8
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnoPO
 70
     0
  0
APPID
  5
D9
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnotative
 70
     0
  0
APPID
  5
DA
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMJAG
 70
     0
  0
APPID
  5
DB
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMTALN
 70
     0
  0
APPID
  5
102
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_MLEADERVER
 70
     0
  0
APPID
  5
1A3
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_NAV_VCDISPLAY
 70
     0
  0
ENDTAB
  0
TABLE
  2
DIMSTYLE
  5
A
330
0
100
AcDbSymbolTable
 70
     2
100
AcDbDimStyleTable
 71
     2
340
DC
340
27
  0
DIMSTYLE
105
27
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Standard
 70
     0
340
11
  0
DIMSTYLE
105
DC
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
340
11
1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD_DSTYLE_DIMJAG
1070
   388
1040
1.5
1001
ACAD_DSTYLE_DIMTALN
1070
   392
1070
     0
  0
ENDTAB
  0
TABLE
  2
BLOCK_RECORD
  5
1
330
0
100
AcDbSymbolTable
 70
     1
  0
BLOCK_RECORD
  5
1F
102
{ACAD_XDICTIONARY
360
15A
102
}
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Model_Space
340
22
  0
BLOCK_RECORD
  5
73
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space
340
74
  0
BLOCK_RECORD
  5
78
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space0
340
79
  0
ENDTAB
  0
ENDSEC
  0
SECTION
  2
BLOCKS
  0
BLOCK
  5
20
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockBegin
  2
*Model_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Model_Space
  1

  0
ENDBLK
  5
21
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
75
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space
  1

  0
ENDBLK
  5
76
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
7A
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space0
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space0
  1

  0
ENDBLK
  5
7B
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
ENDSEC
  0
SECTION
  2
ENTITIES
  0
ENDSEC
  0
SECTION
  2
OBJECTS
  0
DICTIONARY
  5
C
330
0
100
AcDbDictionary
281
     1
  3
ACAD_CIP_PREVIOUS_PRODUCT_INFO
350
1A2
  3
ACAD_COLOR
350
6C
  3
ACAD_DETAILVIEWSTYLE
350
1A8
  3
ACAD_GROUP
350
D
  3
ACAD_LAYOUT
350
1A
  3
ACAD_MATERIAL
350
6B
  3
ACAD_MLEADERSTYLE
350
D2
  3
ACAD_MLINESTYLE
350
17
  3
ACAD_PLOTSETTINGS
350
19
  3
ACAD_PLOTSTYLENAME
350
E
  3
ACAD_SCALELIST
350
B1
  3
ACAD_SECTIONVIEWSTYLE
350
1A5
  3
ACAD_TABLESTYLE
350
A6
  3
ACAD_VISUALSTYLE
350
95
  3
ACDB_RECOMPOSE_DATA
350
2BF
  3
AcDbVariableDictionary
350
59
  3
AcDsDecomposeData
350
2C5
  0
DICTIONARY
  5
18B
330
2
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_LAYERSTATES
360
18C
  0
DICTIONARY
  5
E1
330
10
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
15A
330
1F
100
AcDbDictionary
280
     1
281
     1
  0
XRECORD
  5
1A2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
300
ACD
300
2021
300

  0
DICTIONARY
  5
6C
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A8
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A9
  0
DICTIONARY
  5
D
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Model
350
22
  3
\uFFFD\uFFFD\uFFFD\uFFFD1
350
74
  3
\uFFFD\uFFFD\uFFFD\uFFFD2
350
79
  0
DICTIONARY
  5
6B
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
ByBlock
350
93
  3
ByLayer
350
92
  3
Global
350
94
  0
DICTIONARY
  5
D2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Annotative
350
E0
  3
Standard
350
D3
  0
DICTIONARY
  5
17
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
18
  0
DICTIONARY
  5
19
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
ACDBDICTIONARYWDFLT
  5
E
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Normal
350
F
100
AcDbDictionaryWithDefault
340
F
  0
DICTIONARY
  5
B1
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
A0
350
B2
  3
A1
350
124
  3
A2
350
125
  3
A3
350
126
  3
A4
350
127
  3
A5
350
128
  3
A6
350
129
  3
A7
350
12A
  3
A8
350
12B
  3
A9
350
12C
  3
B0
350
12D
  3
B1
350
12E
  3
B2
350
12F
  3
B3
350
130
  3
B4
350
131
  3
B5
350
132
  3
B6
350
133
  3
B7
350
134
  3
B8
350
135
  3
B9
350
136
  3
C0
350
137
  3
C1
350
138
  3
C2
350
139
  3
C3
350
13A
  3
C4
350
13B
  3
C5
350
13C
  3
C6
350
13D
  3
C7
350
13E
  3
C8
350
13F
  3
C9
350
140
  3
D0
350
141
  3
D1
350
142
  3
D2
350
143
  0
DICTIONARY
  5
1A5
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A7
  0
DICTIONARY
  5
A6
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
A7
  0
DICTIONARY
  5
95
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
2dWireframe
350
9B
  3
Basic
350
9A
  3
Brighten
350
A1
  3
ColorChange
350
A5
  3
Conceptual
350
9E
  3
Dim
350
A0
  3
EdgeColorOff
350
172
  3
Facepattern
350
A4
  3
Flat
350
96
  3
FlatWithEdges
350
97
  3
Gouraud
350
98
  3
GouraudWithEdges
350
99
  3
Hidden
350
9D
  3
JitterOff
350
170
  3
Linepattern
350
A3
  3
OverhangOff
350
171
  3
Realistic
350
9F
  3
Shaded
350
17F
  3
Shaded with edges
350
17E
  3
Shades of Gray
350
17B
  3
Sketchy
350
17C
  3
Thicken
350
A2
  3
Wireframe
350
9C
  3
X-Ray
350
17D
  0
XRECORD
  5
2BF
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
 90
        1
330
A7
  0
DICTIONARY
  5
59
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
CAMERAHEIGHT
350
227
  3
CANNOSCALE
350
EB
  3
CMLEADERSTYLE
350
EA
  3
CTABLESTYLE
350
AB
  3
CVIEWDETAILSTYLE
350
1B4
  3
CVIEWSECTIONSTYLE
350
1B5
  3
DIMASSOC
350
5A
  3
HIDETEXT
350
5E
  3
INDEXCTL
350
226
  3
LAYEREVAL
350
14A
  3
LAYERNOTIFY
350
14B
  3
LIGHTINGUNITS
350
224
  3
MSLTSCALE
350
223
  3
SORTENTS
350
225
  3
XCLIPFRAME
350
228
  0
DICTIONARY
  5
2C5
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
AcDsRecords
350
2C7
  3
AcDsSchemas
350
2C6
1001
ACAD
1070
     2
  0
DICTIONARY
  5
18C
102
{ACAD_REACTORS
330
18B
102
}
330
18B
100
AcDbDictionary
281
     1
  0
ACDBDETAILVIEWSTYLE
  5
1A9
102
{ACAD_XDICTIONARY
360
2FE
102
}
102
{ACAD_REACTORS
330
1A8
102
}
330
1A8
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
100
AcDbDetailViewStyle
 70
     0
 71
     0
 90
        3
 71
     1
340
11
 62
   256
 40
0.24
340
0
 62
   256
 40
0.24
300

 40
0.36
280
     3
 71
     2
340
16
 90
       25
 62
   256
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewDetailId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
340
16
 90
       25
 62
   256
340
16
 90
       25
 62
   256
280
     0
  0
LAYOUT
  5
22
102
{ACAD_XDICTIONARY
360
191
102
}
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
none_device
  4
Letter_(8.50_x_11.00_Inches)
  6

 40
6.349999904632568
 41
6.349999904632568
 42
6.350006103515625
 43
6.350006103515625
 44
215.8999938964844
 45
279.3999938964844
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
3.560208697428376
 70
 11952
 72
     0
 73
     1
 74
     0
  7

 75
     0
147
0.28088241027059
 76
     0
 77
     2
 78
   300
148
0.1311165230791651
149
0.096403374003771
100
AcDbLayout
  1
Model
 70
     1
 71
     0
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
1F
331
90
  0
LAYOUT
  5
74
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\uFFFD\uFFFD\uFFFD\uFFFD1
 70
     1
 71
     1
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
73
  0
LAYOUT
  5
79
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\uFFFD\uFFFD\uFFFD\uFFFD2
 70
     1
 71
     2
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
78
  0
MATERIAL
  5
93
102
{ACAD_XDICTIONARY
360
185
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByBlock
  0
MATERIAL
  5
92
102
{ACAD_XDICTIONARY
360
183
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByLayer
  0
MATERIAL
  5
94
102
{ACAD_XDICTIONARY
360
10B
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
Global
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
1001
ACAD
1070
    -1
1070
     3
1070
     0
1000

1071
        0
1070
     0
  0
MLEADERSTYLE
  5
E0
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     1
143
0.125
1001
ACAD_MLEADERVER
1070
     2
  0
MLEADERSTYLE
  5
D3
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     0
143
0.125
1001
ACAD_MLEADERVER
1070
     2
  0
MLINESTYLE
  5
18
102
{ACAD_REACTORS
330
17
102
}
330
17
100
AcDbMlineStyle
  2
STANDARD
 70
     0
  3

 62
   256
 51
90.0
 52
90.0
 71
     2
 49
0.5
 62
   256
  6
BYLAYER
 49
-0.5
 62
   256
  6
BYLAYER
  0
ACDBPLACEHOLDER
  5
F
102
{ACAD_REACTORS
330
E
102
}
330
E
  0
SCALE
  5
B2
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:1
140
1.0
141
1.0
290
     1
  0
SCALE
  5
124
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:2
140
1.0
141
2.0
290
     0
  0
SCALE
  5
125
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:4
140
1.0
141
4.0
290
     0
  0
SCALE
  5
126
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:5
140
1.0
141
5.0
290
     0
  0
SCALE
  5
127
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:8
140
1.0
141
8.0
290
     0
  0
SCALE
  5
128
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:10
140
1.0
141
10.0
290
     0
  0
SCALE
  5
129
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:16
140
1.0
141
16.0
290
     0
  0
SCALE
  5
12A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:20
140
1.0
141
20.0
290
     0
  0
SCALE
  5
12B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:30
140
1.0
141
30.0
290
     0
  0
SCALE
  5
12C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:40
140
1.0
141
40.0
290
     0
  0
SCALE
  5
12D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:50
140
1.0
141
50.0
290
     0
  0
SCALE
  5
12E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:100
140
1.0
141
100.0
290
     0
  0
SCALE
  5
12F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
2:1
140
2.0
141
1.0
290
     0
  0
SCALE
  5
130
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
4:1
140
4.0
141
1.0
290
     0
  0
SCALE
  5
131
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
8:1
140
8.0
141
1.0
290
     0
  0
SCALE
  5
132
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
10:1
140
10.0
141
1.0
290
     0
  0
SCALE
  5
133
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
100:1
140
100.0
141
1.0
290
     0
  0
SCALE
  5
134
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/128" = 1'-0"
140
0.0078125
141
12.0
290
     0
  0
SCALE
  5
135
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/64" = 1'-0"
140
0.015625
141
12.0
290
     0
  0
SCALE
  5
136
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/32" = 1'-0"
140
0.03125
141
12.0
290
     0
  0
SCALE
  5
137
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/16" = 1'-0"
140
0.0625
141
12.0
290
     0
  0
SCALE
  5
138
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/32" = 1'-0"
140
0.09375
141
12.0
290
     0
  0
SCALE
  5
139
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/8" = 1'-0"
140
0.125
141
12.0
290
     0
  0
SCALE
  5
13A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/16" = 1'-0"
140
0.1875
141
12.0
290
     0
  0
SCALE
  5
13B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/4" = 1'-0"
140
0.25
141
12.0
290
     0
  0
SCALE
  5
13C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/8" = 1'-0"
140
0.375
141
12.0
290
     0
  0
SCALE
  5
13D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/2" = 1'-0"
140
0.5
141
12.0
290
     0
  0
SCALE
  5
13E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/4" = 1'-0"
140
0.75
141
12.0
290
     0
  0
SCALE
  5
13F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1" = 1'-0"
140
1.0
141
12.0
290
     0
  0
SCALE
  5
140
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1-1/2" = 1'-0"
140
1.5
141
12.0
290
     0
  0
SCALE
  5
141
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3" = 1'-0"
140
3.0
141
12.0
290
     0
  0
SCALE
  5
142
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
6" = 1'-0"
140
6.0
141
12.0
290
     0
  0
SCALE
  5
143
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1'-0" = 1'-0"
140
12.0
141
12.0
290
     0
  0
ACDBSECTIONVIEWSTYLE
  5
1A7
102
{ACAD_XDICTIONARY
360
2FC
102
}
102
{ACAD_REACTORS
330
1A5
102
}
330
1A5
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
100
AcDbSectionViewStyle
 70
     0
 71
     0
 90
       78
 71
     1
340
11
 62
   256
 40
0.24
340
0
340
0
 62
   256
 40
0.24
300
I, O, Q, S, X, Z
 40
0.48
 90
        3
 40
0.18
 90
        1
 71
     2
340
16
 90
       25
 62
   256
340
16
 90
       50
 62
   256
 40
0.24
 40
0.0
 40
0.24
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewSectionStartId>%-%<\\AcVar ViewSectionEndId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
 62
   256
 62
   257
300
ANSI31
 40
1.0
 90
        0
290
     0
290
     0
 90
        6
 40
0.0
 40
1.570796326794896
 40
0.2617993877991494
 40
1.308996938995747
 40
-0.2617993877991494
 40
1.832595714594046
  0
TABLESTYLE
  5
A7
102
{ACAD_XDICTIONARY
360
FF
102
}
102
{ACAD_REACTORS
330
A6
102
}
330
A6
100
AcDbTableStyle
  3
Standard
 70
     0
 71
     0
 40
0.06
 41
0.06
280
     0
281
     0
  7
Standard
140
0.18
170
     2
 62
     0
 63
     7
283
     0
274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.25
170
     5
 62
     0
 63
     7
283
     0
274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.18
170
     5
 62
     0
 63
     7
283
     0
274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  0
VISUALSTYLE
  5
9B
102
{ACAD_XDICTIONARY
360
2D5
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
2dWireframe
 70
     4
 71
     0
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9A
102
{ACAD_XDICTIONARY
360
2D3
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Basic
 70
     7
 71
     1
 72
     0
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A1
102
{ACAD_XDICTIONARY
360
2E1
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Brighten
 70
    12
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
50.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A5
102
{ACAD_XDICTIONARY
360
2E9
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
ColorChange
 70
    16
 71
     2
 72
     2
 73
     3
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     8
421
  8421504
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     8
424
  8421504
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9E
102
{ACAD_XDICTIONARY
360
2DB
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Conceptual
 70
     9
 71
     3
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     2
 91
        2
 64
     7
 65
   257
 75
     1
175
     1
 42
40.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A0
102
{ACAD_XDICTIONARY
360
2DF
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Dim
 70
    11
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
-50.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
172
102
{ACAD_XDICTIONARY
360
2F0
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
EdgeColorOff
 70
    22
 71
     2
 72
     2
 73
     0
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A4
102
{ACAD_XDICTIONARY
360
2E7
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Facepattern
 70
    15
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
96
102
{ACAD_XDICTIONARY
360
2CB
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Flat
 70
     0
 71
     2
 72
     1
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
97
102
{ACAD_XDICTIONARY
360
2CD
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
FlatWithEdges
 70
     1
 71
     2
 72
     1
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
98
102
{ACAD_XDICTIONARY
360
2CF
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Gouraud
 70
     2
 71
     2
 72
     2
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
99
102
{ACAD_XDICTIONARY
360
2D1
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
GouraudWithEdges
 70
     3
 71
     2
 72
     2
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9D
102
{ACAD_XDICTIONARY
360
2D9
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Hidden
 70
     6
 71
     1
 72
     2
 73
     2
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     2
 91
        2
 64
     7
 65
   257
 75
     2
175
     1
 42
40.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
170
102
{ACAD_XDICTIONARY
360
2EC
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
JitterOff
 70
    20
 71
     2
 72
     2
 73
     0
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
       10
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A3
102
{ACAD_XDICTIONARY
360
2E5
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Linepattern
 70
    14
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     7
175
     7
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
171
102
{ACAD_XDICTIONARY
360
2EE
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
OverhangOff
 70
    21
 71
     2
 72
     2
 73
     0
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        9
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9F
102
{ACAD_XDICTIONARY
360
2DD
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Realistic
 70
     8
 71
     2
 72
     3
 73
     0
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17F
102
{ACAD_XDICTIONARY
360
2FA
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded
 70
    27
 71
     2
 72
     2
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     8
425
  7895160
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        5
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17E
102
{ACAD_XDICTIONARY
360
2F8
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded with edges
 70
    26
 71
     2
 72
     2
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        2
 64
     7
 65
   257
 75
     2
175
     1
 42
1.0
 92
        8
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        5
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17B
102
{ACAD_XDICTIONARY
360
2F2
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shades of Gray
 70
    23
 71
     2
 72
     2
 73
     3
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     2
 91
        2
 64
     7
 65
     7
 75
     1
175
     1
 42
40.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17C
102
{ACAD_XDICTIONARY
360
2F4
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Sketchy
 70
    24
 71
     1
 72
     2
 73
     2
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     2
 91
        2
 64
     7
 65
     7
 75
     1
175
     1
 42
40.0
 92
       11
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     6
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A2
102
{ACAD_XDICTIONARY
360
2E3
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Thicken
 70
    13
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
       12
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9C
102
{ACAD_XDICTIONARY
360
2D7
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Wireframe
 70
     5
 71
     0
 72
     2
 73
     0
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17D
102
{ACAD_XDICTIONARY
360
2F6
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
X-Ray
 70
    25
 71
     2
 72
     2
 73
     1
 90
        1
 40
0.5
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
DICTIONARYVAR
  5
227
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
60.000000
  0
DICTIONARYVAR
  5
EB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1:1
  0
DICTIONARYVAR
  5
EA
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
AB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
1B4
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
1B5
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
5A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
5E
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
226
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14B
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
224
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
223
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
225
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
127
  0
DICTIONARYVAR
  5
228
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARY
  5
2C7
102
{ACAD_REACTORS
330
2C5
102
}
330
2C5
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
2C6
102
{ACAD_REACTORS
330
2C5
102
}
330
2C5
100
AcDbDictionary
281
     1
  3
1654967885312
350
2C0
  3
1654967885328
350
2C1
  3
1654967885344
350
2C2
  3
1654967885360
350
2C3
  3
1654967885376
350
2C4
  0
DICTIONARY
  5
2FE
330
1A9
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2FF
  0
DICTIONARY
  5
191
330
22
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
185
330
93
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2C9
  3
FBXASSET
360
186
  0
DICTIONARY
  5
183
330
92
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2C8
  3
FBXASSET
360
184
  0
DICTIONARY
  5
10B
330
94
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2CA
  3
BUMPTILE
360
10D
  3
DIFFUSETILE
360
10C
  3
FBXASSET
360
187
  3
OPACITYTILE
360
10E
  3
REFLECTIONTILE
360
10F
  0
DICTIONARY
  5
2FC
330
1A7
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2FD
  0
DICTIONARY
  5
FF
330
A7
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_ROUNDTRIP_2008_TABLESTYLE_CELLSTYLEMAP
360
2BE
  3
ACAD_XREC_ROUNDTRIP
360
2EB
  0
DICTIONARY
  5
2D5
330
9B
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2D6
  0
DICTIONARY
  5
2D3
330
9A
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2D4
  0
DICTIONARY
  5
2E1
330
A1
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2E2
  0
DICTIONARY
  5
2E9
330
A5
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2EA
  0
DICTIONARY
  5
2DB
330
9E
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2DC
  0
DICTIONARY
  5
2DF
330
A0
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2E0
  0
DICTIONARY
  5
2F0
330
172
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2F1
  0
DICTIONARY
  5
2E7
330
A4
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2E8
  0
DICTIONARY
  5
2CB
330
96
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2CC
  0
DICTIONARY
  5
2CD
330
97
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2CE
  0
DICTIONARY
  5
2CF
330
98
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2D0
  0
DICTIONARY
  5
2D1
330
99
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2D2
  0
DICTIONARY
  5
2D9
330
9D
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2DA
  0
DICTIONARY
  5
2EC
330
170
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2ED
  0
DICTIONARY
  5
2E5
330
A3
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2E6
  0
DICTIONARY
  5
2EE
330
171
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2EF
  0
DICTIONARY
  5
2DD
330
9F
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2DE
  0
DICTIONARY
  5
2FA
330
17F
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2FB
  0
DICTIONARY
  5
2F8
330
17E
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2F9
  0
DICTIONARY
  5
2F2
330
17B
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2F3
  0
DICTIONARY
  5
2F4
330
17C
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2F5
  0
DICTIONARY
  5
2E3
330
A2
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2E4
  0
DICTIONARY
  5
2D7
330
9C
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2D8
  0
DICTIONARY
  5
2F6
330
17D
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
2F7
  0
XRECORD
  5
2C0
102
{ACAD_REACTORS
330
2C6
102
}
330
2C6
100
AcDbXrecord
280
     1
  1
AcDb_Thumbnail_Schema
102
{ATTRRECORD
341
2C1
  2
AcDbDs::TreatedAsObjectData
280
     1
291
     1
102
ATTRRECORD}
102
{ATTRRECORD
341
2C2
  2
AcDbDs::Legacy
280
     1
291
     1
102
ATTRRECORD}
  2
AcDbDs::ID
280
    10
 91
        8
102
{ATTRRECORD
341
2C3
  2
AcDs:Indexable
280
     1
291
     1
102
ATTRRECORD}
102
{ATTRRECORD
341
2C4
  2
AcDbDs::HandleAttribute
280
     7
282
     1
102
ATTRRECORD}
  2
Thumbnail_Data
280
    15
 91
        0
  0
XRECORD
  5
2C1
102
{ACAD_REACTORS
330
2C6
102
}
330
2C6
100
AcDbXrecord
280
     1
  1
AcDbDs::TreatedAsObjectDataSchema
  2
AcDbDs::TreatedAsObjectData
280
     1
 91
        0
  0
XRECORD
  5
2C2
102
{ACAD_REACTORS
330
2C6
102
}
330
2C6
100
AcDbXrecord
280
     1
  1
AcDbDs::LegacySchema
  2
AcDbDs::Legacy
280
     1
 91
        0
  0
XRECORD
  5
2C3
102
{ACAD_REACTORS
330
2C6
102
}
330
2C6
100
AcDbXrecord
280
     1
  1
AcDbDs::IndexedPropertySchema
  2
AcDs:Indexable
280
     1
 91
        0
  0
XRECORD
  5
2C4
102
{ACAD_REACTORS
330
2C6
102
}
330
2C6
100
AcDbXrecord
280
     1
  1
AcDbDs::HandleAttributeSchema
  2
AcDbDs::HandleAttribute
280
     7
 91
        1
284
     1
  0
XRECORD
  5
2FF
102
{ACAD_REACTORS
330
2FE
102
}
330
2FE
100
AcDbXrecord
280
     1
102
DISPLAYNAME
  1
Imperial24
102
FLAGS
 90
        0
  0
XRECORD
  5
2C9
102
{ACAD_REACTORS
330
185
102
}
330
185
100
AcDbXrecord
280
     1
102
MATERIAL
148
0.0
149
0.0
149
0.0
 93
        0
 94
       63
282
     0
 72
     1
 77
     1
171
     1
175
     1
179
     1
273
     0
  0
XRECORD
  5
186
102
{ACAD_REACTORS
330
185
102
}
330
185
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
7581DE8E-A623-425F-9BF4-B3F4BE6C4F9A
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623B9A2F3B5FEC0000007C01000008000000636F72652E786D6C8D90416E83301045AF62CDB632D8040820E328B4E204BD80653BC44AB011B6AB1EBF262152BBEB6A467FFE9B197D76FA9EEFE84BAFDE38DB03CD08206DA553C64E3DC470C10DA01367AB73E1970D9015B3EE61
310
9381B3697571D925E96CD03624D53AA5775178AF0320794F4D0F5E5EF52C32114372F85BB608791393CEE8AB4B708C46A1E711A3D23E73317A055E0D4D53D6C71A9FC7A1C6657D18703354232ECFED4731B6B43CBED72CDF60CE82995FF7E5AA45D00A7841488B29C5A4F8A46547AAAEA8DE48D311C2F2CDFE078A8BFA2714
310
8D0D87627FF78979E0343DF21870966F59A4F2082AD52D37FE03504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623B6E137E0172010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C0810121947A1554ED00B38E05014B091B1518EDFE511A5A9D22AFD2A1F60CDEC7A67C698ED2E6D8306
310
69FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7166B4B65FCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B0FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2601EE7691A25EBC4DB1FF2C48B9255EEA5797C
310
F0A2FDE62D3C6C8268FD9A3032367366EBF6AAAE30525859621E52BAF182C0A3E17B106D69BC0DE3179A6E2965642CBF6B725DF96493AB955D858BDCB9ADC73C002113F1CD2D4464512F06D04338236388F09912BE0F1A028190AD3836571F67800659586D22604AED6ED4201A27612AF5E9F4A09F178CCC9D3075DA1C5C3F
310
9C113E3DE3F71DE1A885AAC084B0B03C3A3BEA64B38625B44E1A6FB017A4B46945F39C8D5F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F02504B0304140006080800AC70623BE001BAC07D0000009D0000000B0000006662782F636E782E786D6C4DCCD10AC2201886E15B91FFDCA6536B037548D87D8CE686
310
E4344CA3CB6F8B1D74F4C1C3C72B87CF1AD0DBE5974F51013D11402EDED3E4E3A2A096197780062D734AE5EF06288EAB53B03368B9E4549F074D6E1E6B289B061F1F07124689687987B9601C7373BD60C36E065B6A6DDF7341A93843A365F32B6DBB87F517504B0304140006080800AC70623B8E5068122901000012020000
310
310000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C8D515B6EC32010BC0AE22B55850D364E93081345557A825E801892A2C460F1A872FC2EB523B57FF961D1EECCECECAED8DFC71BFA36215AEF7ACC2A8A917183D7D65D7A9CD3996C30DA4B
310
11BC4F7F601839359A1E973496E2127C9E96D4E05D322E41D6796D96A48AD1248C861B7C7A1C872F33AA4AE5048878AD26355CD5C554AC8232E0A4882980013437292F96B465B46BF886F0AEE5841FDEDFC8A1FD3890233B1EB75BDE31D6AD453D13A5C8D9EA856E35D8B1676BC2B322852C45B2E3C3FE108C4A4663D950BA
310
258C11DA7C32BEA3DDAEE95EE96647A9A80BFC1F294FFA4952B62EB5CD6277A6452C99A8E78214DAE7D3ED61C6DC271F122AFD56D10C2F305545CB6A60FC1908E383E29A2F8A31F900EB5D5D4F8065DD2CBBE652D4E542107ECF07B15C53FE00504B0304140006080800AC70623B503B51794E010000330300003000000066
310
62782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F
310
77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347
310
DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F
310
504B0304140006080800AC70623B38FA165F680500003C100000340000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F6F626A656374732E786D6CAD575D6FA33814FD2B887D0E8424EDB42BCAA8499A2A1A756634D18CF6A15264C0A16CC146B6E9A4FBEBF7180C
310
019276B21F7908D8D8F7F3DCE36BFFE33ECFAC172A64CAD98DED3963DBA22CE271CA921BBB54BBD1956D7D0C7CC1B9EA2CB32D46727A63EB693BF013C1CBC24CC57447CA4C0D6657F33F2C1951466D2BCA889437B68C9E684E1C522A1E53F9ECC4441127D9ED1DCFA917F6C52682144F03A105119429588A790629566D94D7
310
1F8E6D37F05DFD3DF0F5BF59357D7B955BF9D3D79F32A9088B8E940DC44CBDD9F26E72713DBA98CDA6A3D9E5C41BCD57F3E5C8FB301D2F2E178BEBDBBB6B28964A4092B144D09D1DDC2336228D7CB7FED45A6C0C3F6552C419A351E53F3CAC6C3612635A5016238F2995D0D6F17ADC1F7A3A369DCF533D362ABBD3E779D5DD
310
D111D4D8DE3CBB96F2F04FB820CF41859054A3AA8E8F71B4C6DFF810B590F3CC7C4BA5951345454A322B4B4341C4AB1D60A95E12F83D311A9D42235C7B6007DE415ED75694C6AFB17BCACA5D99651A9A7650217B0BFC53252BCBD2BFA838AD0D36215765CAD4957148BD16D40EAE7DB79A0C7CFD984ECCC73A90D62E230952
310
0E37EBAF034717BAF6D64B3BF8B40AF71B5D8FA79517821754280D1F40AB495CF3D451326ABDB332A737C0995ECC0F41F986C87F46F91E4C41DE44BA9FED67468B1284C91D173972E38CAB9F356E5E46EDDBF10BF86CB0FA784D3BF3AF16FB6E6B6C9F30DECA1FC0A55373F5DFF3D78F5917A99DF405FE0B0A8C8BA909E526
310
2219A8E72165488806A595714C81CB77E1DE0ED6604A303B76912C680372F4E2BB2FF88EFF5A36D8AA52DF79322474C0B767303F625995056C7B032C473C592936CEBD15F38BFFA5666E979B4F9B52EC48441F0CB12CE92E65A9C2D979006FD7A05E227A1E3DD3D79F5CC470F438099B6E1272A34A22DA3AE63AF0497358E8
310
C141734F41847D09D79CE7FF42C3432A239A6584515E365ADA634863B52519D327A00AEB804E2703140BFA92EA4EA2B7A26716CEFA48A4850E597BE8B53CEDBCE1CBF7F56780D20EE6AF73A0F5F9B02A3CD07DC4332EB6E1EBB666421BE0C39E3EBA7FF4E16D22EA6A29407C85E586724C88B771BADB9512BC7B228A3FD68B
310
6EA65A22397E690AA8D158D7E40CEC8CDA23C2C0B7D1898640101CEC9C6D531CE328CB93CABBBA870A6425F70DF96199175B92F392A973C2346EFC69AC6F8577BB18F993A8E8C90E36D573340765C7343EA4AA87027D049DF0A9979E0F1757DEF2EEEA6E747B39412B35B9588DAEE7ABD9683E5DCDE677978BD9EAFAB6B5A8
310
B224F09B13AA5B8388264E44BF14A909F3F7F5A16CEDE08128E9DED705E526F5F3FBDA415BECBBD80380B71BD77991D19C3245347C1FF44BF68DA0ABE8C9A8E7D73949E81952BEDC6F063660E68C7D5F75A9D19F83BD6676A16BE1A410F554E621236936D8681C770A9618B79B50B6CF9AD19BA11E9978A20F953C4B63104E
310
6C2594E7548176CE607B915309C474BBF2D8DC1ECED8FD52F7838A84196D2C79226889330954036E65A4FAF3D66F68E174177563E3B0739EF1670AD1B690EA1B1BFCA6D2884A27C4F1A81B9F4A3820802EAC2541408DB02443675D6F6AC7ED2E1D1BD00F4E40A3BF5D724EB764FCEA116F4E8A02A7768F562BDB8C82E81F39
310
DE98631185D7B054AD2F8789D6994A0D2AAB76CADC0DD0423C1BD57BD4D7FB6E794EB5A61791B3EE49EF82A0963A524424D5BD40DB674CBA5D7E75D10A58EB2F569195097279BEA491A00073A90B1C28022A8CCC82284075F1FBE357C17117CDAD550A083C2E789E736606B7E62E6B6D9E70338D1F410B545F3FE464EC798F
310
55D76F2E22DB9048EA90583E63A22938EDC1006B00E4D1716A52E0EA1C0C96AF9796393066105A81F6A829ADAFE1168A47DF1C75A974C9B278B7F177ABA5008340CB1EFC0D504B0304140006080000AC70623B000000000000000000000000350000006662782F30333130353234382D343533342D344143372D413346412D
310
4531454539393435313135362F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E636660600000504B0304140006080000AC70
310
623B000000000000000000000000370000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30333130353234382D343533342D344143372D41
310
3346412D4531454539393435313135362F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11D
310
E607FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BF2C5666EFF000000A00100003B0000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F7265736F7572636573
310
2F636F72652E786D6C8D504B6E833010BD0A9A6D65B00910888CA3D02A27E8052C33A156821DF953F5F8B5132AB5BB6E6646EFA3797AFCF8B5DE8A4F745E5B33022B291468949DB5594688E1427A288E823B6BC32F191446AE38428641F0C5D978DF20654D4013126AEC8C1B28BDC70085BAA56304AF3E7095A58C2129FCB5
310
BC4B75950B96AC4C74D209EE834B018AE7933C4138F4363A859E574F56F018F5BC69F49C7EEA8B4607A29DFABEE9F62D399DA78E34DD6E22FDD49E49731ADEEAF3C09AFD6BC7AB6C163CE8F527A3722803CE206A4A07C218A1F53B6B0EB43DD4ED0BED0F94F22ACBFF98E27DFEA7296A1376F516F769F320580AF22004AF72
310
5F693DCA4C3B772BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B200
310
00005B436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623B9A2F3B5FEC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D
310
6C504B01021400140006080800AC70623B6E137E0172010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623BE001BAC07D0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B010214001400060808
310
00AC70623B8E506812290100001202000031000000000000000000000000005B0500006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D3
310
0600006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6C504B01021400140006080800AC70623B38FA165F680500003C10000034000000000000000000000000006F0800006662782F30333130353234382D343533342D344143372D413346412D4531
310
454539393435313135362F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000290E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F76657274696365732E62696E504B01021400
310
140006080800AC70623BF270F133060000000400000036000000000000000000000000007C0E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000
310
000000000000000000D60E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD1900000004101000036000000000000000000000000002B0F00006662782F30333130353234382D
310
343533342D344143372D413346412D4531454539393435313135362F6469726563746F72792E786D6C504B01021400140006080800AC70623BF2C5666EFF000000A00100003B000000000000000000000000000F1000006662782F30333130353234382D343533342D344143372D413346412D453145453939343531313536
310
2F7265736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000671100000000
  0
XRECORD
  5
2C8
102
{ACAD_REACTORS
330
183
102
}
330
183
100
AcDbXrecord
280
     1
102
MATERIAL
148
0.0
149
0.0
149
0.0
 93
        0
 94
       63
282
     0
 72
     1
 77
     1
171
     1
175
     1
179
     1
273
     0
  0
XRECORD
  5
184
102
{ACAD_REACTORS
330
183
102
}
330
183
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
778E3A9F-1AF3-452F-85C1-1BC15BD3F630
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BFD5588D4EC0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103891DC7C24471939CA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EF81EEFE8CBCCC17AD7012D0820E394D7D60D1DA478C50DA083E0B3F7F1970D9093A3E960
310
9141F061F6695A25E55D342E66D5796D56518660222075CF4D07417D9A511632C5EC08B76292EA260753D05797E194AC46CF2356E77DF66ACD0C62C768BD63971E5727D2E06DDF9C71BF7B3FE10BABF79BFA488FE4DCF07281058F767CDD57B391D168108C903DA61413F641B72DA95A56BD91A62584978BFD0F9426FD4F28
310
5917376C7DF7890510343FF218085E2E59E4F2082AD72537F103504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB5D38BAD72010000D40300000C0000006662782F636F72652E786D6CC553DB8E823014FC95A6AF1B68C11B9A52A3AB7EC1FE4085CA36424B4A4BFCFC3D5C8CEBC635EED3F200CDCC393D3353CAD697AA44AD
310
B48D323AC5514831923A33B9D2458ABD3B0509466BCEAC31EE5B19465A5432C51D8C392BACF1F50865463BA91DA0DAE4720445D348875156C222C54DF6292B110AEFA0A23987B5C8CEA2906114020D759C35CE8200340CE9DE989F8E1746069C33EF553EB22A8769EAA4A4C57C1147F3457CD806B31D4D82E936D907DBC5FB
310
2E38C4F3E564BE8936749F30D23573E65475559759299CCC318F295D065114D0F8239AAEE86C15CFDE68B2A29491AEFCAEC9D7F98B4D5E69378947B9435B837904427AE2875B88C8A146B4A0877046BA10E1D3277C1F340402213B712CAF3ECE00B53273C64E81C98DBF51AD28BD84A934A4FD837E5F303274C2D47E7370FD
310
7046FCF28CE73BC2510B5D8009E16079F4AED3C9060D6368B5B441EB2E481B5B89F2351B4F1CFE89BA897F282933A5B1FFA5888C0744C6DF8374F7917F01504B0304140006080800AC70623B09885E1C7E0000009D0000000B0000006662782F636E782E786D6C4DCCDF0A83201C86E15B91DFB9CBA6FD11D41063F711CB42
310
663A9C8E5DFE6A74B0A30F1E3E5E317C368FDE36BD5C0C12EA0B0164C33DCE2EAC124A5E700F685022C598FF6E80C2B459090783126B8AE579D26C97A9F8BCAB77E17122E586D5843498B3EE8699D114F39E5E713D76EDA84DCBB569A052A2FA95F63DC2EA0B504B0304140006080800AC70623B961D28872A010000120200
310
00310000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C8D515B6EC32010BC8AC557AA0A1BFC4A1C61A2C8514FD00B10435294182C1E558EDFA576A4F62F3F80666766875D76784CF7EC5B39AFADE911CD09CA9419ADD4E6DAA3182E7887B203
310
67CEDAF08786322326D5A30423CEAECEC67985466B8232015063A55A41E1BD0A281BEFF0E8911FBFD42472110330FC2D9FC578135795D31CCAC0E3CC070701B2A5493A11AFBAA1A68434B8ABB71FB81E8E15EE765589E969DB9E8E43DB1D8786158B90B318B55CE55A421C7DD1CABD6A92C49C053D3DE38F4E89A024E22521
310
1DA61493F293D67BD2ECCBE69DECF684B022D1FF89E22C5F14456D4255AE711799479CB2622970266D3CDF9F61D463B62E64A9DFC6ABF10D7192C35CCA0A040B11BE0F8E6DBD3AFA601D8C77733B0397C290926D5B7356A40DC1F5BB3EB8D336F90F504B0304140006080800AC70623B503B51794E01000033030000300000
310
006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1E
310
BC4F77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C54
310
2347DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F
310
103F504B0304140006080800AC70623B2EA4D28F640500003C100000340000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F6F626A656374732E786D6CAD575D739B3814FD2B0CFB6C30B1D3263B844E6CC71D4F376DA79E76F621331E01326103122389C4E9AFDF
310
231018B09D7A3FFC609090EEE7B94757FE875D9E59CF54C894B31BDB73C6B64559C4E394253776A9B6A32BDBFA10F88273D559665B8CE4F4C6D6D376E027829785998AE99694991ACC2E677F5A32A28CDA569411296F6C193DD29C38A4543CA6F2C98989224EB2DD399E532FEC8B4D04291E07420B222853B014F30C52ACDA
310
28AF3F1CDB6EE0BBFA7BE0EB7FB36A727A955BF9D3D79F32A9088B0E940DC44CBCE9E2EEE2F27A74399D4E46D37717DE68B69C2D46DEFBC978FE6E3EBFBEBDBB8662A90424194B04DDDAC147C446A491EFD69F5A8B8DE1C74C8A386334AAFC878795CD46624C0BCA62E431A512DA3A5E8FFB434FC7A6F379A2C7466577FA3C
310
AFBA3B3A821ADB9B67D7521EFE0517E439A810926A54D5F1318ED6F81BEFA316729E996FA9B472A2A84849666569288878B5032CD54B02BF2746A35368846B0FECC0DBCBEBDA8AD2F835768F59B92DB34C43D30E2A646F807FAA646559FA938AE3DA60137255A64C5D1987D46B41EDE0DA77ABC9C0D78FC985F95807D2DA66
310
2441CAE166FD75E0E85CD7DE6A61079F96E16EADEBF1B8F242F0820AA5E1036835896B9E3A4A46AD7756E6F40638D38BF93E28DF10F9CF28DFBD29C89B4877D3DDD468518230B9E522476E9C71F5B3C6CDCBA87D3B7C019F0D561FAE6967FED562DF6D8DED13C6A9FC015C3A3557FF3D7FFD987591DA495FE03FA3C0B89898
310
50AE2392817AEE53868468505A19C714B87C1BEEEC6005A604B36317C9823620072FBEFB8CEFF8AF6583AD2AF59D274342077C7B06F323965559C0B6136039E0C94AB171EE54CC2FFF979AB95DAC3FAD4BB12511BD37C4B2A0DB94A50A67E71EBC5D837A89E879F4445F5FB888E1E86112D6DD24E4469544B475CC75E093E6
310
B0D083BDE69E8208FB12AE39CFFF8586FB544634CB08A3BC6CB4B4C790C66A4B32A64F4015D6019D5C0C502CE873AA3B89DE8A9E5938EB2391163A64EDA1D7F2B473C297EFABCF00A51DCC5EFF20AF5DC20CF7741FF18C8B4DF8BAA999D006F8B0A78FEE1F7D789B88BA5A0A105F61B9A11C13E24D9C6EB7A504EF1E89E28F
310
D5BC9BA996480E5F9A026A34D63539053BA3F68830F06D74A2211004073B679B14C738CAF2A8F2AEEEA10259C93D213F2CF36243725E32754E98C68D3F8DF5ADF06E17235F888A1EED605D3D473350764CE31309D547D0119F7AE979FFFEEA6E727BBD1C79B74BB4529717CBD1D5E5DC1B79B3B977395B4C96EF2638E6FA15
310
D09C50DD1A44347122FAA5484D98BFAFF6656B07F74449F7635D506E523FBFAF1CB4C5BE8B3D0078BB71951719CD295344C3F75EBF64DF08BA8A9E8C7A7E9593849E21E5CBC7F5C006CC9CB1EFAB2E35FA32D86B66E7BA168E0A518F651E329266838DC671A7608971BB0965FBAC19BD19EA918927FA50C9B33406E1C45642
310
794E1568E70CB6173995404CB72B8FCDEDE18CDDCF753FA84898D1C6924782963893403548A78C547FDEFA0D2D9CEEA26E6C1C76CE13FE4C21DA16527D6383DF541A51E984381E75E353090704D085B52408D0139664E8ACEB4DEDB8DDA56303FAC10968F4B74BCEE9968C5F3DE2CD4951E0D4EED16A659B5110FD23C71B73
310
2CA2F01A96AAF5653FD13A53A909C03570A77DA0857832AA77A8AFB7DDF29C6A4D2F2267DD93DE04412D75A48848AA7B810EBA31E976F1D5452B60ADBE58455626C8E5F992468202CCA52E70A008A830320BA200D5F9EF0F5F05C75D34B7962920F030E779CE9919DC9ABBACB57EC4CD347E002D507DFD901763CF7BA8BA7E
310
7311D984445287C4F209134DC1690F065803200F8E53733D73750E06CB570BCB1C185308AD407BD094D6D7700BC5A36F8EBA54BA6459BCD9F8BBD552A040A0650FFE06504B0304140006080000AC70623B000000000000000000000000350000006662782F33394334313030352D393437462D344341332D393833322D3144
310
373644414336394143352F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B
310
000000000000000000000000370000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F33394334313030352D393437462D344341332D393833
310
322D3144373644414336394143352F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607
310
FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623B95BFD5E5FE000000A00100003B0000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265736F75726365732F63
310
6F72652E786D6C8D50596E833010BD0A9ADFCA603B1B41C611699213F40296992456828DBC543D7E4DA052FBD79F99D15B344F4F1CBE8667F1893E18675B60258502AD76BDB1B71652BC921A8A8314DEB9F84B06855503B630C120C5CDBB342E907636A28D19B5AEC70554216084423FF3D142D0771C54A952CC8AF02847A5
310
1FEA86252B339D755284E87380627E324D901E834B5E6310D5CC4A9192E9178DE9F34F7335E841EE38DBEEF8A5239B13ADC9FA589FC971F77E2217BEDDAFB61DEBE8B916D56496229AE127A3F6A822F62039A57BC218A1FC83AD1BBA69F8E68DD60DA5A29AE47F4C69ECFF694AC6C6155FE2CEB60092E5202F428A6AEA2BAF
310
5799794FDDCA6F504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B
310
436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BFD5588D4EC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D6C504B
310
01021400140006080800AC70623BB5D38BAD72010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623B09885E1C7E0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B01021400140006080800AC70
310
623B961D28872A0100001202000031000000000000000000000000005C0500006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D5060000
310
6662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6C504B01021400140006080800AC70623B2EA4D28F640500003C1000003400000000000000000000000000710800006662782F33394334313030352D393437462D344341332D393833322D3144373644
310
414336394143352F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000270E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F76657274696365732E62696E504B01021400140006
310
080800AC70623BF270F133060000000400000036000000000000000000000000007A0E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000000000
310
000000000000D40E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000290F00006662782F33394334313030352D393437
310
462D344341332D393833322D3144373644414336394143352F6469726563746F72792E786D6C504B01021400140006080800AC70623B95BFD5E5FE000000A00100003B000000000000000000000000000D1000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265
310
736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000641100000000
  0
XRECORD
  5
2CA
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
102
MATERIAL
148
0.0
149
0.0
149
0.0
 93
        0
 94
       63
282
     0
 72
     1
 77
     1
171
     1
175
     1
179
     1
273
     0
  0
XRECORD
  5
10D
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10C
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
187
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
 70
     0
 90
1778669749
  1
7E355024-1ABF-47F9-966E-F2159FBE82AB
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BDCE527C8EB0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103B15DC7C24471249FA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EFA9EEFE8CBACC17AD7032D0820E394D7D64D3DA478C52DA093E0ABF7F1970D9093B3E961
310
9341F069F569D925E55D342E66D5796D76518660222075CF4D0F417D9A591632C5EC08B76291EA262753D05797E194AC46CF2356E77DF66ACD0A621C9B73335C463C5E0E1457EC9DE2A1612D3E9233A92BD2D66333F07283058F767EDD57AB91D168108C9023A61413F641AB8ED41DABDF48DB11C2CBCDFE074A8BFE2794AC
310
8B07B6BFFBC402089A1F790C042FB72C72790495EB969BF801504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF32603847
310
2BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB24894EB71010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C085012194749244ED00B38E05014B091B1518EDFE511A5A9D228FD2A1F60CDEC7A67C6986D2F6D830669
310
FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7266B4B6DFCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B4FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2609EE7C92ED91F722F3FAC022F0ADF036F9F84A9
310
B7A63B1A47348DF364CFC8D8CC99ADDBABBAC2486165897948E9DA0B028F861F41B4A1F1268CDF68BAA19491B1FCAEC975E58B4DAE5676152E72E7B61EF300844CC40FB7109145BD18400FE18C8C21C2674AF83E68080442B6E2D85C7D9C011A6461B5898029B5BB5183689C84A9D4A7D3837E5F303277C2D4697370FD7046
310
F8F28CE73BC2510B5581096161797476D4C9660D4B689D34DE602F4869D38AE6351B4F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F01504B0304140006080800AC70623B3A54DFB77D0000009D0000000B0000006662782F636E782E786D6C4DCCD10A83201805E05791FFDEA5EBA76DA046A37C8F581632D3
310
613AF6F8B3D1C52E0E073E0E47B49FD591B7899B0D5E023F3120C63FC264FD2221A7995E81B44AC410D2DF0C881F5723616750628921BF0E9ACC3C66978A3AEB9F07B2A6D77AB87514F95953EC39D20EEF9C6AD60C88BC2EB940A544F57B2ABD1FAB2F504B0304140006080800AC70623B4A17098729010000120200003100
310
00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C8D515B6EC32010BC0AE22B55850D0E76930813A54A7C825E80DA244589C1E251E5F85D6A476AFFF2018B7667666759B1BF8F37F4AD7D30CEB6981514236D7B37187B69718A67B2C1682F8577
310
2EFE816164D5A85B9CD3588A8B77695A52BDB351DB0859EB06BD2455083A62D4DFE0D1E2D07FE951152A4540846B31A9FEAA2EBA600594012745881E0CA0B949BEB1A4CDB1EB4EDB03E1ACEA083F324E0EFC9D918E3627CED91ACE9B2867A214299961A19B01EC98B3D1FE59914C96229AF161BFF75A453D605951BA258C11
310
5A7D30BEA3F5AEAA5FE96647A92833FC1F294DC393A4646C5C578BDD9916B064A29C0B520C2E7DDE1E66F47D723EA2DC6F1574FF02531594D6AC69443903617C506CF8A218A2F3F0BDABEB2760593DCB365C8A326F08C2EFFA20E66DCA1F504B0304140006080800AC70623B503B51794E0100003303000030000000666278
310
2F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F7736
310
4A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347DEE0
310
50F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F504B
310
0304140006080800AC70623BD8F6D0D5660500003B100000340000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F6F626A656374732E786D6CAD575B8F9B3814FE2B887D064292B964C5504D92491555D3568D5AEDC348910187610730B2CD4C667FFD7E06438024
310
6DF6928780CDF1B97EE762EFC33E4B8D57CA45C2F23BD3B547A641F39045491EDF99A5DC59B7A6F1C1F73863B243661A39C9E89DA9B64DDF8B392B0BBD15D11D295339D85DCDFF304448736A1A614A84B83345F84C33629352B2888A173B2292D8F16E6FBB764DD8671B73523C0F981684D35C4253ECE7E062D44AB9FDE5C8
310
747CCF51DF7D4FFD6BAAC9792AA7B2A72F3FC985247978246CC066E24E970FE3AB9975359D4EACE9F5D8B5E6ABF9D2726F26A3C5F56231BB7F9841B0901C9CB4269CEE4CFF237CC393D073EA4FADC65AF1532A852CCF6958D90F0B2B9D35C78816348F10C7840A48EB583DEA2F5DE59BCEE7895A6B91DDEDCBACEA9EE8306A
310
746F9E5D4D59F0274C1097A0820BAA5055FB471B5AE36F74F05AC058AABF25C2C888A43C21A991260127FCDDF441AA487CAFC746A1932B842B0B4CDF3DF0EBEA8AD4F835764F69B92BD35441D3F42B646F817F2A45A559F217E5A7A54127C4AA4C7279AB0D92EF0535FD99E7549BBEA71E93B1FE583BD2D8A52446C86166FD
310
7560E842E5DE7A69FA9F56C17EA3F2F1B4F082B38272A9E0036835816B9ECA4B5AAC7B51E4D40118D3F3F9C129DFE0F9CF48DF832A881B4FF6D3FD544B919CE462C77886D8D8A3EA678C9A17AB7D3B7E413D1B501FD3B43BFF8AD8735A65FB05E35CFC002E159ADBFF1EBFBECFBA48ED84CFF75E91608C4FB42B372149517A
310
1E931C0151A03452862DD4F25DB037FD352A252A3B4E91D46F1D72F4E239AFF88EFF9A37AA5525BEF3CC11D041BDBDA0F2C397555A40B7336039AA9395606DDC399F5FFD2F3973BFDC7CDA947C4742FAA80BCB92EE923C91E89D07F07615EA05A267D10B7D7F633C82A1C741D8748390695102DE563E578E8F9B66A11607C9
310
3D0121CEC54CD53CEF17121E1311D2342539656523A56D430AAB6D91D17302B2B076E8643C4031A7AF899A247A143DB5D0EB439E14CA656DD36BEBB47DC696EFEBCF0025E8531690F440141CAA7DC852C6B7C1FBB62E8426B087237D70FFE8A35B3BD4515C00F80ACA4DC5D11EDE46C96E570A94DD134EFCB15E7403D5D691
310
E397267F1A89754A4E519C917A846BF43632310F7082BECEF26D822E8EAC3C29BC2B7B2840547CCFF00FCAACD8928C95B9BCC44DA3C69E46FB96797788116F4486CFA6BFA99ED61C153BA2D121543D10A80E74C2A65E786E1E265757A3F1D472EFE72B6B7AB39A59B3EBEB076B3576AF66ABF9C3EDF87EDE6A5469E27B4D83
310
EAA620BC8986E8953CD16EFEBE3E64ADE93F12299C8F753E3971FDFCBEB631157B0ECE00DFEDC17556A434A3B9240ABD8FEA25FD463054F478D4FBEB8CC4F4022E5F3E6E063A60E782735F55A6D1B7C159BDBB50B97092897C2EB32027493A38A80DB78B3CD66637AE6C9F75416F966AA5FD893154B03489506F2223A62CA3
310
1255E78262CF332A8098EE501EE9CBC305A75FEB71509220A58D26CF0413712A806AC0AD0C657FDFF80D139C1AA2EE4CF43AFB057F3A114D03A1BE3351DE6412526107E88E6AEEA998030218C2DA1A08A8913C4E3158D787DA757B4AF906E5070D50CB6F492E1996B45DBDBA9B91A240D3EE55D54A372D20FC478637EA1844
310
E23528656BCB61A335A61283CCAA8DD257034C102F5AF41EF9F573B35CBBA2E979E4A26BD24F415073B524E171752D50FA6995EE975F1D4C02C6FA8B51A4658C585ECEC9E214602E558203454085E6591009A82E7E7FFACA19AEA299B14A0081A705CB3296EBC5BDBECA1A9B675C4CA3279405AA6E1F623C72DDA76AE8D7F7
310
906D4004B549245EB0D1249CB260803500F2A89BEA10382A0603F2F5D2D00D630AA615688F66D2FA166E2079D4C551A54AB758163F9DFB9D8A1460E098D8FDBF01504B0304140006080000AC70623B000000000000000000000000350000006662782F30364446464539412D343132462D344431342D413442312D46303645
310
34343133343431372F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B0000
310
00000000000000000000370000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30364446464539412D343132462D344431342D413442312D
310
4630364534343133343431372F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607FB14
310
4396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BB40F7AF9FE000000A00100003B0000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F75726365732F636F72
310
652E786D6C8D504B6E833010BD0A9A6D65B00950828CA3109513F4029699502BC146FE543D7E4D42A576D7CDCCE87D344F8F9FBE967BF689CE6B6B7A6039850C8DB29336730F315C490BD94970676DF82583CCC8057BD860107C7636AE3BA4AC096842428D9D7007A5F7182053F774F4E0D5072E3297312485BFE5AB543739
310
63CEF244279DE03EB814207B3ED9260887DE46A7D0F3E2C90A1EA39E768D9ED24F7DD5E8408C63736E86CB1B192F0746AAF29591A1295B72A4675A57B4ADC766E0C566163CE8E527A37228034E204A4A8F843142CB775675B4EECAFA85B61DA5BCD8E47F4C719DFE698ADA8443B9C77DDA3C0896823C08C18BADAFB41E65A6
310
BD752BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B436F
310
6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BDCE527C8EB0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000094020000636E782E786D6C504B0102
310
1400140006080800AC70623BB24894EB71010000D40300000C00000000000000000000000000180300006662782F636F72652E786D6C504B01021400140006080800AC70623B3A54DFB77D0000009D0000000B00000000000000000000000000B30400006662782F636E782E786D6C504B01021400140006080800AC70623B
310
4A17098729010000120200003100000000000000000000000000590500006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D10600006662
310
782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6C504B01021400140006080800AC70623BD8F6D0D5660500003B10000034000000000000000000000000006D0800006662782F30364446464539412D343132462D344431342D413442312D46303645343431
310
33343431372F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000250E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F76657274696365732E62696E504B010214001400060808
310
00AC70623BF270F13306000000040000003600000000000000000000000000780E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E504B01021400140006080000AC70623B00000000000000000000000037000000000000000000
310
00000000D20E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000270F00006662782F30364446464539412D343132462D
310
344431342D413442312D4630364534343133343431372F6469726563746F72792E786D6C504B01021400140006080800AC70623BB40F7AF9FE000000A00100003B000000000000000000000000000B1000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F
310
75726365732F636F72652E786D6C504B0506000000000E000E0080040000621100000000
  0
XRECORD
  5
10E
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10F
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
2FD
102
{ACAD_REACTORS
330
2FC
102
}
330
2FC
100
AcDbXrecord
280
     1
102
DISPLAYNAME
  1
Imperial24
102
FLAGS
 90
        0
  0
CELLSTYLEMAP
  5
2BE
102
{ACAD_REACTORS
330
FF
102
}
330
FF
100
AcDbCellStyleMap
 90
        3
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
    32768
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.25
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        1
 91
        1
300
_TITLE
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        2
 91
        1
300
_HEADER
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        2
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        3
 91
        2
300
_DATA
309
CELLSTYLE_END
  0
XRECORD
  5
2EB
102
{ACAD_REACTORS
330
FF
102
}
330
FF
100
AcDbXrecord
280
     1
102
ACAD_ROUNDTRIP_PRE2007_TABLESTYLE
 90
      512
 91
        0
  1

 92
      512
 93
        0
  2

 94
      512
 95
        0
  3

  0
XRECORD
  5
2D6
102
{ACAD_REACTORS
330
2D5
102
}
330
2D5
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     1
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     0
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2D4
102
{ACAD_REACTORS
330
2D3
102
}
330
2D3
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2E2
102
{ACAD_REACTORS
330
2E1
102
}
330
2E1
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2EA
102
{ACAD_REACTORS
330
2E9
102
}
330
2E9
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2DC
102
{ACAD_REACTORS
330
2DB
102
}
330
2DB
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2E0
102
{ACAD_REACTORS
330
2DF
102
}
330
2DF
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2F1
102
{ACAD_REACTORS
330
2F0
102
}
330
2F0
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     0
102
RTVSPropertyOp1
 70
     0
102
RTVSPropertyOp2
 70
     0
102
RTVSPropertyOp3
 70
     0
102
RTVSPropertyOp4
 70
     0
102
RTVSPropertyOp5
 70
     0
102
RTVSPropertyOp6
 70
     0
102
RTVSPropertyOp7
 70
     0
102
RTVSPropertyOp8
 70
     0
102
RTVSPropertyOp9
 70
     0
102
RTVSPropertyOp10
 70
     0
102
RTVSPropertyOp11
 70
     0
102
RTVSPropertyOp12
 70
     0
102
RTVSPropertyOp13
 70
     0
102
RTVSPropertyOp14
 70
     2
102
RTVSPropertyOp15
 70
     0
102
RTVSPropertyOp16
 70
     0
102
RTVSPropertyOp17
 70
     0
102
RTVSPropertyOp18
 70
     0
102
RTVSPropertyOp19
 70
     0
102
RTVSPropertyOp20
 70
     0
102
RTVSPropertyOp21
 70
     0
102
RTVSPropertyOp22
 70
     0
102
RTVSPropertyOp23
 70
     0
102
RTVSPropertyOp24
 70
     0
102
RTVSPropertyOp25
 70
     0
102
RTVSPropertyOp26
 70
     0
102
RTVSPropertyOp27
 70
     0
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2E8
102
{ACAD_REACTORS
330
2E7
102
}
330
2E7
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2CC
102
{ACAD_REACTORS
330
2CB
102
}
330
2CB
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2CE
102
{ACAD_REACTORS
330
2CD
102
}
330
2CD
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2D0
102
{ACAD_REACTORS
330
2CF
102
}
330
2CF
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2D2
102
{ACAD_REACTORS
330
2D1
102
}
330
2D1
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2DA
102
{ACAD_REACTORS
330
2D9
102
}
330
2D9
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2ED
102
{ACAD_REACTORS
330
2EC
102
}
330
2EC
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     0
102
RTVSPropertyOp1
 70
     0
102
RTVSPropertyOp2
 70
     0
102
RTVSPropertyOp3
 70
     0
102
RTVSPropertyOp4
 70
     0
102
RTVSPropertyOp5
 70
     0
102
RTVSPropertyOp6
 70
     0
102
RTVSPropertyOp7
 70
     0
102
RTVSPropertyOp8
 70
     0
102
RTVSPropertyOp9
 70
     0
102
RTVSPropertyOp10
 70
     0
102
RTVSPropertyOp11
 70
     0
102
RTVSPropertyOp12
 70
     0
102
RTVSPropertyOp13
 70
     0
102
RTVSPropertyOp14
 70
     2
102
RTVSPropertyOp15
 70
     0
102
RTVSPropertyOp16
 70
     0
102
RTVSPropertyOp17
 70
     0
102
RTVSPropertyOp18
 70
     0
102
RTVSPropertyOp19
 70
     0
102
RTVSPropertyOp20
 70
     0
102
RTVSPropertyOp21
 70
     0
102
RTVSPropertyOp22
 70
     0
102
RTVSPropertyOp23
 70
     0
102
RTVSPropertyOp24
 70
     0
102
RTVSPropertyOp25
 70
     0
102
RTVSPropertyOp26
 70
     0
102
RTVSPropertyOp27
 70
     0
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2E6
102
{ACAD_REACTORS
330
2E5
102
}
330
2E5
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2EF
102
{ACAD_REACTORS
330
2EE
102
}
330
2EE
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     0
102
RTVSPropertyOp1
 70
     0
102
RTVSPropertyOp2
 70
     0
102
RTVSPropertyOp3
 70
     0
102
RTVSPropertyOp4
 70
     0
102
RTVSPropertyOp5
 70
     0
102
RTVSPropertyOp6
 70
     0
102
RTVSPropertyOp7
 70
     0
102
RTVSPropertyOp8
 70
     0
102
RTVSPropertyOp9
 70
     0
102
RTVSPropertyOp10
 70
     0
102
RTVSPropertyOp11
 70
     0
102
RTVSPropertyOp12
 70
     0
102
RTVSPropertyOp13
 70
     0
102
RTVSPropertyOp14
 70
     2
102
RTVSPropertyOp15
 70
     0
102
RTVSPropertyOp16
 70
     0
102
RTVSPropertyOp17
 70
     0
102
RTVSPropertyOp18
 70
     0
102
RTVSPropertyOp19
 70
     0
102
RTVSPropertyOp20
 70
     0
102
RTVSPropertyOp21
 70
     0
102
RTVSPropertyOp22
 70
     0
102
RTVSPropertyOp23
 70
     0
102
RTVSPropertyOp24
 70
     0
102
RTVSPropertyOp25
 70
     0
102
RTVSPropertyOp26
 70
     0
102
RTVSPropertyOp27
 70
     0
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2DE
102
{ACAD_REACTORS
330
2DD
102
}
330
2DD
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2FB
102
{ACAD_REACTORS
330
2FA
102
}
330
2FA
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2F9
102
{ACAD_REACTORS
330
2F8
102
}
330
2F8
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2F3
102
{ACAD_REACTORS
330
2F2
102
}
330
2F2
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2F5
102
{ACAD_REACTORS
330
2F4
102
}
330
2F4
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2E4
102
{ACAD_REACTORS
330
2E3
102
}
330
2E3
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2D8
102
{ACAD_REACTORS
330
2D7
102
}
330
2D7
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
2F7
102
{ACAD_REACTORS
330
2F6
102
}
330
2F6
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
ENDSEC
  0
EOF
`;var zOe=`  0
SECTION
  2
HEADER
  9
$ACADVER
  1
AC1021
  9
$ACADMAINTVER
 70
    50
  9
$DWGCODEPAGE
  3
ANSI_936
  9
$LASTSAVEDBY
  1
win10
  9
$INSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$EXTMIN
 10
1.000000000000000E+20
 20
1.000000000000000E+20
 30
1.000000000000000E+20
  9
$EXTMAX
 10
-1.000000000000000E+20
 20
-1.000000000000000E+20
 30
-1.000000000000000E+20
  9
$LIMMIN
 10
0.0
 20
0.0
  9
$LIMMAX
 10
12.0
 20
9.0
  9
$ORTHOMODE
 70
     0
  9
$REGENMODE
 70
     1
  9
$FILLMODE
 70
     1
  9
$QTEXTMODE
 70
     0
  9
$MIRRTEXT
 70
     0
  9
$LTSCALE
 40
1.0
  9
$ATTMODE
 70
     1
  9
$TEXTSIZE
 40
0.2
  9
$TRACEWID
 40
0.05
  9
$TEXTSTYLE
  7
Standard
  9
$CLAYER
  8
0
  9
$CELTYPE
  6
ByLayer
  9
$CECOLOR
 62
   256
  9
$CELTSCALE
 40
1.0
  9
$DISPSILH
 70
     0
  9
$DIMSCALE
 40
1.0
  9
$DIMASZ
 40
0.18
  9
$DIMEXO
 40
0.0625
  9
$DIMDLI
 40
0.38
  9
$DIMRND
 40
0.0
  9
$DIMDLE
 40
0.0
  9
$DIMEXE
 40
0.18
  9
$DIMTP
 40
0.0
  9
$DIMTM
 40
0.0
  9
$DIMTXT
 40
0.18
  9
$DIMCEN
 40
0.09
  9
$DIMTSZ
 40
0.0
  9
$DIMTOL
 70
     0
  9
$DIMLIM
 70
     0
  9
$DIMTIH
 70
     1
  9
$DIMTOH
 70
     1
  9
$DIMSE1
 70
     0
  9
$DIMSE2
 70
     0
  9
$DIMTAD
 70
     0
  9
$DIMZIN
 70
     0
  9
$DIMBLK
  1

  9
$DIMASO
 70
     1
  9
$DIMSHO
 70
     1
  9
$DIMPOST
  1

  9
$DIMAPOST
  1

  9
$DIMALT
 70
     0
  9
$DIMALTD
 70
     2
  9
$DIMALTF
 40
25.4
  9
$DIMLFAC
 40
1.0
  9
$DIMTOFL
 70
     0
  9
$DIMTVP
 40
0.0
  9
$DIMTIX
 70
     0
  9
$DIMSOXD
 70
     0
  9
$DIMSAH
 70
     0
  9
$DIMBLK1
  1

  9
$DIMBLK2
  1

  9
$DIMSTYLE
  2
Standard
  9
$DIMCLRD
 70
     0
  9
$DIMCLRE
 70
     0
  9
$DIMCLRT
 70
     0
  9
$DIMTFAC
 40
1.0
  9
$DIMGAP
 40
0.09
  9
$DIMJUST
 70
     0
  9
$DIMSD1
 70
     0
  9
$DIMSD2
 70
     0
  9
$DIMTOLJ
 70
     1
  9
$DIMTZIN
 70
     0
  9
$DIMALTZ
 70
     0
  9
$DIMALTTZ
 70
     0
  9
$DIMUPT
 70
     0
  9
$DIMDEC
 70
     4
  9
$DIMTDEC
 70
     4
  9
$DIMALTU
 70
     2
  9
$DIMALTTD
 70
     2
  9
$DIMTXSTY
  7
Standard
  9
$DIMAUNIT
 70
     0
  9
$DIMADEC
 70
     0
  9
$DIMALTRND
 40
0.0
  9
$DIMAZIN
 70
     0
  9
$DIMDSEP
 70
    46
  9
$DIMATFIT
 70
     3
  9
$DIMFRAC
 70
     0
  9
$DIMLDRBLK
  1

  9
$DIMLUNIT
 70
     2
  9
$DIMLWD
 70
    -2
  9
$DIMLWE
 70
    -2
  9
$DIMTMOVE
 70
     0
  9
$DIMFXL
 40
1.0
  9
$DIMFXLON
 70
     0
  9
$DIMJOGANG
 40
0.7853981633974483
  9
$DIMTFILL
 70
     0
  9
$DIMTFILLCLR
 70
     0
  9
$DIMARCSYM
 70
     0
  9
$DIMLTYPE
  6

  9
$DIMLTEX1
  6

  9
$DIMLTEX2
  6

  9
$LUNITS
 70
     2
  9
$LUPREC
 70
     4
  9
$SKETCHINC
 40
0.1
  9
$FILLETRAD
 40
0.0
  9
$AUNITS
 70
     0
  9
$AUPREC
 70
     0
  9
$MENU
  1
.
  9
$ELEVATION
 40
0.0
  9
$PELEVATION
 40
0.0
  9
$THICKNESS
 40
0.0
  9
$LIMCHECK
 70
     0
  9
$CHAMFERA
 40
0.0
  9
$CHAMFERB
 40
0.0
  9
$CHAMFERC
 40
0.0
  9
$CHAMFERD
 40
0.0
  9
$SKPOLY
 70
     0
  9
$TDCREATE
 40
2460560.605914352
  9
$TDUCREATE
 40
2460560.272581019
  9
$TDUPDATE
 40
2460560.629363426
  9
$TDUUPDATE
 40
2460560.296030092
  9
$TDINDWG
 40
0.0234490741
  9
$TDUSRTIMER
 40
0.0234490741
  9
$USRTIMER
 70
     1
  9
$ANGBASE
 50
0.0
  9
$ANGDIR
 70
     0
  9
$PDMODE
 70
     0
  9
$PDSIZE
 40
0.0
  9
$PLINEWID
 40
0.0
  9
$SPLFRAME
 70
     0
  9
$SPLINETYPE
 70
     6
  9
$SPLINESEGS
 70
     8
  9
$HANDSEED
  5
33E
  9
$SURFTAB1
 70
     6
  9
$SURFTAB2
 70
     6
  9
$SURFTYPE
 70
     6
  9
$SURFU
 70
     6
  9
$SURFV
 70
     6
  9
$UCSBASE
  2

  9
$UCSNAME
  2

  9
$UCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$UCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$UCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$UCSORTHOREF
  2

  9
$UCSORTHOVIEW
 70
     0
  9
$UCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSBASE
  2

  9
$PUCSNAME
  2

  9
$PUCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$PUCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$PUCSORTHOREF
  2

  9
$PUCSORTHOVIEW
 70
     0
  9
$PUCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$USERI1
 70
     0
  9
$USERI2
 70
     0
  9
$USERI3
 70
     0
  9
$USERI4
 70
     0
  9
$USERI5
 70
     0
  9
$USERR1
 40
0.0
  9
$USERR2
 40
0.0
  9
$USERR3
 40
0.0
  9
$USERR4
 40
0.0
  9
$USERR5
 40
0.0
  9
$WORLDVIEW
 70
     1
  9
$SHADEDGE
 70
     3
  9
$SHADEDIF
 70
    70
  9
$TILEMODE
 70
     1
  9
$MAXACTVP
 70
    64
  9
$PINSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMCHECK
 70
     0
  9
$PEXTMIN
 10
0.0
 20
0.0
 30
0.0
  9
$PEXTMAX
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMMIN
 10
0.0
 20
0.0
  9
$PLIMMAX
 10
12.0
 20
9.0
  9
$UNITMODE
 70
     0
  9
$VISRETAIN
 70
     1
  9
$PLINEGEN
 70
     0
  9
$PSLTSCALE
 70
     1
  9
$TREEDEPTH
 70
  3020
  9
$CMLSTYLE
  2
Standard
  9
$CMLJUST
 70
     0
  9
$CMLSCALE
 40
1.0
  9
$PROXYGRAPHICS
 70
     1
  9
$MEASUREMENT
 70
     0
  9
$CELWEIGHT
370
    -1
  9
$ENDCAPS
280
     0
  9
$JOINSTYLE
280
     0
  9
$LWDISPLAY
290
     0
  9
$INSUNITS
 70
     4
  9
$HYPERLINKBASE
  1

  9
$STYLESHEET
  1

  9
$XEDIT
290
     1
  9
$CEPSNTYPE
380
     0
  9
$PSTYLEMODE
290
     0
  9
$FINGERPRINTGUID
  2
{FA9A02B2-7E04-C34E-BD13-02980AC2B394}
  9
$VERSIONGUID
  2
{964EB223-33A2-D549-8684-CDE005EE773C}
  9
$EXTNAMES
290
     1
  9
$PSVPSCALE
 40
0.0
  9
$OLESTARTUP
290
     0
  9
$SORTENTS
280
   127
  9
$INDEXCTL
280
     0
  9
$HIDETEXT
280
     1
  9
$XCLIPFRAME
290
     0
  9
$HALOGAP
280
     0
  9
$OBSCOLOR
 70
   257
  9
$OBSLTYPE
280
     0
  9
$INTERSECTIONDISPLAY
280
     0
  9
$INTERSECTIONCOLOR
 70
   257
  9
$DIMASSOC
280
     2
  9
$PROJECTNAME
  1

  9
$CAMERADISPLAY
290
     0
  9
$LENSLENGTH
 40
50.0
  9
$CAMERAHEIGHT
 40
60.0
  9
$STEPSPERSEC
 40
2.0
  9
$STEPSIZE
 40
6.0
  9
$3DDWFPREC
 40
2.0
  9
$PSOLWIDTH
 40
0.25
  9
$PSOLHEIGHT
 40
4.0
  9
$LOFTANG1
 40
1.570796326794896
  9
$LOFTANG2
 40
1.570796326794896
  9
$LOFTMAG1
 40
0.0
  9
$LOFTMAG2
 40
0.0
  9
$LOFTPARAM
 70
     7
  9
$LOFTNORMALS
280
     1
  9
$LATITUDE
 40
37.795
  9
$LONGITUDE
 40
-122.394
  9
$NORTHDIRECTION
 40
0.0
  9
$TIMEZONE
 70
 -8000
  9
$LIGHTGLYPHDISPLAY
280
     1
  9
$TILEMODELIGHTSYNCH
280
     1
  9
$CMATERIAL
347
92
  9
$SOLIDHIST
280
     0
  9
$SHOWHIST
280
     1
  9
$DWFFRAME
280
     2
  9
$DGNFRAME
280
     0
  9
$REALWORLDSCALE
290
     1
  9
$INTERFERECOLOR
 62
     1
  9
$INTERFEREOBJVS
345
9F
  9
$INTERFEREVPVS
346
9C
  9
$CSHADOW
280
     0
  9
$SHADOWPLANELOCATION
 40
0.0
  0
ENDSEC
  0
SECTION
  2
CLASSES
  0
CLASS
  1
ACDBDICTIONARYWDFLT
  2
AcDbDictionaryWithDefault
  3
ObjectDBX Classes
 90
        0
 91
        1
280
     0
281
     0
  0
CLASS
  1
DICTIONARYVAR
  2
AcDbDictionaryVar
  3
ObjectDBX Classes
 90
        0
 91
       15
280
     0
281
     0
  0
CLASS
  1
MATERIAL
  2
AcDbMaterial
  3
ObjectDBX Classes
 90
     1153
 91
        3
280
     0
281
     0
  0
CLASS
  1
VISUALSTYLE
  2
AcDbVisualStyle
  3
ObjectDBX Classes
 90
     4095
 91
       24
280
     0
281
     0
  0
CLASS
  1
TABLESTYLE
  2
AcDbTableStyle
  3
ObjectDBX Classes
 90
     4095
 91
        1
280
     0
281
     0
  0
CLASS
  1
SCALE
  2
AcDbScale
  3
ObjectDBX Classes
 90
     1153
 91
       33
280
     0
281
     0
  0
CLASS
  1
MLEADERSTYLE
  2
AcDbMLeaderStyle
  3
ACDB_MLEADERSTYLE_CLASS
 90
     4095
 91
        2
280
     0
281
     0
  0
CLASS
  1
CELLSTYLEMAP
  2
AcDbCellStyleMap
  3
ObjectDBX Classes
 90
     1152
 91
        4
280
     0
281
     0
  0
CLASS
  1
EXACXREFPANELOBJECT
  2
ExAcXREFPanelObject
  3
EXAC_ESW
 90
     1025
 91
        0
280
     0
281
     0
  0
CLASS
  1
NPOCOLLECTION
  2
AcDbImpNonPersistentObjectsCollection
  3
ObjectDBX Classes
 90
     1153
 91
        0
280
     0
281
     0
  0
CLASS
  1
LAYER_INDEX
  2
AcDbLayerIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
SPATIAL_INDEX
  2
AcDbSpatialIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
IDBUFFER
  2
AcDbIdBuffer
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
ACDBSECTIONVIEWSTYLE
  2
AcDbSectionViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
CLASS
  1
ACDBDETAILVIEWSTYLE
  2
AcDbDetailViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
ENDSEC
  0
SECTION
  2
TABLES
  0
TABLE
  2
VPORT
  5
8
330
0
100
AcDbSymbolTable
 70
     1
  0
VPORT
  5
90
330
8
100
AcDbSymbolTableRecord
100
AcDbViewportTableRecord
  2
*Active
 70
     0
 10
0.0
 20
0.0
 11
1.0
 21
1.0
 12
97.5486911906951
 22
42.51345460271504
 13
0.0
 23
0.0
 14
0.5
 24
0.5
 15
0.5
 25
0.5
 16
0.0
 26
0.0
 36
1.0
 17
0.0
 27
0.0
 37
0.0
 40
78.45799938217576
 41
1.945409429280396
 42
50.0
 43
0.0
 44
0.0
 50
0.0
 51
0.0
 71
     0
 72
  1000
 73
     1
 74
     3
 75
     0
 76
     1
 77
     0
 78
     0
281
     0
 65
     1
110
0.0
120
0.0
130
0.0
111
1.0
121
0.0
131
0.0
112
0.0
122
1.0
132
0.0
 79
     0
146
0.0
348
9B
 60
     3
 61
     5
292
     1
282
     1
141
0.0
142
0.0
 63
   250
421
  3355443
1001
ACAD_NAV_VCDISPLAY
1070
     3
  0
ENDTAB
  0
TABLE
  2
LTYPE
  5
5
330
0
100
AcDbSymbolTable
 70
     1
  0
LTYPE
  5
14
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByBlock
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
15
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByLayer
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
16
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
Continuous
 70
     0
  3
Solid line
 72
    65
 73
     0
 40
0.0
  0
ENDTAB
  0
TABLE
  2
LAYER
  5
2
102
{ACAD_XDICTIONARY
360
18B
102
}
330
0
100
AcDbSymbolTable
 70
     1
  0
LAYER
  5
10
102
{ACAD_XDICTIONARY
360
E1
102
}
330
2
100
AcDbSymbolTableRecord
100
AcDbLayerTableRecord
  2
0
 70
     0
 62
     7
  6
Continuous
370
    -3
390
F
347
94
  0
ENDTAB
  0
TABLE
  2
STYLE
  5
3
330
0
100
AcDbSymbolTable
 70
     2
  0
STYLE
  5
11
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Standard
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
ACAD
1000
Arial
1071
       34
  0
STYLE
  5
D7
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD
1000
Arial
1071
       34
  0
ENDTAB
  0
TABLE
  2
VIEW
  5
6
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
UCS
  5
7
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
APPID
  5
9
330
0
100
AcDbSymbolTable
 70
     7
  0
APPID
  5
12
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD
 70
     0
  0
APPID
  5
D8
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnoPO
 70
     0
  0
APPID
  5
D9
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnotative
 70
     0
  0
APPID
  5
DA
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMJAG
 70
     0
  0
APPID
  5
DB
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMTALN
 70
     0
  0
APPID
  5
102
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_MLEADERVER
 70
     0
  0
APPID
  5
1A3
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_NAV_VCDISPLAY
 70
     0
  0
ENDTAB
  0
TABLE
  2
DIMSTYLE
  5
A
330
0
100
AcDbSymbolTable
 70
     2
100
AcDbDimStyleTable
 71
     2
340
DC
340
27
  0
DIMSTYLE
105
27
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Standard
 70
     0
340
11
  0
DIMSTYLE
105
DC
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
340
11
1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD_DSTYLE_DIMJAG
1070
   388
1040
1.5
1001
ACAD_DSTYLE_DIMTALN
1070
   392
1070
     0
  0
ENDTAB
  0
TABLE
  2
BLOCK_RECORD
  5
1
330
0
100
AcDbSymbolTable
 70
     1
  0
BLOCK_RECORD
  5
1F
102
{ACAD_XDICTIONARY
360
15A
102
}
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Model_Space
340
22
 70
     0
280
     1
281
     0
  0
BLOCK_RECORD
  5
73
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space
340
74
 70
     0
280
     1
281
     0
  0
BLOCK_RECORD
  5
78
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space0
340
79
 70
     0
280
     1
281
     0
  0
ENDTAB
  0
ENDSEC
  0
SECTION
  2
BLOCKS
  0
BLOCK
  5
20
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockBegin
  2
*Model_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Model_Space
  1

  0
ENDBLK
  5
21
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
75
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space
  1

  0
ENDBLK
  5
76
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
7A
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space0
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space0
  1

  0
ENDBLK
  5
7B
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
ENDSEC
  0
SECTION
  2
ENTITIES
  0
ENDSEC
  0
SECTION
  2
OBJECTS
  0
DICTIONARY
  5
C
330
0
100
AcDbDictionary
281
     1
  3
ACAD_CIP_PREVIOUS_PRODUCT_INFO
350
1A2
  3
ACAD_COLOR
350
6C
  3
ACAD_DETAILVIEWSTYLE
350
1A8
  3
ACAD_GROUP
350
D
  3
ACAD_LAYOUT
350
1A
  3
ACAD_MATERIAL
350
6B
  3
ACAD_MLEADERSTYLE
350
D2
  3
ACAD_MLINESTYLE
350
17
  3
ACAD_PLOTSETTINGS
350
19
  3
ACAD_PLOTSTYLENAME
350
E
  3
ACAD_SCALELIST
350
B1
  3
ACAD_SECTIONVIEWSTYLE
350
1A5
  3
ACAD_TABLESTYLE
350
A6
  3
ACAD_VISUALSTYLE
350
95
  3
ACDB_RECOMPOSE_DATA
350
301
  3
AcDbVariableDictionary
350
59
  3
AcDsDecomposeData
350
307
  0
DICTIONARY
  5
18B
330
2
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_LAYERSTATES
360
18C
  0
DICTIONARY
  5
E1
330
10
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
15A
330
1F
100
AcDbDictionary
280
     1
281
     1
  0
XRECORD
  5
1A2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
300
ACD
300
2021
300

  0
DICTIONARY
  5
6C
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A8
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A9
  0
DICTIONARY
  5
D
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Model
350
22
  3
\u5E03\u5C401
350
74
  3
\u5E03\u5C402
350
79
  0
DICTIONARY
  5
6B
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
ByBlock
350
93
  3
ByLayer
350
92
  3
Global
350
94
  0
DICTIONARY
  5
D2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Annotative
350
E0
  3
Standard
350
D3
  0
DICTIONARY
  5
17
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
18
  0
DICTIONARY
  5
19
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
ACDBDICTIONARYWDFLT
  5
E
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Normal
350
F
100
AcDbDictionaryWithDefault
340
F
  0
DICTIONARY
  5
B1
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
A0
350
B2
  3
A1
350
124
  3
A2
350
125
  3
A3
350
126
  3
A4
350
127
  3
A5
350
128
  3
A6
350
129
  3
A7
350
12A
  3
A8
350
12B
  3
A9
350
12C
  3
B0
350
12D
  3
B1
350
12E
  3
B2
350
12F
  3
B3
350
130
  3
B4
350
131
  3
B5
350
132
  3
B6
350
133
  3
B7
350
134
  3
B8
350
135
  3
B9
350
136
  3
C0
350
137
  3
C1
350
138
  3
C2
350
139
  3
C3
350
13A
  3
C4
350
13B
  3
C5
350
13C
  3
C6
350
13D
  3
C7
350
13E
  3
C8
350
13F
  3
C9
350
140
  3
D0
350
141
  3
D1
350
142
  3
D2
350
143
  0
DICTIONARY
  5
1A5
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A7
  0
DICTIONARY
  5
A6
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
A7
  0
DICTIONARY
  5
95
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
2dWireframe
350
9B
  3
Basic
350
9A
  3
Brighten
350
A1
  3
ColorChange
350
A5
  3
Conceptual
350
9E
  3
Dim
350
A0
  3
EdgeColorOff
350
172
  3
Facepattern
350
A4
  3
Flat
350
96
  3
FlatWithEdges
350
97
  3
Gouraud
350
98
  3
GouraudWithEdges
350
99
  3
Hidden
350
9D
  3
JitterOff
350
170
  3
Linepattern
350
A3
  3
OverhangOff
350
171
  3
Realistic
350
9F
  3
Shaded
350
17F
  3
Shaded with edges
350
17E
  3
Shades of Gray
350
17B
  3
Sketchy
350
17C
  3
Thicken
350
A2
  3
Wireframe
350
9C
  3
X-Ray
350
17D
  0
XRECORD
  5
301
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
 90
        1
330
A7
  0
DICTIONARY
  5
59
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
CAMERAHEIGHT
350
227
  3
CANNOSCALE
350
EB
  3
CMLEADERSTYLE
350
EA
  3
CTABLESTYLE
350
AB
  3
CVIEWDETAILSTYLE
350
1B4
  3
CVIEWSECTIONSTYLE
350
1B5
  3
DIMASSOC
350
5A
  3
HIDETEXT
350
5E
  3
INDEXCTL
350
226
  3
LAYEREVAL
350
14A
  3
LAYERNOTIFY
350
14B
  3
LIGHTINGUNITS
350
224
  3
MSLTSCALE
350
223
  3
SORTENTS
350
225
  3
XCLIPFRAME
350
228
  0
DICTIONARY
  5
307
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
AcDsRecords
350
309
  3
AcDsSchemas
350
308
1001
ACAD
1070
     2
  0
DICTIONARY
  5
18C
102
{ACAD_REACTORS
330
18B
102
}
330
18B
100
AcDbDictionary
281
     1
  0
ACDBDETAILVIEWSTYLE
  5
1A9
102
{ACAD_XDICTIONARY
360
33C
102
}
102
{ACAD_REACTORS
330
1A8
102
}
330
1A8
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
100
AcDbDetailViewStyle
 70
     0
 71
     0
 90
        3
 71
     1
340
11
 62
   256
 40
0.24
340
0
 62
   256
 40
0.24
300

 40
0.36
280
     3
 71
     2
340
16
 90
       25
 62
   256
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewDetailId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
340
16
 90
       25
 62
   256
340
16
 90
       25
 62
   256
280
     0
  0
LAYOUT
  5
22
102
{ACAD_XDICTIONARY
360
191
102
}
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
none_device
  4
Letter_(8.50_x_11.00_Inches)
  6

 40
6.349999904632568
 41
6.349999904632568
 42
6.350006103515625
 43
6.350006103515625
 44
215.8999938964844
 45
279.3999938964844
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
3.560208697428376
 70
 11952
 72
     0
 73
     1
 74
     0
  7

 75
     0
147
0.28088241027059
 76
     0
 77
     2
 78
   300
148
0.1311165230791651
149
0.096403374003771
100
AcDbLayout
  1
Model
 70
     1
 71
     0
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
1F
331
90
  0
LAYOUT
  5
74
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\u5E03\u5C401
 70
     1
 71
     1
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
73
  0
LAYOUT
  5
79
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\u5E03\u5C402
 70
     1
 71
     2
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
78
  0
MATERIAL
  5
93
102
{ACAD_XDICTIONARY
360
185
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByBlock
 94
       63
  0
MATERIAL
  5
92
102
{ACAD_XDICTIONARY
360
183
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByLayer
 94
       63
  0
MATERIAL
  5
94
102
{ACAD_XDICTIONARY
360
10B
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
Global
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
 94
       63
1001
ACAD
1070
    -1
1070
     3
1070
     0
1000

1071
        0
1070
     0
  0
MLEADERSTYLE
  5
E0
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     1
143
0.125
1001
ACAD_MLEADERVER
1070
     2
  0
MLEADERSTYLE
  5
D3
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     0
143
0.125
1001
ACAD_MLEADERVER
1070
     2
  0
MLINESTYLE
  5
18
102
{ACAD_REACTORS
330
17
102
}
330
17
100
AcDbMlineStyle
  2
STANDARD
 70
     0
  3

 62
   256
 51
90.0
 52
90.0
 71
     2
 49
0.5
 62
   256
  6
BYLAYER
 49
-0.5
 62
   256
  6
BYLAYER
  0
ACDBPLACEHOLDER
  5
F
102
{ACAD_REACTORS
330
E
102
}
330
E
  0
SCALE
  5
B2
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:1
140
1.0
141
1.0
290
     1
  0
SCALE
  5
124
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:2
140
1.0
141
2.0
290
     0
  0
SCALE
  5
125
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:4
140
1.0
141
4.0
290
     0
  0
SCALE
  5
126
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:5
140
1.0
141
5.0
290
     0
  0
SCALE
  5
127
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:8
140
1.0
141
8.0
290
     0
  0
SCALE
  5
128
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:10
140
1.0
141
10.0
290
     0
  0
SCALE
  5
129
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:16
140
1.0
141
16.0
290
     0
  0
SCALE
  5
12A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:20
140
1.0
141
20.0
290
     0
  0
SCALE
  5
12B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:30
140
1.0
141
30.0
290
     0
  0
SCALE
  5
12C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:40
140
1.0
141
40.0
290
     0
  0
SCALE
  5
12D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:50
140
1.0
141
50.0
290
     0
  0
SCALE
  5
12E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:100
140
1.0
141
100.0
290
     0
  0
SCALE
  5
12F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
2:1
140
2.0
141
1.0
290
     0
  0
SCALE
  5
130
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
4:1
140
4.0
141
1.0
290
     0
  0
SCALE
  5
131
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
8:1
140
8.0
141
1.0
290
     0
  0
SCALE
  5
132
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
10:1
140
10.0
141
1.0
290
     0
  0
SCALE
  5
133
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
100:1
140
100.0
141
1.0
290
     0
  0
SCALE
  5
134
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/128" = 1'-0"
140
0.0078125
141
12.0
290
     0
  0
SCALE
  5
135
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/64" = 1'-0"
140
0.015625
141
12.0
290
     0
  0
SCALE
  5
136
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/32" = 1'-0"
140
0.03125
141
12.0
290
     0
  0
SCALE
  5
137
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/16" = 1'-0"
140
0.0625
141
12.0
290
     0
  0
SCALE
  5
138
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/32" = 1'-0"
140
0.09375
141
12.0
290
     0
  0
SCALE
  5
139
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/8" = 1'-0"
140
0.125
141
12.0
290
     0
  0
SCALE
  5
13A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/16" = 1'-0"
140
0.1875
141
12.0
290
     0
  0
SCALE
  5
13B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/4" = 1'-0"
140
0.25
141
12.0
290
     0
  0
SCALE
  5
13C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/8" = 1'-0"
140
0.375
141
12.0
290
     0
  0
SCALE
  5
13D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/2" = 1'-0"
140
0.5
141
12.0
290
     0
  0
SCALE
  5
13E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/4" = 1'-0"
140
0.75
141
12.0
290
     0
  0
SCALE
  5
13F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1" = 1'-0"
140
1.0
141
12.0
290
     0
  0
SCALE
  5
140
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1-1/2" = 1'-0"
140
1.5
141
12.0
290
     0
  0
SCALE
  5
141
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3" = 1'-0"
140
3.0
141
12.0
290
     0
  0
SCALE
  5
142
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
6" = 1'-0"
140
6.0
141
12.0
290
     0
  0
SCALE
  5
143
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1'-0" = 1'-0"
140
12.0
141
12.0
290
     0
  0
ACDBSECTIONVIEWSTYLE
  5
1A7
102
{ACAD_XDICTIONARY
360
33A
102
}
102
{ACAD_REACTORS
330
1A5
102
}
330
1A5
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
100
AcDbSectionViewStyle
 70
     0
 71
     0
 90
       78
 71
     1
340
11
 62
   256
 40
0.24
340
0
340
0
 62
   256
 40
0.24
300
I, O, Q, S, X, Z
 40
0.48
 90
        3
 40
0.18
 90
        1
 71
     2
340
16
 90
       25
 62
   256
340
16
 90
       50
 62
   256
 40
0.24
 40
0.0
 40
0.24
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewSectionStartId>%-%<\\AcVar ViewSectionEndId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
 62
   256
 62
   257
300
ANSI31
 40
1.0
 90
        0
290
     0
290
     0
 90
        6
 40
0.0
 40
1.570796326794896
 40
0.2617993877991494
 40
1.308996938995747
 40
-0.2617993877991494
 40
1.832595714594046
  0
TABLESTYLE
  5
A7
102
{ACAD_XDICTIONARY
360
FF
102
}
102
{ACAD_REACTORS
330
A6
102
}
330
A6
100
AcDbTableStyle
  3
Standard
 70
     0
 71
     0
 40
0.06
 41
0.06
280
     0
281
     0
  7
Standard
140
0.18
170
     2
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.25
170
     5
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.18
170
     5
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  0
VISUALSTYLE
  5
9B
102
{ACAD_XDICTIONARY
360
314
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
2dWireframe
 70
     4
 71
     0
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9A
102
{ACAD_XDICTIONARY
360
312
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Basic
 70
     7
 71
     1
 72
     0
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A1
102
{ACAD_XDICTIONARY
360
320
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Brighten
 70
    12
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
50.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A5
102
{ACAD_XDICTIONARY
360
328
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
ColorChange
 70
    16
 71
     2
 72
     2
 73
     3
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     8
421
  8421504
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     8
424
  8421504
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9E
102
{ACAD_XDICTIONARY
360
31A
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Conceptual
 70
     9
 71
     3
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     2
 91
        2
 64
     7
 65
   257
 75
     1
175
     1
 42
40.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A0
102
{ACAD_XDICTIONARY
360
31E
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Dim
 70
    11
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
-50.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
172
102
{ACAD_XDICTIONARY
360
32E
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
EdgeColorOff
 70
    22
 71
     2
 72
     2
 73
     0
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A4
102
{ACAD_XDICTIONARY
360
326
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Facepattern
 70
    15
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
96
102
{ACAD_XDICTIONARY
360
30A
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Flat
 70
     0
 71
     2
 72
     1
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
97
102
{ACAD_XDICTIONARY
360
30C
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
FlatWithEdges
 70
     1
 71
     2
 72
     1
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
98
102
{ACAD_XDICTIONARY
360
30E
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Gouraud
 70
     2
 71
     2
 72
     2
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
99
102
{ACAD_XDICTIONARY
360
310
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
GouraudWithEdges
 70
     3
 71
     2
 72
     2
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9D
102
{ACAD_XDICTIONARY
360
318
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Hidden
 70
     6
 71
     1
 72
     2
 73
     2
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     2
 91
        2
 64
     7
 65
   257
 75
     2
175
     1
 42
40.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
170
102
{ACAD_XDICTIONARY
360
32A
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
JitterOff
 70
    20
 71
     2
 72
     2
 73
     0
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
       10
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A3
102
{ACAD_XDICTIONARY
360
324
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Linepattern
 70
    14
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     7
175
     7
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
171
102
{ACAD_XDICTIONARY
360
32C
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
OverhangOff
 70
    21
 71
     2
 72
     2
 73
     0
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        9
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9F
102
{ACAD_XDICTIONARY
360
31C
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Realistic
 70
     8
 71
     2
 72
     3
 73
     0
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17F
102
{ACAD_XDICTIONARY
360
338
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded
 70
    27
 71
     2
 72
     2
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     0
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     8
425
  7895160
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        5
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17E
102
{ACAD_XDICTIONARY
360
336
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded with edges
 70
    26
 71
     2
 72
     2
 73
     1
 90
        2
 40
-0.6
 41
30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        2
 64
     7
 65
   257
 75
     2
175
     1
 42
1.0
 92
        8
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        5
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17B
102
{ACAD_XDICTIONARY
360
330
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shades of Gray
 70
    23
 71
     2
 72
     2
 73
     3
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     2
 91
        2
 64
     7
 65
     7
 75
     1
175
     1
 42
40.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17C
102
{ACAD_XDICTIONARY
360
332
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Sketchy
 70
    24
 71
     1
 72
     2
 73
     2
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     2
 91
        2
 64
     7
 65
     7
 75
     1
175
     1
 42
40.0
 92
       11
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     6
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A2
102
{ACAD_XDICTIONARY
360
322
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Thicken
 70
    13
 71
     2
 72
     2
 73
     1
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
       12
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     5
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     1
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9C
102
{ACAD_XDICTIONARY
360
316
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Wireframe
 70
     5
 71
     0
 72
     2
 73
     0
 90
        0
 40
-0.6
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        4
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        0
 66
   257
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
        1
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17D
102
{ACAD_XDICTIONARY
360
334
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
X-Ray
 70
    25
 71
     2
 72
     2
 73
     1
 90
        1
 40
0.5
 41
-30.0
 62
     5
 63
     7
421
 16777215
 74
     1
 91
        0
 64
     7
 65
   257
 75
     1
175
     1
 42
1.0
 92
        8
 66
     7
 43
1.0
 76
     1
 77
     6
 78
     2
 67
     7
 79
     3
170
     0
171
     0
290
     0
174
     0
 93
       13
 44
0.0
173
     0
291
     0
 45
0.0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
DICTIONARYVAR
  5
227
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
60.000000
  0
DICTIONARYVAR
  5
EB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1:1
  0
DICTIONARYVAR
  5
EA
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
AB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
1B4
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
1B5
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
5A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
5E
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
226
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14B
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
224
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
223
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
225
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
127
  0
DICTIONARYVAR
  5
228
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARY
  5
309
102
{ACAD_REACTORS
330
307
102
}
330
307
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
308
102
{ACAD_REACTORS
330
307
102
}
330
307
100
AcDbDictionary
281
     1
  3
1654967913120
350
302
  3
1654967913136
350
303
  3
1654967913152
350
304
  3
1654967913168
350
305
  3
1654967913184
350
306
  0
DICTIONARY
  5
33C
330
1A9
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
33D
  0
DICTIONARY
  5
191
330
22
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
185
330
93
100
AcDbDictionary
280
     1
281
     1
  3
FBXASSET
360
186
  0
DICTIONARY
  5
183
330
92
100
AcDbDictionary
280
     1
281
     1
  3
FBXASSET
360
184
  0
DICTIONARY
  5
10B
330
94
100
AcDbDictionary
280
     1
281
     1
  3
BUMPTILE
360
10D
  3
DIFFUSETILE
360
10C
  3
FBXASSET
360
187
  3
OPACITYTILE
360
10E
  3
REFLECTIONTILE
360
10F
  0
DICTIONARY
  5
33A
330
1A7
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
33B
  0
DICTIONARY
  5
FF
330
A7
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_ROUNDTRIP_2008_TABLESTYLE_CELLSTYLEMAP
360
300
  0
DICTIONARY
  5
314
330
9B
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
315
  0
DICTIONARY
  5
312
330
9A
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
313
  0
DICTIONARY
  5
320
330
A1
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
321
  0
DICTIONARY
  5
328
330
A5
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
329
  0
DICTIONARY
  5
31A
330
9E
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
31B
  0
DICTIONARY
  5
31E
330
A0
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
31F
  0
DICTIONARY
  5
32E
330
172
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
32F
  0
DICTIONARY
  5
326
330
A4
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
327
  0
DICTIONARY
  5
30A
330
96
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
30B
  0
DICTIONARY
  5
30C
330
97
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
30D
  0
DICTIONARY
  5
30E
330
98
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
30F
  0
DICTIONARY
  5
310
330
99
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
311
  0
DICTIONARY
  5
318
330
9D
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
319
  0
DICTIONARY
  5
32A
330
170
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
32B
  0
DICTIONARY
  5
324
330
A3
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
325
  0
DICTIONARY
  5
32C
330
171
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
32D
  0
DICTIONARY
  5
31C
330
9F
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
31D
  0
DICTIONARY
  5
338
330
17F
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
339
  0
DICTIONARY
  5
336
330
17E
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
337
  0
DICTIONARY
  5
330
330
17B
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
331
  0
DICTIONARY
  5
332
330
17C
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
333
  0
DICTIONARY
  5
322
330
A2
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
323
  0
DICTIONARY
  5
316
330
9C
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
317
  0
DICTIONARY
  5
334
330
17D
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
335
  0
XRECORD
  5
302
102
{ACAD_REACTORS
330
308
102
}
330
308
100
AcDbXrecord
280
     1
  1
AcDb_Thumbnail_Schema
102
{ATTRRECORD
341
303
  2
AcDbDs::TreatedAsObjectData
280
     1
291
     1
102
ATTRRECORD}
102
{ATTRRECORD
341
304
  2
AcDbDs::Legacy
280
     1
291
     1
102
ATTRRECORD}
  2
AcDbDs::ID
280
    10
 91
        8
102
{ATTRRECORD
341
305
  2
AcDs:Indexable
280
     1
291
     1
102
ATTRRECORD}
102
{ATTRRECORD
341
306
  2
AcDbDs::HandleAttribute
280
     7
282
     1
102
ATTRRECORD}
  2
Thumbnail_Data
280
    15
 91
        0
  0
XRECORD
  5
303
102
{ACAD_REACTORS
330
308
102
}
330
308
100
AcDbXrecord
280
     1
  1
AcDbDs::TreatedAsObjectDataSchema
  2
AcDbDs::TreatedAsObjectData
280
     1
 91
        0
  0
XRECORD
  5
304
102
{ACAD_REACTORS
330
308
102
}
330
308
100
AcDbXrecord
280
     1
  1
AcDbDs::LegacySchema
  2
AcDbDs::Legacy
280
     1
 91
        0
  0
XRECORD
  5
305
102
{ACAD_REACTORS
330
308
102
}
330
308
100
AcDbXrecord
280
     1
  1
AcDbDs::IndexedPropertySchema
  2
AcDs:Indexable
280
     1
 91
        0
  0
XRECORD
  5
306
102
{ACAD_REACTORS
330
308
102
}
330
308
100
AcDbXrecord
280
     1
  1
AcDbDs::HandleAttributeSchema
  2
AcDbDs::HandleAttribute
280
     7
 91
        1
284
     1
  0
XRECORD
  5
33D
102
{ACAD_REACTORS
330
33C
102
}
330
33C
100
AcDbXrecord
280
     1
102
DISPLAYNAME
  1
Imperial24
102
FLAGS
 90
        0
  0
XRECORD
  5
186
102
{ACAD_REACTORS
330
185
102
}
330
185
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
7581DE8E-A623-425F-9BF4-B3F4BE6C4F9A
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623B9A2F3B5FEC0000007C01000008000000636F72652E786D6C8D90416E83301045AF62CDB632D8040820E328B4E204BD80653BC44AB011B6AB1EBF262152BBEB6A467FFE9B197D76FA9EEFE84BAFDE38DB03CD08206DA553C64E3DC470C10DA01367AB73E1970D9015B3EE61
310
9381B3697571D925E96CD03624D53AA5775178AF0320794F4D0F5E5EF52C32114372F85BB608791393CEE8AB4B708C46A1E711A3D23E73317A055E0D4D53D6C71A9FC7A1C6657D18703354232ECFED4731B6B43CBED72CDF60CE82995FF7E5AA45D00A7841488B29C5A4F8A46547AAAEA8DE48D311C2F2CDFE078A8BFA2714
310
8D0D87627FF78979E0343DF21870966F59A4F2082AD52D37FE03504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623B6E137E0172010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C0810121947A1554ED00B38E05014B091B1518EDFE511A5A9D22AFD2A1F60CDEC7A67C698ED2E6D8306
310
69FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7166B4B65FCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B0FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2601EE7691A25EBC4DB1FF2C48B9255EEA5797C
310
F0A2FDE62D3C6C8268FD9A3032367366EBF6AAAE30525859621E52BAF182C0A3E17B106D69BC0DE3179A6E2965642CBF6B725DF96493AB955D858BDCB9ADC73C002113F1CD2D4464512F06D04338236388F09912BE0F1A028190AD3836571F67800659586D22604AED6ED4201A27612AF5E9F4A09F178CCC9D3075DA1C5C3F
310
9C113E3DE3F71DE1A885AAC084B0B03C3A3BEA64B38625B44E1A6FB017A4B46945F39C8D5F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F02504B0304140006080800AC70623BE001BAC07D0000009D0000000B0000006662782F636E782E786D6C4DCCD10AC2201886E15B91FFDCA6536B037548D87D8CE686
310
E4344CA3CB6F8B1D74F4C1C3C72B87CF1AD0DBE5974F51013D11402EDED3E4E3A2A096197780062D734AE5EF06288EAB53B03368B9E4549F074D6E1E6B289B061F1F07124689687987B9601C7373BD60C36E065B6A6DDF7341A93843A365F32B6DBB87F517504B0304140006080800AC70623B8E5068122901000012020000
310
310000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C8D515B6EC32010BC0AE22B55850D364E93081345557A825E801892A2C460F1A872FC2EB523B57FF961D1EECCECECAED8DFC71BFA36215AEF7ACC2A8A917183D7D65D7A9CD3996C30DA4B
310
11BC4F7F601839359A1E973496E2127C9E96D4E05D322E41D6796D96A48AD1248C861B7C7A1C872F33AA4AE5048878AD26355CD5C554AC8232E0A4882980013437292F96B465B46BF886F0AEE5841FDEDFC8A1FD3890233B1EB75BDE31D6AD453D13A5C8D9EA856E35D8B1676BC2B322852C45B2E3C3FE108C4A4663D950BA
310
258C11DA7C32BEA3DDAEE95EE96647A9A80BFC1F294FFA4952B62EB5CD6277A6452C99A8E78214DAE7D3ED61C6DC271F122AFD56D10C2F305545CB6A60FC1908E383E29A2F8A31F900EB5D5D4F8065DD2CBBE652D4E542107ECF07B15C53FE00504B0304140006080800AC70623B503B51794E010000330300003000000066
310
62782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F
310
77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347
310
DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F
310
504B0304140006080800AC70623B38FA165F680500003C100000340000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F6F626A656374732E786D6CAD575D6FA33814FD2B887D0E8424EDB42BCAA8499A2A1A756634D18CF6A15264C0A16CC146B6E9A4FBEBF7180C
310
019276B21F7908D8D8F7F3DCE36BFFE33ECFAC172A64CAD98DED3963DBA22CE271CA921BBB54BBD1956D7D0C7CC1B9EA2CB32D46727A63EB693BF013C1CBC24CC57447CA4C0D6657F33F2C1951466D2BCA889437B68C9E684E1C522A1E53F9ECC4441127D9ED1DCFA917F6C52682144F03A105119429588A790629566D94D7
310
1F8E6D37F05DFD3DF0F5BF59357D7B955BF9D3D79F32A9088B8E940DC44CBDD9F26E72713DBA98CDA6A3D9E5C41BCD57F3E5C8FB301D2F2E178BEBDBBB6B28964A4092B144D09D1DDC2336228D7CB7FED45A6C0C3F6552C419A351E53F3CAC6C3612635A5016238F2995D0D6F17ADC1F7A3A369DCF533D362ABBD3E779D5DD
310
D111D4D8DE3CBB96F2F04FB820CF41859054A3AA8E8F71B4C6DFF810B590F3CC7C4BA5951345454A322B4B4341C4AB1D60A95E12F83D311A9D42235C7B6007DE415ED75694C6AFB17BCACA5D99651A9A7650217B0BFC53252BCBD2BFA838AD0D36215765CAD4957148BD16D40EAE7DB79A0C7CFD984ECCC73A90D62E230952
310
0E37EBAF034717BAF6D64B3BF8B40AF71B5D8FA79517821754280D1F40AB495CF3D451326ABDB332A737C0995ECC0F41F986C87F46F91E4C41DE44BA9FED67468B1284C91D173972E38CAB9F356E5E46EDDBF10BF86CB0FA784D3BF3AF16FB6E6B6C9F30DECA1FC0A55373F5DFF3D78F5917A99DF405FE0B0A8C8BA909E526
310
2219A8E72165488806A595714C81CB77E1DE0ED6604A303B76912C680372F4E2BB2FF88EFF5A36D8AA52DF79322474C0B767303F625995056C7B032C473C592936CEBD15F38BFFA5666E979B4F9B52EC48441F0CB12CE92E65A9C2D979006FD7A05E227A1E3DD3D79F5CC470F438099B6E1272A34A22DA3AE63AF0497358E8
310
C141734F41847D09D79CE7FF42C3432A239A6584515E365ADA634863B52519D327A00AEB804E2703140BFA92EA4EA2B7A26716CEFA48A4850E597BE8B53CEDBCE1CBF7F56780D20EE6AF73A0F5F9B02A3CD07DC4332EB6E1EBB666421BE0C39E3EBA7FF4E16D22EA6A29407C85E586724C88B771BADB9512BC7B228A3FD68B
310
6EA65A22397E690AA8D158D7E40CEC8CDA23C2C0B7D1898640101CEC9C6D531CE328CB93CABBBA870A6425F70DF96199175B92F392A973C2346EFC69AC6F8577BB18F993A8E8C90E36D573340765C7343EA4AA87027D049DF0A9979E0F1757DEF2EEEA6E747B39412B35B9588DAEE7ABD9683E5DCDE677978BD9EAFAB6B5A8
310
B224F09B13AA5B8388264E44BF14A909F3F7F5A16CEDE08128E9DED705E526F5F3FBDA415BECBBD80380B71BD77991D19C3245347C1FF44BF68DA0ABE8C9A8E7D73949E81952BEDC6F063660E68C7D5F75A9D19F83BD6676A16BE1A410F554E621236936D8681C770A9618B79B50B6CF9AD19BA11E9978A20F953C4B63104E
310
6C2594E7548176CE607B915309C474BBF2D8DC1ECED8FD52F7838A84196D2C79226889330954036E65A4FAF3D66F68E174177563E3B0739EF1670AD1B690EA1B1BFCA6D2884A27C4F1A81B9F4A3820802EAC2541408DB02443675D6F6AC7ED2E1D1BD00F4E40A3BF5D724EB764FCEA116F4E8A02A7768F562BDB8C82E81F39
310
DE98631185D7B054AD2F8789D6994A0D2AAB76CADC0DD0423C1BD57BD4D7FB6E794EB5A61791B3EE49EF82A0963A524424D5BD40DB674CBA5D7E75D10A58EB2F569195097279BEA491A00073A90B1C28022A8CCC82284075F1FBE357C17117CDAD550A083C2E789E736606B7E62E6B6D9E70338D1F410B545F3FE464EC798F
310
55D76F2E22DB9048EA90583E63A22938EDC1006B00E4D1716A52E0EA1C0C96AF9796393066105A81F6A829ADAFE1168A47DF1C75A974C9B278B7F177ABA5008340CB1EFC0D504B0304140006080000AC70623B000000000000000000000000350000006662782F30333130353234382D343533342D344143372D413346412D
310
4531454539393435313135362F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E636660600000504B0304140006080000AC70
310
623B000000000000000000000000370000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30333130353234382D343533342D344143372D41
310
3346412D4531454539393435313135362F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11D
310
E607FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BF2C5666EFF000000A00100003B0000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F7265736F7572636573
310
2F636F72652E786D6C8D504B6E833010BD0A9A6D65B00910888CA3D02A27E8052C33A156821DF953F5F8B5132AB5BB6E6646EFA3797AFCF8B5DE8A4F745E5B33022B291468949DB5594688E1427A288E823B6BC32F191446AE38428641F0C5D978DF20654D4013126AEC8C1B28BDC70085BAA56304AF3E7095A58C2129FCB5
310
BC4B75950B96AC4C74D209EE834B018AE7933C4138F4363A859E574F56F018F5BC69F49C7EEA8B4607A29DFABEE9F62D399DA78E34DD6E22FDD49E49731ADEEAF3C09AFD6BC7AB6C163CE8F527A3722803CE206A4A07C218A1F53B6B0EB43DD4ED0BED0F94F22ACBFF98E27DFEA7296A1376F516F769F320580AF22004AF72
310
5F693DCA4C3B772BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B200
310
00005B436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623B9A2F3B5FEC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D
310
6C504B01021400140006080800AC70623B6E137E0172010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623BE001BAC07D0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B010214001400060808
310
00AC70623B8E506812290100001202000031000000000000000000000000005B0500006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D3
310
0600006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6C504B01021400140006080800AC70623B38FA165F680500003C10000034000000000000000000000000006F0800006662782F30333130353234382D343533342D344143372D413346412D4531
310
454539393435313135362F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000290E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F76657274696365732E62696E504B01021400
310
140006080800AC70623BF270F133060000000400000036000000000000000000000000007C0E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000
310
000000000000000000D60E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD1900000004101000036000000000000000000000000002B0F00006662782F30333130353234382D
310
343533342D344143372D413346412D4531454539393435313135362F6469726563746F72792E786D6C504B01021400140006080800AC70623BF2C5666EFF000000A00100003B000000000000000000000000000F1000006662782F30333130353234382D343533342D344143372D413346412D453145453939343531313536
310
2F7265736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000671100000000
  0
XRECORD
  5
184
102
{ACAD_REACTORS
330
183
102
}
330
183
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
778E3A9F-1AF3-452F-85C1-1BC15BD3F630
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BFD5588D4EC0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103891DC7C24471939CA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EF81EEFE8CBCCC17AD7012D0820E394D7D60D1DA478C50DA083E0B3F7F1970D9093A3E960
310
9141F061F6695A25E55D342E66D5796D56518660222075CF4D07417D9A511632C5EC08B76292EA260753D05797E194AC46CF2356E77DF66ACD0C62C768BD63971E5727D2E06DDF9C71BF7B3FE10BABF79BFA488FE4DCF07281058F767CDD57B391D168108C903DA61413F641B72DA95A56BD91A62584978BFD0F9426FD4F28
310
5917376C7DF7890510343FF218085E2E59E4F2082AD72537F103504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB5D38BAD72010000D40300000C0000006662782F636F72652E786D6CC553DB8E823014FC95A6AF1B68C11B9A52A3AB7EC1FE4085CA36424B4A4BFCFC3D5C8CEBC635EED3F200CDCC393D3353CAD697AA44AD
310
B48D323AC5514831923A33B9D2458ABD3B0509466BCEAC31EE5B19465A5432C51D8C392BACF1F50865463BA91DA0DAE4720445D348875156C222C54DF6292B110AEFA0A23987B5C8CEA2906114020D759C35CE8200340CE9DE989F8E1746069C33EF553EB22A8769EAA4A4C57C1147F3457CD806B31D4D82E936D907DBC5FB
310
2E38C4F3E564BE8936749F30D23573E65475559759299CCC318F295D065114D0F8239AAEE86C15CFDE68B2A29491AEFCAEC9D7F98B4D5E69378947B9435B837904427AE2875B88C8A146B4A0877046BA10E1D3277C1F340402213B712CAF3ECE00B53273C64E81C98DBF51AD28BD84A934A4FD837E5F303274C2D47E7370FD
310
7046FCF28CE73BC2510B5D8009E16079F4AED3C9060D6368B5B441EB2E481B5B89F2351B4F1CFE89BA897F282933A5B1FFA5888C0744C6DF8374F7917F01504B0304140006080800AC70623B09885E1C7E0000009D0000000B0000006662782F636E782E786D6C4DCCDF0A83201C86E15B91DFB9CBA6FD11D41063F711CB42
310
663A9C8E5DFE6A74B0A30F1E3E5E317C368FDE36BD5C0C12EA0B0164C33DCE2EAC124A5E700F685022C598FF6E80C2B459090783126B8AE579D26C97A9F8BCAB77E17122E586D5843498B3EE8699D114F39E5E713D76EDA84DCBB569A052A2FA95F63DC2EA0B504B0304140006080800AC70623B961D28872A010000120200
310
00310000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C8D515B6EC32010BC8AC557AA0A1BFC4A1C61A2C8514FD00B10435294182C1E558EDFA576A4F62F3F80666766875D76784CF7EC5B39AFADE911CD09CA9419ADD4E6DAA3182E7887B203
310
67CEDAF08786322326D5A30423CEAECEC67985466B8232015063A55A41E1BD0A281BEFF0E8911FBFD42472110330FC2D9FC578135795D31CCAC0E3CC070701B2A5493A11AFBAA1A68434B8ABB71FB81E8E15EE765589E969DB9E8E43DB1D8786158B90B318B55CE55A421C7DD1CABD6A92C49C053D3DE38F4E89A024E22521
310
1DA61493F293D67BD2ECCBE69DECF684B022D1FF89E22C5F14456D4255AE711799479CB2622970266D3CDF9F61D463B62E64A9DFC6ABF10D7192C35CCA0A040B11BE0F8E6DBD3AFA601D8C77733B0397C290926D5B7356A40DC1F5BB3EB8D336F90F504B0304140006080800AC70623B503B51794E01000033030000300000
310
006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1E
310
BC4F77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C54
310
2347DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F
310
103F504B0304140006080800AC70623B2EA4D28F640500003C100000340000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F6F626A656374732E786D6CAD575D739B3814FD2B0CFB6C30B1D3263B844E6CC71D4F376DA79E76F621331E01326103122389C4E9AFDF
310
231018B09D7A3FFC609090EEE7B94757FE875D9E59CF54C894B31BDB73C6B64559C4E394253776A9B6A32BDBFA10F88273D559665B8CE4F4C6D6D376E027829785998AE99694991ACC2E677F5A32A28CDA569411296F6C193DD29C38A4543CA6F2C98989224EB2DD399E532FEC8B4D04291E07420B222853B014F30C52ACDA
310
28AF3F1CDB6EE0BBFA7BE0EB7FB36A727A955BF9D3D79F32A9088B0E940DC44CBCE9E2EEE2F27A74399D4E46D37717DE68B69C2D46DEFBC978FE6E3EBFBEBDBB8662A90424194B04DDDAC147C446A491EFD69F5A8B8DE1C74C8A386334AAFC878795CD46624C0BCA62E431A512DA3A5E8FFB434FC7A6F379A2C7466577FA3C
310
AFBA3B3A821ADB9B67D7521EFE0517E439A810926A54D5F1318ED6F81BEFA316729E996FA9B472A2A84849666569288878B5032CD54B02BF2746A35368846B0FECC0DBCBEBDA8AD2F835768F59B92DB34C43D30E2A646F807FAA646559FA938AE3DA60137255A64C5D1987D46B41EDE0DA77ABC9C0D78FC985F95807D2DA66
310
2441CAE166FD75E0E85CD7DE6A61079F96E16EADEBF1B8F242F0820AA5E1036835896B9E3A4A46AD7756E6F40638D38BF93E28DF10F9CF28DFBD29C89B4877D3DDD468518230B9E522476E9C71F5B3C6CDCBA87D3B7C019F0D561FAE6967FED562DF6D8DED13C6A9FC015C3A3557FF3D7FFD987591DA495FE03FA3C0B89898
310
50AE2392817AEE53868468505A19C714B87C1BEEEC6005A604B36317C9823620072FBEFB8CEFF8AF6583AD2AF59D274342077C7B06F323965559C0B6136039E0C94AB171EE54CC2FFF979AB95DAC3FAD4BB12511BD37C4B2A0DB94A50A67E71EBC5D837A89E879F4445F5FB888E1E86112D6DD24E4469544B475CC75E093E6
310
B0D083BDE69E8208FB12AE39CFFF8586FB544634CB08A3BC6CB4B4C790C66A4B32A64F4015D6019D5C0C502CE873AA3B89DE8A9E5938EB2391163A64EDA1D7F2B473C297EFABCF00A51DCC5EFF20AF5DC20CF7741FF18C8B4DF8BAA999D006F8B0A78FEE1F7D789B88BA5A0A105F61B9A11C13E24D9C6EB7A504EF1E89E28F
310
D5BC9BA996480E5F9A026A34D63539053BA3F68830F06D74A2211004073B679B14C738CAF2A8F2AEEEA10259C93D213F2CF36243725E32754E98C68D3F8DF5ADF06E17235F888A1EED605D3D473350764CE31309D547D0119F7AE979FFFEEA6E727BBD1C79B74BB4529717CBD1D5E5DC1B79B3B977395B4C96EF2638E6FA15
310
D09C50DD1A44347122FAA5484D98BFAFF6656B07F74449F7635D506E523FBFAF1CB4C5BE8B3D0078BB71951719CD295344C3F75EBF64DF08BA8A9E8C7A7E9593849E21E5CBC7F5C006CC9CB1EFAB2E35FA32D86B66E7BA168E0A518F651E329266838DC671A7608971BB0965FBAC19BD19EA918927FA50C9B33406E1C45642
310
794E1568E70CB6173995404CB72B8FCDEDE18CDDCF753FA84898D1C6924782963893403548A78C547FDEFA0D2D9CEEA26E6C1C76CE13FE4C21DA16527D6383DF541A51E984381E75E353090704D085B52408D0139664E8ACEB4DEDB8DDA56303FAC10968F4B74BCEE9968C5F3DE2CD4951E0D4EED16A659B5110FD23C71B73
310
2CA2F01A96AAF5653FD13A53A909C03570A77DA0857832AA77A8AFB7DDF29C6A4D2F2267DD93DE04412D75A48848AA7B810EBA31E976F1D5452B60ADBE58455626C8E5F992468202CCA52E70A008A830320BA200D5F9EF0F5F05C75D34B7962920F030E779CE9919DC9ABBACB57EC4CD347E002D507DFD901763CF7BA8BA7E
310
7311D984445287C4F209134DC1690F065803200F8E53733D73750E06CB570BCB1C185308AD407BD094D6D7700BC5A36F8EBA54BA6459BCD9F8BBD552A040A0650FFE06504B0304140006080000AC70623B000000000000000000000000350000006662782F33394334313030352D393437462D344341332D393833322D3144
310
373644414336394143352F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B
310
000000000000000000000000370000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F33394334313030352D393437462D344341332D393833
310
322D3144373644414336394143352F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607
310
FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623B95BFD5E5FE000000A00100003B0000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265736F75726365732F63
310
6F72652E786D6C8D50596E833010BD0A9ADFCA603B1B41C611699213F40296992456828DBC543D7E4DA052FBD79F99D15B344F4F1CBE8667F1893E18675B60258502AD76BDB1B71652BC921A8A8314DEB9F84B06855503B630C120C5CDBB342E907636A28D19B5AEC70554216084423FF3D142D0771C54A952CC8AF02847A5
310
1FEA86252B339D755284E87380627E324D901E834B5E6310D5CC4A9192E9178DE9F34F7335E841EE38DBEEF8A5239B13ADC9FA589FC971F77E2217BEDDAFB61DEBE8B916D56496229AE127A3F6A822F62039A57BC218A1FC83AD1BBA69F8E68DD60DA5A29AE47F4C69ECFF694AC6C6155FE2CEB60092E5202F428A6AEA2BAF
310
5799794FDDCA6F504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B
310
436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BFD5588D4EC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D6C504B
310
01021400140006080800AC70623BB5D38BAD72010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623B09885E1C7E0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B01021400140006080800AC70
310
623B961D28872A0100001202000031000000000000000000000000005C0500006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D5060000
310
6662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6C504B01021400140006080800AC70623B2EA4D28F640500003C1000003400000000000000000000000000710800006662782F33394334313030352D393437462D344341332D393833322D3144373644
310
414336394143352F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000270E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F76657274696365732E62696E504B01021400140006
310
080800AC70623BF270F133060000000400000036000000000000000000000000007A0E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000000000
310
000000000000D40E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000290F00006662782F33394334313030352D393437
310
462D344341332D393833322D3144373644414336394143352F6469726563746F72792E786D6C504B01021400140006080800AC70623B95BFD5E5FE000000A00100003B000000000000000000000000000D1000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265
310
736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000641100000000
  0
XRECORD
  5
10D
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10C
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
187
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
 70
     0
 90
1778669749
  1
7E355024-1ABF-47F9-966E-F2159FBE82AB
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BDCE527C8EB0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103B15DC7C24471249FA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EFA9EEFE8CBACC17AD7032D0820E394D7D64D3DA478C52DA093E0ABF7F1970D9093B3E961
310
9341F069F569D925E55D342E66D5796D76518660222075CF4D0F417D9A591632C5EC08B76291EA262753D05797E194AC46CF2356E77DF66ACD0A621C9B73335C463C5E0E1457EC9DE2A1612D3E9233A92BD2D66333F07283058F767EDD57AB91D168108C9023A61413F641AB8ED41DABDF48DB11C2CBCDFE074A8BFE2794AC
310
8B07B6BFFBC402089A1F790C042FB72C72790495EB969BF801504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF32603847
310
2BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB24894EB71010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C085012194749244ED00B38E05014B091B1518EDFE511A5A9D228FD2A1F60CDEC7A67C6986D2F6D830669
310
FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7266B4B6DFCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B4FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2609EE7C92ED91F722F3FAC022F0ADF036F9F84A9
310
B7A63B1A47348DF364CFC8D8CC99ADDBABBAC2486165897948E9DA0B028F861F41B4A1F1268CDF68BAA19491B1FCAEC975E58B4DAE5676152E72E7B61EF300844CC40FB7109145BD18400FE18C8C21C2674AF83E68080442B6E2D85C7D9C011A6461B5898029B5BB5183689C84A9D4A7D3837E5F303277C2D4697370FD7046
310
F8F28CE73BC2510B5581096161797476D4C9660D4B689D34DE602F4869D38AE6351B4F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F01504B0304140006080800AC70623B3A54DFB77D0000009D0000000B0000006662782F636E782E786D6C4DCCD10A83201805E05791FFDEA5EBA76DA046A37C8F581632D3
310
613AF6F8B3D1C52E0E073E0E47B49FD591B7899B0D5E023F3120C63FC264FD2221A7995E81B44AC410D2DF0C881F5723616750628921BF0E9ACC3C66978A3AEB9F07B2A6D77AB87514F95953EC39D20EEF9C6AD60C88BC2EB940A544F57B2ABD1FAB2F504B0304140006080800AC70623B4A17098729010000120200003100
310
00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C8D515B6EC32010BC0AE22B55850D0E76930813A54A7C825E80DA244589C1E251E5F85D6A476AFFF2018B7667666759B1BF8F37F4AD7D30CEB6981514236D7B37187B69718A67B2C1682F8577
310
2EFE816164D5A85B9CD3588A8B77695A52BDB351DB0859EB06BD2455083A62D4DFE0D1E2D07FE951152A4540846B31A9FEAA2EBA600594012745881E0CA0B949BEB1A4CDB1EB4EDB03E1ACEA083F324E0EFC9D918E3627CED91ACE9B2867A214299961A19B01EC98B3D1FE59914C96229AF161BFF75A453D605951BA258C11
310
5A7D30BEA3F5AEAA5FE96647A92833FC1F294DC393A4646C5C578BDD9916B064A29C0B520C2E7DDE1E66F47D723EA2DC6F1574FF02531594D6AC69443903617C506CF8A218A2F3F0BDABEB2760593DCB365C8A326F08C2EFFA20E66DCA1F504B0304140006080800AC70623B503B51794E0100003303000030000000666278
310
2F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F7736
310
4A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347DEE0
310
50F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F504B
310
0304140006080800AC70623BD8F6D0D5660500003B100000340000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F6F626A656374732E786D6CAD575B8F9B3814FE2B887D064292B964C5504D92491555D3568D5AEDC348910187610730B2CD4C667FFD7E06438024
310
6DF6928780CDF1B97EE762EFC33E4B8D57CA45C2F23BD3B547A641F39045491EDF99A5DC59B7A6F1C1F73863B243661A39C9E89DA9B64DDF8B392B0BBD15D11D295339D85DCDFF304448736A1A614A84B83345F84C33629352B2888A173B2292D8F16E6FBB764DD8671B73523C0F981684D35C4253ECE7E062D44AB9FDE5C8
310
747CCF51DF7D4FFD6BAAC9792AA7B2A72F3FC985247978246CC066E24E970FE3AB9975359D4EACE9F5D8B5E6ABF9D2726F26A3C5F56231BB7F9841B0901C9CB4269CEE4CFF237CC393D073EA4FADC65AF1532A852CCF6958D90F0B2B9D35C78816348F10C7840A48EB583DEA2F5DE59BCEE7895A6B91DDEDCBACEA9EE8306A
310
746F9E5D4D59F0274C1097A0820BAA5055FB471B5AE36F74F05AC058AABF25C2C888A43C21A991260127FCDDF441AA487CAFC746A1932B842B0B4CDF3DF0EBEA8AD4F835764F69B92BD35441D3F42B646F817F2A45A559F217E5A7A54127C4AA4C7279AB0D92EF0535FD99E7549BBEA71E93B1FE583BD2D8A52446C86166FD
310
7560E842E5DE7A69FA9F56C17EA3F2F1B4F082B38272A9E0036835816B9ECA4B5AAC7B51E4D40118D3F3F9C129DFE0F9CF48DF832A881B4FF6D3FD544B919CE462C77886D8D8A3EA678C9A17AB7D3B7E413D1B501FD3B43BFF8AD8735A65FB05E35CFC002E159ADBFF1EBFBECFBA48ED84CFF75E91608C4FB42B372149517A
310
1E931C0151A03452862DD4F25DB037FD352A252A3B4E91D46F1D72F4E239AFF88EFF9A37AA5525BEF3CC11D041BDBDA0F2C397555A40B7336039AA9395606DDC399F5FFD2F3973BFDC7CDA947C4742FAA80BCB92EE923C91E89D07F07615EA05A267D10B7D7F633C82A1C741D8748390695102DE563E578E8F9B66A11607C9
310
3D0121CEC54CD53CEF17121E1311D2342539656523A56D430AAB6D91D17302B2B076E8643C4031A7AF899A247A143DB5D0EB439E14CA656DD36BEBB47DC696EFEBCF0025E8531690F440141CAA7DC852C6B7C1FBB62E8426B087237D70FFE8A35B3BD4515C00F80ACA4DC5D11EDE46C96E570A94DD134EFCB15E7403D5D691
310
E397267F1A89754A4E519C917A846BF43632310F7082BECEF26D822E8EAC3C29BC2B7B2840547CCFF00FCAACD8928C95B9BCC44DA3C69E46FB96797788116F4486CFA6BFA99ED61C153BA2D121543D10A80E74C2A65E786E1E265757A3F1D472EFE72B6B7AB39A59B3EBEB076B3576AF66ABF9C3EDF87EDE6A5469E27B4D83
310
EAA620BC8986E8953CD16EFEBE3E64ADE93F12299C8F753E3971FDFCBEB631157B0ECE00DFEDC17556A434A3B9240ABD8FEA25FD463054F478D4FBEB8CC4F4022E5F3E6E063A60E782735F55A6D1B7C159BDBB50B97092897C2EB32027493A38A80DB78B3CD66637AE6C9F75416F966AA5FD893154B03489506F2223A62CA3
310
1255E78262CF332A8098EE501EE9CBC305A75FEB71509220A58D26CF0413712A806AC0AD0C657FDFF80D139C1AA2EE4CF43AFB057F3A114D03A1BE3351DE6412526107E88E6AEEA998030218C2DA1A08A8913C4E3158D787DA757B4AF906E5070D50CB6F492E1996B45DBDBA9B91A240D3EE55D54A372D20FC478637EA1844
310
E23528656BCB61A335A61283CCAA8DD257034C102F5AF41EF9F573B35CBBA2E979E4A26BD24F415073B524E171752D50FA6995EE975F1D4C02C6FA8B51A4658C585ECEC9E214602E558203454085E6591009A82E7E7FFACA19AEA299B14A0081A705CB3296EBC5BDBECA1A9B675C4CA3279405AA6E1F623C72DDA76AE8D7F7
310
906D4004B549245EB0D1249CB260803500F2A89BEA10382A0603F2F5D2D00D630AA615688F66D2FA166E2079D4C551A54AB758163F9DFB9D8A1460E098D8FDBF01504B0304140006080000AC70623B000000000000000000000000350000006662782F30364446464539412D343132462D344431342D413442312D46303645
310
34343133343431372F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B0000
310
00000000000000000000370000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30364446464539412D343132462D344431342D413442312D
310
4630364534343133343431372F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607FB14
310
4396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BB40F7AF9FE000000A00100003B0000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F75726365732F636F72
310
652E786D6C8D504B6E833010BD0A9A6D65B00950828CA3109513F4029699502BC146FE543D7E4D42A576D7CDCCE87D344F8F9FBE967BF689CE6B6B7A6039850C8DB29336730F315C490BD94970676DF82583CCC8057BD860107C7636AE3BA4AC096842428D9D7007A5F7182053F774F4E0D5072E3297312485BFE5AB543739
310
63CEF244279DE03EB814207B3ED9260887DE46A7D0F3E2C90A1EA39E768D9ED24F7DD5E8408C63736E86CB1B192F0746AAF29591A1295B72A4675A57B4ADC766E0C566163CE8E527A37228034E204A4A8F843142CB775675B4EECAFA85B61DA5BCD8E47F4C719DFE698ADA8443B9C77DDA3C0896823C08C18BADAFB41E65A6
310
BD752BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B436F
310
6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BDCE527C8EB0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000094020000636E782E786D6C504B0102
310
1400140006080800AC70623BB24894EB71010000D40300000C00000000000000000000000000180300006662782F636F72652E786D6C504B01021400140006080800AC70623B3A54DFB77D0000009D0000000B00000000000000000000000000B30400006662782F636E782E786D6C504B01021400140006080800AC70623B
310
4A17098729010000120200003100000000000000000000000000590500006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D10600006662
310
782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6C504B01021400140006080800AC70623BD8F6D0D5660500003B10000034000000000000000000000000006D0800006662782F30364446464539412D343132462D344431342D413442312D46303645343431
310
33343431372F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000250E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F76657274696365732E62696E504B010214001400060808
310
00AC70623BF270F13306000000040000003600000000000000000000000000780E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E504B01021400140006080000AC70623B00000000000000000000000037000000000000000000
310
00000000D20E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000270F00006662782F30364446464539412D343132462D
310
344431342D413442312D4630364534343133343431372F6469726563746F72792E786D6C504B01021400140006080800AC70623BB40F7AF9FE000000A00100003B000000000000000000000000000B1000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F
310
75726365732F636F72652E786D6C504B0506000000000E000E0080040000621100000000
  0
XRECORD
  5
10E
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10F
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
33B
102
{ACAD_REACTORS
330
33A
102
}
330
33A
100
AcDbXrecord
280
     1
102
DISPLAYNAME
  1
Imperial24
102
FLAGS
 90
        0
  0
CELLSTYLEMAP
  5
300
102
{ACAD_REACTORS
330
FF
102
}
330
FF
100
AcDbCellStyleMap
 90
        3
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
    32768
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.25
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        1
 91
        1
300
_TITLE
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        2
 91
        1
300
_HEADER
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        2
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        3
 91
        2
300
_DATA
309
CELLSTYLE_END
  0
XRECORD
  5
315
102
{ACAD_REACTORS
330
314
102
}
330
314
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     1
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     0
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
313
102
{ACAD_REACTORS
330
312
102
}
330
312
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
321
102
{ACAD_REACTORS
330
320
102
}
330
320
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
329
102
{ACAD_REACTORS
330
328
102
}
330
328
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
31B
102
{ACAD_REACTORS
330
31A
102
}
330
31A
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
31F
102
{ACAD_REACTORS
330
31E
102
}
330
31E
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
32F
102
{ACAD_REACTORS
330
32E
102
}
330
32E
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     0
102
RTVSPropertyOp1
 70
     0
102
RTVSPropertyOp2
 70
     0
102
RTVSPropertyOp3
 70
     0
102
RTVSPropertyOp4
 70
     0
102
RTVSPropertyOp5
 70
     0
102
RTVSPropertyOp6
 70
     0
102
RTVSPropertyOp7
 70
     0
102
RTVSPropertyOp8
 70
     0
102
RTVSPropertyOp9
 70
     0
102
RTVSPropertyOp10
 70
     0
102
RTVSPropertyOp11
 70
     0
102
RTVSPropertyOp12
 70
     0
102
RTVSPropertyOp13
 70
     0
102
RTVSPropertyOp14
 70
     2
102
RTVSPropertyOp15
 70
     0
102
RTVSPropertyOp16
 70
     0
102
RTVSPropertyOp17
 70
     0
102
RTVSPropertyOp18
 70
     0
102
RTVSPropertyOp19
 70
     0
102
RTVSPropertyOp20
 70
     0
102
RTVSPropertyOp21
 70
     0
102
RTVSPropertyOp22
 70
     0
102
RTVSPropertyOp23
 70
     0
102
RTVSPropertyOp24
 70
     0
102
RTVSPropertyOp25
 70
     0
102
RTVSPropertyOp26
 70
     0
102
RTVSPropertyOp27
 70
     0
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
327
102
{ACAD_REACTORS
330
326
102
}
330
326
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
30B
102
{ACAD_REACTORS
330
30A
102
}
330
30A
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
30D
102
{ACAD_REACTORS
330
30C
102
}
330
30C
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
30F
102
{ACAD_REACTORS
330
30E
102
}
330
30E
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
311
102
{ACAD_REACTORS
330
310
102
}
330
310
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
319
102
{ACAD_REACTORS
330
318
102
}
330
318
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
32B
102
{ACAD_REACTORS
330
32A
102
}
330
32A
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     0
102
RTVSPropertyOp1
 70
     0
102
RTVSPropertyOp2
 70
     0
102
RTVSPropertyOp3
 70
     0
102
RTVSPropertyOp4
 70
     0
102
RTVSPropertyOp5
 70
     0
102
RTVSPropertyOp6
 70
     0
102
RTVSPropertyOp7
 70
     0
102
RTVSPropertyOp8
 70
     0
102
RTVSPropertyOp9
 70
     0
102
RTVSPropertyOp10
 70
     0
102
RTVSPropertyOp11
 70
     0
102
RTVSPropertyOp12
 70
     0
102
RTVSPropertyOp13
 70
     0
102
RTVSPropertyOp14
 70
     2
102
RTVSPropertyOp15
 70
     0
102
RTVSPropertyOp16
 70
     0
102
RTVSPropertyOp17
 70
     0
102
RTVSPropertyOp18
 70
     0
102
RTVSPropertyOp19
 70
     0
102
RTVSPropertyOp20
 70
     0
102
RTVSPropertyOp21
 70
     0
102
RTVSPropertyOp22
 70
     0
102
RTVSPropertyOp23
 70
     0
102
RTVSPropertyOp24
 70
     0
102
RTVSPropertyOp25
 70
     0
102
RTVSPropertyOp26
 70
     0
102
RTVSPropertyOp27
 70
     0
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
325
102
{ACAD_REACTORS
330
324
102
}
330
324
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
32D
102
{ACAD_REACTORS
330
32C
102
}
330
32C
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     0
102
RTVSPropertyOp1
 70
     0
102
RTVSPropertyOp2
 70
     0
102
RTVSPropertyOp3
 70
     0
102
RTVSPropertyOp4
 70
     0
102
RTVSPropertyOp5
 70
     0
102
RTVSPropertyOp6
 70
     0
102
RTVSPropertyOp7
 70
     0
102
RTVSPropertyOp8
 70
     0
102
RTVSPropertyOp9
 70
     0
102
RTVSPropertyOp10
 70
     0
102
RTVSPropertyOp11
 70
     0
102
RTVSPropertyOp12
 70
     0
102
RTVSPropertyOp13
 70
     0
102
RTVSPropertyOp14
 70
     2
102
RTVSPropertyOp15
 70
     0
102
RTVSPropertyOp16
 70
     0
102
RTVSPropertyOp17
 70
     0
102
RTVSPropertyOp18
 70
     0
102
RTVSPropertyOp19
 70
     0
102
RTVSPropertyOp20
 70
     0
102
RTVSPropertyOp21
 70
     0
102
RTVSPropertyOp22
 70
     0
102
RTVSPropertyOp23
 70
     0
102
RTVSPropertyOp24
 70
     0
102
RTVSPropertyOp25
 70
     0
102
RTVSPropertyOp26
 70
     0
102
RTVSPropertyOp27
 70
     0
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
31D
102
{ACAD_REACTORS
330
31C
102
}
330
31C
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
339
102
{ACAD_REACTORS
330
338
102
}
330
338
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
337
102
{ACAD_REACTORS
330
336
102
}
330
336
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
331
102
{ACAD_REACTORS
330
330
102
}
330
330
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
333
102
{ACAD_REACTORS
330
332
102
}
330
332
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
323
102
{ACAD_REACTORS
330
322
102
}
330
322
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
317
102
{ACAD_REACTORS
330
316
102
}
330
316
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
XRECORD
  5
335
102
{ACAD_REACTORS
330
334
102
}
330
334
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
102
RTVSPropertyOp0
 70
     1
102
RTVSPropertyOp1
 70
     1
102
RTVSPropertyOp2
 70
     1
102
RTVSPropertyOp3
 70
     1
102
RTVSPropertyOp4
 70
     1
102
RTVSPropertyOp5
 70
     1
102
RTVSPropertyOp6
 70
     1
102
RTVSPropertyOp7
 70
     1
102
RTVSPropertyOp8
 70
     1
102
RTVSPropertyOp9
 70
     1
102
RTVSPropertyOp10
 70
     1
102
RTVSPropertyOp11
 70
     1
102
RTVSPropertyOp12
 70
     1
102
RTVSPropertyOp13
 70
     1
102
RTVSPropertyOp14
 70
     1
102
RTVSPropertyOp15
 70
     1
102
RTVSPropertyOp16
 70
     1
102
RTVSPropertyOp17
 70
     1
102
RTVSPropertyOp18
 70
     1
102
RTVSPropertyOp19
 70
     1
102
RTVSPropertyOp20
 70
     1
102
RTVSPropertyOp21
 70
     1
102
RTVSPropertyOp22
 70
     1
102
RTVSPropertyOp23
 70
     1
102
RTVSPropertyOp24
 70
     1
102
RTVSPropertyOp25
 70
     1
102
RTVSPropertyOp26
 70
     1
102
RTVSPropertyOp27
 70
     1
102
RTVSPropertyOp28
 70
     1
102
RTVSPropertyOp29
 70
     1
102
RTVSPropertyOp30
 70
     1
102
RTVSPropertyOp31
 70
     1
102
RTVSPropertyOp32
 70
     1
102
RTVSPropertyOp33
 70
     1
102
RTVSPropertyOp34
 70
     1
102
RTVSPropertyOp35
 70
     1
102
RTVSPropertyOp36
 70
     1
102
RTVSPropertyOp37
 70
     1
102
RTVSPropertyOp38
 70
     1
102
RTVSPropertyOp39
 70
     1
102
RTVSPropertyOp40
 70
     1
102
RTVSPropertyOp41
 70
     1
102
RTVSPropertyOp42
 70
     1
102
RTVSPropertyOp43
 70
     1
102
RTVSPropertyOp44
 70
     1
102
RTVSPropertyOp45
 70
     1
102
RTVSPropertyOp46
 70
     1
102
RTVSPropertyOp47
 70
     1
102
RTVSPropertyOp48
 70
     1
102
RTVSPropertyOp49
 70
     1
102
RTVSPropertyOp50
 70
     1
102
RTVSPropertyOp51
 70
     0
102
RTVSPropertyOp52
 70
     0
102
RTVSPropertyOp53
 70
     1
102
RTVSPropertyOp54
 70
     1
102
RTVSPropertyOp55
 70
     1
102
RTVSPropertyOp56
 70
     1
102
RTVSPropertyOp57
 70
     1
102
RTVSPropertyOp58
 70
     1
102
RTVSPropertyOp59
 70
     1
102
RTVSPropertyOp60
 70
     1
102
RTVSPropertyOp61
 70
     1
102
RTVSPropertyOp62
 70
     1
  0
ENDSEC
  0
EOF
`;var jXe=`  0
SECTION
  2
HEADER
  9
$ACADVER
  1
AC1024
  9
$ACADMAINTVER
 70
   226
  9
$DWGCODEPAGE
  3
ANSI_936
  9
$LASTSAVEDBY
  1
win10
  9
$INSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$EXTMIN
 10
1.000000000000000E+20
 20
1.000000000000000E+20
 30
1.000000000000000E+20
  9
$EXTMAX
 10
-1.000000000000000E+20
 20
-1.000000000000000E+20
 30
-1.000000000000000E+20
  9
$LIMMIN
 10
0.0
 20
0.0
  9
$LIMMAX
 10
12.0
 20
9.0
  9
$ORTHOMODE
 70
     0
  9
$REGENMODE
 70
     1
  9
$FILLMODE
 70
     1
  9
$QTEXTMODE
 70
     0
  9
$MIRRTEXT
 70
     0
  9
$LTSCALE
 40
1.0
  9
$ATTMODE
 70
     1
  9
$TEXTSIZE
 40
0.2
  9
$TRACEWID
 40
0.05
  9
$TEXTSTYLE
  7
Standard
  9
$CLAYER
  8
0
  9
$CELTYPE
  6
ByLayer
  9
$CECOLOR
 62
   256
  9
$CELTSCALE
 40
1.0
  9
$DISPSILH
 70
     0
  9
$DIMSCALE
 40
1.0
  9
$DIMASZ
 40
0.18
  9
$DIMEXO
 40
0.0625
  9
$DIMDLI
 40
0.38
  9
$DIMRND
 40
0.0
  9
$DIMDLE
 40
0.0
  9
$DIMEXE
 40
0.18
  9
$DIMTP
 40
0.0
  9
$DIMTM
 40
0.0
  9
$DIMTXT
 40
0.18
  9
$DIMCEN
 40
0.09
  9
$DIMTSZ
 40
0.0
  9
$DIMTOL
 70
     0
  9
$DIMLIM
 70
     0
  9
$DIMTIH
 70
     1
  9
$DIMTOH
 70
     1
  9
$DIMSE1
 70
     0
  9
$DIMSE2
 70
     0
  9
$DIMTAD
 70
     0
  9
$DIMZIN
 70
     0
  9
$DIMBLK
  1

  9
$DIMASO
 70
     1
  9
$DIMSHO
 70
     1
  9
$DIMPOST
  1

  9
$DIMAPOST
  1

  9
$DIMALT
 70
     0
  9
$DIMALTD
 70
     2
  9
$DIMALTF
 40
25.4
  9
$DIMLFAC
 40
1.0
  9
$DIMTOFL
 70
     0
  9
$DIMTVP
 40
0.0
  9
$DIMTIX
 70
     0
  9
$DIMSOXD
 70
     0
  9
$DIMSAH
 70
     0
  9
$DIMBLK1
  1

  9
$DIMBLK2
  1

  9
$DIMSTYLE
  2
Standard
  9
$DIMCLRD
 70
     0
  9
$DIMCLRE
 70
     0
  9
$DIMCLRT
 70
     0
  9
$DIMTFAC
 40
1.0
  9
$DIMGAP
 40
0.09
  9
$DIMJUST
 70
     0
  9
$DIMSD1
 70
     0
  9
$DIMSD2
 70
     0
  9
$DIMTOLJ
 70
     1
  9
$DIMTZIN
 70
     0
  9
$DIMALTZ
 70
     0
  9
$DIMALTTZ
 70
     0
  9
$DIMUPT
 70
     0
  9
$DIMDEC
 70
     4
  9
$DIMTDEC
 70
     4
  9
$DIMALTU
 70
     2
  9
$DIMALTTD
 70
     2
  9
$DIMTXSTY
  7
Standard
  9
$DIMAUNIT
 70
     0
  9
$DIMADEC
 70
     0
  9
$DIMALTRND
 40
0.0
  9
$DIMAZIN
 70
     0
  9
$DIMDSEP
 70
    46
  9
$DIMATFIT
 70
     3
  9
$DIMFRAC
 70
     0
  9
$DIMLDRBLK
  1

  9
$DIMLUNIT
 70
     2
  9
$DIMLWD
 70
    -2
  9
$DIMLWE
 70
    -2
  9
$DIMTMOVE
 70
     0
  9
$DIMFXL
 40
1.0
  9
$DIMFXLON
 70
     0
  9
$DIMJOGANG
 40
0.7853981633974483
  9
$DIMTFILL
 70
     0
  9
$DIMTFILLCLR
 70
     0
  9
$DIMARCSYM
 70
     0
  9
$DIMLTYPE
  6

  9
$DIMLTEX1
  6

  9
$DIMLTEX2
  6

  9
$DIMTXTDIRECTION
 70
     0
  9
$LUNITS
 70
     2
  9
$LUPREC
 70
     4
  9
$SKETCHINC
 40
0.1
  9
$FILLETRAD
 40
0.0
  9
$AUNITS
 70
     0
  9
$AUPREC
 70
     0
  9
$MENU
  1
.
  9
$ELEVATION
 40
0.0
  9
$PELEVATION
 40
0.0
  9
$THICKNESS
 40
0.0
  9
$LIMCHECK
 70
     0
  9
$CHAMFERA
 40
0.0
  9
$CHAMFERB
 40
0.0
  9
$CHAMFERC
 40
0.0
  9
$CHAMFERD
 40
0.0
  9
$SKPOLY
 70
     0
  9
$TDCREATE
 40
2460560.605914352
  9
$TDUCREATE
 40
2460560.272581019
  9
$TDUPDATE
 40
2460560.629502315
  9
$TDUUPDATE
 40
2460560.296168982
  9
$TDINDWG
 40
0.0235879630
  9
$TDUSRTIMER
 40
0.0235879630
  9
$USRTIMER
 70
     1
  9
$ANGBASE
 50
0.0
  9
$ANGDIR
 70
     0
  9
$PDMODE
 70
     0
  9
$PDSIZE
 40
0.0
  9
$PLINEWID
 40
0.0
  9
$SPLFRAME
 70
     0
  9
$SPLINETYPE
 70
     6
  9
$SPLINESEGS
 70
     8
  9
$HANDSEED
  5
37C
  9
$SURFTAB1
 70
     6
  9
$SURFTAB2
 70
     6
  9
$SURFTYPE
 70
     6
  9
$SURFU
 70
     6
  9
$SURFV
 70
     6
  9
$UCSBASE
  2

  9
$UCSNAME
  2

  9
$UCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$UCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$UCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$UCSORTHOREF
  2

  9
$UCSORTHOVIEW
 70
     0
  9
$UCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSBASE
  2

  9
$PUCSNAME
  2

  9
$PUCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$PUCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$PUCSORTHOREF
  2

  9
$PUCSORTHOVIEW
 70
     0
  9
$PUCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$USERI1
 70
     0
  9
$USERI2
 70
     0
  9
$USERI3
 70
     0
  9
$USERI4
 70
     0
  9
$USERI5
 70
     0
  9
$USERR1
 40
0.0
  9
$USERR2
 40
0.0
  9
$USERR3
 40
0.0
  9
$USERR4
 40
0.0
  9
$USERR5
 40
0.0
  9
$WORLDVIEW
 70
     1
  9
$SHADEDGE
 70
     3
  9
$SHADEDIF
 70
    70
  9
$TILEMODE
 70
     1
  9
$MAXACTVP
 70
    64
  9
$PINSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMCHECK
 70
     0
  9
$PEXTMIN
 10
0.0
 20
0.0
 30
0.0
  9
$PEXTMAX
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMMIN
 10
0.0
 20
0.0
  9
$PLIMMAX
 10
12.0
 20
9.0
  9
$UNITMODE
 70
     0
  9
$VISRETAIN
 70
     1
  9
$PLINEGEN
 70
     0
  9
$PSLTSCALE
 70
     1
  9
$TREEDEPTH
 70
  3020
  9
$CMLSTYLE
  2
Standard
  9
$CMLJUST
 70
     0
  9
$CMLSCALE
 40
1.0
  9
$PROXYGRAPHICS
 70
     1
  9
$MEASUREMENT
 70
     0
  9
$CELWEIGHT
370
    -1
  9
$ENDCAPS
280
     0
  9
$JOINSTYLE
280
     0
  9
$LWDISPLAY
290
     0
  9
$INSUNITS
 70
     4
  9
$HYPERLINKBASE
  1

  9
$STYLESHEET
  1

  9
$XEDIT
290
     1
  9
$CEPSNTYPE
380
     0
  9
$PSTYLEMODE
290
     0
  9
$FINGERPRINTGUID
  2
{FA9A02B2-7E04-C34E-BD13-02980AC2B394}
  9
$VERSIONGUID
  2
{964EB223-33A2-D549-8684-CDE005EE773C}
  9
$EXTNAMES
290
     1
  9
$PSVPSCALE
 40
0.0
  9
$OLESTARTUP
290
     0
  9
$SORTENTS
280
   127
  9
$INDEXCTL
280
     0
  9
$HIDETEXT
280
     1
  9
$XCLIPFRAME
280
     2
  9
$HALOGAP
280
     0
  9
$OBSCOLOR
 70
   257
  9
$OBSLTYPE
280
     0
  9
$INTERSECTIONDISPLAY
280
     0
  9
$INTERSECTIONCOLOR
 70
   257
  9
$DIMASSOC
280
     2
  9
$PROJECTNAME
  1

  9
$CAMERADISPLAY
290
     0
  9
$LENSLENGTH
 40
50.0
  9
$CAMERAHEIGHT
 40
60.0
  9
$STEPSPERSEC
 40
2.0
  9
$STEPSIZE
 40
6.0
  9
$3DDWFPREC
 40
2.0
  9
$PSOLWIDTH
 40
0.25
  9
$PSOLHEIGHT
 40
4.0
  9
$LOFTANG1
 40
1.570796326794896
  9
$LOFTANG2
 40
1.570796326794896
  9
$LOFTMAG1
 40
0.0
  9
$LOFTMAG2
 40
0.0
  9
$LOFTPARAM
 70
     7
  9
$LOFTNORMALS
280
     1
  9
$LATITUDE
 40
37.795
  9
$LONGITUDE
 40
-122.394
  9
$NORTHDIRECTION
 40
0.0
  9
$TIMEZONE
 70
 -8000
  9
$LIGHTGLYPHDISPLAY
280
     1
  9
$TILEMODELIGHTSYNCH
280
     1
  9
$CMATERIAL
347
92
  9
$SOLIDHIST
280
     0
  9
$SHOWHIST
280
     1
  9
$DWFFRAME
280
     2
  9
$DGNFRAME
280
     0
  9
$REALWORLDSCALE
290
     1
  9
$INTERFERECOLOR
 62
     1
  9
$INTERFEREOBJVS
345
9F
  9
$INTERFEREVPVS
346
9C
  9
$CSHADOW
280
     0
  9
$SHADOWPLANELOCATION
 40
0.0
  0
ENDSEC
  0
SECTION
  2
CLASSES
  0
CLASS
  1
ACDBDICTIONARYWDFLT
  2
AcDbDictionaryWithDefault
  3
ObjectDBX Classes
 90
        0
 91
        1
280
     0
281
     0
  0
CLASS
  1
DICTIONARYVAR
  2
AcDbDictionaryVar
  3
ObjectDBX Classes
 90
        0
 91
       15
280
     0
281
     0
  0
CLASS
  1
MATERIAL
  2
AcDbMaterial
  3
ObjectDBX Classes
 90
     1153
 91
        3
280
     0
281
     0
  0
CLASS
  1
VISUALSTYLE
  2
AcDbVisualStyle
  3
ObjectDBX Classes
 90
     4095
 91
       24
280
     0
281
     0
  0
CLASS
  1
TABLESTYLE
  2
AcDbTableStyle
  3
ObjectDBX Classes
 90
     4095
 91
        1
280
     0
281
     0
  0
CLASS
  1
SCALE
  2
AcDbScale
  3
ObjectDBX Classes
 90
     1153
 91
       33
280
     0
281
     0
  0
CLASS
  1
MLEADERSTYLE
  2
AcDbMLeaderStyle
  3
ACDB_MLEADERSTYLE_CLASS
 90
     4095
 91
        2
280
     0
281
     0
  0
CLASS
  1
CELLSTYLEMAP
  2
AcDbCellStyleMap
  3
ObjectDBX Classes
 90
     1152
 91
        5
280
     0
281
     0
  0
CLASS
  1
EXACXREFPANELOBJECT
  2
ExAcXREFPanelObject
  3
EXAC_ESW
 90
     1025
 91
        0
280
     0
281
     0
  0
CLASS
  1
NPOCOLLECTION
  2
AcDbImpNonPersistentObjectsCollection
  3
ObjectDBX Classes
 90
     1153
 91
        0
280
     0
281
     0
  0
CLASS
  1
LAYER_INDEX
  2
AcDbLayerIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
SPATIAL_INDEX
  2
AcDbSpatialIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
IDBUFFER
  2
AcDbIdBuffer
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
ACDBSECTIONVIEWSTYLE
  2
AcDbSectionViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
CLASS
  1
ACDBDETAILVIEWSTYLE
  2
AcDbDetailViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
ENDSEC
  0
SECTION
  2
TABLES
  0
TABLE
  2
VPORT
  5
8
330
0
100
AcDbSymbolTable
 70
     1
  0
VPORT
  5
90
330
8
100
AcDbSymbolTableRecord
100
AcDbViewportTableRecord
  2
*Active
 70
     0
 10
0.0
 20
0.0
 11
1.0
 21
1.0
 12
97.5486911906951
 22
42.51345460271504
 13
0.0
 23
0.0
 14
0.5
 24
0.5
 15
0.5
 25
0.5
 16
0.0
 26
0.0
 36
1.0
 17
0.0
 27
0.0
 37
0.0
 40
78.45799938217576
 41
1.945409429280396
 42
50.0
 43
0.0
 44
0.0
 50
0.0
 51
0.0
 71
     0
 72
  1000
 73
     1
 74
     3
 75
     0
 76
     1
 77
     0
 78
     0
281
     0
 65
     1
110
0.0
120
0.0
130
0.0
111
1.0
121
0.0
131
0.0
112
0.0
122
1.0
132
0.0
 79
     0
146
0.0
348
9B
 60
     3
 61
     5
292
     1
282
     1
141
0.0
142
0.0
 63
   250
421
  3355443
1001
ACAD_NAV_VCDISPLAY
1070
     3
  0
ENDTAB
  0
TABLE
  2
LTYPE
  5
5
330
0
100
AcDbSymbolTable
 70
     1
  0
LTYPE
  5
14
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByBlock
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
15
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByLayer
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
16
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
Continuous
 70
     0
  3
Solid line
 72
    65
 73
     0
 40
0.0
  0
ENDTAB
  0
TABLE
  2
LAYER
  5
2
102
{ACAD_XDICTIONARY
360
18B
102
}
330
0
100
AcDbSymbolTable
 70
     1
  0
LAYER
  5
10
102
{ACAD_XDICTIONARY
360
E1
102
}
330
2
100
AcDbSymbolTableRecord
100
AcDbLayerTableRecord
  2
0
 70
     0
 62
     7
  6
Continuous
370
    -3
390
F
347
94
  0
ENDTAB
  0
TABLE
  2
STYLE
  5
3
330
0
100
AcDbSymbolTable
 70
     2
  0
STYLE
  5
11
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Standard
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
ACAD
1000
Arial
1071
       34
  0
STYLE
  5
D7
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD
1000
Arial
1071
       34
  0
ENDTAB
  0
TABLE
  2
VIEW
  5
6
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
UCS
  5
7
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
APPID
  5
9
330
0
100
AcDbSymbolTable
 70
     7
  0
APPID
  5
12
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD
 70
     0
  0
APPID
  5
D8
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnoPO
 70
     0
  0
APPID
  5
D9
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnotative
 70
     0
  0
APPID
  5
DA
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMJAG
 70
     0
  0
APPID
  5
DB
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMTALN
 70
     0
  0
APPID
  5
102
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_MLEADERVER
 70
     0
  0
APPID
  5
1A3
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_NAV_VCDISPLAY
 70
     0
  0
ENDTAB
  0
TABLE
  2
DIMSTYLE
  5
A
330
0
100
AcDbSymbolTable
 70
     2
100
AcDbDimStyleTable
 71
     2
340
DC
340
27
  0
DIMSTYLE
105
27
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Standard
 70
     0
340
11
  0
DIMSTYLE
105
DC
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
340
11
1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD_DSTYLE_DIMJAG
1070
   388
1040
1.5
1001
ACAD_DSTYLE_DIMTALN
1070
   392
1070
     0
  0
ENDTAB
  0
TABLE
  2
BLOCK_RECORD
  5
1
330
0
100
AcDbSymbolTable
 70
     1
  0
BLOCK_RECORD
  5
1F
102
{ACAD_XDICTIONARY
360
15A
102
}
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Model_Space
340
22
 70
     0
280
     1
281
     0
  0
BLOCK_RECORD
  5
73
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space
340
74
 70
     0
280
     1
281
     0
  0
BLOCK_RECORD
  5
78
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space0
340
79
 70
     0
280
     1
281
     0
  0
ENDTAB
  0
ENDSEC
  0
SECTION
  2
BLOCKS
  0
BLOCK
  5
20
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockBegin
  2
*Model_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Model_Space
  1

  0
ENDBLK
  5
21
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
75
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space
  1

  0
ENDBLK
  5
76
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
7A
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space0
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space0
  1

  0
ENDBLK
  5
7B
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
ENDSEC
  0
SECTION
  2
ENTITIES
  0
ENDSEC
  0
SECTION
  2
OBJECTS
  0
DICTIONARY
  5
C
330
0
100
AcDbDictionary
281
     1
  3
ACAD_CIP_PREVIOUS_PRODUCT_INFO
350
1A2
  3
ACAD_COLOR
350
6C
  3
ACAD_DETAILVIEWSTYLE
350
1A8
  3
ACAD_GROUP
350
D
  3
ACAD_LAYOUT
350
1A
  3
ACAD_MATERIAL
350
6B
  3
ACAD_MLEADERSTYLE
350
D2
  3
ACAD_MLINESTYLE
350
17
  3
ACAD_PLOTSETTINGS
350
19
  3
ACAD_PLOTSTYLENAME
350
E
  3
ACAD_SCALELIST
350
B1
  3
ACAD_SECTIONVIEWSTYLE
350
1A5
  3
ACAD_TABLESTYLE
350
A6
  3
ACAD_VISUALSTYLE
350
95
  3
ACDB_RECOMPOSE_DATA
350
33F
  3
AcDbVariableDictionary
350
59
  3
AcDsDecomposeData
350
345
  0
DICTIONARY
  5
18B
330
2
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_LAYERSTATES
360
18C
  0
DICTIONARY
  5
E1
330
10
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
15A
330
1F
100
AcDbDictionary
280
     1
281
     1
  0
XRECORD
  5
1A2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
300
ACD
300
2021
300

  0
DICTIONARY
  5
6C
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A8
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A9
  0
DICTIONARY
  5
D
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Model
350
22
  3
\u5E03\u5C401
350
74
  3
\u5E03\u5C402
350
79
  0
DICTIONARY
  5
6B
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
ByBlock
350
93
  3
ByLayer
350
92
  3
Global
350
94
  0
DICTIONARY
  5
D2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Annotative
350
E0
  3
Standard
350
D3
  0
DICTIONARY
  5
17
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
18
  0
DICTIONARY
  5
19
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
ACDBDICTIONARYWDFLT
  5
E
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Normal
350
F
100
AcDbDictionaryWithDefault
340
F
  0
DICTIONARY
  5
B1
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
A0
350
B2
  3
A1
350
124
  3
A2
350
125
  3
A3
350
126
  3
A4
350
127
  3
A5
350
128
  3
A6
350
129
  3
A7
350
12A
  3
A8
350
12B
  3
A9
350
12C
  3
B0
350
12D
  3
B1
350
12E
  3
B2
350
12F
  3
B3
350
130
  3
B4
350
131
  3
B5
350
132
  3
B6
350
133
  3
B7
350
134
  3
B8
350
135
  3
B9
350
136
  3
C0
350
137
  3
C1
350
138
  3
C2
350
139
  3
C3
350
13A
  3
C4
350
13B
  3
C5
350
13C
  3
C6
350
13D
  3
C7
350
13E
  3
C8
350
13F
  3
C9
350
140
  3
D0
350
141
  3
D1
350
142
  3
D2
350
143
  0
DICTIONARY
  5
1A5
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A7
  0
DICTIONARY
  5
A6
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
A7
  0
DICTIONARY
  5
95
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
2dWireframe
350
9B
  3
Basic
350
9A
  3
Brighten
350
A1
  3
ColorChange
350
A5
  3
Conceptual
350
9E
  3
Dim
350
A0
  3
EdgeColorOff
350
172
  3
Facepattern
350
A4
  3
Flat
350
96
  3
FlatWithEdges
350
97
  3
Gouraud
350
98
  3
GouraudWithEdges
350
99
  3
Hidden
350
9D
  3
JitterOff
350
170
  3
Linepattern
350
A3
  3
OverhangOff
350
171
  3
Realistic
350
9F
  3
Shaded
350
17F
  3
Shaded with edges
350
17E
  3
Shades of Gray
350
17B
  3
Sketchy
350
17C
  3
Thicken
350
A2
  3
Wireframe
350
9C
  3
X-Ray
350
17D
  0
XRECORD
  5
33F
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
 90
        1
330
A7
  0
DICTIONARY
  5
59
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
CAMERAHEIGHT
350
227
  3
CANNOSCALE
350
EB
  3
CMLEADERSTYLE
350
EA
  3
CTABLESTYLE
350
AB
  3
CVIEWDETAILSTYLE
350
1B4
  3
CVIEWSECTIONSTYLE
350
1B5
  3
DIMASSOC
350
5A
  3
HIDETEXT
350
5E
  3
INDEXCTL
350
226
  3
LAYEREVAL
350
14A
  3
LAYERNOTIFY
350
14B
  3
LIGHTINGUNITS
350
224
  3
MSLTSCALE
350
223
  3
SORTENTS
350
225
  3
XCLIPFRAME
350
228
  0
DICTIONARY
  5
345
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
AcDsRecords
350
347
  3
AcDsSchemas
350
346
1001
ACAD
1070
     2
  0
DICTIONARY
  5
18C
102
{ACAD_REACTORS
330
18B
102
}
330
18B
100
AcDbDictionary
281
     1
  0
ACDBDETAILVIEWSTYLE
  5
1A9
102
{ACAD_XDICTIONARY
360
37A
102
}
102
{ACAD_REACTORS
330
1A8
102
}
330
1A8
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
100
AcDbDetailViewStyle
 70
     0
 71
     0
 90
        3
 71
     1
340
11
 62
   256
 40
0.24
340
0
 62
   256
 40
0.24
300

 40
0.36
280
     3
 71
     2
340
16
 90
       25
 62
   256
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewDetailId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
340
16
 90
       25
 62
   256
340
16
 90
       25
 62
   256
280
     0
  0
LAYOUT
  5
22
102
{ACAD_XDICTIONARY
360
191
102
}
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
none_device
  4
Letter_(8.50_x_11.00_Inches)
  6

 40
6.349999904632568
 41
6.349999904632568
 42
6.350006103515625
 43
6.350006103515625
 44
215.8999938964844
 45
279.3999938964844
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
3.560208697428376
 70
 11952
 72
     0
 73
     1
 74
     0
  7

 75
     0
147
0.28088241027059
 76
     0
 77
     2
 78
   300
148
0.1311165230791651
149
0.096403374003771
100
AcDbLayout
  1
Model
 70
     1
 71
     0
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
1F
331
90
  0
LAYOUT
  5
74
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\u5E03\u5C401
 70
     1
 71
     1
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
73
  0
LAYOUT
  5
79
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\u5E03\u5C402
 70
     1
 71
     2
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
78
  0
MATERIAL
  5
93
102
{ACAD_XDICTIONARY
360
185
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByBlock
 94
       63
  0
MATERIAL
  5
92
102
{ACAD_XDICTIONARY
360
183
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByLayer
 94
       63
  0
MATERIAL
  5
94
102
{ACAD_XDICTIONARY
360
10B
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
Global
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
 94
       63
1001
ACAD
1070
    -1
1070
     3
1070
     0
1000

1071
        0
1070
     0
  0
MLEADERSTYLE
  5
E0
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
179
     2
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     1
143
0.125
271
     0
272
     9
273
     9
  0
MLEADERSTYLE
  5
D3
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
179
     2
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     0
143
0.125
271
     0
272
     9
273
     9
  0
MLINESTYLE
  5
18
102
{ACAD_REACTORS
330
17
102
}
330
17
100
AcDbMlineStyle
  2
STANDARD
 70
     0
  3

 62
   256
 51
90.0
 52
90.0
 71
     2
 49
0.5
 62
   256
  6
BYLAYER
 49
-0.5
 62
   256
  6
BYLAYER
  0
ACDBPLACEHOLDER
  5
F
102
{ACAD_REACTORS
330
E
102
}
330
E
  0
SCALE
  5
B2
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:1
140
1.0
141
1.0
290
     1
  0
SCALE
  5
124
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:2
140
1.0
141
2.0
290
     0
  0
SCALE
  5
125
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:4
140
1.0
141
4.0
290
     0
  0
SCALE
  5
126
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:5
140
1.0
141
5.0
290
     0
  0
SCALE
  5
127
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:8
140
1.0
141
8.0
290
     0
  0
SCALE
  5
128
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:10
140
1.0
141
10.0
290
     0
  0
SCALE
  5
129
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:16
140
1.0
141
16.0
290
     0
  0
SCALE
  5
12A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:20
140
1.0
141
20.0
290
     0
  0
SCALE
  5
12B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:30
140
1.0
141
30.0
290
     0
  0
SCALE
  5
12C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:40
140
1.0
141
40.0
290
     0
  0
SCALE
  5
12D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:50
140
1.0
141
50.0
290
     0
  0
SCALE
  5
12E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:100
140
1.0
141
100.0
290
     0
  0
SCALE
  5
12F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
2:1
140
2.0
141
1.0
290
     0
  0
SCALE
  5
130
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
4:1
140
4.0
141
1.0
290
     0
  0
SCALE
  5
131
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
8:1
140
8.0
141
1.0
290
     0
  0
SCALE
  5
132
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
10:1
140
10.0
141
1.0
290
     0
  0
SCALE
  5
133
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
100:1
140
100.0
141
1.0
290
     0
  0
SCALE
  5
134
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/128" = 1'-0"
140
0.0078125
141
12.0
290
     0
  0
SCALE
  5
135
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/64" = 1'-0"
140
0.015625
141
12.0
290
     0
  0
SCALE
  5
136
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/32" = 1'-0"
140
0.03125
141
12.0
290
     0
  0
SCALE
  5
137
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/16" = 1'-0"
140
0.0625
141
12.0
290
     0
  0
SCALE
  5
138
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/32" = 1'-0"
140
0.09375
141
12.0
290
     0
  0
SCALE
  5
139
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/8" = 1'-0"
140
0.125
141
12.0
290
     0
  0
SCALE
  5
13A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/16" = 1'-0"
140
0.1875
141
12.0
290
     0
  0
SCALE
  5
13B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/4" = 1'-0"
140
0.25
141
12.0
290
     0
  0
SCALE
  5
13C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/8" = 1'-0"
140
0.375
141
12.0
290
     0
  0
SCALE
  5
13D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/2" = 1'-0"
140
0.5
141
12.0
290
     0
  0
SCALE
  5
13E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/4" = 1'-0"
140
0.75
141
12.0
290
     0
  0
SCALE
  5
13F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1" = 1'-0"
140
1.0
141
12.0
290
     0
  0
SCALE
  5
140
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1-1/2" = 1'-0"
140
1.5
141
12.0
290
     0
  0
SCALE
  5
141
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3" = 1'-0"
140
3.0
141
12.0
290
     0
  0
SCALE
  5
142
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
6" = 1'-0"
140
6.0
141
12.0
290
     0
  0
SCALE
  5
143
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1'-0" = 1'-0"
140
12.0
141
12.0
290
     0
  0
ACDBSECTIONVIEWSTYLE
  5
1A7
102
{ACAD_XDICTIONARY
360
378
102
}
102
{ACAD_REACTORS
330
1A5
102
}
330
1A5
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
100
AcDbSectionViewStyle
 70
     0
 71
     0
 90
       78
 71
     1
340
11
 62
   256
 40
0.24
340
0
340
0
 62
   256
 40
0.24
300
I, O, Q, S, X, Z
 40
0.48
 90
        3
 40
0.18
 90
        1
 71
     2
340
16
 90
       25
 62
   256
340
16
 90
       50
 62
   256
 40
0.24
 40
0.0
 40
0.24
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewSectionStartId>%-%<\\AcVar ViewSectionEndId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
 62
   256
 62
   257
300
ANSI31
 40
1.0
 90
        0
290
     0
290
     0
 90
        6
 40
0.0
 40
1.570796326794896
 40
0.2617993877991494
 40
1.308996938995747
 40
-0.2617993877991494
 40
1.832595714594046
  0
TABLESTYLE
  5
A7
102
{ACAD_XDICTIONARY
360
FF
102
}
102
{ACAD_REACTORS
330
A6
102
}
330
A6
100
AcDbTableStyle
280
     0
  3
Standard
 70
     0
 71
     0
 40
0.06
 41
0.06
280
     0
281
     0
  7
Standard
140
0.18
170
     2
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.25
170
     5
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.18
170
     5
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  0
VISUALSTYLE
  5
9B
102
{ACAD_XDICTIONARY
360
352
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
2dWireframe
 70
     4
177
     2
291
     0
 71
     0
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        0
176
     1
 66
   257
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9A
102
{ACAD_XDICTIONARY
360
350
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Basic
 70
     7
177
     2
291
     1
 71
     1
176
     1
 72
     0
176
     1
 73
     1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     0
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A1
102
{ACAD_XDICTIONARY
360
35E
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Brighten
 70
    12
177
     2
291
     1
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
50.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A5
102
{ACAD_XDICTIONARY
360
366
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
ColorChange
 70
    16
177
     2
291
     1
 71
     2
176
     1
 72
     2
176
     1
 73
     3
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     8
421
  8421504
176
     1
 74
     1
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
     8
424
  8421504
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9E
102
{ACAD_XDICTIONARY
360
358
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Conceptual
 70
     9
177
     2
291
     0
 71
     3
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     2
176
     1
 91
        2
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
40.0
176
     1
 92
        8
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     3
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A0
102
{ACAD_XDICTIONARY
360
35C
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Dim
 70
    11
177
     2
291
     1
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
-50.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
172
102
{ACAD_XDICTIONARY
360
36C
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
EdgeColorOff
 70
    22
177
     2
291
     1
 71
     2
176
     0
 72
     2
176
     0
 73
     0
176
     0
 90
        0
176
     0
 40
0.6
176
     0
 41
30.0
176
     0
 63
     7
421
 16777215
176
     0
 74
     1
176
     0
 91
        4
176
     0
 64
     7
176
     0
 65
   257
176
     0
 75
     1
176
     0
175
     1
176
     0
 42
1.0
176
     0
 92
        8
176
     2
 66
     7
176
     0
 43
1.0
176
     0
 76
     1
176
     0
 77
     6
176
     0
 78
     2
176
     0
 67
     7
176
     0
 79
     5
176
     0
170
     0
176
     0
171
     0
176
     0
290
     0
176
     0
 93
        1
176
     0
 44
0.0
176
     0
173
     0
176
     0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A4
102
{ACAD_XDICTIONARY
360
364
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Facepattern
 70
    15
177
     2
291
     1
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
96
102
{ACAD_XDICTIONARY
360
348
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Flat
 70
     0
177
     2
291
     1
 71
     2
176
     1
 72
     1
176
     1
 73
     1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     0
176
     1
 91
        0
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
       13
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
97
102
{ACAD_XDICTIONARY
360
34A
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
FlatWithEdges
 70
     1
177
     2
291
     1
 71
     2
176
     1
 72
     1
176
     1
 73
     1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        0
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        0
176
     1
 66
   257
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
       13
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
98
102
{ACAD_XDICTIONARY
360
34C
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Gouraud
 70
     2
177
     2
291
     1
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     0
176
     1
 91
        0
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        0
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
       13
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
99
102
{ACAD_XDICTIONARY
360
34E
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
GouraudWithEdges
 70
     3
177
     2
291
     1
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        0
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        0
176
     1
 66
   257
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
       13
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9D
102
{ACAD_XDICTIONARY
360
356
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Hidden
 70
     6
177
     2
291
     0
 71
     1
176
     1
 72
     2
176
     1
 73
     2
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     2
176
     1
 91
        2
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     2
176
     1
175
     1
176
     1
 42
40.0
176
     1
 92
        0
176
     1
 66
   257
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     3
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
170
102
{ACAD_XDICTIONARY
360
368
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
JitterOff
 70
    20
177
     2
291
     1
 71
     2
176
     0
 72
     2
176
     0
 73
     0
176
     0
 90
        0
176
     0
 40
0.6
176
     0
 41
30.0
176
     0
 63
     7
421
 16777215
176
     0
 74
     1
176
     0
 91
        4
176
     0
 64
     7
176
     0
 65
   257
176
     0
 75
     1
176
     0
175
     1
176
     0
 42
1.0
176
     0
 92
       10
176
     2
 66
     7
176
     0
 43
1.0
176
     0
 76
     1
176
     0
 77
     6
176
     0
 78
     2
176
     0
 67
     7
176
     0
 79
     5
176
     0
170
     0
176
     0
171
     0
176
     0
290
     0
176
     0
 93
        1
176
     0
 44
0.0
176
     0
173
     0
176
     0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A3
102
{ACAD_XDICTIONARY
360
362
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Linepattern
 70
    14
177
     2
291
     1
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     7
176
     1
175
     7
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
171
102
{ACAD_XDICTIONARY
360
36A
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
OverhangOff
 70
    21
177
     2
291
     1
 71
     2
176
     0
 72
     2
176
     0
 73
     0
176
     0
 90
        0
176
     0
 40
0.6
176
     0
 41
30.0
176
     0
 63
     7
421
 16777215
176
     0
 74
     1
176
     0
 91
        4
176
     0
 64
     7
176
     0
 65
   257
176
     0
 75
     1
176
     0
175
     1
176
     0
 42
1.0
176
     0
 92
        9
176
     2
 66
     7
176
     0
 43
1.0
176
     0
 76
     1
176
     0
 77
     6
176
     0
 78
     2
176
     0
 67
     7
176
     0
 79
     5
176
     0
170
     0
176
     0
171
     0
176
     0
290
     0
176
     0
 93
        1
176
     0
 44
0.0
176
     0
173
     0
176
     0
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9F
102
{ACAD_XDICTIONARY
360
35A
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Realistic
 70
     8
177
     2
291
     0
 71
     2
176
     1
 72
     3
176
     1
 73
     0
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     0
176
     1
 91
        0
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
   257
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     3
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
       13
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17F
102
{ACAD_XDICTIONARY
360
376
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded
 70
    27
177
     2
291
     0
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     0
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
   257
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     8
425
  7895160
176
     1
 79
     3
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        5
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17E
102
{ACAD_XDICTIONARY
360
374
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded with edges
 70
    26
177
     2
291
     0
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        2
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     2
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
   257
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     3
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        5
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17B
102
{ACAD_XDICTIONARY
360
36E
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shades of Gray
 70
    23
177
     2
291
     0
 71
     2
176
     1
 72
     2
176
     1
 73
     3
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     2
176
     1
 91
        2
176
     1
 64
     7
176
     1
 65
     7
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
40.0
176
     1
 92
        8
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     3
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17C
102
{ACAD_XDICTIONARY
360
370
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Sketchy
 70
    24
177
     2
291
     0
 71
     1
176
     1
 72
     2
176
     1
 73
     2
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     2
176
     1
 91
        2
176
     1
 64
     7
176
     1
 65
     7
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
40.0
176
     1
 92
       11
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     6
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A2
102
{ACAD_XDICTIONARY
360
360
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Thicken
 70
    13
177
     2
291
     1
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
       12
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     5
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9C
102
{ACAD_XDICTIONARY
360
354
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Wireframe
 70
     5
177
     2
291
     0
 71
     0
176
     1
 72
     2
176
     1
 73
     0
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        4
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        0
176
     1
 66
   257
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     3
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
        1
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17D
102
{ACAD_XDICTIONARY
360
372
102
}
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
X-Ray
 70
    25
177
     2
291
     0
 71
     2
176
     1
 72
     2
176
     1
 73
     1
176
     1
 90
        1
176
     1
 40
0.5
176
     1
 41
30.0
176
     1
 63
     7
421
 16777215
176
     1
 74
     1
176
     1
 91
        0
176
     1
 64
     7
176
     1
 65
   257
176
     1
 75
     1
176
     1
175
     1
176
     1
 42
1.0
176
     1
 92
        8
176
     1
 66
     7
176
     1
 43
1.0
176
     1
 76
     1
176
     1
 77
     6
176
     1
 78
     2
176
     1
 67
     7
176
     1
 79
     3
176
     1
170
     0
176
     1
171
     0
176
     1
290
     0
176
     1
 93
       13
176
     1
 44
0.0
176
     1
173
     0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
DICTIONARYVAR
  5
227
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
60.000000
  0
DICTIONARYVAR
  5
EB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1:1
  0
DICTIONARYVAR
  5
EA
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
AB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
1B4
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
1B5
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
5A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
5E
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
226
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14B
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
224
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
223
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
225
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
127
  0
DICTIONARYVAR
  5
228
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARY
  5
347
102
{ACAD_REACTORS
330
345
102
}
330
345
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
346
102
{ACAD_REACTORS
330
345
102
}
330
345
100
AcDbDictionary
281
     1
  3
1654967914112
350
340
  3
1654967914128
350
341
  3
1654967914144
350
342
  3
1654967914160
350
343
  3
1654967914176
350
344
  0
DICTIONARY
  5
37A
330
1A9
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
37B
  0
DICTIONARY
  5
191
330
22
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
185
330
93
100
AcDbDictionary
280
     1
281
     1
  3
FBXASSET
360
186
  0
DICTIONARY
  5
183
330
92
100
AcDbDictionary
280
     1
281
     1
  3
FBXASSET
360
184
  0
DICTIONARY
  5
10B
330
94
100
AcDbDictionary
280
     1
281
     1
  3
BUMPTILE
360
10D
  3
DIFFUSETILE
360
10C
  3
FBXASSET
360
187
  3
OPACITYTILE
360
10E
  3
REFLECTIONTILE
360
10F
  0
DICTIONARY
  5
378
330
1A7
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
379
  0
DICTIONARY
  5
FF
330
A7
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_ROUNDTRIP_2008_TABLESTYLE_CELLSTYLEMAP
360
33E
  0
DICTIONARY
  5
352
330
9B
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
353
  0
DICTIONARY
  5
350
330
9A
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
351
  0
DICTIONARY
  5
35E
330
A1
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
35F
  0
DICTIONARY
  5
366
330
A5
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
367
  0
DICTIONARY
  5
358
330
9E
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
359
  0
DICTIONARY
  5
35C
330
A0
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
35D
  0
DICTIONARY
  5
36C
330
172
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
36D
  0
DICTIONARY
  5
364
330
A4
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
365
  0
DICTIONARY
  5
348
330
96
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
349
  0
DICTIONARY
  5
34A
330
97
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
34B
  0
DICTIONARY
  5
34C
330
98
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
34D
  0
DICTIONARY
  5
34E
330
99
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
34F
  0
DICTIONARY
  5
356
330
9D
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
357
  0
DICTIONARY
  5
368
330
170
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
369
  0
DICTIONARY
  5
362
330
A3
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
363
  0
DICTIONARY
  5
36A
330
171
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
36B
  0
DICTIONARY
  5
35A
330
9F
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
35B
  0
DICTIONARY
  5
376
330
17F
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
377
  0
DICTIONARY
  5
374
330
17E
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
375
  0
DICTIONARY
  5
36E
330
17B
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
36F
  0
DICTIONARY
  5
370
330
17C
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
371
  0
DICTIONARY
  5
360
330
A2
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
361
  0
DICTIONARY
  5
354
330
9C
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
355
  0
DICTIONARY
  5
372
330
17D
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
373
  0
XRECORD
  5
340
102
{ACAD_REACTORS
330
346
102
}
330
346
100
AcDbXrecord
280
     1
  1
AcDb_Thumbnail_Schema
102
{ATTRRECORD
341
341
  2
AcDbDs::TreatedAsObjectData
280
     1
291
     1
102
ATTRRECORD}
102
{ATTRRECORD
341
342
  2
AcDbDs::Legacy
280
     1
291
     1
102
ATTRRECORD}
  2
AcDbDs::ID
280
    10
 91
        8
102
{ATTRRECORD
341
343
  2
AcDs:Indexable
280
     1
291
     1
102
ATTRRECORD}
102
{ATTRRECORD
341
344
  2
AcDbDs::HandleAttribute
280
     7
282
     1
102
ATTRRECORD}
  2
Thumbnail_Data
280
    15
 91
        0
  0
XRECORD
  5
341
102
{ACAD_REACTORS
330
346
102
}
330
346
100
AcDbXrecord
280
     1
  1
AcDbDs::TreatedAsObjectDataSchema
  2
AcDbDs::TreatedAsObjectData
280
     1
 91
        0
  0
XRECORD
  5
342
102
{ACAD_REACTORS
330
346
102
}
330
346
100
AcDbXrecord
280
     1
  1
AcDbDs::LegacySchema
  2
AcDbDs::Legacy
280
     1
 91
        0
  0
XRECORD
  5
343
102
{ACAD_REACTORS
330
346
102
}
330
346
100
AcDbXrecord
280
     1
  1
AcDbDs::IndexedPropertySchema
  2
AcDs:Indexable
280
     1
 91
        0
  0
XRECORD
  5
344
102
{ACAD_REACTORS
330
346
102
}
330
346
100
AcDbXrecord
280
     1
  1
AcDbDs::HandleAttributeSchema
  2
AcDbDs::HandleAttribute
280
     7
 91
        1
284
     1
  0
XRECORD
  5
37B
102
{ACAD_REACTORS
330
37A
102
}
330
37A
100
AcDbXrecord
280
     1
102
DISPLAYNAME
  1
Imperial24
102
FLAGS
 90
        0
  0
XRECORD
  5
186
102
{ACAD_REACTORS
330
185
102
}
330
185
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
7581DE8E-A623-425F-9BF4-B3F4BE6C4F9A
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623B9A2F3B5FEC0000007C01000008000000636F72652E786D6C8D90416E83301045AF62CDB632D8040820E328B4E204BD80653BC44AB011B6AB1EBF262152BBEB6A467FFE9B197D76FA9EEFE84BAFDE38DB03CD08206DA553C64E3DC470C10DA01367AB73E1970D9015B3EE61
310
9381B3697571D925E96CD03624D53AA5775178AF0320794F4D0F5E5EF52C32114372F85BB608791393CEE8AB4B708C46A1E711A3D23E73317A055E0D4D53D6C71A9FC7A1C6657D18703354232ECFED4731B6B43CBED72CDF60CE82995FF7E5AA45D00A7841488B29C5A4F8A46547AAAEA8DE48D311C2F2CDFE078A8BFA2714
310
8D0D87627FF78979E0343DF21870966F59A4F2082AD52D37FE03504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623B6E137E0172010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C0810121947A1554ED00B38E05014B091B1518EDFE511A5A9D22AFD2A1F60CDEC7A67C698ED2E6D8306
310
69FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7166B4B65FCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B0FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2601EE7691A25EBC4DB1FF2C48B9255EEA5797C
310
F0A2FDE62D3C6C8268FD9A3032367366EBF6AAAE30525859621E52BAF182C0A3E17B106D69BC0DE3179A6E2965642CBF6B725DF96493AB955D858BDCB9ADC73C002113F1CD2D4464512F06D04338236388F09912BE0F1A028190AD3836571F67800659586D22604AED6ED4201A27612AF5E9F4A09F178CCC9D3075DA1C5C3F
310
9C113E3DE3F71DE1A885AAC084B0B03C3A3BEA64B38625B44E1A6FB017A4B46945F39C8D5F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F02504B0304140006080800AC70623BE001BAC07D0000009D0000000B0000006662782F636E782E786D6C4DCCD10AC2201886E15B91FFDCA6536B037548D87D8CE686
310
E4344CA3CB6F8B1D74F4C1C3C72B87CF1AD0DBE5974F51013D11402EDED3E4E3A2A096197780062D734AE5EF06288EAB53B03368B9E4549F074D6E1E6B289B061F1F07124689687987B9601C7373BD60C36E065B6A6DDF7341A93843A365F32B6DBB87F517504B0304140006080800AC70623B8E5068122901000012020000
310
310000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C8D515B6EC32010BC0AE22B55850D364E93081345557A825E801892A2C460F1A872FC2EB523B57FF961D1EECCECECAED8DFC71BFA36215AEF7ACC2A8A917183D7D65D7A9CD3996C30DA4B
310
11BC4F7F601839359A1E973496E2127C9E96D4E05D322E41D6796D96A48AD1248C861B7C7A1C872F33AA4AE5048878AD26355CD5C554AC8232E0A4882980013437292F96B465B46BF886F0AEE5841FDEDFC8A1FD3890233B1EB75BDE31D6AD453D13A5C8D9EA856E35D8B1676BC2B322852C45B2E3C3FE108C4A4663D950BA
310
258C11DA7C32BEA3DDAEE95EE96647A9A80BFC1F294FFA4952B62EB5CD6277A6452C99A8E78214DAE7D3ED61C6DC271F122AFD56D10C2F305545CB6A60FC1908E383E29A2F8A31F900EB5D5D4F8065DD2CBBE652D4E542107ECF07B15C53FE00504B0304140006080800AC70623B503B51794E010000330300003000000066
310
62782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F
310
77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347
310
DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F
310
504B0304140006080800AC70623B38FA165F680500003C100000340000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F6F626A656374732E786D6CAD575D6FA33814FD2B887D0E8424EDB42BCAA8499A2A1A756634D18CF6A15264C0A16CC146B6E9A4FBEBF7180C
310
019276B21F7908D8D8F7F3DCE36BFFE33ECFAC172A64CAD98DED3963DBA22CE271CA921BBB54BBD1956D7D0C7CC1B9EA2CB32D46727A63EB693BF013C1CBC24CC57447CA4C0D6657F33F2C1951466D2BCA889437B68C9E684E1C522A1E53F9ECC4441127D9ED1DCFA917F6C52682144F03A105119429588A790629566D94D7
310
1F8E6D37F05DFD3DF0F5BF59357D7B955BF9D3D79F32A9088B8E940DC44CBDD9F26E72713DBA98CDA6A3D9E5C41BCD57F3E5C8FB301D2F2E178BEBDBBB6B28964A4092B144D09D1DDC2336228D7CB7FED45A6C0C3F6552C419A351E53F3CAC6C3612635A5016238F2995D0D6F17ADC1F7A3A369DCF533D362ABBD3E779D5DD
310
D111D4D8DE3CBB96F2F04FB820CF41859054A3AA8E8F71B4C6DFF810B590F3CC7C4BA5951345454A322B4B4341C4AB1D60A95E12F83D311A9D42235C7B6007DE415ED75694C6AFB17BCACA5D99651A9A7650217B0BFC53252BCBD2BFA838AD0D36215765CAD4957148BD16D40EAE7DB79A0C7CFD984ECCC73A90D62E230952
310
0E37EBAF034717BAF6D64B3BF8B40AF71B5D8FA79517821754280D1F40AB495CF3D451326ABDB332A737C0995ECC0F41F986C87F46F91E4C41DE44BA9FED67468B1284C91D173972E38CAB9F356E5E46EDDBF10BF86CB0FA784D3BF3AF16FB6E6B6C9F30DECA1FC0A55373F5DFF3D78F5917A99DF405FE0B0A8C8BA909E526
310
2219A8E72165488806A595714C81CB77E1DE0ED6604A303B76912C680372F4E2BB2FF88EFF5A36D8AA52DF79322474C0B767303F625995056C7B032C473C592936CEBD15F38BFFA5666E979B4F9B52EC48441F0CB12CE92E65A9C2D979006FD7A05E227A1E3DD3D79F5CC470F438099B6E1272A34A22DA3AE63AF0497358E8
310
C141734F41847D09D79CE7FF42C3432A239A6584515E365ADA634863B52519D327A00AEB804E2703140BFA92EA4EA2B7A26716CEFA48A4850E597BE8B53CEDBCE1CBF7F56780D20EE6AF73A0F5F9B02A3CD07DC4332EB6E1EBB666421BE0C39E3EBA7FF4E16D22EA6A29407C85E586724C88B771BADB9512BC7B228A3FD68B
310
6EA65A22397E690AA8D158D7E40CEC8CDA23C2C0B7D1898640101CEC9C6D531CE328CB93CABBBA870A6425F70DF96199175B92F392A973C2346EFC69AC6F8577BB18F993A8E8C90E36D573340765C7343EA4AA87027D049DF0A9979E0F1757DEF2EEEA6E747B39412B35B9588DAEE7ABD9683E5DCDE677978BD9EAFAB6B5A8
310
B224F09B13AA5B8388264E44BF14A909F3F7F5A16CEDE08128E9DED705E526F5F3FBDA415BECBBD80380B71BD77991D19C3245347C1FF44BF68DA0ABE8C9A8E7D73949E81952BEDC6F063660E68C7D5F75A9D19F83BD6676A16BE1A410F554E621236936D8681C770A9618B79B50B6CF9AD19BA11E9978A20F953C4B63104E
310
6C2594E7548176CE607B915309C474BBF2D8DC1ECED8FD52F7838A84196D2C79226889330954036E65A4FAF3D66F68E174177563E3B0739EF1670AD1B690EA1B1BFCA6D2884A27C4F1A81B9F4A3820802EAC2541408DB02443675D6F6AC7ED2E1D1BD00F4E40A3BF5D724EB764FCEA116F4E8A02A7768F562BDB8C82E81F39
310
DE98631185D7B054AD2F8789D6994A0D2AAB76CADC0DD0423C1BD57BD4D7FB6E794EB5A61791B3EE49EF82A0963A524424D5BD40DB674CBA5D7E75D10A58EB2F569195097279BEA491A00073A90B1C28022A8CCC82284075F1FBE357C17117CDAD550A083C2E789E736606B7E62E6B6D9E70338D1F410B545F3FE464EC798F
310
55D76F2E22DB9048EA90583E63A22938EDC1006B00E4D1716A52E0EA1C0C96AF9796393066105A81F6A829ADAFE1168A47DF1C75A974C9B278B7F177ABA5008340CB1EFC0D504B0304140006080000AC70623B000000000000000000000000350000006662782F30333130353234382D343533342D344143372D413346412D
310
4531454539393435313135362F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E636660600000504B0304140006080000AC70
310
623B000000000000000000000000370000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30333130353234382D343533342D344143372D41
310
3346412D4531454539393435313135362F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11D
310
E607FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BF2C5666EFF000000A00100003B0000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F7265736F7572636573
310
2F636F72652E786D6C8D504B6E833010BD0A9A6D65B00910888CA3D02A27E8052C33A156821DF953F5F8B5132AB5BB6E6646EFA3797AFCF8B5DE8A4F745E5B33022B291468949DB5594688E1427A288E823B6BC32F191446AE38428641F0C5D978DF20654D4013126AEC8C1B28BDC70085BAA56304AF3E7095A58C2129FCB5
310
BC4B75950B96AC4C74D209EE834B018AE7933C4138F4363A859E574F56F018F5BC69F49C7EEA8B4607A29DFABEE9F62D399DA78E34DD6E22FDD49E49731ADEEAF3C09AFD6BC7AB6C163CE8F527A3722803CE206A4A07C218A1F53B6B0EB43DD4ED0BED0F94F22ACBFF98E27DFEA7296A1376F516F769F320580AF22004AF72
310
5F693DCA4C3B772BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B200
310
00005B436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623B9A2F3B5FEC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D
310
6C504B01021400140006080800AC70623B6E137E0172010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623BE001BAC07D0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B010214001400060808
310
00AC70623B8E506812290100001202000031000000000000000000000000005B0500006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D3
310
0600006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6C504B01021400140006080800AC70623B38FA165F680500003C10000034000000000000000000000000006F0800006662782F30333130353234382D343533342D344143372D413346412D4531
310
454539393435313135362F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000290E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F76657274696365732E62696E504B01021400
310
140006080800AC70623BF270F133060000000400000036000000000000000000000000007C0E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000
310
000000000000000000D60E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD1900000004101000036000000000000000000000000002B0F00006662782F30333130353234382D
310
343533342D344143372D413346412D4531454539393435313135362F6469726563746F72792E786D6C504B01021400140006080800AC70623BF2C5666EFF000000A00100003B000000000000000000000000000F1000006662782F30333130353234382D343533342D344143372D413346412D453145453939343531313536
310
2F7265736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000671100000000
  0
XRECORD
  5
184
102
{ACAD_REACTORS
330
183
102
}
330
183
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
778E3A9F-1AF3-452F-85C1-1BC15BD3F630
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BFD5588D4EC0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103891DC7C24471939CA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EF81EEFE8CBCCC17AD7012D0820E394D7D60D1DA478C50DA083E0B3F7F1970D9093A3E960
310
9141F061F6695A25E55D342E66D5796D56518660222075CF4D07417D9A511632C5EC08B76292EA260753D05797E194AC46CF2356E77DF66ACD0C62C768BD63971E5727D2E06DDF9C71BF7B3FE10BABF79BFA488FE4DCF07281058F767CDD57B391D168108C903DA61413F641B72DA95A56BD91A62584978BFD0F9426FD4F28
310
5917376C7DF7890510343FF218085E2E59E4F2082AD72537F103504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB5D38BAD72010000D40300000C0000006662782F636F72652E786D6CC553DB8E823014FC95A6AF1B68C11B9A52A3AB7EC1FE4085CA36424B4A4BFCFC3D5C8CEBC635EED3F200CDCC393D3353CAD697AA44AD
310
B48D323AC5514831923A33B9D2458ABD3B0509466BCEAC31EE5B19465A5432C51D8C392BACF1F50865463BA91DA0DAE4720445D348875156C222C54DF6292B110AEFA0A23987B5C8CEA2906114020D759C35CE8200340CE9DE989F8E1746069C33EF553EB22A8769EAA4A4C57C1147F3457CD806B31D4D82E936D907DBC5FB
310
2E38C4F3E564BE8936749F30D23573E65475559759299CCC318F295D065114D0F8239AAEE86C15CFDE68B2A29491AEFCAEC9D7F98B4D5E69378947B9435B837904427AE2875B88C8A146B4A0877046BA10E1D3277C1F340402213B712CAF3ECE00B53273C64E81C98DBF51AD28BD84A934A4FD837E5F303274C2D47E7370FD
310
7046FCF28CE73BC2510B5D8009E16079F4AED3C9060D6368B5B441EB2E481B5B89F2351B4F1CFE89BA897F282933A5B1FFA5888C0744C6DF8374F7917F01504B0304140006080800AC70623B09885E1C7E0000009D0000000B0000006662782F636E782E786D6C4DCCDF0A83201C86E15B91DFB9CBA6FD11D41063F711CB42
310
663A9C8E5DFE6A74B0A30F1E3E5E317C368FDE36BD5C0C12EA0B0164C33DCE2EAC124A5E700F685022C598FF6E80C2B459090783126B8AE579D26C97A9F8BCAB77E17122E586D5843498B3EE8699D114F39E5E713D76EDA84DCBB569A052A2FA95F63DC2EA0B504B0304140006080800AC70623B961D28872A010000120200
310
00310000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C8D515B6EC32010BC8AC557AA0A1BFC4A1C61A2C8514FD00B10435294182C1E558EDFA576A4F62F3F80666766875D76784CF7EC5B39AFADE911CD09CA9419ADD4E6DAA3182E7887B203
310
67CEDAF08786322326D5A30423CEAECEC67985466B8232015063A55A41E1BD0A281BEFF0E8911FBFD42472110330FC2D9FC578135795D31CCAC0E3CC070701B2A5493A11AFBAA1A68434B8ABB71FB81E8E15EE765589E969DB9E8E43DB1D8786158B90B318B55CE55A421C7DD1CABD6A92C49C053D3DE38F4E89A024E22521
310
1DA61493F293D67BD2ECCBE69DECF684B022D1FF89E22C5F14456D4255AE711799479CB2622970266D3CDF9F61D463B62E64A9DFC6ABF10D7192C35CCA0A040B11BE0F8E6DBD3AFA601D8C77733B0397C290926D5B7356A40DC1F5BB3EB8D336F90F504B0304140006080800AC70623B503B51794E01000033030000300000
310
006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1E
310
BC4F77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C54
310
2347DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F
310
103F504B0304140006080800AC70623B2EA4D28F640500003C100000340000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F6F626A656374732E786D6CAD575D739B3814FD2B0CFB6C30B1D3263B844E6CC71D4F376DA79E76F621331E01326103122389C4E9AFDF
310
231018B09D7A3FFC609090EEE7B94757FE875D9E59CF54C894B31BDB73C6B64559C4E394253776A9B6A32BDBFA10F88273D559665B8CE4F4C6D6D376E027829785998AE99694991ACC2E677F5A32A28CDA569411296F6C193DD29C38A4543CA6F2C98989224EB2DD399E532FEC8B4D04291E07420B222853B014F30C52ACDA
310
28AF3F1CDB6EE0BBFA7BE0EB7FB36A727A955BF9D3D79F32A9088B0E940DC44CBCE9E2EEE2F27A74399D4E46D37717DE68B69C2D46DEFBC978FE6E3EBFBEBDBB8662A90424194B04DDDAC147C446A491EFD69F5A8B8DE1C74C8A386334AAFC878795CD46624C0BCA62E431A512DA3A5E8FFB434FC7A6F379A2C7466577FA3C
310
AFBA3B3A821ADB9B67D7521EFE0517E439A810926A54D5F1318ED6F81BEFA316729E996FA9B472A2A84849666569288878B5032CD54B02BF2746A35368846B0FECC0DBCBEBDA8AD2F835768F59B92DB34C43D30E2A646F807FAA646559FA938AE3DA60137255A64C5D1987D46B41EDE0DA77ABC9C0D78FC985F95807D2DA66
310
2441CAE166FD75E0E85CD7DE6A61079F96E16EADEBF1B8F242F0820AA5E1036835896B9E3A4A46AD7756E6F40638D38BF93E28DF10F9CF28DFBD29C89B4877D3DDD468518230B9E522476E9C71F5B3C6CDCBA87D3B7C019F0D561FAE6967FED562DF6D8DED13C6A9FC015C3A3557FF3D7FFD987591DA495FE03FA3C0B89898
310
50AE2392817AEE53868468505A19C714B87C1BEEEC6005A604B36317C9823620072FBEFB8CEFF8AF6583AD2AF59D274342077C7B06F323965559C0B6136039E0C94AB171EE54CC2FFF979AB95DAC3FAD4BB12511BD37C4B2A0DB94A50A67E71EBC5D837A89E879F4445F5FB888E1E86112D6DD24E4469544B475CC75E093E6
310
B0D083BDE69E8208FB12AE39CFFF8586FB544634CB08A3BC6CB4B4C790C66A4B32A64F4015D6019D5C0C502CE873AA3B89DE8A9E5938EB2391163A64EDA1D7F2B473C297EFABCF00A51DCC5EFF20AF5DC20CF7741FF18C8B4DF8BAA999D006F8B0A78FEE1F7D789B88BA5A0A105F61B9A11C13E24D9C6EB7A504EF1E89E28F
310
D5BC9BA996480E5F9A026A34D63539053BA3F68830F06D74A2211004073B679B14C738CAF2A8F2AEEEA10259C93D213F2CF36243725E32754E98C68D3F8DF5ADF06E17235F888A1EED605D3D473350764CE31309D547D0119F7AE979FFFEEA6E727BBD1C79B74BB4529717CBD1D5E5DC1B79B3B977395B4C96EF2638E6FA15
310
D09C50DD1A44347122FAA5484D98BFAFF6656B07F74449F7635D506E523FBFAF1CB4C5BE8B3D0078BB71951719CD295344C3F75EBF64DF08BA8A9E8C7A7E9593849E21E5CBC7F5C006CC9CB1EFAB2E35FA32D86B66E7BA168E0A518F651E329266838DC671A7608971BB0965FBAC19BD19EA918927FA50C9B33406E1C45642
310
794E1568E70CB6173995404CB72B8FCDEDE18CDDCF753FA84898D1C6924782963893403548A78C547FDEFA0D2D9CEEA26E6C1C76CE13FE4C21DA16527D6383DF541A51E984381E75E353090704D085B52408D0139664E8ACEB4DEDB8DDA56303FAC10968F4B74BCEE9968C5F3DE2CD4951E0D4EED16A659B5110FD23C71B73
310
2CA2F01A96AAF5653FD13A53A909C03570A77DA0857832AA77A8AFB7DDF29C6A4D2F2267DD93DE04412D75A48848AA7B810EBA31E976F1D5452B60ADBE58455626C8E5F992468202CCA52E70A008A830320BA200D5F9EF0F5F05C75D34B7962920F030E779CE9919DC9ABBACB57EC4CD347E002D507DFD901763CF7BA8BA7E
310
7311D984445287C4F209134DC1690F065803200F8E53733D73750E06CB570BCB1C185308AD407BD094D6D7700BC5A36F8EBA54BA6459BCD9F8BBD552A040A0650FFE06504B0304140006080000AC70623B000000000000000000000000350000006662782F33394334313030352D393437462D344341332D393833322D3144
310
373644414336394143352F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B
310
000000000000000000000000370000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F33394334313030352D393437462D344341332D393833
310
322D3144373644414336394143352F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607
310
FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623B95BFD5E5FE000000A00100003B0000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265736F75726365732F63
310
6F72652E786D6C8D50596E833010BD0A9ADFCA603B1B41C611699213F40296992456828DBC543D7E4DA052FBD79F99D15B344F4F1CBE8667F1893E18675B60258502AD76BDB1B71652BC921A8A8314DEB9F84B06855503B630C120C5CDBB342E907636A28D19B5AEC70554216084423FF3D142D0771C54A952CC8AF02847A5
310
1FEA86252B339D755284E87380627E324D901E834B5E6310D5CC4A9192E9178DE9F34F7335E841EE38DBEEF8A5239B13ADC9FA589FC971F77E2217BEDDAFB61DEBE8B916D56496229AE127A3F6A822F62039A57BC218A1FC83AD1BBA69F8E68DD60DA5A29AE47F4C69ECFF694AC6C6155FE2CEB60092E5202F428A6AEA2BAF
310
5799794FDDCA6F504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B
310
436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BFD5588D4EC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D6C504B
310
01021400140006080800AC70623BB5D38BAD72010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623B09885E1C7E0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B01021400140006080800AC70
310
623B961D28872A0100001202000031000000000000000000000000005C0500006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D5060000
310
6662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6C504B01021400140006080800AC70623B2EA4D28F640500003C1000003400000000000000000000000000710800006662782F33394334313030352D393437462D344341332D393833322D3144373644
310
414336394143352F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000270E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F76657274696365732E62696E504B01021400140006
310
080800AC70623BF270F133060000000400000036000000000000000000000000007A0E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000000000
310
000000000000D40E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000290F00006662782F33394334313030352D393437
310
462D344341332D393833322D3144373644414336394143352F6469726563746F72792E786D6C504B01021400140006080800AC70623B95BFD5E5FE000000A00100003B000000000000000000000000000D1000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265
310
736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000641100000000
  0
XRECORD
  5
10D
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10C
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
187
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
 70
     0
 90
1778669749
  1
7E355024-1ABF-47F9-966E-F2159FBE82AB
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BDCE527C8EB0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103B15DC7C24471249FA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EFA9EEFE8CBACC17AD7032D0820E394D7D64D3DA478C52DA093E0ABF7F1970D9093B3E961
310
9341F069F569D925E55D342E66D5796D76518660222075CF4D0F417D9A591632C5EC08B76291EA262753D05797E194AC46CF2356E77DF66ACD0A621C9B73335C463C5E0E1457EC9DE2A1612D3E9233A92BD2D66333F07283058F767EDD57AB91D168108C9023A61413F641AB8ED41DABDF48DB11C2CBCDFE074A8BFE2794AC
310
8B07B6BFFBC402089A1F790C042FB72C72790495EB969BF801504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF32603847
310
2BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB24894EB71010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C085012194749244ED00B38E05014B091B1518EDFE511A5A9D228FD2A1F60CDEC7A67C6986D2F6D830669
310
FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7266B4B6DFCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B4FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2609EE7C92ED91F722F3FAC022F0ADF036F9F84A9
310
B7A63B1A47348DF364CFC8D8CC99ADDBABBAC2486165897948E9DA0B028F861F41B4A1F1268CDF68BAA19491B1FCAEC975E58B4DAE5676152E72E7B61EF300844CC40FB7109145BD18400FE18C8C21C2674AF83E68080442B6E2D85C7D9C011A6461B5898029B5BB5183689C84A9D4A7D3837E5F303277C2D4697370FD7046
310
F8F28CE73BC2510B5581096161797476D4C9660D4B689D34DE602F4869D38AE6351B4F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F01504B0304140006080800AC70623B3A54DFB77D0000009D0000000B0000006662782F636E782E786D6C4DCCD10A83201805E05791FFDEA5EBA76DA046A37C8F581632D3
310
613AF6F8B3D1C52E0E073E0E47B49FD591B7899B0D5E023F3120C63FC264FD2221A7995E81B44AC410D2DF0C881F5723616750628921BF0E9ACC3C66978A3AEB9F07B2A6D77AB87514F95953EC39D20EEF9C6AD60C88BC2EB940A544F57B2ABD1FAB2F504B0304140006080800AC70623B4A17098729010000120200003100
310
00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C8D515B6EC32010BC0AE22B55850D0E76930813A54A7C825E80DA244589C1E251E5F85D6A476AFFF2018B7667666759B1BF8F37F4AD7D30CEB6981514236D7B37187B69718A67B2C1682F8577
310
2EFE816164D5A85B9CD3588A8B77695A52BDB351DB0859EB06BD2455083A62D4DFE0D1E2D07FE951152A4540846B31A9FEAA2EBA600594012745881E0CA0B949BEB1A4CDB1EB4EDB03E1ACEA083F324E0EFC9D918E3627CED91ACE9B2867A214299961A19B01EC98B3D1FE59914C96229AF161BFF75A453D605951BA258C11
310
5A7D30BEA3F5AEAA5FE96647A92833FC1F294DC393A4646C5C578BDD9916B064A29C0B520C2E7DDE1E66F47D723EA2DC6F1574FF02531594D6AC69443903617C506CF8A218A2F3F0BDABEB2760593DCB365C8A326F08C2EFFA20E66DCA1F504B0304140006080800AC70623B503B51794E0100003303000030000000666278
310
2F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F7736
310
4A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347DEE0
310
50F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F504B
310
0304140006080800AC70623BD8F6D0D5660500003B100000340000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F6F626A656374732E786D6CAD575B8F9B3814FE2B887D064292B964C5504D92491555D3568D5AEDC348910187610730B2CD4C667FFD7E06438024
310
6DF6928780CDF1B97EE762EFC33E4B8D57CA45C2F23BD3B547A641F39045491EDF99A5DC59B7A6F1C1F73863B243661A39C9E89DA9B64DDF8B392B0BBD15D11D295339D85DCDFF304448736A1A614A84B83345F84C33629352B2888A173B2292D8F16E6FBB764DD8671B73523C0F981684D35C4253ECE7E062D44AB9FDE5C8
310
747CCF51DF7D4FFD6BAAC9792AA7B2A72F3FC985247978246CC066E24E970FE3AB9975359D4EACE9F5D8B5E6ABF9D2726F26A3C5F56231BB7F9841B0901C9CB4269CEE4CFF237CC393D073EA4FADC65AF1532A852CCF6958D90F0B2B9D35C78816348F10C7840A48EB583DEA2F5DE59BCEE7895A6B91DDEDCBACEA9EE8306A
310
746F9E5D4D59F0274C1097A0820BAA5055FB471B5AE36F74F05AC058AABF25C2C888A43C21A991260127FCDDF441AA487CAFC746A1932B842B0B4CDF3DF0EBEA8AD4F835764F69B92BD35441D3F42B646F817F2A45A559F217E5A7A54127C4AA4C7279AB0D92EF0535FD99E7549BBEA71E93B1FE583BD2D8A52446C86166FD
310
7560E842E5DE7A69FA9F56C17EA3F2F1B4F082B38272A9E0036835816B9ECA4B5AAC7B51E4D40118D3F3F9C129DFE0F9CF48DF832A881B4FF6D3FD544B919CE462C77886D8D8A3EA678C9A17AB7D3B7E413D1B501FD3B43BFF8AD8735A65FB05E35CFC002E159ADBFF1EBFBECFBA48ED84CFF75E91608C4FB42B372149517A
310
1E931C0151A03452862DD4F25DB037FD352A252A3B4E91D46F1D72F4E239AFF88EFF9A37AA5525BEF3CC11D041BDBDA0F2C397555A40B7336039AA9395606DDC399F5FFD2F3973BFDC7CDA947C4742FAA80BCB92EE923C91E89D07F07615EA05A267D10B7D7F633C82A1C741D8748390695102DE563E578E8F9B66A11607C9
310
3D0121CEC54CD53CEF17121E1311D2342539656523A56D430AAB6D91D17302B2B076E8643C4031A7AF899A247A143DB5D0EB439E14CA656DD36BEBB47DC696EFEBCF0025E8531690F440141CAA7DC852C6B7C1FBB62E8426B087237D70FFE8A35B3BD4515C00F80ACA4DC5D11EDE46C96E570A94DD134EFCB15E7403D5D691
310
E397267F1A89754A4E519C917A846BF43632310F7082BECEF26D822E8EAC3C29BC2B7B2840547CCFF00FCAACD8928C95B9BCC44DA3C69E46FB96797788116F4486CFA6BFA99ED61C153BA2D121543D10A80E74C2A65E786E1E265757A3F1D472EFE72B6B7AB39A59B3EBEB076B3576AF66ABF9C3EDF87EDE6A5469E27B4D83
310
EAA620BC8986E8953CD16EFEBE3E64ADE93F12299C8F753E3971FDFCBEB631157B0ECE00DFEDC17556A434A3B9240ABD8FEA25FD463054F478D4FBEB8CC4F4022E5F3E6E063A60E782735F55A6D1B7C159BDBB50B97092897C2EB32027493A38A80DB78B3CD66637AE6C9F75416F966AA5FD893154B03489506F2223A62CA3
310
1255E78262CF332A8098EE501EE9CBC305A75FEB71509220A58D26CF0413712A806AC0AD0C657FDFF80D139C1AA2EE4CF43AFB057F3A114D03A1BE3351DE6412526107E88E6AEEA998030218C2DA1A08A8913C4E3158D787DA757B4AF906E5070D50CB6F492E1996B45DBDBA9B91A240D3EE55D54A372D20FC478637EA1844
310
E23528656BCB61A335A61283CCAA8DD257034C102F5AF41EF9F573B35CBBA2E979E4A26BD24F415073B524E171752D50FA6995EE975F1D4C02C6FA8B51A4658C585ECEC9E214602E558203454085E6591009A82E7E7FFACA19AEA299B14A0081A705CB3296EBC5BDBECA1A9B675C4CA3279405AA6E1F623C72DDA76AE8D7F7
310
906D4004B549245EB0D1249CB260803500F2A89BEA10382A0603F2F5D2D00D630AA615688F66D2FA166E2079D4C551A54AB758163F9DFB9D8A1460E098D8FDBF01504B0304140006080000AC70623B000000000000000000000000350000006662782F30364446464539412D343132462D344431342D413442312D46303645
310
34343133343431372F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B0000
310
00000000000000000000370000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30364446464539412D343132462D344431342D413442312D
310
4630364534343133343431372F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607FB14
310
4396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BB40F7AF9FE000000A00100003B0000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F75726365732F636F72
310
652E786D6C8D504B6E833010BD0A9A6D65B00950828CA3109513F4029699502BC146FE543D7E4D42A576D7CDCCE87D344F8F9FBE967BF689CE6B6B7A6039850C8DB29336730F315C490BD94970676DF82583CCC8057BD860107C7636AE3BA4AC096842428D9D7007A5F7182053F774F4E0D5072E3297312485BFE5AB543739
310
63CEF244279DE03EB814207B3ED9260887DE46A7D0F3E2C90A1EA39E768D9ED24F7DD5E8408C63736E86CB1B192F0746AAF29591A1295B72A4675A57B4ADC766E0C566163CE8E527A37228034E204A4A8F843142CB775675B4EECAFA85B61DA5BCD8E47F4C719DFE698ADA8443B9C77DDA3C0896823C08C18BADAFB41E65A6
310
BD752BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B436F
310
6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BDCE527C8EB0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000094020000636E782E786D6C504B0102
310
1400140006080800AC70623BB24894EB71010000D40300000C00000000000000000000000000180300006662782F636F72652E786D6C504B01021400140006080800AC70623B3A54DFB77D0000009D0000000B00000000000000000000000000B30400006662782F636E782E786D6C504B01021400140006080800AC70623B
310
4A17098729010000120200003100000000000000000000000000590500006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D10600006662
310
782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6C504B01021400140006080800AC70623BD8F6D0D5660500003B10000034000000000000000000000000006D0800006662782F30364446464539412D343132462D344431342D413442312D46303645343431
310
33343431372F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000250E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F76657274696365732E62696E504B010214001400060808
310
00AC70623BF270F13306000000040000003600000000000000000000000000780E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E504B01021400140006080000AC70623B00000000000000000000000037000000000000000000
310
00000000D20E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000270F00006662782F30364446464539412D343132462D
310
344431342D413442312D4630364534343133343431372F6469726563746F72792E786D6C504B01021400140006080800AC70623BB40F7AF9FE000000A00100003B000000000000000000000000000B1000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F
310
75726365732F636F72652E786D6C504B0506000000000E000E0080040000621100000000
  0
XRECORD
  5
10E
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10F
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
379
102
{ACAD_REACTORS
330
378
102
}
330
378
100
AcDbXrecord
280
     1
102
DISPLAYNAME
  1
Imperial24
102
FLAGS
 90
        0
  0
CELLSTYLEMAP
  5
33E
102
{ACAD_REACTORS
330
FF
102
}
330
FF
100
AcDbCellStyleMap
 90
        3
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
    32768
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.25
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        1
 91
        1
300
_TITLE
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        2
 91
        1
300
_HEADER
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        2
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        3
 91
        2
300
_DATA
309
CELLSTYLE_END
  0
XRECORD
  5
353
102
{ACAD_REACTORS
330
352
102
}
330
352
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     1
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     0
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
351
102
{ACAD_REACTORS
330
350
102
}
330
350
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
35F
102
{ACAD_REACTORS
330
35E
102
}
330
35E
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
367
102
{ACAD_REACTORS
330
366
102
}
330
366
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
359
102
{ACAD_REACTORS
330
358
102
}
330
358
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
35D
102
{ACAD_REACTORS
330
35C
102
}
330
35C
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
36D
102
{ACAD_REACTORS
330
36C
102
}
330
36C
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
365
102
{ACAD_REACTORS
330
364
102
}
330
364
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
349
102
{ACAD_REACTORS
330
348
102
}
330
348
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
34B
102
{ACAD_REACTORS
330
34A
102
}
330
34A
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
34D
102
{ACAD_REACTORS
330
34C
102
}
330
34C
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
34F
102
{ACAD_REACTORS
330
34E
102
}
330
34E
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
357
102
{ACAD_REACTORS
330
356
102
}
330
356
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
369
102
{ACAD_REACTORS
330
368
102
}
330
368
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
363
102
{ACAD_REACTORS
330
362
102
}
330
362
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
36B
102
{ACAD_REACTORS
330
36A
102
}
330
36A
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
35B
102
{ACAD_REACTORS
330
35A
102
}
330
35A
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
377
102
{ACAD_REACTORS
330
376
102
}
330
376
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
375
102
{ACAD_REACTORS
330
374
102
}
330
374
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
36F
102
{ACAD_REACTORS
330
36E
102
}
330
36E
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
371
102
{ACAD_REACTORS
330
370
102
}
330
370
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
361
102
{ACAD_REACTORS
330
360
102
}
330
360
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
355
102
{ACAD_REACTORS
330
354
102
}
330
354
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
XRECORD
  5
373
102
{ACAD_REACTORS
330
372
102
}
330
372
100
AcDbXrecord
280
     1
102
RTVSPost2010Prop28
280
     0
102
RTVSPost2010PropOp28
 70
     1
102
RTVSPost2010Prop29
280
     1
102
RTVSPost2010PropOp29
 70
     1
102
RTVSPost2010Prop30
280
     1
102
RTVSPost2010PropOp30
 70
     1
102
RTVSPost2010Prop31
280
     0
102
RTVSPost2010PropOp31
 70
     1
102
RTVSPost2010Prop32
280
     0
102
RTVSPost2010PropOp32
 70
     1
102
RTVSPost2010Prop33
280
     0
102
RTVSPost2010PropOp33
 70
     1
102
RTVSPost2010Prop34
280
     0
102
RTVSPost2010PropOp34
 70
     1
102
RTVSPost2010Prop35
280
     0
102
RTVSPost2010PropOp35
 70
     1
102
RTVSPost2010Prop36
280
     0
102
RTVSPost2010PropOp36
 70
     1
102
RTVSPost2010Prop37
 90
       50
102
RTVSPost2010PropOp37
 70
     1
102
RTVSPost2010Prop38
140
0.0
102
RTVSPost2010PropOp38
 70
     1
102
RTVSPost2010Prop39
140
1.0
102
RTVSPost2010PropOp39
 70
     1
102
RTVSPost2010Prop40
 90
        0
102
RTVSPost2010PropOp40
 70
     1
102
RTVSPost2010Prop41ColorIndex
 90
       18
102
RTVSPost2010Prop41ColorRGB
 90
        0
102
RTVSPost2010PropOp41
 70
     1
102
RTVSPost2010Prop42
 90
       50
102
RTVSPost2010PropOp42
 70
     1
102
RTVSPost2010Prop43
 90
        3
102
RTVSPost2010PropOp43
 70
     1
102
RTVSPost2010Prop44ColorIndex
 90
        5
102
RTVSPost2010Prop44ColorRGB
 90
      255
102
RTVSPost2010PropOp44
 70
     1
102
RTVSPost2010Prop45
280
     0
102
RTVSPost2010PropOp45
 70
     1
102
RTVSPost2010Prop46
 90
       50
102
RTVSPost2010PropOp46
 70
     1
102
RTVSPost2010Prop47
 90
       50
102
RTVSPost2010PropOp47
 70
     1
102
RTVSPost2010Prop48
 90
       50
102
RTVSPost2010PropOp48
 70
     1
102
RTVSPost2010Prop49
280
     0
102
RTVSPost2010PropOp49
 70
     1
102
RTVSPost2010Prop50
 90
       50
102
RTVSPost2010PropOp50
 70
     1
102
RTVSPost2010Prop51ColorIndex
 90
      256
102
RTVSPost2010Prop51ColorRGB
 90
-16777216
102
RTVSPost2010PropOp51
 70
     0
102
RTVSPost2010Prop52
140
1.0
102
RTVSPost2010PropOp52
 70
     0
102
RTVSPost2010Prop53
 90
        2
102
RTVSPost2010PropOp53
 70
     1
102
RTVSPost2010Prop54
  1
strokes_ogs.tif
102
RTVSPost2010PropOp54
 70
     1
102
RTVSPost2010Prop55
280
     0
102
RTVSPost2010PropOp55
 70
     1
102
RTVSPost2010Prop56
140
1.0
102
RTVSPost2010PropOp56
 70
     1
102
RTVSPost2010Prop57
140
1.0
102
RTVSPost2010PropOp57
 70
     1
  0
ENDSEC
  0
EOF
`;var XXe=`  0
SECTION
  2
HEADER
  9
$ACADVER
  1
AC1027
  9
$ACADMAINTVER
 70
   125
  9
$DWGCODEPAGE
  3
ANSI_936
  9
$LASTSAVEDBY
  1
win10
  9
$REQUIREDVERSIONS
160
                 0
  9
$INSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$EXTMIN
 10
1.000000000000000E+20
 20
1.000000000000000E+20
 30
1.000000000000000E+20
  9
$EXTMAX
 10
-1.000000000000000E+20
 20
-1.000000000000000E+20
 30
-1.000000000000000E+20
  9
$LIMMIN
 10
0.0
 20
0.0
  9
$LIMMAX
 10
12.0
 20
9.0
  9
$ORTHOMODE
 70
     0
  9
$REGENMODE
 70
     1
  9
$FILLMODE
 70
     1
  9
$QTEXTMODE
 70
     0
  9
$MIRRTEXT
 70
     0
  9
$LTSCALE
 40
1.0
  9
$ATTMODE
 70
     1
  9
$TEXTSIZE
 40
0.2
  9
$TRACEWID
 40
0.05
  9
$TEXTSTYLE
  7
Standard
  9
$CLAYER
  8
0
  9
$CELTYPE
  6
ByLayer
  9
$CECOLOR
 62
   256
  9
$CELTSCALE
 40
1.0
  9
$DISPSILH
 70
     0
  9
$DIMSCALE
 40
1.0
  9
$DIMASZ
 40
0.18
  9
$DIMEXO
 40
0.0625
  9
$DIMDLI
 40
0.38
  9
$DIMRND
 40
0.0
  9
$DIMDLE
 40
0.0
  9
$DIMEXE
 40
0.18
  9
$DIMTP
 40
0.0
  9
$DIMTM
 40
0.0
  9
$DIMTXT
 40
0.18
  9
$DIMCEN
 40
0.09
  9
$DIMTSZ
 40
0.0
  9
$DIMTOL
 70
     0
  9
$DIMLIM
 70
     0
  9
$DIMTIH
 70
     1
  9
$DIMTOH
 70
     1
  9
$DIMSE1
 70
     0
  9
$DIMSE2
 70
     0
  9
$DIMTAD
 70
     0
  9
$DIMZIN
 70
     0
  9
$DIMBLK
  1

  9
$DIMASO
 70
     1
  9
$DIMSHO
 70
     1
  9
$DIMPOST
  1

  9
$DIMAPOST
  1

  9
$DIMALT
 70
     0
  9
$DIMALTD
 70
     2
  9
$DIMALTF
 40
25.4
  9
$DIMLFAC
 40
1.0
  9
$DIMTOFL
 70
     0
  9
$DIMTVP
 40
0.0
  9
$DIMTIX
 70
     0
  9
$DIMSOXD
 70
     0
  9
$DIMSAH
 70
     0
  9
$DIMBLK1
  1

  9
$DIMBLK2
  1

  9
$DIMSTYLE
  2
Standard
  9
$DIMCLRD
 70
     0
  9
$DIMCLRE
 70
     0
  9
$DIMCLRT
 70
     0
  9
$DIMTFAC
 40
1.0
  9
$DIMGAP
 40
0.09
  9
$DIMJUST
 70
     0
  9
$DIMSD1
 70
     0
  9
$DIMSD2
 70
     0
  9
$DIMTOLJ
 70
     1
  9
$DIMTZIN
 70
     0
  9
$DIMALTZ
 70
     0
  9
$DIMALTTZ
 70
     0
  9
$DIMUPT
 70
     0
  9
$DIMDEC
 70
     4
  9
$DIMTDEC
 70
     4
  9
$DIMALTU
 70
     2
  9
$DIMALTTD
 70
     2
  9
$DIMTXSTY
  7
Standard
  9
$DIMAUNIT
 70
     0
  9
$DIMADEC
 70
     0
  9
$DIMALTRND
 40
0.0
  9
$DIMAZIN
 70
     0
  9
$DIMDSEP
 70
    46
  9
$DIMATFIT
 70
     3
  9
$DIMFRAC
 70
     0
  9
$DIMLDRBLK
  1

  9
$DIMLUNIT
 70
     2
  9
$DIMLWD
 70
    -2
  9
$DIMLWE
 70
    -2
  9
$DIMTMOVE
 70
     0
  9
$DIMFXL
 40
1.0
  9
$DIMFXLON
 70
     0
  9
$DIMJOGANG
 40
0.7853981633974483
  9
$DIMTFILL
 70
     0
  9
$DIMTFILLCLR
 70
     0
  9
$DIMARCSYM
 70
     0
  9
$DIMLTYPE
  6

  9
$DIMLTEX1
  6

  9
$DIMLTEX2
  6

  9
$DIMTXTDIRECTION
 70
     0
  9
$LUNITS
 70
     2
  9
$LUPREC
 70
     4
  9
$SKETCHINC
 40
0.1
  9
$FILLETRAD
 40
0.0
  9
$AUNITS
 70
     0
  9
$AUPREC
 70
     0
  9
$MENU
  1
.
  9
$ELEVATION
 40
0.0
  9
$PELEVATION
 40
0.0
  9
$THICKNESS
 40
0.0
  9
$LIMCHECK
 70
     0
  9
$CHAMFERA
 40
0.0
  9
$CHAMFERB
 40
0.0
  9
$CHAMFERC
 40
0.0
  9
$CHAMFERD
 40
0.0
  9
$SKPOLY
 70
     0
  9
$TDCREATE
 40
2460560.605914352
  9
$TDUCREATE
 40
2460560.272581019
  9
$TDUPDATE
 40
2460560.629675926
  9
$TDUUPDATE
 40
2460560.296342593
  9
$TDINDWG
 40
0.0237615741
  9
$TDUSRTIMER
 40
0.0237615741
  9
$USRTIMER
 70
     1
  9
$ANGBASE
 50
0.0
  9
$ANGDIR
 70
     0
  9
$PDMODE
 70
     0
  9
$PDSIZE
 40
0.0
  9
$PLINEWID
 40
0.0
  9
$SPLFRAME
 70
     0
  9
$SPLINETYPE
 70
     6
  9
$SPLINESEGS
 70
     8
  9
$HANDSEED
  5
38A
  9
$SURFTAB1
 70
     6
  9
$SURFTAB2
 70
     6
  9
$SURFTYPE
 70
     6
  9
$SURFU
 70
     6
  9
$SURFV
 70
     6
  9
$UCSBASE
  2

  9
$UCSNAME
  2

  9
$UCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$UCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$UCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$UCSORTHOREF
  2

  9
$UCSORTHOVIEW
 70
     0
  9
$UCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSBASE
  2

  9
$PUCSNAME
  2

  9
$PUCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$PUCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$PUCSORTHOREF
  2

  9
$PUCSORTHOVIEW
 70
     0
  9
$PUCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$USERI1
 70
     0
  9
$USERI2
 70
     0
  9
$USERI3
 70
     0
  9
$USERI4
 70
     0
  9
$USERI5
 70
     0
  9
$USERR1
 40
0.0
  9
$USERR2
 40
0.0
  9
$USERR3
 40
0.0
  9
$USERR4
 40
0.0
  9
$USERR5
 40
0.0
  9
$WORLDVIEW
 70
     1
  9
$SHADEDGE
 70
     3
  9
$SHADEDIF
 70
    70
  9
$TILEMODE
 70
     1
  9
$MAXACTVP
 70
    64
  9
$PINSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMCHECK
 70
     0
  9
$PEXTMIN
 10
0.0
 20
0.0
 30
0.0
  9
$PEXTMAX
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMMIN
 10
0.0
 20
0.0
  9
$PLIMMAX
 10
12.0
 20
9.0
  9
$UNITMODE
 70
     0
  9
$VISRETAIN
 70
     1
  9
$PLINEGEN
 70
     0
  9
$PSLTSCALE
 70
     1
  9
$TREEDEPTH
 70
  3020
  9
$CMLSTYLE
  2
Standard
  9
$CMLJUST
 70
     0
  9
$CMLSCALE
 40
1.0
  9
$PROXYGRAPHICS
 70
     1
  9
$MEASUREMENT
 70
     0
  9
$CELWEIGHT
370
    -1
  9
$ENDCAPS
280
     0
  9
$JOINSTYLE
280
     0
  9
$LWDISPLAY
290
     0
  9
$INSUNITS
 70
     4
  9
$HYPERLINKBASE
  1

  9
$STYLESHEET
  1

  9
$XEDIT
290
     1
  9
$CEPSNTYPE
380
     0
  9
$PSTYLEMODE
290
     0
  9
$FINGERPRINTGUID
  2
{FA9A02B2-7E04-C34E-BD13-02980AC2B394}
  9
$VERSIONGUID
  2
{964EB223-33A2-D549-8684-CDE005EE773C}
  9
$EXTNAMES
290
     1
  9
$PSVPSCALE
 40
0.0
  9
$OLESTARTUP
290
     0
  9
$SORTENTS
280
   127
  9
$INDEXCTL
280
     0
  9
$HIDETEXT
280
     1
  9
$XCLIPFRAME
280
     2
  9
$HALOGAP
280
     0
  9
$OBSCOLOR
 70
   257
  9
$OBSLTYPE
280
     0
  9
$INTERSECTIONDISPLAY
280
     0
  9
$INTERSECTIONCOLOR
 70
   257
  9
$DIMASSOC
280
     2
  9
$PROJECTNAME
  1

  9
$CAMERADISPLAY
290
     0
  9
$LENSLENGTH
 40
50.0
  9
$CAMERAHEIGHT
 40
60.0
  9
$STEPSPERSEC
 40
2.0
  9
$STEPSIZE
 40
6.0
  9
$3DDWFPREC
 40
2.0
  9
$PSOLWIDTH
 40
0.25
  9
$PSOLHEIGHT
 40
4.0
  9
$LOFTANG1
 40
1.570796326794896
  9
$LOFTANG2
 40
1.570796326794896
  9
$LOFTMAG1
 40
0.0
  9
$LOFTMAG2
 40
0.0
  9
$LOFTPARAM
 70
     7
  9
$LOFTNORMALS
280
     1
  9
$LATITUDE
 40
37.795
  9
$LONGITUDE
 40
-122.394
  9
$NORTHDIRECTION
 40
0.0
  9
$TIMEZONE
 70
 -8000
  9
$LIGHTGLYPHDISPLAY
280
     1
  9
$TILEMODELIGHTSYNCH
280
     1
  9
$CMATERIAL
347
92
  9
$SOLIDHIST
280
     0
  9
$SHOWHIST
280
     1
  9
$DWFFRAME
280
     2
  9
$DGNFRAME
280
     0
  9
$REALWORLDSCALE
290
     1
  9
$INTERFERECOLOR
 62
     1
  9
$INTERFEREOBJVS
345
9F
  9
$INTERFEREVPVS
346
9C
  9
$CSHADOW
280
     0
  9
$SHADOWPLANELOCATION
 40
0.0
  0
ENDSEC
  0
SECTION
  2
CLASSES
  0
CLASS
  1
ACDBDICTIONARYWDFLT
  2
AcDbDictionaryWithDefault
  3
ObjectDBX Classes
 90
        0
 91
        1
280
     0
281
     0
  0
CLASS
  1
DICTIONARYVAR
  2
AcDbDictionaryVar
  3
ObjectDBX Classes
 90
        0
 91
       15
280
     0
281
     0
  0
CLASS
  1
MATERIAL
  2
AcDbMaterial
  3
ObjectDBX Classes
 90
     1153
 91
        3
280
     0
281
     0
  0
CLASS
  1
VISUALSTYLE
  2
AcDbVisualStyle
  3
ObjectDBX Classes
 90
     4095
 91
       24
280
     0
281
     0
  0
CLASS
  1
TABLESTYLE
  2
AcDbTableStyle
  3
ObjectDBX Classes
 90
     4095
 91
        1
280
     0
281
     0
  0
CLASS
  1
SCALE
  2
AcDbScale
  3
ObjectDBX Classes
 90
     1153
 91
       33
280
     0
281
     0
  0
CLASS
  1
MLEADERSTYLE
  2
AcDbMLeaderStyle
  3
ACDB_MLEADERSTYLE_CLASS
 90
     4095
 91
        2
280
     0
281
     0
  0
CLASS
  1
CELLSTYLEMAP
  2
AcDbCellStyleMap
  3
ObjectDBX Classes
 90
     1152
 91
        6
280
     0
281
     0
  0
CLASS
  1
EXACXREFPANELOBJECT
  2
ExAcXREFPanelObject
  3
EXAC_ESW
 90
     1025
 91
        0
280
     0
281
     0
  0
CLASS
  1
NPOCOLLECTION
  2
AcDbImpNonPersistentObjectsCollection
  3
ObjectDBX Classes
 90
     1153
 91
        0
280
     0
281
     0
  0
CLASS
  1
LAYER_INDEX
  2
AcDbLayerIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
SPATIAL_INDEX
  2
AcDbSpatialIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
IDBUFFER
  2
AcDbIdBuffer
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
ACDBSECTIONVIEWSTYLE
  2
AcDbSectionViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
CLASS
  1
ACDBDETAILVIEWSTYLE
  2
AcDbDetailViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
ENDSEC
  0
SECTION
  2
TABLES
  0
TABLE
  2
VPORT
  5
8
330
0
100
AcDbSymbolTable
 70
     1
1001
ACAD
1000
DbSaveVer
1071
      224
  0
VPORT
  5
90
330
8
100
AcDbSymbolTableRecord
100
AcDbViewportTableRecord
  2
*Active
 70
     0
 10
0.0
 20
0.0
 11
1.0
 21
1.0
 12
97.5486911906951
 22
42.51345460271504
 13
0.0
 23
0.0
 14
0.5
 24
0.5
 15
0.5
 25
0.5
 16
0.0
 26
0.0
 36
1.0
 17
0.0
 27
0.0
 37
0.0
 40
78.45799938217576
 41
1.945409429280396
 42
50.0
 43
0.0
 44
0.0
 50
0.0
 51
0.0
 71
     0
 72
  1000
 73
     1
 74
     3
 75
     0
 76
     1
 77
     0
 78
     0
281
     0
 65
     1
110
0.0
120
0.0
130
0.0
111
1.0
121
0.0
131
0.0
112
0.0
122
1.0
132
0.0
 79
     0
146
0.0
348
9B
 60
     3
 61
     5
292
     1
282
     1
141
0.0
142
0.0
 63
   250
421
  3355443
1001
ACAD_NAV_VCDISPLAY
1070
     3
  0
ENDTAB
  0
TABLE
  2
LTYPE
  5
5
330
0
100
AcDbSymbolTable
 70
     1
  0
LTYPE
  5
14
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByBlock
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
15
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByLayer
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
16
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
Continuous
 70
     0
  3
Solid line
 72
    65
 73
     0
 40
0.0
  0
ENDTAB
  0
TABLE
  2
LAYER
  5
2
102
{ACAD_XDICTIONARY
360
18B
102
}
330
0
100
AcDbSymbolTable
 70
     1
  0
LAYER
  5
10
102
{ACAD_XDICTIONARY
360
E1
102
}
330
2
100
AcDbSymbolTableRecord
100
AcDbLayerTableRecord
  2
0
 70
     0
 62
     7
  6
Continuous
370
    -3
390
F
347
94
348
0
  0
ENDTAB
  0
TABLE
  2
STYLE
  5
3
330
0
100
AcDbSymbolTable
 70
     2
  0
STYLE
  5
11
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Standard
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
ACAD
1000
Arial
1071
       34
  0
STYLE
  5
D7
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD
1000
Arial
1071
       34
  0
ENDTAB
  0
TABLE
  2
VIEW
  5
6
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
UCS
  5
7
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
APPID
  5
9
330
0
100
AcDbSymbolTable
 70
     7
  0
APPID
  5
12
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD
 70
     0
  0
APPID
  5
D8
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnoPO
 70
     0
  0
APPID
  5
D9
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnotative
 70
     0
  0
APPID
  5
DA
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMJAG
 70
     0
  0
APPID
  5
DB
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMTALN
 70
     0
  0
APPID
  5
102
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_MLEADERVER
 70
     0
  0
APPID
  5
1A3
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_NAV_VCDISPLAY
 70
     0
  0
ENDTAB
  0
TABLE
  2
DIMSTYLE
  5
A
330
0
100
AcDbSymbolTable
 70
     2
100
AcDbDimStyleTable
 71
     2
340
DC
340
27
  0
DIMSTYLE
105
27
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Standard
 70
     0
340
11
  0
DIMSTYLE
105
DC
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
340
11
1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD_DSTYLE_DIMJAG
1070
   388
1040
1.5
1001
ACAD_DSTYLE_DIMTALN
1070
   392
1070
     0
  0
ENDTAB
  0
TABLE
  2
BLOCK_RECORD
  5
1
330
0
100
AcDbSymbolTable
 70
     1
  0
BLOCK_RECORD
  5
1F
102
{ACAD_XDICTIONARY
360
15A
102
}
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Model_Space
340
22
 70
     0
280
     1
281
     0
  0
BLOCK_RECORD
  5
73
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space
340
74
 70
     0
280
     1
281
     0
  0
BLOCK_RECORD
  5
78
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space0
340
79
 70
     0
280
     1
281
     0
  0
ENDTAB
  0
ENDSEC
  0
SECTION
  2
BLOCKS
  0
BLOCK
  5
20
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockBegin
  2
*Model_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Model_Space
  1

  0
ENDBLK
  5
21
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
75
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space
  1

  0
ENDBLK
  5
76
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
7A
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space0
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space0
  1

  0
ENDBLK
  5
7B
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
ENDSEC
  0
SECTION
  2
ENTITIES
  0
ENDSEC
  0
SECTION
  2
OBJECTS
  0
DICTIONARY
  5
C
330
0
100
AcDbDictionary
281
     1
  3
ACAD_CIP_PREVIOUS_PRODUCT_INFO
350
1A2
  3
ACAD_COLOR
350
6C
  3
ACAD_DETAILVIEWSTYLE
350
1A8
  3
ACAD_GROUP
350
D
  3
ACAD_LAYOUT
350
1A
  3
ACAD_MATERIAL
350
6B
  3
ACAD_MLEADERSTYLE
350
D2
  3
ACAD_MLINESTYLE
350
17
  3
ACAD_PLOTSETTINGS
350
19
  3
ACAD_PLOTSTYLENAME
350
E
  3
ACAD_SCALELIST
350
B1
  3
ACAD_SECTIONVIEWSTYLE
350
1A5
  3
ACAD_TABLESTYLE
350
A6
  3
ACAD_VISUALSTYLE
350
95
  3
ACDB_RECOMPOSE_DATA
350
37D
  3
AcDbVariableDictionary
350
59
  3
AcDsDecomposeData
350
383
  0
DICTIONARY
  5
18B
330
2
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_LAYERSTATES
360
18C
  0
DICTIONARY
  5
E1
330
10
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
15A
330
1F
100
AcDbDictionary
280
     1
281
     1
  0
XRECORD
  5
1A2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
300
ACD
300
2021
300

  0
DICTIONARY
  5
6C
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A8
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A9
  0
DICTIONARY
  5
D
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Model
350
22
  3
\u5E03\u5C401
350
74
  3
\u5E03\u5C402
350
79
  0
DICTIONARY
  5
6B
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
ByBlock
350
93
  3
ByLayer
350
92
  3
Global
350
94
  0
DICTIONARY
  5
D2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Annotative
350
E0
  3
Standard
350
D3
  0
DICTIONARY
  5
17
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
18
  0
DICTIONARY
  5
19
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
ACDBDICTIONARYWDFLT
  5
E
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Normal
350
F
100
AcDbDictionaryWithDefault
340
F
  0
DICTIONARY
  5
B1
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
A0
350
B2
  3
A1
350
124
  3
A2
350
125
  3
A3
350
126
  3
A4
350
127
  3
A5
350
128
  3
A6
350
129
  3
A7
350
12A
  3
A8
350
12B
  3
A9
350
12C
  3
B0
350
12D
  3
B1
350
12E
  3
B2
350
12F
  3
B3
350
130
  3
B4
350
131
  3
B5
350
132
  3
B6
350
133
  3
B7
350
134
  3
B8
350
135
  3
B9
350
136
  3
C0
350
137
  3
C1
350
138
  3
C2
350
139
  3
C3
350
13A
  3
C4
350
13B
  3
C5
350
13C
  3
C6
350
13D
  3
C7
350
13E
  3
C8
350
13F
  3
C9
350
140
  3
D0
350
141
  3
D1
350
142
  3
D2
350
143
  0
DICTIONARY
  5
1A5
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A7
  0
DICTIONARY
  5
A6
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
A7
  0
DICTIONARY
  5
95
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
2dWireframe
350
9B
  3
Basic
350
9A
  3
Brighten
350
A1
  3
ColorChange
350
A5
  3
Conceptual
350
9E
  3
Dim
350
A0
  3
EdgeColorOff
350
172
  3
Facepattern
350
A4
  3
Flat
350
96
  3
FlatWithEdges
350
97
  3
Gouraud
350
98
  3
GouraudWithEdges
350
99
  3
Hidden
350
9D
  3
JitterOff
350
170
  3
Linepattern
350
A3
  3
OverhangOff
350
171
  3
Realistic
350
9F
  3
Shaded
350
17F
  3
Shaded with edges
350
17E
  3
Shades of Gray
350
17B
  3
Sketchy
350
17C
  3
Thicken
350
A2
  3
Wireframe
350
9C
  3
X-Ray
350
17D
  0
XRECORD
  5
37D
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
 90
        1
330
A7
  0
DICTIONARY
  5
59
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
CAMERAHEIGHT
350
227
  3
CANNOSCALE
350
EB
  3
CMLEADERSTYLE
350
EA
  3
CTABLESTYLE
350
AB
  3
CVIEWDETAILSTYLE
350
1B4
  3
CVIEWSECTIONSTYLE
350
1B5
  3
DIMASSOC
350
5A
  3
HIDETEXT
350
5E
  3
INDEXCTL
350
226
  3
LAYEREVAL
350
14A
  3
LAYERNOTIFY
350
14B
  3
LIGHTINGUNITS
350
224
  3
MSLTSCALE
350
223
  3
SORTENTS
350
225
  3
XCLIPFRAME
350
228
  0
DICTIONARY
  5
383
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
AcDsRecords
350
385
  3
AcDsSchemas
350
384
1001
ACAD
1070
     2
  0
DICTIONARY
  5
18C
102
{ACAD_REACTORS
330
18B
102
}
330
18B
100
AcDbDictionary
281
     1
  0
ACDBDETAILVIEWSTYLE
  5
1A9
102
{ACAD_XDICTIONARY
360
388
102
}
102
{ACAD_REACTORS
330
1A8
102
}
330
1A8
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
100
AcDbDetailViewStyle
 70
     0
 71
     0
 90
        3
 71
     1
340
11
 62
   256
 40
0.24
340
0
 62
   256
 40
0.24
300

 40
0.36
280
     3
 71
     2
340
16
 90
       25
 62
   256
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewDetailId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
340
16
 90
       25
 62
   256
340
16
 90
       25
 62
   256
280
     0
  0
LAYOUT
  5
22
102
{ACAD_XDICTIONARY
360
191
102
}
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
none_device
  4
Letter_(8.50_x_11.00_Inches)
  6

 40
6.349999904632568
 41
6.349999904632568
 42
6.350006103515625
 43
6.350006103515625
 44
215.8999938964844
 45
279.3999938964844
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
3.560208697428376
 70
 11952
 72
     0
 73
     1
 74
     0
  7

 75
     0
147
0.28088241027059
 76
     0
 77
     2
 78
   300
148
0.1311165230791651
149
0.096403374003771
100
AcDbLayout
  1
Model
 70
     1
 71
     0
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
1F
331
90
  0
LAYOUT
  5
74
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\u5E03\u5C401
 70
     1
 71
     1
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
73
  0
LAYOUT
  5
79
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\u5E03\u5C402
 70
     1
 71
     2
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
78
  0
MATERIAL
  5
93
102
{ACAD_XDICTIONARY
360
185
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByBlock
 94
       63
  0
MATERIAL
  5
92
102
{ACAD_XDICTIONARY
360
183
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByLayer
 94
       63
  0
MATERIAL
  5
94
102
{ACAD_XDICTIONARY
360
10B
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
Global
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
 94
       63
1001
ACAD
1070
    -1
1070
     3
1070
     0
1000

1071
        0
1070
     0
  0
MLEADERSTYLE
  5
E0
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
179
     2
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     1
143
0.125
271
     0
272
     9
273
     9
298
     0
  0
MLEADERSTYLE
  5
D3
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
179
     2
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     0
143
0.125
271
     0
272
     9
273
     9
298
     0
  0
MLINESTYLE
  5
18
102
{ACAD_REACTORS
330
17
102
}
330
17
100
AcDbMlineStyle
  2
STANDARD
 70
     0
  3

 62
   256
 51
90.0
 52
90.0
 71
     2
 49
0.5
 62
   256
  6
BYLAYER
 49
-0.5
 62
   256
  6
BYLAYER
  0
ACDBPLACEHOLDER
  5
F
102
{ACAD_REACTORS
330
E
102
}
330
E
  0
SCALE
  5
B2
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:1
140
1.0
141
1.0
290
     1
  0
SCALE
  5
124
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:2
140
1.0
141
2.0
290
     0
  0
SCALE
  5
125
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:4
140
1.0
141
4.0
290
     0
  0
SCALE
  5
126
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:5
140
1.0
141
5.0
290
     0
  0
SCALE
  5
127
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:8
140
1.0
141
8.0
290
     0
  0
SCALE
  5
128
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:10
140
1.0
141
10.0
290
     0
  0
SCALE
  5
129
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:16
140
1.0
141
16.0
290
     0
  0
SCALE
  5
12A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:20
140
1.0
141
20.0
290
     0
  0
SCALE
  5
12B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:30
140
1.0
141
30.0
290
     0
  0
SCALE
  5
12C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:40
140
1.0
141
40.0
290
     0
  0
SCALE
  5
12D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:50
140
1.0
141
50.0
290
     0
  0
SCALE
  5
12E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:100
140
1.0
141
100.0
290
     0
  0
SCALE
  5
12F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
2:1
140
2.0
141
1.0
290
     0
  0
SCALE
  5
130
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
4:1
140
4.0
141
1.0
290
     0
  0
SCALE
  5
131
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
8:1
140
8.0
141
1.0
290
     0
  0
SCALE
  5
132
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
10:1
140
10.0
141
1.0
290
     0
  0
SCALE
  5
133
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
100:1
140
100.0
141
1.0
290
     0
  0
SCALE
  5
134
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/128" = 1'-0"
140
0.0078125
141
12.0
290
     0
  0
SCALE
  5
135
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/64" = 1'-0"
140
0.015625
141
12.0
290
     0
  0
SCALE
  5
136
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/32" = 1'-0"
140
0.03125
141
12.0
290
     0
  0
SCALE
  5
137
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/16" = 1'-0"
140
0.0625
141
12.0
290
     0
  0
SCALE
  5
138
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/32" = 1'-0"
140
0.09375
141
12.0
290
     0
  0
SCALE
  5
139
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/8" = 1'-0"
140
0.125
141
12.0
290
     0
  0
SCALE
  5
13A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/16" = 1'-0"
140
0.1875
141
12.0
290
     0
  0
SCALE
  5
13B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/4" = 1'-0"
140
0.25
141
12.0
290
     0
  0
SCALE
  5
13C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/8" = 1'-0"
140
0.375
141
12.0
290
     0
  0
SCALE
  5
13D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/2" = 1'-0"
140
0.5
141
12.0
290
     0
  0
SCALE
  5
13E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/4" = 1'-0"
140
0.75
141
12.0
290
     0
  0
SCALE
  5
13F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1" = 1'-0"
140
1.0
141
12.0
290
     0
  0
SCALE
  5
140
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1-1/2" = 1'-0"
140
1.5
141
12.0
290
     0
  0
SCALE
  5
141
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3" = 1'-0"
140
3.0
141
12.0
290
     0
  0
SCALE
  5
142
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
6" = 1'-0"
140
6.0
141
12.0
290
     0
  0
SCALE
  5
143
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1'-0" = 1'-0"
140
12.0
141
12.0
290
     0
  0
ACDBSECTIONVIEWSTYLE
  5
1A7
102
{ACAD_XDICTIONARY
360
386
102
}
102
{ACAD_REACTORS
330
1A5
102
}
330
1A5
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
100
AcDbSectionViewStyle
 70
     0
 71
     0
 90
       78
 71
     1
340
11
 62
   256
 40
0.24
340
0
340
0
 62
   256
 40
0.24
300
I, O, Q, S, X, Z
 40
0.48
 90
        3
 40
0.18
 90
        1
 71
     2
340
16
 90
       25
 62
   256
340
16
 90
       50
 62
   256
 40
0.24
 40
0.0
 40
0.24
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewSectionStartId>%-%<\\AcVar ViewSectionEndId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
 62
   256
 62
   257
300
ANSI31
 40
1.0
 90
        0
290
     0
290
     0
 90
        6
 40
0.0
 40
1.570796326794896
 40
0.2617993877991494
 40
1.308996938995747
 40
-0.2617993877991494
 40
1.832595714594046
  0
TABLESTYLE
  5
A7
102
{ACAD_XDICTIONARY
360
FF
102
}
102
{ACAD_REACTORS
330
A6
102
}
330
A6
100
AcDbTableStyle
280
     0
  3
Standard
 70
     0
 71
     0
 40
0.06
 41
0.06
280
     0
281
     0
  7
Standard
140
0.18
170
     2
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.25
170
     5
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.18
170
     5
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  0
VISUALSTYLE
  5
9B
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
2dWireframe
 70
     4
177
     3
291
     0
 70
    58
 90
        0
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9A
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Basic
 70
     7
177
     3
291
     1
 70
    58
 90
        1
176
     1
 90
        0
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A1
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Brighten
 70
    12
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
50.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A5
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
ColorChange
 70
    16
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        3
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     8
420
  8421504
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     8
420
  8421504
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9E
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Conceptual
 70
     9
177
     3
291
     0
 70
    58
 90
        3
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        2
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
40.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A0
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Dim
 70
    11
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
-50.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
172
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
EdgeColorOff
 70
    22
177
     3
291
     1
 70
    58
 90
        2
176
     0
 90
        2
176
     0
 90
        0
176
     0
 90
        0
176
     0
 40
0.6
176
     0
 40
30.0
176
     0
 62
     7
420
 16777215
176
     0
 90
        1
176
     0
 90
        4
176
     0
 62
     7
176
     0
 62
   257
176
     0
 90
        1
176
     0
 90
        1
176
     0
 40
1.0
176
     0
 90
        8
176
     2
 62
     7
176
     0
 40
1.0
176
     0
 90
        1
176
     0
 90
        6
176
     0
 90
        2
176
     0
 62
     7
176
     0
 90
        5
176
     0
 90
        0
176
     0
 90
        0
176
     0
290
     0
176
     0
 90
        1
176
     0
 40
0.0
176
     0
 90
        0
176
     0
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A4
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Facepattern
 70
    15
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
96
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Flat
 70
     0
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        1
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
97
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
FlatWithEdges
 70
     1
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        1
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
98
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Gouraud
 70
     2
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
99
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
GouraudWithEdges
 70
     3
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9D
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Hidden
 70
     6
177
     3
291
     0
 70
    58
 90
        1
176
     1
 90
        2
176
     1
 90
        2
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        2
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        2
176
     1
 90
        1
176
     1
 40
40.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
170
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
JitterOff
 70
    20
177
     3
291
     1
 70
    58
 90
        2
176
     0
 90
        2
176
     0
 90
        0
176
     0
 90
        0
176
     0
 40
0.6
176
     0
 40
30.0
176
     0
 62
     7
420
 16777215
176
     0
 90
        1
176
     0
 90
        4
176
     0
 62
     7
176
     0
 62
   257
176
     0
 90
        1
176
     0
 90
        1
176
     0
 40
1.0
176
     0
 90
       10
176
     2
 62
     7
176
     0
 40
1.0
176
     0
 90
        1
176
     0
 90
        6
176
     0
 90
        2
176
     0
 62
     7
176
     0
 90
        5
176
     0
 90
        0
176
     0
 90
        0
176
     0
290
     0
176
     0
 90
        1
176
     0
 40
0.0
176
     0
 90
        0
176
     0
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A3
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Linepattern
 70
    14
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        7
176
     1
 90
        7
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
171
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
OverhangOff
 70
    21
177
     3
291
     1
 70
    58
 90
        2
176
     0
 90
        2
176
     0
 90
        0
176
     0
 90
        0
176
     0
 40
0.6
176
     0
 40
30.0
176
     0
 62
     7
420
 16777215
176
     0
 90
        1
176
     0
 90
        4
176
     0
 62
     7
176
     0
 62
   257
176
     0
 90
        1
176
     0
 90
        1
176
     0
 40
1.0
176
     0
 90
        9
176
     2
 62
     7
176
     0
 40
1.0
176
     0
 90
        1
176
     0
 90
        6
176
     0
 90
        2
176
     0
 62
     7
176
     0
 90
        5
176
     0
 90
        0
176
     0
 90
        0
176
     0
290
     0
176
     0
 90
        1
176
     0
 40
0.0
176
     0
 90
        0
176
     0
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9F
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Realistic
 70
     8
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17F
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded
 70
    27
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     8
420
  7895160
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        5
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17E
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded with edges
 70
    26
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        2
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        5
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17B
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shades of Gray
 70
    23
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        3
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        2
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
     7
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
40.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17C
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Sketchy
 70
    24
177
     3
291
     0
 70
    58
 90
        1
176
     1
 90
        2
176
     1
 90
        2
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        2
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
     7
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
40.0
176
     1
 90
       11
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        6
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
A2
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Thicken
 70
    13
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
       12
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
9C
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Wireframe
 70
     5
177
     3
291
     0
 70
    58
 90
        0
176
     1
 90
        2
176
     1
 90
        0
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
VISUALSTYLE
  5
17D
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
X-Ray
 70
    25
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
0.5
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
1001
ACAD
1000
AcDbSavedByObjectVersion
1070
     0
  0
DICTIONARYVAR
  5
227
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
60.000000
  0
DICTIONARYVAR
  5
EB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1:1
  0
DICTIONARYVAR
  5
EA
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
AB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
1B4
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
1B5
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
5A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
5E
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
226
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14B
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
224
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
223
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
225
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
127
  0
DICTIONARYVAR
  5
228
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARY
  5
385
102
{ACAD_REACTORS
330
383
102
}
330
383
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
384
102
{ACAD_REACTORS
330
383
102
}
330
383
100
AcDbDictionary
281
     1
  3
1654967909088
350
37E
  3
1654967909104
350
37F
  3
1654967909120
350
380
  3
1654967909136
350
381
  3
1654967909152
350
382
  0
DICTIONARY
  5
388
330
1A9
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
389
  0
DICTIONARY
  5
191
330
22
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
185
330
93
100
AcDbDictionary
280
     1
281
     1
  3
FBXASSET
360
186
  0
DICTIONARY
  5
183
330
92
100
AcDbDictionary
280
     1
281
     1
  3
FBXASSET
360
184
  0
DICTIONARY
  5
10B
330
94
100
AcDbDictionary
280
     1
281
     1
  3
BUMPTILE
360
10D
  3
DIFFUSETILE
360
10C
  3
FBXASSET
360
187
  3
OPACITYTILE
360
10E
  3
REFLECTIONTILE
360
10F
  0
DICTIONARY
  5
386
330
1A7
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_XREC_ROUNDTRIP
360
387
  0
DICTIONARY
  5
FF
330
A7
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_ROUNDTRIP_2008_TABLESTYLE_CELLSTYLEMAP
360
37C
  0
XRECORD
  5
37E
102
{ACAD_REACTORS
330
384
102
}
330
384
100
AcDbXrecord
280
     1
  1
AcDb_Thumbnail_Schema
102
{ATTRRECORD
341
37F
  2
AcDbDs::TreatedAsObjectData
280
     1
291
     1
102
ATTRRECORD}
102
{ATTRRECORD
341
380
  2
AcDbDs::Legacy
280
     1
291
     1
102
ATTRRECORD}
  2
AcDbDs::ID
280
    10
 91
        8
102
{ATTRRECORD
341
381
  2
AcDs:Indexable
280
     1
291
     1
102
ATTRRECORD}
102
{ATTRRECORD
341
382
  2
AcDbDs::HandleAttribute
280
     7
282
     1
102
ATTRRECORD}
  2
Thumbnail_Data
280
    15
 91
        0
  0
XRECORD
  5
37F
102
{ACAD_REACTORS
330
384
102
}
330
384
100
AcDbXrecord
280
     1
  1
AcDbDs::TreatedAsObjectDataSchema
  2
AcDbDs::TreatedAsObjectData
280
     1
 91
        0
  0
XRECORD
  5
380
102
{ACAD_REACTORS
330
384
102
}
330
384
100
AcDbXrecord
280
     1
  1
AcDbDs::LegacySchema
  2
AcDbDs::Legacy
280
     1
 91
        0
  0
XRECORD
  5
381
102
{ACAD_REACTORS
330
384
102
}
330
384
100
AcDbXrecord
280
     1
  1
AcDbDs::IndexedPropertySchema
  2
AcDs:Indexable
280
     1
 91
        0
  0
XRECORD
  5
382
102
{ACAD_REACTORS
330
384
102
}
330
384
100
AcDbXrecord
280
     1
  1
AcDbDs::HandleAttributeSchema
  2
AcDbDs::HandleAttribute
280
     7
 91
        1
284
     1
  0
XRECORD
  5
389
102
{ACAD_REACTORS
330
388
102
}
330
388
100
AcDbXrecord
280
     1
102
DISPLAYNAME
  1
Imperial24
102
FLAGS
 90
        0
  0
XRECORD
  5
186
102
{ACAD_REACTORS
330
185
102
}
330
185
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
7581DE8E-A623-425F-9BF4-B3F4BE6C4F9A
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623B9A2F3B5FEC0000007C01000008000000636F72652E786D6C8D90416E83301045AF62CDB632D8040820E328B4E204BD80653BC44AB011B6AB1EBF262152BBEB6A467FFE9B197D76FA9EEFE84BAFDE38DB03CD08206DA553C64E3DC470C10DA01367AB73E1970D9015B3EE61
310
9381B3697571D925E96CD03624D53AA5775178AF0320794F4D0F5E5EF52C32114372F85BB608791393CEE8AB4B708C46A1E711A3D23E73317A055E0D4D53D6C71A9FC7A1C6657D18703354232ECFED4731B6B43CBED72CDF60CE82995FF7E5AA45D00A7841488B29C5A4F8A46547AAAEA8DE48D311C2F2CDFE078A8BFA2714
310
8D0D87627FF78979E0343DF21870966F59A4F2082AD52D37FE03504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623B6E137E0172010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C0810121947A1554ED00B38E05014B091B1518EDFE511A5A9D22AFD2A1F60CDEC7A67C698ED2E6D8306
310
69FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7166B4B65FCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B0FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2601EE7691A25EBC4DB1FF2C48B9255EEA5797C
310
F0A2FDE62D3C6C8268FD9A3032367366EBF6AAAE30525859621E52BAF182C0A3E17B106D69BC0DE3179A6E2965642CBF6B725DF96493AB955D858BDCB9ADC73C002113F1CD2D4464512F06D04338236388F09912BE0F1A028190AD3836571F67800659586D22604AED6ED4201A27612AF5E9F4A09F178CCC9D3075DA1C5C3F
310
9C113E3DE3F71DE1A885AAC084B0B03C3A3BEA64B38625B44E1A6FB017A4B46945F39C8D5F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F02504B0304140006080800AC70623BE001BAC07D0000009D0000000B0000006662782F636E782E786D6C4DCCD10AC2201886E15B91FFDCA6536B037548D87D8CE686
310
E4344CA3CB6F8B1D74F4C1C3C72B87CF1AD0DBE5974F51013D11402EDED3E4E3A2A096197780062D734AE5EF06288EAB53B03368B9E4549F074D6E1E6B289B061F1F07124689687987B9601C7373BD60C36E065B6A6DDF7341A93843A365F32B6DBB87F517504B0304140006080800AC70623B8E5068122901000012020000
310
310000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C8D515B6EC32010BC0AE22B55850D364E93081345557A825E801892A2C460F1A872FC2EB523B57FF961D1EECCECECAED8DFC71BFA36215AEF7ACC2A8A917183D7D65D7A9CD3996C30DA4B
310
11BC4F7F601839359A1E973496E2127C9E96D4E05D322E41D6796D96A48AD1248C861B7C7A1C872F33AA4AE5048878AD26355CD5C554AC8232E0A4882980013437292F96B465B46BF886F0AEE5841FDEDFC8A1FD3890233B1EB75BDE31D6AD453D13A5C8D9EA856E35D8B1676BC2B322852C45B2E3C3FE108C4A4663D950BA
310
258C11DA7C32BEA3DDAEE95EE96647A9A80BFC1F294FFA4952B62EB5CD6277A6452C99A8E78214DAE7D3ED61C6DC271F122AFD56D10C2F305545CB6A60FC1908E383E29A2F8A31F900EB5D5D4F8065DD2CBBE652D4E542107ECF07B15C53FE00504B0304140006080800AC70623B503B51794E010000330300003000000066
310
62782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F
310
77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347
310
DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F
310
504B0304140006080800AC70623B38FA165F680500003C100000340000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F6F626A656374732E786D6CAD575D6FA33814FD2B887D0E8424EDB42BCAA8499A2A1A756634D18CF6A15264C0A16CC146B6E9A4FBEBF7180C
310
019276B21F7908D8D8F7F3DCE36BFFE33ECFAC172A64CAD98DED3963DBA22CE271CA921BBB54BBD1956D7D0C7CC1B9EA2CB32D46727A63EB693BF013C1CBC24CC57447CA4C0D6657F33F2C1951466D2BCA889437B68C9E684E1C522A1E53F9ECC4441127D9ED1DCFA917F6C52682144F03A105119429588A790629566D94D7
310
1F8E6D37F05DFD3DF0F5BF59357D7B955BF9D3D79F32A9088B8E940DC44CBDD9F26E72713DBA98CDA6A3D9E5C41BCD57F3E5C8FB301D2F2E178BEBDBBB6B28964A4092B144D09D1DDC2336228D7CB7FED45A6C0C3F6552C419A351E53F3CAC6C3612635A5016238F2995D0D6F17ADC1F7A3A369DCF533D362ABBD3E779D5DD
310
D111D4D8DE3CBB96F2F04FB820CF41859054A3AA8E8F71B4C6DFF810B590F3CC7C4BA5951345454A322B4B4341C4AB1D60A95E12F83D311A9D42235C7B6007DE415ED75694C6AFB17BCACA5D99651A9A7650217B0BFC53252BCBD2BFA838AD0D36215765CAD4957148BD16D40EAE7DB79A0C7CFD984ECCC73A90D62E230952
310
0E37EBAF034717BAF6D64B3BF8B40AF71B5D8FA79517821754280D1F40AB495CF3D451326ABDB332A737C0995ECC0F41F986C87F46F91E4C41DE44BA9FED67468B1284C91D173972E38CAB9F356E5E46EDDBF10BF86CB0FA784D3BF3AF16FB6E6B6C9F30DECA1FC0A55373F5DFF3D78F5917A99DF405FE0B0A8C8BA909E526
310
2219A8E72165488806A595714C81CB77E1DE0ED6604A303B76912C680372F4E2BB2FF88EFF5A36D8AA52DF79322474C0B767303F625995056C7B032C473C592936CEBD15F38BFFA5666E979B4F9B52EC48441F0CB12CE92E65A9C2D979006FD7A05E227A1E3DD3D79F5CC470F438099B6E1272A34A22DA3AE63AF0497358E8
310
C141734F41847D09D79CE7FF42C3432A239A6584515E365ADA634863B52519D327A00AEB804E2703140BFA92EA4EA2B7A26716CEFA48A4850E597BE8B53CEDBCE1CBF7F56780D20EE6AF73A0F5F9B02A3CD07DC4332EB6E1EBB666421BE0C39E3EBA7FF4E16D22EA6A29407C85E586724C88B771BADB9512BC7B228A3FD68B
310
6EA65A22397E690AA8D158D7E40CEC8CDA23C2C0B7D1898640101CEC9C6D531CE328CB93CABBBA870A6425F70DF96199175B92F392A973C2346EFC69AC6F8577BB18F993A8E8C90E36D573340765C7343EA4AA87027D049DF0A9979E0F1757DEF2EEEA6E747B39412B35B9588DAEE7ABD9683E5DCDE677978BD9EAFAB6B5A8
310
B224F09B13AA5B8388264E44BF14A909F3F7F5A16CEDE08128E9DED705E526F5F3FBDA415BECBBD80380B71BD77991D19C3245347C1FF44BF68DA0ABE8C9A8E7D73949E81952BEDC6F063660E68C7D5F75A9D19F83BD6676A16BE1A410F554E621236936D8681C770A9618B79B50B6CF9AD19BA11E9978A20F953C4B63104E
310
6C2594E7548176CE607B915309C474BBF2D8DC1ECED8FD52F7838A84196D2C79226889330954036E65A4FAF3D66F68E174177563E3B0739EF1670AD1B690EA1B1BFCA6D2884A27C4F1A81B9F4A3820802EAC2541408DB02443675D6F6AC7ED2E1D1BD00F4E40A3BF5D724EB764FCEA116F4E8A02A7768F562BDB8C82E81F39
310
DE98631185D7B054AD2F8789D6994A0D2AAB76CADC0DD0423C1BD57BD4D7FB6E794EB5A61791B3EE49EF82A0963A524424D5BD40DB674CBA5D7E75D10A58EB2F569195097279BEA491A00073A90B1C28022A8CCC82284075F1FBE357C17117CDAD550A083C2E789E736606B7E62E6B6D9E70338D1F410B545F3FE464EC798F
310
55D76F2E22DB9048EA90583E63A22938EDC1006B00E4D1716A52E0EA1C0C96AF9796393066105A81F6A829ADAFE1168A47DF1C75A974C9B278B7F177ABA5008340CB1EFC0D504B0304140006080000AC70623B000000000000000000000000350000006662782F30333130353234382D343533342D344143372D413346412D
310
4531454539393435313135362F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E636660600000504B0304140006080000AC70
310
623B000000000000000000000000370000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30333130353234382D343533342D344143372D41
310
3346412D4531454539393435313135362F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11D
310
E607FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BF2C5666EFF000000A00100003B0000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F7265736F7572636573
310
2F636F72652E786D6C8D504B6E833010BD0A9A6D65B00910888CA3D02A27E8052C33A156821DF953F5F8B5132AB5BB6E6646EFA3797AFCF8B5DE8A4F745E5B33022B291468949DB5594688E1427A288E823B6BC32F191446AE38428641F0C5D978DF20654D4013126AEC8C1B28BDC70085BAA56304AF3E7095A58C2129FCB5
310
BC4B75950B96AC4C74D209EE834B018AE7933C4138F4363A859E574F56F018F5BC69F49C7EEA8B4607A29DFABEE9F62D399DA78E34DD6E22FDD49E49731ADEEAF3C09AFD6BC7AB6C163CE8F527A3722803CE206A4A07C218A1F53B6B0EB43DD4ED0BED0F94F22ACBFF98E27DFEA7296A1376F516F769F320580AF22004AF72
310
5F693DCA4C3B772BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B200
310
00005B436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623B9A2F3B5FEC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D
310
6C504B01021400140006080800AC70623B6E137E0172010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623BE001BAC07D0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B010214001400060808
310
00AC70623B8E506812290100001202000031000000000000000000000000005B0500006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D3
310
0600006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6C504B01021400140006080800AC70623B38FA165F680500003C10000034000000000000000000000000006F0800006662782F30333130353234382D343533342D344143372D413346412D4531
310
454539393435313135362F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000290E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F76657274696365732E62696E504B01021400
310
140006080800AC70623BF270F133060000000400000036000000000000000000000000007C0E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000
310
000000000000000000D60E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD1900000004101000036000000000000000000000000002B0F00006662782F30333130353234382D
310
343533342D344143372D413346412D4531454539393435313135362F6469726563746F72792E786D6C504B01021400140006080800AC70623BF2C5666EFF000000A00100003B000000000000000000000000000F1000006662782F30333130353234382D343533342D344143372D413346412D453145453939343531313536
310
2F7265736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000671100000000
  0
XRECORD
  5
184
102
{ACAD_REACTORS
330
183
102
}
330
183
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
778E3A9F-1AF3-452F-85C1-1BC15BD3F630
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BFD5588D4EC0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103891DC7C24471939CA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EF81EEFE8CBCCC17AD7012D0820E394D7D60D1DA478C50DA083E0B3F7F1970D9093A3E960
310
9141F061F6695A25E55D342E66D5796D56518660222075CF4D07417D9A511632C5EC08B76292EA260753D05797E194AC46CF2356E77DF66ACD0C62C768BD63971E5727D2E06DDF9C71BF7B3FE10BABF79BFA488FE4DCF07281058F767CDD57B391D168108C903DA61413F641B72DA95A56BD91A62584978BFD0F9426FD4F28
310
5917376C7DF7890510343FF218085E2E59E4F2082AD72537F103504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB5D38BAD72010000D40300000C0000006662782F636F72652E786D6CC553DB8E823014FC95A6AF1B68C11B9A52A3AB7EC1FE4085CA36424B4A4BFCFC3D5C8CEBC635EED3F200CDCC393D3353CAD697AA44AD
310
B48D323AC5514831923A33B9D2458ABD3B0509466BCEAC31EE5B19465A5432C51D8C392BACF1F50865463BA91DA0DAE4720445D348875156C222C54DF6292B110AEFA0A23987B5C8CEA2906114020D759C35CE8200340CE9DE989F8E1746069C33EF553EB22A8769EAA4A4C57C1147F3457CD806B31D4D82E936D907DBC5FB
310
2E38C4F3E564BE8936749F30D23573E65475559759299CCC318F295D065114D0F8239AAEE86C15CFDE68B2A29491AEFCAEC9D7F98B4D5E69378947B9435B837904427AE2875B88C8A146B4A0877046BA10E1D3277C1F340402213B712CAF3ECE00B53273C64E81C98DBF51AD28BD84A934A4FD837E5F303274C2D47E7370FD
310
7046FCF28CE73BC2510B5D8009E16079F4AED3C9060D6368B5B441EB2E481B5B89F2351B4F1CFE89BA897F282933A5B1FFA5888C0744C6DF8374F7917F01504B0304140006080800AC70623B09885E1C7E0000009D0000000B0000006662782F636E782E786D6C4DCCDF0A83201C86E15B91DFB9CBA6FD11D41063F711CB42
310
663A9C8E5DFE6A74B0A30F1E3E5E317C368FDE36BD5C0C12EA0B0164C33DCE2EAC124A5E700F685022C598FF6E80C2B459090783126B8AE579D26C97A9F8BCAB77E17122E586D5843498B3EE8699D114F39E5E713D76EDA84DCBB569A052A2FA95F63DC2EA0B504B0304140006080800AC70623B961D28872A010000120200
310
00310000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C8D515B6EC32010BC8AC557AA0A1BFC4A1C61A2C8514FD00B10435294182C1E558EDFA576A4F62F3F80666766875D76784CF7EC5B39AFADE911CD09CA9419ADD4E6DAA3182E7887B203
310
67CEDAF08786322326D5A30423CEAECEC67985466B8232015063A55A41E1BD0A281BEFF0E8911FBFD42472110330FC2D9FC578135795D31CCAC0E3CC070701B2A5493A11AFBAA1A68434B8ABB71FB81E8E15EE765589E969DB9E8E43DB1D8786158B90B318B55CE55A421C7DD1CABD6A92C49C053D3DE38F4E89A024E22521
310
1DA61493F293D67BD2ECCBE69DECF684B022D1FF89E22C5F14456D4255AE711799479CB2622970266D3CDF9F61D463B62E64A9DFC6ABF10D7192C35CCA0A040B11BE0F8E6DBD3AFA601D8C77733B0397C290926D5B7356A40DC1F5BB3EB8D336F90F504B0304140006080800AC70623B503B51794E01000033030000300000
310
006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1E
310
BC4F77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C54
310
2347DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F
310
103F504B0304140006080800AC70623B2EA4D28F640500003C100000340000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F6F626A656374732E786D6CAD575D739B3814FD2B0CFB6C30B1D3263B844E6CC71D4F376DA79E76F621331E01326103122389C4E9AFDF
310
231018B09D7A3FFC609090EEE7B94757FE875D9E59CF54C894B31BDB73C6B64559C4E394253776A9B6A32BDBFA10F88273D559665B8CE4F4C6D6D376E027829785998AE99694991ACC2E677F5A32A28CDA569411296F6C193DD29C38A4543CA6F2C98989224EB2DD399E532FEC8B4D04291E07420B222853B014F30C52ACDA
310
28AF3F1CDB6EE0BBFA7BE0EB7FB36A727A955BF9D3D79F32A9088B0E940DC44CBCE9E2EEE2F27A74399D4E46D37717DE68B69C2D46DEFBC978FE6E3EBFBEBDBB8662A90424194B04DDDAC147C446A491EFD69F5A8B8DE1C74C8A386334AAFC878795CD46624C0BCA62E431A512DA3A5E8FFB434FC7A6F379A2C7466577FA3C
310
AFBA3B3A821ADB9B67D7521EFE0517E439A810926A54D5F1318ED6F81BEFA316729E996FA9B472A2A84849666569288878B5032CD54B02BF2746A35368846B0FECC0DBCBEBDA8AD2F835768F59B92DB34C43D30E2A646F807FAA646559FA938AE3DA60137255A64C5D1987D46B41EDE0DA77ABC9C0D78FC985F95807D2DA66
310
2441CAE166FD75E0E85CD7DE6A61079F96E16EADEBF1B8F242F0820AA5E1036835896B9E3A4A46AD7756E6F40638D38BF93E28DF10F9CF28DFBD29C89B4877D3DDD468518230B9E522476E9C71F5B3C6CDCBA87D3B7C019F0D561FAE6967FED562DF6D8DED13C6A9FC015C3A3557FF3D7FFD987591DA495FE03FA3C0B89898
310
50AE2392817AEE53868468505A19C714B87C1BEEEC6005A604B36317C9823620072FBEFB8CEFF8AF6583AD2AF59D274342077C7B06F323965559C0B6136039E0C94AB171EE54CC2FFF979AB95DAC3FAD4BB12511BD37C4B2A0DB94A50A67E71EBC5D837A89E879F4445F5FB888E1E86112D6DD24E4469544B475CC75E093E6
310
B0D083BDE69E8208FB12AE39CFFF8586FB544634CB08A3BC6CB4B4C790C66A4B32A64F4015D6019D5C0C502CE873AA3B89DE8A9E5938EB2391163A64EDA1D7F2B473C297EFABCF00A51DCC5EFF20AF5DC20CF7741FF18C8B4DF8BAA999D006F8B0A78FEE1F7D789B88BA5A0A105F61B9A11C13E24D9C6EB7A504EF1E89E28F
310
D5BC9BA996480E5F9A026A34D63539053BA3F68830F06D74A2211004073B679B14C738CAF2A8F2AEEEA10259C93D213F2CF36243725E32754E98C68D3F8DF5ADF06E17235F888A1EED605D3D473350764CE31309D547D0119F7AE979FFFEEA6E727BBD1C79B74BB4529717CBD1D5E5DC1B79B3B977395B4C96EF2638E6FA15
310
D09C50DD1A44347122FAA5484D98BFAFF6656B07F74449F7635D506E523FBFAF1CB4C5BE8B3D0078BB71951719CD295344C3F75EBF64DF08BA8A9E8C7A7E9593849E21E5CBC7F5C006CC9CB1EFAB2E35FA32D86B66E7BA168E0A518F651E329266838DC671A7608971BB0965FBAC19BD19EA918927FA50C9B33406E1C45642
310
794E1568E70CB6173995404CB72B8FCDEDE18CDDCF753FA84898D1C6924782963893403548A78C547FDEFA0D2D9CEEA26E6C1C76CE13FE4C21DA16527D6383DF541A51E984381E75E353090704D085B52408D0139664E8ACEB4DEDB8DDA56303FAC10968F4B74BCEE9968C5F3DE2CD4951E0D4EED16A659B5110FD23C71B73
310
2CA2F01A96AAF5653FD13A53A909C03570A77DA0857832AA77A8AFB7DDF29C6A4D2F2267DD93DE04412D75A48848AA7B810EBA31E976F1D5452B60ADBE58455626C8E5F992468202CCA52E70A008A830320BA200D5F9EF0F5F05C75D34B7962920F030E779CE9919DC9ABBACB57EC4CD347E002D507DFD901763CF7BA8BA7E
310
7311D984445287C4F209134DC1690F065803200F8E53733D73750E06CB570BCB1C185308AD407BD094D6D7700BC5A36F8EBA54BA6459BCD9F8BBD552A040A0650FFE06504B0304140006080000AC70623B000000000000000000000000350000006662782F33394334313030352D393437462D344341332D393833322D3144
310
373644414336394143352F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B
310
000000000000000000000000370000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F33394334313030352D393437462D344341332D393833
310
322D3144373644414336394143352F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607
310
FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623B95BFD5E5FE000000A00100003B0000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265736F75726365732F63
310
6F72652E786D6C8D50596E833010BD0A9ADFCA603B1B41C611699213F40296992456828DBC543D7E4DA052FBD79F99D15B344F4F1CBE8667F1893E18675B60258502AD76BDB1B71652BC921A8A8314DEB9F84B06855503B630C120C5CDBB342E907636A28D19B5AEC70554216084423FF3D142D0771C54A952CC8AF02847A5
310
1FEA86252B339D755284E87380627E324D901E834B5E6310D5CC4A9192E9178DE9F34F7335E841EE38DBEEF8A5239B13ADC9FA589FC971F77E2217BEDDAFB61DEBE8B916D56496229AE127A3F6A822F62039A57BC218A1FC83AD1BBA69F8E68DD60DA5A29AE47F4C69ECFF694AC6C6155FE2CEB60092E5202F428A6AEA2BAF
310
5799794FDDCA6F504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B
310
436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BFD5588D4EC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D6C504B
310
01021400140006080800AC70623BB5D38BAD72010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623B09885E1C7E0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B01021400140006080800AC70
310
623B961D28872A0100001202000031000000000000000000000000005C0500006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D5060000
310
6662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6C504B01021400140006080800AC70623B2EA4D28F640500003C1000003400000000000000000000000000710800006662782F33394334313030352D393437462D344341332D393833322D3144373644
310
414336394143352F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000270E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F76657274696365732E62696E504B01021400140006
310
080800AC70623BF270F133060000000400000036000000000000000000000000007A0E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000000000
310
000000000000D40E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000290F00006662782F33394334313030352D393437
310
462D344341332D393833322D3144373644414336394143352F6469726563746F72792E786D6C504B01021400140006080800AC70623B95BFD5E5FE000000A00100003B000000000000000000000000000D1000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265
310
736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000641100000000
  0
XRECORD
  5
10D
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10C
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
187
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
 70
     0
 90
1778669749
  1
7E355024-1ABF-47F9-966E-F2159FBE82AB
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BDCE527C8EB0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103B15DC7C24471249FA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EFA9EEFE8CBACC17AD7032D0820E394D7D64D3DA478C52DA093E0ABF7F1970D9093B3E961
310
9341F069F569D925E55D342E66D5796D76518660222075CF4D0F417D9A591632C5EC08B76291EA262753D05797E194AC46CF2356E77DF66ACD0A621C9B73335C463C5E0E1457EC9DE2A1612D3E9233A92BD2D66333F07283058F767EDD57AB91D168108C9023A61413F641AB8ED41DABDF48DB11C2CBCDFE074A8BFE2794AC
310
8B07B6BFFBC402089A1F790C042FB72C72790495EB969BF801504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF32603847
310
2BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB24894EB71010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C085012194749244ED00B38E05014B091B1518EDFE511A5A9D228FD2A1F60CDEC7A67C6986D2F6D830669
310
FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7266B4B6DFCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B4FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2609EE7C92ED91F722F3FAC022F0ADF036F9F84A9
310
B7A63B1A47348DF364CFC8D8CC99ADDBABBAC2486165897948E9DA0B028F861F41B4A1F1268CDF68BAA19491B1FCAEC975E58B4DAE5676152E72E7B61EF300844CC40FB7109145BD18400FE18C8C21C2674AF83E68080442B6E2D85C7D9C011A6461B5898029B5BB5183689C84A9D4A7D3837E5F303277C2D4697370FD7046
310
F8F28CE73BC2510B5581096161797476D4C9660D4B689D34DE602F4869D38AE6351B4F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F01504B0304140006080800AC70623B3A54DFB77D0000009D0000000B0000006662782F636E782E786D6C4DCCD10A83201805E05791FFDEA5EBA76DA046A37C8F581632D3
310
613AF6F8B3D1C52E0E073E0E47B49FD591B7899B0D5E023F3120C63FC264FD2221A7995E81B44AC410D2DF0C881F5723616750628921BF0E9ACC3C66978A3AEB9F07B2A6D77AB87514F95953EC39D20EEF9C6AD60C88BC2EB940A544F57B2ABD1FAB2F504B0304140006080800AC70623B4A17098729010000120200003100
310
00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C8D515B6EC32010BC0AE22B55850D0E76930813A54A7C825E80DA244589C1E251E5F85D6A476AFFF2018B7667666759B1BF8F37F4AD7D30CEB6981514236D7B37187B69718A67B2C1682F8577
310
2EFE816164D5A85B9CD3588A8B77695A52BDB351DB0859EB06BD2455083A62D4DFE0D1E2D07FE951152A4540846B31A9FEAA2EBA600594012745881E0CA0B949BEB1A4CDB1EB4EDB03E1ACEA083F324E0EFC9D918E3627CED91ACE9B2867A214299961A19B01EC98B3D1FE59914C96229AF161BFF75A453D605951BA258C11
310
5A7D30BEA3F5AEAA5FE96647A92833FC1F294DC393A4646C5C578BDD9916B064A29C0B520C2E7DDE1E66F47D723EA2DC6F1574FF02531594D6AC69443903617C506CF8A218A2F3F0BDABEB2760593DCB365C8A326F08C2EFFA20E66DCA1F504B0304140006080800AC70623B503B51794E0100003303000030000000666278
310
2F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F7736
310
4A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347DEE0
310
50F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F504B
310
0304140006080800AC70623BD8F6D0D5660500003B100000340000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F6F626A656374732E786D6CAD575B8F9B3814FE2B887D064292B964C5504D92491555D3568D5AEDC348910187610730B2CD4C667FFD7E06438024
310
6DF6928780CDF1B97EE762EFC33E4B8D57CA45C2F23BD3B547A641F39045491EDF99A5DC59B7A6F1C1F73863B243661A39C9E89DA9B64DDF8B392B0BBD15D11D295339D85DCDFF304448736A1A614A84B83345F84C33629352B2888A173B2292D8F16E6FBB764DD8671B73523C0F981684D35C4253ECE7E062D44AB9FDE5C8
310
747CCF51DF7D4FFD6BAAC9792AA7B2A72F3FC985247978246CC066E24E970FE3AB9975359D4EACE9F5D8B5E6ABF9D2726F26A3C5F56231BB7F9841B0901C9CB4269CEE4CFF237CC393D073EA4FADC65AF1532A852CCF6958D90F0B2B9D35C78816348F10C7840A48EB583DEA2F5DE59BCEE7895A6B91DDEDCBACEA9EE8306A
310
746F9E5D4D59F0274C1097A0820BAA5055FB471B5AE36F74F05AC058AABF25C2C888A43C21A991260127FCDDF441AA487CAFC746A1932B842B0B4CDF3DF0EBEA8AD4F835764F69B92BD35441D3F42B646F817F2A45A559F217E5A7A54127C4AA4C7279AB0D92EF0535FD99E7549BBEA71E93B1FE583BD2D8A52446C86166FD
310
7560E842E5DE7A69FA9F56C17EA3F2F1B4F082B38272A9E0036835816B9ECA4B5AAC7B51E4D40118D3F3F9C129DFE0F9CF48DF832A881B4FF6D3FD544B919CE462C77886D8D8A3EA678C9A17AB7D3B7E413D1B501FD3B43BFF8AD8735A65FB05E35CFC002E159ADBFF1EBFBECFBA48ED84CFF75E91608C4FB42B372149517A
310
1E931C0151A03452862DD4F25DB037FD352A252A3B4E91D46F1D72F4E239AFF88EFF9A37AA5525BEF3CC11D041BDBDA0F2C397555A40B7336039AA9395606DDC399F5FFD2F3973BFDC7CDA947C4742FAA80BCB92EE923C91E89D07F07615EA05A267D10B7D7F633C82A1C741D8748390695102DE563E578E8F9B66A11607C9
310
3D0121CEC54CD53CEF17121E1311D2342539656523A56D430AAB6D91D17302B2B076E8643C4031A7AF899A247A143DB5D0EB439E14CA656DD36BEBB47DC696EFEBCF0025E8531690F440141CAA7DC852C6B7C1FBB62E8426B087237D70FFE8A35B3BD4515C00F80ACA4DC5D11EDE46C96E570A94DD134EFCB15E7403D5D691
310
E397267F1A89754A4E519C917A846BF43632310F7082BECEF26D822E8EAC3C29BC2B7B2840547CCFF00FCAACD8928C95B9BCC44DA3C69E46FB96797788116F4486CFA6BFA99ED61C153BA2D121543D10A80E74C2A65E786E1E265757A3F1D472EFE72B6B7AB39A59B3EBEB076B3576AF66ABF9C3EDF87EDE6A5469E27B4D83
310
EAA620BC8986E8953CD16EFEBE3E64ADE93F12299C8F753E3971FDFCBEB631157B0ECE00DFEDC17556A434A3B9240ABD8FEA25FD463054F478D4FBEB8CC4F4022E5F3E6E063A60E782735F55A6D1B7C159BDBB50B97092897C2EB32027493A38A80DB78B3CD66637AE6C9F75416F966AA5FD893154B03489506F2223A62CA3
310
1255E78262CF332A8098EE501EE9CBC305A75FEB71509220A58D26CF0413712A806AC0AD0C657FDFF80D139C1AA2EE4CF43AFB057F3A114D03A1BE3351DE6412526107E88E6AEEA998030218C2DA1A08A8913C4E3158D787DA757B4AF906E5070D50CB6F492E1996B45DBDBA9B91A240D3EE55D54A372D20FC478637EA1844
310
E23528656BCB61A335A61283CCAA8DD257034C102F5AF41EF9F573B35CBBA2E979E4A26BD24F415073B524E171752D50FA6995EE975F1D4C02C6FA8B51A4658C585ECEC9E214602E558203454085E6591009A82E7E7FFACA19AEA299B14A0081A705CB3296EBC5BDBECA1A9B675C4CA3279405AA6E1F623C72DDA76AE8D7F7
310
906D4004B549245EB0D1249CB260803500F2A89BEA10382A0603F2F5D2D00D630AA615688F66D2FA166E2079D4C551A54AB758163F9DFB9D8A1460E098D8FDBF01504B0304140006080000AC70623B000000000000000000000000350000006662782F30364446464539412D343132462D344431342D413442312D46303645
310
34343133343431372F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B0000
310
00000000000000000000370000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30364446464539412D343132462D344431342D413442312D
310
4630364534343133343431372F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607FB14
310
4396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BB40F7AF9FE000000A00100003B0000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F75726365732F636F72
310
652E786D6C8D504B6E833010BD0A9A6D65B00950828CA3109513F4029699502BC146FE543D7E4D42A576D7CDCCE87D344F8F9FBE967BF689CE6B6B7A6039850C8DB29336730F315C490BD94970676DF82583CCC8057BD860107C7636AE3BA4AC096842428D9D7007A5F7182053F774F4E0D5072E3297312485BFE5AB543739
310
63CEF244279DE03EB814207B3ED9260887DE46A7D0F3E2C90A1EA39E768D9ED24F7DD5E8408C63736E86CB1B192F0746AAF29591A1295B72A4675A57B4ADC766E0C566163CE8E527A37228034E204A4A8F843142CB775675B4EECAFA85B61DA5BCD8E47F4C719DFE698ADA8443B9C77DDA3C0896823C08C18BADAFB41E65A6
310
BD752BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B436F
310
6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BDCE527C8EB0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000094020000636E782E786D6C504B0102
310
1400140006080800AC70623BB24894EB71010000D40300000C00000000000000000000000000180300006662782F636F72652E786D6C504B01021400140006080800AC70623B3A54DFB77D0000009D0000000B00000000000000000000000000B30400006662782F636E782E786D6C504B01021400140006080800AC70623B
310
4A17098729010000120200003100000000000000000000000000590500006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D10600006662
310
782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6C504B01021400140006080800AC70623BD8F6D0D5660500003B10000034000000000000000000000000006D0800006662782F30364446464539412D343132462D344431342D413442312D46303645343431
310
33343431372F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000250E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F76657274696365732E62696E504B010214001400060808
310
00AC70623BF270F13306000000040000003600000000000000000000000000780E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E504B01021400140006080000AC70623B00000000000000000000000037000000000000000000
310
00000000D20E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000270F00006662782F30364446464539412D343132462D
310
344431342D413442312D4630364534343133343431372F6469726563746F72792E786D6C504B01021400140006080800AC70623BB40F7AF9FE000000A00100003B000000000000000000000000000B1000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F
310
75726365732F636F72652E786D6C504B0506000000000E000E0080040000621100000000
  0
XRECORD
  5
10E
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10F
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
387
102
{ACAD_REACTORS
330
386
102
}
330
386
100
AcDbXrecord
280
     1
102
DISPLAYNAME
  1
Imperial24
102
FLAGS
 90
        0
  0
CELLSTYLEMAP
  5
37C
102
{ACAD_REACTORS
330
FF
102
}
330
FF
100
AcDbCellStyleMap
 90
        3
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
    32768
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.25
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        1
 91
        1
300
_TITLE
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        2
 91
        1
300
_HEADER
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        2
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        3
 91
        2
300
_DATA
309
CELLSTYLE_END
  0
ENDSEC
  0
SECTION
  2
ACDSDATA
 70
     2
 71
     8
  0
ACDSSCHEMA
 90
        0
  1
AcDb_Thumbnail_Schema
  2
AcDbDs::ID
280
    10
 91
        8
  2
Thumbnail_Data
280
    15
 91
        0
101
ACDSRECORD
 95
        0
 90
        1
  2
AcDbDs::TreatedAsObjectData
280
     1
291
     1
101
ACDSRECORD
 95
        0
 90
        2
  2
AcDbDs::Legacy
280
     1
291
     1
101
ACDSRECORD
  1
AcDbDs::ID
 90
        3
  2
AcDs:Indexable
280
     1
291
     1
101
ACDSRECORD
  1
AcDbDs::ID
 90
        4
  2
AcDbDs::HandleAttribute
280
     7
282
     1
  0
ACDSSCHEMA
 90
        1
  1
AcDbDs::TreatedAsObjectDataSchema
  2
AcDbDs::TreatedAsObjectData
280
     1
 91
        0
  0
ACDSSCHEMA
 90
        2
  1
AcDbDs::LegacySchema
  2
AcDbDs::Legacy
280
     1
 91
        0
  0
ACDSSCHEMA
 90
        3
  1
AcDbDs::IndexedPropertySchema
  2
AcDs:Indexable
280
     1
 91
        0
  0
ACDSSCHEMA
 90
        4
  1
AcDbDs::HandleAttributeSchema
  2
AcDbDs::HandleAttribute
280
     7
 91
        1
284
     1
  0
ACDSRECORD
 90
        0
  2
AcDbDs::ID
280
    10
320
22
  2
Thumbnail_Data
280
    15
 94
      896
310
89504E470D0A1A0A0000000D49484452000001000000009108030000001BE1960600000300504C5445212830FFFFFF2128300000000000000000000000000000000000000000000000000000330000660000990000CC0000FF0033000033330033660033990033CC0033FF0066000066330066660066990066CC0066FF0099
310
000099330099660099990099CC0099FF00CC0000CC3300CC6600CC9900CCCC00CCFF00FF0000FF3300FF6600FF9900FFCC00FFFF3300003300333300663300993300CC3300FF3333003333333333663333993333CC3333FF3366003366333366663366993366CC3366FF3399003399333399663399993399CC3399FF33CC00
310
33CC3333CC6633CC9933CCCC33CCFF33FF0033FF3333FF6633FF9933FFCC33FFFF6600006600336600666600996600CC6600FF6633006633336633666633996633CC6633FF6666006666336666666666996666CC6666FF6699006699336699666699996699CC6699FF66CC0066CC3366CC6666CC9966CCCC66CCFF66FF0066
310
FF3366FF6666FF9966FFCC66FFFF9900009900339900669900999900CC9900FF9933009933339933669933999933CC9933FF9966009966339966669966999966CC9966FF9999009999339999669999999999CC9999FF99CC0099CC3399CC6699CC9999CCCC99CCFF99FF0099FF3399FF6699FF9999FFCC99FFFFCC0000CC00
310
33CC0066CC0099CC00CCCC00FFCC3300CC3333CC3366CC3399CC33CCCC33FFCC6600CC6633CC6666CC6699CC66CCCC66FFCC9900CC9933CC9966CC9999CC99CCCC99FFCCCC00CCCC33CCCC66CCCC99CCCCCCCCCCFFCCFF00CCFF33CCFF66CCFF99CCFFCCCCFFFFFF0000FF0033FF0066FF0099FF00CCFF00FFFF3300FF3333
310
FF3366FF3399FF33CCFF33FFFF6600FF6633FF6666FF6699FF66CCFF66FFFF9900FF9933FF9966FF9999FF99CCFF99FFFFCC00FFCC33FFCC66FFCC99FFCCCCFFCCFFFFFF00FFFF33FFFF66FFFF99FFFFCCFFFFFF0000000D0D0D1A1A1A2828283535354343435050505D5D5D6B6B6B787878868686939393A1A1A1AEAEAEBB
310
BBBBC9C9C9D6D6D6E4E4E4F1F1F1FFFFFF0000000000000000000000000000000000000000000000000000000000002E4550F10000003B4944415478DAEDC13101000000C2A0F54F6D0B2FA0000000000000000000000000000000000000000000000000000000000000000000000000CE06919100016C9A5B1B0000000049
310
454E44AE426082
  0
ENDSEC
  0
EOF
`;var qXe=`  0
SECTION
  2
HEADER
  9
$ACADVER
  1
AC1032
  9
$ACADMAINTVER
 90
      174
  9
$DWGCODEPAGE
  3
ANSI_936
  9
$LASTSAVEDBY
  1
win10
  9
$REQUIREDVERSIONS
160
                 0
  9
$INSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$EXTMIN
 10
1.000000000000000E+20
 20
1.000000000000000E+20
 30
1.000000000000000E+20
  9
$EXTMAX
 10
-1.000000000000000E+20
 20
-1.000000000000000E+20
 30
-1.000000000000000E+20
  9
$LIMMIN
 10
0.0
 20
0.0
  9
$LIMMAX
 10
12.0
 20
9.0
  9
$ORTHOMODE
 70
     0
  9
$REGENMODE
 70
     1
  9
$FILLMODE
 70
     1
  9
$QTEXTMODE
 70
     0
  9
$MIRRTEXT
 70
     0
  9
$LTSCALE
 40
1.0
  9
$ATTMODE
 70
     1
  9
$TEXTSIZE
 40
0.2
  9
$TRACEWID
 40
0.05
  9
$TEXTSTYLE
  7
Standard
  9
$CLAYER
  8
0
  9
$CELTYPE
  6
ByLayer
  9
$CECOLOR
 62
   256
  9
$CELTSCALE
 40
1.0
  9
$DISPSILH
 70
     0
  9
$DIMSCALE
 40
1.0
  9
$DIMASZ
 40
0.18
  9
$DIMEXO
 40
0.0625
  9
$DIMDLI
 40
0.38
  9
$DIMRND
 40
0.0
  9
$DIMDLE
 40
0.0
  9
$DIMEXE
 40
0.18
  9
$DIMTP
 40
0.0
  9
$DIMTM
 40
0.0
  9
$DIMTXT
 40
0.18
  9
$DIMCEN
 40
0.09
  9
$DIMTSZ
 40
0.0
  9
$DIMTOL
 70
     0
  9
$DIMLIM
 70
     0
  9
$DIMTIH
 70
     1
  9
$DIMTOH
 70
     1
  9
$DIMSE1
 70
     0
  9
$DIMSE2
 70
     0
  9
$DIMTAD
 70
     0
  9
$DIMZIN
 70
     0
  9
$DIMBLK
  1

  9
$DIMASO
 70
     1
  9
$DIMSHO
 70
     1
  9
$DIMPOST
  1

  9
$DIMAPOST
  1

  9
$DIMALT
 70
     0
  9
$DIMALTD
 70
     2
  9
$DIMALTF
 40
25.4
  9
$DIMLFAC
 40
1.0
  9
$DIMTOFL
 70
     0
  9
$DIMTVP
 40
0.0
  9
$DIMTIX
 70
     0
  9
$DIMSOXD
 70
     0
  9
$DIMSAH
 70
     0
  9
$DIMBLK1
  1

  9
$DIMBLK2
  1

  9
$DIMSTYLE
  2
Standard
  9
$DIMCLRD
 70
     0
  9
$DIMCLRE
 70
     0
  9
$DIMCLRT
 70
     0
  9
$DIMTFAC
 40
1.0
  9
$DIMGAP
 40
0.09
  9
$DIMJUST
 70
     0
  9
$DIMSD1
 70
     0
  9
$DIMSD2
 70
     0
  9
$DIMTOLJ
 70
     1
  9
$DIMTZIN
 70
     0
  9
$DIMALTZ
 70
     0
  9
$DIMALTTZ
 70
     0
  9
$DIMUPT
 70
     0
  9
$DIMDEC
 70
     4
  9
$DIMTDEC
 70
     4
  9
$DIMALTU
 70
     2
  9
$DIMALTTD
 70
     2
  9
$DIMTXSTY
  7
Standard
  9
$DIMAUNIT
 70
     0
  9
$DIMADEC
 70
     0
  9
$DIMALTRND
 40
0.0
  9
$DIMAZIN
 70
     0
  9
$DIMDSEP
 70
    46
  9
$DIMATFIT
 70
     3
  9
$DIMFRAC
 70
     0
  9
$DIMLDRBLK
  1

  9
$DIMLUNIT
 70
     2
  9
$DIMLWD
 70
    -2
  9
$DIMLWE
 70
    -2
  9
$DIMTMOVE
 70
     0
  9
$DIMFXL
 40
1.0
  9
$DIMFXLON
 70
     0
  9
$DIMJOGANG
 40
0.7853981633974483
  9
$DIMTFILL
 70
     0
  9
$DIMTFILLCLR
 70
     0
  9
$DIMARCSYM
 70
     0
  9
$DIMLTYPE
  6

  9
$DIMLTEX1
  6

  9
$DIMLTEX2
  6

  9
$DIMTXTDIRECTION
 70
     0
  9
$LUNITS
 70
     2
  9
$LUPREC
 70
     4
  9
$SKETCHINC
 40
0.1
  9
$FILLETRAD
 40
0.0
  9
$AUNITS
 70
     0
  9
$AUPREC
 70
     0
  9
$MENU
  1
.
  9
$ELEVATION
 40
0.0
  9
$PELEVATION
 40
0.0
  9
$THICKNESS
 40
0.0
  9
$LIMCHECK
 70
     0
  9
$CHAMFERA
 40
0.0
  9
$CHAMFERB
 40
0.0
  9
$CHAMFERC
 40
0.0
  9
$CHAMFERD
 40
0.0
  9
$SKPOLY
 70
     0
  9
$TDCREATE
 40
2460560.605914352
  9
$TDUCREATE
 40
2460560.272581019
  9
$TDUPDATE
 40
2460560.629861111
  9
$TDUUPDATE
 40
2460560.296527778
  9
$TDINDWG
 40
0.0239467593
  9
$TDUSRTIMER
 40
0.0239467593
  9
$USRTIMER
 70
     1
  9
$ANGBASE
 50
0.0
  9
$ANGDIR
 70
     0
  9
$PDMODE
 70
     0
  9
$PDSIZE
 40
0.0
  9
$PLINEWID
 40
0.0
  9
$SPLFRAME
 70
     0
  9
$SPLINETYPE
 70
     6
  9
$SPLINESEGS
 70
     8
  9
$HANDSEED
  5
38C
  9
$SURFTAB1
 70
     6
  9
$SURFTAB2
 70
     6
  9
$SURFTYPE
 70
     6
  9
$SURFU
 70
     6
  9
$SURFV
 70
     6
  9
$UCSBASE
  2

  9
$UCSNAME
  2

  9
$UCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$UCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$UCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$UCSORTHOREF
  2

  9
$UCSORTHOVIEW
 70
     0
  9
$UCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$UCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSBASE
  2

  9
$PUCSNAME
  2

  9
$PUCSORG
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSXDIR
 10
1.0
 20
0.0
 30
0.0
  9
$PUCSYDIR
 10
0.0
 20
1.0
 30
0.0
  9
$PUCSORTHOREF
  2

  9
$PUCSORTHOVIEW
 70
     0
  9
$PUCSORGTOP
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBOTTOM
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGLEFT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGRIGHT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGFRONT
 10
0.0
 20
0.0
 30
0.0
  9
$PUCSORGBACK
 10
0.0
 20
0.0
 30
0.0
  9
$USERI1
 70
     0
  9
$USERI2
 70
     0
  9
$USERI3
 70
     0
  9
$USERI4
 70
     0
  9
$USERI5
 70
     0
  9
$USERR1
 40
0.0
  9
$USERR2
 40
0.0
  9
$USERR3
 40
0.0
  9
$USERR4
 40
0.0
  9
$USERR5
 40
0.0
  9
$WORLDVIEW
 70
     1
  9
$SHADEDGE
 70
     3
  9
$SHADEDIF
 70
    70
  9
$TILEMODE
 70
     1
  9
$MAXACTVP
 70
    64
  9
$PINSBASE
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMCHECK
 70
     0
  9
$PEXTMIN
 10
0.0
 20
0.0
 30
0.0
  9
$PEXTMAX
 10
0.0
 20
0.0
 30
0.0
  9
$PLIMMIN
 10
0.0
 20
0.0
  9
$PLIMMAX
 10
12.0
 20
9.0
  9
$UNITMODE
 70
     0
  9
$VISRETAIN
 70
     1
  9
$PLINEGEN
 70
     0
  9
$PSLTSCALE
 70
     1
  9
$TREEDEPTH
 70
  3020
  9
$CMLSTYLE
  2
Standard
  9
$CMLJUST
 70
     0
  9
$CMLSCALE
 40
1.0
  9
$PROXYGRAPHICS
 70
     1
  9
$MEASUREMENT
 70
     0
  9
$CELWEIGHT
370
    -1
  9
$ENDCAPS
280
     0
  9
$JOINSTYLE
280
     0
  9
$LWDISPLAY
290
     0
  9
$INSUNITS
 70
     4
  9
$HYPERLINKBASE
  1

  9
$STYLESHEET
  1

  9
$XEDIT
290
     1
  9
$CEPSNTYPE
380
     0
  9
$PSTYLEMODE
290
     0
  9
$FINGERPRINTGUID
  2
{FA9A02B2-7E04-C34E-BD13-02980AC2B394}
  9
$VERSIONGUID
  2
{964EB223-33A2-D549-8684-CDE005EE773C}
  9
$EXTNAMES
290
     1
  9
$PSVPSCALE
 40
0.0
  9
$OLESTARTUP
290
     0
  9
$SORTENTS
280
   127
  9
$INDEXCTL
280
     0
  9
$HIDETEXT
280
     1
  9
$XCLIPFRAME
280
     2
  9
$HALOGAP
280
     0
  9
$OBSCOLOR
 70
   257
  9
$OBSLTYPE
280
     0
  9
$INTERSECTIONDISPLAY
280
     0
  9
$INTERSECTIONCOLOR
 70
   257
  9
$DIMASSOC
280
     2
  9
$PROJECTNAME
  1

  9
$CAMERADISPLAY
290
     0
  9
$LENSLENGTH
 40
50.0
  9
$CAMERAHEIGHT
 40
60.0
  9
$STEPSPERSEC
 40
2.0
  9
$STEPSIZE
 40
6.0
  9
$3DDWFPREC
 40
2.0
  9
$PSOLWIDTH
 40
0.25
  9
$PSOLHEIGHT
 40
4.0
  9
$LOFTANG1
 40
1.570796326794896
  9
$LOFTANG2
 40
1.570796326794896
  9
$LOFTMAG1
 40
0.0
  9
$LOFTMAG2
 40
0.0
  9
$LOFTPARAM
 70
     7
  9
$LOFTNORMALS
280
     1
  9
$LATITUDE
 40
37.795
  9
$LONGITUDE
 40
-122.394
  9
$NORTHDIRECTION
 40
0.0
  9
$TIMEZONE
 70
 -8000
  9
$LIGHTGLYPHDISPLAY
280
     1
  9
$TILEMODELIGHTSYNCH
280
     1
  9
$CMATERIAL
347
92
  9
$SOLIDHIST
280
     0
  9
$SHOWHIST
280
     1
  9
$DWFFRAME
280
     2
  9
$DGNFRAME
280
     0
  9
$REALWORLDSCALE
290
     1
  9
$INTERFERECOLOR
 62
     1
  9
$INTERFEREOBJVS
345
9F
  9
$INTERFEREVPVS
346
9C
  9
$CSHADOW
280
     0
  9
$SHADOWPLANELOCATION
 40
0.0
  0
ENDSEC
  0
SECTION
  2
CLASSES
  0
CLASS
  1
ACDBDICTIONARYWDFLT
  2
AcDbDictionaryWithDefault
  3
ObjectDBX Classes
 90
        0
 91
        1
280
     0
281
     0
  0
CLASS
  1
DICTIONARYVAR
  2
AcDbDictionaryVar
  3
ObjectDBX Classes
 90
        0
 91
       15
280
     0
281
     0
  0
CLASS
  1
MATERIAL
  2
AcDbMaterial
  3
ObjectDBX Classes
 90
     1153
 91
        3
280
     0
281
     0
  0
CLASS
  1
VISUALSTYLE
  2
AcDbVisualStyle
  3
ObjectDBX Classes
 90
     4095
 91
       24
280
     0
281
     0
  0
CLASS
  1
TABLESTYLE
  2
AcDbTableStyle
  3
ObjectDBX Classes
 90
     4095
 91
        1
280
     0
281
     0
  0
CLASS
  1
SCALE
  2
AcDbScale
  3
ObjectDBX Classes
 90
     1153
 91
       33
280
     0
281
     0
  0
CLASS
  1
MLEADERSTYLE
  2
AcDbMLeaderStyle
  3
ACDB_MLEADERSTYLE_CLASS
 90
     4095
 91
        2
280
     0
281
     0
  0
CLASS
  1
CELLSTYLEMAP
  2
AcDbCellStyleMap
  3
ObjectDBX Classes
 90
     1152
 91
        7
280
     0
281
     0
  0
CLASS
  1
EXACXREFPANELOBJECT
  2
ExAcXREFPanelObject
  3
EXAC_ESW
 90
     1025
 91
        0
280
     0
281
     0
  0
CLASS
  1
NPOCOLLECTION
  2
AcDbImpNonPersistentObjectsCollection
  3
ObjectDBX Classes
 90
     1153
 91
        0
280
     0
281
     0
  0
CLASS
  1
LAYER_INDEX
  2
AcDbLayerIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
SPATIAL_INDEX
  2
AcDbSpatialIndex
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
IDBUFFER
  2
AcDbIdBuffer
  3
ObjectDBX Classes
 90
        0
 91
        0
280
     0
281
     0
  0
CLASS
  1
ACDBSECTIONVIEWSTYLE
  2
AcDbSectionViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
CLASS
  1
ACDBDETAILVIEWSTYLE
  2
AcDbDetailViewStyle
  3
ObjectDBX Classes
 90
     1025
 91
        1
280
     0
281
     0
  0
ENDSEC
  0
SECTION
  2
TABLES
  0
TABLE
  2
VPORT
  5
8
330
0
100
AcDbSymbolTable
 70
     1
1001
ACAD
1000
DbSaveVer
1071
      224
  0
VPORT
  5
90
330
8
100
AcDbSymbolTableRecord
100
AcDbViewportTableRecord
  2
*Active
 70
     0
 10
0.0
 20
0.0
 11
1.0
 21
1.0
 12
97.5486911906951
 22
42.51345460271504
 13
0.0
 23
0.0
 14
0.5
 24
0.5
 15
0.5
 25
0.5
 16
0.0
 26
0.0
 36
1.0
 17
0.0
 27
0.0
 37
0.0
 40
78.45799938217576
 41
1.945409429280396
 42
50.0
 43
0.0
 44
0.0
 50
0.0
 51
0.0
 71
     0
 72
  1000
 73
     1
 74
     3
 75
     0
 76
     1
 77
     0
 78
     0
281
     0
 65
     1
110
0.0
120
0.0
130
0.0
111
1.0
121
0.0
131
0.0
112
0.0
122
1.0
132
0.0
 79
     0
146
0.0
348
9B
 60
     3
 61
     5
292
     1
282
     1
141
0.0
142
0.0
 63
   250
421
  3355443
1001
ACAD_NAV_VCDISPLAY
1070
     3
  0
ENDTAB
  0
TABLE
  2
LTYPE
  5
5
330
0
100
AcDbSymbolTable
 70
     1
  0
LTYPE
  5
14
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByBlock
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
15
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
ByLayer
 70
     0
  3

 72
    65
 73
     0
 40
0.0
  0
LTYPE
  5
16
330
5
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
  2
Continuous
 70
     0
  3
Solid line
 72
    65
 73
     0
 40
0.0
  0
ENDTAB
  0
TABLE
  2
LAYER
  5
2
102
{ACAD_XDICTIONARY
360
18B
102
}
330
0
100
AcDbSymbolTable
 70
     1
  0
LAYER
  5
10
102
{ACAD_XDICTIONARY
360
E1
102
}
330
2
100
AcDbSymbolTableRecord
100
AcDbLayerTableRecord
  2
0
 70
     0
 62
     7
  6
Continuous
370
    -3
390
F
347
94
348
0
  0
ENDTAB
  0
TABLE
  2
STYLE
  5
3
330
0
100
AcDbSymbolTable
 70
     2
  0
STYLE
  5
11
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Standard
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
ACAD
1000
Arial
1071
       34
  0
STYLE
  5
D7
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
 41
1.0
 50
0.0
 71
     0
 42
0.2
  3
arial.ttf
  4

1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD
1000
Arial
1071
       34
  0
ENDTAB
  0
TABLE
  2
VIEW
  5
6
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
UCS
  5
7
330
0
100
AcDbSymbolTable
 70
     0
  0
ENDTAB
  0
TABLE
  2
APPID
  5
9
330
0
100
AcDbSymbolTable
 70
     7
  0
APPID
  5
12
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD
 70
     0
  0
APPID
  5
D8
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnoPO
 70
     0
  0
APPID
  5
D9
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
AcadAnnotative
 70
     0
  0
APPID
  5
DA
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMJAG
 70
     0
  0
APPID
  5
DB
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_DSTYLE_DIMTALN
 70
     0
  0
APPID
  5
102
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_MLEADERVER
 70
     0
  0
APPID
  5
1A3
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
  2
ACAD_NAV_VCDISPLAY
 70
     0
  0
ENDTAB
  0
TABLE
  2
DIMSTYLE
  5
A
330
0
100
AcDbSymbolTable
 70
     2
100
AcDbDimStyleTable
 71
     2
340
DC
340
27
  0
DIMSTYLE
105
27
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Standard
 70
     0
340
11
  0
DIMSTYLE
105
DC
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
  2
Annotative
 70
     0
 40
0.0
340
11
1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
     1
1070
     1
1002
}
1001
ACAD_DSTYLE_DIMJAG
1070
   388
1040
1.5
1001
ACAD_DSTYLE_DIMTALN
1070
   392
1070
     0
  0
ENDTAB
  0
TABLE
  2
BLOCK_RECORD
  5
1
330
0
100
AcDbSymbolTable
 70
     1
  0
BLOCK_RECORD
  5
1F
102
{ACAD_XDICTIONARY
360
15A
102
}
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Model_Space
340
22
 70
     0
280
     1
281
     0
  0
BLOCK_RECORD
  5
73
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space
340
74
 70
     0
280
     1
281
     0
  0
BLOCK_RECORD
  5
78
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
  2
*Paper_Space0
340
79
 70
     0
280
     1
281
     0
  0
ENDTAB
  0
ENDSEC
  0
SECTION
  2
BLOCKS
  0
BLOCK
  5
20
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockBegin
  2
*Model_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Model_Space
  1

  0
ENDBLK
  5
21
330
1F
100
AcDbEntity
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
75
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space
  1

  0
ENDBLK
  5
76
330
73
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
BLOCK
  5
7A
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockBegin
  2
*Paper_Space0
 70
     0
 10
0.0
 20
0.0
 30
0.0
  3
*Paper_Space0
  1

  0
ENDBLK
  5
7B
330
78
100
AcDbEntity
 67
     1
  8
0
100
AcDbBlockEnd
  0
ENDSEC
  0
SECTION
  2
ENTITIES
  0
ENDSEC
  0
SECTION
  2
OBJECTS
  0
DICTIONARY
  5
C
330
0
100
AcDbDictionary
281
     1
  3
ACAD_CIP_PREVIOUS_PRODUCT_INFO
350
1A2
  3
ACAD_COLOR
350
6C
  3
ACAD_DETAILVIEWSTYLE
350
1A8
  3
ACAD_GROUP
350
D
  3
ACAD_LAYOUT
350
1A
  3
ACAD_MATERIAL
350
6B
  3
ACAD_MLEADERSTYLE
350
D2
  3
ACAD_MLINESTYLE
350
17
  3
ACAD_PLOTSETTINGS
350
19
  3
ACAD_PLOTSTYLENAME
350
E
  3
ACAD_SCALELIST
350
B1
  3
ACAD_SECTIONVIEWSTYLE
350
1A5
  3
ACAD_TABLESTYLE
350
A6
  3
ACAD_VISUALSTYLE
350
95
  3
ACDB_RECOMPOSE_DATA
350
38B
  3
AcDbVariableDictionary
350
59
  0
DICTIONARY
  5
18B
330
2
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_LAYERSTATES
360
18C
  0
DICTIONARY
  5
E1
330
10
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
15A
330
1F
100
AcDbDictionary
280
     1
281
     1
  0
XRECORD
  5
1A2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
300
ACD
300
2021
300

  0
DICTIONARY
  5
6C
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A8
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A9
  0
DICTIONARY
  5
D
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
DICTIONARY
  5
1A
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Model
350
22
  3
\u5E03\u5C401
350
74
  3
\u5E03\u5C402
350
79
  0
DICTIONARY
  5
6B
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
ByBlock
350
93
  3
ByLayer
350
92
  3
Global
350
94
  0
DICTIONARY
  5
D2
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Annotative
350
E0
  3
Standard
350
D3
  0
DICTIONARY
  5
17
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
18
  0
DICTIONARY
  5
19
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  0
ACDBDICTIONARYWDFLT
  5
E
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Normal
350
F
100
AcDbDictionaryWithDefault
340
F
  0
DICTIONARY
  5
B1
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
A0
350
B2
  3
A1
350
124
  3
A2
350
125
  3
A3
350
126
  3
A4
350
127
  3
A5
350
128
  3
A6
350
129
  3
A7
350
12A
  3
A8
350
12B
  3
A9
350
12C
  3
B0
350
12D
  3
B1
350
12E
  3
B2
350
12F
  3
B3
350
130
  3
B4
350
131
  3
B5
350
132
  3
B6
350
133
  3
B7
350
134
  3
B8
350
135
  3
B9
350
136
  3
C0
350
137
  3
C1
350
138
  3
C2
350
139
  3
C3
350
13A
  3
C4
350
13B
  3
C5
350
13C
  3
C6
350
13D
  3
C7
350
13E
  3
C8
350
13F
  3
C9
350
140
  3
D0
350
141
  3
D1
350
142
  3
D2
350
143
  0
DICTIONARY
  5
1A5
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Imperial24
350
1A7
  0
DICTIONARY
  5
A6
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
Standard
350
A7
  0
DICTIONARY
  5
95
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
2dWireframe
350
9B
  3
Basic
350
9A
  3
Brighten
350
A1
  3
ColorChange
350
A5
  3
Conceptual
350
9E
  3
Dim
350
A0
  3
EdgeColorOff
350
172
  3
Facepattern
350
A4
  3
Flat
350
96
  3
FlatWithEdges
350
97
  3
Gouraud
350
98
  3
GouraudWithEdges
350
99
  3
Hidden
350
9D
  3
JitterOff
350
170
  3
Linepattern
350
A3
  3
OverhangOff
350
171
  3
Realistic
350
9F
  3
Shaded
350
17F
  3
Shaded with edges
350
17E
  3
Shades of Gray
350
17B
  3
Sketchy
350
17C
  3
Thicken
350
A2
  3
Wireframe
350
9C
  3
X-Ray
350
17D
  0
XRECORD
  5
38B
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbXrecord
280
     1
 90
        1
330
A7
  0
DICTIONARY
  5
59
102
{ACAD_REACTORS
330
C
102
}
330
C
100
AcDbDictionary
281
     1
  3
CAMERAHEIGHT
350
227
  3
CANNOSCALE
350
EB
  3
CMLEADERSTYLE
350
EA
  3
CTABLESTYLE
350
AB
  3
CVIEWDETAILSTYLE
350
1B4
  3
CVIEWSECTIONSTYLE
350
1B5
  3
DIMASSOC
350
5A
  3
HIDETEXT
350
5E
  3
INDEXCTL
350
226
  3
LAYEREVAL
350
14A
  3
LAYERNOTIFY
350
14B
  3
LIGHTINGUNITS
350
224
  3
MSLTSCALE
350
223
  3
SORTENTS
350
225
  3
XCLIPFRAME
350
228
  0
DICTIONARY
  5
18C
102
{ACAD_REACTORS
330
18B
102
}
330
18B
100
AcDbDictionary
281
     1
  0
ACDBDETAILVIEWSTYLE
  5
1A9
102
{ACAD_REACTORS
330
1A8
102
}
330
1A8
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
300
Imperial24
 90
        0
100
AcDbDetailViewStyle
 70
     0
 71
     0
 90
        3
 71
     1
340
11
 62
   256
 40
0.24
340
0
 62
   256
 40
0.24
300

 40
0.36
280
     3
 71
     2
340
16
 90
       25
 62
   256
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewDetailId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
340
16
 90
       25
 62
   256
340
16
 90
       25
 62
   256
280
     0
  0
LAYOUT
  5
22
102
{ACAD_XDICTIONARY
360
191
102
}
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
none_device
  4
Letter_(8.50_x_11.00_Inches)
  6

 40
6.349999904632568
 41
6.349999904632568
 42
6.350006103515625
 43
6.350006103515625
 44
215.8999938964844
 45
279.3999938964844
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
3.560208697428376
 70
 11952
 72
     0
 73
     1
 74
     0
  7

 75
     0
147
0.28088241027059
 76
     0
 77
     2
 78
   300
148
0.1311165230791651
149
0.096403374003771
100
AcDbLayout
  1
Model
 70
     1
 71
     0
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
1F
331
90
  0
LAYOUT
  5
74
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\u5E03\u5C401
 70
     1
 71
     1
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
73
  0
LAYOUT
  5
79
102
{ACAD_REACTORS
330
1A
102
}
330
1A
100
AcDbPlotSettings
  1

  2
\\\\ADSCCNDC1\\hq601xrx1
  4

  6

 40
0.0
 41
0.0
 42
0.0
 43
0.0
 44
0.0
 45
0.0
 46
0.0
 47
0.0
 48
0.0
 49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
 70
   688
 72
     0
 73
     0
 74
     5
  7

 75
    16
147
1.0
 76
     0
 77
     2
 78
   300
148
0.0
149
0.0
100
AcDbLayout
  1
\u5E03\u5C402
 70
     1
 71
     2
 10
0.0
 20
0.0
 11
12.0
 21
9.0
 12
0.0
 22
0.0
 32
0.0
 14
0.0
 24
0.0
 34
0.0
 15
0.0
 25
0.0
 35
0.0
146
0.0
 13
0.0
 23
0.0
 33
0.0
 16
1.0
 26
0.0
 36
0.0
 17
0.0
 27
1.0
 37
0.0
 76
     0
330
78
  0
MATERIAL
  5
93
102
{ACAD_XDICTIONARY
360
185
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByBlock
 94
       63
  0
MATERIAL
  5
92
102
{ACAD_XDICTIONARY
360
183
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
ByLayer
 94
       63
  0
MATERIAL
  5
94
102
{ACAD_XDICTIONARY
360
10B
102
}
102
{ACAD_REACTORS
330
6B
102
}
330
6B
100
AcDbMaterial
  1
Global
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0208000000566244
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 43
0.0
 43
0.0
 43
0.0
 43
0.0
 43
1.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0208000000566244
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
 49
0.0
 49
0.0
 49
0.0
 49
0.0
 49
1.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
0.0208000000566244
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
142
0.0
142
0.0
142
0.0
142
0.0
142
1.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
0.0208000000566244
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
144
0.0
144
0.0
144
0.0
144
0.0
144
1.0
 94
       63
1001
ACAD
1070
    -1
1070
     3
1070
     0
1000

1071
        0
1070
     0
  0
MLEADERSTYLE
  5
E0
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
179
     2
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     1
143
0.125
271
     0
272
     9
273
     9
298
     0
  0
MLEADERSTYLE
  5
D3
102
{ACAD_REACTORS
330
D2
102
}
330
D2
100
AcDbMLeaderStyle
179
     2
170
     2
171
     1
172
     0
 90
        2
 40
0.0
 41
0.0
173
     1
 91
-1056964608
340
14
 92
       -2
290
     1
 42
0.09
291
     1
 43
0.36
  3
Standard
 44
0.18
300

342
11
174
     1
178
     1
175
     1
176
     0
 93
-1056964608
 45
0.18
292
     0
297
     0
 46
0.18
 94
-1056964608
 47
1.0
 49
1.0
140
1.0
293
     1
141
0.0
294
     1
177
     0
142
1.0
295
     0
296
     0
143
0.125
271
     0
272
     9
273
     9
298
     0
  0
MLINESTYLE
  5
18
102
{ACAD_REACTORS
330
17
102
}
330
17
100
AcDbMlineStyle
  2
STANDARD
 70
     0
  3

 62
   256
 51
90.0
 52
90.0
 71
     2
 49
0.5
 62
   256
  6
BYLAYER
 49
-0.5
 62
   256
  6
BYLAYER
  0
ACDBPLACEHOLDER
  5
F
102
{ACAD_REACTORS
330
E
102
}
330
E
  0
SCALE
  5
B2
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:1
140
1.0
141
1.0
290
     1
  0
SCALE
  5
124
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:2
140
1.0
141
2.0
290
     0
  0
SCALE
  5
125
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:4
140
1.0
141
4.0
290
     0
  0
SCALE
  5
126
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:5
140
1.0
141
5.0
290
     0
  0
SCALE
  5
127
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:8
140
1.0
141
8.0
290
     0
  0
SCALE
  5
128
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:10
140
1.0
141
10.0
290
     0
  0
SCALE
  5
129
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:16
140
1.0
141
16.0
290
     0
  0
SCALE
  5
12A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:20
140
1.0
141
20.0
290
     0
  0
SCALE
  5
12B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:30
140
1.0
141
30.0
290
     0
  0
SCALE
  5
12C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:40
140
1.0
141
40.0
290
     0
  0
SCALE
  5
12D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:50
140
1.0
141
50.0
290
     0
  0
SCALE
  5
12E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1:100
140
1.0
141
100.0
290
     0
  0
SCALE
  5
12F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
2:1
140
2.0
141
1.0
290
     0
  0
SCALE
  5
130
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
4:1
140
4.0
141
1.0
290
     0
  0
SCALE
  5
131
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
8:1
140
8.0
141
1.0
290
     0
  0
SCALE
  5
132
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
10:1
140
10.0
141
1.0
290
     0
  0
SCALE
  5
133
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
100:1
140
100.0
141
1.0
290
     0
  0
SCALE
  5
134
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/128" = 1'-0"
140
0.0078125
141
12.0
290
     0
  0
SCALE
  5
135
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/64" = 1'-0"
140
0.015625
141
12.0
290
     0
  0
SCALE
  5
136
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/32" = 1'-0"
140
0.03125
141
12.0
290
     0
  0
SCALE
  5
137
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/16" = 1'-0"
140
0.0625
141
12.0
290
     0
  0
SCALE
  5
138
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/32" = 1'-0"
140
0.09375
141
12.0
290
     0
  0
SCALE
  5
139
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/8" = 1'-0"
140
0.125
141
12.0
290
     0
  0
SCALE
  5
13A
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/16" = 1'-0"
140
0.1875
141
12.0
290
     0
  0
SCALE
  5
13B
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/4" = 1'-0"
140
0.25
141
12.0
290
     0
  0
SCALE
  5
13C
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/8" = 1'-0"
140
0.375
141
12.0
290
     0
  0
SCALE
  5
13D
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1/2" = 1'-0"
140
0.5
141
12.0
290
     0
  0
SCALE
  5
13E
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3/4" = 1'-0"
140
0.75
141
12.0
290
     0
  0
SCALE
  5
13F
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1" = 1'-0"
140
1.0
141
12.0
290
     0
  0
SCALE
  5
140
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1-1/2" = 1'-0"
140
1.5
141
12.0
290
     0
  0
SCALE
  5
141
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
3" = 1'-0"
140
3.0
141
12.0
290
     0
  0
SCALE
  5
142
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
6" = 1'-0"
140
6.0
141
12.0
290
     0
  0
SCALE
  5
143
102
{ACAD_REACTORS
330
B1
102
}
330
B1
100
AcDbScale
 70
     0
300
1'-0" = 1'-0"
140
12.0
141
12.0
290
     0
  0
ACDBSECTIONVIEWSTYLE
  5
1A7
102
{ACAD_REACTORS
330
1A5
102
}
330
1A5
100
AcDbModelDocViewStyle
 70
     0
  3
Imperial24
290
     0
300
Imperial24
 90
        0
100
AcDbSectionViewStyle
 70
     0
 71
     0
 90
       78
 71
     1
340
11
 62
   256
 40
0.24
340
0
340
0
 62
   256
 40
0.24
300
I, O, Q, S, X, Z
 40
0.48
 90
        3
 40
0.18
 90
        1
 71
     2
340
16
 90
       25
 62
   256
340
16
 90
       50
 62
   256
 40
0.24
 40
0.0
 40
0.24
 71
     3
340
11
 62
   256
 40
0.24
 90
        1
 40
0.75
 90
        1
300
%<\\AcVar ViewType \\f "%tc1">% %<\\AcVar ViewSectionStartId>%-%<\\AcVar ViewSectionEndId>%\\PSCALE %<\\AcVar ViewScale \\f "%sn">%
 71
     4
 62
   256
 62
   257
300
ANSI31
 40
1.0
 90
        0
290
     0
290
     0
 90
        6
 40
0.0
 40
1.570796326794896
 40
0.2617993877991494
 40
1.308996938995747
 40
-0.2617993877991494
 40
1.832595714594046
  0
TABLESTYLE
  5
A7
102
{ACAD_XDICTIONARY
360
FF
102
}
102
{ACAD_REACTORS
330
A6
102
}
330
A6
100
AcDbTableStyle
280
     0
  3
Standard
 70
     0
 71
     0
 40
0.06
 41
0.06
280
     0
281
     0
  7
Standard
140
0.18
170
     2
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.25
170
     5
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  7
Standard
140
0.18
170
     5
 62
     0
 63
     7
283
     0
 90
      512
 91
        0
  1

274
    -2
284
     1
 64
     0
275
    -2
285
     1
 65
     0
276
    -2
286
     1
 66
     0
277
    -2
287
     1
 67
     0
278
    -2
288
     1
 68
     0
279
    -2
289
     1
 69
     0
  0
VISUALSTYLE
  5
9B
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
2dWireframe
 70
     4
177
     3
291
     0
 70
    58
 90
        0
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
9A
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Basic
 70
     7
177
     3
291
     1
 70
    58
 90
        1
176
     1
 90
        0
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
A1
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Brighten
 70
    12
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
50.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
A5
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
ColorChange
 70
    16
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        3
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     8
420
  8421504
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     8
420
  8421504
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
9E
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Conceptual
 70
     9
177
     3
291
     0
 70
    58
 90
        3
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        2
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
40.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
A0
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Dim
 70
    11
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
-50.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
172
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
EdgeColorOff
 70
    22
177
     3
291
     1
 70
    58
 90
        2
176
     0
 90
        2
176
     0
 90
        0
176
     0
 90
        0
176
     0
 40
0.6
176
     0
 40
30.0
176
     0
 62
     7
420
 16777215
176
     0
 90
        1
176
     0
 90
        4
176
     0
 62
     7
176
     0
 62
   257
176
     0
 90
        1
176
     0
 90
        1
176
     0
 40
1.0
176
     0
 90
        8
176
     2
 62
     7
176
     0
 40
1.0
176
     0
 90
        1
176
     0
 90
        6
176
     0
 90
        2
176
     0
 62
     7
176
     0
 90
        5
176
     0
 90
        0
176
     0
 90
        0
176
     0
290
     0
176
     0
 90
        1
176
     0
 40
0.0
176
     0
 90
        0
176
     0
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
A4
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Facepattern
 70
    15
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
96
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Flat
 70
     0
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        1
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
97
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
FlatWithEdges
 70
     1
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        1
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
98
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Gouraud
 70
     2
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
99
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
GouraudWithEdges
 70
     3
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
9D
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Hidden
 70
     6
177
     3
291
     0
 70
    58
 90
        1
176
     1
 90
        2
176
     1
 90
        2
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        2
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        2
176
     1
 90
        1
176
     1
 40
40.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
170
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
JitterOff
 70
    20
177
     3
291
     1
 70
    58
 90
        2
176
     0
 90
        2
176
     0
 90
        0
176
     0
 90
        0
176
     0
 40
0.6
176
     0
 40
30.0
176
     0
 62
     7
420
 16777215
176
     0
 90
        1
176
     0
 90
        4
176
     0
 62
     7
176
     0
 62
   257
176
     0
 90
        1
176
     0
 90
        1
176
     0
 40
1.0
176
     0
 90
       10
176
     2
 62
     7
176
     0
 40
1.0
176
     0
 90
        1
176
     0
 90
        6
176
     0
 90
        2
176
     0
 62
     7
176
     0
 90
        5
176
     0
 90
        0
176
     0
 90
        0
176
     0
290
     0
176
     0
 90
        1
176
     0
 40
0.0
176
     0
 90
        0
176
     0
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
A3
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Linepattern
 70
    14
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        7
176
     1
 90
        7
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
171
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
OverhangOff
 70
    21
177
     3
291
     1
 70
    58
 90
        2
176
     0
 90
        2
176
     0
 90
        0
176
     0
 90
        0
176
     0
 40
0.6
176
     0
 40
30.0
176
     0
 62
     7
420
 16777215
176
     0
 90
        1
176
     0
 90
        4
176
     0
 62
     7
176
     0
 62
   257
176
     0
 90
        1
176
     0
 90
        1
176
     0
 40
1.0
176
     0
 90
        9
176
     2
 62
     7
176
     0
 40
1.0
176
     0
 90
        1
176
     0
 90
        6
176
     0
 90
        2
176
     0
 62
     7
176
     0
 90
        5
176
     0
 90
        0
176
     0
 90
        0
176
     0
290
     0
176
     0
 90
        1
176
     0
 40
0.0
176
     0
 90
        0
176
     0
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
9F
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Realistic
 70
     8
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
17F
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded
 70
    27
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        0
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     8
420
  7895160
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        5
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
17E
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shaded with edges
 70
    26
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        2
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        2
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        5
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
17B
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Shades of Gray
 70
    23
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        3
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        2
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
     7
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
40.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
17C
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Sketchy
 70
    24
177
     3
291
     0
 70
    58
 90
        1
176
     1
 90
        2
176
     1
 90
        2
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        2
176
     1
 90
        2
176
     1
 62
     7
176
     1
 62
     7
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
40.0
176
     1
 90
       11
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        6
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
A2
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Thicken
 70
    13
177
     3
291
     1
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
       12
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        5
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
9C
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
Wireframe
 70
     5
177
     3
291
     0
 70
    58
 90
        0
176
     1
 90
        2
176
     1
 90
        0
176
     1
 90
        0
176
     1
 40
0.6
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        4
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
   257
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
        1
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
VISUALSTYLE
  5
17D
102
{ACAD_REACTORS
330
95
102
}
330
95
100
AcDbVisualStyle
  2
X-Ray
 70
    25
177
     3
291
     0
 70
    58
 90
        2
176
     1
 90
        2
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
0.5
176
     1
 40
30.0
176
     1
 62
     7
420
 16777215
176
     1
 90
        1
176
     1
 90
        0
176
     1
 62
     7
176
     1
 62
   257
176
     1
 90
        1
176
     1
 90
        1
176
     1
 40
1.0
176
     1
 90
        8
176
     1
 62
     7
176
     1
 40
1.0
176
     1
 90
        1
176
     1
 90
        6
176
     1
 90
        2
176
     1
 62
     7
176
     1
 90
        3
176
     1
 90
        0
176
     1
 90
        0
176
     1
290
     0
176
     1
 90
       13
176
     1
 40
0.0
176
     1
 90
        0
176
     1
290
     0
176
     1
290
     1
176
     1
290
     1
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
290
     0
176
     1
 90
       50
176
     1
 40
0.0
176
     1
 40
1.0
176
     1
 90
        0
176
     1
 62
    18
420
        0
176
     1
 90
       50
176
     1
 90
        3
176
     1
 62
     5
420
      255
176
     1
290
     0
176
     1
 90
       50
176
     1
 90
       50
176
     1
 90
       50
176
     1
290
     0
176
     1
 90
       50
176
     1
 62
   256
176
     0
 40
1.0
176
     0
 90
        2
176
     1
  1
strokes_ogs.tif
176
     1
290
     0
176
     1
 40
1.0
176
     1
 40
1.0
176
     1
  0
DICTIONARYVAR
  5
227
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
60.000000
  0
DICTIONARYVAR
  5
EB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1:1
  0
DICTIONARYVAR
  5
EA
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
AB
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
STANDARD
  0
DICTIONARYVAR
  5
1B4
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
1B5
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
Imperial24
  0
DICTIONARYVAR
  5
5A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
5E
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
226
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14A
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
14B
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
0
  0
DICTIONARYVAR
  5
224
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARYVAR
  5
223
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
1
  0
DICTIONARYVAR
  5
225
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
127
  0
DICTIONARYVAR
  5
228
102
{ACAD_REACTORS
330
59
102
}
330
59
100
DictionaryVariables
280
     0
  1
2
  0
DICTIONARY
  5
191
330
22
100
AcDbDictionary
280
     1
281
     1
  0
DICTIONARY
  5
185
330
93
100
AcDbDictionary
280
     1
281
     1
  3
FBXASSET
360
186
  0
DICTIONARY
  5
183
330
92
100
AcDbDictionary
280
     1
281
     1
  3
FBXASSET
360
184
  0
DICTIONARY
  5
10B
330
94
100
AcDbDictionary
280
     1
281
     1
  3
BUMPTILE
360
10D
  3
DIFFUSETILE
360
10C
  3
FBXASSET
360
187
  3
OPACITYTILE
360
10E
  3
REFLECTIONTILE
360
10F
  0
DICTIONARY
  5
FF
330
A7
100
AcDbDictionary
280
     1
281
     1
  3
ACAD_ROUNDTRIP_2008_TABLESTYLE_CELLSTYLEMAP
360
38A
  0
XRECORD
  5
186
102
{ACAD_REACTORS
330
185
102
}
330
185
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
7581DE8E-A623-425F-9BF4-B3F4BE6C4F9A
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623B9A2F3B5FEC0000007C01000008000000636F72652E786D6C8D90416E83301045AF62CDB632D8040820E328B4E204BD80653BC44AB011B6AB1EBF262152BBEB6A467FFE9B197D76FA9EEFE84BAFDE38DB03CD08206DA553C64E3DC470C10DA01367AB73E1970D9015B3EE61
310
9381B3697571D925E96CD03624D53AA5775178AF0320794F4D0F5E5EF52C32114372F85BB608791393CEE8AB4B708C46A1E711A3D23E73317A055E0D4D53D6C71A9FC7A1C6657D18703354232ECFED4731B6B43CBED72CDF60CE82995FF7E5AA45D00A7841488B29C5A4F8A46547AAAEA8DE48D311C2F2CDFE078A8BFA2714
310
8D0D87627FF78979E0343DF21870966F59A4F2082AD52D37FE03504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623B6E137E0172010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C0810121947A1554ED00B38E05014B091B1518EDFE511A5A9D22AFD2A1F60CDEC7A67C698ED2E6D8306
310
69FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7166B4B65FCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B0FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2601EE7691A25EBC4DB1FF2C48B9255EEA5797C
310
F0A2FDE62D3C6C8268FD9A3032367366EBF6AAAE30525859621E52BAF182C0A3E17B106D69BC0DE3179A6E2965642CBF6B725DF96493AB955D858BDCB9ADC73C002113F1CD2D4464512F06D04338236388F09912BE0F1A028190AD3836571F67800659586D22604AED6ED4201A27612AF5E9F4A09F178CCC9D3075DA1C5C3F
310
9C113E3DE3F71DE1A885AAC084B0B03C3A3BEA64B38625B44E1A6FB017A4B46945F39C8D5F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F02504B0304140006080800AC70623BE001BAC07D0000009D0000000B0000006662782F636E782E786D6C4DCCD10AC2201886E15B91FFDCA6536B037548D87D8CE686
310
E4344CA3CB6F8B1D74F4C1C3C72B87CF1AD0DBE5974F51013D11402EDED3E4E3A2A096197780062D734AE5EF06288EAB53B03368B9E4549F074D6E1E6B289B061F1F07124689687987B9601C7373BD60C36E065B6A6DDF7341A93843A365F32B6DBB87F517504B0304140006080800AC70623B8E5068122901000012020000
310
310000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C8D515B6EC32010BC0AE22B55850D364E93081345557A825E801892A2C460F1A872FC2EB523B57FF961D1EECCECECAED8DFC71BFA36215AEF7ACC2A8A917183D7D65D7A9CD3996C30DA4B
310
11BC4F7F601839359A1E973496E2127C9E96D4E05D322E41D6796D96A48AD1248C861B7C7A1C872F33AA4AE5048878AD26355CD5C554AC8232E0A4882980013437292F96B465B46BF886F0AEE5841FDEDFC8A1FD3890233B1EB75BDE31D6AD453D13A5C8D9EA856E35D8B1676BC2B322852C45B2E3C3FE108C4A4663D950BA
310
258C11DA7C32BEA3DDAEE95EE96647A9A80BFC1F294FFA4952B62EB5CD6277A6452C99A8E78214DAE7D3ED61C6DC271F122AFD56D10C2F305545CB6A60FC1908E383E29A2F8A31F900EB5D5D4F8065DD2CBBE652D4E542107ECF07B15C53FE00504B0304140006080800AC70623B503B51794E010000330300003000000066
310
62782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F
310
77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347
310
DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F
310
504B0304140006080800AC70623B38FA165F680500003C100000340000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F6F626A656374732E786D6CAD575D6FA33814FD2B887D0E8424EDB42BCAA8499A2A1A756634D18CF6A15264C0A16CC146B6E9A4FBEBF7180C
310
019276B21F7908D8D8F7F3DCE36BFFE33ECFAC172A64CAD98DED3963DBA22CE271CA921BBB54BBD1956D7D0C7CC1B9EA2CB32D46727A63EB693BF013C1CBC24CC57447CA4C0D6657F33F2C1951466D2BCA889437B68C9E684E1C522A1E53F9ECC4441127D9ED1DCFA917F6C52682144F03A105119429588A790629566D94D7
310
1F8E6D37F05DFD3DF0F5BF59357D7B955BF9D3D79F32A9088B8E940DC44CBDD9F26E72713DBA98CDA6A3D9E5C41BCD57F3E5C8FB301D2F2E178BEBDBBB6B28964A4092B144D09D1DDC2336228D7CB7FED45A6C0C3F6552C419A351E53F3CAC6C3612635A5016238F2995D0D6F17ADC1F7A3A369DCF533D362ABBD3E779D5DD
310
D111D4D8DE3CBB96F2F04FB820CF41859054A3AA8E8F71B4C6DFF810B590F3CC7C4BA5951345454A322B4B4341C4AB1D60A95E12F83D311A9D42235C7B6007DE415ED75694C6AFB17BCACA5D99651A9A7650217B0BFC53252BCBD2BFA838AD0D36215765CAD4957148BD16D40EAE7DB79A0C7CFD984ECCC73A90D62E230952
310
0E37EBAF034717BAF6D64B3BF8B40AF71B5D8FA79517821754280D1F40AB495CF3D451326ABDB332A737C0995ECC0F41F986C87F46F91E4C41DE44BA9FED67468B1284C91D173972E38CAB9F356E5E46EDDBF10BF86CB0FA784D3BF3AF16FB6E6B6C9F30DECA1FC0A55373F5DFF3D78F5917A99DF405FE0B0A8C8BA909E526
310
2219A8E72165488806A595714C81CB77E1DE0ED6604A303B76912C680372F4E2BB2FF88EFF5A36D8AA52DF79322474C0B767303F625995056C7B032C473C592936CEBD15F38BFFA5666E979B4F9B52EC48441F0CB12CE92E65A9C2D979006FD7A05E227A1E3DD3D79F5CC470F438099B6E1272A34A22DA3AE63AF0497358E8
310
C141734F41847D09D79CE7FF42C3432A239A6584515E365ADA634863B52519D327A00AEB804E2703140BFA92EA4EA2B7A26716CEFA48A4850E597BE8B53CEDBCE1CBF7F56780D20EE6AF73A0F5F9B02A3CD07DC4332EB6E1EBB666421BE0C39E3EBA7FF4E16D22EA6A29407C85E586724C88B771BADB9512BC7B228A3FD68B
310
6EA65A22397E690AA8D158D7E40CEC8CDA23C2C0B7D1898640101CEC9C6D531CE328CB93CABBBA870A6425F70DF96199175B92F392A973C2346EFC69AC6F8577BB18F993A8E8C90E36D573340765C7343EA4AA87027D049DF0A9979E0F1757DEF2EEEA6E747B39412B35B9588DAEE7ABD9683E5DCDE677978BD9EAFAB6B5A8
310
B224F09B13AA5B8388264E44BF14A909F3F7F5A16CEDE08128E9DED705E526F5F3FBDA415BECBBD80380B71BD77991D19C3245347C1FF44BF68DA0ABE8C9A8E7D73949E81952BEDC6F063660E68C7D5F75A9D19F83BD6676A16BE1A410F554E621236936D8681C770A9618B79B50B6CF9AD19BA11E9978A20F953C4B63104E
310
6C2594E7548176CE607B915309C474BBF2D8DC1ECED8FD52F7838A84196D2C79226889330954036E65A4FAF3D66F68E174177563E3B0739EF1670AD1B690EA1B1BFCA6D2884A27C4F1A81B9F4A3820802EAC2541408DB02443675D6F6AC7ED2E1D1BD00F4E40A3BF5D724EB764FCEA116F4E8A02A7768F562BDB8C82E81F39
310
DE98631185D7B054AD2F8789D6994A0D2AAB76CADC0DD0423C1BD57BD4D7FB6E794EB5A61791B3EE49EF82A0963A524424D5BD40DB674CBA5D7E75D10A58EB2F569195097279BEA491A00073A90B1C28022A8CCC82284075F1FBE357C17117CDAD550A083C2E789E736606B7E62E6B6D9E70338D1F410B545F3FE464EC798F
310
55D76F2E22DB9048EA90583E63A22938EDC1006B00E4D1716A52E0EA1C0C96AF9796393066105A81F6A829ADAFE1168A47DF1C75A974C9B278B7F177ABA5008340CB1EFC0D504B0304140006080000AC70623B000000000000000000000000350000006662782F30333130353234382D343533342D344143372D413346412D
310
4531454539393435313135362F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E636660600000504B0304140006080000AC70
310
623B000000000000000000000000370000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30333130353234382D343533342D344143372D41
310
3346412D4531454539393435313135362F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11D
310
E607FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BF2C5666EFF000000A00100003B0000006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F7265736F7572636573
310
2F636F72652E786D6C8D504B6E833010BD0A9A6D65B00910888CA3D02A27E8052C33A156821DF953F5F8B5132AB5BB6E6646EFA3797AFCF8B5DE8A4F745E5B33022B291468949DB5594688E1427A288E823B6BC32F191446AE38428641F0C5D978DF20654D4013126AEC8C1B28BDC70085BAA56304AF3E7095A58C2129FCB5
310
BC4B75950B96AC4C74D209EE834B018AE7933C4138F4363A859E574F56F018F5BC69F49C7EEA8B4607A29DFABEE9F62D399DA78E34DD6E22FDD49E49731ADEEAF3C09AFD6BC7AB6C163CE8F527A3722803CE206A4A07C218A1F53B6B0EB43DD4ED0BED0F94F22ACBFF98E27DFEA7296A1376F516F769F320580AF22004AF72
310
5F693DCA4C3B772BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B200
310
00005B436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623B9A2F3B5FEC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D
310
6C504B01021400140006080800AC70623B6E137E0172010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623BE001BAC07D0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B010214001400060808
310
00AC70623B8E506812290100001202000031000000000000000000000000005B0500006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D3
310
0600006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F636E782E786D6C504B01021400140006080800AC70623B38FA165F680500003C10000034000000000000000000000000006F0800006662782F30333130353234382D343533342D344143372D413346412D4531
310
454539393435313135362F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000290E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F76657274696365732E62696E504B01021400
310
140006080800AC70623BF270F133060000000400000036000000000000000000000000007C0E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000
310
000000000000000000D60E00006662782F30333130353234382D343533342D344143372D413346412D4531454539393435313135362F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD1900000004101000036000000000000000000000000002B0F00006662782F30333130353234382D
310
343533342D344143372D413346412D4531454539393435313135362F6469726563746F72792E786D6C504B01021400140006080800AC70623BF2C5666EFF000000A00100003B000000000000000000000000000F1000006662782F30333130353234382D343533342D344143372D413346412D453145453939343531313536
310
2F7265736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000671100000000
  0
XRECORD
  5
184
102
{ACAD_REACTORS
330
183
102
}
330
183
100
AcDbXrecord
280
     1
 70
     1
 90
429727718
  1
778E3A9F-1AF3-452F-85C1-1BC15BD3F630
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BFD5588D4EC0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103891DC7C24471939CA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EF81EEFE8CBCCC17AD7012D0820E394D7D60D1DA478C50DA083E0B3F7F1970D9093A3E960
310
9141F061F6695A25E55D342E66D5796D56518660222075CF4D07417D9A511632C5EC08B76292EA260753D05797E194AC46CF2356E77DF66ACD0C62C768BD63971E5727D2E06DDF9C71BF7B3FE10BABF79BFA488FE4DCF07281058F767CDD57B391D168108C903DA61413F641B72DA95A56BD91A62584978BFD0F9426FD4F28
310
5917376C7DF7890510343FF218085E2E59E4F2082AD72537F103504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF326038
310
472BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB5D38BAD72010000D40300000C0000006662782F636F72652E786D6CC553DB8E823014FC95A6AF1B68C11B9A52A3AB7EC1FE4085CA36424B4A4BFCFC3D5C8CEBC635EED3F200CDCC393D3353CAD697AA44AD
310
B48D323AC5514831923A33B9D2458ABD3B0509466BCEAC31EE5B19465A5432C51D8C392BACF1F50865463BA91DA0DAE4720445D348875156C222C54DF6292B110AEFA0A23987B5C8CEA2906114020D759C35CE8200340CE9DE989F8E1746069C33EF553EB22A8769EAA4A4C57C1147F3457CD806B31D4D82E936D907DBC5FB
310
2E38C4F3E564BE8936749F30D23573E65475559759299CCC318F295D065114D0F8239AAEE86C15CFDE68B2A29491AEFCAEC9D7F98B4D5E69378947B9435B837904427AE2875B88C8A146B4A0877046BA10E1D3277C1F340402213B712CAF3ECE00B53273C64E81C98DBF51AD28BD84A934A4FD837E5F303274C2D47E7370FD
310
7046FCF28CE73BC2510B5D8009E16079F4AED3C9060D6368B5B441EB2E481B5B89F2351B4F1CFE89BA897F282933A5B1FFA5888C0744C6DF8374F7917F01504B0304140006080800AC70623B09885E1C7E0000009D0000000B0000006662782F636E782E786D6C4DCCDF0A83201C86E15B91DFB9CBA6FD11D41063F711CB42
310
663A9C8E5DFE6A74B0A30F1E3E5E317C368FDE36BD5C0C12EA0B0164C33DCE2EAC124A5E700F685022C598FF6E80C2B459090783126B8AE579D26C97A9F8BCAB77E17122E586D5843498B3EE8699D114F39E5E713D76EDA84DCBB569A052A2FA95F63DC2EA0B504B0304140006080800AC70623B961D28872A010000120200
310
00310000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C8D515B6EC32010BC8AC557AA0A1BFC4A1C61A2C8514FD00B10435294182C1E558EDFA576A4F62F3F80666766875D76784CF7EC5B39AFADE911CD09CA9419ADD4E6DAA3182E7887B203
310
67CEDAF08786322326D5A30423CEAECEC67985466B8232015063A55A41E1BD0A281BEFF0E8911FBFD42472110330FC2D9FC578135795D31CCAC0E3CC070701B2A5493A11AFBAA1A68434B8ABB71FB81E8E15EE765589E969DB9E8E43DB1D8786158B90B318B55CE55A421C7DD1CABD6A92C49C053D3DE38F4E89A024E22521
310
1DA61493F293D67BD2ECCBE69DECF684B022D1FF89E22C5F14456D4255AE711799479CB2622970266D3CDF9F61D463B62E64A9DFC6ABF10D7192C35CCA0A040B11BE0F8E6DBD3AFA601D8C77733B0397C290926D5B7356A40DC1F5BB3EB8D336F90F504B0304140006080800AC70623B503B51794E01000033030000300000
310
006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1E
310
BC4F77364A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C54
310
2347DEE050F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F
310
103F504B0304140006080800AC70623B2EA4D28F640500003C100000340000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F6F626A656374732E786D6CAD575D739B3814FD2B0CFB6C30B1D3263B844E6CC71D4F376DA79E76F621331E01326103122389C4E9AFDF
310
231018B09D7A3FFC609090EEE7B94757FE875D9E59CF54C894B31BDB73C6B64559C4E394253776A9B6A32BDBFA10F88273D559665B8CE4F4C6D6D376E027829785998AE99694991ACC2E677F5A32A28CDA569411296F6C193DD29C38A4543CA6F2C98989224EB2DD399E532FEC8B4D04291E07420B222853B014F30C52ACDA
310
28AF3F1CDB6EE0BBFA7BE0EB7FB36A727A955BF9D3D79F32A9088B0E940DC44CBCE9E2EEE2F27A74399D4E46D37717DE68B69C2D46DEFBC978FE6E3EBFBEBDBB8662A90424194B04DDDAC147C446A491EFD69F5A8B8DE1C74C8A386334AAFC878795CD46624C0BCA62E431A512DA3A5E8FFB434FC7A6F379A2C7466577FA3C
310
AFBA3B3A821ADB9B67D7521EFE0517E439A810926A54D5F1318ED6F81BEFA316729E996FA9B472A2A84849666569288878B5032CD54B02BF2746A35368846B0FECC0DBCBEBDA8AD2F835768F59B92DB34C43D30E2A646F807FAA646559FA938AE3DA60137255A64C5D1987D46B41EDE0DA77ABC9C0D78FC985F95807D2DA66
310
2441CAE166FD75E0E85CD7DE6A61079F96E16EADEBF1B8F242F0820AA5E1036835896B9E3A4A46AD7756E6F40638D38BF93E28DF10F9CF28DFBD29C89B4877D3DDD468518230B9E522476E9C71F5B3C6CDCBA87D3B7C019F0D561FAE6967FED562DF6D8DED13C6A9FC015C3A3557FF3D7FFD987591DA495FE03FA3C0B89898
310
50AE2392817AEE53868468505A19C714B87C1BEEEC6005A604B36317C9823620072FBEFB8CEFF8AF6583AD2AF59D274342077C7B06F323965559C0B6136039E0C94AB171EE54CC2FFF979AB95DAC3FAD4BB12511BD37C4B2A0DB94A50A67E71EBC5D837A89E879F4445F5FB888E1E86112D6DD24E4469544B475CC75E093E6
310
B0D083BDE69E8208FB12AE39CFFF8586FB544634CB08A3BC6CB4B4C790C66A4B32A64F4015D6019D5C0C502CE873AA3B89DE8A9E5938EB2391163A64EDA1D7F2B473C297EFABCF00A51DCC5EFF20AF5DC20CF7741FF18C8B4DF8BAA999D006F8B0A78FEE1F7D789B88BA5A0A105F61B9A11C13E24D9C6EB7A504EF1E89E28F
310
D5BC9BA996480E5F9A026A34D63539053BA3F68830F06D74A2211004073B679B14C738CAF2A8F2AEEEA10259C93D213F2CF36243725E32754E98C68D3F8DF5ADF06E17235F888A1EED605D3D473350764CE31309D547D0119F7AE979FFFEEA6E727BBD1C79B74BB4529717CBD1D5E5DC1B79B3B977395B4C96EF2638E6FA15
310
D09C50DD1A44347122FAA5484D98BFAFF6656B07F74449F7635D506E523FBFAF1CB4C5BE8B3D0078BB71951719CD295344C3F75EBF64DF08BA8A9E8C7A7E9593849E21E5CBC7F5C006CC9CB1EFAB2E35FA32D86B66E7BA168E0A518F651E329266838DC671A7608971BB0965FBAC19BD19EA918927FA50C9B33406E1C45642
310
794E1568E70CB6173995404CB72B8FCDEDE18CDDCF753FA84898D1C6924782963893403548A78C547FDEFA0D2D9CEEA26E6C1C76CE13FE4C21DA16527D6383DF541A51E984381E75E353090704D085B52408D0139664E8ACEB4DEDB8DDA56303FAC10968F4B74BCEE9968C5F3DE2CD4951E0D4EED16A659B5110FD23C71B73
310
2CA2F01A96AAF5653FD13A53A909C03570A77DA0857832AA77A8AFB7DDF29C6A4D2F2267DD93DE04412D75A48848AA7B810EBA31E976F1D5452B60ADBE58455626C8E5F992468202CCA52E70A008A830320BA200D5F9EF0F5F05C75D34B7962920F030E779CE9919DC9ABBACB57EC4CD347E002D507DFD901763CF7BA8BA7E
310
7311D984445287C4F209134DC1690F065803200F8E53733D73750E06CB570BCB1C185308AD407BD094D6D7700BC5A36F8EBA54BA6459BCD9F8BBD552A040A0650FFE06504B0304140006080000AC70623B000000000000000000000000350000006662782F33394334313030352D393437462D344341332D393833322D3144
310
373644414336394143352F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B
310
000000000000000000000000370000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F33394334313030352D393437462D344341332D393833
310
322D3144373644414336394143352F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607
310
FB144396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623B95BFD5E5FE000000A00100003B0000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265736F75726365732F63
310
6F72652E786D6C8D50596E833010BD0A9ADFCA603B1B41C611699213F40296992456828DBC543D7E4DA052FBD79F99D15B344F4F1CBE8667F1893E18675B60258502AD76BDB1B71652BC921A8A8314DEB9F84B06855503B630C120C5CDBB342E907636A28D19B5AEC70554216084423FF3D142D0771C54A952CC8AF02847A5
310
1FEA86252B339D755284E87380627E324D901E834B5E6310D5CC4A9192E9178DE9F34F7335E841EE38DBEEF8A5239B13ADC9FA589FC971F77E2217BEDDAFB61DEBE8B916D56496229AE127A3F6A822F62039A57BC218A1FC83AD1BBA69F8E68DD60DA5A29AE47F4C69ECFF694AC6C6155FE2CEB60092E5202F428A6AEA2BAF
310
5799794FDDCA6F504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B
310
436F6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BFD5588D4EC0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000095020000636E782E786D6C504B
310
01021400140006080800AC70623BB5D38BAD72010000D40300000C00000000000000000000000000190300006662782F636F72652E786D6C504B01021400140006080800AC70623B09885E1C7E0000009D0000000B00000000000000000000000000B50400006662782F636E782E786D6C504B01021400140006080800AC70
310
623B961D28872A0100001202000031000000000000000000000000005C0500006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D5060000
310
6662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F636E782E786D6C504B01021400140006080800AC70623B2EA4D28F640500003C1000003400000000000000000000000000710800006662782F33394334313030352D393437462D344341332D393833322D3144373644
310
414336394143352F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000270E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F76657274696365732E62696E504B01021400140006
310
080800AC70623BF270F133060000000400000036000000000000000000000000007A0E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F747269616E676C65732E62696E504B01021400140006080000AC70623B0000000000000000000000003700000000000000
310
000000000000D40E00006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000290F00006662782F33394334313030352D393437
310
462D344341332D393833322D3144373644414336394143352F6469726563746F72792E786D6C504B01021400140006080800AC70623B95BFD5E5FE000000A00100003B000000000000000000000000000D1000006662782F33394334313030352D393437462D344341332D393833322D3144373644414336394143352F7265
310
736F75726365732F636F72652E786D6C504B0506000000000E000E0080040000641100000000
  0
XRECORD
  5
10D
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10C
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
187
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
 70
     0
 90
1778669749
  1
7E355024-1ABF-47F9-966E-F2159FBE82AB
310
504B03040A0000080000AC70623B3DEE336E79000000790000001B0000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D3822203F3E3C666F726D6174733E3C666F726D61743E687474703A2F2F736368656D612E
310
6175746F6465736B2E636F6D2F64657369676E2D7061636B6167652F323030393C2F666F726D61743E3C2F666F726D6174733E504B0304140006080800AC70623BD486FD9CA0000000F4000000130000005B436F6E74656E745F54797065735D2E786D6C7D8EC10E82300C865F65E91D8A1E8C310C0EEA1BF002731658846E
310
D98AC1B77784ABF1D8FE5FBFBF75BBCE937A534CCEB38643598122B6FEE978D0B0485F9C41B54DDD7D022595594E1A469170414C76A4D9A4D207E29CF43ECE46F218070CC6BECC4078ACAA135ACF422C856C0E68EA1BF5669944DDD7BCDE7B1F8E415D77AECB980613C2E4AC91FC167A2B244592486606FC29C8FD7F045B9A
310
EF7053A7E60B504B0304140006080800AC70623BDCE527C8EB0000007C01000008000000636F72652E786D6C8D90416EC3201045AF82665B6103B15DC7C24471249FA01740405C94182C03558F5F9C3852BBEB6A467FFE9B197D7EFA9EEFE8CBACC17AD7032D0820E394D7D64D3DA478C52DA093E0ABF7F1970D9093B3E961
310
9341F069F569D925E55D342E66D5796D76518660222075CF4D0F417D9A591632C5EC08B76291EA262753D05797E194AC46CF2356E77DF66ACD0A621C9B73335C463C5E0E1457EC9DE2A1612D3E9233A92BD2D66333F07283058F767EDD57AB91D168108C9023A61413F641AB8ED41DABDF48DB11C2CBCDFE074A8BFE2794AC
310
8B07B6BFFBC402089A1F790C042FB72C72790495EB969BF801504B0304140006080800AC70623B55019EA25F0000007C00000007000000636E782E786D6C4DCB3B0E80201045D1AD90E915ED2CF8AC45050C11660C8261F98AB1B07AC9C97D42D718D865D3E909258CFD00CCE24AC6E326A164D74DC0B4128928FF32603847
310
2BA13128B1252AC747C6BAB984FC68F0B87FE8960A5C09FE86CFB69FBA01504B0304140006080800AC70623BB24894EB71010000D40300000C0000006662782F636F72652E786D6CC5535B6E833010BC8AE5DF0A6C085012194749244ED00B38E05014B091B1518EDFE511A5A9D228FD2A1F60CDEC7A67C6986D2F6D830669
310
FA5AAB0C073EC548AA4297B5AA32ECECC94B31DA7266B4B6DFCA3052A295191E61CC5965B4EB16A8D0CA4A650155BA940B28FA5E5A8C8A061619EE8B4FD90A5F380B15FDD9EF44711695F4031F68A8E3ACB70604A079C8F8C6FC74BC3032E39C3957970B5B9730AD3ED5D2609EE7C92ED91F722F3FAC022F0ADF036F9F84A9
310
B7A63B1A47348DF364CFC8D8CC99ADDBABBAC2486165897948E9DA0B028F861F41B4A1F1268CDF68BAA19491B1FCAEC975E58B4DAE5676152E72E7B61EF300844CC40FB7109145BD18400FE18C8C21C2674AF83E68080442B6E2D85C7D9C011A6461B5898029B5BB5183689C84A9D4A7D3837E5F303277C2D4697370FD7046
310
F8F28CE73BC2510B5581096161797476D4C9660D4B689D34DE602F4869D38AE6351B4F1CFE89BA897F28A9D08D36FFA5882C074496DF838CF7917F01504B0304140006080800AC70623B3A54DFB77D0000009D0000000B0000006662782F636E782E786D6C4DCCD10A83201805E05791FFDEA5EBA76DA046A37C8F581632D3
310
613AF6F8B3D1C52E0E073E0E47B49FD591B7899B0D5E023F3120C63FC264FD2221A7995E81B44AC410D2DF0C881F5723616750628921BF0E9ACC3C66978A3AEB9F07B2A6D77AB87514F95953EC39D20EEF9C6AD60C88BC2EB940A544F57B2ABD1FAB2F504B0304140006080800AC70623B4A17098729010000120200003100
310
00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C8D515B6EC32010BC0AE22B55850D0E76930813A54A7C825E80DA244589C1E251E5F85D6A476AFFF2018B7667666759B1BF8F37F4AD7D30CEB6981514236D7B37187B69718A67B2C1682F8577
310
2EFE816164D5A85B9CD3588A8B77695A52BDB351DB0859EB06BD2455083A62D4DFE0D1E2D07FE951152A4540846B31A9FEAA2EBA600594012745881E0CA0B949BEB1A4CDB1EB4EDB03E1ACEA083F324E0EFC9D918E3627CED91ACE9B2867A214299961A19B01EC98B3D1FE59914C96229AF161BFF75A453D605951BA258C11
310
5A7D30BEA3F5AEAA5FE96647A92833FC1F294DC393A4646C5C578BDD9916B064A29C0B520C2E7DDE1E66F47D723EA2DC6F1574FF02531594D6AC69443903617C506CF8A218A2F3F0BDABEB2760593DCB365C8A326F08C2EFFA20E66DCA1F504B0304140006080800AC70623B503B51794E0100003303000030000000666278
310
2F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6CD593C16EC32010447F0571AD6CE3D489D20813A9877E410FBD62D82434182CC055F3F75D1292E692438FBD206B7698593D61BEFD1E2DF982108D773D6D6B460938E5B571FB9ECE6957AD29D90A1EBC4F7736
310
4A9C1CA1A759A682EF839FA72269D8C9D92654AD71C72206887E0E0A22CAF926B15E498B01E0AA19451807D01A34B919F16B070157417138917400F2F6FA41FCF0092A45DEE414C19BDC21783E4BD39D891265658C3D8DEA00A3ACE59CBC8678ACB54CB26EEB6BD7839D7E9348BE70AD9C8321B9BCA7F9A4A26C542347DEE0
310
50F09802D22BA6749A800A394DD62899107273365E3C82CFC6A55557BC06C10774B7ABE7AEC3B0F34CF06446280E154026D0542C187BA9DAB6628BF7B6DBB0E566B17C62EB0D63BCC976C107EF6DB9843110FC449477095CA2A2E54D1E3FC2577C449B80AC7D38FD01240228AD173AB78CFFCCA739BF6FC415F02F103F504B
310
0304140006080800AC70623BD8F6D0D5660500003B100000340000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F6F626A656374732E786D6CAD575B8F9B3814FE2B887D064292B964C5504D92491555D3568D5AEDC348910187610730B2CD4C667FFD7E06438024
310
6DF6928780CDF1B97EE762EFC33E4B8D57CA45C2F23BD3B547A641F39045491EDF99A5DC59B7A6F1C1F73863B243661A39C9E89DA9B64DDF8B392B0BBD15D11D295339D85DCDFF304448736A1A614A84B83345F84C33629352B2888A173B2292D8F16E6FBB764DD8671B73523C0F981684D35C4253ECE7E062D44AB9FDE5C8
310
747CCF51DF7D4FFD6BAAC9792AA7B2A72F3FC985247978246CC066E24E970FE3AB9975359D4EACE9F5D8B5E6ABF9D2726F26A3C5F56231BB7F9841B0901C9CB4269CEE4CFF237CC393D073EA4FADC65AF1532A852CCF6958D90F0B2B9D35C78816348F10C7840A48EB583DEA2F5DE59BCEE7895A6B91DDEDCBACEA9EE8306A
310
746F9E5D4D59F0274C1097A0820BAA5055FB471B5AE36F74F05AC058AABF25C2C888A43C21A991260127FCDDF441AA487CAFC746A1932B842B0B4CDF3DF0EBEA8AD4F835764F69B92BD35441D3F42B646F817F2A45A559F217E5A7A54127C4AA4C7279AB0D92EF0535FD99E7549BBEA71E93B1FE583BD2D8A52446C86166FD
310
7560E842E5DE7A69FA9F56C17EA3F2F1B4F082B38272A9E0036835816B9ECA4B5AAC7B51E4D40118D3F3F9C129DFE0F9CF48DF832A881B4FF6D3FD544B919CE462C77886D8D8A3EA678C9A17AB7D3B7E413D1B501FD3B43BFF8AD8735A65FB05E35CFC002E159ADBFF1EBFBECFBA48ED84CFF75E91608C4FB42B372149517A
310
1E931C0151A03452862DD4F25DB037FD352A252A3B4E91D46F1D72F4E239AFF88EFF9A37AA5525BEF3CC11D041BDBDA0F2C397555A40B7336039AA9395606DDC399F5FFD2F3973BFDC7CDA947C4742FAA80BCB92EE923C91E89D07F07615EA05A267D10B7D7F633C82A1C741D8748390695102DE563E578E8F9B66A11607C9
310
3D0121CEC54CD53CEF17121E1311D2342539656523A56D430AAB6D91D17302B2B076E8643C4031A7AF899A247A143DB5D0EB439E14CA656DD36BEBB47DC696EFEBCF0025E8531690F440141CAA7DC852C6B7C1FBB62E8426B087237D70FFE8A35B3BD4515C00F80ACA4DC5D11EDE46C96E570A94DD134EFCB15E7403D5D691
310
E397267F1A89754A4E519C917A846BF43632310F7082BECEF26D822E8EAC3C29BC2B7B2840547CCFF00FCAACD8928C95B9BCC44DA3C69E46FB96797788116F4486CFA6BFA99ED61C153BA2D121543D10A80E74C2A65E786E1E265757A3F1D472EFE72B6B7AB39A59B3EBEB076B3576AF66ABF9C3EDF87EDE6A5469E27B4D83
310
EAA620BC8986E8953CD16EFEBE3E64ADE93F12299C8F753E3971FDFCBEB631157B0ECE00DFEDC17556A434A3B9240ABD8FEA25FD463054F478D4FBEB8CC4F4022E5F3E6E063A60E782735F55A6D1B7C159BDBB50B97092897C2EB32027493A38A80DB78B3CD66637AE6C9F75416F966AA5FD893154B03489506F2223A62CA3
310
1255E78262CF332A8098EE501EE9CBC305A75FEB71509220A58D26CF0413712A806AC0AD0C657FDFF80D139C1AA2EE4CF43AFB057F3A114D03A1BE3351DE6412526107E88E6AEEA998030218C2DA1A08A8913C4E3158D787DA757B4AF906E5070D50CB6F492E1996B45DBDBA9B91A240D3EE55D54A372D20FC478637EA1844
310
E23528656BCB61A335A61283CCAA8DD257034C102F5AF41EF9F573B35CBBA2E979E4A26BD24F415073B524E171752D50FA6995EE975F1D4C02C6FA8B51A4658C585ECEC9E214602E558203454085E6591009A82E7E7FFACA19AEA299B14A0081A705CB3296EBC5BDBECA1A9B675C4CA3279405AA6E1F623C72DDA76AE8D7F7
310
906D4004B549245EB0D1249CB260803500F2A89BEA10382A0603F2F5D2D00D630AA615688F66D2FA166E2079D4C551A54AB758163F9DFB9D8A1460E098D8FDBF01504B0304140006080000AC70623B000000000000000000000000350000006662782F30364446464539412D343132462D344431342D413442312D46303645
310
34343133343431372F76657274696365732E62696E504B0304140006080800AC70623BF270F1330600000004000000360000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E636660600000504B0304140006080000AC70623B0000
310
00000000000000000000370000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B0304140006080800AC70623B08DA0BD19000000041010000360000006662782F30364446464539412D343132462D344431342D413442312D
310
4630364534343133343431372F6469726563746F72792E786D6C858F410AC3201045AF22B36F53E9A60B35CBEEBAE80D244E44489C6234F4F835464A48035D0DF398FF9F8AF63D0E6CC63039F212F8F9020C7D47C6792B21C5FE7403D62A1188E2E60C98D7234A5830286103A55745067B9D86B8A3CF9C7F90C11DE607FB14
310
4396D7B6A82D282E9A152AD114D5EF2CB866EEE831B8EEA07A7BB5A8D7D61A2BAAEB7FD5F70921FF497D00504B0304140006080800AC70623BB40F7AF9FE000000A00100003B0000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F75726365732F636F72
310
652E786D6C8D504B6E833010BD0A9A6D65B00950828CA3109513F4029699502BC146FE543D7E4D42A576D7CDCCE87D344F8F9FBE967BF689CE6B6B7A6039850C8DB29336730F315C490BD94970676DF82583CCC8057BD860107C7636AE3BA4AC096842428D9D7007A5F7182053F774F4E0D5072E3297312485BFE5AB543739
310
63CEF244279DE03EB814207B3ED9260887DE46A7D0F3E2C90A1EA39E768D9ED24F7DD5E8408C63736E86CB1B192F0746AAF29591A1295B72A4675A57B4ADC766E0C566163CE8E527A37228034E204A4A8F843142CB775675B4EECAFA85B61DA5BCD8E47F4C719DFE698ADA8443B9C77DDA3C0896823C08C18BADAFB41E65A6
310
BD752BBE01504B010214000A0000080000AC70623B3DEE336E79000000790000001B00000000000000000000000000000000006175746F6465736B2D64657369676E2D7061636B6167652E786D6C504B01021400140006080800AC70623BD486FD9CA0000000F40000001300000000000000000000000000B20000005B436F
310
6E74656E745F54797065735D2E786D6C504B01021400140006080800AC70623BDCE527C8EB0000007C010000080000000000000000000000000083010000636F72652E786D6C504B01021400140006080800AC70623B55019EA25F0000007C000000070000000000000000000000000094020000636E782E786D6C504B0102
310
1400140006080800AC70623BB24894EB71010000D40300000C00000000000000000000000000180300006662782F636F72652E786D6C504B01021400140006080800AC70623B3A54DFB77D0000009D0000000B00000000000000000000000000B30400006662782F636E782E786D6C504B01021400140006080800AC70623B
310
4A17098729010000120200003100000000000000000000000000590500006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636F72652E786D6C504B01021400140006080800AC70623B503B51794E010000330300003000000000000000000000000000D10600006662
310
782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F636E782E786D6C504B01021400140006080800AC70623BD8F6D0D5660500003B10000034000000000000000000000000006D0800006662782F30364446464539412D343132462D344431342D413442312D46303645343431
310
33343431372F6F626A656374732E786D6C504B01021400140006080000AC70623B0000000000000000000000003500000000000000000000000000250E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F76657274696365732E62696E504B010214001400060808
310
00AC70623BF270F13306000000040000003600000000000000000000000000780E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F747269616E676C65732E62696E504B01021400140006080000AC70623B00000000000000000000000037000000000000000000
310
00000000D20E00006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F617474726962757465732E62696E504B01021400140006080800AC70623B08DA0BD190000000410100003600000000000000000000000000270F00006662782F30364446464539412D343132462D
310
344431342D413442312D4630364534343133343431372F6469726563746F72792E786D6C504B01021400140006080800AC70623BB40F7AF9FE000000A00100003B000000000000000000000000000B1000006662782F30364446464539412D343132462D344431342D413442312D4630364534343133343431372F7265736F
310
75726365732F636F72652E786D6C504B0506000000000E000E0080040000621100000000
  0
XRECORD
  5
10E
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
XRECORD
  5
10F
102
{ACAD_REACTORS
330
10B
102
}
330
10B
100
AcDbXrecord
280
     1
270
     1
271
     1
  0
CELLSTYLEMAP
  5
38A
102
{ACAD_REACTORS
330
FF
102
}
330
FF
100
AcDbCellStyleMap
 90
        3
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
    32768
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.25
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        1
 91
        1
300
_TITLE
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        5
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        2
 91
        1
300
_HEADER
309
CELLSTYLE_END
300
CELLSTYLE
  1
TABLEFORMAT_BEGIN
 90
        5
170
     1
 91
        0
 92
        0
 62
   257
 93
        1
300
CONTENTFORMAT
  1
CONTENTFORMAT_BEGIN
 90
        0
 91
        0
 92
      512
 93
        0
300

 40
0.0
140
1.0
 94
        2
 62
     0
340
11
144
0.18
309
CONTENTFORMAT_END
171
     1
301
MARGIN
  1
CELLMARGIN_BEGIN
 40
0.06
 40
0.06
 40
0.06
 40
0.06
 40
0.18
 40
0.18
309
CELLMARGIN_END
 94
        6
 95
        1
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        2
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        4
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
        8
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       16
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
 95
       32
302
GRIDFORMAT
  1
GRIDFORMAT_BEGIN
 90
        0
 91
        1
 62
     0
 92
       -2
340
0
 93
        0
 40
0.045
309
GRIDFORMAT_END
309
TABLEFORMAT_END
  1
CELLSTYLE_BEGIN
 90
        3
 91
        2
300
_DATA
309
CELLSTYLE_END
  0
ENDSEC
  0
SECTION
  2
ACDSDATA
 70
     2
 71
     8
  0
ACDSSCHEMA
 90
        0
  1
AcDb_Thumbnail_Schema
  2
AcDbDs::ID
280
    10
 91
        8
  2
Thumbnail_Data
280
    15
 91
        0
101
ACDSRECORD
 95
        0
 90
        1
  2
AcDbDs::TreatedAsObjectData
280
     1
291
     1
101
ACDSRECORD
 95
        0
 90
        2
  2
AcDbDs::Legacy
280
     1
291
     1
101
ACDSRECORD
  1
AcDbDs::ID
 90
        3
  2
AcDs:Indexable
280
     1
291
     1
101
ACDSRECORD
  1
AcDbDs::ID
 90
        4
  2
AcDbDs::HandleAttribute
280
     7
282
     1
  0
ACDSSCHEMA
 90
        1
  1
AcDbDs::TreatedAsObjectDataSchema
  2
AcDbDs::TreatedAsObjectData
280
     1
 91
        0
  0
ACDSSCHEMA
 90
        2
  1
AcDbDs::LegacySchema
  2
AcDbDs::Legacy
280
     1
 91
        0
  0
ACDSSCHEMA
 90
        3
  1
AcDbDs::IndexedPropertySchema
  2
AcDs:Indexable
280
     1
 91
        0
  0
ACDSSCHEMA
 90
        4
  1
AcDbDs::HandleAttributeSchema
  2
AcDbDs::HandleAttribute
280
     7
 91
        1
284
     1
  0
ACDSRECORD
 90
        0
  2
AcDbDs::ID
280
    10
320
22
  2
Thumbnail_Data
280
    15
 94
      896
310
89504E470D0A1A0A0000000D49484452000001000000009108030000001BE1960600000300504C5445212830FFFFFF2128300000000000000000000000000000000000000000000000000000330000660000990000CC0000FF0033000033330033660033990033CC0033FF0066000066330066660066990066CC0066FF0099
310
000099330099660099990099CC0099FF00CC0000CC3300CC6600CC9900CCCC00CCFF00FF0000FF3300FF6600FF9900FFCC00FFFF3300003300333300663300993300CC3300FF3333003333333333663333993333CC3333FF3366003366333366663366993366CC3366FF3399003399333399663399993399CC3399FF33CC00
310
33CC3333CC6633CC9933CCCC33CCFF33FF0033FF3333FF6633FF9933FFCC33FFFF6600006600336600666600996600CC6600FF6633006633336633666633996633CC6633FF6666006666336666666666996666CC6666FF6699006699336699666699996699CC6699FF66CC0066CC3366CC6666CC9966CCCC66CCFF66FF0066
310
FF3366FF6666FF9966FFCC66FFFF9900009900339900669900999900CC9900FF9933009933339933669933999933CC9933FF9966009966339966669966999966CC9966FF9999009999339999669999999999CC9999FF99CC0099CC3399CC6699CC9999CCCC99CCFF99FF0099FF3399FF6699FF9999FFCC99FFFFCC0000CC00
310
33CC0066CC0099CC00CCCC00FFCC3300CC3333CC3366CC3399CC33CCCC33FFCC6600CC6633CC6666CC6699CC66CCCC66FFCC9900CC9933CC9966CC9999CC99CCCC99FFCCCC00CCCC33CCCC66CCCC99CCCCCCCCCCFFCCFF00CCFF33CCFF66CCFF99CCFFCCCCFFFFFF0000FF0033FF0066FF0099FF00CCFF00FFFF3300FF3333
310
FF3366FF3399FF33CCFF33FFFF6600FF6633FF6666FF6699FF66CCFF66FFFF9900FF9933FF9966FF9999FF99CCFF99FFFFCC00FFCC33FFCC66FFCC99FFCCCCFFCCFFFFFF00FFFF33FFFF66FFFF99FFFFCCFFFFFF0000000D0D0D1A1A1A2828283535354343435050505D5D5D6B6B6B787878868686939393A1A1A1AEAEAEBB
310
BBBBC9C9C9D6D6D6E4E4E4F1F1F1FFFFFF0000000000000000000000000000000000000000000000000000000000002E4550F10000003B4944415478DAEDC13101000000C2A0F54F6D0B2FA0000000000000000000000000000000000000000000000000000000000000000000000000CE06919100016C9A5B1B0000000049
310
454E44AE426082
  0
ENDSEC
  0
EOF
`;function $Xe(o){return o==0?YXe:o==1?zOe:o==2?jXe:o==3?XXe:o==4?qXe:zOe}var KXe=new X0e,q0e=class{constructor(){this.delimiter=`\r
`;this.entityMap=new Map}initTemplate(t){this.templateDxfData||(this.templateDxfData=KXe.parseSync($Xe(t)).parseData,this.headerCodeInfo=Ss(KXe.headerCodeInfo))}getCurrentBlob(){return this.currentBlob}clearCurrentBlob(){this.currentBlob=null}decodeInit(t,e){this.initTemplate(e),this.dxfArr=[];let r=this.templateDxfData,i=t.origin||new S(0,0),n=Qe.translate(-i.x,-i.y).scale(nn.convert(1,t.unit,r.unit));this.matrix=n,this.decoderHeader(this.extends(r.header,t.header)),this.decoderClasses(),this.decoderTables(t.tables),this.decoderBlocks(this.extends(r.blocks,t.blocks),this.matrix)}handleDecodeEntity(t,e){t=="start"?this.decoderEntities(this.templateDxfData.entities,this.matrix):(this.handleEnFileData(e),this.autoEndSection(),this.decoderObjects(),this.autoItem(0,"EOF"),this.handleFileData())}decode(t){let{items:e,layer:r}=t;if(!e||!e.length)return this;let i=this.autoEntityItems(e);if(!i)return this;let n=this.entityMap.get(r);return typeof n<"u"?n.push(i):this.entityMap.set(r,[i]),this}extends(t,e){return Array.isArray(t)?t.concat(e):Object.assign({},t,e)}getDxfFileContent(){return this.dxfArr.join(this.delimiter)}handleDataByPiece(t){let e=t.length>=3?t.length/3:t.length,r=[];for(let i=0;i<t.length;i+=e)r.push(t.slice(i,i+e));return r}async handleEnFileData(t){for(let r of t){let i=this.entityMap.get(r);if(i!=null&&i.length){this.entityMap.delete(r);let n=this.handleDataByPiece(i);i=null;for(let s of n){for(let a of s)this.dxfArr.push(a);this.handleFileData()}}}let e=this.entityMap.keys();for(let r of e){let i=this.entityMap.get(r);if(this.entityMap.delete(r),i!=null&&i.length){for(let n of i)this.dxfArr.push(n);this.handleFileData()}}}handleFileData(t=this.dxfArr.join(this.delimiter)){let e=this.currentBlob?[this.currentBlob,this.delimiter+t]:[t];this.currentBlob=new Blob(e,{endings:"native"}),this.dxfArr=[]}downLoadFile1(t){let e=t+".dxf";D2?JI(this.currentBlob,e,"dxf"):xd.downloadFile(e,this.currentBlob),this.currentBlob=null}downLoadFile(t){if(D2){let e={dataStr:this.getDxfFileContent(),title:t+".dxf",extension:"dxf"};he.windowBridge.publish("ui/exportFileClient",e,Q())}else xd.downloadFileASCII(t+".dxf",this.getDxfFileContent())}autoItem(t,e){let r=[];Gb(r,t,e);let i=r[0];!i||i.length!=2||this.dxfArr.push(["  "+i[0],i[1]].join(this.delimiter))}autoItems(t){if(t)for(let e of t)this.autoItem(e[0],e[1])}autoStartSection(t){this.autoItem(0,"SECTION"),this.autoItem(2,t)}autoEndSection(){this.autoItem(0,"ENDSEC")}autoNumber(t){return isNaN(t)?0:t}autoVerctor2(t){this.autoItem(10,this.autoNumber(t&&t.x)),this.autoItem(20,this.autoNumber(t&&t.y))}decoderHeader(t){this.autoStartSection("HEADER");let e=this.headerCodeInfo,r=Object.keys(e);for(let i=0;i<r.length;i++){let n=r[i];this.autoItem(9,n);let s=e[n],a=t[n];if(typeof a=="object"&&Y0(a,"x")){let l=[];ph(l,a,10),this.autoItems(l)}else isNaN(s)?console.error("code must be a number!"):this.autoItem(s,a)}this.autoEndSection()}decoderClasses(){this.autoItems(this.templateDxfData.CLASSES_items)}decoderTables(t){let e=this.decorderLayerItems(t&&t.layers),r=Array.from(this.templateDxfData.TABLES_items);if(e&&e.length){let i=this.indexOfItem(r,[0,"LAYER"]);i===-1?console.error("the templateDxfData has no LAYER table."):r.splice(i,0,...e)}this.autoItems(r)}indexOfItem(t,e){if(!t||!e)return-1;let r=0;for(let i of t){if(i[0]===e[0]&&i[1]===e[1])return r;r++}return-1}autoLayerName(t){return(t||"").replace(/\s/g,"-")}decorderLayerItems(t){if(!t)return;let e=[];for(let r in t){let i=t[r];e.push([0,"LAYER"]),e.push([5,r]),e.push([100,"AcDbSymbolTableRecord"]),e.push([100,"AcDbLayerTableRecord"]),e.push([2,this.autoLayerName(i.name)]),e.push([70,0]),e.push([420,parseInt(i.activeColor.toString().slice(1),16)]),e.push([6,"Continuous"]),e.push([370,-3]),e.push([390,"F"]),e.push([347,21])}return e}decoderObjects(){this.autoItems(this.templateDxfData.OBJECTS_items)}decoderBlocks(t,e){if(!(!t||!Object.keys(t).length)){this.autoStartSection("BLOCKS");for(let r in t)this.decoderBlock(r,t[r],e);this.autoEndSection()}}decoderBlock(t,e,r){this.autoItem(0,"BLOCK"),this.autoItem(5,e.handle),this.autoItem(330,e.ownerHandle),this.autoItem(100,e.subclassTag[0]),e.paperSpace&&this.autoItem(67,e.paperSpace),this.autoItem(8,this.autoLayerName(e.layer)),this.autoItem(100,e.subclassTag[1]),this.autoItem(2,e.name||e.name2||t),this.autoItem(70,e.type||0),this.autoVerctor2(e.position),this.autoItem(3,e.name||e.name2||t),this.autoItem(1,e.xrefPath||""),this.decoderEntities(e.entities,r),this.autoItem(0,"ENDBLK"),this.autoItems(e.endBlock)}decoderEntities(t,e){if(!t){console.warn("entites is null data");return}this.autoStartSection("ENTITIES"),t.forEach(r=>{let i=r.multiply3(e).entityDxfItems();!i||!i.length||this.autoItems(i)})}autoEntityItems(t){if(!t)return null;let e=[],r,i;for(let n of t)i=n[0],r=n[1],r==null&&(r=0),r=Ej(i,r),!Object.is(NaN,r)&&e.push("  "+i+this.delimiter+r);return e.join(this.delimiter)}};var JS=new q0e,$0e=class{constructor(){this.handleIndex=-1;this.clearance=0;this.defaultStroke=1;this.defaultPadStroke=0;this.defaultViaStroke=0;this.layerOrder=[2,4,6,8,10,1,3,5,7,9,11,12,13,14,47];this.exportLayers=[];this.layerConfigMap=new Rl;this.isPanelize=!1;this.matrixArr=[];this.cur=0;this.hasShape=!1;A.subscribe("exportDxfFile",this.export.bind(this)),A.messageBus.rpcService("exportDxfFileRPC",async t=>await this.export(t))}async export(t){if(!R.getInstance().isactive||23==R.getInstance().doctype)return null;let e="exportDxf-time";Cn(e);let r={};r._start=performance.now(),await this.updateProgress(),this.handleIndex=1024,this.data={header:{$LWDISPLAY:this.autoStroke()},blocks:{},entities:[],tables:null,unit:10,unitName:"px(100)",scale:1,strokeWidth:10,layerConvertInfo:{},origin:R.getInstance().origin,CLASSES_items:null,TABLES_items:null,OBJECTS_items:null},this.hasShape=!1,this.entities_cache={},this.layerConfigMap.clear();let i=[];for(let a of t.layerConfigs)a.check&&(this.layerConfigMap.put(a.layerId,a),i.push(a.layerId));let n=t.objectConfigs;if(this.getMatrixArr(),await this.updateProgress(),r._initEnd=performance.now(),r.$init=r._initEnd-r._start,this.parseLayers(i),this.resetPanelizeState(),await this.updateProgress(),r._parseLayersEnd=performance.now(),r.parseLayers=r._parseLayersEnd-r._initEnd,JS.decodeInit(this.data,t.version),await this.updateProgress(),JS.handleDecodeEntity("start"),await this.updateProgress(),r._decodeEntityStartEnd=performance.now(),r.decodeEntityStart=r._decodeEntityStartEnd-r._parseLayersEnd,this.parseLineShape(n),await this.updateProgress(),r._parseLineShapeEnd=performance.now(),r.parseLineShape=r._parseLineShapeEnd-r._decodeEntityStartEnd,this.parseImage(n),await this.updateProgress(),r._parseImageEnd=performance.now(),r.parseImage=r._parseImageEnd-r._parseLineShapeEnd,this.parseTrack(n),await this.updateProgress(),r._parseTrackEnd=performance.now(),r.parseTrack=r._parseTrackEnd-r._parseImageEnd,this.parsePads(n),await this.updateProgress(),r._parsePadskEnd=performance.now(),r.parsePads=r._parsePadskEnd-r._parseTrackEnd,this.parseVias(n),await this.updateProgress(),r._parseViasEnd=performance.now(),r.parseVias=r._parseViasEnd-r._parsePadskEnd,this.parseTexts(n),await this.updateProgress(),r._parseTextsEnd=performance.now(),r.parseTexts=r._parseTextsEnd-r._parseViasEnd,this.parseDemension(n),await this.updateProgress(),r._parseDemensionEnd=performance.now(),r.parseDemension=r._parseDemensionEnd-r._parseTextsEnd,this.parseComponentSilkscreen(n),await this.updateProgress(),r._parseComponentSilkscreenEnd=performance.now(),r.parseComponentSilkscreen=r._parseComponentSilkscreenEnd-r._parseDemensionEnd,this.parsePanelize(),await this.updateProgress(),r._parsePanelizeEnd=performance.now(),r.parsePanelize=r._parsePanelizeEnd-r._parseComponentSilkscreenEnd,r.$parse=r._parsePanelizeEnd-r._initEnd,!this.hasShape)return A.publish("message",{type:"warn",message:"The exported file is empty, please check the layer or object."},Q()),this.updateProgress(1),null;JS.handleDecodeEntity("end",this.orderLayerNameArr()),await this.updateProgress(),r._decodeEntityEndEnd=performance.now(),r.decodeEntityEnd=r._decodeEntityEndEnd-r._parsePanelizeEnd,(typeof t.__isOnlyGetData>"u"||t.__isOnlyGetData===!1)&&(JS.downLoadFile1(t.title||"*"),this.updateProgress(1),this.cur=0),r._downLoadFileEnd=performance.now(),r.$file=r._downLoadFileEnd-r._parsePanelizeEnd,r.$all=performance.now()-r._start,console.warn(r),Xi(e);let s=JS.getCurrentBlob();return JS.clearCurrentBlob(),{blobData:s}}autoLayerConfig(t){return Object.assign({layerId:t,isMirror:!1,transparency:0},this.layerConfigMap.get(t))}autoEntity(t,e){t||console.warn("entity was null data!"),this.autoLayerConfig(e).isMirror&&(t=t.multiply3(Qe.MIRROR_X.setOrigin1(this.data.origin))),this.isPanelize&&this.parseEntityPanelize(t),JS.matrix&&(t=t.multiply3(JS.matrix));let i={items:t.entityDxfItems(),name:t.name,layer:t.entity.layer};JS.decode(i),this.hasShape=!0}orderLayerNameArr(){let t=[];for(let e of this.layerOrder){let r=this.autoLayer(e);t.push(r)}return t}autoLoadEntity(){let t=this.entities_cache;this.layerOrder.forEach(e=>{let r=this.autoLayer(e),i=t[r];i&&(this.data.entities=this.data.entities.concat(i),delete t[r])});for(let e in t)this.data.entities=this.data.entities.concat(t[e])}autoStroke(t){return Object.is(t,void 0)?this.defaultStroke:t}parseLayers(t){t&&(this.exportLayers=t,this.data.tables||(this.data.tables={}),this.data.tables.layers={},t.forEach(e=>{let r=Ze.getInstance().getLayer(e);r&&(this.data.tables.layers[this.autoHandle()]={name:r.name,activeColor:r.activeColor})}))}allowLayer(t){return this.exportLayers.includes(t)}autoHandle(){return(this.handleIndex++).toString()}autoLayerName(t){return(t||"").replace(/\s/g,"-")}autoLayer(t){let e=Ze.getInstance().getLayer(t);return e?this.autoLayerName(e.name):"0"}autoCircle(t,e,r,i,n){if(n){let c=yE.builder({type:yE.entityName,pcb_layer:null,handle:this.autoHandle(),layer:this.autoLayer(t),center:e,radius:r,lineStroke:i});n.layerId||(n.layerId=t),n.linkHandle=c.entity.handle,n.outlines=[c.cloneOne()],this.autoHatch(n)}let s=new S(e.x-r,e.y),a=new S(e.x+r,e.y),l=[q.build1(s,a,r,r,!1,ae.CCW),q.build1(a,s,r,r,!1,ae.CCW)];this.parsePoly2(t,l,null,{width:i})}parsePoly(t,e,r,i){if(!e)return;let n=e instanceof Bt?e.items:[e],s=!!r;for(let a of n){let l=a.primitives;if(r&&l.length>1){let c=[];a.points(.1,h=>{c.push(h)}),l=ge.build4(c).primitives}this.parsePoly2(t,l,r,i,s)}}parsePoly2(t,e,r,i,n=!1){if(!e)return;let s=this.autoStroke(i&&i.width),a=[];for(let u of e){let d=u instanceof q;if(u instanceof M||u instanceof q){let p,m;p=u.start(),m=u.end();let g=p.equals(m);if(e.length==1&&u instanceof q&&g){this.autoCircle(t,u.center,u.rx,s,r);return}if(g)continue;let y=0;d&&(y=gn(u.bulge,3),d&&u.sweepAngle<0&&(y=-y)),this.autoPushVertex(a,p,y),this.autoPushVertex(a,m)}else console.warn("need to parse this shape:",u)}let l=a.length;if(l==0)return;let c=!1;if(l>1&&a[0].entity.center.equals(a[l-1].entity.center)&&(a.pop(),c=!0),a.length<2)return;let h=gC.builder({type:gC.entityName,pcb_layer:null,handle:this.autoHandle(),layer:this.autoLayer(t),elevation:null,depth:null,shape:c,hasContinuousLinetypePattern:null,numberOfVertices:a.length,vertexs:a,width:s,startWidth:null,endWidth:null,extrusionDirectionX:null,extrusionDirectionY:null,extrusionDirectionZ:null});r&&(r.layerId||(r.layerId=t),r.linkHandle=h.entity.handle,n?r.outlines?r.outlines.push(h.cloneOne()):r.outlines=[h.cloneOne()]:r.outlines=[h.cloneOne()],this.autoHatch(r)),this.autoEntity(h,t)}autoPushVertex(t,e,r){let i=t&&t[t.length-1];if(i&&i.entity.center.equals(e)){r&&(i.entity.bulge=r);return}let n=R3.builderNull();n.entity.center=e,r&&(n.entity.bulge=r),t.push(n)}parsePads(t){if(!t)return;let e=[],r=[],i=[],n=[];t.includes("TopPad")&&(r=[1,5,7],r=r.filter(h=>this.allowLayer(h)),r.length&&e.push(1)),t.includes("BottomPad")&&(i=[2,6,8],i=i.filter(h=>this.allowLayer(h)),i.length&&e.push(2));let s=t.includes("MultiPad"),a=t.includes("PadDrill");(s||a)&&(n=s?[2,1,12,5,7,6,8]:[],a&&n.push(47),n=n.filter(h=>this.allowLayer(h)),n.length&&e.push(12));let l={1:r,2:i,12:n};if(e.length==0)return;let c=jn.getInstance().getAllItem();for(let h=0;h<c.length;h++){let u=c[h];if(!e.includes(u.layerId))continue;let d=l[u.layerId];d.length&&this.parsePad(u,d)}}parsePad(t,e){let r=this.clearance,i={width:this.defaultPadStroke};for(let n of e){let s=t.getFileGraphics(n,r);if(s)for(let a of s){let l=this.getHatchInfo("Fill Region");this.parsePoly(n,a,l,i)}}}parseTexts(t){let e=t.includes("Text"),r=t.includes("ComponentProperty");if(e||r){let i=io.getInstance().getAllItem();for(let n of i)this.allowLayer(n.layerId)&&n.value&&(e&&n.key===""||n.key!=""&&r)&&this.parseMText(n)}}getTextAlign(t){let e=0,r=0;return t==1?(e=3,r=0):t==2?(e=2,r=0):t==3?(e=1,r=0):t==4?(e=3,r=1):t==5?(e=2,r=1):t==6?(e=1,r=1):t==7?(e=3,r=2):t==8?(e=2,r=2):t==9&&(e=1,r=2),{valign:e,halign:r}}parseMText(t){let{fontSize:e,fontFamily:r}=t,i=this.splitOneLineText(t),n=is(t.layerId),s=!n&&t.mirror||n&&!t.mirror;this.autoLayerConfig(t.layerId).isMirror&&(s=!s);let l=t.rotation*180/Math.PI,c=s?-l:l;for(let h of i){if(!h.text)return;let u=h.position,d=this.getTextAlign(t.origin);this.autoEntity(N5.builder({type:N5.entityName,pcb_layer:null,handle:this.autoHandle(),layer:this.autoLayer(t.layerId),text:h.text,startPoint:u,endPoint:u,xScale:1.1,halign:d.halign,valign:d.valign,tiltAngle:0,height:h.textHeight,rotation:c,pcbString:null,reverse:s,fontSize:e*.7,fontFamily:r}),t.layerId)}}splitOneLineText(t){let e=t.value.split(`
`);if(e.length<2||t.getParent()!=null){let{showKey:a,showValue:l,key:c,value:h}=t,u=a&&l;return[{position:t.position,text:(a?c:"")+(u?":":"")+(l?h:""),textHeight:t.height*.7}]}let r=t.box.leftUp,i=[],n=t.box.leftUp.sub(t.box.leftLow).normalize(),s=t.box.height/e.length;return e.forEach((a,l)=>{let c=r.sub(n.mul(s*(l+1)));i.push({position:c,text:a,textHeight:s/1.2})}),i}parseVias(t){let e=t.includes("Via"),r=t.includes("ViaDrill");if(!e&&!r)return;let i=this.clearance,n={width:this.defaultViaStroke},s=e?[12,5,6]:[];if(r&&s.push(47),s=s.filter(l=>this.allowLayer(l)),!s.length)return;let a=bn.getInstance().getAllItem();for(let l of a)for(let c of s){let h=l.getFileGraphics(c,i);if(h)for(let u of h)this.parsePoly(c,u,void 0,n)}}parseLineShape(t){let e=[],r=!1;for(let i of t)switch(i){case"BoardOutline":e.push("Board Outline");break;case"BoardCutout":e.push("Slot Region");break;case"CopperOutline":e.push("Copper Region");break;case"SolidRegion":e.push("Fill Region");break;case"ProhibitedRegion":e.push("Prohibited Region");case"TearDrop":e.push("TearDrop");break;case"Line":e.push("Line");break;case"Shell_Outline":e.push("3D Shell - Outline");break;case"Shell_ScrewPillar":e.push("3D Shell - Screw Pillar");break;case"Shell_SideDatumLine":e.push("3D Shell - Side Datum Line");break;case"Shell_TopBottomSlotRegion":e.push("3D Shell - Top Slot Region");break;case"Shell_SideSlotRegion":e.push("3D Shell - Side Slot Region");break;case"Shell_SideEntity":e.push("3D Shell - Side Entity");break;case"Shell_TopBottomEntity":e.push("3D Shell - Top/Bottom Entity");break;case"FPCStiffener":e.push("FPC Stiffener");break;case"CopperFilled":r=!0;break;default:break}if(e.length){let i=Qi.getInstance().getAllItem(),n=Fi.getInstance().getAllItem(),s=vi.getInstance().getAllItem(),a=i.concat(n).concat(s);for(let l of a){let{type:c,layerId:h,strokeWidth:u}=l;e.includes(c)&&this.allowLayer(h)&&this.parsePoly(h,l.getMathGraphics(h),this.getHatchInfo(c),{width:u})}}if(r){let i=[];qo.getInstance().getAllItem().forEach(a=>{a.style!=="none"&&this.allowLayer(a.layerId)&&i.push(a)});let n=[],s=[];i.some(a=>{a.getOutline().forEach(l=>{l&&(n.push(l),s.push({style:a.style,layerId:a.layerId}))})}),n.forEach((a,l)=>{let c=s[l],h=this.getHatchInfo(c.style==="solid"?"Fill Region":"Copper Region");this.parsePoly(c.layerId,a,h,{width:.2})})}zn.iterator(i=>{let{layerId:n,style:s}=i;this.allowLayer(n)&&i.getOutline().forEach(a=>{let l=this.getHatchInfo(s?"Fill Region":"Line");this.parsePoly(n,a,l,{width:.2})})})}getPanelize(t){let e=si.getInstance().getDefaultPanelize();if(!(e==null?void 0:e.success))return[];let i=si.getInstance().getProfileGroup(t),n=si.getInstance().getPadGroup(t),s=si.getInstance().getText(t),a=t==12?si.getInstance().slots.map(l=>({primitives:l.getMathGraphics(t).primitives,type:l.type,strokeWidth:l.strokeWidth})):[];return[].concat(i,n,s,a)}getMatrixArr(){let t=si.getInstance().offset;if(Object.is(t,null))return;let{success:e}=si.getInstance().getDefaultPanelize();if(!e)return;let{row:r,column:i,borderAtTopBottom:n}=si.getInstance().getDefaultPanelize(),s=[];for(let a=1;a<=r;a++)for(let l=1;l<=i;l++){if(a==1&&l==1&&!n&&!n)continue;let c=Qe.translate(t.x*(l-1),t.y*(a-1));s.push(c)}s.length!==0&&(this.matrixArr=s)}parseEntityPanelize(t){var r,i,n;if(!((r=this.matrixArr)!=null&&r.length))return;let{onlyOutline:e}=si.getInstance().getDefaultPanelize();if(!(e&&t.entity.layer!=((i=Ze.getInstance().getLayer(11))==null?void 0:i.name))&&t.entity.layer!==((n=Ze.getInstance().getLayer(56))==null?void 0:n.name)){for(let s of this.matrixArr){let a=t.cloneOne().multiply3(s).multiply3(JS.matrix);a.entity.handle=this.autoHandle();let c={items:a.entityDxfItems(),name:a.name,layer:a.entity.layer};JS.decode(c)}this.hasShape=!0}}resetPanelizeState(){if(this.isPanelize=!1,!this.allowLayer(11))return;let t=si.getInstance().offset;if(Object.is(t,null))return;let{success:e}=si.getInstance().getDefaultPanelize();e&&(this.isPanelize=!0)}parsePanelize(){if(this.isPanelize){this.isPanelize=!1;for(let t of this.exportLayers){let e=this.getPanelize(t);for(let r of e)r instanceof ge?this.parsePoly(t,r):r instanceof Li?this.parseMText(r):r.primitives&&r.primitives.length>0&&this.parsePoly(t,ge.build2(r.primitives),this.getHatchInfo(r.type),{width:r.strokeWidth})}this.isPanelize=!0}}async updateProgress(t){let e=t;t||(e=(this.cur+=.2)/4),A.publish("progressUpdate",[e,"Export DXF"],Q()),await new Promise(r=>{setTimeout(r,30)})}autoHatch(t){var e;if(((e=t.outlines)==null?void 0:e.length)>0){let r=[];for(let i of t.outlines)r.push(i.cloneOne());this.autoEntity(s$.builder({type:s$.entityName,pcb_layer:null,handle:this.autoHandle(),layer:this.autoLayer(t.layerId),seedName:t.name,position:null,extrusionDirection:null,linkHandle:t.linkHandle,outlines:r}),t.layerId)}}getHatchInfo(t){let e=null;switch(t){case"Board Outline":case"Line":case"Copper Region":break;case"Fill Region":case"Slot Region":case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":case"FPC Stiffener":e={name:"SOLID",layerId:null,linkHandle:null,outlines:null};break;case"Prohibited Region":e={name:"ANSI37",layerId:null,linkHandle:null,outlines:null};break}return e}parseImage(t){if(t.includes("Image")){let e=Hs.getInstance().getAllItem();for(let r of e){let i=r.layerId;if(!this.allowLayer(i))continue;r.getPath().forEach(s=>{let a=[];s.pl.points(1,l=>{a.push(l)}),this.parsePoly(i,ge.build4(a),this.getHatchInfo(i===56?"Line":"Fill Region"),{width:this.autoStroke()})})}}}parseTrack(t){let e=[],r,i;if(t.includes("Track")){let n=Sn.getInstance().getAllItem();for(let s of n)if(r=s.layerId,!!this.allowLayer(r)&&(i=s.width,!s.start.equals(s.end))){if(e=this.autoLwPoly(e,s.primitive,{layerId:r,width:i}),e.length>1){let a=gC.builder({type:gC.entityName,pcb_layer:null,handle:this.autoHandle(),layer:this.autoLayer(r),elevation:null,depth:null,shape:!1,hasContinuousLinetypePattern:null,numberOfVertices:e.length,vertexs:e,width:i,startWidth:null,endWidth:null,extrusionDirectionX:null,extrusionDirectionY:null,extrusionDirectionZ:null});this.autoEntity(a,r)}e=[]}}}autoLwPoly(t,e,r){let i=e.start(),n=e.end(),s=0;if(e instanceof q&&(s=gn(e.bulge,3),e.sweepAngle<0)){let c=i;i=n,n=c}let a=t.length,l=t[a-1];if(a===0)this.autoPushVertex(t,i,s),this.autoPushVertex(t,n);else if(l&&l.entity.center.equals(i))s&&(l.entity.bulge=s),this.autoPushVertex(t,n);else if(t.length>1){r=r||{};let c=r.layerId||1,h=gC.builder({type:gC.entityName,pcb_layer:null,handle:this.autoHandle(),layer:this.autoLayer(c),elevation:null,depth:null,shape:!1,hasContinuousLinetypePattern:null,numberOfVertices:t.length,vertexs:t,width:this.autoStroke(r.width),startWidth:null,endWidth:null,extrusionDirectionX:null,extrusionDirectionY:null,extrusionDirectionZ:null});this.autoEntity(h,c);let u=[];return this.autoPushVertex(u,i,s),this.autoPushVertex(u,n),u}return t}parseDemension(t){if(t.includes("Dimension")){let e=Ma.getInstance().getAllItem(),r=Na.getInstance().getAllItem(),i=sl.getInstance().getAllItem(),n=e.concat(r).concat(i);for(let s of n){if(!this.allowLayer(s.layerId))continue;let a=s.getBaseGraphics();for(let l of a)this.parsePoly2(s.layerId,l)}}}parseComponentSilkscreen(t){if(!t.includes("ComponentSilkscreen"))return;let e=Ms.getInstance().getAllItem();for(let r of e){let i=r.getItems();for(let n of i){let s=+n.layerId;if(this.allowLayer(s)){if(n instanceof Li)this.parseMText(n);else if(n instanceof or){let{strokeWidth:a}=n,l=n.getMathGraphics();l&&this.parsePoly(s,l,this.getHatchInfo(n.type),{width:a})}}}}}};var K0e=class{constructor(){this.tool=null;this.state=Zt.getInstance();A.subscribe("toggleRouteCorner",t=>{switch(t){case"routeLine(WIRING_CORNER_LINE45)":this.state.type="WIRING_CORNER_LINE45";break;case"routeLine(WIRING_CORNER_LINE90)":this.state.type="WIRING_CORNER_LINE90";break;case"routeLine(WIRING_CORNER_ARC45)":this.state.type="WIRING_CORNER_ARC45";break;case"routeLine(WIRING_CORNER_ARC90)":this.state.type="WIRING_CORNER_ARC90";break;case"routeLine(WIRING_CORNER_ARC)":this.state.type="WIRING_CORNER_ARC";break;case"routeLine(WIRING_CORNER_FREEANGLE)":this.state.type="WIRING_CORNER_FREEANGLE";break}this.tool!=null&&this.tool.wireCorner(this.state.type),bh.type&&A.publish("FlushSketcherAttrView",{type:bh.type}),wi()}),A.subscribe("toggleRouteMode",t=>{switch(t){case"routeMode(WIRING_MODE_OBSTRUCT)":this.state.mode="WIRING_MODE_OBSTRUCT";break;case"routeMode(WIRING_MODE_SURROUND)":this.state.mode="WIRING_MODE_SURROUND";break;case"routeMode(WIRING_MODE_IGNORE)":this.state.mode="WIRING_MODE_IGNORE";break;case"routeMode(WIRING_MODE_PUSHAWAY)":this.state.mode="WIRING_MODE_PUSHAWAY";break;case"routeMode(WIRING_MODE_SURROUND_AND_PUSHAWAY)":this.state.mode="WIRING_MODE_SURROUND_AND_PUSHAWAY";break}this.tool!=null&&this.tool.wireMode(this.state.mode),A.publish("flushSelectingInfo",""),wi()}),A.subscribe("WireWidth",this.wireWidth.bind(this))}addDrawTool(t){this.tool=t,this.tool!=null&&(this.tool instanceof vo||this.tool instanceof hc||this.tool instanceof Ac||this.tool instanceof Vh||this.tool instanceof lC||this.tool instanceof hC||this.tool instanceof cC)&&(we.isRouting=!0)}clearDrawTool(){this.tool!=null&&(this.tool instanceof vo||this.tool instanceof hc||this.tool instanceof Ac||this.tool instanceof Vh||this.tool instanceof lC||this.tool instanceof hC||this.tool instanceof cC)&&(we.isRouting=!1),this.tool=null}toggleWidth(t){if(t=="WIRING_WIDTH_COMMONLY_SSETTING")A.publish("openSystemDialog","PCB_COMM_TRACK_WIDTH",Q());else if(t=="WIRING_WIDTH_RULESSETTING"){let e={activeMenu:"Track"};A.publish("openMainDialog",{cmd:5,data:{option:e}})}else if(t=="WIRING_WIDTH_INPUT")A.publish("openMainDialog",{cmd:26,data:{tool:this.tool}});else if(this.tool!=null&&(this.tool instanceof vo||this.tool instanceof hc||this.tool instanceof Ac||this.tool instanceof Vh||this.tool instanceof lC||this.tool instanceof hC||this.tool instanceof cC))this.tool.toggleWidth(t);else{let r=le.trackConfig[t].getSizeAccordingToUnit();we.prevTrackWidth=r}}getNextType(){return this.state.getNextType(we.diffTrack)}wireWidth(t){if(this.tool!=null&&t.length==2&&(this.tool instanceof vo||this.tool instanceof hc)){let e=parseFloat(t[1])/10;isNaN(e)||(R.getInstance().unit!="mil"&&(e=new dt().conversion(R.getInstance().unit,"mil",e)),this.tool.setWireWidth(e),wi()),A.publish("updateFrame","")}bh.type&&A.publish("FlushSketcherAttrView",{type:bh.type})}getTool(){return this.tool}};var Z0e=class{constructor(t,e,r,i,n){this.hotKey=t,this.action=e,this.uiAction=r,this.subHotkey=i,this.menuHotkeyCmd=n}},d_=class{constructor(){this.pcbMap=new Array;this.ftMap=new Array}modifyPcb(t,e,r,i,n){let s=!1;if(this.pcbMap.forEach(a=>{!s&&a.action===e&&(a.hotKey=t,a.uiAction=r,a.subHotkey=i,a.menuHotkeyCmd=n,s=!0)}),!s){let a=new Z0e(t,e,r,i,n);this.pcbMap.push(a)}}modifyFootprint(t,e,r,i,n){let s=!1;if(this.ftMap.forEach(a=>{!s&&a.action===e&&(a.hotKey=t,a.uiAction=r,a.subHotkey=i,a.menuHotkeyCmd=n,s=!0)}),!s){let a=new Z0e(t,e,r,i,n);this.ftMap.push(a)}}setConfig(t,e,r,i,n,s){switch(t){case 1:this.modifyPcb(e,r,i,n,s),this.modifyFootprint(e,r,i,n,s);break;case 4:this.modifyPcb(e,r,i,n,s);break;case 5:this.modifyFootprint(e,r,i,n,s);break}}getAction(t){let e=this.getHotkeyByKey(t);return e?e.action:null}getHotkeyByKey(t){if(R.getInstance().doctype===3||23==R.getInstance().doctype){for(let e of this.pcbMap)if(e.hotKey===t)return e;return null}else if(R.getInstance().doctype===4){for(let e of this.ftMap)if(e.hotKey===t)return e;return null}return null}getHotkeyByKey2(t){if(R.getInstance().doctype===3||23==R.getInstance().doctype){for(let e of this.pcbMap)if(e.hotKey===t||e.subHotkey===t)return e;return null}else if(R.getInstance().doctype===4){for(let e of this.ftMap)if(e.hotKey===t||e.subHotkey===t)return e;return null}return null}getHotkey(t){if(R.getInstance().doctype===3||23==R.getInstance().doctype){for(let e of this.pcbMap)if(e.action===t)return e.hotKey;return null}else if(R.getInstance().doctype===4){for(let e of this.ftMap)if(e.action===t)return e.hotKey;return null}return null}getHotkeyInfo(t){if(R.getInstance().doctype===3||23==R.getInstance().doctype){for(let e of this.pcbMap)if(e.action===t)return e;return null}else if(R.getInstance().doctype===4){for(let e of this.ftMap)if(e.action===t)return e;return null}return null}};var ZXe={F1:!0,F4:!0,F6:!0,F7:!0,F9:!0,F10:!0,"Ctrl+Shift+R":!0,"Ctrl+Shift+O":!0,"Ctrl+Shift+B":!0,"Shift+Alt+E":!0,"Ctrl+Shift+G":!0,"Ctrl+L":!0,"Ctrl+Tab":function(){return!0},"Ctrl+Shift":!0,"Ctrl+H":!0,"Ctrl+Page Down":!0,"Ctrl+Shift+H":!0,"Shift+Alt+H":!0,"Ctrl+Shift+E":!0,"Ctrl+Shift+C":!0,"Ctrl+Shift+T":!0,"Ctrl+Shift+D":!0,"Ctrl+Shift+M":!0,"Ctrl+Shift+X":!0,"Ctrl+J":!0,"Ctrl+N":!0,"Ctrl+O":!0,"Ctrl+P":!0,"Ctrl+S":!0,Space:!0,"Ctrl+F":!0,"Ctrl+Shift+F":!0,"Ctrl+A":!0,"Alt+V":!0,Alt:!0,"Cmd+W":!0,"Ctrl+1":!0,"Ctrl+2":!0,"Ctrl+3":!0,"Ctrl+4":!0,"Ctrl+5":!0,"Ctrl+6":!0,"Ctrl+7":!0,"Ctrl+8":!0,"Ctrl+9":!0,"Ctrl+K":!0,"Ctrl+E":!0,F5:!0,"Ctrl+R":!0,"Shift+F5":!0,ESC:!0,"Ctrl+U":!0,"Ctrl+G":!0,"Ctrl+=":!0,Enter:!0,"Ctrl+-":!0,"Ctrl+0":!0,"Shift+Esc":!0,"Ctrl+T":!0,"Ctrl+Shift+N":!0,"Ctrl+W":!0,"Ctrl+F4":!0,"Ctrl+Page Up":!0,"Ctrl+Shift+Tab":!0},c$=class{constructor(){this.scenes={};this.hotkeys=new Set;this.scenes[1]=new d_,this.scenes[2]=new d_,this.scenes[3]=new d_,this.scenes[4]=new d_,this.scenes[5]=new d_,this.scenes[6]=new d_}restore(){this.hotkeys.clear()}modify(t,e,r,i,n,s,a){let l=this.scenes[t];l!=null&&(l.setConfig(e,r,i,n,s,a),this.hotkeys.add(r))}getHotKey(t){let e=this.getKeyCode(t.keyCode);return t.altKey&&e!=="Alt"&&(e="Alt+"+e),t.shiftKey&&e!=="Shift"&&(e="Shift+"+e),(A2?t.realCtrlKey:t.ctrlKey)&&e!=="Ctrl"&&e!="Control"&&(e=A2?"Control+"+e:"Ctrl+"+e),A2&&t.metaKey&&e!=="Cmd"&&(e="Cmd+"+e),e}getCtrlShift(){return(A2?"Control+":"Ctrl+")+"Shift"}shouldPreventHotkey(t){if(!t)return!1;let e={};for(let r in ZXe){let i=this.fixCtrl(r);e[i]=ZXe[r]}return typeof e[t]=="function"?e[t]():e[t]}fixCtrl(t){return typeof t=="string"&&(A2?t=t.replace(/Ctrl/g,"Cmd"):(t=t.replace(/Control\+Cmd|Cmd\+Control/g,"Ctrl"),t=t.replace(/Control/g,"Ctrl"),t=t.replace(/Cmd/g,"Ctrl"))),t}getLocalAction(t,e){let r=this.getHotKey(e),i=this.scenes[6];if(i!=null){let n=i.getAction(r.toString());if(t.includes(n))return n&&A.windowBridge.publish("sensorsEventsReport",{eventName:"hotkey",eventType:"pcb",eventData:{hotkey:r.toString(),function:n}},Q()),n}return null}getAction(t,e){let r=this.getHotKey(e);if(this.handleHotkeyAction)return this.handleHotkeyAction;if(Array.isArray(t))for(let i of t){let n=this.scenes[i];if(n!=null){let s=n.getAction(r.toString()),a=di.overrideAction[i];if(a!=null&&s!=null&&a.indexOf(s)>=0)return A.windowBridge.publish("sensorsEventsReport",{eventName:"hotkey",eventType:"pcb",eventData:{hotkey:r.toString(),function:s}},Q()),this.hotkeyIsValid(e,s)?s:null;if(s!=null&&a==null)return A.windowBridge.publish("sensorsEventsReport",{eventName:"hotkey",eventType:"pcb",eventData:{hotkey:r.toString(),function:s}},Q()),this.hotkeyIsValid(e,s)?s:null}}else{let i=this.scenes[t];if(i!=null){let n=i.getAction(r.toString());return n&&A.windowBridge.publish("sensorsEventsReport",{eventName:"hotkey",eventType:"pcb",eventData:{hotkey:r.toString(),function:n}},Q()),i.getAction(r.toString())}}return null}hotkeyIsValid(t,e){return e?!0:!t.mouseInFrame&&e?!!this.scenes[1].getHotkeyInfo(e):!0}getConfigHotkey(t){let e="";for(let r in this.scenes)if(e=this.scenes[r].getHotkey(t),e==null)e="";else return e;return e}getConfigHotkeyInfo(t){let e;for(let r in this.scenes)if(e=this.scenes[r].getHotkeyInfo(t),e!=null)return e;return null}getKeyCode(t){switch(t){case 65:return"A";case 66:return"B";case 67:return"C";case 68:return"D";case 69:return"E";case 70:return"F";case 71:return"G";case 72:return"H";case 73:return"I";case 74:return"J";case 75:return"K";case 76:return"L";case 77:return"M";case 78:return"N";case 79:return"O";case 80:return"P";case 81:return"Q";case 82:return"R";case 83:return"S";case 84:return"T";case 85:return"U";case 86:return"V";case 87:return"W";case 88:return"X";case 89:return"Y";case 90:return"Z";case 48:return 0;case 49:return 1;case 50:return 2;case 51:return 3;case 52:return 4;case 53:return 5;case 54:return 6;case 55:return 7;case 56:return 8;case 57:return 9;case 96:return"Num0";case 97:return"Num1";case 98:return"Num2";case 99:return"Num3";case 100:return"Num4";case 101:return"Num5";case 102:return"Num6";case 103:return"Num7";case 104:return"Num8";case 105:return"Num9";case 106:return"Num*";case 107:return"Num+";case 108:return"Enter";case 109:return"Num-";case 110:return"Num.";case 111:return"Num/";case 112:return"F1";case 113:return"F2";case 114:return"F3";case 115:return"F4";case 116:return"F5";case 117:return"F6";case 118:return"F7";case 119:return"F8";case 120:return"F9";case 121:return"F10";case 122:return"F11";case 123:return"F12";case 8:return A2?"Delete":"Backspace";case 27:return"Esc";case 39:return"Right";case 37:return"Left";case 40:return"Down";case 38:return"Up";case Vy.sub:return"-";case 190:return".";case 32:return"Space";case 9:return"Tab";case 33:return"Page Up";case 34:return"Page Down";case 13:return"Enter";case 45:return"Insert";case Vy.SEMICOLON:return";";case 46:return"Delete";case 192:return"`";case 191:return"/";case 144:return"NumLock";case 17:return A2?"Control":"Ctrl";case 36:return"Home";case 35:return"End";case 16:return"Shift";case 219:return"[";case 221:return"]";case 220:return"\\";case Vy.EQUAL:return"=";case 188:return",";case 222:return"'";case 20:return"CapeLock";case 18:return"Alt";case 91:return A2?"Cmd":"";default:return"Cmd"}}isAltAndDirection(t){if(t.toString().startsWith("Alt"))return!0;let e={F4:!0,F6:!0,F7:!0,F9:!0,F10:!0},r=["Right","Left"],i=!1;for(let n=0,s=r.length;n<s;n++)if(t==="Alt+"+r[n]){i=!0;break}return e[t]&&(i=!0),i}useBrowserHotkey(t){let e=!1;return{F11:!0,"Ctrl+V":!0}[t]&&(e=!0),e}},J0e=class extends c${getHotkeyInfo(t,e){let r=this.getHotKey(e);if(Array.isArray(t))for(let i of t){let n=this.scenes[i];if(n!=null){let s=n.getHotkeyByKey(r.toString());if(s){let a=s.uiAction;return A.windowBridge.publish("sensorsEventsReport",{eventName:"hotkey",eventType:"pcb",eventData:{hotkey:r.toString(),function:a}},Q()),s}}}else{let i=this.scenes[t];if(i!=null){let n=i.getHotkeyByKey(r.toString());return n&&A.windowBridge.publish("sensorsEventsReport",{eventName:"hotkey",eventType:"pcb",eventData:{hotkey:r.toString(),function:n.uiAction}},Q()),n}}return null}};var Q0e=class{constructor(){this.lexicalSplit=" ";this.sentenceSplit=";";this.cmdMap={};this.cmdMap.x="Absolute",this.cmdMap.ix="Relative",this.cmdMap.iy="RelativeY",this.cmdMap.l="ToggleLayer",this.cmdMap.z="DisplayLayer",this.cmdMap.s="Find",this.cmdMap.w="WireWidth",A.subscribe("globalCommand",this.parse.bind(this))}modify(t,e){let r=this.getKey(t);r!=null&&(delete this.cmdMap[r],this.cmdMap[e.toLocaleLowerCase()]=t)}getKey(t){for(let e in this.cmdMap)if(this.cmdMap[e]==t)return e;return null}parse(t){let e=t.split(this.sentenceSplit);for(let r of e){let i=this.parseSentence(r,this.lexicalSplit);i[0]=this.cmdMap[i[0].toLocaleLowerCase()],A.publish(i[0],i)}}parseSentence(t,e){let r=new Array,i=t.split(e);for(let n=0,s=i.length;n<s;n++){let a=i[n];switch(a){case";":case" ":case"":break;default:r.push(a)}}return r}};var efe=class{constructor(){this.inputInfo=fi.getInstance();this.joinGroup=!1;this.ungroupSelected=!1;this.flip=!1;this.has2DLine=!1;this.canDispersedLine=!1;this.hasMultiUnCloseLine=!1;this.hasSelected=!1;this.hasMoreThanOneSelected=!1;this.hasSelectedDevice=!1;this.hasSelectedPad=!1;this.hasSelectedNet=!1;this.onlyAbstractProfile=!1;this.canDupToOtherLayer=!1;this.canDupToCursor=!1;this.onlyDevice=!1;this.twoDevice=!1;this._canIntersectionAggregate=!1;this._canSubtractionExclusive=!1;this._canBooleanSplit=!1;this._canSplit=!1;this._canCutout=!1;this._canAvoidSlotsOrPads=!1;this.route=!1;this._rotate=!1;this._canCopy=!1;this._isRouting=!1;this._redo=!1;this._undo=!1;this._adsorb=!0;this._realTimeDRC=!1;this._flipBoard=!1;this._removeLoop=!0;this._autoTrimSilkscreen=!0;this.command="";this.moveStatus=!1;this._smartMode=!1;this._editPadShapeMode=!1;this._grayState=0;this._diffTrack=!1;this._oldTrackParam={type:null,mode:null};this._docNeedUpdate=!1;this._topBoardColor="#FFFFFF";this._topSilkscreenColor="#000000";this._bottomBoardColor="#FFFFFF";this._bottomSilkscreenColor="#000000";this._footprintIsConnectDevice=!1;this._drawingProfile=!1;this.hasPoly2DLine=!1;this.canConvert2dLine=!1;this.hasBoard=!1;this._isShowBottomLayerScrollBarShow=!0;this.needSelectAlignRefObject=!1;this.needSelectAlignRefObjectForCenters=!0;this.isCheckedCrossProbeMode=!0;this._prevTrackWidth=null;this._stretchTrackMinCorner=1;he.messageBus.rpcService("pcb/getTopMenuStatus",this.getTopMenuStatus.bind(this)),he.messageBus.rpcService("/pcb/model/2dPreview/setPattern",()=>It.getInstance().pattern)}get footprintIsConnectDevice(){return R.getInstance().footprintIsConnectDevice}set footprintIsConnectDevice(t){R.getInstance().footprintIsConnectDevice=t}get drawing(){return this._drawingProfile}set drawing(t){this._drawingProfile=t}get docNeedUpdate(){return this._docNeedUpdate}set docNeedUpdate(t){this._docNeedUpdate=t}get smartMode(){return this._smartMode}set smartMode(t){this._smartMode=t,this.synchronize()}get editPadShapeMode(){return this._editPadShapeMode}set editPadShapeMode(t){this._editPadShapeMode=t}get grayState(){return this._grayState}set grayState(t){this._grayState=t,this.synchronize()}setCommand(t){this.command=t,this.synchronize()}getCommand(){return this.command}get ruler(){return R.getInstance().openRuler}get sizeFollowRule(){return le.pcbConfig.startViaSize=="rule"}set sizeFollowRule(t){le.pcbConfig.startViaSize=t?"rule":"last"}get prevTrackWidth(){return this._prevTrackWidth==null&&(this._prevTrackWidth=1),this._prevTrackWidth}set prevTrackWidth(t){this._prevTrackWidth=t,this.synchronize()}get stretchTrackMinCorner(){return this._stretchTrackMinCorner}set stretchTrackMinCorner(t){this._stretchTrackMinCorner=Math.floor(t)}get widthFollowRule(){return le.pcbConfig.startTrackWidth==="rule"}set widthFollowRule(t){le.pcbConfig.startTrackWidth=t?"rule":"last",this.synchronize()}set undo(t){this._undo=t,this.synchronize()}set redo(t){this._redo=t,this.synchronize()}get scale(){return Ai().getScale()}get canvasWidth(){return this.inputInfo.canvasWidth}get canvasHeight(){return this.inputInfo.canvasHeight}get mouseRealX(){return this.inputInfo.mouseX}get mouseRealY(){return this.inputInfo.mouseY}get mouseX(){return _o(new S(this.inputInfo.sceneX,this.inputInfo.sceneY)).x}get mouseY(){return _o(new S(this.inputInfo.sceneX,this.inputInfo.sceneY)).y}get sceneX(){return this.inputInfo.sceneX}get sceneY(){return this.inputInfo.sceneY}get tabId(){return R.getInstance().tabId}get doctype(){return R.getInstance().doctype}get isShowBottomLayerScrollBarShow(){return this._isShowBottomLayerScrollBarShow}set isShowBottomLayerScrollBarShow(t){this._isShowBottomLayerScrollBarShow=t}select(t){let{hasSelected:e,rotate:r,canCopy:i,flipMenu:n,hasMoreThanOneSelected:s,hasSelectedDevice:a,hasSelectedPad:l,hasSelectedNet:c,onlyAbstractProfile:h,canDupToOtherLayer:u,canDupToCursor:d,onlyDevice:p,twoDevice:m,joinGroup:g,ungroupSelected:y,route:b,flip:P,has2DLine:T,canDispersedLine:I,hasMultiUnCloseLine:C,canIntersectionAggregate:E,canSubtractionExclusive:O,canBooleanSplit:_,canSplit:x,canCutout:v,hasPoly2DLine:D,canConvert2dLine:w,hasBoard:F,canAvoidSlotsOrPads:H}=t;this.hasSelected=e,this.rotate=r,this.canCopy=i,this.flipMenu=n,this.hasMoreThanOneSelected=s,this.hasSelectedDevice=a,this.hasSelectedPad=l,this.hasSelectedNet=c,this.onlyAbstractProfile=h,this.canDupToOtherLayer=u,this.canDupToCursor=d,this.onlyDevice=p,this.twoDevice=m,this.joinGroup=g,this.ungroupSelected=y,this.flip=P,this.route=b,this.has2DLine=T,this.canDispersedLine=I,this.hasMultiUnCloseLine=C,this._canIntersectionAggregate=E,this._canSubtractionExclusive=O,this._canBooleanSplit=_,this._canSplit=x,this._canCutout=v,this.hasPoly2DLine=D,this.canConvert2dLine=w,this.hasBoard=F,this._canAvoidSlotsOrPads=H,this.synchronize()}allowFlip(t){this.flip=t,this.synchronize()}move(t){this.moveStatus=t,this.flipMenu=!this.moveStatus,this.synchronize()}set adsorb(t){this._adsorb=t,this.synchronize()}set isRouting(t){this._isRouting=t,this.synchronize()}get realTimeDRC(){return this._realTimeDRC}set realTimeDRC(t){this._realTimeDRC=t,this.synchronize()}get adsorb(){return this._adsorb}set flipBoard(t){this._flipBoard=t,this.synchronize()}get flipBoard(){return this._flipBoard}set removeLoop(t){this._removeLoop=t,this.synchronize(),bh.type&&he.publish("FlushSketcherAttrView",{type:bh.type}),he.publish("flushSelectingInfo","")}get removeLoop(){return this._removeLoop}get autoTrimSilkscreen(){return this._autoTrimSilkscreen}set autoTrimSilkscreen(t){this._autoTrimSilkscreen=t,this.synchronize()}set rotate(t){this._rotate=t,this.synchronize()}get rotate(){return this._rotate}set canCopy(t){this._canCopy=t,this.synchronize()}get canCopy(){return this._canCopy}get diffTrack(){return this._diffTrack}get canIntersectionAggregate(){return this._canIntersectionAggregate}get canSubtractionExclusive(){return this._canSubtractionExclusive}get canBooleanSplit(){return this._canBooleanSplit}get canSplit(){return this._canSplit}get canCutout(){return this._canCutout}get canAvoidSlotsOrPads(){return this._canAvoidSlotsOrPads}set diffTrack(t){this._diffTrack=t,this.synchronize()}get gridX(){return It.getInstance().getGridX()}get gridY(){return It.getInstance().getGridY()}get snapX(){return It.getInstance().getSnapX()}get snapY(){return It.getInstance().getSnapY()}get topBoardColor(){return this._topBoardColor}set topBoardColor(t){this._topBoardColor=t}get topSilkscreenColor(){return this._topSilkscreenColor}set topSilkscreenColor(t){this._topSilkscreenColor=t}get bottomBoardColor(){return this._bottomBoardColor}set bottomBoardColor(t){this._bottomBoardColor=t}get bottomSilkscreenColor(){return this._bottomSilkscreenColor}set bottomSilkscreenColor(t){this._bottomSilkscreenColor=t}get angleDelta(){return It.getInstance().angleDelta}get radius(){return It.getInstance().radius}get startAngle(){return It.getInstance().startAngle}get endAngle(){return It.getInstance().endAngle}get minRadius(){return It.getInstance().minRadius}get maxRadius(){return It.getInstance().maxRadius}get gridType(){return R.getInstance().gridType}set gridType(t){R.getInstance().gridType=t,this.realSynchronize()}get multiType(){return R.getInstance().multiType}set multiType(t){R.getInstance().multiType=t,this.realSynchronize()}get multiRatio(){return R.getInstance().multiRatio}set multiRatio(t){R.getInstance().multiRatio=t,this.realSynchronize()}getGridTypeByNum(t){switch(t){case 0:return"none";case 1:return"grid";case 2:return"outlets"}}getGridTypeByStr(t){switch(t){case"none":return 0;case"grid":return 1;case"outlets":return 2}}updateGridRange(t,e,r,i){It.getInstance().startAngle=t,It.getInstance().endAngle=e,It.getInstance().minRadius=r,It.getInstance().maxRadius=i}synchronize(){this.antiShake==null?this.antiShake=this.update(this.getCheck(),this.getDisable()):(clearTimeout(this.antiShake),this.antiShake=this.update(this.getCheck(),this.getDisable()));let t=Ai().getScale(),e=je(this.gridX),r=je(this.gridY),i=je(this.snapX),n=je(this.snapY),s=R.getInstance().unit,a=gn(vL(It.getInstance().angleDelta),1,!0),l=Bs.conversion1("mil",R.getInstance().unit,It.getInstance().radius*10),c=R.getInstance().tabId;he.publish("setSG",{scale:t,gridX:e,gridY:r,snapX:i,snapY:n,unit:s,polarAngleStep:a,polarRadiuStep:l,tabId:c},Q())}updatePartialState(t){he.publish("PartialRefreshTopMenuState",t,Q())}realSynchronize(){this.updateRealInfo()}getValue(t){return+(t*10).toFixed(t.toString().length+1)}getCheck(){let t={},e=Zt.getInstance();return t[`Grid(${this.getValue(this.gridX)}mil,${this.getValue(this.gridY)}mil)`]=!0,t[`Snap(${this.getValue(this.snapX)}mil,${this.getValue(this.snapY)}mil)`]=!0,t[`GridPolar(${pb(this.angleDelta)},${this.getValue(this.radius)})`]=!0,t[`switchGridType(${this.gridType})`]=!0,t[`trackWidth(${this.getValue(this.prevTrackWidth)})`]=!0,t[`unit(${R.getInstance().unit})`]=!0,t.toggleRealTimeDRC=this.realTimeDRC,t.toggleAdsorb=this.adsorb,t.flipBoard=this.flipBoard,t.autoTrimSilkscreen=this.autoTrimSilkscreen,t.smartSize=this.smartMode,t.removeLoop=this.removeLoop,t[`brightness(${this.grayState})`]=!0,t["trackWidthSetting(WIRING_WIDTH_FOLLOWRULES)"]=this.widthFollowRule,t.showRuler=R.getInstance().openRuler,t[`routeLine(${e.type})`]=!0,t[`routeMode(${e.mode})`]=!0,t}getDisable(){return{joinGroup:this.joinGroup,ungroupSelected:this.ungroupSelected,flip:this.flip,has2DLine:this.has2DLine,canDispersedLine:this.canDispersedLine,hasMultiUnCloseLine:this.hasMultiUnCloseLine,canIntersectionAggregate:this._canIntersectionAggregate,canSubtractionExclusive:this._canSubtractionExclusive,canBooleanSplit:this._canBooleanSplit,canSplit:this._canSplit,hasSelected:this.hasSelected,hasMoreThanOneSelected:this.hasMoreThanOneSelected,hasSelectedDevice:this.hasSelectedDevice,hasSelectedPad:this.hasSelectedPad,hasSelectedNet:this.hasSelectedNet,onlyAbstractProfile:this.onlyAbstractProfile,canDupToOtherLayer:this.canDupToOtherLayer,canDupToCursor:this.canDupToCursor,onlyDevice:this.onlyDevice,twoDevice:this.twoDevice,route:this.route,redo:this._redo,undo:this._undo,isRoutingOrNotFollowRule:this._isRouting||!this.widthFollowRule,ruler:this.ruler,command:this.command,rotate:this.rotate,canCopy:this.canCopy,flipMenu:this.flipMenu,notDiffTrack:!this.diffTrack,canCutout:this._canCutout,hasPoly2DLine:this.hasPoly2DLine,canConvert2dLine:this.canConvert2dLine,hasBoard:this.hasBoard,canAvoidSlotsOrPads:this._canAvoidSlotsOrPads}}updateRealInfo(){let t={canvasWidth:this.canvasWidth,canvasHeight:this.canvasHeight,mouseRealX:this.mouseRealX,mouseRealY:this.mouseRealY,mouseX:this.mouseX,mouseY:this.mouseY,sceneX:this.sceneX,sceneY:this.sceneY,tabId:this.tabId,doctype:this.doctype,unit:R.getInstance().unit,scale:this.scale,adsrop:this.adsorb,gridType:this.gridType,coordinateType:It.getInstance().currentCoord};he.publish("pcbCanvasINFO",t,Q())}update(t,e){return he.publish("enablePcbMenuItem",e,Q()),setTimeout(()=>{23!=R.getInstance().doctype&&(he.publish("switchCoordinateBtn",It.getInstance().currentCoord?"cartesian":"polar",Q()),he.publish("setPcbMenuItemChecked",t,Q()),he.publish("switchViewBtn",R.getInstance().renderMode?"outline":"normal",Q()))},200)}getTopMenuStatus(){return{gridType:this.gridType}}};var tfe=class extends UV{constructor(t){super(),this.radiusMarkItem=t,this.point=t.end,t.setRadiusLength(0)}doAction(t){if(t instanceof Pr&&t.type=="Copper Region"){if(t.isSelectOnlyLine(this.point.x,this.point.y))return this.radiusMarkItem.setRadiusLength(t.radius),!0}else if(t instanceof lt){let e=t.selectEdges(this.point.x,this.point.y);for(let r of e)if(r instanceof _t)return this.radiusMarkItem.setRadiusLength(r.radius),!0}else{if((t instanceof _t||t instanceof yi||t instanceof Pr)&&t.isSelect(this.point.x,this.point.y))return this.radiusMarkItem.setRadiusLength(t.radius),!0;if(t instanceof rr){let e=t.getHoveredArc(this.point.x,this.point.y);return e?(this.radiusMarkItem.setRadiusLength(e.rx),!0):!1}}return!1}};var rfe=class{constructor(){A.subscribe("updateRadiusMark",this.computeRadius.bind(this))}computeRadius(t){jo.iterator(e=>{this.updateRadius(e)})}updateRadius(t){if(t.getParent()!=null)return;let e=t.end,r=new ht(e.x,e.x,e.y,e.y),i=kt.search4Types(r,gIe);i.setOnceAction(new tfe(t)),i.once(gIe)}};var h$=class{constructor(t,e,r,i,n){this._referX=t,this._referY=e,this.cbs1=r,this.cbs2=i,this.cbs3=n}setReferPoint(t,e){this._referX=t,this._referY=e,this.cbs1(t,e)}movePoint(t,e){let r={x:t,y:e};return this.cbs2(r)}setEndPoint(t,e){this._endX=t,this._endY=e,this.cbs3(t,e,!1)}interrupt(){this.cbs3(null,null,!0)}get referX(){return this._referX}set referX(t){this._referX=t}get referY(){return this._referY}set referY(t){this._referY=t}get endX(){return this._endX}set endX(t){this._endX=t}get endY(){return this._endY}set endY(t){this._endY=t}};var ife=class{constructor(){this.currTool=null;this.subline=null;this.currAngle=0;this.executeCommand=!1;this.drawing=!1;this.model=null;this.first=!0;A.subscribe("ROTATE",this.parse.bind(this)),A.subscribe("rotateAssignAngle",this.rotateAssignAngle.bind(this))}parse(t){!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype||this.currTool!=null&&(this.drawing=!0,this.currTool.parse({cmdKey:"ROTATE:"+t}))}rotate(t,e,r){for(let i of r)i.rotateFor(t,e)}selectReferPointCallback(t,e){if(this.drawing){this.referPoint={x:t,y:e},gr.model=3;let r=new S(t,e);return this.subline=new cr(1002,r,r,!0,ee.WHITE),this.cb1&&this.cb1(t,e),this.tool.recordStyle(),this.referPoint}}selectReferPointMoving(t){if(this.drawing){this.first&&(this.clearFilterItems(),this.setFilterItems(this.tool.group),this.first=!1);let e=new S(this.referPoint.x,this.referPoint.y),r=new S(t.x,t.y),i=r.angle(e);return this.subline&&(this.subline.end=r),this.tool.rotateFor(e,i-this.currAngle),this.cb2&&this.cb2(this.referPoint,t),this.currAngle=i,this.currAngle||0}return 0}selectEndPoint(t,e,r){if(this.drawing){if(this.drawing=!1,gr.model=this.model,this.model=null,A.windowBridge.publish("removeRuler",{pcbId:R.getInstance().tabId,type:"circle"},Q()),this.subline&&(this.subline.remove(),this.subline=null),r)this.tool.cancel(),this.commands.undo();else if(this.executeCommand&&this.commands.length){let i=new hi;i.addGroup(this.commands),this.tool.complete(),i.checkOutlines(Array.from(this.tool.group),new Set)}return this.cb3&&this.cb3(t,e,r,{angle:this.currAngle,referPoint:this.referPoint,commands:this.commands}),this.clearFilterItems(),this.currAngle}}rotateReferPoint(t,e,r,i,n){this.first=!0,Hn(t.items,(l,c,h)=>{(c instanceof mt||c instanceof _t)&&(t.items[h]=c.getParent())}),this.tool=t.items,this.executeCommand=t.executeCommand,this.setTool(e),this.cb1=r,this.cb2=i,this.cb3=n,this.subline=null,this.currAngle=0,this.drawing=!0,this.model=gr.model,this.commands=new De("Rotate By Reference Point"),t.commands&&t.commands.length>0&&t.commands.commands.forEach(l=>this.commands.addCommand(l)),Hn(this.tool.group,(l,c)=>{let h=Ce.dispatch(c,"modify");this.commands.addCommand(h),c instanceof He&&(Ce.dispatchCoppers(c,"delete",this.commands),c.clearCopper())});let s=new h$(0,0,this.selectReferPointCallback.bind(this),this.selectReferPointMoving.bind(this),this.selectEndPoint.bind(this)),a={command:"referencePoint1",program:s,msg:"Please select a reference point",needInput:!0};A.publish("toggle",a)}rotateAssignReferPoint(t,e,r,i,n){this.first=!0;let{x:s,y:a}=t;Hn(t.items.group,(h,u,d)=>{u instanceof mt&&(t.items.group[d]=u.getParent())}),this.tool=t.items,this.executeCommand=t.executeCommand,this.setTool(e),this.cb1=r,this.cb2=i,this.cb3=n,this.subline=null,this.currAngle=0,this.drawing=!0,this.model=gr.model,this.commands=new De("Rotate By Reference Point"),Hn(this.tool.group,(h,u)=>{let d=Ce.dispatch(u,"modify");this.commands.addCommand(d)});let l=new h$(0,0,this.selectReferPointCallback.bind(this),this.selectReferPointMoving.bind(this),this.selectEndPoint.bind(this)),c={command:"referencePoint1",program:l,msg:"",assignReferPoint:{x:s,y:a},needInput:!0};A.publish("toggle",c)}setFilterItems(t){t.forEach(e=>{e!=null&&(ai.filterItems.add(e),e instanceof ke&&e.getItems().forEach(r=>{ai.filterItems.add(r)}))})}clearFilterItems(){ai.filterItems.clear()}setTool(t){this.currTool=t}getTool(){return this.currTool}rotateAssignAngle(t){this.drawing=!1,gr.model=this.model,this.model=null;let{x:e,y:r}=t;this.currTool!=null&&this.currTool instanceof XG&&this.currTool.completed({x:e,y:r}),this.subline&&(this.subline.remove(),this.subline=null);let i=t.angle/180*Math.PI,n=new S(this.referPoint.x,this.referPoint.y);this.tool.rotateFor(n,i-this.currAngle),this.tool.complete(),this.executeCommand&&this.commands.length&&qe.executeCommand(this.commands),this.cb3&&this.cb3(e,r,!1,{angle:i,referPoint:this.referPoint}),this.clearFilterItems()}};var JXe=(i=>(i[i.turnAround="FLIP_LEFTANDRIGHT"]="turnAround",i[i.turnUpsideDown="FLIP_UPANDDOWN"]="turnUpsideDown",i[i.turnAroundByReferPoint="FLIP_LEFTANDRIGHT_BY_REFER_POINT"]="turnAroundByReferPoint",i[i.turnUpsideDownByReferPoint="FLIP_UPANDDOWN_BY_REFER_POINT"]="turnUpsideDownByReferPoint",i))(JXe||{}),M1=class M1{constructor(){this.currTool=null;this.items=new Array;this._flipQueue=[];this._isProcessingFlip=!1;this._currentFlipProgress=0;this._progressBase=0;A.subscribe("turn",this.parse.bind(this))}parse(t){!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype||this.currTool!=null&&this.currTool.parse({cmdKey:"FLIP:"+JXe[t]})}async processFlipQueue(){if(!(this._isProcessingFlip||this._flipQueue.length===0)){this._isProcessingFlip=!0,this._currentFlipProgress<=M1.FLIP_PROGRESS_START&&(this._progressBase=M1.FLIP_PROGRESS_START),this.showFlipProgress();try{for(;this._flipQueue.length>0;){let t=this._flipQueue.shift();t&&await t()}}catch(t){console.error("Error processing flip operation:",t),this.clearFlipQueue(),this.closeProgress();return}finally{let t=this._flipQueue.length===0;this._isProcessingFlip=!1,t?(this.closeProgress(),this._currentFlipProgress=0,this._progressBase=0):this.processFlipQueue()}}}addFlipToQueue(t){if(this._isProcessingFlip){this._flipQueue.length>=M1.MAX_QUEUE_SIZE&&(console.warn(`Flip queue size limit (${M1.MAX_QUEUE_SIZE}) reached, discarding oldest operation`),this.showQueueFullWarning(),this._flipQueue.shift()),this._flipQueue.push(t);return}this._flipQueue.length>=M1.MAX_QUEUE_SIZE&&(console.warn(`Flip queue size limit (${M1.MAX_QUEUE_SIZE}) reached, discarding oldest operation`),this.showQueueFullWarning(),this._flipQueue.shift()),this._flipQueue.push(t),this.processFlipQueue()}showQueueFullWarning(){A.publish("ui/toastMsg",{type:"warning",msg:['<span class="i18n">Too many flip operations in queue. Please wait for current operations to complete.</span>']},Q())}showFlipProgress(){this._progressBase>=1&&(this._progressBase=Math.max(M1.FLIP_PROGRESS_START,1-M1.FLIP_PROGRESS_RANGE)),A.publish("progressUpdate",[this._progressBase,"flipping components"],Q())}closeProgress(){A.publish("progressUpdate",[1,"flipping components"],Q())}updateFlipProgress(t,e){let r=e>0?t/e*M1.FLIP_PROGRESS_RANGE:0,i=this._progressBase+r;i=Math.min(i,1),this._currentFlipProgress=i,A.publish("progressUpdate",[this._currentFlipProgress,"flipping components"],Q())}clearFlipQueue(){this._flipQueue=[],this._isProcessingFlip=!1,this._currentFlipProgress=0,this._progressBase=0}turn(t,e,r,i){let n=i!=null?i:this.getCenter(t);Is.getInstance().init(t,"flip to"+yT,async(s,a)=>{if(!s||s.length===0)return;let l=async()=>{let c=a.getCommand(),h=e?{x:1,y:-1,z:1}:{x:-1,y:1,z:1},u=le.pcbConfig.allowFootprintFlipping;s.forEach(d=>{if(d instanceof ke)u&&c.addCommand(Ce.dispatch(d,"modify"));else if(d instanceof ua)c.addCommand(Ce.dispatch(d,"modify"));else if(d instanceof Le)d.getParent()==null&&c.addCommand(Ce.dispatch(d,"modify"));else if(d instanceof mt||d instanceof _t){let p=d.getParent();p!=null&&p instanceof lt&&p.getParent()==null&&c.addCommand(Ce.dispatch(p,"modify"))}else d instanceof He?d.getParent()==null&&c.addCommand(Ce.dispatch(d,"modify")):d instanceof lr?c.addCommand(Ce.dispatch(d,"modify")):d instanceof Mn?c.addCommand(Ce.dispatch(d,"modify")):c.addCommand(Ce.dispatch(d,"modify"))}),await this.turnCbInternal(n.x,n.y,e,h,c,s,r,null)};this.addFlipToQueue(l)})}turnByReferPoint(t,e,r){this.items=t.items,this.scalePoint=t.isTurnUpsideDown?{x:1,y:-1,z:1}:{x:-1,y:1,z:1},this.isTurnUpsideDown=t.isTurnUpsideDown,this.executeCommand=t.executeCommand,this.setTool(e),this.cb=r,this.commands=new De("flip to"+yT),this.items.forEach(a=>{if(a instanceof ke)le.pcbConfig.allowFootprintFlipping&&this.commands.addCommand(Ce.dispatch(a,"modify"));else if(a instanceof ua)this.commands.addCommand(Ce.dispatch(a,"modify"));else if(a instanceof Le)a.getParent()==null&&this.commands.addCommand(Ce.dispatch(a,"modify"));else if(a instanceof mt||a instanceof _t){let l=a.getParent();l!=null&&l instanceof lt&&l.getParent()==null&&this.commands.addCommand(Ce.dispatch(l,"modify"))}else a instanceof He?a.getParent()==null&&this.commands.addCommand(Ce.dispatch(a,"modify")):a instanceof lr?this.commands.addCommand(Ce.dispatch(a,"modify")):a instanceof Mn?this.commands.addCommand(Ce.dispatch(a,"modify")):this.commands.addCommand(Ce.dispatch(a,"modify"))});let i=async(a,l)=>{let c=async()=>{await this.turnCb(a,l)};this.addFlipToQueue(c)},n=new uE(0,0,[i]),s={command:"referencePoint",program:n,msg:"Please select a reference point"};A.publish("toggle",s)}async turnCb(t,e){let{x:r,y:i,z:n}=this.scalePoint;this.shouldShowFlipTip(this.items)&&this.tips(),await this.flipItems(t,e,r,i,n,this.isTurnUpsideDown,this.items,this.commands),this.commands.length>0&&this.executeCommand&&this.checkOutlines(this.commands,this.items),this.cb&&this.cb(),this.cb=null,this.flushAttrAndSetCenter(t,e)}async turnCbInternal(t,e,r,i,n,s,a,l){this.shouldShowFlipTip(s)&&this.tips();let{x:c,y:h,z:u}=i;await this.flipItems(t,e,c,h,u,r,s,n),n.length>0&&a&&this.checkOutlines(n,s),l&&l(),this.flushAttrAndSetCenter(t,e)}checkOutlines(t,e){let r=new Set;e.forEach(n=>{if(n instanceof mt||n instanceof _t){let s=n.getParent();if(s!=null&&s instanceof He){r.add(s);return}}r.add(n),A.publish("hasModifyPcbItem",n)});let i=new hi;i.addGroup(t),i.checkOutlines(Array.from(r),new Set)}setTool(t){this.currTool=t,t!=null?we.allowFlip(!0):we.allowFlip(!1)}async flipItems(t,e,r,i,n,s,a,l){let c=[],h=Ae.translate(-t,-e,0).scale(r,i,n).translate1(t,e,0),u=Array.from(a),d=u.length;if(d===0)return;let p=le.pcbConfig.allowFootprintFlipping,m=new Map,g=[];u.forEach((b,P)=>{if(b instanceof ke){if(p){let T=pf.updateComponentFootprint(b,s,new S(t,e),l);m.set(P,T)}}else g.push({item:b,index:P})});async function y(b,P){let T=new Set,I=Array.from(b.entries()).map(([C,E])=>E.then(()=>{if(T.add(C),T.size%M1.PROGRESS_UPDATE_INTERVAL===0||T.size===b.size){let O=g.length+T.size;this.updateFlipProgress(O,P)}}));await Promise.all(I)}for(let{item:b,index:P}of g){if(b instanceof ua)b.flip(h);else if(b instanceof Le)b.getParent()==null&&b.flip(h);else if(b instanceof mt||b instanceof _t){let I=b.getParent();if(I!=null&&I instanceof lt&&I.getParent()==null){let E=I.globalIndex;c.includes(E)||(c.push(E),I.transform(h))}}else b instanceof He?b.getParent()==null&&(b instanceof rr?(b.start=b.getUR().multiply4(h),b.rotation=Math.PI*2-b.rotation,s&&(b.rotation=b.rotation+Math.PI)):b.transform(h)):b instanceof lr?(b.position=b.position.multiply4(h),b.mirror=!b.mirror,s&&(b.rotation=b.rotation+Math.PI),b.click()):b instanceof Mn||b instanceof Ps?(b.start=b.start.multiply4(h),b.mirror=!b.mirror,s&&(b.rotation=b.rotation+Math.PI)):b.transform(h);let T=g.findIndex(I=>I.index===P)+1;(T%M1.PROGRESS_UPDATE_INTERVAL===0||T===g.length)&&this.updateFlipProgress(T,d)}await y.call(this,m,d)}flushAttrAndSetCenter(t,e){this.currTool instanceof bG&&A.publish("flushSelectingInfo",""),this.currTool instanceof FD&&this.currTool.setCenter(t,e)}buildItemsBBox(t){let e=new _e;for(let r of t)if(r instanceof da){let{start:i,end:n,strokeWidth:s}=r,a=new _e;for(let l of xM(i,n))a.ext1(l.bbox());a.ext7(s/2),e.ext1(a.build())}else e.ext1(r.buildBBox());return e.build1()}getCenter(t){return this.buildItemsBBox(t!=null?t:this.items).center()}shouldShowFlipTip(t){let e=le.pcbConfig.allowFootprintFlipping;return(t instanceof Array?t:Array.from(t)).some(i=>i instanceof ke)&&!e}tips(){A.publish("ui/toastMsg",{type:"info",msg:[{value:'"Allow Footprint Flipping" is not enabled and the selected footprint is being ignored. To enable it, please go to'},{text:"PCB Settings",call:{name:"commonButtonsSetting(PCB_FOOTPRINT)",args:{scrollTo:"allowFootprintFlipping"}},class:"space-btn-blue"}]},Q())}};M1.FLIP_PROGRESS_RANGE=.8,M1.FLIP_PROGRESS_START=.1,M1.MAX_QUEUE_SIZE=20,M1.PROGRESS_UPDATE_INTERVAL=10;var nfe=M1;var ofe=class{constructor(){this.lastScene=[1];this.lastDropDrag=!1;this._dropDrag=!1;this.nonCanvas=1;this.scene=[1];this.needHistoryTool=new Set;this.overrideAction={}}get currentCanUndoTool(){return this._currentCanUndoTool}set currentCanUndoTool(t){this._currentCanUndoTool=t}get dropDrag(){return this._dropDrag}set dropDrag(t){this.lastDropDrag=this._dropDrag,this._dropDrag=t}saveSceneToSession(t){let r=!!window["USE-IFRAME-FOR-MAIN"]?window:Q();r!=null&&r.sensorsDataFromTopWindow&&(r.sensorsDataFromTopWindow.canvasStatus=t)}getScene(){return this.scene}setArea(t){this.overrideAction[6]=t,this.scene.splice(0,0,6)}setDraw(){this.lastScene=Array.from(this.scene),this.scene=[4],this.saveSceneToSession("\u7ED8\u5236")}setPlace(){this.lastScene=Array.from(this.scene),this.scene=[5],this.saveSceneToSession("\u653E\u7F6E")}setSelect(){this.lastScene=Array.from(this.scene),this.scene=[2],this.saveSceneToSession("\u9009\u4E2D")}setNonSelect(){this.lastScene=Array.from(this.scene),this.scene=[3],this.saveSceneToSession("\u672A\u9009\u4E2D")}resetLastScene(){this.scene=Array.from(this.lastScene),this.dropDrag=this.lastDropDrag}};var mU=class o extends lr{constructor(e){super(e);this.isBase=!0;this.sendDeleteMsg=!1}static build(e,r,i,n,s){let a=new Ku(Lh(),s,0,"",!1,e,!0,"default",n,0,r,3,i,!1,0,!1,!1,[],0,0,!1);return new o(a)}setColor(e){uo.getInstance().textConfig.setCustomColor(this.globalIndex,e),this.refreshRender()}remove(){uo.getInstance().textConfig.setCustomColor(this.globalIndex,null),super.remove()}setBBoxModify(){}setLayerModify(e){}};var gU=class extends Cs{constructor(e=!1){super();this._isCheck=!1;this.allDimesionText=[];this.allDimesion=[];this.margin=2;this.textNum=0;this.alreadyPDimensions=[];this.alreadyLSDimensions=[];this.isCheckEnd=!1;this.checkCache=[];this.dimensionPositionXArr=[];this.textContentList=[];this.logger=new Di(4);this.UNIT=R.getInstance().unit,this.pads=Qt.getAllItem(),this.tracks=pr.getAllItem(),this.polygons=pt.getAllItem(),this.images=Bn.getAllItem(),this.rects=Xt.getAllItem(),this.circles=Kt.getAllItem(),this.dimensions=Yo.getAllItem(),this.radius=jo.getAllItem(),this.allPads=[].concat(...this.pads),this.getBBox(),this.isPreview=e}getBBox(){let e=[].concat(...this.allPads,...this.tracks,...this.polygons,...this.images,...this.rects,...this.circles,...this.radius),r=ys(e);if(r.valid()){let i=r.build1();this.UL=i.UL(),this.UR=i.UR(),this.LL=i.LL(),this.LR=i.LR(),this.center=i.center()}}buildBox(){let e=new _e;return this.allDimesion.forEach(r=>{e.ext1(r.buildBBox())}),e.valid()?e.build1():null}getTextPosition(e){let r=this.dimensionPositionXArr.sort((c,h)=>h-c),i=Math.max(Math.ceil(this.UR.sub(this.LR).y/(e*1.2)),5),n=new S(r[0]+12,this.UR.y),s=this.UR.sub(this.LR).y,a=Math.floor(this.textNum/i),l=n.add(new S(a*18,-(this.textNum%i)*3));return this.textNum++,l}exportRawItemNums(e){let r=[];return e.forEach(i=>{r.push(i._num)}),r}sortByXOrY(e,r){return e.sort((n,s)=>{let a=n.center.x,l=n.center.y,c=s.center.x,h=s.center.y;if(r==="X")return Math.abs(a-c)>1e-4?a-c:Math.abs(l-h)>1e-4?h-l:0;if(r==="Y")return Math.abs(l-h)>1e-4?h-l:Math.abs(a-c)>1e-4?a-c:0})}groupSortByX(){let e=[],r=1e5,i=[];this.sortByXItems=this.sortByXOrY(this.allPads,"X"),this.logger.debug3("%s %s","rawSortItems-X",this.exportRawItemNums(this.sortByXItems));for(let n=0;n<this.sortByXItems.length;n++){let s=this.sortByXItems[n],a=i.length>0?s.center.x-i[i.length-1].center.x:0;r===1e5?(i.push(s),e.push(i),a=100001):Math.abs(r-a)<.01||r>1e5?i.push(s):(a=1e6,i=[s],n<this.sortByXItems.length-1&&e.push(i)),r=a}return e}groupSortByY(){let e=[],r=1e5,i=[];this.sortByYItems=this.sortByXOrY(this.allPads,"Y"),this.logger.debug3("%s %s","rawSortItems-Y",this.exportRawItemNums(this.sortByYItems));for(let n=0;n<this.sortByYItems.length;n++){let s=this.sortByYItems[n],a=i.length>0?s.center.y-i[i.length-1].center.y:0;r===1e5?(i.push(s),e.push(i),a=100001):Math.abs(r-a)<.01||r>1e5?i.push(s):(a=1e6,i=[s],n<this.sortByYItems.length-1&&e.push(i)),r=a}return e}addDimension(e,r,i,n,s,a=3){let l=nr(),c=i.sub(this.center),h=new S(0,0),u=new S(0,0),d=!1,p=[],m=(E,O)=>{E==="x"?c.y>0?(h=new S(i.x,this.UL.y+O),u=new S(n.x,this.UL.y+O),d=!0):(h=new S(i.x,this.LL.y-O),u=new S(n.x,this.LL.y-O)):E==="y"&&(c.x>0?(h=new S(this.LR.x+O,i.y),u=new S(this.LR.x+O,n.y),d=!0):(h=new S(this.LL.x-O,i.y),u=new S(this.LL.x-O,n.y)))};m(s,this.margin),this.allDimesion.map(E=>{p.push(E)});let g=ys(p);if(g.valid()){let E=g.build1(),O=ht.extend3(h,u);E.isIntersect(O)&&(this.margin=this.margin+1.5*1.2,m(s,this.margin))}let y=Math.pow(10,a);if(Math.round(u.sub(h).length()*y)/y===0)return{dimension:{},textContent:{},layer:{},textTitle:r,textValue:"",length:0};let b=new AD(l,e,r,h,u,i,n,a,1.5,.1,this.UNIT,d);this.allDimesion.push(b),this.dimensionPositionXArr.push(u.x);let P=e,T=b.getLength(),I=1;this.UNIT!="mil"&&(T=new dt().conversion1("mil",this.UNIT,T),I=3),T=Math.round(T*y)/y;let C=`${r}: ${bTe(T,I)}${this.UNIT}`;return{dimension:b,textContent:C,layer:P,textTitle:r,textValue:`${bTe(T,I)}${this.UNIT}`,length:T}}endAddDimension(){this.checkCache.sort((r,i)=>{let n=s=>Math.abs(s.end[s.direction]-s.start[s.direction]);return n(r)-n(i)}),this.dimensionPositionXArr=[];let e=[];this.checkCache.forEach(r=>{let{dimension:i,textContent:n,layer:s,textTitle:a,textValue:l,length:c}=this.addDimension(r.layerId,r.text,r.start,r.end,r.direction,r.precision);c!==0&&e.push({dimension:i,textContent:n,layer:s,textTitle:a,textValue:l,length:c})}),e.forEach(({dimension:r,textContent:i,layer:n,textTitle:s,textValue:a,length:l})=>{if(this.isPreview)this.textContentList.push({textTitle:s,textValue:a,highPrecisionValue:l}),this.allDimesionText.push([r,s]);else{let c=mU.build(i,this.getTextPosition(1.5),.1,1.5,n);this.allDimesionText.push([r,c])}})}prevAddDimension(e,r,i,n,s,a=3){s==="y"&&i.y<n.y&&([i,n]=[n,i]),this.checkCache.push({layerId:e,text:r,start:i,end:n,direction:s,precision:a})}setPitchDimension(){this.sortByYItemGroup=this.groupSortByX(),this.sortByXItemGroup=this.groupSortByY();let e=this.sortByXItemGroup.length,r=this.sortByYItemGroup.length,i=n=>{let s=[];for(let a=0;a<n.length;a++){let l=n[a],c=[];l.forEach(h=>{c.push(h._num)}),s.push(c)}return s};e>=1&&(e>1?(this.prevAddDimension(13,"P1",this.sortByXItemGroup[0][0].center,this.sortByXItemGroup[0][1].center,"x"),this.prevAddDimension(13,"P3",this.sortByXItemGroup[e-1][0].center,this.sortByXItemGroup[e-1][1].center,"x"),this.alreadyPDimensions.push([this.sortByXItemGroup[0][0].num,this.sortByXItemGroup[0][1].num]),this.alreadyPDimensions.push([this.sortByXItemGroup[e-1][0].num,this.sortByXItemGroup[e-1][1].num])):e===1&&(this.prevAddDimension(13,"P1",this.sortByXItemGroup[0][0].center,this.sortByXItemGroup[0][1].center,"x"),this.alreadyPDimensions.push([this.sortByXItemGroup[0][0].num,this.sortByXItemGroup[0][1].num]))),r>=1&&(r>1?(this.prevAddDimension(13,"P2",this.sortByYItemGroup[0][0].center,this.sortByYItemGroup[0][1].center,"y"),this.prevAddDimension(13,"P4",this.sortByYItemGroup[r-1][0].center,this.sortByYItemGroup[r-1][1].center,"y"),this.alreadyPDimensions.push([this.sortByYItemGroup[0][0].num,this.sortByYItemGroup[0][1].num]),this.alreadyPDimensions.push([this.sortByYItemGroup[r-1][0].num,this.sortByYItemGroup[r-1][1].num])):r===1&&(this.prevAddDimension(13,"P2",this.sortByYItemGroup[0][0].center,this.sortByYItemGroup[0][1].center,"y"),this.alreadyPDimensions.push([this.sortByYItemGroup[0][0].num,this.sortByYItemGroup[0][1].num])))}getLeadSpanPosition(e){let r=null,i=null,n=null,s=null,a=c=>{if(ar(c.layerId))!r||!i?(r=c.center,i=c.center,n=c.num,s=c.num):r[e]>c.center[e]?(r=c.center,n=c.num):i[e]<c.center[e]&&(i=c.center,s=c.num);else{let h=c.buildBBox(),u=[h.UL(),h.LL(),h.LR(),h.UR()],d=ge.build4(u).primitives,p=c.getMathGraphics(),m=[];p.primitives.forEach(P=>{d.forEach(T=>{let I=Pt(P,T);for(let C=0;C<I;C+=2){let E=new S(Ee[C],Ee[C+1]);m.push(E)}})});let g=[];e==="x"?m.length<1?g=[h.UL().add(h.LL()).mul(.5),h.UR().add(h.LR()).mul(.5)]:g=m.sort((P,T)=>Math.abs(P.x-T.x)>1e-4?P.x-T.x:Math.abs(P.y-T.y)>1e-4?P.y-T.y:0):m.length<1?g=[h.UL().add(h.UR()).mul(.5),h.LL().add(h.LR()).mul(.5)]:g=m.sort((P,T)=>Math.abs(P.y-T.y)>1e-4?P.y-T.y:Math.abs(P.x-T.x)>1e-4?P.x-T.x:0);let y=g[0],b=g[g.length-1];!r||!i?(r=y,i=b,n=s=c.num):r[e]>y[e]?(r=y,n=c.num):i[e]<b[e]&&(i=b,s=c.num)}};return this.allPads.forEach(c=>{a(c)}),this.alreadyLSDimensions.push([n,s]),this.alreadyPDimensions.some(c=>c[0]===n&&c[1]===s?!0:c[1]===n&&c[0]===s)?null:[r,i]}setLeadSpanDimension(){let e=this.getLeadSpanPosition("x"),r=this.getLeadSpanPosition("y");e&&this.prevAddDimension(13,"LS1",e[0],e[1],"x"),r&&this.prevAddDimension(13,"LS2",r[0],r[1],"y")}setComponentDimension(){let e=new _e,r=new Array,i=new dt,n=.5;if(Hn(this.tracks,(s,a)=>{if(!a.isEmpty&&a.layerId===3){let l=a.getMathGraphics(a.layerId,0);xe.addAll(r,l.primitives),e.ext1(l.bbox())}}),Hn(this.polygons,(s,a)=>{if(!a.isEmpty&&a.layerId===3){let l=a.onlyOneChilds();if(l instanceof _t&&i.conversion1("mil","mm",l.radius*10)<n)return!1;let c=a.getMathGraphics(a.layerId,0);xe.addAll(r,c.primitives),e.ext1(c.bbox())}}),Hn(this.images,(s,a)=>{if(!a.isEmpty&&a.layerId===3){let l=a.getMathGraphics(a.layerId,0);xe.addAll(r,l.primitives),e.ext1(l.bbox())}}),Hn(this.rects,(s,a)=>{if(!a.isEmpty&&a.layerId===3){let l=a.getMathGraphics();xe.addAll(r,l.primitives),e.ext1(l.bbox())}}),Hn(this.circles,(s,a)=>{let l=i.conversion1("mil","mm",a.radius*10);if(!a.isEmpty&&a.layerId===3&&l>=n){let c=a.getMathGraphics();xe.addAll(r,c.primitives),e.ext1(c.bbox())}}),Hn(this.dimensions,(s,a)=>{if(!a.isEmpty&&a.layerId===3){let l=a.getMathGraphics();xe.addAll(r,l.primitives),e.ext1(l.bbox())}}),Hn(this.radius,(s,a)=>{if(!a.isEmpty&&a.layerId===3){let l=a.getMathGraphics();xe.addAll(r,l.primitives),e.ext1(l.bbox())}}),e.valid()){let s=e.build1();"DOCUMENT",this.prevAddDimension(13,"L",s.UL(),s.UR(),"x"),this.prevAddDimension(13,"W",s.LL(),s.UL(),"y")}}setPadDimension(){let e={},r=[];this.allPads.forEach(i=>{let n=i.getDimensionBBox(),s=n.width().toFixed(4)+"|"+n.height().toFixed(4);l2(e,s).push(i)});for(let i in e)e[i].sort((s,a)=>s.num-a.num),this.alreadyLSDimensions.some(s=>{let a=e[i][0].num;return s[0]===a&&s[1]===a})||r.push(e[i][0]);r.forEach((i,n)=>{let s=i.getDimensionBBox(),a=s.UL().add(s.UR()).mul(.5),l=s.LL().add(s.LR()).mul(.5),c=s.UL().add(s.LL()).mul(.5),h=s.UR().add(s.LR()).mul(.5),u=s.width(),d=s.height();this.prevAddDimension(13,u>=d?`PW${n+1}`:`PL${n+1}`,a,l,"y"),this.prevAddDimension(13,u>=d?`PL${n+1}`:`PW${n+1}`,c,h,"x")})}setAllDimension(e="mil"){if(this.UNIT=e||R.getInstance().unit,this.textContentList=[],this.allPads.length>1&&(this.setPitchDimension(),this.setLeadSpanDimension()),this.setComponentDimension(),this.setPadDimension(),this.endAddDimension(),this.isPreview)return this.textContentList}interrupt(){return this.allDimesionText.forEach(e=>{e[0].remove(),e[1]instanceof mU&&e[1].remove()}),this.allDimesion.forEach(e=>{e.remove()}),!0}allDimensionVisible(e){let r=!1;return this.allDimesionText.forEach(n=>{!r&&n[0].isVisible!=e&&(r=!0),i(n[0]),n[1]instanceof mU&&i(n[1])}),this.allDimesion.forEach(n=>{!r&&n.isVisible!=e&&(r=!0),i(n)}),r;function i(n){e?n.visible():n.hidden()}}onMouseLeftDown(e){if(this.isPreview){let r=e.realSceneX,i=e.realSceneY,n=[];this.allDimesionText.forEach(s=>{let a=!1;s[0].isSelect(r,i)&&(a=!0,n=s),s[0].hightlight(a)}),A.publish("setHighlightRowByNumber",n[1]||"",Q())}return!0}onMouseLeftUp(){return!0}onMouseMove(e){let r=e.realSceneX,i=e.realSceneY;return this.isPreview||this.allDimesionText.forEach(n=>{let s=!1;n.map(a=>{a.isSelect(r,i)&&(s=!0)}),n[0].hightlight(s),n[1].setColor(s?ee.RED:ee.WHITE)}),!0}highlightDimension(e){this.allDimesionText.forEach(r=>{r[1]===e?r[0].hightlight(!0):r[0].hightlight(!1)})}};var sfe=class{constructor(){this.currTool=null;this.currTool=null}changeTool(t){this.currTool=t}applyInputAtCursorValue(t){this==null||this.applyInputAtCursorValue(t)}valueInputEnd(t){this==null||this.valueInputEnd(t)}};var afe=class{constructor(t,e,r,i,n,s){this.id=t,this.start=e,this.end=r,this.condition=i,this.startIndex=n,this.endIndex=s}set condition(t){this._condition=t}get condition(){return this._condition}};var lfe=class extends Ei{addControllerCache(t){this.map.set(t.globalIndex,t),kt.insert(t)}addDimension(t,e,r,i,n,s,a,l,c,h){let u=nr(),d=new hh(u,t,e,r,i,n,s,a,l,c,h);return d.model=Cx.getInstance().addDimension(u,t,e,r,i,n,R.getInstance().unit=="mil"?1:3,s,a,R.getInstance().unit,l),this.addControllerCache(d),d}rebuild(t,e,r,i,n,s,a,l,c,h,u){let d=new hh(t,e,r,i,n,s,a,l,c,h,u);return d.restriction=u3.getItem(t),d.model=Cx.getInstance().addDimension(t,e,r,i,n,s,R.getInstance().unit=="mil"?1:3,a,l,R.getInstance().unit,c),this.addControllerCache(d),d}delete(t){t instanceof hh&&(Cx.getInstance().delete(t.model),this.map.delete(t.globalIndex))}clearAll(){let t=this.getAllItem();for(let e of t)e.remove(),this.delete(e)}setSmartDimensionLength(t,e,r=!1){let i=this.getItem(e);if(!i)return;let n=Qt.getItem(i.restriction.end),s=Qt.getItem(i.restriction.start);if(!s||!n)return;if(A.publish("clearDimension",""),s.locked&&n.locked)A.publish("ui/toastMsg",{type:"warn",msg:"The associated pad has been locked"},Q());else{let c,h,u,d;n.locked?(c=s,h=n.globalIndex,u=i.end,d=i.start):(c=n,h=s.globalIndex,u=i.start,d=i.end);let p=0,m=0;switch(i.restriction.condition){case 0:d.x-u.x<0&&(t=-t),p=t-(d.x-u.x);break;case 1:d.y-u.y<0&&(t=-t),m=t-(d.y-u.y);break;case 2:let g=Math.atan2(d.y-u.y,d.x-u.x),y=t*Math.cos(g),b=t*Math.sin(g);p=y+u.x-d.x,m=b+u.y-d.y;break}(p!=0||m!=0)&&kB.move(c.globalIndex,new S(p,m),!0,h,r?e:null)}let a=new Jt,l=_s.movedItems.map(c=>a.getItem(c));_s.addCommand(this.getItem(e),r?"add":"modify"),_s.executeCommand(),A.publish("hasModifyPcbItem",l),A.publish("flushService","")}};var cfe=class{constructor(){this.map={}}getItem(t){for(let e in this.map){let r=this.map[e].filter(i=>i.id==t);if(r.length)return r[0]}}addDRestriction(t,e,r,i,n,s){let a=new afe(t,e,r,i,n,s);return[e,r].forEach(l=>{let c=this.map[l];c==null&&(c=new Array,this.map[l]=c);let h=c.findIndex(u=>u.id==a.id);h>=0?c[h].condition!=a.condition&&(c[h].condition=a.condition):c.push(a)}),a}removeRestriction(t){for(let e in this.map)this.map[e]=this.map[e].filter(r=>r.id!=t),this.map[e].length==0&&delete this.map[e]}find(t){let e={};return t.forEach(r=>{let i=this.map[r];i!=null&&(e[r]=i.filter(n=>!!ah.getItem(n.id)))}),e}findAll(t){let e=new Set,r=new Set,i=new Set;for(let n of t)r.add(n),i.add(n);for(;r.size>0;){let n=new Set;for(let s of r){let a=this.map[s];a!=null&&a.forEach(l=>{e.add(l),!i.has(l.start)&&!n.has(l.start)&&(n.add(l.start),i.add(l.start)),!i.has(l.end)&&!n.has(l.end)&&(n.add(l.end),i.add(l.end))})}r.clear(),r=n}return t.forEach(n=>{if(!r.has(n)){let s=this.map[n];s!=null&&s.forEach(a=>{e.add(a),r.add(a.start),r.add(a.end)})}}),e}};var hfe=class{constructor(){this._control=null;this.dimension=null;this.start=null;this.end=null;this.startSpots=[];this.highlightedSpots=[];this.bbox=null;this.condition=null;this.startId=null;this.endId=null;this.startIndex=null;this.endIndex=null;this.spotColor=ee.build(.7,.7,0,.7);this.state=0;this.command=new De("Smart Dimension");this.initCommandFromOutside=!1;this._historyItems=new Set;this.moveOffsetFromStart=null;this.needMoreClickToDrag=!0;this.justSelectOnePoint=!1;this.historyState=2}get control(){return this._control}set control(t){this._control=t}addCommand(t,e){this._historyItems.has(t.globalIndex)||(this.command.addCommand(Ce.dispatch(t,e)),this._historyItems.add(t.globalIndex))}executeCommand(){this.command.length>0&&(this.initCommandFromOutside||qe.executeCommand(this.command),this.initCommandFromOutside=!1,this._historyItems=new Set,this.command=new De("Smart Dimension"))}initGroupCommand(t){return this.initCommandFromOutside=!0,this.command=t}get movedItems(){return Array.from(this._historyItems)}reAddRestriction(t){this.startId=t.restriction.start,this.startIndex=t.restriction.startIndex,this.start=t.left,this.endId=t.restriction.end,this.endIndex=t.restriction.endIndex,this.end=t.right,this.condition=t.restriction.condition,this.dimension=t,this.bbox=new _e().ext2(this.start).ext2(this.end).build1(),this.state=2,this.historyState=1}highlightSpot(t,e){this.clearHighlightSpot();let r=new fA(Lh(),1002,t,e);r.color=this.spotColor,this.highlightedSpots.push(r)}clearHighlightSpot(){this.highlightedSpots.forEach(t=>t.remove()),this.highlightedSpots.length=0}addRestriction(t,e,r,i){if(this.start==null)this.startId=t,this.startIndex=e,this.start=r,this.startSpots.push(new fA(Lh(),1002,this.start,i)),this.startSpots[this.startSpots.length-1].color=this.spotColor,this.state=1;else if(this.startId!=t&&this.startSpots.length>0){this.endId=t,this.endIndex=e,this.end=r;let n=this.startSpots[this.startSpots.length-1].radius;this.startSpots.forEach(s=>s.remove()),this.startSpots=[],this.dimension=ah.addDimension(13,this.start,this.end,this.start,this.end,1.5,.09,!1,n,i),this.bbox=new _e().ext2(this.start).ext2(this.end).build1(),this.state=2,this.historyState=0}}move(t){if(this.justSelectOnePoint=!1,this._control&&(t.leftDown?this._control.onMouseMove(t):this._control.onMouseUpMove(t)),this.dimension!==null){this.historyState==1&&(this.addCommand(this.dimension,"modify"),this.historyState=2);let e=new S(t.sceneX,t.sceneY);this.moveOffsetFromStart||(this.moveOffsetFromStart=this.dimension.start.sub(e));let r=e.add(this.moveOffsetFromStart);if(this.bbox.isContainsX(e.x)&&!this.bbox.isContainsY(e.y)||ne.eq(this.start.y,this.end.y)){let i=new S(this.start.x,r.y),n=new S(this.end.x,r.y);this.condition=0,this.dimension.modifyDimension(i,n)}else if(!this.bbox.isContainsX(e.x)&&this.bbox.isContainsY(e.y)||ne.eq(this.start.x,this.end.x)){this.condition=1;let i=new S(r.x,this.start.y),n=new S(r.x,this.end.y);this.dimension.modifyDimension(i,n)}else{this.condition=2;let i=this.end.sub(this.start).normalize(),n=new S(-i.y,i.x),s=r.sub(this.start).dot(n),a=this.start.add(n.mul(s)),l=a.add(this.end.sub(this.start));this.dimension.modifyDimension(a,l)}return this.moveOffsetFromStart=new S(0,0),!0}return!1}build(){if(this.state==2){if(this.dimension.end.equals1(this.dimension.right)||this.dimension.start.equals1(this.dimension.left))return;if(this.condition!=null){let t=u3.getItem(this.dimension.globalIndex);t&&t.condition!=this.condition&&this.isCloseLoop(this.dimension.globalIndex)&&A.publish("showPcbAlertMsg","This size is the determined size!",Q());let e=u3.addDRestriction(this.dimension.globalIndex,this.startId,this.endId,this.condition,this.startIndex,this.endIndex);this.dimension.restriction=e,this.state=0,this.historyState==0?(A.publish("openMainDialog",{cmd:32,data:{option:{value:this.dimension.length+this.dimension.unit,rulerId:this.dimension.globalIndex,unit:this.dimension.unit,isNew:!0}}}),this.isCloseLoop(this.dimension.globalIndex)&&A.publish("showPcbAlertMsg","This size is the determined size!",Q())):this.command.length>0&&this.executeCommand()}return kt.insert(this.dimension),this.dimension=null,this.start=null,this.end=null,this.bbox=null,this.condition=null,this.startId=null,this.endId=null,this.startIndex=null,this.endIndex=null,this.historyState=2,this.moveOffsetFromStart=null,!0}return!1}isCloseLoop(t){let e=ah.getItem(t),r=e.restriction.start,i=e.restriction.end,n=new Set,s=new Set([r]);for(;s.size>0;){let l=u3.find(s);s.clear();for(let c in l)n.add(c);for(let c in l){let h=l[c];for(let u of h)if(!(!a(u.condition)||u.id==t)&&(n.has(u.start)||s.add(u.start),n.has(u.end)||s.add(u.end),s.has(i)))return!0}}return!1;function a(l){return e.restriction.condition==2||l==2?!0:e.restriction.condition==l}}cancel(){this.clearHighlightSpot(),this.startSpots.forEach(t=>t.remove()),this.startSpots=[],this.dimension!=null&&(this.dimension.remove(),this.dimension=null),this.start=null,this.end=null,this.bbox=null,this.condition=null,this.startId=null,this.endId=null,this.startIndex=null,this.endIndex=null,this.historyState=2,this.state!=0&&(this.state=0,A.publish("flushService",""))}exit(){this.dimension&&ah.delete(this.dimension),this.cancel()}};var u$=class{constructor(){this.pads=new Array;this.limitReg=null;this.logger=new Di(4)}set options(t){this._options=t}get options(){return this._options}renumber(t){this.logger.debug1(t);let{range:e,sequsence:r,prefix:i,suffix:n,rule:s,step:a,isLimit:l,selectItems:c}=t;this.pads=new Array,this.commands=new De("Renumber Pads");let h=Qt.getAllItem();if((c||(e==="selectPads"?ze.getSelects():h)).forEach(d=>{if(d instanceof Le){let p=Ce.dispatch(d,"modify");this.commands.addCommand(p),this.pads.push(d)}}),!!this.pads.length){if(this.sortPads(r),s==="suffix_prefix_Increment"&&this.renumberGroup1(r),r==="anti_clockwise"){let d=this.renumberGroup2(),p=Object.keys(d).length;if(p>5){this.logger.debug3("%s %s: %s","\u6392\u5E8F\u540E...\uFF0C\u9006\u65F6\u9488\uFF0C\u5206\u7EC4 > 5",p,this.pads);return}else if(p===5){this.logger.debug3("%s %s: %s","\u6392\u5E8F\u540E...\uFF0C\u9006\u65F6\u9488\uFF0C\u5206\u7EC4 = 5",p,this.pads);return}}if(this.logger.debug3("%s %s: %s","\u6392\u5E8F\u540E...",r,this.pads),this.limitReg=l?/[IOQSXZ]/gim:null,s==="prefixIncrement"){n=this.checkLimitStr(n);let d=i;this.pads.forEach(p=>{let m=d+n;p.num=m,delete p.renumberGroup,d=this.increaseAffix(d,a)})}else if(s==="suffixIncrement"){i=this.checkLimitStr(i);let d=n;this.pads.forEach(p=>{let m=i+d;p.num=m,delete p.renumberGroup,d=this.increaseAffix(d,a)})}else{let d=i,p=n,m=this.pads[0].renumberGroup;this.pads.forEach(g=>{let{renumberGroup:y}=g;m!==y&&(m=y,d=this.increaseAffix(d,a),p=n);let b=d+p;g.num=b,delete g.renumberGroup,p=this.increaseAffix(p,a)})}this.commands.length&&qe.executeCommand(this.commands),A.publish("clearSelect",""),A.publish("flushAttrPlane","")}}sortPads(t){let e=this.pads.length,r;this.left_bottom_point=this.pads[0].center,t==="anti_clockwise"?(this.pads.forEach(i=>{let n=i.center;n.y<this.left_bottom_point.y?this.left_bottom_point=n:n.y===this.left_bottom_point.y&&n.x<this.left_bottom_point.x&&(this.left_bottom_point=n)}),this.logger.debug3("%s %s","\u9006\u65F6\u9488\u7F16\u53F7...\uFF0C\u5DE6\u4E0B\u89D2\u7684\u70B9...",this.left_bottom_point),r=this.anti_clockwise.bind(this)):t==="vertical_horizontal"?r=this.vertical_horizontal.bind(this):t==="horizontal_vertical"?r=this.horizontal_vertical.bind(this):t==="custom_path"&&(r=this.custom_path.bind(this));for(let i=0;i<e-1;i++)for(let n=0;n<e-1-i;n++){let s=this.pads[n].center,a=this.pads[n+1].center;if(r(s,a)){let l=this.pads[n];this.pads[n]=this.pads[n+1],this.pads[n+1]=l}}}renumberGroup1(t){let e=1,r=t==="vertical_horizontal"?"x":"y";this.pads[0].renumberGroup=e;let i=new Rc(.01);for(let n=1;n<this.pads.length;n++)i.eq(this.pads[n].center[r],this.pads[n-1].center[r])?this.pads[n].renumberGroup=this.pads[n-1].renumberGroup:(e++,this.pads[n].renumberGroup=e)}renumberGroup2(){let t=1,e="y";this.pads[0].renumberGroup=t;let r={[t]:1},i=0,n=null,s=null,a=new Rc(.01);for(let l=1;l<this.pads.length;l++)if(a.eq(this.pads[l].center[e],this.pads[i].center[e]))this.pads[l].renumberGroup=this.pads[i].renumberGroup,r[t]+=1,s=null,n=null;else if(r[t]===1)if(n){let c=e==="y"?"x":"y";a.eq(this.pads[l].center[c],this.pads[n].center[c])?(this.pads.splice(i,1),e=c,t--,this.pads[l].renumberGroup=this.pads[n].renumberGroup,r[t]+=1,i=n,l-=1):(this.pads[l].renumberGroup=t,s=l),n=null}else s&&(a.eq(this.pads[l].center[e],this.pads[s].center[e])?(this.pads.splice(i,1),this.pads[l].renumberGroup=this.pads[s].renumberGroup,r[t]+=1,i=s,l-=1):(this.pads[l].renumberGroup=t,r[t]=1,i=l),s=null);else e=e==="y"?"x":"y",t++,this.pads[l].renumberGroup=t,r[t]=1,n=i,i=l,s=null;return r}checkLimitStr(t){return this.limitReg&&this.limitReg.test(t)?t.replace(this.limitReg,function(e){return e==="Z"?"A":String.fromCharCode(e.charCodeAt(0)+1)}):t}anti_clockwise(t,e){let r=Math.abs(Math.atan2(t.y-this.left_bottom_point.y,t.x-this.left_bottom_point.x)*180/Math.PI),i=Math.abs(Math.atan2(e.y-this.left_bottom_point.y,e.x-this.left_bottom_point.x)*180/Math.PI),n=new Rc(.01);return n.eq(e.x,this.left_bottom_point.x)&&n.eq(e.y,this.left_bottom_point.y)||r>i?!0:r===i&&n.eq(t.x,e.x)&&n.greater(t.y,e.y)?!1:r===i&&n.eq(t.x,e.x)&&n.less(t.y,e.y)||r===i&&n.eq(t.y,e.y)&&n.greater(t.x,e.x)?!0:(r===i&&n.eq(t.y,e.y)&&n.less(t.x,e.x),!1)}custom_path(t,e){return t.index>e.index}horizontal_vertical(t,e){let r=new Rc(.01);return r.less(t.y,e.y)?!0:r.eq(t.y,e.y)?r.greater(t.x,e.x):!1}vertical_horizontal(t,e){let r=new Rc(.01);return r.greater(t.x,e.x)?!0:r.eq(t.x,e.x)?r.less(t.y,e.y):!1}increaseAffix(t,e){if(t==="")return"";if(/^[0-9]+$/.test(t))return(Number(t)+e).toString();if(/^[A-Z]+$/i.test(t)){let r=t.length-1,i=t.substr(0,r),n=t[r],s=n.charCodeAt(0),a=90;return s<a&&s+e<=a?(n=String.fromCharCode(s+e),n=this.checkLimitStr(n)):s<a&&s+e>a?(i=i?this.increaseAffix(i,1):"A",i=this.checkLimitStr(i),n=String.fromCharCode(65+(e-(90-s)-1)),n=this.checkLimitStr(n)):s===a&&(i=i?this.increaseAffix(i,1):"A",i=this.checkLimitStr(i),n=String.fromCharCode(65+(e-1)),n=this.checkLimitStr(n)),i+n}else return t}customPathRenumber(){if(A.messageBus.publish("tool","customPathRenumberPads"),this.options.range==="allPads"){let e=Qt.getAllItem();e.forEach(r=>{r.click()}),A.publish("select",e)}}};var ufe=class{get toleranceTargetNet(){return this._targetNet}set toleranceTargetNet(t){this._targetNet=t}getToleranceTargetNet(t){if(!t)return;let e=re.getInstance().getNet(t);if(!e||!e.equalLengthGroup)return;let r=e.equalLengthGroup.targetNet;if(r)this.toleranceTargetNet=r;else{let i=e.equalLengthGroup.getAllNetIds(),n=i.map(a=>Ye.getNetLength(a)),s=0;n.forEach((a,l)=>{n[l]>n[s]&&(s=l)}),this.toleranceTargetNet=i[s]}}cancel(){this.toleranceTargetNet=null,A.publish("showPcbMsgAtCursor",{show:!1},Q())}update(t,e){let r=_o(new S(t.sceneX,t.sceneY));(e=="Please Select The Reference Object"||e=="Please select a reference point")&&(r=r.add1(20,0)),A.publish("showPcbMsgAtCursor",{text:e,pos:r,show:!0,id:"textCursorMsg",tabId:R.getInstance().tabId},Q())}updateNetLengthMsg(t,e){let{diffPairLength:r,netLength:i,net:n,additionalLength:s,hasIncreased:a}=e,l=e.netLength2!=null?e.netLength2:i;if(n){let c=re.getInstance().getNet(n),h=R.getInstance().unit;if(c!=null){let u=null,d=null,p=null,m=null;i!=null&&A.publish("updateNets",{updateNetLength:{[n]:i},unit:h},Q());let g={};if(i!=null&&(g.updateNetLength={[n]:i}),c.netLengthPhysics!=null&&i!=null){let y=re.getInstance().getNetLengthPhysics(c.netLengthPhysics);u={netLength:aa(i,h),netLengthMin:aa(y.netLengthMin,h),netLengthMax:aa(y.netLengthMax,h)}}if(c.netLengthTolerancePhysics!=null&&this.toleranceTargetNet&&l!=null){let y=re.getInstance().getNetLengthTolerancePhysics(c.netLengthTolerancePhysics).netLengthTolerance,b=Ye.getNetLength(this.toleranceTargetNet);d={netLengthDiff:aa(l-b,h),tolerance:aa(y,h)},g.red={[n]:Math.abs(l-b)>y},le.pcbConfig.showNetLength||(d=null)}if(c.netDifferential!=null&&r!=null){let y=c.netDifferential,b=re.getInstance().getDifferentialPhysics(y.differentialPhysics);p={diffPairLength:aa(r,h),diffPairLengthMax:aa(b.differentialPairLenTolerMax,h)}}s!=null&&(m={additionalLength:aa(s,h),hasIncreased:aa(a,h)}),u||d||p||m?A.publish("showPcbMsgAtCursor",{id:"netLengthCursorMsg",show:!0,data:{...u,...p,...m,...d},pos:t?_o(new S(t.sceneX,t.sceneY)):null,tabId:R.getInstance().tabId,showNetLength:le.pcbConfig.showNetLength,showDiffLength:le.pcbConfig.showDiffLength},Q()):this.cancel()}}}updateNetLengthMsg2(t,e){let{diffPairLength:r,netLength:i,net:n,additionalLength:s,hasIncreased:a}=e,l=e.netLength2!=null?e.netLength2:i;if(n){let c=re.getInstance().getNet(n),h=R.getInstance().unit;if(c!=null){let u=null,d=null,p=null,m=null;i!=null&&A.publish("updateNets",{updateNetLength:{[n]:i},unit:h},Q());let g={unit:h};if(i!=null&&(g.updateNetLength={[n]:i}),c.netLengthPhysics!=null&&i!=null){let y=re.getInstance().getNetLengthPhysics(c.netLengthPhysics);u={netLength:aa(i,h),netLengthMin:aa(y.netLengthMin,h),netLengthMax:aa(y.netLengthMax,h)}}if(c.netLengthTolerancePhysics!=null&&this.toleranceTargetNet&&l!=null){let y=re.getInstance().getNetLengthTolerancePhysics(c.netLengthTolerancePhysics).netLengthTolerance,b=Ye.getNetLength(this.toleranceTargetNet);d={netLengthDiff:aa(l-b,h),tolerance:aa(y,h)},g.red={[n]:Math.abs(l-b)>y},le.pcbConfig.showNetLength||(d=null)}if(c.netDifferential!=null&&r!=null){let y=c.netDifferential,b=re.getInstance().getDifferentialPhysics(y.differentialPhysics),P=KTe(r.len_P,h)-KTe(r.len_N,h);p={diffPairLength:aa(P,h,h),diffPairLengthMax:aa(b.differentialPairLenTolerMax,h)}}s!=null&&(m={additionalLength:aa(s,h),hasIncreased:aa(a,h)}),i!=null&&A.publish("updateNets",g,Q()),u||d||p||m?A.publish("showPcbMsgAtCursor",{id:"netLengthCursorMsg",show:!0,data:{...u,...p,...m,...d},pos:t?_o(new S(t.sceneX,t.sceneY)):null,tabId:R.getInstance().tabId,showNetLength:le.pcbConfig.showNetLength,showDiffLength:le.pcbConfig.showDiffLength},Q()):this.cancel()}}}};var QXe=Ru(r2());var dfe=class{constructor(){this._collectors=[]}putItem(t,e){if(!t||t instanceof ge&&t.primitives.length==0)return;let r=null;if(!(t instanceof ge&&t.isClose(e))&&this.iterator(n=>{let s=n.putItem(t,e);return s&&(r=n),!s}),r)return this.autoLink(r,e);this._collectors.push(t instanceof ge?t:ge.build2([t]))}autoLink(t,e){let r=t.primitives.length,i=this._collectors.indexOf(t),n=!1,s=0,a=-1;for(let l=0;l<this._collectors.length;l++){let c=this._collectors[l];if(l==i)continue;let h=c.primitives.length;if(n=r>h?t.putItem(c,e):c.putItem(t,e),n){r>h?(s=l,a=i):(s=i,a=l),this._collectors.splice(s,1);break}}return{sucess:n,delConnect:s,connect:a}}iterator(t){for(let e=0;e<this._collectors.length;e++){let r=this._collectors[e];if(!t(r,e))return}}get size(){return this._collectors.length}};var pfe=class{constructor(){this.trackMap=new Rl;this.viaMap=new Rl}addTrack(t,e,r,i,n,s){let a=nr(),l=Sn.getInstance().addTrack(a,t,e,r,i,n,s);return new Ir(l)}addVia(t,e,r,i,n,s,a,l,c,h,u,d,p=new Array,m=!1){let g=nr();s=oo(s),l=oo(l),t==0&&m&&(t=2);let y=bn.getInstance().addVia(g,t,e,r,i,n,s,a,l,c,h,u,d,p,m);return new Ue(y)}clear(){this.trackMap.clear(),this.viaMap.clear()}clearPreview(){this.trackMap.iterator((t,e)=>{for(let r of e)r.update(),r.remove(),Sn.getInstance().delete(r.model,r.model.globalIndex);return!0}),this.viaMap.iterator((t,e)=>(e.update(),e.remove(),bn.getInstance().delete(e.model,e.model.globalIndex),!0)),this.trackMap.clear(),this.viaMap.clear()}addCommand(t){if(!t)return;let e=R.getInstance().partitionId;this.trackMap.iterator((r,i)=>{for(let n of i){let s=pr.addTrackByModel(n.model);s.partition=e,t.addCommand4Item(s,"add")}return!0}),this.viaMap.iterator((r,i)=>{let n=Wr.addViaByModel(i.model);return n.partition=e,t.addCommand4Item(n,"add"),!0})}};var ffe=class{constructor(){this.workerBus=null;this.worker=null;this.state=2;this.manager=new pfe;this.matrixRes=null;this.historyGroup=null;this.selectNets=null;this._curProgressTitle="";this.workerName="pcbRouterWorker";this.config={routingRange:0,routingCorner:0,isKeep:!0,viaQuatity:0,routingEffectPriority:1,routingNetPriority:0,layers:[1,2,12],ignoreNets:[]};A.subscribe("pcb/autoRouting",t=>{this.autoRouting(t,!1)}),A.subscribe("pcb/routerResult",this.routerResult.bind(this)),A.subscribe("pcb/routerInterrupt",this.routerInterrupt.bind(this)),A.subscribe("pcb/routerProgress",t=>{let e=this.getProgressTitle(t.stage);this.updateProgress(t.progress,e,!1)})}getConfig(){return Ss(this.config)}loadWorker(t=!1){this.terminateWorker();let e={name:this.workerName};t?this.worker=new Worker(`editor?entry=pcb-router-worker.js${Q().location.search.replace(/\?/,"&")}`,e):this.worker=new Worker(`editor?entry=pangolin-worker.js${Q().location.search.replace(/\?/,"&")}`,e),this.worker.onerror=this.handleWorkerError,this.workerBus=new QXe.WorkerMessageBridge(A.messageBus,this.worker)}terminateWorker(){this.worker&&this.worker.terminate(),this.worker=null}handleWorkerError(t){console.error("router worker error:",t.message),this.terminateWorker()}async autoRouting(t,e=!1){if(!R.getInstance().isactive||![pi.PCB,pi.PCBMODULE].includes(R.getInstance().doctype)||!this.isAllowRouter(!0))return;let r=1e3,i=(parent.location.search||"").match(/pangolinStage=(\d+)/);i&&(r=parseInt(i[1]));let n=e?!1:t.routingEffectPriority===0,s=await this.createPangolinJson(t,!0,r,n);if(e)return this.matrixRes=null,s;if(!s)return;this.loadWorker(!0),this.toggleRouterState(0);let l=n?"pangolin/autoRoutingJR":"pangolin/autoRouting_wasm";og(l,{color:"#9c50ff"}),this.workerBus.publish(l,{json:s,options:{VISUAL_DEBUG_TYPE:parent.window.VISUAL_DEBUG_TYPE,ROUTING_OPT_PATH_ALGO:parent.window.ROUTING_OPT_PATH_ALGO,STAGE:r}}),this.config.isKeep||(this.clearRoute(!1,void 0,this.selectNets),A.publish("updateFrame",""))}async autoRoutingForJR(t){if(!R.getInstance().isactive||![pi.PCB,pi.PCBMODULE].includes(R.getInstance().doctype)||!this.isAllowRouter(!0))return;let e=1e3,r=(parent.location.search||"").match(/pangolinStage=(\d+)/);r&&(e=parseInt(r[1]));let i=await this.createPangolinJson(t,!0,e,!0);return this.matrixRes=null,i}getProgressTitle(t){switch(t){case 1:return"Track optimizing...";case 2:return"Routing...";case 3:return"Initializing...";default:return"Autorouting..."}}routerResult(t){if(this.state!==1){console.error("Auto Routing is stop!",this.state);return}try{og("PangolinResJson",void 0,t),this.updateCanvas(t),t.finish||t.progress===1?t.progress=1:t.progress=Math.min(t.progress,.99);let e=this.getProgressTitle(t.stage);this.updateProgress(t.progress,e)}catch(e){g0({type:"error",message:"Automatic Routing interrupt: "+e,shortMsg:"Automatic Routing interrupt!"}),this.routerInterrupt()}}previewJsonInCanvas(t){let e=new hi;e.createGroup("previewJsonInCanvas");let r=this.getMatrixRes(),i=null;i=this.parsePangolinPoints(t.board.path,r),this.drawPolygon({type:"Board Outline",layerId:11,pl:i},e),t.traces.forEach(n=>{i=this.parsePangolinPoints(n.path,r),this.drawPolygon({type:"Line",layerId:this.getProLayer(n.layer),pl:i,width:this.autoPangolinNum(n.width,r)},e)}),t.pins.forEach(n=>{i=this.parsePangolinPoints(n.path,r);let s=this.getProLayer(n.layer),a=s==12;this.drawPolygon({type:a?"Slot Region":"Fill Region",layerId:s,pl:i},e)}),t.vias.forEach(n=>{let s=this.parsePangolinPoint(n.location,r);i=ge.build2([q.buildCircle(s,this.autoPangolinNum(Math.max(n.size[0],n.size[1])/2,r),ae.CCW)]),this.drawPolygon({type:"Slot Region",layerId:12,pl:i},e)}),t.keepouts.forEach(n=>{i=this.parsePangolinPoints(n.path,r),this.drawPolygon({type:"Prohibited Region",layerId:this.getProLayer(n.layer),pl:i},e)}),e.execute()}drawPolygon(t,e){if(!t.pl||t.pl.primitives.length==0)return;Object.is(t.locked,void 0)&&(t.locked=!0),t.net||(t.net=""),t.width||(t.width=1);let r=t.pl.primitives[0];if(t.type!="Line"&&t.pl.primitives.length==1&&r instanceof M){let s=pr.addTrack(t.layerId,r.start(),r.end(),t.width,t.locked,t.net);return e.addCommand4Item(s,"add")}let n=new Mh().create4Pl(t.type,t.layerId,t.pl,t.width,t.net,!1);e.addCommand4Item(n,"add")}parsePangolinPoint(t,e){let[r,i]=t,n=new S(r,i);return e&&(n=n.multiply3(e)),n}parsePangolinPoints(t,e){let r=t.map(i=>this.parsePangolinPoint(i,e));return r.length?ge.build4(r):null}updateCanvas(t){this.manager.clearPreview(),this.historyGroup.createGroup("autoRouting_each"),this.updateTracks(t.traces||t.tracks,this.getMatrixRes()),this.updateVias(t.vias,this.getMatrixRes()),Mo.modify(),A.publish("updateFrame","")}clearRoute(t,e,r){ace(this.historyGroup.getCommand(),t,e,r,!1)}autoBool2Num(t){return t?1:0}getPolylineInsideMap(t){let e={},r=1;for(let i=0;i<t.length;i++){let n=t[i],s=n.bbox(),a=[];for(let l in e)e[l].some(h=>{let u=h.bbox();if(s.isInside(u)||u.isInside(s))return a.push(l),!0});if(a.length===0)e[r++]=[n];else if(a.length===1)e[a[0]].push(n),e[a[0]]=e[a[0]].sort((l,c)=>c.bbox().area()-l.bbox().area());else{let l=[n];a.forEach(c=>{l.push(...e[c]),delete e[c]}),e[r++]=l.sort((c,h)=>h.bbox().area()-c.bbox().area())}}return e}getMatrix(){let t=10,e=39.37,r=nn.convert(1,t,e),i=Qe.scale(r),n=Qe.scale(1/r);return{matrix:i,matrixRes:n}}async createPangolinJson(t,e=!0,r=0,i=!0){t=Object.assign(this.config,t),this.historyGroup||(this.historyGroup=new hi,this.historyGroup.createGroup("autoRouting_total"));let n=r===3;n&&(t.isKeep=!1);let{matrix:s,matrixRes:a}=this.getMatrix();this.matrixRes=a;let l=t.routingCorner,c=[],h=[],u=this.getFilterBoard(),d=null;if(!u||u.length===0){let Xe="Please draw a board outline first!";g0({type:"error",message:Xe,shortMsg:Xe});return}else if(u.length>1){let Xe=new _e,ct=[];u.forEach(st=>{Xe.ext1(st.buildBBox()),ct.push(...st.getMathGraphics().primitives)});let Me=new $c(Xe.build1(),2,1.2,new Di(2),ct).detect();if(Me.items.length===1)d=Me.items[0];else{let st=this.getPolylineInsideMap(Me.items);if(Object.keys(st).length>1){let hr="Found multiple board outlines, please change the extra board outlines as solt regions or delete them. All board outlines",Or=[hr+":"];u.forEach((Xr,Oi)=>{Or.push(Oi==0?" ":", "),Or.push({attr:{id:Xr.globalIndex,pcbid:R.getInstance().tabId},text:Tr+Xr.number})}),e&&g0({type:"error",message:Or,shortMsg:hr});return}else{let hr=0,Or=null,Xr=Ze.getInstance().getAllCopperLayerIds(),Oi=null;Me.items.forEach(qi=>{let Ni=qi.bbox().area();Ni>hr?(hr=Ni,Or&&h.push({path:this.autoPangolinPointsForArc(Or.asClose(),s),layers:Xr}),Or=qi):h.push({path:this.autoPangolinPointsForArc(qi.asClose(),s),layers:Xr})}),d=Or}}}let p=d||d||u[0].getMathGraphics(),m=Mt.isChildPcb();m&&(p=this.getChildPcbBoardOutline(p));let g=p.bbox(),y=this.autoPangolinBBox2(g,s),b=this.autoPangolinPointsForArc(p,s),P=re.getInstance().getDefaultSafeSpacing(),T=this.autoPangolinNum(P.getItemsMaxClearance([0,1,2,5],[11]),s),I=null;if(t.routingRange!=0){if(I=[],(t.routingRange==2?ze.getComponents():ze.getItems()).forEach(ct=>{if(ct instanceof ke)ct.getItems().forEach(Me=>{if(Me instanceof Qo){let st=Me.net;st&&!I.includes(st)&&I.push(st)}});else{let Me=Ao(ct);Me&&!I.includes(Me)&&I.push(Me)}}),I=I.filter(ct=>!t.ignoreNets.includes(ct)),I.length===0){let ct="No network selected!";g0({type:"error",message:ct,shortMsg:ct});return}}else t.ignoreNets.length>0&&(I=Ye.getAllNets(),I=I.filter(Xe=>!t.ignoreNets.includes(Xe)));this.selectNets=I;let C=[],E={},O=[],_=[],x=new Rl,v=re.getInstance(),D={},w={},F=v.getAllNetClass();F&&(F.forEach(Xe=>{let ct=Xe.name,Me=Xe._nets;w[ct]=Array.from(Me)}),D.netClasses=w);let H={},z=v.getAllNetDifferentials();z&&(z.forEach(Xe=>{let ct=Xe.name,Me=Xe.positiveNet,st=Xe.negativeNet;H[ct]=[Me.name,st.name]}),D.differentialPairClasses=H);let V={},W=v.getAllSafeSpacing(),L=[];W&&W.forEach(Xe=>{L.push(Xe.name)});let k={};L.forEach(Xe=>{let ct=v.getSafeSpacing(Xe),Me=ct.status==0,st=Ze.getInstance().getAllCopperLayerIds(),Ot=[];if(Me){let hr={layers:st,trackToTrack:ct.getClearance(0,0),trackToVia:ct.getClearance(0,5),trackToPad:Math.max(ct.getClearance(0,1),ct.getClearance(0,2)),trackToFillRegion:ct.getClearance(0,6),trackToProhibitedRegion:Math.max(ct.getClearance(0,8),ct.getClearance(0,15)),trackToBoardOutline:ct.getClearance(0,11),viaToVia:ct.getClearance(5,5),viaToPad:Math.max(ct.getClearance(5,1),ct.getClearance(5,2)),viaToFillRegion:ct.getClearance(5,6),viaToProhibitedRegion:Math.max(ct.getClearance(5,8),ct.getClearance(5,15)),viaToBoardOutline:ct.getClearance(5,11)};this.transformRuleUnitToMM(hr),Ot.push(hr)}else st.forEach(hr=>{let Or={layers:[hr],trackToTrack:ct.getClearance(0,0,hr),trackToVia:ct.getClearance(0,5,hr),trackToPad:Math.max(ct.getClearance(0,1,hr),ct.getClearance(0,2,hr)),trackToFillRegion:ct.getClearance(0,6,hr),trackToProhibitedRegion:Math.max(ct.getClearance(0,8,hr),ct.getClearance(0,15,hr)),trackToBoardOutline:ct.getClearance(0,11,hr),viaToVia:ct.getClearance(5,5,hr),viaToPad:Math.max(ct.getClearance(5,1,hr),ct.getClearance(5,2,hr)),viaToFillRegion:ct.getClearance(5,6,hr),viaToProhibitedRegion:Math.max(ct.getClearance(5,8,hr),ct.getClearance(5,15,hr)),viaToBoardOutline:ct.getClearance(5,11,hr)};this.transformRuleUnitToMM(Or),Ot.push(Or)});k[Xe]=Ot}),E.safeClearances=k;let N=v.getAllTrackPhysics(),U=[];N&&N.forEach(Xe=>{U.push(Xe.name)});let B={};U.forEach(Xe=>{let ct=v.getTrackPhysics(Xe),Me=Ze.getInstance().getAllCopperLayerIds(),st=[];if(Me.forEach(hr=>{let Or=ve(nn.convert(ct.getMinWidth(hr)*10,1,39.37),3),Xr=ve(nn.convert(ct.getDefaultWidth(hr)*10,1,39.37),3),Oi=ve(nn.convert(ct.getMaxWidth(hr)*10,1,39.37),3),qi=[Or,Xr,Oi];st.push(qi)}),st.every(hr=>JSON.stringify(hr)===JSON.stringify(st[0]))){let hr=[{layers:Me,trackWidth:st[0]}];B[Xe]=hr}else{let hr=Me.map((Or,Xr)=>({layer:Or,trackWidth:st[Xr]}));B[Xe]=hr}}),E.trackWidths=B;let G=v.getAllRadiusPhysics(),Y=[];G&&G.forEach(Xe=>{Y.push(Xe.name)});let X={};Y.forEach(Xe=>{let ct=v.getRadiusPhysics(Xe),Me=ct.defalutRadius*2,st=ct.defalutInner*2,Ot=[ve(nn.convert(Me*10,1,39.37),3),ve(nn.convert(st*10,1,39.37),3)];X[Xe]=Ot}),E.viaSizes=X;let K=v.getAllDifferentialPhysics(),J=[];K&&K.forEach(Xe=>{J.push(Xe.name)});let se={};J.forEach(Xe=>{let ct=v.getDifferentialPhysics(Xe),Me=ve(nn.convert(ct.differentialPairLenTolerMax*10,1,39.37),3);Me<.127&&(Me=.127);let st=Ze.getInstance().getAllCopperLayerIds(),Ot=[];if(st.forEach(Or=>{let Xr=ve(nn.convert(ct.getStrokeWidthMin(Or)*10,1,39.37),3),Oi=ve(nn.convert(ct.getStrokeWidthDefault(Or)*10,1,39.37),3),qi=ve(nn.convert(ct.getStrokeWidthMax(Or)*10,1,39.37),3),Ni=ve(nn.convert(ct.getDifferentialPairSpacingMin(Or)*10,1,39.37),3),Wi=ve(nn.convert(ct.getDifferentialPairSpacingDefault(Or)*10,1,39.37),3),fo=[Xr,Oi,qi,Ni,Wi];Ot.push(fo)}),Ot.every(Or=>JSON.stringify(Or)===JSON.stringify(Ot[0]))){let Or=[{layers:st,lengthTolerance:Me,width:Ot[0].slice(0,3),clearance:Ot[0].slice(3)}];se[Xe]=Or}else{let Or=st.map((Xr,Oi)=>({layer:Xr,lengthTolerance:Me,width:Ot[Oi].slice(0,3),clearance:Ot[Oi].slice(3)}));se[Xe]=Or}}),E.differentialPairs=se;let ce=v.getAllNetLengthPhysics(),te=[];ce&&ce.forEach(Xe=>{te.push(Xe.name)});let oe={};te.forEach(Xe=>{let ct=v.getNetLengthPhysics(Xe),Me=ve(nn.convert(ct.netLengthMin*10,1,39.37),3),st=ve(nn.convert(ct.netLengthMax*10,1,39.37),3);oe[Xe]=[Me,st]}),E.trackLengths=oe;let $=new Set(this.selectNets),fe=v.getAllNets(),Oe=$.size>0?new Set([...fe].filter(Xe=>$.has(Xe.name))):fe;for(let Xe of Oe){let ct=Xe.name;if(!ct)continue;let Me={net:ct,routing:!t.ignoreNets.includes(ct),safeClearance:Xe.safeSpacing=="default"?v.getDefaultSafeSpacing().name:Xe.safeSpacing,trackWidth:Xe.trackPhysics=="default"?v.getDefaultTrackPhysics().name:Xe.trackPhysics,viaSize:Xe.radiusPhysics=="default"?v.getDefaultRadiusPhysics().name:Xe.radiusPhysics,differentialPair:Xe.differentialPhysics=="default"?v.getDefaultDifferentialPhysics().name:Xe.differentialPhysics,trackLength:Xe.netLengthPhysics=="default"?v.getDefaultNetLengthPhysics().name:Xe.netLengthPhysics};if(C.push(Me),L.includes(Xe.safeSpacing))V[Xe.safeSpacing]||(V[Xe.safeSpacing]=[]),V[Xe.safeSpacing].push(Xe.name);else if(Xe.safeSpacing=="default"){let Oa=v.getDefaultSafeSpacing().name;V[Oa]||(V[Oa]=[]),V[Oa].push(Xe.name)}let Ot=v.getSafeSpacingByNet(ct,0).getItemMaxClearance(0,[0,1,2,5]),hr=v.getTrackPhysicsByNet(ct).getDefaultWidth(),Or=v.getRadiusPhysicsByNet(ct);if(Or.defalutRadius<=0||Or.defalutInner<=0||Or.defalutInner>=Or.defalutRadius){e&&g0({type:"error",message:["Found incorrect via size of"," ",{text:"Design Rule",i18n:!0,call:{topic:"DesignRuler"}}," ",", it must large than 0 mm, and via outside diameter must large than inside diameter, please modify"],shortMsg:"Incorrect via size!"});return}if(hr<=0){e&&g0({type:"error",message:["Found incorrect track width of"," ",{text:"Design Rule",i18n:!0,call:{topic:"DesignRuler"}}," ",{text:", it must large than 0 mm, please modify",i18nContext:"routing-dlg-track"}],shortMsg:"Incorrect track width!"});return}let Xr=[this.autoPangolinNum(Or.defalutRadius*2,s),this.autoPangolinNum(Or.defalutInner*2,s)],Oi=this.autoPangolinNum(hr,s),qi=this.autoPangolinNum(Ot,s),Ni=[Xr.toString(),Oi.toString(),qi.toString()].join("-"),Wi=I&&!I.includes(ct),fo=this.autoBool2Num(!Wi);if(x.contains(Ni)){_.push([ct,x.get(Ni),fo]);continue}O.push({viaSize:Xr,width:Oi,clearance:qi});let tl=O.length-1;x.put(Ni,tl),_.push([ct,tl,fo])}D.netClearancesClasses=V,O.length&&_.push(["",0,this.autoBool2Num(!1)]);let Te=t.isKeep||n,ue={},be={},j={},Z=[],ie=Qt.getAllItem();ie=this.partitionFilter(ie),ie.forEach(Xe=>{if(!(Xe instanceof _i||Xe instanceof sn))return;let ct=Xe.globalIndex,Me=Xe.net,st=Xe.buildBBox(),Ot=this.autoPangolinBBox(st,s),hr=Xe.layerId,Or=!1,Xr=null;if(Xe.model.padStyle.type=="ELLIPSE"&&(Xr=ve(nn.convert(Xe.model.padStyle.width*10,1,39.37),3)),ar(hr)&&Xe instanceof _i){let Wi=Xe.top,fo=Xe.bottom,tl=Xe.inner;(Wi&&Wi.type==="ELLIPSE"||fo&&fo.type==="ELLIPSE"||tl&&tl.type==="ELLIPSE")&&(Xr=this.getEllipsePadDiameter(Xe.model));let Oa=0,Gc=Math.max(Xe.topWidth,Xe.topHeight);if(Gc>Oa&&(Oa=Gc,hr=1),Gc=Math.max(Xe.bottomWidth,Xe.bottomHeight),Gc>Oa&&(Oa=Gc,hr=2),Gc=Math.max(Xe.innerWidth,Xe.innerHeight),Gc>Oa){Oa=Gc;let B0=Xe.getOneInnerInUse();B0&&(hr=B0)}(Xe.holeLength>Oa||Xe.holeRadius*2>Oa)&&(Or=!0)}let Oi=this.autoPangolinPointsForArc(Or?Xe.hole.getShape(0,Xe.center,Xe.rotation):Xe.getMathGraphics(hr),s),qi=this.getPangolinLayer(Xe.layerId);if(Z.push({net:Me,layer:qi,bbox:Ot,location:this.autoPangolinPoint(Xe.center,s),rotation:zt.toDegrees(Xe.rotation),path:Oi}),!(Xe.getParent()instanceof ke)){let Wi=[];ar(Xe.layerId)?Wi=Ze.getInstance().getAllSignalLayerIds():Wi.push(Xe.layerId);let fo={number:Xe.num,layers:Wi,location:this.autoPangolinPoint(Xe.center,s),path:Oi,diameter:Xr};be[ct]=fo,j[ct]=Me}}),_=this.fixRoutingPriority(_,Z,t.routingNetPriority);let de=[];if(Te){let Xe=[];pr.getAllItem().forEach(Me=>{if(Xe.includes(Me.gId))return;let st=jt.filterTrack(Me),Ot=Me.gId;st=this.partitionFilter(st),st.forEach(hr=>{if(!(hr instanceof Ge))return;let Or=[...hr.searchAllConnectNode()].filter(Ni=>Ni instanceof _i&&(Ni.layerId===12||Ni.layerId===hr.layerId)),Xr=[];Or.length>0&&Or.forEach(Ni=>{if(Ni.getParent()instanceof ke){let Wi=Ni.getParent(),fo=Wi.globalIndex;Xr.push([Wi.designator,this.extractPrefix(Ni.globalIndex,fo)])}}),Xe.push(hr.gId);let Oi={id:hr.gId,width:ve(this.autoPangolinNum(hr.width,s),3),layer:this.getPangolinLayer(hr.layerId),net:hr.net,path:null,pads:Xr},qi=hr instanceof yi?ge.build4(hr.model.primitive.points(.1)):ge.build4([hr.start,hr.end]);yk(ue,Ot,()=>({collector:new dfe,traceConfig:Oi})).collector.putItem(qi)})})}let me=[];(t.isKeep||n)&&this.partitionFilter(Wr.getAllItem()).forEach(ct=>{me.push({id:ct.globalIndex,location:this.autoPangolinPoint2(ct.center,s),size:[this.autoPangolinNum(ct.radius*2,s),this.autoPangolinNum(ct.holeRadius*2,s)],net:ct.net})});let Se={},Re=["Prohibited Region","Slot Region","Fill Region","Line"];Xt.getAllItem().concat(Kt.getAllItem()).concat(pt.getAllItem()).forEach(Xe=>{let{type:ct,layerId:Me,strokeWidth:st,net:Ot}=Xe,hr=[];if(Me==12?hr=Ze.getInstance().getAllSignalLayerIds():hr.push(Me),ct==="Partition"&&Xe.model.component instanceof ac){let Or=Xe.model.component.fileUuid;if(!m&&Or){let Xr=this.getPolylineOutline(Xe,Me);this.autoPushFillRegionPath(c,Xr,s,Me,p,Ot)}return}if(!(!this.isSingleLayer(Me)&&!ar(Me)&&ct!=="Board Outline")){if(Re.includes(ct)){let Or=Xe.getComponent();if(ct==="Prohibited Region"&&Or instanceof Fu&&!Or.track)return;let Xr=this.getPangolinLayer(Me),Oi=this.getPolylineOutline(Xe,Xr);if(ct==="Line"&&Pe.getLayer(Me).isCopperLayer()){let qi={id:Xe.globalIndex,width:ve(this.autoPangolinNum(Xe.strokeWidth,s),3),layer:Me,net:"",path:this.autoPushPath(Oi,s,p),pads:[]};de.push(qi)}if(Oi.closed())ct==="Fill Region"&&this.autoPushFillRegionPath(c,Oi,s,Me,p,Ot),(ct==="Prohibited Region"||ct==="Slot Region")&&this.autoPushProhibitedRegionPath(h,Oi,s,hr,p);else return Oi.primitives.forEach(qi=>{let Ni=qi.stroke(st,wr.ROUND,ae.CW).asClose();ct==="Fill Region"&&this.autoPushFillRegionPath(c,Ni,s,Me,p,Ot),(ct==="Prohibited Region"||ct==="Slot Region")&&this.autoPushProhibitedRegionPath(h,Ni,s,hr,p)})}if(ct=="Constraint Region"){let Or=Xe.globalIndex,Xr=Xe.constrainName,Oi=this.getPangolinLayer(Me),qi=this.getPolylineOutline(Xe,Oi),Ni=this.autoPushPath(qi,s,p),Wi=v.getAllConstraintRegions(),fo=Array.from(Wi).find(Oa=>Oa.name===Or),tl={layers:hr,safeClearance:fo.safeClearance,trackWidth:fo.track,viaSize:fo.radius,differentialPair:fo.diff,path:Ni};Se[Xr]=tl}}}),(!t.isKeep||n)&&this.clearRoute(!1,void 0,this.selectNets);for(let Xe in ue){let ct=ue[Xe],Me=ct.traceConfig;ct.collector.iterator(st=>{let Ot=Object.assign({},Me,{path:this.autoPangolinPointsForArc(st,s)});return de.push(Ot),!0})}let Je=[],Ke=[],Gt={},Nr=Ar.getAllItem().map(Xe=>Xe.footprintUUID),xr=Array.from(new Set(Nr));xr&&xr.forEach(Xe=>{Ke.push(Hi.getItem(Xe))}),Ke&&Ke.forEach(Xe=>{let ct=Xe.id,Me=Xe.uuid,st=Xe.getBBox();if(!st)return;let Ot=this.autoPangolinBBox2(st,s),hr=Xe.origin,Or=Xe.getPads(),Xr={};Or.length>0&&Or.forEach(qi=>{let Ni=qi.globalIndex,Wi=qi.layerId,fo=qi.center,tl=fo.sub(hr),Oa=this.autoPangolinPoint2(tl,s),Gc=qi.rotation,B0=qi.getMathGraphics(Wi),Uc=this.getFootprintNewOutlineByMatrix(B0,hr),Lt=this.autoPangolinPointsForArc(Uc,s),Ql=null;qi.padStyle.type=="ELLIPSE"&&(Ql=ve(nn.convert(qi.padStyle.width*10,1,39.37),3));let Wm=[];if(Wm.push(Wi),Wi==12){Wm=Ze.getInstance().getAllSignalLayerIds();let IE=qi.top,o9=qi.bottom,CE=qi.inner;(IE&&IE.type==="ELLIPSE"||o9&&o9.type==="ELLIPSE"||CE&&CE.type==="ELLIPSE")&&(Ql=this.getEllipsePadDiameter(qi));let s9=qi.hole,S$=qi.pasteExpansion||0,q5=qi.topSolderExpansion||0,AU=qi.bottomSolderExpansion||0,E$=Q9(1,fo,Gc,IE,o9,CE,s9,S$,q5,AU),O$=Q9(2,fo,Gc,IE,o9,CE,s9,S$,q5,AU),A$=E$.area(),_$=O$.area(),$5=A$>_$?qi.getMathGraphics(1):qi.getMathGraphics(2),K5=this.getFootprintNewOutlineByMatrix($5,hr);Lt=this.autoPangolinPointsForArc(K5,s)}let Lg={number:qi.num,layers:Wm,location:Oa,path:Lt,diameter:Ql};Xr[Ni]=Lg});let Oi={pads:Xr,bbox:Ot};Gt[ct]?(Gt[ct+"_"+Me]=Oi,Je.push(Me)):Gt[ct]=Oi});let vr={},_r=Ar.getAllItem(),Ne={},Vt={};_r.forEach(Xe=>{let ct=Xe.attrKeyValue["Unique ID"];ct&&(Ne[Xe.globalIndex]=ct,Vt[ct]=Xe.globalIndex)});let Ft=(await A.windowBridge.rpcCall("getAutoLayoutSymbolInfoByUniqueId",{uniqueID:Object.values(Ne),pcbUuid:R.getInstance().tabId},Q())).message||{};if(_r){let Xe={};_r.forEach(st=>{let Ot=st.globalIndex,hr=st.designator;hr in Xe?Xe[hr].push(Ot):Xe[hr]=[Ot];let Or={},Xr={};st.getPads().forEach(Wi=>{let fo=Wi.globalIndex,tl=Wi.net,Oa=Wi.num;fo.includes(st.globalIndex)&&(fo=fo.replace(st.globalIndex,"")),Or[fo]=tl,Xr[fo]=this.getPinName(Ft,hr,Oa)});let qi=Je.includes(st.footprintUUID)?st.footprintId+"_"+st.footprintUUID:st.footprintId,Ni={name:st.device,footprint:qi,layer:st.layerId,location:this.autoPangolinPoint2(st.position,s),rotation:ve(zt.toDegrees(st.rotation),4),nets:Or,pinName:Xr,reuseModules:{moduleName:st.reuseBlock,groupID:st.combinationID,channelID:st.channelID}};vr[hr]=Ni});let ct=[],Me=[];for(let st in Xe){let Ot=Xe[st];Ot.length>1&&(ct.push(...Array(Ot.length).fill(st)),Me.push(...Ot))}if(ct.length>0){let st="Auto component routing failed, has duplicated designator, please modify",Ot=[st+":"];Me.forEach((hr,Or)=>{Ot.push(Or==0?" ":", "),Ot.push({attr:{id:hr,pcbid:R.getInstance().tabId},text:ct[Or]})}),g0({type:"error",message:Ot,shortMsg:st});return}}let ir={pads:be,bbox:[0,0,0,0]};Object.keys(ir.pads).length!==0&&(Gt.FREEPADFOOTPRINT=ir,vr.eFREEPADCOMPONENT={name:"d_FREEPADCOMPONENT",footprint:"FREEPADFOOTPRINT",layer:1,location:[0,0],rotation:0,nets:j,reuseModules:{moduleName:null,groupID:null,channelID:null}});let Fe=[],tt=t.layers;tt.length==0&&tt.push(1,2,12),tt.includes(12)&&(tt=Ze.getInstance().getAllSignalLayerIds());let ye=t.ignoreLayers;i&&(tt.forEach(Xe=>{let ct=this.getPlaneLayerNet(Xe);Fe.push({name:Pe.getLayerName(Xe),layerID:Xe,isRoute:!0,net:ct})}),ye&&ye.forEach(Xe=>{let ct=this.getPlaneLayerNet(Xe);Fe.push({name:Pe.getLayerName(Xe),layerID:Xe,isRoute:!1,net:ct})}));let yt="";l==0?yt="45":l==1?yt="90":l==2?yt="arc":yt="any",ri.getAllItem().forEach(Xe=>{if(Pe.getLayer(Xe.layerId).isCopperLayer()&&Xe.showValue){let ct=Xe.getMathGraphics(Xe.layerId);this.autoPushProhibitedRegionPath(h,ct,s,[Xe.layerId],p)}});let pe={boardOutline:{bbox:y,path:b},layers:i?Fe:{route:tt,notRoute:ye},routingCorner:yt,rules:E,classes:D,nets:C,components:vr,footprints:Gt,constraintRegions:Se,tracks:de,vias:me,fillRegions:c,prohibitedRegions:h};return og("\u81EA\u52A8\u5E03\u7EBFJSON",void 0,pe),pe}getChildPcbBoardOutline(t){let e=Mt.getJudgeCanEditArea();if(!(t&&e&&e instanceof ge))return t;let r=new As(t,e,0).relation;if([1,2].includes(r)){let i=t.bbox().area(),n=e.bbox().area();i>n&&(t=e)}else t=new Ec().getIntersection([t],[e],[2,2])[0].items[0];return t}partitionFilter(t){return Mt.isChildPcb()||(t=t.filter(r=>r.partition=="")),t}autoPushKeepPath(t,e,r,i,n){new Xl(e,n,0).relation!==3&&t.push({path:this.autoPangolinPoints(e,r),layer:i})}autoPushFillRegionPath(t,e,r,i,n,s){new Xl(e,n,0).relation!==3&&t.push({path:this.autoPangolinPointsForArc(e,r),layer:i,net:s})}autoPushProhibitedRegionPath(t,e,r,i,n){new Xl(e,n,0).relation!==3&&t.push({path:this.autoPangolinPointsForArc(e,r),layers:i})}autoPushPath(t,e,r){return new Xl(t,r,0).relation!==3?this.autoPangolinPointsForArc(t,e):[]}fixRoutingPriority(t,e,r){let i={},n={},s=t.map(c=>(n[c[0]]=c,c[0])),a={};if(e.forEach(c=>{l2(i,c.net).push(c),a[c.net]?a[c.net]++:a[c.net]=1}),r===0)return t;if(r===1)Dke(s);else if(r===2)s.sort().sort((c,h)=>{let u=c.includes("$"),d=h.includes("$");return u&&!d?1:!u&&d?-1:0});else if(r===3||r===4){let c=r===3?1:-1;s.sort((h,u)=>(a[u]-a[h])*c)}else if(r===5||r===6){let c=r===5?1:-1;s.sort((h,u)=>(Wo.getRatlineLengthByName(u)-Wo.getRatlineLengthByName(h))*c)}else return t;let l=[];return s.forEach(c=>{l.push(n[c])}),l}getPangolinLayer(t){return t}getProLayer(t){return t}getPlaneLayerNet(t){let e=zn.layerMapSet[t];return e&&e.size>0&&Array.from(e)[0].net||""}isSingleLayer(t){return Pe.getLayer(t).isSignalLayer()}autoPangolinPoint(t,e){return e&&(t=t.multiply3(e)),[t.x,t.y]}autoPangolinPoint2(t,e){return e&&(t=t.multiply3(e)),[ve(t.x,4),ve(t.y,4)]}autoPangolinBBox(t,e){return[this.autoPangolinPoint(t.LL(),e),this.autoPangolinPoint(t.UR(),e)]}autoPangolinBBox2(t,e){return t=t.transform(e),[ve(t.minX,4),ve(t.maxX,4),ve(t.minY,4),ve(t.maxY,4)]}areArraysEqual(t,e){return t[0]===e[0]&&t[1]===e[1]}autoPangolinPoints(t,e){let r=[],i="";return t.points(.1,n=>{let s=this.autoPangolinPoint(n,e),a=s.join("_");i!==a&&(i=a,r.push(s))}),r}autoPangolinPointsForPad(t,e){let r=[],i="";return t.points(.01,n=>{let s=this.autoPangolinPoint(n,e),a=s.join("_");i!==a&&(i=a,r.push(s))}),r}autoPangolinPointsForArc(t,e){let r=[];return t.primitives.forEach(i=>{if(i instanceof q)if(i.isCircle()){let n=i.sweepAngle/2,s=q.build3(i.center,i.startAngle,i.sweepAngle/2,i.rx,i.ry),a=this.autoPangolinPoint(s.start(),e),c=[...this.autoPangolinPoint(s.end(),e),n],h=[...a,n];(r.length===0||!this.areArraysEqual(r[r.length-1],a))&&r.push(a),r.push(c),r.push(h)}else{let n=this.autoPangolinPoint(i.start(),e),s=this.autoPangolinPoint(i.end(),e),a=i.sweepAngle,l=[...s,a];(r.length===0||!this.areArraysEqual(r[r.length-1],n))&&r.push(n),r.push(l)}else{let n=this.autoPangolinPoint(i.start(),e),s=this.autoPangolinPoint(i.end(),e);(r.length===0||!this.areArraysEqual(r[r.length-1],n))&&r.push(n),r.push(s)}}),r}autoPangolinResPoint(t,e){let r=new S(t[0],t[1]);return e?r.multiply3(e):r}autoPangolinNum(t,e){return e&&(t=t*e.iScale),t}isAllowRouter(t=!0){let e=re.getInstance().getDefaultSafeSpacing(),r=e.getClearance(11,0),i=e.getClearance(11,5);return r<=0||i<=0?(t&&g0({type:"error",message:["Found incorrect board outline clearance of"," ",{text:"Design Rule",i18n:!0,call:{topic:"DesignRuler"}}," ",", it must large than 0 mm, please modify"],shortMsg:"Incorrect board outline clearance!"}),!1):!0}toggleRouterState(t,e=!1,r=1){let i=this.state;if(t===0){if(i!=2)return;this.routerReady()}else{if(t===1)return;if(t===2){if(i!=1){this.state=t;return}this.routerEnd(e,r)}else if(t===3){if(i!=1){this.state=2;return}this.routerInterrupt()}}}routerReady(){this.state=0,this.startTime=new Date,this.manager.clear(),this._curProgressTitle="",this.state=1,this.updateProgress(0,this._curProgressTitle),this.historyGroup||(this.historyGroup=new hi,this.historyGroup.createGroup("autoRouting_total"));let t=Pe.getRatlineLayer();t.visible?(t.visible=!1,this._ratlineVisible=!0):this._ratlineVisible=!1}routerEnd(t=!1,e=1){this.terminateWorker(),this._ratlineVisible&&(Pe.getRatlineLayer().visible=!0),this.manager.addCommand(this.historyGroup),this.historyGroup&&this.historyGroup.execute(),this.historyGroup=null,this.putLogs(t),this.state=2,this.updateProgress(e,this._curProgressTitle)}routerInterrupt(t){let e="",r=!1;if(typeof t=="string"?(e=t,r=!1):t&&(r=t.manual,e=t.message),r){this.terminateWorker(),this.toggleRouterState(2);return}e&&g0({type:"error",message:e,shortMsg:e}),this._ratlineVisible&&(Pe.getRatlineLayer().visible=!0),this.manager.clearPreview(),this.historyGroup&&this.historyGroup.undo(),this.historyGroup=null,this.putLogs(!0),this.state=2,this.updateProgress(1,this._curProgressTitle)}updateTracks(t,e){let r=this,i=this.manager.trackMap;t&&t.forEach(s=>{let a=s.id;n(a,s)});function n(s,a){if(i.contains(s)){console.error("Repeated item:",a);return}let l=r.getProLayer(a.layer),c=a.path,h=r.autoPangolinNum(a.width,e),u=null,d=null,p=[];for(let m=0;m<c.length;m++){let g=r.autoPangolinResPoint(c[m],e);if(!u||u.equals(g)){u=g;continue}else d=g;let y=r.manager.addTrack(l,u,d,h,!1,a.net);p.push(y),u=d}i.put(s,p)}}updateVias(t,e){let r=this,i=this.manager.viaMap;t&&t.forEach(s=>{let a=s.id;n(a,s)});function n(s,a){if(i.contains(s)){console.error("Repeated item:",a);return}let l=r.autoPangolinResPoint(a.location,e),[c,h]=[r.autoPangolinNum(a.size[0]/2,e),r.autoPangolinNum(a.size[1]/2,e)],u=r.manager.addVia(0,"",1,2,a.net,c,l,h,!1,1,null,null);i.put(s,u)}}updateProgress(t,e,r=!0){if(Q().location.search.includes("pcbdebug"))return;isNaN(t)&&(t=1,console.error("There has undesired number of progress: ",t));let i=!0;e=e||this._curProgressTitle||this.getProgressTitle(0),this._curProgressTitle&&this._curProgressTitle!=e&&A.publish("/pro-ui/progressUpdate",{progress:1,title:this._curProgressTitle},Q()),this._curProgressTitle=e,A.publish("/pro-ui/progressUpdate",{progress:t,title:e,closeFn:{messageTopic:"pcb/routerInterrupt",messageTopicData:{manual:!0},onlyInitiative:!0},showTitle:i},Q()),t>=1&&r&&this.toggleRouterState(2)}putLogs(t=!1){if(t)return;let e=0;this.manager.trackMap.iterator((r,i)=>(e+=i.length,!0)),setTimeout(()=>{g0({type:"info",message:"Auto routing completed! Add tracks: {0}, add vias: {1}, nets completion: {2}, use time: {3}s.",shortMsg:"Auto routing completed!",replace:{0:e.toString(),1:Object.keys(this.manager.viaMap.origin()).length.toString(),2:((1-Wo.getAllNets().length/Ye.getAllNets().length)*100).toFixed(2)+"%",3:((new Date().getTime()-this.startTime.getTime())/1e3).toFixed(2).toString()},timeout:3e3})},20)}transformRuleUnitToMM(t){for(let e in t)if(t.hasOwnProperty(e)){let r=t[e];e!=="layer"&&e!=="layers"&&(t[e]=ve(nn.convert(r*10,1,39.37),3))}}getPolylineOutline(t,e){let r=t.getMathGraphics(e);if(!r)return;let i;return r instanceof Bt?i=r.items[0]:i=r,i}getEllipsePadDiameter(t){let e=t.top,r=t.bottom,i=t.inner,n=[];if(e&&e.type==="ELLIPSE"&&n.push(e.width),r&&r.type==="ELLIPSE"&&n.push(r.width),i&&i.type==="ELLIPSE"&&n.push(i.width),n.length>0){let s=n.length>1?Math.max(...n):n[0];return ve(nn.convert(s*10,1,39.37),3)}}getFilterBoard(){return Au().filter(t=>!t.getParent())}getPinName(t,e,r){for(let i in t)if(t.hasOwnProperty(i)){let n=t[i];for(let s of n)if(s.designator===e&&s.pinName&&s.pinName[r]!==void 0)return s.pinName[r]}}getMatrixRes(){return this.matrixRes||this.getMatrix().matrixRes}extractPrefix(t,e){return t.startsWith(e)?t.substring(e.length):t}getFootprintNewOutlineByMatrix(t,e){let r=Qe.translate(-e.x,-e.y);return t.multiply3(r)}};var d$=new nn(10,39.37).ratio;async function eqe(o){let t=new Array,e=new Array,r=0,i={},n={},s=R.getInstance().origin,a=await JX();console.debug("components 2 model",a);let l=Ar.getAllItem();for(let g=0;g<l.length;g++){let y=l[g],b=y.attrKeyValue;if(y.layerId===1){let P=await h(y);t.push(P)}else e.push(await h(y));i[b["Supplier Part"]+","+b.Value]=c(y),A.publish("progressUpdate",[g/l.length,"smtUILoading"],Q())}return m();function c(g){let y=g.attrKeyValue,b={is_base:!0,proc:"SMT",mode:"smtWeld",lc_model:y["LCSC Part Name"],lc_pkg:y["Supplier Footprint"],lc_ma:null,t:"None",q:2,tv:"None",ta:"None",ba:"None",value:y.Value||"",Name:g.getFormulaName()||"",Supplier:y.Supplier||""};for(let P in y)P!="Name"&&P!="Unique ID"&&P!="Add into BOM"&&P!="Designator"&&P!="Device"&&P!="Footprint"&&P!="3D Model"&&P!="3D Model Title"&&P!="3D Model Transform"&&(b[P]=y[P]);return b}async function h(g){let y=g.attrKeyValue,b=y["3D Model"]||"",P=g.attrKeyValue["3D Model Transform"]||"0,0,0,0,0,0,0,0,0",{uuid:T,path:I}=_V(b),C=a[`${T}|${I}`]||b,E=Hi.getItem(g.footprintUUID).getOrigin(),O=new nn(10,1).ratio,{pins:_,bbox:x}=yk(n,g.footprintId,()=>{let V=0,W=Hi.getItem(g.footprintUUID),L=new _e;for(let[,N]of W.getItems()){let U=N==null?void 0:N.layerId;N instanceof Li&&N.key!=""||(N instanceof et?(V++,L.ext1(N.buildBBox())):(U===3||U===4)&&L.ext1(N.buildBBox()))}let k=L.valid()?L.build1():null;return{pins:V,bbox:k}});r++;let v=g.position.sub(s).mul(d$),D={},w=P&&P.trim().startsWith("v2:"),F="0,0,0,0,0,0,0,0,0";if(w){let V=(await A.windowBridge.rpcCall("/engine/loadModelAndV2ToV1",{uuid:C||"default_model",transformV2:P},Q())).message;V&&(F=`${V.dx},${V.dy},${V.dz},${V.rz},${V.rx},${V.ry},${V.x},${V.y},${V.z}`)}else F=P;let H=F.split(",").map(V=>parseFloat(V));D={uuid:C,dx:H[0]/10*O,dy:H[1]/10*O,dz:H[2]/10*O,rz:H[3],rx:H[4],ry:H[5],x:(H[6]/10-E.x)*O,y:(H[7]/10-E.y)*O,z:H[8]/10*O};let z=g.layerId===1?g.rotation:(3*Math.PI-g.rotation)%(2*Math.PI);return{model:D,pick_index:r,bom_index:r,deviceUuid:g.deviceUUID,des:y.Designator,ft_name:y.Footprint,ft_pins:_,cm:g.getFormulaName()||y.Device,lc_code:y["Supplier Part"]+","+y.Value,is_mount:!0,sel_mount:!1,source:"lceda-pro",ec:{x:v.x,y:v.y,ang:zt.toDegrees(z),dx:(x==null?void 0:x.width())*d$,dy:(x==null?void 0:x.height())*d$,cx:((x==null?void 0:x.center().x)-E.x)*d$,cy:((x==null?void 0:x.center().y)-E.y)*d$},oc:{x:`${v.x}mm`,y:`${v.y}mm`,rx:null,ry:null,px:null,py:null,ang:`${z}`}}}function u(){let g=Math.round(new Date().getTime());return{create_time:g,modify_time:g,modify_user:"lceda-pro",software:"",data_type:"ERP_ORDER_CREATOR",customer_code:R.getInstance().customerCode,pcb_order:"",board:o.board,pcb_name:o.pcbName,smt_order:"",version:1}}function d(){return{assembler_total_num:t.length+e.length,top_assembler_total_num:t.length,bot_assembler_total_num:e.length}}function p(){return{file_info:u(),check_info:d(),comp_info:i,designator_info:[{name:"default",x_datum:0,y_datum:0,mirror_x_datum:0,mirror_y_datum:0,set:[{name:"default",x_offset:0,y_offset:0,ang:0}],top:t,bottom:e}]}}function m(){let g=p();return JSON.stringify({sum:"1231313215456",data:JSON.stringify(g)})}}var JRt=new dt,mfe=class{constructor(){this.disable=!1}cut(t,e,r,i){let n=i.event,s=new Array;for(let u=0;u<i.lineArcs.length;u++){let d=i.lineArcs[u];d instanceof Vi||d instanceof cr?d.length>1e-8&&(i.lineArcs[u]=c(d)):s.push(d)}let a=new Array,l=new Array;for(let u=0;u<s.length;u++)if(s[u].length>1e-8){let d=[s[u]];for(l.push(s[u]);s[u+1]&&s[u].end.equals1(s[u+1].start);)d.push(s[u+1]),l.push(s[u+1]),u++;a.push(d)}else s[u].remove();if(n.cutSilkLines.length>0){let u=n.cutSilkLines[n.cutSilkLines.length-1],d=u[u.length-1];d instanceof Vi&&a.length>0&&a[0][0].start.equals1(d.end)&&(u.push(...a[0]),a.shift())}return n.cutSilkLines.push(...a),l;function c(u){if(!u)return;let d=u.start,p=[],m=new b8,g=u.buildBBox(),y=kt.searchByType(g,"Pad"),b,P,T=[];for(let C of y.pads){if(e===3&&![12,1].includes(C.layerId)||e===4&&![12,2].includes(C.layerId))continue;let E,O=JRt.conversion("mm","mil",.15)/10;if((e===3||e===4)&&(E=C.getMathGraphics(e===3?1:2),E=XP.zoomPolygon(E,O+u.width/2)),!E)continue;T.push(E);let _=E.primitives;for(let x=0;x<_.length;x++){let v=Pt(h(u),_[x]);if(v>0)for(let D=0;D<v;D+=2){let w=new S(Ee[D],Ee[D+1]);p.push(w)}}m.pointInPolyline(u.start,E)&&(b=!0),m.pointInPolyline(u.end,E)&&(P=!0)}p.sort((C,E)=>C.distance2(d)-E.distance2(d));let I=[];for(let C=0;C<p.length;C++){for(;p[C+1]&&p[C].equals1(p[C+1]);)C++;I.push(p[C])}if(p=I,p.length>0&&(e===3||e===4)){b||p.unshift(u.start),P||p.push(u.end);for(let C=0;C<p.length;C+=2)if(p[C+1]){if(!(!b&&C===0)){let _=new S(p[C].x-d.x,p[C].y-d.y),x=_.length(),v=_.normalize(),D=new S(v.x*x,v.y*x);p[C]=new S(D.x+d.x,D.y+d.y)}if(!(!P&&C+1===p.length-1)){let _=new S(p[C+1].x-d.x,p[C+1].y-d.y),x=_.length(),v=_.normalize(),D=new S(v.x*x,v.y*x);p[C+1]=new S(D.x+d.x,D.y+d.y)}let E=new S((p[C].x+p[C+1].x)/2,(p[C].y+p[C+1].y)/2),O=!1;for(let _=0;_<T.length;_++)if(m.pointInPolyline(E,T[_])){O=!0;break}!O&&p[C].distance2(p[C+1])>1e-8&&p[C].distance2(d)-p[C+1].distance2(d)<0&&s.push(Vi.build(t,p[C],p[C+1],u.width,r))}}else u.length>1e-8&&s.push(Vi.build(t,u.start,u.end,u.width,r));return u.remove(),s[s.length-1]}function h(u){if(u instanceof Vi||u instanceof es)return u.primitive;if(u instanceof cr)return new M(u.start,u.end);if(u instanceof gs)return q.build2(u.center,u.startAngle,u.endAngle,u.radius,u.radius,u.sweep)}}canCut(){return!this.disable&&we.autoTrimSilkscreen&&R.getInstance().doctype===pi.FOOTPRINT}};var gfe=class{constructor(){this.group=null;this.globalIndexs=[];this.succCallback=[];this.isToggleTool=!1;this.sideBaseLine=null}setGroup(t){this.group=t}addItem(t){let e=Array.isArray(t)?t:[t];this.globalIndexs.push(...e)}completed(){let t=this.sideBaseLine;t&&(this.updateItems(),this.succCallback.forEach(e=>e(t))),this.resetState()}getBaseLine(){return this.sideBaseLine}pushBaseLine(t){if(t instanceof lt&&t.type==="3D Shell - Side Datum Line"){this.sideBaseLine=t;return}this.sideBaseLine=null}addCallback(t){typeof t=="function"&&this.succCallback.push(t)}setOnceCallback(t){typeof t=="function"&&(this.succCallback.length=0,this.succCallback.push(t))}toggleTool(){if(this.isToggleTool)return;this.isToggleTool=!0,this.sideBaseLine=null;let t={command:"selectDatumLineWithRegion",msg:"Please select a Side Datum Line"};A.publish("toggle",t)}interrupt(){this.resetState(),this.sideBaseLine=null}resetState(){this.globalIndexs.length=0,this.succCallback.length=0,this.group=null,this.isToggleTool=!1}updateItems(){let t=this.sideBaseLine,e=new Jt;this.globalIndexs.forEach(r=>{let i=e.getItem(r);if(i instanceof He&&this.isD3ShellSlotOrEntity(i.type)){let n=i.getComponent(),s=n.lineId,a=this.isD3ShellSlot(i.type);this.isTopBottomType(i.type)&&(i.type=a?"3D Shell - Side Slot Region":"3D Shell - Side Entity",i.refreshStyle()),n=i.getComponent(),n.type=a?"Side":"side",n.lineId=t.globalIndex,La.getInstance().delConnectRelatedId(s,r),La.getInstance().addConnectRelatedId(t.globalIndex,r)}}),this.group instanceof De&&qe.executeCommand(this.group),A.publish("updateFrame","")}isD3ShellSlot(t){return t==="3D Shell - Top Slot Region"||t==="3D Shell - Side Slot Region"}isTopBottomType(t){return t==="3D Shell - Top Slot Region"||t==="3D Shell - Top/Bottom Entity"}isD3ShellSlotOrEntity(t){return t==="3D Shell - Top Slot Region"||t==="3D Shell - Side Slot Region"||t==="3D Shell - Top/Bottom Entity"||t==="3D Shell - Side Entity"}};var yfe=class extends yh{constructor(){super(...arguments);this.mgr=_p.getInstance()}addControllerCache(e){kt.insert(e)}addImage(e,r,i,n,s,a,l,c){let h=nr();e=VY(e);let u=_p.getInstance().addImage(h,e,r,i,n,s,a,l,c),d=new Ps(u);return this.addControllerCache(d),d}addImageByModel(e,r=!1){if(r){let n=e.globalIndex;_p.getInstance().getItem(n)==e&&_p.getInstance().delete(e,n),e.globalIndex=nr(),_p.getInstance().addModel(e)}let i=new Ps(e);return this.addControllerCache(i),i}rebuild(e,r,i,n,s,a,l,c,h){r=VY(r);let u=_p.getInstance().addImage(e,r,i,n,s,a,l,c,h),d=new Ps(u);return this.addControllerCache(d),d}copy(e){let{globalIndex:r,layerId:i,start:n,width:s,height:a,rotation:l,mirror:c,locked:h,hashId:u}=e;n=new S(n.x,n.y);let d=r.slice(0,-16)+nr();return this.rebuild(d,i,n,s,a,l,c,h,u)}delete(e){if(e instanceof Ps){let r=e.globalIndex;_p.getInstance().delete(e.model,r)}}};function p$(o){let t=Ze.getInstance().getLayer(o);R.getInstance().compiler.uploadSilkOpts(o,Sr.getInstance().encode("SILK_OPTS",t))}var bfe=class extends kl{constructor(){super(...arguments);this.tool=null;this.wiringRouterParam=Ha.getInstance()}set(){return this}getTool(){return this.tool}setTool(e){this.tool=e}get isFootPrint(){return R.getInstance().doctype===4}getHtmlData(){this.attrlist==null&&(this.attrlist={},this.idList=["canvas"]);let e=this.attrlist,r=new dt;(e["attr-id"]==null||e["attr-id"].value!=Ve)&&(e["attr-id"]={title:"ID",value:"canvas"}),(e["attr-coosys-type"]==null||e["attr-coosys-type"].value!=Ve)&&(e["attr-coosys-type"]={title:"Coordinate System Type",value:It.getInstance().currentCoord?1:2}),(e["attr-unit"]==null||e["attr-unit"].value!=Ve)&&(e["attr-unit"]={title:"Unit",value:R.getInstance().unit,options:[{value:"mil",text:"mil"},{value:"mm",text:"mm"}]}),(e["attr-grid-type"]==null||e["attr-grid-type"].value!=Ve)&&(e["attr-grid-type"]={title:"Grid Type",value:we.gridType,options:[{value:"grid",text:"Grid"},{value:"outlets",text:"Grid Dot"},{value:"none",text:"None"}]}),(e["attr-multi-grid-type"]==null||e["attr-multi-grid-type"].value!=Ve)&&(e["attr-multi-grid-type"]={title:"Bold Grid Type",value:we.multiType,options:[{value:"grid",text:"Grid"},{value:"outlets",text:"Grid Dot"},{value:"none",text:"None"}]}),(e["attr-multi-grid-ratio"]==null||e["attr-multi-grid-ratio"].value!=Ve)&&(e["attr-multi-grid-ratio"]={title:"Bold Grid Ratio",value:we.multiRatio});let i=r.conversion1("mil",R.getInstance().unit,It.getInstance().getGridX()*10),n=r.conversion1("mil",R.getInstance().unit,It.getInstance().getGridY()*10);(e["attr-grid-size"]==null||e["attr-grid-size"].value!=Ve)&&(e["attr-grid-size"]={title:"Grid Size",value:i==n?i:`${i},${n}`}),(e["attr-polar-angle-step"]==null||e["attr-polar-angle-step"].value!=Ve)&&(e["attr-polar-angle-step"]={title:"Grid Size",value:gn(vL(It.getInstance().angleDelta),1,!0)});let s=R.getInstance().unit,a=r.conversion("mil",R.getInstance().unit,It.getInstance().radius);(e["attr-polar-radiu-step"]==null||e["attr-polar-radiu-step"].value!=Ve)&&(e["attr-polar-radiu-step"]={title:"Grid Size",value:s==="mm"?gn(a*10,3):gn(a*10,1)});let l=r.conversion1("mil",R.getInstance().unit,It.getInstance().getSnapX()*10),c=r.conversion1("mil",R.getInstance().unit,It.getInstance().getSnapY()*10);(e["attr-snap-size"]==null||e["attr-snap-size"].value!=Ve)&&(e["attr-snap-size"]={title:"Snap Size",value:l==c?l:`${l},${c}`});let h=R.getInstance().altGridSize,u=r.conversion1(h.GridX.unit,R.getInstance().unit,h.GridX.number),d=r.conversion1(h.GridY.unit,R.getInstance().unit,h.GridY.number);(e["attr-alt-grid-size"]==null||e["attr-alt-grid-size"].value!=Ve)&&(e["attr-alt-grid-size"]={title:"Alt Snap Size",value:u==d?u:`${u},${d}`}),(e["attr-snap"]==null||e["attr-snap"].value!=Ve)&&(e["attr-snap"]={title:"Snap",value:we.adsorb?"yes":"no"}),this.isFootPrint||(e["attr-start-track-width"]==null||e["attr-start-track-width"].value!=Ve)&&(e["attr-start-track-width"]={title:"Start Track Width",value:le.pcbConfig.startTrackWidth,options:[{text:"Follow Rule",value:"rule"},{text:"Customize",value:"last"}]});let p;if(this.isFootPrint?p=we.prevTrackWidth:this.tool instanceof vo?p=this.tool.getWireWidth():(this.tool instanceof hc||this.tool instanceof cC||this.tool instanceof lC||this.tool instanceof hC||this.tool instanceof Vh||this.tool instanceof Ac)&&(p=le.pcbConfig.startTrackWidth=="rule"?this.wiringRouterParam.getTrackWidth(1).value:we.prevTrackWidth),p==null&&(p=this.wiringRouterParam.getTrackWidth(1).value),(e["attr-track-width"]==null||e["attr-track-width"].value!=Ve)&&(e["attr-track-width"]={title:"Track Width",value:r.conversion1("mil",R.getInstance().unit,p*10),disabled:R.getInstance().doctype==3&&!we.drawing&&le.pcbConfig.startTrackWidth=="rule"}),!this.isFootPrint){(e["attr-start-via-size"]==null||e["attr-start-via-size"].value!=Ve)&&(e["attr-start-via-size"]={title:"Start Via Size",value:le.pcbConfig.startViaSize,options:[{text:"Follow Rule",value:"rule"},{text:"Customize",value:"last"}]});let m,g;if(we.drawing&&(this.tool instanceof w1||this.tool instanceof U2)){let P=this.tool.getViaRadius();m=P.radius,g=P.innerRadius}else if(this.tool instanceof vo){let P=this.tool.getViaRadius();m=P.radius,g=P.innerRadius}else m=this.wiringRouterParam.getViaOutsideDiameter().value/20,g=this.wiringRouterParam.getViaInsideDiameter().value/20;(e["attr-via-outside-diameter"]==null||e["attr-via-outside-diameter"].value!=Ve)&&(e["attr-via-outside-diameter"]={title:"Via Outside Diameter",value:r.conversion1("mil",R.getInstance().unit,m*20),disabled:!we.drawing&&le.pcbConfig.startViaSize=="rule"}),(e["attr-via-inside-diameter"]==null||e["attr-via-inside-diameter"].value!=Ve)&&(e["attr-via-inside-diameter"]={title:"Via Inside Diameter",value:r.conversion1("mil",R.getInstance().unit,g*20),disabled:!we.drawing&&le.pcbConfig.startViaSize=="rule"}),(e["attr-routing-mode"]==null||e["attr-routing-mode"].value!=Ve)&&(e["attr-routing-mode"]={title:"Routing Mode",value:Zt.getInstance().mode,options:[{value:"WIRING_MODE_PUSHAWAY",text:"Push"},{value:"WIRING_MODE_SURROUND_AND_PUSHAWAY",text:"Around & Push"},{value:"WIRING_MODE_SURROUND",text:"Around"},{value:"WIRING_MODE_OBSTRUCT",text:"Block"},{value:"WIRING_MODE_IGNORE",text:"Ignore"}]}),(e["attr-routing-pushVia"]==null||e["attr-routing-pushVia"].value!=Ve)&&(e["attr-routing-pushVia"]={title:"Push Via",value:this.wiringRouterParam.getPushVia(),options:[{value:"OPTIMIZA_OPEN",text:"On"},{value:"OPTIMIZA_NONE",text:"Off"}]}),(e["attr-routing-pathOptimization4BePushed"]==null||e["attr-routing-pathOptimization4BePushed"].value!=Ve)&&(e["attr-routing-pathOptimization4BePushed"]={title:"Be Pushed Track Path Optimization",value:this.wiringRouterParam.getPathOptimization4BePushed(),options:[{value:0,text:"Individual Segment"},{value:1,text:"Full Routing"},{value:2,text:"None"}]}),(e["attr-routing-currentPathOptimization"]==null||e["attr-routing-currentPathOptimization"].value!=Ve)&&(e["attr-routing-currentPathOptimization"]={title:"Current Track Path Optimization",value:this.wiringRouterParam.getCurrentPathOptimization(),options:[{value:"OPTIMIZA_STRONG",text:"Strong"},{value:"OPTIMIZA_WEAK",text:"Weak"},{value:"OPTIMIZA_NONE",text:"Off"}]}),(e["attr-remove-loop"]==null||e["attr-remove-loop"].value!=Ve)&&(e["attr-remove-loop"]={title:"Remove Loop",value:this.wiringRouterParam.getRemoveLoop().value});let y=this.wiringRouterParam.getRemoveLoop().removeLoopOptions[0];(e["attr-remove-circuits-containing-vias"]==null||e["attr-remove-circuits-containing-vias"].value!=Ve)&&(e["attr-remove-circuits-containing-vias"]={title:"Remove Loops With Vias",value:y.value});let b=this.wiringRouterParam.getRemoveLoop().removeLoopOptions[1];(e["attr-remove-antenna"]==null||e["attr-remove-antenna"].value!=Ve)&&(e["attr-remove-antenna"]={title:"Remove Antenna",value:b.value}),(e["attr-copper-region"]==null||e["attr-copper-region"].value!=Ve)&&(e["attr-copper-region"]={title:"Hide Copper Region",value:this.wiringRouterParam.getHideCopper()})}return(e["attr-rotating-object"]==null||e["attr-rotating-object"].value!=Ve)&&(e["attr-rotating-object"]={title:"Rotation Objects",value:le.pcbConfig.rotateWhole,options:[{text:"Rotate Single Object",value:"single"},{text:"Rotate the Selected Whole",value:"whole"}]}),(e["attr-track-follow"]==null||e["attr-track-follow"].value!=Ve)&&(e["attr-track-follow"]={title:"Move Footprint The Wire Follows",value:le.pcbConfig.trackFollow,options:[{text:"Yes",value:"moveKeep"},{text:"No",value:"moveDisconnect"}]}),(e["attr-track-minimum-corner"]==null||e["attr-track-minimum-corner"].value!=Ve)&&(e["attr-track-minimum-corner"]={title:"Minimum Track Corners",value:this.wiringRouterParam.getTrackMinCorner()}),(e["attr-auto-trim-silkscreen"]==null||e["attr-auto-trim-silkscreen"].value!=Ve)&&(e["attr-auto-trim-silkscreen"]={title:"Auto Cut Silkscreen",value:we.autoTrimSilkscreen?"yes":"no"}),(e["attr-top-side-board-color"]==null||e["attr-top-side-board-color"].value!=Ve)&&(e["attr-top-side-board-color"]={title:"Top Side Board Color",value:we.topBoardColor}),(e["attr-bottom-side-board-color"]==null||e["attr-bottom-side-board-color"].value!=Ve)&&(e["attr-bottom-side-board-color"]={title:"Bottom Side Board Color",value:we.bottomBoardColor}),(e["attr-top-side-silkscreen-color"]==null||e["attr-top-side-silkscreen-color"].value!=Ve)&&(e["attr-top-side-silkscreen-color"]={title:"Top Side Silkscreen Color",value:we.topSilkscreenColor}),(e["attr-bottom-side-silkscreen-color"]==null||e["attr-bottom-side-silkscreen-color"].value!=Ve)&&(e["attr-bottom-side-silkscreen-color"]={title:"Bottom Side Silkscreen Color",value:we.bottomSilkscreenColor}),(e["attr-range"]==null||e["attr-range"].value!=Ve)&&(e["attr-range"]={title:"Highlight",value:{explodeRatio:R.getInstance().forceValue}}),this}modifyBy(e){let r=new dt;for(let i in e){let n=e[i];switch(i){case"attr-id":break;case"attr-unit":{eC(n);break}case"attr-grid-type":{A.messageBus.publish("switchGridType",n),A.publish("switchGridTypeBtn",n,Q());break}case"attr-multi-grid-type":{A.messageBus.publish("switchMultiGridType",n);break}case"attr-multi-grid-ratio":{A.messageBus.publish("switchMultiGridRatio",n);break}case"attr-polar-mixin-step":{let s=n.split(",")[0],a=n.split(",")[1],l=parseFloat(s),c=parseFloat(a)/10;typeof a>"u"&&(c=l);let h=dBe(l);c=r.conversion(R.getInstance().unit,"mil",c);let u=It.getInstance().angleDelta,d=It.getInstance().radius;if(u===h&&d===c)break;It.getInstance().angleDelta=h,It.getInstance().radius=c,np();break}case"attr-grid-size":case"attr-snap-size":case"attr-alt-grid-size":{let s=n.toString().split(/,|，/),a,l;if(s.length==1?a=l=parseFloat(s[0]):s.length==2&&(a=parseFloat(s[0]),l=parseFloat(s[1])),a==null||l==null||isNaN(a)||isNaN(l))return;let c=le.getAssociationPCBCanvasGridAndSnap()===1,h=c?qS():{xRatio:1,yRatio:1},u=r.conversion(R.getInstance().unit,"mil",a)/10,d=r.conversion(R.getInstance().unit,"mil",l)/10;if(i=="attr-grid-size")It.getInstance().setGridX(oo(u)),It.getInstance().setGridY(oo(d)),c&&(It.getInstance().setSnapX(oo(u/h.xRatio)),It.getInstance().setSnapY(oo(d/h.yRatio)));else if(i=="attr-snap-size")It.getInstance().setSnapX(oo(u)),It.getInstance().setSnapY(oo(d)),c&&(It.getInstance().setGridX(oo(u*h.xRatio)),It.getInstance().setGridY(oo(d*h.yRatio)));else if(i=="attr-alt-grid-size"){let p={GridX:{number:a,unit:R.getInstance().unit},GridY:{number:l,unit:R.getInstance().unit}};R.getInstance().altGridSize=p}np();break}case"attr-snap":{A.publish("toggleAdsorb",n=="yes");break}case"attr-start-track-width":{this.wiringRouterParam.setStartTrackWidth(n),(this.tool instanceof hc||this.tool instanceof cC||this.tool instanceof lC||this.tool instanceof hC||this.tool instanceof Vh||this.tool instanceof Ac)&&this.tool.setWireWidth(this.wiringRouterParam.getTrackWidth().value),wi();break}case"attr-track-width":{if(+n<=0)return;let s=r.conversion(R.getInstance().unit,"mil",n)/10;s>=vc&&(this.tool instanceof hc||this.tool instanceof cC||this.tool instanceof lC||this.tool instanceof hC||this.tool instanceof Vh||this.tool instanceof Ac?(this.tool.setWireWidth(s),we.prevTrackWidth=s):this.wiringRouterParam.setTrackWidth(s*10),wi());break}case"attr-start-via-size":{if(this.isFootPrint)break;this.tool instanceof vo||(this.wiringRouterParam.setStartViaSize(n),n=="rule"&&(this.tool instanceof w1||this.tool instanceof U2)&&this.tool.updateViaRadius()),wi();break}case"attr-via-outside-diameter":case"attr-via-inside-diameter":{if(this.isFootPrint)break;if(+n<=0)return;let s=r.conversion(R.getInstance().unit,"mil",n)/20;s>=vc/2&&(this.tool instanceof w1||this.tool instanceof U2?i=="attr-via-inside-diameter"?this.tool.modifyViaSize(s,this.tool.getViaRadius().radius,!1):this.tool.modifyViaSize(this.tool.getViaRadius().innerRadius,s,!1):ut.setDefaultVia({net:null,holeRadius:i=="attr-via-inside-diameter"?s:null,radius:i=="attr-via-outside-diameter"?s:null}),wi());break}case"attr-routing-mode":{if(this.isFootPrint)break;this.tool instanceof vo?this.tool.wireMode(n):this.wiringRouterParam.setRoutingMode(n),wi();break}case"attr-routing-pushVia":{if(this.isFootPrint)break;this.wiringRouterParam.setPushVia(n,!0);break}case"attr-routing-pathOptimization4BePushed":{if(this.isFootPrint)break;this.wiringRouterParam.setPathOptimization4BePushed(n,!0);break}case"attr-routing-currentPathOptimization":{if(this.isFootPrint)break;this.wiringRouterParam.setCurrentPathOptimization(n,!0);break}case"attr-remove-loop":{if(this.isFootPrint)break;A.publish("removeLoop",n=="yes");break}case"attr-remove-circuits-containing-vias":{if(this.isFootPrint)break;this.wiringRouterParam.setRemoveLoop(n,"Remove Circuits Containing Vias",!0);break}case"attr-remove-antenna":{if(this.isFootPrint)break;this.wiringRouterParam.setRemoveLoop(n,"Remove Antenna",!0);break}case"attr-copper-region":{if(this.isFootPrint)break;this.wiringRouterParam.setHideCopper(n,!0);break}case"attr-rotating-object":{le.pcbConfig.rotateWhole=n,wi();break}case"attr-track-follow":{le.pcbConfig.trackFollow=n,wi();break}case"attr-track-minimum-corner":{this.wiringRouterParam.setTrackMinCorner(n,!0);break}case"attr-auto-trim-silkscreen":{we.autoTrimSilkscreen=n=="yes",wi();break}case"attr-top-side-board-color":{we.topBoardColor=n,p$(3),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q());break}case"attr-top-side-silkscreen-color":{we.topSilkscreenColor=n,p$(3),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q());break}case"attr-bottom-side-board-color":{we.bottomBoardColor=n,p$(4),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q());break}case"attr-bottom-side-silkscreen-color":{we.bottomSilkscreenColor=n,p$(4),A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q());break}case"attr-range":{n!=null&&!isNaN(n)&&A.publish("highlightValue",n);break}default:throw Error("Unexpected key for canvas html")}}}};var Pfe=class{constructor(){A.subscribe("checkRemoveAllPlane",this.checkRemoveAllPlane.bind(this))}checkRemoveAllPlane(){let t=qe.stack;if(!t||!t.commands.some(a=>a instanceof pg))return;let e=zn.getAllItem();if(e.length<=0)return;let r=Xt.getAllItem(),i=Kt.getAllItem(),n=pt.getAllItem();[].concat(r,i,n).filter(a=>a instanceof He&&(a.type=="Board Outline"||a.type=="Line"&&a.layerId==11)).length>0||e.forEach(a=>{t.addCommand(Ce.dispatch(a,"delete")),a.remove(),A.publish("hasModifyPcbItem",a),A.publish("delete",a)})}};var Tfe=class{constructor(){this.hotkeys={}}addSubMenu(t,e,r){this.hotkeys[t]={hotkey:e,menuCmd:r}}restore(){this.hotkeys={}}getMenuHotkeyConfigInfo(t){return this.hotkeys[t]}};var jOe=["Track","ArcTrack","Pad","Via","Polygon","Circle","Rect","Copper"],Ife=class{constructor(t=!0){this.checkMap=new Map;this.result=new Map;this.toBeCheckMap=new Map;this.filter=new gd;this.check=new TS;this.filterPlane=!1;this.filter.whetherCheckNet=t}update(t){this.checkMap=new Map;for(let e of t)if(e instanceof ke){let r=e.getPads();for(let n=0;n<r.length;n++)this.updateNode(r[n]);let i=e.getVias();for(let n=0;n<i.length;n++)this.updateNode(i[n])}else this.updateNode(e)}updateLoopTypeConnect(t){this.checkMap=new Map;for(let e of t)(e instanceof Ge||e instanceof Le||e instanceof Ue)&&this.updateLoopNode(e)}getMap(){let t=new Array;for(let[,e]of this.toBeCheckMap)for(let[,r]of e)t.push([r[0].model,r[1].model]);return t}sycnResult(t){for(let[e,r]of t){this.result.get(e)==null&&this.result.set(e,new Map);for(let[i,n]of r)this.result.get(e).set(i,n)}}getResult(){return this.result}updateLoopNode(t){if(!(t instanceof Qo)||t.isEmpty)return;let e=this.searchNode(t);for(let r of e)if(r&&r instanceof Qo&&r!=t&&!this.checkConnect(t,r)&&this.filter.needCheckIntersection(t.model,r.model)){let i=this.check.isConnect(t.model,r.model);i||this.add2BeCheckMap(t,r),this.add2Result(t,r,i),this.addCheckMap(t,r)}}searchNode(t){if(t==null||t.isEmpty)return[];if(t instanceof Le)return this.searchPadAndViaCycleNode(t);if(t instanceof Ue)return this.searchPadAndViaCycleNode(t);if(t instanceof Ge){let e;return t instanceof Ir?e=Lc.trackToOctagon(t.start,t.end,t.width):t instanceof yi&&(e=t.buildBBox()),this.searchAbstractTrackCycleNode(e,t)}return[]}searchPadAndViaCycleNode(t){return kt.conditionSearch(t.buildBBox(),e=>{let r=e.item;return!!(!r.isEmpty&&r!=t&&r instanceof Ge&&this.filter.needCheckIntersection(r.model,t.model))},(e,r)=>{switch(r){case"Track":case"ArcTrack":{if(t instanceof Ue){if(t.isContains(e))return!0}else if(t.layerId==12||e==t.layerId)return!0;return!1}default:return!1}}).getTracks()}searchAbstractTrackCycleNode(t,e){return kt.conditionSearch(t,r=>{let i=r.item;return i instanceof Qo&&i.net==e.net},(r,i)=>{switch(i){case"Track":case"ArcTrack":return r==e.layerId;case"Via":return!0;case"Pad":return r==12||r==e.layerId}return!1}).getTPV()}updateNode(t){if(!(t instanceof Qo)||t.isEmpty)return;let e=this.search(t).getConnectNodes();for(let r of e)if(!(this.filterPlane&&r instanceof Qp)&&r&&r instanceof Qo&&r!=t&&!this.checkConnect(t,r)&&this.filter.needCheckIntersection(t.model,r.model)){let i=this.check.isConnect(t.model,r.model);i||this.add2BeCheckMap(t,r),this.add2Result(t,r,i),this.addCheckMap(t,r)}}getBBox(t){return t instanceof Ir?Lc.trackToOctagon(t.start,t.end,t.width):t.buildBBox()}search(t){let e=t.buildBBox();if(e==null)return new iR;if(t instanceof Le){let r;return t.layerId==12?r=(i,n)=>n=="Track"||n=="ArcTrack"||n=="Via"||n=="Pad"?!0:n=="Polygon"||n=="Circle"||n=="Rect"||n=="Copper"?!!(i!=12&&Ud(i)):!1:r=(i,n)=>(n=="Track"||n=="ArcTrack")&&i==t.layerId||(i==12||i==t.layerId)&&(n=="Via"||n=="Pad")?!0:n=="Polygon"||n=="Circle"||n=="Rect"||n=="Copper"?i==t.layerId:!1,kt.search4Types(e,jOe,r)}else if(t instanceof Ue){let r=(i,n)=>(n=="Track"||n=="ArcTrack")&&t.isContains(i)||(i==12||t.isContains(i))&&(n=="Via"||n=="Pad")?!0:n=="Polygon"||n=="Circle"||n=="Rect"||n=="Copper"?!!t.isContains(i):!1;return kt.search4Types(e,jOe,r)}else if(t instanceof Ge){let r=this.getBBox(t),i=(n,s)=>(s=="Track"||s=="ArcTrack")&&t.layerId==n||s=="Pad"&&(n==12||n==t.layerId)||s=="Via"?!0:s=="Polygon"||s=="Circle"||s=="Rect"||s=="Copper"?n==t.layerId:!1;return kt.search4Types(r,jOe,i)}else return kt.search(e)}checkConnect(t,e){if(t.globalIndex<e.globalIndex){let r=this.checkMap.get(t.globalIndex);if(r!=null)return r.get(e.globalIndex)!=null}else{let r=this.checkMap.get(e.globalIndex);if(r!=null)return r.get(t.globalIndex)!=null}return!1}addCheckMap(t,e){let{globalIndex:r}=t,{globalIndex:i}=e;if(r>i){let n=i;i=r,r=n}this.checkMap.get(r)==null&&this.checkMap.set(r,new Map),this.checkMap.get(r).set(i,!0)}add2Result(t,e,r){let{globalIndex:i}=t,{globalIndex:n}=e;if(i>n){let s=n;n=i,i=s}this.result.get(i)==null&&this.result.set(i,new Map),this.result.get(i).set(n,r)}add2BeCheckMap(t,e){let{globalIndex:r}=t,{globalIndex:i}=e;if(r>i){let n=i;i=r,r=n}this.toBeCheckMap.get(r)==null&&this.toBeCheckMap.set(r,new Map),this.toBeCheckMap.get(r).set(i,[t,e])}clear(){this.checkMap=new Map,this.result=new Map,this.toBeCheckMap=new Map}getFilterWhetherCheckNet(){return this.filter.whetherCheckNet}changeFilterWhetherCheckNet(t){this.filter.whetherCheckNet=t}};var Cfe=class{constructor(){this.notAsking=!1;this.moveWhole=!0}init(t,e,r){this.items=t||[],this.action=r,this.commandFactory=e,this.padsOfComponent=this.items.some(i=>i instanceof Le&&i.getParent()instanceof ke),this.padsOfComponent?this.notAsking?this.execute(this.moveWhole):A.publish("openMainDialog",{cmd:39,data:{option:{moveWhole:this.moveWhole}}}):this.action(this.items,this.commandFactory)}execute(t){this.moveWhole=t,this.action(this.items,this.commandFactory),this.interrupt()}interrupt(){this.action=null}};var XOe=!1,qOe=0,Sfe=class o{constructor(){this.restrictLength=XOe;this.additionalLength=qOe;this.subscribe("INIT_PCB_CONFIG",this.initConfig.bind(this)),this.subscribe("UPDATE_PCB_CONFIG",this.updateConfig.bind(this))}static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}subscribe(t,e){A.subscribe(t,e)}initConfig(t){this.config=t,this.restrictLength=XOe,this.additionalLength=qOe}updateConfig(t){let{config:e,others:r}=t;e&&(this.config=e),r&&(this.restrictLength=r.restrictLength||XOe,this.additionalLength=r.additionalLength||qOe)}getSnakeTrackToolConfig(){let t=this.config.EQUAL_LENGTH_TUNING;return t?{...t,restrictLength:this.restrictLength,additionalLength:this.additionalLength}:{}}getDiffPairSnakeTrackToolConfig(){let t=this.config.DIFF_PAIR_EQUAL_LENGTH_TUNING;return t?{...t,restrictLength:this.restrictLength,additionalLength:this.additionalLength}:{}}getPcbReaTimeDRC(){return this.config.PCB_REALTIME_DRC||{}}};var XD=class o extends fI{constructor(){super(),this.params=UG.getInstance()}static getInstance(){return o.instance==null&&(o.instance=new o),o.instance}createHeader(t){let e=this.createBaseHeader();return e.id=t,e.action=t,e.tabId=R.getInstance().tabId,e}createBody(...t){return{glossMode:{mode:this.params.glossMode},glossOption:{pushTrack:this.params.pushTrack},trackCanvas:this.createCanvas()}}handleHeaderUpdate(...t){}handleBodyUpdate(t,e){this.params.glossMode=e.glossMode.mode,this.params.pushTrack=e.glossOption.pushTrack,this.updateCanvas(e.trackCanvas)}createCanvas(){let t={},e=Ha.getInstance();return t.unit=e.getUnit(),t.gridType=e.getGridType(),t.blodGridType=e.getBlodGridType(),t.blodGridRatio=e.getBlodGridRatio(),t.gridSize=e.getGridSize(),t.snapSize=e.getSnapSize(),t.snap=e.getSnap(),t.altSnapSize=e.getAltSnapSize(),t}updateCanvas(t){let{unit:e,gridType:r,blodGridType:i,blodGridRatio:n,gridSize:s,snapSize:a,snap:l,altSnapSize:c}=t,h=Ha.getInstance(),u=h.getUnit(),d=h.getGridType(),p=h.getBlodGridType(),m=h.getBlodGridRatio(),g=String(h.getGridSize()),y=String(h.getSnapSize()),b=h.getSnap().value,P=h.getAltSnapSize(),T=!1;e!==u&&(T=!0,h.setUnit(e)),r!==d&&(T=!0,h.setGridType(r)),i!==p&&(T=!0,h.setBlodGridType(i)),n!==m&&(T=!0,h.setBlodGridRatio(n)),s!==g&&(T=!0,this.updateCanvasGirdSnap("attr-grid-size",s)),a!==y&&(T=!0,this.updateCanvasGirdSnap("attr-snap-size",a)),l.value!==b&&(T=!0,h.setSnap(l.value)),c!==P&&(T=!0,this.updateCanvasGirdSnap("attr-alt-grid-size",c)),T&&np()}updateCanvasGirdSnap(t,e){let r=Ha.getInstance(),i=e.toString().split(/,|，/),n,s;i.length==1?n=s=parseFloat(i[0]):i.length==2&&(n=parseFloat(i[0]),s=parseFloat(i[1])),!(isNaN(n)||isNaN(s))&&(t=="attr-grid-size"?r.setGridSize(n,s):t=="attr-snap-size"?r.setSnapSize(n,s):t=="attr-alt-grid-size"&&r.setAltSnapSize(n,s))}};var Efe=class{constructor(){this.isUnmounted=!1;this._type=null,this._ui2PCBAboutAttrDataUpdateTimer=null,he.subscribe("FlushSketcherAttrView",this.flushSketcherAttrView.bind(this)),he.subscribe("ExitSketcherAttrView",this.exitSketcherAttrView.bind(this)),he.subscribe("UI2PCBAboutAttrDataUpdate",this.ui2PCBAboutAttrDataUpdate.bind(this))}get type(){return this._type}set type(t){this._type=t}flushSketcherAttrView(t){var s;this.isUnmounted=!1;let e=t.type,r=!!t.isInitAllParams,i=(s=t.switchTab)!=null?s:!1,n={};switch(this.type=e,this.type){case"DIST_MEASURE":{n.header=hu.getInstance().createHeader("DIST_MEASURE"),n.body=hu.getInstance().createBody(r);let a=n.body.startTarget.allElements,l=n.body.endTarget.allElements;n.body.startTarget.allElements=[],n.body.endTarget.allElements=[],n.body=Ss(n.body),hu.getInstance().correct(a,l);break}case"SINGLE_WIRE":{n.header=Ys.getInstance().createHeader("SINGLE_WIRE"),n.body=Ys.getInstance().createBody("SINGLE_WIRE"),n.body=Ss(n.body);break}case"DIFF_WIRE":{n.header=Ys.getInstance().createHeader("DIFF_WIRE"),n.body=Ys.getInstance().createBody("DIFF_WIRE"),n.body=Ss(n.body);break}case"MULTI_WIRE":{n.header=Ys.getInstance().createHeader("MULTI_WIRE"),n.body=Ys.getInstance().createBody("MULTI_WIRE"),n.body=Ss(n.body);break}case"TRACK_OPTIMIZATION":{n.header=XD.getInstance().createHeader("TRACK_OPTIMIZATION"),n.body=XD.getInstance().createBody(),n.body=Ss(n.body);break}case"COPY_SPECIAL":{n.header=zo.getInstance().createHeader("COPY_SPECIAL"),n.body=zo.getInstance().createBody(),n.body=Ss(n.body);break}case"PASTE":{if(a0.getInstance().isUnmounted)break;n.header=a0.getInstance().createHeader("PASTE"),n.body=a0.getInstance().createBody("PASTE"),n.body=Ss(n.body);break}}n.header&&(n.header.switchTab=i,he.publish("PCB2UIAboutRenderSketcherAttrView",n,Q()))}ui2PCBAboutAttrDataUpdate(t){this.isUnmounted||(window.clearTimeout(this._ui2PCBAboutAttrDataUpdateTimer),this._ui2PCBAboutAttrDataUpdateTimer=window.setTimeout(()=>{let{header:e,body:r}=t;if(e.tabId===R.getInstance().tabId)switch(e.action){case"DIST_MEASURE":{hu.getInstance().handleHeaderUpdate(e),hu.getInstance().handleBodyUpdate(r),he.publish("FlushSketcherAttrView",{type:"DIST_MEASURE"});break}case"SINGLE_WIRE":{Ys.getInstance().handleHeaderUpdate(e),Ys.getInstance().handleBodyUpdate("SINGLE_WIRE",r),he.publish("FlushSketcherAttrView",{type:"SINGLE_WIRE"});break}case"DIFF_WIRE":{Ys.getInstance().handleHeaderUpdate(e),Ys.getInstance().handleBodyUpdate("DIFF_WIRE",r),he.publish("FlushSketcherAttrView",{type:"DIFF_WIRE"});break}case"MULTI_WIRE":{Ys.getInstance().handleHeaderUpdate(e),Ys.getInstance().handleBodyUpdate("MULTI_WIRE",r),he.publish("FlushSketcherAttrView",{type:"MULTI_WIRE"});break}case"TRACK_OPTIMIZATION":{XD.getInstance().handleHeaderUpdate(e),XD.getInstance().handleBodyUpdate("TRACK_OPTIMIZATION",r),he.publish("FlushSketcherAttrView",{type:"TRACK_OPTIMIZATION"});break}case"COPY_SPECIAL":{zo.getInstance().handleHeaderUpdate(e),zo.getInstance().handleBodyUpdate(r,e),he.publish("FlushSketcherAttrView",{type:"COPY_SPECIAL"});break}case"PASTE":{a0.getInstance().handleHeaderUpdate(e),a0.getInstance().handleBodyUpdate("PASTE",r),he.publish("FlushSketcherAttrView",{type:"PASTE"});break}}}))}exitSketcherAttrView(t){this.exit();let e=t.type,r={};switch(e){case"DIST_MEASURE":{r.header=hu.getInstance().createHeader("DIST_MEASURE"),r.body=null,hu.getInstance().distMeasureParams.reset();break}case"SINGLE_WIRE":{r.header=Ys.getInstance().createHeader("SINGLE_WIRE"),r.body=null;break}case"DIFF_WIRE":{r.header=Ys.getInstance().createHeader("DIFF_WIRE"),r.body=null;break}case"MULTI_WIRE":{r.header=Ys.getInstance().createHeader("MULTI_WIRE"),r.body=null;break}case"TRACK_OPTIMIZATION":r.header=XD.getInstance().createHeader("TRACK_OPTIMIZATION"),r.body=null;case"COPY_SPECIAL":r.header=zo.getInstance().createHeader("COPY_SPECIAL"),r.body=null;case"PASTE":r.header=a0.getInstance().createHeader("PASTE"),r.body=null}r.header&&he.publish("PCB2UIAboutExitSketcherAttrView",r,Q()),this.type=null}clearSketcherAttrView(){this.exit();let t=["DIST_MEASURE","SINGLE_WIRE","DIFF_WIRE","MULTI_WIRE","COPY_SPECIAL","PASTE"];for(let e of t){let r={};r.header=Ys.getInstance().createHeader(e),r.body=null,r.header&&he.publish("PCB2UIAboutExitSketcherAttrView",r,Q())}}exit(){this.isUnmounted=!0,window.clearTimeout(this._ui2PCBAboutAttrDataUpdateTimer),this._ui2PCBAboutAttrDataUpdateTimer=null}};var Cwl=qo.getInstance(),Ofe=class{constructor(){A.subscribe("rebuildConnectCopper",this.rebuildConnectCopper.bind(this))}getOrders(t){let e={};for(let r of pt.getAllItem())if(r.type=="Copper Region"&&(!t||r.layerId==t)&&r.getComponent()instanceof xn){let i=r.layerId,n=e[i];n==null&&(n=new Array,e[i]=n),n.push(r)}for(let r of Kt.getAllItem())if(r.type=="Copper Region"&&(!t||r.layerId==t)&&r.getComponent()instanceof xn){let i=r.layerId,n=e[i];n==null&&(n=new Array,e[i]=n),n.push(r)}for(let r of Xt.getAllItem())if(r.type=="Copper Region"&&(!t||r.layerId==t)&&r.getComponent()instanceof xn){let i=r.layerId,n=e[i];n==null&&(n=new Array,e[i]=n),n.push(r)}for(let r in e)e[r].sort((n,s)=>n.getComponent().order-s.getComponent().order);return e}getOrders4Layer(t){return(this.getOrders(t)[t]||[]).map(i=>i.globalIndex)}getNextOrders4Layer(t){let r=this.getOrders(t)[t]||[];for(let i=r.length-1;i>=0;i--){let n=r[i];if(n.type=="Copper Region"){let s=n.getComponent();if(s!=null)return s.order+1}}return 0}addOrder(t,e){if(!(t instanceof He&&t.type=="Copper Region"))return;console.time("copperOrder");let r=t.model,i=r.layerId,n=this.getOrders(i)[i]||[],a=kt.search4Types(r.buildBBox(),Kp).getResult(Kp).filter(c=>!c.isEmpty&&c instanceof He&&c.globalIndex!=r.globalIndex&&c.layerId==r.layerId&&c.type=="Copper Region").sort((c,h)=>{let u=n.indexOf(c),d=n.indexOf(h);return u==-1?(console.warn("\u6709\u94FA\u94DC\u6CA1\u6709\u6DFB\u52A0\u4F18\u5148\u7EA7:"+c.globalIndex),-1):d==-1?(console.warn("\u6709\u94FA\u94DC\u6CA1\u6709\u6DFB\u52A0\u4F18\u5148\u7EA7:"+c.globalIndex),1):u-d}),l=this.getContainAB(a,r);if(l){let c=n.indexOf(l);if(c!==-1){let h=l.getComponent().order;t.getComponent().order=h,h++;for(let u=c;u<n.length;u++){let d=n[u];if(d.type=="Copper Region"&&d!=t){let p=d.getComponent();p instanceof xn&&p.order<h&&(e.addCommand(Ce.dispatch(d,"modify")),p.order=h,h++)}}}else{let h=n[n.length-1];h!=t&&(t.getComponent().order=h.getComponent().order+1)}}else{let c=n[n.length-1];c!=t&&(t.getComponent().order=c.getComponent().order+1)}console.timeEnd("copperOrder")}changeModelLayer(t,e,r){t.type=="Copper Region"&&this.addOrder(t,r)}changeTypeToPour(t,e){t.type=="Copper Region"&&this.addOrder(t,e)}changeTypeToPours(t,e){t.forEach(r=>{r.type=="Copper Region"&&this.addOrder(r,e)})}rebuildConnectCopper(t){let e=new Set;for(let r of t)this.getNeedRebuildCopper(r,e);A.publish("rebuildSingleCopper",{ids:Array.from(e),isLast:!0})}getNeedRebuildCopper(t,e){let r=UY(t);if(this.getOrder(t)==null)return;kt.search4Types(r.bbox,Kp).getResult(Kp).filter(s=>!s.isEmpty&&s instanceof He&&s.globalIndex!=r.globalIndex&&s.layerId==r.layerId&&s.type=="Copper Region"?(this.needRebuildCopper(s,r),!0):!1).forEach(s=>{e.add(s.globalIndex)}),e.add(t)}getOrder(t){let e=this.getModelById(t);return e?this.getOrderByModel(e):null}getOrderByModel(t){if(t.type!="Copper Region")return null;let e=t.component;return e instanceof xn?e.order:null}needRebuildCopper(t,e){let r=t.model.getMathGraphics(),i=e.getMathGraphics();return new As(r,i,0).relation==3}getModelById(t){let e=UY(t);return e&&e.type=="Copper Region"?e:null}setOrder(t,e,r){if(e==0)this.toHighest([t],r);else if(e>0){let i=this.getOrders(t.layerId)[t.layerId]||[];if(i.length>0)this.insertAfter([t],i[e-1],r);else if(t instanceof He&&t.type=="Copper Region"){let n=t.getComponent();n instanceof xn&&(n.order=0)}}else this.toLowest([t])}toHighest(t,e){let r={};t.forEach(n=>{n instanceof He&&n.type=="Copper Region"&&(r[n.layerId]||(r[n.layerId]=[]),r[n.layerId].push(n))});let i=this.getOrders();for(let n in r){let a=r[n].sort((h,u)=>this.getOrder(h.globalIndex)-this.getOrder(u.globalIndex)),l=0;for(let h of a)if(h instanceof He&&h.type=="Copper Region"){let u=h.getComponent();u instanceof xn&&(u.order=l,l++)}let c=i[+n];for(let h of c)if(h instanceof He&&h.type=="Copper Region"&&!a.includes(h)){let u=h.getComponent();u instanceof xn&&u.order<l&&(e.addCommand(Ce.dispatch(h,"modify")),u.order=l,l++)}}}insertAfter(t,e,r){let i={};t.forEach(h=>{h instanceof He&&h.type=="Copper Region"&&(i[h.layerId]||(i[h.layerId]=[]),i[h.layerId].push(h))});let n=this.getOrders(),s=i[e.layerId]||[],a=n[e.layerId]||[],l,c=a.indexOf(e);if(c!==-1)l=e.getComponent().order+1;else{let h=a[a.length-1];h!=null?l=h.getComponent().order+1:l=0}for(let h of s)if(h instanceof He&&h.type=="Copper Region"){let u=h.getComponent();u instanceof xn&&(u.order=l,l++)}if(c>=0)for(let h=c+1;h<a.length;h++){let u=a[h];if(u instanceof He&&u.type=="Copper Region"&&!s.includes(u)){let d=u.getComponent();d instanceof xn&&d.order<l&&(r.addCommand(Ce.dispatch(u,"modify")),d.order=l,l++)}}for(let h in i)if(+h!=e.layerId){let u=n[+h]||[],d=u[u.length-1],p;d==null?p=0:p=d.getComponent().order+1;for(let m of s)if(m instanceof He&&m.type=="Copper Region"){let g=m.getComponent();g instanceof xn&&(g.order=p,p++)}}}toLowest(t,e=!0){let r={};t.forEach(n=>{n instanceof He&&n.type=="Copper Region"&&(r[n.layerId]||(r[n.layerId]=[]),r[n.layerId].push(n))});let i=this.getOrders();for(let n in r){let s=r[n],a;e?a=s.sort((u,d)=>this.getOrder(u.globalIndex)-this.getOrder(d.globalIndex)):a=s;let l=i[+n]||[],c=l[l.length-1],h;c==null?h=0:h=c.getComponent().order+1;for(let u of a)if(u instanceof He&&u.type=="Copper Region"){let d=u.getComponent();d instanceof xn&&(d.order=h,h++)}}}getContainAB(t,e){for(let r of t){let i=r.buildBBox();if(!e.bbox.isInside(i))continue;let l=r.model.getMathGraphics(),c=e.getMathGraphics();switch(new As(l,c,0).relation){case 2:case 3:continue;case 1:return r}if(!this.isIntersect(l,c))return r}return null}isIntersect(t,e){let r=[];t.points(.1,l=>{r.push(l)});let i=fk.getSweep(r),n=new $Oe(t.primitives,.001,i?ae.CW:ae.CCW);switch(new As(ge.build2(n.path).asClose(),e,0).relation){case 1:return!1}return!0}},$Oe=class{constructor(t,e,r){this.path=new Array;let i=new Array;for(let s of t){if(s instanceof M&&s.length()<1e-8)continue;let a=this.getPrimitive(s,e,r);a!=null&&i.push(a)}for(let s=0,a=i.length;s<a;s++){let l=i[s],c=i[s+1];if(c!=null){let h=this.getPoint(l,c);if(h!=null){let u=this.modifyPrimitiveEnd(l,h),d=this.modifyPrimitiveStart(c,h);i.splice(s,2,u,d)}}}let n=ge.build2(i);this.path=n.primitives}getNearPoint(t,e){let i=new er(t,new M(e,e)).getLine();return i.start().distance2(e)<i.end().distance2(e)?i.end():i.start()}isParaller(t,e){if(t instanceof M&&e instanceof M){let r=t.direct.cross(e.direct);if(ne.eq(r,0))return!0}return!1}getPoint(t,e){let r=Pt(t,e),i=null,n=Number.MAX_VALUE,s=this.isParaller(t,e),a=null;for(let l=0;l<r;l+=2){let c=new S(Ee[l],Ee[l+1]),h=c.distance2(t.start());h<n&&(i=c,n=h),a==null?a=c:a=a.add(c)}return s&&r>0&&a!=null?a.mul(2/r):i}modifyPrimitiveStart(t,e){if(t instanceof M)return new M(e,t.end());if(t instanceof q){let r=e.angleD(t.center);return q.build2(t.center,r,t.endAngle(),t.rx,t.ry,t.sweep())}return null}modifyPrimitiveEnd(t,e){if(t instanceof M)return new M(t.start(),e);if(t instanceof q){let r=e.angleD(t.center);return q.build2(t.center,t.startAngle,r,t.rx,t.ry,t.sweep())}return null}getInters(t,e,r){let i=-1;for(let n=r,s=e.length;n<s;n++){let a=e[n];Pt(t,a)>0&&(i=n)}return i}getPrimitive(t,e,r){if(t instanceof M){let i=t.end().sub(t.start()).normalize(),n=new S(-i.y,i.x).mul(e);r==ae.CW&&(n=n.mul(-1));let s=t.start().sub(i.mul(e)).add(n),a=t.end().add(i.mul(e)).add(n);return new M(s,a)}else if(t instanceof q){let i=t.rx;return t.sweep()==ae.CCW?r==ae.CCW?i=t.rx-e:i=t.rx+e:r==ae.CCW?i=t.rx+e:i=t.rx-e,i<=0?null:q.build2(t.center,t.startAngle,t.endAngle(),i,i,t.sweep())}return null}};var Afe=class Afe{static getInstance(){return this.instanceItem===null&&(this.instanceItem=new Afe),this.instanceItem}constructor(){this._activeStatus="active"}get activeStatus(){return this._activeStatus}set activeStatus(t){this._activeStatus=t}};Afe.instanceItem=null;var yU=Afe;function Ks(o,t,e){let r=[];for(let i=0;i<o.length;i++)o[i][t]===e&&r.push(o[i]);return r}function _fe(o){let t=[];return t.push(o.end.x*10),t.push(o.end.y*10),t.push(o.start.x*10),t.push(o.start.y*10),t.push(o.textPosition.x*10),t.push(o.textPosition.y*10),t}function vfe(o){let t=[];return t.push(o.left.x*10),t.push(o.left.y*10),t.push(o.start.x*10),t.push(o.start.y*10),t.push(o.end.x*10),t.push(o.end.y*10),t.push(o.right.x*10),t.push(o.right.y*10),t}function xfe(o){let t=[];return t.push(o.start.x*10),t.push(o.start.y*10),t.push(o.center.x*10),t.push(o.center.y*10),t.push(o.end.x*10),t.push(o.end.y*10),t}function N1(o){let t=o.model;if(o instanceof lt){let r=o.toJSON();delete r.componentData,delete r.shapes;let i=k1(o);return r.pathString=i||"",r.strokeWidth=je(r.strokeWidth,3,"mil"),{...r,pcbItemPrimitiveType:t.modelType}}if(o instanceof Ge){if(o instanceof yi||o instanceof _t){let i=o.toJSON(),n=o.center.add(new S(Math.cos(o.startAngle),Math.sin(o.startAngle)).mul(o.radius)),s=o.center.add(new S(Math.cos(o.endAngle),Math.sin(o.endAngle)).mul(o.radius));return{...i,startX:je(n.x,3,"mil"),startY:je(n.y,3,"mil"),endX:je(s.x,3,"mil"),endY:je(s.y,3,"mil"),width:i.width*10,arcAngle:zt.toDegrees(t.angle),pcbItemPrimitiveType:t.modelType}}let r=o.toJSON();return r.start=new S(je(r.start.x,3,"mil"),je(r.start.y,3,"mil")),r.end=new S(je(r.end.x,3,"mil"),je(r.end.y,3,"mil")),r.width=je(r.width,3,"mil"),{...r,startX:r.start.x,startY:r.start.y,endX:r.end.x,endY:r.end.y,pcbItemPrimitiveType:t.modelType}}if(o instanceof Le){let r=o.toJSON();return r.center=new S(je(r.center.x,3,"mil"),je(r.center.y,3,"mil")),r.rotation=zt.toDegrees(r.rotation),r.topSolderExpansion=je(r.topSolderExpansion,3,"mil"),r.bottomSolderExpansion=je(r.bottomSolderExpansion,3,"mil"),r.pasteExpansion=je(r.pasteExpansion,3,"mil"),{...r,padRule:o.model.padRule?o.model.padRule:null,holeAspect:o.holeShape?[o.holeShape,(o.holeRadius*10||0)*2,o.holeLength*10||0]:null,padTypeAspect:o.model.padType,defaultPadShapeAspect:bU(o.model),specialPadShapeAspect:PU(o.model),pcbItemPrimitiveType:t.modelType,parentId:o.getParent()?o.getParent().globalIndex:null}}if(o instanceof Mn){let r=o.toJSON();return r.start=new S(je(r.start.x,3,"mil"),je(r.start.y,3,"mil")),r.width=je(r.width,3,"mil"),r.height=je(r.height,3,"mil"),{...r,imageType:o.model.modelType==="Image"?"Image":"Picture",pathString:o instanceof Mn?zb(o.getRealPath()).join(" "):"",pcbItemPrimitiveType:t.modelType}}if(o instanceof qs||o instanceof da||o instanceof Ga){let r=o.toJSON();return r.width=je(r.width,3,"mil"),{...r,dimensionType:o.type,coordinateSet:o.type==="Length Dimension"?vfe(o):o.type==="Radius Dimension"?_fe(o):xfe(o),unit:R.getInstance().unit,pcbItemPrimitiveType:t.modelType}}if(o instanceof Ue){let r=o.toJSON();return r.center=new S(je(r.center.x,3,"mil"),je(r.center.y,3,"mil")),r.radius=je(r.radius,3,"mil"),r.holeRadius=je(r.holeRadius,3,"mil"),{...r,pcbItemPrimitiveType:t.modelType}}let e=o.toJSON();if(typeof e.componentData=="object"&&e.componentData!==null&&e.componentData.model&&delete e.componentData,e.pcbItemPrimitiveType=t.modelType,t.modelType=="Rect"||t.modelType=="Circle"){let r=zb([o.getMathGraphics()]).join(" ");switch(e.pathString=r||"",e.strokeWidth=je(e.strokeWidth,3,"mil"),t.modelType){case"Rect":e.start=new S(je(e.start.x,3,"mil"),je(e.start.y,3,"mil")),e.width=je(e.width,3,"mil"),e.height=je(e.height,3,"mil"),e.rotation=zt.toDegrees(e.rotation),e.cornerRadius=je(e.cornerRadius,3,"mil");break;case"Circle":e.center=new S(je(e.center.x,3,"mil"),je(e.center.y,3,"mil")),e.radius=je(e.radius,3,"mil");break;default:break}}return e}function k1(o){if(o instanceof lt){let t=o.getMathGraphics();return P2(2,{pl:t})}else if(o instanceof rr){let{start:t,width:e,height:r,rotation:i,radius:n}=o,s={start:t,width:e,height:r,rotation:i,radius:n};return P2(1,s)}else if(o instanceof Pr){let t=o.center,e=o.radius;return P2(0,{center:t,radius:e})}}function xu(o){o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q())}function bU(o){if(o instanceof et)if(o.isPolygon()){let t;return[1,2,15].forEach(e=>{let r=o.getPad(e);r&&(t=r)}),["POLYGON",o1(t.pl,10)]}else return o.layerId==12?o.top.type=="RECT"?[o.top.type,je(o.top.width,3,"mil"),je(o.top.height,3,"mil"),o.top.ratio*100]:[o.top.type,je(o.top.width,3,"mil"),je(o.top.height,3,"mil")]:o.layerId==1?o.top.type=="RECT"?[o.top.type,je(o.top.width,3,"mil"),je(o.top.height,3,"mil"),o.top.ratio*100]:[o.top.type,je(o.top.width,3,"mil"),je(o.top.height,3,"mil")]:o.bottom.type=="RECT"?[o.bottom.type,je(o.bottom.width,3,"mil"),je(o.bottom.height,3,"mil"),o.bottom.ratio*100]:[o.bottom.type,je(o.bottom.width,3,"mil"),je(o.bottom.height,3,"mil")]}function PU(o){let t=new Array;return o instanceof et&&!o.isPolygon()&&o.type==2&&(o.top.type=="RECT"?t.push([1,1,[o.top.type,je(o.top.width,3,"mil"),je(o.top.height,3,"mil"),o.top.ratio*100]]):t.push([1,1,[o.top.type,je(o.top.width,3,"mil"),je(o.top.height,3,"mil")]]),o.inner.type=="RECT"?t.push([1,2,[o.inner.type,je(o.inner.width,3,"mil"),je(o.inner.height,3,"mil"),o.inner.ratio*100]]):t.push([1,2,[o.inner.type,je(o.inner.width,3,"mil"),je(o.inner.height,3,"mil")]]),o.bottom.type=="RECT"?t.push([2,2,[o.bottom.type,je(o.bottom.width,3,"mil"),je(o.bottom.height,3,"mil"),o.bottom.ratio*100]]):t.push([2,2,[o.bottom.type,je(o.bottom.width,3,"mil"),je(o.bottom.height,3,"mil")]])),t}var qD=null;function tqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/document-getRatlineStatus",async()=>({status:yU.getInstance().activeStatus})),o.messageBus.rpcService("pcb/extensionAPI/document-setRatlineStatus",async e=>{let{status:r}=e;return yU.getInstance().activeStatus=r,{status:yU.getInstance().activeStatus}}),o.messageBus.rpcService("pcb/extensionAPI/document-convertCanvasOriginToDataOrigin",async e=>{let{x:r,y:i}=e,n=r/10,s=i/10,a=R.getInstance().origin;return{x:(n+a.x)*10,y:(s+a.y)*10}}),o.messageBus.rpcService("pcb/extensionAPI/document-convertDataOriginToCanvasOrigin",async e=>{let{x:r,y:i}=e,n=r/10,s=i/10,a=R.getInstance().origin;return{x:(n-a.x)*10,y:(s-a.y)*10}}),o.messageBus.rpcService("pcb/extensionAPI/document-getCanvasOrigin",async e=>{let r=R.getInstance().origin;return{offsetX:r.x*10,offsetY:r.y*10}}),o.messageBus.rpcService("pcb/extensionAPI/document-setCanvasOrigin",async e=>{let{offsetX:r,offsetY:i}=e,n=new S(r/10,i/10);return G3(n),!0}),o.messageBus.rpcService("pcb/extensionAPI/document-navigateToCoordinates",async e=>{let{x:r,y:i}=e,n=new ht(r/10-200,r/10+200,i/10-200,i/10+200);return o.publish("AdaptBBox2",{box:n,showCrossLines:!1,onlyMove:!0}),o.publish("updateFrame",""),typeof qD=="number"&&(o.publish("HiddenCanvasCrossLine",null),qD=null),window.clearTimeout(qD),window.requestAnimationFrame(()=>{qD=window.setTimeout(()=>{o.publish("SetCanvasCrossLine",{box:n,delay:3e3})},75)}),!0}),o.messageBus.rpcService("pcb/extensionAPI/document-navigateToRegion",async e=>{let{left:r,right:i,top:n,bottom:s}=e,a=(r+i)/2,l=(n+s)/2,c=Math.abs(r-i)/2,h=Math.abs(n-s)/2,u=new ht(a/10-c/10,a/10+c/10,l/10-h/10,l/10+h/10);return o.publish("AdaptBBox2",{box:u,showCrossLines:!1,onlyMove:!0}),o.publish("updateFrame",""),typeof qD=="number"&&(o.publish("hiddenCanvasRectRegion",null),qD=null),window.clearTimeout(qD),window.requestAnimationFrame(()=>{qD=window.setTimeout(()=>{o.publish("showCanvasRectRegion",{box:u,delay:3e3})},75)}),!0}),o.messageBus.rpcService("pcb/extensionAPI/document-getPrimitivesInRegion",async e=>{let{left:r,right:i,top:n,bottom:s,leftToRight:a}=e,l=(r+i)/2,c=(n+s)/2,h=Math.abs(r-i)/2,u=Math.abs(n-s)/2,d=new ht(l/10-h/10,l/10+h/10,c/10-u/10,c/10+u/10);return t.getItemsByBBox(d,a).filter(g=>typeof g.toJSON=="function").map(g=>N1(g))}),o.messageBus.rpcService("pcb/extensionAPI/document-getPrimitiveAtPoint",async e=>{let{x:r,y:i}=e,n=Vr.pointSelect(r/10,i/10);return n=Array.from(jt.filter(n)),Vr.filterPartiton(n).filter(l=>typeof l.toJSON=="function").map(l=>N1(l))}),o.messageBus.rpcService("pcb/extensionAPI/document-getCurrentFilterConfiguration",async()=>new iU().getCurrentConfig())}function TU(o,t,e){let r=e.map(n=>n.designator),i=t.map(n=>String(n.num));if(o.indexOf(":")>=0){let n=o.split(":"),s=n[0],a=n[1];if(r.indexOf(s)<=-1||i.indexOf(a)<=-1)return null;let l=xe.queryItem(e,"designator",s);if(l.index<=-1)return null;let c=xe.queryItem(t,"num",a);return c.index<=-1?null:{belongDeiviceId:l.data.globalIndex,designator:s,id:c.data.globalIndex,isDissociate:!1,nets:[],number:a}}else{let n=o,s=xe.queryItem(t,"number",+n.slice(Tr.length));return s.index<=-1?null:{belongDeiviceId:"",designator:"",id:s.data.globalIndex,isDissociate:!0,nets:[],number:"",text:n}}}function Rfe(o){return typeof o=="string"?!0:Array.isArray(o)?o.every(t=>typeof t=="string"):!1}function QRt(o){if(Array.isArray(o)&&o.length===2){let[t,e]=o;if(typeof t=="string"&&typeof e=="string")return!0}if(Array.isArray(o)){for(let t of o)if(!Array.isArray(t)||t.length!==2||typeof t[0]!="string"||typeof t[1]!="string")return!1;return!0}return!1}function eDt(o,t){return o.sort().toString()===t.sort().toString()}function rqe(o,t){for(let e of t)for(let r of o){let i,n="",s="";if(e[0].indexOf(":")>=0?n=r.pad1.designator+":"+r.pad1.number:n=r.pad1.id,e[1].indexOf(":")>=0?s=r.pad2.designator+":"+r.pad2.number:s=r.pad2.id,i=[n,s],eDt(e,i))return!1}return!0}function V5(o,t){let e=Object.keys(o),r=Object.keys(t);if(e.length!==r.length)return!0;for(let i of e){if(!r.includes(i))return!0;let n=o[i],s=t[i];if(n.length!==s.length)return!0;for(let a=0;a<n.length;a++)if(n[a]!==s[a])return!0}return!1}function tDt(o){let t=new Set;for(let e in o)if(o.hasOwnProperty(e))for(let r of o[e]){if(t.has(r))return!1;t.add(r)}return!0}function rDt(o,t){Array.isArray(t)||(t=[t]);for(let e in o)if(o.hasOwnProperty(e)){let r=o[e];for(let i of t)if(r.includes(i))return!1}return!0}function Dfe(o){let t=o.toRGBA();return{r:t[0],g:t[1],b:t[2],alpha:t[3]}}var iDt=o=>{if(o.type==="net"&&o.name){let t=re.getInstance().getNet(o.name);t!=null&&t.netDifferential&&(o["Differential Pair"]=t.netDifferential.differentialPhysics)}};function iqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/drc-check",async e=>{let{strict:r,userInterface:i,includeVerboseError:n}=e;if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let s=await oYe({isOpenDRCCustomCheck:!0}),a=pd.panelManager.getErrorTree(s);pd.updateVisibility(!0),o.publish("getAllErrorsBack",a,Q());let l=!1,c=[];for(let h of s)h.list.length!==0&&(l=!0,c.push(h));return n?c:!l}),o.messageBus.rpcService("pcb/extensionAPI/drc-getCurrentRuleConfigurationName",async e=>{if(!(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype))return{ruleTemplateName:re.getInstance().getRuleTemplateName()}}),o.messageBus.rpcService("pcb/extensionAPI/drc-getCurrentRuleConfiguration",async e=>{if(!(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype))return{...g1.getDesignRulers()}}),o.messageBus.rpcService("pcb/extensionAPI/drc-overwriteCurrentRuleConfiguration",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let r=new Rg,i=r.getDesignRulers();return e.configName?r.setDesignRulers({...i,Rule:e.ruleConfiguration,RuleTemplateName:e.configName}):r.setDesignRulers({...i,Rule:e.ruleConfiguration}),!0}),o.messageBus.rpcService("pcb/extensionAPI/drc-getNetRules",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let n=new Rg().getDesignRulers().Net,s=a=>{iDt(a),a.sub&&a.sub.forEach(s)};return n.forEach(s),n}),o.messageBus.rpcService("pcb/extensionAPI/drc-overwriteNetRules",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let{netRules:r}=e,i=new Rg,n=i.getDesignRulers();return i.setDesignRulers({...n,Net:r}),!0}),o.messageBus.rpcService("pcb/extensionAPI/drc-getNetByNetRules",async e=>!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype?void 0:new Rg().getDesignRulers().NetnetList),o.messageBus.rpcService("pcb/extensionAPI/drc-overwriteNetByNetRules",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let{netByNetRules:r}=e,i=new Rg,n=i.getDesignRulers();return i.setDesignRulers({...n,NetnetList:r}),!0}),o.messageBus.rpcService("pcb/extensionAPI/drc-getRegionRules",async e=>!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype?void 0:new Rg().getDesignRulers().constraintRegion),o.messageBus.rpcService("pcb/extensionAPI/drc-overwriteRegionRules",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let{regionRules:r}=e,i=new Rg,n=i.getDesignRulers();return i.setDesignRulers({...n,constraintRegion:r}),!0}),o.messageBus.rpcService("pcb/extensionAPI/drc-createNetClass",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let{netClassName:r,nets:i,color:n}=e,s={[r]:i},a=Ye.getAllNets(),l=!0;if(i.forEach(c=>{a.includes(c)||(l=!1)}),!l)return!1;if(n){let c=ee.of2(n.r,n.g,n.b,n.alpha);W8(i,c)}return IT("new-net-class",s)}),o.messageBus.rpcService("pcb/extensionAPI/drc-deleteNetClass",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let{netClassName:r}=e;if(typeof r!="string"||r.trim()=="")return!1;let n=g1.getDesignRulers().Net.filter(l=>l.type==="netClass"),s={};n.forEach(l=>{s[l.name]=l.sub.map(c=>c.name)});let a={};return Object.keys(s).forEach(l=>{r!==l&&(a[l]=Ss(s[l]))}),V5(a,s)?IT("edit-net-class",a,s):!1}),o.messageBus.rpcService("pcb/extensionAPI/drc-modifyNetClassName",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let{originalNetClassName:r,netClassName:i}=e,s=g1.getDesignRulers().Net.filter(c=>c.type==="netClass"),a={};s.forEach(c=>{a[c.name]=c.sub.map(h=>h.name)});let l={};return Object.keys(a).forEach(c=>{if(c===r){l[i]=Ss(a[c]);return}l[c]=Ss(a[c])}),IT("edit-net-class",l,a)}),o.messageBus.rpcService("pcb/extensionAPI/drc-addNetToNetClass",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let{net:r,netClassName:i}=e;if(typeof i!="string"||!Rfe(r)||typeof r=="string"&&!re.getInstance().getNet(r)||r instanceof Array&&!r.every(c=>re.getInstance().getNet(c)))return!1;let s=g1.getDesignRulers().Net.filter(c=>c.type==="netClass"),a={};s.forEach(c=>{a[c.name]=c.sub.map(h=>h.name)});let l={};return Object.keys(a).forEach(c=>{if(c===i){if(l[i]=Ss(a[c]),typeof r=="string"){l[i].push(r);return}if(r instanceof Array){r.forEach(h=>{l[i].push(h)});return}return}l[c]=Ss(a[c])}),V5(l,a)&&tDt(l)?IT("edit-net-class",l,a):!1}),o.messageBus.rpcService("pcb/extensionAPI/drc-removeNetFromNetClass",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let{net:r,netClassName:i}=e;if(typeof i!="string"||!Rfe(r))return!1;let s=g1.getDesignRulers().Net.filter(c=>c.type==="netClass"),a={};s.forEach(c=>{a[c.name]=c.sub.map(h=>h.name)});let l={};return Object.keys(a).forEach(c=>{if(c===i){if(l[i]=Ss(a[c]),typeof r=="string"){let h=l[i].indexOf(r);h>=0&&l[i].splice(h,1);return}if(r instanceof Array){r.forEach(h=>{let u=l[i].indexOf(h);u>=0&&l[i].splice(u,1)});return}return}l[c]=Ss(a[c])}),V5(l,a)?IT("edit-net-class",l,a):!1}),o.messageBus.rpcService("pcb/extensionAPI/drc-getAllNetClasses",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let r=[];return g1.getDesignRulers().Net.filter(s=>s.type==="netClass").forEach(s=>{let a={name:"",nets:[]};a.name=s.name,s.sub.forEach(h=>{a.nets.push(h.name)});let l=Ye.getSpecialColor(a.nets[0]),c=!0;for(let h=1;h<a.nets.length;h++){let u=Ye.getSpecialColor(a.nets[h]);if(u.r!==l.r||u.g!==l.g||u.b!==l.b){c=!1;break}}c?a.color=Dfe(l):a.color=Dfe(ee.BLACK),r.push(a)}),r}),o.messageBus.rpcService("pcb/extensionAPI/drc-createEqualLengthNetGroup",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let{equalLengthNetGroupName:r,nets:i,color:n}=e,s={[r]:i},a=Ye.getAllNets(),l=!0;if(i.forEach(c=>{a.includes(c)||(l=!1)}),!l)return!1;if(n){let c=ee.of2(n.r,n.g,n.b,n.alpha);W8(i,c)}return IT("new-equal-length-group",s)}),o.messageBus.rpcService("pcb/extensionAPI/drc-deleteEqualLengthNetGroup",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let{equalLengthNetGroupName:r}=e;if(typeof r!="string"||r.trim()=="")return!1;let n=g1.getDesignRulers().Net.filter(l=>l.type==="equalLengthGroup"),s={};n.forEach(l=>{s[l.name]=l.sub.map(c=>c.name)});let a={};return Object.keys(s).forEach(l=>{r!==l&&(a[l]=Ss(s[l]))}),V5(a,s)?IT("edit-equal-length-group",a,s):!1}),o.messageBus.rpcService("pcb/extensionAPI/drc-modifyEqualLengthNetGroupName",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let{originalEqualLengthNetGroupName:r,equalLengthNetGroupName:i}=e;if(typeof r!="string"||r.trim()==""||typeof i!="string"||i.trim()=="")return!1;let s=g1.getDesignRulers().Net.filter(c=>c.type==="equalLengthGroup"),a={};s.forEach(c=>{a[c.name]=c.sub.map(h=>h.name)});let l={};return Object.keys(a).forEach(c=>{if(c===r){l[i]=Ss(a[c]);return}l[c]=Ss(a[c])}),V5(l,a)?IT("edit-equal-length-group",l,a):!1}),o.messageBus.rpcService("pcb/extensionAPI/drc-addNetToEqualLengthNetGroup",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let{net:r,equalLengthNetGroupName:i}=e;if(typeof i!="string"||!Rfe(r)||typeof r=="string"&&!re.getInstance().getNet(r)||r instanceof Array&&!r.every(c=>re.getInstance().getNet(c)))return!1;let s=g1.getDesignRulers().Net.filter(c=>c.type==="equalLengthGroup"),a={};if(s.forEach(c=>{a[c.name]=c.sub.map(h=>h.name)}),!rDt(a,r))return!1;let l={};return Object.keys(a).forEach(c=>{if(c===i){if(l[i]=Ss(a[c]),typeof r=="string"){l[i].push(r);return}if(r instanceof Array){r.forEach(h=>{l[i].push(h)});return}return}l[c]=Ss(a[c])}),V5(l,a)?IT("edit-equal-length-group",l,a):!1}),o.messageBus.rpcService("pcb/extensionAPI/drc-removeNetFromEqualLengthNetGroup",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let{net:r,equalLengthNetGroupName:i}=e;if(typeof i!="string"||!Rfe(r))return!1;let s=g1.getDesignRulers().Net.filter(c=>c.type==="equalLengthGroup"),a={};s.forEach(c=>{a[c.name]=c.sub.map(h=>h.name)});let l={};return Object.keys(a).forEach(c=>{if(c===i){if(l[i]=Ss(a[c]),typeof r=="string"){let h=l[i].indexOf(r);h>=0&&l[i].splice(h,1);return}if(r instanceof Array){r.forEach(h=>{let u=l[i].indexOf(h);u>=0&&l[i].splice(u,1)});return}return}l[c]=Ss(a[c])}),V5(l,a)?IT("edit-equal-length-group",l,a):!1}),o.messageBus.rpcService("pcb/extensionAPI/drc-getAllEqualLengthNetGroups",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let r=[];return g1.getDesignRulers().Net.filter(s=>s.type==="equalLengthGroup").forEach(s=>{let a={name:"",nets:[]};a.name=s.name,s.sub.forEach(h=>{a.nets.push(h.name)});let l=Ye.getSpecialColor(a.nets[0]),c=!0;for(let h=1;h<a.nets.length;h++){let u=Ye.getSpecialColor(a.nets[h]);if(u.r!==l.r||u.g!==l.g||u.b!==l.b){c=!1;break}}c?a.color=Dfe(l):a.color=Dfe(ee.BLACK),r.push(a)}),r}),o.messageBus.rpcService("pcb/extensionAPI/drc-createPadPairGroup",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let{padPairGroupName:r,padPairs:i}=e,n=fE();for(let u=0;u<n.length;u++){let d=n[u].details;if(!rqe(d,i))return!1}let s=Ar.getAllItem(),a=Qt.getAllItem(),l=[],c=!0;if(i.forEach(u=>{let d=u[0],p=u[1],m={pad1:null,pad2:null};if(!d||!p)return;let g=TU(d,a,s),y=TU(p,a,s);if(!g||!y){c=!1;return}m.pad1=g,m.pad2=y,l.push(m)}),!c)return!1;let h=xe.queryItem(n,"groupName",r);return h.index>=0?l.forEach(u=>{h.data.details.push(u),h.data.action="UPDATED"}):n.push({groupName:r,oldGroupName:r,action:"CREATED",details:l}),GD(Ss(n)),!0}),o.messageBus.rpcService("pcb/extensionAPI/drc-deletePadPairGroup",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let{padPairGroupName:r}=e;if(typeof r!="string"||r.trim()=="")return!1;let i=fE(),n=xe.queryItem(i,"groupName",r);return n.index<=-1?!1:(n.data.action="DELETED",GD(Ss(i)),!0)}),o.messageBus.rpcService("pcb/extensionAPI/drc-modifyPadPairGroupName",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let{originalPadPairGroupName:r,padPairGroupName:i}=e;if(typeof r!="string"||r.trim()==""||typeof i!="string"||i.trim()=="")return!1;let n=fE(),s=xe.queryItem(n,"groupName",r);return s.index<=-1?!1:(s.data.groupName=i,s.data.action="UPDATED",GD(Ss(n)),!0)}),o.messageBus.rpcService("pcb/extensionAPI/drc-addPadPairToPadPairGroup",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let{padPairGroupName:r,padPair:i}=e;if(typeof r!="string"||r.trim()==""||!QRt(i))return!1;let n=fE();for(let d=0;d<n.length;d++){let p=n[d].details,m=i[0]instanceof Array?i:[i];if(!rqe(p,m))return!1}let s=xe.queryItem(n,"groupName",r);if(s.index<=-1)return!1;let a=i[0]instanceof Array?i:[i],l=Ar.getAllItem(),c=Qt.getAllItem(),h=[],u=!0;return a.forEach(d=>{let p=d[0],m=d[1],g={pad1:null,pad2:null};if(!p||!m)return;let y=TU(p,c,l),b=TU(m,c,l);if(!y||!b){u=!1;return}g.pad1=y,g.pad2=b,h.push(g)}),u?(h.forEach(d=>{s.data.details.push(d),s.data.action="CREATED"}),GD(Ss(n)),!0):!1}),o.messageBus.rpcService("pcb/extensionAPI/drc-removePadPairFromPadPairGroup",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let{padPairGroupName:r,padPair:i}=e,n=fE(),s=xe.queryItem(n,"groupName",r);if(s.index<=-1)return!1;let a=i[0]instanceof Array?i:[i],l=Ar.getAllItem(),c=Qt.getAllItem(),h=[],u=!1;return a.forEach(d=>{let p=d[0],m=d[1],g={pad1:null,pad2:null};if(!p||!m)return;let y=TU(p,c,l),b=TU(m,c,l);!y||!b||(g.pad1=y,g.pad2=b,h.push(g))}),h.forEach(d=>{let p=d.pad1,m=d.pad2,g=-1,y=-1;if(p.designator&&p.number)for(let b=0;b<s.data.details.length;b++){let P=s.data.details[b].pad1;if(P.designator===p.designator&&P.number===p.number){g=b;break}}else if(p.text){for(let b=0;b<s.data.details.length;b++)if(s.data.details[b].pad1.id===p.text){g=b;break}}if(m.designator&&m.number)for(let b=0;b<s.data.details.length;b++){let P=s.data.details[b].pad2;if(P.designator===m.designator&&P.number===m.number){y=b;break}}else if(m.text){for(let b=0;b<s.data.details.length;b++)if(s.data.details[b].pad2.id===m.text){y=b;break}}g>=0&&y>=0&&g===y&&(u=!0,s.data.details.splice(g,1),s.data.action="UPDATED")}),GD(Ss(n)),!!u}),o.messageBus.rpcService("pcb/extensionAPI/drc-getAllPadPairGroups",async e=>!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype?void 0:fE()),o.messageBus.rpcService("pcb/extensionAPI/drc-getPadPairGroupMinWireLength",async e=>{if(!R.getInstance().isactive||pi.FOOTPRINTVIEW==R.getInstance().doctype)return;let i=fE().filter(s=>s.groupName==e.padPairGroupName)[0];if(!i)return;let n=[];return i.details.forEach(s=>{let a=Tj(s.pad1),l=Tj(s.pad2);if(a&&l){let c=s.pad1.designator.length>1?`${s.pad1.designator}:${s.pad1.number}`:s.pad1.id,h=s.pad2.designator.length>1?`${s.pad2.designator}:${s.pad2.number}`:s.pad2.id,d=GCe(s.pad1,s.pad2).netMinLength*10;n.push({padPair:[c,h],minWireLength:d})}}),n})}function nqe(o){let t=Pe.configInnerLayers.size,e=Pe.getAllLayer(),r=o,i=new E3,n=new Array,s=new Array,a,l=new Array;for(let c=0;c<e.length;c++){let h=i.toPlainObj(e[c]),u=!0,d=e[c].config;if(r.forEach(p=>{if(+p.layerId===h.layerId){u=!1;let m=Object.assign({},h,p),g=ee.of3(m.activeColor).getData();if(Pe.modifyLayer(m.layerId,m.layerType,m.layerName||e[c].name,e[c].order,ee.build(g[0],g[1],g[2],m.activeColorAlpha),ee.build(g[0],g[1],g[2],m.deactiveColorAlpha),e[c].active,m.status),ER.deactiveAlpha=m.deactiveColorAlpha,p.layerType==="PLANE"&&Pd.hasProfileItem(p.layerId)){let b=Pd.fetchProfileItem(p.layerId);Pe.updatePlanzoneLayerKeepIsland(p.layerId,b.keepIsland)}let y=Pe.getLayer(h.layerId).config;return u=!y,u||A0(p.layerId),!d&&y?m.layerType=="PLANE"&&n.push(m.layerId):d&&!y?m.layerType=="PLANE"&&s.push(m.layerId):m.layerType=="SIGNAL"&&h.layerType=="PLANE"?s.push(m.layerId):m.layerType=="PLANE"&&h.layerType=="SIGNAL"&&n.push(m.layerId),!1}}),e[c].active&&(a=e[c]),u)if(e[c].active&&(a=Pe.getTopLayer()),Pe.modifyLayer(e[c].layerID,e[c].type,e[c].name,e[c].order,e[c].activeColor,e[c].deactiveColor,!1,0),l.push(e[c].layerID),Pd.hasProfileItem(e[c].layerID)&&Pd.deleteProfileItem(e[c].layerID),h.layerType=="CUSTOM"){let p=e[c].layerID,m=Pe.getLayer(p).config;(d!=m||m)&&A0(p,u)}else A0(e[c].layerID)}if(l.length){let c=Ar.getAllItem();for(let h of c)h.needUpdateBBox=!0}a!=null&&Pe.setActiveLayer(a),ea.getInstance().viaShowPair&&t!=Pe.configInnerLayers.size&&Wr.iterator(c=>c.refreshRender()),A.publish("clearSinglePlane",s),A.publish("rebuildSinglePlane",n),A.publish("autoRefresh3DColor",""),A.publish("autoFill","")}async function oqe(){if(!le.pcbConfig.realTimeUpdateUnusedLayers)return;let o=[...Qt.getAllItem().filter(r=>r.layerId==12),...Wr.getAllItem()],t=(await A.messageBus.rpcCall("unusedLayer",e0e(o))).message,e=await Qpe(t);o.length>0&&qe.executeCommand(e)}function wfe(o,t={}){let{visible:e,locked:r}=t;typeof e<"u"&&(o.visible=!!e),typeof r<"u"&&(o.locked=!!r)}function sqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/pcblayer-getAllLayers",async()=>Pe.getAllLayer().map(r=>({layerId:r.layerID,type:r.type,name:r.name,order:r.order,activeColor:r.activeColor.toString(),activeColorAlpha:r.activeColor.alpha,deactiveColor:r.deactiveColor.toString(),deactiveColorAlpha:r.deactiveColor.alpha,visible:r.visible,locked:r.locked,active:r.active,layerStatus:r.layerStatus}))),o.messageBus.rpcService("pcb/extensionAPI/pcblayer-selectLayerById",async e=>{let{layerId:r}=e;return Pe.setActiveLayerId(+r),o.publish("flushService",""),o.publish("updateFrame",""),!0}),o.messageBus.rpcService("pcb/extensionAPI/pcblayer-setLayerStatus",async e=>{let{layerIds:r,visible:i,locked:n,setOtherLayerInvisible:s=!1,setOtherLayerVisible:a=!1}=e;if(typeof r>"u"||r.length<=0){let l=Pe.getAllLayer();for(let c=0;c<l.length;c++)wfe(l[c],{visible:i,locked:n});return o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),wm.getInstance().updateLayerInfo(),!0}for(let l=0;l<r.length;l++){let c=r[l],h=Pe.getLayer(+c);if(!h)return!1;let u=Pe.getAllLayer();if(s)for(let d=0;d<u.length;d++)r.indexOf(u[d].layerID)>=0||wfe(u[d],{visible:!1});if(a)for(let d=0;d<u.length;d++)r.indexOf(u[d].layerID)>=0||wfe(u[d],{visible:!0});wfe(h,{visible:i,locked:n})}return o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),wm.getInstance().updateLayerInfo(),!0}),o.messageBus.rpcService("pcb/extensionAPI/pcblayer-setLayerData",async e=>{let{layerList:r}=e;return nqe(r.map(i=>({activeColor:i.activeColor,activeColorAlpha:i.activeColorAlpha,deactiveColor:i.deactiveColor,deactiveColorAlpha:i.deactiveColorAlpha,layerId:i.layerId,layerName:i.name,layerType:i.type,locked:i.locked,referenceLayerId:i.layerId,status:i.layerStatus}))),QI(!0),await oqe(),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),!0}),o.messageBus.rpcService("pcb/extensionAPI/pcblayer-setLayerThemeProfile",async e=>!e.canvasColorTheme||!e.canvasColorTheme.length||!e.canvasColorThemeSelected?!1:(le.updatePcbLayerByThemeCall(e),!0))}function aqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/pcbmanufacturedata-getGerberFile",async e=>{try{return await CV(e)}catch(r){return console.warn(r),{__isError:!0,__message:r.message}}}),o.messageBus.rpcService("pcb/extensionAPI/pcbmanufacturedata-get3DShellFile",async e=>{try{return await ROe(e)}catch(r){return console.warn(r),{__isError:!0,__message:r.message}}}),o.messageBus.rpcService("pcb/extensionAPI/pcbmanufacturedata-getSourcePCBInfo",async e=>JSON.parse(JSON.stringify(new RR))),o.messageBus.rpcService("pcb/extensionAPI/pcbmanufacturedata-getIPC_D_356AFile",async e=>bze(e))}function lqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/math-convertImageToComplexPolygon",async e=>{let{data:r}=e,i=new Array;return K3(r.path).forEach(s=>{let a=o1(s);i.push(a)}),i}),o.messageBus.rpcService("pcb/extensionAPI/math-getCenter",async e=>{let r=m2(e);return new rI(r).center})}function cqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/pcbnet-getAllNetsInfo",async()=>{let e=Ye.getAllNets(),r=[];return e&&e.forEach(i=>{r.push({net:i,color:Ye.getSpecialColor(i),length:Ye.getNetLength(i)*10})}),r}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-getNet",async e=>{let{net:r}=e;return Ye.getAllNets().includes(r)?{net:r,color:Ye.getSpecialColor(r),length:Ye.getNetLength(r)*10}:void 0}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-setNetColor",async e=>{let{net:r,color:i}=e;if(!Ye.getAllNets().includes(r))return!1;if(i){let s=ee.build(i.r,i.g,i.b,i.alpha);return W8([r],s),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),!0}else return!1}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-getAllNets",async()=>Ye.getAllNets()),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-getNetLength",async e=>{let{netName:r}=e;return Ye.getAllNets().includes(r)?Ye.getNetLength(r):void 0}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-getAllPrimitivesByNet",async e=>{let{netName:r,primitiveTypes:i=[]}=e,n=Ye.getSameNetItems(r),s=[];for(let a=0;a<n.length;a++){let l=n[a],c=l.model;c.modelType&&(i.length&&i.indexOf(c)<=-1||s.push(N1(l)))}return s}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-selectNet",async e=>{let{netName:r}=e,i=Ye.getSameNetItems(r),n=new Set;for(let s=0;s<i.length;s++)i[s].click(),n.add(i[s]);return t.setSelect(n),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),!0}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-unselectNet",async e=>{let{netName:r}=e;return t.cancelNetSelect([r]),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),!0}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-unselectAllNets",async()=>{let e=Ye.getAllNets();return t.cancelNetSelect(e),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),!0}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-highlightNet",async e=>{let{netName:r}=e;return WS.getInstance().highLightNets(new Set([r])),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),!0}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-unhighlightNet",async e=>{let{netName:r}=e;return WS.getInstance().unhighLightNets(new Set([r])),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),!0}),o.messageBus.rpcService("pcb/extensionAPI/pcbnet-unhighlightAllNets",async()=>{let e=Ye.getAllNets();return WS.getInstance().unhighLightNets(new Set(e)),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),!0})}function hqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/pcbprimitive-getPrimitivesBBox",async e=>{let r=[];return e.forEach(i=>{let n=ch(i);n&&n.bbox&&r.push(n.bbox)}),r})}function KOe(o){return{primitiveLock:"locked"}[o]||o}function uqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/arc-create",async e=>{let r=new De("create arc for api"),{net:i,layerId:n,startX:s,startY:a,endX:l,endY:c,arcAngle:h,lineWidth:u,interactiveMode:d,primitiveLock:p}=e,m=Pe.getLayer(n),g=new Yn,{center:y,radius:b,startAngle:P,endAngle:T,sweep:I}=g.pointToAngle(new S(s/10,a/10),new S(l/10,c/10),zt.toRadians(h)),C=null;return typeof i<"u"&&m&&m.isSignalLayer()?C=pr.addArcTrack(n,y,b,P,T,I,u/10,!!p,i,d===1?1:2):C=Yc.addArc(n,y,b,u/10,P,T,I,!!p,d===1?1:2),r.addCommand(Ce.dispatch(C,"add")),qe.executeCommand(r),o.publish("hasModifyPcbItem",C),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),{primitiveId:C.model.globalIndex}}),o.messageBus.rpcService("pcb/extensionAPI/arc-delete",async e=>{let r=new De("delete arc for api"),{primitiveIds:i}=e,n=[],s=[],a=new Jt;for(let l=0;l<i.length;l++){let c=a.getItem(i[l]);c&&(r.addCommand(Ce.dispatch(c,"delete")),c.remove(),o.publish("delete",c),s.push(c),n.push(i[l]))}return s.length&&xu(o),qe.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/arc-modify",async e=>{let r=new De("modify arc for api"),{primitiveId:i,data:n}=e,{net:s,layerId:a,startX:l,startY:c,endX:h,endY:u,arcAngle:d,lineWidth:p,interactiveMode:m,primitiveLock:g}=n,b=new Jt().getItem(i);if(!b)return null;if(b instanceof yi){let E=b;if(r.addCommand(Ce.dispatch(E,"modify")),E.net!==s&&(E.net=s),E.layerId!==a)if(Ze.getInstance().getAllSignalLayerIds().includes(a))E.layerId=a;else return null;if(E.start.x!==l/10){let v=new S(l/10,E.start.y);E.start=v}if(E.start.y!==c/10){let v=new S(E.start.x,c/10);E.start=v}if(E.end.x!==h/10){let v=new S(h/10,E.end.y);E.end=v}if(E.end.y!==u/10){let v=new S(E.end.x,u/10);E.end=v}E.angle!==zt.toRadians(d)&&(E.angle=zt.toRadians(d)),E.arcType!==m&&(E.arcType=m),E.width!==p/10&&(E.width=p/10),E.locked!==!!g&&(E.locked=!!g),qe.executeCommand(r),o.publish("hasModifyPcbItem",E),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q());let O=E.toJSON(),_=O.center.add(new S(Math.cos(O.startAngle),Math.sin(O.startAngle)).mul(O.radius)),x=O.center.add(new S(Math.cos(O.endAngle),Math.sin(O.endAngle)).mul(O.radius));return{...O,startX:_.x,startY:_.y,endX:x.x,endY:x.y}}let P=b;if(r.addCommand(Ce.dispatch(P,"modify")),P.layerId!==a)if(Ze.getInstance().getAllSignalLayerIds().includes(a))P.layerId=a;else return null;if(P.start.x!==l/10){let E=new S(l/10,P.start.y);P.start=E}if(P.start.y!==c/10){let E=new S(P.start.x,c/10);P.start=E}if(P.end.x!==h/10){let E=new S(h/10,P.end.y);P.end=E}if(P.end.y!==u/10){let E=new S(P.end.x,u/10);P.end=E}P.width!==p/10&&(P.width=p/10),P.locked!==!!g&&(P.locked=!!g),qe.executeCommand(r),o.publish("hasModifyPcbItem",P),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q());let T=P.toJSON(),I=T.center.add(new S(Math.cos(T.startAngle),Math.sin(T.startAngle)).mul(T.radius)),C=T.center.add(new S(Math.cos(T.endAngle),Math.sin(T.endAngle)).mul(T.radius));return{...T,startX:I.x,startY:I.y,endX:C.x,endY:C.y}}),o.messageBus.rpcService("pcb/extensionAPI/arc-getByIds",async e=>{let{primitiveIds:r}=e,i=[],n=new Jt;for(let s=0;s<r.length;s++){let a=n.getItem(r[s]);if(!a)continue;let l=a.toJSON(),c=a.center.add(new S(Math.cos(a.startAngle),Math.sin(a.startAngle)).mul(a.radius)),h=a.center.add(new S(Math.cos(a.endAngle),Math.sin(a.endAngle)).mul(a.radius));i.push({...l,arcAngle:zt.toDegrees(a.angle),startX:c.x*10,startY:c.y*10,endX:h.x*10,endY:h.y*10})}return i}),o.messageBus.rpcService("pcb/extensionAPI/arc-getAll",async e=>{let{net:r,layerId:i,primitiveLock:n}=e,a=pr.getAllItem().filter(l=>l instanceof yi).map(l=>{let c=l.toJSON(),h=l.center.add(new S(Math.cos(l.startAngle),Math.sin(l.startAngle)).mul(l.radius)),u=l.center.add(new S(Math.cos(l.endAngle),Math.sin(l.endAngle)).mul(l.radius));return{...c,arcAngle:zt.toDegrees(l.angle),startX:h.x*10,startY:h.y*10,endX:u.x*10,endY:u.y*10}});return typeof r<"u"&&(a=Ks(a,KOe("net"),r)),typeof i<"u"&&(a=Ks(a,KOe("layerId"),i)),typeof n<"u"&&(a=Ks(a,KOe("primitiveLock"),n)),a}),o.messageBus.rpcService("pcb/extensionAPI/arc-getAdjacentPrimitives",async e=>new Jt().getItem(e).searchNode().filter(a=>a.globalIndex!==e).filter(a=>typeof a.toJSON=="function").map(a=>N1(a))),o.messageBus.rpcService("pcb/extensionAPI/arc-getEntireTrack",async e=>[...pr.getItem(e).searchAllConnectNode()].filter(n=>typeof n.toJSON=="function").map(n=>N1(n)))}function dqe(o){return{primitiveLock:"locked"}[o]||o}function pqe(o){return o.toLowerCase().replace(/\s+/g,"")}function G5(o,t,e){o.attrKeyText[t]!=null?o.attrKeyText[t].value=e:o.modifyATTRMap(t,e)}function nDt(o,t,e){let r=3;o.layerId==2&&(r=4);let i=le.getDefaultFontSetting(),n=o.generateValidId(),s=ri.rebuild(n,r,t,!1,e,!1,i.defaultComponentFontTypeface,i.defaultComponentFontHeight,o.rotation,!1,S.ORIGIN,3,i.defaultComponentFontStrokeWidth,!1,0,!1,!0);return o.addAttribute(s),s}function fqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/component-create",async e=>{let{deviceUuid:r,footprintUuid:i,layerId:n,x:s,y:a,rotation:l,primitiveLock:c}=e,h=R.getInstance().compilerChannel;await Hi.add(i,h);let u=await ts.add(r,h);if(!u)return{primitiveId:null};let d=new E2,p=nr(),m=d.build(u.createComponent(p),new S(s/10,a/10));m.visible(),m.layerId=n,m.rotation=zt.toRadians(l),$n.rotate(m.position,ut.footprintDefault.rotation,[m]),m.locked=c,m.attributes.forEach(y=>{let b=le.attributeConfig.getAttribute(y.key);b!=null&&(y.showKey=b.showKey,y.showValue=b.showValue)});let g=new De("draw component");return g.addCommand(Ce.dispatch(m,"add")),qe.executeCommand(g),o.publish("hasModifyPcbItem",m),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),m.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/component-delete",async e=>{let r=new De("delete component for API"),{primitiveIds:i}=e,n=[],s=[];for(let a=0;a<i.length;a++){let l=Ar.getItem(i[a]);l&&(r.addCommand(Ce.dispatch(l,"delete")),l.remove(),o.publish("delete",l),s.push(l),n.push(i[a]))}return s.length&&xu(o),qe.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/component-modify",async e=>{let r=new De("Modify Component For API"),{primitiveId:i,data:n}=e,{componentData:s={},layerId:a,x:l,y:c,rotation:h,primitiveLock:u,newAddIntoBom:d,designator:p,name:m,uniqueId:g,manufacturer:y,manufacturerId:b,supplier:P,supplierId:T,otherProperty:I}=n,C=Ar.getItem(i),E=1e-10;if(!C)return null;if(r.addCommand(Ce.dispatch(C,"modify")),C.layerId!==a)if([1,2].includes(a))C.layerId=a;else return null;if(Math.abs(C.position.x-l/10)>E){let O=new S(l/10,C.position.y);C.position=O}if(Math.abs(C.position.y-c/10)>E){let O=new S(C.position.x,c/10);C.position=O}if(C.rotation!==zt.toRadians(h)&&(C.rotation=zt.toRadians(h)),C.locked!==!!u&&(C.locked=!!u),C.attrsMap["Add into BOM"]!==d&&C.modifyATTRMap("Add into BOM",d),C.attrKeyText.Designator.value!==p&&(C.attrKeyText.Designator.value=p),C.attrsMap.Name!==m&&G5(C,"Name",m),C.attrsMap["Unique ID"]!==g&&G5(C,"Unique ID",g),C.attrsMap.Manufacturer!==y&&G5(C,"Manufacturer",y),C.attrsMap["Manufacturer Part"]!==b&&G5(C,"Manufacturer Part",b),C.attrsMap.Supplier!==P&&G5(C,"Supplier",P),C.attrsMap["Supplier Part"]!==T&&G5(C,"Supplier Part",T),typeof I<"u"&&Object.keys(I).length!==0){let O={};for(let _ in C.attrsMap){let x=pqe(_);O[x]||(O[x]=[]),O[x].push(_)}Object.keys(I).forEach(_=>{let x=pqe(_),v=O[x];if(v){let D=I[_];v.forEach(w=>{C.attrsMap[w]!==D&&G5(C,w,D)})}else C.modifyATTRMap(_,I[_])})}return qe.executeCommand(r),o.publish("hasModifyPcbItem",C),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),C.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/component-getByIds",async e=>{let{primitiveIds:r}=e,i=[];for(let n=0;n<r.length;n++){let s=Ar.getItem(r[n]);if(!s)continue;let a={...s.toJSON(),footprintItemId:s.footprintUUID},l=new S(a.position.x*10,a.position.y*10);a.position=l,a.rotation=zt.toDegrees(a.rotation),i.push(a)}return i}),o.messageBus.rpcService("pcb/extensionAPI/component-getAll",async e=>{let{layer:r,primitiveLock:i}=e,s=Ar.getAllItem().map(a=>{let l=a.toJSON(),c=new S(l.position.x*10,l.position.y*10);return l.position=c,l.rotation=zt.toDegrees(l.rotation),{...l,footprintItemId:a.footprintUUID}});return typeof r<"u"&&(s=Ks(s,dqe("layerId"),r)),typeof i<"u"&&(s=Ks(s,dqe("primitiveLock"),i)),s}),o.messageBus.rpcService("pcb/extensionAPI/component-getAllPinsByPrimitiveId",async e=>{let r=Ar.getItem(e);if(!r)return null;let i=[];return r.getPads().forEach(s=>{let a=s.toJSON();a.padRule=s.model.padRule?s.model.padRule:null,a.holeAspect=s.holeShape?[s.holeShape,(s.holeRadius||0)*2,s.holeLength||0]:null,a.padTypeAspect=s.model.padType,a.defaultPadShapeAspect=bU(s.model),a.specialPadShapeAspect=PU(s.model),a.center=new S(je(a.center.x,3,"mil"),je(a.center.y,3,"mil")),a.bottomSolderExpansion=je(a.bottomSolderExpansion,3,"mil"),a.pasteExpansion=je(a.pasteExpansion,3,"mil"),a.topSolderExpansion=je(a.topSolderExpansion,3,"mil"),a.rotation=zt.toDegrees(a.rotation),i.push(a)}),i}),o.messageBus.rpcService("pcb/extensionAPI/component-setAttribute",async e=>{let r=new De("Set Attribute For API"),{primitiveId:i,visible:n}=e,s=Ar.getItem(i);if(!s)return null;if(r.addCommand(Ce.dispatch(s,"modify")),typeof n<"u"){let a=Object.keys(n)[0],l=Object.values(n)[0].value.toString();if(s.attrKeyText[a]==null){let h=nDt(s,a,l)}let c=s.attrKeyText[a];typeof n[a].keyVisible=="boolean"&&(c.showKey=n[a].keyVisible),typeof n[a].valueVisible=="boolean"&&(c.showValue=n[a].valueVisible)}return qe.executeCommand(r),o.publish("hasModifyPcbItem",s),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),s.toJSON()})}function mqe(o){return{primitiveLock:"locked",layer:"layerId"}[o]||o}function gqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/dimension-create",async e=>{let r=new De("create dimension for api"),{dimensionType:i,coordinateSet:n,layer:s,unit:a,lineWidth:l,precision:c,primitiveLock:h,textHeight:u}=e,d=null,p,m,g,y,b;if(i==="Length Dimension")m=new S(n[0]/10,n[1]/10),p=new S(n[2]/10,n[3]/10),y=new S(n[4]/10,n[5]/10),g=new S(n[6]/10,n[7]/10),d=Yo.addDimension(s,p,y,m,g,c,u?u/10:10,l/10,a,h);else if(i==="Radius Dimension"){y=new S(n[0]/10,n[1]/10),p=new S(n[2]/10,n[3]/10);let P=n[4]/10,T=n[4];d=jo.addRadius(s,p,y,T,u?u/10:8,P,c,a,h)}else i==="Protractor Dimension"&&(p=new S(n[0]/10,n[1]/10),b=new S(n[2]/10,n[3]/10),y=new S(n[4]/10,n[5]/10),d=os.addProtractor(s,l/10,u?u/10:4.5,c,b,p,y,h));return r.addCommand(Ce.dispatch(d,"add")),qe.executeCommand(r),o.publish("hasModifyPcbItem",d),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),{primitiveId:d?d.model.globalIndex:void 0}}),o.messageBus.rpcService("pcb/extensionAPI/dimension-delete",async e=>{let r=new De("delete dimension for api"),{primitiveIds:i}=e,n=[],s=[],a=new Jt;for(let l=0;l<i.length;l++){let c=a.getItem(i[l]);c&&(r.addCommand(Ce.dispatch(c,"delete")),c.remove(),o.publish("delete",c),s.push(c),n.push(i[l]))}return s.length&&xu(o),qe.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/dimension-modify",async e=>{let r=new De("modify dimension for api"),{primitiveId:i,data:n}=e,{dimensionType:s,coordinateSet:a,layerId:l,unit:c,lineWidth:h,precision:u,primitiveLock:d}=n,m=new Jt().getItem(i);if(!m)return null;if(m instanceof qs){if(r.addCommand(Ce.dispatch(m,"modify")),typeof l<"u")if(Un.abstractDimension().some(y=>y.value===l))m.layerId=l;else return null;typeof h<"u"&&(m.width=h/10),typeof u<"u"&&(m.precision=u),typeof d<"u"&&(m.locked=d),typeof c<"u"&&(m.unit=c),typeof a<"u"&&(m.left=new S(a[0]/10,a[1]/10),m.start=new S(a[2]/10,a[3]/10),m.end=new S(a[4]/10,a[5]/10),m.right=new S(a[6]/10,a[7]/10))}else m instanceof da?(r.addCommand(Ce.dispatch(m,"modify")),typeof l<"u"&&(m.layerId=l),typeof h<"u"&&(m.width=h/10),typeof u<"u"&&(m.precision=u),typeof d<"u"&&(m.locked=d),typeof c<"u"&&(m.unit=c),typeof a<"u"&&(m.end=new S(a[0]/10,a[1]/10),m.start=new S(a[2]/10,a[3]/10),m.textPosition=new S(a[4]/10,a[5]/10))):m instanceof Ga&&(r.addCommand(Ce.dispatch(m,"modify")),typeof l<"u"&&(m.layerId=l),typeof h<"u"&&(m.width=h/10),typeof u<"u"&&(m.precision=u),typeof d<"u"&&(m.locked=d),typeof a<"u"&&(m.start=new S(a[0]/10,a[1]/10),m.center=new S(a[2]/10,a[3]/10),m.end=new S(a[4]/10,a[5]/10)));return qe.executeCommand(r),o.publish("hasModifyPcbItem",m),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),m.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/dimension-getByIds",async e=>{let{primitiveIds:r}=e,i=[],n=new Jt;for(let s=0;s<r.length;s++){let a=n.getItem(r[s]);if(!a)continue;let l=a.toJSON();l.width=l.width*10,i.push({...l,dimensionType:a.type,coordinateSet:a.type==="Length Dimension"?vfe(a):a.type==="Radius Dimension"?_fe(a):xfe(a),unit:R.getInstance().unit})}return i}),o.messageBus.rpcService("pcb/extensionAPI/dimension-getAll",async e=>{let{layer:r,primitiveLock:i}=e,n=Yo.getAllItem(),s=jo.getAllItem(),a=os.getAllItem(),l=[].concat(n,s,a).map(c=>{let h=c.toJSON();return h.width=h.width*10,{...h,dimensionType:c.type,coordinateSet:c.type==="Length Dimension"?vfe(c):c.type==="Radius Dimension"?_fe(c):xfe(c),unit:R.getInstance().unit}});return typeof r<"u"&&(l=Ks(l,mqe("layer"),r)),typeof i<"u"&&(l=Ks(l,mqe("primitiveLock"),i)),l})}function yC(o,t,e,r,i,n,s,a=!1){let l=o;if(r=ru(r,e,t),s=s[0]instanceof Array?s:[s],s.length==1&&s[0].length==0)return;let c=new Array;for(let u of s)if(u[0]=="CIRCLE"||u[0]=="C"){let d=new S(parseFloat(u[1])/10,parseFloat(u[2])/10),p=parseFloat(u[3])/10;return a?Fi.getInstance().addCircle(l,t,e,d,p,n,i,r):new Ip(l,t,e,d,p,n,i,r,null,null)}else if(u[0]=="R"){let d=new S(parseFloat(u[1])/10,parseFloat(u[2])/10),p=parseFloat(u[3])/10,m=parseFloat(u[4])/10,g=parseFloat(u[5])/180*Math.PI;isNaN(g)&&(g=0);let y;return this.version<"1.5"?y=Math.min(p,m)/2*(parseFloat(u[6])||0):y=(parseFloat(u[6])||0)/10,a?Qi.getInstance().addRect(l,t,e,d,p,m,r,i,n,g,y):new Sp(l,t,e,d,p,m,g,y,r,n,i,null,null)}else{let d=new S(parseFloat(u[0])/10,parseFloat(u[1])/10),p=new Yn,m=new Tn,g=!1,y={layerId:e,strokeWidth:n,locked:i};for(let T=2,I=u.length;T<I;)if(u[T]=="L"){let C=new S(parseFloat(u[T+1])/10,parseFloat(u[T+2])/10),E=nr(),O=new wc(E,d,C,y);m.addLast(O),d=C,T+=3,g=!0}else if(u[T]=="ARC"||u[T]=="CARC"){g=!1;let C=parseFloat(u[T+1])/180*Math.PI,E=new S(parseFloat(u[T+2])/10,parseFloat(u[T+3])/10);if(ne.greater(zt.regular(C),0)&&!d.equals1(E)){let{center:O,radius:_,startAngle:x,endAngle:v,sweep:D}=p.pointToAngle(d,E,C),w=null;u[T]=="ARC"?w=1:w=2;let F=nr(),H=new zc(F,O,_,x,v,D,y,w);m.addLast(H)}d=E,T+=4}else if(g){let C=new S(parseFloat(u[T])/10,parseFloat(u[T+1])/10),E=nr(),O=new wc(E,d,C,y);m.addLast(O),d=C,T+=2}let b=m.toArray();m.clear();let P=0;for(let T of b)if(P+=T.length,P>1e-8)break;if(P<1e-8||e!=11&&Bu(t)&&!Qh(b.map(T=>T.primitive),1e-4)){for(let T of b)T.remove();return null}b.length>0&&c.push(b)}let h=a?vi.getInstance().addPolygon(l,t,e,c,n,r,i,null,null):new Ep(l,t,e,c,n,r,i,null,null);return h.type=="Board Outline"&&!h.isClose()&&(h.type="Line"),h}function ZOe(o){return{primitiveLock:"locked",layer:"layerId"}[o]||o}function Lfe(){let o=pt.getAllItem().filter(r=>r.type==="Fill Region"||r.type==="Slot Region"),t=Xt.getAllItem().filter(r=>r.type==="Fill Region"||r.type==="Slot Region"),e=Kt.getAllItem().filter(r=>r.type==="Fill Region"||r.type==="Slot Region");return[].concat(o,t,e).filter(r=>!r.getParent())}function JOe(o){let t,e=o.getSelects();return e.length===1&&e[0]instanceof Le&&(t=e[0].globalIndex),new Zi(t)}function yqe(o,t,e){let r=null;if(e.modelType==="Circle")t!==12&&(e.component=JOe(o)),r=Kt.addCircleByModel(e);else if(e.modelType==="Rect")t!==12&&(e.component=JOe(o)),r=Xt.addRectByModel(e);else if(e.modelType==="Polygon"){t!==12&&(e.component=JOe(o));let i=new Array;for(let n of e.childrens){let s=new Array;for(let a of n)s.push(Xc(a));i.push(s)}r=pt.addPolygonByModel(e,i)}return r}function oDt(o,t){if(o.length!==t.length)return!1;for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}function Mfe(o,t){t&&o.publish("hasModifyPcbItem",t),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q())}function bqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/fill-create",async e=>{let r=new De("create fill for api"),{layer:i,complexPolygon:n,net:s,lineWidth:a,primitiveLock:l}=e,c=nr(),h=yC(c,i==12?"Slot Region":"Fill Region",i,s,!!l,a/10,n,!0),u=yqe(t,i,h);return r.addCommand(Ce.dispatch(u,"add")),qe.executeCommand(r),Mfe(o,u),{primitiveId:u.globalIndex,lineWidth:u.strokeWidth*10}}),o.messageBus.rpcService("pcb/extensionAPI/fill-delete",async e=>{let r=new De("delete fill for api"),{primitiveIds:i}=e,n=[],s=[],a=new Jt;for(let l=0;l<i.length;l++){let c=a.getItem(i[l]);c&&(r.addCommand(Ce.dispatch(c,"delete")),c.remove(),o.publish("delete",c),s.push(c),n.push(i[l]))}return s.length&&xu(o),qe.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/fill-modify",async e=>{let r=new De("modify fill for api"),{primitiveId:i,data:n}=e,{layerId:s,polygonSource:a,net:l,lineWidth:c,primitiveLock:h}=n,u=Lfe(),p=u.map(b=>b.globalIndex).indexOf(i);if(p<=-1)return;let m=u[p],g=k1(m);if(!oDt(g[0],a)){let b=new De("modify shape for fill api");t.clearSelect(),b.addCommand(Ce.dispatch(m,"delete")),t.setSelect([m]),o.publish("removeSelect","");let P=yC(i,s==12?"Slot Region":"Fill Region",s,l,!!h,c/10,a,!0);if(P.modelType=="Circle"||P.modelType=="Rect"||P.modelType=="Polygon"){let T=yqe(t,s,P);return b.addCommand(Ce.dispatch(T,"add")),qe.executeCommand(b),Mfe(o,T),{primitiveId:T.globalIndex,lineWidth:T.strokeWidth*10}}else return null}if(r.addCommand(Ce.dispatch(m,"modify")),typeof s<"u")if(Un.fixLayerOptions(s,Un.createLayerOptionsByLineloop(m)).some(P=>P.value===s))m.layerId=s;else return null;typeof l<"u"&&(m.net=l),m.strokeWidth!==c/10&&(m.strokeWidth=c/10),typeof h<"u"&&(m.locked=!!h),qe.executeCommand(r),Mfe(o,m);let y=m.toJSON();return y.polygonSource=a,delete y.componentData,delete y.silkColor,y}),o.messageBus.rpcService("pcb/extensionAPI/fill-getByIds",async e=>{let{primitiveIds:r}=e,i=[],n=Lfe(),s=n.map(a=>a.globalIndex);for(let a=0;a<r.length;a++){let l=s.indexOf(r[a]);if(l<=-1)continue;let c=n[l],h=c.toJSON();delete h.componentData,delete h.shapes,delete h.silkColor;let u=k1(c);h.path=u,h.strokeWidth=h.strokeWidth*10,i.push(h)}return i}),o.messageBus.rpcService("pcb/extensionAPI/fill-getAll",async e=>{let{layer:r,net:i,primitiveLock:n}=e,s=Lfe(),a=s.map(l=>{let c=l.toJSON();return{...c,strokeWidth:c.strokeWidth*10}});for(let l=0;l<a.length;l++)a[l].path=k1(s[l]),delete a[l].componentData,delete a[l].shapes,delete a[l].silkColor;return typeof r<"u"&&(a=Ks(a,ZOe("layer"),r)),typeof i<"u"&&(a=Ks(a,ZOe("net"),i)),typeof n<"u"&&(a=Ks(a,ZOe("primitiveLock"),n)),a}),o.messageBus.rpcService("pcb/extensionAPI/fill-convertToType",async e=>{let r=new De("modify type for fill api"),{primitiveId:i,type:n}=e,s=Lfe(),l=s.map(u=>u.globalIndex).indexOf(i);if(l<=-1)return;let c=s[l];r.addCommand(Ce.dispatch(c,"modify"));let h=c.toJSON();return n=="line"?c.type="Line":n=="copper"?(c.type="Copper Region",h.copperInfo=c.component.toJSON(),un.addOrder(c,r),h.pourPriority=un.getOrder(c.globalIndex)+1):n=="region"&&(c.type="Prohibited Region"),delete h.componentData,delete h.silkColor,qe.executeCommand(r),Mfe(o,c),h})}function Pqe(o){return{primitiveLock:"locked",layer:"layerId"}[o]||o}function Tqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/image-create",async e=>{let r=new De("create image for api"),{x:i,y:n,complexPolygon:s,layer:a,width:l,height:c,rotation:h,horizonMirror:u,primitiveLock:d}=e,p=Jh(s),m=Bn.addImage(a,new S(i/10,n/10),l/10,c/10,zt.toRadians(h),u,d,p);return r.addCommand(Ce.dispatch(m,"add")),qe.executeCommand(r),o.publish("hasModifyPcbItem",m),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),{primitiveId:m.model.globalIndex}}),o.messageBus.rpcService("pcb/extensionAPI/image-delete",async e=>{let r=new De("delete image for api"),{primitiveIds:i}=e,n=[],s=[];for(let a=0;a<i.length;a++){let l=Bn.getItem(i[a]);l&&(r.addCommand(Ce.dispatch(l,"delete")),l.remove(),o.publish("delete",l),s.push(l),n.push(i[a]))}return s.length&&xu(o),qe.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/image-modify",async e=>{let r=new De("modify image for api"),{primitiveId:i,data:n}=e,{x:s,y:a,complexPolygon:l,layerId:c,width:h,height:u,rotation:d,horizonMirror:p,primitiveLock:m}=n,g=Bn.getItem(i),y=1e-10;if(!g)return null;if(r.addCommand(Ce.dispatch(g,"modify")),Math.abs(g.start.x-s/10)>y){let b=new S(s/10,g.start.y);g.start=b}if(Math.abs(g.start.y-a/10)>y){let b=new S(g.start.x,a/10);g.start=b}if(typeof c<"u")if(Un.image().some(P=>P.value===c))g.layerId=c;else return null;return g.width!==h/10&&(g.width=h/10),g.height!==u/10&&(g.height=u/10),g.rotation!==zt.toRadians(d)&&(g.rotation=zt.toRadians(d)),typeof p<"u"&&(g.mirror=p),typeof m<"u"&&(g.locked=!!m),qe.executeCommand(r),o.publish("hasModifyPcbItem",g),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),g.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/image-getByIds",async e=>{let{primitiveIds:r}=e,i=[];for(let n=0;n<r.length;n++){let s=Bn.getItem(r[n]);if(!s)continue;let a=s.toJSON(),l=s.model.modelType==="Image"?"Image":"Picture",c=s instanceof Mn?zb(s.getRealPath()).join(" "):"";a.imageType=l,a.pathString=c,a.start=new S(a.start.x*10,a.start.y*10),a.height=a.height*10,a.width=a.width*10,a.rotation=zt.toDegrees(a.rotation),i.push(a)}return i}),o.messageBus.rpcService("pcb/extensionAPI/image-getAll",async e=>{let{layer:r,primitiveLock:i}=e,n=Bn.getAllItem(),s=So.getAllItem(),a=[].concat(n,s).map(l=>({...l.toJSON(),start:new S(l.start.x*10,l.start.y*10),height:l.height*10,width:l.width*10,rotation:zt.toDegrees(l.rotation),imageType:l.model.modelType==="Image"?"Image":"Picture",pathString:l instanceof Mn?zb(l.getRealPath()).join(" "):""}));return typeof r<"u"&&(a=Ks(a,Pqe("layer"),r)),typeof i<"u"&&(a=Ks(a,Pqe("primitiveLock"),i)),a})}function Iqe(o){return{primitiveLock:"locked",layer:"layerId"}[o]||o}function Cqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/object-create",async e=>{let r=new De("create object for api"),{layer:i,topLeftX:n,topLeftY:s,binaryData:a,width:l,height:c,rotation:h,mirror:u,fileName:d,primitiveLock:p}=e,m=R.getInstance().compiler.uploadBlob(d,a);if(!m.success)return;let g=m.hash;if(!qd.getItem(g)){let P=new Image;P.src=a,qd.addTemplate(g,d,P)}let b=So.addImage(i,new S(n/10,s/10),l/10,c/10,zt.toRadians(h),u,p,g);return r.addCommand(Ce.dispatch(b,"add")),qe.executeCommand(r),o.publish("hasModifyPcbItem",b),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),{primitiveId:b.model.globalIndex}}),o.messageBus.rpcService("pcb/extensionAPI/object-delete",async e=>{let r=new De("delete object for api"),{primitiveIds:i}=e,n=[],s=[];for(let a=0;a<i.length;a++){let l=So.getItem(i[a]);l&&(r.addCommand(Ce.dispatch(l,"delete")),l.remove(),o.publish("delete",l),s.push(l),n.push(i[a]))}return s.length&&xu(o),qe.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/object-modify",async e=>{let r=new De("modify object for api"),{primitiveId:i,data:n}=e,{topLeftX:s,topLeftY:a,layerId:l,width:c,height:h,rotation:u,mirror:d,primitiveLock:p}=n,m=So.getItem(i),g=1e-10;if(!m)return null;if(r.addCommand(Ce.dispatch(m,"modify")),Math.abs(m.start.x-s/10)>g){let y=new S(s/10,m.start.y);m.start=y}if(Math.abs(m.start.y-a/10)>g){let y=new S(m.start.x,a/10);m.start=y}if(typeof l<"u")if(Un.trueColorImage().some(b=>b.value===l))m.layerId=l;else return null;return m.width!==c/10&&(m.width=c/10),m.height!==h/10&&(m.height=h/10),m.rotation!==zt.toRadians(u)&&(m.rotation=zt.toRadians(u)),typeof d<"u"&&(m.mirror=d),typeof p<"u"&&(m.locked=!!p),qe.executeCommand(r),o.publish("hasModifyPcbItem",m),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),m.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/object-getByIds",async e=>{let{primitiveIds:r}=e,i=[];for(let n=0;n<r.length;n++){let s=So.getItem(r[n]);if(!s)continue;let a=s.toJSON(),l="Picture",c="";a.imageType=l,a.pathString=c,a.start=new S(a.start.x*10,a.start.y*10),a.height=a.height*10,a.width=a.width*10,a.rotation=zt.toDegrees(a.rotation),i.push(a)}return i}),o.messageBus.rpcService("pcb/extensionAPI/object-getAll",async e=>{let{layer:r,primitiveLock:i}=e,s=So.getAllItem().map(a=>({...a.toJSON(),start:new S(a.start.x*10,a.start.y*10),height:a.height*10,width:a.width*10,rotation:zt.toDegrees(a.rotation),imageType:"Picture",pathString:""}));return typeof r<"u"&&(s=Ks(s,Iqe("layer"),r)),typeof i<"u"&&(s=Ks(s,Iqe("primitiveLock"),i)),s})}function Sqe(o){return{Divergent:0,"Direct-connected":1,"Non-connected":2}[o]}function sDt(o){return/^\d+$/.test(o)?o:o.replace(/-/g,"").toUpperCase()}function Eqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/pad-create",async e=>{let r=new De("create pads for api"),{layer:i,padNumber:n,x:s,y:a,rotation:l,pad:c,net:h,hole:u,holeOffsetX:d,holeOffsetY:p,holeRotation:m,metallization:g,padType:y,specialPad:b,solderMaskAndPasteMaskExpansion:P,heatWelding:T,primitiveLock:I}=e,C=c[0],E=c[1],O=c[2],_=C==="RECT"?c[3]/100:null,x=u?u[0]:null,v=null,D=null;u&&(u[0]==="ROUND"?(v=null,D=u[1]/2/10):(D=u[1]/2/10,v=u[2]/10));let w=P?2:1,F=P?(P==null?void 0:P.topPasteMask)/10:null,H=P?(P==null?void 0:P.topSolderMask)/10:null,z=P?(P==null?void 0:P.bottomSolderMask)/10:null,V=T?T==null?void 0:T.divergenceAngle:null,W=T?T==null?void 0:T.divergenceLineWidth:null,L=T?T==null?void 0:T.divergenceSpacing:null,k=T?T==null?void 0:T.connectionMethod:null,N;V||W||L||k?N=q0.buildByJson({lineAngle:zt.toRadians(V),lineWidth:W/10,lineClearance:L/10,connectMode:Sqe(k)}):N=null;let U=Qt.addPad(+i,1,n,new S(s/10,a/10),C,E/10,O/10,_!==null?_:E/10/2,C,E/10,O/10,_!==null?_:E/2,C,E/10,O/10,_!==null?_:E/10/2,zt.toRadians(l),I,h,w,F,H,z,[],g,v,D,x,zt.toRadians(m),new S(d/10,p/10),N,y);return U.num=sDt(n),r.addCommand(Ce.dispatch(U,"add")),qe.executeCommand(r),o.publish("hasModifyPcbItem",U),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),{primitiveId:U.model.globalIndex}}),o.messageBus.rpcService("pcb/extensionAPI/pad-delete",async e=>{let r=new De("delete Pads for api"),{primitiveIds:i}=e,n=[],s=[];for(let a=0;a<i.length;a++){let l=Qt.getItem(i[a]);l&&(r.addCommand(Ce.dispatch(l,"delete")),l.remove(),o.publish("delete",l),s.push(l),n.push(i[a]))}return s.length&&xu(o),qe.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/pad-modify",async e=>{let r=new De("modify pads for api"),{primitiveId:i,data:n}=e,{layerId:s,padNumber:a,x:l,y:c,rotation:h,pad:u,net:d,hole:p,holeOffsetX:m,holeOffsetY:g,holeRotation:y,metallization:b,padFunction:P,specialPad:T,solderMaskAndPasteMaskExpansion:I,heatWelding:C,primitiveLock:E}=n,O=u[0],_=u[1],x=u[2],v=O==="RECT"?u[3]/100:0,D=p?p[0]:null,w=null,F=null;p&&(p[0]==="ROUND"?(w=null,F=p[1]/2/10):(F=p[1]/2/10,w=p[2]/10));let H=I?I==null?void 0:I.topPasteMask:null,z=I?I==null?void 0:I.bottomPasteMask:null,V=H||z,W=I?I==null?void 0:I.topSolderMask:null,L=I?I==null?void 0:I.bottomSolderMask:null,k=C?C==null?void 0:C.divergenceAngle:null,N=C?C==null?void 0:C.divergenceLineWidth:null,U=C?C==null?void 0:C.divergenceSpacing:null,B=C?C==null?void 0:C.connectionMethod:null,G=Qt.getItem(i);if(!G)return null;if(r.addCommand(Ce.dispatch(G,"modify")),typeof d<"u"&&(G.net=d),typeof l<"u"){let Y=new S(l/10,G.center.y);G.center=Y}if(typeof c<"u"){let Y=new S(G.center.x,c/10);G.center=Y}return typeof h<"u"&&(G.rotation=zt.toRadians(h)),typeof s<"u"&&(G.layerId=+s),typeof a<"u"&&(G.num=a),typeof u<"u"&&(+s===1?G.top=Lo.getStyle(O,_,x,v,null):+s===2?G.bottom=Lo.getStyle(O,_,x,v,null):(G.top=Lo.getStyle(O,_,x,v,null),G.bottom=Lo.getStyle(O,_,x,v,null),G.inner=Lo.getStyle(O,_,x,v,null))),typeof _<"u"&&(G.topWidth=_/10,G.innerWidth=_/10,G.bottomWidth=_/10),typeof x<"u"&&(G.topHeight=x/10,G.innerHeight=x/10,G.bottomHeight=x/10),typeof p<"u"&&(G.hole=new Mv(w||G.holeLength,F||G.holeRadius,D||G.holeShape,y?zt.toRadians(y):G.holeRotation,new S(m/10||G.holeOffset.x,g/10||G.holeOffset.y))),typeof C<"u"&&(G.padRule=q0.buildByJson({lineAngle:zt.toRadians(k),lineWidth:N/10,lineClearance:U/10,connectMode:Sqe(B)})),typeof I<"u"&&(G.padExpansion=new Bk(2,V/10||G.pasteExpansion,W/10||G.topSolderExpansion,L/10||G.bottomSolderExpansion)),typeof E<"u"&&(G.locked=!!E),typeof b<"u"&&(G.plated=b),qe.executeCommand(r),o.publish("hasModifyPcbItem",G),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),G.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/pad-getByIds",async e=>{let{primitiveIds:r}=e,i=[],n=new Jt;for(let s=0;s<r.length;s++){let a=n.getItem(r[s]);if(!a)continue;let l=a.toJSON();l.padRule=a.model.padRule?a.model.padRule:null;let c=null;a.holeShape==="ROUND"?c=[a.holeShape,(a.holeRadius*10||0)*2]:a.holeShape=="SLOT"&&(c=[a.holeShape,(a.holeRadius*10||0)*2,a.holeLength*10||0]),l.holeAspect=c,l.padTypeAspect=a.model.padType,l.defaultPadShapeAspect=bU(a.model),l.specialPadShapeAspect=PU(a.model),i.push(l)}return i}),o.messageBus.rpcService("pcb/extensionAPI/pad-getAll",async e=>Qt.getAllItem().map(n=>{let s=null;return n.holeShape==="ROUND"?s=[n.holeShape,(n.holeRadius*10||0)*2]:n.holeShape=="SLOT"&&(s=[n.holeShape,(n.holeRadius*10||0)*2,n.holeLength*10||0]),{...n.toJSON(),padRule:n.model.padRule?n.model.padRule:null,holeAspect:s,padTypeAspect:n.model.padType,defaultPadShapeAspect:bU(n.model),specialPadShapeAspect:PU(n.model)}})),o.messageBus.rpcService("pcb/extensionAPI/pad-getConnectedPrimitives",async e=>Qt.getItem(e).searchNode().filter(s=>s.globalIndex!==e).filter(s=>typeof s.toJSON=="function").map(s=>N1(s)))}function QOe(o){return{primitiveLock:"locked"}[o]||o}function eAe(){let o=pt.getAllItem().filter(r=>r.type==="Line"||r.type==="Board Outline"),t=Xt.getAllItem().filter(r=>r.type==="Line"||r.type==="Board Outline"),e=Kt.getAllItem().filter(r=>r.type==="Line"||r.type==="Board Outline");return[].concat(o,t,e)}function aDt(o){let t=pt.getItem(o),e=Xt.getItem(o),r=Kt.getItem(o);if(t)return t;if(e)return e;if(r)return r}function Oqe(o){let t=null;if(o.modelType==="Circle")t=Kt.addCircleByModel(o);else if(o.modelType==="Line")t=Cu.addByModel(o);else if(o.modelType==="Rect")t=Xt.addRectByModel(o);else if(o.modelType==="Polygon"){let e=new Array;for(let r of o.childrens){let i=new Array;for(let n of r)i.push(Xc(n));e.push(i)}t=pt.addPolygonByModel(o,e)}return t}function lDt(o,t){if(o.length!==t.length)return!1;for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}function Nfe(o,t){t&&o.publish("hasModifyPcbItem",t),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q())}function Aqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/polylines-create",async e=>{let r=new De("create polyline for api"),{net:i,layerId:n,polygonSource:s,lineWidth:a,primitiveLock:l}=e,c=nr(),h=yC(c,"Line",n,i,!!l,a/10,s,!0),u=Oqe(h);return r.addCommand(Ce.dispatch(u,"add")),qe.executeCommand(r),Nfe(o,u),{primitiveId:u.globalIndex}}),o.messageBus.rpcService("pcb/extensionAPI/polylines-delete",async e=>{let r=new De("delete polyline for api"),{primitiveIds:i}=e,n=[],s=[],a=new Jt;for(let l=0;l<i.length;l++){let c=a.getItem(i[l]);c&&(r.addCommand(Ce.dispatch(c,"delete")),c.remove(),o.publish("delete",c),s.push(c),n.push(i[l]))}return s.length&&xu(o),qe.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/polylines-modify",async e=>{let r=new De("modify polyline for api"),{primitiveId:i,data:n}=e,{net:s,layerId:a,polygonSource:l,lineWidth:c,primitiveLock:h}=n,u=nr(),d=aDt(i);if(!d)return null;let p=k1(d);if(!lDt(p[0],l)){let m=new De("modify shape for polyline api");t.clearSelect(),m.addCommand(Ce.dispatch(d,"delete")),t.setSelect([d]),o.publish("removeSelect","");let g=yC(u,"Line",a,s,!!h,c/10,l,!0);if(g.modelType=="Circle"||g.modelType=="Rect"||g.modelType=="Polygon"||g.modelType==="Line"){let y=Oqe(g);return m.addCommand(Ce.dispatch(y,"add")),qe.executeCommand(m),Nfe(o,y),{primitiveId:y.globalIndex}}else return null}if(r.addCommand(Ce.dispatch(d,"modify")),typeof s<"u"&&(d.net=s),typeof a<"u")if(Un.fixLayerOptions(a,Un.createLayerOptionsByLineloop(d)).some(g=>g.value===a))d.layerId=a;else return null;return d.strokeWidth!==c/10&&(d.strokeWidth=c/10),typeof h<"u"&&(d.locked=!!h),qe.executeCommand(r),Nfe(o,d),d.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/polylines-getByIds",async e=>{let{primitiveIds:r}=e,i=[],n=eAe(),s=n.map(a=>a.globalIndex);for(let a=0;a<r.length;a++){let l=s.indexOf(r[a]);if(l<=-1)continue;let c=n[l],h=c.toJSON();delete h.componentData,delete h.shapes;let u=k1(c);h.path=u,h.strokeWidth=h.strokeWidth*10,i.push(h)}return i}),o.messageBus.rpcService("pcb/extensionAPI/polylines-getAll",async e=>{let{net:r,layerId:i,primitiveLock:n}=e,s=eAe().filter(l=>!l.getParent()),a=s.map(l=>{let c=l.toJSON();return{...c,strokeWidth:c.strokeWidth*10}});typeof r<"u"&&(a=Ks(a,QOe("net"),r)),typeof i<"u"&&(a=Ks(a,QOe("layerId"),i)),typeof n<"u"&&(a=Ks(a,QOe("primitiveLock"),n));for(let l=0;l<a.length;l++)delete a[l].componentData,delete a[l].shapes,a[l].path=k1(s[l]);return a}),o.messageBus.rpcService("pcb/extensionAPI/polylines-convertToType",async e=>{let r=new De("modify type for polyline api"),{primitiveId:i,type:n}=e,s=eAe(),l=s.map(u=>u.globalIndex).indexOf(i);if(l<=-1)return;let c=s[l];r.addCommand(Ce.dispatch(c,"modify"));let h=c.toJSON();return n=="fill"?c.type="Fill Region":n=="copper"?(c.type="Copper Region",h.copperInfo=c.component.toJSON(),un.addOrder(c,r),h.pourPriority=un.getOrder(c.globalIndex)+1):n=="region"&&(c.type="Prohibited Region"),delete h.componentData,delete h.silkColor,qe.executeCommand(r),Nfe(o,c),h})}function tAe(o){return{primitiveLock:"locked",layer:"layerId"}[o]||o}function kfe(){let o=pt.getAllItem().filter(r=>r.type==="Copper Region"),t=Xt.getAllItem().filter(r=>r.type==="Copper Region"),e=Kt.getAllItem().filter(r=>r.type==="Copper Region");return[].concat(o,t,e)}function rAe(o,t,e,r){let i=Ti.nameManager.getNum(r||"pour1");Ti.nameManager.add(i);let{style:n,gridLineWidth:s,clearance:a,keepIsland:l,optimization:c,optimizationValue:h}=Gf.fillComponent,u=un.getNextOrders4Layer(o);return new xn(t||n,s,a,e||l,c,i,u,h)}function _qe(o,t,e,r){let i=null;if(o.modelType==="Circle")o.component=rAe(o.layerId,t,e,r),i=Kt.addCircleByModel(o);else if(o.modelType==="Rect")o.component=rAe(o.layerId,t,e,r),i=Xt.addRectByModel(o);else if(o.modelType==="Polygon"){o.component=rAe(o.layerId,t,e,r);let n=new Array;for(let s of o.childrens){let a=new Array;for(let l of s)a.push(Xc(l));n.push(a)}i=pt.addPolygonByModel(o,n)}return i}function cDt(o,t){if(o.length!==t.length)return!1;for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}function Bfe(o,t){t&&o.publish("hasModifyPcbItem",t),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q())}function Ffe(o){return un.getNextOrders4Layer(o.layerId)}function vqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/copper-create",async e=>{let r=new De("create pour for api"),{net:i,layer:n,complexPolygon:s,pourFillMethod:a,preserveSilos:l,pourName:c,pourPriority:h,lineWidth:u,primitiveLock:d}=e,p=nr(),m=yC(p,"Copper Region",n,i,!!d,u/10,s,!0),g=_qe(m,a,l,c);h&&un.setOrder(g,h,r);let y=Ffe(g);return r.addCommand(Ce.dispatch(g,"add")),qe.executeCommand(r),Bfe(o,g),{primitiveId:g.globalIndex,pourName:g.component.name,pourPriority:y,lineWidth:g.strokeWidth*10}}),o.messageBus.rpcService("pcb/extensionAPI/copper-delete",async e=>{let r=new De("delete pour for api"),{primitiveIds:i}=e,n=[],s=[],a=new Jt;for(let l=0;l<i.length;l++){let c=a.getItem(i[l]);c&&(r.addCommand(Ce.dispatch(c,"delete")),c.remove(),o.publish("delete",c),s.push(c),n.push(i[l]))}return s.length&&xu(o),qe.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/copper-modify",async e=>{let r=new De("modify pour for api"),{primitiveId:i,data:n}=e,{net:s,layerId:a,polygonSource:l,pourFillMethod:c,preserveSilos:h,pourName:u,pourPriority:d,lineWidth:p,primitiveLock:m}=n,g=kfe(),b=g.map(C=>C.globalIndex).indexOf(i);if(b<=-1)return;let P=g[b],T=k1(P);if(!cDt(T[0],l)){let C=new De("modify shape for pour api");t.clearSelect(),C.addCommand(Ce.dispatch(P,"delete")),t.setSelect([P]),o.publish("removeSelect","");let E=yC(i,"Copper Region",a,s,!!m,p/10,l,!0);if(E.modelType=="Circle"||E.modelType=="Rect"||E.modelType=="Polygon"){let O=_qe(E,c,h,u);d&&un.setOrder(O,d,r);let _=Ffe(O);return C.addCommand(Ce.dispatch(O,"add")),qe.executeCommand(C),Bfe(o,O),{primitiveId:O.globalIndex,pourName:O.component.name,pourPriority:_,lineWidth:O.strokeWidth*10}}else return null}if(r.addCommand(Ce.dispatch(P,"modify")),P.net!==s&&(P.net=s),P.layerId!==a)if(Un.fixLayerOptions(a,Un.createLayerOptionsByLineloop(P)).some(E=>E.value===a))P.layerId=a;else return null;if(typeof c<"u"){let C=P.component;C.style=c}if(typeof h<"u"){let C=P.component;C.keepIsland=h}if(typeof u<"u"){let C=P.component;C.name=u}typeof d<"u"&&un.setOrder(P,d,r),P.strokeWidth!==p/10&&(P.strokeWidth=p/10),typeof m<"u"&&(P.locked=!!m),qe.executeCommand(r),Bfe(o,P);let I=P.toJSON();return I.polygonSource=l,delete I.componentData,delete I.silkColor,I}),o.messageBus.rpcService("pcb/extensionAPI/copper-getByIds",async e=>{let{primitiveIds:r}=e,i=[],n=kfe(),s=n.map(a=>a.globalIndex);for(let a=0;a<r.length;a++){let l=s.indexOf(r[a]);if(l<=-1)continue;let c=n[l],h=c.toJSON();delete h.componentData,delete h.shapes,delete h.silkColor;let u=k1(c);h.path=u,h.copperInfo=c.component.toJSON();let d=un.getOrder(c.globalIndex);d||(d=Ffe(c)),h.pourPriority=d,h.strokeWidth=h.strokeWidth*10,i.push(h)}return i}),o.messageBus.rpcService("pcb/extensionAPI/copper-getCopperRegion",async e=>{let{primitiveId:r}=e;return Ti.getAllItem().filter(s=>s.getParent().globalIndex===r).map(s=>({...s.toJSON(),pourPrimitiveId:s.getParent().globalIndex}))}),o.messageBus.rpcService("pcb/extensionAPI/copper-getAll",async e=>{let{layer:r,net:i,primitiveLock:n}=e,s=kfe(),a=s.map(l=>{let c=l.toJSON();return{...c,strokeWidth:c.strokeWidth*10}});for(let l=0;l<a.length;l++){a[l].path=k1(s[l]),a[l].copperInfo=s[l].component.toJSON();let c=un.getOrder(s[l].globalIndex);c||(c=Ffe(s[l])),a[l].pourPriority=c,delete a[l].componentData,delete a[l].shapes,delete a[l].silkColor}return typeof r<"u"&&(a=Ks(a,tAe("layer"),r)),typeof i<"u"&&(a=Ks(a,tAe("net"),i)),typeof n<"u"&&(a=Ks(a,tAe("primitiveLock"),n)),a}),o.messageBus.rpcService("pcb/extensionAPI/copper-convertToType",async e=>{let r=new De("modify type for pour api"),{primitiveId:i,type:n}=e,s=kfe(),l=s.map(u=>u.globalIndex).indexOf(i);if(l<=-1)return;let c=s[l];r.addCommand(Ce.dispatch(c,"modify"));let h=c.toJSON();return n=="line"?c.type="Line":n=="fill"?c.type="Fill Region":n=="region"&&(c.type="Prohibited Region"),delete h.componentData,delete h.silkColor,qe.executeCommand(r),Bfe(o,c),h})}function $D(o){return{primitiveLock:"locked",layer:"layerId"}[o]||o}function Vfe(){let o=pt.getAllItem().filter(r=>r.type==="Constraint Region"||r.type==="Prohibited Region"),t=Xt.getAllItem().filter(r=>r.type==="Constraint Region"||r.type==="Prohibited Region"),e=Kt.getAllItem().filter(r=>r.type==="Constraint Region"||r.type==="Prohibited Region");return[].concat(o,t,e)}function Gfe(o){let t={device:!1,track:!1,copper:!1,fill:!1,planzone:!1,constraintRegion:!1};return o&&o.forEach(e=>{switch(e){case 2:t.device=!0;break;case 6:t.fill=!0;break;case 5:t.track=!0;break;case 7:t.copper=!0;break;case 8:t.planzone=!0;break;case 9:t.constraintRegion=!0;break}}),t}function xqe(o,t,e){let r=null;if(o.modelType==="Circle")t.constraintRegion?(e&&(o.component=new Dh(e)),r=Kt.addCircleByModel(o)):(o.component=new Fu(t.device,t.track,t.copper,t.fill,t.planzone),r=Kt.addCircleByModel(o));else if(o.modelType==="Rect")t.constraintRegion?(e&&(o.component=new Dh(e)),r=Xt.addRectByModel(o)):(o.component=new Fu(t.device,t.track,t.copper,t.fill,t.planzone),r=Xt.addRectByModel(o));else if(o.modelType==="Polygon"){let i=new Array;for(let n of o.childrens){let s=new Array;for(let a of n)s.push(Xc(a));i.push(s)}t.constraintRegion?(e&&(o.component=new Dh(e)),r=pt.addPolygonByModel(o,i)):(o.component=new Fu(t.device,t.track,t.copper,t.fill,t.planzone),r=pt.addPolygonByModel(o,i))}return r}function hDt(o,t){if(o.length!==t.length)return!1;for(let e=0;e<o.length;e++)if(o[e]!==t[e])return!1;return!0}function Ufe(o,t){t&&o.publish("hasModifyPcbItem",t),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q())}function Rqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/region-create",async e=>{let r=new De("create region for api"),{layer:i,complexPolygon:n,ruleType:s,regionName:a,lineWidth:l,primitiveLock:c}=e,h=nr(),u=Gfe(s),d=yC(h,u.constraintRegion?"Constraint Region":"Prohibited Region",i,null,!!c,l/10,n,!0),p=xqe(d,u,a);return r.addCommand(Ce.dispatch(p,"add")),qe.executeCommand(r),Ufe(o,p),{primitiveId:p.globalIndex,lineWidth:p.strokeWidth*10}}),o.messageBus.rpcService("pcb/extensionAPI/region-delete",async e=>{let r=new De("delete region for api"),{primitiveIds:i}=e,n=[],s=[],a=new Jt;for(let l=0;l<i.length;l++){let c=a.getItem(i[l]);c&&(r.addCommand(Ce.dispatch(c,"delete")),c.remove(),o.publish("delete",c),s.push(c),n.push(i[l]))}return s.length&&xu(o),qe.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/region-modify",async e=>{let r=new De("modify region for api"),{primitiveId:i,data:n}=e,{layerId:s,polygonSource:a,ruleType:l,regionName:c,lineWidth:h,primitiveLock:u}=n,d=Vfe(),m=d.map(P=>P.globalIndex).indexOf(i);if(m<=-1)return;let g=d[m],y=k1(g);if(!hDt(y[0],a)){let P=new De("modify shape for region api");t.clearSelect(),P.addCommand(Ce.dispatch(g,"delete")),t.setSelect([g]),o.publish("removeSelect","");let T=Gfe(l),I=yC(i,T.constraintRegion?"Constraint Region":"Prohibited Region",s,null,!!u,h/10,a,!0);if(I.modelType=="Circle"||I.modelType=="Rect"||I.modelType=="Polygon"){let C=xqe(I,T,c);return P.addCommand(Ce.dispatch(C,"add")),qe.executeCommand(P),Ufe(o,C),{primitiveId:C.globalIndex,lineWidth:C.strokeWidth*10}}else return null}if(r.addCommand(Ce.dispatch(g,"modify")),typeof s<"u")if(Un.fixLayerOptions(s,Un.createLayerOptionsByLineloop(g)).some(T=>T.value===s))g.layerId=s;else return null;if(typeof l<"u"&&g.type=="Prohibited Region"){let P=Gfe(l),T=g.component;T.device=P.device,T.fill=P.fill,T.track=P.track,T.copper=P.copper,T.planzone=P.planzone}if(typeof c<"u"&&g.type=="Constraint Region"){let P=g.component;P.name=c}g.strokeWidth!==h/10&&(g.strokeWidth=h/10),typeof u<"u"&&(g.locked=!!u),qe.executeCommand(r),Ufe(o,g);let b=g.toJSON();return b.polygonSource=a,delete b.componentData,delete b.net,delete b.silkColor,b}),o.messageBus.rpcService("pcb/extensionAPI/region-getByIds",async e=>{let{primitiveIds:r}=e,i=[],n=Vfe(),s=n.map(a=>a.globalIndex);for(let a=0;a<r.length;a++){let l=s.indexOf(r[a]);if(l<=-1)continue;let c=n[l],h=c.toJSON();h.type=="Prohibited Region"?(h.device=h.componentData.device,h.fill=h.componentData.fill,h.track=h.componentData.track,h.copper=h.componentData.copper,h.planzone=h.componentData.planzone):h.name=h.componentData.name,delete h.componentData,delete h.shapes,delete h.silkColor,delete h.net;let u=k1(c);h.path=u,h.strokeWidth=h.strokeWidth*10,i.push(h)}return i}),o.messageBus.rpcService("pcb/extensionAPI/region-getAll",async e=>{let{layer:r,ruleType:i,primitiveLock:n}=e,s=Vfe(),a=s.map(l=>{let c=l.toJSON();return{...c,strokeWidth:c.strokeWidth*10}});for(let l=0;l<a.length;l++)a[l].type=="Prohibited Region"?(a[l].device=a[l].componentData.device,a[l].fill=a[l].componentData.fill,a[l].track=a[l].componentData.track,a[l].copper=a[l].componentData.copper,a[l].planzone=a[l].componentData.planzone):a[l].name=a[l].componentData.name,a[l].path=k1(s[l]),delete a[l].componentData,delete a[l].shapes,delete a[l].net,delete a[l].silkColor;if(typeof r<"u"&&(a=Ks(a,$D("layer"),r)),typeof i<"u"){let l=Gfe(i);l.device&&(a=Ks(a,$D("device"),l.device)),l.fill&&(a=Ks(a,$D("fill"),l.fill)),l.track&&(a=Ks(a,$D("track"),l.track)),l.copper&&(a=Ks(a,$D("copper"),l.copper)),l.planzone&&(a=Ks(a,$D("planzone"),l.planzone)),l.constraintRegion&&(a=Ks(a,$D("type"),"Constraint Region"))}return typeof n<"u"&&(a=Ks(a,$D("primitiveLock"),n)),a}),o.messageBus.rpcService("pcb/extensionAPI/region-convertToType",async e=>{let r=new De("modify type for region api"),{primitiveId:i,type:n}=e,s=Vfe(),l=s.map(u=>u.globalIndex).indexOf(i);if(l<=-1)return;let c=s[l];r.addCommand(Ce.dispatch(c,"modify"));let h=c.toJSON();return n=="line"?c.type="Line":n=="copper"?(c.type="Copper Region",h.copperInfo=c.component.toJSON(),un.addOrder(c,r),h.pourPriority=un.getOrder(c.globalIndex)+1):n=="fill"&&(c.type="Fill Region"),delete h.componentData,delete h.silkColor,qe.executeCommand(r),Ufe(o,c),h})}function Dqe(o){return{primitiveLock:"locked",layer:"layerId"}[o]||o}function wqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/string-create",async e=>{let{layer:r,x:i,y:n,text:s,fontFamily:a,fontSize:l,lineWidth:c,alignMode:h,rotation:u,reverse:d,expansion:p,mirror:m,primitiveLock:g}=e,y=new De("create texts for api"),b=ri.addText(r,"",!1,s,!0,a,l/10,zt.toRadians(u),!!g,new S(i/10,n/10),h,c/10,d,p,m);return y.addCommand(Ce.dispatch(b,"add")),qe.executeCommand(y),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),{primitiveId:b.model.globalIndex}}),o.messageBus.rpcService("pcb/extensionAPI/string-delete",async e=>{let r=new De("delete texts for api"),{primitiveIds:i}=e,n=[],s=[];for(let a=0;a<i.length;a++){let l=ri.getItem(i[a]);l&&(r.addCommand(Ce.dispatch(l,"delete")),l.remove(),o.publish("delete",l),s.push(l),n.push(i[a]))}return s.length&&xu(o),qe.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/string-modify",async e=>{let r=new De("modify texts for api"),{primitiveId:i,data:n}=e,{layer:s,x:a,y:l,text:c,fontFamily:h,fontSize:u,lineWidth:d,alignMode:p,rotation:m,reverse:g,expansion:y,mirror:b,primitiveLock:P}=n,T=ri.getItem(i),I=1e-10;if(!T)return null;if(r.addCommand(Ce.dispatch(T,"modify")),T.layerId!==s)if(Un.pcbText().some(E=>E.value===s))T.layerId=s;else return null;if(Math.abs(T.position.x-a/10)>I){let C=new S(a/10,T.position.y);T.position=C}if(Math.abs(T.position.y-l/10)>I){let C=new S(T.position.x,l/10);T.position=C}if(T.value!==c&&(T.value=c),T.fontFamily!==h&&(T.fontFamily=h),T.fontSize!==u/10&&(T.fontSize=u/10),T.strokeWidth!==d/10&&(T.strokeWidth=d/10),T.origin!==p&&(T.origin=p),T.rotation!==zt.toRadians(m)&&(T.rotation=zt.toRadians(m)),T.reverse!==g){if(h==="default")return console.debug("[DEBUG]: \u9ED8\u8BA4\u5B57\u4F53\u4E0D\u652F\u6301\u8BBE\u7F6E\u53CD\u76F8"),!1;T.reverse=g}return T.reverseExpansion!==y/10&&(T.reverseExpansion=y/10),T.mirror!==b&&(T.mirror=b),T.locked!==P&&(T.locked=P),qe.executeCommand(r),o.publish("hasModifyPcbItem",T),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),T.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/string-getByIds",async e=>{let{primitiveIds:r}=e,i=[];for(let n=0;n<r.length;n++){let s=ri.getItem(r[n]);s&&i.push(s.toJSON())}return i}),o.messageBus.rpcService("pcb/extensionAPI/string-getAll",async e=>{let{layer:r,primitiveLock:i}=e,s=ri.getAllItem().filter(a=>!a.getParent()).map(a=>a.toJSON());return typeof r<"u"&&(s=Ks(s,Dqe("layer"),r)),typeof i<"u"&&(s=Ks(s,Dqe("primitiveLock"),i)),s})}function iAe(o){return{primitiveLock:"locked"}[o]||o}function Lqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/track-create",async e=>{let{net:r,layerId:i,startX:n,startY:s,endX:a,endY:l,lineWidth:c,primitiveLock:h}=e,u=pr.addTrack(i,new S(n/10,s/10),new S(a/10,l/10),c/10,!!h,r),d=new De("create track for api");return d.addCommand(Ce.dispatch(u,"add")),qe.executeCommand(d),o.publish("hasModifyPcbItem",u),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),{primitiveId:u.model.globalIndex}}),o.messageBus.rpcService("pcb/extensionAPI/track-delete",async e=>{let r=new De("delete tracks for api"),{primitiveIds:i}=e,n=[],s=[];for(let a=0;a<i.length;a++){let l=pr.getItem(i[a]);l&&(r.addCommand(Ce.dispatch(l,"delete")),l.remove(),o.publish("delete",l),s.push(l),n.push(i[a]))}return s.length&&xu(o),qe.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/track-modify",async e=>{let r=new De("modify tracks for api"),{primitiveId:i,data:n}=e,{net:s,layerId:a,startX:l,startY:c,endX:h,endY:u,lineWidth:d,primitiveLock:p}=n,m=pr.getItem(i);if(!m)return null;if(r.addCommand(Ce.dispatch(m,"modify")),m.net!==s&&(m.net=s),m.layerId!==+a)if(Ze.getInstance().getAllSignalLayerIds().includes(+a))m.layerId=+a;else return null;if(m.start.x!==l/10){let y=new S(l/10,m.start.y);m.start=y}if(m.start.y!==c/10){let y=new S(m.start.x,c/10);m.start=y}if(m.end.x!==h/10){let y=new S(h/10,m.end.y);m.end=y}if(m.end.y!==u/10){let y=new S(m.end.x,u/10);m.end=y}m.width!==d/10&&(m.width=d/10),m.locked!==!!p&&(m.locked=!!p),qe.executeCommand(r),o.publish("hasModifyPcbItem",m),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q());let g=m.toJSON();return{...g,startX:g.start.x,startY:g.start.y,endX:g.end.x,endY:g.end.y}}),o.messageBus.rpcService("pcb/extensionAPI/track-getByIds",async e=>{let{primitiveIds:r}=e,i=[];for(let n=0;n<r.length;n++){let s=pr.getItem(r[n]);if(!s)continue;let a=s.toJSON();i.push({...a,startX:a.start.x*10,startY:a.start.y*10,endX:a.end.x*10,endY:a.end.y*10,width:a.width*10})}return i}),o.messageBus.rpcService("pcb/extensionAPI/track-getAll",async e=>{let{net:r,layerId:i,primitiveLock:n}=e,a=pr.getAllItem().filter(l=>l instanceof Ir).map(l=>{let c=l.toJSON();return{...c,startX:c.start.x*10,startY:c.start.y*10,endX:c.end.x*10,endY:c.end.y*10,width:c.width*10}});return typeof r<"u"&&(a=Ks(a,iAe("net"),r)),typeof i<"u"&&(a=Ks(a,iAe("layerId"),i)),typeof n<"u"&&(a=Ks(a,iAe("primitiveLock"),n)),a}),o.messageBus.rpcService("pcb/extensionAPI/track-getAdjacentPrimitives",async e=>pr.getItem(e).searchNode().filter(s=>s.globalIndex!==e).filter(s=>typeof s.toJSON=="function").map(s=>N1(s))),o.messageBus.rpcService("pcb/extensionAPI/track-getEntireTrack",async e=>[...pr.getItem(e).searchAllConnectNode()].filter(n=>typeof n.toJSON=="function").map(n=>N1(n)))}function Mqe(o){return{primitiveLock:"locked"}[o]||o}function Nqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/via-create",async e=>{let r=new De("create vias for api"),{net:i,x:n,y:s,holeDiameter:a,diameter:l,viaType:c,designRuleBlindViaName:h,solderMaskExpansion:u,primitiveLock:d}=e,p=1,m=2,g=h||"";if(g.length>0&&!re.getInstance().getBlindPhysics().data.some(C=>C.name===g))return;let y=u?2:1,b=u?u.topSolderMask/10:null,P=u?u.bottomSolderMask/10:null,T=Wr.addVia(c,g,p,m,i,l/10/2,new S(n/10,s/10),a/10/2,!!d,y,b,P);return r.addCommand(Ce.dispatch(T,"add")),qe.executeCommand(r),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),{primitiveId:T.model.globalIndex}}),o.messageBus.rpcService("pcb/extensionAPI/via-delete",async e=>{let r=new De("delete vias for api"),{primitiveIds:i}=e,n=[],s=[];for(let a=0;a<i.length;a++){let l=Wr.getItem(i[a]);l&&(r.addCommand(Ce.dispatch(l,"delete")),l.remove(),o.publish("delete",l),s.push(l),n.push(i[a]))}return s.length&&xu(o),qe.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/via-modify",async e=>{let r=new De("modify Vias for api"),{primitiveId:i,data:n}=e,{net:s,x:a,y:l,holeDiameter:c,diameter:h,viaType:u,designRuleBlindViaName:d,solderMaskExpansion:p,primitiveLock:m}=n,g=Wr.getItem(i),y=1e-10;if(!g)return null;if(r.addCommand(Ce.dispatch(g,"modify")),typeof s<"u"&&(g.net=s),Math.abs(g.center.x-a/10)>y){let b=new S(a/10,g.center.y);g.center=b}if(Math.abs(g.center.y-l/10)>y){let b=new S(g.center.x,l/10);g.center=b}return Math.abs(g.holeRadius-c/10/2)>y&&(g.holeRadius=c/10/2),Math.abs(g.radius-h/10/2)>y&&(g.radius=h/10/2),typeof u<"u"&&(g.type=u),typeof p<"u"&&(g.viaExpansion=new kk(2,p.topSolderMask/10,p.bottomSolderMask/10)),typeof m<"u"&&(g.locked=!!m),qe.executeCommand(r),o.publish("hasModifyPcbItem",g),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),g.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/via-getByIds",async e=>{let{primitiveIds:r}=e,i=[];for(let n=0;n<r.length;n++){let s=Wr.getItem(r[n]);s&&i.push(s.toJSON())}return i}),o.messageBus.rpcService("pcb/extensionAPI/via-getAll",async e=>{let{net:r,primitiveLock:i}=e,s=Wr.getAllItem().map(a=>a.toJSON());return typeof r<"u"&&(s=Ks(s,Mqe("net"),r)),typeof i<"u"&&(s=Ks(s,Mqe("primitiveLock"),i)),s}),o.messageBus.rpcService("pcb/extensionAPI/via-getAdjacentPrimitives",async e=>Wr.getItem(e).searchNode().filter(s=>s.globalIndex!==e).filter(s=>typeof s.toJSON=="function").map(s=>N1(s)))}function kqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/selectcontrol-getAllSelectedPrimitiveIds",async()=>t.getItems().map(r=>r.globalIndex)),o.messageBus.rpcService("pcb/extensionAPI/selectcontrol-getAllSelectedPrimitives",async()=>t.getItems().filter(i=>typeof i.toJSON=="function").map(i=>N1(i))),o.messageBus.rpcService("pcb/extensionAPI/selectcontrol-doSelectPrimitives",async e=>{let r=e.primitiveIds;Array.isArray(r)||(r=[r]);let i=new Jt,n=[];for(let s=0;s<r.length;s++){let a=i.getItem(r[s]);a&&n.push(a)}return t.setSelect(n,!1),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("flushSelectingInfo",""),n.length>0}),o.messageBus.rpcService("pcb/extensionAPI/selectcontrol-doCrossProbeSelect",async e=>{let{components:r=[],pins:i=[],nets:n=[],highlight:s,select:a}=e;t.clearSelect(),t.cancelAllElementsHightlight(!0);let l=Ar.getAllItem(),c=Qt.getAllItem(),h=new Set,u=[],d=new Map,p=Array.from(r);for(let m=0;m<i.length;m++){if(i[m].indexOf("_")>=0){let g=i[m].split("_");p.push(g[0]);let y=d.get(g[0]);typeof y>"u"&&(y=[]),y.push(g[1]),d.set(g[0],[...y]);continue}u.push(i[m])}for(let m=0;m<u.length;m++)for(let g=0;g<c.length;g++)c[g].num===u[m]&&h.add(c[g]);for(let m=0;m<p.length;m++)for(let g=0;g<l.length;g++)if(l[g].designator===p[m]){r.indexOf(p[m])>=0&&h.add(l[g]);let y=l[g].getPads(),b=d.get(p[m])||[];for(let P=0;P<b.length;P++)for(let T=0;T<y.length;T++)y[T].num===b[P]&&h.add(y[T])}if(n.length)for(let m=0;m<n.length;m++){let g=Ye.getSameNetItems(n[m]);for(let y=0;y<g.length;y++)h.add(g[y])}if(h.size&&(a&&t.setSelect(h),s)){let m=new Set;for(let g of h)m.add(g.globalIndex);t.highlight.highlightUnselect(m)}return o.publish("flushService",""),o.publish("updateFrame",""),!0}),o.messageBus.rpcService("pcb/extensionAPI/selectcontrol-doCrossProbeSelectByObject",async e=>{let{components:r=[],pins:i=[],nets:n=[]}=e,s={parts:r,pins:i,nets:n,partKey:"Designator"};return o.publish("pcbCrossProbe",s),!0}),o.messageBus.rpcService("pcb/extensionAPI/selectcontrol-clearSelected",async()=>(t.clearSelect(),!0)),o.messageBus.rpcService("pcb/extensionAPI/selectcontrol-getCurrentMousePosition",async()=>{let e=mf.getInputInfo();return{x:e.sceneX*10,y:e.sceneY*10}})}function Bqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/attribute-delete",async e=>{let r=new De("hide attrs for API"),{primitiveIds:i}=e,n=[];for(let s=0;s<i.length;s++){let a=ri.getItem(i[s]);a&&(r.addCommand(Ce.dispatch(a,"modify")),o.publish("hasModifyPcbItem",a),a.showKey=!1,a.showValue=!1,n.push(i[s]))}return qe.executeCommand(r),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),n}),o.messageBus.rpcService("pcb/extensionAPI/attribute-modify",async e=>{let r=new De("modify attrs for api"),{primitiveId:i,data:n}=e,{layer:s,x:a,y:l,key:c,value:h,keyVisible:u,valueVisible:d,fontFamily:p,fontSize:m,lineWidth:g,alignMode:y,rotation:b,reverse:P,expansion:T,mirror:I,primitiveLock:C}=n,E=ri.getItem(i),O=1e-10;if(!E)return null;if(r.addCommand(Ce.dispatch(E,"modify")),E.layerId!==s)if(Un.pcbText().some(x=>x.value===s))E.layerId=s;else return null;if(Math.abs(E.position.x-a/10)>O){let _=new S(a/10,E.position.y);E.position=_}if(Math.abs(E.position.y-l/10)>O){let _=new S(E.position.x,l/10);E.position=_}if(E.key!==c&&(E.key=c),E.value!==h&&(E.value=h),E.showKey!==u&&(E.showKey=u),E.showValue!==d&&(E.showValue=d),E.fontFamily!==p&&(E.fontFamily=p),E.fontSize!==m/10&&(E.fontSize=m/10),E.strokeWidth!==g/10&&(E.strokeWidth=g/10),E.origin!==y&&(E.origin=y),E.rotation!==zt.toRadians(b)&&(E.rotation=zt.toRadians(b)),E.reverse!==P){if(p==="default")return console.debug("[DEBUG]: \u9ED8\u8BA4\u5B57\u4F53\u4E0D\u652F\u6301\u8BBE\u7F6E\u53CD\u76F8"),!1;E.reverse=P}return E.reverseExpansion!==T/10&&(E.reverseExpansion=T/10),E.mirror!==I&&(E.mirror=I),E.locked!==C&&(E.locked=C),qe.executeCommand(r),o.publish("hasModifyPcbItem",E),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),E.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/attribute-getByIds",async e=>{let{primitiveIds:r}=e,n=Ar.getAllItem().map(a=>a.toJSON().ATTR.map(l=>({...l,parentPrimitiveId:a.globalIndex}))).flat(),s=[];for(let a=0;a<r.length;a++){let l=n.filter(c=>c.globalIndex===r[a])[0];l&&s.push(l)}return s}),o.messageBus.rpcService("pcb/extensionAPI/attribute-getAll",async()=>Ar.getAllItem().map(i=>({attrs:i.toJSON().ATTR,parentPrimitiveId:i.globalIndex})))}function Fqe(o,t){t&&o.publish("hasModifyPcbItem",t),o.publish("flushService",""),o.publish("updateFrame",""),o.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q())}function Vqe(o,t){o.messageBus.rpcService("pcb/extensionAPI/poured-delete",async e=>{let r=new De("delete poured for api"),{primitiveIds:i}=e,n=[],s=[],a=Ti.getAllItem();for(let l=0;l<i.length;l++){let c=i[l],h=a.filter(u=>u.getParent().globalIndex===c);for(let u=0;u<h.length;u++){let d=h[u];d&&(r.addCommand(Ce.dispatch(d,"delete")),d.remove(),o.publish("delete",d),s.push(d))}n.push(c)}return s.length&&xu(o),qe.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/poured-deletePourFills",async e=>{let r=new De("delete PourFills for api"),{primitiveIds:i}=e,n=[],s=[];for(let a=0;a<i.length;a++){let l=Ti.getItem(i[a]);l&&(r.addCommand(Ce.dispatch(l,"delete")),l.remove(),o.publish("delete",l),s.push(l),n.push(i[a]))}return s.length&&xu(o),qe.executeCommand(r),n}),o.messageBus.rpcService("pcb/extensionAPI/poured-convertToFill",async e=>{let r=new De("convertToFill for api"),{pourFillId:i}=e,n=Ti.getItem(i);r.addCommand(Ce.dispatch(n,"modify")),ice("CONVERT_TO_FILL_REGION",[n]);let s=t.getSelects().filter(a=>a instanceof lt&&a.type==="Fill Region")[0];return qe.executeCommand(r),Fqe(o,n),s.toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/poured-addSolderMaskFill",async e=>{let r=new De("addSolderMaskFill for api"),{pourFillId:i}=e,n=Ti.getItem(i);r.addCommand(Ce.dispatch(n,"add"));let s;if(ao(n.layerId))s=5;else if(2==n.layerId)s=6;else return;let a=qA.convertCopperResult2FillRegion([n],!0,r);return a.forEach(l=>{(l.layerId!=s||!l.net)&&(r.addCommand(Ce.dispatch(l,"modify")),l.layerId=s,l.net=null)}),qe.executeCommand(r),Fqe(o,n),a[0].toJSON()}),o.messageBus.rpcService("pcb/extensionAPI/poured-getAll",async()=>Ti.getAllItem().map(i=>({...i.toJSON(),pourPrimitiveId:i.getParent().globalIndex})))}function Gqe(o,t){Nqe(o,t),Lqe(o,t),uqe(o,t),Aqe(o,t),fqe(o,t),iqe(o,t),tqe(o,t),Eqe(o,t),Tqe(o,t),Cqe(o,t),Rqe(o,t),bqe(o,t),vqe(o,t),gqe(o,t),kqe(o,t),sqe(o,t),cqe(o,t),aqe(o,t),hqe(o,t),lqe(o,t),wqe(o,t),Bqe(o,t),Vqe(o,t)}function Uqe(o){let t;if(o.useCustomSize)o.path=`["R",0,0,${o.customWidth*10},${o.customHeight*10},0,0]`,t=[`["POLY", "e0", 0, "", 11, 10, ${o.path}, 0]`];else if(o.isSetjson){let e=JSON.parse(o.path);t=uDt(e),si.getInstance().useSetJsonFirst=!0,si.getInstance().setJsonParamCache=e.ui_params_sum}else o.path=o.path||'[["R",0,0,1000,500,0,0]]',t=JSON.parse(o.path).map(e=>`["POLY", "e0", 0, "", 11, 10, ${JSON.stringify(e)}, 0]`);return dDt(t)}function uDt(o){let t=new Array;for(let r of o.set.marks){let i=ST(r.dia,o.unit),n=ST(r.x,o.unit),s=ST(r.y,o.unit),a=ST(.5,"mm");[1,2].forEach(l=>{t.push(["PAD",nr(),0,"",l,"",n,s,0,null,["ELLIPSE",i,i],[],0,0,null,1,0,a,null,null,null,0,null,null,null,null,[]])})}let e=[];for(let r of o.set.stamp_holes)for(let i of r.holes)e.push(i);for(let r of o.set.tool_holes)e.push(r);for(let r of e){let i=ST(r.x,o.unit),n=ST(r.y,o.unit),s=ST(r.dia/2,o.unit);t.push(["FILL",nr(),0,"",12,1,0,[["CIRCLE",i,n,s]],0])}t.push(...Hfe(o.set.margins.vertexs,o.unit)),o.set.margins.vertexs_holes&&t.push(...Hfe(o.set.margins.vertexs_holes.map(r=>r.vertexs),o.unit)),t.push(...Hfe(o.set.margins.vertexs,o.unit));for(let r=0;r<o.set.repeat.length;r++){let i=o.set.repeat[r],n=o.pcs[i.key];for(let s=0;s<i.repeat_x;s++)for(let a=0;a<i.repeat_y;a++){let l=new S(i.dis_x*s,i.dis_y*a),c=i.rotate!=0;t.push(...Hfe(n.outline.vertexs,o.unit,l,c,r==0&&s==0&&a==0))}}return t.map(r=>JSON.stringify(r))}function Hfe(o,t,e=new S(0,0),r=!1,i=!1){let n=[];o=JSON.parse(JSON.stringify(o));for(let l of o)if(l.length)for(let c=0;c<l.length;c++){let h=l[c];h.xc!=null&&(h.xc+=e.x,h.yc+=e.y),h.x+=e.x,h.y+=e.y}let s=new Array;for(let l of o){if(!l.length)continue;let c=new S(ST(l.at(-1).x,t),ST(l.at(-1).y,t)),h=[c.x,c.y],u=new Array;s.push(u);for(let d=0;d<l.length;d++){let p=l[d],m=p.xc!=null,g=ST(p.x,t),y=ST(p.y,t),b=new S(h.at(-2),h.at(-1)),P=new S(g,y);if(m){let T=ST(p.xc,t),I=ST(p.yc,t),C=new S(T,I),E=C.distance1(P),O=q.build4(b,P,C,E,E,p.ccw?ae.CCW:ae.CW);h.push("ARC",O.sweepAngle,g,y),u.push(O)}else{let T=new M(b,P);h.push("L",g,y),u.push(T)}}}let a;if(r){let l=new _e;s.flat(2).forEach(h=>{l.ext1(h.bbox())}),a=l.build1().center()}return s.forEach((l,c)=>{let h=[];l.forEach((u,d)=>{let p;if(r){let m=Ae.rotateZForPoint(a,Math.PI);p=u.multiply3(m.toMatrix3())}else p=u;d==0&&h.push(p.start().x,p.start().y),p instanceof q?h.push("ARC",p.sweepAngle,p.end().x,p.end().y):h.push("L",p.end().x,p.end().y)}),n.push(["POLY",nr(),0,"",11,10,h,i?1:0])}),n}function dDt(o){return`["DOCTYPE","PCB","1.7"]
["HEAD",{"editorVersion":"dev","importFlag":0}]
["CANVAS",0,0,"mil",5,5,5,5,5,5,2,0,5]
["LAYER",1,"TOP","Top Layer",3,"#ff0000",1,"#7f0000",0.5]
["LAYER",2,"BOTTOM","Bottom Layer",3,"#0000ff",1,"#00007f",0.5]
["LAYER",3,"TOP_SILK","Top Silkscreen Layer",3,"#ffcc00",1,"#7f6600",0.5]
["LAYER",4,"BOT_SILK","Bottom Silkscreen Layer",3,"#66cc33",1,"#336619",0.5]
["LAYER",5,"TOP_SOLDER_MASK","Top Solder Mask Layer",3,"#800080",0.7,"#400040",0.5]
["LAYER",6,"BOT_SOLDER_MASK","Bottom Solder Mask Layer",3,"#aa00ff",0.7,"#55007f",0.5]
["LAYER",7,"TOP_PASTE_MASK","Top Paste Mask Layer",3,"#808080",1,"#404040",0.5]
["LAYER",8,"BOT_PASTE_MASK","Bottom Paste Mask Layer",3,"#800000",1,"#400000",0.5]
["LAYER",9,"TOP_ASSEMBLY","Top Assembly Layer",3,"#33cc99",1,"#19664c",0.5]
["LAYER",10,"BOT_ASSEMBLY","Bottom Assembly Layer",3,"#5555ff",1,"#2a2a7f",0.5]
["LAYER",11,"OUTLINE","Board Outline Layer",3,"#ff00ff",1,"#7f007f",0.5]
["LAYER",12,"MULTI","Multi-Layer",3,"#c0c0c0",1,"#606060",0.5]
["LAYER",13,"DOCUMENT","Document Layer",3,"#ffffff",1,"#7f7f7f",0.5]
["LAYER",14,"MECHANICAL","Mechanical Layer",3,"#f022f0",1,"#781178",0.5]
["LAYER",15,"SIGNAL","Inner1",0,"#999966",1,"#4c4c33",0.5]
["LAYER",16,"SIGNAL","Inner2",0,"#008000",1,"#004000",0.5]
["LAYER",17,"SIGNAL","Inner3",0,"#00ff00",1,"#007f00",0.5]
["LAYER",18,"SIGNAL","Inner4",0,"#bc8e00",1,"#5e4700",0.5]
["LAYER",19,"SIGNAL","Inner5",0,"#70dbfa",1,"#39503f",0.5]
["LAYER",20,"SIGNAL","Inner6",0,"#00cc66",1,"#006633",0.5]
["LAYER",21,"SIGNAL","Inner7",0,"#9966ff",1,"#4c337f",0.5]
["LAYER",22,"SIGNAL","Inner8",0,"#800080",1,"#400040",0.5]
["LAYER",23,"SIGNAL","Inner9",0,"#008080",1,"#004040",0.5]
["LAYER",24,"SIGNAL","Inner10",0,"#15935f",1,"#0a492f",0.5]
["LAYER",25,"SIGNAL","Inner11",0,"#000080",1,"#000040",0.5]
["LAYER",26,"SIGNAL","Inner12",0,"#00b400",1,"#005a00",0.5]
["LAYER",27,"SIGNAL","Inner13",0,"#2e4756",1,"#17232b",0.5]
["LAYER",28,"SIGNAL","Inner14",0,"#99842f",1,"#4c4217",0.5]
["LAYER",29,"SIGNAL","Inner15",0,"#ffffaa",1,"#7f7f55",0.5]
["LAYER",30,"SIGNAL","Inner16",0,"#99842f",1,"#4c4217",0.5]
["LAYER",31,"SIGNAL","Inner17",0,"#2e4756",1,"#17232b",0.5]
["LAYER",32,"SIGNAL","Inner18",0,"#3535ff",1,"#1a1a7f",0.5]
["LAYER",33,"SIGNAL","Inner19",0,"#8000bc",1,"#40005e",0.5]
["LAYER",34,"SIGNAL","Inner20",0,"#43ae5f",1,"#21572f",0.5]
["LAYER",35,"SIGNAL","Inner21",0,"#c3ecce",1,"#617667",0.5]
["LAYER",36,"SIGNAL","Inner22",0,"#728978",1,"#39443c",0.5]
["LAYER",37,"SIGNAL","Inner23",0,"#39503f",1,"#1c281f",0.5]
["LAYER",38,"SIGNAL","Inner24",0,"#0c715d",1,"#06382e",0.5]
["LAYER",39,"SIGNAL","Inner25",0,"#5a8a80",1,"#2d4540",0.5]
["LAYER",40,"SIGNAL","Inner26",0,"#2b937e",1,"#15493f",0.5]
["LAYER",41,"SIGNAL","Inner27",0,"#23999d",1,"#114c4e",0.5]
["LAYER",42,"SIGNAL","Inner28",0,"#45b4e3",1,"#225a71",0.5]
["LAYER",43,"SIGNAL","Inner29",0,"#215da1",1,"#102e50",0.5]
["LAYER",44,"SIGNAL","Inner30",0,"#4564d7",1,"#22326b",0.5]
["LAYER",45,"SIGNAL","Inner31",0,"#6969e9",1,"#343474",0.5]
["LAYER",46,"SIGNAL","Inner32",0,"#9069e9",1,"#483474",0.5]
["LAYER",47,"HOLE","Hole Layer",3,"#222222",1,"#111111",0.5]
["LAYER",48,"COMPONENT_SHAPE","Component Shape Layer",1,"#00cccc",1,"#006666",0.5]
["LAYER",49,"COMPONENT_MARKING","Component Marking Layer",1,"#66ffcc",1,"#337f66",0.5]
["LAYER",50,"PIN_SOLDERING","Pin Soldering Layer",1,"#cc9999",1,"#664c4c",0.5]
["LAYER",51,"PIN_FLOATING","Pin Floating Layer",1,"#ff99ff",1,"#7f4c7f",0.5]
["LAYER",52,"COMPONENT_MODEL","Component Model Layer",0,"#ffffff",1,"#7f7f7f",0.5]
["LAYER",53,"3D_SHELL_OUTLINE","3D Shell Outline Layer",3,"#66ff99",1,"#337f4c",0.5]
["LAYER",54,"3D_SHELL_TOP","3D Shell Top Layer",3,"#ffccff",1,"#7f667f",0.5]
["LAYER",55,"3D_SHELL_BOTTOM","3D Shell Bottom Layer",3,"#0066cc",1,"#003366",0.5]
["LAYER",56,"DRILL_DRAWING","Drill Drawing Layer",3,"#008080",1,"#004040",0.5]
["LAYER",57,"OTHER","Ratline Layer",7,"#6464ff",1,"#32327f",0.5]
["LAYER",58,"TOP_STIFFENER","Top Stiffener Layer",0,"#eee666",1,"#777333",0.5]
["LAYER",59,"BOTTOM_STIFFENER","Bottom Stiffener Layer",0,"#ccff00",1,"#667f00",0.5]
["LAYER",71,"CUSTOM","Custom1",0,"#9069e9",1,"#483474",0.5]
["LAYER",72,"CUSTOM","Custom2",0,"#6969e9",1,"#343474",0.5]
["LAYER",73,"CUSTOM","Custom3",0,"#4564d7",1,"#22326b",0.5]
["LAYER",74,"CUSTOM","Custom4",0,"#215da1",1,"#102e50",0.5]
["LAYER",75,"CUSTOM","Custom5",0,"#45b4e3",1,"#225a71",0.5]
["LAYER",76,"CUSTOM","Custom6",0,"#23999d",1,"#114c4e",0.5]
["LAYER",77,"CUSTOM","Custom7",0,"#2b937e",1,"#15493f",0.5]
["LAYER",78,"CUSTOM","Custom8",0,"#5a8a80",1,"#2d4540",0.5]
["LAYER",79,"CUSTOM","Custom9",0,"#0c715d",1,"#06382e",0.5]
["LAYER",80,"CUSTOM","Custom10",0,"#39503f",1,"#1c281f",0.5]
["LAYER",81,"CUSTOM","Custom11",0,"#728978",1,"#39443c",0.5]
["LAYER",82,"CUSTOM","Custom12",0,"#c3ecce",1,"#617667",0.5]
["LAYER",83,"CUSTOM","Custom13",0,"#43ae5f",1,"#21572f",0.5]
["LAYER",84,"CUSTOM","Custom14",0,"#8000bc",1,"#40005e",0.5]
["LAYER",85,"CUSTOM","Custom15",0,"#3535ff",1,"#1a1a7f",0.5]
["LAYER",86,"CUSTOM","Custom16",0,"#2e4756",1,"#17232b",0.5]
["LAYER",87,"CUSTOM","Custom17",0,"#99842f",1,"#4c4217",0.5]
["LAYER",88,"CUSTOM","Custom18",0,"#ffffaa",1,"#7f7f55",0.5]
["LAYER",89,"CUSTOM","Custom19",0,"#99842f",1,"#4c4217",0.5]
["LAYER",90,"CUSTOM","Custom20",0,"#2e4756",1,"#17232b",0.5]
["LAYER",91,"CUSTOM","Custom21",0,"#00b400",1,"#005a00",0.5]
["LAYER",92,"CUSTOM","Custom22",0,"#000080",1,"#000040",0.5]
["LAYER",93,"CUSTOM","Custom23",0,"#15935f",1,"#0a492f",0.5]
["LAYER",94,"CUSTOM","Custom24",0,"#008080",1,"#004040",0.5]
["LAYER",95,"CUSTOM","Custom25",0,"#800080",1,"#400040",0.5]
["LAYER",96,"CUSTOM","Custom26",0,"#9966ff",1,"#4c337f",0.5]
["LAYER",97,"CUSTOM","Custom27",0,"#00cc66",1,"#006633",0.5]
["LAYER",98,"CUSTOM","Custom28",0,"#70dbfa",1,"#39503f",0.5]
["LAYER",99,"CUSTOM","Custom29",0,"#bc8e00",1,"#5e4700",0.5]
["LAYER",100,"CUSTOM","Custom30",0,"#00ff00",1,"#007f00",0.5]
["LAYER",101,"SUBSTRATE","Dielectric1",0,"#000000",1,"#000000",0.5]
["LAYER_PHYS",3,null,0,null,null,1]
["LAYER_PHYS",7,null,0,null,null,1]
["LAYER_PHYS",5,"",0.394,3.3,0.02,1]
["LAYER_PHYS",1,null,1.379,null,null,1]
["LAYER_PHYS",101,"FR4",59.449,4.5,0,1]
["LAYER_PHYS",2,null,1.378,null,null,1]
["LAYER_PHYS",6,"",0.394,3.3,0.02,1]
["LAYER_PHYS",8,null,0,null,null,1]
["LAYER_PHYS",4,null,0,null,null,1]
["ACTIVE_LAYER",1]
`+o.join(`
`)+`
["PANELIZE",0,1,1,0,0,1]
["PANELIZE_STAMP",1,0,1,21.6535,8,33.4646]
["PANELIZE_SIDE",1,1,236.2205,78.7402,39.3701,19.685]
["PANELIZE_STAMP",0,0,1,21.6535,8,33.4646]
["PANELIZE_SIDE",0,0,236.2205,78.7402,39.3701,19.685]`}function ST(o,t){return gn(na(o,t,"mil"),4)}var Hqe={NotAddIntoBomWithNcMark:null,NotAddIntoBomWithXMark:null,IsolatedTopPad:6,ThroughHoleTopPad:6,SurfaceMountTopPad:6,IsolatedBottomPad:6,ThroughHoleBottomPad:6,SurfaceMountBottomPad:6,IsolatedMultiPad:6,ThroughHoleMultiPad:6,Via:9,PadDrill:6,ViaDrill:9,BoardOutline:17,BoardCutout:18,CopperOutline:21,CopperFilled:21,Track:4,Text:13,Image:15,Dimension:16,SolidRegion:19,ProhibitedRegion:23,FPCStiffener:20,Line:26,PlaneZone:null,ThroughHoleComponentSilkscreen:3,SurfaceMountComponentSilkscreen:3,ThroughHoleComponentProperty:2,SurfaceMountComponentProperty:2,TearDrop:34,Shell_Outline:27,Shell_ScrewPillar:28,Shell_SideDatumLine:29,Shell_SideSlotRegion:31,Shell_TopBottomSlotRegion:30,Shell_SideEntity:33,Shell_TopBottomEntity:32};var nAe=[14,13,11,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,59,10,8,6,2,4,58,9,7,5,1,3,12,47,56],oAe=["NotAddIntoBomWithNcMark","NotAddIntoBomWithXMark"],Wfe=0;var Wqe=.5,zqe=4,Yqe={CopperOutline:"Copper Region",SolidRegion:"Fill Region",ProhibitedRegion:"Prohibited Region",FPCStiffener:"FPC Stiffener",Line:"Line",TearDrop:"TearDrop",Shell_Outline:"3D Shell - Outline",Shell_ScrewPillar:"3D Shell - Screw Pillar",Shell_SideDatumLine:"3D Shell - Side Datum Line",Shell_SideSlotRegion:"3D Shell - Side Slot Region",Shell_TopBottomSlotRegion:"3D Shell - Top Slot Region",Shell_SideEntity:"3D Shell - Side Entity",Shell_TopBottomEntity:"3D Shell - Top/Bottom Entity",BoardOutline:"Board Outline"},jqe=["PadDrill","IsolatedTopPad","ThroughHoleTopPad","SurfaceMountTopPad","IsolatedBottomPad","ThroughHoleBottomPad","SurfaceMountBottomPad","IsolatedMultiPad","ThroughHoleMultiPad"];var y$=15,hAe=30,uAe=19,pDt=29,Jfe=256,pAe=Jfe+1+pDt,Xqe=2*pAe+1,f$=256,fDt=7,qqe=16,$qe=17,Kqe=18,sAe=16,Qfe=-1,mDt=1,zfe=2,gDt=0,CU=0,Zqe=1,yDt=3,iP=4,r9=0,n$e=1,Yfe=2,i9=-2,bDt=-3,IU=-5,Jqe=[0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,0,0,16,17,18,18,19,19,20,20,20,20,21,21,21,21,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29];function ap(){var o=this;function t(i){var n=o.dyn_tree,s=o.stat_desc.static_tree,a=o.stat_desc.extra_bits,l=o.stat_desc.extra_base,c=o.stat_desc.max_length,h,u,d,p,m,g,y=0;for(p=0;p<=y$;p++)i.bl_count[p]=0;for(n[i.heap[i.heap_max]*2+1]=0,h=i.heap_max+1;h<Xqe;h++)u=i.heap[h],p=n[n[u*2+1]*2+1]+1,p>c&&(p=c,y++),n[u*2+1]=p,!(u>o.max_code)&&(i.bl_count[p]++,m=0,u>=l&&(m=a[u-l]),g=n[u*2],i.opt_len+=g*(p+m),s&&(i.static_len+=g*(s[u*2+1]+m)));if(y!==0){do{for(p=c-1;i.bl_count[p]===0;)p--;i.bl_count[p]--,i.bl_count[p+1]+=2,i.bl_count[c]--,y-=2}while(y>0);for(p=c;p!==0;p--)for(u=i.bl_count[p];u!==0;)d=i.heap[--h],!(d>o.max_code)&&(n[d*2+1]!=p&&(i.opt_len+=(p-n[d*2+1])*n[d*2],n[d*2+1]=p),u--)}}function e(i,n){var s=0;do s|=i&1,i>>>=1,s<<=1;while(--n>0);return s>>>1}function r(i,n,s){var a=[],l=0,c,h,u;for(c=1;c<=y$;c++)a[c]=l=l+s[c-1]<<1;for(h=0;h<=n;h++)u=i[h*2+1],u!==0&&(i[h*2]=e(a[u]++,u))}o.build_tree=function(i){var n=o.dyn_tree,s=o.stat_desc.static_tree,a=o.stat_desc.elems,l,c,h=-1,u;for(i.heap_len=0,i.heap_max=Xqe,l=0;l<a;l++)n[l*2]!==0?(i.heap[++i.heap_len]=h=l,i.depth[l]=0):n[l*2+1]=0;for(;i.heap_len<2;)u=i.heap[++i.heap_len]=h<2?++h:0,n[u*2]=1,i.depth[u]=0,i.opt_len--,s&&(i.static_len-=s[u*2+1]);for(o.max_code=h,l=Math.floor(i.heap_len/2);l>=1;l--)i.pqdownheap(n,l);u=a;do l=i.heap[1],i.heap[1]=i.heap[i.heap_len--],i.pqdownheap(n,1),c=i.heap[1],i.heap[--i.heap_max]=l,i.heap[--i.heap_max]=c,n[u*2]=n[l*2]+n[c*2],i.depth[u]=Math.max(i.depth[l],i.depth[c])+1,n[l*2+1]=n[c*2+1]=u,i.heap[1]=u++,i.pqdownheap(n,1);while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],t(i),r(n,o.max_code,i.bl_count)}}ap._length_code=[0,1,2,3,4,5,6,7,8,8,9,9,10,10,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,28],ap.base_length=[0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224,0],ap.base_dist=[0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576],ap.d_code=function(o){return o<256?Jqe[o]:Jqe[256+(o>>>7)]},ap.extra_lbits=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ap.extra_dbits=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],ap.extra_blbits=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ap.bl_order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function B1(o,t,e,r,i){var n=this;n.static_tree=o,n.extra_bits=t,n.extra_base=e,n.elems=r,n.max_length=i}B1.static_ltree=[12,8,140,8,76,8,204,8,44,8,172,8,108,8,236,8,28,8,156,8,92,8,220,8,60,8,188,8,124,8,252,8,2,8,130,8,66,8,194,8,34,8,162,8,98,8,226,8,18,8,146,8,82,8,210,8,50,8,178,8,114,8,242,8,10,8,138,8,74,8,202,8,42,8,170,8,106,8,234,8,26,8,154,8,90,8,218,8,58,8,186,8,122,8,250,8,6,8,134,8,70,8,198,8,38,8,166,8,102,8,230,8,22,8,150,8,86,8,214,8,54,8,182,8,118,8,246,8,14,8,142,8,78,8,206,8,46,8,174,8,110,8,238,8,30,8,158,8,94,8,222,8,62,8,190,8,126,8,254,8,1,8,129,8,65,8,193,8,33,8,161,8,97,8,225,8,17,8,145,8,81,8,209,8,49,8,177,8,113,8,241,8,9,8,137,8,73,8,201,8,41,8,169,8,105,8,233,8,25,8,153,8,89,8,217,8,57,8,185,8,121,8,249,8,5,8,133,8,69,8,197,8,37,8,165,8,101,8,229,8,21,8,149,8,85,8,213,8,53,8,181,8,117,8,245,8,13,8,141,8,77,8,205,8,45,8,173,8,109,8,237,8,29,8,157,8,93,8,221,8,61,8,189,8,125,8,253,8,19,9,275,9,147,9,403,9,83,9,339,9,211,9,467,9,51,9,307,9,179,9,435,9,115,9,371,9,243,9,499,9,11,9,267,9,139,9,395,9,75,9,331,9,203,9,459,9,43,9,299,9,171,9,427,9,107,9,363,9,235,9,491,9,27,9,283,9,155,9,411,9,91,9,347,9,219,9,475,9,59,9,315,9,187,9,443,9,123,9,379,9,251,9,507,9,7,9,263,9,135,9,391,9,71,9,327,9,199,9,455,9,39,9,295,9,167,9,423,9,103,9,359,9,231,9,487,9,23,9,279,9,151,9,407,9,87,9,343,9,215,9,471,9,55,9,311,9,183,9,439,9,119,9,375,9,247,9,503,9,15,9,271,9,143,9,399,9,79,9,335,9,207,9,463,9,47,9,303,9,175,9,431,9,111,9,367,9,239,9,495,9,31,9,287,9,159,9,415,9,95,9,351,9,223,9,479,9,63,9,319,9,191,9,447,9,127,9,383,9,255,9,511,9,0,7,64,7,32,7,96,7,16,7,80,7,48,7,112,7,8,7,72,7,40,7,104,7,24,7,88,7,56,7,120,7,4,7,68,7,36,7,100,7,20,7,84,7,52,7,116,7,3,8,131,8,67,8,195,8,35,8,163,8,99,8,227,8],B1.static_dtree=[0,5,16,5,8,5,24,5,4,5,20,5,12,5,28,5,2,5,18,5,10,5,26,5,6,5,22,5,14,5,30,5,1,5,17,5,9,5,25,5,5,5,21,5,13,5,29,5,3,5,19,5,11,5,27,5,7,5,23,5],B1.static_l_desc=new B1(B1.static_ltree,ap.extra_lbits,Jfe+1,pAe,y$),B1.static_d_desc=new B1(B1.static_dtree,ap.extra_dbits,0,hAe,y$),B1.static_bl_desc=new B1(null,ap.extra_blbits,0,uAe,fDt);var PDt=9,TDt=8;function bE(o,t,e,r,i){var n=this;n.good_length=o,n.max_lazy=t,n.nice_length=e,n.max_chain=r,n.func=i}var o$e=0,Kfe=1,U5=2,QS=[new bE(0,0,0,0,o$e),new bE(4,4,8,4,Kfe),new bE(4,5,16,8,Kfe),new bE(4,6,32,32,Kfe),new bE(4,4,16,16,U5),new bE(8,16,32,32,U5),new bE(8,16,128,128,U5),new bE(8,32,128,256,U5),new bE(32,128,258,1024,U5),new bE(32,258,258,4096,U5)],jfe=["need dictionary","stream end","","","stream error","data error","","buffer error","",""],e9=0,Xfe=1,m$=2,qfe=3,IDt=32,aAe=42,$fe=113,g$=666,lAe=8,CDt=0,cAe=1,SDt=2,Fp=3,Zfe=258,ET=Zfe+Fp+1;function Qqe(o,t,e,r){var i=o[t*2],n=o[e*2];return i<n||i==n&&r[t]<=r[e]}function EDt(){var o=this,t,e,r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,x,v,D,w,F,H,z,V,W,L=new ap,k=new ap,N=new ap;o.depth=[];var U,B,G,Y,X,K,J,se;o.bl_count=[],o.heap=[],z=[],V=[],W=[];function ce(){var Fe;for(c=2*n,u[p-1]=0,Fe=0;Fe<p-1;Fe++)u[Fe]=0;v=QS[D].max_lazy,F=QS[D].good_length,H=QS[D].nice_length,x=QS[D].max_chain,C=0,b=0,O=0,P=_=Fp-1,I=0,d=0}function te(){var Fe;for(Fe=0;Fe<pAe;Fe++)z[Fe*2]=0;for(Fe=0;Fe<hAe;Fe++)V[Fe*2]=0;for(Fe=0;Fe<uAe;Fe++)W[Fe*2]=0;z[f$*2]=1,o.opt_len=o.static_len=0,G=X=0}function oe(){L.dyn_tree=z,L.stat_desc=B1.static_l_desc,k.dyn_tree=V,k.stat_desc=B1.static_d_desc,N.dyn_tree=W,N.stat_desc=B1.static_bl_desc,J=0,se=0,K=8,te()}o.pqdownheap=function(Fe,tt){for(var ye=o.heap,yt=ye[tt],Wt=tt<<1;Wt<=o.heap_len&&(Wt<o.heap_len&&Qqe(Fe,ye[Wt+1],ye[Wt],o.depth)&&Wt++,!Qqe(Fe,yt,ye[Wt],o.depth));)ye[tt]=ye[Wt],tt=Wt,Wt<<=1;ye[tt]=yt};function $(Fe,tt){var ye,yt=-1,Wt,pe=Fe[1],Xe=0,ct=7,Me=4;for(pe===0&&(ct=138,Me=3),Fe[(tt+1)*2+1]=65535,ye=0;ye<=tt;ye++)Wt=pe,pe=Fe[(ye+1)*2+1],!(++Xe<ct&&Wt==pe)&&(Xe<Me?W[Wt*2]+=Xe:Wt!==0?(Wt!=yt&&W[Wt*2]++,W[qqe*2]++):Xe<=10?W[$qe*2]++:W[Kqe*2]++,Xe=0,yt=Wt,pe===0?(ct=138,Me=3):Wt==pe?(ct=6,Me=3):(ct=7,Me=4))}function fe(){var Fe;for($(z,L.max_code),$(V,k.max_code),N.build_tree(o),Fe=uAe-1;Fe>=3&&W[ap.bl_order[Fe]*2+1]===0;Fe--);return o.opt_len+=3*(Fe+1)+5+5+4,Fe}function Oe(Fe){o.pending_buf[o.pending++]=Fe}function Te(Fe){Oe(Fe&255),Oe(Fe>>>8&255)}function ue(Fe){Oe(Fe>>8&255),Oe(Fe&255&255)}function be(Fe,tt){var ye,yt=tt;se>sAe-yt?(ye=Fe,J|=ye<<se&65535,Te(J),J=ye>>>sAe-se,se+=yt-sAe):(J|=Fe<<se&65535,se+=yt)}function j(Fe,tt){var ye=Fe*2;be(tt[ye]&65535,tt[ye+1]&65535)}function Z(Fe,tt){var ye,yt=-1,Wt,pe=Fe[1],Xe=0,ct=7,Me=4;for(pe===0&&(ct=138,Me=3),ye=0;ye<=tt;ye++)if(Wt=pe,pe=Fe[(ye+1)*2+1],!(++Xe<ct&&Wt==pe)){if(Xe<Me)do j(Wt,W);while(--Xe!==0);else Wt!==0?(Wt!=yt&&(j(Wt,W),Xe--),j(qqe,W),be(Xe-3,2)):Xe<=10?(j($qe,W),be(Xe-3,3)):(j(Kqe,W),be(Xe-11,7));Xe=0,yt=Wt,pe===0?(ct=138,Me=3):Wt==pe?(ct=6,Me=3):(ct=7,Me=4)}}function ie(Fe,tt,ye){var yt;for(be(Fe-257,5),be(tt-1,5),be(ye-4,4),yt=0;yt<ye;yt++)be(W[ap.bl_order[yt]*2+1],3);Z(z,Fe-1),Z(V,tt-1)}function de(){se==16?(Te(J),J=0,se=0):se>=8&&(Oe(J&255),J>>>=8,se-=8)}function me(){be(cAe<<1,3),j(f$,B1.static_ltree),de(),1+K+10-se<9&&(be(cAe<<1,3),j(f$,B1.static_ltree),de()),K=7}function Se(Fe,tt){var ye,yt,Wt;if(o.pending_buf[Y+G*2]=Fe>>>8&255,o.pending_buf[Y+G*2+1]=Fe&255,o.pending_buf[U+G]=tt&255,G++,Fe===0?z[tt*2]++:(X++,Fe--,z[(ap._length_code[tt]+Jfe+1)*2]++,V[ap.d_code(Fe)*2]++),!(G&8191)&&D>2){for(ye=G*8,yt=C-b,Wt=0;Wt<hAe;Wt++)ye+=V[Wt*2]*(5+ap.extra_dbits[Wt]);if(ye>>>=3,X<Math.floor(G/2)&&ye<Math.floor(yt/2))return!0}return G==B-1}function Re(Fe,tt){var ye,yt,Wt=0,pe,Xe;if(G!==0)do ye=o.pending_buf[Y+Wt*2]<<8&65280|o.pending_buf[Y+Wt*2+1]&255,yt=o.pending_buf[U+Wt]&255,Wt++,ye===0?j(yt,Fe):(pe=ap._length_code[yt],j(pe+Jfe+1,Fe),Xe=ap.extra_lbits[pe],Xe!==0&&(yt-=ap.base_length[pe],be(yt,Xe)),ye--,pe=ap.d_code(ye),j(pe,tt),Xe=ap.extra_dbits[pe],Xe!==0&&(ye-=ap.base_dist[pe],be(ye,Xe)));while(Wt<G);j(f$,Fe),K=Fe[f$*2+1]}function Je(){se>8?Te(J):se>0&&Oe(J&255),J=0,se=0}function Ke(Fe,tt,ye){Je(),K=8,ye&&(Te(tt),Te(~tt)),o.pending_buf.set(l.subarray(Fe,Fe+tt),o.pending),o.pending+=tt}function Gt(Fe,tt,ye){be((CDt<<1)+(ye?1:0),3),Ke(Fe,tt,!0)}function Nr(Fe,tt,ye){var yt,Wt,pe=0;D>0?(L.build_tree(o),k.build_tree(o),pe=fe(),yt=o.opt_len+3+7>>>3,Wt=o.static_len+3+7>>>3,Wt<=yt&&(yt=Wt)):yt=Wt=tt+5,tt+4<=yt&&Fe!=-1?Gt(Fe,tt,ye):Wt==yt?(be((cAe<<1)+(ye?1:0),3),Re(B1.static_ltree,B1.static_dtree)):(be((SDt<<1)+(ye?1:0),3),ie(L.max_code+1,k.max_code+1,pe+1),Re(z,V)),te(),ye&&Je()}function xr(Fe){Nr(b>=0?b:-1,C-b,Fe),b=C,t.flush_pending()}function vr(){var Fe,tt,ye,yt;do{if(yt=c-O-C,yt===0&&C===0&&O===0)yt=n;else if(yt==-1)yt--;else if(C>=n+n-ET){l.set(l.subarray(n,n+n),0),E-=n,C-=n,b-=n,Fe=p,ye=Fe;do tt=u[--ye]&65535,u[ye]=tt>=n?tt-n:0;while(--Fe!==0);Fe=n,ye=Fe;do tt=h[--ye]&65535,h[ye]=tt>=n?tt-n:0;while(--Fe!==0);yt+=n}if(t.avail_in===0)return;Fe=t.read_buf(l,C+O,yt),O+=Fe,O>=Fp&&(d=l[C]&255,d=(d<<y^l[C+1]&255)&g)}while(O<ET&&t.avail_in!==0)}function _r(Fe){var tt=65535,ye;for(tt>r-5&&(tt=r-5);;){if(O<=1){if(vr(),O===0&&Fe==CU)return e9;if(O===0)break}if(C+=O,O=0,ye=b+tt,(C===0||C>=ye)&&(O=C-ye,C=ye,xr(!1),t.avail_out===0)||C-b>=n-ET&&(xr(!1),t.avail_out===0))return e9}return xr(Fe==iP),t.avail_out===0?Fe==iP?m$:e9:Fe==iP?qfe:Xfe}function Ne(Fe){var tt=x,ye=C,yt,Wt,pe=_,Xe=C>n-ET?C-(n-ET):0,ct=H,Me=a,st=C+Zfe,Ot=l[ye+pe-1],hr=l[ye+pe];_>=F&&(tt>>=2),ct>O&&(ct=O);do if(yt=Fe,!(l[yt+pe]!=hr||l[yt+pe-1]!=Ot||l[yt]!=l[ye]||l[++yt]!=l[ye+1])){ye+=2,yt++;do;while(l[++ye]==l[++yt]&&l[++ye]==l[++yt]&&l[++ye]==l[++yt]&&l[++ye]==l[++yt]&&l[++ye]==l[++yt]&&l[++ye]==l[++yt]&&l[++ye]==l[++yt]&&l[++ye]==l[++yt]&&ye<st);if(Wt=Zfe-(st-ye),ye=st-Zfe,Wt>pe){if(E=Fe,pe=Wt,Wt>=ct)break;Ot=l[ye+pe-1],hr=l[ye+pe]}}while((Fe=h[Fe&Me]&65535)>Xe&&--tt!==0);return pe<=O?pe:O}function Vt(Fe){for(var tt=0,ye;;){if(O<ET){if(vr(),O<ET&&Fe==CU)return e9;if(O===0)break}if(O>=Fp&&(d=(d<<y^l[C+(Fp-1)]&255)&g,tt=u[d]&65535,h[C&a]=u[d],u[d]=C),tt!==0&&(C-tt&65535)<=n-ET&&w!=zfe&&(P=Ne(tt)),P>=Fp)if(ye=Se(C-E,P-Fp),O-=P,P<=v&&O>=Fp){P--;do C++,d=(d<<y^l[C+(Fp-1)]&255)&g,tt=u[d]&65535,h[C&a]=u[d],u[d]=C;while(--P!==0);C++}else C+=P,P=0,d=l[C]&255,d=(d<<y^l[C+1]&255)&g;else ye=Se(0,l[C]&255),O--,C++;if(ye&&(xr(!1),t.avail_out===0))return e9}return xr(Fe==iP),t.avail_out===0?Fe==iP?m$:e9:Fe==iP?qfe:Xfe}function Ft(Fe){for(var tt=0,ye,yt;;){if(O<ET){if(vr(),O<ET&&Fe==CU)return e9;if(O===0)break}if(O>=Fp&&(d=(d<<y^l[C+(Fp-1)]&255)&g,tt=u[d]&65535,h[C&a]=u[d],u[d]=C),_=P,T=E,P=Fp-1,tt!==0&&_<v&&(C-tt&65535)<=n-ET&&(w!=zfe&&(P=Ne(tt)),P<=5&&(w==mDt||P==Fp&&C-E>4096)&&(P=Fp-1)),_>=Fp&&P<=_){yt=C+O-Fp,ye=Se(C-1-T,_-Fp),O-=_-1,_-=2;do++C<=yt&&(d=(d<<y^l[C+(Fp-1)]&255)&g,tt=u[d]&65535,h[C&a]=u[d],u[d]=C);while(--_!==0);if(I=0,P=Fp-1,C++,ye&&(xr(!1),t.avail_out===0))return e9}else if(I!==0){if(ye=Se(0,l[C-1]&255),ye&&xr(!1),C++,O--,t.avail_out===0)return e9}else I=1,C++,O--}return I!==0&&(ye=Se(0,l[C-1]&255),I=0),xr(Fe==iP),t.avail_out===0?Fe==iP?m$:e9:Fe==iP?qfe:Xfe}function ir(Fe){return Fe.total_in=Fe.total_out=0,Fe.msg=null,o.pending=0,o.pending_out=0,e=$fe,i=CU,oe(),ce(),r9}o.deflateInit=function(Fe,tt,ye,yt,Wt,pe){return yt||(yt=lAe),Wt||(Wt=TDt),pe||(pe=gDt),Fe.msg=null,tt==Qfe&&(tt=6),Wt<1||Wt>PDt||yt!=lAe||ye<9||ye>15||tt<0||tt>9||pe<0||pe>zfe?i9:(Fe.dstate=o,s=ye,n=1<<s,a=n-1,m=Wt+7,p=1<<m,g=p-1,y=Math.floor((m+Fp-1)/Fp),l=new Uint8Array(n*2),h=[],u=[],B=1<<Wt+6,o.pending_buf=new Uint8Array(B*4),r=B*4,Y=Math.floor(B/2),U=3*B,D=tt,w=pe,ir(Fe))},o.deflateEnd=function(){return e!=aAe&&e!=$fe&&e!=g$?i9:(o.pending_buf=null,u=null,h=null,l=null,o.dstate=null,e==$fe?bDt:r9)},o.deflateParams=function(Fe,tt,ye){var yt=r9;return tt==Qfe&&(tt=6),tt<0||tt>9||ye<0||ye>zfe?i9:(QS[D].func!=QS[tt].func&&Fe.total_in!==0&&(yt=Fe.deflate(Zqe)),D!=tt&&(D=tt,v=QS[D].max_lazy,F=QS[D].good_length,H=QS[D].nice_length,x=QS[D].max_chain),w=ye,yt)},o.deflateSetDictionary=function(Fe,tt,ye){var yt=ye,Wt,pe=0;if(!tt||e!=aAe)return i9;if(yt<Fp)return r9;for(yt>n-ET&&(yt=n-ET,pe=ye-yt),l.set(tt.subarray(pe,pe+yt),0),C=yt,b=yt,d=l[0]&255,d=(d<<y^l[1]&255)&g,Wt=0;Wt<=yt-Fp;Wt++)d=(d<<y^l[Wt+(Fp-1)]&255)&g,h[Wt&a]=u[d],u[d]=Wt;return r9},o.deflate=function(Fe,tt){var ye,yt,Wt,pe,Xe;if(tt>iP||tt<0)return i9;if(!Fe.next_out||!Fe.next_in&&Fe.avail_in!==0||e==g$&&tt!=iP)return Fe.msg=jfe[Yfe-i9],i9;if(Fe.avail_out===0)return Fe.msg=jfe[Yfe-IU],IU;if(t=Fe,pe=i,i=tt,e==aAe&&(yt=lAe+(s-8<<4)<<8,Wt=(D-1&255)>>1,Wt>3&&(Wt=3),yt|=Wt<<6,C!==0&&(yt|=IDt),yt+=31-yt%31,e=$fe,ue(yt)),o.pending!==0){if(t.flush_pending(),t.avail_out===0)return i=-1,r9}else if(t.avail_in===0&&tt<=pe&&tt!=iP)return t.msg=jfe[Yfe-IU],IU;if(e==g$&&t.avail_in!==0)return Fe.msg=jfe[Yfe-IU],IU;if(t.avail_in!==0||O!==0||tt!=CU&&e!=g$){switch(Xe=-1,QS[D].func){case o$e:Xe=_r(tt);break;case Kfe:Xe=Vt(tt);break;case U5:Xe=Ft(tt);break;default:}if((Xe==m$||Xe==qfe)&&(e=g$),Xe==e9||Xe==m$)return t.avail_out===0&&(i=-1),r9;if(Xe==Xfe){if(tt==Zqe)me();else if(Gt(0,0,!1),tt==yDt)for(ye=0;ye<p;ye++)u[ye]=0;if(t.flush_pending(),t.avail_out===0)return i=-1,r9}}return tt!=iP?r9:n$e}}function s$e(){var o=this;o.next_in_index=0,o.next_out_index=0,o.avail_in=0,o.total_in=0,o.avail_out=0,o.total_out=0}s$e.prototype={deflateInit:function(o,t){var e=this;return e.dstate=new EDt,t||(t=y$),e.dstate.deflateInit(e,o,t)},deflate:function(o){var t=this;return t.dstate?t.dstate.deflate(t,o):i9},deflateEnd:function(){var o=this;if(!o.dstate)return i9;var t=o.dstate.deflateEnd();return o.dstate=null,t},deflateParams:function(o,t){var e=this;return e.dstate?e.dstate.deflateParams(e,o,t):i9},deflateSetDictionary:function(o,t){var e=this;return e.dstate?e.dstate.deflateSetDictionary(e,o,t):i9},read_buf:function(o,t,e){var r=this,i=r.avail_in;return i>e&&(i=e),i===0?0:(r.avail_in-=i,o.set(r.next_in.subarray(r.next_in_index,r.next_in_index+i),t),r.next_in_index+=i,r.total_in+=i,i)},flush_pending:function(){var o=this,t=o.dstate.pending;t>o.avail_out&&(t=o.avail_out),t!==0&&(o.next_out.set(o.dstate.pending_buf.subarray(o.dstate.pending_out,o.dstate.pending_out+t),o.next_out_index),o.next_out_index+=t,o.dstate.pending_out+=t,o.total_out+=t,o.avail_out-=t,o.dstate.pending-=t,o.dstate.pending===0&&(o.dstate.pending_out=0))}};function dAe(o){var t=this,e=new s$e,r=512,i=CU,n=new Uint8Array(r),s=o?o.level:Qfe;typeof s>"u"&&(s=Qfe),e.deflateInit(s),e.next_out=n,t.append=function(a,l){var c,h=[],u=0,d=0,p=0,m;if(a.length){e.next_in_index=0,e.next_in=a,e.avail_in=a.length;do{if(e.next_out_index=0,e.avail_out=r,c=e.deflate(i),c!=r9)throw new Error("deflating: "+e.msg);e.next_out_index&&(e.next_out_index==r?h.push(new Uint8Array(n)):h.push(new Uint8Array(n.subarray(0,e.next_out_index)))),p+=e.next_out_index,l&&e.next_in_index>0&&e.next_in_index!=u&&(l(e.next_in_index),u=e.next_in_index)}while(e.avail_in>0||e.avail_out===0);return m=new Uint8Array(p),h.forEach(function(g){m.set(g,d),d+=g.length}),m}},t.flush=function(){var a,l=[],c=0,h=0,u;do{if(e.next_out_index=0,e.avail_out=r,a=e.deflate(iP),a!=n$e&&a!=r9)throw new Error("deflating: "+e.msg);r-e.avail_out>0&&l.push(new Uint8Array(n.subarray(0,e.next_out_index))),h+=e.next_out_index}while(e.avail_in>0||e.avail_out===0);return e.deflateEnd(),u=new Uint8Array(h),l.forEach(function(d){u.set(d,c),c+=d.length}),u}}var ODt={Arial:{bbox:"-665 -325 2000 1006",flags:"32",stemV:"80",italicAngle:"0",ascender:"1006",decender:"-325",capHeight:"500",widths:"278 278 355 556 556 889 667 191 333 333 389 584 278 333 278 278 556 556 556 556 556 556 556 556 556 556 278 278 584 584 584 556 1015 667 667 722 722 667 611 778 722 278 500 667 556 833 722 778 667 778 722 667 611 722 667 944 667 667 611 278 278 278 469 556 333 556 556 500 556 556 278 556 556 222 222 500 222 833 556 556 556 556 333 500 278 556 500 722 500 500 500 334 260 334 584 500 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 278 333 556 556 556 556 260 556 333 737 370 556 584 333 737 552 400 549 333 333 333 576 537 333 333 333 365 556 834 834 834 611 667 667 667 667 667 667 1000 722 667 667 667 667 278 278 278 278 722 722 778 778 778 778 778 584 778 722 722 722 722 667 667 611 556 556 556 556 556 556 889 500 556 556 556 556 278 278 278 278 556 556 556 556 556 556 556 549 611 556 556 556 556 500 556 500",encoding:"WinAnsiEncoding",ranges:[{start:32,end:126},{start:160,end:879},{start:884,end:885},{start:890,end:894},{start:900,end:906},{start:908,end:908},{start:910,end:929},{start:931,end:974},{start:976,end:1299},{start:1306,end:1309},{start:1425,end:1479},{start:1488,end:1514},{start:1520,end:1524},{start:1536,end:1539},{start:1547,end:1557},{start:1563,end:1563},{start:1566,end:1567},{start:1569,end:1594},{start:1600,end:1630},{start:1632,end:1791},{start:1872,end:1901},{start:7424,end:7626},{start:7678,end:7835},{start:7838,end:7838},{start:7840,end:7929},{start:7936,end:7957},{start:7960,end:7965},{start:7968,end:8005},{start:8008,end:8013},{start:8016,end:8023},{start:8025,end:8025},{start:8027,end:8027},{start:8029,end:8029},{start:8031,end:8061},{start:8064,end:8116},{start:8118,end:8132},{start:8134,end:8147},{start:8150,end:8155},{start:8157,end:8175},{start:8178,end:8180},{start:8182,end:8190},{start:8192,end:8207},{start:8210,end:8226},{start:8230,end:8230},{start:8234,end:8240},{start:8242,end:8244},{start:8249,end:8250},{start:8252,end:8252},{start:8254,end:8254},{start:8260,end:8260},{start:8286,end:8286},{start:8298,end:8303},{start:8319,end:8319},{start:8336,end:8340},{start:8352,end:8373},{start:8376,end:8376},{start:8432,end:8432},{start:8453,end:8453},{start:8467,end:8467},{start:8470,end:8471},{start:8482,end:8482},{start:8486,end:8486},{start:8494,end:8494},{start:8525,end:8526},{start:8531,end:8532},{start:8539,end:8542},{start:8580,end:8580},{start:8592,end:8597},{start:8616,end:8616},{start:8706,end:8706},{start:8710,end:8710},{start:8719,end:8719},{start:8721,end:8722},{start:8725,end:8725},{start:8729,end:8730},{start:8734,end:8735},{start:8745,end:8745},{start:8747,end:8747},{start:8776,end:8776},{start:8800,end:8801},{start:8804,end:8805},{start:8962,end:8962},{start:8976,end:8976},{start:8992,end:8993},{start:9472,end:9472},{start:9474,end:9474},{start:9484,end:9484},{start:9488,end:9488},{start:9492,end:9492},{start:9496,end:9496},{start:9500,end:9500},{start:9508,end:9508},{start:9516,end:9516},{start:9524,end:9524},{start:9532,end:9532},{start:9552,end:9580},{start:9600,end:9600},{start:9604,end:9604},{start:9608,end:9608},{start:9612,end:9612},{start:9616,end:9619},{start:9632,end:9633},{start:9642,end:9644},{start:9650,end:9650},{start:9658,end:9658},{start:9660,end:9660},{start:9668,end:9668},{start:9674,end:9676},{start:9679,end:9679},{start:9688,end:9689},{start:9702,end:9702},{start:9786,end:9788},{start:9792,end:9792},{start:9794,end:9794},{start:9824,end:9824},{start:9827,end:9827},{start:9829,end:9830},{start:9834,end:9835},{start:9839,end:9839},{start:11360,end:11373},{start:11377,end:11383},{start:11799,end:11799},{start:42775,end:42785},{start:42888,end:42892},{start:64257,end:64258},{start:64285,end:64310},{start:64312,end:64316},{start:64318,end:64318},{start:64320,end:64321},{start:64323,end:64324},{start:64326,end:64433},{start:64467,end:64489},{start:64508,end:64511},{start:64606,end:64610},{start:64830,end:64831},{start:65010,end:65010},{start:65020,end:65020},{start:65056,end:65059},{start:65152,end:65276},{start:65532,end:65532}]},Verdana:{bbox:"-559 -303 1446 1050",flags:"32",stemV:"0",italicAngle:"0",ascender:"1005",decender:"-209",capHeight:"727",widths:"351 393 458 818 635 1076 726 268 454 454 635 818 363 454 363 454 635 635 635 635 635 635 635 635 635 635 454 454 818 818 818 545 1000 683 685 698 770 632 574 775 751 420 454 692 556 842 748 787 603 787 695 683 616 731 683 988 685 615 685 454 454 454 818 635 635 600 623 520 623 595 351 623 632 274 344 591 274 972 632 606 623 623 426 520 394 632 591 818 591 591 525 634 454 634 818 632 635 545 268 635 458 818 635 635 635 1521 683 454 1069 545 685 545 545 268 268 458 458 545 635 1000 635 976 520 454 981 545 525 615 351 393 635 635 635 635 454 635 635 1000 545 644 818 454 1000 635 541 818 541 541 635 641 635 363 635 541 545 644 1000 1000 1000 545 683 683 683 683 683 683 984 698 632 632 632 632 420 420 420 420 775 748 787 787 787 787 787 818 787 731 731 731 731 615 605 620 600 600 600 600 600 600 955 520 595 595 595 595 274 274 274 274 611 632 606 606 606 606 606 818 606 632 632 632 632 591 623 591",encoding:"WinAnsiEncoding",ranges:[{start:32,end:126},{start:160,end:383},{start:399,end:399},{start:402,end:402},{start:416,end:417},{start:431,end:432},{start:506,end:511},{start:536,end:539},{start:601,end:601},{start:710,end:711},{start:713,end:713},{start:728,end:733},{start:768,end:769},{start:771,end:771},{start:777,end:777},{start:803,end:803},{start:819,end:819},{start:839,end:839},{start:894,end:894},{start:900,end:906},{start:908,end:908},{start:910,end:929},{start:931,end:974},{start:1025,end:1103},{start:1105,end:1119},{start:1144,end:1145},{start:1148,end:1149},{start:1159,end:1159},{start:1168,end:1171},{start:1174,end:1175},{start:1178,end:1181},{start:1186,end:1187},{start:1192,end:1193},{start:1198,end:1203},{start:1208,end:1215},{start:1240,end:1241},{start:1256,end:1257},{start:1306,end:1309},{start:1380,end:1380},{start:1408,end:1408},{start:3647,end:3647},{start:7808,end:7813},{start:7838,end:7838},{start:7840,end:7929},{start:8210,end:8213},{start:8215,end:8226},{start:8230,end:8230},{start:8239,end:8240},{start:8242,end:8244},{start:8249,end:8250},{start:8252,end:8252},{start:8254,end:8254},{start:8260,end:8260},{start:8308,end:8309},{start:8311,end:8312},{start:8319,end:8319},{start:8352,end:8373},{start:8376,end:8376},{start:8432,end:8432},{start:8453,end:8453},{start:8467,end:8467},{start:8470,end:8470},{start:8480,end:8480},{start:8482,end:8482},{start:8486,end:8486},{start:8494,end:8494},{start:8539,end:8542},{start:8706,end:8706},{start:8710,end:8710},{start:8719,end:8719},{start:8721,end:8722},{start:8725,end:8725},{start:8729,end:8730},{start:8734,end:8734},{start:8747,end:8747},{start:8776,end:8776},{start:8800,end:8801},{start:8804,end:8805},{start:9472,end:9472},{start:9474,end:9474},{start:9484,end:9484},{start:9488,end:9488},{start:9492,end:9492},{start:9496,end:9496},{start:9633,end:9633},{start:9642,end:9643},{start:9674,end:9674},{start:9679,end:9679},{start:9702,end:9702},{start:9834,end:9834},{start:11373,end:11373},{start:11377,end:11379},{start:42779,end:42783},{start:42888,end:42892},{start:64257,end:64258},{start:65509,end:65510},{start:65533,end:65533}]},ArialBlack:{bbox:"-193 -306 1687 1083",flags:"32",stemV:"180",italicAngle:"0",ascender:"1100",decender:"-309",capHeight:"0",widths:"333 333 500 660 666 1000 889 277 389 389 556 660 333 333 333 277 666 666 666 666 666 666 666 666 666 666 333 333 660 660 660 610 740 777 777 777 777 722 666 833 833 389 666 833 666 943 833 833 722 833 777 722 722 833 777 1000 777 777 722 389 277 389 660 500 333 666 666 666 666 666 389 666 666 333 333 666 333 1000 666 666 666 666 443 610 443 666 610 943 666 610 556 389 277 389 660 666 666 500 277 666 500 1000 666 666 333 1000 722 333 1000 500 722 500 500 277 277 500 500 500 500 1000 333 950 610 333 1000 500 556 777 333 333 666 666 660 666 277 666 333 799 399 666 660 333 799 500 399 660 399 399 333 666 850 333 333 399 399 666 1000 1000 1000 610 777 777 777 777 777 777 1000 777 722 722 722 722 389 389 389 389 777 833 833 833 833 833 833 660 833 833 833 833 833 777 722 666 666 666 666 666 666 666 1000 666 666 666 666 666 333 333 333 333 666 666 666 666 666 666 666 660 666 666 666 666 666 610 666 610",encoding:"WinAnsiEncoding",ranges:[{start:32,end:126},{start:160,end:383},{start:402,end:402},{start:506,end:511},{start:536,end:539},{start:710,end:711},{start:713,end:713},{start:728,end:733},{start:894,end:894},{start:900,end:906},{start:908,end:908},{start:910,end:929},{start:931,end:974},{start:1025,end:1036},{start:1038,end:1103},{start:1105,end:1116},{start:1118,end:1119},{start:1168,end:1169},{start:7808,end:7813},{start:7922,end:7923},{start:8211,end:8213},{start:8215,end:8222},{start:8224,end:8226},{start:8230,end:8230},{start:8240,end:8240},{start:8242,end:8243},{start:8249,end:8250},{start:8252,end:8252},{start:8254,end:8254},{start:8260,end:8260},{start:8308,end:8309},{start:8311,end:8312},{start:8319,end:8319},{start:8355,end:8356},{start:8359,end:8359},{start:8364,end:8364},{start:8453,end:8453},{start:8467,end:8467},{start:8470,end:8470},{start:8482,end:8482},{start:8486,end:8486},{start:8494,end:8494},{start:8539,end:8542},{start:8592,end:8597},{start:8616,end:8616},{start:8706,end:8706},{start:8710,end:8710},{start:8719,end:8719},{start:8721,end:8722},{start:8725,end:8725},{start:8729,end:8730},{start:8734,end:8735},{start:8745,end:8745},{start:8747,end:8747},{start:8776,end:8776},{start:8800,end:8801},{start:8804,end:8805},{start:8962,end:8962},{start:8976,end:8976},{start:8992,end:8993},{start:9472,end:9472},{start:9474,end:9474},{start:9484,end:9484},{start:9488,end:9488},{start:9492,end:9492},{start:9496,end:9496},{start:9500,end:9500},{start:9508,end:9508},{start:9516,end:9516},{start:9524,end:9524},{start:9532,end:9532},{start:9552,end:9580},{start:9600,end:9600},{start:9604,end:9604},{start:9608,end:9608},{start:9612,end:9612},{start:9616,end:9619},{start:9632,end:9633},{start:9642,end:9644},{start:9650,end:9650},{start:9658,end:9658},{start:9660,end:9660},{start:9668,end:9668},{start:9674,end:9675},{start:9679,end:9679},{start:9688,end:9689},{start:9702,end:9702},{start:9786,end:9788},{start:9792,end:9792},{start:9794,end:9794},{start:9824,end:9824},{start:9827,end:9827},{start:9829,end:9830},{start:9834,end:9835},{start:64257,end:64258}]},ArialNarrow:{bbox:"-182 -306 999 1085",flags:"32",stemV:"0",italicAngle:"0",ascender:"935",decender:"-211",capHeight:"0",widths:"228 228 291 456 456 729 546 157 272 272 318 479 228 272 228 228 456 456 456 456 456 456 456 456 456 456 228 228 479 479 479 456 832 546 546 591 591 546 500 638 591 228 410 546 456 683 591 638 546 638 591 546 500 591 546 773 546 546 500 228 228 228 384 456 272 456 456 410 456 456 228 456 456 182 182 410 182 683 456 456 456 456 272 410 228 456 410 591 410 410 410 273 212 273 479 456 456 287 182 456 272 819 456 456 272 819 546 272 819 287 500 287 287 182 182 272 272 287 456 819 272 819 410 272 773 287 410 546 228 272 456 456 456 456 212 456 272 604 303 456 479 272 604 500 399 548 272 272 272 576 439 271 272 272 298 456 684 684 684 500 546 546 546 546 546 546 819 591 546 546 546 546 228 228 228 228 591 591 638 638 638 638 638 479 638 591 591 591 591 546 546 500 456 456 456 456 456 456 729 410 456 456 456 456 228 228 228 228 456 456 456 456 456 456 456 548 500 456 456 456 456 410 456 410",encoding:"WinAnsiEncoding",ranges:[{start:32,end:126},{start:160,end:383},{start:402,end:402},{start:506,end:511},{start:536,end:539},{start:710,end:711},{start:713,end:713},{start:728,end:733},{start:894,end:894},{start:900,end:906},{start:908,end:908},{start:910,end:929},{start:931,end:974},{start:1025,end:1036},{start:1038,end:1103},{start:1105,end:1116},{start:1118,end:1119},{start:1168,end:1169},{start:7808,end:7813},{start:7922,end:7923},{start:8211,end:8213},{start:8215,end:8222},{start:8224,end:8226},{start:8230,end:8230},{start:8240,end:8240},{start:8242,end:8243},{start:8249,end:8250},{start:8252,end:8252},{start:8254,end:8254},{start:8260,end:8260},{start:8319,end:8319},{start:8355,end:8356},{start:8359,end:8359},{start:8364,end:8364},{start:8453,end:8453},{start:8467,end:8467},{start:8470,end:8470},{start:8482,end:8482},{start:8486,end:8486},{start:8494,end:8494},{start:8539,end:8542},{start:8592,end:8597},{start:8616,end:8616},{start:8706,end:8706},{start:8710,end:8710},{start:8719,end:8719},{start:8721,end:8722},{start:8725,end:8725},{start:8729,end:8730},{start:8734,end:8735},{start:8745,end:8745},{start:8747,end:8747},{start:8776,end:8776},{start:8800,end:8801},{start:8804,end:8805},{start:8962,end:8962},{start:8976,end:8976},{start:8992,end:8993},{start:9472,end:9472},{start:9474,end:9474},{start:9484,end:9484},{start:9488,end:9488},{start:9492,end:9492},{start:9496,end:9496},{start:9500,end:9500},{start:9508,end:9508},{start:9516,end:9516},{start:9524,end:9524},{start:9532,end:9532},{start:9552,end:9580},{start:9600,end:9600},{start:9604,end:9604},{start:9608,end:9608},{start:9612,end:9612},{start:9616,end:9619},{start:9632,end:9633},{start:9642,end:9644},{start:9650,end:9650},{start:9658,end:9658},{start:9660,end:9660},{start:9668,end:9668},{start:9674,end:9675},{start:9679,end:9679},{start:9688,end:9689},{start:9702,end:9702},{start:9786,end:9788},{start:9792,end:9792},{start:9794,end:9794},{start:9824,end:9824},{start:9827,end:9827},{start:9829,end:9830},{start:9834,end:9835},{start:64257,end:64258}]},Tahoma:{bbox:"-599 -215 1515 1034",flags:"32",stemV:"0",italicAngle:"0",ascender:"1000",decender:"-206",capHeight:"727",widths:"312 332 401 727 545 976 673 210 382 382 545 727 302 363 302 382 545 545 545 545 545 545 545 545 545 545 353 353 727 727 727 473 909 599 589 600 678 561 521 667 675 373 416 587 497 770 667 707 551 707 620 557 583 655 596 901 580 576 559 382 382 382 727 545 545 524 552 461 552 526 318 552 557 228 281 498 228 839 557 542 552 552 360 446 334 557 498 742 495 498 444 480 382 480 727 557 545 454 210 545 397 817 545 545 545 1390 557 382 976 454 559 454 454 210 210 401 401 454 545 909 545 875 446 382 908 454 444 576 312 332 545 545 545 545 382 545 545 928 493 573 727 363 928 545 470 727 493 493 545 567 545 353 545 493 493 573 1000 1000 1000 473 599 599 599 599 599 599 913 600 561 561 561 561 373 373 373 373 698 667 707 707 707 707 707 727 707 655 655 655 655 576 565 548 524 524 524 524 524 524 879 461 526 526 526 526 228 228 228 228 545 557 542 542 542 542 542 727 542 557 557 557 557 498 552 498",encoding:"WinAnsiEncoding",ranges:[{start:32,end:126},{start:160,end:831},{start:834,end:879},{start:884,end:885},{start:890,end:894},{start:900,end:906},{start:908,end:908},{start:910,end:929},{start:931,end:974},{start:976,end:1016},{start:1020,end:1299},{start:1306,end:1309},{start:1329,end:1366},{start:1369,end:1375},{start:1377,end:1415},{start:1417,end:1418},{start:1425,end:1479},{start:1488,end:1514},{start:1520,end:1524},{start:1536,end:1539},{start:1547,end:1557},{start:1563,end:1563},{start:1566,end:1567},{start:1569,end:1594},{start:1600,end:1630},{start:1632,end:1791},{start:1872,end:1901},{start:3585,end:3642},{start:3647,end:3675},{start:7424,end:7626},{start:7678,end:7835},{start:7838,end:7838},{start:7840,end:7929},{start:7936,end:7957},{start:7960,end:7965},{start:7968,end:8005},{start:8008,end:8013},{start:8016,end:8023},{start:8025,end:8025},{start:8027,end:8027},{start:8029,end:8029},{start:8031,end:8061},{start:8064,end:8116},{start:8118,end:8132},{start:8134,end:8147},{start:8150,end:8155},{start:8157,end:8175},{start:8178,end:8180},{start:8182,end:8190},{start:8192,end:8207},{start:8210,end:8226},{start:8230,end:8230},{start:8239,end:8240},{start:8242,end:8244},{start:8249,end:8250},{start:8252,end:8252},{start:8254,end:8254},{start:8260,end:8260},{start:8286,end:8286},{start:8319,end:8319},{start:8336,end:8340},{start:8352,end:8373},{start:8432,end:8432},{start:8453,end:8453},{start:8467,end:8467},{start:8470,end:8470},{start:8482,end:8482},{start:8486,end:8486},{start:8494,end:8494},{start:8525,end:8526},{start:8539,end:8542},{start:8580,end:8580},{start:8706,end:8706},{start:8710,end:8710},{start:8719,end:8719},{start:8721,end:8722},{start:8729,end:8730},{start:8734,end:8734},{start:8747,end:8747},{start:8776,end:8776},{start:8800,end:8801},{start:8804,end:8805},{start:9633,end:9633},{start:9642,end:9643},{start:9674,end:9674},{start:9676,end:9676},{start:9679,end:9679},{start:9702,end:9702},{start:9839,end:9839},{start:11360,end:11373},{start:11377,end:11383},{start:11799,end:11799},{start:42775,end:42785},{start:42888,end:42892},{start:64257,end:64258},{start:64285,end:64310},{start:64312,end:64316},{start:64318,end:64318},{start:64320,end:64321},{start:64323,end:64324},{start:64326,end:64433},{start:64467,end:64489},{start:64508,end:64511},{start:64606,end:64610},{start:64830,end:64831},{start:65010,end:65010},{start:65020,end:65020},{start:65056,end:65059},{start:65152,end:65276},{start:65532,end:65533}]},CourierNew:{bbox:"-121 -679 622 1020",flags:"33",stemV:"0",italicAngle:"0",ascender:"832",decender:"-300",capHeight:"571",widths:"600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600",encoding:"WinAnsiEncoding",ranges:[{start:32,end:126},{start:160,end:566},{start:568,end:740},{start:748,end:879},{start:884,end:885},{start:890,end:894},{start:900,end:906},{start:908,end:908},{start:910,end:929},{start:931,end:974},{start:976,end:1299},{start:1306,end:1309},{start:1425,end:1479},{start:1488,end:1514},{start:1520,end:1524},{start:1536,end:1539},{start:1547,end:1557},{start:1563,end:1563},{start:1566,end:1567},{start:1569,end:1594},{start:1600,end:1630},{start:1632,end:1791},{start:1872,end:1901},{start:7424,end:7626},{start:7678,end:7829},{start:7831,end:7835},{start:7838,end:7838},{start:7840,end:7929},{start:7936,end:7957},{start:7960,end:7965},{start:7968,end:8005},{start:8008,end:8013},{start:8016,end:8023},{start:8025,end:8025},{start:8027,end:8027},{start:8029,end:8029},{start:8031,end:8061},{start:8064,end:8116},{start:8118,end:8132},{start:8134,end:8147},{start:8150,end:8155},{start:8157,end:8175},{start:8178,end:8180},{start:8182,end:8190},{start:8204,end:8207},{start:8210,end:8213},{start:8215,end:8226},{start:8230,end:8230},{start:8240,end:8240},{start:8242,end:8244},{start:8249,end:8250},{start:8252,end:8252},{start:8254,end:8254},{start:8260,end:8260},{start:8286,end:8286},{start:8319,end:8319},{start:8336,end:8340},{start:8352,end:8373},{start:8432,end:8432},{start:8453,end:8453},{start:8467,end:8467},{start:8470,end:8470},{start:8482,end:8482},{start:8486,end:8486},{start:8494,end:8494},{start:8525,end:8526},{start:8531,end:8532},{start:8539,end:8542},{start:8580,end:8580},{start:8592,end:8597},{start:8616,end:8616},{start:8706,end:8706},{start:8710,end:8710},{start:8719,end:8719},{start:8721,end:8722},{start:8725,end:8725},{start:8729,end:8730},{start:8734,end:8735},{start:8745,end:8745},{start:8747,end:8747},{start:8776,end:8776},{start:8800,end:8801},{start:8804,end:8805},{start:8962,end:8962},{start:8976,end:8976},{start:8992,end:8993},{start:9472,end:9472},{start:9474,end:9474},{start:9484,end:9484},{start:9488,end:9488},{start:9492,end:9492},{start:9496,end:9496},{start:9500,end:9500},{start:9508,end:9508},{start:9516,end:9516},{start:9524,end:9524},{start:9532,end:9532},{start:9552,end:9580},{start:9600,end:9600},{start:9604,end:9604},{start:9608,end:9608},{start:9612,end:9612},{start:9616,end:9619},{start:9632,end:9633},{start:9642,end:9644},{start:9650,end:9650},{start:9658,end:9658},{start:9660,end:9660},{start:9668,end:9668},{start:9674,end:9676},{start:9679,end:9679},{start:9688,end:9689},{start:9702,end:9702},{start:9786,end:9788},{start:9792,end:9792},{start:9794,end:9794},{start:9824,end:9824},{start:9827,end:9827},{start:9829,end:9830},{start:9834,end:9835},{start:9839,end:9839},{start:11360,end:11373},{start:11377,end:11383},{start:11799,end:11799},{start:42775,end:42785},{start:42888,end:42892},{start:64257,end:64258},{start:64285,end:64310},{start:64312,end:64316},{start:64318,end:64318},{start:64320,end:64321},{start:64323,end:64324},{start:64326,end:64433},{start:64467,end:64489},{start:64508,end:64511},{start:64520,end:64521},{start:64526,end:64526},{start:64530,end:64530},{start:64561,end:64562},{start:64575,end:64580},{start:64590,end:64591},{start:64600,end:64601},{start:64606,end:64610},{start:64618,end:64618},{start:64621,end:64624},{start:64627,end:64629},{start:64654,end:64655},{start:64657,end:64657},{start:64660,end:64660},{start:64668,end:64678},{start:64680,end:64680},{start:64682,end:64682},{start:64684,end:64684},{start:64688,end:64688},{start:64713,end:64726},{start:64728,end:64728},{start:64730,end:64733},{start:64816,end:64816},{start:64828,end:64831},{start:64904,end:64904},{start:65010,end:65010},{start:65020,end:65020},{start:65056,end:65059},{start:65152,end:65276},{start:65279,end:65279},{start:65532,end:65532}]},MSGothic:{bbox:"-121 -136 996 859",flags:"33",stemV:"0",italicAngle:"0",ascender:"859",decender:"-140",capHeight:"679",widths:"500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 1000 1000 1000 500 1000 500 500 500 500 500 500 500 1000 1000 1000 1000 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 1000 1000 500 500 500 500 500 500 500 1000 1000 500 500 1000 500 1000 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 1000 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 1000 500 500 500 500 500 500 500 500",encoding:"WinAnsiEncoding",ranges:[{start:32,end:126},{start:160,end:383},{start:402,end:402},{start:506,end:511},{start:536,end:539},{start:710,end:711},{start:713,end:713},{start:728,end:733},{start:894,end:894},{start:900,end:906},{start:908,end:908},{start:910,end:929},{start:931,end:974},{start:1025,end:1036},{start:1038,end:1103},{start:1105,end:1116},{start:1118,end:1119},{start:1168,end:1169},{start:7808,end:7813},{start:7922,end:7923},{start:8211,end:8213},{start:8215,end:8222},{start:8224,end:8226},{start:8230,end:8230},{start:8240,end:8240},{start:8242,end:8243},{start:8249,end:8250},{start:8252,end:8252},{start:8254,end:8254},{start:8260,end:8260},{start:8308,end:8309},{start:8311,end:8312},{start:8319,end:8319},{start:8355,end:8356},{start:8359,end:8359},{start:8364,end:8364},{start:8453,end:8453},{start:8467,end:8467},{start:8470,end:8470},{start:8482,end:8482},{start:8486,end:8486},{start:8494,end:8494},{start:8539,end:8542},{start:8592,end:8597},{start:8616,end:8616},{start:8706,end:8706},{start:8710,end:8710},{start:8719,end:8719},{start:8721,end:8722},{start:8725,end:8725},{start:8729,end:8730},{start:8734,end:8735},{start:8745,end:8745},{start:8747,end:8747},{start:8776,end:8776},{start:8800,end:8801},{start:8804,end:8805},{start:8962,end:8962},{start:8976,end:8976},{start:8992,end:8993},{start:9472,end:9472},{start:9474,end:9474},{start:9484,end:9484},{start:9488,end:9488},{start:9492,end:9492},{start:9496,end:9496},{start:9500,end:9500},{start:9508,end:9508},{start:9516,end:9516},{start:9524,end:9524},{start:9532,end:9532},{start:9552,end:9580},{start:9600,end:9600},{start:9604,end:9604},{start:9608,end:9608},{start:9612,end:9612},{start:9616,end:9619},{start:9632,end:9633},{start:9642,end:9644},{start:9650,end:9650},{start:9658,end:9658},{start:9660,end:9660},{start:9668,end:9668},{start:9674,end:9675},{start:9679,end:9679},{start:9688,end:9689},{start:9702,end:9702},{start:9786,end:9788},{start:9792,end:9792},{start:9794,end:9794},{start:9824,end:9824},{start:9827,end:9827},{start:9829,end:9830},{start:9834,end:9835},{start:64257,end:64258}]},SimHei:{bbox:"-11 -156 996 859",flags:"32",stemV:"0",italicAngle:"0",ascender:"859",decender:"-140",capHeight:"687",widths:"1 95 500 738 813 1000",ordering:"GB1",registry:"Adobe",supplement:"2",encoding:"UniGB-UCS2-H",ranges:[{start:32,end:126},{start:164,end:164},{start:167,end:168},{start:176,end:177},{start:183,end:183},{start:215,end:215},{start:224,end:225},{start:232,end:234},{start:236,end:237},{start:242,end:243},{start:247,end:247},{start:249,end:250},{start:252,end:252},{start:257,end:257},{start:275,end:275},{start:283,end:283},{start:299,end:299},{start:324,end:324},{start:328,end:328},{start:333,end:333},{start:363,end:363},{start:462,end:462},{start:464,end:464},{start:466,end:466},{start:468,end:468},{start:470,end:470},{start:472,end:472},{start:474,end:474},{start:476,end:476},{start:505,end:505},{start:593,end:593},{start:609,end:609},{start:711,end:711},{start:713,end:715},{start:729,end:729},{start:913,end:929},{start:931,end:937},{start:945,end:961},{start:963,end:969},{start:1025,end:1025},{start:1040,end:1103},{start:1105,end:1105},{start:8208,end:8208},{start:8211,end:8214},{start:8216,end:8217},{start:8220,end:8221},{start:8229,end:8230},{start:8240,end:8240},{start:8242,end:8243},{start:8245,end:8245},{start:8251,end:8251},{start:8364,end:8364},{start:8451,end:8451},{start:8453,end:8453},{start:8457,end:8457},{start:8470,end:8470},{start:8481,end:8481},{start:8544,end:8555},{start:8560,end:8569},{start:8592,end:8595},{start:8598,end:8601},{start:8712,end:8712},{start:8719,end:8719},{start:8721,end:8721},{start:8725,end:8725},{start:8730,end:8730},{start:8733,end:8736},{start:8739,end:8739},{start:8741,end:8741},{start:8743,end:8747},{start:8750,end:8750},{start:8756,end:8759},{start:8765,end:8765},{start:8776,end:8776},{start:8780,end:8780},{start:8786,end:8786},{start:8800,end:8801},{start:8804,end:8807},{start:8814,end:8815},{start:8853,end:8853},{start:8857,end:8857},{start:8869,end:8869},{start:8895,end:8895},{start:8978,end:8978},{start:9312,end:9321},{start:9332,end:9371},{start:9472,end:9547},{start:9552,end:9587},{start:9601,end:9615},{start:9619,end:9621},{start:9632,end:9633},{start:9650,end:9651},{start:9660,end:9661},{start:9670,end:9671},{start:9675,end:9675},{start:9678,end:9679},{start:9698,end:9701},{start:9733,end:9734},{start:9737,end:9737},{start:9792,end:9792},{start:9794,end:9794},{start:11905,end:11905},{start:11908,end:11908},{start:11912,end:11912},{start:11915,end:11916},{start:11927,end:11927},{start:11943,end:11943},{start:11946,end:11946},{start:11950,end:11950},{start:11955,end:11955},{start:11958,end:11959},{start:11963,end:11963},{start:11978,end:11978},{start:12272,end:12283},{start:12288,end:12291},{start:12293,end:12311},{start:12317,end:12318},{start:12321,end:12329},{start:12350,end:12350},{start:12353,end:12435},{start:12443,end:12446},{start:12449,end:12534},{start:12540,end:12542},{start:12549,end:12585},{start:12832,end:12841},{start:12849,end:12849},{start:12963,end:12963},{start:13198,end:13199},{start:13212,end:13214},{start:13217,end:13217},{start:13252,end:13252},{start:13262,end:13262},{start:13265,end:13266},{start:13269,end:13269},{start:13312,end:19893},{start:19968,end:40869},{start:59277,end:59286},{start:59335,end:59335},{start:59414,end:59416},{start:59422,end:59422},{start:59430,end:59430},{start:59435,end:59436},{start:59441,end:59442},{start:59451,end:59451},{start:59459,end:59459},{start:59476,end:59477},{start:59492,end:59492},{start:63788,end:63788},{start:63865,end:63865},{start:63893,end:63893},{start:63975,end:63975},{start:63985,end:63985},{start:64012,end:64015},{start:64017,end:64017},{start:64019,end:64020},{start:64024,end:64024},{start:64031,end:64033},{start:64035,end:64036},{start:64039,end:64041},{start:65072,end:65073},{start:65075,end:65092},{start:65097,end:65106},{start:65108,end:65111},{start:65113,end:65126},{start:65128,end:65131},{start:65281,end:65374},{start:65504,end:65509}],widthOfString:(o,t)=>{let e=0;for(let r=0;r<o.length;r++)e+=/[^\x00-\x7f]/.test(o[r])?1:.5;return e*t}},SimSun:{bbox:"-8 -145 1000 859",flags:"32",stemV:"0",italicAngle:"0",ascender:"859",decender:"-141",capHeight:"175",widths:"1 95 500",ordering:"GB1",registry:"Adobe",supplement:"2",encoding:"UniGB-UCS2-H",ranges:[{start:32,end:126},{start:164,end:164},{start:167,end:168},{start:176,end:177},{start:183,end:183},{start:215,end:215},{start:224,end:225},{start:232,end:234},{start:236,end:237},{start:242,end:243},{start:247,end:247},{start:249,end:250},{start:252,end:252},{start:257,end:257},{start:275,end:275},{start:283,end:283},{start:299,end:299},{start:324,end:324},{start:328,end:328},{start:333,end:333},{start:363,end:363},{start:462,end:462},{start:464,end:464},{start:466,end:466},{start:468,end:468},{start:470,end:470},{start:472,end:472},{start:474,end:474},{start:476,end:476},{start:505,end:505},{start:593,end:593},{start:609,end:609},{start:711,end:711},{start:713,end:715},{start:729,end:729},{start:913,end:929},{start:931,end:937},{start:945,end:961},{start:963,end:969},{start:1025,end:1025},{start:1040,end:1103},{start:1105,end:1105},{start:8208,end:8208},{start:8211,end:8214},{start:8216,end:8217},{start:8220,end:8221},{start:8229,end:8230},{start:8240,end:8240},{start:8242,end:8243},{start:8245,end:8245},{start:8251,end:8251},{start:8364,end:8364},{start:8451,end:8451},{start:8453,end:8453},{start:8457,end:8457},{start:8470,end:8470},{start:8481,end:8481},{start:8544,end:8555},{start:8560,end:8569},{start:8592,end:8595},{start:8598,end:8601},{start:8712,end:8712},{start:8719,end:8719},{start:8721,end:8721},{start:8725,end:8725},{start:8730,end:8730},{start:8733,end:8736},{start:8739,end:8739},{start:8741,end:8741},{start:8743,end:8747},{start:8750,end:8750},{start:8756,end:8759},{start:8765,end:8765},{start:8776,end:8776},{start:8780,end:8780},{start:8786,end:8786},{start:8800,end:8801},{start:8804,end:8807},{start:8814,end:8815},{start:8853,end:8853},{start:8857,end:8857},{start:8869,end:8869},{start:8895,end:8895},{start:8978,end:8978},{start:9312,end:9321},{start:9332,end:9371},{start:9472,end:9547},{start:9552,end:9587},{start:9601,end:9615},{start:9619,end:9621},{start:9632,end:9633},{start:9650,end:9651},{start:9660,end:9661},{start:9670,end:9671},{start:9675,end:9675},{start:9678,end:9679},{start:9698,end:9701},{start:9733,end:9734},{start:9737,end:9737},{start:9792,end:9792},{start:9794,end:9794},{start:11905,end:11905},{start:11908,end:11908},{start:11912,end:11912},{start:11915,end:11916},{start:11927,end:11927},{start:11943,end:11943},{start:11946,end:11946},{start:11950,end:11950},{start:11955,end:11955},{start:11958,end:11959},{start:11963,end:11963},{start:11978,end:11978},{start:12272,end:12283},{start:12288,end:12291},{start:12293,end:12311},{start:12317,end:12318},{start:12321,end:12329},{start:12350,end:12350},{start:12353,end:12435},{start:12443,end:12446},{start:12449,end:12534},{start:12540,end:12542},{start:12549,end:12585},{start:12832,end:12841},{start:12849,end:12849},{start:12963,end:12963},{start:13198,end:13199},{start:13212,end:13214},{start:13217,end:13217},{start:13252,end:13252},{start:13262,end:13262},{start:13265,end:13266},{start:13269,end:13269},{start:13312,end:19893},{start:19968,end:40869},{start:59277,end:59286},{start:59335,end:59335},{start:59414,end:59416},{start:59422,end:59422},{start:59430,end:59430},{start:59435,end:59436},{start:59441,end:59442},{start:59451,end:59451},{start:59459,end:59459},{start:59476,end:59477},{start:59492,end:59492},{start:63788,end:63788},{start:63865,end:63865},{start:63893,end:63893},{start:63975,end:63975},{start:63985,end:63985},{start:64012,end:64015},{start:64017,end:64017},{start:64019,end:64020},{start:64024,end:64024},{start:64031,end:64033},{start:64035,end:64036},{start:64039,end:64041},{start:65072,end:65073},{start:65075,end:65092},{start:65097,end:65106},{start:65108,end:65111},{start:65113,end:65126},{start:65128,end:65131},{start:65281,end:65374},{start:65504,end:65509}],widthOfString:(o,t)=>{let e=0;for(let r=0;r<o.length;r++)e+=/[^\x00-\x7f]/.test(o[r])?1:.5;return e*t}},KaiTi:{bbox:"-8 -145 1000 859",flags:"32",stemV:"0",italicAngle:"0",ascender:"859",decender:"-141",capHeight:"175",widths:"1 95 500",ordering:"GB1",registry:"Adobe",supplement:"2",encoding:"UniGB-UCS2-H",ranges:[{start:32,end:126},{start:164,end:164},{start:167,end:168},{start:176,end:177},{start:183,end:183},{start:215,end:215},{start:224,end:225},{start:232,end:234},{start:236,end:237},{start:242,end:243},{start:247,end:247},{start:249,end:250},{start:252,end:252},{start:257,end:257},{start:275,end:275},{start:283,end:283},{start:299,end:299},{start:324,end:324},{start:328,end:328},{start:333,end:333},{start:363,end:363},{start:462,end:462},{start:464,end:464},{start:466,end:466},{start:468,end:468},{start:470,end:470},{start:472,end:472},{start:474,end:474},{start:476,end:476},{start:505,end:505},{start:593,end:593},{start:609,end:609},{start:711,end:711},{start:713,end:715},{start:729,end:729},{start:913,end:929},{start:931,end:937},{start:945,end:961},{start:963,end:969},{start:1025,end:1025},{start:1040,end:1103},{start:1105,end:1105},{start:8208,end:8208},{start:8211,end:8214},{start:8216,end:8217},{start:8220,end:8221},{start:8229,end:8230},{start:8240,end:8240},{start:8242,end:8243},{start:8245,end:8245},{start:8251,end:8251},{start:8364,end:8364},{start:8451,end:8451},{start:8453,end:8453},{start:8457,end:8457},{start:8470,end:8470},{start:8481,end:8481},{start:8544,end:8555},{start:8560,end:8569},{start:8592,end:8595},{start:8598,end:8601},{start:8712,end:8712},{start:8719,end:8719},{start:8721,end:8721},{start:8725,end:8725},{start:8730,end:8730},{start:8733,end:8736},{start:8739,end:8739},{start:8741,end:8741},{start:8743,end:8747},{start:8750,end:8750},{start:8756,end:8759},{start:8765,end:8765},{start:8776,end:8776},{start:8780,end:8780},{start:8786,end:8786},{start:8800,end:8801},{start:8804,end:8807},{start:8814,end:8815},{start:8853,end:8853},{start:8857,end:8857},{start:8869,end:8869},{start:8895,end:8895},{start:8978,end:8978},{start:9312,end:9321},{start:9332,end:9371},{start:9472,end:9547},{start:9552,end:9587},{start:9601,end:9615},{start:9619,end:9621},{start:9632,end:9633},{start:9650,end:9651},{start:9660,end:9661},{start:9670,end:9671},{start:9675,end:9675},{start:9678,end:9679},{start:9698,end:9701},{start:9733,end:9734},{start:9737,end:9737},{start:9792,end:9792},{start:9794,end:9794},{start:11905,end:11905},{start:11908,end:11908},{start:11912,end:11912},{start:11915,end:11916},{start:11927,end:11927},{start:11943,end:11943},{start:11946,end:11946},{start:11950,end:11950},{start:11955,end:11955},{start:11958,end:11959},{start:11963,end:11963},{start:11978,end:11978},{start:12272,end:12283},{start:12288,end:12291},{start:12293,end:12311},{start:12317,end:12318},{start:12321,end:12329},{start:12350,end:12350},{start:12353,end:12435},{start:12443,end:12446},{start:12449,end:12534},{start:12540,end:12542},{start:12549,end:12585},{start:12832,end:12841},{start:12849,end:12849},{start:12963,end:12963},{start:13198,end:13199},{start:13212,end:13214},{start:13217,end:13217},{start:13252,end:13252},{start:13262,end:13262},{start:13265,end:13266},{start:13269,end:13269},{start:13312,end:19893},{start:19968,end:40869},{start:59277,end:59286},{start:59335,end:59335},{start:59414,end:59416},{start:59422,end:59422},{start:59430,end:59430},{start:59435,end:59436},{start:59441,end:59442},{start:59451,end:59451},{start:59459,end:59459},{start:59476,end:59477},{start:59492,end:59492},{start:63788,end:63788},{start:63865,end:63865},{start:63893,end:63893},{start:63975,end:63975},{start:63985,end:63985},{start:64012,end:64015},{start:64017,end:64017},{start:64019,end:64020},{start:64024,end:64024},{start:64031,end:64033},{start:64035,end:64036},{start:64039,end:64041},{start:65072,end:65073},{start:65075,end:65092},{start:65097,end:65106},{start:65108,end:65111},{start:65113,end:65126},{start:65128,end:65131},{start:65281,end:65374},{start:65504,end:65509}],widthOfString:(o,t)=>{let e=0;for(let r=0;r<o.length;r++)e+=/[^\x00-\x7f]/.test(o[r])?1:.5;return e*t}},FangSong:{bbox:"-8 -145 1000 859",flags:"32",stemV:"0",italicAngle:"0",ascender:"859",decender:"-141",capHeight:"175",widths:"1 95 500",ordering:"GB1",registry:"Adobe",supplement:"2",encoding:"UniGB-UCS2-H",ranges:[{start:32,end:126},{start:164,end:164},{start:167,end:168},{start:176,end:177},{start:183,end:183},{start:215,end:215},{start:224,end:225},{start:232,end:234},{start:236,end:237},{start:242,end:243},{start:247,end:247},{start:249,end:250},{start:252,end:252},{start:257,end:257},{start:275,end:275},{start:283,end:283},{start:299,end:299},{start:324,end:324},{start:328,end:328},{start:333,end:333},{start:363,end:363},{start:462,end:462},{start:464,end:464},{start:466,end:466},{start:468,end:468},{start:470,end:470},{start:472,end:472},{start:474,end:474},{start:476,end:476},{start:505,end:505},{start:593,end:593},{start:609,end:609},{start:711,end:711},{start:713,end:715},{start:729,end:729},{start:913,end:929},{start:931,end:937},{start:945,end:961},{start:963,end:969},{start:1025,end:1025},{start:1040,end:1103},{start:1105,end:1105},{start:8208,end:8208},{start:8211,end:8214},{start:8216,end:8217},{start:8220,end:8221},{start:8229,end:8230},{start:8240,end:8240},{start:8242,end:8243},{start:8245,end:8245},{start:8251,end:8251},{start:8364,end:8364},{start:8451,end:8451},{start:8453,end:8453},{start:8457,end:8457},{start:8470,end:8470},{start:8481,end:8481},{start:8544,end:8555},{start:8560,end:8569},{start:8592,end:8595},{start:8598,end:8601},{start:8712,end:8712},{start:8719,end:8719},{start:8721,end:8721},{start:8725,end:8725},{start:8730,end:8730},{start:8733,end:8736},{start:8739,end:8739},{start:8741,end:8741},{start:8743,end:8747},{start:8750,end:8750},{start:8756,end:8759},{start:8765,end:8765},{start:8776,end:8776},{start:8780,end:8780},{start:8786,end:8786},{start:8800,end:8801},{start:8804,end:8807},{start:8814,end:8815},{start:8853,end:8853},{start:8857,end:8857},{start:8869,end:8869},{start:8895,end:8895},{start:8978,end:8978},{start:9312,end:9321},{start:9332,end:9371},{start:9472,end:9547},{start:9552,end:9587},{start:9601,end:9615},{start:9619,end:9621},{start:9632,end:9633},{start:9650,end:9651},{start:9660,end:9661},{start:9670,end:9671},{start:9675,end:9675},{start:9678,end:9679},{start:9698,end:9701},{start:9733,end:9734},{start:9737,end:9737},{start:9792,end:9792},{start:9794,end:9794},{start:11905,end:11905},{start:11908,end:11908},{start:11912,end:11912},{start:11915,end:11916},{start:11927,end:11927},{start:11943,end:11943},{start:11946,end:11946},{start:11950,end:11950},{start:11955,end:11955},{start:11958,end:11959},{start:11963,end:11963},{start:11978,end:11978},{start:12272,end:12283},{start:12288,end:12291},{start:12293,end:12311},{start:12317,end:12318},{start:12321,end:12329},{start:12350,end:12350},{start:12353,end:12435},{start:12443,end:12446},{start:12449,end:12534},{start:12540,end:12542},{start:12549,end:12585},{start:12832,end:12841},{start:12849,end:12849},{start:12963,end:12963},{start:13198,end:13199},{start:13212,end:13214},{start:13217,end:13217},{start:13252,end:13252},{start:13262,end:13262},{start:13265,end:13266},{start:13269,end:13269},{start:13312,end:19893},{start:19968,end:40869},{start:59277,end:59286},{start:59335,end:59335},{start:59414,end:59416},{start:59422,end:59422},{start:59430,end:59430},{start:59435,end:59436},{start:59441,end:59442},{start:59451,end:59451},{start:59459,end:59459},{start:59476,end:59477},{start:59492,end:59492},{start:63788,end:63788},{start:63865,end:63865},{start:63893,end:63893},{start:63975,end:63975},{start:63985,end:63985},{start:64012,end:64015},{start:64017,end:64017},{start:64019,end:64020},{start:64024,end:64024},{start:64031,end:64033},{start:64035,end:64036},{start:64039,end:64041},{start:65072,end:65073},{start:65075,end:65092},{start:65097,end:65106},{start:65108,end:65111},{start:65113,end:65126},{start:65128,end:65131},{start:65281,end:65374},{start:65504,end:65509}],widthOfString:(o,t)=>{let e=0;for(let r=0;r<o.length;r++)e+=/[^\x00-\x7f]/.test(o[r])?1:.5;return e*t}},LiSu:{bbox:"-8 -145 1000 859",flags:"32",stemV:"0",italicAngle:"0",ascender:"859",decender:"-141",capHeight:"175",widths:"1 95 500",ordering:"GB1",registry:"Adobe",supplement:"2",encoding:"UniGB-UCS2-H",ranges:[{start:32,end:126},{start:164,end:164},{start:167,end:168},{start:176,end:177},{start:183,end:183},{start:215,end:215},{start:224,end:225},{start:232,end:234},{start:236,end:237},{start:242,end:243},{start:247,end:247},{start:249,end:250},{start:252,end:252},{start:257,end:257},{start:275,end:275},{start:283,end:283},{start:299,end:299},{start:324,end:324},{start:328,end:328},{start:333,end:333},{start:363,end:363},{start:462,end:462},{start:464,end:464},{start:466,end:466},{start:468,end:468},{start:470,end:470},{start:472,end:472},{start:474,end:474},{start:476,end:476},{start:505,end:505},{start:593,end:593},{start:609,end:609},{start:711,end:711},{start:713,end:715},{start:729,end:729},{start:913,end:929},{start:931,end:937},{start:945,end:961},{start:963,end:969},{start:1025,end:1025},{start:1040,end:1103},{start:1105,end:1105},{start:8208,end:8208},{start:8211,end:8214},{start:8216,end:8217},{start:8220,end:8221},{start:8229,end:8230},{start:8240,end:8240},{start:8242,end:8243},{start:8245,end:8245},{start:8251,end:8251},{start:8364,end:8364},{start:8451,end:8451},{start:8453,end:8453},{start:8457,end:8457},{start:8470,end:8470},{start:8481,end:8481},{start:8544,end:8555},{start:8560,end:8569},{start:8592,end:8595},{start:8598,end:8601},{start:8712,end:8712},{start:8719,end:8719},{start:8721,end:8721},{start:8725,end:8725},{start:8730,end:8730},{start:8733,end:8736},{start:8739,end:8739},{start:8741,end:8741},{start:8743,end:8747},{start:8750,end:8750},{start:8756,end:8759},{start:8765,end:8765},{start:8776,end:8776},{start:8780,end:8780},{start:8786,end:8786},{start:8800,end:8801},{start:8804,end:8807},{start:8814,end:8815},{start:8853,end:8853},{start:8857,end:8857},{start:8869,end:8869},{start:8895,end:8895},{start:8978,end:8978},{start:9312,end:9321},{start:9332,end:9371},{start:9472,end:9547},{start:9552,end:9587},{start:9601,end:9615},{start:9619,end:9621},{start:9632,end:9633},{start:9650,end:9651},{start:9660,end:9661},{start:9670,end:9671},{start:9675,end:9675},{start:9678,end:9679},{start:9698,end:9701},{start:9733,end:9734},{start:9737,end:9737},{start:9792,end:9792},{start:9794,end:9794},{start:11905,end:11905},{start:11908,end:11908},{start:11912,end:11912},{start:11915,end:11916},{start:11927,end:11927},{start:11943,end:11943},{start:11946,end:11946},{start:11950,end:11950},{start:11955,end:11955},{start:11958,end:11959},{start:11963,end:11963},{start:11978,end:11978},{start:12272,end:12283},{start:12288,end:12291},{start:12293,end:12311},{start:12317,end:12318},{start:12321,end:12329},{start:12350,end:12350},{start:12353,end:12435},{start:12443,end:12446},{start:12449,end:12534},{start:12540,end:12542},{start:12549,end:12585},{start:12832,end:12841},{start:12849,end:12849},{start:12963,end:12963},{start:13198,end:13199},{start:13212,end:13214},{start:13217,end:13217},{start:13252,end:13252},{start:13262,end:13262},{start:13265,end:13266},{start:13269,end:13269},{start:13312,end:19893},{start:19968,end:40869},{start:59277,end:59286},{start:59335,end:59335},{start:59414,end:59416},{start:59422,end:59422},{start:59430,end:59430},{start:59435,end:59436},{start:59441,end:59442},{start:59451,end:59451},{start:59459,end:59459},{start:59476,end:59477},{start:59492,end:59492},{start:63788,end:63788},{start:63865,end:63865},{start:63893,end:63893},{start:63975,end:63975},{start:63985,end:63985},{start:64012,end:64015},{start:64017,end:64017},{start:64019,end:64020},{start:64024,end:64024},{start:64031,end:64033},{start:64035,end:64036},{start:64039,end:64041},{start:65072,end:65073},{start:65075,end:65092},{start:65097,end:65106},{start:65108,end:65111},{start:65113,end:65126},{start:65128,end:65131},{start:65281,end:65374},{start:65504,end:65509}],widthOfString:(o,t)=>{let e=0;for(let r=0;r<o.length;r++)e+=/[^\x00-\x7f]/.test(o[r])?1:.5;return e*t}}},KD=ODt,e$e=(function(){function o(){this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=null}return o.prototype={ensureBuffer:function(t){var e=this.buffer,r=e?e.byteLength:0;if(t<r)return e;for(var i=512;i<t;)i<<=1;for(var n=new Uint8Array(i),s=0;s<r;++s)n[s]=e[s];return this.buffer=n},getByte:function(){for(var t=this.pos;this.bufferLength<=t;){if(this.eof)return null;this.readBlock()}return this.buffer[this.pos++]},getBytes:function(t){var e=this.pos;if(t){this.ensureBuffer(e+t);for(var r=e+t;!this.eof&&this.bufferLength<r;)this.readBlock();var i=this.bufferLength;r>i&&(r=i)}else{for(;!this.eof;)this.readBlock();var r=this.bufferLength}return this.pos=r,this.buffer.subarray(e,r)},lookChar:function(){for(var t=this.pos;this.bufferLength<=t;){if(this.eof)return null;this.readBlock()}return String.fromCharCode(this.buffer[this.pos])},getChar:function(){for(var t=this.pos;this.bufferLength<=t;){if(this.eof)return null;this.readBlock()}return String.fromCharCode(this.buffer[this.pos++])},makeSubStream:function(t,e,r){for(var i=t+e;this.bufferLength<=i&&!this.eof;)this.readBlock();return new Stream(this.buffer,t,e,r)},skip:function(t){t||(t=1),this.pos+=t},reset:function(){this.pos=0}},o})(),a$e=(function(){if(typeof Uint32Array>"u")return;var o=new Uint32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),t=new Uint32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),e=new Uint32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),r=[new Uint32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],i=[new Uint32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5];function n(a){throw new Error(a)}function s(a){var l=0,c=a[l++],h=a[l++];(c==-1||h==-1)&&n("Invalid header in flate stream"),(c&15)!=8&&n("Unknown compression method in flate stream"),((c<<8)+h)%31!=0&&n("Bad FCHECK in flate stream"),h&32&&n("FDICT bit set in flate stream"),this.bytes=a,this.bytesPos=l,this.codeSize=0,this.codeBuf=0,e$e.call(this)}return s.prototype=Object.create(e$e.prototype),s.prototype.getBits=function(a){for(var l=this.codeSize,c=this.codeBuf,h=this.bytes,u=this.bytesPos,d;l<a;)typeof(d=h[u++])>"u"&&n("Bad encoding in flate stream"),c|=d<<l,l+=8;return d=c&(1<<a)-1,this.codeBuf=c>>a,this.codeSize=l-=a,this.bytesPos=u,d},s.prototype.getCode=function(a){for(var l=a[0],c=a[1],h=this.codeSize,u=this.codeBuf,d=this.bytes,p=this.bytesPos;h<c;){var m;typeof(m=d[p++])>"u"&&n("Bad encoding in flate stream"),u|=m<<h,h+=8}var g=l[u&(1<<c)-1],y=g>>16,b=g&65535;return(h==0||h<y||y==0)&&n("Bad encoding in flate stream"),this.codeBuf=u>>y,this.codeSize=h-y,this.bytesPos=p,b},s.prototype.generateHuffmanTable=function(a){for(var l=a.length,c=0,h=0;h<l;++h)a[h]>c&&(c=a[h]);for(var u=1<<c,d=new Uint32Array(u),p=1,m=0,g=2;p<=c;++p,m<<=1,g<<=1)for(var y=0;y<l;++y)if(a[y]==p){for(var b=0,P=m,h=0;h<p;++h)b=b<<1|P&1,P>>=1;for(var h=b;h<u;h+=g)d[h]=p<<16|y;++m}return[d,c]},s.prototype.readBlock=function(){function a(N,U,B,G,Y){for(var X=N.getBits(B)+G;X-- >0;)U[_++]=Y}var l=this.getBits(3);if(l&1&&(this.eof=!0),l>>=1,l==0){var c=this.bytes,h=this.bytesPos,u;typeof(u=c[h++])>"u"&&n("Bad block header in flate stream");var d=u;typeof(u=c[h++])>"u"&&n("Bad block header in flate stream"),d|=u<<8,typeof(u=c[h++])>"u"&&n("Bad block header in flate stream");var p=u;typeof(u=c[h++])>"u"&&n("Bad block header in flate stream"),p|=u<<8,p!=(~d&65535)&&n("Bad uncompressed block length in flate stream"),this.codeBuf=0,this.codeSize=0;var m=this.bufferLength,g=this.ensureBuffer(m+d),y=m+d;this.bufferLength=y;for(var b=m;b<y;++b){if(typeof(u=c[h++])>"u"){this.eof=!0;break}g[b]=u}this.bytesPos=h;return}var P,T;if(l==1)P=r,T=i;else if(l==2){for(var I=this.getBits(5)+257,C=this.getBits(5)+1,E=this.getBits(4)+4,O=Array(o.length),_=0;_<E;)O[o[_++]]=this.getBits(3);for(var x=this.generateHuffmanTable(O),v=0,_=0,D=I+C,w=new Array(D);_<D;){var F=this.getCode(x);F==16?a(this,w,2,3,v):F==17?a(this,w,3,3,v=0):F==18?a(this,w,7,11,v=0):w[_++]=v=F}P=this.generateHuffmanTable(w.slice(0,I)),T=this.generateHuffmanTable(w.slice(I,D))}else n("Unknown block type in flate stream");for(var g=this.buffer,H=g?g.length:0,z=this.bufferLength;;){var V=this.getCode(P);if(V<256){z+1>=H&&(g=this.ensureBuffer(z+1),H=g.length),g[z++]=V;continue}if(V==256){this.bufferLength=z;return}V-=257,V=t[V];var W=V>>16;W>0&&(W=this.getBits(W));var v=(V&65535)+W;V=this.getCode(T),V=e[V],W=V>>16,W>0&&(W=this.getBits(W));var L=(V&65535)+W;z+v>=H&&(g=this.ensureBuffer(z+v),H=g.length);for(var k=0;k<v;++k,++z)g[z]=g[z-L]}},s})(),ADt=(function(){var o,t,e;r.load=function(i,n,s){var a;return typeof n=="function"&&(s=n),a=new XMLHttpRequest,a.open("GET",i,!0),a.responseType="arraybuffer",a.onload=function(){var l,c;return l=new Uint8Array(a.response||a.mozResponseArrayBuffer),c=new r(l),n==null||n.getContext,typeof s=="function"?s(c):void 0},a.send(null)},t=1,e=2,o=0;function r(i){var n,s,a,l,c,h,u,d,p,m,g,y,b,P,T;for(this.data=i,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},h=null;;){switch(n=this.readUInt32(),m=(function(){var I,C;for(C=[],u=I=0;I<4;u=++I)C.push(String.fromCharCode(this.data[this.pos++]));return C}).call(this).join(""),m){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(n);break;case"fcTL":h&&this.animation.frames.push(h),this.pos+=4,h={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},c=this.readUInt16(),l=this.readUInt16()||100,h.delay=1e3*c/l,h.disposeOp=this.data[this.pos++],h.blendOp=this.data[this.pos++],h.data=[];break;case"IDAT":case"fdAT":for(m==="fdAT"&&(this.pos+=4,n-=4),i=(h==null?void 0:h.data)||this.imgData,u=b=0;0<=n?b<n:b>n;u=0<=n?++b:--b)i.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(a=this.palette.length/3,this.transparency.indexed=this.read(n),this.transparency.indexed.length>a)throw new Error("More transparent colors than palette size");if(g=a-this.transparency.indexed.length,g>0)for(u=P=0;0<=g?P<g:P>g;u=0<=g?++P:--P)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(n)[0];break;case 2:this.transparency.rgb=this.read(n)}break;case"tEXt":y=this.read(n),d=y.indexOf(0),p=String.fromCharCode.apply(String,y.slice(0,d)),this.text[p]=String.fromCharCode.apply(String,y.slice(d+1));break;case"IEND":h&&this.animation.frames.push(h),this.colors=(function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}).call(this),this.hasAlphaChannel=(T=this.colorType)===4||T===6,s=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*s,this.colorSpace=(function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}).call(this),this.imgData=new Uint8Array(this.imgData);return;default:this.pos+=n}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}return r.prototype.read=function(i){var n,s,a;for(a=[],n=s=0;0<=i?s<i:s>i;n=0<=i?++s:--s)a.push(this.data[this.pos++]);return a},r.prototype.readUInt32=function(){var i,n,s,a;return i=this.data[this.pos++]<<24,n=this.data[this.pos++]<<16,s=this.data[this.pos++]<<8,a=this.data[this.pos++],i|n|s|a},r.prototype.readUInt16=function(){var i,n;return i=this.data[this.pos++]<<8,n=this.data[this.pos++],i|n},r.prototype.decodePixels=function(i){var n=this.pixelBitlength/8,s=new Uint8Array(this.width*this.height*n),a=0,l=this;if(i==null&&(i=this.imgData),i.length===0)return new Uint8Array(0);i=new a$e(i),i=i.getBytes();function c(h,u,d,p){var m,g,y,b,P,T,I,C,E,O,_,x,v,D,w,F,H,z,V,W,L,k=Math.ceil((l.width-h)/d),N=Math.ceil((l.height-u)/p),U=l.width==k&&l.height==N;for(D=n*k,x=U?s:new Uint8Array(D*N),T=i.length,v=0,g=0;v<N&&a<T;){switch(i[a++]){case 0:for(b=H=0;H<D;b=H+=1)x[g++]=i[a++];break;case 1:for(b=z=0;z<D;b=z+=1)m=i[a++],P=b<n?0:x[g-n],x[g++]=(m+P)%256;break;case 2:for(b=V=0;V<D;b=V+=1)m=i[a++],y=(b-b%n)/n,w=v&&x[(v-1)*D+y*n+b%n],x[g++]=(w+m)%256;break;case 3:for(b=W=0;W<D;b=W+=1)m=i[a++],y=(b-b%n)/n,P=b<n?0:x[g-n],w=v&&x[(v-1)*D+y*n+b%n],x[g++]=(m+Math.floor((P+w)/2))%256;break;case 4:for(b=L=0;L<D;b=L+=1)m=i[a++],y=(b-b%n)/n,P=b<n?0:x[g-n],v===0?w=F=0:(w=x[(v-1)*D+y*n+b%n],F=y&&x[(v-1)*D+(y-1)*n+b%n]),I=P+w-F,C=Math.abs(I-P),O=Math.abs(I-w),_=Math.abs(I-F),C<=O&&C<=_?E=P:O<=_?E=w:E=F,x[g++]=(m+E)%256;break;default:throw new Error("Invalid filter algorithm: "+i[a-1])}if(!U){var B=((u+v*p)*l.width+h)*n,G=v*D;for(b=0;b<k;b+=1){for(var Y=0;Y<n;Y+=1)s[B++]=x[G++];B+=(d-1)*n}}v++}}return l.interlaceMethod==1?(c(0,0,8,8),c(4,0,8,8),c(0,4,4,8),c(2,0,4,4),c(0,2,2,4),c(1,0,2,2),c(0,1,1,2)):c(0,0,1,1),s},r.prototype.decodePalette=function(){var i,n,s,a,l,c,h,u,d,p;for(a=this.palette,h=this.transparency.indexed||[],c=new Uint8Array((h.length||0)+a.length),l=0,s=a.length,i=0,n=u=0,d=a.length;u<d;n=u+=3)c[l++]=a[n],c[l++]=a[n+1],c[l++]=a[n+2],c[l++]=(p=h[i++])!=null?p:255;return c},r.prototype.copyToImageData=function(i,n){var s,a,l,c,h,u,d,p,m,g,y;if(a=this.colors,m=null,s=this.hasAlphaChannel,this.palette.length&&(m=(y=this._decodedPalette)!=null?y:this._decodedPalette=this.decodePalette(),a=4,s=!0),l=i.data||i,p=l.length,h=m||n,c=u=0,a===1)for(;c<p;)d=m?n[c/4]*4:u,g=h[d++],l[c++]=g,l[c++]=g,l[c++]=g,l[c++]=s?h[d++]:255,u=d;else for(;c<p;)d=m?n[c/4]*4:u,l[c++]=h[d++],l[c++]=h[d++],l[c++]=h[d++],l[c++]=s?h[d++]:255,u=d},r.prototype.decode=function(){var i;return i=new Uint8Array(this.width*this.height*4),this.copyToImageData(i,this.decodePixels()),i},r.prototype.renderFrame=function(i,n){var s,a,l;return a=this.animation.frames,s=a[n],l=a[n-1],n===0&&i.clearRect(0,0,this.width,this.height),(l==null?void 0:l.disposeOp)===t?i.clearRect(l.xOffset,l.yOffset,l.width,l.height):(l==null?void 0:l.disposeOp)===e&&i.putImageData(l.imageData,l.xOffset,l.yOffset),s.blendOp===o&&i.clearRect(s.xOffset,s.yOffset,s.width,s.height),i.drawImage(s.image,s.xOffset,s.yOffset)},r.prototype.animate=function(i){var n,s,a,l,c,h,u=this;return s=0,h=this.animation,l=h.numFrames,a=h.frames,c=h.numPlays,(n=function(){var d,p;if(d=s++%l,p=a[d],u.renderFrame(i,d),l>1&&s/l<c)return u.animation._timeout=setTimeout(n,p.delay)})()},r.prototype.stopAnimation=function(){var i;return clearTimeout((i=this.animation)!=null?i._timeout:void 0)},r})(),t$e=ADt,H2=(function(o){"use strict";function t(r){if(typeof r!="object")throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var i={};this.subscribe=function(n,s,a){if(a=a||!1,typeof n!="string"||typeof s!="function"||typeof a!="boolean")throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");i.hasOwnProperty(n)||(i[n]={});var l=Math.random().toString(35);return i[n][l]=[s,!!a],l},this.unsubscribe=function(n){for(var s in i)if(i[s][n])return delete i[s][n],Object.keys(i[s]).length===0&&delete i[s],!0;return!1},this.publish=function(n){if(i.hasOwnProperty(n)){var s=Array.prototype.slice.call(arguments,1),a=[];for(var l in i[n]){var c=i[n][l];try{c[0].apply(r,s)}catch(h){o.console&&console.error("jsPDF PubSub Error",h.message,h)}c[1]&&a.push(l)}a.length&&a.forEach(this.unsubscribe)}},this.getTopics=function(){return i}}function e(r,i,n,s){var a={},l=[],c=1;typeof r=="object"&&(a=r,r=a.orientation,i=a.unit||i,n=a.format||n,s=a.compress||a.compressPdf||s,l=a.filters||(s===!0?["FlateEncode"]:l),c=typeof a.userUnit=="number"?Math.abs(a.userUnit):1),i=i||"mm",r=(""+(r||"P")).toLowerCase();var h=a.putOnlyUsedFonts||!0,u={},d={internal:{},__private__:{}};d.__private__.PubSub=t;var p="1.4",m=d.__private__.getPdfVersion=function(){return p},g=d.__private__.setPdfVersion=function(Ie){p=Ie};let y={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};var b=d.__private__.getPageFormats=function(){return y},P=d.__private__.getPageFormat=function(Ie){return y[Ie]};typeof n=="string"&&(n=P(n)),n=n||P("a4");var T=d.f2=d.__private__.f2=function(Ie){if(isNaN(Ie))throw new Error("Invalid argument passed to jsPDF.f2");return Ie.toFixed(2)},I=d.__private__.f3=function(Ie){if(isNaN(Ie))throw new Error("Invalid argument passed to jsPDF.f3");return Ie.toFixed(3)},C="00000000000000000000000000000000",E=d.__private__.getFileId=function(){return C},O=d.__private__.setFileId=function(Ie){return Ie=Ie||"12345678901234567890123456789012".split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(Math.random()*16))}).join(""),C=Ie,C};d.setFileId=function(Ie){return O(Ie),this},d.getFileId=function(){return E()};var _,x=d.__private__.convertDateToPDFDate=function(Ie){var rt="",Rt=Ie.getTimezoneOffset(),ur=Rt<0?"+":"-",qr=Math.floor(Math.abs(Rt/60)),zi=Math.abs(Rt%60),ln=[ur,F(qr),"'",F(zi),"'"].join("");return rt=["D:",Ie.getFullYear(),F(Ie.getMonth()+1),F(Ie.getDate()),F(Ie.getHours()),F(Ie.getMinutes()),F(Ie.getSeconds()),ln].join(""),rt},v=d.__private__.convertPDFDateToDate=function(Ie){var rt=parseInt(Ie.substr(2,4),10),Rt=parseInt(Ie.substr(6,2),10)-1,ur=parseInt(Ie.substr(8,2),10),qr=parseInt(Ie.substr(10,2),10),zi=parseInt(Ie.substr(12,2),10),ln=parseInt(Ie.substr(14,2),10),Pn=parseInt(Ie.substr(16,2),10),Hc=parseInt(Ie.substr(20,2),10),Aa=new Date(rt,Rt,ur,qr,zi,ln,0);return Aa},D=d.__private__.setCreationDate=function(Ie){var rt,Rt=/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|\-0[0-9]|\-1[0-1])\'(0[0-9]|[1-5][0-9])\'?$/;if(typeof Ie>"u"&&(Ie=new Date),typeof Ie=="object"&&Object.prototype.toString.call(Ie)==="[object Date]")rt=x(Ie);else if(Rt.test(Ie))rt=Ie;else throw new Error("Invalid argument passed to jsPDF.setCreationDate");return _=rt,_},w=d.__private__.getCreationDate=function(Ie){var rt=_;return Ie==="jsDate"&&(rt=v(_)),rt};d.setCreationDate=function(Ie){return D(Ie),this},d.getCreationDate=function(Ie){return w(Ie)};var F=d.__private__.padd2=function(Ie){return("0"+parseInt(Ie)).slice(-2)},H=!1,z=[],V=[],W,L=0,k,N=d.__private__.setCustomOutputDestination=function(Ie){k=Ie},U=d.__private__.resetCustomOutputDestination=function(Ie){k=void 0},B=d.__private__.out=function(Ie){var rt;return Ie=typeof Ie=="string"?Ie:Ie.toString(),typeof k>"u"?rt=H?z[W]:V:rt=k,rt.push(Ie),H||(L+=Ie.length+1),rt},G=d.__private__.write=function(Ie){return B(arguments.length===1?Ie.toString():Array.prototype.join.call(arguments," "))},Y=d.__private__.getArrayBuffer=function(Ie){if(Ie instanceof ArrayBuffer)return Ie;for(var rt=Ie.length,Rt=new ArrayBuffer(rt),ur=new Uint8Array(Rt);rt--;)ur[rt]=Ie.charCodeAt(rt);return Rt},X={0:0,90:1,180:0,270:-1,360:0},K={0:1,90:0,180:-1,270:0,360:1},J={Helvetica:["helvetica","normal","WinAnsiEncoding"],"Helvetica-Bold":["helvetica","bold","WinAnsiEncoding"],"Helvetica-Oblique":["helvetica","italic","WinAnsiEncoding"],"Helvetica-BoldOblique":["helvetica","bolditalic","WinAnsiEncoding"],Courier:["courier","normal","WinAnsiEncoding"],"Courier-Bold":["courier","bold","WinAnsiEncoding"],"Courier-Oblique":["courier","italic","WinAnsiEncoding"],"Courier-BoldOblique":["courier","bolditalic","WinAnsiEncoding"],"Times-Roman":["Times-Roman","normal","WinAnsiEncoding"],"Times-Bold":["times","bold","WinAnsiEncoding"],"Times-Italic":["times","italic","WinAnsiEncoding"],"Times-BoldItalic":["times","bolditalic","WinAnsiEncoding"],ZapfDingbats:["zapfdingbats","normal",null],Symbol:["symbol","normal",null]},se=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","Times-Roman","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]],ce=d.__private__.getStandardFonts=function(Ie){return se},te=a.fontSize||16,oe=d.__private__.setFontSize=d.setFontSize=function(Ie){return te=Ie,this},$=d.__private__.getFontSize=d.getFontSize=function(){return te},fe=a.R2L||!1,Oe=d.__private__.setR2L=d.setR2L=function(Ie){return fe=Ie,this},Te=d.__private__.getR2L=d.getR2L=function(Ie){return fe},ue,be=d.__private__.setZoomMode=function(Ie){var rt=[void 0,null,"fullwidth","fullheight","fullpage","original"];if(/^\d*\.?\d*\%$/.test(Ie))ue=Ie;else if(!isNaN(Ie))ue=parseInt(Ie,10);else if(rt.indexOf(Ie)!==-1)ue=Ie;else throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+Ie+'" is not recognized.')},j=d.__private__.getZoomMode=function(){return ue},Z,ie=d.__private__.setPageMode=function(Ie){var rt=[void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"];if(rt.indexOf(Ie)==-1)throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+Ie+'" is not recognized.');Z=Ie},de=d.__private__.getPageMode=function(){return Z},me,Se=d.__private__.setLayoutMode=function(Ie){var rt=[void 0,null,"continuous","single","twoleft","tworight","two"];if(rt.indexOf(Ie)==-1)throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+Ie+'" is not recognized.');me=Ie},Re=d.__private__.getLayoutMode=function(){return me},Je=d.__private__.setDisplayMode=d.setDisplayMode=function(Ie,rt,Rt){return be(Ie),Se(rt),ie(Rt),this},Ke={title:"",subject:"",author:"",keywords:"",creator:""},Gt=d.__private__.getDocumentProperty=function(Ie){if(Object.keys(Ke).indexOf(Ie)===-1)throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return Ke[Ie]},Nr=d.__private__.getDocumentProperties=function(Ie){return Ke},xr=d.__private__.setDocumentProperties=d.setProperties=d.setDocumentProperties=function(Ie){for(var rt in Ke)Ke.hasOwnProperty(rt)&&Ie[rt]&&(Ke[rt]=Ie[rt]);return this},vr=d.__private__.setDocumentProperty=function(Ie,rt){if(Object.keys(Ke).indexOf(Ie)===-1){console.warn("Invalid arguments passed to jsPDF.setDocumentProperty");return}return Ke[Ie]=rt},_r=0,Ne=[],Vt={},Ft={},ir,Fe,tt=0,ye=[],yt=[],Wt=new t(d),pe=a.hotfixes||[],Xe=d.__private__.newObject=function(){var Ie=ct();return Me(Ie,!0),Ie},ct=d.__private__.newObjectDeferred=function(){return _r++,Ne[_r]=function(){return L},_r},Me=function(Ie,rt){return rt=typeof rt=="boolean"?rt:!1,Ne[Ie]=L,rt&&B(Ie+" 0 obj"),Ie},st=d.__private__.newAdditionalObject=function(){var Ie=ct(),rt={objId:Ie,content:""};return yt.push(rt),rt},Ot=ct(),hr=ct(),Or=d.__private__.decodeColorString=function(Ie){var rt=Ie.split(" ");if(rt.length===2&&(rt[1]==="g"||rt[1]==="G")){var Rt=parseFloat(rt[0]);rt=[Rt,Rt,Rt,"r"]}for(var ur="#",qr=0;qr<3;qr++)ur+=("0"+Math.floor(parseFloat(rt[qr])*255).toString(16)).slice(-2);return ur},Xr=d.__private__.encodeColorString=function(Ie){var rt;typeof Ie=="string"&&(Ie={ch1:Ie});var Rt=Ie.ch1,ur=Ie.ch2,qr=Ie.ch3,zi=Ie.ch4,ln=Ie.precision,Pn=Ie.pdfColorType==="draw"?["G","RG","K"]:["g","rg","k"];if(typeof Rt=="string"&&Rt.charAt(0)!=="#"){var Hc=new RGBColor(Rt);if(Hc.ok)Rt=Hc.toHex();else if(!/^\d*\.?\d*$/.test(Rt))throw new Error('Invalid color "'+Rt+'" passed to jsPDF.encodeColorString.')}if(typeof Rt=="string"&&/^#[0-9A-Fa-f]{3}$/.test(Rt)&&(Rt="#"+Rt[1]+Rt[1]+Rt[2]+Rt[2]+Rt[3]+Rt[3]),typeof Rt=="string"&&/^#[0-9A-Fa-f]{6}$/.test(Rt)){var Aa=parseInt(Rt.substr(1),16);Rt=Aa>>16&255,ur=Aa>>8&255,qr=Aa&255}if(typeof ur>"u"||typeof zi>"u"&&Rt===ur&&ur===qr)if(typeof Rt=="string")rt=Rt+" "+Pn[0];else switch(Ie.precision){case 2:rt=T(Rt/255)+" "+Pn[0];break;case 3:default:rt=I(Rt/255)+" "+Pn[0]}else if(typeof zi>"u"||typeof zi=="object"){if(zi&&!isNaN(zi.a)&&zi.a===0)return rt=["1.000","1.000","1.000",Pn[1]].join(" "),rt;if(typeof Rt=="string")rt=[Rt,ur,qr,Pn[1]].join(" ");else switch(Ie.precision){case 2:rt=[T(Rt/255),T(ur/255),T(qr/255),Pn[1]].join(" ");break;default:case 3:rt=[I(Rt/255),I(ur/255),I(qr/255),Pn[1]].join(" ")}}else if(typeof Rt=="string")rt=[Rt,ur,qr,zi,Pn[2]].join(" ");else switch(Ie.precision){case 2:rt=[T(Rt/255),T(ur/255),T(qr/255),T(zi/255),Pn[2]].join(" ");break;case 3:default:rt=[I(Rt/255),I(ur/255),I(qr/255),I(zi/255),Pn[2]].join(" ")}return rt},Oi=d.__private__.getFilters=function(){return l},qi=d.__private__.putStream=function(Ie){Ie=Ie||{};var rt=Ie.data||"",Rt=Ie.filters||Oi(),ur=Ie.alreadyAppliedFilters||[],qr=Ie.addLength1||!1,zi=rt.length,ln={};Rt===!0&&(Rt=["FlateEncode"]);var Pn=Ie.additionalKeyValues||[];typeof e.API.processDataByFilters<"u"?ln=e.API.processDataByFilters(rt,Rt):ln={data:rt,reverseChain:[]};var Hc=ln.reverseChain+(Array.isArray(ur)?ur.join(" "):ur.toString());ln.data.length!==0&&(Pn.push({key:"Length",value:ln.data.length}),qr===!0&&Pn.push({key:"Length1",value:zi})),Hc.length!=0&&(Hc.split("/").length-1===1?Pn.push({key:"Filter",value:Hc}):Pn.push({key:"Filter",value:"["+Hc+"]"})),B("<<");for(var Aa=0;Aa<Pn.length;Aa++)B("/"+Pn[Aa].key+" "+Pn[Aa].value);B(">>"),ln.data.length!==0&&(B("stream"),B(ln.data),B("endstream"))},Ni=d.__private__.putPage=function(Ie){var rt=Ie.mediaBox,Rt=Ie.number,ur=Ie.data,qr=Ie.objId,zi=Ie.contentsObjId;Me(qr,!0);var ln=ye[W].mediaBox.topRightX-ye[W].mediaBox.bottomLeftX,Pn=ye[W].mediaBox.topRightY-ye[W].mediaBox.bottomLeftY;B("<</Type /Page"),B("/Parent "+Ie.rootDictionaryObjId+" 0 R"),B("/Resources "+Ie.resourceDictionaryObjId+" 0 R"),B("/MediaBox ["+parseFloat(T(Ie.mediaBox.bottomLeftX))+" "+parseFloat(T(Ie.mediaBox.bottomLeftY))+" "+T(Ie.mediaBox.topRightX)+" "+T(Ie.mediaBox.topRightY)+"]"),Ie.cropBox!==null&&B("/CropBox ["+T(Ie.cropBox.bottomLeftX)+" "+T(Ie.cropBox.bottomLeftY)+" "+T(Ie.cropBox.topRightX)+" "+T(Ie.cropBox.topRightY)+"]"),Ie.bleedBox!==null&&B("/BleedBox ["+T(Ie.bleedBox.bottomLeftX)+" "+T(Ie.bleedBox.bottomLeftY)+" "+T(Ie.bleedBox.topRightX)+" "+T(Ie.bleedBox.topRightY)+"]"),Ie.trimBox!==null&&B("/TrimBox ["+T(Ie.trimBox.bottomLeftX)+" "+T(Ie.trimBox.bottomLeftY)+" "+T(Ie.trimBox.topRightX)+" "+T(Ie.trimBox.topRightY)+"]"),Ie.artBox!==null&&B("/ArtBox ["+T(Ie.artBox.bottomLeftX)+" "+T(Ie.artBox.bottomLeftY)+" "+T(Ie.artBox.topRightX)+" "+T(Ie.artBox.topRightY)+"]"),typeof Ie.userUnit=="number"&&Ie.userUnit!==1&&B("/UserUnit "+Ie.userUnit),Wt.publish("putPage",{objId:qr,pageContext:ye[Rt],pageNumber:Rt,page:ur}),B("/Contents "+zi+" 0 R"),B(">>"),B("endobj");var Hc=ur.join(`
`);return Me(zi,!0),qi({data:Hc,filters:Oi()}),B("endobj"),qr},Wi=d.__private__.putPages=function(){var Ie,rt,Rt,ur=[];for(Ie=1;Ie<=tt;Ie++)ye[Ie].objId=ct(),ye[Ie].contentsObjId=ct();for(Ie=1;Ie<=tt;Ie++)ur.push(Ni({number:Ie,data:z[Ie],objId:ye[Ie].objId,contentsObjId:ye[Ie].contentsObjId,mediaBox:ye[Ie].mediaBox,cropBox:ye[Ie].cropBox,bleedBox:ye[Ie].bleedBox,trimBox:ye[Ie].trimBox,artBox:ye[Ie].artBox,userUnit:ye[Ie].userUnit,rootDictionaryObjId:Ot,resourceDictionaryObjId:hr}));Me(Ot,!0),B("<</Type /Pages");var qr="/Kids [";for(Rt=0;Rt<tt;Rt++)qr+=ur[Rt]+" 0 R ";B(qr+"]"),B("/Count "+tt),B(">>"),B("endobj"),Wt.publish("postPutPages")},fo=function(Ie){Wt.publish("putFont",{font:Ie,out:B,newObject:Xe,putStream:qi}),Ie.isAlreadyPutted!==!0&&(Ie.objectNumber=Xe(),B("<<"),B("/Type /Font"),B("/BaseFont /"+Ie.postScriptName),B("/Subtype /Type1"),typeof Ie.encoding=="string"&&B("/Encoding /"+Ie.encoding),B("/FirstChar 32"),B("/LastChar 255"),B(">>"),B("endobj"))},tl=function(){for(var Ie in Vt)Vt.hasOwnProperty(Ie)&&(h===!1||h===!0&&u.hasOwnProperty(Ie))&&fo(Vt[Ie])},Oa=function(){B("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),B("/Font <<");for(var Ie in Vt)Vt.hasOwnProperty(Ie)&&(h===!1||h===!0&&u.hasOwnProperty(Ie))&&B("/"+Ie+" "+Vt[Ie].objectNumber+" 0 R");if(B(">>"),B("/XObject <<"),Wt.publish("putXobjectDict"),B(">>"),Object.keys(p_).length>0){B("/ExtGState <<");for(var rt in p_)p_.hasOwnProperty(rt)&&B(" /"+p_[rt]+" << /CA "+rt+" /ca "+rt+" >>");B(">>")}},Gc=function(){tl(),Wt.publish("putResources"),Me(hr,!0),B("<<"),Oa(),B(">>"),B("endobj"),Wt.publish("postPutResources")},B0=function(){Wt.publish("putAdditionalObjects");for(var Ie=0;Ie<yt.length;Ie++){var rt=yt[Ie];Me(rt.objId,!0),B(rt.content),B("endobj")}Wt.publish("postPutAdditionalObjects")},Uc=function(Ie,rt,Rt){Ft.hasOwnProperty(rt)||(Ft[rt]={}),Ft[rt][Rt]=Ie},Lt=function(Ie,rt,Rt,ur,qr){qr=qr||!1;var zi="F"+(Object.keys(Vt).length+1).toString(10),ln={id:zi,postScriptName:Ie,fontName:rt.match(/^\w+-(en|cn)\,*/)?rt.replace(/-(en|cn)/,""):rt,fontStyle:Rt,encoding:ur,isStandardFont:qr,metadata:{}},Pn,Hc;if(KD[rt.split(",")[0]]){Pn=KD[rt.split(",")[0]],ln.metadata.bbox=Pn.bbox,ln.metadata.flags=Pn.flags,ln.metadata.stemV=Pn.stemV,ln.metadata.italicAngle=Pn.italicAngle,ln.metadata.ascender=Pn.ascender,ln.metadata.decender=Pn.decender,ln.metadata.capHeight=Pn.capHeight,ln.metadata.widths=Pn.widths,ln.metadata.ordering=Pn.ordering,ln.metadata.registry=Pn.registry,ln.metadata.supplement=Pn.supplement,ln.encoding=Pn.encoding,ln.metadata.Unicode={},Hc=Pn.widths.split(" "),ln.metadata.Unicode.widths={};for(var Aa=0;Aa<Hc.length;Aa++)ln.metadata.Unicode.widths[32+Aa]=+Hc[Aa];ln.metadata.Unicode.widths.fof=1e3,ln.metadata.Unicode.kerning={},ln.metadata.widthOfString=Pn.widthOfString}var lp=this;return Wt.publish("addFont",{font:ln,instance:lp}),zi!==void 0&&(Vt[zi]=ln,Uc(zi,rt,Rt)),zi},Ql=function(Ie){for(var rt=0,Rt=se.length;rt<Rt;rt++){var ur=Lt(Ie[rt][0],Ie[rt][1],Ie[rt][2],se[rt][3],!0);u[ur]=!0;var qr=Ie[rt][0].split("-");Uc(ur,qr[0],qr[1]||"")}Wt.publish("addFonts",{fonts:Vt,dictionary:Ft})},Wm=function(Ie){return Ie.foo=function(){try{return Ie.apply(this,arguments)}catch(ur){var rt=ur.stack||"";~rt.indexOf(" at ")&&(rt=rt.split(" at ")[1]);var Rt="Error in function "+rt.split(`
`)[0].split("<")[0]+": "+ur.message;if(o.console)o.console.error(Rt,ur),o.alert&&alert(Rt);else throw new Error(Rt)}},Ie.foo.bar=Ie,Ie.foo},Lg=function(Ie,rt){var Rt,ur,qr,zi,ln,Pn,Hc,Aa,lp;if(rt=rt||{},qr=rt.sourceEncoding||"Unicode",ln=rt.outputEncoding,(rt.autoencode||ln)&&Vt[ir].metadata&&Vt[ir].metadata[qr]&&Vt[ir].metadata[qr].encoding&&(zi=Vt[ir].metadata[qr].encoding,!ln&&Vt[ir].encoding&&(ln=Vt[ir].encoding),!ln&&zi.codePages&&(ln=zi.codePages[0]),typeof ln=="string"&&(ln=zi[ln]),ln)){for(Hc=!1,Pn=[],Rt=0,ur=Ie.length;Rt<ur;Rt++)Aa=ln[Ie.charCodeAt(Rt)],Aa?Pn.push(String.fromCharCode(Aa)):Pn.push(Ie[Rt]),Pn[Rt].charCodeAt(0)>>8&&(Hc=!0);Ie=Pn.join("")}for(Rt=Ie.length;Hc===void 0&&Rt!==0;)Ie.charCodeAt(Rt-1)>>8&&(Hc=!0),Rt--;if(!Hc)return Ie;for(Pn=rt.noBOM?[]:[254,255],Rt=0,ur=Ie.length;Rt<ur;Rt++){if(Aa=Ie.charCodeAt(Rt),lp=Aa>>8,lp>>8)throw new Error("Character at position "+Rt+" of string '"+Ie+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");Pn.push(lp),Pn.push(Aa-(lp<<8))}return String.fromCharCode.apply(void 0,Pn)},OT=d.__private__.pdfEscape=d.pdfEscape=function(Ie,rt){return Lg(Ie,rt).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},IE=d.__private__.beginPage=function(Ie,rt){var Rt,ur=typeof rt=="string"&&rt.toLowerCase();if(typeof Ie=="string"&&(Rt=P(Ie.toLowerCase()))&&(Ie=Rt[0],rt=Rt[1]),Array.isArray(Ie)&&(rt=Ie[1],Ie=Ie[0]),(isNaN(Ie)||isNaN(rt))&&(Ie=n[0],rt=n[1]),ur){switch(ur.substr(0,1)){case"l":rt>Ie&&(ur="s");break;case"p":Ie>rt&&(ur="s");break}ur==="s"&&(Rt=Ie,Ie=rt,rt=Rt)}(Ie>14400||rt>14400)&&(console.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),Ie=Math.min(14400,Ie),rt=Math.min(14400,rt)),n=[Ie,rt],H=!0,z[++tt]=[],ye[tt]={objId:0,contentsObjId:0,userUnit:Number(c),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(Ie),topRightY:Number(rt)}},s9(tt)},o9=function(){IE.apply(this,arguments),tKe(eKe),B(J5),Vme!==0&&B(Vme+" J"),Gme!==0&&B(Gme+" j"),Wt.publish("addPage",{pageNumber:tt})},CE=function(Ie){Ie>0&&Ie<=tt&&(z.splice(Ie,1),tt--,W>tt&&(W=tt),this.setPage(W))},s9=function(Ie){Ie>0&&Ie<=tt&&(W=Ie)},S$=d.__private__.getNumberOfPages=d.getNumberOfPages=function(){return z.length-1},q5=function(Ie,rt,Rt){var ur=void 0,qr,zi;Ie=Ie!==void 0?Ie:Vt[ir].fontName;var ln=Ie.split(",")[0];return Rt=Rt||{},zi=Ie.toLowerCase(),Ft[Ie]?(Ie=Ie!==void 0?Ie:Vt[ir].fontName,rt=rt!==void 0?rt:Vt[ir].fontStyle,Ft[zi]!==void 0&&Ft[zi][rt]!==void 0?ur=Ft[zi][rt]:Ft[Ie]!==void 0&&Ft[Ie][rt]!==void 0?ur=Ft[Ie][rt]:Rt.disableWarning===!1&&console.warn("Unable to look up font label for font '"+Ie+"', '"+rt+"'. Refer to getFontList() for available fonts."),!ur&&!Rt.noFallback&&(ur=Ft.times[rt],ur==null&&(ur=Ft.times.normal)),ur):(J[ln]?ur=Lt(Ie,Ie!=ln?Ie:J[Ie][0],J[ln][1],J[ln][2],!0):ur=Lt(Ie,Ie,"normal"),ir||(ir=ur),ur)},AU=d.__private__.putInfo=function(){Xe(),B("<<"),B("/Producer (jsPDF "+e.version+")");for(var Ie in Ke)Ke.hasOwnProperty(Ie)&&Ke[Ie]&&B("/"+Ie.substr(0,1).toUpperCase()+Ie.substr(1)+" ("+OT(Ke[Ie])+")");B("/CreationDate ("+_+")"),B(">>"),B("endobj")},E$=d.__private__.putCatalog=function(Ie){Ie=Ie||{};var rt=Ie.rootDictionaryObjId||Ot;switch(Xe(),B("<<"),B("/Type /Catalog"),B("/Pages "+rt+" 0 R"),ue||(ue="fullwidth"),ue){case"fullwidth":B("/OpenAction [3 0 R /FitH null]");break;case"fullheight":B("/OpenAction [3 0 R /FitV null]");break;case"fullpage":B("/OpenAction [3 0 R /Fit]");break;case"original":B("/OpenAction [3 0 R /XYZ null null 1]");break;default:var Rt=""+ue;Rt.substr(Rt.length-1)==="%"&&(ue=parseInt(ue)/100),typeof ue=="number"&&B("/OpenAction [3 0 R /XYZ null null "+T(ue)+"]")}switch(me||(me="continuous"),me){case"continuous":B("/PageLayout /OneColumn");break;case"single":B("/PageLayout /SinglePage");break;case"two":case"twoleft":B("/PageLayout /TwoColumnLeft");break;case"tworight":B("/PageLayout /TwoColumnRight");break}Z&&B("/PageMode /"+Z),Wt.publish("putCatalog"),B(">>"),B("endobj")},O$=d.__private__.putTrailer=function(){B("trailer"),B("<<"),B("/Size "+(_r+1)),B("/Root "+_r+" 0 R"),B("/Info "+(_r-1)+" 0 R"),B("/ID [ <"+C+"> <"+C+"> ]"),B(">>")},A$=d.__private__.putHeader=function(){B("%PDF-"+p),B("%\xBA\xDF\xAC\xE0")},_$=d.__private__.putXRef=function(){var Ie=1,rt="0000000000";for(B("xref"),B("0 "+(_r+1)),B("0000000000 65535 f "),Ie=1;Ie<=_r;Ie++){var Rt=Ne[Ie];typeof Rt=="function"?B((rt+Ne[Ie]()).slice(-10)+" 00000 n "):typeof Ne[Ie]<"u"?B((rt+Ne[Ie]).slice(-10)+" 00000 n "):B("0000000000 00000 n ")}},$5=d.__private__.buildDocument=function(Ie="string"){H=!1,_r=0,L=0,V=[],Ne=[],yt=[],Ot=ct(),hr=ct(),Wt.publish("buildDocument"),A$(),Wi(),d.internal.pages.length=0,B0(),Gc(),AU(),E$();var rt=L;_$(),O$(),B("startxref"),B(""+rt),B("%%EOF"),H=!0,zDt(ye),ye.length=0;let Rt;return Ie==="arrayBuffer"?Rt=K5():Rt=V.join(`
`),V.length=0,Rt},K5=d.__private__.getContentArrayBuffer=function(){let Ie=0;for(let qr of V)Ie+=qr.length,++Ie;let rt=new ArrayBuffer(Ie),Rt=new Uint8Array(rt),ur=0;for(let qr of V){for(let zi=0;zi<qr.length;zi++)Rt[ur++]=qr.charCodeAt(zi);Rt[ur++]=10}return rt},_U=d.__private__.getBlob=function(Ie){return new Blob([Y(Ie)],{type:"application/pdf"})},Z$e=d.output=d.__private__.output=Wm(function(Ie,rt){rt=rt||{};var Rt=$5();switch(typeof rt=="string"?rt={filename:rt}:rt.filename=rt.filename||"generated.pdf",Ie){case void 0:return Rt;case"save":d.save(rt.filename);break;case"arraybuffer":return Y(Rt);case"blob":return _U(Rt);case"bloburi":case"bloburl":if(typeof o.URL<"u"&&typeof o.URL.createObjectURL=="function")return o.URL&&o.URL.createObjectURL(_U(Rt))||void 0;f,console.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":return"data:application/pdf;filename="+rt.filename+";base64,"+btoa(Rt);case"dataurlnewwindow":var ur='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;}  </style><body><iframe src="'+this.output("datauristring")+'"></iframe></body></html>',qr=o.open();if(qr!==null&&qr.document.write(ur),qr||typeof safari>"u")return qr;case"datauri":case"dataurl":return o.document.location.href="data:application/pdf;filename="+rt.filename+";base64,"+btoa(Rt);default:return null}}),TAe=function(Ie){return Array.isArray(pe)===!0&&pe.indexOf(Ie)>-1};switch(i){case"pt":Fe=1;break;case"mm":Fe=72/25.4;break;case"cm":Fe=72/2.54;break;case"in":Fe=.72;break;case"px":TAe("px_scaling")==!0?Fe=72/96:Fe=96/72;break;case"pc":Fe=12;break;case"em":Fe=12;break;case"ex":Fe=6;break;default:if(Number.isNaN(i))throw new Error("Invalid unit: "+i);Fe=Number(i);break}D(),O();var IAe=d.__private__.getPageInfo=function(Ie){if(isNaN(Ie)||Ie%1!==0)throw new Error("Invalid argument passed to jsPDF.getPageInfo");var rt=ye[Ie].objId;return{objId:rt,pageNumber:Ie,pageContext:ye[Ie]}},J$e=d.__private__.getPageInfoByObjId=function(Ie){var rt;for(var Rt in ye)if(ye[Rt].objId===Ie){rt=Rt;break}if(isNaN(Ie)||Ie%1!==0)throw new Error("Invalid argument passed to jsPDF.getPageInfoByObjId");return IAe(Rt)},Q$e=d.__private__.getCurrentPageInfo=function(){return{objId:ye[W].objId,pageNumber:W,pageContext:ye[W]}};d.addPage=function(){return o9.apply(this,arguments),this},d.setPage=function(){return s9.apply(this,arguments),this},d.insertPage=function(Ie){return this.addPage(),this.movePage(W,Ie),this},d.movePage=function(Ie,rt){if(Ie>rt){for(var Rt=z[Ie],ur=ye[Ie],qr=Ie;qr>rt;qr--)z[qr]=z[qr-1],ye[qr]=ye[qr-1];z[rt]=Rt,ye[rt]=ur,this.setPage(rt)}else if(Ie<rt){for(var Rt=z[Ie],ur=ye[Ie],qr=Ie;qr<rt;qr++)z[qr]=z[qr+1],ye[qr]=ye[qr+1];z[rt]=Rt,ye[rt]=ur,this.setPage(rt)}return this},d.deletePage=function(){return CE.apply(this,arguments),this};var gwt=d.__private__.saveGraphicState=d.saveGraphicState=function(){B("q")},ywt=d.__private__.restoreGraphicState=d.restoreGraphicState=function(){B("Q")},bwt=d.__private__.text=d.text=function(Ie,rt,Rt,ur){var qr;typeof Ie=="number"&&typeof rt=="number"&&(typeof Rt=="string"||Array.isArray(Rt))&&(qr=Rt,Rt=rt,rt=Ie,Ie=qr);var zi;typeof Array.isArray(rt)&&rt.length===6&&(zi=rt,rt=0,Rt=0);var Mg=arguments[3],W2=arguments[4],SE=arguments[5];if((typeof Mg!="object"||Mg===null)&&(typeof W2=="string"&&(SE=W2,W2=null),typeof Mg=="string"&&(SE=Mg,Mg=null),typeof Mg=="number"&&(W2=Mg,Mg=null),ur={flags:Mg,angle:W2,align:SE}),Mg=Mg||{},Mg.noBOM=Mg.noBOM||!0,Mg.autoencode=Mg.autoencode||!0,isNaN(rt)||isNaN(Rt)||typeof Ie>"u"||Ie===null)return console.warn("Invalid arguments passed to jsPDF.text"),Aa;if(Ie.length===0)return Aa;var ln="",Pn=!1,Hc=typeof ur.lineHeightFactor=="number"?ur.lineHeightFactor:ew,Aa=ur.scope||this;function lp(th){return th=th.split("	").join(Array(ur.TabLen||9).join(" ")),OT(th,Mg)}function f_(th){for(var nd=th.concat(),Nd=[],t2=nd.length,c0;t2--;)c0=nd.shift(),typeof c0=="string"?Nd.push(c0):Array.isArray(th)&&c0.length===1?Nd.push(c0[0]):Nd.push([c0[0],c0[1],c0[2]]);return Nd}function R$(th,nd){var Nd;if(typeof th=="string")Nd=nd(th)[0];else if(Array.isArray(th)){for(var t2=th.concat(),c0=[],z2=t2.length,vT,c9;z2--;)vT=t2.shift(),typeof vT=="string"?c0.push(nd(vT)[0]):Array.isArray(vT)&&vT[0]==="string"&&(c9=nd(vT[0],vT[1],vT[2]),c0.push([c9[0],c9[1],c9[2]]));Nd=c0}return Nd}function D$(th,nd){var Nd=KD[nd.split(",")[0]];if(Nd){var t2=Nd.encoding;if(!(t2==="WinAnsiEncoding"&&th>255)){for(var c0=Nd.ranges,z2=0;z2<c0.length;z2++)if(th>=c0[z2].start&&th<=c0[z2].end)return!0;return!1}}}function w$(th){var nd;for(var Nd in KD)if(KD.hasOwnProperty(Nd)){if(nd=KD[Nd].ranges,KD[Nd].encoding==="WinAnsiEncoding"&&th>255)continue;for(var t2=0;t2<nd.length;t2++)if(th>=nd[t2].start&&th<=nd[t2].end)return Nd}return""}function bC(th,nd){var Nd=!1,t2,c0=[],z2,vT,c9,AE,g_=nd.split(",")[1]||"";nd=nd.split(",")[0];var IKe=["Helvetica","Helvetica-Bold","Helvetica-Oblique","Helvetica-BoldOblique","Courier","Courier-Bold","Courier-Oblique","Courier-BoldOblique","Times-Roman","Times-Bold","Times-Italic","Times-BoldItalic","ZapfDingbats","Symbol"];if(!/[^\x00-\x7f]/.test(th)&&IKe.indexOf(nd)>-1)return;let LAe=fKe==="WinAnsiEncoding",MAe=LAe?1:4;for(var sP=0;sP<th.length;sP+=MAe)t2=LAe?th.charCodeAt(sP):+`0x${th.slice(sP,sP+MAe)}`,D$(t2,nd)?Nd&&AE!==nd&&(c0.push({partStr:th.slice(z2,sP),fontName:AE+(g_?","+g_:"")}),z2=sP,AE=nd):(Nd=!0,c9=w$(t2),sP===0?(z2=sP,vT=!0,AE=c9):vT?AE!==c9&&(c0.push({partStr:th.slice(z2,sP),fontName:AE+(g_?","+g_:"")}),z2=sP,AE=c9):(c0.push({partStr:th.slice(0,sP),fontName:nd+(g_?","+g_:"")}),vT=!0,z2=sP,AE=c9));if(Nd)return c0.push({partStr:th.slice(z2),fontName:AE+(g_?","+g_:"")}),c0}var nP=!1,xU=!0;if(typeof Ie=="string")nP=!0;else if(Array.isArray(Ie)){for(var EAe=Ie.concat(),F0=[],oP=EAe.length,L$;oP--;)L$=EAe.shift(),(typeof L$!="string"||Array.isArray(L$)&&typeof L$[0]!="string")&&(xU=!1);nP=xU}if(nP===!1)throw new Error('Type of text must be string or Array. "'+Ie+'" is not recognized.');var fKe=Vt[ir].encoding;typeof Ie=="string"&&(Ie.match(/[\\r?\\n]/)?Ie=Ie.split(/\\r\\n|\\r|\\n/g):Ie=[Ie]);var M$=te/Aa.internal.scaleFactor,N$=M$*(ew-1);switch(ur.baseline){case"bottom":Rt-=N$;break;case"top":Rt+=M$-N$;break;case"hanging":Rt+=M$-2*N$;break;case"middle":Rt+=M$/2-N$;break;case"ideographic":case"alphabetic":default:break}var m_=ur.maxWidth||0;m_>0&&(typeof Ie=="string"?Ie=Aa.splitTextToSize(Ie,m_):Object.prototype.toString.call(Ie)==="[object Array]"&&(Ie=Aa.splitTextToSize(Ie.join(" "),m_)));var tw={text:Ie,x:rt,y:Rt,options:ur,mutex:{pdfEscape:OT,activeFontKey:ir,fonts:Vt,activeFontSize:te}};Wt.publish("preProcessText",tw),Ie=tw.text,ur=tw.options;var W2=+ur.angle||0,Q5=Aa.internal.scaleFactor,Hme=[];if(W2){W2*=Math.PI/180;var OAe=Math.cos(W2),AAe=Math.sin(W2);Hme=[T(OAe),T(AAe),T(AAe*-1),T(OAe)]}var B$=ur.charSpace;typeof B$<"u"&&(ln+=I(B$*Q5)+` Tc
`);var Wwt=ur.lang,zwt=-1,AT=-1,mKe=typeof ur.renderingMode<"u"?ur.renderingMode:ur.stroke,Wme=Aa.internal.getCurrentPageInfo().pageContext;switch(mKe){case 0:case!1:case"fill":AT=0;break;case 1:case!0:case"stroke":AT=1;break;case 2:case"fillThenStroke":AT=2;break;case 3:case"invisible":AT=3;break;case 4:case"fillAndAddForClipping":AT=4;break;case 5:case"strokeAndAddPathForClipping":AT=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":AT=6;break;case 7:case"addToPathForClipping":AT=7;break}var gKe=typeof Wme.usedRenderingMode<"u"?Wme.usedRenderingMode:-1;AT!==-1?ln+=AT+` Tr
`:gKe!==-1&&(ln+=`0 Tr
`),AT!==-1&&(Wme.usedRenderingMode=AT);var SE=ur.align||"left",k$=te*Hc,yKe=Aa.internal.pageSize.getWidth(),Q5=Aa.internal.scaleFactor,bKe=bKe,RU=Vt[ir],B$=ur.charSpace||Fme,Ywt,m_=ur.maxWidth||0,zm,Mg={},F$=[];if(Object.prototype.toString.call(Ie)==="[object Array]"){var F0=f_(Ie),PKe=0,EE,V$,zm;SE!=="left"&&(zm=F0.map(function(Nd){return Aa.getStringUnitWidth(Nd,{font:RU,charSpace:B$,fontSize:te})*te/Q5}));var V$=Math.max.apply(Math,zm),G$=0,_Ae,OE;if(SE==="right"){PKe=rt-V$,K.hasOwnProperty(ur.angle)?rt-=zm[0]*K[ur.angle]:rt-=zm[0]*Math.cos(W2),X.hasOwnProperty(ur.angle)?Rt+=zm[0]*X[ur.angle]:Rt+=zm[0]*Math.sin(W2),Ie=[];for(var mo=0,oP=F0.length;mo<oP;mo++)_Ae=V$-zm[mo],mo===0?(OE=Ld(rt),EE=Md(Rt)):(OE=(G$-zm[mo])*Q5,EE=-k$),Ie.push([F0[mo],OE,EE]),G$=zm[mo]}else if(SE==="center"){K.hasOwnProperty(ur.angle)?rt-=zm[0]/2*K[ur.angle]:rt-=zm[0]/2*Math.cos(W2),X.hasOwnProperty(ur.angle)?Rt+=zm[0]/2*X[ur.angle]:Rt+=zm[0]/2*Math.sin(W2),Ie=[];for(var mo=0,oP=F0.length;mo<oP;mo++)_Ae=(V$-zm[mo])/2,mo===0?(OE=Ld(rt),EE=Md(Rt)):(OE=(G$-zm[mo])/2*Q5,EE=-k$),Ie.push([F0[mo],OE,EE]),G$=zm[mo]}else if(SE==="left"){Ie=[];for(var mo=0,oP=F0.length;mo<oP;mo++)EE=mo===0?Md(Rt):-k$,OE=mo===0?Ld(rt):0,Ie.push(F0[mo])}else if(SE==="justify"){Ie=[];for(var m_=m_!==0?m_:yKe,mo=0,oP=F0.length;mo<oP;mo++)EE=mo===0?Md(Rt):-k$,OE=mo===0?Ld(rt):0,mo<oP-1&&F$.push(((m_-zm[mo])/(F0[mo].split(" ").length-1)*Q5).toFixed(2)),Ie.push([F0[mo],OE,EE])}else throw new Error('Unrecognized alignment option, use "left", "center", "right" or "justify".')}var TKe=typeof ur.R2L=="boolean"?ur.R2L:fe;TKe===!0&&(Ie=R$(Ie,function(th,nd,Nd){return[th.split("").reverse().join(""),nd,Nd]}));var tw={text:Ie,x:rt,y:Rt,options:ur,mutex:{pdfEscape:OT,activeFontKey:ir,fonts:Vt,activeFontSize:te}};Wt.publish("postProcessText",tw),Ie=tw.text,Pn=tw.mutex.isHex;var F0=f_(Ie);Ie=[];for(var U$=0,oP=F0.length,H$,W$,_T,e7="",z$,zme,a9=[],Yme=RU?RU.fontName:"",vAe=!1,xAe=new Map,mo=0;Yme&&mo<oP;mo++)Array.isArray(F0[mo])?z$=F0[mo][0]:z$=F0[mo],zme=bC(z$,Yme),zme?(a9[mo]=zme,vAe=!0):(a9[mo]=null,xAe.set(mo,z$));vAe&&xAe.forEach((th,nd)=>{a9[nd]=[{partStr:th,fontName:Yme}]});for(var l9,RAe,DU,DAe,wAe,mo=0;mo<oP;mo++){if(e7="",a9[mo]){_T="";for(var wU=0;wU<a9[mo].length;wU++)l9=a9[mo][wU],l9&&l9.fontName&&l9.fontName!==DU&&(mo===0&&(wAe=!0),DAe=!0,RAe=ir,this.setFont(l9.fontName),_T+="/"+ir+" "+te+` Tf
`,u[ir]=!0,DU=l9.fontName,ir=RAe),/[^\x00-\x7f]/.test(l9.partStr)?_T+="<"+this.stringToHex(l9.fontName?l9.partStr:" ")+(wU===a9[mo].length-1?">":`> Tj
`):_T+=(Pn?"<":"(")+l9.partStr+(wU===a9[mo].length-1?Pn?">":")":(Pn?">":")")+` Tj
`)}Array.isArray(F0[mo])?(H$=parseFloat(F0[mo][1]),W$=parseFloat(F0[mo][2]),a9[mo]||(_T=(Pn?"<":"(")+F0[mo][0]+(Pn?">":")")),U$=1):(H$=Ld(rt),W$=Md(Rt),a9[mo]||(_T="",mo>0&&DU&&RU.fontName!==DU&&(_T+="/"+ir+" "+te+` Tf
`,DU=RU.fontName),_T+=(Pn?"<":"(")+F0[mo]+(Pn?">":")"))),F$!==void 0&&F$[mo]!==void 0&&(e7=F$[mo]+` Tw
`),zi!=null&&zi.length&&mo===0?Ie.push(e7+zi.join(" ")+` Tm
`+_T):Hme.length!==0&&mo===0?Ie.push(e7+Hme.join(" ")+" "+H$.toFixed(2)+" "+W$.toFixed(2)+` Tm
`+_T):U$===1||U$===0&&mo===0?Ie.push(e7+H$.toFixed(2)+" "+W$.toFixed(2)+` Td
`+_T):Ie.push(e7+_T)}U$===0?Ie=Ie.join(` Tj
T* `):Ie=Ie.join(` Tj
`),Ie+=` Tj
`;var Y$=`BT
`+(wAe?"":"/"+ir+" "+te+` Tf
`)+(te*Hc).toFixed(2)+` TL
`+Bme+`
`;return Y$+=ln,Y$+=Ie,Y$+="ET",B(Y$),DAe||(u[ir]=!0),Aa},Pwt=d.__private__.lstext=d.lstext=function(Ie,rt,Rt,ur){return console.warn("jsPDF.lstext is deprecated"),this.text(Ie,rt,Rt,{charSpace:ur})},Twt=d.__private__.clip=d.clip=function(Ie){B(Ie==="evenodd"?"W*":"W"),B("n")},Iwt=d.__private__.clip_fixed=d.clip_fixed=function(Ie){console.log("clip_fixed is deprecated"),d.clip(Ie)},Z5=d.__private__.isValidStyle=function(Ie){var rt=[void 0,null,"S","F","DF","FD","f","f*","B","B*"],Rt=!1;return rt.indexOf(Ie)!==-1&&(Rt=!0),Rt},v$=d.__private__.getStyle=function(Ie){var rt="S";return Ie==="F"?rt="f":Ie==="FD"||Ie==="DF"?rt="B":(Ie==="f"||Ie==="f*"||Ie==="B"||Ie==="B*")&&(rt=Ie),rt},Cwt=d.__private__.line=d.line=function(Ie,rt,Rt,ur){return isNaN(Ie)||isNaN(rt)||isNaN(Rt)||isNaN(ur)?(console.warn("Invalid arguments passed to jsPDF.line"),this):this.lines([[Rt-Ie,ur-rt]],Ie,rt)},Swt=d.__private__.lines=d.lines=function(Ie,rt,Rt,ur,qr,zi){var ln,Pn,Hc,Aa,lp,f_,R$,D$,w$,bC,nP,xU;if(typeof Ie=="number"&&(xU=Rt,Rt=rt,rt=Ie,Ie=xU),ur=ur||[1,1],zi=zi||!1,isNaN(rt)||isNaN(Rt)||!Array.isArray(Ie)||!Array.isArray(ur)||!Z5(qr)||typeof zi!="boolean")return console.warn("Invalid arguments passed to jsPDF.lines"),this;for(B(I(Ld(rt))+" "+I(Md(Rt))+" m "),ln=ur[0],Pn=ur[1],Aa=Ie.length,bC=rt,nP=Rt,Hc=0;Hc<Aa;Hc++)lp=Ie[Hc],lp.length===2?(bC=lp[0]*ln+bC,nP=lp[1]*Pn+nP,B(I(Ld(bC))+" "+I(Md(nP))+" l")):(f_=lp[0]*ln+bC,R$=lp[1]*Pn+nP,D$=lp[2]*ln+bC,w$=lp[3]*Pn+nP,bC=lp[4]*ln+bC,nP=lp[5]*Pn+nP,B(I(Ld(f_))+" "+I(Md(R$))+" "+I(Ld(D$))+" "+I(Md(w$))+" "+I(Ld(bC))+" "+I(Md(nP))+" c"));return zi&&B(" h"),qr!==null&&B(v$(qr)),this},Ewt=d.__private__.rect=d.rect=function(Ie,rt,Rt,ur,qr){return isNaN(Ie)||isNaN(rt)||isNaN(Rt)||isNaN(ur)||!Z5(qr)?(console.warn("Invalid arguments passed to jsPDF.rect"),this):(B([T(Ld(Ie)),T(Md(rt)),T(Rt*Fe),T(-ur*Fe),"re"].join(" ")),qr!==null&&B(v$(qr)),this)},Owt=d.__private__.triangle=d.triangle=function(Ie,rt,Rt,ur,qr,zi,ln){return isNaN(Ie)||isNaN(rt)||isNaN(Rt)||isNaN(ur)||isNaN(qr)||isNaN(zi)||!Z5(ln)?(console.warn("Invalid arguments passed to jsPDF.triangle"),this):(this.lines([[Rt-Ie,ur-rt],[qr-Rt,zi-ur],[Ie-qr,rt-zi]],Ie,rt,[1,1],ln,!0),this)},Awt=d.__private__.roundedRect=d.roundedRect=function(Ie,rt,Rt,ur,qr,zi,ln){if(isNaN(Ie)||isNaN(rt)||isNaN(Rt)||isNaN(ur)||isNaN(qr)||isNaN(zi)||!Z5(ln))return console.warn("Invalid arguments passed to jsPDF.roundedRect"),this;var Pn=4/3*(Math.SQRT2-1);return this.lines([[Rt-2*qr,0],[qr*Pn,0,qr,zi-zi*Pn,qr,zi],[0,ur-2*zi],[0,zi*Pn,-(qr*Pn),zi,-qr,zi],[-Rt+2*qr,0],[-(qr*Pn),0,-qr,-(zi*Pn),-qr,-zi],[0,-ur+2*zi],[0,-(zi*Pn),qr*Pn,-zi,qr,-zi]],Ie+qr,rt,[1,1],ln),this},_wt=d.__private__.ellipse=d.ellipse=function(Ie,rt,Rt,ur,qr){if(isNaN(Ie)||isNaN(rt)||isNaN(Rt)||isNaN(ur)||!Z5(qr))return console.warn("Invalid arguments passed to jsPDF.ellipse"),this;var zi=4/3*(Math.SQRT2-1)*Rt,ln=4/3*(Math.SQRT2-1)*ur;return B([T(Ld(Ie+Rt)),T(Md(rt)),"m",T(Ld(Ie+Rt)),T(Md(rt-ln)),T(Ld(Ie+zi)),T(Md(rt-ur)),T(Ld(Ie)),T(Md(rt-ur)),"c"].join(" ")),B([T(Ld(Ie-zi)),T(Md(rt-ur)),T(Ld(Ie-Rt)),T(Md(rt-ln)),T(Ld(Ie-Rt)),T(Md(rt)),"c"].join(" ")),B([T(Ld(Ie-Rt)),T(Md(rt+ln)),T(Ld(Ie-zi)),T(Md(rt+ur)),T(Ld(Ie)),T(Md(rt+ur)),"c"].join(" ")),B([T(Ld(Ie+zi)),T(Md(rt+ur)),T(Ld(Ie+Rt)),T(Md(rt+ln)),T(Ld(Ie+Rt)),T(Md(rt)),"c"].join(" ")),qr!==null&&B(v$(qr)),this},vwt=d.__private__.circle=d.circle=function(Ie,rt,Rt,ur){return isNaN(Ie)||isNaN(rt)||isNaN(Rt)||!Z5(ur)?(console.warn("Invalid arguments passed to jsPDF.circle"),this):this.ellipse(Ie,rt,Rt,Rt,ur)};d.setFont=function(Ie,rt){return ir=q5(Ie,rt,{disableWarning:!1}),this},d.setFontStyle=d.setFontType=function(Ie){return ir=q5(void 0,Ie),this};var xwt=d.__private__.getFontList=d.getFontList=function(){var Ie={},rt,Rt,ur;for(rt in Ft)if(Ft.hasOwnProperty(rt)){Ie[rt]=ur=[];for(Rt in Ft[rt])Ft[rt].hasOwnProperty(Rt)&&ur.push(Rt)}return Ie};d.addFont=function(Ie,rt,Rt,ur){ur=ur,Lt.call(this,Ie,rt,Rt,ur)};var kme=0,Rwt=d.setLineWidthIncrement=function(Ie){isNaN(Ie)||(kme=+Ie)},eKe=a.lineWidth||.200025,tKe=d.__private__.setLineWidth=d.setLineWidth=function(Ie,rt){return kme&&!rt&&(Ie=Ie>1||Ie===0?Ie:Ie+kme),B((Ie*Fe).toFixed(2)+" w"),this},Dwt=d.__private__.setLineDash=e.API.setLineDash=function(Ie,rt){return Ie=Ie||[],rt=rt||0,isNaN(rt)||!Array.isArray(Ie)?(console.warn("Invalid arguments passed to jsPDF.setLineDash"),this):(Ie=Ie.map(function(Rt){return(Rt*Fe).toFixed(3)}).join(" "),rt=parseFloat((rt*Fe).toFixed(3)),B("["+Ie+"] "+rt+" d"),this)},ew,CAe=d.__private__.getLineHeight=d.getLineHeight=function(){return te*ew},ew,CAe=d.__private__.getLineHeight=d.getLineHeight=function(){return te*ew},rKe=d.__private__.setLineHeightFactor=d.setLineHeightFactor=function(Ie){return Ie=Ie||1,typeof Ie=="number"&&(ew=Ie),this},iKe=d.__private__.getLineHeightFactor=d.getLineHeightFactor=function(){return ew};rKe(a.lineHeight);var Ld=d.__private__.getHorizontalCoordinate=function(Ie){return Ie*Fe},Md=d.__private__.getVerticalCoordinate=function(Ie,rt){return ye[rt||W].mediaBox.topRightY-ye[rt||W].mediaBox.bottomLeftY-Ie*Fe},nKe=d.__private__.getHorizontalCoordinateString=function(Ie){return T(Ie*Fe)},oKe=d.__private__.getVerticalCoordinateString=function(Ie,rt){return T(ye[rt||W].mediaBox.topRightY-ye[rt||W].mediaBox.bottomLeftY-Ie*Fe)},J5=a.strokeColor||"0 G",wwt=d.__private__.getStrokeColor=d.getDrawColor=function(){return Or(J5)},Lwt=d.__private__.setStrokeColor=d.setDrawColor=function(Ie,rt,Rt,ur){var qr={ch1:Ie,ch2:rt,ch3:Rt,ch4:ur,pdfColorType:"draw",precision:2};return J5=Xr(qr),B(J5),this},sKe="1",aKe=0,p_={},Mwt=d.setColorWithOpacity=function(Ie,rt,Rt,ur,qr){var zi={ch1:Ie,ch2:rt,ch3:Rt,pdfColorType:"draw",precision:2};qr!=="S"&&qr!=="F"&&qr!=="FD"&&(qr="S"),ur!=null?ur=T(ur):ur="1",sKe=ur,p_[ur]||(p_[ur]="a"+aKe++),(qr==="S"||qr==="FD")&&(J5=Xr(zi),B(J5+" /"+p_[ur]+" gs")),(qr==="F"||qr==="FD")&&(zi.pdfColorType="fill",vU=Xr(zi),B(vU+" /"+p_[ur]+" gs"))},Nwt=d.setCTM=function(Ie,rt,Rt,ur,qr,zi){B([Ie,rt,Rt,ur,qr,zi,"cm"].join(" "))},vU=a.fillColor||"0 g",kwt=d.__private__.getFillColor=d.getFillColor=function(){return Or(vU)},Bwt=d.__private__.setFillColor=d.setFillColor=function(Ie,rt,Rt,ur){var qr={ch1:Ie,ch2:rt,ch3:Rt,ch4:ur,pdfColorType:"fill",precision:2};return vU=Xr(qr),B(vU),this},Bme=a.textColor||"0 g",lKe=d.__private__.getTextColor=d.getTextColor=function(){return Or(Bme)},Fwt=d.__private__.setTextColor=d.setTextColor=function(Ie,rt,Rt,ur){var qr={ch1:Ie,ch2:rt,ch3:Rt,ch4:ur,pdfColorType:"text",precision:3};return Bme=Xr(qr),this},Fme=a.charSpace||0,cKe=d.__private__.getCharSpace=d.getCharSpace=function(){return Fme},Vwt=d.__private__.setCharSpace=d.setCharSpace=function(Ie){if(isNaN(Ie))throw new Error("Invalid argument passed to jsPDF.setCharSpace");return Fme=Ie,this},Vme=0;d.CapJoinStyles={0:0,butt:0,but:0,miter:0,1:1,round:1,rounded:1,circle:1,2:2,projecting:2,project:2,square:2,bevel:2};var Gwt=d.__private__.setLineCap=d.setLineCap=function(Ie){var rt=d.CapJoinStyles[Ie];if(rt===void 0)throw new Error("Line cap style of '"+Ie+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return Vme=rt,B(rt+" J"),this},Gme=0,Uwt=d.__private__.setLineJoin=d.setLineJoin=function(Ie){var rt=d.CapJoinStyles[Ie];if(rt===void 0)throw new Error("Line join style of '"+Ie+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return Gme=rt,B(rt+" j"),this},SAe,Hwt=d.__private__.setMiterLimit=d.setMiterLimit=function(Ie){if(Ie=Ie||0,isNaN(Ie))throw new Error("Invalid argument passed to jsPDF.setMiterLimit");return SAe=parseFloat(T(Ie*Fe)),B(SAe+" M"),this};d.save=function(Ie,rt){if(Ie=Ie||"generated.pdf",rt=rt||{},rt.returnPromise=rt.returnPromise||!1,rt.returnPromise===!1)saveAs(_U($5()),Ie),typeof saveAs.unload=="function"&&o.setTimeout&&setTimeout(saveAs.unload,911);else return new Promise(function(Rt,ur){try{var qr=saveAs(_U($5()),Ie);typeof saveAs.unload=="function"&&o.setTimeout&&setTimeout(saveAs.unload,911),Rt(qr)}catch(zi){ur(zi.message)}})},d.getPDFBlob=function(){return _U($5("arrayBuffer"))};var Ume=[],hKe=async function(Ie,rt){ye[Ie].objId=ct(),ye[Ie].contentsObjId=ct(),Ume.push(await uKe({number:Ie,data:z[Ie],objId:ye[Ie].objId,contentsObjId:ye[Ie].contentsObjId,mediaBox:ye[Ie].mediaBox,cropBox:ye[Ie].cropBox,bleedBox:ye[Ie].bleedBox,trimBox:ye[Ie].trimBox,artBox:ye[Ie].artBox,userUnit:ye[Ie].userUnit,rootDictionaryObjId:Ot,resourceDictionaryObjId:hr},rt))},uKe=async function(Ie,rt){var Rt=Ie.number,ur=Ie.data,qr=Ie.objId,zi=Ie.contentsObjId;return Me(qr,!0),B("<</Type /Page"),B("/Parent "+Ie.rootDictionaryObjId+" 0 R"),B("/Resources "+Ie.resourceDictionaryObjId+" 0 R"),B("/MediaBox ["+parseFloat(T(Ie.mediaBox.bottomLeftX))+" "+parseFloat(T(Ie.mediaBox.bottomLeftY))+" "+T(Ie.mediaBox.topRightX)+" "+T(Ie.mediaBox.topRightY)+"]"),Ie.cropBox!==null&&B("/CropBox ["+T(Ie.cropBox.bottomLeftX)+" "+T(Ie.cropBox.bottomLeftY)+" "+T(Ie.cropBox.topRightX)+" "+T(Ie.cropBox.topRightY)+"]"),Ie.bleedBox!==null&&B("/BleedBox ["+T(Ie.bleedBox.bottomLeftX)+" "+T(Ie.bleedBox.bottomLeftY)+" "+T(Ie.bleedBox.topRightX)+" "+T(Ie.bleedBox.topRightY)+"]"),Ie.trimBox!==null&&B("/TrimBox ["+T(Ie.trimBox.bottomLeftX)+" "+T(Ie.trimBox.bottomLeftY)+" "+T(Ie.trimBox.topRightX)+" "+T(Ie.trimBox.topRightY)+"]"),Ie.artBox!==null&&B("/ArtBox ["+T(Ie.artBox.bottomLeftX)+" "+T(Ie.artBox.bottomLeftY)+" "+T(Ie.artBox.topRightX)+" "+T(Ie.artBox.topRightY)+"]"),typeof Ie.userUnit=="number"&&Ie.userUnit!==1&&B("/UserUnit "+Ie.userUnit),Wt.publish("putPage",{objId:qr,pageContext:ye[Rt],pageNumber:Rt,page:ur}),B("/Contents "+zi+" 0 R"),B(">>"),B("endobj"),await rt(0),Me(zi,!0),await dKe({data:ur,filters:Oi(),onProgress:rt}),B("endobj"),await rt(1),qr},dKe=async function(Ie){Ie=Ie||{};var rt=Ie.data||[],Rt=rt.length+rt.reduce((Hc,Aa)=>(Hc+=Aa.length,Hc),-1),ur=Ie.addLength1||!1,qr=Rt,zi=Ie.onProgress,ln=Ie.additionalKeyValues||[];Rt!==0&&(ln.push({key:"Length",value:Rt}),ur===!0&&ln.push({key:"Length1",value:qr})),B("<<");for(var Pn=0;Pn<ln.length;Pn++)B("/"+ln[Pn].key+" "+ln[Pn].value);if(B(">>"),Rt!==0){B("stream");let Hc=1e7,Aa=0,lp=[];for(let f_ of rt)lp.push(f_),Aa+=f_.length,Aa>=Hc&&(B(lp.join(`
`)),lp.length=0,Aa=0,await zi(1));lp.length>0&&(B(lp.join(`
`)),await zi(1)),B("endstream")}},pKe=d.__private__.putPageEnd=function(){Me(Ot,!0),B("<</Type /Pages");var Ie="/Kids [";for(let rt=0;rt<tt;rt++)Ie+=Ume[rt]+" 0 R ";B(Ie+"]"),B("/Count "+tt),B(">>"),B("endobj"),Ume.length=0};d.buildDocumentStart=function(Ie="string"){H=!1,_r=0,L=0,V=[],Ne=[],yt=[],Ot=ct(),hr=ct(),A$(),H=!0;let rt;return Ie==="arrayBuffer"?rt=K5():rt=V.join(`
`)+`
`,V.length=0,rt},d.buildDocumentContent=async function(Ie="string",rt=1,Rt){H=!1,await hKe(rt,async ur=>{let qr;Ie==="arrayBuffer"?qr=K5():qr=V.join(`
`)+`
`,V.length=0,await Rt({data:qr,value:ur})}),delete d.internal.pages[d.internal.pages.length-2],d.internal.pages.at(-1).length=0,H=!0},d.buildDocumentEnd=function(Ie="string"){H=!1,pKe(),B0(),Gc(),AU(),E$();var rt=L;_$(),O$(),B("startxref"),B(""+rt),B("%%EOF"),H=!0,ye.length=0;let Rt;return Ie==="arrayBuffer"?Rt=K5():Rt=V.join(`
`),V.length=0,Rt};for(var x$ in e.API)e.API.hasOwnProperty(x$)&&(x$==="events"&&e.API.events.length?(function(Ie,rt){var Rt,ur,qr;for(qr=rt.length-1;qr!==-1;qr--)Rt=rt[qr][0],ur=rt[qr][1],Ie.subscribe.apply(Ie,[Rt].concat(typeof ur=="function"?[ur]:ur))})(Wt,e.API.events):d[x$]=e.API[x$]);return d.internal={pdfEscape:OT,getStyle:v$,getFont:function(){return Vt[q5.apply(d,arguments)]},getFontSize:$,getCharSpace:cKe,getTextColor:lKe,getLineHeight:CAe,getLineHeightFactor:iKe,write:G,getHorizontalCoordinate:Ld,getVerticalCoordinate:Md,getCoordinateString:nKe,getVerticalCoordinateString:oKe,collections:{},newObject:Xe,newAdditionalObject:st,newObjectDeferred:ct,newObjectDeferredBegin:Me,getFilters:Oi,putStream:qi,events:Wt,scaleFactor:Fe,pageSize:{getWidth:function(){return(ye[W].mediaBox.topRightX-ye[W].mediaBox.bottomLeftX)/Fe},setWidth:function(Ie){ye[W].mediaBox.topRightX=Ie*Fe+ye[W].mediaBox.bottomLeftX},getHeight:function(){return(ye[W].mediaBox.topRightY-ye[W].mediaBox.bottomLeftY)/Fe},setHeight:function(Ie){ye[W].mediaBox.topRightY=Ie*Fe+ye[W].mediaBox.bottomLeftY}},output:Z$e,getNumberOfPages:S$,pages:z,out:B,f2:T,f3:I,getPageInfo:IAe,getPageInfoByObjId:J$e,getCurrentPageInfo:Q$e,getPDFVersion:m,hasHotfix:TAe},Object.defineProperty(d.internal.pageSize,"width",{get:function(){return(ye[W].mediaBox.topRightX-ye[W].mediaBox.bottomLeftX)/Fe},set:function(Ie){ye[W].mediaBox.topRightX=Ie*Fe+ye[W].mediaBox.bottomLeftX},enumerable:!0,configurable:!0}),Object.defineProperty(d.internal.pageSize,"height",{get:function(){return(ye[W].mediaBox.topRightY-ye[W].mediaBox.bottomLeftY)/Fe},set:function(Ie){ye[W].mediaBox.topRightY=Ie*Fe+ye[W].mediaBox.bottomLeftY},enumerable:!0,configurable:!0}),o9(n,r),Wt.publish("initialized"),d}return e.API={events:[]},e.version="0.0.0",e})(self),l$e=H2;(function(o,t){"use strict";var e=function(L){return L=L||{},this.isStrokeTransparent=L.isStrokeTransparent||!1,this.strokeOpacity=L.strokeOpacity||1,this.strokeStyle=L.strokeStyle||"#000000",this.fillStyle=L.fillStyle||"#000000",this.isFillTransparent=L.isFillTransparent||!1,this.fillOpacity=L.fillOpacity||1,this.font=L.font||"10px sans-serif",this.textBaseline=L.textBaseline||"alphabetic",this.textAlign=L.textAlign||"left",this.lineWidth=L.lineWidth||1,this.lineJoin=L.lineJoin||"miter",this.lineCap=L.lineCap||"butt",this.path=L.path||[],this.transform=typeof L.transform<"u"?L.transform.clone():new W,this.globalCompositeOperation=L.globalCompositeOperation||"normal",this.globalAlpha=L.globalAlpha||1,this.clip_path=L.clip_path||[],this.currentPoint=L.currentPoint||new z,this.miterLimit=L.miterLimit||10,this.lastPoint=L.lastPoint||new z,this.ignoreClearRect=typeof L.ignoreClearRect=="boolean"?L.ignoreClearRect:!0,this},r,i,n,s,a,l;o.events.push(["initialized",function(){this.context2d=new c(this),r=this.internal.f2,i=this.internal.f3,n=this.internal.getCoordinateString,s=this.internal.getVerticalCoordinateString,a=this.internal.getHorizontalCoordinate,l=this.internal.getVerticalCoordinate}]);var c=function(L){Object.defineProperty(this,"canvas",{get:function(){return{parentNode:!1,style:!1}}});var k=L;Object.defineProperty(this,"pdf",{get:function(){return L}});var N=!1;Object.defineProperty(this,"pageWrapXEnabled",{get:function(){return N},set:function(ce){N=!!ce}});var U=!1;Object.defineProperty(this,"pageWrapYEnabled",{get:function(){return U},set:function(ce){U=!!ce}});var B=0;Object.defineProperty(this,"posX",{get:function(){return B},set:function(ce){isNaN(ce)||(B=ce)}});var G=0;Object.defineProperty(this,"posY",{get:function(){return G},set:function(ce){isNaN(ce)||(G=ce)}});var Y=!1;Object.defineProperty(this,"autoPaging",{get:function(){return Y},set:function(ce){Y=!!ce}});var X=0;Object.defineProperty(this,"lastBreak",{get:function(){return X},set:function(ce){X=ce}});var K=[];Object.defineProperty(this,"pageBreaks",{get:function(){return K},set:function(ce){K=ce}});var J=new e;Object.defineProperty(this,"ctx",{get:function(){return J},set:function(ce){ce instanceof e&&(J=ce)}}),Object.defineProperty(this,"path",{get:function(){return J.path},set:function(ce){J.path=ce}});var se=[];Object.defineProperty(this,"ctxStack",{get:function(){return se},set:function(ce){se=ce}}),Object.defineProperty(this,"fillStyle",{get:function(){return this.ctx.fillStyle},set:function(ce){var te;te=h(ce),this.ctx.fillStyle=te.style,this.ctx.isFillTransparent=te.a===0,this.ctx.fillOpacity=te.a,this.pdf.setFillColor(te.r,te.g,te.b,{a:te.a}),this.pdf.setTextColor(te.r,te.g,te.b,{a:te.a})}}),Object.defineProperty(this,"strokeStyle",{get:function(){return this.ctx.strokeStyle},set:function(ce){var te=h(ce);this.ctx.strokeStyle=te.style,this.ctx.isStrokeTransparent=te.a===0,this.ctx.strokeOpacity=te.a,te.a===0?this.pdf.setDrawColor(255,255,255):te.a===1?this.pdf.setDrawColor(te.r,te.g,te.b):this.pdf.setDrawColor(te.r,te.g,te.b)}}),Object.defineProperty(this,"lineCap",{get:function(){return this.ctx.lineCap},set:function(ce){["butt","round","square"].indexOf(ce)!==-1&&(this.ctx.lineCap=ce,this.pdf.setLineCap(ce))}}),Object.defineProperty(this,"lineWidth",{get:function(){return this.ctx.lineWidth},set:function(ce){isNaN(ce)||(this.ctx.lineWidth=ce,this.pdf.setLineWidth(ce))}}),Object.defineProperty(this,"lineJoin",{get:function(){return this.ctx.lineJoin},set:function(ce){["bevel","round","miter"].indexOf(ce)!==-1&&(this.ctx.lineJoin=ce,this.pdf.setLineJoin(ce))}}),Object.defineProperty(this,"miterLimit",{get:function(){return this.ctx.miterLimit},set:function(ce){isNaN(ce)||(this.ctx.miterLimit=ce,this.pdf.setMiterLimit(ce))}}),Object.defineProperty(this,"textBaseline",{get:function(){return this.ctx.textBaseline},set:function(ce){this.ctx.textBaseline=ce}}),Object.defineProperty(this,"textAlign",{get:function(){return this.ctx.textAlign},set:function(ce){["right","end","center","left","start"].indexOf(ce)!==-1&&(this.ctx.textAlign=ce)}}),Object.defineProperty(this,"font",{get:function(){return this.ctx.font},set:function(ce){this.ctx.font=ce;var te,oe;if(te=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-_,\"\'\sa-z]+?)\s*$/i,oe=te.exec(ce),oe!==null)var $=oe[1],fe=oe[2],Oe=oe[3],Te=oe[4],ue=oe[5],be=oe[6];else return;ue==="px"?Te=Math.floor(parseFloat(Te)):ue==="em"?Te=Math.floor(parseFloat(Te)*this.pdf.getFontSize()):Te=Math.floor(parseFloat(Te)),this.pdf.setFontSize(Te);var j="";(Oe==="bold"||parseInt(Oe,10)>=700||$==="bold")&&(j="bold"),$==="italic"&&(j+="italic"),j.length===0&&(j="normal");for(var Z="",ie=be.toLowerCase().replace(/"|'/g,"").split(/\s*,\s*/),de={arial:"Helvetica",verdana:"Helvetica",helvetica:"Helvetica","sans-serif":"Helvetica",fixed:"Courier",monospace:"Courier",terminal:"Courier",courier:"Courier",times:"Times",cursive:"Times",fantasy:"Times",serif:"Times"},me=0;me<ie.length;me++)if(this.pdf.internal.getFont(ie[me],j,{noFallback:!0,disableWarning:!0})!==void 0){Z=ie[me];break}else if(j==="bolditalic"&&this.pdf.internal.getFont(ie[me],"bold",{noFallback:!0,disableWarning:!0})!==void 0)Z=ie[me],j="bold";else if(this.pdf.internal.getFont(ie[me],"normal",{noFallback:!0,disableWarning:!0})!==void 0){Z=ie[me],j="normal";break}if(Z===""){for(var me=0;me<ie.length;me++)if(de[ie[me]]){Z=de[ie[me]];break}}Z=Z===""?"Times":Z,this.pdf.setFont(Z,j)}}),Object.defineProperty(this,"globalCompositeOperation",{get:function(){return this.ctx.globalCompositeOperation},set:function(ce){this.ctx.globalCompositeOperation=ce}}),Object.defineProperty(this,"globalAlpha",{get:function(){return this.ctx.globalAlpha},set:function(ce){this.ctx.globalAlpha=ce}}),Object.defineProperty(this,"ignoreClearRect",{get:function(){return this.ctx.ignoreClearRect},set:function(ce){this.ctx.ignoreClearRect=!!ce}})};c.prototype.fill=function(){y.call(this,"fill",!1)},c.prototype.stroke=function(){y.call(this,"stroke",!1)},c.prototype.beginPath=function(){this.path=[{type:"begin"}]},c.prototype.moveTo=function(L,k){if(isNaN(L)||isNaN(k)){console.error("jsPDF.context2d.moveTo: Invalid arguments",arguments),console.warn("Invalid arguments passed to jsPDF.context2d.moveTo");return}var N=this.ctx.transform.applyToPoint(new z(L,k));this.path.push({type:"mt",x:N.x,y:N.y}),this.ctx.lastPoint=new z(L,k)},c.prototype.closePath=function(){this.path.push({type:"close"})},c.prototype.closeSubpath=function(){this.path.push({type:"h"})},c.prototype.lineTo=function(L,k){if(isNaN(L)||isNaN(k)){console.warn("Invalid arguments passed to jsPDF.context2d.lineTo");return}var N=this.ctx.transform.applyToPoint(new z(L,k));this.path.push({type:"lt",x:N.x,y:N.y}),this.ctx.lastPoint=new z(N.x,N.y)},c.prototype.clip=function(){this.ctx.clip_path=JSON.parse(JSON.stringify(this.path)),y.call(this,null,!0)},c.prototype.quadraticCurveTo=function(L,k,N,U){if(isNaN(N)||isNaN(U)||isNaN(L)||isNaN(k)){console.warn("Invalid arguments passed to jsPDF.context2d.quadraticCurveTo");return}var B=this.ctx.transform.applyToPoint(new z(N,U)),G=this.ctx.transform.applyToPoint(new z(L,k));this.path.push({type:"qct",x1:G.x,y1:G.y,x:B.x,y:B.y}),this.ctx.lastPoint=new z(B.x,B.y)},c.prototype.bezierCurveTo=function(L,k,N,U,B,G){if(isNaN(B)||isNaN(G)||isNaN(L)||isNaN(k)||isNaN(N)||isNaN(U)){console.warn("Invalid arguments passed to jsPDF.context2d.bezierCurveTo");return}var Y=this.ctx.transform.applyToPoint(new z(B,G)),X=this.ctx.transform.applyToPoint(new z(L,k)),K=this.ctx.transform.applyToPoint(new z(N,U));this.path.push({type:"bct",x1:X.x,y1:X.y,x2:K.x,y2:K.y,x:Y.x,y:Y.y}),this.ctx.lastPoint=new z(Y.x,Y.y)},c.prototype.arc=function(L,k,N,U,B,G,Y,X,K,J,se,ce){if(isNaN(B)||isNaN(G)||isNaN(Y)||isNaN(K)||isNaN(se)){console.warn("Invalid arguments passed to jsPDF.context2d.arc");return}if(ce=!!ce,!this.ctx.transform.isIdentity){var te=this.ctx.transform.applyToPoint(new z(B,G));B=te.x,G=te.y;var oe=this.ctx.transform.applyToPoint(new z(0,Y)),$=this.ctx.transform.applyToPoint(new z(0,0));Y=Math.sqrt(Math.pow(oe.x-$.x,2)+Math.pow(oe.y-$.y,2))}Math.abs(J)-Math.abs(K)>=2*Math.PI&&(K=0,J=2*Math.PI),se>=2*Math.PI&&(K=0,se=2*Math.PI),this.path.push({type:"arc",x:B,y:G,startX:L,startY:k,endX:N,endY:U,radius:Y,radius2:X,startAngle:K,endAngle:J,totalAngle:se,counterclockwise:ce})},c.prototype.rect=function(L,k,N,U){if(isNaN(L)||isNaN(k)||isNaN(N)||isNaN(U)){console.warn("Invalid arguments passed to jsPDF.context2d.rect");return}this.moveTo(L,k),this.lineTo(L+N,k),this.lineTo(L+N,k+U),this.lineTo(L,k+U),this.lineTo(L,k),this.lineTo(L+N,k),this.lineTo(L,k)},c.prototype.clearRect=function(L,k,N,U){if(isNaN(L)||isNaN(k)||isNaN(N)||isNaN(U)){console.warn("Invalid arguments passed to jsPDF.context2d.clearRect");return}this.ignoreClearRect||(this.fillStyle="#ffffff",this.fillRect(L,k,N,U))},c.prototype.save=function(L){L=typeof L=="boolean"?L:!0;for(var k=this.pdf.internal.getCurrentPageInfo().pageNumber,N=0;N<this.pdf.internal.getNumberOfPages();N++)this.pdf.setPage(N+1),this.pdf.internal.out("q");if(this.pdf.setPage(k),L){this.ctx.fontSize=this.pdf.internal.getFontSize();var U=new e(this.ctx);this.ctxStack.push(this.ctx),this.ctx=U}},c.prototype.restore=function(L){L=typeof L=="boolean"?L:!0;for(var k=this.pdf.internal.getCurrentPageInfo().pageNumber,N=0;N<this.pdf.internal.getNumberOfPages();N++)this.pdf.setPage(N+1),this.pdf.internal.out("Q");this.pdf.setPage(k),L&&this.ctxStack.length!==0&&(this.ctx=this.ctxStack.pop(),this.fillStyle=this.ctx.fillStyle,this.strokeStyle=this.ctx.strokeStyle,this.font=this.ctx.font,this.lineCap=this.ctx.lineCap,this.lineWidth=this.ctx.lineWidth,this.lineJoin=this.ctx.lineJoin)};var h=function(L){var k=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,N=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\s*\)/,U=/transparent|rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*0+\s*\)/,B,G,Y,X;if(L.isCanvasGradient===!0&&(L=L.getColor()),!L)return{r:0,g:0,b:0,a:0,style:L};if(U.test(L))B=0,G=0,Y=0,X=0;else{var K=k.exec(L);if(K!==null)B=parseInt(K[1]),G=parseInt(K[2]),Y=parseInt(K[3]),X=1;else if(K=N.exec(L),K!==null)B=parseInt(K[1]),G=parseInt(K[2]),Y=parseInt(K[3]),X=parseFloat(K[4]);else{if(X=1,typeof L=="string"&&L.charAt(0)!=="#"){var J=new RGBColor(L);J.ok?L=J.toHex():L="#000000"}L.length===4?(B=L.substring(1,2),B+=B,G=L.substring(2,3),G+=G,Y=L.substring(3,4),Y+=Y):(B=L.substring(1,3),G=L.substring(3,5),Y=L.substring(5,7)),B=parseInt(B,16),G=parseInt(G,16),Y=parseInt(Y,16)}}return{r:B,g:G,b:Y,a:X,style:L}},u=function(){return this.ctx.isFillTransparent||this.globalAlpha==0},d=function(){return!!(this.ctx.isStrokeTransparent||this.globalAlpha==0)};c.prototype.scale=function(L,k){if(isNaN(L)||isNaN(k)){console.warn("Invalid arguments passed to jsPDF.context2d.scale");return}var N=new W(L,0,0,k,0,0);this.ctx.transform=this.ctx.transform.multiply(N)},c.prototype.rotate=function(L){if(isNaN(L)){console.warn("Invalid arguments passed to jsPDF.context2d.rotate");return}var k=new W(Math.cos(L),Math.sin(L),-Math.sin(L),Math.cos(L),0,0);this.ctx.transform=this.ctx.transform.multiply(k)},c.prototype.translate=function(L,k){if(isNaN(L)||isNaN(k)){console.warn("Invalid arguments passed to jsPDF.context2d.translate");return}var N=new W(1,0,0,1,L,k);this.ctx.transform=this.ctx.transform.multiply(N)},c.prototype.transform=function(L,k,N,U,B,G){if(isNaN(L)||isNaN(k)||isNaN(N)||isNaN(U)||isNaN(B)||isNaN(G)){console.warn("Invalid arguments passed to jsPDF.context2d.transform");return}var Y=new W(L,k,N,U,B,G);this.ctx.transform=this.ctx.transform.multiply(Y)},c.prototype.setTransform=function(L,k,N,U,B,G){L=isNaN(L)?1:L,k=isNaN(k)?0:k,N=isNaN(N)?0:N,U=isNaN(U)?1:U,B=isNaN(B)?0:B,G=isNaN(G)?0:G,this.ctx.transform=new W(L,k,N,U,B,G)},c.prototype.drawImage=function(L,k,N,U,B,G,Y,X,K){var J=this.pdf.getImageProperties(L),se=1,ce=1,te=!1,oe=1,$=1,fe=1,Oe=1;typeof U<"u"&&typeof X<"u"&&(te=!0,oe=X/U,$=K/B,se=J.width/U*X/U,ce=J.height/B*K/B),typeof G>"u"&&(G=k,Y=N,k=0,N=0),typeof U<"u"&&typeof X>"u"&&(X=U,K=B),typeof U>"u"&&typeof X>"u"&&(X=J.width,K=J.height);var Te=this.ctx.transform.decompose(),ue=D(Te.rotate.shx);fe=Te.scale.sx,fe=Te.scale.sy;var be=new W;be=be.multiply(Te.translate),be=be.multiply(Te.skew),be=be.multiply(Te.scale);for(var j=be.applyToPoint(new z(X,K)),Z=be.applyToRectangle(new V(G-k*oe,Y-N*$,U*se,B*ce)),ie=p.call(this,Z),de=[],me=0;me<ie.length;me+=1)de.indexOf(ie[me])===-1&&de.push(ie[me]);de.sort();var Se;if(this.autoPaging)for(var Re=de[0],Je=de[de.length-1],Ke=Re;Ke<Je+1;Ke++){if(this.pdf.setPage(Ke),this.ctx.clip_path.length!==0){var Gt=this.path;Se=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=g(Se,this.posX,-1*this.pdf.internal.pageSize.height*(Ke-1)+this.posY),b.call(this,"fill",!0),this.path=Gt}var Nr=JSON.parse(JSON.stringify(Z));Nr=g([Nr],this.posX,-1*this.pdf.internal.pageSize.height*(Ke-1)+this.posY)[0],this.pdf.addImage(L,"jpg",Nr.x,Nr.y,Nr.w,Nr.h,null,null,ue)}else this.pdf.addImage(L,"jpg",Z.x,Z.y,Z.w,Z.h,null,null,ue)};var p=function(L,k,N){var U=[];switch(k=k||this.pdf.internal.pageSize.width,N=N||this.pdf.internal.pageSize.height,L.type){default:case"mt":case"lt":U.push(Math.floor((L.y+this.posY)/N)+1);break;case"arc":U.push(Math.floor((L.y+this.posY-L.radius)/N)+1),U.push(Math.floor((L.y+this.posY+L.radius)/N)+1);break;case"qct":var B=F(this.ctx.lastPoint.x,this.ctx.lastPoint.y,L.x1,L.y1,L.x,L.y);U.push(Math.floor(B.y/N)+1),U.push(Math.floor((B.y+B.h)/N)+1);break;case"bct":var G=H(this.ctx.lastPoint.x,this.ctx.lastPoint.y,L.x1,L.y1,L.x2,L.y2,L.x,L.y);U.push(Math.floor(G.y/N)+1),U.push(Math.floor((G.y+G.h)/N)+1);break;case"rect":U.push(Math.floor((L.y+this.posY)/N)+1),U.push(Math.floor((L.y+L.h+this.posY)/N)+1)}for(var Y=0;Y<U.length;Y+=1)for(;this.pdf.internal.getNumberOfPages()<U[Y];)m.call(this);return U},m=function(){var L=this.fillStyle,k=this.strokeStyle,N=this.font,U=this.lineCap,B=this.lineWidth,G=this.lineJoin;this.pdf.addPage(),this.fillStyle=L,this.strokeStyle=k,this.font=N,this.lineCap=U,this.lineWidth=B,this.lineJoin=G},g=function(L,k,N){for(var U=0;U<L.length;U++)switch(L[U].type){case"bct":L[U].x2+=k,L[U].y2+=N;case"qct":L[U].x1+=k,L[U].y1+=N;case"mt":case"lt":case"arc":default:L[U].x+=k,L[U].y+=N}return L},y=function(L,k){for(var N=this.fillStyle,U=this.strokeStyle,B=this.font,G=this.lineCap,Y=this.lineWidth,X=this.lineJoin,K=JSON.parse(JSON.stringify(this.path)),J=JSON.parse(JSON.stringify(this.path)),se,ce,te=[],oe=0;oe<J.length;oe++)if(typeof J[oe].x<"u")for(var $=p.call(this,J[oe]),fe=0;fe<$.length;fe+=1)te.indexOf($[fe])===-1&&te.push($[fe]);for(var oe=0;oe<te.length;oe++)for(;this.pdf.internal.getNumberOfPages()<te[oe];)m.call(this);if(te.sort(),this.autoPaging)for(var Oe=te[0],Te=te[te.length-1],oe=Oe;oe<Te+1;oe++){if(this.pdf.setPage(oe),this.fillStyle=N,this.strokeStyle=U,this.lineCap=G,this.lineWidth=Y,this.lineJoin=X,this.ctx.clip_path.length!==0){var ue=this.path;se=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=g(se,this.posX,-1*this.pdf.internal.pageSize.height*(oe-1)+this.posY),b.call(this,L,!0),this.path=ue}ce=JSON.parse(JSON.stringify(K)),this.path=g(ce,this.posX,-1*this.pdf.internal.pageSize.height*(oe-1)+this.posY),(k===!1||oe===0)&&b.call(this,L,k)}else b.call(this,L,k);this.path=K},b=function(L,k){if(!(L==="stroke"&&!k&&d.call(this))&&!(L!=="stroke"&&!k&&u.call(this))){var N=[],U=this.ctx.globalAlpha;this.ctx.fillOpacity<1&&(U=this.ctx.fillOpacity);for(var B=this.path,G=0;G<B.length;G++){var Y=B[G];switch(Y.type){case"begin":N.push({begin:!0});break;case"close":N.push({close:!0});break;case"mt":N.push({start:Y,deltas:[],abs:[]});break;case"lt":var X=N.length;if(!isNaN(B[G-1].x)){if(B[G-1].type==="arc")var $=[Y.x-B[G-1].endX,Y.y-B[G-1].endY];else var $=[Y.x-B[G-1].x,Y.y-B[G-1].y];if(X>0){for(X;X>=0;X--)if(N[X-1].close!==!0&&N[X-1].begin!==!0){N[X-1].deltas.push($),N[X-1].abs.push(Y);break}}}break;case"bct":var $=[Y.x1-B[G-1].x,Y.y1-B[G-1].y,Y.x2-B[G-1].x,Y.y2-B[G-1].y,Y.x-B[G-1].x,Y.y-B[G-1].y];N[N.length-1].deltas.push($);break;case"qct":var K=B[G-1].x+2/3*(Y.x1-B[G-1].x),J=B[G-1].y+2/3*(Y.y1-B[G-1].y),se=Y.x+2/3*(Y.x1-Y.x),ce=Y.y+2/3*(Y.y1-Y.y),te=Y.x,oe=Y.y,$=[K-B[G-1].x,J-B[G-1].y,se-B[G-1].x,ce-B[G-1].y,te-B[G-1].x,oe-B[G-1].y];N[N.length-1].deltas.push($);break;case"arc":N.push({deltas:[],abs:[],arc:!0}),Array.isArray(N[N.length-1].abs)&&N[N.length-1].abs.push(Y);break;case"h":N.push({closeSubpath:!0});break}}var fe;k?fe=null:L==="stroke"?fe="stroke":L==="fill"?fe="fill":fe="strokeFill";for(var G=0;G<N.length;G++){if(N[G].closeSubpath){this.pdf.internal.out("h");continue}if(N[G].arc)for(var Oe=N[G].abs,Te=0;Te<Oe.length;Te++){var ue=Oe[Te];if(typeof ue.startAngle<"u"){var be=D(ue.startAngle),j=D(ue.totalAngle),Z=ue.x,ie=ue.y;P.call(this,Z,ie,ue.radius,ue.radius2,be,j,ue.counterclockwise,null,k)}else N[G].deltas[Te-1]&&E.call(this,ue.x-N[G].deltas[Te-1][0],ue.y-N[G].deltas[Te-1][1]),E.call(this,ue.x,ue.y)}if(!N[G].arc&&N[G].close!==!0&&N[G].begin!==!0){var Z=N[G].start.x,ie=N[G].start.y;O.call(this,N[G].deltas,Z,ie,null,null)}}fe&&T.call(this,fe),k&&I.call(this)}};c.prototype.drawPaths=b;var P=function(L,k,N,U,B,G,Y,X,K){for(var J=!1,se=this.pdf.internal.scaleFactor,ce=w(B),te=w(G),oe=x.call(this,N,U,ce,te,Y),$=null,fe=0;fe<oe.length;fe++){var Oe=oe[fe];J&&fe===0&&C.call(this,Oe.x1+L,Oe.y1+k),_.call(this,L,k,Oe.x2,Oe.y2,Oe.x3,Oe.y3,Oe.x4,Oe.y4)}K?I.call(this):T.call(this,X)},T=function(L){switch(L){case"stroke":this.pdf.internal.out("S");break;case"fill":this.pdf.internal.out("f");break;case"strokeFill":this.pdf.internal.out("B");break}},I=function(){this.pdf.clip()},C=function(L,k){this.pdf.internal.out(n(L)+" "+s(k)+" m")},E=function(L,k,N,U){N=N||0,U=U||0,this.pdf.internal.out(n(L+N)+" "+s(k+U)+" l")},O=function(L,k,N){return this.pdf.lines(L,k,N,null,null)},_=function(L,k,N,U,B,G,Y,X){this.pdf.internal.out([r(a(N+L)),r(l(U+k)),r(a(B+L)),r(l(G+k)),r(a(Y+L)),r(l(X+k)),"c"].join(" "))},x=function(L,k,N,U,B){var G=1e-5,Y=Math.PI*2,X=N;(X<Y||X>Y)&&(X=X%Y);var K=U;(K<Y||K>Y)&&(K=K%Y);for(var J=[],se=Math.PI/2,ce=B?-1:1,te=N,oe=Math.min(Y,K);oe>G;){var $=te+ce*Math.min(oe,se);J.push(v.call(this,L,k,te,$)),oe-=Math.abs($-te),te=$}return J},v=function(L,k,N,U){var B=(U-N)/2,G=L/k,Y=k*Math.cos(B),X=k*Math.sin(B),K=Y,J=-X,se=K*K+J*J,ce=se+K*Y+J*X,te=4/3*(Math.sqrt(2*se*ce)-ce)/(K*X-J*Y),oe=K-te*J,$=J+te*K,fe=oe,Oe=-$,Te=B+N,ue=Math.cos(Te),be=Math.sin(Te),j={x1:L*Math.cos(N),y1:k*Math.sin(N),x2:oe*ue-$*be,y2:oe*be+$*ue,x3:fe*ue-Oe*be,y3:fe*be+Oe*ue,x4:L*Math.cos(U),y4:k*Math.sin(U)};return j.x2*=G,j.x3*=G,j},D=function(L){return L*180/Math.PI},w=function(L){return L*Math.PI/180},F=function(L,k,N,U,B,G){var Y=L+(N-L)*.5,X=k+(U-k)*.5,K=B+(N-B)*.5,J=G+(U-G)*.5,se=Math.min(L,B,Y,K),ce=Math.max(L,B,Y,K),te=Math.min(k,G,X,J),oe=Math.max(k,G,X,J);return new V(se,te,ce-se,oe-te)},H=function(L,k,N,U,B,G,Y,X){for(var K=N-L,J=U-k,se=B-N,ce=G-U,te=Y-B,oe=X-G,$=40,fe,Oe,Te,ue,be,j,Z,ie,de,me,Se,Re,Je,Fe,Ke,Gt,Nr,xr,vr,_r,Ne,Vt,Ft,ir,Fe=0;Fe<$+1;Fe++)fe=Fe/$,Oe=L+fe*K,Te=k+fe*J,ue=N+fe*se,be=U+fe*ce,j=B+fe*te,Z=G+fe*oe,vr=ue-Oe,_r=be-Te,Ne=j-ue,Vt=Z-be,me=Oe+fe*vr,Se=Te+fe*_r,ie=ue+fe*Ne,de=be+fe*Vt,Ft=ie-me,ir=de-Se,Re=me+fe*Ft,Je=Se+fe*ir,Fe==0?(Ke=Re,Gt=Je,Nr=Re,xr=Je):(Ke=Math.min(Ke,Re),Gt=Math.min(Gt,Je),Nr=Math.max(Nr,Re),xr=Math.max(xr,Je));return new V(Math.round(Ke),Math.round(Gt),Math.round(Nr-Ke),Math.round(xr-Gt))},z=function(L,k){var N=L||0;Object.defineProperty(this,"x",{enumerable:!0,get:function(){return N},set:function(G){isNaN(G)||(N=parseFloat(G))}});var U=k||0;Object.defineProperty(this,"y",{enumerable:!0,get:function(){return U},set:function(G){isNaN(G)||(U=parseFloat(G))}});var B="pt";return Object.defineProperty(this,"type",{enumerable:!0,get:function(){return B},set:function(G){B=G.toString()}}),this},V=function(L,k,N,U){z.call(this,L,k),this.type="rect";var B=N||0;Object.defineProperty(this,"w",{enumerable:!0,get:function(){return B},set:function(Y){isNaN(Y)||(B=parseFloat(Y))}});var G=U||0;return Object.defineProperty(this,"h",{enumerable:!0,get:function(){return G},set:function(Y){isNaN(Y)||(G=parseFloat(Y))}}),this},W=function(L,k,N,U,B,G){var Y=[];return Object.defineProperty(this,"sx",{get:function(){return Y[0]},set:function(X){Y[0]=Math.round(X*1e5)/1e5}}),Object.defineProperty(this,"shy",{get:function(){return Y[1]},set:function(X){Y[1]=Math.round(X*1e5)/1e5}}),Object.defineProperty(this,"shx",{get:function(){return Y[2]},set:function(X){Y[2]=Math.round(X*1e5)/1e5}}),Object.defineProperty(this,"sy",{get:function(){return Y[3]},set:function(X){Y[3]=Math.round(X*1e5)/1e5}}),Object.defineProperty(this,"tx",{get:function(){return Y[4]},set:function(X){Y[4]=Math.round(X*1e5)/1e5}}),Object.defineProperty(this,"ty",{get:function(){return Y[5]},set:function(X){Y[5]=Math.round(X*1e5)/1e5}}),Object.defineProperty(this,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(this,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(this,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(this,"isIdentity",{get:function(){return!(this.sx!==1||this.shy!==0||this.shx!==0||this.sy!==1||this.tx!==0||this.ty!==0)}}),this.sx=isNaN(L)?1:L,this.shy=isNaN(k)?0:k,this.shx=isNaN(N)?0:N,this.sy=isNaN(U)?1:U,this.tx=isNaN(B)?0:B,this.ty=isNaN(G)?0:G,this};W.prototype.multiply=function(L){var k=L.sx*this.sx+L.shy*this.shx,N=L.sx*this.shy+L.shy*this.sy,U=L.shx*this.sx+L.sy*this.shx,B=L.shx*this.shy+L.sy*this.sy,G=L.tx*this.sx+L.ty*this.shx+this.tx,Y=L.tx*this.shy+L.ty*this.sy+this.ty;return new W(k,N,U,B,G,Y)},W.prototype.decompose=function(){var L=this.sx,k=this.shy,N=this.shx,U=this.sy,B=this.tx,G=this.ty,Y=Math.sqrt(L*L+k*k);L/=Y,k/=Y;var X=L*N+k*U;N-=L*X,U-=k*X;var K=Math.sqrt(N*N+U*U);return N/=K,U/=K,X/=K,L*U<k*N&&(L=-L,k=-k,X=-X,Y=-Y),{scale:new W(Y,0,0,K,0,0),translate:new W(1,0,0,1,B,G),rotate:new W(L,k,-k,L,0,0),skew:new W(1,0,X,1,0,0)}},W.prototype.applyToPoint=function(L){var k=L.x*this.sx+L.y*this.shx+this.tx,N=L.x*this.shy+L.y*this.sy+this.ty;return new z(k,N)},W.prototype.applyToRectangle=function(L){var k=this.applyToPoint(L),N=this.applyToPoint(new z(L.x+L.w,L.y+L.h));return new V(k.x,k.y,N.x-k.x,N.y-k.y)},W.prototype.clone=function(){var L=this.sx,k=this.shy,N=this.shx,U=this.sy,B=this.tx,G=this.ty;return new W(L,k,N,U,B,G)}})(H2.API,typeof self<"u"&&self||typeof window<"u"&&window||typeof global<"u"&&global||Function('return typeof this === "object" && this.content')()||Function("return this")()),(function(o,t){"use strict";var e=o.API,r=e.stringToHex=function(c){for(var h="",u=0;u<c.length;u++){var d=""+c.charCodeAt(u).toString(16);d.length===3?d="0"+d:d.length===2&&(d="00"+d),h+=d}return h},i=e.pdfEscape16=function(c,h){for(var u=h.metadata.Unicode.widths,d=["","0","00","000","0000"],p=[""],m=0,g=c.length,y;m<g;++m){if(y=h.metadata.characterToGlyph(c.charCodeAt(m)),h.metadata.glyIdsUsed.push(y),h.metadata.toUnicode[y]=c.charCodeAt(m),u.indexOf(y)==-1&&(u.push(y),u.push([parseInt(h.metadata.widthOfGlyph(y),10)])),y=="0")return p.join("");y=y.toString(16),p.push(d[4-y.length],y)}return p.join("")},n=function(c,h,u,d){if(c&&c.metadata&&!c.isStandardFont&&c.encoding!="WinAnsiEncoding"&&KD[c.fontName.split(",")[0]]){var p=u();h("<<"),h("/Type /FontDescriptor"),h("/FontName /"+c.fontName),h("/FontBBox ["+c.metadata.bbox+"]"),h("/Flags "+c.metadata.flags),h("/StemV "+c.metadata.stemV),h("/ItalicAngle "+c.metadata.italicAngle),h("/Ascent "+c.metadata.ascender),h("/Descent "+c.metadata.decender),h("/CapHeight "+c.metadata.capHeight),h(">>"),h("endobj");var m=u();h("<<"),h("/Type /Font"),h("/BaseFont /"+c.fontName),h("/FontDescriptor "+p+" 0 R"),h("/W ["+c.metadata.widths+"]"),h("/Subtype /CIDFontType2"),h("/CIDSystemInfo"),h("<<"),h("/Ordering ("+c.metadata.ordering+")"),h("/Registry ("+c.metadata.registry+")"),h("/Supplement "+c.metadata.supplement),h(">>"),h(">>"),h("endobj"),c.objectNumber=u(),h("<<"),h("/Type /Font"),h("/Subtype /Type0"),h("/BaseFont /"+c.fontName),h("/Encoding /"+c.encoding),h("/DescendantFonts ["+m+" 0 R]"),h(">>"),h("endobj"),c.isAlreadyPutted=!0}};e.events.push(["putFont",function(c){n(c.font,c.out,c.newObject,c.putStream)}]);var s=function(c,h,u,d){if(!c.isStandardFont&&c.encoding==="WinAnsiEncoding"){var p=u();h("<<"),h("/Descent "+c.metadata.decender),h("/CapHeight "+c.metadata.capHeight),h("/StemV "+c.metadata.stemV),h("/Type /FontDescriptor"),h("/Flags "+c.metadata.flags),h("/FontBBox ["+c.metadata.bbox+"]"),h("/FontName /"+c.fontName),h("/ItalicAngle "+c.metadata.italicAngle),h("/Ascent "+c.metadata.ascender),h(">>"),h("endobj"),c.objectNumber=u(),h("<</Subtype/TrueType/Type/Font/BaseFont/"+c.fontName+"/FontDescriptor "+p+" 0 R/Encoding/"+c.encoding+" /FirstChar 32 /LastChar 255 /Widths ["+c.metadata.widths+"]>>"),h("endobj"),c.isAlreadyPutted=!0}};e.events.push(["putFont",function(c){s(c.font,c.out,c.newObject,c.putStream)}]);var a=function(c){var h=c.text||"",u=c.x,d=c.y,p=c.options||{},m,g=c.mutex||{},y=g.pdfEscape,b=g.activeFontKey,P=g.fonts,z,T=0,I=g.activeFontSize,C=0,E,O="",_=0,x=0,v,D,w,F="",H,z=b,V=P[z].encoding;if(P[z].encoding!=="Identity-H"&&P[z].encoding!=="UniGB-UCS2-H")return h=h.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)"),{text:h,x:u,y:d,options:p,mutex:g};var W=0;for(F=h,z=H?getFont(H.font,H.fontStyle):b,Object.prototype.toString.call(h)==="[object Array]"&&(F=h[0]),x=0;x<F.length;x+=1)O+=F[x];var L="";return parseInt(z.slice(1))<14||V==="WinAnsiEncoding"?L=r(O):V==="Identity-H"&&(L=i(O,P[z])),g.isHex=!0,{text:L,x:u,y:d,options:p,mutex:g}},l=function(c){var h=c.text||"",u=c.x,d=c.y,p=c.options,m=c.mutex,g=p.lang,y=[],b,P={text:h,x:u,y:d,options:p,mutex:m};if(Object.prototype.toString.call(h)==="[object Array]"){var T=0;for(T=0;T<h.length;T+=1)Object.prototype.toString.call(h[T])==="[object Array]"?h[T].length===3?y.push([a(Object.assign({},P,{text:h[T][0]})).text,h[T][1],h[T][2]]):y.push(a(Object.assign({},P,{text:h[T]})).text):y.push(a(Object.assign({},P,{text:h[T]})).text);c.text=y}else c.text=a(Object.assign({},P,{text:h})).text};e.events.push(["postProcessText",l])})(H2,typeof self<"u"&&self||typeof global<"u"&&global||typeof window<"u"&&window||Function("return this")()),(function(o){"use strict";var t="addImage_",e={PNG:[[137,80,78,71]],TIFF:[[77,77,0,42],[73,73,42,0]],JPEG:[[255,216,255,224,void 0,void 0,74,70,73,70,0],[255,216,255,225,void 0,void 0,69,120,105,102,0,0]],JPEG2000:[[0,0,0,12,106,80,32,32]],GIF87a:[[71,73,70,56,55,97]],GIF89a:[[71,73,70,56,57,97]],BMP:[[66,77],[66,65],[67,73],[67,80],[73,67],[80,84]]},r=o.getImageFileTypeByImageData=function(C,E){E=E||"UNKNOWN";var O,_,x="UNKNOWN",v,D,w;o.isArrayBufferView(C)&&(C=o.arrayBufferToBinaryString(C));for(w in e)for(v=e[w],O=0;O<v.length;O+=1){for(D=!0,_=0;_<v[O].length;_+=1)if(v[O][_]!==void 0&&v[O][_]!==C.charCodeAt(_)){D=!1;break}if(D===!0){x=w;break}}return x==="UNKNOWN"&&E!=="UNKNOWN"&&(console.warn('FileType of Image not recognized. Processing image as "'+E+'".'),x=E),x},i=function(C){for(var E=this.internal.newObject(),O=this.internal.write,_=this.internal.putStream,x=this.internal.getFilters,v=x();v.indexOf("FlateEncode")!==-1;)v.splice(v.indexOf("FlateEncode"),1);C.n=E;var D=[];if(D.push({key:"Type",value:"/XObject"}),D.push({key:"Subtype",value:"/Image"}),D.push({key:"Width",value:C.w}),D.push({key:"Height",value:C.h}),C.cs===this.color_spaces.INDEXED?D.push({key:"ColorSpace",value:"[/Indexed /DeviceRGB "+(C.pal.length/3-1)+" "+("smask"in C?E+2:E+1)+" 0 R]"}):(D.push({key:"ColorSpace",value:"/"+C.cs}),C.cs===this.color_spaces.DEVICE_CMYK&&D.push({key:"Decode",value:"[1 0 1 0 1 0 1 0]"})),D.push({key:"BitsPerComponent",value:C.bpc}),"dp"in C&&D.push({key:"DecodeParms",value:"<<"+C.dp+">>"}),"trns"in C&&C.trns.constructor==Array){for(var w="",F=0,H=C.trns.length;F<H;F++)w+=C.trns[F]+" "+C.trns[F]+" ";D.push({key:"Mask",value:"["+w+"]"})}"smask"in C&&D.push({key:"SMask",value:E+1+" 0 R"});var z=typeof C.f<"u"?["/"+C.f]:void 0;if(_({data:C.data,additionalKeyValues:D,alreadyAppliedFilters:z}),O("endobj"),"smask"in C){var V="/Predictor "+C.p+" /Colors 1 /BitsPerComponent "+C.bpc+" /Columns "+C.w,W={w:C.w,h:C.h,cs:"DeviceGray",bpc:C.bpc,dp:V,data:C.smask};"f"in C&&(W.f=C.f),i.call(this,W)}C.cs===this.color_spaces.INDEXED&&(this.internal.newObject(),_({data:this.arrayBufferToBinaryString(new Uint8Array(C.pal))}),O("endobj"))},n=function(){var C=this.internal.collections[t+"images"];for(var E in C)i.call(this,C[E])},s=function(){var C=this.internal.collections[t+"images"],E=this.internal.write,O;for(var _ in C)O=C[_],E("/I"+O.i,O.n,"0","R")},a=function(C){return C&&typeof C=="string"&&(C=C.toUpperCase()),C in o.image_compression?C:o.image_compression.NONE},l=function(){var C=this.internal.collections[t+"images"];return C||(this.internal.collections[t+"images"]=C={},this.internal.events.subscribe("putResources",n),this.internal.events.subscribe("putXobjectDict",s)),C},c=function(C){var E=0;return C&&(E=Object.keys?Object.keys(C).length:(function(O){var _=0;for(var x in O)O.hasOwnProperty(x)&&_++;return _})(C)),E},h=function(C){return typeof C>"u"||C===null||C.length===0},u=function(C){return typeof C=="string"?o.sHashCode(C):o.isArrayBufferView(C)?o.sHashCode(o.arrayBufferToBinaryString(C)):null},d=function(C){return typeof o["process"+C.toUpperCase()]=="function"},p=function(C){return typeof C=="object"&&C.nodeType===1},m=function(C,E){if(C.nodeName==="IMG"&&C.hasAttribute("src")){var O=""+C.getAttribute("src");if(O.indexOf("data:image/")===0)return unescape(O)}if(C.nodeName==="CANVAS"){var _=C;return C.toDataURL("image/jpeg",1)}var _=document.createElement("canvas");_.width=C.clientWidth||C.width,_.height=C.clientHeight||C.height;var x=_.getContext("2d");if(!x)throw"addImage requires canvas to be supported by browser.";return x.drawImage(C,0,0,_.width,_.height),_.toDataURL((""+E).toLowerCase()=="png"?"image/png":"image/jpeg")},g=function(C,E){var O;if(E){for(var _ in E)if(C===E[_].alias){O=E[_];break}}return O},y=function(C,E,O){return!C&&!E&&(C=-96,E=-96),C<0&&(C=-1*O.w*72/C/this.internal.scaleFactor),E<0&&(E=-1*O.h*72/E/this.internal.scaleFactor),C===0&&(C=E*O.w/O.h),E===0&&(E=C*O.h/O.w),[C,E]},b=function(C,E,O,_,x,v,D,w=0,F,H){var z=y.call(this,O,_,x),V=this.internal.getCoordinateString,W=this.internal.getVerticalCoordinateString;O=z[0],_=z[1],D[v]=x,w*=Math.PI/180;var L=Math.cos(w),k=Math.sin(w),N=function(Y){return Y.toFixed(4)},U=[N(L),N(k),N(k*-1),N(L),0,0,"cm"];this.internal.write("q");let B=F==="top"?N(k)*_:0,G=F==="top"?(1-N(L))*_:0;this.internal.write([1,"0","0",1,V(C),W(E+_),"cm"].join(" ")),H&&this.internal.write([-1,"0","0",1,"0","0","cm"].join(" ")),this.internal.write(U.join(" ")),this.internal.write([1,"0","0",1,V(B),V(-G),"cm"].join(" ")),this.internal.write([V(O),"0","0",V(_),"0","0","cm"].join(" ")),this.internal.write("/I"+x.i+" Do"),this.internal.write("Q")};o.color_spaces={DEVICE_RGB:"DeviceRGB",DEVICE_GRAY:"DeviceGray",DEVICE_CMYK:"DeviceCMYK",CAL_GREY:"CalGray",CAL_RGB:"CalRGB",LAB:"Lab",ICC_BASED:"ICCBased",INDEXED:"Indexed",PATTERN:"Pattern",SEPARATION:"Separation",DEVICE_N:"DeviceN"},o.decode={DCT_DECODE:"DCTDecode",FLATE_DECODE:"FlateDecode",LZW_DECODE:"LZWDecode",JPX_DECODE:"JPXDecode",JBIG2_DECODE:"JBIG2Decode",ASCII85_DECODE:"ASCII85Decode",ASCII_HEX_DECODE:"ASCIIHexDecode",RUN_LENGTH_DECODE:"RunLengthDecode",CCITT_FAX_DECODE:"CCITTFaxDecode"},o.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},o.sHashCode=function(C){C=C||"";var E=0,O,_;if(C.length===0)return E;for(O=0;O<C.length;O++)_=C.charCodeAt(O),E=(E<<5)-E+_,E|=0;return E},o.isString=function(C){return typeof C=="string"},o.validateStringAsBase64=function(C){C=C||"",C.toString().trim();var E=!0;return C.length===0&&(E=!1),C.length%4!==0&&(E=!1),/^[A-Za-z0-9+\/]+$/.test(C.substr(0,C.length-2))===!1&&(E=!1),/^[A-Za-z0-9\/][A-Za-z0-9+\/]|[A-Za-z0-9+\/]=|==$/.test(C.substr(-2))===!1&&(E=!1),E},o.extractInfoFromBase64DataURI=function(C){return/^data:([\w]+?\/([\w\+]+?));\S*;*base64,(.+)$/g.exec(C)},o.extractImageFromDataUrl=function(C){C=C||"";var E=C.split("base64,"),O=null;if(E.length===2){var _=/^data:(\w*\/\w*);*(charset=[\w=-]*)*;*$/.exec(E[0]);Array.isArray(_)&&(O={mimeType:_[1],charset:_[2],data:E[1]})}return O},o.supportsArrayBuffer=function(){return typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"},o.isArrayBuffer=function(C){return this.supportsArrayBuffer()?C instanceof ArrayBuffer:!1},o.isArrayBufferView=function(C){return!this.supportsArrayBuffer()||typeof Uint32Array>"u"?!1:C instanceof Int8Array||C instanceof Uint8Array||typeof Uint8ClampedArray<"u"&&C instanceof Uint8ClampedArray||C instanceof Int16Array||C instanceof Uint16Array||C instanceof Int32Array||C instanceof Uint32Array||C instanceof Float32Array||C instanceof Float64Array},o.binaryStringToUint8Array=function(C){for(var E=C.length,O=new Uint8Array(E),_=0;_<E;_++)O[_]=C.charCodeAt(_);return O},o.arrayBufferToBinaryString=function(C){if(typeof atob=="function")return atob(this.arrayBufferToBase64(C))},o.arrayBufferToBase64=function(C){for(var E="",O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_=new Uint8Array(C),x=_.byteLength,v=x%3,D=x-v,w,F,H,z,V,W=0;W<D;W=W+3)V=_[W]<<16|_[W+1]<<8|_[W+2],w=(V&16515072)>>18,F=(V&258048)>>12,H=(V&4032)>>6,z=V&63,E+=O[w]+O[F]+O[H]+O[z];return v==1?(V=_[D],w=(V&252)>>2,F=(V&3)<<4,E+=O[w]+O[F]+"=="):v==2&&(V=_[D]<<8|_[D+1],w=(V&64512)>>10,F=(V&1008)>>4,H=(V&15)<<2,E+=O[w]+O[F]+O[H]+"="),E},o.createImageInfo=function(C,E,O,_,x,v,D,w,F,H,z,V,W){var L={alias:w,w:E,h:O,cs:_,bpc:x,i:D,data:C};return v&&(L.f=v),F&&(L.dp=F),H&&(L.trns=H),z&&(L.pal=z),V&&(L.smask=V),W&&(L.p=W),L},o.addImage=function(C,E,O,_,x,v,D,w,F,H,z){"use strict";var V="";if(typeof E!="string"){var W=v;v=x,x=_,_=O,O=E,E=W}if(typeof C=="object"&&!p(C)&&"imageData"in C){var L=C;C=L.imageData,E=L.format||E||"UNKNOWN",O=L.x||O||0,_=L.y||_||0,x=L.w||x,v=L.h||v,D=L.alias||D,w=L.compression||w,F=L.rotation||L.angle||F}var k=this.internal.getFilters();if(w===void 0&&k.indexOf("FlateEncode")!==-1&&(w="SLOW"),typeof C=="string"&&(C=unescape(C)),isNaN(O)||isNaN(_))return console.warn("Invalid coordinates passed to jsPDF.addImage"),this;var N=l.call(this),U,B;if(!(U=g(C,N))&&(p(C)&&(C=m(C,E)),h(D)&&(D=u(C)),!(U=g(D,N)))){if(this.isString(C))if(V=this.convertStringToImageData(C),V!=="")C=V;else return console.warn("tmpImageData is empty."),this;if(E=this.getImageFileTypeByImageData(C,E),!d(E))return console.warn("addImage does not support files of type '"+E+"', please ensure that a plugin for '"+E+"' support is added."),this;if(this.supportsArrayBuffer()&&(C instanceof Uint8Array||(B=C,C=this.binaryStringToUint8Array(C))),U=this["process"+E.toUpperCase()](C,c(N),D,a(w),B),!U)return console.warn("An unknown error occurred whilst processing the image"),this}return b.call(this,O,_,x,v,U,U.i,N,F,H,z),this},o.convertStringToImageData=function(C){var E,O="",_;if(this.isString(C)){var E=this.extractImageFromDataUrl(C);_=E!==null?E.data:C;try{O=atob(_)}catch(v){return o.validateStringAsBase64(_)?console.warn("atob-Error in jsPDF.convertStringToImageData "+v.message):console.warn("Supplied Data is not a valid base64-String jsPDF.convertStringToImageData "),""}}return O};var P=function(C){"use strict";var E,O,_;if(r(C)!=="JPEG")throw new Error("getJpegSize requires a binary string jpeg file");for(var x=C.charCodeAt(4)*256+C.charCodeAt(5),v=4,D=C.length;v<D;){if(v+=x,C.charCodeAt(v)!==255)throw new Error("getJpegSize could not find the size of the image");if(C.charCodeAt(v+1)===192||C.charCodeAt(v+1)===193||C.charCodeAt(v+1)===194||C.charCodeAt(v+1)===195||C.charCodeAt(v+1)===196||C.charCodeAt(v+1)===197||C.charCodeAt(v+1)===198||C.charCodeAt(v+1)===199)return O=C.charCodeAt(v+5)*256+C.charCodeAt(v+6),E=C.charCodeAt(v+7)*256+C.charCodeAt(v+8),_=C.charCodeAt(v+9),[E,O,_];v+=2,x=C.charCodeAt(v)*256+C.charCodeAt(v+1)}},T=function(C){var E=C[0]<<8|C[1];if(E!==65496)throw new Error("Supplied data is not a JPEG");for(var O=C.length,_=(C[4]<<8)+C[5],x=4,v,D,w,F;x<O;){if(x+=_,v=I(C,x),_=(v[2]<<8)+v[3],(v[1]===192||v[1]===194)&&v[0]===255&&_>7)return v=I(C,x+5),D=(v[2]<<8)+v[3],w=(v[0]<<8)+v[1],F=v[4],{width:D,height:w,numcomponents:F};x+=2}throw new Error("getJpegSizeFromBytes could not find the size of the image")},I=function(C,E){return C.subarray(E,E+5)};o.processJPEG=function(C,E,O,_,x,v){"use strict";var D=this.decode.DCT_DECODE,w=8,F;if(!this.isString(C)&&!this.isArrayBuffer(C)&&!this.isArrayBufferView(C))return null;if(this.isString(C)&&(F=P(C)),this.isArrayBuffer(C)&&(C=new Uint8Array(C)),this.isArrayBufferView(C)&&(F=T(C),C=x||this.arrayBufferToBinaryString(C)),v===void 0)switch(F.numcomponents){case 1:v=this.color_spaces.DEVICE_GRAY;break;case 4:v=this.color_spaces.DEVICE_CMYK;break;default:case 3:v=this.color_spaces.DEVICE_RGB;break}return this.createImageInfo(C,F.width,F.height,v,w,D,E,O)},o.processJPG=function(){return this.processJPEG.apply(this,arguments)},o.getImageProperties=function(C){var E,O="",_,x;if(p(C)&&(C=m(C)),this.isString(C)&&(O=this.convertStringToImageData(C),O!==""&&(C=O)),_=this.getImageFileTypeByImageData(C),!d(_))throw new Error("addImage does not support files of type '"+_+"', please ensure that a plugin for '"+_+"' support is added.");if(this.supportsArrayBuffer()&&(C instanceof Uint8Array||(x=C,C=this.binaryStringToUint8Array(C))),E=this["process"+_.toUpperCase()](C),!E)throw new Error("An unknown error occurred whilst processing the image");return{fileType:_,width:E.w,height:E.h,colorSpace:E.cs,compressionMode:E.f,bitsPerComponent:E.bpc}}})(H2.API),(function(o){"use strict";var t=function(){return typeof t$e!="function"||typeof a$e!="function"},e=function(P){return P!==o.image_compression.NONE&&r()},r=function(){var P=typeof dAe=="function";if(!P)throw new Error("requires deflate.js for compression");return P},i=function(P,T,I,C){var E=5,O=h;switch(C){case o.image_compression.FAST:E=3,O=c;break;case o.image_compression.MEDIUM:E=6,O=u;break;case o.image_compression.SLOW:E=9,O=d;break}P=a(P,T,I,O);var _=new Uint8Array(n(E)),x=s(P),v=new dAe(E),D=v.append(P),w=v.flush(),F=_.length+D.length+w.length,H=new Uint8Array(F+4);return H.set(_),H.set(D,_.length),H.set(w,_.length+D.length),H[F++]=x>>>24&255,H[F++]=x>>>16&255,H[F++]=x>>>8&255,H[F++]=x&255,o.arrayBufferToBinaryString(H)},n=function(P,T){var I=8,C=Math.LOG2E*Math.log(32768)-8,E=C<<4|I,O=E<<8,_=Math.min(3,(T-1&255)>>1);return O|=_<<6,O|=0,O+=31-O%31,[E,O&255&255]},s=function(P,T){for(var I=1,C=I&65535,E=I>>>16&65535,O=P.length,_,x=0;O>0;){_=O>T?T:O,O-=_;do C+=P[x++],E+=C;while(--_);C%=65521,E%=65521}return(E<<16|C)>>>0},a=function(P,T,I,C){for(var E=P.length/T,O=new Uint8Array(P.length+E),_=m(),x=0,v,D,w;x<E;x++){if(w=x*T,v=P.subarray(w,w+T),C)O.set(C(v,I,D),w+x);else{for(var F=0,H=_.length,z=[];F<H;F++)z[F]=_[F](v,I,D);var V=g(z.concat());O.set(z[V],w+x)}D=v}return O},l=function(P,T,I){var C=Array.apply([],P);return C.unshift(0),C},c=function(P,T,I){var C=[],E=0,O=P.length,_;for(C[0]=1;E<O;E++)_=P[E-T]||0,C[E+1]=P[E]-_+256&255;return C},h=function(P,T,I){var C=[],E=0,O=P.length,_;for(C[0]=2;E<O;E++)_=I&&I[E]||0,C[E+1]=P[E]-_+256&255;return C},u=function(P,T,I){var C=[],E=0,O=P.length,_,x;for(C[0]=3;E<O;E++)_=P[E-T]||0,x=I&&I[E]||0,C[E+1]=P[E]+256-(_+x>>>1)&255;return C},d=function(P,T,I){var C=[],E=0,O=P.length,_,x,v,D;for(C[0]=4;E<O;E++)_=P[E-T]||0,x=I&&I[E]||0,v=I&&I[E-T]||0,D=p(_,x,v),C[E+1]=P[E]-D+256&255;return C},p=function(P,T,I){var C=P+T-I,E=Math.abs(C-P),O=Math.abs(C-T),_=Math.abs(C-I);return E<=O&&E<=_?P:O<=_?T:I},m=function(){return[l,c,h,u,d]},g=function(P){for(var T=0,I=P.length,C,E,O;T<I;)C=y(P[T].slice(1)),(C<E||!E)&&(E=C,O=T),T++;return O},y=function(P){for(var T=0,I=P.length,C=0;T<I;)C+=Math.abs(P[T++]);return C},b=function(P){var T;switch(P){case o.image_compression.FAST:T=11;break;case o.image_compression.MEDIUM:T=13;break;case o.image_compression.SLOW:T=14;break;default:T=12;break}return T};o.processPNG=function(P,T,I,C,E){"use strict";var O=this.color_spaces.DEVICE_RGB,_=this.decode.FLATE_DECODE,x=8,v,D,w,F,H,z;if(this.isArrayBuffer(P)&&(P=new Uint8Array(P)),this.isArrayBufferView(P)){if(t())throw new Error("PNG support requires png.js and zlib.js");if(v=new t$e(P),P=v.imgData,x=v.bits,O=v.colorSpace,F=v.colors,[4,6].indexOf(v.colorType)!==-1){if(v.bits===8)for(var V=v.pixelBitlength==32?new Uint32Array(v.decodePixels().buffer):v.pixelBitlength==16?new Uint16Array(v.decodePixels().buffer):new Uint8Array(v.decodePixels().buffer),W=V.length,L=new Uint8Array(W*v.colors),k=new Uint8Array(W),N=v.pixelBitlength-v.bits,U=0,B=0,G,Y;U<W;U++){for(G=V[U],Y=0;Y<N;)L[B++]=G>>>Y&255,Y=Y+v.bits;k[U]=G>>>Y&255}if(v.bits===16){for(var V=new Uint32Array(v.decodePixels().buffer),W=V.length,L=new Uint8Array(W*(32/v.pixelBitlength)*v.colors),k=new Uint8Array(W*(32/v.pixelBitlength)),X=v.colors>1,U=0,B=0,K=0,G;U<W;)G=V[U++],L[B++]=G>>>0&255,X&&(L[B++]=G>>>16&255,G=V[U++],L[B++]=G>>>0&255),k[K++]=G>>>16&255;x=8}e(C)?(P=i(L,v.width*v.colors,v.colors,C),z=i(k,v.width,1,C)):(P=L,z=k,_=null)}if(v.colorType===3&&(O=this.color_spaces.INDEXED,H=v.palette,v.transparency.indexed)){for(var J=v.transparency.indexed,se=0,U=0,W=J.length;U<W;++U)se+=J[U];if(se=se/255,se===W-1&&J.indexOf(0)!==-1)w=[J.indexOf(0)];else if(se!==W){for(var V=v.decodePixels(),k=new Uint8Array(V.length),U=0,W=V.length;U<W;U++)k[U]=J[V[U]];z=i(k,v.width,1)}}var ce=b(C);return _===this.decode.FLATE_DECODE?D="/Predictor "+ce+" /Colors "+F+" /BitsPerComponent "+x+" /Columns "+v.width:D="/Colors "+F+" /BitsPerComponent "+x+" /Columns "+v.width,(this.isArrayBuffer(P)||this.isArrayBufferView(P))&&(P=this.arrayBufferToBinaryString(P)),(z&&this.isArrayBuffer(z)||this.isArrayBufferView(z))&&(z=this.arrayBufferToBinaryString(z)),this.createImageInfo(P,v.width,v.height,O,x,_,T,I,D,w,H,z,ce)}throw new Error("Unsupported PNG image data, try using JPEG instead.")}})(H2.API),(function(o){"use strict";var t=o.getCharWidthsArray=function(s,a){a=a||{};var l=a.font||this.internal.getFont(),c=a.fontSize||this.internal.getFontSize(),h=a.charSpace||this.internal.getCharSpace(),u=a.widths?a.widths:l.metadata.Unicode.widths,d=u.fof?u.fof:1,p=a.kerning?a.kerning:l.metadata.Unicode.kerning,m=p.fof?p.fof:1,g,y,b,P=0,T=u[0]||d,I=[];for(g=0,y=s.length;g<y;g++){if(b=s.charCodeAt(g),b>255)I.push(1);else if(typeof l.metadata.widthOfString=="function")try{I.push((l.metadata.widthOfGlyph(l.metadata.characterToGlyph(b))+h*(1e3/c)||0)/1e3)}catch{I.push(.5)}else I.push((u[b]||T)/d+(p[b]&&p[b][P]||0)/m);P=b}return I},e=o.getArraySum=function(s){for(var a=s.length,l=0;a;)a--,l+=s[a];return l},r=o.getStringUnitWidth=function(s,a){a=a||{};var l=a.fontSize||this.internal.getFontSize(),c=a.font||this.internal.getFont(),h=a.charSpace||this.internal.getCharSpace(),u=0;return typeof c.metadata.widthOfString=="function"?u=c.metadata.widthOfString(s,l,h)/l:u=e(t.apply(this,arguments)),u},i=function(s,a,l,c){for(var h=[],u=0,d=s.length,p=0;u!==d&&p+a[u]<l;)p+=a[u],u++;h.push(s.slice(0,u));var m=u;for(p=0;u!==d;)p+a[u]>c&&(h.push(s.slice(m,u)),p=0,m=u),p+=a[u],u++;return m!==u&&h.push(s.slice(m,u)),h},n=function(s,a,l){l||(l={});var c=[],h=[c],u=l.textIndent||0,d=0,p=0,m,g,y=s.split(" "),b=t.apply(this,[" ",l])[0],P,T,I,C;if(l.lineIndent===-1?C=y[0].length+2:C=l.lineIndent||0,C){var E=Array(C).join(" "),O=[];y.map(function(v){v=v.split(/\s*\n/),v.length>1?O=O.concat(v.map(function(D,w){return(w&&D.length?`
`:"")+D})):O.push(v[0])}),y=O,C=r.apply(this,[E,l])}for(P=0,T=y.length;P<T;P++){var _=0;if(m=y[P],C&&m[0]==`
`&&(m=m.substr(1),_=1),g=t.apply(this,[m,l]),p=e(g),u+d+p>a||_){if(p>a){for(I=i.apply(this,[m,g,a-(u+d),a]),c.push(I.shift()),c=[I.pop()];I.length;)h.push([I.shift()]);p=e(g.slice(m.length-(c[0]?c[0].length:0)))}else c=[m];h.push(c),u=p+C,d=b}else c.push(m),u+=d+p,d=b}if(C)var x=function(v,D){return(D?E:"")+v.join(" ")};else var x=function(v){return v.join(" ")};return h.map(x)};o.splitTextToSize=function(s,a,l){"use strict";l=l||{};var c=l.fontSize||this.internal.getFontSize(),h=(function(y){var b={0:1},P={};if(!y.widths||!y.kerning){var T=this.internal.getFont(y.fontName,y.fontStyle),I="Unicode";return T.metadata[I]?{widths:T.metadata[I].widths||b,kerning:T.metadata[I].kerning||P}:{font:T.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}else return{widths:y.widths,kerning:y.kerning};return{widths:b,kerning:P}}).call(this,l),u;Array.isArray(s)?u=s:u=s.split(/\r?\n/);var d=1*this.internal.scaleFactor*a/c;h.textIndent=l.textIndent?l.textIndent*1*this.internal.scaleFactor/c:0,h.lineIndent=l.lineIndent;var p,m,g=[];for(p=0,m=u.length;p<m;p++)g=g.concat(n.apply(this,[u[p],d,h]));return g}})(H2.API),(function(o){"use strict";var t=function(n){for(var s="0123456789abcdef",a="klmnopqrstuvwxyz",l={},c=0;c<a.length;c++)l[a[c]]=s[c];var h,u={},d=1,p,m=u,g=[],y,b="",P="",T,I=n.length-1,C;for(c=1;c!=I;)C=n[c],c+=1,C=="'"?p?(T=p.join(""),p=h):p=[]:p?p.push(C):C=="{"?(g.push([m,T]),m={},T=h):C=="}"?(y=g.pop(),y[0][y[1]]=m,T=h,m=y[0]):C=="-"?d=-1:T===h?l.hasOwnProperty(C)?(b+=l[C],T=parseInt(b,16)*d,d=1,b=""):b+=C:l.hasOwnProperty(C)?(P+=l[C],m[T]=parseInt(P,16)*d,d=1,T=h,P=""):P+=C;return u},e={codePages:["WinAnsiEncoding"],WinAnsiEncoding:t("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},r={Unicode:{Courier:e,"Courier-Bold":e,"Courier-BoldOblique":e,"Courier-Oblique":e,Helvetica:e,"Helvetica-Bold":e,"Helvetica-BoldOblique":e,"Helvetica-Oblique":e,"Times-Roman":e,"Times-Bold":e,"Times-BoldItalic":e,"Times-Italic":e}},i={Unicode:{"Courier-Oblique":t("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":t("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":t("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:t("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":t("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":t("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:t("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:t("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":t("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:t("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":t("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":t("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":t("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":t("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};o.events.push(["addFont",function(n){var s=n.font,a,l,c="Unicode",h;a=i[c][s.postScriptName.split(",")[0]],a&&(s.metadata[c]?l=s.metadata[c]:l=s.metadata[c]={},l.widths=a.widths,l.kerning=a.kerning),h=r[c][s.postScriptName.split(",")[0]],h&&(s.metadata[c]?l=s.metadata[c]:l=s.metadata[c]={},l.encoding=h,h.codePages&&h.codePages.length&&(s.encoding=h.codePages[0]))}])})(H2.API);function t9(o,t){if(this.pos=0,this.buffer=o,this.datav=new DataView(o.buffer),this.is_with_alpha=!!t,this.bottom_up=!0,this.flag=String.fromCharCode(this.buffer[0])+String.fromCharCode(this.buffer[1]),this.pos+=2,["BM","BA","CI","CP","IC","PT"].indexOf(this.flag)===-1)throw new Error("Invalid BMP File");this.parseHeader(),this.parseBGR()}t9.prototype.parseHeader=function(){if(this.fileSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.reserved=this.datav.getUint32(this.pos,!0),this.pos+=4,this.offset=this.datav.getUint32(this.pos,!0),this.pos+=4,this.headerSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.width=this.datav.getUint32(this.pos,!0),this.pos+=4,this.height=this.datav.getInt32(this.pos,!0),this.pos+=4,this.planes=this.datav.getUint16(this.pos,!0),this.pos+=2,this.bitPP=this.datav.getUint16(this.pos,!0),this.pos+=2,this.compress=this.datav.getUint32(this.pos,!0),this.pos+=4,this.rawSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.hr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.vr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.colors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.importantColors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.bitPP===16&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var o=this.colors===0?1<<this.bitPP:this.colors;this.palette=new Array(o);for(var t=0;t<o;t++){var e=this.datav.getUint8(this.pos++,!0),r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),n=this.datav.getUint8(this.pos++,!0);this.palette[t]={red:i,green:r,blue:e,quad:n}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},t9.prototype.parseBGR=function(){this.pos=this.offset;try{var o="bit"+this.bitPP,t=this.width*this.height*4;this.data=new Uint8Array(t),this[o]()}catch(e){console.log("bit decode error:"+e)}},t9.prototype.bit1=function(){for(var o=Math.ceil(this.width/8),t=o%4,e=this.height>=0?this.height-1:-this.height,e=this.height-1;e>=0;e--){for(var r=this.bottom_up?e:this.height-1-e,i=0;i<o;i++)for(var n=this.datav.getUint8(this.pos++,!0),s=r*this.width*4+i*8*4,a=0;a<8&&i*8+a<this.width;a++){var l=this.palette[n>>7-a&1];this.data[s+a*4]=l.blue,this.data[s+a*4+1]=l.green,this.data[s+a*4+2]=l.red,this.data[s+a*4+3]=255}t!=0&&(this.pos+=4-t)}},t9.prototype.bit4=function(){for(var o=Math.ceil(this.width/2),t=o%4,e=this.height-1;e>=0;e--){for(var r=this.bottom_up?e:this.height-1-e,i=0;i<o;i++){var n=this.datav.getUint8(this.pos++,!0),s=r*this.width*4+i*2*4,a=n>>4,l=n&15,c=this.palette[a];if(this.data[s]=c.blue,this.data[s+1]=c.green,this.data[s+2]=c.red,this.data[s+3]=255,i*2+1>=this.width)break;c=this.palette[l],this.data[s+4]=c.blue,this.data[s+4+1]=c.green,this.data[s+4+2]=c.red,this.data[s+4+3]=255}t!=0&&(this.pos+=4-t)}},t9.prototype.bit8=function(){for(var o=this.width%4,t=this.height-1;t>=0;t--){for(var e=this.bottom_up?t:this.height-1-t,r=0;r<this.width;r++){var i=this.datav.getUint8(this.pos++,!0),n=e*this.width*4+r*4;if(i<this.palette.length){var s=this.palette[i];this.data[n]=s.red,this.data[n+1]=s.green,this.data[n+2]=s.blue,this.data[n+3]=255}else this.data[n]=255,this.data[n+1]=255,this.data[n+2]=255,this.data[n+3]=255}o!=0&&(this.pos+=4-o)}},t9.prototype.bit15=function(){for(var o=this.width%3,t=parseInt("11111",2),e=t,r=this.height-1;r>=0;r--){for(var i=this.bottom_up?r:this.height-1-r,n=0;n<this.width;n++){var s=this.datav.getUint16(this.pos,!0);this.pos+=2;var a=(s&e)/e*255|0,l=(s>>5&e)/e*255|0,c=(s>>10&e)/e*255|0,h=s>>15?255:0,u=i*this.width*4+n*4;this.data[u]=c,this.data[u+1]=l,this.data[u+2]=a,this.data[u+3]=h}this.pos+=o}},t9.prototype.bit16=function(){for(var o=this.width%3,t=parseInt("11111",2),e=t,r=parseInt("111111",2),i=r,n=this.height-1;n>=0;n--){for(var s=this.bottom_up?n:this.height-1-n,a=0;a<this.width;a++){var l=this.datav.getUint16(this.pos,!0);this.pos+=2;var c=255,h=(l&e)/e*255|0,u=(l>>5&i)/i*255|0,d=(l>>11)/e*255|0,p=s*this.width*4+a*4;this.data[p]=d,this.data[p+1]=u,this.data[p+2]=h,this.data[p+3]=c}this.pos+=o}},t9.prototype.bit24=function(){for(var o=this.height-1;o>=0;o--){for(var t=this.bottom_up?o:this.height-1-o,e=0;e<this.width;e++){var r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),n=this.datav.getUint8(this.pos++,!0),s=t*this.width*4+e*4;this.data[s]=n,this.data[s+1]=i,this.data[s+2]=r,this.data[s+3]=255}this.pos+=this.width%4}},t9.prototype.bit32=function(){for(var o=this.height-1;o>=0;o--)for(var t=this.bottom_up?o:this.height-1-o,e=0;e<this.width;e++){var r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),n=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),a=t*this.width*4+e*4;this.data[a]=n,this.data[a+1]=i,this.data[a+2]=r,this.data[a+3]=s}},t9.prototype.getData=function(){return this.data};function _Dt(o){var t=0;if(o[t++]!==71||o[t++]!==73||o[t++]!==70||o[t++]!==56||(o[t++]+1&253)!==56||o[t++]!==97)throw"Invalid GIF 87a/89a header.";var e=o[t++]|o[t++]<<8,r=o[t++]|o[t++]<<8,i=o[t++],n=i>>7,s=i&7,a=1<<s+1,l=o[t++];o[t++];var c=null;n&&(c=t,t+=a*3);var h=!0,u=[],d=0,p=null,m=0,g=null;for(this.width=e,this.height=r;h&&t<o.length;)switch(o[t++]){case 33:switch(o[t++]){case 255:if(o[t]!==11||o[t+1]==78&&o[t+2]==69&&o[t+3]==84&&o[t+4]==83&&o[t+5]==67&&o[t+6]==65&&o[t+7]==80&&o[t+8]==69&&o[t+9]==50&&o[t+10]==46&&o[t+11]==48&&o[t+12]==3&&o[t+13]==1&&o[t+16]==0)t+=14,g=o[t++]|o[t++]<<8,t++;else for(t+=12;;){var y=o[t++];if(y===0)break;t+=y}break;case 249:if(o[t++]!==4||o[t+4]!==0)throw"Invalid graphics extension block.";var b=o[t++];d=o[t++]|o[t++]<<8,p=o[t++],b&1||(p=null),m=b>>2&7,t++;break;case 254:for(;;){var y=o[t++];if(y===0)break;t+=y}break;default:throw"Unknown graphic control label: 0x"+o[t-1].toString(16)}break;case 44:var P=o[t++]|o[t++]<<8,T=o[t++]|o[t++]<<8,I=o[t++]|o[t++]<<8,C=o[t++]|o[t++]<<8,E=o[t++],O=E>>7,_=E>>6&1,x=E&7,v=1<<x+1,D=c,w=!1;if(O){var w=!0;D=t,t+=v*3}var F=t;for(t++;;){var y=o[t++];if(y===0)break;t+=y}u.push({x:P,y:T,width:I,height:C,has_local_palette:w,palette_offset:D,data_offset:F,data_length:t-F,transparent_index:p,interlaced:!!_,delay:d,disposal:m});break;case 59:h=!1;break;default:throw"Unknown gif block: 0x"+o[t-1].toString(16)}this.numFrames=function(){return u.length},this.loopCount=function(){return g},this.frameInfo=function(H){if(H<0||H>=u.length)throw"Frame index out of range.";return u[H]},this.decodeAndBlitFrameBGRA=function(H,z){var V=this.frameInfo(H),W=V.width*V.height,L=new Uint8Array(W);r$e(o,V.data_offset,L,W);var k=V.palette_offset,N=V.transparent_index;N===null&&(N=256);var U=V.width,B=e-U,G=U,Y=(V.y*e+V.x)*4,X=((V.y+V.height)*e+V.x)*4,K=Y,J=B*4;V.interlaced===!0&&(J+=(U+B)*4*7);for(var se=8,ce=0,te=L.length;ce<te;++ce){var oe=L[ce];if(G===0&&(K+=J,G=U,K>=X&&(J=B+(U+B)*4*(se-1),K=Y+(U+B)*(se<<1),se>>=1)),oe===N)K+=4;else{var $=o[k+oe*3],fe=o[k+oe*3+1],Oe=o[k+oe*3+2];z[K++]=Oe,z[K++]=fe,z[K++]=$,z[K++]=255}--G}},this.decodeAndBlitFrameRGBA=function(H,z){var V=this.frameInfo(H),W=V.width*V.height,L=new Uint8Array(W);r$e(o,V.data_offset,L,W);var k=V.palette_offset,N=V.transparent_index;N===null&&(N=256);var U=V.width,B=e-U,G=U,Y=(V.y*e+V.x)*4,X=((V.y+V.height)*e+V.x)*4,K=Y,J=B*4;V.interlaced===!0&&(J+=(U+B)*4*7);for(var se=8,ce=0,te=L.length;ce<te;++ce){var oe=L[ce];if(G===0&&(K+=J,G=U,K>=X&&(J=B+(U+B)*4*(se-1),K=Y+(U+B)*(se<<1),se>>=1)),oe===N)K+=4;else{var $=o[k+oe*3],fe=o[k+oe*3+1],Oe=o[k+oe*3+2];z[K++]=$,z[K++]=fe,z[K++]=Oe,z[K++]=255}--G}}}function r$e(o,t,e,r){for(var i=o[t++],n=1<<i,s=n+1,a=s+1,l=i+1,c=(1<<l)-1,h=0,u=0,d=0,p=o[t++],m=new Int32Array(4096),g=null;;){for(;h<16&&p!==0;)u|=o[t++]<<h,h+=8,p===1?p=o[t++]:--p;if(h<l)break;var y=u&c;if(u>>=l,h-=l,y===n){a=s+1,l=i+1,c=(1<<l)-1,g=null;continue}else if(y===s)break;for(var b=y<a?y:g,P=0,T=b;T>n;)T=m[T]>>8,++P;var I=T,C=d+P+(b!==y?1:0);if(C>r){console.log("Warning, gif stream longer than expected.");return}e[d++]=I,d+=P;var E=d;for(b!==y&&(e[d++]=I),T=b;P--;)T=m[T],e[--E]=T&255,T>>=8;g!==null&&a<4096&&(m[a++]=g<<8|I,a>=c+1&&l<12&&(++l,c=c<<1|1)),g=y}return d!==r&&console.log("Warning, gif stream shorter than expected."),e}function c$e(o){var t=this,e=Math.round,r=Math.floor,i=new Array(64),n=new Array(64),s=new Array(64),a=new Array(64),l,c,h,u,d=new Array(65535),p=new Array(65535),m=new Array(64),g=new Array(64),y=[],b=0,P=7,T=new Array(64),I=new Array(64),C=new Array(64),E=new Array(256),O=new Array(2048),_,x=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],v=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],D=[0,1,2,3,4,5,6,7,8,9,10,11],w=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],F=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],H=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],z=[0,1,2,3,4,5,6,7,8,9,10,11],V=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],W=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function L(ue){for(var be=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],j=0;j<64;j++){var Z=r((be[j]*ue+50)/100);Z<1?Z=1:Z>255&&(Z=255),i[x[j]]=Z}for(var ie=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],de=0;de<64;de++){var me=r((ie[de]*ue+50)/100);me<1?me=1:me>255&&(me=255),n[x[de]]=me}for(var Se=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],Re=0,Je=0;Je<8;Je++)for(var Ke=0;Ke<8;Ke++)s[Re]=1/(i[x[Re]]*Se[Je]*Se[Ke]*8),a[Re]=1/(n[x[Re]]*Se[Je]*Se[Ke]*8),Re++}function k(ue,be){for(var j=0,Z=0,ie=new Array,de=1;de<=16;de++){for(var me=1;me<=ue[de];me++)ie[be[Z]]=[],ie[be[Z]][0]=j,ie[be[Z]][1]=de,Z++,j++;j*=2}return ie}function N(){l=k(v,D),c=k(H,z),h=k(w,F),u=k(V,W)}function U(){for(var ue=1,be=2,j=1;j<=15;j++){for(var Z=ue;Z<be;Z++)p[32767+Z]=j,d[32767+Z]=[],d[32767+Z][1]=j,d[32767+Z][0]=Z;for(var ie=-(be-1);ie<=-ue;ie++)p[32767+ie]=j,d[32767+ie]=[],d[32767+ie][1]=j,d[32767+ie][0]=be-1+ie;ue<<=1,be<<=1}}function B(){for(var ue=0;ue<256;ue++)O[ue]=19595*ue,O[ue+256>>0]=38470*ue,O[ue+512>>0]=7471*ue+32768,O[ue+768>>0]=-11059*ue,O[ue+1024>>0]=-21709*ue,O[ue+1280>>0]=32768*ue+8421375,O[ue+1536>>0]=-27439*ue,O[ue+1792>>0]=-5329*ue}function G(ue){for(var be=ue[0],j=ue[1]-1;j>=0;)be&1<<j&&(b|=1<<P),j--,P--,P<0&&(b==255?(Y(255),Y(0)):Y(b),P=7,b=0)}function Y(ue){y.push(ue)}function X(ue){Y(ue>>8&255),Y(ue&255)}function K(ue,be){var j,Z,ie,de,me,Se,Re,Je,Ke=0,Gt,Nr=8,xr=64;for(Gt=0;Gt<Nr;++Gt){j=ue[Ke],Z=ue[Ke+1],ie=ue[Ke+2],de=ue[Ke+3],me=ue[Ke+4],Se=ue[Ke+5],Re=ue[Ke+6],Je=ue[Ke+7];var vr=j+Je,_r=j-Je,Ne=Z+Re,Vt=Z-Re,Ft=ie+Se,ir=ie-Se,Fe=de+me,tt=de-me,ye=vr+Fe,yt=vr-Fe,Wt=Ne+Ft,pe=Ne-Ft;ue[Ke]=ye+Wt,ue[Ke+4]=ye-Wt;var Xe=(pe+yt)*.707106781;ue[Ke+2]=yt+Xe,ue[Ke+6]=yt-Xe,ye=tt+ir,Wt=ir+Vt,pe=Vt+_r;var ct=(ye-pe)*.382683433,Me=.5411961*ye+ct,st=1.306562965*pe+ct,Ot=Wt*.707106781,hr=_r+Ot,Or=_r-Ot;ue[Ke+5]=Or+Me,ue[Ke+3]=Or-Me,ue[Ke+1]=hr+st,ue[Ke+7]=hr-st,Ke+=8}for(Ke=0,Gt=0;Gt<Nr;++Gt){j=ue[Ke],Z=ue[Ke+8],ie=ue[Ke+16],de=ue[Ke+24],me=ue[Ke+32],Se=ue[Ke+40],Re=ue[Ke+48],Je=ue[Ke+56];var Xr=j+Je,Oi=j-Je,qi=Z+Re,Ni=Z-Re,Wi=ie+Se,fo=ie-Se,tl=de+me,Oa=de-me,Gc=Xr+tl,B0=Xr-tl,Uc=qi+Wi,Lt=qi-Wi;ue[Ke]=Gc+Uc,ue[Ke+32]=Gc-Uc;var Ql=(Lt+B0)*.707106781;ue[Ke+16]=B0+Ql,ue[Ke+48]=B0-Ql,Gc=Oa+fo,Uc=fo+Ni,Lt=Ni+Oi;var Wm=(Gc-Lt)*.382683433,Lg=.5411961*Gc+Wm,OT=1.306562965*Lt+Wm,IE=Uc*.707106781,o9=Oi+IE,CE=Oi-IE;ue[Ke+40]=CE+Lg,ue[Ke+24]=CE-Lg,ue[Ke+8]=o9+OT,ue[Ke+56]=o9-OT,Ke++}var s9;for(Gt=0;Gt<xr;++Gt)s9=ue[Gt]*be[Gt],m[Gt]=s9>0?s9+.5|0:s9-.5|0;return m}function J(){X(65504),X(16),Y(74),Y(70),Y(73),Y(70),Y(0),Y(1),Y(1),Y(0),X(1),X(1),Y(0),Y(0)}function se(ue,be){X(65472),X(17),Y(8),X(be),X(ue),Y(3),Y(1),Y(17),Y(0),Y(2),Y(17),Y(1),Y(3),Y(17),Y(1)}function ce(){X(65499),X(132),Y(0);for(var ue=0;ue<64;ue++)Y(i[ue]);Y(1);for(var be=0;be<64;be++)Y(n[be])}function te(){X(65476),X(418),Y(0);for(var ue=0;ue<16;ue++)Y(v[ue+1]);for(var be=0;be<=11;be++)Y(D[be]);Y(16);for(var j=0;j<16;j++)Y(w[j+1]);for(var Z=0;Z<=161;Z++)Y(F[Z]);Y(1);for(var ie=0;ie<16;ie++)Y(H[ie+1]);for(var de=0;de<=11;de++)Y(z[de]);Y(17);for(var me=0;me<16;me++)Y(V[me+1]);for(var Se=0;Se<=161;Se++)Y(W[Se])}function oe(){X(65498),X(12),Y(3),Y(1),Y(0),Y(2),Y(17),Y(3),Y(17),Y(0),Y(63),Y(0)}function $(ue,be,j,Z,ie){for(var de=ie[0],me=ie[240],Se,Re=16,Je=63,Ke=64,Gt=K(ue,be),Nr=0;Nr<Ke;++Nr)g[x[Nr]]=Gt[Nr];var xr=g[0]-j;j=g[0],xr==0?G(Z[0]):(Se=32767+xr,G(Z[p[Se]]),G(d[Se]));for(var vr=63;vr>0&&g[vr]==0;vr--);if(vr==0)return G(de),j;for(var _r=1,Ne;_r<=vr;){for(var Vt=_r;g[_r]==0&&_r<=vr;++_r);var Ft=_r-Vt;if(Ft>=Re){Ne=Ft>>4;for(var ir=1;ir<=Ne;++ir)G(me);Ft=Ft&15}Se=32767+g[_r],G(ie[(Ft<<4)+p[Se]]),G(d[Se]),_r++}return vr!=Je&&G(de),j}function fe(){for(var ue=String.fromCharCode,be=0;be<256;be++)E[be]=ue(be)}this.encode=function(ue,be){var j=new Date().getTime();be&&Oe(be),y=new Array,b=0,P=7,X(65496),J(),ce(),se(ue.width,ue.height),te(),oe();var Z=0,ie=0,de=0;b=0,P=7,this.encode.displayName="_encode_";for(var me=ue.data,Se=ue.width,Re=ue.height,Je=Se*4,Ke=Se*3,Gt,Nr=0,xr,vr,_r,Ne,Vt,Ft,ir,Fe;Nr<Re;){for(Gt=0;Gt<Je;){for(Ne=Je*Nr+Gt,Vt=Ne,Ft=-1,ir=0,Fe=0;Fe<64;Fe++)ir=Fe>>3,Ft=(Fe&7)*4,Vt=Ne+ir*Je+Ft,Nr+ir>=Re&&(Vt-=Je*(Nr+1+ir-Re)),Gt+Ft>=Je&&(Vt-=Gt+Ft-Je+4),xr=me[Vt++],vr=me[Vt++],_r=me[Vt++],T[Fe]=(O[xr]+O[vr+256>>0]+O[_r+512>>0]>>16)-128,I[Fe]=(O[xr+768>>0]+O[vr+1024>>0]+O[_r+1280>>0]>>16)-128,C[Fe]=(O[xr+1280>>0]+O[vr+1536>>0]+O[_r+1792>>0]>>16)-128;Z=$(T,s,Z,l,h),ie=$(I,a,ie,c,u),de=$(C,a,de,c,u),Gt+=32}Nr+=8}if(P>=0){var tt=[];tt[1]=P+1,tt[0]=(1<<P+1)-1,G(tt)}return X(65497),new Uint8Array(y)};function Oe(ue){if(ue<=0&&(ue=1),ue>100&&(ue=100),_!=ue){var be=0;ue<50?be=Math.floor(5e3/ue):be=Math.floor(200-ue*2),L(be),_=ue}}function Te(){var ue=new Date().getTime();o||(o=50),fe(),N(),U(),B(),Oe(o);var be=new Date().getTime()-ue}Te()}(function(o){"use strict";o.processBMP=function(t,e,r,i,n){var s=new t9(t,!1),a=s.width,l=s.height,c=100,h=s.getData(),u={data:h,width:a,height:l},d=new c$e(c),p=d.encode(u,c);return o.processJPEG.call(this,p,e,r,i)}})(H2.API);(function(o){"use strict";o.processGIF89A=function(t,e,r,i,n){var s=new _Dt(t),a=s.width,l=s.height,c=100,h=[];s.decodeAndBlitFrameRGBA(0,h);var u=new Uint8Array(a*l*4),d={data:h,width:a,height:l},p=new c$e(c),m=p.encode(d,c);return o.processJPEG.call(this,m,e,r,i)},o.processGIF87A=o.processGIF89A})(H2.API);(function(o){"use strict";var t=function(e){if(typeof e<"u"&&e!="")return!0};return H2.API.events.push(["addPage",function(e){var r=this.internal.getPageInfo(e.pageNumber);r.pageContext.annotations=[]}]),o.events.push(["putPage",function(e){for(var r=this.internal.getCoordinateString,i=this.internal.getVerticalCoordinateString,n=this.internal.getPageInfoByObjId(e.objId),s=e.pageContext.annotations,a,l,c,h=!1,u=0;u<s.length&&!h;u++)switch(a=s[u],a.type){case"link":(t(a.options.url)||t(a.options.pageNumber)||t(a.options.js))&&(h=!0);break;case"reference":case"text":case"freetext":h=!0;break}if(h!=!1){this.internal.write("/Annots [");for(var d=0;d<s.length;d++)switch(a=s[d],a.type){case"reference":this.internal.write(" "+a.object.objId+" 0 R ");break;case"text":var p=this.internal.newAdditionalObject(),m=this.internal.newAdditionalObject(),g=a.title||"Note";l="/Rect ["+r(a.bounds.x)+" "+i(a.bounds.y+a.bounds.h,n.pageNumber)+" "+r(a.bounds.x+a.bounds.w)+" "+i(a.bounds.y,n.pageNumber)+"] ",c="<</Type /Annot /Subtype /Text "+l+`/Contents ${a.contentType==="code"?"<":"("}`+a.contents+`${a.contentType==="code"?">":")"}`,c+=" /Popup "+m.objId+" 0 R",c+=" /P "+n.objId+" 0 R",c+=` /T ${a.contentType==="code"?"<":"("}`+g+`${a.contentType==="code"?">":")"} >>`,p.content=c;var y=p.objId+" 0 R",b=30;l="/Rect ["+r(a.bounds.x+b)+" "+i(a.bounds.y+a.bounds.h,n.pageNumber)+" "+r(a.bounds.x+a.bounds.w+b)+" "+i(a.bounds.y,n.pageNumber)+"] ",c="<</Type /Annot /Subtype /Popup "+l+" /Parent "+y,a.open&&(c+=" /Open true"),c+=" >>",m.content=c,this.internal.write(p.objId,"0 R",m.objId,"0 R");break;case"freetext":l="/Rect ["+r(a.bounds.x)+" "+i(a.bounds.y,n.pageNumber)+" "+r(a.bounds.x+a.bounds.w)+" "+i(a.bounds.y+a.bounds.h,n.pageNumber)+"] ";var P=a.color||"#000000";c="<</Type /Annot /Subtype /FreeText "+l+`/Contents ${a.contentType==="code"?"<":"("}`+a.contents+`${a.contentType==="code"?">":")"}`,c+=" /DS(font: Helvetica,sans-serif 12.0pt; text-align:left; color:#"+P+")",c+=" /Border [0 0 0]",c+=" >>",this.internal.write(c);break;case"link":if(a.options.name){var T=this.annotations._nameMap[a.options.name];a.options.pageNumber=T.page,a.options.top=T.y}else a.options.top||(a.options.top=0);if(l="/Rect ["+r(a.x)+" "+i(a.y,n.pageNumber)+" "+r(a.x+a.w)+" "+i(a.y+a.h,n.pageNumber)+"] ",c="",a.options.url)c="<</Type /Annot /Subtype /Link "+l+"/Border [0 0 0] /A <</S /URI /URI ("+a.options.url+") >>";else if(a.options.pageNumber){var I=this.internal.getPageInfo(a.options.pageNumber);switch(c="<</Type /Annot /Subtype /Link "+l+"/Border [0 0 0] /Dest ["+I.objId+" 0 R",a.options.magFactor=a.options.magFactor||"XYZ",a.options.magFactor){case"Fit":c+=" /Fit]";break;case"FitH":c+=" /FitH "+a.options.top+"]";break;case"FitV":a.options.left=a.options.left||0,c+=" /FitV "+a.options.left+"]";break;case"XYZ":default:var C=i(a.options.top);a.options.left=a.options.left||0,typeof a.options.zoom>"u"&&(a.options.zoom=0),c+=" /XYZ "+a.options.left+" "+C+" "+a.options.zoom+"]";break}}else a.options.js&&(c=`<</Type /Annot /Subtype /Link ${l} /Border [0 0 0] /A << /Type /Action /S /JavaScript /JS ${a.options.contentType==="code"?"<":"("} ${a.options.js} ${a.options.contentType==="code"?">":")"} >>`);c!=""&&(c+=" >>",this.internal.write(c));break}this.internal.write("]")}}]),o.createAnnotation=function(e){var r=this.internal.getCurrentPageInfo();switch(e.type){case"link":this.link(e.bounds.x,e.bounds.y,e.bounds.w,e.bounds.h,e);break;case"text":case"freetext":r.pageContext.annotations.push(e);break}},o.link=function(e,r,i,n,s){var a=this.internal.getCurrentPageInfo();a.pageContext.annotations.push({x:e,y:r,w:i,h:n,options:s,type:"link"})},o.textWithLink=function(e,r,i,n){var s=this.getTextWidth(e),a=this.internal.getLineHeight()/this.internal.scaleFactor;return this.text(e,r,i,n),i+=a*.2,this.link(r,i-a,s,a,n),s},o.getTextWidth=function(e){var r=this.internal.getFontSize(),i=this.getStringUnitWidth(e)*r/this.internal.scaleFactor;return i},this})(H2.API);(function(o){var t;return o.events.push(["postPutResources",function(){var e=this,r=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var i=e.outline.render().split(/\r\n/),n=0;n<i.length;n++){var s=i[n],a=r.exec(s);if(a!=null){var l=a[1];e.internal.newObjectDeferredBegin(l,!1)}e.internal.write(s)}if(this.outline.createNamedDestinations){for(var c=this.internal.pages.length,h=[],n=0;n<c;n++){var u=e.internal.newObject();h.push(u);var d=e.internal.getPageInfo(n+1);e.internal.write("<< /D["+d.objId+" 0 R /XYZ null null null]>> endobj")}var p=e.internal.newObject();e.internal.write("<< /Names [ ");for(var n=0;n<h.length;n++)e.internal.write("(page_"+(n+1)+")"+h[n]+" 0 R");e.internal.write(" ] >>","endobj"),t=e.internal.newObject(),e.internal.write("<< /Dests "+p+" 0 R"),e.internal.write(">>","endobj")}}]),o.events.push(["putCatalog",function(){var e=this;e.outline.root.children.length>0&&(e.internal.write("/Outlines",this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&e.internal.write("/Names "+t+" 0 R"))}]),o.events.push(["initialized",function(){var e=this;e.outline={createNamedDestinations:!1,root:{children:[]}},e.outline.add=function(r,i,n){var s={title:i,options:n,children:[]};return r==null&&(r=this.root),r.children.push(s),s},e.outline.render=function(){return this.ctx={},this.ctx.val="",this.ctx.pdf=e,this.genIds_r(this.root),this.renderRoot(this.root),this.renderItems(this.root),this.ctx.val},e.outline.genIds_r=function(r){r.id=e.internal.newObjectDeferred();for(var i=0;i<r.children.length;i++)this.genIds_r(r.children[i])},e.outline.renderRoot=function(r){this.objStart(r),this.line("/Type /Outlines"),r.children.length>0&&(this.line("/First "+this.makeRef(r.children[0])),this.line("/Last "+this.makeRef(r.children[r.children.length-1]))),this.line("/Count "+this.count_r({count:0},r)),this.objEnd()},e.outline.renderItems=function(r){for(var i=this.ctx.pdf.internal.getVerticalCoordinateString,n=0;n<r.children.length;n++){var s=r.children[n];this.objStart(s),this.line("/Title "+this.makeString(s.title)),this.line("/Parent "+this.makeRef(r)),n>0&&this.line("/Prev "+this.makeRef(r.children[n-1])),n<r.children.length-1&&this.line("/Next "+this.makeRef(r.children[n+1])),s.children.length>0&&(this.line("/First "+this.makeRef(s.children[0])),this.line("/Last "+this.makeRef(s.children[s.children.length-1])));var a=this.count=this.count_r({count:0},s);if(a>0&&this.line("/Count "+a),s.options&&s.options.pageNumber){let{bbox:u,useMark:d}=s.options;if(u){let{x:p,y:m,width:g,height:y}=u,b=Math.max(g,y),P=`this.removeField('arrow');var a = this.addField('arrow','text',${s.options.pageNumber-1},[${p},${m},${p+g},${m-y}]);a.textColor=color.blue;a.value=""`;var l=e.internal.newObject();e.internal.write("<</D["+(s.options.pageNumber-1)+` /XYZ 0 ${i(0)} 0]/S/GoTo/Next `+(l+1)+" 0 R>> endobj"),e.internal.newObject(),e.internal.write(`<</JS(this.zoomType=zoomtype.fitV;var box=this.getPageBox('Media',${s.options.pageNumber-1});var scale=(box[2]-box[0])/${b}/5;this.zoom*=scale;var scrollX=${p+g/2}-(box[2]-box[0])/2/scale;var scrollY=${m-y/2}-(box[3]-box[1])/2/scale;this.scroll(scrollX,scrollY);${d?P:""})/S/JavaScript>> endobj`),this.line("/A "+l+" 0 R")}else{var c=e.internal.getPageInfo(s.options.pageNumber);this.line("/Dest ["+c.objId+" 0 R /XYZ 0 "+i(0)+" 0]")}}this.objEnd()}for(var h=0;h<r.children.length;h++)this.renderItems(r.children[h])},e.outline.line=function(r){this.ctx.val+=r+`\r
`},e.outline.makeRef=function(r){return r.id+" 0 R"},e.outline.makeString=function(r){return"("+e.internal.pdfEscape(r)+")"},e.outline.objStart=function(r){this.ctx.val+=`\r
`+r.id+` 0 obj\r
<<\r
`},e.outline.objEnd=function(){this.ctx.val+=`>> \r
endobj\r
`},e.outline.count_r=function(r,i){for(var n=0;n<i.children.length;n++)r.count++,this.count_r(r,i.children[n]);return r.count}}]),this})(H2.API);(function(o){"use strict";var t=function(a){var l,c,h,u,d,p,m,g,y,b;for(/[^\x00-\xFF]/.test(a),l="\0\0\0\0".slice(a.length%4||4),a+=l,c=[],h=0,u=a.length;u>h;h+=4)d=(a.charCodeAt(h)<<24)+(a.charCodeAt(h+1)<<16)+(a.charCodeAt(h+2)<<8)+a.charCodeAt(h+3),d!==0?(b=d%85,d=(d-b)/85,y=d%85,d=(d-y)/85,g=d%85,d=(d-g)/85,m=d%85,d=(d-m)/85,p=d%85,c.push(p+33,m+33,g+33,y+33,b+33)):c.push(122);return(function(P,T){for(var I=T;I>0;I--)P.pop()})(c,l.length),String.fromCharCode.apply(String,c)+"~>"},e=function(a){var l,c,h,u,d,p=String,m="length",g=255,y="charCodeAt",b="slice",P="replace";for(a[b](-2),a=a[b](0,-2)[P](/\s/g,"")[P]("z","!!!!!"),l="uuuuu"[b](a[m]%5||5),a+=l,h=[],u=0,d=a[m];d>u;u+=5)c=52200625*(a[y](u)-33)+614125*(a[y](u+1)-33)+7225*(a[y](u+2)-33)+85*(a[y](u+3)-33)+(a[y](u+4)-33),h.push(g&c>>24,g&c>>16,g&c>>8,g&c);return(function(T,I){for(var C=I;C>0;C--)T.pop()})(h,l[m]),p.fromCharCode.apply(p,h)},r=function(a){return a.split("").map(function(l){return("0"+l.charCodeAt().toString(16)).slice(-2)}).join("")+">"},i=function(a){var l=new RegExp(/^([0-9A-Fa-f]{2})+$/);if(a=a.replace(/\s/g,""),a.indexOf(">")!==-1&&(a=a.substr(0,a.indexOf(">"))),a.length%2&&(a+="0"),l.test(a)===!1)return"";for(var c="",h=0;h<a.length;h+=2)c+=String.fromCharCode("0x"+(a[h]+a[h+1]));return c},n=function(a,l){var c=new Uint8Array(a.byteLength+l.byteLength);return c.set(new Uint8Array(a),0),c.set(new Uint8Array(l),a.byteLength),c},s=function(a){for(var l=[],c=a.length,h,u;c--;)l[c]=a.charCodeAt(c);return h=o.adler32cs.from(a),u=new dAe(6),a=u.append(new Uint8Array(l)),a=n(a,u.flush()),l=new Uint8Array(a.byteLength+6),l.set(new Uint8Array([120,156])),l.set(a,2),l.set(new Uint8Array([h&255,h>>8&255,h>>16&255,h>>24&255]),a.byteLength+2),a=l.reduce(function(d,p){return d+String.fromCharCode(p)},""),a};o.processDataByFilters=function(a,l){"use strict";var c=0,h=a||"",u=[];for(l=l||[],typeof l=="string"&&(l=[l]),c=0;c<l.length;c+=1)switch(l[c]){case"ASCII85Decode":case"/ASCII85Decode":h=e(h),u.push("/ASCII85Encode");break;case"ASCII85Encode":case"/ASCII85Encode":h=t(h),u.push("/ASCII85Decode");break;case"ASCIIHexDecode":case"/ASCIIHexDecode":h=i(h),u.push("/ASCIIHexEncode");break;case"ASCIIHexEncode":case"/ASCIIHexEncode":h=r(h),u.push("/ASCIIHexDecode");break;case"FlateEncode":case"/FlateEncode":h=s(h),u.push("/FlateDecode");break;default:throw new Error('The filter: "'+l[c]+'" is not implemented')}return{data:h,reverseChain:u.reverse().join(" ")}}})(H2.API);(function(o,t){o.API.adler32cs=t()})(H2,function(){var o=typeof ArrayBuffer=="function"&&typeof Uint8Array=="function",t=null,e=(function(){if(!o)return function(){return!1};try{var c={};typeof c.Buffer=="function"&&(t=c.Buffer)}catch{}return function(h){return h instanceof ArrayBuffer||t!==null&&h instanceof t}})(),r=(function(){return t!==null?function(c){return new t(c,"utf8").toString("binary")}:function(c){return unescape(encodeURIComponent(c))}})(),i=65521,n=function(c,h){for(var u=c&65535,d=c>>>16,p=0,m=h.length;p<m;p++)u=(u+(h.charCodeAt(p)&255))%i,d=(d+u)%i;return(d<<16|u)>>>0},s=function(c,h){for(var u=c&65535,d=c>>>16,p=0,m=h.length;p<m;p++)u=(u+h[p])%i,d=(d+u)%i;return(d<<16|u)>>>0},a={},l=a.Adler32=(function(){var c=function(u){if(!(this instanceof c))throw new TypeError("Constructor cannot called be as a function.");if(!isFinite(u=u===null?1:+u))throw new Error("First arguments needs to be a finite number.");this.checksum=u>>>0},h=c.prototype={};return h.constructor=c,c.from=(function(u){return u.prototype=h,u})(function(u){if(!(this instanceof c))throw new TypeError("Constructor cannot called be as a function.");if(u===null)throw new Error("First argument needs to be a string.");this.checksum=n(1,u.toString())}),c.fromUtf8=(function(u){return u.prototype=h,u})(function(u){if(!(this instanceof c))throw new TypeError("Constructor cannot called be as a function.");if(u===null)throw new Error("First argument needs to be a string.");var d=r(u.toString());this.checksum=n(1,d)}),o&&(c.fromBuffer=(function(u){return u.prototype=h,u})(function(u){if(!(this instanceof c))throw new TypeError("Constructor cannot called be as a function.");if(!e(u))throw new Error("First argument needs to be ArrayBuffer.");var d=new Uint8Array(u);return this.checksum=s(1,d)})),h.update=function(u){if(u===null)throw new Error("First argument needs to be a string.");return u=u.toString(),this.checksum=n(this.checksum,u)},h.updateUtf8=function(u){if(u===null)throw new Error("First argument needs to be a string.");var d=r(u.toString());return this.checksum=n(this.checksum,d)},o&&(h.updateBuffer=function(u){if(!e(u))throw new Error("First argument needs to be ArrayBuffer.");var d=new Uint8Array(u);return this.checksum=s(this.checksum,d)}),h.clone=function(){return new l(this.checksum)},c})();return a.from=function(c){if(c===null)throw new Error("First argument needs to be a string.");return n(1,c.toString())},a.fromUtf8=function(c){if(c===null)throw new Error("First argument needs to be a string.");var h=r(c.toString());return n(1,h)},o&&(a.fromBuffer=function(c){if(!e(c))throw new Error("First argument need to be ArrayBuffer.");var h=new Uint8Array(c);return s(1,h)}),a}),H2.API.TTFFont=(function(){o.open=function(t){return new o(t)};function o(t){var e;if(this.rawData=t,e=this.contents=new ZD(t),this.contents.pos=4,e.readString(4)==="ttcf")throw new Error("TTCF not supported.");e.pos=0,this.parse(),this.subset=new WDt(this),this.registerTTF()}return o.prototype.parse=function(){return this.directory=new vDt(this.contents),this.head=new RDt(this),this.name=new NDt(this),this.cmap=new h$e(this),this.toUnicode={},this.hhea=new DDt(this),this.maxp=new kDt(this),this.hmtx=new BDt(this),this.post=new LDt(this),this.os2=new wDt(this),this.loca=new UDt(this),this.glyf=new FDt(this),this.ascender=this.os2.exists&&this.os2.ascender||this.hhea.ascender,this.decender=this.os2.exists&&this.os2.decender||this.hhea.decender,this.lineGap=this.os2.exists&&this.os2.lineGap||this.hhea.lineGap,this.bbox=[this.head.xMin,this.head.yMin,this.head.xMax,this.head.yMax]},o.prototype.registerTTF=function(){var t,e,r,i,n;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=(function(){var s,a,l,c;for(l=this.bbox,c=[],s=0,a=l.length;s<a;s++)t=l[s],c.push(Math.round(t*this.scaleFactor));return c}).call(this),this.stemV=0,this.post.exists?(i=this.post.italic_angle,e=i>>16,r=i&255,e&32768&&(e=-((e^65535)+1)),this.italicAngle=+(""+e+"."+r)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=(n=this.familyClass)===1||n===2||n===3||n===4||n===5||n===7,this.isScript=this.familyClass===10,this.flags=0,this.post.isFixedPitch&&(this.flags|=1),this.isSerif&&(this.flags|=2),this.isScript&&(this.flags|=8),this.italicAngle!==0&&(this.flags|=64),this.flags|=32,!this.cmap.unicode)throw new Error("No unicode cmap for font")},o.prototype.characterToGlyph=function(t){var e;return((e=this.cmap.unicode)!=null?e.codeMap[t]:void 0)||0},o.prototype.widthOfGlyph=function(t){var e;return e=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(t).advance*e},o.prototype.widthOfString=function(t,e,r){var i,n,s,a,l;for(t=""+t,a=0,n=0,l=t.length;0<=l?n<l:n>l;n=0<=l?++n:--n)i=t.charCodeAt(n),a+=this.widthOfGlyph(this.characterToGlyph(i))+r*(1e3/e)||0;return s=e/1e3,a*s},o.prototype.lineHeight=function(t,e){var r;return e==null&&(e=!1),r=e?this.lineGap:0,(this.ascender+r-this.decender)/1e3*t},o})();var ZD=(function(){function o(t){this.data=t!=null?t:[],this.pos=0,this.length=this.data.length}return o.prototype.readByte=function(){return this.data[this.pos++]},o.prototype.writeByte=function(t){return this.data[this.pos++]=t},o.prototype.readUInt32=function(){var t,e,r,i;return t=this.readByte()*16777216,e=this.readByte()<<16,r=this.readByte()<<8,i=this.readByte(),t+e+r+i},o.prototype.writeUInt32=function(t){return this.writeByte(t>>>24&255),this.writeByte(t>>16&255),this.writeByte(t>>8&255),this.writeByte(t&255)},o.prototype.readInt32=function(){var t;return t=this.readUInt32(),t>=2147483648?t-4294967296:t},o.prototype.writeInt32=function(t){return t<0&&(t+=4294967296),this.writeUInt32(t)},o.prototype.readUInt16=function(){var t,e;return t=this.readByte()<<8,e=this.readByte(),t|e},o.prototype.writeUInt16=function(t){return this.writeByte(t>>8&255),this.writeByte(t&255)},o.prototype.readInt16=function(){var t;return t=this.readUInt16(),t>=32768?t-65536:t},o.prototype.writeInt16=function(t){return t<0&&(t+=65536),this.writeUInt16(t)},o.prototype.readString=function(t){var e,r;for(r=[],e=0;0<=t?e<t:e>t;e=0<=t?++e:--e)r[e]=String.fromCharCode(this.readByte());return r.join("")},o.prototype.writeString=function(t){var e,r,i;for(i=[],e=0,r=t.length;0<=r?e<r:e>r;e=0<=r?++e:--e)i.push(this.writeByte(t.charCodeAt(e)));return i},o.prototype.readShort=function(){return this.readInt16()},o.prototype.writeShort=function(t){return this.writeInt16(t)},o.prototype.readLongLong=function(){var t,e,r,i,n,s,a,l;return t=this.readByte(),e=this.readByte(),r=this.readByte(),i=this.readByte(),n=this.readByte(),s=this.readByte(),a=this.readByte(),l=this.readByte(),t&128?((t^255)*72057594037927940+(e^255)*281474976710656+(r^255)*1099511627776+(i^255)*4294967296+(n^255)*16777216+(s^255)*65536+(a^255)*256+(l^255)+1)*-1:t*72057594037927940+e*281474976710656+r*1099511627776+i*4294967296+n*16777216+s*65536+a*256+l},o.prototype.writeLongLong=function(t){var e,r;return e=Math.floor(t/4294967296),r=t&4294967295,this.writeByte(e>>24&255),this.writeByte(e>>16&255),this.writeByte(e>>8&255),this.writeByte(e&255),this.writeByte(r>>24&255),this.writeByte(r>>16&255),this.writeByte(r>>8&255),this.writeByte(r&255)},o.prototype.readInt=function(){return this.readInt32()},o.prototype.writeInt=function(t){return this.writeInt32(t)},o.prototype.read=function(t){var e,r;for(e=[],r=0;0<=t?r<t:r>t;r=0<=t?++r:--r)e.push(this.readByte());return e},o.prototype.write=function(t){var e,r,i,n;for(n=[],r=0,i=t.length;r<i;r++)e=t[r],n.push(this.writeByte(e));return n},o})(),vDt=(function(){var o;function t(e){var r,i,n;for(this.scalarType=e.readInt(),this.tableCount=e.readShort(),this.searchRange=e.readShort(),this.entrySelector=e.readShort(),this.rangeShift=e.readShort(),this.tables={},i=0,n=this.tableCount;0<=n?i<n:i>n;i=0<=n?++i:--i)r={tag:e.readString(4),checksum:e.readInt(),offset:e.readInt(),length:e.readInt()},this.tables[r.tag]=r}return t.prototype.encode=function(e){var r,i,n,s,a,l,c,h,u,d,p,m,g,y;m=Object.keys(e).length,l=Math.log(2),u=Math.floor(Math.log(m)/l)*16,s=Math.floor(u/l),h=m*16-u,i=new ZD,i.writeInt(this.scalarType),i.writeShort(m),i.writeShort(u),i.writeShort(s),i.writeShort(h),n=m*16,c=i.pos+n,a=null,g=[];for(y in e)for(p=e[y],i.writeString(y),i.writeInt(o(p)),i.writeInt(c),i.writeInt(p.length),g=g.concat(p),y==="head"&&(a=c),c+=p.length;c%4;)g.push(0),c++;return i.write(g),d=o(i.data),r=2981146554-d,i.pos=a+8,i.writeUInt32(r),i.data},o=function(e){var r,i,n,s;for(e=u$e.call(e);e.length%4;)e.push(0);for(n=new ZD(e),i=0,r=0,s=e.length;r<s;r=r+=4)i+=n.readUInt32();return i&4294967295},t})(),n9,xDt={}.hasOwnProperty,PE=function(o,t){for(var e in t)xDt.call(t,e)&&(o[e]=t[e]);function r(){this.constructor=o}return r.prototype=t.prototype,o.prototype=new r,o.__super__=t.prototype,o};n9=(function(){function o(t){var e;this.file=t,e=this.file.directory.tables[this.tag],this.exists=!!e,e&&(this.offset=e.offset,this.length=e.length,this.parse(this.file.contents))}return o.prototype.parse=function(){},o.prototype.encode=function(){},o.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},o})();var RDt=(function(o){PE(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="head",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.revision=e.readInt(),this.checkSumAdjustment=e.readInt(),this.magicNumber=e.readInt(),this.flags=e.readShort(),this.unitsPerEm=e.readShort(),this.created=e.readLongLong(),this.modified=e.readLongLong(),this.xMin=e.readShort(),this.yMin=e.readShort(),this.xMax=e.readShort(),this.yMax=e.readShort(),this.macStyle=e.readShort(),this.lowestRecPPEM=e.readShort(),this.fontDirectionHint=e.readShort(),this.indexToLocFormat=e.readShort(),this.glyphDataFormat=e.readShort()},t.prototype.encode=function(e){var r;return r=new ZD,r.writeInt(this.version),r.writeInt(this.revision),r.writeInt(this.checkSumAdjustment),r.writeInt(this.magicNumber),r.writeShort(this.flags),r.writeShort(this.unitsPerEm),r.writeLongLong(this.created),r.writeLongLong(this.modified),r.writeShort(this.xMin),r.writeShort(this.yMin),r.writeShort(this.xMax),r.writeShort(this.yMax),r.writeShort(this.macStyle),r.writeShort(this.lowestRecPPEM),r.writeShort(this.fontDirectionHint),r.writeShort(e),r.writeShort(this.glyphDataFormat),r.data},t})(n9),i$e=(function(){function o(t,e){var r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I;switch(this.platformID=t.readUInt16(),this.encodingID=t.readShort(),this.offset=e+t.readInt(),d=t.pos,t.pos=this.offset,this.format=t.readUInt16(),this.length=t.readUInt16(),this.language=t.readUInt16(),this.isUnicode=this.platformID===3&&this.encodingID===1&&this.format===4||this.platformID===0&&this.format===4,this.codeMap={},this.format){case 0:for(l=0;l<256;++l)this.codeMap[l]=t.readByte();break;case 4:for(m=t.readUInt16(),p=m/2,t.pos+=6,n=(function(){var C,E;for(E=[],l=C=0;0<=p?C<p:C>p;l=0<=p?++C:--C)E.push(t.readUInt16());return E})(),t.pos+=2,y=(function(){var C,E;for(E=[],l=C=0;0<=p?C<p:C>p;l=0<=p?++C:--C)E.push(t.readUInt16());return E})(),c=(function(){var C,E;for(E=[],l=C=0;0<=p?C<p:C>p;l=0<=p?++C:--C)E.push(t.readUInt16());return E})(),h=(function(){var C,E;for(E=[],l=C=0;0<=p?C<p:C>p;l=0<=p?++C:--C)E.push(t.readUInt16());return E})(),i=(this.length-t.pos+this.offset)/2,a=(function(){var C,E;for(E=[],l=C=0;0<=i?C<i:C>i;l=0<=i?++C:--C)E.push(t.readUInt16());return E})(),l=P=0,I=n.length;P<I;l=++P)for(b=n[l],g=y[l],r=T=g;g<=b?T<=b:T>=b;r=g<=b?++T:--T)h[l]===0?s=r+c[l]:(u=h[l]/2+(r-g)-(p-l),s=a[u]||0,s!==0&&(s+=c[l])),this.codeMap[r]=s&65535}t.pos=d}return o.encode=function(t,e){var r,i,n,s,a,l,c,h,u,d,p,m,g,y,b,P,T,I,C,E,O,_,x,v,D,w,F,H,z,V,W,L,k,N,U,B,G,Y,X,K,J,se,ce,te,oe,$;switch(H=new ZD,s=Object.keys(t).sort(function(fe,Oe){return fe-Oe}),e){case"macroman":for(g=0,y=(function(){var fe=[];for(m=0;m<256;++m)fe.push(0);return fe})(),P={0:0},n={},z=0,k=s.length;z<k;z++)i=s[z],P[ce=t[i]]==null&&(P[ce]=++g),n[i]={old:t[i],new:P[t[i]]},y[i]=P[t[i]];return H.writeUInt16(1),H.writeUInt16(0),H.writeUInt32(12),H.writeUInt16(0),H.writeUInt16(262),H.writeUInt16(0),H.write(y),{charMap:n,subtable:H.data,maxGlyphID:g+1};case"unicode":for(w=[],u=[],T=0,P={},r={},b=c=null,V=0,N=s.length;V<N;V++)i=s[V],C=t[i],P[C]==null&&(P[C]=++T),r[i]={old:C,new:P[C]},a=P[C]-i,(b==null||a!==c)&&(b&&u.push(b),w.push(i),c=a),b=i;for(b&&u.push(b),u.push(65535),w.push(65535),x=w.length,v=x*2,_=2*Math.pow(Math.log(x)/Math.LN2,2),d=Math.log(_/2)/Math.LN2,O=2*x-_,l=[],E=[],p=[],m=W=0,U=w.length;W<U;m=++W){if(D=w[m],h=u[m],D===65535){l.push(0),E.push(0);break}if(F=r[D].new,D-F>=32768)for(l.push(0),E.push(2*(p.length+x-m)),i=L=D;D<=h?L<=h:L>=h;i=D<=h?++L:--L)p.push(r[i].new);else l.push(F-D),E.push(0)}for(H.writeUInt16(3),H.writeUInt16(1),H.writeUInt32(12),H.writeUInt16(4),H.writeUInt16(16+x*8+p.length*2),H.writeUInt16(0),H.writeUInt16(v),H.writeUInt16(_),H.writeUInt16(d),H.writeUInt16(O),J=0,B=u.length;J<B;J++)i=u[J],H.writeUInt16(i);for(H.writeUInt16(0),se=0,G=w.length;se<G;se++)i=w[se],H.writeUInt16(i);for(te=0,Y=l.length;te<Y;te++)a=l[te],H.writeUInt16(a);for(oe=0,X=E.length;oe<X;oe++)I=E[oe],H.writeUInt16(I);for($=0,K=p.length;$<K;$++)g=p[$],H.writeUInt16(g);return{charMap:r,subtable:H.data,maxGlyphID:T+1}}},o})(),h$e=(function(o){PE(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="cmap",t.prototype.parse=function(e){var r,i,n;for(e.pos=this.offset,this.version=e.readUInt16(),n=e.readUInt16(),this.tables=[],this.unicode=null,i=0;0<=n?i<n:i>n;i=0<=n?++i:--i)r=new i$e(e,this.offset),this.tables.push(r),r.isUnicode&&this.unicode==null&&(this.unicode=r);return!0},t.encode=function(e,r){var i,n;return r==null&&(r="macroman"),i=i$e.encode(e,r),n=new ZD,n.writeUInt16(0),n.writeUInt16(1),i.table=n.data.concat(i.subtable),i},t})(n9),DDt=(function(o){PE(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="hhea",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.ascender=e.readShort(),this.decender=e.readShort(),this.lineGap=e.readShort(),this.advanceWidthMax=e.readShort(),this.minLeftSideBearing=e.readShort(),this.minRightSideBearing=e.readShort(),this.xMaxExtent=e.readShort(),this.caretSlopeRise=e.readShort(),this.caretSlopeRun=e.readShort(),this.caretOffset=e.readShort(),e.pos+=8,this.metricDataFormat=e.readShort(),this.numberOfMetrics=e.readUInt16()},t})(n9),wDt=(function(o){PE(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="OS/2",t.prototype.parse=function(e){if(e.pos=this.offset,this.version=e.readUInt16(),this.averageCharWidth=e.readShort(),this.weightClass=e.readUInt16(),this.widthClass=e.readUInt16(),this.type=e.readShort(),this.ySubscriptXSize=e.readShort(),this.ySubscriptYSize=e.readShort(),this.ySubscriptXOffset=e.readShort(),this.ySubscriptYOffset=e.readShort(),this.ySuperscriptXSize=e.readShort(),this.ySuperscriptYSize=e.readShort(),this.ySuperscriptXOffset=e.readShort(),this.ySuperscriptYOffset=e.readShort(),this.yStrikeoutSize=e.readShort(),this.yStrikeoutPosition=e.readShort(),this.familyClass=e.readShort(),this.panose=(function(){var r,i;for(i=[],r=0;r<10;++r)i.push(e.readByte());return i})(),this.charRange=(function(){var r,i;for(i=[],r=0;r<4;++r)i.push(e.readInt());return i})(),this.vendorID=e.readString(4),this.selection=e.readShort(),this.firstCharIndex=e.readShort(),this.lastCharIndex=e.readShort(),this.version>0&&(this.ascent=e.readShort(),this.descent=e.readShort(),this.lineGap=e.readShort(),this.winAscent=e.readShort(),this.winDescent=e.readShort(),this.codePageRange=(function(){var r,i;for(i=[],r=0;r<2;r=++r)i.push(e.readInt());return i})(),this.version>1))return this.xHeight=e.readShort(),this.capHeight=e.readShort(),this.defaultChar=e.readShort(),this.breakChar=e.readShort(),this.maxContext=e.readShort()},t})(n9),LDt=(function(o){PE(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="post",t.prototype.parse=function(e){var r,i,n;switch(e.pos=this.offset,this.format=e.readInt(),this.italicAngle=e.readInt(),this.underlinePosition=e.readShort(),this.underlineThickness=e.readShort(),this.isFixedPitch=e.readInt(),this.minMemType42=e.readInt(),this.maxMemType42=e.readInt(),this.minMemType1=e.readInt(),this.maxMemType1=e.readInt(),this.format){case 65536:break;case 131072:i=e.readUInt16(),this.glyphNameIndex=[];var s;for(s=0;0<=i?s<i:s>i;s=0<=i?++s:--s)this.glyphNameIndex.push(e.readUInt16());for(this.names=[],n=[];e.pos<this.offset+this.length;)r=e.readByte(),n.push(this.names.push(e.readString(r)));return n;case 151552:return i=e.readUInt16(),this.offsets=e.read(i);case 196608:break;case 262144:return this.map=(function(){var a,l,c;for(c=[],s=a=0,l=this.file.maxp.numGlyphs;0<=l?a<l:a>l;s=0<=l?++a:--a)c.push(e.readUInt32());return c}).call(this)}},t})(n9),MDt=(function(){function o(t,e){this.raw=t,this.length=t.length,this.platformID=e.platformID,this.encodingID=e.encodingID,this.languageID=e.languageID}return o})(),NDt=(function(o){PE(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="name",t.prototype.parse=function(e){var r,i,n,s,a,l,c,h,u,d,p;for(e.pos=this.offset,e.readShort(),r=e.readShort(),l=e.readShort(),i=[],s=0;0<=r?s<r:s>r;s=0<=r?++s:--s)i.push({platformID:e.readShort(),encodingID:e.readShort(),languageID:e.readShort(),nameID:e.readShort(),length:e.readShort(),offset:this.offset+l+e.readShort()});for(c={},s=u=0,d=i.length;u<d;s=++u)n=i[s],e.pos=n.offset,h=e.readString(n.length),a=new MDt(h,n),c[p=n.nameID]==null&&(c[p]=[]),c[n.nameID].push(a);this.strings=c,this.copyright=c[0],this.fontFamily=c[1],this.fontSubfamily=c[2],this.uniqueSubfamily=c[3],this.fontName=c[4],this.version=c[5];try{this.postscriptName=c[6][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}catch{this.postscriptName=c[4][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}return this.trademark=c[7],this.manufacturer=c[8],this.designer=c[9],this.description=c[10],this.vendorUrl=c[11],this.designerUrl=c[12],this.license=c[13],this.licenseUrl=c[14],this.preferredFamily=c[15],this.preferredSubfamily=c[17],this.compatibleFull=c[18],this.sampleText=c[19]},t})(n9),kDt=(function(o){PE(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="maxp",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.numGlyphs=e.readUInt16(),this.maxPoints=e.readUInt16(),this.maxContours=e.readUInt16(),this.maxCompositePoints=e.readUInt16(),this.maxComponentContours=e.readUInt16(),this.maxZones=e.readUInt16(),this.maxTwilightPoints=e.readUInt16(),this.maxStorage=e.readUInt16(),this.maxFunctionDefs=e.readUInt16(),this.maxInstructionDefs=e.readUInt16(),this.maxStackElements=e.readUInt16(),this.maxSizeOfInstructions=e.readUInt16(),this.maxComponentElements=e.readUInt16(),this.maxComponentDepth=e.readUInt16()},t})(n9),BDt=(function(o){PE(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="hmtx",t.prototype.parse=function(e){var r,i,n,s,a,l,c;for(e.pos=this.offset,this.metrics=[],r=0,l=this.file.hhea.numberOfMetrics;0<=l?r<l:r>l;r=0<=l?++r:--r)this.metrics.push({advance:e.readUInt16(),lsb:e.readInt16()});for(n=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=(function(){var h,u;for(u=[],r=h=0;0<=n?h<n:h>n;r=0<=n?++h:--h)u.push(e.readInt16());return u})(),this.widths=(function(){var h,u,d,p;for(d=this.metrics,p=[],h=0,u=d.length;h<u;h++)s=d[h],p.push(s.advance);return p}).call(this),i=this.widths[this.widths.length-1],c=[],r=a=0;0<=n?a<n:a>n;r=0<=n?++a:--a)c.push(this.widths.push(i));return c},t.prototype.forGlyph=function(e){return e in this.metrics?this.metrics[e]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[e-this.metrics.length]}},t})(n9),u$e=[].slice,FDt=(function(o){PE(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="glyf",t.prototype.parse=function(){return this.cache={}},t.prototype.glyphFor=function(e){var r,i,n,s,a,l,c,h,u,d;return e in this.cache?this.cache[e]:(s=this.file.loca,r=this.file.contents,i=s.indexOf(e),n=s.lengthOf(e),n===0?this.cache[e]=null:(r.pos=this.offset+i,l=new ZD(r.read(n)),a=l.readShort(),h=l.readShort(),d=l.readShort(),c=l.readShort(),u=l.readShort(),a===-1?this.cache[e]=new GDt(l,h,d,c,u):this.cache[e]=new VDt(l,a,h,d,c,u),this.cache[e]))},t.prototype.encode=function(e,r,i){var n,s,a,l,c,h;for(l=[],a=[],c=0,h=r.length;c<h;c++)s=r[c],n=e[s],a.push(l.length),n&&(l=l.concat(n.encode(i)));return a.push(l.length),{table:l,offsets:a}},t})(n9),VDt=(function(){function o(t,e,r,i,n,s){this.raw=t,this.numberOfContours=e,this.xMin=r,this.yMin=i,this.xMax=n,this.yMax=s,this.compound=!1}return o.prototype.encode=function(){return this.raw.data},o})(),GDt=(function(){var o,t,e,r,i;o=1,r=8,t=32,e=64,i=128;function n(s,a,l,c,h){var u,d;for(this.raw=s,this.xMin=a,this.yMin=l,this.xMax=c,this.yMax=h,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],u=this.raw;d=u.readShort(),this.glyphOffsets.push(u.pos),this.glyphIDs.push(u.readUInt16()),!!(d&t);)d&o?u.pos+=4:u.pos+=2,d&i?u.pos+=8:d&e?u.pos+=4:d&r&&(u.pos+=2)}return n.prototype.encode=function(){var s,a,l,c;for(a=new ZD(u$e.call(this.raw.data)),c=this.glyphIDs,s=0,l=c.length;s<l;++s)a.pos=this.glyphOffsets[s];return a.data},n})(),UDt=(function(o){PE(t,o);function t(){return t.__super__.constructor.apply(this,arguments)}return t.prototype.tag="loca",t.prototype.parse=function(e){var r,i;return e.pos=this.offset,r=this.file.head.indexToLocFormat,r===0?this.offsets=(function(){var n,s;for(s=[],i=0,n=this.length;i<n;i+=2)s.push(e.readUInt16()*2);return s}).call(this):this.offsets=(function(){var n,s;for(s=[],i=0,n=this.length;i<n;i+=4)s.push(e.readUInt32());return s}).call(this)},t.prototype.indexOf=function(e){return this.offsets[e]},t.prototype.lengthOf=function(e){return this.offsets[e+1]-this.offsets[e]},t.prototype.encode=function(e,r){for(var i=new Uint32Array(this.offsets.length),n=0,s=0,a=0;a<i.length;++a)if(i[a]=n,s<r.length&&r[s]==a){++s,i[a]=n;var l=this.offsets[a],c=this.offsets[a+1]-l;c>0&&(n+=c)}for(var h=new Array(i.length*4),u=0;u<i.length;++u)h[4*u+3]=i[u]&255,h[4*u+2]=(i[u]&65280)>>8,h[4*u+1]=(i[u]&16711680)>>16,h[4*u]=(i[u]&4278190080)>>24;return h},t})(n9),HDt=function(o){var t,e,r;e={};for(t in o)r=o[t],e[r]=t;return e},WDt=(function(){function o(t){this.font=t,this.subset={},this.unicodes={},this.next=33}return o.prototype.generateCmap=function(){var t,e,r,i,n;i=this.font.cmap.tables[0].codeMap,t={},n=this.subset;for(e in n)r=n[e],t[e]=i[r];return t},o.prototype.glyphsFor=function(t){var e,r,i,n,s,a,l;for(i={},s=0,a=t.length;s<a;s++)n=t[s],i[n]=this.font.glyf.glyphFor(n);e=[];for(n in i)r=i[n],r!=null&&r.compound&&e.push.apply(e,r.glyphIDs);if(e.length>0){l=this.glyphsFor(e);for(n in l)r=l[n],i[n]=r}return i},o.prototype.encode=function(t,e){var r,i,n,s,a,l,c,h,u,d,p,m,g,y,b;r=h$e.encode(this.generateCmap(),"unicode"),s=this.glyphsFor(t),p={0:0},b=r.charMap;for(i in b)l=b[i],p[l.old]=l.new;d=r.maxGlyphID;for(m in s)m in p||(p[m]=d++);return h=HDt(p),u=Object.keys(h).sort(function(P,T){return P-T}),g=(function(){var P,T,I;for(I=[],P=0,T=u.length;P<T;P++)a=u[P],I.push(h[a]);return I})(),n=this.font.glyf.encode(s,g,p),c=this.font.loca.encode(n.offsets,g),y={cmap:this.font.cmap.raw(),glyf:n.table,loca:c,hmtx:this.font.hmtx.raw(),hhea:this.font.hhea.raw(),maxp:this.font.maxp.raw(),post:this.font.post.raw(),name:this.font.name.raw(),head:this.font.head.encode(e)},this.font.os2.exists&&(y["OS/2"]=this.font.os2.raw()),this.font.directory.encode(y)},o})();function zDt(o){for(let t in o)Array.isArray(o[t])&&(o[t].length=0),delete o[t]}(function(o){"use strict";var t,e,r,i=6,n=13,s,a={x:void 0,y:void 0,w:void 0,h:void 0,ln:void 0},l=1,c=function(m,g,y,b,P){a={x:m,y:g,w:y,h:b,ln:P}},h=function(){return a},u,d,p={left:0,top:0,bottom:0};o.setHeaderFunction=function(m){s=m},o.getTextDimensions=function(m,g){var y=this.table_font_size||this.internal.getFontSize(),b=this.internal.getFont().fontStyle;g=g||{};var P=g.scaleFactor||this.internal.scaleFactor,T=0,I=0,C=0,E=0,O=0;if(typeof m=="string")T=this.getStringUnitWidth(m)*y,T!==0&&(I=1);else if(Object.prototype.toString.call(m)==="[object Array]"){for(var _=0;_<m.length;_++)E=this.getStringUnitWidth(m[_])*y,T<E&&(T=E);T!==0&&(I=m.length)}else throw new Error("getTextDimensions expects text-parameter to be of type String or an Array of Strings.");return T=T/P,C=Math.max((I*y*this.getLineHeightFactor()-y*(this.getLineHeightFactor()-1))/P,0),{w:T,h:C}},o.cellAddPage=function(){var m=this.margins||p;this.addPage(),c(m.left,m.top,void 0,void 0),l+=1},o.cellInitialize=function(){a={x:void 0,y:void 0,w:void 0,h:void 0,ln:void 0},l=1},o.cell=async function(m,g,y,b,P,T,I){var C=h(),E=!1;if(C.ln!==void 0)if(C.ln===T)m=C.x+C.w,g=C.y;else{var O=this.margins||p;C.y+C.h+b+n>=this.internal.pageSize.getHeight()-O.bottom&&(await(u==null?void 0:u()),this.cellAddPage(),await(d==null?void 0:d()),E=!0),g=h().y+h().h,E&&(g=(O==null?void 0:O.top)||n+10)}if(P[0]!==void 0)if(this.printingHeaderRow?this.rect(m,g,y,b,"FD"):this.rect(m,g,y,b),I==="right"){P instanceof Array||(P=[P]);for(var _=0;_<P.length;_++){var x=P[_],v=this.getStringUnitWidth(x)*this.internal.getFontSize()/this.internal.scaleFactor;this.text(x,m+y-v-i,g+this.internal.getLineHeight()*(_+1)+i)}}else this.text(P,m+i,g+this.internal.getLineHeight()+i);return c(m,g,y,b,T),this},o.arrayMax=function(m,g){var y=m[0],b,P,T;for(b=0,P=m.length;b<P;b+=1)T=m[b],g?g(y,T)===-1&&(y=T):T>y&&(y=T);return y},o.table=async function(m,g,y,b,P){if(!y)throw"No data for PDF table";var T=[],I=[],C,E,O,_,x={},v={},D,w,F=[],H,z=[],V,W,L,k=!1,N=!0,U=12,B=p;if(B.width=this.internal.pageSize.getWidth(),P&&(P.autoSize===!0&&(k=!0),P.printHeaders===!1&&(N=!1),P.fontSize&&(U=P.fontSize),P.css&&typeof P.css["font-size"]<"u"&&(U=P.css["font-size"]*16),P.margins&&(B=P.margins),P.beforeCellAddPage&&(u=P.beforeCellAddPage),P.afterCellAddPage&&(d=P.afterCellAddPage)),this.lnMod=0,a={x:void 0,y:void 0,w:void 0,h:void 0,ln:void 0},l=1,this.printHeaders=N,this.margins=B,this.setFontSize(U),this.table_font_size=U,b==null)T=Object.keys(y[0]);else if(b[0]&&typeof b[0]!="string"){var G=1;for(E=0,O=b.length;E<O;E+=1)C=b[E],T.push(C.name),I.push(C.prompt),v[C.name]=C.width*G}else T=b;if(k)for(L=function(X){return X[C]},E=0,O=T.length;E<O;E+=1){for(C=T[E],x[C]=y.map(L),F.push(this.getTextDimensions(I[E]||C,{scaleFactor:1}).w),w=x[C],H=0,_=w.length;H<_;H+=1)D=w[H],F.push(this.getTextDimensions(D,{scaleFactor:1}).w);v[C]=o.arrayMax(F),F=[]}if(N){var Y=this.calculateLineHeight(T,v,I.length?I:T);for(E=0,O=T.length;E<O;E+=1)C=T[E],z.push([m,g,v[C],Y,I.length?I[E]:C]);this.setTableHeaderRow(z),await this.printHeaderRow(1,!1)}for(E=0,O=y.length;E<O;E+=1){var Y;for(V=y[E],Y=this.calculateLineHeight(T,v,V),H=0,W=T.length;H<W;H+=1)C=T[H],await this.cell(m,g,v[C],Y,V[C],E+2,C.align)}return this.lastCellPos=a,this.table_x=m,this.table_y=g,this},o.calculateLineHeight=function(m,g,y){for(var b,P=0,T=0;T<m.length;T++){b=m[T];let C=Array.isArray(y)?T:b;y[C]=this.splitTextToSize(String(y[C]),g[b]-i);var I=this.internal.getLineHeight()*y[C].length/.72+i;I>P&&(P=I)}return P},o.setTableHeaderRow=function(m){this.tableHeaderRow=m},o.printHeaderRow=async function(m,g){if(!this.tableHeaderRow)throw"Property tableHeaderRow does not exist.";var y,b,P,T;if(this.printingHeaderRow=!0,s!==void 0){var I=s(this,l);c(I[0],I[1],I[2],I[3],-1)}this.setFont("Arial,Bold");var C=[];for(P=0,T=this.tableHeaderRow.length;P<T;P+=1)this.setFillColor(200,200,200),y=this.tableHeaderRow[P],g&&(this.margins.top=n,y[1]=this.margins&&this.margins.top||0,C.push(y)),b=[].concat(y),await this.cell.apply(this,b.concat(m));C.length>0&&this.setTableHeaderRow(C),this.setFont("Arial"),this.printingHeaderRow=!1}})(l$e.API);var d$e=l$e;var jDt=["\u5B8B\u4F53","Times New Roman","Arial","helvetica","sans-serif","monospace","Tahoma","Courier New","MS Gothic","Arial Black","Arial Narrow","Verdana","\u9ED1\u4F53","\u6977\u4F53","\u4EFF\u5B8B","\u96B6\u4E66"];function XDt(o,t,e,r,i,n,s,a,l){var c=Math.PI*2;function h(B,G,Y,X){var K=B*Y+G*X,J=Math.sqrt((B*B+G*G)*(Y*Y+X*X)),se=Math.acos(K/J);return B*X-G*Y<0&&(se=-se),se}function u(B){for(;B>=c;)B-=c;for(;B<0;)B+=c;return B}function d(B){return B.rx=s,B.ry=a,B.startAngle=B.theta1,B.endAngle=u(B.theta1+B.delta_theta),B}var p,m,g,y,b=1e-5;s<0&&(s=-s),a<0&&(a=-a),s==a&&(l=0);var P=Math.sin(l),T=Math.cos(l),I=(o-e)/2,C=(t-r)/2,E=(o+e)/2,O=(t+r)/2;if(s<b||a<b)return g=h(1,0,e-o,r-t),d({cx:E,cy:O,theta1:g,delta_theta:Math.PI});var _=T*I+P*C,x=T*C-P*I,v=_*_/(s*s)+x*x/(a*a);v>1&&(s=s*Math.sqrt(v),a=a*Math.sqrt(v));var D=s*a,w=s*x,F=a*_,H=w*w+F*F;if(!H)return d({cx:E,cy:O,theta1:0,delta_theta:0});var z=(D*D-H)/H;z=Math.sqrt(Math.abs(z)),!!i==!!n&&(z=-z);var V=z*w/a,W=-z*F/s;p=T*V-P*W+E,m=P*V+T*W+O;var L=(_-V)/s,k=(_+V)/s,N=(x-W)/a,U=(x+W)/a;for(g=h(1,0,L,N),y=h(L,N,-k,-U);y>c;)y-=c;for(;y<0;)y+=c;return(n===!1||n===0)&&(y-=c),d({cx:p,cy:m,theta1:g,delta_theta:y})}var qDt={Properties:"\u5C5E\u6027"},b$=class{constructor(t){this.config=t;this.originX=0;this.originY=0;this.width=0;this.height=0;this.isMirror=!1;this.multiWatermark=(t,e,r,i)=>{this.pdfDoc.text(t,e.x,e.y,{align:"left",baseline:"bottom",angle:360-r.angleD(e)}),i&&this.pdfDoc.line(e.x,e.y,r.x,r.y)}}get needAnnot(){return this.config.needAnnot}get needMenu(){return this.config.needMenu}get language(){return this.config.language||"en"}get onlyShowStroke(){return this.config.onlyShowStroke}get segmentedExport(){return this.config.segmentedExport}get pdfWatermarkConfig(){return this.config.pdfWatermarkConfig}get customPdfWatermarkConfig(){return this.config.customPdfWatermarkConfig}async generateOne(t,e,r,i){let{bbox:n,shapes:s,color:a,isMirror:l,textArr:c,id:h,colorType:u,backgroundColor:d}=t;n||(n=new ht(-1,1,-1,1));let p=n.maxX-n.minX,m=n.maxY-n.minY;this.originX=n.minX,this.originY=n.maxY,this.width=p,this.height=m,this.isMirror=l,this.colorType=u,this.onProgress=e,this.jsonObj=t,this.pdfDoc?r&&(this.pdfDoc.addPage([p*.72,m*.72],p>m?"l":"p"),this.setBackground(n,this.colorType,d)):(this.pdfDoc=new d$e({orientation:p>m?"l":"p",format:[p*.72,m*.72],unit:"in"}),this.segmentedExport&&await e({title:`CreatePDF ${this.getCurrentPageNumber()} ${h}`,value:0,data:this.pdfDoc.buildDocumentStart("arrayBuffer")}),this.setBackground(n,this.colorType,d)),this.setPageColor(this.colorType,a),this.pdfDoc.saveGraphicState(),l&&this.pdfDoc.setCTM(-1,0,0,1,p*.72,0),r&&this.preDealText(c);for(let g=0;g<s.length;g++)await this.createShape(s[g]),g%1e4||await e({value:g/s.length*.7,title:`CreatePDF ${this.getCurrentPageNumber()} ${h}`});this.pdfDoc.restoreGraphicState(),i&&((LS||T9e)&&(this.setWatermark(this.pdfWatermarkConfig),this.setWatermark(this.customPdfWatermarkConfig)),this.segmentedExport&&await this.pdfDoc.buildDocumentContent("arrayBuffer",this.getCurrentPageNumber(),async g=>{await e({title:`CreatePDF ${this.getCurrentPageNumber()} ${h}`,data:g.data,value:.7+.3*g.value})})),await e({title:`CreatePDF ${this.getCurrentPageNumber()} ${h}`,value:1})}generateEnd(t){if(t&&this.outLine(t),this.segmentedExport)return this.pdfDoc.buildDocumentEnd("arrayBuffer")}outLine(t){let e=this;for(let i of t)r(i,null);function r(i,n){let{pageNumber:s,name:a}=i;if(!e.pdfDoc)return;let l=e.pdfDoc.outline.add(n,a,{pageNumber:s});if(i.children)for(let c of i.children)r(c,l)}}setPageColor(t,e){t==="Black on White"&&(e=[0,0,0,e[3]]),t==="White on Black"&&(e=[255,255,255,e[3]]),this.pageColor=e,e[3]&&e[3]!==1?this.pdfDoc.setColorWithOpacity(...e,"FD"):(e[3]=e[3]||Wfe,this.pdfDoc.setColorWithOpacity(...e,"FD")),this.pdfDoc.setTextColor(...this.bgColor)}setBackground(t,e,r){let i=[255,255,255],s=[0,0,0];e==="Black on White"?s=i:e==="Full Color"&&r&&(s=r.toRGBA().slice(0,3)),this.bgColor=s,this.pdfDoc.setFillColor(...s),this.pdfDoc.rect(t.minX-this.originX,-(t.maxY-this.originY),t.maxX-t.minX,t.maxY-t.minY,"F")}preDealText(t){for(let e of t){let{rotation:r,fontSize:i,fontFamily:n,matrix:s}=e,a=e.content;n=this.getFontFamily(n),i=this.getFontSize(i,n),this.pdfDoc.setFont(n,"normal"),this.pdfDoc.setFontSize(i);let l=a.split(`
`);this.pdfDoc.text(l,[s.data[0].toFixed(2),s.data[1].toFixed(2),s.data[4].toFixed(2),s.data[5].toFixed(2),((s.data[12]-this.originX)*.72-Math.sin(r)*(l.length-1)*i).toFixed(2),((s.data[13]+this.height-this.originY)*.72+Math.cos(r)*(l.length-1)*i).toFixed(2)])}}async createShape(t){let e=t.color,r=t.opacity;if(e?e==="transparent"?this.onlyShowStroke?this.pdfDoc.setColorWithOpacity(...this.bgColor,Math.max(r||Wfe),"F"):this.pdfDoc.setColorWithOpacity(...this.bgColor,Math.max(r||Wfe),"FD"):(this.pdfDoc.setColorWithOpacity(...e,"FD"),this.pdfDoc.setTextColor(...e.slice(0,3),{a:e.at(-1)})):(this.pdfDoc.setColorWithOpacity(...this.pageColor,"FD"),this.pdfDoc.setTextColor(...this.pageColor.slice(0,3),{a:this.pageColor.at(-1)})),t.primitives){let{primitives:i,strokeWidth:n,style:s,color:a,opacity:l,lineJoin:c}=t;n&&!this.onlyShowStroke?this.pdfDoc.setLineWidth(n||0):this.pdfDoc.setLineWidth(0),this.pdfDoc.setLineJoin(c||"0");for(let h of i){if(s!=="S"&&i.length>1){i.filter(u=>!(u instanceof M)).length?this.path(i,this.getPDFStyle(s)):this.lines(i,this.getPDFStyle(s));break}h instanceof M?this.line(h):h instanceof q?this.arc(h,this.getPDFStyle(s)):h instanceof Dr&&this.bezier(h,this.getPDFStyle(s))}}else t.headers?(this.pdfDoc.setFont(this.getFontFamily("Arial")),await this.table(t)):t.attr?this.setComponentAttr(t):this.text(t)}arc(t,e){let[r,i,n,s,a]=[t.rx,t.ry,t.start(),t.end(),t.center],{x:l,y:c}=a,[h,u,d,p]=[n.x,s.x,n.y,s.y];if(db(h,u,1e-12)&&db(d,p,1e-12)&&db(r,i,1e-12))return this.circle({x:l,y:c,r},e);let m=this.pdfDoc.context2d;m.beginPath(),m.moveTo(h-this.originX,this.originY-d),this.context2dDrawArc(t,!1,e),m.closePath(),e=e==="F"?"fill":e==="S"?"stroke":"strokeFill",m.drawPaths(e)}bezier(t,e){let{x:r,y:i}=t.start(),n=this.pdfDoc.context2d;n.beginPath(),n.moveTo(r-this.originX,this.originY-i),this.context2dDrawBezier(t,!1),n.closePath(),e=e==="F"?"fill":e==="S"?"stroke":"strokeFill",n.drawPaths(e)}text(t){let{strokeWidth:e}=t;this.pdfDoc.setLineWidth(e||0);let r=t.shapes||[],i=[];if(!r.length)return;for(let s of r)s&&(s instanceof Cp?i.push(s):this.path(s.primitives,"S"));let n=i.reduce((s,a,l)=>(s.push(...a.pl.primitives),l!==i.length-1&&s.push("m"),s),[]);n.length&&this.path(n,"F")}line(t){let[e,r]=[t.start(),t.end()],[i,n,s,a]=[e.x,e.y,r.x,r.y];i-=this.originX,s-=this.originX,n=this.originY-n,a=this.originY-a,this.pdfDoc.setLineCap("1"),this.pdfDoc.line(i,n,s,a)}circle(t,e){let{x:r,y:i,r:n}=t;r-=this.originX,i=this.originY-i,this.pdfDoc.circle(r,i,n,e||"F")}lines(t,e){let{x:r,y:i}=t[0].start();r-=this.originX,i=this.originY-i;let n=t.slice(1).reduce((s,a,l)=>{let c=a.start(),u=t[l].start(),[d,p]=[c.x,c.y],[m,g]=[u.x,u.y];return s.push([d-m,-(p-g)]),s},[]);this.pdfDoc.lines(n,r,i,[1,1],e,!0)}isCircleArc(t){try{let[e,r,i,n]=[t.rx,t.ry,t.center,t.start(),t.end()],[s,a,l,c]=[i.x,n.x,i.y,n.y];return s===a&&l===c&&e===r}catch{return!1}}path(t,e){let r=t[0],{x:i,y:n}=r.start();i-=this.originX,n=this.originY-n;let s=this.pdfDoc.context2d,a=!1;s.beginPath(),this.pdfDoc.setLineCap(1),t[0]instanceof q&&this.isCircleArc(t[0])||s.moveTo(i,n);for(let l of t)l==="m"?a=!0:(l instanceof q?this.context2dDrawArc(l,a,e):l instanceof M?this.context2dDrawLine(l,a):l instanceof Dr&&this.context2dDrawBezier(l,a),a=!1);s.closePath(),e=e==="F"?"fill":e==="S"?"stroke":"strokeFill",s.drawPaths(e)}context2dDrawArc(t,e=!1,r){let i=this.pdfDoc.context2d,[n,s,a,l,c,h,u]=[t.rx,t.ry,t.sweepAngle,t.center,t.start(),t.end(),t.isCCW],{x:d,y:p}=l,[m,g,y,b]=[c.x,h.x,c.y,h.y];if(db(m,g,1e-12)&&db(y,b,1e-12)&&db(n,s,1e-12)){this.circle({x:d,y:p,r:n},r);return}d-=this.originX,m-=this.originX,g-=this.originX,p=this.originY-p,y=this.originY-y,b=this.originY-b,a=a*Math.PI/180;let P=Math.abs(a)>zh?1:0,T=XDt(m,y,g,b,P,!u,n,s,0);e&&i.moveTo(m,y),i.arc(m,y,g,b,T.cx,T.cy,T.rx,T.ry,T.startAngle,T.endAngle,Math.abs(T.delta_theta),T.delta_theta<0)}context2dDrawLine(t,e=!1){let r=this.pdfDoc.context2d,i=t.end(),n=t.start(),{x:s,y:a}=i;s-=this.originX,a=this.originY-a,e&&r.moveTo(n.x-this.originX,this.originY-n.y),r.lineTo(s,a)}context2dDrawBezier(t,e=!1){let r=this.pdfDoc.context2d,{controls:i}=t,[n,s,a,l,c,h,u,d]=[i[0].x-this.originX,this.originY-i[0].y,i[1].x-this.originX,this.originY-i[1].y,i[2].x-this.originX,this.originY-i[2].y,i[3].x-this.originX,this.originY-i[3].y];e&&r.moveTo(n,s),r.bezierCurveTo(a,l,c,h,u,d)}setComponentAttr(t){let{attr:e,box:r,device:i,globalIndex:n}=t;e.ID={k:"ID",v:n};let s="",a=[`'${this.language==="en"?"Properties":qDt.Properties}:'`],{leftUp:l,leftLow:c,rightUp:h,rightLow:u,width:d,height:p}=r,m=[l.x,c.x,u.x,h.x],g=[l.y,c.y,u.y,h.y],y=h.x-l.x===0&&l.y-c.y===0,[b,P]=[y?p:d,y?d:p],[T,I]=[this.isMirror?this.width-Math.max(...m):Math.min(...m),Math.max(...g)];T=this.isMirror?T+this.originX:T-this.originX,I=this.originY-I;for(let O of E(e)){let{k:_,v:x}=O,v=`${_} : ${x}`;s+=`${v}
`,a.push(`'${v.replace(/'/g,"\\'")}'`)}this.needAnnot&&this.pdfDoc.createAnnotation({type:"text",contentType:"code",title:C(i),bounds:{x:T,y:I,w:b,h:P},contents:C(s),open:!1}),this.needMenu&&this.pdfDoc.createAnnotation({type:"link",contentType:"code",bounds:{x:T,y:I,w:b,h:P},js:C(`var item = app.popUpMenu([${a.join(", ")}] )`)});function C(O){let _="FEFF";for(let v=0;v<O.length;v++){let w=O.charCodeAt(v).toString(16);_+=x(w)}function x(v){let D=v,w=4-v.length;for(;w;)D=`0${D}`,w--;return D}return _}function E(O){let _=["Layer","ID","Name","Unique ID","Add into BOM","Designator","Device","Footprint","zh"],x=[],v=[];return Hn(O,(D,w,F)=>{_.includes(D)?x.push({k:D,v:w}):v.push({k:D,v:w})}),x.sort((D,w)=>(D=_.indexOf(D.k),w=_.indexOf(w.k),D>w?1:-1)),v.sort((D,w)=>D.k.localeCompare(w.k)),x.concat(v).map(D=>{let{k:w,v:F}=D.v;return{k:w,v:F}})}}setWatermark(t){if(!t)return;let{fontSize:e,color:r,rowGap:i,columnGap:n,deg:s,underline:a=!1,italic:l=!1,bold:c=!1,fontFamily:h="serif"}=t,u=t.text;this.pdfDoc.setFont(this.getFontFamily(h,c,l)),this.pdfDoc.setFontSize(this.getFontSize(e,h)),this.pdfDoc.setTextColor(...r.slice(0,3),{a:r[r.length-1]}),this.pdfDoc.setColorWithOpacity(...r,"FD"),a&&this.pdfDoc.setLineWidth(e/9);let d=this.pdfDoc.getTextWidth(u),p=this.pdfDoc.getLineHeightFactor()*e;if(!i&&!n){let O=this.width/2,_=this.height/2;this.centerWatermark(u,O,_,s,a,d,p);return}let m=d+n,g=p+i,y=(s||0)/180*Math.PI,b=gn(Math.cos(y),4),P=gn(Math.sin(y),4),T=new S(g*P,g*b),I=new S(m*b,-m*P),C=new ht(0,this.width,0,this.height),E=new S(0,p);[1,-1].forEach((O,_)=>{let x=T.mul(O),v=!0,D=_===0?E:E.add(x),w=D.add1(d,0).rotateD(D,360-s),F=new _e().ext3([D,w]).build();for(;v;){v=!1;let H=new S(D.x,D.y).add(I),z=H.add1(d,0).rotateD(H,360-s),V=new _e().ext3([H,z]).build();for(;V.isInside(C)||V.isIntersect(C);)this.multiWatermark(u,H,z,a),H=H.add(I),z=H.add1(d,0).rotateD(H,360-s),V=new _e().ext3([H,z]).build(),v=!0;let W=new S(D.x,D.y).add(I.mul(-1)),L=W.add1(d,0).rotateD(W,360-s),k=new _e().ext3([W,L]).build();for(;k.isInside(C)||k.isIntersect(C);)this.multiWatermark(u,W,L,a),W=W.add(I.mul(-1)),L=W.add1(d,0).rotateD(W,360-s),k=new _e().ext3([W,L]).build(),v=!0;(F.isInside(C)||F.isIntersect(C))&&(this.multiWatermark(u,D,w,a),v=!0);let N=D.distance2(H),U=W.distance2(D),B=U===N?S.ORIGIN:U>N?I.mul(-1):I;D=D.add(B).add(x),w=D.add1(d,0).rotateD(D,360-s),F=new _e().ext3([D,w]).build()}})}centerWatermark(t,e,r,i,n,s,a){if(this.pdfDoc.text(t,e,r,{align:"center",baseline:"middle",angle:i}),n){let l=new S(e,r).add1(s*.5,a/2).rotateD(new S(e,r),360-i),c=new S(e,r).add1(-s*.5,a/2).rotateD(new S(e,r),360-i);this.pdfDoc.line(l.x,l.y,c.x,c.y)}}async table(t){let{x:e,y:r,headers:i,data:n,config:s}=t,a=this.getFontSize(s.fontSize||10,void 0);await this.pdfDoc.table(e-this.originX,this.originY-r,n,i,{...s,fontSize:a,beforeCellAddPage:async()=>{(LS||T9e)&&(this.setWatermark(this.pdfWatermarkConfig),this.setWatermark(this.customPdfWatermarkConfig)),this.segmentedExport&&await this.pdfDoc.buildDocumentContent("arrayBuffer",this.getCurrentPageNumber(),async l=>{await this.onProgress({title:`CreatePDF ${this.getCurrentPageNumber()} ${this.jsonObj.id}`,data:l.data,value:.7+.3*l.value})}),this.pdfDoc.setFont("Arial"),this.pdfDoc.setFontSize(a),this.pdfDoc.setColorWithOpacity(...this.pageColor,"FD"),this.pdfDoc.setTextColor(...this.pageColor.slice(0,3))}})}getFontFamily(t,e,r){let i="",n="";return jDt.includes(t)?t=="Times New Roman"?t="Times-Roman":t=="Courier New"?t="CourierNew":t=="helvetica"?t="Helvetica":t=="sans-serif"?t="Tahoma":t=="monospace"||t=="Courier New"?t="CourierNew":t=="MS Gothic"?t="MSGothic":t=="Arial Black"?t="ArialBlack":t=="Arial Narrow"?t="ArialNarrow":t==="\u5B8B\u4F53"?t="SimSun":t==="\u9ED1\u4F53"?t="SimHei":t==="\u6977\u4F53"?t="KaiTi":t==="\u4EFF\u5B8B"?t="FangSong":t==="\u96B6\u4E66"&&(t="LiSu"):t="Arial",e&&(e===!0||e=="bold"||e=="bolder"||Number(e)>=600)&&(i="Bold"),r&&r===!0&&(n="Italic"),t+(i||n?","+i+n:"")}getFontSize(t,e){return t*.72}getPDFStyle(t){return this.onlyShowStroke?"S":t}getPDFBlob(){return this.pdfDoc?this.pdfDoc.getPDFBlob():null}getCurrentPageNumber(){var t;return(t=this.pdfDoc)==null?void 0:t.getNumberOfPages()}removePDFDoc(){delete this.pdfDoc}};var mAe=Ru(YR());var O$e=Ru(r2());function m$e(o){return o.pageSet==="merged"||o.pageSet==="separated"}function fAe(o,t,e,r){return o.type==="Board Outline"&&r==="separated"?!0:!(!e.has(o.layerId)||!t.has(o.type))}function ZDt(o){return o.reduce((t,e)=>{let r=Yqe[e];return r&&t.set(r,1),t},new Map)}function g$e(o){return o.reduce((t,e)=>(t.set(e.layerId,1),t),new Map)}function y$e(o){return o.reduce((t,e)=>(t.set(e,1),t),new Map)}function b$e(o,t=[],e=[],r){let i=ZDt(e),n=g$e(t),s=y$e(e),a=new dt;Fi.getInstance().getAllItem().forEach(I=>{n.has(56)&&I.type==="Slot Region"&&a.conversion1("px(100)","mm",I.radius*2)<=h9e&&o.ext1(I.center.bbox().extendOfSize(XF/2)),fAe(I,i,n,r)&&o.ext1(I.buildBBox())}),Qi.getInstance().getAllItem().forEach(I=>{fAe(I,i,n,r)&&o.ext1(I.buildBBox())}),vi.getInstance().getAllItem().forEach(I=>{fAe(I,i,n,r)&&o.ext1(I.buildBBox())});let l=n.has(3),c=n.has(4),h=s.has("SurfaceMountComponentSilkscreen"),u=s.has("ThroughHoleComponentSilkscreen"),d=s.has("NotAddIntoBomWithNcMark"),p=s.has("NotAddIntoBomWithXMark");(h||u||d||p)&&Ms.getInstance().getAllItem().forEach(I=>{let C=JDt(I);d||p?o.ext1(I.buildBBox()):I.layerId===1?l&&s.has(C)&&o.ext1(I.buildBBox()):I.layerId===2&&c&&s.has(C)&&o.ext1(I.buildBBox())}),s.has("CopperFilled")&&qo.getInstance().getAllItem().forEach(I=>{n.has(I.layerId)&&o.ext1(I.buildBBox())}),s.has("Dimension")&&(Ma.getInstance().getAllItem().forEach(I=>{n.has(I.layerId)&&o.ext1(I.buildBBox())}),Na.getInstance().getAllItem().forEach(I=>{n.has(I.layerId)&&o.ext1(I.buildBBox())}),sl.getInstance().getAllItem().forEach(I=>{n.has(I.layerId)&&o.ext1(I.buildBBox())})),s.has("Image")&&Hs.getInstance().getAllItem().forEach(I=>{n.has(I.layerId)&&o.ext1(I.buildBBox())});let m=s.has("PadDrill"),g=n.has(47);jqe.some(I=>s.has(I))&&jn.getInstance().getAllItem().forEach(I=>{n.has(56)&&o.ext1(I.center.bbox().extendOfSize(XF/2));let C=QDt(I);switch(I.layerId){case 1:{s.has(C)&&[1,5,7].some(E=>n.has(E))&&o.ext1(I.buildBBox());break}case 2:{s.has(C)&&[2,6,8].some(E=>n.has(E))&&o.ext1(I.buildBBox());break}case 12:{(m&&g||s.has(C)&&[2,6,8,1,5,7].some(E=>n.has(E)))&&o.ext1(I.buildBBox());break}default:throw Error(`getBBox: not support pad on layer:${I.layerId}`)}});let y=s.has("Via"),b=s.has("ViaDrill");(y||b)&&bn.getInstance().getAllItem().forEach(I=>{n.has(56)&&o.ext1(I.center.bbox().extendOfSize(XF/2)),(n.has(I.layerId)||b&&n.has(47)||y&&[12,5,6].some(C=>n.has(C)))&&o.ext1(I.buildBBox())}),s.has("PlaneZone")&&Xo.getInstance().getAllItem().forEach(I=>{n.has(I.layerId)&&o.ext1(I.buildBBox())});let P=s.has("Text"),T=s.has("SurfaceMountComponentProperty")||s.has("ThroughHoleComponentProperty");(P||T)&&io.getInstance().getAllItem().forEach(I=>{let C=eme(I);n.has(I.layerId)&&s.has(C)&&I.getText()&&o.ext1(I.buildBBox())}),s.has("Track")&&Sn.getInstance().getAllItem().forEach(I=>{n.has(I.layerId)&&o.ext1(I.buildBBox())})}function P$e(o,t){switch(t){case"Bottom Auto Designator Placement":case"Top Auto Designator Placement":{let e=t==="Bottom Auto Designator Placement"?2:1;Ms.getInstance().getAllItem().forEach(r=>{r.layerId===e&&o.ext1(r.buildBBox())}),Fi.getInstance().getAllItem().concat(Qi.getInstance().getAllItem()).concat(vi.getInstance().getAllItem()).forEach(r=>{r.type==="Board Outline"&&o.ext1(r.buildBBox())});break}case"BOM":default:break}}function JDt(o){return PI(o)?"SurfaceMountComponentSilkscreen":"ThroughHoleComponentSilkscreen"}function QDt(o){let t=o.getParent(),e=o.layerId;if(t==null)switch(e){case 1:return t?t instanceof Bi?PI(t)?"SurfaceMountTopPad":"ThroughHoleTopPad":void 0:"IsolatedTopPad";case 2:return t?t instanceof Bi?PI(t)?"SurfaceMountBottomPad":"ThroughHoleBottomPad":void 0:"IsolatedTopPad";case 12:return t?t instanceof Bi?"ThroughHoleMultiPad":void 0:"IsolatedTopPad";default:throw Error(`getPadType: pad can not use layerId:${e}`)}}function eme(o){let t=o.getParent();if(o.key&&t instanceof Bi)return PI(t)?"SurfaceMountComponentProperty":"ThroughHoleComponentProperty";if(!o.key&&!t)return"Text";if(!o.key&&t instanceof Bi&&[3,4].includes(o.layerId))return PI(t)?"SurfaceMountComponentSilkscreen":"ThroughHoleComponentSilkscreen"}function tme(o){return{matrix:o.getMatrix(),bbox:o.bbox,rotation:o.rotation,fontSize:o.fontSize,fontFamily:o.fontFamily,strokeWidth:o.strokeWidth,content:o.getText(),shapes:o.getRealOutline()}}function T$e(o,t){let e=g$e(o),r=y$e(t);return io.getInstance().getAllItem().reduce((i,n)=>{if(!e.has(n.layerId))return i;let s=eme(n);return r.has(s)&&i.push({content:n.getText(),rotation:n.rotation,matrix:n.matrix,fontSize:n.fontSize,fontFamily:n.fontFamily}),i},[])}function rme(o,t){let e=o.getParent();switch(t){case"IsolatedTopPad":case"IsolatedMultiPad":case"IsolatedBottomPad":return e==null;case"SurfaceMountBottomPad":case"SurfaceMountTopPad":return e instanceof Bi&&PI(e);case"ThroughHoleBottomPad":case"ThroughHoleTopPad":case"ThroughHoleMultiPad":return e instanceof Bi&&!PI(e);case"PadDrill":return!0;default:throw Error("matchPad: error used!")}}function I$e(o,t){if(o.key==="")return!1;let e=o.getParent();switch(t){case"SurfaceMountComponentProperty":return e instanceof Bi&&PI(e);case"ThroughHoleComponentProperty":return e instanceof Bi&&!PI(e);default:throw Error("matchComponentProperty: error used!")}}function C$e(o,t){switch(t){case"SurfaceMountComponentSilkscreen":return PI(o);case"ThroughHoleComponentSilkscreen":return!PI(o);default:throw Error("matchComponentSilkscreen: error used!")}}var E$e=Ru(YR());var SU=class{constructor(t){this.parent=t}async generatePageEnd(t,e){let r=this.parent.ops.customPage.indexOf(t);if(this.parent.ops.pageSet==="separated"&&this.parent.ops.fileType!=="printPDF"){if(this.parent.ops.segmentedExport)await e({title:"CreatePDF",value:(r+1)/this.parent.ops.customPage.length,description:"",data:this.parent.createPDF.generateEnd()});else{this.parent.jsZIP||(this.parent.jsZIP=new E$e.default);let i=this.parent.createPDF.getPDFBlob();this.parent.jsZIP.file(this.getZipPath(t.name),i)}this.parent.createPDF.removePDFDoc()}}getZipPath(t){switch(this.parent.ops.pageSet){case"separated":case"merged":return`${t}.pdf`;default:return}}};var l0=class l0 extends SU{static getCellWidth(t){switch(t){case"Description":return this.DESCRIPTION_COLUMN_WIDTH;case"Designator":return this.DESIGNATOR_COLUMN_WIDTH;default:return this.DEFAULT_COLUMN_WIDTH}}async generatePage(t,e){let{colorType:r,name:i,specialFlag:n,bomInfo:s}=t,a=!0,l=!0,c=await this.getShapes(s),h=new ht(0,l0.PAGE_WIDTH,0,l0.PAGE_HEIGHT),u=this.parent.ops.customPage.indexOf(t);for(let d=0;d<c.length;d++)await this.parent.createPDF.generateOne({id:n,color:[0,0,0,1],isMirror:!1,shapes:c[d],bbox:h,textArr:[],colorType:r,backgroundColor:ee.WHITE},async p=>{let{data:m,value:g,title:y}=p,b=this.getZipPath(i);await e({title:"CreatePDF",value:(u+(d+g)/c.length)/this.parent.ops.customPage.length,data:m,path:b})},a,l);await this.generatePageEnd(t,e)}async getShapes(t){let r=((await he.windowBridge.rpcCall("getBomCsv",{...t,selectedId:R.getInstance().id},Q())).message||[]).filter(d=>d!==`
`).map(d=>d.split("	")),[i=[],...n]=r,s=[],a=[],l=l0.PAGE_WIDTH-l0.MARGIN*2,c=0,h=[];for(let d of i){let p=l0.getCellWidth(d);c+=p,c<=l?h.push({name:d,prompt:d,width:p}):(c=0,s.push(h),a.push([]),h=[{name:d,prompt:d,width:p}])}h.length&&s.push(h)&&a.push([]);for(let d of n){let p=0;for(let m=0;m<s.length;m++){let g=p+s[m].length;a[m].push(d.slice(p,g).reduce((y,b,P)=>(y[s[m][P].name]=b,y),{})),p=g}}let u=s.map((d,p)=>[{x:l0.MARGIN,y:l0.PAGE_HEIGHT-l0.MARGIN,headers:d,data:a[p],config:{fontSize:l0.FONT_SIZE,margins:{left:l0.MARGIN,top:l0.MARGIN,bottom:l0.MARGIN,width:l0.PAGE_WIDTH-2*l0.MARGIN}}}]);return u.length?u:[[]]}};l0.MARGIN=39.37,l0.DESCRIPTION_COLUMN_WIDTH=236.22,l0.DESIGNATOR_COLUMN_WIDTH=157.48,l0.DEFAULT_COLUMN_WIDTH=78.74,l0.PAGE_WIDTH=1170,l0.PAGE_HEIGHT=825,l0.FONT_SIZE=12;var ime=l0;var wg=class wg extends SU{constructor(e,r){super(e);this.type=r}get componentLayerId(){if(this.type==="TOP")return 1;if(this.type==="BOTTOM")return 2}get isMirror(){return this.type==="BOTTOM"}async generatePage(e,r){let{colorType:i,name:n,specialFlag:s}=e,a=!0,l=!0,{shapes:c,preText:h}=this.getShapes(),{cloneShapes:u,clonePreText:d}=this.getClonePanlizeShapes(c,h),p=this.parent.ops.customPage.indexOf(e);await this.parent.createPDF.generateOne({id:s,color:[0,0,0,1],isMirror:this.isMirror,shapes:Qg(c,u),bbox:this.parent.pageBBox,textArr:a&&Qg(h,d),colorType:i,backgroundColor:ee.WHITE},async m=>{let{data:g,value:y,title:b}=m,P=this.getZipPath(n);await r({title:"CreatePDF",value:(p+y)/this.parent.ops.customPage.length,data:g,path:P})},a,l),await this.generatePageEnd(e,r)}getShapes(){let e=this.parent.getBoardOutline(11).map(s=>(s.color=wg.OUTLINE_COLOR,s)),r=[],i=[],n=[];for(let s of Ms.getInstance().getAllItem()){let{box:a,layerId:l,designator:c}=s;if(l===this.componentLayerId){let{width:h,height:u,rotation:d,center:p}=a,m=Math.min(h,u),g=[new M(a.leftLow,a.leftUp),new M(a.leftUp,a.rightUp),new M(a.rightUp,a.rightLow),new M(a.rightLow,a.leftLow)];r.push({primitives:g,style:"S",color:wg.BOX_COLOR,strokeWidth:0});let y=Math.min(Math.max(m*3/4,wg.MIN_DESIGNATOR_HEIGHT),wg.MAX_DESIGNATOR_HEIGHT),b=h>u?d:(Go+d)%kr;b<0&&(b+=kr),b-wg.ROTATION_LIMIT_1>1e-4&&wg.ROTATION_LIMIT_2-b>1e-4&&(b>Go*3?b=wg.ROTATION_LIMIT_1:b=Math.max(b+zh,wg.ROTATION_LIMIT_2));let{path:P,width:T,height:I}=fd(c,y,y/10),C=5,E=new Ku(void 0,l,void 0,"",!1,c,!0,"default",y,b,p,C,this.getFontStrokeWidth(y),!1,0,!1,!1,P,T,I,!1),O=tme(E);O.color=wg.DESIGNATOR_COLOR,i.push(O),n.push({content:E.getText(),rotation:E.rotation,matrix:E.matrix,fontSize:E.fontSize,fontFamily:E.fontFamily})}}return{shapes:[].concat(e,r,i),preText:n}}getClonePanlizeShapes(e,r){let i=this.parent.getClonePanelizeShapes(e,null),n=[];if(this.parent.panelizeInfo.success&&!this.parent.panelizeInfo.onlyOutline){let{row:s,column:a}=this.parent.panelizeInfo,l=si.getInstance().offset;for(let c=0;c<s;c++)for(let h=0;h<a;h++){if(c===0&&h===0)continue;let u=Ae.translate(l.x*h,l.y*c,0);for(let d of r){let{matrix:p}=d,m=p.multiply4(u);n.push({...d,matrix:m})}}}return{cloneShapes:i,clonePreText:n}}getFontStrokeWidth(e){return this.parent.ops.onlyShowStroke?0:e/10}};wg.DESIGNATOR_COLOR=[255,0,0,1],wg.OUTLINE_COLOR=[192,128,192,1],wg.BOX_COLOR=[0,0,0,1],wg.MAX_DESIGNATOR_HEIGHT=4.7244,wg.MIN_DESIGNATOR_HEIGHT=2.3622,wg.ROTATION_LIMIT_1=Go,wg.ROTATION_LIMIT_2=Go*3+Go/90;var P$=wg;var EU=class o{constructor(t,e,r){this.ops=t;this.panelizeInfo=e;this.bridge=r;this.clearance=0;this.bboxFac=new _e;this.bomPageTool=new ime(this);this.topAutoDesignatorPageTool=new P$(this,"TOP");this.bottomAutoDesignatorPageTool=new P$(this,"BOTTOM");this._state="NORMAL";this._componentAttrMap=new Map;this._i18nMap=new Map;o.CURRENT_INSTANCE=this,t.customPage.forEach(i=>{var n,s,a;(n=i.layer)==null||n.sort((l,c)=>nAe.indexOf(l.layerId)>nAe.indexOf(c.layerId)?1:-1),(s=i.object)==null||s.sort((l,c)=>oAe.indexOf(l)>oAe.indexOf(c)?1:-1),i.layerMap=(a=i.layer)==null?void 0:a.reduce((l,c)=>(l.set(c.layerId,c),l),new Map),Hn(i.objectColor||{},(l,c)=>{let h=yTe(c);h&&(i.objectColor[l]=h)})})}get objectColor(){return this.ops.customPage[this.currentPageIndex].objectColor}get willCreatePageNumber(){var t;return(((t=this.createPDF)==null?void 0:t.getCurrentPageNumber())||0)+1}getSpecialPageTool(t){if(t==="BOM")return this.bomPageTool;if(t==="Top Auto Designator Placement")return this.topAutoDesignatorPageTool;if(t==="Bottom Auto Designator Placement")return this.bottomAutoDesignatorPageTool}get state(){return this._state}async getPdf(t,e,r){let{pageSet:i,needAnnot:n,needMenu:s,fileName:a,language:l,onlyShowStroke:c,customPage:h,fileType:u,pdfWatermarkConfig:d,segmentedExport:p,customPdfWatermarkConfig:m}=this.ops,g=n||s,y=[],b=i==="merged";this.isMerge=b,this.pageSet=i,this.pageBBox=this.getPageBBox(),this.onInterrupt=r;let P=this.createPDF=new b$({needAnnot:n,needMenu:s,language:l,onlyShowStroke:c,pdfWatermarkConfig:d,segmentedExport:p,customPdfWatermarkConfig:m});if(await pz(h,async(C,E,O)=>{if(this.state==="INTERRUPT")return;let{layer:_=[],object:x,colorType:v,name:D,background:w,specialFlag:F}=E;this.colorType=v,this.currentPageIndex=O;let H=i==="paged"?this.willCreatePageNumber:1;if(y.push({name:D,pageNumber:H}),F&&await this.getSpecialPageTool(F).generatePage(E,e),await pz(_,async(z,V,W)=>{if(this.state==="INTERRUPT")return;let{layerId:L,color:k}=V,N=ee.of3(k).toRGBA(),U=Ze.getInstance().getLayer(L),{isMirror:B,transparency:G}=V,Y=g?await this.getComponentAttr(L,b):[],X=this.getPanelize(L,x),K=x.reduce((ce,te)=>{let oe=this.getObjectShape(L,te);return Qg(oe,this.getClonePanelizeShapes(oe,te)),te==="CopperFilled"||te==="Image"||te==="PlaneZone"?oe.concat(ce):ce.concat(oe)},Y.concat(X));if(L===56&&x.includes("PadDrill")&&x.includes("ViaDrill")){let ce=this.getDrillDrawingLayerDrill();Qg(K,Qg(ce,this.getClonePanelizeShapes(ce,null)))}N[3]=1-G*.01;let J=W===0||i==="separated",se=W===_.length-1||i==="separated";if(await P.generateOne({id:L,color:N,isMirror:B,shapes:K,bbox:this.pageBBox,textArr:J&&this.getPrePageText(),colorType:v,backgroundColor:(w==null?void 0:w.color)&&ee.of3(w==null?void 0:w.color)},async ce=>{let{data:te,value:oe,title:$}=ce,fe=I(D,U);await e({title:"CreatePDF",value:(O+(oe+W)/_.length)/h.length,data:te,path:fe})},J,se),i==="separated"&&u!=="printPDF"){if(p)await e({title:"CreatePDF",value:(O+(1+W)/_.length)/h.length,description:"",data:P.generateEnd()});else{this.jsZIP||(this.jsZIP=new mAe.default);let ce=P.getPDFBlob();this.jsZIP.file(`${I(D,U)}.pdf`,ce)}P.removePDFDoc()}}),i==="merged"&&u!=="printPDF"){if(p)await e({title:"CreatePDF",value:(O+1)/h.length,description:"",data:P.generateEnd()});else{this.jsZIP||(this.jsZIP=new mAe.default);let z=P.getPDFBlob();this.jsZIP.file(`${I(D,void 0)}.pdf`,z)}P.removePDFDoc()}}),this.state==="INTERRUPT")return;if(i==="separated"||i==="merged"){if(!p){u==="printPDF"?t(P.getPDFBlob(),null,null):await this.jsZIP.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:6}}).then(C=>t(C,a,"zip"));return}}else{let C=P.generateEnd(y);await e({title:"CreatePDF",value:1,description:"",data:C})}await e({title:"DownloadPDF",value:0});let T=p?null:P.getPDFBlob();await t(T,a,i==="paged"?"pdf":"zip"),await e({title:"DownloadPDF",value:1});function I(C,E){switch(i){case"separated":return`${C}/${E.name}.pdf`;case"merged":return`${C}.pdf`;default:return}}}getObjectShape(t,e){switch(e){case"NotAddIntoBomWithNcMark":return this.getNotAddIntoBomWithNcMark(t);case"NotAddIntoBomWithXMark":return this.getNotAddIntoBomWithXMark(t);case"IsolatedTopPad":case"ThroughHoleTopPad":case"SurfaceMountTopPad":return this.getTopPad(t,e);case"IsolatedBottomPad":case"ThroughHoleBottomPad":case"SurfaceMountBottomPad":return this.getBottomPad(t,e);case"IsolatedMultiPad":case"ThroughHoleMultiPad":return this.getMultiPad(t,e);case"Via":return this.getVia(t);case"PadDrill":return this.getPadDrill(t);case"ViaDrill":return this.getViaDrill(t);case"Track":return this.getTrack(t);case"Text":return this.getText(t);case"Image":return this.getImage(t);case"Dimension":return this.getDimension(t);case"BoardOutline":return this.getBoardOutline(t);case"BoardCutout":return this.getBoardCutout(t);case"CopperOutline":return this.getCopperOutline(t);case"CopperFilled":return this.getCopperFilled(t);case"SolidRegion":return this.getSolidRegion(t);case"ProhibitedRegion":return this.getProhibitedRegion(t);case"FPCStiffener":return this.getFPCStiffener(t);case"Line":return this.getLine(t);case"PlaneZone":return this.getPlaneZone(t);case"SurfaceMountComponentProperty":case"ThroughHoleComponentProperty":return this.getComponentProperty(t,e);case"SurfaceMountComponentSilkscreen":case"ThroughHoleComponentSilkscreen":return this.getComponentSilkscreen(t,e);case"TearDrop":return this.getTearDropShapes(t);case"Shell_Outline":case"Shell_ScrewPillar":case"Shell_SideDatumLine":case"Shell_SideSlotRegion":case"Shell_TopBottomSlotRegion":case"Shell_SideEntity":case"Shell_TopBottomEntity":return this.getShellShapes(t,e);default:return console.warn(`${e}\u83B7\u53D6\u56FE\u5143\u6570\u636E\u5931\u8D25\uFF0C\u65E0\u76F8\u5E94\u83B7\u53D6\u56FE\u5F62\u65B9\u6CD5\uFF01`),[]}}getNotAddIntoBomWithNcMark(t){return Ms.getInstance().getAllItem().reduce((e,r)=>{let{box:i,addIntoBom:n}=r;if(n==="no"){let{width:a,height:l,rotation:c,center:h}=i,d=Math.min(a,l)*2/3,{path:p,width:m,height:g}=fd("NC",d,d/10),y=5,b=new Ku(void 0,t,void 0,"",!1,"NC",!0,"default",d,c,h,y,d/10,!1,0,is(t),!1,p,m,g,!1),P=this.textModel2PDFText(b,"NotAddIntoBomWithNcMark");P.color&&(P.color[3]=.5),e.push(P)}return e},[])}getNotAddIntoBomWithXMark(t){let e=this.getObjectColorWithA("NotAddIntoBomWithXMark",t);e&&(e[3]=.5);let r="S";return Ms.getInstance().getAllItem().reduce((i,n)=>{let{box:s,addIntoBom:a}=n;if(a==="no"){let{width:l,height:c,rotation:h,center:u}=s,d=Math.min(l,c),p=[new M(s.leftLow,s.rightUp),new M(s.leftUp,s.rightLow)];i.push({primitives:p,style:r,color:e,strokeWidth:d*2/30})}return i},[])}getTopPad(t,e){let r=[1,5,7],i="F",n=t===1?this.getObjectColorWithA(e,t):void 0;return r.includes(t)?jn.getInstance().getAllItem().filter(a=>a.layerId===1).reduce((a,l)=>{if(!rme(l,e))return a;let c=l.getMathGraphics(t,this.clearance);return c&&a.push({...c,style:i,color:n}),a},[]):[]}getBottomPad(t,e){let r=[2,6,8],i="F",n=t===2?this.getObjectColorWithA(e,t):void 0;return r.includes(t)?jn.getInstance().getAllItem().filter(a=>a.layerId===2).reduce((a,l)=>{if(!rme(l,e))return a;let c=l.getMathGraphics(t,this.clearance);return c&&a.push({...c,style:i,color:n}),a},[]):[]}getMultiPad(t,e){return[2,1,12,5,7,6,8].includes(t)||Es(t)?this.getMultiPadData(t,e):[]}getMultiPadData(t,e){let r="F",i=t===12?this.getObjectColorWithA(e,t):void 0;return jn.getInstance().getAllItem().filter(s=>s.layerId===12&&rme(s,e)).reduce((s,a)=>{var c,h;if(t===12&&(a.type===2||a.unusedInnerLayers.length))return s;let l=a.getFileGraphics(t,this.clearance);if(l){let u=[];for(let m of l)m!=null&&(Qg(u,m.primitives),m!==l[l.length-1]&&u.push("m"));let d={primitives:u,style:r,color:i},p=null;if(t===47&&this.colorType!=="Full Color"){d.color="transparent";let m=(h=(c=this.ops.customPage[this.currentPageIndex].layerMap)==null?void 0:c.get(t))==null?void 0:h.transparency;m!=null&&(d.opacity=1-m*.01),p={...d,style:"S"},delete p.color}s.push(d),p&&s.push(p)}return s},[])}getVia(t){let r=[12,5,6].includes(t);return this.isMerge||(r=r||[1,2].includes(t)||Es(t)),r?this.getViaData(t,"Via"):[]}getViaData(t,e){let r="F",i=[12,5,6,47],n=this.getObjectColorWithA(e,t);return bn.getInstance().getAllItem().reduce((s,a)=>{var c,h,u;if(t===12&&a.unusedInnerLayers.length)return s;if(a.type===1){let p=t===2?100:t,{startLayer:m,endLayer:g}=a;if(m=m===2?100:m,g=g===2?100:g,(p<m||p>g)&&!i.includes(t))return s}let l=a.getFileGraphics(t,this.clearance);if(l){let d=[];for(let g of l)g!=null&&(Qg(d,g.primitives),g!==l[l.length-1]&&d.push("m"));let p={primitives:d,style:r,color:n},m=null;if(t===47&&this.colorType!=="Full Color"){p.color="transparent";let g=(u=(h=(c=this.ops.customPage[this.currentPageIndex])==null?void 0:c.layerMap)==null?void 0:h.get(t))==null?void 0:u.transparency;g!=null&&(p.opacity=1-g*.01),m={...p,style:"S"},delete m.color}s.push(p),m&&s.push(m)}return s},[])}getPadDrill(t){return[47].includes(t)?this.getMultiPadData(t,"PadDrill"):[]}getViaDrill(t){return[47].includes(t)?this.getViaData(t,"ViaDrill"):[]}getTrack(t){let e="S",r=this.getObjectColorWithA("Track",t);return Sn.getInstance().getAllItem().reduce((i,n)=>{if(n.layerId===t){let s=n.width,a={primitives:[n.primitive]};a&&i.push({...a,strokeWidth:s,style:e,color:r})}return i},[])}getText(t){return io.getInstance().getAllItem().filter(e=>e.layerId===t&&e.key==="").map(e=>this.textModel2PDFText(e,"Text"))}getImage(t){let e="F",r=this.getObjectColorWithA("Image",t);return Hs.getInstance().getAllItem().reduce((i,n)=>{if(n.layerId===t){let s=n.getPath(),a=s.reduce((l,c,h)=>{let u=c.pl.primitives;return h!==s.length-1&&u.push("m"),Qg(l,u),l},[]);i.push({primitives:a,style:e,color:r})}return i},[])}getDimension(t){let e=this.getObjectColorWithA("Dimension",t);return Ma.getInstance().getAllItem().concat(Na.getInstance().getAllItem()).concat(sl.getInstance().getAllItem()).reduce((r,i)=>{if(i.layerId===t){let n=i.getBaseGraphics();for(let s of n)r.push({primitives:s,style:"S",strokeWidth:i.strokeWidth,color:e})}return r},[])}getBoardOutline(t){return this.pageSet==="separated"&&(t=11),this.getLine2DTypeShape(t,"Board Outline",this.getObjectColorWithA("BoardOutline",t))}getBoardCutout(t){return this.getLine2DTypeShape(t,"Slot Region",this.getObjectColorWithA("BoardCutout",t))}getCopperOutline(t){return this.getLine2DTypeShape(t,"Copper Region",this.getObjectColorWithA("CopperOutline",t))}getCopperFilled(t){let e=this.getObjectColorWithA("CopperFilled",t);return Qi.getInstance().getAllItem().concat(Fi.getInstance().getAllItem()).concat(vi.getInstance().getAllItem()).reduce((r,i)=>(i.layerId===t&&i.type=="Copper Region"&&i.iteratorCopper(n=>{let s=qo.getInstance().getItem(n);if(!s)return;let a=s.style==="solid",l=a?s.optimization?s.optimizationWidth||0:null:s.gridLineWidth||0,c=a?l!=null?"FD":"F":"S",h=a&&s.optimization?"1":void 0,u=s.getOutline(),d=[];u.forEach((p,m)=>{Qg(d,p.primitives),d.push("m")}),r.push({primitives:d,style:c,strokeWidth:l,lineJoin:h,color:e})}),r),[])}getSolidRegion(t){return this.getLine2DTypeShape(t,"Fill Region",this.getObjectColorWithA("SolidRegion",t))}getProhibitedRegion(t){return this.getLine2DTypeShape(t,"Prohibited Region",this.getObjectColorWithA("ProhibitedRegion",t))}getFPCStiffener(t){return this.getLine2DTypeShape(t,"FPC Stiffener",this.getObjectColorWithA("FPCStiffener",t))}getLine(t){return this.getLine2DTypeShape(t,"Line",this.getObjectColorWithA("Line",t))}getShellShapes(t,e){let r=null;if(e==="Shell_Outline"?r="3D Shell - Outline":e==="Shell_ScrewPillar"?r="3D Shell - Screw Pillar":e==="Shell_SideDatumLine"?r="3D Shell - Side Datum Line":e==="Shell_SideSlotRegion"?r="3D Shell - Side Slot Region":e==="Shell_TopBottomSlotRegion"?r="3D Shell - Top Slot Region":e==="Shell_SideEntity"?r="3D Shell - Side Entity":e==="Shell_TopBottomEntity"&&(r="3D Shell - Top/Bottom Entity"),!Object.is(r,null))return this.getLine2DTypeShape(t,r,this.getObjectColorWithA(e,t))}async getComponentAttr(t,e){let r=e?[1]:[1,3,7,5,9],i=e?[2]:[2,4,8,10,6];if(!r.includes(t)&&!i.includes(t))return[];{let n=r.includes(t)?1:2,s=[];for(let a of Ms.getInstance().getAllItem())if(a.layerId===n){let{attrKeyValue:l,box:c,device:h,globalIndex:u}=a,d=this._componentAttrMap.get(u);if(d){if(d[0]===this.currentPageIndex)continue;s.push(d[1])}else{let p={};await pz(l,async(m,g,y)=>{p[m]={k:await this.i18n(m),v:g}}),p.Layer||(p.Layer={k:await this.i18n("Layer"),v:await this.i18n(Ze.getInstance().getLayer(a.layerId).name)}),this._componentAttrMap.set(u,[this.currentPageIndex,{attr:p,box:c,device:h,globalIndex:u}]),s.push(this._componentAttrMap.get(u)[1])}}return s}}getPlaneZone(t){let e="F",r=this.getObjectColorWithA("PlaneZone",t);return Xo.getInstance().getAllItem().reduce((i,n)=>{if(n.layerId===t){let s=n.getOutline(),a=[];s.forEach((l,c)=>{Qg(a,l.primitives),a.push("m")}),i.push({primitives:a,style:e,color:r})}return i},[])}getComponentProperty(t,e){return io.getInstance().getAllItem().filter(i=>i.layerId===t&&I$e(i,e)&&i.getText()).map(i=>this.textModel2PDFText(i,e))}getComponentSilkscreen(t,e){if(![4,3].includes(t))return[];let r=this.getObjectColorWithA(e,t);return Ms.getInstance().getAllItem().reduce((i,n)=>(C$e(n,e)&&n.getItems().filter(a=>a.layerId&&a.layerId===t).forEach(a=>{if(a.layerId&&a.layerId===t){if(a instanceof Li)a.key===""&&i.push(this.textModel2PDFText(a,e));else if(a instanceof or){let{strokeWidth:l}=a,c=["Line","Board Outline","Copper Region"].includes(a.type)?"S":"F",h=a.getMathGraphics(t,this.clearance);if(h){let u=this.polylineOrGroup2PDFShape(h,{strokeWidth:l,style:c,color:r});i.push(u)}}}}),i),[])}getLine2DTypeShape(t,e,r){return Fi.getInstance().getAllItem().concat(Qi.getInstance().getAllItem()).concat(vi.getInstance().getAllItem()).reduce((i,n)=>{var s,a,l,c,h,u;if(!(n.getParent()&&[4,3].includes(t))&&n.type===e&&t===n.layerId){let{strokeWidth:d}=n,p=["Line","Board Outline","Copper Region","3D Shell - Outline","3D Shell - Screw Pillar","3D Shell - Side Datum Line","Prohibited Region"].includes(e)?"S":"F",m=n.getMathGraphics(t,this.clearance),g=m?m instanceof Bt?m.items.sort((b,P)=>b.bbox().area()>P.bbox().area()?-1:1):[m]:null,y=g==null?void 0:g.reduce((b,P,T)=>(Qg(b,P.primitives),T!==g.length-1&&b.push("m"),b),[]);if(y!=null&&y.length){let b={primitives:y,strokeWidth:d,style:p,color:r};if(this.pageSet==="separated"&&e==="Board Outline"){if(b.color=this.getObjectColorWithA("BoardOutline",11),!b.color)switch(this.colorType){case"Black on White":{b.color=[0,0,0,1];break}case"Full Color":{b.color=yTe((a=(s=this.ops.customPage[this.currentPageIndex])==null?void 0:s.layerMap.get(t))==null?void 0:a.color)||Ze.getInstance().getLayer(t).activeColor.toRGBA();break}case"White on Black":{b.color=[255,255,255,1];break}}let T=(c=(l=this.ops.customPage[this.currentPageIndex])==null?void 0:l.layerMap.get(t))==null?void 0:c.transparency;T!=null&&(b.color[3]=1-T*.01)}let P=null;if(e==="Slot Region"&&this.colorType!=="Full Color"){b.color="transparent";let T=(u=(h=this.ops.customPage[this.currentPageIndex])==null?void 0:h[t])==null?void 0:u.transparency;T!=null&&(b.opacity=1-T*.01),P={...b,style:"S"},delete P.color}e==="Prohibited Region"&&i.push(this.getFillGrid(n)),i.push(b),P&&i.push(P)}}return i},[])}getDrillDrawingLayerDrill(){let t=this.getDrillConfig();if(t==null)return[];let e=XF;return t.reduce((r,i)=>{let{position:n,text:s,image:a}=i;if(a!=null){let l=new _e;a.forEach(p=>{l.ext1(p.bbox())});let c=l.build1(),h=c.center(),u=Qe.translate(-h.x,-h.y).scale(e/c.width()*1.4).translate1(n),d=a.reduce((p,m,g)=>{let y=m.primitives.map(b=>b.multiply3(u));return Qg(p,y),g!==a.length-1&&p.push("m"),p},[]);r.push({primitives:d,style:"F"})}if(s!=null){let{center:l,width:c,height:h}=this.getPolyLinesCenterAndWH(...s),u=Qe.translate(-l.x,-l.y).scale(e/Math.max(c,h)/1.8*1.4*2).translate1(n),d=s.reduce((p,m)=>{let g=m.primitives.map(y=>y.multiply3(u));return Qg(p,g),p},[]);r.push({primitives:d,style:"S",strokeWidth:.1*2})}return r},[])}getPolyLinesCenterAndWH(...t){console.time("calculate polyline center");let[e,r,i,n]=[1/0,1/0,-1/0,-1/0];for(let c of t)for(let h of c.primitives){let[u,d,p,m]=[h.start().x,h.end().x,h.start().y,h.end().y];e=Math.min(u,d,e),i=Math.max(u,d,i),r=Math.min(p,m,r),n=Math.max(p,m,n)}let s=new S((e+i)/2||0,(r+n)/2||0),a=Math.abs(i-e),l=Math.abs(n-r);return console.timeEnd("calculate polyline center"),{center:s,width:a,height:l}}getPanelize(t,e){var a;if(!((a=this.panelizeInfo)==null?void 0:a.success))return[];let i=e.includes("BoardOutline")?si.getInstance().getProfileGroup(t).map(l=>({...l,style:"S"})):[],n=si.getInstance().getPadGroup(t),s=si.getInstance().getText(t).map(l=>this.textModel2PDFText(l,eme(l)));return[].concat(i,n,s)}getClonePanelizeShapes(t,e){let{success:r,row:i,column:n,onlyOutline:s}=this.panelizeInfo;if(!r||s&&e!=="BoardCutout")return[];let a=[],l=si.getInstance().offset;for(let c=0;c<i;c++)for(let h=0;h<n;h++){if(c===0&&h===0)continue;let u=Qe.translate(l.x*h,l.y*c);for(let d of t)if(d.primitives){let p={...d,primitives:d.primitives.slice()};p.primitives.forEach((m,g)=>{m instanceof rl&&(p.primitives[g]=m.multiply3(u))}),a.push(p)}else if(d instanceof Li){let p=d.getRealOutline().map(C=>{let E=C instanceof Cp?C.pl.primitives:C.primitives;return E.forEach((O,_)=>{E[_]=O.multiply3(u)}),C}),{rotation:m,fontSize:g,fontFamily:y,layerId:b,mirror:P,strokeWidth:T,bbox:I}=d;a.push({bbox:I.transform(u),rotation:m,fontSize:g,fontFamily:y,layerId:b,mirror:P,content:d.getText(),shapes:p,strokeWidth:T})}else if(typeof d.fontSize<"u"){let p=d.matrix.multiply4(u.toMatrix4()),m=d.bbox.transform(u),g=d.shapes.map(y=>{let b=y.clone(),P=b instanceof Cp?b.pl.primitives:b.primitives;return P.forEach((T,I)=>{P[I]=T.multiply3(u)}),b});a.push({...d,shapes:g,matrix:p,bbox:m})}}return a}getSlotBgShape(){return Fi.getInstance().getAllItem().concat(Qi.getInstance().getAllItem()).concat(vi.getInstance().getAllItem()).reduce((t,e)=>{if(e.type==="Slot Region"){let{strokeWidth:r}=e,i="F",n=e.getMathGraphics(47,this.clearance);if(n){let s={...n,strokeWidth:r,style:i};s.color="transparent",t.push(s)}}return t},[])}getTearDropShapes(t){let e=vi.getInstance().getAllItem(),r=[],i="FD",n=this.getObjectColorWithA("TearDrop",t);return e.forEach(s=>{if(s.type=="TearDrop"){if(t!==s.layerId)return;let a=s.getMathGraphics(t);a&&r.push({...a,style:i,color:n})}}),r}extendShapeBBox(t){this.getShapesBBoxFac(t,this.bboxFac)}getShapesBBoxFac(t,e){for(let r of t)if(r.primitives){let i=new _e;for(let n of r.primitives)n!="m"&&i.ext1(n.bbox());if(i.valid()){let n=i.build1(),s=r.strokeWidth;s&&(n=n.extendOfSize(s/2+Wqe)),e.ext1(n)}}else typeof r.fontSize<"u"&&e.ext1(r.bbox);return e}fac2BBox(t){try{return t.build1()}catch{return null}}textModel2PDFText(t,e){let r=tme(t),i=this.getObjectColorWithA(e,t.layerId);return{...r,color:i}}polylineOrGroup2PDFShape(t,e){if(t instanceof ge)return{primitives:t.primitives,...e};if(t instanceof Bt){let r=[];for(let i of t.items)i!=null&&(Qg(r,i.primitives),i!==t.items.at(-1)&&r.push("m"));return{primitives:r,...e}}}getFillGrid(t){if(t instanceof yo)return this.getCircleFillGrid(t);{let e=t.getMathGraphics();e=e instanceof Bt?e.items[0]:e;let r=VO(e),i=0,n="S",s=ee.Gray.toRGBA();return{primitives:r,strokeWidth:i,style:n,color:s}}}getCircleFillGrid(t){let e=new Array,r=t.center.add(new S(-1,1).mul(t.radius*Math.sqrt(2)/2)),i=t.center.add(new S(1,-1).mul(t.radius*Math.sqrt(2)/2)),n=r.y-r.x,s=i.y-i.x,a=6;for(n-=a;n>s;n-=a){let g=2*(n-t.center.y-t.center.x),y=t.center.x*t.center.x-t.radius*t.radius+(n-t.center.y)*(n-t.center.y),b=Math.sqrt(g*g-8*y),P=(-g+b)/4,T=(-g-b)/4,I=P+n,C=T+n,E=new M(new S(P,I),new S(T,C));e.push(E)}let l=t.center.add(new S(1,1).mul(t.radius*Math.sqrt(2)/2)),c=t.center.add(new S(-1,-1).mul(t.radius*Math.sqrt(2)/2)),h=l.y+l.x,u=c.y+c.x;for(h-=a;h>u;h-=a){let g=2*(t.center.y-h-t.center.x),y=t.center.x*t.center.x-t.radius*t.radius+(t.center.y-h)*(t.center.y-h),b=Math.sqrt(g*g-8*y),P=(-g+b)/4,T=(-g-b)/4,I=-P+h,C=-T+h,E=new M(new S(P,I),new S(T,C));e.push(E)}let d=0,p="S",m=ee.Gray.toRGBA();return{primitives:e,strokeWidth:d,style:p,color:m}}async i18n(t){if(this._i18nMap.has(t))return this._i18nMap.get(t);if(this.bridge instanceof O$e.WindowMessageBridge){let e=(await this.bridge.rpcCall("i18n",t,top)).message;return this._i18nMap.set(t,e),e}else{let e=(await this.bridge.rpcCall("i18n",t)).message;return this._i18nMap.set(t,e),e}}getDrillConfig(){return this._drillConfig=this._drillConfig||THe()}getPrePageText(){var r,i;let e=(()=>{let n=this.ops.customPage.filter(l=>l.checked),{layer:s,object:a}=n[this.currentPageIndex];return T$e(s,a)})();if(!((r=this.panelizeInfo)!=null&&r.success)||(i=this.panelizeInfo)!=null&&i.onlyOutline)return e;{let{row:n,column:s}=this.panelizeInfo,a=si.getInstance().offset,l=[];for(let c=0;c<n;c++)for(let h=0;h<s;h++){if(c===0&&h===0)continue;let u=Ae.translate(a.x*h,a.y*c,0);for(let d of e){let{matrix:p}=d,m=p.multiply4(u);l.push({...d,matrix:m})}}return Qg(e,l)}}getPageBBox(){var r;let e=(()=>{let i=new _e;for(let n of this.ops.customPage)n.specialFlag?P$e(i,n.specialFlag):b$e(i,n.layer,n.object,this.ops.pageSet);try{return i.build().extendOfSize(zqe)}catch{return new ht(-1,1,-1,1)}}).bind(this)();if((r=this.panelizeInfo)!=null&&r.success){let{row:i,column:n}=this.panelizeInfo,s=si.getInstance().bbox;if(this.panelizeInfo.onlyOutline)return ht.extend2(s,e);{let a=si.getInstance().offset,l=Qe.translate(a.x*(n-1),a.y*(i-1));return ht.extend2(ht.extend2(e,e.transform(l)),s)}}else return e}getObjectColorWithA(t,e){var i;let r=(i=this.objectColor)==null?void 0:i[t];return r&&[...r.slice(0,3),1-this.ops.customPage[this.currentPageIndex].layerMap.get(e).transparency]}setInterrupt(t){var e;this.state!=="INTERRUPT"&&(this._state="INTERRUPT",(e=this.onInterrupt)==null||e.call(this,t))}exit(){o.CURRENT_INSTANCE=null}};function A$e(o){return new Promise(async(t,e)=>{console.time("CreatePDF:_getDataByMain"),AS&&console.log(`CreatePDF: before _getDataByMain used js heap size:${performance.memory.usedJSHeapSize/1024/1024}MB`);let r=m$e(o),i=o.segmentedExport?new rk(o.fileName+(r?".zip":".pdf")):null;await(i==null?void 0:i.create());let n=new EU(o,si.getInstance().getDefaultPanelize(),A.windowBridge),s=i&&r?new wWe:null,a;s&&(s.ondata=async(l,c,h)=>{try{c!=null&&c.length&&await(i==null?void 0:i.write(c.buffer)),h&&i.close()}catch(u){n.setInterrupt(u)}}),await n.getPdf(async(l,c,h)=>{n.state!=="INTERRUPT"&&(s?(a==null||a.push(new Uint8Array,!0),s==null||s.end()):i==null||i.close(),t({data:l,fileName:c,extension:h}),console.timeEnd("CreatePDF:_getDataByMain"),AS&&console.log(`CreatePDF: after _getDataByMain used js heap size:${performance.memory.usedJSHeapSize/1024/1024}MB`))},async l=>{try{if(n.state==="INTERRUPT")return;let{value:c,title:h,data:u,path:d}=l,p=h==="CreatePDF"?.9*c:.9+c*.1,m=(u==null?void 0:u.length)||(u==null?void 0:u.byteLength);if(A.windowBridge.publish("progressUpdate",[p,"exportFile"],Q()),m)if(s){d&&(a==null?void 0:a.filename)!==d&&(a==null||a.push(new Uint8Array,!0),a=new DWe(d),s.add(a));let g=u instanceof ArrayBuffer?new Uint8Array(u):xd.stringToUint8Array(u);a.push(g)}else i&&await(i==null?void 0:i.write(u));await gz(10)}catch(c){n.setInterrupt(c)}},async l=>{s?s==null||s.terminate():i==null||i.cancel(),A.windowBridge.publish("progressUpdate",[1,"exportFile"],Q()),e(l||"\u6D41\u7A0B\u5DF2\u4E2D\u65AD")}).finally(()=>{n.exit()})})}async function _$e(o){On.getInstance().allowPull=!1,console.time("CreatePDF:_getDataByWorker"),AS&&console.log(`CreatePDF: before _getDataByWorker used js heap size:${performance.memory.usedJSHeapSize/1024/1024}MB`);let t=new jI().encode(),r=await tm.getInstance().addWorker(`editor?entry=pcb-decode-worker.js${Q().location.search.replace(/\?/,"&")}`).rpcCall("exportFile",{world:t,config:o,panelize:si.getInstance().getDefaultPanelize()}).catch(l=>{throw l}),{workerName:i,data:n,fileName:s,extension:a}=r.message;return tm.getInstance().deleteWorker(i),On.getInstance().allowPull=!0,console.timeEnd("CreatePDF:_getDataByWorker"),AS&&console.log(`CreatePDF: after _getDataByWorker used js heap size:${performance.memory.usedJSHeapSize/1024/1024}MB`),{data:n,fileName:s,extension:a}}function v$e(o){var t,e;(e=(t=EU.CURRENT_INSTANCE)==null?void 0:t.setInterrupt)==null||e.call(t,o)}async function x$e(o,t=!1){A.windowBridge.publish("progressUpdate",[0,"exportFile",void 0,{messageTopic:"pcb/exportFile/cancel",onlyInitiative:!0,messageTopicData:"\u7528\u6237\u4E3B\u52A8\u53D6\u6D88\u5BFC\u51FA"}],Q()),twt(o,t);let e=t?await _$e(o):await A$e(o),{data:r,fileName:i,extension:n}=e;if(o.fileType==="printPDF"){let s=URL.createObjectURL(r);A.windowBridge.publish("popupNewWindowDialog",[s],Q())}else o.segmentedExport||(D2?JI(r,`${i}.${n}`,n):xd.downloadFile(`${i}.${n}`,r));A.windowBridge.publish("progressUpdate",[1,"exportFile"],Q())}function twt(o,t){let{fileType:e,pageSet:r}=o;rwt()&&e==="filePdf"?o.segmentedExport=!0:o.segmentedExport=!1,o.fileType==="printPDF"&&(o.needMenu=!1)}function rwt(){var o,t,e;return(e=(t=(o=Q())==null?void 0:o.navigator)==null?void 0:t.serviceWorker)==null?void 0:e.controller}async function R$e(o,t=!1){A.windowBridge.publish("progressUpdate",[0,"exportFile",void 0,{messageTopic:"pcb/exportFile/cancel",onlyInitiative:!0,messageTopicData:"\u7528\u6237\u4E3B\u52A8\u53D6\u6D88\u5BFC\u51FA"}],Q());let e=t?await _$e(o):await A$e(o);A.windowBridge.publish("progressUpdate",[1,"exportFile"],Q());let{data:r,fileName:i,extension:n}=e;return{data:(await ZI(r)).data,fileName:i,extension:n}}var e2=re.getInstance();var nme=class{constructor(){this.startIndex=0;this.endIndex=300;this._pcbNames=[];this.searchValue="";this._yesOrNo=["Yes","No"];this._origin=["Upper Left","Middle Left","Lower Left","Upper Center","Middle Center","Lower Center","Upper Right","Middle Right","Lower Right"];this._attrsForDocType={4:["Component Property","Pad","Test Point","FPC Stiffener","Text","Via","Slot Region","Fill Region","Prohibited Region","Line","Dimension","Image"],3:["Component","Component Property","Pad","Test Point","FPC Stiffener","Text","Track","Via","Suture Via","Board Outline","Slot Region","Copper Region","Fill Region","Prohibited Region","Constraint Region","Line","Dimension","Image","Colorful Image","Group","3D Shell - Outline","3D Shell - Screw Pillar","3D Shell - Side Datum Line","3D Shell - Slot Region","3D Shell - Entity"]};this._inputType=this.getInputType(this.pcbNames),A.messageBus.rpcService("getFindResult",({startIndex:t,endIndex:e})=>(this.startIndex=t,this.endIndex=e,this.getResult())),A.messageBus.rpcService("setSearchData",({value:t,valueEn:e})=>this.searchValue!=t?(this.searchValue==""&&(this.oldData=this.passFilter),t==""?(this.passFilter=this.oldData,this.oldData=null):this.passFilter=this.filterData(t,e),this.startIndex=0,this.endIndex=300,this.searchValue=t,this.passFilter.length==0?[]:this.getResult()):!1)}filterData(t,e){var a;let r=this.oldData,i=this.configForFindObj,n=[],s=Object.keys(i).filter(l=>l!="getAllItem"&&l!="is");t=t.replace(/\./g,"\\.").replace(/\(/g,"\\(").replace(/\)/g,"\\)").replace(/-/g,"\\-").replace(/\?/g,"\\?").replace(/\*/g,"\\*").replace(/\+/g,"\\+");for(let l=0;l<r.length;l++){let c=r[l],h=this.getObj(c,s);for(let u of s){let d=(a=this._inputType[u])!=null&&a.translate?e:t,p=new RegExp(d,"im");if(h[u]&&p.test(h[u])){n.push(c);break}}}return n}get pcbNames(){return this._pcbNames}set pcbNames(t){this._pcbNames=t,this._inputType=this.getInputType(t)}getInputType(t){return{All:{type:"textInput",translate:!0},Layer:{type:"select",translate:!0},"Start Layer":{type:"select",translate:!0},"End Layer":{type:"select",translate:!0},Designator:{type:"textInput",translate:!1},Footprint:{type:"textInput",translate:!1},Device:{type:"textInput",translate:!1},ID:{type:"textInput",translate:!1},globalIndex:{type:"textInput",translate:!1},"Unique ID":{type:"textInput",translate:!1},"3D Model":{type:"textInput",translate:!1},"Group ID":{type:"textInput",translate:!1},"Channel ID":{type:"textInput",translate:!1},Rotation:{type:"textInputWithNumber",translate:!1},Locked:{type:"select",translate:!0,value:this._yesOrNo},"Property Name":{type:"select",translate:!0,value:this.allPropertyNameShow()},Text:{type:"textInput",translate:!1},"Property Value":{type:"textInput",translate:!1},Mirror:{type:"select",translate:!0,value:this._yesOrNo},Inverted:{type:"select",translate:!0,value:this._yesOrNo},"Inverted Expansion":{type:"textInputWithUnit",translate:!1},"Font Family":{type:"select",translate:!0,value:this.getFontFamilyOption()},"Line Width":{type:"textInputWithUnit",translate:!1},Height:{type:"textInputWithUnit",translate:!1},Radius:{type:"textInputWithUnit",translate:!1},"Corner Radius Ratio":{type:"textInputWithNumber",translate:!1},"Corner Radius":{type:"textInputWithUnit",translate:!1},Origin:{type:"select",translate:!0,value:this._origin},Number:{type:"textInput",translate:!1},Net:{type:"select",translate:!1,value:this.allNet(),clearBtn:!0},Size:{type:"select",translate:!0,value:["General","Custom"]},Shape:{type:"select",translate:!0,value:["Rectangle","Round","Polygon"]},Width:{type:"textInputWithUnit",translate:!1},Diameter:{type:"textInputWithUnit",translate:!1},"Hole Shape":{type:"select",translate:!0,value:["Round","Slot"]},"Hole Diameter":{type:"textInputWithUnit",translate:!1},"Hole Width":{type:"textInputWithUnit",translate:!1},"Hole Length":{type:"textInputWithUnit",translate:!1},"Hole Rotation":{type:"textInputWithNumber",translate:!1},Plated:{type:"select",translate:!0,value:this._yesOrNo},"TopLayer Solder Mask Expansion":{type:"textInputWithUnit",translate:!1},"BottomLayer Solder Mask Expansion":{type:"textInputWithUnit",translate:!1},"Paste Mask Expansion":{type:"textInputWithUnit",translate:!1},"Type.attr":{type:"select",translate:!0},Belong:{type:"select",translate:!0},"Via Type":{type:"select",translate:!0,value:["Through Via","Blind Via"]},Length:{type:"textInputWithUnit",translate:!1},"Via Outside Diameter":{type:"textInputWithUnit",translate:!1},"Via Inside Diameter":{type:"textInputWithUnit",translate:!1},Name:{type:"textInput",translate:!1},"Fill Style":{type:"select",translate:!0,value:["Solid","Grid 45\xB0","Grid 90\xB0"]},"Grid Line Width":{type:"textInputWithUnit",translate:!1},"Grid Line Spacing":{type:"textInputWithUnit",translate:!1},"Keep Island":{type:"select",translate:!0,value:this._yesOrNo},"Improve Fabrication":{type:"select",translate:!0,value:this._yesOrNo},Precision:{type:"textInputWithNumber",translate:!1},"Dimension Type":{type:"select",translate:!0,value:["Length","Angle","Radius"]},Unit:{type:"select",translate:!1,value:["mm","cm","mil","inch"]},"Overall height of shell":{type:"textInputWithUnit",translate:!1},"PCB Height From The Bottom Surface of Shell":{type:"textInputWithUnit",translate:!1},"Height of lower shell":{type:"textInputWithUnit",translate:!1},"Shell thickness":{type:"textInputWithUnit",translate:!1},"Group Name":{type:"textInput",translate:!1},"Reuse Block":{type:"select",translate:!1,value:this.reuseBlocks(t),clearBtn:!0},"Screw specifications":{type:"select",translate:!0,value:["M2","M3","M4","M5","M6","Custom"]},"3DShell.screwHoleDiameter":{type:"textInputWithUnit",translate:!1},"3DShell.screwThickness":{type:"textInputWithUnit",translate:!1},"Need Stiffener":{type:"select",translate:!0,value:this._yesOrNo},"Top Width of Stiffener":{type:"textInputWithUnit",translate:!1},"Bottom Width of Stiffener":{type:"textInputWithUnit",translate:!1},"Stiffener Height":{type:"textInputWithUnit",translate:!1},"Stiffener Thickness":{type:"textInputWithUnit",translate:!1},"Need Counterbore":{type:"select",translate:!0,value:this._yesOrNo},"Counterbore Height":{type:"textInputWithUnit",translate:!1},"Counterbore Diameter":{type:"textInputWithUnit",translate:!1},Baseline:{type:"textInput",translate:!1},"Slot depth":{type:"textInputWithUnit",translate:!1},"Stretch Length":{type:"textInputWithUnit",translate:!1},"Add into BOM":{type:"select",translate:!0,value:this._yesOrNo},"Silk Screen Color":{type:"textInput",translate:!1},Material:{type:"select",translate:!0,i18nContext:"FPCStiffenerAttr"},Model:{type:"select",translate:!0,i18nContext:"FPCStiffenerAttr"},Thickness:{type:"select",translate:!0,i18nContext:"FPCStiffenerAttr"},"Safe Spacing":{type:"select",translate:!1},"Other Spacing":{type:"select",translate:!1},Track:{type:"select",translate:!1},"Differential Pair":{type:"select",translate:!1},"Via Size":{type:"select",translate:!1},"Plane Zone":{type:"select",translate:!1},"Copper Zone":{type:"select",translate:!1},"Copper Bridge":{type:"select",translate:!0,value:this._yesOrNo},"Copper Bridge List":{type:"textInput",translate:!1}}}configForObjType(t){switch(t){case"Component":{let e={Layer:{attr:"layerId",value:[1,2],cannotDisplay:!0},Designator:{attr:"name"},Footprint:{attr:"footprintId"},Device:{attr:"device"},ID:{attr:"number",cannotDisplay:!0},globalIndex:{attr:"globalIndex",cannotDisplay:!0},Name:{attr:r=>r.getFormulaName()},"Unique ID":{attr:r=>r.attrKeyValue["Unique ID"]},"Add into BOM":{attr:r=>r.attrKeyValue["Add into BOM"]==="yes"},"3D Model":{attr:r=>r.attrKeyValue["3D Model Title"]},Rotation:{attr:"rotation",cannotDisplay:!0},Locked:{attr:"locked",cannotDisplay:!0},"Silk Screen Color":{attr:r=>r.silkColor!=null?r.silkColor.toString().toUpperCase():1===r.layerId?we.topSilkscreenColor.toString().toUpperCase():we.bottomSilkscreenColor.toString().toUpperCase(),cannotDisplay:!0},"Group Name":{attr:r=>Ht.getGroupNameByGroupId(r.getGroupID()),cannotDisplay:!0},"Reuse Block":{attr:"reuseBlock",cannotDisplay:!0},"Group ID":{attr:r=>r.model.combinationID,cannotDisplay:!0},"Channel ID":{attr:r=>r.model.channelID,cannotDisplay:!0}};return this.allPropertyName().filter(r=>!["Footprint","Designator","Device","nameAlias","3D Model Title","3D Model Transform","Standardization Check"].includes(r)).forEach(r=>{e[r]||(e[`attrs-${r}`]={attr:r})}),{...e,is:r=>r instanceof ke,getAllItem:()=>Ar.getAllItem()}}case"Component Property":return{Layer:{attr:"layerId",value:this.getAllowedLayers("Text")},"Property Value":{attr:"value"},Mirror:{attr:"mirror"},Inverted:{attr:"reverse"},"Inverted Expansion":{attr:"reverseExpansion"},"Font Family":{attr:"fontFamily"},"Line Width":{attr:"strokeWidth"},Height:{attr:"fontSize"},Rotation:{attr:"rotation"},Locked:{attr:"locked"},Origin:{attr:"origin"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Silk Screen Color":{attr:e=>e.silkColor!=null?e.silkColor.toString().toUpperCase():1===e.layerId?we.topSilkscreenColor.toString().toUpperCase():we.bottomSilkscreenColor.toString().toUpperCase()},is:e=>e instanceof lr&&!!e.key,getAllItem:()=>ri.getAllItem().filter(e=>!!e.key&&(e.showKey||e.showValue))};case"Pad":return{Layer:{attr:"layerId",value:[1,2,12]},Number:{attr:"num"},Net:{attr:"net"},ID:{attr:"number"},globalIndex:{attr:"globalIndex",cannotDisplay:!0},Size:{attr:"type"},Shape:{attr:e=>e instanceof sn?"POLYGON":this.mergeSimilarValue([e.topType,e.innerType,e.bottomType]),value:["Rectangle","Round","Oval","Polygon"]},Width:{attr:e=>this.mergeSimilarValue([e.topWidth,e.innerWidth,e.bottomWidth])},Height:{attr:e=>this.mergeSimilarValue([e.topHeight,e.innerHeight,e.bottomHeight])},Diameter:{attr:e=>this.mergeSimilarValue([e.topWidth,e.innerWidth,e.bottomWidth])},"Corner Radius Ratio":{attr:e=>this.mergeSimilarValue([e.topRatio*100,e.innerRatio*100,e.bottomRatio*100])},"Hole Shape":{attr:"holeShape"},"Hole Diameter":{attr:e=>e.holeRadius*2},"Hole Width":{attr:e=>e.holeRadius*2},"Hole Length":{attr:"holeLength"},"Hole Rotation":{attr:"holeRotation"},Plated:{attr:e=>e.layerId==12?e.plated:""},Rotation:{attr:"rotation"},Locked:{attr:"locked"},"TopLayer Solder Mask Expansion":{attr:"topSolderExpansion"},"BottomLayer Solder Mask Expansion":{attr:"bottomSolderExpansion"},"Paste Mask Expansion":{attr:"pasteExpansion"},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},is:e=>e instanceof Le&&!e.isTestPad,getAllItem:()=>Qt.getAllItem().filter(e=>!e.isTestPad)};case"Test Point":return{Layer:{attr:"layerId",value:[1,2,12]},Number:{attr:"num"},Net:{attr:"net"},ID:{attr:"number"},globalIndex:{attr:"globalIndex",cannotDisplay:!0},Size:{attr:"type"},Shape:{attr:e=>e instanceof sn?"POLYGON":this.mergeSimilarValue([e.topType,e.innerType,e.bottomType]),value:["Rectangle","Round","Oval","Polygon"]},Width:{attr:e=>this.mergeSimilarValue([e.topWidth,e.innerWidth,e.bottomWidth])},Height:{attr:e=>this.mergeSimilarValue([e.topHeight,e.innerHeight,e.bottomHeight])},Diameter:{attr:e=>this.mergeSimilarValue([e.topWidth,e.innerWidth,e.bottomWidth])},"Corner Radius Ratio":{attr:e=>this.mergeSimilarValue([e.topRatio*100,e.innerRatio*100,e.bottomRatio*100])},"Hole Shape":{attr:"holeShape"},"Hole Diameter":{attr:e=>e.holeRadius*2},"Hole Width":{attr:e=>e.holeRadius*2},"Hole Length":{attr:"holeLength"},"Hole Rotation":{attr:"holeRotation"},Plated:{attr:e=>e.layerId==12?e.plated:""},Locked:{attr:"locked"},"TopLayer Solder Mask Expansion":{attr:"topSolderExpansion"},"BottomLayer Solder Mask Expansion":{attr:"bottomSolderExpansion"},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},is:e=>e instanceof Le&&e.isTestPad,getAllItem:()=>Qt.getAllItem().filter(e=>e.isTestPad)};case"FPC Stiffener":return{Layer:{attr:"layerId",value:[58,59]},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Material:{attr:e=>{var i;let r=e.getComponent();if(r instanceof tu)return(i=td.getMaterialOptions().filter(s=>s.value===r.material)[0])==null?void 0:i.text},value:td.getMaterialOptions().map(e=>e.text)},Model:{attr:e=>{var i;let r=e.getComponent();if(r instanceof tu)return(i=td.getModelOptions().filter(s=>s.value===r.fpcModel)[0])==null?void 0:i.text},value:td.getModelOptions().map(e=>e.text)},Thickness:{attr:e=>{var i;let r=e.getComponent();if(r instanceof tu)return(i=td.getThicknessOptions(r).filter(s=>s.value===r.thickness)[0])==null?void 0:i.text},value:td.getMixThicknessOptions().map(e=>e.text)},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="FPC Stiffener"&&!(e.getParent()instanceof ke))};case"Text":return{Layer:{attr:"layerId",value:this.getAllowedLayers("Text")},Text:{attr:"value"},Mirror:{attr:"mirror"},Inverted:{attr:"reverse"},"Inverted Expansion":{attr:"reverseExpansion"},"Font Family":{attr:"fontFamily"},"Line Width":{attr:"strokeWidth"},Height:{attr:"fontSize"},Rotation:{attr:"rotation"},Locked:{attr:"locked"},Origin:{attr:"origin"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},is:e=>e instanceof lr&&!e.key&&!e.getParent(),getAllItem:()=>ri.getAllItem().filter(e=>!e.key&&!e.getParent())};case"Track":return{Layer:{attr:"layerId",value:this.getAllowedLayers("Signal")},Width:{attr:"width"},Length:{attr:"length"},Net:{attr:"net"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Locked:{attr:"locked"},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},is:e=>e instanceof Ge,getAllItem:()=>pr.getAllItem()};case"Via":return{"Via Type":{attr:"type"},"Type.attr":{attr:"name",value:this.getAllBlindVia().ruleNames},"Start Layer":{attr:"startLayer",value:this.getAllBlindVia().startLayers},"End Layer":{attr:"endLayer",value:this.getAllBlindVia().endLayers},Net:{attr:"net"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Via Outside Diameter":{attr:e=>e.radius*2},"Via Inside Diameter":{attr:e=>e.holeRadius*2},Locked:{attr:"locked"},"TopLayer Solder Mask Expansion":{attr:"topExpansion"},"BottomLayer Solder Mask Expansion":{attr:"bottomExpansion"},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},is:e=>e instanceof Ue,getAllItem:()=>Wr.getAllItem()};case"Suture Via":return{"Via Type":{attr:"type"},"Type.attr":{attr:"name",value:this.getAllBlindVia().ruleNames},"Start Layer":{attr:"startLayer",value:Pe.getAllCopperLayerIds()},"End Layer":{attr:"endLayer",value:Pe.getAllCopperLayerIds()},Net:{attr:"net"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Via Outside Diameter":{attr:e=>e.radius*2},"Via Inside Diameter":{attr:e=>e.holeRadius*2},Locked:{attr:"locked"},"TopLayer Solder Mask Expansion":{attr:"topExpansion"},"BottomLayer Solder Mask Expansion":{attr:"bottomExpansion"},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},is:e=>e instanceof Ue&&e.isSuture,getAllItem:()=>Wr.getAllItem().filter(e=>e.isSuture)};case"Board Outline":return{"Line Width":{attr:"strokeWidth"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Shape:{attr:this.getShape},Radius:{attr:"radius"},"Corner Radius":{attr:e=>e.cornerRadius||0},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="Board Outline")};case"Slot Region":return{"Line Width":{attr:"strokeWidth"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Shape:{attr:this.getShape},Radius:{attr:"radius"},"Corner Radius":{attr:e=>e.cornerRadius||0},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="Slot Region")};case"Copper Region":return{Name:{attr:e=>e.component.name},Layer:{attr:"layerId",value:this.getAllowedLayers("Signal")},"Line Width":{attr:"strokeWidth"},Net:{attr:"net"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Fill Style":{attr:e=>e.component.style},"Grid Line Width":{attr:e=>e.component.gridLineWidth},"Grid Line Spacing":{attr:e=>e.component.clearance},"Keep Island":{attr:e=>e.component.keepIsland},"Improve Fabrication":{attr:e=>e.component.optimization},Shape:{attr:this.getShape},Radius:{attr:"radius"},"Corner Radius":{attr:e=>e.cornerRadius||0},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="Copper Region")};case"Fill Region":return{Layer:{attr:"layerId",value:this.getAllowedLayers("Fill Region")},"Line Width":{attr:"strokeWidth"},Net:{attr:"net"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Shape:{attr:this.getShape},Radius:{attr:"radius"},"Corner Radius":{attr:e=>e.cornerRadius||0},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},"Copper Bridge":{attr:e=>{var r;return(r=e.component)==null?void 0:r.isBridgingCopper}},"Copper Bridge List":{attr:e=>{var r;return(r=e.component)==null?void 0:r.networkList}},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="Fill Region"&&!(e.getParent()&&e.getParent()instanceof ke))};case"Prohibited Region":return{Layer:{attr:"layerId",value:this.getAllowedLayers("Fill Region")},"Line Width":{attr:"strokeWidth"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Shape:{attr:this.getShape},Radius:{attr:"radius"},"Corner Radius":{attr:e=>e.cornerRadius||0},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="Prohibited Region")};case"Constraint Region":return{Name:{attr:e=>e.component.name},Layer:{attr:"layerId",value:this.getAllowedLayers("Constraint Region")},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Shape:{attr:this.getShape},"Corner Radius":{attr:e=>e.cornerRadius||0},"Safe Spacing":{attr:e=>{let r=e2.getRegion(e.globalIndex);return r?r.safeClearance:null},value:Array.from(e2.getAllSafeSpacing()).map(e=>e.name)},"Other Spacing":{attr:e=>{let r=e2.getRegion(e.globalIndex);return r?r.otherClearance:null},value:Array.from(e2.getAllOtherSpacing()).map(e=>e.name)},"Creepage Distance":{attr:e=>{let r=e2.getRegion(e.globalIndex);return r?r.creepageClearance:null},value:Array.from(e2.getAllCreepageSpacing()).map(e=>e.name)},Track:{attr:e=>{let r=e2.getRegion(e.globalIndex);return r?r.track:null},value:Array.from(e2.getAllTrackPhysics()).map(e=>e.name)},"Differential Pair":{attr:e=>{let r=e2.getRegion(e.globalIndex);return r?r.diff:null},value:Array.from(e2.getAllDifferentialPhysics()).map(e=>e.name)},"Via Size":{attr:e=>{let r=e2.getRegion(e.globalIndex);return r?r.radius:null},value:Array.from(e2.getAllRadiusPhysics()).map(e=>e.name)},"Copper Zone":{attr:e=>{let r=e2.getRegion(e.globalIndex);return r?r.copperPlane:null},value:Array.from(e2.getAllCopperPlane()).map(e=>e.name)},"Plane Zone":{attr:e=>{let r=e2.getRegion(e.globalIndex);return r?r.innerPlane:null},value:Array.from(e2.getAllInnerPlane()).map(e=>e.name)},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="Constraint Region")};case"Line":return{Layer:{attr:"layerId",value:this.getAllowedLayers("Line")},"Line Width":{attr:"strokeWidth"},Net:{attr:"net"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Shape:{attr:this.getShape},Radius:{attr:"radius"},"Corner Radius":{attr:e=>e.cornerRadius||0},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="Line"&&!(e.getParent()&&e.getParent()instanceof ke))};case"Dimension":return{Layer:{attr:"layerId",value:[13,3,4]},Unit:{attr:"unit"},"Line Width":{attr:"width"},Height:{attr:"height"},Precision:{attr:"precision"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},is:e=>e instanceof qs||e instanceof Ga||e instanceof da,getAllItem(){return[].concat(Yo.getAllItem(),os.getAllItem(),jo.getAllItem())}};case"Image":return{Layer:{attr:"layerId",value:this.getAllowedLayers("Text")},Mirror:{attr:"mirror"},Rotation:{attr:"rotation"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},is:e=>e instanceof Mn,getAllItem:()=>Bn.getAllItem()};case"Colorful Image":return{Layer:{attr:"layerId",value:this.getAllowedLayers("Text")},Mirror:{attr:"mirror"},Rotation:{attr:"rotation"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},is:e=>e instanceof Ps,getAllItem:()=>So.getAllItem()};case"Group":return{"Group Name":{attr:e=>e.model.name,cannotDisplay:!0},is:e=>e instanceof qc,getAllItem:()=>Ht.getAllItem()};case"3D Shell - Outline":return{"Type.attr":{attr:e=>e.getComponent().getShowType(),value:["Push cover","Upper and lower shell"]},Layer:{attr:"layerId",value:[53]},"Overall height of shell":{attr:e=>e.getComponent().shellHeight},"PCB Height From The Bottom Surface of Shell":{attr:e=>e.getComponent().substrateHeight},"Height of lower shell":{attr:e=>e.getComponent().botShellHeight},"Shell thickness":{attr:e=>e.getComponent().shellThickness},"Line Width":{attr:"strokeWidth"},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Shape:{attr:this.getShape},Radius:{attr:"radius"},"Corner Radius":{attr:e=>e.cornerRadius||0},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="3D Shell - Outline"&&!(e.getParent()&&e.getParent()instanceof ke))};case"3D Shell - Screw Pillar":return{"Screw specifications":{attr:e=>e.getComponent().specification},Layer:{attr:"layerId",value:[54,55]},Height:{attr:e=>e.getComponent().height},"3DShell.screwHoleDiameter":{attr:e=>e.getComponent().holeDiameter},"3DShell.screwThickness":{attr:e=>e.getComponent().holeDiameter},"Need Stiffener":{attr:e=>e.getComponent().needStiffener},"Top Width of Stiffener":{attr:e=>{let r=e.getComponent();return r.stiffenerProps?r.stiffenerProps.topWidth:0}},"Bottom Width of Stiffener":{attr:e=>{let r=e.getComponent();return r.stiffenerProps?r.stiffenerProps.bottomWidth:0}},"Stiffener Height":{attr:e=>{let r=e.getComponent();return r.stiffenerProps?r.stiffenerProps.height:0}},"Stiffener Thickness":{attr:e=>{let r=e.getComponent();return r.stiffenerProps?r.stiffenerProps.stiffThickness:0}},"Need Counterbore":{attr:e=>e.getComponent().needCounterbore},"Counterbore Height":{attr:e=>{let r=e.getComponent();return r.counterboreProps?r.counterboreProps.height:0}},"Counterbore Diameter":{attr:e=>{let r=e.getComponent();return r.counterboreProps?r.counterboreProps.diameter:0}},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="3D Shell - Screw Pillar"&&!(e.getParent()&&e.getParent()instanceof ke),[Pr])};case"3D Shell - Side Datum Line":return{Layer:{attr:"layerId",value:[54,55]},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>e.type=="3D Shell - Side Datum Line"&&!(e.getParent()&&e.getParent()instanceof ke),[lt])};case"3D Shell - Slot Region":return{"Type.attr":{attr:e=>e.getComponent().getShowType(),value:["Top/Bottom Slot Region","Side Slot Region"]},Layer:{attr:"layerId",value:[54,55]},Baseline:{attr:e=>e.type==="3D Shell - Top/Bottom Entity"?null:e.getComponent().lineId},"Slot depth":{attr:e=>e.getComponent().slotDepth},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Shape:{attr:this.getShape},Radius:{attr:"radius"},"Corner Radius":{attr:e=>e.cornerRadius||0},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>["3D Shell - Side Slot Region","3D Shell - Top Slot Region"].includes(e.type)&&!(e.getParent()&&e.getParent()instanceof ke))};case"3D Shell - Entity":return{"Type.attr":{attr:e=>e.getComponent().type=="side"?"Side Entity":"Top/Bottom Entity",value:["Top/Bottom Entity","Side Entity"]},Layer:{attr:"layerId",value:[54,55]},Baseline:{attr:e=>e.type==="3D Shell - Top/Bottom Entity"?null:e.getComponent().lineId},"Stretch Length":{attr:e=>e.getComponent().stretchLength},Belong:{attr:e=>{if(e.type==="3D Shell - Top/Bottom Entity")return null;let r=e.getComponent();return ml.getBelongOptions()[r.belong].text},value:ml.getBelongOptions().map(e=>e.text)},Locked:{attr:"locked"},ID:{attr:"number"},globalIndex:{attr:"globalIndex"},Shape:{attr:this.getShape},Radius:{attr:"radius"},"Corner Radius":{attr:e=>e.cornerRadius||0},"Group Name":{attr:e=>Ht.getGroupNameByGroupId(e.getGroupID()),cannotDisplay:!0},...this.getAllItemAndIsMethodOf2DLine(e=>["3D Shell - Side Entity","3D Shell - Top/Bottom Entity"].includes(e.type)&&!(e.getParent()&&e.getParent()instanceof ke))}}}getShape(t){return t instanceof Pr||t.getParent()instanceof Pr?"Round":t instanceof rr||t.getParent()instanceof rr?"Rectangle":"Polygon"}getAllAttrConfig(t,e){if(t!=3&&t!=4)return;let r={},i=e&&e.plainObj;this._attrsForDocType[t].forEach(s=>{let a=Ss(this.configForObjType(s));t==4&&(delete a.Net,delete a["Copper Bridge"],delete a["Copper Bridge List"]),i&&(delete a.getAllItem,delete a.is);for(let l in a)i&&typeof a[l].attr=="function"&&delete a[l].attr,a[l].value&&(a[l].value=this.convertCanvasValueToShowStrOrStrArr(l,a[l].value));r[s]=a});let n={};for(let s in this._inputType)n[s]=this._inputType[s],this._inputType[s].value=="function"&&(n[s].value=this._inputType[s].value());return{attrConfig:r,inputType:n,unit:R.getInstance().unit}}getAllItemAndIsMethodOf2DLine(t,e=[Pr,lt,rr]){return{is:r=>e.some(i=>r instanceof i)&&t(r),getAllItem:()=>[].concat(e.includes(lt)?pt.getAllItem():[],e.includes(rr)?Xt.getAllItem():[],e.includes(Pr)?Kt.getAllItem():[]).filter(t)}}mergeSimilarValue(t){return Array.from(new Set(t.filter(e=>!!e)))}allPropertyName(){let t=[];return Ar.getAllItem().forEach(r=>Array.prototype.push.apply(t,Object.keys(r.attrKeyValue))),this.mergeSimilarValue(t)}getFontFamilyOption(){let t=new Array;for(let e in le.fontConfig.info){let r=le.fontConfig.info[e];t.push(r.family)}return t}allPropertyNameShow(){let t=ri.getAllItem().filter(e=>!!e.key&&(e.showKey||e.showValue)).map(e=>e.key);return this.mergeSimilarValue(t)}getAllBlindVia(){let t=[],e=new Set([1,2]),r=new Set([1,2]);for(let i of re.getInstance().getAllBlindPhysics())for(let n of i.data)t.push(n.name),e.add(n.startLayer),r.add(n.endLayer);return{ruleNames:t,startLayers:Array.from(e),endLayers:Array.from(r)}}getAllowedLayers(t){switch(t){case"Text":return Pe.getAllLayer().filter(e=>e.visible?!["TOP_SOLDER_MASK","BOT_SOLDER_MASK","OUTLINE","MULTI","PLANE","HOLE"].includes(e.type):!1).map(e=>e.layerID);case"Signal":return Pe.getAllSignalLayer().filter(e=>e.visible).map(e=>e.layerID);case"Fill Region":return Pe.getAllLayer().filter(e=>e.visible?!["OUTLINE","MULTI","PLANE","HOLE"].includes(e.type):!1).map(e=>e.layerID);case"Constraint Region":{let e=new Array,r=Pe.getAllLayer();for(let i of r)(ar(i.layerID)||i.config&&i.isSignalLayer()||i.config&&i.isPlaneLayer())&&e.push(i.layerID);return e}case"Line":return Pe.getAllLayer().filter(e=>e.visible?!["MULTI","PLANE","HOLE"].includes(e.type):!1).map(e=>e.layerID);default:throw Error("Wrong forType")}}allNet(){return a2(Ye.getAllNets())}reuseBlocks(t){let e=Ar.getAllItem().map(i=>i.reuseBlock),r=Array.from(new Set(e.concat(t))).filter(i=>!!i);return a2(r)}convertCanvasValueToShowStrOrStrArr(t,e){return Array.isArray(e)?e.map(r=>this.convertCanvasValueToShowStr(t,r)):this.convertCanvasValueToShowStr(t,e)}convertCanvasValueToShowStr(t,e){if(e==null||typeof e=="number"&&isNaN(e))return"";let r=e;switch(t){case"Start Layer":case"End Layer":case"Layer":r=Pe.getLayer(e).name;break;case"Size":r=e==1?"General":"Custom";break;case"Via Type":r=e==1?"Blind Via":"Through Via";break;case"Rotation":case"Hole Rotation":r=Vz(Gee(e/Math.PI*180),{decimalPlacesShow:1});break;case"Origin":r=this._origin[e-1];break;case"Fill Style":r=e=="45grid"?"Grid 45\xB0":e=="90grid"?"Grid 90\xB0":"Solid";break;case"Shape":case"Hole Shape":switch(e){case"RECT":r="Rectangle";break;case"ELLIPSE":r="Round";break;case"OVAL":r="Oval";break;case"POLYGON":r="Polygon";break;case"SLOT":r="Slot";break}break;default:this._inputType[t]&&(this._inputType[t].type==="textInputWithUnit"?r=aa(e,R.getInstance().unit):this._inputType[t].value==this._yesOrNo&&(r=e===!0?"Yes":e===!1?"No":""))}return String(r)}removeAttrPrefix(t){return t.startsWith("attrs-")?t.split("attrs-")[1]:t}getElementAttrValue(t,e,r){let i,n=r[e].attr;return typeof n=="function"?i=n(t):e.startsWith("attrs-")?i=t.attrKeyValue[n]:n==="number"?i=t.getParent()?`${Tr}${t.getParent().number}${Tr}${t[n]}`:`${Tr}${t[n]}`:i=t[n],i}matchDisplayCond(t,e,r){var s,a;let i=(s=t.attrKeyText[e])==null?void 0:s.showKey,n=(a=t.attrKeyText[e])==null?void 0:a.showValue;switch(r){case"onlyKey":return i&&!n;case"onlyValue":return!i&&n;case"both":return i&&n;case"none":return!i&&!n;default:return!0}}matchConditionForOneAttr(t,e,r,i,n,s){var u;if(r===void 0)return!1;let a=t=="Copper Bridge List",l=s&&((u=this._inputType[t])!=null&&u.translate)&&i.attrValueEn||i.attrValue;if((l==null||l==="")&&i.mode=="contain")return!0;l=l==null?"":l.toString();let c=Array.isArray(r)?r:[r],h=!1;for(let d=0;d<c.length;d++){let p=c[d],m=this.convertCanvasValueToShowStr(t,p),g=n.includes("caseSensitive");if(i.mode==="equal"){let T;if(a){let I=new Set(l.split(" ")),C=new Set(c);T=I.size===C.size&&[...I].every(E=>C.has(E))}else T=g?m===l:m.toLowerCase()===l.toLowerCase();l!==""&&T&&t.startsWith("attrs-")&&e.add(t),h=T||h;continue}if(i.mode==="contain"&&a){h=l.split(" ").every(I=>c.some(C=>C.includes(I))),h&&t.startsWith("attrs-")&&e.add(t);continue}let y=n.includes("wildChar");if(!n.includes("expression")){let T=y?/[\/\\+^$|\-()\[\]{}!]/g:/[\/*\\+?^$|\-()\[\]{}!]/g;l=l.replace(T,I=>"\\"+I)}y&&(l=l.replace(/\*/g,".*").replace(/\?/g,"."));try{new RegExp(l)}catch{this.errorMsg="Regular Expression Illegal!";return}let P=new RegExp(l,g?"":"i").test(m);l!==""&&P&&t.startsWith("attrs-")&&e.add(t),h=P||h}return h}matchEveryConditions(t,e,r,i,n,s){let a=Object.keys(i).filter(l=>l!="getAllItem"&&l!="is");return t.every(l=>{let c=l.attrName=="All",h=c?a:[l.attrName],u=!1;for(let d=0;d<h.length;d++){let p=h[d];if(!(s=="Component"&&!this.matchDisplayCond(e,this.removeAttrPrefix(p),l.attrDisplay)))if(l.mode=="any")u=!0;else{let m=this.getElementAttrValue(e,p,i);u=this.matchConditionForOneAttr(p,r,m,l,n,c)||u}}return u})}objMatched(t,e,r,i,n="currentPage"){this.errorMsg=null;let s="findObjMatched-time";Cn(s),this.startIndex=0,this.endIndex=300,this.searchValue="";let a=new Set;this.configForFindObj=this.getAllAttrConfig(R.getInstance().doctype).attrConfig[t];let l;n=="selected"&&this.configForFindObj.is?l=ze.getSelects().filter(m=>this.configForFindObj.is(m)):l=this.configForFindObj.getAllItem();let c=l.filter(m=>t=="Component Property"&&i!="any"&&m.key!=i?!1:this.matchEveryConditions(r,m,a,this.configForFindObj,e,t));if(this.objType=t,this.passFilter=c,this.errorMsg){A.publish("showPcbAlertMsg",this.errorMsg,Q());return}if(c.length==0)return{valueArr:[],titleArr:[]};let h=this.getResult(),u=Object.keys(this.configForFindObj).filter(m=>m!="getAllItem"&&m!="is"),d=new Set([t].concat(u.filter(m=>!m.startsWith("attrs-")||a.has(m)).map(m=>this.removeAttrPrefix(m)))),p=c.map(m=>m.globalIndex);return Xi(s),{valueArr:h,titleArr:Array.from(d),needTranslate:this._inputType,allIds:p}}getResult(){let t=this.passFilter,e=this.objType,r=this.configForFindObj;if(!t||!t.length||!e)throw Error("\u6CA1\u6709\u67E5\u627E\u7ED3\u679C");let i=new Array(t.length).fill(null),n=Object.keys(r).filter(s=>s!="getAllItem"&&s!="is");for(let s=this.startIndex;s<Math.min(this.endIndex,t.length);s++){let a=t[s];i[s]=this.getObj(a,n)}return i}getObj(t,e){let r=this.objType,i=this.configForFindObj,n={};if(t instanceof ke)n[r]=t.name;else if(t instanceof qc)n[r]=t.globalIndex;else if(t instanceof Le&&t.getParent()){let s=t.getParent();s instanceof ke&&(n[r]=`${s.name}: ${t.num}`)}else n[r]=`${Tr}${t.number}`;for(let s of e)n[this.removeAttrPrefix(s)]=this.convertCanvasValueToShowStrOrStrArr(s,this.getElementAttrValue(t,s,i));return n}};var ome=class{static getActiveTab(){var t;return(t=Q().UI)==null?void 0:t.tabBar.getActiveTab()}static getTabDocType(t){var e;return(e=Q().UI)==null?void 0:e.tabBar.getTabDocType(t)}};ome.handlers={};var D$e="|";var sme=class o{constructor(){this._layerId=1005;this._maskMap={};this._maskShapeMap={};this._nextIdIndex=0;this._defaultStyle=this.styleReviseByDefault(),A.messageBus.subscribe("pcb/addRectMasks",t=>{let{masks:e,tabId:r,adaptAll:i}=t||{},n=R.getInstance();[23].includes(n.doctype)||(r?n.tabId!=r:!n.isactive)||(e.forEach(s=>{this.addMask(s)}),i&&A.publish("adaptAll",{tabId:r}))}),A.messageBus.subscribe("pcb/clearRectMasks",t=>{let{tabId:e}=t||{},r=R.getInstance();[23].includes(r.doctype)||(e?r.tabId!=e:!r.isactive)||this.clear()}),A.messageBus.subscribe("pcb/positioningMark",t=>{let{id:e,tabId:r}=t||{},i=t==null?void 0:t.opt,n=R.getInstance();[23].includes(n.doctype)||(r?n.tabId!=r:!n.isactive)||(r&&(i=Object.assign(i,{tabId:r})),this.positioningMark(e,i))}),A.messageBus.subscribe("pcb/updateMaskState",t=>{let{ids:e,tabId:r,state:i}=t||{},n=R.getInstance();if([23].includes(n.doctype)||(r?n.tabId!=r:!n.isactive))return;(Array.isArray(e)?e:[e]).forEach(a=>{let l=this.getMask(a);!l||l.state==i||(l.state=i,this.resetMaskState(l))})})}static getInstance(){return o._instance||(o._instance=new o),o._instance}autoId(){return"mask_"+this._nextIdIndex++}getMask(t){return this._maskMap[t]}getMaskShape(t){return this._maskShapeMap[t]}getBBoxes(t){if(Array.isArray(t))return t.map(r=>e(r));return[e(t)];function e(r){return new ht(r.minX,r.maxX,r.minY,r.maxY)}}styleColorRevise(t){return t&&(typeof t.strokeColor=="string"&&(t.strokeColor=ee.of3(t.strokeColor)),typeof t.highlightColor=="string"&&(t.highlightColor=ee.of3(t.highlightColor)),t)}isNoneBBox(t){return t.width()==0&&t.height()==0}styleReviseByDefault(t){let e=this._defaultStyle||{strokeColor:ee.WHITE,strokeWidth:.1,highlightColor:ee.WHITE};return t=Object.assign({},e,this.styleColorRevise(t)),t}addMask(t){(!t.id||this.getMaskShape(t.id))&&(t.id=this.autoId());let{id:e,bboxes:r,style:i}=t,n=this.getBBoxes(r),s=this.styleReviseByDefault(i),a=[],l=new Jt;return n.forEach(c=>{if(this.isNoneBBox(c))if(t.links){if(!t.links.some(p=>{let m=l.getItem(p);if(m&&(c=m.buildBBox(),c))return!0}))return}else return;let h=new Sp(nr(),"Line",this._layerId,c.UL(),c.width(),c.height(),0,0,"",s.strokeWidth,!1,null,null,c),u=new rr(h);a.push(u),this.refreshMask(u,t)}),this._maskShapeMap[e]=a.length==1?a[0]:a,e}resetMaskState(t){var i;let{id:e}=t,r=this.getMaskShape(e);return r?(e==((i=this._lastPositionMask)==null?void 0:i.id)&&(this._lastPositionMask=null),Array.isArray(r)?r.forEach(n=>{this.refreshMask(n,t)}):this.refreshMask(r,t),e):this.addMask(t)}refreshMask(t,e){let{id:r,state:i,style:n}=e,s=Object.assign({},this._defaultStyle,n);e.style=s,i==0?(t.color=s.strokeColor,t.strokeWidth=s.strokeWidth,t.visible()):i==1?t.hidden():i==2&&(s.highlightColor&&(t.color=s.highlightColor),t.strokeWidth=s.strokeWidth+.5,t.visible()),A.publish("updateFrame",""),this._maskMap[r]=e}positioningMark(t,e){let r=this.getMaskShape(t),i=this.getMask(t);if(!r||!i)return;e=Object.assign({adaptAll:!1,selectLink:!0},e);let{tabId:n,adaptAll:s,selectLink:a}=e,l=new _e;(Array.isArray(r)?r:[r]).forEach(u=>{l.ext1(u.buildBBox())}),l.valid()||this.getBBoxes(i.bboxes).forEach(u=>{l.ext1(u.bbox())});let c=l.build().center();if(ze.highlight.cancelHighlightUnselect(),A.publish("clearSelect",{tabId:n}),this._lastPositionMask&&this._lastPositionMask.id!=t){let u=this.getMask(this._lastPositionMask.id);if(u){u.state=this._lastPositionMask.state;let d=this.getMaskShape(this._lastPositionMask.id);Array.isArray(d)?d.forEach(p=>{this.refreshMask(p,u)}):this.refreshMask(d,u)}}s&&A.publish("adaptAll",{tabId:n});let h=new Dt(c.x,c.y,0);if(Ai().setTarget(h),ql.show(c),ql.click(),clearTimeout(this._crossTimer),this._crossTimer=setTimeout(()=>{ql.remove(),A.publish("updateFrame","")},1e3),i.state==0&&(this._lastPositionMask=Ss(i),i.state=2,Array.isArray(r)?r.forEach(u=>{this.refreshMask(u,i)}):this.refreshMask(r,i)),a&&i.links){let u=new Jt,d=new Set;i.links.forEach(p=>{let m=u.getItem(p);m&&(d.add(m),m.click())}),d.size>0&&ze.select(d)}A.publish("updateFrame","")}deleteMask(t){let e=this.getMaskShape(t),r=this.getMask(t);return!e||!r?!1:(Array.isArray(e)?e.forEach(i=>i.remove()):e.remove(),delete this._maskShapeMap[t],delete this._maskMap[t],A.publish("updateFrame",""),!0)}clear(){for(let t in this._maskShapeMap){let e=this._maskShapeMap[t];Array.isArray(e)?e.forEach(r=>r.remove()):e.remove(),delete this._maskShapeMap[t]}this._maskMap={},this._lastPositionMask=null,this._nextIdIndex=0,A.publish("updateFrame","")}};var ame=class{getBoardInfo(){let t=0,e=0,r=Au();if(r.length>0){let n=new _e;if(r.forEach(s=>{let a=s.getMathGraphics();n.ext1(a.bbox())}),n.valid()){let s=n.build1();t=s.width(),e=s.height()}}return`${je(t,null,"mil")}mil x ${je(e,null,"mil")}mil(${je(t,null,"mm")}mm x ${je(e,null,"mm")}mm)`}getLayerAndShape(){var h;let t=new Map,e=new Set,r=new Set;this.setLayerMapShapes(Sn.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes(jn.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes(bn.getInstance().getAllItem(),t,e,r),this.setProfile2LayerMapShapes(Fi.getInstance().getAllItem(),t,e,r),this.setProfile2LayerMapShapes(Qi.getInstance().getAllItem(),t,e,r),this.setProfile2LayerMapShapes(vi.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes(io.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes(Hs.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes(Ms.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes(qo.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes(Xo.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes(Ma.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes(sl.getInstance().getAllItem(),t,e,r),this.setLayerMapShapes(Na.getInstance().getAllItem(),t,e,r);let i=Array.from(e),n=Array.from(r),s=new Array,a=new Map;for(let u of n){let d=0;for(let p of i){let m=((h=t.get(u))==null?void 0:h.get(p))||0;s.push(m),d+=m,a.set(p,(a.get(p)||0)+m)}s.push(d)}let l=0;for(let u of i){let d=a.get(u)||0;l+=d,s.push(d)}s.push(l),i.push("Total");let c=n.map(u=>{var d;return((d=Ze.getInstance().getLayer(u))==null?void 0:d.name)||""});return c.push("Total"),{rowKeys:i,colKeys:c,data:s}}setLayerMapShapes(t,e,r,i){let n=null,s=0;for(let a of t)n=e.get(a.layerId),i.add(a.layerId),n==null&&(n=new Map,e.set(a.layerId,n)),r.add(a.modelType),s=(n.get(a.modelType)||0)+1,n.set(a.modelType,s)}setProfile2LayerMapShapes(t,e,r,i){let n=null,s=0;for(let a of t)n=e.get(a.layerId),i.add(a.layerId),n==null&&(n=new Map,e.set(a.layerId,n)),r.add(a.type),s=(n.get(a.type)||0)+1,n.set(a.type,s)}getNetInfo(){var s,a;let t=re.getInstance().getAllNets(),e=new Array,r=new Array,i=new Array,n=new Array;for(let l of t){let c=l.name,h=((s=l.color)==null?void 0:s.toString())||"default",u=((a=Ye.getItem(c))==null?void 0:a.size)||0;n.push({net:c,color:h,count:u})}n.sort((l,c)=>c.count-l.count);for(let{net:l,color:c,count:h}of n)e.push(l),r.push(c),i.push(h);return{nets:e,colors:r,counts:i}}getWireMode(){switch(Zt.getInstance().mode){case"WIRING_MODE_PUSHAWAY":return"Push";case"WIRING_MODE_SURROUND":return"Around";case"WIRING_MODE_SURROUND_AND_PUSHAWAY":return"Around & Push";case"WIRING_MODE_OBSTRUCT":return"Block";case"WIRING_MODE_IGNORE":return"Ignore"}return""}getMoveComponentMode(){switch(le.pcbConfig.moveComponent){case"push":return"Push";case"block":return"Block";case"ignore":return"Ignore"}return""}getRealTimeInfo(){let t=Uu.switch,e=le.pcbConfig.addTeardropAutomatically,r=le.pcbConfig.isPlaceViasAutoShove,i=le.pcbConfig.coreRenderingEngine,n=le.pcbConfig.graphicEffectMode=="speedFirst"?"Speed Priority":"Quality Priority",s=this.getMoveComponentMode(),a=le.pcbConfig.realTimeUpdateUnusedLayers,l=this.getWireMode(),h=si.getInstance().getDefaultPanelize();return{"Real-Time DRC":t,"Add Teardrop Automatically":e,"Move/Place/Paste Via Follows Routing Mode":r,"Rendering Engine":i,"Display Effect":n,"Move Component":s,"Remove Unused Pad":a,"Routing Mode":l}}getRenderInfo(){try{return om.scene.getInfo()}catch{return{engine:"fail",fps:0,ptNum:0}}}getResult(){return{BoardSize:this.getBoardInfo(),LayerAndShape:this.getLayerAndShape(),net:this.getNetInfo(),realTimeInfo:this.getRealTimeInfo(),render:this.getRenderInfo()}}};function w$e(o){return window.localStorage.getItem(o)}var lme=class{bindListener(t){}};var cme=class extends lme{bindListener(t){let e=new nD(new vy);e.setProxy(new yG(t),!1),t.setHandle(e)}};var hme=class{bindListener(t){}};var ume=class extends nB{constructor(e){super();this.proxy=null;this.device=e}setProxy(e){this.proxy=e}async onDocDetail(e,r,i){let n=new oB;n.onDocDetail(e,r,i);let s=new Map,a=new Map,l=new Map,c=new Set;for(let u in this.device.attrMap){let d=this.device.attrMap[u],p=n.attr[u];p==null?l.set(u,d):d!=p?a.set(u,p):c.add(u)}for(let u in n.attr)c.has(u)||l.has(u)||a.has(u)||s.set(u,n.attr[u]);for(let u of this.device.getComponents()){let d=u.getAttr(),p=PB(u);for(let[m,g]of s){let y=d[m],b=!0;y!=null?$d(y,u)?b=!1:(y.value=g,this.addModel(y)):p[m]!=null&&(b=!1),b&&u.modifyATTRMap(m,g)}for(let[m,g]of a){let y=d[m],b=!0;y!=null?$d(y,u)?b=!1:(y.value=g,this.addModel(y)):p[m]!=null&&(b=!1),b&&u.modifyATTRMap(m,g)}for(let[m,g]of l){let y=d[m],b=!0;if(y!=null)if($d(y,u))b=!1;else{let T=Ji.getInstance().getItem(u.footprintUUID).getValue(m);T!=null&&(y.value=T,this.addModel(y),b=!1,u.modifyATTRMap(m,T))}else p[m]!=null&&(b=!1);b&&u.deleteATTRMap(m)}}let h=this.device.footprintUUID!=n.footprintUUID?this.getTemplate4Device():[];this.device.sycn(n),await this.update(h,n.footprintUUID)}getTemplate4Device(){let e=new Array;for(let r of this.device.getComponents())r.footprintUUID==this.device.footprintUUID&&!$d(r.idShape,r)&&e.push(r);return e}async update(e,r){for(let i of e)await this.proxy.replaceFootprint(i,r)}addModel(e){e!=null&&this.proxy!=null&&this.proxy.addModel(e,null)}deleteModel(e){e!=null&&this.proxy!=null&&this.proxy.deleteModel(e)}};var dme=class extends oD{build(){for(let t of this.models){let e=Xc(t);e instanceof lr&&ep.addText(e),e.refreshRender(),he.publish("hasModifyPcbItem",e)}Og.historyFlushService(),he.publish("updateRtree",""),he.publish("flushSelectingInfo",""),this.clear()}getLayer(t){return null}addNet(t){}getLayerPhy(t){}getNetModel(t){}getCombination(t){}addCombination(t){}deleteModel(t){super.deleteModel(t),iE(t),Og.historyFlushService()}preAdjust(t){let e=Ar.getItem(t.globalIndex);new Rb(e,"modify"),Ce.dispatch(e,"delete"),he.publish("hasModifyPcbItem",e)}async replaceFootprint(t,e){this.preAdjust(t);let i=new d1("2.0").save(t);this.deleteModel(t);let n=new p1(i);await n.replaceFootprint(e);for(let s of n.items)he.publish("hasModifyPcbItem",s);Og.historyFlushService(),he.publish("updateRtree",""),he.publish("flushSelectingInfo","")}};var pme=class extends hme{bindListener(t){let e=new ume(t);e.setProxy(new dme),t.setHandle(e)}};var fme=class{constructor(){this.debugLines=[];this.debugLines2=[];this.debugArcs=[];this.debugArrows=[];this.debugLineOrArcs=[]}displayLines(t,e=ee.of3("#FFFF00")){for(let r=0;r<t.length;r++){let i=t[r],n=new Gn(i,{color:e});n.display(),this.debugLines.push(n)}}clearLines(){for(let t=0;t<this.debugLines.length;t++)this.debugLines[t].remove();this.debugLines.length=0}displayPoints(t,e=ee.of3("#FFFF00")){for(let r=0;r<t.length-1;r++){let i=new M(t[r],t[r+1]),n=new Gn(i,{color:e});n.display(),this.debugLines2.push(n)}if(t.length===1){let r=new Gn(new M(t[0],t[0]),{color:e});r.display(),this.debugLines2.push(r)}}clearPoints(){for(let t=0;t<this.debugLines2.length;t++)this.debugLines2[t].remove();this.debugLines2.length=0}displayArc(t,e=ee.of3("#FFFF00")){let r=new Gn(t,{color:e});r.display();let i=new Gn(new M(t.start(),t.start()),{color:e}),n=new Gn(new M(t.end(),t.end()),{color:e});i.display(),n.display(),this.debugArcs.push(i,n),this.debugArcs.push(r)}clearArcs(){for(let t=0;t<this.debugArcs.length;t++)this.debugArcs[t].remove();this.debugArcs.length=0}displayArrow(t,e,r=ee.of3("#FFFF00")){let i=new Gn(new M(t,t.add(e)),{color:r});i.display(),this.debugArrows.push(i)}clearArrows(){for(let t=0;t<this.debugArrows.length;t++)this.debugArrows[t].remove();this.debugArrows.length=0}displayLineOrArc(t,e=ee.of3("#FFFF00")){let r=new Gn(t,{color:e});r.display(),this.debugLineOrArcs.push(r)}displayPolyline(t,e=ee.of3("#FFFF00")){t.primitives.forEach(r=>{(r instanceof M||r instanceof q)&&this.displayLineOrArc(r,e)})}clearLineOrArcs(){for(let t=0;t<this.debugLineOrArcs.length;t++)this.debugLineOrArcs[t].remove();this.debugLineOrArcs.length=0}clear(){this.clearPoints(),this.clearArcs(),this.clearArrows(),this.clearLines(),this.clearLineOrArcs()}};var mme=class{constructor(t,e){this.horizontal=new Array;this.vertical=new Array;this.distance=new Array;this.tool=new Jt;this.id=t,this.restriction=e}canMove(t){let e=this.tool.getItem(t);return e!=null&&!e.locked}moveItemInAllowedDirection(t,e,r,i,n){if(i[t])return;r=t=="x"?new S(r.x,0):new S(0,r.y);let s=Ae.translate(r.x,r.y,0);switch(this.restriction.condition){case 0:s=Ae.translate(r.x,0,0),r=new S(r.x,0);break;case 1:s=Ae.translate(0,r.y,0),r=new S(0,r.y);break;case 2:break}let a=this.restriction.start==this.id?this.restriction.end:this.restriction.start;if(n==a)return;if(!this.canMove(a)){i[t]=!0;return}if(e[t].has(a))return;e[t].add(a);let l=this.tool.getItem(a);_s.addCommand(l,"modify"),l.transform(s),this.horizontal.forEach(c=>{c.moveItemInAllowedDirection(t,e,r,i)}),this.vertical.forEach(c=>{c.moveItemInAllowedDirection(t,e,r,i)}),this.distance.forEach(c=>{c.moveItemInAllowedDirection(t,e,r,i)})}};var gme=class{constructor(){}get isMoving(){return this.gId!=null}move(t,e,r=!0,i=null,n=null){this.gId=t;let s={x:new Set([this.gId]),y:new Set([this.gId])},a={x:!1,y:!1},l=this.createTree();["x","y"].forEach(c=>{if(l[c].forEach(h=>{h.moveItemInAllowedDirection(c,s,e,a,i)}),a[c])s[c].clear();else{let h=Qt.getItem(this.gId);_s.addCommand(h,"modify");let u=Ae.translate(c=="x"?e.x:0,c=="y"?e.y:0,0);h.transform(u)}}),s.x.size==0&&s.y.size==0&&r?A.publish("ui/toastMsg",{type:"warn",msg:"The associated pad has been locked"},Q()):this.updateDimension(s,e,i,n),this.gId=null}updateDimension(t,e,r,i){if(!Object.keys(t).length)return;ah.getAllItem().forEach(a=>{let l=a.restriction;if(!l)return;let c=u(t,e,l.start),h=u(t,e,l.end);if(!c&&!h)return;if(c&&h&&c.equals1(h)){_s.addCommand(a,"modify");let d=Ae.translate(c.x,c.y,0);a.transform(d)}else{if(c){l.id!==i&&_s.addCommand(a,"modify");let d=Ae.translate(c.x,c.y,0);a.left=a.left.multiply4(d)}if(h){l.id!==i&&_s.addCommand(a,"modify");let d=Ae.translate(h.x,h.y,0);a.right=a.right.multiply4(d)}}function u(d,p,m){let g=d.x.has(m),y=d.y.has(m);if(g&&y)return new S(p.x,p.y);if(g)return new S(p.x,0);if(y)return new S(0,p.y)}})}createTree(){return{x:this.createTreeInOneDirection("x"),y:this.createTreeInOneDirection("y")}}createTreeInOneDirection(t){let e=new Set,r=new Set,i=new Set([this.gId]),n={};for(;i.size>0;){let c=u3.find(i);i.clear();for(let h in c)e.add(h);for(let h in c){let u=c[h];for(let d of u)if(l(d.condition)&&!r.has(d)){let p=new mme(h,d),m=n[h];m==null&&(m=new Array,n[h]=m),m.push(p),e.has(d.start)||i.add(d.start),e.has(d.end)||i.add(d.end),r.add(d)}}}let s=n[this.gId]||[],a=new Set([this.gId]);return this.iters(a,n,s),s;function l(c){return t=="x"?c==2||c==0:c==2||c==1}}iters(t,e,r){for(let i of r){let n;if(i.restriction.start==i.id?n=i.restriction.end:i.restriction.end==i.id&&(n=i.restriction.start),n&&!t.has(n)){let s=e[n];if(t.add(n),s!=null){for(let a of s)switch(a.restriction.condition){case 0:i.horizontal.push(a);break;case 1:i.vertical.push(a);break;case 2:i.distance.push(a);break}this.iters(t,e,s)}}}}};async function yme(o){return(await A.windowBridge.rpcCall("pro-ui/getWatermarkConfig",{watermarkType:o},Q())).message}function bme(o,t,e,r,i){if(!o||!t||!e||typeof i!="function")return;let{rowWithRowGap:n,columnWithColumnGap:s,deg:a}=o,l=r.x,c=r.y,h=Math.max(t,e),u=h*2,d=h*2,p=Math.ceil(u/s),m=Math.ceil(d/n);for(let g=0;g<p;g++)for(let y=0;y<m;y++){let b,P;a>0?(b=l+g*s,P=c+y*n-(d-e)):(b=l+g*s-(u-t)/2,P=c+y*n-(d-e)/2),i(new S(b,P))}}function L$e(o,t="image/png",e,r){return new Promise(i=>{try{let n=o.width,s=o.height,a=document.createElement("canvas");a.width=n,a.height=s;let l=a.getContext("2d");if(!l)return console.error("Failed to get canvas 2D context"),i(null);if(l.putImageData(o,0,0),r){let{text:c,fontSize:h,deg:u,color:d}=r,p=u*Math.PI/180,m=h+"px serif",g=`rgba(${d.join(",")})`;bme(r,n,s,S.ORIGIN,y=>{l.save(),l.rotate(p),l.font=m,l.fillStyle=g,l.fillText(c,y.x,y.y),l.restore()})}a.toBlob(c=>{if(!c)return console.error("Canvas toBlob failed"),i(null);i(c)},t,e)}catch(n){console.error(n),i(null)}})}async function Pme(o){var i;let t={success:!1,errorMsg:""};if(typeof ClipboardItem>"u")return t.errorMsg="ClipboardItem API \u4E0D\u88AB\u5F53\u524D\u6D4F\u89C8\u5668\u652F\u6301",t;if(!((i=navigator.clipboard)!=null&&i.write))return t.errorMsg="\u526A\u8D34\u677F API \u4E0D\u88AB\u5F53\u524D\u6D4F\u89C8\u5668\u652F\u6301",t;window.focus();let e={};if((Array.isArray(o)?o:[o]).forEach(n=>{let s=n.type;if(!s){t.errorMsg="Blob \u7C7B\u578B\u65E0\u6548\uFF0C\u8BF7\u6307\u5B9A MIME \u7C7B\u578B";return}e[s]=n}),Object.keys(e).length==0)return t;try{return await navigator.clipboard.write([new ClipboardItem(e)]),t.success=!0,t}catch(n){return n instanceof TypeError?t.errorMsg="\u521B\u5EFA\u526A\u8D34\u677F\u9879\u76EE\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5 MIME \u7C7B\u578B":n.name==="NotAllowedError"?t.errorMsg="\u526A\u8D34\u677F\u5199\u5165\u6743\u9650\u88AB\u62D2\u7EDD":t.errorMsg=`\u590D\u5236\u5230\u526A\u8D34\u677F\u5931\u8D25: ${n.message}`,console.error(n),t}}async function M$e(o){let t=document.createElement("canvas"),e=t.getContext("2d");if(!e)return console.error("Could not create canvas context"),null;t.width=o instanceof VideoFrame?o.displayWidth:o.width,t.height=o instanceof VideoFrame?o.displayHeight:o.height;try{if(o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof ImageBitmap||o instanceof OffscreenCanvas)e.drawImage(o,0,0);else if(o instanceof HTMLVideoElement)o.readyState<HTMLMediaElement.HAVE_CURRENT_DATA&&await new Promise(i=>{o.addEventListener("loadeddata",()=>i(),{once:!0})}),e.drawImage(o,0,0,t.width,t.height);else if(o instanceof VideoFrame)e.drawImage(o,0,0,o.displayWidth,o.displayHeight),o.close();else return console.error("Unsupported image source type"),null}catch(i){return console.error(`Failed to draw image source: ${i}`),null}return t.toDataURL("image/png")}function N$e(){A.publish("ui/toastMsg",{type:"warn",msg:"No selected primitives!"},f0())}function Tme(o,t=""){let e=null;o?e={type:"success",msg:"Copy Success!"}:e={type:"error",msg:{text:"Copy Failed: {error}!",i18nParam:{error:t}}},A.publish("ui/toastMsg",e,f0())}function Ime(o){let t=ze.getSelects();if(!t||t.length==0)return N$e(),null;let{getParentShape:e,filterRatline:r}=o||{},i=new Set,n=new _e,s=new Set;t.forEach(l=>{if(l.isEmpty||r&&l instanceof mn)return;if(e){let d=l.getParent();d&&!(d instanceof ke)&&(l=d)}if(s.has(l))return;let c=l.globalIndex,h;try{h=l.bbox()}catch{}let u;l instanceof ke&&(u=l.getAttrBBox()),s.add(l),i.add(c),h&&n.ext1(h),u&&n.ext1(u)});let a=n.build1();return{selectSet:s,selectedIds:i,selectedBBox:a}}function k$e(o){let t=Pe.getRatlineLayer(),e=t.visible,r=jt.getVisible(35),i=new Set;return rOe(n=>{var l;let s=n.globalIndex;if(o.has(s)||!n.isVisible||n instanceof ke)return;let a=(l=n.getParent())==null?void 0:l.globalIndex;a&&o.has(a)||(i.add(s),n.hidden())}),ze.clearSelect(),e&&(t.visible=!1),r&&jt.setVisible(35,!1),Mo.modify(),{hiddenIds:i,ratlineVisible:e,drcVisible:r}}function B$e(o,t,e=!1,r=!1){e&&(Pe.getRatlineLayer().visible=e),r&&jt.setVisible(35,r),A.publish("onlySelect",o),t&&rOe(i=>{let n=i.globalIndex;t.has(n)&&i.visible()}),Mo.modify()}function Cme(o,t){let e=R.getInstance(),r=10,i=4096,{minPixelLength:n,maxPixelLength:s,canvasScale:a}=t||{};if(n>0||(n=r),s>0||(s=i),!a){let g=e.getRatio();a=Ai().getScale()/g}let l=Math.ceil(o.width()),c=Math.ceil(o.height()),h=a,u=Math.ceil(h*l),d=Math.ceil(h*c),p=u<n||d<n,m=u>s||d>s;if(p||m){let g=c/l,y=m?s:n;if(m){let b=g<1?y*g:y/g;g<1?(u=y,d=b):(u=b,d=y)}else{let b=g>1?y*g:y/g;g>1?(u=y,d=b):(u=b,d=y)}h=u/l}return{showWidth:u,showHeight:d,scale:h}}async function gAe(o,t){t||(t=new Map);let e=new Set;for(let r of o)if(!r.isEmpty){if(r instanceof Ps){let i=r.hashId,n=r.source,s=await M$e(n);s&&t.set(i,s)}else if(r instanceof ke){let i=r.footprintUUID;if(e.has(i))continue;gAe(r.getItems(),t),e.add(i)}}return t}function F$e(o,t){let e=[];for(let r of o){if(r.isEmpty)continue;let i=r.getParent();t&&i&&t.has(i.globalIndex)||i&&o.has(i)||e.push(r)}return e}var TE=class{constructor(t,e,r,i){this._total=0;this._cur=0;this.childMap=[];this._percent=0;this._lastPercent=0;this.minUpdateProgress=.005;this.name=t||"",this._total=e||0,this.setMinUpdateProgress(i),this.bindTickCall(r),this._update()}_update(){this._total<0&&(this._total=0),this._cur>this._total&&(this._cur=this._total);let t=1,e=this.childMap.length,r=this._total+e*t,i=this._cur;return this.childMap.forEach(n=>{i+=n._percent*t}),this._percent=r==0?0:i/r,this._percent}get percent(){return this._percent}setMinUpdateProgress(t){t>=0&&t<=1&&(this.minUpdateProgress=t)}bindTickCall(t){this._tickCall=t}resetTotal(t){this._total=t,this._update()}start(t){if(t==this)return console.warn("IncorrectUse: cause a circular reference","at","TaskProgress.start"),t;let e=this.childMap;return e.includes(t)||(e.push(t),t._super=this,this._update()),t}startNumbers(t){t>0&&(this._total+=t,this._update())}end(t=!0){this._total==0&&(this._total=1),this._cur=this._total,t&&this.childMap.forEach(r=>r.end(t));let e=this._update();return this.tickCall(),e}tick(t=1){this._cur+=t;let e=this._update();return this.tickCall(),e}tickCall(){this._percent-this._lastPercent<this.minUpdateProgress||(this._lastPercent=this._percent,typeof this._tickCall=="function"&&this._tickCall.call(null,this._percent,this.name),this._super&&(this._super._update(),this._super.tickCall()))}};var JD={enableTransparentBackground:!0},V$e=3.5;var Sme=class o{constructor(){this.params=JD;this.initTool()}static getInstance(){return this._instance||(this._instance=new o),this._instance}initTool(){}resetParams(t){this.params=t?Object.assign({},JD,t):JD}async exportSelects(t){let{enableTransparentBackground:e}=this.params,r=4;t||(t=new TE("export-png/export-selects")),t.startNumbers(r);let i=Ime({getParentShape:!0,filterRatline:!0});if(!i)return t.tick(r),null;let{selectSet:n,selectedIds:s,selectedBBox:a}=i,l=Array.from(n);t.tick();let{hiddenIds:c,ratlineVisible:h,drcVisible:u}=k$e(s),d=we.smartMode&&Qt.allSmartPadVisible(!1);d&&ah.iterator(O=>{O.visible()});let p=!1;oa&&(p=oa.allDimensionVisible(!1)),(d||p)&&Mo.modify(),t.tick();let g=a.extendOfSize(1),{showWidth:y,showHeight:b,scale:P}=Cme(g,{canvasScale:V$e});e&&om.scene.modifyBgColor(ee.build(0,0,0,0));let I=await om.scene.getCaptureImageData(Math.floor(y),Math.floor(b),g,P,!1),C=new ImageData(I.data,I.width,I.height);t.tick();let E=R.getInstance();return e&&om.scene.modifyBgColor(E.backgroundColor),B$e(l,c,h,u),d&&Qt.allSmartPadVisible(!0),p&&oa&&oa.allDimensionVisible(!0),(d||p)&&Mo.modify(),t.tick(),C}async exportSelectsToClipboard(t,e){this.resetParams(t);let r=3;e||(e=new TE("export-png/export-selects-to-clipboard")),e.startNumbers(r);let i=await this.exportSelects(e);if(!i)return e.tick(r),!1;e.tick();let n=await yme("1"),s=await L$e(i,void 0,void 0,n);e.tick();let a=await Pme(s);e.tick();let{success:l,errorMsg:c}=a;return Tme(l,c),l}};var G$e="http://www.w3.org/2000/svg",U$e="http://www.w3.org/1999/xlink",H$e="none";var Eme=class o{constructor(){}initEncoderState(t,e,r){this.encodeOptions=e,this.encodeItems=t,this.initProgress(r),this.svgShapeSourceMap=new Map,this.svgNetTextSourceMap=new Map,this.componentTemplateSourceMap=new Map,this.encodingNet=!1,this.encodingRes=null}initProgress(t){let e=this.encodeItems.length;t||(t=new TE("svg-encoder")),t.startNumbers(e),this.progress=t}generateSvgSource(t,e,r){return this.initEncoderState(t,e,r),this.encoding(),this.finishEncoding(),this.checkValid()?this.encodingRes:null}encoding(){this.encodingShape(),this.encodeEncoderResult()}encodingShape(){let t=this.encodeItems,e=this.progress;this.beforeShapeEncoding(),t.forEach(r=>{this.encodePcbShape(r),e.tick()}),this.afterShapeEncoding()}putSvgShapeSource(t,e){if(!t)return;let r=this.svgShapeSourceMap,i=r.get(e);if(!i){if(!Pe.getLayer(e))return;i=[],r.set(e,i)}i.push(t)}putSvgNetTextSource(t,e){if(!t)return;let r=this.svgNetTextSourceMap,i=r.get(e);i||(i=[],r.set(e,i)),i.push(t)}encodeSvgSource(t,e,r=""){let i=`<${t}`;for(let n in e){let s=e[n];i+=Object.is(s,null)?` ${n}`:` ${n}="${s}"`}return i+=">",r&&(i+=r),i+=`</${t}>`,i}encodeBoolStr(t){return t?"true":"false"}encodeBoolNumber(t){return t?1:0}encodeColor(t){return t?t.toString():H$e}encodeNumber(t,e){return isNaN(t)?0:(isNaN(e)&&(e=this.encodeOptions.decimalPlaces),Nke(t,e,!1))}encodeOpacity(t){return t>1&&t<100?t/100:Math.max(0,Math.min(t,1))}encodePoint(t){return new S(t.x,-t.y)}encodeTransform(t){let e=t.data;return`matrix(${e[0]},${e[1]},${e[3]},${e[4]},${e[6]},${e[7]})`}encodePolyline(t,e){let r=t instanceof ge?[t]:t.items,i=new wS;r.forEach(l=>{i.encPl(l),l.isClose()&&i.close(!0)});let n=i.toString(),s={...e,d:n};return this.encodeSvgSource("path",s)}encodePrimitive(t,e){if(t instanceof q&&t.isCircle())return this.encodeCircle(t,e);let r=new wS;r.encPt(t);let i=r.toString(),n={...e,d:i};return this.encodeSvgSource("path",n)}encodeCircle(t,e){let r=this.encodePoint(t.center),i={...e,cx:r.x,cy:r.y,r:this.encodeNumber(t.rx)};return this.encodeSvgSource("circle",i)}encodeRect(t,e,r,i,n,s,a){let l=this.encodePoint(t),c=this.encodeNumber(i),h={...a,x:l.x,y:l.y,width:this.encodeNumber(e),height:this.encodeNumber(r)};if(c!=0&&(h.rx=h.ry=c),n!=0){let d=this.encodePoint(s),p=Qe.rotateD(-n).setOrigin1(d);h.transform=this.encodeTransform(p)}return this.encodeSvgSource("rect",h)}encodeImage(t,e,r,i,n,s,a){let l=this.encodePoint(e),c={...a,href:t,x:l.x,y:l.y,width:this.encodeNumber(r),height:this.encodeNumber(i)};if(s||n!=0){let u=s?Qe.rotateD(-n).multiply3(Qe.MIRROR_X).setOrigin1(l):Qe.rotateD(-n).setOrigin1(l);c.transform=this.encodeTransform(u)}return this.encodeSvgSource("image",c)}encodeShapeId(t){let e=t.model,r=t.getParent(),i=r?this.encodeShapeId(r):"",n=e.number;return i+`${Tr}${n}`}encodeAngle(t){return pb(t)}beforeShapeEncoding(){}encodePcbShape(t){try{if(t.isEmpty)return;t instanceof Ir||t instanceof yi?this.encodePcbTrack(t):t instanceof Pr?this.encodePcbCircle(t):t instanceof rr?this.encodePcbRect(t):t instanceof lt?this.encodePcbPolygon(t):t instanceof lr?this.encodePcbText(t):t instanceof Ue?this.encodePcbVia(t):t instanceof _i||t instanceof sn?this.encodePcbPad(t):t instanceof Ga?this.encodePcbProtractor(t):t instanceof qs?this.encodePcbDimension(t):t instanceof da?this.encodePcbRadiusMark(t):t instanceof Mn?this.encodePcbImage(t):t instanceof Ps?this.encodePcbPicture(t):t instanceof ke?this.encodePcbComponent(t):console.warn("Unsupported shape",this.encodeShapeId(t))}catch(e){console.error(e)}}encodeShapeBaseAttrs(t){let r=t.model.modelType||"",i={id:this.encodeShapeId(t),"data-layer-id":t.layerId,"data-model-type":r,"data-locked":this.encodeBoolStr(t.locked)};return t.isVisible||(i.visibility="hidden"),i}encodeProfileAttrs(t){let r=t.model.type,i=t.strokeWidth,n=t.lineColor,s=this.encodeShapeBaseAttrs(t),a=this.encodeColor(null),c=Math.max(.2,this.encodeNumber(i));switch(s["data-line-type"]=r,s["stroke-width"]=c,r){case"Slot Region":{let h=Pe.getLayer(47).color;s.fill=this.encodeColor(h),s.stroke=this.encodeColor(ee.WHITE);break}case"Slot Region":case"Fill Region":case"Constraint Region":case"TearDrop":case"FPC Stiffener":case"3D Shell - Side Slot Region":case"3D Shell - Top Slot Region":case"3D Shell - Side Entity":case"3D Shell - Top/Bottom Entity":case"3D Shell - Screw Pillar":case"3D Shell - Outline":{n&&!n.equals(ee.BLACK)?s.stroke=this.encodeColor(n):s.stroke=a;break}default:{s.fill=a;break}}return s}encodeNetText(t,e,r,i,n,s,a,l,c,h){if(!r)return;let d=this.encodeOptions.viewScale,p=l*d,m=c*d;if(p<s||m<s)return;p=Math.max(s,Math.min(p,a)),m=Math.max(s,Math.min(m,a));let g=Math.min(3,Math.min(p,m)/d),y=this.encodePoint(i),b=this.encodeNumber(y.x),P=this.encodeNumber(y.y),T="0.1em",I={"data-parent-id":t,x:b,y:P,"font-size":g,"text-anchor":"middle","alignment-baseline":"middle",dy:T};if(n!=0){let E=Qe.rotateD(-n).setOrigin1(y);I.transform=this.encodeTransform(E)}h&&(I.fill=this.encodeColor(h));let C=this.encodeSvgSource("text",I,r);this.putSvgNetTextSource(C,t)}encodePcbTrack(t){let e=this.encodeOptions.ignoreNet,r=this.encodingNet,i=this.encodeShapeId(t),n=t.layerId,s=t.model.primitive,a=t.width,l=t.net;if(!r){let u={...this.encodeShapeBaseAttrs(t),fill:this.encodeColor(null),"stroke-width":this.encodeNumber(a)},d=this.encodePrimitive(s,u);this.putSvgShapeSource(d,n)}if(l&&ea.getInstance().trackShowNet&&!e){let h=s.midPoint,u=s.length(),d=s.start(),p=s.end(),m=this.encodeAngle(p.angle(d));this.encodeNetText(i,n,l,h,m,12,30,u,a,null)}}encodeProfileFilling(t){t.model.type=="Prohibited Region"&&this.encodeProfileProhibitAreaFilling(t)}encodeProfileProhibitAreaFilling(t){let e=this.encodeOptions.viewScale,r=this.encodeShapeId(t),i=t.fillColor||ee.Gray,n=t.layerId,a=1/e,l=[];if(t instanceof Pr){let d=t.center,p=t.radius,m=d.add(new S(-1,1).mul(p*Math.sqrt(2)/2)),g=d.add(new S(1,-1).mul(p*Math.sqrt(2)/2)),y=m.y-m.x,b=g.y-g.x,P=p*2,T=Math.max(1,Math.min(6,P));for(y-=T;y>b;y-=T){let _=2*(y-d.y-d.x),x=d.x*d.x-p*p+(y-d.y)*(y-d.y),v=Math.sqrt(_*_-8*x),D=(-_+v)/4,w=(-_-v)/4,F=D+y,H=w+y,z=new M(new S(D,F),new S(w,H));l.push(z)}let I=d.add(new S(1,1).mul(p*Math.sqrt(2)/2)),C=d.add(new S(-1,-1).mul(p*Math.sqrt(2)/2)),E=I.y+I.x,O=C.y+C.x;for(E-=T;E>O;E-=T){let _=2*(d.y-E-d.x),x=d.x*d.x-p*p+(d.y-E)*(d.y-E),v=Math.sqrt(_*_-8*x),D=(-_+v)/4,w=(-_-v)/4,F=-D+E,H=-w+E,z=new M(new S(D,F),new S(w,H));l.push(z)}}else if(t instanceof rr){let d=t.getMathGraphics();d&&(l=VO(d))}else{let d=t.getMathGraphics(),p=d instanceof ge?d:d.items[0];p&&(l=VO(p))}if(l.length==0)return;let c="";l.forEach(d=>{let p={},m=this.encodePrimitive(d,p);c+=m});let h={"data-layer-id":n,"data-parent-id":r,fill:this.encodeColor(null),stroke:this.encodeColor(i),"stroke-width":this.encodeNumber(a)},u=this.encodeSvgSource("g",h,c);this.putSvgShapeSource(u,n)}encodeProfileBaseTexts(t){this.encodeProfileHoleBaseText(t),this.encodeProfileFpcBaseText(t)}encodeProfileHoleBaseText(t){let r=t.model.type,i="";if(r=="Constraint Region"?i=t.constrainName:r=="Partition"&&(i=t.lineColor.alpha===0?"":t.partitionName),!i)return;let n=this.encodeShapeId(t),s=t.layerId,a=0,l=10,c=15,h=null,u,d=0,p=0;if(t instanceof Pr)u=t.center,d=t.radius*2,p=d;else if(t instanceof rr){let g=t.leftLow,y=t.rightUp;u=g.add(y).mul(.5),d=t.width,p=t.height}else{let g=t.outline,y=new rI(g);u=y.center,d=g.bbox().width(),p=y.high}d=d*.75,this.encodeNetText(n,s,i,u,a,l,c,d,p,h)}encodeProfileFpcBaseText(t){if(t.model.type!="FPC Stiffener")return;let i=t.fpcMaterial;if(!i)return;let n=t.fpcThickness+"mm",s=this.encodeShapeId(t),a=t.layerId,l=0,c=10,h=15,u=ee.build(.2,.4,.8,1),d,p=0,m=0;if(t instanceof Pr)d=t.center,p=t.radius*2,m=p;else if(t instanceof rr){let P=t.leftLow,T=t.rightUp;d=P.add(T).mul(.5),p=t.width,m=t.height}else{let P=t.outline,T=new rI(P);d=T.center,p=P.bbox().width(),m=T.high}let g=d.add1(0,.25*m),y=d.add1(0,-.25*m);p=p*.75,this.encodeNetText(s,a,i,g,l,c,h,p,m,u),this.encodeNetText(s,a,n,y,l,c,h,p,m,u)}encodePcbCircle(t){let e=t.layerId,r=t.model.primitive,i=this.encodeProfileAttrs(t),n=this.encodePrimitive(r,i);this.encodeProfileFilling(t),this.encodeProfileBaseTexts(t),this.putSvgShapeSource(n,e)}encodePcbRect(t){let e=t.layerId,r=t.model.leftUp,i=t.width,n=t.height,s=t.cornerRadius,a=this.encodeAngle(t.rotation),l=this.encodeProfileAttrs(t),c=this.encodeRect(r,i,n,s,a,r,l);this.encodeProfileFilling(t),this.encodeProfileBaseTexts(t),this.putSvgShapeSource(c,e)}encodePcbPolygon(t){let e=t.layerId,r=t.getMathGraphics(),i=this.encodeProfileAttrs(t),n=this.encodePolyline(r,i);this.encodeProfileFilling(t),this.encodeProfileBaseTexts(t),this.putSvgShapeSource(n,e)}encodePcbText(t){let e=t.layerId,r=t.matrix.toMatrix3(),i=t.path.map(c=>c.multiply3(r)),n=t.strokeWidth,s=t.model.type==0,a=this.encodeShapeBaseAttrs(t),l="";if(s){let c={...a,fill:this.encodeColor(null),"stroke-width":this.encodeNumber(n)},h="";i.forEach(u=>{let d={},p=this.encodePolyline(u,d);h+=p}),l=this.encodeSvgSource("g",c,h)}else{let c={...a,stroke:this.encodeColor(null)};l=this.encodePolyline(new Bt(i),c)}this.putSvgShapeSource(l,e)}encodePcbVia(t){this.encodePcbViaShapes(t),this.encodePcbViaBaseTexts(t)}encodePcbViaShapes(t){let e=this.encodeShapeId(t),r=t.center,i=t.radius,n=q.buildCircle(r,i,ae.CCW),s=t.type==1,a=this.encodeColor(null);(t.unusedInnerLayers.length>0?t.usedLayers:t.grayIndex!=0?t.allLayers:[12]).forEach(p=>{let m={"data-layer-id":p,"data-parent-id":e,stroke:a},g=this.encodeCircle(n,m);this.putSvgShapeSource(g,p)});let c=t.holeRadius,h=47;if(s){let p=t.startLayer,m=t.endLayer,g=Pe.getLayer(p).color,y=Pe.getLayer(m).color,b=270,P=90,T=q.build2(r,b,P,c,c,ae.CCW),I=q.build2(r,P,b,c,c,ae.CCW),C={"data-parent-id":e,stroke:a},E={...C,"data-layer-id":p,fill:this.encodeColor(g)},O={...C,"data-layer-id":m,fill:this.encodeColor(y)},_=this.encodePrimitive(T,E),x=this.encodePrimitive(I,O);this.putSvgShapeSource(_,h),this.putSvgShapeSource(x,h)}else{let p=t.holeColor,m=q.buildCircle(r,c,ae.CCW),g={"data-layer-id":h,"data-parent-id":e,stroke:a};p&&!p.equals(ee.BLACK)&&(g.fill=this.encodeColor(p));let y=this.encodeCircle(m,g);this.putSvgShapeSource(y,h)}let u=t.topExpansion+i;if(u>0){let p=q.buildCircle(r,u,ae.CCW),m=5,g={"data-layer-id":m,"data-parent-id":e,stroke:a},y=this.encodeCircle(p,g);this.putSvgShapeSource(y,m)}let d=t.bottomExpansion+i;if(d>0){let p=q.buildCircle(r,d,ae.CCW),m=6,g={"data-layer-id":m,"data-parent-id":e,stroke:a},y=this.encodeCircle(p,g);this.putSvgShapeSource(y,m)}}encodePcbViaBaseTexts(t){let e=ea.getInstance(),r=e.viaShowNet,i=e.viaShowPair,n=r?t.net:"",s=i?t.layerPairStr:"";if(!n&&!s)return;let a=this.encodeOptions.ignoreNet,l=this.encodingNet,c=this.encodeShapeId(t),h=t.layerId,u=t.center,d=t.radius,p=t.holeRadius,m=d*2,g=p*2,y=this.getPadOrViaBaseTextPosition(n,s),b=u,P=u;if(y==1){let I=g*.25;b=new S(u.x,u.y-I),P=new S(u.x,u.y+I),g*=.5}let T=0;n&&!a&&this.encodeNetText(c,h,n,b,T,12,30,m,g),!l&&s&&this.encodeNetText(c,h,s,P,T,12,30,m,g)}encodePcbPad(t){this.encodingNet||this.encodePcbPadShapes(t),this.encodePcbPadBaseTexts(t)}encodePcbPadShapes(t){let e=t.model,r=e.top,i=e.inner,n=e.bottom;this.encodePcbSinglePadShape(r,1,t),i&&(t.usedLayers.length>0||t.type==2||t.grayIndex!=0?t.usedLayers.filter(l=>![1,2].includes(l)):[t.layerId]).forEach(l=>{this.encodePcbSinglePadShape(i,l,t)}),this.encodePcbSinglePadShape(n,2,t),this.encodePcbPadHoleShape(t)}encodePcbSinglePadShape(t,e,r){if(!t)return;let i=t.type,n=e,s=this.encodeShapeId(r),a=r.center,l=r.rotation,c=t.width,h=t.height,u=t.ratio,d=e==1,p=i=="POLYGON"?t.pl:null,m={"data-parent-id":s,"data-layer-id":n},g=this.encodePcbSinglePadShapeByOptions(i,a,l,c,h,u,m,p);g&&this.putSvgShapeSource(g,n);let y=this.getPadSolderExpansion(r,e);if(y||y==0){let P=d?5:6,T=p?xL(p,y):null,I=c+y*2,C=h+y*2,E=this.encodePcbSinglePadShapeByOptions(i,a,l,I,C,u,m,T);E&&this.putSvgShapeSource(E,P)}let b=this.getPadPasteExpansion(r,e);if(b||b==0){let P=d?7:8,T=c+b*2,I=h+b*2,C=p?xL(p,y):null,E=this.encodePcbSinglePadShapeByOptions(i,a,l,T,I,u,m,C);E&&this.putSvgShapeSource(E,P)}}encodePcbSinglePadShapeByOptions(t,e,r,i,n,s,a,l){let c;if(i<=0||n<=0)return c;let h=this.encodeColor(null);switch(t){case"ELLIPSE":{let u=q.buildCircle(e,i/2,ae.CCW),d={...a,stroke:h};c=this.encodeCircle(u,d);break}case"OVAL":{c=this.encodePcbPadHoleShapeByOptions(e,i,n,r,a);break}case"RECT":{let u=i/2,d=n/2,p=Math.min(u,d)*s,m=this.encodeAngle(r),g=e.add1(-u,d);c=this.encodeRect(g,i,n,p,m,e,a);break}case"POLYGON":{if(l){let u={...a,stroke:h};c=this.encodePolyline(l,u)}break}}return c}encodePcbPadHoleShape(t){let e=t.model,r=e.hole;if(!r)return;let i=this.encodeShapeId(t),n=e.rotation,s=e.center,l=r.holeRadius*2,c=r.holeLength,h=r.holeRotation,u=r.holeOffset,d=Ae.rotateZ(h).translate1(u.x,u.y,0).rotateZ(n).translate1(s.x,s.y,0),p=S.ORIGIN.multiply4(d),m=47,g={"data-layer-id":m,"data-parent-id":i},y=this.encodePcbPadHoleShapeByOptions(p,l,c,h,g);y&&this.putSvgShapeSource(y,m)}encodePcbPadHoleShapeByOptions(t,e,r,i,n){let s=this.encodeColor(null),a=Math.abs(e-r),l="";if(a>1e-4){let c,h=0;if(e>r){let d=(e-r)/2,p=new S(-d,0).rotate(S.ORIGIN,i).add(t),m=new S(d,0).rotate(S.ORIGIN,i).add(t);c=new M(p,m),h=r}else{let d=(r-e)/2,p=new S(0,-d).rotate(S.ORIGIN,i).add(t),m=new S(0,d).rotate(S.ORIGIN,i).add(t);c=new M(p,m),h=e}let u={...n,fill:s,"stroke-width":this.encodeNumber(h)};l=this.encodePrimitive(c,u)}else{let c={...n,stroke:s},h=q.buildCircle(t,e/2,ae.CCW);l=this.encodeCircle(h,c)}return l}encodePcbPadBaseTexts(t){let e=ea.getInstance(),r=e.padShowNet,i=e.padShowNum,n=r?t.net:"",s=i?t.num:"";if(!n&&!s)return;let a=this.encodeOptions.ignoreNet,l=this.encodingNet,c=this.encodeShapeId(t),h=t.layerId,u=t.center,d=t.rotation,p=this.getPadOrViaBaseTextPosition(n,s),m=this.padIsCircle(t),g=m?new S(1,0):new S(Math.cos(d),Math.sin(d)),y=new S(-g.y,g.x),b=Math.atan2(g.y,g.x);(b<-Go||b>Go)&&(y=new S(g.y,-g.x)),b<0&&(g=g.mul(-1));let P=u,T=u,I=this.getPadWidth(t),C=this.getPadHeight(t);if(p==1)if(I>=C){let _=y.mul(C*.25);P=u.sub(_),T=u.add(_),C*=.5}else{let _=g.mul(I*.25);P=u.sub(_),T=u.add(_),I*=.5}let E=d;I==C||m?E=0:(I<C&&(E+=Go),E=NP(E));let O=this.encodeAngle(E);if(C>I){let _=I;I=C,C=_}n&&!a&&this.encodeNetText(c,h,n,P,O,12,30,I,C),!l&&s&&this.encodeNetText(c,h,s,T,O,12,30,I,C)}encodePcbProtractor(t){let e=t.layerId,r=t.center,i=t.start,n=t.end,s=t.strokeWidth,{startAngle:a,endAngle:l,sweep:c,textAngleCenter:h,textAngleRadius:u}=this.getPcbProtractorShapeData(t),d=new M(i,r),p=new M(r,n),m=ge.build2([d,p]),g={},y=this.encodePolyline(m,g),b=10,P=q.build2(r,a,l,b,b,c),T={},I=this.encodePrimitive(P,T),C="",E=t.textMatrix.toMatrix3();t.textPath.map(W=>W.multiply3(E)).forEach(W=>{let L={},k=this.encodePolyline(W,L);C+=k});let _={},x=this.encodeSvgSource("g",_,C),v=q.buildCircle(h,u,c),D={},w=this.encodePrimitive(v,D),H={...this.encodeShapeBaseAttrs(t),fill:this.encodeColor(null),"stroke-width":this.encodeNumber(s)},z=y+I+x+w,V=this.encodeSvgSource("g",H,z);this.putSvgShapeSource(V,e)}encodePcbDimension(t){let e=t.layerId,r=t.start,i=t.end,n=t.left,s=t.right,a=t.lineLen,l=t.arrLineLen,c=t.strokeWidth,u=t.model.text.width,d=QC(r,i,n,s,u,a,l),p="";d.forEach(x=>{let v={},D=this.encodePrimitive(x,v);p+=D});let m={},g=this.encodeSvgSource("g",m,p),y="",b=t.textMatrix.toMatrix3();t.textPath.map(x=>x.multiply3(b)).forEach(x=>{let v={},D=this.encodePolyline(x,v);y+=D});let T={},I=this.encodeSvgSource("g",T,y),E={...this.encodeShapeBaseAttrs(t),fill:this.encodeColor(null),"stroke-width":this.encodeNumber(c)},O=g+I,_=this.encodeSvgSource("g",E,O);this.putSvgShapeSource(_,e)}encodePcbRadiusMark(t){let e=t.layerId,r=t.start,i=t.end,n=t.strokeWidth,s=t.model.text,a=i.sub(r).normalize(),l=Math.PI/4,c=3,h=Ae.rotateZ(l),u=Ae.rotateZ(-l),d=a.multiply4(h).mul(c),p=a.multiply4(u).mul(c),m=[new M(r,i),new M(i,i.sub(d)),new M(i,i.sub(p))],g="";m.forEach(D=>{let w={},F=this.encodePrimitive(D,w);g+=F});let y={},b=this.encodeSvgSource("g",y,g),P="",T=t.textMatrix.toMatrix3();t.textPath.map(D=>D.multiply3(T)).forEach(D=>{let w={},F=this.encodePolyline(D,w);P+=F});let C={},E=this.encodeSvgSource("g",C,P),_={...this.encodeShapeBaseAttrs(t),fill:this.encodeColor(null),"stroke-width":this.encodeNumber(n)},x=b+E,v=this.encodeSvgSource("g",_,x);this.putSvgShapeSource(v,e)}encodePcbImage(t){let e=t.layerId,r=t.matrix.toMatrix3(),i=t.path.map(c=>c.multiply3(r)),n=new Bt(i),a={...this.encodeShapeBaseAttrs(t),stroke:this.encodeColor(null)},l=this.encodePolyline(n,a);this.putSvgShapeSource(l,e)}encodePcbPicture(t){let e=this.encodeOptions.pictureDataUrlMap;if(!e)return;let r=t.hashId,i=e.get(r);if(!i)return;let n=t.layerId,s=t.leftUp,a=t.width,l=t.height,c=this.encodeAngle(t.rotation),h=is(n)!=t.mirror,u=this.encodeShapeBaseAttrs(t),d=this.encodeImage(i,s,a,l,c,h,u);this.putSvgShapeSource(d,n)}encodePcbComponent(t){let e=t.footprintUUID,r=t.layerId,i=t.position,n=t.rotation,s=this.encodingNet,a=e+"-"+r;if(this.encodePcbComponentTemplate(t,a)){let c=this.encodeShapeBaseAttrs(t),h=this.encodePoint(i),u=Qe.rotate(-n).translate1(h),d={...c,"xlink:href":`#${a}`,x:0,y:0,transform:this.encodeTransform(u)},p=this.encodeSvgSource("use",d);this.putSvgShapeSource(p,r)}t.iterateAttrs(c=>{(c.showKey||c.showValue)&&this.encodePcbShape(c)}),this.encodingNet=!0,t.iterateShapes(c=>{(c instanceof Ge||c instanceof Le||c instanceof Ue)&&c.net&&this.encodePcbShape(c)}),this.encodingNet=s}encodePcbComponentTemplate(t,e){let r=this.componentTemplateSourceMap;if(r.has(e))return r.get(e);let i=this.encodeOptions,n=t.model,s=t.position,a=t.rotation,l=S.ORIGIN,c=0,h=!s.equals1(l)||a!=c;if(h){let g=l.sub(s),y=c-a,b=Ae.translate1(new Dt(g.x,g.y,0)).rotateZ(y);n.transform(b)}let u=t.getItems(),d={...i,onlyKeepShapesSource:!0,shapesGroupNodeId:e,ignoreNet:!0},p=new o().generateSvgSource(u,d),m=p==null?void 0:p.svgSource;if(h){let g=s.sub(l),y=a-c,b=Ae.rotateZ(y).translate(new Dt(g.x,g.y,0));n.transform(b)}return r.set(e,m),m}afterShapeEncoding(){}encodeLayerAttrs(t){let e=t.layerID,r=this.encodeColor(t.color),i=this.encodeOpacity(1),n=this.encodeOpacity(1),s="round",a={"data-layer-id":e,fill:r,"fill-opacity":i,stroke:r,"stroke-opacity":n,"stroke-linecap":s,"stroke-linejoin":s};return t.visible||(a.visibility="hidden"),a}encodeShapesAttrs(){let t="shapes";return{id:t}}encodeShapeNetTextsAttrs(){let t="shape-net-texts",e=this.encodeColor(ee.WHITE),r=this.encodeColor(ee.BLACK),i=.01,n="Consolas,Courier,Monospace";return{id:t,fill:e,stroke:r,"stroke-width":i,"font-family":n}}getSvgViewData(){let{encodeItemsBBox:t,viewWidth:e,viewHeight:r,viewScale:i}=this.encodeOptions,n=t.width(),s=t.height(),a=n*i,l=s*i,c=t.UL();return{svgWidth:a,svgHeight:l,viewLeftTop:c,physicalWidth:n,physicalHeight:s}}encodeBackGroundShape(t){let{enableTransparentBackground:e}=this.encodeOptions,{viewLeftTop:r,physicalWidth:i,physicalHeight:n}=t,s=R.getInstance().getBgColor(),a=e?0:s.alpha,l="background",c={id:l,stroke:this.encodeColor(null),fill:this.encodeColor(s),"fill-opacity":this.encodeOpacity(a)};return this.encodeRect(r,i,n,0,0,r,c)}encodeSvgAttrs(t){let e=this.encodeOptions.viewScale,{svgWidth:r,svgHeight:i,viewLeftTop:n,physicalWidth:s,physicalHeight:a}=t,l=this.encodePoint(n),c=[l.x,l.y,s,a].join(" ");return{width:r,height:i,"data-view-scale":this.encodeNumber(e),viewBox:c,xmlns:G$e,"xmlns:xlink":U$e}}encodeWatermark(){let{watermarkConfig:t,viewScale:e}=this.encodeOptions;if(!t)return"";let{svgWidth:r,svgHeight:i}=this.getSvgViewData(),n=[],{text:s,fontSize:a,deg:l,color:c}=t,h=1/e,u=a/e,d="0.1em",p=255,m=c&&c.length>=4&&ee.build(c[0]/p,c[1]/p,c[2]/p,c[3]),g=this.encodeColor(m);bme(t,r,i,S.ORIGIN,P=>{let T=this.encodePoint(P.scale(1/e)),I=this.encodeNumber(T.x),C=this.encodeNumber(T.y),E={x:I,y:C};if(l!=0){let _=Qe.rotateD(l).setOrigin1(T);E.transform=this.encodeTransform(_)}let O=this.encodeSvgSource("text",E,s);n.push(O)});let y="watermarks",b={id:y,"stroke-width":h,"font-size":u,"text-anchor":"middle","alignment-baseline":"middle",dy:d};return g&&(b.stroke=g,b.fill=g),this.encodeSvgSource("g",b,n.join(""))}encodeEncoderResult(){let t=this.encodeOptions,e=t.onlyKeepShapesSource,r=t.shapesGroupNodeId,i=this.svgShapeSourceMap,n=this.svgNetTextSourceMap,s=this.componentTemplateSourceMap,a=this.getSvgViewData(),l=this.encodeBackGroundShape(a),c="";s.forEach(F=>{c+=F});let h={},u=this.encodeSvgSource("defs",h,c),d="";Array.from(i.keys()).sort((F,H)=>Pe.getLayer(H).order-Pe.getLayer(F).order).forEach(F=>{let H=Pe.getLayer(F),V=i.get(F).join(""),W=this.encodeLayerAttrs(H),L=this.encodeSvgSource("g",W,V);d+=L});let g=this.encodeShapesAttrs(),y=this.encodeSvgSource("g",g,d),b="";n.forEach(F=>{b+=F.join("")});let P=this.encodeShapeNetTextsAttrs(),T=this.encodeSvgSource("g",P,b),I=y+T,C=r||"shapes-net-texts-group",E={id:C},O=this.encodeSvgSource("g",E,I),_=this.encodeWatermark(),x=l+u+O+_,v=this.encodeSvgAttrs(a),D=this.encodeSvgSource("svg",v,x),w=`<?xml version="1.0" encoding="UTF-8" standalone="no"?>
`;this.encodingRes={svgSource:e?O:w+D}}checkValid(){return!0}finishEncoding(){this.cycleMemory()}cycleMemory(){this.encodeItems=null,this.progress=null,this.svgShapeSourceMap=null,this.svgNetTextSourceMap=null}getPadOrViaBaseTextPosition(t,e){return t!=""&&e!=""?1:t!=""&&e==""?2:t==""&&e!=""?2:3}padIsCircle(t){let e=t.model;return t.layerId==2?e.bottom.type=="ELLIPSE":e.top.type=="ELLIPSE"}getPadWidth(t){var i,n;let e=t.layerId,r=t.model;return e==2?(i=r.bottom)==null?void 0:i.width:(n=r.top)==null?void 0:n.width}getPadHeight(t){var i,n;let e=t.layerId,r=t.model;return e==2?(i=r.bottom)==null?void 0:i.height:(n=r.top)==null?void 0:n.height}getPadSolderExpansion(t,e){return e==1?t.topSolderExpansion:e==2?t.bottomSolderExpansion:null}getPadPasteExpansion(t,e){return e==1||e==2?t.pasteExpansion:null}getPcbProtractorShapeData(t){let e=t.layerId,r=t.center,i=t.start,n=t.end,s=t.viewWidth,a=t.viewHeight,l=t.strokeWidth,c=t.textMatrix,h=i.sub(r),u=n.sub(r),d=Math.atan2(h.y,h.x),p=Math.atan2(u.y,u.x);d==p&&(p+=1e-8);let g=h.cross(u)>=0?ae.CCW:ae.CW,b=new S(s,a).multiply4(c).add1(is(e)?-1:1,0),P=l/2+.1;return{startAngle:this.encodeAngle(d),endAngle:this.encodeAngle(p),sweep:g,textAngleCenter:b,textAngleRadius:P}}};var Ome=class o{constructor(){this.params=JD;this.initTool()}static getInstance(){return this._instance||(this._instance=new o),this._instance}initTool(){}resetParams(t){this.params=t?Object.assign({},JD,t):JD}async exportSelects(t){let{enableTransparentBackground:e}=this.params,r=2;t||(t=new TE("export-svg/export-selects")),t.startNumbers(r);let i=Ime({getParentShape:!0,filterRatline:!0});if(!i)return t.tick(r),null;let{selectSet:n,selectedIds:s,selectedBBox:a}=i;t.tick();let c=a.extendOfSize(1),{showWidth:h,showHeight:u,scale:d}=Cme(c),p=F$e(n,s),m=await gAe(p),g=await yme("1"),y={encodeItemsBBox:c,viewWidth:h,viewHeight:u,viewScale:d,decimalPlaces:5,pictureDataUrlMap:m,watermarkConfig:g,enableTransparentBackground:e},b=new Eme().generateSvgSource(p,y,t);return t.tick(),b?b.svgSource:null}async exportSelectsToClipboard(t,e){this.resetParams(t);let r=3;e||(e=new TE("export-svg/export-selects-to-clipboard")),e.startNumbers(r);let i=await this.exportSelects(e);if(!i)return e.tick(r),!1;e.tick();let n=new Blob([i],{type:"image/svg+xml"}),s=new Blob([i],{type:"text/plain"});e.tick();let a=await Pme([n,s]);e.tick();let{success:l,errorMsg:c}=a;return Tme(l,c),l}};var Ame=class{constructor(){this.moveTool=null;this._flipping=!1}flipComponent(t,e,r,i){let n=this.getCenter(r);this._flipping=!0;let s=i||new De("flip-component"),a=new hi().addGroup(s);Is.getInstance().init(r,a,async(l,c)=>{if(le.pcbConfig.allowFootprintFlipping){i=c.getCommand();for(let h of l)h instanceof ke&&(i.addCommand(Ce.dispatch(h,"modify")),await this.updateComponentFootprint(h,t=="Flip Up and Down",n,i));if(!this.moveTool){let h=new hi().addGroup(i);this.toggleMove(l,e,h),this.moveTool=mf.getNextTool().getNextTool()}}else A.windowBridge.rpcCall("tipsModalBackToPcb","flipComponent",Q()).then(async h=>{if(h.message.action=="yes"){i=c.getCommand();for(let u of l)u instanceof ke&&(i.addCommand(Ce.dispatch(u,"modify")),await this.updateComponentFootprint(u,t=="Flip Up and Down",n,i))}if(!this.moveTool){let u=new hi().addGroup(i);this.toggleMove(l,e,u),this.moveTool=mf.getNextTool().getNextTool()}})})}async updateComponentFootprint(t,e,r,i){t.flip(e,r),await new ff().updateCustomFootprint(t,i,t.getItems()),A.publish("autoFill","")}toggleMove(t,e,r){let i={command:"batchMoveItem",refer:new k2(t,e.x,e.y),menu:"MOVE_BY_REFERENCE_POINT",isContinuousMode:!1,commandFactory:r};A.publish("toggle",i)}clear(){this.moveTool=null,this._flipping=!1}getCenter(t){let e=new _e;for(let r of t)e.ext1(r.buildBBox());return e.build1().center()}getStatus(){return this._flipping}};var A=he,qe=new Xhe,kt=new I8(20,()=>new iR),Pe=new qhe,Ye=new rue,pr=new h5,Qt=new Khe,Wr=new Zhe,Kt=new Jhe,Xt=new Qhe,un=new Ofe,ri=new u5,os=new eue,Yo=new tue,ah=new lfe,jo=new sue,Ajl=new $he,Ht=new iue,Cu=new aue,Yc=new lue,pt=new cue,Ur=new K0e,jy=py.getInstance(),Pd=new vpe,HXe=new Q0e,aC=new oue,tXe=new Epe,bh=new Efe,Hi=Ji.getInstance(),Ar=new _D,Bje=new uue,gr=new Oue,Wo=new Aue,Hu=new vue,Bo=new Lue,Uu=new oV(!0),Ea=new sfe,$n=new ife,S5=new u$,xo=new nfe,ut=new Nue,jP=new Ope,Fc=new gfe,_jl=new rfe,vjl=new Pfe,xjl=new xpe,Bn=new v5,So=new yfe,Ti=new Ape,zn=new _pe,jt=new iU,Fl=new Rpe,le=new Hpe,DR=ka.getInstance(),OOe=Sfe.getInstance(),ts=Tu.getInstance(),tr=new c$,Xq=new J0e,KM=new Tfe,Rjl=new $0e,Djl=Sme.getInstance(),wjl=Ome.getInstance(),we=new efe,xje=new kue,Ljl=new Bue,Kb=new ffe;new G0e;var di=new ofe,Ua=new Mue,loe=new hue,ND="",lce=new nme,u3=new cfe,_s=new hfe,kB=new gme,Ut=new ufe,_d=new Cfe,Pi=new uoe,g1=new Rg,vu=new mfe,uu=new bfe,VM=new G8,I2=new Ife,pf=new Ame,pd=new Ede,PT={isChecked:!1,outlineInfoForQRCode:null,coverOil:!0};Hi.bindListener(new cme);ts.bindListener(new pme);Gqe(he,ze);var owt=new fme;Window.endPointDebug=owt;var yAe={typeface:wK,height:12,strokeWidth:.8};function o0e(o,t){typeof yAe[o]<"u"&&(yAe[o]=t)}var KS=o=>yAe[o];function Hb(){return w$e("linked-width-height")=="1"}function xG(o){ND=o}function eC(o,t=!0){!R.getInstance().isactive||23==R.getInstance().doctype||(vje(R.getInstance().unit,o),R.getInstance().unit=o,we.smartMode&&ah.getAllItem().forEach(r=>r.unit=o),A.publish("updateFrame",""),A.publish("flushSelectingInfo",""),oa&&setTimeout(()=>{A.publish("checkDimension",{on:!0})},10),R.getInstance().doctype===4&&(A.publish("flushAttrPlane",{isUpdateDeviceData:"",doNotReloadPrjTree:""}),A.publish("flushWizardOption",{unit:o},Q())),at.updateUnit(o),A.publish("updateNetLengthUnit",o,window.top),t&&!R.getInstance().isReadOnlyMode&&A.publish("setPcbTabUnSaved",[R.getInstance().tabId,!0],Q()),_me(),np())}function _me(){switch(bh.type){case"DIST_MEASURE":hu.getInstance().hasSettingResult&&(hu.getInstance().refreshMeasureResultBySelectedElements(),A.publish("FlushSketcherAttrView",{type:"DIST_MEASURE"}));break;case"SINGLE_WIRE":A.publish("FlushSketcherAttrView",{type:"SINGLE_WIRE"});break;case"DIFF_WIRE":A.publish("FlushSketcherAttrView",{type:"DIFF_WIRE"});break;case"MULTI_WIRE":A.publish("FlushSketcherAttrView",{type:"MULTI_WIRE"});break;case"COPY_SPECIAL":A.publish("FlushSketcherAttrView",{type:"COPY_SPECIAL"});break;case"PASTE":A.publish("FlushSketcherAttrView",{type:"PASTE"});break}}async function JI(o,t,e){let r=await ZI(o);A.windowBridge.publish("exportFileClientWay",{data:{fileData:r.data,fileTitle:t,extension:e}},Q())}A.messageBus.subscribe("pcb/exportFileClient",o=>{let{dataStr:t,title:e,extension:r}=o;t&&JI(new Blob([t],{endings:"native"}),e,r)});function aq(o,t,e=[]){let r=Hi.getItem(o.footprintUUID);if(r instanceof Sc){t.addCommand(Ce.dispatch(o,"delete"));let n=new d1("2.0").replace(o.model,"Footprint",r.source);A.publish("clearSelect",""),o.remove(),A.publish("delete",o);let s=new p1(n);s.build();let a=s.items[0];for(let h of o.model.getPads())if(!e.includes(h.globalIndex)){let u=a.getPads().find(d=>d.globalIndex==h.globalIndex);u&&(u.unusedInnerLayers=h.unusedInnerLayers)}let l=Ri.getInstance().getItem(2),c=Ri.getInstance().getItem(3);x5.updateDisplay(2,l.visible),x5.updateDisplay(3,c.visible),A.publish("hasModifyPcbItem",a),t.addCommand(Ce.dispatch(a,"add"))}}A.subscribe("TrackWidthSetting",o=>{if(R.getInstance().isactive){if(o==="WIRING_WIDTH_FOLLOWRULES"){let t=le.pcbConfig.startTrackWidth=="rule"?"last":"rule";le.pcbConfig.startTrackWidth=t,we.widthFollowRule=t=="rule"}else{let t=le.trackConfig;if(!t||!t.length)return;let e=o;for(let r in t)if(Math.abs(Number(t[r].mil)*10-Number(o))<.001){e=r;break}Ur.toggleWidth(e),wi()}A.publish("flushSelectingInfo",""),_me()}});A.subscribe("updateRtree",o=>{kt.init||(kt.flushWhenNeed(),kt.init=!0);let t="updateRTree-time";Cn(t);let e=o==null?void 0:o.refreshAll,r=new Set,i=!1;if(!e)for(let[u,d]of cY)for(let p of d)p&&p.item&&(p.item.isEmpty||r.add(p),kt.remove(p,u),i=!0);i&&kt.flushDeleteWhenNeed();for(let u of r)kt.insert(u);r.clear(),r=null,i&&kt.flushWhenNeed(),cY.clear();let n=e,s=new Set,a=new Set;if(!e){for(let u of lte)h(u),n=!0;lte.clear()}kt.itorTree(u=>{if(e){for(let d of u.items)n=!0,d.item.isEmpty?s.add(d):a.add(d);return}for(let d of u.changeList)n=!0,d.item.isEmpty?s.add(d):a.add(d);u.changeList.clear()});for(let u of s)kt.remove(u);s.clear(),s=null;for(let u of a)kt.remove(u);n&&kt.flushDeleteWhenNeed();for(let u of a)u.update(),kt.insert(u);a.clear(),a=null,n&&kt.flushWhenNeed(),Xi(t,.05);let l=20;uY(t).length>=l&&swt(l);function c(u,d){if(!u)return;let p=u;p&&(u.isEmpty?s.add(p):a.add(p))}function h(u){if(!u)return;let d=u.globalIndex;c(u,d);let p=u.getParent();p&&p instanceof He&&c(u,d)}});function swt(o){let t="updateRTree-time",e="rebuildRatline-time",r="updateDRC-time",i="updateConnectRelation-time";fIe({[t]:"\u66F4\u65B0RTree",[e]:"\u91CD\u5EFA\u98DE\u7EBF",[r]:"\u66F4\u65B0DRC",[i]:"\u66F4\u65B0\u8FDE\u63A5\u5173\u7CFB"},`autoFlushService-Time(${o})`)}A.subscribe("undo",()=>{if(!(!R.getInstance().isactive||23==R.getInstance().doctype||!di.currentCanUndoTool))if(L1.getInstance().hasActiveToolHistory()&&L1.getInstance().canUndo())L1.getInstance().undo();else{let o=l5.getInstance();o.stash(),A.publish("clearDimension",""),qe.undo(),o.pop()}});A.subscribe("redo",()=>{if(!(!R.getInstance().isactive||23==R.getInstance().doctype||!di.currentCanUndoTool))if(L1.getInstance().hasActiveToolHistory()&&L1.getInstance().canRedo())L1.getInstance().redo();else{let o=l5.getInstance();o.stash(),A.publish("clearDimension",""),qe.redo(),o.pop()}});A.subscribe("UnitConver",eC.bind(void 0));A.messageBus.rpcService("FileSource",async o=>{var r;o&&o.useCompilerSave&&await((r=R.getInstance().compiler)==null?void 0:r.save());let t=R.getInstance();return new Qd("2.0",t.doctype).save()});A.messageBus.rpcService("pcb/saveCompiler",async o=>{var i;let t=Ji.getInstance().getAllItem();for(let n of t)if(n instanceof Sc){let s=await n.getInstance().save();s.success||console.log(s.message)}let e=await((i=R.getInstance().compiler)==null?void 0:i.save()),r=await XI.getInstance().saveCopper();return!r.success&&e.success&&(e=r),e});A.messageBus.rpcService("pcb/closePcbPage",async()=>{var o;ze.closePcbPage(),On.getInstance().allowPull=!1,await((o=R.getInstance().compiler)==null?void 0:o.destroy()),await Ji.getInstance().clear(),await Tu.getInstance().clear(),R.getInstance().compilerChannel.dispose(),XI.getInstance().closeDynamicCopper(),bh.clearSketcherAttrView()});A.messageBus.rpcService("FileSourceForSelected",o=>{let t=ze.getSelects(),e=R.getInstance().origin,r=ys(t);if(r.valid()){let n=r.build();R.getInstance().origin=new S(n.minX,n.minY)}let i=new Qd("2.0",3).saveSelected(o);return R.getInstance().origin=e,i});A.messageBus.rpcService("footprintIsExist",({uuid:o,source:t})=>{t=t.split(D$e)[0]||"";let e=Ji.getInstance().getItem(o),r=Ji.getInstance().getItem(t);return e instanceof Sc&&e.components.size>0&&e.uuid==o?!0:r instanceof pI&&r.components.size>0&&r.uuid==t});A.messageBus.rpcService("addCustomFootprint",o=>Zoe(o));A.messageBus.rpcService("FileSourceForPanelizePreview",()=>{let o=R.getInstance();return new Qd("2.0",o.doctype).onlyOutline()});A.messageBus.rpcService("getCanvasParam",()=>new Promise((o,t)=>{let e=new dt,r={visible:It.getInstance().visible,color:le.themeConfig.canvasTheme.gridColor,snapX:e.conversion1("mil",R.getInstance().unit,It.getInstance().getSnapX())*10+R.getInstance().unit,snapY:e.conversion1("mil",R.getInstance().unit,It.getInstance().getSnapY())*10+R.getInstance().unit,style:It.getInstance().pattern?"line":"dot",origin:R.getInstance().origin,unit:R.getInstance().unit};o({...r,adsorb:we.adsorb,realTimeDRC:Uu.switch,grayState:we.grayState})}));A.messageBus.rpcService("pcb/getAllTestPoints",()=>{let o=Qt.getAllTestPad(),t=new dt;return{items:o.map(r=>{let{net:i,num:n,layerId:s,center:a}=r,l=r.getParent();l&&(n=`${l.designator}${n?"-"+n:""}`);let c=0;s==12&&(c=t.conversion1("mil",R.getInstance().unit,r.hole.holeRadius*20));let h=R.getInstance().origin,u=t.conversion1("mil",R.getInstance().unit,(a.x-h.x)*10),d=t.conversion1("mil",R.getInstance().unit,(a.y-h.y)*10),p=Pe.getLayer(s).name;return{x:u,y:d,layerName:p,num:n,net:i,holeSize:c}}),UNIT:R.getInstance().unit,nets:Ye.getAllNets()}});A.messageBus.rpcService("getAllComponentWithSelectionState",o=>{let e=ze.getSelects().filter(r=>r instanceof ke).map(r=>r.globalIndex);return Ar.getAllItem().map(r=>({attributes:r.attrKeyValue,deviceUUID:r.deviceUUID,footprintUUID:r.footprintUUID,isSelected:e.includes(r.globalIndex),ID:r.globalIndex}))});A.messageBus.rpcService("getDeviceComponent",o=>ts.getItem(o).getComponents().map(e=>e.globalIndex));A.messageBus.rpcService("getSelectFtUuids",()=>new Promise((o,t)=>{let e=ze.getSelects(),r=new Array;e.forEach(i=>{i instanceof ke&&r.push(i.footprintUUID)}),o({uuids:r})}));A.messageBus.rpcService("pcb/getRouterNets",o=>new Promise((t,e)=>{let r=Ye.getAllNets();t({nets:r})}));A.messageBus.rpcService("restoreHistoryNode",o=>new Promise(async(t,e)=>{function r(){if(o.pcbs&&o.pcbs[R.getInstance().id]){let n=o.pcbs[R.getInstance().id].canvas;new F3(R.getInstance().compiler).parseFull(n)}t(!0)}function i(){va.rebuildingRatlineInWorker?setTimeout(()=>{i()},50):r()}va.rebuildingRatlineInWorker?i():r()}));A.subscribe("restoreCanvasDefault",()=>{R.getInstance().compilerChannel.pull(),Pe.getLayer(1).layerStatus==0&&(Pe.checkDefault(),re.getInstance().correctDefault(),wm.getInstance().updateLayerInfo())},Q());A.messageBus.rpcService("/pcb/bomMerge/source",eqe);A.messageBus.rpcService("unitConversion",o=>new dt().conversion(o.unit,R.getInstance().unit,o.value));function pde(o){return o instanceof lr?YV(o):o instanceof He&&(o.type!="Line"||o.layerId==11)?o.getMathGraphics().bbox():o.buildBBox()}function Yje(o){return o instanceof ke||o instanceof lr?o.position:o instanceof Dp?o.start:o.buildBBox().center()}A.messageBus.rpcService("toggleSmartSizeMode",o=>new Promise((t,e)=>{o!==""&&we.smartMode==o&&t(o),A.publish("clearDimension",""),we.smartMode=!we.smartMode,we.smartMode?(Qt.allAddSmartPad(),A.publish("updateRtree","")):(ah.clearAll(),Qt.removeAllSmartPad(),A.publish("flushService",""),A.publish("tool","draw(origin)"),A.publish("tool","dropdrag"),A.publish("flushSelectingInfo","")),A.publish("updateFrame",""),t(we.smartMode)}));A.messageBus.subscribe("exitEditPadShapeMode",o=>{let t=mf.getNextTool().getNextTool();(t instanceof T5||t instanceof LG)&&t.completed()});A.subscribe("clearAllPcbHistory",(o=!1)=>{R.getInstance().doctype===3&&qe.clear(),o&&R.getInstance().doctype===4&&R.getInstance().projectId!=null&&qe.clear()},Q());A.messageBus.rpcService("PhysicalStackingConfig",()=>new Promise((o,t)=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return o([]);let e=new dt,r=Pe.getLayerPhys().map(i=>({"Layer Id":i.layerId,Layer:i.layerName,Type:null,Material:i.material,Thickness:i.thickness!=null?ve(e.mil2mm(i.thickness*10),3):null,Permittivity:i.permittivity,"Loss Tangent":i.lossTangent,"Layer Type":i.layerType,zIndex:i.zIndex}));o(r)}));A.subscribe("pcb/exportFile/cancel",o=>{!R.getInstance().isactive||23==R.getInstance().doctype||v$e(o)});A.subscribe("pcb/exportFile",o=>{!R.getInstance().isactive||23==R.getInstance().doctype||x$e(o)});A.messageBus.rpcService("pcb/getExportFileData",async o=>!R.getInstance().isactive||23==R.getInstance().doctype?void 0:await R$e(o));A.subscribe("progressUpdate",o=>{console.debug(o),A.publish("pcbUpdateProgress",o,Q())});A.subscribe("syncFromContentModel",o=>{let t=JSON.parse(o),e=new r6().decode(t);Bo.syncFromContentModel(e)});A.messageBus.rpcService("i18n",async o=>(await A.windowBridge.rpcCall("i18n",o,top)).message);window.onunload=()=>{jhe(),R.getInstance().compilerChannel.dispose(),A.publish("editPageClose",{uuid:R.getInstance().tabId,doctype:R.getInstance().doctype},Q())};A.messageBus.rpcService("getMousePosition",o=>{if(o)return _o(new S(o.x,o.y))});var oa=null;A.messageBus.subscribe("checkDimension",o=>{let t=new gU,e=o.on||!oa;if(oa&&(oa.interrupt(),oa=null),e){let r=o.unit?o.unit:R.getInstance().unit;t.setAllDimension(r),oa=t}A.publish("updateFrame","")});A.messageBus.rpcService("checkDimensionForUi",async()=>{oa&&(oa.interrupt(),oa=null);let o=new gU(!0),t="mil",e=o.setAllDimension(t);oa=o;let r=Kc(),i=new _e;r.forEach(s=>{i.ext1(s.buildBBox())});let n=o.buildBox();if(i.ext1(n),i.valid()){let s=i.build1();A.publish("adaptBBox",s)}return A.publish("updateFrame",""),e});A.messageBus.rpcService("toggleDimension",o=>{let t=new gU(!0);if(oa){oa.interrupt(),oa=null;let e=t.setAllDimension(o.unit);return oa=t,A.publish("updateFrame",""),e}else return[]});A.messageBus.subscribe("highlightDimension",o=>{oa&&(oa.highlightDimension(o.title),A.publish("updateFrame",""))});A.messageBus.subscribe("highlightPad",o=>{let t=Qt.getAllItem(),e=[];for(let r=0;r<t.length;r++)t[r].visible(),o.indexOf(t[r].globalIndex)>=0&&e.push(t[r]);for(let r=0;r<e.length;r++)e[r].click();A.publish("updateFrame","")});A.messageBus.subscribe("clearDimension",o=>{oa&&(oa.interrupt(),oa=null,o&&A.publish("adaptAll",""),A.publish("updateFrame",""))});A.messageBus.rpcService("getAttrList",o=>{let t;o==="allItems"?t=Ar.getAllItem():o==="selectedItems"&&(t=ze.getComponents());let e=new nU(t),{allItemsAttrList:r,selectedItemsAttrList:i}=e.open();return r});A.subscribe("applyInputAtCursorValue",o=>{if(!R.getInstance().isactive||23==R.getInstance().doctype)return;Ea.applyInputAtCursorValue.bind(Ea.currTool)(o)});A.subscribe("restoreInputAtCursorValue",()=>{!R.getInstance().isactive||23==R.getInstance().doctype||(at.editingWhat="")});A.subscribe("valueInputEnd",o=>{Ea.valueInputEnd.bind(Ea.currTool)(o)});A.messageBus.rpcService("setTableParameter",o=>{let t=+o.strokeWidth/10;R.getInstance().unit!=="mil"&&(t=new dt().conversion(R.getInstance().unit,"mil",t)),ut.defaultTable.lineWidth=t,ut.defaultTable.fontSize=+o.fontSize});A.subscribe("updateGridRange",o=>{let{startAngle:t,endAngle:e,minRadius:r,maxRadius:i}=o;we.updateGridRange(Xh(t),Xh(e),L3(r),L3(i))},Q());A.messageBus.rpcService("getGridRange",()=>new Promise((o,t)=>{o({startAngle:pb(we.startAngle),endAngle:pb(we.endAngle),minRadius:eF(we.minRadius),maxRadius:eF(we.maxRadius),unit:R.getInstance().unit})}));A.subscribe("refreshFootprintAttrPanel",o=>{R.getInstance().doctype==4&&A.publish("flushAttrPlane","")},Q());A.subscribe("footprintIsConnectDevice",o=>{we.footprintIsConnectDevice=o},Q());A.messageBus.rpcService("getFootprintAttr",o=>new V3().getHtmlData());A.messageBus.rpcService("getTabIdAndDocType",()=>({tabId:R.getInstance().tabId,docType:R.getInstance().doctype}));A.messageBus.rpcService("fetchPCBCanvasProfile",o=>({topBoardColor:we.topBoardColor,topSilkscreenColor:we.topSilkscreenColor,bottomBoardColor:we.bottomBoardColor,bottomSilkscreenColor:we.bottomSilkscreenColor}));A.messageBus.rpcService("destoryTriangleDistmeasureTool",()=>(tn.destroy(),A.publish("tool","dropdrag"),!0));A.messageBus.rpcService("isRuningTriangleDistmeasureTool",()=>tn.isRuning);A.messageBus.rpcService("destoryCopySpecialTool",()=>(A.publish("tool","dropdrag"),A5.getInstance().isRunning=!1,!0));A.messageBus.rpcService("isRuningCopySpecialTool",()=>A5.getInstance().isRunning);A.subscribe("updateHistoryMode",o=>{R.getInstance().doctype===3&&(R.getInstance().isHistoryMode=o)},Q());A.subscribe("checkIfSelectAlignRefObject",o=>{we.needSelectAlignRefObject=o});A.subscribe("checkIfSelectAlignRefObjectForCenters",o=>{we.needSelectAlignRefObjectForCenters=o});A.subscribe("isCheckedCrossProbeMode",o=>{we.isCheckedCrossProbeMode=o},Q());A.messageBus.rpcService("pcb/getComponentInfoById",o=>o.map(e=>{let r={id:e},i=Ar.getItem(e);if(i){r.designator=i.designator||e;let n=i.attrKeyValue;r.footprint=n.Footprint,r.footprintUuid=i.footprintUUID,r.name=i.getFormulaName()||n.Value||n.Device,r.d3Model=n["3D Model Title"]}return r}));A.messageBus.rpcService("pcb/editCustomFootprint",o=>{A.publish("PcbEditFootprint1",o)});function bFe(o){if(!o)return;let t=Sr.getInstance().encode("PARTITION",o.model);R.getInstance().compiler.uploadPartition(o.globalIndex,{name:t.name,fileUuid:"",path:t.path});let e=new Qd("2.0",3,R.getInstance().compiler),r=o.buildBBox(),i=kt.search(r).getAllItems(),n=[],s=[];i.forEach(a=>{if(a.partition==o.globalIndex){if(a.partition=null,a.refreshRender(),a instanceof Jr){n.push(a.model);return}else if(a instanceof Gi){s.push(a.model);return}a.model instanceof Bi?e.feedComponent(a.model):(a.model instanceof et||a.model instanceof Ct)&&a.model.getParent()!=null?R.getInstance().compiler.uploadPadNet(Sr.getInstance().encode("PAD_NET",a.model)):e.feedItem(a.model)}}),e.feedCopper(n),e.feedInner(s)}A.messageBus.rpcService("getPcbScene",()=>di.getScene());A.messageBus.rpcService("pcb/getMouseRecorder",()=>{let o=mf.getInputInfo(),t=mf.getRatio();return{clientX:o.mouseX/t,clientY:o.mouseY/t}});A.globalMessageBus.rpcService("GetPanelizePreviewFile2",Uqe);A.globalMessageBus.rpcService("getPanelizeSetJson2",()=>{if(Pi.offset==null){let o=si.getInstance().setJsonParamCache;new L0().applyPanelize(o)}return Pi.getDataForDFM()});A.messageBus.rpcService("pcb/editor/getDxfLayerType2NameMap",()=>{let o=Pe.getAllLayer(),t={};for(let e of o)if(!ar(e.layerID)&&!ic(e.layerID)&&e.config&&![47,52].includes(e.layerID)&&!ra(e.layerID)&&57!=e.layerID&&!LO(e.layerID)){let r=e.type;r=="CUSTOM"&&e.layerID!=71?r=r+","+(e.layerID-71+1):(r=="SIGNAL"||r=="PLANE")&&e.layerID!=15&&(r=r+","+(e.layerID-15+1)),t[r]=e.name}return t});A.messageBus.rpcService("pcb/editor/getLayerInfoMap",o=>{let{onlyPolyLayer:t}=o||{},e=Pe.getAllLayer(),r={};for(let i of e){if(!i.config||t&&!(!ar(i.layerID)&&!ic(i.layerID)&&![47,52].includes(i.layerID)&&!ra(i.layerID)&&57!=i.layerID&&!LO(i.layerID)))continue;let n=i.layerID,s={layerId:n,isPlane:i.isPlaneLayer(),layerName:i.name,layerColor:i.color.toString(),isVisible:i.visible};r[n]=s}return r});A.messageBus.rpcService("pro-pcb/editor/batchUpdateShapeState",o=>{let{shapeIds:t,layerId:e,strokeWidth:r,scale:i,isVisible:n,isRemove:s}=o||{};if(!t||t.length==0)return!1;let a=Kc(),l=new Array(t.length),c=0,h=new Set(t);if(a.forEach(d=>{h.has(d.globalIndex)&&(l[c++]=d)}),l.length==0)return!1;let u=!1;if(!s&&e>0&&Pe.getLayer(e)&&(l.forEach(p=>{p.layerId=e}),u=!0),!s&&r>0&&l.forEach(d=>{d instanceof _t||d instanceof mt?(d.width=r,u=!0):d instanceof He||d instanceof lr?(d.strokeWidth=r,u=!0):d instanceof Pr&&(d.strokeWidth=r)}),!s&&i>0&&i!=1){let d=Ae.scale(i);l.forEach(p=>{p.transform(d),p instanceof lt?p.model.childrens.forEach(m=>{m.forEach(g=>{g instanceof zc&&(g.radius*=i)})}):p instanceof lr?p.fontSize*=i:p instanceof Pr&&(p.radius*=i)}),u=!0}return Mke(n)||(l.forEach(d=>{n?d.visible():d.hidden()}),u=!0),s&&(l.forEach(d=>{d.remove()}),u=!0),u&&(A.publish("updateModify",""),A.publish("adaptAll",""),A.publish("autoFill","")),u});A.messageBus.rpcService("pcb/createDownloadStream",async o=>{let t=new rk(o);return await t.create(),t.uuid});A.messageBus.rpcService("pcb/writeDownloadStream",async({id:o,data:t})=>{var e;await((e=rk.getOpenedStream(o))==null?void 0:e.write(t))});A.messageBus.rpcService("pcb/closeDownloadStream",async o=>{var t;await((t=rk.getOpenedStream(o))==null?void 0:t.close())});A.messageBus.rpcService("pcb/getBgColor",()=>R.getInstance().getBgColor().toString());A.messageBus.rpcService("pcb/getExportObjects",()=>Object.entries(Hqe).reduce((o,[t,e])=>(e!=null?Ri.getInstance().getItem(e).visible&&o.push(t):o.push(t),o),[]));A.messageBus.rpcService("pcb/performanceData",()=>new ame().getResult());A.messageBus.rpcService("pcb/getDefaultPngSize",(o=!0)=>{let e=2160,r=o?of():Eje(),i=r.width()/r.height(),n=e/i;return(e>4096||n>4096)&&(e>n?(n=4096/i,e=4096):(e=4096*i,n=4096)),{width:e,height:n}});A.messageBus.rpcService("pcb/setCheckingQRCode",async o=>{var d,p;console.log("pcb/setCheckingQRCode");let{enableDetection:t,coverOil:e}=o;if(PT.isChecked=t,PT.coverOil=e,!t||PT.outlineInfoForQRCode)return;let r;for(let m of Pe.getAllLayer())if(m.type==="ANALYSIS_OUT_LINE"){r=m.layerID;break}let i=[],n;if(r!=null){n=new Set;let m=(p=(d=kt.map.get("Polygon"))==null?void 0:d.get(r))==null?void 0:p.items;if(m==null)n=new Set;else for(let g of m){let y=g.item;y instanceof lt&&n.add(y)}}else n=new Set;if(Array.from(n).filter(m=>!m.getParent()).sort((m,g)=>parseInt(m.globalIndex.slice(1))-parseInt(g.globalIndex.slice(1))).forEach(m=>{if(!(m instanceof lt)){console.error("!(item instanceof PcbPolygon)");return}xe.addAll(i,m.primitives)}),i.length!==0){PT.outlineInfoForQRCode=ge.build2(i);return}let s=null,a=[Cl.UNION],l=new _e;kt.search(kt.bbox(),m=>m===11).getProfiles().forEach(m=>{l.ext1(m.buildBBox());let g=m.getMathGraphics();if(g instanceof ge)a.push(new Zo([g.area(.1)>0?g.reverse():g]));else{let y=g.items.sort((P,T)=>T.bbox().area()-P.bbox().area()),b=[y[0].area(.1)>0?y[0].reverse():y[0]];y.slice(1).forEach(P=>{b.push(P.area(.1)>0?P:P.reverse())}),a.push(new Zo(b))}});let c=l.build1(),h=hP([Cl.DIFF,ge.build6(c.extendOfSize(Math.max(c.width(),c.height()))),a]);if(s){let m=s?Qe.scale(10,10):null;h.items.forEach(g=>{g.items.forEach((y,b)=>{s.initColor(b===0?ee.RED:ee.Golden).addPly(y.multiply3(m))})}),s.draw()}let u;if(h.items.length>=2){let m=h.items.slice();Er(m,(y,b)=>b.bbox().area()-y.bbox().area(),0,m.length);let g=m.slice(1);if(g.length===1){let y=g[0];y.items.length===1&&(u=y.items[0])}}u||(u=ge.build6(await(await A.messageBus.rpcCall("getAllBoardBox")).message)),PT.outlineInfoForQRCode=u});sme.getInstance();A.subscribe("modifyRulerTheme",o=>{let t="#FFFFFF",e="#858585",{rulerBgColor:r,rulerStringColor:i}=o;try{Ns.getInstance().rulerBackgroundColor=PTe(r),Ns.getInstance().rulerStringColor=PTe(i)}catch(n){console.error("RulerBackgroundColor Error:",n),Ns.getInstance().rulerBackgroundColor=ee.of3(t),Ns.getInstance().rulerStringColor=ee.of3(e)}},Q());var $S=new dt,W$e="-",awt=10,z$e=20,lwt=30,bAe=$S.mm2mil(1)/10,cwt=$S.mm2mil(3)/10,H5=class extends Do{constructor(){super(...arguments);this._mainContent=-1;this._isSetHighlight=!1;this._isDestroyed=!0}get globalIndex(){var e;return(e=this._viewDataModel)==null?void 0:e.globalIndex}get name(){var e;return(e=this._viewDataModel)==null?void 0:e.name}get position(){var e;return(e=this._viewDataModel)==null?void 0:e.position}get errType(){var e;return(e=this._viewDataModel)==null?void 0:e.errType}get color(){var e;return(e=this._viewDataModel)==null?void 0:e.color}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get locked(){var e;return(e=this._viewDataModel)==null?void 0:e.locked}get contentModel(){var e;return(e=this._viewDataModel)==null?void 0:e.contentModel}get matrix(){var e;return(e=this._viewDataModel)==null?void 0:e.matrix}get bbox2(){var e;return(e=this._viewDataModel)==null?void 0:e.bbox2}get layer(){return cn.getInstance().getLayer(this.layerId).layer}get plane(){return this.layer.plane}shapeVisible(){if(this._isDestroyed){let e=le.pcbConfig.drcErrorStyle,r=le.pcbConfig.drcErrorZoom;e==="1"?om.scene.setDrcRenderStyle(oJ.CROSS):e==="2"&&om.scene.setDrcRenderStyle(oJ.TRIANGLE);let i=e==="2"?this.getCombineFontDescribes():{leftText:"",rightText:""},n=r==="keepConstantSize"?Hp.FIXED:Hp.ZOOM;om.scene.setDrcRenderModel(n);let[s,a,l,c]=r==="keepConstantSize"?[awt,lwt,z$e,z$e]:[bAe,cwt,bAe,bAe];this._mainContent=this.plane.createOrUpdateDrc(-1,this.position,0,s,a,l,c,i.leftText,i.rightText,this.color,void 0,this.engineGroupId)}}mainVisible(){this.shapeVisible()}maskVisible(e=!1){let r=Ai().getScale();if(e===!0){le.pcbConfig.drcErrorStyle==="1"&&(le.pcbConfig.drcErrorZoom==="keepConstantSize"?typeof this._mainContent<"u"&&this._mainContent!==-1&&(this.plane.setHighLightPtNum(this._mainContent,1,1),this._isSetHighlight=!0):le.pcbConfig.drcErrorZoom==="followObjectScaling"&&typeof this._mainContent<"u"&&this._mainContent!==-1&&(this.plane.setHighLightPtNum(this._mainContent,1,1),this._isSetHighlight=!0)),le.pcbConfig.drcErrorStyle==="2"&&(le.pcbConfig.drcErrorZoom==="keepConstantSize"?typeof this._mainContent<"u"&&this._mainContent!==-1&&(this.plane.setHighLightPtNum(this._mainContent,1,1),this._isSetHighlight=!0):le.pcbConfig.drcErrorZoom==="followObjectScaling"&&typeof this._mainContent<"u"&&this._mainContent!==-1&&(this.plane.setHighLightPtNum(this._mainContent,1,1),this._isSetHighlight=!0));return}if(e===!1){this.maskRemove();return}}visible(){this.maskVisible(!1),this.mainVisible(),this._isDestroyed=!1}highlight(){this.mainVisible(),this.maskVisible(!0),this._isDestroyed=!1}mainRemove(){typeof this._mainContent<"u"&&this._mainContent!==-1&&this.plane.removePt(this._mainContent)}maskRemove(){typeof this._mainContent<"u"&&this._mainContent!==-1&&this._isSetHighlight&&(this.plane.removeHighLightPt(this._mainContent),this._isSetHighlight=!1)}modify(e,r){switch(super.modify(e,r),r){case"Only Main":{this.visible();break}case"Main And Highlight":{this.highlight();break}default:break}}remove(){this.maskRemove(),this.mainRemove(),this._isDestroyed=!0,this._mainContent=-1}getCombineFontDescribes(){let e={leftText:"",rightText:""};if(this.contentModel instanceof O0||this.contentModel instanceof vb)return e.leftText=this.getPrimitiveFontDescribe(this.contentModel.obj1Type),e.rightText=this.getPrimitiveFontDescribe(this.contentModel.obj2Type),e;e.leftText=this.getPrimitiveFontDescribe(this.contentModel.obj1Type||this.contentModel.objType||this.contentModel.obj2Type);let r=this.contentModel.errorType;return this.contentModel instanceof Cy?(e.leftText="L",e.rightText="W"):this.contentModel instanceof Iy||this.contentModel instanceof Sy||r==="Net Length Range"||this.contentModel instanceof KP||r==="Net Length Tolerance"?(e.leftText="L",e.rightText="N"):this.contentModel instanceof Ty?e.rightText="N":this.contentModel instanceof _b||this.contentModel instanceof Ey?(e.leftText="V",e.rightText="D"):this.contentModel instanceof Py?e.rightText="I":this.contentModel instanceof Oy?(e.leftText="L",e.rightText="W"):this.contentModel instanceof b3?(e.leftText="O",e.rightText="O"):e.rightText=W$e,e}getPrimitiveFontDescribe(e){let i={Line:"L",Track:"L",Device:"C","TH Test Point":"P","SMD Test Point":"P","Test Point":"P","TH Pad":"P","SMD Pad":"P",Via:"V",Text:"S","Fill Region":"S","Copper Region":"S","Copper Region(Filled)":"S","Bridging Copper":"S",TearDrop:"S","Plane Zone":"S",Image:"S",Picture:"S",Hole:"H","Slot Region":"H","Prohibited Region":"K","Board Outline":"O"}[e];return i||(console.warn(`Unmatched DRC ObjType: ${e}`),e||W$e)}getBBoxs(){return[this.plane.getPtBboxById(this._mainContent)]}};var QD=class extends jh{constructor(t,e=null){super(t,e)}getId(){return this.id}visible(t,e,r,i,n,s,a,l=null,c,h){if(this.layerId!==t&&this.isValidId()){let u=this.plane;this.forceVisibleHighLight(!1),u.removePt(this.id),this.resetId()}this.layerId=t,!Ra.unRefreshScene&&(this.id=this.plane.createOrUpdateScaleString(this.id,e,r,i,n,s,a,void 0,l!=null?l:void 0,c,h))}getBBox(){return this.plane.getPtBboxById(this.id)}};var C$=class extends jh{constructor(t,e=null){super(t,e)}getId(){return this.id}visible(t,e,r,i,n){this.layerId!==t&&this.isValidId()&&(this.plane.removePt(this.id),this.resetId()),this.layerId=t,!Ra.unRefreshScene&&(this.id=this.plane.createOrUpdateDrcArrow(this.id,e,r,i,n))}getBBox(){return this.plane.getPtBboxById(this.id)}};var W5=class extends Do{constructor(){super(...arguments);this._isSetHighlight=!1;this._startArrowId=-1;this._endArrowId=-1;this._textId=-1;this.startArrow=null;this.endArrow=null;this.zoomText=null;this.fixText=null;this.direction=new S(0,0);this.lineAngle=0;this.perpDirection=new S(0,0)}get renderModel(){return le.pcbConfig.drcErrorZoom==="keepConstantSize"?Hp.FIXED:Hp.ZOOM}get plane(){return this.layerId?cn.getInstance().getLayer(this.layerId).layer.plane:null}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get startPoint(){var e;return(e=this._viewDataModel)==null?void 0:e.start}get endPoint(){var e;return(e=this._viewDataModel)==null?void 0:e.end}get manualHighLight(){var e;return(e=this._viewDataModel)==null?void 0:e.manualHighLight}get viewGroupId(){var e;return this.getEngineGroupId((e=this._viewDataModel)==null?void 0:e.viewGroupId)}get str(){var e;return((e=this._viewDataModel)==null?void 0:e.text)||""}get textAngle(){let e=(this.lineAngle+2*zh)%(2*zh);return e>=zh/2&&e<=3*zh/2?this.lineAngle+zh:this.lineAngle}get textWidth(){var e;return((e=this._viewDataModel)==null?void 0:e.textWidth)||0}get textHeight(){return this.renderModel===Hp.FIXED?6:$S.mm2mil(.5)/10}get highlightColor(){var e;return(e=this._viewDataModel)==null?void 0:e.highlightColor}calculateLineGeometry(){!this.startPoint||!this.endPoint||(this.direction=new S(this.endPoint.x-this.startPoint.x,this.endPoint.y-this.startPoint.y),this.lineAngle=Math.atan2(this.direction.y,this.direction.x),this.perpDirection=new S(-this.direction.y,this.direction.x).normalize())}get textPosition(){return!this.startPoint||!this.endPoint?new S(0,0):this.startPoint.add(this.endPoint).mul(.5).add(this.perpDirection.mul(5))}updateArrows(){var e,r;!this.startPoint||!this.endPoint||!this.plane||(this.calculateLineGeometry(),this.startArrow||(this.startArrow=new C$(this.layerId)),this.startArrow.visible(this.layerId,this.startPoint,this.lineAngle,void 0,this.viewGroupId),this._startArrowId=(e=this.startArrow.getId())!=null?e:-1,this.endArrow||(this.endArrow=new C$(this.layerId)),this.endArrow.visible(this.layerId,this.endPoint,this.lineAngle+zh,void 0,this.viewGroupId),this._endArrowId=(r=this.endArrow.getId())!=null?r:-1)}updateText(){this.str&&(this.renderModel===Hp.ZOOM?this.updateZoomText():this.updateFixedText())}updateZoomText(){var e;this.zoomText||(this.zoomText=new QD(this.layerId)),this.zoomText.visible(this.layerId,this.str,this.textPosition,this.textAngle,this.textWidth,this.textHeight,void 0,this.viewGroupId),this._textId=(e=this.zoomText.getId())!=null?e:-1}updateFixedText(){var e;this.fixText||(this.fixText=new vl(this.layerId)),this.fixText.visible(this.layerId,this.str,this.textPosition,this.textAngle,Pc,Tc,this.textWidth,this.textHeight,void 0,this.viewGroupId),this._textId=(e=this.fixText.getId())!=null?e:-1}setHighlightVisible(e){this.plane&&(e&&!this._isSetHighlight?(this._startArrowId!==-1&&this.plane.setHighLightPtNum(this._startArrowId,1,1),this._endArrowId!==-1&&this.plane.setHighLightPtNum(this._endArrowId,1,1),this._textId!==-1&&this.plane.setHighLightPtNum(this._textId,1,1),this._isSetHighlight=!0):!e&&this._isSetHighlight&&(this._startArrowId!==-1&&this.plane.removeHighLightPt(this._startArrowId),this._endArrowId!==-1&&this.plane.removeHighLightPt(this._endArrowId),this._textId!==-1&&this.plane.removeHighLightPt(this._textId),this._isSetHighlight=!1))}visible(){this.calculateLineGeometry(),this.updateArrows(),this.updateText(),this.setHighlightVisible(!1)}highlight(){this.visible(),this.setHighlightVisible(!0)}modify(e,r){super.modify(e,r),this._viewDataModel=e,this.calculateLineGeometry(),r==="Only Main"?this.visible():r==="Main And Highlight"&&this.highlight()}remove(){var e,r,i,n;this.setHighlightVisible(!1),(e=this.startArrow)==null||e.remove(),(r=this.endArrow)==null||r.remove(),(i=this.zoomText)==null||i.remove(),(n=this.fixText)==null||n.remove(),this.startArrow=null,this.endArrow=null,this.zoomText=null,this.fixText=null,this._isSetHighlight=!1,this._startArrowId=-1,this._endArrowId=-1,this._textId=-1}getBBoxs(){let e=[];if(this.startArrow){let i=this.startArrow.getBBox();i&&e.push(i)}if(this.endArrow){let i=this.endArrow.getBBox();i&&e.push(i)}let r=null;return this.renderModel===Hp.ZOOM&&this.zoomText?r=this.zoomText.getBBox():this.fixText&&(r=this.fixText.getBBox()),r&&e.push(r),e}};var z5=class extends Do{constructor(){super(...arguments);this.circle=null;this.zoomText=null;this.fixText=null;this.circleMask=null;this.renderModel=le.pcbConfig.drcErrorZoom==="keepConstantSize"?Hp.FIXED:Hp.ZOOM;this._circleId=-1;this._textId=-1;this._circleMaskId=-1;this._isSetHighlight=!1}get plane(){return this.layerId?cn.getInstance().getLayer(this.layerId).layer.plane:null}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get layerModified(){var e;return(e=this._viewDataModel)==null?void 0:e.layerModified}get viewGroupId(){var e;return this.getEngineGroupId((e=this._viewDataModel)==null?void 0:e.viewGroupId)}get center(){var e;return(e=this._viewDataModel)==null?void 0:e.center}get radius(){var e;return(e=this._viewDataModel)==null?void 0:e.radius}get color(){var e;return(e=this._viewDataModel)==null?void 0:e.color}get str(){var e;return(e=this._viewDataModel)==null?void 0:e.str}get textPosition(){var e;return(e=this._viewDataModel)==null?void 0:e.textPosition}get angle(){var e,r;return(r=(e=this._viewDataModel)==null?void 0:e.angle)!=null?r:0}get textWidth(){var e;return(e=this._viewDataModel)==null?void 0:e.textWidth}get textHeight(){var e;return(e=this._viewDataModel)==null?void 0:e.textHeight}get textColor(){var e;return(e=this._viewDataModel)==null?void 0:e.textColor}get highlightColor(){var e;return(e=this._viewDataModel)==null?void 0:e.highlightColor}get highLightType(){var e;return(e=this._viewDataModel)==null?void 0:e.highLightType}get forceUpdateMask(){var e;return((e=this._viewDataModel)==null?void 0:e.forceUpdateMask)||!1}updateCircle(){var r,i;(!this.circle||this.layerModified)&&((r=this.circle)==null||r.remove(),this.circle=new Ka(this.layerId)),this.circle.visible(this.layerId,this.center,this.radius,$S.mm2mil(.1)/10,0,kr,ae.CCW,this.color,this.engineGroupId),this.circle&&(this._circleId=(i=this.circle.getId())!=null?i:-1)}updateCircleMask(e=!1){var i,n;(e||this.forceUpdateMask||!this.circleMask||this.layerModified)&&((i=this.circleMask)==null||i.remove(),this.circleMask=new Ka(1002),this.circleMask.visible(1002,this.center,this.radius,$S.mm2mil(.1)/10,0,kr,ae.CCW,this.highlightColor,this.engineGroupId),this.circleMask&&(this._circleMaskId=(n=this.circleMask.getId())!=null?n:-1))}updateString(){om.scene.setDrcRenderModel(this.renderModel),this.renderModel==Hp.ZOOM?this.updateScaleString():this.renderModel==Hp.FIXED&&this.updateFixedString()}updateScaleString(){var r,i;(!this.zoomText||this.layerModified)&&((r=this.zoomText)==null||r.remove(),this.zoomText=new QD(this.layerId)),this.zoomText.visible(this.layerId,this.str,this.textPosition,this.angle,this.textWidth,this.textHeight,this.textColor,this.engineGroupId),this.zoomText&&(this._textId=(i=this.zoomText.getId())!=null?i:-1)}updateFixedString(){var r,i;(!this.fixText||this.layerModified)&&((r=this.fixText)==null||r.remove(),this.fixText=new vl(this.layerId)),this.fixText.visible(this.layerId,this.str,this.textPosition,this.angle,Pc,Tc,this.textWidth,this.textHeight,void 0,this.viewGroupId),this.fixText&&(this._textId=(i=this.fixText.getId())!=null?i:-1)}setHighlightVisible(e){this.plane&&(e&&!this._isSetHighlight?(this._circleId!==-1&&this.plane.setHighLightPtNum(this._circleId,1,1),this._textId!==-1&&this.plane.setHighLightPtNum(this._textId,1,1),this._circleMaskId!==-1&&this.plane.setHighLightPtNum(this._circleMaskId,1,1),this._isSetHighlight=!0):!e&&this._isSetHighlight&&(this._circleId!==-1&&this.plane.removeHighLightPt(this._circleId),this._textId!==-1&&this.plane.removeHighLightPt(this._textId),this._circleMaskId!==-1&&this.plane.removeHighLightPt(this._circleMaskId),this._isSetHighlight=!1))}handleHighlight(e=!1){this.updateCircle(),this.updateCircleMask(!0),this.updateString(),this.setHighlightVisible(!0)}removeMask(){var e;this.circleMask&&(this.plane&&this._circleMaskId!==-1&&this.plane.removeHighLightPt(this._circleMaskId),(e=this.circleMask)==null||e.remove(),this.circleMask=null,this._circleMaskId=-1)}visible(){this.updateCircle(),this.updateString(),this.removeMask(),this.setHighlightVisible(!1)}highlight(e=!1){this.handleHighlight(e)}modify(e,r){super.modify(e,r),this._viewDataModel=e,r==="Only Main"?this.visible():r==="Main And Highlight"&&this.highlight(e.forceUpdateMask)}remove(){var e,r,i;this.setHighlightVisible(!1),(e=this.circle)==null||e.remove(),(r=this.zoomText)==null||r.remove(),(i=this.fixText)==null||i.remove(),this.removeMask(),this.circle=null,this.zoomText=null,this.fixText=null,this._circleId=-1,this._textId=-1,this._circleMaskId=-1}getBBoxs(){let e=this.circle.getBBox(),r;return this.renderModel==Hp.ZOOM?r=this.zoomText.getBBox():this.renderModel==Hp.FIXED&&(r=this.fixText.getBBox()),[e,r]}};var Y5=class extends Do{constructor(){super(...arguments);this._isSetHighlight=!1;this._textId=-1;this.lines=[];this.zoomText=null;this.fixText=null;this.lineAngle=0}get renderModel(){return le.pcbConfig.drcErrorZoom==="keepConstantSize"?Hp.FIXED:Hp.ZOOM}get plane(){return this.layerId?cn.getInstance().getLayer(this.layerId).layer.plane:null}get layerId(){var e;return(e=this._viewDataModel)==null?void 0:e.layerId}get startPoint(){var e;return(e=this._viewDataModel)==null?void 0:e.start}get endPoint(){var e;return(e=this._viewDataModel)==null?void 0:e.end}get manualHighLight(){var e;return(e=this._viewDataModel)==null?void 0:e.manualHighLight}get viewGroupId(){var e;return this.getEngineGroupId((e=this._viewDataModel)==null?void 0:e.viewGroupId)}get str(){var i,n;let e=((i=this._viewDataModel)==null?void 0:i.ruleText)||"",r=((n=this._viewDataModel)==null?void 0:n.text)||"";if(e&&r)return`<${e}(${r})`}get color(){var e;return(e=this._viewDataModel)==null?void 0:e.color}get textAngle(){let e=(this.lineAngle+2*zh)%(2*zh);return e>=zh/2&&e<=3*zh/2?this.lineAngle+zh:this.lineAngle}get textWidth(){var e;return((e=this._viewDataModel)==null?void 0:e.textWidth)||0}get textHeight(){let e=new dt;return this.renderModel===Hp.FIXED?6:e.mm2mil(.5)/10}get textColor(){var e;return(e=this._viewDataModel)==null?void 0:e.textColor}get highlightColor(){var e;return(e=this._viewDataModel)==null?void 0:e.highlightColor}updateLines(){var i,n;this.lines.forEach(s=>s.remove()),this.lines=[];let e=new _e;if(!((i=this._viewDataModel)!=null&&i.path))return;for(let s of this._viewDataModel.path){if(s instanceof M){let a=new Ds(this.layerId);a.visible(this.layerId,s.start().clone(),s.end().clone(),.01,this.color,this.viewGroupId),this.lines.push(a)}else if(s instanceof q){let a=new Ka(this.layerId),l=s.center,c=s.ry,h=Xh(s.startAngle),u=Xh(s.sweepAngle),d=u+h,p=u>=0?ae.CCW:ae.CW;a.visible(this.layerId,l,c,.01,h,d,p,this.color,this.viewGroupId),this.lines.push(a)}e.ext1(s.bbox())}let r=(n=e.build())==null?void 0:n.center();this.textPosition=new S(r.x,r.y+1)}updateText(){this.str&&(this.renderModel===Hp.ZOOM?this.updateZoomText():this.updateFixedText())}updateZoomText(){var e;this.zoomText||(this.zoomText=new QD(this.layerId)),this.zoomText.visible(this.layerId,this.str,this.textPosition,this.textAngle,this.textWidth,this.textHeight,void 0,this.viewGroupId),this._textId=(e=this.zoomText.getId())!=null?e:-1}updateFixedText(){var e;this.fixText||(this.fixText=new vl(this.layerId)),this.fixText.visible(this.layerId,this.str,this.textPosition,this.textAngle,Pc,Tc,this.textWidth,this.textHeight,this.textColor,this.viewGroupId),this._textId=(e=this.fixText.getId())!=null?e:-1}setHighlightVisible(e){this.plane&&(e&&!this._isSetHighlight?(this.lines.forEach(r=>{let i=r.getId();i!==-1&&this.plane.setHighLightPtNum(i,1,1)}),this._textId!==-1&&this.plane.setHighLightPtNum(this._textId,1,1),this._isSetHighlight=!0):!e&&this._isSetHighlight&&(this.lines.forEach(r=>{let i=r.getId();i!==-1&&this.plane.removeHighLightPt(i)}),this._textId!==-1&&this.plane.removeHighLightPt(this._textId),this._isSetHighlight=!1))}visible(){this.updateLines(),this.updateText(),this.setHighlightVisible(!1)}highlight(){this.visible(),this.setHighlightVisible(!0)}modify(e,r){super.modify(e,r),this._viewDataModel=e,r==="Only Main"?this.visible():r==="Main And Highlight"&&this.highlight()}remove(){var e,r;this.setHighlightVisible(!1),this.lines.forEach(i=>i.remove()),this.lines=[],(e=this.zoomText)==null||e.remove(),(r=this.fixText)==null||r.remove(),this.zoomText=null,this.fixText=null,this._textId=-1,this._isSetHighlight=!1}getBBoxs(){let e=[],r=new _e;this.lines.forEach(n=>{let s=n.getBBox();s&&r.ext1(s)}),e.push(r.build());let i=null;return this.renderModel===Hp.ZOOM&&this.zoomText?i=this.zoomText.getBBox():this.fixText&&(i=this.fixText.getBBox()),i&&e.push(i),e}};var PAe=class{constructor(){this.groupMap=new Map;this.tempMap=new Map;this.fpcOrConstraintIdMap=new Map;this.sameModel=new Set([23,2,21,6])}isMatch(t,e){switch(e){case 0:return t instanceof bz;case 1:return t instanceof Pz;case 2:return t instanceof Tz;case 3:return t instanceof EL;case 24:return t instanceof kL;case 4:return t instanceof Sz;case 5:return t instanceof Ez;case 6:return t instanceof Oz;case 7:return t instanceof Az;case 8:return t instanceof _z;case 9:return t instanceof vz;case 10:return t instanceof Jz;case 11:return t instanceof xz;case 12:return t instanceof qz;case 13:return t instanceof Kv;case 14:return t instanceof $z;case 15:return t instanceof Kz;case 21:return t instanceof DP;case 22:return t instanceof Qz;case 23:return t instanceof eY;case 25:return t instanceof Zz;case 27:return t instanceof Cz;case 28:return t instanceof tY;case 29:return t instanceof rY;case 31:return t instanceof nY;case 32:return t instanceof oY;case 33:return t instanceof sY;case 17:return t instanceof H5;case 18:return t instanceof W5;case 19:return t instanceof z5;case 20:return t instanceof Y5;default:return!1}}createNewView(t){switch(t){case 22:return new Qz;case 0:return new bz;case 9:return new vz;case 23:return new eY;case 2:return new Tz;case 8:return new _z;case 1:return new Pz;case 21:return new DP;case 25:return new Zz;case 12:return new qz;case 24:return new kL;case 3:return new EL;case 13:return new Kv;case 27:return new Cz;case 4:return new Sz;case 5:return new Ez;case 6:return new Oz;case 7:return new Az;case 10:return new Jz;case 11:return new xz;case 14:return new $z;case 15:return new Kz;case 16:return new Kv;case 28:return this.panelizeView==null&&(this.panelizeView=new tY),this.panelizeView;case 29:return new rY;case 31:return new nY;case 32:return new oY;case 33:return new sY;case 30:return new nte;case 17:return new H5;case 18:return new W5;case 19:return new z5;case 20:return new Y5;default:return null}}clearTemp(){this.tempMap=null}getMap4Type(t){return this.tempMap=this.groupMap.get(t),this.tempMap==null&&(this.tempMap=new Map,this.groupMap.set(t,this.tempMap)),this.tempMap}getType(t){switch(t){case 23:return 2;case 2:return 23;case 21:return 6;case 6:return 21;default:return null}}createView(t,e,r){return this.view=r.get(t),!this.view&&this.sameModel.has(e)&&(this.view=this.getView(t,this.getType(e))),this.isMatch(this.view,e)?this.view:(this.view!=null&&(this.view.remove(),this.sameModel.has(e)&&this.delete(t,this.getType(e))),this.view=this.createNewView(e),r.set(t,this.view),this.view)}getView(t,e){var r;return(r=this.groupMap.get(e))==null?void 0:r.get(t)}delete(t,e){var i;if(this.tempMap=this.groupMap.get(e),this.tempMap==null)return;let r=this.tempMap.get(t);r!=null&&r.remove(),this.tempMap.delete(t),(i=this.fpcOrConstraintIdMap.get(e))==null||i.delete(t)}clear(){this.groupMap.clear(),this.fpcOrConstraintIdMap.clear()}iterator(t){e:for(let[,e]of this.groupMap)for(let[r,i]of e)if(t(i,r))break e}},R1=new PAe;var j5=class j5{constructor(){this.map={};this._netBaseRefreshStatus=0;this.engineGroupIdMap=new Map;this._lastGroupInfo=new Map;this.id=-1}static getInstance(){return j5.manager==null&&(j5.manager=new j5),j5.manager}getNetBaseRefreshStatus(t,e,r,i,n){let s=0,a=0;return s=Xp.update(s,a++,t),s=Xp.update(s,a++,e),s=Xp.update(s,a++,r),s=Xp.update(s,a++,i),s=Xp.update(s,a++,n),s}getNetBaseRefreshByStatus(t){Xp.has(t,0),Xp.has(t,0);let e=0,r=Xp.has(t,e++),i=Xp.has(t,e++),n=Xp.has(t,e++),s=Xp.has(t,e++),a=Xp.has(t,e++);return{topDiff:r,botDiff:i,multiDiff:n,topStiffenerDiff:s,botStiffenerDiff:a}}refreshBaseNetByLayerStatus(){var T;if(R1.fpcOrConstraintIdMap.size==0)return;let t=this.getLayer(47).status.visible,e=this.getLayer(1).status.visible,r=this.getLayer(2).status.visible,i=this.getLayer(12).status.visible,n=t!=e,s=t!=r,a=t!=i,l=(T=this.getLayer(1003))==null?void 0:T.status.visible,c=this.getLayer(58).status.visible,h=this.getLayer(59).status.visible,u=l!=c,d=l!=h,p=this.getNetBaseRefreshByStatus(this._netBaseRefreshStatus),m=n!=p.topDiff,g=s!=p.botDiff,y=a!=p.multiDiff,b=u!=p.topStiffenerDiff,P=d!=p.botStiffenerDiff;(m||g||y||b||P)&&(R1.fpcOrConstraintIdMap.forEach((I,C)=>{I.forEach(E=>{let O=R1.getView(E,C);if(O instanceof kL||O instanceof EL||O instanceof Kv){let _=O.layerId;(_==1&&m||_==2&&g||_==12&&y)&&(this.getLayer(_).status.visible?O.holeBaseNetVisible():O.holeBaseNetRemove()),(_==58&&b||_==59&&P)&&(this.getLayer(_).status.visible?O.fpcBaseNetVisible():O.fpcBaseNetRemove())}})}),this._netBaseRefreshStatus=this.getNetBaseRefreshStatus(n,s,a,u,d))}refresh(){this.refreshBaseNetByLayerStatus()}addLayer(t,e,r,i,n,s,a,l){if(this.scene||(this.scene=t,this.layerGroup=new Q2(void 0,!1,"planes"),this.scene.group.add(this.layerGroup)),this.map[e]==null){let c=new uee(t,e,r,i,n,s,this.checkIgnoreForceHighLight(e),a,this.layerGroup,l);return this.map[e]=c,c}else{let c=this.map[e];return c.order=r,c.copperOrder=l,c.activeColor=i,c.deactiveColor=n,c.status=s,c.isUnderGrid=a,c}}checkIgnoreForceHighLight(t){switch(t){case 48:case 51:case 50:case 49:return!0;default:return!1}}getLayer(t){return this.map[t]}deleteLayer(t){let e=this.map[t];e.clear(),delete this.map[t],this.layerGroup.remove(e.layer.plane)}getEngineGroupId(t){if(!t)return-1;if(!va.useWebgl)return this.id=this.engineGroupIdMap.get(t),this.id==null?(this.id=this.scene.addPtGroup(),this.engineGroupIdMap.set(t,this.id),this.id):this.id}removeEngineGroup(t){this.id=this.engineGroupIdMap.get(t),this.id!=null&&(this.engineGroupIdMap.delete(t),this.scene.removePtGroup(this.id))}setEngineGroupVisible(t,e){if(!this.engineGroupIdMap.has(t))return;let r=this.engineGroupIdMap.get(t),i=this._lastGroupInfo.get(r);i&&i.visible==e.visible&&i.highLightType==e.highLightType&&i.doubleRgb==e.doubleRgb||(this.scene.setPtGroup(r,e.visible,e.doubleRgb,e.highLightType,e.isForceHighLight),this._lastGroupInfo.set(r,e))}getHighLightPlane(t){return this.scene.getHighLightPlane(t)}setHighLightColor(t,e){return this.scene.setHighLightColor(t,e)}};j5.manager=null;var cn=j5;var OU=class{refresh(){}};var vme=class extends OU{constructor(t){super(),this.frame=t}notify(t){let e=cn.getInstance(),r;for(let i of t)r=i.getRenderData(),e.addLayer(this.frame.scene,r.layerId,r.order,r.activeColor,r.deactiveColor,r.layerState,r.isUnderGrid,r.copperOrder)}refresh(){cn.getInstance().refresh()}};function Y$e(o){return"getBBoxs"in o&&typeof o.getBBoxs=="function"}var xme=class{constructor(t=new EG){this.injectorMap=new Map;this.styleProxy=t}identifyViewType(t){return t instanceof H5||t instanceof W5||t instanceof z5||t instanceof Y5}initViewStyle(t){if(this.identifyViewType(t))try{this.styleProxy.setupDrcArrowStyle()}catch(r){console.error(`ViewChannel: Failed to initialize style ${r}`)}}inject(t,e){if(!this.isInjectable(t))return;let r=i=>{e.injectedBBox(i),i&&kt.insert(e)};this.injectorMap.set(t,r),this.injectViewBBox(t)}injectViewBBox(t){let e=this.injectorMap.get(t);if(e)try{let r=Y$e(t)?t.getBBoxs():null;e(r)}catch(r){console.error("ViewChannel: BBox injection failed:",t,r),e(null)}}remove(t){let e=this.injectorMap.get(t);e&&(e(null),this.injectorMap.delete(t))}isInjectable(t){let e=this.identifyViewType(t),r=Y$e(t);return e&&r&&!this.injectorMap.has(t)}};var Rme=class extends OU{constructor(){super(...arguments);this.viewChannel=new xme}notifyShape(e,r){if(e.size==0)return;let i,n,s,a,l=!1,c=R1.getMap4Type(r);for(let[h,u]of e){n=this.getEngineGroupId(h);for(let d of u)if(s=d.globalIndex,i=d.getViewState(),i=="Not Shown")d instanceof Ls&&d.resetReadRender(),R1.delete(s,r),this.viewChannel.remove(c.get(s));else{if(a=R1.createView(s,r,c),!a)continue;!l&&[17,18,19,20].includes(r)&&(this.viewChannel.initViewStyle(a),l=!0),a.engineGroupId=n,a.modify(d.getRenderData(),i),d.resetModelNotify&&d.resetModelNotify(),this.viewChannel.inject(a,d)}}}notifyProfile(e,r){var c;if(e.size==0)return;let i,n,s,a,l=R1.getMap4Type(r);for(let[h,u]of e){n=this.getEngineGroupId(h);for(let d of u)if(s=d.globalIndex,i=d.getViewState(),i=="Not Shown")d instanceof Ls&&d.resetReadRender(),R1.delete(s,r);else{if(a=R1.createView(s,r,l),!a)continue;if(this.isFpcOrConstraint(d)){let p=R1.fpcOrConstraintIdMap.get(r);p==null&&(p=new Set,R1.fpcOrConstraintIdMap.set(r,p)),p.add(s)}else(c=R1.fpcOrConstraintIdMap.get(r))==null||c.delete(s);a.engineGroupId=n,a.modify(d.getRenderData(),i),d.resetModelNotify&&d.resetModelNotify()}}}notifyLineOrArc(e,r){for(let[i,n]of r)if(i==null){let s=new Map;for(let a of n){let l=a.viewGroupId,c=s.get(l);c==null&&(c=new Set,s.set(l,c)),c.add(a)}this.notifyShape(s,e)}else this.notifyShape(r,e)}notify(e){if(e.size==0)return;this.refreshHighLightColor();let r=e.get(8);r!=null&&(this.notifyLineOrArc(8,this.getGroupIdMap(r)),e.delete(8));let i=e.get(1);i!=null&&(this.notifyLineOrArc(1,this.getGroupIdMap(i)),e.delete(1));for(let[n,s]of e)n==3||n==24||n==13?this.notifyProfile(this.getGroupIdMap(s),n):this.notifyShape(this.getGroupIdMap(s),n),s.length=0;R1.clearTemp()}getGroupIdMap(e){let r=new Map,i;for(let n of e){i=n.viewGroupId;let s=r.get(i);s==null&&(s=new Set,r.set(i,s)),s.add(n)}return r}getEngineGroupId(e){if(e)return cn.getInstance().getEngineGroupId(e)}isFpcOrConstraint(e){if(e.model&&e.model instanceof or){let r=e.model.component;return r==null?!1:r instanceof tu||r instanceof Dh}}refixHighLightColor(e){if(e.equals(ee.BLACK,!0)){let r=ee.DefaultHighLightColor;return e.alpha==1?r:ee.build(r.r,r.g,r.b,e.alpha)}return e}refreshHighLightColor(){if(!DBe())return;let e=this.refixHighLightColor(lY(!1)),r=this.refixHighLightColor(lY(!0)),i=cn.getInstance();i.setHighLightColor(e,1),i.setHighLightColor(r,0),wBe(!1)}};var j$e=!!window["USE-IFRAME-FOR-MAIN"];if(!j$e)try{Q().sensorsDataFromTopWindow}catch{j$e=window["USE-IFRAME-FOR-MAIN"]=!0}var om=new hee(QA);function X$e(){om.renderFrame(),requestAnimationFrame(X$e)}requestAnimationFrame(X$e);var hwt=new Rme,uwt=new vme(om);Mo.setState(hwt);Mo.setLayerState(uwt);he.subscribe("updateModify",()=>{Mo.modify()});function q$e(){let o=0;for(let t of oy){t.active&&(o=t.layerId);let e=Pe.addPcbLayer(t.layerId,t.type,t.name,t.order,t.activeColor,t.deactiveColor,t.active,t.layerStatus);e.layerID===57&&(e.locked=!0)}Pe.setActiveLayerId(o)}var X5=class X5{static getInstance(){return X5.manager==null&&(X5.manager=new X5),X5.manager}constructor(){this._currUser=f2.getInstance()}get currUser(){return this._currUser.currUser}get selectMap(){return this._currUser.selectMap}get selectIdMap(){return this._currUser.selectIdMap}get colorMap(){return this._currUser.colorMap}get maskColorMap(){return this._currUser.maskColorMap}async otherSelect(t,e,r=!1){var h,u;if(t==this.currUser)return;let i=new Jt,n=this.selectMap.get(t);n||(n=new Set,this.selectMap.put(t,n));let s=new Set,a=[],l=new Set;e.forEach(d=>{n.has(d.id)?s.add(d.id):a.push(d),l.add(d.id)}),n.forEach(d=>{if(s.has(d))return;let p=this.selectIdMap.get(d);if(p&&(p.selectUserIds.delete(t),p.selectUserIds.size==0&&this.selectIdMap.del(d),p.currId==t)){let m=i.getItemByType(d,p.type);p.selectUserIds.size>0?(p.currId=Array.from(p.selectUserIds).shift(),m.click(!1,!0)):m&&!m.isEmpty&&m.visible(!0)}});let c=this.colorMap.get(t);if(!c){let d=(await he.windowBridge.rpcCall("getUserColor",t,Q())).message;if(!d){console.warn("\u989C\u8272\u83B7\u53D6\u4E0D\u5230"),r||this.destroy(t);return}c=ee.of3(d),this.maskColorMap.put(t,c);let p=(u=(h=le)==null?void 0:h.themeConfig)==null?void 0:u.canvasTheme;if(p){let m=p.selectTransparency;c=ee.of6(c,1-m)}this.colorMap.put(t,c)}a.forEach(({type:d,id:p})=>{let m=this.selectIdMap.get(p);if(m){m.selectUserIds.add(t);return}let g=i.getItemByType(p,d),y=new Set;if(y.add(t),!g||g.isEmpty){m={selectUserIds:y,currId:t,type:d},this.selectIdMap.put(p,m);return}g.isHighLight?m={selectUserIds:y,currId:this.currUser,type:d}:(m={selectUserIds:y,currId:t,type:d},g.click(!1,!0)),this.selectIdMap.put(p,m)}),this.selectMap.put(t,l),he.publish("updateFrame","")}destroy(t){t!=this.currUser&&(this.otherSelect(t,[],!0),this.colorMap.del(t),this.selectMap.del(t),this.maskColorMap.del(t))}};X5.manager=null;var Dme=X5;var wme=class{constructor(){this.lastStr=""}};var Lme=class extends wme{constructor(){super();this.selectHandle=null;this.selectManage=null;this.setHandle(Dme.getInstance()),this.setManage(ze)}setHandle(e){this.selectHandle=e}setManage(e){this.selectManage=e}async onSelected(e,r,i){var s;if(!i)return;let n=JSON.parse(i);n.action=="select"&&await((s=this.selectHandle)==null?void 0:s.otherSelect(e.uuid,n.data))}getSelect(){return this.selectManage.getSelectStr()}onDestroy(e,r){var i;(i=this.selectHandle)==null||i.destroy(e)}};var Mme=class{supports(t){return!1}execute(t){}};var Nme=class extends Mme{supports(t){return t.operation=="Main"}execute(t){switch(t.action){case"add":case"modify":{let e=t.data;e instanceof r1?this.uploadRule(e):this.uploadRuleSelector(e);break}case"delete":{let e=t.data;e instanceof r1?R.getInstance().compiler.deleteRule(Nf(Cre(e)),e.name):R.getInstance().compiler.deleteRuleSelector(Ire(e));break}}}checkModelRule(t){t instanceof or}uploadRuleSelector(t){R.getInstance().compiler.uploadRuleSelector(Sr.getInstance().encode("RULE_SELECTOR",t))}uploadRule(t){R.getInstance().compiler.uploadRule(Sr.getInstance().encode("RULE",t))}uploadRuleTemplate(){R.getInstance().compiler.uploadRuleTemplate(Sr.getInstance().encode("RULE_TEMPLATE"))}};(()=>{let o=ee.build(1,1,1,.5),t=ee.build(1,1,1,1),e=Ze.getInstance().addHelpLayer(1001,"OTHER","DRCError",new ny(3),ee.of1(16438793),ee.of1(16438793)),r=Ze.getInstance().addHelpLayer(1002,"OTHER","montu",new ny(3),o,o),i=Ze.getInstance().addHelpLayer(1005,"OTHER","montu2",new ny(3),t,t),n=Ze.getInstance().addHelpLayer(1003,"OTHER","TextColor",new ny(3),o,o),s=Ze.getInstance().addHelpLayer(1004,"OTHER","PartitionLayer",new ny(3),t,t),a=Ze.getInstance().addHelpLayer(1006,"OTHER","board",new ny(3),ee.of1(0),ee.of1(0)),l=new sC(e,!1,4);pd.DRCLayer=l,new sC(r,!1,1),new sC(n,!1,5),new sC(s,!1,6),new sC(i,!1,1),new sC(a,!1,1,!0);let c=async h=>{var Z,ie,de,me;if(!h)return;let{docType:u,tabId:d,saveFile:p,unActive:m,highlightItems:g,commSystemSetting:y,pcbConfig:b,drcCustomSetting:P,isNew:T,owner:I,importFlag:C,source:E,customerCode:O,clientOnlineService:_,isReadOnlyMode:x,isConcurrentStrictMode:v,pcbLevelType:D,isFromBasicLibrary:w,alignNeedSelectRefObject:F,alignNeedSelectRefObjectForCenters:H,name:z,projectTitle:V,footprintIsConnectDevice:W,hideDxfLoading:L,activeLayerId:k,unChangeRepairLineTool:N,isPlaceViasAutoShove:U,isPreview:B,dataStr:G,isOldDataString:Y,user:X,currOpenProjectId:K,isNeedInitRuleWhenCreatedByCBBTemplate:J,envFlag:se,isCheckedCrossProbeMode:ce}=h,te=R.getInstance();On.getInstance().start();let oe=((Z=document.querySelector('meta[name="editorMainVersion"]'))==null?void 0:Z.getAttribute("content"))||"",$="rpcInitFrameInfoInit-time";Cn($),le.changeRepairLineTool=!N,le.isPlaceViasAutoShove=!!U,te.editorVersion=oe,te.owner=I,te.importFlag=C,te.source=E,te.customerCode=O,te.clientOnlineService=_,te.isReadOnlyMode=x,te.isConcurrentStrictMode=v,te.name=z,te.projectTitle=V,te.currOpenProjectId=K,te.workerName="main",Mt.setIsChildPcb(D=="CHILD"),we.needSelectAlignRefObject=F,we.needSelectAlignRefObjectForCenters=H,we.isCheckedCrossProbeMode=ce,u==3&&!B&&(te.currVersionUUid=(await he.windowBridge.rpcCall("getCurrVersion","",Q())).message||""),Qze(y,P,B,u),await om.initScene(u),Jze(u,d,B,se),!B&&u===4&&(t$.updateLayerWithFootprint(),we.footprintIsConnectDevice=W),b&&(eYe(b),sce(b.PCB_REALTIME_DRC.checked,!0)),q$e();let fe=!B&&u===3&&!Ra.unRebuildRatline&&FM.userWorker&&!m;va.multiThreadingOnOpen=fe;let Oe;if(fe){let Se=te.id,Re=te.projectId,Je={uuid:Se,docType:u,projectId:Re,env:{tabId:te.tabId,windowTabId:(ie=Q())==null?void 0:ie._TAB_ID_}},Ke=tm.getInstance();await Ke.addWorker(`editor?entry=pcb-ratline-worker.js${Q().location.search.replace(/\?/,"&")}`,!1,"pcb-ratline-worker").rpcCall("rebuildRatlineInWorker",{world:Je}),va.rebuildingRatlineInWorker=!0,Oe=Ke.getLastWorkerId(),On.getInstance().allowPull=!1}let Te=te.compiler,ue=new _2(Te);if(B&&G)await ue.parseSourceByCompiler(G,Y);else try{!B&&Te instanceof gp&&(ue.mulSelect=!0),await ue.init(new ere(ue))}catch(Se){if(!B)throw new Error(Se)}if(T=ue.isNew,ue.build({unRebuildRatline:fe}),f2.getInstance().currentUser=X,R.getInstance().doctype==4||R.getInstance().doctype==23){let Se=new nD(new vy);Se.setProxy(new sD),Te.setHandle(Se)}else{let Se=new kV;Se.setProxy(new sD),Se.setTool(new vy),Se.setAttrUtils(new BV),Te.setHandle(Se),ue.mulSelect&&Te.setSelectHandle(new Lme),bo.getInstance().syncPartitionStatus()}if(sy.getInstance().set("Main"),Nk.getInstance().subscript(new Nme),QI(!m,!1,T),!te.isactive){he.publish("updateModify","");return}AXe(),tYe(),Xi($);let be=se=="cnc-preview";if(se=="silk-preview")TT.getInstance().init();else if(B||be){he.publish("DelayAutoAdaptAll",""),he.publish("updateFrame",""),u!==3&&jt.setVisible(2,!1),L&&he.publish("toggleDxfLoadingState",!1,Q());let Se=Pe.getAllLayer(),Re=be?HO:HO.concat(wL);for(let Je of Se)Je.config&&(Re.indexOf(Je.layerID)>=0?Je.visible=!1:Je.visible=!0)}else if(!B&&u===4)T&&(te.unit=le.pcbConfig.FOOTPRINT_UNIT),lc.getTemplate().checkMustAttr(),Pe.checkLayerPhys(),he.publish("DelayAutoAdaptAll",""),he.publish("saveFootprintDataSuccess",h),he.publish("flushAttrPlane","");else if(!B&&u===3){(T||J)&&await Hu.initRuleManager();let Se=!0;if(Ti.getAllItem().length>0?Se=!1:Se=!0,Se&&!Ra.unRebuildCopperWhenOpening){let Re=vR();if(Re.length>0&&Ti.getAllItem().length===0){let Je=R.getInstance().tabId,Ke=['<span class="i18n">Found un-poured copper region object(s), suggesting rebuild copper region(s) at copper region manager.</span>',"<span>{</span>",...Re.map(Gt=>({attr:{id:Gt.globalIndex,pcbId:Je},text:`${Tr}${Gt.number}`})),"<span>}</span>"];he.publish("bottomBarLog",{type:"warn",msg:Ke},Q())}}QI(!m,!0,T),T&&(te.unit=le.pcbConfig.UNIT),he.publish("DelayAutoAdaptAll",""),Pe.checkLayerPhys()}if(he.publish("updateTopMenuItemCheckStatus","",Q()),p&&he.publish("file_save","",Q()),g&&he.publish("highlightItems",{globalIndexArr:g}),k&&!isNaN(k)&&Pe.setActiveLayerId(k),T){re.getInstance().correctDefault();let Se=(de=y==null?void 0:y.PCB_THEME)==null?void 0:de.canvasColorTheme,Re=(me=y==null?void 0:y.PCB_THEME)==null?void 0:me.canvasColorThemeSelected,Je=Se==null?void 0:Se.filter((Ke,Gt)=>Ke.name==Re);Array.isArray(Je)&&Je.length>0&&t$.updateLayerWithPCB(Je[0].list,"NORMAL")}if(Pe.checkDefault(),Pe.hiddenAllPlanes(),we.gridType=te.gridType,we.multiType=te.multiType,we.multiRatio=te.multiRatio,Pe.setActiveLayerId(Ze.getInstance().activeLayer),T&&new Qd("2.0",te.doctype,te.compiler).uploadInitData(),!w){let Se=tm.getInstance();Se.hasWorker(Oe)?Se.setWorkerState(Oe,"mainThreadRunEnd",!0):he.publish("hideLoading","",Q())}return LHe&&Pe.getAllCopperLayer().length>=6&&he.publish("doCommand_ui",["checkJLCPCBPersonCoupon"],Q()),he.publish("updateModify",""),Te instanceof gp&&(Te.initFinished=!0),pd.initialize(),!0};he.messageBus.rpcService("rpcInitFrameInfo",c)})();function $$e(){he.subscribe("delete",o=>{if(!(o!=null&&o.isBase)){if(o instanceof mt||o instanceof _t){Ky.getInstance().delete(o,o.globalIndex);return}kt.remove(o),dwt(o,o.globalIndex)}}),he.subscribe("autoFill",()=>{pwt()}),he.subscribe("autoRefresh3DColor",()=>{fwt()}),he.subscribe("updateExpansion",()=>{mwt()}),he.messageBus.rpcService("/pcb/cncPolygonUpdate",async o=>{if(!isNaN(o.scale)&&o.scale!=1){let n=of();if(n){let s=n.center(),a=Ae.scale(o.scale,o.scale,1).setOrigin(s.x,s.y,1);[].concat(pt.getAllItem(),Xt.getAllItem(),Kt.getAllItem(),pr.getAllItem(),ri.getAllItem()).forEach(l=>{l.transform(a),he.publish("hasModifyPcbItem",l)})}he.publish("flushSelectingInfo",""),he.publish("flushService","")}if(o.apply2All&&o.depth>0&&(o.id="",r()),!o.id)return e(),!0;let t=pt.getItem(o.id)||Kt.getItem(o.id);if(!t)return!1;try{let n=t.getComponent();if(n&&n instanceof ml){if(isNaN(o.thickness))return!0;n.stretchLength=Math.abs(o.thickness)}else{if(isNaN(o.depth))return!0;e(),i(t)}}catch{return!1}return!0;function e(){if(isNaN(o.depth))return;let n=Kt.getAllItem(),s=pt.getAllItem();[].concat(n,s).some(a=>{let l=a.getComponent();return l&&l instanceof ml?(l.stretchLength=Math.abs(o.thickness),!0):!1})}function r(){if(isNaN(o.thickness))return;let n=Kt.getAllItem(),s=pt.getAllItem();[].concat(n,s).some(a=>{i(a)})}function i(n){if(!n)return;let s=n.getComponent();if(!(s&&s instanceof ml))if(n.type="3D Shell - Top Slot Region",n.layerId=54,s instanceof wh)s.type="Top",s.slotDepth=Math.abs(o.depth);else{let a=[4,8,16],l=new wh("Top",Math.abs(o.depth),a,"");n.setComponent(l)}}})}function dwt(o,t){let e=null;if(typeof o.getParent=="function"&&(e=o.getParent()),e instanceof He&&(e.model.deleteCopper(t),e.deleteCopperResult(o,t)),Ye.delete(o),ze.deleteItem(o),o instanceof Pr)o.type=="Board"?us.getInstance().deleteBoard(o):Kt.delete(o);else if(o instanceof ke)Ar.delete(o),ts.delete(o.model),Hi.deleteComponent(o.model);else if(o instanceof ux)ts.delete(o);else if(o instanceof Jr)Ti.delete(o);else if(o instanceof qs)Yo.delete(o);else if(o instanceof Mn)Bn.delete(o);else if(o instanceof _i){let r=o.getParent();r!=null&&$o.getInstance().deletePadLen(r.globalIndex,o.globalIndex),Qt.delete(o)}else if(o instanceof Gi)zn.delete(o);else if(o instanceof lt)o.type=="Board"?us.getInstance().deleteBoard(o):pt.delete(o);else if(o instanceof sn){let r=o.getParent();r!=null&&$o.getInstance().deletePadLen(r.globalIndex,o.globalIndex),Qt.delete(o)}else o instanceof Ga?os.delete(o):o instanceof da?jo.delete(o):o instanceof rr?o.type=="Board"?us.getInstance().deleteBoard(o):Xt.delete(o):o instanceof hh?ah.delete(o):o instanceof lr?ri.delete(o):o instanceof Ge?pr.delete(o):o instanceof Ps?So.delete(o):o instanceof Ue&&Wr.delete(o);Bo.deleteByPcbItem([o],!0),Ht.delete(o)}function pwt(){pt.autoFill(),Kt.autoFill(),Xt.autoFill()}function fwt(){pt.autoRefreshAll(),Kt.autoRefreshAll(),Xt.autoRefreshAll()}function mwt(){Qt.updateExpansion(),Wr.updateExpansion()}function K$e(){he.subscribe("updateIFrameState",o=>{let t=o.head;$t.getInstance().close(),To.getInstance().cancel(),t.to===R.getInstance().tabId?QI(o.body.active):QI(!1),(R.getInstance().doctype==3||R.getInstance().doctype==4)&&!R.getInstance().isactive&&(R.getInstance().isactive=!0,he.publish("tool","dropdrag"),R.getInstance().isactive=!1),R.getInstance().doctype===4&&R.getInstance().isactive&&he.publish("flushAttrPlane",{isUpdateDeviceData:!0}),23==R.getInstance().doctype&&we.synchronize()},Q()),he.messageBus.subscribe("switchGridType",o=>{let t=!1;we.gridType!=o&&(we.gridType=o,t=!0),le.getAssociationPCBCanvasGridType()==1&&we.multiType!=o&&(we.multiType=o,t=!0),t&&(np(),_me(),he.publish("flushSelectingInfo",""),he.publish("flushService",""))}),he.messageBus.subscribe("switchMultiGridType",o=>{let t=!1;we.multiType!=o&&(we.multiType=o,t=!0),le.getAssociationPCBCanvasGridType()==1&&we.gridType!=o&&(we.gridType=o,t=!0),t&&(np(),he.publish("flushSelectingInfo",""),he.publish("flushService",""))}),he.messageBus.subscribe("switchMultiGridRatio",o=>{we.multiRatio!=o&&(we.multiRatio=o,np(),he.publish("flushSelectingInfo",""),he.publish("flushService",""))})}$$e();K$e();})();
/*! Bundled license information:

is-buffer/index.js:
  (*!
   * Determine if an object is a Buffer
   *
   * @author   Feross Aboukhadijeh <https://feross.org>
   * @license  MIT
   *)

jszip/dist/jszip.min.js:
  (*!
  
  JSZip v3.10.1 - A JavaScript class for generating and reading zip files
  <http://stuartk.com/jszip>
  
  (c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
  Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
  
  JSZip uses the library pako released under the MIT license :
  https://github.com/nodeca/pako/blob/main/LICENSE
  *)

kitsune/dist/index.js:
  (*! Bundled license information:
  
  three/build/three.core.js:
  three/build/three.module.js:
    (**
     * @license
     * Copyright 2010-2024 Three.js Authors
     * SPDX-License-Identifier: MIT
     *)
  *)

lc-protocol/dist/index.js:
  (*! Bundled license information:
  
  crypto-js/ripemd160.js:
    (** @preserve
    	(c) 2012 by Cédric Mesnil. All rights reserved.
    
    	Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
    
    	    - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
    	    - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
    
    	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    	*)
  
  crypto-js/mode-ctr-gladman.js:
    (** @preserve
     * Counter block mode compatible with  Dr Brian Gladman fileenc.c
     * derived from CryptoJS.mode.CTR
     * Jan Hruby jhruby.web@gmail.com
     *)
  *)

lc-editor-common/dist/index.js:
  (*! Bundled license information:
  
  lc-protocol/dist/index.js:
    (*! Bundled license information:
    
    crypto-js/ripemd160.js:
      (** @preserve
      	(c) 2012 by Cédric Mesnil. All rights reserved.
      
      	Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
      
      	    - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
      	    - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
      
      	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      	*)
    
    crypto-js/mode-ctr-gladman.js:
      (** @preserve
       * Counter block mode compatible with  Dr Brian Gladman fileenc.c
       * derived from CryptoJS.mode.CTR
       * Jan Hruby jhruby.web@gmail.com
       *)
    *)
  *)

lc-jspdf/dist/index.js:
  (**
   * @license
   * Copyright (c) 2017 Aras Abbasi
   *
   * Licensed under the MIT License.
   * http://opensource.org/licenses/mit-license
   *)
  (**
   * @license
   * Copyright (c) 2014 Steven Spungin (TwelveTone LLC)  steven@twelvetone.tv
   *
   * Licensed under the MIT License.
   * http://opensource.org/licenses/mit-license
   *)
  (**
   * @license
   * jsPDF filters PlugIn
   * Copyright (c) 2014 Aras Abbasi
   *
   * Licensed under the MIT License.
   * http://opensource.org/licenses/mit-license
   *)
  (**
   * @license
   * Copyright (c) 2012 chick307 <chick307@gmail.com>
   *
   * Licensed under the MIT License.
   * http://opensource.org/licenses/mit-license
   *)
  (**
   * @license
   * ====================================================================
   * Copyright (c) 2013 Youssef Beddad, youssef.beddad@gmail.com
   *               2013 Eduardo Menezes de Morais, eduardo.morais@usp.br
   *               2013 Lee Driscoll, https://github.com/lsdriscoll
   *               2014 Juan Pablo Gaviria, https://github.com/juanpgaviria
   *               2014 James Hall, james@parall.ax
   *               2014 Diego Casorran, https://github.com/diegocr
   *
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to deal in the Software without restriction, including
   * without limitation the rights to use, copy, modify, merge, publish,
   * distribute, sublicense, and/or sell copies of the Software, and to
   * permit persons to whom the Software is furnished to do so, subject to
   * the following conditions:
   *
   * The above copyright notice and this permission notice shall be
   * included in all copies or substantial portions of the Software.
   *
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
   * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
   * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
   * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
   * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   * ====================================================================
   *)
*/
//# sourceMappingURL=https://modules.lceda.cn/pro-pcb/3.2.131.14eacd6b/js/pcb-panelize.js.map
